diff --git a/TTS/Kokoro/.venv/Lib/site-packages/__pycache__/docopt.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/__pycache__/docopt.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ad46a9016ae88f18d7f4d0895612e16aaa56ed3c Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/__pycache__/docopt.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/__pycache__/isympy.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/__pycache__/isympy.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d67108b06ad53a810a8054d7bfe2ba62d04b0a1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/__pycache__/isympy.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/__pycache__/six.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/__pycache__/six.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d159c7e8bf57025bce6e564cc65beae76358baf3 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/__pycache__/six.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/__pycache__/soundfile.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/__pycache__/soundfile.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..42b6b455e351fb4778959f3d1f788e89ef15135f Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/__pycache__/soundfile.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/_distutils_hack/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/_distutils_hack/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..94f71b99ecefd27e6cf3fd06fc3c0eef5fd73910 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/_distutils_hack/__init__.py @@ -0,0 +1,239 @@ +# don't import any costly modules +import os +import sys + +report_url = ( + "https://github.com/pypa/setuptools/issues/new?template=distutils-deprecation.yml" +) + + +def warn_distutils_present(): + if 'distutils' not in sys.modules: + return + import warnings + + warnings.warn( + "Distutils was imported before Setuptools, but importing Setuptools " + "also replaces the `distutils` module in `sys.modules`. This may lead " + "to undesirable behaviors or errors. To avoid these issues, avoid " + "using distutils directly, ensure that setuptools is installed in the " + "traditional way (e.g. not an editable install), and/or make sure " + "that setuptools is always imported before distutils." + ) + + +def clear_distutils(): + if 'distutils' not in sys.modules: + return + import warnings + + warnings.warn( + "Setuptools is replacing distutils. Support for replacing " + "an already imported distutils is deprecated. In the future, " + "this condition will fail. " + f"Register concerns at {report_url}" + ) + mods = [ + name + for name in sys.modules + if name == "distutils" or name.startswith("distutils.") + ] + for name in mods: + del sys.modules[name] + + +def enabled(): + """ + Allow selection of distutils by environment variable. + """ + which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'local') + if which == 'stdlib': + import warnings + + warnings.warn( + "Reliance on distutils from stdlib is deprecated. Users " + "must rely on setuptools to provide the distutils module. " + "Avoid importing distutils or import setuptools first, " + "and avoid setting SETUPTOOLS_USE_DISTUTILS=stdlib. " + f"Register concerns at {report_url}" + ) + return which == 'local' + + +def ensure_local_distutils(): + import importlib + + clear_distutils() + + # With the DistutilsMetaFinder in place, + # perform an import to cause distutils to be + # loaded from setuptools._distutils. Ref #2906. + with shim(): + importlib.import_module('distutils') + + # check that submodules load as expected + core = importlib.import_module('distutils.core') + assert '_distutils' in core.__file__, core.__file__ + assert 'setuptools._distutils.log' not in sys.modules + + +def do_override(): + """ + Ensure that the local copy of distutils is preferred over stdlib. + + See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401 + for more motivation. + """ + if enabled(): + warn_distutils_present() + ensure_local_distutils() + + +class _TrivialRe: + def __init__(self, *patterns) -> None: + self._patterns = patterns + + def match(self, string): + return all(pat in string for pat in self._patterns) + + +class DistutilsMetaFinder: + def find_spec(self, fullname, path, target=None): + # optimization: only consider top level modules and those + # found in the CPython test suite. + if path is not None and not fullname.startswith('test.'): + return None + + method_name = 'spec_for_{fullname}'.format(**locals()) + method = getattr(self, method_name, lambda: None) + return method() + + def spec_for_distutils(self): + if self.is_cpython(): + return None + + import importlib + import importlib.abc + import importlib.util + + try: + mod = importlib.import_module('setuptools._distutils') + except Exception: + # There are a couple of cases where setuptools._distutils + # may not be present: + # - An older Setuptools without a local distutils is + # taking precedence. Ref #2957. + # - Path manipulation during sitecustomize removes + # setuptools from the path but only after the hook + # has been loaded. Ref #2980. + # In either case, fall back to stdlib behavior. + return None + + class DistutilsLoader(importlib.abc.Loader): + def create_module(self, spec): + mod.__name__ = 'distutils' + return mod + + def exec_module(self, module): + pass + + return importlib.util.spec_from_loader( + 'distutils', DistutilsLoader(), origin=mod.__file__ + ) + + @staticmethod + def is_cpython(): + """ + Suppress supplying distutils for CPython (build and tests). + Ref #2965 and #3007. + """ + return os.path.isfile('pybuilddir.txt') + + def spec_for_pip(self): + """ + Ensure stdlib distutils when running under pip. + See pypa/pip#8761 for rationale. + """ + if sys.version_info >= (3, 12) or self.pip_imported_during_build(): + return + clear_distutils() + self.spec_for_distutils = lambda: None + + @classmethod + def pip_imported_during_build(cls): + """ + Detect if pip is being imported in a build script. Ref #2355. + """ + import traceback + + return any( + cls.frame_file_is_setup(frame) for frame, line in traceback.walk_stack(None) + ) + + @staticmethod + def frame_file_is_setup(frame): + """ + Return True if the indicated frame suggests a setup.py file. + """ + # some frames may not have __file__ (#2940) + return frame.f_globals.get('__file__', '').endswith('setup.py') + + def spec_for_sensitive_tests(self): + """ + Ensure stdlib distutils when running select tests under CPython. + + python/cpython#91169 + """ + clear_distutils() + self.spec_for_distutils = lambda: None + + sensitive_tests = ( + [ + 'test.test_distutils', + 'test.test_peg_generator', + 'test.test_importlib', + ] + if sys.version_info < (3, 10) + else [ + 'test.test_distutils', + ] + ) + + +for name in DistutilsMetaFinder.sensitive_tests: + setattr( + DistutilsMetaFinder, + f'spec_for_{name}', + DistutilsMetaFinder.spec_for_sensitive_tests, + ) + + +DISTUTILS_FINDER = DistutilsMetaFinder() + + +def add_shim(): + DISTUTILS_FINDER in sys.meta_path or insert_shim() + + +class shim: + def __enter__(self) -> None: + insert_shim() + + def __exit__(self, exc: object, value: object, tb: object) -> None: + _remove_shim() + + +def insert_shim(): + sys.meta_path.insert(0, DISTUTILS_FINDER) + + +def _remove_shim(): + try: + sys.meta_path.remove(DISTUTILS_FINDER) + except ValueError: + pass + + +if sys.version_info < (3, 12): + # DistutilsMetaFinder can only be disabled in Python < 3.12 (PEP 632) + remove_shim = _remove_shim diff --git a/TTS/Kokoro/.venv/Lib/site-packages/_distutils_hack/override.py b/TTS/Kokoro/.venv/Lib/site-packages/_distutils_hack/override.py new file mode 100644 index 0000000000000000000000000000000000000000..2cc433a4a55e3b41fa31089918fb62096092f89f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/_distutils_hack/override.py @@ -0,0 +1 @@ +__import__('_distutils_hack').do_override() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/_soundfile_data/COPYING b/TTS/Kokoro/.venv/Lib/site-packages/_soundfile_data/COPYING new file mode 100644 index 0000000000000000000000000000000000000000..c396169eea80f1b63a8029b12a61cee06154761e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/_soundfile_data/COPYING @@ -0,0 +1,503 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/_soundfile_data/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/_soundfile_data/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2a9208e406b147786993bfa21da7731fb922c7d7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/_soundfile_data/__init__.py @@ -0,0 +1,3 @@ +# this file makes _soundfile_data importable, so we can query its path +# when searching for the libsndfile binaries. +pass diff --git a/TTS/Kokoro/.venv/Lib/site-packages/_yaml/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/_yaml/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7baa8c4b68127d5cdf0be9a799429e61347c2694 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/_yaml/__init__.py @@ -0,0 +1,33 @@ +# This is a stub package designed to roughly emulate the _yaml +# extension module, which previously existed as a standalone module +# and has been moved into the `yaml` package namespace. +# It does not perfectly mimic its old counterpart, but should get +# close enough for anyone who's relying on it even when they shouldn't. +import yaml + +# in some circumstances, the yaml module we imoprted may be from a different version, so we need +# to tread carefully when poking at it here (it may not have the attributes we expect) +if not getattr(yaml, '__with_libyaml__', False): + from sys import version_info + + exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError + raise exc("No module named '_yaml'") +else: + from yaml._yaml import * + import warnings + warnings.warn( + 'The _yaml extension module is now located at yaml._yaml' + ' and its location is subject to change. To use the' + ' LibYAML-based parser and emitter, import from `yaml`:' + ' `from yaml import CLoader as Loader, CDumper as Dumper`.', + DeprecationWarning + ) + del warnings + # Don't `del yaml` here because yaml is actually an existing + # namespace member of _yaml. + +__name__ = '_yaml' +# If the module is top-level (i.e. not a part of any specific package) +# then the attribute should be set to ''. +# https://docs.python.org/3.8/library/types.html +__package__ = '' diff --git a/TTS/Kokoro/.venv/Lib/site-packages/addict/__pycache__/__init__.cpython-312.pyc b/TTS/Kokoro/.venv/Lib/site-packages/addict/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8f9d62b1e99602d7240d09ba4bb345f733a19fb1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/addict/__pycache__/__init__.cpython-312.pyc differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..9f6bc96c6dffe66668d531c1ef45a023820fdc67 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/METADATA @@ -0,0 +1,480 @@ +Metadata-Version: 2.4 +Name: rich +Version: 14.3.3 +Summary: Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal +License: MIT +License-File: LICENSE +Author: Will McGugan +Author-email: willmcgugan@gmail.com +Requires-Python: >=3.8.0 +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Framework :: IPython +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: MacOS +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: POSIX :: Linux +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Typing :: Typed +Provides-Extra: jupyter +Requires-Dist: ipywidgets (>=7.5.1,<9) ; extra == "jupyter" +Requires-Dist: markdown-it-py (>=2.2.0) +Requires-Dist: pygments (>=2.13.0,<3.0.0) +Project-URL: Documentation, https://rich.readthedocs.io/en/latest/ +Project-URL: Homepage, https://github.com/Textualize/rich +Description-Content-Type: text/markdown + +[![Supported Python Versions](https://img.shields.io/pypi/pyversions/rich)](https://pypi.org/project/rich/) [![PyPI version](https://badge.fury.io/py/rich.svg)](https://badge.fury.io/py/rich) + +[![Downloads](https://pepy.tech/badge/rich/month)](https://pepy.tech/project/rich) +[![codecov](https://img.shields.io/codecov/c/github/Textualize/rich?label=codecov&logo=codecov)](https://codecov.io/gh/Textualize/rich) +[![Rich blog](https://img.shields.io/badge/blog-rich%20news-yellowgreen)](https://www.willmcgugan.com/tag/rich/) +[![Twitter Follow](https://img.shields.io/twitter/follow/willmcgugan.svg?style=social)](https://twitter.com/willmcgugan) + +![Logo](https://github.com/textualize/rich/raw/master/imgs/logo.svg) + +[English readme](https://github.com/textualize/rich/blob/master/README.md) + • [简体中文 readme](https://github.com/textualize/rich/blob/master/README.cn.md) + • [正體中文 readme](https://github.com/textualize/rich/blob/master/README.zh-tw.md) + • [Lengua española readme](https://github.com/textualize/rich/blob/master/README.es.md) + • [Deutsche readme](https://github.com/textualize/rich/blob/master/README.de.md) + • [Läs på svenska](https://github.com/textualize/rich/blob/master/README.sv.md) + • [日本語 readme](https://github.com/textualize/rich/blob/master/README.ja.md) + • [한국어 readme](https://github.com/textualize/rich/blob/master/README.kr.md) + • [Français readme](https://github.com/textualize/rich/blob/master/README.fr.md) + • [Schwizerdütsch readme](https://github.com/textualize/rich/blob/master/README.de-ch.md) + • [हिन्दी readme](https://github.com/textualize/rich/blob/master/README.hi.md) + • [Português brasileiro readme](https://github.com/textualize/rich/blob/master/README.pt-br.md) + • [Italian readme](https://github.com/textualize/rich/blob/master/README.it.md) + • [Русский readme](https://github.com/textualize/rich/blob/master/README.ru.md) + • [Indonesian readme](https://github.com/textualize/rich/blob/master/README.id.md) + • [فارسی readme](https://github.com/textualize/rich/blob/master/README.fa.md) + • [Türkçe readme](https://github.com/textualize/rich/blob/master/README.tr.md) + • [Polskie readme](https://github.com/textualize/rich/blob/master/README.pl.md) + + +Rich is a Python library for _rich_ text and beautiful formatting in the terminal. + +The [Rich API](https://rich.readthedocs.io/en/latest/) makes it easy to add color and style to terminal output. Rich can also render pretty tables, progress bars, markdown, syntax highlighted source code, tracebacks, and more — out of the box. + +![Features](https://github.com/textualize/rich/raw/master/imgs/features.png) + +For a video introduction to Rich see [calmcode.io](https://calmcode.io/rich/introduction.html) by [@fishnets88](https://twitter.com/fishnets88). + +See what [people are saying about Rich](https://www.willmcgugan.com/blog/pages/post/rich-tweets/). + +## Compatibility + +Rich works with Linux, macOS and Windows. True color / emoji works with new Windows Terminal, classic terminal is limited to 16 colors. Rich requires Python 3.8 or later. + +Rich works with [Jupyter notebooks](https://jupyter.org/) with no additional configuration required. + +## Installing + +Install with `pip` or your favorite PyPI package manager. + +```sh +python -m pip install rich +``` + +Run the following to test Rich output on your terminal: + +```sh +python -m rich +``` + +## Rich Print + +To effortlessly add rich output to your application, you can import the [rich print](https://rich.readthedocs.io/en/latest/introduction.html#quick-start) method, which has the same signature as the builtin Python function. Try this: + +```python +from rich import print + +print("Hello, [bold magenta]World[/bold magenta]!", ":vampire:", locals()) +``` + +![Hello World](https://github.com/textualize/rich/raw/master/imgs/print.png) + +## Rich REPL + +Rich can be installed in the Python REPL, so that any data structures will be pretty printed and highlighted. + +```python +>>> from rich import pretty +>>> pretty.install() +``` + +![REPL](https://github.com/textualize/rich/raw/master/imgs/repl.png) + +## Using the Console + +For more control over rich terminal content, import and construct a [Console](https://rich.readthedocs.io/en/latest/reference/console.html#rich.console.Console) object. + +```python +from rich.console import Console + +console = Console() +``` + +The Console object has a `print` method which has an intentionally similar interface to the builtin `print` function. Here's an example of use: + +```python +console.print("Hello", "World!") +``` + +As you might expect, this will print `"Hello World!"` to the terminal. Note that unlike the builtin `print` function, Rich will word-wrap your text to fit within the terminal width. + +There are a few ways of adding color and style to your output. You can set a style for the entire output by adding a `style` keyword argument. Here's an example: + +```python +console.print("Hello", "World!", style="bold red") +``` + +The output will be something like the following: + +![Hello World](https://github.com/textualize/rich/raw/master/imgs/hello_world.png) + +That's fine for styling a line of text at a time. For more finely grained styling, Rich renders a special markup which is similar in syntax to [bbcode](https://en.wikipedia.org/wiki/BBCode). Here's an example: + +```python +console.print("Where there is a [bold cyan]Will[/bold cyan] there [u]is[/u] a [i]way[/i].") +``` + +![Console Markup](https://github.com/textualize/rich/raw/master/imgs/where_there_is_a_will.png) + +You can use a Console object to generate sophisticated output with minimal effort. See the [Console API](https://rich.readthedocs.io/en/latest/console.html) docs for details. + +## Rich Inspect + +Rich has an [inspect](https://rich.readthedocs.io/en/latest/reference/init.html?highlight=inspect#rich.inspect) function which can produce a report on any Python object, such as class, instance, or builtin. + +```python +>>> my_list = ["foo", "bar"] +>>> from rich import inspect +>>> inspect(my_list, methods=True) +``` + +![Log](https://github.com/textualize/rich/raw/master/imgs/inspect.png) + +See the [inspect docs](https://rich.readthedocs.io/en/latest/reference/init.html#rich.inspect) for details. + +# Rich Library + +Rich contains a number of builtin _renderables_ you can use to create elegant output in your CLI and help you debug your code. + +Click the following headings for details: + +
+Log + +The Console object has a `log()` method which has a similar interface to `print()`, but also renders a column for the current time and the file and line which made the call. By default Rich will do syntax highlighting for Python structures and for repr strings. If you log a collection (i.e. a dict or a list) Rich will pretty print it so that it fits in the available space. Here's an example of some of these features. + +```python +from rich.console import Console +console = Console() + +test_data = [ + {"jsonrpc": "2.0", "method": "sum", "params": [None, 1, 2, 4, False, True], "id": "1",}, + {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]}, + {"jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": "2"}, +] + +def test_log(): + enabled = False + context = { + "foo": "bar", + } + movies = ["Deadpool", "Rise of the Skywalker"] + console.log("Hello from", console, "!") + console.log(test_data, log_locals=True) + + +test_log() +``` + +The above produces the following output: + +![Log](https://github.com/textualize/rich/raw/master/imgs/log.png) + +Note the `log_locals` argument, which outputs a table containing the local variables where the log method was called. + +The log method could be used for logging to the terminal for long running applications such as servers, but is also a very nice debugging aid. + +
+
+Logging Handler + +You can also use the builtin [Handler class](https://rich.readthedocs.io/en/latest/logging.html) to format and colorize output from Python's logging module. Here's an example of the output: + +![Logging](https://github.com/textualize/rich/raw/master/imgs/logging.png) + +
+ +
+Emoji + +To insert an emoji in to console output place the name between two colons. Here's an example: + +```python +>>> console.print(":smiley: :vampire: :pile_of_poo: :thumbs_up: :raccoon:") +😃 🧛 💩 👍 🦝 +``` + +Please use this feature wisely. + +
+ +
+Tables + +Rich can render flexible [tables](https://rich.readthedocs.io/en/latest/tables.html) with unicode box characters. There is a large variety of formatting options for borders, styles, cell alignment etc. + +![table movie](https://github.com/textualize/rich/raw/master/imgs/table_movie.gif) + +The animation above was generated with [table_movie.py](https://github.com/textualize/rich/blob/master/examples/table_movie.py) in the examples directory. + +Here's a simpler table example: + +```python +from rich.console import Console +from rich.table import Table + +console = Console() + +table = Table(show_header=True, header_style="bold magenta") +table.add_column("Date", style="dim", width=12) +table.add_column("Title") +table.add_column("Production Budget", justify="right") +table.add_column("Box Office", justify="right") +table.add_row( + "Dec 20, 2019", "Star Wars: The Rise of Skywalker", "$275,000,000", "$375,126,118" +) +table.add_row( + "May 25, 2018", + "[red]Solo[/red]: A Star Wars Story", + "$275,000,000", + "$393,151,347", +) +table.add_row( + "Dec 15, 2017", + "Star Wars Ep. VIII: The Last Jedi", + "$262,000,000", + "[bold]$1,332,539,889[/bold]", +) + +console.print(table) +``` + +This produces the following output: + +![table](https://github.com/textualize/rich/raw/master/imgs/table.png) + +Note that console markup is rendered in the same way as `print()` and `log()`. In fact, anything that is renderable by Rich may be included in the headers / rows (even other tables). + +The `Table` class is smart enough to resize columns to fit the available width of the terminal, wrapping text as required. Here's the same example, with the terminal made smaller than the table above: + +![table2](https://github.com/textualize/rich/raw/master/imgs/table2.png) + +
+ +
+Progress Bars + +Rich can render multiple flicker-free [progress](https://rich.readthedocs.io/en/latest/progress.html) bars to track long-running tasks. + +For basic usage, wrap any sequence in the `track` function and iterate over the result. Here's an example: + +```python +from rich.progress import track + +for step in track(range(100)): + do_step(step) +``` + +It's not much harder to add multiple progress bars. Here's an example taken from the docs: + +![progress](https://github.com/textualize/rich/raw/master/imgs/progress.gif) + +The columns may be configured to show any details you want. Built-in columns include percentage complete, file size, file speed, and time remaining. Here's another example showing a download in progress: + +![progress](https://github.com/textualize/rich/raw/master/imgs/downloader.gif) + +To try this out yourself, see [examples/downloader.py](https://github.com/textualize/rich/blob/master/examples/downloader.py) which can download multiple URLs simultaneously while displaying progress. + +
+ +
+Status + +For situations where it is hard to calculate progress, you can use the [status](https://rich.readthedocs.io/en/latest/reference/console.html#rich.console.Console.status) method which will display a 'spinner' animation and message. The animation won't prevent you from using the console as normal. Here's an example: + +```python +from time import sleep +from rich.console import Console + +console = Console() +tasks = [f"task {n}" for n in range(1, 11)] + +with console.status("[bold green]Working on tasks...") as status: + while tasks: + task = tasks.pop(0) + sleep(1) + console.log(f"{task} complete") +``` + +This generates the following output in the terminal. + +![status](https://github.com/textualize/rich/raw/master/imgs/status.gif) + +The spinner animations were borrowed from [cli-spinners](https://www.npmjs.com/package/cli-spinners). You can select a spinner by specifying the `spinner` parameter. Run the following command to see the available values: + +``` +python -m rich.spinner +``` + +The above command generates the following output in the terminal: + +![spinners](https://github.com/textualize/rich/raw/master/imgs/spinners.gif) + +
+ +
+Tree + +Rich can render a [tree](https://rich.readthedocs.io/en/latest/tree.html) with guide lines. A tree is ideal for displaying a file structure, or any other hierarchical data. + +The labels of the tree can be simple text or anything else Rich can render. Run the following for a demonstration: + +``` +python -m rich.tree +``` + +This generates the following output: + +![markdown](https://github.com/textualize/rich/raw/master/imgs/tree.png) + +See the [tree.py](https://github.com/textualize/rich/blob/master/examples/tree.py) example for a script that displays a tree view of any directory, similar to the linux `tree` command. + +
+ +
+Columns + +Rich can render content in neat [columns](https://rich.readthedocs.io/en/latest/columns.html) with equal or optimal width. Here's a very basic clone of the (MacOS / Linux) `ls` command which displays a directory listing in columns: + +```python +import os +import sys + +from rich import print +from rich.columns import Columns + +directory = os.listdir(sys.argv[1]) +print(Columns(directory)) +``` + +The following screenshot is the output from the [columns example](https://github.com/textualize/rich/blob/master/examples/columns.py) which displays data pulled from an API in columns: + +![columns](https://github.com/textualize/rich/raw/master/imgs/columns.png) + +
+ +
+Markdown + +Rich can render [markdown](https://rich.readthedocs.io/en/latest/markdown.html) and does a reasonable job of translating the formatting to the terminal. + +To render markdown import the `Markdown` class and construct it with a string containing markdown code. Then print it to the console. Here's an example: + +```python +from rich.console import Console +from rich.markdown import Markdown + +console = Console() +with open("README.md") as readme: + markdown = Markdown(readme.read()) +console.print(markdown) +``` + +This will produce output something like the following: + +![markdown](https://github.com/textualize/rich/raw/master/imgs/markdown.png) + +
+ +
+Syntax Highlighting + +Rich uses the [pygments](https://pygments.org/) library to implement [syntax highlighting](https://rich.readthedocs.io/en/latest/syntax.html). Usage is similar to rendering markdown; construct a `Syntax` object and print it to the console. Here's an example: + +```python +from rich.console import Console +from rich.syntax import Syntax + +my_code = ''' +def iter_first_last(values: Iterable[T]) -> Iterable[Tuple[bool, bool, T]]: + """Iterate and generate a tuple with a flag for first and last value.""" + iter_values = iter(values) + try: + previous_value = next(iter_values) + except StopIteration: + return + first = True + for value in iter_values: + yield first, False, previous_value + first = False + previous_value = value + yield first, True, previous_value +''' +syntax = Syntax(my_code, "python", theme="monokai", line_numbers=True) +console = Console() +console.print(syntax) +``` + +This will produce the following output: + +![syntax](https://github.com/textualize/rich/raw/master/imgs/syntax.png) + +
+ +
+Tracebacks + +Rich can render [beautiful tracebacks](https://rich.readthedocs.io/en/latest/traceback.html) which are easier to read and show more code than standard Python tracebacks. You can set Rich as the default traceback handler so all uncaught exceptions will be rendered by Rich. + +Here's what it looks like on OSX (similar on Linux): + +![traceback](https://github.com/textualize/rich/raw/master/imgs/traceback.png) + +
+ +All Rich renderables make use of the [Console Protocol](https://rich.readthedocs.io/en/latest/protocol.html), which you can also use to implement your own Rich content. + +# Rich CLI + + +See also [Rich CLI](https://github.com/textualize/rich-cli) for a command line application powered by Rich. Syntax highlight code, render markdown, display CSVs in tables, and more, directly from the command prompt. + + +![Rich CLI](https://raw.githubusercontent.com/Textualize/rich-cli/main/imgs/rich-cli-splash.jpg) + +# Textual + +See also Rich's sister project, [Textual](https://github.com/Textualize/textual), which you can use to build sophisticated User Interfaces in the terminal. + +![textual-splash](https://github.com/user-attachments/assets/4caeb77e-48c0-4cf7-b14d-c53ded855ffd) + +# Toad + +[Toad](https://github.com/batrachianai/toad) is a unified interface for agentic coding. Built with Rich and Textual. + +![toad](https://github.com/user-attachments/assets/6678b707-1aeb-420f-99ad-abfcd4356771) + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..e3ecfbf72e9948a3c821d5c054591daad6f8a3e2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/RECORD @@ -0,0 +1,206 @@ +rich-14.3.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +rich-14.3.3.dist-info/METADATA,sha256=9kOnJPejl6vTwavl35qTJmtKu218p9Ob-z-jDoz1ATo,18495 +rich-14.3.3.dist-info/RECORD,, +rich-14.3.3.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88 +rich-14.3.3.dist-info/licenses/LICENSE,sha256=3u18F6QxgVgZCj6iOcyHmlpQJxzruYrnAl9I--WNyhU,1056 +rich/__init__.py,sha256=j7AA9_z_PANQbmRTwTkWZc_DVdqtBBHxBqGrMsz21CI,6131 +rich/__main__.py,sha256=kcy8BtBEUkYLCogRkwhCdJs0VNx6KF1n8kFU2g-7plg,7725 +rich/__pycache__/__init__.cpython-312.pyc,, +rich/__pycache__/__main__.cpython-312.pyc,, +rich/__pycache__/_emoji_codes.cpython-312.pyc,, +rich/__pycache__/_emoji_replace.cpython-312.pyc,, +rich/__pycache__/_export_format.cpython-312.pyc,, +rich/__pycache__/_extension.cpython-312.pyc,, +rich/__pycache__/_fileno.cpython-312.pyc,, +rich/__pycache__/_inspect.cpython-312.pyc,, +rich/__pycache__/_log_render.cpython-312.pyc,, +rich/__pycache__/_loop.cpython-312.pyc,, +rich/__pycache__/_null_file.cpython-312.pyc,, +rich/__pycache__/_palettes.cpython-312.pyc,, +rich/__pycache__/_pick.cpython-312.pyc,, +rich/__pycache__/_ratio.cpython-312.pyc,, +rich/__pycache__/_spinners.cpython-312.pyc,, +rich/__pycache__/_stack.cpython-312.pyc,, +rich/__pycache__/_timer.cpython-312.pyc,, +rich/__pycache__/_win32_console.cpython-312.pyc,, +rich/__pycache__/_windows.cpython-312.pyc,, +rich/__pycache__/_windows_renderer.cpython-312.pyc,, +rich/__pycache__/_wrap.cpython-312.pyc,, +rich/__pycache__/abc.cpython-312.pyc,, +rich/__pycache__/align.cpython-312.pyc,, +rich/__pycache__/ansi.cpython-312.pyc,, +rich/__pycache__/bar.cpython-312.pyc,, +rich/__pycache__/box.cpython-312.pyc,, +rich/__pycache__/cells.cpython-312.pyc,, +rich/__pycache__/color.cpython-312.pyc,, +rich/__pycache__/color_triplet.cpython-312.pyc,, +rich/__pycache__/columns.cpython-312.pyc,, +rich/__pycache__/console.cpython-312.pyc,, +rich/__pycache__/constrain.cpython-312.pyc,, +rich/__pycache__/containers.cpython-312.pyc,, +rich/__pycache__/control.cpython-312.pyc,, +rich/__pycache__/default_styles.cpython-312.pyc,, +rich/__pycache__/diagnose.cpython-312.pyc,, +rich/__pycache__/emoji.cpython-312.pyc,, +rich/__pycache__/errors.cpython-312.pyc,, +rich/__pycache__/file_proxy.cpython-312.pyc,, +rich/__pycache__/filesize.cpython-312.pyc,, +rich/__pycache__/highlighter.cpython-312.pyc,, +rich/__pycache__/json.cpython-312.pyc,, +rich/__pycache__/jupyter.cpython-312.pyc,, +rich/__pycache__/layout.cpython-312.pyc,, +rich/__pycache__/live.cpython-312.pyc,, +rich/__pycache__/live_render.cpython-312.pyc,, +rich/__pycache__/logging.cpython-312.pyc,, +rich/__pycache__/markdown.cpython-312.pyc,, +rich/__pycache__/markup.cpython-312.pyc,, +rich/__pycache__/measure.cpython-312.pyc,, +rich/__pycache__/padding.cpython-312.pyc,, +rich/__pycache__/pager.cpython-312.pyc,, +rich/__pycache__/palette.cpython-312.pyc,, +rich/__pycache__/panel.cpython-312.pyc,, +rich/__pycache__/pretty.cpython-312.pyc,, +rich/__pycache__/progress.cpython-312.pyc,, +rich/__pycache__/progress_bar.cpython-312.pyc,, +rich/__pycache__/prompt.cpython-312.pyc,, +rich/__pycache__/protocol.cpython-312.pyc,, +rich/__pycache__/region.cpython-312.pyc,, +rich/__pycache__/repr.cpython-312.pyc,, +rich/__pycache__/rule.cpython-312.pyc,, +rich/__pycache__/scope.cpython-312.pyc,, +rich/__pycache__/screen.cpython-312.pyc,, +rich/__pycache__/segment.cpython-312.pyc,, +rich/__pycache__/spinner.cpython-312.pyc,, +rich/__pycache__/status.cpython-312.pyc,, +rich/__pycache__/style.cpython-312.pyc,, +rich/__pycache__/styled.cpython-312.pyc,, +rich/__pycache__/syntax.cpython-312.pyc,, +rich/__pycache__/table.cpython-312.pyc,, +rich/__pycache__/terminal_theme.cpython-312.pyc,, +rich/__pycache__/text.cpython-312.pyc,, +rich/__pycache__/theme.cpython-312.pyc,, +rich/__pycache__/themes.cpython-312.pyc,, +rich/__pycache__/traceback.cpython-312.pyc,, +rich/__pycache__/tree.cpython-312.pyc,, +rich/_emoji_codes.py,sha256=hu1VL9nbVdppJrVoijVshRlcRRe_v3dju3Mmd2sKZdY,140235 +rich/_emoji_replace.py,sha256=n-kcetsEUx2ZUmhQrfeMNc-teeGhpuSQ5F8VPBsyvDo,1064 +rich/_export_format.py,sha256=RI08pSrm5tBSzPMvnbTqbD9WIalaOoN5d4M1RTmLq1Y,2128 +rich/_extension.py,sha256=G66PkbH_QdTJh6jD-J228O76CmAnr2hLQv72CgPPuzE,241 +rich/_fileno.py,sha256=HWZxP5C2ajMbHryvAQZseflVfQoGzsKOHzKGsLD8ynQ,799 +rich/_inspect.py,sha256=5pUYCqveN4ekb_mgHOYCipyZCrMGEJZYZs3y5QqmCf0,9894 +rich/_log_render.py,sha256=xBKCxqiO4FZk8eG56f8crFdrmJxFrJsQE3V3F-fFekc,3213 +rich/_loop.py,sha256=hV_6CLdoPm0va22Wpw4zKqM0RYsz3TZxXj0PoS-9eDQ,1236 +rich/_null_file.py,sha256=ADGKp1yt-k70FMKV6tnqCqecB-rSJzp-WQsD7LPL-kg,1394 +rich/_palettes.py,sha256=cdev1JQKZ0JvlguV9ipHgznTdnvlIzUFDBb0It2PzjI,7063 +rich/_pick.py,sha256=evDt8QN4lF5CiwrUIXlOJCntitBCOsI3ZLPEIAVRLJU,423 +rich/_ratio.py,sha256=IOtl78sQCYZsmHyxhe45krkb68u9xVz7zFsXVJD-b2Y,5325 +rich/_spinners.py,sha256=U2r1_g_1zSjsjiUdAESc2iAMc3i4ri_S8PYP6kQ5z1I,19919 +rich/_stack.py,sha256=-C8OK7rxn3sIUdVwxZBBpeHhIzX0eI-VM3MemYfaXm0,351 +rich/_timer.py,sha256=zelxbT6oPFZnNrwWPpc1ktUeAT-Vc4fuFcRZLQGLtMI,417 +rich/_unicode_data/__init__.py,sha256=40PhAFp3b88yPnRtTG6i9g5xj-5w98CET3C4Ip1LJAI,2631 +rich/_unicode_data/__pycache__/__init__.cpython-312.pyc,, +rich/_unicode_data/__pycache__/_versions.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode10-0-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode11-0-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode12-0-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode12-1-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode13-0-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode14-0-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode15-0-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode15-1-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode16-0-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode17-0-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode4-1-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode5-0-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode5-1-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode5-2-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode6-0-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode6-1-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode6-2-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode6-3-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode7-0-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode8-0-0.cpython-312.pyc,, +rich/_unicode_data/__pycache__/unicode9-0-0.cpython-312.pyc,, +rich/_unicode_data/_versions.py,sha256=ftILR3G5dqmlQmCJYNovuyXfFneJY2eH2RvpV19tyYE,298 +rich/_unicode_data/unicode10-0-0.py,sha256=FUstYPZwDF15BEuAERqXHqIPvC1KY1SL20qLj999Fzo,14496 +rich/_unicode_data/unicode11-0-0.py,sha256=jp8SRKFBlIaHMafxAfhLiU7FizwdcgPVvytR3kSFtZo,14874 +rich/_unicode_data/unicode12-0-0.py,sha256=0XHXSjW5EXue6Qfgl_u0bK7NstiSdmqrR_F_Wqhs5bE,15216 +rich/_unicode_data/unicode12-1-0.py,sha256=kWcRGh1UVwsmK9qflfGsO_aM8AuNhLthJcsyXAOQryI,15189 +rich/_unicode_data/unicode13-0-0.py,sha256=DokduALtgaB-WvapW7X7PmM3kZFbgnCo9ifINWZtuDs,15519 +rich/_unicode_data/unicode14-0-0.py,sha256=Ni-3JnGf5sB4kGl8ip-Iyqoum-awJjZV0RoSNuo0yu8,15884 +rich/_unicode_data/unicode15-0-0.py,sha256=DBHkV5Si9vmtv_MiW6NmPQb8yUeP4N-9hNt2juZr4ZE,16156 +rich/_unicode_data/unicode15-1-0.py,sha256=uyCZLYrg0q7wGt3-uBdsF0Ay_x8MTMvFqK6aMOkl9rA,16129 +rich/_unicode_data/unicode16-0-0.py,sha256=5iGpbczVQ7BD2QGYb6k1h_OdILQXXuhcvI6dQFLKbMc,16480 +rich/_unicode_data/unicode17-0-0.py,sha256=NXbjFsAaTYdj6TYgk5Q9disv40LZHbedFGRl_48_9Y0,16704 +rich/_unicode_data/unicode4-1-0.py,sha256=yIApQGEG7VOFYY2FFfvOdPprE6VpDusjLlTlCy4G_Rw,9488 +rich/_unicode_data/unicode5-0-0.py,sha256=PkEI1x4RGwXSmgqHiu88jyz14VQT8bWiOtBDrECaVZg,9613 +rich/_unicode_data/unicode5-1-0.py,sha256=C0-PWziqpkVkf3PkPz2GWNwidCrjef5AHQGBpqTPkuY,9650 +rich/_unicode_data/unicode5-2-0.py,sha256=gM88qri3_9b0I37DGK1-ah-0SUed2VmvxUddB5UZLto,10390 +rich/_unicode_data/unicode6-0-0.py,sha256=hhcAipqKU81dZ4YbDXIlT7KEK9yNG_Lx-5GLgNTF75g,10604 +rich/_unicode_data/unicode6-1-0.py,sha256=PtUJYxwtU5S2A44YY_69Ka_wTkq-c7QCa-yibmkHvJs,10899 +rich/_unicode_data/unicode6-2-0.py,sha256=TdTOctGwO-OYVGif1DoRJvsaQISHw5EXHPt58fjB55g,10899 +rich/_unicode_data/unicode6-3-0.py,sha256=G9l8chu2MJTwZ_d_0tmH7PBg8KYYHaeuJCJNCHGHkDc,10924 +rich/_unicode_data/unicode7-0-0.py,sha256=po9GGYW7ilGU9MwGE6fny-OofqbDwelQrnOIm-IusjI,11630 +rich/_unicode_data/unicode8-0-0.py,sha256=4PjyI-w2Uj9xtanNlZm1d_2khcetMQlIefaoU2joGkY,11864 +rich/_unicode_data/unicode9-0-0.py,sha256=A-pQjvkTICUGXEDOiWNMqa6z6vv1E__HJffzu7zLi9c,14148 +rich/_win32_console.py,sha256=o2QN_IRx10biGP3Ap1neaqX8FBGlUKSmWM6Kw4OSg-U,22719 +rich/_windows.py,sha256=is3WpbHMj8WaTHYB11hc6lP2t4hlvt4TViTlHSmjsi0,1901 +rich/_windows_renderer.py,sha256=d799xOnxLbCCCzGu9-U7YLmIQkxtxQIBFQQ6iu4veSc,2759 +rich/_wrap.py,sha256=FlSsom5EX0LVkA3KWy34yHnCfLtqX-ZIepXKh-70rpc,3404 +rich/abc.py,sha256=dALMOGfKVNeAbvqq66IpTQxQUerxD7AE4FKwqd0eQKk,878 +rich/align.py,sha256=a8MbP-iJjoOFonxqgoP3YketKMWU3WFZaxjqAv2Qc5E,10726 +rich/ansi.py,sha256=Avs1LHbSdcyOvDOdpELZUoULcBiYewY76eNBp6uFBhs,6921 +rich/bar.py,sha256=ldbVHOzKJOnflVNuv1xS7g6dLX2E3wMnXkdPbpzJTcs,3263 +rich/box.py,sha256=SSolg8_pzHzY9QvJQo-qp0tbPsnj8O_2W4hmi1l-Zo0,10650 +rich/cells.py,sha256=fPRSnquYlCO4THgmUokOJOhNlcx8C4NZ2Xv9JM_7GbE,12335 +rich/color.py,sha256=3HSULVDj7qQkXUdFWv78JOiSZzfy5y1nkcYhna296V0,18211 +rich/color_triplet.py,sha256=3lhQkdJbvWPoLDO-AnYImAWmJvV5dlgYNCVZ97ORaN4,1054 +rich/columns.py,sha256=HUX0KcMm9dsKNi11fTbiM_h2iDtl8ySCaVcxlalEzq8,7131 +rich/console.py,sha256=doKNi4BLSKZCt6Ra-6AXiQK-FaWAL-7fClG2ZO5w7uQ,101009 +rich/constrain.py,sha256=1VIPuC8AgtKWrcncQrjBdYqA3JVWysu6jZo1rrh7c7Q,1288 +rich/containers.py,sha256=c_56TxcedGYqDepHBMTuZdUIijitAQgnox-Qde0Z1qo,5502 +rich/control.py,sha256=HnsraFTzBaUQDzKJWXsfPv-PPmgGypSgSv7oANackqs,6475 +rich/default_styles.py,sha256=Tk1pZ9bOZ40EVX7cfBbYDEo7hrpwBvZGsiUCXdh0P0M,8340 +rich/diagnose.py,sha256=1RWnQoppPXjC_49AB4vtV048DK3ksQSq671C83Y6f-g,977 +rich/emoji.py,sha256=_bTf1Y3JqiMk6Nfn4V_YOhq1wAPAHNODhGLJj95R3uI,2343 +rich/errors.py,sha256=5pP3Kc5d4QJ_c0KFsxrfyhjiPVe7J1zOqSFbFAzcV-Y,642 +rich/file_proxy.py,sha256=Tl9THMDZ-Pk5Wm8sI1gGg_U5DhusmxD-FZ0fUbcU0W0,1683 +rich/filesize.py,sha256=_iz9lIpRgvW7MNSeCZnLg-HwzbP4GETg543WqD8SFs0,2484 +rich/highlighter.py,sha256=MIapWwjR8ahUcsDicgN4xLRbanbh5x_Qzh5kfdDrKKk,9729 +rich/json.py,sha256=omC2WHTgURxEosna1ftoSJCne2EX7MDuQtCdswS3qsk,5019 +rich/jupyter.py,sha256=G9pOJmR4ESIFYSd4MKGqmHqCtstx0oRWpyeTgv54-Xc,3228 +rich/layout.py,sha256=WR8PCSroYnteIT3zawxQ3k3ad1sQO5wGG1SZOoeBuBM,13944 +rich/live.py,sha256=UKvqLSuSzNHIBz5pxRrU7SPsnG48vJJx2TMHiaHlmnI,15317 +rich/live_render.py,sha256=jQO3X_p2wemGI2bdCAY_e5j9xXNTwDxuujbpoSRsH6c,3803 +rich/logging.py,sha256=UL6TZNlaptYKHNhQ45LREy-29Pl-tQsBh7q3HSnWIAA,12456 +rich/markdown.py,sha256=mDDJmUbWRYm7_vKenVq76K6aG43KTJJ4tiYMzxXO7ns,26177 +rich/markup.py,sha256=btpr271BLhiCR1jNglRnv2BpIzVcNefYwSMeW9teDbc,8427 +rich/measure.py,sha256=HmrIJX8sWRTHbgh8MxEay_83VkqNW_70s8aKP5ZcYI8,5305 +rich/padding.py,sha256=h8XnIivLrNtlxI3vQPKHXh4hAwjOJqZx0slM0z3g1_M,4896 +rich/pager.py,sha256=SO_ETBFKbg3n_AgOzXm41Sv36YxXAyI3_R-KOY2_uSc,828 +rich/palette.py,sha256=Ar6ZUrYHiFt6-Rr2k-k9F8V7hxgJYHNdqjk2vVXsLgc,3288 +rich/panel.py,sha256=9sQl00hPIqH5G2gALQo4NepFwpP0k9wT-s_gOms5pIc,11157 +rich/pretty.py,sha256=lxW_bhBfDTKe-grtzP1KQhQsqPZxfZN14th4JRVoLzQ,36349 +rich/progress.py,sha256=Z6Yz6pYO26LFXx24cXKvk2bEX6FkjK2Z5e2fy0Bt78s,60393 +rich/progress_bar.py,sha256=mZTPpJUwcfcdgQCTTz3kyY-fc79ddLwtx6Ghhxfo064,8162 +rich/prompt.py,sha256=1SIuBEelovvwCG2wp22PZwskA3IkmAsOxf0ruFkOhOk,12448 +rich/protocol.py,sha256=Wt-2HZd67OYiopUkCTOz7lM38vyo5r3HEQZ9TOPDl5Q,1367 +rich/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +rich/region.py,sha256=rNT9xZrVZTYIXZC0NYn41CJQwYNbR-KecPOxTgQvB8Y,166 +rich/repr.py,sha256=HIsurPLZK9Gray75l3_vQx7S27AzTpAj4ChXSfe1Fes,4419 +rich/rule.py,sha256=umO21Wjw0FcYAeTB3UumNLCsDWhejzxnjlf2VwiXiDI,4590 +rich/scope.py,sha256=x-jkKIE-j7ZxA9I07lya5iVAuDAyUKM58HWtNZQUzRc,3239 +rich/screen.py,sha256=rL_j2wX-4SeuIOI2oOlc418QP9EAvD59GInUmEAE6jQ,1579 +rich/segment.py,sha256=aUh9qRteTyo6guePUn8cU7S1ccXRsfzLZ-VMDXXeNug,25795 +rich/spinner.py,sha256=onIhpKlljRHppTZasxO8kXgtYyCHUkpSgKglRJ3o51g,4214 +rich/status.py,sha256=kkPph3YeAZBo-X-4wPp8gTqZyU466NLwZBA4PZTTewo,4424 +rich/style.py,sha256=W9Ccy8Py8lNICtlfcp-ryzMTuQaGxAU3av7-g5fHu0s,26990 +rich/styled.py,sha256=wljVsVTXbABMMZvkzkO43ZEk_-irzEtvUiQ-sNnikQ8,1234 +rich/syntax.py,sha256=5ZBNxjIj3C1FC92vLwBVN-C5YAdKjPHfH6SqCzFaOYE,36263 +rich/table.py,sha256=6yv7wMLXZgOsGgzEDpKXpecXQOwcLBHNOn-MYcbo1Zk,40033 +rich/terminal_theme.py,sha256=1j5-ufJfnvlAo5Qsi_ACZiXDmwMXzqgmFByObT9-yJY,3370 +rich/text.py,sha256=t2J8iMquwR0BUUggm-cVNp30Wxw5M8fIF_p0jioYRV0,47655 +rich/theme.py,sha256=oNyhXhGagtDlbDye3tVu3esWOWk0vNkuxFw-_unlaK0,3771 +rich/themes.py,sha256=0xgTLozfabebYtcJtDdC5QkX5IVUEaviqDUJJh4YVFk,102 +rich/traceback.py,sha256=TT03eLKEj5XapXFp9kgf0bBwNupIFrHquKxZtwBhz_8,37535 +rich/tree.py,sha256=QoOwg424FkdwGfR8K0tZ6Q7qtzWNAUP_m4sFaYuG6nw,9391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..7894e88612ce5ce2c8502e9eeee7ede5b88c9b9e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich-14.3.3.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: poetry-core 2.3.1 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3edd12e0167e159890655f985299759792b71dd0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/__init__.py @@ -0,0 +1,177 @@ +"""Rich text and beautiful formatting in the terminal.""" + +import os +from typing import IO, TYPE_CHECKING, Any, Callable, Optional, Union + +from ._extension import load_ipython_extension # noqa: F401 + +__all__ = ["get_console", "reconfigure", "print", "inspect", "print_json"] + +if TYPE_CHECKING: + from .console import Console + +# Global console used by alternative print +_console: Optional["Console"] = None + +try: + _IMPORT_CWD = os.path.abspath(os.getcwd()) +except FileNotFoundError: + # Can happen if the cwd has been deleted + _IMPORT_CWD = "" + + +def get_console() -> "Console": + """Get a global :class:`~rich.console.Console` instance. This function is used when Rich requires a Console, + and hasn't been explicitly given one. + + Returns: + Console: A console instance. + """ + global _console + if _console is None: + from .console import Console + + _console = Console() + + return _console + + +def reconfigure(*args: Any, **kwargs: Any) -> None: + """Reconfigures the global console by replacing it with another. + + Args: + *args (Any): Positional arguments for the replacement :class:`~rich.console.Console`. + **kwargs (Any): Keyword arguments for the replacement :class:`~rich.console.Console`. + """ + from rich.console import Console + + new_console = Console(*args, **kwargs) + _console = get_console() + _console.__dict__ = new_console.__dict__ + + +def print( + *objects: Any, + sep: str = " ", + end: str = "\n", + file: Optional[IO[str]] = None, + flush: bool = False, +) -> None: + r"""Print object(s) supplied via positional arguments. + This function has an identical signature to the built-in print. + For more advanced features, see the :class:`~rich.console.Console` class. + + Args: + sep (str, optional): Separator between printed objects. Defaults to " ". + end (str, optional): Character to write at end of output. Defaults to "\\n". + file (IO[str], optional): File to write to, or None for stdout. Defaults to None. + flush (bool, optional): Has no effect as Rich always flushes output. Defaults to False. + + """ + from .console import Console + + write_console = get_console() if file is None else Console(file=file) + return write_console.print(*objects, sep=sep, end=end) + + +def print_json( + json: Optional[str] = None, + *, + data: Any = None, + indent: Union[None, int, str] = 2, + highlight: bool = True, + skip_keys: bool = False, + ensure_ascii: bool = False, + check_circular: bool = True, + allow_nan: bool = True, + default: Optional[Callable[[Any], Any]] = None, + sort_keys: bool = False, +) -> None: + """Pretty prints JSON. Output will be valid JSON. + + Args: + json (str): A string containing JSON. + data (Any): If json is not supplied, then encode this data. + indent (int, optional): Number of spaces to indent. Defaults to 2. + highlight (bool, optional): Enable highlighting of output: Defaults to True. + skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False. + ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False. + check_circular (bool, optional): Check for circular references. Defaults to True. + allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True. + default (Callable, optional): A callable that converts values that can not be encoded + in to something that can be JSON encoded. Defaults to None. + sort_keys (bool, optional): Sort dictionary keys. Defaults to False. + """ + + get_console().print_json( + json, + data=data, + indent=indent, + highlight=highlight, + skip_keys=skip_keys, + ensure_ascii=ensure_ascii, + check_circular=check_circular, + allow_nan=allow_nan, + default=default, + sort_keys=sort_keys, + ) + + +def inspect( + obj: Any, + *, + console: Optional["Console"] = None, + title: Optional[str] = None, + help: bool = False, + methods: bool = False, + docs: bool = True, + private: bool = False, + dunder: bool = False, + sort: bool = True, + all: bool = False, + value: bool = True, +) -> None: + """Inspect any Python object. + + * inspect() to see summarized info. + * inspect(, methods=True) to see methods. + * inspect(, help=True) to see full (non-abbreviated) help. + * inspect(, private=True) to see private attributes (single underscore). + * inspect(, dunder=True) to see attributes beginning with double underscore. + * inspect(, all=True) to see all attributes. + + Args: + obj (Any): An object to inspect. + title (str, optional): Title to display over inspect result, or None use type. Defaults to None. + help (bool, optional): Show full help text rather than just first paragraph. Defaults to False. + methods (bool, optional): Enable inspection of callables. Defaults to False. + docs (bool, optional): Also render doc strings. Defaults to True. + private (bool, optional): Show private attributes (beginning with underscore). Defaults to False. + dunder (bool, optional): Show attributes starting with double underscore. Defaults to False. + sort (bool, optional): Sort attributes alphabetically, callables at the top, leading and trailing underscores ignored. Defaults to True. + all (bool, optional): Show all attributes. Defaults to False. + value (bool, optional): Pretty print value. Defaults to True. + """ + _console = console or get_console() + from rich._inspect import Inspect + + # Special case for inspect(inspect) + is_inspect = obj is inspect + + _inspect = Inspect( + obj, + title=title, + help=is_inspect or help, + methods=is_inspect or methods, + docs=is_inspect or docs, + private=private, + dunder=dunder, + sort=sort, + all=all, + value=value, + ) + _console.print(_inspect) + + +if __name__ == "__main__": # pragma: no cover + print("Hello, **World**") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/__main__.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..864b3aed6fbaec83d20404dfc329359b6e2aeb9d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/__main__.py @@ -0,0 +1,245 @@ +import colorsys +import io +from time import process_time + +from rich import box +from rich.color import Color +from rich.console import Console, ConsoleOptions, Group, RenderableType, RenderResult +from rich.markdown import Markdown +from rich.measure import Measurement +from rich.pretty import Pretty +from rich.segment import Segment +from rich.style import Style +from rich.syntax import Syntax +from rich.table import Table +from rich.text import Text + + +class ColorBox: + def __rich_console__( + self, console: Console, options: ConsoleOptions + ) -> RenderResult: + for y in range(0, 5): + for x in range(options.max_width): + h = x / options.max_width + l = 0.1 + ((y / 5) * 0.7) + r1, g1, b1 = colorsys.hls_to_rgb(h, l, 1.0) + r2, g2, b2 = colorsys.hls_to_rgb(h, l + 0.7 / 10, 1.0) + bgcolor = Color.from_rgb(r1 * 255, g1 * 255, b1 * 255) + color = Color.from_rgb(r2 * 255, g2 * 255, b2 * 255) + yield Segment("▄", Style(color=color, bgcolor=bgcolor)) + yield Segment.line() + + def __rich_measure__( + self, console: "Console", options: ConsoleOptions + ) -> Measurement: + return Measurement(1, options.max_width) + + +def make_test_card() -> Table: + """Get a renderable that demonstrates a number of features.""" + table = Table.grid(padding=1, pad_edge=True) + table.title = "Rich features" + table.add_column("Feature", no_wrap=True, justify="center", style="bold red") + table.add_column("Demonstration") + + color_table = Table( + box=None, + expand=False, + show_header=False, + show_edge=False, + pad_edge=False, + ) + color_table.add_row( + ( + "✓ [bold green]4-bit color[/]\n" + "✓ [bold blue]8-bit color[/]\n" + "✓ [bold magenta]Truecolor (16.7 million)[/]\n" + "✓ [bold yellow]Dumb terminals[/]\n" + "✓ [bold cyan]Automatic color conversion" + ), + ColorBox(), + ) + + table.add_row("Colors", color_table) + + table.add_row( + "Styles", + "All ansi styles: [bold]bold[/], [dim]dim[/], [italic]italic[/italic], [underline]underline[/], [strike]strikethrough[/], [reverse]reverse[/], and even [blink]blink[/].", + ) + + lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque in metus sed sapien ultricies pretium a at justo. Maecenas luctus velit et auctor maximus." + lorem_table = Table.grid(padding=1, collapse_padding=True) + lorem_table.pad_edge = False + lorem_table.add_row( + Text(lorem, justify="left", style="green"), + Text(lorem, justify="center", style="yellow"), + Text(lorem, justify="right", style="blue"), + Text(lorem, justify="full", style="red"), + ) + table.add_row( + "Text", + Group( + Text.from_markup( + """Word wrap text. Justify [green]left[/], [yellow]center[/], [blue]right[/] or [red]full[/].\n""" + ), + lorem_table, + ), + ) + + def comparison(renderable1: RenderableType, renderable2: RenderableType) -> Table: + table = Table(show_header=False, pad_edge=False, box=None, expand=True) + table.add_column("1", ratio=1) + table.add_column("2", ratio=1) + table.add_row(renderable1, renderable2) + return table + + table.add_row( + "Asian\nlanguage\nsupport", + ":flag_for_china: 该库支持中文,日文和韩文文本!\n:flag_for_japan: ライブラリは中国語、日本語、韓国語のテキストをサポートしています\n:flag_for_south_korea: 이 라이브러리는 중국어, 일본어 및 한국어 텍스트를 지원합니다", + ) + + markup_example = ( + "[bold magenta]Rich[/] supports a simple [i]bbcode[/i]-like [b]markup[/b] for [yellow]color[/], [underline]style[/], and emoji! " + ":+1: :apple: :ant: :bear: :baguette_bread: :bus: " + ) + table.add_row("Markup", markup_example) + + example_table = Table( + show_edge=False, + show_header=True, + expand=False, + row_styles=["none", "dim"], + box=box.SIMPLE, + ) + example_table.add_column("[green]Date", style="green", no_wrap=True) + example_table.add_column("[blue]Title", style="blue") + example_table.add_column( + "[cyan]Production Budget", + style="cyan", + justify="right", + no_wrap=True, + ) + example_table.add_column( + "[magenta]Box Office", + style="magenta", + justify="right", + no_wrap=True, + ) + example_table.add_row( + "Dec 20, 2019", + "Star Wars: The Rise of Skywalker", + "$275,000,000", + "$375,126,118", + ) + example_table.add_row( + "May 25, 2018", + "[b]Solo[/]: A Star Wars Story", + "$275,000,000", + "$393,151,347", + ) + example_table.add_row( + "Dec 15, 2017", + "Star Wars Ep. VIII: The Last Jedi", + "$262,000,000", + "[bold]$1,332,539,889[/bold]", + ) + example_table.add_row( + "May 19, 1999", + "Star Wars Ep. [b]I[/b]: [i]The phantom Menace", + "$115,000,000", + "$1,027,044,677", + ) + + table.add_row("Tables", example_table) + + code = '''\ +def iter_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]: + """Iterate and generate a tuple with a flag for last value.""" + iter_values = iter(values) + try: + previous_value = next(iter_values) + except StopIteration: + return + for value in iter_values: + yield False, previous_value + previous_value = value + yield True, previous_value''' + + pretty_data = { + "foo": [ + 3.1427, + ( + "Paul Atreides", + "Vladimir Harkonnen", + "Thufir Hawat", + ), + ], + "atomic": (False, True, None), + } + table.add_row( + "Syntax\nhighlighting\n&\npretty\nprinting", + comparison( + Syntax(code, "python3", line_numbers=True, indent_guides=True), + Pretty(pretty_data, indent_guides=True), + ), + ) + + markdown_example = """\ +# Markdown + +Supports much of the *markdown* __syntax__! + +- Headers +- Basic formatting: **bold**, *italic*, `code` +- Block quotes +- Lists, and more... + """ + table.add_row( + "Markdown", comparison("[cyan]" + markdown_example, Markdown(markdown_example)) + ) + + table.add_row( + "+more!", + """Progress bars, columns, styled logging handler, tracebacks, etc...""", + ) + return table + + +if __name__ == "__main__": # pragma: no cover + from rich.panel import Panel + + console = Console( + file=io.StringIO(), + force_terminal=True, + ) + test_card = make_test_card() + + # Print once to warm cache + start = process_time() + console.print(test_card) + pre_cache_taken = round((process_time() - start) * 1000.0, 1) + + console.file = io.StringIO() + + start = process_time() + console.print(test_card) + taken = round((process_time() - start) * 1000.0, 1) + + c = Console(record=True) + c.print(test_card) + + console = Console() + console.print(f"[dim]rendered in [not dim]{pre_cache_taken}ms[/] (cold cache)") + console.print(f"[dim]rendered in [not dim]{taken}ms[/] (warm cache)") + console.print() + console.print( + Panel( + "[b magenta]Hope you enjoy using Rich![/]\n\n" + "Consider sponsoring to ensure this project is maintained.\n\n" + "[cyan]https://github.com/sponsors/willmcgugan[/cyan]", + border_style="green", + title="Help ensure Rich is maintained", + padding=(1, 2), + ) + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/_inspect.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/_inspect.py new file mode 100644 index 0000000000000000000000000000000000000000..ac78ffe296a22d7683a2add354399460b87d5064 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/_inspect.py @@ -0,0 +1,272 @@ +import inspect +from inspect import cleandoc, getdoc, getfile, isclass, ismodule, signature +from typing import Any, Collection, Iterable, Optional, Tuple, Type, Union + +from .console import Group, RenderableType +from .control import escape_control_codes +from .highlighter import ReprHighlighter +from .jupyter import JupyterMixin +from .panel import Panel +from .pretty import Pretty +from .table import Table +from .text import Text, TextType + + +def _first_paragraph(doc: str) -> str: + """Get the first paragraph from a docstring.""" + paragraph, _, _ = doc.partition("\n\n") + return paragraph + + +class Inspect(JupyterMixin): + """A renderable to inspect any Python Object. + + Args: + obj (Any): An object to inspect. + title (str, optional): Title to display over inspect result, or None use type. Defaults to None. + help (bool, optional): Show full help text rather than just first paragraph. Defaults to False. + methods (bool, optional): Enable inspection of callables. Defaults to False. + docs (bool, optional): Also render doc strings. Defaults to True. + private (bool, optional): Show private attributes (beginning with underscore). Defaults to False. + dunder (bool, optional): Show attributes starting with double underscore. Defaults to False. + sort (bool, optional): Sort attributes alphabetically, callables at the top, leading and trailing underscores ignored. Defaults to True. + all (bool, optional): Show all attributes. Defaults to False. + value (bool, optional): Pretty print value of object. Defaults to True. + """ + + def __init__( + self, + obj: Any, + *, + title: Optional[TextType] = None, + help: bool = False, + methods: bool = False, + docs: bool = True, + private: bool = False, + dunder: bool = False, + sort: bool = True, + all: bool = True, + value: bool = True, + ) -> None: + self.highlighter = ReprHighlighter() + self.obj = obj + self.title = title or self._make_title(obj) + if all: + methods = private = dunder = True + self.help = help + self.methods = methods + self.docs = docs or help + self.private = private or dunder + self.dunder = dunder + self.sort = sort + self.value = value + + def _make_title(self, obj: Any) -> Text: + """Make a default title.""" + title_str = ( + str(obj) + if (isclass(obj) or callable(obj) or ismodule(obj)) + else str(type(obj)) + ) + title_text = self.highlighter(title_str) + return title_text + + def __rich__(self) -> Panel: + return Panel.fit( + Group(*self._render()), + title=self.title, + border_style="scope.border", + padding=(0, 1), + ) + + def _get_signature(self, name: str, obj: Any) -> Optional[Text]: + """Get a signature for a callable.""" + try: + _signature = str(signature(obj)) + ":" + except ValueError: + _signature = "(...)" + except TypeError: + return None + + source_filename: Optional[str] = None + try: + source_filename = getfile(obj) + except (OSError, TypeError): + # OSError is raised if obj has no source file, e.g. when defined in REPL. + pass + + callable_name = Text(name, style="inspect.callable") + if source_filename: + callable_name.stylize(f"link file://{source_filename}") + signature_text = self.highlighter(_signature) + + qualname = name or getattr(obj, "__qualname__", name) + if not isinstance(qualname, str): + qualname = getattr(obj, "__name__", name) + if not isinstance(qualname, str): + qualname = name + + # If obj is a module, there may be classes (which are callable) to display + if inspect.isclass(obj): + prefix = "class" + elif inspect.iscoroutinefunction(obj): + prefix = "async def" + else: + prefix = "def" + + qual_signature = Text.assemble( + (f"{prefix} ", f"inspect.{prefix.replace(' ', '_')}"), + (qualname, "inspect.callable"), + signature_text, + ) + + return qual_signature + + def _render(self) -> Iterable[RenderableType]: + """Render object.""" + + def sort_items(item: Tuple[str, Any]) -> Tuple[bool, str]: + key, (_error, value) = item + return (callable(value), key.strip("_").lower()) + + def safe_getattr(attr_name: str) -> Tuple[Any, Any]: + """Get attribute or any exception.""" + try: + return (None, getattr(obj, attr_name)) + except Exception as error: + return (error, None) + + obj = self.obj + keys = dir(obj) + total_items = len(keys) + if not self.dunder: + keys = [key for key in keys if not key.startswith("__")] + if not self.private: + keys = [key for key in keys if not key.startswith("_")] + not_shown_count = total_items - len(keys) + items = [(key, safe_getattr(key)) for key in keys] + if self.sort: + items.sort(key=sort_items) + + items_table = Table.grid(padding=(0, 1), expand=False) + items_table.add_column(justify="right") + add_row = items_table.add_row + highlighter = self.highlighter + + if callable(obj): + signature = self._get_signature("", obj) + if signature is not None: + yield signature + yield "" + + if self.docs: + _doc = self._get_formatted_doc(obj) + if _doc is not None: + doc_text = Text(_doc, style="inspect.help") + doc_text = highlighter(doc_text) + yield doc_text + yield "" + + if self.value and not (isclass(obj) or callable(obj) or ismodule(obj)): + yield Panel( + Pretty(obj, indent_guides=True, max_length=10, max_string=60), + border_style="inspect.value.border", + ) + yield "" + + for key, (error, value) in items: + key_text = Text.assemble( + ( + key, + "inspect.attr.dunder" if key.startswith("__") else "inspect.attr", + ), + (" =", "inspect.equals"), + ) + if error is not None: + warning = key_text.copy() + warning.stylize("inspect.error") + add_row(warning, highlighter(repr(error))) + continue + + if callable(value): + if not self.methods: + continue + + _signature_text = self._get_signature(key, value) + if _signature_text is None: + add_row(key_text, Pretty(value, highlighter=highlighter)) + else: + if self.docs: + docs = self._get_formatted_doc(value) + if docs is not None: + _signature_text.append("\n" if "\n" in docs else " ") + doc = highlighter(docs) + doc.stylize("inspect.doc") + _signature_text.append(doc) + + add_row(key_text, _signature_text) + else: + add_row(key_text, Pretty(value, highlighter=highlighter)) + if items_table.row_count: + yield items_table + elif not_shown_count: + yield Text.from_markup( + f"[b cyan]{not_shown_count}[/][i] attribute(s) not shown.[/i] " + f"Run [b][magenta]inspect[/]([not b]inspect[/])[/b] for options." + ) + + def _get_formatted_doc(self, object_: Any) -> Optional[str]: + """ + Extract the docstring of an object, process it and returns it. + The processing consists in cleaning up the docstring's indentation, + taking only its 1st paragraph if `self.help` is not True, + and escape its control codes. + + Args: + object_ (Any): the object to get the docstring from. + + Returns: + Optional[str]: the processed docstring, or None if no docstring was found. + """ + docs = getdoc(object_) + if docs is None: + return None + docs = cleandoc(docs).strip() + if not self.help: + docs = _first_paragraph(docs) + return escape_control_codes(docs) + + +def get_object_types_mro(obj: Union[object, Type[Any]]) -> Tuple[type, ...]: + """Returns the MRO of an object's class, or of the object itself if it's a class.""" + if not hasattr(obj, "__mro__"): + # N.B. we cannot use `if type(obj) is type` here because it doesn't work with + # some types of classes, such as the ones that use abc.ABCMeta. + obj = type(obj) + return getattr(obj, "__mro__", ()) + + +def get_object_types_mro_as_strings(obj: object) -> Collection[str]: + """ + Returns the MRO of an object's class as full qualified names, or of the object itself if it's a class. + + Examples: + `object_types_mro_as_strings(JSONDecoder)` will return `['json.decoder.JSONDecoder', 'builtins.object']` + """ + return [ + f'{getattr(type_, "__module__", "")}.{getattr(type_, "__qualname__", "")}' + for type_ in get_object_types_mro(obj) + ] + + +def is_object_one_of_types( + obj: object, fully_qualified_types_names: Collection[str] +) -> bool: + """ + Returns `True` if the given object's class (or the object itself, if it's a class) has one of the + fully qualified names in its MRO. + """ + for type_name in get_object_types_mro_as_strings(obj): + if type_name in fully_qualified_types_names: + return True + return False diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/_loop.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/_loop.py new file mode 100644 index 0000000000000000000000000000000000000000..01c6cafbe53f1fcb12f7b382b2b35e2fd2c69933 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/_loop.py @@ -0,0 +1,43 @@ +from typing import Iterable, Tuple, TypeVar + +T = TypeVar("T") + + +def loop_first(values: Iterable[T]) -> Iterable[Tuple[bool, T]]: + """Iterate and generate a tuple with a flag for first value.""" + iter_values = iter(values) + try: + value = next(iter_values) + except StopIteration: + return + yield True, value + for value in iter_values: + yield False, value + + +def loop_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]: + """Iterate and generate a tuple with a flag for last value.""" + iter_values = iter(values) + try: + previous_value = next(iter_values) + except StopIteration: + return + for value in iter_values: + yield False, previous_value + previous_value = value + yield True, previous_value + + +def loop_first_last(values: Iterable[T]) -> Iterable[Tuple[bool, bool, T]]: + """Iterate and generate a tuple with a flag for first and last value.""" + iter_values = iter(values) + try: + previous_value = next(iter_values) + except StopIteration: + return + first = True + for value in iter_values: + yield first, False, previous_value + first = False + previous_value = value + yield first, True, previous_value diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/_palettes.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/_palettes.py new file mode 100644 index 0000000000000000000000000000000000000000..3c748d33e45bfcdc690ceee490cbb50b516cd2b3 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/_palettes.py @@ -0,0 +1,309 @@ +from .palette import Palette + + +# Taken from https://en.wikipedia.org/wiki/ANSI_escape_code (Windows 10 column) +WINDOWS_PALETTE = Palette( + [ + (12, 12, 12), + (197, 15, 31), + (19, 161, 14), + (193, 156, 0), + (0, 55, 218), + (136, 23, 152), + (58, 150, 221), + (204, 204, 204), + (118, 118, 118), + (231, 72, 86), + (22, 198, 12), + (249, 241, 165), + (59, 120, 255), + (180, 0, 158), + (97, 214, 214), + (242, 242, 242), + ] +) + +# # The standard ansi colors (including bright variants) +STANDARD_PALETTE = Palette( + [ + (0, 0, 0), + (170, 0, 0), + (0, 170, 0), + (170, 85, 0), + (0, 0, 170), + (170, 0, 170), + (0, 170, 170), + (170, 170, 170), + (85, 85, 85), + (255, 85, 85), + (85, 255, 85), + (255, 255, 85), + (85, 85, 255), + (255, 85, 255), + (85, 255, 255), + (255, 255, 255), + ] +) + + +# The 256 color palette +EIGHT_BIT_PALETTE = Palette( + [ + (0, 0, 0), + (128, 0, 0), + (0, 128, 0), + (128, 128, 0), + (0, 0, 128), + (128, 0, 128), + (0, 128, 128), + (192, 192, 192), + (128, 128, 128), + (255, 0, 0), + (0, 255, 0), + (255, 255, 0), + (0, 0, 255), + (255, 0, 255), + (0, 255, 255), + (255, 255, 255), + (0, 0, 0), + (0, 0, 95), + (0, 0, 135), + (0, 0, 175), + (0, 0, 215), + (0, 0, 255), + (0, 95, 0), + (0, 95, 95), + (0, 95, 135), + (0, 95, 175), + (0, 95, 215), + (0, 95, 255), + (0, 135, 0), + (0, 135, 95), + (0, 135, 135), + (0, 135, 175), + (0, 135, 215), + (0, 135, 255), + (0, 175, 0), + (0, 175, 95), + (0, 175, 135), + (0, 175, 175), + (0, 175, 215), + (0, 175, 255), + (0, 215, 0), + (0, 215, 95), + (0, 215, 135), + (0, 215, 175), + (0, 215, 215), + (0, 215, 255), + (0, 255, 0), + (0, 255, 95), + (0, 255, 135), + (0, 255, 175), + (0, 255, 215), + (0, 255, 255), + (95, 0, 0), + (95, 0, 95), + (95, 0, 135), + (95, 0, 175), + (95, 0, 215), + (95, 0, 255), + (95, 95, 0), + (95, 95, 95), + (95, 95, 135), + (95, 95, 175), + (95, 95, 215), + (95, 95, 255), + (95, 135, 0), + (95, 135, 95), + (95, 135, 135), + (95, 135, 175), + (95, 135, 215), + (95, 135, 255), + (95, 175, 0), + (95, 175, 95), + (95, 175, 135), + (95, 175, 175), + (95, 175, 215), + (95, 175, 255), + (95, 215, 0), + (95, 215, 95), + (95, 215, 135), + (95, 215, 175), + (95, 215, 215), + (95, 215, 255), + (95, 255, 0), + (95, 255, 95), + (95, 255, 135), + (95, 255, 175), + (95, 255, 215), + (95, 255, 255), + (135, 0, 0), + (135, 0, 95), + (135, 0, 135), + (135, 0, 175), + (135, 0, 215), + (135, 0, 255), + (135, 95, 0), + (135, 95, 95), + (135, 95, 135), + (135, 95, 175), + (135, 95, 215), + (135, 95, 255), + (135, 135, 0), + (135, 135, 95), + (135, 135, 135), + (135, 135, 175), + (135, 135, 215), + (135, 135, 255), + (135, 175, 0), + (135, 175, 95), + (135, 175, 135), + (135, 175, 175), + (135, 175, 215), + (135, 175, 255), + (135, 215, 0), + (135, 215, 95), + (135, 215, 135), + (135, 215, 175), + (135, 215, 215), + (135, 215, 255), + (135, 255, 0), + (135, 255, 95), + (135, 255, 135), + (135, 255, 175), + (135, 255, 215), + (135, 255, 255), + (175, 0, 0), + (175, 0, 95), + (175, 0, 135), + (175, 0, 175), + (175, 0, 215), + (175, 0, 255), + (175, 95, 0), + (175, 95, 95), + (175, 95, 135), + (175, 95, 175), + (175, 95, 215), + (175, 95, 255), + (175, 135, 0), + (175, 135, 95), + (175, 135, 135), + (175, 135, 175), + (175, 135, 215), + (175, 135, 255), + (175, 175, 0), + (175, 175, 95), + (175, 175, 135), + (175, 175, 175), + (175, 175, 215), + (175, 175, 255), + (175, 215, 0), + (175, 215, 95), + (175, 215, 135), + (175, 215, 175), + (175, 215, 215), + (175, 215, 255), + (175, 255, 0), + (175, 255, 95), + (175, 255, 135), + (175, 255, 175), + (175, 255, 215), + (175, 255, 255), + (215, 0, 0), + (215, 0, 95), + (215, 0, 135), + (215, 0, 175), + (215, 0, 215), + (215, 0, 255), + (215, 95, 0), + (215, 95, 95), + (215, 95, 135), + (215, 95, 175), + (215, 95, 215), + (215, 95, 255), + (215, 135, 0), + (215, 135, 95), + (215, 135, 135), + (215, 135, 175), + (215, 135, 215), + (215, 135, 255), + (215, 175, 0), + (215, 175, 95), + (215, 175, 135), + (215, 175, 175), + (215, 175, 215), + (215, 175, 255), + (215, 215, 0), + (215, 215, 95), + (215, 215, 135), + (215, 215, 175), + (215, 215, 215), + (215, 215, 255), + (215, 255, 0), + (215, 255, 95), + (215, 255, 135), + (215, 255, 175), + (215, 255, 215), + (215, 255, 255), + (255, 0, 0), + (255, 0, 95), + (255, 0, 135), + (255, 0, 175), + (255, 0, 215), + (255, 0, 255), + (255, 95, 0), + (255, 95, 95), + (255, 95, 135), + (255, 95, 175), + (255, 95, 215), + (255, 95, 255), + (255, 135, 0), + (255, 135, 95), + (255, 135, 135), + (255, 135, 175), + (255, 135, 215), + (255, 135, 255), + (255, 175, 0), + (255, 175, 95), + (255, 175, 135), + (255, 175, 175), + (255, 175, 215), + (255, 175, 255), + (255, 215, 0), + (255, 215, 95), + (255, 215, 135), + (255, 215, 175), + (255, 215, 215), + (255, 215, 255), + (255, 255, 0), + (255, 255, 95), + (255, 255, 135), + (255, 255, 175), + (255, 255, 215), + (255, 255, 255), + (8, 8, 8), + (18, 18, 18), + (28, 28, 28), + (38, 38, 38), + (48, 48, 48), + (58, 58, 58), + (68, 68, 68), + (78, 78, 78), + (88, 88, 88), + (98, 98, 98), + (108, 108, 108), + (118, 118, 118), + (128, 128, 128), + (138, 138, 138), + (148, 148, 148), + (158, 158, 158), + (168, 168, 168), + (178, 178, 178), + (188, 188, 188), + (198, 198, 198), + (208, 208, 208), + (218, 218, 218), + (228, 228, 228), + (238, 238, 238), + ] +) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/_pick.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/_pick.py new file mode 100644 index 0000000000000000000000000000000000000000..4f6d8b2d79406012c5f8bae9c289ed5bf4d179cc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/_pick.py @@ -0,0 +1,17 @@ +from typing import Optional + + +def pick_bool(*values: Optional[bool]) -> bool: + """Pick the first non-none bool or return the last value. + + Args: + *values (bool): Any number of boolean or None values. + + Returns: + bool: First non-none boolean. + """ + assert values, "1 or more values required" + for value in values: + if value is not None: + return value + return bool(value) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/_ratio.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..5fd5a383d22367f4167731465a12a74a20a8cda4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/_ratio.py @@ -0,0 +1,153 @@ +from fractions import Fraction +from math import ceil +from typing import cast, List, Optional, Sequence, Protocol + + +class Edge(Protocol): + """Any object that defines an edge (such as Layout).""" + + size: Optional[int] = None + ratio: int = 1 + minimum_size: int = 1 + + +def ratio_resolve(total: int, edges: Sequence[Edge]) -> List[int]: + """Divide total space to satisfy size, ratio, and minimum_size, constraints. + + The returned list of integers should add up to total in most cases, unless it is + impossible to satisfy all the constraints. For instance, if there are two edges + with a minimum size of 20 each and `total` is 30 then the returned list will be + greater than total. In practice, this would mean that a Layout object would + clip the rows that would overflow the screen height. + + Args: + total (int): Total number of characters. + edges (List[Edge]): Edges within total space. + + Returns: + List[int]: Number of characters for each edge. + """ + # Size of edge or None for yet to be determined + sizes = [(edge.size or None) for edge in edges] + + _Fraction = Fraction + + # While any edges haven't been calculated + while None in sizes: + # Get flexible edges and index to map these back on to sizes list + flexible_edges = [ + (index, edge) + for index, (size, edge) in enumerate(zip(sizes, edges)) + if size is None + ] + # Remaining space in total + remaining = total - sum(size or 0 for size in sizes) + if remaining <= 0: + # No room for flexible edges + return [ + ((edge.minimum_size or 1) if size is None else size) + for size, edge in zip(sizes, edges) + ] + # Calculate number of characters in a ratio portion + portion = _Fraction( + remaining, sum((edge.ratio or 1) for _, edge in flexible_edges) + ) + + # If any edges will be less than their minimum, replace size with the minimum + for index, edge in flexible_edges: + if portion * edge.ratio <= edge.minimum_size: + sizes[index] = edge.minimum_size + # New fixed size will invalidate calculations, so we need to repeat the process + break + else: + # Distribute flexible space and compensate for rounding error + # Since edge sizes can only be integers we need to add the remainder + # to the following line + remainder = _Fraction(0) + for index, edge in flexible_edges: + size, remainder = divmod(portion * edge.ratio + remainder, 1) + sizes[index] = size + break + # Sizes now contains integers only + return cast(List[int], sizes) + + +def ratio_reduce( + total: int, ratios: List[int], maximums: List[int], values: List[int] +) -> List[int]: + """Divide an integer total in to parts based on ratios. + + Args: + total (int): The total to divide. + ratios (List[int]): A list of integer ratios. + maximums (List[int]): List of maximums values for each slot. + values (List[int]): List of values + + Returns: + List[int]: A list of integers guaranteed to sum to total. + """ + ratios = [ratio if _max else 0 for ratio, _max in zip(ratios, maximums)] + total_ratio = sum(ratios) + if not total_ratio: + return values[:] + total_remaining = total + result: List[int] = [] + append = result.append + for ratio, maximum, value in zip(ratios, maximums, values): + if ratio and total_ratio > 0: + distributed = min(maximum, round(ratio * total_remaining / total_ratio)) + append(value - distributed) + total_remaining -= distributed + total_ratio -= ratio + else: + append(value) + return result + + +def ratio_distribute( + total: int, ratios: List[int], minimums: Optional[List[int]] = None +) -> List[int]: + """Distribute an integer total in to parts based on ratios. + + Args: + total (int): The total to divide. + ratios (List[int]): A list of integer ratios. + minimums (List[int]): List of minimum values for each slot. + + Returns: + List[int]: A list of integers guaranteed to sum to total. + """ + if minimums: + ratios = [ratio if _min else 0 for ratio, _min in zip(ratios, minimums)] + total_ratio = sum(ratios) + assert total_ratio > 0, "Sum of ratios must be > 0" + + total_remaining = total + distributed_total: List[int] = [] + append = distributed_total.append + if minimums is None: + _minimums = [0] * len(ratios) + else: + _minimums = minimums + for ratio, minimum in zip(ratios, _minimums): + if total_ratio > 0: + distributed = max(minimum, ceil(ratio * total_remaining / total_ratio)) + else: + distributed = total_remaining + append(distributed) + total_ratio -= ratio + total_remaining -= distributed + return distributed_total + + +if __name__ == "__main__": + from dataclasses import dataclass + + @dataclass + class E: + size: Optional[int] = None + ratio: int = 1 + minimum_size: int = 1 + + resolved = ratio_resolve(110, [E(None, 1, 1), E(None, 1, 1), E(None, 1, 1)]) + print(sum(resolved)) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/_spinners.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/_spinners.py new file mode 100644 index 0000000000000000000000000000000000000000..d0bb1fe751677f0ee83fc6bb876ed72443fdcde7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/_spinners.py @@ -0,0 +1,482 @@ +""" +Spinners are from: +* cli-spinners: + MIT License + Copyright (c) Sindre Sorhus (sindresorhus.com) + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE + FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. +""" + +SPINNERS = { + "dots": { + "interval": 80, + "frames": "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏", + }, + "dots2": {"interval": 80, "frames": "⣾⣽⣻⢿⡿⣟⣯⣷"}, + "dots3": { + "interval": 80, + "frames": "⠋⠙⠚⠞⠖⠦⠴⠲⠳⠓", + }, + "dots4": { + "interval": 80, + "frames": "⠄⠆⠇⠋⠙⠸⠰⠠⠰⠸⠙⠋⠇⠆", + }, + "dots5": { + "interval": 80, + "frames": "⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋", + }, + "dots6": { + "interval": 80, + "frames": "⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁", + }, + "dots7": { + "interval": 80, + "frames": "⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈", + }, + "dots8": { + "interval": 80, + "frames": "⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈", + }, + "dots9": {"interval": 80, "frames": "⢹⢺⢼⣸⣇⡧⡗⡏"}, + "dots10": {"interval": 80, "frames": "⢄⢂⢁⡁⡈⡐⡠"}, + "dots11": {"interval": 100, "frames": "⠁⠂⠄⡀⢀⠠⠐⠈"}, + "dots12": { + "interval": 80, + "frames": [ + "⢀⠀", + "⡀⠀", + "⠄⠀", + "⢂⠀", + "⡂⠀", + "⠅⠀", + "⢃⠀", + "⡃⠀", + "⠍⠀", + "⢋⠀", + "⡋⠀", + "⠍⠁", + "⢋⠁", + "⡋⠁", + "⠍⠉", + "⠋⠉", + "⠋⠉", + "⠉⠙", + "⠉⠙", + "⠉⠩", + "⠈⢙", + "⠈⡙", + "⢈⠩", + "⡀⢙", + "⠄⡙", + "⢂⠩", + "⡂⢘", + "⠅⡘", + "⢃⠨", + "⡃⢐", + "⠍⡐", + "⢋⠠", + "⡋⢀", + "⠍⡁", + "⢋⠁", + "⡋⠁", + "⠍⠉", + "⠋⠉", + "⠋⠉", + "⠉⠙", + "⠉⠙", + "⠉⠩", + "⠈⢙", + "⠈⡙", + "⠈⠩", + "⠀⢙", + "⠀⡙", + "⠀⠩", + "⠀⢘", + "⠀⡘", + "⠀⠨", + "⠀⢐", + "⠀⡐", + "⠀⠠", + "⠀⢀", + "⠀⡀", + ], + }, + "dots8Bit": { + "interval": 80, + "frames": "⠀⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙" + "⡚⡛⡜⡝⡞⡟⠠⠡⠢⠣⠤⠥⠦⠧⡠⡡⡢⡣⡤⡥⡦⡧⠨⠩⠪⠫⠬⠭⠮⠯⡨⡩⡪⡫⡬⡭⡮⡯⠰⠱⠲⠳⠴⠵⠶⠷⡰⡱⡲⡳⡴⡵⡶⡷⠸⠹⠺⠻" + "⠼⠽⠾⠿⡸⡹⡺⡻⡼⡽⡾⡿⢀⢁⢂⢃⢄⢅⢆⢇⣀⣁⣂⣃⣄⣅⣆⣇⢈⢉⢊⢋⢌⢍⢎⢏⣈⣉⣊⣋⣌⣍⣎⣏⢐⢑⢒⢓⢔⢕⢖⢗⣐⣑⣒⣓⣔⣕" + "⣖⣗⢘⢙⢚⢛⢜⢝⢞⢟⣘⣙⣚⣛⣜⣝⣞⣟⢠⢡⢢⢣⢤⢥⢦⢧⣠⣡⣢⣣⣤⣥⣦⣧⢨⢩⢪⢫⢬⢭⢮⢯⣨⣩⣪⣫⣬⣭⣮⣯⢰⢱⢲⢳⢴⢵⢶⢷" + "⣰⣱⣲⣳⣴⣵⣶⣷⢸⢹⢺⢻⢼⢽⢾⢿⣸⣹⣺⣻⣼⣽⣾⣿", + }, + "line": {"interval": 130, "frames": ["-", "\\", "|", "/"]}, + "line2": {"interval": 100, "frames": "⠂-–—–-"}, + "pipe": {"interval": 100, "frames": "┤┘┴└├┌┬┐"}, + "simpleDots": {"interval": 400, "frames": [". ", ".. ", "...", " "]}, + "simpleDotsScrolling": { + "interval": 200, + "frames": [". ", ".. ", "...", " ..", " .", " "], + }, + "star": {"interval": 70, "frames": "✶✸✹✺✹✷"}, + "star2": {"interval": 80, "frames": "+x*"}, + "flip": { + "interval": 70, + "frames": "___-``'´-___", + }, + "hamburger": {"interval": 100, "frames": "☱☲☴"}, + "growVertical": { + "interval": 120, + "frames": "▁▃▄▅▆▇▆▅▄▃", + }, + "growHorizontal": { + "interval": 120, + "frames": "▏▎▍▌▋▊▉▊▋▌▍▎", + }, + "balloon": {"interval": 140, "frames": " .oO@* "}, + "balloon2": {"interval": 120, "frames": ".oO°Oo."}, + "noise": {"interval": 100, "frames": "▓▒░"}, + "bounce": {"interval": 120, "frames": "⠁⠂⠄⠂"}, + "boxBounce": {"interval": 120, "frames": "▖▘▝▗"}, + "boxBounce2": {"interval": 100, "frames": "▌▀▐▄"}, + "triangle": {"interval": 50, "frames": "◢◣◤◥"}, + "arc": {"interval": 100, "frames": "◜◠◝◞◡◟"}, + "circle": {"interval": 120, "frames": "◡⊙◠"}, + "squareCorners": {"interval": 180, "frames": "◰◳◲◱"}, + "circleQuarters": {"interval": 120, "frames": "◴◷◶◵"}, + "circleHalves": {"interval": 50, "frames": "◐◓◑◒"}, + "squish": {"interval": 100, "frames": "╫╪"}, + "toggle": {"interval": 250, "frames": "⊶⊷"}, + "toggle2": {"interval": 80, "frames": "▫▪"}, + "toggle3": {"interval": 120, "frames": "□■"}, + "toggle4": {"interval": 100, "frames": "■□▪▫"}, + "toggle5": {"interval": 100, "frames": "▮▯"}, + "toggle6": {"interval": 300, "frames": "ဝ၀"}, + "toggle7": {"interval": 80, "frames": "⦾⦿"}, + "toggle8": {"interval": 100, "frames": "◍◌"}, + "toggle9": {"interval": 100, "frames": "◉◎"}, + "toggle10": {"interval": 100, "frames": "㊂㊀㊁"}, + "toggle11": {"interval": 50, "frames": "⧇⧆"}, + "toggle12": {"interval": 120, "frames": "☗☖"}, + "toggle13": {"interval": 80, "frames": "=*-"}, + "arrow": {"interval": 100, "frames": "←↖↑↗→↘↓↙"}, + "arrow2": { + "interval": 80, + "frames": ["⬆️ ", "↗️ ", "➡️ ", "↘️ ", "⬇️ ", "↙️ ", "⬅️ ", "↖️ "], + }, + "arrow3": { + "interval": 120, + "frames": ["▹▹▹▹▹", "▸▹▹▹▹", "▹▸▹▹▹", "▹▹▸▹▹", "▹▹▹▸▹", "▹▹▹▹▸"], + }, + "bouncingBar": { + "interval": 80, + "frames": [ + "[ ]", + "[= ]", + "[== ]", + "[=== ]", + "[ ===]", + "[ ==]", + "[ =]", + "[ ]", + "[ =]", + "[ ==]", + "[ ===]", + "[====]", + "[=== ]", + "[== ]", + "[= ]", + ], + }, + "bouncingBall": { + "interval": 80, + "frames": [ + "( ● )", + "( ● )", + "( ● )", + "( ● )", + "( ●)", + "( ● )", + "( ● )", + "( ● )", + "( ● )", + "(● )", + ], + }, + "smiley": {"interval": 200, "frames": ["😄 ", "😝 "]}, + "monkey": {"interval": 300, "frames": ["🙈 ", "🙈 ", "🙉 ", "🙊 "]}, + "hearts": {"interval": 100, "frames": ["💛 ", "💙 ", "💜 ", "💚 ", "❤️ "]}, + "clock": { + "interval": 100, + "frames": [ + "🕛 ", + "🕐 ", + "🕑 ", + "🕒 ", + "🕓 ", + "🕔 ", + "🕕 ", + "🕖 ", + "🕗 ", + "🕘 ", + "🕙 ", + "🕚 ", + ], + }, + "earth": {"interval": 180, "frames": ["🌍 ", "🌎 ", "🌏 "]}, + "material": { + "interval": 17, + "frames": [ + "█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", + "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", + "███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", + "████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", + "██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁", + "██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁", + "███████▁▁▁▁▁▁▁▁▁▁▁▁▁", + "████████▁▁▁▁▁▁▁▁▁▁▁▁", + "█████████▁▁▁▁▁▁▁▁▁▁▁", + "█████████▁▁▁▁▁▁▁▁▁▁▁", + "██████████▁▁▁▁▁▁▁▁▁▁", + "███████████▁▁▁▁▁▁▁▁▁", + "█████████████▁▁▁▁▁▁▁", + "██████████████▁▁▁▁▁▁", + "██████████████▁▁▁▁▁▁", + "▁██████████████▁▁▁▁▁", + "▁██████████████▁▁▁▁▁", + "▁██████████████▁▁▁▁▁", + "▁▁██████████████▁▁▁▁", + "▁▁▁██████████████▁▁▁", + "▁▁▁▁█████████████▁▁▁", + "▁▁▁▁██████████████▁▁", + "▁▁▁▁██████████████▁▁", + "▁▁▁▁▁██████████████▁", + "▁▁▁▁▁██████████████▁", + "▁▁▁▁▁██████████████▁", + "▁▁▁▁▁▁██████████████", + "▁▁▁▁▁▁██████████████", + "▁▁▁▁▁▁▁█████████████", + "▁▁▁▁▁▁▁█████████████", + "▁▁▁▁▁▁▁▁████████████", + "▁▁▁▁▁▁▁▁████████████", + "▁▁▁▁▁▁▁▁▁███████████", + "▁▁▁▁▁▁▁▁▁███████████", + "▁▁▁▁▁▁▁▁▁▁██████████", + "▁▁▁▁▁▁▁▁▁▁██████████", + "▁▁▁▁▁▁▁▁▁▁▁▁████████", + "▁▁▁▁▁▁▁▁▁▁▁▁▁███████", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████", + "█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", + "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", + "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", + "███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", + "████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", + "█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", + "█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", + "██████▁▁▁▁▁▁▁▁▁▁▁▁▁█", + "████████▁▁▁▁▁▁▁▁▁▁▁▁", + "█████████▁▁▁▁▁▁▁▁▁▁▁", + "█████████▁▁▁▁▁▁▁▁▁▁▁", + "█████████▁▁▁▁▁▁▁▁▁▁▁", + "█████████▁▁▁▁▁▁▁▁▁▁▁", + "███████████▁▁▁▁▁▁▁▁▁", + "████████████▁▁▁▁▁▁▁▁", + "████████████▁▁▁▁▁▁▁▁", + "██████████████▁▁▁▁▁▁", + "██████████████▁▁▁▁▁▁", + "▁██████████████▁▁▁▁▁", + "▁██████████████▁▁▁▁▁", + "▁▁▁█████████████▁▁▁▁", + "▁▁▁▁▁████████████▁▁▁", + "▁▁▁▁▁████████████▁▁▁", + "▁▁▁▁▁▁███████████▁▁▁", + "▁▁▁▁▁▁▁▁█████████▁▁▁", + "▁▁▁▁▁▁▁▁█████████▁▁▁", + "▁▁▁▁▁▁▁▁▁█████████▁▁", + "▁▁▁▁▁▁▁▁▁█████████▁▁", + "▁▁▁▁▁▁▁▁▁▁█████████▁", + "▁▁▁▁▁▁▁▁▁▁▁████████▁", + "▁▁▁▁▁▁▁▁▁▁▁████████▁", + "▁▁▁▁▁▁▁▁▁▁▁▁███████▁", + "▁▁▁▁▁▁▁▁▁▁▁▁███████▁", + "▁▁▁▁▁▁▁▁▁▁▁▁▁███████", + "▁▁▁▁▁▁▁▁▁▁▁▁▁███████", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", + "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", + ], + }, + "moon": { + "interval": 80, + "frames": ["🌑 ", "🌒 ", "🌓 ", "🌔 ", "🌕 ", "🌖 ", "🌗 ", "🌘 "], + }, + "runner": {"interval": 140, "frames": ["🚶 ", "🏃 "]}, + "pong": { + "interval": 80, + "frames": [ + "▐⠂ ▌", + "▐⠈ ▌", + "▐ ⠂ ▌", + "▐ ⠠ ▌", + "▐ ⡀ ▌", + "▐ ⠠ ▌", + "▐ ⠂ ▌", + "▐ ⠈ ▌", + "▐ ⠂ ▌", + "▐ ⠠ ▌", + "▐ ⡀ ▌", + "▐ ⠠ ▌", + "▐ ⠂ ▌", + "▐ ⠈ ▌", + "▐ ⠂▌", + "▐ ⠠▌", + "▐ ⡀▌", + "▐ ⠠ ▌", + "▐ ⠂ ▌", + "▐ ⠈ ▌", + "▐ ⠂ ▌", + "▐ ⠠ ▌", + "▐ ⡀ ▌", + "▐ ⠠ ▌", + "▐ ⠂ ▌", + "▐ ⠈ ▌", + "▐ ⠂ ▌", + "▐ ⠠ ▌", + "▐ ⡀ ▌", + "▐⠠ ▌", + ], + }, + "shark": { + "interval": 120, + "frames": [ + "▐|\\____________▌", + "▐_|\\___________▌", + "▐__|\\__________▌", + "▐___|\\_________▌", + "▐____|\\________▌", + "▐_____|\\_______▌", + "▐______|\\______▌", + "▐_______|\\_____▌", + "▐________|\\____▌", + "▐_________|\\___▌", + "▐__________|\\__▌", + "▐___________|\\_▌", + "▐____________|\\▌", + "▐____________/|▌", + "▐___________/|_▌", + "▐__________/|__▌", + "▐_________/|___▌", + "▐________/|____▌", + "▐_______/|_____▌", + "▐______/|______▌", + "▐_____/|_______▌", + "▐____/|________▌", + "▐___/|_________▌", + "▐__/|__________▌", + "▐_/|___________▌", + "▐/|____________▌", + ], + }, + "dqpb": {"interval": 100, "frames": "dqpb"}, + "weather": { + "interval": 100, + "frames": [ + "☀️ ", + "☀️ ", + "☀️ ", + "🌤 ", + "⛅️ ", + "🌥 ", + "☁️ ", + "🌧 ", + "🌨 ", + "🌧 ", + "🌨 ", + "🌧 ", + "🌨 ", + "⛈ ", + "🌨 ", + "🌧 ", + "🌨 ", + "☁️ ", + "🌥 ", + "⛅️ ", + "🌤 ", + "☀️ ", + "☀️ ", + ], + }, + "christmas": {"interval": 400, "frames": "🌲🎄"}, + "grenade": { + "interval": 80, + "frames": [ + "، ", + "′ ", + " ´ ", + " ‾ ", + " ⸌", + " ⸊", + " |", + " ⁎", + " ⁕", + " ෴ ", + " ⁓", + " ", + " ", + " ", + ], + }, + "point": {"interval": 125, "frames": ["∙∙∙", "●∙∙", "∙●∙", "∙∙●", "∙∙∙"]}, + "layer": {"interval": 150, "frames": "-=≡"}, + "betaWave": { + "interval": 80, + "frames": [ + "ρββββββ", + "βρβββββ", + "ββρββββ", + "βββρβββ", + "ββββρββ", + "βββββρβ", + "ββββββρ", + ], + }, + "aesthetic": { + "interval": 80, + "frames": [ + "▰▱▱▱▱▱▱", + "▰▰▱▱▱▱▱", + "▰▰▰▱▱▱▱", + "▰▰▰▰▱▱▱", + "▰▰▰▰▰▱▱", + "▰▰▰▰▰▰▱", + "▰▰▰▰▰▰▰", + "▰▱▱▱▱▱▱", + ], + }, +} diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/_stack.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/_stack.py new file mode 100644 index 0000000000000000000000000000000000000000..194564e761ddae165b39ef6598877e2e3820af0a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/_stack.py @@ -0,0 +1,16 @@ +from typing import List, TypeVar + +T = TypeVar("T") + + +class Stack(List[T]): + """A small shim over builtin list.""" + + @property + def top(self) -> T: + """Get top of stack.""" + return self[-1] + + def push(self, item: T) -> None: + """Push an item on to the stack (append in stack nomenclature).""" + self.append(item) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/_timer.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/_timer.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ca6be03c43054caaa3660998273ebf704345dd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/_timer.py @@ -0,0 +1,19 @@ +""" +Timer context manager, only used in debug. + +""" + +from time import time + +import contextlib +from typing import Generator + + +@contextlib.contextmanager +def timer(subject: str = "time") -> Generator[None, None, None]: + """print the elapsed time. (only used in debugging)""" + start = time() + yield + elapsed = time() - start + elapsed_ms = elapsed * 1000 + print(f"{subject} elapsed {elapsed_ms:.1f}ms") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/_win32_console.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/_win32_console.py new file mode 100644 index 0000000000000000000000000000000000000000..371ec09fac6954e5fc2473543db4225f760450cb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/_win32_console.py @@ -0,0 +1,661 @@ +"""Light wrapper around the Win32 Console API - this module should only be imported on Windows + +The API that this module wraps is documented at https://docs.microsoft.com/en-us/windows/console/console-functions +""" + +import ctypes +import sys +from typing import Any + +windll: Any = None +if sys.platform == "win32": + windll = ctypes.LibraryLoader(ctypes.WinDLL) +else: + raise ImportError(f"{__name__} can only be imported on Windows") + +import time +from ctypes import Structure, byref, wintypes +from typing import IO, NamedTuple, Type, cast + +from rich.color import ColorSystem +from rich.style import Style + +STDOUT = -11 +ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4 + +COORD = wintypes._COORD + + +class LegacyWindowsError(Exception): + pass + + +class WindowsCoordinates(NamedTuple): + """Coordinates in the Windows Console API are (y, x), not (x, y). + This class is intended to prevent that confusion. + Rows and columns are indexed from 0. + This class can be used in place of wintypes._COORD in arguments and argtypes. + """ + + row: int + col: int + + @classmethod + def from_param(cls, value: "WindowsCoordinates") -> COORD: + """Converts a WindowsCoordinates into a wintypes _COORD structure. + This classmethod is internally called by ctypes to perform the conversion. + + Args: + value (WindowsCoordinates): The input coordinates to convert. + + Returns: + wintypes._COORD: The converted coordinates struct. + """ + return COORD(value.col, value.row) + + +class CONSOLE_SCREEN_BUFFER_INFO(Structure): + _fields_ = [ + ("dwSize", COORD), + ("dwCursorPosition", COORD), + ("wAttributes", wintypes.WORD), + ("srWindow", wintypes.SMALL_RECT), + ("dwMaximumWindowSize", COORD), + ] + + +class CONSOLE_CURSOR_INFO(ctypes.Structure): + _fields_ = [("dwSize", wintypes.DWORD), ("bVisible", wintypes.BOOL)] + + +_GetStdHandle = windll.kernel32.GetStdHandle +_GetStdHandle.argtypes = [ + wintypes.DWORD, +] +_GetStdHandle.restype = wintypes.HANDLE + + +def GetStdHandle(handle: int = STDOUT) -> wintypes.HANDLE: + """Retrieves a handle to the specified standard device (standard input, standard output, or standard error). + + Args: + handle (int): Integer identifier for the handle. Defaults to -11 (stdout). + + Returns: + wintypes.HANDLE: The handle + """ + return cast(wintypes.HANDLE, _GetStdHandle(handle)) + + +_GetConsoleMode = windll.kernel32.GetConsoleMode +_GetConsoleMode.argtypes = [wintypes.HANDLE, wintypes.LPDWORD] +_GetConsoleMode.restype = wintypes.BOOL + + +def GetConsoleMode(std_handle: wintypes.HANDLE) -> int: + """Retrieves the current input mode of a console's input buffer + or the current output mode of a console screen buffer. + + Args: + std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. + + Raises: + LegacyWindowsError: If any error occurs while calling the Windows console API. + + Returns: + int: Value representing the current console mode as documented at + https://docs.microsoft.com/en-us/windows/console/getconsolemode#parameters + """ + + console_mode = wintypes.DWORD() + success = bool(_GetConsoleMode(std_handle, console_mode)) + if not success: + raise LegacyWindowsError("Unable to get legacy Windows Console Mode") + return console_mode.value + + +_FillConsoleOutputCharacterW = windll.kernel32.FillConsoleOutputCharacterW +_FillConsoleOutputCharacterW.argtypes = [ + wintypes.HANDLE, + ctypes.c_char, + wintypes.DWORD, + cast(Type[COORD], WindowsCoordinates), + ctypes.POINTER(wintypes.DWORD), +] +_FillConsoleOutputCharacterW.restype = wintypes.BOOL + + +def FillConsoleOutputCharacter( + std_handle: wintypes.HANDLE, + char: str, + length: int, + start: WindowsCoordinates, +) -> int: + """Writes a character to the console screen buffer a specified number of times, beginning at the specified coordinates. + + Args: + std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. + char (str): The character to write. Must be a string of length 1. + length (int): The number of times to write the character. + start (WindowsCoordinates): The coordinates to start writing at. + + Returns: + int: The number of characters written. + """ + character = ctypes.c_char(char.encode()) + num_characters = wintypes.DWORD(length) + num_written = wintypes.DWORD(0) + _FillConsoleOutputCharacterW( + std_handle, + character, + num_characters, + start, + byref(num_written), + ) + return num_written.value + + +_FillConsoleOutputAttribute = windll.kernel32.FillConsoleOutputAttribute +_FillConsoleOutputAttribute.argtypes = [ + wintypes.HANDLE, + wintypes.WORD, + wintypes.DWORD, + cast(Type[COORD], WindowsCoordinates), + ctypes.POINTER(wintypes.DWORD), +] +_FillConsoleOutputAttribute.restype = wintypes.BOOL + + +def FillConsoleOutputAttribute( + std_handle: wintypes.HANDLE, + attributes: int, + length: int, + start: WindowsCoordinates, +) -> int: + """Sets the character attributes for a specified number of character cells, + beginning at the specified coordinates in a screen buffer. + + Args: + std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. + attributes (int): Integer value representing the foreground and background colours of the cells. + length (int): The number of cells to set the output attribute of. + start (WindowsCoordinates): The coordinates of the first cell whose attributes are to be set. + + Returns: + int: The number of cells whose attributes were actually set. + """ + num_cells = wintypes.DWORD(length) + style_attrs = wintypes.WORD(attributes) + num_written = wintypes.DWORD(0) + _FillConsoleOutputAttribute( + std_handle, style_attrs, num_cells, start, byref(num_written) + ) + return num_written.value + + +_SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute +_SetConsoleTextAttribute.argtypes = [ + wintypes.HANDLE, + wintypes.WORD, +] +_SetConsoleTextAttribute.restype = wintypes.BOOL + + +def SetConsoleTextAttribute( + std_handle: wintypes.HANDLE, attributes: wintypes.WORD +) -> bool: + """Set the colour attributes for all text written after this function is called. + + Args: + std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. + attributes (int): Integer value representing the foreground and background colours. + + + Returns: + bool: True if the attribute was set successfully, otherwise False. + """ + return bool(_SetConsoleTextAttribute(std_handle, attributes)) + + +_GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo +_GetConsoleScreenBufferInfo.argtypes = [ + wintypes.HANDLE, + ctypes.POINTER(CONSOLE_SCREEN_BUFFER_INFO), +] +_GetConsoleScreenBufferInfo.restype = wintypes.BOOL + + +def GetConsoleScreenBufferInfo( + std_handle: wintypes.HANDLE, +) -> CONSOLE_SCREEN_BUFFER_INFO: + """Retrieves information about the specified console screen buffer. + + Args: + std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. + + Returns: + CONSOLE_SCREEN_BUFFER_INFO: A CONSOLE_SCREEN_BUFFER_INFO ctype struct contain information about + screen size, cursor position, colour attributes, and more.""" + console_screen_buffer_info = CONSOLE_SCREEN_BUFFER_INFO() + _GetConsoleScreenBufferInfo(std_handle, byref(console_screen_buffer_info)) + return console_screen_buffer_info + + +_SetConsoleCursorPosition = windll.kernel32.SetConsoleCursorPosition +_SetConsoleCursorPosition.argtypes = [ + wintypes.HANDLE, + cast(Type[COORD], WindowsCoordinates), +] +_SetConsoleCursorPosition.restype = wintypes.BOOL + + +def SetConsoleCursorPosition( + std_handle: wintypes.HANDLE, coords: WindowsCoordinates +) -> bool: + """Set the position of the cursor in the console screen + + Args: + std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. + coords (WindowsCoordinates): The coordinates to move the cursor to. + + Returns: + bool: True if the function succeeds, otherwise False. + """ + return bool(_SetConsoleCursorPosition(std_handle, coords)) + + +_GetConsoleCursorInfo = windll.kernel32.GetConsoleCursorInfo +_GetConsoleCursorInfo.argtypes = [ + wintypes.HANDLE, + ctypes.POINTER(CONSOLE_CURSOR_INFO), +] +_GetConsoleCursorInfo.restype = wintypes.BOOL + + +def GetConsoleCursorInfo( + std_handle: wintypes.HANDLE, cursor_info: CONSOLE_CURSOR_INFO +) -> bool: + """Get the cursor info - used to get cursor visibility and width + + Args: + std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. + cursor_info (CONSOLE_CURSOR_INFO): CONSOLE_CURSOR_INFO ctype struct that receives information + about the console's cursor. + + Returns: + bool: True if the function succeeds, otherwise False. + """ + return bool(_GetConsoleCursorInfo(std_handle, byref(cursor_info))) + + +_SetConsoleCursorInfo = windll.kernel32.SetConsoleCursorInfo +_SetConsoleCursorInfo.argtypes = [ + wintypes.HANDLE, + ctypes.POINTER(CONSOLE_CURSOR_INFO), +] +_SetConsoleCursorInfo.restype = wintypes.BOOL + + +def SetConsoleCursorInfo( + std_handle: wintypes.HANDLE, cursor_info: CONSOLE_CURSOR_INFO +) -> bool: + """Set the cursor info - used for adjusting cursor visibility and width + + Args: + std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. + cursor_info (CONSOLE_CURSOR_INFO): CONSOLE_CURSOR_INFO ctype struct containing the new cursor info. + + Returns: + bool: True if the function succeeds, otherwise False. + """ + return bool(_SetConsoleCursorInfo(std_handle, byref(cursor_info))) + + +_SetConsoleTitle = windll.kernel32.SetConsoleTitleW +_SetConsoleTitle.argtypes = [wintypes.LPCWSTR] +_SetConsoleTitle.restype = wintypes.BOOL + + +def SetConsoleTitle(title: str) -> bool: + """Sets the title of the current console window + + Args: + title (str): The new title of the console window. + + Returns: + bool: True if the function succeeds, otherwise False. + """ + return bool(_SetConsoleTitle(title)) + + +class LegacyWindowsTerm: + """This class allows interaction with the legacy Windows Console API. It should only be used in the context + of environments where virtual terminal processing is not available. However, if it is used in a Windows environment, + the entire API should work. + + Args: + file (IO[str]): The file which the Windows Console API HANDLE is retrieved from, defaults to sys.stdout. + """ + + BRIGHT_BIT = 8 + + # Indices are ANSI color numbers, values are the corresponding Windows Console API color numbers + ANSI_TO_WINDOWS = [ + 0, # black The Windows colours are defined in wincon.h as follows: + 4, # red define FOREGROUND_BLUE 0x0001 -- 0000 0001 + 2, # green define FOREGROUND_GREEN 0x0002 -- 0000 0010 + 6, # yellow define FOREGROUND_RED 0x0004 -- 0000 0100 + 1, # blue define FOREGROUND_INTENSITY 0x0008 -- 0000 1000 + 5, # magenta define BACKGROUND_BLUE 0x0010 -- 0001 0000 + 3, # cyan define BACKGROUND_GREEN 0x0020 -- 0010 0000 + 7, # white define BACKGROUND_RED 0x0040 -- 0100 0000 + 8, # bright black (grey) define BACKGROUND_INTENSITY 0x0080 -- 1000 0000 + 12, # bright red + 10, # bright green + 14, # bright yellow + 9, # bright blue + 13, # bright magenta + 11, # bright cyan + 15, # bright white + ] + + def __init__(self, file: "IO[str]") -> None: + handle = GetStdHandle(STDOUT) + self._handle = handle + default_text = GetConsoleScreenBufferInfo(handle).wAttributes + self._default_text = default_text + + self._default_fore = default_text & 7 + self._default_back = (default_text >> 4) & 7 + self._default_attrs = self._default_fore | (self._default_back << 4) + + self._file = file + self.write = file.write + self.flush = file.flush + + @property + def cursor_position(self) -> WindowsCoordinates: + """Returns the current position of the cursor (0-based) + + Returns: + WindowsCoordinates: The current cursor position. + """ + coord: COORD = GetConsoleScreenBufferInfo(self._handle).dwCursorPosition + return WindowsCoordinates(row=coord.Y, col=coord.X) + + @property + def screen_size(self) -> WindowsCoordinates: + """Returns the current size of the console screen buffer, in character columns and rows + + Returns: + WindowsCoordinates: The width and height of the screen as WindowsCoordinates. + """ + screen_size: COORD = GetConsoleScreenBufferInfo(self._handle).dwSize + return WindowsCoordinates(row=screen_size.Y, col=screen_size.X) + + def write_text(self, text: str) -> None: + """Write text directly to the terminal without any modification of styles + + Args: + text (str): The text to write to the console + """ + self.write(text) + self.flush() + + def write_styled(self, text: str, style: Style) -> None: + """Write styled text to the terminal. + + Args: + text (str): The text to write + style (Style): The style of the text + """ + color = style.color + bgcolor = style.bgcolor + if style.reverse: + color, bgcolor = bgcolor, color + + if color: + fore = color.downgrade(ColorSystem.WINDOWS).number + fore = fore if fore is not None else 7 # Default to ANSI 7: White + if style.bold: + fore = fore | self.BRIGHT_BIT + if style.dim: + fore = fore & ~self.BRIGHT_BIT + fore = self.ANSI_TO_WINDOWS[fore] + else: + fore = self._default_fore + + if bgcolor: + back = bgcolor.downgrade(ColorSystem.WINDOWS).number + back = back if back is not None else 0 # Default to ANSI 0: Black + back = self.ANSI_TO_WINDOWS[back] + else: + back = self._default_back + + assert fore is not None + assert back is not None + + SetConsoleTextAttribute( + self._handle, attributes=ctypes.c_ushort(fore | (back << 4)) + ) + self.write_text(text) + SetConsoleTextAttribute(self._handle, attributes=self._default_text) + + def move_cursor_to(self, new_position: WindowsCoordinates) -> None: + """Set the position of the cursor + + Args: + new_position (WindowsCoordinates): The WindowsCoordinates representing the new position of the cursor. + """ + if new_position.col < 0 or new_position.row < 0: + return + SetConsoleCursorPosition(self._handle, coords=new_position) + + def erase_line(self) -> None: + """Erase all content on the line the cursor is currently located at""" + screen_size = self.screen_size + cursor_position = self.cursor_position + cells_to_erase = screen_size.col + start_coordinates = WindowsCoordinates(row=cursor_position.row, col=0) + FillConsoleOutputCharacter( + self._handle, " ", length=cells_to_erase, start=start_coordinates + ) + FillConsoleOutputAttribute( + self._handle, + self._default_attrs, + length=cells_to_erase, + start=start_coordinates, + ) + + def erase_end_of_line(self) -> None: + """Erase all content from the cursor position to the end of that line""" + cursor_position = self.cursor_position + cells_to_erase = self.screen_size.col - cursor_position.col + FillConsoleOutputCharacter( + self._handle, " ", length=cells_to_erase, start=cursor_position + ) + FillConsoleOutputAttribute( + self._handle, + self._default_attrs, + length=cells_to_erase, + start=cursor_position, + ) + + def erase_start_of_line(self) -> None: + """Erase all content from the cursor position to the start of that line""" + row, col = self.cursor_position + start = WindowsCoordinates(row, 0) + FillConsoleOutputCharacter(self._handle, " ", length=col, start=start) + FillConsoleOutputAttribute( + self._handle, self._default_attrs, length=col, start=start + ) + + def move_cursor_up(self) -> None: + """Move the cursor up a single cell""" + cursor_position = self.cursor_position + SetConsoleCursorPosition( + self._handle, + coords=WindowsCoordinates( + row=cursor_position.row - 1, col=cursor_position.col + ), + ) + + def move_cursor_down(self) -> None: + """Move the cursor down a single cell""" + cursor_position = self.cursor_position + SetConsoleCursorPosition( + self._handle, + coords=WindowsCoordinates( + row=cursor_position.row + 1, + col=cursor_position.col, + ), + ) + + def move_cursor_forward(self) -> None: + """Move the cursor forward a single cell. Wrap to the next line if required.""" + row, col = self.cursor_position + if col == self.screen_size.col - 1: + row += 1 + col = 0 + else: + col += 1 + SetConsoleCursorPosition( + self._handle, coords=WindowsCoordinates(row=row, col=col) + ) + + def move_cursor_to_column(self, column: int) -> None: + """Move cursor to the column specified by the zero-based column index, staying on the same row + + Args: + column (int): The zero-based column index to move the cursor to. + """ + row, _ = self.cursor_position + SetConsoleCursorPosition(self._handle, coords=WindowsCoordinates(row, column)) + + def move_cursor_backward(self) -> None: + """Move the cursor backward a single cell. Wrap to the previous line if required.""" + row, col = self.cursor_position + if col == 0: + row -= 1 + col = self.screen_size.col - 1 + else: + col -= 1 + SetConsoleCursorPosition( + self._handle, coords=WindowsCoordinates(row=row, col=col) + ) + + def hide_cursor(self) -> None: + """Hide the cursor""" + current_cursor_size = self._get_cursor_size() + invisible_cursor = CONSOLE_CURSOR_INFO(dwSize=current_cursor_size, bVisible=0) + SetConsoleCursorInfo(self._handle, cursor_info=invisible_cursor) + + def show_cursor(self) -> None: + """Show the cursor""" + current_cursor_size = self._get_cursor_size() + visible_cursor = CONSOLE_CURSOR_INFO(dwSize=current_cursor_size, bVisible=1) + SetConsoleCursorInfo(self._handle, cursor_info=visible_cursor) + + def set_title(self, title: str) -> None: + """Set the title of the terminal window + + Args: + title (str): The new title of the console window + """ + assert len(title) < 255, "Console title must be less than 255 characters" + SetConsoleTitle(title) + + def _get_cursor_size(self) -> int: + """Get the percentage of the character cell that is filled by the cursor""" + cursor_info = CONSOLE_CURSOR_INFO() + GetConsoleCursorInfo(self._handle, cursor_info=cursor_info) + return int(cursor_info.dwSize) + + +if __name__ == "__main__": + handle = GetStdHandle() + + from rich.console import Console + + console = Console() + + term = LegacyWindowsTerm(sys.stdout) + term.set_title("Win32 Console Examples") + + style = Style(color="black", bgcolor="red") + + heading = Style.parse("black on green") + + # Check colour output + console.rule("Checking colour output") + console.print("[on red]on red!") + console.print("[blue]blue!") + console.print("[yellow]yellow!") + console.print("[bold yellow]bold yellow!") + console.print("[bright_yellow]bright_yellow!") + console.print("[dim bright_yellow]dim bright_yellow!") + console.print("[italic cyan]italic cyan!") + console.print("[bold white on blue]bold white on blue!") + console.print("[reverse bold white on blue]reverse bold white on blue!") + console.print("[bold black on cyan]bold black on cyan!") + console.print("[black on green]black on green!") + console.print("[blue on green]blue on green!") + console.print("[white on black]white on black!") + console.print("[black on white]black on white!") + console.print("[#1BB152 on #DA812D]#1BB152 on #DA812D!") + + # Check cursor movement + console.rule("Checking cursor movement") + console.print() + term.move_cursor_backward() + term.move_cursor_backward() + term.write_text("went back and wrapped to prev line") + time.sleep(1) + term.move_cursor_up() + term.write_text("we go up") + time.sleep(1) + term.move_cursor_down() + term.write_text("and down") + time.sleep(1) + term.move_cursor_up() + term.move_cursor_backward() + term.move_cursor_backward() + term.write_text("we went up and back 2") + time.sleep(1) + term.move_cursor_down() + term.move_cursor_backward() + term.move_cursor_backward() + term.write_text("we went down and back 2") + time.sleep(1) + + # Check erasing of lines + term.hide_cursor() + console.print() + console.rule("Checking line erasing") + console.print("\n...Deleting to the start of the line...") + term.write_text("The red arrow shows the cursor location, and direction of erase") + time.sleep(1) + term.move_cursor_to_column(16) + term.write_styled("<", Style.parse("black on red")) + term.move_cursor_backward() + time.sleep(1) + term.erase_start_of_line() + time.sleep(1) + + console.print("\n\n...And to the end of the line...") + term.write_text("The red arrow shows the cursor location, and direction of erase") + time.sleep(1) + + term.move_cursor_to_column(16) + term.write_styled(">", Style.parse("black on red")) + time.sleep(1) + term.erase_end_of_line() + time.sleep(1) + + console.print("\n\n...Now the whole line will be erased...") + term.write_styled("I'm going to disappear!", style=Style.parse("black on cyan")) + time.sleep(1) + term.erase_line() + + term.show_cursor() + print("\n") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/_windows.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/_windows.py new file mode 100644 index 0000000000000000000000000000000000000000..e17c5c0fdcaeec4b2b0c007733970ae4ffa9c641 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/_windows.py @@ -0,0 +1,71 @@ +import sys +from dataclasses import dataclass + + +@dataclass +class WindowsConsoleFeatures: + """Windows features available.""" + + vt: bool = False + """The console supports VT codes.""" + truecolor: bool = False + """The console supports truecolor.""" + + +try: + import ctypes + from ctypes import LibraryLoader + + if sys.platform == "win32": + windll = LibraryLoader(ctypes.WinDLL) + else: + windll = None + raise ImportError("Not windows") + + from rich._win32_console import ( + ENABLE_VIRTUAL_TERMINAL_PROCESSING, + GetConsoleMode, + GetStdHandle, + LegacyWindowsError, + ) + +except (AttributeError, ImportError, ValueError): + # Fallback if we can't load the Windows DLL + def get_windows_console_features() -> WindowsConsoleFeatures: + features = WindowsConsoleFeatures() + return features + +else: + + def get_windows_console_features() -> WindowsConsoleFeatures: + """Get windows console features. + + Returns: + WindowsConsoleFeatures: An instance of WindowsConsoleFeatures. + """ + handle = GetStdHandle() + try: + console_mode = GetConsoleMode(handle) + success = True + except LegacyWindowsError: + console_mode = 0 + success = False + vt = bool(success and console_mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) + truecolor = False + if vt: + win_version = sys.getwindowsversion() + truecolor = win_version.major > 10 or ( + win_version.major == 10 and win_version.build >= 15063 + ) + features = WindowsConsoleFeatures(vt=vt, truecolor=truecolor) + return features + + +if __name__ == "__main__": + import platform + + features = get_windows_console_features() + from rich import print + + print(f'platform="{platform.system()}"') + print(repr(features)) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/_windows_renderer.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/_windows_renderer.py new file mode 100644 index 0000000000000000000000000000000000000000..0fc2ba852a92a45ef510d27ca6ce5e5348bec8a1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/_windows_renderer.py @@ -0,0 +1,56 @@ +from typing import Iterable, Sequence, Tuple, cast + +from rich._win32_console import LegacyWindowsTerm, WindowsCoordinates +from rich.segment import ControlCode, ControlType, Segment + + +def legacy_windows_render(buffer: Iterable[Segment], term: LegacyWindowsTerm) -> None: + """Makes appropriate Windows Console API calls based on the segments in the buffer. + + Args: + buffer (Iterable[Segment]): Iterable of Segments to convert to Win32 API calls. + term (LegacyWindowsTerm): Used to call the Windows Console API. + """ + for text, style, control in buffer: + if not control: + if style: + term.write_styled(text, style) + else: + term.write_text(text) + else: + control_codes: Sequence[ControlCode] = control + for control_code in control_codes: + control_type = control_code[0] + if control_type == ControlType.CURSOR_MOVE_TO: + _, x, y = cast(Tuple[ControlType, int, int], control_code) + term.move_cursor_to(WindowsCoordinates(row=y - 1, col=x - 1)) + elif control_type == ControlType.CARRIAGE_RETURN: + term.write_text("\r") + elif control_type == ControlType.HOME: + term.move_cursor_to(WindowsCoordinates(0, 0)) + elif control_type == ControlType.CURSOR_UP: + term.move_cursor_up() + elif control_type == ControlType.CURSOR_DOWN: + term.move_cursor_down() + elif control_type == ControlType.CURSOR_FORWARD: + term.move_cursor_forward() + elif control_type == ControlType.CURSOR_BACKWARD: + term.move_cursor_backward() + elif control_type == ControlType.CURSOR_MOVE_TO_COLUMN: + _, column = cast(Tuple[ControlType, int], control_code) + term.move_cursor_to_column(column - 1) + elif control_type == ControlType.HIDE_CURSOR: + term.hide_cursor() + elif control_type == ControlType.SHOW_CURSOR: + term.show_cursor() + elif control_type == ControlType.ERASE_IN_LINE: + _, mode = cast(Tuple[ControlType, int], control_code) + if mode == 0: + term.erase_end_of_line() + elif mode == 1: + term.erase_start_of_line() + elif mode == 2: + term.erase_line() + elif control_type == ControlType.SET_WINDOW_TITLE: + _, title = cast(Tuple[ControlType, str], control_code) + term.set_title(title) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rich/_wrap.py b/TTS/Kokoro/.venv/Lib/site-packages/rich/_wrap.py new file mode 100644 index 0000000000000000000000000000000000000000..2e94ff6f43adfb6a6900a3a2147781e91220b189 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rich/_wrap.py @@ -0,0 +1,93 @@ +from __future__ import annotations + +import re +from typing import Iterable + +from ._loop import loop_last +from .cells import cell_len, chop_cells + +re_word = re.compile(r"\s*\S+\s*") + + +def words(text: str) -> Iterable[tuple[int, int, str]]: + """Yields each word from the text as a tuple + containing (start_index, end_index, word). A "word" in this context may + include the actual word and any whitespace to the right. + """ + position = 0 + word_match = re_word.match(text, position) + while word_match is not None: + start, end = word_match.span() + word = word_match.group(0) + yield start, end, word + word_match = re_word.match(text, end) + + +def divide_line(text: str, width: int, fold: bool = True) -> list[int]: + """Given a string of text, and a width (measured in cells), return a list + of cell offsets which the string should be split at in order for it to fit + within the given width. + + Args: + text: The text to examine. + width: The available cell width. + fold: If True, words longer than `width` will be folded onto a new line. + + Returns: + A list of indices to break the line at. + """ + break_positions: list[int] = [] # offsets to insert the breaks at + append = break_positions.append + cell_offset = 0 + _cell_len = cell_len + + for start, _end, word in words(text): + word_length = _cell_len(word.rstrip()) + remaining_space = width - cell_offset + word_fits_remaining_space = remaining_space >= word_length + + if word_fits_remaining_space: + # Simplest case - the word fits within the remaining width for this line. + cell_offset += _cell_len(word) + else: + # Not enough space remaining for this word on the current line. + if word_length > width: + # The word doesn't fit on any line, so we can't simply + # place it on the next line... + if fold: + # Fold the word across multiple lines. + folded_word = chop_cells(word, width=width) + for last, line in loop_last(folded_word): + if start: + append(start) + if last: + cell_offset = _cell_len(line) + else: + start += len(line) + else: + # Folding isn't allowed, so crop the word. + if start: + append(start) + cell_offset = _cell_len(word) + elif cell_offset and start: + # The word doesn't fit within the remaining space on the current + # line, but it *can* fit on to the next (empty) line. + append(start) + cell_offset = _cell_len(word) + + return break_positions + + +if __name__ == "__main__": # pragma: no cover + from .console import Console + + console = Console(width=10) + console.print("12345 abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ 12345") + print(chop_cells("abcdefghijklmnopqrstuvwxyz", 10)) + + console = Console(width=20) + console.rule() + console.print("TextualはPythonの高速アプリケーション開発フレームワークです") + + console.rule() + console.print("アプリケーションは1670万色を使用でき") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rpds/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/rpds/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..257da6a7bd439c46cb2409e77531dc4a4dc6295c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rpds/__init__.py @@ -0,0 +1,5 @@ +from .rpds import * + +__doc__ = rpds.__doc__ +if hasattr(rpds, "__all__"): + __all__ = rpds.__all__ \ No newline at end of file diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rpds/__init__.pyi b/TTS/Kokoro/.venv/Lib/site-packages/rpds/__init__.pyi new file mode 100644 index 0000000000000000000000000000000000000000..cb14e2ec88bc076d9d9ecb78e296ff567d76b0f6 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rpds/__init__.pyi @@ -0,0 +1,79 @@ +from collections.abc import ( + ItemsView, + Iterable, + Iterator, + KeysView, + Mapping, + ValuesView, +) +from typing import ( + TypeVar, +) + +_T = TypeVar("_T") +_KT_co = TypeVar("_KT_co", covariant=True) +_VT_co = TypeVar("_VT_co", covariant=True) +_KU_co = TypeVar("_KU_co", covariant=True) +_VU_co = TypeVar("_VU_co", covariant=True) + +class HashTrieMap(Mapping[_KT_co, _VT_co]): + def __init__( + self, + value: Mapping[_KT_co, _VT_co] | Iterable[tuple[_KT_co, _VT_co]] = {}, + **kwds: Mapping[_KT_co, _VT_co], + ): ... + def __getitem__(self, key: _KT_co) -> _VT_co: ... + def __iter__(self) -> Iterator[_KT_co]: ... + def __len__(self) -> int: ... + def discard(self, key: _KT_co) -> HashTrieMap[_KT_co, _VT_co]: ... + def items(self) -> ItemsView[_KT_co, _VT_co]: ... + def keys(self) -> KeysView[_KT_co]: ... + def values(self) -> ValuesView[_VT_co]: ... + def remove(self, key: _KT_co) -> HashTrieMap[_KT_co, _VT_co]: ... + def insert( + self, + key: _KT_co, + val: _VT_co, + ) -> HashTrieMap[_KT_co, _VT_co]: ... + def update( + self, + *args: Mapping[_KU_co, _VU_co] | Iterable[tuple[_KU_co, _VU_co]], + ) -> HashTrieMap[_KT_co | _KU_co, _VT_co | _VU_co]: ... + @classmethod + def convert( + cls, + value: Mapping[_KT_co, _VT_co] | Iterable[tuple[_KT_co, _VT_co]], + ) -> HashTrieMap[_KT_co, _VT_co]: ... + @classmethod + def fromkeys( + cls, + keys: Iterable[_KT_co], + value: _VT_co = None, + ) -> HashTrieMap[_KT_co, _VT_co]: ... + +class HashTrieSet(frozenset[_T]): + def __init__(self, value: Iterable[_T] = ()): ... + def __iter__(self) -> Iterator[_T]: ... + def __len__(self) -> int: ... + def discard(self, value: _T) -> HashTrieSet[_T]: ... + def remove(self, value: _T) -> HashTrieSet[_T]: ... + def insert(self, value: _T) -> HashTrieSet[_T]: ... + def update(self, *args: Iterable[_T]) -> HashTrieSet[_T]: ... + +class List(Iterable[_T]): + def __init__(self, value: Iterable[_T] = (), *more: _T): ... + def __iter__(self) -> Iterator[_T]: ... + def __len__(self) -> int: ... + def push_front(self, value: _T) -> List[_T]: ... + def drop_first(self) -> List[_T]: ... + +class Queue(Iterable[_T]): + def __init__(self, value: Iterable[_T] = (), *more: _T): ... + def __iter__(self) -> Iterator[_T]: ... + def __len__(self) -> int: ... + def enqueue(self, value: _T) -> Queue[_T]: ... + def dequeue(self, value: _T) -> Queue[_T]: ... + @property + def is_empty(self) -> _T: ... + @property + def peek(self) -> _T: ... diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rpds/py.typed b/TTS/Kokoro/.venv/Lib/site-packages/rpds/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..b1cbe56bcc36a70fa6aa63d4f6150acc84087d7b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/METADATA @@ -0,0 +1,99 @@ +Metadata-Version: 2.4 +Name: rpds-py +Version: 0.30.0 +Classifier: Development Status :: 3 - Alpha +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Rust +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +License-File: LICENSE +Summary: Python bindings to Rust's persistent data structures (rpds) +Keywords: data structures,rust,persistent +Author-email: Julian Berman +License-Expression: MIT +Requires-Python: >=3.10 +Description-Content-Type: text/x-rst; charset=UTF-8 +Project-URL: Documentation, https://rpds.readthedocs.io/ +Project-URL: Homepage, https://github.com/crate-py/rpds +Project-URL: Issues, https://github.com/crate-py/rpds/issues/ +Project-URL: Funding, https://github.com/sponsors/Julian +Project-URL: Tidelift, https://tidelift.com/subscription/pkg/pypi-rpds-py?utm_source=pypi-rpds-py&utm_medium=referral&utm_campaign=pypi-link +Project-URL: Source, https://github.com/crate-py/rpds +Project-URL: Upstream, https://github.com/orium/rpds + +=========== +``rpds.py`` +=========== + +|PyPI| |Pythons| |CI| + +.. |PyPI| image:: https://img.shields.io/pypi/v/rpds-py.svg + :alt: PyPI version + :target: https://pypi.org/project/rpds-py/ + +.. |Pythons| image:: https://img.shields.io/pypi/pyversions/rpds-py.svg + :alt: Supported Python versions + :target: https://pypi.org/project/rpds-py/ + +.. |CI| image:: https://github.com/crate-py/rpds/workflows/CI/badge.svg + :alt: Build status + :target: https://github.com/crate-py/rpds/actions?query=workflow%3ACI + +.. |ReadTheDocs| image:: https://readthedocs.org/projects/referencing/badge/?version=stable&style=flat + :alt: ReadTheDocs status + :target: https://referencing.readthedocs.io/en/stable/ + + +Python bindings to the `Rust rpds crate `_ for persistent data structures. + +What's here is quite minimal (in transparency, it was written initially to support replacing ``pyrsistent`` in the `referencing library `_). +If you see something missing (which is very likely), a PR is definitely welcome to add it. + +Installation +------------ + +The distribution on PyPI is named ``rpds.py`` (equivalently ``rpds-py``), and thus can be installed via e.g.: + +.. code:: sh + + $ pip install rpds-py + +Note that if you install ``rpds-py`` from source, you will need a Rust toolchain installed, as it is a build-time dependency. +An example of how to do so in a ``Dockerfile`` can be found `here `_. + +If you believe you are on a common platform which should have wheels built (i.e. and not need to compile from source), feel free to file an issue or pull request modifying the GitHub action used here to build wheels via ``maturin``. + +Usage +----- + +Methods in general are named similarly to their ``rpds`` counterparts (rather than ``pyrsistent``\ 's conventions, though probably a full drop-in ``pyrsistent``\ -compatible wrapper module is a good addition at some point). + +.. code:: python + + >>> from rpds import HashTrieMap, HashTrieSet, List + + >>> m = HashTrieMap({"foo": "bar", "baz": "quux"}) + >>> m.insert("spam", 37) == HashTrieMap({"foo": "bar", "baz": "quux", "spam": 37}) + True + >>> m.remove("foo") == HashTrieMap({"baz": "quux"}) + True + + >>> s = HashTrieSet({"foo", "bar", "baz", "quux"}) + >>> s.insert("spam") == HashTrieSet({"foo", "bar", "baz", "quux", "spam"}) + True + >>> s.remove("foo") == HashTrieSet({"bar", "baz", "quux"}) + True + + >>> L = List([1, 3, 5]) + >>> L.push_front(-1) == List([-1, 1, 3, 5]) + True + >>> L.rest == List([3, 5]) + True + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..7b378fb9c75e3a50982bd9d71f68de632ced41a2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/RECORD @@ -0,0 +1,10 @@ +rpds/__init__.py,sha256=w3MgXW7lpTCICw0KXbw20QX573_kbsEnWIeMsCAugvM,99 +rpds/__init__.pyi,sha256=AC1SJpBQT3r0HyikMq0jJMm9PJgp6NL8iBjXiI4lbYQ,2681 +rpds/__pycache__/__init__.cpython-312.pyc,, +rpds/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +rpds/rpds.cp312-win_amd64.pyd,sha256=aO6OAuMdDBU2t2QQ7WezAW5NCJ_gZsXfb2CxVBK03WY,628224 +rpds_py-0.30.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +rpds_py-0.30.0.dist-info/METADATA,sha256=T-7MNIW5G2-ElJZRCcxl2OFe_Tcqhat29E8yDKc2uEE,4213 +rpds_py-0.30.0.dist-info/RECORD,, +rpds_py-0.30.0.dist-info/WHEEL,sha256=MicGETHZ2NSvTN4l4NAAzDXbOHnrlOKS0CnBsnFTiLs,97 +rpds_py-0.30.0.dist-info/licenses/LICENSE,sha256=i8tyyC6ornSAIpPEHZOtfVFDQAGwrkWmA6WvD1B67go,1076 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..47f1478c756bc6ace7c4349b1781bb86fb13cd9a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/rpds_py-0.30.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: maturin (1.10.2) +Root-Is-Purelib: false +Tag: cp312-cp312-win_amd64 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..c6acde05dad1212c772ee68fc01d2d05f7cf05bb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/METADATA @@ -0,0 +1,133 @@ +Metadata-Version: 2.4 +Name: safetensors +Version: 0.7.0 +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Education +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence +Classifier: Typing :: Typed +Requires-Dist: numpy>=1.21.6 ; extra == 'numpy' +Requires-Dist: packaging ; extra == 'torch' +Requires-Dist: safetensors[numpy] ; extra == 'torch' +Requires-Dist: torch>=1.10 ; extra == 'torch' +Requires-Dist: safetensors[numpy] ; extra == 'tensorflow' +Requires-Dist: tensorflow>=2.11.0 ; extra == 'tensorflow' +Requires-Dist: safetensors[numpy] ; extra == 'pinned-tf' +Requires-Dist: tensorflow==2.18.0 ; extra == 'pinned-tf' +Requires-Dist: safetensors[numpy] ; extra == 'jax' +Requires-Dist: flax>=0.6.3 ; extra == 'jax' +Requires-Dist: jax>=0.3.25 ; extra == 'jax' +Requires-Dist: jaxlib>=0.3.25 ; extra == 'jax' +Requires-Dist: mlx>=0.0.9 ; extra == 'mlx' +Requires-Dist: safetensors[numpy] ; extra == 'paddlepaddle' +Requires-Dist: paddlepaddle>=2.4.1 ; extra == 'paddlepaddle' +Requires-Dist: ruff ; extra == 'quality' +Requires-Dist: safetensors[numpy] ; extra == 'testing' +Requires-Dist: h5py>=3.7.0 ; extra == 'testing' +Requires-Dist: huggingface-hub>=0.12.1 ; extra == 'testing' +Requires-Dist: setuptools-rust>=1.5.2 ; extra == 'testing' +Requires-Dist: pytest>=7.2.0 ; extra == 'testing' +Requires-Dist: pytest-benchmark>=4.0.0 ; extra == 'testing' +Requires-Dist: hypothesis>=6.70.2 ; extra == 'testing' +Requires-Dist: safetensors[numpy] ; extra == 'testingfree' +Requires-Dist: huggingface-hub>=0.12.1 ; extra == 'testingfree' +Requires-Dist: setuptools-rust>=1.5.2 ; extra == 'testingfree' +Requires-Dist: pytest>=7.2.0 ; extra == 'testingfree' +Requires-Dist: pytest-benchmark>=4.0.0 ; extra == 'testingfree' +Requires-Dist: hypothesis>=6.70.2 ; extra == 'testingfree' +Requires-Dist: safetensors[torch] ; extra == 'all' +Requires-Dist: safetensors[numpy] ; extra == 'all' +Requires-Dist: safetensors[pinned-tf] ; extra == 'all' +Requires-Dist: safetensors[jax] ; extra == 'all' +Requires-Dist: safetensors[paddlepaddle] ; extra == 'all' +Requires-Dist: safetensors[quality] ; extra == 'all' +Requires-Dist: safetensors[testing] ; extra == 'all' +Requires-Dist: safetensors[all] ; extra == 'dev' +Provides-Extra: numpy +Provides-Extra: torch +Provides-Extra: tensorflow +Provides-Extra: pinned-tf +Provides-Extra: jax +Provides-Extra: mlx +Provides-Extra: paddlepaddle +Provides-Extra: quality +Provides-Extra: testing +Provides-Extra: testingfree +Provides-Extra: all +Provides-Extra: dev +License-File: LICENSE +Author-email: Nicolas Patry +Requires-Python: >=3.9 +Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM +Project-URL: Homepage, https://github.com/huggingface/safetensors +Project-URL: Source, https://github.com/huggingface/safetensors + +## Installation + +``` +pip install safetensors +``` + + +## Usage + +### Numpy + +```python +from safetensors.numpy import save_file, load_file +import numpy as np + +tensors = { + "a": np.zeros((2, 2)), + "b": np.zeros((2, 3), dtype=np.uint8) +} + +save_file(tensors, "./model.safetensors") + + +# Now loading +loaded = load_file("./model.safetensors") +``` + +### Torch + +```python +from safetensors.torch import save_file, load_file +import torch + +tensors = { + "a": torch.zeros((2, 2)), + "b": torch.zeros((2, 3), dtype=torch.uint8) +} + +save_file(tensors, "./model.safetensors") + + +# Now loading +loaded = load_file("./model.safetensors") +``` + +### Developing + +``` +# inside ./safetensors/bindings/python +pip install .[dev] +``` +Should be enough to install this library locally. + +### Testing + +``` +# inside ./safetensors/bindings/python +pip install .[dev] +pytest -sv tests/ +``` + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..84e71f7df52f6463f31826bfa7f378f115136b11 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/RECORD @@ -0,0 +1,22 @@ +safetensors-0.7.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +safetensors-0.7.0.dist-info/METADATA,sha256=j4yXpt97GFoHwriefq-dEwV9ZX_7SZKS795bMtYUiBs,4185 +safetensors-0.7.0.dist-info/RECORD,, +safetensors-0.7.0.dist-info/WHEEL,sha256=MW5GXj0PFGHxdts4kUIyLDU55oFjz5S6uZmcnjsRmds,95 +safetensors-0.7.0.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558 +safetensors/__init__.py,sha256=HYY5VVsb3b-cxhZBwhNx53ZKqSIB4M14nIXLTOAM1Wc,204 +safetensors/__init__.pyi,sha256=tnVaPqYbh8ggFbOZdYKUC4ArqitiWDfrIQt1BNJ377k,4183 +safetensors/__pycache__/__init__.cpython-312.pyc,, +safetensors/__pycache__/flax.cpython-312.pyc,, +safetensors/__pycache__/mlx.cpython-312.pyc,, +safetensors/__pycache__/numpy.cpython-312.pyc,, +safetensors/__pycache__/paddle.cpython-312.pyc,, +safetensors/__pycache__/tensorflow.cpython-312.pyc,, +safetensors/__pycache__/torch.cpython-312.pyc,, +safetensors/_safetensors_rust.pyd,sha256=8gPLI70OVyFz6ze8U_qlSH1QD5vCVAkB0NpGbFq62vA,738304 +safetensors/flax.py,sha256=SnuiGojmth0eCFIWoKEvAfh95nZP9uCZ9E-S4NndrbU,3991 +safetensors/mlx.py,sha256=KvfTWusLSx1hSPWQgg99iL-z9VoD6zQ8l4-RAsCe7P8,3990 +safetensors/numpy.py,sha256=8ci56gDXetlYHH1-Nru83auiUVi-Q1P9bKvfsdkLKPw,5215 +safetensors/paddle.py,sha256=EhXpflqrhKr_NFh4jxV9SUnW0B1vcX_KdPdTqcytrDs,9011 +safetensors/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +safetensors/tensorflow.py,sha256=DajI3qkz00Zy2h7jublSAvTaD51QOPdaIgKQIeSiCRs,4042 +safetensors/torch.py,sha256=CLVWgWQdLm_tVzhRPaeihBHt-4iGAtUW5fY2ys3TyMc,19160 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..7b33363d1d5e7f716fa8d79afde89eb47ea6f33d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/safetensors-0.7.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: maturin (1.10.2) +Root-Is-Purelib: false +Tag: cp38-abi3-win_amd64 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bc8d30f8bd506668b4de95dbd64a307170e39945 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/__init__.py @@ -0,0 +1,10 @@ +# Re-export this +from ._safetensors_rust import ( # noqa: F401 + SafetensorError, + __version__, + deserialize, + safe_open, + _safe_open_handle, + serialize, + serialize_file, +) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors/__init__.pyi b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/__init__.pyi new file mode 100644 index 0000000000000000000000000000000000000000..81c343f67156b19199c260f818715d56bbd05199 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/__init__.pyi @@ -0,0 +1,164 @@ +# Generated content DO NOT EDIT +@staticmethod +def deserialize(bytes): + """ + Opens a safetensors lazily and returns tensors as asked + + Args: + data (`bytes`): + The byte content of a file + + Returns: + (`List[str, Dict[str, Dict[str, any]]]`): + The deserialized content is like: + [("tensor_name", {"shape": [2, 3], "dtype": "F32", "data": b"\0\0.." }), (...)] + """ + pass + +@staticmethod +def serialize(tensor_dict, metadata=None): + """ + Serializes raw data. + + Args: + tensor_dict (`Dict[str, Dict[Any]]`): + The tensor dict is like: + {"tensor_name": {"dtype": "F32", "shape": [2, 3], "data": b"\0\0"}} + metadata (`Dict[str, str]`, *optional*): + The optional purely text annotations + + Returns: + (`bytes`): + The serialized content. + """ + pass + +@staticmethod +def serialize_file(tensor_dict, filename, metadata=None): + """ + Serializes raw data into file. + + Args: + tensor_dict (`Dict[str, Dict[Any]]`): + The tensor dict is like: + {"tensor_name": {"dtype": "F32", "shape": [2, 3], "data": b"\0\0"}} + filename (`str`, or `os.PathLike`): + The name of the file to write into. + metadata (`Dict[str, str]`, *optional*): + The optional purely text annotations + + Returns: + (`NoneType`): + On success return None + """ + pass + +class safe_open: + """ + Opens a safetensors lazily and returns tensors as asked + + Args: + filename (`str`, or `os.PathLike`): + The filename to open + + framework (`str`): + The framework you want you tensors in. Supported values: + `pt`, `tf`, `flax`, `numpy`. + + device (`str`, defaults to `"cpu"`): + The device on which you want the tensors. + """ + def __init__(self, filename, framework, device=...): + pass + + def __enter__(self): + """ + Start the context manager + """ + pass + + def __exit__(self, _exc_type, _exc_value, _traceback): + """ + Exits the context manager + """ + pass + + def get_slice(self, name): + """ + Returns a full slice view object + + Args: + name (`str`): + The name of the tensor you want + + Returns: + (`PySafeSlice`): + A dummy object you can slice into to get a real tensor + Example: + ```python + from safetensors import safe_open + + with safe_open("model.safetensors", framework="pt", device=0) as f: + tensor_part = f.get_slice("embedding")[:, ::8] + + ``` + """ + pass + + def get_tensor(self, name): + """ + Returns a full tensor + + Args: + name (`str`): + The name of the tensor you want + + Returns: + (`Tensor`): + The tensor in the framework you opened the file for. + + Example: + ```python + from safetensors import safe_open + + with safe_open("model.safetensors", framework="pt", device=0) as f: + tensor = f.get_tensor("embedding") + + ``` + """ + pass + + def keys(self): + """ + Returns the names of the tensors in the file. + + Returns: + (`List[str]`): + The name of the tensors contained in that file + """ + pass + + def metadata(self): + """ + Return the special non tensor information in the header + + Returns: + (`Dict[str, str]`): + The freeform metadata. + """ + pass + + def offset_keys(self): + """ + Returns the names of the tensors in the file, ordered by offset. + + Returns: + (`List[str]`): + The name of the tensors contained in that file + """ + pass + +class SafetensorError(Exception): + """ + Custom Python Exception for Safetensor errors. + """ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors/flax.py b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/flax.py new file mode 100644 index 0000000000000000000000000000000000000000..1d30e73b46866bc9c3f41ae799a075162eab5e60 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/flax.py @@ -0,0 +1,138 @@ +import os +from typing import Dict, Optional, Union + +import numpy as np + +import jax.numpy as jnp +from jax import Array +from safetensors import numpy, safe_open + + +def save(tensors: Dict[str, Array], metadata: Optional[Dict[str, str]] = None) -> bytes: + """ + Saves a dictionary of tensors into raw bytes in safetensors format. + + Args: + tensors (`Dict[str, Array]`): + The incoming tensors. Tensors need to be contiguous and dense. + metadata (`Dict[str, str]`, *optional*, defaults to `None`): + Optional text only metadata you might want to save in your header. + For instance it can be useful to specify more about the underlying + tensors. This is purely informative and does not affect tensor loading. + + Returns: + `bytes`: The raw bytes representing the format + + Example: + + ```python + from safetensors.flax import save + from jax import numpy as jnp + + tensors = {"embedding": jnp.zeros((512, 1024)), "attention": jnp.zeros((256, 256))} + byte_data = save(tensors) + ``` + """ + np_tensors = _jnp2np(tensors) + return numpy.save(np_tensors, metadata=metadata) + + +def save_file( + tensors: Dict[str, Array], + filename: Union[str, os.PathLike], + metadata: Optional[Dict[str, str]] = None, +) -> None: + """ + Saves a dictionary of tensors into raw bytes in safetensors format. + + Args: + tensors (`Dict[str, Array]`): + The incoming tensors. Tensors need to be contiguous and dense. + filename (`str`, or `os.PathLike`)): + The filename we're saving into. + metadata (`Dict[str, str]`, *optional*, defaults to `None`): + Optional text only metadata you might want to save in your header. + For instance it can be useful to specify more about the underlying + tensors. This is purely informative and does not affect tensor loading. + + Returns: + `None` + + Example: + + ```python + from safetensors.flax import save_file + from jax import numpy as jnp + + tensors = {"embedding": jnp.zeros((512, 1024)), "attention": jnp.zeros((256, 256))} + save_file(tensors, "model.safetensors") + ``` + """ + np_tensors = _jnp2np(tensors) + return numpy.save_file(np_tensors, filename, metadata=metadata) + + +def load(data: bytes) -> Dict[str, Array]: + """ + Loads a safetensors file into flax format from pure bytes. + + Args: + data (`bytes`): + The content of a safetensors file + + Returns: + `Dict[str, Array]`: dictionary that contains name as key, value as `Array` on cpu + + Example: + + ```python + from safetensors.flax import load + + file_path = "./my_folder/bert.safetensors" + with open(file_path, "rb") as f: + data = f.read() + + loaded = load(data) + ``` + """ + flat = numpy.load(data) + return _np2jnp(flat) + + +def load_file(filename: Union[str, os.PathLike]) -> Dict[str, Array]: + """ + Loads a safetensors file into flax format. + + Args: + filename (`str`, or `os.PathLike`)): + The name of the file which contains the tensors + + Returns: + `Dict[str, Array]`: dictionary that contains name as key, value as `Array` + + Example: + + ```python + from safetensors.flax import load_file + + file_path = "./my_folder/bert.safetensors" + loaded = load_file(file_path) + ``` + """ + result = {} + with safe_open(filename, framework="flax") as f: + for k in f.offset_keys(): + result[k] = f.get_tensor(k) + return result + + +def _np2jnp(numpy_dict: Dict[str, np.ndarray]) -> Dict[str, Array]: + for k, v in numpy_dict.items(): + numpy_dict[k] = jnp.array(v) + return numpy_dict + + +def _jnp2np(jnp_dict: Dict[str, Array]) -> Dict[str, np.array]: + for k, v in jnp_dict.items(): + jnp_dict[k] = np.asarray(v) + return jnp_dict diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors/mlx.py b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/mlx.py new file mode 100644 index 0000000000000000000000000000000000000000..840f946880d1da9b98a041b4ae50445c16919377 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/mlx.py @@ -0,0 +1,140 @@ +import os +from typing import Dict, Optional, Union + +import numpy as np + +import mlx.core as mx +from safetensors import numpy, safe_open + + +def save( + tensors: Dict[str, mx.array], metadata: Optional[Dict[str, str]] = None +) -> bytes: + """ + Saves a dictionary of tensors into raw bytes in safetensors format. + + Args: + tensors (`Dict[str, mx.array]`): + The incoming tensors. Tensors need to be contiguous and dense. + metadata (`Dict[str, str]`, *optional*, defaults to `None`): + Optional text only metadata you might want to save in your header. + For instance it can be useful to specify more about the underlying + tensors. This is purely informative and does not affect tensor loading. + + Returns: + `bytes`: The raw bytes representing the format + + Example: + + ```python + from safetensors.mlx import save + import mlx.core as mx + + tensors = {"embedding": mx.zeros((512, 1024)), "attention": mx.zeros((256, 256))} + byte_data = save(tensors) + ``` + """ + np_tensors = _mx2np(tensors) + return numpy.save(np_tensors, metadata=metadata) + + +def save_file( + tensors: Dict[str, mx.array], + filename: Union[str, os.PathLike], + metadata: Optional[Dict[str, str]] = None, +) -> None: + """ + Saves a dictionary of tensors into raw bytes in safetensors format. + + Args: + tensors (`Dict[str, mx.array]`): + The incoming tensors. Tensors need to be contiguous and dense. + filename (`str`, or `os.PathLike`)): + The filename we're saving into. + metadata (`Dict[str, str]`, *optional*, defaults to `None`): + Optional text only metadata you might want to save in your header. + For instance it can be useful to specify more about the underlying + tensors. This is purely informative and does not affect tensor loading. + + Returns: + `None` + + Example: + + ```python + from safetensors.mlx import save_file + import mlx.core as mx + + tensors = {"embedding": mx.zeros((512, 1024)), "attention": mx.zeros((256, 256))} + save_file(tensors, "model.safetensors") + ``` + """ + np_tensors = _mx2np(tensors) + return numpy.save_file(np_tensors, filename, metadata=metadata) + + +def load(data: bytes) -> Dict[str, mx.array]: + """ + Loads a safetensors file into MLX format from pure bytes. + + Args: + data (`bytes`): + The content of a safetensors file + + Returns: + `Dict[str, mx.array]`: dictionary that contains name as key, value as `mx.array` + + Example: + + ```python + from safetensors.mlx import load + + file_path = "./my_folder/bert.safetensors" + with open(file_path, "rb") as f: + data = f.read() + + loaded = load(data) + ``` + """ + flat = numpy.load(data) + return _np2mx(flat) + + +def load_file(filename: Union[str, os.PathLike]) -> Dict[str, mx.array]: + """ + Loads a safetensors file into MLX format. + + Args: + filename (`str`, or `os.PathLike`)): + The name of the file which contains the tensors + + Returns: + `Dict[str, mx.array]`: dictionary that contains name as key, value as `mx.array` + + Example: + + ```python + from safetensors.flax import load_file + + file_path = "./my_folder/bert.safetensors" + loaded = load_file(file_path) + ``` + """ + result = {} + with safe_open(filename, framework="mlx") as f: + for k in f.offset_keys(): + result[k] = f.get_tensor(k) + return result + + +def _np2mx(numpy_dict: Dict[str, np.ndarray]) -> Dict[str, mx.array]: + for k, v in numpy_dict.items(): + numpy_dict[k] = mx.array(v) + return numpy_dict + + +def _mx2np(mx_dict: Dict[str, mx.array]) -> Dict[str, np.array]: + new_dict = {} + for k, v in mx_dict.items(): + new_dict[k] = np.asarray(v) + return new_dict diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors/numpy.py b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/numpy.py new file mode 100644 index 0000000000000000000000000000000000000000..aad12312683a992d179fd4b132340b9c6c57917b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/numpy.py @@ -0,0 +1,187 @@ +import os +import sys +from typing import Dict, Optional, Union + +import numpy as np + +from safetensors import deserialize, safe_open, serialize, serialize_file + + +def _tobytes(tensor: np.ndarray) -> bytes: + if not _is_little_endian(tensor): + tensor = tensor.byteswap(inplace=False) + return tensor.tobytes() + + +def save( + tensor_dict: Dict[str, np.ndarray], metadata: Optional[Dict[str, str]] = None +) -> bytes: + """ + Saves a dictionary of tensors into raw bytes in safetensors format. + + Args: + tensor_dict (`Dict[str, np.ndarray]`): + The incoming tensors. Tensors need to be contiguous and dense. + metadata (`Dict[str, str]`, *optional*, defaults to `None`): + Optional text only metadata you might want to save in your header. + For instance it can be useful to specify more about the underlying + tensors. This is purely informative and does not affect tensor loading. + + Returns: + `bytes`: The raw bytes representing the format + + Example: + + ```python + from safetensors.numpy import save + import numpy as np + + tensors = {"embedding": np.zeros((512, 1024)), "attention": np.zeros((256, 256))} + byte_data = save(tensors) + ``` + """ + flattened = { + k: {"dtype": v.dtype.name, "shape": v.shape, "data": _tobytes(v)} + for k, v in tensor_dict.items() + } + serialized = serialize(flattened, metadata=metadata) + result = bytes(serialized) + return result + + +def save_file( + tensor_dict: Dict[str, np.ndarray], + filename: Union[str, os.PathLike], + metadata: Optional[Dict[str, str]] = None, +) -> None: + """ + Saves a dictionary of tensors into raw bytes in safetensors format. + + Args: + tensor_dict (`Dict[str, np.ndarray]`): + The incoming tensors. Tensors need to be contiguous and dense. + filename (`str`, or `os.PathLike`)): + The filename we're saving into. + metadata (`Dict[str, str]`, *optional*, defaults to `None`): + Optional text only metadata you might want to save in your header. + For instance it can be useful to specify more about the underlying + tensors. This is purely informative and does not affect tensor loading. + + Returns: + `None` + + Example: + + ```python + from safetensors.numpy import save_file + import numpy as np + + tensors = {"embedding": np.zeros((512, 1024)), "attention": np.zeros((256, 256))} + save_file(tensors, "model.safetensors") + ``` + """ + flattened = { + k: {"dtype": v.dtype.name, "shape": v.shape, "data": _tobytes(v)} + for k, v in tensor_dict.items() + } + serialize_file(flattened, filename, metadata=metadata) + + +def load(data: bytes) -> Dict[str, np.ndarray]: + """ + Loads a safetensors file into numpy format from pure bytes. + + Args: + data (`bytes`): + The content of a safetensors file + + Returns: + `Dict[str, np.ndarray]`: dictionary that contains name as key, value as `np.ndarray` on cpu + + Example: + + ```python + from safetensors.numpy import load + + file_path = "./my_folder/bert.safetensors" + with open(file_path, "rb") as f: + data = f.read() + + loaded = load(data) + ``` + """ + flat = deserialize(data) + return _view2np(flat) + + +def load_file(filename: Union[str, os.PathLike]) -> Dict[str, np.ndarray]: + """ + Loads a safetensors file into numpy format. + + Args: + filename (`str`, or `os.PathLike`)): + The name of the file which contains the tensors + + Returns: + `Dict[str, np.ndarray]`: dictionary that contains name as key, value as `np.ndarray` + + Example: + + ```python + from safetensors.numpy import load_file + + file_path = "./my_folder/bert.safetensors" + loaded = load_file(file_path) + ``` + """ + result = {} + with safe_open(filename, framework="np") as f: + for k in f.offset_keys(): + result[k] = f.get_tensor(k) + return result + + +_TYPES = { + "F64": np.float64, + "F32": np.float32, + "F16": np.float16, + "I64": np.int64, + "U64": np.uint64, + "I32": np.int32, + "U32": np.uint32, + "I16": np.int16, + "U16": np.uint16, + "I8": np.int8, + "U8": np.uint8, + "BOOL": bool, + "C64": np.complex64, +} + + +def _getdtype(dtype_str: str) -> np.dtype: + return _TYPES[dtype_str] + + +def _view2np(safeview) -> Dict[str, np.ndarray]: + result = {} + for k, v in safeview: + dtype = _getdtype(v["dtype"]) + arr = np.frombuffer(v["data"], dtype=dtype).reshape(v["shape"]) + result[k] = arr + return result + + +def _is_little_endian(tensor: np.ndarray) -> bool: + byteorder = tensor.dtype.byteorder + if byteorder == "=": + if sys.byteorder == "little": + return True + else: + return False + elif byteorder == "|": + return True + elif byteorder == "<": + return True + elif byteorder == ">": + return False + raise ValueError(f"Unexpected byte order {byteorder}") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors/paddle.py b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/paddle.py new file mode 100644 index 0000000000000000000000000000000000000000..0c03d3710cabdca7794f3de8e659faeb465b7de1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/paddle.py @@ -0,0 +1,290 @@ +import os +import sys +from typing import Any, Dict, Optional, Union + +import numpy as np +import paddle + +from safetensors import numpy, deserialize, safe_open, serialize, serialize_file + + +def save( + tensors: Dict[str, paddle.Tensor], metadata: Optional[Dict[str, str]] = None +) -> bytes: + """ + Saves a dictionary of tensors into raw bytes in safetensors format. + + Args: + tensors (`Dict[str, paddle.Tensor]`): + The incoming tensors. Tensors need to be contiguous and dense. + metadata (`Dict[str, str]`, *optional*, defaults to `None`): + Optional text only metadata you might want to save in your header. + For instance it can be useful to specify more about the underlying + tensors. This is purely informative and does not affect tensor loading. + + Returns: + `bytes`: The raw bytes representing the format + + Example: + + ```python + from safetensors.paddle import save + import paddle + + tensors = {"embedding": paddle.zeros((512, 1024)), "attention": paddle.zeros((256, 256))} + byte_data = save(tensors) + ``` + """ + serialized = serialize(_flatten(tensors), metadata=metadata) + result = bytes(serialized) + return result + + +def save_file( + tensors: Dict[str, paddle.Tensor], + filename: Union[str, os.PathLike], + metadata: Optional[Dict[str, str]] = None, +) -> None: + """ + Saves a dictionary of tensors into raw bytes in safetensors format. + + Args: + tensors (`Dict[str, paddle.Tensor]`): + The incoming tensors. Tensors need to be contiguous and dense. + filename (`str`, or `os.PathLike`)): + The filename we're saving into. + metadata (`Dict[str, str]`, *optional*, defaults to `None`): + Optional text only metadata you might want to save in your header. + For instance it can be useful to specify more about the underlying + tensors. This is purely informative and does not affect tensor loading. + + Returns: + `None` + + Example: + + ```python + from safetensors.paddle import save_file + import paddle + + tensors = {"embedding": paddle.zeros((512, 1024)), "attention": paddle.zeros((256, 256))} + save_file(tensors, "model.safetensors") + ``` + """ + serialize_file(_flatten(tensors), filename, metadata=metadata) + + +def load(data: bytes, device: str = "cpu") -> Dict[str, paddle.Tensor]: + """ + Loads a safetensors file into paddle format from pure bytes. + + Args: + data (`bytes`): + The content of a safetensors file + + Returns: + `Dict[str, paddle.Tensor]`: dictionary that contains name as key, value as `paddle.Tensor` on cpu + + Example: + + ```python + from safetensors.paddle import load + + file_path = "./my_folder/bert.safetensors" + with open(file_path, "rb") as f: + data = f.read() + + loaded = load(data) + ``` + """ + if paddle.__version__ >= "3.2.0": + flat = deserialize(data) + return _view2paddle(flat, device) + else: + flat = numpy.load(data) + return _np2paddle(flat, device) + + +def load_file( + filename: Union[str, os.PathLike], device="cpu" +) -> Dict[str, paddle.Tensor]: + """ + Loads a safetensors file into paddle format. + + Args: + filename (`str`, or `os.PathLike`)): + The name of the file which contains the tensors + device (`Union[Dict[str, any], str]`, *optional*, defaults to `cpu`): + The device where the tensors need to be located after load. + available options are all regular paddle device locations + + Returns: + `Dict[str, paddle.Tensor]`: dictionary that contains name as key, value as `paddle.Tensor` + + Example: + + ```python + from safetensors.paddle import load_file + + file_path = "./my_folder/bert.safetensors" + loaded = load_file(file_path) + ``` + """ + result = {} + if paddle.__version__ >= "3.2.0": + with safe_open(filename, framework="paddle", device=device) as f: + for k in f.offset_keys(): + result[k] = f.get_tensor(k) + else: + flat = numpy.load_file(filename) + result = _np2paddle(flat, device) + return result + + +def _np2paddle( + numpy_dict: Dict[str, np.ndarray], device: str = "cpu" +) -> Dict[str, paddle.Tensor]: + for k, v in numpy_dict.items(): + numpy_dict[k] = paddle.to_tensor(v, place=device) + return numpy_dict + + +def _paddle2np(paddle_dict: Dict[str, paddle.Tensor]) -> Dict[str, np.array]: + for k, v in paddle_dict.items(): + paddle_dict[k] = v.detach().cpu().numpy() + return paddle_dict + + +_SIZE = { + paddle.int64: 8, + paddle.float32: 4, + paddle.int32: 4, + paddle.bfloat16: 2, + paddle.float16: 2, + paddle.int16: 2, + paddle.uint8: 1, + paddle.int8: 1, + paddle.bool: 1, + paddle.float64: 8, + paddle.float8_e4m3fn: 1, + paddle.float8_e5m2: 1, + paddle.complex64: 8, + # XXX: These are not supported yet in paddle + # paddle.uint64: 8, + # paddle.uint32: 4, + # paddle.uint16: 2, + # paddle.float8_e8m0: 1, + # paddle.float4_e2m1_x2: 1, +} + +_TYPES = { + "F64": paddle.float64, + "F32": paddle.float32, + "F16": paddle.float16, + "BF16": paddle.bfloat16, + "I64": paddle.int64, + "I32": paddle.int32, + "I16": paddle.int16, + "I8": paddle.int8, + "U8": paddle.uint8, + "BOOL": paddle.bool, + "F8_E4M3": paddle.float8_e4m3fn, + "F8_E5M2": paddle.float8_e5m2, +} + +NPDTYPES = { + paddle.int64: np.int64, + paddle.float32: np.float32, + paddle.int32: np.int32, + # XXX: This is ok because both have the same width + paddle.bfloat16: np.float16, + paddle.float16: np.float16, + paddle.int16: np.int16, + paddle.uint8: np.uint8, + paddle.int8: np.int8, + paddle.bool: bool, + paddle.float64: np.float64, + # XXX: This is ok because both have the same width and byteswap is a no-op anyway + paddle.float8_e4m3fn: np.uint8, + paddle.float8_e5m2: np.uint8, +} + + +def _getdtype(dtype_str: str) -> paddle.dtype: + return _TYPES[dtype_str] + + +def _view2paddle(safeview, device) -> Dict[str, paddle.Tensor]: + result = {} + for k, v in safeview: + dtype = _getdtype(v["dtype"]) + if len(v["data"]) == 0: + # Workaround because frombuffer doesn't accept zero-size tensors + assert any(x == 0 for x in v["shape"]) + arr = paddle.empty(v["shape"], dtype=dtype) + else: + arr = paddle.base.core.frombuffer(v["data"], dtype).reshape(v["shape"]) + if device != "cpu": + arr = arr.to(device) + if sys.byteorder == "big": + arr = paddle.to_tensor(arr.numpy().byteswap(inplace=False), place=device) + result[k] = arr + + return result + + +def _tobytes(tensor: paddle.Tensor, name: str) -> bytes: + if not tensor.is_contiguous(): + raise ValueError( + f"You are trying to save a non contiguous tensor: `{name}` which is not allowed. It either means you" + " are trying to save tensors which are reference of each other in which case it's recommended to save" + " only the full tensors, and reslice at load time, or simply call `.contiguous()` on your tensor to" + " pack it before saving." + ) + if not tensor.place.is_cpu_place(): + # Moving tensor to cpu before saving + tensor = tensor.cpu() + + import ctypes + + import numpy as np + + # When shape is empty (scalar), np.prod returns a float + # we need a int for the following calculations + length = int(np.prod(tensor.shape).item()) + bytes_per_item = _SIZE[tensor.dtype] + + total_bytes = length * bytes_per_item + + ptr = tensor.data_ptr() + if ptr == 0: + return b"" + newptr = ctypes.cast(ptr, ctypes.POINTER(ctypes.c_ubyte)) + data = np.ctypeslib.as_array(newptr, (total_bytes,)) # no internal copy + if sys.byteorder == "big": + npdtype = NPDTYPES[tensor.dtype] + # Not in place as that would potentially modify a live running model + data = data.view(npdtype).byteswap(inplace=False) + return data.tobytes() + + +def _flatten(tensors: Dict[str, paddle.Tensor]) -> Dict[str, Dict[str, Any]]: + if not isinstance(tensors, dict): + raise ValueError( + f"Expected a dict of [str, paddle.Tensor] but received {type(tensors)}" + ) + + for k, v in tensors.items(): + if not isinstance(v, paddle.Tensor): + raise ValueError( + f"Key `{k}` is invalid, expected paddle.Tensor but received {type(v)}" + ) + + return { + k: { + "dtype": str(v.dtype).split(".")[-1], + "shape": v.shape, + "data": _tobytes(v, k), + } + for k, v in tensors.items() + } diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors/py.typed b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors/tensorflow.py b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/tensorflow.py new file mode 100644 index 0000000000000000000000000000000000000000..96008c4cabfd0b6469ac70cfc2a125d53a463ffb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/tensorflow.py @@ -0,0 +1,139 @@ +import os +from typing import Dict, Optional, Union + +import numpy as np +import tensorflow as tf + +from safetensors import numpy, safe_open + + +def save( + tensors: Dict[str, tf.Tensor], metadata: Optional[Dict[str, str]] = None +) -> bytes: + """ + Saves a dictionary of tensors into raw bytes in safetensors format. + + Args: + tensors (`Dict[str, tf.Tensor]`): + The incoming tensors. Tensors need to be contiguous and dense. + metadata (`Dict[str, str]`, *optional*, defaults to `None`): + Optional text only metadata you might want to save in your header. + For instance it can be useful to specify more about the underlying + tensors. This is purely informative and does not affect tensor loading. + + Returns: + `bytes`: The raw bytes representing the format + + Example: + + ```python + from safetensors.tensorflow import save + import tensorflow as tf + + tensors = {"embedding": tf.zeros((512, 1024)), "attention": tf.zeros((256, 256))} + byte_data = save(tensors) + ``` + """ + np_tensors = _tf2np(tensors) + return numpy.save(np_tensors, metadata=metadata) + + +def save_file( + tensors: Dict[str, tf.Tensor], + filename: Union[str, os.PathLike], + metadata: Optional[Dict[str, str]] = None, +) -> None: + """ + Saves a dictionary of tensors into raw bytes in safetensors format. + + Args: + tensors (`Dict[str, tf.Tensor]`): + The incoming tensors. Tensors need to be contiguous and dense. + filename (`str`, or `os.PathLike`)): + The filename we're saving into. + metadata (`Dict[str, str]`, *optional*, defaults to `None`): + Optional text only metadata you might want to save in your header. + For instance it can be useful to specify more about the underlying + tensors. This is purely informative and does not affect tensor loading. + + Returns: + `None` + + Example: + + ```python + from safetensors.tensorflow import save_file + import tensorflow as tf + + tensors = {"embedding": tf.zeros((512, 1024)), "attention": tf.zeros((256, 256))} + save_file(tensors, "model.safetensors") + ``` + """ + np_tensors = _tf2np(tensors) + return numpy.save_file(np_tensors, filename, metadata=metadata) + + +def load(data: bytes) -> Dict[str, tf.Tensor]: + """ + Loads a safetensors file into tensorflow format from pure bytes. + + Args: + data (`bytes`): + The content of a safetensors file + + Returns: + `Dict[str, tf.Tensor]`: dictionary that contains name as key, value as `tf.Tensor` on cpu + + Example: + + ```python + from safetensors.tensorflow import load + + file_path = "./my_folder/bert.safetensors" + with open(file_path, "rb") as f: + data = f.read() + + loaded = load(data) + ``` + """ + flat = numpy.load(data) + return _np2tf(flat) + + +def load_file(filename: Union[str, os.PathLike]) -> Dict[str, tf.Tensor]: + """ + Loads a safetensors file into tensorflow format. + + Args: + filename (`str`, or `os.PathLike`)): + The name of the file which contains the tensors + + Returns: + `Dict[str, tf.Tensor]`: dictionary that contains name as key, value as `tf.Tensor` + + Example: + + ```python + from safetensors.tensorflow import load_file + + file_path = "./my_folder/bert.safetensors" + loaded = load_file(file_path) + ``` + """ + result = {} + with safe_open(filename, framework="tf") as f: + for k in f.offset_keys(): + result[k] = f.get_tensor(k) + return result + + +def _np2tf(numpy_dict: Dict[str, np.ndarray]) -> Dict[str, tf.Tensor]: + for k, v in numpy_dict.items(): + numpy_dict[k] = tf.convert_to_tensor(v) + return numpy_dict + + +def _tf2np(tf_dict: Dict[str, tf.Tensor]) -> Dict[str, np.array]: + for k, v in tf_dict.items(): + tf_dict[k] = v.numpy() + return tf_dict diff --git a/TTS/Kokoro/.venv/Lib/site-packages/safetensors/torch.py b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/torch.py new file mode 100644 index 0000000000000000000000000000000000000000..58c116dd03774e6c7c41007b86b64bd8a1dc29f4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/safetensors/torch.py @@ -0,0 +1,550 @@ +import os +import sys +from collections import defaultdict +from typing import Any, Dict, List, Optional, Set, Tuple, Union +from packaging.version import Version + +import torch + +from safetensors import deserialize, safe_open, serialize, serialize_file + + +def storage_ptr(tensor: torch.Tensor) -> int: + try: + return tensor.untyped_storage().data_ptr() + except Exception: + # Fallback for torch==1.10 + try: + return tensor.storage().data_ptr() + except NotImplementedError: + # Fallback for meta storage + return 0 + + +def _end_ptr(tensor: torch.Tensor) -> int: + if tensor.nelement(): + stop = tensor.view(-1)[-1].data_ptr() + _SIZE[tensor.dtype] + else: + stop = tensor.data_ptr() + return stop + + +def storage_size(tensor: torch.Tensor) -> int: + try: + return tensor.untyped_storage().nbytes() + except AttributeError: + # Fallback for torch==1.10 + try: + return tensor.storage().size() * _SIZE[tensor.dtype] + except NotImplementedError: + # Fallback for meta storage + # On torch >=2.0 this is the tensor size + return tensor.nelement() * _SIZE[tensor.dtype] + + +def _filter_shared_not_shared( + tensors: List[Set[str]], state_dict: Dict[str, torch.Tensor] +) -> List[Set[str]]: + filtered_tensors = [] + for shared in tensors: + if len(shared) < 2: + filtered_tensors.append(shared) + continue + + areas = [] + for name in shared: + tensor = state_dict[name] + areas.append((tensor.data_ptr(), _end_ptr(tensor), name)) + areas.sort() + + _, last_stop, last_name = areas[0] + filtered_tensors.append({last_name}) + for start, stop, name in areas[1:]: + if start >= last_stop: + filtered_tensors.append({name}) + else: + filtered_tensors[-1].add(name) + last_stop = stop + + return filtered_tensors + + +def _find_shared_tensors(state_dict: Dict[str, torch.Tensor]) -> List[Set[str]]: + tensors = defaultdict(set) + for k, v in state_dict.items(): + if ( + v.device != torch.device("meta") + and storage_ptr(v) != 0 + and storage_size(v) != 0 + ): + # Need to add device as key because of multiple GPU. + tensors[(v.device, storage_ptr(v), storage_size(v))].add(k) + tensors = list(sorted(tensors.values())) + tensors = _filter_shared_not_shared(tensors, state_dict) + return tensors + + +def _is_complete(tensor: torch.Tensor) -> bool: + return tensor.data_ptr() == storage_ptr(tensor) and tensor.nelement() * _SIZE[ + tensor.dtype + ] == storage_size(tensor) + + +def _remove_duplicate_names( + state_dict: Dict[str, torch.Tensor], + *, + preferred_names: Optional[List[str]] = None, + discard_names: Optional[List[str]] = None, +) -> Dict[str, List[str]]: + if preferred_names is None: + preferred_names = [] + preferred_names = set(preferred_names) + if discard_names is None: + discard_names = [] + discard_names = set(discard_names) + + shareds = _find_shared_tensors(state_dict) + to_remove = defaultdict(list) + for shared in shareds: + complete_names = set( + [name for name in shared if _is_complete(state_dict[name])] + ) + if not complete_names: + raise RuntimeError( + "Error while trying to find names to remove to save state dict, but found no suitable name to keep" + f" for saving amongst: {shared}. None is covering the entire storage.Refusing to save/load the model" + " since you could be storing much more memory than needed. Please refer to" + " https://huggingface.co/docs/safetensors/torch_shared_tensors for more information. Or open an" + " issue." + ) + + keep_name = sorted(list(complete_names))[0] + + # Mechanism to preferentially select keys to keep + # coming from the on-disk file to allow + # loading models saved with a different choice + # of keep_name + preferred = complete_names.difference(discard_names) + if preferred: + keep_name = sorted(list(preferred))[0] + + if preferred_names: + preferred = preferred_names.intersection(complete_names) + if preferred: + keep_name = sorted(list(preferred))[0] + for name in sorted(shared): + if name != keep_name: + to_remove[keep_name].append(name) + return to_remove + + +def save_model( + model: torch.nn.Module, + filename: str, + metadata: Optional[Dict[str, str]] = None, + force_contiguous: bool = True, +): + """ + Saves a given torch model to specified filename. + This method exists specifically to avoid tensor sharing issues which are + not allowed in `safetensors`. [More information on tensor sharing](../torch_shared_tensors) + + Args: + model (`torch.nn.Module`): + The model to save on disk. + filename (`str`): + The filename location to save the file + metadata (`Dict[str, str]`, *optional*): + Extra information to save along with the file. + Some metadata will be added for each dropped tensors. + This information will not be enough to recover the entire + shared structure but might help understanding things + force_contiguous (`boolean`, *optional*, defaults to True): + Forcing the state_dict to be saved as contiguous tensors. + This has no effect on the correctness of the model, but it + could potentially change performance if the layout of the tensor + was chosen specifically for that reason. + """ + state_dict = model.state_dict() + to_removes = _remove_duplicate_names(state_dict) + + for kept_name, to_remove_group in to_removes.items(): + for to_remove in to_remove_group: + if metadata is None: + metadata = {} + + if to_remove not in metadata: + # Do not override user data + metadata[to_remove] = kept_name + del state_dict[to_remove] + if force_contiguous: + state_dict = {k: v.contiguous() for k, v in state_dict.items()} + try: + save_file(state_dict, filename, metadata=metadata) + except ValueError as e: + msg = str(e) + msg += " Or use save_model(..., force_contiguous=True), read the docs for potential caveats." + raise ValueError(msg) + + +def load_model( + model: torch.nn.Module, + filename: Union[str, os.PathLike], + strict: bool = True, + device: Union[str, int] = "cpu", +) -> Tuple[List[str], List[str]]: + """ + Loads a given filename onto a torch model. + This method exists specifically to avoid tensor sharing issues which are + not allowed in `safetensors`. [More information on tensor sharing](../torch_shared_tensors) + + Args: + model (`torch.nn.Module`): + The model to load onto. + filename (`str`, or `os.PathLike`): + The filename location to load the file from. + strict (`bool`, *optional*, defaults to True): + Whether to fail if you're missing keys or having unexpected ones. + When false, the function simply returns missing and unexpected names. + device (`Union[str, int]`, *optional*, defaults to `cpu`): + The device where the tensors need to be located after load. + available options are all regular torch device locations. + + Returns: + `(missing, unexpected): (List[str], List[str])` + `missing` are names in the model which were not modified during loading + `unexpected` are names that are on the file, but weren't used during + the load. + """ + state_dict = load_file(filename, device=device) + model_state_dict = model.state_dict() + to_removes = _remove_duplicate_names( + model_state_dict, preferred_names=state_dict.keys() + ) + missing, unexpected = model.load_state_dict(state_dict, strict=False) + missing = set(missing) + for to_remove_group in to_removes.values(): + for to_remove in to_remove_group: + if to_remove not in missing: + unexpected.append(to_remove) + else: + missing.remove(to_remove) + if strict and (missing or unexpected): + missing_keys = ", ".join([f'"{k}"' for k in sorted(missing)]) + unexpected_keys = ", ".join([f'"{k}"' for k in sorted(unexpected)]) + error = f"Error(s) in loading state_dict for {model.__class__.__name__}:" + if missing: + error += f"\n Missing key(s) in state_dict: {missing_keys}" + if unexpected: + error += f"\n Unexpected key(s) in state_dict: {unexpected_keys}" + raise RuntimeError(error) + return missing, unexpected + + +def save( + tensors: Dict[str, torch.Tensor], metadata: Optional[Dict[str, str]] = None +) -> bytes: + """ + Saves a dictionary of tensors into raw bytes in safetensors format. + + Args: + tensors (`Dict[str, torch.Tensor]`): + The incoming tensors. Tensors need to be contiguous and dense. + metadata (`Dict[str, str]`, *optional*, defaults to `None`): + Optional text only metadata you might want to save in your header. + For instance it can be useful to specify more about the underlying + tensors. This is purely informative and does not affect tensor loading. + + Returns: + `bytes`: The raw bytes representing the format + + Example: + + ```python + from safetensors.torch import save + import torch + + tensors = {"embedding": torch.zeros((512, 1024)), "attention": torch.zeros((256, 256))} + byte_data = save(tensors) + ``` + """ + serialized = serialize(_flatten(tensors), metadata=metadata) + result = bytes(serialized) + return result + + +def save_file( + tensors: Dict[str, torch.Tensor], + filename: Union[str, os.PathLike], + metadata: Optional[Dict[str, str]] = None, +): + """ + Saves a dictionary of tensors into raw bytes in safetensors format. + + Args: + tensors (`Dict[str, torch.Tensor]`): + The incoming tensors. Tensors need to be contiguous and dense. + filename (`str`, or `os.PathLike`)): + The filename we're saving into. + metadata (`Dict[str, str]`, *optional*, defaults to `None`): + Optional text only metadata you might want to save in your header. + For instance it can be useful to specify more about the underlying + tensors. This is purely informative and does not affect tensor loading. + + Returns: + `None` + + Example: + + ```python + from safetensors.torch import save_file + import torch + + tensors = {"embedding": torch.zeros((512, 1024)), "attention": torch.zeros((256, 256))} + save_file(tensors, "model.safetensors") + ``` + """ + serialize_file(_flatten(tensors), filename, metadata=metadata) + + +def load_file( + filename: Union[str, os.PathLike], device: Union[str, int] = "cpu" +) -> Dict[str, torch.Tensor]: + """ + Loads a safetensors file into torch format. + + Args: + filename (`str`, or `os.PathLike`): + The name of the file which contains the tensors + device (`Union[str, int]`, *optional*, defaults to `cpu`): + The device where the tensors need to be located after load. + available options are all regular torch device locations. + + Returns: + `Dict[str, torch.Tensor]`: dictionary that contains name as key, value as `torch.Tensor` + + Example: + + ```python + from safetensors.torch import load_file + + file_path = "./my_folder/bert.safetensors" + loaded = load_file(file_path) + ``` + """ + result = {} + with safe_open(filename, framework="pt", device=device) as f: + for k in f.offset_keys(): + result[k] = f.get_tensor(k) + return result + + +def load(data: bytes) -> Dict[str, torch.Tensor]: + """ + Loads a safetensors file into torch format from pure bytes. + + Args: + data (`bytes`): + The content of a safetensors file + + Returns: + `Dict[str, torch.Tensor]`: dictionary that contains name as key, value as `torch.Tensor` on cpu + + Example: + + ```python + from safetensors.torch import load + + file_path = "./my_folder/bert.safetensors" + with open(file_path, "rb") as f: + data = f.read() + + loaded = load(data) + ``` + """ + flat = deserialize(data) + return _view2torch(flat) + + +# torch.float8 formats require 2.1; we do not support these dtypes on earlier versions +_float8_e4m3fn = getattr(torch, "float8_e4m3fn", None) +_float8_e5m2 = getattr(torch, "float8_e5m2", None) +_float8_e8m0 = getattr(torch, "float8_e8m0fnu", None) +_float4_e2m1_x2 = getattr(torch, "float4_e2m1fn_x2", None) + +_SIZE = { + torch.int64: 8, + torch.float32: 4, + torch.int32: 4, + torch.bfloat16: 2, + torch.float16: 2, + torch.int16: 2, + torch.uint8: 1, + torch.int8: 1, + torch.bool: 1, + torch.float64: 8, + torch.complex64: 8, + _float8_e4m3fn: 1, + _float8_e5m2: 1, + _float8_e8m0: 1, + _float4_e2m1_x2: 1, +} +if Version(torch.__version__) >= Version("2.3.0"): + _SIZE.update( + { + torch.uint64: 8, + torch.uint32: 4, + torch.uint16: 2, + } + ) + +_TYPES = { + "F64": torch.float64, + "F32": torch.float32, + "F16": torch.float16, + "BF16": torch.bfloat16, + "I64": torch.int64, + "I32": torch.int32, + "I16": torch.int16, + "I8": torch.int8, + "U8": torch.uint8, + "BOOL": torch.bool, + "F8_E4M3": _float8_e4m3fn, + "F8_E5M2": _float8_e5m2, + "C64": torch.complex64, +} +if Version(torch.__version__) >= Version("2.3.0"): + _TYPES.update( + { + "U64": torch.uint64, + "U32": torch.uint32, + "U16": torch.uint16, + } + ) + + +def _getdtype(dtype_str: str) -> torch.dtype: + return _TYPES[dtype_str] + + +def _view2torch(safeview) -> Dict[str, torch.Tensor]: + result = {} + for k, v in safeview: + dtype = _getdtype(v["dtype"]) + if len(v["data"]) == 0: + # Workaround because frombuffer doesn't accept zero-size tensors + assert any(x == 0 for x in v["shape"]) + arr = torch.empty(v["shape"], dtype=dtype) + else: + arr = torch.frombuffer(v["data"], dtype=dtype).reshape(v["shape"]) + if sys.byteorder == "big": + arr = torch.from_numpy(arr.numpy().byteswap(inplace=False)) + result[k] = arr + + return result + + +def _tobytes(tensor: torch.Tensor, name: str) -> bytes: + if tensor.layout != torch.strided: + raise ValueError( + f"You are trying to save a sparse tensor: `{name}` which this library does not support." + " You can make it a dense tensor before saving with `.to_dense()` but be aware this might" + " make a much larger file than needed." + ) + + if not tensor.is_contiguous(): + raise ValueError( + f"You are trying to save a non contiguous tensor: `{name}` which is not allowed. It either means you" + " are trying to save tensors which are reference of each other in which case it's recommended to save" + " only the full tensors, and reslice at load time, or simply call `.contiguous()` on your tensor to" + " pack it before saving." + ) + if tensor.device.type != "cpu": + # Moving tensor to cpu before saving + tensor = tensor.to("cpu") + + import ctypes + + import numpy as np + + # When shape is empty (scalar), np.prod returns a float + # we need a int for the following calculations + length = int(np.prod(tensor.shape).item()) + bytes_per_item = _SIZE[tensor.dtype] + + total_bytes = length * bytes_per_item + + ptr = tensor.data_ptr() + if ptr == 0: + return b"" + newptr = ctypes.cast(ptr, ctypes.POINTER(ctypes.c_ubyte)) + data = np.ctypeslib.as_array(newptr, (total_bytes,)) # no internal copy + if sys.byteorder == "big": + NPDTYPES = { + torch.int64: np.int64, + torch.float32: np.float32, + torch.int32: np.int32, + # XXX: This is ok because both have the same width + torch.bfloat16: np.float16, + torch.float16: np.float16, + torch.int16: np.int16, + torch.uint8: np.uint8, + torch.int8: np.int8, + torch.bool: bool, + torch.float64: np.float64, + # XXX: This is ok because both have the same width and byteswap is a no-op anyway + _float8_e4m3fn: np.uint8, + _float8_e5m2: np.uint8, + torch.complex64: np.complex64, + } + npdtype = NPDTYPES[tensor.dtype] + # Not in place as that would potentially modify a live running model + data = data.view(npdtype).byteswap(inplace=False) + return data.tobytes() + + +def _flatten(tensors: Dict[str, torch.Tensor]) -> Dict[str, Dict[str, Any]]: + if not isinstance(tensors, dict): + raise ValueError( + f"Expected a dict of [str, torch.Tensor] but received {type(tensors)}" + ) + + invalid_tensors = [] + for k, v in tensors.items(): + if not isinstance(v, torch.Tensor): + raise ValueError( + f"Key `{k}` is invalid, expected torch.Tensor but received {type(v)}" + ) + + if v.layout != torch.strided: + invalid_tensors.append(k) + if invalid_tensors: + raise ValueError( + f"You are trying to save a sparse tensors: `{invalid_tensors}` which this library does not support." + " You can make it a dense tensor before saving with `.to_dense()` but be aware this might" + " make a much larger file than needed." + ) + + shared_pointers = _find_shared_tensors(tensors) + failing = [] + for names in shared_pointers: + if len(names) > 1: + failing.append(names) + + if failing: + raise RuntimeError( + f""" + Some tensors share memory, this will lead to duplicate memory on disk and potential differences when loading them again: {failing}. + A potential way to correctly save your model is to use `save_model`. + More information at https://huggingface.co/docs/safetensors/torch_shared_tensors + """ + ) + + return { + k: { + "dtype": str(v.dtype).split(".")[-1], + "shape": v.shape, + "data": _tobytes(v, k), + } + for k, v in tensors.items() + } diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/LICENSE b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e06d2081865a766a8668acc12878f98b27fc9ea0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..5974f5f80e9f2d5147b0362a04cce835c84f4cf8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/METADATA @@ -0,0 +1,124 @@ +Metadata-Version: 2.1 +Name: segments +Version: 2.3.0 +Summary: Segmentation with orthography profiles +Home-page: https://github.com/cldf/segments +Author: Steven Moran and Robert Forkel +Author-email: dlce.rdm@eva.mpg.de +License: Apache 2.0 +Project-URL: Bug Tracker, https://github.com/cldf/segments/issues +Keywords: linguistics,tokenizer +Platform: any +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Science/Research +Classifier: Natural Language :: English +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: License :: OSI Approved :: Apache Software License +Requires-Python: >=3.8 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: regex +Requires-Dist: csvw>=1.5.6 +Provides-Extra: dev +Requires-Dist: flake8; extra == "dev" +Requires-Dist: wheel; extra == "dev" +Requires-Dist: build; extra == "dev" +Requires-Dist: twine; extra == "dev" +Provides-Extra: test +Requires-Dist: pytest>=5; extra == "test" +Requires-Dist: pytest-mock; extra == "test" +Requires-Dist: pytest-cov; extra == "test" + +segments +======== + +[![Build Status](https://github.com/cldf/segments/workflows/tests/badge.svg)](https://github.com/cldf/segments/actions?query=workflow%3Atests) +[![PyPI](https://img.shields.io/pypi/v/segments.svg)](https://pypi.org/project/segments) + + +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1051157.svg)](https://doi.org/10.5281/zenodo.1051157) + +The segments package provides Unicode Standard tokenization routines and orthography segmentation, +implementing the linear algorithm described in the orthography profile specification from +*The Unicode Cookbook* (Moran and Cysouw 2018 [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1296780.svg)](https://doi.org/10.5281/zenodo.1296780)). + + +Command line usage +------------------ + +Create a text file: +``` +$ echo "aäaaöaaüaa" > text.txt +``` + +Now look at the profile: +``` +$ cat text.txt | segments profile +Grapheme frequency mapping +a 7 a +ä 1 ä +ü 1 ü +ö 1 ö +``` + +Write the profile to a file: +``` +$ cat text.txt | segments profile > profile.prf +``` + +Edit the profile: + +``` +$ more profile.prf +Grapheme frequency mapping +aa 0 x +a 7 a +ä 1 ä +ü 1 ü +ö 1 ö +``` + +Now tokenize the text without profile: +``` +$ cat text.txt | segments tokenize +a ä a a ö a a ü a a +``` + +And with profile: +``` +$ cat text.txt | segments --profile=profile.prf tokenize +a ä aa ö aa ü aa + +$ cat text.txt | segments --mapping=mapping --profile=profile.prf tokenize +a ä x ö x ü x +``` + + +API +--- + +```python +>>> from segments import Profile, Tokenizer +>>> t = Tokenizer() +>>> t('abcd') +'a b c d' +>>> prf = Profile({'Grapheme': 'ab', 'mapping': 'x'}, {'Grapheme': 'cd', 'mapping': 'y'}) +>>> print(prf) +Grapheme mapping +ab x +cd y +>>> t = Tokenizer(profile=prf) +>>> t('abcd') +'ab cd' +>>> t('abcd', column='mapping') +'x y' +``` diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..878e22e9a2ef36edcdc55ffb8fbb162272e63920 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/RECORD @@ -0,0 +1,22 @@ +../../Scripts/segments.exe,sha256=l9VeqELcRemhiBCRQ1CfpqUrfSWTJiCwCEWwUXwTjvI,108380 +segments-2.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +segments-2.3.0.dist-info/LICENSE,sha256=y16Ofl9KOYjhBjwULGDcLfdWBfTEZRXnduOspt-XbhQ,11325 +segments-2.3.0.dist-info/METADATA,sha256=qtnnRFmMljakKscbHve5Uk0rvlvvQuZ_DqNvAa_hLmI,3467 +segments-2.3.0.dist-info/RECORD,, +segments-2.3.0.dist-info/WHEEL,sha256=TJ49d73sNs10F0aze1W_bTW2P_X7-F4YXOlBqoqA-jY,109 +segments-2.3.0.dist-info/entry_points.txt,sha256=Es_A2rNdxpgiq7SEXfjlrbm2nvmcRywVwrJEp4cY1gc,52 +segments-2.3.0.dist-info/top_level.txt,sha256=6c8xKq6vt3NBzy6MSfFICf-VMJL3FMsIX3g9bft7Bm0,9 +segments/__init__.py,sha256=Oe5ySNg2nR7TI2fq3GLygH_ZiITIreIFKTICkm6QZ8E,239 +segments/__main__.py,sha256=sy9UjYJ1bB9gjET_EMkkNDSalA4zbb23Qh8tMl3_Uv4,2623 +segments/__pycache__/__init__.cpython-312.pyc,, +segments/__pycache__/__main__.cpython-312.pyc,, +segments/__pycache__/errors.cpython-312.pyc,, +segments/__pycache__/profile.cpython-312.pyc,, +segments/__pycache__/tokenizer.cpython-312.pyc,, +segments/__pycache__/tree.cpython-312.pyc,, +segments/__pycache__/util.cpython-312.pyc,, +segments/errors.py,sha256=TpVcNUCx1YIZqZ1Urc-30oRptzOqD98gA4tpXFtQyCA,434 +segments/profile.py,sha256=dOraG_axfMgzuyA_V_nxdeTvGfAl9TdvC2KTh9emg_Y,5554 +segments/tokenizer.py,sha256=yyreV3YBt_gFwO8IP8oHzIR_El46wEXpscXw574o00w,12920 +segments/tree.py,sha256=AeTp31M7XB6youejSPNihTitzBjxkbnv9AzaK99Q5hM,2077 +segments/util.py,sha256=b7W64hyKe0CeefDfFu8zXCDJMkyY7zkdvMtvMuS66l8,187 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..17c0299e4939ec0b7f7cf5b02ed977ee81d70312 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: setuptools (75.2.0) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea34346308b3f41320d46c175a4b4ff15a354417 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +segments = segments.__main__:main diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb27fb8cbf3350e48bef4df819b0eab03cbb21bf --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments-2.3.0.dist-info/top_level.txt @@ -0,0 +1 @@ +segments diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/segments/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..43f06a9bd427a4d472d6c95c70af1b0c9ecc22a8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments/__init__.py @@ -0,0 +1,6 @@ +from segments.tokenizer import Tokenizer, Rules # noqa: F401 +from segments.profile import Profile # noqa: F401 +from segments.util import REPLACEMENT_MARKER # noqa: F401 + +__version__ = '2.3.0' +__all__ = ['Tokenizer', 'Profile', 'Rules'] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments/__main__.py b/TTS/Kokoro/.venv/Lib/site-packages/segments/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..961828ca667f9eb0881c32b2e66fc4246e657727 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments/__main__.py @@ -0,0 +1,80 @@ +import sys +import logging +import pathlib +import argparse + +from segments import Tokenizer, Profile + + +class ParserError(Exception): + pass + + +def tokenize(args): + """ + Tokenize a string (passed as argument or read from stdin) + + segments [--profile=PATH/TO/PROFILE] tokenize [STRING] + """ + if args.profile and not pathlib.Path(args.profile).exists(): # pragma: no cover + raise ParserError('--profile must be a path for an existing file') + print(Tokenizer(profile=args.profile)(_read(args), column=args.mapping)) + + +def profile(args): + """ + Create an orthography profile for a string (passed as argument or read from stdin) + + segments profile [STRING] + """ + print(Profile.from_text(_read(args))) + + +def _read(args): + string = args.args[0] if args.args else sys.stdin.read() + if not isinstance(string, str): + string = string.decode(args.encoding) + return string.strip() + + +def main(parsed_args=None): + commands = {'tokenize': tokenize, 'profile': profile} + logging.basicConfig() + parser = argparse.ArgumentParser( + description="Main command line interface of the segments package.", + epilog="Use '%(prog)s help ' to get help about individual commands.") + parser.add_argument("--verbosity", help="increase output verbosity") + parser.add_argument('command', help=' | '.join(commands)) + parser.add_argument('args', nargs=argparse.REMAINDER) + parser.add_argument("--encoding", help='input encoding', default="utf8") + parser.add_argument("--profile", help='path to an orthography profile', default=None) + parser.add_argument( + "--mapping", + help='column name in ortho profile to map graphemes', + default=Profile.GRAPHEME_COL) + + args = parsed_args or parser.parse_args() + if args.command == 'help' and len(args.args): + # As help text for individual commands we simply re-use the docstrings of the + # callables registered for the command: + print(commands[args.args[0]].__doc__.strip() + if args.args[0] in commands else "Invalid command: '{}'".format(args.args[0])) + else: + if args.command not in commands: + print('invalid command') + parser.print_help() + sys.exit(64) + try: + commands[args.command](args) + except ParserError as e: + print(e) + print(commands[args.command].__doc__.strip()) + sys.exit(64) + except Exception as e: # pragma: no cover + print(e) + sys.exit(1) + sys.exit(0) + + +if __name__ == '__main__': # pragma: no cover + main() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments/errors.py b/TTS/Kokoro/.venv/Lib/site-packages/segments/errors.py new file mode 100644 index 0000000000000000000000000000000000000000..669806b05c3e6dfda98d542f9f11de2e938dc631 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments/errors.py @@ -0,0 +1,23 @@ +""" +Default implementations for error handlers +""" +import logging + +from segments.util import REPLACEMENT_MARKER + +log = logging.getLogger(__name__) + + +def strict(c): + log.debug('invalid grapheme: {0}'.format(c)) + raise ValueError('invalid grapheme') + + +def replace(c): + log.debug('replacing grapheme: {0}'.format(c)) + return REPLACEMENT_MARKER + + +def ignore(c): + log.debug('ignoring grapheme: {0}'.format(c)) + return '' diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments/profile.py b/TTS/Kokoro/.venv/Lib/site-packages/segments/profile.py new file mode 100644 index 0000000000000000000000000000000000000000..5ac852d16bf12fa6b42e70b65c1e1813ce056ba4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments/profile.py @@ -0,0 +1,165 @@ +import copy +import typing +import logging +import pathlib +import warnings +import collections +import unicodedata +import json.decoder + +from csvw import TableGroup, Column + +from segments.tree import Tree +from segments.util import grapheme_pattern + + +class Profile: + """ + An Orthography Profile as specified by Moran and Cysouw 2018. + """ + GRAPHEME_COL = 'Grapheme' + NULL = "NULL" + MD = { + "tables": [ + { + "dialect": { + "delimiter": "\t", + "header": True, + "encoding": "utf-8" + }, + "tableSchema": { + "columns": [ + { + "name": GRAPHEME_COL, + "datatype": "string", + "required": True + } + ], + "primaryKey": GRAPHEME_COL + } + } + ] + } + + @classmethod + def default_metadata(cls, fname=None) -> dict: + md = copy.copy(cls.MD) + md['tables'][0]['url'] = str(fname or '') + return md + + def __init__(self, *specs: dict, **kw): + """ + + Parameters + ---------- + specs : list of dict + A list of grapheme specifications. + kw : + The following keyword arguments are recognized: + - fname: Path of the profile or profile metadata. + - form: Unicode normalization to apply to the data in the profile before use. + - remaining keyword arguments are assigned as dict to `Profile.metadata`. + """ + self.graphemes = collections.OrderedDict() + self.column_labels = set() + self.fname = kw.pop('fname', None) + self.form = kw.pop('form', None) + self.metadata = kw + + log = logging.getLogger(__name__) + for i, spec in enumerate(specs): + if self.GRAPHEME_COL not in spec: + raise ValueError('invalid grapheme specification') + + if self.form: + spec = { + unicodedata.normalize(self.form, k): + None if v is None else unicodedata.normalize(self.form, v) + for k, v in spec.items()} + + grapheme = spec.pop(self.GRAPHEME_COL) + if not grapheme: + raise ValueError('Grapheme must not be empty') + + self.column_labels = self.column_labels.union(spec.keys()) + + # check for duplicates in the orthography profile (fail if dups) + if grapheme not in self.graphemes: + self.graphemes[grapheme] = spec + else: + log.warning( + 'line {0}:duplicate grapheme in profile: {1}'.format(i + 2, grapheme)) + self.tree = Tree(list(self.graphemes.keys())) + + def iteritems(self) -> typing.Generator[dict, None, None]: + for grapheme, spec in self.graphemes.items(): + res = {self.GRAPHEME_COL: grapheme} + res.update({k: None for k in self.column_labels}) + res.update({k: v for k, v in spec.items()}) + yield res + + @classmethod + def from_file(cls, fname, form=None) -> 'Profile': + """ + Read an orthography profile from a metadata file or a default tab-separated profile file. + """ + try: + tg = TableGroup.from_file(fname) + opfname = None + except json.decoder.JSONDecodeError: + tg = TableGroup.fromvalue(cls.default_metadata(fname)) + opfname = fname + if len(tg.tables) != 1: # pragma: no cover + raise ValueError('profile description must contain exactly one table') + metadata = tg.common_props + metadata.update(fname=pathlib.Path(fname), form=form) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + res = cls( + *[{k: None if (k != cls.GRAPHEME_COL and v == cls.NULL) else v + for k, v in d.items()} + for d in tg.tables[0].iterdicts(fname=opfname)], + **metadata) + return res + + @classmethod + def from_text(cls, text: str, mapping='mapping') -> 'Profile': + """ + Create a Profile instance from the Unicode graphemes found in `text`. + + Parameters + ---------- + text + mapping + + Returns + ------- + A Profile instance. + + """ + graphemes = collections.Counter(grapheme_pattern.findall(text)) + specs = [ + collections.OrderedDict([ + (cls.GRAPHEME_COL, grapheme), + ('frequency', frequency), + (mapping, grapheme)]) + for grapheme, frequency in graphemes.most_common()] + return cls(*specs) + + @classmethod + def from_textfile(cls, fname, mapping='mapping') -> 'Profile': + with pathlib.Path(fname).open(encoding='utf-8') as fp: + lines = fp.readlines() + return cls.from_text(' '.join(lines), mapping=mapping) + + def __str__(self): + """ + A Profile is represented as tab-separated lines of grapheme specifications. + """ + tg = TableGroup.fromvalue(self.default_metadata()) + for col in self.column_labels: + if col != self.GRAPHEME_COL: + tg.tables[0].tableSchema.columns.append( + Column.fromvalue({"name": col, "null": self.NULL})) + + return tg.tables[0].write(self.iteritems(), fname=None).decode('utf8').strip() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments/tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/segments/tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..4facefae5ce8889b66b7872ee5657073d1e702aa --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments/tokenizer.py @@ -0,0 +1,355 @@ +""" +Tokenizer of Unicode characters, grapheme clusters and tailored grapheme clusters +(of orthographies) given an orthography profile. +""" +import typing +import pathlib +import unicodedata + +import regex +from csvw.dsv import reader + +from segments.util import nfd, grapheme_pattern +from segments import errors +from segments.profile import Profile + + +def iterlines(p: typing.Union[pathlib.Path, str]) -> typing.Generator[str, None, None]: + with pathlib.Path(p).open(encoding='utf-8') as fp: + for line in fp.readlines(): + line = line.strip() + if line and not line.startswith('#'): + yield unicodedata.normalize('NFD', line) + + +class Rules: + """ + Rules are given in tuple format, comma delimited. + Regular expressions are given in Python syntax. + """ + def __init__(self, *rules: typing.Tuple[str, str]): + self._rules = [(regex.compile(rule), replacement) for rule, replacement in rules] + + @classmethod + def from_file(cls, fname) -> 'Rules': + return cls(*list(reader(list(iterlines(fname))))) + + def apply(self, s): + for rule, replacement in self._rules: + s = rule.sub(replacement, s) + return s + + +class Tokenizer: + """ + Class for Unicode character and grapheme tokenization. + + This class provides extended functionality for + orthography-specific tokenization with orthography profiles. + + Parameters + ---------- + + profile : string or pathlib.Path or Profile instance (default = None) + Specifies an orthography profile to use. + + rules : string (default = None) + Filename of a rules file. + + Notes + ----- + The tokenizer can be used for pure Unicode character and grapheme + tokenization, i.e. it uses the Unicode standard grapheme parsing rules, as + implemented in the Python regex package by Matthew Barnett, to do basic tokenization + with the "\\X" grapheme regular expression match. This grapheme match + combines one or more Combining Diacritical Marks to their base character. + These are called "grapheme clusters" in Unicode parlance. With these functions + the Tokenizer is meant to do basic rudimentary parsing for things like generating + unigram models (segments and their counts) from input data. + + When a profile is passed, the Tokenizer reads the orthography profile and calls a helper + class to build a tree data structure, which stores the possible Unicode + character combinations that are specified in the orthography profile + (i.e. tailored grapheme clusters) that appear in the data source. + + For example, an orthography profile might specify that in source X + is a single grapheme (Unicode parlance: tailored grapheme) and + therefore it should be chunked as so. Given an orthography profile and + some data to tokenize, the process would look like this: + + input string example: uubo uubo + output string example: uu b o # uu b o + + >>> prf = Profile({'Grapheme': 'uu'}, {'Grapheme': 'b'}, {'Grapheme': 'o'}) + >>> t = Tokenizer(profile=prf) + >>> t('uubo uubo') + 'uu b o # uu b o' + + See also the test orthography profile and rules in the test directory. + + An additional method "combine_modifiers" handles the case where there are + Unicode Spacing Modifier Letters, which are not explicitly + combined to their base character in the Unicode Standard. These graphemes + are called "Tailored grapheme clusters" in Unicode. For more information + see the Unicode Standard Annex #29: Unicode Text Segmentation: + + * http://www.unicode.org/reports/tr29/ + + Additionally, the Tokenizer provides functionality to transform graphemes + into associated character(s) specified in additional columns in the orthography + profile. A dictionary is created that keeps a mapping between source-specific + graphemes and their counterparts (e.g. an IPA column in the orthography profile). + + Lastly, the Tokenizer can be used to transform text as specified in an + orthography rules file. These transformations are specified in a separate + file from the orthography profile (that specifics the document specific graphemes, + and possibly their IPA counterparts) and the orthography rules should + be applied to the output of a grapheme tokenization. + + In an orthography rules file, rules are given in order as regular + expressions, e.g. this rule replaces a vowel followed by an + followed by followed by a second vowel with first vowel + second vowel, e.g.:: + + $ (a|á|e|é|i|í|o|ó|u|ú)(n)(\\s)(a|á|e|é|i|í|o|ó|u|ú), \\1 \\2 \\4 + + """ + def __init__(self, + profile=None, + rules=None, + errors_strict: typing.Callable[[str], typing.Optional[str]] = errors.strict, + errors_replace: typing.Callable[[str], typing.Optional[str]] = errors.replace, + errors_ignore: typing.Callable[[str], typing.Optional[str]] = errors.ignore): + self.op = None + if isinstance(profile, Profile): + self.op = profile + elif profile is not None: + self.op = Profile.from_file(profile) + if not rules and self.op and self.op.fname: + _rules = self.op.fname.parent / (self.op.fname.stem + '.rules') + if _rules.exists(): + rules = _rules + self._rules = Rules.from_file(rules) if rules else None + self._errors = { + 'strict': errors_strict, + 'replace': errors_replace, + 'ignore': errors_ignore, + } + + def __call__(self, + string: str, + column: str = Profile.GRAPHEME_COL, + form: typing.Optional[typing.Literal['NFC', 'NFKC', 'NFD', 'NFKD']] = None, + ipa: bool = False, + segment_separator=' ', + separator=' # ', + errors: typing.Literal['replace', 'strict', 'ignore'] = 'replace') -> str: + """ + The main task of a Tokenizer is tokenizing! This is what happens when called. + + This function determines what to do given any combination + of orthography profile and rules or not orthography profile + or rules. + + Parameters + ---------- + string : str + The input string to be tokenized. + + column : str (default = "graphemes") + The column label for the transformation, if specified. + + form : None or unicode normalization form + Normalize return value if form is not None. + + ipa : bool + Tokenize IPA (work in progress) + + Returns + ------- + result : str + Result of the tokenization. + + """ + res = [] + for word in string.split(): + if ipa: + res.append(self.combine_modifiers(self.grapheme_clusters(nfd(word)))) + else: + if self.op: + res.append( + self.transform(word, column=column, error=self._errors[errors])) + else: + res.append(self.grapheme_clusters(nfd(word))) + + def pp(word): + res = segment_separator.join(word).strip() + res = self._rules.apply(res) if self._rules else res + return unicodedata.normalize(form, res) if form else res + + return separator.join(pp(word) for word in res) + + def characters(self, string, segment_separator=' ', separator=' # ',) -> str: + """ + Given a string as input, return a space-delimited string of Unicode characters + (code points rendered as glyphs). + Parameters + ---------- + string : str + A Unicode string to be tokenized into graphemes. + Returns + ------- + result : str + String returned is space-delimited on Unicode characters and contains "#" to + mark word boundaries. + The string is in NFD. + Notes + ----- + Input is first normalized according to Normalization Ford D(ecomposition). + String returned contains "#" to mark word boundaries. + """ + return separator.join(segment_separator.join(word) for word in nfd(string).split()) + + def grapheme_clusters(self, word): + """ + See: Unicode Standard Annex #29: UNICODE TEXT SEGMENTATION + http://www.unicode.org/reports/tr29/ + + Given a string as input, return a list of Unicode graphemes using the + "\\X" regular expression. + + Parameters + ---------- + word : str + A Unicode string to be tokenized into graphemes. + + Returns + ------- + result : list + List of Unicode graphemes in NFD. + + """ + # init the regex Unicode grapheme cluster match + return grapheme_pattern.findall(word) + + def transform(self, word, column=Profile.GRAPHEME_COL, error=errors.replace): + """ + Transform a string's graphemes into the mappings given in a different column + in the orthography profile. + + Parameters + ---------- + word : str + The input string to be tokenized. + + column : str (default = "Grapheme") + The label of the column to transform to. Default it to tokenize with + orthography profile. + + Returns + ------- + result : list of lists + Result of the transformation. + + """ + assert self.op, 'method can only be called with orthography profile.' + + if column != Profile.GRAPHEME_COL and column not in self.op.column_labels: + raise ValueError("Column {0} not found in profile.".format(column)) + + word = self.op.tree.parse(word, error) + if column == Profile.GRAPHEME_COL: + return word + out = [] + for token in word: + try: + target = self.op.graphemes[token][column] + except KeyError: + target = self._errors['replace'](token) + if target is not None: + if isinstance(target, (tuple, list)): + out.extend(target) + else: + out.append(target) + return out + + def rules(self, word): + """ + Function to tokenize input string and return output of str with ortho rules + applied. + + Parameters + ---------- + word : str + The input string to be tokenized. + + Returns + ------- + result : str + Result of the orthography rules applied to the input str. + + """ + return self._rules.apply(word) if self._rules else word + + def combine_modifiers(self, graphemes): + """ + Given a string that is space-delimited on Unicode grapheme clusters, + group Unicode modifier letters with their preceding base characters, + deal with tie bars, etc. + + Parameters + ---------- + string : str + A Unicode string tokenized into grapheme clusters to be tokenized into simple + IPA. + + """ + result = [] + temp = "" + count = len(graphemes) + for grapheme in reversed(graphemes): + count -= 1 + if len(grapheme) == 1 and unicodedata.category(grapheme) == "Lm" \ + and not ord(grapheme) in [712, 716] and len(graphemes) > 1: + temp = grapheme + temp + # hack for the cases where a space modifier is the first character in the + # string + if count == 0: + result[-1] = temp + result[-1] + continue # pragma: no cover + + # catch and repair stress marks + if len(grapheme) == 1 and (ord(grapheme) in [712, 716]) and result: + # If result == [], there's nothing to combine with ... + result[-1] = grapheme + result[-1] + temp = "" + continue + + # combine contour tone marks (non-accents) + if len(grapheme) == 1 and unicodedata.category(grapheme) == "Sk": + if len(result) == 0: + result.append(grapheme) + temp = "" + continue + else: + if unicodedata.category(result[-1][0]) == "Sk": + result[-1] = grapheme + temp + result[-1] + temp = "" + continue + + result.append(grapheme + temp) + temp = "" + + # last check for tie bars + segments = result[::-1] + i = 0 + r = [] + while i < len(segments): + # tie bars + if ord(segments[i][-1]) in [865, 860]: + r.append(segments[i] + segments[i + 1]) + i += 2 + else: + r.append(segments[i]) + i += 1 + return r diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments/tree.py b/TTS/Kokoro/.venv/Lib/site-packages/segments/tree.py new file mode 100644 index 0000000000000000000000000000000000000000..f06c0ce2f202daa76014fda71e891dab3c72be1c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments/tree.py @@ -0,0 +1,68 @@ +from segments.errors import replace + + +class TreeNode: + """ + Private class that creates the tree data structure from the orthography profile for + parsing. + """ + + def __init__(self, char, sentinel=False): + self.char = char + self.children = {} + self.sentinel = sentinel + + +class Tree: + def __init__(self, graphemes): + def _multigraph(node, line): + # Internal function to add a multigraph starting at node. + for char in line: + node = node.children.setdefault(char, TreeNode(char)) + node.sentinel = True + + self.root = TreeNode('', sentinel=True) + for grapheme in graphemes: + _multigraph(self.root, grapheme) + + def parse(self, line, error=replace): + res, idx = self._parse(self.root, line, 0) + rem = line[idx:] + while rem: + # Chop off one character and try parsing the remainder: + res.append(error(rem[0])) + rem = rem[1:] + r, i = self._parse(self.root, rem, 0) + res.extend(r) + rem = rem[i:] + return res + + def _parse(self, root, line, idx): + """ + :param root: Tree node. + :param line: String to parse. + :param idx: Global counter of characters parsed. + :return: (list of parsed graphemes, incremented character count) + """ + # Base (or degenerate..) case. + if len(line) == 0: + return [], idx + + parse = [] + curr = 0 + node = root + cidx = idx + while curr < len(line): + node = node.children.get(line[curr]) + curr += 1 + if not node: + break + if node.sentinel: + subparse, cidx = self._parse(root, line[curr:], idx + curr) + # Always keep the latest valid parse, which will be + # the longest-matched (greedy match) graphemes. + parse = [line[:curr]] + parse.extend(subparse) + if parse: + idx = cidx + return parse, idx diff --git a/TTS/Kokoro/.venv/Lib/site-packages/segments/util.py b/TTS/Kokoro/.venv/Lib/site-packages/segments/util.py new file mode 100644 index 0000000000000000000000000000000000000000..ecaa0564133ac6d43786c512e91ab28522c1df88 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/segments/util.py @@ -0,0 +1,8 @@ +import functools +import unicodedata + +import regex + +REPLACEMENT_MARKER = '�' +nfd = functools.partial(unicodedata.normalize, 'NFD') +grapheme_pattern = regex.compile(r"\X", regex.UNICODE) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..269f41649159832efcb833cb6dfb8a11afb8259c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/METADATA @@ -0,0 +1,141 @@ +Metadata-Version: 2.4 +Name: setuptools +Version: 82.0.0 +Summary: Easily download, build, install, upgrade, and uninstall Python packages +Author-email: Python Packaging Authority +License-Expression: MIT +Project-URL: Source, https://github.com/pypa/setuptools +Project-URL: Documentation, https://setuptools.pypa.io/ +Project-URL: Changelog, https://setuptools.pypa.io/en/stable/history.html +Keywords: CPAN PyPI distutils eggs package management +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: System :: Archiving :: Packaging +Classifier: Topic :: System :: Systems Administration +Classifier: Topic :: Utilities +Requires-Python: >=3.9 +Description-Content-Type: text/x-rst +License-File: LICENSE +Provides-Extra: test +Requires-Dist: pytest!=8.1.*,>=6; extra == "test" +Requires-Dist: virtualenv>=13.0.0; extra == "test" +Requires-Dist: wheel>=0.44.0; extra == "test" +Requires-Dist: pip>=19.1; extra == "test" +Requires-Dist: packaging>=24.2; extra == "test" +Requires-Dist: jaraco.envs>=2.2; extra == "test" +Requires-Dist: pytest-xdist>=3; extra == "test" +Requires-Dist: jaraco.path>=3.7.2; extra == "test" +Requires-Dist: build[virtualenv]>=1.0.3; extra == "test" +Requires-Dist: filelock>=3.4.0; extra == "test" +Requires-Dist: ini2toml[lite]>=0.14; extra == "test" +Requires-Dist: tomli-w>=1.0.0; extra == "test" +Requires-Dist: pytest-timeout; extra == "test" +Requires-Dist: pytest-perf; sys_platform != "cygwin" and extra == "test" +Requires-Dist: jaraco.develop>=7.21; (python_version >= "3.9" and sys_platform != "cygwin") and extra == "test" +Requires-Dist: pytest-home>=0.5; extra == "test" +Requires-Dist: pytest-subprocess; extra == "test" +Requires-Dist: pyproject-hooks!=1.1; extra == "test" +Requires-Dist: jaraco.test>=5.5; extra == "test" +Provides-Extra: doc +Requires-Dist: sphinx>=3.5; extra == "doc" +Requires-Dist: jaraco.packaging>=9.3; extra == "doc" +Requires-Dist: rst.linker>=1.9; extra == "doc" +Requires-Dist: furo; extra == "doc" +Requires-Dist: sphinx-lint; extra == "doc" +Requires-Dist: jaraco.tidelift>=1.4; extra == "doc" +Requires-Dist: pygments-github-lexers==0.0.5; extra == "doc" +Requires-Dist: sphinx-favicon; extra == "doc" +Requires-Dist: sphinx-inline-tabs; extra == "doc" +Requires-Dist: sphinx-reredirects; extra == "doc" +Requires-Dist: sphinxcontrib-towncrier; extra == "doc" +Requires-Dist: sphinx-notfound-page<2,>=1; extra == "doc" +Requires-Dist: pyproject-hooks!=1.1; extra == "doc" +Requires-Dist: towncrier<24.7; extra == "doc" +Provides-Extra: ssl +Provides-Extra: certs +Provides-Extra: core +Requires-Dist: packaging>=24.2; extra == "core" +Requires-Dist: more_itertools>=8.8; extra == "core" +Requires-Dist: jaraco.text>=3.7; extra == "core" +Requires-Dist: importlib_metadata>=6; python_version < "3.10" and extra == "core" +Requires-Dist: tomli>=2.0.1; python_version < "3.11" and extra == "core" +Requires-Dist: wheel>=0.43.0; extra == "core" +Requires-Dist: platformdirs>=4.2.2; extra == "core" +Requires-Dist: jaraco.functools>=4; extra == "core" +Requires-Dist: more_itertools; extra == "core" +Provides-Extra: check +Requires-Dist: pytest-checkdocs>=2.4; extra == "check" +Requires-Dist: pytest-ruff>=0.2.1; sys_platform != "cygwin" and extra == "check" +Requires-Dist: ruff>=0.13.0; sys_platform != "cygwin" and extra == "check" +Provides-Extra: cover +Requires-Dist: pytest-cov; extra == "cover" +Provides-Extra: enabler +Requires-Dist: pytest-enabler>=2.2; extra == "enabler" +Provides-Extra: type +Requires-Dist: pytest-mypy; extra == "type" +Requires-Dist: mypy==1.18.*; extra == "type" +Requires-Dist: importlib_metadata>=7.0.2; python_version < "3.10" and extra == "type" +Requires-Dist: jaraco.develop>=7.21; sys_platform != "cygwin" and extra == "type" +Dynamic: license-file + +.. |pypi-version| image:: https://img.shields.io/pypi/v/setuptools.svg + :target: https://pypi.org/project/setuptools + +.. |py-version| image:: https://img.shields.io/pypi/pyversions/setuptools.svg + +.. |test-badge| image:: https://github.com/pypa/setuptools/actions/workflows/main.yml/badge.svg + :target: https://github.com/pypa/setuptools/actions?query=workflow%3A%22tests%22 + :alt: tests + +.. |ruff-badge| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json + :target: https://github.com/astral-sh/ruff + :alt: Ruff + +.. |docs-badge| image:: https://img.shields.io/readthedocs/setuptools/latest.svg + :target: https://setuptools.pypa.io + +.. |skeleton-badge| image:: https://img.shields.io/badge/skeleton-2025-informational + :target: https://blog.jaraco.com/skeleton + +.. |codecov-badge| image:: https://img.shields.io/codecov/c/github/pypa/setuptools/master.svg?logo=codecov&logoColor=white + :target: https://codecov.io/gh/pypa/setuptools + +.. |tidelift-badge| image:: https://tidelift.com/badges/github/pypa/setuptools?style=flat + :target: https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=readme + +.. |discord-badge| image:: https://img.shields.io/discord/803025117553754132 + :target: https://discord.com/channels/803025117553754132/815945031150993468 + :alt: Discord + +|pypi-version| |py-version| |test-badge| |ruff-badge| |docs-badge| |skeleton-badge| |codecov-badge| |discord-badge| + +See the `Quickstart `_ +and the `User's Guide `_ for +instructions on how to use Setuptools. + +Questions and comments should be directed to `GitHub Discussions +`_. +Bug reports and especially tested patches may be +submitted directly to the `bug tracker +`_. + + +Code of Conduct +=============== + +Everyone interacting in the setuptools project's codebases, issue trackers, +chat rooms, and fora is expected to follow the +`PSF Code of Conduct `_. + + +For Enterprise +============== + +Available as part of the Tidelift Subscription. + +Setuptools and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use. + +`Learn more `_. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..94a897bbed899f9a1cc715b2d99089fc41b44ff9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/RECORD @@ -0,0 +1,759 @@ +_distutils_hack/__init__.py,sha256=34HmvLo07j45Uvd2VR-2aRQ7lJD91sTK6zJgn5fphbQ,6755 +_distutils_hack/__pycache__/__init__.cpython-312.pyc,, +_distutils_hack/__pycache__/override.cpython-312.pyc,, +_distutils_hack/override.py,sha256=Eu_s-NF6VIZ4Cqd0tbbA5wtWky2IZPNd8et6GLt1mzo,44 +distutils-precedence.pth,sha256=JjjOniUA5XKl4N5_rtZmHrVp0baW_LoHsN0iPaX10iQ,151 +setuptools-82.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +setuptools-82.0.0.dist-info/METADATA,sha256=rH6S0y76F6DYVMvMvpwyRPfKpeVjOzLxof3h2iaukV8,6573 +setuptools-82.0.0.dist-info/RECORD,, +setuptools-82.0.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91 +setuptools-82.0.0.dist-info/entry_points.txt,sha256=zkgthpf_Fa9NVE9p6FKT3Xk9DR1faAcRU4coggsV7jA,2449 +setuptools-82.0.0.dist-info/licenses/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023 +setuptools-82.0.0.dist-info/top_level.txt,sha256=Wsln-wPBdc8NXLNXsnCRyTXUhGi0mUw_l0ZVThaim-I,27 +setuptools/__init__.py,sha256=-UtTG9pdeEZkYiIFT69RckMCqxUdVILjj24g3qeJ_rc,9521 +setuptools/__pycache__/__init__.cpython-312.pyc,, +setuptools/__pycache__/_core_metadata.cpython-312.pyc,, +setuptools/__pycache__/_discovery.cpython-312.pyc,, +setuptools/__pycache__/_entry_points.cpython-312.pyc,, +setuptools/__pycache__/_imp.cpython-312.pyc,, +setuptools/__pycache__/_importlib.cpython-312.pyc,, +setuptools/__pycache__/_itertools.cpython-312.pyc,, +setuptools/__pycache__/_normalization.cpython-312.pyc,, +setuptools/__pycache__/_path.cpython-312.pyc,, +setuptools/__pycache__/_reqs.cpython-312.pyc,, +setuptools/__pycache__/_scripts.cpython-312.pyc,, +setuptools/__pycache__/_shutil.cpython-312.pyc,, +setuptools/__pycache__/_static.cpython-312.pyc,, +setuptools/__pycache__/archive_util.cpython-312.pyc,, +setuptools/__pycache__/build_meta.cpython-312.pyc,, +setuptools/__pycache__/depends.cpython-312.pyc,, +setuptools/__pycache__/discovery.cpython-312.pyc,, +setuptools/__pycache__/dist.cpython-312.pyc,, +setuptools/__pycache__/errors.cpython-312.pyc,, +setuptools/__pycache__/extension.cpython-312.pyc,, +setuptools/__pycache__/glob.cpython-312.pyc,, +setuptools/__pycache__/installer.cpython-312.pyc,, +setuptools/__pycache__/launch.cpython-312.pyc,, +setuptools/__pycache__/logging.cpython-312.pyc,, +setuptools/__pycache__/modified.cpython-312.pyc,, +setuptools/__pycache__/monkey.cpython-312.pyc,, +setuptools/__pycache__/msvc.cpython-312.pyc,, +setuptools/__pycache__/namespaces.cpython-312.pyc,, +setuptools/__pycache__/unicode_utils.cpython-312.pyc,, +setuptools/__pycache__/version.cpython-312.pyc,, +setuptools/__pycache__/warnings.cpython-312.pyc,, +setuptools/__pycache__/wheel.cpython-312.pyc,, +setuptools/__pycache__/windows_support.cpython-312.pyc,, +setuptools/_core_metadata.py,sha256=T7Tjp-WSoN881adev3R1wzXCPnkDHqbC2MgylN1yjS8,11978 +setuptools/_discovery.py,sha256=HxEpgYQ8zUaLOOSp8JIA4y2Mdvn9ysVxspPT-ppfzM4,836 +setuptools/_distutils/__init__.py,sha256=xGYuhWwLG07J0Q49BVnEjPy6wyDcd6veJMDJX7ljlyM,359 +setuptools/_distutils/__pycache__/__init__.cpython-312.pyc,, +setuptools/_distutils/__pycache__/_log.cpython-312.pyc,, +setuptools/_distutils/__pycache__/_macos_compat.cpython-312.pyc,, +setuptools/_distutils/__pycache__/_modified.cpython-312.pyc,, +setuptools/_distutils/__pycache__/_msvccompiler.cpython-312.pyc,, +setuptools/_distutils/__pycache__/archive_util.cpython-312.pyc,, +setuptools/_distutils/__pycache__/ccompiler.cpython-312.pyc,, +setuptools/_distutils/__pycache__/cmd.cpython-312.pyc,, +setuptools/_distutils/__pycache__/core.cpython-312.pyc,, +setuptools/_distutils/__pycache__/cygwinccompiler.cpython-312.pyc,, +setuptools/_distutils/__pycache__/debug.cpython-312.pyc,, +setuptools/_distutils/__pycache__/dep_util.cpython-312.pyc,, +setuptools/_distutils/__pycache__/dir_util.cpython-312.pyc,, +setuptools/_distutils/__pycache__/dist.cpython-312.pyc,, +setuptools/_distutils/__pycache__/errors.cpython-312.pyc,, +setuptools/_distutils/__pycache__/extension.cpython-312.pyc,, +setuptools/_distutils/__pycache__/fancy_getopt.cpython-312.pyc,, +setuptools/_distutils/__pycache__/file_util.cpython-312.pyc,, +setuptools/_distutils/__pycache__/filelist.cpython-312.pyc,, +setuptools/_distutils/__pycache__/log.cpython-312.pyc,, +setuptools/_distutils/__pycache__/spawn.cpython-312.pyc,, +setuptools/_distutils/__pycache__/sysconfig.cpython-312.pyc,, +setuptools/_distutils/__pycache__/text_file.cpython-312.pyc,, +setuptools/_distutils/__pycache__/unixccompiler.cpython-312.pyc,, +setuptools/_distutils/__pycache__/util.cpython-312.pyc,, +setuptools/_distutils/__pycache__/version.cpython-312.pyc,, +setuptools/_distutils/__pycache__/versionpredicate.cpython-312.pyc,, +setuptools/_distutils/__pycache__/zosccompiler.cpython-312.pyc,, +setuptools/_distutils/_log.py,sha256=i-lNTTcXS8TmWITJ6DODGvtW5z5tMattJQ76h8rZxQU,42 +setuptools/_distutils/_macos_compat.py,sha256=JzUGhF4E5yIITHbUaPobZEWjGHdrrcNV63z86S4RjBc,239 +setuptools/_distutils/_modified.py,sha256=RF1n1CexyDYV3lvGbeXS0s-XCJVboDOIUbA8wEQqYTY,3211 +setuptools/_distutils/_msvccompiler.py,sha256=9PSfSHxvJnHnQL6Sqz4Xcz7iaBIT62p6BheQzGsSlwo,335 +setuptools/_distutils/archive_util.py,sha256=dDZjw4BwhNIyt20hHlrIely4WSiN20HVTGdaPRKGI0o,8484 +setuptools/_distutils/ccompiler.py,sha256=FKVjqzGJ7c-FtouNjhLiaMPm5LKMZHHAruXf8LU216c,524 +setuptools/_distutils/cmd.py,sha256=lzqM-3rwYJNUhJiCYOv04aeUPenym2vyOndFPEOdZgo,21344 +setuptools/_distutils/command/__init__.py,sha256=GfFAzbBqk1qxSH4BdaKioKS4hRRnD44BAmwEN85C4u8,386 +setuptools/_distutils/command/__pycache__/__init__.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/_framework_compat.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/bdist.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/bdist_dumb.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/bdist_rpm.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/build.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/build_clib.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/build_ext.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/build_py.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/build_scripts.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/check.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/clean.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/config.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/install.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/install_data.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/install_egg_info.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/install_headers.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/install_lib.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/install_scripts.cpython-312.pyc,, +setuptools/_distutils/command/__pycache__/sdist.cpython-312.pyc,, +setuptools/_distutils/command/_framework_compat.py,sha256=0iZdSJYzGRWCCvzRDKE-R0-_yaAYvFMd1ylXb2eYXug,1609 +setuptools/_distutils/command/bdist.py,sha256=jWtk61R7fWNUUNxJV0thTZzU5n80L3Ay1waSiP9kiLA,5854 +setuptools/_distutils/command/bdist_dumb.py,sha256=FF0FpuC3IgFpOjJ1ub3hGU5ERFMBnJOiUjrAI-u4auw,4609 +setuptools/_distutils/command/bdist_rpm.py,sha256=WRRB3k65qubgZO6zwiRMpaEEuG391mju_iJDRJTPvT8,21672 +setuptools/_distutils/command/build.py,sha256=SpHlagf0iNaKVyIhxDfhPFZ8X1-LAWOCQACy-yt2K0w,5923 +setuptools/_distutils/command/build_clib.py,sha256=6u-R8qjmWr6FPECuzDoAyVl1xRBtuEmXJZ2cz2Zk2zg,7733 +setuptools/_distutils/command/build_ext.py,sha256=vnInlUvOVbCS7eCpp3ThqTY4NkQ7WBHcmsROGn8upKw,32676 +setuptools/_distutils/command/build_py.py,sha256=BAJI_X9QlfiTyokU3ZgfDnsy3Xn6aWdxl2T_lToagbk,16606 +setuptools/_distutils/command/build_scripts.py,sha256=UKhGKyXLjGCAQoQVfP2t-DnlMaUVjcXWac6UCs6GWMI,4833 +setuptools/_distutils/command/check.py,sha256=yoNe2MPY4JcTM7rwoIQdfZ75q5Ri058I2coi-Gq9CjM,4946 +setuptools/_distutils/command/clean.py,sha256=UWkfAMmpOZGl0_PjiZJFdyLV2yzGnoimygF8fka907I,2551 +setuptools/_distutils/command/config.py,sha256=zE7F8mSQavwiZwNZj8WtrF6T92lt-K1dUNq9rYIQpgc,12206 +setuptools/_distutils/command/install.py,sha256=-JenB-mua4hc2RI_-W8F9PnP_J-OaFO7E0PJGKxLo1o,30072 +setuptools/_distutils/command/install_data.py,sha256=GzBlUWWKubTYJlP-L0auUriq9cL-5RKOcoyHTttKj0Q,2875 +setuptools/_distutils/command/install_egg_info.py,sha256=0tJ0AqFr8P1bf5wFH9eO7ssx1G3_SLhO9bCbWN-h0f4,2809 +setuptools/_distutils/command/install_headers.py,sha256=5ciKCj8c3XKsYNKdkdMvnypaUCKcoWCDeeZij3fD-Z4,1272 +setuptools/_distutils/command/install_lib.py,sha256=3VQc5P06dv-1QVl8G-raVpTD-bMlPTj1c3NE7adJiyk,8512 +setuptools/_distutils/command/install_scripts.py,sha256=CTzga_-kEjYWguL-Dg_GP83Jax6uw2VnFFwlR8XoAls,1877 +setuptools/_distutils/command/sdist.py,sha256=XGEO5UMznLzPT-F3ftbryqkMsMWLKd15tjObiZJsm8k,19107 +setuptools/_distutils/compat/__init__.py,sha256=J20aXGjJ86Rg41xFLIWlcWCgZ9edMdJ9vvdNEQ87vPQ,522 +setuptools/_distutils/compat/__pycache__/__init__.cpython-312.pyc,, +setuptools/_distutils/compat/__pycache__/numpy.cpython-312.pyc,, +setuptools/_distutils/compat/__pycache__/py39.cpython-312.pyc,, +setuptools/_distutils/compat/numpy.py,sha256=UFgneZw9w97g4c-yGoAIOyLxUOWQ-fPRIhhfMs7_Ouc,167 +setuptools/_distutils/compat/py39.py,sha256=hOsD6lwZLqZoMnacNJ3P6nUA-LJQhEpVtYTzVH0o96M,1964 +setuptools/_distutils/compilers/C/__pycache__/base.cpython-312.pyc,, +setuptools/_distutils/compilers/C/__pycache__/cygwin.cpython-312.pyc,, +setuptools/_distutils/compilers/C/__pycache__/errors.cpython-312.pyc,, +setuptools/_distutils/compilers/C/__pycache__/msvc.cpython-312.pyc,, +setuptools/_distutils/compilers/C/__pycache__/unix.cpython-312.pyc,, +setuptools/_distutils/compilers/C/__pycache__/zos.cpython-312.pyc,, +setuptools/_distutils/compilers/C/base.py,sha256=0b6_nCJiQtmUkdxL6tFKxVx8vv8AkLZOfRkIS2zGXCc,54550 +setuptools/_distutils/compilers/C/cygwin.py,sha256=QFW4oBPylt6-uR4mdrXbFtGMQQ_mXJ4gB0qPUklbMWQ,11802 +setuptools/_distutils/compilers/C/errors.py,sha256=sKOVzJajMUmNdfywo9UM_QQGsKFcclDhtI5TlCiXMLc,573 +setuptools/_distutils/compilers/C/msvc.py,sha256=c-12nYp2XpD-fUvxfgd559rWZqmmRx9f9mWFwWTsoP4,21386 +setuptools/_distutils/compilers/C/tests/__pycache__/test_base.cpython-312.pyc,, +setuptools/_distutils/compilers/C/tests/__pycache__/test_cygwin.cpython-312.pyc,, +setuptools/_distutils/compilers/C/tests/__pycache__/test_mingw.cpython-312.pyc,, +setuptools/_distutils/compilers/C/tests/__pycache__/test_msvc.cpython-312.pyc,, +setuptools/_distutils/compilers/C/tests/__pycache__/test_unix.cpython-312.pyc,, +setuptools/_distutils/compilers/C/tests/test_base.py,sha256=rdhHc56bhXtm5NnN9BSHwr6c69UqzMItZQzlw2AsdMc,2706 +setuptools/_distutils/compilers/C/tests/test_cygwin.py,sha256=UgV2VgUXj3VulcbDc0UBWfEyJDx42tgSwS4LzHix3mY,2701 +setuptools/_distutils/compilers/C/tests/test_mingw.py,sha256=hCmwyywISpRoyOySbFHBL4TprWRV0mUWDKmOLO8XBXE,1900 +setuptools/_distutils/compilers/C/tests/test_msvc.py,sha256=DlGjmZ1mBSMXIgmlu80BKc7V-EJOZuYucwJwFh5dn28,4151 +setuptools/_distutils/compilers/C/tests/test_unix.py,sha256=AyadWw1fR-UeDl2TvIbYBzOJVHkpE_oRRQ3JTJWqaEA,14642 +setuptools/_distutils/compilers/C/unix.py,sha256=YH-y9g_pjBFjaJyHJQkDEBQ7q4D20I2-cWJNdgw-Yho,16531 +setuptools/_distutils/compilers/C/zos.py,sha256=WnGA_PR51_FP89wKbl85_2rcLA28BIKbeG5rPZ7JUig,6568 +setuptools/_distutils/core.py,sha256=GEHKaFC48T3o-_SmH4864GvKyx1IgbVC6ISIPVlx7a4,9364 +setuptools/_distutils/cygwinccompiler.py,sha256=mG_cU8SVZ4amD_VtF5vH6BXP0-kghGsDPbDSXrQ963c,594 +setuptools/_distutils/debug.py,sha256=N6MrTAqK6l9SVk6tWweR108PM8Ol7qNlfyV-nHcLhsY,139 +setuptools/_distutils/dep_util.py,sha256=xN75p6ZpHhMiHEc-rpL2XilJQynHnDNiafHteaZ4tjU,349 +setuptools/_distutils/dir_util.py,sha256=1i-puqc3g8sTggEPX6NSuqNtGSNEdSy-Qw9qQfC3PSo,6864 +setuptools/_distutils/dist.py,sha256=kPQ81tTJdZikPayJ7OIunkFAh-m8-YqjbpQYQSuMTeI,55699 +setuptools/_distutils/errors.py,sha256=PPE2oDRh5y9Q1beKK9rhdvDaCzQhi4HCXs4KcqfqgZY,3092 +setuptools/_distutils/extension.py,sha256=Foyu4gULcPqm1_U9zrYYHxNk4NqglXv1rbsOk_QrSds,11155 +setuptools/_distutils/fancy_getopt.py,sha256=PjdO-bWCW0imV_UN-MGEw9R2GP2OiE8pHjITgmTAY3Q,17895 +setuptools/_distutils/file_util.py,sha256=O3hNtKxcs4jhCdOtGN23wIrLSvMwoRmMV2caEeXbvdU,7811 +setuptools/_distutils/filelist.py,sha256=MBeSRJmPcKmDv8ooZgSU4BiQPZ0Khwv8l_jhD50XycI,15337 +setuptools/_distutils/log.py,sha256=VyBs5j7z4-K6XTEEBThUc9HyMpoPLGtQpERqbz5ylww,1200 +setuptools/_distutils/spawn.py,sha256=sPnZ3Q3gsBzNBB2zsbfFxzkHJ-AveB6lyK9YqBHQiIw,3963 +setuptools/_distutils/sysconfig.py,sha256=KeI8OHbMuEzHJ8Q0cBez9KZny8iRy6Z6Y0AkMz1jlsU,19728 +setuptools/_distutils/tests/__init__.py,sha256=j-IoPZEtQv3EOPuqNTwalr6GLyRjzCC-OOaNvZzmHsI,1485 +setuptools/_distutils/tests/__pycache__/__init__.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/support.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_archive_util.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_bdist.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_bdist_dumb.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_bdist_rpm.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_build.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_build_clib.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_build_ext.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_build_py.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_build_scripts.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_check.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_clean.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_cmd.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_config_cmd.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_core.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_dir_util.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_dist.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_extension.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_file_util.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_filelist.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_install.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_install_data.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_install_headers.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_install_lib.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_install_scripts.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_log.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_modified.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_sdist.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_spawn.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_sysconfig.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_text_file.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_util.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_version.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/test_versionpredicate.cpython-312.pyc,, +setuptools/_distutils/tests/__pycache__/unix_compat.cpython-312.pyc,, +setuptools/_distutils/tests/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_distutils/tests/compat/__pycache__/__init__.cpython-312.pyc,, +setuptools/_distutils/tests/compat/__pycache__/py39.cpython-312.pyc,, +setuptools/_distutils/tests/compat/py39.py,sha256=t0GBTM-30jX-9zCfkwlNBFtzzabemx6065mJ0d9_VRw,1026 +setuptools/_distutils/tests/support.py,sha256=tjsYsyxvpTK4NrkCseh2ujvDIGV0Mf_b5SI5fP2T0yM,4099 +setuptools/_distutils/tests/test_archive_util.py,sha256=VaXLjV8kup-Z6rIVXCBW7u21pubcAH_R3hEtSmS81Xs,11441 +setuptools/_distutils/tests/test_bdist.py,sha256=xNHxUsLlHsZQRwkzLb_iSD24s-9Mk-NX2ffBWwOyPyc,1396 +setuptools/_distutils/tests/test_bdist_dumb.py,sha256=QF05MHNhPOdZyh88Xpw8KsO64s7pRFkl8KL-RoV4XK0,2247 +setuptools/_distutils/tests/test_bdist_rpm.py,sha256=Hdm-pwWgyaoGdGbEcGZa8cRhGU45y8gHK8umOanTjik,3932 +setuptools/_distutils/tests/test_build.py,sha256=JJY5XpOZco25ZY0pstxl-iI8mHsWP0ujf5o8aOtuZYY,1742 +setuptools/_distutils/tests/test_build_clib.py,sha256=Mo1ZFb4C1VXBYOGvnallwN7YCnTtr24akLDO8Zi4CsY,4331 +setuptools/_distutils/tests/test_build_ext.py,sha256=QFO9qYVhWWdJu17HXc4x9RMnLZlhk0lAHi9HVppbuX4,22545 +setuptools/_distutils/tests/test_build_py.py,sha256=NsfmRrojOHBXNMqWR_mp5g4PLTgjhD7iZFUffGZFIdw,6882 +setuptools/_distutils/tests/test_build_scripts.py,sha256=cD-FRy-oX55sXRX5Ez5xQCaeHrWajyKc4Xuwv2fe48w,2880 +setuptools/_distutils/tests/test_check.py,sha256=hHSV07qf7YoSxGsTbbsUQ9tssZz5RRNdbrY1s2SwaFI,6226 +setuptools/_distutils/tests/test_clean.py,sha256=hPH6jfIpGFUrvWbF1txkiNVSNaAxt2wq5XjV499zO4E,1240 +setuptools/_distutils/tests/test_cmd.py,sha256=bgRB79mitoOKR1OiyZHnCogvGxt3pWkxeTqIC04lQWQ,3254 +setuptools/_distutils/tests/test_config_cmd.py,sha256=Zs6WX0IfxDvmuC19XzuVNnYCnTr9Y-hl73TAmDSBN4Y,2664 +setuptools/_distutils/tests/test_core.py,sha256=L7XKVAxa-MGoAZeANopnuK9fRKneYhkSQpgw8XQvcF8,3829 +setuptools/_distutils/tests/test_dir_util.py,sha256=E84lC-k4riVUwURyWaQ0Jqx2ui2-io-0RuJa3M7qkJs,4500 +setuptools/_distutils/tests/test_dist.py,sha256=a6wlc5fQJd5qQ6HOndzcupNhjTxvj6-_JLtpuYvaP1M,18793 +setuptools/_distutils/tests/test_extension.py,sha256=-YejLgZCuycFrOBd64pVH0JvwMc9NwhzHvQxvvjXHqk,3670 +setuptools/_distutils/tests/test_file_util.py,sha256=livjnl3FkilQlrB2rFdFQq9nvjEVZHynNya0bfzv_b4,3522 +setuptools/_distutils/tests/test_filelist.py,sha256=rJwkqCUfkGDgWlD22TozsT8ycbupMHB8DXqThzwT1T4,10766 +setuptools/_distutils/tests/test_install.py,sha256=TfCB0ykhIxydIC2Q4SuTAZzSHvteMHgrBL9whoSgK9Q,8618 +setuptools/_distutils/tests/test_install_data.py,sha256=vKq3K97k0hBAnOg38nmwEdf7cEDVr9rTVyCeJolgb4A,2464 +setuptools/_distutils/tests/test_install_headers.py,sha256=PVAYpo_tYl980Qf64DPOmmSvyefIHdU06f7VsJeZykE,936 +setuptools/_distutils/tests/test_install_lib.py,sha256=qri6Rl-maNTQrNDV8DbeXNl0hjsfRIKiI4rfZLrmWBI,3612 +setuptools/_distutils/tests/test_install_scripts.py,sha256=KE3v0cDkFW-90IOID-OmZZGM2mhy-ZkEuuW7UXS2SHw,1600 +setuptools/_distutils/tests/test_log.py,sha256=isFtOufloCyEdZaQOV7cVUr46GwtdVMj43mGBB5XH7k,323 +setuptools/_distutils/tests/test_modified.py,sha256=h1--bOWmtJo1bpVV6uRhdnS9br71CBiNDM1MDwSGpug,4221 +setuptools/_distutils/tests/test_sdist.py,sha256=cfzUhlCA418-1vH9ta3IBs26c_jUBbkJoFOK5GnAyNk,15062 +setuptools/_distutils/tests/test_spawn.py,sha256=eS8w9D7bTxyFLSyRahJWeuh8Kc1F8RWWiY_dSG5B5Bc,4803 +setuptools/_distutils/tests/test_sysconfig.py,sha256=lxM8LsUi1TomjDV4HoYK8u5nUoBkeNL60Uq8PY1DcwU,11986 +setuptools/_distutils/tests/test_text_file.py,sha256=WQWSB5AfdBDZaMA8BFgipJPnsJb_2SKMfL90fSkRVtw,3460 +setuptools/_distutils/tests/test_util.py,sha256=H9zlZ4z4Vh4TfjNYDBsxP7wguQLpxCfJYyOcm1yZU3c,7988 +setuptools/_distutils/tests/test_version.py,sha256=ahfg_mP8wRy1sgwY-_Px5hrjgf6_upTIpnCgpR4yWRk,2750 +setuptools/_distutils/tests/test_versionpredicate.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_distutils/tests/unix_compat.py,sha256=z-op6C2iVdX1aq5BIBR7cqOxijKE97alNwJqHNdLpoI,386 +setuptools/_distutils/text_file.py,sha256=z4dkOJBr9Bo2LG0TNqm8sD63LEEaKSSP0J0bWBrFG3c,12101 +setuptools/_distutils/unixccompiler.py,sha256=1bXJWH4fiu_A2WfriHzf88xjllQTXnnjUkZdRKs9cWU,212 +setuptools/_distutils/util.py,sha256=iGaXP9t2-SQo7vaDR7bKUoEbrGO5QN69xTEtS5eihvk,17534 +setuptools/_distutils/version.py,sha256=vImT5-ECXkQ21oKL0XYFiTqK6NyM09cpzBNoA_34CQU,12619 +setuptools/_distutils/versionpredicate.py,sha256=qBWQ6wTj12ODytoTmIydefIY2jb4uY1sdbgbuLn-IJM,5205 +setuptools/_distutils/zosccompiler.py,sha256=svdiXZ2kdcwKrJKfhUhib03y8gz7aGZKukXH3I7YkBc,58 +setuptools/_entry_points.py,sha256=10TjbzfGdqWGH06lQuPPGDDci-OnXoIzrfpIWba5AZw,2468 +setuptools/_imp.py,sha256=YY1EjZEN-0zYci1cxO10B_adAEOr7i8eK8JoCc9Ierc,2435 +setuptools/_importlib.py,sha256=aKIjcK0HKXNz2D-XTrxaixGn_juTkONwmu3dcheMOF0,223 +setuptools/_itertools.py,sha256=jWRfsIrpC7myooz3hDURj9GtvpswZeKXg2HakmEhNjo,657 +setuptools/_normalization.py,sha256=1H0YXdCuVkUcNX2zQqDyqa-4eWC8VI5vWjGGsbj7n8I,5798 +setuptools/_path.py,sha256=2Bv1q9_Hrd4oizKwcH3pv_05YVR6meovQE6ZtyD45yI,2976 +setuptools/_reqs.py,sha256=RRX-qYsz_fy6K66XchCHcIszK3bSAtU6aO1s3ZaLV14,1380 +setuptools/_scripts.py,sha256=5TrIWDVOuO3cRcfzcZAUBKPRH7K4svQRdQLZKKiD1bQ,11247 +setuptools/_shutil.py,sha256=IQQ1gcPX4X_wPilYGJGxChyMCqG43VOejoQZTIrCTY8,1578 +setuptools/_static.py,sha256=GTR79gESF1_JaK4trLkpDrEuCeEtPlwQW0MRv7VNQX4,4855 +setuptools/_vendor/.lock,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/autocommand-2.2.2.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE,sha256=reeNBJgtaZctREqOFKlPh6IzTdOFXMgDSOqOJAqg3y0,7634 +setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA,sha256=OADZuR3O6iBlpu1ieTgzYul6w4uOVrk0P0BO5TGGAJk,15006 +setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD,sha256=K-5gcsvOxjkMVxB8jfywQikYqY7NtaLMNiGH8T1C6W8,1072 +setuptools/_vendor/autocommand-2.2.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/autocommand-2.2.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92 +setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt,sha256=AzfhgKKS8EdAwWUTSF8mgeVQbXOY9kokHB6kSqwwqu0,12 +setuptools/_vendor/autocommand/__init__.py,sha256=zko5Rnvolvb-UXjCx_2ArPTGBWwUK5QY4LIQIKYR7As,1037 +setuptools/_vendor/autocommand/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/autocommand/__pycache__/autoasync.cpython-312.pyc,, +setuptools/_vendor/autocommand/__pycache__/autocommand.cpython-312.pyc,, +setuptools/_vendor/autocommand/__pycache__/automain.cpython-312.pyc,, +setuptools/_vendor/autocommand/__pycache__/autoparse.cpython-312.pyc,, +setuptools/_vendor/autocommand/__pycache__/errors.cpython-312.pyc,, +setuptools/_vendor/autocommand/autoasync.py,sha256=AMdyrxNS4pqWJfP_xuoOcImOHWD-qT7x06wmKN1Vp-U,5680 +setuptools/_vendor/autocommand/autocommand.py,sha256=hmkEmQ72HtL55gnURVjDOnsfYlGd5lLXbvT4KG496Qw,2505 +setuptools/_vendor/autocommand/automain.py,sha256=A2b8i754Mxc_DjU9WFr6vqYDWlhz0cn8miu8d8EsxV8,2076 +setuptools/_vendor/autocommand/autoparse.py,sha256=WVWmZJPcbzUKXP40raQw_0HD8qPJ2V9VG1eFFmmnFxw,11642 +setuptools/_vendor/autocommand/errors.py,sha256=7aa3roh9Herd6nIKpQHNWEslWE8oq7GiHYVUuRqORnA,886 +setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023 +setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA,sha256=ghXFTq132dxaEIolxr3HK1mZqm9iyUmaRANZQSr6WlE,2020 +setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD,sha256=D2nbcZtUIg1qSt_4v7BKyYr_6j3ItUBUoaeHoXVn9NE,1056 +setuptools/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92 +setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt,sha256=cGjaLMOoBR1FK0ApojtzWVmViTtJ7JGIK_HwXiEsvtU,10 +setuptools/_vendor/backports/__init__.py,sha256=iOEMwnlORWezdO8-2vxBIPSR37D7JGjluZ8f55vzxls,81 +setuptools/_vendor/backports/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/backports/tarfile/__init__.py,sha256=Pwf2qUIfB0SolJPCKcx3vz3UEu_aids4g4sAfxy94qg,108491 +setuptools/_vendor/backports/tarfile/__main__.py,sha256=Yw2oGT1afrz2eBskzdPYL8ReB_3liApmhFkN2EbDmc4,59 +setuptools/_vendor/backports/tarfile/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/backports/tarfile/__pycache__/__main__.cpython-312.pyc,, +setuptools/_vendor/backports/tarfile/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/backports/tarfile/compat/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/backports/tarfile/compat/__pycache__/py38.cpython-312.pyc,, +setuptools/_vendor/backports/tarfile/compat/py38.py,sha256=iYkyt_gvWjLzGUTJD9TuTfMMjOk-ersXZmRlvQYN2qE,568 +setuptools/_vendor/importlib_metadata-8.7.1.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +setuptools/_vendor/importlib_metadata-8.7.1.dist-info/METADATA,sha256=o-OLnuQyYonUhkcE8w4pnudp4jCc6fSnXw3hpQrQo1Y,4670 +setuptools/_vendor/importlib_metadata-8.7.1.dist-info/RECORD,sha256=Uqa47g3hXPf9mWJfQ7l80uOUKshvFgVOqQ3kjmbyk1U,1868 +setuptools/_vendor/importlib_metadata-8.7.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/importlib_metadata-8.7.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91 +setuptools/_vendor/importlib_metadata-8.7.1.dist-info/licenses/LICENSE,sha256=RYUC4S2Xu_ZEOGBqIARKqF6wX7CoqAe7NdvsJT_R_AQ,10278 +setuptools/_vendor/importlib_metadata-8.7.1.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19 +setuptools/_vendor/importlib_metadata/__init__.py,sha256=u7Ew4-UkpzNY-ka6k-WRkDhQZS1akkLMfWs2eEnUmGo,37734 +setuptools/_vendor/importlib_metadata/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/__pycache__/_adapters.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/__pycache__/_collections.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/__pycache__/_compat.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/__pycache__/_functools.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/__pycache__/_itertools.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/__pycache__/_meta.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/__pycache__/_text.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/__pycache__/_typing.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/__pycache__/diagnose.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/_adapters.py,sha256=r5i8XLrKT6xmrpoREZhZrfczOYDmrVZeJBW5u0HzIGU,3797 +setuptools/_vendor/importlib_metadata/_collections.py,sha256=CxAhzlF3g1rwu_fMiB53JtRQiUFh0RgiMpoOvmK_ocg,760 +setuptools/_vendor/importlib_metadata/_compat.py,sha256=VC5ZDLlT-BcshauCShdFJvMNLntJJfZzNK1meGa-enw,1313 +setuptools/_vendor/importlib_metadata/_functools.py,sha256=0pA2OoiVK6wnsGq8HvVIzgdkvLiZ0nfnfw7IsndjoHk,3510 +setuptools/_vendor/importlib_metadata/_itertools.py,sha256=nMvp9SfHAQ_JYwK4L2i64lr3GRXGlYlikGTVzWbys_E,5351 +setuptools/_vendor/importlib_metadata/_meta.py,sha256=EtHyiJ5kGzWFDfKyQ2XQp6Vu113CeadKW1Vf6aGc1B4,1765 +setuptools/_vendor/importlib_metadata/_text.py,sha256=HCsFksZpJLeTP3NEk_ngrAeXVRRtTrtyh9eOABoRP4A,2166 +setuptools/_vendor/importlib_metadata/_typing.py,sha256=EQKhhsEgz_Sa-FnePI-faC72rNOOQwopjA1i5pG8FDU,367 +setuptools/_vendor/importlib_metadata/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/importlib_metadata/compat/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/compat/__pycache__/py311.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/compat/__pycache__/py39.cpython-312.pyc,, +setuptools/_vendor/importlib_metadata/compat/py311.py,sha256=uqm-K-uohyj1042TH4a9Er_I5o7667DvulcD-gC_fSA,608 +setuptools/_vendor/importlib_metadata/compat/py39.py,sha256=J3W7PUVRPNYMmcvT12RF8ndBU9e8_T0Ac4U87Bsrq70,1187 +setuptools/_vendor/importlib_metadata/diagnose.py,sha256=nkSRMiowlmkhLYhKhvCg9glmt_11Cox-EmLzEbqYTa8,379 +setuptools/_vendor/importlib_metadata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/jaraco.text-4.0.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +setuptools/_vendor/jaraco.text-4.0.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023 +setuptools/_vendor/jaraco.text-4.0.0.dist-info/METADATA,sha256=XC_QkBLJVPE5sQYkl41TNaZUw0AUzQb29GbKaD28nFY,3731 +setuptools/_vendor/jaraco.text-4.0.0.dist-info/RECORD,sha256=Y7k2wwjQ_L4TkOgkVnzAB1NsMqhJrbAieOlfHUxzbDE,1157 +setuptools/_vendor/jaraco.text-4.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/jaraco.text-4.0.0.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91 +setuptools/_vendor/jaraco.text-4.0.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7 +setuptools/_vendor/jaraco/context/__init__.py,sha256=br1ydYGo1Xr_Pu1anuEdd-QrjUiz_EY5L_5E4C03L4w,9809 +setuptools/_vendor/jaraco/context/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/jaraco/context/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/jaraco/functools/__init__.py,sha256=ZJx9cMs2Nvk2xGUl8OjVGkpjdOaNlSzJrN4dGglgX2g,18599 +setuptools/_vendor/jaraco/functools/__init__.pyi,sha256=K4DcbnYIHE5QlMxqf9-cVp-WhycrhuTao4J7O7TMq4Y,3907 +setuptools/_vendor/jaraco/functools/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/jaraco/functools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/jaraco/text/Lorem ipsum.txt,sha256=N_7c_79zxOufBY9HZ3yzMgOkNv-TkOTTio4BydrSjgs,1335 +setuptools/_vendor/jaraco/text/__init__.py,sha256=lazNYXo8IhOR1bFigLAyGiiQao6jtO3KGWh8bZZPx3c,16762 +setuptools/_vendor/jaraco/text/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/jaraco/text/__pycache__/layouts.cpython-312.pyc,, +setuptools/_vendor/jaraco/text/__pycache__/show-newlines.cpython-312.pyc,, +setuptools/_vendor/jaraco/text/__pycache__/strip-prefix.cpython-312.pyc,, +setuptools/_vendor/jaraco/text/__pycache__/to-dvorak.cpython-312.pyc,, +setuptools/_vendor/jaraco/text/__pycache__/to-qwerty.cpython-312.pyc,, +setuptools/_vendor/jaraco/text/layouts.py,sha256=HTC8aSTLZ7uXipyOXapRMC158juecjK6RVwitfmZ9_w,643 +setuptools/_vendor/jaraco/text/show-newlines.py,sha256=jT0vp4gLhG20hX2lTB-zKo_i3NgKzj79yRAdz4eMzIM,903 +setuptools/_vendor/jaraco/text/strip-prefix.py,sha256=NfVXV8JVNo6nqcuYASfMV7_y4Eo8zMQqlCOGvAnRIVw,412 +setuptools/_vendor/jaraco/text/to-dvorak.py,sha256=36nPPsiifwv6RfpAb--3zpgbIx8ohnnI1aR29IJTO9s,118 +setuptools/_vendor/jaraco/text/to-qwerty.py,sha256=IQoFY9v7vLTEybcput4KBYm_5GR35pmtgZ_xyrmdTgI,118 +setuptools/_vendor/jaraco_context-6.1.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +setuptools/_vendor/jaraco_context-6.1.0.dist-info/METADATA,sha256=BDXr_FIFXFqZdO0gwXG2RUOD6vnbsVCIFLp62XxZ1xI,4270 +setuptools/_vendor/jaraco_context-6.1.0.dist-info/RECORD,sha256=RZnYds60K37vA6o54jXE6-q2rqJAnb5jRJaFI5PR-Dc,777 +setuptools/_vendor/jaraco_context-6.1.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/jaraco_context-6.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91 +setuptools/_vendor/jaraco_context-6.1.0.dist-info/licenses/LICENSE,sha256=l1WhhRlmbl8PTK49qtPXASvK5IpgCzEjfXXp_hNOZoM,1076 +setuptools/_vendor/jaraco_context-6.1.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7 +setuptools/_vendor/jaraco_functools-4.4.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +setuptools/_vendor/jaraco_functools-4.4.0.dist-info/METADATA,sha256=LnnajcNGmSSr46yLIqP-tWkqeb-fR7vIa2U11hhkGEk,2960 +setuptools/_vendor/jaraco_functools-4.4.0.dist-info/RECORD,sha256=uq_S1tlMG95FPkyAWsBVEdxTmG4KY7AvZ07w94i-wUY,882 +setuptools/_vendor/jaraco_functools-4.4.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/jaraco_functools-4.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91 +setuptools/_vendor/jaraco_functools-4.4.0.dist-info/licenses/LICENSE,sha256=WlfLTbheKi3YjCkGKJCK3VfjRRRJ4KmnH9-zh3b9dZ0,1076 +setuptools/_vendor/jaraco_functools-4.4.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7 +setuptools/_vendor/more_itertools-10.8.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +setuptools/_vendor/more_itertools-10.8.0.dist-info/METADATA,sha256=arNRUUWr5YsGfwh8hnYxz0z11lP-2BuWQu4SCGw5BLg,39413 +setuptools/_vendor/more_itertools-10.8.0.dist-info/RECORD,sha256=ntGxNMCqg3IvNumfORiqlhDOOgpRTXk7u3SjaNRBoB0,1095 +setuptools/_vendor/more_itertools-10.8.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/more_itertools-10.8.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82 +setuptools/_vendor/more_itertools-10.8.0.dist-info/licenses/LICENSE,sha256=CfHIyelBrz5YTVlkHqm4fYPAyw_QB-te85Gn4mQ8GkY,1053 +setuptools/_vendor/more_itertools/__init__.py,sha256=5F7E_zpoGcEBW_T_3WE0WYYt8j-gJodIuiBcOJxrOv8,149 +setuptools/_vendor/more_itertools/__init__.pyi,sha256=5B3eTzON1BBuOLob1vCflyEb2lSd6usXQQ-Cv-hXkeA,43 +setuptools/_vendor/more_itertools/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/more_itertools/__pycache__/more.cpython-312.pyc,, +setuptools/_vendor/more_itertools/__pycache__/recipes.cpython-312.pyc,, +setuptools/_vendor/more_itertools/more.py,sha256=mNPKKu5UI7lRL460vgm0QTCWFiGMVCMosSPxVSdibos,163690 +setuptools/_vendor/more_itertools/more.pyi,sha256=fpEgNX3O66wY5cnT-s5VYDKNUpAcaCyU3iP84It3OOM,27119 +setuptools/_vendor/more_itertools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/more_itertools/recipes.py,sha256=Ma-kuBNZDFhaQDbIJgRmnrG86WzaupbOyUV3v8je3xw,41811 +setuptools/_vendor/more_itertools/recipes.pyi,sha256=LNRwN-OL3nkMfQAqx-PPc1fBaetUObb_Z6mdePyzh1c,6226 +setuptools/_vendor/packaging-26.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +setuptools/_vendor/packaging-26.0.dist-info/METADATA,sha256=M2K7fWom2iliuo2qpHhc0LrKwhq6kIoRlcyPWVgKJlo,3309 +setuptools/_vendor/packaging-26.0.dist-info/RECORD,sha256=9QUDMzqulReAfS-02B_CfLYKpkRmb1AXaBJibWIkzl0,2113 +setuptools/_vendor/packaging-26.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/packaging-26.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82 +setuptools/_vendor/packaging-26.0.dist-info/licenses/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197 +setuptools/_vendor/packaging-26.0.dist-info/licenses/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174 +setuptools/_vendor/packaging-26.0.dist-info/licenses/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344 +setuptools/_vendor/packaging/__init__.py,sha256=y4lVbpeBzCGk-IPDw5BGBZ_b0P3ukEEJZAbGYc6Ey8c,494 +setuptools/_vendor/packaging/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/_elffile.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/_manylinux.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/_musllinux.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/_parser.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/_structures.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/_tokenizer.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/markers.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/metadata.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/pylock.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/requirements.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/specifiers.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/tags.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/utils.cpython-312.pyc,, +setuptools/_vendor/packaging/__pycache__/version.cpython-312.pyc,, +setuptools/_vendor/packaging/_elffile.py,sha256=-sKkptYqzYw2-x3QByJa5mB4rfPWu1pxkZHRx1WAFCY,3211 +setuptools/_vendor/packaging/_manylinux.py,sha256=Hf6nB0cOrayEs96-p3oIXAgGnFquv20DO5l-o2_Xnv0,9559 +setuptools/_vendor/packaging/_musllinux.py,sha256=Z6swjH3MA7XS3qXnmMN7QPhqP3fnoYI0eQ18e9-HgAE,2707 +setuptools/_vendor/packaging/_parser.py,sha256=U_DajsEx2VoC_F46fSVV3hDKNCWoQYkPkasO3dld0ig,10518 +setuptools/_vendor/packaging/_structures.py,sha256=Hn49Ta8zV9Wo8GiCL8Nl2ARZY983Un3pruZGVNldPwE,1514 +setuptools/_vendor/packaging/_tokenizer.py,sha256=M8EwNIdXeL9NMFuFrQtiOKwjka_xFx8KjRQnfE8O_z8,5421 +setuptools/_vendor/packaging/licenses/__init__.py,sha256=TwXLHZCXwSgdFwRLPxW602T6mSieunSFHM6fp8pgW78,5819 +setuptools/_vendor/packaging/licenses/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/packaging/licenses/__pycache__/_spdx.cpython-312.pyc,, +setuptools/_vendor/packaging/licenses/_spdx.py,sha256=WW7DXiyg68up_YND_wpRYlr1SHhiV4FfJLQffghhMxQ,51122 +setuptools/_vendor/packaging/markers.py,sha256=ZX-cLvW1S3cZcEc0fHI4z7zSx5U2T19yMpDP_mE-CYw,12771 +setuptools/_vendor/packaging/metadata.py,sha256=CWVZpN_HfoYMSSDuCP7igOvGgqA9AOmpW8f3qTisfnc,39360 +setuptools/_vendor/packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/packaging/pylock.py,sha256=-R1uNfJ4PaLto7Mg62YsGOHgvskuiIEqPwxOywl42Jk,22537 +setuptools/_vendor/packaging/requirements.py,sha256=PMCAWD8aNMnVD-6uZMedhBuAVX2573eZ4yPBLXmz04I,2870 +setuptools/_vendor/packaging/specifiers.py,sha256=EPNPimY_zFivthv1vdjZYz5IqkKGsnKR2yKh-EVyvZw,40797 +setuptools/_vendor/packaging/tags.py,sha256=cXLV1pJD3UtJlDg7Wz3zrfdQhRZqr8jumSAKKAAd2xE,22856 +setuptools/_vendor/packaging/utils.py,sha256=N4c6oZzFJy6klTZ3AnkNz7sSkJesuFWPp68LA3B5dAo,5040 +setuptools/_vendor/packaging/version.py,sha256=7XWlL2IDYLwDYC0ht6cFEhapLwLWbmyo4rb7sEFj0x8,23272 +setuptools/_vendor/platformdirs-4.4.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +setuptools/_vendor/platformdirs-4.4.0.dist-info/METADATA,sha256=u8UhbV9Md7-8VyJyZNUuZrzN5xzPeedeGmBG0CnTAiM,12831 +setuptools/_vendor/platformdirs-4.4.0.dist-info/RECORD,sha256=PQ0vHMAYWTxNi6ojlbrwscHGRbvYwYzQZPSctOTJXqA,1218 +setuptools/_vendor/platformdirs-4.4.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/platformdirs-4.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87 +setuptools/_vendor/platformdirs-4.4.0.dist-info/licenses/LICENSE,sha256=KeD9YukphQ6G6yjD_czwzv30-pSHkBHP-z0NS-1tTbY,1089 +setuptools/_vendor/platformdirs/__init__.py,sha256=iORRy6_lZ9tXLvO0W6fJPn8QV7F532ivl-f2WGmabBc,22284 +setuptools/_vendor/platformdirs/__main__.py,sha256=HnsUQHpiBaiTxwcmwVw-nFaPdVNZtQIdi1eWDtI-MzI,1493 +setuptools/_vendor/platformdirs/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/platformdirs/__pycache__/__main__.cpython-312.pyc,, +setuptools/_vendor/platformdirs/__pycache__/android.cpython-312.pyc,, +setuptools/_vendor/platformdirs/__pycache__/api.cpython-312.pyc,, +setuptools/_vendor/platformdirs/__pycache__/macos.cpython-312.pyc,, +setuptools/_vendor/platformdirs/__pycache__/unix.cpython-312.pyc,, +setuptools/_vendor/platformdirs/__pycache__/version.cpython-312.pyc,, +setuptools/_vendor/platformdirs/__pycache__/windows.cpython-312.pyc,, +setuptools/_vendor/platformdirs/android.py,sha256=r0DshVBf-RO1jXJGX8C4Til7F1XWt-bkdWMgmvEiaYg,9013 +setuptools/_vendor/platformdirs/api.py,sha256=wPHOlwOsfz2oqQZ6A2FcCu5kEAj-JondzoNOHYFQ0h8,9281 +setuptools/_vendor/platformdirs/macos.py,sha256=0XoOgin1NK7Qki7iskD-oS8xKxw6bXgoKEgdqpCRAFQ,6322 +setuptools/_vendor/platformdirs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/platformdirs/unix.py,sha256=WZmkUA--L3JNRGmz32s35YfoD3ica6xKIPdCV_HhLcs,10458 +setuptools/_vendor/platformdirs/version.py,sha256=i31fi3nNO19D2FdSx8aldD7IFLSqm2YrAo6SmkV0FLM,704 +setuptools/_vendor/platformdirs/windows.py,sha256=IFpiohUBwxPtCzlyKwNtxyW4Jk8haa6W8o59mfrDXVo,10125 +setuptools/_vendor/tomli-2.4.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +setuptools/_vendor/tomli-2.4.0.dist-info/METADATA,sha256=9awKH4-6kItGRs1lUwnpGq2Wm2eHYWrFccpGKjgy_84,10567 +setuptools/_vendor/tomli-2.4.0.dist-info/RECORD,sha256=IlQwzpVkDo1Pzbk82uL8ONaFrsAW0OKT1fuZppWIb-0,822 +setuptools/_vendor/tomli-2.4.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/tomli-2.4.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82 +setuptools/_vendor/tomli-2.4.0.dist-info/licenses/LICENSE,sha256=uAgWsNUwuKzLTCIReDeQmEpuO2GSLCte6S8zcqsnQv4,1072 +setuptools/_vendor/tomli/__init__.py,sha256=ahtDjGJA2M_wWVvGpzx4YJtWxrWBx6qE-GH5-UYoECA,314 +setuptools/_vendor/tomli/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/tomli/__pycache__/_parser.cpython-312.pyc,, +setuptools/_vendor/tomli/__pycache__/_re.cpython-312.pyc,, +setuptools/_vendor/tomli/__pycache__/_types.cpython-312.pyc,, +setuptools/_vendor/tomli/_parser.py,sha256=txeATLE3zHyZ-ushXtYfrZ3LoIs7JzQF2W2KL1gwJPg,25958 +setuptools/_vendor/tomli/_re.py,sha256=oSNZ_ilFI6chEuQ01YRSoUydBQr_okF_mSdHTkFmv90,3396 +setuptools/_vendor/tomli/_types.py,sha256=-GTG2VUqkpxwMqzmVO4F7ybKddIbAnuAHXfmWQcTi3Q,254 +setuptools/_vendor/tomli/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26 +setuptools/_vendor/wheel-0.46.3.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +setuptools/_vendor/wheel-0.46.3.dist-info/METADATA,sha256=IpEKqXyonLzCCgGeJ_4xNgt5KaS9ZsoNMQ-ZpE9szTU,2410 +setuptools/_vendor/wheel-0.46.3.dist-info/RECORD,sha256=sCl8OtoXuHJ-Fd3W0eOMipCpl_d5_Pl4mW9v7GLstwI,1734 +setuptools/_vendor/wheel-0.46.3.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/wheel-0.46.3.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82 +setuptools/_vendor/wheel-0.46.3.dist-info/entry_points.txt,sha256=JJdtSAGTvMLbIkTVZUAMvGKO39FtWfCVF8mp_NH6e4g,110 +setuptools/_vendor/wheel-0.46.3.dist-info/licenses/LICENSE.txt,sha256=MMI2GGeRCPPo6h0qZYx8pBe9_IkcmO8aifpP8MmChlQ,1107 +setuptools/_vendor/wheel/__init__.py,sha256=UweKvhe4SyP7zFyDoYo8BOuwTA6q3-_WpMmY2NNO54c,59 +setuptools/_vendor/wheel/__main__.py,sha256=_83wl9tyGU2cHiqfudpubGHdRL5uonPXnzeznznkxzs,512 +setuptools/_vendor/wheel/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/wheel/__pycache__/__main__.cpython-312.pyc,, +setuptools/_vendor/wheel/__pycache__/_bdist_wheel.cpython-312.pyc,, +setuptools/_vendor/wheel/__pycache__/_metadata.cpython-312.pyc,, +setuptools/_vendor/wheel/__pycache__/_setuptools_logging.cpython-312.pyc,, +setuptools/_vendor/wheel/__pycache__/bdist_wheel.cpython-312.pyc,, +setuptools/_vendor/wheel/__pycache__/macosx_libfile.cpython-312.pyc,, +setuptools/_vendor/wheel/__pycache__/metadata.cpython-312.pyc,, +setuptools/_vendor/wheel/__pycache__/wheelfile.cpython-312.pyc,, +setuptools/_vendor/wheel/_bdist_wheel.py,sha256=bpmNa7_s-CYFkVgXf9ENAYTiJ01XBhRW4pxH1T8XYsI,21729 +setuptools/_vendor/wheel/_commands/__init__.py,sha256=fCRAQZNDyj2JLrufdgPsBlaRS_t_j_aBUMpXj09KZ4E,4432 +setuptools/_vendor/wheel/_commands/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/wheel/_commands/__pycache__/convert.cpython-312.pyc,, +setuptools/_vendor/wheel/_commands/__pycache__/pack.cpython-312.pyc,, +setuptools/_vendor/wheel/_commands/__pycache__/tags.cpython-312.pyc,, +setuptools/_vendor/wheel/_commands/__pycache__/unpack.cpython-312.pyc,, +setuptools/_vendor/wheel/_commands/convert.py,sha256=0wSJMU0m-6LY16Om8Wmmloy-hJWFZeOmI8hT-2Z7Qms,12743 +setuptools/_vendor/wheel/_commands/pack.py,sha256=o3iwjfRHl7N9ul-M2kHbewLJZnqBLAWf0tzUCwoiTMw,3078 +setuptools/_vendor/wheel/_commands/tags.py,sha256=Rv2ySVb8-qX3osKp3uJgxcIMXkjt43XUD0-zvC6KvnY,4775 +setuptools/_vendor/wheel/_commands/unpack.py,sha256=AjDSS23XYyCSFfifnMutinrpPv-DK_2wbNHkKAUFwgM,1016 +setuptools/_vendor/wheel/_metadata.py,sha256=BP5jC9uC1hyicp7nL4FJ2LYixNFpEJIV_uMDY1KBZBg,6188 +setuptools/_vendor/wheel/_setuptools_logging.py,sha256=-5KC-lne0ilOUWIDfOkqapUWGMFZhuKYDIavIZiB5kM,781 +setuptools/_vendor/wheel/bdist_wheel.py,sha256=HrzYiSzMkh5ohAAhlQnYBS1p8qbr85X6F59xqxd9kBg,1102 +setuptools/_vendor/wheel/macosx_libfile.py,sha256=pL0wm88jRMl_4ASgGlNg_mz69Zmv5xm8JSkjLdwyvIQ,16712 +setuptools/_vendor/wheel/metadata.py,sha256=GknOO7JJiZMlcEe_fiD7nqnDTTLd0sX_-IgipM4L3-4,757 +setuptools/_vendor/wheel/wheelfile.py,sha256=m_g_7TNsEp-j-xnvSr5yDLEFb1nhyObueq9Q5_1_lBA,8720 +setuptools/_vendor/zipp-3.23.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +setuptools/_vendor/zipp-3.23.0.dist-info/METADATA,sha256=vdZ9TRbPC_O4k-fRjNPS13StuC837Zhbx3cMYHIms1s,3563 +setuptools/_vendor/zipp-3.23.0.dist-info/RECORD,sha256=O_q2YKJHBPhCKOS7HOHw4_qf-A5cgGNSpiay9GDq2DY,1078 +setuptools/_vendor/zipp-3.23.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/zipp-3.23.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91 +setuptools/_vendor/zipp-3.23.0.dist-info/licenses/LICENSE,sha256=WlfLTbheKi3YjCkGKJCK3VfjRRRJ4KmnH9-zh3b9dZ0,1076 +setuptools/_vendor/zipp-3.23.0.dist-info/top_level.txt,sha256=iAbdoSHfaGqBfVb2XuR9JqSQHCoOsOtG6y9C_LSpqFw,5 +setuptools/_vendor/zipp/__init__.py,sha256=ieXh9GIMdABjKRX_JUJtP9k5wdBLK4Mt5X4nszSkmYE,11976 +setuptools/_vendor/zipp/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/zipp/__pycache__/_functools.cpython-312.pyc,, +setuptools/_vendor/zipp/__pycache__/glob.cpython-312.pyc,, +setuptools/_vendor/zipp/_functools.py,sha256=f6Kt9LxZ4TE-cY1lJVdXSId3memSXmH9IdgMbU-_x2k,575 +setuptools/_vendor/zipp/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/_vendor/zipp/compat/__pycache__/__init__.cpython-312.pyc,, +setuptools/_vendor/zipp/compat/__pycache__/overlay.cpython-312.pyc,, +setuptools/_vendor/zipp/compat/__pycache__/py310.cpython-312.pyc,, +setuptools/_vendor/zipp/compat/__pycache__/py313.cpython-312.pyc,, +setuptools/_vendor/zipp/compat/overlay.py,sha256=oEIGAnbr8yGjuKTrVSO2ByewPui71uppbX18BLnYTKE,783 +setuptools/_vendor/zipp/compat/py310.py,sha256=S7i6N9mToEn3asNb2ILyjnzvITOXrATD_J4emjyBbDU,256 +setuptools/_vendor/zipp/compat/py313.py,sha256=RndvDNtuY7H2D9ecnnzcPBMZ8mZc42gmXD_IwQAXXAE,654 +setuptools/_vendor/zipp/glob.py,sha256=DLV9LBsDxA6YVW82e3-tkoNrus1h4R-j3BR6VqS0AzE,3382 +setuptools/archive_util.py,sha256=Tl_64hSTtc4y8x7xa98rFVUbG24oArpjzLAYGYP2_sI,7356 +setuptools/build_meta.py,sha256=x3a7i1m4K6gGYC03yj20LRnEtvZpZjetXCJbpgNo6Cg,20234 +setuptools/cli-32.exe,sha256=MqzBvFQxFsviz_EMuGd3LfLyVP8mNMhwrvC0bEtpb9s,11776 +setuptools/cli-64.exe,sha256=u7PeVwdinmpgoMI4zUd7KPB_AGaYL9qVP6b87DkHOko,14336 +setuptools/cli-arm64.exe,sha256=uafQjaiA36yLz1SOuksG-1m28JsX0zFIoPZhgyiSbGE,13824 +setuptools/cli.exe,sha256=MqzBvFQxFsviz_EMuGd3LfLyVP8mNMhwrvC0bEtpb9s,11776 +setuptools/command/__init__.py,sha256=wdSrlNR0P6nCz9_oFtCAiAkeFJMsZa1jPcpXT53f0SM,803 +setuptools/command/__pycache__/__init__.cpython-312.pyc,, +setuptools/command/__pycache__/_requirestxt.cpython-312.pyc,, +setuptools/command/__pycache__/alias.cpython-312.pyc,, +setuptools/command/__pycache__/bdist_egg.cpython-312.pyc,, +setuptools/command/__pycache__/bdist_rpm.cpython-312.pyc,, +setuptools/command/__pycache__/bdist_wheel.cpython-312.pyc,, +setuptools/command/__pycache__/build.cpython-312.pyc,, +setuptools/command/__pycache__/build_clib.cpython-312.pyc,, +setuptools/command/__pycache__/build_ext.cpython-312.pyc,, +setuptools/command/__pycache__/build_py.cpython-312.pyc,, +setuptools/command/__pycache__/develop.cpython-312.pyc,, +setuptools/command/__pycache__/dist_info.cpython-312.pyc,, +setuptools/command/__pycache__/easy_install.cpython-312.pyc,, +setuptools/command/__pycache__/editable_wheel.cpython-312.pyc,, +setuptools/command/__pycache__/egg_info.cpython-312.pyc,, +setuptools/command/__pycache__/install.cpython-312.pyc,, +setuptools/command/__pycache__/install_egg_info.cpython-312.pyc,, +setuptools/command/__pycache__/install_lib.cpython-312.pyc,, +setuptools/command/__pycache__/install_scripts.cpython-312.pyc,, +setuptools/command/__pycache__/rotate.cpython-312.pyc,, +setuptools/command/__pycache__/saveopts.cpython-312.pyc,, +setuptools/command/__pycache__/sdist.cpython-312.pyc,, +setuptools/command/__pycache__/setopt.cpython-312.pyc,, +setuptools/command/__pycache__/test.cpython-312.pyc,, +setuptools/command/_requirestxt.py,sha256=ItYMTJGh_i5TlQstX_nFopqEhkC4PJFadBL2Zd3V670,4228 +setuptools/command/alias.py,sha256=vVxEYVEFMTZznxuXLg-62Y07VV2U-rfhVqmqhTc62Cg,2366 +setuptools/command/bdist_egg.py,sha256=1kWCzqsiDUGw-HiHu6aGcH16Cf7TjV8oe86ILNLLHTM,16832 +setuptools/command/bdist_rpm.py,sha256=LyqI49w48SKk0FmuHsE9MLzX1SuXjL7YMNbZMFZqFII,1435 +setuptools/command/bdist_wheel.py,sha256=2TMl21f7WWeH3m0NhJLVZPVOSWE0w-wZcG2pFseP8Qw,22210 +setuptools/command/build.py,sha256=eI7STMERGGZEpzk1tvJN8p9IOjAAXMcGLzljv2mwI3M,6052 +setuptools/command/build_clib.py,sha256=AbgpPIF_3qL8fZr3JIebI-WHTMTBiMfrFkVQz8K40G4,4528 +setuptools/command/build_ext.py,sha256=SaurTvvtJuOSOD8cm_6Wj1T0DFiyl5Nazv4GYINAgWA,18270 +setuptools/command/build_py.py,sha256=eHhfo9z7Qf79vSzrCnq-oEXayQC0R_nx3hWaTgWGv5M,15826 +setuptools/command/develop.py,sha256=TYKWIzfv3c3wjAYhH5UD8tW6S6ozZi_fpF6IJILm8Kg,1751 +setuptools/command/dist_info.py,sha256=HU752iLLmmYMHbsDBgz2ubRjkgJobugOp8H71LzzDys,3450 +setuptools/command/easy_install.py,sha256=XrN5cV51mfzbCDoapZ6iT8nCzaLpumdwJYRKeMHEjCQ,780 +setuptools/command/editable_wheel.py,sha256=xJOPl_0s5DbwpeLw-SNh75mvEnmwE7OFpnpChlOaNgg,34862 +setuptools/command/egg_info.py,sha256=_yZYJz5CrLh0aYeT2GXBp6bjF0a0QgYvoDR3uBdKJZc,25754 +setuptools/command/install.py,sha256=4x2hiNgBGQrFEXKuPBQMrb8ecSwIfYF4TYHZQLjPVAg,5066 +setuptools/command/install_egg_info.py,sha256=gYOkfDM-G0agy2aMCE8HzreIi4LzUy6acZ6Ka-rKahQ,2020 +setuptools/command/install_lib.py,sha256=9n1_U83eHcERL_a_rv_LhHCkhXlLdqyZ4SdBow-9qcE,4319 +setuptools/command/install_scripts.py,sha256=ZYfF_-viovV5HSLsRzBlNQv5pHv2H0t2ZnL5qzZ4xfM,2445 +setuptools/command/launcher manifest.xml,sha256=xlLbjWrB01tKC0-hlVkOKkiSPbzMml2eOPtJ_ucCnbE,628 +setuptools/command/rotate.py,sha256=PywuJoufmiO_5JykOg-oatrYsBnZfA0pG1HJy7Bsb9Q,2134 +setuptools/command/saveopts.py,sha256=k9hiQ_wOKweXWgBWV548PISmFKfYJkV2XHhi92ejz5o,678 +setuptools/command/sdist.py,sha256=nS2xogcTfQZwbZH1AQ5WYh13KCvNda9xwUT57sVxTec,7426 +setuptools/command/setopt.py,sha256=MCM9SM92LwGUC-E2nnvQxX8Yf2ukMj1YAa6KCRlqt_8,5047 +setuptools/command/test.py,sha256=x9z3DDCQi-_3-TRf8yNeQ9QH-G6yR1au7kX0ijedKqU,1400 +setuptools/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/compat/__pycache__/__init__.cpython-312.pyc,, +setuptools/compat/__pycache__/py310.cpython-312.pyc,, +setuptools/compat/__pycache__/py311.cpython-312.pyc,, +setuptools/compat/__pycache__/py312.cpython-312.pyc,, +setuptools/compat/__pycache__/py39.cpython-312.pyc,, +setuptools/compat/py310.py,sha256=JwjQZ3cNTizfpDLNl9GLsUGzBr-tVlMPxmMYVDTlhiI,344 +setuptools/compat/py311.py,sha256=e6tJAFwZEP82hmMBl10HYeSypelo_Ti2wTjKZVKLwOE,790 +setuptools/compat/py312.py,sha256=vYKVtdrdOTsO_R90dJkEXsFwfMJFuIFJflhIgHrjJ-Y,366 +setuptools/compat/py39.py,sha256=BJMtnkfcqyTfccqjYQxfoRtU2nTnWaEESBVkshTiXqY,493 +setuptools/config/NOTICE,sha256=Ld3wiBgpejuJ1D2V_2WdjahXQRCMkTbfo6TYVsBiO9g,493 +setuptools/config/__init__.py,sha256=aiPnL9BJn1O6MfmuNXyn8W2Lp8u9qizRVqwPiOdPIjY,1499 +setuptools/config/__pycache__/__init__.cpython-312.pyc,, +setuptools/config/__pycache__/_apply_pyprojecttoml.cpython-312.pyc,, +setuptools/config/__pycache__/expand.cpython-312.pyc,, +setuptools/config/__pycache__/pyprojecttoml.cpython-312.pyc,, +setuptools/config/__pycache__/setupcfg.cpython-312.pyc,, +setuptools/config/_apply_pyprojecttoml.py,sha256=tQXU9M4lcrd3iwO_2reihz22IbHaHg_Z-lAMBXZRzW8,19120 +setuptools/config/_validate_pyproject/NOTICE,sha256=XTANv6ZDE4sBO3WsnK7uWR-VG4sO4kKIw0zNkmxHgMg,18737 +setuptools/config/_validate_pyproject/__init__.py,sha256=dnp6T7ePP1R5z4OuC7Fd2dkFlIrtIfizUfvpGJP6nz0,1042 +setuptools/config/_validate_pyproject/__pycache__/__init__.cpython-312.pyc,, +setuptools/config/_validate_pyproject/__pycache__/error_reporting.cpython-312.pyc,, +setuptools/config/_validate_pyproject/__pycache__/extra_validations.cpython-312.pyc,, +setuptools/config/_validate_pyproject/__pycache__/fastjsonschema_exceptions.cpython-312.pyc,, +setuptools/config/_validate_pyproject/__pycache__/fastjsonschema_validations.cpython-312.pyc,, +setuptools/config/_validate_pyproject/__pycache__/formats.cpython-312.pyc,, +setuptools/config/_validate_pyproject/error_reporting.py,sha256=meldD7nBQdolQhvG-43r1Ue-gU1n7ORAJR86vh3Rrvk,11813 +setuptools/config/_validate_pyproject/extra_validations.py,sha256=-GUG5S--ijY8WfXbdXPoHl6ywGsyEF9dtDpenSoJPHg,2858 +setuptools/config/_validate_pyproject/fastjsonschema_exceptions.py,sha256=w749JgqKi8clBFcObdcbZVqsmF4oJ_QByhZ1SGbUFNw,1612 +setuptools/config/_validate_pyproject/fastjsonschema_validations.py,sha256=FihD5ZcM6p77BPZ04CGqh3BEwVNoPMKJZJAyuJpkAU0,354682 +setuptools/config/_validate_pyproject/formats.py,sha256=TETokJBK9hjl-cVg1olsojkJwLxfP7_chgJQNmzAB98,13564 +setuptools/config/distutils.schema.json,sha256=Tcp32kRnhwORGw_9p6GEi08lj2h15tQRzOYBbzGmcBU,972 +setuptools/config/expand.py,sha256=STKJ6oNAo6avEBVUiR25WpfIthVPVZQG65Z-5-t78QI,16064 +setuptools/config/pyprojecttoml.py,sha256=YMu5PdbJJI5azp6kR_boM1mflf5nqOA-InF4s6LnLgw,18320 +setuptools/config/setupcfg.py,sha256=Wnfbrk6D0GQV-Z2AE0b0KnL-WGrw-KQUcsem3naImBw,26695 +setuptools/config/setuptools.schema.json,sha256=dZBRuSEnZkatoVlt1kVwG8ocTeRdO7BD0xvOWKH54PY,16071 +setuptools/depends.py,sha256=jKYfjmt_2ZQYVghb8L9bU7LJ6erHJ5ze-K_fKV1BMXk,5965 +setuptools/discovery.py,sha256=XYIeFN20WEsEtssmpzCFlnda-Qxilj8KlLYKaJphAto,21286 +setuptools/dist.py,sha256=aa181F7kGdfeL6To3X2ZvQ8zSiQCSacWRJdhL0v49xk,45184 +setuptools/errors.py,sha256=gY2x2PIaIgy01yRANRC-zcCwxDCqCScgJoCOZFe0yio,3024 +setuptools/extension.py,sha256=GbCxJ9rRk2rZcXS4qgmnzWNG36HlhLfUEvNwB-OKGk8,6818 +setuptools/glob.py,sha256=AC_B33DY8g-CHELxDsJrtwFrpiucSAZsakPFdSOQzhc,6062 +setuptools/gui-32.exe,sha256=hdrh6V13hF8stZvKw9Sv50u-TJGpvMW_SnHNQxBNvnw,11776 +setuptools/gui-64.exe,sha256=NHG2FA6txkEid9u-_j_vjDRaDxpZd2CGuAo2GMOoPjs,14336 +setuptools/gui-arm64.exe,sha256=5pT0dDQFyLWSb_RX22_n8aEt7HwWqcOGR4TT9OB64Jc,13824 +setuptools/gui.exe,sha256=hdrh6V13hF8stZvKw9Sv50u-TJGpvMW_SnHNQxBNvnw,11776 +setuptools/installer.py,sha256=Wy_hG1g1r-45E6IWh7lvQ0Pk0QHNl6JJbu3hQmr1_Ek,5184 +setuptools/launch.py,sha256=IBb5lEv69CyuZ9ewIrmKlXh154kdLmP29LKfTMkximE,820 +setuptools/logging.py,sha256=W16iHJ1HcCXYQ0RxyrEfJ83FT4175tCtoYg-E6uSpVI,1261 +setuptools/modified.py,sha256=ZwbfBfCFP88ltvbv_dJDz-t1LsQjnM-JUpgZnnQZjjM,568 +setuptools/monkey.py,sha256=nOD5vgLG7IpKAs7LrnpJxGPaCW54Rzj-onJmm91otoY,3733 +setuptools/msvc.py,sha256=IdCsRhdJLeyZG3gyDrGx2DqZymoay3ndBXC77taHHCA,42909 +setuptools/namespaces.py,sha256=eE1hI5X86TNWvY5u5BC1WiGiOrrJyGOv0pp9vycCmK0,3045 +setuptools/script (dev).tmpl,sha256=RUzQzCQUaXtwdLtYHWYbIQmOaES5Brqq1FvUA_tu-5I,218 +setuptools/script.tmpl,sha256=WGTt5piezO27c-Dbx6l5Q4T3Ff20A5z7872hv3aAhYY,138 +setuptools/tests/__init__.py,sha256=AnBfls2iJbTDQzmMKeLRt-9lxhaOHUVOZEgXv89Uwvs,335 +setuptools/tests/__pycache__/__init__.cpython-312.pyc,, +setuptools/tests/__pycache__/contexts.cpython-312.pyc,, +setuptools/tests/__pycache__/environment.cpython-312.pyc,, +setuptools/tests/__pycache__/fixtures.cpython-312.pyc,, +setuptools/tests/__pycache__/mod_with_constant.cpython-312.pyc,, +setuptools/tests/__pycache__/namespaces.cpython-312.pyc,, +setuptools/tests/__pycache__/script-with-bom.cpython-312.pyc,, +setuptools/tests/__pycache__/test_archive_util.cpython-312.pyc,, +setuptools/tests/__pycache__/test_bdist_deprecations.cpython-312.pyc,, +setuptools/tests/__pycache__/test_bdist_egg.cpython-312.pyc,, +setuptools/tests/__pycache__/test_bdist_wheel.cpython-312.pyc,, +setuptools/tests/__pycache__/test_build.cpython-312.pyc,, +setuptools/tests/__pycache__/test_build_clib.cpython-312.pyc,, +setuptools/tests/__pycache__/test_build_ext.cpython-312.pyc,, +setuptools/tests/__pycache__/test_build_meta.cpython-312.pyc,, +setuptools/tests/__pycache__/test_build_py.cpython-312.pyc,, +setuptools/tests/__pycache__/test_config_discovery.cpython-312.pyc,, +setuptools/tests/__pycache__/test_core_metadata.cpython-312.pyc,, +setuptools/tests/__pycache__/test_depends.cpython-312.pyc,, +setuptools/tests/__pycache__/test_develop.cpython-312.pyc,, +setuptools/tests/__pycache__/test_dist.cpython-312.pyc,, +setuptools/tests/__pycache__/test_dist_info.cpython-312.pyc,, +setuptools/tests/__pycache__/test_distutils_adoption.cpython-312.pyc,, +setuptools/tests/__pycache__/test_editable_install.cpython-312.pyc,, +setuptools/tests/__pycache__/test_egg_info.cpython-312.pyc,, +setuptools/tests/__pycache__/test_extern.cpython-312.pyc,, +setuptools/tests/__pycache__/test_find_packages.cpython-312.pyc,, +setuptools/tests/__pycache__/test_find_py_modules.cpython-312.pyc,, +setuptools/tests/__pycache__/test_glob.cpython-312.pyc,, +setuptools/tests/__pycache__/test_install_scripts.cpython-312.pyc,, +setuptools/tests/__pycache__/test_logging.cpython-312.pyc,, +setuptools/tests/__pycache__/test_manifest.cpython-312.pyc,, +setuptools/tests/__pycache__/test_namespaces.cpython-312.pyc,, +setuptools/tests/__pycache__/test_scripts.cpython-312.pyc,, +setuptools/tests/__pycache__/test_sdist.cpython-312.pyc,, +setuptools/tests/__pycache__/test_setopt.cpython-312.pyc,, +setuptools/tests/__pycache__/test_setuptools.cpython-312.pyc,, +setuptools/tests/__pycache__/test_shutil_wrapper.cpython-312.pyc,, +setuptools/tests/__pycache__/test_unicode_utils.cpython-312.pyc,, +setuptools/tests/__pycache__/test_virtualenv.cpython-312.pyc,, +setuptools/tests/__pycache__/test_warnings.cpython-312.pyc,, +setuptools/tests/__pycache__/test_wheel.cpython-312.pyc,, +setuptools/tests/__pycache__/test_windows_wrappers.cpython-312.pyc,, +setuptools/tests/__pycache__/text.cpython-312.pyc,, +setuptools/tests/__pycache__/textwrap.cpython-312.pyc,, +setuptools/tests/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/tests/compat/__pycache__/__init__.cpython-312.pyc,, +setuptools/tests/compat/__pycache__/py39.cpython-312.pyc,, +setuptools/tests/compat/py39.py,sha256=eUy7_F-6KRTOIKl-veshUu6I0EdTSdBZMh0EV0lZ1-g,135 +setuptools/tests/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/tests/config/__pycache__/__init__.cpython-312.pyc,, +setuptools/tests/config/__pycache__/test_apply_pyprojecttoml.cpython-312.pyc,, +setuptools/tests/config/__pycache__/test_expand.cpython-312.pyc,, +setuptools/tests/config/__pycache__/test_pyprojecttoml.cpython-312.pyc,, +setuptools/tests/config/__pycache__/test_pyprojecttoml_dynamic_deps.cpython-312.pyc,, +setuptools/tests/config/__pycache__/test_setupcfg.cpython-312.pyc,, +setuptools/tests/config/downloads/__init__.py,sha256=9ixnDEdyL_arKbUzfuiJftAj9bGxKz8M9alOFZMjx9Y,1827 +setuptools/tests/config/downloads/__pycache__/__init__.cpython-312.pyc,, +setuptools/tests/config/downloads/__pycache__/preload.cpython-312.pyc,, +setuptools/tests/config/downloads/preload.py,sha256=sIGGZpY3cmMpMwiJYYYYHG2ifZJkvJgEotRFtiulV1I,450 +setuptools/tests/config/setupcfg_examples.txt,sha256=cAbVvCbkFZuTUL6xRRzRgqyB0rLvJTfvw3D30glo2OE,1912 +setuptools/tests/config/test_apply_pyprojecttoml.py,sha256=KVBqnElEW5p9HJpTYnztZqd3RXYaY6SrSY8ek9ysq7s,28822 +setuptools/tests/config/test_expand.py,sha256=S0oT6JvgA_oujR4YS4RUuf5gmOt1CTQV66RQDzV8xd4,8933 +setuptools/tests/config/test_pyprojecttoml.py,sha256=CzLH1qcKDQGxCyLHC_ZYMObms1D_Jtp6AuJROOFI_D8,12438 +setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py,sha256=1MRtzcxZag-ElRwVGt0kUk4KPRA-RSwKkibO8-Vy51w,3265 +setuptools/tests/config/test_setupcfg.py,sha256=iwViCQFLGVWZLgCDrBv8HKBBCj-Onr8aNdioD9_lBEo,33712 +setuptools/tests/contexts.py,sha256=Ozdfc2KydF9x9wODUsdun800myLuP27uxoeT06Gbk7M,3166 +setuptools/tests/environment.py,sha256=95_UtTaRiuvwYC9eXKEHbn02kDtZysvZq3UZJmPUj1I,3102 +setuptools/tests/fixtures.py,sha256=jE7pIFQt91dZIUc6Btsffi8OdBqmY_7DNeWI1Stv7i8,12224 +setuptools/tests/indexes/test_links_priority/external.html,sha256=eL9euOuE93JKZdqlXxBOlHbKwIuNuIdq7GBRpsaPMcU,92 +setuptools/tests/indexes/test_links_priority/simple/foobar/index.html,sha256=DD-TKr7UU4zAjHHz4VexYDNSAzR27levSh1c-k3ZdLE,174 +setuptools/tests/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +setuptools/tests/integration/__pycache__/__init__.cpython-312.pyc,, +setuptools/tests/integration/__pycache__/helpers.cpython-312.pyc,, +setuptools/tests/integration/__pycache__/test_pbr.cpython-312.pyc,, +setuptools/tests/integration/__pycache__/test_pip_install_sdist.cpython-312.pyc,, +setuptools/tests/integration/helpers.py,sha256=ieQtGuIohqNI_RHMH0yxE602Uz4E8wysUj7XaXYH30Y,2688 +setuptools/tests/integration/test_pbr.py,sha256=2eKuklFNmpnBgA_eEhYPBr6rLLG2Xm4MY6PlcmzZgGU,432 +setuptools/tests/integration/test_pip_install_sdist.py,sha256=SFbvuYF_hDzt6OtsQ5GjFNnxmoJ_eElfvpYsiyyGJ-g,8256 +setuptools/tests/mod_with_constant.py,sha256=X_Kj80M55w1tmQ4f7uZY91ZTALo4hKVT6EHxgYocUMQ,22 +setuptools/tests/namespaces.py,sha256=HPcI3nR5MCFWXpaADIJ1fwKxymcQgBkuw87Ic5PUSAQ,2774 +setuptools/tests/script-with-bom.py,sha256=hRRgIizEULGiG_ZTNoMY46HhKhxpWfy5FGcD6Qbh5fc,18 +setuptools/tests/test_archive_util.py,sha256=buuKdY8XkW26Pe3IKAoBRGHG0MDumnuNoPg2WsAQzIg,845 +setuptools/tests/test_bdist_deprecations.py,sha256=75Xq3gYn79LIIyusEltbHan0bEgAt2e_CaL7KLS8-KQ,775 +setuptools/tests/test_bdist_egg.py,sha256=6PaYN1F3JDbIh1uK0urv7yJFcx98z5dn9SOJ8Mv91l8,1957 +setuptools/tests/test_bdist_wheel.py,sha256=xGHVaggiYobkOuGwkLK2bNejcSh8z2Fiuq-ge_S-yKo,23091 +setuptools/tests/test_build.py,sha256=wJgMz2hwHADcLFg-nXrwRVhus7hjmAeEGgrpIQwCGnA,798 +setuptools/tests/test_build_clib.py,sha256=bX51XRAf4uO7IuHFpjePnoK8mE74N2gsoeEqF-ofgws,3123 +setuptools/tests/test_build_ext.py,sha256=e4ZSxsYPB5zq1KSqGEuATZ0t0PJQzMhjjkKJ-hIjcgc,10099 +setuptools/tests/test_build_meta.py,sha256=ToI7-2LUnHuIPhKN8EkDkSEfLCvLqLI6VJhqwR5pVuU,33320 +setuptools/tests/test_build_py.py,sha256=SIcHFX3YNErcVkWjf0eDRuKmsO9kTymKjfK-PkOi9M0,14201 +setuptools/tests/test_config_discovery.py,sha256=FqV-lOtkqaI-ayzU2zocSdD5TaRAgCZnixNDilKA6FQ,22580 +setuptools/tests/test_core_metadata.py,sha256=p8mW920afKVdL8sC_Fce8zpmfWDCRylBa3dd39Y-qWo,18038 +setuptools/tests/test_depends.py,sha256=yQBXoQbNQlJit6mbRVoz6Bb553f3sNrq02lZimNz5XY,424 +setuptools/tests/test_develop.py,sha256=k-agNgB8DIGR8zlaYMBILu8KOPrL2plorNCexxzNm-s,3136 +setuptools/tests/test_dist.py,sha256=M4FikA-vL0_lZdA_5wry2Z9CBuSugr0Pj54dBZ3peBM,8951 +setuptools/tests/test_dist_info.py,sha256=EihdrU9UZkPV7d19G-K_OtOByp64GvGnf4or-f8Iq54,5005 +setuptools/tests/test_distutils_adoption.py,sha256=_eynrOfyEqXFEmjUJhzpe8GXPyTUPvNSObs4qAAmBy8,5987 +setuptools/tests/test_editable_install.py,sha256=o4DkoytkiL-_rzES8p1q8XYRa9-ha_m6uhrm-EWzdwI,42498 +setuptools/tests/test_egg_info.py,sha256=R7nT27YhVz9oSuDyimAGerWglkbRWiMSPBs5FzcSnBM,44941 +setuptools/tests/test_extern.py,sha256=rpKU6oCcksumLwf5TeKlDluFQ0TUfbPwTLQbpxcFrCU,296 +setuptools/tests/test_find_packages.py,sha256=CTLAcTzWGWBLCcd2aAsUVkvO3ibrlqexFBdDKOWPoq8,7819 +setuptools/tests/test_find_py_modules.py,sha256=zQjuhIG5TQN2SJPix9ARo4DL_w84Ln8QsHDUjjbrtAQ,2404 +setuptools/tests/test_glob.py,sha256=P3JvpH-kXQ4BZ3zvRF-zKxOgwyWzwIaQIz0WHdxS0kk,887 +setuptools/tests/test_install_scripts.py,sha256=scIrJ6a_ssKqg4vIBNaUjmAKHEYLUUZ9WKnPeKnE6gc,3433 +setuptools/tests/test_logging.py,sha256=czGLLdGxUBZKXbea3A0HnSW9lf-3K_CUwaI0gDkVbOM,2096 +setuptools/tests/test_manifest.py,sha256=eMg65pIA52DizB6mpktSU-b8CjwaNCS5MSgL_V1LrFI,18562 +setuptools/tests/test_namespaces.py,sha256=e84seD5g6KIPVSDpawE9Ihc25Je7shooybV1flUsW20,2508 +setuptools/tests/test_scripts.py,sha256=_ra506yQF7n72ROUDcz2r3CTsGsawO1m-1oqA9EQCfw,379 +setuptools/tests/test_sdist.py,sha256=oKMgvBrkfTsPH5jqsrhFxRMbtUDoOy4vKfwll3kGCg0,32808 +setuptools/tests/test_setopt.py,sha256=3VxxM4ATfP-P4AGnDjoWCnHr5-i9CSEQTFYU1-FTnvI,1365 +setuptools/tests/test_setuptools.py,sha256=_eIhqKf45-OtHqxRf20KndOZJlJdS0PuFLXBO3M-LN8,9008 +setuptools/tests/test_shutil_wrapper.py,sha256=g15E11PtZxG-InB2BWNFyH-svObXx2XcMhgMLJPuFnc,641 +setuptools/tests/test_unicode_utils.py,sha256=xWfEEl8jkQCt9othUTXJfFmdyATAFggJs2tTxjbumbw,316 +setuptools/tests/test_virtualenv.py,sha256=g-njC_9JTAs1YVx_1dGJ_Q6RlInO4qKVu9-XAgNb6TY,3730 +setuptools/tests/test_warnings.py,sha256=zwR2zcnCeCeDqILZlJOPAcuyPHoDvGu1OtOVYiLMk74,3347 +setuptools/tests/test_wheel.py,sha256=iMfVTNixu4puf6xvRYjQDw4Zg_OHVCQjSy7SztvVYqE,18722 +setuptools/tests/test_windows_wrappers.py,sha256=wBjXN3iGldkzRGTgKTrx99xqUqwPJ0V-ldyiB1pWD-g,7868 +setuptools/tests/text.py,sha256=a12197pMVTvB6FAWQ0ujT8fIQiLIWJlFAl1UCaDUDfg,123 +setuptools/tests/textwrap.py,sha256=FNNNq_MiaEJx88PnsbJQIRxmj1qmgcAOCXXRsODPJN4,98 +setuptools/unicode_utils.py,sha256=ukMGh8pEAw6F_Ezb-K5D3c-078RgA_GcF0oW6lg4lSs,3189 +setuptools/version.py,sha256=WJCeUuyq74Aok2TeK9-OexZOu8XrlQy7-y0BEuWNovQ,161 +setuptools/warnings.py,sha256=oY0Se5eOqje_FEyjTgonUc0XGwgsrI5cgm1kkwulz_w,3796 +setuptools/wheel.py,sha256=iI-LSDrgHMlJIzQMALVlJRq3Qesgbj7xa6hWZYJyZl4,9532 +setuptools/windows_support.py,sha256=wW4IYLM1Bv7Z1MaauP2xmPjyy-wkmQnXdyvXscAf9fw,726 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..1ef5583317a5e59140e3f1c85c2db91aec0961e8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (82.0.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..0db0a6c8f1b8d9c0ad4a25db6892e29f8988fcf2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/entry_points.txt @@ -0,0 +1,51 @@ +[distutils.commands] +alias = setuptools.command.alias:alias +bdist_egg = setuptools.command.bdist_egg:bdist_egg +bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm +bdist_wheel = setuptools.command.bdist_wheel:bdist_wheel +build = setuptools.command.build:build +build_clib = setuptools.command.build_clib:build_clib +build_ext = setuptools.command.build_ext:build_ext +build_py = setuptools.command.build_py:build_py +develop = setuptools.command.develop:develop +dist_info = setuptools.command.dist_info:dist_info +easy_install = setuptools.command.easy_install:easy_install +editable_wheel = setuptools.command.editable_wheel:editable_wheel +egg_info = setuptools.command.egg_info:egg_info +install = setuptools.command.install:install +install_egg_info = setuptools.command.install_egg_info:install_egg_info +install_lib = setuptools.command.install_lib:install_lib +install_scripts = setuptools.command.install_scripts:install_scripts +rotate = setuptools.command.rotate:rotate +saveopts = setuptools.command.saveopts:saveopts +sdist = setuptools.command.sdist:sdist +setopt = setuptools.command.setopt:setopt + +[distutils.setup_keywords] +dependency_links = setuptools.dist:assert_string_list +eager_resources = setuptools.dist:assert_string_list +entry_points = setuptools.dist:check_entry_points +exclude_package_data = setuptools.dist:check_package_data +extras_require = setuptools.dist:check_extras +include_package_data = setuptools.dist:assert_bool +install_requires = setuptools.dist:check_requirements +namespace_packages = setuptools.dist:check_nsp +package_data = setuptools.dist:check_package_data +packages = setuptools.dist:check_packages +python_requires = setuptools.dist:check_specifier +setup_requires = setuptools.dist:check_requirements +use_2to3 = setuptools.dist:invalid_unless_false +zip_safe = setuptools.dist:assert_bool + +[egg_info.writers] +PKG-INFO = setuptools.command.egg_info:write_pkg_info +dependency_links.txt = setuptools.command.egg_info:overwrite_arg +eager_resources.txt = setuptools.command.egg_info:overwrite_arg +entry_points.txt = setuptools.command.egg_info:write_entries +namespace_packages.txt = setuptools.command.egg_info:overwrite_arg +requires.txt = setuptools.command.egg_info:write_requirements +top_level.txt = setuptools.command.egg_info:write_toplevel_names + +[setuptools.finalize_distribution_options] +keywords = setuptools.dist:Distribution._finalize_setup_keywords +parent_finalize = setuptools.dist:_Distribution.finalize_options diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..11b11fe8dd21d5b4fcb4539230460a42747fa896 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools-82.0.0.dist-info/top_level.txt @@ -0,0 +1,2 @@ +_distutils_hack +setuptools diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..87ca47bbc9fd4d1e5083d4dedb7a6c86f43c73fc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/__init__.py @@ -0,0 +1,256 @@ +"""Extensions to the 'distutils' for large or complex distributions""" +# mypy: disable_error_code=override +# Command.reinitialize_command has an extra **kw param that distutils doesn't have +# Can't disable on the exact line because distutils doesn't exists on Python 3.12 +# and mypy isn't aware of distutils_hack, causing distutils.core.Command to be Any, +# and a [unused-ignore] to be raised on 3.12+ + +from __future__ import annotations + +import functools +import os +import sys +from abc import abstractmethod +from collections.abc import Mapping +from typing import TYPE_CHECKING, TypeVar, overload + +sys.path.extend(((vendor_path := os.path.join(os.path.dirname(os.path.dirname(__file__)), 'setuptools', '_vendor')) not in sys.path) * [vendor_path]) # fmt: skip +# workaround for #4476 +sys.modules.pop('backports', None) + +import _distutils_hack.override # noqa: F401 + +from . import logging, monkey +from .depends import Require +from .discovery import PackageFinder, PEP420PackageFinder +from .dist import Distribution +from .extension import Extension +from .version import __version__ as __version__ +from .warnings import SetuptoolsDeprecationWarning + +import distutils.core + +__all__ = [ + 'setup', + 'Distribution', + 'Command', + 'Extension', + 'Require', + 'SetuptoolsDeprecationWarning', + 'find_packages', + 'find_namespace_packages', +] + +_CommandT = TypeVar("_CommandT", bound="_Command") + +bootstrap_install_from = None + +find_packages = PackageFinder.find +find_namespace_packages = PEP420PackageFinder.find + + +def _install_setup_requires(attrs): + # Note: do not use `setuptools.Distribution` directly, as + # our PEP 517 backend patch `distutils.core.Distribution`. + class MinimalDistribution(distutils.core.Distribution): + """ + A minimal version of a distribution for supporting the + fetch_build_eggs interface. + """ + + def __init__(self, attrs: Mapping[str, object]) -> None: + _incl = 'dependency_links', 'setup_requires' + filtered = {k: attrs[k] for k in set(_incl) & set(attrs)} + super().__init__(filtered) + # Prevent accidentally triggering discovery with incomplete set of attrs + self.set_defaults._disable() + + def _get_project_config_files(self, filenames=None): + """Ignore ``pyproject.toml``, they are not related to setup_requires""" + try: + cfg, _toml = super()._split_standard_project_metadata(filenames) + except Exception: + return filenames, () + return cfg, () + + def finalize_options(self): + """ + Disable finalize_options to avoid building the working set. + Ref #2158. + """ + + dist = MinimalDistribution(attrs) + + # Honor setup.cfg's options. + dist.parse_config_files(ignore_option_errors=True) + if dist.setup_requires: + _fetch_build_eggs(dist) + + +def _fetch_build_eggs(dist: Distribution): + try: + dist.fetch_build_eggs(dist.setup_requires) + except Exception as ex: + msg = """ + It is possible a package already installed in your system + contains an version that is invalid according to PEP 440. + You can try `pip install --use-pep517` as a workaround for this problem, + or rely on a new virtual environment. + + If the problem refers to a package that is not installed yet, + please contact that package's maintainers or distributors. + """ + if "InvalidVersion" in ex.__class__.__name__: + if hasattr(ex, "add_note"): + ex.add_note(msg) # PEP 678 + else: + dist.announce(f"\n{msg}\n") + raise + + +def setup(**attrs) -> Distribution: + logging.configure() + # Make sure we have any requirements needed to interpret 'attrs'. + _install_setup_requires(attrs) + # Override return type of distutils.core.Distribution with setuptools.dist.Distribution + # (implicitly implemented via `setuptools.monkey.patch_all`). + return distutils.core.setup(**attrs) # type: ignore[return-value] + + +setup.__doc__ = distutils.core.setup.__doc__ + +if TYPE_CHECKING: + # Work around a mypy issue where type[T] can't be used as a base: https://github.com/python/mypy/issues/10962 + from distutils.core import Command as _Command +else: + _Command = monkey.get_unpatched(distutils.core.Command) + + +class Command(_Command): + """ + Setuptools internal actions are organized using a *command design pattern*. + This means that each action (or group of closely related actions) executed during + the build should be implemented as a ``Command`` subclass. + + These commands are abstractions and do not necessarily correspond to a command that + can (or should) be executed via a terminal, in a CLI fashion (although historically + they would). + + When creating a new command from scratch, custom defined classes **SHOULD** inherit + from ``setuptools.Command`` and implement a few mandatory methods. + Between these mandatory methods, are listed: + :meth:`initialize_options`, :meth:`finalize_options` and :meth:`run`. + + A useful analogy for command classes is to think of them as subroutines with local + variables called "options". The options are "declared" in :meth:`initialize_options` + and "defined" (given their final values, aka "finalized") in :meth:`finalize_options`, + both of which must be defined by every command class. The "body" of the subroutine, + (where it does all the work) is the :meth:`run` method. + Between :meth:`initialize_options` and :meth:`finalize_options`, ``setuptools`` may set + the values for options/attributes based on user's input (or circumstance), + which means that the implementation should be careful to not overwrite values in + :meth:`finalize_options` unless necessary. + + Please note that other commands (or other parts of setuptools) may also overwrite + the values of the command's options/attributes multiple times during the build + process. + Therefore it is important to consistently implement :meth:`initialize_options` and + :meth:`finalize_options`. For example, all derived attributes (or attributes that + depend on the value of other attributes) **SHOULD** be recomputed in + :meth:`finalize_options`. + + When overwriting existing commands, custom defined classes **MUST** abide by the + same APIs implemented by the original class. They also **SHOULD** inherit from the + original class. + """ + + command_consumes_arguments = False + distribution: Distribution # override distutils.dist.Distribution with setuptools.dist.Distribution + + dry_run = False # type: ignore[assignment] # pyright: ignore[reportAssignmentType] (until #4689; see #4872) + """ + For compatibility with vendored bdist_wheel. + https://github.com/pypa/setuptools/pull/4872/files#r1986395142 + """ + + def __init__(self, dist: Distribution, **kw) -> None: + """ + Construct the command for dist, updating + vars(self) with any keyword parameters. + """ + super().__init__(dist) + vars(self).update(kw) + + @overload + def reinitialize_command( + self, command: str, reinit_subcommands: bool = False, **kw + ) -> Command: ... # override distutils.cmd.Command with setuptools.Command + @overload + def reinitialize_command( + self, command: _CommandT, reinit_subcommands: bool = False, **kw + ) -> _CommandT: ... + def reinitialize_command( + self, command: str | _Command, reinit_subcommands: bool = False, **kw + ) -> Command | _Command: + cmd = _Command.reinitialize_command(self, command, reinit_subcommands) + vars(cmd).update(kw) + return cmd # pyright: ignore[reportReturnType] # pypa/distutils#307 + + @abstractmethod + def initialize_options(self) -> None: + """ + Set or (reset) all options/attributes/caches used by the command + to their default values. Note that these values may be overwritten during + the build. + """ + raise NotImplementedError + + @abstractmethod + def finalize_options(self) -> None: + """ + Set final values for all options/attributes used by the command. + Most of the time, each option/attribute/cache should only be set if it does not + have any value yet (e.g. ``if self.attr is None: self.attr = val``). + """ + raise NotImplementedError + + @abstractmethod + def run(self) -> None: + """ + Execute the actions intended by the command. + (Side effects **SHOULD** only take place when :meth:`run` is executed, + for example, creating new files or writing to the terminal output). + """ + raise NotImplementedError + + +def _find_all_simple(path): + """ + Find all files under 'path' + """ + results = ( + os.path.join(base, file) + for base, dirs, files in os.walk(path, followlinks=True) + for file in files + ) + return filter(os.path.isfile, results) + + +def findall(dir=os.curdir): + """ + Find all files under 'dir' and return the list of full filenames. + Unless dir is '.', return full filenames with dir prepended. + """ + files = _find_all_simple(dir) + if dir == os.curdir: + make_rel = functools.partial(os.path.relpath, start=dir) + files = map(make_rel, files) + return list(files) + + +class sic(str): + """Treat this string as-is (https://en.wikipedia.org/wiki/Sic)""" + + +# Apply monkey patches +monkey.patch_all() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_core_metadata.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_core_metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..a52d5cf755cdd6a502e752c2f7a3afa3b25897d5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_core_metadata.py @@ -0,0 +1,337 @@ +""" +Handling of Core Metadata for Python packages (including reading and writing). + +See: https://packaging.python.org/en/latest/specifications/core-metadata/ +""" + +from __future__ import annotations + +import os +import stat +import textwrap +from email import message_from_file +from email.message import Message +from tempfile import NamedTemporaryFile + +from packaging.markers import Marker +from packaging.requirements import Requirement +from packaging.utils import canonicalize_name, canonicalize_version +from packaging.version import Version + +from . import _normalization, _reqs +from ._static import is_static +from .warnings import SetuptoolsDeprecationWarning + +from distutils.util import rfc822_escape + + +def get_metadata_version(self): + mv = getattr(self, 'metadata_version', None) + if mv is None: + mv = Version('2.4') + self.metadata_version = mv + return mv + + +def rfc822_unescape(content: str) -> str: + """Reverse RFC-822 escaping by removing leading whitespaces from content.""" + lines = content.splitlines() + if len(lines) == 1: + return lines[0].lstrip() + return '\n'.join((lines[0].lstrip(), textwrap.dedent('\n'.join(lines[1:])))) + + +def _read_field_from_msg(msg: Message, field: str) -> str | None: + """Read Message header field.""" + value = msg[field] + if value == 'UNKNOWN': + return None + return value + + +def _read_field_unescaped_from_msg(msg: Message, field: str) -> str | None: + """Read Message header field and apply rfc822_unescape.""" + value = _read_field_from_msg(msg, field) + if value is None: + return value + return rfc822_unescape(value) + + +def _read_list_from_msg(msg: Message, field: str) -> list[str] | None: + """Read Message header field and return all results as list.""" + values = msg.get_all(field, None) + if values == []: + return None + return values + + +def _read_payload_from_msg(msg: Message) -> str | None: + value = str(msg.get_payload()).strip() + if value == 'UNKNOWN' or not value: + return None + return value + + +def read_pkg_file(self, file): + """Reads the metadata values from a file object.""" + msg = message_from_file(file) + + self.metadata_version = Version(msg['metadata-version']) + self.name = _read_field_from_msg(msg, 'name') + self.version = _read_field_from_msg(msg, 'version') + self.description = _read_field_from_msg(msg, 'summary') + # we are filling author only. + self.author = _read_field_from_msg(msg, 'author') + self.maintainer = None + self.author_email = _read_field_from_msg(msg, 'author-email') + self.maintainer_email = None + self.url = _read_field_from_msg(msg, 'home-page') + self.download_url = _read_field_from_msg(msg, 'download-url') + self.license = _read_field_unescaped_from_msg(msg, 'license') + self.license_expression = _read_field_unescaped_from_msg(msg, 'license-expression') + + self.long_description = _read_field_unescaped_from_msg(msg, 'description') + if self.long_description is None and self.metadata_version >= Version('2.1'): + self.long_description = _read_payload_from_msg(msg) + self.description = _read_field_from_msg(msg, 'summary') + + if 'keywords' in msg: + self.keywords = _read_field_from_msg(msg, 'keywords').split(',') + + self.platforms = _read_list_from_msg(msg, 'platform') + self.classifiers = _read_list_from_msg(msg, 'classifier') + + # PEP 314 - these fields only exist in 1.1 + if self.metadata_version == Version('1.1'): + self.requires = _read_list_from_msg(msg, 'requires') + self.provides = _read_list_from_msg(msg, 'provides') + self.obsoletes = _read_list_from_msg(msg, 'obsoletes') + else: + self.requires = None + self.provides = None + self.obsoletes = None + + self.license_files = _read_list_from_msg(msg, 'license-file') + + +def single_line(val): + """ + Quick and dirty validation for Summary pypa/setuptools#1390. + """ + if '\n' in val: + # TODO: Replace with `raise ValueError("newlines not allowed")` + # after reviewing #2893. + msg = "newlines are not allowed in `summary` and will break in the future" + SetuptoolsDeprecationWarning.emit("Invalid config.", msg) + # due_date is undefined. Controversial change, there was a lot of push back. + val = val.strip().split('\n')[0] + return val + + +def write_pkg_info(self, base_dir): + """Write the PKG-INFO file into the release tree.""" + temp = "" + final = os.path.join(base_dir, 'PKG-INFO') + try: + # Use a temporary file while writing to avoid race conditions + # (e.g. `importlib.metadata` reading `.egg-info/PKG-INFO`): + with NamedTemporaryFile("w", encoding="utf-8", dir=base_dir, delete=False) as f: + temp = f.name + self.write_pkg_file(f) + permissions = stat.S_IMODE(os.lstat(temp).st_mode) + os.chmod(temp, permissions | stat.S_IRGRP | stat.S_IROTH) + os.replace(temp, final) # atomic operation. + finally: + if temp and os.path.exists(temp): + os.remove(temp) + + +# Based on Python 3.5 version +def write_pkg_file(self, file): # noqa: C901 # is too complex (14) # FIXME + """Write the PKG-INFO format data to a file object.""" + version = self.get_metadata_version() + + def write_field(key, value): + file.write(f"{key}: {value}\n") + + write_field('Metadata-Version', str(version)) + write_field('Name', self.get_name()) + write_field('Version', self.get_version()) + + summary = self.get_description() + if summary: + write_field('Summary', single_line(summary)) + + optional_fields = ( + ('Home-page', 'url'), + ('Download-URL', 'download_url'), + ('Author', 'author'), + ('Author-email', 'author_email'), + ('Maintainer', 'maintainer'), + ('Maintainer-email', 'maintainer_email'), + ) + + for field, attr in optional_fields: + attr_val = getattr(self, attr, None) + if attr_val is not None: + write_field(field, attr_val) + + if license_expression := self.license_expression: + write_field('License-Expression', license_expression) + elif license := self.get_license(): + write_field('License', rfc822_escape(license)) + + for label, url in self.project_urls.items(): + write_field('Project-URL', f'{label}, {url}') + + keywords = ','.join(self.get_keywords()) + if keywords: + write_field('Keywords', keywords) + + platforms = self.get_platforms() or [] + for platform in platforms: + write_field('Platform', platform) + + self._write_list(file, 'Classifier', self.get_classifiers()) + + # PEP 314 + self._write_list(file, 'Requires', self.get_requires()) + self._write_list(file, 'Provides', self.get_provides()) + self._write_list(file, 'Obsoletes', self.get_obsoletes()) + + # Setuptools specific for PEP 345 + if hasattr(self, 'python_requires'): + write_field('Requires-Python', self.python_requires) + + # PEP 566 + if self.long_description_content_type: + write_field('Description-Content-Type', self.long_description_content_type) + + safe_license_files = map(_safe_license_file, self.license_files or []) + self._write_list(file, 'License-File', safe_license_files) + _write_requirements(self, file) + + for field, attr in _POSSIBLE_DYNAMIC_FIELDS.items(): + if (val := getattr(self, attr, None)) and not is_static(val): + write_field('Dynamic', field) + + long_description = self.get_long_description() + if long_description: + file.write(f"\n{long_description}") + if not long_description.endswith("\n"): + file.write("\n") + + +def _write_requirements(self, file): + for req in _reqs.parse(self.install_requires): + file.write(f"Requires-Dist: {req}\n") + + processed_extras = {} + for augmented_extra, reqs in self.extras_require.items(): + # Historically, setuptools allows "augmented extras": `:` + unsafe_extra, _, condition = augmented_extra.partition(":") + unsafe_extra = unsafe_extra.strip() + extra = _normalization.safe_extra(unsafe_extra) + + if extra: + _write_provides_extra(file, processed_extras, extra, unsafe_extra) + for req in _reqs.parse_strings(reqs): + r = _include_extra(req, extra, condition.strip()) + file.write(f"Requires-Dist: {r}\n") + + return processed_extras + + +def _include_extra(req: str, extra: str, condition: str) -> Requirement: + r = Requirement(req) # create a fresh object that can be modified + parts = ( + f"({r.marker})" if r.marker else None, + f"({condition})" if condition else None, + f"extra == {extra!r}" if extra else None, + ) + r.marker = Marker(" and ".join(x for x in parts if x)) + return r + + +def _write_provides_extra(file, processed_extras, safe, unsafe): + previous = processed_extras.get(safe) + if previous == unsafe: + SetuptoolsDeprecationWarning.emit( + 'Ambiguity during "extra" normalization for dependencies.', + f""" + {previous!r} and {unsafe!r} normalize to the same value:\n + {safe!r}\n + In future versions, setuptools might halt the build process. + """, + see_url="https://peps.python.org/pep-0685/", + ) + else: + processed_extras[safe] = unsafe + file.write(f"Provides-Extra: {safe}\n") + + +# from pypa/distutils#244; needed only until that logic is always available +def get_fullname(self): + return _distribution_fullname(self.get_name(), self.get_version()) + + +def _distribution_fullname(name: str, version: str) -> str: + """ + >>> _distribution_fullname('setup.tools', '1.0-2') + 'setup_tools-1.0.post2' + >>> _distribution_fullname('setup-tools', '1.2post2') + 'setup_tools-1.2.post2' + >>> _distribution_fullname('setup-tools', '1.0-r2') + 'setup_tools-1.0.post2' + >>> _distribution_fullname('setup.tools', '1.0.post') + 'setup_tools-1.0.post0' + >>> _distribution_fullname('setup.tools', '1.0+ubuntu-1') + 'setup_tools-1.0+ubuntu.1' + """ + return "{}-{}".format( + canonicalize_name(name).replace('-', '_'), + canonicalize_version(version, strip_trailing_zero=False), + ) + + +def _safe_license_file(file): + # XXX: Do we need this after the deprecation discussed in #4892, #4896?? + normalized = os.path.normpath(file).replace(os.sep, "/") + if "../" in normalized: + return os.path.basename(normalized) # Temporarily restore pre PEP639 behaviour + return normalized + + +_POSSIBLE_DYNAMIC_FIELDS = { + # Core Metadata Field x related Distribution attribute + "author": "author", + "author-email": "author_email", + "classifier": "classifiers", + "description": "long_description", + "description-content-type": "long_description_content_type", + "download-url": "download_url", + "home-page": "url", + "keywords": "keywords", + "license": "license", + # XXX: License-File is complicated because the user gives globs that are expanded + # during the build. Without special handling it is likely always + # marked as Dynamic, which is an acceptable outcome according to: + # https://github.com/pypa/setuptools/issues/4629#issuecomment-2331233677 + "license-file": "license_files", + "license-expression": "license_expression", # PEP 639 + "maintainer": "maintainer", + "maintainer-email": "maintainer_email", + "obsoletes": "obsoletes", + # "obsoletes-dist": "obsoletes_dist", # NOT USED + "platform": "platforms", + "project-url": "project_urls", + "provides": "provides", + # "provides-dist": "provides_dist", # NOT USED + "provides-extra": "extras_require", + "requires": "requires", + "requires-dist": "install_requires", + # "requires-external": "requires_external", # NOT USED + "requires-python": "python_requires", + "summary": "description", + # "supported-platform": "supported_platforms", # NOT USED +} diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_discovery.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_discovery.py new file mode 100644 index 0000000000000000000000000000000000000000..d1b4a0ee0351d69de5f0ab7d65bbe6958e398916 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_discovery.py @@ -0,0 +1,33 @@ +import functools +import operator + +import packaging.requirements + + +# from coherent.build.discovery +def extras_from_dep(dep): + try: + markers = packaging.requirements.Requirement(dep).marker._markers + except AttributeError: + markers = () + return set( + marker[2].value + for marker in markers + if isinstance(marker, tuple) and marker[0].value == 'extra' + ) + + +def extras_from_deps(deps): + """ + >>> extras_from_deps(['requests']) + set() + >>> extras_from_deps(['pytest; extra == "test"']) + {'test'} + >>> sorted(extras_from_deps([ + ... 'requests', + ... 'pytest; extra == "test"', + ... 'pytest-cov; extra == "test"', + ... 'sphinx; extra=="doc"'])) + ['doc', 'test'] + """ + return functools.reduce(operator.or_, map(extras_from_dep, deps), set()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_entry_points.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_entry_points.py new file mode 100644 index 0000000000000000000000000000000000000000..cd5dd2c8ac99783a2edb617278627ba170a9872b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_entry_points.py @@ -0,0 +1,94 @@ +import functools +import itertools +import operator + +from jaraco.functools import pass_none +from jaraco.text import yield_lines +from more_itertools import consume + +from ._importlib import metadata +from ._itertools import ensure_unique +from .errors import OptionError + + +def ensure_valid(ep): + """ + Exercise one of the dynamic properties to trigger + the pattern match. + + This function is deprecated in favor of importlib_metadata 8.7 and + Python 3.14 importlib.metadata, which validates entry points on + construction. + """ + try: + ep.extras + except (AttributeError, AssertionError) as ex: + # Why both? See https://github.com/python/importlib_metadata/issues/488 + msg = ( + f"Problems to parse {ep}.\nPlease ensure entry-point follows the spec: " + "https://packaging.python.org/en/latest/specifications/entry-points/" + ) + raise OptionError(msg) from ex + + +def load_group(value, group): + """ + Given a value of an entry point or series of entry points, + return each as an EntryPoint. + """ + # normalize to a single sequence of lines + lines = yield_lines(value) + text = f'[{group}]\n' + '\n'.join(lines) + return metadata.EntryPoints._from_text(text) + + +def by_group_and_name(ep): + return ep.group, ep.name + + +def validate(eps: metadata.EntryPoints): + """ + Ensure entry points are unique by group and name and validate each. + """ + consume(map(ensure_valid, ensure_unique(eps, key=by_group_and_name))) + return eps + + +@functools.singledispatch +def load(eps): + """ + Given a Distribution.entry_points, produce EntryPoints. + """ + groups = itertools.chain.from_iterable( + load_group(value, group) for group, value in eps.items() + ) + return validate(metadata.EntryPoints(groups)) + + +@load.register(str) +def _(eps): + r""" + >>> ep, = load('[console_scripts]\nfoo=bar') + >>> ep.group + 'console_scripts' + >>> ep.name + 'foo' + >>> ep.value + 'bar' + """ + return validate(metadata.EntryPoints(metadata.EntryPoints._from_text(eps))) + + +load.register(type(None), lambda x: x) + + +@pass_none +def render(eps: metadata.EntryPoints): + by_group = operator.attrgetter('group') + groups = itertools.groupby(sorted(eps, key=by_group), by_group) + + return '\n'.join(f'[{group}]\n{render_items(items)}\n' for group, items in groups) + + +def render_items(eps): + return '\n'.join(f'{ep.name} = {ep.value}' for ep in sorted(eps)) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_imp.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_imp.py new file mode 100644 index 0000000000000000000000000000000000000000..f1d9f29218987d4f830f2d57aca9e3f74d00a095 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_imp.py @@ -0,0 +1,87 @@ +""" +Re-implementation of find_module and get_frozen_object +from the deprecated imp module. +""" + +import importlib.machinery +import importlib.util +import os +import tokenize +from importlib.util import module_from_spec + +PY_SOURCE = 1 +PY_COMPILED = 2 +C_EXTENSION = 3 +C_BUILTIN = 6 +PY_FROZEN = 7 + + +def find_spec(module, paths): + finder = ( + importlib.machinery.PathFinder().find_spec + if isinstance(paths, list) + else importlib.util.find_spec + ) + return finder(module, paths) + + +def find_module(module, paths=None): + """Just like 'imp.find_module()', but with package support""" + spec = find_spec(module, paths) + if spec is None: + raise ImportError(f"Can't find {module}") + if not spec.has_location and hasattr(spec, 'submodule_search_locations'): + spec = importlib.util.spec_from_loader('__init__.py', spec.loader) + + kind = -1 + file = None + static = isinstance(spec.loader, type) + if ( + spec.origin == 'frozen' + or static + and issubclass(spec.loader, importlib.machinery.FrozenImporter) + ): + kind = PY_FROZEN + path = None # imp compabilty + suffix = mode = '' # imp compatibility + elif ( + spec.origin == 'built-in' + or static + and issubclass(spec.loader, importlib.machinery.BuiltinImporter) + ): + kind = C_BUILTIN + path = None # imp compabilty + suffix = mode = '' # imp compatibility + elif spec.has_location: + path = spec.origin + suffix = os.path.splitext(path)[1] + mode = 'r' if suffix in importlib.machinery.SOURCE_SUFFIXES else 'rb' + + if suffix in importlib.machinery.SOURCE_SUFFIXES: + kind = PY_SOURCE + file = tokenize.open(path) + elif suffix in importlib.machinery.BYTECODE_SUFFIXES: + kind = PY_COMPILED + file = open(path, 'rb') + elif suffix in importlib.machinery.EXTENSION_SUFFIXES: + kind = C_EXTENSION + + else: + path = None + suffix = mode = '' + + return file, path, (suffix, mode, kind) + + +def get_frozen_object(module, paths=None): + spec = find_spec(module, paths) + if not spec: + raise ImportError(f"Can't find {module}") + return spec.loader.get_code(module) + + +def get_module(module, paths, info): + spec = find_spec(module, paths) + if not spec: + raise ImportError(f"Can't find {module}") + return module_from_spec(spec) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_importlib.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_importlib.py new file mode 100644 index 0000000000000000000000000000000000000000..ce0fd52653b56c9c2cb2b2c7bfb35e3ec3c61408 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_importlib.py @@ -0,0 +1,9 @@ +import sys + +if sys.version_info < (3, 10): + import importlib_metadata as metadata # pragma: no cover +else: + import importlib.metadata as metadata # noqa: F401 + + +import importlib.resources as resources # noqa: F401 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_itertools.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_itertools.py new file mode 100644 index 0000000000000000000000000000000000000000..d6ca841353ce39ac4361013f5c8160d69028d0d8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_itertools.py @@ -0,0 +1,23 @@ +from more_itertools import consume # noqa: F401 + + +# copied from jaraco.itertools 6.1 +def ensure_unique(iterable, key=lambda x: x): + """ + Wrap an iterable to raise a ValueError if non-unique values are encountered. + + >>> list(ensure_unique('abc')) + ['a', 'b', 'c'] + >>> consume(ensure_unique('abca')) + Traceback (most recent call last): + ... + ValueError: Duplicate element 'a' encountered. + """ + seen = set() + seen_add = seen.add + for element in iterable: + k = key(element) + if k in seen: + raise ValueError(f"Duplicate element {element!r} encountered.") + seen_add(k) + yield element diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_normalization.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..6b8d4ddbf900d648e30d61d96d9b9993c7c57663 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_normalization.py @@ -0,0 +1,180 @@ +""" +Helpers for normalization as expected in wheel/sdist/module file names +and core metadata +""" + +import re +from typing import TYPE_CHECKING + +import packaging + +# https://packaging.python.org/en/latest/specifications/core-metadata/#name +_VALID_NAME = re.compile(r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", re.IGNORECASE) +_UNSAFE_NAME_CHARS = re.compile(r"[^A-Z0-9._-]+", re.IGNORECASE) +_NON_ALPHANUMERIC = re.compile(r"[^A-Z0-9]+", re.IGNORECASE) +_PEP440_FALLBACK = re.compile( + r"^v?(?P(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.IGNORECASE +) + + +def safe_identifier(name: str) -> str: + """Make a string safe to be used as Python identifier. + >>> safe_identifier("12abc") + '_12abc' + >>> safe_identifier("__editable__.myns.pkg-78.9.3_local") + '__editable___myns_pkg_78_9_3_local' + """ + safe = re.sub(r'\W|^(?=\d)', '_', name) + assert safe.isidentifier() + return safe + + +def safe_name(component: str) -> str: + """Escape a component used as a project name according to Core Metadata. + >>> safe_name("hello world") + 'hello-world' + >>> safe_name("hello?world") + 'hello-world' + >>> safe_name("hello_world") + 'hello_world' + """ + return _UNSAFE_NAME_CHARS.sub("-", component) + + +def safe_version(version: str) -> str: + """Convert an arbitrary string into a valid version string. + Can still raise an ``InvalidVersion`` exception. + To avoid exceptions use ``best_effort_version``. + >>> safe_version("1988 12 25") + '1988.12.25' + >>> safe_version("v0.2.1") + '0.2.1' + >>> safe_version("v0.2?beta") + '0.2b0' + >>> safe_version("v0.2 beta") + '0.2b0' + >>> safe_version("ubuntu lts") + Traceback (most recent call last): + ... + packaging.version.InvalidVersion: Invalid version: 'ubuntu.lts' + """ + v = version.replace(' ', '.') + try: + return str(packaging.version.Version(v)) + except packaging.version.InvalidVersion: + attempt = _UNSAFE_NAME_CHARS.sub("-", v) + return str(packaging.version.Version(attempt)) + + +def best_effort_version(version: str) -> str: + """Convert an arbitrary string into a version-like string. + Fallback when ``safe_version`` is not safe enough. + >>> best_effort_version("v0.2 beta") + '0.2b0' + >>> best_effort_version("ubuntu lts") + '0.dev0+sanitized.ubuntu.lts' + >>> best_effort_version("0.23ubuntu1") + '0.23.dev0+sanitized.ubuntu1' + >>> best_effort_version("0.23-") + '0.23.dev0+sanitized' + >>> best_effort_version("0.-_") + '0.dev0+sanitized' + >>> best_effort_version("42.+?1") + '42.dev0+sanitized.1' + """ + try: + return safe_version(version) + except packaging.version.InvalidVersion: + v = version.replace(' ', '.') + match = _PEP440_FALLBACK.search(v) + if match: + safe = match["safe"] + rest = v[len(safe) :] + else: + safe = "0" + rest = version + safe_rest = _NON_ALPHANUMERIC.sub(".", rest).strip(".") + local = f"sanitized.{safe_rest}".strip(".") + return safe_version(f"{safe}.dev0+{local}") + + +def safe_extra(extra: str) -> str: + """Normalize extra name according to PEP 685 + >>> safe_extra("_FrIeNdLy-._.-bArD") + 'friendly-bard' + >>> safe_extra("FrIeNdLy-._.-bArD__._-") + 'friendly-bard' + """ + return _NON_ALPHANUMERIC.sub("-", extra).strip("-").lower() + + +def filename_component(value: str) -> str: + """Normalize each component of a filename (e.g. distribution/version part of wheel) + Note: ``value`` needs to be already normalized. + >>> filename_component("my-pkg") + 'my_pkg' + """ + return value.replace("-", "_").strip("_") + + +def filename_component_broken(value: str) -> str: + """ + Produce the incorrect filename component for compatibility. + + See pypa/setuptools#4167 for detailed analysis. + + TODO: replace this with filename_component after pip 24 is + nearly-ubiquitous. + + >>> filename_component_broken('foo_bar-baz') + 'foo-bar-baz' + """ + return value.replace('_', '-') + + +def safer_name(value: str) -> str: + """Like ``safe_name`` but can be used as filename component for wheel""" + # See bdist_wheel.safer_name + return ( + # Per https://packaging.python.org/en/latest/specifications/name-normalization/#name-normalization + re + .sub(r"[-_.]+", "-", safe_name(value)) + .lower() + # Per https://packaging.python.org/en/latest/specifications/binary-distribution-format/#escaping-and-unicode + .replace("-", "_") + ) + + +def safer_best_effort_version(value: str) -> str: + """Like ``best_effort_version`` but can be used as filename component for wheel""" + # See bdist_wheel.safer_verion + # TODO: Replace with only safe_version in the future (no need for best effort) + return filename_component(best_effort_version(value)) + + +def _missing_canonicalize_license_expression(expression: str) -> str: + """ + Defer import error to affect only users that actually use it + https://github.com/pypa/setuptools/issues/4894 + >>> _missing_canonicalize_license_expression("a OR b") + Traceback (most recent call last): + ... + ImportError: ...Cannot import `packaging.licenses`... + """ + raise ImportError( + "Cannot import `packaging.licenses`." + """ + Setuptools>=77.0.0 requires "packaging>=24.2" to work properly. + Please make sure you have a suitable version installed. + """ + ) + + +try: + from packaging.licenses import ( + canonicalize_license_expression as _canonicalize_license_expression, + ) +except ImportError: # pragma: nocover + if not TYPE_CHECKING: + # XXX: pyright is still upset even with # pyright: ignore[reportAssignmentType] + _canonicalize_license_expression = _missing_canonicalize_license_expression diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_path.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_path.py new file mode 100644 index 0000000000000000000000000000000000000000..2b78022934d89599e642a10f861b382947031be9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_path.py @@ -0,0 +1,93 @@ +from __future__ import annotations + +import contextlib +import os +import sys +from typing import TYPE_CHECKING, TypeVar, Union + +from more_itertools import unique_everseen + +if TYPE_CHECKING: + from typing_extensions import TypeAlias + +StrPath: TypeAlias = Union[str, os.PathLike[str]] # Same as _typeshed.StrPath +StrPathT = TypeVar("StrPathT", bound=Union[str, os.PathLike[str]]) + + +def ensure_directory(path): + """Ensure that the parent directory of `path` exists""" + dirname = os.path.dirname(path) + os.makedirs(dirname, exist_ok=True) + + +def same_path(p1: StrPath, p2: StrPath) -> bool: + """Differs from os.path.samefile because it does not require paths to exist. + Purely string based (no comparison between i-nodes). + >>> same_path("a/b", "./a/b") + True + >>> same_path("a/b", "a/./b") + True + >>> same_path("a/b", "././a/b") + True + >>> same_path("a/b", "./a/b/c/..") + True + >>> same_path("a/b", "../a/b/c") + False + >>> same_path("a", "a/b") + False + """ + return normpath(p1) == normpath(p2) + + +def _cygwin_patch(filename: StrPath): # pragma: nocover + """ + Contrary to POSIX 2008, on Cygwin, getcwd (3) contains + symlink components. Using + os.path.abspath() works around this limitation. A fix in os.getcwd() + would probably better, in Cygwin even more so, except + that this seems to be by design... + """ + return os.path.abspath(filename) if sys.platform == 'cygwin' else filename + + +def normpath(filename: StrPath) -> str: + """Normalize a file/dir name for comparison purposes.""" + return os.path.normcase(os.path.realpath(os.path.normpath(_cygwin_patch(filename)))) + + +@contextlib.contextmanager +def paths_on_pythonpath(paths): + """ + Add the indicated paths to the head of the PYTHONPATH environment + variable so that subprocesses will also see the packages at + these paths. + + Do this in a context that restores the value on exit. + + >>> getfixture('monkeypatch').setenv('PYTHONPATH', 'anything') + >>> with paths_on_pythonpath(['foo', 'bar']): + ... assert 'foo' in os.environ['PYTHONPATH'] + ... assert 'anything' in os.environ['PYTHONPATH'] + >>> os.environ['PYTHONPATH'] + 'anything' + + >>> getfixture('monkeypatch').delenv('PYTHONPATH') + >>> with paths_on_pythonpath(['foo', 'bar']): + ... assert 'foo' in os.environ['PYTHONPATH'] + >>> os.environ.get('PYTHONPATH') + """ + nothing = object() + orig_pythonpath = os.environ.get('PYTHONPATH', nothing) + current_pythonpath = os.environ.get('PYTHONPATH', '') + try: + prefix = os.pathsep.join(unique_everseen(paths)) + to_join = filter(None, [prefix, current_pythonpath]) + new_path = os.pathsep.join(to_join) + if new_path: + os.environ['PYTHONPATH'] = new_path + yield + finally: + if orig_pythonpath is nothing: + os.environ.pop('PYTHONPATH', None) + else: + os.environ['PYTHONPATH'] = orig_pythonpath diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_reqs.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_reqs.py new file mode 100644 index 0000000000000000000000000000000000000000..7be56cbf35d4a7cbeacdca1c18599433d7fb2f7f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_reqs.py @@ -0,0 +1,42 @@ +from __future__ import annotations + +from collections.abc import Iterable, Iterator +from functools import lru_cache +from typing import TYPE_CHECKING, Callable, TypeVar, Union, overload + +import jaraco.text as text +from packaging.requirements import Requirement + +if TYPE_CHECKING: + from typing_extensions import TypeAlias + +_T = TypeVar("_T") +_StrOrIter: TypeAlias = Union[str, Iterable[str]] + + +parse_req: Callable[[str], Requirement] = lru_cache()(Requirement) +# Setuptools parses the same requirement many times +# (e.g. first for validation than for normalisation), +# so it might be worth to cache. + + +def parse_strings(strs: _StrOrIter) -> Iterator[str]: + """ + Yield requirement strings for each specification in `strs`. + + `strs` must be a string, or a (possibly-nested) iterable thereof. + """ + return text.join_continuation(map(text.drop_comment, text.yield_lines(strs))) + + +# These overloads are only needed because of a mypy false-positive, pyright gets it right +# https://github.com/python/mypy/issues/3737 +@overload +def parse(strs: _StrOrIter) -> Iterator[Requirement]: ... +@overload +def parse(strs: _StrOrIter, parser: Callable[[str], _T]) -> Iterator[_T]: ... +def parse(strs: _StrOrIter, parser: Callable[[str], _T] = parse_req) -> Iterator[_T]: # type: ignore[assignment] + """ + Parse requirements. + """ + return map(parser, parse_strings(strs)) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_scripts.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_scripts.py new file mode 100644 index 0000000000000000000000000000000000000000..88bf02f927ba7cb47731fc0984f4b4f135fbdd45 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_scripts.py @@ -0,0 +1,361 @@ +from __future__ import annotations + +import os +import re +import shlex +import shutil +import struct +import subprocess +import sys +import textwrap +from collections.abc import Iterable +from typing import TYPE_CHECKING, TypedDict + +from ._importlib import metadata, resources + +if TYPE_CHECKING: + from typing_extensions import Self + +from .warnings import SetuptoolsWarning + +from distutils.command.build_scripts import first_line_re +from distutils.util import get_platform + + +class _SplitArgs(TypedDict, total=False): + comments: bool + posix: bool + + +class CommandSpec(list): + """ + A command spec for a #! header, specified as a list of arguments akin to + those passed to Popen. + """ + + options: list[str] = [] + split_args = _SplitArgs() + + @classmethod + def best(cls): + """ + Choose the best CommandSpec class based on environmental conditions. + """ + return cls + + @classmethod + def _sys_executable(cls): + _default = os.path.normpath(sys.executable) + return os.environ.get('__PYVENV_LAUNCHER__', _default) + + @classmethod + def from_param(cls, param: Self | str | Iterable[str] | None) -> Self: + """ + Construct a CommandSpec from a parameter to build_scripts, which may + be None. + """ + if isinstance(param, cls): + return param + if isinstance(param, str): + return cls.from_string(param) + if isinstance(param, Iterable): + return cls(param) + if param is None: + return cls.from_environment() + raise TypeError(f"Argument has an unsupported type {type(param)}") + + @classmethod + def from_environment(cls): + return cls([cls._sys_executable()]) + + @classmethod + def from_string(cls, string: str) -> Self: + """ + Construct a command spec from a simple string representing a command + line parseable by shlex.split. + """ + items = shlex.split(string, **cls.split_args) + return cls(items) + + def install_options(self, script_text: str): + self.options = shlex.split(self._extract_options(script_text)) + cmdline = subprocess.list2cmdline(self) + if not isascii(cmdline): + self.options[:0] = ['-x'] + + @staticmethod + def _extract_options(orig_script): + """ + Extract any options from the first line of the script. + """ + first = (orig_script + '\n').splitlines()[0] + match = _first_line_re().match(first) + options = match.group(1) or '' if match else '' + return options.strip() + + def as_header(self): + return self._render(self + list(self.options)) + + @staticmethod + def _strip_quotes(item): + _QUOTES = '"\'' + for q in _QUOTES: + if item.startswith(q) and item.endswith(q): + return item[1:-1] + return item + + @staticmethod + def _render(items): + cmdline = subprocess.list2cmdline( + CommandSpec._strip_quotes(item.strip()) for item in items + ) + return '#!' + cmdline + '\n' + + +class WindowsCommandSpec(CommandSpec): + split_args = _SplitArgs(posix=False) + + +class ScriptWriter: + """ + Encapsulates behavior around writing entry point scripts for console and + gui apps. + """ + + template = textwrap.dedent( + r""" + # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r + import re + import sys + + # for compatibility with easy_install; see #2198 + __requires__ = %(spec)r + + try: + from importlib.metadata import distribution + except ImportError: + try: + from importlib_metadata import distribution + except ImportError: + from pkg_resources import load_entry_point + + + def importlib_load_entry_point(spec, group, name): + dist_name, _, _ = spec.partition('==') + matches = ( + entry_point + for entry_point in distribution(dist_name).entry_points + if entry_point.group == group and entry_point.name == name + ) + return next(matches).load() + + + globals().setdefault('load_entry_point', importlib_load_entry_point) + + + if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) + sys.exit(load_entry_point(%(spec)r, %(group)r, %(name)r)()) + """ + ).lstrip() + + command_spec_class = CommandSpec + + @classmethod + def get_args(cls, dist, header=None): + """ + Yield write_script() argument tuples for a distribution's + console_scripts and gui_scripts entry points. + """ + + # If distribution is not an importlib.metadata.Distribution, assume + # it's a pkg_resources.Distribution and transform it. + if not hasattr(dist, 'entry_points'): + SetuptoolsWarning.emit("Unsupported distribution encountered.") + dist = metadata.Distribution.at(dist.egg_info) + + if header is None: + header = cls.get_header() + spec = f'{dist.name}=={dist.version}' + for type_ in 'console', 'gui': + group = f'{type_}_scripts' + for ep in dist.entry_points.select(group=group): + name = ep.name + cls._ensure_safe_name(ep.name) + script_text = cls.template % locals() + args = cls._get_script_args(type_, ep.name, header, script_text) + yield from args + + @staticmethod + def _ensure_safe_name(name): + """ + Prevent paths in *_scripts entry point names. + """ + has_path_sep = re.search(r'[\\/]', name) + if has_path_sep: + raise ValueError("Path separators not allowed in script names") + + @classmethod + def best(cls): + """ + Select the best ScriptWriter for this environment. + """ + if sys.platform == 'win32' or (os.name == 'java' and os._name == 'nt'): + return WindowsScriptWriter.best() + else: + return cls + + @classmethod + def _get_script_args(cls, type_, name, header, script_text): + # Simply write the stub with no extension. + yield (name, header + script_text) + + @classmethod + def get_header( + cls, + script_text: str = "", + executable: str | CommandSpec | Iterable[str] | None = None, + ) -> str: + """Create a #! line, getting options (if any) from script_text""" + cmd = cls.command_spec_class.best().from_param(executable) + cmd.install_options(script_text) + return cmd.as_header() + + +class WindowsScriptWriter(ScriptWriter): + command_spec_class = WindowsCommandSpec + + @classmethod + def best(cls): + """ + Select the best ScriptWriter suitable for Windows + """ + writer_lookup = dict( + executable=WindowsExecutableLauncherWriter, + natural=cls, + ) + # for compatibility, use the executable launcher by default + launcher = os.environ.get('SETUPTOOLS_LAUNCHER', 'executable') + return writer_lookup[launcher] + + @classmethod + def _get_script_args(cls, type_, name, header, script_text): + "For Windows, add a .py extension" + ext = dict(console='.pya', gui='.pyw')[type_] + if ext not in os.environ['PATHEXT'].lower().split(';'): + msg = ( + "{ext} not listed in PATHEXT; scripts will not be " + "recognized as executables." + ).format(**locals()) + SetuptoolsWarning.emit(msg) + old = ['.pya', '.py', '-script.py', '.pyc', '.pyo', '.pyw', '.exe'] + old.remove(ext) + header = cls._adjust_header(type_, header) + blockers = [name + x for x in old] + yield name + ext, header + script_text, 't', blockers + + @classmethod + def _adjust_header(cls, type_, orig_header): + """ + Make sure 'pythonw' is used for gui and 'python' is used for + console (regardless of what sys.executable is). + """ + pattern = 'pythonw.exe' + repl = 'python.exe' + if type_ == 'gui': + pattern, repl = repl, pattern + pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE) + new_header = pattern_ob.sub(string=orig_header, repl=repl) + return new_header if cls._use_header(new_header) else orig_header + + @staticmethod + def _use_header(new_header): + """ + Should _adjust_header use the replaced header? + + On non-windows systems, always use. On + Windows systems, only use the replaced header if it resolves + to an executable on the system. + """ + clean_header = new_header[2:-1].strip('"') + return sys.platform != 'win32' or shutil.which(clean_header) + + +class WindowsExecutableLauncherWriter(WindowsScriptWriter): + @classmethod + def _get_script_args(cls, type_, name, header, script_text): + """ + For Windows, add a .py extension and an .exe launcher + """ + if type_ == 'gui': + launcher_type = 'gui' + ext = '-script.pyw' + old = ['.pyw'] + else: + launcher_type = 'cli' + ext = '-script.py' + old = ['.py', '.pyc', '.pyo'] + hdr = cls._adjust_header(type_, header) + blockers = [name + x for x in old] + yield (name + ext, hdr + script_text, 't', blockers) + yield ( + name + '.exe', + get_win_launcher(launcher_type), + 'b', # write in binary mode + ) + if not is_64bit(): + # install a manifest for the launcher to prevent Windows + # from detecting it as an installer (which it will for + # launchers like easy_install.exe). Consider only + # adding a manifest for launchers detected as installers. + # See Distribute #143 for details. + m_name = name + '.exe.manifest' + yield (m_name, load_launcher_manifest(name), 't') + + +def get_win_launcher(type): + """ + Load the Windows launcher (executable) suitable for launching a script. + + `type` should be either 'cli' or 'gui' + + Returns the executable as a byte string. + """ + launcher_fn = f'{type}.exe' + if is_64bit(): + if get_platform() == "win-arm64": + launcher_fn = launcher_fn.replace(".", "-arm64.") + else: + launcher_fn = launcher_fn.replace(".", "-64.") + else: + launcher_fn = launcher_fn.replace(".", "-32.") + return resources.files('setuptools').joinpath(launcher_fn).read_bytes() + + +def load_launcher_manifest(name): + res = resources.files(__name__).joinpath('launcher manifest.xml') + return res.read_text(encoding='utf-8') % vars() + + +def _first_line_re(): + """ + Return a regular expression based on first_line_re suitable for matching + strings. + """ + if isinstance(first_line_re.pattern, str): + return first_line_re + + # first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern. + return re.compile(first_line_re.pattern.decode()) + + +def is_64bit(): + return struct.calcsize("P") == 8 + + +def isascii(s): + try: + s.encode('ascii') + except UnicodeError: + return False + return True diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_shutil.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_shutil.py new file mode 100644 index 0000000000000000000000000000000000000000..660459a1102eed0da597ebd7c1a38cb4eee99791 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_shutil.py @@ -0,0 +1,59 @@ +"""Convenience layer on top of stdlib's shutil and os""" + +import os +import stat +from typing import Callable, TypeVar + +from .compat import py311 + +from distutils import log + +try: + from os import chmod # pyright: ignore[reportAssignmentType] + # Losing type-safety w/ pyright, but that's ok +except ImportError: # pragma: no cover + # Jython compatibility + def chmod(*args: object, **kwargs: object) -> None: # type: ignore[misc] # Mypy reuses the imported definition anyway + pass + + +_T = TypeVar("_T") + + +def attempt_chmod_verbose(path, mode): + log.debug("changing mode of %s to %o", path, mode) + try: + chmod(path, mode) + except OSError as e: # pragma: no cover + log.debug("chmod failed: %s", e) + + +# Must match shutil._OnExcCallback +def _auto_chmod( + func: Callable[..., _T], arg: str, exc: BaseException +) -> _T: # pragma: no cover + """shutils onexc callback to automatically call chmod for certain functions.""" + # Only retry for scenarios known to have an issue + if func in [os.unlink, os.remove] and os.name == 'nt': + attempt_chmod_verbose(arg, stat.S_IWRITE) + return func(arg) + raise exc + + +def rmtree(path, ignore_errors=False, onexc=_auto_chmod): + """ + Similar to ``shutil.rmtree`` but automatically executes ``chmod`` + for well know Windows failure scenarios. + """ + return py311.shutil_rmtree(path, ignore_errors, onexc) + + +def rmdir(path, **opts): + if os.path.isdir(path): + rmtree(path, **opts) + + +def current_umask(): + tmp = os.umask(0o022) + os.umask(tmp) + return tmp diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_static.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_static.py new file mode 100644 index 0000000000000000000000000000000000000000..af35862cf8b759a0e60110ce9e92bfdb1b49bc5f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/_static.py @@ -0,0 +1,188 @@ +from functools import wraps +from typing import TypeVar + +import packaging.specifiers + +from .warnings import SetuptoolsDeprecationWarning + + +class Static: + """ + Wrapper for built-in object types that are allow setuptools to identify + static core metadata (in opposition to ``Dynamic``, as defined :pep:`643`). + + The trick is to mark values with :class:`Static` when they come from + ``pyproject.toml`` or ``setup.cfg``, so if any plugin overwrite the value + with a built-in, setuptools will be able to recognise the change. + + We inherit from built-in classes, so that we don't need to change the existing + code base to deal with the new types. + We also should strive for immutability objects to avoid changes after the + initial parsing. + """ + + _mutated_: bool = False # TODO: Remove after deprecation warning is solved + + +def _prevent_modification(target: type, method: str, copying: str) -> None: + """ + Because setuptools is very flexible we cannot fully prevent + plugins and user customizations from modifying static values that were + parsed from config files. + But we can attempt to block "in-place" mutations and identify when they + were done. + """ + fn = getattr(target, method, None) + if fn is None: + return + + @wraps(fn) + def _replacement(self: Static, *args, **kwargs): + # TODO: After deprecation period raise NotImplementedError instead of warning + # which obviated the existence and checks of the `_mutated_` attribute. + self._mutated_ = True + SetuptoolsDeprecationWarning.emit( + "Direct modification of value will be disallowed", + f""" + In an effort to implement PEP 643, direct/in-place changes of static values + that come from configuration files are deprecated. + If you need to modify this value, please first create a copy with {copying} + and make sure conform to all relevant standards when overriding setuptools + functionality (https://packaging.python.org/en/latest/specifications/). + """, + due_date=(2025, 10, 10), # Initially introduced in 2024-09-06 + ) + return fn(self, *args, **kwargs) + + _replacement.__doc__ = "" # otherwise doctest may fail. + setattr(target, method, _replacement) + + +class Str(str, Static): + pass + + +class Tuple(tuple, Static): + pass + + +class List(list, Static): + """ + :meta private: + >>> x = List([1, 2, 3]) + >>> is_static(x) + True + >>> x += [0] # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + SetuptoolsDeprecationWarning: Direct modification ... + >>> is_static(x) # no longer static after modification + False + >>> y = list(x) + >>> y.clear() + >>> y + [] + >>> y == x + False + >>> is_static(List(y)) + True + """ + + +# Make `List` immutable-ish +# (certain places of setuptools/distutils issue a warn if we use tuple instead of list) +for _method in ( + '__delitem__', + '__iadd__', + '__setitem__', + 'append', + 'clear', + 'extend', + 'insert', + 'remove', + 'reverse', + 'pop', +): + _prevent_modification(List, _method, "`list(value)`") + + +class Dict(dict, Static): + """ + :meta private: + >>> x = Dict({'a': 1, 'b': 2}) + >>> is_static(x) + True + >>> x['c'] = 0 # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + SetuptoolsDeprecationWarning: Direct modification ... + >>> x._mutated_ + True + >>> is_static(x) # no longer static after modification + False + >>> y = dict(x) + >>> y.popitem() + ('b', 2) + >>> y == x + False + >>> is_static(Dict(y)) + True + """ + + +# Make `Dict` immutable-ish (we cannot inherit from types.MappingProxyType): +for _method in ( + '__delitem__', + '__ior__', + '__setitem__', + 'clear', + 'pop', + 'popitem', + 'setdefault', + 'update', +): + _prevent_modification(Dict, _method, "`dict(value)`") + + +class SpecifierSet(packaging.specifiers.SpecifierSet, Static): + """Not exactly a built-in type but useful for ``requires-python``""" + + +T = TypeVar("T") + + +def noop(value: T) -> T: + """ + >>> noop(42) + 42 + """ + return value + + +_CONVERSIONS = {str: Str, tuple: Tuple, list: List, dict: Dict} + + +def attempt_conversion(value: T) -> T: + """ + >>> is_static(attempt_conversion("hello")) + True + >>> is_static(object()) + False + """ + return _CONVERSIONS.get(type(value), noop)(value) # type: ignore[call-overload] + + +def is_static(value: object) -> bool: + """ + >>> is_static(a := Dict({'a': 1})) + True + >>> is_static(dict(a)) + False + >>> is_static(b := List([1, 2, 3])) + True + >>> is_static(list(b)) + False + """ + return isinstance(value, Static) and not value._mutated_ + + +EMPTY_LIST = List() +EMPTY_DICT = Dict() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/archive_util.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/archive_util.py new file mode 100644 index 0000000000000000000000000000000000000000..1a02010bb2af2be0487730d6a32080877b9ac220 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/archive_util.py @@ -0,0 +1,219 @@ +"""Utilities for extracting common archive formats""" + +import contextlib +import os +import posixpath +import shutil +import tarfile +import zipfile + +from ._path import ensure_directory + +from distutils.errors import DistutilsError + +__all__ = [ + "unpack_archive", + "unpack_zipfile", + "unpack_tarfile", + "default_filter", + "UnrecognizedFormat", + "extraction_drivers", + "unpack_directory", +] + + +class UnrecognizedFormat(DistutilsError): + """Couldn't recognize the archive type""" + + +def default_filter(src, dst): + """The default progress/filter callback; returns True for all files""" + return dst + + +def unpack_archive( + filename, extract_dir, progress_filter=default_filter, drivers=None +) -> None: + """Unpack `filename` to `extract_dir`, or raise ``UnrecognizedFormat`` + + `progress_filter` is a function taking two arguments: a source path + internal to the archive ('/'-separated), and a filesystem path where it + will be extracted. The callback must return the desired extract path + (which may be the same as the one passed in), or else ``None`` to skip + that file or directory. The callback can thus be used to report on the + progress of the extraction, as well as to filter the items extracted or + alter their extraction paths. + + `drivers`, if supplied, must be a non-empty sequence of functions with the + same signature as this function (minus the `drivers` argument), that raise + ``UnrecognizedFormat`` if they do not support extracting the designated + archive type. The `drivers` are tried in sequence until one is found that + does not raise an error, or until all are exhausted (in which case + ``UnrecognizedFormat`` is raised). If you do not supply a sequence of + drivers, the module's ``extraction_drivers`` constant will be used, which + means that ``unpack_zipfile`` and ``unpack_tarfile`` will be tried, in that + order. + """ + for driver in drivers or extraction_drivers: + try: + driver(filename, extract_dir, progress_filter) + except UnrecognizedFormat: + continue + else: + return + else: + raise UnrecognizedFormat(f"Not a recognized archive type: {filename}") + + +def unpack_directory(filename, extract_dir, progress_filter=default_filter) -> None: + """ "Unpack" a directory, using the same interface as for archives + + Raises ``UnrecognizedFormat`` if `filename` is not a directory + """ + if not os.path.isdir(filename): + raise UnrecognizedFormat(f"{filename} is not a directory") + + paths = { + filename: ('', extract_dir), + } + for base, dirs, files in os.walk(filename): + src, dst = paths[base] + for d in dirs: + paths[os.path.join(base, d)] = src + d + '/', os.path.join(dst, d) + for f in files: + target = os.path.join(dst, f) + target = progress_filter(src + f, target) + if not target: + # skip non-files + continue + ensure_directory(target) + f = os.path.join(base, f) + shutil.copyfile(f, target) + shutil.copystat(f, target) + + +def unpack_zipfile(filename, extract_dir, progress_filter=default_filter) -> None: + """Unpack zip `filename` to `extract_dir` + + Raises ``UnrecognizedFormat`` if `filename` is not a zipfile (as determined + by ``zipfile.is_zipfile()``). See ``unpack_archive()`` for an explanation + of the `progress_filter` argument. + """ + + if not zipfile.is_zipfile(filename): + raise UnrecognizedFormat(f"{filename} is not a zip file") + + with zipfile.ZipFile(filename) as z: + _unpack_zipfile_obj(z, extract_dir, progress_filter) + + +def _unpack_zipfile_obj(zipfile_obj, extract_dir, progress_filter=default_filter): + """Internal/private API used by other parts of setuptools. + Similar to ``unpack_zipfile``, but receives an already opened :obj:`zipfile.ZipFile` + object instead of a filename. + """ + for info in zipfile_obj.infolist(): + name = info.filename + + # don't extract absolute paths or ones with .. in them + if name.startswith('/') or '..' in name.split('/'): + continue + + target = os.path.join(extract_dir, *name.split('/')) + target = progress_filter(name, target) + if not target: + continue + if name.endswith('/'): + # directory + ensure_directory(target) + else: + # file + ensure_directory(target) + data = zipfile_obj.read(info.filename) + with open(target, 'wb') as f: + f.write(data) + unix_attributes = info.external_attr >> 16 + if unix_attributes: + os.chmod(target, unix_attributes) + + +def _resolve_tar_file_or_dir(tar_obj, tar_member_obj): + """Resolve any links and extract link targets as normal files.""" + while tar_member_obj is not None and ( + tar_member_obj.islnk() or tar_member_obj.issym() + ): + linkpath = tar_member_obj.linkname + if tar_member_obj.issym(): + base = posixpath.dirname(tar_member_obj.name) + linkpath = posixpath.join(base, linkpath) + linkpath = posixpath.normpath(linkpath) + tar_member_obj = tar_obj._getmember(linkpath) + + is_file_or_dir = tar_member_obj is not None and ( + tar_member_obj.isfile() or tar_member_obj.isdir() + ) + if is_file_or_dir: + return tar_member_obj + + raise LookupError('Got unknown file type') + + +def _iter_open_tar(tar_obj, extract_dir, progress_filter): + """Emit member-destination pairs from a tar archive.""" + # don't do any chowning! + tar_obj.chown = lambda *args: None + + with contextlib.closing(tar_obj): + for member in tar_obj: + name = member.name + # don't extract absolute paths or ones with .. in them + if name.startswith('/') or '..' in name.split('/'): + continue + + prelim_dst = os.path.join(extract_dir, *name.split('/')) + + try: + member = _resolve_tar_file_or_dir(tar_obj, member) + except LookupError: + continue + + final_dst = progress_filter(name, prelim_dst) + if not final_dst: + continue + + if final_dst.endswith(os.sep): + final_dst = final_dst[:-1] + + yield member, final_dst + + +def unpack_tarfile(filename, extract_dir, progress_filter=default_filter) -> bool: + """Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir` + + Raises ``UnrecognizedFormat`` if `filename` is not a tarfile (as determined + by ``tarfile.open()``). See ``unpack_archive()`` for an explanation + of the `progress_filter` argument. + """ + try: + tarobj = tarfile.open(filename) + except tarfile.TarError as e: + raise UnrecognizedFormat( + f"{filename} is not a compressed or uncompressed tar file" + ) from e + + for member, final_dst in _iter_open_tar( + tarobj, + extract_dir, + progress_filter, + ): + try: + # XXX Ugh + tarobj._extract_member(member, final_dst) + except tarfile.ExtractError: + # chown/chmod/mkfifo/mknode/makedev failed + pass + + return True + + +extraction_drivers = unpack_directory, unpack_zipfile, unpack_tarfile diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/build_meta.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/build_meta.py new file mode 100644 index 0000000000000000000000000000000000000000..1d93b6193be40883b113265aac44ccd775075a0d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/build_meta.py @@ -0,0 +1,556 @@ +"""A PEP 517 interface to setuptools + +Previously, when a user or a command line tool (let's call it a "frontend") +needed to make a request of setuptools to take a certain action, for +example, generating a list of installation requirements, the frontend +would call "setup.py egg_info" or "setup.py bdist_wheel" on the command line. + +PEP 517 defines a different method of interfacing with setuptools. Rather +than calling "setup.py" directly, the frontend should: + + 1. Set the current directory to the directory with a setup.py file + 2. Import this module into a safe python interpreter (one in which + setuptools can potentially set global variables or crash hard). + 3. Call one of the functions defined in PEP 517. + +What each function does is defined in PEP 517. However, here is a "casual" +definition of the functions (this definition should not be relied on for +bug reports or API stability): + + - `build_wheel`: build a wheel in the folder and return the basename + - `get_requires_for_build_wheel`: get the `setup_requires` to build + - `prepare_metadata_for_build_wheel`: get the `install_requires` + - `build_sdist`: build an sdist in the folder and return the basename + - `get_requires_for_build_sdist`: get the `setup_requires` to build + +Again, this is not a formal definition! Just a "taste" of the module. +""" + +from __future__ import annotations + +import contextlib +import io +import os +import shlex +import shutil +import sys +import tempfile +import tokenize +import warnings +from collections.abc import Iterable, Iterator, Mapping +from pathlib import Path +from typing import TYPE_CHECKING, NoReturn, Union + +import setuptools + +from . import errors +from ._path import StrPath, same_path +from ._reqs import parse_strings +from .warnings import SetuptoolsDeprecationWarning + +import distutils +from distutils.util import strtobool + +if TYPE_CHECKING: + from typing_extensions import TypeAlias + +__all__ = [ + 'get_requires_for_build_sdist', + 'get_requires_for_build_wheel', + 'prepare_metadata_for_build_wheel', + 'build_wheel', + 'build_sdist', + 'get_requires_for_build_editable', + 'prepare_metadata_for_build_editable', + 'build_editable', + '__legacy__', + 'SetupRequirementsError', +] + + +class SetupRequirementsError(BaseException): + def __init__(self, specifiers) -> None: + self.specifiers = specifiers + + +class Distribution(setuptools.dist.Distribution): + def fetch_build_eggs(self, specifiers) -> NoReturn: + specifier_list = list(parse_strings(specifiers)) + + raise SetupRequirementsError(specifier_list) + + @classmethod + @contextlib.contextmanager + def patch(cls) -> Iterator[None]: + """ + Replace + distutils.dist.Distribution with this class + for the duration of this context. + """ + orig = distutils.core.Distribution + distutils.core.Distribution = cls # type: ignore[misc] # monkeypatching + try: + yield + finally: + distutils.core.Distribution = orig # type: ignore[misc] # monkeypatching + + +@contextlib.contextmanager +def no_install_setup_requires(): + """Temporarily disable installing setup_requires + + Under PEP 517, the backend reports build dependencies to the frontend, + and the frontend is responsible for ensuring they're installed. + So setuptools (acting as a backend) should not try to install them. + """ + orig = setuptools._install_setup_requires + setuptools._install_setup_requires = lambda attrs: None + try: + yield + finally: + setuptools._install_setup_requires = orig + + +def _get_immediate_subdirectories(a_dir): + return [ + name for name in os.listdir(a_dir) if os.path.isdir(os.path.join(a_dir, name)) + ] + + +def _file_with_extension(directory: StrPath, extension: str | tuple[str, ...]): + matching = (f for f in os.listdir(directory) if f.endswith(extension)) + try: + (file,) = matching + except ValueError: + raise ValueError( + 'No distribution was found. Ensure that `setup.py` ' + 'is not empty and that it calls `setup()`.' + ) from None + return file + + +def _open_setup_script(setup_script): + if not os.path.exists(setup_script): + # Supply a default setup.py + return io.StringIO("from setuptools import setup; setup()") + + return tokenize.open(setup_script) + + +@contextlib.contextmanager +def suppress_known_deprecation(): + with warnings.catch_warnings(): + warnings.filterwarnings('ignore', 'setup.py install is deprecated') + yield + + +_ConfigSettings: TypeAlias = Union[Mapping[str, Union[str, list[str], None]], None] +""" +Currently the user can run:: + + pip install -e . --config-settings key=value + python -m build -C--key=value -C key=value + +- pip will pass both key and value as strings and overwriting repeated keys + (pypa/pip#11059). +- build will accumulate values associated with repeated keys in a list. + It will also accept keys with no associated value. + This means that an option passed by build can be ``str | list[str] | None``. +- PEP 517 specifies that ``config_settings`` is an optional dict. +""" + + +class _ConfigSettingsTranslator: + """Translate ``config_settings`` into distutils-style command arguments. + Only a limited number of options is currently supported. + """ + + # See pypa/setuptools#1928 pypa/setuptools#2491 + + def _get_config(self, key: str, config_settings: _ConfigSettings) -> list[str]: + """ + Get the value of a specific key in ``config_settings`` as a list of strings. + + >>> fn = _ConfigSettingsTranslator()._get_config + >>> fn("--global-option", None) + [] + >>> fn("--global-option", {}) + [] + >>> fn("--global-option", {'--global-option': 'foo'}) + ['foo'] + >>> fn("--global-option", {'--global-option': ['foo']}) + ['foo'] + >>> fn("--global-option", {'--global-option': 'foo'}) + ['foo'] + >>> fn("--global-option", {'--global-option': 'foo bar'}) + ['foo', 'bar'] + """ + cfg = config_settings or {} + opts = cfg.get(key) or [] + return shlex.split(opts) if isinstance(opts, str) else opts + + def _global_args(self, config_settings: _ConfigSettings) -> Iterator[str]: + """ + Let the user specify ``verbose`` or ``quiet`` + escape hatch via + ``--global-option``. + Note: ``-v``, ``-vv``, ``-vvv`` have similar effects in setuptools, + so we just have to cover the basic scenario ``-v``. + + >>> fn = _ConfigSettingsTranslator()._global_args + >>> list(fn(None)) + [] + >>> list(fn({"verbose": "False"})) + ['-q'] + >>> list(fn({"verbose": "1"})) + ['-v'] + >>> list(fn({"--verbose": None})) + ['-v'] + >>> list(fn({"verbose": "true", "--global-option": "-q --no-user-cfg"})) + ['-v', '-q', '--no-user-cfg'] + >>> list(fn({"--quiet": None})) + ['-q'] + """ + cfg = config_settings or {} + falsey = {"false", "no", "0", "off"} + if "verbose" in cfg or "--verbose" in cfg: + level = str(cfg.get("verbose") or cfg.get("--verbose") or "1") + yield ("-q" if level.lower() in falsey else "-v") + if "quiet" in cfg or "--quiet" in cfg: + level = str(cfg.get("quiet") or cfg.get("--quiet") or "1") + yield ("-v" if level.lower() in falsey else "-q") + + yield from self._get_config("--global-option", config_settings) + + def __dist_info_args(self, config_settings: _ConfigSettings) -> Iterator[str]: + """ + The ``dist_info`` command accepts ``tag-date`` and ``tag-build``. + + .. warning:: + We cannot use this yet as it requires the ``sdist`` and ``bdist_wheel`` + commands run in ``build_sdist`` and ``build_wheel`` to reuse the egg-info + directory created in ``prepare_metadata_for_build_wheel``. + + >>> fn = _ConfigSettingsTranslator()._ConfigSettingsTranslator__dist_info_args + >>> list(fn(None)) + [] + >>> list(fn({"tag-date": "False"})) + ['--no-date'] + >>> list(fn({"tag-date": None})) + ['--no-date'] + >>> list(fn({"tag-date": "true", "tag-build": ".a"})) + ['--tag-date', '--tag-build', '.a'] + """ + cfg = config_settings or {} + if "tag-date" in cfg: + val = strtobool(str(cfg["tag-date"] or "false")) + yield ("--tag-date" if val else "--no-date") + if "tag-build" in cfg: + yield from ["--tag-build", str(cfg["tag-build"])] + + def _editable_args(self, config_settings: _ConfigSettings) -> Iterator[str]: + """ + The ``editable_wheel`` command accepts ``editable-mode=strict``. + + >>> fn = _ConfigSettingsTranslator()._editable_args + >>> list(fn(None)) + [] + >>> list(fn({"editable-mode": "strict"})) + ['--mode', 'strict'] + """ + cfg = config_settings or {} + mode = cfg.get("editable-mode") or cfg.get("editable_mode") + if not mode: + return + yield from ["--mode", str(mode)] + + def _arbitrary_args(self, config_settings: _ConfigSettings) -> Iterator[str]: + """ + Users may expect to pass arbitrary lists of arguments to a command + via "--global-option" (example provided in PEP 517 of a "escape hatch"). + + >>> fn = _ConfigSettingsTranslator()._arbitrary_args + >>> list(fn(None)) + [] + >>> list(fn({})) + [] + >>> list(fn({'--build-option': 'foo'})) + ['foo'] + >>> list(fn({'--build-option': ['foo']})) + ['foo'] + >>> list(fn({'--build-option': 'foo'})) + ['foo'] + >>> list(fn({'--build-option': 'foo bar'})) + ['foo', 'bar'] + >>> list(fn({'--global-option': 'foo'})) + [] + """ + yield from self._get_config("--build-option", config_settings) + + +class _BuildMetaBackend(_ConfigSettingsTranslator): + def _get_build_requires( + self, config_settings: _ConfigSettings, requirements: list[str] + ): + sys.argv = [ + *sys.argv[:1], + *self._global_args(config_settings), + "egg_info", + ] + try: + with Distribution.patch(): + self.run_setup() + except SetupRequirementsError as e: + requirements += e.specifiers + + return requirements + + def run_setup(self, setup_script: str = 'setup.py') -> None: + # Note that we can reuse our build directory between calls + # Correctness comes first, then optimization later + __file__ = os.path.abspath(setup_script) + __name__ = '__main__' + + with _open_setup_script(__file__) as f: + code = f.read().replace(r'\r\n', r'\n') + + try: + exec(code, locals()) + except SystemExit as e: + if e.code: + raise + # We ignore exit code indicating success + SetuptoolsDeprecationWarning.emit( + "Running `setup.py` directly as CLI tool is deprecated.", + "Please avoid using `sys.exit(0)` or similar statements " + "that don't fit in the paradigm of a configuration file.", + see_url="https://blog.ganssle.io/articles/2021/10/" + "setup-py-deprecated.html", + ) + + def get_requires_for_build_wheel( + self, config_settings: _ConfigSettings = None + ) -> list[str]: + return self._get_build_requires(config_settings, requirements=[]) + + def get_requires_for_build_sdist( + self, config_settings: _ConfigSettings = None + ) -> list[str]: + return self._get_build_requires(config_settings, requirements=[]) + + def _bubble_up_info_directory( + self, metadata_directory: StrPath, suffix: str + ) -> str: + """ + PEP 517 requires that the .dist-info directory be placed in the + metadata_directory. To comply, we MUST copy the directory to the root. + + Returns the basename of the info directory, e.g. `proj-0.0.0.dist-info`. + """ + info_dir = self._find_info_directory(metadata_directory, suffix) + if not same_path(info_dir.parent, metadata_directory): + shutil.move(str(info_dir), metadata_directory) + # PEP 517 allow other files and dirs to exist in metadata_directory + return info_dir.name + + def _find_info_directory(self, metadata_directory: StrPath, suffix: str) -> Path: + for parent, dirs, _ in os.walk(metadata_directory): + candidates = [f for f in dirs if f.endswith(suffix)] + + if len(candidates) != 0 or len(dirs) != 1: + assert len(candidates) == 1, ( + f"Exactly one {suffix} should have been produced, but found {len(candidates)}: {candidates}" + ) + return Path(parent, candidates[0]) + + msg = f"No {suffix} directory found in {metadata_directory}" + raise errors.InternalError(msg) + + def prepare_metadata_for_build_wheel( + self, metadata_directory: StrPath, config_settings: _ConfigSettings = None + ) -> str: + sys.argv = [ + *sys.argv[:1], + *self._global_args(config_settings), + "dist_info", + "--output-dir", + str(metadata_directory), + "--keep-egg-info", + ] + with no_install_setup_requires(): + self.run_setup() + + self._bubble_up_info_directory(metadata_directory, ".egg-info") + return self._bubble_up_info_directory(metadata_directory, ".dist-info") + + def _build_with_temp_dir( + self, + setup_command: Iterable[str], + result_extension: str | tuple[str, ...], + result_directory: StrPath, + config_settings: _ConfigSettings, + arbitrary_args: Iterable[str] = (), + ): + result_directory = os.path.abspath(result_directory) + + # Build in a temporary directory, then copy to the target. + os.makedirs(result_directory, exist_ok=True) + + with tempfile.TemporaryDirectory( + prefix=".tmp-", dir=result_directory + ) as tmp_dist_dir: + sys.argv = [ + *sys.argv[:1], + *self._global_args(config_settings), + *setup_command, + "--dist-dir", + tmp_dist_dir, + *arbitrary_args, + ] + with no_install_setup_requires(): + self.run_setup() + + result_basename = _file_with_extension(tmp_dist_dir, result_extension) + result_path = os.path.join(result_directory, result_basename) + if os.path.exists(result_path): + # os.rename will fail overwriting on non-Unix. + os.remove(result_path) + os.rename(os.path.join(tmp_dist_dir, result_basename), result_path) + + return result_basename + + def build_wheel( + self, + wheel_directory: StrPath, + config_settings: _ConfigSettings = None, + metadata_directory: StrPath | None = None, + ) -> str: + def _build(cmd: list[str]): + with suppress_known_deprecation(): + return self._build_with_temp_dir( + cmd, + '.whl', + wheel_directory, + config_settings, + self._arbitrary_args(config_settings), + ) + + if metadata_directory is None: + return _build(['bdist_wheel']) + + try: + return _build(['bdist_wheel', '--dist-info-dir', str(metadata_directory)]) + except SystemExit as ex: # pragma: nocover + # pypa/setuptools#4683 + if "--dist-info-dir not recognized" not in str(ex): + raise + _IncompatibleBdistWheel.emit() + return _build(['bdist_wheel']) + + def build_sdist( + self, sdist_directory: StrPath, config_settings: _ConfigSettings = None + ) -> str: + return self._build_with_temp_dir( + ['sdist', '--formats', 'gztar'], '.tar.gz', sdist_directory, config_settings + ) + + def _get_dist_info_dir(self, metadata_directory: StrPath | None) -> str | None: + if not metadata_directory: + return None + dist_info_candidates = list(Path(metadata_directory).glob("*.dist-info")) + assert len(dist_info_candidates) <= 1 + return str(dist_info_candidates[0]) if dist_info_candidates else None + + def build_editable( + self, + wheel_directory: StrPath, + config_settings: _ConfigSettings = None, + metadata_directory: StrPath | None = None, + ) -> str: + # XXX can or should we hide our editable_wheel command normally? + info_dir = self._get_dist_info_dir(metadata_directory) + opts = ["--dist-info-dir", info_dir] if info_dir else [] + cmd = ["editable_wheel", *opts, *self._editable_args(config_settings)] + with suppress_known_deprecation(): + return self._build_with_temp_dir( + cmd, ".whl", wheel_directory, config_settings + ) + + def get_requires_for_build_editable( + self, config_settings: _ConfigSettings = None + ) -> list[str]: + return self.get_requires_for_build_wheel(config_settings) + + def prepare_metadata_for_build_editable( + self, metadata_directory: StrPath, config_settings: _ConfigSettings = None + ) -> str: + return self.prepare_metadata_for_build_wheel( + metadata_directory, config_settings + ) + + +class _BuildMetaLegacyBackend(_BuildMetaBackend): + """Compatibility backend for setuptools + + This is a version of setuptools.build_meta that endeavors + to maintain backwards + compatibility with pre-PEP 517 modes of invocation. It + exists as a temporary + bridge between the old packaging mechanism and the new + packaging mechanism, + and will eventually be removed. + """ + + def run_setup(self, setup_script: str = 'setup.py') -> None: + # In order to maintain compatibility with scripts assuming that + # the setup.py script is in a directory on the PYTHONPATH, inject + # '' into sys.path. (pypa/setuptools#1642) + sys_path = list(sys.path) # Save the original path + + script_dir = os.path.dirname(os.path.abspath(setup_script)) + if script_dir not in sys.path: + sys.path.insert(0, script_dir) + + # Some setup.py scripts (e.g. in pygame and numpy) use sys.argv[0] to + # get the directory of the source code. They expect it to refer to the + # setup.py script. + sys_argv_0 = sys.argv[0] + sys.argv[0] = setup_script + + try: + super().run_setup(setup_script=setup_script) + finally: + # While PEP 517 frontends should be calling each hook in a fresh + # subprocess according to the standard (and thus it should not be + # strictly necessary to restore the old sys.path), we'll restore + # the original path so that the path manipulation does not persist + # within the hook after run_setup is called. + sys.path[:] = sys_path + sys.argv[0] = sys_argv_0 + + +class _IncompatibleBdistWheel(SetuptoolsDeprecationWarning): + _SUMMARY = "wheel.bdist_wheel is deprecated, please import it from setuptools" + _DETAILS = """ + Ensure that any custom bdist_wheel implementation is a subclass of + setuptools.command.bdist_wheel.bdist_wheel. + """ + _DUE_DATE = (2025, 10, 15) + # Initially introduced in 2024/10/15, but maybe too disruptive to be enforced? + _SEE_URL = "https://github.com/pypa/wheel/pull/631" + + +# The primary backend +_BACKEND = _BuildMetaBackend() + +get_requires_for_build_wheel = _BACKEND.get_requires_for_build_wheel +get_requires_for_build_sdist = _BACKEND.get_requires_for_build_sdist +prepare_metadata_for_build_wheel = _BACKEND.prepare_metadata_for_build_wheel +build_wheel = _BACKEND.build_wheel +build_sdist = _BACKEND.build_sdist +get_requires_for_build_editable = _BACKEND.get_requires_for_build_editable +prepare_metadata_for_build_editable = _BACKEND.prepare_metadata_for_build_editable +build_editable = _BACKEND.build_editable + + +# The legacy backend +__legacy__ = _BuildMetaLegacyBackend() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/cli-32.exe b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/cli-32.exe new file mode 100644 index 0000000000000000000000000000000000000000..65c3cd99cc7433f271a5b9387abdd1ddb949d1a6 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/cli-32.exe differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/cli-64.exe b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/cli-64.exe new file mode 100644 index 0000000000000000000000000000000000000000..3ea50eebfe3f0113b231a318cc1ad6e238afd60d Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/cli-64.exe differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/cli-arm64.exe b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/cli-arm64.exe new file mode 100644 index 0000000000000000000000000000000000000000..da96455a07a0bad4cde5dc5626544325f82c722b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/cli-arm64.exe differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/cli.exe b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/cli.exe new file mode 100644 index 0000000000000000000000000000000000000000..65c3cd99cc7433f271a5b9387abdd1ddb949d1a6 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/cli.exe differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/depends.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/depends.py new file mode 100644 index 0000000000000000000000000000000000000000..e5223b79561c36d9b6c45ead78288098e1cb0f1d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/depends.py @@ -0,0 +1,185 @@ +from __future__ import annotations + +import contextlib +import dis +import marshal +import sys +from types import CodeType +from typing import Any, Literal, TypeVar + +from packaging.version import Version + +from . import _imp +from ._imp import PY_COMPILED, PY_FROZEN, PY_SOURCE, find_module + +_T = TypeVar("_T") + +__all__ = ['Require', 'find_module'] + + +class Require: + """A prerequisite to building or installing a distribution""" + + def __init__( + self, + name, + requested_version, + module, + homepage: str = '', + attribute=None, + format=None, + ) -> None: + if format is None and requested_version is not None: + format = Version + + if format is not None: + requested_version = format(requested_version) + if attribute is None: + attribute = '__version__' + + self.__dict__.update(locals()) + del self.self + + def full_name(self): + """Return full package/distribution name, w/version""" + if self.requested_version is not None: + return f'{self.name}-{self.requested_version}' + return self.name + + def version_ok(self, version): + """Is 'version' sufficiently up-to-date?""" + return ( + self.attribute is None + or self.format is None + or str(version) != "unknown" + and self.format(version) >= self.requested_version + ) + + def get_version( + self, paths=None, default: _T | Literal["unknown"] = "unknown" + ) -> _T | Literal["unknown"] | None | Any: + """Get version number of installed module, 'None', or 'default' + + Search 'paths' for module. If not found, return 'None'. If found, + return the extracted version attribute, or 'default' if no version + attribute was specified, or the value cannot be determined without + importing the module. The version is formatted according to the + requirement's version format (if any), unless it is 'None' or the + supplied 'default'. + """ + + if self.attribute is None: + try: + f, _p, _i = find_module(self.module, paths) + except ImportError: + return None + if f: + f.close() + return default + + v = get_module_constant(self.module, self.attribute, default, paths) + + if v is not None and v is not default and self.format is not None: + return self.format(v) + + return v + + def is_present(self, paths=None): + """Return true if dependency is present on 'paths'""" + return self.get_version(paths) is not None + + def is_current(self, paths=None): + """Return true if dependency is present and up-to-date on 'paths'""" + version = self.get_version(paths) + if version is None: + return False + return self.version_ok(str(version)) + + +def maybe_close(f): + @contextlib.contextmanager + def empty(): + yield + return + + if not f: + return empty() + + return contextlib.closing(f) + + +# Some objects are not available on some platforms. +# XXX it'd be better to test assertions about bytecode instead. +if not sys.platform.startswith('java') and sys.platform != 'cli': + + def get_module_constant( + module, symbol, default: _T | int = -1, paths=None + ) -> _T | int | None | Any: + """Find 'module' by searching 'paths', and extract 'symbol' + + Return 'None' if 'module' does not exist on 'paths', or it does not define + 'symbol'. If the module defines 'symbol' as a constant, return the + constant. Otherwise, return 'default'.""" + + try: + f, path, (_suffix, _mode, kind) = info = find_module(module, paths) + except ImportError: + # Module doesn't exist + return None + + with maybe_close(f): + if kind == PY_COMPILED: + f.read(8) # skip magic & date + code = marshal.load(f) + elif kind == PY_FROZEN: + code = _imp.get_frozen_object(module, paths) + elif kind == PY_SOURCE: + code = compile(f.read(), path, 'exec') + else: + # Not something we can parse; we'll have to import it. :( + imported = _imp.get_module(module, paths, info) + return getattr(imported, symbol, None) + + return extract_constant(code, symbol, default) + + def extract_constant( + code: CodeType, symbol: str, default: _T | int = -1 + ) -> _T | int | None | Any: + """Extract the constant value of 'symbol' from 'code' + + If the name 'symbol' is bound to a constant value by the Python code + object 'code', return that value. If 'symbol' is bound to an expression, + return 'default'. Otherwise, return 'None'. + + Return value is based on the first assignment to 'symbol'. 'symbol' must + be a global, or at least a non-"fast" local in the code block. That is, + only 'STORE_NAME' and 'STORE_GLOBAL' opcodes are checked, and 'symbol' + must be present in 'code.co_names'. + """ + if symbol not in code.co_names: + # name's not there, can't possibly be an assignment + return None + + name_idx = list(code.co_names).index(symbol) + + STORE_NAME = dis.opmap['STORE_NAME'] + STORE_GLOBAL = dis.opmap['STORE_GLOBAL'] + LOAD_CONST = dis.opmap['LOAD_CONST'] + + const = default + + for byte_code in dis.Bytecode(code): + op = byte_code.opcode + arg = byte_code.arg + + if op == LOAD_CONST: + assert arg is not None + const = code.co_consts[arg] + elif arg == name_idx and (op == STORE_NAME or op == STORE_GLOBAL): + return const + else: + const = default + + return None + + __all__ += ['get_module_constant', 'extract_constant'] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/discovery.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/discovery.py new file mode 100644 index 0000000000000000000000000000000000000000..296d3193ab429f64bc5f3bfdcad7ee6e1050dc6d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/discovery.py @@ -0,0 +1,614 @@ +"""Automatic discovery of Python modules and packages (for inclusion in the +distribution) and other config values. + +For the purposes of this module, the following nomenclature is used: + +- "src-layout": a directory representing a Python project that contains a "src" + folder. Everything under the "src" folder is meant to be included in the + distribution when packaging the project. Example:: + + . + ├── tox.ini + ├── pyproject.toml + └── src/ + └── mypkg/ + ├── __init__.py + ├── mymodule.py + └── my_data_file.txt + +- "flat-layout": a Python project that does not use "src-layout" but instead + have a directory under the project root for each package:: + + . + ├── tox.ini + ├── pyproject.toml + └── mypkg/ + ├── __init__.py + ├── mymodule.py + └── my_data_file.txt + +- "single-module": a project that contains a single Python script direct under + the project root (no directory used):: + + . + ├── tox.ini + ├── pyproject.toml + └── mymodule.py + +""" + +from __future__ import annotations + +import itertools +import os +from collections.abc import Iterable, Iterator, Mapping +from fnmatch import fnmatchcase +from glob import glob +from pathlib import Path +from typing import TYPE_CHECKING, ClassVar + +import _distutils_hack.override # noqa: F401 + +from ._path import StrPath + +from distutils import log +from distutils.util import convert_path + +if TYPE_CHECKING: + from setuptools import Distribution + +chain_iter = itertools.chain.from_iterable + + +def _valid_name(path: StrPath) -> bool: + # Ignore invalid names that cannot be imported directly + return os.path.basename(path).isidentifier() + + +class _Filter: + """ + Given a list of patterns, create a callable that will be true only if + the input matches at least one of the patterns. + """ + + def __init__(self, *patterns: str) -> None: + self._patterns = dict.fromkeys(patterns) + + def __call__(self, item: str) -> bool: + return any(fnmatchcase(item, pat) for pat in self._patterns) + + def __contains__(self, item: str) -> bool: + return item in self._patterns + + +class _Finder: + """Base class that exposes functionality for module/package finders""" + + ALWAYS_EXCLUDE: ClassVar[tuple[str, ...]] = () + DEFAULT_EXCLUDE: ClassVar[tuple[str, ...]] = () + + @classmethod + def find( + cls, + where: StrPath = '.', + exclude: Iterable[str] = (), + include: Iterable[str] = ('*',), + ) -> list[str]: + """Return a list of all Python items (packages or modules, depending on + the finder implementation) found within directory ``where``. + + ``where`` is the root directory which will be searched. + It should be supplied as a "cross-platform" (i.e. URL-style) path; + it will be converted to the appropriate local path syntax. + + ``exclude`` is a sequence of names to exclude; ``*`` can be used + as a wildcard in the names. + When finding packages, ``foo.*`` will exclude all subpackages of ``foo`` + (but not ``foo`` itself). + + ``include`` is a sequence of names to include. + If it's specified, only the named items will be included. + If it's not specified, all found items will be included. + ``include`` can contain shell style wildcard patterns just like + ``exclude``. + """ + + exclude = exclude or cls.DEFAULT_EXCLUDE + return list( + cls._find_iter( + convert_path(str(where)), + _Filter(*cls.ALWAYS_EXCLUDE, *exclude), + _Filter(*include), + ) + ) + + @classmethod + def _find_iter( + cls, where: StrPath, exclude: _Filter, include: _Filter + ) -> Iterator[str]: + raise NotImplementedError + + +class PackageFinder(_Finder): + """ + Generate a list of all Python packages found within a directory + """ + + ALWAYS_EXCLUDE = ("ez_setup", "*__pycache__") + + @classmethod + def _find_iter( + cls, where: StrPath, exclude: _Filter, include: _Filter + ) -> Iterator[str]: + """ + All the packages found in 'where' that pass the 'include' filter, but + not the 'exclude' filter. + """ + for root, dirs, files in os.walk(str(where), followlinks=True): + # Copy dirs to iterate over it, then empty dirs. + all_dirs = dirs[:] + dirs[:] = [] + + for dir in all_dirs: + full_path = os.path.join(root, dir) + rel_path = os.path.relpath(full_path, where) + package = rel_path.replace(os.path.sep, '.') + + # Skip directory trees that are not valid packages + if '.' in dir or not cls._looks_like_package(full_path, package): + continue + + # Should this package be included? + if include(package) and not exclude(package): + yield package + + # Early pruning if there is nothing else to be scanned + if f"{package}*" in exclude or f"{package}.*" in exclude: + continue + + # Keep searching subdirectories, as there may be more packages + # down there, even if the parent was excluded. + dirs.append(dir) + + @staticmethod + def _looks_like_package(path: StrPath, _package_name: str) -> bool: + """Does a directory look like a package?""" + return os.path.isfile(os.path.join(path, '__init__.py')) + + +class PEP420PackageFinder(PackageFinder): + @staticmethod + def _looks_like_package(_path: StrPath, _package_name: str) -> bool: + return True + + +class ModuleFinder(_Finder): + """Find isolated Python modules. + This function will **not** recurse subdirectories. + """ + + @classmethod + def _find_iter( + cls, where: StrPath, exclude: _Filter, include: _Filter + ) -> Iterator[str]: + for file in glob(os.path.join(where, "*.py")): + module, _ext = os.path.splitext(os.path.basename(file)) + + if not cls._looks_like_module(module): + continue + + if include(module) and not exclude(module): + yield module + + _looks_like_module = staticmethod(_valid_name) + + +# We have to be extra careful in the case of flat layout to not include files +# and directories not meant for distribution (e.g. tool-related) + + +class FlatLayoutPackageFinder(PEP420PackageFinder): + _EXCLUDE = ( + "ci", + "bin", + "debian", + "doc", + "docs", + "documentation", + "manpages", + "news", + "newsfragments", + "changelog", + "test", + "tests", + "unit_test", + "unit_tests", + "example", + "examples", + "scripts", + "tools", + "util", + "utils", + "python", + "build", + "dist", + "venv", + "env", + "requirements", + # ---- Task runners / Build tools ---- + "tasks", # invoke + "fabfile", # fabric + "site_scons", # SCons + # ---- Other tools ---- + "benchmark", + "benchmarks", + "exercise", + "exercises", + "htmlcov", # Coverage.py + # ---- Hidden directories/Private packages ---- + "[._]*", + ) + + DEFAULT_EXCLUDE = tuple(chain_iter((p, f"{p}.*") for p in _EXCLUDE)) + """Reserved package names""" + + @staticmethod + def _looks_like_package(_path: StrPath, package_name: str) -> bool: + names = package_name.split('.') + # Consider PEP 561 + root_pkg_is_valid = names[0].isidentifier() or names[0].endswith("-stubs") + return root_pkg_is_valid and all(name.isidentifier() for name in names[1:]) + + +class FlatLayoutModuleFinder(ModuleFinder): + DEFAULT_EXCLUDE = ( + "setup", + "conftest", + "test", + "tests", + "example", + "examples", + "build", + # ---- Task runners ---- + "toxfile", + "noxfile", + "pavement", + "dodo", + "tasks", + "fabfile", + # ---- Other tools ---- + "[Ss][Cc]onstruct", # SCons + "conanfile", # Connan: C/C++ build tool + "manage", # Django + "benchmark", + "benchmarks", + "exercise", + "exercises", + # ---- Hidden files/Private modules ---- + "[._]*", + ) + """Reserved top-level module names""" + + +def _find_packages_within(root_pkg: str, pkg_dir: StrPath) -> list[str]: + nested = PEP420PackageFinder.find(pkg_dir) + return [root_pkg] + [".".join((root_pkg, n)) for n in nested] + + +class ConfigDiscovery: + """Fill-in metadata and options that can be automatically derived + (from other metadata/options, the file system or conventions) + """ + + def __init__(self, distribution: Distribution) -> None: + self.dist = distribution + self._called = False + self._disabled = False + self._skip_ext_modules = False + + def _disable(self): + """Internal API to disable automatic discovery""" + self._disabled = True + + def _ignore_ext_modules(self): + """Internal API to disregard ext_modules. + + Normally auto-discovery would not be triggered if ``ext_modules`` are set + (this is done for backward compatibility with existing packages relying on + ``setup.py`` or ``setup.cfg``). However, ``setuptools`` can call this function + to ignore given ``ext_modules`` and proceed with the auto-discovery if + ``packages`` and ``py_modules`` are not given (e.g. when using pyproject.toml + metadata). + """ + self._skip_ext_modules = True + + @property + def _root_dir(self) -> StrPath: + # The best is to wait until `src_root` is set in dist, before using _root_dir. + return self.dist.src_root or os.curdir + + @property + def _package_dir(self) -> dict[str, str]: + if self.dist.package_dir is None: + return {} + return self.dist.package_dir + + def __call__( + self, force: bool = False, name: bool = True, ignore_ext_modules: bool = False + ) -> None: + """Automatically discover missing configuration fields + and modifies the given ``distribution`` object in-place. + + Note that by default this will only have an effect the first time the + ``ConfigDiscovery`` object is called. + + To repeatedly invoke automatic discovery (e.g. when the project + directory changes), please use ``force=True`` (or create a new + ``ConfigDiscovery`` instance). + """ + if force is False and (self._called or self._disabled): + # Avoid overhead of multiple calls + return + + self._analyse_package_layout(ignore_ext_modules) + if name: + self.analyse_name() # depends on ``packages`` and ``py_modules`` + + self._called = True + + def _explicitly_specified(self, ignore_ext_modules: bool) -> bool: + """``True`` if the user has specified some form of package/module listing""" + ignore_ext_modules = ignore_ext_modules or self._skip_ext_modules + ext_modules = not (self.dist.ext_modules is None or ignore_ext_modules) + return ( + self.dist.packages is not None + or self.dist.py_modules is not None + or ext_modules + or hasattr(self.dist, "configuration") + and self.dist.configuration + # ^ Some projects use numpy.distutils.misc_util.Configuration + ) + + def _analyse_package_layout(self, ignore_ext_modules: bool) -> bool: + if self._explicitly_specified(ignore_ext_modules): + # For backward compatibility, just try to find modules/packages + # when nothing is given + return True + + log.debug( + "No `packages` or `py_modules` configuration, performing " + "automatic discovery." + ) + + return ( + self._analyse_explicit_layout() + or self._analyse_src_layout() + # flat-layout is the trickiest for discovery so it should be last + or self._analyse_flat_layout() + ) + + def _analyse_explicit_layout(self) -> bool: + """The user can explicitly give a package layout via ``package_dir``""" + package_dir = self._package_dir.copy() # don't modify directly + package_dir.pop("", None) # This falls under the "src-layout" umbrella + root_dir = self._root_dir + + if not package_dir: + return False + + log.debug(f"`explicit-layout` detected -- analysing {package_dir}") + pkgs = chain_iter( + _find_packages_within(pkg, os.path.join(root_dir, parent_dir)) + for pkg, parent_dir in package_dir.items() + ) + self.dist.packages = list(pkgs) + log.debug(f"discovered packages -- {self.dist.packages}") + return True + + def _analyse_src_layout(self) -> bool: + """Try to find all packages or modules under the ``src`` directory + (or anything pointed by ``package_dir[""]``). + + The "src-layout" is relatively safe for automatic discovery. + We assume that everything within is meant to be included in the + distribution. + + If ``package_dir[""]`` is not given, but the ``src`` directory exists, + this function will set ``package_dir[""] = "src"``. + """ + package_dir = self._package_dir + src_dir = os.path.join(self._root_dir, package_dir.get("", "src")) + if not os.path.isdir(src_dir): + return False + + log.debug(f"`src-layout` detected -- analysing {src_dir}") + package_dir.setdefault("", os.path.basename(src_dir)) + self.dist.package_dir = package_dir # persist eventual modifications + self.dist.packages = PEP420PackageFinder.find(src_dir) + self.dist.py_modules = ModuleFinder.find(src_dir) + log.debug(f"discovered packages -- {self.dist.packages}") + log.debug(f"discovered py_modules -- {self.dist.py_modules}") + return True + + def _analyse_flat_layout(self) -> bool: + """Try to find all packages and modules under the project root. + + Since the ``flat-layout`` is more dangerous in terms of accidentally including + extra files/directories, this function is more conservative and will raise an + error if multiple packages or modules are found. + + This assumes that multi-package dists are uncommon and refuse to support that + use case in order to be able to prevent unintended errors. + """ + log.debug(f"`flat-layout` detected -- analysing {self._root_dir}") + return self._analyse_flat_packages() or self._analyse_flat_modules() + + def _analyse_flat_packages(self) -> bool: + self.dist.packages = FlatLayoutPackageFinder.find(self._root_dir) + top_level = remove_nested_packages(remove_stubs(self.dist.packages)) + log.debug(f"discovered packages -- {self.dist.packages}") + self._ensure_no_accidental_inclusion(top_level, "packages") + return bool(top_level) + + def _analyse_flat_modules(self) -> bool: + self.dist.py_modules = FlatLayoutModuleFinder.find(self._root_dir) + log.debug(f"discovered py_modules -- {self.dist.py_modules}") + self._ensure_no_accidental_inclusion(self.dist.py_modules, "modules") + return bool(self.dist.py_modules) + + def _ensure_no_accidental_inclusion(self, detected: list[str], kind: str): + if len(detected) > 1: + from inspect import cleandoc + + from setuptools.errors import PackageDiscoveryError + + msg = f"""Multiple top-level {kind} discovered in a flat-layout: {detected}. + + To avoid accidental inclusion of unwanted files or directories, + setuptools will not proceed with this build. + + If you are trying to create a single distribution with multiple {kind} + on purpose, you should not rely on automatic discovery. + Instead, consider the following options: + + 1. set up custom discovery (`find` directive with `include` or `exclude`) + 2. use a `src-layout` + 3. explicitly set `py_modules` or `packages` with a list of names + + To find more information, look for "package discovery" on setuptools docs. + """ + raise PackageDiscoveryError(cleandoc(msg)) + + def analyse_name(self) -> None: + """The packages/modules are the essential contribution of the author. + Therefore the name of the distribution can be derived from them. + """ + if self.dist.metadata.name or self.dist.name: + # get_name() is not reliable (can return "UNKNOWN") + return + + log.debug("No `name` configuration, performing automatic discovery") + + name = ( + self._find_name_single_package_or_module() + or self._find_name_from_packages() + ) + if name: + self.dist.metadata.name = name + + def _find_name_single_package_or_module(self) -> str | None: + """Exactly one module or package""" + for field in ('packages', 'py_modules'): + items = getattr(self.dist, field, None) or [] + if items and len(items) == 1: + log.debug(f"Single module/package detected, name: {items[0]}") + return items[0] + + return None + + def _find_name_from_packages(self) -> str | None: + """Try to find the root package that is not a PEP 420 namespace""" + if not self.dist.packages: + return None + + packages = remove_stubs(sorted(self.dist.packages, key=len)) + package_dir = self.dist.package_dir or {} + + parent_pkg = find_parent_package(packages, package_dir, self._root_dir) + if parent_pkg: + log.debug(f"Common parent package detected, name: {parent_pkg}") + return parent_pkg + + log.warn("No parent package detected, impossible to derive `name`") + return None + + +def remove_nested_packages(packages: list[str]) -> list[str]: + """Remove nested packages from a list of packages. + + >>> remove_nested_packages(["a", "a.b1", "a.b2", "a.b1.c1"]) + ['a'] + >>> remove_nested_packages(["a", "b", "c.d", "c.d.e.f", "g.h", "a.a1"]) + ['a', 'b', 'c.d', 'g.h'] + """ + pkgs = sorted(packages, key=len) + top_level = pkgs[:] + size = len(pkgs) + for i, name in enumerate(reversed(pkgs)): + if any(name.startswith(f"{other}.") for other in top_level): + top_level.pop(size - i - 1) + + return top_level + + +def remove_stubs(packages: list[str]) -> list[str]: + """Remove type stubs (:pep:`561`) from a list of packages. + + >>> remove_stubs(["a", "a.b", "a-stubs", "a-stubs.b.c", "b", "c-stubs"]) + ['a', 'a.b', 'b'] + """ + return [pkg for pkg in packages if not pkg.split(".")[0].endswith("-stubs")] + + +def find_parent_package( + packages: list[str], package_dir: Mapping[str, str], root_dir: StrPath +) -> str | None: + """Find the parent package that is not a namespace.""" + packages = sorted(packages, key=len) + common_ancestors = [] + for i, name in enumerate(packages): + if not all(n.startswith(f"{name}.") for n in packages[i + 1 :]): + # Since packages are sorted by length, this condition is able + # to find a list of all common ancestors. + # When there is divergence (e.g. multiple root packages) + # the list will be empty + break + common_ancestors.append(name) + + for name in common_ancestors: + pkg_path = find_package_path(name, package_dir, root_dir) + init = os.path.join(pkg_path, "__init__.py") + if os.path.isfile(init): + return name + + return None + + +def find_package_path( + name: str, package_dir: Mapping[str, str], root_dir: StrPath +) -> str: + """Given a package name, return the path where it should be found on + disk, considering the ``package_dir`` option. + + >>> path = find_package_path("my.pkg", {"": "root/is/nested"}, ".") + >>> path.replace(os.sep, "/") + './root/is/nested/my/pkg' + + >>> path = find_package_path("my.pkg", {"my": "root/is/nested"}, ".") + >>> path.replace(os.sep, "/") + './root/is/nested/pkg' + + >>> path = find_package_path("my.pkg", {"my.pkg": "root/is/nested"}, ".") + >>> path.replace(os.sep, "/") + './root/is/nested' + + >>> path = find_package_path("other.pkg", {"my.pkg": "root/is/nested"}, ".") + >>> path.replace(os.sep, "/") + './other/pkg' + """ + parts = name.split(".") + for i in range(len(parts), 0, -1): + # Look backwards, the most specific package_dir first + partial_name = ".".join(parts[:i]) + if partial_name in package_dir: + parent = package_dir[partial_name] + return os.path.join(root_dir, parent, *parts[i:]) + + parent = package_dir.get("") or "" + return os.path.join(root_dir, *parent.split("/"), *parts) + + +def construct_package_dir(packages: list[str], package_path: StrPath) -> dict[str, str]: + parent_pkgs = remove_nested_packages(packages) + prefix = Path(package_path).parts + return {pkg: "/".join([*prefix, *pkg.split(".")]) for pkg in parent_pkgs} diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/dist.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/dist.py new file mode 100644 index 0000000000000000000000000000000000000000..a224b3ee44cdbfb5fa76b2075c934b2f04c89924 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/dist.py @@ -0,0 +1,1124 @@ +from __future__ import annotations + +import functools +import io +import itertools +import numbers +import os +import re +import sys +from collections.abc import Iterable, Iterator, MutableMapping, Sequence +from glob import glob +from pathlib import Path +from typing import TYPE_CHECKING, Any, Union + +from more_itertools import partition, unique_everseen +from packaging.markers import InvalidMarker, Marker +from packaging.specifiers import InvalidSpecifier, SpecifierSet +from packaging.version import Version + +from . import ( + _entry_points, + _reqs, + _static, + command as _, # noqa: F401 # imported for side-effects +) +from ._importlib import metadata +from ._normalization import _canonicalize_license_expression +from ._path import StrPath +from ._reqs import _StrOrIter +from .config import pyprojecttoml, setupcfg +from .discovery import ConfigDiscovery +from .errors import InvalidConfigError +from .monkey import get_unpatched +from .warnings import InformationOnly, SetuptoolsDeprecationWarning + +import distutils.cmd +import distutils.command +import distutils.core +import distutils.dist +import distutils.log +from distutils.debug import DEBUG +from distutils.errors import DistutilsOptionError, DistutilsSetupError +from distutils.fancy_getopt import translate_longopt +from distutils.util import strtobool + +if TYPE_CHECKING: + from typing_extensions import TypeAlias + + +__all__ = ['Distribution'] + +_sequence = tuple, list +""" +:meta private: + +Supported iterable types that are known to be: +- ordered (which `set` isn't) +- not match a str (which `Sequence[str]` does) +- not imply a nested type (like `dict`) +for use with `isinstance`. +""" +_Sequence: TypeAlias = Union[tuple[str, ...], list[str]] +# This is how stringifying _Sequence would look in Python 3.10 +_sequence_type_repr = "tuple[str, ...] | list[str]" +_OrderedStrSequence: TypeAlias = Union[str, dict[str, Any], Sequence[str]] +""" +:meta private: +Avoid single-use iterable. Disallow sets. +A poor approximation of an OrderedSequence (dict doesn't match a Sequence). +""" + + +def __getattr__(name: str) -> Any: # pragma: no cover + if name == "sequence": + SetuptoolsDeprecationWarning.emit( + "`setuptools.dist.sequence` is an internal implementation detail.", + "Please define your own `sequence = tuple, list` instead.", + due_date=(2025, 8, 28), # Originally added on 2024-08-27 + ) + return _sequence + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") + + +def check_importable(dist, attr, value): + try: + ep = metadata.EntryPoint(value=value, name=None, group=None) + assert not ep.extras + except (TypeError, ValueError, AttributeError, AssertionError) as e: + raise DistutilsSetupError( + f"{attr!r} must be importable 'module:attrs' string (got {value!r})" + ) from e + + +def assert_string_list(dist, attr: str, value: _Sequence) -> None: + """Verify that value is a string list""" + try: + # verify that value is a list or tuple to exclude unordered + # or single-use iterables + assert isinstance(value, _sequence) + # verify that elements of value are strings + assert ''.join(value) != value + except (TypeError, ValueError, AttributeError, AssertionError) as e: + raise DistutilsSetupError( + f"{attr!r} must be of type <{_sequence_type_repr}> (got {value!r})" + ) from e + + +def check_nsp(dist, attr, value): + """Verify that namespace packages are valid""" + ns_packages = value + assert_string_list(dist, attr, ns_packages) + for nsp in ns_packages: + if not dist.has_contents_for(nsp): + raise DistutilsSetupError( + f"Distribution contains no modules or packages for namespace package {nsp!r}" + ) + parent, _sep, _child = nsp.rpartition('.') + if parent and parent not in ns_packages: + distutils.log.warn( + "WARNING: %r is declared as a package namespace, but %r" + " is not: please correct this in setup.py", + nsp, + parent, + ) + SetuptoolsDeprecationWarning.emit( + "The namespace_packages parameter is deprecated.", + "Please replace its usage with implicit namespaces (PEP 420).", + see_docs="references/keywords.html#keyword-namespace-packages", + # TODO: define due_date, it may break old packages that are no longer + # maintained (e.g. sphinxcontrib extensions) when installed from source. + # Warning officially introduced in May 2022, however the deprecation + # was mentioned much earlier in the docs (May 2020, see #2149). + ) + + +def check_extras(dist, attr, value): + """Verify that extras_require mapping is valid""" + try: + list(itertools.starmap(_check_extra, value.items())) + except (TypeError, ValueError, AttributeError) as e: + raise DistutilsSetupError( + "'extras_require' must be a dictionary whose values are " + "strings or lists of strings containing valid project/version " + "requirement specifiers." + ) from e + + +def _check_extra(extra, reqs): + _name, _sep, marker = extra.partition(':') + try: + _check_marker(marker) + except InvalidMarker: + msg = f"Invalid environment marker: {marker} ({extra!r})" + raise DistutilsSetupError(msg) from None + list(_reqs.parse(reqs)) + + +def _check_marker(marker): + if not marker: + return + m = Marker(marker) + m.evaluate() + + +def assert_bool(dist, attr, value): + """Verify that value is True, False, 0, or 1""" + if bool(value) != value: + raise DistutilsSetupError(f"{attr!r} must be a boolean value (got {value!r})") + + +def invalid_unless_false(dist, attr, value): + if not value: + DistDeprecationWarning.emit(f"{attr} is ignored.") + # TODO: should there be a `due_date` here? + return + raise DistutilsSetupError(f"{attr} is invalid.") + + +def check_requirements(dist, attr: str, value: _OrderedStrSequence) -> None: + """Verify that install_requires is a valid requirements list""" + try: + list(_reqs.parse(value)) + if isinstance(value, set): + raise TypeError("Unordered types are not allowed") + except (TypeError, ValueError) as error: + msg = ( + f"{attr!r} must be a string or iterable of strings " + f"containing valid project/version requirement specifiers; {error}" + ) + raise DistutilsSetupError(msg) from error + + +def check_specifier(dist, attr, value): + """Verify that value is a valid version specifier""" + try: + SpecifierSet(value) + except (InvalidSpecifier, AttributeError) as error: + msg = f"{attr!r} must be a string containing valid version specifiers; {error}" + raise DistutilsSetupError(msg) from error + + +def check_entry_points(dist, attr, value): + """Verify that entry_points map is parseable""" + try: + _entry_points.load(value) + except Exception as e: + raise DistutilsSetupError(e) from e + + +def check_package_data(dist, attr, value): + """Verify that value is a dictionary of package names to glob lists""" + if not isinstance(value, dict): + raise DistutilsSetupError( + f"{attr!r} must be a dictionary mapping package names to lists of " + "string wildcard patterns" + ) + for k, v in value.items(): + if not isinstance(k, str): + raise DistutilsSetupError( + f"keys of {attr!r} dict must be strings (got {k!r})" + ) + assert_string_list(dist, f'values of {attr!r} dict', v) + + +def check_packages(dist, attr, value): + for pkgname in value: + if not re.match(r'\w+(\.\w+)*', pkgname): + distutils.log.warn( + "WARNING: %r not a valid package name; please use only " + ".-separated package names in setup.py", + pkgname, + ) + + +if TYPE_CHECKING: + # Work around a mypy issue where type[T] can't be used as a base: https://github.com/python/mypy/issues/10962 + from distutils.core import Distribution as _Distribution +else: + _Distribution = get_unpatched(distutils.core.Distribution) + + +class Distribution(_Distribution): + """Distribution with support for tests and package data + + This is an enhanced version of 'distutils.dist.Distribution' that + effectively adds the following new optional keyword arguments to 'setup()': + + 'install_requires' -- a string or sequence of strings specifying project + versions that the distribution requires when installed, in the format + used by 'pkg_resources.require()'. They will be installed + automatically when the package is installed. If you wish to use + packages that are not available in PyPI, or want to give your users an + alternate download location, you can add a 'find_links' option to the + '[easy_install]' section of your project's 'setup.cfg' file, and then + setuptools will scan the listed web pages for links that satisfy the + requirements. + + 'extras_require' -- a dictionary mapping names of optional "extras" to the + additional requirement(s) that using those extras incurs. For example, + this:: + + extras_require = dict(reST = ["docutils>=0.3", "reSTedit"]) + + indicates that the distribution can optionally provide an extra + capability called "reST", but it can only be used if docutils and + reSTedit are installed. If the user installs your package using + EasyInstall and requests one of your extras, the corresponding + additional requirements will be installed if needed. + + 'package_data' -- a dictionary mapping package names to lists of filenames + or globs to use to find data files contained in the named packages. + If the dictionary has filenames or globs listed under '""' (the empty + string), those names will be searched for in every package, in addition + to any names for the specific package. Data files found using these + names/globs will be installed along with the package, in the same + location as the package. Note that globs are allowed to reference + the contents of non-package subdirectories, as long as you use '/' as + a path separator. (Globs are automatically converted to + platform-specific paths at runtime.) + + In addition to these new keywords, this class also has several new methods + for manipulating the distribution's contents. For example, the 'include()' + and 'exclude()' methods can be thought of as in-place add and subtract + commands that add or remove packages, modules, extensions, and so on from + the distribution. + """ + + _DISTUTILS_UNSUPPORTED_METADATA = { + 'long_description_content_type': lambda: None, + 'project_urls': dict, + 'provides_extras': dict, # behaves like an ordered set + 'license_expression': lambda: None, + 'license_file': lambda: None, + 'license_files': lambda: None, + 'install_requires': list, + 'extras_require': dict, + } + + # Used by build_py, editable_wheel and install_lib commands for legacy namespaces + namespace_packages: list[str] #: :meta private: DEPRECATED + + # Any: Dynamic assignment results in Incompatible types in assignment + def __init__(self, attrs: MutableMapping[str, Any] | None = None) -> None: + have_package_data = hasattr(self, "package_data") + if not have_package_data: + self.package_data: dict[str, list[str]] = {} + attrs = attrs or {} + self.dist_files: list[tuple[str, str, str]] = [] + self.include_package_data: bool | None = None + self.exclude_package_data: dict[str, list[str]] | None = None + # Filter-out setuptools' specific options. + self.src_root: str | None = attrs.pop("src_root", None) + self.dependency_links: list[str] = attrs.pop('dependency_links', []) + self.setup_requires: list[str] = attrs.pop('setup_requires', []) + for ep in metadata.entry_points(group='distutils.setup_keywords'): + vars(self).setdefault(ep.name, None) + + metadata_only = set(self._DISTUTILS_UNSUPPORTED_METADATA) + metadata_only -= {"install_requires", "extras_require"} + dist_attrs = {k: v for k, v in attrs.items() if k not in metadata_only} + _Distribution.__init__(self, dist_attrs) + + # Private API (setuptools-use only, not restricted to Distribution) + # Stores files that are referenced by the configuration and need to be in the + # sdist (e.g. `version = file: VERSION.txt`) + self._referenced_files = set[str]() + + self.set_defaults = ConfigDiscovery(self) + + self._set_metadata_defaults(attrs) + + self.metadata.version = self._normalize_version(self.metadata.version) + self._finalize_requires() + + def _validate_metadata(self): + required = {"name"} + provided = { + key + for key in vars(self.metadata) + if getattr(self.metadata, key, None) is not None + } + missing = required - provided + + if missing: + msg = f"Required package metadata is missing: {missing}" + raise DistutilsSetupError(msg) + + def _set_metadata_defaults(self, attrs): + """ + Fill-in missing metadata fields not supported by distutils. + Some fields may have been set by other tools (e.g. pbr). + Those fields (vars(self.metadata)) take precedence to + supplied attrs. + """ + for option, default in self._DISTUTILS_UNSUPPORTED_METADATA.items(): + vars(self.metadata).setdefault(option, attrs.get(option, default())) + + @staticmethod + def _normalize_version(version): + from . import sic + + if isinstance(version, numbers.Number): + # Some people apparently take "version number" too literally :) + version = str(version) + elif isinstance(version, sic) or version is None: + return version + + normalized = str(Version(version)) + if version != normalized: + InformationOnly.emit(f"Normalizing '{version}' to '{normalized}'") + return normalized + return version + + def _finalize_requires(self): + """ + Set `metadata.python_requires` and fix environment markers + in `install_requires` and `extras_require`. + """ + if getattr(self, 'python_requires', None): + self.metadata.python_requires = self.python_requires + + self._normalize_requires() + self.metadata.install_requires = self.install_requires + self.metadata.extras_require = self.extras_require + + if self.extras_require: + for extra in self.extras_require.keys(): + # Setuptools allows a weird ": syntax for extras + extra = extra.split(':')[0] + if extra: + self.metadata.provides_extras.setdefault(extra) + + def _normalize_requires(self): + """Make sure requirement-related attributes exist and are normalized""" + install_requires = getattr(self, "install_requires", None) or [] + extras_require = getattr(self, "extras_require", None) or {} + + # Preserve the "static"-ness of values parsed from config files + list_ = _static.List if _static.is_static(install_requires) else list + self.install_requires = list_(map(str, _reqs.parse(install_requires))) + + dict_ = _static.Dict if _static.is_static(extras_require) else dict + self.extras_require = dict_( + (k, list(map(str, _reqs.parse(v or [])))) for k, v in extras_require.items() + ) + + def _finalize_license_expression(self) -> None: + """ + Normalize license and license_expression. + >>> dist = Distribution({"license_expression": _static.Str("mit aNd gpl-3.0-OR-later")}) + >>> _static.is_static(dist.metadata.license_expression) + True + >>> dist._finalize_license_expression() + >>> _static.is_static(dist.metadata.license_expression) # preserve "static-ness" + True + >>> print(dist.metadata.license_expression) + MIT AND GPL-3.0-or-later + """ + classifiers = self.metadata.get_classifiers() + license_classifiers = [cl for cl in classifiers if cl.startswith("License :: ")] + + license_expr = self.metadata.license_expression + if license_expr: + str_ = _static.Str if _static.is_static(license_expr) else str + normalized = str_(_canonicalize_license_expression(license_expr)) + if license_expr != normalized: + InformationOnly.emit(f"Normalizing '{license_expr}' to '{normalized}'") + self.metadata.license_expression = normalized + if license_classifiers: + raise InvalidConfigError( + "License classifiers have been superseded by license expressions " + "(see https://peps.python.org/pep-0639/). Please remove:\n\n" + + "\n".join(license_classifiers), + ) + elif license_classifiers: + pypa_guides = "guides/writing-pyproject-toml/#license" + SetuptoolsDeprecationWarning.emit( + "License classifiers are deprecated.", + "Please consider removing the following classifiers in favor of a " + "SPDX license expression:\n\n" + "\n".join(license_classifiers), + see_url=f"https://packaging.python.org/en/latest/{pypa_guides}", + # Warning introduced on 2025-02-17 + # TODO: Should we add a due date? It may affect old/unmaintained + # packages in the ecosystem and cause problems... + ) + + def _finalize_license_files(self) -> None: + """Compute names of all license files which should be included.""" + license_files: list[str] | None = self.metadata.license_files + patterns = license_files or [] + + license_file: str | None = self.metadata.license_file + if license_file and license_file not in patterns: + patterns.append(license_file) + + if license_files is None and license_file is None: + # Default patterns match the ones wheel uses + # See https://wheel.readthedocs.io/en/stable/user_guide.html + # -> 'Including license files in the generated wheel file' + patterns = ['LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*'] + files = self._expand_patterns(patterns, enforce_match=False) + else: # Patterns explicitly given by the user + files = self._expand_patterns(patterns, enforce_match=True) + + self.metadata.license_files = list(unique_everseen(files)) + + @classmethod + def _expand_patterns( + cls, patterns: list[str], enforce_match: bool = True + ) -> Iterator[str]: + """ + >>> getfixture('sample_project_cwd') + >>> list(Distribution._expand_patterns(['LICENSE.txt'])) + ['LICENSE.txt'] + >>> list(Distribution._expand_patterns(['pyproject.toml', 'LIC*'])) + ['pyproject.toml', 'LICENSE.txt'] + >>> list(Distribution._expand_patterns(['src/**/*.dat'])) + ['src/sample/package_data.dat'] + """ + return ( + path.replace(os.sep, "/") + for pattern in patterns + for path in sorted(cls._find_pattern(pattern, enforce_match)) + if not path.endswith('~') and os.path.isfile(path) + ) + + @staticmethod + def _find_pattern(pattern: str, enforce_match: bool = True) -> list[str]: + r""" + >>> getfixture('sample_project_cwd') + >>> Distribution._find_pattern("LICENSE.txt") + ['LICENSE.txt'] + >>> Distribution._find_pattern("/LICENSE.MIT") + Traceback (most recent call last): + ... + setuptools.errors.InvalidConfigError: Pattern '/LICENSE.MIT' should be relative... + >>> Distribution._find_pattern("../LICENSE.MIT") + Traceback (most recent call last): + ... + setuptools.warnings.SetuptoolsDeprecationWarning: ...Pattern '../LICENSE.MIT' cannot contain '..'... + >>> Distribution._find_pattern("LICEN{CSE*") + Traceback (most recent call last): + ... + setuptools.warnings.SetuptoolsDeprecationWarning: ...Pattern 'LICEN{CSE*' contains invalid characters... + """ + pypa_guides = "specifications/glob-patterns/" + if ".." in pattern: + SetuptoolsDeprecationWarning.emit( + f"Pattern {pattern!r} cannot contain '..'", + """ + Please ensure the files specified are contained by the root + of the Python package (normally marked by `pyproject.toml`). + """, + see_url=f"https://packaging.python.org/en/latest/{pypa_guides}", + due_date=(2027, 2, 18), # Introduced in 2025-03-20 + # Replace with InvalidConfigError after deprecation + ) + if pattern.startswith((os.sep, "/")) or ":\\" in pattern: + raise InvalidConfigError( + f"Pattern {pattern!r} should be relative and must not start with '/'" + ) + if re.match(r'^[\w\-\.\/\*\?\[\]]+$', pattern) is None: + SetuptoolsDeprecationWarning.emit( + "Please provide a valid glob pattern.", + "Pattern {pattern!r} contains invalid characters.", + pattern=pattern, + see_url=f"https://packaging.python.org/en/latest/{pypa_guides}", + due_date=(2027, 2, 18), # Introduced in 2025-02-20 + ) + + found = glob(pattern, recursive=True) + + if enforce_match and not found: + SetuptoolsDeprecationWarning.emit( + "Cannot find any files for the given pattern.", + "Pattern {pattern!r} did not match any files.", + pattern=pattern, + due_date=(2027, 2, 18), # Introduced in 2025-02-20 + # PEP 639 requires us to error, but as a transition period + # we will only issue a warning to give people time to prepare. + # After the transition, this should raise an InvalidConfigError. + ) + return found + + # FIXME: 'Distribution._parse_config_files' is too complex (14) + def _parse_config_files(self, filenames=None): # noqa: C901 + """ + Adapted from distutils.dist.Distribution.parse_config_files, + this method provides the same functionality in subtly-improved + ways. + """ + from configparser import ConfigParser + + # Ignore install directory options if we have a venv + ignore_options = ( + [] + if sys.prefix == sys.base_prefix + else [ + 'install-base', + 'install-platbase', + 'install-lib', + 'install-platlib', + 'install-purelib', + 'install-headers', + 'install-scripts', + 'install-data', + 'prefix', + 'exec-prefix', + 'home', + 'user', + 'root', + ] + ) + + ignore_options = frozenset(ignore_options) + + if filenames is None: + filenames = self.find_config_files() + + if DEBUG: + self.announce("Distribution.parse_config_files():") + + parser = ConfigParser() + parser.optionxform = str + for filename in filenames: + with open(filename, encoding='utf-8') as reader: + if DEBUG: + self.announce(" reading {filename}".format(**locals())) + parser.read_file(reader) + for section in parser.sections(): + options = parser.options(section) + opt_dict = self.get_option_dict(section) + + for opt in options: + if opt == '__name__' or opt in ignore_options: + continue + + val = parser.get(section, opt) + opt = self._enforce_underscore(opt, section) + opt = self._enforce_option_lowercase(opt, section) + opt_dict[opt] = (filename, val) + + # Make the ConfigParser forget everything (so we retain + # the original filenames that options come from) + parser.__init__() + + if 'global' not in self.command_options: + return + + # If there was a "global" section in the config file, use it + # to set Distribution options. + + for opt, (src, val) in self.command_options['global'].items(): + alias = self.negative_opt.get(opt) + if alias: + val = not strtobool(val) + elif opt == 'verbose': + val = strtobool(val) + + try: + setattr(self, alias or opt, val) + except ValueError as e: + raise DistutilsOptionError(e) from e + + def _enforce_underscore(self, opt: str, section: str) -> str: + if "-" not in opt or self._skip_setupcfg_normalization(section): + return opt + + underscore_opt = opt.replace('-', '_') + affected = f"(Affected: {self.metadata.name})." if self.metadata.name else "" + SetuptoolsDeprecationWarning.emit( + f"Invalid dash-separated key {opt!r} in {section!r} (setup.cfg), " + f"please use the underscore name {underscore_opt!r} instead.", + f""" + Usage of dash-separated {opt!r} will not be supported in future + versions. Please use the underscore name {underscore_opt!r} instead. + {affected} + + Available configuration options are listed in: + https://setuptools.pypa.io/en/latest/userguide/declarative_config.html + """, + see_url="https://github.com/pypa/setuptools/discussions/5011", + due_date=(2026, 3, 3), + # Warning initially introduced in 3 Mar 2021 + ) + return underscore_opt + + def _enforce_option_lowercase(self, opt: str, section: str) -> str: + if opt.islower() or self._skip_setupcfg_normalization(section): + return opt + + lowercase_opt = opt.lower() + affected = f"(Affected: {self.metadata.name})." if self.metadata.name else "" + SetuptoolsDeprecationWarning.emit( + f"Invalid uppercase key {opt!r} in {section!r} (setup.cfg), " + f"please use lowercase {lowercase_opt!r} instead.", + f""" + Usage of uppercase key {opt!r} in {section!r} will not be supported in + future versions. Please use lowercase {lowercase_opt!r} instead. + {affected} + + Available configuration options are listed in: + https://setuptools.pypa.io/en/latest/userguide/declarative_config.html + """, + see_url="https://github.com/pypa/setuptools/discussions/5011", + due_date=(2026, 3, 3), + # Warning initially introduced in 6 Mar 2021 + ) + return lowercase_opt + + def _skip_setupcfg_normalization(self, section: str) -> bool: + skip = ( + 'options.extras_require', + 'options.data_files', + 'options.entry_points', + 'options.package_data', + 'options.exclude_package_data', + ) + return section in skip or not self._is_setuptools_section(section) + + def _is_setuptools_section(self, section: str) -> bool: + return ( + section == "metadata" + or section.startswith("options") + or section in _setuptools_commands() + ) + + # FIXME: 'Distribution._set_command_options' is too complex (14) + def _set_command_options(self, command_obj, option_dict=None): # noqa: C901 + """ + Set the options for 'command_obj' from 'option_dict'. Basically + this means copying elements of a dictionary ('option_dict') to + attributes of an instance ('command'). + + 'command_obj' must be a Command instance. If 'option_dict' is not + supplied, uses the standard option dictionary for this command + (from 'self.command_options'). + + (Adopted from distutils.dist.Distribution._set_command_options) + """ + command_name = command_obj.get_command_name() + if option_dict is None: + option_dict = self.get_option_dict(command_name) + + if DEBUG: + self.announce(f" setting options for '{command_name}' command:") + for option, (source, value) in option_dict.items(): + if DEBUG: + self.announce(f" {option} = {value} (from {source})") + try: + bool_opts = [translate_longopt(o) for o in command_obj.boolean_options] + except AttributeError: + bool_opts = [] + try: + neg_opt = command_obj.negative_opt + except AttributeError: + neg_opt = {} + + try: + is_string = isinstance(value, str) + if option in neg_opt and is_string: + setattr(command_obj, neg_opt[option], not strtobool(value)) + elif option in bool_opts and is_string: + setattr(command_obj, option, strtobool(value)) + elif hasattr(command_obj, option): + setattr(command_obj, option, value) + else: + raise DistutilsOptionError( + f"error in {source}: command '{command_name}' has no such option '{option}'" + ) + except ValueError as e: + raise DistutilsOptionError(e) from e + + def _get_project_config_files(self, filenames: Iterable[StrPath] | None): + """Add default file and split between INI and TOML""" + tomlfiles = [] + standard_project_metadata = Path(self.src_root or os.curdir, "pyproject.toml") + if filenames is not None: + parts = partition(lambda f: Path(f).suffix == ".toml", filenames) + filenames = list(parts[0]) # 1st element => predicate is False + tomlfiles = list(parts[1]) # 2nd element => predicate is True + elif standard_project_metadata.exists(): + tomlfiles = [standard_project_metadata] + return filenames, tomlfiles + + def parse_config_files( + self, + filenames: Iterable[StrPath] | None = None, + ignore_option_errors: bool = False, + ) -> None: + """Parses configuration files from various levels + and loads configuration. + """ + inifiles, tomlfiles = self._get_project_config_files(filenames) + + self._parse_config_files(filenames=inifiles) + + setupcfg.parse_configuration( + self, self.command_options, ignore_option_errors=ignore_option_errors + ) + for filename in tomlfiles: + pyprojecttoml.apply_configuration(self, filename, ignore_option_errors) + + self._finalize_requires() + self._finalize_license_expression() + self._finalize_license_files() + + def fetch_build_eggs(self, requires: _StrOrIter) -> list[metadata.Distribution]: + """Resolve pre-setup requirements""" + from .installer import _fetch_build_eggs + + return _fetch_build_eggs(self, requires) + + def finalize_options(self) -> None: + """ + Allow plugins to apply arbitrary operations to the + distribution. Each hook may optionally define a 'order' + to influence the order of execution. Smaller numbers + go first and the default is 0. + """ + group = 'setuptools.finalize_distribution_options' + + def by_order(hook): + return getattr(hook, 'order', 0) + + defined = metadata.entry_points(group=group) + filtered = itertools.filterfalse(self._removed, defined) + loaded = map(lambda e: e.load(), filtered) + for ep in sorted(loaded, key=by_order): + ep(self) + + @staticmethod + def _removed(ep): + """ + When removing an entry point, if metadata is loaded + from an older version of Setuptools, that removed + entry point will attempt to be loaded and will fail. + See #2765 for more details. + """ + removed = { + # removed 2021-09-05 + '2to3_doctests', + } + return ep.name in removed + + def _finalize_setup_keywords(self): + for ep in metadata.entry_points(group='distutils.setup_keywords'): + value = getattr(self, ep.name, None) + if value is not None: + ep.load()(self, ep.name, value) + + def get_egg_cache_dir(self) -> str: + from . import windows_support + + egg_cache_dir = os.path.join(os.curdir, '.eggs') + if not os.path.exists(egg_cache_dir): + os.mkdir(egg_cache_dir) + windows_support.hide_file(egg_cache_dir) + readme_txt_filename = os.path.join(egg_cache_dir, 'README.txt') + with open(readme_txt_filename, 'w', encoding="utf-8") as f: + f.write( + 'This directory contains eggs that were downloaded ' + 'by setuptools to build, test, and run plug-ins.\n\n' + ) + f.write( + 'This directory caches those eggs to prevent ' + 'repeated downloads.\n\n' + ) + f.write('However, it is safe to delete this directory.\n\n') + + return egg_cache_dir + + def fetch_build_egg(self, req): + """Fetch an egg needed for building""" + from .installer import fetch_build_egg + + return fetch_build_egg(self, req) + + def get_command_class(self, command: str) -> type[distutils.cmd.Command]: # type: ignore[override] # Not doing complex overrides yet + """Pluggable version of get_command_class()""" + if command in self.cmdclass: + return self.cmdclass[command] + + # Special case bdist_wheel so it's never loaded from "wheel" + if command == 'bdist_wheel': + from .command.bdist_wheel import bdist_wheel + + return bdist_wheel + + eps = metadata.entry_points(group='distutils.commands', name=command) + for ep in eps: + self.cmdclass[command] = cmdclass = ep.load() + return cmdclass + else: + return _Distribution.get_command_class(self, command) + + def print_commands(self): + for ep in metadata.entry_points(group='distutils.commands'): + if ep.name not in self.cmdclass: + cmdclass = ep.load() + self.cmdclass[ep.name] = cmdclass + return _Distribution.print_commands(self) + + def get_command_list(self): + for ep in metadata.entry_points(group='distutils.commands'): + if ep.name not in self.cmdclass: + cmdclass = ep.load() + self.cmdclass[ep.name] = cmdclass + return _Distribution.get_command_list(self) + + def include(self, **attrs) -> None: + """Add items to distribution that are named in keyword arguments + + For example, 'dist.include(py_modules=["x"])' would add 'x' to + the distribution's 'py_modules' attribute, if it was not already + there. + + Currently, this method only supports inclusion for attributes that are + lists or tuples. If you need to add support for adding to other + attributes in this or a subclass, you can add an '_include_X' method, + where 'X' is the name of the attribute. The method will be called with + the value passed to 'include()'. So, 'dist.include(foo={"bar":"baz"})' + will try to call 'dist._include_foo({"bar":"baz"})', which can then + handle whatever special inclusion logic is needed. + """ + for k, v in attrs.items(): + include = getattr(self, '_include_' + k, None) + if include: + include(v) + else: + self._include_misc(k, v) + + def exclude_package(self, package: str) -> None: + """Remove packages, modules, and extensions in named package""" + + pfx = package + '.' + if self.packages: + self.packages = [ + p for p in self.packages if p != package and not p.startswith(pfx) + ] + + if self.py_modules: + self.py_modules = [ + p for p in self.py_modules if p != package and not p.startswith(pfx) + ] + + if self.ext_modules: + self.ext_modules = [ + p + for p in self.ext_modules + if p.name != package and not p.name.startswith(pfx) + ] + + def has_contents_for(self, package: str) -> bool: + """Return true if 'exclude_package(package)' would do something""" + + pfx = package + '.' + + for p in self.iter_distribution_names(): + if p == package or p.startswith(pfx): + return True + + return False + + def _exclude_misc(self, name: str, value: _Sequence) -> None: + """Handle 'exclude()' for list/tuple attrs without a special handler""" + if not isinstance(value, _sequence): + raise DistutilsSetupError( + f"{name}: setting must be of type <{_sequence_type_repr}> (got {value!r})" + ) + try: + old = getattr(self, name) + except AttributeError as e: + raise DistutilsSetupError(f"{name}: No such distribution setting") from e + if old is not None and not isinstance(old, _sequence): + raise DistutilsSetupError( + name + ": this setting cannot be changed via include/exclude" + ) + elif old: + setattr(self, name, [item for item in old if item not in value]) + + def _include_misc(self, name: str, value: _Sequence) -> None: + """Handle 'include()' for list/tuple attrs without a special handler""" + + if not isinstance(value, _sequence): + raise DistutilsSetupError( + f"{name}: setting must be of type <{_sequence_type_repr}> (got {value!r})" + ) + try: + old = getattr(self, name) + except AttributeError as e: + raise DistutilsSetupError(f"{name}: No such distribution setting") from e + if old is None: + setattr(self, name, value) + elif not isinstance(old, _sequence): + raise DistutilsSetupError( + name + ": this setting cannot be changed via include/exclude" + ) + else: + new = [item for item in value if item not in old] + setattr(self, name, list(old) + new) + + def exclude(self, **attrs) -> None: + """Remove items from distribution that are named in keyword arguments + + For example, 'dist.exclude(py_modules=["x"])' would remove 'x' from + the distribution's 'py_modules' attribute. Excluding packages uses + the 'exclude_package()' method, so all of the package's contained + packages, modules, and extensions are also excluded. + + Currently, this method only supports exclusion from attributes that are + lists or tuples. If you need to add support for excluding from other + attributes in this or a subclass, you can add an '_exclude_X' method, + where 'X' is the name of the attribute. The method will be called with + the value passed to 'exclude()'. So, 'dist.exclude(foo={"bar":"baz"})' + will try to call 'dist._exclude_foo({"bar":"baz"})', which can then + handle whatever special exclusion logic is needed. + """ + for k, v in attrs.items(): + exclude = getattr(self, '_exclude_' + k, None) + if exclude: + exclude(v) + else: + self._exclude_misc(k, v) + + def _exclude_packages(self, packages: _Sequence) -> None: + if not isinstance(packages, _sequence): + raise DistutilsSetupError( + f"packages: setting must be of type <{_sequence_type_repr}> (got {packages!r})" + ) + list(map(self.exclude_package, packages)) + + def _parse_command_opts(self, parser, args): + # Remove --with-X/--without-X options when processing command args + self.global_options = self.__class__.global_options + self.negative_opt = self.__class__.negative_opt + + # First, expand any aliases + command = args[0] + aliases = self.get_option_dict('aliases') + while command in aliases: + _src, alias = aliases[command] + del aliases[command] # ensure each alias can expand only once! + import shlex + + args[:1] = shlex.split(alias, True) + command = args[0] + + nargs = _Distribution._parse_command_opts(self, parser, args) + + # Handle commands that want to consume all remaining arguments + cmd_class = self.get_command_class(command) + if getattr(cmd_class, 'command_consumes_arguments', None): + self.get_option_dict(command)['args'] = ("command line", nargs) + if nargs is not None: + return [] + + return nargs + + def get_cmdline_options(self) -> dict[str, dict[str, str | None]]: + """Return a '{cmd: {opt:val}}' map of all command-line options + + Option names are all long, but do not include the leading '--', and + contain dashes rather than underscores. If the option doesn't take + an argument (e.g. '--quiet'), the 'val' is 'None'. + + Note that options provided by config files are intentionally excluded. + """ + + d: dict[str, dict[str, str | None]] = {} + + for cmd, opts in self.command_options.items(): + val: str | None + for opt, (src, val) in opts.items(): + if src != "command line": + continue + + opt = opt.replace('_', '-') + + if val == 0: + cmdobj = self.get_command_obj(cmd) + neg_opt = self.negative_opt.copy() + neg_opt.update(getattr(cmdobj, 'negative_opt', {})) + for neg, pos in neg_opt.items(): + if pos == opt: + opt = neg + val = None + break + else: + raise AssertionError("Shouldn't be able to get here") + + elif val == 1: + val = None + + d.setdefault(cmd, {})[opt] = val + + return d + + def iter_distribution_names(self) -> Iterator[str]: + """Yield all packages, modules, and extension names in distribution""" + + yield from self.packages or () + + yield from self.py_modules or () + + for ext in self.ext_modules or (): + if isinstance(ext, tuple): + name, _buildinfo = ext + else: + name = ext.name + name = name.removesuffix('module') + yield name + + def handle_display_options(self, option_order): + """If there were any non-global "display-only" options + (--help-commands or the metadata display options) on the command + line, display the requested info and return true; else return + false. + """ + import sys + + if self.help_commands: + return _Distribution.handle_display_options(self, option_order) + + # Stdout may be StringIO (e.g. in tests) + if not isinstance(sys.stdout, io.TextIOWrapper): + return _Distribution.handle_display_options(self, option_order) + + # Don't wrap stdout if utf-8 is already the encoding. Provides + # workaround for #334. + if sys.stdout.encoding.lower() in ('utf-8', 'utf8'): + return _Distribution.handle_display_options(self, option_order) + + # Print metadata in UTF-8 no matter the platform + encoding = sys.stdout.encoding + sys.stdout.reconfigure(encoding='utf-8') + try: + return _Distribution.handle_display_options(self, option_order) + finally: + sys.stdout.reconfigure(encoding=encoding) + + def run_command(self, command) -> None: + self.set_defaults() + # Postpone defaults until all explicit configuration is considered + # (setup() args, config files, command line and plugins) + + super().run_command(command) + + +@functools.cache +def _setuptools_commands() -> set[str]: + try: + # Use older API for importlib.metadata compatibility + entry_points = metadata.distribution('setuptools').entry_points + eps: Iterable[str] = (ep.name for ep in entry_points) + except metadata.PackageNotFoundError: + # during bootstrapping, distribution doesn't exist + eps = [] + return {*distutils.command.__all__, *eps} + + +class DistDeprecationWarning(SetuptoolsDeprecationWarning): + """Class for warning about deprecations in dist in + setuptools. Not ignored by default, unlike DeprecationWarning.""" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/errors.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/errors.py new file mode 100644 index 0000000000000000000000000000000000000000..990ecbf4e2f18eb188addc9e0466152a20193a90 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/errors.py @@ -0,0 +1,67 @@ +"""setuptools.errors + +Provides exceptions used by setuptools modules. +""" + +from __future__ import annotations + +from distutils import errors as _distutils_errors + +# Re-export errors from distutils to facilitate the migration to PEP632 + +ByteCompileError = _distutils_errors.DistutilsByteCompileError +CCompilerError = _distutils_errors.CCompilerError +ClassError = _distutils_errors.DistutilsClassError +CompileError = _distutils_errors.CompileError +ExecError = _distutils_errors.DistutilsExecError +FileError = _distutils_errors.DistutilsFileError +InternalError = _distutils_errors.DistutilsInternalError +LibError = _distutils_errors.LibError +LinkError = _distutils_errors.LinkError +ModuleError = _distutils_errors.DistutilsModuleError +OptionError = _distutils_errors.DistutilsOptionError +PlatformError = _distutils_errors.DistutilsPlatformError +PreprocessError = _distutils_errors.PreprocessError +SetupError = _distutils_errors.DistutilsSetupError +TemplateError = _distutils_errors.DistutilsTemplateError +UnknownFileError = _distutils_errors.UnknownFileError + +# The root error class in the hierarchy +BaseError = _distutils_errors.DistutilsError + + +class InvalidConfigError(OptionError): # type: ignore[valid-type, misc] # distutils imports are `Any` on python 3.12+ + """Error used for invalid configurations.""" + + +class RemovedConfigError(OptionError): # type: ignore[valid-type, misc] # distutils imports are `Any` on python 3.12+ + """Error used for configurations that were deprecated and removed.""" + + +class RemovedCommandError(BaseError, RuntimeError): # type: ignore[valid-type, misc] # distutils imports are `Any` on python 3.12+ + """Error used for commands that have been removed in setuptools. + + Since ``setuptools`` is built on ``distutils``, simply removing a command + from ``setuptools`` will make the behavior fall back to ``distutils``; this + error is raised if a command exists in ``distutils`` but has been actively + removed in ``setuptools``. + """ + + +class PackageDiscoveryError(BaseError, RuntimeError): # type: ignore[valid-type, misc] # distutils imports are `Any` on python 3.12+ + """Impossible to perform automatic discovery of packages and/or modules. + + The current project layout or given discovery options can lead to problems when + scanning the project directory. + + Setuptools might also refuse to complete auto-discovery if an error prone condition + is detected (e.g. when a project is organised as a flat-layout but contains + multiple directories that can be taken as top-level packages inside a single + distribution [*]_). In these situations the users are encouraged to be explicit + about which packages to include or to make the discovery parameters more specific. + + .. [*] Since multi-package distributions are uncommon it is very likely that the + developers did not intend for all the directories to be packaged, and are just + leaving auxiliary code in the repository top-level, such as maintenance-related + scripts. + """ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/extension.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/extension.py new file mode 100644 index 0000000000000000000000000000000000000000..3e63cbe12aefc3b52a5d1ca2fe3e1ca2e172e29d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/extension.py @@ -0,0 +1,179 @@ +from __future__ import annotations + +import functools +import re +from collections.abc import Iterable +from typing import TYPE_CHECKING + +from setuptools._path import StrPath + +from .monkey import get_unpatched + +import distutils.core +import distutils.errors +import distutils.extension + + +def _have_cython() -> bool: + """ + Return True if Cython can be imported. + """ + cython_impl = 'Cython.Distutils.build_ext' + try: + # from (cython_impl) import build_ext + __import__(cython_impl, fromlist=['build_ext']).build_ext + except Exception: + return False + return True + + +# for compatibility +have_pyrex = _have_cython +if TYPE_CHECKING: + # Work around a mypy issue where type[T] can't be used as a base: https://github.com/python/mypy/issues/10962 + from distutils.core import Extension as _Extension +else: + _Extension = get_unpatched(distutils.core.Extension) + + +class Extension(_Extension): + """ + Describes a single extension module. + + This means that all source files will be compiled into a single binary file + ``.`` (with ```` derived from ``name`` and + ```` defined by one of the values in + ``importlib.machinery.EXTENSION_SUFFIXES``). + + In the case ``.pyx`` files are passed as ``sources and`` ``Cython`` is **not** + installed in the build environment, ``setuptools`` may also try to look for the + equivalent ``.cpp`` or ``.c`` files. + + :arg str name: + the full name of the extension, including any packages -- ie. + *not* a filename or pathname, but Python dotted name + + :arg Iterable[str | os.PathLike[str]] sources: + iterable of source filenames, (except strings, which could be misinterpreted + as a single filename), relative to the distribution root + (where the setup script lives), in Unix form (slash-separated) + for portability. Source files may be C, C++, SWIG (.i), + platform-specific resource files, or whatever else is recognized + by the "build_ext" command as source for a Python extension. + + :keyword list[str] include_dirs: + list of directories to search for C/C++ header files (in Unix + form for portability) + + :keyword list[tuple[str, str|None]] define_macros: + list of macros to define; each macro is defined using a 2-tuple: + the first item corresponding to the name of the macro and the second + item either a string with its value or None to + define it without a particular value (equivalent of "#define + FOO" in source or -DFOO on Unix C compiler command line) + + :keyword list[str] undef_macros: + list of macros to undefine explicitly + + :keyword list[str] library_dirs: + list of directories to search for C/C++ libraries at link time + + :keyword list[str] libraries: + list of library names (not filenames or paths) to link against + + :keyword list[str] runtime_library_dirs: + list of directories to search for C/C++ libraries at run time + (for shared extensions, this is when the extension is loaded). + Setting this will cause an exception during build on Windows + platforms. + + :keyword list[str] extra_objects: + list of extra files to link with (eg. object files not implied + by 'sources', static library that must be explicitly specified, + binary resource files, etc.) + + :keyword list[str] extra_compile_args: + any extra platform- and compiler-specific information to use + when compiling the source files in 'sources'. For platforms and + compilers where "command line" makes sense, this is typically a + list of command-line arguments, but for other platforms it could + be anything. + + :keyword list[str] extra_link_args: + any extra platform- and compiler-specific information to use + when linking object files together to create the extension (or + to create a new static Python interpreter). Similar + interpretation as for 'extra_compile_args'. + + :keyword list[str] export_symbols: + list of symbols to be exported from a shared extension. Not + used on all platforms, and not generally necessary for Python + extensions, which typically export exactly one symbol: "init" + + extension_name. + + :keyword list[str] swig_opts: + any extra options to pass to SWIG if a source file has the .i + extension. + + :keyword list[str] depends: + list of files that the extension depends on + + :keyword str language: + extension language (i.e. "c", "c++", "objc"). Will be detected + from the source extensions if not provided. + + :keyword bool optional: + specifies that a build failure in the extension should not abort the + build process, but simply not install the failing extension. + + :keyword bool py_limited_api: + opt-in flag for the usage of :doc:`Python's limited API `. + + :raises setuptools.errors.PlatformError: if ``runtime_library_dirs`` is + specified on Windows. (since v63) + """ + + # These 4 are set and used in setuptools/command/build_ext.py + # The lack of a default value and risk of `AttributeError` is purposeful + # to avoid people forgetting to call finalize_options if they modify the extension list. + # See example/rationale in https://github.com/pypa/setuptools/issues/4529. + _full_name: str #: Private API, internal use only. + _links_to_dynamic: bool #: Private API, internal use only. + _needs_stub: bool #: Private API, internal use only. + _file_name: str #: Private API, internal use only. + + def __init__( + self, + name: str, + sources: Iterable[StrPath], + *args, + py_limited_api: bool = False, + **kw, + ) -> None: + # The *args is needed for compatibility as calls may use positional + # arguments. py_limited_api may be set only via keyword. + self.py_limited_api = py_limited_api + super().__init__( + name, + sources, # type: ignore[arg-type] # Vendored version of setuptools supports PathLike + *args, + **kw, + ) + + def _convert_pyx_sources_to_lang(self): + """ + Replace sources with .pyx extensions to sources with the target + language extension. This mechanism allows language authors to supply + pre-converted sources but to prefer the .pyx sources. + """ + if _have_cython(): + # the build has Cython, so allow it to compile the .pyx files + return + lang = self.language or '' + target_ext = '.cpp' if lang.lower() == 'c++' else '.c' + sub = functools.partial(re.sub, '.pyx$', target_ext) + self.sources = list(map(sub, self.sources)) + + +class Library(Extension): + """Just like a regular Extension, but built as a library instead""" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/glob.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/glob.py new file mode 100644 index 0000000000000000000000000000000000000000..1dfff2cd50ff87b8cef9d936f1fc9d4a2478b136 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/glob.py @@ -0,0 +1,185 @@ +""" +Filename globbing utility. Mostly a copy of `glob` from Python 3.5. + +Changes include: + * `yield from` and PEP3102 `*` removed. + * Hidden files are not ignored. +""" + +from __future__ import annotations + +import fnmatch +import os +import re +from collections.abc import Iterable, Iterator +from typing import TYPE_CHECKING, AnyStr, overload + +if TYPE_CHECKING: + from _typeshed import BytesPath, StrOrBytesPath, StrPath + +__all__ = ["glob", "iglob", "escape"] + + +def glob(pathname: AnyStr, recursive: bool = False) -> list[AnyStr]: + """Return a list of paths matching a pathname pattern. + + The pattern may contain simple shell-style wildcards a la + fnmatch. However, unlike fnmatch, filenames starting with a + dot are special cases that are not matched by '*' and '?' + patterns. + + If recursive is true, the pattern '**' will match any files and + zero or more directories and subdirectories. + """ + return list(iglob(pathname, recursive=recursive)) + + +def iglob(pathname: AnyStr, recursive: bool = False) -> Iterator[AnyStr]: + """Return an iterator which yields the paths matching a pathname pattern. + + The pattern may contain simple shell-style wildcards a la + fnmatch. However, unlike fnmatch, filenames starting with a + dot are special cases that are not matched by '*' and '?' + patterns. + + If recursive is true, the pattern '**' will match any files and + zero or more directories and subdirectories. + """ + it = _iglob(pathname, recursive) + if recursive and _isrecursive(pathname): + s = next(it) # skip empty string + assert not s + return it + + +def _iglob(pathname: AnyStr, recursive: bool) -> Iterator[AnyStr]: + dirname, basename = os.path.split(pathname) + glob_in_dir = glob2 if recursive and _isrecursive(basename) else glob1 + + if not has_magic(pathname): + if basename: + if os.path.lexists(pathname): + yield pathname + else: + # Patterns ending with a slash should match only directories + if os.path.isdir(dirname): + yield pathname + return + + if not dirname: + yield from glob_in_dir(dirname, basename) + return + # `os.path.split()` returns the argument itself as a dirname if it is a + # drive or UNC path. Prevent an infinite recursion if a drive or UNC path + # contains magic characters (i.e. r'\\?\C:'). + if dirname != pathname and has_magic(dirname): + dirs: Iterable[AnyStr] = _iglob(dirname, recursive) + else: + dirs = [dirname] + if not has_magic(basename): + glob_in_dir = glob0 + for dirname in dirs: + for name in glob_in_dir(dirname, basename): + yield os.path.join(dirname, name) + + +# These 2 helper functions non-recursively glob inside a literal directory. +# They return a list of basenames. `glob1` accepts a pattern while `glob0` +# takes a literal basename (so it only has to check for its existence). + + +@overload +def glob1(dirname: StrPath, pattern: str) -> list[str]: ... +@overload +def glob1(dirname: BytesPath, pattern: bytes) -> list[bytes]: ... +def glob1(dirname: StrOrBytesPath, pattern: str | bytes) -> list[str] | list[bytes]: + if not dirname: + if isinstance(pattern, bytes): + dirname = os.curdir.encode('ASCII') + else: + dirname = os.curdir + try: + names = os.listdir(dirname) + except OSError: + return [] + # mypy false-positives: str or bytes type possibility is always kept in sync + return fnmatch.filter(names, pattern) # type: ignore[type-var, return-value] + + +def glob0(dirname, basename): + if not basename: + # `os.path.split()` returns an empty basename for paths ending with a + # directory separator. 'q*x/' should match only directories. + if os.path.isdir(dirname): + return [basename] + else: + if os.path.lexists(os.path.join(dirname, basename)): + return [basename] + return [] + + +# This helper function recursively yields relative pathnames inside a literal +# directory. + + +@overload +def glob2(dirname: StrPath, pattern: str) -> Iterator[str]: ... +@overload +def glob2(dirname: BytesPath, pattern: bytes) -> Iterator[bytes]: ... +def glob2(dirname: StrOrBytesPath, pattern: str | bytes) -> Iterator[str | bytes]: + assert _isrecursive(pattern) + yield pattern[:0] + yield from _rlistdir(dirname) + + +# Recursively yields relative pathnames inside a literal directory. +@overload +def _rlistdir(dirname: StrPath) -> Iterator[str]: ... +@overload +def _rlistdir(dirname: BytesPath) -> Iterator[bytes]: ... +def _rlistdir(dirname: StrOrBytesPath) -> Iterator[str | bytes]: + if not dirname: + if isinstance(dirname, bytes): + dirname = os.curdir.encode('ASCII') + else: + dirname = os.curdir + try: + names = os.listdir(dirname) + except OSError: + return + for x in names: + yield x + # mypy false-positives: str or bytes type possibility is always kept in sync + path = os.path.join(dirname, x) if dirname else x # type: ignore[arg-type] + for y in _rlistdir(path): + yield os.path.join(x, y) # type: ignore[arg-type] + + +magic_check = re.compile('([*?[])') +magic_check_bytes = re.compile(b'([*?[])') + + +def has_magic(s: str | bytes) -> bool: + if isinstance(s, bytes): + return magic_check_bytes.search(s) is not None + else: + return magic_check.search(s) is not None + + +def _isrecursive(pattern: str | bytes) -> bool: + if isinstance(pattern, bytes): + return pattern == b'**' + else: + return pattern == '**' + + +def escape(pathname): + """Escape all special characters.""" + # Escaping is done by wrapping any of "*?[" between square brackets. + # Metacharacters do not work in the drive part and shouldn't be escaped. + drive, pathname = os.path.splitdrive(pathname) + if isinstance(pathname, bytes): + pathname = magic_check_bytes.sub(rb'[\1]', pathname) + else: + pathname = magic_check.sub(r'[\1]', pathname) + return drive + pathname diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/gui-32.exe b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/gui-32.exe new file mode 100644 index 0000000000000000000000000000000000000000..1eb430c6d614a5daea4139badc09c222a4b0e72a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/gui-32.exe differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/gui-64.exe b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/gui-64.exe new file mode 100644 index 0000000000000000000000000000000000000000..031cb77c17ba8d8a983448268851d612e05e80d1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/gui-64.exe differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/gui-arm64.exe b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/gui-arm64.exe new file mode 100644 index 0000000000000000000000000000000000000000..1e00ffacb182c2af206e5dd9d9fbc41d236da0d1 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/gui-arm64.exe differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/gui.exe b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/gui.exe new file mode 100644 index 0000000000000000000000000000000000000000..1eb430c6d614a5daea4139badc09c222a4b0e72a Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/gui.exe differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/installer.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/installer.py new file mode 100644 index 0000000000000000000000000000000000000000..36a8b092279780d730fd0a3cc20c1c76bd72c8a0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/installer.py @@ -0,0 +1,155 @@ +from __future__ import annotations + +import glob +import itertools +import os +import subprocess +import sys +import tempfile + +import packaging.requirements +import packaging.utils + +from . import _reqs +from ._importlib import metadata +from .warnings import SetuptoolsDeprecationWarning +from .wheel import Wheel + +from distutils import log +from distutils.errors import DistutilsError + + +def _fixup_find_links(find_links): + """Ensure find-links option end-up being a list of strings.""" + if isinstance(find_links, str): + return find_links.split() + assert isinstance(find_links, (tuple, list)) + return find_links + + +def fetch_build_egg(dist, req) -> metadata.Distribution | metadata.PathDistribution: + """Fetch an egg needed for building. + + Use pip/wheel to fetch/build a wheel.""" + _DeprecatedInstaller.emit() + _warn_wheel_not_available(dist) + return _fetch_build_egg_no_warn(dist, req) + + +def _present(req): + return any(_dist_matches_req(dist, req) for dist in metadata.distributions()) + + +def _fetch_build_eggs(dist, requires: _reqs._StrOrIter) -> list[metadata.Distribution]: + _DeprecatedInstaller.emit(stacklevel=3) + _warn_wheel_not_available(dist) + + parsed_reqs = _reqs.parse(requires) + + missing_reqs = itertools.filterfalse(_present, parsed_reqs) + + needed_reqs = ( + req for req in missing_reqs if not req.marker or req.marker.evaluate() + ) + resolved_dists = [_fetch_build_egg_no_warn(dist, req) for req in needed_reqs] + for dist in resolved_dists: + # dist.locate_file('') is the directory containing EGG-INFO, where the importabl + # contents can be found. + sys.path.insert(0, str(dist.locate_file(''))) + return resolved_dists + + +def _dist_matches_req(egg_dist, req): + return ( + packaging.utils.canonicalize_name(egg_dist.name) + == packaging.utils.canonicalize_name(req.name) + and egg_dist.version in req.specifier + ) + + +def _fetch_build_egg_no_warn(dist, req): # noqa: C901 # is too complex (16) # FIXME + # Ignore environment markers; if supplied, it is required. + req = strip_marker(req) + # Take easy_install options into account, but do not override relevant + # pip environment variables (like PIP_INDEX_URL or PIP_QUIET); they'll + # take precedence. + opts = dist.get_option_dict('easy_install') + if 'allow_hosts' in opts: + raise DistutilsError( + 'the `allow-hosts` option is not supported ' + 'when using pip to install requirements.' + ) + quiet = 'PIP_QUIET' not in os.environ and 'PIP_VERBOSE' not in os.environ + if 'PIP_INDEX_URL' in os.environ: + index_url = None + elif 'index_url' in opts: + index_url = opts['index_url'][1] + else: + index_url = None + find_links = ( + _fixup_find_links(opts['find_links'][1])[:] if 'find_links' in opts else [] + ) + if dist.dependency_links: + find_links.extend(dist.dependency_links) + eggs_dir = os.path.realpath(dist.get_egg_cache_dir()) + cached_dists = metadata.Distribution.discover(path=glob.glob(f'{eggs_dir}/*.egg')) + for egg_dist in cached_dists: + if _dist_matches_req(egg_dist, req): + return egg_dist + with tempfile.TemporaryDirectory() as tmpdir: + cmd = [ + sys.executable, + '-m', + 'pip', + '--disable-pip-version-check', + 'wheel', + '--no-deps', + '-w', + tmpdir, + ] + if quiet: + cmd.append('--quiet') + if index_url is not None: + cmd.extend(('--index-url', index_url)) + for link in find_links or []: + cmd.extend(('--find-links', link)) + # If requirement is a PEP 508 direct URL, directly pass + # the URL to pip, as `req @ url` does not work on the + # command line. + cmd.append(req.url or str(req)) + try: + subprocess.check_call(cmd) + except subprocess.CalledProcessError as e: + raise DistutilsError(str(e)) from e + wheel = Wheel(glob.glob(os.path.join(tmpdir, '*.whl'))[0]) + dist_location = os.path.join(eggs_dir, wheel.egg_name()) + wheel.install_as_egg(dist_location) + return metadata.Distribution.at(dist_location + '/EGG-INFO') + + +def strip_marker(req) -> packaging.requirements.Requirement: + """ + Return a new requirement without the environment marker to avoid + calling pip with something like `babel; extra == "i18n"`, which + would always be ignored. + """ + # create a copy to avoid mutating the input + req = packaging.requirements.Requirement(str(req)) + req.marker = None + return req + + +def _warn_wheel_not_available(dist): + try: + metadata.distribution('wheel') + except metadata.PackageNotFoundError: + dist.announce('WARNING: The wheel package is not available.', log.WARN) + + +class _DeprecatedInstaller(SetuptoolsDeprecationWarning): + _SUMMARY = "setuptools.installer and fetch_build_eggs are deprecated." + _DETAILS = """ + Requirements should be satisfied by a PEP 517 installer. + If you are using pip, you can try `pip install --use-pep517`. + """ + _DUE_DATE = 2025, 10, 31 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/launch.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/launch.py new file mode 100644 index 0000000000000000000000000000000000000000..0d162647d55777d7afa1bf1e44a6c200a3f82419 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/launch.py @@ -0,0 +1,36 @@ +""" +Launch the Python script on the command line after +setuptools is bootstrapped via import. +""" + +# Note that setuptools gets imported implicitly by the +# invocation of this script using python -m setuptools.launch + +import sys +import tokenize + + +def run() -> None: + """ + Run the script in sys.argv[1] as if it had + been invoked naturally. + """ + __builtins__ + script_name = sys.argv[1] + namespace = dict( + __file__=script_name, + __name__='__main__', + __doc__=None, + ) + sys.argv[:] = sys.argv[1:] + + open_ = getattr(tokenize, 'open', open) + with open_(script_name) as fid: + script = fid.read() + norm_script = script.replace('\\r\\n', '\\n') + code = compile(norm_script, script_name, 'exec') + exec(code, namespace) + + +if __name__ == '__main__': + run() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/logging.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/logging.py new file mode 100644 index 0000000000000000000000000000000000000000..532da899f7dc02f9fea9a44c429086b98fe043d8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/logging.py @@ -0,0 +1,40 @@ +import inspect +import logging +import sys + +from . import monkey + +import distutils.log + + +def _not_warning(record): + return record.levelno < logging.WARNING + + +def configure() -> None: + """ + Configure logging to emit warning and above to stderr + and everything else to stdout. This behavior is provided + for compatibility with distutils.log but may change in + the future. + """ + err_handler = logging.StreamHandler() + err_handler.setLevel(logging.WARNING) + out_handler = logging.StreamHandler(sys.stdout) + out_handler.addFilter(_not_warning) + handlers = err_handler, out_handler + logging.basicConfig( + format="{message}", style='{', handlers=handlers, level=logging.DEBUG + ) + if inspect.ismodule(distutils.dist.log): + monkey.patch_func(set_threshold, distutils.log, 'set_threshold') + # For some reason `distutils.log` module is getting cached in `distutils.dist` + # and then loaded again when patched, + # implying: id(distutils.log) != id(distutils.dist.log). + # Make sure the same module object is used everywhere: + distutils.dist.log = distutils.log + + +def set_threshold(level: int) -> int: + logging.root.setLevel(level * 10) + return set_threshold.unpatched(level) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/modified.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/modified.py new file mode 100644 index 0000000000000000000000000000000000000000..6ba02fab68734e1e96fd50d7c4b6ffb1442717fb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/modified.py @@ -0,0 +1,18 @@ +try: + # Ensure a DistutilsError raised by these methods is the same as distutils.errors.DistutilsError + from distutils._modified import ( + newer, + newer_group, + newer_pairwise, + newer_pairwise_group, + ) +except ImportError: + # fallback for SETUPTOOLS_USE_DISTUTILS=stdlib, because _modified never existed in stdlib + from ._distutils._modified import ( + newer, + newer_group, + newer_pairwise, + newer_pairwise_group, + ) + +__all__ = ['newer', 'newer_pairwise', 'newer_group', 'newer_pairwise_group'] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/monkey.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/monkey.py new file mode 100644 index 0000000000000000000000000000000000000000..24bb8180f960a2cd62f352a41241e107e9521750 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/monkey.py @@ -0,0 +1,126 @@ +""" +Monkey patching of distutils. +""" + +from __future__ import annotations + +import inspect +import platform +import sys +import types +from typing import TypeVar, cast, overload + +import distutils.filelist + +_T = TypeVar("_T") +_UnpatchT = TypeVar("_UnpatchT", type, types.FunctionType) + + +__all__: list[str] = [] +""" +Everything is private. Contact the project team +if you think you need this functionality. +""" + + +def _get_mro(cls): + """ + Returns the bases classes for cls sorted by the MRO. + + Works around an issue on Jython where inspect.getmro will not return all + base classes if multiple classes share the same name. Instead, this + function will return a tuple containing the class itself, and the contents + of cls.__bases__. See https://github.com/pypa/setuptools/issues/1024. + """ + if platform.python_implementation() == "Jython": + return (cls,) + cls.__bases__ + return inspect.getmro(cls) + + +@overload +def get_unpatched(item: _UnpatchT) -> _UnpatchT: ... +@overload +def get_unpatched(item: object) -> None: ... +def get_unpatched( + item: type | types.FunctionType | object, +) -> type | types.FunctionType | None: + if isinstance(item, type): + return get_unpatched_class(item) + if isinstance(item, types.FunctionType): + return get_unpatched_function(item) + return None + + +def get_unpatched_class(cls: type[_T]) -> type[_T]: + """Protect against re-patching the distutils if reloaded + + Also ensures that no other distutils extension monkeypatched the distutils + first. + """ + external_bases = ( + cast(type[_T], cls) + for cls in _get_mro(cls) + if not cls.__module__.startswith('setuptools') + ) + base = next(external_bases) + if not base.__module__.startswith('distutils'): + msg = f"distutils has already been patched by {cls!r}" + raise AssertionError(msg) + return base + + +def patch_all() -> None: + import setuptools + + # we can't patch distutils.cmd, alas + distutils.core.Command = setuptools.Command # type: ignore[misc,assignment] # monkeypatching + + _patch_distribution_metadata() + + # Install Distribution throughout the distutils + for module in distutils.dist, distutils.core, distutils.cmd: + module.Distribution = setuptools.dist.Distribution + + # Install the patched Extension + distutils.core.Extension = setuptools.extension.Extension # type: ignore[misc,assignment] # monkeypatching + distutils.extension.Extension = setuptools.extension.Extension # type: ignore[misc,assignment] # monkeypatching + if 'distutils.command.build_ext' in sys.modules: + sys.modules[ + 'distutils.command.build_ext' + ].Extension = setuptools.extension.Extension + + +def _patch_distribution_metadata(): + from . import _core_metadata + + """Patch write_pkg_file and read_pkg_file for higher metadata standards""" + for attr in ( + 'write_pkg_info', + 'write_pkg_file', + 'read_pkg_file', + 'get_metadata_version', + 'get_fullname', + ): + new_val = getattr(_core_metadata, attr) + setattr(distutils.dist.DistributionMetadata, attr, new_val) + + +def patch_func(replacement, target_mod, func_name) -> None: + """ + Patch func_name in target_mod with replacement + + Important - original must be resolved by name to avoid + patching an already patched function. + """ + original = getattr(target_mod, func_name) + + # set the 'unpatched' attribute on the replacement to + # point to the original. + vars(replacement).setdefault('unpatched', original) + + # replace the function in the original module + setattr(target_mod, func_name, replacement) + + +def get_unpatched_function(candidate): + return candidate.unpatched diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/msvc.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/msvc.py new file mode 100644 index 0000000000000000000000000000000000000000..f506c8222dc1994dfd155f3b2c2404c62fc50659 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/msvc.py @@ -0,0 +1,1557 @@ +""" +Environment info about Microsoft Compilers. + +>>> getfixture('windows_only') +>>> ei = EnvironmentInfo('amd64') +""" + +from __future__ import annotations + +import contextlib +import itertools +import json +import os +import os.path +import platform +from typing import TYPE_CHECKING, TypedDict, overload + +from more_itertools import unique_everseen + +from ._path import StrPath +from .compat import py310 + +import distutils.errors + +if TYPE_CHECKING: + from typing_extensions import LiteralString, NotRequired + +# https://github.com/python/mypy/issues/8166 +if not TYPE_CHECKING and platform.system() == 'Windows': + import winreg + from os import environ +else: + # Mock winreg and environ so the module can be imported on this platform. + + class winreg: + HKEY_USERS = None + HKEY_CURRENT_USER = None + HKEY_LOCAL_MACHINE = None + HKEY_CLASSES_ROOT = None + + environ: dict[str, str] = dict() + + +class PlatformInfo: + """ + Current and Target Architectures information. + + Parameters + ---------- + arch: str + Target architecture. + """ + + current_cpu = environ.get('processor_architecture', '').lower() + + def __init__(self, arch: str) -> None: + self.arch = arch.lower().replace('x64', 'amd64') + + @property + def target_cpu(self) -> str: + """ + Return Target CPU architecture. + + Return + ------ + str + Target CPU + """ + return self.arch[self.arch.find('_') + 1 :] + + def target_is_x86(self) -> bool: + """ + Return True if target CPU is x86 32 bits.. + + Return + ------ + bool + CPU is x86 32 bits + """ + return self.target_cpu == 'x86' + + def current_is_x86(self) -> bool: + """ + Return True if current CPU is x86 32 bits.. + + Return + ------ + bool + CPU is x86 32 bits + """ + return self.current_cpu == 'x86' + + def current_dir(self, hidex86=False, x64=False) -> str: + """ + Current platform specific subfolder. + + Parameters + ---------- + hidex86: bool + return '' and not '\x86' if architecture is x86. + x64: bool + return '\x64' and not '\amd64' if architecture is amd64. + + Return + ------ + str + subfolder: '\target', or '' (see hidex86 parameter) + """ + return ( + '' + if (self.current_cpu == 'x86' and hidex86) + else r'\x64' + if (self.current_cpu == 'amd64' and x64) + else rf'\{self.current_cpu}' + ) + + def target_dir(self, hidex86=False, x64=False) -> str: + r""" + Target platform specific subfolder. + + Parameters + ---------- + hidex86: bool + return '' and not '\x86' if architecture is x86. + x64: bool + return '\x64' and not '\amd64' if architecture is amd64. + + Return + ------ + str + subfolder: '\current', or '' (see hidex86 parameter) + """ + return ( + '' + if (self.target_cpu == 'x86' and hidex86) + else r'\x64' + if (self.target_cpu == 'amd64' and x64) + else rf'\{self.target_cpu}' + ) + + def cross_dir(self, forcex86=False) -> str: + r""" + Cross platform specific subfolder. + + Parameters + ---------- + forcex86: bool + Use 'x86' as current architecture even if current architecture is + not x86. + + Return + ------ + str + subfolder: '' if target architecture is current architecture, + '\current_target' if not. + """ + current = 'x86' if forcex86 else self.current_cpu + return ( + '' + if self.target_cpu == current + else self.target_dir().replace('\\', f'\\{current}_') + ) + + +class RegistryInfo: + """ + Microsoft Visual Studio related registry information. + + Parameters + ---------- + platform_info: PlatformInfo + "PlatformInfo" instance. + """ + + HKEYS = ( + winreg.HKEY_USERS, + winreg.HKEY_CURRENT_USER, + winreg.HKEY_LOCAL_MACHINE, + winreg.HKEY_CLASSES_ROOT, + ) + + def __init__(self, platform_info: PlatformInfo) -> None: + self.pi = platform_info + + @property + def visualstudio(self) -> LiteralString: + """ + Microsoft Visual Studio root registry key. + + Return + ------ + str + Registry key + """ + return 'VisualStudio' + + @property + def sxs(self) -> LiteralString: + """ + Microsoft Visual Studio SxS registry key. + + Return + ------ + str + Registry key + """ + return os.path.join(self.visualstudio, 'SxS') + + @property + def vc(self) -> LiteralString: + """ + Microsoft Visual C++ VC7 registry key. + + Return + ------ + str + Registry key + """ + return os.path.join(self.sxs, 'VC7') + + @property + def vs(self) -> LiteralString: + """ + Microsoft Visual Studio VS7 registry key. + + Return + ------ + str + Registry key + """ + return os.path.join(self.sxs, 'VS7') + + @property + def vc_for_python(self) -> LiteralString: + """ + Microsoft Visual C++ for Python registry key. + + Return + ------ + str + Registry key + """ + return r'DevDiv\VCForPython' + + @property + def microsoft_sdk(self) -> LiteralString: + """ + Microsoft SDK registry key. + + Return + ------ + str + Registry key + """ + return 'Microsoft SDKs' + + @property + def windows_sdk(self) -> LiteralString: + """ + Microsoft Windows/Platform SDK registry key. + + Return + ------ + str + Registry key + """ + return os.path.join(self.microsoft_sdk, 'Windows') + + @property + def netfx_sdk(self) -> LiteralString: + """ + Microsoft .NET Framework SDK registry key. + + Return + ------ + str + Registry key + """ + return os.path.join(self.microsoft_sdk, 'NETFXSDK') + + @property + def windows_kits_roots(self) -> LiteralString: + """ + Microsoft Windows Kits Roots registry key. + + Return + ------ + str + Registry key + """ + return r'Windows Kits\Installed Roots' + + @overload + def microsoft(self, key: LiteralString, x86: bool = False) -> LiteralString: ... + @overload + def microsoft(self, key: str, x86: bool = False) -> str: ... # type: ignore[misc] + def microsoft(self, key: str, x86: bool = False) -> str: + """ + Return key in Microsoft software registry. + + Parameters + ---------- + key: str + Registry key path where look. + x86: bool + Force x86 software registry. + + Return + ------ + str + Registry key + """ + node64 = '' if self.pi.current_is_x86() or x86 else 'Wow6432Node' + return os.path.join('Software', node64, 'Microsoft', key) + + def lookup(self, key: str, name: str) -> str | None: + """ + Look for values in registry in Microsoft software registry. + + Parameters + ---------- + key: str + Registry key path where look. + name: str + Value name to find. + + Return + ------ + str | None + value + """ + key_read = winreg.KEY_READ + openkey = winreg.OpenKey + closekey = winreg.CloseKey + ms = self.microsoft + for hkey in self.HKEYS: + bkey = None + try: + bkey = openkey(hkey, ms(key), 0, key_read) + except OSError: + if not self.pi.current_is_x86(): + try: + bkey = openkey(hkey, ms(key, True), 0, key_read) + except OSError: + continue + else: + continue + try: + return winreg.QueryValueEx(bkey, name)[0] + except OSError: + pass + finally: + if bkey: + closekey(bkey) + return None + + +class SystemInfo: + """ + Microsoft Windows and Visual Studio related system information. + + Parameters + ---------- + registry_info: RegistryInfo + "RegistryInfo" instance. + vc_ver: float + Required Microsoft Visual C++ version. + """ + + # Variables and properties in this class use originals CamelCase variables + # names from Microsoft source files for more easy comparison. + WinDir = environ.get('WinDir', '') + ProgramFiles = environ.get('ProgramFiles', '') + ProgramFilesx86 = environ.get('ProgramFiles(x86)', ProgramFiles) + + def __init__( + self, registry_info: RegistryInfo, vc_ver: float | None = None + ) -> None: + self.ri = registry_info + self.pi = self.ri.pi + + self.known_vs_paths = self.find_programdata_vs_vers() + + # Except for VS15+, VC version is aligned with VS version + self.vs_ver = self.vc_ver = vc_ver or self._find_latest_available_vs_ver() + + def _find_latest_available_vs_ver(self): + """ + Find the latest VC version + + Return + ------ + float + version + """ + reg_vc_vers = self.find_reg_vs_vers() + + if not (reg_vc_vers or self.known_vs_paths): + raise distutils.errors.DistutilsPlatformError( + 'No Microsoft Visual C++ version found' + ) + + vc_vers = set(reg_vc_vers) + vc_vers.update(self.known_vs_paths) + return max(vc_vers) + + def find_reg_vs_vers(self) -> list[float]: + """ + Find Microsoft Visual Studio versions available in registry. + + Return + ------ + list of float + Versions + """ + ms = self.ri.microsoft + vckeys = (self.ri.vc, self.ri.vc_for_python, self.ri.vs) + vs_vers = [] + for hkey, key in itertools.product(self.ri.HKEYS, vckeys): + try: + bkey = winreg.OpenKey(hkey, ms(key), 0, winreg.KEY_READ) + except OSError: + continue + with bkey: + subkeys, values, _ = winreg.QueryInfoKey(bkey) + for i in range(values): + with contextlib.suppress(ValueError): + ver = float(winreg.EnumValue(bkey, i)[0]) + if ver not in vs_vers: + vs_vers.append(ver) + for i in range(subkeys): + with contextlib.suppress(ValueError): + ver = float(winreg.EnumKey(bkey, i)) + if ver not in vs_vers: + vs_vers.append(ver) + return sorted(vs_vers) + + def find_programdata_vs_vers(self) -> dict[float, str]: + r""" + Find Visual studio 2017+ versions from information in + "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances". + + Return + ------ + dict + float version as key, path as value. + """ + vs_versions: dict[float, str] = {} + instances_dir = r'C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances' + + try: + hashed_names = os.listdir(instances_dir) + + except OSError: + # Directory not exists with all Visual Studio versions + return vs_versions + + for name in hashed_names: + try: + # Get VS installation path from "state.json" file + state_path = os.path.join(instances_dir, name, 'state.json') + with open(state_path, 'rt', encoding='utf-8') as state_file: + state = json.load(state_file) + vs_path = state['installationPath'] + + # Raises OSError if this VS installation does not contain VC + os.listdir(os.path.join(vs_path, r'VC\Tools\MSVC')) + + # Store version and path + vs_versions[self._as_float_version(state['installationVersion'])] = ( + vs_path + ) + + except (OSError, KeyError): + # Skip if "state.json" file is missing or bad format + continue + + return vs_versions + + @staticmethod + def _as_float_version(version): + """ + Return a string version as a simplified float version (major.minor) + + Parameters + ---------- + version: str + Version. + + Return + ------ + float + version + """ + return float('.'.join(version.split('.')[:2])) + + @property + def VSInstallDir(self) -> str: + """ + Microsoft Visual Studio directory. + + Return + ------ + str + path + """ + # Default path + default = os.path.join( + self.ProgramFilesx86, f'Microsoft Visual Studio {self.vs_ver:0.1f}' + ) + + # Try to get path from registry, if fail use default path + return self.ri.lookup(self.ri.vs, f'{self.vs_ver:0.1f}') or default + + @property + def VCInstallDir(self) -> str: + """ + Microsoft Visual C++ directory. + + Return + ------ + str + path + """ + path = self._guess_vc() or self._guess_vc_legacy() + + if not os.path.isdir(path): + msg = 'Microsoft Visual C++ directory not found' + raise distutils.errors.DistutilsPlatformError(msg) + + return path + + def _guess_vc(self): + """ + Locate Visual C++ for VS2017+. + + Return + ------ + str + path + """ + if self.vs_ver <= 14.0: + return '' + + try: + # First search in known VS paths + vs_dir = self.known_vs_paths[self.vs_ver] + except KeyError: + # Else, search with path from registry + vs_dir = self.VSInstallDir + + guess_vc = os.path.join(vs_dir, r'VC\Tools\MSVC') + + # Subdir with VC exact version as name + try: + # Update the VC version with real one instead of VS version + vc_ver = os.listdir(guess_vc)[-1] + self.vc_ver = self._as_float_version(vc_ver) + return os.path.join(guess_vc, vc_ver) + except (OSError, IndexError): + return '' + + def _guess_vc_legacy(self): + """ + Locate Visual C++ for versions prior to 2017. + + Return + ------ + str + path + """ + default = os.path.join( + self.ProgramFilesx86, + rf'Microsoft Visual Studio {self.vs_ver:0.1f}\VC', + ) + + # Try to get "VC++ for Python" path from registry as default path + reg_path = os.path.join(self.ri.vc_for_python, f'{self.vs_ver:0.1f}') + python_vc = self.ri.lookup(reg_path, 'installdir') + default_vc = os.path.join(python_vc, 'VC') if python_vc else default + + # Try to get path from registry, if fail use default path + return self.ri.lookup(self.ri.vc, f'{self.vs_ver:0.1f}') or default_vc + + @property + def WindowsSdkVersion(self) -> tuple[LiteralString, ...]: + """ + Microsoft Windows SDK versions for specified MSVC++ version. + + Return + ------ + tuple of str + versions + """ + if self.vs_ver <= 9.0: + return '7.0', '6.1', '6.0a' + elif self.vs_ver == 10.0: + return '7.1', '7.0a' + elif self.vs_ver == 11.0: + return '8.0', '8.0a' + elif self.vs_ver == 12.0: + return '8.1', '8.1a' + elif self.vs_ver >= 14.0: + return '10.0', '8.1' + return () + + @property + def WindowsSdkLastVersion(self) -> str: + """ + Microsoft Windows SDK last version. + + Return + ------ + str + version + """ + return self._use_last_dir_name(os.path.join(self.WindowsSdkDir, 'lib')) + + @property + def WindowsSdkDir(self) -> str: # noqa: C901 # is too complex (12) # FIXME + """ + Microsoft Windows SDK directory. + + Return + ------ + str + path + """ + sdkdir: str | None = '' + for ver in self.WindowsSdkVersion: + # Try to get it from registry + loc = os.path.join(self.ri.windows_sdk, f'v{ver}') + sdkdir = self.ri.lookup(loc, 'installationfolder') + if sdkdir: + break + if not sdkdir or not os.path.isdir(sdkdir): + # Try to get "VC++ for Python" version from registry + path = os.path.join(self.ri.vc_for_python, f'{self.vc_ver:0.1f}') + install_base = self.ri.lookup(path, 'installdir') + if install_base: + sdkdir = os.path.join(install_base, 'WinSDK') + if not sdkdir or not os.path.isdir(sdkdir): + # If fail, use default new path + for ver in self.WindowsSdkVersion: + intver = ver[: ver.rfind('.')] + path = rf'Microsoft SDKs\Windows Kits\{intver}' + d = os.path.join(self.ProgramFiles, path) + if os.path.isdir(d): + sdkdir = d + if not sdkdir or not os.path.isdir(sdkdir): + # If fail, use default old path + for ver in self.WindowsSdkVersion: + path = rf'Microsoft SDKs\Windows\v{ver}' + d = os.path.join(self.ProgramFiles, path) + if os.path.isdir(d): + sdkdir = d + if not sdkdir: + # If fail, use Platform SDK + sdkdir = os.path.join(self.VCInstallDir, 'PlatformSDK') + return sdkdir + + @property + def WindowsSDKExecutablePath(self) -> str | None: + """ + Microsoft Windows SDK executable directory. + + Return + ------ + str | None + path + """ + # Find WinSDK NetFx Tools registry dir name + if self.vs_ver <= 11.0: + netfxver = 35 + arch = '' + else: + netfxver = 40 + hidex86 = True if self.vs_ver <= 12.0 else False + arch = self.pi.current_dir(x64=True, hidex86=hidex86).replace('\\', '-') + fx = f'WinSDK-NetFx{netfxver}Tools{arch}' + + # list all possibles registry paths + regpaths = [] + if self.vs_ver >= 14.0: + for ver in self.NetFxSdkVersion: + regpaths += [os.path.join(self.ri.netfx_sdk, ver, fx)] + + for ver in self.WindowsSdkVersion: + regpaths += [os.path.join(self.ri.windows_sdk, f'v{ver}A', fx)] + + # Return installation folder from the more recent path + for path in regpaths: + execpath = self.ri.lookup(path, 'installationfolder') + if execpath: + return execpath + + return None + + @property + def FSharpInstallDir(self) -> str: + """ + Microsoft Visual F# directory. + + Return + ------ + str + path + """ + path = os.path.join(self.ri.visualstudio, rf'{self.vs_ver:0.1f}\Setup\F#') + return self.ri.lookup(path, 'productdir') or '' + + @property + def UniversalCRTSdkDir(self) -> str | None: + """ + Microsoft Universal CRT SDK directory. + + Return + ------ + str | None + path + """ + # Set Kit Roots versions for specified MSVC++ version + vers = ('10', '81') if self.vs_ver >= 14.0 else () + + # Find path of the more recent Kit + for ver in vers: + sdkdir = self.ri.lookup(self.ri.windows_kits_roots, f'kitsroot{ver}') + if sdkdir: + return sdkdir + + return None + + @property + def UniversalCRTSdkLastVersion(self) -> str: + """ + Microsoft Universal C Runtime SDK last version. + + Return + ------ + str + version + """ + try: + return self._use_last_dir_name(os.path.join(self.UniversalCRTSdkDir, 'lib')) # type: ignore[arg-type] # Expected TypeError + except TypeError as ex: + py310.add_note(ex, "Cannot find UniversalCRTSdkDir") + raise + + @property + def NetFxSdkVersion(self) -> tuple[LiteralString, ...]: + """ + Microsoft .NET Framework SDK versions. + + Return + ------ + tuple of str + versions + """ + # Set FxSdk versions for specified VS version + return ( + ('4.7.2', '4.7.1', '4.7', '4.6.2', '4.6.1', '4.6', '4.5.2', '4.5.1', '4.5') + if self.vs_ver >= 14.0 + else () + ) + + @property + def NetFxSdkDir(self) -> str | None: + """ + Microsoft .NET Framework SDK directory. + + Return + ------ + str | None + path + """ + sdkdir: str | None = '' + for ver in self.NetFxSdkVersion: + loc = os.path.join(self.ri.netfx_sdk, ver) + sdkdir = self.ri.lookup(loc, 'kitsinstallationfolder') + if sdkdir: + break + return sdkdir + + @property + def FrameworkDir32(self) -> str: + """ + Microsoft .NET Framework 32bit directory. + + Return + ------ + str + path + """ + # Default path + guess_fw = os.path.join(self.WinDir, r'Microsoft.NET\Framework') + + # Try to get path from registry, if fail use default path + return self.ri.lookup(self.ri.vc, 'frameworkdir32') or guess_fw + + @property + def FrameworkDir64(self) -> str: + """ + Microsoft .NET Framework 64bit directory. + + Return + ------ + str + path + """ + # Default path + guess_fw = os.path.join(self.WinDir, r'Microsoft.NET\Framework64') + + # Try to get path from registry, if fail use default path + return self.ri.lookup(self.ri.vc, 'frameworkdir64') or guess_fw + + @property + def FrameworkVersion32(self) -> tuple[str, ...]: + """ + Microsoft .NET Framework 32bit versions. + + Return + ------ + tuple of str + versions + """ + return self._find_dot_net_versions(32) + + @property + def FrameworkVersion64(self) -> tuple[str, ...]: + """ + Microsoft .NET Framework 64bit versions. + + Return + ------ + tuple of str + versions + """ + return self._find_dot_net_versions(64) + + def _find_dot_net_versions(self, bits) -> tuple[str, ...]: + """ + Find Microsoft .NET Framework versions. + + Parameters + ---------- + bits: int + Platform number of bits: 32 or 64. + + Return + ------ + tuple of str + versions + """ + # Find actual .NET version in registry + reg_ver = self.ri.lookup(self.ri.vc, f'frameworkver{bits}') + dot_net_dir = getattr(self, f'FrameworkDir{bits}') + ver = reg_ver or self._use_last_dir_name(dot_net_dir, 'v') or '' + + # Set .NET versions for specified MSVC++ version + if self.vs_ver >= 12.0: + return ver, 'v4.0' + elif self.vs_ver >= 10.0: + return 'v4.0.30319' if ver.lower()[:2] != 'v4' else ver, 'v3.5' + elif self.vs_ver == 9.0: + return 'v3.5', 'v2.0.50727' + elif self.vs_ver == 8.0: + return 'v3.0', 'v2.0.50727' + return () + + @staticmethod + def _use_last_dir_name(path: StrPath, prefix: str = '') -> str: + """ + Return name of the last dir in path or '' if no dir found. + + Parameters + ---------- + path: StrPath + Use dirs in this path + prefix: str + Use only dirs starting by this prefix + + Return + ------ + str + name + """ + matching_dirs = ( + dir_name + for dir_name in reversed(os.listdir(path)) + if os.path.isdir(os.path.join(path, dir_name)) + and dir_name.startswith(prefix) + ) + return next(matching_dirs, '') + + +class _EnvironmentDict(TypedDict): + include: str + lib: str + libpath: str + path: str + py_vcruntime_redist: NotRequired[str | None] + + +class EnvironmentInfo: + """ + Return environment variables for specified Microsoft Visual C++ version + and platform : Lib, Include, Path and libpath. + + This function is compatible with Microsoft Visual C++ 9.0 to 14.X. + + Script created by analysing Microsoft environment configuration files like + "vcvars[...].bat", "SetEnv.Cmd", "vcbuildtools.bat", ... + + Parameters + ---------- + arch: str + Target architecture. + vc_ver: float + Required Microsoft Visual C++ version. If not set, autodetect the last + version. + vc_min_ver: float + Minimum Microsoft Visual C++ version. + """ + + # Variables and properties in this class use originals CamelCase variables + # names from Microsoft source files for more easy comparison. + + def __init__(self, arch, vc_ver=None, vc_min_ver=0) -> None: + self.pi = PlatformInfo(arch) + self.ri = RegistryInfo(self.pi) + self.si = SystemInfo(self.ri, vc_ver) + + if self.vc_ver < vc_min_ver: + err = 'No suitable Microsoft Visual C++ version found' + raise distutils.errors.DistutilsPlatformError(err) + + @property + def vs_ver(self): + """ + Microsoft Visual Studio. + + Return + ------ + float + version + """ + return self.si.vs_ver + + @property + def vc_ver(self): + """ + Microsoft Visual C++ version. + + Return + ------ + float + version + """ + return self.si.vc_ver + + @property + def VSTools(self): + """ + Microsoft Visual Studio Tools. + + Return + ------ + list of str + paths + """ + paths = [r'Common7\IDE', r'Common7\Tools'] + + if self.vs_ver >= 14.0: + arch_subdir = self.pi.current_dir(hidex86=True, x64=True) + paths += [r'Common7\IDE\CommonExtensions\Microsoft\TestWindow'] + paths += [r'Team Tools\Performance Tools'] + paths += [rf'Team Tools\Performance Tools{arch_subdir}'] + + return [os.path.join(self.si.VSInstallDir, path) for path in paths] + + @property + def VCIncludes(self): + """ + Microsoft Visual C++ & Microsoft Foundation Class Includes. + + Return + ------ + list of str + paths + """ + return [ + os.path.join(self.si.VCInstallDir, 'Include'), + os.path.join(self.si.VCInstallDir, r'ATLMFC\Include'), + ] + + @property + def VCLibraries(self): + """ + Microsoft Visual C++ & Microsoft Foundation Class Libraries. + + Return + ------ + list of str + paths + """ + if self.vs_ver >= 15.0: + arch_subdir = self.pi.target_dir(x64=True) + else: + arch_subdir = self.pi.target_dir(hidex86=True) + paths = [f'Lib{arch_subdir}', rf'ATLMFC\Lib{arch_subdir}'] + + if self.vs_ver >= 14.0: + paths += [rf'Lib\store{arch_subdir}'] + + return [os.path.join(self.si.VCInstallDir, path) for path in paths] + + @property + def VCStoreRefs(self): + """ + Microsoft Visual C++ store references Libraries. + + Return + ------ + list of str + paths + """ + if self.vs_ver < 14.0: + return [] + return [os.path.join(self.si.VCInstallDir, r'Lib\store\references')] + + @property + def VCTools(self): + """ + Microsoft Visual C++ Tools. + + Return + ------ + list of str + paths + + When host CPU is ARM, the tools should be found for ARM. + + >>> getfixture('windows_only') + >>> mp = getfixture('monkeypatch') + >>> mp.setattr(PlatformInfo, 'current_cpu', 'arm64') + >>> ei = EnvironmentInfo(arch='irrelevant') + >>> paths = ei.VCTools + >>> any('HostARM64' in path for path in paths) + True + """ + si = self.si + tools = [os.path.join(si.VCInstallDir, 'VCPackages')] + + forcex86 = True if self.vs_ver <= 10.0 else False + arch_subdir = self.pi.cross_dir(forcex86) + if arch_subdir: + tools += [os.path.join(si.VCInstallDir, f'Bin{arch_subdir}')] + + if self.vs_ver == 14.0: + path = f'Bin{self.pi.current_dir(hidex86=True)}' + tools += [os.path.join(si.VCInstallDir, path)] + + elif self.vs_ver >= 15.0: + host_id = self.pi.current_cpu.replace('amd64', 'x64').upper() + host_dir = os.path.join('bin', f'Host{host_id}%s') + tools += [ + os.path.join(si.VCInstallDir, host_dir % self.pi.target_dir(x64=True)) + ] + + if self.pi.current_cpu != self.pi.target_cpu: + tools += [ + os.path.join( + si.VCInstallDir, host_dir % self.pi.current_dir(x64=True) + ) + ] + + else: + tools += [os.path.join(si.VCInstallDir, 'Bin')] + + return tools + + @property + def OSLibraries(self): + """ + Microsoft Windows SDK Libraries. + + Return + ------ + list of str + paths + """ + if self.vs_ver <= 10.0: + arch_subdir = self.pi.target_dir(hidex86=True, x64=True) + return [os.path.join(self.si.WindowsSdkDir, f'Lib{arch_subdir}')] + + else: + arch_subdir = self.pi.target_dir(x64=True) + lib = os.path.join(self.si.WindowsSdkDir, 'lib') + libver = self._sdk_subdir + return [os.path.join(lib, f'{libver}um{arch_subdir}')] + + @property + def OSIncludes(self): + """ + Microsoft Windows SDK Include. + + Return + ------ + list of str + paths + """ + include = os.path.join(self.si.WindowsSdkDir, 'include') + + if self.vs_ver <= 10.0: + return [include, os.path.join(include, 'gl')] + + else: + if self.vs_ver >= 14.0: + sdkver = self._sdk_subdir + else: + sdkver = '' + return [ + os.path.join(include, f'{sdkver}shared'), + os.path.join(include, f'{sdkver}um'), + os.path.join(include, f'{sdkver}winrt'), + ] + + @property + def OSLibpath(self): + """ + Microsoft Windows SDK Libraries Paths. + + Return + ------ + list of str + paths + """ + ref = os.path.join(self.si.WindowsSdkDir, 'References') + libpath = [] + + if self.vs_ver <= 9.0: + libpath += self.OSLibraries + + if self.vs_ver >= 11.0: + libpath += [os.path.join(ref, r'CommonConfiguration\Neutral')] + + if self.vs_ver >= 14.0: + libpath += [ + ref, + os.path.join(self.si.WindowsSdkDir, 'UnionMetadata'), + os.path.join(ref, 'Windows.Foundation.UniversalApiContract', '1.0.0.0'), + os.path.join(ref, 'Windows.Foundation.FoundationContract', '1.0.0.0'), + os.path.join( + ref, 'Windows.Networking.Connectivity.WwanContract', '1.0.0.0' + ), + os.path.join( + self.si.WindowsSdkDir, + 'ExtensionSDKs', + 'Microsoft.VCLibs', + f'{self.vs_ver:0.1f}', + 'References', + 'CommonConfiguration', + 'neutral', + ), + ] + return libpath + + @property + def SdkTools(self): + """ + Microsoft Windows SDK Tools. + + Return + ------ + list of str + paths + """ + return list(self._sdk_tools()) + + def _sdk_tools(self): + """ + Microsoft Windows SDK Tools paths generator. + + Return + ------ + generator of str + paths + """ + if self.vs_ver < 15.0: + bin_dir = 'Bin' if self.vs_ver <= 11.0 else r'Bin\x86' + yield os.path.join(self.si.WindowsSdkDir, bin_dir) + + if not self.pi.current_is_x86(): + arch_subdir = self.pi.current_dir(x64=True) + path = f'Bin{arch_subdir}' + yield os.path.join(self.si.WindowsSdkDir, path) + + if self.vs_ver in (10.0, 11.0): + if self.pi.target_is_x86(): + arch_subdir = '' + else: + arch_subdir = self.pi.current_dir(hidex86=True, x64=True) + path = rf'Bin\NETFX 4.0 Tools{arch_subdir}' + yield os.path.join(self.si.WindowsSdkDir, path) + + elif self.vs_ver >= 15.0: + path = os.path.join(self.si.WindowsSdkDir, 'Bin') + arch_subdir = self.pi.current_dir(x64=True) + sdkver = self.si.WindowsSdkLastVersion + yield os.path.join(path, f'{sdkver}{arch_subdir}') + + if self.si.WindowsSDKExecutablePath: + yield self.si.WindowsSDKExecutablePath + + @property + def _sdk_subdir(self) -> str: + """ + Microsoft Windows SDK version subdir. + + Return + ------ + str + subdir + """ + ucrtver = self.si.WindowsSdkLastVersion + return (f'{ucrtver}\\') if ucrtver else '' + + @property + def SdkSetup(self): + """ + Microsoft Windows SDK Setup. + + Return + ------ + list of str + paths + """ + if self.vs_ver > 9.0: + return [] + + return [os.path.join(self.si.WindowsSdkDir, 'Setup')] + + @property + def FxTools(self): + """ + Microsoft .NET Framework Tools. + + Return + ------ + list of str + paths + """ + pi = self.pi + si = self.si + + if self.vs_ver <= 10.0: + include32 = True + include64 = not pi.target_is_x86() and not pi.current_is_x86() + else: + include32 = pi.target_is_x86() or pi.current_is_x86() + include64 = pi.current_cpu == 'amd64' or pi.target_cpu == 'amd64' + + tools = [] + if include32: + tools += [ + os.path.join(si.FrameworkDir32, ver) for ver in si.FrameworkVersion32 + ] + if include64: + tools += [ + os.path.join(si.FrameworkDir64, ver) for ver in si.FrameworkVersion64 + ] + return tools + + @property + def NetFxSDKLibraries(self): + """ + Microsoft .Net Framework SDK Libraries. + + Return + ------ + list of str + paths + """ + if self.vs_ver < 14.0 or not self.si.NetFxSdkDir: + return [] + + arch_subdir = self.pi.target_dir(x64=True) + return [os.path.join(self.si.NetFxSdkDir, rf'lib\um{arch_subdir}')] + + @property + def NetFxSDKIncludes(self): + """ + Microsoft .Net Framework SDK Includes. + + Return + ------ + list of str + paths + """ + if self.vs_ver < 14.0 or not self.si.NetFxSdkDir: + return [] + + return [os.path.join(self.si.NetFxSdkDir, r'include\um')] + + @property + def VsTDb(self): + """ + Microsoft Visual Studio Team System Database. + + Return + ------ + list of str + paths + """ + return [os.path.join(self.si.VSInstallDir, r'VSTSDB\Deploy')] + + @property + def MSBuild(self): + """ + Microsoft Build Engine. + + Return + ------ + list of str + paths + """ + if self.vs_ver < 12.0: + return [] + elif self.vs_ver < 15.0: + base_path = self.si.ProgramFilesx86 + arch_subdir = self.pi.current_dir(hidex86=True) + else: + base_path = self.si.VSInstallDir + arch_subdir = '' + + path = rf'MSBuild\{self.vs_ver:0.1f}\bin{arch_subdir}' + build = [os.path.join(base_path, path)] + + if self.vs_ver >= 15.0: + # Add Roslyn C# & Visual Basic Compiler + build += [os.path.join(base_path, path, 'Roslyn')] + + return build + + @property + def HTMLHelpWorkshop(self): + """ + Microsoft HTML Help Workshop. + + Return + ------ + list of str + paths + """ + if self.vs_ver < 11.0: + return [] + + return [os.path.join(self.si.ProgramFilesx86, 'HTML Help Workshop')] + + @property + def UCRTLibraries(self) -> list[str]: + """ + Microsoft Universal C Runtime SDK Libraries. + + Return + ------ + list of str + paths + """ + if self.vs_ver < 14.0: + return [] + + arch_subdir = self.pi.target_dir(x64=True) + try: + lib = os.path.join(self.si.UniversalCRTSdkDir, 'lib') # type: ignore[arg-type] # Expected TypeError + except TypeError as ex: + py310.add_note(ex, "Cannot find UniversalCRTSdkDir") + raise + ucrtver = self._ucrt_subdir + return [os.path.join(lib, f'{ucrtver}ucrt{arch_subdir}')] + + @property + def UCRTIncludes(self) -> list[str]: + """ + Microsoft Universal C Runtime SDK Include. + + Return + ------ + list of str + paths + """ + if self.vs_ver < 14.0: + return [] + + try: + include = os.path.join(self.si.UniversalCRTSdkDir, 'include') # type: ignore[arg-type] # Expected TypeError + except TypeError as ex: + py310.add_note(ex, "Cannot find UniversalCRTSdkDir") + raise + return [os.path.join(include, f'{self._ucrt_subdir}ucrt')] + + @property + def _ucrt_subdir(self) -> str: + """ + Microsoft Universal C Runtime SDK version subdir. + + Return + ------ + str + subdir + """ + ucrtver = self.si.UniversalCRTSdkLastVersion + return (f'{ucrtver}\\') if ucrtver else '' + + @property + def FSharp(self): + """ + Microsoft Visual F#. + + Return + ------ + list of str + paths + """ + if 11.0 > self.vs_ver > 12.0: + return [] + + return [self.si.FSharpInstallDir] + + @property + def VCRuntimeRedist(self) -> str | None: + """ + Microsoft Visual C++ runtime redistributable dll. + + Returns the first suitable path found or None. + """ + vcruntime = f'vcruntime{self.vc_ver}0.dll' + arch_subdir = self.pi.target_dir(x64=True).strip('\\') + + # Installation prefixes candidates + prefixes = [] + tools_path = self.si.VCInstallDir + redist_path = os.path.dirname(tools_path.replace(r'\Tools', r'\Redist')) + if os.path.isdir(redist_path): + # Redist version may not be exactly the same as tools + redist_path = os.path.join(redist_path, os.listdir(redist_path)[-1]) + prefixes += [redist_path, os.path.join(redist_path, 'onecore')] + + prefixes += [os.path.join(tools_path, 'redist')] # VS14 legacy path + + # CRT directory + crt_dirs = ( + f'Microsoft.VC{self.vc_ver * 10}.CRT', + # Sometime store in directory with VS version instead of VC + f'Microsoft.VC{int(self.vs_ver) * 10}.CRT', + ) + + # vcruntime path + candidate_paths = ( + os.path.join(prefix, arch_subdir, crt_dir, vcruntime) + for (prefix, crt_dir) in itertools.product(prefixes, crt_dirs) + ) + return next(filter(os.path.isfile, candidate_paths), None) # type: ignore[arg-type] #python/mypy#12682 + + def return_env(self, exists: bool = True) -> _EnvironmentDict: + """ + Return environment dict. + + Parameters + ---------- + exists: bool + It True, only return existing paths. + + Return + ------ + dict + environment + """ + env = _EnvironmentDict( + include=self._build_paths( + 'include', + [ + self.VCIncludes, + self.OSIncludes, + self.UCRTIncludes, + self.NetFxSDKIncludes, + ], + exists, + ), + lib=self._build_paths( + 'lib', + [ + self.VCLibraries, + self.OSLibraries, + self.FxTools, + self.UCRTLibraries, + self.NetFxSDKLibraries, + ], + exists, + ), + libpath=self._build_paths( + 'libpath', + [self.VCLibraries, self.FxTools, self.VCStoreRefs, self.OSLibpath], + exists, + ), + path=self._build_paths( + 'path', + [ + self.VCTools, + self.VSTools, + self.VsTDb, + self.SdkTools, + self.SdkSetup, + self.FxTools, + self.MSBuild, + self.HTMLHelpWorkshop, + self.FSharp, + ], + exists, + ), + ) + if self.vs_ver >= 14 and self.VCRuntimeRedist: + env['py_vcruntime_redist'] = self.VCRuntimeRedist + return env + + def _build_paths(self, name, spec_path_lists, exists): + """ + Given an environment variable name and specified paths, + return a pathsep-separated string of paths containing + unique, extant, directories from those paths and from + the environment variable. Raise an error if no paths + are resolved. + + Parameters + ---------- + name: str + Environment variable name + spec_path_lists: list of str + Paths + exists: bool + It True, only return existing paths. + + Return + ------ + str + Pathsep-separated paths + """ + # flatten spec_path_lists + spec_paths = itertools.chain.from_iterable(spec_path_lists) + env_paths = environ.get(name, '').split(os.pathsep) + paths = itertools.chain(spec_paths, env_paths) + extant_paths = list(filter(os.path.isdir, paths)) if exists else paths + if not extant_paths: + msg = f"{name.upper()} environment variable is empty" + raise distutils.errors.DistutilsPlatformError(msg) + unique_paths = unique_everseen(extant_paths) + return os.pathsep.join(unique_paths) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/namespaces.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/namespaces.py new file mode 100644 index 0000000000000000000000000000000000000000..7760f07fb468605d4caff5a2f816b7a425fcd70b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/namespaces.py @@ -0,0 +1,101 @@ +import itertools +import os + +from .compat import py312 + +from distutils import log + +flatten = itertools.chain.from_iterable + + +class Installer: + nspkg_ext = '-nspkg.pth' + + def install_namespaces(self) -> None: + nsp = self._get_all_ns_packages() + if not nsp: + return + filename = self._get_nspkg_file() + self.outputs.append(filename) + log.info("Installing %s", filename) + lines = map(self._gen_nspkg_line, nsp) + + with open(filename, 'wt', encoding=py312.PTH_ENCODING) as f: + # Python<3.13 requires encoding="locale" instead of "utf-8" + # See: python/cpython#77102 + f.writelines(lines) + + def uninstall_namespaces(self) -> None: + filename = self._get_nspkg_file() + if not os.path.exists(filename): + return + log.info("Removing %s", filename) + os.remove(filename) + + def _get_nspkg_file(self): + filename, _ = os.path.splitext(self._get_target()) + return filename + self.nspkg_ext + + def _get_target(self): + return self.target + + _nspkg_tmpl = ( + "import sys, types, os", + "p = os.path.join(%(root)s, *%(pth)r)", + "importlib = __import__('importlib.util')", + "__import__('importlib.machinery')", + ( + "m = " + "sys.modules.setdefault(%(pkg)r, " + "importlib.util.module_from_spec(" + "importlib.machinery.PathFinder.find_spec(%(pkg)r, " + "[os.path.dirname(p)])))" + ), + ("m = m or sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))"), + "mp = (m or []) and m.__dict__.setdefault('__path__',[])", + "(p not in mp) and mp.append(p)", + ) + "lines for the namespace installer" + + _nspkg_tmpl_multi = ('m and setattr(sys.modules[%(parent)r], %(child)r, m)',) + "additional line(s) when a parent package is indicated" + + def _get_root(self): + return "sys._getframe(1).f_locals['sitedir']" + + def _gen_nspkg_line(self, pkg): + pth = tuple(pkg.split('.')) + root = self._get_root() + tmpl_lines = self._nspkg_tmpl + parent, sep, child = pkg.rpartition('.') + if parent: + tmpl_lines += self._nspkg_tmpl_multi + return ';'.join(tmpl_lines) % locals() + '\n' + + def _get_all_ns_packages(self): + """Return sorted list of all package namespaces""" + pkgs = self.distribution.namespace_packages or [] + return sorted(set(flatten(map(self._pkg_names, pkgs)))) + + @staticmethod + def _pkg_names(pkg): + """ + Given a namespace package, yield the components of that + package. + + >>> names = Installer._pkg_names('a.b.c') + >>> set(names) == set(['a', 'a.b', 'a.b.c']) + True + """ + parts = pkg.split('.') + while parts: + yield '.'.join(parts) + parts.pop() + + +class DevelopInstaller(Installer): + def _get_root(self): + return repr(str(self.egg_path)) + + def _get_target(self): + return self.egg_link diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/script (dev).tmpl b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/script (dev).tmpl new file mode 100644 index 0000000000000000000000000000000000000000..39a24b04888e79df51e2237577b303a2f901be63 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/script (dev).tmpl @@ -0,0 +1,6 @@ +# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r +__requires__ = %(spec)r +__import__('pkg_resources').require(%(spec)r) +__file__ = %(dev_path)r +with open(__file__) as f: + exec(compile(f.read(), __file__, 'exec')) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/script.tmpl b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/script.tmpl new file mode 100644 index 0000000000000000000000000000000000000000..ff5efbcab3b58063dd84787181c26a95fb663d94 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/script.tmpl @@ -0,0 +1,3 @@ +# EASY-INSTALL-SCRIPT: %(spec)r,%(script_name)r +__requires__ = %(spec)r +__import__('pkg_resources').run_script(%(spec)r, %(script_name)r) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/unicode_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/unicode_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..f502f5b089619eafd28e2c7a61967e34e16920e5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/unicode_utils.py @@ -0,0 +1,102 @@ +import sys +import unicodedata +from configparser import RawConfigParser + +from .compat import py39 +from .warnings import SetuptoolsDeprecationWarning + + +# HFS Plus uses decomposed UTF-8 +def decompose(path): + if isinstance(path, str): + return unicodedata.normalize('NFD', path) + try: + path = path.decode('utf-8') + path = unicodedata.normalize('NFD', path) + path = path.encode('utf-8') + except UnicodeError: + pass # Not UTF-8 + return path + + +def filesys_decode(path): + """ + Ensure that the given path is decoded, + ``None`` when no expected encoding works + """ + + if isinstance(path, str): + return path + + fs_enc = sys.getfilesystemencoding() or 'utf-8' + candidates = fs_enc, 'utf-8' + + for enc in candidates: + try: + return path.decode(enc) + except UnicodeDecodeError: + continue + + return None + + +def try_encode(string, enc): + "turn unicode encoding into a functional routine" + try: + return string.encode(enc) + except UnicodeEncodeError: + return None + + +def _read_utf8_with_fallback(file: str, fallback_encoding=py39.LOCALE_ENCODING) -> str: + """ + First try to read the file with UTF-8, if there is an error fallback to a + different encoding ("locale" by default). Returns the content of the file. + Also useful when reading files that might have been produced by an older version of + setuptools. + """ + try: + with open(file, "r", encoding="utf-8") as f: + return f.read() + except UnicodeDecodeError: # pragma: no cover + _Utf8EncodingNeeded.emit(file=file, fallback_encoding=fallback_encoding) + with open(file, "r", encoding=fallback_encoding) as f: + return f.read() + + +def _cfg_read_utf8_with_fallback( + cfg: RawConfigParser, file: str, fallback_encoding=py39.LOCALE_ENCODING +) -> None: + """Same idea as :func:`_read_utf8_with_fallback`, but for the + :meth:`RawConfigParser.read` method. + + This method may call ``cfg.clear()``. + """ + try: + cfg.read(file, encoding="utf-8") + except UnicodeDecodeError: # pragma: no cover + _Utf8EncodingNeeded.emit(file=file, fallback_encoding=fallback_encoding) + cfg.clear() + cfg.read(file, encoding=fallback_encoding) + + +class _Utf8EncodingNeeded(SetuptoolsDeprecationWarning): + _SUMMARY = """ + `encoding="utf-8"` fails with {file!r}, trying `encoding={fallback_encoding!r}`. + """ + + _DETAILS = """ + Fallback behavior for UTF-8 is considered **deprecated** and future versions of + `setuptools` may not implement it. + + Please encode {file!r} with "utf-8" to ensure future builds will succeed. + + If this file was produced by `setuptools` itself, cleaning up the cached files + and re-building/re-installing the package with a newer version of `setuptools` + (e.g. by updating `build-system.requires` in its `pyproject.toml`) + might solve the problem. + """ + # TODO: Add a deadline? + # Will we be able to remove this? + # The question comes to mind mainly because of sdists that have been produced + # by old versions of setuptools and published to PyPI... diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/version.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/version.py new file mode 100644 index 0000000000000000000000000000000000000000..ec253c414474677d3a5977511cfe901bfb786740 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/version.py @@ -0,0 +1,6 @@ +from ._importlib import metadata + +try: + __version__ = metadata.version('setuptools') or '0.dev0+unknown' +except Exception: + __version__ = '0.dev0+unknown' diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/warnings.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/warnings.py new file mode 100644 index 0000000000000000000000000000000000000000..96467787c237846bfbacf2d44eb833be0a88b633 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/warnings.py @@ -0,0 +1,110 @@ +"""Provide basic warnings used by setuptools modules. + +Using custom classes (other than ``UserWarning``) allow users to set +``PYTHONWARNINGS`` filters to run tests and prepare for upcoming changes in +setuptools. +""" + +from __future__ import annotations + +import os +import warnings +from datetime import date +from inspect import cleandoc +from textwrap import indent +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from typing_extensions import TypeAlias + +_DueDate: TypeAlias = tuple[int, int, int] # time tuple +_INDENT = 8 * " " +_TEMPLATE = f"""{80 * '*'}\n{{details}}\n{80 * '*'}""" + + +class SetuptoolsWarning(UserWarning): + """Base class in ``setuptools`` warning hierarchy.""" + + @classmethod + def emit( + cls, + summary: str | None = None, + details: str | None = None, + due_date: _DueDate | None = None, + see_docs: str | None = None, + see_url: str | None = None, + stacklevel: int = 2, + **kwargs, + ) -> None: + """Private: reserved for ``setuptools`` internal use only""" + # Default values: + summary_ = summary or getattr(cls, "_SUMMARY", None) or "" + details_ = details or getattr(cls, "_DETAILS", None) or "" + due_date = due_date or getattr(cls, "_DUE_DATE", None) + docs_ref = see_docs or getattr(cls, "_SEE_DOCS", None) + docs_url = docs_ref and f"https://setuptools.pypa.io/en/latest/{docs_ref}" + see_url = see_url or getattr(cls, "_SEE_URL", None) + due = date(*due_date) if due_date else None + + text = cls._format(summary_, details_, due, see_url or docs_url, kwargs) + if due and due < date.today() and _should_enforce(): + raise cls(text) + warnings.warn(text, cls, stacklevel=stacklevel + 1) + + @classmethod + def _format( + cls, + summary: str, + details: str, + due_date: date | None = None, + see_url: str | None = None, + format_args: dict | None = None, + ) -> str: + """Private: reserved for ``setuptools`` internal use only""" + today = date.today() + summary = cleandoc(summary).format_map(format_args or {}) + possible_parts = [ + cleandoc(details).format_map(format_args or {}), + ( + f"\nBy {due_date:%Y-%b-%d}, you need to update your project and remove " + "deprecated calls\nor your builds will no longer be supported." + if due_date and due_date > today + else None + ), + ( + "\nThis deprecation is overdue, please update your project and remove " + "deprecated\ncalls to avoid build errors in the future." + if due_date and due_date < today + else None + ), + (f"\nSee {see_url} for details." if see_url else None), + ] + parts = [x for x in possible_parts if x] + if parts: + body = indent(_TEMPLATE.format(details="\n".join(parts)), _INDENT) + return "\n".join([summary, "!!\n", body, "\n!!"]) + return summary + + +class InformationOnly(SetuptoolsWarning): + """Currently there is no clear way of displaying messages to the users + that use the setuptools backend directly via ``pip``. + The only thing that might work is a warning, although it is not the + most appropriate tool for the job... + + See pypa/packaging-problems#558. + """ + + +class SetuptoolsDeprecationWarning(SetuptoolsWarning): + """ + Base class for warning deprecations in ``setuptools`` + + This class is not derived from ``DeprecationWarning``, and as such is + visible by default. + """ + + +def _should_enforce(): + enforce = os.getenv("SETUPTOOLS_ENFORCE_DEPRECATION", "false").lower() + return enforce in ("true", "on", "ok", "1") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/wheel.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/wheel.py new file mode 100644 index 0000000000000000000000000000000000000000..93663031541eba1b459f44bd81bc418c9e40decc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/wheel.py @@ -0,0 +1,262 @@ +"""Wheels support.""" + +import contextlib +import email +import functools +import itertools +import os +import posixpath +import re +import zipfile +from collections.abc import Iterator + +from packaging.requirements import Requirement +from packaging.tags import sys_tags +from packaging.utils import canonicalize_name +from packaging.version import Version as parse_version + +import setuptools +from setuptools.archive_util import _unpack_zipfile_obj +from setuptools.command.egg_info import _egg_basename, write_requirements + +from ._discovery import extras_from_deps +from ._importlib import metadata +from .unicode_utils import _read_utf8_with_fallback + +from distutils.util import get_platform + +WHEEL_NAME = re.compile( + r"""^(?P.+?)-(?P\d.*?) + ((-(?P\d.*?))?-(?P.+?)-(?P.+?)-(?P.+?) + )\.whl$""", + re.VERBOSE, +).match + +NAMESPACE_PACKAGE_INIT = "__import__('pkg_resources').declare_namespace(__name__)\n" + + +@functools.cache +def _get_supported_tags(): + # We calculate the supported tags only once, otherwise calling + # this method on thousands of wheels takes seconds instead of + # milliseconds. + return {(t.interpreter, t.abi, t.platform) for t in sys_tags()} + + +def unpack(src_dir, dst_dir) -> None: + """Move everything under `src_dir` to `dst_dir`, and delete the former.""" + for dirpath, dirnames, filenames in os.walk(src_dir): + subdir = os.path.relpath(dirpath, src_dir) + for f in filenames: + src = os.path.join(dirpath, f) + dst = os.path.join(dst_dir, subdir, f) + os.renames(src, dst) + for n, d in reversed(list(enumerate(dirnames))): + src = os.path.join(dirpath, d) + dst = os.path.join(dst_dir, subdir, d) + if not os.path.exists(dst): + # Directory does not exist in destination, + # rename it and prune it from os.walk list. + os.renames(src, dst) + del dirnames[n] + # Cleanup. + for dirpath, dirnames, filenames in os.walk(src_dir, topdown=True): + assert not filenames + os.rmdir(dirpath) + + +@contextlib.contextmanager +def disable_info_traces() -> Iterator[None]: + """ + Temporarily disable info traces. + """ + from distutils import log + + saved = log.set_threshold(log.WARN) + try: + yield + finally: + log.set_threshold(saved) + + +class Wheel: + def __init__(self, filename) -> None: + match = WHEEL_NAME(os.path.basename(filename)) + if match is None: + raise ValueError(f'invalid wheel name: {filename!r}') + self.filename = filename + for k, v in match.groupdict().items(): + setattr(self, k, v) + + def tags(self): + """List tags (py_version, abi, platform) supported by this wheel.""" + return itertools.product( + self.py_version.split('.'), + self.abi.split('.'), + self.platform.split('.'), + ) + + def is_compatible(self): + """Is the wheel compatible with the current platform?""" + return next((True for t in self.tags() if t in _get_supported_tags()), False) + + def egg_name(self): + return ( + _egg_basename( + self.project_name, + self.version, + platform=(None if self.platform == 'any' else get_platform()), + ) + + ".egg" + ) + + def get_dist_info(self, zf): + # find the correct name of the .dist-info dir in the wheel file + for member in zf.namelist(): + dirname = posixpath.dirname(member) + if dirname.endswith('.dist-info') and canonicalize_name(dirname).startswith( + canonicalize_name(self.project_name) + ): + return dirname + raise ValueError("unsupported wheel format. .dist-info not found") + + def install_as_egg(self, destination_eggdir) -> None: + """Install wheel as an egg directory.""" + with zipfile.ZipFile(self.filename) as zf: + self._install_as_egg(destination_eggdir, zf) + + def _install_as_egg(self, destination_eggdir, zf): + dist_basename = f'{self.project_name}-{self.version}' + dist_info = self.get_dist_info(zf) + dist_data = f'{dist_basename}.data' + egg_info = os.path.join(destination_eggdir, 'EGG-INFO') + + self._convert_metadata(zf, destination_eggdir, dist_info, egg_info) + self._move_data_entries(destination_eggdir, dist_data) + self._fix_namespace_packages(egg_info, destination_eggdir) + + @staticmethod + def _convert_metadata(zf, destination_eggdir, dist_info, egg_info): + def get_metadata(name): + with zf.open(posixpath.join(dist_info, name)) as fp: + value = fp.read().decode('utf-8') + return email.parser.Parser().parsestr(value) + + wheel_metadata = get_metadata('WHEEL') + # Check wheel format version is supported. + wheel_version = parse_version(wheel_metadata.get('Wheel-Version')) + wheel_v1 = parse_version('1.0') <= wheel_version < parse_version('2.0dev0') + if not wheel_v1: + raise ValueError(f'unsupported wheel format version: {wheel_version}') + # Extract to target directory. + _unpack_zipfile_obj(zf, destination_eggdir) + dist_info = os.path.join(destination_eggdir, dist_info) + install_requires, extras_require = Wheel._convert_requires( + destination_eggdir, dist_info + ) + os.rename(dist_info, egg_info) + os.rename( + os.path.join(egg_info, 'METADATA'), + os.path.join(egg_info, 'PKG-INFO'), + ) + setup_dist = setuptools.Distribution( + attrs=dict( + install_requires=install_requires, + extras_require=extras_require, + ), + ) + with disable_info_traces(): + write_requirements( + setup_dist.get_command_obj('egg_info'), + None, + os.path.join(egg_info, 'requires.txt'), + ) + + @staticmethod + def _convert_requires(destination_eggdir, dist_info): + md = metadata.Distribution.at(dist_info).metadata + deps = md.get_all('Requires-Dist') or [] + reqs = list(map(Requirement, deps)) + + extras = extras_from_deps(deps) + + # Note: Evaluate and strip markers now, + # as it's difficult to convert back from the syntax: + # foobar; "linux" in sys_platform and extra == 'test' + def raw_req(req): + req = Requirement(str(req)) + req.marker = None + return str(req) + + def eval(req, **env): + return not req.marker or req.marker.evaluate(env) + + def for_extra(req): + try: + markers = req.marker._markers + except AttributeError: + markers = () + return set( + marker[2].value + for marker in markers + if isinstance(marker, tuple) and marker[0].value == 'extra' + ) + + install_requires = list( + map(raw_req, filter(eval, itertools.filterfalse(for_extra, reqs))) + ) + extras_require = { + extra: list( + map( + raw_req, + (req for req in reqs if for_extra(req) and eval(req, extra=extra)), + ) + ) + for extra in extras + } + return install_requires, extras_require + + @staticmethod + def _move_data_entries(destination_eggdir, dist_data): + """Move data entries to their correct location.""" + dist_data = os.path.join(destination_eggdir, dist_data) + dist_data_scripts = os.path.join(dist_data, 'scripts') + if os.path.exists(dist_data_scripts): + egg_info_scripts = os.path.join(destination_eggdir, 'EGG-INFO', 'scripts') + os.mkdir(egg_info_scripts) + for entry in os.listdir(dist_data_scripts): + # Remove bytecode, as it's not properly handled + # during easy_install scripts install phase. + if entry.endswith('.pyc'): + os.unlink(os.path.join(dist_data_scripts, entry)) + else: + os.rename( + os.path.join(dist_data_scripts, entry), + os.path.join(egg_info_scripts, entry), + ) + os.rmdir(dist_data_scripts) + for subdir in filter( + os.path.exists, + ( + os.path.join(dist_data, d) + for d in ('data', 'headers', 'purelib', 'platlib') + ), + ): + unpack(subdir, destination_eggdir) + if os.path.exists(dist_data): + os.rmdir(dist_data) + + @staticmethod + def _fix_namespace_packages(egg_info, destination_eggdir): + namespace_packages = os.path.join(egg_info, 'namespace_packages.txt') + if os.path.exists(namespace_packages): + namespace_packages = _read_utf8_with_fallback(namespace_packages).split() + + for mod in namespace_packages: + mod_dir = os.path.join(destination_eggdir, *mod.split('.')) + mod_init = os.path.join(mod_dir, '__init__.py') + if not os.path.exists(mod_dir): + os.mkdir(mod_dir) + if not os.path.exists(mod_init): + with open(mod_init, 'w', encoding="utf-8") as fp: + fp.write(NAMESPACE_PACKAGE_INIT) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/setuptools/windows_support.py b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/windows_support.py new file mode 100644 index 0000000000000000000000000000000000000000..7a2b53a291409c66851961a559eb4d69be0f4acc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/setuptools/windows_support.py @@ -0,0 +1,30 @@ +import platform + + +def windows_only(func): + if platform.system() != 'Windows': + return lambda *args, **kwargs: None + return func + + +@windows_only +def hide_file(path: str) -> None: + """ + Set the hidden attribute on a file or directory. + + From https://stackoverflow.com/questions/19622133/ + + `path` must be text. + """ + import ctypes + import ctypes.wintypes + + SetFileAttributes = ctypes.windll.kernel32.SetFileAttributesW + SetFileAttributes.argtypes = ctypes.wintypes.LPWSTR, ctypes.wintypes.DWORD + SetFileAttributes.restype = ctypes.wintypes.BOOL + + FILE_ATTRIBUTE_HIDDEN = 0x02 + + ret = SetFileAttributes(path, FILE_ATTRIBUTE_HIDDEN) + if not ret: + raise ctypes.WinError() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/LICENSE b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..b9077766e9b9bdcae49ea5c8fced750ed13ec8f7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2018, Tzu-ping Chung + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..52118f1e5c83bd7ef39196a749651fc87d176812 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/METADATA @@ -0,0 +1,106 @@ +Metadata-Version: 2.1 +Name: shellingham +Version: 1.5.4 +Summary: Tool to Detect Surrounding Shell +Home-page: https://github.com/sarugaku/shellingham +Author: Tzu-ping Chung +Author-email: uranusjr@gmail.com +License: ISC License +Keywords: shell +Classifier: Development Status :: 3 - Alpha +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: ISC License (ISCL) +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +License-File: LICENSE + +============================================= +Shellingham: Tool to Detect Surrounding Shell +============================================= + +.. image:: https://img.shields.io/pypi/v/shellingham.svg + :target: https://pypi.org/project/shellingham/ + +Shellingham detects what shell the current Python executable is running in. + + +Usage +===== + +.. code-block:: python + + >>> import shellingham + >>> shellingham.detect_shell() + ('bash', '/bin/bash') + +``detect_shell`` pokes around the process's running environment to determine +what shell it is run in. It returns a 2-tuple: + +* The shell name, always lowercased. +* The command used to run the shell. + +``ShellDetectionFailure`` is raised if ``detect_shell`` fails to detect the +surrounding shell. + + +Notes +===== + +* The shell name is always lowercased. +* On Windows, the shell name is the name of the executable, minus the file + extension. + + +Notes for Application Developers +================================ + +Remember, your application's user is not necessarily using a shell. +Shellingham raises ``ShellDetectionFailure`` if there is no shell to detect, +but *your application should almost never do this to your user*. + +A practical approach to this is to wrap ``detect_shell`` in a try block, and +provide a sane default on failure + +.. code-block:: python + + try: + shell = shellingham.detect_shell() + except shellingham.ShellDetectionFailure: + shell = provide_default() + + +There are a few choices for you to choose from. + +* The POSIX standard mandates the environment variable ``SHELL`` to refer to + "the user's preferred command language interpreter". This is always available + (even if the user is not in an interactive session), and likely the correct + choice to launch an interactive sub-shell with. +* A command ``sh`` is almost guaranteed to exist, likely at ``/bin/sh``, since + several POSIX tools rely on it. This should be suitable if you want to run a + (possibly non-interactive) script. +* All versions of DOS and Windows have an environment variable ``COMSPEC``. + This can always be used to launch a usable command prompt (e.g. `cmd.exe` on + Windows). + +Here's a simple implementation to provide a default shell + +.. code-block:: python + + import os + + def provide_default(): + if os.name == 'posix': + return os.environ['SHELL'] + elif os.name == 'nt': + return os.environ['COMSPEC'] + raise NotImplementedError(f'OS {os.name!r} support not available') diff --git a/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..0f9259f43a2bcaecd717bd908b6a6993509c96fa --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/RECORD @@ -0,0 +1,21 @@ +shellingham-1.5.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +shellingham-1.5.4.dist-info/LICENSE,sha256=84j9OMrRMRLB3A9mm76A5_hFQe26-3LzAw0sp2QsPJ0,751 +shellingham-1.5.4.dist-info/METADATA,sha256=GD2AIgo3STJieVc53TV8xbs_Sb05DMkZjVGA5UUaB_o,3461 +shellingham-1.5.4.dist-info/RECORD,, +shellingham-1.5.4.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110 +shellingham-1.5.4.dist-info/top_level.txt,sha256=uKMQL5AKxPi4O9_Rbd838QeEs4ImpGQKNbEDZYqgBgk,12 +shellingham-1.5.4.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 +shellingham/__init__.py,sha256=pAKXUPKUdwyErC0ZjS-5w-fRdSbmdcfvnpt_x1yWqtA,635 +shellingham/__pycache__/__init__.cpython-312.pyc,, +shellingham/__pycache__/_core.cpython-312.pyc,, +shellingham/__pycache__/nt.cpython-312.pyc,, +shellingham/_core.py,sha256=v-CTr_7F7cJAtNnzpa1N_Hl8afkY5yiDA4joGmsUBu0,300 +shellingham/nt.py,sha256=m6J6SuwyqVVlxXT9Bc-9F_1x-T5u0gCFFrRAF2LIkeg,4516 +shellingham/posix/__init__.py,sha256=pB69qtvZJ_yIf48nl4-ZfS3wLwwuXuknXOZhBnC2T1o,3129 +shellingham/posix/__pycache__/__init__.cpython-312.pyc,, +shellingham/posix/__pycache__/_core.cpython-312.pyc,, +shellingham/posix/__pycache__/proc.cpython-312.pyc,, +shellingham/posix/__pycache__/ps.cpython-312.pyc,, +shellingham/posix/_core.py,sha256=_v18UaXbzr4muNhr3-mH1FdSdjZ_dOXQrtUyomIbKYQ,81 +shellingham/posix/proc.py,sha256=nSUxIuQSotvaDW76i0oTQAM9aZ9PXBLFAEktWljSKCo,2659 +shellingham/posix/ps.py,sha256=NGmDKCukhNp0lahwYCaMXphBYaVbhbiR9BtE0OkT8qU,1770 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..c34f1162ef9a50c355df1261ef6194ffc1b39975 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.41.2) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4e44ce0299bb38463f8491ec8850910235c2709 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/top_level.txt @@ -0,0 +1 @@ +shellingham diff --git a/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/zip-safe b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/zip-safe new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/shellingham-1.5.4.dist-info/zip-safe @@ -0,0 +1 @@ + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/shellingham/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/shellingham/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..15f7a90cbd02e5c2cc933cf6aa0374cca68035f1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/shellingham/__init__.py @@ -0,0 +1,23 @@ +import importlib +import os + +from ._core import ShellDetectionFailure + +__version__ = "1.5.4" + + +def detect_shell(pid=None, max_depth=10): + name = os.name + try: + impl = importlib.import_module(".{}".format(name), __name__) + except ImportError: + message = "Shell detection not implemented for {0!r}".format(name) + raise RuntimeError(message) + try: + get_shell = impl.get_shell + except AttributeError: + raise RuntimeError("get_shell not implemented for {0!r}".format(name)) + shell = get_shell(pid, max_depth=max_depth) + if shell: + return shell + raise ShellDetectionFailure() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/shellingham/_core.py b/TTS/Kokoro/.venv/Lib/site-packages/shellingham/_core.py new file mode 100644 index 0000000000000000000000000000000000000000..13b65417c733b54e48b120e37f573c2baa6ef72b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/shellingham/_core.py @@ -0,0 +1,11 @@ +SHELL_NAMES = ( + {"sh", "bash", "dash", "ash"} # Bourne. + | {"csh", "tcsh"} # C. + | {"ksh", "zsh", "fish"} # Common alternatives. + | {"cmd", "powershell", "pwsh"} # Microsoft. + | {"elvish", "xonsh", "nu"} # More exotic. +) + + +class ShellDetectionFailure(EnvironmentError): + pass diff --git a/TTS/Kokoro/.venv/Lib/site-packages/shellingham/nt.py b/TTS/Kokoro/.venv/Lib/site-packages/shellingham/nt.py new file mode 100644 index 0000000000000000000000000000000000000000..389551b223a761fa2f97e929b60bf3ca5baed94c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/shellingham/nt.py @@ -0,0 +1,163 @@ +import contextlib +import ctypes +import os + +from ctypes.wintypes import ( + BOOL, + CHAR, + DWORD, + HANDLE, + LONG, + LPWSTR, + MAX_PATH, + PDWORD, + ULONG, +) + +from shellingham._core import SHELL_NAMES + + +INVALID_HANDLE_VALUE = HANDLE(-1).value +ERROR_NO_MORE_FILES = 18 +ERROR_INSUFFICIENT_BUFFER = 122 +TH32CS_SNAPPROCESS = 2 +PROCESS_QUERY_LIMITED_INFORMATION = 0x1000 + + +kernel32 = ctypes.windll.kernel32 + + +def _check_handle(error_val=0): + def check(ret, func, args): + if ret == error_val: + raise ctypes.WinError() + return ret + + return check + + +def _check_expected(expected): + def check(ret, func, args): + if ret: + return True + code = ctypes.GetLastError() + if code == expected: + return False + raise ctypes.WinError(code) + + return check + + +class ProcessEntry32(ctypes.Structure): + _fields_ = ( + ("dwSize", DWORD), + ("cntUsage", DWORD), + ("th32ProcessID", DWORD), + ("th32DefaultHeapID", ctypes.POINTER(ULONG)), + ("th32ModuleID", DWORD), + ("cntThreads", DWORD), + ("th32ParentProcessID", DWORD), + ("pcPriClassBase", LONG), + ("dwFlags", DWORD), + ("szExeFile", CHAR * MAX_PATH), + ) + + +kernel32.CloseHandle.argtypes = [HANDLE] +kernel32.CloseHandle.restype = BOOL + +kernel32.CreateToolhelp32Snapshot.argtypes = [DWORD, DWORD] +kernel32.CreateToolhelp32Snapshot.restype = HANDLE +kernel32.CreateToolhelp32Snapshot.errcheck = _check_handle( # type: ignore + INVALID_HANDLE_VALUE, +) + +kernel32.Process32First.argtypes = [HANDLE, ctypes.POINTER(ProcessEntry32)] +kernel32.Process32First.restype = BOOL +kernel32.Process32First.errcheck = _check_expected( # type: ignore + ERROR_NO_MORE_FILES, +) + +kernel32.Process32Next.argtypes = [HANDLE, ctypes.POINTER(ProcessEntry32)] +kernel32.Process32Next.restype = BOOL +kernel32.Process32Next.errcheck = _check_expected( # type: ignore + ERROR_NO_MORE_FILES, +) + +kernel32.GetCurrentProcessId.argtypes = [] +kernel32.GetCurrentProcessId.restype = DWORD + +kernel32.OpenProcess.argtypes = [DWORD, BOOL, DWORD] +kernel32.OpenProcess.restype = HANDLE +kernel32.OpenProcess.errcheck = _check_handle( # type: ignore + INVALID_HANDLE_VALUE, +) + +kernel32.QueryFullProcessImageNameW.argtypes = [HANDLE, DWORD, LPWSTR, PDWORD] +kernel32.QueryFullProcessImageNameW.restype = BOOL +kernel32.QueryFullProcessImageNameW.errcheck = _check_expected( # type: ignore + ERROR_INSUFFICIENT_BUFFER, +) + + +@contextlib.contextmanager +def _handle(f, *args, **kwargs): + handle = f(*args, **kwargs) + try: + yield handle + finally: + kernel32.CloseHandle(handle) + + +def _iter_processes(): + f = kernel32.CreateToolhelp32Snapshot + with _handle(f, TH32CS_SNAPPROCESS, 0) as snap: + entry = ProcessEntry32() + entry.dwSize = ctypes.sizeof(entry) + ret = kernel32.Process32First(snap, entry) + while ret: + yield entry + ret = kernel32.Process32Next(snap, entry) + + +def _get_full_path(proch): + size = DWORD(MAX_PATH) + while True: + path_buff = ctypes.create_unicode_buffer("", size.value) + if kernel32.QueryFullProcessImageNameW(proch, 0, path_buff, size): + return path_buff.value + size.value *= 2 + + +def get_shell(pid=None, max_depth=10): + proc_map = { + proc.th32ProcessID: (proc.th32ParentProcessID, proc.szExeFile) + for proc in _iter_processes() + } + pid = pid or os.getpid() + + for _ in range(0, max_depth + 1): + try: + ppid, executable = proc_map[pid] + except KeyError: # No such process? Give up. + break + + # The executable name would be encoded with the current code page if + # we're in ANSI mode (usually). Try to decode it into str/unicode, + # replacing invalid characters to be safe (not thoeratically necessary, + # I think). Note that we need to use 'mbcs' instead of encoding + # settings from sys because this is from the Windows API, not Python + # internals (which those settings reflect). (pypa/pipenv#3382) + if isinstance(executable, bytes): + executable = executable.decode("mbcs", "replace") + + name = executable.rpartition(".")[0].lower() + if name not in SHELL_NAMES: + pid = ppid + continue + + key = PROCESS_QUERY_LIMITED_INFORMATION + with _handle(kernel32.OpenProcess, key, 0, pid) as proch: + return (name, _get_full_path(proch)) + + return None diff --git a/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/LICENSE b/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..1cc22a5aa7679ebaa10934212f356823931bdc3e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/LICENSE @@ -0,0 +1,18 @@ +Copyright (c) 2010-2024 Benjamin Peterson + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..cfde03c2631c5c1d5cdc0949d0ee3379e7110f0e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/METADATA @@ -0,0 +1,43 @@ +Metadata-Version: 2.1 +Name: six +Version: 1.17.0 +Summary: Python 2 and 3 compatibility utilities +Home-page: https://github.com/benjaminp/six +Author: Benjamin Peterson +Author-email: benjamin@python.org +License: MIT +Classifier: Development Status :: 5 - Production/Stable +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 3 +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Topic :: Software Development :: Libraries +Classifier: Topic :: Utilities +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.* +License-File: LICENSE + +.. image:: https://img.shields.io/pypi/v/six.svg + :target: https://pypi.org/project/six/ + :alt: six on PyPI + +.. image:: https://readthedocs.org/projects/six/badge/?version=latest + :target: https://six.readthedocs.io/ + :alt: six's documentation on Read the Docs + +.. image:: https://img.shields.io/badge/license-MIT-green.svg + :target: https://github.com/benjaminp/six/blob/master/LICENSE + :alt: MIT License badge + +Six is a Python 2 and 3 compatibility library. It provides utility functions +for smoothing over the differences between the Python versions with the goal of +writing Python code that is compatible on both Python versions. See the +documentation for more information on what is provided. + +Six supports Python 2.7 and 3.3+. It is contained in only one Python +file, so it can be easily copied into your project. (The copyright and license +notice must be retained.) + +Online documentation is at https://six.readthedocs.io/. + +Bugs can be reported to https://github.com/benjaminp/six. The code can also +be found there. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..bb90c1a52e0f905a3facec665e8600ef20931282 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/RECORD @@ -0,0 +1,8 @@ +__pycache__/six.cpython-312.pyc,, +six-1.17.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +six-1.17.0.dist-info/LICENSE,sha256=Q3W6IOK5xsTnytKUCmKP2Q6VzD1Q7pKq51VxXYuh-9A,1066 +six-1.17.0.dist-info/METADATA,sha256=ViBCB4wnUlSfbYp8htvF3XCAiKe-bYBnLsewcQC3JGg,1658 +six-1.17.0.dist-info/RECORD,, +six-1.17.0.dist-info/WHEEL,sha256=pxeNX5JdtCe58PUSYP9upmc7jdRPgvT0Gm9kb1SHlVw,109 +six-1.17.0.dist-info/top_level.txt,sha256=_iVH_iYEtEXnD8nYGQYpYFUvkUW9sEO1GYbkeKSAais,4 +six.py,sha256=xRyR9wPT1LNpbJI8tf7CE-BeddkhU5O--sfy-mo5BN8,34703 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..104f3874635f24f0d2918dfeaf6a59652274460c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: setuptools (75.6.0) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffe2fce498955b628014618b28c6bcf152466a4a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/six-1.17.0.dist-info/top_level.txt @@ -0,0 +1 @@ +six diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..0a19a25dbd415c06b085fcd1d4f5e4a1c6d84943 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/METADATA @@ -0,0 +1,581 @@ +Metadata-Version: 2.4 +Name: smart_open +Version: 7.5.1 +Summary: Utils for streaming large files (S3, HDFS, GCS, SFTP, Azure Blob Storage, gzip, bz2, zst...) +Author-email: Radim Rehurek +Project-URL: Repository, https://github.com/piskvorky/smart_open +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Topic :: System :: Distributed Computing +Classifier: Topic :: Database :: Front-Ends +Requires-Python: <4.0,>=3.10 +Description-Content-Type: text/x-rst +License-File: LICENSE +Requires-Dist: wrapt +Provides-Extra: s3 +Requires-Dist: boto3>=1.9.17; extra == "s3" +Provides-Extra: gcs +Requires-Dist: google-cloud-storage>=2.6.0; extra == "gcs" +Requires-Dist: google-api-core<2.28; python_version < "3.10" and extra == "gcs" +Provides-Extra: azure +Requires-Dist: azure-storage-blob; extra == "azure" +Requires-Dist: azure-common; extra == "azure" +Requires-Dist: azure-core; extra == "azure" +Provides-Extra: http +Requires-Dist: requests; extra == "http" +Provides-Extra: webhdfs +Requires-Dist: requests; extra == "webhdfs" +Provides-Extra: ssh +Requires-Dist: paramiko; extra == "ssh" +Provides-Extra: zst +Requires-Dist: backports.zstd>=1.0.0; python_version < "3.14" and extra == "zst" +Provides-Extra: all +Requires-Dist: smart_open[azure,gcs,http,s3,ssh,webhdfs,zst]; extra == "all" +Provides-Extra: test +Requires-Dist: smart_open[all]; extra == "test" +Requires-Dist: moto[server]; extra == "test" +Requires-Dist: responses; extra == "test" +Requires-Dist: pytest; extra == "test" +Requires-Dist: pytest-rerunfailures; extra == "test" +Requires-Dist: pytest_benchmark; extra == "test" +Requires-Dist: pytest-timeout; extra == "test" +Requires-Dist: pytest-xdist[psutil]; extra == "test" +Requires-Dist: awscli; extra == "test" +Requires-Dist: pyopenssl; extra == "test" +Requires-Dist: numpy; extra == "test" +Requires-Dist: flake8; extra == "test" +Dynamic: license-file + +====================================================== +smart_open — utils for streaming large files in Python +====================================================== + + +|License|_ |CI|_ |Coveralls|_ |Version|_ |Python|_ |Downloads|_ + +.. |License| image:: https://img.shields.io/pypi/l/smart_open.svg +.. |CI| image:: https://github.com/piskvorky/smart_open/actions/workflows/python-package.yml/badge.svg?branch=develop&event=push +.. |Coveralls| image:: https://coveralls.io/repos/github/RaRe-Technologies/smart_open/badge.svg?branch=develop +.. |Version| image:: https://img.shields.io/pypi/v/smart-open.svg?logo=pypi&logoColor=white +.. |Python| image:: https://img.shields.io/pypi/pyversions/smart-open.svg?logo=python&logoColor=white +.. |Downloads| image:: https://pepy.tech/badge/smart-open/month +.. _License: https://github.com/piskvorky/smart_open/blob/master/LICENSE +.. _CI: https://github.com/piskvorky/smart_open/actions/workflows/python-package.yml +.. _Coveralls: https://coveralls.io/github/RaRe-Technologies/smart_open?branch=HEAD +.. _Version: https://pypi.org/project/smart-open/ +.. _Python: https://pypi.org/project/smart-open/ +.. _Downloads: https://pypistats.org/packages/smart-open + + +What? +===== + +``smart_open`` is a Python 3 library for **efficient streaming of very large files** from/to storages such as S3, GCS, Azure Blob Storage, HDFS, WebHDFS, HTTP, HTTPS, SFTP, or local filesystem. It supports transparent, on-the-fly (de-)compression for a variety of different formats. + +``smart_open`` is a drop-in replacement for Python's built-in ``open()``: it can do anything ``open`` can (100% compatible, falls back to native ``open`` wherever possible), plus lots of nifty extra stuff on top. + +Why? +==== + +Working with large remote files, for example using Amazon's `boto3 `_ Python library, is a pain. +``boto3``'s ``Object.upload_fileobj()`` and ``Object.download_fileobj()`` methods require gotcha-prone boilerplate to use successfully, such as constructing file-like object wrappers. +``smart_open`` shields you from that. It builds on boto3 and other remote storage libraries, but offers a **clean unified Pythonic API**. The result is less code for you to write and fewer bugs to make. + + +How? +===== + +``smart_open`` is well-tested, well-documented, and has a simple Pythonic API: + + +.. _doctools_before_examples: + +.. code-block:: python + + >>> from smart_open import open + >>> + >>> # stream lines from an S3 object + >>> for line in open('s3://commoncrawl/robots.txt'): + ... print(repr(line)) + ... break + 'User-Agent: *\n' + + >>> # stream from/to compressed files, with transparent (de)compression: + >>> for line in open('tests/test_data/1984.txt.gz', encoding='utf-8'): + ... print(repr(line)) + 'It was a bright cold day in April, and the clocks were striking thirteen.\n' + 'Winston Smith, his chin nuzzled into his breast in an effort to escape the vile\n' + 'wind, slipped quickly through the glass doors of Victory Mansions, though not\n' + 'quickly enough to prevent a swirl of gritty dust from entering along with him.\n' + + >>> # can use context managers too: + >>> with open('tests/test_data/1984.txt.gz') as fin: + ... with open('tests/test_data/1984.txt.bz2', 'w') as fout: + ... for line in fin: + ... fout.write(line) + 74 + 80 + 78 + 79 + + >>> # can use any IOBase operations, like seek + >>> with open('s3://commoncrawl/robots.txt', 'rb') as fin: + ... for line in fin: + ... print(repr(line.decode('utf-8'))) + ... break + ... offset = fin.seek(0) # seek to the beginning + ... print(fin.read(4)) + 'User-Agent: *\n' + b'User' + + >>> # stream from HTTP + >>> for line in open('http://example.com'): + ... print(repr(line[:15])) + ... break + '' + +.. _doctools_after_examples: + +For more examples of URIs that ``smart_open`` accepts, see `help.txt `__ or ``help('smart_open')``. +Some examples:: + + s3://bucket/key + s3://access_key_id:secret_access_key@bucket/key + gs://bucket/blob + azure://bucket/blob + hdfs://path/file + ./local/path/file.gz + file:///home/user/file.bz2 + [ssh|scp|sftp]://username:password@host/path/file + + +Documentation +============= + +The API reference can be viewed at `help.txt `__ or using ``help('smart_open')``. + +Installation +------------ + +``smart_open`` supports a wide range of storage solutions. For all options, see the API reference. +Each individual solution has its own dependencies. +By default, ``smart_open`` does not install any dependencies in order to keep the installation size small. +You can install one or more of these dependencies explicitly using optional dependencies defined in +`pyproject.toml `__ : + +.. code-block:: sh + + pip install 'smart_open[s3,gcs,azure,http,webhdfs,ssh,zst]' + +Or, if you don't mind installing a large number of third party libraries, you can install all dependencies using: + +.. code-block:: sh + + pip install 'smart_open[all]' + +Built-in help +------------- + +To view the API reference, use the ``help`` python builtin: + +.. code-block:: python + + help('smart_open') + +or view `help.txt `__ in your browser. + +More examples +------------- + +For the sake of simplicity, the examples below assume you have all the dependencies installed, i.e. you have done: + +.. code-block:: sh + + pip install 'smart_open[all]' + +.. code-block:: python + + import os, boto3, botocore + from smart_open import open + + # stream content *into* S3 (write mode) using a custom client + # this client is thread-safe ref https://github.com/boto/boto3/blob/1.38.41/docs/source/guide/clients.rst?plain=1#L111 + config = botocore.client.Config( + max_pool_connections=64, + tcp_keepalive=True, + retries={"max_attempts": 6, "mode": "adaptive"}, + ) + client = boto3.Session( + aws_access_key_id=os.environ['AWS_ACCESS_KEY_ID'], + aws_secret_access_key=os.environ['AWS_SECRET_ACCESS_KEY'], + ).client("s3", config=config) + with open('s3://smart-open-py37-benchmark-results/test.txt', 'wb', transport_params={'client': client}) as fout: + bytes_written = fout.write(b'hello world!') + print(bytes_written) + + # perform a single-part upload to S3 (saves billable API requests, and allows seek() before upload) + with open('s3://smart-open-py37-benchmark-results/test.txt', 'wb', transport_params={'multipart_upload': False}) as fout: + bytes_written = fout.write(b'hello world!') + print(bytes_written) + # now with tempfile.TemporaryFile instead of the default io.BytesIO (to reduce memory footprint) + import tempfile + with tempfile.TemporaryFile() as tmp, open('s3://smart-open-py37-benchmark-results/test.txt', 'wb', transport_params={'multipart_upload': False, 'writebuffer': tmp}) as fout: + bytes_written = fout.write(b'hello world!') + print(bytes_written) + + # stream from HDFS + for line in open('hdfs://user/hadoop/my_file.txt', encoding='utf8'): + print(line) + + # stream from WebHDFS + for line in open('webhdfs://host:port/user/hadoop/my_file.txt'): + print(line) + + # stream content *into* HDFS (write mode): + with open('hdfs://host:port/user/hadoop/my_file.txt', 'wb') as fout: + fout.write(b'hello world') + + # stream content *into* WebHDFS (write mode): + with open('webhdfs://host:port/user/hadoop/my_file.txt', 'wb') as fout: + fout.write(b'hello world') + + # stream from a completely custom s3 server, like s3proxy: + for line in open('s3u://user:secret@host:port@mybucket/mykey.txt'): + print(line) + + # Stream to Digital Ocean Spaces bucket providing credentials from boto3 profile + session = boto3.Session(profile_name='digitalocean') + client = session.client('s3', endpoint_url='https://ams3.digitaloceanspaces.com') + transport_params = {'client': client} + with open('s3://bucket/key.txt', 'wb', transport_params=transport_params) as fout: + fout.write(b'here we stand') + + # stream from GCS + for line in open('gs://my_bucket/my_file.txt'): + print(line) + + # stream content *into* GCS (write mode): + with open('gs://my_bucket/my_file.txt', 'wb') as fout: + fout.write(b'hello world') + + # stream from Azure Blob Storage + connect_str = os.environ['AZURE_STORAGE_CONNECTION_STRING'] + transport_params = { + 'client': azure.storage.blob.BlobServiceClient.from_connection_string(connect_str), + } + for line in open('azure://mycontainer/myfile.txt', transport_params=transport_params): + print(line) + + # stream content *into* Azure Blob Storage (write mode): + connect_str = os.environ['AZURE_STORAGE_CONNECTION_STRING'] + transport_params = { + 'client': azure.storage.blob.BlobServiceClient.from_connection_string(connect_str), + } + with open('azure://mycontainer/my_file.txt', 'wb', transport_params=transport_params) as fout: + fout.write(b'hello world') + +Compression Handling +-------------------- + +The top-level `compression` parameter controls compression/decompression behavior when reading and writing. +The supported values for this parameter are: + +- ``infer_from_extension`` (default behavior) +- ``disable`` +- ``.bz2`` +- ``.gz`` +- ``.xz`` +- ``.zst`` + +By default, ``smart_open`` automatically (de)compresses the file if the filename ends with one of these extensions. +`See also `__ +``smart_open.compression.get_supported_compression_types`` and ``mart_open.compression.register_compressor``. + +.. code-block:: python + + >>> from smart_open import open + >>> with open('tests/test_data/1984.txt.gz') as fin: + ... print(fin.read(32)) + It was a bright cold day in Apri + +You can override this behavior to either disable compression, or explicitly specify the algorithm to use. +To disable compression: + +.. code-block:: python + + >>> from smart_open import open + >>> with open('tests/test_data/1984.txt.gz', 'rb', compression='disable') as fin: + ... print(fin.read(32)) + b'\x1f\x8b\x08\x08\x85F\x94\\\x00\x031984.txt\x005\x8f=r\xc3@\x08\x85{\x9d\xe2\x1d@' + + +To specify the algorithm explicitly (e.g. for non-standard file extensions): + +.. code-block:: python + + >>> from smart_open import open + >>> with open('tests/test_data/1984.txt.gzip', compression='.gz') as fin: + ... print(fin.read(32)) + It was a bright cold day in Apri + +You can also easily add support for other file extensions and compression formats. +For example, to open xz-compressed files: + +.. code-block:: python + + >>> import lzma, os + >>> from smart_open import open, register_compressor + + >>> def _handle_xz(file_obj, mode): + ... return lzma.LZMAFile(filename=file_obj, mode=mode) + + >>> register_compressor('.xz', _handle_xz) + + >>> with open('tests/test_data/1984.txt.xz') as fin: + ... print(fin.read(32)) + It was a bright cold day in Apri + +This is just an example: ``lzma`` is in the standard library and is registered by default. + +Transport-specific Options +-------------------------- + +``smart_open`` supports a wide range of transport options out of the box. +For the full list of supported URI schemes, see `help.txt `__ or ``help('smart_open')``. +Some examples:: + +- AWS S3 (and any S3-Compatible) +- HTTP, HTTPS (read-only) +- SSH, SCP and SFTP +- HDFS / WebHDFS +- Google Cloud Storage +- Azure Blob Storage + +Each option involves setting up its own set of parameters. +For example, for accessing S3, you often need to set up authentication, like API keys or a profile name. +``smart_open``'s ``open`` function accepts a keyword argument ``transport_params`` which accepts additional parameters for the transport layer. +Here are some examples of using this parameter: + +.. code-block:: python + + >>> import boto3 + >>> fin = open('s3://commoncrawl/robots.txt', transport_params=dict(client=boto3.client('s3'))) + >>> fin = open('s3://commoncrawl/robots.txt', transport_params=dict(buffer_size=1024)) + +For the full list of keyword arguments supported by each transport option, see `help.txt `__ or ``help('smart_open')``. + +.. code-block:: python + + help('smart_open.open') + +S3 Credentials +-------------- + +``smart_open`` uses the ``boto3`` library to talk to S3. +``boto3`` has several `mechanisms `__ for determining the credentials to use. +By default, ``smart_open`` will defer to ``boto3`` and let the latter take care of the credentials. +There are several ways to override this behavior. + +The first is to pass a ``boto3.Client`` object as a transport parameter to the ``open`` function. +You can customize the credentials when constructing the session for the client. +``smart_open`` will then use the session when talking to S3. + +.. code-block:: python + + session = boto3.Session( + aws_access_key_id=ACCESS_KEY, + aws_secret_access_key=SECRET_KEY, + aws_session_token=SESSION_TOKEN, + ) + client = session.client('s3', endpoint_url=..., config=...) + fin = open('s3://bucket/key', transport_params={'client': client}) + +Your second option is to specify the credentials within the S3 URL itself: + +.. code-block:: python + + fin = open('s3://aws_access_key_id:aws_secret_access_key@bucket/key', ...) + +*Important*: The two methods above are **mutually exclusive**. If you pass an AWS client *and* the URL contains credentials, ``smart_open`` will ignore the latter. + +*Important*: ``smart_open`` ignores configuration files from the older ``boto`` library. +Port your old ``boto`` settings to ``boto3`` in order to use them with ``smart_open``. + +S3 Advanced Usage +----------------- + +Additional keyword arguments can be propagated to the boto3 methods that are used by ``smart_open`` under the hood using the ``client_kwargs`` transport parameter. + +For instance, to upload a blob with Metadata, ACL, StorageClass, these keyword arguments can be passed to ``create_multipart_upload`` (`docs `__). + +.. code-block:: python + + kwargs = {'Metadata': {'version': 2}, 'ACL': 'authenticated-read', 'StorageClass': 'STANDARD_IA'} + fout = open('s3://bucket/key', 'wb', transport_params={'client_kwargs': {'S3.Client.create_multipart_upload': kwargs}}) + +Iterating Over an S3 Bucket's Contents +-------------------------------------- + +Since going over all (or select) keys in an S3 bucket is a very common operation, there's also an extra function ``smart_open.s3.iter_bucket()`` that does this efficiently, **processing the bucket keys in parallel** (using multiprocessing): + +.. code-block:: python + + >>> from smart_open import s3 + >>> # we use workers=1 for reproducibility; you should use as many workers as you have cores + >>> bucket = 'silo-open-data' + >>> prefix = 'Official/annual/monthly_rain/' + >>> for key, content in s3.iter_bucket(bucket, prefix=prefix, accept_key=lambda key: '/201' in key, workers=1, key_limit=3): + ... print(key, round(len(content) / 2**20)) + Official/annual/monthly_rain/2010.monthly_rain.nc 13 + Official/annual/monthly_rain/2011.monthly_rain.nc 13 + Official/annual/monthly_rain/2012.monthly_rain.nc 13 + +GCS Credentials +--------------- +``smart_open`` uses the ``google-cloud-storage`` library to talk to GCS. +``google-cloud-storage`` uses the ``google-cloud`` package under the hood to handle authentication. +There are several `options `__ to provide +credentials. +By default, ``smart_open`` will defer to ``google-cloud-storage`` and let it take care of the credentials. + +To override this behavior, pass a ``google.cloud.storage.Client`` object as a transport parameter to the ``open`` function. +You can `customize the credentials `__ +when constructing the client. ``smart_open`` will then use the client when talking to GCS. To follow allow with +the example below, `refer to Google's guide `__ +to setting up GCS authentication with a service account. + +.. code-block:: python + + import os + from google.cloud.storage import Client + service_account_path = os.environ['GOOGLE_APPLICATION_CREDENTIALS'] + client = Client.from_service_account_json(service_account_path) + fin = open('gs://gcp-public-data-landsat/index.csv.gz', transport_params=dict(client=client)) + +If you need more credential options, you can create an explicit ``google.auth.credentials.Credentials`` object +and pass it to the Client. To create an API token for use in the example below, refer to the +`GCS authentication guide `__. + +.. code-block:: python + + import os + from google.auth.credentials import Credentials + from google.cloud.storage import Client + token = os.environ['GOOGLE_API_TOKEN'] + credentials = Credentials(token=token) + client = Client(credentials=credentials) + fin = open('gs://gcp-public-data-landsat/index.csv.gz', transport_params={'client': client}) + +GCS Advanced Usage +------------------ + +Additional keyword arguments can be propagated to the GCS open method (`docs `__), which is used by ``smart_open`` under the hood, using the ``blob_open_kwargs`` transport parameter. + +Additionally keyword arguments can be propagated to the GCS ``get_blob`` method (`docs `__) when in a read-mode, using the ``get_blob_kwargs`` transport parameter. + +Additional blob properties (`docs `__) can be set before an upload, as long as they are not read-only, using the ``blob_properties`` transport parameter. + +.. code-block:: python + + open_kwargs = {'predefined_acl': 'authenticated-read'} + properties = {'metadata': {'version': 2}, 'storage_class': 'COLDLINE'} + fout = open('gs://bucket/key', 'wb', transport_params={'blob_open_kwargs': open_kwargs, 'blob_properties': properties}) + +Azure Credentials +----------------- + +``smart_open`` uses the ``azure-storage-blob`` library to talk to Azure Blob Storage. +By default, ``smart_open`` will defer to ``azure-storage-blob`` and let it take care of the credentials. + +Azure Blob Storage does not have any ways of inferring credentials therefore, passing a ``azure.storage.blob.BlobServiceClient`` +object as a transport parameter to the ``open`` function is required. +You can `customize the credentials `__ +when constructing the client. ``smart_open`` will then use the client when talking to. To follow allow with +the example below, `refer to Azure's guide `__ +to setting up authentication. + +.. code-block:: python + + import os + from azure.storage.blob import BlobServiceClient + azure_storage_connection_string = os.environ['AZURE_STORAGE_CONNECTION_STRING'] + client = BlobServiceClient.from_connection_string(azure_storage_connection_string) + fin = open('azure://my_container/my_blob.txt', transport_params={'client': client}) + +If you need more credential options, refer to the +`Azure Storage authentication guide `__. + +Azure Advanced Usage +-------------------- + +Additional keyword arguments can be propagated to the ``commit_block_list`` method (`docs `__), which is used by ``smart_open`` under the hood for uploads, using the ``blob_kwargs`` transport parameter. + +.. code-block:: python + + kwargs = {'metadata': {'version': 2}} + fout = open('azure://container/key', 'wb', transport_params={'blob_kwargs': kwargs}) + +Drop-in replacement of ``pathlib.Path.open`` +-------------------------------------------- + +``smart_open.open`` can also be used with ``Path`` objects. +The built-in `Path.open()` is not able to read text from compressed files, so use ``patch_pathlib`` to replace it with `smart_open.open()` instead. +This can be helpful when e.g. working with compressed files. + +.. code-block:: python + + >>> from pathlib import Path + >>> from smart_open.smart_open_lib import patch_pathlib + >>> + >>> _ = patch_pathlib() # replace `Path.open` with `smart_open.open` + >>> + >>> path = Path("tests/test_data/crime-and-punishment.txt.gz") + >>> + >>> with path.open("r") as infile: + ... print(infile.readline()[:41]) + В начале июля, в чрезвычайно жаркое время + +How do I ...? +============= + +See `this document `__. + +Extending ``smart_open`` +======================== + +See `this document `__. + +Testing ``smart_open`` +====================== + +``smart_open`` comes with a comprehensive suite of unit tests. +Before you can run the test suite, install the test dependencies:: + + pip install -e .[test] + +Now, you can run the unit tests:: + + pytest tests + +The tests are also run automatically with `GitHub Actions `_ on every commit push & pull request. + +Comments, bug reports +===================== + +``smart_open`` lives on `Github `_. You can file +issues or pull requests there. Suggestions, pull requests and improvements welcome! + +---------------- + +``smart_open`` is open source software released under the `MIT license `_. +Copyright (c) 2015-now `Radim Řehůřek `_. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..29bfd26d5b0c8bdcbae7302b2ece1d854a509b47 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/RECORD @@ -0,0 +1,42 @@ +smart_open-7.5.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +smart_open-7.5.1.dist-info/METADATA,sha256=JfDtORnq6t5nrpv-Ud3r0FKl1ElnKblzA6_FsNvQFQk,24997 +smart_open-7.5.1.dist-info/RECORD,, +smart_open-7.5.1.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91 +smart_open-7.5.1.dist-info/licenses/LICENSE,sha256=y-3Nu6aU9arZ5fZYdbz3E3vH5jB-HRGo1Su6mUPYL5g,1084 +smart_open-7.5.1.dist-info/top_level.txt,sha256=6rlVExUYRo3KUmXhVLAqF86SbZvWWha5yb4r_89odYQ,11 +smart_open/__init__.py,sha256=-sC7N_x0kcl5De_n8UXdxVSrqA1ZTFsQHM6KPEEGtho,2116 +smart_open/__pycache__/__init__.cpython-312.pyc,, +smart_open/__pycache__/azure.cpython-312.pyc,, +smart_open/__pycache__/bytebuffer.cpython-312.pyc,, +smart_open/__pycache__/compression.cpython-312.pyc,, +smart_open/__pycache__/concurrency.cpython-312.pyc,, +smart_open/__pycache__/constants.cpython-312.pyc,, +smart_open/__pycache__/doctools.cpython-312.pyc,, +smart_open/__pycache__/ftp.cpython-312.pyc,, +smart_open/__pycache__/gcs.cpython-312.pyc,, +smart_open/__pycache__/hdfs.cpython-312.pyc,, +smart_open/__pycache__/http.cpython-312.pyc,, +smart_open/__pycache__/local_file.cpython-312.pyc,, +smart_open/__pycache__/s3.cpython-312.pyc,, +smart_open/__pycache__/smart_open_lib.cpython-312.pyc,, +smart_open/__pycache__/ssh.cpython-312.pyc,, +smart_open/__pycache__/transport.cpython-312.pyc,, +smart_open/__pycache__/utils.cpython-312.pyc,, +smart_open/__pycache__/webhdfs.cpython-312.pyc,, +smart_open/azure.py,sha256=XUdj_LX52rzcuD5nBHnzLXR1y9wtw32W3pf9-5kSdnM,18106 +smart_open/bytebuffer.py,sha256=sLuzU5RAN4qwkakUyZWPW5hF50mVc6j7ORGY8K4MjW8,5994 +smart_open/compression.py,sha256=8tRG-gIgJYE_XMPGHlrSXBbFpvV7EvXMGVNy5QTn1D8,5533 +smart_open/concurrency.py,sha256=juY5jbCr9yQYu_Q3CmOUfoHC3YIiT9_93qJDBQTOomc,3396 +smart_open/constants.py,sha256=g5crItFcK04e_GyQQxqk1lSeF4FbU-TCL23dxNvh1Yw,467 +smart_open/doctools.py,sha256=4M7cC4DE_m9f7WN3tV8367sROG2-8g35rqt8Dr_Yb_k,7439 +smart_open/ftp.py,sha256=8-611UqdQdM-Q8KbcPgSlIVN7_73y8yRQaI1GuyzTXo,4727 +smart_open/gcs.py,sha256=eUlYshjrkUAaMseJAN-O-tYBnlpJMRCb7OODf706sD0,5115 +smart_open/hdfs.py,sha256=HPKB-PqEHGqxKlinHwyotaBQv53-Y7Wc2pbmdFtYQaQ,4195 +smart_open/http.py,sha256=N_UUuhGQMhm5AOGnkQA-5_6w250Q1mYUIQ3wAw3gm6Q,9837 +smart_open/local_file.py,sha256=ReUSBt-JSLQj_BsQ40z_ad3drwx8XCzfOZ1StTwt9Ps,1004 +smart_open/s3.py,sha256=qhFdFMLodB1tHw3OFM3U-26xBimvny-vgrore5phPH4,53120 +smart_open/smart_open_lib.py,sha256=CNr3Y0s0xMEK4N-d40M0cuHjToZRAZqfXfk57vgTtuU,16274 +smart_open/ssh.py,sha256=kIND9K-1baTPVOF-jFm4Kf-xXVJEctK3UkTrFMlxS8k,9236 +smart_open/transport.py,sha256=LpSSvsY2u3Ao5mhYn9jOXPhiu6n6estuqKjN_yOMEAs,3258 +smart_open/utils.py,sha256=GYnzT9hlpBYlO5y7WFTsPNXh4hKh1rKrPqc7a0rMdH4,7443 +smart_open/webhdfs.py,sha256=JVp6B4SZgH-MOt1T3nhqxekh1CDVVbGNCP67MoCNrXk,8589 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..1ef5583317a5e59140e3f1c85c2db91aec0961e8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (82.0.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..a92b5257d4cfdada3d9a8b629ebaee599a2de3ae --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open-7.5.1.dist-info/top_level.txt @@ -0,0 +1 @@ +smart_open diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b9f0a7180863d729e4e9072f2cfdfc15f2459abc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/__init__.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2019 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# + +""" +Utilities for streaming to/from several file-like data storages: S3 / HDFS / local +filesystem / compressed files, and many more, using a simple, Pythonic API. + +The streaming makes heavy use of generators and pipes, to avoid loading +full file contents into memory, allowing work with arbitrarily large files. + +The main functions are: + +* `open()`, which opens the given file for reading/writing +* `parse_uri()` +* `s3_iter_bucket()`, which goes over all keys in an S3 bucket in parallel +* `register_compressor()`, which registers callbacks for transparent compressor handling + +""" + +import contextlib +import logging +from importlib.metadata import PackageNotFoundError, version + +with contextlib.suppress(PackageNotFoundError): + __version__ = version("smart_open") +# +# Prevent regression of #474 and #475 +# +logger = logging.getLogger(__name__) +logger.addHandler(logging.NullHandler()) + +from .smart_open_lib import open, parse_uri, smart_open, register_compressor # noqa: E402 + +_WARNING = """smart_open.s3_iter_bucket is deprecated and will stop functioning +in a future version. Please import iter_bucket from the smart_open.s3 module instead: + + from smart_open.s3 import iter_bucket as s3_iter_bucket + +""" +_WARNED = False + + +def s3_iter_bucket( + bucket_name, + prefix='', + accept_key=None, + key_limit=None, + workers=16, + retries=3, + **session_kwargs +): + """Deprecated. Use smart_open.s3.iter_bucket instead.""" + global _WARNED + from .s3 import iter_bucket + if not _WARNED: + logger.warning(_WARNING) + _WARNED = True + return iter_bucket( + bucket_name=bucket_name, + prefix=prefix, + accept_key=accept_key, + key_limit=key_limit, + workers=workers, + retries=retries, + session_kwargs=session_kwargs + ) + + +__all__ = [ + 'open', + 'parse_uri', + 'register_compressor', + 's3_iter_bucket', + 'smart_open', +] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/azure.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/azure.py new file mode 100644 index 0000000000000000000000000000000000000000..6ad950fe8516272f04372b07a506abcffb16718d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/azure.py @@ -0,0 +1,542 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2020 Radim Rehurek +# Copyright (C) 2020 Nicolas Mitchell +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# +"""Implements file-like objects for reading and writing to/from Azure Blob Storage.""" + +import base64 +import io +import logging + +import smart_open.bytebuffer +import smart_open.constants + +try: + import azure.storage.blob + import azure.core.exceptions +except ImportError: + MISSING_DEPS = True + +logger = logging.getLogger(__name__) + +_BINARY_TYPES = (bytes, bytearray, memoryview) +"""Allowed binary buffer types for writing to the underlying Azure Blob Storage stream""" + +SCHEME = "azure" +"""Supported scheme for Azure Blob Storage in smart_open endpoint URL""" + +_DEFAULT_MIN_PART_SIZE = 64 * 1024**2 +"""Default minimum part size for Azure Cloud Storage multipart uploads is 64MB""" + +DEFAULT_BUFFER_SIZE = 4 * 1024**2 +"""Default buffer size for working with Azure Blob Storage is 256MB +https://docs.microsoft.com/en-us/rest/api/storageservices/understanding-block-blobs--append-blobs--and-page-blobs +""" + +DEFAULT_MAX_CONCURRENCY = 1 +"""Default number of parallel connections with which to download.""" + + +def parse_uri(uri_as_string): + sr = smart_open.utils.safe_urlsplit(uri_as_string) + assert sr.scheme == SCHEME + first = sr.netloc + second = sr.path.lstrip('/') + + # https://docs.microsoft.com/en-us/rest/api/storageservices/working-with-the-root-container + if not second: + container_id = '$root' + blob_id = first + else: + container_id = first + blob_id = second + + return dict(scheme=SCHEME, container_id=container_id, blob_id=blob_id) + + +def open_uri(uri, mode, transport_params): + parsed_uri = parse_uri(uri) + kwargs = smart_open.utils.check_kwargs(open, transport_params) + return open(parsed_uri['container_id'], parsed_uri['blob_id'], mode, **kwargs) + + +def open( + container_id, + blob_id, + mode, + client=None, # type: Union[azure.storage.blob.BlobServiceClient, azure.storage.blob.ContainerClient, azure.storage.blob.BlobClient] # noqa + blob_kwargs=None, + buffer_size=DEFAULT_BUFFER_SIZE, + min_part_size=_DEFAULT_MIN_PART_SIZE, + max_concurrency=DEFAULT_MAX_CONCURRENCY, + ): + """Open an Azure Blob Storage blob for reading or writing. + + Parameters + ---------- + container_id: str + The name of the container this object resides in. + blob_id: str + The name of the blob within the bucket. + mode: str + The mode for opening the object. Must be either "rb" or "wb". + client: azure.storage.blob.BlobServiceClient, ContainerClient, or BlobClient + The Azure Blob Storage client to use when working with azure-storage-blob. + blob_kwargs: dict, optional + Additional parameters to pass to `BlobClient.commit_block_list`. + For writing only. + buffer_size: int, optional + The buffer size to use when performing I/O. For reading only. + min_part_size: int, optional + The minimum part size for multipart uploads. For writing only. + max_concurrency: int, optional + The number of parallel connections with which to download. For reading only. + + """ + if not client: + raise ValueError('you must specify the client to connect to Azure') + + if mode == smart_open.constants.READ_BINARY: + return Reader( + container_id, + blob_id, + client, + buffer_size=buffer_size, + line_terminator=smart_open.constants.BINARY_NEWLINE, + max_concurrency=max_concurrency, + ) + elif mode == smart_open.constants.WRITE_BINARY: + return Writer( + container_id, + blob_id, + client, + blob_kwargs=blob_kwargs, + min_part_size=min_part_size + ) + else: + raise NotImplementedError('Azure Blob Storage support for mode %r not implemented' % mode) + + +def _get_blob_client(client, container, blob): + # type: (Union[azure.storage.blob.BlobServiceClient, azure.storage.blob.ContainerClient, azure.storage.blob.BlobClient], str, str) -> azure.storage.blob.BlobClient # noqa + """ + Return an Azure BlobClient starting with any of BlobServiceClient, + ContainerClient, or BlobClient plus container name and blob name. + """ + if hasattr(client, "get_container_client"): + client = client.get_container_client(container) + + if hasattr(client, "container_name") and client.container_name != container: + raise ValueError( + "Client for %r doesn't match " + "container %r" % (client.container_name, container) + ) + + if hasattr(client, "get_blob_client"): + client = client.get_blob_client(blob) + + return client + + +class _RawReader(object): + """Read an Azure Blob Storage file.""" + + def __init__(self, blob, size, concurrency): + # type: (azure.storage.blob.BlobClient, int, int) -> None + self._blob = blob + self._size = size + self._position = 0 + self._concurrency = concurrency + + def seek(self, position): + """Seek to the specified position (byte offset) in the Azure Blob Storage blob. + + :param int position: The byte offset from the beginning of the blob. + + Returns the position after seeking. + """ + self._position = position + return self._position + + def read(self, size=-1): + if self._position >= self._size: + return b'' + binary = self._download_blob_chunk(size) + self._position += len(binary) + return binary + + def _download_blob_chunk(self, size): + if self._size == self._position: + # + # When reading, we can't seek to the first byte of an empty file. + # Similarly, we can't seek past the last byte. Do nothing here. + # + return b'' + elif size == -1: + stream = self._blob.download_blob(offset=self._position, max_concurrency=self._concurrency) + else: + stream = self._blob.download_blob( + offset=self._position, max_concurrency=self._concurrency, length=size) + logging.debug('reading with a max concurrency of %d', self._concurrency) + if isinstance(stream, azure.storage.blob.StorageStreamDownloader): + binary = stream.readall() + else: + binary = stream.read() + return binary + + +class Reader(io.BufferedIOBase): + """Reads bytes from Azure Blob Storage. + + Implements the io.BufferedIOBase interface of the standard library. + + :raises azure.core.exceptions.ResourceNotFoundError: Raised when the blob to read from does not exist. + """ + _blob = None # so `closed` property works in case __init__ fails and __del__ is called + + def __init__( + self, + container, + blob, + client, # type: Union[azure.storage.blob.BlobServiceClient, azure.storage.blob.ContainerClient, azure.storage.blob.BlobClient] # noqa + buffer_size=DEFAULT_BUFFER_SIZE, + line_terminator=smart_open.constants.BINARY_NEWLINE, + max_concurrency=DEFAULT_MAX_CONCURRENCY, + ): + self._container_name = container + self._blob_name = blob + + # type: azure.storage.blob.BlobClient + self._blob = _get_blob_client(client, container, blob) + + if self._blob is None: + raise azure.core.exceptions.ResourceNotFoundError( + 'blob %s not found in %s' % (blob, container) + ) + try: + self._size = self._blob.get_blob_properties()['size'] + except KeyError: + self._size = 0 + + self._raw_reader = _RawReader(self._blob, self._size, max_concurrency) + self._position = 0 + self._current_part = smart_open.bytebuffer.ByteBuffer(buffer_size) + self._line_terminator = line_terminator + + # + # Override some methods from io.IOBase. + # + def close(self): + """Flush and close this stream.""" + logger.debug("close: called") + if not self.closed: + self._blob = None + self._raw_reader = None + + @property + def closed(self): + return self._blob is None + + def readable(self): + """Return True if the stream can be read from.""" + return True + + def seekable(self): + """If False, seek(), tell() and truncate() will raise IOError. + + We offer only seek support, and no truncate support.""" + return True + + # + # io.BufferedIOBase methods. + # + def detach(self): + """Unsupported.""" + raise io.UnsupportedOperation + + def seek(self, offset, whence=smart_open.constants.WHENCE_START): + """Seek to the specified position. + + :param int offset: The offset in bytes. + :param int whence: Where the offset is from. + + Returns the position after seeking.""" + logger.debug('seeking to offset: %r whence: %r', offset, whence) + if whence not in smart_open.constants.WHENCE_CHOICES: + raise ValueError('invalid whence %i, expected one of %r' % (whence, + smart_open.constants.WHENCE_CHOICES)) + + if whence == smart_open.constants.WHENCE_START: + new_position = offset + elif whence == smart_open.constants.WHENCE_CURRENT: + new_position = self._position + offset + else: + new_position = self._size + offset + self._position = new_position + self._raw_reader.seek(new_position) + logger.debug('current_pos: %r', self._position) + + self._current_part.empty() + return self._position + + def tell(self): + """Return the current position within the file.""" + return self._position + + def truncate(self, size=None): + """Unsupported.""" + raise io.UnsupportedOperation + + def read(self, size=-1): + """Read up to size bytes from the object and return them.""" + if size == 0: + return b'' + elif size < 0: + self._position = self._size + return self._read_from_buffer() + self._raw_reader.read() + + # + # Return unused data first + # + if len(self._current_part) >= size: + return self._read_from_buffer(size) + + if self._position == self._size: + return self._read_from_buffer() + + self._fill_buffer(size) + return self._read_from_buffer(size) + + def read1(self, size=-1): + """This is the same as read().""" + return self.read(size=size) + + def readinto(self, b): + """Read up to len(b) bytes into b, and return the number of bytes read.""" + data = self.read(len(b)) + if not data: + return 0 + b[:len(data)] = data + return len(data) + + def readline(self, limit=-1): + """Read up to and including the next newline. Returns the bytes read.""" + if limit != -1: + raise NotImplementedError('limits other than -1 not implemented yet') + + # + # A single line may span multiple buffers. + # + line = io.BytesIO() + while not (self._position == self._size and len(self._current_part) == 0): + line_part = self._current_part.readline(self._line_terminator) + line.write(line_part) + self._position += len(line_part) + + if line_part.endswith(self._line_terminator): + break + else: + self._fill_buffer() + + return line.getvalue() + + # + # Internal methods. + # + def _read_from_buffer(self, size=-1): + """Remove at most size bytes from our buffer and return them.""" + # logger.debug('reading %r bytes from %r byte-long buffer', size, len(self._current_part)) + size = size if size >= 0 else len(self._current_part) + part = self._current_part.read(size) + self._position += len(part) + # logger.debug('part: %r', part) + return part + + def _fill_buffer(self, size=-1): + size = max(size, self._current_part._chunk_size) + while len(self._current_part) < size and not self._position == self._size: + bytes_read = self._current_part.fill(self._raw_reader) + if bytes_read == 0: + logger.debug('reached EOF while filling buffer') + return True + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.close() + + def __str__(self): + return "(%s, %r, %r)" % ( + self.__class__.__name__, + self._container_name, + self._blob_name + ) + + def __repr__(self): + return "%s(container=%r, blob=%r)" % ( + self.__class__.__name__, + self._container_name, + self._blob_name, + ) + + +class Writer(io.BufferedIOBase): + """Writes bytes to Azure Blob Storage. + + Implements the io.BufferedIOBase interface of the standard library. + """ + _blob = None # so `closed` property works in case __init__ fails and __del__ is called + + def __init__( + self, + container, + blob, + client, # type: Union[azure.storage.blob.BlobServiceClient, azure.storage.blob.ContainerClient, azure.storage.blob.BlobClient] # noqa + blob_kwargs=None, + min_part_size=_DEFAULT_MIN_PART_SIZE, + ): + self._container_name = container + self._blob_name = blob + self._blob_kwargs = blob_kwargs or {} + self._min_part_size = min_part_size + self._total_size = 0 + self._total_parts = 0 + self._bytes_uploaded = 0 + self._current_part = io.BytesIO() + self._block_list = [] + + # type: azure.storage.blob.BlobClient + self._blob = _get_blob_client(client, container, blob) + + def flush(self): + pass + + def terminate(self): + """Do not commit block list on abort. + + Uploaded (uncommitted) blocks will be garbage collected after 7 days. + + See also https://stackoverflow.com/a/69673084/5511061.""" + logger.debug('%s: terminating multipart upload', self) + if not self.closed: + self._block_list = [] + self._blob = None + logger.debug('%s: terminated multipart upload', self) + + # + # Override some methods from io.IOBase. + # + def close(self): + logger.debug("close: called") + if not self.closed: + logger.debug('%s: completing multipart upload', self) + if self._current_part.tell() > 0: + self._upload_part() + self._blob.commit_block_list(self._block_list, **self._blob_kwargs) + self._block_list = [] + self._blob = None + logger.debug('%s: completed multipart upload', self) + + @property + def closed(self): + return self._blob is None + + def writable(self): + """Return True if the stream supports writing.""" + return True + + def seekable(self): + """If False, seek(), tell() and truncate() will raise IOError. + + We offer only tell support, and no seek or truncate support.""" + return True + + def seek(self, offset, whence=smart_open.constants.WHENCE_START): + """Unsupported.""" + raise io.UnsupportedOperation + + def truncate(self, size=None): + """Unsupported.""" + raise io.UnsupportedOperation + + def tell(self): + """Return the current stream position.""" + return self._total_size + + # + # io.BufferedIOBase methods. + # + def detach(self): + raise io.UnsupportedOperation("detach() not supported") + + def write(self, b): + """Write the given bytes (binary string) to the Azure Blob Storage file. + + There's buffering happening under the covers, so this may not actually + do any HTTP transfer right away.""" + + if not isinstance(b, _BINARY_TYPES): + raise TypeError("input must be one of %r, got: %r" % (_BINARY_TYPES, type(b))) + + self._current_part.write(b) + self._total_size += len(b) + + if self._current_part.tell() >= self._min_part_size: + self._upload_part() + + return len(b) + + def _upload_part(self): + part_num = self._total_parts + 1 + content_length = self._current_part.tell() + range_stop = self._bytes_uploaded + content_length - 1 + + """ # noqa: E501 + block_id's must be base64 encoded, all the same length, and less than or equal to 64 bytes in size prior + to encoding. + https://docs.microsoft.com/en-us/python/api/azure-storage-blob/azure.storage.blob.blobclient?view=azure-python#stage-block-block-id--data--length-none----kwargs- + """ + zero_padded_part_num = str(part_num).zfill(64 // 2) + block_id = base64.b64encode(zero_padded_part_num.encode()) + self._current_part.seek(0) + self._blob.stage_block(block_id, self._current_part.read(content_length)) + self._block_list.append(azure.storage.blob.BlobBlock(block_id=block_id)) + + logger.info( + "uploading part #%i, %i bytes (total %.3fGB)", + part_num, content_length, range_stop / 1024.0 ** 3, + ) + + self._total_parts += 1 + self._bytes_uploaded += content_length + self._current_part = io.BytesIO(self._current_part.read()) + self._current_part.seek(0, io.SEEK_END) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + if exc_type is not None: + self.terminate() + else: + self.close() + + def __str__(self): + return "(%s, %r, %r)" % ( + self.__class__.__name__, + self._container_name, + self._blob_name + ) + + def __repr__(self): + return "%s(container=%r, blob=%r, min_part_size=%r)" % ( + self.__class__.__name__, + self._container_name, + self._blob_name, + self._min_part_size + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/bytebuffer.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/bytebuffer.py new file mode 100644 index 0000000000000000000000000000000000000000..6aaa25155ac3c9a122fe9a7c215583060bb62097 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/bytebuffer.py @@ -0,0 +1,180 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2019 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# +"""Implements ByteBuffer class for amortizing network transfer overhead.""" + +import io + + +class ByteBuffer(object): + """Implements a byte buffer that allows callers to read data with minimal + copying, and has a fast __len__ method. The buffer is parametrized by its + chunk_size, which is the number of bytes that it will read in from the + supplied reader or iterable when the buffer is being filled. As primary use + case for this buffer is to amortize the overhead costs of transferring data + over the network (rather than capping memory consumption), it leads to more + predictable performance to always read the same amount of bytes each time + the buffer is filled, hence the chunk_size parameter instead of some fixed + capacity. + + The bytes are stored in a bytestring, and previously-read bytes are freed + when the buffer is next filled (by slicing the bytestring into a smaller + copy). + + Example + ------- + + Note that while this example works in both Python 2 and 3, the doctest only + passes in Python 3 due to the bytestring literals in the expected values. + + >>> buf = ByteBuffer(chunk_size = 8) + >>> message_bytes = iter([b'Hello, W', b'orld!']) + >>> buf.fill(message_bytes) + 8 + >>> len(buf) # only chunk_size bytes are filled + 8 + >>> buf.peek() + b'Hello, W' + >>> len(buf) # peek() does not change read position + 8 + >>> buf.read(6) + b'Hello,' + >>> len(buf) # read() does change read position + 2 + >>> buf.fill(message_bytes) + 5 + >>> buf.read() + b' World!' + >>> len(buf) + 0 + """ + + def __init__(self, chunk_size=io.DEFAULT_BUFFER_SIZE): + """Create a ByteBuffer instance that reads chunk_size bytes when filled. + Note that the buffer has no maximum size. + + Parameters + ----------- + chunk_size: int, optional + The the number of bytes that will be read from the supplied reader + or iterable when filling the buffer. + """ + self._chunk_size = chunk_size + self.empty() + + def __len__(self): + """Return the number of unread bytes in the buffer as an int""" + return len(self._bytes) - self._pos + + def read(self, size=-1): + """Read bytes from the buffer and advance the read position. Returns + the bytes in a bytestring. + + Parameters + ---------- + size: int, optional + Maximum number of bytes to read. If negative or not supplied, read + all unread bytes in the buffer. + + Returns + ------- + bytes + """ + part = self.peek(size) + self._pos += len(part) + return part + + def peek(self, size=-1): + """Get bytes from the buffer without advancing the read position. + Returns the bytes in a bytestring. + + Parameters + ---------- + size: int, optional + Maximum number of bytes to return. If negative or not supplied, + return all unread bytes in the buffer. + + Returns + ------- + bytes + """ + if size < 0 or size > len(self): + size = len(self) + + part = bytes(self._bytes[self._pos:self._pos+size]) + return part + + def empty(self): + """Remove all bytes from the buffer""" + self._bytes = bytearray() + self._pos = 0 + + def fill(self, source, size=-1): + """Fill the buffer with bytes from source until one of these + conditions is met: + * size bytes have been read from source (if size >= 0); + * chunk_size bytes have been read from source; + * no more bytes can be read from source; + Returns the number of new bytes added to the buffer. + Note: all previously-read bytes in the buffer are removed. + + Parameters + ---------- + source: a file-like object, or iterable/list that contains bytes + The source of bytes to fill the buffer with. If this argument has + the `read` attribute, it's assumed to be a file-like object and + `read` is called to get the bytes; otherwise it's assumed to be an + iterable or list that contains bytes, and a for loop is used to get + the bytes. + size: int, optional + The number of bytes to try to read from source. If not supplied, + negative, or larger than the buffer's chunk_size, then chunk_size + bytes are read. Note that if source is an iterable or list, then + it's possible that more than size bytes will be read if iterating + over source produces more than one byte at a time. + + Returns + ------- + int, the number of new bytes added to the buffer. + """ + size = size if size >= 0 else self._chunk_size + size = min(size, self._chunk_size) + + if self._pos != 0: + self._bytes = self._bytes[self._pos:] + self._pos = 0 + + if hasattr(source, 'read'): + new_bytes = source.read(size) + else: + new_bytes = bytearray() + for more_bytes in source: + new_bytes += more_bytes + if len(new_bytes) >= size: + break + + self._bytes += new_bytes + return len(new_bytes) + + def readline(self, terminator): + """Read a line from this buffer efficiently. + + A line is a contiguous sequence of bytes that ends with either: + + 1. The ``terminator`` character + 2. The end of the buffer itself + + :param byte terminator: The line terminator character. + :rtype: bytes + + """ + index = self._bytes.find(terminator, self._pos) + if index == -1: + size = len(self) + else: + size = index - self._pos + 1 + return self.read(size) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/compression.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/compression.py new file mode 100644 index 0000000000000000000000000000000000000000..ace754108e744042752db512f9debe1bbf3bbf5f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/compression.py @@ -0,0 +1,179 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2020 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# +"""Implements the compression layer of the `smart_open` library.""" +import io +import logging +import os.path + +logger = logging.getLogger(__name__) + +_COMPRESSOR_REGISTRY = {} + +NO_COMPRESSION = 'disable' +"""Use no compression. Read/write the data as-is.""" +INFER_FROM_EXTENSION = 'infer_from_extension' +"""Determine the compression to use from the file extension. + +See get_supported_extensions(). +""" + + +def get_supported_compression_types(): + """Return the list of supported compression types available to open. + + See compression paratemeter to smart_open.open(). + """ + return [NO_COMPRESSION, INFER_FROM_EXTENSION] + get_supported_extensions() + + +def get_supported_extensions(): + """Return the list of file extensions for which we have registered compressors.""" + return sorted(_COMPRESSOR_REGISTRY.keys()) + + +def register_compressor(ext, callback): + """Register a callback for transparently decompressing files with a specific extension. + + Parameters + ---------- + ext: str + The extension. Must include the leading period, e.g. `.gz`. + callback: callable + The callback. It must accept two position arguments, file_obj and mode. + This function will be called when `smart_open` is opening a file with + the specified extension. + + Examples + -------- + + Instruct smart_open to use the `lzma` module whenever opening a file + with a .xz extension (see README.rst for the complete example showing I/O): + + >>> def _handle_xz(file_obj, mode): + ... import lzma + ... return lzma.LZMAFile(filename=file_obj, mode=mode) + >>> + >>> register_compressor('.xz', _handle_xz) + + This is just an example: `lzma` is in the standard library and is registered by default. + + """ + if not (ext and ext[0] == '.'): + raise ValueError('ext must be a string starting with ., not %r' % ext) + ext = ext.lower() + if ext in _COMPRESSOR_REGISTRY: + logger.warning('overriding existing compression handler for %r', ext) + _COMPRESSOR_REGISTRY[ext] = callback + + +def tweak_close(outer, inner): + """Ensure that closing the `outer` stream closes the `inner` stream as well. + + Deprecated: `smart_open.open().__exit__` now always calls `__exit__` on the + underlying filestream. + + Use this when your compression library's `close` method does not + automatically close the underlying filestream. See + https://github.com/piskvorky/smart_open/issues/630 for an + explanation why that is a problem for smart_open. + """ + outer_close = outer.close + + def close_both(*args): + nonlocal inner + try: + outer_close() + finally: + if inner: + inner, fp = None, inner + fp.close() + + outer.close = close_both + + +def _maybe_wrap_buffered(file_obj, mode): + # https://github.com/piskvorky/smart_open/issues/760#issuecomment-1553971657 + result = file_obj + if "b" in mode and "w" in mode: + result = io.BufferedWriter(result) + elif "b" in mode and "r" in mode: + result = io.BufferedReader(result) + return result + + +def _handle_bz2(file_obj, mode): + import bz2 + result = bz2.open(filename=file_obj, mode=mode) + return _maybe_wrap_buffered(result, mode) + + +def _handle_gzip(file_obj, mode): + import gzip + result = gzip.open(filename=file_obj, mode=mode) + return _maybe_wrap_buffered(result, mode) + + +def _handle_zstd(file_obj, mode): + import sys + if sys.version_info >= (3, 14): + from compression import zstd + else: + from backports import zstd + result = zstd.open(file_obj, mode=mode) + return _maybe_wrap_buffered(result, mode) + + +def _handle_xz(file_obj, mode): + import lzma + result = lzma.open(filename=file_obj, mode=mode) + return _maybe_wrap_buffered(result, mode) + + +def compression_wrapper(file_obj, mode, compression=INFER_FROM_EXTENSION, filename=None): + """ + Wrap `file_obj` with an appropriate [de]compression mechanism based on its file extension. + + If the filename extension isn't recognized, simply return the original `file_obj` unchanged. + + `file_obj` must either be a filehandle object, or a class which behaves like one. + + If `filename` is specified, it will be used to extract the extension. + If not, the `file_obj.name` attribute is used as the filename. + + """ + if compression == NO_COMPRESSION: + return file_obj + elif compression == INFER_FROM_EXTENSION: + try: + filename = (filename or file_obj.name).lower() + except (AttributeError, TypeError): + logger.warning( + 'unable to transparently decompress %r because it ' + 'seems to lack a string-like .name', file_obj + ) + return file_obj + _, compression = os.path.splitext(filename) + + if compression in _COMPRESSOR_REGISTRY and mode.endswith('+'): + raise ValueError('transparent (de)compression unsupported for mode %r' % mode) + + try: + callback = _COMPRESSOR_REGISTRY[compression] + except KeyError: + return file_obj + else: + return callback(file_obj, mode) + + +# +# NB. avoid using lambda here to make stack traces more readable. +# +register_compressor('.bz2', _handle_bz2) +register_compressor('.gz', _handle_gzip) +register_compressor('.zst', _handle_zstd) +register_compressor('.xz', _handle_xz) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/concurrency.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/concurrency.py new file mode 100644 index 0000000000000000000000000000000000000000..89d72d594d2ff0d492e65f092a4a09f7baed9ff8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/concurrency.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2020 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# + +"""Common functionality for concurrent processing. The main entry point is :func:`create_pool`.""" + +import concurrent.futures +import contextlib +import logging +from collections import deque +from concurrent.futures import ThreadPoolExecutor as _ThreadPoolExecutor + +logger = logging.getLogger(__name__) + + +class ThreadPoolExecutor(_ThreadPoolExecutor): + """Subclass with a lazy consuming imap method.""" + + def imap(self, fn, *iterables, timeout=None, queued_tasks_per_worker=2): + """Ordered imap that consumes iterables just-in-time. + + References: + https://gist.github.com/ddelange/c98b05437f80e4b16bf4fc20fde9c999 + + Args: + fn: Function to apply. + iterables: One (or more) iterable(s) to pass to fn (using zip) as positional argument(s). + timeout: Per-future result retrieval timeout in seconds. + queued_tasks_per_worker: Amount of additional items per worker to fetch from iterables to + fill the queue: this determines the total queue size. + Setting 0 will result in a true just-in-time behaviour: when a worker finishes a task, + it waits until a result is consumed from the imap generator, at which point next() + is called on the input iterable(s) and a new task is submitted. + Default 2 ensures there is always some work to pick up. Note that at imap startup, + the queue will fill up before the first yield occurs. + + Example: + long_generator = itertools.count() + with ThreadPoolExecutor(42) as pool: + result_generator = pool.imap(fn, long_generator) + for result in result_generator: + print(result) + """ + futures, maxlen = deque(), self._max_workers * (queued_tasks_per_worker + 1) + popleft, append, submit = futures.popleft, futures.append, self.submit + + def get(): + """Block until the next task is done and return the result.""" + return popleft().result(timeout) + + for args in zip(*iterables): + append(submit(fn, *args)) + if len(futures) == maxlen: + yield get() + + while futures: + yield get() + + +# ConcurrentFuturesPool and create_pool were once used in smart_open.s3.iter_bucket. +# Left here for backwards compatibility. + + +class ConcurrentFuturesPool(object): + """A class that mimics multiprocessing.pool.Pool but uses concurrent futures instead of processes.""" + def __init__(self, max_workers): + self.executor = ThreadPoolExecutor(max_workers=max_workers) + + def imap_unordered(self, function, items): + futures = [self.executor.submit(function, item) for item in items] + for future in concurrent.futures.as_completed(futures): + yield future.result() + + def terminate(self): + self.executor.shutdown(wait=True) + + +@contextlib.contextmanager +def create_pool(processes=1): # arg is called processes due to historical reasons + logger.info("creating concurrent futures pool with %i workers", processes) + pool = ConcurrentFuturesPool(max_workers=processes) + yield pool + pool.terminate() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/constants.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/constants.py new file mode 100644 index 0000000000000000000000000000000000000000..1ffa14e3f99e44c784a435732ea222d4689e816c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/constants.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2020 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# + +"""Some universal constants that are common to I/O operations.""" + + +READ_BINARY = 'rb' + +WRITE_BINARY = 'wb' + +BINARY_MODES = (READ_BINARY, WRITE_BINARY) + +BINARY_NEWLINE = b'\n' + +WHENCE_START = 0 + +WHENCE_CURRENT = 1 + +WHENCE_END = 2 + +WHENCE_CHOICES = (WHENCE_START, WHENCE_CURRENT, WHENCE_END) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/doctools.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/doctools.py new file mode 100644 index 0000000000000000000000000000000000000000..d8ff414a71ec2bef374e290e72fc413162d96c95 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/doctools.py @@ -0,0 +1,272 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2019 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# + +"""Common functions for working with docstrings. + +For internal use only. +""" + +import contextlib +import inspect +import io +import os.path +import re +import sys + +from . import compression +from . import transport + +# +# Python 3.13+ automatically trims docstrings (like inspect.cleandoc), +# so we need to adjust the placeholder and indentation accordingly. +# +if sys.version_info >= (3, 13): + PLACEHOLDER = 'smart_open/doctools.py magic goes here' + LPAD = '' +else: + PLACEHOLDER = ' smart_open/doctools.py magic goes here' + LPAD = ' ' + + +def extract_kwargs(docstring): + """Extract keyword argument documentation from a function's docstring. + + Parameters + ---------- + docstring: str + The docstring to extract keyword arguments from. + + Returns + ------- + list of (str, str, list str) + + str + The name of the keyword argument. + str + Its type. + str + Its documentation as a list of lines. + + Notes + ----- + The implementation is rather fragile. It expects the following: + + 1. The parameters are under an underlined Parameters section + 2. Keyword parameters have the literal ", optional" after the type + 3. Names and types are not indented + 4. Descriptions are indented with 4 spaces + 5. The Parameters section ends with an empty line. + + Examples + -------- + + >>> docstring = '''The foo function. + ... Parameters + ... ---------- + ... bar: str, optional + ... This parameter is the bar. + ... baz: int, optional + ... This parameter is the baz. + ... + ... ''' + >>> kwargs = extract_kwargs(docstring) + >>> kwargs[0] + ('bar', 'str, optional', ['This parameter is the bar.']) + + """ + if not docstring: + return [] + + lines = inspect.cleandoc(docstring).split('\n') + kwargs = [] + + # + # 1. Find the underlined 'Parameters' section + # 2. Once there, continue parsing parameters until we hit an empty line + # + while lines and lines[0] != 'Parameters': + lines.pop(0) + + if not lines: + return [] + + lines.pop(0) + lines.pop(0) + + for line in lines: + if not line.strip(): # stop at the first empty line encountered + break + is_arg_line = not line.startswith(' ') + if is_arg_line: + name, type_ = line.split(':', 1) + name, type_, description = name.strip(), type_.strip(), [] + kwargs.append([name, type_, description]) + continue + is_description_line = line.startswith(' ') + if is_description_line: + kwargs[-1][-1].append(line.strip()) + + return kwargs + + +def to_docstring(kwargs, lpad=''): + """Reconstruct a docstring from keyword argument info. + + Basically reverses :func:`extract_kwargs`. + + Parameters + ---------- + kwargs: list + Output from the extract_kwargs function + lpad: str, optional + Padding string (from the left). + + Returns + ------- + str + The docstring snippet documenting the keyword arguments. + + Examples + -------- + + >>> kwargs = [ + ... ('bar', 'str, optional', ['This parameter is the bar.']), + ... ('baz', 'int, optional', ['This parameter is the baz.']), + ... ] + >>> print(to_docstring(kwargs), end='') + bar: str, optional + This parameter is the bar. + baz: int, optional + This parameter is the baz. + + """ + buf = io.StringIO() + for name, type_, description in kwargs: + buf.write('%s%s: %s\n' % (lpad, name, type_)) + for line in description: + buf.write('%s %s\n' % (lpad, line)) + return buf.getvalue() + + +def extract_examples_from_readme_rst(indent=None): + """Extract examples from this project's README.rst file. + + Parameters + ---------- + indent: str + Prepend each line with this string. Should contain some number of spaces. + + Returns + ------- + str + The examples. + + Notes + ----- + Quite fragile, depends on named labels inside the README.rst file. + """ + if indent is None: + indent = LPAD + curr_dir = os.path.dirname(os.path.abspath(__file__)) + readme_path = os.path.join(curr_dir, '..', 'README.rst') + try: + with open(readme_path) as fin: + lines = list(fin) + start = lines.index('.. _doctools_before_examples:\n') + end = lines.index(".. _doctools_after_examples:\n") + lines = lines[start+4:end-2] + return ''.join([indent + re.sub('^ ', '', line) for line in lines]) + except Exception: + return indent + 'See README.rst' + + +def tweak_open_docstring(f): + buf = io.StringIO() + seen = set() + + root_path = os.path.dirname(os.path.dirname(__file__)) + + with contextlib.redirect_stdout(buf): + print(f'{LPAD}smart_open supports the following transport mechanisms:') + print() + for scheme, submodule in sorted(transport._REGISTRY.items()): + if scheme == transport.NO_SCHEME or submodule in seen: + continue + seen.add(submodule) + + try: + schemes = submodule.SCHEMES + except AttributeError: + schemes = [scheme] + + relpath = os.path.relpath(submodule.__file__, start=root_path) + heading = '%s (%s)' % ("/".join(schemes), relpath) + print(f'{LPAD}{heading}') + print(f'{LPAD}{"~" * len(heading)}') + print(f'{LPAD}{submodule.__doc__.split(chr(10))[0]}') + print() + + kwargs = extract_kwargs(submodule.open.__doc__) + if kwargs: + print(to_docstring(kwargs, lpad=LPAD)) + + print(f'{LPAD}Examples') + print(f'{LPAD}--------') + print() + print(extract_examples_from_readme_rst(indent=LPAD)) + + print(f'{LPAD}This function also supports transparent compression and decompression ') + print(f'{LPAD}using the following codecs:') + print() + for extension in compression.get_supported_extensions(): + print(f'{LPAD}* {extension}') + print() + print(f'{LPAD}The function depends on the file extension to determine the appropriate codec.') + + # + # The docstring can be None if -OO was passed to the interpreter. + # + if f.__doc__: + f.__doc__ = f.__doc__.replace(PLACEHOLDER, buf.getvalue()) + + +def tweak_parse_uri_docstring(f): + buf = io.StringIO() + seen = set() + schemes = [] + examples = [] + + for scheme, submodule in sorted(transport._REGISTRY.items()): + if scheme == transport.NO_SCHEME or submodule in seen: + continue + + seen.add(submodule) + + try: + examples.extend(submodule.URI_EXAMPLES) + except AttributeError: + pass + + try: + schemes.extend(submodule.SCHEMES) + except AttributeError: + schemes.append(scheme) + + with contextlib.redirect_stdout(buf): + print(f'{LPAD}Supported URI schemes are:') + print() + for scheme in schemes: + print(f'{LPAD}* {scheme}') + print() + print(f'{LPAD}Valid URI examples::') + print() + for example in examples: + print(f'{LPAD}* {example}') + + if f.__doc__: + f.__doc__ = f.__doc__.replace(PLACEHOLDER, buf.getvalue()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/ftp.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/ftp.py new file mode 100644 index 0000000000000000000000000000000000000000..7581969d14df47bf823160e77ab5ed6614366cbe --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/ftp.py @@ -0,0 +1,171 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2019 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# + +"""Implements I/O streams over FTP.""" + +import logging +import ssl +import urllib.parse +import smart_open.utils +from ftplib import FTP, FTP_TLS, error_reply +import types + +logger = logging.getLogger(__name__) + +SCHEMES = ("ftp", "ftps") + +"""Supported URL schemes.""" + +DEFAULT_PORT = 21 + +URI_EXAMPLES = ( + "ftp://username@host/path/file", + "ftp://username:password@host/path/file", + "ftp://username:password@host:port/path/file", + "ftps://username@host/path/file", + "ftps://username:password@host/path/file", + "ftps://username:password@host:port/path/file", +) + + +def _unquote(text): + return text and urllib.parse.unquote(text) + + +def parse_uri(uri_as_string): + split_uri = urllib.parse.urlsplit(uri_as_string) + assert split_uri.scheme in SCHEMES + return dict( + scheme=split_uri.scheme, + uri_path=_unquote(split_uri.path), + user=_unquote(split_uri.username), + host=split_uri.hostname, + port=int(split_uri.port or DEFAULT_PORT), + password=_unquote(split_uri.password), + ) + + +def open_uri(uri, mode, transport_params): + smart_open.utils.check_kwargs(open, transport_params) + parsed_uri = parse_uri(uri) + uri_path = parsed_uri.pop("uri_path") + scheme = parsed_uri.pop("scheme") + secure_conn = True if scheme == "ftps" else False + return open( + uri_path, + mode, + secure_connection=secure_conn, + transport_params=transport_params, + **parsed_uri, + ) + + +def convert_transport_params_to_args(transport_params): + supported_keywords = [ + "timeout", + "source_address", + "encoding", + ] + unsupported_keywords = [k for k in transport_params if k not in supported_keywords] + kwargs = {k: v for (k, v) in transport_params.items() if k in supported_keywords} + + if unsupported_keywords: + logger.warning( + "ignoring unsupported ftp keyword arguments: %r", unsupported_keywords + ) + + return kwargs + + +def _connect(hostname, username, port, password, secure_connection, transport_params): + kwargs = convert_transport_params_to_args(transport_params) + if secure_connection: + ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH) + ftp = FTP_TLS(context=ssl_context, **kwargs) + else: + ftp = FTP(**kwargs) + try: + ftp.connect(hostname, port) + except Exception as e: + logger.error("Unable to connect to FTP server: try checking the host and port!") + raise e + try: + ftp.login(username, password) + except error_reply as e: + logger.error( + "Unable to login to FTP server: try checking the username and password!" + ) + raise e + if secure_connection: + ftp.prot_p() + return ftp + + +def open( + path, + mode="rb", + host=None, + user=None, + password=None, + port=DEFAULT_PORT, + secure_connection=False, + transport_params=None, +): + """Open a file for reading or writing via FTP/FTPS. + + Parameters + ---------- + path: str + The path on the remote server + mode: str + Must be "rb" or "wb" + host: str + The host to connect to + user: str + The username to use for the connection + password: str + The password for the specified username + port: int + The port to connect to + secure_connection: bool + True for FTPS, False for FTP + transport_params: dict + Additional parameters for the FTP connection. + Currently supported parameters: timeout, source_address, encoding. + """ + if not host: + raise ValueError("you must specify the host to connect to") + if not user: + raise ValueError("you must specify the user") + if not transport_params: + transport_params = {} + conn = _connect(host, user, port, password, secure_connection, transport_params) + mode_to_ftp_cmds = { + "rb": ("RETR", "rb"), + "wb": ("STOR", "wb"), + "ab": ("APPE", "wb"), + } + try: + ftp_mode, file_obj_mode = mode_to_ftp_cmds[mode] + except KeyError: + raise ValueError(f"unsupported mode: {mode!r}") + ftp_mode, file_obj_mode = mode_to_ftp_cmds[mode] + conn.voidcmd("TYPE I") + socket = conn.transfercmd(f"{ftp_mode} {path}") + fobj = socket.makefile(file_obj_mode) + + def full_close(self): + self.orig_close() + self.socket.close() + self.conn.close() + + fobj.orig_close = fobj.close + fobj.socket = socket + fobj.conn = conn + fobj.close = types.MethodType(full_close, fobj) + return fobj diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/gcs.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/gcs.py new file mode 100644 index 0000000000000000000000000000000000000000..0ae3430721bc42d5443dcd92794f93c13b29c0e1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/gcs.py @@ -0,0 +1,176 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2019 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# +"""Implements file-like objects for reading and writing to/from GCS.""" + +import logging +import warnings + +try: + import google.cloud.exceptions + import google.cloud.storage + import google.auth.transport.requests +except ImportError: + MISSING_DEPS = True + +import smart_open.bytebuffer +import smart_open.utils + +from smart_open import constants + +logger = logging.getLogger(__name__) + +SCHEME = "gs" +"""Supported scheme for GCS""" + +_DEFAULT_MIN_PART_SIZE = 50 * 1024**2 +"""Default minimum part size for GCS multipart uploads""" + +_DEFAULT_WRITE_OPEN_KWARGS = {'ignore_flush': True} + + +def parse_uri(uri_as_string): + sr = smart_open.utils.safe_urlsplit(uri_as_string) + assert sr.scheme == SCHEME + bucket_id = sr.netloc + blob_id = sr.path.lstrip('/') + return dict(scheme=SCHEME, bucket_id=bucket_id, blob_id=blob_id) + + +def open_uri(uri, mode, transport_params): + parsed_uri = parse_uri(uri) + kwargs = smart_open.utils.check_kwargs(open, transport_params) + return open(parsed_uri['bucket_id'], parsed_uri['blob_id'], mode, **kwargs) + + +def warn_deprecated(parameter_name): + message = f"Parameter {parameter_name} is deprecated, this parameter no-longer has any effect" + warnings.warn(message, UserWarning) + + +def open( + bucket_id, + blob_id, + mode, + buffer_size=None, + min_part_size=_DEFAULT_MIN_PART_SIZE, + client=None, # type: google.cloud.storage.Client + get_blob_kwargs=None, + blob_properties=None, + blob_open_kwargs=None, +): + """Open an GCS blob for reading or writing. + + Parameters + ---------- + bucket_id: str + The name of the bucket this object resides in. + blob_id: str + The name of the blob within the bucket. + mode: str + The mode for opening the object. Must be either "rb" or "wb". + buffer_size: + deprecated + min_part_size: int, optional + The minimum part size for multipart uploads. For writing only. + client: google.cloud.storage.Client, optional + The GCS client to use when working with google-cloud-storage. + get_blob_kwargs: dict, optional + Additional keyword arguments to propagate to the bucket.get_blob + method of the google-cloud-storage library. For reading only. + blob_properties: dict, optional + Set properties on blob before writing. For writing only. + blob_open_kwargs: dict, optional + Additional keyword arguments to propagate to the blob.open method + of the google-cloud-storage library. + + """ + if blob_open_kwargs is None: + blob_open_kwargs = {} + + if buffer_size is not None: + warn_deprecated('buffer_size') + + if mode in (constants.READ_BINARY, 'r', 'rt'): + _blob = Reader(bucket=bucket_id, + key=blob_id, + client=client, + get_blob_kwargs=get_blob_kwargs, + blob_open_kwargs=blob_open_kwargs) + + elif mode in (constants.WRITE_BINARY, 'w', 'wt'): + _blob = Writer(bucket=bucket_id, + blob=blob_id, + min_part_size=min_part_size, + client=client, + blob_properties=blob_properties, + blob_open_kwargs=blob_open_kwargs) + + else: + raise NotImplementedError(f'GCS support for mode {mode} not implemented') + + return _blob + + +def Reader(bucket, + key, + buffer_size=None, + line_terminator=None, + client=None, + get_blob_kwargs=None, + blob_open_kwargs=None): + + if get_blob_kwargs is None: + get_blob_kwargs = {} + if blob_open_kwargs is None: + blob_open_kwargs = {} + if client is None: + client = google.cloud.storage.Client() + if buffer_size is not None: + warn_deprecated('buffer_size') + if line_terminator is not None: + warn_deprecated('line_terminator') + + bkt = client.bucket(bucket) + blob = bkt.get_blob(key, **get_blob_kwargs) + + if blob is None: + raise google.cloud.exceptions.NotFound(f'blob {key} not found in {bucket}') + + return blob.open('rb', **blob_open_kwargs) + + +def Writer(bucket, + blob, + min_part_size=None, + client=None, + blob_properties=None, + blob_open_kwargs=None): + + if blob_open_kwargs is None: + blob_open_kwargs = {} + if blob_properties is None: + blob_properties = {} + if client is None: + client = google.cloud.storage.Client() + + blob_open_kwargs = {**_DEFAULT_WRITE_OPEN_KWARGS, **blob_open_kwargs} + + g_blob = client.bucket(bucket).blob( + blob, + chunk_size=min_part_size, + ) + + for k, v in blob_properties.items(): + setattr(g_blob, k, v) + + _blob = g_blob.open('wb', **blob_open_kwargs) + + # backwards-compatiblity, was deprecated upstream https://cloud.google.com/storage/docs/resumable-uploads + _blob.terminate = lambda: None + + return _blob diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/hdfs.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/hdfs.py new file mode 100644 index 0000000000000000000000000000000000000000..2d44d96ef6d53bab0557346f036d2bd9d08d0ea6 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/hdfs.py @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2019 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# + +"""Implements reading and writing to/from HDFS.""" + +import io +import logging +import subprocess +import urllib.parse + +from smart_open import utils + +logger = logging.getLogger(__name__) + +SCHEMES = ('hdfs', 'viewfs') + +URI_EXAMPLES = ( + 'hdfs:///path/file', + 'hdfs://path/file', + 'viewfs:///path/file', + 'viewfs://path/file', +) + + +def parse_uri(uri_as_string): + split_uri = urllib.parse.urlsplit(uri_as_string) + assert split_uri.scheme in SCHEMES + + uri_path = split_uri.netloc + split_uri.path + uri_path = "/" + uri_path.lstrip("/") + if not uri_path: + raise RuntimeError("invalid HDFS URI: %r" % uri_as_string) + + return dict(scheme=split_uri.scheme, uri_path=uri_path) + + +def open_uri(uri, mode, transport_params): + utils.check_kwargs(open, transport_params) + + parsed_uri = parse_uri(uri) + fobj = open(parsed_uri['uri_path'], mode) + fobj.name = parsed_uri['uri_path'].split('/')[-1] + return fobj + + +def open(uri, mode): + if mode == 'rb': + return CliRawInputBase(uri) + elif mode == 'wb': + return CliRawOutputBase(uri) + else: + raise NotImplementedError('hdfs support for mode %r not implemented' % mode) + + +class CliRawInputBase(io.RawIOBase): + """Reads bytes from HDFS via the "hdfs dfs" command-line interface. + + Implements the io.RawIOBase interface of the standard library. + """ + _sub = None # so `closed` property works in case __init__ fails and __del__ is called + + def __init__(self, uri): + self._uri = uri + self._sub = subprocess.Popen(["hdfs", "dfs", '-cat', self._uri], stdout=subprocess.PIPE) + + # + # Override some methods from io.IOBase. + # + def close(self): + """Flush and close this stream.""" + logger.debug("close: called") + if not self.closed: + self._sub.terminate() + self._sub = None + + @property + def closed(self): + return self._sub is None + + def readable(self): + """Return True if the stream can be read from.""" + return self._sub is not None + + def seekable(self): + """If False, seek(), tell() and truncate() will raise IOError.""" + return False + + # + # io.RawIOBase methods. + # + def detach(self): + """Unsupported.""" + raise io.UnsupportedOperation + + def read(self, size=-1): + """Read up to size bytes from the object and return them.""" + return self._sub.stdout.read(size) + + def read1(self, size=-1): + """This is the same as read().""" + return self.read(size=size) + + def readinto(self, b): + """Read up to len(b) bytes into b, and return the number of bytes + read.""" + data = self.read(len(b)) + if not data: + return 0 + b[:len(data)] = data + return len(data) + + +class CliRawOutputBase(io.RawIOBase): + """Writes bytes to HDFS via the "hdfs dfs" command-line interface. + + Implements the io.RawIOBase interface of the standard library. + """ + _sub = None # so `closed` property works in case __init__ fails and __del__ is called + + def __init__(self, uri): + self._uri = uri + self._sub = subprocess.Popen(["hdfs", "dfs", '-put', '-f', '-', self._uri], + stdin=subprocess.PIPE) + + def close(self): + logger.debug("close: called") + if not self.closed: + self.flush() + self._sub.stdin.close() + self._sub.wait() + self._sub = None + + @property + def closed(self): + return self._sub is None + + def flush(self): + self._sub.stdin.flush() + + def writeable(self): + """Return True if this object is writeable.""" + return self._sub is not None + + def seekable(self): + """If False, seek(), tell() and truncate() will raise IOError.""" + return False + + def write(self, b): + self._sub.stdin.write(b) + + # + # io.IOBase methods. + # + def detach(self): + raise io.UnsupportedOperation("detach() not supported") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/http.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/http.py new file mode 100644 index 0000000000000000000000000000000000000000..f512739023388b15862b525cb8383dfd3617a458 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/http.py @@ -0,0 +1,307 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2019 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# +"""Implements file-like objects for reading from http.""" + +import io +import logging +import os.path +import urllib.parse + +try: + import requests +except ImportError: + MISSING_DEPS = True + +from smart_open import bytebuffer, constants +import smart_open.utils + +DEFAULT_BUFFER_SIZE = 128 * 1024 +SCHEMES = ('http', 'https') + +logger = logging.getLogger(__name__) + + +_HEADERS = {'Accept-Encoding': 'identity'} +"""The headers we send to the server with every HTTP request. + +For now, we ask the server to send us the files as they are. +Sometimes, servers compress the file for more efficient transfer, in which case +the client (us) has to decompress them with the appropriate algorithm. +""" + + +def parse_uri(uri_as_string): + split_uri = urllib.parse.urlsplit(uri_as_string) + assert split_uri.scheme in SCHEMES + + uri_path = split_uri.netloc + split_uri.path + uri_path = "/" + uri_path.lstrip("/") + return dict(scheme=split_uri.scheme, uri_path=uri_path) + + +def open_uri(uri, mode, transport_params): + kwargs = smart_open.utils.check_kwargs(open, transport_params) + return open(uri, mode, **kwargs) + + +def open(uri, mode, kerberos=False, user=None, password=None, cert=None, + headers=None, timeout=None, session=None, buffer_size=DEFAULT_BUFFER_SIZE): + """Implement streamed reader from a web site. + + Supports Kerberos and Basic HTTP authentication. + + Parameters + ---------- + url: str + The URL to open. + mode: str + The mode to open using. + kerberos: boolean, optional + If True, will attempt to use the local Kerberos credentials + user: str, optional + The username for authenticating over HTTP + password: str, optional + The password for authenticating over HTTP + cert: str/tuple, optional + if String, path to ssl client cert file (.pem). If Tuple, (‘cert’, ‘key’) + headers: dict, optional + Any headers to send in the request. If ``None``, the default headers are sent: + ``{'Accept-Encoding': 'identity'}``. To use no headers at all, + set this variable to an empty dict, ``{}``. + session: object, optional + The requests Session object to use with http get requests. + Can be used for OAuth2 clients. + buffer_size: int, optional + The buffer size to use when performing I/O. + + Note + ---- + If neither kerberos or (user, password) are set, will connect + unauthenticated, unless set separately in headers. + + """ + if mode == constants.READ_BINARY: + fobj = SeekableBufferedInputBase( + uri, mode, buffer_size=buffer_size, kerberos=kerberos, + user=user, password=password, cert=cert, + headers=headers, session=session, timeout=timeout, + ) + fobj.name = os.path.basename(urllib.parse.urlparse(uri).path) + return fobj + else: + raise NotImplementedError('http support for mode %r not implemented' % mode) + + +class BufferedInputBase(io.BufferedIOBase): + response = None # so `closed` property works in case __init__ fails and __del__ is called + + def __init__(self, url, mode='r', buffer_size=DEFAULT_BUFFER_SIZE, + kerberos=False, user=None, password=None, cert=None, + headers=None, session=None, timeout=None): + + self.url = url + self.cert = cert + self.session = session or requests + + if kerberos: + import requests_kerberos + self.auth = requests_kerberos.HTTPKerberosAuth() + elif user is not None and password is not None: + self.auth = (user, password) + else: + self.auth = None + + self.buffer_size = buffer_size + self.mode = mode + + if headers is None: + self.headers = _HEADERS.copy() + else: + self.headers = headers + + self.timeout = timeout + + self.response = self.session.get( + self.url, + auth=self.auth, + cert=self.cert, + stream=True, + headers=self.headers, + timeout=self.timeout, + ) + + if not self.response.ok: + self.response.raise_for_status() + + self._read_buffer = bytebuffer.ByteBuffer(buffer_size) + self._current_pos = 0 + + # + # Override some methods from io.IOBase. + # + def close(self): + """Flush and close this stream.""" + logger.debug("close: called") + if not self.closed: + self.response = None + self._read_buffer = None + + @property + def closed(self): + return self.response is None + + def readable(self): + """Return True if the stream can be read from.""" + return True + + def seekable(self): + return False + + # + # io.BufferedIOBase methods. + # + def detach(self): + """Unsupported.""" + raise io.UnsupportedOperation + + def read(self, size=-1): + """ + Mimics the read call to a filehandle object. + """ + if size < -1: + raise ValueError(f'size must be >= -1, got {size}') + + logger.debug("reading with size: %d", size) + if self.closed or size == 0: + return b"" + + if size == -1: + if len(self._read_buffer): + retval = self._read_buffer.read() + self.response.raw.read() + else: # Avoid unnecessary + + retval = self.response.raw.read() + else: + # Fill _read_buffer until it contains enough bytes + while len(self._read_buffer) < size: + if self._read_buffer.fill(self.response.raw) == 0: + break # EOF reached + retval = self._read_buffer.read(size) + + self._current_pos += len(retval) + return retval + + def read1(self, size=-1): + """This is the same as read().""" + return self.read(size=size) + + def readinto(self, b): + """Read up to len(b) bytes into b, and return the number of bytes + read.""" + data = self.read(len(b)) + if not data: + return 0 + b[:len(data)] = data + return len(data) + + +class SeekableBufferedInputBase(BufferedInputBase): + """ + Implement seekable streamed reader from a web site. + Supports Kerberos, client certificate and Basic HTTP authentication. + """ + + def __init__(self, url, mode='r', buffer_size=DEFAULT_BUFFER_SIZE, + kerberos=False, user=None, password=None, cert=None, + headers=None, session=None, timeout=None): + """ + If Kerberos is True, will attempt to use the local Kerberos credentials. + If cert is set, will try to use a client certificate + Otherwise, will try to use "basic" HTTP authentication via username/password. + + If none of those are set, will connect unauthenticated. + """ + super().__init__(url, mode, buffer_size, kerberos, user, password, cert, headers, session, timeout) + self.content_length = int(self.response.headers.get("Content-Length", -1)) + # + # We assume the HTTP stream is seekable unless the server explicitly + # tells us it isn't. It's better to err on the side of "seekable" + # because we don't want to prevent users from seeking a stream that + # does not appear to be seekable but really is. + # + self._seekable = self.response.headers.get("Accept-Ranges", "").lower() != "none" + + def seek(self, offset, whence=0): + """Seek to the specified position. + + :param int offset: The offset in bytes. + :param int whence: Where the offset is from. + + Returns the position after seeking.""" + logger.debug('seeking to offset: %r whence: %r', offset, whence) + if whence not in constants.WHENCE_CHOICES: + raise ValueError('invalid whence, expected one of %r' % constants.WHENCE_CHOICES) + + if not self.seekable(): + raise OSError('stream is not seekable') + + if whence == constants.WHENCE_START: + new_pos = offset + elif whence == constants.WHENCE_CURRENT: + new_pos = self._current_pos + offset + elif whence == constants.WHENCE_END: + new_pos = self.content_length + offset + + if self.content_length == -1: + new_pos = smart_open.utils.clamp(new_pos, maxval=None) + else: + new_pos = smart_open.utils.clamp(new_pos, maxval=self.content_length) + + if self._current_pos == new_pos: + return self._current_pos + + logger.debug("http seeking from current_pos: %d to new_pos: %d", self._current_pos, new_pos) + + self._current_pos = new_pos + + if new_pos == self.content_length: + self.response = None + self._read_buffer.empty() + else: + response = self._partial_request(new_pos) + if response.ok: + self.response = response + self._read_buffer.empty() + else: + self.response = None + + return self._current_pos + + def tell(self): + return self._current_pos + + def seekable(self, *args, **kwargs): + return self._seekable + + def truncate(self, size=None): + """Unsupported.""" + raise io.UnsupportedOperation + + def _partial_request(self, start_pos=None): + headers = self.headers.copy() + if start_pos is not None: + headers["range"] = smart_open.utils.make_range_string(start_pos) + + response = self.session.get( + self.url, + auth=self.auth, + stream=True, + cert=self.cert, + headers=headers, + timeout=self.timeout, + ) + return response diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/local_file.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/local_file.py new file mode 100644 index 0000000000000000000000000000000000000000..e5f5c5aadef7845ce5cbb0dd6d134e9ebb02b272 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/local_file.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2020 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# +"""Implements the transport for the file:// schema.""" +import io +import os.path + +SCHEME = 'file' + +URI_EXAMPLES = ( + './local/path/file', + '~/local/path/file', + 'local/path/file', + './local/path/file.gz', + 'file:///home/user/file', + 'file:///home/user/file.bz2', +) + + +open = io.open + + +def parse_uri(uri_as_string): + local_path = extract_local_path(uri_as_string) + return dict(scheme=SCHEME, uri_path=local_path) + + +def open_uri(uri_as_string, mode, transport_params): + parsed_uri = parse_uri(uri_as_string) + fobj = io.open(parsed_uri['uri_path'], mode) + return fobj + + +def extract_local_path(uri_as_string): + if uri_as_string.startswith('file://'): + local_path = uri_as_string.replace('file://', '', 1) + else: + local_path = uri_as_string + return os.path.expanduser(local_path) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/s3.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/s3.py new file mode 100644 index 0000000000000000000000000000000000000000..5a1624c493d1964f17960db129b4a88bb20a1edf --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/s3.py @@ -0,0 +1,1548 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2019 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# +"""Implements file-like objects for reading and writing from/to AWS S3.""" +from __future__ import annotations + +import http +import io +import functools +import itertools +import logging +import time +import warnings +from math import inf + +from typing import ( + Callable, + List, + TYPE_CHECKING, +) + +try: + import boto3 + import botocore.client + import botocore.exceptions + import urllib3.exceptions +except ImportError: + MISSING_DEPS = True + +import smart_open.bytebuffer +import smart_open.concurrency +import smart_open.utils + +from smart_open import constants + + +if TYPE_CHECKING: + from mypy_boto3_s3.client import S3Client + from typing_extensions import Buffer + +logger = logging.getLogger(__name__) + +# +# AWS puts restrictions on the part size for multipart uploads. +# Each part must be more than 5MB, and less than 5GB. +# +# On top of that, our MultipartWriter has a min_part_size option. +# In retrospect, it's an unfortunate name, because it conflicts with the +# minimum allowable part size (5MB), but it's too late to change it, because +# people are using that parameter (unlike the MIN, DEFAULT, MAX constants). +# It really just means "part size": as soon as you have this many bytes, +# write a part to S3 (see the MultipartWriter.write method). +# + +MIN_PART_SIZE = 5 * 1024 ** 2 +"""The absolute minimum permitted by Amazon.""" + +DEFAULT_PART_SIZE = 50 * 1024**2 +"""The default part size for S3 multipart uploads, chosen carefully by smart_open""" + +MAX_PART_SIZE = 5 * 1024 ** 3 +"""The absolute maximum permitted by Amazon.""" + +SCHEMES = ("s3", "s3n", 's3u', "s3a") +DEFAULT_PORT = 443 +DEFAULT_HOST = 's3.amazonaws.com' + +DEFAULT_BUFFER_SIZE = 128 * 1024 + +URI_EXAMPLES = ( + 's3://my_bucket/my_key', + 's3://my_key:my_secret@my_bucket/my_key', + 's3://my_key:my_secret@my_server:my_port@my_bucket/my_key', +) + +# Returned by AWS when we try to seek beyond EOF. +_OUT_OF_RANGE = 'InvalidRange' + + +class Retry: + def __init__(self): + self.attempts: int = 6 + self.sleep_seconds: int = 10 + self.exceptions: List[Exception] = [botocore.exceptions.EndpointConnectionError] + self.client_error_codes: List[str] = ['NoSuchUpload'] + + def _do(self, fn: Callable): + for attempt in range(self.attempts): + try: + return fn() + except tuple(self.exceptions) as err: + logger.critical( + 'Caught non-fatal %s, retrying %d more times', + err, + self.attempts - attempt - 1, + ) + logger.exception(err) + time.sleep(self.sleep_seconds) + except botocore.exceptions.ClientError as err: + error_code = err.response['Error'].get('Code') + if error_code not in self.client_error_codes: + raise + logger.critical( + 'Caught non-fatal ClientError (%s), retrying %d more times', + error_code, + self.attempts - attempt - 1, + ) + logger.exception(err) + time.sleep(self.sleep_seconds) + else: + logger.critical('encountered too many non-fatal errors, giving up') + raise IOError('%s failed after %d attempts', fn.func, self.attempts) + + +# +# The retry mechanism for this submodule. Client code may modify it, e.g. by +# updating RETRY.sleep_seconds and friends. +# +if 'MISSING_DEPS' not in locals(): + RETRY = Retry() + + +class _ClientWrapper: + """Wraps a client to inject the appropriate keyword args into each method call. + + The keyword args are a dictionary keyed by the fully qualified method name. + For example, S3.Client.create_multipart_upload. + + See https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#client + + This wrapper behaves identically to the client otherwise. + """ + def __init__(self, client, kwargs): + self.client = client + self.kwargs = kwargs + + def __getattr__(self, method_name): + method = getattr(self.client, method_name) + kwargs = self.kwargs.get('S3.Client.%s' % method_name, {}) + return functools.partial(method, **kwargs) + + +def parse_uri(uri_as_string): + # + # Restrictions on bucket names and labels: + # + # - Bucket names must be at least 3 and no more than 63 characters long. + # - Bucket names must be a series of one or more labels. + # - Adjacent labels are separated by a single period (.). + # - Bucket names can contain lowercase letters, numbers, and hyphens. + # - Each label must start and end with a lowercase letter or a number. + # + # We use the above as a guide only, and do not perform any validation. We + # let boto3 take care of that for us. + # + split_uri = smart_open.utils.safe_urlsplit(uri_as_string) + assert split_uri.scheme in SCHEMES + + port = DEFAULT_PORT + host = DEFAULT_HOST + ordinary_calling_format = False + # + # These defaults tell boto3 to look for credentials elsewhere + # + access_id, access_secret = None, None + + # + # Common URI template [secret:key@][host[:port]@]bucket/object + # + # The urlparse function doesn't handle the above schema, so we have to do + # it ourselves. + # + uri = split_uri.netloc + split_uri.path + + # + # Attempt to extract edge-case authentication details from the URL. + # + # See: + # 1. https://summitroute.com/blog/2018/06/20/aws_security_credential_formats/ + # 2. test_s3_uri_with_credentials* in test_smart_open.py for example edge cases + # + if '@' in uri: + maybe_auth, rest = uri.split('@', 1) + if ':' in maybe_auth: + maybe_id, maybe_secret = maybe_auth.split(':', 1) + if '/' not in maybe_id: + access_id, access_secret = maybe_id, maybe_secret + uri = rest + + head, key_id = uri.split('/', 1) + if '@' in head and ':' in head: + ordinary_calling_format = True + host_port, bucket_id = head.split('@') + host, port = host_port.split(':', 1) + port = int(port) + elif '@' in head: + ordinary_calling_format = True + host, bucket_id = head.split('@') + else: + bucket_id = head + + return dict( + scheme=split_uri.scheme, + bucket_id=bucket_id, + key_id=key_id, + port=port, + host=host, + ordinary_calling_format=ordinary_calling_format, + access_id=access_id, + access_secret=access_secret, + ) + + +def _consolidate_params(uri, transport_params): + """Consolidates the parsed Uri with the additional parameters. + + This is necessary because the user can pass some of the parameters can in + two different ways: + + 1) Via the URI itself + 2) Via the transport parameters + + These are not mutually exclusive, but we have to pick one over the other + in a sensible way in order to proceed. + + """ + transport_params = dict(transport_params) + + def inject(**kwargs): + try: + client_kwargs = transport_params['client_kwargs'] + except KeyError: + client_kwargs = transport_params['client_kwargs'] = {} + + try: + init_kwargs = client_kwargs['S3.Client'] + except KeyError: + init_kwargs = client_kwargs['S3.Client'] = {} + + init_kwargs.update(**kwargs) + + client = transport_params.get('client') + if client is not None and (uri['access_id'] or uri['access_secret']): + logger.warning( + 'ignoring credentials parsed from URL because they conflict with ' + 'transport_params["client"]. Set transport_params["client"] to None ' + 'to suppress this warning.' + ) + uri.update(access_id=None, access_secret=None) + elif (uri['access_id'] and uri['access_secret']): + inject( + aws_access_key_id=uri['access_id'], + aws_secret_access_key=uri['access_secret'], + ) + uri.update(access_id=None, access_secret=None) + + if client is not None and uri['host'] != DEFAULT_HOST: + logger.warning( + 'ignoring endpoint_url parsed from URL because they conflict with ' + 'transport_params["client"]. Set transport_params["client"] to None ' + 'to suppress this warning.' + ) + uri.update(host=None) + elif uri['host'] != DEFAULT_HOST: + if uri['scheme'] == 's3u': + scheme = 'http' + else: + scheme = 'https' + inject(endpoint_url=scheme + '://%(host)s:%(port)d' % uri) + uri.update(host=None) + + return uri, transport_params + + +def open_uri(uri, mode, transport_params): + deprecated = ( + 'multipart_upload_kwargs', + 'object_kwargs', + 'resource', + 'resource_kwargs', + 'session', + 'singlepart_upload_kwargs', + ) + detected = [k for k in deprecated if k in transport_params] + if detected: + doc_url = ( + 'https://github.com/piskvorky/smart_open/blob/develop/' + 'MIGRATING_FROM_OLDER_VERSIONS.rst' + ) + # + # We use warnings.warn /w UserWarning instead of logger.warn here because + # + # 1) Not everyone has logging enabled; and + # 2) check_kwargs (below) already uses logger.warn with a similar message + # + # https://github.com/piskvorky/smart_open/issues/614 + # + message = ( + 'ignoring the following deprecated transport parameters: %r. ' + 'See <%s> for details' % (detected, doc_url) + ) + warnings.warn(message, UserWarning) + parsed_uri = parse_uri(uri) + parsed_uri, transport_params = _consolidate_params(parsed_uri, transport_params) + kwargs = smart_open.utils.check_kwargs(open, transport_params) + return open(parsed_uri['bucket_id'], parsed_uri['key_id'], mode, **kwargs) + + +def open( + bucket_id, + key_id, + mode, + version_id=None, + buffer_size=DEFAULT_BUFFER_SIZE, + min_part_size=DEFAULT_PART_SIZE, + multipart_upload=True, + defer_seek=False, + client=None, + client_kwargs=None, + writebuffer=None, + range_chunk_size=None, +): + """Open an S3 object for reading or writing. + + Parameters + ---------- + bucket_id: str + The name of the bucket this object resides in. + key_id: str + The name of the key within the bucket. + mode: str + The mode for opening the object. Must be either "rb" or "wb". + buffer_size: int, optional + Default: 128KB + The buffer size in bytes for reading. Controls memory usage. Data is streamed + from a S3 network stream in buffer_size chunks. Forward seeks within + the current buffer are satisfied without additional GET requests. Backward + seeks always open a new GET request. For forward seek-intensive workloads, + increase buffer_size to reduce GET requests at the cost of higher memory usage. + min_part_size: int, optional + The minimum part size for multipart uploads, in bytes. + When the writebuffer contains this many bytes, smart_open will upload + the bytes to S3 as a single part of a multi-part upload, freeing the + buffer either partially or entirely. When you close the writer, it + will assemble the parts together. + The value determines the upper limit for the writebuffer. If buffer + space is short (e.g. you are buffering to memory), then use a smaller + value for min_part_size, or consider buffering to disk instead (see + the writebuffer option). + The value must be between 5MB and 5GB. If you specify a value outside + of this range, smart_open will adjust it for you, because otherwise the + upload _will_ fail. + For writing only. Does not apply if you set multipart_upload=False. + multipart_upload: bool, optional + Default: `True` + If set to `True`, will use multipart upload for writing to S3. If set + to `False`, S3 upload will use the S3 Single-Part Upload API, which + is more ideal for small file sizes. + For writing only. + version_id: str, optional + Version of the object, used when reading object. + If None, will fetch the most recent version. + defer_seek: boolean, optional + Default: `False` + If set to `True` on a file opened for reading, GetObject will not be + called until the first seek() or read(). + Avoids redundant API queries when seeking before reading. + range_chunk_size: int, optional + Default: `None` + Maximum byte range per S3 GET request when reading. + When None (default), a single GET request is made for the entire file, + and data is streamed from that single botocore.response.StreamingBody + in buffer_size chunks. + When set to a positive integer, multiple GET requests are made, each + limited to at most this many bytes via HTTP Range headers. Each GET + returns a new StreamingBody that is streamed in buffer_size chunks. + Useful for reading small portions of large files without forcing + S3-compatible systems like SeaweedFS/Ceph to load the entire file. + Larger values mean fewer billable GET requests but higher load on S3 + servers. Smaller values mean more GET requests but less server load per request. + Values larger than the file size result in a single GET for the whole file. + Affects reading only. Does not affect memory usage (controlled by buffer_size). + client: object, optional + The S3 client to use when working with boto3. + If you don't specify this, then smart_open will create a new client for you. + client_kwargs: dict, optional + Additional parameters to pass to the relevant functions of the client. + The keys are fully qualified method names, e.g. `S3.Client.create_multipart_upload`. + The values are kwargs to pass to that method each time it is called. + writebuffer: IO[bytes], optional + By default, this module will buffer data in memory using io.BytesIO + when writing. Pass another binary IO instance here to use it instead. + For example, you may pass a file object to buffer to local disk instead + of in RAM. Use this to keep RAM usage low at the expense of additional + disk IO. If you pass in an open file, then you are responsible for + cleaning it up after writing completes. + """ + logger.debug('%r', locals()) + if mode not in constants.BINARY_MODES: + raise NotImplementedError('bad mode: %r expected one of %r' % (mode, constants.BINARY_MODES)) + + if (mode == constants.WRITE_BINARY) and (version_id is not None): + raise ValueError("version_id must be None when writing") + + if mode == constants.READ_BINARY: + fileobj = Reader( + bucket_id, + key_id, + version_id=version_id, + buffer_size=buffer_size, + defer_seek=defer_seek, + client=client, + client_kwargs=client_kwargs, + range_chunk_size=range_chunk_size, + ) + elif mode == constants.WRITE_BINARY: + if multipart_upload: + fileobj = MultipartWriter( + bucket_id, + key_id, + client=client, + client_kwargs=client_kwargs, + writebuffer=writebuffer, + part_size=min_part_size, + ) + else: + fileobj = SinglepartWriter( + bucket_id, + key_id, + client=client, + client_kwargs=client_kwargs, + writebuffer=writebuffer, + ) + else: + assert False, 'unexpected mode: %r' % mode + + fileobj.name = key_id + return fileobj + + +def _get(client, bucket, key, version, range_string): + try: + params = dict(Bucket=bucket, Key=key) + if version: + params["VersionId"] = version + if range_string: + params["Range"] = range_string + + return client.get_object(**params) + except botocore.client.ClientError as error: + wrapped_error = IOError( + 'unable to access bucket: %r key: %r version: %r error: %s' % ( + bucket, key, version, error + ) + ) + wrapped_error.backend_error = error + raise wrapped_error from error + + +def _unwrap_ioerror(ioe): + """Given an IOError from _get, return the 'Error' dictionary from boto.""" + try: + return ioe.backend_error.response['Error'] + except (AttributeError, KeyError): + return None + + +class _SeekableRawReader(object): + """Read an S3 object. + + This class is internal to the S3 submodule. + """ + + def __init__( + self, + client, + bucket, + key, + version_id=None, + range_chunk_size=None, + ): + self._client = client + self._bucket = bucket + self._key = key + self._version_id = version_id + self._range_chunk_size = range_chunk_size + + self._content_length = None + self._position = 0 + self._body = None + + @property + def closed(self): + return self._body is None + + def close(self): + if not self.closed: + self._body.close() + self._body = None + + def seek(self, offset, whence=constants.WHENCE_START): + """Seek to the specified position. + + :param int offset: The offset in bytes. + :param int whence: Where the offset is from. + + :returns: the position after seeking. + :rtype: int + """ + if whence not in constants.WHENCE_CHOICES: + raise ValueError('invalid whence, expected one of %r' % constants.WHENCE_CHOICES) + + # + # Close old body explicitly. + # + self.close() + + start = None + stop = None + if whence == constants.WHENCE_START: + start = max(0, offset) + elif whence == constants.WHENCE_CURRENT: + start = max(0, offset + self._position) + elif whence == constants.WHENCE_END: + stop = max(0, -offset) + + # + # If we can figure out that we've read past the EOF, then we can save + # an extra API call. + # + if self._content_length is None: # _open_body has not been called yet + if start is None and stop == 0: + # seek(0, WHENCE_END) seeks straight to EOF: + # make a minimal request to populate _content_length + self._open_body(start=0, stop=0) + self.close() + reached_eof = True + else: + reached_eof = False + elif start is not None and start >= self._content_length: + reached_eof = True + elif stop == 0: + reached_eof = True + else: + reached_eof = False + + if reached_eof: + self._body = io.BytesIO() + self._position = self._content_length + else: + self._open_body(start, stop) + + return self._position + + def _open_body(self, start=None, stop=None): + """Open a connection to download the specified range of bytes. Store + the open file handle in self._body. + + If no range is specified, start defaults to self._position. + start and stop follow the semantics of the http range header, + so a stop without a start will read bytes beginning at stop. + + If self._range_chunk_size is set, the S3 server is protected from open range + headers and stop will be set such that at most self._range_chunk_size bytes + are returned in a single GET request. + + As a side effect, set self._content_length. Set self._position + to self._content_length if start is past end of file. + """ + if start is None and stop is None: + start = self._position + + # Apply chunking: limit the stop position if range_chunk_size is set + if stop is None and self._range_chunk_size is not None: + stop = start + self._range_chunk_size - 1 + # Don't request beyond known content length + if self._content_length is not None: + stop = min(stop, self._content_length - 1) + + range_string = smart_open.utils.make_range_string(start, stop) + + try: + # Optimistically try to fetch the requested content range. + response = _get( + self._client, + self._bucket, + self._key, + self._version_id, + range_string, + ) + except IOError as ioe: + # Handle requested content range exceeding content size. + error_response = _unwrap_ioerror(ioe) + if error_response is None or error_response.get('Code') != _OUT_OF_RANGE: + raise + + actual_object_size = int(error_response.get('ActualObjectSize', 0)) + if ( + # empty file (==) or start is past end of file (>) + (start is not None and start >= actual_object_size) + # negative seek requested more bytes than file has + or (start is None and stop is not None and stop >= actual_object_size) + ): + self._position = self._content_length = actual_object_size + self._body = io.BytesIO() + else: # stop is past end of file: request the correct remainder instead + self._open_body(start=start, stop=actual_object_size - 1) + return + + # + # Keep track of how many times boto3's built-in retry mechanism + # activated. + # + # https://boto3.amazonaws.com/v1/documentation/api/latest/guide/retries.html#checking-retry-attempts-in-an-aws-service-response + # + logger.debug( + '%s: RetryAttempts: %d', + self, + response['ResponseMetadata']['RetryAttempts'], + ) + # + # range request may not always return partial content, see: + # https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests#partial_request_responses + # + status_code = response['ResponseMetadata']['HTTPStatusCode'] + if status_code == http.HTTPStatus.PARTIAL_CONTENT: + # 206 guarantees that the response body only contains the requested byte range + _, resp_start, _, length = smart_open.utils.parse_content_range(response['ContentRange']) + self._position = resp_start + self._content_length = length + self._body = response['Body'] + elif status_code == http.HTTPStatus.OK: + # 200 guarantees the response body contains the full file (server ignored range header) + self._position = 0 + self._content_length = response["ContentLength"] + self._body = response['Body'] + # + # If we got a full request when we were actually expecting a range, we need to + # read some data to ensure that the body starts in the place that the caller expects + # + if start is not None: + expected_position = min(self._content_length, start) + elif start is None and stop is not None: + expected_position = max(0, self._content_length - stop) + else: + expected_position = 0 + if expected_position > 0: + logger.debug( + '%s: discarding %d bytes to reach expected position', + self, + expected_position, + ) + self._position = len(self._body.read(expected_position)) + else: + raise ValueError("Unexpected status code %r" % status_code) + + def read(self, size=-1): + """Read from the continuous connection with the remote peer.""" + if size < -1: + raise ValueError(f'size must be >= -1, got {size}') + + if size == -1: + size = inf # makes for a simple while-condition below + + binary_collected = io.BytesIO() + + # + # Boto3 has built-in error handling and retry mechanisms: + # + # https://boto3.amazonaws.com/v1/documentation/api/latest/guide/error-handling.html + # https://boto3.amazonaws.com/v1/documentation/api/latest/guide/retries.html + # + # Unfortunately, it isn't always enough. There is still a non-zero + # possibility that an exception will slip past these mechanisms and + # terminate the read prematurely. Luckily, at this stage, it's very + # simple to recover from the problem: wait a little bit, reopen the + # HTTP connection and try again. Usually, a single retry attempt is + # enough to recover, but we try multiple times "just in case". + # + def retry_read(attempts=(1, 2, 4, 8, 16)) -> bytes: + for seconds in attempts: + if self.closed: + self._open_body() + try: + if size == inf: + return self._body.read() + return self._body.read(size - binary_collected.tell()) + except ( + ConnectionResetError, + botocore.exceptions.BotoCoreError, + urllib3.exceptions.HTTPError, + ) as err: + logger.warning( + '%s: caught %r while reading %d bytes, sleeping %ds before retry', + self, + err, + -1 if size == inf else size, + seconds, + ) + self.close() + time.sleep(seconds) + raise IOError( + '%s: failed to read %d bytes after %d attempts' % + (self, -1 if size == inf else size, len(attempts)), + ) + + while ( + self._content_length is None # very first read call + or ( + self._position < self._content_length # not yet end of file + and binary_collected.tell() < size # not yet read enough + ) + ): + binary = retry_read() + self._position += len(binary) + binary_collected.write(binary) + if not binary: # end of stream + self.close() + + return binary_collected.getvalue() + + def __str__(self): + return 'smart_open.s3._SeekableReader(%r, %r)' % (self._bucket, self._key) + + +def _initialize_boto3(rw, client, client_kwargs, bucket, key): + """Created the required objects for accessing S3. Ideally, they have + been already created for us and we can just reuse them.""" + if client_kwargs is None: + client_kwargs = {} + + if client is None: + init_kwargs = client_kwargs.get('S3.Client', {}) + if 'config' not in init_kwargs: + init_kwargs['config'] = botocore.client.Config( + max_pool_connections=64, + tcp_keepalive=True, + retries={"max_attempts": 6, "mode": "adaptive"} + ) + # boto3.client re-uses the default session which is not thread-safe when this is called + # from within a thread. when using smart_open with multithreading, create a thread-safe + # client with the config above and share it between threads using transport_params + # https://github.com/boto/boto3/blob/1.38.41/docs/source/guide/clients.rst?plain=1#L111 + client = boto3.client('s3', **init_kwargs) + assert client + + rw._client = _ClientWrapper(client, client_kwargs) + rw._bucket = bucket + rw._key = key + + +class Reader(io.BufferedIOBase): + """Reads bytes from S3. + + Implements the io.BufferedIOBase interface of the standard library.""" + + def __init__( + self, + bucket, + key, + version_id=None, + buffer_size=DEFAULT_BUFFER_SIZE, + line_terminator=constants.BINARY_NEWLINE, + defer_seek=False, + client=None, + client_kwargs=None, + range_chunk_size=None, + ): + self._version_id = version_id + self._buffer_size = buffer_size + + _initialize_boto3(self, client, client_kwargs, bucket, key) + + self._raw_reader = _SeekableRawReader( + self._client, + bucket, + key, + self._version_id, + range_chunk_size=range_chunk_size, + ) + self._current_pos = 0 + self._buffer = smart_open.bytebuffer.ByteBuffer(buffer_size) + self._eof = False + self._line_terminator = line_terminator + self._seek_initialized = False + + if not defer_seek: + self.seek(0) + + # + # io.BufferedIOBase methods. + # + + def close(self): + """Flush and close this stream.""" + logger.debug("close: called") + pass + + def readable(self): + """Return True if the stream can be read from.""" + return True + + def read(self, size=-1): + """Read up to size bytes from the object and return them.""" + if size == 0: + return b'' + elif size < 0: + # call read() before setting _current_pos to make sure _content_length is set + out = self._read_from_buffer() + self._raw_reader.read() + self._current_pos = self._raw_reader._content_length + return out + + # + # Return unused data first + # + if len(self._buffer) >= size: + return self._read_from_buffer(size) + + # + # If the stream is finished, return what we have. + # + if self._eof: + return self._read_from_buffer() + + self._fill_buffer(size) + return self._read_from_buffer(size) + + def read1(self, size=-1): + """This is the same as read().""" + return self.read(size=size) + + def readinto(self, b): + """Read up to len(b) bytes into b, and return the number of bytes + read.""" + data = self.read(len(b)) + if not data: + return 0 + b[:len(data)] = data + return len(data) + + def readline(self, limit=-1): + """Read up to and including the next newline. Returns the bytes read.""" + if limit != -1: + raise NotImplementedError('limits other than -1 not implemented yet') + + # + # A single line may span multiple buffers. + # + line = io.BytesIO() + while not (self._eof and len(self._buffer) == 0): + line_part = self._buffer.readline(self._line_terminator) + line.write(line_part) + self._current_pos += len(line_part) + + if line_part.endswith(self._line_terminator): + break + else: + self._fill_buffer() + + return line.getvalue() + + def seekable(self): + """If False, seek(), tell() and truncate() will raise IOError. + + We offer only seek support, and no truncate support.""" + return True + + def seek(self, offset, whence=constants.WHENCE_START): + """Seek to the specified position. + + :param int offset: The offset in bytes. + :param int whence: Where the offset is from. + + Returns the position after seeking.""" + # Convert relative offset to absolute, since self._raw_reader + # doesn't know our current position. + if whence == constants.WHENCE_CURRENT: + whence = constants.WHENCE_START + offset += self._current_pos + + # Check if we can satisfy seek from buffer + if whence == constants.WHENCE_START and offset > self._current_pos: + buffer_end = self._current_pos + len(self._buffer) + if offset <= buffer_end: + # Forward seek within buffered data - avoid S3 request + self._buffer.read(offset - self._current_pos) + self._current_pos = offset + return self._current_pos + + if not self._seek_initialized or not ( + whence == constants.WHENCE_START and offset == self._current_pos + ): + self._current_pos = self._raw_reader.seek(offset, whence) + self._buffer.empty() + + self._eof = self._current_pos == self._raw_reader._content_length + + self._seek_initialized = True + return self._current_pos + + def tell(self): + """Return the current position within the file.""" + return self._current_pos + + def truncate(self, size=None): + """Unsupported.""" + raise io.UnsupportedOperation + + def detach(self): + """Unsupported.""" + raise io.UnsupportedOperation + + def terminate(self): + """Do nothing.""" + pass + + def to_boto3(self, resource): + """Create an **independent** `boto3.s3.Object` instance that points to + the same S3 object as this instance. + Changes to the returned object will not affect the current instance. + """ + assert resource, 'resource must be a boto3.resource instance' + obj = resource.Object(self._bucket, self._key) + if self._version_id is not None: + return obj.Version(self._version_id) + else: + return obj + + # + # Internal methods. + # + def _read_from_buffer(self, size=-1): + """Remove at most size bytes from our buffer and return them.""" + size = size if size >= 0 else len(self._buffer) + part = self._buffer.read(size) + self._current_pos += len(part) + return part + + def _fill_buffer(self, size=-1): + size = max(size, self._buffer._chunk_size) + while len(self._buffer) < size and not self._eof: + bytes_read = self._buffer.fill(self._raw_reader) + if bytes_read == 0: + logger.debug('%s: reached EOF while filling buffer', self) + self._eof = True + + def __str__(self): + return "smart_open.s3.Reader(%r, %r)" % (self._bucket, self._key) + + def __repr__(self): + return ( + "smart_open.s3.Reader(" + "bucket=%r, " + "key=%r, " + "version_id=%r, " + "buffer_size=%r, " + "line_terminator=%r)" + ) % ( + self._bucket, + self._key, + self._version_id, + self._buffer_size, + self._line_terminator, + ) + + +class MultipartWriter(io.BufferedIOBase): + """Writes bytes to S3 using the multi part API. + + Implements the io.BufferedIOBase interface of the standard library.""" + _upload_id = None # so `closed` property works in case __init__ fails and __del__ is called + + def __init__( + self, + bucket, + key, + part_size=DEFAULT_PART_SIZE, + client=None, + client_kwargs=None, + writebuffer: io.BytesIO | None = None, + ): + adjusted_ps = smart_open.utils.clamp(part_size, MIN_PART_SIZE, MAX_PART_SIZE) + if part_size != adjusted_ps: + logger.warning(f"adjusting part_size from {part_size} to {adjusted_ps}") + part_size = adjusted_ps + self._part_size = part_size + + _initialize_boto3(self, client, client_kwargs, bucket, key) + self._client: S3Client + self._bucket: str + self._key: str + + try: + partial = functools.partial( + self._client.create_multipart_upload, + Bucket=bucket, + Key=key, + ) + self._upload_id = RETRY._do(partial)['UploadId'] + except botocore.client.ClientError as error: + raise ValueError( + 'the bucket %r does not exist, or is forbidden for access (%r)' % ( + bucket, error + ) + ) from error + + if writebuffer is None: + self._buf = io.BytesIO() + else: + self._buf = writebuffer + + self._total_bytes = 0 + self._total_parts = 0 + self._parts: list[dict[str, object]] = [] + + def flush(self): + pass + + # + # Override some methods from io.IOBase. + # + def close(self): + logger.debug("close: called") + if self.closed: + return + + if self._buf.tell(): + self._upload_next_part() + + logger.debug('%s: completing multipart upload', self) + if self._total_bytes and self._upload_id: + partial = functools.partial( + self._client.complete_multipart_upload, + Bucket=self._bucket, + Key=self._key, + UploadId=self._upload_id, + MultipartUpload={'Parts': self._parts}, + ) + RETRY._do(partial) + logger.debug('%s: completed multipart upload', self) + elif self._upload_id: + # + # AWS complains with "The XML you provided was not well-formed or + # did not validate against our published schema" when the input is + # completely empty => abort the upload, no file created. + # + # We work around this by creating an empty file explicitly. + # + self._client.abort_multipart_upload( + Bucket=self._bucket, + Key=self._key, + UploadId=self._upload_id, + ) + self._client.put_object( + Bucket=self._bucket, + Key=self._key, + Body=b'', + ) + logger.debug('%s: wrote 0 bytes to imitate multipart upload', self) + self._upload_id = None + + @property + def closed(self): + return self._upload_id is None + + def writable(self): + """Return True if the stream supports writing.""" + return True + + def seekable(self): + """If False, seek(), tell() and truncate() will raise IOError. + + We offer only tell support, and no seek or truncate support.""" + return True + + def seek(self, offset, whence=constants.WHENCE_START): + """Unsupported.""" + raise io.UnsupportedOperation + + def truncate(self, size=None): + """Unsupported.""" + raise io.UnsupportedOperation + + def tell(self): + """Return the current stream position.""" + return self._total_bytes + + # + # io.BufferedIOBase methods. + # + def detach(self): + raise io.UnsupportedOperation("detach() not supported") + + def write(self, b: Buffer) -> int: + """Write the given buffer (bytes, bytearray, memoryview or any buffer + interface implementation) to the S3 file. + + For more information about buffers, see https://docs.python.org/3/c-api/buffer.html + + There's buffering happening under the covers, so this may not actually + do any HTTP transfer right away.""" + offset = 0 + mv = memoryview(b) + self._total_bytes += len(mv) + + # + # botocore does not accept memoryview, otherwise we could've gotten + # away with not needing to write a copy to the buffer aside from cases + # where b is smaller than part_size + # + while offset < len(mv): + start = offset + end = offset + self._part_size - self._buf.tell() + self._buf.write(mv[start:end]) + if self._buf.tell() < self._part_size: + # + # Not enough data to write a new part just yet. The assert + # ensures that we've consumed all of the input buffer. + # + assert end >= len(mv) + return len(mv) + + self._upload_next_part() + offset = end + return len(mv) + + def terminate(self): + """Cancel the underlying multipart upload.""" + if self.closed: + return + logger.debug('%s: terminating multipart upload', self) + self._client.abort_multipart_upload( + Bucket=self._bucket, + Key=self._key, + UploadId=self._upload_id, + ) + self._upload_id = None + logger.debug('%s: terminated multipart upload', self) + + def to_boto3(self, resource): + """Create an **independent** `boto3.s3.Object` instance that points to + the same S3 object as this instance. + Changes to the returned object will not affect the current instance. + """ + assert resource, 'resource must be a boto3.resource instance' + return resource.Object(self._bucket, self._key) + + # + # Internal methods. + # + def _upload_next_part(self) -> None: + part_num = self._total_parts + 1 + logger.info( + "%s: uploading part_num: %i, %i bytes (total %.3fGB)", + self, + part_num, + self._buf.tell(), + self._total_bytes / 1024.0 ** 3, + ) + self._buf.seek(0) + + # + # Network problems in the middle of an upload are particularly + # troublesome. We don't want to abort the entire upload just because + # of a temporary connection problem, so this part needs to be + # especially robust. + # + upload = RETRY._do( + functools.partial( + self._client.upload_part, + Bucket=self._bucket, + Key=self._key, + UploadId=self._upload_id, + PartNumber=part_num, + Body=self._buf, + ) + ) + + self._parts.append({'ETag': upload['ETag'], 'PartNumber': part_num}) + logger.debug("%s: upload of part_num #%i finished", self, part_num) + + self._total_parts += 1 + + self._buf.seek(0) + self._buf.truncate(0) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + if exc_type is not None: + self.terminate() + else: + self.close() + + def __str__(self): + return "smart_open.s3.MultipartWriter(%r, %r)" % (self._bucket, self._key) + + def __repr__(self): + return "smart_open.s3.MultipartWriter(bucket=%r, key=%r, part_size=%r)" % ( + self._bucket, + self._key, + self._part_size, + ) + + +class SinglepartWriter(io.BufferedIOBase): + """Writes bytes to S3 using the single part API. + + Implements the io.BufferedIOBase interface of the standard library. + + This class buffers all of its input in memory until its `close` method is called. Only then will + the data be written to S3 and the buffer is released.""" + _buf = None # so `closed` property works in case __init__ fails and __del__ is called + + def __init__( + self, + bucket, + key, + client=None, + client_kwargs=None, + writebuffer=None, + ): + _initialize_boto3(self, client, client_kwargs, bucket, key) + + if writebuffer is None: + self._buf = io.BytesIO() + elif not writebuffer.seekable(): + raise ValueError('writebuffer needs to be seekable') + else: + self._buf = writebuffer + + def flush(self): + pass + + # + # Override some methods from io.IOBase. + # + def close(self): + logger.debug("close: called") + if self.closed: + return + + self.seek(0) + + try: + self._client.put_object( + Bucket=self._bucket, + Key=self._key, + Body=self._buf, + ) + except botocore.client.ClientError as e: + raise ValueError( + 'the bucket %r does not exist, or is forbidden for access' % self._bucket) from e + else: + logger.debug("%s: direct upload finished", self) + finally: + self._buf.close() + + @property + def closed(self): + return self._buf is None or self._buf.closed + + def readable(self): + """Propagate.""" + return self._buf.readable() + + def writable(self): + """Propagate.""" + return self._buf.writable() + + def seekable(self): + """Propagate.""" + return self._buf.seekable() + + def seek(self, offset, whence=constants.WHENCE_START): + """Propagate.""" + return self._buf.seek(offset, whence) + + def truncate(self, size=None): + """Propagate.""" + return self._buf.truncate(size) + + def tell(self): + """Propagate.""" + return self._buf.tell() + + def write(self, b): + """Write the given buffer (bytes, bytearray, memoryview or any buffer + interface implementation) into the buffer. Content of the buffer will be + written to S3 on close as a single-part upload. + + For more information about buffers, see https://docs.python.org/3/c-api/buffer.html""" + return self._buf.write(b) + + def read(self, size=-1): + """Propagate.""" + return self._buf.read(size) + + def read1(self, size=-1): + """Propagate.""" + return self._buf.read1(size) + + def terminate(self): + """Close buffer and skip upload.""" + self._buf.close() + logger.debug('%s: terminated singlepart upload', self) + + # + # Internal methods. + # + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + if exc_type is not None: + self.terminate() + else: + self.close() + + def __str__(self): + return "smart_open.s3.SinglepartWriter(%r, %r)" % (self._bucket, self._key) + + def __repr__(self): + return "smart_open.s3.SinglepartWriter(bucket=%r, key=%r)" % (self._bucket, self._key) + + +def _accept_all(key): + return True + + +def iter_bucket( + bucket_name, + prefix='', + accept_key=None, + key_limit=None, + workers=16, + retries=3, + max_threads_per_fileobj=4, + client_kwargs=None, + **session_kwargs, # double star notation for backwards compatibility +): + """ + Iterate and download all S3 objects under `s3://bucket_name/prefix`. + + Parameters + ---------- + bucket_name: str + The name of the bucket. + prefix: str, optional + Limits the iteration to keys starting with the prefix. + accept_key: callable, optional + This is a function that accepts a key name (unicode string) and + returns True/False, signalling whether the given key should be downloaded. + The default behavior is to accept all keys. + key_limit: int, optional + If specified, the iterator will stop after yielding this many results. + workers: int, optional + The number of objects to download concurrently. The entire operation uses + a single ThreadPoolExecutor and shared thread-safe boto3 S3.Client. Default: 16 + retries: int, optional + The number of time to retry a failed download. Default: 3 + max_threads_per_fileobj: int, optional + The maximum number of download threads per worker. The maximum size of the + connection pool will be `workers * max_threads_per_fileobj + 1`. Default: 4 + client_kwargs: dict, optional + Keyword arguments to pass when creating a new session. + For a list of available names and values, see: + https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html#boto3.session.Session.client + session_kwargs: dict, optional + Keyword arguments to pass when creating a new session. + For a list of available names and values, see: + https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html#boto3.session.Session + + + Yields + ------ + str + The full key name (does not include the bucket name). + bytes + The full contents of the key. + + Notes + ----- + The keys are processed in parallel, using `workers` processes (default: 16), + to speed up downloads greatly. If multiprocessing is not available, thus + _MULTIPROCESSING is False, this parameter will be ignored. + + Examples + -------- + + >>> # get all JSON files under "mybucket/foo/" + >>> for key, content in iter_bucket( + ... bucket_name, prefix='foo/', + ... accept_key=lambda key: key.endswith('.json')): + ... print key, len(content) + + >>> # limit to 10k files, using 32 parallel workers (default is 16) + >>> for key, content in iter_bucket(bucket_name, key_limit=10000, workers=32): + ... print key, len(content) + """ + if accept_key is None: + accept_key = _accept_all + + # + # If people insist on giving us bucket instances, silently extract the name + # before moving on. Works for boto3 as well as boto. + # + try: + bucket_name = bucket_name.name + except AttributeError: + pass + + if bucket_name is None: + raise ValueError('bucket_name may not be None') + + total_size, key_no = 0, 0 + + # thread-safe client to share across _list_bucket and _download_key calls + # https://github.com/boto/boto3/blob/1.38.41/docs/source/guide/clients.rst?plain=1#L111 + session = boto3.session.Session(**session_kwargs) + if client_kwargs is None: + client_kwargs = {} + if 'config' not in client_kwargs: + client_kwargs['config'] = botocore.client.Config( + max_pool_connections=workers * max_threads_per_fileobj + 1, # 1 thread for _list_bucket + tcp_keepalive=True, + retries={'max_attempts': retries * 2, 'mode': 'adaptive'}, + ) + client = session.client('s3', **client_kwargs) + + transfer_config = boto3.s3.transfer.TransferConfig(max_concurrency=max_threads_per_fileobj) + + key_iterator = _list_bucket( + bucket_name=bucket_name, + prefix=prefix, + accept_key=accept_key, + client=client, + ) + download_key = functools.partial( + _download_key, + bucket_name=bucket_name, + retries=retries, + client=client, + transfer_config=transfer_config, + ) + + # Limit the iterator ('infinite' iterators are supported, key_limit=None is supported) + key_iterator = itertools.islice(key_iterator, key_limit) + + with smart_open.concurrency.ThreadPoolExecutor(workers) as executor: + result_iterator = executor.imap(download_key, key_iterator) + for key_no, (key, content) in enumerate(result_iterator, start=1): + # Skip deleted objects (404 responses) + if key is None: + continue + + if key_no % 1000 == 0: + logger.info( + "yielding key #%i: %s, size %i (total %.1f MB)", + key_no, key, len(content), total_size / 1024.0 ** 2 + ) + + yield key, content + total_size += len(content) + logger.info( + "processed %i keys, total size %.1f MB", + key_no, + total_size / 1024.0 ** 2, + ) + + +def _list_bucket( + *, + bucket_name, + client, + prefix='', + accept_key=lambda k: True, +): + ctoken = None + + while True: + # list_objects_v2 doesn't like a None value for ContinuationToken + # so we don't set it if we don't have one. + if ctoken: + kwargs = dict(Bucket=bucket_name, Prefix=prefix, ContinuationToken=ctoken) + else: + kwargs = dict(Bucket=bucket_name, Prefix=prefix) + response = client.list_objects_v2(**kwargs) + try: + content = response['Contents'] + except KeyError: + pass + else: + for c in content: + key = c['Key'] + if accept_key(key): + yield key + ctoken = response.get('NextContinuationToken', None) + if not ctoken: + break + + +def _download_key(key_name, *, client, bucket_name, retries, transfer_config): + # Sometimes, https://github.com/boto/boto/issues/2409 can happen + # because of network issues on either side. + # Retry up to 3 times to ensure its not a transient issue. + for x in range(retries + 1): + try: + content_bytes = _download_fileobj( + client=client, + bucket_name=bucket_name, + key_name=key_name, + transfer_config=transfer_config, + ) + except botocore.exceptions.ClientError as err: + # + # ignore 404 not found errors: they mean the object was deleted + # after we listed the contents of the bucket, but before we + # downloaded the object. + # + if 'Error' in err.response and err.response['Error'].get('Code') == '404': + return None, None + # Actually fail on last pass through the loop + if x == retries: + raise + # Otherwise, try again, as this might be a transient timeout + continue + return key_name, content_bytes + + +def _download_fileobj(*, client, bucket_name, key_name, transfer_config): + # + # This is a separate function only because it makes it easier to inject + # exceptions during tests. + # + buf = io.BytesIO() + client.download_fileobj( + Bucket=bucket_name, + Key=key_name, + Fileobj=buf, + Config=transfer_config, + ) + return buf.getvalue() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/smart_open_lib.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/smart_open_lib.py new file mode 100644 index 0000000000000000000000000000000000000000..ccec7bc3b79b97ac929ed1247ad1d0a096473e41 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/smart_open_lib.py @@ -0,0 +1,526 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2019 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# + +"""Implements the majority of smart_open's top-level API.""" + +import collections +import locale +import logging +import os +import os.path as P +import pathlib +import urllib.parse +import warnings + +# +# This module defines a function called smart_open so we cannot use +# smart_open.submodule to reference to the submodules. +# +import smart_open.local_file as so_file +import smart_open.compression as so_compression +import smart_open.utils as so_utils + +from smart_open import doctools +from smart_open import transport + +# +# For backwards compatibility and keeping old unit tests happy. +# +from smart_open.compression import register_compressor # noqa: F401 +from smart_open.utils import check_kwargs as _check_kwargs # noqa: F401 +from smart_open.utils import inspect_kwargs as _inspect_kwargs # noqa: F401 + +logger = logging.getLogger(__name__) + +DEFAULT_ENCODING = locale.getpreferredencoding(do_setlocale=False) + + +def _sniff_scheme(uri_as_string): + """Returns the scheme of the URL only, as a string.""" + # + # urlsplit doesn't work on Windows -- it parses the drive as the scheme... + # no protocol given => assume a local file + # + if os.name == 'nt' and '://' not in uri_as_string: + uri_as_string = 'file://' + uri_as_string + + return urllib.parse.urlsplit(uri_as_string).scheme + + +def parse_uri(uri_as_string): + """ + Parse the given URI from a string. + + Parameters + ---------- + uri_as_string: str + The URI to parse. + + Returns + ------- + collections.namedtuple + The parsed URI. + + Notes + ----- + smart_open/doctools.py magic goes here + """ + scheme = _sniff_scheme(uri_as_string) + submodule = transport.get_transport(scheme) + as_dict = submodule.parse_uri(uri_as_string) + + # + # The conversion to a namedtuple is just to keep the old tests happy while + # I'm still refactoring. + # + Uri = collections.namedtuple('Uri', sorted(as_dict.keys())) + return Uri(**as_dict) + + +# +# To keep old unit tests happy while I'm refactoring. +# +_parse_uri = parse_uri + +_builtin_open = open + + +def open( + uri, + mode='r', + buffering=-1, + encoding=None, + errors=None, + newline=None, + closefd=True, + opener=None, + compression=so_compression.INFER_FROM_EXTENSION, + transport_params=None, + ): + r"""Open the URI object, returning a file-like object. + + The URI is usually a string in a variety of formats. + For a full list of examples, see the :func:`parse_uri` function. + + The URI may also be one of: + + - an instance of the pathlib.Path class + - a stream (anything that implements io.IOBase-like functionality) + + Parameters + ---------- + uri: str or object + The object to open. + mode: str, optional + Mimicks built-in open parameter of the same name. + buffering: int, optional + Mimicks built-in open parameter of the same name. + encoding: str, optional + Mimicks built-in open parameter of the same name. + errors: str, optional + Mimicks built-in open parameter of the same name. + newline: str, optional + Mimicks built-in open parameter of the same name. + closefd: boolean, optional + Mimicks built-in open parameter of the same name. Ignored. + opener: object, optional + Mimicks built-in open parameter of the same name. Ignored. + compression: str, optional (see smart_open.compression.get_supported_compression_types) + Explicitly specify the compression/decompression behavior. + transport_params: dict, optional + Additional parameters for the transport layer (see notes below). + + Returns + ------- + A file-like object. + + Notes + ----- + smart_open has several implementations for its transport layer (e.g. S3, HTTP). + Each transport layer has a different set of keyword arguments for overriding + default behavior. If you specify a keyword argument that is *not* supported + by the transport layer being used, smart_open will ignore that argument and + log a warning message. + + smart_open/doctools.py magic goes here + + See Also + -------- + - `Standard library reference `__ + - `smart_open README.rst + `__ + + """ + logger.debug('%r', locals()) + + if not isinstance(mode, str): + raise TypeError('mode should be a string') + + if compression not in so_compression.get_supported_compression_types(): + raise ValueError(f'invalid compression type: {compression}') + + if transport_params is None: + transport_params = {} + + fobj = _shortcut_open( + uri, + mode, + compression=compression, + buffering=buffering, + encoding=encoding, + errors=errors, + newline=newline, + ) + if fobj is not None: + return fobj + + # + # This is a work-around for the problem described in Issue #144. + # If the user has explicitly specified an encoding, then assume they want + # us to open the destination in text mode, instead of the default binary. + # + # If we change the default mode to be text, and match the normal behavior + # of Py2 and 3, then the above assumption will be unnecessary. + # + if encoding is not None and 'b' in mode: + mode = mode.replace('b', '') + + if isinstance(uri, pathlib.Path): + uri = str(uri) + + explicit_encoding = encoding + encoding = explicit_encoding if explicit_encoding else DEFAULT_ENCODING + + # + # This is how we get from the filename to the end result. Decompression is + # optional, but it always accepts bytes and returns bytes. + # + # Decoding is also optional, accepts bytes and returns text. The diagram + # below is for reading, for writing, the flow is from right to left, but + # the code is identical. + # + # open as binary decompress? decode? + # filename ---------------> bytes -------------> bytes ---------> text + # binary decompressed decode + # + + try: + binary_mode = _get_binary_mode(mode) + except ValueError as ve: + raise NotImplementedError(ve.args[0]) + + binary = _open_binary_stream(uri, binary_mode, transport_params) + filename = ( + binary.name + # if name attribute is not string-like (e.g. ftp socket fileno)... + if isinstance(getattr(binary, "name", None), (str, bytes)) + # ...fall back to uri + else uri + ) + decompressed = so_compression.compression_wrapper( + binary, + binary_mode, + compression, + filename=filename, + ) + + if 'b' not in mode or explicit_encoding is not None: + decoded = _encoding_wrapper( + decompressed, + mode, + encoding=encoding, + errors=errors, + newline=newline, + ) + else: + decoded = decompressed + + # + # There are some useful methods in the binary readers, e.g. to_boto3, that get + # hidden by the multiple layers of wrapping we just performed. Promote + # them so they are visible to the user. + # + if decoded != binary: + promoted_attrs = ['to_boto3'] + for attr in promoted_attrs: + try: + setattr(decoded, attr, getattr(binary, attr)) + except AttributeError: + pass + + return so_utils.FileLikeProxy(decoded, binary) + + +def _get_binary_mode(mode_str): + # + # https://docs.python.org/3/library/functions.html#open + # + # The order of characters in the mode parameter appears to be unspecified. + # The implementation follows the examples, just to be safe. + # + mode = list(mode_str) + binmode = [] + + if 't' in mode and 'b' in mode: + raise ValueError("can't have text and binary mode at once") + + counts = [mode.count(x) for x in 'rwa'] + if sum(counts) > 1: + raise ValueError("must have exactly one of create/read/write/append mode") + + def transfer(char): + binmode.append(mode.pop(mode.index(char))) + + if 'a' in mode: + transfer('a') + elif 'w' in mode: + transfer('w') + elif 'r' in mode: + transfer('r') + else: + raise ValueError( + "Must have exactly one of create/read/write/append " + "mode and at most one plus" + ) + + if 'b' in mode: + transfer('b') + elif 't' in mode: + mode.pop(mode.index('t')) + binmode.append('b') + else: + binmode.append('b') + + if '+' in mode: + transfer('+') + + # + # There shouldn't be anything left in the mode list at this stage. + # If there is, then either we've missed something and the implementation + # of this function is broken, or the original input mode is invalid. + # + if mode: + raise ValueError('invalid mode: %r' % mode_str) + + return ''.join(binmode) + + +def _shortcut_open( + uri, + mode, + compression, + buffering=-1, + encoding=None, + errors=None, + newline=None, + ): + """Try to open the URI using the standard library io.open function. + + This can be much faster than the alternative of opening in binary mode and + then decoding. + + This is only possible under the following conditions: + + 1. Opening a local file; and + 2. Compression is disabled + + If it is not possible to use the built-in open for the specified URI, returns None. + + :param str uri: A string indicating what to open. + :param str mode: The mode to pass to the open function. + :param str compression: The compression type selected. + :returns: The opened file + :rtype: file + """ + if not isinstance(uri, str): + return None + + scheme = _sniff_scheme(uri) + if scheme not in (transport.NO_SCHEME, so_file.SCHEME): + return None + + local_path = so_file.extract_local_path(uri) + if compression == so_compression.INFER_FROM_EXTENSION: + _, extension = P.splitext(local_path) + if extension in so_compression.get_supported_extensions(): + return None + elif compression != so_compression.NO_COMPRESSION: + return None + + open_kwargs = {} + if encoding is not None: + open_kwargs['encoding'] = encoding + mode = mode.replace('b', '') + if newline is not None: + open_kwargs['newline'] = newline + + # + # binary mode of the builtin/stdlib open function doesn't take an errors argument + # + if errors and 'b' not in mode: + open_kwargs['errors'] = errors + + return _builtin_open(local_path, mode, buffering=buffering, **open_kwargs) + + +def _open_binary_stream(uri, mode, transport_params): + """Open an arbitrary URI in the specified binary mode. + + Not all modes are supported for all protocols. + + :arg uri: The URI to open. May be a string, or something else. + :arg str mode: The mode to open with. Must be rb, wb or ab. + :arg transport_params: Keyword argumens for the transport layer. + :returns: A named file object + :rtype: file-like object with a .name attribute + """ + if mode not in ('rb', 'rb+', 'wb', 'wb+', 'ab', 'ab+'): + # + # This should really be a ValueError, but for the sake of compatibility + # with older versions, which raise NotImplementedError, we do the same. + # + raise NotImplementedError('unsupported mode: %r' % mode) + + if isinstance(uri, int): + # + # We're working with a file descriptor. If we open it, its name is + # just the integer value, which isn't helpful. Unfortunately, there's + # no easy cross-platform way to go from a file descriptor to the filename, + # so we just give up here. The user will have to handle their own + # compression, etc. explicitly. + # + fobj = _builtin_open(uri, mode, closefd=False) + return fobj + + if not isinstance(uri, str): + raise TypeError("don't know how to handle uri %s" % repr(uri)) + + scheme = _sniff_scheme(uri) + submodule = transport.get_transport(scheme) + fobj = submodule.open_uri(uri, mode, transport_params) + if not hasattr(fobj, 'name'): + fobj.name = uri + + return fobj + + +def _encoding_wrapper(fileobj, mode, encoding=None, errors=None, newline=None): + """Decode bytes into text, if necessary. + + If mode specifies binary access, does nothing, unless the encoding is + specified. A non-null encoding implies text mode. + + :arg fileobj: must quack like a filehandle object. + :arg str mode: is the mode which was originally requested by the user. + :arg str encoding: The text encoding to use. If mode is binary, overrides mode. + :arg str errors: The method to use when handling encoding/decoding errors. + :returns: a file object + """ + logger.debug('encoding_wrapper: %r', locals()) + + # + # If the mode is binary, but the user specified an encoding, assume they + # want text. If we don't make this assumption, ignore the encoding and + # return bytes, smart_open behavior will diverge from the built-in open: + # + # open(filename, encoding='utf-8') returns a text stream in Py3 + # smart_open(filename, encoding='utf-8') would return a byte stream + # without our assumption, because the default mode is rb. + # + if 'b' in mode and encoding is None: + return fileobj + + if encoding is None: + encoding = DEFAULT_ENCODING + + fileobj = so_utils.TextIOWrapper( + fileobj, + encoding=encoding, + errors=errors, + newline=newline, + write_through=True, + ) + return fileobj + + +class patch_pathlib(object): + """Replace `Path.open` with `smart_open.open`""" + + def __init__(self): + self.old_impl = _patch_pathlib(open) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + _patch_pathlib(self.old_impl) + + +def _patch_pathlib(func): + """Replace `Path.open` with `func`""" + old_impl = pathlib.Path.open + pathlib.Path.open = func + return old_impl + + +def smart_open( + uri, + mode='rb', + buffering=-1, + encoding=None, + errors=None, + newline=None, + closefd=True, + opener=None, + ignore_extension=False, + **kwargs + ): + # + # This is a thin wrapper of smart_open.open. It's here for backward + # compatibility. It works exactly like smart_open.open when the passed + # parameters are identical. Otherwise, it raises a DeprecationWarning. + # + # For completeness, the main differences of the old smart_open function: + # + # 1. Default mode was read binary (mode='rb') + # 2. compression parameter was called ignore_extension + # 3. Transport parameters were passed directly as kwargs + # + url = 'https://github.com/piskvorky/smart_open/blob/develop/MIGRATING_FROM_OLDER_VERSIONS.rst' + if kwargs: + raise DeprecationWarning( + 'The following keyword parameters are not supported: %r. ' + 'See %s for more information.' % (sorted(kwargs), url) + ) + message = 'This function is deprecated. See %s for more information' % url + warnings.warn(message, category=DeprecationWarning) + + if ignore_extension: + compression = so_compression.NO_COMPRESSION + else: + compression = so_compression.INFER_FROM_EXTENSION + del kwargs, url, message, ignore_extension + return open(**locals()) + + +# +# Prevent failures with doctools from messing up the entire library. We don't +# expect such failures, but contributed modules (e.g. new transport mechanisms) +# may not be as polished. +# +try: + doctools.tweak_open_docstring(open) + doctools.tweak_parse_uri_docstring(parse_uri) +except Exception as ex: + logger.error( + 'Encountered a non-fatal error while building docstrings (see below). ' + 'help(smart_open) will provide incomplete information as a result. ' + 'For full help text, see ' + '.' + ) + logger.exception(ex) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/ssh.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/ssh.py new file mode 100644 index 0000000000000000000000000000000000000000..47848bb41e039b99ada0c1334d9c50b4f1f420b5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/ssh.py @@ -0,0 +1,308 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2019 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# + +"""Implements I/O streams over SSH. + +Examples +-------- + +>>> with open('/proc/version_signature', host='1.2.3.4') as conn: +... print(conn.read()) +b'Ubuntu 4.4.0-1061.70-aws 4.4.131' + +Similarly, from a command line:: + + $ python -c "from smart_open import ssh;print(ssh.open('/proc/version_signature', host='1.2.3.4').read())" + b'Ubuntu 4.4.0-1061.70-aws 4.4.131' + +""" + +import getpass +import os +import logging +import urllib.parse + +from typing import ( + Dict, + Callable, + Tuple, +) + +try: + import paramiko +except ImportError: + MISSING_DEPS = True + +import smart_open.utils + +logger = logging.getLogger(__name__) + +# +# Global storage for SSH connections. +# +_SSH = {} + +SCHEMES = ("ssh", "scp", "sftp") +"""Supported URL schemes.""" + +DEFAULT_PORT = 22 + +URI_EXAMPLES = ( + 'ssh://username@host/path/file', + 'ssh://username@host//path/file', + 'scp://username@host/path/file', + 'sftp://username@host/path/file', +) + +# +# Global storage for SSH config files. +# +_SSH_CONFIG_FILES = [os.path.expanduser("~/.ssh/config")] + + +def _unquote(text): + return text and urllib.parse.unquote(text) + + +def _str2bool(string): + if string == "no": + return False + if string == "yes": + return True + raise ValueError(f"Expected 'yes' / 'no', got {string}.") + + +# +# The parameter names used by Paramiko (and smart_open) slightly differ to +# those used in ~/.ssh/config, so we use a mapping to bridge the gap. +# +# The keys are option names as they appear in Paramiko (and smart_open) +# The values are a tuples containing: +# +# 1. their corresponding names in the ~/.ssh/config file +# 2. a callable to convert the parameter value from a string to the appropriate type +# +_PARAMIKO_CONFIG_MAP: Dict[str, Tuple[str, Callable]] = { + "timeout": ("connecttimeout", float), + "compress": ("compression", _str2bool), + "gss_auth": ("gssapiauthentication", _str2bool), + "gss_kex": ("gssapikeyexchange", _str2bool), + "gss_deleg_creds": ("gssapidelegatecredentials", _str2bool), + "gss_trust_dns": ("gssapitrustdns", _str2bool), +} + + +def parse_uri(uri_as_string): + split_uri = urllib.parse.urlsplit(uri_as_string) + assert split_uri.scheme in SCHEMES + return dict( + scheme=split_uri.scheme, + uri_path=_unquote(split_uri.path), + user=_unquote(split_uri.username), + host=split_uri.hostname, + port=int(split_uri.port) if split_uri.port else None, + password=_unquote(split_uri.password), + ) + + +def open_uri(uri, mode, transport_params): + kwargs = smart_open.utils.check_kwargs(open, transport_params) + parsed_uri = parse_uri(uri) + uri_path = parsed_uri.pop('uri_path') + parsed_uri.pop('scheme') + final_params = {**parsed_uri, **kwargs} # transport_params takes precedence over uri + return open(uri_path, mode, **final_params) + + +def _connect_ssh(hostname, username, port, password, connect_kwargs): + ssh = paramiko.SSHClient() + ssh.load_system_host_keys() + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + kwargs = (connect_kwargs or {}).copy() + if 'key_filename' not in kwargs: + kwargs.setdefault('password', password) + kwargs.setdefault('username', username) + ssh.connect(hostname, port, **kwargs) + return ssh + + +def _maybe_fetch_config(host, username=None, password=None, port=None, connect_kwargs=None): + # If all fields are set, return as-is. + if not any(arg is None for arg in (host, username, password, port, connect_kwargs)): + return host, username, password, port, connect_kwargs + + if not host: + raise ValueError('you must specify the host to connect to') + + # Attempt to load an OpenSSH config. + # + # Connections configured in this way are not guaranteed to perform exactly + # as they do in typical usage due to mismatches between the set of OpenSSH + # configuration options and those that Paramiko supports. We provide a best + # attempt, and support: + # + # - hostname -> address resolution + # - username inference + # - port inference + # - identityfile inference + # - connection timeout inference + # - compression selection + # - GSS configuration + # + connect_params = (connect_kwargs or {}).copy() + config_files = [f for f in _SSH_CONFIG_FILES if os.path.exists(f)] + # + # This is the actual name of the host. The input host may actually be an + # alias. + # + actual_hostname = "" + + for config_filename in config_files: + try: + cfg = paramiko.SSHConfig.from_path(config_filename) + except PermissionError: + continue + + if host not in cfg.get_hostnames(): + continue + + cfg = cfg.lookup(host) + if username is None: + username = cfg.get("user", None) + + if not actual_hostname: + actual_hostname = cfg["hostname"] + + if port is None: + try: + port = int(cfg["port"]) + except (KeyError, ValueError): + # + # Nb. ignore missing/invalid port numbers + # + pass + + # + # Special case, as we can have multiple identity files, so we check + # that the identityfile list has len > 0. This should be redundant, but + # keeping it for safety. + # + if connect_params.get("key_filename") is None: + identityfile = cfg.get("identityfile", []) + if len(identityfile): + connect_params["key_filename"] = identityfile + + for param_name, (sshcfg_name, from_str) in _PARAMIKO_CONFIG_MAP.items(): + if connect_params.get(param_name) is None and sshcfg_name in cfg: + connect_params[param_name] = from_str(cfg[sshcfg_name]) + + # + # Continue working through other config files, if there are any, + # as they may contain more options for our host + # + + if port is None: + port = DEFAULT_PORT + + if not username: + username = getpass.getuser() + + if actual_hostname: + host = actual_hostname + + return host, username, password, port, connect_params + + +def open( + path, + mode="r", + host=None, + user=None, + password=None, + port=None, + connect_kwargs=None, + prefetch_kwargs=None, + buffer_size=-1, +): + """Open a file on a remote machine over SSH. + + Expects authentication to be already set up via existing keys on the local machine. + + Parameters + ---------- + path: str + The path to the file to open on the remote machine. + mode: str, optional + The mode to use for opening the file. + host: str, optional + The hostname of the remote machine. May not be None. + user: str, optional + The username to use to login to the remote machine. + If None, defaults to the name of the current user. + password: str, optional + The password to use to login to the remote machine. + port: int, optional + The port to connect to. + connect_kwargs: dict, optional + Any additional settings to be passed to paramiko.SSHClient.connect. + prefetch_kwargs: dict, optional + Any additional settings to be passed to paramiko.SFTPFile.prefetch. + The presence of this dict (even if empty) triggers prefetching. + buffer_size: int, optional + Passed to the bufsize argument of paramiko.SFTPClient.open. + + Returns + ------- + A file-like object. + + Important + --------- + If you specify a previously unseen host, then its host key will be added to + the local ~/.ssh/known_hosts *automatically*. + + If ``username`` or ``password`` are specified in *both* the uri and + ``transport_params``, ``transport_params`` will take precedence + """ + host, user, password, port, connect_kwargs = _maybe_fetch_config( + host, user, password, port, connect_kwargs + ) + + key = (host, user) + + attempts = 2 + for attempt in range(attempts): + try: + ssh = _SSH[key] + # Validate that the cached connection is still an active connection + # and if not, refresh the connection + if not ssh.get_transport().active: + ssh.close() + ssh = _SSH[key] = _connect_ssh(host, user, port, password, connect_kwargs) + except KeyError: + ssh = _SSH[key] = _connect_ssh(host, user, port, password, connect_kwargs) + + try: + transport = ssh.get_transport() + sftp_client = transport.open_sftp_client() + break + except paramiko.SSHException as ex: + connection_timed_out = ex.args and ex.args[0] == 'SSH session not active' + if attempt == attempts - 1 or not connection_timed_out: + raise + + # + # Try again. Delete the connection from the cache to force a + # reconnect in the next attempt. + # + del _SSH[key] + + fobj = sftp_client.open(path, mode=mode, bufsize=buffer_size) + fobj.name = path + if prefetch_kwargs is not None: + fobj.prefetch(**prefetch_kwargs) + return fobj diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/transport.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/transport.py new file mode 100644 index 0000000000000000000000000000000000000000..35b535328c1ae1cf09db485266f665a48bf3f408 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/transport.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2020 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# +"""Maintains a registry of transport mechanisms. + +The main entrypoint is :func:`get_transport`. See also :file:`extending.md`. + +""" +import importlib +import logging + +import smart_open.local_file + +logger = logging.getLogger(__name__) + +NO_SCHEME = '' + +_REGISTRY = {NO_SCHEME: smart_open.local_file} +_ERRORS = {} +_MISSING_DEPS_ERROR = """You are trying to use the %(module)s functionality of smart_open +but you do not have the correct %(module)s dependencies installed. Try: + + pip install smart_open[%(module)s] + +""" + + +def register_transport(submodule): + """Register a submodule as a transport mechanism for ``smart_open``. + + This module **must** have: + + - `SCHEME` attribute (or `SCHEMES`, if the submodule supports multiple schemes) + - `open` function + - `open_uri` function + - `parse_uri' function + + Once registered, you can get the submodule by calling :func:`get_transport`. + + """ + module_name = submodule + if isinstance(submodule, str): + try: + submodule = importlib.import_module(submodule) + except ImportError: + return + else: + module_name = submodule.__name__ + # Save only the last module name piece + module_name = module_name.rsplit(".")[-1] + + if hasattr(submodule, "SCHEME"): + schemes = [submodule.SCHEME] + elif hasattr(submodule, "SCHEMES"): + schemes = submodule.SCHEMES + else: + raise ValueError("%r does not have a .SCHEME or .SCHEMES attribute" % submodule) + + for f in ("open", "open_uri", "parse_uri"): + assert hasattr(submodule, f), "%r is missing %r" % (submodule, f) + + for scheme in schemes: + assert scheme not in _REGISTRY + if getattr(submodule, "MISSING_DEPS", False): + _ERRORS[scheme] = module_name + else: + _REGISTRY[scheme] = submodule + + +def get_transport(scheme): + """Get the submodule that handles transport for the specified scheme. + + This submodule must have been previously registered via :func:`register_transport`. + + """ + expected = SUPPORTED_SCHEMES + readme_url = ( + "https://github.com/piskvorky/smart_open/blob/master/README.rst" + ) + message = ( + "Unable to handle scheme %(scheme)r, expected one of %(expected)r. " + "Extra dependencies required by %(scheme)r may be missing. " + "See <%(readme_url)s> for details." % locals() + ) + if scheme in _ERRORS: + raise ImportError(_MISSING_DEPS_ERROR % dict(module=_ERRORS[scheme])) + if scheme in _REGISTRY: + return _REGISTRY[scheme] + raise NotImplementedError(message) + + +register_transport(smart_open.local_file) +register_transport("smart_open.azure") +register_transport("smart_open.ftp") +register_transport("smart_open.gcs") +register_transport("smart_open.hdfs") +register_transport("smart_open.http") +register_transport("smart_open.s3") +register_transport("smart_open.ssh") +register_transport("smart_open.webhdfs") + +SUPPORTED_SCHEMES = tuple(sorted(_REGISTRY.keys())) +"""The transport schemes that the local installation of ``smart_open`` supports.""" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/utils.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..eceae960addcbcdf3bb859cdf7e05410247baa4f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/utils.py @@ -0,0 +1,236 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2020 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# + +"""Helper functions for documentation, etc.""" + +import inspect +import io +import logging +import urllib.parse + +import wrapt + +logger = logging.getLogger(__name__) + +WORKAROUND_SCHEMES = ['s3', 's3n', 's3u', 's3a', 'gs'] +QUESTION_MARK_PLACEHOLDER = '///smart_open.utils.QUESTION_MARK_PLACEHOLDER///' + + +def inspect_kwargs(kallable): + # + # inspect.getargspec got deprecated in Py3.4, and calling it spews + # deprecation warnings that we'd prefer to avoid. Unfortunately, older + # versions of Python (<3.3) did not have inspect.signature, so we need to + # handle them the old-fashioned getargspec way. + # + try: + signature = inspect.signature(kallable) + except AttributeError: + try: + args, varargs, keywords, defaults = inspect.getargspec(kallable) + except TypeError: + # + # Happens under Py2.7 with mocking. + # + return {} + + if not defaults: + return {} + supported_keywords = args[-len(defaults):] + return dict(zip(supported_keywords, defaults)) + else: + return { + name: param.default + for name, param in signature.parameters.items() + if param.default != inspect.Parameter.empty + } + + +def check_kwargs(kallable, kwargs): + """Check which keyword arguments the callable supports. + + Parameters + ---------- + kallable: callable + A function or method to test + kwargs: dict + The keyword arguments to check. If the callable doesn't support any + of these, a warning message will get printed. + + Returns + ------- + dict + A dictionary of argument names and values supported by the callable. + """ + supported_keywords = sorted(inspect_kwargs(kallable)) + unsupported_keywords = [k for k in sorted(kwargs) if k not in supported_keywords] + supported_kwargs = {k: v for (k, v) in kwargs.items() if k in supported_keywords} + + if unsupported_keywords: + logger.warning('ignoring unsupported keyword arguments: %r', unsupported_keywords) + + return supported_kwargs + + +def clamp(value, minval=0, maxval=None): + """Clamp a numeric value to a specific range. + + Parameters + ---------- + value: numeric + The value to clamp. + + minval: numeric + The lower bound. + + maxval: numeric + The upper bound. + + Returns + ------- + numeric + The clamped value. It will be in the range ``[minval, maxval]``. + + """ + if maxval is not None: + value = min(value, maxval) + value = max(value, minval) + return value + + +def make_range_string(start=None, stop=None): + """Create a byte range specifier in accordance with RFC-2616. + + Parameters + ---------- + start: int, optional + The start of the byte range. If unspecified, stop indicated offset from EOF. + + stop: int, optional + The end of the byte range. If unspecified, indicates EOF. + + Returns + ------- + str + A byte range specifier. + + """ + # + # https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35 + # + if start is None and stop is None: + raise ValueError("make_range_string requires either a stop or start value") + start_str = '' if start is None else str(start) + stop_str = '' if stop is None else str(stop) + return 'bytes=%s-%s' % (start_str, stop_str) + + +def parse_content_range(content_range): + """Extract units, start, stop, and length from a content range header like "bytes 0-846981/846982". + + Assumes a properly formatted content-range header from S3. + See werkzeug.http.parse_content_range_header for a more robust version. + + Parameters + ---------- + content_range: str + The content-range header to parse. + + Returns + ------- + tuple (units: str, start: int, stop: int, length: int) + The units and three integers from the content-range header. + + """ + units, numbers = content_range.split(' ', 1) + range, length = numbers.split('/', 1) + start, stop = range.split('-', 1) + return units, int(start), int(stop), int(length) + + +def safe_urlsplit(url): + """This is a hack to prevent the regular urlsplit from splitting around question marks. + + A question mark (?) in a URL typically indicates the start of a + querystring, and the standard library's urlparse function handles the + querystring separately. Unfortunately, question marks can also appear + _inside_ the actual URL for some schemas like S3, GS. + + Replaces question marks with a special placeholder substring prior to + splitting. This work-around behavior is disabled in the unlikely event the + placeholder is already part of the URL. If this affects you, consider + changing the value of QUESTION_MARK_PLACEHOLDER to something more suitable. + + See Also + -------- + https://bugs.python.org/issue43882 + https://github.com/python/cpython/blob/3.14/Lib/urllib/parse.py + https://github.com/piskvorky/smart_open/issues/285 + https://github.com/piskvorky/smart_open/issues/458 + smart_open/utils.py:QUESTION_MARK_PLACEHOLDER + """ + sr = urllib.parse.urlsplit(url, allow_fragments=False) + + placeholder = None + if sr.scheme in WORKAROUND_SCHEMES and '?' in url and QUESTION_MARK_PLACEHOLDER not in url: + # + # This is safe because people will _almost never_ use the below + # substring in a URL. If they do, then they're asking for trouble, + # and this special handling will simply not happen for them. + # + placeholder = QUESTION_MARK_PLACEHOLDER + url = url.replace('?', placeholder) + sr = urllib.parse.urlsplit(url, allow_fragments=False) + + if placeholder is None: + return sr + + path = sr.path.replace(placeholder, '?') + return urllib.parse.SplitResult(sr.scheme, sr.netloc, path, '', '') + + +class TextIOWrapper(io.TextIOWrapper): + def __exit__(self, exc_type, exc_val, exc_tb): + """Call close on underlying buffer only when there was no exception. + + Without this patch, TextIOWrapper would call self.buffer.close() during + exception handling, which is unwanted for e.g. s3 and azure. They only call + self.close() when there was no exception (self.terminate() otherwise) to avoid + committing unfinished/failed uploads. + """ + if exc_type is None: + self.close() + + +class FileLikeProxy(wrapt.ObjectProxy): + __inner = ... # initialized before wrapt disallows __setattr__ on certain objects + + def __init__(self, outer, inner): + super().__init__(outer) + self.__inner = inner + + def __enter__(self): + """This explicit proxy method is only required for pylance ref #916.""" + return self.__wrapped__.__enter__() + + def __exit__(self, *args, **kwargs): + """Exit inner after exiting outer.""" + try: + return super().__exit__(*args, **kwargs) + finally: + self.__inner.__exit__(*args, **kwargs) + + def __next__(self): + return self.__wrapped__.__next__() + + def close(self): + try: + return self.__wrapped__.close() + finally: + if self.__inner != self.__wrapped__: # Don't close again if inner and wrapped are the same + self.__inner.close() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/smart_open/webhdfs.py b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/webhdfs.py new file mode 100644 index 0000000000000000000000000000000000000000..9a693306b93ab4e4200e0838d4648255803c4fb3 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/smart_open/webhdfs.py @@ -0,0 +1,295 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2019 Radim Rehurek +# +# This code is distributed under the terms and conditions +# from the MIT License (MIT). +# + +"""Implements reading and writing to/from WebHDFS. + +The main entry point is the :func:`~smart_open.webhdfs.open` function. + +""" + +import io +import logging +import urllib.parse + +try: + import requests +except ImportError: + MISSING_DEPS = True + +from smart_open import utils, constants + +import http.client as httplib + +logger = logging.getLogger(__name__) + +SCHEME = 'webhdfs' + +URI_EXAMPLES = ( + 'webhdfs://host:port/path/file', +) + +MIN_PART_SIZE = 50 * 1024**2 # minimum part size for HDFS multipart uploads + + +def parse_uri(uri_as_str): + return dict(scheme=SCHEME, uri=uri_as_str) + + +def open_uri(uri, mode, transport_params): + kwargs = utils.check_kwargs(open, transport_params) + return open(uri, mode, **kwargs) + + +def open(http_uri, mode, min_part_size=MIN_PART_SIZE): + """ + Parameters + ---------- + http_uri: str + webhdfs url converted to http REST url + min_part_size: int, optional + For writing only. + + """ + if http_uri.startswith(SCHEME): + http_uri = _convert_to_http_uri(http_uri) + + if mode == constants.READ_BINARY: + fobj = BufferedInputBase(http_uri) + elif mode == constants.WRITE_BINARY: + fobj = BufferedOutputBase(http_uri, min_part_size=min_part_size) + else: + raise NotImplementedError("webhdfs support for mode %r not implemented" % mode) + + fobj.name = http_uri.split('/')[-1] + return fobj + + +def _convert_to_http_uri(webhdfs_url): + """ + Convert webhdfs uri to http url and return it as text + + Parameters + ---------- + webhdfs_url: str + A URL starting with webhdfs:// + """ + split_uri = urllib.parse.urlsplit(webhdfs_url) + netloc = split_uri.hostname + if split_uri.port: + netloc += ":{}".format(split_uri.port) + query = split_uri.query + if split_uri.username: + query += ( + ("&" if query else "") + "user.name=" + urllib.parse.quote(split_uri.username) + ) + + return urllib.parse.urlunsplit( + ("http", netloc, "/webhdfs/v1" + split_uri.path, query, "") + ) + + +# +# For old unit tests. +# +def convert_to_http_uri(parsed_uri): + return _convert_to_http_uri(parsed_uri.uri) + + +class BufferedInputBase(io.BufferedIOBase): + _buf = None # so `closed` property works in case __init__ fails and __del__ is called + + def __init__(self, uri): + self._uri = uri + + payload = {"op": "OPEN", "offset": 0} + self._response = requests.get(self._uri, params=payload, stream=True) + if self._response.status_code != httplib.OK: + raise WebHdfsException.from_response(self._response) + self._buf = b'' + + # + # Override some methods from io.IOBase. + # + def close(self): + """Flush and close this stream.""" + logger.debug("close: called") + if not self.closed: + self._buf = None + + @property + def closed(self): + return self._buf is None + + def readable(self): + """Return True if the stream can be read from.""" + return True + + def seekable(self): + """If False, seek(), tell() and truncate() will raise IOError. + + We offer only seek support, and no truncate support.""" + return False + + # + # io.BufferedIOBase methods. + # + def detach(self): + """Unsupported.""" + raise io.UnsupportedOperation + + def read(self, size=None): + if size is None: + self._buf, retval = b'', self._buf + self._response.raw.read() + return retval + elif size < len(self._buf): + self._buf, retval = self._buf[size:], self._buf[:size] + return retval + + try: + buffers = [self._buf] + total_read = 0 + while total_read < size: + raw_data = self._response.raw.read(io.DEFAULT_BUFFER_SIZE) + # some times read returns 0 length data without throwing a + # StopIteration exception. We break here if this happens. + if len(raw_data) == 0: + break + + total_read += len(raw_data) + buffers.append(raw_data) + except StopIteration: + pass + + self._buf = b"".join(buffers) + self._buf, retval = self._buf[size:], self._buf[:size] + return retval + + def read1(self, size=-1): + """This is the same as read().""" + return self.read(size=size) + + def readinto(self, b): + """Read up to len(b) bytes into b, and return the number of bytes + read.""" + data = self.read(len(b)) + if not data: + return 0 + b[:len(data)] = data + return len(data) + + def readline(self): + self._buf, retval = b'', self._buf + self._response.raw.readline() + return retval + + +class BufferedOutputBase(io.BufferedIOBase): + def __init__(self, uri, min_part_size=MIN_PART_SIZE): + """ + Parameters + ---------- + min_part_size: int, optional + For writing only. + + """ + self._uri = uri + self._closed = False + self.min_part_size = min_part_size + # creating empty file first + payload = {"op": "CREATE", "overwrite": True} + init_response = requests.put(self._uri, params=payload, allow_redirects=False) + if not init_response.status_code == httplib.TEMPORARY_REDIRECT: + raise WebHdfsException.from_response(init_response) + uri = init_response.headers['location'] + response = requests.put(uri, data="", headers={'content-type': 'application/octet-stream'}) + if not response.status_code == httplib.CREATED: + raise WebHdfsException.from_response(response) + self.lines = [] + self.parts = 0 + self.chunk_bytes = 0 + self.total_size = 0 + + # + # Override some methods from io.IOBase. + # + def writable(self): + """Return True if the stream supports writing.""" + return True + + # + # io.BufferedIOBase methods. + # + def detach(self): + raise io.UnsupportedOperation("detach() not supported") + + def _upload(self, data): + payload = {"op": "APPEND"} + init_response = requests.post(self._uri, params=payload, allow_redirects=False) + if not init_response.status_code == httplib.TEMPORARY_REDIRECT: + raise WebHdfsException.from_response(init_response) + uri = init_response.headers['location'] + response = requests.post(uri, data=data, + headers={'content-type': 'application/octet-stream'}) + if not response.status_code == httplib.OK: + raise WebHdfsException.from_response(response) + + def write(self, b): + """ + Write the given bytes (binary string) into the WebHDFS file from constructor. + + """ + if self._closed: + raise ValueError("I/O operation on closed file") + + if not isinstance(b, bytes): + raise TypeError("input must be a binary string") + + self.lines.append(b) + self.chunk_bytes += len(b) + self.total_size += len(b) + + if self.chunk_bytes >= self.min_part_size: + buff = b"".join(self.lines) + logger.info( + "uploading part #%i, %i bytes (total %.3fGB)", + self.parts, len(buff), self.total_size / 1024.0 ** 3 + ) + self._upload(buff) + logger.debug("upload of part #%i finished", self.parts) + self.parts += 1 + self.lines, self.chunk_bytes = [], 0 + + def close(self): + buff = b"".join(self.lines) + if buff: + logger.info( + "uploading last part #%i, %i bytes (total %.3fGB)", + self.parts, len(buff), self.total_size / 1024.0 ** 3 + ) + self._upload(buff) + logger.debug("upload of last part #%i finished", self.parts) + self._closed = True + + @property + def closed(self): + return self._closed + + +class WebHdfsException(Exception): + def __init__(self, msg="", status_code=None): + self.msg = msg + self.status_code = status_code + super(WebHdfsException, self).__init__(repr(self)) + + def __repr__(self): + return "{}(status_code={}, msg={!r})".format( + self.__class__.__name__, self.status_code, self.msg + ) + + @classmethod + def from_response(cls, response): + return cls(msg=response.text, status_code=response.status_code) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/LICENSE b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..5d91fd72404ac73b066e4b34a2ebf2ac8f889e2b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2013, Bastian Bechtold +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of python-soundfile nor the names + of its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..2de7dd269516e7daa161d2d82abd0d3eb5d2ef8b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/METADATA @@ -0,0 +1,438 @@ +Metadata-Version: 2.1 +Name: soundfile +Version: 0.13.1 +Summary: An audio library based on libsndfile, CFFI and NumPy +Home-page: https://github.com/bastibe/python-soundfile +Author: Bastian Bechtold +Author-email: basti@bastibe.de +License: BSD 3-Clause License +Keywords: audio,libsndfile +Platform: any +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: BSD License +Classifier: Natural Language :: English +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Topic :: Multimedia :: Sound/Audio +Description-Content-Type: text/x-rst +License-File: LICENSE +Requires-Dist: cffi >=1.0 +Requires-Dist: numpy +Provides-Extra: numpy + +python-soundfile +================ + +|version| |python| |status| |license| + +|contributors| |downloads| + +The `soundfile `__ module is an audio +library based on libsndfile, CFFI and NumPy. Full documentation is +available on https://python-soundfile.readthedocs.io/. + +The ``soundfile`` module can read and write sound files. File reading/writing is +supported through `libsndfile `__, +which is a free, cross-platform, open-source (LGPL) library for reading +and writing many different sampled sound file formats that runs on many +platforms including Windows, OS X, and Unix. It is accessed through +`CFFI `__, which is a foreign function +interface for Python calling C code. CFFI is supported for CPython 2.6+, +3.x and PyPy 2.0+. The ``soundfile`` module represents audio data as NumPy arrays. + +| python-soundfile is BSD licensed (BSD 3-Clause License). +| (c) 2013, Bastian Bechtold + + +|open-issues| |closed-issues| |open-prs| |closed-prs| + +.. |contributors| image:: https://img.shields.io/github/contributors/bastibe/python-soundfile.svg +.. |version| image:: https://img.shields.io/pypi/v/soundfile.svg +.. |python| image:: https://img.shields.io/pypi/pyversions/soundfile.svg +.. |license| image:: https://img.shields.io/github/license/bastibe/python-soundfile.svg +.. |downloads| image:: https://img.shields.io/pypi/dm/soundfile.svg +.. |open-issues| image:: https://img.shields.io/github/issues/bastibe/python-soundfile.svg +.. |closed-issues| image:: https://img.shields.io/github/issues-closed/bastibe/python-soundfile.svg +.. |open-prs| image:: https://img.shields.io/github/issues-pr/bastibe/python-soundfile.svg +.. |closed-prs| image:: https://img.shields.io/github/issues-pr-closed/bastibe/python-soundfile.svg +.. |status| image:: https://img.shields.io/pypi/status/soundfile.svg + +Breaking Changes +---------------- + +The ``soundfile`` module has evolved rapidly in the past. Most +notably, we changed the import name from ``import pysoundfile`` to +``import soundfile`` in 0.7. In 0.6, we cleaned up many small +inconsistencies, particularly in the the ordering and naming of +function arguments and the removal of the indexing interface. + +In 0.8.0, we changed the default value of ``always_2d`` from ``True`` +to ``False``. Also, the order of arguments of the ``write`` function +changed from ``write(data, file, ...)`` to ``write(file, data, ...)``. + +In 0.9.0, we changed the ``ctype`` arguments of the ``buffer_*`` +methods to ``dtype``, using the Numpy ``dtype`` notation. The old +``ctype`` arguments still work, but are now officially deprecated. + +In 0.12.0, we changed the load order of the libsndfile library. Now, +the packaged libsndfile in the platform-specific wheels is tried +before falling back to any system-provided libsndfile. If you would +prefer using the system-provided libsndfile, install the source +package or source wheel instead of the platform-specific wheels. + +Installation +------------ + +The ``soundfile`` module depends on the Python packages CFFI and NumPy, and the +library libsndfile. + +In a modern Python, you can use ``pip install soundfile`` to download +and install the latest release of the ``soundfile`` module and its +dependencies. On Windows (64/32) and OS X (Intel/ARM) and Linux 64, +this will also install a current version of the library libsndfile. If +you install the source module, you need to install libsndfile using +your distribution's package manager, for example ``sudo apt install +libsndfile1``. + +If you are running on an unusual platform or if you are using an older +version of Python, you might need to install NumPy and CFFI separately, +for example using the Anaconda_ package manager. + +.. _Anaconda: https://www.continuum.io/downloads + +Building +-------- + +``Soundfile`` itself does not contain any compiled code and can be +bundled into a wheel with the usual ``python setup.py bdist_wheel``. +However, ``soundfile`` relies on libsndfile, and optionally ships its +own copy of libsndfile in the wheel. + +To build a binary wheel that contains libsndfile, make sure to +checkout and update the ``_soundfile_data`` submodule, then run +``python setup.py bdist_wheel`` as usual. If the resulting file size +of the wheel is around one megabyte, a matching libsndfile has been +bundled (without libsndfile, it's around 25 KB). + +To build binary wheels for all supported platforms, run ``python +build_wheels.py``, which will ``python setup.py bdist_wheel`` for each +of the platforms we have precompiled libsndfiles for. + +Error Reporting +--------------- + +In case of API usage errors the ``soundfile`` module raises the usual `ValueError` or `TypeError`. + +For other errors `SoundFileError` is raised (used to be `RuntimeError`). +Particularly, a `LibsndfileError` subclass of this exception is raised on +errors reported by the libsndfile library. In that case the exception object +provides the libsndfile internal error code in the `LibsndfileError.code` attribute and the raw +libsndfile error message in the `LibsndfileError.error_string` attribute. + +Read/Write Functions +-------------------- + +Data can be written to the file using `soundfile.write()`, or read from +the file using `soundfile.read()`. The ``soundfile`` module can open all file formats +that `libsndfile supports +`__, for example WAV, +FLAC, OGG and MAT files (see `Known Issues `__ below about writing OGG files). + +Here is an example for a program that reads a wave file and copies it +into an FLAC file: + +.. code:: python + + import soundfile as sf + + data, samplerate = sf.read('existing_file.wav') + sf.write('new_file.flac', data, samplerate) + +Block Processing +---------------- + +Sound files can also be read in short, optionally overlapping blocks +with `soundfile.blocks()`. +For example, this calculates the signal level for each block of a long +file: + +.. code:: python + + import numpy as np + import soundfile as sf + + rms = [np.sqrt(np.mean(block**2)) for block in + sf.blocks('myfile.wav', blocksize=1024, overlap=512)] + +``SoundFile`` Objects +--------------------- + +Sound files can also be opened as `SoundFile` objects. Every +`SoundFile` has a specific sample rate, data format and a set number of +channels. + +If a file is opened, it is kept open for as long as the `SoundFile` +object exists. The file closes when the object is garbage collected, +but you should use the `SoundFile.close()` method or the +context manager to close the file explicitly: + +.. code:: python + + import soundfile as sf + + with sf.SoundFile('myfile.wav', 'r+') as f: + while f.tell() < f.frames: + pos = f.tell() + data = f.read(1024) + f.seek(pos) + f.write(data*2) + +All data access uses frames as index. A frame is one discrete time-step +in the sound file. Every frame contains as many samples as there are +channels in the file. + +RAW Files +--------- + +`soundfile.read()` can usually auto-detect the file type of sound files. This +is not possible for RAW files, though: + +.. code:: python + + import soundfile as sf + + data, samplerate = sf.read('myfile.raw', channels=1, samplerate=44100, + subtype='FLOAT') + +Note that on x86, this defaults to ``endian='LITTLE'``. If you are +reading big endian data (mostly old PowerPC/6800-based files), you +have to set ``endian='BIG'`` accordingly. + +You can write RAW files in a similar way, but be advised that in most +cases, a more expressive format is better and should be used instead. + +Virtual IO +---------- + +If you have an open file-like object, `soundfile.read()` can open it just like +regular files: + +.. code:: python + + import soundfile as sf + with open('filename.flac', 'rb') as f: + data, samplerate = sf.read(f) + +Here is an example using an HTTP request: + +.. code:: python + + import io + import soundfile as sf + from urllib.request import urlopen + + url = "http://tinyurl.com/shepard-risset" + data, samplerate = sf.read(io.BytesIO(urlopen(url).read())) + +Note that the above example only works with Python 3.x. +For Python 2.x support, replace the third line with: + +.. code:: python + + from urllib2 import urlopen + +In-memory files +^^^^^^^^^^^^^^^ + +Chunks of audio, i.e. `bytes`, can also be read and written without touching the filesystem. +In the following example OGG is converted to WAV entirely in memory (without writing files to the disk): + +.. code:: python + + import io + import soundfile as sf + + def ogg2wav(ogg: bytes): + ogg_buf = io.BytesIO(ogg) + ogg_buf.name = 'file.ogg' + data, samplerate = sf.read(ogg_buf) + wav_buf = io.BytesIO() + wav_buf.name = 'file.wav' + sf.write(wav_buf, data, samplerate) + wav_buf.seek(0) # Necessary for `.read()` to return all bytes + return wav_buf.read() + +Controlling bitrate mode and compression level +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +For some audio formats, you can control the bitrate and compression level. + +`compression_level` is a float between 0 and 1, with 1 being the highest compression, +and `bitrate_mode` is 'VARIABLE', 'CONSTANT', or 'AVERAGE'. + +.. code:: python + + import soundfile as sf + + # for example, this uncompressed 5 minute wav file with 32 kHz sample rate is 18 Mb + data, samplerate = sf.read('5min_32kHz.wav') + + # maximum mp3 compression results in 1.1 Mb file, with either CONSTANT or VARIABLE bit rate + sf.write('max_compression_vbr.mp3', data, samplerate, bitrate_mode='VARIABLE', compression_level=.99) + sf.write('max_compression_cbr.mp3', data, samplerate, bitrate_mode='CONSTANT', compression_level=.99) + + # minimum mp3 compression results in 3.5 Mb file + sf.write('min_compression_vbr.mp3', data, samplerate, bitrate_mode='VARIABLE', compression_level=0) + +Known Issues +------------ + +Writing to OGG files can result in empty files with certain versions of libsndfile. See `#130 `__ for news on this issue. + +If using a Buildroot style system, Python has trouble locating ``libsndfile.so`` file, which causes python-soundfile to not be loaded. This is apparently a bug in `python `__. For the time being, in ``soundfile.py``, you can remove the call to ``_find_library`` and hardcode the location of the ``libsndfile.so`` in ``_ffi.dlopen``. See `#258 `__ for discussion on this issue. + +News +---- + +2013-08-27 V0.1.0 Bastian Bechtold: + Initial prototype. A simple wrapper for libsndfile in Python + +2013-08-30 V0.2.0 Bastian Bechtold: + Bugfixes and more consistency with PySoundCard + +2013-08-30 V0.2.1 Bastian Bechtold: + Bugfixes + +2013-09-27 V0.3.0 Bastian Bechtold: + Added binary installer for Windows, and context manager + +2013-11-06 V0.3.1 Bastian Bechtold: + Switched from distutils to setuptools for easier installation + +2013-11-29 V0.4.0 Bastian Bechtold: + Thanks to David Blewett, now with Virtual IO! + +2013-12-08 V0.4.1 Bastian Bechtold: + Thanks to Xidorn Quan, FLAC files are not float32 any more. + +2014-02-26 V0.5.0 Bastian Bechtold: + Thanks to Matthias Geier, improved seeking and a flush() method. + +2015-01-19 V0.6.0 Bastian Bechtold: + A big, big thank you to Matthias Geier, who did most of the work! + + - Switched to ``float64`` as default data type. + - Function arguments changed for consistency. + - Added unit tests. + - Added global `read()`, `write()`, `blocks()` convenience + functions. + - Documentation overhaul and hosting on readthedocs. + - Added ``'x'`` open mode. + - Added `tell()` method. + - Added ``__repr__()`` method. + +2015-04-12 V0.7.0 Bastian Bechtold: + Again, thanks to Matthias Geier for all of his hard work, but also + Nils Werner and Whistler7 for their many suggestions and help. + + - Renamed ``import pysoundfile`` to ``import soundfile``. + - Installation through pip wheels that contain the necessary + libraries for OS X and Windows. + - Removed ``exclusive_creation`` argument to `write()`. + - Added `truncate()` method. + +2015-10-20 V0.8.0 Bastian Bechtold: + Again, Matthias Geier contributed a whole lot of hard work to this + release. + + - Changed the default value of ``always_2d`` from ``True`` to + ``False``. + - Numpy is now optional, and only loaded for ``read`` and + ``write``. + - Added `SoundFile.buffer_read()` and + `SoundFile.buffer_read_into()` and `SoundFile.buffer_write()`, + which read/write raw data without involving Numpy. + - Added `info()` function that returns metadata of a sound file. + - Changed the argument order of the `write()` function from + ``write(data, file, ...)`` to ``write(file, data, ...)`` + + And many more minor bug fixes. + +2017-02-02 V0.9.0 Bastian Bechtold: + Thank you, Matthias Geier, Tomas Garcia, and Todd, for contributions + for this release. + + - Adds support for ALAC files. + - Adds new member ``__libsndfile_version__`` + - Adds number of frames to ``info`` class + - Adds ``dtype`` argument to ``buffer_*`` methods + - Deprecates ``ctype`` argument to ``buffer_*`` methods + - Adds official support for Python 3.6 + + And some minor bug fixes. + +2017-11-12 V0.10.0 Bastian Bechtold: + Thank you, Matthias Geier, Toni Barth, Jon Peirce, Till Hoffmann, + and Tomas Garcia, for contributions to this release. + + - Should now work with cx_freeze. + - Several documentation fixes in the README. + - Removes deprecated ``ctype`` argument in favor of ``dtype`` in ``buffer_*()``. + - Adds `SoundFile.frames` in favor of now-deprecated ``__len__()``. + - Improves performance of `blocks()` and `SoundFile.blocks()`. + - Improves import time by using CFFI's out of line mode. + - Adds a build script for building distributions. + +2022-06-02 V0.11.0 Bastian Bechtold: + Thank you, tennies, Hannes Helmholz, Christoph Boeddeker, Matt + Vollrath, Matthias Geier, Jacek Konieczny, Boris Verkhovskiy, + Jonas Haag, Eduardo Moguillansky, Panos Laganakos, Jarvy Jarvison, + Domingo Ramirez, Tim Chagnon, Kyle Benesch, Fabian-Robert Stöter, + Joe Todd + + - MP3 support + - Adds binary wheels for macOS M1 + - Improves compatibility with macOS, specifically for M1 machines + - Fixes file descriptor open for binary wheels on Windows and Python 3.5+ + - Updates libsndfile to v1.1.0 + - Adds get_strings method for retrieving all metadata at once + - Improves documentation, error messages and tests + - Displays length of very short files in samples + - Supports the file system path protocol (pathlib et al) + +2023-02-02 V0.12.0 Bastian Bechtold + Thank you, Barabazs, Andrew Murray, Jon Peirce, for contributions + to this release. + + - Updated libsndfile to v1.2.0 + - Improves precompiled library location, especially with py2app or cx-freeze. + - Now provide binary wheels for Linux x86_64 + - Now prefers packaged libsndfile over system-installed libsndfile + +2023-02-15 V0.12.1 Bastian Bechtold + Thank you, funnypig, for the bug report + + - Fixed typo on library location detection if no packaged lib and + no system lib was found + +2025-01-02 V0.13.0 Bastian Bechtold + Thank you, Zhong Jianxin, mcclure, jneuendorf-i4h, aoirint, endolith, Guy Illes, ytya, Sam Lapp, Benjamin Moody + + - Updated libsndfile to v1.2.2 + - Linux arm64 builds added + - Numpy is now a dependency + - Fixed error in blocks, if file is very short + - Compression level and bitrate controls added for compressed files + - Various README improvements + - Various build system improvements + - Various improvements to error messages + +2025-01-25 V0.13.1 Bastian Bechtold + Thank you, Brian McFee and Guy Illes + + - Fixed regression in blocks diff --git a/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..e092b5f40f4975b080aba0cbd51b83457a0d6b32 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/RECORD @@ -0,0 +1,15 @@ +__pycache__/_soundfile.cpython-312.pyc,, +__pycache__/soundfile.cpython-312.pyc,, +_soundfile.py,sha256=tdj761Lv7oFon9QQXATiuHi4ILkg2I_-sxVruxl7MmY,5914 +_soundfile_data/COPYING,sha256=rQHqXNJ1X2BIODyNVMiEWc1vyxd1fFyIkvjF6gYPYUA,26518 +_soundfile_data/__init__.py,sha256=NyPoHQFFNB1a48Z6dFNzGSpwx_ZyrQKPdslRKTOar-k,125 +_soundfile_data/__pycache__/__init__.cpython-312.pyc,, +_soundfile_data/libsndfile_x64.dll,sha256=IlGMFvnRPtpa5a35mcR0DX0WzC1rF4s23UrC91mjhVk,2364416 +soundfile-0.13.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +soundfile-0.13.1.dist-info/LICENSE,sha256=DdLkEf7VU7qJGEUHfloyxbcm0bvEb_MaIRiuHM-BZ1I,1512 +soundfile-0.13.1.dist-info/METADATA,sha256=DkJUwy9IhS4HieJlruECCKm7d4ETroxUINaAOTt9MqE,16925 +soundfile-0.13.1.dist-info/RECORD,, +soundfile-0.13.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +soundfile-0.13.1.dist-info/WHEEL,sha256=AicHu81jYIhU5ObukFKUZOOinzdgDNwF05fPW9oDLwY,122 +soundfile-0.13.1.dist-info/top_level.txt,sha256=Tj_0Vt4DBIkZRETu3hVFttfv39v8vHG3H2-ngR1FC4k,37 +soundfile.py,sha256=40nDhY1qBIH-gHjXoBMmAyYee-8rD6z7lZautExRxWM,64864 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/REQUESTED b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..a19a164bc17834e9173dccb873e8a0033de44222 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.43.0) +Root-Is-Purelib: true +Tag: py2-none-win_amd64 +Tag: py3-none-win_amd64 + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c0ba8c37d0402950d930ca950870d53e4eda4dc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/soundfile-0.13.1.dist-info/top_level.txt @@ -0,0 +1,3 @@ +_soundfile +_soundfile_data +soundfile diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..c9ffdddfdd1b4e5d8d9046937a40205597a77d23 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/METADATA @@ -0,0 +1,393 @@ +Metadata-Version: 2.4 +Name: spacy +Version: 3.8.11 +Summary: Industrial-strength Natural Language Processing (NLP) in Python +Home-page: https://spacy.io +Author: Explosion +Author-email: contact@explosion.ai +License: MIT +Project-URL: Release notes, https://github.com/explosion/spaCy/releases +Project-URL: Source, https://github.com/explosion/spaCy +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: Cython +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Topic :: Scientific/Engineering +Requires-Python: <3.15,>=3.9 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: spacy-legacy<3.1.0,>=3.0.11 +Requires-Dist: spacy-loggers<2.0.0,>=1.0.0 +Requires-Dist: murmurhash<1.1.0,>=0.28.0 +Requires-Dist: cymem<2.1.0,>=2.0.2 +Requires-Dist: preshed<3.1.0,>=3.0.2 +Requires-Dist: thinc<8.4.0,>=8.3.4 +Requires-Dist: wasabi<1.2.0,>=0.9.1 +Requires-Dist: srsly<3.0.0,>=2.4.3 +Requires-Dist: catalogue<2.1.0,>=2.0.6 +Requires-Dist: weasel<0.5.0,>=0.4.2 +Requires-Dist: typer-slim<1.0.0,>=0.3.0 +Requires-Dist: tqdm<5.0.0,>=4.38.0 +Requires-Dist: numpy>=1.15.0; python_version < "3.9" +Requires-Dist: numpy>=1.19.0; python_version >= "3.9" +Requires-Dist: requests<3.0.0,>=2.13.0 +Requires-Dist: pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4 +Requires-Dist: jinja2 +Requires-Dist: setuptools +Requires-Dist: packaging>=20.0 +Provides-Extra: lookups +Requires-Dist: spacy_lookups_data<1.1.0,>=1.0.3; extra == "lookups" +Provides-Extra: transformers +Requires-Dist: spacy_transformers<1.4.0,>=1.1.2; extra == "transformers" +Provides-Extra: cuda +Requires-Dist: cupy<13.0.0,>=5.0.0b4; extra == "cuda" +Provides-Extra: cuda80 +Requires-Dist: cupy-cuda80<13.0.0,>=5.0.0b4; extra == "cuda80" +Provides-Extra: cuda90 +Requires-Dist: cupy-cuda90<13.0.0,>=5.0.0b4; extra == "cuda90" +Provides-Extra: cuda91 +Requires-Dist: cupy-cuda91<13.0.0,>=5.0.0b4; extra == "cuda91" +Provides-Extra: cuda92 +Requires-Dist: cupy-cuda92<13.0.0,>=5.0.0b4; extra == "cuda92" +Provides-Extra: cuda100 +Requires-Dist: cupy-cuda100<13.0.0,>=5.0.0b4; extra == "cuda100" +Provides-Extra: cuda101 +Requires-Dist: cupy-cuda101<13.0.0,>=5.0.0b4; extra == "cuda101" +Provides-Extra: cuda102 +Requires-Dist: cupy-cuda102<13.0.0,>=5.0.0b4; extra == "cuda102" +Provides-Extra: cuda110 +Requires-Dist: cupy-cuda110<13.0.0,>=5.0.0b4; extra == "cuda110" +Provides-Extra: cuda111 +Requires-Dist: cupy-cuda111<13.0.0,>=5.0.0b4; extra == "cuda111" +Provides-Extra: cuda112 +Requires-Dist: cupy-cuda112<13.0.0,>=5.0.0b4; extra == "cuda112" +Provides-Extra: cuda113 +Requires-Dist: cupy-cuda113<13.0.0,>=5.0.0b4; extra == "cuda113" +Provides-Extra: cuda114 +Requires-Dist: cupy-cuda114<13.0.0,>=5.0.0b4; extra == "cuda114" +Provides-Extra: cuda115 +Requires-Dist: cupy-cuda115<13.0.0,>=5.0.0b4; extra == "cuda115" +Provides-Extra: cuda116 +Requires-Dist: cupy-cuda116<13.0.0,>=5.0.0b4; extra == "cuda116" +Provides-Extra: cuda117 +Requires-Dist: cupy-cuda117<13.0.0,>=5.0.0b4; extra == "cuda117" +Provides-Extra: cuda11x +Requires-Dist: cupy-cuda11x<13.0.0,>=11.0.0; extra == "cuda11x" +Provides-Extra: cuda12x +Requires-Dist: cupy-cuda12x<13.0.0,>=11.5.0; extra == "cuda12x" +Provides-Extra: cuda-autodetect +Requires-Dist: cupy-wheel<13.0.0,>=11.0.0; extra == "cuda-autodetect" +Provides-Extra: apple +Requires-Dist: thinc-apple-ops<2.0.0,>=1.0.0; extra == "apple" +Provides-Extra: ja +Requires-Dist: sudachipy!=0.6.1,>=0.5.2; extra == "ja" +Requires-Dist: sudachidict_core>=20211220; extra == "ja" +Provides-Extra: ko +Requires-Dist: natto-py>=0.9.0; extra == "ko" +Provides-Extra: th +Requires-Dist: pythainlp>=2.0; extra == "th" +Dynamic: license-file + + + +# spaCy: Industrial-strength NLP + +spaCy is a library for **advanced Natural Language Processing** in Python and +Cython. It's built on the very latest research, and was designed from day one to +be used in real products. + +spaCy comes with [pretrained pipelines](https://spacy.io/models) and currently +supports tokenization and training for **70+ languages**. It features +state-of-the-art speed and **neural network models** for tagging, parsing, +**named entity recognition**, **text classification** and more, multi-task +learning with pretrained **transformers** like BERT, as well as a +production-ready [**training system**](https://spacy.io/usage/training) and easy +model packaging, deployment and workflow management. spaCy is commercial +open-source software, released under the +[MIT license](https://github.com/explosion/spaCy/blob/master/LICENSE). + +💫 **Version 3.8 out now!** +[Check out the release notes here.](https://github.com/explosion/spaCy/releases) + +[![tests](https://github.com/explosion/spaCy/actions/workflows/tests.yml/badge.svg)](https://github.com/explosion/spaCy/actions/workflows/tests.yml) +[![Current Release Version](https://img.shields.io/github/release/explosion/spacy.svg?style=flat-square&logo=github)](https://github.com/explosion/spaCy/releases) +[![pypi Version](https://img.shields.io/pypi/v/spacy.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/spacy/) +[![conda Version](https://img.shields.io/conda/vn/conda-forge/spacy.svg?style=flat-square&logo=conda-forge&logoColor=white)](https://anaconda.org/conda-forge/spacy) +[![Python wheels](https://img.shields.io/badge/wheels-%E2%9C%93-4c1.svg?longCache=true&style=flat-square&logo=python&logoColor=white)](https://github.com/explosion/wheelwright/releases) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/ambv/black) +
+[![PyPi downloads](https://static.pepy.tech/personalized-badge/spacy?period=total&units=international_system&left_color=grey&right_color=orange&left_text=pip%20downloads)](https://pypi.org/project/spacy/) +[![Conda downloads](https://img.shields.io/conda/dn/conda-forge/spacy?label=conda%20downloads)](https://anaconda.org/conda-forge/spacy) + +## 📖 Documentation + +| Documentation | | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ⭐️ **[spaCy 101]** | New to spaCy? Here's everything you need to know! | +| 📚 **[Usage Guides]** | How to use spaCy and its features. | +| 🚀 **[New in v3.0]** | New features, backwards incompatibilities and migration guide. | +| 🪐 **[Project Templates]** | End-to-end workflows you can clone, modify and run. | +| 🎛 **[API Reference]** | The detailed reference for spaCy's API. | +| ⏩ **[GPU Processing]** | Use spaCy with CUDA-compatible GPU processing. | +| 📦 **[Models]** | Download trained pipelines for spaCy. | +| 🦙 **[Large Language Models]** | Integrate LLMs into spaCy pipelines. | +| 🌌 **[Universe]** | Plugins, extensions, demos and books from the spaCy ecosystem. | +| ⚙️ **[spaCy VS Code Extension]** | Additional tooling and features for working with spaCy's config files. | +| 👩‍🏫 **[Online Course]** | Learn spaCy in this free and interactive online course. | +| 📰 **[Blog]** | Read about current spaCy and Prodigy development, releases, talks and more from Explosion. | +| 📺 **[Videos]** | Our YouTube channel with video tutorials, talks and more. | +| 🔴 **[Live Stream]** | Join Matt as he works on spaCy and chat about NLP, live every week. | +| 🛠 **[Changelog]** | Changes and version history. | +| 💝 **[Contribute]** | How to contribute to the spaCy project and code base. | +| 👕 **[Swag]** | Support us and our work with unique, custom-designed swag! | +| Tailored Solutions | Custom NLP consulting, implementation and strategic advice by spaCy’s core development team. Streamlined, production-ready, predictable and maintainable. Send us an email or take our 5-minute questionnaire, and well'be in touch! **[Learn more →](https://explosion.ai/tailored-solutions)** | + +[spacy 101]: https://spacy.io/usage/spacy-101 +[new in v3.0]: https://spacy.io/usage/v3 +[usage guides]: https://spacy.io/usage/ +[api reference]: https://spacy.io/api/ +[gpu processing]: https://spacy.io/usage#gpu +[models]: https://spacy.io/models +[large language models]: https://spacy.io/usage/large-language-models +[universe]: https://spacy.io/universe +[spacy vs code extension]: https://github.com/explosion/spacy-vscode +[videos]: https://www.youtube.com/c/ExplosionAI +[live stream]: https://www.youtube.com/playlist?list=PLBmcuObd5An5_iAxNYLJa_xWmNzsYce8c +[online course]: https://course.spacy.io +[blog]: https://explosion.ai +[project templates]: https://github.com/explosion/projects +[changelog]: https://spacy.io/usage#changelog +[contribute]: https://github.com/explosion/spaCy/blob/master/CONTRIBUTING.md +[swag]: https://explosion.ai/merch + +## 💬 Where to ask questions + +The spaCy project is maintained by the [spaCy team](https://explosion.ai/about). +Please understand that we won't be able to provide individual support via email. +We also believe that help is much more valuable if it's shared publicly, so that +more people can benefit from it. + +| Type | Platforms | +| ------------------------------- | --------------------------------------- | +| 🚨 **Bug Reports** | [GitHub Issue Tracker] | +| 🎁 **Feature Requests & Ideas** | [GitHub Discussions] · [Live Stream] | +| 👩‍💻 **Usage Questions** | [GitHub Discussions] · [Stack Overflow] | +| 🗯 **General Discussion** | [GitHub Discussions] · [Live Stream] | + +[github issue tracker]: https://github.com/explosion/spaCy/issues +[github discussions]: https://github.com/explosion/spaCy/discussions +[stack overflow]: https://stackoverflow.com/questions/tagged/spacy +[live stream]: https://www.youtube.com/playlist?list=PLBmcuObd5An5_iAxNYLJa_xWmNzsYce8c + +## Features + +- Support for **70+ languages** +- **Trained pipelines** for different languages and tasks +- Multi-task learning with pretrained **transformers** like BERT +- Support for pretrained **word vectors** and embeddings +- State-of-the-art speed +- Production-ready **training system** +- Linguistically-motivated **tokenization** +- Components for named **entity recognition**, part-of-speech-tagging, + dependency parsing, sentence segmentation, **text classification**, + lemmatization, morphological analysis, entity linking and more +- Easily extensible with **custom components** and attributes +- Support for custom models in **PyTorch**, **TensorFlow** and other frameworks +- Built in **visualizers** for syntax and NER +- Easy **model packaging**, deployment and workflow management +- Robust, rigorously evaluated accuracy + +📖 **For more details, see the +[facts, figures and benchmarks](https://spacy.io/usage/facts-figures).** + +## ⏳ Install spaCy + +For detailed installation instructions, see the +[documentation](https://spacy.io/usage). + +- **Operating system**: macOS / OS X · Linux · Windows (Cygwin, MinGW, Visual + Studio) +- **Python version**: Python >=3.7, <3.13 (only 64 bit) +- **Package managers**: [pip] · [conda] (via `conda-forge`) + +[pip]: https://pypi.org/project/spacy/ +[conda]: https://anaconda.org/conda-forge/spacy + +### pip + +Using pip, spaCy releases are available as source packages and binary wheels. +Before you install spaCy and its dependencies, make sure that your `pip`, +`setuptools` and `wheel` are up to date. + +```bash +pip install -U pip setuptools wheel +pip install spacy +``` + +To install additional data tables for lemmatization and normalization you can +run `pip install spacy[lookups]` or install +[`spacy-lookups-data`](https://github.com/explosion/spacy-lookups-data) +separately. The lookups package is needed to create blank models with +lemmatization data, and to lemmatize in languages that don't yet come with +pretrained models and aren't powered by third-party libraries. + +When using pip it is generally recommended to install packages in a virtual +environment to avoid modifying system state: + +```bash +python -m venv .env +source .env/bin/activate +pip install -U pip setuptools wheel +pip install spacy +``` + +### conda + +You can also install spaCy from `conda` via the `conda-forge` channel. For the +feedstock including the build recipe and configuration, check out +[this repository](https://github.com/conda-forge/spacy-feedstock). + +```bash +conda install -c conda-forge spacy +``` + +### Updating spaCy + +Some updates to spaCy may require downloading new statistical models. If you're +running spaCy v2.0 or higher, you can use the `validate` command to check if +your installed models are compatible and if not, print details on how to update +them: + +```bash +pip install -U spacy +python -m spacy validate +``` + +If you've trained your own models, keep in mind that your training and runtime +inputs must match. After updating spaCy, we recommend **retraining your models** +with the new version. + +📖 **For details on upgrading from spaCy 2.x to spaCy 3.x, see the +[migration guide](https://spacy.io/usage/v3#migrating).** + +## 📦 Download model packages + +Trained pipelines for spaCy can be installed as **Python packages**. This means +that they're a component of your application, just like any other module. Models +can be installed using spaCy's [`download`](https://spacy.io/api/cli#download) +command, or manually by pointing pip to a path or URL. + +| Documentation | | +| -------------------------- | ---------------------------------------------------------------- | +| **[Available Pipelines]** | Detailed pipeline descriptions, accuracy figures and benchmarks. | +| **[Models Documentation]** | Detailed usage and installation instructions. | +| **[Training]** | How to train your own pipelines on your data. | + +[available pipelines]: https://spacy.io/models +[models documentation]: https://spacy.io/usage/models +[training]: https://spacy.io/usage/training + +```bash +# Download best-matching version of specific model for your spaCy installation +python -m spacy download en_core_web_sm + +# pip install .tar.gz archive or .whl from path or URL +pip install /Users/you/en_core_web_sm-3.0.0.tar.gz +pip install /Users/you/en_core_web_sm-3.0.0-py3-none-any.whl +pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz +``` + +### Loading and using models + +To load a model, use [`spacy.load()`](https://spacy.io/api/top-level#spacy.load) +with the model name or a path to the model data directory. + +```python +import spacy +nlp = spacy.load("en_core_web_sm") +doc = nlp("This is a sentence.") +``` + +You can also `import` a model directly via its full name and then call its +`load()` method with no arguments. + +```python +import spacy +import en_core_web_sm + +nlp = en_core_web_sm.load() +doc = nlp("This is a sentence.") +``` + +📖 **For more info and examples, check out the +[models documentation](https://spacy.io/docs/usage/models).** + +## ⚒ Compile from source + +The other way to install spaCy is to clone its +[GitHub repository](https://github.com/explosion/spaCy) and build it from +source. That is the common way if you want to make changes to the code base. +You'll need to make sure that you have a development environment consisting of a +Python distribution including header files, a compiler, +[pip](https://pip.pypa.io/en/latest/installing/), +[virtualenv](https://virtualenv.pypa.io/en/latest/) and +[git](https://git-scm.com) installed. The compiler part is the trickiest. How to +do that depends on your system. + +| Platform | | +| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **Ubuntu** | Install system-level dependencies via `apt-get`: `sudo apt-get install build-essential python-dev git` . | +| **Mac** | Install a recent version of [XCode](https://developer.apple.com/xcode/), including the so-called "Command Line Tools". macOS and OS X ship with Python and git preinstalled. | +| **Windows** | Install a version of the [Visual C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) or [Visual Studio Express](https://visualstudio.microsoft.com/vs/express/) that matches the version that was used to compile your Python interpreter. | + +For more details and instructions, see the documentation on +[compiling spaCy from source](https://spacy.io/usage#source) and the +[quickstart widget](https://spacy.io/usage#section-quickstart) to get the right +commands for your platform and Python version. + +```bash +git clone https://github.com/explosion/spaCy +cd spaCy + +python -m venv .env +source .env/bin/activate + +# make sure you are using the latest pip +python -m pip install -U pip setuptools wheel + +pip install -r requirements.txt +pip install --no-build-isolation --editable . +``` + +To install with extras: + +```bash +pip install --no-build-isolation --editable .[lookups,cuda102] +``` + +## 🚦 Run tests + +spaCy comes with an [extensive test suite](spacy/tests). In order to run the +tests, you'll usually want to clone the repository and build spaCy from source. +This will also install the required development dependencies and test utilities +defined in the [`requirements.txt`](requirements.txt). + +Alternatively, you can run `pytest` on the tests from within the installed +`spacy` package. Don't forget to also install the test utilities via spaCy's +[`requirements.txt`](requirements.txt): + +```bash +pip install -r requirements.txt +python -m pytest --pyargs spacy +``` diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..9373f54e78c69557233eb19d5491f280fc0a0247 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/RECORD @@ -0,0 +1,1955 @@ +../../Scripts/spacy.exe,sha256=YCy0lo39Yfg1L-8q7areKKSmkGaE--Hdh5mG85vkyfg,108382 +spacy-3.8.11.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +spacy-3.8.11.dist-info/METADATA,sha256=8qelklGZCXXeuDQxAlOX-hqptsAkUYYvKHmY6E6qZ7o,28349 +spacy-3.8.11.dist-info/RECORD,, +spacy-3.8.11.dist-info/WHEEL,sha256=8UP9x9puWI0P1V_d7K2oMTBqfeLNm21CTzZ_Ptr0NXU,101 +spacy-3.8.11.dist-info/entry_points.txt,sha256=q6IIfdWIqV5G_nzLChejIJpbzXNEg4iqHL05cTBO888,46 +spacy-3.8.11.dist-info/licenses/LICENSE,sha256=KKfkHRd893LU6-vxV1WFAVCOgunFe2VMh4ZZVrafcog,1149 +spacy-3.8.11.dist-info/top_level.txt,sha256=oXTJOtzJdUdzkIbih8SAC-lK9JfD0jvZ_43H5fmTCHw,6 +spacy/__init__.pxd,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/__init__.py,sha256=yv1DzNAXPvMFV_4zhZMG80kCNcVmnczF3zBECeSga3E,3076 +spacy/__main__.py,sha256=ipw4uuFXJo2_pifxy6Vg6Jyxzks2XD3mppBZyzGbsrE,84 +spacy/__pycache__/__init__.cpython-312.pyc,, +spacy/__pycache__/__main__.cpython-312.pyc,, +spacy/__pycache__/about.cpython-312.pyc,, +spacy/__pycache__/compat.cpython-312.pyc,, +spacy/__pycache__/errors.cpython-312.pyc,, +spacy/__pycache__/git_info.cpython-312.pyc,, +spacy/__pycache__/glossary.cpython-312.pyc,, +spacy/__pycache__/language.cpython-312.pyc,, +spacy/__pycache__/lookups.cpython-312.pyc,, +spacy/__pycache__/pipe_analysis.cpython-312.pyc,, +spacy/__pycache__/registrations.cpython-312.pyc,, +spacy/__pycache__/schemas.cpython-312.pyc,, +spacy/__pycache__/scorer.cpython-312.pyc,, +spacy/__pycache__/ty.cpython-312.pyc,, +spacy/__pycache__/util.cpython-312.pyc,, +spacy/about.py,sha256=6i6lUchabzF0l5zLLHg70kAPC6s9HK6b3InhMGuXgk8,245 +spacy/attrs.cp312-win_amd64.pyd,sha256=i_HdF4SPJf_ow6y3UeMqXhv-PYLZ4o8K_jefjQ39mEg,63488 +spacy/attrs.cpp,sha256=278oAoUzWUhamSheZel-ThNK1YKtEhLJe7bP9Z4iHxM,511007 +spacy/attrs.pxd,sha256=3niCIPXzTpcDx7DgMWbarZc-El_0c3t9lAzSAlUwpDM,1256 +spacy/attrs.pyx,sha256=ZJcFmXfWTen6vOVtKUU8r31MvU7IjpsZHGs1ZsERRBE,6002 +spacy/cli/__init__.py,sha256=negnqnsucuC6Saf6toML5WYQxtoJg-p-jAt7IDUTPTw,2446 +spacy/cli/__pycache__/__init__.cpython-312.pyc,, +spacy/cli/__pycache__/_util.cpython-312.pyc,, +spacy/cli/__pycache__/apply.cpython-312.pyc,, +spacy/cli/__pycache__/assemble.cpython-312.pyc,, +spacy/cli/__pycache__/benchmark_speed.cpython-312.pyc,, +spacy/cli/__pycache__/convert.cpython-312.pyc,, +spacy/cli/__pycache__/debug_config.cpython-312.pyc,, +spacy/cli/__pycache__/debug_data.cpython-312.pyc,, +spacy/cli/__pycache__/debug_diff.cpython-312.pyc,, +spacy/cli/__pycache__/debug_model.cpython-312.pyc,, +spacy/cli/__pycache__/download.cpython-312.pyc,, +spacy/cli/__pycache__/evaluate.cpython-312.pyc,, +spacy/cli/__pycache__/find_function.cpython-312.pyc,, +spacy/cli/__pycache__/find_threshold.cpython-312.pyc,, +spacy/cli/__pycache__/info.cpython-312.pyc,, +spacy/cli/__pycache__/init_config.cpython-312.pyc,, +spacy/cli/__pycache__/init_pipeline.cpython-312.pyc,, +spacy/cli/__pycache__/package.cpython-312.pyc,, +spacy/cli/__pycache__/pretrain.cpython-312.pyc,, +spacy/cli/__pycache__/profile.cpython-312.pyc,, +spacy/cli/__pycache__/train.cpython-312.pyc,, +spacy/cli/__pycache__/validate.cpython-312.pyc,, +spacy/cli/_util.py,sha256=tfSTKjUthCQGtlRWxEofhWr-fAo9tFouFscCUVOlAIc,11172 +spacy/cli/apply.py,sha256=UXDkn0G3yuNUPS8snCczv2QrhbcWy4LpkuXm3n_j1y8,5012 +spacy/cli/assemble.py,sha256=xO0F6NFoe2sdrlSX-nr-nCTPm90AKvMnJjABDOYd9uk,2642 +spacy/cli/benchmark_speed.py,sha256=6Rws6ULZzKI8hz1nHMw1L08Tqpzq73FXY_xNRJEnkrY,5619 +spacy/cli/convert.py,sha256=T1SMkCQEkdl7JjP1r8f71m8557zv9SRgWJcxUYPidGM,9643 +spacy/cli/debug_config.py,sha256=24tqcPezWSHC1NVj7iPQtJQwuli0WAhbZ4OrC9pYVDo,4671 +spacy/cli/debug_data.py,sha256=JSRe9MJbLw2sAynUFEQpenUyMFqX1xomsFTjmQxWfzU,51475 +spacy/cli/debug_diff.py,sha256=qFhQsRmfQYIgy2fs1OHp0M7vh7FPEYzbtcRL2PyyVzQ,3669 +spacy/cli/debug_model.py,sha256=_VkcQjtyRoh4qKQ-ngx1SlvdhG7Yr7Plx_cbQdMfMT8,9172 +spacy/cli/download.py,sha256=E0dtP5ZDxc62jenxjbfBqWv_Gd92thGPXod_gho4YLs,6803 +spacy/cli/evaluate.py,sha256=uBu0OAt19JL4sj8wi8jkcrq7YuZs8mWy4LfaWNPjTHM,9659 +spacy/cli/find_function.py,sha256=rNUSmMRf_lwBjOZR-2TctjlXjKPVtco9OboIKhYJQdA,2191 +spacy/cli/find_threshold.py,sha256=P_tYT4VRM0UIG3ngT2k1rVqSWIH7uW6PhU8t4-M8DZA,9701 +spacy/cli/info.py,sha256=BDvaPRVY8ktFyvQf-V-5deoTTNM0KIJTSbsLEceTQh0,6520 +spacy/cli/init_config.py,sha256=Gx1K6j1S6DfuJjdhyxbU-jJLssgd-86lKwbbpIx5n8M,10678 +spacy/cli/init_pipeline.py,sha256=cw39Tc6ZOAy-Qzs5_p8DzFmucDx4ElJBLs7EkAh0HPY,5911 +spacy/cli/package.py,sha256=mZEaUIxQMkxCugvTbgQo4eZkUJQOLlrT8Ln3fJNThvQ,24484 +spacy/cli/pretrain.py,sha256=8v4ZWMn34LdTEba5LO4DQAe2RgKyNLl-M4S4g0W2pqw,5401 +spacy/cli/profile.py,sha256=Yctdw-oTTIckYo0XdlGZpUN61yHEH--C7D7ixAh_Q6c,3559 +spacy/cli/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/cli/project/__pycache__/__init__.cpython-312.pyc,, +spacy/cli/project/__pycache__/assets.cpython-312.pyc,, +spacy/cli/project/__pycache__/clone.cpython-312.pyc,, +spacy/cli/project/__pycache__/document.cpython-312.pyc,, +spacy/cli/project/__pycache__/dvc.cpython-312.pyc,, +spacy/cli/project/__pycache__/pull.cpython-312.pyc,, +spacy/cli/project/__pycache__/push.cpython-312.pyc,, +spacy/cli/project/__pycache__/remote_storage.cpython-312.pyc,, +spacy/cli/project/__pycache__/run.cpython-312.pyc,, +spacy/cli/project/assets.py,sha256=Gu4HGRtW7_sKF7i9LNeKGjDpiFaTOt8-ZvcGMi8ZRgw,33 +spacy/cli/project/clone.py,sha256=DTDLXE1h5jo8E1KATHouzOYioKvoLSYsl4EVqWzAenQ,32 +spacy/cli/project/document.py,sha256=KDgBdOaINBa3CkaQSAmM-nCGntKvf9Iuakj9yXE7rGA,35 +spacy/cli/project/dvc.py,sha256=b86jsms1n0x7Me8wtxBxVci3ungIUxjqSJaNQCeZKuE,30 +spacy/cli/project/pull.py,sha256=dHf6gYmC9OXDhOj9g1kmZ0R9a-9DfFcD8WXiIAsWvL0,31 +spacy/cli/project/push.py,sha256=dBbYgZCOgYRNrW94AhCYNapYcFrAuZc_68Cj8w6KgQs,31 +spacy/cli/project/remote_storage.py,sha256=xhBJMwSJrD2nuKMcSSGqo0-6wRF7y02axLeiP5hAgjM,41 +spacy/cli/project/run.py,sha256=dFvrl7QrAsRSObOQ-KK5qpiyCpxmykJ_2fqfZrl4UVc,30 +spacy/cli/templates/quickstart_training.jinja,sha256=h8OqIrzNLZOh4OMT8VabM_R7d2IIYMb1l6c4m1ORlzo,17003 +spacy/cli/templates/quickstart_training_recommendations.yml,sha256=7lIrbsm8HSCbUNe4IfoodVLiah61V9166o2VZySisZA,6576 +spacy/cli/train.py,sha256=djomPb1hpcV_YPgjiIx2SaBORapQ89orNTfkNnZE5sU,3490 +spacy/cli/validate.py,sha256=C_JGXzGYO8UKzVIrNpE1kCD4EfikhrzPu-djJn26DAg,4710 +spacy/compat.py,sha256=3kX80qNvlZGaZPXxdsx2B-h64CJTx4cesolfieDjSOc,1398 +spacy/default_config.cfg,sha256=gHMQ7JsQFkP6D-MnZtrIIEONyMuiEW0UpwqDkX-ro6g,4535 +spacy/default_config_pretraining.cfg,sha256=h41wUgQkX2KmUW_2Y09DnxeOb7Nc5v-ed_tPIYfiR1Q,782 +spacy/displacy/__init__.py,sha256=HVq36qZUKHzk77vN50hjuf-Of6LZgrtf4fr96uuuRZk,10652 +spacy/displacy/__pycache__/__init__.cpython-312.pyc,, +spacy/displacy/__pycache__/render.cpython-312.pyc,, +spacy/displacy/__pycache__/templates.cpython-312.pyc,, +spacy/displacy/render.py,sha256=-8eHI9N0EERDXjHMz6lvPQOgAzS398xe8N3t_njbwq0,25312 +spacy/displacy/templates.py,sha256=BNuAWXxAdocc5qa_AdeRsioffQ9ZcWXlAk6eWQOrrNY,4785 +spacy/errors.py,sha256=mLAFRxr1hGiMl7buYjHnns91E8fa7RUDoFZI3Bppmp0,69151 +spacy/git_info.py,sha256=RjPisDz4-ZMsy_Jy-We1j-r7hch69ntsDwMpUq8_bYo,74 +spacy/glossary.py,sha256=MnY6AbNkMsofkEvCffH2GD3hukYuXt4rU6dBoHlMSdc,13546 +spacy/kb/__init__.py,sha256=iWbBgDvGS4g9us7oefSkCQ-O-Rvtarx5C6blOQinKK8,282 +spacy/kb/__pycache__/__init__.cpython-312.pyc,, +spacy/kb/candidate.cp312-win_amd64.pyd,sha256=fWZqjLDqSiKxRIVBYN69ZSHmgvRoWby7AxMfQGmkMAc,69120 +spacy/kb/candidate.cpp,sha256=fw9lBkM2t_Ak_NdEot2BxHyeINXkcEFDM-hwVSTWnPw,681139 +spacy/kb/candidate.pxd,sha256=dg5S03k8PiqS7Cgb_ajkxnGDmuUv_ti-M7cb_7ylqOY,409 +spacy/kb/candidate.pyx,sha256=5XkXaydKC_qybFb1WGv4X3t7yAEHfeVl_2AcFjBWvvQ,2769 +spacy/kb/kb.cp312-win_amd64.pyd,sha256=ku_L2Ev6DZIyDc5cCIsJIuK2xY1j7k6VrUAOoHPJDb4,77824 +spacy/kb/kb.cpp,sha256=HacjHygr_EXYE4OOAXkGiDTx0IY5T1qwiXFMqAbdosw,743411 +spacy/kb/kb.pxd,sha256=W7jpueuhDk53PM6-WR3VFruMXvtUpMlPz7BdUmvJF-M,279 +spacy/kb/kb.pyx,sha256=gq_ZSyvM9M2vLy59zw9BEyIYiCfg9pW0PD9avf9qI0Q,4827 +spacy/kb/kb_in_memory.cp312-win_amd64.pyd,sha256=nvshvEDGJdK50e9udoGkCqqxMxANEFZkuUq-VHfy4Dg,251904 +spacy/kb/kb_in_memory.cpp,sha256=gqgLc-2S9bC-n8nMYoM2O2CIGeOs5g1bgRhz0_a-pEU,1734956 +spacy/kb/kb_in_memory.pxd,sha256=JzIo6JAuYmwDNPAER3XqCrt0PBzSym7iLTbTkj4wsRo,7139 +spacy/kb/kb_in_memory.pyx,sha256=y0c-5hqHeJCHAapxj65IzkveRZ1Ay7RJ7JCqsgXHMOM,27851 +spacy/lang/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/lang/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/__pycache__/char_classes.cpython-312.pyc,, +spacy/lang/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/__pycache__/norm_exceptions.cpython-312.pyc,, +spacy/lang/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/af/__init__.py,sha256=ZeDySzRyxvhfJTndUMYCHNFiBhQkX0p8Je83FQ3tf_E,269 +spacy/lang/af/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/af/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/af/stop_words.py,sha256=H_sR5txOztzBQH4p4xVnNxx0RkWhPlPPqvpYTl9gQJk,348 +spacy/lang/am/__init__.py,sha256=ViDKjqDKOLRVIp1JAit_A1DhbBDI5BmpcPpgstdGy5s,856 +spacy/lang/am/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/am/__pycache__/examples.cpython-312.pyc,, +spacy/lang/am/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/am/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/am/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/am/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/am/examples.py,sha256=kcbyuRACGJ1c6Y3XvBYEAlyoTMOOCyrsJLIBxxgQ37E,808 +spacy/lang/am/lex_attrs.py,sha256=j-SPYezEw3IEghMy9a4FDNV9HLe2b5_NjlGBVkeJMcc,2294 +spacy/lang/am/punctuation.py,sha256=IUfG5HQn-w4Yb3BBrTxusfXK9TDPvrWQstzmg-SVIBQ,572 +spacy/lang/am/stop_words.py,sha256=0JnkVNCLWSJyHCZTOE0fNY4_qMNaYN8myRoDIvJ-BVs,3235 +spacy/lang/am/tokenizer_exceptions.py,sha256=cQ10ykSkQekvb2WzfSEQ5-2RplDmcAMcjlbwAYORS0w,310 +spacy/lang/ar/__init__.py,sha256=wmF--ZWF_y7YfOaTZs-4BEWT22AftiiFGjnhP9IGMHc,593 +spacy/lang/ar/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ar/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ar/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ar/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/ar/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ar/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/ar/examples.py,sha256=p0i1W-pzSKCODHF9vBKvvSYGZxX5FIqyypzAWQaMKo4,907 +spacy/lang/ar/lex_attrs.py,sha256=OPmYFydoME6Fe_1bNPI1t-HpzTxI2tvBVFlI48GMYiM,1406 +spacy/lang/ar/punctuation.py,sha256=L4Yh69QPl1cka78n_-eDlrvfxb1OV6Id41g587Y6_9w,486 +spacy/lang/ar/stop_words.py,sha256=3Qw5pKVhtDGQ3FlW0rRxm7vjfIbf60C6L6hbuzkfUS4,3570 +spacy/lang/ar/tokenizer_exceptions.py,sha256=qQfUc-uJp9guA-_4qbq2ycVKvnuVa9iS4WHxThmbn6c,1548 +spacy/lang/az/__init__.py,sha256=g1eXaA-G45gkdHC22KQLRjcA2buXr5w-FjGxTMcagj8,345 +spacy/lang/az/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/az/__pycache__/examples.cpython-312.pyc,, +spacy/lang/az/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/az/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/az/examples.py,sha256=nm_18MTS_-CWRIUTDGPGoY0651Rx8U3zYhAsQCd9Ii0,763 +spacy/lang/az/lex_attrs.py,sha256=wHCWvnDVqnHnQxGLGcN0t9InC4plY6mUf6P9gdvb84w,1784 +spacy/lang/az/stop_words.py,sha256=E10S_YshQa8QXgojMsih4sAqr41eWgplm9bEahTjC-A,1111 +spacy/lang/bg/__init__.py,sha256=08lpNjLTQxa_Kts6bvl0PY-LanbcDZRosniAuWf2x44,938 +spacy/lang/bg/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/bg/__pycache__/examples.cpython-312.pyc,, +spacy/lang/bg/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/bg/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/bg/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/bg/examples.py,sha256=36pksYTnijoWBOIDmNLbAVcDFa4zYO9zdtomkiuck_0,649 +spacy/lang/bg/lex_attrs.py,sha256=lWmr7SLaFKE-MV74ccr29z5Zmj5YPV2H7-liU4ClY_E,2134 +spacy/lang/bg/stop_words.py,sha256=Bb6ONVH99zxEo7qqbhRa8nAFQ58oSh4WuirtgaTXLR0,4829 +spacy/lang/bg/tokenizer_exceptions.py,sha256=YlSqOp5SisWeIFSoLqFSSFiLQL4mOGvuNHZqISofJWs,9321 +spacy/lang/bn/__init__.py,sha256=O9WVKw86bIByKlrGGifor20vHKWlbGj6F4Girw46Um8,1226 +spacy/lang/bn/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/bn/__pycache__/examples.cpython-312.pyc,, +spacy/lang/bn/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/bn/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/bn/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/bn/examples.py,sha256=ARzkk-GKdNcsV5H01z-NJXLB1ZFhOTUIeQomXo82DPE,312 +spacy/lang/bn/punctuation.py,sha256=nwwY7kGBbHBVpgfYPaJjQA_GrL4M58LhvLuJ5hgI7Rs,1337 +spacy/lang/bn/stop_words.py,sha256=HzcPcAKwdOcTpTzYJNe1UW5GMv3it59gd8NmYpzmGfc,6198 +spacy/lang/bn/tokenizer_exceptions.py,sha256=QS3dc1SUA0C1OE0OgKOs7zTDjyDs1vOXi2goM18KJXY,995 +spacy/lang/bo/__init__.py,sha256=7LecpEYcKVi68nsMg9yN4qRQuqsjnE_uaM_O7a-mSUY,329 +spacy/lang/bo/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/bo/__pycache__/examples.cpython-312.pyc,, +spacy/lang/bo/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/bo/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/bo/examples.py,sha256=IuFL2GNXEV70l5X1wUrFXMsm-fSh41EKT6L25uKp-ec,1655 +spacy/lang/bo/lex_attrs.py,sha256=K1I2EE9ZTbftRJVzg_xS6I90e8vGW2KpRWLY92zKlI8,1759 +spacy/lang/bo/stop_words.py,sha256=sCwl9HaZ94190_7QhlhYgt70t2f1KhZTQtbKR1Us7wI,2397 +spacy/lang/ca/__init__.py,sha256=fK8hjB51wH2aOGcdv2aXGeHa6ACLAb06y-J-fxLx2jw,1397 +spacy/lang/ca/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ca/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ca/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/ca/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ca/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/ca/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ca/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/ca/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/ca/examples.py,sha256=XpQVMWjND2apS1J_9XJX_UWN5IAbNeHw-g5L8lkviVI,611 +spacy/lang/ca/lemmatizer.py,sha256=zuzsrKUYT3cQSM21dafO2qFP7ANuUOh3bGJMmyWA1Ic,2924 +spacy/lang/ca/lex_attrs.py,sha256=ronURt-9a9CHjRtV4OwAkE2fm_tVJhmgB_LkO20vzrM,1013 +spacy/lang/ca/punctuation.py,sha256=Rc8qcJMDngDy2-tN0XCB16kboxmgZ9nBESLmfCb2iC0,1668 +spacy/lang/ca/stop_words.py,sha256=-m8za0h81UbOw4i0UG857zjVO_9nQASaxk1gOg71U5Q,1671 +spacy/lang/ca/syntax_iterators.py,sha256=OwqOo4aPjKKwkvUNPlCuBNtbTvtt7nmzkRwDIjNsw2M,2044 +spacy/lang/ca/tokenizer_exceptions.py,sha256=l4ATYwiO49_kbsWyBGdacUv0EESu5Jr5GP-jeswiMBs,2028 +spacy/lang/char_classes.py,sha256=FZ9Y5ZUPRvuIz8or-UEI7fGgqg-1nyAap8OHfwyXHYg,15011 +spacy/lang/cs/__init__.py,sha256=xI4eD5puCmwZJXP7HIBGBnYfZsN_Co8CJyUDRVDJm68,321 +spacy/lang/cs/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/cs/__pycache__/examples.cpython-312.pyc,, +spacy/lang/cs/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/cs/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/cs/examples.py,sha256=X4q3AizUg2TmzeUjyeLINeQ8liU93Ys-UK2mRDaiuCk,1550 +spacy/lang/cs/lex_attrs.py,sha256=a-C2DCEroB1LyKmC83SmYYbNlDbJ4Sk3kxjqEKMs1nc,1135 +spacy/lang/cs/stop_words.py,sha256=Oa--mrk0zKN_MWUV2E-PWMsf483x-SGeMXpgDvzNX7U,2628 +spacy/lang/da/__init__.py,sha256=8bQ6IA2RgtufOIkYIKUxAkn_bgEBg4nLep8OA57WPRg,651 +spacy/lang/da/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/da/__pycache__/examples.cpython-312.pyc,, +spacy/lang/da/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/da/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/da/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/da/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/da/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/da/examples.py,sha256=FLPTyVtK9ux7ewZ75uodGgDT3Sjzjv8z7a_I6xUe5iI,585 +spacy/lang/da/lex_attrs.py,sha256=zmd3iV004q5j3fk-SkcwT_j6tcNTEF2vHD7H_x146QQ,3624 +spacy/lang/da/punctuation.py,sha256=1qJd2YAkgcSr9pE3wPPjagkdIrfZgRakCWSdNpBqvrg,950 +spacy/lang/da/stop_words.py,sha256=xvlGGoRV5LtAP8upcVEhXZ4DIRaGdBuoMPCDf3NQqaU,1390 +spacy/lang/da/syntax_iterators.py,sha256=Q2ytAhof-MQzBARMIacgyF5LTH4TjKi6pmra9A7WQP0,2263 +spacy/lang/da/tokenizer_exceptions.py,sha256=7uDw0ad2QaRL_jWQRuFaX5FA-g0nIKY56pVnFyG_sMc,9537 +spacy/lang/de/__init__.py,sha256=JDIA4031ewdT_U81Rpr75r2jBwDdrRCnXkaWGscx9kw,638 +spacy/lang/de/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/de/__pycache__/examples.cpython-312.pyc,, +spacy/lang/de/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/de/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/de/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/de/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/de/examples.py,sha256=KiQ97oeJmL4fKAWtAkfj_5MbFC3kHHPRhTlv_uXsiAA,695 +spacy/lang/de/punctuation.py,sha256=nPF_VeD_Q1YouCwby5TpvdY8Cut2f_rf9djSt288dqE,1465 +spacy/lang/de/stop_words.py,sha256=25baHVaTDhAAlPU20EnPJ74MafkROAzXnRwI5MczoZw,3739 +spacy/lang/de/syntax_iterators.py,sha256=bU2yayFpZgP4RMGnPCB5px5PjLIZvbpByFUgEdJi2xI,1893 +spacy/lang/de/tokenizer_exceptions.py,sha256=F72X3ABfxeR8RgtgBR-VDsg-2s2urn_jv3ggBhMcAkU,6122 +spacy/lang/dsb/__init__.py,sha256=yhEGIzRQe3YBwHNynf5tJDCgRnt9sjZF4YcHfpDdqmI,350 +spacy/lang/dsb/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/dsb/__pycache__/examples.cpython-312.pyc,, +spacy/lang/dsb/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/dsb/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/dsb/examples.py,sha256=IcuE6V-_us6joH90iJQmVI2_vIYlyYDXth8iwxuMpRA,566 +spacy/lang/dsb/lex_attrs.py,sha256=jVBjesvzatTtye-2eDDLh2OeVD3lmfuvGfgpIt88hH8,2019 +spacy/lang/dsb/stop_words.py,sha256=DJ6QDzYe6eN0Q4gSTTDG7T4gEfeR_R86_RoAk-98Bsc,133 +spacy/lang/el/__init__.py,sha256=f-bCPO2ys5MlNSr-Dw1w0uUmKK1t-6Q6j1HeYQwf5ss,1383 +spacy/lang/el/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/el/__pycache__/examples.cpython-312.pyc,, +spacy/lang/el/__pycache__/get_pos_from_wiktionary.cpython-312.pyc,, +spacy/lang/el/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/el/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/el/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/el/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/el/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/el/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/el/examples.py,sha256=_cQbPtUwB-TTQNS0A6BsfRuQ39mLP7fw9uOtDczKTxM,1996 +spacy/lang/el/get_pos_from_wiktionary.py,sha256=zjcz_WD0sRFZ86dcdZzK6ONZpg4CJVkKZCNGyZK2PAQ,2151 +spacy/lang/el/lemmatizer.py,sha256=UJpdYmXFb0SXkSyEYSJfGKLXoUFg1cJ1ZI5fBCz3900,2257 +spacy/lang/el/lex_attrs.py,sha256=kGn4bzLt8eC5Mv3xJ7t-gaZHjCdj495ypfWYxi2xQV8,2419 +spacy/lang/el/punctuation.py,sha256=cczk06w0aeh0f-ak1qbxf2M3tNjKk3B0cLlhAGztvwM,3513 +spacy/lang/el/stop_words.py,sha256=wCpgnP35DX2qw8VAP-oJGgNSg49jEusVCC8JFpxcgEI,8187 +spacy/lang/el/syntax_iterators.py,sha256=2Zz4ejZLxiV070emRe4k7wTPlAJgOxOq-CPym3DimeM,2343 +spacy/lang/el/tokenizer_exceptions.py,sha256=zyjdJYDKQxggi8u223nOfhY2GjSJG2jTwcGrtq_yQHw,10471 +spacy/lang/en/__init__.py,sha256=w6FMOVdVeQyBvG9bIFts6F1dpA2rRrD4cMzFMYuBO08,1287 +spacy/lang/en/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/en/__pycache__/examples.cpython-312.pyc,, +spacy/lang/en/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/en/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/en/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/en/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/en/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/en/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/en/examples.py,sha256=ZpYUxqUjR1JSdeBJIgKs6XHEdEGNm6_txLthxvG0MOM,572 +spacy/lang/en/lemmatizer.py,sha256=xQ-Tod3RI1sbS7xd7cWkEnHya9E47hNZ0BlPWGbgxZQ,1520 +spacy/lang/en/lex_attrs.py,sha256=CmAQ7somf8tJGhmO5R2q6aNj_crtQhahTydZCzTEQaQ,1816 +spacy/lang/en/punctuation.py,sha256=NE246fA9_BmJyArRIROb48Z02x03wk2m1gmuHYbqlz0,602 +spacy/lang/en/stop_words.py,sha256=t3w3m4xfRGBB4BFpppgGwtmjl523U0LV87w4S-QQvSw,2221 +spacy/lang/en/syntax_iterators.py,sha256=2aLVMI3JPy2rrQWMrTGTAO5FYbkdGKxLitSGC7fBs_U,1620 +spacy/lang/en/tokenizer_exceptions.py,sha256=j6yHhowmuER9TqFQT9v0aln_hOh15r3F_CTKexVafcg,14778 +spacy/lang/es/__init__.py,sha256=3SO9ZO8n8OuoQ-ks8lfBLNteOVfTGV4Sb7bnXjCncyQ,1342 +spacy/lang/es/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/es/__pycache__/examples.cpython-312.pyc,, +spacy/lang/es/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/es/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/es/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/es/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/es/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/es/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/es/examples.py,sha256=z3-0WO2URaUQMcZsh7UT0Goe92DXgdxmcKvVHRvaz3I,798 +spacy/lang/es/lemmatizer.py,sha256=xXPVLSrv1K_RB-aFaC9uFNczEdmAoz5RkKd3z58JVlM,16450 +spacy/lang/es/lex_attrs.py,sha256=iQFiuhiY9HkCpbyNNGwacvYiQD5XjevyWYZhrP-ajrk,1898 +spacy/lang/es/punctuation.py,sha256=wRvDM5rgapPp77ux2xl3t2rNwtFQBzeWfoSpco0yDa4,1261 +spacy/lang/es/stop_words.py,sha256=jizTlvy5N-nQmLAVwYUZC1QqXv7Xe9t-nU1yMjW2mgs,3468 +spacy/lang/es/syntax_iterators.py,sha256=MZr7a5aG-11HUDteJX_y61lr40MKS4-RY2338a3Sv0s,2790 +spacy/lang/es/tokenizer_exceptions.py,sha256=5XGveG4W9qS0tIeAvOBmAdX4gOha2arcy9JGRPW4-3M,1539 +spacy/lang/et/__init__.py,sha256=PkMJnctug4sf9Cc5gAO1B9rMmjTBakKrJprwvixTvew,265 +spacy/lang/et/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/et/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/et/stop_words.py,sha256=p3f6Aa8PDXTPqiKxfSsfEE_9LBsmqOTayGmDDJucPHw,287 +spacy/lang/eu/__init__.py,sha256=csBf3qU7InPmGUAx1EGN3QZo8vAUUTTLvgRxuAf7YmU,405 +spacy/lang/eu/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/eu/__pycache__/examples.cpython-312.pyc,, +spacy/lang/eu/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/eu/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/eu/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/eu/examples.py,sha256=4Yemvo2C6RiLmonJKRD1qRljmMMqu4ID0yl0BHTO_Lg,430 +spacy/lang/eu/lex_attrs.py,sha256=6K1uXNmsJx_mBubPfzHua435LA5vd2TuAkLybbh-Yrc,1169 +spacy/lang/eu/punctuation.py,sha256=HWXmxBKR0LsoS0kq01YNYulgzl1MR5aXqRFzc_SPEZc,80 +spacy/lang/eu/stop_words.py,sha256=q-d3a_gjlgRVf9bm_-l33KICnlb1qITNLLJBw_OH8YE,865 +spacy/lang/fa/__init__.py,sha256=s9pLeOQE2Ekuqe2cT_TqxYoyMLEAGzBs8w7nZjvSaro,1359 +spacy/lang/fa/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/fa/__pycache__/examples.cpython-312.pyc,, +spacy/lang/fa/__pycache__/generate_verbs_exc.cpython-312.pyc,, +spacy/lang/fa/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/fa/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/fa/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/fa/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/fa/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/fa/examples.py,sha256=7eQpy8pXQV57sl98qXj5VLZmszEtnpHryx9mXtGFDrQ,528 +spacy/lang/fa/generate_verbs_exc.py,sha256=-Uwhwh4B2KTYu24t9mrLnowurNoJ0eMGUIXsYbIBDKc,15507 +spacy/lang/fa/lex_attrs.py,sha256=ksndiguuxYvTJ1o5p94A8R9_X93-qy2wIdjzaxRo9dU,1486 +spacy/lang/fa/punctuation.py,sha256=gJhsl3iPjyl8ckc9HlW61O7ya5O4jh-juy4e77gEx6w,532 +spacy/lang/fa/stop_words.py,sha256=VCbkQeLN8_NgMOYxSqQlXR5OQicCS5Ybo4Xm-bY63TI,4161 +spacy/lang/fa/syntax_iterators.py,sha256=IYDndeLdr8dJQ1Owa1JXRPOJwco4clV8p2i1LBM3K_4,1607 +spacy/lang/fa/tokenizer_exceptions.py,sha256=i0A6WF7_Fpws_N9LBIsagP0UdN_WO3xzAhzaNJgsQw8,65666 +spacy/lang/fi/__init__.py,sha256=2YHMHSal5agYuklnZCNrQjbv94rv0gp7rIXKLMn5i7E,655 +spacy/lang/fi/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/fi/__pycache__/examples.cpython-312.pyc,, +spacy/lang/fi/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/fi/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/fi/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/fi/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/fi/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/fi/examples.py,sha256=Y8OCJxQnDjWVeoACOcn_rTO-XXdEb2KC_qynFKSrPBQ,560 +spacy/lang/fi/lex_attrs.py,sha256=CZl3cvPYta4tnWLcOjH7AMeSo61849lOByiFSOzXhyY,1131 +spacy/lang/fi/punctuation.py,sha256=3gXtJIWl5NKFQVYOiyTouOLMlkagGd8TL4_WZBt6j7U,898 +spacy/lang/fi/stop_words.py,sha256=fpzLwU1H0F_L3BzDjFCg90YfwVpGXibyJT517cCL3QM,6546 +spacy/lang/fi/syntax_iterators.py,sha256=zzpmBGEXWPi3-0eYhf6ogZDvXJUlaarT-W1q51NLaPE,2460 +spacy/lang/fi/tokenizer_exceptions.py,sha256=AIWTuf_SdL2H_xzhmg6-YaixKhpNyeI2Z95HNIdUI5w,2574 +spacy/lang/fo/__init__.py,sha256=m2hYP20rHUcyZVPfuW4QvuGz0GyUOOMUz3edYuQfQXs,489 +spacy/lang/fo/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/fo/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/fo/tokenizer_exceptions.py,sha256=FvMUl7puVxyJPQT6FKdW4_d-Kig8ERe5C1TSDG-ouFI,1394 +spacy/lang/fr/__init__.py,sha256=YPpqGcl9C3Qha9w8VZJJauoF6taSvTMsR5Y5WKKohCA,1434 +spacy/lang/fr/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/fr/__pycache__/_tokenizer_exceptions_list.cpython-312.pyc,, +spacy/lang/fr/__pycache__/examples.cpython-312.pyc,, +spacy/lang/fr/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/fr/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/fr/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/fr/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/fr/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/fr/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/fr/_tokenizer_exceptions_list.py,sha256=NFyro9MHB3ESK7XC5UrTR8JevRjdxhIsPfUpZnKZlr4,376238 +spacy/lang/fr/examples.py,sha256=CzANXPdM6HtraNDEtXHBJY8i3Kl6TVE-KMzYbyn47Ts,958 +spacy/lang/fr/lemmatizer.py,sha256=Wso4aXTdK8wxD7Q25mzAr32rDqTyyd0BRE3piG8XiE8,3103 +spacy/lang/fr/lex_attrs.py,sha256=edsvNVRD_f7kauHOqf1LQPdN-o51vvdnzW5CN7uN_ik,1669 +spacy/lang/fr/punctuation.py,sha256=ANKsXYbQqY7ysV5oqBYeocJf6Po60EQUI1pwXzLrUZc,1524 +spacy/lang/fr/stop_words.py,sha256=sOe7bx2a3Q6XleqnE7ZTsvxrEO8hyHebB5cA7rg5BdA,3588 +spacy/lang/fr/syntax_iterators.py,sha256=k2DlEqtN28dNa9v7C-83h-bICN-PCsohetLOfqvvJ1A,3209 +spacy/lang/fr/tokenizer_exceptions.py,sha256=rYt7XuXvaY0Ia7H9JBl6cxZj4HJ1U4BY108LeMSZd_0,11674 +spacy/lang/ga/__init__.py,sha256=P2qVh1Mp3DdlVRB0wJovV9IQOxCELqbse_wgiDGI67M,852 +spacy/lang/ga/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ga/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/ga/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ga/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/ga/lemmatizer.py,sha256=Z_T0JpoO7o0f0eEzdWtSM0asf-tXuqUbh7f8LF0RTNM,5098 +spacy/lang/ga/stop_words.py,sha256=hhQX1ZWyWAbGR_xqjbMvNxn_NOGD2T57ndaYprSYmAI,651 +spacy/lang/ga/tokenizer_exceptions.py,sha256=c1VQeG2to4xDfob9Uv1CvnO58Ee9nrCqfdQZjGwW4cQ,1953 +spacy/lang/gd/__init__.py,sha256=V2CkAmyYks61k2qE3kAih6CeSyaIw8uao3crhOY6zXw,401 +spacy/lang/gd/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/gd/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/gd/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/gd/stop_words.py,sha256=BOfbjZX8XGFh14CKT2tiddnCUABoIUb3Fn9ilUoh8yA,2756 +spacy/lang/gd/tokenizer_exceptions.py,sha256=b0zqlz_-XdKGJJSYv4w4YTxzSoTPPM8Q2jeBJz9BTo4,26563 +spacy/lang/grc/__init__.py,sha256=JOVM3Q73ohDUbg-AeMekQaiAeM0dPmLUjZW8T4vFzEk,642 +spacy/lang/grc/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/grc/__pycache__/examples.cpython-312.pyc,, +spacy/lang/grc/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/grc/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/grc/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/grc/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/grc/examples.py,sha256=E_HxfmHZNeSXbVGoks-OxEW1PZiM5BG30Ryc_GbM-nY,1081 +spacy/lang/grc/lex_attrs.py,sha256=KpguDXdOc7opj1BrgSlQ_QMhQFeEmFUNu7OV_O45Dgw,6953 +spacy/lang/grc/punctuation.py,sha256=4Mupg3paIFU-R5PVnbr4PyYu0xUyQssRrC9HyWTv1ZE,1162 +spacy/lang/grc/stop_words.py,sha256=BJnEOTTM-iK5qAwC7UGiE-O7HHjHIQS2TyPox4Z7keg,9425 +spacy/lang/grc/tokenizer_exceptions.py,sha256=mNsw_rdRbuIYst4tdaLCmx4hIH4dHc1Mbl-x5G0d-lI,6879 +spacy/lang/gu/__init__.py,sha256=HzOWL8fj9S7gq71Y71xAjOJcF_gkCMsft8DfVZIfsOQ,265 +spacy/lang/gu/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/gu/__pycache__/examples.cpython-312.pyc,, +spacy/lang/gu/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/gu/examples.py,sha256=gz985wQRFe1uTf5vX9V2GDcoEqh8VweyMOGH3aBYft0,1231 +spacy/lang/gu/stop_words.py,sha256=M5mZ-PJ6f-CP9R__YhCEkesa30i8wwG2-vwXk7fLSuI,1092 +spacy/lang/he/__init__.py,sha256=qi57MrqoR98ERHu0GOHcKW6clDbarTAWsD0-5eVhNO0,408 +spacy/lang/he/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/he/__pycache__/examples.cpython-312.pyc,, +spacy/lang/he/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/he/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/he/examples.py,sha256=N_gMov3RoOXitipWGTmgzK6kH8irOpr4vPq5LqdYPNI,1016 +spacy/lang/he/lex_attrs.py,sha256=CmsTNg4bfhZyIZivs9Bkw2S2LL3MpsJzU1sdJ81n3wI,1854 +spacy/lang/he/stop_words.py,sha256=lL3fSBVBI81D6uVi8vsZIUy37a1tYPER1GZMOvKsBpY,2078 +spacy/lang/hi/__init__.py,sha256=cZohl0X1pJ8v_z1EK9YibDR-x8e0NUbQqM7b6dlt_Xc,321 +spacy/lang/hi/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/hi/__pycache__/examples.cpython-312.pyc,, +spacy/lang/hi/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/hi/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/hi/examples.py,sha256=a5jurRb8eobNXEbzDuiwQUl-DTRB6QbtYodqcbv2s6k,1536 +spacy/lang/hi/lex_attrs.py,sha256=dfRkSNpFX72joE_WUACTpCFIvyvJ2n4BNQDt4BvVyRY,6076 +spacy/lang/hi/stop_words.py,sha256=W3rrJYPIAwA02rb5cLgA_7TBXgpjRafbd6vxhCYGxlI,3214 +spacy/lang/hr/__init__.py,sha256=OpLYm9nm2d_-qD_KDGM4oE3Q_i9I9L6tCquxKGTvRyw,265 +spacy/lang/hr/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/hr/__pycache__/examples.cpython-312.pyc,, +spacy/lang/hr/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/hr/examples.py,sha256=QcYby6oQFVNzDetgOyfbiy8hcJqRbKH1GQyP5nYxtt0,504 +spacy/lang/hr/lemma_lookup_license.txt,sha256=rr3OQRFnIIIQxPwBWYKSXVq9OQgIy0E_lXwOCbkdHwM,986 +spacy/lang/hr/stop_words.py,sha256=YF0ae-a9QfOyk9cNohZadb_LT2_4qVrmZ66D1H5QEFs,2343 +spacy/lang/hsb/__init__.py,sha256=LmneRw8WZitH-AqYXbZcvAOJQyTpXwDzuvD55u2w2gA,455 +spacy/lang/hsb/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/hsb/__pycache__/examples.cpython-312.pyc,, +spacy/lang/hsb/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/hsb/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/hsb/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/hsb/examples.py,sha256=9OvxJnI-vPf2UBnQ-Ob9vitGW4rzRVWFrynbFBgp1WI,653 +spacy/lang/hsb/lex_attrs.py,sha256=FkHtl2P55IAoM9VXuKXgCcpC-wz6h3fufIXRQxB_jx0,1897 +spacy/lang/hsb/stop_words.py,sha256=61RWIlR0ctPp-j1f0vhUDZ5cVcaPO4pJYyC7fSe0YgU,142 +spacy/lang/hsb/tokenizer_exceptions.py,sha256=dGjreo4aifP6tfccNpPWmoXT-1Gzqz1Wone5IwTjePs,404 +spacy/lang/ht/__init__.py,sha256=XNkQ7-v8hKrNjD8SJuVFFJYtbT9-eScm0_CZcaXuNHQ,1492 +spacy/lang/ht/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ht/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ht/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/ht/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ht/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/ht/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ht/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/ht/__pycache__/tag_map.cpython-312.pyc,, +spacy/lang/ht/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/ht/examples.py,sha256=HJvW1PS13Eof9iFliq0XYVefUHQG5O7W_hS9qtkZhKE,556 +spacy/lang/ht/lemmatizer.py,sha256=sgwsjuuj5vcfAIWtA04DICcKG6sfrB7Je4kQRRH3j30,1642 +spacy/lang/ht/lex_attrs.py,sha256=Hq02Z-lssYwklCXiYZyxLrgc0QlUh2AVfwMmCT8WHHA,1933 +spacy/lang/ht/punctuation.py,sha256=dB6kPpMJOVovD2zpIGFqWJ24lcMl5a3yzBB5Rx_igK0,1619 +spacy/lang/ht/stop_words.py,sha256=EboafYnPo4bs92oD1EEhHcpuGko4-q7MaQOgtuFM7FQ,809 +spacy/lang/ht/syntax_iterators.py,sha256=YqQ5Kot5cUObYn8Wq43JWHfsK-GOKxf2inqIHTPKy9s,2401 +spacy/lang/ht/tag_map.py,sha256=gQMR5ADotN8dfH4DbFb53AO8J8kQBrRkkku1MzBFXAc,695 +spacy/lang/ht/tokenizer_exceptions.py,sha256=mNa2uMR20U6G8ZSg6Vcd4g6TkpVl1IdWpLPy1nd5hNQ,3790 +spacy/lang/hu/__init__.py,sha256=J6ItbOBVKjxEZ0QMQWsSPDWbHO8vSlpQNN_m7YJqxJE,605 +spacy/lang/hu/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/hu/__pycache__/examples.cpython-312.pyc,, +spacy/lang/hu/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/hu/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/hu/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/hu/examples.py,sha256=QiSRb1lVdbooI67WvrAMMna48_CyskNGlIFd7D9K5cY,418 +spacy/lang/hu/punctuation.py,sha256=BuidsxOU6DMnt8RhZTzy4A_oqhcqVp61Jk2MXrDCtv0,1566 +spacy/lang/hu/stop_words.py,sha256=f27xbpOgpENj-af3GkCFj2rbDX_Zabe-1voHJ_4klik,1446 +spacy/lang/hu/tokenizer_exceptions.py,sha256=2HAQsJ7-SWfMIVQjTydV9ohfiE94dQu0NDOjNM48f9M,9054 +spacy/lang/hy/__init__.py,sha256=eQ3U7mm9muJ9fUS7dK2YaJ5EBJqbt2-hrAfThFoC35I,333 +spacy/lang/hy/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/hy/__pycache__/examples.cpython-312.pyc,, +spacy/lang/hy/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/hy/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/hy/examples.py,sha256=arlqcqMFbygN2T80Rgg7uM0DX2qpeZed9hxNJX5cF2M,452 +spacy/lang/hy/lex_attrs.py,sha256=L5bH2loHa_1QKGPmVNNzJinhyZjk4xJ3fHaWVSZgOKY,1215 +spacy/lang/hy/stop_words.py,sha256=_FgA_mjC3WBjVGGT5ocZcizo18baVvVRxYIiQIU7Ct0,1174 +spacy/lang/id/__init__.py,sha256=uKW0bZtps3EK5QRKBp-DqxPq7qo5FNI9OVpKibjyMPE,722 +spacy/lang/id/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/id/__pycache__/_tokenizer_exceptions_list.cpython-312.pyc,, +spacy/lang/id/__pycache__/examples.cpython-312.pyc,, +spacy/lang/id/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/id/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/id/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/id/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/id/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/id/_tokenizer_exceptions_list.py,sha256=szqi4HgQvdkesccZ6lIfsuChTtcrbpvkonGHnr-hAUM,57501 +spacy/lang/id/examples.py,sha256=1IYi9-JDkwPoeN5BSIQfE4y8RC5kunBIR5mA7zeRI0I,742 +spacy/lang/id/lex_attrs.py,sha256=d-2icoWp4ffuiuOdxDa7aJCM5jru-SUzENGOdwi9g6s,1342 +spacy/lang/id/punctuation.py,sha256=GVwgYsGVMvCff1nSYa7Fdyl6dIQxaZdc_CY0uza0ZUk,2198 +spacy/lang/id/stop_words.py,sha256=rfrNIC1F8G3KnF1PUUVgpEBKROsIQd1Ynd1ArMiRoFg,6625 +spacy/lang/id/syntax_iterators.py,sha256=5D0d-ztAAd-U6nWEY6fpSyknIRXOemHYUAfZkWLQQSs,1579 +spacy/lang/id/tokenizer_exceptions.py,sha256=ahoJdBtFEwqNQ9_lYc4hiiXd-y2HQwwSwIv_8jk5x1k,4424 +spacy/lang/is/__init__.py,sha256=cfZ9upWQeDmuv1qwJ4EyCuA1aeZTvMKI5nZmoLkKWLk,269 +spacy/lang/is/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/is/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/is/stop_words.py,sha256=EXvUI9qz7EXQvuATHfJDD9oF6oM4_exf1Uyv9hAvAx8,1177 +spacy/lang/it/__init__.py,sha256=Al3e3lbPigjHnnaGGMxYYKc8f2pYNSJc_hXAYVr6Oa0,1280 +spacy/lang/it/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/it/__pycache__/examples.cpython-312.pyc,, +spacy/lang/it/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/it/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/it/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/it/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/it/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/it/examples.py,sha256=SbFNhKFnO1P5xAo462wFva-MYg-dywUR_r8V0fEgUVk,483 +spacy/lang/it/lemmatizer.py,sha256=SZUX2cDKTJpiJ4j2eqpsE1IJWAXUWUlVVNchdwwcx-E,4747 +spacy/lang/it/punctuation.py,sha256=AM0PrKWZzSH7bjm4-8MPF0Zkc0kHBb-vkEEo6utzxgk,887 +spacy/lang/it/stop_words.py,sha256=agTiYrl4t-8vHlleZOjdFstYZD2HdQWtKoar7iMpKsY,4197 +spacy/lang/it/syntax_iterators.py,sha256=nAO4AabPE2gOZDNzydkTs6y5VQCbjkyQkeZ36a-e470,3223 +spacy/lang/it/tokenizer_exceptions.py,sha256=8SjeV9lapozI9Tiof7hv4-EbspX1RuU2NCCayevHQnQ,1224 +spacy/lang/ja/__init__.py,sha256=dwzk6_xweOIjt0M5BnyYrFt7zr5_pzAMcnWvIAJOvuk,12921 +spacy/lang/ja/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ja/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ja/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ja/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/ja/__pycache__/tag_bigram_map.cpython-312.pyc,, +spacy/lang/ja/__pycache__/tag_map.cpython-312.pyc,, +spacy/lang/ja/__pycache__/tag_orth_map.cpython-312.pyc,, +spacy/lang/ja/examples.py,sha256=DSofUI7o9QBsA6kdXPl8MtAuPHdZbiYbOKM92lN-fag,511 +spacy/lang/ja/stop_words.py,sha256=L0DZgqvjvTpJYq2f0Wrkue5423i6gEqxJJnUNmMUhIA,1376 +spacy/lang/ja/syntax_iterators.py,sha256=XkJYj6jtixAshjsE5jO4IeApes5YFgaGW_J-bajEdWg,1679 +spacy/lang/ja/tag_bigram_map.py,sha256=vurQQpZV__0ZMuMnkgpXUHULzJ3AaX6NSPdi0P0-2OM,1675 +spacy/lang/ja/tag_map.py,sha256=QDMPMtHw8gsKeXDdRkS5WPDhuGa7yVs_mciG17WuIyQ,3912 +spacy/lang/ja/tag_orth_map.py,sha256=XHc6dKfvs4-s3CO6-fgxobsBjosIxpc1WKGITqPTo-4,568 +spacy/lang/kmr/__init__.py,sha256=MT9AfGfA_NjE_mb1U1Opp5tYdyBWhh02oOCPuYcBXF8,334 +spacy/lang/kmr/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/kmr/__pycache__/examples.cpython-312.pyc,, +spacy/lang/kmr/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/kmr/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/kmr/examples.py,sha256=ZhjCwSaF9PFH05wx_noV8vx2hn5ndJQjAK6XhWAQSI0,1343 +spacy/lang/kmr/lex_attrs.py,sha256=IyLaEtgAIB7cpBLKfJFrf9JkElPNmyVzaL5EBpMPNps,2466 +spacy/lang/kmr/stop_words.py,sha256=-nmq6FG7YuU7z-EdG6NVY6EfberWhvqN7z2ZAYYCxc0,247 +spacy/lang/kn/__init__.py,sha256=p81cc359bwddtx3KtP54U1KLnxk9Bl9IFbllhihsIx0,261 +spacy/lang/kn/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/kn/__pycache__/examples.cpython-312.pyc,, +spacy/lang/kn/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/kn/examples.py,sha256=VpOf1-UeYopH33GRlWSQJecYTXNcoOmB0XifVxUL3Rg,1227 +spacy/lang/kn/stop_words.py,sha256=heqqOvegkHUVuMyhfFdbvW9MXHoOmIjy42XE9JK-WtU,1339 +spacy/lang/ko/__init__.py,sha256=W1AUICsEsbnwZrY_GqqzqB6ONwDvmK6J3TtwlmeARVI,4376 +spacy/lang/ko/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ko/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ko/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ko/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/ko/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ko/__pycache__/tag_map.cpython-312.pyc,, +spacy/lang/ko/examples.py,sha256=e7Hfr5AklFlXqV5Xgv9O11L9Si6y1KWllSuuVkm5tPc,544 +spacy/lang/ko/lex_attrs.py,sha256=X-JI3uS3PtYO66iYKdlPOyBf_OPk1jPre54z0QPBHUU,1114 +spacy/lang/ko/punctuation.py,sha256=4wG2SL8ViJtm35owSqwEv6YVclja1kEhhQH46y0GPtU,278 +spacy/lang/ko/stop_words.py,sha256=mj55PmpDCzfFKD0S-aPWhfslUH676mngevUgGLq0N7M,416 +spacy/lang/ko/tag_map.py,sha256=fQZ_Xp18WgERCAUhwEE66d8xuiyVNZk0yyzNMn6itf0,2047 +spacy/lang/ky/__init__.py,sha256=OpNhmrHVctubgZy041HXHQ4DpSi0CAjDn1SiNgtQsCI,507 +spacy/lang/ky/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ky/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ky/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ky/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/ky/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ky/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/ky/examples.py,sha256=Y0DLLQAJqFbw6kLhweF4BDsGUb9jh2e1Hk_1gTiustE,933 +spacy/lang/ky/lex_attrs.py,sha256=dQQcKGMrbmyXHzr0TW3_ZhP_ded2ioeHliZjdXM4Qy4,973 +spacy/lang/ky/punctuation.py,sha256=q1Z2KfirrbBeAY-BpcVn72P57Rh6qPAdgrQe5iBSItI,883 +spacy/lang/ky/stop_words.py,sha256=CbB8f1CS366hu5FBbbbiCX6FB9ZDcNgzl58chZnUB9Q,1106 +spacy/lang/ky/tokenizer_exceptions.py,sha256=do8egs4S9LNjrdshDS4X8mGvv6ArjN3AlyiIB6-is7E,2102 +spacy/lang/la/__init__.py,sha256=Vp4bZPF-BHV3hf8lOl921BMc3rtyFBrm8Uf-y79s0qQ,515 +spacy/lang/la/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/la/__pycache__/examples.cpython-312.pyc,, +spacy/lang/la/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/la/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/la/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/la/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/la/examples.py,sha256=nXvyD4f-jT40lgIMAgAEhsHBwJn67g5oArqJDZRiKp0,1168 +spacy/lang/la/lex_attrs.py,sha256=OlnCNhrr7xJwNTIgYfd3AXLeXjyaqPH9wxDOBRIN7aM,2406 +spacy/lang/la/stop_words.py,sha256=A94nMEoHTw1GyF1ushvyqFtmeDlESEHD-bEAU5pN9cQ,656 +spacy/lang/la/syntax_iterators.py,sha256=yfWnxbN0glh6OuRsvfkkpD04L7QCeroCcORXDGAK1oc,2478 +spacy/lang/la/tokenizer_exceptions.py,sha256=UtNEC4qY7zadbJINGrkDj3PCNzLTYkgvYb9emGReTuo,1260 +spacy/lang/lb/__init__.py,sha256=Jz1cLNmPIXTZEOS5f9RoJHFbUqZUyuoT7-8cEvAWjTA,535 +spacy/lang/lb/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/lb/__pycache__/examples.cpython-312.pyc,, +spacy/lang/lb/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/lb/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/lb/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/lb/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/lb/examples.py,sha256=px80hXqUPVv0tJlsDQSJYmcVMm_6kdmvhM4qUrFIlqQ,921 +spacy/lang/lb/lex_attrs.py,sha256=BSBWdP8QQ7Ajpgeti6860Jvmhag_c-izRpI6gUGGpkw,1382 +spacy/lang/lb/punctuation.py,sha256=q_wiWEeUVM7Rcq9G6X8_4RJGr79bO-kdQwux2x7qIz4,662 +spacy/lang/lb/stop_words.py,sha256=DTkY6Pgb1XjDv3bD1jG2eIkYvjygM6cTLr5j2SW10Eo,1338 +spacy/lang/lb/tokenizer_exceptions.py,sha256=6QtK7topcWdheHh1UltLg7wvvs3-2woMVMnbtZwbfCQ,1219 +spacy/lang/lex_attrs.py,sha256=Xm6KqUE55c6pdLTl-uE8h8bolLLVXO4JWJcHIVeJwlE,6156 +spacy/lang/lg/__init__.py,sha256=FsjecflXNUSZNXJrP6yvdUlaRNASOJpxqNdSP1QU0-w,406 +spacy/lang/lg/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/lg/__pycache__/examples.cpython-312.pyc,, +spacy/lang/lg/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/lg/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/lg/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/lg/examples.py,sha256=RcpWEuFjI9XmZktNs2YenN0WBhyUHRc6pXqd4yz1hTg,539 +spacy/lang/lg/lex_attrs.py,sha256=OndRpwzBfwbOr6IY-IAjEU6LAMkfRvJvNbSVjpkt6No,2775 +spacy/lang/lg/punctuation.py,sha256=NE246fA9_BmJyArRIROb48Z02x03wk2m1gmuHYbqlz0,602 +spacy/lang/lg/stop_words.py,sha256=0zdX5GzLJQGOHHGlWetYbeyEaJfTTsZaWh07MvOkSoY,1380 +spacy/lang/lij/__init__.py,sha256=PEM-ORQXvoGdDrcm0wQNHclZfCOryjtOeYfK6BmtqZw,448 +spacy/lang/lij/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/lij/__pycache__/examples.cpython-312.pyc,, +spacy/lang/lij/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/lij/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/lij/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/lij/examples.py,sha256=2SV6VLKp09IdPT0Yl-NWEItcQUq3GUAGOTzl_Fyxmrg,409 +spacy/lang/lij/punctuation.py,sha256=af8T0EMchBXzX53ecfwPF1yiRkAdnw3_hMulZ0xTgdM,280 +spacy/lang/lij/stop_words.py,sha256=_8_wvIcuk3uWBBvxQsKKt5LLo3A5tvFloH_aM9z0ykk,892 +spacy/lang/lij/tokenizer_exceptions.py,sha256=oT-gZFJ7y2HQaDit4ftUQsCkPndhgDaKwTFlkN8SDWY,919 +spacy/lang/lt/__init__.py,sha256=d7BdjqldDUSE3k747BjW5Dl6LK-gQ0oBdCD_ta1C1aU,578 +spacy/lang/lt/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/lt/__pycache__/examples.cpython-312.pyc,, +spacy/lang/lt/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/lt/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/lt/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/lt/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/lt/examples.py,sha256=BvoRy-PN0PpA8o2x8uqPTLFCoOCHgNS3qj296Ds0-oI,618 +spacy/lang/lt/lex_attrs.py,sha256=8gugw5vY22Owx1dsmmO-UYKClgo_5p70XoGIkbSMraQ,23614 +spacy/lang/lt/punctuation.py,sha256=eZ-4c6zdQldS1I6RFHl8jeZBP38XmM5UHfAOASintZE,727 +spacy/lang/lt/stop_words.py,sha256=QZAMwwPmw0LZRzen79mUA3C_8N3q16KmLSYeh-bLu74,21024 +spacy/lang/lt/tokenizer_exceptions.py,sha256=9FcSmPheEa2dAqgWtaAXROl3u8NeTFM4oJWHrogHRd4,396 +spacy/lang/lv/__init__.py,sha256=FZ3EzxzqP2Kr4U9jEGawZloMIcCtgxi73DSMeoKMCZI,261 +spacy/lang/lv/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/lv/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/lv/stop_words.py,sha256=RmsiFu7FpypSXR47ylxFqwphsD1v1KlDShcpgWByJY4,1252 +spacy/lang/mk/__init__.py,sha256=oNqkOmjzgdzkkvLZIJnzLhN38KHNRh85aAv9CjFUBoE,1568 +spacy/lang/mk/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/mk/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/mk/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/mk/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/mk/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/mk/lemmatizer.py,sha256=w6teXALJc-AXklYe2CDnKl99XJ3We_H31GmfnSPgotg,1776 +spacy/lang/mk/lex_attrs.py,sha256=QkW-7NK5tUwIQTL9HUYHTpFEJ5Czm52u9b2jrYb1Sc4,3606 +spacy/lang/mk/stop_words.py,sha256=uqaWWVWbohSY5cVBxpBkXkAb5I_Of1VDkOLdFQdhWpg,9921 +spacy/lang/mk/tokenizer_exceptions.py,sha256=u4R7dvVhA0JWhXpFLSoFCN-5S_7QwZT67QV6muwQ1WM,3669 +spacy/lang/ml/__init__.py,sha256=kpgAMvVKz1bOKKEcgXLYU4gAhqSWVO0dRvkfmx5-VZ4,337 +spacy/lang/ml/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ml/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ml/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ml/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ml/examples.py,sha256=nlBPxCFh5KfLiuMWgffIv7SWT_Iz9E_N_TQqdCGbYFs,1416 +spacy/lang/ml/lex_attrs.py,sha256=OyaWrDTfLdpg2W_BdI4YP_M7qr8TZhD8d8rFG-YlAho,2420 +spacy/lang/ml/stop_words.py,sha256=9qiBsIRcMYKSjoyd1rymt16ADnmncJ8CPH2jidkV9R8,197 +spacy/lang/mr/__init__.py,sha256=z-e7xbSE196tn4T365D8x7a4fv1QLV46WvWqNcdKNC4,261 +spacy/lang/mr/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/mr/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/mr/stop_words.py,sha256=FAmWTdp-CqIRshGvfke7l0bgSS2I5OOg28__hiDMvjw,2648 +spacy/lang/ms/__init__.py,sha256=TCgZcVTf7IPAKAe8F9KqgrIbo0vmcch3mhxK-pSKaq0,702 +spacy/lang/ms/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ms/__pycache__/_tokenizer_exceptions_list.cpython-312.pyc,, +spacy/lang/ms/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ms/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ms/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/ms/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ms/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/ms/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/ms/_tokenizer_exceptions_list.py,sha256=zxRzWOfMxGCod3g769ni6eS1bJrqA0GkzpxNWRNDNNE,29388 +spacy/lang/ms/examples.py,sha256=9hqE37akk1WdZti3it7GL3v4p4f7fyL1J0zItsj5XzY,695 +spacy/lang/ms/lex_attrs.py,sha256=jLrCLFpdl4MnWZ0hVbejWLQSVC9H3X9mMeDSPIduRes,1330 +spacy/lang/ms/punctuation.py,sha256=GX2G2VOBArn9WJe3Raxz7zh7KfxqtT5oV9BqMGpNMXY,2194 +spacy/lang/ms/stop_words.py,sha256=rfrNIC1F8G3KnF1PUUVgpEBKROsIQd1Ynd1ArMiRoFg,6625 +spacy/lang/ms/syntax_iterators.py,sha256=5D0d-ztAAd-U6nWEY6fpSyknIRXOemHYUAfZkWLQQSs,1579 +spacy/lang/ms/tokenizer_exceptions.py,sha256=QAAqcEcRBWIAE2DEIPoLU_KoXpwzoax5bWOkugt3QM8,20641 +spacy/lang/nb/__init__.py,sha256=5oGrVNSoUJhGYecM15IyW_AfxPzcL_Xyq5uM9SUrHmI,1325 +spacy/lang/nb/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/nb/__pycache__/examples.cpython-312.pyc,, +spacy/lang/nb/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/nb/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/nb/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/nb/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/nb/examples.py,sha256=G_O5BVGB_I0s0t96ZTvJxi7OzP5Dml1EDA_enkN-5fI,440 +spacy/lang/nb/punctuation.py,sha256=yFXBMTuERHTQZheCaea32CBPZTPf9e63_VNHnl2tLbk,1732 +spacy/lang/nb/stop_words.py,sha256=Yb_pOJAkxa466znM8-uaXhJywLY4ga_xqU2WHIeVofI,1210 +spacy/lang/nb/syntax_iterators.py,sha256=Wm5hYmwtISYSyQ5UfGlZgRVJ-hZ8DhMriuuuOlyRLGs,1562 +spacy/lang/nb/tokenizer_exceptions.py,sha256=MiAiKl-5eXHY3IWubGe5LU4Y4FluU9nHOoow-KbAoHU,3290 +spacy/lang/ne/__init__.py,sha256=lbkYEx2LOl87s96SCPg7IPaAxgAy2XEYd1SwTOhE8kQ,325 +spacy/lang/ne/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ne/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ne/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ne/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ne/examples.py,sha256=dOBAnlGS2YZRsZM9V4f5CpBmQI-luMNGTGZuUjnGvvY,1120 +spacy/lang/ne/lex_attrs.py,sha256=9a4F83z_LQktHUI8AjMbTwkQta4DFuflCypF3-Q2zBA,3369 +spacy/lang/ne/stop_words.py,sha256=SkKIXg7nHfUdK27DSnfnh0g2Ud9Ba_P6wMC96mjZJHo,7629 +spacy/lang/nl/__init__.py,sha256=2c97g1eIM6b_oN2HQXw7IW0co8ULFRtcbCmP5jPmWR0,1383 +spacy/lang/nl/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/nl/__pycache__/examples.cpython-312.pyc,, +spacy/lang/nl/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/nl/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/nl/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/nl/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/nl/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/nl/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/nl/examples.py,sha256=hZp9eXl1yKZDRo6K-8L9HGr2ZNw-SgCC1n6FwsO0E7I,453 +spacy/lang/nl/lemmatizer.py,sha256=V3ADssYt7NaB6HVh8qcaRvBNZ1Ryd3CH0nVQQuEnpuc,4740 +spacy/lang/nl/lex_attrs.py,sha256=gqeNRbvSWNffj26XAtML8cSJd9pe0CLikdz1P7ECGoU,1342 +spacy/lang/nl/punctuation.py,sha256=9Br77tJIBMWE-uswpw_axUFCCIL5eTbyecCeSA4Tbtk,1602 +spacy/lang/nl/stop_words.py,sha256=Rr2DXFE-WPYgm28fHXllZHGO2OboVDIIMmFCVparArA,3162 +spacy/lang/nl/syntax_iterators.py,sha256=2j6sua3CqeXwf3timdQFyI5eCMs5fRzkRpE43IrFndA,2943 +spacy/lang/nl/tokenizer_exceptions.py,sha256=qoLbeHMwUhRkA1rUVvOkoYCx-XhYAx-IdcB2LVjm8s4,25905 +spacy/lang/nn/__init__.py,sha256=L-LWr-KDaYUimw9VQ_N8Ukjry2ZDHqV_DZItkkGTOjc,600 +spacy/lang/nn/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/nn/__pycache__/examples.cpython-312.pyc,, +spacy/lang/nn/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/nn/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/nn/examples.py,sha256=Qtj6xnOxG25pk-vXAuEPLF5hOXWzVUnnrj098o_u5w8,688 +spacy/lang/nn/punctuation.py,sha256=lMF61rbtjOTY2TJxBxGiP2jn2z8od1om4OtTX8AJBd0,1870 +spacy/lang/nn/tokenizer_exceptions.py,sha256=UTN6KcbmCyUPygeEl686iMu0XZ4wHJqqwNXPjCoCTDI,3526 +spacy/lang/norm_exceptions.py,sha256=ZGmzDTcCexrANn_gPdEqNbLiceSDaHh4n39sm-Zt5y4,1484 +spacy/lang/pl/__init__.py,sha256=z408EdR-3_ejUPb7JlReIR4U8utnHp3T9mYvsRHv2vw,1413 +spacy/lang/pl/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/pl/__pycache__/examples.cpython-312.pyc,, +spacy/lang/pl/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/pl/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/pl/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/pl/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/pl/examples.py,sha256=7dAuIbY86XMOkFQIqGxi2e8BNvXg51rA3z3LTDKpZVY,699 +spacy/lang/pl/lemmatizer.py,sha256=RpIGwd3S0YxPR3Wc2RD3CTGcjZuXdO6cmOrbtCeZXLo,3652 +spacy/lang/pl/lex_attrs.py,sha256=w0O_LTajPz8-FT2EvPVoA8m-cN-Zdq14b6RkbjKv85w,1257 +spacy/lang/pl/punctuation.py,sha256=W5tYtS5_P4IoFHj-oTKOce30URpuIxEHqcjjV6Qtow0,1419 +spacy/lang/pl/stop_words.py,sha256=ZGtJuxZ7afMHQNRBay2ma7JVGGZh8xIzDGtXjRheQkc,2438 +spacy/lang/pt/__init__.py,sha256=2XMmHh87Bayn96ctKgC8aExi7zGRmnj0SjCYWZnLC0g,667 +spacy/lang/pt/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/pt/__pycache__/examples.cpython-312.pyc,, +spacy/lang/pt/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/pt/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/pt/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/pt/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/pt/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/pt/examples.py,sha256=pzwCu636N8Lh1kslekZDxplBFGaXxd0zHQb1uMcJ-2g,484 +spacy/lang/pt/lex_attrs.py,sha256=1TkW3mhEsWvLXqDwBaZP4v4eHzu9OQXIhJo7IOWd6S0,2155 +spacy/lang/pt/punctuation.py,sha256=ca_tUv2yVr1Cm3qp4gm79TJ6N2CzSXGD0Y104SGDPF4,469 +spacy/lang/pt/stop_words.py,sha256=NhbgY6eIlAvV4GOXf5fQVd9qnD-lxUJyVj9_v_BVrc0,2632 +spacy/lang/pt/syntax_iterators.py,sha256=01-Hiyb3tIGHnYvOENaP4hzZDz3XDrzvk895DlLwaGo,3173 +spacy/lang/pt/tokenizer_exceptions.py,sha256=AHnPW3f-wCm-_6HQgckkmy6fij6iYgaHiKO9tP6g3yo,769 +spacy/lang/punctuation.py,sha256=q6Pf4A04k4jfZu5fPjJtvGSbx9o-tmx5Am5K-3DnT0Y,2280 +spacy/lang/ro/__init__.py,sha256=v7o-bF7JD89VuaQFSt7MHSt6u-mAd1P4b08xZUPAegs,804 +spacy/lang/ro/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ro/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ro/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ro/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/ro/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ro/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/ro/examples.py,sha256=4zNuKaCGPHSL0IpRAgUKVK4GoLnN-Y6B9GFNlghF-fo,618 +spacy/lang/ro/lex_attrs.py,sha256=HAQbaFkzgODqDv9qplSVSNw-tsNIeAkCl-RgSowrEWY,1721 +spacy/lang/ro/punctuation.py,sha256=lON9hgOw8uZVYYQy8d3PdgALyPfisu2m3kQXPakUKB4,3324 +spacy/lang/ro/stop_words.py,sha256=3w-5tCaUQrO0eK9XUFdaltPKiOHQ5aPGneaxnCh5vWs,3444 +spacy/lang/ro/tokenizer_exceptions.py,sha256=lEN2sB7mizKXWuucjlp4IEzlPfYmwCisQXIAADECcew,1555 +spacy/lang/ru/__init__.py,sha256=cmCapNclWOYxPTivfpclQslkmuZZd2rLzWQ5hxYqqTg,1359 +spacy/lang/ru/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ru/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ru/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/ru/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ru/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ru/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/ru/examples.py,sha256=kRGucaWuuhK-A95A7g3oXTRhD_OSNk_sUTSiH-TWaMs,4619 +spacy/lang/ru/lemmatizer.py,sha256=xCzNgNWPN58CLvtLDgTAb55YLlHkx_hhahPYrEilIog,8192 +spacy/lang/ru/lex_attrs.py,sha256=LAW69sFQ7288wxh0pXgJ0VWLlUoT7xYhxZXoMLjq704,18961 +spacy/lang/ru/stop_words.py,sha256=TIDDXCUlHrownYkmreNwqjibo_FU5PNBj8UaTUPHEOY,8467 +spacy/lang/ru/tokenizer_exceptions.py,sha256=ujM5m2Pkb0UzHiMgE-J7jK1sEe1R3UR4fzcvAYagWkE,25801 +spacy/lang/sa/__init__.py,sha256=_YExAAxTwDKsOsy6DS7JDDHaLDheMMePX7Yo987q82o,333 +spacy/lang/sa/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/sa/__pycache__/examples.cpython-312.pyc,, +spacy/lang/sa/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/sa/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/sa/examples.py,sha256=EVQcEGIcq-cIFC5wo5m1pvqHl_YuQw0mNrZ2m_WfhgQ,794 +spacy/lang/sa/lex_attrs.py,sha256=BzQaYB4SxLYAvfifQIMUzZ9ojcjgx2ox_1nCiZvcE1U,4338 +spacy/lang/sa/stop_words.py,sha256=PSmEfRkQRzIcqKAWTr5q-s5oO-q8E1cYr6tFeXF6OJw,9879 +spacy/lang/si/__init__.py,sha256=HaN2UDXgp-c1FDCdrWeIpyZVPQbAzj7VSWF6NDctjq0,329 +spacy/lang/si/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/si/__pycache__/examples.cpython-312.pyc,, +spacy/lang/si/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/si/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/si/examples.py,sha256=MSXiSRzpuGXBfvYN0GlbYO1Rjgr0DofC8yEeaebOjl4,961 +spacy/lang/si/lex_attrs.py,sha256=Ch9E4iWCc78Vwxzc6b6hex1JziLww9mPg8Su_yLgJeA,1314 +spacy/lang/si/stop_words.py,sha256=Bo1UgDYSSCJDGckpMCfD4kqAwp_28_43obV0hmSXxB4,2602 +spacy/lang/sk/__init__.py,sha256=oczD9sUK4R9vniQBQGo5suyvkT4qg3NXDDPxFUt9asc,325 +spacy/lang/sk/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/sk/__pycache__/examples.cpython-312.pyc,, +spacy/lang/sk/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/sk/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/sk/examples.py,sha256=rt1RXBZqA2-AtLzwlbERH9sHHjgUFTlJoYH8IFU4i0o,750 +spacy/lang/sk/lex_attrs.py,sha256=LPiqigDoWakm-d9p4t10lB4o9Rsjie1WQMXk6RaYYxs,1129 +spacy/lang/sk/stop_words.py,sha256=9M1izuYTadYb1Z39RBKlseL4PS_SYGqTZaRwsHXLgQk,3063 +spacy/lang/sl/__init__.py,sha256=HS07jBx8-872xHyUhoSXVU2ywaC16cqlinVfna6mmqg,629 +spacy/lang/sl/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/sl/__pycache__/examples.cpython-312.pyc,, +spacy/lang/sl/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/sl/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/sl/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/sl/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/sl/examples.py,sha256=nBR8LNbPWoijuIIawpF4K103jahLFpUmb1qL1gBADeE,591 +spacy/lang/sl/lex_attrs.py,sha256=Ni6UbOcQAM1lvr7KRPq1x7Xgdcb64D0rKu4DXmj-RAI,6727 +spacy/lang/sl/punctuation.py,sha256=KD-xVp-d98SYBdjhgbFajO_KyGkUiRGjgUxm0AwZvEE,3307 +spacy/lang/sl/stop_words.py,sha256=vn_Gc9OjH_bP7GKsDavkzKf-9XlPyparLG7W7LFBzds,2562 +spacy/lang/sl/tokenizer_exceptions.py,sha256=cXzDT3Li7D8HCXNWRutkym8lD4WgFVPIENrY4TXJLgY,13702 +spacy/lang/sq/__init__.py,sha256=PFIpV9bONWHQ3DlQbeMORvm3y3HmYO3VFjvmxgcW9R0,265 +spacy/lang/sq/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/sq/__pycache__/examples.cpython-312.pyc,, +spacy/lang/sq/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/sq/examples.py,sha256=6nF1q50AtOw2VGBZxm_FMDSbNfZVyMYuVrDJFcifY2c,479 +spacy/lang/sq/stop_words.py,sha256=Z9BeFjdiCeh54CCVQy5gmUUqnc-3929YnRvBm3DkLUM,1439 +spacy/lang/sr/__init__.py,sha256=DrDdWxVm2stHMjl7EJpZ4XNce22L3ZIM9fi4SA9WXvQ,566 +spacy/lang/sr/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/sr/__pycache__/examples.cpython-312.pyc,, +spacy/lang/sr/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/sr/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/sr/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/sr/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/sr/examples.py,sha256=iDdOWi-onaNa1SWHuvZ_T3UDeQhfFchzuLd2cINa0kA,929 +spacy/lang/sr/lemma_lookup_licence.txt,sha256=grEvnqf2QM4EdMoQEtglVRz73zHXSBLUw-l8QLEKnIM,1580 +spacy/lang/sr/lex_attrs.py,sha256=ljFq70IR0q9HHEy-IOAaI3jQa24Rtb-RKWo4VPBcKTA,1490 +spacy/lang/sr/punctuation.py,sha256=70XWsDuMM-AehakXKVQ5Hyiakjuo-Di-ChXD3ORIGsE,1005 +spacy/lang/sr/stop_words.py,sha256=NZA6m9NUrzF2VdnFB4rPG8Yw8qB6a0XfbdnwFCnumNc,4288 +spacy/lang/sr/tokenizer_exceptions.py,sha256=7MsxoarRrse7XR8Dl8fbM4EsZyhXtc1TZOr7Z8KuecA,3615 +spacy/lang/sv/__init__.py,sha256=DT5-GrVNWwLCvqr22FkEsLfT5GZgwuAgOiVhROOIBJ4,1328 +spacy/lang/sv/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/sv/__pycache__/examples.cpython-312.pyc,, +spacy/lang/sv/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/sv/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/sv/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/sv/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/sv/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/sv/examples.py,sha256=07E94wuHAhKwEMZXD0lCH9mABTJ1cIEnThe4hkPh21w,453 +spacy/lang/sv/lex_attrs.py,sha256=MSSexewzxkxNmxh5dqwHEKM89rR9ImoMD76Q3sa5F-w,1011 +spacy/lang/sv/punctuation.py,sha256=AION2JV62SMGcPbSUmFOpZJVW89Bx0cG4aD8DFL_gsA,1063 +spacy/lang/sv/stop_words.py,sha256=vOxCdNYwB3_yQ1J6qJ8fvg2ujTZy-VhO0rNhauybPs8,2611 +spacy/lang/sv/syntax_iterators.py,sha256=ovVWW2bhM1vCDS-8GfBofuyPcdILMggMfRGbNp5yUC4,1570 +spacy/lang/sv/tokenizer_exceptions.py,sha256=Px0xExIIAg3xA0UZ39o0RenNfaxpwtuSb5CP6bClzg0,3811 +spacy/lang/ta/__init__.py,sha256=0PWfqEBJhMN9ereNtU3FWRs3J9RXpKRF103CoRjZtpg,321 +spacy/lang/ta/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ta/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ta/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ta/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ta/examples.py,sha256=UCa5HmlR38j8eePAj02sx1B-Wk3--hvkPBKmvBrYhiU,2725 +spacy/lang/ta/lex_attrs.py,sha256=E4naC6T33158evappxumYcX8RvxxZNOz4prP4z6k9Q8,2367 +spacy/lang/ta/stop_words.py,sha256=O7cCwUSk8gvCjm3vc8AJTt6SyqNLFs3luBhGLGOZDAA,2149 +spacy/lang/te/__init__.py,sha256=nP2EewTJFotZXPYbJrZx9HssMvoh4WuNuGs1bXDzYtQ,325 +spacy/lang/te/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/te/__pycache__/examples.cpython-312.pyc,, +spacy/lang/te/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/te/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/te/examples.py,sha256=LsGJJz0MFmPQh4i99R4k81yuWW8M_yy4OX59zrieoy0,1261 +spacy/lang/te/lex_attrs.py,sha256=LLGx2EJqiJZ4XO-5n9yUcN7J61FPb7d9sEHMgConWhs,1317 +spacy/lang/te/stop_words.py,sha256=grEG5XgO80PZfB2FbU4_qOSq3TgH035FWVa7t-Q5MMo,1163 +spacy/lang/th/__init__.py,sha256=gXGqQIMX0QS787ELlsGKETa3kX8SgjfjADMAjcXgReQ,1376 +spacy/lang/th/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/th/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/th/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/th/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/th/lex_attrs.py,sha256=JaZY68UOc6tvERNsdA1lRDJftBQEo4CcSO2KUCMA9OU,1535 +spacy/lang/th/stop_words.py,sha256=XDPxX727hZFYO_cag1bE2IJ5tvkxkC7saFViCCLwR-k,19538 +spacy/lang/th/tokenizer_exceptions.py,sha256=b3fQsGZip7ydkh-_ftCNKgMOf83X9GtJsIjFNYTcoIQ,18771 +spacy/lang/ti/__init__.py,sha256=wtJWKW05oxoQFewmqUgnworJQ_DA_OdYzRFIAqJlkg8,860 +spacy/lang/ti/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ti/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ti/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ti/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/ti/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ti/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/ti/examples.py,sha256=a972b8VElFfvu4mSpxQZ1RgtAtpYzW-NfUhEqms3qYo,837 +spacy/lang/ti/lex_attrs.py,sha256=GprYGv-NZ-KWX-oypdySINOjSauyPp25x_7sZOOsS6M,1581 +spacy/lang/ti/punctuation.py,sha256=ATe5MajFhkSOLjmpFLpdMqiwF-p_QVY_Dl94BPXqCrs,573 +spacy/lang/ti/stop_words.py,sha256=2fH5we0_yrBpueRhnLt3IZl1bDzRUk7jC5k0fKlhu2Y,2004 +spacy/lang/ti/tokenizer_exceptions.py,sha256=siasLF-3vHTe-v7Aqor2bv-VacqsE4yTwxjoxHKVN6c,359 +spacy/lang/tl/__init__.py,sha256=z4GFjq-KXjHkgHGjzjeHVFRrdx-6LLVkDHGVVloYmhQ,434 +spacy/lang/tl/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/tl/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/tl/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/tl/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/tl/lex_attrs.py,sha256=ZuSmrqEBR9L9PVgjtqyTD98XS4nzEzI48pcgXB-ALcE,998 +spacy/lang/tl/stop_words.py,sha256=eLIUpFYpthu0IldXrxOFESniG6nqVARKX4BD9-CC-L8,1116 +spacy/lang/tl/tokenizer_exceptions.py,sha256=BN5g_ZDDGPfi0GQdogKWWHtX4zEViSFWvmDMgz5UqwU,705 +spacy/lang/tn/__init__.py,sha256=9Fnm-0jA8u323E2hLDrM6elQQ9LCOQXuEag5NLOGS5A,410 +spacy/lang/tn/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/tn/__pycache__/examples.cpython-312.pyc,, +spacy/lang/tn/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/tn/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/tn/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/tn/examples.py,sha256=SpLNrUvFsjUum1G1L5Dg7UW2CHY6sgiUaigN097QZfE,434 +spacy/lang/tn/lex_attrs.py,sha256=ZJL_Z6SYUDGtNOLa1qGMdPO0bNRhkvZZGgnkFb9_KCA,2050 +spacy/lang/tn/punctuation.py,sha256=NE246fA9_BmJyArRIROb48Z02x03wk2m1gmuHYbqlz0,602 +spacy/lang/tn/stop_words.py,sha256=WEOgc_FnSf52V-mdMooCOPyjahEzvD1zHYZHUMytBmM,816 +spacy/lang/tokenizer_exceptions.py,sha256=pkbY095NvhQz8_O4EvYzlWUXciZ2t0JPy__GwOA-_8s,3732 +spacy/lang/tr/__init__.py,sha256=Riu35GNXV0Dh5BlyCrFncp3TLNGhxRc3i-jpPBOFHU0,567 +spacy/lang/tr/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/tr/__pycache__/examples.cpython-312.pyc,, +spacy/lang/tr/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/tr/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/tr/__pycache__/syntax_iterators.cpython-312.pyc,, +spacy/lang/tr/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/tr/examples.py,sha256=bGQaf0StSyg0AfGgWLzSRUlrMHvoXFwUzOyFg2ZvVJY,746 +spacy/lang/tr/lex_attrs.py,sha256=WERxbqEXl7w1s3_18igBdeK_1W3Eia5QIDAP_kSq-tM,1761 +spacy/lang/tr/stop_words.py,sha256=eva9AuhPLrVI3BLdu7faLSY34BXpQequHsbmsTLwciI,5063 +spacy/lang/tr/syntax_iterators.py,sha256=JKRi0mc1Er0SI7jDwz0dbgt5OnUA9XY1apUR9Gw21oI,1912 +spacy/lang/tr/tokenizer_exceptions.py,sha256=n9-Eq3K6gUyXByrEqSwGT5O1CQRTpZ3c3sA5I0d46rU,6281 +spacy/lang/tt/__init__.py,sha256=dre2skBSPx72WSyPRtRuL406iJPJKJdX3VCs22T7ybk,503 +spacy/lang/tt/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/tt/__pycache__/examples.cpython-312.pyc,, +spacy/lang/tt/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/tt/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/tt/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/tt/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/tt/examples.py,sha256=1pvKNtPIFow7_mayaj4cHqtyP5EWbVb_y13YTA21DxI,913 +spacy/lang/tt/lex_attrs.py,sha256=48lx_3n_hdRppHJXtzO0h7OBkBgVTSkY-r6Q-aLR8ok,1175 +spacy/lang/tt/punctuation.py,sha256=vGauR4NckQ3uDw8GAHSmpfohLVARO0pZyS2a8N-b63w,833 +spacy/lang/tt/stop_words.py,sha256=8ORDfQ8g48stMfO-qGlL3DtBCYZIaZqMLTq17P5ElgI,18740 +spacy/lang/tt/tokenizer_exceptions.py,sha256=MSx8M6k-93YIdUqbFUFcOL-6Sl1mPujgIc3hthf7LAI,1807 +spacy/lang/uk/__init__.py,sha256=Z1a6M_oVmmv1TmSEdLmqqNHXIMOjqpubP2liYqfx_9M,1373 +spacy/lang/uk/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/uk/__pycache__/examples.cpython-312.pyc,, +spacy/lang/uk/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/lang/uk/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/uk/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/uk/__pycache__/tokenizer_exceptions.cpython-312.pyc,, +spacy/lang/uk/examples.py,sha256=bZvW4lDbcXqjXMaOIpxueODJ5HKOeHb2E5gzUdMYJYI,1815 +spacy/lang/uk/lemmatizer.py,sha256=vL5AwUTzIQm1lws1HiYbujzw7EP0an1QpI9BtEddqnQ,1761 +spacy/lang/uk/lex_attrs.py,sha256=zsyQYi3usR5wtpF41c5NLHD0SaP5oJrIwNXy9LYhotM,1645 +spacy/lang/uk/stop_words.py,sha256=U7hOjkC10YeEL3osa5W9z6RbfFAeVy2XWKJh9Qsa4vA,5356 +spacy/lang/uk/tokenizer_exceptions.py,sha256=Hou3HOE6oQsbiujWGOBuBN6f-O8H7tJ0If5C-bnynz0,1424 +spacy/lang/ur/__init__.py,sha256=EKYul3PYLUf_LLpQqGb-teqZXZIYWCb2FM206hT_KnY,480 +spacy/lang/ur/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/ur/__pycache__/examples.cpython-312.pyc,, +spacy/lang/ur/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/ur/__pycache__/punctuation.cpython-312.pyc,, +spacy/lang/ur/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/ur/examples.py,sha256=jFTGaMLwJwxbqKiVShHRFvI-qpJSPq8AhFsR1nYPqTo,313 +spacy/lang/ur/lex_attrs.py,sha256=MI4PQL6PG3DlouJQBVXB0i28lzd7coZhBUTY9gU-VEg,2282 +spacy/lang/ur/punctuation.py,sha256=HWXmxBKR0LsoS0kq01YNYulgzl1MR5aXqRFzc_SPEZc,80 +spacy/lang/ur/stop_words.py,sha256=pf7hT7MY-5R_ZzN1hgDwqU08nKPfQa47Ia6asVsPMAU,5235 +spacy/lang/vi/__init__.py,sha256=oGNd0mCF_87Bac0oq4jVX9xnh7EEdBcxBdVTQvG_F4o,5689 +spacy/lang/vi/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/vi/__pycache__/examples.cpython-312.pyc,, +spacy/lang/vi/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/vi/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/vi/examples.py,sha256=bU-8BxG31rvcsYu4tI0Fcky7cqqq9nXYrXLwHevD2ho,784 +spacy/lang/vi/lex_attrs.py,sha256=lMnlLWodJHUHXbp8Qu2SFUObMn5Aandh0zSBpr8Fk0g,1441 +spacy/lang/vi/stop_words.py,sha256=QgL_H7UlMX8MnHrg4nmo80_Z21gx4Cl1P8cuhFs7N3E,22544 +spacy/lang/xx/__init__.py,sha256=V2Ww_qAgVKPIn-zlyj-HY7piYNCOM5cShDFGAXoe1Sg,278 +spacy/lang/xx/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/xx/__pycache__/examples.cpython-312.pyc,, +spacy/lang/xx/examples.py,sha256=n3SJglw4nCNj-lmqNcbtxAxL8lSXzBuTOZpDLIi2dRU,8256 +spacy/lang/yo/__init__.py,sha256=mmnw_yF8Olfip_B7Y6TQFQcTzO37rhYG04Xj1EtWoJw,325 +spacy/lang/yo/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/yo/__pycache__/examples.cpython-312.pyc,, +spacy/lang/yo/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/yo/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/yo/examples.py,sha256=Vm6fSr-ZQHA_IO2vdiFZ6s-QYK6Q2AH_m5ufYGfudSw,1291 +spacy/lang/yo/lex_attrs.py,sha256=v2Y-b-mp2dpG6rbUo4jLDboujSR2ucHrF4pRixJPT0c,2633 +spacy/lang/yo/stop_words.py,sha256=c81W0td_RiCY231omW4l4wHsXhDYSlNE19BdTMkRl8I,617 +spacy/lang/zh/__init__.py,sha256=qxcauXzomN96OFlDhh2J4-qTzTqorND_tFnovGLLNmE,13024 +spacy/lang/zh/__pycache__/__init__.cpython-312.pyc,, +spacy/lang/zh/__pycache__/examples.cpython-312.pyc,, +spacy/lang/zh/__pycache__/lex_attrs.cpython-312.pyc,, +spacy/lang/zh/__pycache__/stop_words.cpython-312.pyc,, +spacy/lang/zh/examples.py,sha256=nWohZaaGZ6IP2PNCi2bI48gzkdBMfQJmY3animjlLp0,808 +spacy/lang/zh/lex_attrs.py,sha256=brPQtpEFdBRXB-rAZrUw2dkehgui4pe4ZbJ3ZNWhnBo,1709 +spacy/lang/zh/stop_words.py,sha256=hjVdk_pF5Xg3jiy9talatR0ofMhk_uATcGO_uWeQ064,15308 +spacy/language.py,sha256=SuOnoZ1KA8sGB4MJxdQt0_YsdlabTztuURFoH5fzoNE,109252 +spacy/lexeme.cp312-win_amd64.pyd,sha256=LC5bL5Cg5abfCtHKTLF7EYHJUVzlEq8f6Leo9AZ7xv8,108544 +spacy/lexeme.cpp,sha256=me1p4e3DD_eFUdpAXxmi-X7y8PP2hcg7XiZIp5gR_ww,997486 +spacy/lexeme.pxd,sha256=70G_8aPNsdzLpTvuOHhvQcZkrJCsn94R9zScX_Hk42c,2780 +spacy/lexeme.pyi,sha256=xTW6bXIzSAYqxPUCqcsYkKRXE8Y2coKdf6O8WcPmwFA,1496 +spacy/lexeme.pyx,sha256=xpkdeB1IC-7dMRqkSjEUlNuQQAEKZTVlAoLq7gbcbks,17212 +spacy/lookups.py,sha256=deNe8xXxlKH96QdkyLeSAbRE4CnHEdJYJVY2n6oP-s4,11165 +spacy/matcher/__init__.py,sha256=kIb1D2M_eTAUSQM6kHJHz8VaBZPp66SmkFhS0IzhrTU,238 +spacy/matcher/__pycache__/__init__.cpython-312.pyc,, +spacy/matcher/dependencymatcher.cp312-win_amd64.pyd,sha256=8Bp3-sOoxfv42hsWYA2uB0XIJvzvs97tXR5xoM299dM,250880 +spacy/matcher/dependencymatcher.cpp,sha256=_BQoaPuP-woPvS7IxyAjI4k5YwfYmVD4zD10zgx_404,2067855 +spacy/matcher/dependencymatcher.pyi,sha256=xXheTdNFywKBzVIjsDnXRgzcdoaMeR-haEVb_qLcPec,2176 +spacy/matcher/dependencymatcher.pyx,sha256=gEA2eI1mOC1x8u7STb8BXqv_hp_GY07KU1kNtnKULDM,18704 +spacy/matcher/levenshtein.c,sha256=k4H18jE6PSMvOW-C-iPCAkBllMXkcx8b9fpVShaUHGs,374552 +spacy/matcher/levenshtein.cp312-win_amd64.pyd,sha256=PctvATL5diw4NSgv7e0z_Jne4uckGSsS68Yyz9ICr_w,46080 +spacy/matcher/levenshtein.pyx,sha256=v-GPEETH5NKD4_5_D6i6RmG72zG86HKpoEBlEbeBVN4,933 +spacy/matcher/matcher.cp312-win_amd64.pyd,sha256=pSnwioIPFllPnmnmaBwUCCcqvyoLlJKXnuRiE24W02Q,370176 +spacy/matcher/matcher.cpp,sha256=x3YbA3BNS3F3rv26g6ZBQmrEYIUG0uEBcK7JMBSBlVw,2930099 +spacy/matcher/matcher.pxd,sha256=sTnu_05ZZtEQmKFcn6px1Ch9lBClHuJIe8_9s2QbnZM,1610 +spacy/matcher/matcher.pyi,sha256=cL3I2QAIa5pcBOGc8tPq3UwDLIaeOgwNJdvk09Y026E,1944 +spacy/matcher/matcher.pyx,sha256=EeVoiz_UDnyOjNzU1t3Ee0c8kKG04fBL9AkhWVC-U68,51491 +spacy/matcher/phrasematcher.cp312-win_amd64.pyd,sha256=z-L_6FtNfmTb4rTYMFCuUJdcxJ-ueyc0W7triJ-W-Os,190976 +spacy/matcher/phrasematcher.cpp,sha256=KevqtD4G_epG4j7w-GT9gJxbwunbRUTZAoMD68kLOL4,1707975 +spacy/matcher/phrasematcher.pxd,sha256=Rjk3z1OLS34Fs04kPxXlS368fo4QwaUULBej9GdbMDk,576 +spacy/matcher/phrasematcher.pyi,sha256=rOCTPV5ZwTo0y4JU9ts5NwohPsfxNs55djPGL8SdAAA,1083 +spacy/matcher/phrasematcher.pyx,sha256=oGV_SgN7mhV_-sLQVqO0mAkzafJBhNcedX9cJvY6mm4,14628 +spacy/matcher/polyleven.c,sha256=2Qn5qoQ4s7MopAg4UUKq-gQNL8RVse1Y1Ex3rxqmoSk,9955 +spacy/ml/__init__.py,sha256=NJlyIGLT19zxcigWJTCYjLOMvlVofpkyZbeNjVZ75r4,111 +spacy/ml/__pycache__/__init__.cpython-312.pyc,, +spacy/ml/__pycache__/_character_embed.cpython-312.pyc,, +spacy/ml/__pycache__/_precomputable_affine.cpython-312.pyc,, +spacy/ml/__pycache__/callbacks.cpython-312.pyc,, +spacy/ml/__pycache__/extract_ngrams.cpython-312.pyc,, +spacy/ml/__pycache__/extract_spans.cpython-312.pyc,, +spacy/ml/__pycache__/featureextractor.cpython-312.pyc,, +spacy/ml/__pycache__/staticvectors.cpython-312.pyc,, +spacy/ml/__pycache__/tb_framework.cpython-312.pyc,, +spacy/ml/_character_embed.py,sha256=GzPWy2F-ViTp9yONCm6Xn5bvZ6iVNnk1d_D6NNhYI78,2014 +spacy/ml/_precomputable_affine.py,sha256=AuWZUnUc7TnfiWELQXGQ0qhh2lrNchJDfesninksOM8,5948 +spacy/ml/callbacks.py,sha256=kUK5DMR0YY6aFmRbA0eWYVRDk57XaDETI3NmH7aVC6w,3789 +spacy/ml/extract_ngrams.py,sha256=MBdhIuiFyqKVQHKDcQ7w6aBUFldvYBBzuW309pS-JDw,1180 +spacy/ml/extract_spans.py,sha256=TdalDQmCeZ0PPs-2s1O4-Gh8LC1ks2zxsqX99jJWrLw,2327 +spacy/ml/featureextractor.py,sha256=6f3l8ci7utKIKVxK_05IoSVTQUfpOpPD8UO2OM6UObc,990 +spacy/ml/models/__init__.py,sha256=hiQA-_aMPpf3F5m2F8WArqARIZjg-M21tl-HfdIAdB8,267 +spacy/ml/models/__pycache__/__init__.cpython-312.pyc,, +spacy/ml/models/__pycache__/entity_linker.cpython-312.pyc,, +spacy/ml/models/__pycache__/multi_task.cpython-312.pyc,, +spacy/ml/models/__pycache__/parser.cpython-312.pyc,, +spacy/ml/models/__pycache__/span_finder.cpython-312.pyc,, +spacy/ml/models/__pycache__/spancat.cpython-312.pyc,, +spacy/ml/models/__pycache__/tagger.cpython-312.pyc,, +spacy/ml/models/__pycache__/textcat.cpython-312.pyc,, +spacy/ml/models/__pycache__/tok2vec.cpython-312.pyc,, +spacy/ml/models/entity_linker.py,sha256=BLy-icCKqEuB-ZK4IJjPLvk7HZZTvEr5Ig-s1q-wIrU,4167 +spacy/ml/models/multi_task.py,sha256=xT9ZJNfERQhr5nNfE9eLgBcRj7cV2pdQ-HlbDLeVc9Q,9434 +spacy/ml/models/parser.py,sha256=a9pmFKZ-aIiAs9mF4kMzG7-yv4cUvTuW0WXAhJv2KRs,7013 +spacy/ml/models/span_finder.py,sha256=pgL09e2XH2gdJFbxgJ7Or-0xlkMA7-ItcaCDZN8LRmI,1223 +spacy/ml/models/spancat.py,sha256=0JZ9gs5lsxLfnP9in3PrIky-O1Hu7uBes5pa_HSVLrc,2318 +spacy/ml/models/tagger.py,sha256=NqCNqeijiy_SYcpjm2hUQC3OJ8CCI2F6JwwvDh20mbY,1240 +spacy/ml/models/textcat.py,sha256=z21scH8umWVGdpFnP_nSEalXCpDWZY-yfsAd2f0E3l8,13151 +spacy/ml/models/tok2vec.py,sha256=YhsqQNSROZ6_D5W0DhZA0KqJrMZvaPZIm7MJEx49bdE,13998 +spacy/ml/parser_model.cp312-win_amd64.pyd,sha256=M6iOOytkvEuSkTqxT0lDvkUftdahinv5mTHpjn3scS8,235520 +spacy/ml/parser_model.cpp,sha256=NO0OfvwdmEyoqyNmc7pIHIn5egBP9K_m_w2O5G39PGg,2200097 +spacy/ml/parser_model.pxd,sha256=p4XhrWYq57-cAKQZaaIPLe0LvHGpzy8Z_lG0Rg4_K5Q,1231 +spacy/ml/parser_model.pyx,sha256=G9-eQpBHE31JVhTlZoCNHWczxhcpK1uRTolb7AeuS6M,19030 +spacy/ml/staticvectors.py,sha256=EQxOLG5BB_caCBw2P6NJQr8S1N0VBHF7VEPleV7xMeE,4330 +spacy/ml/tb_framework.py,sha256=L4uUzdOtIV-vzc3RATGVQlS140VM_Xll2HHNdiBocZQ,1470 +spacy/morphology.cp312-win_amd64.pyd,sha256=_4FwXPVgJYc9T0B5Nd2fQeAY7mEn1r_O-XTmYyzJqjo,94720 +spacy/morphology.cpp,sha256=wREMpoE2ULYRuZnxWUxgYIv097dbByuODer_cMeQEjM,839344 +spacy/morphology.pxd,sha256=OWIhYZ17I6Za57a1f0dRSggqOZ121LtCF4hqNbsZhQk,851 +spacy/morphology.pyx,sha256=K6AwX_P3BAdd3i0m90SG6Tl8egNThtaTkleawnHda8Q,8459 +spacy/parts_of_speech.cp312-win_amd64.pyd,sha256=xey2ECekO7DSGB8D5RlP2C9erybn0RM1K1alUjaJ2zY,33792 +spacy/parts_of_speech.cpp,sha256=bKjUmVuOpsmLT2v_wHBCIwfR3eWwQFMWtqEMLxWQBnE,309457 +spacy/parts_of_speech.pxd,sha256=Yo7beauYy1M_PDzX4UATOOjn20sa07bofhPTcCfTde4,283 +spacy/parts_of_speech.pyx,sha256=C_lzfc3SVjkQQvK2O3NOdnhDiMU2ua0u1Tm67PL22Pc,607 +spacy/pipe_analysis.py,sha256=JNEFuBjg9U-ddhblhqA0AhLGDtwHch_13nbvWp6SEwU,6380 +spacy/pipeline/__init__.py,sha256=daO9R_CahTrTfeFxs73dAYmHngEkqBbncET5WWLGYvA,1324 +spacy/pipeline/__pycache__/__init__.cpython-312.pyc,, +spacy/pipeline/__pycache__/attributeruler.cpython-312.pyc,, +spacy/pipeline/__pycache__/edit_tree_lemmatizer.cpython-312.pyc,, +spacy/pipeline/__pycache__/entity_linker.cpython-312.pyc,, +spacy/pipeline/__pycache__/entityruler.cpython-312.pyc,, +spacy/pipeline/__pycache__/factories.cpython-312.pyc,, +spacy/pipeline/__pycache__/functions.cpython-312.pyc,, +spacy/pipeline/__pycache__/lemmatizer.cpython-312.pyc,, +spacy/pipeline/__pycache__/span_finder.cpython-312.pyc,, +spacy/pipeline/__pycache__/span_ruler.cpython-312.pyc,, +spacy/pipeline/__pycache__/spancat.cpython-312.pyc,, +spacy/pipeline/__pycache__/textcat.cpython-312.pyc,, +spacy/pipeline/__pycache__/textcat_multilabel.cpython-312.pyc,, +spacy/pipeline/__pycache__/tok2vec.cpython-312.pyc,, +spacy/pipeline/_edit_tree_internals/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/pipeline/_edit_tree_internals/__pycache__/__init__.cpython-312.pyc,, +spacy/pipeline/_edit_tree_internals/__pycache__/schemas.cpython-312.pyc,, +spacy/pipeline/_edit_tree_internals/edit_trees.cp312-win_amd64.pyd,sha256=A3L6PclA2MK81tdeOIaCAwMIxSODCZHnxytZiQn80UQ,123904 +spacy/pipeline/_edit_tree_internals/edit_trees.cpp,sha256=EUiJfKsh7T0qBc6mB2DXe6KOWjvV469V_kBr-yho0jY,912665 +spacy/pipeline/_edit_tree_internals/edit_trees.pxd,sha256=-oIrW2funh_WtHlcoNJ59PPB6umcgGBki03RzSm3naM,3575 +spacy/pipeline/_edit_tree_internals/edit_trees.pyx,sha256=4uRLM6z6D6_sb01iUM2RUtv95Cx7eYRzuugX9qFXVhk,10965 +spacy/pipeline/_edit_tree_internals/schemas.py,sha256=uq9AmVxhy6vAaHzIHAdGCNqSdI9SYPwjn4Ynil6scTk,1718 +spacy/pipeline/_parser_internals/__init__.pxd,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/pipeline/_parser_internals/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/pipeline/_parser_internals/__pycache__/__init__.cpython-312.pyc,, +spacy/pipeline/_parser_internals/_beam_utils.cp312-win_amd64.pyd,sha256=tfLucTiqWckER8DwHBdZZ7eyh-yIAsew-hvvYow8FOk,218112 +spacy/pipeline/_parser_internals/_beam_utils.cpp,sha256=vyy4MFPHUEvLCiOIfNldnSGWTpVOUtGydwyKpQ0me9o,1982563 +spacy/pipeline/_parser_internals/_beam_utils.pxd,sha256=cvZkeBdbG9IXGYh5-HjX9qkVqiovG5ARh-E5_SyWiwE,262 +spacy/pipeline/_parser_internals/_beam_utils.pyx,sha256=udUyONbruB4OVKEZLpse53XavUdOGxZ_COUVsp_KwQ4,11830 +spacy/pipeline/_parser_internals/_state.cp312-win_amd64.pyd,sha256=VzbGSCq7f6HEMWvSPyaOn5K2HtaV0KoZ1t9IfG49PCU,23040 +spacy/pipeline/_parser_internals/_state.cpp,sha256=Yez5f1-fbpcTRuSbddwCCKMnncJeeBtKVFVMb_-xUjA,586231 +spacy/pipeline/_parser_internals/_state.pxd,sha256=2TEPcpWL29xKwZFBiqf2Pmanq0mfk68KLhe0nAorox4,13468 +spacy/pipeline/_parser_internals/_state.pyx,sha256=BHrIYTbTg0wPXDU4nEu7Ep0XlDEAfwyyZzHZlzdkFeA,25 +spacy/pipeline/_parser_internals/arc_eager.cp312-win_amd64.pyd,sha256=rSKyWFofa6b7azVc5KUnRUcl1FYQ6MkC5mUSNfOTnT0,300032 +spacy/pipeline/_parser_internals/arc_eager.cpp,sha256=V30MFJT-oa8Y-YVvqY3I407_GyZDGoUatp8_O5y7nBU,2626231 +spacy/pipeline/_parser_internals/arc_eager.pxd,sha256=sSiPLSH8mvXad3ynHKWfYJtkWZAkHGpAn4PUDCWWXBo,218 +spacy/pipeline/_parser_internals/arc_eager.pyx,sha256=o5bLQp1qGvlUo2utOtCTivZ5IQA22tWDmSmd7TEfN_8,31554 +spacy/pipeline/_parser_internals/ner.cp312-win_amd64.pyd,sha256=Mt_llIRgMYB9cqLVq1hmFfas-9BnPOoZUUhtRUYEr2E,224256 +spacy/pipeline/_parser_internals/ner.cpp,sha256=4taqwECXvQjV8PsyFnuxoEqtFhqGR6FT74fEV2yipCg,2270017 +spacy/pipeline/_parser_internals/ner.pxd,sha256=t4C1A08YZB6G8pg7ewex8XCdqfGgRP51-ML4PwHi4X8,109 +spacy/pipeline/_parser_internals/ner.pyx,sha256=Mrgz6Z4VfB4hvzR7vE6L0Mrj3hIWr9N_DEGgmUD6wgY,23940 +spacy/pipeline/_parser_internals/nonproj.cp312-win_amd64.pyd,sha256=57TqTals8ZQ6qz631TJyg7bKCZCNqnVFLUQkYwl_voQ,185344 +spacy/pipeline/_parser_internals/nonproj.cpp,sha256=QhZy83fLe2ba6L2ROgpqpOp54qZNhLc3eSWAyI-0FuM,1546670 +spacy/pipeline/_parser_internals/nonproj.hh,sha256=O2QsGbVxKQ8Y9GBho6javj3wsSCV8NRT2ND0eHOssxA,198 +spacy/pipeline/_parser_internals/nonproj.pxd,sha256=MoAQutcnqG2xc5JrrqnkiyU1InuGNoVjhUAUpLKiGLU,139 +spacy/pipeline/_parser_internals/nonproj.pyx,sha256=u6fpklrA7BSAbk7JewP1ksxoxLqbs6rMxiFxJHWrHX8,8919 +spacy/pipeline/_parser_internals/stateclass.cp312-win_amd64.pyd,sha256=R8eYYHC-4xbrf_9HgbhX4eIWBZUE49ABVqeJmpKRYVA,199680 +spacy/pipeline/_parser_internals/stateclass.cpp,sha256=0h20mHBdhpfON86Q_feMOAyb3MOG127nnLOgSp9iSgE,1787317 +spacy/pipeline/_parser_internals/stateclass.pxd,sha256=lUZokB62t67xzd8l4FQqK5Jl-bTZizbk6QVpRt1KZ2Q,771 +spacy/pipeline/_parser_internals/stateclass.pyx,sha256=5b7smN38M1aKnCyTO05YnpUffmPSEjQmlIfAKbmxI4U,4801 +spacy/pipeline/_parser_internals/transition_system.cp312-win_amd64.pyd,sha256=M9fSja7D3GbBXhz3WzQzWNAqVFJ-K6eAzWzZyVPZXYM,218112 +spacy/pipeline/_parser_internals/transition_system.cpp,sha256=9G1os88v_DfiCa1oHPfheS0nryzCyJNhqj8VcXBpK6g,1833741 +spacy/pipeline/_parser_internals/transition_system.pxd,sha256=Ic2hwFgRPG59ssVEMNxzDAWd9bGUByU9VzGYcpkq-dg,1861 +spacy/pipeline/_parser_internals/transition_system.pyx,sha256=72YoEOICK96LAUzCt6M1PqmYE-Y1p1XHTS2Dw5I0Jvo,9388 +spacy/pipeline/attributeruler.py,sha256=F54dYWbVuo6KsZvhVpZ4PF--q0TrvDeGX-hdb7boDiM,13954 +spacy/pipeline/dep_parser.cp312-win_amd64.pyd,sha256=myEybSEZXBDVOEqxZE37vNQNWX7EXboeuk2G7xK2eU0,168960 +spacy/pipeline/dep_parser.cpp,sha256=DDx2Q27Q4x7fqHimR7-5LM02tQn-pWN1bMY0I-spgKs,1684000 +spacy/pipeline/dep_parser.pyx,sha256=TT1EvcHvormU_AHQwHi-W4Rs4SdEJUY6WrjBMn8g6dY,5912 +spacy/pipeline/edit_tree_lemmatizer.py,sha256=U3UK9TzROXMoBV7luFMnI2groYaYzEXmLAq-qD6vBBw,15190 +spacy/pipeline/entity_linker.py,sha256=7x5nyFCKaDqZULtAlpyVrg1l_iH0SJqtY2FWhzFfUd0,24770 +spacy/pipeline/entityruler.py,sha256=DspLB1CgTW6W9yXnr6zogB_mStjloeCPMIsJbiNk1Fo,20778 +spacy/pipeline/factories.py,sha256=v6eR1LZIjKw6vUo64LlUoT5NZd3K47ZiqfsuLJh5O2A,27749 +spacy/pipeline/functions.py,sha256=hMhYyzZU0PZUfANtF75kCE-ho18xY5Fo6Y3jG3FHe1k,6807 +spacy/pipeline/legacy/__init__.py,sha256=1j5edMXlnmpKU_OkEj4p6Nt2SP5vKbRprVWX2L3g-p8,77 +spacy/pipeline/legacy/__pycache__/__init__.cpython-312.pyc,, +spacy/pipeline/legacy/__pycache__/entity_linker.cpython-312.pyc,, +spacy/pipeline/legacy/entity_linker.py,sha256=NUsNlC5rUSMVHW8OUMiUvnxQLfn1YV-psMo4gOfHUjQ,19210 +spacy/pipeline/lemmatizer.py,sha256=A55CRxSmnxLLm37jAdV4QQh5BhPFvTJtPOc_J98qWN0,12356 +spacy/pipeline/morphologizer.cp312-win_amd64.pyd,sha256=Yrwwa0szMpCzJRJruWbzO-Y0F1wYlRJ807_scI0KGjw,194560 +spacy/pipeline/morphologizer.cpp,sha256=8I0JPbS-m41QLz8Q_oRSO2qSVAsbic4dstWAdrhZdz0,1586446 +spacy/pipeline/morphologizer.pyx,sha256=XmLgS1pi3suxkKRUZhXJVFcJbJaRM0HSCj41DfP6W-k,12535 +spacy/pipeline/multitask.cp312-win_amd64.pyd,sha256=z36SEgRISlgqcsmWQvLMOTBibc7M1dz5O4P7fpKUi64,115200 +spacy/pipeline/multitask.cpp,sha256=valF-2f7sQobpPg4rSWbI_Yv5Ju39Q6IIxiiLcVbycg,733398 +spacy/pipeline/multitask.pyx,sha256=BNkeJgxkfWM3dlWKazTfvwNwu89s5UGguB-HEmxA26w,7621 +spacy/pipeline/ner.cp312-win_amd64.pyd,sha256=W1cTcSJ42qxnQ2b5_oLCzKSfw-NoY3JNc2hStvxSo34,168448 +spacy/pipeline/ner.cpp,sha256=cqUL2GiieS3-Q8HZN_Kb3v0tPaa-3PYw-ioCfV6Wt3E,1673870 +spacy/pipeline/ner.pyx,sha256=WH98Lbln220GPVWVQHmb_g0qXrcoqh-WE8N38Y8YMVU,4253 +spacy/pipeline/pipe.cp312-win_amd64.pyd,sha256=ApV6fs0poLvHV6pz5RdVg7Ns4zGc4RBn9f5Rz0CrEjE,163840 +spacy/pipeline/pipe.cpp,sha256=NbCuO4rp5zcTNlz4U0TQtNjmSu581UgShNkVhBfhp2Q,1419081 +spacy/pipeline/pipe.pxd,sha256=mQBwT5sVlL33DiQa9dMiw5C95c_DHpQhsZsXLPRizug,44 +spacy/pipeline/pipe.pyi,sha256=cSVU7tUfDWQAqrOFf-BMTC5VJWe4kdslaOIOYr_cIIg,1299 +spacy/pipeline/pipe.pyx,sha256=C598xDCj205D3ucnZtDHDp4ofG-fStYOIXmqAinOxns,5434 +spacy/pipeline/sentencizer.cp312-win_amd64.pyd,sha256=DMaaYBv7mETwN4kqdpTex4sKX7Z0kgQp-7UfKxBkA_g,173056 +spacy/pipeline/sentencizer.cpp,sha256=bk_wrVHcCyT_ihL1haIytajmVfuJful3ojqtKiPKP_s,1481160 +spacy/pipeline/sentencizer.pyx,sha256=wb8urVPsygJv7CSxbNPBUrEmPrD73xB-9t71Lx0viMw,6719 +spacy/pipeline/senter.cp312-win_amd64.pyd,sha256=-2xmXaKKrNRjekp18FvQIml_o7tmrFtSEM1WadXxwUg,172544 +spacy/pipeline/senter.cpp,sha256=eHXsspZsXnxPKa_fXFAtw7gxQyONqzZxDFB1ArRBlZU,1451372 +spacy/pipeline/senter.pyx,sha256=QnyBpbFo9i8cm71z-7nhDly6_R_kHqfBIx8SLGCyb1g,6484 +spacy/pipeline/span_finder.py,sha256=K_07xtM7j0n18FrpxeG-_EqG_dyofHAsX0__wvYlSNQ,10867 +spacy/pipeline/span_ruler.py,sha256=srKGmK2LwNXHrrT3Y1-SrwXC2Zq2YS_CUoCchqI-Pgw,19501 +spacy/pipeline/spancat.py,sha256=3pz193gxkXS5SKCshPUIGQNqxYJkv2IvWaNxDqNCKz0,25648 +spacy/pipeline/tagger.cp312-win_amd64.pyd,sha256=2-7EDbe6kOdcBwo5Bn37QHSY4lmwhXju8ETsGfT55HA,214016 +spacy/pipeline/tagger.cpp,sha256=_Kv1-US_fEzeKDPg56wRrMC_PP3kq44-6IQ6Z4ziM5I,1680061 +spacy/pipeline/tagger.pyx,sha256=nVoCTt6din-TjHI4Z_9SOK64nfbs2r6sIdB7eBYjB18,11768 +spacy/pipeline/textcat.py,sha256=g3rjj0aO54KyaaqQoDD4je6u4pHhEs-yALra6QqI_mg,14421 +spacy/pipeline/textcat_multilabel.py,sha256=FWL_vIEX-MKiZoNbf081_BxkCPe61HZJUcZ3-yMlv28,5758 +spacy/pipeline/tok2vec.py,sha256=u7f7U7BiIUZRmcJpAtXxBVBfN5tesrcSlpewqwrv9lY,13801 +spacy/pipeline/trainable_pipe.cp312-win_amd64.pyd,sha256=mQrNOSsED6xN2pi5YgjbTaDzYH9mcevxJvxVlhPYwzk,240128 +spacy/pipeline/trainable_pipe.cpp,sha256=hw2WkeH9EtWGpcmClhTd4X8Oz2gEVUNHE_-SwiTgU_M,1871398 +spacy/pipeline/trainable_pipe.pxd,sha256=lZQNYUVj8u_Ysgtcs-2wZpbUUrpzVqRiDbBI0PONjPg,208 +spacy/pipeline/trainable_pipe.pyx,sha256=nbGtfD2OEnN3Ni-evSh4RlkWiyp9TORINuE9RWZLK7c,14364 +spacy/pipeline/transition_parser.cp312-win_amd64.pyd,sha256=Repgk3Hm24iON_823aufjOdbEFW5JpUk9aqnLlltwg0,341504 +spacy/pipeline/transition_parser.cpp,sha256=M51UhES8UqqKQ4ph7q5WLba-A02rYPk9fuC1ZTX9LgU,2615265 +spacy/pipeline/transition_parser.pxd,sha256=8knaZLWbpkAa1m5h54J6DvNUecmITdz1071dypcI1H4,831 +spacy/pipeline/transition_parser.pyx,sha256=TRqv-eK9xKOYy_5jq1NctLRgAHI7tdXSaK0exwYugdI,28137 +spacy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/registrations.py,sha256=KLIVW2E5wl3Rv0tJA0OrILq96ghfbjepmLs-kKNNXTc,11618 +spacy/schemas.py,sha256=82PpvyyioLYzyBNluZTbPfrJ_6UCtvzPeieH1CljDSY,22237 +spacy/scorer.py,sha256=Lt7L1pnApp-kPWS1AiczH1ZISvWILwrqO4THz_8rZLM,46935 +spacy/strings.cp312-win_amd64.pyd,sha256=_VsJpjWr-0IZocMpxZWT265Hr194bIrDtHn_pW7KqHA,111104 +spacy/strings.cpp,sha256=91TajHRVFUUB31OhiWxioMIpc9J1rQ1CE7e-v0xoS7Y,793688 +spacy/strings.pxd,sha256=XotAlwmHkv9XM52h74QvHgxw6cjJ9krEmYtKkBOB90s,871 +spacy/strings.pyi,sha256=1a3dI9kPz1GOHd9rNQd1VFT8UGaCJFqXhAITzhPT_xI,1123 +spacy/strings.pyx,sha256=0VwALkKBQsyjusDOGR2U-IUmJexHmdd7U-91FfeE9hI,14411 +spacy/structs.pxd,sha256=H8CcXDFyDOb-JSu_56izd08oQfRXMfpGuHWyPyGVNRQ,2615 +spacy/symbols.cp312-win_amd64.pyd,sha256=UeS81SM-i1FV4m3dV7PtPT5BRd8sDCbl9HkLeGVdDN8,77824 +spacy/symbols.cpp,sha256=GcCGhvJsi2hHtwOCUI_LJtbd9YKzbEQjVZO9Wuj4Nwc,659922 +spacy/symbols.pxd,sha256=RVen8KP27p8CgQ5pLAkOUEjtjWWYHrkGBnhuKz-84I4,7412 +spacy/symbols.pyx,sha256=v7eadInEoIIiaszY0jACa-7NgiC6-Tqo_RLd9N9pYfI,14687 +spacy/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/__pycache__/conftest.cpython-312.pyc,, +spacy/tests/__pycache__/enable_gpu.cpython-312.pyc,, +spacy/tests/__pycache__/test_architectures.cpython-312.pyc,, +spacy/tests/__pycache__/test_cli.cpython-312.pyc,, +spacy/tests/__pycache__/test_cli_app.cpython-312.pyc,, +spacy/tests/__pycache__/test_displacy.cpython-312.pyc,, +spacy/tests/__pycache__/test_errors.cpython-312.pyc,, +spacy/tests/__pycache__/test_factory_imports.cpython-312.pyc,, +spacy/tests/__pycache__/test_factory_registrations.cpython-312.pyc,, +spacy/tests/__pycache__/test_language.cpython-312.pyc,, +spacy/tests/__pycache__/test_misc.cpython-312.pyc,, +spacy/tests/__pycache__/test_models.cpython-312.pyc,, +spacy/tests/__pycache__/test_pickles.cpython-312.pyc,, +spacy/tests/__pycache__/test_registry_population.cpython-312.pyc,, +spacy/tests/__pycache__/test_scorer.cpython-312.pyc,, +spacy/tests/__pycache__/test_ty.cpython-312.pyc,, +spacy/tests/__pycache__/tok2vec.cpython-312.pyc,, +spacy/tests/__pycache__/util.cpython-312.pyc,, +spacy/tests/conftest.py,sha256=6m9yBxv7Jffjmy24kTL6mNg-BQbEn1mEa31c0l6jDAo,12630 +spacy/tests/doc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/doc/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_add_entities.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_array.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_creation.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_doc_api.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_graph.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_json_doc_conversion.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_morphanalysis.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_pickle_doc.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_retokenize_merge.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_retokenize_split.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_span.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_span_group.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_token_api.cpython-312.pyc,, +spacy/tests/doc/__pycache__/test_underscore.cpython-312.pyc,, +spacy/tests/doc/test_add_entities.py,sha256=GElMSdbkH2EpAEXPhoCBebEHy4elSApX2FzlvZUNEYo,1861 +spacy/tests/doc/test_array.py,sha256=e-q6i2vq8UdN--P2u1qjTgm3gBYJoT5-njdeeVM1rCY,5124 +spacy/tests/doc/test_creation.py,sha256=lAvqP9rqJi52oL8WY8fNMFHfZDfl6a6FRve_jBqqvz4,2731 +spacy/tests/doc/test_doc_api.py,sha256=mTyPbqEnnKmbKL29OGLYyunqO3V6LUeo1JL2CxeIlTU,36934 +spacy/tests/doc/test_graph.py,sha256=6z5uFDXYars77gLqt6_XsL504VmEhHsVpoV9aK5Ym00,1867 +spacy/tests/doc/test_json_doc_conversion.py,sha256=3Rev7YR54J9WD83CFU-J12uU9pRx7Q0unezalWzffSA,14043 +spacy/tests/doc/test_morphanalysis.py,sha256=K-haVQ8osFVzftsc82IWZZ_Q9a4FQGVncw6Kmp4gBy4,3245 +spacy/tests/doc/test_pickle_doc.py,sha256=ZdHn5IHK2M8xtY9URShdODXn1qUW_8dOFos-TuhIDf0,1524 +spacy/tests/doc/test_retokenize_merge.py,sha256=ES35gW76xC7KExE0Q81gjb9eIr12LWq_YrQH0QtLA20,19451 +spacy/tests/doc/test_retokenize_split.py,sha256=TQsW2atsDBkasWjxJHqSKLBY7AxDCSnDC3itkxvb--E,11233 +spacy/tests/doc/test_span.py,sha256=z_Y-gCpi4jk3OjhagRgD7MkXGcEe3wyu9e6vKO1mgRk,26968 +spacy/tests/doc/test_span_group.py,sha256=iQtIV7EBnA-p5dIv5Hft2HUdB58DuB_KpNRMRiFXNPc,8947 +spacy/tests/doc/test_token_api.py,sha256=Db8oG3XptLbeNrePmALN6WmPW6IV8MO7OzAcHnWBnxk,11719 +spacy/tests/doc/test_underscore.py,sha256=iSfObYTRRCrZFBCHpREgqznYRBRwePRpilnLev6LIG0,5739 +spacy/tests/enable_gpu.py,sha256=3SmrS2K52tlcV7qrld5UzkTMF2zKfit0ptIU68_D_TE,48 +spacy/tests/factory_registrations.json,sha256=A48e65CZPYF7nu7SulonLqagaNmsqSY2Z2xpslHeKa4,3621 +spacy/tests/lang/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/__pycache__/test_attrs.cpython-312.pyc,, +spacy/tests/lang/__pycache__/test_initialize.cpython-312.pyc,, +spacy/tests/lang/__pycache__/test_lemmatizers.cpython-312.pyc,, +spacy/tests/lang/af/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/af/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/af/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/af/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/af/test_text.py,sha256=38UgXyHz3N1gJHxLRo19WsXut-pp_Uh8NNBi_Hg0PTY,953 +spacy/tests/lang/af/test_tokenizer.py,sha256=WJZHJv4D4V3pIyBSm7I7TItz4Vaq1x2WiGUOLEWPHg8,739 +spacy/tests/lang/am/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/am/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/am/__pycache__/test_exception.cpython-312.pyc,, +spacy/tests/lang/am/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/am/test_exception.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/am/test_text.py,sha256=80u6QPuD3XDcfKU_IbjyWZkaslunfLrIr5-YwZhgboU,1888 +spacy/tests/lang/ar/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ar/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ar/__pycache__/test_exceptions.cpython-312.pyc,, +spacy/tests/lang/ar/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/ar/test_exceptions.py,sha256=hM9owHEhXVNhksqQ4b81H4d6r6ljmeCbFJewJAKvOYM,641 +spacy/tests/lang/ar/test_text.py,sha256=4yvJ035BgYB9cUzEoGpJIPuhOiGQ01ChtPjDuhB2xQ4,830 +spacy/tests/lang/bn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/bn/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/bn/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/bn/test_tokenizer.py,sha256=_0XlFYY-wcTQZeJ0maHB9zHbV_qeJVgwAN9ZdH9DTrY,3658 +spacy/tests/lang/bo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/bo/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/bo/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/bo/test_text.py,sha256=4KZwrGWcTR_LI4oaYNXGrq3YmlWNIT6_J5_BfDdMiDA,538 +spacy/tests/lang/ca/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ca/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ca/__pycache__/test_exception.cpython-312.pyc,, +spacy/tests/lang/ca/__pycache__/test_prefix_suffix_infix.cpython-312.pyc,, +spacy/tests/lang/ca/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/ca/test_exception.py,sha256=yPcIuayC-qGnDPV1hNB54iuE1Tq2dgruMrwZlid7AsQ,649 +spacy/tests/lang/ca/test_prefix_suffix_infix.py,sha256=kEY88p34-SDccWCwIaltNb62d5ow9oMVr499mMPrdb0,511 +spacy/tests/lang/ca/test_text.py,sha256=s_QVnqAMS17c_UtDdqOU6Sor5IauxaIyfXJRB1EYvEY,1957 +spacy/tests/lang/cs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/cs/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/cs/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/cs/test_text.py,sha256=4yupiA1KXaRR-3cNxq-3TlxPuxpWDHOxB-TzO5loFXw,533 +spacy/tests/lang/da/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/da/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/da/__pycache__/test_exceptions.cpython-312.pyc,, +spacy/tests/lang/da/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/da/__pycache__/test_prefix_suffix_infix.cpython-312.pyc,, +spacy/tests/lang/da/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/da/test_exceptions.py,sha256=Q00wmSCcZPU1_obLsayuKp6L4JnvmF3kXxfcan1EgLQ,1883 +spacy/tests/lang/da/test_noun_chunks.py,sha256=rgRHkKmM8BeSI4HkgaZhwfTgI0dKYB7feybWG-C3n4s,2135 +spacy/tests/lang/da/test_prefix_suffix_infix.py,sha256=B14Zwf8SuhntKmngQ22zLccJbvZxxc7ELUZ-nlM6OPw,5591 +spacy/tests/lang/da/test_text.py,sha256=3P5LhMgnrlbFut1QUlDwqZR6OxpHre4dfGPIrdtlLdY,1261 +spacy/tests/lang/de/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/de/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/de/__pycache__/test_exceptions.cpython-312.pyc,, +spacy/tests/lang/de/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/de/__pycache__/test_parser.cpython-312.pyc,, +spacy/tests/lang/de/__pycache__/test_prefix_suffix_infix.cpython-312.pyc,, +spacy/tests/lang/de/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/de/test_exceptions.py,sha256=vqKBIOfx70X8HMc04h7qxZh98oU4bVfwRqM0FuROtQU,618 +spacy/tests/lang/de/test_noun_chunks.py,sha256=r90RAxjpHxdofxTElS9-Byg_xaZTP4A5CcY2aU2U9pM,274 +spacy/tests/lang/de/test_parser.py,sha256=RRA-tpkZCo9KIehVJkc5b8KzyGy-DVt886S2Yg73UOI,1216 +spacy/tests/lang/de/test_prefix_suffix_infix.py,sha256=RH7-f79GFUniRs10a3KYT_CBdirkSaZmI4WgsPcbS5E,3503 +spacy/tests/lang/de/test_text.py,sha256=SYBCcSMS0RnMCXLXbVn2OZqP7Ir6CJC9cen_Zrb0LvU,1550 +spacy/tests/lang/dsb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/dsb/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/dsb/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/dsb/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/dsb/test_text.py,sha256=k-BaAZyAdbKZf_nz22m2xo2FgijTTLC5fu1zCIFJWTs,585 +spacy/tests/lang/dsb/test_tokenizer.py,sha256=yU9DVyRl4XR4vcmYwVkM3QBOgPdjwZVZH3MdUTV4knM,778 +spacy/tests/lang/el/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/el/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/el/__pycache__/test_exception.cpython-312.pyc,, +spacy/tests/lang/el/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/el/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/el/test_exception.py,sha256=P8b5DEK8Nengb7EYOgnq1KOSCxf2IThOzbidrfzOyHY,528 +spacy/tests/lang/el/test_noun_chunks.py,sha256=r1RQf-woEbKUlYmtzYYrXz8vwzl9PaAgCVpThtcYi44,314 +spacy/tests/lang/el/test_text.py,sha256=MQU2nWLXwzSgn1D2Bij6Nlmq46XTaWWyiM6ZjNJfTdI,1799 +spacy/tests/lang/en/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/en/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/en/__pycache__/test_customized_tokenizer.cpython-312.pyc,, +spacy/tests/lang/en/__pycache__/test_exceptions.cpython-312.pyc,, +spacy/tests/lang/en/__pycache__/test_indices.cpython-312.pyc,, +spacy/tests/lang/en/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/en/__pycache__/test_parser.cpython-312.pyc,, +spacy/tests/lang/en/__pycache__/test_prefix_suffix_infix.cpython-312.pyc,, +spacy/tests/lang/en/__pycache__/test_punct.cpython-312.pyc,, +spacy/tests/lang/en/__pycache__/test_sbd.cpython-312.pyc,, +spacy/tests/lang/en/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/en/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/en/test_customized_tokenizer.py,sha256=6Zt4wd9cueM5Yd2iZpwM6vlyaY-aNj3IENfWW4uDvgM,3932 +spacy/tests/lang/en/test_exceptions.py,sha256=utGMVXoxZRdaCHgUHg6E9BIK8oW8X_D8-t8K0Nzjdv8,4285 +spacy/tests/lang/en/test_indices.py,sha256=hG93NO7QCJT4jjq0i8FNWTXD545CafHWptlrvanxEhg,748 +spacy/tests/lang/en/test_noun_chunks.py,sha256=655Bk4LIF6LolemPPi0UFkimtnnY7BAxN5QpPvkp0qE,1594 +spacy/tests/lang/en/test_parser.py,sha256=6gSLK3O9Xm7nEEnArkh5KoIcyh6lj3r_F13DzvYxoMg,3020 +spacy/tests/lang/en/test_prefix_suffix_infix.py,sha256=n7PEePPBt7sPP0EF-TkZ9PRDE21zGtO5BwGrwDCTBl0,4391 +spacy/tests/lang/en/test_punct.py,sha256=qrJL3CbW4z2MhoKaarvs-cAeXa-MlVARwJgW43AorQA,4549 +spacy/tests/lang/en/test_sbd.py,sha256=g8GTHe5dtppt9FVQ_cVmAixy7CCZUgxvcY-fhnHfF-U,1754 +spacy/tests/lang/en/test_text.py,sha256=-H-PXA45mCh0f__VyuNR8-fTxc16mEbMw2YpglyBQok,2033 +spacy/tests/lang/en/test_tokenizer.py,sha256=p1YI09mmwTkTQh7CpXM0lwlWzO_15uA6S6rxb_EpxEs,6116 +spacy/tests/lang/es/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/es/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/es/__pycache__/test_exception.cpython-312.pyc,, +spacy/tests/lang/es/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/es/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/es/test_exception.py,sha256=zW0QYlCHcYqxfSn-JZV6KphkXWvJm2CS_hZSpTqDAS8,571 +spacy/tests/lang/es/test_noun_chunks.py,sha256=0aBOulvG9P9lAls8JHWFNxScGH2n_YENA38Pt7Zp-qo,10126 +spacy/tests/lang/es/test_text.py,sha256=jVX1NoMmU2Is6LMoghSPaIxni4_pfs6WDfVVHYW2sJA,2100 +spacy/tests/lang/et/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/et/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/et/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/et/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/et/test_text.py,sha256=CGlPU82c-ks2PvE6uBsx5bcFrN9C-I1HhyRQTyxXUtc,959 +spacy/tests/lang/et/test_tokenizer.py,sha256=aSKDcg4Qta1y7eTLwyCRB-KxEFQ2tfp2ovl9JWOP5ME,766 +spacy/tests/lang/eu/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/eu/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/eu/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/eu/test_text.py,sha256=DAAJjFeYxB4YYH6UvDWwjZ6CODc_7KFy5MM1caWvbDI,507 +spacy/tests/lang/fa/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/fa/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/fa/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/fa/test_noun_chunks.py,sha256=zRmA8IcpUnHMRp-PwPKWwgoD00WpLGf1PxjjX0nZu80,305 +spacy/tests/lang/fi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/fi/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/fi/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/fi/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/fi/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/fi/test_noun_chunks.py,sha256=Zm36QAEARQtcfB-0zkiEMCMrQCWc8P_TgmIyp5IQPIc,7447 +spacy/tests/lang/fi/test_text.py,sha256=J0M5uI5eTkvbEiMW5CxTjyMkusg5q5pBbNVfD8wO0rc,566 +spacy/tests/lang/fi/test_tokenizer.py,sha256=2yy2UtLW6ZY6RFMIY8Ocwx-5kjVon5Qo_Y1xZTlCIyY,2983 +spacy/tests/lang/fo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/fo/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/fo/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/fo/test_tokenizer.py,sha256=jcJTLFirkAZFjjKeF1_PXoZNznt0mpBB1erp_kl_EEQ,1541 +spacy/tests/lang/fr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/fr/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/fr/__pycache__/test_exceptions.cpython-312.pyc,, +spacy/tests/lang/fr/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/fr/__pycache__/test_prefix_suffix_infix.cpython-312.pyc,, +spacy/tests/lang/fr/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/fr/test_exceptions.py,sha256=h49lZwR0jmcSlHgn8l7JvaBbpOQl17KAQ33IJprCO6U,2301 +spacy/tests/lang/fr/test_noun_chunks.py,sha256=dl15F-l2ZjNt-psfHhm9p3rfJ4D2OtgC2mR_v_RSGX8,8585 +spacy/tests/lang/fr/test_prefix_suffix_infix.py,sha256=VlGWSWdOL0G59Bg7k8inCjJ6nAPQeIyUAfBxWlJf_bY,796 +spacy/tests/lang/fr/test_text.py,sha256=hvKHbGJbDdKrPrAgDM5oQuYFupFmSwsLt3zbq97yv5Y,1035 +spacy/tests/lang/ga/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ga/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ga/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/ga/test_tokenizer.py,sha256=qv3OJfxSNQC6ZpiC8AVWfsyUdvZYFJ93zlLYDbQDnlw,699 +spacy/tests/lang/grc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/grc/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/grc/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/grc/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/grc/test_text.py,sha256=yIvgaa4CeGuK7dgD5b6nTBmK5wKblmX4YYh-wl47jNM,566 +spacy/tests/lang/grc/test_tokenizer.py,sha256=ZJp2nFCIcIpQ3S21FiFuOAlT-gluN8nSBzCW4yssWiM,1343 +spacy/tests/lang/gu/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/gu/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/gu/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/gu/test_text.py,sha256=GLtbOyuRLKwhPeNJCi6L-P8ampU0akZx18CWT_mK5xo,701 +spacy/tests/lang/he/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/he/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/he/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/he/test_tokenizer.py,sha256=2hchbiV1Q3i-unY1vmRvnpba9sHSMB41Rmmb0XmRoMU,2326 +spacy/tests/lang/hi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/hi/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/hi/__pycache__/test_lex_attrs.cpython-312.pyc,, +spacy/tests/lang/hi/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/hi/test_lex_attrs.py,sha256=c9a-ELXQ-S5GnHMJZ1V3QqxZ8C9_igJ4tx7jsEozdPA,1886 +spacy/tests/lang/hi/test_text.py,sha256=U0B_QxW_HM1eBwH3yDyswdhJnLjuxqtCHFdUn9iBjKE,413 +spacy/tests/lang/hr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/hr/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/hr/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/hr/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/hr/test_text.py,sha256=fpr_xDtu2MUoHf0TWmvZIaIoKNo4ElrkqVd5Y7WQ0lg,980 +spacy/tests/lang/hr/test_tokenizer.py,sha256=W_I5gOtbKrAQ9nTlb9zq29nEVPqk9DvjJzGCohBKADs,832 +spacy/tests/lang/hsb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/hsb/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/hsb/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/hsb/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/hsb/test_text.py,sha256=ardRbipilRC6GOwR-Wp1dqrtWp4ZuNp020wHTXWeO1U,591 +spacy/tests/lang/hsb/test_tokenizer.py,sha256=GVCgP5hw4A3W5y5OcFYMLRUiyqTHgh_R7jHnZYGkMpE,898 +spacy/tests/lang/ht/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ht/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ht/__pycache__/test_exceptions.cpython-312.pyc,, +spacy/tests/lang/ht/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/ht/__pycache__/test_prefix_suffix_infix.cpython-312.pyc,, +spacy/tests/lang/ht/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/ht/test_exceptions.py,sha256=AqTGowHlqAhd16P0qp0FbDm0txmD7v23-tbMzMr-le8,1107 +spacy/tests/lang/ht/test_noun_chunks.py,sha256=8j51HFc6-ROj-jzGP_xDFhQifejX_kGYW0bMzBMou9g,1558 +spacy/tests/lang/ht/test_prefix_suffix_infix.py,sha256=sNKo6ZPCfdoTnUovkJQgS8db8rclk8IntlITkQd7jdg,4119 +spacy/tests/lang/ht/test_text.py,sha256=AoxdFS1SIW7Px67g76twtgCmX-RHk6-fU5qZiLAa7Dc,2160 +spacy/tests/lang/hu/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/hu/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/hu/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/hu/test_tokenizer.py,sha256=zk04eubQtZYTw0wzd-J64XzhAK2s4HT22Bc4F6Ekeug,14844 +spacy/tests/lang/hy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/hy/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/hy/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/hy/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/hy/test_text.py,sha256=niI-qWftaBdeZhcEna6f0QqaLzx5G0DIoNwwNCzJDYU,220 +spacy/tests/lang/hy/test_tokenizer.py,sha256=tYfinvy71CWbgnwPFK8oh1oJ7OQ-Kdz3lrSFZ7KBzbc,1394 +spacy/tests/lang/id/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/id/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/id/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/id/__pycache__/test_prefix_suffix_infix.cpython-312.pyc,, +spacy/tests/lang/id/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/id/test_noun_chunks.py,sha256=ULACuOkyjRfARyui3trrac6BURIhp64a3Ab1rknvfH4,264 +spacy/tests/lang/id/test_prefix_suffix_infix.py,sha256=ICH4G1DhZJ-XqzpqeYF8pQxYVjpwZmFU_kQXk8WT4bw,3603 +spacy/tests/lang/id/test_text.py,sha256=Ps_Q4nWodE-Z3sEMgJyk-MqE-dNBW3M0vKw7PgWfMdE,215 +spacy/tests/lang/is/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/is/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/is/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/is/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/is/test_text.py,sha256=9u0bEr9n_DYB5YcuMhL2qkcPcJnOQZG1pA5J70wp5pA,1006 +spacy/tests/lang/is/test_tokenizer.py,sha256=CbAJo1uWexq0dRC7DjoXfUjyp5ADSdVGUeF24DLYgdM,813 +spacy/tests/lang/it/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/it/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/it/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/it/__pycache__/test_prefix_suffix_infix.cpython-312.pyc,, +spacy/tests/lang/it/__pycache__/test_stopwords.cpython-312.pyc,, +spacy/tests/lang/it/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/it/test_noun_chunks.py,sha256=cTfp7fQxKyt2vITWshxaWGlgLWXl_gqauYokF5JcUAc,8862 +spacy/tests/lang/it/test_prefix_suffix_infix.py,sha256=tcjrTqy6cF_G3V_0Qx6iD0Bb_L0Hck3kRtu5nMJ36rA,370 +spacy/tests/lang/it/test_stopwords.py,sha256=CtIWKyApYsBQ4MQcQKrNzNqpij2XRfI4yAzIn484jIo,466 +spacy/tests/lang/it/test_text.py,sha256=FDHmZjI9RF03-G5lEQU-7P5CJZ56rbTv7iXdYYzmqKE,425 +spacy/tests/lang/ja/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ja/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ja/__pycache__/test_lemmatization.cpython-312.pyc,, +spacy/tests/lang/ja/__pycache__/test_morphologizer_factory.cpython-312.pyc,, +spacy/tests/lang/ja/__pycache__/test_serialize.cpython-312.pyc,, +spacy/tests/lang/ja/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/ja/test_lemmatization.py,sha256=Vioqvy8QkMxDzEq44-30r_iJaDOAFWqdp3Hq3fOJKVY,771 +spacy/tests/lang/ja/test_morphologizer_factory.py,sha256=pgoWPOy0bW7sWbtMBbHlLMlCoXmgMjrC_xn6sTDpVP0,254 +spacy/tests/lang/ja/test_serialize.py,sha256=TNlZPBRxyVC1LY9ocVWC3PO_1Ml3UH4ubhUtzGSMIjw,1349 +spacy/tests/lang/ja/test_tokenizer.py,sha256=kwXVsx0w0pQrcHrZ5SB-WjtImxXh8di7eqTS9Z0yNdA,8153 +spacy/tests/lang/kmr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/kmr/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/kmr/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/kmr/test_text.py,sha256=DFZAp-_J84vg2Si6eTWNJeZkvONJJD-X2VvZq2jtw28,529 +spacy/tests/lang/ko/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ko/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ko/__pycache__/test_lemmatization.cpython-312.pyc,, +spacy/tests/lang/ko/__pycache__/test_serialize.cpython-312.pyc,, +spacy/tests/lang/ko/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/ko/test_lemmatization.py,sha256=JvB3VCq9QAI7OPOjrASr6K1CKTq8iiobGjxUD2ICC6g,377 +spacy/tests/lang/ko/test_serialize.py,sha256=bY3rB9__Ekgwbnu-Dx_HHoleFoeIbXWb5iYgHHYoMrk,738 +spacy/tests/lang/ko/test_tokenizer.py,sha256=i57i_tuf1Vr-y6sitMUtP4lDq6gC2atezLG-iXqzGHQ,2968 +spacy/tests/lang/ky/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ky/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ky/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/ky/test_tokenizer.py,sha256=3ocKMCeL7XpGCxskRMOOX8MRI0dNZFGtstjF_PkDrjg,4098 +spacy/tests/lang/la/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/la/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/la/__pycache__/test_exception.cpython-312.pyc,, +spacy/tests/lang/la/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/la/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/la/test_exception.py,sha256=pnlUIANbRNLTIyx31qdzqHCz-WEqPTsJqPeX7AHXNXk,244 +spacy/tests/lang/la/test_noun_chunks.py,sha256=xk0Bw94KJkGVMh3g0R6BXasWLE2h8LH14-59vDiwJtY,1681 +spacy/tests/lang/la/test_text.py,sha256=LuyDKdXn4emum6ow3kx_Ot-pzXwuJLiuIVND4TBvTDY,840 +spacy/tests/lang/lb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/lb/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/lb/__pycache__/test_exceptions.cpython-312.pyc,, +spacy/tests/lang/lb/__pycache__/test_prefix_suffix_infix.cpython-312.pyc,, +spacy/tests/lang/lb/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/lb/test_exceptions.py,sha256=Uneh-YjxNseMsCTv2lb-PQAhe-HJ0XwJFItmPcsAZRg,610 +spacy/tests/lang/lb/test_prefix_suffix_infix.py,sha256=yL2VY1iUNTdIaq1qFQlREhPxm39Gi_Eyt2ITd40K26M,603 +spacy/tests/lang/lb/test_text.py,sha256=2gMZkdSN8pwCdALSbAzGiAni7Wz5WPCYYF8an_Swujk,1323 +spacy/tests/lang/lg/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/lg/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/lg/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/lg/test_tokenizer.py,sha256=6kZvUhCpOrQ2fdn8sQ_cFDP02wT4FxJwUjvCeWuPP_Y,464 +spacy/tests/lang/lt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/lt/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/lt/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/lt/test_text.py,sha256=ufLYjnQSHZ_5DYlYo8NX0O6H-c_FORSCA2hI-7u9gj4,1697 +spacy/tests/lang/lv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/lv/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/lv/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/lv/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/lv/test_text.py,sha256=dZZCSKffPxNlVFC6ByCfKUv7AHwl1_Osys0PwWzySwE,1045 +spacy/tests/lang/lv/test_tokenizer.py,sha256=Y4g_uaHPtgy4IwY2b4yW9o0UOybW83-jX7woTi27pUQ,808 +spacy/tests/lang/mk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/mk/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/mk/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/mk/test_text.py,sha256=7TzwJgyjy1E57QUfMeDwOxxGuti6PizKr6t9VQxtqKQ,4431 +spacy/tests/lang/ml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ml/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ml/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/ml/test_text.py,sha256=qQGlrSmaubLNc-9ARiQSYzktEKU_lPXiXzFUY3zUW1M,1097 +spacy/tests/lang/ms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ms/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ms/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/ms/__pycache__/test_prefix_suffix_infix.cpython-312.pyc,, +spacy/tests/lang/ms/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/ms/test_noun_chunks.py,sha256=rObkOYo2e2EjmFlujXTfsQ22fup3vtuAxsNBLKoHD2o,264 +spacy/tests/lang/ms/test_prefix_suffix_infix.py,sha256=8LeZo8Gjw9KbeEnFLfLZVi8mDiD_056IAU61DwZFvKQ,3624 +spacy/tests/lang/ms/test_text.py,sha256=JHcNswD0Qy6AaiUgP8WhbVEWu4yHKqwOmVnIoorZuys,215 +spacy/tests/lang/nb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/nb/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/nb/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/nb/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/nb/test_noun_chunks.py,sha256=B-NlCy_FMhkUmt8DtpQ9b0y3-rxoyxnV2mnEuSCpsPw,285 +spacy/tests/lang/nb/test_tokenizer.py,sha256=9pXx6Xc6FjSgmdlbUWL6x6mC93zxSDjw7ZatjWWOvvg,648 +spacy/tests/lang/ne/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ne/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ne/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/ne/test_text.py,sha256=No3TyHdAS5Ybe0rV7OOHjqOwfRatygU10ktnXZsZGxs,783 +spacy/tests/lang/nl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/nl/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/nl/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/nl/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/nl/test_noun_chunks.py,sha256=4HmmFzNVtKFP01PoJKIKKzsJ65wNMW9eSuW4PukX9jk,4530 +spacy/tests/lang/nl/test_text.py,sha256=7P8lr420qwpscsXF-r9IwV5du23BS0sIdJphitdJUdA,719 +spacy/tests/lang/nn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/nn/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/nn/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/nn/test_tokenizer.py,sha256=RspoAFvb6JYTk235AjwsUdqhm3DFEFtBcfCvnWYduAs,1834 +spacy/tests/lang/pl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/pl/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/pl/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/pl/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/pl/test_text.py,sha256=hHIb-ModI2nQyhzJ8Zn5HxkkQ-MtmOyrz8HSg7jJH2U,547 +spacy/tests/lang/pl/test_tokenizer.py,sha256=l0nvFUb0ADooJ77Y-ZbS2P81mWsQJsr5qVWoAwhYCIM,578 +spacy/tests/lang/pt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/pt/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/pt/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/pt/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/pt/test_noun_chunks.py,sha256=xP_Rew1pRcHNlXBhWRHuxD5vpjQj1cQkCxuvHoPY9PI,7971 +spacy/tests/lang/pt/test_text.py,sha256=3dai_Q1fKSmAxYj2RIqqVlGaDflKcNvS5mR6Obo0dfo,229 +spacy/tests/lang/ro/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ro/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ro/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/ro/test_tokenizer.py,sha256=pKMXrjzp7p7ouSYpi6vUgcshte7lD0AryPXtQDfoOao,754 +spacy/tests/lang/ru/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ru/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ru/__pycache__/test_exceptions.cpython-312.pyc,, +spacy/tests/lang/ru/__pycache__/test_lemmatizer.cpython-312.pyc,, +spacy/tests/lang/ru/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/ru/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/ru/test_exceptions.py,sha256=DL1fT5b9asOsVn4yF-AKINWFHExPUVaI4rA5QCRLYSE,364 +spacy/tests/lang/ru/test_lemmatizer.py,sha256=di8v2-e1_gEJoUNjdfSmgikdp8r6ZG1VbdIctg5JZNU,4067 +spacy/tests/lang/ru/test_text.py,sha256=mz6siyEcLCuU55Dtnpdx6-TYs0ym78idJcc9Zaz7uWA,230 +spacy/tests/lang/ru/test_tokenizer.py,sha256=aKWxwCducV-nYVvb7foQlnClSYxelN4JGcR4PDeyv1c,6141 +spacy/tests/lang/sa/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/sa/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/sa/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/sa/test_text.py,sha256=zrIvezsBb5twTG3R-4FMP5dmdiSikdS158m_ymyA_LM,1339 +spacy/tests/lang/sk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/sk/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/sk/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/sk/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/sk/test_text.py,sha256=NwbRs3s4Ct237UKc-l5BWGKrnppOj5cs8tA2LCFEuGo,1533 +spacy/tests/lang/sk/test_tokenizer.py,sha256=mG4Kq2xP0tiIE5oy5jRv4WA4yJD-nfs-l6O9l9XYs64,468 +spacy/tests/lang/sl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/sl/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/sl/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/sl/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/sl/test_text.py,sha256=J9_mWfor_w8KcIMPtk3EnBJjMzyNU3TyqFEdvHK72xs,1019 +spacy/tests/lang/sl/test_tokenizer.py,sha256=zZrM7PMHdBqBBB4BCr-YoIAlXOkczdjbeH5FseMSFlw,863 +spacy/tests/lang/sq/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/sq/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/sq/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/sq/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/sq/test_text.py,sha256=dXj7Cg1Ea7iVg19saOSxDsIdnJFxCCHGzmb64qU9MmI,1203 +spacy/tests/lang/sq/test_tokenizer.py,sha256=Og8WFtuSG9ILc4H7lLdOYMQCpkS-R8W9Urlq7xpvJMI,848 +spacy/tests/lang/sr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/sr/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/sr/__pycache__/test_exceptions.cpython-312.pyc,, +spacy/tests/lang/sr/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/sr/test_exceptions.py,sha256=KqnQeBQAH0fbrIZ27V8lkW1TwJTsKDKpH3gDBl3njiQ,526 +spacy/tests/lang/sr/test_tokenizer.py,sha256=0kmMJwhAQs4pNDyClHmLiZHVyuMIWsU_nx7ikGwsIeY,4424 +spacy/tests/lang/sv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/sv/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/sv/__pycache__/test_exceptions.cpython-312.pyc,, +spacy/tests/lang/sv/__pycache__/test_lex_attrs.cpython-312.pyc,, +spacy/tests/lang/sv/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/sv/__pycache__/test_prefix_suffix_infix.cpython-312.pyc,, +spacy/tests/lang/sv/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/sv/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/sv/test_exceptions.py,sha256=1v15qkJKJgFjHoupaI8in9BwfF4YFGuXljKU6gPlavM,2530 +spacy/tests/lang/sv/test_lex_attrs.py,sha256=T4Hkq26ou3L0dTPDM7GV7OUN6MSvfi1MdT9QkQJf67U,715 +spacy/tests/lang/sv/test_noun_chunks.py,sha256=-0D7JMUXm54c7w_X35hJtF-LRnirleIaltg790iF1rg,1907 +spacy/tests/lang/sv/test_prefix_suffix_infix.py,sha256=_3lbAyO8j1zRb47vlmEqs-dYhB2QrfWadCVFali4Waw,1306 +spacy/tests/lang/sv/test_text.py,sha256=u-SjK4xInt_BUnvuUhjabYxbb2JqnqpLvz7voTivIg8,737 +spacy/tests/lang/sv/test_tokenizer.py,sha256=aAQFC4msaTx-u5d2cpmdIXHRrQDPeRmbB-bxwK3YReM,1034 +spacy/tests/lang/ta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ta/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ta/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/ta/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/ta/test_text.py,sha256=qxd6Bx6lighmUCUuV-95Q_b33oBqJA8C1tATslHPqBw,2764 +spacy/tests/lang/ta/test_tokenizer.py,sha256=ivyNLSWMgM2nK0WkhEwM0TUtGLC5N-xw5xEosXxq3Qo,8019 +spacy/tests/lang/test_attrs.py,sha256=Fikb2CKAUcuRtQVYkCoOREgJHmO1VUwHSV09WV3wUgU,3667 +spacy/tests/lang/test_initialize.py,sha256=WKRSkPYvktkYhYQ-uLw7n3njEZ_OcfdIhxZ5m0YKZ4w,953 +spacy/tests/lang/test_lemmatizers.py,sha256=ODCk5ErOmWu18Dv6GjGXgQfbvI6n6wLwmKLkro279K8,1964 +spacy/tests/lang/th/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/th/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/th/__pycache__/test_serialize.cpython-312.pyc,, +spacy/tests/lang/th/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/th/test_serialize.py,sha256=eXdWfFmjCSr_3FM5CTWKCyEXAdSa7YGXo6-8w0yd3Q4,732 +spacy/tests/lang/th/test_tokenizer.py,sha256=V0ctcHhaepZdZ8U2jjDf0WpiehJbqi_6pvnBC13pE-w,327 +spacy/tests/lang/ti/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ti/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ti/__pycache__/test_exception.cpython-312.pyc,, +spacy/tests/lang/ti/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/ti/test_exception.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ti/test_text.py,sha256=_ljfsUdaLB0jC3Kvc0PVVbsce56ywqKCehce2sj8Mak,2171 +spacy/tests/lang/tl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/tl/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/tl/__pycache__/test_indices.cpython-312.pyc,, +spacy/tests/lang/tl/__pycache__/test_punct.cpython-312.pyc,, +spacy/tests/lang/tl/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/tl/test_indices.py,sha256=wO9XybcK95I4Jma0uHV271x5UHdG5rBN26Q7GEKgLcc,265 +spacy/tests/lang/tl/test_punct.py,sha256=LSQrXjzq_xIG84XKsqU148jN1j0fWNaMVyPNMBDiqgk,4547 +spacy/tests/lang/tl/test_text.py,sha256=84-CZ-dJCbWY6ZCtdcwKEbpnNRSF3eNeGf_Ob3wwFVE,2554 +spacy/tests/lang/tr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/tr/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/tr/__pycache__/test_noun_chunks.cpython-312.pyc,, +spacy/tests/lang/tr/__pycache__/test_parser.cpython-312.pyc,, +spacy/tests/lang/tr/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/tr/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/tr/test_noun_chunks.py,sha256=S2VnDNh-psiE3idxxtvZSV0HgnCVY1n_N6Jr7JYyLgI,434 +spacy/tests/lang/tr/test_parser.py,sha256=UdFSv1O2fyYQWxm--VJPOVrCcdE2SdrYtx0C8yi3OkU,20359 +spacy/tests/lang/tr/test_text.py,sha256=PTpNTPDB3AuMw7p1MY0SPN7_WRGnlD8BkqPJguEqRVc,1845 +spacy/tests/lang/tr/test_tokenizer.py,sha256=ZzU1u3OOWrGNjFVvBfOedh2lFDhHjV0L_c0YQbQzkp8,20284 +spacy/tests/lang/tt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/tt/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/tt/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/tt/test_tokenizer.py,sha256=XWoQcJGs-j8So7c31NvCd569oweDLEyAvN_YMuv_MFg,3803 +spacy/tests/lang/uk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/uk/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/uk/__pycache__/test_lemmatizer.cpython-312.pyc,, +spacy/tests/lang/uk/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/uk/__pycache__/test_tokenizer_exc.cpython-312.pyc,, +spacy/tests/lang/uk/test_lemmatizer.py,sha256=9EURieXon7v_NLeLAPkMy8bRQpW67C-OvV7uWUr6R9A,864 +spacy/tests/lang/uk/test_tokenizer.py,sha256=7m0eRq1xgIX6suymx__fKMp7CHmr45WRqiwd151dFH4,5563 +spacy/tests/lang/uk/test_tokenizer_exc.py,sha256=AjcwFraAyqJbbTjVUCktYuQmO1H8H0Of-WdAjQMsn3I,375 +spacy/tests/lang/ur/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/ur/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/ur/__pycache__/test_prefix_suffix_infix.cpython-312.pyc,, +spacy/tests/lang/ur/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/ur/test_prefix_suffix_infix.py,sha256=zxcOQGPBjV_tKrMteLQxVU52Sd_NkYLd5gV0edKiGfk,237 +spacy/tests/lang/ur/test_text.py,sha256=ycw5veAPOiifwJ0zbOMH8mCEpEZZNpCzM5T74Zokzx0,492 +spacy/tests/lang/vi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/vi/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/vi/__pycache__/test_serialize.cpython-312.pyc,, +spacy/tests/lang/vi/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/vi/test_serialize.py,sha256=v1Nz_OBptO58fw7-Gxp4Qt5vkBdC-zJA-9Hm-kG1_8E,1351 +spacy/tests/lang/vi/test_tokenizer.py,sha256=1TUBAdJGeo8ZyNEPlylTwjcSfM-CM5qjfgx6uFyYBuE,1724 +spacy/tests/lang/xx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/xx/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/xx/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/xx/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/xx/test_text.py,sha256=w0yzR8-rXBEkyS7eS99MwWZk3P6sD7HDFrD5fcAk8Y0,1744 +spacy/tests/lang/xx/test_tokenizer.py,sha256=GvABfRk9yWz4mRk1PHOXTAzSADx7suOgR8Vr45-YiF0,694 +spacy/tests/lang/yo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/yo/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/yo/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/yo/test_text.py,sha256=wfaaU17kQV1BFwVw32b-4yudl-ulQY9P8_RpE_bicv4,1521 +spacy/tests/lang/zh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/lang/zh/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/lang/zh/__pycache__/test_serialize.cpython-312.pyc,, +spacy/tests/lang/zh/__pycache__/test_text.cpython-312.pyc,, +spacy/tests/lang/zh/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/lang/zh/test_serialize.py,sha256=ZyVGZ_kGR1JN_ATYwt3brrB7rzwg1ngbNSGI9Pec6tc,1294 +spacy/tests/lang/zh/test_text.py,sha256=Kn58rL0dPZF2DIt0yVvfOBEJanXjAXv8lmr5XXrTXYw,475 +spacy/tests/lang/zh/test_tokenizer.py,sha256=xxL0O_Jnw8MvdL0TKAySAt9pBTeNwCRrgxR3ZIEMRos,2897 +spacy/tests/matcher/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/matcher/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/matcher/__pycache__/test_dependency_matcher.cpython-312.pyc,, +spacy/tests/matcher/__pycache__/test_levenshtein.cpython-312.pyc,, +spacy/tests/matcher/__pycache__/test_matcher_api.cpython-312.pyc,, +spacy/tests/matcher/__pycache__/test_matcher_logic.cpython-312.pyc,, +spacy/tests/matcher/__pycache__/test_pattern_validation.cpython-312.pyc,, +spacy/tests/matcher/__pycache__/test_phrase_matcher.cpython-312.pyc,, +spacy/tests/matcher/test_dependency_matcher.py,sha256=9fUKhR4bC_4AWDlxJFBpQN8KrzZNoeA33AcP35oSN2s,15539 +spacy/tests/matcher/test_levenshtein.py,sha256=uafUAY_WQRF2kVKpQoOerzcU_yDWpAzaR3TIG7EqT8U,2872 +spacy/tests/matcher/test_matcher_api.py,sha256=X9nhtqubYn-wrBEtxrUI88qfcfxmTIB1mHIkloehoGY,30826 +spacy/tests/matcher/test_matcher_logic.py,sha256=sHRTTNnz3BViqlLOnr7nlWjb0arEuhTby5ZdgcW0T2A,27969 +spacy/tests/matcher/test_pattern_validation.py,sha256=EDN5t0Wh_R2JzzzLsNrTfbvTZBFe1BAttza8P7Pkxl4,3453 +spacy/tests/matcher/test_phrase_matcher.py,sha256=GE5-IWUxlFXvxjZYjA4v42rolJLVfdpp2LkQnub8By8,18476 +spacy/tests/morphology/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/morphology/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/morphology/__pycache__/test_morph_converters.cpython-312.pyc,, +spacy/tests/morphology/__pycache__/test_morph_features.cpython-312.pyc,, +spacy/tests/morphology/__pycache__/test_morph_pickle.cpython-312.pyc,, +spacy/tests/morphology/test_morph_converters.py,sha256=Ds6BVEguOfp-D3MlxlV87QNK7nBlrFcGrIE4b8TVJ3I,877 +spacy/tests/morphology/test_morph_features.py,sha256=HACDAVIuSzoLtIb3kLTw4YwczO5wvbfhFMliAx-4csg,1399 +spacy/tests/morphology/test_morph_pickle.py,sha256=jNm72vTmXCxU_1wv_ZhsyCggST6JvXFPBiFgDvEIyuQ,693 +spacy/tests/package/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/package/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/package/__pycache__/test_requirements.cpython-312.pyc,, +spacy/tests/package/pyproject.toml,sha256=BrxTPKRoFm3EUrfoihJi5W1L2XYbjS9mr8MaYbTR5l4,1788 +spacy/tests/package/requirements.txt,sha256=a7GQ8xAbe6ABEjw4cUOVV00DiGYiaIT5zqtL10s7KsA,916 +spacy/tests/package/setup.cfg,sha256=FB1-O3hmDFYs7uWlQa8p_N8N6w8KA3Vsw-vqVJSMGGc,3990 +spacy/tests/package/test_requirements.py,sha256=cy__e0Be1KlrmAtYaQhhvxXtEAM852j02jfOR34iglg,3303 +spacy/tests/parser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/parser/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/parser/__pycache__/test_add_label.cpython-312.pyc,, +spacy/tests/parser/__pycache__/test_arc_eager_oracle.cpython-312.pyc,, +spacy/tests/parser/__pycache__/test_ner.cpython-312.pyc,, +spacy/tests/parser/__pycache__/test_neural_parser.cpython-312.pyc,, +spacy/tests/parser/__pycache__/test_nn_beam.cpython-312.pyc,, +spacy/tests/parser/__pycache__/test_nonproj.cpython-312.pyc,, +spacy/tests/parser/__pycache__/test_parse.cpython-312.pyc,, +spacy/tests/parser/__pycache__/test_parse_navigate.cpython-312.pyc,, +spacy/tests/parser/__pycache__/test_preset_sbd.cpython-312.pyc,, +spacy/tests/parser/__pycache__/test_space_attachment.cpython-312.pyc,, +spacy/tests/parser/__pycache__/test_state.cpython-312.pyc,, +spacy/tests/parser/test_add_label.py,sha256=ke2MGr7zeXbbj_OtGPNahNsKN7B0cKXDqTp60nGpc5Y,5079 +spacy/tests/parser/test_arc_eager_oracle.py,sha256=orrbi21eBBR5FDDZ9AOBMM-9aOEBVTDmtIbggAdDkJI,10380 +spacy/tests/parser/test_ner.py,sha256=0NUfZwTTZHxQ5wU29X9yGPuVk69eeOideRfB2U2AXDE,30004 +spacy/tests/parser/test_neural_parser.py,sha256=b4L8BuS7hSHtEnHMa5n4PyNxqx38S8VENxISmt5jDys,2969 +spacy/tests/parser/test_nn_beam.py,sha256=z3RxA6G7XQm5JnpNujSTmbcTnA-rHHoMv9-AVbA6wcM,3744 +spacy/tests/parser/test_nonproj.py,sha256=52vV9Qq7n6-aAYKPvL2o4T6YN3NpXfy9-3ciUz0jL5c,6413 +spacy/tests/parser/test_parse.py,sha256=ZbSWfOqPLH-9_0eC_2GsScdszuqx7SLnY0wlZdnX_jA,20702 +spacy/tests/parser/test_parse_navigate.py,sha256=dUBud3QzsCAbUFzPy-f-w3ic6aQc2kQGdyCorrozJ7c,6342 +spacy/tests/parser/test_preset_sbd.py,sha256=obn0zZoWhwPIr7xrHcK8m-T16gK7TKApz4UmD1kAtyM,2649 +spacy/tests/parser/test_space_attachment.py,sha256=KlHoT7FSpwYgNzssOzQUVmsYRlbY1Q6QiT6kxgwOKMk,3007 +spacy/tests/parser/test_state.py,sha256=thpb-vcd4_39mijtqxU6HCUv8zfRiazlFtAUh32DYiU,1973 +spacy/tests/pipeline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/pipeline/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_analysis.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_annotates_on_update.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_attributeruler.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_edit_tree_lemmatizer.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_entity_linker.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_entity_ruler.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_functions.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_initialize.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_lemmatizer.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_models.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_morphologizer.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_pipe_factories.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_pipe_methods.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_sentencizer.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_senter.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_span_finder.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_span_ruler.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_spancat.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_tagger.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_textcat.cpython-312.pyc,, +spacy/tests/pipeline/__pycache__/test_tok2vec.cpython-312.pyc,, +spacy/tests/pipeline/test_analysis.py,sha256=B6hAwi9iHSmtcD4UsfPW7m3lfVQoU2zfGa-ENiDQ8bw,3572 +spacy/tests/pipeline/test_annotates_on_update.py,sha256=XGbRlpGERdD2346hpoWreR2YZPXkBc04aE-BrIr8Kk4,3306 +spacy/tests/pipeline/test_attributeruler.py,sha256=0cziPPwQMJcKLuypbhOKVq-Hkd-qFSXjdMV8PjZ3o58,9830 +spacy/tests/pipeline/test_edit_tree_lemmatizer.py,sha256=lmbYkApeKjtkj1BF_0S4QooN-L2Eil_X359qcCo0Iw8,10782 +spacy/tests/pipeline/test_entity_linker.py,sha256=a_ubdhScNrLuQbjUDXC4rd5ea4t0TkXslUn0d1dXtMQ,50200 +spacy/tests/pipeline/test_entity_ruler.py,sha256=9T6BxoWd2Kuoh6YK8_jOGph1jQFF5BMQPDlmhnyW19M,26578 +spacy/tests/pipeline/test_functions.py,sha256=eVwzA0XHt_hgxJOvCiGtZ0BGW0JWyObL7NglWk_DeXI,3291 +spacy/tests/pipeline/test_initialize.py,sha256=XFsFE7SW44x_suRXAM2WflEw_LUtyt1kTLFiomXB0RA,2512 +spacy/tests/pipeline/test_lemmatizer.py,sha256=lddcoLVtBNkUURZrf2AY0zTOXazCE0bXEx97jS8lwRg,3842 +spacy/tests/pipeline/test_models.py,sha256=DQhBWe6WFeai0NMYN-6Emk5yI9Ll5pVHfnXcniH0OJU,3950 +spacy/tests/pipeline/test_morphologizer.py,sha256=4-SFw43dowwVwYx8-rSqx5VBaqu8xL2UO9bOKfi52dI,8320 +spacy/tests/pipeline/test_pipe_factories.py,sha256=K6XOtmp6TZxi10enSjKilzXq4NhstA7gLgKybTGy9vI,20527 +spacy/tests/pipeline/test_pipe_methods.py,sha256=cq9vWrgtho9XSaUdvdx8akLgRYBjE4aQJXLdwRfV0I8,23718 +spacy/tests/pipeline/test_sentencizer.py,sha256=rmkPs8t3mgWyJBJf6T2kCN7RaiS8yYmxR-VytU7WIrw,18427 +spacy/tests/pipeline/test_senter.py,sha256=AvygHwhjBw5n0tZdrN1_Z6mOPCdpxYcBTfzUpL82HZg,3416 +spacy/tests/pipeline/test_span_finder.py,sha256=HQfS3kau87rogmznkNvIoJwYHwMODRVjG6uSeKbvLHA,7669 +spacy/tests/pipeline/test_span_ruler.py,sha256=qGqw4hsmnPYn2XdTK04ZcYA98zfRn5ixKaQsQ1jfXBI,16684 +spacy/tests/pipeline/test_spancat.py,sha256=rusGPOfKDR8NI7EjzqZ2peTvS281NcXDRjrTRQBP3ME,22588 +spacy/tests/pipeline/test_tagger.py,sha256=-6B06jtpbKX3FJC9d-IJ_UoeDvniburu2k-ozSWi1o4,7895 +spacy/tests/pipeline/test_textcat.py,sha256=ffzF-l2buzRNtzW48eHm4iQkf6VfT7fTLyGiUypGQeM,40709 +spacy/tests/pipeline/test_tok2vec.py,sha256=8AkB5D23uLefLaz--Mu6LzPa7SO5Lnqn2wkI2kzucE4,22434 +spacy/tests/registry_contents.json,sha256=x3s8fQ5xhr4MqgGuFIZTcD5ahDg5V4mMukHPYCCNkMM,7251 +spacy/tests/serialize/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/serialize/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/serialize/__pycache__/test_resource_warning.cpython-312.pyc,, +spacy/tests/serialize/__pycache__/test_serialize_config.cpython-312.pyc,, +spacy/tests/serialize/__pycache__/test_serialize_doc.cpython-312.pyc,, +spacy/tests/serialize/__pycache__/test_serialize_docbin.cpython-312.pyc,, +spacy/tests/serialize/__pycache__/test_serialize_extension_attrs.cpython-312.pyc,, +spacy/tests/serialize/__pycache__/test_serialize_kb.cpython-312.pyc,, +spacy/tests/serialize/__pycache__/test_serialize_language.cpython-312.pyc,, +spacy/tests/serialize/__pycache__/test_serialize_pipeline.cpython-312.pyc,, +spacy/tests/serialize/__pycache__/test_serialize_span_groups.cpython-312.pyc,, +spacy/tests/serialize/__pycache__/test_serialize_tokenizer.cpython-312.pyc,, +spacy/tests/serialize/__pycache__/test_serialize_vocab_strings.cpython-312.pyc,, +spacy/tests/serialize/test_resource_warning.py,sha256=r99gJxPRqwy3K5KUPatmXPrT0SCLqPfRd76aqKSK510,4434 +spacy/tests/serialize/test_serialize_config.py,sha256=5QKjj3rHtp9Zzl_btr9G99FC4Bo4G5eJc8zuQseNxTA,18682 +spacy/tests/serialize/test_serialize_doc.py,sha256=afu1kWRW5_LLQ0sxO2yeEs_vVW2E8tHLPNcvcqKY-L4,7595 +spacy/tests/serialize/test_serialize_docbin.py,sha256=ZNMcwlDE8__hRWqNtPObe8ENujznsi1oT8VokD2rAxo,4141 +spacy/tests/serialize/test_serialize_extension_attrs.py,sha256=LdvaNO-al2FfpBBHNgi33-6Q7E3Dw10gmkirDkuINas,1142 +spacy/tests/serialize/test_serialize_kb.py,sha256=nbltJZqiVe-D9FQ06Cl9YuXkaBD6V2M8kmluETwA19E,7263 +spacy/tests/serialize/test_serialize_language.py,sha256=nl3vjRt7qf0x02MwGuxEpoM1Q7cHQB4NYjtp_n3oZOo,3729 +spacy/tests/serialize/test_serialize_pipeline.py,sha256=9COMLonx0SlWncobdoZnCQngQp0FaDUcgmQf-_nglvA,17317 +spacy/tests/serialize/test_serialize_span_groups.py,sha256=y3DDgaQzY7hrn-GX1J1RNWJJjViQRDVGDHQkJHCrPFA,8929 +spacy/tests/serialize/test_serialize_tokenizer.py,sha256=rPQIr-fn72sVNSUoxnxCDYmrT3dsKk-6wo2qKUb1sl0,5594 +spacy/tests/serialize/test_serialize_vocab_strings.py,sha256=1M2AaQgAaDaGPSr1swKLo1QrpZIR_C11Jol_Us9ph24,7262 +spacy/tests/test_architectures.py,sha256=wninXT5UFQQMF24XXyHqkdwLnVFU4DNWvTKnW5juCfk,464 +spacy/tests/test_cli.py,sha256=OBuoG2RJcfmLvBJFQUfx2ZmLAEv8IX9pC2PlnDybR84,41971 +spacy/tests/test_cli_app.py,sha256=hbVWOKmUdRXJ26t76EMSWA0zKdrKH2T_zn1zHMWzOA4,14414 +spacy/tests/test_displacy.py,sha256=1fmajhROp_r2I3vza1yNtmzshmmD3AcqBKNjFm5K4qQ,18264 +spacy/tests/test_errors.py,sha256=awSfQ69K1XuL4X82-pfjRbJg4kMoeqnJvPTl1LoTkEI,349 +spacy/tests/test_factory_imports.py,sha256=aOQREHrtQbMUzdHPMyZGLPt0gfyaBlrSwKVM9DpnXEk,3946 +spacy/tests/test_factory_registrations.py,sha256=iqP8jPZajXdsQ4QBimnpBtOKGh-VPoPs1L-ZkkuNXpY,3105 +spacy/tests/test_language.py,sha256=klyu5iI_FAz7kUM9Q8EDGBXGLhl3XInkt-CNlBJLmms,27822 +spacy/tests/test_misc.py,sha256=6cmg0jlwjVk0eKsdcwZ8nT7cvl3ZUrR9RuEY2xgKek4,15994 +spacy/tests/test_models.py,sha256=BCRBmDttIhWigTj6PPYYND3gcPcd_VFW7CamNzy5FOk,9892 +spacy/tests/test_pickles.py,sha256=0IcG2ThqN_D6v6my6qw5OM-RCSFFEfIDT0PEb4ne73k,2085 +spacy/tests/test_registry_population.py,sha256=LJZYILs1y-oVjQ-i4LK4_yQhIkOOfW_qfoicn5SNqKI,1965 +spacy/tests/test_scorer.py,sha256=QJzu80S8Kg20wYPww-EmnSrb21_zS-IaUIzGOgDds78,18015 +spacy/tests/test_ty.py,sha256=76nkWHSDlnw3hAuVr5GHOratmXxqf-N_lz4Ah5E9xOg,766 +spacy/tests/tok2vec.py,sha256=oPgtxVA284eqbqCORCDP0k1u77v-fTnJ6YKI0mjiPDA,1037 +spacy/tests/tokenizer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/tokenizer/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/tokenizer/__pycache__/test_exceptions.cpython-312.pyc,, +spacy/tests/tokenizer/__pycache__/test_explain.cpython-312.pyc,, +spacy/tests/tokenizer/__pycache__/test_naughty_strings.cpython-312.pyc,, +spacy/tests/tokenizer/__pycache__/test_tokenizer.cpython-312.pyc,, +spacy/tests/tokenizer/__pycache__/test_urls.cpython-312.pyc,, +spacy/tests/tokenizer/__pycache__/test_whitespace.cpython-312.pyc,, +spacy/tests/tokenizer/sun.txt,sha256=kP35baZeinL_9jG7WR06vfnjJtnGN4nDDkuWeJiiWJU,2595 +spacy/tests/tokenizer/test_exceptions.py,sha256=VfDAgzhg8L3Uqv08uUhb8ev8FXLYUS9aSM-iLG50sNk,1811 +spacy/tests/tokenizer/test_explain.py,sha256=qpQ7gqeGNFHtTCiQOLemGBklmAut_Og4dKAg-jNO7OU,5586 +spacy/tests/tokenizer/test_naughty_strings.py,sha256=twv3xOvYq2ZKpy1BpcTso8aR4-zHWHfV5Q92qEKLfF4,7581 +spacy/tests/tokenizer/test_tokenizer.py,sha256=b-_j_pdTQKNHHyqB7fDCnjThKq0h9aCbVbJCAeogv0w,19145 +spacy/tests/tokenizer/test_urls.py,sha256=nv4KiRkSTWuvpUe_UX5IHjiFKPfhdA1KsGlkUZkzen0,6667 +spacy/tests/tokenizer/test_whitespace.py,sha256=icALPI0Nq5vhcPXl2DS0xBU5KZ1nLm40Ngb8X86EU4A,1340 +spacy/tests/training/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/training/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/training/__pycache__/test_augmenters.cpython-312.pyc,, +spacy/tests/training/__pycache__/test_corpus.cpython-312.pyc,, +spacy/tests/training/__pycache__/test_logger.cpython-312.pyc,, +spacy/tests/training/__pycache__/test_new_example.cpython-312.pyc,, +spacy/tests/training/__pycache__/test_pretraining.cpython-312.pyc,, +spacy/tests/training/__pycache__/test_readers.cpython-312.pyc,, +spacy/tests/training/__pycache__/test_rehearse.cpython-312.pyc,, +spacy/tests/training/__pycache__/test_training.cpython-312.pyc,, +spacy/tests/training/test_augmenters.py,sha256=WIHLelHutX9Yc6g4jWpV_naB89D9oNqvBIRjrv4Z9rA,10803 +spacy/tests/training/test_corpus.py,sha256=VLEFfkaxXS6KdZ5GUf2C32ccC3K21g3RJXURtCpZ9Dc,2021 +spacy/tests/training/test_logger.py,sha256=HQl8z647uCsShdsW556rYSCclQmArSNfy-YiC0z4Ez8,630 +spacy/tests/training/test_new_example.py,sha256=6UU9HqrdVO9CMYjw5H4pL0wkVtWUSynGSRH1ihDll9k,16618 +spacy/tests/training/test_pretraining.py,sha256=R6yysZd2hUJ1YlFcFBAjtvTbau0eeixfQNL46h58ZMM,12446 +spacy/tests/training/test_readers.py,sha256=w5zJjQnBmGXasEB2eupoWW_BaE9JDFVFWIf6dFMeDOc,4071 +spacy/tests/training/test_rehearse.py,sha256=ZMxptffVTHSYMgAiNhQYQ0GHv-R5xih6VT6NMelYXJw,6616 +spacy/tests/training/test_training.py,sha256=rHt2orTH0EczxREdYWTlLfFfADj7GaIEoA1X5Wj3kzU,46713 +spacy/tests/util.py,sha256=n-i7P8P29K_aWv1v1guAzLwGkliGbDyglej13MyYy8U,3385 +spacy/tests/vocab_vectors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tests/vocab_vectors/__pycache__/__init__.cpython-312.pyc,, +spacy/tests/vocab_vectors/__pycache__/test_lexeme.cpython-312.pyc,, +spacy/tests/vocab_vectors/__pycache__/test_lookups.cpython-312.pyc,, +spacy/tests/vocab_vectors/__pycache__/test_memory_zone.cpython-312.pyc,, +spacy/tests/vocab_vectors/__pycache__/test_similarity.cpython-312.pyc,, +spacy/tests/vocab_vectors/__pycache__/test_stringstore.cpython-312.pyc,, +spacy/tests/vocab_vectors/__pycache__/test_vectors.cpython-312.pyc,, +spacy/tests/vocab_vectors/__pycache__/test_vocab_api.cpython-312.pyc,, +spacy/tests/vocab_vectors/test_lexeme.py,sha256=Uqw3UCUkGoSxXyEpun8A3u2g_8qclAZI3dLWRpI0Jaw,2937 +spacy/tests/vocab_vectors/test_lookups.py,sha256=UIOM2DK6e-Y0zRyQiYGNwLrJ13TGTqQTmWaedxkhFyw,4794 +spacy/tests/vocab_vectors/test_memory_zone.py,sha256=JNr8NTr2JzZzDTOcb8648rZOZNAM5ZozaoP9Z22KUpk,941 +spacy/tests/vocab_vectors/test_similarity.py,sha256=P0UmldkrNa3wgO5yozSYh0lGSmCQjbD38bl7UFIPif0,3946 +spacy/tests/vocab_vectors/test_stringstore.py,sha256=KW4mBSkEeL_8Dj2eyEAV0qRGRSPLZNPh3SQnxn43DSU,3437 +spacy/tests/vocab_vectors/test_vectors.py,sha256=iuWuOEClw1ASLfc6Kj5LZ0INMc-iftwhgKVj7DygEuc,24492 +spacy/tests/vocab_vectors/test_vocab_api.py,sha256=QyP0270Qia-BigyPqr9YxVvXIXMH1om0xvy3hbZshT0,2231 +spacy/tokenizer.cp312-win_amd64.pyd,sha256=PKw1Pj1Fn58EmZX3y0ApnmR5wrzwapHRV8UK_Y0Mdk8,300544 +spacy/tokenizer.cpp,sha256=2Da2ki82wToQmr_Pr4IJMLcTUjHn0Xl-7Lxt-7U7jlw,2291167 +spacy/tokenizer.pxd,sha256=c44eqf-5D-mQMm7w6MOheCDWmbUKM3-LF54UF8jnCUY,2304 +spacy/tokenizer.pyx,sha256=wxcGr2wM18S6nAbnHf1xxe4CA6KIA87OJ3jla2VYt8M,37652 +spacy/tokens/__init__.pxd,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/tokens/__init__.py,sha256=EFMegQPp3oDrCMXLEnJ2-vqOhmSk-CeYe1J336dP1CU,259 +spacy/tokens/__pycache__/__init__.cpython-312.pyc,, +spacy/tokens/__pycache__/_dict_proxies.cpython-312.pyc,, +spacy/tokens/__pycache__/_serialize.cpython-312.pyc,, +spacy/tokens/__pycache__/underscore.cpython-312.pyc,, +spacy/tokens/_dict_proxies.py,sha256=7dmU5yJSIOwKtnSXGG783UjAYTjcQjKu6NFnGwKzS90,4625 +spacy/tokens/_retokenize.cp312-win_amd64.pyd,sha256=LH-3UD-wKHqvHBs2spBn8sRiGUSWzJAYh6ypIvKyfJA,216064 +spacy/tokens/_retokenize.cpp,sha256=xQLNRV7NQRnlNy4p-O9rdycEAqg9bunMdMbP3oP3q3s,1887369 +spacy/tokens/_retokenize.pyi,sha256=sXUAjADL1mgc9oepMebnQJkZUwI2yAPI9UtTt9nWWIc,725 +spacy/tokens/_retokenize.pyx,sha256=bYMZfBM8YGxE4cycu3n_GZmU9sg5FW3LUTUREZDsbVY,20885 +spacy/tokens/_serialize.py,sha256=bAOQv5sdN7_UWsrDL-jBRxTE5SlPgBuKb4YnXipvaKU,12298 +spacy/tokens/doc.cp312-win_amd64.pyd,sha256=epB34ujgxsKnIGL5i28EXY8zfdoxUXpYIWfHAMexf4I,515584 +spacy/tokens/doc.cpp,sha256=Upaq1YGsHJD3yRopO_UCz4fUvJM6xHh4M9tjXHxgm_U,3734631 +spacy/tokens/doc.pxd,sha256=A5gYPyhsLgRuJHJT--GZbcBXGhe4t30Ln-P4ZuQEtRc,1754 +spacy/tokens/doc.pyi,sha256=uBflZV7JZr76IobMDXK6mCn3_VKuLt1jrujl9WnJAEc,6329 +spacy/tokens/doc.pyx,sha256=GLTbqr05wZplS1QFOkdLJ0VEXxw8U9k2fcjaNzvtH_o,85347 +spacy/tokens/graph.cp312-win_amd64.pyd,sha256=ZOYM24h1rgwR0TnLPpQzOG65zQgWQ2R6OkDcpcjt7ek,200704 +spacy/tokens/graph.cpp,sha256=QVPRGzxja0lZuezfxpDZxfYMGS5iyq9Z4eGX0TmmCzE,1439497 +spacy/tokens/graph.pxd,sha256=KcX4zjsN9AC57AsXr5PO1kIIT7ZJ2nNiWgdHT9cylG0,310 +spacy/tokens/graph.pyx,sha256=SVH8J5vXdCJFXTCL3VfMUnxy3SSI7K2KkdhtmdDrAGA,23620 +spacy/tokens/morphanalysis.cp312-win_amd64.pyd,sha256=w8YEVCfMqUXOLQAgSiBCijNva88O4YhkiEQhZ5Mqpag,77312 +spacy/tokens/morphanalysis.cpp,sha256=c4uLwnldfpCPwmNyLD_Rn4xUK8UBKPyAPGwOKXc4XmA,753323 +spacy/tokens/morphanalysis.pxd,sha256=EPtB6tCP6ReQLSTIm8wCPqmlXfwM7gVy_VATr3VfmK4,218 +spacy/tokens/morphanalysis.pyi,sha256=zMBBItLGUzYCvqd4edXj-0JDIuMI347KP9oIGLKTdh8,882 +spacy/tokens/morphanalysis.pyx,sha256=HzFVh4er3CueJ6UdDEMqnr86iXHw5hsgnpPIHDL9BJY,3108 +spacy/tokens/span.cp312-win_amd64.pyd,sha256=4cQwjWt38sFTG-YDKPXf0aafzr6YQqVuysKNYi2l7ew,287232 +spacy/tokens/span.cpp,sha256=l7JmQvTRKQ-4P4E393bpUicmeXP7SlCga3aoh6cdKAg,2280775 +spacy/tokens/span.pxd,sha256=7iIQnVxur6yVBcw3qlwFf8OfDJkEjVu3UjpjxfjBzeI,546 +spacy/tokens/span.pyi,sha256=Tq_u1CeCZKzVXJRC2QBjQyzuC7oL-MVsgGO6vLE_2_A,4059 +spacy/tokens/span.pyx,sha256=BV94bzWz2HtIyfT-CUjDaMhQdyytfEI58iNKJGYADXM,34542 +spacy/tokens/span_group.cp312-win_amd64.pyd,sha256=EghrtK2qxIsB1fsIGIXEjiU_3WoRkGORP2UvS23_iJ4,202240 +spacy/tokens/span_group.cpp,sha256=tH88PCWyFu75EOK6uJGVlyxPt8Ahd-ajfb-MOXEJW5g,1663065 +spacy/tokens/span_group.pxd,sha256=mIvYUGEbN3L0ADyX5BG06U-oLawZjahFyhqvFV1K1lQ,258 +spacy/tokens/span_group.pyi,sha256=InJCWf1zR7TXYEMatvApWdRV2_GmzGSNT8fQgMA_dY8,893 +spacy/tokens/span_group.pyx,sha256=K1G1if0Ncov9no0tp2TPWNitSHeMRPx3Bc_WvmtG0R4,12021 +spacy/tokens/token.cp312-win_amd64.pyd,sha256=DtXSmwVb3xy6ySzNspN0TldcUzjY4GsoZPEi6KgIu1c,251392 +spacy/tokens/token.cpp,sha256=cR9yXeDd9ZSmB-4XNsHeJpzE6SKBPKJ3YDSzHUFYe2Q,2183369 +spacy/tokens/token.pxd,sha256=-7mq390cJHmuhH_7drmhoXp_7QB5qikpnrnXAoYNlnM,3569 +spacy/tokens/token.pyi,sha256=AaYzyJ2lEh-V0z8ixwurR7cUwzu6FTwVDWd3IOOy26g,5756 +spacy/tokens/token.pyx,sha256=ZOMpbBHkvpCOZhV9sT0QglbFO7SDmVKPxwT1362ar0Y,34455 +spacy/tokens/underscore.py,sha256=-QrFZVnTCSBWJx48DYnQJhWn_xcxaXCQSHSFzBcL6PA,5729 +spacy/training/__init__.pxd,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy/training/__init__.py,sha256=-DorNoEVRmsbIitNQkM5OYKJNH3TqmazFgn7nKSFVUA,1345 +spacy/training/__pycache__/__init__.cpython-312.pyc,, +spacy/training/__pycache__/alignment.cpython-312.pyc,, +spacy/training/__pycache__/augment.cpython-312.pyc,, +spacy/training/__pycache__/batchers.cpython-312.pyc,, +spacy/training/__pycache__/callbacks.cpython-312.pyc,, +spacy/training/__pycache__/corpus.cpython-312.pyc,, +spacy/training/__pycache__/initialize.cpython-312.pyc,, +spacy/training/__pycache__/iob_utils.cpython-312.pyc,, +spacy/training/__pycache__/loggers.cpython-312.pyc,, +spacy/training/__pycache__/loop.cpython-312.pyc,, +spacy/training/__pycache__/pretrain.cpython-312.pyc,, +spacy/training/align.cp312-win_amd64.pyd,sha256=2etO4Y5W5mDGlhXBODVrc4u4Sx1SDXmKJM58jtOT7ew,68608 +spacy/training/align.cpp,sha256=Zaq8i5SGTxNqXt1yI9Kkvmd5m7RLdZ8k1M2rLnWdG60,526525 +spacy/training/align.pyx,sha256=Nbquxj8PYZC3b0oTuZzcN7ZThzrRReBZfkIq4WFRagQ,3367 +spacy/training/alignment.py,sha256=5l1Ztzajrdlv8bDdoEKUQaiA9JYHiBJD2zwBZxTwB7Y,636 +spacy/training/alignment_array.cp312-win_amd64.pyd,sha256=oprWhlQLx0UsvlNWymhKek35gGMj_zREOYTeqrRRB1E,60416 +spacy/training/alignment_array.cpp,sha256=pHtm3yyvdglnFm5SzKOuDQYrHAC1IPQUH9Ldr_Ko11w,620997 +spacy/training/alignment_array.pxd,sha256=vQ0-tboV53_orhuT80VeiYs6En3M7k96MTWZXtgTxSE,179 +spacy/training/alignment_array.pyx,sha256=wi3o1Ci4kWZ4_knX__oeoZv5VhpaFecCfCC6qT_-KUk,2233 +spacy/training/augment.py,sha256=nc4kG9FjEXIGPQdlragqX6_gam3MU32FowTvW5e_Nyk,13463 +spacy/training/batchers.py,sha256=JhCjZZLsMg-hmiAJTnUpDWSkSfkz7DBvfCUN7fhz1QA,9227 +spacy/training/callbacks.py,sha256=zbhHERd4DU9UNm52IEbqwZ3zk0atunKyeqvcNDgP1MU,1293 +spacy/training/converters/__init__.py,sha256=il9NHMm0-WhfxbW5o03PPj4rcEm17gIe-k_xNPc12xg,228 +spacy/training/converters/__pycache__/__init__.cpython-312.pyc,, +spacy/training/converters/__pycache__/conll_ner_to_docs.cpython-312.pyc,, +spacy/training/converters/__pycache__/conllu_to_docs.cpython-312.pyc,, +spacy/training/converters/__pycache__/iob_to_docs.cpython-312.pyc,, +spacy/training/converters/__pycache__/json_to_docs.cpython-312.pyc,, +spacy/training/converters/conll_ner_to_docs.py,sha256=IP1VOK84aYNK1k7pHx-uQimR7y50qeoZz9Ofpiwrxvs,6348 +spacy/training/converters/conllu_to_docs.py,sha256=TEVmvjMp0g-laKKl6O-cUn_PSpKWlfHn_DwC4N8b3oc,10582 +spacy/training/converters/iob_to_docs.py,sha256=-xUHWyHd8Kmmbor8p9ZCsYXtRuHKrmdbKNDnGxcJPok,2418 +spacy/training/converters/json_to_docs.py,sha256=VmYoaSfEVJeQ-v0o0U_owV4sPuDAfPDYIFA6ITHXT4w,904 +spacy/training/corpus.py,sha256=o3eyUxcPLWoDasIsAxDrUqeILKZPAzLPRmcpw73QMY4,12308 +spacy/training/example.cp312-win_amd64.pyd,sha256=A98EEK3JlpQYW3eYq7KvN4rtoN8f050pXr9VZM0hN4k,303616 +spacy/training/example.cpp,sha256=hgdz0yeKjMr5fxohah4Wwq-ir2N7s9w3FLYu6R1ZyBY,2390105 +spacy/training/example.pxd,sha256=bicPNu-jB2PsaJGu_xTqXz56lVxhnsE5P0ztROALDCA,341 +spacy/training/example.pyi,sha256=0ctIRMeuWwFyUStgZroK-FC9DbV-VJjcKBBjlHdFt9o,2082 +spacy/training/example.pyx,sha256=KpQ5Iz74voxF5ArrUXwFd7QIKk4ne8Efh2aiqIJYU4g,25476 +spacy/training/gold_io.cp312-win_amd64.pyd,sha256=W4gCL-zb3SBjjUgNqdR5bMT5mItyRtGp-2BV9z2ivmA,103424 +spacy/training/gold_io.cpp,sha256=St-e47B4mW5MhN6wgYMDaL6F32WjBNPj2Ym6KsFOLAA,751030 +spacy/training/gold_io.pyx,sha256=81WUV_DSdyGo0Tle3XGeqbJzz16OOQHw1jPWDVTl09Y,8466 +spacy/training/initialize.py,sha256=Q9r-K8wo7VGMusaItyiBUrq0C8wzA8C3XXCNOVFNgu8,14506 +spacy/training/iob_utils.py,sha256=Dsrxr3R4ybPXVt6pKXvGJ2DbxKiSwkxcTTlcSf9Ghyg,9315 +spacy/training/loggers.py,sha256=ZlZQ-ZySTn5qk6-TePOGvYzuH8nr9UXFWHZU-Es_AHs,7929 +spacy/training/loop.py,sha256=T8RxAh6fjCsspdbIgQ-C8g4OXqiwggElYAGTwiVdSy0,15416 +spacy/training/pretrain.py,sha256=ONT-oPgLUKOwU8jrVSdGKxJW0ZK76d4TrB5ClIiGwH0,9970 +spacy/ty.py,sha256=vYrUorOI_8yXFRqObLFSk1UouXRdqUKcxUMhjtnrE2c,1356 +spacy/typedefs.pxd,sha256=Wbphm-PgPqAazRJU9KpiVZ960sujaTWIhF5O80i2rH8,267 +spacy/typedefs.pyx,sha256=BHrIYTbTg0wPXDU4nEu7Ep0XlDEAfwyyZzHZlzdkFeA,25 +spacy/util.py,sha256=bu-hU2B9ni7pHQZTwitkGWpJVgWbAQamauPusGlj3V4,70355 +spacy/vectors.cp312-win_amd64.pyd,sha256=JlS7LrX78FqccuCD7r5_BVAZ__LT_n-vvGVSO1ebzK8,272896 +spacy/vectors.cpp,sha256=7QUNR5ff-V9miodXXhBsexUti5wS27sztf1wW0ZJj3g,1718346 +spacy/vectors.pyx,sha256=XOwmPmo8nzA4YuLYYvLU7J8ulIr7CGwGZSdwliNlyRE,29033 +spacy/vocab.cp312-win_amd64.pyd,sha256=fXe18CTSqtwUixXEMWfUQ2gTytchjtJF5SiFw2Ovg48,287232 +spacy/vocab.cpp,sha256=_s7Ve2BpMVGG-0TuMz07Kple17ha3dlad1JZi7EfLs4,2226031 +spacy/vocab.pxd,sha256=ayKvYuqFsCBecFN922rNBjNyewjy4VmDTsBp5ljLAAY,1512 +spacy/vocab.pyi,sha256=KGx1kwHou3Na28L5poT4dDTUfaCAWhE5lUmKBXe7d9s,2984 +spacy/vocab.pyx,sha256=Ya2gkRbWh2HLHjXg0qAp1dRPzW5i3Zl1fqRgmSCtvwg,26713 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..10ac2c23843796b65786bc9aba179a906c8bcc88 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: false +Tag: cp312-cp312-win_amd64 + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..132c9df314a33a93c2ddb5e3d1780eaa9695a163 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +spacy = spacy.cli:setup_cli diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..568e4fc634a8aa91913507327733d895947767ef --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy-3.8.11.dist-info/top_level.txt @@ -0,0 +1 @@ +spacy diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/__init__.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/__init__.pxd new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d5c68ede78e8a91e79d7c59e381ab5da36ba6d8e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/__init__.py @@ -0,0 +1,80 @@ +import sys +from pathlib import Path +from typing import Any, Dict, Iterable, Union + +# set library-specific custom warning handling before doing anything else +from .errors import setup_default_warnings + +setup_default_warnings() # noqa: E402 + +# These are imported as part of the API +from thinc.api import Config, prefer_gpu, require_cpu, require_gpu # noqa: F401 + +from . import pipeline # noqa: F401 +from . import util +from .about import __version__ # noqa: F401 +from .cli.info import info # noqa: F401 +from .errors import Errors +from .glossary import explain # noqa: F401 +from .language import Language +from .registrations import REGISTRY_POPULATED, populate_registry +from .util import logger, registry # noqa: F401 +from .vocab import Vocab + +if sys.maxunicode == 65535: + raise SystemError(Errors.E130) + + +def load( + name: Union[str, Path], + *, + vocab: Union[Vocab, bool] = True, + disable: Union[str, Iterable[str]] = util._DEFAULT_EMPTY_PIPES, + enable: Union[str, Iterable[str]] = util._DEFAULT_EMPTY_PIPES, + exclude: Union[str, Iterable[str]] = util._DEFAULT_EMPTY_PIPES, + config: Union[Dict[str, Any], Config] = util.SimpleFrozenDict(), +) -> Language: + """Load a spaCy model from an installed package or a local path. + + name (str): Package name or model path. + vocab (Vocab): A Vocab object. If True, a vocab is created. + disable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to disable. Disabled + pipes will be loaded but they won't be run unless you explicitly + enable them by calling nlp.enable_pipe. + enable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to enable. All other + pipes will be disabled (but can be enabled later using nlp.enable_pipe). + exclude (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to exclude. Excluded + components won't be loaded. + config (Dict[str, Any] / Config): Config overrides as nested dict or dict + keyed by section values in dot notation. + RETURNS (Language): The loaded nlp object. + """ + return util.load_model( + name, + vocab=vocab, + disable=disable, + enable=enable, + exclude=exclude, + config=config, + ) + + +def blank( + name: str, + *, + vocab: Union[Vocab, bool] = True, + config: Union[Dict[str, Any], Config] = util.SimpleFrozenDict(), + meta: Dict[str, Any] = util.SimpleFrozenDict(), +) -> Language: + """Create a blank nlp object for a given language code. + + name (str): The language code, e.g. "en". + vocab (Vocab): A Vocab object. If True, a vocab is created. + config (Dict[str, Any] / Config): Optional config overrides. + meta (Dict[str, Any]): Overrides for nlp.meta. + RETURNS (Language): The nlp object. + """ + LangClass = util.get_lang_class(name) + # We should accept both dot notation and nested dict here for consistency + config = util.dot_to_dict(config) + return LangClass.from_config(config, vocab=vocab, meta=meta) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/__main__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..5e3146cd67a963a6ca4c083195334914717ad62b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/__main__.py @@ -0,0 +1,4 @@ +if __name__ == "__main__": + from spacy.cli import setup_cli + + setup_cli() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/about.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/about.py new file mode 100644 index 0000000000000000000000000000000000000000..23cde0b5e7fe78e1da082d270fc7d77b6398c13f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/about.py @@ -0,0 +1,5 @@ +# fmt: off +__title__ = "spacy" +__version__ = "3.8.11" +__download_url__ = "https://github.com/explosion/spacy-models/releases/download" +__compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/attrs.cp312-win_amd64.pyd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/attrs.cp312-win_amd64.pyd new file mode 100644 index 0000000000000000000000000000000000000000..889b738c45bd837946261248a19d9c7784dd8f05 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/attrs.cp312-win_amd64.pyd differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/attrs.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/attrs.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fc6bcfae933fbd9c0457f1ffec7bf6438f399512 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/attrs.cpp @@ -0,0 +1,12015 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.attrs", + "sources": [ + "spacy/attrs.pyx" + ] + }, + "module_name": "spacy.attrs" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +/* InitLimitedAPI */ +#if defined(Py_LIMITED_API) + #if !defined(CYTHON_LIMITED_API) + #define CYTHON_LIMITED_API 1 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef _MSC_VER + #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") + #else + #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. + #endif +#endif + +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x03080000 + #error Cython requires Python 3.8+. +#else +#define __PYX_ABI_VERSION "3_2_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* CModulePreamble */ +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#define __PYX_COMMA , +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) + #endif + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 1 + #endif + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #ifdef Py_GIL_DISABLED + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 + #else + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #endif + #if PY_VERSION_HEX < 0x030A0000 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #elif !defined(CYTHON_USE_TYPE_SLOTS) + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLIST_INTERNALS) + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #elif !defined(CYTHON_FAST_GIL) + #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #ifndef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif + #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work + #elif !defined(CYTHON_IMMORTAL_CONSTANTS) + #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif +#endif +#ifndef CYTHON_COMPRESS_STRINGS + #define CYTHON_COMPRESS_STRINGS 1 +#endif +#ifndef CYTHON_FAST_PYCCALL +#define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL +#endif +#ifndef CYTHON_VECTORCALL +#if CYTHON_COMPILING_IN_LIMITED_API +#define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) +#else +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) +#endif +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#include +typedef uintptr_t __pyx_uintptr_t; +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif +#ifndef Py_UNREACHABLE + #define Py_UNREACHABLE() assert(0); abort() +#endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* PythonCompatibility */ +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#define __Pyx_BUILTIN_MODULE_NAME "builtins" +#define __Pyx_DefaultClassType PyType_Type +#if CYTHON_COMPILING_IN_LIMITED_API + #ifndef CO_OPTIMIZED + static int CO_OPTIMIZED; + #endif + #ifndef CO_NEWLOCALS + static int CO_NEWLOCALS; + #endif + #ifndef CO_VARARGS + static int CO_VARARGS; + #endif + #ifndef CO_VARKEYWORDS + static int CO_VARKEYWORDS; + #endif + #ifndef CO_ASYNC_GENERATOR + static int CO_ASYNC_GENERATOR; + #endif + #ifndef CO_GENERATOR + static int CO_GENERATOR; + #endif + #ifndef CO_COROUTINE + static int CO_COROUTINE; + #endif +#else + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 + #endif +#endif +static int __Pyx_init_co_variables(void); +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif +#ifndef Py_TPFLAGS_IMMUTABLETYPE + #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) +#endif +#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION + #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) +#endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#ifndef METH_FASTCALL + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #if PY_VERSION_HEX >= 0x030d00A4 + # define __Pyx_PyCFunctionFast PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords + #else + # define __Pyx_PyCFunctionFast _PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords + #endif +#endif +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX >= 0x030900B1 +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) +#else +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) +#endif +#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) +#elif !CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) +static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { + return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; +} +#endif +static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; +#else + return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +#endif +} +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) +#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) +#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) +#elif CYTHON_COMPILING_IN_GRAAL + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#endif +#if CYTHON_USE_MODULE_STATE +static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) +#else +#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) +#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) +#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) + #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) + #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ + ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ + (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ + __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) + #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) + #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) +#endif +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) +#endif +#define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) +#if CYTHON_USE_TYPE_SPECS +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE((PyObject*)obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#else + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #else + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #endif +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif +#endif +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#elif CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) +#endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif +enum __Pyx_ReferenceSharing { + __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check + __Pyx_ReferenceSharing_OwnStrongReference, + __Pyx_ReferenceSharing_FunctionArgument, + __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar +}; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ + (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ + (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ + (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) +#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) +#else +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) +#endif +#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) + #else + #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) + #endif +#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) + #endif +#else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) +#endif +#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ + __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) +#else + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) +#endif +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyObject_GetItem(dict, key); + if (*result == NULL) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + return 0; + } + return -1; + } + return 1; +} +#else +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyDict_GetItemWithError(dict, key); + if (*result == NULL) { + return PyErr_Occurred() ? -1 : 0; + } + Py_INCREF(*result); + return 1; +} +#endif +#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST + #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) +#else + #define __Pyx_VISIT_CONST(obj) +#endif +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) +#else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) +#endif +#if CYTHON_ASSUME_SAFE_SIZE + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) +#else + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) +#endif +#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t +#define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t +#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 + #define __Pyx_PySendResult PySendResult +#else + typedef enum { + PYGEN_RETURN = 0, + PYGEN_ERROR = -1, + PYGEN_NEXT = 1, + } __Pyx_PySendResult; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 + typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); +#else + #define __Pyx_pyiter_sendfunc sendfunc +#endif +#if !CYTHON_USE_AM_SEND +#define __PYX_HAS_PY_AM_SEND 0 +#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 +#define __PYX_HAS_PY_AM_SEND 1 +#else +#define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation +#endif +#if __PYX_HAS_PY_AM_SEND < 2 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods +#else + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + __Pyx_pyiter_sendfunc am_send; + } __Pyx_PyAsyncMethodsStruct; + #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) +#endif +#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 + #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) +#else + #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) +#endif +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() +#else +#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 +#ifdef __cplusplus +extern "C" +#endif +PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { + int value; + PyObject *py_value = PyObject_GetAttrString(inspect, name); + if (!py_value) return 0; + value = (int) PyLong_AsLong(py_value); + Py_DECREF(py_value); + *write_to = value; + return value != -1 || !PyErr_Occurred(); +} +static int __Pyx_init_co_variables(void) { + PyObject *inspect; + int result; + inspect = PyImport_ImportModule("inspect"); + result = +#if !defined(CO_OPTIMIZED) + __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && +#endif +#if !defined(CO_NEWLOCALS) + __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && +#endif +#if !defined(CO_VARARGS) + __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && +#endif +#if !defined(CO_VARKEYWORDS) + __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && +#endif +#if !defined(CO_ASYNC_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && +#endif +#if !defined(CO_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && +#endif +#if !defined(CO_COROUTINE) + __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && +#endif + 1; + Py_DECREF(inspect); + return result ? 0 : -1; +} +#else +static int __Pyx_init_co_variables(void) { + return 0; // It's a limited API-only feature +} +#endif + +/* MathInitCode */ +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #ifndef _USE_MATH_DEFINES + #define _USE_MATH_DEFINES + #endif +#endif +#include +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 +#endif +#ifndef CYTHON_CLINE_IN_TRACEBACK +#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#endif +#if CYTHON_CLINE_IN_TRACEBACK +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } +#else +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } +#endif +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__attrs +#define __PYX_HAVE_API__spacy__attrs +/* Early includes */ +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) +#else + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) +#endif +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) + return Py_NewRef(obj); +#else + Py_INCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) + return Py_XNewRef(obj); +#else + Py_XINCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) +#else +#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) +#endif +#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) +#else + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +/* PretendToInitialize */ +#ifdef __cplusplus +#if __cplusplus > 201103L +#include +#endif +template +static void __Pyx_pretend_to_initialize(T* ptr) { +#if __cplusplus > 201103L + if ((std::is_trivially_default_constructible::value)) +#endif + *ptr = T(); + (void)ptr; +} +#else +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#endif + + +#if !CYTHON_USE_MODULE_STATE +static PyObject *__pyx_m = NULL; +#endif +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * const __pyx_cfilenm = __FILE__; +static const char *__pyx_filename; + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/attrs.pyx", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* Atomics.proto (used by UnpackUnboundCMethod) */ +#include +#ifndef CYTHON_ATOMICS + #define CYTHON_ATOMICS 1 +#endif +#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS +#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __pyx_atomic_int_type int +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_ptr_type atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) atomic_load(value) + #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_ptr_type std::atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) std::atomic_load(value) + #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ + (__GNUC_MINOR__ > 1 ||\ + (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) + #define __pyx_atomic_ptr_type void* + #define __pyx_nonatomic_ptr_type void* + #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) + #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #warning "Using GNU atomics" + #endif +#elif CYTHON_ATOMICS && defined(_MSC_VER) + #include + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type long + #define __pyx_atomic_ptr_type void* + #undef __pyx_nonatomic_int_type + #define __pyx_nonatomic_int_type long + #define __pyx_nonatomic_ptr_type void* + #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) + #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) + #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) + #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value + #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #pragma message ("Using MSVC atomics") + #endif +#else + #undef CYTHON_ATOMICS + #define CYTHON_ATOMICS 0 + #ifdef __PYX_DEBUG_ATOMICS + #warning "Not using atomics" + #endif +#endif + +/* CriticalSectionsDefinition.proto (used by CriticalSections) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection void* +#define __Pyx_PyCriticalSection2 void* +#define __Pyx_PyCriticalSection_End(cs) +#define __Pyx_PyCriticalSection2_End(cs) +#else +#define __Pyx_PyCriticalSection PyCriticalSection +#define __Pyx_PyCriticalSection2 PyCriticalSection2 +#define __Pyx_PyCriticalSection_End PyCriticalSection_End +#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End +#endif + +/* CriticalSections.proto (used by ParseKeywordsImpl) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs) +#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs) +#else +#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin +#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin +#endif +#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_BEGIN_CRITICAL_SECTION(o) { +#define __Pyx_END_CRITICAL_SECTION() } +#else +#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION +#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION +#endif + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "spacy/attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "spacy/attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; +/* #### Code section: utility_code_proto ### */ + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto (used by PyErrFetchRestore) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* TupleAndListFromArray.proto (used by fastcall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +#endif +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto (used by BytesEquals) */ +#include + +/* BytesEquals.proto (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i)) +#else + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i)) +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i]) + #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); + #else + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #endif +#else + #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS +#endif +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start) +#else +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* py_dict_items.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); + +/* CallCFunction.proto (used by CallUnboundCMethod0) */ +#define __Pyx_CallCFunction(cfunc, self, args)\ + ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args) +#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\ + ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs) +#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\ + ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs) +#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ + ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) + +/* PyObjectCall.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto (used by PyObjectCallOneArg) */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); + +/* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ +typedef struct { + PyObject *type; + PyObject **method_name; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS + __pyx_atomic_int_type initialized; +#endif + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) { +#if !CYTHON_ATOMICS + return 1; +#else + __pyx_nonatomic_int_type expected = 0; + if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) { + return 0; + } + return expected; +#endif +} +static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) { +#if CYTHON_ATOMICS + __pyx_atomic_store(&cfunc->initialized, 2); +#endif +} +#else +#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2 +#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc) +#endif + +/* CallUnboundCMethod0.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#else +#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) +#endif + +/* py_dict_values.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); + +/* OwnedDictNext.proto (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue); +#else +CYTHON_INLINE +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue); +#endif + +/* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywordsImpl.export */ +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name +); +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* CallUnboundCMethod2.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); +#else +#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) +#endif + +/* ParseKeywords.proto */ +static CYTHON_INLINE int __Pyx_ParseKeywords( + PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[], + PyObject *kwds2, PyObject *values[], + Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* PyObjectFastCallMethod.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) +#else +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); +#endif + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* PyDictVersioning.proto (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* PyValueError_Check.proto */ +#define __Pyx_PyExc_ValueError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ValueError) + +/* PyObjectVectorCallKwBuilder.proto (used by PyObjectVectorCallMethodKwBuilder) */ +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#if CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall +#endif +#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict +#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) +#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) +#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) +#endif + +/* PyObjectVectorCallMethodKwBuilder.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod +#else +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#endif + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* HasAttr.proto */ +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n) +#else +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +#endif + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* ImportImpl.export */ +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); + +/* Import.proto */ +static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* dict_setdefault.proto (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); + +/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp); +#endif + +/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v); +#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v) + +/* FixUpExtensionType.proto (used by FetchCommonType) */ +static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); + +/* AddModuleRef.proto (used by FetchSharedCythonModule) */ +#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ + __PYX_LIMITED_VERSION_HEX < 0x030d0000) + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); +#else + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#endif + +/* FetchSharedCythonModule.proto (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto (used by CommonTypesMetaclass) */ +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases); + +/* CommonTypesMetaclass.proto (used by CythonFunctionShared) */ +static int __pyx_CommonTypesMetaclass_init(PyObject *module); +#define __Pyx_CommonTypesMetaclass_USED + +/* CallTypeTraverse.proto (used by CythonFunctionShared) */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0 +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg); +#endif + +/* PyMethodNew.proto (used by CythonFunctionShared) */ +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ); + +/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto (used by CythonFunction) */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_dict; +#endif + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + PyObject *defaults; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#undef __Pyx_CyOrPyCFunction_Check +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType) +#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType) +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)); +#undef __Pyx_IsSameCFunction +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, + PyTypeObject *defaults_type); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* ListCompAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + L->ob_item[len] = x; + #else + PyList_SET_ITEM(list, len, x); + #endif + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +/* CLineInTraceback.proto (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#else +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#endif + +/* CodeObjectCache.proto (used by AddTraceback) */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject __Pyx_CachedCodeObjectType; +#else +typedef PyCodeObject __Pyx_CachedCodeObjectType; +#endif +typedef struct { + __Pyx_CachedCodeObjectType* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_int_type accessor_count; + #endif +}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(enum __pyx_t_5spacy_5attrs_attr_id_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* Globals.proto */ +static PyObject* __Pyx_Globals(void); + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#else +static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); +#endif +#else // !LIMITED_API +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { + return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); +} +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +#ifdef PyExceptionInstance_Check + #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) +#else + #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) +#endif + +/* GetRuntimeVersion.proto */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +static unsigned long __Pyx_cached_runtime_version = 0; +static void __Pyx_init_runtime_version(void); +#else +#define __Pyx_init_runtime_version() +#endif +static unsigned long __Pyx_get_runtime_version(void); + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); + +/* DecompressString.proto */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); + +/* MultiPhaseInitModuleState.proto */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +static PyObject *__Pyx_State_FindModule(void*); +static int __Pyx_State_AddModule(PyObject* module, void*); +static int __Pyx_State_RemoveModule(void*); +#elif CYTHON_USE_MODULE_STATE +#define __Pyx_State_FindModule PyState_FindModule +#define __Pyx_State_AddModule PyState_AddModule +#define __Pyx_State_RemoveModule PyState_RemoveModule +#endif + +/* #### Code section: module_declarations ### */ +/* CythonABIVersion.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API + #if CYTHON_METH_FASTCALL + #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" + #else + #define __PYX_FASTCALL_ABI_SUFFIX + #endif + #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#else + #define __PYX_LIMITED_ABI_SUFFIX +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + #define __PYX_AM_SEND_ABI_SUFFIX +#elif __PYX_HAS_PY_AM_SEND == 2 + #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" +#else + #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" +#endif +#ifndef __PYX_MONITORING_ABI_SUFFIX + #define __PYX_MONITORING_ABI_SUFFIX +#endif +#if CYTHON_USE_TP_FINALIZE + #define __PYX_TP_FINALIZE_ABI_SUFFIX +#else + #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" +#endif +#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) + #define __PYX_FREELISTS_ABI_SUFFIX +#else + #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" +#endif +#define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." + + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.attrs" */ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.attrs" +extern int __pyx_module_is_main_spacy__attrs; +int __pyx_module_is_main_spacy__attrs = 0; + +/* Implementation of "spacy.attrs" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_sorted; +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static PyObject *__pyx_lambda_funcdef_5spacy_5attrs_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_item); /* proto */ +static PyObject *__pyx_pf_5spacy_5attrs_intify_attrs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_stringy_attrs, PyObject *__pyx_v_strings_map, PyObject *__pyx_v__do_deprecated); /* proto */ +static PyObject *__pyx_pf_5spacy_5attrs_2intify_attr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name); /* proto */ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +/* SmallCodeConfig */ +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + PyObject *__pyx_tuple[2]; + PyObject *__pyx_codeobj_tab[3]; + PyObject *__pyx_string_tab[185]; +/* #### Code section: module_state_contents ### */ +/* CommonTypesMetaclass.module_state_decls */ +PyTypeObject *__pyx_CommonTypesMetaclassType; + +/* CachedMethodType.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API +PyObject *__Pyx_CachedMethodType; +#endif + +/* CythonFunctionShared.module_state_decls */ +PyTypeObject *__pyx_CyFunctionType; + +/* CodeObjectCache.module_state_decls */ +struct __Pyx_CodeObjectCache __pyx_code_cache; + +/* #### Code section: module_state_end ### */ +} __pyx_mstatetype; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { +extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) + +#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstatetype __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: constant_name_defines ### */ +#define __pyx_kp_u_ __pyx_string_tab[0] +#define __pyx_kp_u__2 __pyx_string_tab[1] +#define __pyx_kp_u__3 __pyx_string_tab[2] +#define __pyx_kp_u_spacy_attrs_pyx __pyx_string_tab[3] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[4] +#define __pyx_n_u_Abbr __pyx_string_tab[5] +#define __pyx_n_u_AdjType __pyx_string_tab[6] +#define __pyx_n_u_AdpType __pyx_string_tab[7] +#define __pyx_n_u_AdvType __pyx_string_tab[8] +#define __pyx_n_u_Animacy __pyx_string_tab[9] +#define __pyx_n_u_Aspect __pyx_string_tab[10] +#define __pyx_n_u_B __pyx_string_tab[11] +#define __pyx_n_u_Case __pyx_string_tab[12] +#define __pyx_n_u_ConjType __pyx_string_tab[13] +#define __pyx_n_u_DEP __pyx_string_tab[14] +#define __pyx_n_u_Degree __pyx_string_tab[15] +#define __pyx_n_u_Derivation __pyx_string_tab[16] +#define __pyx_n_u_E1025 __pyx_string_tab[17] +#define __pyx_n_u_ENT_ID __pyx_string_tab[18] +#define __pyx_n_u_ENT_IOB __pyx_string_tab[19] +#define __pyx_n_u_ENT_KB_ID __pyx_string_tab[20] +#define __pyx_n_u_ENT_TYPE __pyx_string_tab[21] +#define __pyx_n_u_Echo __pyx_string_tab[22] +#define __pyx_n_u_Errors __pyx_string_tab[23] +#define __pyx_n_u_F __pyx_string_tab[24] +#define __pyx_n_u_FLAG19 __pyx_string_tab[25] +#define __pyx_n_u_FLAG20 __pyx_string_tab[26] +#define __pyx_n_u_FLAG21 __pyx_string_tab[27] +#define __pyx_n_u_FLAG22 __pyx_string_tab[28] +#define __pyx_n_u_FLAG23 __pyx_string_tab[29] +#define __pyx_n_u_FLAG24 __pyx_string_tab[30] +#define __pyx_n_u_FLAG25 __pyx_string_tab[31] +#define __pyx_n_u_FLAG26 __pyx_string_tab[32] +#define __pyx_n_u_FLAG27 __pyx_string_tab[33] +#define __pyx_n_u_FLAG28 __pyx_string_tab[34] +#define __pyx_n_u_FLAG29 __pyx_string_tab[35] +#define __pyx_n_u_FLAG30 __pyx_string_tab[36] +#define __pyx_n_u_FLAG31 __pyx_string_tab[37] +#define __pyx_n_u_FLAG32 __pyx_string_tab[38] +#define __pyx_n_u_FLAG33 __pyx_string_tab[39] +#define __pyx_n_u_FLAG34 __pyx_string_tab[40] +#define __pyx_n_u_FLAG35 __pyx_string_tab[41] +#define __pyx_n_u_FLAG36 __pyx_string_tab[42] +#define __pyx_n_u_FLAG37 __pyx_string_tab[43] +#define __pyx_n_u_FLAG38 __pyx_string_tab[44] +#define __pyx_n_u_FLAG39 __pyx_string_tab[45] +#define __pyx_n_u_FLAG40 __pyx_string_tab[46] +#define __pyx_n_u_FLAG41 __pyx_string_tab[47] +#define __pyx_n_u_FLAG42 __pyx_string_tab[48] +#define __pyx_n_u_FLAG43 __pyx_string_tab[49] +#define __pyx_n_u_FLAG44 __pyx_string_tab[50] +#define __pyx_n_u_FLAG45 __pyx_string_tab[51] +#define __pyx_n_u_FLAG46 __pyx_string_tab[52] +#define __pyx_n_u_FLAG47 __pyx_string_tab[53] +#define __pyx_n_u_FLAG48 __pyx_string_tab[54] +#define __pyx_n_u_FLAG49 __pyx_string_tab[55] +#define __pyx_n_u_FLAG50 __pyx_string_tab[56] +#define __pyx_n_u_FLAG51 __pyx_string_tab[57] +#define __pyx_n_u_FLAG52 __pyx_string_tab[58] +#define __pyx_n_u_FLAG53 __pyx_string_tab[59] +#define __pyx_n_u_FLAG54 __pyx_string_tab[60] +#define __pyx_n_u_FLAG55 __pyx_string_tab[61] +#define __pyx_n_u_FLAG56 __pyx_string_tab[62] +#define __pyx_n_u_FLAG57 __pyx_string_tab[63] +#define __pyx_n_u_FLAG58 __pyx_string_tab[64] +#define __pyx_n_u_FLAG59 __pyx_string_tab[65] +#define __pyx_n_u_FLAG60 __pyx_string_tab[66] +#define __pyx_n_u_FLAG61 __pyx_string_tab[67] +#define __pyx_n_u_FLAG62 __pyx_string_tab[68] +#define __pyx_n_u_FLAG63 __pyx_string_tab[69] +#define __pyx_n_u_Foreign __pyx_string_tab[70] +#define __pyx_n_u_Gender __pyx_string_tab[71] +#define __pyx_n_u_HEAD __pyx_string_tab[72] +#define __pyx_n_u_Hyph __pyx_string_tab[73] +#define __pyx_n_u_I __pyx_string_tab[74] +#define __pyx_n_u_ID __pyx_string_tab[75] +#define __pyx_n_u_IDS __pyx_string_tab[76] +#define __pyx_n_u_IDX __pyx_string_tab[77] +#define __pyx_n_u_IOB_STRINGS __pyx_string_tab[78] +#define __pyx_n_u_IS_ALPHA __pyx_string_tab[79] +#define __pyx_n_u_IS_ASCII __pyx_string_tab[80] +#define __pyx_n_u_IS_BRACKET __pyx_string_tab[81] +#define __pyx_n_u_IS_CURRENCY __pyx_string_tab[82] +#define __pyx_n_u_IS_DIGIT __pyx_string_tab[83] +#define __pyx_n_u_IS_LEFT_PUNCT __pyx_string_tab[84] +#define __pyx_n_u_IS_LOWER __pyx_string_tab[85] +#define __pyx_n_u_IS_OOV_DEPRECATED __pyx_string_tab[86] +#define __pyx_n_u_IS_PUNCT __pyx_string_tab[87] +#define __pyx_n_u_IS_QUOTE __pyx_string_tab[88] +#define __pyx_n_u_IS_RIGHT_PUNCT __pyx_string_tab[89] +#define __pyx_n_u_IS_SPACE __pyx_string_tab[90] +#define __pyx_n_u_IS_STOP __pyx_string_tab[91] +#define __pyx_n_u_IS_TITLE __pyx_string_tab[92] +#define __pyx_n_u_IS_UPPER __pyx_string_tab[93] +#define __pyx_n_u_L __pyx_string_tab[94] +#define __pyx_n_u_LANG __pyx_string_tab[95] +#define __pyx_n_u_LEMMA __pyx_string_tab[96] +#define __pyx_n_u_LENGTH __pyx_string_tab[97] +#define __pyx_n_u_LIKE_EMAIL __pyx_string_tab[98] +#define __pyx_n_u_LIKE_NUM __pyx_string_tab[99] +#define __pyx_n_u_LIKE_URL __pyx_string_tab[100] +#define __pyx_n_u_LOWER __pyx_string_tab[101] +#define __pyx_n_u_MORPH __pyx_string_tab[102] +#define __pyx_n_u_Mood __pyx_string_tab[103] +#define __pyx_n_u_NAMES __pyx_string_tab[104] +#define __pyx_n_u_NORM __pyx_string_tab[105] +#define __pyx_n_u_NameType __pyx_string_tab[106] +#define __pyx_n_u_Negative __pyx_string_tab[107] +#define __pyx_n_u_NounType __pyx_string_tab[108] +#define __pyx_n_u_NumForm __pyx_string_tab[109] +#define __pyx_n_u_NumType __pyx_string_tab[110] +#define __pyx_n_u_NumValue __pyx_string_tab[111] +#define __pyx_n_u_Number __pyx_string_tab[112] +#define __pyx_n_u_O __pyx_string_tab[113] +#define __pyx_n_u_ORTH __pyx_string_tab[114] +#define __pyx_n_u_Other __pyx_string_tab[115] +#define __pyx_n_u_POS __pyx_string_tab[116] +#define __pyx_n_u_PREFIX __pyx_string_tab[117] +#define __pyx_n_u_PartType __pyx_string_tab[118] +#define __pyx_n_u_Person __pyx_string_tab[119] +#define __pyx_n_u_Polarity __pyx_string_tab[120] +#define __pyx_n_u_Polite __pyx_string_tab[121] +#define __pyx_n_u_Poss __pyx_string_tab[122] +#define __pyx_n_u_PrepCase __pyx_string_tab[123] +#define __pyx_n_u_PronType __pyx_string_tab[124] +#define __pyx_n_u_PunctSide __pyx_string_tab[125] +#define __pyx_n_u_PunctType __pyx_string_tab[126] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[127] +#define __pyx_n_u_Reflex __pyx_string_tab[128] +#define __pyx_n_u_SENT_START __pyx_string_tab[129] +#define __pyx_n_u_SHAPE __pyx_string_tab[130] +#define __pyx_n_u_SPACY __pyx_string_tab[131] +#define __pyx_n_u_SUFFIX __pyx_string_tab[132] +#define __pyx_n_u_StyleVariant __pyx_string_tab[133] +#define __pyx_n_u_TAG __pyx_string_tab[134] +#define __pyx_n_u_Tense __pyx_string_tab[135] +#define __pyx_n_u_Variant __pyx_string_tab[136] +#define __pyx_n_u_VerbForm __pyx_string_tab[137] +#define __pyx_n_u_VerbType __pyx_string_tab[138] +#define __pyx_n_u_Voice __pyx_string_tab[139] +#define __pyx_n_u_add __pyx_string_tab[140] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[141] +#define __pyx_n_u_class_getitem __pyx_string_tab[142] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[143] +#define __pyx_n_u_do_deprecated __pyx_string_tab[144] +#define __pyx_n_u_errors __pyx_string_tab[145] +#define __pyx_n_u_format __pyx_string_tab[146] +#define __pyx_n_u_func __pyx_string_tab[147] +#define __pyx_n_u_index __pyx_string_tab[148] +#define __pyx_n_u_int_key __pyx_string_tab[149] +#define __pyx_n_u_intify_attr __pyx_string_tab[150] +#define __pyx_n_u_intify_attrs __pyx_string_tab[151] +#define __pyx_n_u_inty_attrs __pyx_string_tab[152] +#define __pyx_n_u_is_coroutine __pyx_string_tab[153] +#define __pyx_n_u_item __pyx_string_tab[154] +#define __pyx_n_u_items __pyx_string_tab[155] +#define __pyx_n_u_key __pyx_string_tab[156] +#define __pyx_n_u_lambda __pyx_string_tab[157] +#define __pyx_n_u_lower __pyx_string_tab[158] +#define __pyx_n_u_main __pyx_string_tab[159] +#define __pyx_n_u_module __pyx_string_tab[160] +#define __pyx_n_u_morph __pyx_string_tab[161] +#define __pyx_n_u_morph_keys __pyx_string_tab[162] +#define __pyx_n_u_morphs __pyx_string_tab[163] +#define __pyx_n_u_name __pyx_string_tab[164] +#define __pyx_n_u_name_2 __pyx_string_tab[165] +#define __pyx_n_u_number __pyx_string_tab[166] +#define __pyx_n_u_pop __pyx_string_tab[167] +#define __pyx_n_u_pos __pyx_string_tab[168] +#define __pyx_n_u_qualname __pyx_string_tab[169] +#define __pyx_n_u_set_name __pyx_string_tab[170] +#define __pyx_n_u_setdefault __pyx_string_tab[171] +#define __pyx_n_u_sorted __pyx_string_tab[172] +#define __pyx_n_u_spacy_attrs __pyx_string_tab[173] +#define __pyx_n_u_strings_map __pyx_string_tab[174] +#define __pyx_n_u_stringy_attrs __pyx_string_tab[175] +#define __pyx_n_u_tenspect __pyx_string_tab[176] +#define __pyx_n_u_test __pyx_string_tab[177] +#define __pyx_n_u_update __pyx_string_tab[178] +#define __pyx_n_u_upper __pyx_string_tab[179] +#define __pyx_n_u_value __pyx_string_tab[180] +#define __pyx_n_u_values __pyx_string_tab[181] +#define __pyx_kp_b_iso88591_2_q_4s_M_Qa_4s_aq_6_A_AQ_83a_aq __pyx_string_tab[182] +#define __pyx_kp_b_iso88591_D __pyx_string_tab[183] +#define __pyx_kp_b_iso88591_z_q_c_s_1_V3c_s_4vQ_1 __pyx_string_tab[184] +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { + __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #if CYTHON_PEP489_MULTI_PHASE_INIT + __Pyx_State_RemoveModule(NULL); + #endif + for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<3; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<185; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } +/* #### Code section: module_state_clear_contents ### */ +/* CommonTypesMetaclass.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + +/* #### Code section: module_state_clear_end ### */ +return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); + for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<3; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<185; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } +/* #### Code section: module_state_traverse_contents ### */ +/* CommonTypesMetaclass.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "spacy/attrs.pyx":97 + * + * # ATTR IDs, in order of the symbol + * NAMES = [key for key, value in sorted(IDS.items(), key=lambda item: item[1])] # <<<<<<<<<<<<<< + * locals().update(IDS) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5attrs_4lambda(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_5attrs_4lambda = {"lambda", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5attrs_4lambda, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_5attrs_4lambda(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_item = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_item,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 97, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 97, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda", 0) < (0)) __PYX_ERR(0, 97, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda", 1, 1, 1, i); __PYX_ERR(0, 97, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 97, __pyx_L3_error) + } + __pyx_v_item = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 97, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.attrs.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_5spacy_5attrs_lambda(__pyx_self, __pyx_v_item); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_5spacy_5attrs_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_item, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.attrs.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/attrs.pyx":101 + * + * + * def intify_attrs(stringy_attrs, strings_map=None, _do_deprecated=False): # <<<<<<<<<<<<<< + * """ + * Normalize a dictionary of attributes, converting them to ints. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5attrs_1intify_attrs(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5attrs_intify_attrs, "intify_attrs(stringy_attrs, strings_map=None, _do_deprecated=False)\n\nNormalize a dictionary of attributes, converting them to ints.\n\nstringy_attrs (dict): Dictionary keyed by attribute string names. Values\n can be ints or strings.\nstrings_map (StringStore): Defaults to None. If provided, encodes string\n values into ints.\nRETURNS (dict): Attributes dictionary with keys and optionally values\n converted to ints."); +static PyMethodDef __pyx_mdef_5spacy_5attrs_1intify_attrs = {"intify_attrs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5attrs_1intify_attrs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5attrs_intify_attrs}; +static PyObject *__pyx_pw_5spacy_5attrs_1intify_attrs(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_stringy_attrs = 0; + PyObject *__pyx_v_strings_map = 0; + PyObject *__pyx_v__do_deprecated = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("intify_attrs (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_stringy_attrs,&__pyx_mstate_global->__pyx_n_u_strings_map,&__pyx_mstate_global->__pyx_n_u_do_deprecated,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 101, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 101, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 101, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 101, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "intify_attrs", 0) < (0)) __PYX_ERR(0, 101, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False))); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("intify_attrs", 0, 1, 3, i); __PYX_ERR(0, 101, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 101, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 101, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 101, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False))); + } + __pyx_v_stringy_attrs = values[0]; + __pyx_v_strings_map = values[1]; + __pyx_v__do_deprecated = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("intify_attrs", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 101, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.attrs.intify_attrs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5attrs_intify_attrs(__pyx_self, __pyx_v_stringy_attrs, __pyx_v_strings_map, __pyx_v__do_deprecated); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5attrs_intify_attrs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_stringy_attrs, PyObject *__pyx_v_strings_map, PyObject *__pyx_v__do_deprecated) { + PyObject *__pyx_v_inty_attrs = NULL; + CYTHON_UNUSED PyObject *__pyx_v_morphs = NULL; + PyObject *__pyx_v_morph_keys = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_v_int_key = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("intify_attrs", 0); + + /* "spacy/attrs.pyx":112 + * converted to ints. + * """ + * inty_attrs = {} # <<<<<<<<<<<<<< + * if _do_deprecated: + * if "F" in stringy_attrs: +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_inty_attrs = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/attrs.pyx":113 + * """ + * inty_attrs = {} + * if _do_deprecated: # <<<<<<<<<<<<<< + * if "F" in stringy_attrs: + * stringy_attrs["ORTH"] = stringy_attrs.pop("F") +*/ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v__do_deprecated); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 113, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":114 + * inty_attrs = {} + * if _do_deprecated: + * if "F" in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs["ORTH"] = stringy_attrs.pop("F") + * if "L" in stringy_attrs: +*/ + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_F, __pyx_v_stringy_attrs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 114, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":115 + * if _do_deprecated: + * if "F" in stringy_attrs: + * stringy_attrs["ORTH"] = stringy_attrs.pop("F") # <<<<<<<<<<<<<< + * if "L" in stringy_attrs: + * stringy_attrs["LEMMA"] = stringy_attrs.pop("L") +*/ + __pyx_t_3 = __pyx_v_stringy_attrs; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_F}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pop, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (unlikely((PyObject_SetItem(__pyx_v_stringy_attrs, __pyx_mstate_global->__pyx_n_u_ORTH, __pyx_t_1) < 0))) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/attrs.pyx":114 + * inty_attrs = {} + * if _do_deprecated: + * if "F" in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs["ORTH"] = stringy_attrs.pop("F") + * if "L" in stringy_attrs: +*/ + } + + /* "spacy/attrs.pyx":116 + * if "F" in stringy_attrs: + * stringy_attrs["ORTH"] = stringy_attrs.pop("F") + * if "L" in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs["LEMMA"] = stringy_attrs.pop("L") + * if "pos" in stringy_attrs: +*/ + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_L, __pyx_v_stringy_attrs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 116, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":117 + * stringy_attrs["ORTH"] = stringy_attrs.pop("F") + * if "L" in stringy_attrs: + * stringy_attrs["LEMMA"] = stringy_attrs.pop("L") # <<<<<<<<<<<<<< + * if "pos" in stringy_attrs: + * stringy_attrs["TAG"] = stringy_attrs.pop("pos") +*/ + __pyx_t_3 = __pyx_v_stringy_attrs; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_L}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pop, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (unlikely((PyObject_SetItem(__pyx_v_stringy_attrs, __pyx_mstate_global->__pyx_n_u_LEMMA, __pyx_t_1) < 0))) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/attrs.pyx":116 + * if "F" in stringy_attrs: + * stringy_attrs["ORTH"] = stringy_attrs.pop("F") + * if "L" in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs["LEMMA"] = stringy_attrs.pop("L") + * if "pos" in stringy_attrs: +*/ + } + + /* "spacy/attrs.pyx":118 + * if "L" in stringy_attrs: + * stringy_attrs["LEMMA"] = stringy_attrs.pop("L") + * if "pos" in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs["TAG"] = stringy_attrs.pop("pos") + * if "morph" in stringy_attrs: +*/ + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_pos, __pyx_v_stringy_attrs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 118, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":119 + * stringy_attrs["LEMMA"] = stringy_attrs.pop("L") + * if "pos" in stringy_attrs: + * stringy_attrs["TAG"] = stringy_attrs.pop("pos") # <<<<<<<<<<<<<< + * if "morph" in stringy_attrs: + * morphs = stringy_attrs.pop("morph") # no-cython-lint +*/ + __pyx_t_3 = __pyx_v_stringy_attrs; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pos}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pop, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (unlikely((PyObject_SetItem(__pyx_v_stringy_attrs, __pyx_mstate_global->__pyx_n_u_TAG, __pyx_t_1) < 0))) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/attrs.pyx":118 + * if "L" in stringy_attrs: + * stringy_attrs["LEMMA"] = stringy_attrs.pop("L") + * if "pos" in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs["TAG"] = stringy_attrs.pop("pos") + * if "morph" in stringy_attrs: +*/ + } + + /* "spacy/attrs.pyx":120 + * if "pos" in stringy_attrs: + * stringy_attrs["TAG"] = stringy_attrs.pop("pos") + * if "morph" in stringy_attrs: # <<<<<<<<<<<<<< + * morphs = stringy_attrs.pop("morph") # no-cython-lint + * if "number" in stringy_attrs: +*/ + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_morph, __pyx_v_stringy_attrs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 120, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":121 + * stringy_attrs["TAG"] = stringy_attrs.pop("pos") + * if "morph" in stringy_attrs: + * morphs = stringy_attrs.pop("morph") # no-cython-lint # <<<<<<<<<<<<<< + * if "number" in stringy_attrs: + * stringy_attrs.pop("number") +*/ + __pyx_t_3 = __pyx_v_stringy_attrs; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_morph}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pop, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_morphs = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/attrs.pyx":120 + * if "pos" in stringy_attrs: + * stringy_attrs["TAG"] = stringy_attrs.pop("pos") + * if "morph" in stringy_attrs: # <<<<<<<<<<<<<< + * morphs = stringy_attrs.pop("morph") # no-cython-lint + * if "number" in stringy_attrs: +*/ + } + + /* "spacy/attrs.pyx":122 + * if "morph" in stringy_attrs: + * morphs = stringy_attrs.pop("morph") # no-cython-lint + * if "number" in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs.pop("number") + * if "tenspect" in stringy_attrs: +*/ + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_number, __pyx_v_stringy_attrs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 122, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":123 + * morphs = stringy_attrs.pop("morph") # no-cython-lint + * if "number" in stringy_attrs: + * stringy_attrs.pop("number") # <<<<<<<<<<<<<< + * if "tenspect" in stringy_attrs: + * stringy_attrs.pop("tenspect") +*/ + __pyx_t_3 = __pyx_v_stringy_attrs; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_number}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pop, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/attrs.pyx":122 + * if "morph" in stringy_attrs: + * morphs = stringy_attrs.pop("morph") # no-cython-lint + * if "number" in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs.pop("number") + * if "tenspect" in stringy_attrs: +*/ + } + + /* "spacy/attrs.pyx":124 + * if "number" in stringy_attrs: + * stringy_attrs.pop("number") + * if "tenspect" in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs.pop("tenspect") + * morph_keys = [ +*/ + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_tenspect, __pyx_v_stringy_attrs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 124, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":125 + * stringy_attrs.pop("number") + * if "tenspect" in stringy_attrs: + * stringy_attrs.pop("tenspect") # <<<<<<<<<<<<<< + * morph_keys = [ + * "PunctType", +*/ + __pyx_t_3 = __pyx_v_stringy_attrs; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_tenspect}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pop, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/attrs.pyx":124 + * if "number" in stringy_attrs: + * stringy_attrs.pop("number") + * if "tenspect" in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs.pop("tenspect") + * morph_keys = [ +*/ + } + + /* "spacy/attrs.pyx":126 + * if "tenspect" in stringy_attrs: + * stringy_attrs.pop("tenspect") + * morph_keys = [ # <<<<<<<<<<<<<< + * "PunctType", + * "PunctSide", +*/ + __pyx_t_1 = PyList_New(47); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PunctType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PunctType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PunctType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PunctSide); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PunctSide); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_n_u_PunctSide) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Other); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Other); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 2, __pyx_mstate_global->__pyx_n_u_Other) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Degree); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Degree); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 3, __pyx_mstate_global->__pyx_n_u_Degree) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_AdvType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_AdvType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 4, __pyx_mstate_global->__pyx_n_u_AdvType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Number); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Number); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 5, __pyx_mstate_global->__pyx_n_u_Number) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_VerbForm); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_VerbForm); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 6, __pyx_mstate_global->__pyx_n_u_VerbForm) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PronType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PronType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 7, __pyx_mstate_global->__pyx_n_u_PronType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Aspect); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Aspect); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 8, __pyx_mstate_global->__pyx_n_u_Aspect) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Tense); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Tense); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 9, __pyx_mstate_global->__pyx_n_u_Tense) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PartType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PartType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 10, __pyx_mstate_global->__pyx_n_u_PartType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Poss); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Poss); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 11, __pyx_mstate_global->__pyx_n_u_Poss) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Hyph); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Hyph); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 12, __pyx_mstate_global->__pyx_n_u_Hyph) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ConjType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_ConjType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 13, __pyx_mstate_global->__pyx_n_u_ConjType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_NumType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_NumType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 14, __pyx_mstate_global->__pyx_n_u_NumType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Foreign); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Foreign); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 15, __pyx_mstate_global->__pyx_n_u_Foreign) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_VerbType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_VerbType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 16, __pyx_mstate_global->__pyx_n_u_VerbType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_NounType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_NounType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 17, __pyx_mstate_global->__pyx_n_u_NounType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Gender); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Gender); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 18, __pyx_mstate_global->__pyx_n_u_Gender) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Mood); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Mood); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 19, __pyx_mstate_global->__pyx_n_u_Mood) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Negative); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Negative); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 20, __pyx_mstate_global->__pyx_n_u_Negative) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Tense); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Tense); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 21, __pyx_mstate_global->__pyx_n_u_Tense) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Voice); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Voice); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 22, __pyx_mstate_global->__pyx_n_u_Voice) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Abbr); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Abbr); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 23, __pyx_mstate_global->__pyx_n_u_Abbr) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Derivation); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Derivation); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 24, __pyx_mstate_global->__pyx_n_u_Derivation) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Echo); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Echo); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 25, __pyx_mstate_global->__pyx_n_u_Echo) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Foreign); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Foreign); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 26, __pyx_mstate_global->__pyx_n_u_Foreign) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_NameType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_NameType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 27, __pyx_mstate_global->__pyx_n_u_NameType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_NounType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_NounType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 28, __pyx_mstate_global->__pyx_n_u_NounType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_NumForm); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_NumForm); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 29, __pyx_mstate_global->__pyx_n_u_NumForm) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_NumValue); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_NumValue); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 30, __pyx_mstate_global->__pyx_n_u_NumValue) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PartType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PartType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 31, __pyx_mstate_global->__pyx_n_u_PartType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Polite); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Polite); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 32, __pyx_mstate_global->__pyx_n_u_Polite) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_StyleVariant); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_StyleVariant); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 33, __pyx_mstate_global->__pyx_n_u_StyleVariant) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PronType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PronType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 34, __pyx_mstate_global->__pyx_n_u_PronType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_AdjType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_AdjType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 35, __pyx_mstate_global->__pyx_n_u_AdjType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Person); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Person); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 36, __pyx_mstate_global->__pyx_n_u_Person) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Variant); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Variant); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 37, __pyx_mstate_global->__pyx_n_u_Variant) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_AdpType); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_AdpType); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 38, __pyx_mstate_global->__pyx_n_u_AdpType) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Reflex); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Reflex); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 39, __pyx_mstate_global->__pyx_n_u_Reflex) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Negative); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Negative); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 40, __pyx_mstate_global->__pyx_n_u_Negative) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Mood); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Mood); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 41, __pyx_mstate_global->__pyx_n_u_Mood) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Aspect); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Aspect); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 42, __pyx_mstate_global->__pyx_n_u_Aspect) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Case); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Case); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 43, __pyx_mstate_global->__pyx_n_u_Case) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Polarity); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Polarity); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 44, __pyx_mstate_global->__pyx_n_u_Polarity) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PrepCase); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PrepCase); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 45, __pyx_mstate_global->__pyx_n_u_PrepCase) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Animacy); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Animacy); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 46, __pyx_mstate_global->__pyx_n_u_Animacy) != (0)) __PYX_ERR(0, 126, __pyx_L1_error); + __pyx_v_morph_keys = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/attrs.pyx":175 + * "Animacy", # U20 + * ] + * for key in morph_keys: # <<<<<<<<<<<<<< + * if key in stringy_attrs: + * stringy_attrs.pop(key) +*/ + __pyx_t_1 = __pyx_v_morph_keys; __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 175, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/attrs.pyx":176 + * ] + * for key in morph_keys: + * if key in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs.pop(key) + * elif key.lower() in stringy_attrs: +*/ + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_v_stringy_attrs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 176, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":177 + * for key in morph_keys: + * if key in stringy_attrs: + * stringy_attrs.pop(key) # <<<<<<<<<<<<<< + * elif key.lower() in stringy_attrs: + * stringy_attrs.pop(key.lower()) +*/ + __pyx_t_6 = __pyx_v_stringy_attrs; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_key}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pop, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/attrs.pyx":176 + * ] + * for key in morph_keys: + * if key in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs.pop(key) + * elif key.lower() in stringy_attrs: +*/ + goto __pyx_L12; + } + + /* "spacy/attrs.pyx":178 + * if key in stringy_attrs: + * stringy_attrs.pop(key) + * elif key.lower() in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs.pop(key.lower()) + * elif key.upper() in stringy_attrs: +*/ + __pyx_t_6 = __pyx_v_key; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_lower, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_3, __pyx_v_stringy_attrs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":179 + * stringy_attrs.pop(key) + * elif key.lower() in stringy_attrs: + * stringy_attrs.pop(key.lower()) # <<<<<<<<<<<<<< + * elif key.upper() in stringy_attrs: + * stringy_attrs.pop(key.upper()) +*/ + __pyx_t_6 = __pyx_v_stringy_attrs; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_8 = __pyx_v_key; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_lower, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pop, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/attrs.pyx":178 + * if key in stringy_attrs: + * stringy_attrs.pop(key) + * elif key.lower() in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs.pop(key.lower()) + * elif key.upper() in stringy_attrs: +*/ + goto __pyx_L12; + } + + /* "spacy/attrs.pyx":180 + * elif key.lower() in stringy_attrs: + * stringy_attrs.pop(key.lower()) + * elif key.upper() in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs.pop(key.upper()) + * for name, value in stringy_attrs.items(): +*/ + __pyx_t_7 = __pyx_v_key; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_3, __pyx_v_stringy_attrs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":181 + * stringy_attrs.pop(key.lower()) + * elif key.upper() in stringy_attrs: + * stringy_attrs.pop(key.upper()) # <<<<<<<<<<<<<< + * for name, value in stringy_attrs.items(): + * int_key = intify_attr(name) +*/ + __pyx_t_7 = __pyx_v_stringy_attrs; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = __pyx_v_key; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pop, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/attrs.pyx":180 + * elif key.lower() in stringy_attrs: + * stringy_attrs.pop(key.lower()) + * elif key.upper() in stringy_attrs: # <<<<<<<<<<<<<< + * stringy_attrs.pop(key.upper()) + * for name, value in stringy_attrs.items(): +*/ + } + __pyx_L12:; + + /* "spacy/attrs.pyx":175 + * "Animacy", # U20 + * ] + * for key in morph_keys: # <<<<<<<<<<<<<< + * if key in stringy_attrs: + * stringy_attrs.pop(key) +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/attrs.pyx":113 + * """ + * inty_attrs = {} + * if _do_deprecated: # <<<<<<<<<<<<<< + * if "F" in stringy_attrs: + * stringy_attrs["ORTH"] = stringy_attrs.pop("F") +*/ + } + + /* "spacy/attrs.pyx":182 + * elif key.upper() in stringy_attrs: + * stringy_attrs.pop(key.upper()) + * for name, value in stringy_attrs.items(): # <<<<<<<<<<<<<< + * int_key = intify_attr(name) + * if int_key is not None: +*/ + __pyx_t_3 = __pyx_v_stringy_attrs; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 182, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 182, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 182, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); + #endif + ++__pyx_t_5; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_9(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 182, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 182, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_7); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); + index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L16_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L16_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L17_unpacking_done; + __pyx_L16_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_L17_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/attrs.pyx":183 + * stringy_attrs.pop(key.upper()) + * for name, value in stringy_attrs.items(): + * int_key = intify_attr(name) # <<<<<<<<<<<<<< + * if int_key is not None: + * if int_key == ENT_IOB: +*/ + __pyx_t_7 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_intify_attr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_7); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_name}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_int_key, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/attrs.pyx":184 + * for name, value in stringy_attrs.items(): + * int_key = intify_attr(name) + * if int_key is not None: # <<<<<<<<<<<<<< + * if int_key == ENT_IOB: + * if value in IOB_STRINGS: +*/ + __pyx_t_2 = (__pyx_v_int_key != Py_None); + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":185 + * int_key = intify_attr(name) + * if int_key is not None: + * if int_key == ENT_IOB: # <<<<<<<<<<<<<< + * if value in IOB_STRINGS: + * value = IOB_STRINGS.index(value) +*/ + __pyx_t_1 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_ENT_IOB); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_RichCompare(__pyx_v_int_key, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":186 + * if int_key is not None: + * if int_key == ENT_IOB: + * if value in IOB_STRINGS: # <<<<<<<<<<<<<< + * value = IOB_STRINGS.index(value) + * elif isinstance(value, str): +*/ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_IOB_STRINGS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_value, __pyx_t_6, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":187 + * if int_key == ENT_IOB: + * if value in IOB_STRINGS: + * value = IOB_STRINGS.index(value) # <<<<<<<<<<<<<< + * elif isinstance(value, str): + * raise ValueError(Errors.E1025.format(value=value)) +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_IOB_STRINGS); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_value}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/attrs.pyx":186 + * if int_key is not None: + * if int_key == ENT_IOB: + * if value in IOB_STRINGS: # <<<<<<<<<<<<<< + * value = IOB_STRINGS.index(value) + * elif isinstance(value, str): +*/ + goto __pyx_L20; + } + + /* "spacy/attrs.pyx":188 + * if value in IOB_STRINGS: + * value = IOB_STRINGS.index(value) + * elif isinstance(value, str): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E1025.format(value=value)) + * if strings_map is not None and isinstance(value, str): +*/ + __pyx_t_2 = PyUnicode_Check(__pyx_v_value); + if (unlikely(__pyx_t_2)) { + + /* "spacy/attrs.pyx":189 + * value = IOB_STRINGS.index(value) + * elif isinstance(value, str): + * raise ValueError(Errors.E1025.format(value=value)) # <<<<<<<<<<<<<< + * if strings_map is not None and isinstance(value, str): + * if hasattr(strings_map, "add"): +*/ + __pyx_t_8 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_E1025); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_7 = __pyx_t_12; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, NULL}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_value, __pyx_v_value, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_1}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 189, __pyx_L1_error) + + /* "spacy/attrs.pyx":188 + * if value in IOB_STRINGS: + * value = IOB_STRINGS.index(value) + * elif isinstance(value, str): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E1025.format(value=value)) + * if strings_map is not None and isinstance(value, str): +*/ + } + __pyx_L20:; + + /* "spacy/attrs.pyx":185 + * int_key = intify_attr(name) + * if int_key is not None: + * if int_key == ENT_IOB: # <<<<<<<<<<<<<< + * if value in IOB_STRINGS: + * value = IOB_STRINGS.index(value) +*/ + } + + /* "spacy/attrs.pyx":190 + * elif isinstance(value, str): + * raise ValueError(Errors.E1025.format(value=value)) + * if strings_map is not None and isinstance(value, str): # <<<<<<<<<<<<<< + * if hasattr(strings_map, "add"): + * value = strings_map.add(value) +*/ + __pyx_t_13 = (__pyx_v_strings_map != Py_None); + if (__pyx_t_13) { + } else { + __pyx_t_2 = __pyx_t_13; + goto __pyx_L22_bool_binop_done; + } + __pyx_t_13 = PyUnicode_Check(__pyx_v_value); + __pyx_t_2 = __pyx_t_13; + __pyx_L22_bool_binop_done:; + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":191 + * raise ValueError(Errors.E1025.format(value=value)) + * if strings_map is not None and isinstance(value, str): + * if hasattr(strings_map, "add"): # <<<<<<<<<<<<<< + * value = strings_map.add(value) + * else: +*/ + __pyx_t_2 = __Pyx_HasAttr(__pyx_v_strings_map, __pyx_mstate_global->__pyx_n_u_add); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 191, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/attrs.pyx":192 + * if strings_map is not None and isinstance(value, str): + * if hasattr(strings_map, "add"): + * value = strings_map.add(value) # <<<<<<<<<<<<<< + * else: + * value = strings_map[value] +*/ + __pyx_t_1 = __pyx_v_strings_map; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_value}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/attrs.pyx":191 + * raise ValueError(Errors.E1025.format(value=value)) + * if strings_map is not None and isinstance(value, str): + * if hasattr(strings_map, "add"): # <<<<<<<<<<<<<< + * value = strings_map.add(value) + * else: +*/ + goto __pyx_L24; + } + + /* "spacy/attrs.pyx":194 + * value = strings_map.add(value) + * else: + * value = strings_map[value] # <<<<<<<<<<<<<< + * inty_attrs[int_key] = value + * return inty_attrs +*/ + /*else*/ { + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_strings_map, __pyx_v_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_6); + __pyx_t_6 = 0; + } + __pyx_L24:; + + /* "spacy/attrs.pyx":190 + * elif isinstance(value, str): + * raise ValueError(Errors.E1025.format(value=value)) + * if strings_map is not None and isinstance(value, str): # <<<<<<<<<<<<<< + * if hasattr(strings_map, "add"): + * value = strings_map.add(value) +*/ + } + + /* "spacy/attrs.pyx":195 + * else: + * value = strings_map[value] + * inty_attrs[int_key] = value # <<<<<<<<<<<<<< + * return inty_attrs + * +*/ + if (unlikely((PyDict_SetItem(__pyx_v_inty_attrs, __pyx_v_int_key, __pyx_v_value) < 0))) __PYX_ERR(0, 195, __pyx_L1_error) + + /* "spacy/attrs.pyx":184 + * for name, value in stringy_attrs.items(): + * int_key = intify_attr(name) + * if int_key is not None: # <<<<<<<<<<<<<< + * if int_key == ENT_IOB: + * if value in IOB_STRINGS: +*/ + } + + /* "spacy/attrs.pyx":182 + * elif key.upper() in stringy_attrs: + * stringy_attrs.pop(key.upper()) + * for name, value in stringy_attrs.items(): # <<<<<<<<<<<<<< + * int_key = intify_attr(name) + * if int_key is not None: +*/ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/attrs.pyx":196 + * value = strings_map[value] + * inty_attrs[int_key] = value + * return inty_attrs # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_inty_attrs); + __pyx_r = __pyx_v_inty_attrs; + goto __pyx_L0; + + /* "spacy/attrs.pyx":101 + * + * + * def intify_attrs(stringy_attrs, strings_map=None, _do_deprecated=False): # <<<<<<<<<<<<<< + * """ + * Normalize a dictionary of attributes, converting them to ints. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("spacy.attrs.intify_attrs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_inty_attrs); + __Pyx_XDECREF(__pyx_v_morphs); + __Pyx_XDECREF(__pyx_v_morph_keys); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_int_key); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/attrs.pyx":199 + * + * + * def intify_attr(name): # <<<<<<<<<<<<<< + * """ + * Normalize an attribute name, converting it to int. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5attrs_3intify_attr(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5attrs_2intify_attr, "intify_attr(name)\n\nNormalize an attribute name, converting it to int.\n\nstringy_attr (string): Attribute string name. Can also be int (will then be left unchanged)\nRETURNS (int): int representation of the attribute, or None if it couldn't be converted."); +static PyMethodDef __pyx_mdef_5spacy_5attrs_3intify_attr = {"intify_attr", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5attrs_3intify_attr, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5attrs_2intify_attr}; +static PyObject *__pyx_pw_5spacy_5attrs_3intify_attr(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_name = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("intify_attr (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 199, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 199, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "intify_attr", 0) < (0)) __PYX_ERR(0, 199, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("intify_attr", 1, 1, 1, i); __PYX_ERR(0, 199, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 199, __pyx_L3_error) + } + __pyx_v_name = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("intify_attr", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 199, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.attrs.intify_attr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5attrs_2intify_attr(__pyx_self, __pyx_v_name); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5attrs_2intify_attr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("intify_attr", 0); + + /* "spacy/attrs.pyx":206 + * RETURNS (int): int representation of the attribute, or None if it couldn't be converted. + * """ + * if isinstance(name, int): # <<<<<<<<<<<<<< + * return name + * elif name in IDS: +*/ + __pyx_t_1 = PyLong_Check(__pyx_v_name); + if (__pyx_t_1) { + + /* "spacy/attrs.pyx":207 + * """ + * if isinstance(name, int): + * return name # <<<<<<<<<<<<<< + * elif name in IDS: + * return IDS[name] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_name); + __pyx_r = __pyx_v_name; + goto __pyx_L0; + + /* "spacy/attrs.pyx":206 + * RETURNS (int): int representation of the attribute, or None if it couldn't be converted. + * """ + * if isinstance(name, int): # <<<<<<<<<<<<<< + * return name + * elif name in IDS: +*/ + } + + /* "spacy/attrs.pyx":208 + * if isinstance(name, int): + * return name + * elif name in IDS: # <<<<<<<<<<<<<< + * return IDS[name] + * elif name.upper() in IDS: +*/ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IDS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_t_2, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "spacy/attrs.pyx":209 + * return name + * elif name in IDS: + * return IDS[name] # <<<<<<<<<<<<<< + * elif name.upper() in IDS: + * return IDS[name.upper()] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IDS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/attrs.pyx":208 + * if isinstance(name, int): + * return name + * elif name in IDS: # <<<<<<<<<<<<<< + * return IDS[name] + * elif name.upper() in IDS: +*/ + } + + /* "spacy/attrs.pyx":210 + * elif name in IDS: + * return IDS[name] + * elif name.upper() in IDS: # <<<<<<<<<<<<<< + * return IDS[name.upper()] + * return None +*/ + __pyx_t_2 = __pyx_v_name; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IDS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_3, __pyx_t_2, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "spacy/attrs.pyx":211 + * return IDS[name] + * elif name.upper() in IDS: + * return IDS[name.upper()] # <<<<<<<<<<<<<< + * return None +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IDS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __pyx_v_name; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "spacy/attrs.pyx":210 + * elif name in IDS: + * return IDS[name] + * elif name.upper() in IDS: # <<<<<<<<<<<<<< + * return IDS[name.upper()] + * return None +*/ + } + + /* "spacy/attrs.pyx":212 + * elif name.upper() in IDS: + * return IDS[name.upper()] + * return None # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "spacy/attrs.pyx":199 + * + * + * def intify_attr(name): # <<<<<<<<<<<<<< + * """ + * Normalize an attribute name, converting it to int. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.attrs.intify_attr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +/* #### Code section: initfunc_declarations ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ +/* #### Code section: init_module ### */ + +static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_attrs(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_attrs}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #endif + #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE + {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, + #endif + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "attrs", + 0, /* m_doc */ + #if CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstatetype), /* m_size */ + #else + (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif + +/* PyModInitFuncType */ +#ifndef CYTHON_NO_PYINIT_EXPORT + #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#else + #ifdef __cplusplus + #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * + #else + #define __Pyx_PyMODINIT_FUNC PyObject * + #endif +#endif + +__Pyx_PyMODINIT_FUNC PyInit_attrs(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_attrs(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +/* ModuleCreationPEP489 */ +#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) +static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { + { + PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think + if (!module) { + PyErr_Clear(); // just try the 3.8-3.12 version + module = PyImport_ImportModule("_xxsubinterpreters"); + if (!module) goto bad; + } + PyObject *current = PyObject_CallMethod(module, "get_current", NULL); + Py_DECREF(module); + if (!current) goto bad; + if (PyTuple_Check(current)) { + PyObject *new_current = PySequence_GetItem(current, 0); + Py_DECREF(current); + current = new_current; + if (!new_current) goto bad; + } + long long as_c_int = PyLong_AsLongLong(current); + Py_DECREF(current); + return as_c_int; + } + bad: + PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); + return -1; +} +#endif +#if !CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + static PY_INT64_T main_interpreter_id = -1; +#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_GRAAL + PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) + PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); +#elif CYTHON_COMPILING_IN_LIMITED_API + PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); +#else + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); +#endif + if (unlikely(current_id == -1)) { + return -1; + } + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return 0; + } else if (unlikely(main_interpreter_id != current_id)) { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#endif +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + #if !CYTHON_USE_MODULE_STATE + if (__Pyx_check_single_interpreter()) + return NULL; + #endif + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_attrs(PyObject *__pyx_pyinit_module) +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + __pyx_mstatetype *__pyx_mstate = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + PyObject *(*__pyx_t_12)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'attrs' has already been imported. Re-initialisation is not supported."); + return -1; + } + #else + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_t_1 = __pyx_pyinit_module; + Py_INCREF(__pyx_t_1); + #else + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #if CYTHON_USE_MODULE_STATE + { + int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "attrs" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = __pyx_t_1; + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); + #endif + __pyx_mstate = __pyx_mstate_global; + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_mstate->__pyx_d); + __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /* ImportRefnannyAPI */ + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + +__Pyx_RefNannySetupContext("PyInit_attrs", 0); + __Pyx_init_runtime_version(); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Library function declarations ---*/ + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_module_is_main_spacy__attrs) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "spacy.attrs")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.attrs", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(__pyx_mstate); + (void)__Pyx_modinit_variable_export_code(__pyx_mstate); + (void)__Pyx_modinit_function_export_code(__pyx_mstate); + (void)__Pyx_modinit_type_init_code(__pyx_mstate); + (void)__Pyx_modinit_type_import_code(__pyx_mstate); + (void)__Pyx_modinit_variable_import_code(__pyx_mstate); + (void)__Pyx_modinit_function_import_code(__pyx_mstate); + /*--- Execution code ---*/ + + /* "spacy/attrs.pyx":2 + * # cython: profile=False + * from .errors import Errors # <<<<<<<<<<<<<< + * + * IOB_STRINGS = ("", "I", "O", "B") +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/attrs.pyx":4 + * from .errors import Errors + * + * IOB_STRINGS = ("", "I", "O", "B") # <<<<<<<<<<<<<< + * + * IDS = { +*/ + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_IOB_STRINGS, __pyx_mstate_global->__pyx_tuple[0]) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + + /* "spacy/attrs.pyx":7 + * + * IDS = { + * "": NULL_ATTR, # <<<<<<<<<<<<<< + * "IS_ALPHA": IS_ALPHA, + * "IS_ASCII": IS_ASCII, +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(86); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_NULL_ATTR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u__2, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":8 + * IDS = { + * "": NULL_ATTR, + * "IS_ALPHA": IS_ALPHA, # <<<<<<<<<<<<<< + * "IS_ASCII": IS_ASCII, + * "IS_DIGIT": IS_DIGIT, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_ALPHA); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_ALPHA, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":9 + * "": NULL_ATTR, + * "IS_ALPHA": IS_ALPHA, + * "IS_ASCII": IS_ASCII, # <<<<<<<<<<<<<< + * "IS_DIGIT": IS_DIGIT, + * "IS_LOWER": IS_LOWER, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_ASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_ASCII, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":10 + * "IS_ALPHA": IS_ALPHA, + * "IS_ASCII": IS_ASCII, + * "IS_DIGIT": IS_DIGIT, # <<<<<<<<<<<<<< + * "IS_LOWER": IS_LOWER, + * "IS_PUNCT": IS_PUNCT, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_DIGIT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_DIGIT, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":11 + * "IS_ASCII": IS_ASCII, + * "IS_DIGIT": IS_DIGIT, + * "IS_LOWER": IS_LOWER, # <<<<<<<<<<<<<< + * "IS_PUNCT": IS_PUNCT, + * "IS_SPACE": IS_SPACE, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_LOWER); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_LOWER, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":12 + * "IS_DIGIT": IS_DIGIT, + * "IS_LOWER": IS_LOWER, + * "IS_PUNCT": IS_PUNCT, # <<<<<<<<<<<<<< + * "IS_SPACE": IS_SPACE, + * "IS_TITLE": IS_TITLE, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_PUNCT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_PUNCT, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":13 + * "IS_LOWER": IS_LOWER, + * "IS_PUNCT": IS_PUNCT, + * "IS_SPACE": IS_SPACE, # <<<<<<<<<<<<<< + * "IS_TITLE": IS_TITLE, + * "IS_UPPER": IS_UPPER, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_SPACE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_SPACE, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":14 + * "IS_PUNCT": IS_PUNCT, + * "IS_SPACE": IS_SPACE, + * "IS_TITLE": IS_TITLE, # <<<<<<<<<<<<<< + * "IS_UPPER": IS_UPPER, + * "LIKE_URL": LIKE_URL, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_TITLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_TITLE, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":15 + * "IS_SPACE": IS_SPACE, + * "IS_TITLE": IS_TITLE, + * "IS_UPPER": IS_UPPER, # <<<<<<<<<<<<<< + * "LIKE_URL": LIKE_URL, + * "LIKE_NUM": LIKE_NUM, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_UPPER); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_UPPER, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":16 + * "IS_TITLE": IS_TITLE, + * "IS_UPPER": IS_UPPER, + * "LIKE_URL": LIKE_URL, # <<<<<<<<<<<<<< + * "LIKE_NUM": LIKE_NUM, + * "LIKE_EMAIL": LIKE_EMAIL, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_LIKE_URL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LIKE_URL, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":17 + * "IS_UPPER": IS_UPPER, + * "LIKE_URL": LIKE_URL, + * "LIKE_NUM": LIKE_NUM, # <<<<<<<<<<<<<< + * "LIKE_EMAIL": LIKE_EMAIL, + * "IS_STOP": IS_STOP, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_LIKE_NUM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LIKE_NUM, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":18 + * "LIKE_URL": LIKE_URL, + * "LIKE_NUM": LIKE_NUM, + * "LIKE_EMAIL": LIKE_EMAIL, # <<<<<<<<<<<<<< + * "IS_STOP": IS_STOP, + * "IS_OOV_DEPRECATED": IS_OOV_DEPRECATED, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_LIKE_EMAIL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LIKE_EMAIL, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":19 + * "LIKE_NUM": LIKE_NUM, + * "LIKE_EMAIL": LIKE_EMAIL, + * "IS_STOP": IS_STOP, # <<<<<<<<<<<<<< + * "IS_OOV_DEPRECATED": IS_OOV_DEPRECATED, + * "IS_BRACKET": IS_BRACKET, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_STOP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_STOP, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":20 + * "LIKE_EMAIL": LIKE_EMAIL, + * "IS_STOP": IS_STOP, + * "IS_OOV_DEPRECATED": IS_OOV_DEPRECATED, # <<<<<<<<<<<<<< + * "IS_BRACKET": IS_BRACKET, + * "IS_QUOTE": IS_QUOTE, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_OOV_DEPRECATED, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":21 + * "IS_STOP": IS_STOP, + * "IS_OOV_DEPRECATED": IS_OOV_DEPRECATED, + * "IS_BRACKET": IS_BRACKET, # <<<<<<<<<<<<<< + * "IS_QUOTE": IS_QUOTE, + * "IS_LEFT_PUNCT": IS_LEFT_PUNCT, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_BRACKET); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_BRACKET, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":22 + * "IS_OOV_DEPRECATED": IS_OOV_DEPRECATED, + * "IS_BRACKET": IS_BRACKET, + * "IS_QUOTE": IS_QUOTE, # <<<<<<<<<<<<<< + * "IS_LEFT_PUNCT": IS_LEFT_PUNCT, + * "IS_RIGHT_PUNCT": IS_RIGHT_PUNCT, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_QUOTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_QUOTE, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":23 + * "IS_BRACKET": IS_BRACKET, + * "IS_QUOTE": IS_QUOTE, + * "IS_LEFT_PUNCT": IS_LEFT_PUNCT, # <<<<<<<<<<<<<< + * "IS_RIGHT_PUNCT": IS_RIGHT_PUNCT, + * "IS_CURRENCY": IS_CURRENCY, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_LEFT_PUNCT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_LEFT_PUNCT, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":24 + * "IS_QUOTE": IS_QUOTE, + * "IS_LEFT_PUNCT": IS_LEFT_PUNCT, + * "IS_RIGHT_PUNCT": IS_RIGHT_PUNCT, # <<<<<<<<<<<<<< + * "IS_CURRENCY": IS_CURRENCY, + * "FLAG19": FLAG19, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_RIGHT_PUNCT, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":25 + * "IS_LEFT_PUNCT": IS_LEFT_PUNCT, + * "IS_RIGHT_PUNCT": IS_RIGHT_PUNCT, + * "IS_CURRENCY": IS_CURRENCY, # <<<<<<<<<<<<<< + * "FLAG19": FLAG19, + * "FLAG20": FLAG20, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IS_CURRENCY); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_CURRENCY, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":26 + * "IS_RIGHT_PUNCT": IS_RIGHT_PUNCT, + * "IS_CURRENCY": IS_CURRENCY, + * "FLAG19": FLAG19, # <<<<<<<<<<<<<< + * "FLAG20": FLAG20, + * "FLAG21": FLAG21, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG19); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG19, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":27 + * "IS_CURRENCY": IS_CURRENCY, + * "FLAG19": FLAG19, + * "FLAG20": FLAG20, # <<<<<<<<<<<<<< + * "FLAG21": FLAG21, + * "FLAG22": FLAG22, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG20); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG20, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":28 + * "FLAG19": FLAG19, + * "FLAG20": FLAG20, + * "FLAG21": FLAG21, # <<<<<<<<<<<<<< + * "FLAG22": FLAG22, + * "FLAG23": FLAG23, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG21); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG21, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":29 + * "FLAG20": FLAG20, + * "FLAG21": FLAG21, + * "FLAG22": FLAG22, # <<<<<<<<<<<<<< + * "FLAG23": FLAG23, + * "FLAG24": FLAG24, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG22); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG22, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":30 + * "FLAG21": FLAG21, + * "FLAG22": FLAG22, + * "FLAG23": FLAG23, # <<<<<<<<<<<<<< + * "FLAG24": FLAG24, + * "FLAG25": FLAG25, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG23); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG23, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":31 + * "FLAG22": FLAG22, + * "FLAG23": FLAG23, + * "FLAG24": FLAG24, # <<<<<<<<<<<<<< + * "FLAG25": FLAG25, + * "FLAG26": FLAG26, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG24); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG24, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":32 + * "FLAG23": FLAG23, + * "FLAG24": FLAG24, + * "FLAG25": FLAG25, # <<<<<<<<<<<<<< + * "FLAG26": FLAG26, + * "FLAG27": FLAG27, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG25); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG25, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":33 + * "FLAG24": FLAG24, + * "FLAG25": FLAG25, + * "FLAG26": FLAG26, # <<<<<<<<<<<<<< + * "FLAG27": FLAG27, + * "FLAG28": FLAG28, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG26); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG26, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":34 + * "FLAG25": FLAG25, + * "FLAG26": FLAG26, + * "FLAG27": FLAG27, # <<<<<<<<<<<<<< + * "FLAG28": FLAG28, + * "FLAG29": FLAG29, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG27); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG27, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":35 + * "FLAG26": FLAG26, + * "FLAG27": FLAG27, + * "FLAG28": FLAG28, # <<<<<<<<<<<<<< + * "FLAG29": FLAG29, + * "FLAG30": FLAG30, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG28); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG28, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":36 + * "FLAG27": FLAG27, + * "FLAG28": FLAG28, + * "FLAG29": FLAG29, # <<<<<<<<<<<<<< + * "FLAG30": FLAG30, + * "FLAG31": FLAG31, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG29); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG29, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":37 + * "FLAG28": FLAG28, + * "FLAG29": FLAG29, + * "FLAG30": FLAG30, # <<<<<<<<<<<<<< + * "FLAG31": FLAG31, + * "FLAG32": FLAG32, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG30); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG30, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":38 + * "FLAG29": FLAG29, + * "FLAG30": FLAG30, + * "FLAG31": FLAG31, # <<<<<<<<<<<<<< + * "FLAG32": FLAG32, + * "FLAG33": FLAG33, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG31); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG31, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":39 + * "FLAG30": FLAG30, + * "FLAG31": FLAG31, + * "FLAG32": FLAG32, # <<<<<<<<<<<<<< + * "FLAG33": FLAG33, + * "FLAG34": FLAG34, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG32, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":40 + * "FLAG31": FLAG31, + * "FLAG32": FLAG32, + * "FLAG33": FLAG33, # <<<<<<<<<<<<<< + * "FLAG34": FLAG34, + * "FLAG35": FLAG35, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG33); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG33, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":41 + * "FLAG32": FLAG32, + * "FLAG33": FLAG33, + * "FLAG34": FLAG34, # <<<<<<<<<<<<<< + * "FLAG35": FLAG35, + * "FLAG36": FLAG36, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG34); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG34, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":42 + * "FLAG33": FLAG33, + * "FLAG34": FLAG34, + * "FLAG35": FLAG35, # <<<<<<<<<<<<<< + * "FLAG36": FLAG36, + * "FLAG37": FLAG37, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG35); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG35, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":43 + * "FLAG34": FLAG34, + * "FLAG35": FLAG35, + * "FLAG36": FLAG36, # <<<<<<<<<<<<<< + * "FLAG37": FLAG37, + * "FLAG38": FLAG38, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG36); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG36, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":44 + * "FLAG35": FLAG35, + * "FLAG36": FLAG36, + * "FLAG37": FLAG37, # <<<<<<<<<<<<<< + * "FLAG38": FLAG38, + * "FLAG39": FLAG39, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG37); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG37, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":45 + * "FLAG36": FLAG36, + * "FLAG37": FLAG37, + * "FLAG38": FLAG38, # <<<<<<<<<<<<<< + * "FLAG39": FLAG39, + * "FLAG40": FLAG40, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG38); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG38, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":46 + * "FLAG37": FLAG37, + * "FLAG38": FLAG38, + * "FLAG39": FLAG39, # <<<<<<<<<<<<<< + * "FLAG40": FLAG40, + * "FLAG41": FLAG41, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG39); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG39, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":47 + * "FLAG38": FLAG38, + * "FLAG39": FLAG39, + * "FLAG40": FLAG40, # <<<<<<<<<<<<<< + * "FLAG41": FLAG41, + * "FLAG42": FLAG42, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG40); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG40, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":48 + * "FLAG39": FLAG39, + * "FLAG40": FLAG40, + * "FLAG41": FLAG41, # <<<<<<<<<<<<<< + * "FLAG42": FLAG42, + * "FLAG43": FLAG43, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG41); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG41, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":49 + * "FLAG40": FLAG40, + * "FLAG41": FLAG41, + * "FLAG42": FLAG42, # <<<<<<<<<<<<<< + * "FLAG43": FLAG43, + * "FLAG44": FLAG44, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG42); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG42, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":50 + * "FLAG41": FLAG41, + * "FLAG42": FLAG42, + * "FLAG43": FLAG43, # <<<<<<<<<<<<<< + * "FLAG44": FLAG44, + * "FLAG45": FLAG45, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG43); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG43, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":51 + * "FLAG42": FLAG42, + * "FLAG43": FLAG43, + * "FLAG44": FLAG44, # <<<<<<<<<<<<<< + * "FLAG45": FLAG45, + * "FLAG46": FLAG46, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG44); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG44, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":52 + * "FLAG43": FLAG43, + * "FLAG44": FLAG44, + * "FLAG45": FLAG45, # <<<<<<<<<<<<<< + * "FLAG46": FLAG46, + * "FLAG47": FLAG47, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG45); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG45, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":53 + * "FLAG44": FLAG44, + * "FLAG45": FLAG45, + * "FLAG46": FLAG46, # <<<<<<<<<<<<<< + * "FLAG47": FLAG47, + * "FLAG48": FLAG48, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG46); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG46, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":54 + * "FLAG45": FLAG45, + * "FLAG46": FLAG46, + * "FLAG47": FLAG47, # <<<<<<<<<<<<<< + * "FLAG48": FLAG48, + * "FLAG49": FLAG49, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG47); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG47, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":55 + * "FLAG46": FLAG46, + * "FLAG47": FLAG47, + * "FLAG48": FLAG48, # <<<<<<<<<<<<<< + * "FLAG49": FLAG49, + * "FLAG50": FLAG50, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG48); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG48, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":56 + * "FLAG47": FLAG47, + * "FLAG48": FLAG48, + * "FLAG49": FLAG49, # <<<<<<<<<<<<<< + * "FLAG50": FLAG50, + * "FLAG51": FLAG51, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG49); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG49, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":57 + * "FLAG48": FLAG48, + * "FLAG49": FLAG49, + * "FLAG50": FLAG50, # <<<<<<<<<<<<<< + * "FLAG51": FLAG51, + * "FLAG52": FLAG52, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG50); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG50, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":58 + * "FLAG49": FLAG49, + * "FLAG50": FLAG50, + * "FLAG51": FLAG51, # <<<<<<<<<<<<<< + * "FLAG52": FLAG52, + * "FLAG53": FLAG53, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG51); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG51, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":59 + * "FLAG50": FLAG50, + * "FLAG51": FLAG51, + * "FLAG52": FLAG52, # <<<<<<<<<<<<<< + * "FLAG53": FLAG53, + * "FLAG54": FLAG54, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG52); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG52, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":60 + * "FLAG51": FLAG51, + * "FLAG52": FLAG52, + * "FLAG53": FLAG53, # <<<<<<<<<<<<<< + * "FLAG54": FLAG54, + * "FLAG55": FLAG55, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG53); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG53, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":61 + * "FLAG52": FLAG52, + * "FLAG53": FLAG53, + * "FLAG54": FLAG54, # <<<<<<<<<<<<<< + * "FLAG55": FLAG55, + * "FLAG56": FLAG56, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG54); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG54, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":62 + * "FLAG53": FLAG53, + * "FLAG54": FLAG54, + * "FLAG55": FLAG55, # <<<<<<<<<<<<<< + * "FLAG56": FLAG56, + * "FLAG57": FLAG57, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG55); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG55, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":63 + * "FLAG54": FLAG54, + * "FLAG55": FLAG55, + * "FLAG56": FLAG56, # <<<<<<<<<<<<<< + * "FLAG57": FLAG57, + * "FLAG58": FLAG58, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG56); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG56, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":64 + * "FLAG55": FLAG55, + * "FLAG56": FLAG56, + * "FLAG57": FLAG57, # <<<<<<<<<<<<<< + * "FLAG58": FLAG58, + * "FLAG59": FLAG59, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG57); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG57, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":65 + * "FLAG56": FLAG56, + * "FLAG57": FLAG57, + * "FLAG58": FLAG58, # <<<<<<<<<<<<<< + * "FLAG59": FLAG59, + * "FLAG60": FLAG60, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG58); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG58, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":66 + * "FLAG57": FLAG57, + * "FLAG58": FLAG58, + * "FLAG59": FLAG59, # <<<<<<<<<<<<<< + * "FLAG60": FLAG60, + * "FLAG61": FLAG61, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG59); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG59, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":67 + * "FLAG58": FLAG58, + * "FLAG59": FLAG59, + * "FLAG60": FLAG60, # <<<<<<<<<<<<<< + * "FLAG61": FLAG61, + * "FLAG62": FLAG62, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG60); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG60, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":68 + * "FLAG59": FLAG59, + * "FLAG60": FLAG60, + * "FLAG61": FLAG61, # <<<<<<<<<<<<<< + * "FLAG62": FLAG62, + * "FLAG63": FLAG63, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG61); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG61, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":69 + * "FLAG60": FLAG60, + * "FLAG61": FLAG61, + * "FLAG62": FLAG62, # <<<<<<<<<<<<<< + * "FLAG63": FLAG63, + * "ID": ID, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG62); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG62, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":70 + * "FLAG61": FLAG61, + * "FLAG62": FLAG62, + * "FLAG63": FLAG63, # <<<<<<<<<<<<<< + * "ID": ID, + * "ORTH": ORTH, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_FLAG63); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG63, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":71 + * "FLAG62": FLAG62, + * "FLAG63": FLAG63, + * "ID": ID, # <<<<<<<<<<<<<< + * "ORTH": ORTH, + * "LOWER": LOWER, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_ID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ID, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":72 + * "FLAG63": FLAG63, + * "ID": ID, + * "ORTH": ORTH, # <<<<<<<<<<<<<< + * "LOWER": LOWER, + * "NORM": NORM, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_ORTH); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ORTH, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":73 + * "ID": ID, + * "ORTH": ORTH, + * "LOWER": LOWER, # <<<<<<<<<<<<<< + * "NORM": NORM, + * "SHAPE": SHAPE, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_LOWER); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LOWER, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":74 + * "ORTH": ORTH, + * "LOWER": LOWER, + * "NORM": NORM, # <<<<<<<<<<<<<< + * "SHAPE": SHAPE, + * "PREFIX": PREFIX, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_NORM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_NORM, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":75 + * "LOWER": LOWER, + * "NORM": NORM, + * "SHAPE": SHAPE, # <<<<<<<<<<<<<< + * "PREFIX": PREFIX, + * "SUFFIX": SUFFIX, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_SHAPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SHAPE, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":76 + * "NORM": NORM, + * "SHAPE": SHAPE, + * "PREFIX": PREFIX, # <<<<<<<<<<<<<< + * "SUFFIX": SUFFIX, + * "LENGTH": LENGTH, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_PREFIX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PREFIX, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":77 + * "SHAPE": SHAPE, + * "PREFIX": PREFIX, + * "SUFFIX": SUFFIX, # <<<<<<<<<<<<<< + * "LENGTH": LENGTH, + * "LEMMA": LEMMA, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_SUFFIX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SUFFIX, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":78 + * "PREFIX": PREFIX, + * "SUFFIX": SUFFIX, + * "LENGTH": LENGTH, # <<<<<<<<<<<<<< + * "LEMMA": LEMMA, + * "POS": POS, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_LENGTH); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LENGTH, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":79 + * "SUFFIX": SUFFIX, + * "LENGTH": LENGTH, + * "LEMMA": LEMMA, # <<<<<<<<<<<<<< + * "POS": POS, + * "TAG": TAG, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_LEMMA); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LEMMA, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":80 + * "LENGTH": LENGTH, + * "LEMMA": LEMMA, + * "POS": POS, # <<<<<<<<<<<<<< + * "TAG": TAG, + * "DEP": DEP, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_POS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_POS, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":81 + * "LEMMA": LEMMA, + * "POS": POS, + * "TAG": TAG, # <<<<<<<<<<<<<< + * "DEP": DEP, + * "ENT_IOB": ENT_IOB, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_TAG); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TAG, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":82 + * "POS": POS, + * "TAG": TAG, + * "DEP": DEP, # <<<<<<<<<<<<<< + * "ENT_IOB": ENT_IOB, + * "ENT_TYPE": ENT_TYPE, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_DEP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEP, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":83 + * "TAG": TAG, + * "DEP": DEP, + * "ENT_IOB": ENT_IOB, # <<<<<<<<<<<<<< + * "ENT_TYPE": ENT_TYPE, + * "ENT_ID": ENT_ID, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_ENT_IOB); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ENT_IOB, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":84 + * "DEP": DEP, + * "ENT_IOB": ENT_IOB, + * "ENT_TYPE": ENT_TYPE, # <<<<<<<<<<<<<< + * "ENT_ID": ENT_ID, + * "ENT_KB_ID": ENT_KB_ID, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_ENT_TYPE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ENT_TYPE, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":85 + * "ENT_IOB": ENT_IOB, + * "ENT_TYPE": ENT_TYPE, + * "ENT_ID": ENT_ID, # <<<<<<<<<<<<<< + * "ENT_KB_ID": ENT_KB_ID, + * "HEAD": HEAD, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_ENT_ID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ENT_ID, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":86 + * "ENT_TYPE": ENT_TYPE, + * "ENT_ID": ENT_ID, + * "ENT_KB_ID": ENT_KB_ID, # <<<<<<<<<<<<<< + * "HEAD": HEAD, + * "SENT_START": SENT_START, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_ENT_KB_ID); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ENT_KB_ID, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":87 + * "ENT_ID": ENT_ID, + * "ENT_KB_ID": ENT_KB_ID, + * "HEAD": HEAD, # <<<<<<<<<<<<<< + * "SENT_START": SENT_START, + * "SPACY": SPACY, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_HEAD); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_HEAD, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":88 + * "ENT_KB_ID": ENT_KB_ID, + * "HEAD": HEAD, + * "SENT_START": SENT_START, # <<<<<<<<<<<<<< + * "SPACY": SPACY, + * "LANG": LANG, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_SENT_START); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SENT_START, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":89 + * "HEAD": HEAD, + * "SENT_START": SENT_START, + * "SPACY": SPACY, # <<<<<<<<<<<<<< + * "LANG": LANG, + * "MORPH": MORPH, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_SPACY); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SPACY, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":90 + * "SENT_START": SENT_START, + * "SPACY": SPACY, + * "LANG": LANG, # <<<<<<<<<<<<<< + * "MORPH": MORPH, + * "IDX": IDX, +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_LANG); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LANG, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":91 + * "SPACY": SPACY, + * "LANG": LANG, + * "MORPH": MORPH, # <<<<<<<<<<<<<< + * "IDX": IDX, + * } +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_MORPH); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_MORPH, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/attrs.pyx":92 + * "LANG": LANG, + * "MORPH": MORPH, + * "IDX": IDX, # <<<<<<<<<<<<<< + * } + * +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_IDX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IDX, __pyx_t_4) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_IDS, __pyx_t_2) < (0)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/attrs.pyx":97 + * + * # ATTR IDs, in order of the symbol + * NAMES = [key for key, value in sorted(IDS.items(), key=lambda item: item[1])] # <<<<<<<<<<<<<< + * locals().update(IDS) + * +*/ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + __pyx_t_7 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_IDS); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_items); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9); + assert(__pyx_t_7); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_9, __pyx__function); + __pyx_t_10 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5attrs_4lambda, 0, __pyx_mstate_global->__pyx_n_u_lambda, NULL, __pyx_mstate_global->__pyx_n_u_spacy_attrs, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_9); + #endif + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_t_6}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_key, __pyx_t_9, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_builtin_sorted, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_7 = __pyx_t_4; __Pyx_INCREF(__pyx_t_7); + __pyx_t_3 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 97, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 97, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 97, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_3)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_11(__pyx_t_7); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 97, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 97, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_9); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_6); + } else { + __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + } + #else + __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); + index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_5); if (unlikely(!__pyx_t_9)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + index = 1; __pyx_t_6 = __pyx_t_12(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_5), 2) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_12 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L5_unpacking_done; + __pyx_L4_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_12 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_L5_unpacking_done:; + } + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_key, __pyx_t_9) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_value, __pyx_t_6) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NAMES, __pyx_t_2) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/attrs.pyx":98 + * # ATTR IDs, in order of the symbol + * NAMES = [key for key, value in sorted(IDS.items(), key=lambda item: item[1])] + * locals().update(IDS) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __Pyx_Globals(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_IDS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/attrs.pyx":101 + * + * + * def intify_attrs(stringy_attrs, strings_map=None, _do_deprecated=False): # <<<<<<<<<<<<<< + * """ + * Normalize a dictionary of attributes, converting them to ints. +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5attrs_1intify_attrs, 0, __pyx_mstate_global->__pyx_n_u_intify_attrs, NULL, __pyx_mstate_global->__pyx_n_u_spacy_attrs, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[1]); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_intify_attrs, __pyx_t_2) < (0)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/attrs.pyx":199 + * + * + * def intify_attr(name): # <<<<<<<<<<<<<< + * """ + * Normalize an attribute name, converting it to int. +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5attrs_3intify_attr, 0, __pyx_mstate_global->__pyx_n_u_intify_attr, NULL, __pyx_mstate_global->__pyx_n_u_spacy_attrs, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_intify_attr, __pyx_t_2) < (0)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/attrs.pyx":1 + * # cython: profile=False # <<<<<<<<<<<<<< + * from .errors import Errors + * +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.attrs", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init spacy.attrs"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #else + return __pyx_m; + #endif +} +/* #### Code section: pystring_table ### */ +/* #### Code section: cached_builtins ### */ + +static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_sorted); if (!__pyx_builtin_sorted) __PYX_ERR(0, 97, __pyx_L1_error) + + /* Cached unbound methods */ + __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cached_constants ### */ + +static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "spacy/attrs.pyx":4 + * from .errors import Errors + * + * IOB_STRINGS = ("", "I", "O", "B") # <<<<<<<<<<<<<< + * + * IDS = { +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(4, __pyx_mstate_global->__pyx_kp_u__2, __pyx_mstate_global->__pyx_n_u_I, __pyx_mstate_global->__pyx_n_u_O, __pyx_mstate_global->__pyx_n_u_B); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + + /* "spacy/attrs.pyx":101 + * + * + * def intify_attrs(stringy_attrs, strings_map=None, _do_deprecated=False): # <<<<<<<<<<<<<< + * """ + * Normalize a dictionary of attributes, converting them to ints. +*/ + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(2, Py_None, ((PyObject*)Py_False)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<2; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + { + const struct { const unsigned int length: 10; } index[] = {{1},{0},{1},{15},{12},{4},{7},{7},{7},{7},{6},{1},{4},{8},{3},{6},{10},{5},{6},{7},{9},{8},{4},{6},{1},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{7},{6},{4},{4},{1},{2},{3},{3},{11},{8},{8},{10},{11},{8},{13},{8},{17},{8},{8},{14},{8},{7},{8},{8},{1},{4},{5},{6},{10},{8},{8},{5},{5},{4},{5},{4},{8},{8},{8},{7},{7},{8},{6},{1},{4},{5},{3},{6},{8},{6},{8},{6},{4},{8},{8},{9},{9},{20},{6},{10},{5},{5},{6},{12},{3},{5},{7},{8},{8},{5},{3},{18},{17},{18},{14},{6},{6},{8},{5},{7},{11},{12},{10},{13},{4},{5},{3},{8},{5},{8},{10},{5},{10},{6},{4},{8},{6},{3},{3},{12},{12},{10},{6},{11},{11},{13},{8},{8},{6},{5},{5},{6},{519},{8},{65}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1175 bytes) */ +const char* const cstring = "BZh91AY&SY\032*C\365\000\000y\377\377\347\357\377\266\3579\377\377\277\357\377\342\277\377\377\376@@@@@@@@@@@@@\000@\000P\003\255\323\273\032\272iZ\327\030h\224\324\037\250&\230\322z'\2504\000z\215\000\320\001\240\0001\001\220= 4\003M=4\312\rF\201\000i0\2152\233T\375$\362\032C\324d\000\000\000\001\240i\240\000\0322= \006\210dj\023MSjz\231\251\262\217\322\217\324\324=M4\310\320\006@\000\001\246\200\000\032\000\006\200D\364JyI\241\262\236\241\351\000=CC\324\032\000i\243@\000\000\000\000\000\000\0008\000\000\000\000\000\003 \000\000\000\000\000\000\0002\000>\210\337 i\272\2154\016\245`\033~*\301\260\256\"p\310BQ\000\302\244H \010\216*\304DC\374\347\223\312\004V\377\265\024\344\340\3414o\210B4\030\300\036*|g\264w\021\304+\002uA\"\2129O:\371\241\004\214dj0\210\240/>|\007\240Ix\0230p\252\263\364Z\326\265\256\305\021\301\310\206\231\220ffm\025\004\025UU\211A\005UY\202\250 \241U`\004!\010*\314\252\252\202\244DH\213H\210\211#\246[\0176\236\257x\356j\020\"\036\r]C\315\356\244\024\236\375[^\343H\333/\313>\336\274\032\345/\213`\363\031g/&\323a\330\004\305\240\235!J\256\177\266\351\256\373\020\273\305\320\374\3249\035\260\325Ax=;\224F\002#\024n\2362(Ia\206\030\207\213>\202R\224\245)JR\314\314\314\314\314\314\314\314\314\314\314\315<\337mk\006na\002!\2307\004\355\276}\354\031\326<\364+\260N\350\330\357\226$\304T\254\275\255\005\237X\304gvI\235'K\360\212)\230\264\n\004\010\205\264X\332\306\233\232f9AhWbz\211e|\020\221fu\303!<\331\3161\200\302\214\250U\227\034\372!+\202H\204W\230\325\312\344O8\354F\246J\362\226C\231F\276mMPG\267\225\300\230\\r\226\211%q\270\356\350\374]\257\0336\3151\263\213/jDS\336\330\207l\355Jj\247k\n\207H#\353++pm\256&\341`\267\025\302\310S\0327\3537\325\242Y\337\2003\341\020\036\223\3203\246\322Xu\333 \022(:4\362\023bS\030OX\300\214\371\341u\347\206\334\211\206\356\222\023'\345DGI\203\253&p\364@d\023\243\205i\204\327\316G0\272\261\tl\304\224\026)

-oF\260\357 9\231\356f\211L\006M\370\307\232\260\026J|j\315_EO0\241\316\354\035c\312q5\257*.F%?bX,\201\336-\351\246K\214*\312\366\236T\373{K\337=\260t\335;\211tlY\2535\265z\361\231\224\273\217Q\026Q\356\242TP\252(K(\313(\237\240|\212\022Y\005Y\005Y\005Y\005Y\005Y\005Y\005Y\005Y\005Y\005Y\025Y\025Y\025Y\025Y\025Y\025Y\025Y\025Y\025Y\025\331\022\262%dK\310\226\220-![B\266\204l\t\331\022\262%d\313\310\226\221-#[VjQ\302\202\343\260\316B\237%\r]\2536\306\361\211aT\215\252cT_\300(\211\343\332\206Yw\014\207hM\253\241I\355T\014\003\364\236\255U\366u\027\254J\327\266u\263r\000f\325\250\0332\324\324k.\261\272f\005\235\366\317\272\r\272\335\356\0218@[\257h\256^\205\300eB\247\333vu\320\266Qo\374\2039\226V\221Q\307m[\240\\\303mJ\267kY\272\335ljf\275\251\267ZZS7\353n\243i\354\353DoiF\023-\263\333B\335\205D\331\274\325\266\255F+\212|Sk\351\216\331\266[&\0350y\241Lv\014\267\350\224\231\321(D\1774\200\241\014@-\275\036\355\217\244>dI\273m\273\215\2668a\211\325v`\0335\343\205E\023!\023-\226\360(\264\242>M\0021\006\035\010fE\234[\t\213\345\375\265\222\010\313[\243\320\023N\340/\014\031!\304\032\237\301\277\032x\202\230\354L\330\354\010\236>;s\344\365u\\\315v\235\206f\351r\034\007N\267\006]\0351\356\263\036\264\242\241p\265\272\313B~\351\366Xr(7 \265,\337\213\002\217Q\337\247|\034zA\264\343EI4\022A\3108!^\237rN\216\231\200\305\016\244\013a\022\204D$\324c\207\324{E\374\210\370,N\230G\005\363\027/\355\021\024\247\202\220#\330\000\201l\237\235\005\241 \257\330\030Tp4&\362U\377\300\344`/-\022p\362w\177\331S\3769\220?\364\351\340\320\247?\366\243_YB\310\200\302\"\3407\210\374Q\237I\235\304'(d\033\216\026\017\341\000\tYJ<\2368""\212\343\010\2665\034\321\376\"N\010gb\231\003\226\317\216\350\250/x\224\300n\026\037\"\\\027\227\013>\346\3207^\230\313\365\n\230\253\374\002\021\"\030\0079\212}\230\303(\216Yr*o\005\n\376v\345\376\333\373\273\263\355\367\367V\256\334I\013\363\265\253\347\303\371\372\365\211:\341\351\366|\343\223\254\220}\223\267f[\263\316\214\376+\376(\1779{8\2433\314/\247\233\251\266\210\177\235?\237\255\315\264YG\306\237\246JJ\347\033w\323\227\371\303\234\346\230\373,\255\244C\231\273\225u2\254\372}\352e\205\017\"w\323\316|\343\306\377\347y\267\2761\251\247\305\371\306\255\211\300\r\335\376\313\366\363\323igJ\347w\277\310\206\371U\230\341\326\247p(\032\324+\317>\276X\275\270w1\224\340\037\331\223\374\313\\L\277\203\263:\276\350\310\022P2{>]]\024\021\323\342T{\207\346\020b\033\367R\232\376\016[X\273>)\316^\377Y}\263\372\246p\276\372\376\346\312\225\365\363\337\322B\372U\266:_\2775\031\316\257\335\234xp5\300\206\263\207)\\\2731\351\301\024\344\221-cjz\232u\260\320_\244\315\215\342"; + PyObject *data = __Pyx_DecompressString(cstring, 1106, 1); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #else /* compression: none (1843 bytes) */ +const char* const bytes = ".?spacy/attrs.pyxspacy.errorsAbbrAdjTypeAdpTypeAdvTypeAnimacyAspectBCaseConjTypeDEPDegreeDerivationE1025ENT_IDENT_IOBENT_KB_IDENT_TYPEEchoErrorsFFLAG19FLAG20FLAG21FLAG22FLAG23FLAG24FLAG25FLAG26FLAG27FLAG28FLAG29FLAG30FLAG31FLAG32FLAG33FLAG34FLAG35FLAG36FLAG37FLAG38FLAG39FLAG40FLAG41FLAG42FLAG43FLAG44FLAG45FLAG46FLAG47FLAG48FLAG49FLAG50FLAG51FLAG52FLAG53FLAG54FLAG55FLAG56FLAG57FLAG58FLAG59FLAG60FLAG61FLAG62FLAG63ForeignGenderHEADHyphIIDIDSIDXIOB_STRINGSIS_ALPHAIS_ASCIIIS_BRACKETIS_CURRENCYIS_DIGITIS_LEFT_PUNCTIS_LOWERIS_OOV_DEPRECATEDIS_PUNCTIS_QUOTEIS_RIGHT_PUNCTIS_SPACEIS_STOPIS_TITLEIS_UPPERLLANGLEMMALENGTHLIKE_EMAILLIKE_NUMLIKE_URLLOWERMORPHMoodNAMESNORMNameTypeNegativeNounTypeNumFormNumTypeNumValueNumberOORTHOtherPOSPREFIXPartTypePersonPolarityPolitePossPrepCasePronTypePunctSidePunctType__Pyx_PyDict_NextRefReflexSENT_STARTSHAPESPACYSUFFIXStyleVariantTAGTenseVariantVerbFormVerbTypeVoiceaddasyncio.coroutines__class_getitem__cline_in_traceback_do_deprecatederrorsformat__func__indexint_keyintify_attrintify_attrsinty_attrs_is_coroutineitemitemskeylower__main____module__morphmorph_keysmorphsname__name__numberpoppos__qualname____set_name__setdefaultsortedspacy.attrsstrings_mapstringy_attrstenspect__test__updateuppervaluevalues\320\000 \320 2\260!\360\026\000\005\022\220\021\330\004\007\200q\330\010\013\2104\210s\220!\330\014\031\230\021\230*\240M\260\024\260Q\260a\330\010\013\2104\210s\220!\330\014\031\230\021\230+\240]\260$\260a\260q\330\010\013\2106\220\023\220A\330\014\031\230\021\230)\240=\260\004\260A\260Q\330\010\013\2108\2203\220a\330\014\025\220]\240$\240a\240q\330\010\013\2109\220C\220q\330\014\031\230\024\230Q\230a\330\010\013\210;\220c\230\021\330\014\031\230\024\230Q\230a\330\010\025\220Q\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330""\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\330\014\r\340\010\014\210G\2201\330\014\017\210t\2203\220a\330\020\035\230T\240\021\240!\330\021\024\220F\230#\230S\240\001\330\020\035\230T\240\021\240#\240V\2501\330\021\024\220F\230#\230S\240\001\330\020\035\230T\240\021\240#\240V\2501\330\004\010\210\006\210i\220}\240F\250!\330\010\022\220+\230Q\230a\330\010\013\2108\2207\230!\330\014\017\210x\220s\230!\330\020\023\2206\230\023\230A\330\024\034\230K\240v\250Q\250a\330\025\037\230q\240\007\240q\330\024\032\230*\240A\240V\2506\260\027\270\001\270\026\270q\330\014\017\210|\2307\240%\240t\250:\260Q\260g\270Q\330\020\023\2207\230!\230=\250\001\330\024\034\230K\240t\2501\250A\340\024\034\230K\240q\250\001\330\014\026\220a\220{\240!\330\004\013\2101\260}\300D\310\001\310\021\200\001\360\016\000\005\010\200z\220\021\220&\230\001\330\010\017\210q\330\t\016\210c\220\021\330\010\017\210s\220!\2201\330\t\r\210V\2203\220c\230\021\330\010\017\210s\220!\2204\220v\230Q\330\004\013\2101"; + PyObject *data = NULL; + CYTHON_UNUSED_VAR(__Pyx_DecompressString); + #endif + PyObject **stringtab = __pyx_mstate->__pyx_string_tab; + Py_ssize_t pos = 0; + for (int i = 0; i < 182; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 5) PyUnicode_InternInPlace(&string); + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + stringtab[i] = string; + pos += bytes_length; + } + for (int i = 182; i < 185; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); + stringtab[i] = string; + pos += bytes_length; + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + Py_XDECREF(data); + for (Py_ssize_t i = 0; i < 185; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 182; + for (Py_ssize_t i=0; i<3; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + } + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_codeobjects ### */ +typedef struct { + unsigned int argcount : 2; + unsigned int num_posonly_args : 1; + unsigned int num_kwonly_args : 1; + unsigned int nlocals : 4; + unsigned int flags : 10; + unsigned int first_line : 8; +} __Pyx_PyCode_New_function_description; +/* NewCodeObj.proto */ +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +); + + +static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { + PyObject* tuple_dedup_map = PyDict_New(); + if (unlikely(!tuple_dedup_map)) return -1; + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 97}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_item}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_attrs_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 101}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_stringy_attrs, __pyx_mstate->__pyx_n_u_strings_map, __pyx_mstate->__pyx_n_u_do_deprecated, __pyx_mstate->__pyx_n_u_inty_attrs, __pyx_mstate->__pyx_n_u_morphs, __pyx_mstate->__pyx_n_u_morph_keys, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_int_key}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_attrs_pyx, __pyx_mstate->__pyx_n_u_intify_attrs, __pyx_mstate->__pyx_kp_b_iso88591_2_q_4s_M_Qa_4s_aq_6_A_AQ_83a_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 199}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_name}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_attrs_pyx, __pyx_mstate->__pyx_n_u_intify_attr, __pyx_mstate->__pyx_kp_b_iso88591_z_q_c_s_1_V3c_s_4vQ_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + Py_DECREF(tuple_dedup_map); + return 0; + bad: + Py_DECREF(tuple_dedup_map); + return -1; +} +/* #### Code section: init_globals ### */ + +static int __Pyx_InitGlobals(void) { + /* PythonCompatibility.init */ + if (likely(__Pyx_init_co_variables() == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CommonTypesMetaclass.init */ + if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CachedMethodType.init */ + #if CYTHON_COMPILING_IN_LIMITED_API + { + PyObject *typesModule=NULL; + typesModule = PyImport_ImportModule("types"); + if (typesModule) { + __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + } + } // error handling follows + #endif + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CythonFunctionShared.init */ + if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, + "name '%U' is not defined", name); + } + return result; +} + +/* TupleAndListFromArray (used by fastcall) */ +#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + Py_ssize_t i; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + for (i = 0; i < n; i++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + return res; +} +#elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\ + !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + return PyObject_RichCompareBool(s1, s2, equals); +#else + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length, length2; + int kind; + void *data1, *data2; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + #endif + length = __Pyx_PyUnicode_GET_LENGTH(s1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length < 0)) return -1; + #endif + length2 = __Pyx_PyUnicode_GET_LENGTH(s2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length2 < 0)) return -1; + #endif + if (length != length2) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + return (equals == Py_EQ); +return_ne: + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(n == -1)) return NULL; + #endif + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + if (s == namei) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; + return kwvalues[i]; + } + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { + Py_ssize_t i, nkwargs; + PyObject *dict; +#if !CYTHON_ASSUME_SAFE_SIZE + nkwargs = PyTuple_Size(kwnames); + if (unlikely(nkwargs < 0)) return NULL; +#else + nkwargs = PyTuple_GET_SIZE(kwnames); +#endif + dict = PyDict_New(); + if (unlikely(!dict)) + return NULL; + for (i=0; itp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall (used by PyObjectCallOneArg) */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API + #if PY_VERSION_HEX < 0x03090000 + #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) + #elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { + PyTypeObject *tp = Py_TYPE(callable); + #if defined(__Pyx_CyFunction_USED) + if (__Pyx_CyFunction_CheckExact(callable)) { + return __Pyx_CyFunction_func_vectorcall(callable); + } + #endif + if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { + return NULL; + } + assert(PyCallable_Check(callable)); + Py_ssize_t offset = tp->tp_vectorcall_offset; + assert(offset > 0); + vectorcallfunc ptr; + memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); + return ptr; +} + #else + #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) + #endif +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if CYTHON_COMPILING_IN_LIMITED_API + return PyObject_Vectorcall(func, args, _nargs, NULL); + #else + vectorcallfunc f = __Pyx_PyVectorcall_Function(func); + if (f) { + return f(func, args, _nargs, NULL); + } + #endif + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* PyObjectCallOneArg (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + PyObject *result; + PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + if (unlikely(!selfless_args)) return NULL; + result = PyObject_Call(method, selfless_args, kwargs); + Py_DECREF(selfless_args); + return result; +} +#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { + return _PyObject_Vectorcall + (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames); +} +#else +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { + return +#if PY_VERSION_HEX < 0x03090000 + _PyObject_Vectorcall +#else + PyObject_Vectorcall +#endif + (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames); +} +#endif +static PyMethodDef __Pyx_UnboundCMethod_Def = { + "CythonUnboundCMethod", + __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 + METH_VARARGS | METH_KEYWORDS, +#else + METH_FASTCALL | METH_KEYWORDS, +#endif + NULL +}; +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method, *result=NULL; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + result = method; +#if CYTHON_COMPILING_IN_CPYTHON + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } else +#endif +#if CYTHON_COMPILING_IN_PYPY +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); +#endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); +#endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + result = unbound_method; + } + } +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + if (unlikely(target->method)) { + Py_DECREF(result); + } else +#endif + target->method = result; + return 0; +} + +/* CallUnboundCMethod0 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + if (likely(cfunc->flag == METH_NOARGS)) + return __Pyx_CallCFunction(cfunc, self, NULL); + if (likely(cfunc->flag == METH_FASTCALL)) + return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0); + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL); + if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS))) + return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (cfunc->flag == METH_VARARGS) + return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple); + return __Pyx__CallUnboundCMethod0(cfunc, self); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + PyObject *result; + if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; + result = __Pyx_PyObject_CallOneArg(cfunc->method, self); + return result; +} + +/* py_dict_items (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d); +} + +/* py_dict_values (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d); +} + +/* OwnedDictNext (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) { + PyObject *next = NULL; + if (!*ppos) { + if (pvalue) { + PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p); + if (unlikely(!dictview)) goto bad; + *ppos = PyObject_GetIter(dictview); + Py_DECREF(dictview); + } else { + *ppos = PyObject_GetIter(p); + } + if (unlikely(!*ppos)) goto bad; + } + next = PyIter_Next(*ppos); + if (!next) { + if (PyErr_Occurred()) goto bad; + return 0; + } + if (pkey && pvalue) { + *pkey = __Pyx_PySequence_ITEM(next, 0); + if (unlikely(*pkey)) goto bad; + *pvalue = __Pyx_PySequence_ITEM(next, 1); + if (unlikely(*pvalue)) goto bad; + Py_DECREF(next); + } else if (pkey) { + *pkey = next; + } else { + assert(pvalue); + *pvalue = next; + } + return 1; + bad: + Py_XDECREF(next); +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 + PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef"); +#else + PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef); +#endif + if (pkey) *pkey = NULL; + if (pvalue) *pvalue = NULL; + return 0; +} +#else // !CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) { + int result = PyDict_Next(p, ppos, pkey, pvalue); + if (likely(result == 1)) { + if (pkey) Py_INCREF(*pkey); + if (pvalue) Py_INCREF(*pvalue); + } + return result; +} +#endif + +/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); +} + +/* CallUnboundCMethod2 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, args, 2); + } + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *result = NULL; + PyObject *args = PyTuple_New(2); + if (unlikely(!args)) return NULL; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + return result; + } +#endif + { + PyObject *args[4] = {NULL, self, arg1, arg2}; + return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } +} + +/* ParseKeywordsImpl (used by ParseKeywords) */ +static int __Pyx_ValidateDuplicatePosArgs( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char* function_name) +{ + PyObject ** const *name = argnames; + while (name != first_kw_arg) { + PyObject *key = **name; + int found = PyDict_Contains(kwds, key); + if (unlikely(found)) { + if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; + } + name++; + } + return 0; +bad: + return -1; +} +#if CYTHON_USE_UNICODE_INTERNALS +static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) { + int kind; + Py_ssize_t len = PyUnicode_GET_LENGTH(s1); + if (len != PyUnicode_GET_LENGTH(s2)) return 0; + kind = PyUnicode_KIND(s1); + if (kind != PyUnicode_KIND(s2)) return 0; + const void *data1 = PyUnicode_DATA(s1); + const void *data2 = PyUnicode_DATA(s2); + return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0); +} +#endif +static int __Pyx_MatchKeywordArg_str( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + #if CYTHON_USE_UNICODE_INTERNALS + Py_hash_t key_hash = ((PyASCIIObject*)key)->hash; + if (unlikely(key_hash == -1)) { + key_hash = PyObject_Hash(key); + if (unlikely(key_hash == -1)) + goto bad; + } + #endif + name = first_kw_arg; + while (*name) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) { + *index_found = (size_t) (name - argnames); + return 1; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + *index_found = (size_t) (name - argnames); + return 1; + } + } + #endif + name++; + } + name = argnames; + while (name != first_kw_arg) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) { + if (__Pyx_UnicodeKeywordsEqual(name_str, key)) + goto arg_passed_twice; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + if (unlikely(name_str == key)) goto arg_passed_twice; + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + } + #endif + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +bad: + return -1; +} +static int __Pyx_MatchKeywordArg_nostr( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; + name = first_kw_arg; + while (*name) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (cmp == 1) { + *index_found = (size_t) (name - argnames); + return 1; + } + if (unlikely(cmp == -1)) goto bad; + name++; + } + name = argnames; + while (name != first_kw_arg) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (unlikely(cmp != 0)) { + if (cmp == 1) goto arg_passed_twice; + else goto bad; + } + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +bad: + return -1; +} +static CYTHON_INLINE int __Pyx_MatchKeywordArg( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + return likely(PyUnicode_CheckExact(key)) ? + __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) : + __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name); +} +static void __Pyx_RejectUnknownKeyword( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char *function_name) +{ + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; + #else + Py_ssize_t pos = 0; + #endif + PyObject *key = NULL; + __Pyx_BEGIN_CRITICAL_SECTION(kwds); + while ( + #if CYTHON_AVOID_BORROWED_REFS + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL) + #else + PyDict_Next(kwds, &pos, &key, NULL) + #endif + ) { + PyObject** const *name = first_kw_arg; + while (*name && (**name != key)) name++; + if (!*name) { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp != 1) { + if (cmp == 0) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + break; + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + } + __Pyx_END_CRITICAL_SECTION(); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); + #endif + assert(PyErr_Occurred()); +} +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t extracted = 0; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + name = first_kw_arg; + while (*name && num_kwargs > extracted) { + PyObject * key = **name; + PyObject *value; + int found = 0; + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + found = PyDict_GetItemRef(kwds, key, &value); + #else + value = PyDict_GetItemWithError(kwds, key); + if (value) { + Py_INCREF(value); + found = 1; + } else { + if (unlikely(PyErr_Occurred())) goto bad; + } + #endif + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + extracted++; + } + name++; + } + if (num_kwargs > extracted) { + if (ignore_unknown_kwargs) { + if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1)) + goto bad; + } else { + __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name); + goto bad; + } + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t len; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + if (PyDict_Update(kwds2, kwds) < 0) goto bad; + name = first_kw_arg; + while (*name) { + PyObject *key = **name; + PyObject *value; +#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)) + int found = PyDict_Pop(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int found = PyDict_GetItemRef(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad; + } +#else + #if CYTHON_COMPILING_IN_CPYTHON + value = _PyDict_Pop(kwds2, key, kwds2); + #else + value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2); + #endif + if (value == kwds2) { + Py_DECREF(value); + } else { + if (unlikely(!value)) goto bad; + values[name-argnames] = value; + } +#endif + name++; + } + len = PyDict_Size(kwds2); + if (len > 0) { + return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name); + } else if (unlikely(len == -1)) { + goto bad; + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject *key = NULL; + PyObject** const * name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) { +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); +#else + key = __Pyx_PyTuple_GET_ITEM(kwds, pos); +#endif +#if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!key)) goto bad; +#endif + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + PyObject *value = kwvalues[pos]; + values[name-argnames] = __Pyx_NewRef(value); + } else { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp == 1) { + PyObject *value = kwvalues[pos]; + values[index_found] = __Pyx_NewRef(value); + } else { + if (unlikely(cmp == -1)) goto bad; + if (kwds2) { + PyObject *value = kwvalues[pos]; + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else if (!ignore_unknown_kwargs) { + goto invalid_keyword; + } + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + key = NULL; + #endif + } + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + goto bad; +bad: + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(key); + #endif + return -1; +} + +/* ParseKeywords */ +static int __Pyx_ParseKeywords( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) + return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); + else if (kwds2) + return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name); + else + return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); +} + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* PyObjectFastCallMethod */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { + PyObject *result; + PyObject *attr = PyObject_GetAttr(args[0], name); + if (unlikely(!attr)) + return NULL; + result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); + Py_DECREF(attr); + return result; +} +#endif + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* IterFinish */ +static CYTHON_INLINE int __Pyx_IterFinish(void) { + PyObject* exc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (unlikely(exc_type)) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) + return -1; + __Pyx_PyErr_Clear(); + return 0; + } + return 0; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* PyDictVersioning (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + if (!PyErr_Occurred()) + PyErr_SetNone(PyExc_NameError); + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } + PyErr_Clear(); +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return result; + } +#else + result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyObjectVectorCallKwBuilder (used by PyObjectVectorCallMethodKwBuilder) */ +#if CYTHON_VECTORCALL +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_PyObject_FastCallDict; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + args[n] = value; + return 0; +} +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_VectorcallBuilder_AddArgStr; + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); +} +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + PyObject *pyKey = PyUnicode_FromString(key); + if (!pyKey) return -1; + return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); +} +#else // CYTHON_VECTORCALL +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return PyDict_SetItem(builder, key, value); +} +#endif + +/* PyObjectVectorCallMethodKwBuilder */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) { + PyObject *result; + PyObject *obj = PyObject_GetAttr(args[0], name); + if (unlikely(!obj)) + return NULL; + result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames); + Py_DECREF(obj); + return result; +} +#endif + +/* RaiseException */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); +#elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} + +/* HasAttr */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!PyUnicode_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (!r) { + return (unlikely(PyErr_Occurred())) ? -1 : 0; + } else { + Py_DECREF(r); + return 1; + } +} +#endif + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#endif + +/* ImportImpl (used by Import) */ +static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) { + PyObject *imported_module = PyImport_GetModule(qualname); + if (unlikely(!imported_module)) { + *module = NULL; + if (PyErr_Occurred()) { + return -1; + } + return 0; + } + *module = imported_module; + return 1; +} +static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) { + PyObject *imported_module; + PyObject *top_level_package_name; + Py_ssize_t i; + int status, module_found; + Py_ssize_t dot_index; + module_found = __Pyx__Import_GetModule(qualname, &imported_module); + if (unlikely(!module_found || module_found == -1)) { + *module = NULL; + return module_found; + } + if (imported_names) { + for (i = 0; i < len_imported_names; i++) { + PyObject *imported_name = imported_names[i]; +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 + int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name); +#else + int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name); + if (unlikely(has_imported_attribute == -1)) goto error; +#endif + if (!has_imported_attribute) { + goto not_found; + } + } + *module = imported_module; + return 1; + } + dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1); + if (dot_index == -1) { + *module = imported_module; + return 1; + } + if (unlikely(dot_index == -2)) goto error; + top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index); + if (unlikely(!top_level_package_name)) goto error; + Py_DECREF(imported_module); + status = __Pyx__Import_GetModule(top_level_package_name, module); + Py_DECREF(top_level_package_name); + return status; +error: + Py_DECREF(imported_module); + *module = NULL; + return -1; +not_found: + Py_DECREF(imported_module); + *module = NULL; + return 0; +} +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *from_list = 0; + int module_found; + if (!qualname) { + qualname = name; + } + module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module); + if (likely(module_found == 1)) { + return module; + } else if (unlikely(module_found == -1)) { + return NULL; + } + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + if (imported_names) { +#if CYTHON_COMPILING_IN_CPYTHON + from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names); + if (unlikely(!from_list)) + goto bad; +#else + from_list = PyList_New(len_imported_names); + if (unlikely(!from_list)) goto bad; + for (Py_ssize_t i=0; i__pyx_d, level); +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u_); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\ + CYTHON_COMPILING_IN_GRAAL + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); + } + return value; +} + +/* dict_setdefault (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + PyObject *args[] = {d, key, default_value}; + value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#elif CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#else + value = PyDict_SetDefault(d, key, default_value); + if (unlikely(!value)) return NULL; + Py_INCREF(value); +#endif + return value; +} + +/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static Py_ssize_t __Pyx_GetTypeDictOffset(void) { + PyObject *tp_dictoffset_o; + Py_ssize_t tp_dictoffset; + tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__"); + if (unlikely(!tp_dictoffset_o)) return -1; + tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o); + Py_DECREF(tp_dictoffset_o); + if (unlikely(tp_dictoffset == 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' doesn't have a dictoffset"); + return -1; + } else if (unlikely(tp_dictoffset < 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' has an unexpected negative dictoffset. " + "Please report this as Cython bug"); + return -1; + } + return tp_dictoffset; +} +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) { + static Py_ssize_t tp_dictoffset = 0; + if (unlikely(tp_dictoffset == 0)) { + tp_dictoffset = __Pyx_GetTypeDictOffset(); + if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) { + tp_dictoffset = 0; // try again next time? + return NULL; + } + } + return *(PyObject**)((char*)tp + tp_dictoffset); +} +#endif + +/* SetItemOnTypeDict (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) { + int result; + PyObject *tp_dict; +#if CYTHON_COMPILING_IN_LIMITED_API + tp_dict = __Pyx_GetTypeDict(tp); + if (unlikely(!tp_dict)) return -1; +#else + tp_dict = tp->tp_dict; +#endif + result = PyDict_SetItem(tp_dict, k, v); + if (likely(!result)) { + PyType_Modified(tp); + if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) { + PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL); + if (!setNameResult) return -1; + Py_DECREF(setNameResult); + } + } + return result; +} + +/* FixUpExtensionType (used by FetchCommonType) */ +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if __PYX_LIMITED_VERSION_HEX > 0x030900B1 + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#else + const PyType_Slot *slot = spec->slots; + int changed = 0; +#if !CYTHON_COMPILING_IN_LIMITED_API + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { +#if !CYTHON_COMPILING_IN_CPYTHON + const +#endif // !CYTHON_COMPILING_IN_CPYTHON) + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_vectorcall_offset = memb->offset; + changed = 1; + } +#endif // CYTHON_METH_FASTCALL +#if !CYTHON_COMPILING_IN_PYPY + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } +#endif // !CYTHON_COMPILING_IN_PYPY + } + memb++; + } + } +#endif // !CYTHON_COMPILING_IN_LIMITED_API +#if !CYTHON_COMPILING_IN_PYPY + slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_getset) + slot++; + if (slot && slot->slot == Py_tp_getset) { + PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc; + while (getset && getset->name) { + if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) { + PyObject *descr = PyDescr_NewGetSet(type, getset); + if (unlikely(!descr)) + return -1; + #if CYTHON_COMPILING_IN_LIMITED_API + PyObject *pyname = PyUnicode_FromString(getset->name); + if (unlikely(!pyname)) { + Py_DECREF(descr); + return -1; + } + int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr); + Py_DECREF(pyname); + #else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + #endif + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } + ++getset; + } + } +#else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#endif // !CYTHON_COMPILING_IN_PYPY + if (changed) + PyType_Modified(type); +#endif // PY_VERSION_HEX > 0x030900B1 + return 0; +} + +/* AddModuleRef (used by FetchSharedCythonModule) */ +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { + PyObject *module_dict = PyImport_GetModuleDict(); + PyObject *m; + if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { + return NULL; + } + if (m != NULL && PyModule_Check(m)) { + return m; + } + Py_XDECREF(m); + m = PyModule_NewObject(name); + if (m == NULL) + return NULL; + if (PyDict_CheckExact(module_dict)) { + PyObject *new_m; + (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); + Py_DECREF(m); + return new_m; + } else { + if (PyObject_SetItem(module_dict, name, m) != 0) { + Py_DECREF(m); + return NULL; + } + return m; + } + } + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *py_name = PyUnicode_FromString(name); + if (!py_name) return NULL; + PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); + Py_DECREF(py_name); + return module; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } +#endif + +/* FetchSharedCythonModule (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME); +} + +/* FetchCommonType (used by CommonTypesMetaclass) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases); + if (result && metaclass) { + PyObject *old_tp = (PyObject*)Py_TYPE(result); + Py_INCREF((PyObject*)metaclass); +#if __PYX_LIMITED_VERSION_HEX >= 0x03090000 + Py_SET_TYPE(result, metaclass); +#else + result->ob_type = metaclass; +#endif + Py_DECREF(old_tp); + } + return result; +} +#else +#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b) +#endif +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t expected_basicsize) { + Py_ssize_t basicsize; + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (expected_basicsize == 0) { + return 0; // size is inherited, nothing useful to check + } +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) return -1; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = NULL; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; +#else + basicsize = ((PyTypeObject*) cached_type)->tp_basicsize; +#endif + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name; + int get_item_ref_result; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + py_object_name = PyUnicode_FromString(object_name); + if (!py_object_name) return NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) goto done; + abi_module_dict = PyModule_GetDict(abi_module); + if (!abi_module_dict) goto done; + get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type); + if (get_item_ref_result == 1) { + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else if (unlikely(get_item_ref_result == -1)) { + goto bad; + } + cached_type = __Pyx_PyType_FromMetaclass( + metaclass, + CYTHON_USE_MODULE_STATE ? module : abi_module, + spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type); + if (unlikely(new_cached_type != cached_type)) { + if (unlikely(!new_cached_type)) goto bad; + Py_DECREF(cached_type); + cached_type = new_cached_type; + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else { + Py_DECREF(new_cached_type); + } +done: + Py_XDECREF(abi_module); + Py_DECREF(py_object_name); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +/* CommonTypesMetaclass (used by CythonFunctionShared) */ +static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) { + return PyUnicode_FromString(__PYX_ABI_MODULE_NAME); +} +#if __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) { + PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types"); + return NULL; +} +static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) { + PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable"); + return -1; +} +#endif +static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = { + {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = { + {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset}, + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr}, + #endif + {0, 0} +}; +static PyType_Spec __pyx_CommonTypesMetaclass_spec = { + __PYX_TYPE_MODULE_PREFIX "_common_types_metatype", + 0, + 0, + Py_TPFLAGS_IMMUTABLETYPE | + Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT, + __pyx_CommonTypesMetaclass_slots +}; +static int __pyx_CommonTypesMetaclass_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + PyObject *bases = PyTuple_Pack(1, &PyType_Type); + if (unlikely(!bases)) { + return -1; + } + mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases); + Py_DECREF(bases); + if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) { + return -1; + } + return 0; +} + +/* CallTypeTraverse (used by CythonFunctionShared) */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) { + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000 + if (__Pyx_get_runtime_version() < 0x03090000) return 0; + #endif + if (!always_call) { + PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*); + unsigned long flags = PyType_GetFlags(base); + if (flags & Py_TPFLAGS_HEAPTYPE) { + return 0; + } + } + Py_VISIT((PyObject*)Py_TYPE(o)); + return 0; +} +#endif + +/* PyMethodNew (used by CythonFunctionShared) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *result; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + { + PyObject *args[] = {func, self}; + result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL); + } + #else + result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL); + #endif + return result; +} +#else +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#endif + +/* PyVectorcallFastCallDict (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i; + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos; + #else + Py_ssize_t pos; + #endif + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + #if !CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t nkw = PyDict_Size(kw); + if (unlikely(nkw == -1)) return NULL; + #else + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + #endif + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = 0; + i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) { + keys_are_strings &= + #if CYTHON_COMPILING_IN_LIMITED_API + PyType_GetFlags(Py_TYPE(key)); + #else + Py_TYPE(key)->tp_flags; + #endif + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup; + #else + PyTuple_SET_ITEM(kwnames, i, key); + #endif + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(pos); + #endif + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + Py_ssize_t kw_size = + likely(kw == NULL) ? + 0 : +#if !CYTHON_ASSUME_SAFE_SIZE + PyDict_Size(kw); +#else + PyDict_GET_SIZE(kw); +#endif + if (kw_size == 0) { + return vc(func, args, nargs, NULL); + } +#if !CYTHON_ASSUME_SAFE_SIZE + else if (unlikely(kw_size == -1)) { + return NULL; + } +#endif + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif + +/* CythonFunctionShared (used by CythonFunction) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) { + if (__Pyx_CyFunction_Check(func)) { + return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; + } else if (PyCFunction_Check(func)) { + return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; + } + return 0; +} +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) { + int result; + PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func); + if (unlikely(!newFunc)) { + PyErr_Clear(); // It's only an optimization, so don't throw an error + return 0; + } + result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc); + Py_DECREF(newFunc); + return result; + } + return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc); +} +#else +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if (PyMethod_Check(func)) { + func = PyMethod_GET_FUNCTION(func); + } + return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +} +#endif +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + PyObject *result; + CYTHON_UNUSED_VAR(closure); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_doc_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#else + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_name_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_name, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + PyObject *result; + __Pyx_BEGIN_CRITICAL_SECTION(op); + Py_INCREF(op->func_qualname); + result = op->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +#endif +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_defaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_kwdefaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_annotations_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) { + int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; + if (is_coroutine) { + PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(is_coroutine_value)) { + return is_coroutine_value; + } +ignore: + PyErr_Clear(); + } + return __Pyx_PyBool_FromLong(is_coroutine); +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + result = __Pyx_CyFunction_get_is_coroutine_value(op); + if (unlikely(!result)) + return NULL; + __Pyx_BEGIN_CRITICAL_SECTION(op); + if (op->func_is_coroutine) { + Py_DECREF(result); + result = __Pyx_NewRef(op->func_is_coroutine); + } else { + op->func_is_coroutine = __Pyx_NewRef(result); + } + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, message, size); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + name, message, size); +#endif +} +static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s", + py_name, message); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s", + name, message); +#endif +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, +#else + {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, +#endif + {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#endif +#if CYTHON_METH_FASTCALL +#if CYTHON_COMPILING_IN_LIMITED_API + {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else + {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(args); + __Pyx_BEGIN_CRITICAL_SECTION(m); + Py_INCREF(m->func_qualname); + result = m->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + op->func_dict = NULL; +#endif + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func_dict); +#elif PY_VERSION_HEX < 0x030d0000 + _PyObject_ClearManagedDict((PyObject*)m); +#else + PyObject_ClearManagedDict((PyObject*)m); +#endif + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + Py_CLEAR(m->defaults); + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + { + int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg); + if (e) return e; + } + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func_dict); +#else + { + int e = +#if PY_VERSION_HEX < 0x030d0000 + _PyObject_VisitManagedDict +#else + PyObject_VisitManagedDict +#endif + ((PyObject*)m, visit, arg); + if (e != 0) return e; + } +#endif + __Pyx_VISIT_CONST(m->func_name); + __Pyx_VISIT_CONST(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + __Pyx_VISIT_CONST(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + Py_VISIT(m->defaults); + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ + PyObject *repr; + __Pyx_BEGIN_CRITICAL_SECTION(op); + repr = PyUnicode_FromFormat("", + op->func_qualname, (void *)op); + __Pyx_END_CRITICAL_SECTION(); + return repr; +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes no arguments", size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes exactly one argument", size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } + __Pyx_CyFunction_raise_type_error( + (__pyx_CyFunctionObject*)func, "takes no keyword arguments"); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_SIZE + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(argc < 0)) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "needs an argument"); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "takes no keyword arguments"); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes no arguments", nargs); + return NULL; + } + return meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes exactly one argument", nargs); + return NULL; + } + return meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + #if PY_VERSION_HEX < 0x030e00A6 + size_t nargs_value = (size_t) nargs; + #else + Py_ssize_t nargs_value = nargs; + #endif + return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames); +} +#endif +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if CYTHON_METH_FASTCALL +#if defined(Py_TPFLAGS_HAVE_VECTORCALL) + Py_TPFLAGS_HAVE_VECTORCALL | +#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif +#endif // CYTHON_METH_FASTCALL +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_DICT | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +static int __pyx_CyFunction_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL); + if (unlikely(mstate->__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type); + if (unlikely(!m->defaults)) + return NULL; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* CLineInTraceback (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) +#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); +#else +PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { + PyObject **dict_ptr = _PyObject_GetDictPtr(o); + return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; +} +#endif +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline = NULL; + PyObject *ptype, *pvalue, *ptraceback; + PyObject *cython_runtime_dict; + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, cython_runtime_dict, + __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) + } + if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + Py_XDECREF(use_cline); + Py_XDECREF(cython_runtime_dict); + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache (used by AddTraceback) */ +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { + __Pyx_CachedCodeObjectType* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!code_cache->entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { + return NULL; + } + code_object = code_cache->entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__find_code_object; + return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); + if (old_count < 0) { + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); + return NULL; + } +#endif + __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); +#endif + return result; +#endif +} +static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) +{ + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + code_cache->entries = entries; + code_cache->max_count = 64; + code_cache->count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { + __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_INCREF(code_object); + Py_DECREF(tmp); + return; + } + if (code_cache->count == code_cache->max_count) { + int new_max = code_cache->max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + code_cache->entries = entries; + code_cache->max_count = new_max; + } + for (i=code_cache->count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + code_cache->count++; + Py_INCREF(code_object); +} +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__insert_code_object; + return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type expected = 0; + if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { + return; + } +#endif + __pyx__insert_code_object(code_cache, code_line, code_object); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); +#endif +#endif +} + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!code_object) { + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + } else { + py_funcname = PyUnicode_FromString(funcname); + } + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); + } else { + dict = PyDict_New(); + } + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + } + py_code = PyCode_NewEmpty(filename, funcname, py_line); + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} +#endif + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(enum __pyx_t_5spacy_5attrs_attr_id_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum __pyx_t_5spacy_5attrs_attr_id_t neg_one = (enum __pyx_t_5spacy_5attrs_attr_id_t) -1, const_zero = (enum __pyx_t_5spacy_5attrs_attr_id_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* Globals */ +static PyObject* __Pyx_Globals(void) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_d); +} + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static __Pyx_TypeName +__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) +{ + PyObject *module = NULL, *name = NULL, *result = NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_qualname); + #else + name = PyType_GetQualName(tp); + #endif + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; + module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_module); + if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; + if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { + result = name; + name = NULL; + goto done; + } + result = PyUnicode_FromFormat("%U.%U", module, name); + if (unlikely(result == NULL)) goto bad; + done: + Py_XDECREF(name); + Py_XDECREF(module); + return result; + bad: + PyErr_Clear(); + if (name) { + result = name; + name = NULL; + } else { + result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__3); + } + goto done; +} +#endif + +/* CIntFromPyVerify (used by CIntFromPy) */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + long val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (long) -1; + val = __Pyx_PyLong_As_long(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + long val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (long) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (long) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = v; + } + v = NULL; + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((long) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (long) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + int val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (int) -1; + val = __Pyx_PyLong_As_int(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(int) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + int val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (int) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = v; + } + v = NULL; + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((int) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (int) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); + for (i=0; i>= 8; + ++i; + } + __Pyx_cached_runtime_version = version; + } +} +#endif +static unsigned long __Pyx_get_runtime_version(void) { +#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + return Py_Version & ~0xFFUL; +#else + return __Pyx_cached_runtime_version; +#endif +} + +/* CheckBinaryVersion */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { + const unsigned long MAJOR_MINOR = 0xFFFF0000UL; + if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) + return 0; + if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) + return 1; + { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compile time Python version %d.%d " + "of module '%.100s' " + "%s " + "runtime version %d.%d", + (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), + __Pyx_MODULE_NAME, + (allow_newer) ? "was newer than" : "does not match", + (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) + ); + return PyErr_WarnEx(NULL, message, 1); + } +} + +/* NewCodeObj */ +#if CYTHON_COMPILING_IN_LIMITED_API + static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + PyObject *version_info; + PyObject *py_minor_version = NULL; + #endif + long minor_version = 0; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + minor_version = 11; + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + Py_DECREF(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + if (type) { + PyErr_Restore(type, value, traceback); + } + return result; + } +#elif PY_VERSION_HEX >= 0x030B0000 + static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1 + if (likely(result)) + result->_co_firsttraceable = 0; + #endif + return result; + } +#elif !CYTHON_COMPILING_IN_PYPY + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +) { + PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL; + Py_ssize_t var_count = (Py_ssize_t) descr.nlocals; + PyObject *varnames_tuple = PyTuple_New(var_count); + if (unlikely(!varnames_tuple)) return NULL; + for (Py_ssize_t i=0; i < var_count; i++) { + Py_INCREF(varnames[i]); + if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done; + } + #if CYTHON_COMPILING_IN_LIMITED_API + varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple); + if (!varnames_tuple_dedup) { + if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done; + varnames_tuple_dedup = varnames_tuple; + } + #else + varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple); + if (unlikely(!varnames_tuple_dedup)) goto done; + #endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(varnames_tuple_dedup); + #endif + if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) { + Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(line_table_length == -1)) goto done; + #endif + Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL; + code_bytes = PyBytes_FromStringAndSize(NULL, code_len); + if (unlikely(!code_bytes)) goto done; + char* c_code_bytes = PyBytes_AsString(code_bytes); + if (unlikely(!c_code_bytes)) goto done; + memset(c_code_bytes, 0, (size_t) code_len); + } + code_obj = (PyObject*) __Pyx__PyCode_New( + (int) descr.argcount, + (int) descr.num_posonly_args, + (int) descr.num_kwonly_args, + (int) descr.nlocals, + 0, + (int) descr.flags, + code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + varnames_tuple_dedup, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + filename, + funcname, + (int) descr.first_line, + (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes + ); +done: + Py_XDECREF(code_bytes); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(varnames_tuple_dedup); + #endif + Py_DECREF(varnames_tuple); + return code_obj; +} + +/* DecompressString */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { + PyObject *module, *decompress, *compressed_bytes, *decompressed; + const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; + PyObject *methodname = PyUnicode_FromString("decompress"); + if (unlikely(!methodname)) return NULL; + #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 + if (algo == 3) { + PyObject *fromlist = Py_BuildValue("[O]", methodname); + if (unlikely(!fromlist)) return NULL; + module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + } else + #endif + module = PyImport_ImportModule(module_name); + if (unlikely(!module)) goto import_failed; + decompress = PyObject_GetAttr(module, methodname); + if (unlikely(!decompress)) goto import_failed; + { + #ifdef __cplusplus + char *memview_bytes = const_cast(s); + #else + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wcast-qual" + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-qual" + #endif + char *memview_bytes = (char*) s; + #if defined(__clang__) + #pragma clang diagnostic pop + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + #endif + #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) + int memview_flags = 0x100; + #else + int memview_flags = PyBUF_READ; + #endif + compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); + } + if (unlikely(!compressed_bytes)) { + Py_DECREF(decompress); + goto bad; + } + decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); + Py_DECREF(compressed_bytes); + Py_DECREF(decompress); + Py_DECREF(module); + Py_DECREF(methodname); + return decompressed; +import_failed: + PyErr_Format(PyExc_ImportError, + "Failed to import '%.20s.decompress' - cannot initialise module strings. " + "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", + module_name, algo); +bad: + Py_XDECREF(module); + Py_DECREF(methodname); + return NULL; +} + +#include +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return __Pyx_PyUnicode_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return PyByteArray_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + { + const char* result; + Py_ssize_t unicode_length; + CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; + #else + result = PyUnicode_AsUTF8AndSize(o, length); + #endif + #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + unicode_length = PyUnicode_GetLength(o); + if (unlikely(unicode_length < 0)) return NULL; + if (unlikely(unicode_length != *length)) { + PyUnicode_AsASCIIString(o); + return NULL; + } + #endif + return result; + } +#else +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +#endif +} +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + if (PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif + if (PyByteArray_Check(o)) { +#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); +#else + *length = PyByteArray_Size(o); + if (*length == -1) return NULL; + return PyByteArray_AsString(o); +#endif + } else + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; + } + __Pyx_DECREF_TypeName(result_type_name); + return result; + } + PyErr_Format(PyExc_TypeError, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", + result_type_name); + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + PyObject *res = NULL; + if (likely(PyLong_Check(x))) + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + if (likely(m && m->nb_int)) { + res = m->nb_int(x); + } +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Long(x); + } +#endif + if (likely(res)) { + if (unlikely(!PyLong_CheckExact(res))) { + return __Pyx_PyNumber_LongWrongResultType(res); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); + } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyLong_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyLong_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { + CYTHON_UNUSED_VAR(b); + return __Pyx_NewRef(Py_None); +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return __Pyx_NewRef(b ? Py_True: Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { + return PyLong_FromSize_t(ival); +} + + +/* MultiPhaseInitModuleState */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 +#else + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 +#endif +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS +#error "Module state with PEP489 requires atomics. Currently that's one of\ + C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" +#endif +#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#define __Pyx_ModuleStateLookup_Lock() +#define __Pyx_ModuleStateLookup_Unlock() +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 +static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; +#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(__cplusplus) && __cplusplus >= 201103L +#include +static std::mutex __Pyx_ModuleStateLookup_mutex; +#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() +#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) +#include +static mtx_t __Pyx_ModuleStateLookup_mutex; +static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; +static void __Pyx_ModuleStateLookup_initialize_mutex(void) { + mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); +} +#define __Pyx_ModuleStateLookup_Lock()\ + call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ + mtx_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(HAVE_PTHREAD_H) +#include +static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; +#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(_WIN32) +#include // synchapi.h on its own doesn't work +static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; +#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#else +#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ + Requires C standard >= C11, or C++ standard >= C++11,\ + or pthreads, or the Windows 32 API, or Python >= 3.13." +#endif +typedef struct { + int64_t id; + PyObject *module; +} __Pyx_InterpreterIdAndModule; +typedef struct { + char interpreter_id_as_index; + Py_ssize_t count; + Py_ssize_t allocated; + __Pyx_InterpreterIdAndModule table[1]; +} __Pyx_ModuleStateLookupData; +#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; +#else +static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; +#endif +static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( + __Pyx_InterpreterIdAndModule* table, + Py_ssize_t count, + int64_t interpreterId) { + __Pyx_InterpreterIdAndModule* begin = table; + __Pyx_InterpreterIdAndModule* end = begin + count; + if (begin->id == interpreterId) { + return begin; + } + while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; + if (halfway->id == interpreterId) { + return halfway; + } + if (halfway->id < interpreterId) { + begin = halfway; + } else { + end = halfway; + } + } + for (; begin < end; ++begin) { + if (begin->id >= interpreterId) return begin; + } + return begin; +} +static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return NULL; +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + { + __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + if (likely(data)) { + __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); + if (likely(data == new_data)) { + goto read_finished; + } + } + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + __Pyx_ModuleStateLookup_Lock(); + __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); + data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + __Pyx_ModuleStateLookup_Unlock(); + } + read_finished:; +#else + __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_InterpreterIdAndModule* found = NULL; + if (unlikely(!data)) goto end; + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + found = data->table+interpreter_id; + } + } else { + found = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + } + end: + { + PyObject *result=NULL; + if (found && found->id == interpreter_id) { + result = found->module; + } +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); +#endif + return result; + } +} +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { + while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); +} +#else +#define __Pyx_ModuleStateLookup_wait_until_no_readers() +#endif +static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { + Py_ssize_t to_allocate = (*old_data)->allocated; + while (to_allocate <= interpreter_id) { + if (to_allocate == 0) to_allocate = 1; + else to_allocate *= 2; + } + __Pyx_ModuleStateLookupData *new_data = *old_data; + if (to_allocate != (*old_data)->allocated) { + new_data = (__Pyx_ModuleStateLookupData *)realloc( + *old_data, + sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + PyErr_NoMemory(); + return -1; + } + for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { + new_data->table[i].id = i; + new_data->table[i].module = NULL; + } + new_data->allocated = to_allocate; + } + new_data->table[interpreter_id].module = module; + if (new_data->count < interpreter_id+1) { + new_data->count = interpreter_id+1; + } + *old_data = new_data; + return 0; +} +static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { + __Pyx_InterpreterIdAndModule *read = data->table; + __Pyx_InterpreterIdAndModule *write = data->table; + __Pyx_InterpreterIdAndModule *end = read + data->count; + for (; readmodule) { + write->id = read->id; + write->module = read->module; + ++write; + } + } + data->count = write - data->table; + for (; writeid = 0; + write->module = NULL; + } + data->interpreter_id_as_index = 0; +} +static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + int result = 0; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_ModuleStateLookupData *new_data = old_data; + if (!new_data) { + new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); + if (!new_data) { + result = -1; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = 1; + new_data->interpreter_id_as_index = 1; + } + __Pyx_ModuleStateLookup_wait_until_no_readers(); + if (new_data->interpreter_id_as_index) { + if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); + goto end; + } + __Pyx_State_ConvertFromInterpIdAsIndex(new_data); + } + { + Py_ssize_t insert_at = 0; + { + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + new_data->table, new_data->count, interpreter_id); + assert(lower_bound); + insert_at = lower_bound - new_data->table; + if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { + lower_bound->module = module; + goto end; // already in table, nothing more to do + } + } + if (new_data->count+1 >= new_data->allocated) { + Py_ssize_t to_allocate = (new_data->count+1)*2; + new_data = + (__Pyx_ModuleStateLookupData*)realloc( + new_data, + sizeof(__Pyx_ModuleStateLookupData) + + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + result = -1; + new_data = old_data; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = to_allocate; + } + ++new_data->count; + int64_t last_id = interpreter_id; + PyObject *last_module = module; + for (Py_ssize_t i=insert_at; icount; ++i) { + int64_t current_id = new_data->table[i].id; + new_data->table[i].id = last_id; + last_id = current_id; + PyObject *current_module = new_data->table[i].module; + new_data->table[i].module = last_module; + last_module = current_module; + } + } + end: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); +#else + __Pyx_ModuleStateLookup_data = new_data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return result; +} +static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; +#endif + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + data->table[interpreter_id].module = NULL; + } + goto done; + } + { + __Pyx_ModuleStateLookup_wait_until_no_readers(); + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + if (!lower_bound) goto done; + if (lower_bound->id != interpreter_id) goto done; + __Pyx_InterpreterIdAndModule *end = data->table+data->count; + for (;lower_boundid = (lower_bound+1)->id; + lower_bound->module = (lower_bound+1)->module; + } + } + --data->count; + if (data->count == 0) { + free(data); + data = NULL; + } + done: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); +#else + __Pyx_ModuleStateLookup_data = data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return 0; +} +#endif + +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ +#endif /* Py_PYTHON_H */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/attrs.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/attrs.pxd new file mode 100644 index 0000000000000000000000000000000000000000..691d4516e7a94939f7cfe9bd34e971f5d94f4253 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/attrs.pxd @@ -0,0 +1,99 @@ +# Reserve 64 values for flag features +from . cimport symbols + + +cdef enum attr_id_t: + NULL_ATTR + IS_ALPHA + IS_ASCII + IS_DIGIT + IS_LOWER + IS_PUNCT + IS_SPACE + IS_TITLE + IS_UPPER + LIKE_URL + LIKE_NUM + LIKE_EMAIL + IS_STOP + IS_OOV_DEPRECATED + IS_BRACKET + IS_QUOTE + IS_LEFT_PUNCT + IS_RIGHT_PUNCT + IS_CURRENCY + + FLAG19 = 19 + FLAG20 + FLAG21 + FLAG22 + FLAG23 + FLAG24 + FLAG25 + FLAG26 + FLAG27 + FLAG28 + FLAG29 + FLAG30 + FLAG31 + FLAG32 + FLAG33 + FLAG34 + FLAG35 + FLAG36 + FLAG37 + FLAG38 + FLAG39 + FLAG40 + FLAG41 + FLAG42 + FLAG43 + FLAG44 + FLAG45 + FLAG46 + FLAG47 + FLAG48 + FLAG49 + FLAG50 + FLAG51 + FLAG52 + FLAG53 + FLAG54 + FLAG55 + FLAG56 + FLAG57 + FLAG58 + FLAG59 + FLAG60 + FLAG61 + FLAG62 + FLAG63 + + ID + ORTH + LOWER + NORM + SHAPE + PREFIX + SUFFIX + + LENGTH + CLUSTER + LEMMA + POS + TAG + DEP + ENT_IOB + ENT_TYPE + HEAD + SENT_START + SPACY + PROB + + LANG + ENT_KB_ID = symbols.ENT_KB_ID + MORPH + ENT_ID = symbols.ENT_ID + + IDX + SENT_END diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/attrs.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/attrs.pyx new file mode 100644 index 0000000000000000000000000000000000000000..af8aa5ee5358d16036095efe180e4c4f085d7118 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/attrs.pyx @@ -0,0 +1,212 @@ +# cython: profile=False +from .errors import Errors + +IOB_STRINGS = ("", "I", "O", "B") + +IDS = { + "": NULL_ATTR, + "IS_ALPHA": IS_ALPHA, + "IS_ASCII": IS_ASCII, + "IS_DIGIT": IS_DIGIT, + "IS_LOWER": IS_LOWER, + "IS_PUNCT": IS_PUNCT, + "IS_SPACE": IS_SPACE, + "IS_TITLE": IS_TITLE, + "IS_UPPER": IS_UPPER, + "LIKE_URL": LIKE_URL, + "LIKE_NUM": LIKE_NUM, + "LIKE_EMAIL": LIKE_EMAIL, + "IS_STOP": IS_STOP, + "IS_OOV_DEPRECATED": IS_OOV_DEPRECATED, + "IS_BRACKET": IS_BRACKET, + "IS_QUOTE": IS_QUOTE, + "IS_LEFT_PUNCT": IS_LEFT_PUNCT, + "IS_RIGHT_PUNCT": IS_RIGHT_PUNCT, + "IS_CURRENCY": IS_CURRENCY, + "FLAG19": FLAG19, + "FLAG20": FLAG20, + "FLAG21": FLAG21, + "FLAG22": FLAG22, + "FLAG23": FLAG23, + "FLAG24": FLAG24, + "FLAG25": FLAG25, + "FLAG26": FLAG26, + "FLAG27": FLAG27, + "FLAG28": FLAG28, + "FLAG29": FLAG29, + "FLAG30": FLAG30, + "FLAG31": FLAG31, + "FLAG32": FLAG32, + "FLAG33": FLAG33, + "FLAG34": FLAG34, + "FLAG35": FLAG35, + "FLAG36": FLAG36, + "FLAG37": FLAG37, + "FLAG38": FLAG38, + "FLAG39": FLAG39, + "FLAG40": FLAG40, + "FLAG41": FLAG41, + "FLAG42": FLAG42, + "FLAG43": FLAG43, + "FLAG44": FLAG44, + "FLAG45": FLAG45, + "FLAG46": FLAG46, + "FLAG47": FLAG47, + "FLAG48": FLAG48, + "FLAG49": FLAG49, + "FLAG50": FLAG50, + "FLAG51": FLAG51, + "FLAG52": FLAG52, + "FLAG53": FLAG53, + "FLAG54": FLAG54, + "FLAG55": FLAG55, + "FLAG56": FLAG56, + "FLAG57": FLAG57, + "FLAG58": FLAG58, + "FLAG59": FLAG59, + "FLAG60": FLAG60, + "FLAG61": FLAG61, + "FLAG62": FLAG62, + "FLAG63": FLAG63, + "ID": ID, + "ORTH": ORTH, + "LOWER": LOWER, + "NORM": NORM, + "SHAPE": SHAPE, + "PREFIX": PREFIX, + "SUFFIX": SUFFIX, + "LENGTH": LENGTH, + "LEMMA": LEMMA, + "POS": POS, + "TAG": TAG, + "DEP": DEP, + "ENT_IOB": ENT_IOB, + "ENT_TYPE": ENT_TYPE, + "ENT_ID": ENT_ID, + "ENT_KB_ID": ENT_KB_ID, + "HEAD": HEAD, + "SENT_START": SENT_START, + "SPACY": SPACY, + "LANG": LANG, + "MORPH": MORPH, + "IDX": IDX, +} + + +# ATTR IDs, in order of the symbol +NAMES = [key for key, value in sorted(IDS.items(), key=lambda item: item[1])] +locals().update(IDS) + + +def intify_attrs(stringy_attrs, strings_map=None, _do_deprecated=False): + """ + Normalize a dictionary of attributes, converting them to ints. + + stringy_attrs (dict): Dictionary keyed by attribute string names. Values + can be ints or strings. + strings_map (StringStore): Defaults to None. If provided, encodes string + values into ints. + RETURNS (dict): Attributes dictionary with keys and optionally values + converted to ints. + """ + inty_attrs = {} + if _do_deprecated: + if "F" in stringy_attrs: + stringy_attrs["ORTH"] = stringy_attrs.pop("F") + if "L" in stringy_attrs: + stringy_attrs["LEMMA"] = stringy_attrs.pop("L") + if "pos" in stringy_attrs: + stringy_attrs["TAG"] = stringy_attrs.pop("pos") + if "morph" in stringy_attrs: + morphs = stringy_attrs.pop("morph") # no-cython-lint + if "number" in stringy_attrs: + stringy_attrs.pop("number") + if "tenspect" in stringy_attrs: + stringy_attrs.pop("tenspect") + morph_keys = [ + "PunctType", + "PunctSide", + "Other", + "Degree", + "AdvType", + "Number", + "VerbForm", + "PronType", + "Aspect", + "Tense", + "PartType", + "Poss", + "Hyph", + "ConjType", + "NumType", + "Foreign", + "VerbType", + "NounType", + "Gender", + "Mood", + "Negative", + "Tense", + "Voice", + "Abbr", + "Derivation", + "Echo", + "Foreign", + "NameType", + "NounType", + "NumForm", + "NumValue", + "PartType", + "Polite", + "StyleVariant", + "PronType", + "AdjType", + "Person", + "Variant", + "AdpType", + "Reflex", + "Negative", + "Mood", + "Aspect", + "Case", + "Polarity", + "PrepCase", + "Animacy", # U20 + ] + for key in morph_keys: + if key in stringy_attrs: + stringy_attrs.pop(key) + elif key.lower() in stringy_attrs: + stringy_attrs.pop(key.lower()) + elif key.upper() in stringy_attrs: + stringy_attrs.pop(key.upper()) + for name, value in stringy_attrs.items(): + int_key = intify_attr(name) + if int_key is not None: + if int_key == ENT_IOB: + if value in IOB_STRINGS: + value = IOB_STRINGS.index(value) + elif isinstance(value, str): + raise ValueError(Errors.E1025.format(value=value)) + if strings_map is not None and isinstance(value, str): + if hasattr(strings_map, "add"): + value = strings_map.add(value) + else: + value = strings_map[value] + inty_attrs[int_key] = value + return inty_attrs + + +def intify_attr(name): + """ + Normalize an attribute name, converting it to int. + + stringy_attr (string): Attribute string name. Can also be int (will then be left unchanged) + RETURNS (int): int representation of the attribute, or None if it couldn't be converted. + """ + if isinstance(name, int): + return name + elif name in IDS: + return IDS[name] + elif name.upper() in IDS: + return IDS[name.upper()] + return None diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/compat.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/compat.py new file mode 100644 index 0000000000000000000000000000000000000000..a5744f8ab97c404714508a5eb18f7aa63e6c2c98 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/compat.py @@ -0,0 +1,50 @@ +"""Helpers for Python and platform compatibility.""" + +import sys + +from thinc.util import copy_array + +try: + import cPickle as pickle +except ImportError: + import pickle # type: ignore[no-redef] + +try: + import copy_reg +except ImportError: + import copyreg as copy_reg # type: ignore[no-redef] + +try: + from cupy.cuda.stream import Stream as CudaStream +except ImportError: + CudaStream = None + +try: + import cupy +except ImportError: + cupy = None + +if sys.version_info[:2] >= (3, 8): # Python 3.8+ + from typing import Literal, Protocol, runtime_checkable +else: + from typing_extensions import Literal, Protocol, runtime_checkable # noqa: F401 + +# Important note: The importlib_metadata "backport" includes functionality +# that's not part of the built-in importlib.metadata. We should treat this +# import like the built-in and only use what's available there. +try: # Python 3.8+ + import importlib.metadata as importlib_metadata +except ImportError: + from catalogue import _importlib_metadata as importlib_metadata # type: ignore[no-redef] # noqa: F401 + +from thinc.api import Optimizer # noqa: F401 + +pickle = pickle +copy_reg = copy_reg +CudaStream = CudaStream +cupy = cupy +copy_array = copy_array + +is_windows = sys.platform.startswith("win") +is_linux = sys.platform.startswith("linux") +is_osx = sys.platform == "darwin" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/default_config.cfg b/TTS/Kokoro/.venv/Lib/site-packages/spacy/default_config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..1804ac6684b84c0474935889d2d505da2a576e8d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/default_config.cfg @@ -0,0 +1,140 @@ +[paths] +train = null +dev = null +vectors = null +init_tok2vec = null + +[system] +seed = 0 +gpu_allocator = null + +[nlp] +lang = null +# List of pipeline component names, in order. The names should correspond to +# components defined in the [components block] +pipeline = [] +# Components that are loaded but disabled by default +disabled = [] +# Optional callbacks to modify the nlp object before it's initialized, after +# it's created and after the pipeline has been set up +before_creation = null +after_creation = null +after_pipeline_creation = null +# Default batch size to use with nlp.pipe and nlp.evaluate +batch_size = 1000 + +[nlp.tokenizer] +@tokenizers = "spacy.Tokenizer.v1" + +[nlp.vectors] +@vectors = "spacy.Vectors.v1" + +# The pipeline components and their models +[components] + +# Readers for corpora like dev and train. +[corpora] + +[corpora.train] +@readers = "spacy.Corpus.v1" +path = ${paths.train} +# Whether to train on sequences with 'gold standard' sentence boundaries +# and tokens. If you set this to true, take care to ensure your run-time +# data is passed in sentence-by-sentence via some prior preprocessing. +gold_preproc = false +# Limitations on training document length +max_length = 0 +# Limitation on number of training examples +limit = 0 +# Apply some simply data augmentation, where we replace tokens with variations. +# This is especially useful for punctuation and case replacement, to help +# generalize beyond corpora that don't/only have smart quotes etc. +augmenter = null + +[corpora.dev] +@readers = "spacy.Corpus.v1" +path = ${paths.dev} +# Whether to train on sequences with 'gold standard' sentence boundaries +# and tokens. If you set this to true, take care to ensure your run-time +# data is passed in sentence-by-sentence via some prior preprocessing. +gold_preproc = false +# Limitations on training document length +max_length = 0 +# Limitation on number of training examples +limit = 0 +# Optional callback for data augmentation +augmenter = null + +# Training hyper-parameters and additional features. +[training] +seed = ${system.seed} +gpu_allocator = ${system.gpu_allocator} +dropout = 0.1 +accumulate_gradient = 1 +# Controls early-stopping, i.e., the number of steps to continue without +# improvement before stopping. 0 disables early stopping. +patience = 1600 +# Number of epochs. 0 means unlimited. If >= 0, train corpus is loaded once in +# memory and shuffled within the training loop. -1 means stream train corpus +# rather than loading in memory with no shuffling within the training loop. +max_epochs = 0 +# Maximum number of update steps to train for. 0 means an unlimited number of steps. +max_steps = 20000 +eval_frequency = 200 +# Control how scores are printed and checkpoints are evaluated. +score_weights = {} +# Names of pipeline components that shouldn't be updated during training +frozen_components = [] +# Names of pipeline components that should set annotations during training +annotating_components = [] +# Location in the config where the dev corpus is defined +dev_corpus = "corpora.dev" +# Location in the config where the train corpus is defined +train_corpus = "corpora.train" +# Optional callback before nlp object is saved to disk after training +before_to_disk = null +# Optional callback that is invoked at the start of each training step +before_update = null + +[training.logger] +@loggers = "spacy.ConsoleLogger.v1" + +[training.batcher] +@batchers = "spacy.batch_by_words.v1" +discard_oversize = false +tolerance = 0.2 + +[training.batcher.size] +@schedules = "compounding.v1" +start = 100 +stop = 1000 +compound = 1.001 + +[training.optimizer] +@optimizers = "Adam.v1" +beta1 = 0.9 +beta2 = 0.999 +L2_is_weight_decay = true +L2 = 0.01 +grad_clip = 1.0 +use_averages = false +eps = 1e-8 +learn_rate = 0.001 + +# These settings are used when nlp.initialize() is called (typically before +# training or pretraining). Components and the tokenizer can each define their +# own arguments via their initialize methods that are populated by the config. +# This lets them gather data resources, build label sets etc. +[initialize] +vectors = ${paths.vectors} +# Extra resources for transfer-learning or pseudo-rehearsal +init_tok2vec = ${paths.init_tok2vec} +# Data and lookups for vocabulary +vocab_data = null +lookups = null +# Arguments passed to the tokenizer's initialize method +tokenizer = {} +# Arguments for initialize methods of the components (keyed by component) +components = {} +before_init = null +after_init = null diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/default_config_pretraining.cfg b/TTS/Kokoro/.venv/Lib/site-packages/spacy/default_config_pretraining.cfg new file mode 100644 index 0000000000000000000000000000000000000000..6c99b9f341ed3fa2d958784bb099d6530e48f539 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/default_config_pretraining.cfg @@ -0,0 +1,44 @@ +[paths] +raw_text = null + +[pretraining] +max_epochs = 1000 +dropout = 0.2 +n_save_every = null +n_save_epoch = null +component = "tok2vec" +layer = "" +corpus = "corpora.pretrain" + +[pretraining.batcher] +@batchers = "spacy.batch_by_words.v1" +size = 3000 +discard_oversize = false +tolerance = 0.2 +get_length = null + +[pretraining.objective] +@architectures = "spacy.PretrainCharacters.v1" +maxout_pieces = 3 +hidden_size = 300 +n_characters = 4 + +[pretraining.optimizer] +@optimizers = "Adam.v1" +beta1 = 0.9 +beta2 = 0.999 +L2_is_weight_decay = true +L2 = 0.01 +grad_clip = 1.0 +use_averages = true +eps = 1e-8 +learn_rate = 0.001 + +[corpora] + +[corpora.pretrain] +@readers = "spacy.JsonlCorpus.v1" +path = ${paths.raw_text} +min_length = 5 +max_length = 500 +limit = 0 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/errors.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/errors.py new file mode 100644 index 0000000000000000000000000000000000000000..2297d6fe1326663e88da12b3692c459b5851fd91 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/errors.py @@ -0,0 +1,1017 @@ +import warnings + +from .compat import Literal + + +class ErrorsWithCodes(type): + def __getattribute__(self, code): + msg = super().__getattribute__(code) + if code.startswith("__"): # python system attributes like __class__ + return msg + else: + return "[{code}] {msg}".format(code=code, msg=msg) + + +def setup_default_warnings(): + # ignore certain numpy warnings + filter_warning("ignore", error_msg="numpy.dtype size changed") # noqa + filter_warning("ignore", error_msg="numpy.ufunc size changed") # noqa + + # warn about entity_ruler, span_ruler & matcher having no patterns only once + for pipe in ["matcher", "entity_ruler", "span_ruler"]: + filter_warning("once", error_msg=Warnings.W036.format(name=pipe)) + + # warn once about lemmatizer without required POS + filter_warning("once", error_msg=Warnings.W108) + + # floret vector table cannot be modified + filter_warning("once", error_msg="[W114]") + + +def filter_warning( + action: Literal["default", "error", "ignore", "always", "module", "once"], + error_msg: str, +): + """Customize how spaCy should handle a certain warning. + + error_msg (str): e.g. "W006", or a full error message + action (str): "default", "error", "ignore", "always", "module" or "once" + """ + warnings.filterwarnings(action, message=_escape_warning_msg(error_msg)) + + +def _escape_warning_msg(msg): + """To filter with warnings.filterwarnings, the [] brackets need to be escaped""" + return msg.replace("[", "\\[").replace("]", "\\]") + + +# fmt: off + +class Warnings(metaclass=ErrorsWithCodes): + W005 = ("Doc object not parsed. This means displaCy won't be able to " + "generate a dependency visualization for it. Make sure the Doc " + "was processed with a model that supports dependency parsing, and " + "not just a language class like `English()`. For more info, see " + "the docs:\nhttps://spacy.io/usage/models") + W006 = ("No entities to visualize found in Doc object. If this is " + "surprising to you, make sure the Doc was processed using a model " + "that supports named entity recognition, and check the `doc.ents` " + "property manually if necessary.") + W007 = ("The model you're using has no word vectors loaded, so the result " + "of the {obj}.similarity method will be based on the tagger, " + "parser and NER, which may not give useful similarity judgements. " + "This may happen if you're using one of the small models, e.g. " + "`en_core_web_sm`, which don't ship with word vectors and only " + "use context-sensitive tensors. You can always add your own word " + "vectors, or use one of the larger models instead if available.") + W008 = ("Evaluating {obj}.similarity based on empty vectors.") + W011 = ("It looks like you're calling displacy.serve from within a " + "Jupyter notebook or a similar environment. This likely means " + "you're already running a local web server, so there's no need to " + "make displaCy start another one. Instead, you should be able to " + "replace displacy.serve with displacy.render to show the " + "visualization.") + W012 = ("A Doc object you're adding to the PhraseMatcher for pattern " + "'{key}' is parsed and/or tagged, but to match on '{attr}', you " + "don't actually need this information. This means that creating " + "the patterns is potentially much slower, because all pipeline " + "components are applied. To only create tokenized Doc objects, " + "try using `nlp.make_doc(text)` or process all texts as a stream " + "using `list(nlp.tokenizer.pipe(all_texts))`.") + W017 = ("Alias '{alias}' already exists in the Knowledge Base.") + W018 = ("Entity '{entity}' already exists in the Knowledge Base - " + "ignoring the duplicate entry.") + W021 = ("Unexpected hash collision in PhraseMatcher. Matches may be " + "incorrect. Modify PhraseMatcher._terminal_hash to fix.") + W024 = ("Entity '{entity}' - Alias '{alias}' combination already exists in " + "the Knowledge Base.") + W026 = ("Unable to set all sentence boundaries from dependency parses. If " + "you are constructing a parse tree incrementally by setting " + "token.head values, you can probably ignore this warning. Consider " + "using Doc(words, ..., heads=heads, deps=deps) instead.") + W027 = ("Found a large training file of {size} bytes. Note that it may " + "be more efficient to split your training data into multiple " + "smaller JSON files instead.") + W028 = ("Doc.from_array was called with a vector of type '{type}', " + "but is expecting one of type uint64 instead. This may result " + "in problems with the vocab further on in the pipeline.") + W030 = ("Some entities could not be aligned in the text \"{text}\" with " + "entities \"{entities}\". Use " + "`spacy.training.offsets_to_biluo_tags(nlp.make_doc(text), entities)`" + " to check the alignment. Misaligned entities ('-') will be " + "ignored during training.") + W033 = ("Training a new {model} using a model with no lexeme normalization " + "table. This may degrade the performance of the model to some " + "degree. If this is intentional or the language you're using " + "doesn't have a normalization table, please ignore this warning. " + "If this is surprising, make sure you have the spacy-lookups-data " + "package installed and load the table in your config. The " + "languages with lexeme normalization tables are currently: " + "{langs}\n\nLoad the table in your config with:\n\n" + "[initialize.lookups]\n" + "@misc = \"spacy.LookupsDataLoader.v1\"\n" + "lang = ${{nlp.lang}}\n" + "tables = [\"lexeme_norm\"]\n") + W035 = ("Discarding subpattern '{pattern}' due to an unrecognized " + "attribute or operator.") + W036 = ("The component '{name}' does not have any patterns defined.") + + # New warnings added in v3.x + W086 = ("Component '{listener}' will be (re)trained, but it needs the component " + "'{name}' which is frozen. If you want to prevent retraining '{name}' " + "but want to train '{listener}' on top of it, you should add '{name}' to the " + "list of 'annotating_components' in the 'training' block in the config. " + "See the documentation for details: " + "https://spacy.io/usage/training#annotating-components") + W087 = ("Component '{name}' will be (re)trained, but the component '{listener}' " + "depends on it via a listener and is frozen. This means that the " + "performance of '{listener}' will be degraded. You can either freeze " + "both, or neither of the two. If you're sourcing the component from " + "an existing pipeline, you can use the `replace_listeners` setting in " + "the config block to replace its token-to-vector listener with a copy " + "and make it independent. For example, `replace_listeners = " + "[\"model.tok2vec\"]` See the documentation for details: " + "https://spacy.io/usage/training#config-components-listeners") + W088 = ("The pipeline component {name} implements a `begin_training` " + "method, which won't be called by spaCy. As of v3.0, `begin_training` " + "has been renamed to `initialize`, so you likely want to rename the " + "component method. See the documentation for details: " + "https://spacy.io/api/language#initialize") + W089 = ("As of spaCy v3.0, the `nlp.begin_training` method has been renamed " + "to `nlp.initialize`.") + W090 = ("Could not locate any {format} files in path '{path}'.") + W091 = ("Could not clean/remove the temp directory at {dir}: {msg}.") + W092 = ("Ignoring annotations for sentence starts, as dependency heads are set.") + W093 = ("Could not find any data to train the {name} on. Is your " + "input data correctly formatted?") + W094 = ("Model '{model}' ({model_version}) specifies an under-constrained " + "spaCy version requirement: {version}. This can lead to compatibility " + "problems with older versions, or as new spaCy versions are " + "released, because the model may say it's compatible when it's " + 'not. Consider changing the "spacy_version" in your meta.json to a ' + "version range, with a lower and upper pin. For example: {example}") + W095 = ("Model '{model}' ({model_version}) was trained with spaCy " + "{version} and may not be 100% compatible with the current version " + "({current}). If you see errors or degraded performance, download " + "a newer compatible model or retrain your custom model with the " + "current spaCy version. For more details and available updates, " + "run: python -m spacy validate") + W096 = ("The method `nlp.disable_pipes` is now deprecated - use " + "`nlp.select_pipes` instead.") + W100 = ("Skipping unsupported morphological feature(s): '{feature}'. " + "Provide features as a dict {{\"Field1\": \"Value1,Value2\"}} or " + "string \"Field1=Value1,Value2|Field2=Value3\".") + W101 = ("Skipping Doc custom extension '{name}' while merging docs.") + W102 = ("Skipping unsupported user data '{key}: {value}' while merging docs.") + W103 = ("Unknown {lang} word segmenter '{segmenter}'. Supported " + "word segmenters: {supported}. Defaulting to {default}.") + W104 = ("Skipping modifications for '{target}' segmenter. The current " + "segmenter is '{current}'.") + W105 = ("As of spaCy v3.0, the `{matcher}.pipe` method is deprecated. If you " + "need to match on a stream of documents, you can use `nlp.pipe` and " + "call the {matcher} on each Doc object.") + W107 = ("The property `Doc.{prop}` is deprecated. Use " + "`Doc.has_annotation(\"{attr}\")` instead.") + W108 = ("The rule-based lemmatizer did not find POS annotation for one or " + "more tokens. Check that your pipeline includes components that " + "assign token.pos, typically 'tagger'+'attribute_ruler' or " + "'morphologizer'.") + W109 = ("Unable to save user hooks while serializing the doc. Re-add any " + "required user hooks to the doc after processing.") + W110 = ("The DependencyMatcher token pattern {pattern} matched a span " + "{tokens} that is 2+ tokens long. Only the first token in the span " + "will be included in the results. For better results, token " + "patterns should return matches that are each exactly one token " + "long.") + W111 = ("Jupyter notebook detected: if using `prefer_gpu()` or " + "`require_gpu()`, include it in the same cell right before " + "`spacy.load()` to ensure that the model is loaded on the correct " + "device. More information: " + "http://spacy.io/usage/v3#jupyter-notebook-gpu") + W112 = ("The model specified to use for initial vectors ({name}) has no " + "vectors. This is almost certainly a mistake.") + W113 = ("Sourced component '{name}' may not work as expected: source " + "vectors are not identical to current pipeline vectors.") + W114 = ("Using multiprocessing with GPU models is not recommended and may " + "lead to errors.") + W115 = ("Skipping {method}: the floret vector table cannot be modified. " + "Vectors are calculated from character ngrams.") + W116 = ("Unable to clean attribute '{attr}'.") + W117 = ("No spans to visualize found in Doc object with spans_key: '{spans_key}'. If this is " + "surprising to you, make sure the Doc was processed using a model " + "that supports span categorization, and check the `doc.spans[spans_key]` " + "property manually if necessary.\n\nAvailable keys: {keys}") + W118 = ("Term '{term}' not found in glossary. It may however be explained in documentation " + "for the corpora used to train the language. Please check " + "`nlp.meta[\"sources\"]` for any relevant links.") + W119 = ("Overriding pipe name in `config` is not supported. Ignoring override '{name_in_config}'.") + W120 = ("Unable to load all spans in Doc.spans: more than one span group " + "with the name '{group_name}' was found in the saved spans data. " + "Only the last span group will be loaded under " + "Doc.spans['{group_name}']. Skipping span group with values: " + "{group_values}") + W121 = ("Attempting to trace non-existent method '{method}' in pipe '{pipe}'") + W122 = ("Couldn't trace method '{method}' in pipe '{pipe}'. This can happen if the pipe class " + "is a Cython extension type.") + W123 = ("Argument `enable` with value {enable} does not contain all values specified in the config option " + "`enabled` ({enabled}). Be aware that this might affect other components in your pipeline.") + W124 = ("{host}:{port} is already in use, using the nearest available port {serve_port} as an alternative.") + W125 = ("The StaticVectors key_attr is no longer used. To set a custom " + "key attribute for vectors, configure it through Vectors(attr=) or " + "'spacy init vectors --attr'") + W126 = ("These keys are unsupported: {unsupported}") + W127 = ("Not all `Language.pipe` worker processes completed successfully") + + +class Errors(metaclass=ErrorsWithCodes): + E001 = ("No component '{name}' found in pipeline. Available names: {opts}") + E002 = ("Can't find factory for '{name}' for language {lang} ({lang_code}). " + "This usually happens when spaCy calls `nlp.{method}` with a custom " + "component name that's not registered on the current language class. " + "If you're using a custom component, make sure you've added the " + "decorator `@Language.component` (for function components) or " + "`@Language.factory` (for class components).\n\nAvailable " + "factories: {opts}") + E003 = ("Not a valid pipeline component. Expected callable, but " + "got {component} (name: '{name}'). If you're using a custom " + "component factory, double-check that it correctly returns your " + "initialized component.") + E004 = ("Can't set up pipeline component: a factory for '{name}' already " + "exists. Existing factory: {func}. New factory: {new_func}") + E005 = ("Pipeline component '{name}' returned {returned_type} instead of a " + "Doc. If you're using a custom component, maybe you forgot to " + "return the processed Doc?") + E006 = ("Invalid constraints for adding pipeline component. You can only " + "set one of the following: before (component name or index), " + "after (component name or index), first (True) or last (True). " + "Invalid configuration: {args}. Existing components: {opts}") + E007 = ("'{name}' already exists in pipeline. Existing names: {opts}") + E008 = ("Can't restore disabled pipeline component '{name}' because it " + "doesn't exist in the pipeline anymore. If you want to remove " + "components from the pipeline, you should do it before calling " + "`nlp.select_pipes` or after restoring the disabled components.") + E010 = ("Word vectors set to length 0. This may be because you don't have " + "a model installed or loaded, or because your model doesn't " + "include word vectors. For more info, see the docs:\n" + "https://spacy.io/usage/models") + E011 = ("Unknown operator: '{op}'. Options: {opts}") + E012 = ("Cannot add pattern for zero tokens to matcher.\nKey: {key}") + E016 = ("MultitaskObjective target should be function or one of: dep, " + "tag, ent, dep_tag_offset, ent_tag.") + E017 = ("Can only add unicode or bytes. Got type: {value_type}") + E018 = ("Can't retrieve string for hash '{hash_value}'. This usually " + "refers to an issue with the `Vocab` or `StringStore`.") + E019 = ("Can't create transition with unknown action ID: {action}. Action " + "IDs are enumerated in spacy/syntax/{src}.pyx.") + E022 = ("Could not find a transition with the name '{name}' in the NER " + "model.") + E024 = ("Could not find an optimal move to supervise the parser. Usually, " + "this means that the model can't be updated in a way that's valid " + "and satisfies the correct annotations specified in the GoldParse. " + "For example, are all labels added to the model? If you're " + "training a named entity recognizer, also make sure that none of " + "your annotated entity spans have leading or trailing whitespace " + "or punctuation. You can also use the `debug data` command to " + "validate your JSON-formatted training data. For details, run:\n" + "python -m spacy debug data --help") + E025 = ("String is too long: {length} characters. Max is 2**30.") + E026 = ("Error accessing token at position {i}: out of bounds in Doc of " + "length {length}.") + E027 = ("Arguments `words` and `spaces` should be sequences of the same " + "length, or `spaces` should be left default at None. `spaces` " + "should be a sequence of booleans, with True meaning that the " + "word owns a ' ' character following it.") + E028 = ("`words` expects a list of unicode strings, but got bytes instance: {value}") + E029 = ("`noun_chunks` requires the dependency parse, which requires a " + "statistical model to be installed and loaded. For more info, see " + "the documentation:\nhttps://spacy.io/usage/models") + E030 = ("Sentence boundaries unset. You can add the 'sentencizer' " + "component to the pipeline with: `nlp.add_pipe('sentencizer')`. " + "Alternatively, add the dependency parser or sentence recognizer, " + "or set sentence boundaries by setting `doc[i].is_sent_start`.") + E031 = ("Invalid token: empty string ('') at position {i}.") + E033 = ("Cannot load into non-empty Doc of length {length}.") + E035 = ("Error creating span with start {start} and end {end} for Doc of " + "length {length}.") + E036 = ("Error calculating span: Can't find a token starting at character " + "offset {start}.") + E037 = ("Error calculating span: Can't find a token ending at character " + "offset {end}.") + E039 = ("Array bounds exceeded while searching for root word. This likely " + "means the parse tree is in an invalid state. Please report this " + "issue here: http://github.com/explosion/spaCy/issues") + E040 = ("Attempt to access token at {i}, max length {max_length}.") + E041 = ("Invalid comparison operator: {op}. Likely a Cython bug?") + E042 = ("Error accessing `doc[{i}].nbor({j})`, for doc of length {length}.") + E043 = ("Refusing to write to token.sent_start if its document is parsed, " + "because this may cause inconsistent state.") + E044 = ("Invalid value for token.sent_start: {value}. Must be one of: " + "None, True, False") + E045 = ("Possibly infinite loop encountered while looking for {attr}.") + E046 = ("Can't retrieve unregistered extension attribute '{name}'. Did " + "you forget to call the `set_extension` method?") + E047 = ("Can't assign a value to unregistered extension attribute " + "'{name}'. Did you forget to call the `set_extension` method?") + E048 = ("Can't import language {lang} or any matching language from spacy.lang: {err}") + E050 = ("Can't find model '{name}'. It doesn't seem to be a Python " + "package or a valid path to a data directory.") + E052 = ("Can't find model directory: {path}") + E053 = ("Could not read {name} from {path}") + E054 = ("No valid '{setting}' setting found in model meta.json.") + E055 = ("Invalid ORTH value in exception:\nKey: {key}\nOrths: {orths}") + E056 = ("Invalid tokenizer exception: ORTH values combined don't match " + "original string.\nKey: {key}\nOrths: {orths}") + E057 = ("Stepped slices not supported in Span objects. Try: " + "`list(tokens)[start:stop:step]` instead.") + E058 = ("Could not retrieve vector for key {key}.") + E059 = ("One (and only one) keyword arg must be set. Got: {kwargs}") + E060 = ("Cannot add new key to vectors: the table is full. Current shape: " + "({rows}, {cols}).") + E062 = ("Cannot find empty bit for new lexical flag. All bits between 0 " + "and 63 are occupied. You can replace one by specifying the " + "`flag_id` explicitly, e.g. " + "`nlp.vocab.add_flag(your_func, flag_id=IS_ALPHA`.") + E063 = ("Invalid value for `flag_id`: {value}. Flag IDs must be between 1 " + "and 63 (inclusive).") + E064 = ("Error fetching a Lexeme from the Vocab. When looking up a " + "string, the lexeme returned had an orth ID that did not match " + "the query string. This means that the cached lexeme structs are " + "mismatched to the string encoding table. The mismatched:\n" + "Query string: {string}\nOrth cached: {orth}\nOrth ID: {orth_id}") + E065 = ("Only one of the vector table's width and shape can be specified. " + "Got width {width} and shape {shape}.") + E067 = ("Invalid BILUO tag sequence: Got a tag starting with {start} " + "without a preceding 'B' (beginning of an entity). " + "Tag sequence:\n{tags}") + E068 = ("Invalid BILUO tag: '{tag}'.") + E071 = ("Error creating lexeme: specified orth ID ({orth}) does not " + "match the one in the vocab ({vocab_orth}).") + E073 = ("Cannot assign vector of length {new_length}. Existing vectors " + "are of length {length}. You can use `vocab.reset_vectors` to " + "clear the existing vectors and resize the table.") + E074 = ("Error interpreting compiled match pattern: patterns are expected " + "to end with the attribute {attr}. Got: {bad_attr}.") + E079 = ("Error computing states in beam: number of predicted beams " + "({pbeams}) does not equal number of gold beams ({gbeams}).") + E080 = ("Duplicate state found in beam: {key}.") + E081 = ("Error getting gradient in beam: number of histories ({n_hist}) " + "does not equal number of losses ({losses}).") + E082 = ("Error deprojectivizing parse: number of heads ({n_heads}), " + "projective heads ({n_proj_heads}) and labels ({n_labels}) do not " + "match.") + E083 = ("Error setting extension: only one of `default`, `method`, or " + "`getter` (plus optional `setter`) is allowed. Got: {nr_defined}") + E084 = ("Error assigning label ID {label} to span: not in StringStore.") + E085 = ("Can't create lexeme for string '{string}'.") + E087 = ("Unknown displaCy style: {style}.") + E088 = ("Text of length {length} exceeds maximum of {max_length}. The " + "parser and NER models require roughly 1GB of temporary " + "memory per 100,000 characters in the input. This means long " + "texts may cause memory allocation errors. If you're not using " + "the parser or NER, it's probably safe to increase the " + "`nlp.max_length` limit. The limit is in number of characters, so " + "you can check whether your inputs are too long by checking " + "`len(text)`.") + E089 = ("Extensions can't have a setter argument without a getter " + "argument. Check the keyword arguments on `set_extension`.") + E090 = ("Extension '{name}' already exists on {obj}. To overwrite the " + "existing extension, set `force=True` on `{obj}.set_extension`.") + E091 = ("Invalid extension attribute {name}: expected callable or None, " + "but got: {value}") + E093 = ("token.ent_iob values make invalid sequence: I without B\n{seq}") + E094 = ("Error reading line {line_num} in vectors file {loc}.") + E095 = ("Can't write to frozen dictionary. This is likely an internal " + "error. Are you writing to a default function argument?") + E096 = ("Invalid object passed to displaCy: Can only visualize `Doc` or " + "Span objects, or dicts if set to `manual=True`.") + E097 = ("Invalid pattern: expected token pattern (list of dicts) or " + "phrase pattern (string) but got:\n{pattern}") + E098 = ("Invalid pattern: expected both RIGHT_ID and RIGHT_ATTRS.") + E099 = ("Invalid pattern: the first node of pattern should be an anchor " + "node. The node should only contain RIGHT_ID and RIGHT_ATTRS.") + E100 = ("Nodes other than the anchor node should all contain {required}, " + "but these are missing: {missing}") + E101 = ("RIGHT_ID should be a new node and LEFT_ID should already have " + "have been declared in previous edges.") + E102 = ("Can't merge non-disjoint spans. '{token}' is already part of " + "tokens to merge. If you want to find the longest non-overlapping " + "spans, you can use the util.filter_spans helper:\n" + "https://spacy.io/api/top-level#util.filter_spans") + E103 = ("Trying to set conflicting doc.ents: '{span1}' and '{span2}'. A " + "token can only be part of one entity, so make sure the entities " + "you're setting don't overlap. To work with overlapping entities, " + "consider using doc.spans instead.") + E106 = ("Can't find `doc._.{attr}` attribute specified in the underscore " + "settings: {opts}") + E107 = ("Value of custom attribute `{attr}` is not JSON-serializable: {value}") + E109 = ("Component '{name}' could not be run. Did you forget to " + "call `initialize()`?") + E110 = ("Invalid displaCy render wrapper. Expected callable, got: {obj}") + E111 = ("Pickling a token is not supported, because tokens are only views " + "of the parent Doc and can't exist on their own. A pickled token " + "would always have to include its Doc and Vocab, which has " + "practically no advantage over pickling the parent Doc directly. " + "So instead of pickling the token, pickle the Doc it belongs to.") + E112 = ("Pickling a span is not supported, because spans are only views " + "of the parent Doc and can't exist on their own. A pickled span " + "would always have to include its Doc and Vocab, which has " + "practically no advantage over pickling the parent Doc directly. " + "So instead of pickling the span, pickle the Doc it belongs to or " + "use Span.as_doc to convert the span to a standalone Doc object.") + E115 = ("All subtokens must have associated heads.") + E117 = ("The newly split tokens must match the text of the original token. " + "New orths: {new}. Old text: {old}.") + E118 = ("The custom extension attribute '{attr}' is not registered on the " + "`Token` object so it can't be set during retokenization. To " + "register an attribute, use the `Token.set_extension` classmethod.") + E119 = ("Can't set custom extension attribute '{attr}' during " + "retokenization because it's not writable. This usually means it " + "was registered with a getter function (and no setter) or as a " + "method extension, so the value is computed dynamically. To " + "overwrite a custom attribute manually, it should be registered " + "with a default value or with a getter AND setter.") + E120 = ("Can't set custom extension attributes during retokenization. " + "Expected dict mapping attribute names to values, but got: {value}") + E121 = ("Can't bulk merge spans. Attribute length {attr_len} should be " + "equal to span length ({span_len}).") + E122 = ("Cannot find token to be split. Did it get merged?") + E123 = ("Cannot find head of token to be split. Did it get merged?") + E125 = ("Unexpected value: {value}") + E126 = ("Unexpected matcher predicate: '{bad}'. Expected one of: {good}. " + "This is likely a bug in spaCy, so feel free to open an issue.") + E130 = ("You are running a narrow unicode build, which is incompatible " + "with spacy >= 2.1.0. To fix this, reinstall Python and use a wide " + "unicode build instead. You can also rebuild Python and set the " + "`--enable-unicode=ucs4 flag`.") + E132 = ("The vectors for entities and probabilities for alias '{alias}' " + "should have equal length, but found {entities_length} and " + "{probabilities_length} respectively.") + E133 = ("The sum of prior probabilities for alias '{alias}' should not " + "exceed 1, but found {sum}.") + E134 = ("Entity '{entity}' is not defined in the Knowledge Base.") + E139 = ("Knowledge base for component '{name}' is empty.") + E140 = ("The list of entities, prior probabilities and entity vectors " + "should be of equal length.") + E141 = ("Entity vectors should be of length {required} instead of the " + "provided {found}.") + E143 = ("Labels for component '{name}' not initialized. This can be fixed " + "by calling add_label, or by providing a representative batch of " + "examples to the component's `initialize` method.") + E145 = ("Error reading `{param}` from input file.") + E146 = ("Could not access {path}.") + E147 = ("Unexpected error in the {method} functionality of the " + "EntityLinker: {msg}. This is likely a bug in spaCy, so feel free " + "to open an issue: https://github.com/explosion/spaCy/issues") + E148 = ("Expected {ents} KB identifiers but got {ids}. Make sure that " + "each entity in `doc.ents` is assigned to a KB identifier.") + E149 = ("Error deserializing model. Check that the config used to create " + "the component matches the model being loaded.") + E150 = ("The language of the `nlp` object and the `vocab` should be the " + "same, but found '{nlp}' and '{vocab}' respectively.") + E152 = ("The attribute {attr} is not supported for token patterns. " + "Please use the option `validate=True` with the Matcher, PhraseMatcher, " + "EntityRuler or AttributeRuler for more details.") + E153 = ("The value type {vtype} is not supported for token patterns. " + "Please use the option validate=True with Matcher, PhraseMatcher, " + "EntityRuler or AttributeRuler for more details.") + E154 = ("One of the attributes or values is not supported for token " + "patterns. Please use the option `validate=True` with the Matcher, " + "PhraseMatcher, or EntityRuler for more details.") + E155 = ("The pipeline needs to include a {pipe} in order to use " + "Matcher or PhraseMatcher with the attribute {attr}. " + "Try using `nlp()` instead of `nlp.make_doc()` or `list(nlp.pipe())` " + "instead of `list(nlp.tokenizer.pipe())`.") + E157 = ("Can't render negative values for dependency arc start or end. " + "Make sure that you're passing in absolute token indices, not " + "relative token offsets.\nstart: {start}, end: {end}, label: " + "{label}, direction: {dir}") + E158 = ("Can't add table '{name}' to lookups because it already exists.") + E159 = ("Can't find table '{name}' in lookups. Available tables: {tables}") + E160 = ("Can't find language data file: {path}") + E161 = ("Found an internal inconsistency when predicting entity links. " + "This is likely a bug in spaCy, so feel free to open an issue: " + "https://github.com/explosion/spaCy/issues") + E163 = ("cumsum was found to be unstable: its last element does not " + "correspond to sum") + E164 = ("x is neither increasing nor decreasing: {x}.") + E165 = ("Only one class present in the gold labels: {label}. " + "ROC AUC score is not defined in that case.") + E166 = ("Can only merge DocBins with the same value for '{param}'.\n" + "Current DocBin: {current}\nOther DocBin: {other}") + E169 = ("Can't find module: {module}") + E170 = ("Cannot apply transition {name}: invalid for the current state.") + E171 = ("Matcher.add received invalid 'on_match' callback argument: expected " + "callable or None, but got: {arg_type}") + E175 = ("Can't remove rule for unknown match pattern ID: {key}") + E176 = ("Alias '{alias}' is not defined in the Knowledge Base.") + E177 = ("Ill-formed IOB input detected: {tag}") + E178 = ("Each pattern should be a list of dicts, but got: {pat}. Maybe you " + "accidentally passed a single pattern to Matcher.add instead of a " + "list of patterns? If you only want to add one pattern, make sure " + "to wrap it in a list. For example: `matcher.add('{key}', [pattern])`") + E179 = ("Invalid pattern. Expected a list of Doc objects but got a single " + "Doc. If you only want to add one pattern, make sure to wrap it " + "in a list. For example: `matcher.add('{key}', [doc])`") + E180 = ("Span attributes can't be declared as required or assigned by " + "components, since spans are only views of the Doc. Use Doc and " + "Token attributes (or custom extension attributes) only and remove " + "the following: {attrs}") + E181 = ("Received invalid attributes for unknown object {obj}: {attrs}. " + "Only Doc and Token attributes are supported.") + E182 = ("Received invalid attribute declaration: {attr}\nDid you forget " + "to define the attribute? For example: `{attr}.???`") + E183 = ("Received invalid attribute declaration: {attr}\nOnly top-level " + "attributes are supported, for example: {solution}") + E184 = ("Only attributes without underscores are supported in component " + "attribute declarations (because underscore and non-underscore " + "attributes are connected anyways): {attr} -> {solution}") + E185 = ("Received invalid attribute in component attribute declaration: " + "`{obj}.{attr}`\nAttribute '{attr}' does not exist on {obj}.") + E187 = ("Only unicode strings are supported as labels.") + E189 = ("Each argument to `Doc.__init__` should be of equal length.") + E190 = ("Token head out of range in `Doc.from_array()` for token index " + "'{index}' with value '{value}' (equivalent to relative head " + "index: '{rel_head_index}'). The head indices should be relative " + "to the current token index rather than absolute indices in the " + "array.") + E191 = ("Invalid head: the head token must be from the same doc as the " + "token itself.") + E192 = ("Unable to resize vectors in place with cupy.") + E193 = ("Unable to resize vectors in place if the resized vector dimension " + "({new_dim}) is not the same as the current vector dimension " + "({curr_dim}).") + E194 = ("Unable to aligned mismatched text '{text}' and words '{words}'.") + E195 = ("Matcher can be called on {good} only, got {got}.") + E196 = ("Refusing to write to `token.is_sent_end`. Sentence boundaries can " + "only be fixed with `token.is_sent_start`.") + E197 = ("Row out of bounds, unable to add row {row} for key {key}.") + E198 = ("Unable to return {n} most similar vectors for the current vectors " + "table, which contains {n_rows} vectors.") + E199 = ("Unable to merge 0-length span at `doc[{start}:{end}]`.") + E200 = ("Can't set {attr} from Span.") + E202 = ("Unsupported {name} mode '{mode}'. Supported modes: {modes}.") + E203 = ("If the {name} embedding layer is not updated " + "during training, make sure to include it in 'annotating components'") + + # New errors added in v3.x + E849 = ("The vocab only supports {method} for vectors of type " + "spacy.vectors.Vectors, not {vectors_type}.") + E850 = ("The PretrainVectors objective currently only supports default or " + "floret vectors, not {mode} vectors.") + E851 = ("The 'textcat' component labels should only have values of 0 or 1, " + "but found value of '{val}'.") + E853 = ("Unsupported component factory name '{name}'. The character '.' is " + "not permitted in factory names.") + E854 = ("Unable to set doc.ents. Check that the 'ents_filter' does not " + "permit overlapping spans.") + E855 = ("Invalid {obj}: {obj} is not from the same doc.") + E856 = ("Error accessing span at position {i}: out of bounds in span group " + "of length {length}.") + E857 = ("Entry '{name}' not found in edit tree lemmatizer labels.") + E858 = ("The {mode} vector table does not support this operation. " + "{alternative}") + E859 = ("The floret vector table cannot be modified.") + E860 = ("Can't truncate floret vectors.") + E861 = ("No 'keys' should be provided when initializing floret vectors " + "with 'minn' and 'maxn'.") + E862 = ("'hash_count' must be between 1-4 for floret vectors.") + E863 = ("'maxn' must be greater than or equal to 'minn'.") + E864 = ("The complete vector table 'data' is required to initialize floret " + "vectors.") + E865 = ("A SpanGroup is not functional after the corresponding Doc has " + "been garbage collected. To keep using the spans, make sure that " + "the corresponding Doc object is still available in the scope of " + "your function.") + E866 = ("Expected a string or 'Doc' as input, but got: {type}.") + E867 = ("The 'textcat' component requires at least two labels because it " + "uses mutually exclusive classes where exactly one label is True " + "for each doc. For binary classification tasks, you can use two " + "labels with 'textcat' (LABEL / NOT_LABEL) or alternatively, you " + "can use the 'textcat_multilabel' component with one label.") + E868 = ("Found a conflicting gold annotation in a reference document, " + "with the following char-based span occurring both in the gold ents " + "as well as in the negative spans: {span}.") + E869 = ("The notation '{label}' is not supported anymore. To annotate " + "negative NER samples, use `doc.spans[key]` instead, and " + "specify the key as 'incorrect_spans_key' when constructing " + "the NER component.") + E870 = ("Could not serialize the DocBin because it is too large. Consider " + "splitting up your documents into several doc bins and serializing " + "each separately. spacy.Corpus.v1 will search recursively for all " + "*.spacy files if you provide a directory instead of a filename as " + "the 'path'.") + E871 = ("Error encountered in nlp.pipe with multiprocessing:\n\n{error}") + E872 = ("Unable to copy tokenizer from base model due to different " + 'tokenizer settings: current tokenizer config "{curr_config}" ' + 'vs. base model "{base_config}"') + E873 = ("Unable to merge a span from doc.spans with key '{key}' and text " + "'{text}'. This is likely a bug in spaCy, so feel free to open an " + "issue: https://github.com/explosion/spaCy/issues") + E874 = ("Could not initialize the tok2vec model from component " + "'{component}' and layer '{layer}'.") + E875 = ("To use the PretrainVectors objective, make sure that static vectors are loaded. " + "In the config, these are defined by the initialize.vectors setting.") + E879 = ("Unexpected type for 'spans' data. Provide a dictionary mapping keys to " + "a list of spans, with each span represented by a tuple (start_char, end_char). " + "The tuple can be optionally extended with a label and a KB ID.") + E884 = ("The pipeline could not be initialized because the vectors " + "could not be found at '{vectors}'. If your pipeline was already " + "initialized/trained before, call 'resume_training' instead of 'initialize', " + "or initialize only the components that are new.") + E885 = ("entity_linker.set_kb received an invalid 'kb_loader' argument: expected " + "a callable function, but got: {arg_type}") + E886 = ("Can't replace {name} -> {tok2vec} listeners: path '{path}' not " + "found in config for component '{name}'.") + E887 = ("Can't replace {name} -> {tok2vec} listeners: the paths to replace " + "({paths}) don't match the available listeners in the model ({n_listeners}).") + E888 = ("Can't replace listeners for '{name}' ({pipe}): invalid upstream " + "component that doesn't seem to support listeners. Expected Tok2Vec " + "or Transformer component. If you didn't call nlp.replace_listeners " + "manually, this is likely a bug in spaCy.") + E889 = ("Can't replace '{tok2vec}' listeners of component '{name}' because " + "'{unknown}' is not in the pipeline. Available components: {opts}. " + "If you didn't call nlp.replace_listeners manually, this is likely " + "a bug in spaCy.") + E890 = ("Cannot add the alias '{alias}' to the Knowledge base. " + "Each alias should be a meaningful string.") + E891 = ("Alias '{alias}' could not be added to the Knowledge base. " + "This is likely a bug in spaCy.") + E892 = ("Unknown function registry: '{name}'.\n\nAvailable names: {available}") + E893 = ("Could not find function '{name}' in function registry '{reg_name}'. " + "If you're using a custom function, make sure the code is available. " + "If the function is provided by a third-party package, e.g. " + "spacy-transformers, make sure the package is installed in your " + "environment.\n\nAvailable names: {available}") + E894 = ("The 'noun_chunks' syntax iterator is not implemented for language " + "'{lang}'.") + E895 = ("The 'textcat' component received gold-standard annotations with " + "multiple labels per document. In spaCy 3 you should use the " + "'textcat_multilabel' component for this instead. " + "Example of an offending annotation: {value}") + E896 = ("There was an error using the static vectors. Ensure that the vectors " + "of the vocab are properly initialized, or set 'include_static_vectors' " + "to False.") + E897 = ("Field '{field}' should be a dot-notation string referring to the " + "relevant section in the config, but found type {type} instead.") + E898 = ("Can't serialize trainable pipe '{name}': the `model` attribute " + "is not set or None. If you've implemented a custom component, make " + "sure to store the component model as `self.model` in your " + "component's __init__ method.") + E899 = ("Can't serialize trainable pipe '{name}': the `vocab` attribute " + "is not set or None. If you've implemented a custom component, make " + "sure to store the current `nlp` object's vocab as `self.vocab` in " + "your component's __init__ method.") + E900 = ("Could not run the full pipeline for evaluation. If you specified " + "frozen components, make sure they were already initialized and " + "trained. Full pipeline: {pipeline}") + E901 = ("Failed to remove existing output directory: {path}. If your " + "config and the components you train change between runs, a " + "non-empty output directory can lead to stale pipeline data. To " + "solve this, remove the existing directories in the output directory.") + E902 = ("The sentence-per-line IOB/IOB2 file is not formatted correctly. " + "Try checking whitespace and delimiters. See " + "https://spacy.io/api/cli#convert") + E903 = ("The token-per-line NER file is not formatted correctly. Try checking " + "whitespace and delimiters. See https://spacy.io/api/cli#convert") + E904 = ("Cannot initialize StaticVectors layer: nO dimension unset. This " + "dimension refers to the output width, after the linear projection " + "has been applied.") + E905 = ("Cannot initialize StaticVectors layer: nM dimension unset. This " + "dimension refers to the width of the vectors table.") + E906 = ("Unexpected `loss` value in pretraining objective: '{found}'. Supported values " + "are: {supported}") + E908 = ("Can't set `spaces` without `words` in `Doc.__init__`.") + E909 = ("Expected {name} in parser internals. This is likely a bug in spaCy.") + E910 = ("Encountered NaN value when computing loss for component '{name}'.") + E911 = ("Invalid feature: {feat}. Must be a token attribute.") + E912 = ("Failed to initialize lemmatizer. Missing lemmatizer table(s) found " + "for mode '{mode}'. Required tables: {tables}. Found: {found}.") + E913 = ("Corpus path can't be None. Maybe you forgot to define it in your " + ".cfg file or override it on the CLI?") + E914 = ("Executing {name} callback failed. Expected the function to " + "return the nlp object but got: {value}. Maybe you forgot to return " + "the modified object in your function?") + E915 = ("Can't use score '{name}' to calculate final weighted score. Expected " + "float or int but got: {score_type}. To exclude the score from the " + "final score, set its weight to null in the [training.score_weights] " + "section of your training config.") + E916 = ("Can't log score for '{name}' in table: not a valid score ({score_type})") + E917 = ("Received invalid value {value} for `state_type` in " + "TransitionBasedParser: only 'parser' or 'ner' are valid options.") + E918 = ("Received invalid value for vocab: {vocab} ({vocab_type}). Valid " + "values are an instance of `spacy.vocab.Vocab` or True to create one" + " (default).") + E919 = ("A textcat `positive_label` '{pos_label}' was provided for training " + "data that does not appear to be a binary classification problem " + "with two labels. Labels found: {labels}") + E920 = ("The textcat's `positive_label` setting '{pos_label}' " + "does not match any label in the training data or provided during " + "initialization. Available labels: {labels}") + E921 = ("The method `set_output` can only be called on components that have " + "a Model with a `resize_output` attribute. Otherwise, the output " + "layer can not be dynamically changed.") + E922 = ("Component '{name}' has been initialized with an output dimension of " + "{nO} - cannot add any more labels.") + E923 = ("It looks like there is no proper sample data to initialize the " + "Model of component '{name}'. To check your input data paths and " + "annotation, run: python -m spacy debug data config.cfg " + "and include the same config override values you would specify " + "for the 'spacy train' command.") + E924 = ("The '{name}' component does not seem to be initialized properly. " + "This is likely a bug in spaCy, so feel free to open an issue: " + "https://github.com/explosion/spaCy/issues") + E925 = ("Invalid color values for displaCy visualizer: expected dictionary " + "mapping label names to colors but got: {obj}") + E926 = ("It looks like you're trying to modify `nlp.{attr}` directly. This " + "doesn't work because it's an immutable computed property. If you " + "need to modify the pipeline, use the built-in methods like " + "`nlp.add_pipe`, `nlp.remove_pipe`, `nlp.disable_pipe` or " + "`nlp.enable_pipe` instead.") + E927 = ("Can't write to frozen list. Maybe you're trying to modify a computed " + "property or default function argument?") + E928 = ("An InMemoryLookupKB can only be serialized to/from from a directory, " + "but the provided argument {loc} points to a file.") + E929 = ("Couldn't read InMemoryLookupKB from {loc}. The path does not seem to exist.") + E930 = ("Received invalid get_examples callback in `{method}`. " + "Expected function that returns an iterable of Example objects but " + "got: {obj}") + E931 = ("Encountered {parent} subclass without `{parent}.{method}` " + "method in component '{name}'. If you want to use this " + "method, make sure it's overwritten on the subclass.") + E940 = ("Found NaN values in scores.") + E941 = ("Can't find model '{name}'. It looks like you're trying to load a " + "model from a shortcut, which is obsolete as of spaCy v3.0. To " + "load the model, use its full name instead:\n\n" + "nlp = spacy.load(\"{full}\")\n\nFor more details on the available " + "models, see the models directory: https://spacy.io/models and if " + "you want to create a blank model, use spacy.blank: " + "nlp = spacy.blank(\"{name}\")") + E942 = ("Executing `after_{name}` callback failed. Expected the function to " + "return an initialized nlp object but got: {value}. Maybe " + "you forgot to return the modified object in your function?") + E943 = ("Executing `before_creation` callback failed. Expected the function to " + "return an uninitialized Language subclass but got: {value}. Maybe " + "you forgot to return the modified object in your function or " + "returned the initialized nlp object instead?") + E944 = ("Can't copy pipeline component '{name}' from source '{model}': " + "not found in pipeline. Available components: {opts}") + E945 = ("Can't copy pipeline component '{name}' from source. Expected " + "loaded nlp object, but got: {source}") + E947 = ("`Matcher.add` received invalid `greedy` argument: expected " + "a string value from {expected} but got: '{arg}'") + E948 = ("`Matcher.add` received invalid 'patterns' argument: expected " + "a list, but got: {arg_type}") + E949 = ("Unable to align tokens for the predicted and reference docs. It " + "is only possible to align the docs when both texts are the same " + "except for whitespace and capitalization. The predicted tokens " + "start with: {x}. The reference tokens start with: {y}.") + E952 = ("The section '{name}' is not a valid section in the provided config.") + E953 = ("Mismatched IDs received by the Tok2Vec listener: {id1} vs. {id2}") + E954 = ("The Tok2Vec listener did not receive any valid input from an upstream " + "component.") + E955 = ("Can't find table(s) {table} for language '{lang}' in " + "spacy-lookups-data. Make sure you have the package installed or " + "provide your own lookup tables if no default lookups are available " + "for your language.") + E956 = ("Can't find component '{name}' in [components] block in the config. " + "Available components: {opts}") + E957 = ("Writing directly to `Language.factories` isn't needed anymore in " + "spaCy v3. Instead, you can use the `@Language.factory` decorator " + "to register your custom component factory or `@Language.component` " + "to register a simple stateless function component that just takes " + "a Doc and returns it.") + E958 = ("Language code defined in config ({bad_lang_code}) does not match " + "language code of current Language subclass {lang} ({lang_code}). " + "If you want to create an nlp object from a config, make sure to " + "use the matching subclass with the language-specific settings and " + "data.") + E959 = ("Can't insert component {dir} index {idx}. Existing components: {opts}") + E960 = ("No config data found for component '{name}'. This is likely a bug " + "in spaCy.") + E961 = ("Found non-serializable Python object in config. Configs should " + "only include values that can be serialized to JSON. If you need " + "to pass models or other objects to your component, use a reference " + "to a registered function or initialize the object in your " + "component.\n\n{config}") + E962 = ("Received incorrect {style} for pipe '{name}'. Expected dict, " + "got: {cfg_type}.") + E963 = ("Can't read component info from `@Language.{decorator}` decorator. " + "Maybe you forgot to call it? Make sure you're using " + "`@Language.{decorator}()` instead of `@Language.{decorator}`.") + E964 = ("The pipeline component factory for '{name}' needs to have the " + "following named arguments, which are passed in by spaCy:\n- nlp: " + "receives the current nlp object and lets you access the vocab\n- " + "name: the name of the component instance, can be used to identify " + "the component, output losses etc.") + E965 = ("It looks like you're using the `@Language.component` decorator to " + "register '{name}' on a class instead of a function component. If " + "you need to register a class or function that *returns* a component " + "function, use the `@Language.factory` decorator instead.") + E966 = ("`nlp.add_pipe` now takes the string name of the registered component " + "factory, not a callable component. Expected string, but got " + "{component} (name: '{name}').\n\n- If you created your component " + "with `nlp.create_pipe('name')`: remove nlp.create_pipe and call " + "`nlp.add_pipe('name')` instead.\n\n- If you passed in a component " + "like `TextCategorizer()`: call `nlp.add_pipe` with the string name " + "instead, e.g. `nlp.add_pipe('textcat')`.\n\n- If you're using a custom " + "component: Add the decorator `@Language.component` (for function " + "components) or `@Language.factory` (for class components / factories) " + "to your custom component and assign it a name, e.g. " + "`@Language.component('your_name')`. You can then run " + "`nlp.add_pipe('your_name')` to add it to the pipeline.") + E967 = ("No {meta} meta information found for '{name}'. This is likely a bug in spaCy.") + E968 = ("`nlp.replace_pipe` now takes the string name of the registered component " + "factory, not a callable component. Expected string, but got " + "{component}.\n\n- If you created your component with" + "with `nlp.create_pipe('name')`: remove `nlp.create_pipe` and call " + "`nlp.replace_pipe('{name}', 'name')` instead.\n\n- If you passed in a " + "component like `TextCategorizer()`: call `nlp.replace_pipe` with the " + "string name instead, e.g. `nlp.replace_pipe('{name}', 'textcat')`.\n\n" + "- If you're using a custom component: Add the decorator " + "`@Language.component` (for function components) or `@Language.factory` " + "(for class components / factories) to your custom component and " + "assign it a name, e.g. `@Language.component('your_name')`. You can " + "then run `nlp.replace_pipe('{name}', 'your_name')`.") + E969 = ("Expected string values for field '{field}', but received {types} instead. ") + E970 = ("Can not execute command '{str_command}'. Do you have '{tool}' installed?") + E971 = ("Found incompatible lengths in `Doc.from_array`: {array_length} for the " + "array and {doc_length} for the Doc itself.") + E972 = ("`Example.__init__` got None for '{arg}'. Requires Doc.") + E973 = ("Unexpected type for NER data") + E974 = ("Unknown {obj} attribute: {key}") + E976 = ("The method `Example.from_dict` expects a {type} as {n} argument, " + "but received None.") + E977 = ("Can not compare a MorphAnalysis with a string object. " + "This is likely a bug in spaCy, so feel free to open an issue: " + "https://github.com/explosion/spaCy/issues") + E978 = ("The {name} method takes a list of Example objects, but got: {types}") + E980 = ("Each link annotation should refer to a dictionary with at most one " + "identifier mapping to 1.0, and all others to 0.0.") + E981 = ("The offsets of the annotations for `links` could not be aligned " + "to token boundaries.") + E982 = ("The `Token.ent_iob` attribute should be an integer indexing " + "into {values}, but found {value}.") + E983 = ("Invalid key(s) for '{dict}': {key}. Available keys: " + "{keys}") + E984 = ("Invalid component config for '{name}': component block needs either " + "a key `factory` specifying the registered function used to " + "initialize the component, or a key `source` key specifying a " + "spaCy model to copy the component from. For example, `factory = " + "\"ner\"` will use the 'ner' factory and all other settings in the " + "block will be passed to it as arguments. Alternatively, `source = " + "\"en_core_web_sm\"` will copy the component from that model.\n\n{config}") + E985 = ("Can't load model from config file: no [nlp] section found.\n\n{config}") + E986 = ("Could not create any training batches: check your input. " + "Are the train and dev paths defined? Is `discard_oversize` set appropriately? ") + E989 = ("`nlp.update()` was called with two positional arguments. This " + "may be due to a backwards-incompatible change to the format " + "of the training data in spaCy 3.0 onwards. The 'update' " + "function should now be called with a batch of Example " + "objects, instead of `(text, annotation)` tuples. ") + E991 = ("The function `nlp.select_pipes` should be called with either a " + "`disable` argument to list the names of the pipe components " + "that should be disabled, or with an 'enable' argument that " + "specifies which pipes should not be disabled.") + E992 = ("The function `select_pipes` was called with `enable`={enable} " + "and `disable`={disable} but that information is conflicting " + "for the `nlp` pipeline with components {names}.") + E993 = ("The config for the nlp object needs to include a key `lang` specifying " + "the code of the language to initialize it with (for example " + "'en' for English) - this can't be None.\n\n{config}") + E997 = ("Tokenizer special cases are not allowed to modify the text. " + "This would map '{chunk}' to '{orth}' given token attributes " + "'{token_attrs}'.") + E999 = ("Unable to merge the Doc objects because they do not all share " + "the same `Vocab`.") + E1000 = ("The Chinese word segmenter is pkuseg but no pkuseg model was " + "loaded. Provide the name of a pretrained model or the path to " + "a model and initialize the pipeline:\n\n" + 'nlp.tokenizer.initialize(pkuseg_model="default")') + E1001 = ("Target token outside of matched span for match with tokens " + "'{span}' and offset '{index}' matched by patterns '{patterns}'.") + E1002 = ("Span index out of range.") + E1003 = ("Unsupported lemmatizer mode '{mode}'.") + E1004 = ("Missing lemmatizer table(s) found for lemmatizer mode '{mode}'. " + "Required tables: {tables}. Found: {found}. Maybe you forgot to " + "call `nlp.initialize()` to load in the data?") + E1005 = ("Unable to set attribute '{attr}' in tokenizer exception for " + "'{chunk}'. Tokenizer exceptions are only allowed to specify " + "ORTH and NORM.") + E1007 = ("Unsupported DependencyMatcher operator '{op}'.") + E1008 = ("Invalid pattern: each pattern should be a list of dicts. Check " + "that you are providing a list of patterns as `List[List[dict]]`.") + E1010 = ("Unable to set entity information for token {i} which is included " + "in more than one span in entities, blocked, missing or outside.") + E1011 = ("Unsupported default '{default}' in `doc.set_ents`. Available " + "options: {modes}") + E1012 = ("Entity spans and blocked/missing/outside spans should be " + "provided to `doc.set_ents` as lists of Span objects.") + E1013 = ("Invalid morph: the MorphAnalysis must have the same vocab as the " + "token itself. To set the morph from this MorphAnalysis, set from " + "the string value with: `token.set_morph(str(other_morph))`.") + E1014 = ("Error loading DocBin data. It doesn't look like the data is in " + "DocBin (.spacy) format. If your data is in spaCy v2's JSON " + "training format, convert it using `python -m spacy convert " + "file.json .`.") + E1015 = ("Can't initialize model from config: no {value} found. For more " + "information, run: python -m spacy debug config config.cfg") + E1016 = ("The operators 'OP': '?', '*', and '+' are not supported in " + "DependencyMatcher token patterns. The token pattern in " + "RIGHT_ATTR should return matches that are each exactly one token " + "long. Invalid pattern:\n{node}") + E1017 = ("A Doc object requires both 'deps' and 'heads' for dependency " + "parses. If no dependency labels are available, provide " + "placeholder deps such as `deps=[\"dep\"]*len(heads)`.") + E1018 = ("Knowledge base for component '{name}' is not set. " + "Make sure either `nel.initialize` or `nel.set_kb` " + "is called with a `kb_loader` function.") + E1019 = ("`noun_chunks` requires the pos tagging, which requires a " + "statistical model to be installed and loaded. For more info, see " + "the documentation:\nhttps://spacy.io/usage/models") + E1020 = ("No `epoch_resume` value specified and could not infer one from " + "filename. Specify an epoch to resume from.") + E1021 = ("`pos` value \"{pp}\" is not a valid Universal Dependencies tag. " + "Non-UD tags should use the `tag` property.") + E1022 = ("Words must be of type str or int, but input is of type '{wtype}'") + E1023 = ("Couldn't read EntityRuler from the {path}. This file doesn't " + "exist.") + E1024 = ("A pattern with {attr_type} '{label}' is not present in " + "'{component}' patterns.") + E1025 = ("Cannot intify the value '{value}' as an IOB string. The only " + "supported values are: 'I', 'O', 'B' and ''") + E1026 = ("Edit tree has an invalid format:\n{errors}") + E1027 = ("AlignmentArray only supports slicing with a step of 1.") + E1028 = ("AlignmentArray only supports indexing using an int or a slice.") + E1029 = ("Edit tree cannot be applied to form.") + E1030 = ("Edit tree identifier out of range.") + E1031 = ("Could not find gold transition - see logs above.") + E1032 = ("`{var}` should not be {forbidden}, but received {value}.") + E1033 = ("Dimension {name} invalid -- only nO, nF, nP") + E1034 = ("Node index {i} out of bounds ({length})") + E1035 = ("Token index {i} out of bounds ({length})") + E1036 = ("Cannot index into NoneNode") + E1037 = ("Invalid attribute value '{attr}'.") + E1038 = ("Invalid JSON input: {message}") + E1039 = ("The {obj} start or end annotations (start: {start}, end: {end}) " + "could not be aligned to token boundaries.") + E1040 = ("Doc.from_json requires all tokens to have the same attributes. " + "Some tokens do not contain annotation for: {partial_attrs}") + E1041 = ("Expected a string, Doc, or bytes as input, but got: {type}") + E1042 = ("`enable={enable}` and `disable={disable}` are inconsistent with each other.\nIf you only passed " + "one of `enable` or `disable`, the other argument is specified in your pipeline's configuration.\nIn that " + "case pass an empty list for the previously not specified argument to avoid this error.") + E1043 = ("Expected None or a value in range [{range_start}, {range_end}] for entity linker threshold, but got " + "{value}.") + E1044 = ("Expected `candidates_batch_size` to be >= 1, but got: {value}") + E1045 = ("Encountered {parent} subclass without `{parent}.{method}` " + "method in '{name}'. If you want to use this method, make " + "sure it's overwritten on the subclass.") + E1046 = ("{cls_name} is an abstract class and cannot be instantiated. If you are looking for spaCy's default " + "knowledge base, use `InMemoryLookupKB`.") + E1047 = ("`find_threshold()` only supports components with a `scorer` attribute.") + E1048 = ("Got '{unexpected}' as console progress bar type, but expected one of the following: {expected}") + E1049 = ("No available port found for displaCy on host {host}. Please specify an available port " + "with `displacy.serve(doc, port=port)`") + E1050 = ("Port {port} is already in use. Please specify an available port with `displacy.serve(doc, port=port)` " + "or use `auto_select_port=True` to pick an available port automatically.") + E1051 = ("'allow_overlap' can only be False when max_positive is 1, but found 'max_positive': {max_positive}.") + E1052 = ("Unable to copy spans: the character offsets for the span at " + "index {i} in the span group do not align with the tokenization " + "in the target doc.") + E1053 = ("Both 'min_length' and 'max_length' should be larger than 0, but found" + " 'min_length': {min_length}, 'max_length': {max_length}") + E1054 = ("The text, including whitespace, must match between reference and " + "predicted docs when training {component}.") + E1055 = ("The 'replace_listener' callback expects {num_params} parameters, " + "but only callbacks with one or three parameters are supported") + E1056 = ("The `TextCatBOW` architecture expects a length of at least 1, was {length}.") + E1057 = ("The `TextCatReduce` architecture must be used with at least one " + "reduction. Please enable one of `use_reduce_first`, " + "`use_reduce_last`, `use_reduce_max` or `use_reduce_mean`.") + + +# Deprecated model shortcuts, only used in errors and warnings +OLD_MODEL_SHORTCUTS = { + "en": "en_core_web_sm", "de": "de_core_news_sm", "es": "es_core_news_sm", + "pt": "pt_core_news_sm", "fr": "fr_core_news_sm", "it": "it_core_news_sm", + "nl": "nl_core_news_sm", "el": "el_core_news_sm", "nb": "nb_core_news_sm", + "lt": "lt_core_news_sm", "xx": "xx_ent_wiki_sm" +} + + +# fmt: on + + +class MatchPatternError(ValueError): + def __init__(self, key, errors): + """Custom error for validating match patterns. + + key (str): The name of the matcher rule. + errors (dict): Validation errors (sequence of strings) mapped to pattern + ID, i.e. the index of the added pattern. + """ + msg = f"Invalid token patterns for matcher rule '{key}'\n" + for pattern_idx, error_msgs in errors.items(): + pattern_errors = "\n".join([f"- {e}" for e in error_msgs]) + msg += f"\nPattern {pattern_idx}:\n{pattern_errors}\n" + ValueError.__init__(self, msg) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/git_info.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/git_info.py new file mode 100644 index 0000000000000000000000000000000000000000..785a30dba49132c2445610a8c045cb9cac9cf217 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/git_info.py @@ -0,0 +1,3 @@ +# THIS FILE IS GENERATED FROM SPACY SETUP.PY +# +GIT_VERSION = "e7a662a" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/glossary.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/glossary.py new file mode 100644 index 0000000000000000000000000000000000000000..c228f08a977c584bd647fb3c9615b81740428151 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/glossary.py @@ -0,0 +1,360 @@ +import warnings + +from .errors import Warnings + + +def explain(term): + """Get a description for a given POS tag, dependency label or entity type. + + term (str): The term to explain. + RETURNS (str): The explanation, or `None` if not found in the glossary. + + EXAMPLE: + >>> spacy.explain(u'NORP') + >>> doc = nlp(u'Hello world') + >>> print([w.text, w.tag_, spacy.explain(w.tag_) for w in doc]) + """ + if term in GLOSSARY: + return GLOSSARY[term] + else: + warnings.warn(Warnings.W118.format(term=term)) + + +GLOSSARY = { + # POS tags + # Universal POS Tags + # http://universaldependencies.org/u/pos/ + "ADJ": "adjective", + "ADP": "adposition", + "ADV": "adverb", + "AUX": "auxiliary", + "CONJ": "conjunction", + "CCONJ": "coordinating conjunction", + "DET": "determiner", + "INTJ": "interjection", + "NOUN": "noun", + "NUM": "numeral", + "PART": "particle", + "PRON": "pronoun", + "PROPN": "proper noun", + "PUNCT": "punctuation", + "SCONJ": "subordinating conjunction", + "SYM": "symbol", + "VERB": "verb", + "X": "other", + "EOL": "end of line", + "SPACE": "space", + # POS tags (English) + # OntoNotes 5 / Penn Treebank + # https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html + ".": "punctuation mark, sentence closer", + ",": "punctuation mark, comma", + "-LRB-": "left round bracket", + "-RRB-": "right round bracket", + "``": "opening quotation mark", + '""': "closing quotation mark", + "''": "closing quotation mark", + ":": "punctuation mark, colon or ellipsis", + "$": "symbol, currency", + "#": "symbol, number sign", + "AFX": "affix", + "CC": "conjunction, coordinating", + "CD": "cardinal number", + "DT": "determiner", + "EX": "existential there", + "FW": "foreign word", + "HYPH": "punctuation mark, hyphen", + "IN": "conjunction, subordinating or preposition", + "JJ": "adjective (English), other noun-modifier (Chinese)", + "JJR": "adjective, comparative", + "JJS": "adjective, superlative", + "LS": "list item marker", + "MD": "verb, modal auxiliary", + "NIL": "missing tag", + "NN": "noun, singular or mass", + "NNP": "noun, proper singular", + "NNPS": "noun, proper plural", + "NNS": "noun, plural", + "PDT": "predeterminer", + "POS": "possessive ending", + "PRP": "pronoun, personal", + "PRP$": "pronoun, possessive", + "RB": "adverb", + "RBR": "adverb, comparative", + "RBS": "adverb, superlative", + "RP": "adverb, particle", + "TO": 'infinitival "to"', + "UH": "interjection", + "VB": "verb, base form", + "VBD": "verb, past tense", + "VBG": "verb, gerund or present participle", + "VBN": "verb, past participle", + "VBP": "verb, non-3rd person singular present", + "VBZ": "verb, 3rd person singular present", + "WDT": "wh-determiner", + "WP": "wh-pronoun, personal", + "WP$": "wh-pronoun, possessive", + "WRB": "wh-adverb", + "SP": "space (English), sentence-final particle (Chinese)", + "ADD": "email", + "NFP": "superfluous punctuation", + "GW": "additional word in multi-word expression", + "XX": "unknown", + "BES": 'auxiliary "be"', + "HVS": 'forms of "have"', + "_SP": "whitespace", + # POS Tags (German) + # TIGER Treebank + # http://www.ims.uni-stuttgart.de/forschung/ressourcen/korpora/TIGERCorpus/annotation/tiger_introduction.pdf + "$(": "other sentence-internal punctuation mark", + "$,": "comma", + "$.": "sentence-final punctuation mark", + "ADJA": "adjective, attributive", + "ADJD": "adjective, adverbial or predicative", + "APPO": "postposition", + "APPR": "preposition; circumposition left", + "APPRART": "preposition with article", + "APZR": "circumposition right", + "ART": "definite or indefinite article", + "CARD": "cardinal number", + "FM": "foreign language material", + "ITJ": "interjection", + "KOKOM": "comparative conjunction", + "KON": "coordinate conjunction", + "KOUI": 'subordinate conjunction with "zu" and infinitive', + "KOUS": "subordinate conjunction with sentence", + "NE": "proper noun", + "NNE": "proper noun", + "PAV": "pronominal adverb", + "PROAV": "pronominal adverb", + "PDAT": "attributive demonstrative pronoun", + "PDS": "substituting demonstrative pronoun", + "PIAT": "attributive indefinite pronoun without determiner", + "PIDAT": "attributive indefinite pronoun with determiner", + "PIS": "substituting indefinite pronoun", + "PPER": "non-reflexive personal pronoun", + "PPOSAT": "attributive possessive pronoun", + "PPOSS": "substituting possessive pronoun", + "PRELAT": "attributive relative pronoun", + "PRELS": "substituting relative pronoun", + "PRF": "reflexive personal pronoun", + "PTKA": "particle with adjective or adverb", + "PTKANT": "answer particle", + "PTKNEG": "negative particle", + "PTKVZ": "separable verbal particle", + "PTKZU": '"zu" before infinitive', + "PWAT": "attributive interrogative pronoun", + "PWAV": "adverbial interrogative or relative pronoun", + "PWS": "substituting interrogative pronoun", + "TRUNC": "word remnant", + "VAFIN": "finite verb, auxiliary", + "VAIMP": "imperative, auxiliary", + "VAINF": "infinitive, auxiliary", + "VAPP": "perfect participle, auxiliary", + "VMFIN": "finite verb, modal", + "VMINF": "infinitive, modal", + "VMPP": "perfect participle, modal", + "VVFIN": "finite verb, full", + "VVIMP": "imperative, full", + "VVINF": "infinitive, full", + "VVIZU": 'infinitive with "zu", full', + "VVPP": "perfect participle, full", + "XY": "non-word containing non-letter", + # POS Tags (Chinese) + # OntoNotes / Chinese Penn Treebank + # https://repository.upenn.edu/cgi/viewcontent.cgi?article=1039&context=ircs_reports + "AD": "adverb", + "AS": "aspect marker", + "BA": "把 in ba-construction", + # "CD": "cardinal number", + "CS": "subordinating conjunction", + "DEC": "的 in a relative clause", + "DEG": "associative 的", + "DER": "得 in V-de const. and V-de-R", + "DEV": "地 before VP", + "ETC": "for words 等, 等等", + # "FW": "foreign words" + "IJ": "interjection", + # "JJ": "other noun-modifier", + "LB": "被 in long bei-const", + "LC": "localizer", + "M": "measure word", + "MSP": "other particle", + # "NN": "common noun", + "NR": "proper noun", + "NT": "temporal noun", + "OD": "ordinal number", + "ON": "onomatopoeia", + "P": "preposition excluding 把 and 被", + "PN": "pronoun", + "PU": "punctuation", + "SB": "被 in short bei-const", + # "SP": "sentence-final particle", + "VA": "predicative adjective", + "VC": "是 (copula)", + "VE": "有 as the main verb", + "VV": "other verb", + # Noun chunks + "NP": "noun phrase", + "PP": "prepositional phrase", + "VP": "verb phrase", + "ADVP": "adverb phrase", + "ADJP": "adjective phrase", + "SBAR": "subordinating conjunction", + "PRT": "particle", + "PNP": "prepositional noun phrase", + # Dependency Labels (English) + # ClearNLP / Universal Dependencies + # https://github.com/clir/clearnlp-guidelines/blob/master/md/specifications/dependency_labels.md + "acl": "clausal modifier of noun (adjectival clause)", + "acomp": "adjectival complement", + "advcl": "adverbial clause modifier", + "advmod": "adverbial modifier", + "agent": "agent", + "amod": "adjectival modifier", + "appos": "appositional modifier", + "attr": "attribute", + "aux": "auxiliary", + "auxpass": "auxiliary (passive)", + "case": "case marking", + "cc": "coordinating conjunction", + "ccomp": "clausal complement", + "clf": "classifier", + "complm": "complementizer", + "compound": "compound", + "conj": "conjunct", + "cop": "copula", + "csubj": "clausal subject", + "csubjpass": "clausal subject (passive)", + "dative": "dative", + "dep": "unclassified dependent", + "det": "determiner", + "discourse": "discourse element", + "dislocated": "dislocated elements", + "dobj": "direct object", + "expl": "expletive", + "fixed": "fixed multiword expression", + "flat": "flat multiword expression", + "goeswith": "goes with", + "hmod": "modifier in hyphenation", + "hyph": "hyphen", + "infmod": "infinitival modifier", + "intj": "interjection", + "iobj": "indirect object", + "list": "list", + "mark": "marker", + "meta": "meta modifier", + "neg": "negation modifier", + "nmod": "modifier of nominal", + "nn": "noun compound modifier", + "npadvmod": "noun phrase as adverbial modifier", + "nsubj": "nominal subject", + "nsubjpass": "nominal subject (passive)", + "nounmod": "modifier of nominal", + "npmod": "noun phrase as adverbial modifier", + "num": "number modifier", + "number": "number compound modifier", + "nummod": "numeric modifier", + "oprd": "object predicate", + "obj": "object", + "obl": "oblique nominal", + "orphan": "orphan", + "parataxis": "parataxis", + "partmod": "participal modifier", + "pcomp": "complement of preposition", + "pobj": "object of preposition", + "poss": "possession modifier", + "possessive": "possessive modifier", + "preconj": "pre-correlative conjunction", + "prep": "prepositional modifier", + "prt": "particle", + "punct": "punctuation", + "quantmod": "modifier of quantifier", + "rcmod": "relative clause modifier", + "relcl": "relative clause modifier", + "reparandum": "overridden disfluency", + "root": "root", + "ROOT": "root", + "vocative": "vocative", + "xcomp": "open clausal complement", + # Dependency labels (German) + # TIGER Treebank + # http://www.ims.uni-stuttgart.de/forschung/ressourcen/korpora/TIGERCorpus/annotation/tiger_introduction.pdf + # currently missing: 'cc' (comparative complement) because of conflict + # with English labels + "ac": "adpositional case marker", + "adc": "adjective component", + "ag": "genitive attribute", + "ams": "measure argument of adjective", + "app": "apposition", + "avc": "adverbial phrase component", + "cd": "coordinating conjunction", + "cj": "conjunct", + "cm": "comparative conjunction", + "cp": "complementizer", + "cvc": "collocational verb construction", + "da": "dative", + "dh": "discourse-level head", + "dm": "discourse marker", + "ep": "expletive es", + "hd": "head", + "ju": "junctor", + "mnr": "postnominal modifier", + "mo": "modifier", + "ng": "negation", + "nk": "noun kernel element", + "nmc": "numerical component", + "oa": "accusative object", + "oc": "clausal object", + "og": "genitive object", + "op": "prepositional object", + "par": "parenthetical element", + "pd": "predicate", + "pg": "phrasal genitive", + "ph": "placeholder", + "pm": "morphological particle", + "pnc": "proper noun component", + "rc": "relative clause", + "re": "repeated element", + "rs": "reported speech", + "sb": "subject", + "sbp": "passivized subject (PP)", + "sp": "subject or predicate", + "svp": "separable verb prefix", + "uc": "unit component", + "vo": "vocative", + # Named Entity Recognition + # OntoNotes 5 + # https://catalog.ldc.upenn.edu/docs/LDC2013T19/OntoNotes-Release-5.0.pdf + "PERSON": "People, including fictional", + "NORP": "Nationalities or religious or political groups", + "FACILITY": "Buildings, airports, highways, bridges, etc.", + "FAC": "Buildings, airports, highways, bridges, etc.", + "ORG": "Companies, agencies, institutions, etc.", + "GPE": "Countries, cities, states", + "LOC": "Non-GPE locations, mountain ranges, bodies of water", + "PRODUCT": "Objects, vehicles, foods, etc. (not services)", + "EVENT": "Named hurricanes, battles, wars, sports events, etc.", + "WORK_OF_ART": "Titles of books, songs, etc.", + "LAW": "Named documents made into laws.", + "LANGUAGE": "Any named language", + "DATE": "Absolute or relative dates or periods", + "TIME": "Times smaller than a day", + "PERCENT": 'Percentage, including "%"', + "MONEY": "Monetary values, including unit", + "QUANTITY": "Measurements, as of weight or distance", + "ORDINAL": '"first", "second", etc.', + "CARDINAL": "Numerals that do not fall under another type", + # Named Entity Recognition + # Wikipedia + # http://www.sciencedirect.com/science/article/pii/S0004370212000276 + # https://pdfs.semanticscholar.org/5744/578cc243d92287f47448870bb426c66cc941.pdf + "PER": "Named person or family.", + "MISC": "Miscellaneous entities, e.g. events, nationalities, products or works of art", + # https://github.com/ltgoslo/norne + "EVT": "Festivals, cultural events, sports events, weather phenomena, wars, etc.", + "PROD": "Product, i.e. artificially produced entities including speeches, radio shows, programming languages, contracts, laws and ideas", + "DRV": "Words (and phrases?) that are dervied from a name, but not a name in themselves, e.g. 'Oslo-mannen' ('the man from Oslo')", + "GPE_LOC": "Geo-political entity, with a locative sense, e.g. 'John lives in Spain'", + "GPE_ORG": "Geo-political entity, with an organisation sense, e.g. 'Spain declined to meet with Belgium'", +} diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/language.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/language.py new file mode 100644 index 0000000000000000000000000000000000000000..3fb8d283b0a115b37dceb1e6cf37bf3dc6333789 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/language.py @@ -0,0 +1,2462 @@ +import functools +import inspect +import itertools +import multiprocessing as mp +import random +import traceback +import warnings +from contextlib import ExitStack, contextmanager +from copy import deepcopy +from dataclasses import dataclass +from itertools import chain, cycle +from pathlib import Path +from timeit import default_timer as timer +from typing import ( + Any, + Callable, + Dict, + Iterable, + Iterator, + List, + NoReturn, + Optional, + Pattern, + Sequence, + Set, + Tuple, + TypeVar, + Union, + cast, + overload, +) + +import numpy +import srsly +from cymem.cymem import Pool +from thinc.api import Config, CupyOps, Optimizer, get_current_ops +from thinc.util import convert_recursive + +from . import about, ty, util +from .compat import Literal +from .errors import Errors, Warnings +from .git_info import GIT_VERSION +from .lang.punctuation import TOKENIZER_INFIXES, TOKENIZER_PREFIXES, TOKENIZER_SUFFIXES +from .lang.tokenizer_exceptions import BASE_EXCEPTIONS, URL_MATCH +from .lookups import load_lookups +from .pipe_analysis import analyze_pipes, print_pipe_analysis, validate_attrs +from .schemas import ( + ConfigSchema, + ConfigSchemaInit, + ConfigSchemaNlp, + ConfigSchemaPretrain, + validate_init_settings, +) +from .scorer import Scorer +from .tokenizer import Tokenizer +from .tokens import Doc +from .tokens.underscore import Underscore +from .training import Example, validate_examples +from .training.initialize import init_tok2vec, init_vocab +from .util import ( + _DEFAULT_EMPTY_PIPES, + CONFIG_SECTION_ORDER, + SimpleFrozenDict, + SimpleFrozenList, + _pipe, + combine_score_weights, + raise_error, + registry, + warn_if_jupyter_cupy, +) +from .vectors import BaseVectors +from .vocab import Vocab, create_vocab + +PipeCallable = Callable[[Doc], Doc] + + +# This is the base config will all settings (training etc.) +DEFAULT_CONFIG_PATH = Path(__file__).parent / "default_config.cfg" +DEFAULT_CONFIG = util.load_config(DEFAULT_CONFIG_PATH) +# This is the base config for the [pretraining] block and currently not included +# in the main config and only added via the 'init fill-config' command +DEFAULT_CONFIG_PRETRAIN_PATH = Path(__file__).parent / "default_config_pretraining.cfg" + +# Type variable for contexts piped with documents +_AnyContext = TypeVar("_AnyContext") + + +class BaseDefaults: + """Language data defaults, available via Language.Defaults. Can be + overwritten by language subclasses by defining their own subclasses of + Language.Defaults. + """ + + config: Config = Config(section_order=CONFIG_SECTION_ORDER) + tokenizer_exceptions: Dict[str, List[dict]] = BASE_EXCEPTIONS + prefixes: Optional[Sequence[Union[str, Pattern]]] = TOKENIZER_PREFIXES + suffixes: Optional[Sequence[Union[str, Pattern]]] = TOKENIZER_SUFFIXES + infixes: Optional[Sequence[Union[str, Pattern]]] = TOKENIZER_INFIXES + token_match: Optional[Callable] = None + url_match: Optional[Callable] = URL_MATCH + syntax_iterators: Dict[str, Callable] = {} + lex_attr_getters: Dict[int, Callable[[str], Any]] = {} + stop_words: Set[str] = set() + writing_system = {"direction": "ltr", "has_case": True, "has_letters": True} + + +def create_tokenizer() -> Callable[["Language"], Tokenizer]: + """Registered function to create a tokenizer. Returns a factory that takes + the nlp object and returns a Tokenizer instance using the language detaults. + """ + + def tokenizer_factory(nlp: "Language") -> Tokenizer: + prefixes = nlp.Defaults.prefixes + suffixes = nlp.Defaults.suffixes + infixes = nlp.Defaults.infixes + prefix_search = util.compile_prefix_regex(prefixes).search if prefixes else None + suffix_search = util.compile_suffix_regex(suffixes).search if suffixes else None + infix_finditer = util.compile_infix_regex(infixes).finditer if infixes else None + return Tokenizer( + nlp.vocab, + rules=nlp.Defaults.tokenizer_exceptions, + prefix_search=prefix_search, + suffix_search=suffix_search, + infix_finditer=infix_finditer, + token_match=nlp.Defaults.token_match, + url_match=nlp.Defaults.url_match, + ) + + return tokenizer_factory + + +def load_lookups_data(lang, tables): + util.logger.debug("Loading lookups from spacy-lookups-data: %s", tables) + lookups = load_lookups(lang=lang, tables=tables) + return lookups + + +class Language: + """A text-processing pipeline. Usually you'll load this once per process, + and pass the instance around your application. + + Defaults (class): Settings, data and factory methods for creating the `nlp` + object and processing pipeline. + lang (str): Two-letter ISO 639-1 or three-letter ISO 639-3 language codes, such as 'en' and 'eng'. + + DOCS: https://spacy.io/api/language + """ + + Defaults = BaseDefaults + lang: Optional[str] = None + default_config = DEFAULT_CONFIG + + factories = SimpleFrozenDict(error=Errors.E957) + _factory_meta: Dict[str, "FactoryMeta"] = {} # meta by factory + + def __init__( + self, + vocab: Union[Vocab, bool] = True, + *, + max_length: int = 10**6, + meta: Dict[str, Any] = {}, + create_tokenizer: Optional[Callable[["Language"], Callable[[str], Doc]]] = None, + create_vectors: Optional[Callable[["Vocab"], BaseVectors]] = None, + batch_size: int = 1000, + **kwargs, + ) -> None: + """Initialise a Language object. + + vocab (Vocab): A `Vocab` object. If `True`, a vocab is created. + meta (dict): Custom meta data for the Language class. Is written to by + models to add model meta data. + max_length (int): Maximum number of characters in a single text. The + current models may run out memory on extremely long texts, due to + large internal allocations. You should segment these texts into + meaningful units, e.g. paragraphs, subsections etc, before passing + them to spaCy. Default maximum length is 1,000,000 charas (1mb). As + a rule of thumb, if all pipeline components are enabled, spaCy's + default models currently requires roughly 1GB of temporary memory per + 100,000 characters in one text. + create_tokenizer (Callable): Function that takes the nlp object and + returns a tokenizer. + batch_size (int): Default batch size for pipe and evaluate. + + DOCS: https://spacy.io/api/language#init + """ + from .pipeline.factories import register_factories + + register_factories() + # We're only calling this to import all factories provided via entry + # points. The factory decorator applied to these functions takes care + # of the rest. + util.registry._entry_point_factories.get_all() + + self._config = DEFAULT_CONFIG.merge(self.default_config) + self._meta = dict(meta) + self._path = None + self._optimizer: Optional[Optimizer] = None + # Component meta and configs are only needed on the instance + self._pipe_meta: Dict[str, "FactoryMeta"] = {} # meta by component + self._pipe_configs: Dict[str, Config] = {} # config by component + + if not isinstance(vocab, Vocab) and vocab is not True: + raise ValueError(Errors.E918.format(vocab=vocab, vocab_type=type(Vocab))) + if vocab is True: + vectors_name = meta.get("vectors", {}).get("name") + vocab = create_vocab(self.lang, self.Defaults, vectors_name=vectors_name) + if not create_vectors: + vectors_cfg = {"vectors": self._config["nlp"]["vectors"]} + create_vectors = registry.resolve(vectors_cfg)["vectors"] + vocab.vectors = create_vectors(vocab) + else: + if (self.lang and vocab.lang) and (self.lang != vocab.lang): + raise ValueError(Errors.E150.format(nlp=self.lang, vocab=vocab.lang)) + self.vocab: Vocab = vocab + if self.lang is None: + self.lang = self.vocab.lang + self._components: List[Tuple[str, PipeCallable]] = [] + self._disabled: Set[str] = set() + self.max_length = max_length + # Create the default tokenizer from the default config + if not create_tokenizer: + tokenizer_cfg = {"tokenizer": self._config["nlp"]["tokenizer"]} + create_tokenizer = registry.resolve(tokenizer_cfg)["tokenizer"] + self.tokenizer = create_tokenizer(self) + self.batch_size = batch_size + self.default_error_handler = raise_error + + def __init_subclass__(cls, **kwargs): + super().__init_subclass__(**kwargs) + cls.default_config = DEFAULT_CONFIG.merge(cls.Defaults.config) + cls.default_config["nlp"]["lang"] = cls.lang + + @property + def path(self): + return self._path + + @property + def meta(self) -> Dict[str, Any]: + """Custom meta data of the language class. If a model is loaded, this + includes details from the model's meta.json. + + RETURNS (Dict[str, Any]): The meta. + + DOCS: https://spacy.io/api/language#meta + """ + spacy_version = util.get_minor_version_range(about.__version__) + if self.vocab.lang: + self._meta.setdefault("lang", self.vocab.lang) + else: + self._meta.setdefault("lang", self.lang) + self._meta.setdefault("name", "pipeline") + self._meta.setdefault("version", "0.0.0") + self._meta.setdefault("spacy_version", spacy_version) + self._meta.setdefault("description", "") + self._meta.setdefault("author", "") + self._meta.setdefault("email", "") + self._meta.setdefault("url", "") + self._meta.setdefault("license", "") + self._meta.setdefault("spacy_git_version", GIT_VERSION) + self._meta["vectors"] = { + "width": self.vocab.vectors_length, + "vectors": len(self.vocab.vectors), + "keys": self.vocab.vectors.n_keys, + "name": self.vocab.vectors.name, + "mode": self.vocab.vectors.mode, + } + self._meta["labels"] = dict(self.pipe_labels) + # TODO: Adding this back to prevent breaking people's code etc., but + # we should consider removing it + self._meta["pipeline"] = list(self.pipe_names) + self._meta["components"] = list(self.component_names) + self._meta["disabled"] = list(self.disabled) + return self._meta + + @meta.setter + def meta(self, value: Dict[str, Any]) -> None: + self._meta = value + + @property + def config(self) -> Config: + """Trainable config for the current language instance. Includes the + current pipeline components, as well as default training config. + + RETURNS (thinc.api.Config): The config. + + DOCS: https://spacy.io/api/language#config + """ + self._config.setdefault("nlp", {}) + self._config.setdefault("training", {}) + self._config["nlp"]["lang"] = self.lang + # We're storing the filled config for each pipeline component and so + # we can populate the config again later + pipeline = {} + score_weights = [] + for pipe_name in self.component_names: + pipe_meta = self.get_pipe_meta(pipe_name) + pipe_config = self.get_pipe_config(pipe_name) + pipeline[pipe_name] = {"factory": pipe_meta.factory, **pipe_config} + if pipe_meta.default_score_weights: + score_weights.append(pipe_meta.default_score_weights) + self._config["nlp"]["pipeline"] = list(self.component_names) + self._config["nlp"]["disabled"] = list(self.disabled) + self._config["components"] = pipeline + # We're merging the existing score weights back into the combined + # weights to make sure we're preserving custom settings in the config + # but also reflect updates (e.g. new components added) + prev_weights = self._config["training"].get("score_weights", {}) + combined_score_weights = combine_score_weights(score_weights, prev_weights) + self._config["training"]["score_weights"] = combined_score_weights + if not srsly.is_json_serializable(self._config): + raise ValueError(Errors.E961.format(config=self._config)) + return self._config + + @config.setter + def config(self, value: Config) -> None: + self._config = value + + @property + def disabled(self) -> List[str]: + """Get the names of all disabled components. + + RETURNS (List[str]): The disabled components. + """ + # Make sure the disabled components are returned in the order they + # appear in the pipeline (which isn't guaranteed by the set) + names = [name for name, _ in self._components if name in self._disabled] + return SimpleFrozenList(names, error=Errors.E926.format(attr="disabled")) + + @property + def factory_names(self) -> List[str]: + """Get names of all available factories. + + RETURNS (List[str]): The factory names. + """ + names = list(self.factories.keys()) + return SimpleFrozenList(names) + + @property + def components(self) -> List[Tuple[str, PipeCallable]]: + """Get all (name, component) tuples in the pipeline, including the + currently disabled components. + """ + return SimpleFrozenList( + self._components, error=Errors.E926.format(attr="components") + ) + + @property + def component_names(self) -> List[str]: + """Get the names of the available pipeline components. Includes all + active and inactive pipeline components. + + RETURNS (List[str]): List of component name strings, in order. + """ + names = [pipe_name for pipe_name, _ in self._components] + return SimpleFrozenList(names, error=Errors.E926.format(attr="component_names")) + + @property + def pipeline(self) -> List[Tuple[str, PipeCallable]]: + """The processing pipeline consisting of (name, component) tuples. The + components are called on the Doc in order as it passes through the + pipeline. + + RETURNS (List[Tuple[str, Callable[[Doc], Doc]]]): The pipeline. + """ + pipes = [(n, p) for n, p in self._components if n not in self._disabled] + return SimpleFrozenList(pipes, error=Errors.E926.format(attr="pipeline")) + + @property + def pipe_names(self) -> List[str]: + """Get names of available active pipeline components. + + RETURNS (List[str]): List of component name strings, in order. + """ + names = [pipe_name for pipe_name, _ in self.pipeline] + return SimpleFrozenList(names, error=Errors.E926.format(attr="pipe_names")) + + @property + def pipe_factories(self) -> Dict[str, str]: + """Get the component factories for the available pipeline components. + + RETURNS (Dict[str, str]): Factory names, keyed by component names. + """ + factories = {} + for pipe_name, pipe in self._components: + factories[pipe_name] = self.get_pipe_meta(pipe_name).factory + return SimpleFrozenDict(factories) + + @property + def pipe_labels(self) -> Dict[str, List[str]]: + """Get the labels set by the pipeline components, if available (if + the component exposes a labels property and the labels are not + hidden). + + RETURNS (Dict[str, List[str]]): Labels keyed by component name. + """ + labels = {} + for name, pipe in self._components: + if hasattr(pipe, "hide_labels") and pipe.hide_labels is True: + continue + if hasattr(pipe, "labels"): + labels[name] = list(pipe.labels) + return SimpleFrozenDict(labels) + + @classmethod + def has_factory(cls, name: str) -> bool: + """RETURNS (bool): Whether a factory of that name is registered.""" + internal_name = cls.get_factory_name(name) + return name in registry.factories or internal_name in registry.factories + + @classmethod + def get_factory_name(cls, name: str) -> str: + """Get the internal factory name based on the language subclass. + + name (str): The factory name. + RETURNS (str): The internal factory name. + """ + if cls.lang is None: + return name + return f"{cls.lang}.{name}" + + @classmethod + def get_factory_meta(cls, name: str) -> "FactoryMeta": + """Get the meta information for a given factory name. + + name (str): The component factory name. + RETURNS (FactoryMeta): The meta for the given factory name. + """ + internal_name = cls.get_factory_name(name) + if internal_name in cls._factory_meta: + return cls._factory_meta[internal_name] + if name in cls._factory_meta: + return cls._factory_meta[name] + raise ValueError(Errors.E967.format(meta="factory", name=name)) + + @classmethod + def set_factory_meta(cls, name: str, value: "FactoryMeta") -> None: + """Set the meta information for a given factory name. + + name (str): The component factory name. + value (FactoryMeta): The meta to set. + """ + cls._factory_meta[cls.get_factory_name(name)] = value + + def get_pipe_meta(self, name: str) -> "FactoryMeta": + """Get the meta information for a given component name. + + name (str): The component name. + RETURNS (FactoryMeta): The meta for the given component name. + """ + if name not in self._pipe_meta: + raise ValueError(Errors.E967.format(meta="component", name=name)) + return self._pipe_meta[name] + + def get_pipe_config(self, name: str) -> Config: + """Get the config used to create a pipeline component. + + name (str): The component name. + RETURNS (Config): The config used to create the pipeline component. + """ + if name not in self._pipe_configs: + raise ValueError(Errors.E960.format(name=name)) + pipe_config = self._pipe_configs[name] + return pipe_config + + @classmethod + def factory( + cls, + name: str, + *, + default_config: Dict[str, Any] = SimpleFrozenDict(), + assigns: Iterable[str] = SimpleFrozenList(), + requires: Iterable[str] = SimpleFrozenList(), + retokenizes: bool = False, + default_score_weights: Dict[str, Optional[float]] = SimpleFrozenDict(), + func: Optional[Callable] = None, + ) -> Callable: + """Register a new pipeline component factory. Can be used as a decorator + on a function or classmethod, or called as a function with the factory + provided as the func keyword argument. To create a component and add + it to the pipeline, you can use nlp.add_pipe(name). + + name (str): The name of the component factory. + default_config (Dict[str, Any]): Default configuration, describing the + default values of the factory arguments. + assigns (Iterable[str]): Doc/Token attributes assigned by this component, + e.g. "token.ent_id". Used for pipeline analysis. + requires (Iterable[str]): Doc/Token attributes required by this component, + e.g. "token.ent_id". Used for pipeline analysis. + retokenizes (bool): Whether the component changes the tokenization. + Used for pipeline analysis. + default_score_weights (Dict[str, Optional[float]]): The scores to report during + training, and their default weight towards the final score used to + select the best model. Weights should sum to 1.0 per component and + will be combined and normalized for the whole pipeline. If None, + the score won't be shown in the logs or be weighted. + func (Optional[Callable]): Factory function if not used as a decorator. + + DOCS: https://spacy.io/api/language#factory + """ + if not isinstance(name, str): + raise ValueError(Errors.E963.format(decorator="factory")) + if "." in name: + raise ValueError(Errors.E853.format(name=name)) + if not isinstance(default_config, dict): + err = Errors.E962.format( + style="default config", name=name, cfg_type=type(default_config) + ) + raise ValueError(err) + + def add_factory(factory_func: Callable) -> Callable: + internal_name = cls.get_factory_name(name) + if internal_name in registry.factories: + # We only check for the internal name here – it's okay if it's a + # subclass and the base class has a factory of the same name. We + # also only raise if the function is different to prevent raising + # if module is reloaded. + existing_func = registry.factories.get(internal_name) + if not util.is_same_func(factory_func, existing_func): + err = Errors.E004.format( + name=name, func=existing_func, new_func=factory_func + ) + raise ValueError(err) + + arg_names = util.get_arg_names(factory_func) + if "nlp" not in arg_names or "name" not in arg_names: + raise ValueError(Errors.E964.format(name=name)) + # Officially register the factory so we can later call + # registry.resolve and refer to it in the config as + # @factories = "spacy.Language.xyz". We use the class name here so + # different classes can have different factories. + registry.factories.register(internal_name, func=factory_func) + factory_meta = FactoryMeta( + factory=name, + default_config=default_config, + assigns=validate_attrs(assigns), + requires=validate_attrs(requires), + scores=list(default_score_weights.keys()), + default_score_weights=default_score_weights, + retokenizes=retokenizes, + ) + cls.set_factory_meta(name, factory_meta) + # We're overwriting the class attr with a frozen dict to handle + # backwards-compat (writing to Language.factories directly). This + # wouldn't work with an instance property and just produce a + # confusing error – here we can show a custom error + cls.factories = SimpleFrozenDict( + registry.factories.get_all(), error=Errors.E957 + ) + return factory_func + + if func is not None: # Support non-decorator use cases + return add_factory(func) + return add_factory + + @classmethod + def component( + cls, + name: str, + *, + assigns: Iterable[str] = SimpleFrozenList(), + requires: Iterable[str] = SimpleFrozenList(), + retokenizes: bool = False, + func: Optional[PipeCallable] = None, + ) -> Callable[..., Any]: + """Register a new pipeline component. Can be used for stateless function + components that don't require a separate factory. Can be used as a + decorator on a function or classmethod, or called as a function with the + factory provided as the func keyword argument. To create a component and + add it to the pipeline, you can use nlp.add_pipe(name). + + name (str): The name of the component factory. + assigns (Iterable[str]): Doc/Token attributes assigned by this component, + e.g. "token.ent_id". Used for pipeline analysis. + requires (Iterable[str]): Doc/Token attributes required by this component, + e.g. "token.ent_id". Used for pipeline analysis. + retokenizes (bool): Whether the component changes the tokenization. + Used for pipeline analysis. + func (Optional[Callable[[Doc], Doc]): Factory function if not used as a decorator. + + DOCS: https://spacy.io/api/language#component + """ + if name is not None: + if not isinstance(name, str): + raise ValueError(Errors.E963.format(decorator="component")) + if "." in name: + raise ValueError(Errors.E853.format(name=name)) + component_name = name if name is not None else util.get_object_name(func) + + def add_component(component_func: PipeCallable) -> Callable: + if isinstance(func, type): # function is a class + raise ValueError(Errors.E965.format(name=component_name)) + + def factory_func(nlp, name: str) -> PipeCallable: + return component_func + + internal_name = cls.get_factory_name(name) + if internal_name in registry.factories: + # We only check for the internal name here – it's okay if it's a + # subclass and the base class has a factory of the same name. We + # also only raise if the function is different to prevent raising + # if module is reloaded. It's hacky, but we need to check the + # existing functure for a closure and whether that's identical + # to the component function (because factory_func created above + # will always be different, even for the same function) + existing_func = registry.factories.get(internal_name) + closure = existing_func.__closure__ + wrapped = [c.cell_contents for c in closure][0] if closure else None + if util.is_same_func(wrapped, component_func): + factory_func = existing_func # noqa: F811 + + cls.factory( + component_name, + assigns=assigns, + requires=requires, + retokenizes=retokenizes, + func=factory_func, + ) + return component_func + + if func is not None: # Support non-decorator use cases + return add_component(func) + return add_component + + def analyze_pipes( + self, + *, + keys: List[str] = ["assigns", "requires", "scores", "retokenizes"], + pretty: bool = False, + ) -> Optional[Dict[str, Any]]: + """Analyze the current pipeline components, print a summary of what + they assign or require and check that all requirements are met. + + keys (List[str]): The meta values to display in the table. Corresponds + to values in FactoryMeta, defined by @Language.factory decorator. + pretty (bool): Pretty-print the results. + RETURNS (dict): The data. + """ + analysis = analyze_pipes(self, keys=keys) + if pretty: + print_pipe_analysis(analysis, keys=keys) + return analysis + + def get_pipe(self, name: str) -> PipeCallable: + """Get a pipeline component for a given component name. + + name (str): Name of pipeline component to get. + RETURNS (callable): The pipeline component. + + DOCS: https://spacy.io/api/language#get_pipe + """ + for pipe_name, component in self._components: + if pipe_name == name: + return component + raise KeyError(Errors.E001.format(name=name, opts=self.component_names)) + + def create_pipe( + self, + factory_name: str, + name: Optional[str] = None, + *, + config: Dict[str, Any] = SimpleFrozenDict(), + raw_config: Optional[Config] = None, + validate: bool = True, + ) -> PipeCallable: + """Create a pipeline component. Mostly used internally. To create and + add a component to the pipeline, you can use nlp.add_pipe. + + factory_name (str): Name of component factory. + name (Optional[str]): Optional name to assign to component instance. + Defaults to factory name if not set. + config (Dict[str, Any]): Config parameters to use for this component. + Will be merged with default config, if available. + raw_config (Optional[Config]): Internals: the non-interpolated config. + validate (bool): Whether to validate the component config against the + arguments and types expected by the factory. + RETURNS (Callable[[Doc], Doc]): The pipeline component. + + DOCS: https://spacy.io/api/language#create_pipe + """ + name = name if name is not None else factory_name + if not isinstance(config, dict): + err = Errors.E962.format(style="config", name=name, cfg_type=type(config)) + raise ValueError(err) + if not srsly.is_json_serializable(config): + raise ValueError(Errors.E961.format(config=config)) + if not self.has_factory(factory_name): + err = Errors.E002.format( + name=factory_name, + opts=", ".join(self.factory_names), + method="create_pipe", + lang=util.get_object_name(self), + lang_code=self.lang, + ) + raise ValueError(err) + pipe_meta = self.get_factory_meta(factory_name) + # This is unideal, but the alternative would mean you always need to + # specify the full config settings, which is not really viable. + if pipe_meta.default_config: + config = Config(pipe_meta.default_config).merge(config) + internal_name = self.get_factory_name(factory_name) + # If the language-specific factory doesn't exist, try again with the + # not-specific name + if internal_name not in registry.factories: + internal_name = factory_name + # The name allows components to know their pipe name and use it in the + # losses etc. (even if multiple instances of the same factory are used) + config = {"nlp": self, "name": name, **config, "@factories": internal_name} + # We need to create a top-level key because Thinc doesn't allow resolving + # top-level references to registered functions. Also gives nicer errors. + cfg = {factory_name: config} + # We're calling the internal _fill here to avoid constructing the + # registered functions twice + resolved = registry.resolve(cfg, validate=validate) + filled = registry.fill({"cfg": cfg[factory_name]}, validate=validate)["cfg"] + filled = Config(filled) + filled["factory"] = factory_name + filled.pop("@factories", None) + # Remove the extra values we added because we don't want to keep passing + # them around, copying them etc. + filled.pop("nlp", None) + filled.pop("name", None) + # Merge the final filled config with the raw config (including non- + # interpolated variables) + if raw_config: + filled = filled.merge(raw_config) + self._pipe_configs[name] = filled + return resolved[factory_name] + + def create_pipe_from_source( + self, source_name: str, source: "Language", *, name: str + ) -> Tuple[PipeCallable, str]: + """Create a pipeline component by copying it from an existing model. + + source_name (str): Name of the component in the source pipeline. + source (Language): The source nlp object to copy from. + name (str): Optional alternative name to use in current pipeline. + RETURNS (Tuple[Callable[[Doc], Doc], str]): The component and its factory name. + """ + # Check source type + if not isinstance(source, Language): + raise ValueError(Errors.E945.format(name=source_name, source=type(source))) + if self.vocab.vectors != source.vocab.vectors: + warnings.warn(Warnings.W113.format(name=source_name)) + if source_name not in source.component_names: + raise KeyError( + Errors.E944.format( + name=source_name, + model=f"{source.meta['lang']}_{source.meta['name']}", + opts=", ".join(source.component_names), + ) + ) + pipe = source.get_pipe(source_name) + # There is no actual solution here. Either the component has the right + # name for the source pipeline or the component has the right name for + # the current pipeline. This prioritizes the current pipeline. + if hasattr(pipe, "name"): + pipe.name = name + # Make sure the source config is interpolated so we don't end up with + # orphaned variables in our final config + source_config = source.config.interpolate() + pipe_config = util.copy_config(source_config["components"][source_name]) + self._pipe_configs[name] = pipe_config + if self.vocab.strings != source.vocab.strings: + for s in source.vocab.strings: + self.vocab.strings.add(s) + return pipe, pipe_config["factory"] + + def add_pipe( + self, + factory_name: str, + name: Optional[str] = None, + *, + before: Optional[Union[str, int]] = None, + after: Optional[Union[str, int]] = None, + first: Optional[bool] = None, + last: Optional[bool] = None, + source: Optional["Language"] = None, + config: Dict[str, Any] = SimpleFrozenDict(), + raw_config: Optional[Config] = None, + validate: bool = True, + ) -> PipeCallable: + """Add a component to the processing pipeline. Valid components are + callables that take a `Doc` object, modify it and return it. Only one + of before/after/first/last can be set. Default behaviour is "last". + + factory_name (str): Name of the component factory. + name (str): Name of pipeline component. Overwrites existing + component.name attribute if available. If no name is set and + the component exposes no name attribute, component.__name__ is + used. An error is raised if a name already exists in the pipeline. + before (Union[str, int]): Name or index of the component to insert new + component directly before. + after (Union[str, int]): Name or index of the component to insert new + component directly after. + first (bool): If True, insert component first in the pipeline. + last (bool): If True, insert component last in the pipeline. + source (Language): Optional loaded nlp object to copy the pipeline + component from. + config (Dict[str, Any]): Config parameters to use for this component. + Will be merged with default config, if available. + raw_config (Optional[Config]): Internals: the non-interpolated config. + validate (bool): Whether to validate the component config against the + arguments and types expected by the factory. + RETURNS (Callable[[Doc], Doc]): The pipeline component. + + DOCS: https://spacy.io/api/language#add_pipe + """ + if not isinstance(factory_name, str): + bad_val = repr(factory_name) + err = Errors.E966.format(component=bad_val, name=name) + raise ValueError(err) + name = name if name is not None else factory_name + if name in self.component_names: + raise ValueError(Errors.E007.format(name=name, opts=self.component_names)) + # Overriding pipe name in the config is not supported and will be ignored. + if "name" in config: + warnings.warn(Warnings.W119.format(name_in_config=config.pop("name"))) + if source is not None: + # We're loading the component from a model. After loading the + # component, we know its real factory name + pipe_component, factory_name = self.create_pipe_from_source( + factory_name, source, name=name + ) + else: + pipe_component = self.create_pipe( + factory_name, + name=name, + config=config, + raw_config=raw_config, + validate=validate, + ) + pipe_index = self._get_pipe_index(before, after, first, last) + self._pipe_meta[name] = self.get_factory_meta(factory_name) + self._components.insert(pipe_index, (name, pipe_component)) + self._link_components() + return pipe_component + + def _get_pipe_index( + self, + before: Optional[Union[str, int]] = None, + after: Optional[Union[str, int]] = None, + first: Optional[bool] = None, + last: Optional[bool] = None, + ) -> int: + """Determine where to insert a pipeline component based on the before/ + after/first/last values. + + before (str): Name or index of the component to insert directly before. + after (str): Name or index of component to insert directly after. + first (bool): If True, insert component first in the pipeline. + last (bool): If True, insert component last in the pipeline. + RETURNS (int): The index of the new pipeline component. + """ + all_args = {"before": before, "after": after, "first": first, "last": last} + if sum(arg is not None for arg in [before, after, first, last]) >= 2: + raise ValueError( + Errors.E006.format(args=all_args, opts=self.component_names) + ) + if last or not any(value is not None for value in [first, before, after]): + return len(self._components) + elif first: + return 0 + elif isinstance(before, str): + if before not in self.component_names: + raise ValueError( + Errors.E001.format(name=before, opts=self.component_names) + ) + return self.component_names.index(before) + elif isinstance(after, str): + if after not in self.component_names: + raise ValueError( + Errors.E001.format(name=after, opts=self.component_names) + ) + return self.component_names.index(after) + 1 + # We're only accepting indices referring to components that exist + # (can't just do isinstance here because bools are instance of int, too) + elif type(before) == int: + if before >= len(self._components) or before < 0: + err = Errors.E959.format( + dir="before", idx=before, opts=self.component_names + ) + raise ValueError(err) + return before + elif type(after) == int: + if after >= len(self._components) or after < 0: + err = Errors.E959.format( + dir="after", idx=after, opts=self.component_names + ) + raise ValueError(err) + return after + 1 + raise ValueError(Errors.E006.format(args=all_args, opts=self.component_names)) + + def has_pipe(self, name: str) -> bool: + """Check if a component name is present in the pipeline. Equivalent to + `name in nlp.pipe_names`. + + name (str): Name of the component. + RETURNS (bool): Whether a component of the name exists in the pipeline. + + DOCS: https://spacy.io/api/language#has_pipe + """ + return name in self.pipe_names + + def replace_pipe( + self, + name: str, + factory_name: str, + *, + config: Dict[str, Any] = SimpleFrozenDict(), + validate: bool = True, + ) -> PipeCallable: + """Replace a component in the pipeline. + + name (str): Name of the component to replace. + factory_name (str): Factory name of replacement component. + config (Optional[Dict[str, Any]]): Config parameters to use for this + component. Will be merged with default config, if available. + validate (bool): Whether to validate the component config against the + arguments and types expected by the factory. + RETURNS (Callable[[Doc], Doc]): The new pipeline component. + + DOCS: https://spacy.io/api/language#replace_pipe + """ + if name not in self.component_names: + raise ValueError(Errors.E001.format(name=name, opts=self.pipe_names)) + if hasattr(factory_name, "__call__"): + err = Errors.E968.format(component=repr(factory_name), name=name) + raise ValueError(err) + # We need to delegate to Language.add_pipe here instead of just writing + # to Language.pipeline to make sure the configs are handled correctly + pipe_index = self.component_names.index(name) + self.remove_pipe(name) + if not len(self._components) or pipe_index == len(self._components): + # we have no components to insert before/after, or we're replacing the last component + return self.add_pipe( + factory_name, name=name, config=config, validate=validate + ) + else: + return self.add_pipe( + factory_name, + name=name, + before=pipe_index, + config=config, + validate=validate, + ) + + def rename_pipe(self, old_name: str, new_name: str) -> None: + """Rename a pipeline component. + + old_name (str): Name of the component to rename. + new_name (str): New name of the component. + + DOCS: https://spacy.io/api/language#rename_pipe + """ + if old_name not in self.component_names: + raise ValueError( + Errors.E001.format(name=old_name, opts=self.component_names) + ) + if new_name in self.component_names: + raise ValueError( + Errors.E007.format(name=new_name, opts=self.component_names) + ) + i = self.component_names.index(old_name) + self._components[i] = (new_name, self._components[i][1]) + self._pipe_meta[new_name] = self._pipe_meta.pop(old_name) + self._pipe_configs[new_name] = self._pipe_configs.pop(old_name) + # Make sure [initialize] config is adjusted + if old_name in self._config["initialize"]["components"]: + init_cfg = self._config["initialize"]["components"].pop(old_name) + self._config["initialize"]["components"][new_name] = init_cfg + self._link_components() + + def remove_pipe(self, name: str) -> Tuple[str, PipeCallable]: + """Remove a component from the pipeline. + + name (str): Name of the component to remove. + RETURNS (Tuple[str, Callable[[Doc], Doc]]): A `(name, component)` tuple of the removed component. + + DOCS: https://spacy.io/api/language#remove_pipe + """ + if name not in self.component_names: + raise ValueError(Errors.E001.format(name=name, opts=self.component_names)) + removed = self._components.pop(self.component_names.index(name)) + # We're only removing the component itself from the metas/configs here + # because factory may be used for something else + self._pipe_meta.pop(name) + self._pipe_configs.pop(name) + self.meta.get("_sourced_vectors_hashes", {}).pop(name, None) + # Make sure name is removed from the [initialize] config + if name in self._config["initialize"]["components"]: + self._config["initialize"]["components"].pop(name) + # Make sure the name is also removed from the set of disabled components + if name in self.disabled: + self._disabled.remove(name) + self._link_components() + return removed + + def disable_pipe(self, name: str) -> None: + """Disable a pipeline component. The component will still exist on + the nlp object, but it won't be run as part of the pipeline. Does + nothing if the component is already disabled. + + name (str): The name of the component to disable. + """ + if name not in self.component_names: + raise ValueError(Errors.E001.format(name=name, opts=self.component_names)) + self._disabled.add(name) + + def enable_pipe(self, name: str) -> None: + """Enable a previously disabled pipeline component so it's run as part + of the pipeline. Does nothing if the component is already enabled. + + name (str): The name of the component to enable. + """ + if name not in self.component_names: + raise ValueError(Errors.E001.format(name=name, opts=self.component_names)) + if name in self.disabled: + self._disabled.remove(name) + + def __call__( + self, + text: Union[str, Doc], + *, + disable: Iterable[str] = SimpleFrozenList(), + component_cfg: Optional[Dict[str, Dict[str, Any]]] = None, + ) -> Doc: + """Apply the pipeline to some text. The text can span multiple sentences, + and can contain arbitrary whitespace. Alignment into the original string + is preserved. + + text (Union[str, Doc]): If `str`, the text to be processed. If `Doc`, + the doc will be passed directly to the pipeline, skipping + `Language.make_doc`. + disable (List[str]): Names of the pipeline components to disable. + component_cfg (Dict[str, dict]): An optional dictionary with extra + keyword arguments for specific components. + RETURNS (Doc): A container for accessing the annotations. + + DOCS: https://spacy.io/api/language#call + """ + doc = self._ensure_doc(text) + if component_cfg is None: + component_cfg = {} + for name, proc in self.pipeline: + if name in disable: + continue + if not hasattr(proc, "__call__"): + raise ValueError(Errors.E003.format(component=type(proc), name=name)) + error_handler = self.default_error_handler + if hasattr(proc, "get_error_handler"): + error_handler = proc.get_error_handler() + try: + doc = proc(doc, **component_cfg.get(name, {})) # type: ignore[call-arg] + except KeyError as e: + # This typically happens if a component is not initialized + raise ValueError(Errors.E109.format(name=name)) from e + except Exception as e: + error_handler(name, proc, [doc], e) + if not isinstance(doc, Doc): + raise ValueError(Errors.E005.format(name=name, returned_type=type(doc))) + return doc + + def disable_pipes(self, *names) -> "DisabledPipes": + """Disable one or more pipeline components. If used as a context + manager, the pipeline will be restored to the initial state at the end + of the block. Otherwise, a DisabledPipes object is returned, that has + a `.restore()` method you can use to undo your changes. + + This method has been deprecated since 3.0 + """ + warnings.warn(Warnings.W096, DeprecationWarning) + if len(names) == 1 and isinstance(names[0], (list, tuple)): + names = names[0] # type: ignore[assignment] # support list of names instead of spread + return self.select_pipes(disable=names) + + def select_pipes( + self, + *, + disable: Optional[Union[str, Iterable[str]]] = None, + enable: Optional[Union[str, Iterable[str]]] = None, + ) -> "DisabledPipes": + """Disable one or more pipeline components. If used as a context + manager, the pipeline will be restored to the initial state at the end + of the block. Otherwise, a DisabledPipes object is returned, that has + a `.restore()` method you can use to undo your changes. + + disable (str or iterable): The name(s) of the pipes to disable + enable (str or iterable): The name(s) of the pipes to enable - all others will be disabled + + DOCS: https://spacy.io/api/language#select_pipes + """ + if enable is None and disable is None: + raise ValueError(Errors.E991) + if isinstance(disable, str): + disable = [disable] + if enable is not None: + if isinstance(enable, str): + enable = [enable] + to_disable = [pipe for pipe in self.pipe_names if pipe not in enable] + # raise an error if the enable and disable keywords are not consistent + if disable is not None and disable != to_disable: + raise ValueError( + Errors.E992.format( + enable=enable, disable=disable, names=self.pipe_names + ) + ) + disable = to_disable + assert disable is not None + # DisabledPipes will restore the pipes in 'disable' when it's done, so we need to exclude + # those pipes that were already disabled. + disable = [d for d in disable if d not in self._disabled] + return DisabledPipes(self, disable) + + def make_doc(self, text: str) -> Doc: + """Turn a text into a Doc object. + + text (str): The text to process. + RETURNS (Doc): The processed doc. + """ + if len(text) > self.max_length: + raise ValueError( + Errors.E088.format(length=len(text), max_length=self.max_length) + ) + return self.tokenizer(text) + + def _ensure_doc(self, doc_like: Union[str, Doc, bytes]) -> Doc: + """Create a Doc if need be, or raise an error if the input is not + a Doc, string, or a byte array (generated by Doc.to_bytes()).""" + if isinstance(doc_like, Doc): + return doc_like + if isinstance(doc_like, str): + return self.make_doc(doc_like) + if isinstance(doc_like, bytes): + return Doc(self.vocab).from_bytes(doc_like) + raise ValueError(Errors.E1041.format(type=type(doc_like))) + + def _ensure_doc_with_context( + self, doc_like: Union[str, Doc, bytes], context: _AnyContext + ) -> Doc: + """Call _ensure_doc to generate a Doc and set its context object.""" + doc = self._ensure_doc(doc_like) + doc._context = context + return doc + + def update( + self, + examples: Iterable[Example], + _: Optional[Any] = None, + *, + drop: float = 0.0, + sgd: Optional[Optimizer] = None, + losses: Optional[Dict[str, float]] = None, + component_cfg: Optional[Dict[str, Dict[str, Any]]] = None, + exclude: Iterable[str] = SimpleFrozenList(), + annotates: Iterable[str] = SimpleFrozenList(), + ): + """Update the models in the pipeline. + + examples (Iterable[Example]): A batch of examples + _: Should not be set - serves to catch backwards-incompatible scripts. + drop (float): The dropout rate. + sgd (Optimizer): An optimizer. + losses (Dict[str, float]): Dictionary to update with the loss, keyed by + component. + component_cfg (Dict[str, Dict]): Config parameters for specific pipeline + components, keyed by component name. + exclude (Iterable[str]): Names of components that shouldn't be updated. + annotates (Iterable[str]): Names of components that should set + annotations on the predicted examples after updating. + RETURNS (Dict[str, float]): The updated losses dictionary + + DOCS: https://spacy.io/api/language#update + """ + if _ is not None: + raise ValueError(Errors.E989) + if losses is None: + losses = {} + if isinstance(examples, list) and len(examples) == 0: + return losses + validate_examples(examples, "Language.update") + examples = _copy_examples(examples) + if sgd is None: + if self._optimizer is None: + self._optimizer = self.create_optimizer() + sgd = self._optimizer + if component_cfg is None: + component_cfg = {} + pipe_kwargs = {} + for i, (name, proc) in enumerate(self.pipeline): + component_cfg.setdefault(name, {}) + pipe_kwargs[name] = deepcopy(component_cfg[name]) + component_cfg[name].setdefault("drop", drop) + pipe_kwargs[name].setdefault("batch_size", self.batch_size) + for name, proc in self.pipeline: + # ignore statements are used here because mypy ignores hasattr + if name not in exclude and hasattr(proc, "update"): + proc.update(examples, sgd=None, losses=losses, **component_cfg[name]) # type: ignore + if sgd not in (None, False): + if ( + name not in exclude + and isinstance(proc, ty.TrainableComponent) + and proc.is_trainable + and proc.model not in (True, False, None) + ): + proc.finish_update(sgd) + if name in annotates: + for doc, eg in zip( + _pipe( + (eg.predicted for eg in examples), + proc=proc, + name=name, + default_error_handler=self.default_error_handler, + kwargs=pipe_kwargs[name], + ), + examples, + ): + eg.predicted = doc + return _replace_numpy_floats(losses) + + def rehearse( + self, + examples: Iterable[Example], + *, + sgd: Optional[Optimizer] = None, + losses: Optional[Dict[str, float]] = None, + component_cfg: Optional[Dict[str, Dict[str, Any]]] = None, + exclude: Iterable[str] = SimpleFrozenList(), + ) -> Dict[str, float]: + """Make a "rehearsal" update to the models in the pipeline, to prevent + forgetting. Rehearsal updates run an initial copy of the model over some + data, and update the model so its current predictions are more like the + initial ones. This is useful for keeping a pretrained model on-track, + even if you're updating it with a smaller set of examples. + + examples (Iterable[Example]): A batch of `Example` objects. + sgd (Optional[Optimizer]): An optimizer. + component_cfg (Dict[str, Dict]): Config parameters for specific pipeline + components, keyed by component name. + exclude (Iterable[str]): Names of components that shouldn't be updated. + RETURNS (dict): Results from the update. + + EXAMPLE: + >>> raw_text_batches = minibatch(raw_texts) + >>> for labelled_batch in minibatch(examples): + >>> nlp.update(labelled_batch) + >>> raw_batch = [Example.from_dict(nlp.make_doc(text), {}) for text in next(raw_text_batches)] + >>> nlp.rehearse(raw_batch) + + DOCS: https://spacy.io/api/language#rehearse + """ + if losses is None: + losses = {} + if isinstance(examples, list) and len(examples) == 0: + return losses + validate_examples(examples, "Language.rehearse") + if sgd is None: + if self._optimizer is None: + self._optimizer = self.create_optimizer() + sgd = self._optimizer + pipes = list(self.pipeline) + random.shuffle(pipes) + if component_cfg is None: + component_cfg = {} + grads = {} + + def get_grads(key, W, dW): + grads[key] = (W, dW) + return W, dW + + get_grads.learn_rate = sgd.learn_rate # type: ignore[attr-defined, union-attr] + get_grads.b1 = sgd.b1 # type: ignore[attr-defined, union-attr] + get_grads.b2 = sgd.b2 # type: ignore[attr-defined, union-attr] + for name, proc in pipes: + if name in exclude or not hasattr(proc, "rehearse"): + continue + grads = {} + proc.rehearse( # type: ignore[attr-defined] + examples, sgd=get_grads, losses=losses, **component_cfg.get(name, {}) + ) + for key, (W, dW) in grads.items(): + sgd(key, W, dW) # type: ignore[call-arg, misc] + return losses + + def begin_training( + self, + get_examples: Optional[Callable[[], Iterable[Example]]] = None, + *, + sgd: Optional[Optimizer] = None, + ) -> Optimizer: + warnings.warn(Warnings.W089, DeprecationWarning) + return self.initialize(get_examples, sgd=sgd) + + def initialize( + self, + get_examples: Optional[Callable[[], Iterable[Example]]] = None, + *, + sgd: Optional[Optimizer] = None, + ) -> Optimizer: + """Initialize the pipe for training, using data examples if available. + + get_examples (Callable[[], Iterable[Example]]): Optional function that + returns gold-standard Example objects. + sgd (Optional[Optimizer]): An optimizer to use for updates. If not + provided, will be created using the .create_optimizer() method. + RETURNS (thinc.api.Optimizer): The optimizer. + + DOCS: https://spacy.io/api/language#initialize + """ + if get_examples is None: + util.logger.debug( + "No 'get_examples' callback provided to 'Language.initialize', creating dummy examples" + ) + doc = Doc(self.vocab, words=["x", "y", "z"]) + + def get_examples(): + return [Example.from_dict(doc, {})] + + if not hasattr(get_examples, "__call__"): + err = Errors.E930.format( + method="Language.initialize", obj=type(get_examples) + ) + raise TypeError(err) + # Make sure the config is interpolated so we can resolve subsections + config = self.config.interpolate() + # These are the settings provided in the [initialize] block in the config + I = registry.resolve(config["initialize"], schema=ConfigSchemaInit) + before_init = I["before_init"] + if before_init is not None: + before_init(self) + try: + init_vocab( + self, data=I["vocab_data"], lookups=I["lookups"], vectors=I["vectors"] + ) + except IOError: + raise IOError(Errors.E884.format(vectors=I["vectors"])) + if self.vocab.vectors.shape[1] >= 1: + ops = get_current_ops() + self.vocab.vectors.to_ops(ops) + if hasattr(self.tokenizer, "initialize"): + tok_settings = validate_init_settings( + self.tokenizer.initialize, # type: ignore[union-attr] + I["tokenizer"], + section="tokenizer", + name="tokenizer", + ) + self.tokenizer.initialize(get_examples, nlp=self, **tok_settings) # type: ignore[union-attr] + for name, proc in self.pipeline: + if isinstance(proc, ty.InitializableComponent): + p_settings = I["components"].get(name, {}) + p_settings = validate_init_settings( + proc.initialize, p_settings, section="components", name=name + ) + proc.initialize(get_examples, nlp=self, **p_settings) + pretrain_cfg = config.get("pretraining") + if pretrain_cfg: + P = registry.resolve(pretrain_cfg, schema=ConfigSchemaPretrain) + init_tok2vec(self, P, I) + self._link_components() + self._optimizer = sgd + if sgd is not None: + self._optimizer = sgd + elif self._optimizer is None: + self._optimizer = self.create_optimizer() + after_init = I["after_init"] + if after_init is not None: + after_init(self) + return self._optimizer + + def resume_training(self, *, sgd: Optional[Optimizer] = None) -> Optimizer: + """Continue training a pretrained model. + + Create and return an optimizer, and initialize "rehearsal" for any pipeline + component that has a .rehearse() method. Rehearsal is used to prevent + models from "forgetting" their initialized "knowledge". To perform + rehearsal, collect samples of text you want the models to retain performance + on, and call nlp.rehearse() with a batch of Example objects. + + RETURNS (Optimizer): The optimizer. + + DOCS: https://spacy.io/api/language#resume_training + """ + ops = get_current_ops() + if self.vocab.vectors.shape[1] >= 1: + self.vocab.vectors.to_ops(ops) + for name, proc in self.pipeline: + if hasattr(proc, "_rehearsal_model"): + proc._rehearsal_model = deepcopy(proc.model) # type: ignore[attr-defined] + if sgd is not None: + self._optimizer = sgd + elif self._optimizer is None: + self._optimizer = self.create_optimizer() + return self._optimizer + + def set_error_handler( + self, + error_handler: Callable[[str, PipeCallable, List[Doc], Exception], NoReturn], + ): + """Set an error handler object for all the components in the pipeline + that implement a set_error_handler function. + + error_handler (Callable[[str, Callable[[Doc], Doc], List[Doc], Exception], NoReturn]): + Function that deals with a failing batch of documents. This callable + function should take in the component's name, the component itself, + the offending batch of documents, and the exception that was thrown. + DOCS: https://spacy.io/api/language#set_error_handler + """ + self.default_error_handler = error_handler + for name, pipe in self.pipeline: + if hasattr(pipe, "set_error_handler"): + pipe.set_error_handler(error_handler) + + def evaluate( + self, + examples: Iterable[Example], + *, + batch_size: Optional[int] = None, + scorer: Optional[Scorer] = None, + component_cfg: Optional[Dict[str, Dict[str, Any]]] = None, + scorer_cfg: Optional[Dict[str, Any]] = None, + per_component: bool = False, + ) -> Dict[str, Any]: + """Evaluate a model's pipeline components. + + examples (Iterable[Example]): `Example` objects. + batch_size (Optional[int]): Batch size to use. + scorer (Optional[Scorer]): Scorer to use. If not passed in, a new one + will be created. + component_cfg (dict): An optional dictionary with extra keyword + arguments for specific components. + scorer_cfg (dict): An optional dictionary with extra keyword arguments + for the scorer. + per_component (bool): Whether to return the scores keyed by component + name. Defaults to False. + + RETURNS (Scorer): The scorer containing the evaluation results. + + DOCS: https://spacy.io/api/language#evaluate + """ + examples = list(examples) + validate_examples(examples, "Language.evaluate") + examples = _copy_examples(examples) + if batch_size is None: + batch_size = self.batch_size + if component_cfg is None: + component_cfg = {} + if scorer_cfg is None: + scorer_cfg = {} + if scorer is None: + kwargs = dict(scorer_cfg) + kwargs.setdefault("nlp", self) + scorer = Scorer(**kwargs) + # reset annotation in predicted docs and time tokenization + start_time = timer() + # this is purely for timing + for eg in examples: + self.make_doc(eg.reference.text) + # apply all pipeline components + docs = self.pipe( + (eg.predicted for eg in examples), + batch_size=batch_size, + component_cfg=component_cfg, + ) + for eg, doc in zip(examples, docs): + eg.predicted = doc + end_time = timer() + results = scorer.score(examples, per_component=per_component) + n_words = sum(len(eg.predicted) for eg in examples) + results["speed"] = n_words / (end_time - start_time) + return _replace_numpy_floats(results) + + def create_optimizer(self): + """Create an optimizer, usually using the [training.optimizer] config.""" + subconfig = {"optimizer": self.config["training"]["optimizer"]} + return registry.resolve(subconfig)["optimizer"] + + @contextmanager + def use_params(self, params: Optional[dict]): + """Replace weights of models in the pipeline with those provided in the + params dictionary. Can be used as a contextmanager, in which case, + models go back to their original weights after the block. + + params (dict): A dictionary of parameters keyed by model ID. + + EXAMPLE: + >>> with nlp.use_params(optimizer.averages): + >>> nlp.to_disk("/tmp/checkpoint") + + DOCS: https://spacy.io/api/language#use_params + """ + if not params: + yield + else: + contexts = [ + pipe.use_params(params) # type: ignore[attr-defined] + for name, pipe in self.pipeline + if hasattr(pipe, "use_params") and hasattr(pipe, "model") + ] + # TODO: Having trouble with contextlib + # Workaround: these aren't actually context managers atm. + for context in contexts: + try: + next(context) + except StopIteration: + pass + yield + for context in contexts: + try: + next(context) + except StopIteration: + pass + + @overload + def pipe( + self, + texts: Iterable[Union[str, Doc]], + *, + as_tuples: Literal[False] = ..., + batch_size: Optional[int] = ..., + disable: Iterable[str] = ..., + component_cfg: Optional[Dict[str, Dict[str, Any]]] = ..., + n_process: int = ..., + ) -> Iterator[Doc]: ... + + @overload + def pipe( # noqa: F811 + self, + texts: Iterable[Tuple[Union[str, Doc], _AnyContext]], + *, + as_tuples: Literal[True] = ..., + batch_size: Optional[int] = ..., + disable: Iterable[str] = ..., + component_cfg: Optional[Dict[str, Dict[str, Any]]] = ..., + n_process: int = ..., + ) -> Iterator[Tuple[Doc, _AnyContext]]: ... + + def pipe( # noqa: F811 + self, + texts: Union[ + Iterable[Union[str, Doc]], Iterable[Tuple[Union[str, Doc], _AnyContext]] + ], + *, + as_tuples: bool = False, + batch_size: Optional[int] = None, + disable: Iterable[str] = SimpleFrozenList(), + component_cfg: Optional[Dict[str, Dict[str, Any]]] = None, + n_process: int = 1, + ) -> Union[Iterator[Doc], Iterator[Tuple[Doc, _AnyContext]]]: + """Process texts as a stream, and yield `Doc` objects in order. + + texts (Iterable[Union[str, Doc]]): A sequence of texts or docs to + process. + as_tuples (bool): If set to True, inputs should be a sequence of + (text, context) tuples. Output will then be a sequence of + (doc, context) tuples. Defaults to False. + batch_size (Optional[int]): The number of texts to buffer. + disable (List[str]): Names of the pipeline components to disable. + component_cfg (Dict[str, Dict]): An optional dictionary with extra keyword + arguments for specific components. + n_process (int): Number of processors to process texts. If -1, set `multiprocessing.cpu_count()`. + YIELDS (Doc): Documents in the order of the original text. + + DOCS: https://spacy.io/api/language#pipe + """ + if as_tuples: + texts = cast(Iterable[Tuple[Union[str, Doc], _AnyContext]], texts) + docs_with_contexts = ( + self._ensure_doc_with_context(text, context) for text, context in texts + ) + docs = self.pipe( + docs_with_contexts, + batch_size=batch_size, + disable=disable, + n_process=n_process, + component_cfg=component_cfg, + ) + for doc in docs: + context = doc._context + doc._context = None + yield (doc, context) + return + + texts = cast(Iterable[Union[str, Doc]], texts) + + # Set argument defaults + if n_process == -1: + n_process = mp.cpu_count() + if component_cfg is None: + component_cfg = {} + if batch_size is None: + batch_size = self.batch_size + + pipes = ( + [] + ) # contains functools.partial objects to easily create multiprocess worker. + for name, proc in self.pipeline: + if name in disable: + continue + kwargs = component_cfg.get(name, {}) + # Allow component_cfg to overwrite the top-level kwargs. + kwargs.setdefault("batch_size", batch_size) + f = functools.partial( + _pipe, + proc=proc, + name=name, + kwargs=kwargs, + default_error_handler=self.default_error_handler, + ) + pipes.append(f) + + if n_process != 1: + if self._has_gpu_model(disable): + warnings.warn(Warnings.W114) + + docs = self._multiprocessing_pipe(texts, pipes, n_process, batch_size) + else: + # if n_process == 1, no processes are forked. + docs = (self._ensure_doc(text) for text in texts) + for pipe in pipes: + docs = pipe(docs) + for doc in docs: + yield doc + + def _has_gpu_model(self, disable: Iterable[str]): + for name, proc in self.pipeline: + is_trainable = hasattr(proc, "is_trainable") and proc.is_trainable # type: ignore + if name in disable or not is_trainable: + continue + + if hasattr(proc, "model") and hasattr(proc.model, "ops") and isinstance(proc.model.ops, CupyOps): # type: ignore + return True + + return False + + def _multiprocessing_pipe( + self, + texts: Iterable[Union[str, Doc]], + pipes: Iterable[Callable[..., Iterator[Doc]]], + n_process: int, + batch_size: int, + ) -> Iterator[Doc]: + def prepare_input( + texts: Iterable[Union[str, Doc]], + ) -> Iterable[Tuple[Union[str, bytes], _AnyContext]]: + # Serialize Doc inputs to bytes to avoid incurring pickling + # overhead when they are passed to child processes. Also yield + # any context objects they might have separately (as they are not serialized). + for doc_like in texts: + if isinstance(doc_like, Doc): + yield (doc_like.to_bytes(), cast(_AnyContext, doc_like._context)) + else: + yield (doc_like, cast(_AnyContext, None)) + + serialized_texts_with_ctx = prepare_input(texts) # type: ignore + # raw_texts is used later to stop iteration. + texts, raw_texts = itertools.tee(serialized_texts_with_ctx) # type: ignore + # for sending texts to worker + texts_q: List[mp.Queue] = [mp.Queue() for _ in range(n_process)] + # for receiving byte-encoded docs from worker + bytedocs_recv_ch, bytedocs_send_ch = zip( + *[mp.Pipe(False) for _ in range(n_process)] + ) + + batch_texts = util.minibatch(texts, batch_size) + # Sender sends texts to the workers. + # This is necessary to properly handle infinite length of texts. + # (In this case, all data cannot be sent to the workers at once) + sender = _Sender(batch_texts, texts_q, chunk_size=n_process) + # send twice to make process busy + sender.send() + sender.send() + + procs = [ + mp.Process( + target=_apply_pipes, + args=( + self._ensure_doc_with_context, + pipes, + rch, + sch, + Underscore.get_state(), + ), + ) + for rch, sch in zip(texts_q, bytedocs_send_ch) + ] + for proc in procs: + proc.start() + + # Close writing-end of channels. This is needed to avoid that reading + # from the channel blocks indefinitely when the worker closes the + # channel. + for tx in bytedocs_send_ch: + tx.close() + + # Cycle channels not to break the order of docs. + # The received object is a batch of byte-encoded docs, so flatten them with chain.from_iterable. + byte_tuples = chain.from_iterable( + recv.recv() for recv in cycle(bytedocs_recv_ch) + ) + try: + for i, (_, (byte_doc, context, byte_error)) in enumerate( + zip(raw_texts, byte_tuples), 1 + ): + if byte_doc is not None: + doc = Doc(self.vocab).from_bytes(byte_doc) + doc._context = context + yield doc + elif byte_error is not None: + error = srsly.msgpack_loads(byte_error) + self.default_error_handler( + None, None, None, ValueError(Errors.E871.format(error=error)) + ) + if i % batch_size == 0: + # tell `sender` that one batch was consumed. + sender.step() + finally: + # If we are stopping in an orderly fashion, the workers' queues + # are empty. Put the sentinel in their queues to signal that work + # is done, so that they can exit gracefully. + for q in texts_q: + q.put(_WORK_DONE_SENTINEL) + q.close() + + # Otherwise, we are stopping because the error handler raised an + # exception. The sentinel will be last to go out of the queue. + # To avoid doing unnecessary work or hanging on platforms that + # block on sending (Windows), we'll close our end of the channel. + # This signals to the worker that it can exit the next time it + # attempts to send data down the channel. + for r in bytedocs_recv_ch: + r.close() + + for proc in procs: + proc.join() + + if not all(proc.exitcode == 0 for proc in procs): + warnings.warn(Warnings.W127) + + def _link_components(self) -> None: + """Register 'listeners' within pipeline components, to allow them to + effectively share weights. + """ + # I had thought, "Why do we do this inside the Language object? Shouldn't + # it be the tok2vec/transformer/etc's job? + # The problem is we need to do it during deserialization...And the + # components don't receive the pipeline then. So this does have to be + # here :( + # First, fix up all the internal component names in case they have + # gotten out of sync due to sourcing components from different + # pipelines, since find_listeners uses proc2.name for the listener + # map. + for name, proc in self.pipeline: + if hasattr(proc, "name"): + proc.name = name + for i, (name1, proc1) in enumerate(self.pipeline): + if isinstance(proc1, ty.ListenedToComponent): + proc1.listener_map = {} + for name2, proc2 in self.pipeline[i + 1 :]: + proc1.find_listeners(proc2) + + @classmethod + def from_config( + cls, + config: Union[Dict[str, Any], Config] = {}, + *, + vocab: Union[Vocab, bool] = True, + disable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + enable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + exclude: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + meta: Dict[str, Any] = SimpleFrozenDict(), + auto_fill: bool = True, + validate: bool = True, + ) -> "Language": + """Create the nlp object from a loaded config. Will set up the tokenizer + and language data, add pipeline components etc. If no config is provided, + the default config of the given language is used. + + config (Dict[str, Any] / Config): The loaded config. + vocab (Vocab): A Vocab object. If True, a vocab is created. + disable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to disable. + Disabled pipes will be loaded but they won't be run unless you + explicitly enable them by calling nlp.enable_pipe. + enable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to enable. All other + pipes will be disabled (and can be enabled using `nlp.enable_pipe`). + exclude (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to exclude. + Excluded components won't be loaded. + meta (Dict[str, Any]): Meta overrides for nlp.meta. + auto_fill (bool): Automatically fill in missing values in config based + on defaults and function argument annotations. + validate (bool): Validate the component config and arguments against + the types expected by the factory. + RETURNS (Language): The initialized Language class. + + DOCS: https://spacy.io/api/language#from_config + """ + if auto_fill: + config = Config( + cls.default_config, section_order=CONFIG_SECTION_ORDER + ).merge(config) + if "nlp" not in config: + raise ValueError(Errors.E985.format(config=config)) + # fill in [nlp.vectors] if not present (as a narrower alternative to + # auto-filling [nlp] from the default config) + if "vectors" not in config["nlp"]: + config["nlp"]["vectors"] = {"@vectors": "spacy.Vectors.v1"} + config_lang = config["nlp"].get("lang") + if config_lang is not None and config_lang != cls.lang: + raise ValueError( + Errors.E958.format( + bad_lang_code=config["nlp"]["lang"], + lang_code=cls.lang, + lang=util.get_object_name(cls), + ) + ) + config["nlp"]["lang"] = cls.lang + # This isn't very elegant, but we remove the [components] block here to prevent + # it from getting resolved (causes problems because we expect to pass in + # the nlp and name args for each component). If we're auto-filling, we're + # using the nlp.config with all defaults. + config = util.copy_config(config) + orig_pipeline = config.pop("components", {}) + orig_pretraining = config.pop("pretraining", None) + config["components"] = {} + if auto_fill: + filled = registry.fill(config, validate=validate, schema=ConfigSchema) + else: + filled = config + filled["components"] = orig_pipeline + config["components"] = orig_pipeline + if orig_pretraining is not None: + filled["pretraining"] = orig_pretraining + config["pretraining"] = orig_pretraining + resolved_nlp = registry.resolve( + filled["nlp"], validate=validate, schema=ConfigSchemaNlp + ) + create_tokenizer = resolved_nlp["tokenizer"] + create_vectors = resolved_nlp["vectors"] + before_creation = resolved_nlp["before_creation"] + after_creation = resolved_nlp["after_creation"] + after_pipeline_creation = resolved_nlp["after_pipeline_creation"] + lang_cls = cls + if before_creation is not None: + lang_cls = before_creation(cls) + if ( + not isinstance(lang_cls, type) + or not issubclass(lang_cls, cls) + or lang_cls is not cls + ): + raise ValueError(Errors.E943.format(value=type(lang_cls))) + + # Warn about require_gpu usage in jupyter notebook + warn_if_jupyter_cupy() + + # Note that we don't load vectors here, instead they get loaded explicitly + # inside stuff like the spacy train function. If we loaded them here, + # then we would load them twice at runtime: once when we make from config, + # and then again when we load from disk. + nlp = lang_cls( + vocab=vocab, + create_tokenizer=create_tokenizer, + create_vectors=create_vectors, + meta=meta, + ) + if after_creation is not None: + nlp = after_creation(nlp) + if not isinstance(nlp, cls): + raise ValueError(Errors.E942.format(name="creation", value=type(nlp))) + # To create the components we need to use the final interpolated config + # so all values are available (if component configs use variables). + # Later we replace the component config with the raw config again. + interpolated = filled.interpolate() if not filled.is_interpolated else filled + pipeline = interpolated.get("components", {}) + # If components are loaded from a source (existing models), we cache + # them here so they're only loaded once + source_nlps = {} + source_nlp_vectors_hashes = {} + vocab_b = None + for pipe_name in config["nlp"]["pipeline"]: + if pipe_name not in pipeline: + opts = ", ".join(pipeline.keys()) + raise ValueError(Errors.E956.format(name=pipe_name, opts=opts)) + pipe_cfg = util.copy_config(pipeline[pipe_name]) + raw_config = Config(filled["components"][pipe_name]) + if pipe_name not in exclude: + if "factory" not in pipe_cfg and "source" not in pipe_cfg: + err = Errors.E984.format(name=pipe_name, config=pipe_cfg) + raise ValueError(err) + if "factory" in pipe_cfg: + factory = pipe_cfg.pop("factory") + # The pipe name (key in the config) here is the unique name + # of the component, not necessarily the factory + nlp.add_pipe( + factory, + name=pipe_name, + config=pipe_cfg, + validate=validate, + raw_config=raw_config, + ) + else: + assert "source" in pipe_cfg + # We need the sourced components to reference the same + # vocab without modifying the current vocab state **AND** + # we still want to load the source model vectors to perform + # the vectors check. Since the source vectors clobber the + # current ones, we save the original vocab state and + # restore after this loop. Existing strings are preserved + # during deserialization, so they do not need any + # additional handling. + if vocab_b is None: + vocab_b = nlp.vocab.to_bytes(exclude=["lookups", "strings"]) + model = pipe_cfg["source"] + if model not in source_nlps: + # Load with the same vocab, adding any strings + source_nlps[model] = util.load_model( + model, vocab=nlp.vocab, exclude=["lookups"] + ) + source_name = pipe_cfg.get("component", pipe_name) + listeners_replaced = False + if "replace_listeners" in pipe_cfg: + # Make sure that the listened-to component has the + # state of the source pipeline listener map so that the + # replace_listeners method below works as intended. + source_nlps[model]._link_components() + for name, proc in source_nlps[model].pipeline: + if source_name in getattr(proc, "listening_components", []): + source_nlps[model].replace_listeners( + name, source_name, pipe_cfg["replace_listeners"] + ) + listeners_replaced = True + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", message="\\[W113\\]") + nlp.add_pipe( + source_name, source=source_nlps[model], name=pipe_name + ) + # At this point after nlp.add_pipe, the listener map + # corresponds to the new pipeline. + if model not in source_nlp_vectors_hashes: + source_nlp_vectors_hashes[model] = hash( + source_nlps[model].vocab.vectors.to_bytes( + exclude=["strings"] + ) + ) + if "_sourced_vectors_hashes" not in nlp.meta: + nlp.meta["_sourced_vectors_hashes"] = {} + nlp.meta["_sourced_vectors_hashes"][pipe_name] = ( + source_nlp_vectors_hashes[model] + ) + # Delete from cache if listeners were replaced + if listeners_replaced: + del source_nlps[model] + # Restore the original vocab after sourcing if necessary + if vocab_b is not None: + nlp.vocab.from_bytes(vocab_b) + + # Resolve disabled/enabled settings. + if isinstance(disable, str): + disable = [disable] + if isinstance(enable, str): + enable = [enable] + if isinstance(exclude, str): + exclude = [exclude] + + # `enable` should not be merged with `enabled` (the opposite is true for `disable`/`disabled`). If the config + # specifies values for `enabled` not included in `enable`, emit warning. + if id(enable) != id(_DEFAULT_EMPTY_PIPES): + enabled = config["nlp"].get("enabled", []) + if len(enabled) and not set(enabled).issubset(enable): + warnings.warn( + Warnings.W123.format( + enable=enable, + enabled=enabled, + ) + ) + + # Ensure sets of disabled/enabled pipe names are not contradictory. + disabled_pipes = cls._resolve_component_status( + list({*disable, *config["nlp"].get("disabled", [])}), + enable, + config["nlp"]["pipeline"], + ) + nlp._disabled = set(p for p in disabled_pipes if p not in exclude) + + nlp.batch_size = config["nlp"]["batch_size"] + nlp.config = filled if auto_fill else config + if after_pipeline_creation is not None: + nlp = after_pipeline_creation(nlp) + if not isinstance(nlp, cls): + raise ValueError( + Errors.E942.format(name="pipeline_creation", value=type(nlp)) + ) + return nlp + + def replace_listeners( + self, + tok2vec_name: str, + pipe_name: str, + listeners: Iterable[str], + ) -> None: + """Find listener layers (connecting to a token-to-vector embedding + component) of a given pipeline component model and replace + them with a standalone copy of the token-to-vector layer. This can be + useful when training a pipeline with components sourced from an existing + pipeline: if multiple components (e.g. tagger, parser, NER) listen to + the same tok2vec component, but some of them are frozen and not updated, + their performance may degrade significantly as the tok2vec component is + updated with new data. To prevent this, listeners can be replaced with + a standalone tok2vec layer that is owned by the component and doesn't + change if the component isn't updated. + + tok2vec_name (str): Name of the token-to-vector component, typically + "tok2vec" or "transformer". + pipe_name (str): Name of pipeline component to replace listeners for. + listeners (Iterable[str]): The paths to the listeners, relative to the + component config, e.g. ["model.tok2vec"]. Typically, implementations + will only connect to one tok2vec component, [model.tok2vec], but in + theory, custom models can use multiple listeners. The value here can + either be an empty list to not replace any listeners, or a complete + (!) list of the paths to all listener layers used by the model. + + DOCS: https://spacy.io/api/language#replace_listeners + """ + if tok2vec_name not in self.pipe_names: + err = Errors.E889.format( + tok2vec=tok2vec_name, + name=pipe_name, + unknown=tok2vec_name, + opts=", ".join(self.pipe_names), + ) + raise ValueError(err) + if pipe_name not in self.pipe_names: + err = Errors.E889.format( + tok2vec=tok2vec_name, + name=pipe_name, + unknown=pipe_name, + opts=", ".join(self.pipe_names), + ) + raise ValueError(err) + tok2vec = self.get_pipe(tok2vec_name) + tok2vec_cfg = self.get_pipe_config(tok2vec_name) + if not isinstance(tok2vec, ty.ListenedToComponent): + raise ValueError(Errors.E888.format(name=tok2vec_name, pipe=type(tok2vec))) + tok2vec_model = tok2vec.model + pipe_listeners = tok2vec.listener_map.get(pipe_name, []) + pipe = self.get_pipe(pipe_name) + pipe_cfg = self._pipe_configs[pipe_name] + if listeners: + util.logger.debug("Replacing listeners of component '%s'", pipe_name) + if len(list(listeners)) != len(pipe_listeners): + # The number of listeners defined in the component model doesn't + # match the listeners to replace, so we won't be able to update + # the nodes and generate a matching config + err = Errors.E887.format( + name=pipe_name, + tok2vec=tok2vec_name, + paths=listeners, + n_listeners=len(pipe_listeners), + ) + raise ValueError(err) + # Update the config accordingly by copying the tok2vec model to all + # sections defined in the listener paths + for listener_path in listeners: + # Check if the path actually exists in the config + try: + util.dot_to_object(pipe_cfg, listener_path) + except KeyError: + err = Errors.E886.format( + name=pipe_name, tok2vec=tok2vec_name, path=listener_path + ) + raise ValueError(err) + new_config = tok2vec_cfg["model"] + if "replace_listener_cfg" in tok2vec_model.attrs: + replace_func = tok2vec_model.attrs["replace_listener_cfg"] + new_config = replace_func( + tok2vec_cfg["model"], pipe_cfg["model"]["tok2vec"] + ) + util.set_dot_to_object(pipe_cfg, listener_path, new_config) + # Go over the listener layers and replace them + for listener in pipe_listeners: + new_model = tok2vec_model.copy() + replace_listener_func = tok2vec_model.attrs.get("replace_listener") + if replace_listener_func is not None: + # Pass the extra args to the callback without breaking compatibility with + # old library versions that only expect a single parameter. + num_params = len( + inspect.signature(replace_listener_func).parameters + ) + if num_params == 1: + new_model = replace_listener_func(new_model) + elif num_params == 3: + new_model = replace_listener_func(new_model, listener, tok2vec) + else: + raise ValueError(Errors.E1055.format(num_params=num_params)) + + util.replace_model_node(pipe.model, listener, new_model) # type: ignore[attr-defined] + tok2vec.remove_listener(listener, pipe_name) + + @contextmanager + def memory_zone(self, mem: Optional[Pool] = None) -> Iterator[Pool]: + """Begin a block where all resources allocated during the block will + be freed at the end of it. If a resources was created within the + memory zone block, accessing it outside the block is invalid. + Behaviour of this invalid access is undefined. Memory zones should + not be nested. + + The memory zone is helpful for services that need to process large + volumes of text with a defined memory budget. + + Example + ------- + >>> with nlp.memory_zone(): + ... for doc in nlp.pipe(texts): + ... process_my_doc(doc) + >>> # use_doc(doc) <-- Invalid: doc was allocated in the memory zone + """ + if mem is None: + mem = Pool() + # The ExitStack allows programmatic nested context managers. + # We don't know how many we need, so it would be awkward to have + # them as nested blocks. + with ExitStack() as stack: + contexts = [stack.enter_context(self.vocab.memory_zone(mem))] + if hasattr(self.tokenizer, "memory_zone"): + contexts.append(stack.enter_context(self.tokenizer.memory_zone(mem))) + for _, pipe in self.pipeline: + if hasattr(pipe, "memory_zone"): + contexts.append(stack.enter_context(pipe.memory_zone(mem))) + yield mem + + def to_disk( + self, path: Union[str, Path], *, exclude: Iterable[str] = SimpleFrozenList() + ) -> None: + """Save the current state to a directory. If a model is loaded, this + will include the model. + + path (str / Path): Path to a directory, which will be created if + it doesn't exist. + exclude (Iterable[str]): Names of components or serialization fields to exclude. + + DOCS: https://spacy.io/api/language#to_disk + """ + path = util.ensure_path(path) + serializers = {} + serializers["tokenizer"] = lambda p: self.tokenizer.to_disk( # type: ignore[union-attr] + p, exclude=["vocab"] + ) + serializers["meta.json"] = lambda p: srsly.write_json( + p, _replace_numpy_floats(self.meta) + ) + serializers["config.cfg"] = lambda p: self.config.to_disk(p) + for name, proc in self._components: + if name in exclude: + continue + if not hasattr(proc, "to_disk"): + continue + serializers[name] = lambda p, proc=proc: proc.to_disk(p, exclude=["vocab"]) # type: ignore[misc] + serializers["vocab"] = lambda p: self.vocab.to_disk(p, exclude=exclude) + util.to_disk(path, serializers, exclude) + + @staticmethod + def _resolve_component_status( + disable: Union[str, Iterable[str]], + enable: Union[str, Iterable[str]], + pipe_names: Iterable[str], + ) -> Tuple[str, ...]: + """Derives whether (1) `disable` and `enable` values are consistent and (2) + resolves those to a single set of disabled components. Raises an error in + case of inconsistency. + + disable (Union[str, Iterable[str]]): Name(s) of component(s) or serialization fields to disable. + enable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to enable. + pipe_names (Iterable[str]): Names of all pipeline components. + + RETURNS (Tuple[str, ...]): Names of components to exclude from pipeline w.r.t. + specified includes and excludes. + """ + + if isinstance(disable, str): + disable = [disable] + to_disable = disable + + if enable: + if isinstance(enable, str): + enable = [enable] + to_disable = { + *[pipe_name for pipe_name in pipe_names if pipe_name not in enable], + *disable, + } + # If any pipe to be enabled is in to_disable, the specification is inconsistent. + if len(set(enable) & to_disable): + raise ValueError(Errors.E1042.format(enable=enable, disable=disable)) + + return tuple(to_disable) + + def from_disk( + self, + path: Union[str, Path], + *, + exclude: Iterable[str] = SimpleFrozenList(), + overrides: Dict[str, Any] = SimpleFrozenDict(), + ) -> "Language": + """Loads state from a directory. Modifies the object in place and + returns it. If the saved `Language` object contains a model, the + model will be loaded. + + path (str / Path): A path to a directory. + exclude (Iterable[str]): Names of components or serialization fields to exclude. + RETURNS (Language): The modified `Language` object. + + DOCS: https://spacy.io/api/language#from_disk + """ + + def deserialize_meta(path: Path) -> None: + if path.exists(): + data = srsly.read_json(path) + self.meta.update(data) + # self.meta always overrides meta["vectors"] with the metadata + # from self.vocab.vectors, so set the name directly + self.vocab.vectors.name = data.get("vectors", {}).get("name") + + def deserialize_vocab(path: Path) -> None: + if path.exists(): + self.vocab.from_disk(path, exclude=exclude) + + path = util.ensure_path(path) + deserializers = {} + if Path(path / "config.cfg").exists(): # type: ignore[operator] + deserializers["config.cfg"] = lambda p: self.config.from_disk( + p, interpolate=False, overrides=overrides + ) + deserializers["meta.json"] = deserialize_meta # type: ignore[assignment] + deserializers["vocab"] = deserialize_vocab # type: ignore[assignment] + deserializers["tokenizer"] = lambda p: self.tokenizer.from_disk( # type: ignore[union-attr] + p, exclude=["vocab"] + ) + for name, proc in self._components: + if name in exclude: + continue + if not hasattr(proc, "from_disk"): + continue + deserializers[name] = lambda p, proc=proc: proc.from_disk( # type: ignore[misc] + p, exclude=["vocab"] + ) + if not (path / "vocab").exists() and "vocab" not in exclude: # type: ignore[operator] + # Convert to list here in case exclude is (default) tuple + exclude = list(exclude) + ["vocab"] + util.from_disk(path, deserializers, exclude) # type: ignore[arg-type] + self._path = path # type: ignore[assignment] + self._link_components() + return self + + def to_bytes(self, *, exclude: Iterable[str] = SimpleFrozenList()) -> bytes: + """Serialize the current state to a binary string. + + exclude (Iterable[str]): Names of components or serialization fields to exclude. + RETURNS (bytes): The serialized form of the `Language` object. + + DOCS: https://spacy.io/api/language#to_bytes + """ + serializers: Dict[str, Callable[[], bytes]] = {} + serializers["vocab"] = lambda: self.vocab.to_bytes(exclude=exclude) + serializers["tokenizer"] = lambda: self.tokenizer.to_bytes(exclude=["vocab"]) # type: ignore[union-attr] + serializers["meta.json"] = lambda: srsly.json_dumps( + _replace_numpy_floats(self.meta) + ) + serializers["config.cfg"] = lambda: self.config.to_bytes() + for name, proc in self._components: + if name in exclude: + continue + if not hasattr(proc, "to_bytes"): + continue + serializers[name] = lambda proc=proc: proc.to_bytes(exclude=["vocab"]) # type: ignore[misc] + return util.to_bytes(serializers, exclude) + + def from_bytes( + self, bytes_data: bytes, *, exclude: Iterable[str] = SimpleFrozenList() + ) -> "Language": + """Load state from a binary string. + + bytes_data (bytes): The data to load from. + exclude (Iterable[str]): Names of components or serialization fields to exclude. + RETURNS (Language): The `Language` object. + + DOCS: https://spacy.io/api/language#from_bytes + """ + + def deserialize_meta(b): + data = srsly.json_loads(b) + self.meta.update(data) + # self.meta always overrides meta["vectors"] with the metadata + # from self.vocab.vectors, so set the name directly + self.vocab.vectors.name = data.get("vectors", {}).get("name") + + deserializers: Dict[str, Callable[[bytes], Any]] = {} + deserializers["config.cfg"] = lambda b: self.config.from_bytes( + b, interpolate=False + ) + deserializers["meta.json"] = deserialize_meta + deserializers["vocab"] = lambda b: self.vocab.from_bytes(b, exclude=exclude) + deserializers["tokenizer"] = lambda b: self.tokenizer.from_bytes( # type: ignore[union-attr] + b, exclude=["vocab"] + ) + for name, proc in self._components: + if name in exclude: + continue + if not hasattr(proc, "from_bytes"): + continue + deserializers[name] = lambda b, proc=proc: proc.from_bytes( # type: ignore[misc] + b, exclude=["vocab"] + ) + util.from_bytes(bytes_data, deserializers, exclude) + self._link_components() + return self + + +def _replace_numpy_floats(meta_dict: dict) -> dict: + return convert_recursive( + lambda v: isinstance(v, numpy.floating), lambda v: float(v), dict(meta_dict) + ) + + +@dataclass +class FactoryMeta: + """Dataclass containing information about a component and its defaults + provided by the @Language.component or @Language.factory decorator. It's + created whenever a component is defined and stored on the Language class for + each component instance and factory instance. + """ + + factory: str + default_config: Optional[Dict[str, Any]] = None # noqa: E704 + assigns: Iterable[str] = tuple() + requires: Iterable[str] = tuple() + retokenizes: bool = False + scores: Iterable[str] = tuple() + default_score_weights: Optional[Dict[str, Optional[float]]] = None # noqa: E704 + + +class DisabledPipes(list): + """Manager for temporary pipeline disabling.""" + + def __init__(self, nlp: Language, names: List[str]) -> None: + self.nlp = nlp + self.names = names + for name in self.names: + self.nlp.disable_pipe(name) + list.__init__(self) + self.extend(self.names) + + def __enter__(self): + return self + + def __exit__(self, *args): + self.restore() + + def restore(self) -> None: + """Restore the pipeline to its state when DisabledPipes was created.""" + for name in self.names: + if name not in self.nlp.component_names: + raise ValueError(Errors.E008.format(name=name)) + self.nlp.enable_pipe(name) + self[:] = [] + + +def _copy_examples(examples: Iterable[Example]) -> List[Example]: + """Make a copy of a batch of examples, copying the predicted Doc as well. + This is used in contexts where we need to take ownership of the examples + so that they can be mutated, for instance during Language.evaluate and + Language.update. + """ + return [Example(eg.x.copy(), eg.y) for eg in examples] + + +def _apply_pipes( + ensure_doc: Callable[[Union[str, Doc, bytes], _AnyContext], Doc], + pipes: Iterable[Callable[..., Iterator[Doc]]], + receiver, + sender, + underscore_state: Tuple[dict, dict, dict], +) -> None: + """Worker for Language.pipe + + ensure_doc (Callable[[Union[str, Doc]], Doc]): Function to create Doc from text + or raise an error if the input is neither a Doc nor a string. + pipes (Iterable[Pipe]): The components to apply. + receiver (multiprocessing.Connection): Pipe to receive text. Usually + created by `multiprocessing.Pipe()` + sender (multiprocessing.Connection): Pipe to send doc. Usually created by + `multiprocessing.Pipe()` + underscore_state (Tuple[dict, dict, dict]): The data in the Underscore class + of the parent. + """ + Underscore.load_state(underscore_state) + while True: + try: + texts_with_ctx = receiver.get() + + # Stop working if we encounter the end-of-work sentinel. + if isinstance(texts_with_ctx, _WorkDoneSentinel): + sender.close() + receiver.close() + return + + docs = ( + ensure_doc(doc_like, context) for doc_like, context in texts_with_ctx + ) + for pipe in pipes: + docs = pipe(docs) # type: ignore[arg-type, assignment] + # Connection does not accept unpickable objects, so send list. + byte_docs = [(doc.to_bytes(), doc._context, None) for doc in docs] + padding = [(None, None, None)] * (len(texts_with_ctx) - len(byte_docs)) + data: Sequence[Tuple[Optional[bytes], Optional[Any], Optional[bytes]]] = ( + byte_docs + padding # type: ignore[operator] + ) + except Exception: + error_msg = [(None, None, srsly.msgpack_dumps(traceback.format_exc()))] + padding = [(None, None, None)] * (len(texts_with_ctx) - 1) + data = error_msg + padding + + try: + sender.send(data) + except BrokenPipeError: + # Parent has closed the pipe prematurely. This happens when a + # worker encounters an error and the error handler is set to + # stop processing. + sender.close() + receiver.close() + return + + +class _Sender: + """Util for sending data to multiprocessing workers in Language.pipe""" + + def __init__( + self, data: Iterable[Any], queues: List[mp.Queue], chunk_size: int + ) -> None: + self.data = iter(data) + self.queues = iter(cycle(queues)) + self.chunk_size = chunk_size + self.count = 0 + + def send(self) -> None: + """Send chunk_size items from self.data to channels.""" + for item, q in itertools.islice( + zip(self.data, cycle(self.queues)), self.chunk_size + ): + # cycle channels so that distribute the texts evenly + q.put(item) + + def step(self) -> None: + """Tell sender that comsumed one item. Data is sent to the workers after + every chunk_size calls. + """ + self.count += 1 + if self.count >= self.chunk_size: + self.count = 0 + self.send() + + +class _WorkDoneSentinel: + pass + + +_WORK_DONE_SENTINEL = _WorkDoneSentinel() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lexeme.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lexeme.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ff18ed74a5e02451046732fabf4aa985d3e67b75 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lexeme.cpp @@ -0,0 +1,24415 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayscalars.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarraytypes.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ufuncobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include\\Python.h" + ], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.lexeme", + "sources": [ + "spacy/lexeme.pyx" + ] + }, + "module_name": "spacy.lexeme" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +/* InitLimitedAPI */ +#if defined(Py_LIMITED_API) + #if !defined(CYTHON_LIMITED_API) + #define CYTHON_LIMITED_API 1 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef _MSC_VER + #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") + #else + #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. + #endif +#endif + +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x03080000 + #error Cython requires Python 3.8+. +#else +#define __PYX_ABI_VERSION "3_2_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* CModulePreamble */ +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#define __PYX_COMMA , +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) + #endif + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 1 + #endif + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #ifdef Py_GIL_DISABLED + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 + #else + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #endif + #if PY_VERSION_HEX < 0x030A0000 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #elif !defined(CYTHON_USE_TYPE_SLOTS) + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLIST_INTERNALS) + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #elif !defined(CYTHON_FAST_GIL) + #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #ifndef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif + #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work + #elif !defined(CYTHON_IMMORTAL_CONSTANTS) + #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif +#endif +#ifndef CYTHON_COMPRESS_STRINGS + #define CYTHON_COMPRESS_STRINGS 1 +#endif +#ifndef CYTHON_FAST_PYCCALL +#define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL +#endif +#ifndef CYTHON_VECTORCALL +#if CYTHON_COMPILING_IN_LIMITED_API +#define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) +#else +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) +#endif +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#include +typedef uintptr_t __pyx_uintptr_t; +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif +#ifndef Py_UNREACHABLE + #define Py_UNREACHABLE() assert(0); abort() +#endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* PythonCompatibility */ +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#define __Pyx_BUILTIN_MODULE_NAME "builtins" +#define __Pyx_DefaultClassType PyType_Type +#if CYTHON_COMPILING_IN_LIMITED_API + #ifndef CO_OPTIMIZED + static int CO_OPTIMIZED; + #endif + #ifndef CO_NEWLOCALS + static int CO_NEWLOCALS; + #endif + #ifndef CO_VARARGS + static int CO_VARARGS; + #endif + #ifndef CO_VARKEYWORDS + static int CO_VARKEYWORDS; + #endif + #ifndef CO_ASYNC_GENERATOR + static int CO_ASYNC_GENERATOR; + #endif + #ifndef CO_GENERATOR + static int CO_GENERATOR; + #endif + #ifndef CO_COROUTINE + static int CO_COROUTINE; + #endif +#else + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 + #endif +#endif +static int __Pyx_init_co_variables(void); +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif +#ifndef Py_TPFLAGS_IMMUTABLETYPE + #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) +#endif +#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION + #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) +#endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#ifndef METH_FASTCALL + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #if PY_VERSION_HEX >= 0x030d00A4 + # define __Pyx_PyCFunctionFast PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords + #else + # define __Pyx_PyCFunctionFast _PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords + #endif +#endif +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX >= 0x030900B1 +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) +#else +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) +#endif +#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) +#elif !CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) +static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { + return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; +} +#endif +static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; +#else + return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +#endif +} +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) +#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) +#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) +#elif CYTHON_COMPILING_IN_GRAAL + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#endif +#if CYTHON_USE_MODULE_STATE +static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) +#else +#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) +#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) +#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) + #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) + #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ + ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ + (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ + __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) + #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) + #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) +#endif +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) +#endif +#define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) +#if CYTHON_USE_TYPE_SPECS +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE((PyObject*)obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#else + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #else + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #endif +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif +#endif +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#elif CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) +#endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif +enum __Pyx_ReferenceSharing { + __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check + __Pyx_ReferenceSharing_OwnStrongReference, + __Pyx_ReferenceSharing_FunctionArgument, + __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar +}; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ + (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ + (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ + (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) +#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) +#else +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) +#endif +#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) + #else + #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) + #endif +#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) + #endif +#else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) +#endif +#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ + __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) +#else + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) +#endif +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyObject_GetItem(dict, key); + if (*result == NULL) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + return 0; + } + return -1; + } + return 1; +} +#else +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyDict_GetItemWithError(dict, key); + if (*result == NULL) { + return PyErr_Occurred() ? -1 : 0; + } + Py_INCREF(*result); + return 1; +} +#endif +#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST + #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) +#else + #define __Pyx_VISIT_CONST(obj) +#endif +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) +#else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) +#endif +#if CYTHON_ASSUME_SAFE_SIZE + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) +#else + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) +#endif +#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t +#define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t +#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 + #define __Pyx_PySendResult PySendResult +#else + typedef enum { + PYGEN_RETURN = 0, + PYGEN_ERROR = -1, + PYGEN_NEXT = 1, + } __Pyx_PySendResult; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 + typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); +#else + #define __Pyx_pyiter_sendfunc sendfunc +#endif +#if !CYTHON_USE_AM_SEND +#define __PYX_HAS_PY_AM_SEND 0 +#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 +#define __PYX_HAS_PY_AM_SEND 1 +#else +#define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation +#endif +#if __PYX_HAS_PY_AM_SEND < 2 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods +#else + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + __Pyx_pyiter_sendfunc am_send; + } __Pyx_PyAsyncMethodsStruct; + #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) +#endif +#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 + #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) +#else + #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) +#endif +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() +#else +#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 +#ifdef __cplusplus +extern "C" +#endif +PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { + int value; + PyObject *py_value = PyObject_GetAttrString(inspect, name); + if (!py_value) return 0; + value = (int) PyLong_AsLong(py_value); + Py_DECREF(py_value); + *write_to = value; + return value != -1 || !PyErr_Occurred(); +} +static int __Pyx_init_co_variables(void) { + PyObject *inspect; + int result; + inspect = PyImport_ImportModule("inspect"); + result = +#if !defined(CO_OPTIMIZED) + __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && +#endif +#if !defined(CO_NEWLOCALS) + __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && +#endif +#if !defined(CO_VARARGS) + __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && +#endif +#if !defined(CO_VARKEYWORDS) + __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && +#endif +#if !defined(CO_ASYNC_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && +#endif +#if !defined(CO_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && +#endif +#if !defined(CO_COROUTINE) + __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && +#endif + 1; + Py_DECREF(inspect); + return result ? 0 : -1; +} +#else +static int __Pyx_init_co_variables(void) { + return 0; // It's a limited API-only feature +} +#endif + +/* MathInitCode */ +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #ifndef _USE_MATH_DEFINES + #define _USE_MATH_DEFINES + #endif +#endif +#include +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 +#endif +#ifndef CYTHON_CLINE_IN_TRACEBACK +#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#endif +#if CYTHON_CLINE_IN_TRACEBACK +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } +#else +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } +#endif +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__lexeme +#define __PYX_HAVE_API__spacy__lexeme +/* Early includes */ +#include +#include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + +#include "numpy/arrayobject.h" +#include "numpy/ndarrayobject.h" +#include "numpy/ndarraytypes.h" +#include "numpy/arrayscalars.h" +#include "numpy/ufuncobject.h" +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include +#include +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) +#else + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) +#endif +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) + return Py_NewRef(obj); +#else + Py_INCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) + return Py_XNewRef(obj); +#else + Py_XINCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) +#else +#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) +#endif +#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) +#else + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +/* PretendToInitialize */ +#ifdef __cplusplus +#if __cplusplus > 201103L +#include +#endif +template +static void __Pyx_pretend_to_initialize(T* ptr) { +#if __cplusplus > 201103L + if ((std::is_trivially_default_constructible::value)) +#endif + *ptr = T(); + (void)ptr; +} +#else +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#endif + + +#if !CYTHON_USE_MODULE_STATE +static PyObject *__pyx_m = NULL; +#endif +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * const __pyx_cfilenm = __FILE__; +static const char *__pyx_filename; + +/* Header.proto */ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER)) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/lexeme.pyx", + "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd", + "spacy/lexeme.pxd", + "", + "cpython/type.pxd", + "cymem/cymem.pxd", + "preshed/maps.pxd", + "spacy/strings.pxd", + "spacy/morphology.pxd", + "spacy/vocab.pxd", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* Atomics.proto (used by UnpackUnboundCMethod) */ +#include +#ifndef CYTHON_ATOMICS + #define CYTHON_ATOMICS 1 +#endif +#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS +#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __pyx_atomic_int_type int +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_ptr_type atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) atomic_load(value) + #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_ptr_type std::atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) std::atomic_load(value) + #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ + (__GNUC_MINOR__ > 1 ||\ + (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) + #define __pyx_atomic_ptr_type void* + #define __pyx_nonatomic_ptr_type void* + #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) + #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #warning "Using GNU atomics" + #endif +#elif CYTHON_ATOMICS && defined(_MSC_VER) + #include + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type long + #define __pyx_atomic_ptr_type void* + #undef __pyx_nonatomic_int_type + #define __pyx_nonatomic_int_type long + #define __pyx_nonatomic_ptr_type void* + #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) + #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) + #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) + #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value + #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #pragma message ("Using MSVC atomics") + #endif +#else + #undef CYTHON_ATOMICS + #define CYTHON_ATOMICS 0 + #ifdef __PYX_DEBUG_ATOMICS + #warning "Not using atomics" + #endif +#endif + +/* CriticalSectionsDefinition.proto (used by CriticalSections) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection void* +#define __Pyx_PyCriticalSection2 void* +#define __Pyx_PyCriticalSection_End(cs) +#define __Pyx_PyCriticalSection2_End(cs) +#else +#define __Pyx_PyCriticalSection PyCriticalSection +#define __Pyx_PyCriticalSection2 PyCriticalSection2 +#define __Pyx_PyCriticalSection_End PyCriticalSection_End +#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End +#endif + +/* CriticalSections.proto (used by ParseKeywordsImpl) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs) +#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs) +#else +#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin +#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin +#endif +#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_BEGIN_CRITICAL_SECTION(o) { +#define __Pyx_END_CRITICAL_SECTION() } +#else +#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION +#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION +#endif + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* #### Code section: numeric_typedefs ### */ + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":743 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t +*/ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":744 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t +*/ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":745 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * +*/ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":746 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_uint8 uint8_t +*/ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":748 + * ctypedef npy_int64 int64_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t +*/ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":749 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t +*/ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":750 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * +*/ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":751 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_float32 float32_t +*/ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":753 + * ctypedef npy_uint64 uint64_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t +*/ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":754 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t +*/ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":761 + * ctypedef double complex complex128_t + * + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * +*/ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":762 + * + * ctypedef npy_longlong longlong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t +*/ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":764 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * +*/ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":765 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t +*/ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":767 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t +*/ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":768 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * +*/ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":769 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef float complex cfloat_t +*/ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; +/* #### Code section: complex_type_declarations ### */ +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< long double > __pyx_t_long_double_complex; + #else + typedef long double _Complex __pyx_t_long_double_complex; + #endif +#else + typedef struct { long double real, imag; } __pyx_t_long_double_complex; +#endif +static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_10morphology_Morphology; +struct __pyx_obj_5spacy_5vocab_Vocab; +struct __pyx_obj_5spacy_6lexeme_Lexeme; + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; + +/* "parts_of_speech.pxd":4 + * + * + * cpdef enum univ_pos_t: # <<<<<<<<<<<<<< + * NO_TAG = 0 + * ADJ = symbols.ADJ +*/ +enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t { + + /* "parts_of_speech.pxd":6 + * cpdef enum univ_pos_t: + * NO_TAG = 0 + * ADJ = symbols.ADJ # <<<<<<<<<<<<<< + * ADP + * ADV +*/ + __pyx_e_5spacy_15parts_of_speech_NO_TAG = 0, + __pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_15parts_of_speech_ADP, + __pyx_e_5spacy_15parts_of_speech_ADV, + __pyx_e_5spacy_15parts_of_speech_AUX, + __pyx_e_5spacy_15parts_of_speech_CONJ, + __pyx_e_5spacy_15parts_of_speech_CCONJ, + __pyx_e_5spacy_15parts_of_speech_DET, + __pyx_e_5spacy_15parts_of_speech_INTJ, + __pyx_e_5spacy_15parts_of_speech_NOUN, + __pyx_e_5spacy_15parts_of_speech_NUM, + __pyx_e_5spacy_15parts_of_speech_PART, + __pyx_e_5spacy_15parts_of_speech_PRON, + __pyx_e_5spacy_15parts_of_speech_PROPN, + __pyx_e_5spacy_15parts_of_speech_PUNCT, + __pyx_e_5spacy_15parts_of_speech_SCONJ, + __pyx_e_5spacy_15parts_of_speech_SYM, + __pyx_e_5spacy_15parts_of_speech_VERB, + __pyx_e_5spacy_15parts_of_speech_X, + __pyx_e_5spacy_15parts_of_speech_EOL, + __pyx_e_5spacy_15parts_of_speech_SPACE +}; +struct __pyx_t_5spacy_7structs_LexemeC; +struct __pyx_t_5spacy_7structs_SpanC; +struct __pyx_t_5spacy_7structs_TokenC; +struct __pyx_t_5spacy_7structs_MorphAnalysisC; +struct __pyx_t_5spacy_7structs_KBEntryC; +struct __pyx_t_5spacy_7structs_AliasC; +struct __pyx_t_5spacy_7structs_EdgeC; +struct __pyx_t_5spacy_7structs_GraphC; + +/* "structs.pxd":10 + * + * + * cdef struct LexemeC: # <<<<<<<<<<<<<< + * flags_t flags + * +*/ +struct __pyx_t_5spacy_7structs_LexemeC { + __pyx_t_5spacy_8typedefs_flags_t flags; + __pyx_t_5spacy_8typedefs_attr_t lang; + __pyx_t_5spacy_8typedefs_attr_t id; + __pyx_t_5spacy_8typedefs_attr_t length; + __pyx_t_5spacy_8typedefs_attr_t orth; + __pyx_t_5spacy_8typedefs_attr_t lower; + __pyx_t_5spacy_8typedefs_attr_t norm; + __pyx_t_5spacy_8typedefs_attr_t shape; + __pyx_t_5spacy_8typedefs_attr_t prefix; + __pyx_t_5spacy_8typedefs_attr_t suffix; +}; + +/* "structs.pxd":26 + * + * + * cdef struct SpanC: # <<<<<<<<<<<<<< + * hash_t id + * int start +*/ +struct __pyx_t_5spacy_7structs_SpanC { + __pyx_t_5spacy_8typedefs_hash_t id; + int start; + int end; + int start_char; + int end_char; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_attr_t kb_id; +}; + +/* "structs.pxd":36 + * + * + * cdef struct TokenC: # <<<<<<<<<<<<<< + * const LexemeC* lex + * uint64_t morph +*/ +struct __pyx_t_5spacy_7structs_TokenC { + struct __pyx_t_5spacy_7structs_LexemeC const *lex; + uint64_t morph; + enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos; + int spacy; + __pyx_t_5spacy_8typedefs_attr_t tag; + int idx; + __pyx_t_5spacy_8typedefs_attr_t lemma; + __pyx_t_5spacy_8typedefs_attr_t norm; + int head; + __pyx_t_5spacy_8typedefs_attr_t dep; + uint32_t l_kids; + uint32_t r_kids; + uint32_t l_edge; + uint32_t r_edge; + int sent_start; + int ent_iob; + __pyx_t_5spacy_8typedefs_attr_t ent_type; + __pyx_t_5spacy_8typedefs_attr_t ent_kb_id; + __pyx_t_5spacy_8typedefs_hash_t ent_id; +}; + +/* "structs.pxd":60 + * + * + * cdef struct MorphAnalysisC: # <<<<<<<<<<<<<< + * hash_t key + * int length +*/ +struct __pyx_t_5spacy_7structs_MorphAnalysisC { + __pyx_t_5spacy_8typedefs_hash_t key; + int length; + __pyx_t_5spacy_8typedefs_attr_t *fields; + __pyx_t_5spacy_8typedefs_attr_t *features; +}; + +/* "structs.pxd":69 + * + * # Internal struct, for storage and disambiguation of entities. + * cdef struct KBEntryC: # <<<<<<<<<<<<<< + * + * # The hash of this entry's unique ID/name in the kB +*/ +struct __pyx_t_5spacy_7structs_KBEntryC { + __pyx_t_5spacy_8typedefs_hash_t entity_hash; + int32_t vector_index; + int32_t feats_row; + float freq; +}; + +/* "structs.pxd":88 + * # Each alias struct stores a list of Entry pointers with their prior probabilities + * # for this specific mention/alias. + * cdef struct AliasC: # <<<<<<<<<<<<<< + * + * # All entry candidates for this alias +*/ +struct __pyx_t_5spacy_7structs_AliasC { + std::vector entry_indices; + std::vector probs; +}; + +/* "structs.pxd":97 + * + * + * cdef struct EdgeC: # <<<<<<<<<<<<<< + * hash_t label + * int32_t head +*/ +struct __pyx_t_5spacy_7structs_EdgeC { + __pyx_t_5spacy_8typedefs_hash_t label; + int32_t head; + int32_t tail; +}; + +/* "structs.pxd":103 + * + * + * cdef struct GraphC: # <<<<<<<<<<<<<< + * vector[vector[int32_t]] nodes + * vector[EdgeC] edges +*/ +struct __pyx_t_5spacy_7structs_GraphC { + std::vector > nodes; + std::vector edges; + std::vector weights; + std::vector n_heads; + std::vector n_tails; + std::vector first_head; + std::vector first_tail; + std::unordered_set *roots; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *node_map; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *edge_map; +}; +union __pyx_t_5spacy_5vocab_LexemesOrTokens; +struct __pyx_t_5spacy_5vocab__Cached; + +/* "vocab.pxd":15 + * + * + * cdef union LexemesOrTokens: # <<<<<<<<<<<<<< + * const LexemeC* const* lexemes + * const TokenC* tokens +*/ +union __pyx_t_5spacy_5vocab_LexemesOrTokens { + struct __pyx_t_5spacy_7structs_LexemeC const *const *lexemes; + struct __pyx_t_5spacy_7structs_TokenC const *tokens; +}; + +/* "vocab.pxd":20 + * + * + * cdef struct _Cached: # <<<<<<<<<<<<<< + * LexemesOrTokens data + * bint is_lex +*/ +struct __pyx_t_5spacy_5vocab__Cached { + union __pyx_t_5spacy_5vocab_LexemesOrTokens data; + int is_lex; + int length; +}; + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_10morphology_Morphology { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_7preshed_4maps_PreshMap *tags; +}; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_5vocab_Vocab { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_5spacy_10morphology_Morphology *morphology; + PyObject *_vectors; + PyObject *_lookups; + PyObject *writing_system; + PyObject *get_noun_chunks; + int length; + PyObject *_unused_object; + PyObject *lex_attr_getters; + PyObject *cfg; + struct __pyx_obj_7preshed_4maps_PreshMap *_by_orth; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; + std::vector<__pyx_t_5spacy_8typedefs_attr_t> _transient_orths; +}; + + +/* "spacy/lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6lexeme_Lexeme { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtab; + struct __pyx_t_5spacy_7structs_LexemeC *c; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + __pyx_t_5spacy_8typedefs_attr_t orth; +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_10morphology_Morphology { + struct __pyx_t_5spacy_7structs_MorphAnalysisC (*create_morph_tag)(struct __pyx_obj_5spacy_10morphology_Morphology *, PyObject *); + int (*insert)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_MorphAnalysisC); +}; +static struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtabptr_5spacy_10morphology_Morphology; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_5vocab_Vocab { + struct __pyx_t_5spacy_7structs_LexemeC const *(*get)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*get_by_orth)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8typedefs_attr_t); + struct __pyx_t_5spacy_7structs_TokenC const *(*make_fused_token)(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*_new_lexeme)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + int (*_add_lex_to_vocab)(struct __pyx_obj_5spacy_5vocab_Vocab *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_t_5spacy_7structs_LexemeC const *, int); +}; +static struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtabptr_5spacy_5vocab_Vocab; + + +/* "spacy/lexeme.pyx":43 + * + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * """An entry in the vocabulary. A `Lexeme` has no string context it's a + * word-type, as opposed to a word token. It therefore has no part-of-speech +*/ + +struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme { + struct __pyx_obj_5spacy_6lexeme_Lexeme *(*from_ptr)(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); + void (*set_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_attr_t (*get_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_check_flag)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_set_flag)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); +}; +static struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtabptr_5spacy_6lexeme_Lexeme; +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); +/* #### Code section: utility_code_proto ### */ + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* GetTopmostException.proto (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* PyThreadStateGet.proto (used by SaveResetException) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* PyImportError_Check.proto */ +#define __Pyx_PyExc_ImportError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ImportError) + +/* PyObjectCall.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); + +/* PyErrFetchRestore.proto (used by RaiseException) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* tp_new.proto */ +#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL) +static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* TupleAndListFromArray.proto (used by fastcall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +#endif +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto (used by BytesEquals) */ +#include + +/* BytesEquals.proto (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i)) +#else + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i)) +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i]) + #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); + #else + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #endif +#else + #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS +#endif +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start) +#else +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* py_dict_items.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); + +/* CallCFunction.proto (used by CallUnboundCMethod0) */ +#define __Pyx_CallCFunction(cfunc, self, args)\ + ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args) +#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\ + ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs) +#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\ + ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs) +#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ + ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) + +/* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* PyObjectGetAttrStr.proto (used by UnpackUnboundCMethod) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ +typedef struct { + PyObject *type; + PyObject **method_name; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS + __pyx_atomic_int_type initialized; +#endif + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) { +#if !CYTHON_ATOMICS + return 1; +#else + __pyx_nonatomic_int_type expected = 0; + if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) { + return 0; + } + return expected; +#endif +} +static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) { +#if CYTHON_ATOMICS + __pyx_atomic_store(&cfunc->initialized, 2); +#endif +} +#else +#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2 +#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc) +#endif + +/* CallUnboundCMethod0.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#else +#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) +#endif + +/* py_dict_values.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); + +/* OwnedDictNext.proto (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue); +#else +CYTHON_INLINE +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue); +#endif + +/* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywordsImpl.export */ +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name +); +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* CallUnboundCMethod2.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); +#else +#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) +#endif + +/* ParseKeywords.proto */ +static CYTHON_INLINE int __Pyx_ParseKeywords( + PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[], + PyObject *kwds2, PyObject *values[], + Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* ArgTypeTestFunc.export */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) + +/* PyValueError_Check.proto */ +#define __Pyx_PyExc_ValueError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ValueError) + +/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto (used by GetModuleGlobalName) */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* PyDictVersioning.proto (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* PyObjectVectorCallKwBuilder.proto (used by PyObjectVectorCallMethodKwBuilder) */ +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#if CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall +#endif +#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict +#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) +#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) +#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) +#endif + +/* PyObjectVectorCallMethodKwBuilder.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod +#else +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#endif + +/* PyNotImplementedError_Check.proto */ +#define __Pyx_PyExc_NotImplementedError_Check(obj) __Pyx_TypeCheck(obj, PyExc_NotImplementedError) + +/* KeywordStringCheck.proto */ +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(const char* function_name, PyObject *kw); + +/* PyObjectFastCallMethod.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) +#else +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); +#endif + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* HasAttr.proto */ +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n) +#else +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +#endif + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* PyLongCompare.proto */ +static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* PyObjectDelAttr.proto (used by PyObjectSetAttrStr) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +#define __Pyx_PyObject_DelAttr(o, n) PyObject_SetAttr(o, n, NULL) +#else +#define __Pyx_PyObject_DelAttr(o, n) PyObject_DelAttr(o, n) +#endif + +/* PyObjectSetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); +#else +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif + +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); + +/* PyTypeError_Check.proto */ +#define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) + +/* AllocateExtensionType.proto */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); + +/* CallTypeTraverse.proto */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0 +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg); +#endif + +/* VoidPtrExport.proto */ +static int __Pyx_ExportVoidPtr(PyObject *api_dict, const char *name, void *p, const char *sig); + +/* GetApiDict.proto */ +static PyObject *__Pyx_ApiExport_GetApiDict(void); + +/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp); +#endif + +/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v); +#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v) + +/* FixUpExtensionType.proto */ +static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); + +/* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); +#endif + +/* PyObjectCallMethod0.proto (used by PyType_Ready) */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto (used by PyType_Ready) */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* GetVTable.proto (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +static int __Pyx_MergeVtables(PyTypeObject *type); + +/* DelItemOnTypeDict.proto (used by SetupReduce) */ +static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k); +#define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k) + +/* SetupReduce.proto */ +static int __Pyx_setup_reduce(PyObject* type_obj); + +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* VoidPtrImport.proto */ +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig); + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* ImportImpl.export */ +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); + +/* Import.proto */ +static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* dict_setdefault.proto (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); + +/* AddModuleRef.proto (used by FetchSharedCythonModule) */ +#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ + __PYX_LIMITED_VERSION_HEX < 0x030d0000) + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); +#else + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#endif + +/* FetchSharedCythonModule.proto (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto (used by CommonTypesMetaclass) */ +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases); + +/* CommonTypesMetaclass.proto (used by CythonFunctionShared) */ +static int __pyx_CommonTypesMetaclass_init(PyObject *module); +#define __Pyx_CommonTypesMetaclass_USED + +/* PyMethodNew.proto (used by CythonFunctionShared) */ +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ); + +/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto (used by CythonFunction) */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_dict; +#endif + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + PyObject *defaults; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#undef __Pyx_CyOrPyCFunction_Check +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType) +#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType) +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)); +#undef __Pyx_IsSameCFunction +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, + PyTypeObject *defaults_type); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* CLineInTraceback.proto (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#else +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#endif + +/* CodeObjectCache.proto (used by AddTraceback) */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject __Pyx_CachedCodeObjectType; +#else +typedef PyCodeObject __Pyx_CachedCodeObjectType; +#endif +typedef struct { + __Pyx_CachedCodeObjectType* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_int_type accessor_count; + #endif +}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* RealImag.proto */ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(__cplusplus) && CYTHON_CCOMPLEX\ + && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_double(a, b) ((a)==(b)) + #define __Pyx_c_sum_double(a, b) ((a)+(b)) + #define __Pyx_c_diff_double(a, b) ((a)-(b)) + #define __Pyx_c_prod_double(a, b) ((a)*(b)) + #define __Pyx_c_quot_double(a, b) ((a)/(b)) + #define __Pyx_c_neg_double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_double(z) ((z)==(double)0) + #define __Pyx_c_conj_double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (::std::abs(z)) + #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_double(z) ((z)==0) + #define __Pyx_c_conj_double(z) (conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (cabs(z)) + #define __Pyx_c_pow_double(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_long__double(a, b) ((a)==(b)) + #define __Pyx_c_sum_long__double(a, b) ((a)+(b)) + #define __Pyx_c_diff_long__double(a, b) ((a)-(b)) + #define __Pyx_c_prod_long__double(a, b) ((a)*(b)) + #define __Pyx_c_quot_long__double(a, b) ((a)/(b)) + #define __Pyx_c_neg_long__double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0) + #define __Pyx_c_conj_long__double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (::std::abs(z)) + #define __Pyx_c_pow_long__double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_long__double(z) ((z)==0) + #define __Pyx_c_conj_long__double(z) (conjl(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (cabsl(z)) + #define __Pyx_c_pow_long__double(a, b) (cpowl(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex); + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + #endif +#endif + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE enum __pyx_t_5spacy_5attrs_attr_id_t __Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#else +static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); +#endif +#else // !LIMITED_API +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { + return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); +} +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +#ifdef PyExceptionInstance_Check + #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) +#else + #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) +#endif + +/* GetRuntimeVersion.proto */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +static unsigned long __Pyx_cached_runtime_version = 0; +static void __Pyx_init_runtime_version(void); +#else +#define __Pyx_init_runtime_version() +#endif +static unsigned long __Pyx_get_runtime_version(void); + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); + +/* DecompressString.proto */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); + +/* MultiPhaseInitModuleState.proto */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +static PyObject *__Pyx_State_FindModule(void*); +static int __Pyx_State_AddModule(PyObject* module, void*); +static int __Pyx_State_RemoveModule(void*); +#elif CYTHON_USE_MODULE_STATE +#define __Pyx_State_FindModule PyState_FindModule +#define __Pyx_State_AddModule PyState_AddModule +#define __Pyx_State_RemoveModule PyState_RemoveModule +#endif + +/* #### Code section: module_declarations ### */ +/* CythonABIVersion.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API + #if CYTHON_METH_FASTCALL + #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" + #else + #define __PYX_FASTCALL_ABI_SUFFIX + #endif + #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#else + #define __PYX_LIMITED_ABI_SUFFIX +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + #define __PYX_AM_SEND_ABI_SUFFIX +#elif __PYX_HAS_PY_AM_SEND == 2 + #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" +#else + #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" +#endif +#ifndef __PYX_MONITORING_ABI_SUFFIX + #define __PYX_MONITORING_ABI_SUFFIX +#endif +#if CYTHON_USE_TP_FINALIZE + #define __PYX_TP_FINALIZE_ABI_SUFFIX +#else + #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" +#endif +#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) + #define __PYX_FREELISTS_ABI_SUFFIX +#else + #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" +#endif +#define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab); /* proto*/ +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value); /* proto*/ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libc.stdio" */ + +/* Module declarations from "__builtin__" */ + +/* Module declarations from "cpython.type" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "cpython.object" */ + +/* Module declarations from "cpython.ref" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "numpy" */ +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void); /*proto*/ + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.attrs" */ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "preshed.maps" */ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "spacy.strings" */ + +/* Module declarations from "libcpp.unordered_map" */ + +/* Module declarations from "libcpp.unordered_set" */ + +/* Module declarations from "spacy.parts_of_speech" */ + +/* Module declarations from "spacy.structs" */ + +/* Module declarations from "spacy.morphology" */ + +/* Module declarations from "spacy.vocab" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_5vocab_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_5vocab_EMPTY_LEXEME (*__pyx_vp_5spacy_5vocab_EMPTY_LEXEME) + +/* Module declarations from "spacy.lexeme" */ +static struct __pyx_t_5spacy_7structs_LexemeC __pyx_v_5spacy_6lexeme_EMPTY_LEXEME; +static __pyx_t_5spacy_8typedefs_attr_t __pyx_v_5spacy_6lexeme_OOV_RANK; +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.lexeme" +extern int __pyx_module_is_main_spacy__lexeme; +int __pyx_module_is_main_spacy__lexeme = 0; + +/* Implementation of "spacy.lexeme" */ +/* #### Code section: global_var ### */ +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme___init__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_orth); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_2__richcmp__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */ +static Py_hash_t __pyx_pf_5spacy_6lexeme_6Lexeme_4__hash__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6set_attrs(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_attrs); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8set_flag(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_10check_flag(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_12similarity(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_10has_vector___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_11vector_norm___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6vector___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_6vector_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_vector); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_4rank___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_4rank_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_9sentiment___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_9sentiment_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, float __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5orth____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_4text___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5lower___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_5lower_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_4norm___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_4norm_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5shape___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_5shape_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6prefix___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_6prefix_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6suffix___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_6suffix_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_7cluster___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_7cluster_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_4lang___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_4lang_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_4prob___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_4prob_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, float __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6lower____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_6lower__2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5norm____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_5norm__2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6shape____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_6shape__2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_7prefix____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_7prefix__2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_7suffix____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_7suffix__2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5lang____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_5lang__2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5flags___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_5flags_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_flags_t __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6is_oov___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_7is_stop___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_7is_stop_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_alpha___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_alpha_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_ascii___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_ascii_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_digit___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_digit_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_lower___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_lower_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_upper___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_upper_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_title___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_title_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_punct___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_punct_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_space___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_space_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_10is_bracket___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_10is_bracket_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_quote___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_quote_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_13is_left_punct___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_13is_left_punct_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_14is_right_punct___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_14is_right_punct_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_11is_currency___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_11is_currency_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8like_url___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8like_url_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8like_num___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8like_num_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_10like_email___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_6lexeme_6Lexeme_10like_email_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5vocab___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_4orth___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_5spacy_6lexeme_Lexeme(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +/* SmallCodeConfig */ +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + PyTypeObject *__pyx_ptype_7cpython_4type_type; + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyTypeObject *__pyx_ptype_5spacy_10morphology_Morphology; + PyTypeObject *__pyx_ptype_5spacy_5vocab_Vocab; + PyObject *__pyx_type_5spacy_6lexeme_Lexeme; + PyTypeObject *__pyx_ptype_5spacy_6lexeme_Lexeme; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + PyObject *__pyx_tuple[1]; + PyObject *__pyx_codeobj_tab[6]; + PyObject *__pyx_string_tab[115]; + PyObject *__pyx_number_tab[6]; +/* #### Code section: module_state_contents ### */ +/* CommonTypesMetaclass.module_state_decls */ +PyTypeObject *__pyx_CommonTypesMetaclassType; + +/* CachedMethodType.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API +PyObject *__Pyx_CachedMethodType; +#endif + +/* CythonFunctionShared.module_state_decls */ +PyTypeObject *__pyx_CyFunctionType; + +/* CodeObjectCache.module_state_decls */ +struct __Pyx_CodeObjectCache __pyx_code_cache; + +/* #### Code section: module_state_end ### */ +} __pyx_mstatetype; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { +extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) + +#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstatetype __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: constant_name_defines ### */ +#define __pyx_kp_u_ __pyx_string_tab[0] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[1] +#define __pyx_kp_u__2 __pyx_string_tab[2] +#define __pyx_kp_u_add_note __pyx_string_tab[3] +#define __pyx_kp_u_disable __pyx_string_tab[4] +#define __pyx_kp_u_enable __pyx_string_tab[5] +#define __pyx_kp_u_gc __pyx_string_tab[6] +#define __pyx_kp_u_isenabled __pyx_string_tab[7] +#define __pyx_kp_u_numpy__core_multiarray_failed_to __pyx_string_tab[8] +#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[9] +#define __pyx_kp_u_self_c_cannot_be_converted_to_a __pyx_string_tab[10] +#define __pyx_kp_u_spacy_attrs __pyx_string_tab[11] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[12] +#define __pyx_kp_u_spacy_lexeme_pyx __pyx_string_tab[13] +#define __pyx_kp_u_spacy_numpy __pyx_string_tab[14] +#define __pyx_kp_u_spacy_thinc_api __pyx_string_tab[15] +#define __pyx_kp_u_spacy_warnings __pyx_string_tab[16] +#define __pyx_kp_u_stringsource __pyx_string_tab[17] +#define __pyx_n_u_E010 __pyx_string_tab[18] +#define __pyx_n_u_E071 __pyx_string_tab[19] +#define __pyx_n_u_E073 __pyx_string_tab[20] +#define __pyx_n_u_Errors __pyx_string_tab[21] +#define __pyx_n_u_Lexeme __pyx_string_tab[22] +#define __pyx_n_u_Lexeme___reduce_cython __pyx_string_tab[23] +#define __pyx_n_u_Lexeme___setstate_cython __pyx_string_tab[24] +#define __pyx_n_u_Lexeme_check_flag __pyx_string_tab[25] +#define __pyx_n_u_Lexeme_set_attrs __pyx_string_tab[26] +#define __pyx_n_u_Lexeme_set_flag __pyx_string_tab[27] +#define __pyx_n_u_Lexeme_similarity __pyx_string_tab[28] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[29] +#define __pyx_n_u_W008 __pyx_string_tab[30] +#define __pyx_n_u_Warnings __pyx_string_tab[31] +#define __pyx_n_u_add __pyx_string_tab[32] +#define __pyx_n_u_add_table __pyx_string_tab[33] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[34] +#define __pyx_n_u_attr __pyx_string_tab[35] +#define __pyx_n_u_attrs __pyx_string_tab[36] +#define __pyx_n_u_check_flag __pyx_string_tab[37] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[38] +#define __pyx_n_u_dot __pyx_string_tab[39] +#define __pyx_n_u_errors __pyx_string_tab[40] +#define __pyx_n_u_flag_id __pyx_string_tab[41] +#define __pyx_n_u_format __pyx_string_tab[42] +#define __pyx_n_u_func __pyx_string_tab[43] +#define __pyx_n_u_get __pyx_string_tab[44] +#define __pyx_n_u_get_array_module __pyx_string_tab[45] +#define __pyx_n_u_get_table __pyx_string_tab[46] +#define __pyx_n_u_get_vector __pyx_string_tab[47] +#define __pyx_n_u_getstate __pyx_string_tab[48] +#define __pyx_n_u_has_vector __pyx_string_tab[49] +#define __pyx_n_u_intify_attrs __pyx_string_tab[50] +#define __pyx_n_u_is_coroutine __pyx_string_tab[51] +#define __pyx_n_u_item __pyx_string_tab[52] +#define __pyx_n_u_items __pyx_string_tab[53] +#define __pyx_n_u_len __pyx_string_tab[54] +#define __pyx_n_u_length __pyx_string_tab[55] +#define __pyx_n_u_lexeme_cluster __pyx_string_tab[56] +#define __pyx_n_u_lexeme_norm __pyx_string_tab[57] +#define __pyx_n_u_lexeme_prob __pyx_string_tab[58] +#define __pyx_n_u_lexeme_sentiment __pyx_string_tab[59] +#define __pyx_n_u_lexeme_settings __pyx_string_tab[60] +#define __pyx_n_u_lookups __pyx_string_tab[61] +#define __pyx_n_u_main __pyx_string_tab[62] +#define __pyx_n_u_module __pyx_string_tab[63] +#define __pyx_n_u_name __pyx_string_tab[64] +#define __pyx_n_u_new_length __pyx_string_tab[65] +#define __pyx_n_u_norm __pyx_string_tab[66] +#define __pyx_n_u_numpy __pyx_string_tab[67] +#define __pyx_n_u_obj __pyx_string_tab[68] +#define __pyx_n_u_oov_prob __pyx_string_tab[69] +#define __pyx_n_u_orth __pyx_string_tab[70] +#define __pyx_n_u_orth_2 __pyx_string_tab[71] +#define __pyx_n_u_other __pyx_string_tab[72] +#define __pyx_n_u_pop __pyx_string_tab[73] +#define __pyx_n_u_pyx_capi __pyx_string_tab[74] +#define __pyx_n_u_pyx_state __pyx_string_tab[75] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[76] +#define __pyx_n_u_qualname __pyx_string_tab[77] +#define __pyx_n_u_reduce __pyx_string_tab[78] +#define __pyx_n_u_reduce_cython __pyx_string_tab[79] +#define __pyx_n_u_reduce_ex __pyx_string_tab[80] +#define __pyx_n_u_result __pyx_string_tab[81] +#define __pyx_n_u_self __pyx_string_tab[82] +#define __pyx_n_u_set_attrs __pyx_string_tab[83] +#define __pyx_n_u_set_flag __pyx_string_tab[84] +#define __pyx_n_u_set_name __pyx_string_tab[85] +#define __pyx_n_u_set_vector __pyx_string_tab[86] +#define __pyx_n_u_setdefault __pyx_string_tab[87] +#define __pyx_n_u_setstate __pyx_string_tab[88] +#define __pyx_n_u_setstate_cython __pyx_string_tab[89] +#define __pyx_n_u_similarity __pyx_string_tab[90] +#define __pyx_n_u_spacy_lexeme __pyx_string_tab[91] +#define __pyx_n_u_sqrt __pyx_string_tab[92] +#define __pyx_n_u_sum __pyx_string_tab[93] +#define __pyx_n_u_test __pyx_string_tab[94] +#define __pyx_n_u_thinc_api __pyx_string_tab[95] +#define __pyx_n_u_value __pyx_string_tab[96] +#define __pyx_n_u_values __pyx_string_tab[97] +#define __pyx_n_u_vector __pyx_string_tab[98] +#define __pyx_n_u_vector_norm __pyx_string_tab[99] +#define __pyx_n_u_vectors __pyx_string_tab[100] +#define __pyx_n_u_vectors_length __pyx_string_tab[101] +#define __pyx_n_u_vocab __pyx_string_tab[102] +#define __pyx_n_u_vocab_orth __pyx_string_tab[103] +#define __pyx_n_u_warn __pyx_string_tab[104] +#define __pyx_n_u_warnings __pyx_string_tab[105] +#define __pyx_n_u_xp __pyx_string_tab[106] +#define __pyx_kp_b_iso88591_A_4t __pyx_string_tab[107] +#define __pyx_kp_b_iso88591_A_7_7_t2V3e1_q_1G_d_QgS_q_Qd_BfC __pyx_string_tab[108] +#define __pyx_kp_b_iso88591_A_AQ_F_5_a_z_1G1_at4vQ_at4vT_xt1 __pyx_string_tab[109] +#define __pyx_kp_b_iso88591_A_d_1 __pyx_string_tab[110] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[111] +#define __pyx_kp_b_pyx_t_5spacy_8typedefs_attr_t __pyx_string_tab[112] +#define __pyx_kp_b_struct___pyx_t_5spacy_7structs_L __pyx_string_tab[113] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_hash6 __pyx_string_tab[114] +#define __pyx_float_0_0 __pyx_number_tab[0] +#define __pyx_float_1_0 __pyx_number_tab[1] +#define __pyx_float_neg_20_0 __pyx_number_tab[2] +#define __pyx_int_0 __pyx_number_tab[3] +#define __pyx_int_1 __pyx_number_tab[4] +#define __pyx_int_2 __pyx_number_tab[5] +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { + __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #if CYTHON_PEP489_MULTI_PHASE_INIT + __Pyx_State_RemoveModule(NULL); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_6lexeme_Lexeme); + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<6; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<115; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<6; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } +/* #### Code section: module_state_clear_contents ### */ +/* CommonTypesMetaclass.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + +/* #### Code section: module_state_clear_end ### */ +return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_6lexeme_Lexeme); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<6; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<115; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<6; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } +/* #### Code section: module_state_traverse_contents ### */ +/* CommonTypesMetaclass.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":244 + * @property + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_ELSIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":248 + * @property + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) # <<<<<<<<<<<<<< + * + * # Use fields/names with care as they may be NULL. You must check +*/ + __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("fields", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":254 + * @property + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("names", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":258 + * @property + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) # <<<<<<<<<<<<<< + * + * # Use PyDataType_HASSUBARRAY to test whether this field is +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_NAMES(__pyx_v_self); + __Pyx_INCREF(((PyObject*)__pyx_t_1)); + __pyx_r = ((PyObject*)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) { + PyArray_ArrayDescr *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":265 + * @property + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_SUBARRAY(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) { + npy_uint64 __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":270 + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" + * return PyDataType_FLAGS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyDataType_FLAGS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":282 + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" + * return PyArray_MultiIter_NUMITER(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":287 + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" + * return PyArray_MultiIter_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":292 + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" + * return PyArray_MultiIter_INDEX(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":297 + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" + * return PyArray_MultiIter_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":302 + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" + * return PyArray_MultiIter_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) { + void **__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":308 + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. + * On return, the iterators are adjusted for broadcasting.""" + * return PyArray_MultiIter_ITERS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":326 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":332 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":338 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":346 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":353 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":359 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":368 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":777 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":780 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":793 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape; + __Pyx_INCREF(((PyObject*)__pyx_t_2)); + __pyx_r = ((PyObject*)__pyx_t_2); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":795 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_r = __pyx_mstate_global->__pyx_empty_tuple; + goto __pyx_L0; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":995 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * +*/ + Py_INCREF(__pyx_v_base); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":996 + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): +*/ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 996, __pyx_L1_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":999 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None +*/ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1001 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1002 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_array", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1008 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") +*/ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1008, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1009 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.multiarray failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1009, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1010 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1010, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(1, 1010, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1014 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1014, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1015 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1015, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1016 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1016, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(1, 1016, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1020 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1020, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1021 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1021, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1022 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1022, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(1, 1022, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1037 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1052 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1062 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1069 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1076 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self = 0; + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_ptr", 0); + + /* "spacy/lexeme.pxd":31 + * @staticmethod + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) # <<<<<<<<<<<<<< + * self.c = lex + * self.vocab = vocab +*/ + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_vocab)) != (0)) __PYX_ERR(2, 31, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(2, 31, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme)))) __PYX_ERR(2, 31, __pyx_L1_error) + __pyx_v_self = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/lexeme.pxd":32 + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex # <<<<<<<<<<<<<< + * self.vocab = vocab + * self.orth = lex.orth +*/ + __pyx_v_self->c = __pyx_v_lex; + + /* "spacy/lexeme.pxd":33 + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex + * self.vocab = vocab # <<<<<<<<<<<<<< + * self.orth = lex.orth + * return self +*/ + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + __Pyx_GOTREF((PyObject *)__pyx_v_self->vocab); + __Pyx_DECREF((PyObject *)__pyx_v_self->vocab); + __pyx_v_self->vocab = __pyx_v_vocab; + + /* "spacy/lexeme.pxd":34 + * self.c = lex + * self.vocab = vocab + * self.orth = lex.orth # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = __pyx_v_lex->orth; + __pyx_v_self->orth = __pyx_t_3; + + /* "spacy/lexeme.pxd":35 + * self.vocab = vocab + * self.orth = lex.orth + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "spacy/lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value) { + int __pyx_t_1; + + /* "spacy/lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + __pyx_t_1 = (__pyx_v_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":40 + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) # <<<<<<<<<<<<<< + * elif name == ID: + * lex.id = value +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_lex, __pyx_v_name, __pyx_v_value)); + + /* "spacy/lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + goto __pyx_L3; + } + + /* "spacy/lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":42 + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: + * lex.id = value # <<<<<<<<<<<<<< + * elif name == LOWER: + * lex.lower = value +*/ + __pyx_v_lex->id = __pyx_v_value; + + /* "spacy/lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + goto __pyx_L3; + } + + /* "spacy/lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":44 + * lex.id = value + * elif name == LOWER: + * lex.lower = value # <<<<<<<<<<<<<< + * elif name == NORM: + * lex.norm = value +*/ + __pyx_v_lex->lower = __pyx_v_value; + + /* "spacy/lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + goto __pyx_L3; + } + + /* "spacy/lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":46 + * lex.lower = value + * elif name == NORM: + * lex.norm = value # <<<<<<<<<<<<<< + * elif name == SHAPE: + * lex.shape = value +*/ + __pyx_v_lex->norm = __pyx_v_value; + + /* "spacy/lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + goto __pyx_L3; + } + + /* "spacy/lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":48 + * lex.norm = value + * elif name == SHAPE: + * lex.shape = value # <<<<<<<<<<<<<< + * elif name == PREFIX: + * lex.prefix = value +*/ + __pyx_v_lex->shape = __pyx_v_value; + + /* "spacy/lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + goto __pyx_L3; + } + + /* "spacy/lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":50 + * lex.shape = value + * elif name == PREFIX: + * lex.prefix = value # <<<<<<<<<<<<<< + * elif name == SUFFIX: + * lex.suffix = value +*/ + __pyx_v_lex->prefix = __pyx_v_value; + + /* "spacy/lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + goto __pyx_L3; + } + + /* "spacy/lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":52 + * lex.prefix = value + * elif name == SUFFIX: + * lex.suffix = value # <<<<<<<<<<<<<< + * elif name == LANG: + * lex.lang = value +*/ + __pyx_v_lex->suffix = __pyx_v_value; + + /* "spacy/lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + goto __pyx_L3; + } + + /* "spacy/lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":54 + * lex.suffix = value + * elif name == LANG: + * lex.lang = value # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_lex->lang = __pyx_v_value; + + /* "spacy/lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + } + __pyx_L3:; + + /* "spacy/lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ +} + +/* "spacy/lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + int __pyx_t_1; + + /* "spacy/lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + __pyx_t_1 = (__pyx_v_feat_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_lex, __pyx_v_feat_name); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":60 + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "spacy/lexeme.pxd":62 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * elif feat_name == ID: + * return lex.id +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "spacy/lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + } + + /* "spacy/lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":64 + * return 0 + * elif feat_name == ID: + * return lex.id # <<<<<<<<<<<<<< + * elif feat_name == ORTH: + * return lex.orth +*/ + __pyx_r = __pyx_v_lex->id; + goto __pyx_L0; + + /* "spacy/lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + } + + /* "spacy/lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ORTH); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":66 + * return lex.id + * elif feat_name == ORTH: + * return lex.orth # <<<<<<<<<<<<<< + * elif feat_name == LOWER: + * return lex.lower +*/ + __pyx_r = __pyx_v_lex->orth; + goto __pyx_L0; + + /* "spacy/lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + } + + /* "spacy/lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":68 + * return lex.orth + * elif feat_name == LOWER: + * return lex.lower # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * return lex.norm +*/ + __pyx_r = __pyx_v_lex->lower; + goto __pyx_L0; + + /* "spacy/lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + } + + /* "spacy/lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":70 + * return lex.lower + * elif feat_name == NORM: + * return lex.norm # <<<<<<<<<<<<<< + * elif feat_name == SHAPE: + * return lex.shape +*/ + __pyx_r = __pyx_v_lex->norm; + goto __pyx_L0; + + /* "spacy/lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + } + + /* "spacy/lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":72 + * return lex.norm + * elif feat_name == SHAPE: + * return lex.shape # <<<<<<<<<<<<<< + * elif feat_name == PREFIX: + * return lex.prefix +*/ + __pyx_r = __pyx_v_lex->shape; + goto __pyx_L0; + + /* "spacy/lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + } + + /* "spacy/lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":74 + * return lex.shape + * elif feat_name == PREFIX: + * return lex.prefix # <<<<<<<<<<<<<< + * elif feat_name == SUFFIX: + * return lex.suffix +*/ + __pyx_r = __pyx_v_lex->prefix; + goto __pyx_L0; + + /* "spacy/lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + } + + /* "spacy/lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":76 + * return lex.prefix + * elif feat_name == SUFFIX: + * return lex.suffix # <<<<<<<<<<<<<< + * elif feat_name == LENGTH: + * return lex.length +*/ + __pyx_r = __pyx_v_lex->suffix; + goto __pyx_L0; + + /* "spacy/lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + } + + /* "spacy/lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LENGTH); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":78 + * return lex.suffix + * elif feat_name == LENGTH: + * return lex.length # <<<<<<<<<<<<<< + * elif feat_name == LANG: + * return lex.lang +*/ + __pyx_r = __pyx_v_lex->length; + goto __pyx_L0; + + /* "spacy/lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + } + + /* "spacy/lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":80 + * return lex.length + * elif feat_name == LANG: + * return lex.lang # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = __pyx_v_lex->lang; + goto __pyx_L0; + + /* "spacy/lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + } + + /* "spacy/lexeme.pxd":82 + * return lex.lang + * else: + * return 0 # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "spacy/lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + int __pyx_t_1; + + /* "spacy/lexeme.pxd":86 + * @staticmethod + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if lexeme.flags & (one << flag_id): + * return True +*/ + __pyx_v_one = 1; + + /* "spacy/lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = ((__pyx_v_lexeme->flags & (__pyx_v_one << __pyx_v_flag_id)) != 0); + if (__pyx_t_1) { + + /* "spacy/lexeme.pxd":88 + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "spacy/lexeme.pxd":90 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "spacy/lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + + /* "spacy/lexeme.pxd":94 + * @staticmethod + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if value: + * lex.flags |= one << flag_id +*/ + __pyx_v_one = 1; + + /* "spacy/lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + if (__pyx_v_value) { + + /* "spacy/lexeme.pxd":96 + * cdef flags_t one = 1 + * if value: + * lex.flags |= one << flag_id # <<<<<<<<<<<<<< + * else: + * lex.flags &= ~(one << flag_id) +*/ + __pyx_v_lex->flags = (__pyx_v_lex->flags | (__pyx_v_one << __pyx_v_flag_id)); + + /* "spacy/lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/lexeme.pxd":98 + * lex.flags |= one << flag_id + * else: + * lex.flags &= ~(one << flag_id) # <<<<<<<<<<<<<< +*/ + /*else*/ { + __pyx_v_lex->flags = (__pyx_v_lex->flags & (~(__pyx_v_one << __pyx_v_flag_id))); + } + __pyx_L3:; + + /* "spacy/lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":51 + * DOCS: https://spacy.io/api/lexeme + * """ + * def __init__(self, Vocab vocab, attr_t orth): # <<<<<<<<<<<<<< + * """Create a Lexeme object. + * +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_6lexeme_6Lexeme___init__, "Create a Lexeme object.\n\n vocab (Vocab): The parent vocabulary\n orth (uint64): The orth id of the lexeme.\n Returns (Lexeme): The newly constructd object.\n "); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_6lexeme_6Lexeme___init__; +#endif +static int __pyx_pw_5spacy_6lexeme_6Lexeme_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab = 0; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_orth; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_vocab,&__pyx_mstate_global->__pyx_n_u_orth,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 51, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 51, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 51, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 51, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(0, 51, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 51, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 51, __pyx_L3_error) + } + __pyx_v_vocab = ((struct __pyx_obj_5spacy_5vocab_Vocab *)values[0]); + __pyx_v_orth = __Pyx_PyLong_As_uint64_t(values[1]); if (unlikely((__pyx_v_orth == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 51, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.lexeme.Lexeme.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vocab), __pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, 1, "vocab", 0))) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme___init__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), __pyx_v_vocab, __pyx_v_orth); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme___init__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_orth) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/lexeme.pyx":58 + * Returns (Lexeme): The newly constructd object. + * """ + * self.vocab = vocab # <<<<<<<<<<<<<< + * self.orth = orth + * self.c = vocab.get_by_orth(vocab.mem, orth) +*/ + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + __Pyx_GOTREF((PyObject *)__pyx_v_self->vocab); + __Pyx_DECREF((PyObject *)__pyx_v_self->vocab); + __pyx_v_self->vocab = __pyx_v_vocab; + + /* "spacy/lexeme.pyx":59 + * """ + * self.vocab = vocab + * self.orth = orth # <<<<<<<<<<<<<< + * self.c = vocab.get_by_orth(vocab.mem, orth) + * if self.c.orth != orth: +*/ + __pyx_v_self->orth = __pyx_v_orth; + + /* "spacy/lexeme.pyx":60 + * self.vocab = vocab + * self.orth = orth + * self.c = vocab.get_by_orth(vocab.mem, orth) # <<<<<<<<<<<<<< + * if self.c.orth != orth: + * raise ValueError(Errors.E071.format(orth=orth, vocab_orth=self.c.orth)) +*/ + __pyx_t_1 = ((PyObject *)__pyx_v_vocab->mem); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_vocab->__pyx_vtab)->get_by_orth(__pyx_v_vocab, ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1), __pyx_v_orth); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->c = ((struct __pyx_t_5spacy_7structs_LexemeC *)((void *)__pyx_t_2)); + + /* "spacy/lexeme.pyx":61 + * self.orth = orth + * self.c = vocab.get_by_orth(vocab.mem, orth) + * if self.c.orth != orth: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E071.format(orth=orth, vocab_orth=self.c.orth)) + * +*/ + __pyx_t_3 = (__pyx_v_self->c->orth != __pyx_v_orth); + if (unlikely(__pyx_t_3)) { + + /* "spacy/lexeme.pyx":62 + * self.c = vocab.get_by_orth(vocab.mem, orth) + * if self.c.orth != orth: + * raise ValueError(Errors.E071.format(orth=orth, vocab_orth=self.c.orth)) # <<<<<<<<<<<<<< + * + * def __richcmp__(self, other, int op): +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E071); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyLong_From_uint64_t(__pyx_v_orth); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->orth); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_orth, __pyx_t_7, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 62, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_vocab_orth, __pyx_t_9, __pyx_t_11, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 62, __pyx_L1_error) + + /* "spacy/lexeme.pyx":61 + * self.orth = orth + * self.c = vocab.get_by_orth(vocab.mem, orth) + * if self.c.orth != orth: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E071.format(orth=orth, vocab_orth=self.c.orth)) + * +*/ + } + + /* "spacy/lexeme.pyx":51 + * DOCS: https://spacy.io/api/lexeme + * """ + * def __init__(self, Vocab vocab, attr_t orth): # <<<<<<<<<<<<<< + * """Create a Lexeme object. + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":64 + * raise ValueError(Errors.E071.format(orth=orth, vocab_orth=self.c.orth)) + * + * def __richcmp__(self, other, int op): # <<<<<<<<<<<<<< + * if other is None: + * if op == 0 or op == 1 or op == 2: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_3__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_3__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_2__richcmp__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_2__richcmp__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { + PyObject *__pyx_v_a = NULL; + PyObject *__pyx_v_b = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__richcmp__", 0); + + /* "spacy/lexeme.pyx":65 + * + * def __richcmp__(self, other, int op): + * if other is None: # <<<<<<<<<<<<<< + * if op == 0 or op == 1 or op == 2: + * return False +*/ + __pyx_t_1 = (__pyx_v_other == Py_None); + if (__pyx_t_1) { + + /* "spacy/lexeme.pyx":66 + * def __richcmp__(self, other, int op): + * if other is None: + * if op == 0 or op == 1 or op == 2: # <<<<<<<<<<<<<< + * return False + * else: +*/ + switch (__pyx_v_op) { + case 0: + case 1: + case 2: + + /* "spacy/lexeme.pyx":67 + * if other is None: + * if op == 0 or op == 1 or op == 2: + * return False # <<<<<<<<<<<<<< + * else: + * return True +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":66 + * def __richcmp__(self, other, int op): + * if other is None: + * if op == 0 or op == 1 or op == 2: # <<<<<<<<<<<<<< + * return False + * else: +*/ + break; + default: + + /* "spacy/lexeme.pyx":69 + * return False + * else: + * return True # <<<<<<<<<<<<<< + * if isinstance(other, Lexeme): + * a = self.orth +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + goto __pyx_L0; + break; + } + + /* "spacy/lexeme.pyx":65 + * + * def __richcmp__(self, other, int op): + * if other is None: # <<<<<<<<<<<<<< + * if op == 0 or op == 1 or op == 2: + * return False +*/ + } + + /* "spacy/lexeme.pyx":70 + * else: + * return True + * if isinstance(other, Lexeme): # <<<<<<<<<<<<<< + * a = self.orth + * b = other.orth +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme); + if (__pyx_t_1) { + + /* "spacy/lexeme.pyx":71 + * return True + * if isinstance(other, Lexeme): + * a = self.orth # <<<<<<<<<<<<<< + * b = other.orth + * elif isinstance(other, int): +*/ + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->orth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_a = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/lexeme.pyx":72 + * if isinstance(other, Lexeme): + * a = self.orth + * b = other.orth # <<<<<<<<<<<<<< + * elif isinstance(other, int): + * a = self.orth +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_orth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_b = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/lexeme.pyx":70 + * else: + * return True + * if isinstance(other, Lexeme): # <<<<<<<<<<<<<< + * a = self.orth + * b = other.orth +*/ + goto __pyx_L4; + } + + /* "spacy/lexeme.pyx":73 + * a = self.orth + * b = other.orth + * elif isinstance(other, int): # <<<<<<<<<<<<<< + * a = self.orth + * b = other +*/ + __pyx_t_1 = PyLong_Check(__pyx_v_other); + if (__pyx_t_1) { + + /* "spacy/lexeme.pyx":74 + * b = other.orth + * elif isinstance(other, int): + * a = self.orth # <<<<<<<<<<<<<< + * b = other + * elif isinstance(other, str): +*/ + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->orth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_a = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/lexeme.pyx":75 + * elif isinstance(other, int): + * a = self.orth + * b = other # <<<<<<<<<<<<<< + * elif isinstance(other, str): + * a = self.orth_ +*/ + __Pyx_INCREF(__pyx_v_other); + __pyx_v_b = __pyx_v_other; + + /* "spacy/lexeme.pyx":73 + * a = self.orth + * b = other.orth + * elif isinstance(other, int): # <<<<<<<<<<<<<< + * a = self.orth + * b = other +*/ + goto __pyx_L4; + } + + /* "spacy/lexeme.pyx":76 + * a = self.orth + * b = other + * elif isinstance(other, str): # <<<<<<<<<<<<<< + * a = self.orth_ + * b = other +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_other); + if (__pyx_t_1) { + + /* "spacy/lexeme.pyx":77 + * b = other + * elif isinstance(other, str): + * a = self.orth_ # <<<<<<<<<<<<<< + * b = other + * else: +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_orth_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_a = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/lexeme.pyx":78 + * elif isinstance(other, str): + * a = self.orth_ + * b = other # <<<<<<<<<<<<<< + * else: + * a = 0 +*/ + __Pyx_INCREF(__pyx_v_other); + __pyx_v_b = __pyx_v_other; + + /* "spacy/lexeme.pyx":76 + * a = self.orth + * b = other + * elif isinstance(other, str): # <<<<<<<<<<<<<< + * a = self.orth_ + * b = other +*/ + goto __pyx_L4; + } + + /* "spacy/lexeme.pyx":80 + * b = other + * else: + * a = 0 # <<<<<<<<<<<<<< + * b = 1 + * if op == 2: # == +*/ + /*else*/ { + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_v_a = __pyx_mstate_global->__pyx_int_0; + + /* "spacy/lexeme.pyx":81 + * else: + * a = 0 + * b = 1 # <<<<<<<<<<<<<< + * if op == 2: # == + * return a == b +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); + __pyx_v_b = __pyx_mstate_global->__pyx_int_1; + } + __pyx_L4:; + + /* "spacy/lexeme.pyx":82 + * a = 0 + * b = 1 + * if op == 2: # == # <<<<<<<<<<<<<< + * return a == b + * elif op == 3: # != +*/ + switch (__pyx_v_op) { + case 2: + + /* "spacy/lexeme.pyx":83 + * b = 1 + * if op == 2: # == + * return a == b # <<<<<<<<<<<<<< + * elif op == 3: # != + * return a != b +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_a, __pyx_v_b, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":82 + * a = 0 + * b = 1 + * if op == 2: # == # <<<<<<<<<<<<<< + * return a == b + * elif op == 3: # != +*/ + break; + case 3: + + /* "spacy/lexeme.pyx":85 + * return a == b + * elif op == 3: # != + * return a != b # <<<<<<<<<<<<<< + * elif op == 0: # < + * return a < b +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_a, __pyx_v_b, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":84 + * if op == 2: # == + * return a == b + * elif op == 3: # != # <<<<<<<<<<<<<< + * return a != b + * elif op == 0: # < +*/ + break; + case 0: + + /* "spacy/lexeme.pyx":87 + * return a != b + * elif op == 0: # < + * return a < b # <<<<<<<<<<<<<< + * elif op == 1: # <= + * return a <= b +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_a, __pyx_v_b, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":86 + * elif op == 3: # != + * return a != b + * elif op == 0: # < # <<<<<<<<<<<<<< + * return a < b + * elif op == 1: # <= +*/ + break; + case 1: + + /* "spacy/lexeme.pyx":89 + * return a < b + * elif op == 1: # <= + * return a <= b # <<<<<<<<<<<<<< + * elif op == 4: # > + * return a > b +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_a, __pyx_v_b, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":88 + * elif op == 0: # < + * return a < b + * elif op == 1: # <= # <<<<<<<<<<<<<< + * return a <= b + * elif op == 4: # > +*/ + break; + case 4: + + /* "spacy/lexeme.pyx":91 + * return a <= b + * elif op == 4: # > + * return a > b # <<<<<<<<<<<<<< + * elif op == 5: # >= + * return a >= b +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_a, __pyx_v_b, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":90 + * elif op == 1: # <= + * return a <= b + * elif op == 4: # > # <<<<<<<<<<<<<< + * return a > b + * elif op == 5: # >= +*/ + break; + case 5: + + /* "spacy/lexeme.pyx":93 + * return a > b + * elif op == 5: # >= + * return a >= b # <<<<<<<<<<<<<< + * else: + * raise NotImplementedError(op) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_a, __pyx_v_b, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":92 + * elif op == 4: # > + * return a > b + * elif op == 5: # >= # <<<<<<<<<<<<<< + * return a >= b + * else: +*/ + break; + default: + + /* "spacy/lexeme.pyx":95 + * return a >= b + * else: + * raise NotImplementedError(op) # <<<<<<<<<<<<<< + * + * def __hash__(self): +*/ + __pyx_t_3 = NULL; + __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_op); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_NotImplementedError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 95, __pyx_L1_error) + break; + } + + /* "spacy/lexeme.pyx":64 + * raise ValueError(Errors.E071.format(orth=orth, vocab_orth=self.c.orth)) + * + * def __richcmp__(self, other, int op): # <<<<<<<<<<<<<< + * if other is None: + * if op == 0 or op == 1 or op == 2: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_a); + __Pyx_XDECREF(__pyx_v_b); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":97 + * raise NotImplementedError(op) + * + * def __hash__(self): # <<<<<<<<<<<<<< + * return self.c.orth + * +*/ + +/* Python wrapper */ +static Py_hash_t __pyx_pw_5spacy_6lexeme_6Lexeme_5__hash__(PyObject *__pyx_v_self); /*proto*/ +static Py_hash_t __pyx_pw_5spacy_6lexeme_6Lexeme_5__hash__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_hash_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_4__hash__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_hash_t __pyx_pf_5spacy_6lexeme_6Lexeme_4__hash__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + Py_hash_t __pyx_r; + + /* "spacy/lexeme.pyx":98 + * + * def __hash__(self): + * return self.c.orth # <<<<<<<<<<<<<< + * + * def set_attrs(self, **attrs): +*/ + __pyx_r = __pyx_v_self->c->orth; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":97 + * raise NotImplementedError(op) + * + * def __hash__(self): # <<<<<<<<<<<<<< + * return self.c.orth + * +*/ + + /* function exit code */ + __pyx_L0:; + if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":100 + * return self.c.orth + * + * def set_attrs(self, **attrs): # <<<<<<<<<<<<<< + * cdef attr_id_t attr + * attrs = intify_attrs(attrs) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_7set_attrs(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_6lexeme_6Lexeme_6set_attrs, "Lexeme.set_attrs(self, **attrs)"); +static PyMethodDef __pyx_mdef_5spacy_6lexeme_6Lexeme_7set_attrs = {"set_attrs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_6lexeme_6Lexeme_7set_attrs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_6lexeme_6Lexeme_6set_attrs}; +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_7set_attrs(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_attrs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_attrs (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("set_attrs", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (__pyx_kwds_len > 0) { + if (unlikely(__Pyx_CheckKeywordStrings("set_attrs", __pyx_kwds) == -1)) return NULL; + __pyx_v_attrs = __Pyx_KwargsAsDict_FASTCALL(__pyx_kwds, __pyx_kwvalues); + if (unlikely(!__pyx_v_attrs)) return NULL; + __Pyx_GOTREF(__pyx_v_attrs); + } else { + __pyx_v_attrs = PyDict_New(); + if (unlikely(!__pyx_v_attrs)) return NULL; + __Pyx_GOTREF(__pyx_v_attrs); + } + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_6set_attrs(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), __pyx_v_attrs); + + /* function exit code */ + __Pyx_DECREF(__pyx_v_attrs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6set_attrs(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_attrs) { + enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_attr; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_t_10; + int __pyx_t_11; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_attrs", 0); + __Pyx_INCREF(__pyx_v_attrs); + + /* "spacy/lexeme.pyx":102 + * def set_attrs(self, **attrs): + * cdef attr_id_t attr + * attrs = intify_attrs(attrs) # <<<<<<<<<<<<<< + * for attr, value in attrs.items(): + * # skip PROB, e.g. from lexemes.jsonl +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_intify_attrs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_attrs}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_attrs, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":103 + * cdef attr_id_t attr + * attrs = intify_attrs(attrs) + * for attr, value in attrs.items(): # <<<<<<<<<<<<<< + * # skip PROB, e.g. from lexemes.jsonl + * if isinstance(value, float): +*/ + __pyx_t_3 = __pyx_v_attrs; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 103, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 103, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 103, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); + #endif + ++__pyx_t_5; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_6(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 103, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 103, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_7); + } + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); + index = 0; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_L6_unpacking_done:; + } + __pyx_t_10 = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_attr = __pyx_t_10; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/lexeme.pyx":105 + * for attr, value in attrs.items(): + * # skip PROB, e.g. from lexemes.jsonl + * if isinstance(value, float): # <<<<<<<<<<<<<< + * continue + * elif isinstance(value, int): +*/ + __pyx_t_11 = PyFloat_Check(__pyx_v_value); + if (__pyx_t_11) { + + /* "spacy/lexeme.pyx":106 + * # skip PROB, e.g. from lexemes.jsonl + * if isinstance(value, float): + * continue # <<<<<<<<<<<<<< + * elif isinstance(value, int): + * Lexeme.set_struct_attr(self.c, attr, value) +*/ + goto __pyx_L3_continue; + + /* "spacy/lexeme.pyx":105 + * for attr, value in attrs.items(): + * # skip PROB, e.g. from lexemes.jsonl + * if isinstance(value, float): # <<<<<<<<<<<<<< + * continue + * elif isinstance(value, int): +*/ + } + + /* "spacy/lexeme.pyx":107 + * if isinstance(value, float): + * continue + * elif isinstance(value, int): # <<<<<<<<<<<<<< + * Lexeme.set_struct_attr(self.c, attr, value) + * else: +*/ + __pyx_t_11 = PyLong_Check(__pyx_v_value); + if (__pyx_t_11) { + + /* "spacy/lexeme.pyx":108 + * continue + * elif isinstance(value, int): + * Lexeme.set_struct_attr(self.c, attr, value) # <<<<<<<<<<<<<< + * else: + * Lexeme.set_struct_attr(self.c, attr, self.vocab.strings.add(value)) +*/ + __pyx_t_12 = __Pyx_PyLong_As_uint64_t(__pyx_v_value); if (unlikely((__pyx_t_12 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(__pyx_v_self->c, __pyx_v_attr, __pyx_t_12); + + /* "spacy/lexeme.pyx":107 + * if isinstance(value, float): + * continue + * elif isinstance(value, int): # <<<<<<<<<<<<<< + * Lexeme.set_struct_attr(self.c, attr, value) + * else: +*/ + goto __pyx_L7; + } + + /* "spacy/lexeme.pyx":110 + * Lexeme.set_struct_attr(self.c, attr, value) + * else: + * Lexeme.set_struct_attr(self.c, attr, self.vocab.strings.add(value)) # <<<<<<<<<<<<<< + * + * def set_flag(self, attr_id_t flag_id, bint value): +*/ + /*else*/ { + __pyx_t_7 = ((PyObject *)__pyx_v_self->vocab->strings); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_value}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_12 = __Pyx_PyLong_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_12 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(__pyx_v_self->c, __pyx_v_attr, __pyx_t_12); + } + __pyx_L7:; + + /* "spacy/lexeme.pyx":103 + * cdef attr_id_t attr + * attrs = intify_attrs(attrs) + * for attr, value in attrs.items(): # <<<<<<<<<<<<<< + * # skip PROB, e.g. from lexemes.jsonl + * if isinstance(value, float): +*/ + __pyx_L3_continue:; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":100 + * return self.c.orth + * + * def set_attrs(self, **attrs): # <<<<<<<<<<<<<< + * cdef attr_id_t attr + * attrs = intify_attrs(attrs) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.set_attrs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_attrs); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":112 + * Lexeme.set_struct_attr(self.c, attr, self.vocab.strings.add(value)) + * + * def set_flag(self, attr_id_t flag_id, bint value): # <<<<<<<<<<<<<< + * """Change the value of a boolean flag. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_9set_flag(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_6lexeme_6Lexeme_8set_flag, "Lexeme.set_flag(self, attr_id_t flag_id, bool value)\n\nChange the value of a boolean flag.\n\nflag_id (int): The attribute ID of the flag to set.\nvalue (bool): The new value of the flag."); +static PyMethodDef __pyx_mdef_5spacy_6lexeme_6Lexeme_9set_flag = {"set_flag", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_6lexeme_6Lexeme_9set_flag, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_6lexeme_6Lexeme_8set_flag}; +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_9set_flag(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id; + int __pyx_v_value; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_flag (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_flag_id,&__pyx_mstate_global->__pyx_n_u_value,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 112, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 112, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 112, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_flag", 0) < (0)) __PYX_ERR(0, 112, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_flag", 1, 2, 2, i); __PYX_ERR(0, 112, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 112, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 112, __pyx_L3_error) + } + __pyx_v_flag_id = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L3_error) + __pyx_v_value = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_flag", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 112, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.lexeme.Lexeme.set_flag", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8set_flag(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), __pyx_v_flag_id, __pyx_v_value); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8set_flag(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_flag", 0); + + /* "spacy/lexeme.pyx":118 + * value (bool): The new value of the flag. + * """ + * Lexeme.c_set_flag(self.c, flag_id, value) # <<<<<<<<<<<<<< + * + * def check_flag(self, attr_id_t flag_id): +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_v_flag_id, __pyx_v_value)); + + /* "spacy/lexeme.pyx":112 + * Lexeme.set_struct_attr(self.c, attr, self.vocab.strings.add(value)) + * + * def set_flag(self, attr_id_t flag_id, bint value): # <<<<<<<<<<<<<< + * """Change the value of a boolean flag. + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":120 + * Lexeme.c_set_flag(self.c, flag_id, value) + * + * def check_flag(self, attr_id_t flag_id): # <<<<<<<<<<<<<< + * """Check the value of a boolean flag. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_11check_flag(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_6lexeme_6Lexeme_10check_flag, "Lexeme.check_flag(self, attr_id_t flag_id)\n\nCheck the value of a boolean flag.\n\nflag_id (int): The attribute ID of the flag to query.\nRETURNS (bool): The value of the flag."); +static PyMethodDef __pyx_mdef_5spacy_6lexeme_6Lexeme_11check_flag = {"check_flag", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_6lexeme_6Lexeme_11check_flag, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_6lexeme_6Lexeme_10check_flag}; +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_11check_flag(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("check_flag (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_flag_id,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 120, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 120, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "check_flag", 0) < (0)) __PYX_ERR(0, 120, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("check_flag", 1, 1, 1, i); __PYX_ERR(0, 120, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 120, __pyx_L3_error) + } + __pyx_v_flag_id = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("check_flag", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 120, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.lexeme.Lexeme.check_flag", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_10check_flag(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), __pyx_v_flag_id); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_10check_flag(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_RefNannySetupContext("check_flag", 0); + + /* "spacy/lexeme.pyx":126 + * RETURNS (bool): The value of the flag. + * """ + * return True if Lexeme.c_check_flag(self.c, flag_id) else False # <<<<<<<<<<<<<< + * + * def similarity(self, other): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_v_flag_id); + if (__pyx_t_2) { + __Pyx_INCREF(Py_True); + __pyx_t_1 = Py_True; + } else { + __Pyx_INCREF(Py_False); + __pyx_t_1 = Py_False; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":120 + * Lexeme.c_set_flag(self.c, flag_id, value) + * + * def check_flag(self, attr_id_t flag_id): # <<<<<<<<<<<<<< + * """Check the value of a boolean flag. + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":128 + * return True if Lexeme.c_check_flag(self.c, flag_id) else False + * + * def similarity(self, other): # <<<<<<<<<<<<<< + * """Compute a semantic similarity estimate. Defaults to cosine over + * vectors. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_13similarity(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_6lexeme_6Lexeme_12similarity, "Lexeme.similarity(self, other)\n\nCompute a semantic similarity estimate. Defaults to cosine over\nvectors.\n\nother (object): The object to compare with. By default, accepts `Doc`,\n `Span`, `Token` and `Lexeme` objects.\nRETURNS (float): A scalar similarity score. Higher is more similar."); +static PyMethodDef __pyx_mdef_5spacy_6lexeme_6Lexeme_13similarity = {"similarity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_6lexeme_6Lexeme_13similarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_6lexeme_6Lexeme_12similarity}; +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_13similarity(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_other = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("similarity (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_other,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 128, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 128, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "similarity", 0) < (0)) __PYX_ERR(0, 128, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("similarity", 1, 1, 1, i); __PYX_ERR(0, 128, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 128, __pyx_L3_error) + } + __pyx_v_other = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("similarity", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 128, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.lexeme.Lexeme.similarity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_12similarity(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), __pyx_v_other); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_12similarity(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_v_vector = NULL; + PyObject *__pyx_v_xp = NULL; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + size_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("similarity", 0); + + /* "spacy/lexeme.pyx":137 + * """ + * # Return 1.0 similarity for matches + * if hasattr(other, "orth"): # <<<<<<<<<<<<<< + * if self.c.orth == other.orth: + * return 1.0 +*/ + __pyx_t_1 = __Pyx_HasAttr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_orth); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 137, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/lexeme.pyx":138 + * # Return 1.0 similarity for matches + * if hasattr(other, "orth"): + * if self.c.orth == other.orth: # <<<<<<<<<<<<<< + * return 1.0 + * elif ( +*/ + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->orth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_orth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + + /* "spacy/lexeme.pyx":139 + * if hasattr(other, "orth"): + * if self.c.orth == other.orth: + * return 1.0 # <<<<<<<<<<<<<< + * elif ( + * hasattr(other, "__len__") and len(other) == 1 +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_float_1_0); + __pyx_r = __pyx_mstate_global->__pyx_float_1_0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":138 + * # Return 1.0 similarity for matches + * if hasattr(other, "orth"): + * if self.c.orth == other.orth: # <<<<<<<<<<<<<< + * return 1.0 + * elif ( +*/ + } + + /* "spacy/lexeme.pyx":137 + * """ + * # Return 1.0 similarity for matches + * if hasattr(other, "orth"): # <<<<<<<<<<<<<< + * if self.c.orth == other.orth: + * return 1.0 +*/ + goto __pyx_L3; + } + + /* "spacy/lexeme.pyx":141 + * return 1.0 + * elif ( + * hasattr(other, "__len__") and len(other) == 1 # <<<<<<<<<<<<<< + * and hasattr(other[0], "orth") + * and self.c.orth == other[0].orth +*/ + __pyx_t_5 = __Pyx_HasAttr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_len); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 141, __pyx_L1_error) + if (__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L5_bool_binop_done; + } + + /* "spacy/lexeme.pyx":142 + * elif ( + * hasattr(other, "__len__") and len(other) == 1 + * and hasattr(other[0], "orth") # <<<<<<<<<<<<<< + * and self.c.orth == other[0].orth + * ): +*/ + __pyx_t_6 = PyObject_Length(__pyx_v_other); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 141, __pyx_L1_error) + + /* "spacy/lexeme.pyx":141 + * return 1.0 + * elif ( + * hasattr(other, "__len__") and len(other) == 1 # <<<<<<<<<<<<<< + * and hasattr(other[0], "orth") + * and self.c.orth == other[0].orth +*/ + __pyx_t_5 = (__pyx_t_6 == 1); + if (__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L5_bool_binop_done; + } + + /* "spacy/lexeme.pyx":142 + * elif ( + * hasattr(other, "__len__") and len(other) == 1 + * and hasattr(other[0], "orth") # <<<<<<<<<<<<<< + * and self.c.orth == other[0].orth + * ): +*/ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_other, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_HasAttr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_orth); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L5_bool_binop_done; + } + + /* "spacy/lexeme.pyx":143 + * hasattr(other, "__len__") and len(other) == 1 + * and hasattr(other[0], "orth") + * and self.c.orth == other[0].orth # <<<<<<<<<<<<<< + * ): + * return 1.0 +*/ + __pyx_t_4 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->orth); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_other, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_orth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __pyx_t_5; + __pyx_L5_bool_binop_done:; + + /* "spacy/lexeme.pyx":140 + * if self.c.orth == other.orth: + * return 1.0 + * elif ( # <<<<<<<<<<<<<< + * hasattr(other, "__len__") and len(other) == 1 + * and hasattr(other[0], "orth") +*/ + if (__pyx_t_1) { + + /* "spacy/lexeme.pyx":145 + * and self.c.orth == other[0].orth + * ): + * return 1.0 # <<<<<<<<<<<<<< + * if self.vector_norm == 0 or other.vector_norm == 0: + * warnings.warn(Warnings.W008.format(obj="Lexeme")) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_float_1_0); + __pyx_r = __pyx_mstate_global->__pyx_float_1_0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":140 + * if self.c.orth == other.orth: + * return 1.0 + * elif ( # <<<<<<<<<<<<<< + * hasattr(other, "__len__") and len(other) == 1 + * and hasattr(other[0], "orth") +*/ + } + __pyx_L3:; + + /* "spacy/lexeme.pyx":146 + * ): + * return 1.0 + * if self.vector_norm == 0 or other.vector_norm == 0: # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W008.format(obj="Lexeme")) + * return 0.0 +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vector_norm); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_3, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L10_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_vector_norm); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_3, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __pyx_t_5; + __pyx_L10_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/lexeme.pyx":147 + * return 1.0 + * if self.vector_norm == 0 or other.vector_norm == 0: + * warnings.warn(Warnings.W008.format(obj="Lexeme")) # <<<<<<<<<<<<<< + * return 0.0 + * vector = self.vector +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_Warnings); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_W008); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_8 = __pyx_t_10; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_11 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_8, NULL}; + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_obj, __pyx_mstate_global->__pyx_n_u_Lexeme, __pyx_t_9, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_11 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_7, __pyx__function); + __pyx_t_11 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":148 + * if self.vector_norm == 0 or other.vector_norm == 0: + * warnings.warn(Warnings.W008.format(obj="Lexeme")) + * return 0.0 # <<<<<<<<<<<<<< + * vector = self.vector + * xp = get_array_module(vector) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_float_0_0); + __pyx_r = __pyx_mstate_global->__pyx_float_0_0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":146 + * ): + * return 1.0 + * if self.vector_norm == 0 or other.vector_norm == 0: # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W008.format(obj="Lexeme")) + * return 0.0 +*/ + } + + /* "spacy/lexeme.pyx":149 + * warnings.warn(Warnings.W008.format(obj="Lexeme")) + * return 0.0 + * vector = self.vector # <<<<<<<<<<<<<< + * xp = get_array_module(vector) + * result = xp.dot(vector, other.vector) / (self.vector_norm * other.vector_norm) +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vector); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_vector = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":150 + * return 0.0 + * vector = self.vector + * xp = get_array_module(vector) # <<<<<<<<<<<<<< + * result = xp.dot(vector, other.vector) / (self.vector_norm * other.vector_norm) + * # ensure we get a scalar back (numpy does this automatically but cupy doesn't) +*/ + __pyx_t_7 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_array_module); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_7); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_11 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_vector}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_xp = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":151 + * vector = self.vector + * xp = get_array_module(vector) + * result = xp.dot(vector, other.vector) / (self.vector_norm * other.vector_norm) # <<<<<<<<<<<<<< + * # ensure we get a scalar back (numpy does this automatically but cupy doesn't) + * return result.item() +*/ + __pyx_t_4 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_vector); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_vector, __pyx_t_7}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_dot, __pyx_callargs+__pyx_t_11, (3-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vector_norm); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_vector_norm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyNumber_Multiply(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_result = __pyx_t_4; + __pyx_t_4 = 0; + + /* "spacy/lexeme.pyx":153 + * result = xp.dot(vector, other.vector) / (self.vector_norm * other.vector_norm) + * # ensure we get a scalar back (numpy does this automatically but cupy doesn't) + * return result.item() # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_result; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_11 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_item, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":128 + * return True if Lexeme.c_check_flag(self.c, flag_id) else False + * + * def similarity(self, other): # <<<<<<<<<<<<<< + * """Compute a semantic similarity estimate. Defaults to cosine over + * vectors. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.similarity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_vector); + __Pyx_XDECREF(__pyx_v_xp); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":155 + * return result.item() + * + * @property # <<<<<<<<<<<<<< + * def has_vector(self): + * """RETURNS (bool): Whether a word vector is associated with the object. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_10has_vector_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_10has_vector_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_10has_vector___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_10has_vector___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":159 + * """RETURNS (bool): Whether a word vector is associated with the object. + * """ + * return self.vocab.has_vector(self.c.orth) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_v_self->vocab); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->orth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_has_vector, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":155 + * return result.item() + * + * @property # <<<<<<<<<<<<<< + * def has_vector(self): + * """RETURNS (bool): Whether a word vector is associated with the object. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.has_vector.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":161 + * return self.vocab.has_vector(self.c.orth) + * + * @property # <<<<<<<<<<<<<< + * def vector_norm(self): + * """RETURNS (float): The L2 norm of the vector representation.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_11vector_norm_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_11vector_norm_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_11vector_norm___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_11vector_norm___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_v_vector = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":164 + * def vector_norm(self): + * """RETURNS (float): The L2 norm of the vector representation.""" + * vector = self.vector # <<<<<<<<<<<<<< + * return numpy.sqrt((vector**2).sum()) + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vector); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_vector = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":165 + * """RETURNS (float): The L2 norm of the vector representation.""" + * vector = self.vector + * return numpy.sqrt((vector**2).sum()) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sqrt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = PyNumber_Power(__pyx_v_vector, __pyx_mstate_global->__pyx_int_2, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __pyx_t_6; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sum, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_7 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":161 + * return self.vocab.has_vector(self.c.orth) + * + * @property # <<<<<<<<<<<<<< + * def vector_norm(self): + * """RETURNS (float): The L2 norm of the vector representation.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.vector_norm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_vector); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":167 + * return numpy.sqrt((vector**2).sum()) + * + * @property # <<<<<<<<<<<<<< + * def vector(self): + * """A real-valued meaning representation. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_6vector_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_6vector_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_6vector___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6vector___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + int __pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":174 + * representing the lexeme's semantics. + * """ + * cdef int length = self.vocab.vectors_length # <<<<<<<<<<<<<< + * if length == 0: + * raise ValueError(Errors.E010) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_vectors_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_length = __pyx_t_2; + + /* "spacy/lexeme.pyx":175 + * """ + * cdef int length = self.vocab.vectors_length + * if length == 0: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E010) + * return self.vocab.get_vector(self.c.orth) +*/ + __pyx_t_3 = (__pyx_v_length == 0); + if (unlikely(__pyx_t_3)) { + + /* "spacy/lexeme.pyx":176 + * cdef int length = self.vocab.vectors_length + * if length == 0: + * raise ValueError(Errors.E010) # <<<<<<<<<<<<<< + * return self.vocab.get_vector(self.c.orth) + * +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_E010); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 176, __pyx_L1_error) + + /* "spacy/lexeme.pyx":175 + * """ + * cdef int length = self.vocab.vectors_length + * if length == 0: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E010) + * return self.vocab.get_vector(self.c.orth) +*/ + } + + /* "spacy/lexeme.pyx":177 + * if length == 0: + * raise ValueError(Errors.E010) + * return self.vocab.get_vector(self.c.orth) # <<<<<<<<<<<<<< + * + * @vector.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = ((PyObject *)__pyx_v_self->vocab); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->orth); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_vector, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":167 + * return numpy.sqrt((vector**2).sum()) + * + * @property # <<<<<<<<<<<<<< + * def vector(self): + * """A real-valued meaning representation. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.vector.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":179 + * return self.vocab.get_vector(self.c.orth) + * + * @vector.setter # <<<<<<<<<<<<<< + * def vector(self, vector): + * if len(vector) != self.vocab.vectors_length: +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_6vector_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_vector); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_6vector_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_vector) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_6vector_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((PyObject *)__pyx_v_vector)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_6vector_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_vector) { + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/lexeme.pyx":181 + * @vector.setter + * def vector(self, vector): + * if len(vector) != self.vocab.vectors_length: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E073.format(new_length=len(vector), + * length=self.vocab.vectors_length)) +*/ + __pyx_t_1 = PyObject_Length(__pyx_v_vector); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_vectors_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(__pyx_t_5)) { + + /* "spacy/lexeme.pyx":182 + * def vector(self, vector): + * if len(vector) != self.vocab.vectors_length: + * raise ValueError(Errors.E073.format(new_length=len(vector), # <<<<<<<<<<<<<< + * length=self.vocab.vectors_length)) + * self.vocab.set_vector(self.c.orth, vector) +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E073); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_1 = PyObject_Length(__pyx_v_vector); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_7 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + + /* "spacy/lexeme.pyx":183 + * if len(vector) != self.vocab.vectors_length: + * raise ValueError(Errors.E073.format(new_length=len(vector), + * length=self.vocab.vectors_length)) # <<<<<<<<<<<<<< + * self.vocab.set_vector(self.c.orth, vector) + * +*/ + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_vectors_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_new_length, __pyx_t_7, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 182, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_length, __pyx_t_9, __pyx_t_11, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_2}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 182, __pyx_L1_error) + + /* "spacy/lexeme.pyx":181 + * @vector.setter + * def vector(self, vector): + * if len(vector) != self.vocab.vectors_length: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E073.format(new_length=len(vector), + * length=self.vocab.vectors_length)) +*/ + } + + /* "spacy/lexeme.pyx":184 + * raise ValueError(Errors.E073.format(new_length=len(vector), + * length=self.vocab.vectors_length)) + * self.vocab.set_vector(self.c.orth, vector) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self->vocab); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->orth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_3, __pyx_v_vector}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_set_vector, __pyx_callargs+__pyx_t_10, (3-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/lexeme.pyx":179 + * return self.vocab.get_vector(self.c.orth) + * + * @vector.setter # <<<<<<<<<<<<<< + * def vector(self, vector): + * if len(vector) != self.vocab.vectors_length: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.vector.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":186 + * self.vocab.set_vector(self.c.orth, vector) + * + * @property # <<<<<<<<<<<<<< + * def rank(self): + * """RETURNS (str): Sequential ID of the lexeme's lexical type, used +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_4rank_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_4rank_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_4rank___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_4rank___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":190 + * """RETURNS (str): Sequential ID of the lexeme's lexical type, used + * to index into tables, e.g. for word vectors.""" + * return self.c.id # <<<<<<<<<<<<<< + * + * @rank.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":186 + * self.vocab.set_vector(self.c.orth, vector) + * + * @property # <<<<<<<<<<<<<< + * def rank(self): + * """RETURNS (str): Sequential ID of the lexeme's lexical type, used +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.rank.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":192 + * return self.c.id + * + * @rank.setter # <<<<<<<<<<<<<< + * def rank(self, value): + * self.c.id = value +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_4rank_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_4rank_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_4rank_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_4rank_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "spacy/lexeme.pyx":194 + * @rank.setter + * def rank(self, value): + * self.c.id = value # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_1 = __Pyx_PyLong_As_uint64_t(__pyx_v_value); if (unlikely((__pyx_t_1 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_v_self->c->id = __pyx_t_1; + + /* "spacy/lexeme.pyx":192 + * return self.c.id + * + * @rank.setter # <<<<<<<<<<<<<< + * def rank(self, value): + * self.c.id = value +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.rank.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":196 + * self.c.id = value + * + * @property # <<<<<<<<<<<<<< + * def sentiment(self): + * """RETURNS (float): A scalar value indicating the positivity or +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_9sentiment_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_9sentiment_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_9sentiment___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_9sentiment___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_v_sentiment_table = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":200 + * """RETURNS (float): A scalar value indicating the positivity or + * negativity of the lexeme.""" + * sentiment_table = self.vocab.lookups.get_table("lexeme_sentiment", {}) # <<<<<<<<<<<<<< + * return sentiment_table.get(self.c.orth, 0.0) + * +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_lexeme_sentiment, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_table, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_sentiment_table = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":201 + * negativity of the lexeme.""" + * sentiment_table = self.vocab.lookups.get_table("lexeme_sentiment", {}) + * return sentiment_table.get(self.c.orth, 0.0) # <<<<<<<<<<<<<< + * + * @sentiment.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __pyx_v_sentiment_table; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->orth); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_4, __pyx_mstate_global->__pyx_float_0_0}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":196 + * self.c.id = value + * + * @property # <<<<<<<<<<<<<< + * def sentiment(self): + * """RETURNS (float): A scalar value indicating the positivity or +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.sentiment.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_sentiment_table); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":203 + * return sentiment_table.get(self.c.orth, 0.0) + * + * @sentiment.setter # <<<<<<<<<<<<<< + * def sentiment(self, float x): + * if "lexeme_sentiment" not in self.vocab.lookups: +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_9sentiment_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_9sentiment_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + float __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyFloat_AsFloat(__pyx_arg_x); if (unlikely((__pyx_v_x == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 204, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.sentiment.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_9sentiment_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((float)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_9sentiment_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, float __pyx_v_x) { + PyObject *__pyx_v_sentiment_table = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/lexeme.pyx":205 + * @sentiment.setter + * def sentiment(self, float x): + * if "lexeme_sentiment" not in self.vocab.lookups: # <<<<<<<<<<<<<< + * self.vocab.lookups.add_table("lexeme_sentiment") + * sentiment_table = self.vocab.lookups.get_table("lexeme_sentiment") +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_lexeme_sentiment, __pyx_t_1, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/lexeme.pyx":206 + * def sentiment(self, float x): + * if "lexeme_sentiment" not in self.vocab.lookups: + * self.vocab.lookups.add_table("lexeme_sentiment") # <<<<<<<<<<<<<< + * sentiment_table = self.vocab.lookups.get_table("lexeme_sentiment") + * sentiment_table[self.c.orth] = x +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_lexeme_sentiment}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add_table, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":205 + * @sentiment.setter + * def sentiment(self, float x): + * if "lexeme_sentiment" not in self.vocab.lookups: # <<<<<<<<<<<<<< + * self.vocab.lookups.add_table("lexeme_sentiment") + * sentiment_table = self.vocab.lookups.get_table("lexeme_sentiment") +*/ + } + + /* "spacy/lexeme.pyx":207 + * if "lexeme_sentiment" not in self.vocab.lookups: + * self.vocab.lookups.add_table("lexeme_sentiment") + * sentiment_table = self.vocab.lookups.get_table("lexeme_sentiment") # <<<<<<<<<<<<<< + * sentiment_table[self.c.orth] = x + * +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_lexeme_sentiment}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_table, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_sentiment_table = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":208 + * self.vocab.lookups.add_table("lexeme_sentiment") + * sentiment_table = self.vocab.lookups.get_table("lexeme_sentiment") + * sentiment_table[self.c.orth] = x # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_v_sentiment_table, __pyx_v_self->c->orth, __pyx_t_1, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":203 + * return sentiment_table.get(self.c.orth, 0.0) + * + * @sentiment.setter # <<<<<<<<<<<<<< + * def sentiment(self, float x): + * if "lexeme_sentiment" not in self.vocab.lookups: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.sentiment.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_sentiment_table); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":210 + * sentiment_table[self.c.orth] = x + * + * @property # <<<<<<<<<<<<<< + * def orth_(self): + * """RETURNS (str): The original verbatim text of the lexeme +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5orth__1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5orth__1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_5orth____get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5orth____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":215 + * (identical to `Lexeme.text`). Exists mostly for consistency with + * the other attributes.""" + * return self.vocab.strings[self.c.orth] # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->vocab->strings), __pyx_v_self->c->orth, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":210 + * sentiment_table[self.c.orth] = x + * + * @property # <<<<<<<<<<<<<< + * def orth_(self): + * """RETURNS (str): The original verbatim text of the lexeme +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.orth_.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":217 + * return self.vocab.strings[self.c.orth] + * + * @property # <<<<<<<<<<<<<< + * def text(self): + * """RETURNS (str): The original verbatim text of the lexeme.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_4text_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_4text_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_4text___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_4text___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":220 + * def text(self): + * """RETURNS (str): The original verbatim text of the lexeme.""" + * return self.orth_ # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_orth_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":217 + * return self.vocab.strings[self.c.orth] + * + * @property # <<<<<<<<<<<<<< + * def text(self): + * """RETURNS (str): The original verbatim text of the lexeme.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":222 + * return self.orth_ + * + * @property # <<<<<<<<<<<<<< + * def lower(self): + * """RETURNS (uint64): Lowercase form of the lexeme.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5lower_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5lower_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_5lower___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5lower___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":225 + * def lower(self): + * """RETURNS (uint64): Lowercase form of the lexeme.""" + * return self.c.lower # <<<<<<<<<<<<<< + * + * @lower.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->lower); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":222 + * return self.orth_ + * + * @property # <<<<<<<<<<<<<< + * def lower(self): + * """RETURNS (uint64): Lowercase form of the lexeme.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.lower.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":227 + * return self.c.lower + * + * @lower.setter # <<<<<<<<<<<<<< + * def lower(self, attr_t x): + * self.c.lower = x +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_5lower_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_5lower_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyLong_As_uint64_t(__pyx_arg_x); if (unlikely((__pyx_v_x == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.lower.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_5lower_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((__pyx_t_5spacy_8typedefs_attr_t)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_5lower_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":229 + * @lower.setter + * def lower(self, attr_t x): + * self.c.lower = x # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_v_self->c->lower = __pyx_v_x; + + /* "spacy/lexeme.pyx":227 + * return self.c.lower + * + * @lower.setter # <<<<<<<<<<<<<< + * def lower(self, attr_t x): + * self.c.lower = x +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":231 + * self.c.lower = x + * + * @property # <<<<<<<<<<<<<< + * def norm(self): + * """RETURNS (uint64): The lexeme's norm, i.e. a normalised form of the +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_4norm_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_4norm_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_4norm___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_4norm___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":236 + * lexeme text. + * """ + * return self.c.norm # <<<<<<<<<<<<<< + * + * @norm.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->norm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":231 + * self.c.lower = x + * + * @property # <<<<<<<<<<<<<< + * def norm(self): + * """RETURNS (uint64): The lexeme's norm, i.e. a normalised form of the +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.norm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":238 + * return self.c.norm + * + * @norm.setter # <<<<<<<<<<<<<< + * def norm(self, attr_t x): + * if "lexeme_norm" not in self.vocab.lookups: +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_4norm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_4norm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyLong_As_uint64_t(__pyx_arg_x); if (unlikely((__pyx_v_x == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 239, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.norm.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_4norm_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((__pyx_t_5spacy_8typedefs_attr_t)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_4norm_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x) { + PyObject *__pyx_v_norm_table = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/lexeme.pyx":240 + * @norm.setter + * def norm(self, attr_t x): + * if "lexeme_norm" not in self.vocab.lookups: # <<<<<<<<<<<<<< + * self.vocab.lookups.add_table("lexeme_norm") + * norm_table = self.vocab.lookups.get_table("lexeme_norm") +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_lexeme_norm, __pyx_t_1, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/lexeme.pyx":241 + * def norm(self, attr_t x): + * if "lexeme_norm" not in self.vocab.lookups: + * self.vocab.lookups.add_table("lexeme_norm") # <<<<<<<<<<<<<< + * norm_table = self.vocab.lookups.get_table("lexeme_norm") + * norm_table[self.c.orth] = self.vocab.strings[x] +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_lexeme_norm}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add_table, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":240 + * @norm.setter + * def norm(self, attr_t x): + * if "lexeme_norm" not in self.vocab.lookups: # <<<<<<<<<<<<<< + * self.vocab.lookups.add_table("lexeme_norm") + * norm_table = self.vocab.lookups.get_table("lexeme_norm") +*/ + } + + /* "spacy/lexeme.pyx":242 + * if "lexeme_norm" not in self.vocab.lookups: + * self.vocab.lookups.add_table("lexeme_norm") + * norm_table = self.vocab.lookups.get_table("lexeme_norm") # <<<<<<<<<<<<<< + * norm_table[self.c.orth] = self.vocab.strings[x] + * self.c.norm = x +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_lexeme_norm}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_table, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_norm_table = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":243 + * self.vocab.lookups.add_table("lexeme_norm") + * norm_table = self.vocab.lookups.get_table("lexeme_norm") + * norm_table[self.c.orth] = self.vocab.strings[x] # <<<<<<<<<<<<<< + * self.c.norm = x + * +*/ + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->vocab->strings), __pyx_v_x, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_v_norm_table, __pyx_v_self->c->orth, __pyx_t_1, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":244 + * norm_table = self.vocab.lookups.get_table("lexeme_norm") + * norm_table[self.c.orth] = self.vocab.strings[x] + * self.c.norm = x # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_v_self->c->norm = __pyx_v_x; + + /* "spacy/lexeme.pyx":238 + * return self.c.norm + * + * @norm.setter # <<<<<<<<<<<<<< + * def norm(self, attr_t x): + * if "lexeme_norm" not in self.vocab.lookups: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.norm.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_norm_table); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":246 + * self.c.norm = x + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * """RETURNS (uint64): Transform of the word's string, to show +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_5shape___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5shape___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":251 + * orthographic features. + * """ + * return self.c.shape # <<<<<<<<<<<<<< + * + * @shape.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":246 + * self.c.norm = x + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * """RETURNS (uint64): Transform of the word's string, to show +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":253 + * return self.c.shape + * + * @shape.setter # <<<<<<<<<<<<<< + * def shape(self, attr_t x): + * self.c.shape = x +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_5shape_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_5shape_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyLong_As_uint64_t(__pyx_arg_x); if (unlikely((__pyx_v_x == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 254, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.shape.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_5shape_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((__pyx_t_5spacy_8typedefs_attr_t)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_5shape_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":255 + * @shape.setter + * def shape(self, attr_t x): + * self.c.shape = x # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_v_self->c->shape = __pyx_v_x; + + /* "spacy/lexeme.pyx":253 + * return self.c.shape + * + * @shape.setter # <<<<<<<<<<<<<< + * def shape(self, attr_t x): + * self.c.shape = x +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":257 + * self.c.shape = x + * + * @property # <<<<<<<<<<<<<< + * def prefix(self): + * """RETURNS (uint64): Length-N substring from the start of the word. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_6prefix_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_6prefix_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_6prefix___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6prefix___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":262 + * Defaults to `N=1`. + * """ + * return self.c.prefix # <<<<<<<<<<<<<< + * + * @prefix.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":257 + * self.c.shape = x + * + * @property # <<<<<<<<<<<<<< + * def prefix(self): + * """RETURNS (uint64): Length-N substring from the start of the word. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.prefix.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":264 + * return self.c.prefix + * + * @prefix.setter # <<<<<<<<<<<<<< + * def prefix(self, attr_t x): + * self.c.prefix = x +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_6prefix_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_6prefix_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyLong_As_uint64_t(__pyx_arg_x); if (unlikely((__pyx_v_x == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 265, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.prefix.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_6prefix_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((__pyx_t_5spacy_8typedefs_attr_t)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_6prefix_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":266 + * @prefix.setter + * def prefix(self, attr_t x): + * self.c.prefix = x # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_v_self->c->prefix = __pyx_v_x; + + /* "spacy/lexeme.pyx":264 + * return self.c.prefix + * + * @prefix.setter # <<<<<<<<<<<<<< + * def prefix(self, attr_t x): + * self.c.prefix = x +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":268 + * self.c.prefix = x + * + * @property # <<<<<<<<<<<<<< + * def suffix(self): + * """RETURNS (uint64): Length-N substring from the end of the word. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_6suffix_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_6suffix_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_6suffix___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6suffix___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":273 + * Defaults to `N=3`. + * """ + * return self.c.suffix # <<<<<<<<<<<<<< + * + * @suffix.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->suffix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":268 + * self.c.prefix = x + * + * @property # <<<<<<<<<<<<<< + * def suffix(self): + * """RETURNS (uint64): Length-N substring from the end of the word. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.suffix.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":275 + * return self.c.suffix + * + * @suffix.setter # <<<<<<<<<<<<<< + * def suffix(self, attr_t x): + * self.c.suffix = x +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_6suffix_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_6suffix_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyLong_As_uint64_t(__pyx_arg_x); if (unlikely((__pyx_v_x == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.suffix.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_6suffix_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((__pyx_t_5spacy_8typedefs_attr_t)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_6suffix_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":277 + * @suffix.setter + * def suffix(self, attr_t x): + * self.c.suffix = x # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_v_self->c->suffix = __pyx_v_x; + + /* "spacy/lexeme.pyx":275 + * return self.c.suffix + * + * @suffix.setter # <<<<<<<<<<<<<< + * def suffix(self, attr_t x): + * self.c.suffix = x +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":279 + * self.c.suffix = x + * + * @property # <<<<<<<<<<<<<< + * def cluster(self): + * """RETURNS (int): Brown cluster ID.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_7cluster_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_7cluster_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_7cluster___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_7cluster___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_v_cluster_table = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":282 + * def cluster(self): + * """RETURNS (int): Brown cluster ID.""" + * cluster_table = self.vocab.lookups.get_table("lexeme_cluster", {}) # <<<<<<<<<<<<<< + * return cluster_table.get(self.c.orth, 0) + * +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_lexeme_cluster, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_table, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_cluster_table = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":283 + * """RETURNS (int): Brown cluster ID.""" + * cluster_table = self.vocab.lookups.get_table("lexeme_cluster", {}) + * return cluster_table.get(self.c.orth, 0) # <<<<<<<<<<<<<< + * + * @cluster.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __pyx_v_cluster_table; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->orth); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_4, __pyx_mstate_global->__pyx_int_0}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":279 + * self.c.suffix = x + * + * @property # <<<<<<<<<<<<<< + * def cluster(self): + * """RETURNS (int): Brown cluster ID.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.cluster.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_cluster_table); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":285 + * return cluster_table.get(self.c.orth, 0) + * + * @cluster.setter # <<<<<<<<<<<<<< + * def cluster(self, int x): + * cluster_table = self.vocab.lookups.get_table("lexeme_cluster", {}) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_7cluster_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_7cluster_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyLong_As_int(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.cluster.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_7cluster_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_7cluster_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + PyObject *__pyx_v_cluster_table = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/lexeme.pyx":287 + * @cluster.setter + * def cluster(self, int x): + * cluster_table = self.vocab.lookups.get_table("lexeme_cluster", {}) # <<<<<<<<<<<<<< + * cluster_table[self.c.orth] = x + * +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_lexeme_cluster, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_table, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_cluster_table = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":288 + * def cluster(self, int x): + * cluster_table = self.vocab.lookups.get_table("lexeme_cluster", {}) + * cluster_table[self.c.orth] = x # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_v_cluster_table, __pyx_v_self->c->orth, __pyx_t_1, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":285 + * return cluster_table.get(self.c.orth, 0) + * + * @cluster.setter # <<<<<<<<<<<<<< + * def cluster(self, int x): + * cluster_table = self.vocab.lookups.get_table("lexeme_cluster", {}) +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.cluster.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_cluster_table); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":290 + * cluster_table[self.c.orth] = x + * + * @property # <<<<<<<<<<<<<< + * def lang(self): + * """RETURNS (uint64): Language of the parent vocabulary.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_4lang_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_4lang_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_4lang___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_4lang___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":293 + * def lang(self): + * """RETURNS (uint64): Language of the parent vocabulary.""" + * return self.c.lang # <<<<<<<<<<<<<< + * + * @lang.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->lang); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":290 + * cluster_table[self.c.orth] = x + * + * @property # <<<<<<<<<<<<<< + * def lang(self): + * """RETURNS (uint64): Language of the parent vocabulary.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.lang.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":295 + * return self.c.lang + * + * @lang.setter # <<<<<<<<<<<<<< + * def lang(self, attr_t x): + * self.c.lang = x +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_4lang_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_4lang_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyLong_As_uint64_t(__pyx_arg_x); if (unlikely((__pyx_v_x == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.lang.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_4lang_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((__pyx_t_5spacy_8typedefs_attr_t)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_4lang_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":297 + * @lang.setter + * def lang(self, attr_t x): + * self.c.lang = x # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_v_self->c->lang = __pyx_v_x; + + /* "spacy/lexeme.pyx":295 + * return self.c.lang + * + * @lang.setter # <<<<<<<<<<<<<< + * def lang(self, attr_t x): + * self.c.lang = x +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":299 + * self.c.lang = x + * + * @property # <<<<<<<<<<<<<< + * def prob(self): + * """RETURNS (float): Smoothed log probability estimate of the lexeme's +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_4prob_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_4prob_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_4prob___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_4prob___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_v_prob_table = NULL; + PyObject *__pyx_v_settings_table = NULL; + PyObject *__pyx_v_default_oov_prob = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":303 + * """RETURNS (float): Smoothed log probability estimate of the lexeme's + * type.""" + * prob_table = self.vocab.lookups.get_table("lexeme_prob", {}) # <<<<<<<<<<<<<< + * settings_table = self.vocab.lookups.get_table("lexeme_settings", {}) + * default_oov_prob = settings_table.get("oov_prob", -20.0) +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_lexeme_prob, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_table, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_prob_table = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":304 + * type.""" + * prob_table = self.vocab.lookups.get_table("lexeme_prob", {}) + * settings_table = self.vocab.lookups.get_table("lexeme_settings", {}) # <<<<<<<<<<<<<< + * default_oov_prob = settings_table.get("oov_prob", -20.0) + * return prob_table.get(self.c.orth, default_oov_prob) +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_lexeme_settings, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_table, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_settings_table = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":305 + * prob_table = self.vocab.lookups.get_table("lexeme_prob", {}) + * settings_table = self.vocab.lookups.get_table("lexeme_settings", {}) + * default_oov_prob = settings_table.get("oov_prob", -20.0) # <<<<<<<<<<<<<< + * return prob_table.get(self.c.orth, default_oov_prob) + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_settings_table, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_default_oov_prob = __pyx_t_4; + __pyx_t_4 = 0; + + /* "spacy/lexeme.pyx":306 + * settings_table = self.vocab.lookups.get_table("lexeme_settings", {}) + * default_oov_prob = settings_table.get("oov_prob", -20.0) + * return prob_table.get(self.c.orth, default_oov_prob) # <<<<<<<<<<<<<< + * + * @prob.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_v_prob_table; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->orth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_2, __pyx_v_default_oov_prob}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":299 + * self.c.lang = x + * + * @property # <<<<<<<<<<<<<< + * def prob(self): + * """RETURNS (float): Smoothed log probability estimate of the lexeme's +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.prob.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_prob_table); + __Pyx_XDECREF(__pyx_v_settings_table); + __Pyx_XDECREF(__pyx_v_default_oov_prob); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":308 + * return prob_table.get(self.c.orth, default_oov_prob) + * + * @prob.setter # <<<<<<<<<<<<<< + * def prob(self, float x): + * prob_table = self.vocab.lookups.get_table("lexeme_prob", {}) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_4prob_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_4prob_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + float __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyFloat_AsFloat(__pyx_arg_x); if (unlikely((__pyx_v_x == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.prob.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_4prob_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((float)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_4prob_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, float __pyx_v_x) { + PyObject *__pyx_v_prob_table = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/lexeme.pyx":310 + * @prob.setter + * def prob(self, float x): + * prob_table = self.vocab.lookups.get_table("lexeme_prob", {}) # <<<<<<<<<<<<<< + * prob_table[self.c.orth] = x + * +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_lexeme_prob, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_table, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_prob_table = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":311 + * def prob(self, float x): + * prob_table = self.vocab.lookups.get_table("lexeme_prob", {}) + * prob_table[self.c.orth] = x # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_v_prob_table, __pyx_v_self->c->orth, __pyx_t_1, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":308 + * return prob_table.get(self.c.orth, default_oov_prob) + * + * @prob.setter # <<<<<<<<<<<<<< + * def prob(self, float x): + * prob_table = self.vocab.lookups.get_table("lexeme_prob", {}) +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.prob.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_prob_table); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":313 + * prob_table[self.c.orth] = x + * + * @property # <<<<<<<<<<<<<< + * def lower_(self): + * """RETURNS (str): Lowercase form of the word.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_6lower__1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_6lower__1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_6lower____get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6lower____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":316 + * def lower_(self): + * """RETURNS (str): Lowercase form of the word.""" + * return self.vocab.strings[self.c.lower] # <<<<<<<<<<<<<< + * + * @lower_.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->vocab->strings), __pyx_v_self->c->lower, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":313 + * prob_table[self.c.orth] = x + * + * @property # <<<<<<<<<<<<<< + * def lower_(self): + * """RETURNS (str): Lowercase form of the word.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.lower_.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":318 + * return self.vocab.strings[self.c.lower] + * + * @lower_.setter # <<<<<<<<<<<<<< + * def lower_(self, str x): + * self.c.lower = self.vocab.strings.add(x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_6lower__3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_6lower__3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), (&PyUnicode_Type), 1, "x", 1))) __PYX_ERR(0, 319, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_6lower__2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((PyObject*)__pyx_v_x)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + goto __pyx_L5_cleaned_up; + __pyx_L0:; + __pyx_L5_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_6lower__2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_x) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/lexeme.pyx":320 + * @lower_.setter + * def lower_(self, str x): + * self.c.lower = self.vocab.strings.add(x) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self->vocab->strings); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_x}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyLong_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->c->lower = __pyx_t_4; + + /* "spacy/lexeme.pyx":318 + * return self.vocab.strings[self.c.lower] + * + * @lower_.setter # <<<<<<<<<<<<<< + * def lower_(self, str x): + * self.c.lower = self.vocab.strings.add(x) +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.lower_.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":322 + * self.c.lower = self.vocab.strings.add(x) + * + * @property # <<<<<<<<<<<<<< + * def norm_(self): + * """RETURNS (str): The lexeme's norm, i.e. a normalised form of the +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5norm__1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5norm__1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_5norm____get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5norm____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":327 + * lexeme text. + * """ + * return self.vocab.strings[self.c.norm] # <<<<<<<<<<<<<< + * + * @norm_.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->vocab->strings), __pyx_v_self->c->norm, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":322 + * self.c.lower = self.vocab.strings.add(x) + * + * @property # <<<<<<<<<<<<<< + * def norm_(self): + * """RETURNS (str): The lexeme's norm, i.e. a normalised form of the +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.norm_.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":329 + * return self.vocab.strings[self.c.norm] + * + * @norm_.setter # <<<<<<<<<<<<<< + * def norm_(self, str x): + * self.norm = self.vocab.strings.add(x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_5norm__3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_5norm__3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), (&PyUnicode_Type), 1, "x", 1))) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_5norm__2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((PyObject*)__pyx_v_x)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + goto __pyx_L5_cleaned_up; + __pyx_L0:; + __pyx_L5_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_5norm__2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_x) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/lexeme.pyx":331 + * @norm_.setter + * def norm_(self, str x): + * self.norm = self.vocab.strings.add(x) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self->vocab->strings); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_x}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_norm, __pyx_t_1) < (0)) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/lexeme.pyx":329 + * return self.vocab.strings[self.c.norm] + * + * @norm_.setter # <<<<<<<<<<<<<< + * def norm_(self, str x): + * self.norm = self.vocab.strings.add(x) +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.norm_.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":333 + * self.norm = self.vocab.strings.add(x) + * + * @property # <<<<<<<<<<<<<< + * def shape_(self): + * """RETURNS (str): Transform of the word's string, to show +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_6shape__1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_6shape__1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_6shape____get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6shape____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":338 + * orthographic features. + * """ + * return self.vocab.strings[self.c.shape] # <<<<<<<<<<<<<< + * + * @shape_.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->vocab->strings), __pyx_v_self->c->shape, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":333 + * self.norm = self.vocab.strings.add(x) + * + * @property # <<<<<<<<<<<<<< + * def shape_(self): + * """RETURNS (str): Transform of the word's string, to show +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.shape_.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":340 + * return self.vocab.strings[self.c.shape] + * + * @shape_.setter # <<<<<<<<<<<<<< + * def shape_(self, str x): + * self.c.shape = self.vocab.strings.add(x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_6shape__3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_6shape__3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), (&PyUnicode_Type), 1, "x", 1))) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_6shape__2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((PyObject*)__pyx_v_x)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + goto __pyx_L5_cleaned_up; + __pyx_L0:; + __pyx_L5_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_6shape__2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_x) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/lexeme.pyx":342 + * @shape_.setter + * def shape_(self, str x): + * self.c.shape = self.vocab.strings.add(x) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self->vocab->strings); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_x}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyLong_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->c->shape = __pyx_t_4; + + /* "spacy/lexeme.pyx":340 + * return self.vocab.strings[self.c.shape] + * + * @shape_.setter # <<<<<<<<<<<<<< + * def shape_(self, str x): + * self.c.shape = self.vocab.strings.add(x) +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.shape_.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":344 + * self.c.shape = self.vocab.strings.add(x) + * + * @property # <<<<<<<<<<<<<< + * def prefix_(self): + * """RETURNS (str): Length-N substring from the start of the word. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_7prefix__1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_7prefix__1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_7prefix____get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_7prefix____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":349 + * Defaults to `N=1`. + * """ + * return self.vocab.strings[self.c.prefix] # <<<<<<<<<<<<<< + * + * @prefix_.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->vocab->strings), __pyx_v_self->c->prefix, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":344 + * self.c.shape = self.vocab.strings.add(x) + * + * @property # <<<<<<<<<<<<<< + * def prefix_(self): + * """RETURNS (str): Length-N substring from the start of the word. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.prefix_.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":351 + * return self.vocab.strings[self.c.prefix] + * + * @prefix_.setter # <<<<<<<<<<<<<< + * def prefix_(self, str x): + * self.c.prefix = self.vocab.strings.add(x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_7prefix__3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_7prefix__3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), (&PyUnicode_Type), 1, "x", 1))) __PYX_ERR(0, 352, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_7prefix__2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((PyObject*)__pyx_v_x)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + goto __pyx_L5_cleaned_up; + __pyx_L0:; + __pyx_L5_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_7prefix__2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_x) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/lexeme.pyx":353 + * @prefix_.setter + * def prefix_(self, str x): + * self.c.prefix = self.vocab.strings.add(x) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self->vocab->strings); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_x}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyLong_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->c->prefix = __pyx_t_4; + + /* "spacy/lexeme.pyx":351 + * return self.vocab.strings[self.c.prefix] + * + * @prefix_.setter # <<<<<<<<<<<<<< + * def prefix_(self, str x): + * self.c.prefix = self.vocab.strings.add(x) +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.prefix_.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":355 + * self.c.prefix = self.vocab.strings.add(x) + * + * @property # <<<<<<<<<<<<<< + * def suffix_(self): + * """RETURNS (str): Length-N substring from the end of the word. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_7suffix__1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_7suffix__1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_7suffix____get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_7suffix____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":360 + * Defaults to `N=3`. + * """ + * return self.vocab.strings[self.c.suffix] # <<<<<<<<<<<<<< + * + * @suffix_.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->vocab->strings), __pyx_v_self->c->suffix, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":355 + * self.c.prefix = self.vocab.strings.add(x) + * + * @property # <<<<<<<<<<<<<< + * def suffix_(self): + * """RETURNS (str): Length-N substring from the end of the word. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.suffix_.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":362 + * return self.vocab.strings[self.c.suffix] + * + * @suffix_.setter # <<<<<<<<<<<<<< + * def suffix_(self, str x): + * self.c.suffix = self.vocab.strings.add(x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_7suffix__3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_7suffix__3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), (&PyUnicode_Type), 1, "x", 1))) __PYX_ERR(0, 363, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_7suffix__2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((PyObject*)__pyx_v_x)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + goto __pyx_L5_cleaned_up; + __pyx_L0:; + __pyx_L5_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_7suffix__2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_x) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/lexeme.pyx":364 + * @suffix_.setter + * def suffix_(self, str x): + * self.c.suffix = self.vocab.strings.add(x) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self->vocab->strings); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_x}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyLong_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->c->suffix = __pyx_t_4; + + /* "spacy/lexeme.pyx":362 + * return self.vocab.strings[self.c.suffix] + * + * @suffix_.setter # <<<<<<<<<<<<<< + * def suffix_(self, str x): + * self.c.suffix = self.vocab.strings.add(x) +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.suffix_.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":366 + * self.c.suffix = self.vocab.strings.add(x) + * + * @property # <<<<<<<<<<<<<< + * def lang_(self): + * """RETURNS (str): Language of the parent vocabulary.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5lang__1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5lang__1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_5lang____get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5lang____get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":369 + * def lang_(self): + * """RETURNS (str): Language of the parent vocabulary.""" + * return self.vocab.strings[self.c.lang] # <<<<<<<<<<<<<< + * + * @lang_.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->vocab->strings), __pyx_v_self->c->lang, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":366 + * self.c.suffix = self.vocab.strings.add(x) + * + * @property # <<<<<<<<<<<<<< + * def lang_(self): + * """RETURNS (str): Language of the parent vocabulary.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.lang_.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":371 + * return self.vocab.strings[self.c.lang] + * + * @lang_.setter # <<<<<<<<<<<<<< + * def lang_(self, str x): + * self.c.lang = self.vocab.strings.add(x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_5lang__3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_5lang__3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), (&PyUnicode_Type), 1, "x", 1))) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_5lang__2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((PyObject*)__pyx_v_x)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + goto __pyx_L5_cleaned_up; + __pyx_L0:; + __pyx_L5_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_5lang__2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, PyObject *__pyx_v_x) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/lexeme.pyx":373 + * @lang_.setter + * def lang_(self, str x): + * self.c.lang = self.vocab.strings.add(x) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self->vocab->strings); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_x}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyLong_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->c->lang = __pyx_t_4; + + /* "spacy/lexeme.pyx":371 + * return self.vocab.strings[self.c.lang] + * + * @lang_.setter # <<<<<<<<<<<<<< + * def lang_(self, str x): + * self.c.lang = self.vocab.strings.add(x) +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.lang_.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":375 + * self.c.lang = self.vocab.strings.add(x) + * + * @property # <<<<<<<<<<<<<< + * def flags(self): + * """RETURNS (uint64): Container of the lexeme's binary flags.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5flags_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5flags_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_5flags___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5flags___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":378 + * def flags(self): + * """RETURNS (uint64): Container of the lexeme's binary flags.""" + * return self.c.flags # <<<<<<<<<<<<<< + * + * @flags.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->c->flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":375 + * self.c.lang = self.vocab.strings.add(x) + * + * @property # <<<<<<<<<<<<<< + * def flags(self): + * """RETURNS (uint64): Container of the lexeme's binary flags.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.flags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":380 + * return self.c.flags + * + * @flags.setter # <<<<<<<<<<<<<< + * def flags(self, flags_t x): + * self.c.flags = x +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_5flags_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_5flags_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyLong_As_uint64_t(__pyx_arg_x); if (unlikely((__pyx_v_x == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 381, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.flags.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_5flags_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((__pyx_t_5spacy_8typedefs_flags_t)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_5flags_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, __pyx_t_5spacy_8typedefs_flags_t __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":382 + * @flags.setter + * def flags(self, flags_t x): + * self.c.flags = x # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_v_self->c->flags = __pyx_v_x; + + /* "spacy/lexeme.pyx":380 + * return self.c.flags + * + * @flags.setter # <<<<<<<<<<<<<< + * def flags(self, flags_t x): + * self.c.flags = x +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":384 + * self.c.flags = x + * + * @property # <<<<<<<<<<<<<< + * def is_oov(self): + * """RETURNS (bool): Whether the lexeme is out-of-vocabulary.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_6is_oov_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_6is_oov_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_6is_oov___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_6is_oov___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":387 + * def is_oov(self): + * """RETURNS (bool): Whether the lexeme is out-of-vocabulary.""" + * return self.orth not in self.vocab.vectors # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->orth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_t_2, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 387, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":384 + * self.c.flags = x + * + * @property # <<<<<<<<<<<<<< + * def is_oov(self): + * """RETURNS (bool): Whether the lexeme is out-of-vocabulary.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_oov.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":389 + * return self.orth not in self.vocab.vectors + * + * @property # <<<<<<<<<<<<<< + * def is_stop(self): + * """RETURNS (bool): Whether the lexeme is a stop word.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_7is_stop_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_7is_stop_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_7is_stop___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_7is_stop___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":392 + * def is_stop(self): + * """RETURNS (bool): Whether the lexeme is a stop word.""" + * return Lexeme.c_check_flag(self.c, IS_STOP) # <<<<<<<<<<<<<< + * + * @is_stop.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_STOP)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":389 + * return self.orth not in self.vocab.vectors + * + * @property # <<<<<<<<<<<<<< + * def is_stop(self): + * """RETURNS (bool): Whether the lexeme is a stop word.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_stop.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":394 + * return Lexeme.c_check_flag(self.c, IS_STOP) + * + * @is_stop.setter # <<<<<<<<<<<<<< + * def is_stop(self, bint x): + * Lexeme.c_set_flag(self.c, IS_STOP, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_7is_stop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_7is_stop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 395, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_stop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_7is_stop_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_7is_stop_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":396 + * @is_stop.setter + * def is_stop(self, bint x): + * Lexeme.c_set_flag(self.c, IS_STOP, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_STOP, __pyx_v_x)); + + /* "spacy/lexeme.pyx":394 + * return Lexeme.c_check_flag(self.c, IS_STOP) + * + * @is_stop.setter # <<<<<<<<<<<<<< + * def is_stop(self, bint x): + * Lexeme.c_set_flag(self.c, IS_STOP, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":398 + * Lexeme.c_set_flag(self.c, IS_STOP, x) + * + * @property # <<<<<<<<<<<<<< + * def is_alpha(self): + * """RETURNS (bool): Whether the lexeme consists of alphabetic +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_alpha_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_alpha_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_alpha___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_alpha___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":403 + * characters. Equivalent to `lexeme.text.isalpha()`. + * """ + * return Lexeme.c_check_flag(self.c, IS_ALPHA) # <<<<<<<<<<<<<< + * + * @is_alpha.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_ALPHA)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":398 + * Lexeme.c_set_flag(self.c, IS_STOP, x) + * + * @property # <<<<<<<<<<<<<< + * def is_alpha(self): + * """RETURNS (bool): Whether the lexeme consists of alphabetic +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_alpha.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":405 + * return Lexeme.c_check_flag(self.c, IS_ALPHA) + * + * @is_alpha.setter # <<<<<<<<<<<<<< + * def is_alpha(self, bint x): + * Lexeme.c_set_flag(self.c, IS_ALPHA, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_alpha_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_alpha_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 406, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_alpha.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_alpha_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_alpha_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":407 + * @is_alpha.setter + * def is_alpha(self, bint x): + * Lexeme.c_set_flag(self.c, IS_ALPHA, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_ALPHA, __pyx_v_x)); + + /* "spacy/lexeme.pyx":405 + * return Lexeme.c_check_flag(self.c, IS_ALPHA) + * + * @is_alpha.setter # <<<<<<<<<<<<<< + * def is_alpha(self, bint x): + * Lexeme.c_set_flag(self.c, IS_ALPHA, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":409 + * Lexeme.c_set_flag(self.c, IS_ALPHA, x) + * + * @property # <<<<<<<<<<<<<< + * def is_ascii(self): + * """RETURNS (bool): Whether the lexeme consists of ASCII characters. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_ascii_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_ascii_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_ascii___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_ascii___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":414 + * Equivalent to `[any(ord(c) >= 128 for c in lexeme.text)]`. + * """ + * return Lexeme.c_check_flag(self.c, IS_ASCII) # <<<<<<<<<<<<<< + * + * @is_ascii.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_ASCII)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":409 + * Lexeme.c_set_flag(self.c, IS_ALPHA, x) + * + * @property # <<<<<<<<<<<<<< + * def is_ascii(self): + * """RETURNS (bool): Whether the lexeme consists of ASCII characters. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_ascii.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":416 + * return Lexeme.c_check_flag(self.c, IS_ASCII) + * + * @is_ascii.setter # <<<<<<<<<<<<<< + * def is_ascii(self, bint x): + * Lexeme.c_set_flag(self.c, IS_ASCII, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_ascii_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_ascii_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 417, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_ascii.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_ascii_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_ascii_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":418 + * @is_ascii.setter + * def is_ascii(self, bint x): + * Lexeme.c_set_flag(self.c, IS_ASCII, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_ASCII, __pyx_v_x)); + + /* "spacy/lexeme.pyx":416 + * return Lexeme.c_check_flag(self.c, IS_ASCII) + * + * @is_ascii.setter # <<<<<<<<<<<<<< + * def is_ascii(self, bint x): + * Lexeme.c_set_flag(self.c, IS_ASCII, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":420 + * Lexeme.c_set_flag(self.c, IS_ASCII, x) + * + * @property # <<<<<<<<<<<<<< + * def is_digit(self): + * """RETURNS (bool): Whether the lexeme consists of digits. Equivalent +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_digit_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_digit_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_digit___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_digit___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":425 + * to `lexeme.text.isdigit()`. + * """ + * return Lexeme.c_check_flag(self.c, IS_DIGIT) # <<<<<<<<<<<<<< + * + * @is_digit.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_DIGIT)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":420 + * Lexeme.c_set_flag(self.c, IS_ASCII, x) + * + * @property # <<<<<<<<<<<<<< + * def is_digit(self): + * """RETURNS (bool): Whether the lexeme consists of digits. Equivalent +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_digit.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":427 + * return Lexeme.c_check_flag(self.c, IS_DIGIT) + * + * @is_digit.setter # <<<<<<<<<<<<<< + * def is_digit(self, bint x): + * Lexeme.c_set_flag(self.c, IS_DIGIT, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_digit_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_digit_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_digit.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_digit_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_digit_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":429 + * @is_digit.setter + * def is_digit(self, bint x): + * Lexeme.c_set_flag(self.c, IS_DIGIT, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_DIGIT, __pyx_v_x)); + + /* "spacy/lexeme.pyx":427 + * return Lexeme.c_check_flag(self.c, IS_DIGIT) + * + * @is_digit.setter # <<<<<<<<<<<<<< + * def is_digit(self, bint x): + * Lexeme.c_set_flag(self.c, IS_DIGIT, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":431 + * Lexeme.c_set_flag(self.c, IS_DIGIT, x) + * + * @property # <<<<<<<<<<<<<< + * def is_lower(self): + * """RETURNS (bool): Whether the lexeme is in lowercase. Equivalent to +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_lower_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_lower_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_lower___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_lower___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":436 + * `lexeme.text.islower()`. + * """ + * return Lexeme.c_check_flag(self.c, IS_LOWER) # <<<<<<<<<<<<<< + * + * @is_lower.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_LOWER)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":431 + * Lexeme.c_set_flag(self.c, IS_DIGIT, x) + * + * @property # <<<<<<<<<<<<<< + * def is_lower(self): + * """RETURNS (bool): Whether the lexeme is in lowercase. Equivalent to +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_lower.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":438 + * return Lexeme.c_check_flag(self.c, IS_LOWER) + * + * @is_lower.setter # <<<<<<<<<<<<<< + * def is_lower(self, bint x): + * Lexeme.c_set_flag(self.c, IS_LOWER, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_lower_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_lower_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 439, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_lower.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_lower_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_lower_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":440 + * @is_lower.setter + * def is_lower(self, bint x): + * Lexeme.c_set_flag(self.c, IS_LOWER, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_LOWER, __pyx_v_x)); + + /* "spacy/lexeme.pyx":438 + * return Lexeme.c_check_flag(self.c, IS_LOWER) + * + * @is_lower.setter # <<<<<<<<<<<<<< + * def is_lower(self, bint x): + * Lexeme.c_set_flag(self.c, IS_LOWER, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":442 + * Lexeme.c_set_flag(self.c, IS_LOWER, x) + * + * @property # <<<<<<<<<<<<<< + * def is_upper(self): + * """RETURNS (bool): Whether the lexeme is in uppercase. Equivalent to +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_upper_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_upper_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_upper___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_upper___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":447 + * `lexeme.text.isupper()`. + * """ + * return Lexeme.c_check_flag(self.c, IS_UPPER) # <<<<<<<<<<<<<< + * + * @is_upper.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_UPPER)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":442 + * Lexeme.c_set_flag(self.c, IS_LOWER, x) + * + * @property # <<<<<<<<<<<<<< + * def is_upper(self): + * """RETURNS (bool): Whether the lexeme is in uppercase. Equivalent to +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_upper.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":449 + * return Lexeme.c_check_flag(self.c, IS_UPPER) + * + * @is_upper.setter # <<<<<<<<<<<<<< + * def is_upper(self, bint x): + * Lexeme.c_set_flag(self.c, IS_UPPER, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_upper_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_upper_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 450, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_upper.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_upper_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_upper_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":451 + * @is_upper.setter + * def is_upper(self, bint x): + * Lexeme.c_set_flag(self.c, IS_UPPER, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_UPPER, __pyx_v_x)); + + /* "spacy/lexeme.pyx":449 + * return Lexeme.c_check_flag(self.c, IS_UPPER) + * + * @is_upper.setter # <<<<<<<<<<<<<< + * def is_upper(self, bint x): + * Lexeme.c_set_flag(self.c, IS_UPPER, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":453 + * Lexeme.c_set_flag(self.c, IS_UPPER, x) + * + * @property # <<<<<<<<<<<<<< + * def is_title(self): + * """RETURNS (bool): Whether the lexeme is in titlecase. Equivalent to +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_title_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_title_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_title___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_title___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":458 + * `lexeme.text.istitle()`. + * """ + * return Lexeme.c_check_flag(self.c, IS_TITLE) # <<<<<<<<<<<<<< + * + * @is_title.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_TITLE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":453 + * Lexeme.c_set_flag(self.c, IS_UPPER, x) + * + * @property # <<<<<<<<<<<<<< + * def is_title(self): + * """RETURNS (bool): Whether the lexeme is in titlecase. Equivalent to +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_title.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":460 + * return Lexeme.c_check_flag(self.c, IS_TITLE) + * + * @is_title.setter # <<<<<<<<<<<<<< + * def is_title(self, bint x): + * Lexeme.c_set_flag(self.c, IS_TITLE, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_title_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_title_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 461, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_title.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_title_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_title_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":462 + * @is_title.setter + * def is_title(self, bint x): + * Lexeme.c_set_flag(self.c, IS_TITLE, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_TITLE, __pyx_v_x)); + + /* "spacy/lexeme.pyx":460 + * return Lexeme.c_check_flag(self.c, IS_TITLE) + * + * @is_title.setter # <<<<<<<<<<<<<< + * def is_title(self, bint x): + * Lexeme.c_set_flag(self.c, IS_TITLE, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":464 + * Lexeme.c_set_flag(self.c, IS_TITLE, x) + * + * @property # <<<<<<<<<<<<<< + * def is_punct(self): + * """RETURNS (bool): Whether the lexeme is punctuation.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_punct_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_punct_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_punct___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_punct___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":467 + * def is_punct(self): + * """RETURNS (bool): Whether the lexeme is punctuation.""" + * return Lexeme.c_check_flag(self.c, IS_PUNCT) # <<<<<<<<<<<<<< + * + * @is_punct.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_PUNCT)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":464 + * Lexeme.c_set_flag(self.c, IS_TITLE, x) + * + * @property # <<<<<<<<<<<<<< + * def is_punct(self): + * """RETURNS (bool): Whether the lexeme is punctuation.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_punct.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":469 + * return Lexeme.c_check_flag(self.c, IS_PUNCT) + * + * @is_punct.setter # <<<<<<<<<<<<<< + * def is_punct(self, bint x): + * Lexeme.c_set_flag(self.c, IS_PUNCT, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_punct_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_punct_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 470, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_punct.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_punct_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_punct_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":471 + * @is_punct.setter + * def is_punct(self, bint x): + * Lexeme.c_set_flag(self.c, IS_PUNCT, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_PUNCT, __pyx_v_x)); + + /* "spacy/lexeme.pyx":469 + * return Lexeme.c_check_flag(self.c, IS_PUNCT) + * + * @is_punct.setter # <<<<<<<<<<<<<< + * def is_punct(self, bint x): + * Lexeme.c_set_flag(self.c, IS_PUNCT, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":473 + * Lexeme.c_set_flag(self.c, IS_PUNCT, x) + * + * @property # <<<<<<<<<<<<<< + * def is_space(self): + * """RETURNS (bool): Whether the lexeme consist of whitespace characters. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_space_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_space_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_space___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_space___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":478 + * Equivalent to `lexeme.text.isspace()`. + * """ + * return Lexeme.c_check_flag(self.c, IS_SPACE) # <<<<<<<<<<<<<< + * + * @is_space.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_SPACE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":473 + * Lexeme.c_set_flag(self.c, IS_PUNCT, x) + * + * @property # <<<<<<<<<<<<<< + * def is_space(self): + * """RETURNS (bool): Whether the lexeme consist of whitespace characters. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_space.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":480 + * return Lexeme.c_check_flag(self.c, IS_SPACE) + * + * @is_space.setter # <<<<<<<<<<<<<< + * def is_space(self, bint x): + * Lexeme.c_set_flag(self.c, IS_SPACE, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_space_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_space_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 481, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_space.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_space_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_space_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":482 + * @is_space.setter + * def is_space(self, bint x): + * Lexeme.c_set_flag(self.c, IS_SPACE, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_SPACE, __pyx_v_x)); + + /* "spacy/lexeme.pyx":480 + * return Lexeme.c_check_flag(self.c, IS_SPACE) + * + * @is_space.setter # <<<<<<<<<<<<<< + * def is_space(self, bint x): + * Lexeme.c_set_flag(self.c, IS_SPACE, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":484 + * Lexeme.c_set_flag(self.c, IS_SPACE, x) + * + * @property # <<<<<<<<<<<<<< + * def is_bracket(self): + * """RETURNS (bool): Whether the lexeme is a bracket.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_10is_bracket_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_10is_bracket_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_10is_bracket___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_10is_bracket___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":487 + * def is_bracket(self): + * """RETURNS (bool): Whether the lexeme is a bracket.""" + * return Lexeme.c_check_flag(self.c, IS_BRACKET) # <<<<<<<<<<<<<< + * + * @is_bracket.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_BRACKET)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":484 + * Lexeme.c_set_flag(self.c, IS_SPACE, x) + * + * @property # <<<<<<<<<<<<<< + * def is_bracket(self): + * """RETURNS (bool): Whether the lexeme is a bracket.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_bracket.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":489 + * return Lexeme.c_check_flag(self.c, IS_BRACKET) + * + * @is_bracket.setter # <<<<<<<<<<<<<< + * def is_bracket(self, bint x): + * Lexeme.c_set_flag(self.c, IS_BRACKET, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_10is_bracket_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_10is_bracket_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 490, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_bracket.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_10is_bracket_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_10is_bracket_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":491 + * @is_bracket.setter + * def is_bracket(self, bint x): + * Lexeme.c_set_flag(self.c, IS_BRACKET, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_BRACKET, __pyx_v_x)); + + /* "spacy/lexeme.pyx":489 + * return Lexeme.c_check_flag(self.c, IS_BRACKET) + * + * @is_bracket.setter # <<<<<<<<<<<<<< + * def is_bracket(self, bint x): + * Lexeme.c_set_flag(self.c, IS_BRACKET, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":493 + * Lexeme.c_set_flag(self.c, IS_BRACKET, x) + * + * @property # <<<<<<<<<<<<<< + * def is_quote(self): + * """RETURNS (bool): Whether the lexeme is a quotation mark.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_quote_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8is_quote_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_quote___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8is_quote___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":496 + * def is_quote(self): + * """RETURNS (bool): Whether the lexeme is a quotation mark.""" + * return Lexeme.c_check_flag(self.c, IS_QUOTE) # <<<<<<<<<<<<<< + * + * @is_quote.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_QUOTE)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":493 + * Lexeme.c_set_flag(self.c, IS_BRACKET, x) + * + * @property # <<<<<<<<<<<<<< + * def is_quote(self): + * """RETURNS (bool): Whether the lexeme is a quotation mark.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_quote.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":498 + * return Lexeme.c_check_flag(self.c, IS_QUOTE) + * + * @is_quote.setter # <<<<<<<<<<<<<< + * def is_quote(self, bint x): + * Lexeme.c_set_flag(self.c, IS_QUOTE, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_quote_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8is_quote_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 499, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_quote.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8is_quote_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8is_quote_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":500 + * @is_quote.setter + * def is_quote(self, bint x): + * Lexeme.c_set_flag(self.c, IS_QUOTE, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_QUOTE, __pyx_v_x)); + + /* "spacy/lexeme.pyx":498 + * return Lexeme.c_check_flag(self.c, IS_QUOTE) + * + * @is_quote.setter # <<<<<<<<<<<<<< + * def is_quote(self, bint x): + * Lexeme.c_set_flag(self.c, IS_QUOTE, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":502 + * Lexeme.c_set_flag(self.c, IS_QUOTE, x) + * + * @property # <<<<<<<<<<<<<< + * def is_left_punct(self): + * """RETURNS (bool): Whether the lexeme is left punctuation, e.g. (.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_13is_left_punct_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_13is_left_punct_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_13is_left_punct___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_13is_left_punct___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":505 + * def is_left_punct(self): + * """RETURNS (bool): Whether the lexeme is left punctuation, e.g. (.""" + * return Lexeme.c_check_flag(self.c, IS_LEFT_PUNCT) # <<<<<<<<<<<<<< + * + * @is_left_punct.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":502 + * Lexeme.c_set_flag(self.c, IS_QUOTE, x) + * + * @property # <<<<<<<<<<<<<< + * def is_left_punct(self): + * """RETURNS (bool): Whether the lexeme is left punctuation, e.g. (.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_left_punct.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":507 + * return Lexeme.c_check_flag(self.c, IS_LEFT_PUNCT) + * + * @is_left_punct.setter # <<<<<<<<<<<<<< + * def is_left_punct(self, bint x): + * Lexeme.c_set_flag(self.c, IS_LEFT_PUNCT, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_13is_left_punct_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_13is_left_punct_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 508, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_left_punct.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_13is_left_punct_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_13is_left_punct_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":509 + * @is_left_punct.setter + * def is_left_punct(self, bint x): + * Lexeme.c_set_flag(self.c, IS_LEFT_PUNCT, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, __pyx_v_x)); + + /* "spacy/lexeme.pyx":507 + * return Lexeme.c_check_flag(self.c, IS_LEFT_PUNCT) + * + * @is_left_punct.setter # <<<<<<<<<<<<<< + * def is_left_punct(self, bint x): + * Lexeme.c_set_flag(self.c, IS_LEFT_PUNCT, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":511 + * Lexeme.c_set_flag(self.c, IS_LEFT_PUNCT, x) + * + * @property # <<<<<<<<<<<<<< + * def is_right_punct(self): + * """RETURNS (bool): Whether the lexeme is right punctuation, e.g. ).""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_14is_right_punct_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_14is_right_punct_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_14is_right_punct___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_14is_right_punct___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":514 + * def is_right_punct(self): + * """RETURNS (bool): Whether the lexeme is right punctuation, e.g. ).""" + * return Lexeme.c_check_flag(self.c, IS_RIGHT_PUNCT) # <<<<<<<<<<<<<< + * + * @is_right_punct.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":511 + * Lexeme.c_set_flag(self.c, IS_LEFT_PUNCT, x) + * + * @property # <<<<<<<<<<<<<< + * def is_right_punct(self): + * """RETURNS (bool): Whether the lexeme is right punctuation, e.g. ).""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_right_punct.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":516 + * return Lexeme.c_check_flag(self.c, IS_RIGHT_PUNCT) + * + * @is_right_punct.setter # <<<<<<<<<<<<<< + * def is_right_punct(self, bint x): + * Lexeme.c_set_flag(self.c, IS_RIGHT_PUNCT, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_14is_right_punct_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_14is_right_punct_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 517, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_right_punct.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_14is_right_punct_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_14is_right_punct_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":518 + * @is_right_punct.setter + * def is_right_punct(self, bint x): + * Lexeme.c_set_flag(self.c, IS_RIGHT_PUNCT, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, __pyx_v_x)); + + /* "spacy/lexeme.pyx":516 + * return Lexeme.c_check_flag(self.c, IS_RIGHT_PUNCT) + * + * @is_right_punct.setter # <<<<<<<<<<<<<< + * def is_right_punct(self, bint x): + * Lexeme.c_set_flag(self.c, IS_RIGHT_PUNCT, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":520 + * Lexeme.c_set_flag(self.c, IS_RIGHT_PUNCT, x) + * + * @property # <<<<<<<<<<<<<< + * def is_currency(self): + * """RETURNS (bool): Whether the lexeme is a currency symbol, e.g. $, .""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_11is_currency_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_11is_currency_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_11is_currency___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_11is_currency___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":523 + * def is_currency(self): + * """RETURNS (bool): Whether the lexeme is a currency symbol, e.g. $, .""" + * return Lexeme.c_check_flag(self.c, IS_CURRENCY) # <<<<<<<<<<<<<< + * + * @is_currency.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_CURRENCY)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":520 + * Lexeme.c_set_flag(self.c, IS_RIGHT_PUNCT, x) + * + * @property # <<<<<<<<<<<<<< + * def is_currency(self): + * """RETURNS (bool): Whether the lexeme is a currency symbol, e.g. $, .""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_currency.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":525 + * return Lexeme.c_check_flag(self.c, IS_CURRENCY) + * + * @is_currency.setter # <<<<<<<<<<<<<< + * def is_currency(self, bint x): + * Lexeme.c_set_flag(self.c, IS_CURRENCY, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_11is_currency_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_11is_currency_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 526, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.is_currency.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_11is_currency_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_11is_currency_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":527 + * @is_currency.setter + * def is_currency(self, bint x): + * Lexeme.c_set_flag(self.c, IS_CURRENCY, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_IS_CURRENCY, __pyx_v_x)); + + /* "spacy/lexeme.pyx":525 + * return Lexeme.c_check_flag(self.c, IS_CURRENCY) + * + * @is_currency.setter # <<<<<<<<<<<<<< + * def is_currency(self, bint x): + * Lexeme.c_set_flag(self.c, IS_CURRENCY, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":529 + * Lexeme.c_set_flag(self.c, IS_CURRENCY, x) + * + * @property # <<<<<<<<<<<<<< + * def like_url(self): + * """RETURNS (bool): Whether the lexeme resembles a URL.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8like_url_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8like_url_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8like_url___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8like_url___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":532 + * def like_url(self): + * """RETURNS (bool): Whether the lexeme resembles a URL.""" + * return Lexeme.c_check_flag(self.c, LIKE_URL) # <<<<<<<<<<<<<< + * + * @like_url.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_LIKE_URL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":529 + * Lexeme.c_set_flag(self.c, IS_CURRENCY, x) + * + * @property # <<<<<<<<<<<<<< + * def like_url(self): + * """RETURNS (bool): Whether the lexeme resembles a URL.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.like_url.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":534 + * return Lexeme.c_check_flag(self.c, LIKE_URL) + * + * @like_url.setter # <<<<<<<<<<<<<< + * def like_url(self, bint x): + * Lexeme.c_set_flag(self.c, LIKE_URL, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8like_url_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8like_url_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 535, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.like_url.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8like_url_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8like_url_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":536 + * @like_url.setter + * def like_url(self, bint x): + * Lexeme.c_set_flag(self.c, LIKE_URL, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_LIKE_URL, __pyx_v_x)); + + /* "spacy/lexeme.pyx":534 + * return Lexeme.c_check_flag(self.c, LIKE_URL) + * + * @like_url.setter # <<<<<<<<<<<<<< + * def like_url(self, bint x): + * Lexeme.c_set_flag(self.c, LIKE_URL, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":538 + * Lexeme.c_set_flag(self.c, LIKE_URL, x) + * + * @property # <<<<<<<<<<<<<< + * def like_num(self): + * """RETURNS (bool): Whether the lexeme represents a number, e.g. "10.9", +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8like_num_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_8like_num_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8like_num___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_8like_num___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":543 + * "10", "ten", etc. + * """ + * return Lexeme.c_check_flag(self.c, LIKE_NUM) # <<<<<<<<<<<<<< + * + * @like_num.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_LIKE_NUM)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":538 + * Lexeme.c_set_flag(self.c, LIKE_URL, x) + * + * @property # <<<<<<<<<<<<<< + * def like_num(self): + * """RETURNS (bool): Whether the lexeme represents a number, e.g. "10.9", +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.like_num.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":545 + * return Lexeme.c_check_flag(self.c, LIKE_NUM) + * + * @like_num.setter # <<<<<<<<<<<<<< + * def like_num(self, bint x): + * Lexeme.c_set_flag(self.c, LIKE_NUM, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8like_num_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_8like_num_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 546, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.like_num.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_8like_num_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_8like_num_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":547 + * @like_num.setter + * def like_num(self, bint x): + * Lexeme.c_set_flag(self.c, LIKE_NUM, x) # <<<<<<<<<<<<<< + * + * @property +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_LIKE_NUM, __pyx_v_x)); + + /* "spacy/lexeme.pyx":545 + * return Lexeme.c_check_flag(self.c, LIKE_NUM) + * + * @like_num.setter # <<<<<<<<<<<<<< + * def like_num(self, bint x): + * Lexeme.c_set_flag(self.c, LIKE_NUM, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pyx":549 + * Lexeme.c_set_flag(self.c, LIKE_NUM, x) + * + * @property # <<<<<<<<<<<<<< + * def like_email(self): + * """RETURNS (bool): Whether the lexeme resembles an email address.""" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_10like_email_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_10like_email_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_10like_email___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_10like_email___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/lexeme.pyx":552 + * def like_email(self): + * """RETURNS (bool): Whether the lexeme resembles an email address.""" + * return Lexeme.c_check_flag(self.c, LIKE_EMAIL) # <<<<<<<<<<<<<< + * + * @like_email.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_LIKE_EMAIL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 552, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/lexeme.pyx":549 + * Lexeme.c_set_flag(self.c, LIKE_NUM, x) + * + * @property # <<<<<<<<<<<<<< + * def like_email(self): + * """RETURNS (bool): Whether the lexeme resembles an email address.""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.like_email.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pyx":554 + * return Lexeme.c_check_flag(self.c, LIKE_EMAIL) + * + * @like_email.setter # <<<<<<<<<<<<<< + * def like_email(self, bint x): + * Lexeme.c_set_flag(self.c, LIKE_EMAIL, x) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_10like_email_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static int __pyx_pw_5spacy_6lexeme_6Lexeme_10like_email_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyObject_IsTrue(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 555, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.like_email.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_10like_email_2__set__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), ((int)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_6lexeme_6Lexeme_10like_email_2__set__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, int __pyx_v_x) { + int __pyx_r; + + /* "spacy/lexeme.pyx":556 + * @like_email.setter + * def like_email(self, bint x): + * Lexeme.c_set_flag(self.c, LIKE_EMAIL, x) # <<<<<<<<<<<<<< +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_self->c, __pyx_e_5spacy_5attrs_LIKE_EMAIL, __pyx_v_x)); + + /* "spacy/lexeme.pyx":554 + * return Lexeme.c_check_flag(self.c, LIKE_EMAIL) + * + * @like_email.setter # <<<<<<<<<<<<<< + * def like_email(self, bint x): + * Lexeme.c_set_flag(self.c, LIKE_EMAIL, x) +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/lexeme.pxd":26 + * cdef class Lexeme: + * cdef LexemeC* c + * cdef readonly Vocab vocab # <<<<<<<<<<<<<< + * cdef readonly attr_t orth + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5vocab_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_5vocab_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_5vocab___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_5vocab___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self->vocab); + __pyx_r = ((PyObject *)__pyx_v_self->vocab); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/lexeme.pxd":27 + * cdef LexemeC* c + * cdef readonly Vocab vocab + * cdef readonly attr_t orth # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_4orth_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_4orth_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_4orth___get__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_4orth___get__(struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_self->orth); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.orth.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_15__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_6lexeme_6Lexeme_14__reduce_cython__, "Lexeme.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_6lexeme_6Lexeme_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_6lexeme_6Lexeme_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_6lexeme_6Lexeme_14__reduce_cython__}; +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_15__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_14__reduce_cython__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_c_cannot_be_converted_to_a, 0, 0); + __PYX_ERR(3, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_17__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_6lexeme_6Lexeme_16__setstate_cython__, "Lexeme.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_6lexeme_6Lexeme_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_6lexeme_6Lexeme_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_6lexeme_6Lexeme_16__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_6lexeme_6Lexeme_17__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(3, 3, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 3, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(3, 3, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(3, 3, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(3, 3, __pyx_L3_error) + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(3, 3, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.lexeme.Lexeme.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_6lexeme_6Lexeme_16__setstate_cython__(((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_6lexeme_6Lexeme_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_c_cannot_be_converted_to_a, 0, 0); + __PYX_ERR(3, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.lexeme.Lexeme.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ +static struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme __pyx_vtable_5spacy_6lexeme_Lexeme; + +static PyObject *__pyx_tp_new_5spacy_6lexeme_Lexeme(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_6lexeme_Lexeme; + p->vocab = ((struct __pyx_obj_5spacy_5vocab_Vocab *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5spacy_6lexeme_Lexeme(PyObject *o) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *p = (struct __pyx_obj_5spacy_6lexeme_Lexeme *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_6lexeme_Lexeme) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->vocab); + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static int __pyx_tp_traverse_5spacy_6lexeme_Lexeme(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_6lexeme_Lexeme *p = (struct __pyx_obj_5spacy_6lexeme_Lexeme *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->vocab) { + e = (*v)(((PyObject *)p->vocab), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_6lexeme_Lexeme(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_6lexeme_Lexeme *p = (struct __pyx_obj_5spacy_6lexeme_Lexeme *)o; + tmp = ((PyObject*)p->vocab); + p->vocab = ((struct __pyx_obj_5spacy_5vocab_Vocab *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_has_vector(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_10has_vector_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_vector_norm(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_11vector_norm_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_vector(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_6vector_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_vector(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_6vector_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_rank(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_4rank_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_rank(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_4rank_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_sentiment(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_9sentiment_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_sentiment(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_9sentiment_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_orth_(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_5orth__1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_text(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_4text_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_lower(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_5lower_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_lower(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_5lower_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_norm(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_4norm_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_norm(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_4norm_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_5shape_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_shape(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_5shape_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_prefix(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_6prefix_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_prefix(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_6prefix_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_suffix(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_6suffix_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_suffix(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_6suffix_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_cluster(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_7cluster_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_cluster(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_7cluster_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_lang(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_4lang_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_lang(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_4lang_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_prob(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_4prob_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_prob(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_4prob_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_lower_(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_6lower__1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_lower_(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_6lower__3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_norm_(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_5norm__1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_norm_(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_5norm__3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_shape_(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_6shape__1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_shape_(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_6shape__3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_prefix_(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_7prefix__1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_prefix_(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_7prefix__3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_suffix_(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_7suffix__1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_suffix_(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_7suffix__3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_lang_(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_5lang__1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_lang_(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_5lang__3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_flags(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_5flags_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_flags(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_5flags_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_oov(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_6is_oov_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_stop(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_7is_stop_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_stop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_7is_stop_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_alpha(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_alpha_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_alpha(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_alpha_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_ascii(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_ascii_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_ascii(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_ascii_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_digit(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_digit_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_digit(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_digit_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_lower(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_lower_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_lower(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_lower_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_upper(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_upper_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_upper(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_upper_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_title(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_title_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_title(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_title_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_punct(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_punct_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_punct(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_punct_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_space(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_space_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_space(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_space_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_bracket(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_10is_bracket_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_bracket(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_10is_bracket_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_quote(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_quote_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_quote(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8is_quote_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_left_punct(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_13is_left_punct_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_left_punct(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_13is_left_punct_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_right_punct(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_14is_right_punct_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_right_punct(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_14is_right_punct_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_is_currency(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_11is_currency_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_is_currency(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_11is_currency_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_like_url(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8like_url_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_like_url(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8like_url_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_like_num(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8like_num_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_like_num(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_8like_num_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_like_email(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_10like_email_1__get__(o); +} + +static int __pyx_setprop_5spacy_6lexeme_6Lexeme_like_email(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_10like_email_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_vocab(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_5vocab_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_6lexeme_6Lexeme_orth(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_6lexeme_6Lexeme_4orth_1__get__(o); +} + +static PyMethodDef __pyx_methods_5spacy_6lexeme_Lexeme[] = { + {"set_attrs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_6lexeme_6Lexeme_7set_attrs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_6lexeme_6Lexeme_6set_attrs}, + {"set_flag", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_6lexeme_6Lexeme_9set_flag, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_6lexeme_6Lexeme_8set_flag}, + {"check_flag", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_6lexeme_6Lexeme_11check_flag, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_6lexeme_6Lexeme_10check_flag}, + {"similarity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_6lexeme_6Lexeme_13similarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_6lexeme_6Lexeme_12similarity}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_6lexeme_6Lexeme_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_6lexeme_6Lexeme_14__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_6lexeme_6Lexeme_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_6lexeme_6Lexeme_16__setstate_cython__}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5spacy_6lexeme_Lexeme[] = { + {"has_vector", __pyx_getprop_5spacy_6lexeme_6Lexeme_has_vector, 0, PyDoc_STR("RETURNS (bool): Whether a word vector is associated with the object.\n "), 0}, + {"vector_norm", __pyx_getprop_5spacy_6lexeme_6Lexeme_vector_norm, 0, PyDoc_STR("RETURNS (float): The L2 norm of the vector representation."), 0}, + {"vector", __pyx_getprop_5spacy_6lexeme_6Lexeme_vector, __pyx_setprop_5spacy_6lexeme_6Lexeme_vector, PyDoc_STR("A real-valued meaning representation.\n\n RETURNS (numpy.ndarray[ndim=1, dtype='float32']): A 1D numpy array\n representing the lexeme's semantics.\n "), 0}, + {"rank", __pyx_getprop_5spacy_6lexeme_6Lexeme_rank, __pyx_setprop_5spacy_6lexeme_6Lexeme_rank, PyDoc_STR("RETURNS (str): Sequential ID of the lexeme's lexical type, used\n to index into tables, e.g. for word vectors."), 0}, + {"sentiment", __pyx_getprop_5spacy_6lexeme_6Lexeme_sentiment, __pyx_setprop_5spacy_6lexeme_6Lexeme_sentiment, PyDoc_STR("RETURNS (float): A scalar value indicating the positivity or\n negativity of the lexeme."), 0}, + {"orth_", __pyx_getprop_5spacy_6lexeme_6Lexeme_orth_, 0, PyDoc_STR("RETURNS (str): The original verbatim text of the lexeme\n (identical to `Lexeme.text`). Exists mostly for consistency with\n the other attributes."), 0}, + {"text", __pyx_getprop_5spacy_6lexeme_6Lexeme_text, 0, PyDoc_STR("RETURNS (str): The original verbatim text of the lexeme."), 0}, + {"lower", __pyx_getprop_5spacy_6lexeme_6Lexeme_lower, __pyx_setprop_5spacy_6lexeme_6Lexeme_lower, PyDoc_STR("RETURNS (uint64): Lowercase form of the lexeme."), 0}, + {"norm", __pyx_getprop_5spacy_6lexeme_6Lexeme_norm, __pyx_setprop_5spacy_6lexeme_6Lexeme_norm, PyDoc_STR("RETURNS (uint64): The lexeme's norm, i.e. a normalised form of the\n lexeme text.\n "), 0}, + {"shape", __pyx_getprop_5spacy_6lexeme_6Lexeme_shape, __pyx_setprop_5spacy_6lexeme_6Lexeme_shape, PyDoc_STR("RETURNS (uint64): Transform of the word's string, to show\n orthographic features.\n "), 0}, + {"prefix", __pyx_getprop_5spacy_6lexeme_6Lexeme_prefix, __pyx_setprop_5spacy_6lexeme_6Lexeme_prefix, PyDoc_STR("RETURNS (uint64): Length-N substring from the start of the word.\n Defaults to `N=1`.\n "), 0}, + {"suffix", __pyx_getprop_5spacy_6lexeme_6Lexeme_suffix, __pyx_setprop_5spacy_6lexeme_6Lexeme_suffix, PyDoc_STR("RETURNS (uint64): Length-N substring from the end of the word.\n Defaults to `N=3`.\n "), 0}, + {"cluster", __pyx_getprop_5spacy_6lexeme_6Lexeme_cluster, __pyx_setprop_5spacy_6lexeme_6Lexeme_cluster, PyDoc_STR("RETURNS (int): Brown cluster ID."), 0}, + {"lang", __pyx_getprop_5spacy_6lexeme_6Lexeme_lang, __pyx_setprop_5spacy_6lexeme_6Lexeme_lang, PyDoc_STR("RETURNS (uint64): Language of the parent vocabulary."), 0}, + {"prob", __pyx_getprop_5spacy_6lexeme_6Lexeme_prob, __pyx_setprop_5spacy_6lexeme_6Lexeme_prob, PyDoc_STR("RETURNS (float): Smoothed log probability estimate of the lexeme's\n type."), 0}, + {"lower_", __pyx_getprop_5spacy_6lexeme_6Lexeme_lower_, __pyx_setprop_5spacy_6lexeme_6Lexeme_lower_, PyDoc_STR("RETURNS (str): Lowercase form of the word."), 0}, + {"norm_", __pyx_getprop_5spacy_6lexeme_6Lexeme_norm_, __pyx_setprop_5spacy_6lexeme_6Lexeme_norm_, PyDoc_STR("RETURNS (str): The lexeme's norm, i.e. a normalised form of the\n lexeme text.\n "), 0}, + {"shape_", __pyx_getprop_5spacy_6lexeme_6Lexeme_shape_, __pyx_setprop_5spacy_6lexeme_6Lexeme_shape_, PyDoc_STR("RETURNS (str): Transform of the word's string, to show\n orthographic features.\n "), 0}, + {"prefix_", __pyx_getprop_5spacy_6lexeme_6Lexeme_prefix_, __pyx_setprop_5spacy_6lexeme_6Lexeme_prefix_, PyDoc_STR("RETURNS (str): Length-N substring from the start of the word.\n Defaults to `N=1`.\n "), 0}, + {"suffix_", __pyx_getprop_5spacy_6lexeme_6Lexeme_suffix_, __pyx_setprop_5spacy_6lexeme_6Lexeme_suffix_, PyDoc_STR("RETURNS (str): Length-N substring from the end of the word.\n Defaults to `N=3`.\n "), 0}, + {"lang_", __pyx_getprop_5spacy_6lexeme_6Lexeme_lang_, __pyx_setprop_5spacy_6lexeme_6Lexeme_lang_, PyDoc_STR("RETURNS (str): Language of the parent vocabulary."), 0}, + {"flags", __pyx_getprop_5spacy_6lexeme_6Lexeme_flags, __pyx_setprop_5spacy_6lexeme_6Lexeme_flags, PyDoc_STR("RETURNS (uint64): Container of the lexeme's binary flags."), 0}, + {"is_oov", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_oov, 0, PyDoc_STR("RETURNS (bool): Whether the lexeme is out-of-vocabulary."), 0}, + {"is_stop", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_stop, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_stop, PyDoc_STR("RETURNS (bool): Whether the lexeme is a stop word."), 0}, + {"is_alpha", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_alpha, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_alpha, PyDoc_STR("RETURNS (bool): Whether the lexeme consists of alphabetic\n characters. Equivalent to `lexeme.text.isalpha()`.\n "), 0}, + {"is_ascii", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_ascii, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_ascii, PyDoc_STR("RETURNS (bool): Whether the lexeme consists of ASCII characters.\n Equivalent to `[any(ord(c) >= 128 for c in lexeme.text)]`.\n "), 0}, + {"is_digit", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_digit, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_digit, PyDoc_STR("RETURNS (bool): Whether the lexeme consists of digits. Equivalent\n to `lexeme.text.isdigit()`.\n "), 0}, + {"is_lower", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_lower, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_lower, PyDoc_STR("RETURNS (bool): Whether the lexeme is in lowercase. Equivalent to\n `lexeme.text.islower()`.\n "), 0}, + {"is_upper", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_upper, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_upper, PyDoc_STR("RETURNS (bool): Whether the lexeme is in uppercase. Equivalent to\n `lexeme.text.isupper()`.\n "), 0}, + {"is_title", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_title, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_title, PyDoc_STR("RETURNS (bool): Whether the lexeme is in titlecase. Equivalent to\n `lexeme.text.istitle()`.\n "), 0}, + {"is_punct", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_punct, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_punct, PyDoc_STR("RETURNS (bool): Whether the lexeme is punctuation."), 0}, + {"is_space", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_space, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_space, PyDoc_STR("RETURNS (bool): Whether the lexeme consist of whitespace characters.\n Equivalent to `lexeme.text.isspace()`.\n "), 0}, + {"is_bracket", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_bracket, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_bracket, PyDoc_STR("RETURNS (bool): Whether the lexeme is a bracket."), 0}, + {"is_quote", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_quote, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_quote, PyDoc_STR("RETURNS (bool): Whether the lexeme is a quotation mark."), 0}, + {"is_left_punct", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_left_punct, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_left_punct, PyDoc_STR("RETURNS (bool): Whether the lexeme is left punctuation, e.g. (."), 0}, + {"is_right_punct", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_right_punct, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_right_punct, PyDoc_STR("RETURNS (bool): Whether the lexeme is right punctuation, e.g. )."), 0}, + {"is_currency", __pyx_getprop_5spacy_6lexeme_6Lexeme_is_currency, __pyx_setprop_5spacy_6lexeme_6Lexeme_is_currency, PyDoc_STR("RETURNS (bool): Whether the lexeme is a currency symbol, e.g. $, \342\202\254."), 0}, + {"like_url", __pyx_getprop_5spacy_6lexeme_6Lexeme_like_url, __pyx_setprop_5spacy_6lexeme_6Lexeme_like_url, PyDoc_STR("RETURNS (bool): Whether the lexeme resembles a URL."), 0}, + {"like_num", __pyx_getprop_5spacy_6lexeme_6Lexeme_like_num, __pyx_setprop_5spacy_6lexeme_6Lexeme_like_num, PyDoc_STR("RETURNS (bool): Whether the lexeme represents a number, e.g. \"10.9\",\n \"10\", \"ten\", etc.\n "), 0}, + {"like_email", __pyx_getprop_5spacy_6lexeme_6Lexeme_like_email, __pyx_setprop_5spacy_6lexeme_6Lexeme_like_email, PyDoc_STR("RETURNS (bool): Whether the lexeme resembles an email address."), 0}, + {"vocab", __pyx_getprop_5spacy_6lexeme_6Lexeme_vocab, 0, 0, 0}, + {"orth", __pyx_getprop_5spacy_6lexeme_6Lexeme_orth, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_6lexeme_Lexeme_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_6lexeme_Lexeme}, + {Py_tp_hash, (void *)__pyx_pw_5spacy_6lexeme_6Lexeme_5__hash__}, + {Py_tp_doc, (void *)PyDoc_STR("Lexeme(Vocab vocab, attr_t orth)\n\nAn entry in the vocabulary. A `Lexeme` has no string context \342\200\223 it's a\nword-type, as opposed to a word token. It therefore has no part-of-speech\ntag, dependency parse, or lemma (lemmatization depends on the\npart-of-speech tag).\n\nDOCS: https://spacy.io/api/lexeme")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_6lexeme_Lexeme}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_6lexeme_Lexeme}, + {Py_tp_richcompare, (void *)__pyx_pw_5spacy_6lexeme_6Lexeme_3__richcmp__}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_6lexeme_Lexeme}, + {Py_tp_getset, (void *)__pyx_getsets_5spacy_6lexeme_Lexeme}, + {Py_tp_init, (void *)__pyx_pw_5spacy_6lexeme_6Lexeme_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_6lexeme_Lexeme}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_6lexeme_Lexeme_spec = { + "spacy.lexeme.Lexeme", + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_6lexeme_Lexeme_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_6lexeme_Lexeme = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.lexeme.""Lexeme", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_6lexeme_Lexeme, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + __pyx_pw_5spacy_6lexeme_6Lexeme_5__hash__, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + PyDoc_STR("Lexeme(Vocab vocab, attr_t orth)\n\nAn entry in the vocabulary. A `Lexeme` has no string context \342\200\223 it's a\nword-type, as opposed to a word token. It therefore has no part-of-speech\ntag, dependency parse, or lemma (lemmatization depends on the\npart-of-speech tag).\n\nDOCS: https://spacy.io/api/lexeme"), /*tp_doc*/ + __pyx_tp_traverse_5spacy_6lexeme_Lexeme, /*tp_traverse*/ + __pyx_tp_clear_5spacy_6lexeme_Lexeme, /*tp_clear*/ + __pyx_pw_5spacy_6lexeme_6Lexeme_3__richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_6lexeme_Lexeme, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5spacy_6lexeme_Lexeme, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_5spacy_6lexeme_6Lexeme_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_6lexeme_Lexeme, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +/* #### Code section: initfunc_declarations ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ +/* #### Code section: init_module ### */ + +static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + { + __pyx_t_1 = __Pyx_ApiExport_GetApiDict(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_export_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_pyx_t_5spacy_8typedefs_attr_t); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_export_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_export_name = __pyx_export_signature + 71; + void *const __pyx_export_pointers[] = {(void *)&__pyx_v_5spacy_6lexeme_OOV_RANK, (void *)&__pyx_v_5spacy_6lexeme_EMPTY_LEXEME, (void *) NULL}; + void *const *__pyx_export_pointer = __pyx_export_pointers; + const char *__pyx_export_current_signature = __pyx_export_signature; + while (*__pyx_export_pointer) { + if (__Pyx_ExportVoidPtr(__pyx_t_1, __pyx_export_name, *__pyx_export_pointer, __pyx_export_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_export_pointer; + __pyx_export_name = strchr(__pyx_export_name, '\0') + 1; + __pyx_export_signature = strchr(__pyx_export_signature, '\0') + 1; + if (*__pyx_export_signature != '\0') __pyx_export_current_signature = __pyx_export_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_5spacy_6lexeme_Lexeme = &__pyx_vtable_5spacy_6lexeme_Lexeme; + __pyx_vtable_5spacy_6lexeme_Lexeme.from_ptr = (struct __pyx_obj_5spacy_6lexeme_Lexeme *(*)(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *))__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr; + __pyx_vtable_5spacy_6lexeme_Lexeme.set_struct_attr = (void (*)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr; + __pyx_vtable_5spacy_6lexeme_Lexeme.get_struct_attr = (__pyx_t_5spacy_8typedefs_attr_t (*)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t))__pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr; + __pyx_vtable_5spacy_6lexeme_Lexeme.c_check_flag = (int (*)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t))__pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag; + __pyx_vtable_5spacy_6lexeme_Lexeme.c_set_flag = (int (*)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int))__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_6lexeme_Lexeme_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme)) __PYX_ERR(0, 43, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_6lexeme_Lexeme_spec, __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) < (0)) __PYX_ERR(0, 43, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme = &__pyx_type_5spacy_6lexeme_Lexeme; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) < (0)) __PYX_ERR(0, 43, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 43, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_6lexeme_6Lexeme___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_6lexeme_6Lexeme___init__.doc = __pyx_doc_5spacy_6lexeme_6Lexeme___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_6lexeme_6Lexeme___init__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme, __pyx_vtabptr_5spacy_6lexeme_Lexeme) < (0)) __PYX_ERR(0, 43, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) < (0)) __PYX_ERR(0, 43, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Lexeme, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) < (0)) __PYX_ERR(0, 43, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) < (0)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_1(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + 0, 0, + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(4, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "dtype", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #else + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 228, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flatiter", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #else + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 273, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "broadcast", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #else + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 277, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ndarray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #else + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 316, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "generic", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(1, 825, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "number", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(1, 827, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "integer", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(1, 829, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "signedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 831, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "unsignedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 833, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "inexact", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 835, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "floating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(1, 837, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "complexfloating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 839, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flexible", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 841, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "character", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(1, 843, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ufunc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #else + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 907, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(5, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(5, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(5, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(5, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(5, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(5, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(5, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(6, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(6, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(6, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(6, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(7, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(7, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.morphology"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.morphology", "Morphology", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #else + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) __PYX_ERR(8, 11, __pyx_L1_error) + __pyx_vtabptr_5spacy_10morphology_Morphology = (struct __pyx_vtabstruct_5spacy_10morphology_Morphology*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology); if (unlikely(!__pyx_vtabptr_5spacy_10morphology_Morphology)) __PYX_ERR(8, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.vocab", "Vocab", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #else + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) __PYX_ERR(9, 26, __pyx_L1_error) + __pyx_vtabptr_5spacy_5vocab_Vocab = (struct __pyx_vtabstruct_5spacy_5vocab_Vocab*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab); if (unlikely(!__pyx_vtabptr_5spacy_5vocab_Vocab)) __PYX_ERR(9, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_struct___pyx_t_5spacy_7structs_L); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 39; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_5vocab_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("murmurhash.mrmr"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_uint64_t_void_int_uint64_t_hash6); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 33; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (void (**)(void)) NULL}; + void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportFunction_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_lexeme(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_lexeme}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #endif + #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE + {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, + #endif + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "lexeme", + 0, /* m_doc */ + #if CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstatetype), /* m_size */ + #else + (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif + +/* PyModInitFuncType */ +#ifndef CYTHON_NO_PYINIT_EXPORT + #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#else + #ifdef __cplusplus + #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * + #else + #define __Pyx_PyMODINIT_FUNC PyObject * + #endif +#endif + +__Pyx_PyMODINIT_FUNC PyInit_lexeme(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_lexeme(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +/* ModuleCreationPEP489 */ +#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) +static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { + { + PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think + if (!module) { + PyErr_Clear(); // just try the 3.8-3.12 version + module = PyImport_ImportModule("_xxsubinterpreters"); + if (!module) goto bad; + } + PyObject *current = PyObject_CallMethod(module, "get_current", NULL); + Py_DECREF(module); + if (!current) goto bad; + if (PyTuple_Check(current)) { + PyObject *new_current = PySequence_GetItem(current, 0); + Py_DECREF(current); + current = new_current; + if (!new_current) goto bad; + } + long long as_c_int = PyLong_AsLongLong(current); + Py_DECREF(current); + return as_c_int; + } + bad: + PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); + return -1; +} +#endif +#if !CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + static PY_INT64_T main_interpreter_id = -1; +#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_GRAAL + PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) + PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); +#elif CYTHON_COMPILING_IN_LIMITED_API + PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); +#else + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); +#endif + if (unlikely(current_id == -1)) { + return -1; + } + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return 0; + } else if (unlikely(main_interpreter_id != current_id)) { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#endif +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + #if !CYTHON_USE_MODULE_STATE + if (__Pyx_check_single_interpreter()) + return NULL; + #endif + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_lexeme(PyObject *__pyx_pyinit_module) +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + __pyx_mstatetype *__pyx_mstate = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'lexeme' has already been imported. Re-initialisation is not supported."); + return -1; + } + #else + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_t_1 = __pyx_pyinit_module; + Py_INCREF(__pyx_t_1); + #else + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #if CYTHON_USE_MODULE_STATE + { + int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "lexeme" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = __pyx_t_1; + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); + #endif + __pyx_mstate = __pyx_mstate_global; + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_mstate->__pyx_d); + __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /* ImportRefnannyAPI */ + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + +__Pyx_RefNannySetupContext("PyInit_lexeme", 0); + __Pyx_init_runtime_version(); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Library function declarations ---*/ + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_module_is_main_spacy__lexeme) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "spacy.lexeme")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.lexeme", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(__pyx_mstate); + if (unlikely((__Pyx_modinit_variable_export_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_function_export_code(__pyx_mstate); + if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_variable_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "spacy/lexeme.pyx":7 + * from libc.string cimport memset + * + * np.import_array() # <<<<<<<<<<<<<< + * + * import warnings +*/ + __pyx_t_2 = __pyx_f_5numpy_import_array(); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 7, __pyx_L1_error) + + /* "spacy/lexeme.pyx":9 + * np.import_array() + * + * import warnings # <<<<<<<<<<<<<< + * + * import numpy +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_warnings, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_3 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_warnings, __pyx_t_3) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":11 + * import warnings + * + * import numpy # <<<<<<<<<<<<<< + * from thinc.api import get_array_module + * +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numpy, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_numpy, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_t_3 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_numpy, __pyx_t_3) < (0)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":12 + * + * import numpy + * from thinc.api import get_array_module # <<<<<<<<<<<<<< + * + * from .attrs cimport ( +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_get_array_module}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_thinc_api, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_thinc_api, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) + } + __pyx_t_3 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_3); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_get_array_module}; + __pyx_t_4 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_3, __pyx_imported_names[__pyx_t_4]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_4], __pyx_t_5) < (0)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":35 + * from .typedefs cimport attr_t, flags_t + * + * from .attrs import intify_attrs # <<<<<<<<<<<<<< + * from .errors import Errors, Warnings + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_intify_attrs}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_attrs, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_attrs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) + } + __pyx_t_3 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_3); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_intify_attrs}; + __pyx_t_4 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_3, __pyx_imported_names[__pyx_t_4]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_4], __pyx_t_5) < (0)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":36 + * + * from .attrs import intify_attrs + * from .errors import Errors, Warnings # <<<<<<<<<<<<<< + * + * OOV_RANK = 0xffffffffffffffff # UINT64_MAX +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors,__pyx_mstate_global->__pyx_n_u_Warnings}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 2, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + } + __pyx_t_3 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_3); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors,__pyx_mstate_global->__pyx_n_u_Warnings}; + for (__pyx_t_4=0; __pyx_t_4 < 2; __pyx_t_4++) { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_3, __pyx_imported_names[__pyx_t_4]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_4], __pyx_t_5) < (0)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":38 + * from .errors import Errors, Warnings + * + * OOV_RANK = 0xffffffffffffffff # UINT64_MAX # <<<<<<<<<<<<<< + * memset(&EMPTY_LEXEME, 0, sizeof(LexemeC)) + * EMPTY_LEXEME.id = OOV_RANK +*/ + __pyx_v_5spacy_6lexeme_OOV_RANK = 0xffffffffffffffff; + + /* "spacy/lexeme.pyx":39 + * + * OOV_RANK = 0xffffffffffffffff # UINT64_MAX + * memset(&EMPTY_LEXEME, 0, sizeof(LexemeC)) # <<<<<<<<<<<<<< + * EMPTY_LEXEME.id = OOV_RANK + * +*/ + (void)(memset((&__pyx_v_5spacy_6lexeme_EMPTY_LEXEME), 0, (sizeof(struct __pyx_t_5spacy_7structs_LexemeC)))); + + /* "spacy/lexeme.pyx":40 + * OOV_RANK = 0xffffffffffffffff # UINT64_MAX + * memset(&EMPTY_LEXEME, 0, sizeof(LexemeC)) + * EMPTY_LEXEME.id = OOV_RANK # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_5spacy_6lexeme_EMPTY_LEXEME.id = __pyx_v_5spacy_6lexeme_OOV_RANK; + + /* "spacy/lexeme.pyx":100 + * return self.c.orth + * + * def set_attrs(self, **attrs): # <<<<<<<<<<<<<< + * cdef attr_id_t attr + * attrs = intify_attrs(attrs) +*/ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_6lexeme_6Lexeme_7set_attrs, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Lexeme_set_attrs, NULL, __pyx_mstate_global->__pyx_n_u_spacy_lexeme, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme, __pyx_mstate_global->__pyx_n_u_set_attrs, __pyx_t_3) < (0)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":112 + * Lexeme.set_struct_attr(self.c, attr, self.vocab.strings.add(value)) + * + * def set_flag(self, attr_id_t flag_id, bint value): # <<<<<<<<<<<<<< + * """Change the value of a boolean flag. + * +*/ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_6lexeme_6Lexeme_9set_flag, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Lexeme_set_flag, NULL, __pyx_mstate_global->__pyx_n_u_spacy_lexeme, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme, __pyx_mstate_global->__pyx_n_u_set_flag, __pyx_t_3) < (0)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":120 + * Lexeme.c_set_flag(self.c, flag_id, value) + * + * def check_flag(self, attr_id_t flag_id): # <<<<<<<<<<<<<< + * """Check the value of a boolean flag. + * +*/ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_6lexeme_6Lexeme_11check_flag, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Lexeme_check_flag, NULL, __pyx_mstate_global->__pyx_n_u_spacy_lexeme, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme, __pyx_mstate_global->__pyx_n_u_check_flag, __pyx_t_3) < (0)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":128 + * return True if Lexeme.c_check_flag(self.c, flag_id) else False + * + * def similarity(self, other): # <<<<<<<<<<<<<< + * """Compute a semantic similarity estimate. Defaults to cosine over + * vectors. +*/ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_6lexeme_6Lexeme_13similarity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Lexeme_similarity, NULL, __pyx_mstate_global->__pyx_n_u_spacy_lexeme, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme, __pyx_mstate_global->__pyx_n_u_similarity, __pyx_t_3) < (0)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): +*/ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_6lexeme_6Lexeme_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Lexeme___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_lexeme, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_3) < (0)) __PYX_ERR(3, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.c cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.c cannot be converted to a Python object for pickling" +*/ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_6lexeme_6Lexeme_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Lexeme___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_lexeme, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_3) < (0)) __PYX_ERR(3, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/lexeme.pyx":1 + * # cython: embedsignature=True # <<<<<<<<<<<<<< + * # cython: profile=False + * # Compiler crashes on memory view coercion without this. Should report bug. +*/ + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_3) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.lexeme", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init spacy.lexeme"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #else + return __pyx_m; + #endif +} +/* #### Code section: pystring_table ### */ +/* #### Code section: cached_builtins ### */ + +static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + + /* Cached unbound methods */ + __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; + return 0; +} +/* #### Code section: cached_constants ### */ + +static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "spacy/lexeme.pyx":305 + * prob_table = self.vocab.lookups.get_table("lexeme_prob", {}) + * settings_table = self.vocab.lookups.get_table("lexeme_settings", {}) + * default_oov_prob = settings_table.get("oov_prob", -20.0) # <<<<<<<<<<<<<< + * return prob_table.get(self.c.orth, default_oov_prob) + * +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_oov_prob, __pyx_mstate_global->__pyx_float_neg_20_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + { + const struct { const unsigned int length: 8; } index[] = {{1},{179},{1},{8},{7},{6},{2},{9},{39},{34},{58},{11},{12},{16},{11},{15},{14},{14},{4},{4},{4},{6},{6},{24},{26},{17},{16},{15},{17},{20},{4},{8},{3},{9},{18},{4},{5},{10},{18},{3},{6},{7},{6},{8},{3},{16},{9},{10},{12},{10},{12},{13},{4},{5},{7},{6},{14},{11},{11},{16},{15},{7},{8},{10},{8},{10},{4},{5},{3},{8},{4},{5},{5},{3},{12},{11},{14},{12},{10},{17},{13},{6},{4},{9},{8},{12},{10},{10},{12},{19},{10},{12},{4},{3},{8},{9},{5},{6},{6},{11},{7},{14},{5},{10},{4},{8},{2},{21},{193},{83},{17},{9},{92},{51},{39}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1198 bytes) */ +const char* const cstring = "BZh91AY&SY\342Y\024\332\000\000Q\177\377\347\376\375\232\177\377\377\315\277\257\377\342\277\377\377\363@@@@@@@@@@@@@\000@\000P\003\346\217f\356\342\215\266\216\353\320\324\310\232CL\023&\024\233Sz\"mC@\036\247\250h=M\000\r\017I\241\243F\364(\332OQ\345=F\036\2505\006\225?$\361Q\352z\201\220\032=@\000\000\320\320\000\000\000\000\000\000h\003M!\250\320i\t\232H\362!\220\000\0324\031\000\000\000\000\000\006\200\364\231\001T\000\000\000\000\000\000\000\000\000\000\003@\000\000\001\210%\n\002\247\275)\031\344\246\364\2152L\002d\300\000\020bh\031\014\010\304\300\230\232h\311\246&\216\264;\275\221k\326\000\301\223\373\307\233\371\234\032Q\310\010)\300\3644\006\026@\201\010\225J\203\245X\311af\022\236C\r!\266\354P\343u\020\301\035\r;N\236\224\323Qi\232i\001\013ZB\320\214\246\273\001\300.\323(5H\034\211\n\014\201@@rB2\001LQ,\321\242\207if\215\310\323\206gE\240\034\001\321\251\242\343\001\3534\204\261\0015\267*\220\323(\353\210\237&\212\251\264\376\257\355rF:\2728\251U\201DP\0073jx\346\271*\"f*Y\330CB\032p\003}#\214\025\344IQ\261\215>\r\231\360m\213\350\275\264\002\307N\366\024V\3739\273\211\374\247s6}\367\261\334\034\034wx\241\256\217\327\267\037\016\210\215Qx\356\274\\ \371\231\300:\327\ne\031cb\037\250\334\331\317\300\366\030Q\300\032\341M*x\370\002g\324\244\273\221\222\211\216\266\321\\\324\241xr\360AF\344M\353g\240\340\020\034aG\327\004DVX\355\006R\217\370\273\222)\302\204\207\022\310\246\320"; + PyObject *data = __Pyx_DecompressString(cstring, 1198, 2); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1051 bytes) */ +const char* const cstring = "x\332\215TKo\333F\020V\200\244uZ\005\266\022#\005Z\004X\367\345\270IY\253Qb\003-R\250\256\022\024M\034\333\315\2439\004\213\325r(mMr\351\335\245,\026h\341\243\216<\362\310\243\216:\372\350\243\217=\352\350\237\320\237\320Y\222V\204\270\207\n\340jvv\036\337\314|\273\316\2664@L\237\031\262\225\230\276\014\211\320\304\005_tA1\003~B\264Q\202\033P\326($;\235\235\257[\233-\302B\227(\370\035\270\321D\307]\3563\255A\023\351\221n,|#Bb\222\010\264C~\366H\"c\022\002\270\304H\022\241\335\274\203\351CH4\030+\220U\026\206\3220#dH\321]\204\275U\342\n\205I\304\000\254\367#\346kp~`\256K\321\020\\\241Y\327\007\010\355\332\343B\227\222\033\306A\2248\224K\005N\020#\032\246\024K\210\307\204_\242\020A$\225\2317\213\003f\372\027,4\370\236\303\t/p\221.\020.\303\001(S\3320\262S\266Lvm#\210'\025\211\004\337\367\021\270\216\030O\034f\214\322\245\010J\311J\376\306\207!\004\340D\311\260<+\200\224\242\351\213\220;,\022\345\366\220\251\320F\373\336N\001\377e\2548<\354\2547\327;\353\033M\374\356u\212\270O\212\210\345\352P\252\300\2159P^\300\243t\246\307Fk\354\357\205\023\336\007\276O=\237\365*\005\032\322\002\374\334~\376X\004\302gJ\230\204\322\235d\210\337O\310\021\272\rC\263\007\336\253\365\365\315W\025p\034\225\235\226\261sa:\t\271\220\0166\\\306H\021\3206E\221\346-\000\216\335\003*\220\000\212q\3502\276\357\342\244\213\"\3551\025.\266\031\207E\251\027\207\234\322\036\230\236\005k'L\003\351\306\310\004\334\027\t\2550\300\311HU\330\225\245\323>\323\225V\204FxIY(\025\232\316\200\t\003\201\3754\245>\204\305\3223\375rl\224\373\261FD\325.D4\225\030)\331\255Dd\242\021\001.\263\2751\266\035\276\224\373q\204a\003\206%\342\257Dl\245\220\241\035\r\341\260\312f\003\027\304@vI9(\242#%\373\366\243\022\257\213\212dD)\222\210r\344\213\ra\345\252H+\016\212&\330\203\203\230\371e\374\0317\350\005\226\314\0240\264\242\306\213c\371?\243\3029\007\n\032Up\365\254\303(\271\3401t\232\243\031\375\017\312\275\345NI\361\262C\372\000o[\034Pj@c\204\3315\0300?\206b\321e\236j\236\266;U\342\352\257j\333@r\326-\026j;e/\320""\371%\032FG\355\177\352\265\253K\243\277\2627\343\225qkl&\017O\032\250\274^\273Z\037m\244+\351F\2662\255/\216L\372m\3722\273\227A\336\234.}\224\036\234\325o\244\315\364q\366]\356\216?\033\357\216{\223_\217/M\353K\351\373\351Av%\333\315\334|\305n/\247?\246^\266\225\305y;\337\313K\267\351\302\207\243\326\350O\324\252\374F\336\031\337\232\360\343\306\264\276\234v\262Fv;\377\"?\0343\004\322\234\226\306\215t9\335\235.\\\373\373\332-\214\313\254\342z\332\3024\013\371\225\374\365\230O\226'oN>=\351\2346\316\026\026G\203\364E\266r\324>[XJ\353Y;C\307\372\350Q\272\226\335\317\337\313\331\031V\362\007&Y\315\033\323\245\306\264\361I\326\314\036cE7\277\314Yn\260\374\301d\367ln\363\374\370\346\361\360\304\2346O\333E\243\026?F\347\317\261\266\265q\363\350\322\364\362\007\243;\351nI-C\357\027\323\243\233\366\231\307\301\353\202#\324\324\360\241\212\361-|\307l\243T\353\352\301\331\252={\366\222\356\265\267\177\251u\236\356<\177M\237t~\353<\355\374O\337y\227\030\357\360\203\0265\344\366@\n\227|u\227\240\342.9W\257\325\360\266\367\037\264\376\005\264\246\267\266"; + PyObject *data = __Pyx_DecompressString(cstring, 1051, 1); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #else /* compression: none (1767 bytes) */ +const char* const bytes = ".Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.?add_notedisableenablegcisenablednumpy._core.multiarray failed to importnumpy._core.umath failed to importself.c cannot be converted to a Python object for picklingspacy.attrsspacy.errorsspacy/lexeme.pyxspacy.numpyspacy.thinc.apispacy.warningsE010E071E073ErrorsLexemeLexeme.__reduce_cython__Lexeme.__setstate_cython__Lexeme.check_flagLexeme.set_attrsLexeme.set_flagLexeme.similarity__Pyx_PyDict_NextRefW008Warningsaddadd_tableasyncio.coroutinesattrattrscheck_flagcline_in_tracebackdoterrorsflag_idformat__func__getget_array_moduleget_tableget_vector__getstate__has_vectorintify_attrs_is_coroutineitemitems__len__lengthlexeme_clusterlexeme_normlexeme_problexeme_sentimentlexeme_settingslookups__main____module____name__new_lengthnormnumpyobjoov_proborthorth_otherpop__pyx_capi____pyx_state__pyx_vtable____qualname____reduce____reduce_cython____reduce_ex__resultselfset_attrsset_flag__set_name__set_vectorsetdefault__setstate____setstate_cython__similarityspacy.lexemesqrtsum__test__thinc.apivaluevaluesvectorvector_normvectorsvectors_lengthvocabvocab_orthwarnwarningsxp\200A\360\014\000\t\020\210~\230]\250!\2504\250t\260>\300\021\200A\360\022\000\t\014\2107\220!\2207\230!\330\014\017\210t\2202\220V\2303\230e\2401\330\020\027\220q\340\014\023\2201\220G\230;\240d\250#\250Q\250g\260S\270\001\330\014\020\220\007\220q\230\005\230Q\230d\240!\330\014\020\220\004\220B\220f\230C\230u\240A\240R\240q\340\014\023\2201\330\010\013\2104\210}\230C\230r\240\023\240E\250\035\260c\270\021\330\014\024\220E\230\021\230(\240%\240w\250a\250t\2601\330\014\023\2201\330\010\021\220\024\220Q\330\010\r\320\r\035\230Q\230a\330\010\021\220\022\2204\220q\230\010\240\005\240Y\250c\260\024\260]\300\"\300E\310\021\340\010\017\210v\220U\230!\200A\340\010\020\220\014\230A\230Q\330\010\014\210F\220)\2305\240\006\240a\340\014""\017\210z\230\021\230'\240\021\330\020\021\330\021\033\2301\230G\2401\330\026&\240a\240t\2504\250v\260Q\340\026&\240a\240t\2504\250v\260T\270\026\270x\300t\3101\310A\200A\360\014\000\017\032\230\021\230$\230d\240)\2501\200\001\330\004\n\210+\220Q__pyx_t_5spacy_8typedefs_attr_t\000struct __pyx_t_5spacy_7structs_LexemeC\000OOV_RANK\000EMPTY_LEXEMEstruct __pyx_t_5spacy_7structs_LexemeC\000EMPTY_LEXEMEuint64_t (void *, int, uint64_t)\000hash64"; + PyObject *data = NULL; + CYTHON_UNUSED_VAR(__Pyx_DecompressString); + #endif + PyObject **stringtab = __pyx_mstate->__pyx_string_tab; + Py_ssize_t pos = 0; + for (int i = 0; i < 107; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 18) PyUnicode_InternInPlace(&string); + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + stringtab[i] = string; + pos += bytes_length; + } + for (int i = 107; i < 115; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); + stringtab[i] = string; + pos += bytes_length; + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + Py_XDECREF(data); + for (Py_ssize_t i = 0; i < 115; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 107; + for (Py_ssize_t i=0; i<8; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + } + { + PyObject **numbertab = __pyx_mstate->__pyx_number_tab; + double const c_constants[] = {0.0,1.0,-20.0}; + for (int i = 0; i < 3; i++) { + numbertab[i] = PyFloat_FromDouble(c_constants[i]); + if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + { + PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 3; + int8_t const cint_constants_1[] = {0,1,2}; + for (int i = 0; i < 3; i++) { + numbertab[i] = PyLong_FromLong(cint_constants_1[i - 0]); + if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_number_tab; + for (Py_ssize_t i=0; i<6; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_codeobjects ### */ +typedef struct { + unsigned int argcount : 2; + unsigned int num_posonly_args : 1; + unsigned int num_kwonly_args : 1; + unsigned int nlocals : 3; + unsigned int flags : 10; + unsigned int first_line : 8; +} __Pyx_PyCode_New_function_description; +/* NewCodeObj.proto */ +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +); + + +static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { + PyObject* tuple_dedup_map = PyDict_New(); + if (unlikely(!tuple_dedup_map)) return -1; + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 100}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_attrs, __pyx_mstate->__pyx_n_u_attr, __pyx_mstate->__pyx_n_u_value}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_lexeme_pyx, __pyx_mstate->__pyx_n_u_set_attrs, __pyx_mstate->__pyx_kp_b_iso88591_A_AQ_F_5_a_z_1G1_at4vQ_at4vT_xt1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 112}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_flag_id, __pyx_mstate->__pyx_n_u_value}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_lexeme_pyx, __pyx_mstate->__pyx_n_u_set_flag, __pyx_mstate->__pyx_kp_b_iso88591_A_d_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 120}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_flag_id}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_lexeme_pyx, __pyx_mstate->__pyx_n_u_check_flag, __pyx_mstate->__pyx_kp_b_iso88591_A_4t, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 128}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_other, __pyx_mstate->__pyx_n_u_vector, __pyx_mstate->__pyx_n_u_xp, __pyx_mstate->__pyx_n_u_result}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_lexeme_pyx, __pyx_mstate->__pyx_n_u_similarity, __pyx_mstate->__pyx_kp_b_iso88591_A_7_7_t2V3e1_q_1G_d_QgS_q_Qd_BfC, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + } + Py_DECREF(tuple_dedup_map); + return 0; + bad: + Py_DECREF(tuple_dedup_map); + return -1; +} +/* #### Code section: init_globals ### */ + +static int __Pyx_InitGlobals(void) { + /* PythonCompatibility.init */ + if (likely(__Pyx_init_co_variables() == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CommonTypesMetaclass.init */ + if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CachedMethodType.init */ + #if CYTHON_COMPILING_IN_LIMITED_API + { + PyObject *typesModule=NULL; + typesModule = PyImport_ImportModule("types"); + if (typesModule) { + __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + } + } // error handling follows + #endif + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CythonFunctionShared.init */ + if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* GetTopmostException (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} +#endif + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif +{ + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C0000 + local_value = tstate->current_exception; + tstate->current_exception = 0; + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000 + local_value = PyErr_GetRaisedException(); +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif +#if __PYX_LIMITED_VERSION_HEX > 0x030C0000 + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } +#else + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } +#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000 + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif + } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + PyErr_SetHandledException(local_value); + Py_XDECREF(local_value); + Py_XDECREF(local_type); + Py_XDECREF(local_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000 +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +#endif +} + +/* PyObjectCall (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API + #if PY_VERSION_HEX < 0x03090000 + #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) + #elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { + PyTypeObject *tp = Py_TYPE(callable); + #if defined(__Pyx_CyFunction_USED) + if (__Pyx_CyFunction_CheckExact(callable)) { + return __Pyx_CyFunction_func_vectorcall(callable); + } + #endif + if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { + return NULL; + } + assert(PyCallable_Check(callable)); + Py_ssize_t offset = tp->tp_vectorcall_offset; + assert(offset > 0); + vectorcallfunc ptr; + memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); + return ptr; +} + #else + #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) + #endif +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if CYTHON_COMPILING_IN_LIMITED_API + return PyObject_Vectorcall(func, args, _nargs, NULL); + #else + vectorcallfunc f = __Pyx_PyVectorcall_Function(func); + if (f) { + return f(func, args, _nargs, NULL); + } + #endif + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* PyErrFetchRestore (used by RaiseException) */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* RaiseException */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); +#elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} + +/* tp_new */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __Pyx_tp_new_fallback(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + PyObject *new_func = NULL, *new_args = NULL, *obj; + Py_ssize_t i, nargs = PyTuple_Size(args); + if (unlikely(nargs < 0)) goto bad; + new_args = PyTuple_New(nargs + 1); + if (unlikely(!new_args)) goto bad; + for (i = 0; i < nargs + 1; i++) { + PyObject *item = (i == 0) ? type_obj : PyTuple_GetItem(args, i - 1); + if (unlikely(!item)) goto bad; + Py_INCREF(item); + if (unlikely(PyTuple_SetItem(new_args, i, item)) < 0) goto bad; + } + new_func = PyObject_GetAttrString(type_obj, "__new__"); + if (unlikely(!new_func)) goto bad; + obj = PyObject_Call(new_func, new_args, kwargs); + Py_DECREF(new_func); + Py_DECREF(new_args); + return obj; + bad: + Py_XDECREF(new_func); + Py_XDECREF(new_args); + return NULL; +} +#endif +static PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + newfunc tp_new = __Pyx_PyType_TryGetSlot((PyTypeObject*)type_obj, tp_new, newfunc); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) return __Pyx_tp_new_fallback(type_obj, args, kwargs); +#else + assert(tp_new != NULL); +#endif + return tp_new((PyTypeObject*)type_obj, args, kwargs); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* TupleAndListFromArray (used by fastcall) */ +#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + Py_ssize_t i; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + for (i = 0; i < n; i++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + return res; +} +#elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\ + !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + return PyObject_RichCompareBool(s1, s2, equals); +#else + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length, length2; + int kind; + void *data1, *data2; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + #endif + length = __Pyx_PyUnicode_GET_LENGTH(s1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length < 0)) return -1; + #endif + length2 = __Pyx_PyUnicode_GET_LENGTH(s2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length2 < 0)) return -1; + #endif + if (length != length2) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + return (equals == Py_EQ); +return_ne: + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(n == -1)) return NULL; + #endif + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + if (s == namei) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; + return kwvalues[i]; + } + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { + Py_ssize_t i, nkwargs; + PyObject *dict; +#if !CYTHON_ASSUME_SAFE_SIZE + nkwargs = PyTuple_Size(kwnames); + if (unlikely(nkwargs < 0)) return NULL; +#else + nkwargs = PyTuple_GET_SIZE(kwnames); +#endif + dict = PyDict_New(); + if (unlikely(!dict)) + return NULL; + for (i=0; itp_getattro)) + return tp->tp_getattro(obj, attr_name); + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + PyObject *result; + PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + if (unlikely(!selfless_args)) return NULL; + result = PyObject_Call(method, selfless_args, kwargs); + Py_DECREF(selfless_args); + return result; +} +#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { + return _PyObject_Vectorcall + (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames); +} +#else +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { + return +#if PY_VERSION_HEX < 0x03090000 + _PyObject_Vectorcall +#else + PyObject_Vectorcall +#endif + (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames); +} +#endif +static PyMethodDef __Pyx_UnboundCMethod_Def = { + "CythonUnboundCMethod", + __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 + METH_VARARGS | METH_KEYWORDS, +#else + METH_FASTCALL | METH_KEYWORDS, +#endif + NULL +}; +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method, *result=NULL; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + result = method; +#if CYTHON_COMPILING_IN_CPYTHON + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } else +#endif +#if CYTHON_COMPILING_IN_PYPY +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); +#endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); +#endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + result = unbound_method; + } + } +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + if (unlikely(target->method)) { + Py_DECREF(result); + } else +#endif + target->method = result; + return 0; +} + +/* CallUnboundCMethod0 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + if (likely(cfunc->flag == METH_NOARGS)) + return __Pyx_CallCFunction(cfunc, self, NULL); + if (likely(cfunc->flag == METH_FASTCALL)) + return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0); + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL); + if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS))) + return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (cfunc->flag == METH_VARARGS) + return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple); + return __Pyx__CallUnboundCMethod0(cfunc, self); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + PyObject *result; + if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; + result = __Pyx_PyObject_CallOneArg(cfunc->method, self); + return result; +} + +/* py_dict_items (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d); +} + +/* py_dict_values (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d); +} + +/* OwnedDictNext (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) { + PyObject *next = NULL; + if (!*ppos) { + if (pvalue) { + PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p); + if (unlikely(!dictview)) goto bad; + *ppos = PyObject_GetIter(dictview); + Py_DECREF(dictview); + } else { + *ppos = PyObject_GetIter(p); + } + if (unlikely(!*ppos)) goto bad; + } + next = PyIter_Next(*ppos); + if (!next) { + if (PyErr_Occurred()) goto bad; + return 0; + } + if (pkey && pvalue) { + *pkey = __Pyx_PySequence_ITEM(next, 0); + if (unlikely(*pkey)) goto bad; + *pvalue = __Pyx_PySequence_ITEM(next, 1); + if (unlikely(*pvalue)) goto bad; + Py_DECREF(next); + } else if (pkey) { + *pkey = next; + } else { + assert(pvalue); + *pvalue = next; + } + return 1; + bad: + Py_XDECREF(next); +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 + PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef"); +#else + PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef); +#endif + if (pkey) *pkey = NULL; + if (pvalue) *pvalue = NULL; + return 0; +} +#else // !CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) { + int result = PyDict_Next(p, ppos, pkey, pvalue); + if (likely(result == 1)) { + if (pkey) Py_INCREF(*pkey); + if (pvalue) Py_INCREF(*pvalue); + } + return result; +} +#endif + +/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); +} + +/* CallUnboundCMethod2 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, args, 2); + } + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *result = NULL; + PyObject *args = PyTuple_New(2); + if (unlikely(!args)) return NULL; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + return result; + } +#endif + { + PyObject *args[4] = {NULL, self, arg1, arg2}; + return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } +} + +/* ParseKeywordsImpl (used by ParseKeywords) */ +static int __Pyx_ValidateDuplicatePosArgs( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char* function_name) +{ + PyObject ** const *name = argnames; + while (name != first_kw_arg) { + PyObject *key = **name; + int found = PyDict_Contains(kwds, key); + if (unlikely(found)) { + if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; + } + name++; + } + return 0; +bad: + return -1; +} +#if CYTHON_USE_UNICODE_INTERNALS +static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) { + int kind; + Py_ssize_t len = PyUnicode_GET_LENGTH(s1); + if (len != PyUnicode_GET_LENGTH(s2)) return 0; + kind = PyUnicode_KIND(s1); + if (kind != PyUnicode_KIND(s2)) return 0; + const void *data1 = PyUnicode_DATA(s1); + const void *data2 = PyUnicode_DATA(s2); + return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0); +} +#endif +static int __Pyx_MatchKeywordArg_str( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + #if CYTHON_USE_UNICODE_INTERNALS + Py_hash_t key_hash = ((PyASCIIObject*)key)->hash; + if (unlikely(key_hash == -1)) { + key_hash = PyObject_Hash(key); + if (unlikely(key_hash == -1)) + goto bad; + } + #endif + name = first_kw_arg; + while (*name) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) { + *index_found = (size_t) (name - argnames); + return 1; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + *index_found = (size_t) (name - argnames); + return 1; + } + } + #endif + name++; + } + name = argnames; + while (name != first_kw_arg) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) { + if (__Pyx_UnicodeKeywordsEqual(name_str, key)) + goto arg_passed_twice; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + if (unlikely(name_str == key)) goto arg_passed_twice; + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + } + #endif + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +bad: + return -1; +} +static int __Pyx_MatchKeywordArg_nostr( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; + name = first_kw_arg; + while (*name) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (cmp == 1) { + *index_found = (size_t) (name - argnames); + return 1; + } + if (unlikely(cmp == -1)) goto bad; + name++; + } + name = argnames; + while (name != first_kw_arg) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (unlikely(cmp != 0)) { + if (cmp == 1) goto arg_passed_twice; + else goto bad; + } + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +bad: + return -1; +} +static CYTHON_INLINE int __Pyx_MatchKeywordArg( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + return likely(PyUnicode_CheckExact(key)) ? + __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) : + __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name); +} +static void __Pyx_RejectUnknownKeyword( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char *function_name) +{ + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; + #else + Py_ssize_t pos = 0; + #endif + PyObject *key = NULL; + __Pyx_BEGIN_CRITICAL_SECTION(kwds); + while ( + #if CYTHON_AVOID_BORROWED_REFS + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL) + #else + PyDict_Next(kwds, &pos, &key, NULL) + #endif + ) { + PyObject** const *name = first_kw_arg; + while (*name && (**name != key)) name++; + if (!*name) { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp != 1) { + if (cmp == 0) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + break; + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + } + __Pyx_END_CRITICAL_SECTION(); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); + #endif + assert(PyErr_Occurred()); +} +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t extracted = 0; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + name = first_kw_arg; + while (*name && num_kwargs > extracted) { + PyObject * key = **name; + PyObject *value; + int found = 0; + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + found = PyDict_GetItemRef(kwds, key, &value); + #else + value = PyDict_GetItemWithError(kwds, key); + if (value) { + Py_INCREF(value); + found = 1; + } else { + if (unlikely(PyErr_Occurred())) goto bad; + } + #endif + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + extracted++; + } + name++; + } + if (num_kwargs > extracted) { + if (ignore_unknown_kwargs) { + if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1)) + goto bad; + } else { + __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name); + goto bad; + } + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t len; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + if (PyDict_Update(kwds2, kwds) < 0) goto bad; + name = first_kw_arg; + while (*name) { + PyObject *key = **name; + PyObject *value; +#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)) + int found = PyDict_Pop(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int found = PyDict_GetItemRef(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad; + } +#else + #if CYTHON_COMPILING_IN_CPYTHON + value = _PyDict_Pop(kwds2, key, kwds2); + #else + value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2); + #endif + if (value == kwds2) { + Py_DECREF(value); + } else { + if (unlikely(!value)) goto bad; + values[name-argnames] = value; + } +#endif + name++; + } + len = PyDict_Size(kwds2); + if (len > 0) { + return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name); + } else if (unlikely(len == -1)) { + goto bad; + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject *key = NULL; + PyObject** const * name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) { +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); +#else + key = __Pyx_PyTuple_GET_ITEM(kwds, pos); +#endif +#if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!key)) goto bad; +#endif + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + PyObject *value = kwvalues[pos]; + values[name-argnames] = __Pyx_NewRef(value); + } else { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp == 1) { + PyObject *value = kwvalues[pos]; + values[index_found] = __Pyx_NewRef(value); + } else { + if (unlikely(cmp == -1)) goto bad; + if (kwds2) { + PyObject *value = kwvalues[pos]; + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else if (!ignore_unknown_kwargs) { + goto invalid_keyword; + } + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + key = NULL; + #endif + } + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + goto bad; +bad: + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(key); + #endif + return -1; +} + +/* ParseKeywords */ +static int __Pyx_ParseKeywords( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) + return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); + else if (kwds2) + return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name); + else + return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); +} + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* ArgTypeTestFunc (used by ArgTypeTest) */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode; + int from_annotation_subclass = 0; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (!exact) { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } else if (exact == 2) { + if (__Pyx_TypeCheck(obj, type)) { + from_annotation_subclass = 1; + extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately; + } + } + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")" +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + "%s%U" +#endif + , name, type_name, obj_type_name +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + , (from_annotation_subclass ? ". " : ""), extra_info +#endif + ); +#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + if (exact == 2 && from_annotation_subclass) { + PyObject *res; + PyObject *vargs[2]; + vargs[0] = PyErr_GetRaisedException(); + vargs[1] = extra_info; + res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL); + Py_XDECREF(res); + PyErr_SetRaisedException(vargs[0]); + } +#endif + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName (used by GetModuleGlobalName) */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, + "name '%U' is not defined", name); + } + return result; +} + +/* PyDictVersioning (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + if (!PyErr_Occurred()) + PyErr_SetNone(PyExc_NameError); + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } + PyErr_Clear(); +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return result; + } +#else + result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyObjectVectorCallKwBuilder (used by PyObjectVectorCallMethodKwBuilder) */ +#if CYTHON_VECTORCALL +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_PyObject_FastCallDict; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + args[n] = value; + return 0; +} +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_VectorcallBuilder_AddArgStr; + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); +} +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + PyObject *pyKey = PyUnicode_FromString(key); + if (!pyKey) return -1; + return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); +} +#else // CYTHON_VECTORCALL +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return PyDict_SetItem(builder, key, value); +} +#endif + +/* PyObjectVectorCallMethodKwBuilder */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) { + PyObject *result; + PyObject *obj = PyObject_GetAttr(args[0], name); + if (unlikely(!obj)) + return NULL; + result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames); + Py_DECREF(obj); + return result; +} +#endif + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + const char* function_name, + PyObject *kw) +{ +#if CYTHON_COMPILING_IN_PYPY && !defined(PyArg_ValidateKeywordArguments) + CYTHON_UNUSED_VAR(function_name); + CYTHON_UNUSED_VAR(kw); + return 0; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { +#if PY_VERSION_HEX >= 0x03090000 + CYTHON_UNUSED_VAR(function_name); +#else + Py_ssize_t kwsize; + #if CYTHON_ASSUME_SAFE_SIZE + kwsize = PyTuple_GET_SIZE(kw); + #else + kwsize = PyTuple_Size(kw); + if (unlikely(kwsize < 0)) return -1; + #endif + for (Py_ssize_t pos = 0; pos < kwsize; pos++) { + PyObject* key = NULL; + #if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); + #else + key = PyTuple_GetItem(kw, pos); + if (unlikely(!key)) return -1; + #endif + if (unlikely(!PyUnicode_Check(key))) { + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return -1; + } + } +#endif + } else { + if (unlikely(!PyArg_ValidateKeywordArguments(kw))) return -1; + } + return 0; +#endif +} + +/* PyObjectFastCallMethod */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { + PyObject *result; + PyObject *attr = PyObject_GetAttr(args[0], name); + if (unlikely(!attr)) + return NULL; + result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); + Py_DECREF(attr); + return result; +} +#endif + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* IterFinish */ +static CYTHON_INLINE int __Pyx_IterFinish(void) { + PyObject* exc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (unlikely(exc_type)) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) + return -1; + __Pyx_PyErr_Clear(); + return 0; + } + return 0; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* HasAttr */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!PyUnicode_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (!r) { + return (unlikely(PyErr_Occurred())) ? -1 : 0; + } else { + Py_DECREF(r); + return 1; + } +} +#endif + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* PyLongCompare */ +static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + return 1; + } + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + int unequal; + unsigned long uintval; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + if (intval == 0) { + return (__Pyx_PyLong_IsZero(op1) == 1); + } else if (intval < 0) { + if (__Pyx_PyLong_IsNonNeg(op1)) + return 0; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + return 0; + } + uintval = (unsigned long) intval; +#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 4)) { + unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 3)) { + unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 2)) { + unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 1)) { + unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif + unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); + return (unequal == 0); + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(op1); + return ((double)a == (double)b); + } + return __Pyx_PyObject_IsTrueAndDecref( + PyObject_RichCompare(op1, op2, Py_EQ)); +} + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) { + Py_INCREF(v); + return PyList_SetItem(o, n, v); + } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old; + Py_INCREF(v); + old = PyList_GET_ITEM(o, n); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 0; + } + } else +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_SetItem(o, i, v); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v); +} + +/* PyObjectSetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); + return PyObject_SetAttr(obj, attr_name, value); +} +#endif + +/* RejectKeywords */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) { + PyObject *key = NULL; + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) { + key = __Pyx_PySequence_ITEM(kwds, 0); + } else { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; +#else + Py_ssize_t pos = 0; +#endif +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return; +#endif + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL); +#if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); +#endif + } + if (likely(key)) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + Py_DECREF(key); + } +} + +/* AllocateExtensionType */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) { + if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc); + return alloc_func(t, 0); + } else { + newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc); + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) { + PyObject *new_str = PyUnicode_FromString("__new__"); + if (likely(new_str)) { + PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL); + Py_DECREF(new_str); + return o; + } else + return NULL; + } else + #endif + return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0); + } +} + +/* CallTypeTraverse */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) { + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000 + if (__Pyx_get_runtime_version() < 0x03090000) return 0; + #endif + if (!always_call) { + PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*); + unsigned long flags = PyType_GetFlags(base); + if (flags & Py_TPFLAGS_HEAPTYPE) { + return 0; + } + } + Py_VISIT((PyObject*)Py_TYPE(o)); + return 0; +} +#endif + +/* VoidPtrExport */ +static int __Pyx_ExportVoidPtr(PyObject *api_dict, const char *name, void *p, const char *sig) { + PyObject *cobj; + cobj = PyCapsule_New(p, sig, 0); + if (!cobj) + goto bad; + if (PyDict_SetItemString(api_dict, name, cobj) < 0) + goto bad; + Py_DECREF(cobj); + return 0; +bad: + Py_XDECREF(cobj); + return -1; +} + +/* GetApiDict */ +static PyObject *__Pyx_ApiExport_GetApiDict(void) { + PyObject *d; + if (__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_capi, &d) == -1) + return NULL; + if (!d) { + d = PyDict_New(); + if (!d) + goto bad; + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_pyx_capi, d) < 0) + goto bad; + } + return d; +bad: + Py_XDECREF(d); + return NULL; +} + +/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static Py_ssize_t __Pyx_GetTypeDictOffset(void) { + PyObject *tp_dictoffset_o; + Py_ssize_t tp_dictoffset; + tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__"); + if (unlikely(!tp_dictoffset_o)) return -1; + tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o); + Py_DECREF(tp_dictoffset_o); + if (unlikely(tp_dictoffset == 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' doesn't have a dictoffset"); + return -1; + } else if (unlikely(tp_dictoffset < 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' has an unexpected negative dictoffset. " + "Please report this as Cython bug"); + return -1; + } + return tp_dictoffset; +} +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) { + static Py_ssize_t tp_dictoffset = 0; + if (unlikely(tp_dictoffset == 0)) { + tp_dictoffset = __Pyx_GetTypeDictOffset(); + if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) { + tp_dictoffset = 0; // try again next time? + return NULL; + } + } + return *(PyObject**)((char*)tp + tp_dictoffset); +} +#endif + +/* SetItemOnTypeDict (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) { + int result; + PyObject *tp_dict; +#if CYTHON_COMPILING_IN_LIMITED_API + tp_dict = __Pyx_GetTypeDict(tp); + if (unlikely(!tp_dict)) return -1; +#else + tp_dict = tp->tp_dict; +#endif + result = PyDict_SetItem(tp_dict, k, v); + if (likely(!result)) { + PyType_Modified(tp); + if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) { + PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL); + if (!setNameResult) return -1; + Py_DECREF(setNameResult); + } + } + return result; +} + +/* FixUpExtensionType */ +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if __PYX_LIMITED_VERSION_HEX > 0x030900B1 + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#else + const PyType_Slot *slot = spec->slots; + int changed = 0; +#if !CYTHON_COMPILING_IN_LIMITED_API + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { +#if !CYTHON_COMPILING_IN_CPYTHON + const +#endif // !CYTHON_COMPILING_IN_CPYTHON) + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_vectorcall_offset = memb->offset; + changed = 1; + } +#endif // CYTHON_METH_FASTCALL +#if !CYTHON_COMPILING_IN_PYPY + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } +#endif // !CYTHON_COMPILING_IN_PYPY + } + memb++; + } + } +#endif // !CYTHON_COMPILING_IN_LIMITED_API +#if !CYTHON_COMPILING_IN_PYPY + slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_getset) + slot++; + if (slot && slot->slot == Py_tp_getset) { + PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc; + while (getset && getset->name) { + if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) { + PyObject *descr = PyDescr_NewGetSet(type, getset); + if (unlikely(!descr)) + return -1; + #if CYTHON_COMPILING_IN_LIMITED_API + PyObject *pyname = PyUnicode_FromString(getset->name); + if (unlikely(!pyname)) { + Py_DECREF(descr); + return -1; + } + int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr); + Py_DECREF(pyname); + #else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + #endif + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } + ++getset; + } + } +#else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#endif // !CYTHON_COMPILING_IN_PYPY + if (changed) + PyType_Modified(type); +#endif // PY_VERSION_HEX > 0x030900B1 + return 0; +} + +/* PyObjectCallNoArg (used by PyObjectCallMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg[2] = {NULL, NULL}; + return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod (used by PyObjectCallMethod0) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } +#endif + *method = attr; + return 0; +} +#endif + +/* PyObjectCallMethod0 (used by PyType_Ready) */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[1] = {obj}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_CallNoArg; + return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +#endif +} + +/* ValidateBasesTuple (used by PyType_Ready) */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_SIZE + n = PyTuple_GET_SIZE(bases); +#else + n = PyTuple_Size(bases); + if (unlikely(n < 0)) return -1; +#endif + for (i = 1; i < n; i++) + { + PyTypeObject *b; +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + if (dictoffset == 0) + { + Py_ssize_t b_dictoffset = 0; +#if CYTHON_USE_TYPE_SLOTS + b_dictoffset = b->tp_dictoffset; +#else + PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__"); + if (!py_b_dictoffset) goto dictoffset_return; + b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset); + Py_DECREF(py_b_dictoffset); + if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return; +#endif + if (b_dictoffset) { + { + __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); + } +#if !CYTHON_USE_TYPE_SLOTS + dictoffset_return: +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + } +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + } + return 0; +} +#endif + +/* PyType_Ready */ +CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) { + while (t) { + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases) { + return 1; + } + t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*); + } + return 0; +} +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + if (!__Pyx_PyType_HasMultipleInheritance(t)) { + return PyType_Ready(t); + } + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\ + !CYTHON_COMPILING_IN_GRAAL + gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* GetVTable (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i=0; + Py_ssize_t size; + void** base_vtables; + __Pyx_TypeName tp_base_name = NULL; + __Pyx_TypeName base_name = NULL; + void* unknown = (void*)-1; + PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); + int base_depth = 0; + { + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (base) { + base_depth += 1; + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; +#if CYTHON_COMPILING_IN_LIMITED_API + size = PyTuple_Size(bases); + if (size < 0) goto other_failure; +#else + size = PyTuple_GET_SIZE(bases); +#endif + for (i = 1; i < size; i++) { + PyObject *basei; + void* base_vtable; +#if CYTHON_AVOID_BORROWED_REFS + basei = PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#else + basei = PyTuple_GET_ITEM(bases, i); +#endif + base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + if (base_vtable != NULL) { + int j; + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + } + PyErr_Clear(); + PyMem_Free(base_vtables); + return 0; +bad: + { + PyTypeObject* basei = NULL; + PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); +#if CYTHON_AVOID_BORROWED_REFS + basei = (PyTypeObject*)PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = (PyTypeObject*)PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#else + basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); +#endif + base_name = __Pyx_PyType_GetFullyQualifiedName(basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + } + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); +#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +really_bad: // bad has failed! +#endif + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +other_failure: +#endif + PyMem_Free(base_vtables); + return -1; +} + +/* DelItemOnTypeDict (used by SetupReduce) */ +static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) { + int result; + PyObject *tp_dict; +#if CYTHON_COMPILING_IN_LIMITED_API + tp_dict = __Pyx_GetTypeDict(tp); + if (unlikely(!tp_dict)) return -1; +#else + tp_dict = tp->tp_dict; +#endif + result = PyDict_DelItem(tp_dict, k); + if (likely(!result)) PyType_Modified(tp); + return result; +} + +/* SetupReduce */ +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_name); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate); +#else + getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate); + if (!getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (getstate) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); +#else + object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); + if (!object_getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (object_getstate != getstate) { + goto __PYX_GOOD; + } + } +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); + if (likely(reduce_cython)) { + ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); + if (likely(setstate_cython)) { + ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } + } + PyType_Modified((PyTypeObject*)type_obj); + } + } + goto __PYX_GOOD; +__PYX_BAD: + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); + } + ret = -1; +__PYX_GOOD: +#if !CYTHON_USE_PYTYPE_LOOKUP + Py_XDECREF(object_reduce); + Py_XDECREF(object_reduce_ex); + Py_XDECREF(object_getstate); + Py_XDECREF(getstate); +#endif + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; +} + +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_2_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size) +{ + PyObject *result = 0; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) + PyObject *py_basicsize; + PyObject *py_itemsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) ) + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; +#else + if (size == 0) { + return (PyTypeObject *)result; + } + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize+itemsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_1 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_1 && (size_t)basicsize > size) { + if (PyErr_WarnFormat(NULL, 0, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize) < 0) { + goto bad; + } + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; +} +#endif + +/* PxdImportShared (used by VoidPtrImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(PyObject *module, const char *name, void **p, const char *sig, const char *what) { + PyObject *d = 0; + PyObject *cobj = 0; + d = PyObject_GetAttrString(module, "__pyx_capi__"); + if (!d) + goto bad; +#if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000) + PyDict_GetItemStringRef(d, name, &cobj); +#else + cobj = PyDict_GetItemString(d, name); + Py_XINCREF(cobj); +#endif + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%.200s does not export expected C %.8s %.200s", + PyModule_GetName(module), what, name); + goto bad; + } + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C %.8s %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", + what, PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); + goto bad; + } + *p = PyCapsule_GetPointer(cobj, sig); + if (!(*p)) + goto bad; + Py_DECREF(d); + Py_DECREF(cobj); + return 0; +bad: + Py_XDECREF(d); + Py_XDECREF(cobj); + return -1; +} +#endif + +/* VoidPtrImport */ +#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +#define __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig) { + return __Pyx_ImportFromPxd_3_2_1(module, name, p, sig, "variable"); +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* ImportImpl (used by Import) */ +static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) { + PyObject *imported_module = PyImport_GetModule(qualname); + if (unlikely(!imported_module)) { + *module = NULL; + if (PyErr_Occurred()) { + return -1; + } + return 0; + } + *module = imported_module; + return 1; +} +static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) { + PyObject *imported_module; + PyObject *top_level_package_name; + Py_ssize_t i; + int status, module_found; + Py_ssize_t dot_index; + module_found = __Pyx__Import_GetModule(qualname, &imported_module); + if (unlikely(!module_found || module_found == -1)) { + *module = NULL; + return module_found; + } + if (imported_names) { + for (i = 0; i < len_imported_names; i++) { + PyObject *imported_name = imported_names[i]; +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 + int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name); +#else + int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name); + if (unlikely(has_imported_attribute == -1)) goto error; +#endif + if (!has_imported_attribute) { + goto not_found; + } + } + *module = imported_module; + return 1; + } + dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1); + if (dot_index == -1) { + *module = imported_module; + return 1; + } + if (unlikely(dot_index == -2)) goto error; + top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index); + if (unlikely(!top_level_package_name)) goto error; + Py_DECREF(imported_module); + status = __Pyx__Import_GetModule(top_level_package_name, module); + Py_DECREF(top_level_package_name); + return status; +error: + Py_DECREF(imported_module); + *module = NULL; + return -1; +not_found: + Py_DECREF(imported_module); + *module = NULL; + return 0; +} +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *from_list = 0; + int module_found; + if (!qualname) { + qualname = name; + } + module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module); + if (likely(module_found == 1)) { + return module; + } else if (unlikely(module_found == -1)) { + return NULL; + } + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + if (imported_names) { +#if CYTHON_COMPILING_IN_CPYTHON + from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names); + if (unlikely(!from_list)) + goto bad; +#else + from_list = PyList_New(len_imported_names); + if (unlikely(!from_list)) goto bad; + for (Py_ssize_t i=0; i__pyx_d, level); +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u_); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\ + CYTHON_COMPILING_IN_GRAAL + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); + } + return value; +} + +/* dict_setdefault (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + PyObject *args[] = {d, key, default_value}; + value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#elif CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#else + value = PyDict_SetDefault(d, key, default_value); + if (unlikely(!value)) return NULL; + Py_INCREF(value); +#endif + return value; +} + +/* AddModuleRef (used by FetchSharedCythonModule) */ +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { + PyObject *module_dict = PyImport_GetModuleDict(); + PyObject *m; + if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { + return NULL; + } + if (m != NULL && PyModule_Check(m)) { + return m; + } + Py_XDECREF(m); + m = PyModule_NewObject(name); + if (m == NULL) + return NULL; + if (PyDict_CheckExact(module_dict)) { + PyObject *new_m; + (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); + Py_DECREF(m); + return new_m; + } else { + if (PyObject_SetItem(module_dict, name, m) != 0) { + Py_DECREF(m); + return NULL; + } + return m; + } + } + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *py_name = PyUnicode_FromString(name); + if (!py_name) return NULL; + PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); + Py_DECREF(py_name); + return module; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } +#endif + +/* FetchSharedCythonModule (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME); +} + +/* FetchCommonType (used by CommonTypesMetaclass) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases); + if (result && metaclass) { + PyObject *old_tp = (PyObject*)Py_TYPE(result); + Py_INCREF((PyObject*)metaclass); +#if __PYX_LIMITED_VERSION_HEX >= 0x03090000 + Py_SET_TYPE(result, metaclass); +#else + result->ob_type = metaclass; +#endif + Py_DECREF(old_tp); + } + return result; +} +#else +#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b) +#endif +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t expected_basicsize) { + Py_ssize_t basicsize; + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (expected_basicsize == 0) { + return 0; // size is inherited, nothing useful to check + } +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) return -1; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = NULL; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; +#else + basicsize = ((PyTypeObject*) cached_type)->tp_basicsize; +#endif + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name; + int get_item_ref_result; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + py_object_name = PyUnicode_FromString(object_name); + if (!py_object_name) return NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) goto done; + abi_module_dict = PyModule_GetDict(abi_module); + if (!abi_module_dict) goto done; + get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type); + if (get_item_ref_result == 1) { + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else if (unlikely(get_item_ref_result == -1)) { + goto bad; + } + cached_type = __Pyx_PyType_FromMetaclass( + metaclass, + CYTHON_USE_MODULE_STATE ? module : abi_module, + spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type); + if (unlikely(new_cached_type != cached_type)) { + if (unlikely(!new_cached_type)) goto bad; + Py_DECREF(cached_type); + cached_type = new_cached_type; + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else { + Py_DECREF(new_cached_type); + } +done: + Py_XDECREF(abi_module); + Py_DECREF(py_object_name); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +/* CommonTypesMetaclass (used by CythonFunctionShared) */ +static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) { + return PyUnicode_FromString(__PYX_ABI_MODULE_NAME); +} +#if __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) { + PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types"); + return NULL; +} +static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) { + PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable"); + return -1; +} +#endif +static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = { + {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = { + {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset}, + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr}, + #endif + {0, 0} +}; +static PyType_Spec __pyx_CommonTypesMetaclass_spec = { + __PYX_TYPE_MODULE_PREFIX "_common_types_metatype", + 0, + 0, + Py_TPFLAGS_IMMUTABLETYPE | + Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT, + __pyx_CommonTypesMetaclass_slots +}; +static int __pyx_CommonTypesMetaclass_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + PyObject *bases = PyTuple_Pack(1, &PyType_Type); + if (unlikely(!bases)) { + return -1; + } + mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases); + Py_DECREF(bases); + if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) { + return -1; + } + return 0; +} + +/* PyMethodNew (used by CythonFunctionShared) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *result; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + { + PyObject *args[] = {func, self}; + result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL); + } + #else + result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL); + #endif + return result; +} +#else +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#endif + +/* PyVectorcallFastCallDict (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i; + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos; + #else + Py_ssize_t pos; + #endif + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + #if !CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t nkw = PyDict_Size(kw); + if (unlikely(nkw == -1)) return NULL; + #else + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + #endif + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = 0; + i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) { + keys_are_strings &= + #if CYTHON_COMPILING_IN_LIMITED_API + PyType_GetFlags(Py_TYPE(key)); + #else + Py_TYPE(key)->tp_flags; + #endif + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup; + #else + PyTuple_SET_ITEM(kwnames, i, key); + #endif + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(pos); + #endif + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + Py_ssize_t kw_size = + likely(kw == NULL) ? + 0 : +#if !CYTHON_ASSUME_SAFE_SIZE + PyDict_Size(kw); +#else + PyDict_GET_SIZE(kw); +#endif + if (kw_size == 0) { + return vc(func, args, nargs, NULL); + } +#if !CYTHON_ASSUME_SAFE_SIZE + else if (unlikely(kw_size == -1)) { + return NULL; + } +#endif + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif + +/* CythonFunctionShared (used by CythonFunction) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) { + if (__Pyx_CyFunction_Check(func)) { + return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; + } else if (PyCFunction_Check(func)) { + return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; + } + return 0; +} +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) { + int result; + PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func); + if (unlikely(!newFunc)) { + PyErr_Clear(); // It's only an optimization, so don't throw an error + return 0; + } + result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc); + Py_DECREF(newFunc); + return result; + } + return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc); +} +#else +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if (PyMethod_Check(func)) { + func = PyMethod_GET_FUNCTION(func); + } + return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +} +#endif +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + PyObject *result; + CYTHON_UNUSED_VAR(closure); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_doc_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#else + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_name_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_name, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + PyObject *result; + __Pyx_BEGIN_CRITICAL_SECTION(op); + Py_INCREF(op->func_qualname); + result = op->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +#endif +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_defaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_kwdefaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_annotations_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) { + int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; + if (is_coroutine) { + PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(is_coroutine_value)) { + return is_coroutine_value; + } +ignore: + PyErr_Clear(); + } + return __Pyx_PyBool_FromLong(is_coroutine); +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + result = __Pyx_CyFunction_get_is_coroutine_value(op); + if (unlikely(!result)) + return NULL; + __Pyx_BEGIN_CRITICAL_SECTION(op); + if (op->func_is_coroutine) { + Py_DECREF(result); + result = __Pyx_NewRef(op->func_is_coroutine); + } else { + op->func_is_coroutine = __Pyx_NewRef(result); + } + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, message, size); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + name, message, size); +#endif +} +static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s", + py_name, message); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s", + name, message); +#endif +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, +#else + {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, +#endif + {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#endif +#if CYTHON_METH_FASTCALL +#if CYTHON_COMPILING_IN_LIMITED_API + {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else + {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(args); + __Pyx_BEGIN_CRITICAL_SECTION(m); + Py_INCREF(m->func_qualname); + result = m->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + op->func_dict = NULL; +#endif + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func_dict); +#elif PY_VERSION_HEX < 0x030d0000 + _PyObject_ClearManagedDict((PyObject*)m); +#else + PyObject_ClearManagedDict((PyObject*)m); +#endif + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + Py_CLEAR(m->defaults); + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + { + int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg); + if (e) return e; + } + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func_dict); +#else + { + int e = +#if PY_VERSION_HEX < 0x030d0000 + _PyObject_VisitManagedDict +#else + PyObject_VisitManagedDict +#endif + ((PyObject*)m, visit, arg); + if (e != 0) return e; + } +#endif + __Pyx_VISIT_CONST(m->func_name); + __Pyx_VISIT_CONST(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + __Pyx_VISIT_CONST(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + Py_VISIT(m->defaults); + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ + PyObject *repr; + __Pyx_BEGIN_CRITICAL_SECTION(op); + repr = PyUnicode_FromFormat("", + op->func_qualname, (void *)op); + __Pyx_END_CRITICAL_SECTION(); + return repr; +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes no arguments", size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes exactly one argument", size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } + __Pyx_CyFunction_raise_type_error( + (__pyx_CyFunctionObject*)func, "takes no keyword arguments"); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_SIZE + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(argc < 0)) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "needs an argument"); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "takes no keyword arguments"); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes no arguments", nargs); + return NULL; + } + return meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes exactly one argument", nargs); + return NULL; + } + return meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + #if PY_VERSION_HEX < 0x030e00A6 + size_t nargs_value = (size_t) nargs; + #else + Py_ssize_t nargs_value = nargs; + #endif + return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames); +} +#endif +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if CYTHON_METH_FASTCALL +#if defined(Py_TPFLAGS_HAVE_VECTORCALL) + Py_TPFLAGS_HAVE_VECTORCALL | +#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif +#endif // CYTHON_METH_FASTCALL +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_DICT | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +static int __pyx_CyFunction_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL); + if (unlikely(mstate->__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type); + if (unlikely(!m->defaults)) + return NULL; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* CLineInTraceback (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) +#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); +#else +PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { + PyObject **dict_ptr = _PyObject_GetDictPtr(o); + return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; +} +#endif +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline = NULL; + PyObject *ptype, *pvalue, *ptraceback; + PyObject *cython_runtime_dict; + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, cython_runtime_dict, + __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) + } + if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + Py_XDECREF(use_cline); + Py_XDECREF(cython_runtime_dict); + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache (used by AddTraceback) */ +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { + __Pyx_CachedCodeObjectType* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!code_cache->entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { + return NULL; + } + code_object = code_cache->entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__find_code_object; + return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); + if (old_count < 0) { + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); + return NULL; + } +#endif + __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); +#endif + return result; +#endif +} +static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) +{ + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + code_cache->entries = entries; + code_cache->max_count = 64; + code_cache->count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { + __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_INCREF(code_object); + Py_DECREF(tmp); + return; + } + if (code_cache->count == code_cache->max_count) { + int new_max = code_cache->max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + code_cache->entries = entries; + code_cache->max_count = new_max; + } + for (i=code_cache->count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + code_cache->count++; + Py_INCREF(code_object); +} +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__insert_code_object; + return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type expected = 0; + if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { + return; + } +#endif + __pyx__insert_code_object(code_cache, code_line, code_object); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); +#endif +#endif +} + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!code_object) { + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + } else { + py_funcname = PyUnicode_FromString(funcname); + } + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); + } else { + dict = PyDict_New(); + } + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + } + py_code = PyCode_NewEmpty(filename, funcname, py_line); + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} +#endif + +/* CIntFromPyVerify */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_float(a, a); + case 3: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); + case 4: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powf(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2f(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_double(a, a); + case 3: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); + case 4: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = pow(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return ::std::complex< long double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + __pyx_t_long_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsl(b.real) >= fabsl(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + long double r = b.imag / b.real; + long double s = (long double)(1.0) / (b.real + b.imag * r); + return __pyx_t_long_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + long double r = b.real / b.imag; + long double s = (long double)(1.0) / (b.imag + b.real * r); + return __pyx_t_long_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + long double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_long_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtl(z.real*z.real + z.imag*z.imag); + #else + return hypotl(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + long double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + long double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_long__double(a, a); + case 3: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, a); + case 4: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powl(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2l(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_long__double(a); + theta = atan2l(a.imag, a.real); + } + lnr = logl(r); + z_r = expl(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosl(z_theta); + z.imag = z_r * sinl(z_theta); + return z; + } + #endif +#endif + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(uint64_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint64_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPy */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyLong_As_uint64_t(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint64_t val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(uint64_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((uint64_t) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (uint64_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + int val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (int) -1; + val = __Pyx_PyLong_As_int(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(int) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + int val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (int) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = v; + } + v = NULL; + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((int) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (int) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE enum __pyx_t_5spacy_5attrs_attr_id_t __Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum __pyx_t_5spacy_5attrs_attr_id_t neg_one = (enum __pyx_t_5spacy_5attrs_attr_id_t) -1, const_zero = (enum __pyx_t_5spacy_5attrs_attr_id_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + enum __pyx_t_5spacy_5attrs_attr_id_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; + val = __Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) >= 2 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) >= 3 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) >= 4 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 2 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((enum __pyx_t_5spacy_5attrs_attr_id_t)-1)*(((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 2 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) ((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 3 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((enum __pyx_t_5spacy_5attrs_attr_id_t)-1)*(((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 3 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) ((((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 4 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((enum __pyx_t_5spacy_5attrs_attr_id_t)-1)*(((((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 4 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) ((((((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_5attrs_attr_id_t, long, PyLong_AsLong(x)) + } else if ((sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_5attrs_attr_id_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + enum __pyx_t_5spacy_5attrs_attr_id_t val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() or PyLong_AsNativeBytes() not available, cannot convert large enums"); + val = (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; +#endif + if (unlikely(ret)) + return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to enum __pyx_t_5spacy_5attrs_attr_id_t"); + return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to enum __pyx_t_5spacy_5attrs_attr_id_t"); + return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static __Pyx_TypeName +__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) +{ + PyObject *module = NULL, *name = NULL, *result = NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_qualname); + #else + name = PyType_GetQualName(tp); + #endif + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; + module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_module); + if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; + if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { + result = name; + name = NULL; + goto done; + } + result = PyUnicode_FromFormat("%U.%U", module, name); + if (unlikely(result == NULL)) goto bad; + done: + Py_XDECREF(name); + Py_XDECREF(module); + return result; + bad: + PyErr_Clear(); + if (name) { + result = name; + name = NULL; + } else { + result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__2); + } + goto done; +} +#endif + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + long val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (long) -1; + val = __Pyx_PyLong_As_long(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + long val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (long) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (long) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = v; + } + v = NULL; + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((long) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (long) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); + for (i=0; i>= 8; + ++i; + } + __Pyx_cached_runtime_version = version; + } +} +#endif +static unsigned long __Pyx_get_runtime_version(void) { +#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + return Py_Version & ~0xFFUL; +#else + return __Pyx_cached_runtime_version; +#endif +} + +/* CheckBinaryVersion */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { + const unsigned long MAJOR_MINOR = 0xFFFF0000UL; + if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) + return 0; + if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) + return 1; + { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compile time Python version %d.%d " + "of module '%.100s' " + "%s " + "runtime version %d.%d", + (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), + __Pyx_MODULE_NAME, + (allow_newer) ? "was newer than" : "does not match", + (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) + ); + return PyErr_WarnEx(NULL, message, 1); + } +} + +/* NewCodeObj */ +#if CYTHON_COMPILING_IN_LIMITED_API + static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + PyObject *version_info; + PyObject *py_minor_version = NULL; + #endif + long minor_version = 0; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + minor_version = 11; + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + Py_DECREF(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + if (type) { + PyErr_Restore(type, value, traceback); + } + return result; + } +#elif PY_VERSION_HEX >= 0x030B0000 + static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1 + if (likely(result)) + result->_co_firsttraceable = 0; + #endif + return result; + } +#elif !CYTHON_COMPILING_IN_PYPY + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +) { + PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL; + Py_ssize_t var_count = (Py_ssize_t) descr.nlocals; + PyObject *varnames_tuple = PyTuple_New(var_count); + if (unlikely(!varnames_tuple)) return NULL; + for (Py_ssize_t i=0; i < var_count; i++) { + Py_INCREF(varnames[i]); + if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done; + } + #if CYTHON_COMPILING_IN_LIMITED_API + varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple); + if (!varnames_tuple_dedup) { + if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done; + varnames_tuple_dedup = varnames_tuple; + } + #else + varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple); + if (unlikely(!varnames_tuple_dedup)) goto done; + #endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(varnames_tuple_dedup); + #endif + if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) { + Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(line_table_length == -1)) goto done; + #endif + Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL; + code_bytes = PyBytes_FromStringAndSize(NULL, code_len); + if (unlikely(!code_bytes)) goto done; + char* c_code_bytes = PyBytes_AsString(code_bytes); + if (unlikely(!c_code_bytes)) goto done; + memset(c_code_bytes, 0, (size_t) code_len); + } + code_obj = (PyObject*) __Pyx__PyCode_New( + (int) descr.argcount, + (int) descr.num_posonly_args, + (int) descr.num_kwonly_args, + (int) descr.nlocals, + 0, + (int) descr.flags, + code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + varnames_tuple_dedup, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + filename, + funcname, + (int) descr.first_line, + (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes + ); +done: + Py_XDECREF(code_bytes); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(varnames_tuple_dedup); + #endif + Py_DECREF(varnames_tuple); + return code_obj; +} + +/* DecompressString */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { + PyObject *module, *decompress, *compressed_bytes, *decompressed; + const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; + PyObject *methodname = PyUnicode_FromString("decompress"); + if (unlikely(!methodname)) return NULL; + #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 + if (algo == 3) { + PyObject *fromlist = Py_BuildValue("[O]", methodname); + if (unlikely(!fromlist)) return NULL; + module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + } else + #endif + module = PyImport_ImportModule(module_name); + if (unlikely(!module)) goto import_failed; + decompress = PyObject_GetAttr(module, methodname); + if (unlikely(!decompress)) goto import_failed; + { + #ifdef __cplusplus + char *memview_bytes = const_cast(s); + #else + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wcast-qual" + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-qual" + #endif + char *memview_bytes = (char*) s; + #if defined(__clang__) + #pragma clang diagnostic pop + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + #endif + #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) + int memview_flags = 0x100; + #else + int memview_flags = PyBUF_READ; + #endif + compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); + } + if (unlikely(!compressed_bytes)) { + Py_DECREF(decompress); + goto bad; + } + decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); + Py_DECREF(compressed_bytes); + Py_DECREF(decompress); + Py_DECREF(module); + Py_DECREF(methodname); + return decompressed; +import_failed: + PyErr_Format(PyExc_ImportError, + "Failed to import '%.20s.decompress' - cannot initialise module strings. " + "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", + module_name, algo); +bad: + Py_XDECREF(module); + Py_DECREF(methodname); + return NULL; +} + +#include +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return __Pyx_PyUnicode_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return PyByteArray_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + { + const char* result; + Py_ssize_t unicode_length; + CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; + #else + result = PyUnicode_AsUTF8AndSize(o, length); + #endif + #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + unicode_length = PyUnicode_GetLength(o); + if (unlikely(unicode_length < 0)) return NULL; + if (unlikely(unicode_length != *length)) { + PyUnicode_AsASCIIString(o); + return NULL; + } + #endif + return result; + } +#else +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +#endif +} +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + if (PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif + if (PyByteArray_Check(o)) { +#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); +#else + *length = PyByteArray_Size(o); + if (*length == -1) return NULL; + return PyByteArray_AsString(o); +#endif + } else + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; + } + __Pyx_DECREF_TypeName(result_type_name); + return result; + } + PyErr_Format(PyExc_TypeError, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", + result_type_name); + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + PyObject *res = NULL; + if (likely(PyLong_Check(x))) + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + if (likely(m && m->nb_int)) { + res = m->nb_int(x); + } +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Long(x); + } +#endif + if (likely(res)) { + if (unlikely(!PyLong_CheckExact(res))) { + return __Pyx_PyNumber_LongWrongResultType(res); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); + } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyLong_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyLong_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { + CYTHON_UNUSED_VAR(b); + return __Pyx_NewRef(Py_None); +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return __Pyx_NewRef(b ? Py_True: Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { + return PyLong_FromSize_t(ival); +} + + +/* MultiPhaseInitModuleState */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 +#else + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 +#endif +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS +#error "Module state with PEP489 requires atomics. Currently that's one of\ + C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" +#endif +#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#define __Pyx_ModuleStateLookup_Lock() +#define __Pyx_ModuleStateLookup_Unlock() +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 +static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; +#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(__cplusplus) && __cplusplus >= 201103L +#include +static std::mutex __Pyx_ModuleStateLookup_mutex; +#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() +#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) +#include +static mtx_t __Pyx_ModuleStateLookup_mutex; +static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; +static void __Pyx_ModuleStateLookup_initialize_mutex(void) { + mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); +} +#define __Pyx_ModuleStateLookup_Lock()\ + call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ + mtx_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(HAVE_PTHREAD_H) +#include +static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; +#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(_WIN32) +#include // synchapi.h on its own doesn't work +static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; +#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#else +#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ + Requires C standard >= C11, or C++ standard >= C++11,\ + or pthreads, or the Windows 32 API, or Python >= 3.13." +#endif +typedef struct { + int64_t id; + PyObject *module; +} __Pyx_InterpreterIdAndModule; +typedef struct { + char interpreter_id_as_index; + Py_ssize_t count; + Py_ssize_t allocated; + __Pyx_InterpreterIdAndModule table[1]; +} __Pyx_ModuleStateLookupData; +#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; +#else +static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; +#endif +static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( + __Pyx_InterpreterIdAndModule* table, + Py_ssize_t count, + int64_t interpreterId) { + __Pyx_InterpreterIdAndModule* begin = table; + __Pyx_InterpreterIdAndModule* end = begin + count; + if (begin->id == interpreterId) { + return begin; + } + while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; + if (halfway->id == interpreterId) { + return halfway; + } + if (halfway->id < interpreterId) { + begin = halfway; + } else { + end = halfway; + } + } + for (; begin < end; ++begin) { + if (begin->id >= interpreterId) return begin; + } + return begin; +} +static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return NULL; +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + { + __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + if (likely(data)) { + __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); + if (likely(data == new_data)) { + goto read_finished; + } + } + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + __Pyx_ModuleStateLookup_Lock(); + __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); + data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + __Pyx_ModuleStateLookup_Unlock(); + } + read_finished:; +#else + __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_InterpreterIdAndModule* found = NULL; + if (unlikely(!data)) goto end; + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + found = data->table+interpreter_id; + } + } else { + found = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + } + end: + { + PyObject *result=NULL; + if (found && found->id == interpreter_id) { + result = found->module; + } +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); +#endif + return result; + } +} +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { + while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); +} +#else +#define __Pyx_ModuleStateLookup_wait_until_no_readers() +#endif +static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { + Py_ssize_t to_allocate = (*old_data)->allocated; + while (to_allocate <= interpreter_id) { + if (to_allocate == 0) to_allocate = 1; + else to_allocate *= 2; + } + __Pyx_ModuleStateLookupData *new_data = *old_data; + if (to_allocate != (*old_data)->allocated) { + new_data = (__Pyx_ModuleStateLookupData *)realloc( + *old_data, + sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + PyErr_NoMemory(); + return -1; + } + for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { + new_data->table[i].id = i; + new_data->table[i].module = NULL; + } + new_data->allocated = to_allocate; + } + new_data->table[interpreter_id].module = module; + if (new_data->count < interpreter_id+1) { + new_data->count = interpreter_id+1; + } + *old_data = new_data; + return 0; +} +static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { + __Pyx_InterpreterIdAndModule *read = data->table; + __Pyx_InterpreterIdAndModule *write = data->table; + __Pyx_InterpreterIdAndModule *end = read + data->count; + for (; readmodule) { + write->id = read->id; + write->module = read->module; + ++write; + } + } + data->count = write - data->table; + for (; writeid = 0; + write->module = NULL; + } + data->interpreter_id_as_index = 0; +} +static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + int result = 0; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_ModuleStateLookupData *new_data = old_data; + if (!new_data) { + new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); + if (!new_data) { + result = -1; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = 1; + new_data->interpreter_id_as_index = 1; + } + __Pyx_ModuleStateLookup_wait_until_no_readers(); + if (new_data->interpreter_id_as_index) { + if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); + goto end; + } + __Pyx_State_ConvertFromInterpIdAsIndex(new_data); + } + { + Py_ssize_t insert_at = 0; + { + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + new_data->table, new_data->count, interpreter_id); + assert(lower_bound); + insert_at = lower_bound - new_data->table; + if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { + lower_bound->module = module; + goto end; // already in table, nothing more to do + } + } + if (new_data->count+1 >= new_data->allocated) { + Py_ssize_t to_allocate = (new_data->count+1)*2; + new_data = + (__Pyx_ModuleStateLookupData*)realloc( + new_data, + sizeof(__Pyx_ModuleStateLookupData) + + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + result = -1; + new_data = old_data; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = to_allocate; + } + ++new_data->count; + int64_t last_id = interpreter_id; + PyObject *last_module = module; + for (Py_ssize_t i=insert_at; icount; ++i) { + int64_t current_id = new_data->table[i].id; + new_data->table[i].id = last_id; + last_id = current_id; + PyObject *current_module = new_data->table[i].module; + new_data->table[i].module = last_module; + last_module = current_module; + } + } + end: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); +#else + __Pyx_ModuleStateLookup_data = new_data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return result; +} +static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; +#endif + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + data->table[interpreter_id].module = NULL; + } + goto done; + } + { + __Pyx_ModuleStateLookup_wait_until_no_readers(); + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + if (!lower_bound) goto done; + if (lower_bound->id != interpreter_id) goto done; + __Pyx_InterpreterIdAndModule *end = data->table+data->count; + for (;lower_boundid = (lower_bound+1)->id; + lower_bound->module = (lower_bound+1)->module; + } + } + --data->count; + if (data->count == 0) { + free(data); + data = NULL; + } + done: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); +#else + __Pyx_ModuleStateLookup_data = data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return 0; +} +#endif + +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ +#endif /* Py_PYTHON_H */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lexeme.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lexeme.pxd new file mode 100644 index 0000000000000000000000000000000000000000..adfe0a189e58d2ec36b4338e23694ffc42a12716 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lexeme.pxd @@ -0,0 +1,98 @@ +from numpy cimport ndarray + +from .attrs cimport ( + ID, + LANG, + LENGTH, + LOWER, + NORM, + ORTH, + PREFIX, + SHAPE, + SUFFIX, + attr_id_t, +) +from .strings cimport StringStore +from .structs cimport LexemeC +from .typedefs cimport attr_t, flags_t, hash_t, len_t, tag_t +from .vocab cimport Vocab + + +cdef LexemeC EMPTY_LEXEME +cdef attr_t OOV_RANK + +cdef class Lexeme: + cdef LexemeC* c + cdef readonly Vocab vocab + cdef readonly attr_t orth + + @staticmethod + cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + self.c = lex + self.vocab = vocab + self.orth = lex.orth + return self + + @staticmethod + cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + if name < (sizeof(flags_t) * 8): + Lexeme.c_set_flag(lex, name, value) + elif name == ID: + lex.id = value + elif name == LOWER: + lex.lower = value + elif name == NORM: + lex.norm = value + elif name == SHAPE: + lex.shape = value + elif name == PREFIX: + lex.prefix = value + elif name == SUFFIX: + lex.suffix = value + elif name == LANG: + lex.lang = value + + @staticmethod + cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + if feat_name < (sizeof(flags_t) * 8): + if Lexeme.c_check_flag(lex, feat_name): + return 1 + else: + return 0 + elif feat_name == ID: + return lex.id + elif feat_name == ORTH: + return lex.orth + elif feat_name == LOWER: + return lex.lower + elif feat_name == NORM: + return lex.norm + elif feat_name == SHAPE: + return lex.shape + elif feat_name == PREFIX: + return lex.prefix + elif feat_name == SUFFIX: + return lex.suffix + elif feat_name == LENGTH: + return lex.length + elif feat_name == LANG: + return lex.lang + else: + return 0 + + @staticmethod + cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + cdef flags_t one = 1 + if lexeme.flags & (one << flag_id): + return True + else: + return False + + @staticmethod + cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + cdef flags_t one = 1 + if value: + lex.flags |= one << flag_id + else: + lex.flags &= ~(one << flag_id) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lexeme.pyi b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lexeme.pyi new file mode 100644 index 0000000000000000000000000000000000000000..be2de685e9aafb93262a268c639e7ea417b0958b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lexeme.pyi @@ -0,0 +1,61 @@ +from typing import Any, Union + +from thinc.types import Floats1d + +from .tokens import Doc, Span, Token +from .vocab import Vocab + +class Lexeme: + def __init__(self, vocab: Vocab, orth: int) -> None: ... + def __richcmp__(self, other: Lexeme, op: int) -> bool: ... + def __hash__(self) -> int: ... + def set_attrs(self, **attrs: Any) -> None: ... + def set_flag(self, flag_id: int, value: bool) -> None: ... + def check_flag(self, flag_id: int) -> bool: ... + def similarity(self, other: Union[Doc, Span, Token, Lexeme]) -> float: ... + @property + def has_vector(self) -> bool: ... + @property + def vector_norm(self) -> float: ... + vector: Floats1d + rank: int + sentiment: float + @property + def orth_(self) -> str: ... + @property + def text(self) -> str: ... + orth: int + lower: int + norm: int + shape: int + prefix: int + suffix: int + cluster: int + lang: int + prob: float + lower_: str + norm_: str + shape_: str + prefix_: str + suffix_: str + lang_: str + flags: int + @property + def is_oov(self) -> bool: ... + is_stop: bool + is_alpha: bool + is_ascii: bool + is_digit: bool + is_lower: bool + is_upper: bool + is_title: bool + is_punct: bool + is_space: bool + is_bracket: bool + is_quote: bool + is_left_punct: bool + is_right_punct: bool + is_currency: bool + like_url: bool + like_num: bool + like_email: bool diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lexeme.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lexeme.pyx new file mode 100644 index 0000000000000000000000000000000000000000..372f986757341be9e80f53a495c5aa2527a63205 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lexeme.pyx @@ -0,0 +1,556 @@ +# cython: embedsignature=True +# cython: profile=False +# Compiler crashes on memory view coercion without this. Should report bug. +cimport numpy as np +from libc.string cimport memset + +np.import_array() + +import warnings + +import numpy +from thinc.api import get_array_module + +from .attrs cimport ( + IS_ALPHA, + IS_ASCII, + IS_BRACKET, + IS_CURRENCY, + IS_DIGIT, + IS_LEFT_PUNCT, + IS_LOWER, + IS_PUNCT, + IS_QUOTE, + IS_RIGHT_PUNCT, + IS_SPACE, + IS_STOP, + IS_TITLE, + IS_UPPER, + LIKE_EMAIL, + LIKE_NUM, + LIKE_URL, +) +from .typedefs cimport attr_t, flags_t + +from .attrs import intify_attrs +from .errors import Errors, Warnings + +OOV_RANK = 0xffffffffffffffff # UINT64_MAX +memset(&EMPTY_LEXEME, 0, sizeof(LexemeC)) +EMPTY_LEXEME.id = OOV_RANK + + +cdef class Lexeme: + """An entry in the vocabulary. A `Lexeme` has no string context – it's a + word-type, as opposed to a word token. It therefore has no part-of-speech + tag, dependency parse, or lemma (lemmatization depends on the + part-of-speech tag). + + DOCS: https://spacy.io/api/lexeme + """ + def __init__(self, Vocab vocab, attr_t orth): + """Create a Lexeme object. + + vocab (Vocab): The parent vocabulary + orth (uint64): The orth id of the lexeme. + Returns (Lexeme): The newly constructd object. + """ + self.vocab = vocab + self.orth = orth + self.c = vocab.get_by_orth(vocab.mem, orth) + if self.c.orth != orth: + raise ValueError(Errors.E071.format(orth=orth, vocab_orth=self.c.orth)) + + def __richcmp__(self, other, int op): + if other is None: + if op == 0 or op == 1 or op == 2: + return False + else: + return True + if isinstance(other, Lexeme): + a = self.orth + b = other.orth + elif isinstance(other, int): + a = self.orth + b = other + elif isinstance(other, str): + a = self.orth_ + b = other + else: + a = 0 + b = 1 + if op == 2: # == + return a == b + elif op == 3: # != + return a != b + elif op == 0: # < + return a < b + elif op == 1: # <= + return a <= b + elif op == 4: # > + return a > b + elif op == 5: # >= + return a >= b + else: + raise NotImplementedError(op) + + def __hash__(self): + return self.c.orth + + def set_attrs(self, **attrs): + cdef attr_id_t attr + attrs = intify_attrs(attrs) + for attr, value in attrs.items(): + # skip PROB, e.g. from lexemes.jsonl + if isinstance(value, float): + continue + elif isinstance(value, int): + Lexeme.set_struct_attr(self.c, attr, value) + else: + Lexeme.set_struct_attr(self.c, attr, self.vocab.strings.add(value)) + + def set_flag(self, attr_id_t flag_id, bint value): + """Change the value of a boolean flag. + + flag_id (int): The attribute ID of the flag to set. + value (bool): The new value of the flag. + """ + Lexeme.c_set_flag(self.c, flag_id, value) + + def check_flag(self, attr_id_t flag_id): + """Check the value of a boolean flag. + + flag_id (int): The attribute ID of the flag to query. + RETURNS (bool): The value of the flag. + """ + return True if Lexeme.c_check_flag(self.c, flag_id) else False + + def similarity(self, other): + """Compute a semantic similarity estimate. Defaults to cosine over + vectors. + + other (object): The object to compare with. By default, accepts `Doc`, + `Span`, `Token` and `Lexeme` objects. + RETURNS (float): A scalar similarity score. Higher is more similar. + """ + # Return 1.0 similarity for matches + if hasattr(other, "orth"): + if self.c.orth == other.orth: + return 1.0 + elif ( + hasattr(other, "__len__") and len(other) == 1 + and hasattr(other[0], "orth") + and self.c.orth == other[0].orth + ): + return 1.0 + if self.vector_norm == 0 or other.vector_norm == 0: + warnings.warn(Warnings.W008.format(obj="Lexeme")) + return 0.0 + vector = self.vector + xp = get_array_module(vector) + result = xp.dot(vector, other.vector) / (self.vector_norm * other.vector_norm) + # ensure we get a scalar back (numpy does this automatically but cupy doesn't) + return result.item() + + @property + def has_vector(self): + """RETURNS (bool): Whether a word vector is associated with the object. + """ + return self.vocab.has_vector(self.c.orth) + + @property + def vector_norm(self): + """RETURNS (float): The L2 norm of the vector representation.""" + vector = self.vector + return numpy.sqrt((vector**2).sum()) + + @property + def vector(self): + """A real-valued meaning representation. + + RETURNS (numpy.ndarray[ndim=1, dtype='float32']): A 1D numpy array + representing the lexeme's semantics. + """ + cdef int length = self.vocab.vectors_length + if length == 0: + raise ValueError(Errors.E010) + return self.vocab.get_vector(self.c.orth) + + @vector.setter + def vector(self, vector): + if len(vector) != self.vocab.vectors_length: + raise ValueError(Errors.E073.format(new_length=len(vector), + length=self.vocab.vectors_length)) + self.vocab.set_vector(self.c.orth, vector) + + @property + def rank(self): + """RETURNS (str): Sequential ID of the lexeme's lexical type, used + to index into tables, e.g. for word vectors.""" + return self.c.id + + @rank.setter + def rank(self, value): + self.c.id = value + + @property + def sentiment(self): + """RETURNS (float): A scalar value indicating the positivity or + negativity of the lexeme.""" + sentiment_table = self.vocab.lookups.get_table("lexeme_sentiment", {}) + return sentiment_table.get(self.c.orth, 0.0) + + @sentiment.setter + def sentiment(self, float x): + if "lexeme_sentiment" not in self.vocab.lookups: + self.vocab.lookups.add_table("lexeme_sentiment") + sentiment_table = self.vocab.lookups.get_table("lexeme_sentiment") + sentiment_table[self.c.orth] = x + + @property + def orth_(self): + """RETURNS (str): The original verbatim text of the lexeme + (identical to `Lexeme.text`). Exists mostly for consistency with + the other attributes.""" + return self.vocab.strings[self.c.orth] + + @property + def text(self): + """RETURNS (str): The original verbatim text of the lexeme.""" + return self.orth_ + + @property + def lower(self): + """RETURNS (uint64): Lowercase form of the lexeme.""" + return self.c.lower + + @lower.setter + def lower(self, attr_t x): + self.c.lower = x + + @property + def norm(self): + """RETURNS (uint64): The lexeme's norm, i.e. a normalised form of the + lexeme text. + """ + return self.c.norm + + @norm.setter + def norm(self, attr_t x): + if "lexeme_norm" not in self.vocab.lookups: + self.vocab.lookups.add_table("lexeme_norm") + norm_table = self.vocab.lookups.get_table("lexeme_norm") + norm_table[self.c.orth] = self.vocab.strings[x] + self.c.norm = x + + @property + def shape(self): + """RETURNS (uint64): Transform of the word's string, to show + orthographic features. + """ + return self.c.shape + + @shape.setter + def shape(self, attr_t x): + self.c.shape = x + + @property + def prefix(self): + """RETURNS (uint64): Length-N substring from the start of the word. + Defaults to `N=1`. + """ + return self.c.prefix + + @prefix.setter + def prefix(self, attr_t x): + self.c.prefix = x + + @property + def suffix(self): + """RETURNS (uint64): Length-N substring from the end of the word. + Defaults to `N=3`. + """ + return self.c.suffix + + @suffix.setter + def suffix(self, attr_t x): + self.c.suffix = x + + @property + def cluster(self): + """RETURNS (int): Brown cluster ID.""" + cluster_table = self.vocab.lookups.get_table("lexeme_cluster", {}) + return cluster_table.get(self.c.orth, 0) + + @cluster.setter + def cluster(self, int x): + cluster_table = self.vocab.lookups.get_table("lexeme_cluster", {}) + cluster_table[self.c.orth] = x + + @property + def lang(self): + """RETURNS (uint64): Language of the parent vocabulary.""" + return self.c.lang + + @lang.setter + def lang(self, attr_t x): + self.c.lang = x + + @property + def prob(self): + """RETURNS (float): Smoothed log probability estimate of the lexeme's + type.""" + prob_table = self.vocab.lookups.get_table("lexeme_prob", {}) + settings_table = self.vocab.lookups.get_table("lexeme_settings", {}) + default_oov_prob = settings_table.get("oov_prob", -20.0) + return prob_table.get(self.c.orth, default_oov_prob) + + @prob.setter + def prob(self, float x): + prob_table = self.vocab.lookups.get_table("lexeme_prob", {}) + prob_table[self.c.orth] = x + + @property + def lower_(self): + """RETURNS (str): Lowercase form of the word.""" + return self.vocab.strings[self.c.lower] + + @lower_.setter + def lower_(self, str x): + self.c.lower = self.vocab.strings.add(x) + + @property + def norm_(self): + """RETURNS (str): The lexeme's norm, i.e. a normalised form of the + lexeme text. + """ + return self.vocab.strings[self.c.norm] + + @norm_.setter + def norm_(self, str x): + self.norm = self.vocab.strings.add(x) + + @property + def shape_(self): + """RETURNS (str): Transform of the word's string, to show + orthographic features. + """ + return self.vocab.strings[self.c.shape] + + @shape_.setter + def shape_(self, str x): + self.c.shape = self.vocab.strings.add(x) + + @property + def prefix_(self): + """RETURNS (str): Length-N substring from the start of the word. + Defaults to `N=1`. + """ + return self.vocab.strings[self.c.prefix] + + @prefix_.setter + def prefix_(self, str x): + self.c.prefix = self.vocab.strings.add(x) + + @property + def suffix_(self): + """RETURNS (str): Length-N substring from the end of the word. + Defaults to `N=3`. + """ + return self.vocab.strings[self.c.suffix] + + @suffix_.setter + def suffix_(self, str x): + self.c.suffix = self.vocab.strings.add(x) + + @property + def lang_(self): + """RETURNS (str): Language of the parent vocabulary.""" + return self.vocab.strings[self.c.lang] + + @lang_.setter + def lang_(self, str x): + self.c.lang = self.vocab.strings.add(x) + + @property + def flags(self): + """RETURNS (uint64): Container of the lexeme's binary flags.""" + return self.c.flags + + @flags.setter + def flags(self, flags_t x): + self.c.flags = x + + @property + def is_oov(self): + """RETURNS (bool): Whether the lexeme is out-of-vocabulary.""" + return self.orth not in self.vocab.vectors + + @property + def is_stop(self): + """RETURNS (bool): Whether the lexeme is a stop word.""" + return Lexeme.c_check_flag(self.c, IS_STOP) + + @is_stop.setter + def is_stop(self, bint x): + Lexeme.c_set_flag(self.c, IS_STOP, x) + + @property + def is_alpha(self): + """RETURNS (bool): Whether the lexeme consists of alphabetic + characters. Equivalent to `lexeme.text.isalpha()`. + """ + return Lexeme.c_check_flag(self.c, IS_ALPHA) + + @is_alpha.setter + def is_alpha(self, bint x): + Lexeme.c_set_flag(self.c, IS_ALPHA, x) + + @property + def is_ascii(self): + """RETURNS (bool): Whether the lexeme consists of ASCII characters. + Equivalent to `[any(ord(c) >= 128 for c in lexeme.text)]`. + """ + return Lexeme.c_check_flag(self.c, IS_ASCII) + + @is_ascii.setter + def is_ascii(self, bint x): + Lexeme.c_set_flag(self.c, IS_ASCII, x) + + @property + def is_digit(self): + """RETURNS (bool): Whether the lexeme consists of digits. Equivalent + to `lexeme.text.isdigit()`. + """ + return Lexeme.c_check_flag(self.c, IS_DIGIT) + + @is_digit.setter + def is_digit(self, bint x): + Lexeme.c_set_flag(self.c, IS_DIGIT, x) + + @property + def is_lower(self): + """RETURNS (bool): Whether the lexeme is in lowercase. Equivalent to + `lexeme.text.islower()`. + """ + return Lexeme.c_check_flag(self.c, IS_LOWER) + + @is_lower.setter + def is_lower(self, bint x): + Lexeme.c_set_flag(self.c, IS_LOWER, x) + + @property + def is_upper(self): + """RETURNS (bool): Whether the lexeme is in uppercase. Equivalent to + `lexeme.text.isupper()`. + """ + return Lexeme.c_check_flag(self.c, IS_UPPER) + + @is_upper.setter + def is_upper(self, bint x): + Lexeme.c_set_flag(self.c, IS_UPPER, x) + + @property + def is_title(self): + """RETURNS (bool): Whether the lexeme is in titlecase. Equivalent to + `lexeme.text.istitle()`. + """ + return Lexeme.c_check_flag(self.c, IS_TITLE) + + @is_title.setter + def is_title(self, bint x): + Lexeme.c_set_flag(self.c, IS_TITLE, x) + + @property + def is_punct(self): + """RETURNS (bool): Whether the lexeme is punctuation.""" + return Lexeme.c_check_flag(self.c, IS_PUNCT) + + @is_punct.setter + def is_punct(self, bint x): + Lexeme.c_set_flag(self.c, IS_PUNCT, x) + + @property + def is_space(self): + """RETURNS (bool): Whether the lexeme consist of whitespace characters. + Equivalent to `lexeme.text.isspace()`. + """ + return Lexeme.c_check_flag(self.c, IS_SPACE) + + @is_space.setter + def is_space(self, bint x): + Lexeme.c_set_flag(self.c, IS_SPACE, x) + + @property + def is_bracket(self): + """RETURNS (bool): Whether the lexeme is a bracket.""" + return Lexeme.c_check_flag(self.c, IS_BRACKET) + + @is_bracket.setter + def is_bracket(self, bint x): + Lexeme.c_set_flag(self.c, IS_BRACKET, x) + + @property + def is_quote(self): + """RETURNS (bool): Whether the lexeme is a quotation mark.""" + return Lexeme.c_check_flag(self.c, IS_QUOTE) + + @is_quote.setter + def is_quote(self, bint x): + Lexeme.c_set_flag(self.c, IS_QUOTE, x) + + @property + def is_left_punct(self): + """RETURNS (bool): Whether the lexeme is left punctuation, e.g. (.""" + return Lexeme.c_check_flag(self.c, IS_LEFT_PUNCT) + + @is_left_punct.setter + def is_left_punct(self, bint x): + Lexeme.c_set_flag(self.c, IS_LEFT_PUNCT, x) + + @property + def is_right_punct(self): + """RETURNS (bool): Whether the lexeme is right punctuation, e.g. ).""" + return Lexeme.c_check_flag(self.c, IS_RIGHT_PUNCT) + + @is_right_punct.setter + def is_right_punct(self, bint x): + Lexeme.c_set_flag(self.c, IS_RIGHT_PUNCT, x) + + @property + def is_currency(self): + """RETURNS (bool): Whether the lexeme is a currency symbol, e.g. $, €.""" + return Lexeme.c_check_flag(self.c, IS_CURRENCY) + + @is_currency.setter + def is_currency(self, bint x): + Lexeme.c_set_flag(self.c, IS_CURRENCY, x) + + @property + def like_url(self): + """RETURNS (bool): Whether the lexeme resembles a URL.""" + return Lexeme.c_check_flag(self.c, LIKE_URL) + + @like_url.setter + def like_url(self, bint x): + Lexeme.c_set_flag(self.c, LIKE_URL, x) + + @property + def like_num(self): + """RETURNS (bool): Whether the lexeme represents a number, e.g. "10.9", + "10", "ten", etc. + """ + return Lexeme.c_check_flag(self.c, LIKE_NUM) + + @like_num.setter + def like_num(self, bint x): + Lexeme.c_set_flag(self.c, LIKE_NUM, x) + + @property + def like_email(self): + """RETURNS (bool): Whether the lexeme resembles an email address.""" + return Lexeme.c_check_flag(self.c, LIKE_EMAIL) + + @like_email.setter + def like_email(self, bint x): + Lexeme.c_set_flag(self.c, LIKE_EMAIL, x) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/lookups.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lookups.py new file mode 100644 index 0000000000000000000000000000000000000000..d0959542f7c55644fdd0a1ed06878d56065d91cf --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/lookups.py @@ -0,0 +1,314 @@ +from collections import OrderedDict +from pathlib import Path +from typing import Any, Dict, List, Optional, Union + +import srsly +from preshed.bloom import BloomFilter + +from .errors import Errors +from .strings import get_string_id +from .util import SimpleFrozenDict, ensure_path, load_language_data, registry + +UNSET = object() + + +def load_lookups(lang: str, tables: List[str], strict: bool = True) -> "Lookups": + """Load the data from the spacy-lookups-data package for a given language, + if available. Returns an empty `Lookups` container if there's no data or if the package + is not installed. + + lang (str): The language code (corresponds to entry point exposed by + the spacy-lookups-data package). + tables (List[str]): Name of tables to load, e.g. ["lemma_lookup", "lemma_exc"] + strict (bool): Whether to raise an error if a table doesn't exist. + RETURNS (Lookups): The lookups container containing the loaded tables. + """ + # TODO: import spacy_lookups_data instead of going via entry points here? + lookups = Lookups() + if lang not in registry.lookups: + if strict and len(tables) > 0: + raise ValueError(Errors.E955.format(table=", ".join(tables), lang=lang)) + return lookups + data = registry.lookups.get(lang) + for table in tables: + if table not in data: + if strict: + raise ValueError(Errors.E955.format(table=table, lang=lang)) + language_data = {} # type: ignore[var-annotated] + else: + language_data = load_language_data(data[table]) # type: ignore[assignment] + lookups.add_table(table, language_data) + return lookups + + +class Table(OrderedDict): + """A table in the lookups. Subclass of builtin dict that implements a + slightly more consistent and unified API. + + Includes a Bloom filter to speed up missed lookups. + """ + + @classmethod + def from_dict(cls, data: dict, name: Optional[str] = None) -> "Table": + """Initialize a new table from a dict. + + data (dict): The dictionary. + name (str): Optional table name for reference. + + DOCS: https://spacy.io/api/lookups#table.from_dict + """ + self = cls(name=name) + self.update(data) + return self + + def __init__(self, name: Optional[str] = None, data: Optional[dict] = None) -> None: + """Initialize a new table. + + name (str): Optional table name for reference. + data (dict): Initial data, used to hint Bloom Filter. + + DOCS: https://spacy.io/api/lookups#table.init + """ + OrderedDict.__init__(self) + self.name = name + # Assume a default size of 1M items + self.default_size = 1e6 + size = max(len(data), 1) if data is not None else self.default_size + self.bloom = BloomFilter.from_error_rate(size) + if data: + self.update(data) + + def __setitem__(self, key: Union[str, int], value: Any) -> None: + """Set new key/value pair. String keys will be hashed. + + key (str / int): The key to set. + value: The value to set. + """ + key = get_string_id(key) + OrderedDict.__setitem__(self, key, value) # type:ignore[assignment] + self.bloom.add(key) + + def set(self, key: Union[str, int], value: Any) -> None: + """Set new key/value pair. String keys will be hashed. + Same as table[key] = value. + + key (str / int): The key to set. + value: The value to set. + """ + self[key] = value + + def __getitem__(self, key: Union[str, int]) -> Any: + """Get the value for a given key. String keys will be hashed. + + key (str / int): The key to get. + RETURNS: The value. + """ + key = get_string_id(key) + return OrderedDict.__getitem__(self, key) # type:ignore[index] + + def get(self, key: Union[str, int], default: Optional[Any] = None) -> Any: + """Get the value for a given key. String keys will be hashed. + + key (str / int): The key to get. + default: The default value to return. + RETURNS: The value. + """ + key = get_string_id(key) + return OrderedDict.get(self, key, default) # type:ignore[arg-type] + + def __contains__(self, key: Union[str, int]) -> bool: # type: ignore[override] + """Check whether a key is in the table. String keys will be hashed. + + key (str / int): The key to check. + RETURNS (bool): Whether the key is in the table. + """ + key = get_string_id(key) + # This can give a false positive, so we need to check it after + if key not in self.bloom: + return False + return OrderedDict.__contains__(self, key) + + def to_bytes(self) -> bytes: + """Serialize table to a bytestring. + + RETURNS (bytes): The serialized table. + + DOCS: https://spacy.io/api/lookups#table.to_bytes + """ + data = { + "name": self.name, + "dict": dict(self.items()), + "bloom": self.bloom.to_bytes(), + } + return srsly.msgpack_dumps(data) + + def from_bytes(self, bytes_data: bytes) -> "Table": + """Load a table from a bytestring. + + bytes_data (bytes): The data to load. + RETURNS (Table): The loaded table. + + DOCS: https://spacy.io/api/lookups#table.from_bytes + """ + loaded = srsly.msgpack_loads(bytes_data) + data = loaded.get("dict", {}) + self.name = loaded["name"] + self.bloom = BloomFilter().from_bytes(loaded["bloom"]) + self.clear() + self.update(data) + return self + + +class Lookups: + """Container for large lookup tables and dictionaries, e.g. lemmatization + data or tokenizer exception lists. Lookups are available via vocab.lookups, + so they can be accessed before the pipeline components are applied (e.g. + in the tokenizer and lemmatizer), as well as within the pipeline components + via doc.vocab.lookups. + """ + + def __init__(self) -> None: + """Initialize the Lookups object. + + DOCS: https://spacy.io/api/lookups#init + """ + self._tables: Dict[str, Table] = {} + + def __contains__(self, name: str) -> bool: + """Check if the lookups contain a table of a given name. Delegates to + Lookups.has_table. + + name (str): Name of the table. + RETURNS (bool): Whether a table of that name is in the lookups. + """ + return self.has_table(name) + + def __len__(self) -> int: + """RETURNS (int): The number of tables in the lookups.""" + return len(self._tables) + + @property + def tables(self) -> List[str]: + """RETURNS (List[str]): Names of all tables in the lookups.""" + return list(self._tables.keys()) + + def add_table(self, name: str, data: dict = SimpleFrozenDict()) -> Table: + """Add a new table to the lookups. Raises an error if the table exists. + + name (str): Unique name of table. + data (dict): Optional data to add to the table. + RETURNS (Table): The newly added table. + + DOCS: https://spacy.io/api/lookups#add_table + """ + if name in self.tables: + raise ValueError(Errors.E158.format(name=name)) + table = Table(name=name, data=data) + self._tables[name] = table + return table + + def set_table(self, name: str, table: Table) -> None: + """Set a table. + + name (str): Name of the table to set. + table (Table): The Table to set. + + DOCS: https://spacy.io/api/lookups#set_table + """ + self._tables[name] = table + + def get_table(self, name: str, default: Any = UNSET) -> Table: + """Get a table. Raises an error if the table doesn't exist and no + default value is provided. + + name (str): Name of the table. + default (Any): Optional default value to return if table doesn't exist. + RETURNS (Table): The table. + + DOCS: https://spacy.io/api/lookups#get_table + """ + if name not in self._tables: + if default == UNSET: + raise KeyError(Errors.E159.format(name=name, tables=self.tables)) + return default + return self._tables[name] + + def remove_table(self, name: str) -> Table: + """Remove a table. Raises an error if the table doesn't exist. + + name (str): Name of the table to remove. + RETURNS (Table): The removed table. + + DOCS: https://spacy.io/api/lookups#remove_table + """ + if name not in self._tables: + raise KeyError(Errors.E159.format(name=name, tables=self.tables)) + return self._tables.pop(name) + + def has_table(self, name: str) -> bool: + """Check if the lookups contain a table of a given name. + + name (str): Name of the table. + RETURNS (bool): Whether a table of that name exists. + + DOCS: https://spacy.io/api/lookups#has_table + """ + return name in self._tables + + def to_bytes(self, **kwargs) -> bytes: + """Serialize the lookups to a bytestring. + + RETURNS (bytes): The serialized Lookups. + + DOCS: https://spacy.io/api/lookups#to_bytes + """ + return srsly.msgpack_dumps(self._tables) + + def from_bytes(self, bytes_data: bytes, **kwargs) -> "Lookups": + """Load the lookups from a bytestring. + + bytes_data (bytes): The data to load. + RETURNS (Lookups): The loaded Lookups. + + DOCS: https://spacy.io/api/lookups#from_bytes + """ + self._tables = {} + for key, value in srsly.msgpack_loads(bytes_data).items(): + self._tables[key] = Table(key, value) + return self + + def to_disk( + self, path: Union[str, Path], filename: str = "lookups.bin", **kwargs + ) -> None: + """Save the lookups to a directory as lookups.bin. Expects a path to a + directory, which will be created if it doesn't exist. + + path (str / Path): The file path. + + DOCS: https://spacy.io/api/lookups#to_disk + """ + path = ensure_path(path) + if not path.exists(): + path.mkdir() + filepath = path / filename + with filepath.open("wb") as file_: + file_.write(self.to_bytes()) + + def from_disk( + self, path: Union[str, Path], filename: str = "lookups.bin", **kwargs + ) -> "Lookups": + """Load lookups from a directory containing a lookups.bin. Will skip + loading if the file doesn't exist. + + path (str / Path): The directory path. + RETURNS (Lookups): The loaded lookups. + + DOCS: https://spacy.io/api/lookups#from_disk + """ + path = ensure_path(path) + filepath = path / filename + if filepath.exists(): + with filepath.open("rb") as file_: + data = file_.read() + return self.from_bytes(data) + return self diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/morphology.cp312-win_amd64.pyd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/morphology.cp312-win_amd64.pyd new file mode 100644 index 0000000000000000000000000000000000000000..705a1c9189671d3383b744bb7e41605c4a040889 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/morphology.cp312-win_amd64.pyd differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/morphology.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/morphology.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9cb1414ac2a47f45a93b3243a648b53ecfa55ebb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/morphology.cpp @@ -0,0 +1,19636 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayscalars.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarraytypes.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ufuncobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include\\Python.h" + ], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.morphology", + "sources": [ + "spacy/morphology.pyx" + ] + }, + "module_name": "spacy.morphology" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +/* InitLimitedAPI */ +#if defined(Py_LIMITED_API) + #if !defined(CYTHON_LIMITED_API) + #define CYTHON_LIMITED_API 1 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef _MSC_VER + #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") + #else + #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. + #endif +#endif + +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x03080000 + #error Cython requires Python 3.8+. +#else +#define __PYX_ABI_VERSION "3_2_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* CModulePreamble */ +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#define __PYX_COMMA , +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) + #endif + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 1 + #endif + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #ifdef Py_GIL_DISABLED + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 + #else + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #endif + #if PY_VERSION_HEX < 0x030A0000 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #elif !defined(CYTHON_USE_TYPE_SLOTS) + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLIST_INTERNALS) + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #elif !defined(CYTHON_FAST_GIL) + #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #ifndef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif + #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work + #elif !defined(CYTHON_IMMORTAL_CONSTANTS) + #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif +#endif +#ifndef CYTHON_COMPRESS_STRINGS + #define CYTHON_COMPRESS_STRINGS 1 +#endif +#ifndef CYTHON_FAST_PYCCALL +#define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL +#endif +#ifndef CYTHON_VECTORCALL +#if CYTHON_COMPILING_IN_LIMITED_API +#define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) +#else +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) +#endif +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#include +typedef uintptr_t __pyx_uintptr_t; +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif +#ifndef Py_UNREACHABLE + #define Py_UNREACHABLE() assert(0); abort() +#endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* PythonCompatibility */ +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#define __Pyx_BUILTIN_MODULE_NAME "builtins" +#define __Pyx_DefaultClassType PyType_Type +#if CYTHON_COMPILING_IN_LIMITED_API + #ifndef CO_OPTIMIZED + static int CO_OPTIMIZED; + #endif + #ifndef CO_NEWLOCALS + static int CO_NEWLOCALS; + #endif + #ifndef CO_VARARGS + static int CO_VARARGS; + #endif + #ifndef CO_VARKEYWORDS + static int CO_VARKEYWORDS; + #endif + #ifndef CO_ASYNC_GENERATOR + static int CO_ASYNC_GENERATOR; + #endif + #ifndef CO_GENERATOR + static int CO_GENERATOR; + #endif + #ifndef CO_COROUTINE + static int CO_COROUTINE; + #endif +#else + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 + #endif +#endif +static int __Pyx_init_co_variables(void); +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif +#ifndef Py_TPFLAGS_IMMUTABLETYPE + #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) +#endif +#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION + #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) +#endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#ifndef METH_FASTCALL + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #if PY_VERSION_HEX >= 0x030d00A4 + # define __Pyx_PyCFunctionFast PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords + #else + # define __Pyx_PyCFunctionFast _PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords + #endif +#endif +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX >= 0x030900B1 +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) +#else +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) +#endif +#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) +#elif !CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) +static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { + return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; +} +#endif +static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; +#else + return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +#endif +} +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) +#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) +#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) +#elif CYTHON_COMPILING_IN_GRAAL + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#endif +#if CYTHON_USE_MODULE_STATE +static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) +#else +#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) +#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) +#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) + #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) + #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ + ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ + (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ + __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) + #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) + #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) +#endif +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) +#endif +#define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) +#if CYTHON_USE_TYPE_SPECS +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE((PyObject*)obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#else + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #else + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #endif +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif +#endif +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#elif CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) +#endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif +enum __Pyx_ReferenceSharing { + __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check + __Pyx_ReferenceSharing_OwnStrongReference, + __Pyx_ReferenceSharing_FunctionArgument, + __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar +}; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ + (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ + (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ + (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) +#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) +#else +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) +#endif +#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) + #else + #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) + #endif +#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) + #endif +#else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) +#endif +#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ + __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) +#else + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) +#endif +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyObject_GetItem(dict, key); + if (*result == NULL) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + return 0; + } + return -1; + } + return 1; +} +#else +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyDict_GetItemWithError(dict, key); + if (*result == NULL) { + return PyErr_Occurred() ? -1 : 0; + } + Py_INCREF(*result); + return 1; +} +#endif +#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST + #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) +#else + #define __Pyx_VISIT_CONST(obj) +#endif +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) +#else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) +#endif +#if CYTHON_ASSUME_SAFE_SIZE + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) +#else + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) +#endif +#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t +#define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t +#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 + #define __Pyx_PySendResult PySendResult +#else + typedef enum { + PYGEN_RETURN = 0, + PYGEN_ERROR = -1, + PYGEN_NEXT = 1, + } __Pyx_PySendResult; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 + typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); +#else + #define __Pyx_pyiter_sendfunc sendfunc +#endif +#if !CYTHON_USE_AM_SEND +#define __PYX_HAS_PY_AM_SEND 0 +#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 +#define __PYX_HAS_PY_AM_SEND 1 +#else +#define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation +#endif +#if __PYX_HAS_PY_AM_SEND < 2 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods +#else + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + __Pyx_pyiter_sendfunc am_send; + } __Pyx_PyAsyncMethodsStruct; + #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) +#endif +#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 + #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) +#else + #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) +#endif +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() +#else +#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 +#ifdef __cplusplus +extern "C" +#endif +PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { + int value; + PyObject *py_value = PyObject_GetAttrString(inspect, name); + if (!py_value) return 0; + value = (int) PyLong_AsLong(py_value); + Py_DECREF(py_value); + *write_to = value; + return value != -1 || !PyErr_Occurred(); +} +static int __Pyx_init_co_variables(void) { + PyObject *inspect; + int result; + inspect = PyImport_ImportModule("inspect"); + result = +#if !defined(CO_OPTIMIZED) + __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && +#endif +#if !defined(CO_NEWLOCALS) + __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && +#endif +#if !defined(CO_VARARGS) + __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && +#endif +#if !defined(CO_VARKEYWORDS) + __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && +#endif +#if !defined(CO_ASYNC_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && +#endif +#if !defined(CO_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && +#endif +#if !defined(CO_COROUTINE) + __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && +#endif + 1; + Py_DECREF(inspect); + return result ? 0 : -1; +} +#else +static int __Pyx_init_co_variables(void) { + return 0; // It's a limited API-only feature +} +#endif + +/* MathInitCode */ +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #ifndef _USE_MATH_DEFINES + #define _USE_MATH_DEFINES + #endif +#endif +#include +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 +#endif +#ifndef CYTHON_CLINE_IN_TRACEBACK +#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#endif +#if CYTHON_CLINE_IN_TRACEBACK +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } +#else +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } +#endif +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__morphology +#define __PYX_HAVE_API__spacy__morphology +/* Early includes */ +#include +#include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + +#include "numpy/arrayobject.h" +#include "numpy/ndarrayobject.h" +#include "numpy/ndarraytypes.h" +#include "numpy/arrayscalars.h" +#include "numpy/ufuncobject.h" +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include +#include +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) +#else + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) +#endif +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) + return Py_NewRef(obj); +#else + Py_INCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) + return Py_XNewRef(obj); +#else + Py_XINCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) +#else +#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) +#endif +#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) +#else + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +/* PretendToInitialize */ +#ifdef __cplusplus +#if __cplusplus > 201103L +#include +#endif +template +static void __Pyx_pretend_to_initialize(T* ptr) { +#if __cplusplus > 201103L + if ((std::is_trivially_default_constructible::value)) +#endif + *ptr = T(); + (void)ptr; +} +#else +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#endif + + +#if !CYTHON_USE_MODULE_STATE +static PyObject *__pyx_m = NULL; +#endif +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * const __pyx_cfilenm = __FILE__; +static const char *__pyx_filename; + +/* Header.proto */ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER)) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/morphology.pyx", + "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd", + "cpython/type.pxd", + "cymem/cymem.pxd", + "preshed/maps.pxd", + "spacy/strings.pxd", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* Atomics.proto (used by UnpackUnboundCMethod) */ +#include +#ifndef CYTHON_ATOMICS + #define CYTHON_ATOMICS 1 +#endif +#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS +#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __pyx_atomic_int_type int +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_ptr_type atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) atomic_load(value) + #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_ptr_type std::atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) std::atomic_load(value) + #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ + (__GNUC_MINOR__ > 1 ||\ + (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) + #define __pyx_atomic_ptr_type void* + #define __pyx_nonatomic_ptr_type void* + #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) + #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #warning "Using GNU atomics" + #endif +#elif CYTHON_ATOMICS && defined(_MSC_VER) + #include + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type long + #define __pyx_atomic_ptr_type void* + #undef __pyx_nonatomic_int_type + #define __pyx_nonatomic_int_type long + #define __pyx_nonatomic_ptr_type void* + #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) + #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) + #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) + #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value + #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #pragma message ("Using MSVC atomics") + #endif +#else + #undef CYTHON_ATOMICS + #define CYTHON_ATOMICS 0 + #ifdef __PYX_DEBUG_ATOMICS + #warning "Not using atomics" + #endif +#endif + +/* CriticalSectionsDefinition.proto (used by CriticalSections) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection void* +#define __Pyx_PyCriticalSection2 void* +#define __Pyx_PyCriticalSection_End(cs) +#define __Pyx_PyCriticalSection2_End(cs) +#else +#define __Pyx_PyCriticalSection PyCriticalSection +#define __Pyx_PyCriticalSection2 PyCriticalSection2 +#define __Pyx_PyCriticalSection_End PyCriticalSection_End +#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End +#endif + +/* CriticalSections.proto (used by ParseKeywordsImpl) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs) +#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs) +#else +#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin +#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin +#endif +#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_BEGIN_CRITICAL_SECTION(o) { +#define __Pyx_END_CRITICAL_SECTION() } +#else +#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION +#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION +#endif + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* #### Code section: numeric_typedefs ### */ + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":743 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t +*/ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":744 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t +*/ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":745 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * +*/ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":746 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_uint8 uint8_t +*/ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":748 + * ctypedef npy_int64 int64_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t +*/ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":749 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t +*/ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":750 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * +*/ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":751 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_float32 float32_t +*/ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":753 + * ctypedef npy_uint64 uint64_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t +*/ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":754 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t +*/ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":761 + * ctypedef double complex complex128_t + * + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * +*/ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":762 + * + * ctypedef npy_longlong longlong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t +*/ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":764 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * +*/ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":765 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t +*/ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":767 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t +*/ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":768 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * +*/ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":769 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef float complex cfloat_t +*/ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; +/* #### Code section: complex_type_declarations ### */ +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< long double > __pyx_t_long_double_complex; + #else + typedef long double _Complex __pyx_t_long_double_complex; + #endif +#else + typedef struct { long double real, imag; } __pyx_t_long_double_complex; +#endif +static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_10morphology_Morphology; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "parts_of_speech.pxd":4 + * + * + * cpdef enum univ_pos_t: # <<<<<<<<<<<<<< + * NO_TAG = 0 + * ADJ = symbols.ADJ +*/ +enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t { + + /* "parts_of_speech.pxd":6 + * cpdef enum univ_pos_t: + * NO_TAG = 0 + * ADJ = symbols.ADJ # <<<<<<<<<<<<<< + * ADP + * ADV +*/ + __pyx_e_5spacy_15parts_of_speech_NO_TAG = 0, + __pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_15parts_of_speech_ADP, + __pyx_e_5spacy_15parts_of_speech_ADV, + __pyx_e_5spacy_15parts_of_speech_AUX, + __pyx_e_5spacy_15parts_of_speech_CONJ, + __pyx_e_5spacy_15parts_of_speech_CCONJ, + __pyx_e_5spacy_15parts_of_speech_DET, + __pyx_e_5spacy_15parts_of_speech_INTJ, + __pyx_e_5spacy_15parts_of_speech_NOUN, + __pyx_e_5spacy_15parts_of_speech_NUM, + __pyx_e_5spacy_15parts_of_speech_PART, + __pyx_e_5spacy_15parts_of_speech_PRON, + __pyx_e_5spacy_15parts_of_speech_PROPN, + __pyx_e_5spacy_15parts_of_speech_PUNCT, + __pyx_e_5spacy_15parts_of_speech_SCONJ, + __pyx_e_5spacy_15parts_of_speech_SYM, + __pyx_e_5spacy_15parts_of_speech_VERB, + __pyx_e_5spacy_15parts_of_speech_X, + __pyx_e_5spacy_15parts_of_speech_EOL, + __pyx_e_5spacy_15parts_of_speech_SPACE +}; +struct __pyx_t_5spacy_7structs_LexemeC; +struct __pyx_t_5spacy_7structs_SpanC; +struct __pyx_t_5spacy_7structs_TokenC; +struct __pyx_t_5spacy_7structs_MorphAnalysisC; +struct __pyx_t_5spacy_7structs_KBEntryC; +struct __pyx_t_5spacy_7structs_AliasC; +struct __pyx_t_5spacy_7structs_EdgeC; +struct __pyx_t_5spacy_7structs_GraphC; + +/* "structs.pxd":10 + * + * + * cdef struct LexemeC: # <<<<<<<<<<<<<< + * flags_t flags + * +*/ +struct __pyx_t_5spacy_7structs_LexemeC { + __pyx_t_5spacy_8typedefs_flags_t flags; + __pyx_t_5spacy_8typedefs_attr_t lang; + __pyx_t_5spacy_8typedefs_attr_t id; + __pyx_t_5spacy_8typedefs_attr_t length; + __pyx_t_5spacy_8typedefs_attr_t orth; + __pyx_t_5spacy_8typedefs_attr_t lower; + __pyx_t_5spacy_8typedefs_attr_t norm; + __pyx_t_5spacy_8typedefs_attr_t shape; + __pyx_t_5spacy_8typedefs_attr_t prefix; + __pyx_t_5spacy_8typedefs_attr_t suffix; +}; + +/* "structs.pxd":26 + * + * + * cdef struct SpanC: # <<<<<<<<<<<<<< + * hash_t id + * int start +*/ +struct __pyx_t_5spacy_7structs_SpanC { + __pyx_t_5spacy_8typedefs_hash_t id; + int start; + int end; + int start_char; + int end_char; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_attr_t kb_id; +}; + +/* "structs.pxd":36 + * + * + * cdef struct TokenC: # <<<<<<<<<<<<<< + * const LexemeC* lex + * uint64_t morph +*/ +struct __pyx_t_5spacy_7structs_TokenC { + struct __pyx_t_5spacy_7structs_LexemeC const *lex; + uint64_t morph; + enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos; + int spacy; + __pyx_t_5spacy_8typedefs_attr_t tag; + int idx; + __pyx_t_5spacy_8typedefs_attr_t lemma; + __pyx_t_5spacy_8typedefs_attr_t norm; + int head; + __pyx_t_5spacy_8typedefs_attr_t dep; + uint32_t l_kids; + uint32_t r_kids; + uint32_t l_edge; + uint32_t r_edge; + int sent_start; + int ent_iob; + __pyx_t_5spacy_8typedefs_attr_t ent_type; + __pyx_t_5spacy_8typedefs_attr_t ent_kb_id; + __pyx_t_5spacy_8typedefs_hash_t ent_id; +}; + +/* "structs.pxd":60 + * + * + * cdef struct MorphAnalysisC: # <<<<<<<<<<<<<< + * hash_t key + * int length +*/ +struct __pyx_t_5spacy_7structs_MorphAnalysisC { + __pyx_t_5spacy_8typedefs_hash_t key; + int length; + __pyx_t_5spacy_8typedefs_attr_t *fields; + __pyx_t_5spacy_8typedefs_attr_t *features; +}; + +/* "structs.pxd":69 + * + * # Internal struct, for storage and disambiguation of entities. + * cdef struct KBEntryC: # <<<<<<<<<<<<<< + * + * # The hash of this entry's unique ID/name in the kB +*/ +struct __pyx_t_5spacy_7structs_KBEntryC { + __pyx_t_5spacy_8typedefs_hash_t entity_hash; + int32_t vector_index; + int32_t feats_row; + float freq; +}; + +/* "structs.pxd":88 + * # Each alias struct stores a list of Entry pointers with their prior probabilities + * # for this specific mention/alias. + * cdef struct AliasC: # <<<<<<<<<<<<<< + * + * # All entry candidates for this alias +*/ +struct __pyx_t_5spacy_7structs_AliasC { + std::vector entry_indices; + std::vector probs; +}; + +/* "structs.pxd":97 + * + * + * cdef struct EdgeC: # <<<<<<<<<<<<<< + * hash_t label + * int32_t head +*/ +struct __pyx_t_5spacy_7structs_EdgeC { + __pyx_t_5spacy_8typedefs_hash_t label; + int32_t head; + int32_t tail; +}; + +/* "structs.pxd":103 + * + * + * cdef struct GraphC: # <<<<<<<<<<<<<< + * vector[vector[int32_t]] nodes + * vector[EdgeC] edges +*/ +struct __pyx_t_5spacy_7structs_GraphC { + std::vector > nodes; + std::vector edges; + std::vector weights; + std::vector n_heads; + std::vector n_tails; + std::vector first_head; + std::vector first_tail; + std::unordered_set *roots; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *node_map; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *edge_map; +}; + +/* "attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "spacy/morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_10morphology_Morphology { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_7preshed_4maps_PreshMap *tags; +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; + + +/* "spacy/morphology.pyx":14 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * """Store the possible morphological analyses for a language, and index them + * by hash. +*/ + +struct __pyx_vtabstruct_5spacy_10morphology_Morphology { + struct __pyx_t_5spacy_7structs_MorphAnalysisC (*create_morph_tag)(struct __pyx_obj_5spacy_10morphology_Morphology *, PyObject *); + int (*insert)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_MorphAnalysisC); +}; +static struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtabptr_5spacy_10morphology_Morphology; +/* #### Code section: utility_code_proto ### */ + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto (used by PyErrFetchRestore) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* GetTopmostException.proto (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* PyImportError_Check.proto */ +#define __Pyx_PyExc_ImportError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ImportError) + +/* PyObjectCall.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* TupleAndListFromArray.proto (used by fastcall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +#endif +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto (used by BytesEquals) */ +#include + +/* BytesEquals.proto (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i)) +#else + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i)) +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i]) + #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); + #else + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #endif +#else + #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS +#endif +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start) +#else +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* py_dict_items.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); + +/* CallCFunction.proto (used by CallUnboundCMethod0) */ +#define __Pyx_CallCFunction(cfunc, self, args)\ + ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args) +#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\ + ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs) +#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\ + ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs) +#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ + ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) + +/* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ +typedef struct { + PyObject *type; + PyObject **method_name; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS + __pyx_atomic_int_type initialized; +#endif + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) { +#if !CYTHON_ATOMICS + return 1; +#else + __pyx_nonatomic_int_type expected = 0; + if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) { + return 0; + } + return expected; +#endif +} +static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) { +#if CYTHON_ATOMICS + __pyx_atomic_store(&cfunc->initialized, 2); +#endif +} +#else +#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2 +#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc) +#endif + +/* CallUnboundCMethod0.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#else +#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) +#endif + +/* py_dict_values.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); + +/* OwnedDictNext.proto (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue); +#else +CYTHON_INLINE +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue); +#endif + +/* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywordsImpl.export */ +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name +); +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* CallUnboundCMethod2.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); +#else +#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) +#endif + +/* ParseKeywords.proto */ +static CYTHON_INLINE int __Pyx_ParseKeywords( + PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[], + PyObject *kwds2, PyObject *values[], + Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* ArgTypeTestFunc.export */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) + +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); + +/* ListCompAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + L->ob_item[len] = x; + #else + PyList_SET_ITEM(list, len, x); + #endif + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* PyObjectFastCallMethod.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) +#else +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); +#endif + +/* PyDictVersioning.proto (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* PyObjectVectorCallKwBuilder.proto (used by PyObjectVectorCallMethodKwBuilder) */ +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#if CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall +#endif +#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict +#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) +#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) +#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) +#endif + +/* PyObjectVectorCallMethodKwBuilder.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod +#else +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#endif + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* DictGetItem.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); +#define __Pyx_PyObject_Dict_GetItem(obj, name)\ + (likely(PyDict_CheckExact(obj)) ?\ + __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) +#else +#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) +#endif + +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + L->ob_item[len] = x; + #else + PyList_SET_ITEM(list, len, x); + #endif + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* PyLongBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) +#endif + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* SliceObject.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +/* AllocateExtensionType.proto */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); + +/* CallTypeTraverse.proto */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0 +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg); +#endif + +/* FunctionExport.proto */ +static int __Pyx_ExportFunction(PyObject *api_dict, const char *name, void (*f)(void), const char *sig); + +/* GetApiDict.proto */ +static PyObject *__Pyx_ApiExport_GetApiDict(void); + +/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp); +#endif + +/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v); +#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v) + +/* FixUpExtensionType.proto */ +static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); + +/* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); +#endif + +/* PyObjectCallMethod0.proto (used by PyType_Ready) */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto (used by PyType_Ready) */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* GetVTable.proto (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +static int __Pyx_MergeVtables(PyTypeObject *type); + +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* HasAttr.proto (used by ImportImpl) */ +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n) +#else +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +#endif + +/* ImportImpl.export */ +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); + +/* Import.proto */ +static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* dict_setdefault.proto (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); + +/* AddModuleRef.proto (used by FetchSharedCythonModule) */ +#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ + __PYX_LIMITED_VERSION_HEX < 0x030d0000) + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); +#else + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#endif + +/* FetchSharedCythonModule.proto (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto (used by CommonTypesMetaclass) */ +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases); + +/* CommonTypesMetaclass.proto (used by CythonFunctionShared) */ +static int __pyx_CommonTypesMetaclass_init(PyObject *module); +#define __Pyx_CommonTypesMetaclass_USED + +/* PyMethodNew.proto (used by CythonFunctionShared) */ +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ); + +/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto (used by CythonFunction) */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_dict; +#endif + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + PyObject *defaults; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#undef __Pyx_CyOrPyCFunction_Check +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType) +#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType) +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)); +#undef __Pyx_IsSameCFunction +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, + PyTypeObject *defaults_type); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* GetNameInClass.proto */ +#define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name) +static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name); + +/* CLineInTraceback.proto (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#else +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#endif + +/* CodeObjectCache.proto (used by AddTraceback) */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject __Pyx_CachedCodeObjectType; +#else +typedef PyCodeObject __Pyx_CachedCodeObjectType; +#endif +typedef struct { + __Pyx_CachedCodeObjectType* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_int_type accessor_count; + #endif +}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* RealImag.proto */ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(__cplusplus) && CYTHON_CCOMPLEX\ + && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_double(a, b) ((a)==(b)) + #define __Pyx_c_sum_double(a, b) ((a)+(b)) + #define __Pyx_c_diff_double(a, b) ((a)-(b)) + #define __Pyx_c_prod_double(a, b) ((a)*(b)) + #define __Pyx_c_quot_double(a, b) ((a)/(b)) + #define __Pyx_c_neg_double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_double(z) ((z)==(double)0) + #define __Pyx_c_conj_double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (::std::abs(z)) + #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_double(z) ((z)==0) + #define __Pyx_c_conj_double(z) (conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (cabs(z)) + #define __Pyx_c_pow_double(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_long__double(a, b) ((a)==(b)) + #define __Pyx_c_sum_long__double(a, b) ((a)+(b)) + #define __Pyx_c_diff_long__double(a, b) ((a)-(b)) + #define __Pyx_c_prod_long__double(a, b) ((a)*(b)) + #define __Pyx_c_quot_long__double(a, b) ((a)/(b)) + #define __Pyx_c_neg_long__double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0) + #define __Pyx_c_conj_long__double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (::std::abs(z)) + #define __Pyx_c_pow_long__double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_long__double(z) ((z)==0) + #define __Pyx_c_conj_long__double(z) (conjl(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (cabsl(z)) + #define __Pyx_c_pow_long__double(a, b) (cpowl(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex); + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + #endif +#endif + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(enum __pyx_t_5spacy_5attrs_attr_id_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#else +static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); +#endif +#else // !LIMITED_API +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { + return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); +} +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +#ifdef PyExceptionInstance_Check + #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) +#else + #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) +#endif + +/* GetRuntimeVersion.proto */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +static unsigned long __Pyx_cached_runtime_version = 0; +static void __Pyx_init_runtime_version(void); +#else +#define __Pyx_init_runtime_version() +#endif +static unsigned long __Pyx_get_runtime_version(void); + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); + +/* DecompressString.proto */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); + +/* MultiPhaseInitModuleState.proto */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +static PyObject *__Pyx_State_FindModule(void*); +static int __Pyx_State_AddModule(PyObject* module, void*); +static int __Pyx_State_RemoveModule(void*); +#elif CYTHON_USE_MODULE_STATE +#define __Pyx_State_FindModule PyState_FindModule +#define __Pyx_State_AddModule PyState_AddModule +#define __Pyx_State_RemoveModule PyState_RemoveModule +#endif + +/* #### Code section: module_declarations ### */ +/* CythonABIVersion.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API + #if CYTHON_METH_FASTCALL + #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" + #else + #define __PYX_FASTCALL_ABI_SUFFIX + #endif + #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#else + #define __PYX_LIMITED_ABI_SUFFIX +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + #define __PYX_AM_SEND_ABI_SUFFIX +#elif __PYX_HAS_PY_AM_SEND == 2 + #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" +#else + #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" +#endif +#ifndef __PYX_MONITORING_ABI_SUFFIX + #define __PYX_MONITORING_ABI_SUFFIX +#endif +#if CYTHON_USE_TP_FINALIZE + #define __PYX_TP_FINALIZE_ABI_SUFFIX +#else + #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" +#endif +#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) + #define __PYX_FREELISTS_ABI_SUFFIX +#else + #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" +#endif +#define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ +static struct __pyx_t_5spacy_7structs_MorphAnalysisC __pyx_f_5spacy_10morphology_10Morphology_create_morph_tag(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_field_feature_pairs); /* proto*/ +static int __pyx_f_5spacy_10morphology_10Morphology_insert(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, struct __pyx_t_5spacy_7structs_MorphAnalysisC __pyx_v_tag); /* proto*/ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libc.stdio" */ + +/* Module declarations from "__builtin__" */ + +/* Module declarations from "cpython.type" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "cpython.object" */ + +/* Module declarations from "cpython.ref" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "preshed.maps" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "spacy.strings" */ + +/* Module declarations from "libcpp.unordered_map" */ + +/* Module declarations from "libcpp.unordered_set" */ + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.parts_of_speech" */ + +/* Module declarations from "spacy.structs" */ + +/* Module declarations from "spacy.attrs" */ + +/* Module declarations from "spacy.morphology" */ +static int __pyx_f_5spacy_10morphology_get_n_by_field(__pyx_t_5spacy_8typedefs_attr_t *, struct __pyx_t_5spacy_7structs_MorphAnalysisC const *, __pyx_t_5spacy_8typedefs_attr_t); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.morphology" +extern int __pyx_module_is_main_spacy__morphology; +int __pyx_module_is_main_spacy__morphology = 0; + +/* Implementation of "spacy.morphology" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_staticmethod; +static PyObject *__pyx_builtin_enumerate; +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static int __pyx_pf_5spacy_10morphology_10Morphology___init__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_strings); /* proto */ +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_2__reduce__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_4add(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_features); /* proto */ +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_6normalize_features(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_features); /* proto */ +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_8normalize_attrs(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_attrs); /* proto */ +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_10get(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, __pyx_t_5spacy_8typedefs_hash_t __pyx_v_morph); /* proto */ +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_12feats_to_dict(PyObject *__pyx_v_feats); /* proto */ +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_14dict_to_feats(PyObject *__pyx_v_feats_dict); /* proto */ +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_3mem___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_7strings___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_10morphology_unpickle_morphology(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_strings, PyObject *__pyx_v_tags); /* proto */ +static PyObject *__pyx_tp_new_5spacy_10morphology_Morphology(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +/* SmallCodeConfig */ +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + PyTypeObject *__pyx_ptype_7cpython_4type_type; + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyObject *__pyx_type_5spacy_10morphology_Morphology; + PyTypeObject *__pyx_ptype_5spacy_10morphology_Morphology; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + PyObject *__pyx_codeobj_tab[8]; + PyObject *__pyx_string_tab[118]; + PyObject *__pyx_number_tab[2]; +/* #### Code section: module_state_contents ### */ +/* CommonTypesMetaclass.module_state_decls */ +PyTypeObject *__pyx_CommonTypesMetaclassType; + +/* CachedMethodType.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API +PyObject *__Pyx_CachedMethodType; +#endif + +/* CythonFunctionShared.module_state_decls */ +PyTypeObject *__pyx_CyFunctionType; + +/* CodeObjectCache.module_state_decls */ +struct __Pyx_CodeObjectCache __pyx_code_cache; + +/* #### Code section: module_state_end ### */ +} __pyx_mstatetype; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { +extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) + +#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstatetype __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: constant_name_defines ### */ +#define __pyx_kp_u_ __pyx_string_tab[0] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[1] +#define __pyx_kp_u__2 __pyx_string_tab[2] +#define __pyx_kp_u__3 __pyx_string_tab[3] +#define __pyx_kp_u__4 __pyx_string_tab[4] +#define __pyx_kp_u__5 __pyx_string_tab[5] +#define __pyx_kp_u__7 __pyx_string_tab[6] +#define __pyx_kp_u_add_note __pyx_string_tab[7] +#define __pyx_kp_u_disable __pyx_string_tab[8] +#define __pyx_kp_u_enable __pyx_string_tab[9] +#define __pyx_kp_u_gc __pyx_string_tab[10] +#define __pyx_kp_u_isenabled __pyx_string_tab[11] +#define __pyx_kp_u_numpy__core_multiarray_failed_to __pyx_string_tab[12] +#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[13] +#define __pyx_kp_u_spacy __pyx_string_tab[14] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[15] +#define __pyx_kp_u_spacy_morphology_pyx __pyx_string_tab[16] +#define __pyx_kp_u_spacy_numpy __pyx_string_tab[17] +#define __pyx_kp_u_spacy_parts_of_speech __pyx_string_tab[18] +#define __pyx_kp_u_spacy_warnings __pyx_string_tab[19] +#define __pyx_n_u_ __pyx_string_tab[20] +#define __pyx_n_u_EMPTY_MORPH __pyx_string_tab[21] +#define __pyx_n_u_FEATURE_SEP __pyx_string_tab[22] +#define __pyx_n_u_FIELD_SEP __pyx_string_tab[23] +#define __pyx_n_u_IDS __pyx_string_tab[24] +#define __pyx_n_u_Morphology __pyx_string_tab[25] +#define __pyx_n_u_Morphology___reduce __pyx_string_tab[26] +#define __pyx_n_u_Morphology_add __pyx_string_tab[27] +#define __pyx_n_u_Morphology_dict_to_feats __pyx_string_tab[28] +#define __pyx_n_u_Morphology_feats_to_dict __pyx_string_tab[29] +#define __pyx_n_u_Morphology_get __pyx_string_tab[30] +#define __pyx_n_u_Morphology_normalize_attrs __pyx_string_tab[31] +#define __pyx_n_u_Morphology_normalize_features __pyx_string_tab[32] +#define __pyx_n_u_NAMES __pyx_string_tab[33] +#define __pyx_n_u_POS __pyx_string_tab[34] +#define __pyx_n_u_POS_IDS __pyx_string_tab[35] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[36] +#define __pyx_n_u_VALUE_SEP __pyx_string_tab[37] +#define __pyx_n_u_W100 __pyx_string_tab[38] +#define __pyx_n_u_Warnings __pyx_string_tab[39] +#define __pyx_n_u__6 __pyx_string_tab[40] +#define __pyx_n_u_add __pyx_string_tab[41] +#define __pyx_n_u_allow_transient __pyx_string_tab[42] +#define __pyx_n_u_as_string __pyx_string_tab[43] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[44] +#define __pyx_n_u_attrs __pyx_string_tab[45] +#define __pyx_n_u_class_getitem __pyx_string_tab[46] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[47] +#define __pyx_n_u_dict __pyx_string_tab[48] +#define __pyx_n_u_dict_to_feats __pyx_string_tab[49] +#define __pyx_n_u_dtype __pyx_string_tab[50] +#define __pyx_n_u_enumerate __pyx_string_tab[51] +#define __pyx_n_u_errors __pyx_string_tab[52] +#define __pyx_n_u_feat __pyx_string_tab[53] +#define __pyx_n_u_feats __pyx_string_tab[54] +#define __pyx_n_u_feats_dict __pyx_string_tab[55] +#define __pyx_n_u_feats_to_dict __pyx_string_tab[56] +#define __pyx_n_u_feature __pyx_string_tab[57] +#define __pyx_n_u_features __pyx_string_tab[58] +#define __pyx_n_u_field __pyx_string_tab[59] +#define __pyx_n_u_field_feature_pairs __pyx_string_tab[60] +#define __pyx_n_u_field_id __pyx_string_tab[61] +#define __pyx_n_u_field_sep_value __pyx_string_tab[62] +#define __pyx_n_u_format __pyx_string_tab[63] +#define __pyx_n_u_func __pyx_string_tab[64] +#define __pyx_n_u_get __pyx_string_tab[65] +#define __pyx_n_u_is_coroutine __pyx_string_tab[66] +#define __pyx_n_u_items __pyx_string_tab[67] +#define __pyx_n_u_join __pyx_string_tab[68] +#define __pyx_n_u_key __pyx_string_tab[69] +#define __pyx_n_u_main __pyx_string_tab[70] +#define __pyx_n_u_module __pyx_string_tab[71] +#define __pyx_n_u_morph __pyx_string_tab[72] +#define __pyx_n_u_morphology __pyx_string_tab[73] +#define __pyx_n_u_name __pyx_string_tab[74] +#define __pyx_n_u_norm_feats_string __pyx_string_tab[75] +#define __pyx_n_u_normalize_attrs __pyx_string_tab[76] +#define __pyx_n_u_normalize_features __pyx_string_tab[77] +#define __pyx_n_u_numpy __pyx_string_tab[78] +#define __pyx_n_u_out __pyx_string_tab[79] +#define __pyx_n_u_parts_of_speech __pyx_string_tab[80] +#define __pyx_n_u_pop __pyx_string_tab[81] +#define __pyx_n_u_pyx_capi __pyx_string_tab[82] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[83] +#define __pyx_n_u_qualname __pyx_string_tab[84] +#define __pyx_n_u_reduce __pyx_string_tab[85] +#define __pyx_n_u_s __pyx_string_tab[86] +#define __pyx_n_u_self __pyx_string_tab[87] +#define __pyx_n_u_set_name __pyx_string_tab[88] +#define __pyx_n_u_setdefault __pyx_string_tab[89] +#define __pyx_n_u_spacy_morphology __pyx_string_tab[90] +#define __pyx_n_u_split __pyx_string_tab[91] +#define __pyx_n_u_staticmethod __pyx_string_tab[92] +#define __pyx_n_u_string_features __pyx_string_tab[93] +#define __pyx_n_u_strings __pyx_string_tab[94] +#define __pyx_n_u_symbols __pyx_string_tab[95] +#define __pyx_n_u_tag __pyx_string_tab[96] +#define __pyx_n_u_tag_ptr __pyx_string_tab[97] +#define __pyx_n_u_tags __pyx_string_tab[98] +#define __pyx_n_u_test __pyx_string_tab[99] +#define __pyx_n_u_uint64 __pyx_string_tab[100] +#define __pyx_n_u_unpickle_morphology __pyx_string_tab[101] +#define __pyx_n_u_upper __pyx_string_tab[102] +#define __pyx_n_u_value __pyx_string_tab[103] +#define __pyx_n_u_values __pyx_string_tab[104] +#define __pyx_n_u_warn __pyx_string_tab[105] +#define __pyx_n_u_warnings __pyx_string_tab[106] +#define __pyx_n_u_zeros __pyx_string_tab[107] +#define __pyx_kp_b_PyArrayObject_struct___pyx_t_5sp __pyx_string_tab[108] +#define __pyx_kp_b_iso88591_1A_q_aq_1 __pyx_string_tab[109] +#define __pyx_kp_b_iso88591_A_3a_3a_1_z_U_ZuAQgU__iinnuuvv_C __pyx_string_tab[110] +#define __pyx_kp_b_iso88591_A_4vS_c_1_1_q_z_5_q_fAZ_aahhi_V1 __pyx_string_tab[111] +#define __pyx_kp_b_iso88591_A_Qj_t_4z_A_E_waxq_q_4_q_4xz_hjP __pyx_string_tab[112] +#define __pyx_kp_b_iso88591_A_Qj_y_1_4q_t5_AXT_xs_wa_t_4z_A __pyx_string_tab[113] +#define __pyx_kp_b_iso88591_A_a_AQ_E_vQ_t3d_j_e4s_3a_QgU_e6 __pyx_string_tab[114] +#define __pyx_kp_b_iso88591_A_s_1D_AT_d_t1_1AQ_d_86 __pyx_string_tab[115] +#define __pyx_kp_b_iso88591_A_t5_AQ_4s_1_4xq_1 __pyx_string_tab[116] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_hash6 __pyx_string_tab[117] +#define __pyx_int_0 __pyx_number_tab[0] +#define __pyx_int_1 __pyx_number_tab[1] +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { + __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #if CYTHON_PEP489_MULTI_PHASE_INIT + __Pyx_State_RemoveModule(NULL); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_10morphology_Morphology); + for (int i=0; i<8; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<118; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } +/* #### Code section: module_state_clear_contents ### */ +/* CommonTypesMetaclass.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + +/* #### Code section: module_state_clear_end ### */ +return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_10morphology_Morphology); + for (int i=0; i<8; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<118; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } +/* #### Code section: module_state_traverse_contents ### */ +/* CommonTypesMetaclass.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":244 + * @property + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_ELSIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":248 + * @property + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) # <<<<<<<<<<<<<< + * + * # Use fields/names with care as they may be NULL. You must check +*/ + __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("fields", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":254 + * @property + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("names", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":258 + * @property + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) # <<<<<<<<<<<<<< + * + * # Use PyDataType_HASSUBARRAY to test whether this field is +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_NAMES(__pyx_v_self); + __Pyx_INCREF(((PyObject*)__pyx_t_1)); + __pyx_r = ((PyObject*)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) { + PyArray_ArrayDescr *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":265 + * @property + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_SUBARRAY(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) { + npy_uint64 __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":270 + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" + * return PyDataType_FLAGS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyDataType_FLAGS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":282 + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" + * return PyArray_MultiIter_NUMITER(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":287 + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" + * return PyArray_MultiIter_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":292 + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" + * return PyArray_MultiIter_INDEX(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":297 + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" + * return PyArray_MultiIter_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":302 + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" + * return PyArray_MultiIter_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) { + void **__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":308 + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. + * On return, the iterators are adjusted for broadcasting.""" + * return PyArray_MultiIter_ITERS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":326 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":332 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":338 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":346 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":353 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":359 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":368 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":777 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":780 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":793 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape; + __Pyx_INCREF(((PyObject*)__pyx_t_2)); + __pyx_r = ((PyObject*)__pyx_t_2); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":795 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_r = __pyx_mstate_global->__pyx_empty_tuple; + goto __pyx_L0; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":995 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * +*/ + Py_INCREF(__pyx_v_base); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":996 + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): +*/ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 996, __pyx_L1_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":999 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None +*/ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1001 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1002 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_array", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1008 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") +*/ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1008, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1009 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.multiarray failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1009, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1010 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1010, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(1, 1010, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1014 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1014, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1015 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1015, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1016 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1016, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(1, 1016, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1020 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1020, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1021 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1021, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1022 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1022, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(1, 1022, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1037 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1052 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1062 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1069 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1076 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/morphology.pyx":28 + * EMPTY_MORPH = symbols.NAMES[symbols._] + * + * def __init__(self, StringStore strings): # <<<<<<<<<<<<<< + * self.mem = Pool() + * self.strings = strings +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_10morphology_10Morphology_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5spacy_10morphology_10Morphology_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_strings = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_strings,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 28, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 28, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 28, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(0, 28, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 28, __pyx_L3_error) + } + __pyx_v_strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 28, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.morphology.Morphology.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strings), __pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, 1, "strings", 0))) __PYX_ERR(0, 28, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_10morphology_10Morphology___init__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), __pyx_v_strings); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_10morphology_10Morphology___init__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_strings) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/morphology.pyx":29 + * + * def __init__(self, StringStore strings): + * self.mem = Pool() # <<<<<<<<<<<<<< + * self.strings = strings + * self.tags = PreshMap() +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->mem); + __Pyx_DECREF((PyObject *)__pyx_v_self->mem); + __pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/morphology.pyx":30 + * def __init__(self, StringStore strings): + * self.mem = Pool() + * self.strings = strings # <<<<<<<<<<<<<< + * self.tags = PreshMap() + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_strings); + __Pyx_GIVEREF((PyObject *)__pyx_v_strings); + __Pyx_GOTREF((PyObject *)__pyx_v_self->strings); + __Pyx_DECREF((PyObject *)__pyx_v_self->strings); + __pyx_v_self->strings = __pyx_v_strings; + + /* "spacy/morphology.pyx":31 + * self.mem = Pool() + * self.strings = strings + * self.tags = PreshMap() # <<<<<<<<<<<<<< + * + * def __reduce__(self): +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_7preshed_4maps_PreshMap, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->tags); + __Pyx_DECREF((PyObject *)__pyx_v_self->tags); + __pyx_v_self->tags = ((struct __pyx_obj_7preshed_4maps_PreshMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/morphology.pyx":28 + * EMPTY_MORPH = symbols.NAMES[symbols._] + * + * def __init__(self, StringStore strings): # <<<<<<<<<<<<<< + * self.mem = Pool() + * self.strings = strings +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.morphology.Morphology.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pyx":33 + * self.tags = PreshMap() + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * tags = set([self.get(self.strings[s]) for s in self.strings]) + * tags -= set([""]) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_3__reduce__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_10morphology_10Morphology_2__reduce__, "Morphology.__reduce__(self)"); +static PyMethodDef __pyx_mdef_5spacy_10morphology_10Morphology_3__reduce__ = {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_3__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_2__reduce__}; +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_3__reduce__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_2__reduce__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_2__reduce__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) { + PyObject *__pyx_v_tags = NULL; + PyObject *__pyx_v_s = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "spacy/morphology.pyx":34 + * + * def __reduce__(self): + * tags = set([self.get(self.strings[s]) for s in self.strings]) # <<<<<<<<<<<<<< + * tags -= set([""]) + * return (unpickle_morphology, (self.strings, sorted(tags)), None, None) +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->strings))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->strings))) { + __pyx_t_2 = ((PyObject *)__pyx_v_self->strings); __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self->strings)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 34, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 34, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 34, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_6 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_v_s); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PySet_New(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_tags = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":35 + * def __reduce__(self): + * tags = set([self.get(self.strings[s]) for s in self.strings]) + * tags -= set([""]) # <<<<<<<<<<<<<< + * return (unpickle_morphology, (self.strings, sorted(tags)), None, None) + * +*/ + __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PySet_Add(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_) < (0)) __PYX_ERR(0, 35, __pyx_L1_error) + __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_tags, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_tags, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/morphology.pyx":36 + * tags = set([self.get(self.strings[s]) for s in self.strings]) + * tags -= set([""]) + * return (unpickle_morphology, (self.strings, sorted(tags)), None, None) # <<<<<<<<<<<<<< + * + * def add(self, features): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_unpickle_morphology); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PySequence_List(__pyx_v_tags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((PyList_Sort(__pyx_t_2) < 0))) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF((PyObject *)__pyx_v_self->strings); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->strings); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self->strings)) != (0)) __PYX_ERR(0, 36, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 36, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 36, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 36, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None) != (0)) __PYX_ERR(0, 36, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 3, Py_None) != (0)) __PYX_ERR(0, 36, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_5 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/morphology.pyx":33 + * self.tags = PreshMap() + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * tags = set([self.get(self.strings[s]) for s in self.strings]) + * tags -= set([""]) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.morphology.Morphology.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tags); + __Pyx_XDECREF(__pyx_v_s); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pyx":38 + * return (unpickle_morphology, (self.strings, sorted(tags)), None, None) + * + * def add(self, features): # <<<<<<<<<<<<<< + * """Insert a morphological analysis in the morphology table, if not + * already present. The morphological analysis may be provided in the UD +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_5add(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_10morphology_10Morphology_4add, "Morphology.add(self, features)\n\nInsert a morphological analysis in the morphology table, if not\nalready present. The morphological analysis may be provided in the UD\nFEATS format as a string or in the tag map dict format.\nReturns the hash of the new analysis."); +static PyMethodDef __pyx_mdef_5spacy_10morphology_10Morphology_5add = {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_5add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_4add}; +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_5add(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_features = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_features,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 38, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 38, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "add", 0) < (0)) __PYX_ERR(0, 38, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, i); __PYX_ERR(0, 38, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 38, __pyx_L3_error) + } + __pyx_v_features = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 38, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.morphology.Morphology.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_4add(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), __pyx_v_features); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_4add(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_features) { + struct __pyx_t_5spacy_7structs_MorphAnalysisC *__pyx_v_tag_ptr; + PyObject *__pyx_v_string_features = NULL; + PyObject *__pyx_v_field_feature_pairs = NULL; + PyObject *__pyx_v_field = NULL; + PyObject *__pyx_v_values = NULL; + PyObject *__pyx_v_field_id = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_v_field_sep_value = NULL; + struct __pyx_t_5spacy_7structs_MorphAnalysisC __pyx_v_tag; + PyObject *__pyx_v_norm_feats_string = NULL; + PyObject *__pyx_7genexpr__pyx_v_field = NULL; + PyObject *__pyx_7genexpr__pyx_v_values = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_3; + void *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + Py_ssize_t __pyx_t_13; + PyObject *(*__pyx_t_14)(PyObject *); + PyObject *(*__pyx_t_15)(PyObject *); + Py_ssize_t __pyx_t_16; + int __pyx_t_17; + struct __pyx_t_5spacy_7structs_MorphAnalysisC __pyx_t_18; + int __pyx_t_19; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("add", 0); + __Pyx_INCREF(__pyx_v_features); + + /* "spacy/morphology.pyx":45 + * """ + * cdef MorphAnalysisC* tag_ptr + * if isinstance(features, str): # <<<<<<<<<<<<<< + * if features == "": + * features = self.EMPTY_MORPH +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_features); + if (__pyx_t_1) { + + /* "spacy/morphology.pyx":46 + * cdef MorphAnalysisC* tag_ptr + * if isinstance(features, str): + * if features == "": # <<<<<<<<<<<<<< + * features = self.EMPTY_MORPH + * tag_ptr = self.tags.get(self.strings[features]) +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_features, __pyx_mstate_global->__pyx_kp_u_, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 46, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/morphology.pyx":47 + * if isinstance(features, str): + * if features == "": + * features = self.EMPTY_MORPH # <<<<<<<<<<<<<< + * tag_ptr = self.tags.get(self.strings[features]) + * if tag_ptr != NULL: +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_EMPTY_MORPH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_features, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":46 + * cdef MorphAnalysisC* tag_ptr + * if isinstance(features, str): + * if features == "": # <<<<<<<<<<<<<< + * features = self.EMPTY_MORPH + * tag_ptr = self.tags.get(self.strings[features]) +*/ + } + + /* "spacy/morphology.pyx":48 + * if features == "": + * features = self.EMPTY_MORPH + * tag_ptr = self.tags.get(self.strings[features]) # <<<<<<<<<<<<<< + * if tag_ptr != NULL: + * return tag_ptr.key +*/ + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_v_features); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_As_uint64_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->tags->__pyx_vtab)->get(__pyx_v_self->tags, ((__pyx_t_5spacy_8typedefs_hash_t)__pyx_t_3)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_v_tag_ptr = ((struct __pyx_t_5spacy_7structs_MorphAnalysisC *)__pyx_t_4); + + /* "spacy/morphology.pyx":49 + * features = self.EMPTY_MORPH + * tag_ptr = self.tags.get(self.strings[features]) + * if tag_ptr != NULL: # <<<<<<<<<<<<<< + * return tag_ptr.key + * features = self.feats_to_dict(features) +*/ + __pyx_t_1 = (__pyx_v_tag_ptr != NULL); + if (__pyx_t_1) { + + /* "spacy/morphology.pyx":50 + * tag_ptr = self.tags.get(self.strings[features]) + * if tag_ptr != NULL: + * return tag_ptr.key # <<<<<<<<<<<<<< + * features = self.feats_to_dict(features) + * if not isinstance(features, dict): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_tag_ptr->key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/morphology.pyx":49 + * features = self.EMPTY_MORPH + * tag_ptr = self.tags.get(self.strings[features]) + * if tag_ptr != NULL: # <<<<<<<<<<<<<< + * return tag_ptr.key + * features = self.feats_to_dict(features) +*/ + } + + /* "spacy/morphology.pyx":51 + * if tag_ptr != NULL: + * return tag_ptr.key + * features = self.feats_to_dict(features) # <<<<<<<<<<<<<< + * if not isinstance(features, dict): + * warnings.warn(Warnings.W100.format(feature=features)) +*/ + __pyx_t_5 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_features}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_feats_to_dict, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF_SET(__pyx_v_features, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":45 + * """ + * cdef MorphAnalysisC* tag_ptr + * if isinstance(features, str): # <<<<<<<<<<<<<< + * if features == "": + * features = self.EMPTY_MORPH +*/ + } + + /* "spacy/morphology.pyx":52 + * return tag_ptr.key + * features = self.feats_to_dict(features) + * if not isinstance(features, dict): # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W100.format(feature=features)) + * features = {} +*/ + __pyx_t_1 = PyDict_Check(__pyx_v_features); + __pyx_t_7 = (!__pyx_t_1); + if (__pyx_t_7) { + + /* "spacy/morphology.pyx":53 + * features = self.feats_to_dict(features) + * if not isinstance(features, dict): + * warnings.warn(Warnings.W100.format(feature=features)) # <<<<<<<<<<<<<< + * features = {} + * string_features = {self.strings.as_string(field): self.strings.as_string(values) for field, values in features.items()} +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Warnings); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_W100); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_10 = __pyx_t_12; + __Pyx_INCREF(__pyx_t_10); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_10, NULL}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_feature, __pyx_v_features, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_8 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + } + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_9, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_8}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":54 + * if not isinstance(features, dict): + * warnings.warn(Warnings.W100.format(feature=features)) + * features = {} # <<<<<<<<<<<<<< + * string_features = {self.strings.as_string(field): self.strings.as_string(values) for field, values in features.items()} + * # intified ("Field", "Field=Value") pairs +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_features, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":52 + * return tag_ptr.key + * features = self.feats_to_dict(features) + * if not isinstance(features, dict): # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W100.format(feature=features)) + * features = {} +*/ + } + + /* "spacy/morphology.pyx":55 + * warnings.warn(Warnings.W100.format(feature=features)) + * features = {} + * string_features = {self.strings.as_string(field): self.strings.as_string(values) for field, values in features.items()} # <<<<<<<<<<<<<< + * # intified ("Field", "Field=Value") pairs + * field_feature_pairs = [] +*/ + { /* enter inner scope */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __pyx_v_features; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; + __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 55, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_9); + } + if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { + __pyx_t_8 = __pyx_t_9; __Pyx_INCREF(__pyx_t_8); + __pyx_t_13 = 0; + __pyx_t_14 = NULL; + } else { + __pyx_t_13 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 55, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 55, __pyx_L9_error) + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + for (;;) { + if (likely(!__pyx_t_14)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 55, __pyx_L9_error) + #endif + if (__pyx_t_13 >= __pyx_temp) break; + } + __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_8, __pyx_t_13, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_13; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 55, __pyx_L9_error) + #endif + if (__pyx_t_13 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_13)); + #else + __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_13); + #endif + ++__pyx_t_13; + } + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 55, __pyx_L9_error) + } else { + __pyx_t_9 = __pyx_t_14(__pyx_t_8); + if (unlikely(!__pyx_t_9)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 55, __pyx_L9_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_9); + if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) { + PyObject* sequence = __pyx_t_9; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 55, __pyx_L9_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L9_error) + __Pyx_XGOTREF(__pyx_t_5); + __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 55, __pyx_L9_error) + __Pyx_XGOTREF(__pyx_t_12); + } + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_12 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 55, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_12); + #endif + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_11 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 55, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_15 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); + index = 0; __pyx_t_5 = __pyx_t_15(__pyx_t_11); if (unlikely(!__pyx_t_5)) goto __pyx_L12_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_12 = __pyx_t_15(__pyx_t_11); if (unlikely(!__pyx_t_12)) goto __pyx_L12_unpacking_failed; + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_11), 2) < (0)) __PYX_ERR(0, 55, __pyx_L9_error) + __pyx_t_15 = NULL; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L13_unpacking_done; + __pyx_L12_unpacking_failed:; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_15 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 55, __pyx_L9_error) + __pyx_L13_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_field, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_values, __pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_12); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_7genexpr__pyx_v_field}; + __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_as_string, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 55, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_9); + } + __pyx_t_5 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_7genexpr__pyx_v_values}; + __pyx_t_12 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_as_string, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 55, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_12); + } + if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_t_9, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 55, __pyx_L9_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_field); __pyx_7genexpr__pyx_v_field = 0; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_values); __pyx_7genexpr__pyx_v_values = 0; + goto __pyx_L15_exit_scope; + __pyx_L9_error:; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_field); __pyx_7genexpr__pyx_v_field = 0; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_values); __pyx_7genexpr__pyx_v_values = 0; + goto __pyx_L1_error; + __pyx_L15_exit_scope:; + } /* exit inner scope */ + __pyx_v_string_features = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":57 + * string_features = {self.strings.as_string(field): self.strings.as_string(values) for field, values in features.items()} + * # intified ("Field", "Field=Value") pairs + * field_feature_pairs = [] # <<<<<<<<<<<<<< + * for field in sorted(string_features): + * values = string_features[field] +*/ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_field_feature_pairs = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":58 + * # intified ("Field", "Field=Value") pairs + * field_feature_pairs = [] + * for field in sorted(string_features): # <<<<<<<<<<<<<< + * values = string_features[field] + * self.strings.add(field, allow_transient=False), +*/ + __pyx_t_2 = PySequence_List(__pyx_v_string_features); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((PyList_Sort(__pyx_t_2) < 0))) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_8 = __pyx_t_2; __Pyx_INCREF(__pyx_t_8); + __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 58, __pyx_L1_error) + #endif + if (__pyx_t_13 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_8, __pyx_t_13, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_13; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":59 + * field_feature_pairs = [] + * for field in sorted(string_features): + * values = string_features[field] # <<<<<<<<<<<<<< + * self.strings.add(field, allow_transient=False), + * field_id = self.strings[field] +*/ + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_string_features, __pyx_v_field); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_values, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":60 + * for field in sorted(string_features): + * values = string_features[field] + * self.strings.add(field, allow_transient=False), # <<<<<<<<<<<<<< + * field_id = self.strings[field] + * for value in values.split(self.VALUE_SEP): +*/ + __pyx_t_12 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_12); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_12, __pyx_v_field}; + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_False, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 60, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 60, __pyx_L1_error); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "spacy/morphology.pyx":61 + * values = string_features[field] + * self.strings.add(field, allow_transient=False), + * field_id = self.strings[field] # <<<<<<<<<<<<<< + * for value in values.split(self.VALUE_SEP): + * field_sep_value = field + self.FIELD_SEP + value +*/ + __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_v_field); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_XDECREF_SET(__pyx_v_field_id, __pyx_t_9); + __pyx_t_9 = 0; + + /* "spacy/morphology.pyx":62 + * self.strings.add(field, allow_transient=False), + * field_id = self.strings[field] + * for value in values.split(self.VALUE_SEP): # <<<<<<<<<<<<<< + * field_sep_value = field + self.FIELD_SEP + value + * self.strings.add(field_sep_value, allow_transient=False), +*/ + __pyx_t_2 = __pyx_v_values; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_VALUE_SEP); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_12}; + __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_split, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + } + if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { + __pyx_t_12 = __pyx_t_9; __Pyx_INCREF(__pyx_t_12); + __pyx_t_16 = 0; + __pyx_t_14 = NULL; + } else { + __pyx_t_16 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 62, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + for (;;) { + if (likely(!__pyx_t_14)) { + if (likely(PyList_CheckExact(__pyx_t_12))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_12); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 62, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_12, __pyx_t_16, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_16; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_12); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 62, __pyx_L1_error) + #endif + if (__pyx_t_16 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_16)); + #else + __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_12, __pyx_t_16); + #endif + ++__pyx_t_16; + } + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error) + } else { + __pyx_t_9 = __pyx_t_14(__pyx_t_12); + if (unlikely(!__pyx_t_9)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 62, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_9); + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_9); + __pyx_t_9 = 0; + + /* "spacy/morphology.pyx":63 + * field_id = self.strings[field] + * for value in values.split(self.VALUE_SEP): + * field_sep_value = field + self.FIELD_SEP + value # <<<<<<<<<<<<<< + * self.strings.add(field_sep_value, allow_transient=False), + * field_feature_pairs.append(( +*/ + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_FIELD_SEP); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyNumber_Add(__pyx_v_field, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_v_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_field_sep_value, __pyx_t_9); + __pyx_t_9 = 0; + + /* "spacy/morphology.pyx":64 + * for value in values.split(self.VALUE_SEP): + * field_sep_value = field + self.FIELD_SEP + value + * self.strings.add(field_sep_value, allow_transient=False), # <<<<<<<<<<<<<< + * field_feature_pairs.append(( + * field_id, +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_field_sep_value}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_False, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_9 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + } + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9) != (0)) __PYX_ERR(0, 64, __pyx_L1_error); + __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/morphology.pyx":67 + * field_feature_pairs.append(( + * field_id, + * self.strings[field_sep_value] # <<<<<<<<<<<<<< + * )) + * cdef MorphAnalysisC tag = self.create_morph_tag(field_feature_pairs) +*/ + __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_v_field_sep_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + + /* "spacy/morphology.pyx":66 + * self.strings.add(field_sep_value, allow_transient=False), + * field_feature_pairs.append(( + * field_id, # <<<<<<<<<<<<<< + * self.strings[field_sep_value] + * )) +*/ + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_field_id); + __Pyx_GIVEREF(__pyx_v_field_id); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_field_id) != (0)) __PYX_ERR(0, 66, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 66, __pyx_L1_error); + __pyx_t_5 = 0; + + /* "spacy/morphology.pyx":65 + * field_sep_value = field + self.FIELD_SEP + value + * self.strings.add(field_sep_value, allow_transient=False), + * field_feature_pairs.append(( # <<<<<<<<<<<<<< + * field_id, + * self.strings[field_sep_value] +*/ + __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_field_feature_pairs, __pyx_t_9); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "spacy/morphology.pyx":62 + * self.strings.add(field, allow_transient=False), + * field_id = self.strings[field] + * for value in values.split(self.VALUE_SEP): # <<<<<<<<<<<<<< + * field_sep_value = field + self.FIELD_SEP + value + * self.strings.add(field_sep_value, allow_transient=False), +*/ + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "spacy/morphology.pyx":58 + * # intified ("Field", "Field=Value") pairs + * field_feature_pairs = [] + * for field in sorted(string_features): # <<<<<<<<<<<<<< + * values = string_features[field] + * self.strings.add(field, allow_transient=False), +*/ + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/morphology.pyx":69 + * self.strings[field_sep_value] + * )) + * cdef MorphAnalysisC tag = self.create_morph_tag(field_feature_pairs) # <<<<<<<<<<<<<< + * # the hash key for the tag is either the hash of the normalized UFEATS + * # string or the hash of an empty placeholder +*/ + __pyx_t_18 = ((struct __pyx_vtabstruct_5spacy_10morphology_Morphology *)__pyx_v_self->__pyx_vtab)->create_morph_tag(__pyx_v_self, __pyx_v_field_feature_pairs); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_v_tag = __pyx_t_18; + + /* "spacy/morphology.pyx":72 + * # the hash key for the tag is either the hash of the normalized UFEATS + * # string or the hash of an empty placeholder + * norm_feats_string = self.normalize_features(features) # <<<<<<<<<<<<<< + * tag.key = self.strings.add(norm_feats_string, allow_transient=False) + * self.insert(tag) +*/ + __pyx_t_12 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_12); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_v_features}; + __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_normalize_features, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + } + __pyx_v_norm_feats_string = __pyx_t_8; + __pyx_t_8 = 0; + + /* "spacy/morphology.pyx":73 + * # string or the hash of an empty placeholder + * norm_feats_string = self.normalize_features(features) + * tag.key = self.strings.add(norm_feats_string, allow_transient=False) # <<<<<<<<<<<<<< + * self.insert(tag) + * return tag.key +*/ + __pyx_t_12 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_12); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_12, __pyx_v_norm_feats_string}; + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_False, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_8 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + } + __pyx_t_3 = __Pyx_PyLong_As_uint64_t(__pyx_t_8); if (unlikely((__pyx_t_3 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_tag.key = __pyx_t_3; + + /* "spacy/morphology.pyx":74 + * norm_feats_string = self.normalize_features(features) + * tag.key = self.strings.add(norm_feats_string, allow_transient=False) + * self.insert(tag) # <<<<<<<<<<<<<< + * return tag.key + * +*/ + __pyx_t_19 = ((struct __pyx_vtabstruct_5spacy_10morphology_Morphology *)__pyx_v_self->__pyx_vtab)->insert(__pyx_v_self, __pyx_v_tag); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 74, __pyx_L1_error) + + /* "spacy/morphology.pyx":75 + * tag.key = self.strings.add(norm_feats_string, allow_transient=False) + * self.insert(tag) + * return tag.key # <<<<<<<<<<<<<< + * + * def normalize_features(self, features): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_8 = __Pyx_PyLong_From_uint64_t(__pyx_v_tag.key); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L0; + + /* "spacy/morphology.pyx":38 + * return (unpickle_morphology, (self.strings, sorted(tags)), None, None) + * + * def add(self, features): # <<<<<<<<<<<<<< + * """Insert a morphological analysis in the morphology table, if not + * already present. The morphological analysis may be provided in the UD +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("spacy.morphology.Morphology.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_string_features); + __Pyx_XDECREF(__pyx_v_field_feature_pairs); + __Pyx_XDECREF(__pyx_v_field); + __Pyx_XDECREF(__pyx_v_values); + __Pyx_XDECREF(__pyx_v_field_id); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_field_sep_value); + __Pyx_XDECREF(__pyx_v_norm_feats_string); + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_field); + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_values); + __Pyx_XDECREF(__pyx_v_features); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pyx":77 + * return tag.key + * + * def normalize_features(self, features): # <<<<<<<<<<<<<< + * """Create a normalized FEATS string from a features string or dict. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_7normalize_features(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_10morphology_10Morphology_6normalize_features, "Morphology.normalize_features(self, features)\n\nCreate a normalized FEATS string from a features string or dict.\n\nfeatures (Union[dict, str]): Features as dict or UFEATS string.\nRETURNS (str): Features as normalized UFEATS string."); +static PyMethodDef __pyx_mdef_5spacy_10morphology_10Morphology_7normalize_features = {"normalize_features", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_7normalize_features, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_6normalize_features}; +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_7normalize_features(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_features = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("normalize_features (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_features,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 77, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 77, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "normalize_features", 0) < (0)) __PYX_ERR(0, 77, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("normalize_features", 1, 1, 1, i); __PYX_ERR(0, 77, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 77, __pyx_L3_error) + } + __pyx_v_features = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("normalize_features", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 77, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.morphology.Morphology.normalize_features", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_6normalize_features(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), __pyx_v_features); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_6normalize_features(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_features) { + PyObject *__pyx_v_string_features = NULL; + PyObject *__pyx_v_norm_feats_string = NULL; + PyObject *__pyx_8genexpr1__pyx_v_field = NULL; + PyObject *__pyx_8genexpr1__pyx_v_values = NULL; + PyObject *__pyx_v_field = NULL; + PyObject *__pyx_v_values = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *(*__pyx_t_13)(PyObject *); + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("normalize_features", 0); + __Pyx_INCREF(__pyx_v_features); + + /* "spacy/morphology.pyx":83 + * RETURNS (str): Features as normalized UFEATS string. + * """ + * if isinstance(features, str): # <<<<<<<<<<<<<< + * features = self.feats_to_dict(features) + * if not isinstance(features, dict): +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_features); + if (__pyx_t_1) { + + /* "spacy/morphology.pyx":84 + * """ + * if isinstance(features, str): + * features = self.feats_to_dict(features) # <<<<<<<<<<<<<< + * if not isinstance(features, dict): + * warnings.warn(Warnings.W100.format(feature=features)) +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_features}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_feats_to_dict, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF_SET(__pyx_v_features, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":83 + * RETURNS (str): Features as normalized UFEATS string. + * """ + * if isinstance(features, str): # <<<<<<<<<<<<<< + * features = self.feats_to_dict(features) + * if not isinstance(features, dict): +*/ + } + + /* "spacy/morphology.pyx":85 + * if isinstance(features, str): + * features = self.feats_to_dict(features) + * if not isinstance(features, dict): # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W100.format(feature=features)) + * features = {} +*/ + __pyx_t_1 = PyDict_Check(__pyx_v_features); + __pyx_t_5 = (!__pyx_t_1); + if (__pyx_t_5) { + + /* "spacy/morphology.pyx":86 + * features = self.feats_to_dict(features) + * if not isinstance(features, dict): + * warnings.warn(Warnings.W100.format(feature=features)) # <<<<<<<<<<<<<< + * features = {} + * features = self.normalize_attrs(features) +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_Warnings); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_W100); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_8 = __pyx_t_10; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_8, NULL}; + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_feature, __pyx_v_features, __pyx_t_9, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_7, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":87 + * if not isinstance(features, dict): + * warnings.warn(Warnings.W100.format(feature=features)) + * features = {} # <<<<<<<<<<<<<< + * features = self.normalize_attrs(features) + * string_features = {self.strings.as_string(field): self.strings.as_string(values) for field, values in features.items()} +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_features, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":85 + * if isinstance(features, str): + * features = self.feats_to_dict(features) + * if not isinstance(features, dict): # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W100.format(feature=features)) + * features = {} +*/ + } + + /* "spacy/morphology.pyx":88 + * warnings.warn(Warnings.W100.format(feature=features)) + * features = {} + * features = self.normalize_attrs(features) # <<<<<<<<<<<<<< + * string_features = {self.strings.as_string(field): self.strings.as_string(values) for field, values in features.items()} + * # normalized UFEATS string with sorted fields and values +*/ + __pyx_t_7 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_features}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_normalize_attrs, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF_SET(__pyx_v_features, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":89 + * features = {} + * features = self.normalize_attrs(features) + * string_features = {self.strings.as_string(field): self.strings.as_string(values) for field, values in features.items()} # <<<<<<<<<<<<<< + * # normalized UFEATS string with sorted fields and values + * norm_feats_string = self.FEATURE_SEP.join( +*/ + { /* enter inner scope */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __pyx_v_features; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_7); + } + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_6 = __pyx_t_7; __Pyx_INCREF(__pyx_t_6); + __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 89, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 89, __pyx_L7_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_6))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 89, __pyx_L7_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 89, __pyx_L7_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11)); + #else + __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L7_error) + } else { + __pyx_t_7 = __pyx_t_12(__pyx_t_6); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 89, __pyx_L7_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_7); + if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) { + PyObject* sequence = __pyx_t_7; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 89, __pyx_L7_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_10); + } else { + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L7_error) + __Pyx_XGOTREF(__pyx_t_3); + __pyx_t_10 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 89, __pyx_L7_error) + __Pyx_XGOTREF(__pyx_t_10); + } + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 89, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_9 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 89, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); + index = 0; __pyx_t_3 = __pyx_t_13(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_10 = __pyx_t_13(__pyx_t_9); if (unlikely(!__pyx_t_10)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_9), 2) < (0)) __PYX_ERR(0, 89, __pyx_L7_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L11_unpacking_done; + __pyx_L10_unpacking_failed:; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 89, __pyx_L7_error) + __pyx_L11_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_field, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_values, __pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_10); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_8genexpr1__pyx_v_field}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_as_string, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_3 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_8genexpr1__pyx_v_values}; + __pyx_t_10 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_as_string, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 89, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_10); + } + if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_t_7, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 89, __pyx_L7_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_field); __pyx_8genexpr1__pyx_v_field = 0; + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_values); __pyx_8genexpr1__pyx_v_values = 0; + goto __pyx_L13_exit_scope; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_field); __pyx_8genexpr1__pyx_v_field = 0; + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_values); __pyx_8genexpr1__pyx_v_values = 0; + goto __pyx_L1_error; + __pyx_L13_exit_scope:; + } /* exit inner scope */ + __pyx_v_string_features = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":91 + * string_features = {self.strings.as_string(field): self.strings.as_string(values) for field, values in features.items()} + * # normalized UFEATS string with sorted fields and values + * norm_feats_string = self.FEATURE_SEP.join( # <<<<<<<<<<<<<< + * sorted( + * [self.FIELD_SEP.join([field, values]) for field, values in string_features.items()] +*/ + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_FEATURE_SEP); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_6 = __pyx_t_10; + __Pyx_INCREF(__pyx_t_6); + + /* "spacy/morphology.pyx":93 + * norm_feats_string = self.FEATURE_SEP.join( + * sorted( + * [self.FIELD_SEP.join([field, values]) for field, values in string_features.items()] # <<<<<<<<<<<<<< + * ) + * ) +*/ + __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = __Pyx_PyDict_Items(__pyx_v_string_features); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_9 = __pyx_t_3; __Pyx_INCREF(__pyx_t_9); + __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 93, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_9))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_9); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 93, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_9, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_9); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 93, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_11)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error) + } else { + __pyx_t_3 = __pyx_t_12(__pyx_t_9); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 93, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_3); + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 93, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_8); + __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_14); + } else { + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_8); + __pyx_t_14 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_14); + } + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_14 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_15 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_15); + index = 0; __pyx_t_8 = __pyx_t_13(__pyx_t_15); if (unlikely(!__pyx_t_8)) goto __pyx_L16_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 1; __pyx_t_14 = __pyx_t_13(__pyx_t_15); if (unlikely(!__pyx_t_14)) goto __pyx_L16_unpacking_failed; + __Pyx_GOTREF(__pyx_t_14); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_15), 2) < (0)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + goto __pyx_L17_unpacking_done; + __pyx_L16_unpacking_failed:; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_L17_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_values, __pyx_t_14); + __pyx_t_14 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_FIELD_SEP); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_14 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_14); + __pyx_t_15 = PyList_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(__pyx_v_field); + __Pyx_GIVEREF(__pyx_v_field); + if (__Pyx_PyList_SET_ITEM(__pyx_t_15, 0, __pyx_v_field) != (0)) __PYX_ERR(0, 93, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_values); + __Pyx_GIVEREF(__pyx_v_values); + if (__Pyx_PyList_SET_ITEM(__pyx_t_15, 1, __pyx_v_values) != (0)) __PYX_ERR(0, 93, __pyx_L1_error); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_15}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_join, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_7, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "spacy/morphology.pyx":92 + * # normalized UFEATS string with sorted fields and values + * norm_feats_string = self.FEATURE_SEP.join( + * sorted( # <<<<<<<<<<<<<< + * [self.FIELD_SEP.join([field, values]) for field, values in string_features.items()] + * ) +*/ + if (unlikely((PyList_Sort(__pyx_t_7) < 0))) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_join, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v_norm_feats_string = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":96 + * ) + * ) + * return norm_feats_string or self.EMPTY_MORPH # <<<<<<<<<<<<<< + * + * def normalize_attrs(self, attrs): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_norm_feats_string); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 96, __pyx_L1_error) + if (!__pyx_t_5) { + } else { + __Pyx_INCREF(__pyx_v_norm_feats_string); + __pyx_t_2 = __pyx_v_norm_feats_string; + goto __pyx_L19_bool_binop_done; + } + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_EMPTY_MORPH); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_10); + __pyx_t_2 = __pyx_t_10; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_L19_bool_binop_done:; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/morphology.pyx":77 + * return tag.key + * + * def normalize_features(self, features): # <<<<<<<<<<<<<< + * """Create a normalized FEATS string from a features string or dict. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("spacy.morphology.Morphology.normalize_features", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_string_features); + __Pyx_XDECREF(__pyx_v_norm_feats_string); + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_field); + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_values); + __Pyx_XDECREF(__pyx_v_field); + __Pyx_XDECREF(__pyx_v_values); + __Pyx_XDECREF(__pyx_v_features); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pyx":98 + * return norm_feats_string or self.EMPTY_MORPH + * + * def normalize_attrs(self, attrs): # <<<<<<<<<<<<<< + * """Convert attrs dict so that POS is always by ID, other features are + * by string. Values separated by VALUE_SEP are sorted. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_9normalize_attrs(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_10morphology_10Morphology_8normalize_attrs, "Morphology.normalize_attrs(self, attrs)\n\nConvert attrs dict so that POS is always by ID, other features are\nby string. Values separated by VALUE_SEP are sorted."); +static PyMethodDef __pyx_mdef_5spacy_10morphology_10Morphology_9normalize_attrs = {"normalize_attrs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_9normalize_attrs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_8normalize_attrs}; +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_9normalize_attrs(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_attrs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("normalize_attrs (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_attrs,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 98, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 98, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "normalize_attrs", 0) < (0)) __PYX_ERR(0, 98, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("normalize_attrs", 1, 1, 1, i); __PYX_ERR(0, 98, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 98, __pyx_L3_error) + } + __pyx_v_attrs = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("normalize_attrs", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 98, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.morphology.Morphology.normalize_attrs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_8normalize_attrs(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), __pyx_v_attrs); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_8normalize_attrs(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_attrs) { + PyObject *__pyx_v_out = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_t_10; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("normalize_attrs", 0); + __Pyx_INCREF(__pyx_v_attrs); + + /* "spacy/morphology.pyx":102 + * by string. Values separated by VALUE_SEP are sorted. + * """ + * out = {} # <<<<<<<<<<<<<< + * attrs = dict(attrs) + * for key, value in attrs.items(): +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_out = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/morphology.pyx":103 + * """ + * out = {} + * attrs = dict(attrs) # <<<<<<<<<<<<<< + * for key, value in attrs.items(): + * # convert POS value to ID +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_attrs}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_attrs, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/morphology.pyx":104 + * out = {} + * attrs = dict(attrs) + * for key, value in attrs.items(): # <<<<<<<<<<<<<< + * # convert POS value to ID + * if key == POS or (isinstance(key, str) and key.upper() == "POS"): +*/ + __pyx_t_2 = __pyx_v_attrs; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 104, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 104, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_4; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 104, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4); + #endif + ++__pyx_t_4; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 104, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 104, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_7); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); + index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_L6_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/morphology.pyx":106 + * for key, value in attrs.items(): + * # convert POS value to ID + * if key == POS or (isinstance(key, str) and key.upper() == "POS"): # <<<<<<<<<<<<<< + * if isinstance(value, str) and value.upper() in POS_IDS: + * value = POS_IDS[value.upper()] +*/ + __pyx_t_1 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_POS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyObject_RichCompare(__pyx_v_key, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!__pyx_t_11) { + } else { + __pyx_t_10 = __pyx_t_11; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_11 = PyUnicode_Check(__pyx_v_key); + if (__pyx_t_11) { + } else { + __pyx_t_10 = __pyx_t_11; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_1 = __pyx_v_key; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_11 = (__Pyx_PyUnicode_Equals(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_POS, Py_EQ)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = __pyx_t_11; + __pyx_L8_bool_binop_done:; + if (__pyx_t_10) { + + /* "spacy/morphology.pyx":107 + * # convert POS value to ID + * if key == POS or (isinstance(key, str) and key.upper() == "POS"): + * if isinstance(value, str) and value.upper() in POS_IDS: # <<<<<<<<<<<<<< + * value = POS_IDS[value.upper()] + * elif isinstance(value, int) and value not in POS_IDS.values(): +*/ + __pyx_t_11 = PyUnicode_Check(__pyx_v_value); + if (__pyx_t_11) { + } else { + __pyx_t_10 = __pyx_t_11; + goto __pyx_L12_bool_binop_done; + } + __pyx_t_1 = __pyx_v_value; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_POS_IDS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_t_7, __pyx_t_1, Py_EQ)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_t_11; + __pyx_L12_bool_binop_done:; + if (__pyx_t_10) { + + /* "spacy/morphology.pyx":108 + * if key == POS or (isinstance(key, str) and key.upper() == "POS"): + * if isinstance(value, str) and value.upper() in POS_IDS: + * value = POS_IDS[value.upper()] # <<<<<<<<<<<<<< + * elif isinstance(value, int) and value not in POS_IDS.values(): + * warnings.warn(Warnings.W100.format(feature={key: value})) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_POS_IDS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __pyx_v_value; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/morphology.pyx":107 + * # convert POS value to ID + * if key == POS or (isinstance(key, str) and key.upper() == "POS"): + * if isinstance(value, str) and value.upper() in POS_IDS: # <<<<<<<<<<<<<< + * value = POS_IDS[value.upper()] + * elif isinstance(value, int) and value not in POS_IDS.values(): +*/ + goto __pyx_L11; + } + + /* "spacy/morphology.pyx":109 + * if isinstance(value, str) and value.upper() in POS_IDS: + * value = POS_IDS[value.upper()] + * elif isinstance(value, int) and value not in POS_IDS.values(): # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W100.format(feature={key: value})) + * continue +*/ + __pyx_t_11 = PyLong_Check(__pyx_v_value); + if (__pyx_t_11) { + } else { + __pyx_t_10 = __pyx_t_11; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_7 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_POS_IDS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_values); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + assert(__pyx_t_7); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_v_value, __pyx_t_6, Py_NE)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_10 = __pyx_t_11; + __pyx_L14_bool_binop_done:; + if (__pyx_t_10) { + + /* "spacy/morphology.pyx":110 + * value = POS_IDS[value.upper()] + * elif isinstance(value, int) and value not in POS_IDS.values(): + * warnings.warn(Warnings.W100.format(feature={key: value})) # <<<<<<<<<<<<<< + * continue + * out[POS] = value +*/ + __pyx_t_8 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_Warnings); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_W100); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_12 = __pyx_t_14; + __Pyx_INCREF(__pyx_t_12); + __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (PyDict_SetItem(__pyx_t_13, __pyx_v_key, __pyx_v_value) < (0)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_12, NULL}; + __pyx_t_15 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_feature, __pyx_t_13, __pyx_t_15, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_15); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_8); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_7}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/morphology.pyx":111 + * elif isinstance(value, int) and value not in POS_IDS.values(): + * warnings.warn(Warnings.W100.format(feature={key: value})) + * continue # <<<<<<<<<<<<<< + * out[POS] = value + * # accept any string or ID fields and values and convert to strings +*/ + goto __pyx_L3_continue; + + /* "spacy/morphology.pyx":109 + * if isinstance(value, str) and value.upper() in POS_IDS: + * value = POS_IDS[value.upper()] + * elif isinstance(value, int) and value not in POS_IDS.values(): # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W100.format(feature={key: value})) + * continue +*/ + } + __pyx_L11:; + + /* "spacy/morphology.pyx":112 + * warnings.warn(Warnings.W100.format(feature={key: value})) + * continue + * out[POS] = value # <<<<<<<<<<<<<< + * # accept any string or ID fields and values and convert to strings + * elif isinstance(key, (int, str)) and isinstance(value, (int, str)): +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_POS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely((PyDict_SetItem(__pyx_v_out, __pyx_t_6, __pyx_v_value) < 0))) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/morphology.pyx":106 + * for key, value in attrs.items(): + * # convert POS value to ID + * if key == POS or (isinstance(key, str) and key.upper() == "POS"): # <<<<<<<<<<<<<< + * if isinstance(value, str) and value.upper() in POS_IDS: + * value = POS_IDS[value.upper()] +*/ + goto __pyx_L7; + } + + /* "spacy/morphology.pyx":114 + * out[POS] = value + * # accept any string or ID fields and values and convert to strings + * elif isinstance(key, (int, str)) and isinstance(value, (int, str)): # <<<<<<<<<<<<<< + * key = self.strings.as_string(key) + * value = self.strings.as_string(value) +*/ + __pyx_t_16 = PyLong_Check(__pyx_v_key); + if (!__pyx_t_16) { + } else { + __pyx_t_11 = __pyx_t_16; + goto __pyx_L18_bool_binop_done; + } + __pyx_t_16 = PyUnicode_Check(__pyx_v_key); + __pyx_t_11 = __pyx_t_16; + __pyx_L18_bool_binop_done:; + if (__pyx_t_11) { + } else { + __pyx_t_10 = __pyx_t_11; + goto __pyx_L16_bool_binop_done; + } + __pyx_t_16 = PyLong_Check(__pyx_v_value); + if (!__pyx_t_16) { + } else { + __pyx_t_11 = __pyx_t_16; + goto __pyx_L20_bool_binop_done; + } + __pyx_t_16 = PyUnicode_Check(__pyx_v_value); + __pyx_t_11 = __pyx_t_16; + __pyx_L20_bool_binop_done:; + __pyx_t_10 = __pyx_t_11; + __pyx_L16_bool_binop_done:; + if (__pyx_t_10) { + + /* "spacy/morphology.pyx":115 + * # accept any string or ID fields and values and convert to strings + * elif isinstance(key, (int, str)) and isinstance(value, (int, str)): + * key = self.strings.as_string(key) # <<<<<<<<<<<<<< + * value = self.strings.as_string(value) + * # sort values +*/ + __pyx_t_1 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_key}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_as_string, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/morphology.pyx":116 + * elif isinstance(key, (int, str)) and isinstance(value, (int, str)): + * key = self.strings.as_string(key) + * value = self.strings.as_string(value) # <<<<<<<<<<<<<< + * # sort values + * if self.VALUE_SEP in value: +*/ + __pyx_t_1 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_value}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_as_string, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/morphology.pyx":118 + * value = self.strings.as_string(value) + * # sort values + * if self.VALUE_SEP in value: # <<<<<<<<<<<<<< + * value = self.VALUE_SEP.join(sorted(value.split(self.VALUE_SEP))) + * out[key] = value +*/ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_VALUE_SEP); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_t_6, __pyx_v_value, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_10) { + + /* "spacy/morphology.pyx":119 + * # sort values + * if self.VALUE_SEP in value: + * value = self.VALUE_SEP.join(sorted(value.split(self.VALUE_SEP))) # <<<<<<<<<<<<<< + * out[key] = value + * else: +*/ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_VALUE_SEP); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_14 = __pyx_v_value; + __Pyx_INCREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_VALUE_SEP); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_15}; + __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_split, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + } + __pyx_t_15 = PySequence_List(__pyx_t_8); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely((PyList_Sort(__pyx_t_15) < 0))) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_15}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_join, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/morphology.pyx":118 + * value = self.strings.as_string(value) + * # sort values + * if self.VALUE_SEP in value: # <<<<<<<<<<<<<< + * value = self.VALUE_SEP.join(sorted(value.split(self.VALUE_SEP))) + * out[key] = value +*/ + } + + /* "spacy/morphology.pyx":120 + * if self.VALUE_SEP in value: + * value = self.VALUE_SEP.join(sorted(value.split(self.VALUE_SEP))) + * out[key] = value # <<<<<<<<<<<<<< + * else: + * warnings.warn(Warnings.W100.format(feature={key: value})) +*/ + if (unlikely((PyDict_SetItem(__pyx_v_out, __pyx_v_key, __pyx_v_value) < 0))) __PYX_ERR(0, 120, __pyx_L1_error) + + /* "spacy/morphology.pyx":114 + * out[POS] = value + * # accept any string or ID fields and values and convert to strings + * elif isinstance(key, (int, str)) and isinstance(value, (int, str)): # <<<<<<<<<<<<<< + * key = self.strings.as_string(key) + * value = self.strings.as_string(value) +*/ + goto __pyx_L7; + } + + /* "spacy/morphology.pyx":122 + * out[key] = value + * else: + * warnings.warn(Warnings.W100.format(feature={key: value})) # <<<<<<<<<<<<<< + * return out + * +*/ + /*else*/ { + __pyx_t_7 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_Warnings); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_W100); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_8 = __pyx_t_13; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (PyDict_SetItem(__pyx_t_14, __pyx_v_key, __pyx_v_value) < (0)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_8, NULL}; + __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_feature, __pyx_t_14, __pyx_t_12, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_15 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_12); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + } + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_7); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_15}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_L7:; + + /* "spacy/morphology.pyx":104 + * out = {} + * attrs = dict(attrs) + * for key, value in attrs.items(): # <<<<<<<<<<<<<< + * # convert POS value to ID + * if key == POS or (isinstance(key, str) and key.upper() == "POS"): +*/ + __pyx_L3_continue:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":123 + * else: + * warnings.warn(Warnings.W100.format(feature={key: value})) + * return out # <<<<<<<<<<<<<< + * + * cdef MorphAnalysisC create_morph_tag(self, field_feature_pairs) except *: +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_out); + __pyx_r = __pyx_v_out; + goto __pyx_L0; + + /* "spacy/morphology.pyx":98 + * return norm_feats_string or self.EMPTY_MORPH + * + * def normalize_attrs(self, attrs): # <<<<<<<<<<<<<< + * """Convert attrs dict so that POS is always by ID, other features are + * by string. Values separated by VALUE_SEP are sorted. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("spacy.morphology.Morphology.normalize_attrs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_out); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_attrs); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pyx":125 + * return out + * + * cdef MorphAnalysisC create_morph_tag(self, field_feature_pairs) except *: # <<<<<<<<<<<<<< + * """Creates a MorphAnalysisC from a list of intified + * ("Field", "Field=Value") tuples where fields with multiple values have +*/ + +static struct __pyx_t_5spacy_7structs_MorphAnalysisC __pyx_f_5spacy_10morphology_10Morphology_create_morph_tag(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, PyObject *__pyx_v_field_feature_pairs) { + struct __pyx_t_5spacy_7structs_MorphAnalysisC __pyx_v_tag; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_field = NULL; + PyObject *__pyx_v_feature = NULL; + struct __pyx_t_5spacy_7structs_MorphAnalysisC __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + void *__pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *(*__pyx_t_11)(PyObject *); + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_morph_tag", 0); + + /* "spacy/morphology.pyx":133 + * """ + * cdef MorphAnalysisC tag + * tag.length = len(field_feature_pairs) # <<<<<<<<<<<<<< + * if tag.length > 0: + * tag.fields = self.mem.alloc(tag.length, sizeof(attr_t)) +*/ + __pyx_t_1 = PyObject_Length(__pyx_v_field_feature_pairs); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_v_tag.length = __pyx_t_1; + + /* "spacy/morphology.pyx":134 + * cdef MorphAnalysisC tag + * tag.length = len(field_feature_pairs) + * if tag.length > 0: # <<<<<<<<<<<<<< + * tag.fields = self.mem.alloc(tag.length, sizeof(attr_t)) + * tag.features = self.mem.alloc(tag.length, sizeof(attr_t)) +*/ + __pyx_t_2 = (__pyx_v_tag.length > 0); + if (__pyx_t_2) { + + /* "spacy/morphology.pyx":135 + * tag.length = len(field_feature_pairs) + * if tag.length > 0: + * tag.fields = self.mem.alloc(tag.length, sizeof(attr_t)) # <<<<<<<<<<<<<< + * tag.features = self.mem.alloc(tag.length, sizeof(attr_t)) + * for i, (field, feature) in enumerate(field_feature_pairs): +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->alloc(__pyx_v_self->mem, __pyx_v_tag.length, (sizeof(__pyx_t_5spacy_8typedefs_attr_t))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 135, __pyx_L1_error) + __pyx_v_tag.fields = ((__pyx_t_5spacy_8typedefs_attr_t *)__pyx_t_3); + + /* "spacy/morphology.pyx":136 + * if tag.length > 0: + * tag.fields = self.mem.alloc(tag.length, sizeof(attr_t)) + * tag.features = self.mem.alloc(tag.length, sizeof(attr_t)) # <<<<<<<<<<<<<< + * for i, (field, feature) in enumerate(field_feature_pairs): + * tag.fields[i] = field +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->alloc(__pyx_v_self->mem, __pyx_v_tag.length, (sizeof(__pyx_t_5spacy_8typedefs_attr_t))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_v_tag.features = ((__pyx_t_5spacy_8typedefs_attr_t *)__pyx_t_3); + + /* "spacy/morphology.pyx":134 + * cdef MorphAnalysisC tag + * tag.length = len(field_feature_pairs) + * if tag.length > 0: # <<<<<<<<<<<<<< + * tag.fields = self.mem.alloc(tag.length, sizeof(attr_t)) + * tag.features = self.mem.alloc(tag.length, sizeof(attr_t)) +*/ + } + + /* "spacy/morphology.pyx":137 + * tag.fields = self.mem.alloc(tag.length, sizeof(attr_t)) + * tag.features = self.mem.alloc(tag.length, sizeof(attr_t)) + * for i, (field, feature) in enumerate(field_feature_pairs): # <<<<<<<<<<<<<< + * tag.fields[i] = field + * tag.features[i] = feature +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_4 = __pyx_mstate_global->__pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_field_feature_pairs)) || PyTuple_CheckExact(__pyx_v_field_feature_pairs)) { + __pyx_t_5 = __pyx_v_field_feature_pairs; __Pyx_INCREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_field_feature_pairs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 137, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 137, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_1; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 137, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1)); + #else + __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_1); + #endif + ++__pyx_t_1; + } + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 137, __pyx_L1_error) + } else { + __pyx_t_7 = __pyx_t_6(__pyx_t_5); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 137, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_7); + if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) { + PyObject* sequence = __pyx_t_7; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 137, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_8); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_9); + } else { + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_9); + } + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + #endif + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); + index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_11 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_L7_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_feature, __pyx_t_9); + __pyx_t_9 = 0; + __Pyx_INCREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); + __pyx_t_7 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); + __pyx_t_4 = __pyx_t_7; + __pyx_t_7 = 0; + + /* "spacy/morphology.pyx":138 + * tag.features = self.mem.alloc(tag.length, sizeof(attr_t)) + * for i, (field, feature) in enumerate(field_feature_pairs): + * tag.fields[i] = field # <<<<<<<<<<<<<< + * tag.features[i] = feature + * return tag +*/ + __pyx_t_12 = __Pyx_PyLong_As_uint64_t(__pyx_v_field); if (unlikely((__pyx_t_12 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error) + (__pyx_v_tag.fields[__pyx_t_13]) = __pyx_t_12; + + /* "spacy/morphology.pyx":139 + * for i, (field, feature) in enumerate(field_feature_pairs): + * tag.fields[i] = field + * tag.features[i] = feature # <<<<<<<<<<<<<< + * return tag + * +*/ + __pyx_t_12 = __Pyx_PyLong_As_uint64_t(__pyx_v_feature); if (unlikely((__pyx_t_12 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error) + (__pyx_v_tag.features[__pyx_t_13]) = __pyx_t_12; + + /* "spacy/morphology.pyx":137 + * tag.fields = self.mem.alloc(tag.length, sizeof(attr_t)) + * tag.features = self.mem.alloc(tag.length, sizeof(attr_t)) + * for i, (field, feature) in enumerate(field_feature_pairs): # <<<<<<<<<<<<<< + * tag.fields[i] = field + * tag.features[i] = feature +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/morphology.pyx":140 + * tag.fields[i] = field + * tag.features[i] = feature + * return tag # <<<<<<<<<<<<<< + * + * cdef int insert(self, MorphAnalysisC tag) except -1: +*/ + __pyx_r = __pyx_v_tag; + goto __pyx_L0; + + /* "spacy/morphology.pyx":125 + * return out + * + * cdef MorphAnalysisC create_morph_tag(self, field_feature_pairs) except *: # <<<<<<<<<<<<<< + * """Creates a MorphAnalysisC from a list of intified + * ("Field", "Field=Value") tuples where fields with multiple values have +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("spacy.morphology.Morphology.create_morph_tag", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_field); + __Pyx_XDECREF(__pyx_v_feature); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pyx":142 + * return tag + * + * cdef int insert(self, MorphAnalysisC tag) except -1: # <<<<<<<<<<<<<< + * cdef hash_t key = tag.key + * if self.tags.get(key) == NULL: +*/ + +static int __pyx_f_5spacy_10morphology_10Morphology_insert(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, struct __pyx_t_5spacy_7structs_MorphAnalysisC __pyx_v_tag) { + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key; + struct __pyx_t_5spacy_7structs_MorphAnalysisC *__pyx_v_tag_ptr; + int __pyx_r; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_1; + void *__pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "spacy/morphology.pyx":143 + * + * cdef int insert(self, MorphAnalysisC tag) except -1: + * cdef hash_t key = tag.key # <<<<<<<<<<<<<< + * if self.tags.get(key) == NULL: + * tag_ptr = self.mem.alloc(1, sizeof(MorphAnalysisC)) +*/ + __pyx_t_1 = __pyx_v_tag.key; + __pyx_v_key = __pyx_t_1; + + /* "spacy/morphology.pyx":144 + * cdef int insert(self, MorphAnalysisC tag) except -1: + * cdef hash_t key = tag.key + * if self.tags.get(key) == NULL: # <<<<<<<<<<<<<< + * tag_ptr = self.mem.alloc(1, sizeof(MorphAnalysisC)) + * tag_ptr[0] = tag +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->tags->__pyx_vtab)->get(__pyx_v_self->tags, __pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_3 = (__pyx_t_2 == NULL); + if (__pyx_t_3) { + + /* "spacy/morphology.pyx":145 + * cdef hash_t key = tag.key + * if self.tags.get(key) == NULL: + * tag_ptr = self.mem.alloc(1, sizeof(MorphAnalysisC)) # <<<<<<<<<<<<<< + * tag_ptr[0] = tag + * self.tags.set(key, tag_ptr) +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->alloc(__pyx_v_self->mem, 1, (sizeof(struct __pyx_t_5spacy_7structs_MorphAnalysisC))); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_v_tag_ptr = ((struct __pyx_t_5spacy_7structs_MorphAnalysisC *)__pyx_t_2); + + /* "spacy/morphology.pyx":146 + * if self.tags.get(key) == NULL: + * tag_ptr = self.mem.alloc(1, sizeof(MorphAnalysisC)) + * tag_ptr[0] = tag # <<<<<<<<<<<<<< + * self.tags.set(key, tag_ptr) + * +*/ + (__pyx_v_tag_ptr[0]) = __pyx_v_tag; + + /* "spacy/morphology.pyx":147 + * tag_ptr = self.mem.alloc(1, sizeof(MorphAnalysisC)) + * tag_ptr[0] = tag + * self.tags.set(key, tag_ptr) # <<<<<<<<<<<<<< + * + * def get(self, hash_t morph): +*/ + ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->tags->__pyx_vtab)->set(__pyx_v_self->tags, __pyx_v_key, ((void *)__pyx_v_tag_ptr)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L1_error) + + /* "spacy/morphology.pyx":144 + * cdef int insert(self, MorphAnalysisC tag) except -1: + * cdef hash_t key = tag.key + * if self.tags.get(key) == NULL: # <<<<<<<<<<<<<< + * tag_ptr = self.mem.alloc(1, sizeof(MorphAnalysisC)) + * tag_ptr[0] = tag +*/ + } + + /* "spacy/morphology.pyx":142 + * return tag + * + * cdef int insert(self, MorphAnalysisC tag) except -1: # <<<<<<<<<<<<<< + * cdef hash_t key = tag.key + * if self.tags.get(key) == NULL: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.morphology.Morphology.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/morphology.pyx":149 + * self.tags.set(key, tag_ptr) + * + * def get(self, hash_t morph): # <<<<<<<<<<<<<< + * tag = self.tags.get(morph) + * if tag == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_11get(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_10morphology_10Morphology_10get, "Morphology.get(self, hash_t morph)"); +static PyMethodDef __pyx_mdef_5spacy_10morphology_10Morphology_11get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_11get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_10get}; +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_11get(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_morph; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_morph,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 149, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 149, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get", 0) < (0)) __PYX_ERR(0, 149, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 1, 1, 1, i); __PYX_ERR(0, 149, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 149, __pyx_L3_error) + } + __pyx_v_morph = __Pyx_PyLong_As_uint64_t(values[0]); if (unlikely((__pyx_v_morph == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 149, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 149, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.morphology.Morphology.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_10get(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self), __pyx_v_morph); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_10get(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self, __pyx_t_5spacy_8typedefs_hash_t __pyx_v_morph) { + struct __pyx_t_5spacy_7structs_MorphAnalysisC *__pyx_v_tag; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + void *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get", 0); + + /* "spacy/morphology.pyx":150 + * + * def get(self, hash_t morph): + * tag = self.tags.get(morph) # <<<<<<<<<<<<<< + * if tag == NULL: + * return "" +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->tags->__pyx_vtab)->get(__pyx_v_self->tags, __pyx_v_morph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_v_tag = ((struct __pyx_t_5spacy_7structs_MorphAnalysisC *)__pyx_t_1); + + /* "spacy/morphology.pyx":151 + * def get(self, hash_t morph): + * tag = self.tags.get(morph) + * if tag == NULL: # <<<<<<<<<<<<<< + * return "" + * else: +*/ + __pyx_t_2 = (__pyx_v_tag == NULL); + if (__pyx_t_2) { + + /* "spacy/morphology.pyx":152 + * tag = self.tags.get(morph) + * if tag == NULL: + * return "" # <<<<<<<<<<<<<< + * else: + * return self.strings[tag.key] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_); + __pyx_r = __pyx_mstate_global->__pyx_kp_u_; + goto __pyx_L0; + + /* "spacy/morphology.pyx":151 + * def get(self, hash_t morph): + * tag = self.tags.get(morph) + * if tag == NULL: # <<<<<<<<<<<<<< + * return "" + * else: +*/ + } + + /* "spacy/morphology.pyx":154 + * return "" + * else: + * return self.strings[tag.key] # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->strings), __pyx_v_tag->key, __pyx_t_5spacy_8typedefs_hash_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + + /* "spacy/morphology.pyx":149 + * self.tags.set(key, tag_ptr) + * + * def get(self, hash_t morph): # <<<<<<<<<<<<<< + * tag = self.tags.get(morph) + * if tag == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.morphology.Morphology.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pyx":156 + * return self.strings[tag.key] + * + * @staticmethod # <<<<<<<<<<<<<< + * def feats_to_dict(feats): + * if not feats or feats == Morphology.EMPTY_MORPH: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_13feats_to_dict(CYTHON_UNUSED PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_10morphology_10Morphology_12feats_to_dict, "Morphology.feats_to_dict(feats)"); +static PyMethodDef __pyx_mdef_5spacy_10morphology_10Morphology_13feats_to_dict = {"feats_to_dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_13feats_to_dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_12feats_to_dict}; +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_13feats_to_dict(CYTHON_UNUSED PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_feats = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("feats_to_dict (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_feats,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 156, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 156, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "feats_to_dict", 0) < (0)) __PYX_ERR(0, 156, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("feats_to_dict", 1, 1, 1, i); __PYX_ERR(0, 156, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 156, __pyx_L3_error) + } + __pyx_v_feats = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("feats_to_dict", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 156, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.morphology.Morphology.feats_to_dict", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_12feats_to_dict(__pyx_v_feats); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_12feats_to_dict(PyObject *__pyx_v_feats) { + PyObject *__pyx_8genexpr2__pyx_v_field = NULL; + PyObject *__pyx_8genexpr2__pyx_v_values = NULL; + PyObject *__pyx_v_feat = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + PyObject *__pyx_t_12 = NULL; + PyObject *(*__pyx_t_13)(PyObject *); + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("feats_to_dict", 0); + + /* "spacy/morphology.pyx":158 + * @staticmethod + * def feats_to_dict(feats): + * if not feats or feats == Morphology.EMPTY_MORPH: # <<<<<<<<<<<<<< + * return {} + * return {field: Morphology.VALUE_SEP.join(sorted(values.split(Morphology.VALUE_SEP))) for field, values in +*/ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_feats); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_3 = (!__pyx_t_2); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology), __pyx_mstate_global->__pyx_n_u_EMPTY_MORPH); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_feats, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/morphology.pyx":159 + * def feats_to_dict(feats): + * if not feats or feats == Morphology.EMPTY_MORPH: + * return {} # <<<<<<<<<<<<<< + * return {field: Morphology.VALUE_SEP.join(sorted(values.split(Morphology.VALUE_SEP))) for field, values in + * [feat.split(Morphology.FIELD_SEP) for feat in feats.split(Morphology.FEATURE_SEP)]} +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "spacy/morphology.pyx":158 + * @staticmethod + * def feats_to_dict(feats): + * if not feats or feats == Morphology.EMPTY_MORPH: # <<<<<<<<<<<<<< + * return {} + * return {field: Morphology.VALUE_SEP.join(sorted(values.split(Morphology.VALUE_SEP))) for field, values in +*/ + } + + /* "spacy/morphology.pyx":160 + * if not feats or feats == Morphology.EMPTY_MORPH: + * return {} + * return {field: Morphology.VALUE_SEP.join(sorted(values.split(Morphology.VALUE_SEP))) for field, values in # <<<<<<<<<<<<<< + * [feat.split(Morphology.FIELD_SEP) for feat in feats.split(Morphology.FEATURE_SEP)]} + * +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_5); + + /* "spacy/morphology.pyx":161 + * return {} + * return {field: Morphology.VALUE_SEP.join(sorted(values.split(Morphology.VALUE_SEP))) for field, values in + * [feat.split(Morphology.FIELD_SEP) for feat in feats.split(Morphology.FEATURE_SEP)]} # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __pyx_v_feats; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology), __pyx_mstate_global->__pyx_n_u_FEATURE_SEP); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 161, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_split, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 161, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_6); + } + if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_8 = __pyx_t_6; __Pyx_INCREF(__pyx_t_8); + __pyx_t_10 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 161, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 161, __pyx_L8_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 161, __pyx_L8_error) + #endif + if (__pyx_t_10 >= __pyx_temp) break; + } + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_8, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_10; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 161, __pyx_L8_error) + #endif + if (__pyx_t_10 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_10)); + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_10); + #endif + ++__pyx_t_10; + } + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 161, __pyx_L8_error) + } else { + __pyx_t_6 = __pyx_t_11(__pyx_t_8); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 161, __pyx_L8_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_feat, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_7 = __pyx_v_feat; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology), __pyx_mstate_global->__pyx_n_u_FIELD_SEP); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 161, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_12}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_split, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 161, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_6); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 161, __pyx_L8_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __pyx_t_4; __Pyx_INCREF(__pyx_t_8); + __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 161, __pyx_L8_error) + #endif + if (__pyx_t_10 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_8, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_10; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_4); + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 160, __pyx_L8_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 160, __pyx_L8_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 160, __pyx_L8_error) + __Pyx_XGOTREF(__pyx_t_12); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 160, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_12 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 160, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_12); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 160, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); + index = 0; __pyx_t_6 = __pyx_t_13(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L14_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_12 = __pyx_t_13(__pyx_t_7); if (unlikely(!__pyx_t_12)) goto __pyx_L14_unpacking_failed; + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 160, __pyx_L8_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L15_unpacking_done; + __pyx_L14_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 160, __pyx_L8_error) + __pyx_L15_unpacking_done:; + } + + /* "spacy/morphology.pyx":160 + * if not feats or feats == Morphology.EMPTY_MORPH: + * return {} + * return {field: Morphology.VALUE_SEP.join(sorted(values.split(Morphology.VALUE_SEP))) for field, values in # <<<<<<<<<<<<<< + * [feat.split(Morphology.FIELD_SEP) for feat in feats.split(Morphology.FEATURE_SEP)]} + * +*/ + __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_field, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_values, __pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology), __pyx_mstate_global->__pyx_n_u_VALUE_SEP); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 160, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_12 = __pyx_t_6; + __Pyx_INCREF(__pyx_t_12); + __pyx_t_14 = __pyx_8genexpr2__pyx_v_values; + __Pyx_INCREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology), __pyx_mstate_global->__pyx_n_u_VALUE_SEP); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_15}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_split, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 160, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_15 = PySequence_List(__pyx_t_7); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely((PyList_Sort(__pyx_t_15) < 0))) __PYX_ERR(0, 160, __pyx_L8_error) + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_15}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_join, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L8_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (unlikely(PyDict_SetItem(__pyx_t_5, (PyObject*)__pyx_8genexpr2__pyx_v_field, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 160, __pyx_L8_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_field); __pyx_8genexpr2__pyx_v_field = 0; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_values); __pyx_8genexpr2__pyx_v_values = 0; + goto __pyx_L17_exit_scope; + __pyx_L8_error:; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_field); __pyx_8genexpr2__pyx_v_field = 0; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_values); __pyx_8genexpr2__pyx_v_values = 0; + goto __pyx_L1_error; + __pyx_L17_exit_scope:; + } /* exit inner scope */ + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "spacy/morphology.pyx":156 + * return self.strings[tag.key] + * + * @staticmethod # <<<<<<<<<<<<<< + * def feats_to_dict(feats): + * if not feats or feats == Morphology.EMPTY_MORPH: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("spacy.morphology.Morphology.feats_to_dict", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_field); + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_values); + __Pyx_XDECREF(__pyx_v_feat); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pyx":163 + * [feat.split(Morphology.FIELD_SEP) for feat in feats.split(Morphology.FEATURE_SEP)]} + * + * @staticmethod # <<<<<<<<<<<<<< + * def dict_to_feats(feats_dict): + * if len(feats_dict) == 0: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_15dict_to_feats(CYTHON_UNUSED PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_10morphology_10Morphology_14dict_to_feats, "Morphology.dict_to_feats(feats_dict)"); +static PyMethodDef __pyx_mdef_5spacy_10morphology_10Morphology_15dict_to_feats = {"dict_to_feats", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_15dict_to_feats, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_14dict_to_feats}; +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_15dict_to_feats(CYTHON_UNUSED PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_feats_dict = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dict_to_feats (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_feats_dict,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 163, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 163, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "dict_to_feats", 0) < (0)) __PYX_ERR(0, 163, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("dict_to_feats", 1, 1, 1, i); __PYX_ERR(0, 163, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 163, __pyx_L3_error) + } + __pyx_v_feats_dict = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dict_to_feats", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 163, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.morphology.Morphology.dict_to_feats", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_14dict_to_feats(__pyx_v_feats_dict); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_14dict_to_feats(PyObject *__pyx_v_feats_dict) { + PyObject *__pyx_v_field = NULL; + PyObject *__pyx_v_values = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *(*__pyx_t_14)(PyObject *); + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dict_to_feats", 0); + + /* "spacy/morphology.pyx":165 + * @staticmethod + * def dict_to_feats(feats_dict): + * if len(feats_dict) == 0: # <<<<<<<<<<<<<< + * return "" + * return Morphology.FEATURE_SEP.join(sorted([Morphology.FIELD_SEP.join([field, Morphology.VALUE_SEP.join(sorted(values.split(Morphology.VALUE_SEP)))]) for field, values in feats_dict.items()])) +*/ + __pyx_t_1 = PyObject_Length(__pyx_v_feats_dict); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_1 == 0); + if (__pyx_t_2) { + + /* "spacy/morphology.pyx":166 + * def dict_to_feats(feats_dict): + * if len(feats_dict) == 0: + * return "" # <<<<<<<<<<<<<< + * return Morphology.FEATURE_SEP.join(sorted([Morphology.FIELD_SEP.join([field, Morphology.VALUE_SEP.join(sorted(values.split(Morphology.VALUE_SEP)))]) for field, values in feats_dict.items()])) + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_); + __pyx_r = __pyx_mstate_global->__pyx_kp_u_; + goto __pyx_L0; + + /* "spacy/morphology.pyx":165 + * @staticmethod + * def dict_to_feats(feats_dict): + * if len(feats_dict) == 0: # <<<<<<<<<<<<<< + * return "" + * return Morphology.FEATURE_SEP.join(sorted([Morphology.FIELD_SEP.join([field, Morphology.VALUE_SEP.join(sorted(values.split(Morphology.VALUE_SEP)))]) for field, values in feats_dict.items()])) +*/ + } + + /* "spacy/morphology.pyx":167 + * if len(feats_dict) == 0: + * return "" + * return Morphology.FEATURE_SEP.join(sorted([Morphology.FIELD_SEP.join([field, Morphology.VALUE_SEP.join(sorted(values.split(Morphology.VALUE_SEP)))]) for field, values in feats_dict.items()])) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology), __pyx_mstate_global->__pyx_n_u_FEATURE_SEP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __pyx_t_5; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __pyx_v_feats_dict; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); + __pyx_t_1 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 167, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 167, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_8, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_1; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 167, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_1)); + #else + __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_1); + #endif + ++__pyx_t_1; + } + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 167, __pyx_L1_error) + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 167, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_7); + if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) { + PyObject* sequence = __pyx_t_7; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 167, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_12); + } + #else + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + #endif + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_13 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13); + index = 0; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + index = 1; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < (0)) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_14 = NULL; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_14 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_L7_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_11); + __pyx_t_11 = 0; + __Pyx_XDECREF_SET(__pyx_v_values, __pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology), __pyx_mstate_global->__pyx_n_u_FIELD_SEP); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __pyx_t_11; + __Pyx_INCREF(__pyx_t_12); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology), __pyx_mstate_global->__pyx_n_u_VALUE_SEP); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_15 = __pyx_t_16; + __Pyx_INCREF(__pyx_t_15); + __pyx_t_18 = __pyx_v_values; + __Pyx_INCREF(__pyx_t_18); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology), __pyx_mstate_global->__pyx_n_u_VALUE_SEP); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_18, __pyx_t_19}; + __pyx_t_17 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_split, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + } + __pyx_t_19 = PySequence_List(__pyx_t_17); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (unlikely((PyList_Sort(__pyx_t_19) < 0))) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_19}; + __pyx_t_13 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_join, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + } + __pyx_t_16 = PyList_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_INCREF(__pyx_v_field); + __Pyx_GIVEREF(__pyx_v_field); + if (__Pyx_PyList_SET_ITEM(__pyx_t_16, 0, __pyx_v_field) != (0)) __PYX_ERR(0, 167, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_13); + if (__Pyx_PyList_SET_ITEM(__pyx_t_16, 1, __pyx_t_13) != (0)) __PYX_ERR(0, 167, __pyx_L1_error); + __pyx_t_13 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_16}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_join, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely((PyList_Sort(__pyx_t_6) < 0))) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_join, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/morphology.pyx":163 + * [feat.split(Morphology.FIELD_SEP) for feat in feats.split(Morphology.FEATURE_SEP)]} + * + * @staticmethod # <<<<<<<<<<<<<< + * def dict_to_feats(feats_dict): + * if len(feats_dict) == 0: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_AddTraceback("spacy.morphology.Morphology.dict_to_feats", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_field); + __Pyx_XDECREF(__pyx_v_values); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pxd":12 + * + * cdef class Morphology: + * cdef readonly Pool mem # <<<<<<<<<<<<<< + * cdef readonly StringStore strings + * cdef PreshMap tags # Keyed by hash, value is pointer to tag +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_3mem_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_3mem_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_3mem___get__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_3mem___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self->mem); + __pyx_r = ((PyObject *)__pyx_v_self->mem); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pxd":13 + * cdef class Morphology: + * cdef readonly Pool mem + * cdef readonly StringStore strings # <<<<<<<<<<<<<< + * cdef PreshMap tags # Keyed by hash, value is pointer to tag + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_7strings_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_10morphology_10Morphology_7strings_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_10morphology_10Morphology_7strings___get__(((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_10morphology_10Morphology_7strings___get__(struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self->strings); + __pyx_r = ((PyObject *)__pyx_v_self->strings); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pyx":170 + * + * + * cdef int check_feature(const MorphAnalysisC* morph, attr_t feature) nogil: # <<<<<<<<<<<<<< + * cdef int i + * for i in range(morph.length): +*/ + +static int __pyx_f_5spacy_10morphology_check_feature(struct __pyx_t_5spacy_7structs_MorphAnalysisC const *__pyx_v_morph, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_feature) { + int __pyx_v_i; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "spacy/morphology.pyx":172 + * cdef int check_feature(const MorphAnalysisC* morph, attr_t feature) nogil: + * cdef int i + * for i in range(morph.length): # <<<<<<<<<<<<<< + * if morph.features[i] == feature: + * return True +*/ + __pyx_t_1 = __pyx_v_morph->length; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "spacy/morphology.pyx":173 + * cdef int i + * for i in range(morph.length): + * if morph.features[i] == feature: # <<<<<<<<<<<<<< + * return True + * return False +*/ + __pyx_t_4 = ((__pyx_v_morph->features[__pyx_v_i]) == __pyx_v_feature); + if (__pyx_t_4) { + + /* "spacy/morphology.pyx":174 + * for i in range(morph.length): + * if morph.features[i] == feature: + * return True # <<<<<<<<<<<<<< + * return False + * +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/morphology.pyx":173 + * cdef int i + * for i in range(morph.length): + * if morph.features[i] == feature: # <<<<<<<<<<<<<< + * return True + * return False +*/ + } + } + + /* "spacy/morphology.pyx":175 + * if morph.features[i] == feature: + * return True + * return False # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/morphology.pyx":170 + * + * + * cdef int check_feature(const MorphAnalysisC* morph, attr_t feature) nogil: # <<<<<<<<<<<<<< + * cdef int i + * for i in range(morph.length): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/morphology.pyx":178 + * + * + * cdef list list_features(const MorphAnalysisC* morph): # <<<<<<<<<<<<<< + * cdef int i + * features = [] +*/ + +static PyObject *__pyx_f_5spacy_10morphology_list_features(struct __pyx_t_5spacy_7structs_MorphAnalysisC const *__pyx_v_morph) { + int __pyx_v_i; + PyObject *__pyx_v_features = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("list_features", 0); + + /* "spacy/morphology.pyx":180 + * cdef list list_features(const MorphAnalysisC* morph): + * cdef int i + * features = [] # <<<<<<<<<<<<<< + * for i in range(morph.length): + * features.append(morph.features[i]) +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_features = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/morphology.pyx":181 + * cdef int i + * features = [] + * for i in range(morph.length): # <<<<<<<<<<<<<< + * features.append(morph.features[i]) + * return features +*/ + __pyx_t_2 = __pyx_v_morph->length; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "spacy/morphology.pyx":182 + * features = [] + * for i in range(morph.length): + * features.append(morph.features[i]) # <<<<<<<<<<<<<< + * return features + * +*/ + __pyx_t_1 = __Pyx_PyLong_From_uint64_t((__pyx_v_morph->features[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_features, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "spacy/morphology.pyx":183 + * for i in range(morph.length): + * features.append(morph.features[i]) + * return features # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_features); + __pyx_r = __pyx_v_features; + goto __pyx_L0; + + /* "spacy/morphology.pyx":178 + * + * + * cdef list list_features(const MorphAnalysisC* morph): # <<<<<<<<<<<<<< + * cdef int i + * features = [] +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.morphology.list_features", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_features); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pyx":186 + * + * + * cdef np.ndarray get_by_field(const MorphAnalysisC* morph, attr_t field): # <<<<<<<<<<<<<< + * cdef np.ndarray results = numpy.zeros((morph.length,), dtype="uint64") + * n = get_n_by_field(results.data, morph, field) +*/ + +static PyArrayObject *__pyx_f_5spacy_10morphology_get_by_field(struct __pyx_t_5spacy_7structs_MorphAnalysisC const *__pyx_v_morph, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_field) { + PyArrayObject *__pyx_v_results = 0; + int __pyx_v_n; + PyArrayObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_by_field", 0); + + /* "spacy/morphology.pyx":187 + * + * cdef np.ndarray get_by_field(const MorphAnalysisC* morph, attr_t field): + * cdef np.ndarray results = numpy.zeros((morph.length,), dtype="uint64") # <<<<<<<<<<<<<< + * n = get_n_by_field(results.data, morph, field) + * return results[:n] +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_morph->length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 187, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_t_5}; + __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_uint64, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_v_results = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/morphology.pyx":188 + * cdef np.ndarray get_by_field(const MorphAnalysisC* morph, attr_t field): + * cdef np.ndarray results = numpy.zeros((morph.length,), dtype="uint64") + * n = get_n_by_field(results.data, morph, field) # <<<<<<<<<<<<<< + * return results[:n] + * +*/ + __pyx_t_7 = __pyx_f_5spacy_10morphology_get_n_by_field(((uint64_t *)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_results)), __pyx_v_morph, __pyx_v_field); if (unlikely(__pyx_t_7 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L1_error) + __pyx_v_n = __pyx_t_7; + + /* "spacy/morphology.pyx":189 + * cdef np.ndarray results = numpy.zeros((morph.length,), dtype="uint64") + * n = get_n_by_field(results.data, morph, field) + * return results[:n] # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_results), 0, __pyx_v_n, NULL, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_r = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/morphology.pyx":186 + * + * + * cdef np.ndarray get_by_field(const MorphAnalysisC* morph, attr_t field): # <<<<<<<<<<<<<< + * cdef np.ndarray results = numpy.zeros((morph.length,), dtype="uint64") + * n = get_n_by_field(results.data, morph, field) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.morphology.get_by_field", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_results); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/morphology.pyx":192 + * + * + * cdef int get_n_by_field(attr_t* results, const MorphAnalysisC* morph, attr_t field) nogil: # <<<<<<<<<<<<<< + * cdef int n_results = 0 + * cdef int i +*/ + +static int __pyx_f_5spacy_10morphology_get_n_by_field(__pyx_t_5spacy_8typedefs_attr_t *__pyx_v_results, struct __pyx_t_5spacy_7structs_MorphAnalysisC const *__pyx_v_morph, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_field) { + int __pyx_v_n_results; + int __pyx_v_i; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "spacy/morphology.pyx":193 + * + * cdef int get_n_by_field(attr_t* results, const MorphAnalysisC* morph, attr_t field) nogil: + * cdef int n_results = 0 # <<<<<<<<<<<<<< + * cdef int i + * for i in range(morph.length): +*/ + __pyx_v_n_results = 0; + + /* "spacy/morphology.pyx":195 + * cdef int n_results = 0 + * cdef int i + * for i in range(morph.length): # <<<<<<<<<<<<<< + * if morph.fields[i] == field: + * results[n_results] = morph.features[i] +*/ + __pyx_t_1 = __pyx_v_morph->length; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "spacy/morphology.pyx":196 + * cdef int i + * for i in range(morph.length): + * if morph.fields[i] == field: # <<<<<<<<<<<<<< + * results[n_results] = morph.features[i] + * n_results += 1 +*/ + __pyx_t_4 = ((__pyx_v_morph->fields[__pyx_v_i]) == __pyx_v_field); + if (__pyx_t_4) { + + /* "spacy/morphology.pyx":197 + * for i in range(morph.length): + * if morph.fields[i] == field: + * results[n_results] = morph.features[i] # <<<<<<<<<<<<<< + * n_results += 1 + * return n_results +*/ + (__pyx_v_results[__pyx_v_n_results]) = (__pyx_v_morph->features[__pyx_v_i]); + + /* "spacy/morphology.pyx":198 + * if morph.fields[i] == field: + * results[n_results] = morph.features[i] + * n_results += 1 # <<<<<<<<<<<<<< + * return n_results + * +*/ + __pyx_v_n_results = (__pyx_v_n_results + 1); + + /* "spacy/morphology.pyx":196 + * cdef int i + * for i in range(morph.length): + * if morph.fields[i] == field: # <<<<<<<<<<<<<< + * results[n_results] = morph.features[i] + * n_results += 1 +*/ + } + } + + /* "spacy/morphology.pyx":199 + * results[n_results] = morph.features[i] + * n_results += 1 + * return n_results # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_n_results; + goto __pyx_L0; + + /* "spacy/morphology.pyx":192 + * + * + * cdef int get_n_by_field(attr_t* results, const MorphAnalysisC* morph, attr_t field) nogil: # <<<<<<<<<<<<<< + * cdef int n_results = 0 + * cdef int i +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/morphology.pyx":202 + * + * + * def unpickle_morphology(strings, tags): # <<<<<<<<<<<<<< + * cdef Morphology morphology = Morphology(strings) + * for tag in tags: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_10morphology_1unpickle_morphology(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_10morphology_unpickle_morphology, "unpickle_morphology(strings, tags)"); +static PyMethodDef __pyx_mdef_5spacy_10morphology_1unpickle_morphology = {"unpickle_morphology", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_1unpickle_morphology, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_unpickle_morphology}; +static PyObject *__pyx_pw_5spacy_10morphology_1unpickle_morphology(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_strings = 0; + PyObject *__pyx_v_tags = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unpickle_morphology (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_strings,&__pyx_mstate_global->__pyx_n_u_tags,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 202, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 202, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 202, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "unpickle_morphology", 0) < (0)) __PYX_ERR(0, 202, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("unpickle_morphology", 1, 2, 2, i); __PYX_ERR(0, 202, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 202, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 202, __pyx_L3_error) + } + __pyx_v_strings = values[0]; + __pyx_v_tags = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unpickle_morphology", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 202, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.morphology.unpickle_morphology", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_10morphology_unpickle_morphology(__pyx_self, __pyx_v_strings, __pyx_v_tags); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_10morphology_unpickle_morphology(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_strings, PyObject *__pyx_v_tags) { + struct __pyx_obj_5spacy_10morphology_Morphology *__pyx_v_morphology = 0; + PyObject *__pyx_v_tag = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unpickle_morphology", 0); + + /* "spacy/morphology.pyx":203 + * + * def unpickle_morphology(strings, tags): + * cdef Morphology morphology = Morphology(strings) # <<<<<<<<<<<<<< + * for tag in tags: + * morphology.add(tag) +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_strings}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_morphology = ((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/morphology.pyx":204 + * def unpickle_morphology(strings, tags): + * cdef Morphology morphology = Morphology(strings) + * for tag in tags: # <<<<<<<<<<<<<< + * morphology.add(tag) + * return morphology +*/ + if (likely(PyList_CheckExact(__pyx_v_tags)) || PyTuple_CheckExact(__pyx_v_tags)) { + __pyx_t_1 = __pyx_v_tags; __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_tags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 204, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 204, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_4; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 204, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); + #endif + ++__pyx_t_4; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 204, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_tag, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":205 + * cdef Morphology morphology = Morphology(strings) + * for tag in tags: + * morphology.add(tag) # <<<<<<<<<<<<<< + * return morphology +*/ + __pyx_t_6 = ((PyObject *)__pyx_v_morphology); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_tag}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":204 + * def unpickle_morphology(strings, tags): + * cdef Morphology morphology = Morphology(strings) + * for tag in tags: # <<<<<<<<<<<<<< + * morphology.add(tag) + * return morphology +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/morphology.pyx":206 + * for tag in tags: + * morphology.add(tag) + * return morphology # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_morphology); + __pyx_r = ((PyObject *)__pyx_v_morphology); + goto __pyx_L0; + + /* "spacy/morphology.pyx":202 + * + * + * def unpickle_morphology(strings, tags): # <<<<<<<<<<<<<< + * cdef Morphology morphology = Morphology(strings) + * for tag in tags: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.morphology.unpickle_morphology", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_morphology); + __Pyx_XDECREF(__pyx_v_tag); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ +static struct __pyx_vtabstruct_5spacy_10morphology_Morphology __pyx_vtable_5spacy_10morphology_Morphology; + +static PyObject *__pyx_tp_new_5spacy_10morphology_Morphology(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_10morphology_Morphology *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_10morphology_Morphology *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_10morphology_Morphology; + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + p->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)Py_None); Py_INCREF(Py_None); + p->tags = ((struct __pyx_obj_7preshed_4maps_PreshMap *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5spacy_10morphology_Morphology(PyObject *o) { + struct __pyx_obj_5spacy_10morphology_Morphology *p = (struct __pyx_obj_5spacy_10morphology_Morphology *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_10morphology_Morphology) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->mem); + Py_CLEAR(p->strings); + Py_CLEAR(p->tags); + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static int __pyx_tp_traverse_5spacy_10morphology_Morphology(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_10morphology_Morphology *p = (struct __pyx_obj_5spacy_10morphology_Morphology *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->mem) { + e = (*v)(((PyObject *)p->mem), a); if (e) return e; + } + if (p->strings) { + e = (*v)(((PyObject *)p->strings), a); if (e) return e; + } + if (p->tags) { + e = (*v)(((PyObject *)p->tags), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_10morphology_Morphology(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_10morphology_Morphology *p = (struct __pyx_obj_5spacy_10morphology_Morphology *)o; + tmp = ((PyObject*)p->mem); + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->strings); + p->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->tags); + p->tags = ((struct __pyx_obj_7preshed_4maps_PreshMap *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_5spacy_10morphology_10Morphology_mem(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_10morphology_10Morphology_3mem_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_10morphology_10Morphology_strings(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_10morphology_10Morphology_7strings_1__get__(o); +} + +static PyMethodDef __pyx_methods_5spacy_10morphology_Morphology[] = { + {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_3__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_2__reduce__}, + {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_5add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_4add}, + {"normalize_features", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_7normalize_features, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_6normalize_features}, + {"normalize_attrs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_9normalize_attrs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_8normalize_attrs}, + {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_11get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_10get}, + {"feats_to_dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_13feats_to_dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_12feats_to_dict}, + {"dict_to_feats", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_10morphology_10Morphology_15dict_to_feats, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_10morphology_10Morphology_14dict_to_feats}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5spacy_10morphology_Morphology[] = { + {"mem", __pyx_getprop_5spacy_10morphology_10Morphology_mem, 0, 0, 0}, + {"strings", __pyx_getprop_5spacy_10morphology_10Morphology_strings, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_10morphology_Morphology_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_10morphology_Morphology}, + {Py_tp_doc, (void *)PyDoc_STR("Morphology(StringStore strings)\n\nStore the possible morphological analyses for a language, and index them\nby hash.\n\nTo save space on each token, tokens only know the hash of their\nmorphological analysis, so queries of morphological attributes are delegated\nto this class.")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_10morphology_Morphology}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_10morphology_Morphology}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_10morphology_Morphology}, + {Py_tp_getset, (void *)__pyx_getsets_5spacy_10morphology_Morphology}, + {Py_tp_init, (void *)__pyx_pw_5spacy_10morphology_10Morphology_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_10morphology_Morphology}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_10morphology_Morphology_spec = { + "spacy.morphology.Morphology", + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_10morphology_Morphology_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_10morphology_Morphology = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.morphology.""Morphology", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_10morphology_Morphology, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + PyDoc_STR("Morphology(StringStore strings)\n\nStore the possible morphological analyses for a language, and index them\nby hash.\n\nTo save space on each token, tokens only know the hash of their\nmorphological analysis, so queries of morphological attributes are delegated\nto this class."), /*tp_doc*/ + __pyx_tp_traverse_5spacy_10morphology_Morphology, /*tp_traverse*/ + __pyx_tp_clear_5spacy_10morphology_Morphology, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_10morphology_Morphology, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5spacy_10morphology_Morphology, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_5spacy_10morphology_10Morphology_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_10morphology_Morphology, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +/* #### Code section: initfunc_declarations ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ +/* #### Code section: init_module ### */ + +static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + { + __pyx_t_1 = __Pyx_ApiExport_GetApiDict(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_export_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyArrayObject_struct___pyx_t_5sp); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_export_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_export_name = __pyx_export_signature + 391; + void (*const __pyx_export_pointers[])(void) = {(void (*)(void))&__pyx_f_5spacy_10morphology_get_by_field, (void (*)(void))&__pyx_f_5spacy_10morphology_list_features, (void (*)(void))&__pyx_f_5spacy_10morphology_get_n_by_field, (void (*)(void))&__pyx_f_5spacy_10morphology_check_feature, (void (*)(void)) NULL}; + void (*const *__pyx_export_pointer)(void) = __pyx_export_pointers; + const char *__pyx_export_current_signature = __pyx_export_signature; + while (*__pyx_export_pointer) { + if (__Pyx_ExportFunction(__pyx_t_1, __pyx_export_name, *__pyx_export_pointer, __pyx_export_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_export_pointer; + __pyx_export_name = strchr(__pyx_export_name, '\0') + 1; + __pyx_export_signature = strchr(__pyx_export_signature, '\0') + 1; + if (*__pyx_export_signature != '\0') __pyx_export_current_signature = __pyx_export_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_5spacy_10morphology_Morphology = &__pyx_vtable_5spacy_10morphology_Morphology; + __pyx_vtable_5spacy_10morphology_Morphology.create_morph_tag = (struct __pyx_t_5spacy_7structs_MorphAnalysisC (*)(struct __pyx_obj_5spacy_10morphology_Morphology *, PyObject *))__pyx_f_5spacy_10morphology_10Morphology_create_morph_tag; + __pyx_vtable_5spacy_10morphology_Morphology.insert = (int (*)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_MorphAnalysisC))__pyx_f_5spacy_10morphology_10Morphology_insert; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_10morphology_Morphology_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology)) __PYX_ERR(0, 14, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_10morphology_Morphology_spec, __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) < (0)) __PYX_ERR(0, 14, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology = &__pyx_type_5spacy_10morphology_Morphology; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) < (0)) __PYX_ERR(0, 14, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_vtabptr_5spacy_10morphology_Morphology) < (0)) __PYX_ERR(0, 14, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) < (0)) __PYX_ERR(0, 14, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Morphology, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) < (0)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_1(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + 0, 0, + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "dtype", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #else + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 228, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flatiter", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #else + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 273, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "broadcast", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #else + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 277, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ndarray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #else + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 316, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "generic", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(1, 825, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "number", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(1, 827, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "integer", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(1, 829, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "signedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 831, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "unsignedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 833, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "inexact", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 835, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "floating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(1, 837, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "complexfloating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 839, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flexible", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 841, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "character", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(1, 843, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ufunc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #else + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 907, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(3, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(3, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(3, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(3, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(3, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(3, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(3, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(4, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(4, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(4, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(4, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(5, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(5, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("murmurhash.mrmr"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_uint64_t_void_int_uint64_t_hash6); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 33; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (void (**)(void)) NULL}; + void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportFunction_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_morphology(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_morphology}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #endif + #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE + {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, + #endif + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "morphology", + 0, /* m_doc */ + #if CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstatetype), /* m_size */ + #else + (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif + +/* PyModInitFuncType */ +#ifndef CYTHON_NO_PYINIT_EXPORT + #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#else + #ifdef __cplusplus + #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * + #else + #define __Pyx_PyMODINIT_FUNC PyObject * + #endif +#endif + +__Pyx_PyMODINIT_FUNC PyInit_morphology(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_morphology(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +/* ModuleCreationPEP489 */ +#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) +static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { + { + PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think + if (!module) { + PyErr_Clear(); // just try the 3.8-3.12 version + module = PyImport_ImportModule("_xxsubinterpreters"); + if (!module) goto bad; + } + PyObject *current = PyObject_CallMethod(module, "get_current", NULL); + Py_DECREF(module); + if (!current) goto bad; + if (PyTuple_Check(current)) { + PyObject *new_current = PySequence_GetItem(current, 0); + Py_DECREF(current); + current = new_current; + if (!new_current) goto bad; + } + long long as_c_int = PyLong_AsLongLong(current); + Py_DECREF(current); + return as_c_int; + } + bad: + PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); + return -1; +} +#endif +#if !CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + static PY_INT64_T main_interpreter_id = -1; +#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_GRAAL + PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) + PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); +#elif CYTHON_COMPILING_IN_LIMITED_API + PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); +#else + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); +#endif + if (unlikely(current_id == -1)) { + return -1; + } + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return 0; + } else if (unlikely(main_interpreter_id != current_id)) { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#endif +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + #if !CYTHON_USE_MODULE_STATE + if (__Pyx_check_single_interpreter()) + return NULL; + #endif + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_morphology(PyObject *__pyx_pyinit_module) +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + __pyx_mstatetype *__pyx_mstate = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'morphology' has already been imported. Re-initialisation is not supported."); + return -1; + } + #else + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_t_1 = __pyx_pyinit_module; + Py_INCREF(__pyx_t_1); + #else + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #if CYTHON_USE_MODULE_STATE + { + int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "morphology" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = __pyx_t_1; + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); + #endif + __pyx_mstate = __pyx_mstate_global; + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_mstate->__pyx_d); + __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /* ImportRefnannyAPI */ + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + +__Pyx_RefNannySetupContext("PyInit_morphology", 0); + __Pyx_init_runtime_version(); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Library function declarations ---*/ + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_module_is_main_spacy__morphology) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "spacy.morphology")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.morphology", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(__pyx_mstate); + (void)__Pyx_modinit_variable_export_code(__pyx_mstate); + if (unlikely((__Pyx_modinit_function_export_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_variable_import_code(__pyx_mstate); + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "spacy/morphology.pyx":3 + * # cython: infer_types + * # cython: profile=False + * import warnings # <<<<<<<<<<<<<< + * + * import numpy +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_warnings, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_warnings, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":5 + * import warnings + * + * import numpy # <<<<<<<<<<<<<< + * + * from .attrs cimport POS +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numpy, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_numpy, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_numpy, __pyx_t_2) < (0)) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":9 + * from .attrs cimport POS + * + * from . import symbols # <<<<<<<<<<<<<< + * from .errors import Warnings + * from .parts_of_speech import IDS as POS_IDS +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_symbols}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_symbols}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":10 + * + * from . import symbols + * from .errors import Warnings # <<<<<<<<<<<<<< + * from .parts_of_speech import IDS as POS_IDS + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Warnings}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Warnings}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":11 + * from . import symbols + * from .errors import Warnings + * from .parts_of_speech import IDS as POS_IDS # <<<<<<<<<<<<<< + * + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IDS}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_parts_of_speech, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_parts_of_speech, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IDS}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + switch (__pyx_t_3) { + case 0: + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_POS_IDS, __pyx_t_4) < (0)) __PYX_ERR(0, 11, __pyx_L1_error) + break; + default:; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":22 + * to this class. + * """ + * FEATURE_SEP = "|" # <<<<<<<<<<<<<< + * FIELD_SEP = "=" + * VALUE_SEP = "," +*/ + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_FEATURE_SEP, __pyx_mstate_global->__pyx_kp_u__3) < (0)) __PYX_ERR(0, 22, __pyx_L1_error) + + /* "spacy/morphology.pyx":23 + * """ + * FEATURE_SEP = "|" + * FIELD_SEP = "=" # <<<<<<<<<<<<<< + * VALUE_SEP = "," + * # not an empty string so we can distinguish unset morph from empty morph +*/ + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_FIELD_SEP, __pyx_mstate_global->__pyx_kp_u__4) < (0)) __PYX_ERR(0, 23, __pyx_L1_error) + + /* "spacy/morphology.pyx":24 + * FEATURE_SEP = "|" + * FIELD_SEP = "=" + * VALUE_SEP = "," # <<<<<<<<<<<<<< + * # not an empty string so we can distinguish unset morph from empty morph + * EMPTY_MORPH = symbols.NAMES[symbols._] +*/ + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_VALUE_SEP, __pyx_mstate_global->__pyx_kp_u__5) < (0)) __PYX_ERR(0, 24, __pyx_L1_error) + + /* "spacy/morphology.pyx":26 + * VALUE_SEP = "," + * # not an empty string so we can distinguish unset morph from empty morph + * EMPTY_MORPH = symbols.NAMES[symbols._] # <<<<<<<<<<<<<< + * + * def __init__(self, StringStore strings): +*/ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_symbols); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_NAMES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_symbols); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u__6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_EMPTY_MORPH, __pyx_t_2) < (0)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":33 + * self.tags = PreshMap() + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * tags = set([self.get(self.strings[s]) for s in self.strings]) + * tags -= set([""]) +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_10morphology_10Morphology_3__reduce__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Morphology___reduce, NULL, __pyx_mstate_global->__pyx_n_u_spacy_morphology, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_reduce, __pyx_t_2) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":38 + * return (unpickle_morphology, (self.strings, sorted(tags)), None, None) + * + * def add(self, features): # <<<<<<<<<<<<<< + * """Insert a morphological analysis in the morphology table, if not + * already present. The morphological analysis may be provided in the UD +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_10morphology_10Morphology_5add, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Morphology_add, NULL, __pyx_mstate_global->__pyx_n_u_spacy_morphology, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_add, __pyx_t_2) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":77 + * return tag.key + * + * def normalize_features(self, features): # <<<<<<<<<<<<<< + * """Create a normalized FEATS string from a features string or dict. + * +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_10morphology_10Morphology_7normalize_features, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Morphology_normalize_features, NULL, __pyx_mstate_global->__pyx_n_u_spacy_morphology, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_normalize_features, __pyx_t_2) < (0)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":98 + * return norm_feats_string or self.EMPTY_MORPH + * + * def normalize_attrs(self, attrs): # <<<<<<<<<<<<<< + * """Convert attrs dict so that POS is always by ID, other features are + * by string. Values separated by VALUE_SEP are sorted. +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_10morphology_10Morphology_9normalize_attrs, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Morphology_normalize_attrs, NULL, __pyx_mstate_global->__pyx_n_u_spacy_morphology, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_normalize_attrs, __pyx_t_2) < (0)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":149 + * self.tags.set(key, tag_ptr) + * + * def get(self, hash_t morph): # <<<<<<<<<<<<<< + * tag = self.tags.get(morph) + * if tag == NULL: +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_10morphology_10Morphology_11get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Morphology_get, NULL, __pyx_mstate_global->__pyx_n_u_spacy_morphology, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_2) < (0)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":156 + * return self.strings[tag.key] + * + * @staticmethod # <<<<<<<<<<<<<< + * def feats_to_dict(feats): + * if not feats or feats == Morphology.EMPTY_MORPH: +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_10morphology_10Morphology_13feats_to_dict, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Morphology_feats_to_dict, NULL, __pyx_mstate_global->__pyx_n_u_spacy_morphology, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_feats_to_dict, __pyx_t_2) < (0)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = NULL; + __Pyx_GetNameInClass(__pyx_t_4, (PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_feats_to_dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_staticmethod, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_feats_to_dict, __pyx_t_2) < (0)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":163 + * [feat.split(Morphology.FIELD_SEP) for feat in feats.split(Morphology.FEATURE_SEP)]} + * + * @staticmethod # <<<<<<<<<<<<<< + * def dict_to_feats(feats_dict): + * if len(feats_dict) == 0: +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_10morphology_10Morphology_15dict_to_feats, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Morphology_dict_to_feats, NULL, __pyx_mstate_global->__pyx_n_u_spacy_morphology, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_dict_to_feats, __pyx_t_2) < (0)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = NULL; + __Pyx_GetNameInClass(__pyx_t_5, (PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_dict_to_feats); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_staticmethod, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_mstate_global->__pyx_n_u_dict_to_feats, __pyx_t_2) < (0)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":202 + * + * + * def unpickle_morphology(strings, tags): # <<<<<<<<<<<<<< + * cdef Morphology morphology = Morphology(strings) + * for tag in tags: +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_10morphology_1unpickle_morphology, 0, __pyx_mstate_global->__pyx_n_u_unpickle_morphology, NULL, __pyx_mstate_global->__pyx_n_u_spacy_morphology, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_unpickle_morphology, __pyx_t_2) < (0)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/morphology.pyx":1 + * # cython: infer_types # <<<<<<<<<<<<<< + * # cython: profile=False + * import warnings +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.morphology", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init spacy.morphology"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #else + return __pyx_m; + #endif +} +/* #### Code section: pystring_table ### */ +/* #### Code section: cached_builtins ### */ + +static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 137, __pyx_L1_error) + + /* Cached unbound methods */ + __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cached_constants ### */ + +static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + __Pyx_RefNannyFinishContext(); + return 0; +} +/* #### Code section: init_constants ### */ + +static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + { + const struct { const unsigned int length: 9; } index[] = {{0},{179},{1},{1},{1},{1},{1},{8},{7},{6},{2},{9},{39},{34},{6},{12},{20},{11},{21},{14},{0},{11},{11},{9},{3},{10},{21},{14},{24},{24},{14},{26},{29},{5},{3},{7},{20},{9},{4},{8},{1},{3},{15},{9},{18},{5},{17},{18},{8},{13},{5},{9},{6},{4},{5},{10},{13},{7},{8},{5},{19},{8},{15},{6},{8},{3},{13},{5},{4},{3},{8},{10},{5},{10},{8},{17},{15},{18},{5},{3},{15},{3},{12},{14},{12},{10},{1},{4},{12},{10},{16},{5},{12},{15},{7},{7},{3},{7},{4},{8},{6},{19},{5},{5},{6},{4},{8},{5},{446},{32},{135},{88},{179},{345},{270},{63},{45},{39}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1795 bytes) */ +const char* const cstring = "BZh91AY&SY\274\372C\303\000\001P\177\377\377\375\377\377\377\367\377\363\277\367\377\363\377\377\377\377@@@@@@@@@@@@@\000@\000P\006\014S{\261\271\266\324\026F\266\\\001\303SB\246\324`\2234\324\363Ry4\307\241\251\244F\203\rC\322x\246O$\323h\200\323\023\324\323&'\224\321\223'\251\351\240\322d\364\203D\020\302\002d\236\214\204aS\324\366\243@&\320\032\200dha\246\200\021\202\006\r4\000M\007\250\tD\304M\010\312\236\241\232SmS\332\214\322\237\2522\000\000\332\200h\000\000\000\000\000\003@\364\217Q\352 \323\023\023\023\0010\023\000\000\000\000\230\000\002`\000\023\000\000\000\0014\tD\246i\242'\352\247\352\236\247\264\324\306\232\215@\036\2234\206\200\000\000\000\304\001\2044\032\000\0004\001\330\014 \301|\364^\0010\205c\376\t\004\021\256\002\rj\345\302.c\234\177SN\247\257gn\275\373\326\030b\224\245,\2458z\227\377\221\377$Bd\342\224\366\2116W\244\340\341\307+J\211I\344\307l\330;\275\375\006\357W\271\3157\253V\205\321\246\365\262T)4\266\322n\250\343\316\217>\237K\203\202\260\376h\245\311e\306t\205\200/\231H\354\305\267\001\312>f\206p\242n\233\003\035\266\022\310iJ{\211\361&\013 R\005\r\270\020\303\373e\273J\300\3379\201\310""\314\200\217S\357T\373=\252\275M\360\372\325<\0350]UBFF\315\201B~\023\022\221\202\363\351S\245\310\304\251ZN\233P3IU\340{\034A\324\312,\035\017)\025p\001\334\251\217\022\277*{\234\374?\212\331i\273\262\322\"\273\352\216\"l\303B\023\002\216\177\013\374)\010\2716\354O\212\276a\215)\004\354G\366X\023;E,\210b$\310ZV\0013M\355\334t\300jc\355\232\243?\0300V\244\263\274?!b\356\260\245hE\265#;\265\264\324,\252\022MPZ\020\004\211\005\021\023\036a\027M7\\38\n\305\000\345\302\340\343%,e\033\274\t\010\260I\255m\250\264b\2333\261\014\267,3\010\334\014\357\034\340\010\314]\304B\314}\340\310\3201V\223\360m\317D\202t}\2611\213\t\351r\315\n\233\014\353\301+\242\010C\314\231\"\361\000a\310O+\177\rw\306\266\037\242k\251\032A2c3\271:\014\314\302\214\205k3I\004\266\340\310j\213,\006j\01327\000X\346\307\362\311\035\340\020\343\032'\231H0\010\32235\223\210\331\246\306T\204S\3042\274b\212s\002\241\343\005\340\324\300\364\207\270\264\001\233\245\014iUS%\216\t\000\221PI\r\344 \300^LaqV+\316\032(<&P\202\212|YBIAt\350R\n\350\005B\020\326\032J#\003\n+\244\310/\344\232J\373\347\323\330\346\265\345\002\347\256F\202j\314x\001\204\026d\262\316b\210`\212\323\273R\333\236\t\032\360p\217(\2429.\246\024M\032\014P\257\261\225\345pK\367\332\tqc\264\027\024\231\013\3148\241\204\250\212\252\222\215\025\273E\267PW\317<\350\211^\304\3638!\026\365\265\000\317{G'\003j\371\002\240h\275{\023t\323\254\324\352;\032\265\357\233\033\002)\3126Ltc\203gQ,Bbl\205\205Y\020\033y\210\036\331IV\005\220\016W\\\331\366d0j{^\306\006sHM\350\245\252\215d\264C\341#\t\026\315i\025\266\201b\327d:\320#\003\375\240\007\205\274 \303[<`\"Y\2377\304\321\037\030\225\356\000\305_%\372SN\346\005\332\213\002V0U\202\001\233\226\3401\023\205Tc]\334\230\252\333\211G\026\010\344Z\212\272\240l\323@\264\214\201\265\242\007\003l\203\n\31015\354\001\013\014\003\210\031\006\241\351\"-\200+{\256\335,\271\253\247r`\321 \002R\324\351I$\032S\351_!\217^\333\340\t\313V\252\252\316\331p\325fE4\254ps\006(\350M\373`\032\202\340\0053\227T\204\263E\353\302""\227\224U\024UNH\305\206\240\022A\212<\304u\304I\001\215\357-T\030\302\3766\030\017Pl\010@\241\305\tQ\235\016\352\017\024=\265\257\325\253\235W\345\302cn\030s\355\033\204\207x\210\201\002khA!~*\3065|\314\036\250\\f\013 7b\032\300 ]\"\200\305\250\221cq\237\261\365\204Z\3438\200\215\034\247iJ\2625\313\020j\r\362\264$\350ZP9\r\356BR\206BZ\r\031A[\266\307) \222w-\254s5\263\313\360l8\337;E\274\355\304\206\334\2542A\303\223\243X*\263\033\273\323c\342\016\351\346Vuvu\265\334\375\214\323\343\346\314\027\247\366\367[\262\263\377\277\"{ftKi\247\277^\261=\305\342\205g\237F\257SH\240%\225_$\271MiK\022\245H\314\031u\010eT\224\010G\222J\360\010\3711\343\354H8\362\341\214\261\334\303\234\317lqO\211\007\033\030^\305\212&\215\3734\226*Dqzq2\372\335f\354\310\031L\262>\231:m\266\2727h\302\242\277\275\013:3^\343\341\0074\025\232P\262\006z\261_\322\276\271\252'@\235I\230rf\362\302\317\020E\025\346\016N\313CF\334\350\002F\367\001\243S6\250\304\236\314&BN\374\036VQ\301\004%\200\3010tm\274\027\217\212\237O\327\246x\372\326]sqRZp\032I\361\322\364\320\275\341\355\372\313A%\250\006\017\302W\2215\023g\335\331 \336E1RbE\2135+\266&\361\344\355\207\\\356]~\263\000\313f\241\305\227Va\233/\333\205\037\371\362c\241\307\227^A\341\213R\240|\241\205w|yW\330\234\343\367\346Zs\031\214\346t\342)^w\253n\323=\360\016A\225\225\260\026\016\243\275\270\323\215\273/\343\227\257\343\327r,\203*\\\222\370\355\273\243\342\r\267\345\225\374vPI./d\010_\271\226'z]o\340\277\014\344p9\272>\3736~\365S\374\023\376p.w\241\034_\252z\013^\313\317\003\344\213\277\200|ij\273sn#)\177\001\331\001\327R\274\264\3541\220c>\020\203\177\205;\3215 [\345~\007\016u\253I\371\252\263\317+\371[\251\376&z\177\206\014\305\322\364q\252;\004\275\342 N.)\225\235\242;\357\212\356\213\270\326\014\304\014\305}\257\301\023\227\235\013\356\222;\001\td\000U\376\312\273\355\027\374\232\377&\274\034\002\273E\347\021H\226\217\253\337\304\337\3743\002\373Mo\003\334\026\257$\213\327\334\242\227\367*G\305\257\274Z|{\003\272 \3175\373\223\333\212\205\265\240\001i\200\341\006t\365\320\225\275j|s=^\337\212R|\017\235\206#\362&\242N\025\204-\346.\\\232\202\241\354\314;\242\323\345\036m\347\217\356-\016\352\010\004d\316\232#\2735w\317\317\373W|\0224\003""\032\336\216\346\2425\210V^p\036\270]w\000cQ\003\323z\270\020n\206\343d\361\206\373\020\350\265\375%\177\234\\\371\322\035{\347=\313o\005\347\202A\370\"z8kp\217\266W\361V\374[\376~\200\003;\372,\352rZ\020\260\341\276+\023]\221\371\347\016\016\356\n'\307wrCL\207\353\315\237\0015\"o$"; + PyObject *data = __Pyx_DecompressString(cstring, 1649, 1); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #else /* compression: none (2864 bytes) */ +const char* const bytes = "Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False..|=,?add_notedisableenablegcisenablednumpy._core.multiarray failed to importnumpy._core.umath failed to importspacy.spacy.errorsspacy/morphology.pyxspacy.numpyspacy.parts_of_speechspacy.warningsEMPTY_MORPHFEATURE_SEPFIELD_SEPIDSMorphologyMorphology.__reduce__Morphology.addMorphology.dict_to_featsMorphology.feats_to_dictMorphology.getMorphology.normalize_attrsMorphology.normalize_featuresNAMESPOSPOS_IDS__Pyx_PyDict_NextRefVALUE_SEPW100Warnings_addallow_transientas_stringasyncio.coroutinesattrs__class_getitem__cline_in_traceback__dict__dict_to_featsdtypeenumerateerrorsfeatfeatsfeats_dictfeats_to_dictfeaturefeaturesfieldfield_feature_pairsfield_idfield_sep_valueformat__func__get_is_coroutineitemsjoinkey__main____module__morphmorphology__name__norm_feats_stringnormalize_attrsnormalize_featuresnumpyoutparts_of_speechpop__pyx_capi____pyx_vtable____qualname____reduce__sself__set_name__setdefaultspacy.morphologysplitstaticmethodstring_featuresstringssymbolstagtag_ptrtags__test__uint64unpickle_morphologyuppervaluevalueswarnwarningszerosPyArrayObject *(struct __pyx_t_5spacy_7structs_MorphAnalysisC const *, __pyx_t_5spacy_8typedefs_attr_t)\000PyObject *(struct __pyx_t_5spacy_7structs_MorphAnalysisC const *)\000int (__pyx_t_5spacy_8typedefs_attr_t *, struct __pyx_t_5spacy_7structs_MorphAnalysisC const *, __pyx_t_5spacy_8typedefs_attr_t)\000int (struct __pyx_t_5spacy_7structs_MorphAnalysisC const *, __pyx_t_5spacy_8typedefs_attr_t)\000get_by_field\000list_features\000get_n_by_field\000check_feature\200\001\330\004!\240\032\2501\250A\330\004\010\210\007\210q\330\010\022\220$\220a\220q\330\004\013\2101\200A\340\010\013\2103\210a\210|\2303\230a\330\014\023\2201\330\010\017\210z\230\034\240U\250'\260\021\260!\260:\270Z\300u\310A\310Q\310g\320U_\320_i\320in\320nu\320uv\320v|\360\000\000}\001C\002\360\000""\000C\002D\002\360\000\000D\002N\002\360\000\000N\002^\002\360\000\000^\002b\002\360\000\000b\002i\002\360\000\000i\002s\002\360\000\000s\002}\002\360\000\000}\002C\003\360\000\000C\003D\003\200A\340\010\013\2104\210v\220S\230\006\230c\240\032\2501\330\014\023\2201\330\010\017\210q\220\007\220z\240\032\2505\260\007\260q\270\006\270f\300A\300Z\310~\320]a\320ah\320hi\330\020\021\220\024\220V\2301\230J\240l\260$\260h\270e\3006\310\021\310*\320TU\200A\360\014\000\t\014\210:\220Q\220j\240\001\330\014\027\220t\230>\250\021\250!\330\010\013\2104\210z\230\021\230*\240A\330\014\024\220E\230\021\230(\240%\240w\250a\250x\260q\330\014\027\220q\330\010\023\2204\320\027'\240q\250\001\330\010\032\230!\2304\230x\240z\260\021\260(\270$\270h\300j\320PQ\320QY\320Y]\320]d\320dn\320nv\320v|\320|}\340\010\034\230D\240\014\250E\260\021\330\022\023\330\020\021\220\024\220Z\230u\240A\240Q\240g\250Y\260d\270'\300\032\310?\320Z`\320`a\360\006\000\t\020\320\017!\240\023\240D\250\001\200A\360\016\000\t\014\210:\220Q\220j\240\001\330\014\017\210y\230\003\2301\330\020\033\2304\230q\330\014\026\320\026'\240t\2505\260\004\260A\260X\270T\300\030\310\021\310!\330\014\017\210x\220s\230!\330\020\027\220w\230a\330\014\027\220t\230>\250\021\250!\330\010\013\2104\210z\230\021\230*\240A\330\014\024\220E\230\021\230(\240%\240w\250a\250x\260q\330\014\027\220q\330\010\032\230!\2304\230x\240z\260\021\260(\270$\270h\300j\320PQ\320QY\320Y]\320]d\320dn\320nv\320v|\320|}\340\010\036\230a\330\010\014\210I\220V\2301\230A\330\014\025\220_\240A\240Q\330\014\020\220\010\230\004\230A\230W\320$4\260A\330\014\027\220t\2308\2401\240A\330\014\020\220\t\230\026\230v\240Q\240d\250!\330\020\"\240&\250\002\250$\250k\270\022\2701\330\020\024\220H\230D\240\001\320!2\3202B\300!\330\020#\2407\250!\330\024\025\330\024\030\230\010\240\001\240\021\340\010\"\240$\320&7\260q\270\001\360\006\000\t\035\230D\320 3\2601\260A\330\010\013\2107\220$\220h\230d\240!\320#6\3206F\300a\330\010\014\210G\2201\220A\330\010\017\210s\220!\200A\360\010""\000\t\017\210a\330\010\020\220\004\220A\220Q\330\010\014\210E\220\031\230%\230v\240Q\340\014\017\210t\2203\220d\230$\230j\250\001\250\025\250e\2604\260s\270&\300\003\3003\300a\330\020\023\220:\230Q\230g\240U\250$\250e\2606\270\023\270C\270q\330\024\034\230G\2401\240E\250\026\250q\330\025\037\230q\240\007\240u\250D\260\006\260g\270W\300G\3101\330\024\034\230E\240\021\240(\250%\250w\260a\260y\300\005\300Q\330\024\025\330\020\023\2201\220G\2301\340\021\033\2301\230F\240%\240v\250T\260\032\2701\270H\300E\310\021\330\020\026\220d\230(\240*\250A\250Q\330\020\030\230\004\230H\240J\250a\250q\340\020\023\2204\220{\240#\240Q\330\024\034\230D\240\n\250%\250w\260a\260u\270F\300!\3004\300q\330\020\023\2201\220G\2301\340\020\030\230\005\230Q\230h\240e\2507\260!\2609\270E\300\021\330\010\017\210q\200A\330\010\017\210s\220!\2201\220D\230\004\230A\230T\240\030\250\021\250$\250d\260%\260t\2701\330\010\020\220\003\2201\220A\220Q\330\010\020\320\020&\240d\320*:\270!\2708\3006\310\021\200A\330\010\016\320\016\037\230t\2405\250\004\250A\250Q\330\010\013\2104\210s\220!\330\014\023\2201\340\014\023\2204\220x\230q\240\003\2401uint64_t (void *, int, uint64_t)\000hash64"; + PyObject *data = NULL; + CYTHON_UNUSED_VAR(__Pyx_DecompressString); + #endif + PyObject **stringtab = __pyx_mstate->__pyx_string_tab; + Py_ssize_t pos = 0; + for (int i = 0; i < 108; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 20) PyUnicode_InternInPlace(&string); + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + stringtab[i] = string; + pos += bytes_length; + } + for (int i = 108; i < 118; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); + stringtab[i] = string; + pos += bytes_length; + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + Py_XDECREF(data); + for (Py_ssize_t i = 0; i < 118; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 108; + for (Py_ssize_t i=0; i<10; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + } + { + PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 0; + int8_t const cint_constants_1[] = {0,1}; + for (int i = 0; i < 2; i++) { + numbertab[i] = PyLong_FromLong(cint_constants_1[i - 0]); + if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_number_tab; + for (Py_ssize_t i=0; i<2; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_codeobjects ### */ +typedef struct { + unsigned int argcount : 2; + unsigned int num_posonly_args : 1; + unsigned int num_kwonly_args : 1; + unsigned int nlocals : 4; + unsigned int flags : 10; + unsigned int first_line : 8; +} __Pyx_PyCode_New_function_description; +/* NewCodeObj.proto */ +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +); + + +static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { + PyObject* tuple_dedup_map = PyDict_New(); + if (unlikely(!tuple_dedup_map)) return -1; + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 33}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tags, __pyx_mstate->__pyx_n_u_s}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_morphology_pyx, __pyx_mstate->__pyx_n_u_reduce, __pyx_mstate->__pyx_kp_b_iso88591_A_s_1D_AT_d_t1_1AQ_d_86, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 38}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_features, __pyx_mstate->__pyx_n_u_tag_ptr, __pyx_mstate->__pyx_n_u_string_features, __pyx_mstate->__pyx_n_u_field_feature_pairs, __pyx_mstate->__pyx_n_u_field, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_n_u_field_id, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_field_sep_value, __pyx_mstate->__pyx_n_u_tag, __pyx_mstate->__pyx_n_u_norm_feats_string, __pyx_mstate->__pyx_n_u_field, __pyx_mstate->__pyx_n_u_values}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_morphology_pyx, __pyx_mstate->__pyx_n_u_add, __pyx_mstate->__pyx_kp_b_iso88591_A_Qj_y_1_4q_t5_AXT_xs_wa_t_4z_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 77}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_features, __pyx_mstate->__pyx_n_u_string_features, __pyx_mstate->__pyx_n_u_norm_feats_string, __pyx_mstate->__pyx_n_u_field, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_n_u_field, __pyx_mstate->__pyx_n_u_values}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_morphology_pyx, __pyx_mstate->__pyx_n_u_normalize_features, __pyx_mstate->__pyx_kp_b_iso88591_A_Qj_t_4z_A_E_waxq_q_4_q_4xz_hjP, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 98}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_attrs, __pyx_mstate->__pyx_n_u_out, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_morphology_pyx, __pyx_mstate->__pyx_n_u_normalize_attrs, __pyx_mstate->__pyx_kp_b_iso88591_A_a_AQ_E_vQ_t3d_j_e4s_3a_QgU_e6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 149}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_morph, __pyx_mstate->__pyx_n_u_tag}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_morphology_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_mstate->__pyx_kp_b_iso88591_A_t5_AQ_4s_1_4xq_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 156}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_feats, __pyx_mstate->__pyx_n_u_field, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_n_u_feat}; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_morphology_pyx, __pyx_mstate->__pyx_n_u_feats_to_dict, __pyx_mstate->__pyx_kp_b_iso88591_A_4vS_c_1_1_q_z_5_q_fAZ_aahhi_V1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 163}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_feats_dict, __pyx_mstate->__pyx_n_u_field, __pyx_mstate->__pyx_n_u_values}; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_morphology_pyx, __pyx_mstate->__pyx_n_u_dict_to_feats, __pyx_mstate->__pyx_kp_b_iso88591_A_3a_3a_1_z_U_ZuAQgU__iinnuuvv_C, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 202}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_strings, __pyx_mstate->__pyx_n_u_tags, __pyx_mstate->__pyx_n_u_morphology, __pyx_mstate->__pyx_n_u_tag}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_morphology_pyx, __pyx_mstate->__pyx_n_u_unpickle_morphology, __pyx_mstate->__pyx_kp_b_iso88591_1A_q_aq_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + } + Py_DECREF(tuple_dedup_map); + return 0; + bad: + Py_DECREF(tuple_dedup_map); + return -1; +} +/* #### Code section: init_globals ### */ + +static int __Pyx_InitGlobals(void) { + /* PythonCompatibility.init */ + if (likely(__Pyx_init_co_variables() == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CommonTypesMetaclass.init */ + if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CachedMethodType.init */ + #if CYTHON_COMPILING_IN_LIMITED_API + { + PyObject *typesModule=NULL; + typesModule = PyImport_ImportModule("types"); + if (typesModule) { + __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + } + } // error handling follows + #endif + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CythonFunctionShared.init */ + if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, + "name '%U' is not defined", name); + } + return result; +} + +/* GetTopmostException (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} +#endif + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif +{ + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C0000 + local_value = tstate->current_exception; + tstate->current_exception = 0; + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000 + local_value = PyErr_GetRaisedException(); +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif +#if __PYX_LIMITED_VERSION_HEX > 0x030C0000 + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } +#else + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } +#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000 + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif + } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + PyErr_SetHandledException(local_value); + Py_XDECREF(local_value); + Py_XDECREF(local_type); + Py_XDECREF(local_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000 +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +#endif +} + +/* PyObjectCall (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API + #if PY_VERSION_HEX < 0x03090000 + #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) + #elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { + PyTypeObject *tp = Py_TYPE(callable); + #if defined(__Pyx_CyFunction_USED) + if (__Pyx_CyFunction_CheckExact(callable)) { + return __Pyx_CyFunction_func_vectorcall(callable); + } + #endif + if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { + return NULL; + } + assert(PyCallable_Check(callable)); + Py_ssize_t offset = tp->tp_vectorcall_offset; + assert(offset > 0); + vectorcallfunc ptr; + memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); + return ptr; +} + #else + #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) + #endif +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if CYTHON_COMPILING_IN_LIMITED_API + return PyObject_Vectorcall(func, args, _nargs, NULL); + #else + vectorcallfunc f = __Pyx_PyVectorcall_Function(func); + if (f) { + return f(func, args, _nargs, NULL); + } + #endif + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* RaiseException */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); +#elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} + +/* TupleAndListFromArray (used by fastcall) */ +#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + Py_ssize_t i; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + for (i = 0; i < n; i++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + return res; +} +#elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\ + !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + return PyObject_RichCompareBool(s1, s2, equals); +#else + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length, length2; + int kind; + void *data1, *data2; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + #endif + length = __Pyx_PyUnicode_GET_LENGTH(s1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length < 0)) return -1; + #endif + length2 = __Pyx_PyUnicode_GET_LENGTH(s2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length2 < 0)) return -1; + #endif + if (length != length2) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + return (equals == Py_EQ); +return_ne: + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(n == -1)) return NULL; + #endif + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + if (s == namei) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; + return kwvalues[i]; + } + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { + Py_ssize_t i, nkwargs; + PyObject *dict; +#if !CYTHON_ASSUME_SAFE_SIZE + nkwargs = PyTuple_Size(kwnames); + if (unlikely(nkwargs < 0)) return NULL; +#else + nkwargs = PyTuple_GET_SIZE(kwnames); +#endif + dict = PyDict_New(); + if (unlikely(!dict)) + return NULL; + for (i=0; itype, *target->method_name); + if (unlikely(!method)) + return -1; + result = method; +#if CYTHON_COMPILING_IN_CPYTHON + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } else +#endif +#if CYTHON_COMPILING_IN_PYPY +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); +#endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); +#endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + result = unbound_method; + } + } +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + if (unlikely(target->method)) { + Py_DECREF(result); + } else +#endif + target->method = result; + return 0; +} + +/* CallUnboundCMethod0 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + if (likely(cfunc->flag == METH_NOARGS)) + return __Pyx_CallCFunction(cfunc, self, NULL); + if (likely(cfunc->flag == METH_FASTCALL)) + return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0); + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL); + if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS))) + return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (cfunc->flag == METH_VARARGS) + return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple); + return __Pyx__CallUnboundCMethod0(cfunc, self); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + PyObject *result; + if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; + result = __Pyx_PyObject_CallOneArg(cfunc->method, self); + return result; +} + +/* py_dict_items (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d); +} + +/* py_dict_values (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d); +} + +/* OwnedDictNext (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) { + PyObject *next = NULL; + if (!*ppos) { + if (pvalue) { + PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p); + if (unlikely(!dictview)) goto bad; + *ppos = PyObject_GetIter(dictview); + Py_DECREF(dictview); + } else { + *ppos = PyObject_GetIter(p); + } + if (unlikely(!*ppos)) goto bad; + } + next = PyIter_Next(*ppos); + if (!next) { + if (PyErr_Occurred()) goto bad; + return 0; + } + if (pkey && pvalue) { + *pkey = __Pyx_PySequence_ITEM(next, 0); + if (unlikely(*pkey)) goto bad; + *pvalue = __Pyx_PySequence_ITEM(next, 1); + if (unlikely(*pvalue)) goto bad; + Py_DECREF(next); + } else if (pkey) { + *pkey = next; + } else { + assert(pvalue); + *pvalue = next; + } + return 1; + bad: + Py_XDECREF(next); +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 + PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef"); +#else + PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef); +#endif + if (pkey) *pkey = NULL; + if (pvalue) *pvalue = NULL; + return 0; +} +#else // !CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) { + int result = PyDict_Next(p, ppos, pkey, pvalue); + if (likely(result == 1)) { + if (pkey) Py_INCREF(*pkey); + if (pvalue) Py_INCREF(*pvalue); + } + return result; +} +#endif + +/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); +} + +/* CallUnboundCMethod2 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, args, 2); + } + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *result = NULL; + PyObject *args = PyTuple_New(2); + if (unlikely(!args)) return NULL; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + return result; + } +#endif + { + PyObject *args[4] = {NULL, self, arg1, arg2}; + return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } +} + +/* ParseKeywordsImpl (used by ParseKeywords) */ +static int __Pyx_ValidateDuplicatePosArgs( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char* function_name) +{ + PyObject ** const *name = argnames; + while (name != first_kw_arg) { + PyObject *key = **name; + int found = PyDict_Contains(kwds, key); + if (unlikely(found)) { + if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; + } + name++; + } + return 0; +bad: + return -1; +} +#if CYTHON_USE_UNICODE_INTERNALS +static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) { + int kind; + Py_ssize_t len = PyUnicode_GET_LENGTH(s1); + if (len != PyUnicode_GET_LENGTH(s2)) return 0; + kind = PyUnicode_KIND(s1); + if (kind != PyUnicode_KIND(s2)) return 0; + const void *data1 = PyUnicode_DATA(s1); + const void *data2 = PyUnicode_DATA(s2); + return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0); +} +#endif +static int __Pyx_MatchKeywordArg_str( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + #if CYTHON_USE_UNICODE_INTERNALS + Py_hash_t key_hash = ((PyASCIIObject*)key)->hash; + if (unlikely(key_hash == -1)) { + key_hash = PyObject_Hash(key); + if (unlikely(key_hash == -1)) + goto bad; + } + #endif + name = first_kw_arg; + while (*name) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) { + *index_found = (size_t) (name - argnames); + return 1; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + *index_found = (size_t) (name - argnames); + return 1; + } + } + #endif + name++; + } + name = argnames; + while (name != first_kw_arg) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) { + if (__Pyx_UnicodeKeywordsEqual(name_str, key)) + goto arg_passed_twice; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + if (unlikely(name_str == key)) goto arg_passed_twice; + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + } + #endif + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +bad: + return -1; +} +static int __Pyx_MatchKeywordArg_nostr( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; + name = first_kw_arg; + while (*name) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (cmp == 1) { + *index_found = (size_t) (name - argnames); + return 1; + } + if (unlikely(cmp == -1)) goto bad; + name++; + } + name = argnames; + while (name != first_kw_arg) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (unlikely(cmp != 0)) { + if (cmp == 1) goto arg_passed_twice; + else goto bad; + } + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +bad: + return -1; +} +static CYTHON_INLINE int __Pyx_MatchKeywordArg( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + return likely(PyUnicode_CheckExact(key)) ? + __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) : + __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name); +} +static void __Pyx_RejectUnknownKeyword( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char *function_name) +{ + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; + #else + Py_ssize_t pos = 0; + #endif + PyObject *key = NULL; + __Pyx_BEGIN_CRITICAL_SECTION(kwds); + while ( + #if CYTHON_AVOID_BORROWED_REFS + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL) + #else + PyDict_Next(kwds, &pos, &key, NULL) + #endif + ) { + PyObject** const *name = first_kw_arg; + while (*name && (**name != key)) name++; + if (!*name) { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp != 1) { + if (cmp == 0) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + break; + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + } + __Pyx_END_CRITICAL_SECTION(); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); + #endif + assert(PyErr_Occurred()); +} +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t extracted = 0; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + name = first_kw_arg; + while (*name && num_kwargs > extracted) { + PyObject * key = **name; + PyObject *value; + int found = 0; + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + found = PyDict_GetItemRef(kwds, key, &value); + #else + value = PyDict_GetItemWithError(kwds, key); + if (value) { + Py_INCREF(value); + found = 1; + } else { + if (unlikely(PyErr_Occurred())) goto bad; + } + #endif + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + extracted++; + } + name++; + } + if (num_kwargs > extracted) { + if (ignore_unknown_kwargs) { + if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1)) + goto bad; + } else { + __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name); + goto bad; + } + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t len; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + if (PyDict_Update(kwds2, kwds) < 0) goto bad; + name = first_kw_arg; + while (*name) { + PyObject *key = **name; + PyObject *value; +#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)) + int found = PyDict_Pop(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int found = PyDict_GetItemRef(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad; + } +#else + #if CYTHON_COMPILING_IN_CPYTHON + value = _PyDict_Pop(kwds2, key, kwds2); + #else + value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2); + #endif + if (value == kwds2) { + Py_DECREF(value); + } else { + if (unlikely(!value)) goto bad; + values[name-argnames] = value; + } +#endif + name++; + } + len = PyDict_Size(kwds2); + if (len > 0) { + return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name); + } else if (unlikely(len == -1)) { + goto bad; + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject *key = NULL; + PyObject** const * name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) { +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); +#else + key = __Pyx_PyTuple_GET_ITEM(kwds, pos); +#endif +#if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!key)) goto bad; +#endif + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + PyObject *value = kwvalues[pos]; + values[name-argnames] = __Pyx_NewRef(value); + } else { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp == 1) { + PyObject *value = kwvalues[pos]; + values[index_found] = __Pyx_NewRef(value); + } else { + if (unlikely(cmp == -1)) goto bad; + if (kwds2) { + PyObject *value = kwvalues[pos]; + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else if (!ignore_unknown_kwargs) { + goto invalid_keyword; + } + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + key = NULL; + #endif + } + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + goto bad; +bad: + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(key); + #endif + return -1; +} + +/* ParseKeywords */ +static int __Pyx_ParseKeywords( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) + return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); + else if (kwds2) + return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name); + else + return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); +} + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* ArgTypeTestFunc (used by ArgTypeTest) */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode; + int from_annotation_subclass = 0; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (!exact) { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } else if (exact == 2) { + if (__Pyx_TypeCheck(obj, type)) { + from_annotation_subclass = 1; + extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately; + } + } + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")" +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + "%s%U" +#endif + , name, type_name, obj_type_name +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + , (from_annotation_subclass ? ". " : ""), extra_info +#endif + ); +#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + if (exact == 2 && from_annotation_subclass) { + PyObject *res; + PyObject *vargs[2]; + vargs[0] = PyErr_GetRaisedException(); + vargs[1] = extra_info; + res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL); + Py_XDECREF(res); + PyErr_SetRaisedException(vargs[0]); + } +#endif + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* RejectKeywords */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) { + PyObject *key = NULL; + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) { + key = __Pyx_PySequence_ITEM(kwds, 0); + } else { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; +#else + Py_ssize_t pos = 0; +#endif +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return; +#endif + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL); +#if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); +#endif + } + if (likely(key)) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + Py_DECREF(key); + } +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#endif + +/* PyObjectFastCallMethod */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { + PyObject *result; + PyObject *attr = PyObject_GetAttr(args[0], name); + if (unlikely(!attr)) + return NULL; + result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); + Py_DECREF(attr); + return result; +} +#endif + +/* PyDictVersioning (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + if (!PyErr_Occurred()) + PyErr_SetNone(PyExc_NameError); + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } + PyErr_Clear(); +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return result; + } +#else + result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyObjectVectorCallKwBuilder (used by PyObjectVectorCallMethodKwBuilder) */ +#if CYTHON_VECTORCALL +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_PyObject_FastCallDict; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + args[n] = value; + return 0; +} +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_VectorcallBuilder_AddArgStr; + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); +} +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + PyObject *pyKey = PyUnicode_FromString(key); + if (!pyKey) return -1; + return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); +} +#else // CYTHON_VECTORCALL +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return PyDict_SetItem(builder, key, value); +} +#endif + +/* PyObjectVectorCallMethodKwBuilder */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) { + PyObject *result; + PyObject *obj = PyObject_GetAttr(args[0], name); + if (unlikely(!obj)) + return NULL; + result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames); + Py_DECREF(obj); + return result; +} +#endif + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* IterFinish */ +static CYTHON_INLINE int __Pyx_IterFinish(void) { + PyObject* exc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (unlikely(exc_type)) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) + return -1; + __Pyx_PyErr_Clear(); + return 0; + } + return 0; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* DictGetItem */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } + } + return value; +} +#endif + +/* PyLongBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) { + return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); +} +#if CYTHON_USE_PYLONG_INTERNALS +static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + const long b = intval; + long a; + const PY_LONG_LONG llb = intval; + PY_LONG_LONG lla; + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op2); + } + const int is_positive = __Pyx_PyLong_IsPos(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + if (likely(size == 1)) { + a = (long) digits[0]; + if (!is_positive) a *= -1; + } else { + switch (size) { + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) a *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) lla *= -1; + goto calculate_long_long; + } + break; + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) a *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) lla *= -1; + goto calculate_long_long; + } + break; + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) a *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) lla *= -1; + goto calculate_long_long; + } + break; + } + return PyLong_Type.tp_as_number->nb_add(op1, op2); + } + calculate_long: + { + long x; + x = a + b; + return PyLong_FromLong(x); + } + calculate_long_long: + { + PY_LONG_LONG llx; + llx = lla + llb; + return PyLong_FromLongLong(llx); + } + +} +#endif +static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) { + CYTHON_UNUSED_VAR(zerodivision_check); + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(float_val); + double result; + + result = ((double)a) + (double)b; + return PyFloat_FromDouble(result); +} +static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(zerodivision_check); + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check); + } + #endif + if (PyFloat_CheckExact(op1)) { + return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check); + } + return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace); +} +#endif + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* SliceObject */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { + __Pyx_TypeName obj_type_name; +#if CYTHON_USE_TYPE_SLOTS + PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyLong_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyLong_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_USE_TYPE_SLOTS + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); +bad: + return NULL; +} + +/* AllocateExtensionType */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) { + if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc); + return alloc_func(t, 0); + } else { + newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc); + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) { + PyObject *new_str = PyUnicode_FromString("__new__"); + if (likely(new_str)) { + PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL); + Py_DECREF(new_str); + return o; + } else + return NULL; + } else + #endif + return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0); + } +} + +/* CallTypeTraverse */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) { + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000 + if (__Pyx_get_runtime_version() < 0x03090000) return 0; + #endif + if (!always_call) { + PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*); + unsigned long flags = PyType_GetFlags(base); + if (flags & Py_TPFLAGS_HEAPTYPE) { + return 0; + } + } + Py_VISIT((PyObject*)Py_TYPE(o)); + return 0; +} +#endif + +/* FunctionExport */ +static int __Pyx_ExportFunction(PyObject *api_dict, const char *name, void (*f)(void), const char *sig) { + PyObject *cobj; + union { + void (*fp)(void); + void *p; + } tmp; + tmp.fp = f; + cobj = PyCapsule_New(tmp.p, sig, 0); + if (!cobj) + goto bad; + if (PyDict_SetItemString(api_dict, name, cobj) < 0) + goto bad; + Py_DECREF(cobj); + return 0; +bad: + Py_XDECREF(cobj); + return -1; +} + +/* GetApiDict */ +static PyObject *__Pyx_ApiExport_GetApiDict(void) { + PyObject *d; + if (__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_capi, &d) == -1) + return NULL; + if (!d) { + d = PyDict_New(); + if (!d) + goto bad; + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_pyx_capi, d) < 0) + goto bad; + } + return d; +bad: + Py_XDECREF(d); + return NULL; +} + +/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static Py_ssize_t __Pyx_GetTypeDictOffset(void) { + PyObject *tp_dictoffset_o; + Py_ssize_t tp_dictoffset; + tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__"); + if (unlikely(!tp_dictoffset_o)) return -1; + tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o); + Py_DECREF(tp_dictoffset_o); + if (unlikely(tp_dictoffset == 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' doesn't have a dictoffset"); + return -1; + } else if (unlikely(tp_dictoffset < 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' has an unexpected negative dictoffset. " + "Please report this as Cython bug"); + return -1; + } + return tp_dictoffset; +} +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) { + static Py_ssize_t tp_dictoffset = 0; + if (unlikely(tp_dictoffset == 0)) { + tp_dictoffset = __Pyx_GetTypeDictOffset(); + if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) { + tp_dictoffset = 0; // try again next time? + return NULL; + } + } + return *(PyObject**)((char*)tp + tp_dictoffset); +} +#endif + +/* SetItemOnTypeDict (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) { + int result; + PyObject *tp_dict; +#if CYTHON_COMPILING_IN_LIMITED_API + tp_dict = __Pyx_GetTypeDict(tp); + if (unlikely(!tp_dict)) return -1; +#else + tp_dict = tp->tp_dict; +#endif + result = PyDict_SetItem(tp_dict, k, v); + if (likely(!result)) { + PyType_Modified(tp); + if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) { + PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL); + if (!setNameResult) return -1; + Py_DECREF(setNameResult); + } + } + return result; +} + +/* FixUpExtensionType */ +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if __PYX_LIMITED_VERSION_HEX > 0x030900B1 + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#else + const PyType_Slot *slot = spec->slots; + int changed = 0; +#if !CYTHON_COMPILING_IN_LIMITED_API + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { +#if !CYTHON_COMPILING_IN_CPYTHON + const +#endif // !CYTHON_COMPILING_IN_CPYTHON) + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_vectorcall_offset = memb->offset; + changed = 1; + } +#endif // CYTHON_METH_FASTCALL +#if !CYTHON_COMPILING_IN_PYPY + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } +#endif // !CYTHON_COMPILING_IN_PYPY + } + memb++; + } + } +#endif // !CYTHON_COMPILING_IN_LIMITED_API +#if !CYTHON_COMPILING_IN_PYPY + slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_getset) + slot++; + if (slot && slot->slot == Py_tp_getset) { + PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc; + while (getset && getset->name) { + if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) { + PyObject *descr = PyDescr_NewGetSet(type, getset); + if (unlikely(!descr)) + return -1; + #if CYTHON_COMPILING_IN_LIMITED_API + PyObject *pyname = PyUnicode_FromString(getset->name); + if (unlikely(!pyname)) { + Py_DECREF(descr); + return -1; + } + int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr); + Py_DECREF(pyname); + #else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + #endif + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } + ++getset; + } + } +#else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#endif // !CYTHON_COMPILING_IN_PYPY + if (changed) + PyType_Modified(type); +#endif // PY_VERSION_HEX > 0x030900B1 + return 0; +} + +/* PyObjectCallNoArg (used by PyObjectCallMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg[2] = {NULL, NULL}; + return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod (used by PyObjectCallMethod0) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } +#endif + *method = attr; + return 0; +} +#endif + +/* PyObjectCallMethod0 (used by PyType_Ready) */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[1] = {obj}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_CallNoArg; + return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +#endif +} + +/* ValidateBasesTuple (used by PyType_Ready) */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_SIZE + n = PyTuple_GET_SIZE(bases); +#else + n = PyTuple_Size(bases); + if (unlikely(n < 0)) return -1; +#endif + for (i = 1; i < n; i++) + { + PyTypeObject *b; +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + if (dictoffset == 0) + { + Py_ssize_t b_dictoffset = 0; +#if CYTHON_USE_TYPE_SLOTS + b_dictoffset = b->tp_dictoffset; +#else + PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__"); + if (!py_b_dictoffset) goto dictoffset_return; + b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset); + Py_DECREF(py_b_dictoffset); + if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return; +#endif + if (b_dictoffset) { + { + __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); + } +#if !CYTHON_USE_TYPE_SLOTS + dictoffset_return: +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + } +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + } + return 0; +} +#endif + +/* PyType_Ready */ +CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) { + while (t) { + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases) { + return 1; + } + t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*); + } + return 0; +} +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + if (!__Pyx_PyType_HasMultipleInheritance(t)) { + return PyType_Ready(t); + } + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\ + !CYTHON_COMPILING_IN_GRAAL + gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* GetVTable (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i=0; + Py_ssize_t size; + void** base_vtables; + __Pyx_TypeName tp_base_name = NULL; + __Pyx_TypeName base_name = NULL; + void* unknown = (void*)-1; + PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); + int base_depth = 0; + { + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (base) { + base_depth += 1; + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; +#if CYTHON_COMPILING_IN_LIMITED_API + size = PyTuple_Size(bases); + if (size < 0) goto other_failure; +#else + size = PyTuple_GET_SIZE(bases); +#endif + for (i = 1; i < size; i++) { + PyObject *basei; + void* base_vtable; +#if CYTHON_AVOID_BORROWED_REFS + basei = PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#else + basei = PyTuple_GET_ITEM(bases, i); +#endif + base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + if (base_vtable != NULL) { + int j; + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + } + PyErr_Clear(); + PyMem_Free(base_vtables); + return 0; +bad: + { + PyTypeObject* basei = NULL; + PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); +#if CYTHON_AVOID_BORROWED_REFS + basei = (PyTypeObject*)PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = (PyTypeObject*)PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#else + basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); +#endif + base_name = __Pyx_PyType_GetFullyQualifiedName(basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + } + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); +#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +really_bad: // bad has failed! +#endif + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +other_failure: +#endif + PyMem_Free(base_vtables); + return -1; +} + +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_2_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size) +{ + PyObject *result = 0; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) + PyObject *py_basicsize; + PyObject *py_itemsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) ) + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; +#else + if (size == 0) { + return (PyTypeObject *)result; + } + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize+itemsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_1 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_1 && (size_t)basicsize > size) { + if (PyErr_WarnFormat(NULL, 0, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize) < 0) { + goto bad; + } + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; +} +#endif + +/* PxdImportShared (used by FunctionImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(PyObject *module, const char *name, void **p, const char *sig, const char *what) { + PyObject *d = 0; + PyObject *cobj = 0; + d = PyObject_GetAttrString(module, "__pyx_capi__"); + if (!d) + goto bad; +#if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000) + PyDict_GetItemStringRef(d, name, &cobj); +#else + cobj = PyDict_GetItemString(d, name); + Py_XINCREF(cobj); +#endif + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%.200s does not export expected C %.8s %.200s", + PyModule_GetName(module), what, name); + goto bad; + } + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C %.8s %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", + what, PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); + goto bad; + } + *p = PyCapsule_GetPointer(cobj, sig); + if (!(*p)) + goto bad; + Py_DECREF(d); + Py_DECREF(cobj); + return 0; +bad: + Py_XDECREF(d); + Py_XDECREF(cobj); + return -1; +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* HasAttr (used by ImportImpl) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!PyUnicode_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (!r) { + return (unlikely(PyErr_Occurred())) ? -1 : 0; + } else { + Py_DECREF(r); + return 1; + } +} +#endif + +/* ImportImpl (used by Import) */ +static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) { + PyObject *imported_module = PyImport_GetModule(qualname); + if (unlikely(!imported_module)) { + *module = NULL; + if (PyErr_Occurred()) { + return -1; + } + return 0; + } + *module = imported_module; + return 1; +} +static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) { + PyObject *imported_module; + PyObject *top_level_package_name; + Py_ssize_t i; + int status, module_found; + Py_ssize_t dot_index; + module_found = __Pyx__Import_GetModule(qualname, &imported_module); + if (unlikely(!module_found || module_found == -1)) { + *module = NULL; + return module_found; + } + if (imported_names) { + for (i = 0; i < len_imported_names; i++) { + PyObject *imported_name = imported_names[i]; +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 + int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name); +#else + int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name); + if (unlikely(has_imported_attribute == -1)) goto error; +#endif + if (!has_imported_attribute) { + goto not_found; + } + } + *module = imported_module; + return 1; + } + dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1); + if (dot_index == -1) { + *module = imported_module; + return 1; + } + if (unlikely(dot_index == -2)) goto error; + top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index); + if (unlikely(!top_level_package_name)) goto error; + Py_DECREF(imported_module); + status = __Pyx__Import_GetModule(top_level_package_name, module); + Py_DECREF(top_level_package_name); + return status; +error: + Py_DECREF(imported_module); + *module = NULL; + return -1; +not_found: + Py_DECREF(imported_module); + *module = NULL; + return 0; +} +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *from_list = 0; + int module_found; + if (!qualname) { + qualname = name; + } + module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module); + if (likely(module_found == 1)) { + return module; + } else if (unlikely(module_found == -1)) { + return NULL; + } + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + if (imported_names) { +#if CYTHON_COMPILING_IN_CPYTHON + from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names); + if (unlikely(!from_list)) + goto bad; +#else + from_list = PyList_New(len_imported_names); + if (unlikely(!from_list)) goto bad; + for (Py_ssize_t i=0; i__pyx_d, level); +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__2); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\ + CYTHON_COMPILING_IN_GRAAL + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); + } + return value; +} + +/* dict_setdefault (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + PyObject *args[] = {d, key, default_value}; + value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#elif CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#else + value = PyDict_SetDefault(d, key, default_value); + if (unlikely(!value)) return NULL; + Py_INCREF(value); +#endif + return value; +} + +/* AddModuleRef (used by FetchSharedCythonModule) */ +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { + PyObject *module_dict = PyImport_GetModuleDict(); + PyObject *m; + if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { + return NULL; + } + if (m != NULL && PyModule_Check(m)) { + return m; + } + Py_XDECREF(m); + m = PyModule_NewObject(name); + if (m == NULL) + return NULL; + if (PyDict_CheckExact(module_dict)) { + PyObject *new_m; + (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); + Py_DECREF(m); + return new_m; + } else { + if (PyObject_SetItem(module_dict, name, m) != 0) { + Py_DECREF(m); + return NULL; + } + return m; + } + } + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *py_name = PyUnicode_FromString(name); + if (!py_name) return NULL; + PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); + Py_DECREF(py_name); + return module; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } +#endif + +/* FetchSharedCythonModule (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME); +} + +/* FetchCommonType (used by CommonTypesMetaclass) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases); + if (result && metaclass) { + PyObject *old_tp = (PyObject*)Py_TYPE(result); + Py_INCREF((PyObject*)metaclass); +#if __PYX_LIMITED_VERSION_HEX >= 0x03090000 + Py_SET_TYPE(result, metaclass); +#else + result->ob_type = metaclass; +#endif + Py_DECREF(old_tp); + } + return result; +} +#else +#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b) +#endif +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t expected_basicsize) { + Py_ssize_t basicsize; + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (expected_basicsize == 0) { + return 0; // size is inherited, nothing useful to check + } +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) return -1; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = NULL; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; +#else + basicsize = ((PyTypeObject*) cached_type)->tp_basicsize; +#endif + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name; + int get_item_ref_result; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + py_object_name = PyUnicode_FromString(object_name); + if (!py_object_name) return NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) goto done; + abi_module_dict = PyModule_GetDict(abi_module); + if (!abi_module_dict) goto done; + get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type); + if (get_item_ref_result == 1) { + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else if (unlikely(get_item_ref_result == -1)) { + goto bad; + } + cached_type = __Pyx_PyType_FromMetaclass( + metaclass, + CYTHON_USE_MODULE_STATE ? module : abi_module, + spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type); + if (unlikely(new_cached_type != cached_type)) { + if (unlikely(!new_cached_type)) goto bad; + Py_DECREF(cached_type); + cached_type = new_cached_type; + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else { + Py_DECREF(new_cached_type); + } +done: + Py_XDECREF(abi_module); + Py_DECREF(py_object_name); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +/* CommonTypesMetaclass (used by CythonFunctionShared) */ +static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) { + return PyUnicode_FromString(__PYX_ABI_MODULE_NAME); +} +#if __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) { + PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types"); + return NULL; +} +static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) { + PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable"); + return -1; +} +#endif +static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = { + {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = { + {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset}, + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr}, + #endif + {0, 0} +}; +static PyType_Spec __pyx_CommonTypesMetaclass_spec = { + __PYX_TYPE_MODULE_PREFIX "_common_types_metatype", + 0, + 0, + Py_TPFLAGS_IMMUTABLETYPE | + Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT, + __pyx_CommonTypesMetaclass_slots +}; +static int __pyx_CommonTypesMetaclass_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + PyObject *bases = PyTuple_Pack(1, &PyType_Type); + if (unlikely(!bases)) { + return -1; + } + mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases); + Py_DECREF(bases); + if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) { + return -1; + } + return 0; +} + +/* PyMethodNew (used by CythonFunctionShared) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *result; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + { + PyObject *args[] = {func, self}; + result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL); + } + #else + result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL); + #endif + return result; +} +#else +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#endif + +/* PyVectorcallFastCallDict (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i; + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos; + #else + Py_ssize_t pos; + #endif + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + #if !CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t nkw = PyDict_Size(kw); + if (unlikely(nkw == -1)) return NULL; + #else + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + #endif + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = 0; + i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) { + keys_are_strings &= + #if CYTHON_COMPILING_IN_LIMITED_API + PyType_GetFlags(Py_TYPE(key)); + #else + Py_TYPE(key)->tp_flags; + #endif + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup; + #else + PyTuple_SET_ITEM(kwnames, i, key); + #endif + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(pos); + #endif + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + Py_ssize_t kw_size = + likely(kw == NULL) ? + 0 : +#if !CYTHON_ASSUME_SAFE_SIZE + PyDict_Size(kw); +#else + PyDict_GET_SIZE(kw); +#endif + if (kw_size == 0) { + return vc(func, args, nargs, NULL); + } +#if !CYTHON_ASSUME_SAFE_SIZE + else if (unlikely(kw_size == -1)) { + return NULL; + } +#endif + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif + +/* CythonFunctionShared (used by CythonFunction) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) { + if (__Pyx_CyFunction_Check(func)) { + return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; + } else if (PyCFunction_Check(func)) { + return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; + } + return 0; +} +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) { + int result; + PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func); + if (unlikely(!newFunc)) { + PyErr_Clear(); // It's only an optimization, so don't throw an error + return 0; + } + result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc); + Py_DECREF(newFunc); + return result; + } + return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc); +} +#else +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if (PyMethod_Check(func)) { + func = PyMethod_GET_FUNCTION(func); + } + return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +} +#endif +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + PyObject *result; + CYTHON_UNUSED_VAR(closure); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_doc_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#else + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_name_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_name, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + PyObject *result; + __Pyx_BEGIN_CRITICAL_SECTION(op); + Py_INCREF(op->func_qualname); + result = op->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +#endif +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_defaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_kwdefaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_annotations_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) { + int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; + if (is_coroutine) { + PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(is_coroutine_value)) { + return is_coroutine_value; + } +ignore: + PyErr_Clear(); + } + return __Pyx_PyBool_FromLong(is_coroutine); +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + result = __Pyx_CyFunction_get_is_coroutine_value(op); + if (unlikely(!result)) + return NULL; + __Pyx_BEGIN_CRITICAL_SECTION(op); + if (op->func_is_coroutine) { + Py_DECREF(result); + result = __Pyx_NewRef(op->func_is_coroutine); + } else { + op->func_is_coroutine = __Pyx_NewRef(result); + } + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, message, size); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + name, message, size); +#endif +} +static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s", + py_name, message); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s", + name, message); +#endif +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, +#else + {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, +#endif + {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#endif +#if CYTHON_METH_FASTCALL +#if CYTHON_COMPILING_IN_LIMITED_API + {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else + {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(args); + __Pyx_BEGIN_CRITICAL_SECTION(m); + Py_INCREF(m->func_qualname); + result = m->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + op->func_dict = NULL; +#endif + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func_dict); +#elif PY_VERSION_HEX < 0x030d0000 + _PyObject_ClearManagedDict((PyObject*)m); +#else + PyObject_ClearManagedDict((PyObject*)m); +#endif + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + Py_CLEAR(m->defaults); + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + { + int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg); + if (e) return e; + } + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func_dict); +#else + { + int e = +#if PY_VERSION_HEX < 0x030d0000 + _PyObject_VisitManagedDict +#else + PyObject_VisitManagedDict +#endif + ((PyObject*)m, visit, arg); + if (e != 0) return e; + } +#endif + __Pyx_VISIT_CONST(m->func_name); + __Pyx_VISIT_CONST(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + __Pyx_VISIT_CONST(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + Py_VISIT(m->defaults); + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ + PyObject *repr; + __Pyx_BEGIN_CRITICAL_SECTION(op); + repr = PyUnicode_FromFormat("", + op->func_qualname, (void *)op); + __Pyx_END_CRITICAL_SECTION(); + return repr; +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes no arguments", size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes exactly one argument", size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } + __Pyx_CyFunction_raise_type_error( + (__pyx_CyFunctionObject*)func, "takes no keyword arguments"); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_SIZE + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(argc < 0)) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "needs an argument"); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "takes no keyword arguments"); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes no arguments", nargs); + return NULL; + } + return meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes exactly one argument", nargs); + return NULL; + } + return meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + #if PY_VERSION_HEX < 0x030e00A6 + size_t nargs_value = (size_t) nargs; + #else + Py_ssize_t nargs_value = nargs; + #endif + return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames); +} +#endif +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if CYTHON_METH_FASTCALL +#if defined(Py_TPFLAGS_HAVE_VECTORCALL) + Py_TPFLAGS_HAVE_VECTORCALL | +#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif +#endif // CYTHON_METH_FASTCALL +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_DICT | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +static int __pyx_CyFunction_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL); + if (unlikely(mstate->__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type); + if (unlikely(!m->defaults)) + return NULL; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* GetNameInClass */ +static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) { + PyObject *result; + PyObject *dict; + assert(PyType_Check(nmspace)); +#if CYTHON_USE_TYPE_SLOTS + dict = ((PyTypeObject*)nmspace)->tp_dict; + Py_XINCREF(dict); +#else + dict = PyObject_GetAttr(nmspace, __pyx_mstate_global->__pyx_n_u_dict); +#endif + if (likely(dict)) { + result = PyObject_GetItem(dict, name); + Py_DECREF(dict); + if (result) { + return result; + } + } + PyErr_Clear(); + __Pyx_GetModuleGlobalNameUncached(result, name); + return result; +} + +/* CLineInTraceback (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) +#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); +#else +PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { + PyObject **dict_ptr = _PyObject_GetDictPtr(o); + return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; +} +#endif +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline = NULL; + PyObject *ptype, *pvalue, *ptraceback; + PyObject *cython_runtime_dict; + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, cython_runtime_dict, + __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) + } + if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + Py_XDECREF(use_cline); + Py_XDECREF(cython_runtime_dict); + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache (used by AddTraceback) */ +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { + __Pyx_CachedCodeObjectType* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!code_cache->entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { + return NULL; + } + code_object = code_cache->entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__find_code_object; + return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); + if (old_count < 0) { + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); + return NULL; + } +#endif + __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); +#endif + return result; +#endif +} +static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) +{ + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + code_cache->entries = entries; + code_cache->max_count = 64; + code_cache->count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { + __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_INCREF(code_object); + Py_DECREF(tmp); + return; + } + if (code_cache->count == code_cache->max_count) { + int new_max = code_cache->max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + code_cache->entries = entries; + code_cache->max_count = new_max; + } + for (i=code_cache->count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + code_cache->count++; + Py_INCREF(code_object); +} +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__insert_code_object; + return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type expected = 0; + if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { + return; + } +#endif + __pyx__insert_code_object(code_cache, code_line, code_object); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); +#endif +#endif +} + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!code_object) { + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + } else { + py_funcname = PyUnicode_FromString(funcname); + } + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); + } else { + dict = PyDict_New(); + } + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + } + py_code = PyCode_NewEmpty(filename, funcname, py_line); + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} +#endif + +/* CIntFromPyVerify */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_float(a, a); + case 3: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); + case 4: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powf(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2f(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_double(a, a); + case 3: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); + case 4: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = pow(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return ::std::complex< long double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + __pyx_t_long_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsl(b.real) >= fabsl(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + long double r = b.imag / b.real; + long double s = (long double)(1.0) / (b.real + b.imag * r); + return __pyx_t_long_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + long double r = b.real / b.imag; + long double s = (long double)(1.0) / (b.imag + b.real * r); + return __pyx_t_long_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + long double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_long_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtl(z.real*z.real + z.imag*z.imag); + #else + return hypotl(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + long double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + long double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_long__double(a, a); + case 3: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, a); + case 4: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powl(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2l(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_long__double(a); + theta = atan2l(a.imag, a.real); + } + lnr = logl(r); + z_r = expl(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosl(z_theta); + z.imag = z_r * sinl(z_theta); + return z; + } + #endif +#endif + +/* CIntFromPy */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyLong_As_uint64_t(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint64_t val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(uint64_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((uint64_t) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (uint64_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(uint64_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint64_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(enum __pyx_t_5spacy_5attrs_attr_id_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum __pyx_t_5spacy_5attrs_attr_id_t neg_one = (enum __pyx_t_5spacy_5attrs_attr_id_t) -1, const_zero = (enum __pyx_t_5spacy_5attrs_attr_id_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + int val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (int) -1; + val = __Pyx_PyLong_As_int(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(int) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + int val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (int) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = v; + } + v = NULL; + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((int) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (int) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static __Pyx_TypeName +__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) +{ + PyObject *module = NULL, *name = NULL, *result = NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_qualname); + #else + name = PyType_GetQualName(tp); + #endif + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; + module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_module); + if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; + if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { + result = name; + name = NULL; + goto done; + } + result = PyUnicode_FromFormat("%U.%U", module, name); + if (unlikely(result == NULL)) goto bad; + done: + Py_XDECREF(name); + Py_XDECREF(module); + return result; + bad: + PyErr_Clear(); + if (name) { + result = name; + name = NULL; + } else { + result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__7); + } + goto done; +} +#endif + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + long val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (long) -1; + val = __Pyx_PyLong_As_long(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + long val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (long) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (long) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = v; + } + v = NULL; + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((long) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (long) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); + for (i=0; i>= 8; + ++i; + } + __Pyx_cached_runtime_version = version; + } +} +#endif +static unsigned long __Pyx_get_runtime_version(void) { +#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + return Py_Version & ~0xFFUL; +#else + return __Pyx_cached_runtime_version; +#endif +} + +/* CheckBinaryVersion */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { + const unsigned long MAJOR_MINOR = 0xFFFF0000UL; + if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) + return 0; + if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) + return 1; + { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compile time Python version %d.%d " + "of module '%.100s' " + "%s " + "runtime version %d.%d", + (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), + __Pyx_MODULE_NAME, + (allow_newer) ? "was newer than" : "does not match", + (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) + ); + return PyErr_WarnEx(NULL, message, 1); + } +} + +/* NewCodeObj */ +#if CYTHON_COMPILING_IN_LIMITED_API + static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + PyObject *version_info; + PyObject *py_minor_version = NULL; + #endif + long minor_version = 0; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + minor_version = 11; + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + Py_DECREF(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + if (type) { + PyErr_Restore(type, value, traceback); + } + return result; + } +#elif PY_VERSION_HEX >= 0x030B0000 + static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1 + if (likely(result)) + result->_co_firsttraceable = 0; + #endif + return result; + } +#elif !CYTHON_COMPILING_IN_PYPY + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +) { + PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL; + Py_ssize_t var_count = (Py_ssize_t) descr.nlocals; + PyObject *varnames_tuple = PyTuple_New(var_count); + if (unlikely(!varnames_tuple)) return NULL; + for (Py_ssize_t i=0; i < var_count; i++) { + Py_INCREF(varnames[i]); + if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done; + } + #if CYTHON_COMPILING_IN_LIMITED_API + varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple); + if (!varnames_tuple_dedup) { + if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done; + varnames_tuple_dedup = varnames_tuple; + } + #else + varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple); + if (unlikely(!varnames_tuple_dedup)) goto done; + #endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(varnames_tuple_dedup); + #endif + if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) { + Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(line_table_length == -1)) goto done; + #endif + Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL; + code_bytes = PyBytes_FromStringAndSize(NULL, code_len); + if (unlikely(!code_bytes)) goto done; + char* c_code_bytes = PyBytes_AsString(code_bytes); + if (unlikely(!c_code_bytes)) goto done; + memset(c_code_bytes, 0, (size_t) code_len); + } + code_obj = (PyObject*) __Pyx__PyCode_New( + (int) descr.argcount, + (int) descr.num_posonly_args, + (int) descr.num_kwonly_args, + (int) descr.nlocals, + 0, + (int) descr.flags, + code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + varnames_tuple_dedup, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + filename, + funcname, + (int) descr.first_line, + (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes + ); +done: + Py_XDECREF(code_bytes); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(varnames_tuple_dedup); + #endif + Py_DECREF(varnames_tuple); + return code_obj; +} + +/* DecompressString */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { + PyObject *module, *decompress, *compressed_bytes, *decompressed; + const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; + PyObject *methodname = PyUnicode_FromString("decompress"); + if (unlikely(!methodname)) return NULL; + #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 + if (algo == 3) { + PyObject *fromlist = Py_BuildValue("[O]", methodname); + if (unlikely(!fromlist)) return NULL; + module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + } else + #endif + module = PyImport_ImportModule(module_name); + if (unlikely(!module)) goto import_failed; + decompress = PyObject_GetAttr(module, methodname); + if (unlikely(!decompress)) goto import_failed; + { + #ifdef __cplusplus + char *memview_bytes = const_cast(s); + #else + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wcast-qual" + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-qual" + #endif + char *memview_bytes = (char*) s; + #if defined(__clang__) + #pragma clang diagnostic pop + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + #endif + #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) + int memview_flags = 0x100; + #else + int memview_flags = PyBUF_READ; + #endif + compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); + } + if (unlikely(!compressed_bytes)) { + Py_DECREF(decompress); + goto bad; + } + decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); + Py_DECREF(compressed_bytes); + Py_DECREF(decompress); + Py_DECREF(module); + Py_DECREF(methodname); + return decompressed; +import_failed: + PyErr_Format(PyExc_ImportError, + "Failed to import '%.20s.decompress' - cannot initialise module strings. " + "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", + module_name, algo); +bad: + Py_XDECREF(module); + Py_DECREF(methodname); + return NULL; +} + +#include +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return __Pyx_PyUnicode_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return PyByteArray_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + { + const char* result; + Py_ssize_t unicode_length; + CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; + #else + result = PyUnicode_AsUTF8AndSize(o, length); + #endif + #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + unicode_length = PyUnicode_GetLength(o); + if (unlikely(unicode_length < 0)) return NULL; + if (unlikely(unicode_length != *length)) { + PyUnicode_AsASCIIString(o); + return NULL; + } + #endif + return result; + } +#else +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +#endif +} +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + if (PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif + if (PyByteArray_Check(o)) { +#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); +#else + *length = PyByteArray_Size(o); + if (*length == -1) return NULL; + return PyByteArray_AsString(o); +#endif + } else + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; + } + __Pyx_DECREF_TypeName(result_type_name); + return result; + } + PyErr_Format(PyExc_TypeError, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", + result_type_name); + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + PyObject *res = NULL; + if (likely(PyLong_Check(x))) + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + if (likely(m && m->nb_int)) { + res = m->nb_int(x); + } +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Long(x); + } +#endif + if (likely(res)) { + if (unlikely(!PyLong_CheckExact(res))) { + return __Pyx_PyNumber_LongWrongResultType(res); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); + } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyLong_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyLong_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { + CYTHON_UNUSED_VAR(b); + return __Pyx_NewRef(Py_None); +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return __Pyx_NewRef(b ? Py_True: Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { + return PyLong_FromSize_t(ival); +} + + +/* MultiPhaseInitModuleState */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 +#else + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 +#endif +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS +#error "Module state with PEP489 requires atomics. Currently that's one of\ + C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" +#endif +#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#define __Pyx_ModuleStateLookup_Lock() +#define __Pyx_ModuleStateLookup_Unlock() +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 +static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; +#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(__cplusplus) && __cplusplus >= 201103L +#include +static std::mutex __Pyx_ModuleStateLookup_mutex; +#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() +#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) +#include +static mtx_t __Pyx_ModuleStateLookup_mutex; +static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; +static void __Pyx_ModuleStateLookup_initialize_mutex(void) { + mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); +} +#define __Pyx_ModuleStateLookup_Lock()\ + call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ + mtx_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(HAVE_PTHREAD_H) +#include +static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; +#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(_WIN32) +#include // synchapi.h on its own doesn't work +static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; +#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#else +#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ + Requires C standard >= C11, or C++ standard >= C++11,\ + or pthreads, or the Windows 32 API, or Python >= 3.13." +#endif +typedef struct { + int64_t id; + PyObject *module; +} __Pyx_InterpreterIdAndModule; +typedef struct { + char interpreter_id_as_index; + Py_ssize_t count; + Py_ssize_t allocated; + __Pyx_InterpreterIdAndModule table[1]; +} __Pyx_ModuleStateLookupData; +#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; +#else +static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; +#endif +static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( + __Pyx_InterpreterIdAndModule* table, + Py_ssize_t count, + int64_t interpreterId) { + __Pyx_InterpreterIdAndModule* begin = table; + __Pyx_InterpreterIdAndModule* end = begin + count; + if (begin->id == interpreterId) { + return begin; + } + while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; + if (halfway->id == interpreterId) { + return halfway; + } + if (halfway->id < interpreterId) { + begin = halfway; + } else { + end = halfway; + } + } + for (; begin < end; ++begin) { + if (begin->id >= interpreterId) return begin; + } + return begin; +} +static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return NULL; +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + { + __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + if (likely(data)) { + __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); + if (likely(data == new_data)) { + goto read_finished; + } + } + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + __Pyx_ModuleStateLookup_Lock(); + __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); + data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + __Pyx_ModuleStateLookup_Unlock(); + } + read_finished:; +#else + __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_InterpreterIdAndModule* found = NULL; + if (unlikely(!data)) goto end; + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + found = data->table+interpreter_id; + } + } else { + found = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + } + end: + { + PyObject *result=NULL; + if (found && found->id == interpreter_id) { + result = found->module; + } +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); +#endif + return result; + } +} +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { + while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); +} +#else +#define __Pyx_ModuleStateLookup_wait_until_no_readers() +#endif +static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { + Py_ssize_t to_allocate = (*old_data)->allocated; + while (to_allocate <= interpreter_id) { + if (to_allocate == 0) to_allocate = 1; + else to_allocate *= 2; + } + __Pyx_ModuleStateLookupData *new_data = *old_data; + if (to_allocate != (*old_data)->allocated) { + new_data = (__Pyx_ModuleStateLookupData *)realloc( + *old_data, + sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + PyErr_NoMemory(); + return -1; + } + for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { + new_data->table[i].id = i; + new_data->table[i].module = NULL; + } + new_data->allocated = to_allocate; + } + new_data->table[interpreter_id].module = module; + if (new_data->count < interpreter_id+1) { + new_data->count = interpreter_id+1; + } + *old_data = new_data; + return 0; +} +static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { + __Pyx_InterpreterIdAndModule *read = data->table; + __Pyx_InterpreterIdAndModule *write = data->table; + __Pyx_InterpreterIdAndModule *end = read + data->count; + for (; readmodule) { + write->id = read->id; + write->module = read->module; + ++write; + } + } + data->count = write - data->table; + for (; writeid = 0; + write->module = NULL; + } + data->interpreter_id_as_index = 0; +} +static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + int result = 0; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_ModuleStateLookupData *new_data = old_data; + if (!new_data) { + new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); + if (!new_data) { + result = -1; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = 1; + new_data->interpreter_id_as_index = 1; + } + __Pyx_ModuleStateLookup_wait_until_no_readers(); + if (new_data->interpreter_id_as_index) { + if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); + goto end; + } + __Pyx_State_ConvertFromInterpIdAsIndex(new_data); + } + { + Py_ssize_t insert_at = 0; + { + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + new_data->table, new_data->count, interpreter_id); + assert(lower_bound); + insert_at = lower_bound - new_data->table; + if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { + lower_bound->module = module; + goto end; // already in table, nothing more to do + } + } + if (new_data->count+1 >= new_data->allocated) { + Py_ssize_t to_allocate = (new_data->count+1)*2; + new_data = + (__Pyx_ModuleStateLookupData*)realloc( + new_data, + sizeof(__Pyx_ModuleStateLookupData) + + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + result = -1; + new_data = old_data; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = to_allocate; + } + ++new_data->count; + int64_t last_id = interpreter_id; + PyObject *last_module = module; + for (Py_ssize_t i=insert_at; icount; ++i) { + int64_t current_id = new_data->table[i].id; + new_data->table[i].id = last_id; + last_id = current_id; + PyObject *current_module = new_data->table[i].module; + new_data->table[i].module = last_module; + last_module = current_module; + } + } + end: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); +#else + __Pyx_ModuleStateLookup_data = new_data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return result; +} +static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; +#endif + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + data->table[interpreter_id].module = NULL; + } + goto done; + } + { + __Pyx_ModuleStateLookup_wait_until_no_readers(); + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + if (!lower_bound) goto done; + if (lower_bound->id != interpreter_id) goto done; + __Pyx_InterpreterIdAndModule *end = data->table+data->count; + for (;lower_boundid = (lower_bound+1)->id; + lower_bound->module = (lower_bound+1)->module; + } + } + --data->count; + if (data->count == 0) { + free(data); + data = NULL; + } + done: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); +#else + __Pyx_ModuleStateLookup_data = data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return 0; +} +#endif + +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ +#endif /* Py_PYTHON_H */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/morphology.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/morphology.pxd new file mode 100644 index 0000000000000000000000000000000000000000..95c4a2c787b9b5e811df6d2271624636886da932 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/morphology.pxd @@ -0,0 +1,27 @@ +cimport numpy as np +from cymem.cymem cimport Pool +from libc.stdint cimport uint64_t +from preshed.maps cimport PreshMap + +from .strings cimport StringStore +from .structs cimport MorphAnalysisC +from .typedefs cimport attr_t, hash_t + + +cdef class Morphology: + cdef readonly Pool mem + cdef readonly StringStore strings + cdef PreshMap tags # Keyed by hash, value is pointer to tag + + cdef MorphAnalysisC create_morph_tag(self, field_feature_pairs) except * + cdef int insert(self, MorphAnalysisC tag) except -1 + + +cdef int check_feature(const MorphAnalysisC* morph, attr_t feature) nogil +cdef list list_features(const MorphAnalysisC* morph) +cdef np.ndarray get_by_field(const MorphAnalysisC* morph, attr_t field) +cdef int get_n_by_field( + attr_t* results, + const MorphAnalysisC* morph, + attr_t field, +) nogil diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/morphology.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/morphology.pyx new file mode 100644 index 0000000000000000000000000000000000000000..7b93c0f2821acca832cc4e39b2c7e4a213eb85df --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/morphology.pyx @@ -0,0 +1,206 @@ +# cython: infer_types +# cython: profile=False +import warnings + +import numpy + +from .attrs cimport POS + +from . import symbols +from .errors import Warnings +from .parts_of_speech import IDS as POS_IDS + + +cdef class Morphology: + """Store the possible morphological analyses for a language, and index them + by hash. + + To save space on each token, tokens only know the hash of their + morphological analysis, so queries of morphological attributes are delegated + to this class. + """ + FEATURE_SEP = "|" + FIELD_SEP = "=" + VALUE_SEP = "," + # not an empty string so we can distinguish unset morph from empty morph + EMPTY_MORPH = symbols.NAMES[symbols._] + + def __init__(self, StringStore strings): + self.mem = Pool() + self.strings = strings + self.tags = PreshMap() + + def __reduce__(self): + tags = set([self.get(self.strings[s]) for s in self.strings]) + tags -= set([""]) + return (unpickle_morphology, (self.strings, sorted(tags)), None, None) + + def add(self, features): + """Insert a morphological analysis in the morphology table, if not + already present. The morphological analysis may be provided in the UD + FEATS format as a string or in the tag map dict format. + Returns the hash of the new analysis. + """ + cdef MorphAnalysisC* tag_ptr + if isinstance(features, str): + if features == "": + features = self.EMPTY_MORPH + tag_ptr = self.tags.get(self.strings[features]) + if tag_ptr != NULL: + return tag_ptr.key + features = self.feats_to_dict(features) + if not isinstance(features, dict): + warnings.warn(Warnings.W100.format(feature=features)) + features = {} + string_features = {self.strings.as_string(field): self.strings.as_string(values) for field, values in features.items()} + # intified ("Field", "Field=Value") pairs + field_feature_pairs = [] + for field in sorted(string_features): + values = string_features[field] + self.strings.add(field, allow_transient=False), + field_id = self.strings[field] + for value in values.split(self.VALUE_SEP): + field_sep_value = field + self.FIELD_SEP + value + self.strings.add(field_sep_value, allow_transient=False), + field_feature_pairs.append(( + field_id, + self.strings[field_sep_value] + )) + cdef MorphAnalysisC tag = self.create_morph_tag(field_feature_pairs) + # the hash key for the tag is either the hash of the normalized UFEATS + # string or the hash of an empty placeholder + norm_feats_string = self.normalize_features(features) + tag.key = self.strings.add(norm_feats_string, allow_transient=False) + self.insert(tag) + return tag.key + + def normalize_features(self, features): + """Create a normalized FEATS string from a features string or dict. + + features (Union[dict, str]): Features as dict or UFEATS string. + RETURNS (str): Features as normalized UFEATS string. + """ + if isinstance(features, str): + features = self.feats_to_dict(features) + if not isinstance(features, dict): + warnings.warn(Warnings.W100.format(feature=features)) + features = {} + features = self.normalize_attrs(features) + string_features = {self.strings.as_string(field): self.strings.as_string(values) for field, values in features.items()} + # normalized UFEATS string with sorted fields and values + norm_feats_string = self.FEATURE_SEP.join( + sorted( + [self.FIELD_SEP.join([field, values]) for field, values in string_features.items()] + ) + ) + return norm_feats_string or self.EMPTY_MORPH + + def normalize_attrs(self, attrs): + """Convert attrs dict so that POS is always by ID, other features are + by string. Values separated by VALUE_SEP are sorted. + """ + out = {} + attrs = dict(attrs) + for key, value in attrs.items(): + # convert POS value to ID + if key == POS or (isinstance(key, str) and key.upper() == "POS"): + if isinstance(value, str) and value.upper() in POS_IDS: + value = POS_IDS[value.upper()] + elif isinstance(value, int) and value not in POS_IDS.values(): + warnings.warn(Warnings.W100.format(feature={key: value})) + continue + out[POS] = value + # accept any string or ID fields and values and convert to strings + elif isinstance(key, (int, str)) and isinstance(value, (int, str)): + key = self.strings.as_string(key) + value = self.strings.as_string(value) + # sort values + if self.VALUE_SEP in value: + value = self.VALUE_SEP.join(sorted(value.split(self.VALUE_SEP))) + out[key] = value + else: + warnings.warn(Warnings.W100.format(feature={key: value})) + return out + + cdef MorphAnalysisC create_morph_tag(self, field_feature_pairs) except *: + """Creates a MorphAnalysisC from a list of intified + ("Field", "Field=Value") tuples where fields with multiple values have + been split into individual tuples, e.g.: + [("Field1", "Field1=Value1"), ("Field1", "Field1=Value2"), + ("Field2", "Field2=Value3")] + """ + cdef MorphAnalysisC tag + tag.length = len(field_feature_pairs) + if tag.length > 0: + tag.fields = self.mem.alloc(tag.length, sizeof(attr_t)) + tag.features = self.mem.alloc(tag.length, sizeof(attr_t)) + for i, (field, feature) in enumerate(field_feature_pairs): + tag.fields[i] = field + tag.features[i] = feature + return tag + + cdef int insert(self, MorphAnalysisC tag) except -1: + cdef hash_t key = tag.key + if self.tags.get(key) == NULL: + tag_ptr = self.mem.alloc(1, sizeof(MorphAnalysisC)) + tag_ptr[0] = tag + self.tags.set(key, tag_ptr) + + def get(self, hash_t morph): + tag = self.tags.get(morph) + if tag == NULL: + return "" + else: + return self.strings[tag.key] + + @staticmethod + def feats_to_dict(feats): + if not feats or feats == Morphology.EMPTY_MORPH: + return {} + return {field: Morphology.VALUE_SEP.join(sorted(values.split(Morphology.VALUE_SEP))) for field, values in + [feat.split(Morphology.FIELD_SEP) for feat in feats.split(Morphology.FEATURE_SEP)]} + + @staticmethod + def dict_to_feats(feats_dict): + if len(feats_dict) == 0: + return "" + return Morphology.FEATURE_SEP.join(sorted([Morphology.FIELD_SEP.join([field, Morphology.VALUE_SEP.join(sorted(values.split(Morphology.VALUE_SEP)))]) for field, values in feats_dict.items()])) + + +cdef int check_feature(const MorphAnalysisC* morph, attr_t feature) nogil: + cdef int i + for i in range(morph.length): + if morph.features[i] == feature: + return True + return False + + +cdef list list_features(const MorphAnalysisC* morph): + cdef int i + features = [] + for i in range(morph.length): + features.append(morph.features[i]) + return features + + +cdef np.ndarray get_by_field(const MorphAnalysisC* morph, attr_t field): + cdef np.ndarray results = numpy.zeros((morph.length,), dtype="uint64") + n = get_n_by_field(results.data, morph, field) + return results[:n] + + +cdef int get_n_by_field(attr_t* results, const MorphAnalysisC* morph, attr_t field) nogil: + cdef int n_results = 0 + cdef int i + for i in range(morph.length): + if morph.fields[i] == field: + results[n_results] = morph.features[i] + n_results += 1 + return n_results + + +def unpickle_morphology(strings, tags): + cdef Morphology morphology = Morphology(strings) + for tag in tags: + morphology.add(tag) + return morphology diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/parts_of_speech.cp312-win_amd64.pyd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/parts_of_speech.cp312-win_amd64.pyd new file mode 100644 index 0000000000000000000000000000000000000000..85538126d090eb8e6ed62409423c7ed3515899ef Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/parts_of_speech.cp312-win_amd64.pyd differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/parts_of_speech.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/parts_of_speech.cpp new file mode 100644 index 0000000000000000000000000000000000000000..daeb9c335d2382a6e70148d624e976ea8b4cd948 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/parts_of_speech.cpp @@ -0,0 +1,7301 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.parts_of_speech", + "sources": [ + "spacy/parts_of_speech.pyx" + ] + }, + "module_name": "spacy.parts_of_speech" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +/* InitLimitedAPI */ +#if defined(Py_LIMITED_API) + #if !defined(CYTHON_LIMITED_API) + #define CYTHON_LIMITED_API 1 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef _MSC_VER + #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") + #else + #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. + #endif +#endif + +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x03080000 + #error Cython requires Python 3.8+. +#else +#define __PYX_ABI_VERSION "3_2_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* CModulePreamble */ +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#define __PYX_COMMA , +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) + #endif + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 1 + #endif + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #ifdef Py_GIL_DISABLED + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 + #else + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #endif + #if PY_VERSION_HEX < 0x030A0000 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #elif !defined(CYTHON_USE_TYPE_SLOTS) + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLIST_INTERNALS) + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #elif !defined(CYTHON_FAST_GIL) + #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #ifndef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif + #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work + #elif !defined(CYTHON_IMMORTAL_CONSTANTS) + #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif +#endif +#ifndef CYTHON_COMPRESS_STRINGS + #define CYTHON_COMPRESS_STRINGS 1 +#endif +#ifndef CYTHON_FAST_PYCCALL +#define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL +#endif +#ifndef CYTHON_VECTORCALL +#if CYTHON_COMPILING_IN_LIMITED_API +#define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) +#else +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) +#endif +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#include +typedef uintptr_t __pyx_uintptr_t; +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif +#ifndef Py_UNREACHABLE + #define Py_UNREACHABLE() assert(0); abort() +#endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* PythonCompatibility */ +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#define __Pyx_BUILTIN_MODULE_NAME "builtins" +#define __Pyx_DefaultClassType PyType_Type +#if CYTHON_COMPILING_IN_LIMITED_API + #ifndef CO_OPTIMIZED + static int CO_OPTIMIZED; + #endif + #ifndef CO_NEWLOCALS + static int CO_NEWLOCALS; + #endif + #ifndef CO_VARARGS + static int CO_VARARGS; + #endif + #ifndef CO_VARKEYWORDS + static int CO_VARKEYWORDS; + #endif + #ifndef CO_ASYNC_GENERATOR + static int CO_ASYNC_GENERATOR; + #endif + #ifndef CO_GENERATOR + static int CO_GENERATOR; + #endif + #ifndef CO_COROUTINE + static int CO_COROUTINE; + #endif +#else + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 + #endif +#endif +static int __Pyx_init_co_variables(void); +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif +#ifndef Py_TPFLAGS_IMMUTABLETYPE + #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) +#endif +#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION + #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) +#endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#ifndef METH_FASTCALL + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #if PY_VERSION_HEX >= 0x030d00A4 + # define __Pyx_PyCFunctionFast PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords + #else + # define __Pyx_PyCFunctionFast _PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords + #endif +#endif +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX >= 0x030900B1 +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) +#else +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) +#endif +#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) +#elif !CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) +static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { + return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; +} +#endif +static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; +#else + return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +#endif +} +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) +#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) +#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) +#elif CYTHON_COMPILING_IN_GRAAL + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#endif +#if CYTHON_USE_MODULE_STATE +static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) +#else +#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) +#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) +#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) + #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) + #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ + ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ + (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ + __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) + #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) + #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) +#endif +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) +#endif +#define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) +#if CYTHON_USE_TYPE_SPECS +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE((PyObject*)obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#else + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #else + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #endif +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif +#endif +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#elif CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) +#endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif +enum __Pyx_ReferenceSharing { + __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check + __Pyx_ReferenceSharing_OwnStrongReference, + __Pyx_ReferenceSharing_FunctionArgument, + __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar +}; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ + (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ + (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ + (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) +#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) +#else +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) +#endif +#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) + #else + #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) + #endif +#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) + #endif +#else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) +#endif +#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ + __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) +#else + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) +#endif +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyObject_GetItem(dict, key); + if (*result == NULL) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + return 0; + } + return -1; + } + return 1; +} +#else +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyDict_GetItemWithError(dict, key); + if (*result == NULL) { + return PyErr_Occurred() ? -1 : 0; + } + Py_INCREF(*result); + return 1; +} +#endif +#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST + #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) +#else + #define __Pyx_VISIT_CONST(obj) +#endif +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) +#else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) +#endif +#if CYTHON_ASSUME_SAFE_SIZE + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) +#else + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) +#endif +#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t +#define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t +#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 + #define __Pyx_PySendResult PySendResult +#else + typedef enum { + PYGEN_RETURN = 0, + PYGEN_ERROR = -1, + PYGEN_NEXT = 1, + } __Pyx_PySendResult; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 + typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); +#else + #define __Pyx_pyiter_sendfunc sendfunc +#endif +#if !CYTHON_USE_AM_SEND +#define __PYX_HAS_PY_AM_SEND 0 +#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 +#define __PYX_HAS_PY_AM_SEND 1 +#else +#define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation +#endif +#if __PYX_HAS_PY_AM_SEND < 2 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods +#else + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + __Pyx_pyiter_sendfunc am_send; + } __Pyx_PyAsyncMethodsStruct; + #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) +#endif +#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 + #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) +#else + #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) +#endif +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() +#else +#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 +#ifdef __cplusplus +extern "C" +#endif +PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { + int value; + PyObject *py_value = PyObject_GetAttrString(inspect, name); + if (!py_value) return 0; + value = (int) PyLong_AsLong(py_value); + Py_DECREF(py_value); + *write_to = value; + return value != -1 || !PyErr_Occurred(); +} +static int __Pyx_init_co_variables(void) { + PyObject *inspect; + int result; + inspect = PyImport_ImportModule("inspect"); + result = +#if !defined(CO_OPTIMIZED) + __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && +#endif +#if !defined(CO_NEWLOCALS) + __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && +#endif +#if !defined(CO_VARARGS) + __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && +#endif +#if !defined(CO_VARKEYWORDS) + __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && +#endif +#if !defined(CO_ASYNC_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && +#endif +#if !defined(CO_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && +#endif +#if !defined(CO_COROUTINE) + __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && +#endif + 1; + Py_DECREF(inspect); + return result ? 0 : -1; +} +#else +static int __Pyx_init_co_variables(void) { + return 0; // It's a limited API-only feature +} +#endif + +/* MathInitCode */ +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #ifndef _USE_MATH_DEFINES + #define _USE_MATH_DEFINES + #endif +#endif +#include +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 +#endif +#ifndef CYTHON_CLINE_IN_TRACEBACK +#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#endif +#if CYTHON_CLINE_IN_TRACEBACK +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } +#else +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } +#endif +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__parts_of_speech +#define __PYX_HAVE_API__spacy__parts_of_speech +/* Early includes */ +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) +#else + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) +#endif +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) + return Py_NewRef(obj); +#else + Py_INCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) + return Py_XNewRef(obj); +#else + Py_XINCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) +#else +#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) +#endif +#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) +#else + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +/* PretendToInitialize */ +#ifdef __cplusplus +#if __cplusplus > 201103L +#include +#endif +template +static void __Pyx_pretend_to_initialize(T* ptr) { +#if __cplusplus > 201103L + if ((std::is_trivially_default_constructible::value)) +#endif + *ptr = T(); + (void)ptr; +} +#else +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#endif + + +#if !CYTHON_USE_MODULE_STATE +static PyObject *__pyx_m = NULL; +#endif +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * const __pyx_cfilenm = __FILE__; +static const char *__pyx_filename; + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/parts_of_speech.pyx", + "", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* Atomics.proto (used by CodeObjectCache) */ +#include +#ifndef CYTHON_ATOMICS + #define CYTHON_ATOMICS 1 +#endif +#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS +#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __pyx_atomic_int_type int +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_ptr_type atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) atomic_load(value) + #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_ptr_type std::atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) std::atomic_load(value) + #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ + (__GNUC_MINOR__ > 1 ||\ + (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) + #define __pyx_atomic_ptr_type void* + #define __pyx_nonatomic_ptr_type void* + #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) + #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #warning "Using GNU atomics" + #endif +#elif CYTHON_ATOMICS && defined(_MSC_VER) + #include + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type long + #define __pyx_atomic_ptr_type void* + #undef __pyx_nonatomic_int_type + #define __pyx_nonatomic_int_type long + #define __pyx_nonatomic_ptr_type void* + #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) + #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) + #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) + #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value + #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #pragma message ("Using MSVC atomics") + #endif +#else + #undef CYTHON_ATOMICS + #define CYTHON_ATOMICS 0 + #ifdef __PYX_DEBUG_ATOMICS + #warning "Not using atomics" + #endif +#endif + +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "spacy/parts_of_speech.pxd":4 + * + * + * cpdef enum univ_pos_t: # <<<<<<<<<<<<<< + * NO_TAG = 0 + * ADJ = symbols.ADJ +*/ +enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t { + + /* "spacy/parts_of_speech.pxd":6 + * cpdef enum univ_pos_t: + * NO_TAG = 0 + * ADJ = symbols.ADJ # <<<<<<<<<<<<<< + * ADP + * ADV +*/ + __pyx_e_5spacy_15parts_of_speech_NO_TAG = 0, + __pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_15parts_of_speech_ADP, + __pyx_e_5spacy_15parts_of_speech_ADV, + __pyx_e_5spacy_15parts_of_speech_AUX, + __pyx_e_5spacy_15parts_of_speech_CONJ, + __pyx_e_5spacy_15parts_of_speech_CCONJ, + __pyx_e_5spacy_15parts_of_speech_DET, + __pyx_e_5spacy_15parts_of_speech_INTJ, + __pyx_e_5spacy_15parts_of_speech_NOUN, + __pyx_e_5spacy_15parts_of_speech_NUM, + __pyx_e_5spacy_15parts_of_speech_PART, + __pyx_e_5spacy_15parts_of_speech_PRON, + __pyx_e_5spacy_15parts_of_speech_PROPN, + __pyx_e_5spacy_15parts_of_speech_PUNCT, + __pyx_e_5spacy_15parts_of_speech_SCONJ, + __pyx_e_5spacy_15parts_of_speech_SYM, + __pyx_e_5spacy_15parts_of_speech_VERB, + __pyx_e_5spacy_15parts_of_speech_X, + __pyx_e_5spacy_15parts_of_speech_EOL, + __pyx_e_5spacy_15parts_of_speech_SPACE +}; +/* #### Code section: utility_code_proto ### */ + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto (used by PyErrFetchRestore) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto (used by GetModuleGlobalName) */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* PyDictVersioning.proto (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* PyObjectCall.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); + +/* HasAttr.proto (used by ImportImpl) */ +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n) +#else +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +#endif + +/* PyObjectCallOneArg.proto (used by ImportImpl) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* TupleAndListFromArray.proto (used by ImportImpl) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +#endif +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto (used by ImportImpl) */ +#include + +/* ImportImpl.export */ +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); + +/* Import.proto */ +static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* ListPack.proto */ +static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...); + +/* GetAttr.proto (used by Globals) */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* Globals.proto */ +static PyObject* __Pyx_Globals(void); + +/* PyObjectVectorCallKwBuilder.proto */ +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#if CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall +#endif +#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict +#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) +#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) +#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) +#endif + +/* PyObjectDelAttr.proto (used by PyObjectSetAttrStr) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +#define __Pyx_PyObject_DelAttr(o, n) PyObject_SetAttr(o, n, NULL) +#else +#define __Pyx_PyObject_DelAttr(o, n) PyObject_DelAttr(o, n) +#endif + +/* PyObjectSetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); +#else +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* PyObjectFastCallMethod.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) +#else +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); +#endif + +/* dict_setdefault.proto (used by CLineInTraceback) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); + +/* CLineInTraceback.proto (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#else +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#endif + +/* CodeObjectCache.proto (used by AddTraceback) */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject __Pyx_CachedCodeObjectType; +#else +typedef PyCodeObject __Pyx_CachedCodeObjectType; +#endif +typedef struct { + __Pyx_CachedCodeObjectType* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_int_type accessor_count; + #endif +}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#else +static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); +#endif +#else // !LIMITED_API +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { + return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); +} +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +#ifdef PyExceptionInstance_Check + #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) +#else + #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) +#endif + +/* GetRuntimeVersion.proto */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +static unsigned long __Pyx_cached_runtime_version = 0; +static void __Pyx_init_runtime_version(void); +#else +#define __Pyx_init_runtime_version() +#endif +static unsigned long __Pyx_get_runtime_version(void); + +/* AddModuleRef.proto */ +#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ + __PYX_LIMITED_VERSION_HEX < 0x030d0000) + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); +#else + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#endif + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); + +/* DecompressString.proto */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); + +/* MultiPhaseInitModuleState.proto */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +static PyObject *__Pyx_State_FindModule(void*); +static int __Pyx_State_AddModule(PyObject* module, void*); +static int __Pyx_State_RemoveModule(void*); +#elif CYTHON_USE_MODULE_STATE +#define __Pyx_State_FindModule PyState_FindModule +#define __Pyx_State_AddModule PyState_AddModule +#define __Pyx_State_RemoveModule PyState_RemoveModule +#endif + +/* #### Code section: module_declarations ### */ +/* CythonABIVersion.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API + #if CYTHON_METH_FASTCALL + #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" + #else + #define __PYX_FASTCALL_ABI_SUFFIX + #endif + #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#else + #define __PYX_LIMITED_ABI_SUFFIX +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + #define __PYX_AM_SEND_ABI_SUFFIX +#elif __PYX_HAS_PY_AM_SEND == 2 + #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" +#else + #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" +#endif +#ifndef __PYX_MONITORING_ABI_SUFFIX + #define __PYX_MONITORING_ABI_SUFFIX +#endif +#if CYTHON_USE_TP_FINALIZE + #define __PYX_TP_FINALIZE_ABI_SUFFIX +#else + #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" +#endif +#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) + #define __PYX_FREELISTS_ABI_SUFFIX +#else + #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" +#endif +#define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." + + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.parts_of_speech" */ +static PyObject *__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_key; +static PyObject *__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_value; +static PyObject *__Pyx_EnumBase = 0; +static PyObject *__Pyx_FlagBase = 0; +static PyObject *__Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.parts_of_speech" +extern int __pyx_module_is_main_spacy__parts_of_speech; +int __pyx_module_is_main_spacy__parts_of_speech = 0; + +/* Implementation of "spacy.parts_of_speech" */ +/* #### Code section: global_var ### */ +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +/* SmallCodeConfig */ +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + PyObject *__pyx_tuple[1]; + PyObject *__pyx_string_tab[44]; +/* #### Code section: module_state_contents ### */ +/* CodeObjectCache.module_state_decls */ +struct __Pyx_CodeObjectCache __pyx_code_cache; + +/* #### Code section: module_state_end ### */ +} __pyx_mstatetype; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { +extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) + +#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstatetype __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: constant_name_defines ### */ +#define __pyx_kp_u_ __pyx_string_tab[0] +#define __pyx_kp_u__2 __pyx_string_tab[1] +#define __pyx_kp_u__3 __pyx_string_tab[2] +#define __pyx_kp_u_spacy_parts_of_speech __pyx_string_tab[3] +#define __pyx_n_u_ADJ __pyx_string_tab[4] +#define __pyx_n_u_ADP __pyx_string_tab[5] +#define __pyx_n_u_ADV __pyx_string_tab[6] +#define __pyx_n_u_AUX __pyx_string_tab[7] +#define __pyx_n_u_CCONJ __pyx_string_tab[8] +#define __pyx_n_u_CONJ __pyx_string_tab[9] +#define __pyx_n_u_DET __pyx_string_tab[10] +#define __pyx_n_u_EOL __pyx_string_tab[11] +#define __pyx_n_u_IDS __pyx_string_tab[12] +#define __pyx_n_u_INTJ __pyx_string_tab[13] +#define __pyx_n_u_IntEnum __pyx_string_tab[14] +#define __pyx_n_u_IntFlag __pyx_string_tab[15] +#define __pyx_n_u_NAMES __pyx_string_tab[16] +#define __pyx_n_u_NOUN __pyx_string_tab[17] +#define __pyx_n_u_NO_TAG __pyx_string_tab[18] +#define __pyx_n_u_NUM __pyx_string_tab[19] +#define __pyx_n_u_PART __pyx_string_tab[20] +#define __pyx_n_u_PRON __pyx_string_tab[21] +#define __pyx_n_u_PROPN __pyx_string_tab[22] +#define __pyx_n_u_PUNCT __pyx_string_tab[23] +#define __pyx_n_u_SCONJ __pyx_string_tab[24] +#define __pyx_n_u_SPACE __pyx_string_tab[25] +#define __pyx_n_u_SYM __pyx_string_tab[26] +#define __pyx_n_u_VERB __pyx_string_tab[27] +#define __pyx_n_u_X __pyx_string_tab[28] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[29] +#define __pyx_n_u_enum __pyx_string_tab[30] +#define __pyx_n_u_get __pyx_string_tab[31] +#define __pyx_n_u_items __pyx_string_tab[32] +#define __pyx_n_u_main __pyx_string_tab[33] +#define __pyx_n_u_member_names __pyx_string_tab[34] +#define __pyx_n_u_members __pyx_string_tab[35] +#define __pyx_n_u_module __pyx_string_tab[36] +#define __pyx_n_u_module_2 __pyx_string_tab[37] +#define __pyx_n_u_name __pyx_string_tab[38] +#define __pyx_n_u_qualname __pyx_string_tab[39] +#define __pyx_n_u_setdefault __pyx_string_tab[40] +#define __pyx_n_u_test __pyx_string_tab[41] +#define __pyx_n_u_univ_pos_t __pyx_string_tab[42] +#define __pyx_n_u_update __pyx_string_tab[43] +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { + __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #if CYTHON_PEP489_MULTI_PHASE_INIT + __Pyx_State_RemoveModule(NULL); + #endif + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<44; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } +/* #### Code section: module_state_clear_contents ### */ +/* #### Code section: module_state_clear_end ### */ +return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<44; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } +/* #### Code section: module_state_traverse_contents ### */ +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "EnumTypeToPy":2 + * + * @cname("__Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py") # <<<<<<<<<<<<<< + * cdef __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(univ_pos_t c_val): + * cdef object __pyx_enum +*/ + +static PyObject *__Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t __pyx_v_c_val) { + PyObject *__pyx_v___pyx_enum = 0; + int __pyx_v_underlying_c_val; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py", 0); + + /* "EnumTypeToPy":5 + * cdef __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(univ_pos_t c_val): + * cdef object __pyx_enum + * __pyx_enum = univ_pos_t # <<<<<<<<<<<<<< + * + * if 0: +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_univ_pos_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v___pyx_enum = __pyx_t_1; + __pyx_t_1 = 0; + + /* "EnumTypeToPy":7 + * __pyx_enum = univ_pos_t + * + * if 0: # <<<<<<<<<<<<<< + * pass + * elif c_val == univ_pos_t.NO_TAG: +*/ + switch (__pyx_v_c_val) { + case __pyx_e_5spacy_15parts_of_speech_NO_TAG: + + /* "EnumTypeToPy":10 + * pass + * elif c_val == univ_pos_t.NO_TAG: + * return __pyx_enum.NO_TAG # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.ADJ: + * return __pyx_enum.ADJ +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_NO_TAG); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":9 + * if 0: + * pass + * elif c_val == univ_pos_t.NO_TAG: # <<<<<<<<<<<<<< + * return __pyx_enum.NO_TAG + * elif c_val == univ_pos_t.ADJ: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_ADJ: + + /* "EnumTypeToPy":12 + * return __pyx_enum.NO_TAG + * elif c_val == univ_pos_t.ADJ: + * return __pyx_enum.ADJ # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.ADP: + * return __pyx_enum.ADP +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_ADJ); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":11 + * elif c_val == univ_pos_t.NO_TAG: + * return __pyx_enum.NO_TAG + * elif c_val == univ_pos_t.ADJ: # <<<<<<<<<<<<<< + * return __pyx_enum.ADJ + * elif c_val == univ_pos_t.ADP: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_ADP: + + /* "EnumTypeToPy":14 + * return __pyx_enum.ADJ + * elif c_val == univ_pos_t.ADP: + * return __pyx_enum.ADP # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.ADV: + * return __pyx_enum.ADV +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_ADP); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":13 + * elif c_val == univ_pos_t.ADJ: + * return __pyx_enum.ADJ + * elif c_val == univ_pos_t.ADP: # <<<<<<<<<<<<<< + * return __pyx_enum.ADP + * elif c_val == univ_pos_t.ADV: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_ADV: + + /* "EnumTypeToPy":16 + * return __pyx_enum.ADP + * elif c_val == univ_pos_t.ADV: + * return __pyx_enum.ADV # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.AUX: + * return __pyx_enum.AUX +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_ADV); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":15 + * elif c_val == univ_pos_t.ADP: + * return __pyx_enum.ADP + * elif c_val == univ_pos_t.ADV: # <<<<<<<<<<<<<< + * return __pyx_enum.ADV + * elif c_val == univ_pos_t.AUX: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_AUX: + + /* "EnumTypeToPy":18 + * return __pyx_enum.ADV + * elif c_val == univ_pos_t.AUX: + * return __pyx_enum.AUX # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.CONJ: + * return __pyx_enum.CONJ +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_AUX); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":17 + * elif c_val == univ_pos_t.ADV: + * return __pyx_enum.ADV + * elif c_val == univ_pos_t.AUX: # <<<<<<<<<<<<<< + * return __pyx_enum.AUX + * elif c_val == univ_pos_t.CONJ: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_CONJ: + + /* "EnumTypeToPy":20 + * return __pyx_enum.AUX + * elif c_val == univ_pos_t.CONJ: + * return __pyx_enum.CONJ # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.CCONJ: + * return __pyx_enum.CCONJ +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_CONJ); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":19 + * elif c_val == univ_pos_t.AUX: + * return __pyx_enum.AUX + * elif c_val == univ_pos_t.CONJ: # <<<<<<<<<<<<<< + * return __pyx_enum.CONJ + * elif c_val == univ_pos_t.CCONJ: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_CCONJ: + + /* "EnumTypeToPy":22 + * return __pyx_enum.CONJ + * elif c_val == univ_pos_t.CCONJ: + * return __pyx_enum.CCONJ # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.DET: + * return __pyx_enum.DET +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_CCONJ); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":21 + * elif c_val == univ_pos_t.CONJ: + * return __pyx_enum.CONJ + * elif c_val == univ_pos_t.CCONJ: # <<<<<<<<<<<<<< + * return __pyx_enum.CCONJ + * elif c_val == univ_pos_t.DET: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_DET: + + /* "EnumTypeToPy":24 + * return __pyx_enum.CCONJ + * elif c_val == univ_pos_t.DET: + * return __pyx_enum.DET # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.INTJ: + * return __pyx_enum.INTJ +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_DET); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":23 + * elif c_val == univ_pos_t.CCONJ: + * return __pyx_enum.CCONJ + * elif c_val == univ_pos_t.DET: # <<<<<<<<<<<<<< + * return __pyx_enum.DET + * elif c_val == univ_pos_t.INTJ: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_INTJ: + + /* "EnumTypeToPy":26 + * return __pyx_enum.DET + * elif c_val == univ_pos_t.INTJ: + * return __pyx_enum.INTJ # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.NOUN: + * return __pyx_enum.NOUN +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_INTJ); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":25 + * elif c_val == univ_pos_t.DET: + * return __pyx_enum.DET + * elif c_val == univ_pos_t.INTJ: # <<<<<<<<<<<<<< + * return __pyx_enum.INTJ + * elif c_val == univ_pos_t.NOUN: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_NOUN: + + /* "EnumTypeToPy":28 + * return __pyx_enum.INTJ + * elif c_val == univ_pos_t.NOUN: + * return __pyx_enum.NOUN # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.NUM: + * return __pyx_enum.NUM +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_NOUN); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":27 + * elif c_val == univ_pos_t.INTJ: + * return __pyx_enum.INTJ + * elif c_val == univ_pos_t.NOUN: # <<<<<<<<<<<<<< + * return __pyx_enum.NOUN + * elif c_val == univ_pos_t.NUM: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_NUM: + + /* "EnumTypeToPy":30 + * return __pyx_enum.NOUN + * elif c_val == univ_pos_t.NUM: + * return __pyx_enum.NUM # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.PART: + * return __pyx_enum.PART +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_NUM); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":29 + * elif c_val == univ_pos_t.NOUN: + * return __pyx_enum.NOUN + * elif c_val == univ_pos_t.NUM: # <<<<<<<<<<<<<< + * return __pyx_enum.NUM + * elif c_val == univ_pos_t.PART: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_PART: + + /* "EnumTypeToPy":32 + * return __pyx_enum.NUM + * elif c_val == univ_pos_t.PART: + * return __pyx_enum.PART # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.PRON: + * return __pyx_enum.PRON +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PART); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":31 + * elif c_val == univ_pos_t.NUM: + * return __pyx_enum.NUM + * elif c_val == univ_pos_t.PART: # <<<<<<<<<<<<<< + * return __pyx_enum.PART + * elif c_val == univ_pos_t.PRON: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_PRON: + + /* "EnumTypeToPy":34 + * return __pyx_enum.PART + * elif c_val == univ_pos_t.PRON: + * return __pyx_enum.PRON # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.PROPN: + * return __pyx_enum.PROPN +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PRON); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":33 + * elif c_val == univ_pos_t.PART: + * return __pyx_enum.PART + * elif c_val == univ_pos_t.PRON: # <<<<<<<<<<<<<< + * return __pyx_enum.PRON + * elif c_val == univ_pos_t.PROPN: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_PROPN: + + /* "EnumTypeToPy":36 + * return __pyx_enum.PRON + * elif c_val == univ_pos_t.PROPN: + * return __pyx_enum.PROPN # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.PUNCT: + * return __pyx_enum.PUNCT +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PROPN); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":35 + * elif c_val == univ_pos_t.PRON: + * return __pyx_enum.PRON + * elif c_val == univ_pos_t.PROPN: # <<<<<<<<<<<<<< + * return __pyx_enum.PROPN + * elif c_val == univ_pos_t.PUNCT: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_PUNCT: + + /* "EnumTypeToPy":38 + * return __pyx_enum.PROPN + * elif c_val == univ_pos_t.PUNCT: + * return __pyx_enum.PUNCT # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.SCONJ: + * return __pyx_enum.SCONJ +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_PUNCT); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":37 + * elif c_val == univ_pos_t.PROPN: + * return __pyx_enum.PROPN + * elif c_val == univ_pos_t.PUNCT: # <<<<<<<<<<<<<< + * return __pyx_enum.PUNCT + * elif c_val == univ_pos_t.SCONJ: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_SCONJ: + + /* "EnumTypeToPy":40 + * return __pyx_enum.PUNCT + * elif c_val == univ_pos_t.SCONJ: + * return __pyx_enum.SCONJ # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.SYM: + * return __pyx_enum.SYM +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_SCONJ); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":39 + * elif c_val == univ_pos_t.PUNCT: + * return __pyx_enum.PUNCT + * elif c_val == univ_pos_t.SCONJ: # <<<<<<<<<<<<<< + * return __pyx_enum.SCONJ + * elif c_val == univ_pos_t.SYM: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_SYM: + + /* "EnumTypeToPy":42 + * return __pyx_enum.SCONJ + * elif c_val == univ_pos_t.SYM: + * return __pyx_enum.SYM # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.VERB: + * return __pyx_enum.VERB +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_SYM); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":41 + * elif c_val == univ_pos_t.SCONJ: + * return __pyx_enum.SCONJ + * elif c_val == univ_pos_t.SYM: # <<<<<<<<<<<<<< + * return __pyx_enum.SYM + * elif c_val == univ_pos_t.VERB: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_VERB: + + /* "EnumTypeToPy":44 + * return __pyx_enum.SYM + * elif c_val == univ_pos_t.VERB: + * return __pyx_enum.VERB # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.X: + * return __pyx_enum.X +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_VERB); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":43 + * elif c_val == univ_pos_t.SYM: + * return __pyx_enum.SYM + * elif c_val == univ_pos_t.VERB: # <<<<<<<<<<<<<< + * return __pyx_enum.VERB + * elif c_val == univ_pos_t.X: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_X: + + /* "EnumTypeToPy":46 + * return __pyx_enum.VERB + * elif c_val == univ_pos_t.X: + * return __pyx_enum.X # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.EOL: + * return __pyx_enum.EOL +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_X); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":45 + * elif c_val == univ_pos_t.VERB: + * return __pyx_enum.VERB + * elif c_val == univ_pos_t.X: # <<<<<<<<<<<<<< + * return __pyx_enum.X + * elif c_val == univ_pos_t.EOL: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_EOL: + + /* "EnumTypeToPy":48 + * return __pyx_enum.X + * elif c_val == univ_pos_t.EOL: + * return __pyx_enum.EOL # <<<<<<<<<<<<<< + * elif c_val == univ_pos_t.SPACE: + * return __pyx_enum.SPACE +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_EOL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":47 + * elif c_val == univ_pos_t.X: + * return __pyx_enum.X + * elif c_val == univ_pos_t.EOL: # <<<<<<<<<<<<<< + * return __pyx_enum.EOL + * elif c_val == univ_pos_t.SPACE: +*/ + break; + case __pyx_e_5spacy_15parts_of_speech_SPACE: + + /* "EnumTypeToPy":50 + * return __pyx_enum.EOL + * elif c_val == univ_pos_t.SPACE: + * return __pyx_enum.SPACE # <<<<<<<<<<<<<< + * else: + * underlying_c_val = c_val +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v___pyx_enum, __pyx_mstate_global->__pyx_n_u_SPACE); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumTypeToPy":49 + * elif c_val == univ_pos_t.EOL: + * return __pyx_enum.EOL + * elif c_val == univ_pos_t.SPACE: # <<<<<<<<<<<<<< + * return __pyx_enum.SPACE + * else: +*/ + break; + default: + + /* "EnumTypeToPy":52 + * return __pyx_enum.SPACE + * else: + * underlying_c_val = c_val # <<<<<<<<<<<<<< + * return __pyx_enum(underlying_c_val) +*/ + __pyx_v_underlying_c_val = ((int)__pyx_v_c_val); + + /* "EnumTypeToPy":53 + * else: + * underlying_c_val = c_val + * return __pyx_enum(underlying_c_val) # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_INCREF(__pyx_v___pyx_enum); + __pyx_t_3 = __pyx_v___pyx_enum; + __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_underlying_c_val); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + break; + } + + /* "EnumTypeToPy":2 + * + * @cname("__Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py") # <<<<<<<<<<<<<< + * cdef __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(univ_pos_t c_val): + * cdef object __pyx_enum +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("EnumTypeToPy.__Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_enum); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +/* #### Code section: initfunc_declarations ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ +/* #### Code section: init_module ### */ + +static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_key = Py_None; Py_INCREF(Py_None); + __pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_value = Py_None; Py_INCREF(Py_None); + __Pyx_EnumBase = Py_None; Py_INCREF(Py_None); + __Pyx_FlagBase = Py_None; Py_INCREF(Py_None); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_parts_of_speech(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_parts_of_speech}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #endif + #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE + {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, + #endif + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "parts_of_speech", + 0, /* m_doc */ + #if CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstatetype), /* m_size */ + #else + (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif + +/* PyModInitFuncType */ +#ifndef CYTHON_NO_PYINIT_EXPORT + #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#else + #ifdef __cplusplus + #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * + #else + #define __Pyx_PyMODINIT_FUNC PyObject * + #endif +#endif + +__Pyx_PyMODINIT_FUNC PyInit_parts_of_speech(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_parts_of_speech(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +/* ModuleCreationPEP489 */ +#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) +static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { + { + PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think + if (!module) { + PyErr_Clear(); // just try the 3.8-3.12 version + module = PyImport_ImportModule("_xxsubinterpreters"); + if (!module) goto bad; + } + PyObject *current = PyObject_CallMethod(module, "get_current", NULL); + Py_DECREF(module); + if (!current) goto bad; + if (PyTuple_Check(current)) { + PyObject *new_current = PySequence_GetItem(current, 0); + Py_DECREF(current); + current = new_current; + if (!new_current) goto bad; + } + long long as_c_int = PyLong_AsLongLong(current); + Py_DECREF(current); + return as_c_int; + } + bad: + PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); + return -1; +} +#endif +#if !CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + static PY_INT64_T main_interpreter_id = -1; +#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_GRAAL + PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) + PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); +#elif CYTHON_COMPILING_IN_LIMITED_API + PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); +#else + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); +#endif + if (unlikely(current_id == -1)) { + return -1; + } + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return 0; + } else if (unlikely(main_interpreter_id != current_id)) { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#endif +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + #if !CYTHON_USE_MODULE_STATE + if (__Pyx_check_single_interpreter()) + return NULL; + #endif + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_parts_of_speech(PyObject *__pyx_pyinit_module) +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + __pyx_mstatetype *__pyx_mstate = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; + PyObject *__pyx_t_21 = NULL; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; + PyObject *__pyx_t_24 = NULL; + PyObject *__pyx_t_25 = NULL; + PyObject *__pyx_t_26 = NULL; + PyObject *__pyx_t_27 = NULL; + size_t __pyx_t_28; + int __pyx_t_29; + PyObject *(*__pyx_t_30)(PyObject *); + PyObject *(*__pyx_t_31)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'parts_of_speech' has already been imported. Re-initialisation is not supported."); + return -1; + } + #else + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_t_1 = __pyx_pyinit_module; + Py_INCREF(__pyx_t_1); + #else + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #if CYTHON_USE_MODULE_STATE + { + int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "parts_of_speech" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = __pyx_t_1; + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); + #endif + __pyx_mstate = __pyx_mstate_global; + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_mstate->__pyx_d); + __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /* ImportRefnannyAPI */ + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + +__Pyx_RefNannySetupContext("PyInit_parts_of_speech", 0); + __Pyx_init_runtime_version(); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Library function declarations ---*/ + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_module_is_main_spacy__parts_of_speech) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "spacy.parts_of_speech")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.parts_of_speech", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(__pyx_mstate); + (void)__Pyx_modinit_variable_export_code(__pyx_mstate); + (void)__Pyx_modinit_function_export_code(__pyx_mstate); + (void)__Pyx_modinit_type_init_code(__pyx_mstate); + (void)__Pyx_modinit_type_import_code(__pyx_mstate); + (void)__Pyx_modinit_variable_import_code(__pyx_mstate); + (void)__Pyx_modinit_function_import_code(__pyx_mstate); + /*--- Execution code ---*/ + + /* "EnumBase":10 + * + * cdef object __Pyx_EnumBase + * from enum import IntEnum as __Pyx_EnumBase # <<<<<<<<<<<<<< + * + * cdef object __Pyx_FlagBase +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IntEnum}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_enum, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IntEnum}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + switch (__pyx_t_3) { + case 0: + __Pyx_INCREF(__pyx_t_4); + __Pyx_XGOTREF(__Pyx_EnumBase); + __Pyx_DECREF_SET(__Pyx_EnumBase, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + break; + default:; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "EnumBase":13 + * + * cdef object __Pyx_FlagBase + * from enum import IntFlag as __Pyx_FlagBase # <<<<<<<<<<<<<< +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IntFlag}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_enum, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IntFlag}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + switch (__pyx_t_3) { + case 0: + __Pyx_INCREF(__pyx_t_4); + __Pyx_XGOTREF(__Pyx_FlagBase); + __Pyx_DECREF_SET(__Pyx_FlagBase, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + break; + default:; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "EnumType":23 + * + * + * univ_pos_t = __Pyx_FlagBase('univ_pos_t', [ # <<<<<<<<<<<<<< + * ('NO_TAG', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NO_TAG)), + * ('ADJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADJ)), +*/ + __pyx_t_4 = NULL; + __Pyx_INCREF(__Pyx_FlagBase); + __pyx_t_5 = __Pyx_FlagBase; + + /* "EnumType":24 + * + * univ_pos_t = __Pyx_FlagBase('univ_pos_t', [ + * ('NO_TAG', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NO_TAG)), # <<<<<<<<<<<<<< + * ('ADJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADJ)), + * ('ADP', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADP)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_NO_TAG); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_NO_TAG, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":25 + * univ_pos_t = __Pyx_FlagBase('univ_pos_t', [ + * ('NO_TAG', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NO_TAG)), + * ('ADJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADJ)), # <<<<<<<<<<<<<< + * ('ADP', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADP)), + * ('ADV', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADV)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_ADJ); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_ADJ, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":26 + * ('NO_TAG', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NO_TAG)), + * ('ADJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADJ)), + * ('ADP', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADP)), # <<<<<<<<<<<<<< + * ('ADV', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADV)), + * ('AUX', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(AUX)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_ADP); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_ADP, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":27 + * ('ADJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADJ)), + * ('ADP', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADP)), + * ('ADV', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADV)), # <<<<<<<<<<<<<< + * ('AUX', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(AUX)), + * ('CONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(CONJ)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_ADV); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_ADV, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":28 + * ('ADP', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADP)), + * ('ADV', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADV)), + * ('AUX', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(AUX)), # <<<<<<<<<<<<<< + * ('CONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(CONJ)), + * ('CCONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(CCONJ)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_AUX); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_AUX, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":29 + * ('ADV', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADV)), + * ('AUX', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(AUX)), + * ('CONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(CONJ)), # <<<<<<<<<<<<<< + * ('CCONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(CCONJ)), + * ('DET', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(DET)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_CONJ); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_12 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_CONJ, __pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":30 + * ('AUX', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(AUX)), + * ('CONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(CONJ)), + * ('CCONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(CCONJ)), # <<<<<<<<<<<<<< + * ('DET', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(DET)), + * ('INTJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(INTJ)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_CCONJ); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_13 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_CCONJ, __pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":31 + * ('CONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(CONJ)), + * ('CCONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(CCONJ)), + * ('DET', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(DET)), # <<<<<<<<<<<<<< + * ('INTJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(INTJ)), + * ('NOUN', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NOUN)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_DET); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_14 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_DET, __pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":32 + * ('CCONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(CCONJ)), + * ('DET', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(DET)), + * ('INTJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(INTJ)), # <<<<<<<<<<<<<< + * ('NOUN', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NOUN)), + * ('NUM', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NUM)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_INTJ); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_15 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_INTJ, __pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":33 + * ('DET', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(DET)), + * ('INTJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(INTJ)), + * ('NOUN', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NOUN)), # <<<<<<<<<<<<<< + * ('NUM', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NUM)), + * ('PART', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PART)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_NOUN); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_16 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_NOUN, __pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":34 + * ('INTJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(INTJ)), + * ('NOUN', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NOUN)), + * ('NUM', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NUM)), # <<<<<<<<<<<<<< + * ('PART', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PART)), + * ('PRON', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PRON)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_NUM); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_17 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_NUM, __pyx_t_6); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":35 + * ('NOUN', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NOUN)), + * ('NUM', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NUM)), + * ('PART', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PART)), # <<<<<<<<<<<<<< + * ('PRON', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PRON)), + * ('PROPN', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PROPN)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_PART); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_18 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PART, __pyx_t_6); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":36 + * ('NUM', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NUM)), + * ('PART', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PART)), + * ('PRON', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PRON)), # <<<<<<<<<<<<<< + * ('PROPN', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PROPN)), + * ('PUNCT', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PUNCT)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_PRON); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_19 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PRON, __pyx_t_6); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":37 + * ('PART', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PART)), + * ('PRON', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PRON)), + * ('PROPN', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PROPN)), # <<<<<<<<<<<<<< + * ('PUNCT', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PUNCT)), + * ('SCONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SCONJ)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_PROPN); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_20 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PROPN, __pyx_t_6); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":38 + * ('PRON', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PRON)), + * ('PROPN', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PROPN)), + * ('PUNCT', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PUNCT)), # <<<<<<<<<<<<<< + * ('SCONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SCONJ)), + * ('SYM', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SYM)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_PUNCT); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_21 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_PUNCT, __pyx_t_6); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":39 + * ('PROPN', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PROPN)), + * ('PUNCT', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PUNCT)), + * ('SCONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SCONJ)), # <<<<<<<<<<<<<< + * ('SYM', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SYM)), + * ('VERB', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(VERB)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_SCONJ); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_22 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_SCONJ, __pyx_t_6); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":40 + * ('PUNCT', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(PUNCT)), + * ('SCONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SCONJ)), + * ('SYM', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SYM)), # <<<<<<<<<<<<<< + * ('VERB', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(VERB)), + * ('X', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(X)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_SYM); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_23 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_SYM, __pyx_t_6); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":41 + * ('SCONJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SCONJ)), + * ('SYM', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SYM)), + * ('VERB', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(VERB)), # <<<<<<<<<<<<<< + * ('X', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(X)), + * ('EOL', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(EOL)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_VERB); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_24 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_VERB, __pyx_t_6); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":42 + * ('SYM', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SYM)), + * ('VERB', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(VERB)), + * ('X', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(X)), # <<<<<<<<<<<<<< + * ('EOL', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(EOL)), + * ('SPACE', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SPACE)), +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_X); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_25 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_X, __pyx_t_6); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":43 + * ('VERB', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(VERB)), + * ('X', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(X)), + * ('EOL', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(EOL)), # <<<<<<<<<<<<<< + * ('SPACE', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SPACE)), + * +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_EOL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_26 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_EOL, __pyx_t_6); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_26); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":44 + * ('X', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(X)), + * ('EOL', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(EOL)), + * ('SPACE', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SPACE)), # <<<<<<<<<<<<<< + * + * ], module=globals().get("__module__", 'spacy.parts_of_speech')) +*/ + __pyx_t_6 = __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(__pyx_e_5spacy_15parts_of_speech_SPACE); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_27 = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_SPACE, __pyx_t_6); if (unlikely(!__pyx_t_27)) __PYX_ERR(1, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_27); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "EnumType":23 + * + * + * univ_pos_t = __Pyx_FlagBase('univ_pos_t', [ # <<<<<<<<<<<<<< + * ('NO_TAG', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(NO_TAG)), + * ('ADJ', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(ADJ)), +*/ + __pyx_t_6 = __Pyx_PyList_Pack(21, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0; + + /* "EnumType":46 + * ('SPACE', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SPACE)), + * + * ], module=globals().get("__module__", 'spacy.parts_of_speech')) # <<<<<<<<<<<<<< + * + * if PY_VERSION_HEX >= 0x030B0000: +*/ + __pyx_t_27 = __Pyx_Globals(); if (unlikely(!__pyx_t_27)) __PYX_ERR(1, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_27); + __pyx_t_26 = __Pyx_PyObject_GetAttrStr(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_26); + __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0; + __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_26, __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_27)) __PYX_ERR(1, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_27); + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + __pyx_t_28 = 1; + { + PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_univ_pos_t, __pyx_t_6}; + __pyx_t_26 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_26); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_module, __pyx_t_27, __pyx_t_26, __pyx_callargs+3, 0) < (0)) __PYX_ERR(1, 23, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_28, (3-__pyx_t_28) | (__pyx_t_28*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_26); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0; + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_univ_pos_t, __pyx_t_2) < (0)) __PYX_ERR(1, 23, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "EnumType":48 + * ], module=globals().get("__module__", 'spacy.parts_of_speech')) + * + * if PY_VERSION_HEX >= 0x030B0000: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_29 = (PY_VERSION_HEX >= 0x030B0000); + if (__pyx_t_29) { + + /* "EnumType":53 + * + * + * univ_pos_t._member_names_ = list(univ_pos_t.__members__) # <<<<<<<<<<<<<< +*/ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_univ_pos_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_members); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_univ_pos_t); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_PyObject_SetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_member_names, __pyx_t_2) < (0)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "EnumType":48 + * ], module=globals().get("__module__", 'spacy.parts_of_speech')) + * + * if PY_VERSION_HEX >= 0x030B0000: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "spacy/parts_of_speech.pyx":3 + * # cython: profile=False + * IDS = { + * "": NO_TAG, # <<<<<<<<<<<<<< + * "ADJ": ADJ, + * "ADP": ADP, +*/ + __pyx_t_5 = __Pyx_PyDict_NewPresized(21); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_NO_TAG); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_kp_u__2, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":4 + * IDS = { + * "": NO_TAG, + * "ADJ": ADJ, # <<<<<<<<<<<<<< + * "ADP": ADP, + * "ADV": ADV, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_ADJ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ADJ, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":5 + * "": NO_TAG, + * "ADJ": ADJ, + * "ADP": ADP, # <<<<<<<<<<<<<< + * "ADV": ADV, + * "AUX": AUX, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_ADP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ADP, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":6 + * "ADJ": ADJ, + * "ADP": ADP, + * "ADV": ADV, # <<<<<<<<<<<<<< + * "AUX": AUX, + * "CONJ": CONJ, # U20 +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_ADV); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ADV, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":7 + * "ADP": ADP, + * "ADV": ADV, + * "AUX": AUX, # <<<<<<<<<<<<<< + * "CONJ": CONJ, # U20 + * "CCONJ": CCONJ, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_AUX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_AUX, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":8 + * "ADV": ADV, + * "AUX": AUX, + * "CONJ": CONJ, # U20 # <<<<<<<<<<<<<< + * "CCONJ": CCONJ, + * "DET": DET, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_CONJ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_CONJ, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":9 + * "AUX": AUX, + * "CONJ": CONJ, # U20 + * "CCONJ": CCONJ, # <<<<<<<<<<<<<< + * "DET": DET, + * "INTJ": INTJ, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_CCONJ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_CCONJ, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":10 + * "CONJ": CONJ, # U20 + * "CCONJ": CCONJ, + * "DET": DET, # <<<<<<<<<<<<<< + * "INTJ": INTJ, + * "NOUN": NOUN, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_DET); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_DET, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":11 + * "CCONJ": CCONJ, + * "DET": DET, + * "INTJ": INTJ, # <<<<<<<<<<<<<< + * "NOUN": NOUN, + * "NUM": NUM, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_INTJ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_INTJ, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":12 + * "DET": DET, + * "INTJ": INTJ, + * "NOUN": NOUN, # <<<<<<<<<<<<<< + * "NUM": NUM, + * "PART": PART, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_NOUN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_NOUN, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":13 + * "INTJ": INTJ, + * "NOUN": NOUN, + * "NUM": NUM, # <<<<<<<<<<<<<< + * "PART": PART, + * "PRON": PRON, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_NUM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_NUM, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":14 + * "NOUN": NOUN, + * "NUM": NUM, + * "PART": PART, # <<<<<<<<<<<<<< + * "PRON": PRON, + * "PROPN": PROPN, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_PART); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_PART, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":15 + * "NUM": NUM, + * "PART": PART, + * "PRON": PRON, # <<<<<<<<<<<<<< + * "PROPN": PROPN, + * "PUNCT": PUNCT, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_PRON); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_PRON, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":16 + * "PART": PART, + * "PRON": PRON, + * "PROPN": PROPN, # <<<<<<<<<<<<<< + * "PUNCT": PUNCT, + * "SCONJ": SCONJ, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_PROPN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_PROPN, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":17 + * "PRON": PRON, + * "PROPN": PROPN, + * "PUNCT": PUNCT, # <<<<<<<<<<<<<< + * "SCONJ": SCONJ, + * "SYM": SYM, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_PUNCT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_PUNCT, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":18 + * "PROPN": PROPN, + * "PUNCT": PUNCT, + * "SCONJ": SCONJ, # <<<<<<<<<<<<<< + * "SYM": SYM, + * "VERB": VERB, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_SCONJ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_SCONJ, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":19 + * "PUNCT": PUNCT, + * "SCONJ": SCONJ, + * "SYM": SYM, # <<<<<<<<<<<<<< + * "VERB": VERB, + * "X": X, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_SYM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_SYM, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":20 + * "SCONJ": SCONJ, + * "SYM": SYM, + * "VERB": VERB, # <<<<<<<<<<<<<< + * "X": X, + * "EOL": EOL, +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_VERB); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_VERB, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":21 + * "SYM": SYM, + * "VERB": VERB, + * "X": X, # <<<<<<<<<<<<<< + * "EOL": EOL, + * "SPACE": SPACE +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_X); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_X, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":22 + * "VERB": VERB, + * "X": X, + * "EOL": EOL, # <<<<<<<<<<<<<< + * "SPACE": SPACE + * } +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_EOL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_EOL, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/parts_of_speech.pyx":23 + * "X": X, + * "EOL": EOL, + * "SPACE": SPACE # <<<<<<<<<<<<<< + * } + * +*/ + __pyx_t_2 = __Pyx_Enum_6a79d2__5spacy_15parts_of_speech_enum__dunderpyx_t_5sp__etc_to_py(__pyx_e_5spacy_15parts_of_speech_SPACE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_SPACE, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_IDS, __pyx_t_5) < (0)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/parts_of_speech.pyx":27 + * + * + * NAMES = {value: key for key, value in IDS.items()} # <<<<<<<<<<<<<< + * + * # As of Cython 3.1, the global Python namespace no longer has the enum +*/ + { /* enter inner scope */ + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 27, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_26 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_IDS); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 27, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_27); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_items); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 27, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0; + __pyx_t_28 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_26 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_26); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_26); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_28 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_26, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_28, (1-__pyx_t_28) | (__pyx_t_28*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_6 = __pyx_t_2; __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = 0; + __pyx_t_30 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 27, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_30 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 27, __pyx_L5_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_30)) { + if (likely(PyList_CheckExact(__pyx_t_6))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 27, __pyx_L5_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 27, __pyx_L5_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_3)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L5_error) + } else { + __pyx_t_2 = __pyx_t_30(__pyx_t_6); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 27, __pyx_L5_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 27, __pyx_L5_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_26 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_26); + __pyx_t_27 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_27); + } else { + __pyx_t_26 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 27, __pyx_L5_error) + __Pyx_XGOTREF(__pyx_t_26); + __pyx_t_27 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 27, __pyx_L5_error) + __Pyx_XGOTREF(__pyx_t_27); + } + #else + __pyx_t_26 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 27, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_26); + __pyx_t_27 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 27, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_27); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_31 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); + index = 0; __pyx_t_26 = __pyx_t_31(__pyx_t_4); if (unlikely(!__pyx_t_26)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_26); + index = 1; __pyx_t_27 = __pyx_t_31(__pyx_t_4); if (unlikely(!__pyx_t_27)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_27); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_31(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 27, __pyx_L5_error) + __pyx_t_31 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L9_unpacking_done; + __pyx_L8_unpacking_failed:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_31 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 27, __pyx_L5_error) + __pyx_L9_unpacking_done:; + } + __Pyx_XGOTREF(__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_key); + __Pyx_DECREF_SET(__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_key, __pyx_t_26); + __Pyx_GIVEREF(__pyx_t_26); + __pyx_t_26 = 0; + __Pyx_XGOTREF(__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_value); + __Pyx_DECREF_SET(__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_value, __pyx_t_27); + __Pyx_GIVEREF(__pyx_t_27); + __pyx_t_27 = 0; + if (unlikely(PyDict_SetItem(__pyx_t_5, (PyObject*)__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_value, (PyObject*)__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_key))) __PYX_ERR(0, 27, __pyx_L5_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_key); + __Pyx_DECREF_SET(__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_key, Py_None); + __Pyx_GOTREF(__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_value); + __Pyx_DECREF_SET(__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_value, Py_None); + goto __pyx_L11_exit_scope; + __pyx_L5_error:; + __Pyx_GOTREF(__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_key); + __Pyx_DECREF_SET(__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_key, Py_None); + __Pyx_GOTREF(__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_value); + __Pyx_DECREF_SET(__pyx_7genexpr__pyx_v_5spacy_15parts_of_speech_value, Py_None); + goto __pyx_L1_error; + __pyx_L11_exit_scope:; + } /* exit inner scope */ + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NAMES, __pyx_t_5) < (0)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/parts_of_speech.pyx":31 + * # As of Cython 3.1, the global Python namespace no longer has the enum + * # contents by default. + * globals().update(IDS) # <<<<<<<<<<<<<< + * +*/ + __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_27, __pyx_mstate_global->__pyx_n_u_IDS); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_27); + __pyx_t_28 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_27}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_28, (2-__pyx_t_28) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/parts_of_speech.pyx":1 + * # cython: profile=False # <<<<<<<<<<<<<< + * IDS = { + * "": NO_TAG, +*/ + __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_5) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_XDECREF(__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); + __Pyx_XDECREF(__pyx_t_23); + __Pyx_XDECREF(__pyx_t_24); + __Pyx_XDECREF(__pyx_t_25); + __Pyx_XDECREF(__pyx_t_26); + __Pyx_XDECREF(__pyx_t_27); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.parts_of_speech", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init spacy.parts_of_speech"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #else + return __pyx_m; + #endif +} +/* #### Code section: pystring_table ### */ +/* #### Code section: cached_builtins ### */ + +static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + return 0; +} +/* #### Code section: cached_constants ### */ + +static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "EnumType":46 + * ('SPACE', __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(SPACE)), + * + * ], module=globals().get("__module__", 'spacy.parts_of_speech')) # <<<<<<<<<<<<<< + * + * if PY_VERSION_HEX >= 0x030B0000: +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_module_2, __pyx_mstate_global->__pyx_kp_u_spacy_parts_of_speech); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + { + const struct { const unsigned int length: 5; } index[] = {{1},{0},{1},{21},{3},{3},{3},{3},{5},{4},{3},{3},{3},{4},{7},{7},{5},{4},{6},{3},{4},{4},{5},{5},{5},{5},{3},{4},{1},{18},{4},{3},{5},{8},{14},{11},{6},{10},{8},{12},{10},{8},{10},{6}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (245 bytes) */ +const char* const cstring = "BZh91AY&SY \356I\357\000\000\001_\200@\000\000\001\000\000\277\267\337`\277\357\377 0\000\313,T\311\352\036\246A\241\243M\000\000\0005S\3656\246\321\2445?T\365\006\206@\000\000\325\223\350\032NV{\211K\365\341\361\001\000\253\361w$S\205\t\002\016\344\236\360"; + PyObject *data = __Pyx_DecompressString(cstring, 245, 2); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (195 bytes) */ +const char* const cstring = "x\332E\214\341N\304 \020\204\337\350^\301`A\323\306\002)\364r\376\332\354\321\275\263\021(\0260\361\355\245\232\350\217\231o73\231\323CN\350\276N\t\367\222a\273AND\356\215\361\201q\315\370\231\315\227\256Sr8\304\205\025\352\245\347\246\227v\350c\021\261\206\206'\217w\311Fa\244\232\245T`\331\263\234G\315&\253'%\233\264\324\263\354\25496\214f\2350\257\343YL\217\027\347\327H\260F(;:\272\242{\2476y\247\262\026\n\031 `\313\032(\\i\207\210\201\362\337{\304\333R=\375\023~*\007?*\372\337;SY\350\206\325\027\200B\271y\215\353'\244-C\251i\301B\337\213\300^\323"; + PyObject *data = __Pyx_DecompressString(cstring, 195, 1); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #else /* compression: none (258 bytes) */ +const char* const bytes = ".?spacy.parts_of_speechADJADPADVAUXCCONJCONJDETEOLIDSINTJIntEnumIntFlagNAMESNOUNNO_TAGNUMPARTPRONPROPNPUNCTSCONJSPACESYMVERBXcline_in_tracebackenumgetitems__main___member_names___members__module__module____name____qualname__setdefault__test__univ_pos_tupdate"; + PyObject *data = NULL; + CYTHON_UNUSED_VAR(__Pyx_DecompressString); + #endif + PyObject **stringtab = __pyx_mstate->__pyx_string_tab; + Py_ssize_t pos = 0; + for (int i = 0; i < 44; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 4) PyUnicode_InternInPlace(&string); + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + stringtab[i] = string; + pos += bytes_length; + } + Py_XDECREF(data); + for (Py_ssize_t i = 0; i < 44; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + } + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_codeobjects ### */ + +static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + return 0; +} +/* #### Code section: init_globals ### */ + +static int __Pyx_InitGlobals(void) { + /* PythonCompatibility.init */ + if (likely(__Pyx_init_co_variables() == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName (used by GetModuleGlobalName) */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, + "name '%U' is not defined", name); + } + return result; +} + +/* PyDictVersioning (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + if (!PyErr_Occurred()) + PyErr_SetNone(PyExc_NameError); + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } + PyErr_Clear(); +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return result; + } +#else + result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyObjectCall (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API + #if PY_VERSION_HEX < 0x03090000 + #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) + #elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { + PyTypeObject *tp = Py_TYPE(callable); + #if defined(__Pyx_CyFunction_USED) + if (__Pyx_CyFunction_CheckExact(callable)) { + return __Pyx_CyFunction_func_vectorcall(callable); + } + #endif + if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { + return NULL; + } + assert(PyCallable_Check(callable)); + Py_ssize_t offset = tp->tp_vectorcall_offset; + assert(offset > 0); + vectorcallfunc ptr; + memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); + return ptr; +} + #else + #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) + #endif +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if CYTHON_COMPILING_IN_LIMITED_API + return PyObject_Vectorcall(func, args, _nargs, NULL); + #else + vectorcallfunc f = __Pyx_PyVectorcall_Function(func); + if (f) { + return f(func, args, _nargs, NULL); + } + #endif + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* HasAttr (used by ImportImpl) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!PyUnicode_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (!r) { + return (unlikely(PyErr_Occurred())) ? -1 : 0; + } else { + Py_DECREF(r); + return 1; + } +} +#endif + +/* PyObjectCallOneArg (used by ImportImpl) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* TupleAndListFromArray (used by ImportImpl) */ +#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + Py_ssize_t i; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + for (i = 0; i < n; i++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + return res; +} +#elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* ImportImpl (used by Import) */ +static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) { + PyObject *imported_module = PyImport_GetModule(qualname); + if (unlikely(!imported_module)) { + *module = NULL; + if (PyErr_Occurred()) { + return -1; + } + return 0; + } + *module = imported_module; + return 1; +} +static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) { + PyObject *imported_module; + PyObject *top_level_package_name; + Py_ssize_t i; + int status, module_found; + Py_ssize_t dot_index; + module_found = __Pyx__Import_GetModule(qualname, &imported_module); + if (unlikely(!module_found || module_found == -1)) { + *module = NULL; + return module_found; + } + if (imported_names) { + for (i = 0; i < len_imported_names; i++) { + PyObject *imported_name = imported_names[i]; +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 + int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name); +#else + int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name); + if (unlikely(has_imported_attribute == -1)) goto error; +#endif + if (!has_imported_attribute) { + goto not_found; + } + } + *module = imported_module; + return 1; + } + dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1); + if (dot_index == -1) { + *module = imported_module; + return 1; + } + if (unlikely(dot_index == -2)) goto error; + top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index); + if (unlikely(!top_level_package_name)) goto error; + Py_DECREF(imported_module); + status = __Pyx__Import_GetModule(top_level_package_name, module); + Py_DECREF(top_level_package_name); + return status; +error: + Py_DECREF(imported_module); + *module = NULL; + return -1; +not_found: + Py_DECREF(imported_module); + *module = NULL; + return 0; +} +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *from_list = 0; + int module_found; + if (!qualname) { + qualname = name; + } + module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module); + if (likely(module_found == 1)) { + return module; + } else if (unlikely(module_found == -1)) { + return NULL; + } + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + if (imported_names) { +#if CYTHON_COMPILING_IN_CPYTHON + from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names); + if (unlikely(!from_list)) + goto bad; +#else + from_list = PyList_New(len_imported_names); + if (unlikely(!from_list)) goto bad; + for (Py_ssize_t i=0; i__pyx_d, level); +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u_); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\ + CYTHON_COMPILING_IN_GRAAL + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); + } + return value; +} + +/* ListPack */ +static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...) { + va_list va; + PyObject *l = PyList_New(n); + va_start(va, n); + if (unlikely(!l)) goto end; + for (Py_ssize_t i=0; i__pyx_d); +} + +/* PyObjectVectorCallKwBuilder */ +#if CYTHON_VECTORCALL +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_PyObject_FastCallDict; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + args[n] = value; + return 0; +} +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_VectorcallBuilder_AddArgStr; + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); +} +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + PyObject *pyKey = PyUnicode_FromString(key); + if (!pyKey) return -1; + return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); +} +#else // CYTHON_VECTORCALL +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return PyDict_SetItem(builder, key, value); +} +#endif + +/* PyObjectSetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); + return PyObject_SetAttr(obj, attr_name, value); +} +#endif + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* IterFinish */ +static CYTHON_INLINE int __Pyx_IterFinish(void) { + PyObject* exc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (unlikely(exc_type)) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) + return -1; + __Pyx_PyErr_Clear(); + return 0; + } + return 0; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* PyObjectFastCallMethod */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { + PyObject *result; + PyObject *attr = PyObject_GetAttr(args[0], name); + if (unlikely(!attr)) + return NULL; + result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); + Py_DECREF(attr); + return result; +} +#endif + +/* dict_setdefault (used by CLineInTraceback) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + PyObject *args[] = {d, key, default_value}; + value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#elif CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#else + value = PyDict_SetDefault(d, key, default_value); + if (unlikely(!value)) return NULL; + Py_INCREF(value); +#endif + return value; +} + +/* CLineInTraceback (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) +#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); +#else +PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { + PyObject **dict_ptr = _PyObject_GetDictPtr(o); + return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; +} +#endif +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline = NULL; + PyObject *ptype, *pvalue, *ptraceback; + PyObject *cython_runtime_dict; + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, cython_runtime_dict, + __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) + } + if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + Py_XDECREF(use_cline); + Py_XDECREF(cython_runtime_dict); + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache (used by AddTraceback) */ +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { + __Pyx_CachedCodeObjectType* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!code_cache->entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { + return NULL; + } + code_object = code_cache->entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__find_code_object; + return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); + if (old_count < 0) { + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); + return NULL; + } +#endif + __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); +#endif + return result; +#endif +} +static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) +{ + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + code_cache->entries = entries; + code_cache->max_count = 64; + code_cache->count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { + __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_INCREF(code_object); + Py_DECREF(tmp); + return; + } + if (code_cache->count == code_cache->max_count) { + int new_max = code_cache->max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + code_cache->entries = entries; + code_cache->max_count = new_max; + } + for (i=code_cache->count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + code_cache->count++; + Py_INCREF(code_object); +} +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__insert_code_object; + return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type expected = 0; + if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { + return; + } +#endif + __pyx__insert_code_object(code_cache, code_line, code_object); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); +#endif +#endif +} + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!code_object) { + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + } else { + py_funcname = PyUnicode_FromString(funcname); + } + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); + } else { + dict = PyDict_New(); + } + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + } + py_code = PyCode_NewEmpty(filename, funcname, py_line); + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} +#endif + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_5spacy_15parts_of_speech_univ_pos_t(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t neg_one = (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) -1, const_zero = (enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static __Pyx_TypeName +__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) +{ + PyObject *module = NULL, *name = NULL, *result = NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_qualname); + #else + name = PyType_GetQualName(tp); + #endif + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; + module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_module_2); + if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; + if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { + result = name; + name = NULL; + goto done; + } + result = PyUnicode_FromFormat("%U.%U", module, name); + if (unlikely(result == NULL)) goto bad; + done: + Py_XDECREF(name); + Py_XDECREF(module); + return result; + bad: + PyErr_Clear(); + if (name) { + result = name; + name = NULL; + } else { + result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__3); + } + goto done; +} +#endif + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPyVerify (used by CIntFromPy) */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + long val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (long) -1; + val = __Pyx_PyLong_As_long(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + long val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (long) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (long) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = v; + } + v = NULL; + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((long) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (long) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + int val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (int) -1; + val = __Pyx_PyLong_As_int(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(int) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + int val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (int) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = v; + } + v = NULL; + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((int) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (int) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); + for (i=0; i>= 8; + ++i; + } + __Pyx_cached_runtime_version = version; + } +} +#endif +static unsigned long __Pyx_get_runtime_version(void) { +#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + return Py_Version & ~0xFFUL; +#else + return __Pyx_cached_runtime_version; +#endif +} + +/* AddModuleRef */ +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { + PyObject *module_dict = PyImport_GetModuleDict(); + PyObject *m; + if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { + return NULL; + } + if (m != NULL && PyModule_Check(m)) { + return m; + } + Py_XDECREF(m); + m = PyModule_NewObject(name); + if (m == NULL) + return NULL; + if (PyDict_CheckExact(module_dict)) { + PyObject *new_m; + (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); + Py_DECREF(m); + return new_m; + } else { + if (PyObject_SetItem(module_dict, name, m) != 0) { + Py_DECREF(m); + return NULL; + } + return m; + } + } + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *py_name = PyUnicode_FromString(name); + if (!py_name) return NULL; + PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); + Py_DECREF(py_name); + return module; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } +#endif + +/* CheckBinaryVersion */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { + const unsigned long MAJOR_MINOR = 0xFFFF0000UL; + if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) + return 0; + if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) + return 1; + { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compile time Python version %d.%d " + "of module '%.100s' " + "%s " + "runtime version %d.%d", + (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), + __Pyx_MODULE_NAME, + (allow_newer) ? "was newer than" : "does not match", + (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) + ); + return PyErr_WarnEx(NULL, message, 1); + } +} + +/* DecompressString */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { + PyObject *module, *decompress, *compressed_bytes, *decompressed; + const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; + PyObject *methodname = PyUnicode_FromString("decompress"); + if (unlikely(!methodname)) return NULL; + #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 + if (algo == 3) { + PyObject *fromlist = Py_BuildValue("[O]", methodname); + if (unlikely(!fromlist)) return NULL; + module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + } else + #endif + module = PyImport_ImportModule(module_name); + if (unlikely(!module)) goto import_failed; + decompress = PyObject_GetAttr(module, methodname); + if (unlikely(!decompress)) goto import_failed; + { + #ifdef __cplusplus + char *memview_bytes = const_cast(s); + #else + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wcast-qual" + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-qual" + #endif + char *memview_bytes = (char*) s; + #if defined(__clang__) + #pragma clang diagnostic pop + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + #endif + #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) + int memview_flags = 0x100; + #else + int memview_flags = PyBUF_READ; + #endif + compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); + } + if (unlikely(!compressed_bytes)) { + Py_DECREF(decompress); + goto bad; + } + decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); + Py_DECREF(compressed_bytes); + Py_DECREF(decompress); + Py_DECREF(module); + Py_DECREF(methodname); + return decompressed; +import_failed: + PyErr_Format(PyExc_ImportError, + "Failed to import '%.20s.decompress' - cannot initialise module strings. " + "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", + module_name, algo); +bad: + Py_XDECREF(module); + Py_DECREF(methodname); + return NULL; +} + +#include +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return __Pyx_PyUnicode_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return PyByteArray_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + { + const char* result; + Py_ssize_t unicode_length; + CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; + #else + result = PyUnicode_AsUTF8AndSize(o, length); + #endif + #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + unicode_length = PyUnicode_GetLength(o); + if (unlikely(unicode_length < 0)) return NULL; + if (unlikely(unicode_length != *length)) { + PyUnicode_AsASCIIString(o); + return NULL; + } + #endif + return result; + } +#else +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +#endif +} +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + if (PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif + if (PyByteArray_Check(o)) { +#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); +#else + *length = PyByteArray_Size(o); + if (*length == -1) return NULL; + return PyByteArray_AsString(o); +#endif + } else + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; + } + __Pyx_DECREF_TypeName(result_type_name); + return result; + } + PyErr_Format(PyExc_TypeError, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", + result_type_name); + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + PyObject *res = NULL; + if (likely(PyLong_Check(x))) + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + if (likely(m && m->nb_int)) { + res = m->nb_int(x); + } +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Long(x); + } +#endif + if (likely(res)) { + if (unlikely(!PyLong_CheckExact(res))) { + return __Pyx_PyNumber_LongWrongResultType(res); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); + } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyLong_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyLong_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { + CYTHON_UNUSED_VAR(b); + return __Pyx_NewRef(Py_None); +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return __Pyx_NewRef(b ? Py_True: Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { + return PyLong_FromSize_t(ival); +} + + +/* MultiPhaseInitModuleState */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 +#else + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 +#endif +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS +#error "Module state with PEP489 requires atomics. Currently that's one of\ + C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" +#endif +#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#define __Pyx_ModuleStateLookup_Lock() +#define __Pyx_ModuleStateLookup_Unlock() +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 +static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; +#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(__cplusplus) && __cplusplus >= 201103L +#include +static std::mutex __Pyx_ModuleStateLookup_mutex; +#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() +#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) +#include +static mtx_t __Pyx_ModuleStateLookup_mutex; +static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; +static void __Pyx_ModuleStateLookup_initialize_mutex(void) { + mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); +} +#define __Pyx_ModuleStateLookup_Lock()\ + call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ + mtx_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(HAVE_PTHREAD_H) +#include +static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; +#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(_WIN32) +#include // synchapi.h on its own doesn't work +static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; +#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#else +#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ + Requires C standard >= C11, or C++ standard >= C++11,\ + or pthreads, or the Windows 32 API, or Python >= 3.13." +#endif +typedef struct { + int64_t id; + PyObject *module; +} __Pyx_InterpreterIdAndModule; +typedef struct { + char interpreter_id_as_index; + Py_ssize_t count; + Py_ssize_t allocated; + __Pyx_InterpreterIdAndModule table[1]; +} __Pyx_ModuleStateLookupData; +#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; +#else +static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; +#endif +static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( + __Pyx_InterpreterIdAndModule* table, + Py_ssize_t count, + int64_t interpreterId) { + __Pyx_InterpreterIdAndModule* begin = table; + __Pyx_InterpreterIdAndModule* end = begin + count; + if (begin->id == interpreterId) { + return begin; + } + while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; + if (halfway->id == interpreterId) { + return halfway; + } + if (halfway->id < interpreterId) { + begin = halfway; + } else { + end = halfway; + } + } + for (; begin < end; ++begin) { + if (begin->id >= interpreterId) return begin; + } + return begin; +} +static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return NULL; +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + { + __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + if (likely(data)) { + __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); + if (likely(data == new_data)) { + goto read_finished; + } + } + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + __Pyx_ModuleStateLookup_Lock(); + __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); + data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + __Pyx_ModuleStateLookup_Unlock(); + } + read_finished:; +#else + __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_InterpreterIdAndModule* found = NULL; + if (unlikely(!data)) goto end; + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + found = data->table+interpreter_id; + } + } else { + found = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + } + end: + { + PyObject *result=NULL; + if (found && found->id == interpreter_id) { + result = found->module; + } +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); +#endif + return result; + } +} +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { + while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); +} +#else +#define __Pyx_ModuleStateLookup_wait_until_no_readers() +#endif +static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { + Py_ssize_t to_allocate = (*old_data)->allocated; + while (to_allocate <= interpreter_id) { + if (to_allocate == 0) to_allocate = 1; + else to_allocate *= 2; + } + __Pyx_ModuleStateLookupData *new_data = *old_data; + if (to_allocate != (*old_data)->allocated) { + new_data = (__Pyx_ModuleStateLookupData *)realloc( + *old_data, + sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + PyErr_NoMemory(); + return -1; + } + for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { + new_data->table[i].id = i; + new_data->table[i].module = NULL; + } + new_data->allocated = to_allocate; + } + new_data->table[interpreter_id].module = module; + if (new_data->count < interpreter_id+1) { + new_data->count = interpreter_id+1; + } + *old_data = new_data; + return 0; +} +static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { + __Pyx_InterpreterIdAndModule *read = data->table; + __Pyx_InterpreterIdAndModule *write = data->table; + __Pyx_InterpreterIdAndModule *end = read + data->count; + for (; readmodule) { + write->id = read->id; + write->module = read->module; + ++write; + } + } + data->count = write - data->table; + for (; writeid = 0; + write->module = NULL; + } + data->interpreter_id_as_index = 0; +} +static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + int result = 0; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_ModuleStateLookupData *new_data = old_data; + if (!new_data) { + new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); + if (!new_data) { + result = -1; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = 1; + new_data->interpreter_id_as_index = 1; + } + __Pyx_ModuleStateLookup_wait_until_no_readers(); + if (new_data->interpreter_id_as_index) { + if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); + goto end; + } + __Pyx_State_ConvertFromInterpIdAsIndex(new_data); + } + { + Py_ssize_t insert_at = 0; + { + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + new_data->table, new_data->count, interpreter_id); + assert(lower_bound); + insert_at = lower_bound - new_data->table; + if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { + lower_bound->module = module; + goto end; // already in table, nothing more to do + } + } + if (new_data->count+1 >= new_data->allocated) { + Py_ssize_t to_allocate = (new_data->count+1)*2; + new_data = + (__Pyx_ModuleStateLookupData*)realloc( + new_data, + sizeof(__Pyx_ModuleStateLookupData) + + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + result = -1; + new_data = old_data; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = to_allocate; + } + ++new_data->count; + int64_t last_id = interpreter_id; + PyObject *last_module = module; + for (Py_ssize_t i=insert_at; icount; ++i) { + int64_t current_id = new_data->table[i].id; + new_data->table[i].id = last_id; + last_id = current_id; + PyObject *current_module = new_data->table[i].module; + new_data->table[i].module = last_module; + last_module = current_module; + } + } + end: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); +#else + __Pyx_ModuleStateLookup_data = new_data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return result; +} +static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; +#endif + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + data->table[interpreter_id].module = NULL; + } + goto done; + } + { + __Pyx_ModuleStateLookup_wait_until_no_readers(); + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + if (!lower_bound) goto done; + if (lower_bound->id != interpreter_id) goto done; + __Pyx_InterpreterIdAndModule *end = data->table+data->count; + for (;lower_boundid = (lower_bound+1)->id; + lower_bound->module = (lower_bound+1)->module; + } + } + --data->count; + if (data->count == 0) { + free(data); + data = NULL; + } + done: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); +#else + __Pyx_ModuleStateLookup_data = data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return 0; +} +#endif + +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ +#endif /* Py_PYTHON_H */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/parts_of_speech.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/parts_of_speech.pxd new file mode 100644 index 0000000000000000000000000000000000000000..a0845443868fab6b83f79ad3cf301f66b39b6993 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/parts_of_speech.pxd @@ -0,0 +1,25 @@ +from . cimport symbols + + +cpdef enum univ_pos_t: + NO_TAG = 0 + ADJ = symbols.ADJ + ADP + ADV + AUX + CONJ + CCONJ # U20 + DET + INTJ + NOUN + NUM + PART + PRON + PROPN + PUNCT + SCONJ + SYM + VERB + X + EOL + SPACE diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/parts_of_speech.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/parts_of_speech.pyx new file mode 100644 index 0000000000000000000000000000000000000000..697d688fd52e5a1a10e85280d20ea2a985aa4d30 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/parts_of_speech.pyx @@ -0,0 +1,32 @@ +# cython: profile=False +IDS = { + "": NO_TAG, + "ADJ": ADJ, + "ADP": ADP, + "ADV": ADV, + "AUX": AUX, + "CONJ": CONJ, # U20 + "CCONJ": CCONJ, + "DET": DET, + "INTJ": INTJ, + "NOUN": NOUN, + "NUM": NUM, + "PART": PART, + "PRON": PRON, + "PROPN": PROPN, + "PUNCT": PUNCT, + "SCONJ": SCONJ, + "SYM": SYM, + "VERB": VERB, + "X": X, + "EOL": EOL, + "SPACE": SPACE +} + + +NAMES = {value: key for key, value in IDS.items()} + +# As of Cython 3.1, the global Python namespace no longer has the enum +# contents by default. +globals().update(IDS) + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipe_analysis.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipe_analysis.py new file mode 100644 index 0000000000000000000000000000000000000000..0456f5fa44dd31bef45ccdfb3949d469ede5c497 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/pipe_analysis.py @@ -0,0 +1,138 @@ +from typing import TYPE_CHECKING, Dict, ItemsView, Iterable, List, Set, Union + +from wasabi import msg + +from .errors import Errors +from .tokens import Doc, Span, Token +from .util import dot_to_dict + +if TYPE_CHECKING: + # This lets us add type hints for mypy etc. without causing circular imports + from .language import Language # noqa: F401 + + +DEFAULT_KEYS = ["requires", "assigns", "scores", "retokenizes"] + + +def validate_attrs(values: Iterable[str]) -> Iterable[str]: + """Validate component attributes provided to "assigns", "requires" etc. + Raises error for invalid attributes and formatting. Doesn't check if + custom extension attributes are registered, since this is something the + user might want to do themselves later in the component. + + values (Iterable[str]): The string attributes to check, e.g. `["token.pos"]`. + RETURNS (Iterable[str]): The checked attributes. + """ + data = dot_to_dict({value: True for value in values}) + objs = {"doc": Doc, "token": Token, "span": Span} + for obj_key, attrs in data.items(): + if obj_key == "span": + # Support Span only for custom extension attributes + span_attrs = [attr for attr in values if attr.startswith("span.")] + span_attrs = [attr for attr in span_attrs if not attr.startswith("span._.")] + if span_attrs: + raise ValueError(Errors.E180.format(attrs=", ".join(span_attrs))) + if obj_key not in objs: # first element is not doc/token/span + invalid_attrs = ", ".join(a for a in values if a.startswith(obj_key)) + raise ValueError(Errors.E181.format(obj=obj_key, attrs=invalid_attrs)) + if not isinstance(attrs, dict): # attr is something like "doc" + raise ValueError(Errors.E182.format(attr=obj_key)) + for attr, value in attrs.items(): + if attr == "_": + if value is True: # attr is something like "doc._" + raise ValueError(Errors.E182.format(attr="{}._".format(obj_key))) + for ext_attr, ext_value in value.items(): + # We don't check whether the attribute actually exists + if ext_value is not True: # attr is something like doc._.x.y + good = f"{obj_key}._.{ext_attr}" + bad = f"{good}.{'.'.join(ext_value)}" + raise ValueError(Errors.E183.format(attr=bad, solution=good)) + continue # we can't validate those further + if attr.endswith("_"): # attr is something like "token.pos_" + raise ValueError(Errors.E184.format(attr=attr, solution=attr[:-1])) + if value is not True: # attr is something like doc.x.y + good = f"{obj_key}.{attr}" + bad = f"{good}.{'.'.join(value)}" + raise ValueError(Errors.E183.format(attr=bad, solution=good)) + obj = objs[obj_key] + if not hasattr(obj, attr): + raise ValueError(Errors.E185.format(obj=obj_key, attr=attr)) + return values + + +def get_attr_info(nlp: "Language", attr: str) -> Dict[str, List[str]]: + """Check which components in the pipeline assign or require an attribute. + + nlp (Language): The current nlp object. + attr (str): The attribute, e.g. "doc.tensor". + RETURNS (Dict[str, List[str]]): A dict keyed by "assigns" and "requires", + mapped to a list of component names. + """ + result: Dict[str, List[str]] = {"assigns": [], "requires": []} + for pipe_name in nlp.pipe_names: + meta = nlp.get_pipe_meta(pipe_name) + if attr in meta.assigns: + result["assigns"].append(pipe_name) + if attr in meta.requires: + result["requires"].append(pipe_name) + return result + + +def analyze_pipes( + nlp: "Language", *, keys: List[str] = DEFAULT_KEYS +) -> Dict[str, Dict[str, Union[List[str], Dict]]]: + """Print a formatted summary for the current nlp object's pipeline. Shows + a table with the pipeline components and why they assign and require, as + well as any problems if available. + + nlp (Language): The nlp object. + keys (List[str]): The meta keys to show in the table. + RETURNS (dict): A dict with "summary" and "problems". + """ + result: Dict[str, Dict[str, Union[List[str], Dict]]] = { + "summary": {}, + "problems": {}, + } + all_attrs: Set[str] = set() + for i, name in enumerate(nlp.pipe_names): + meta = nlp.get_pipe_meta(name) + all_attrs.update(meta.assigns) + all_attrs.update(meta.requires) + result["summary"][name] = {key: getattr(meta, key, None) for key in keys} + prev_pipes = nlp.pipeline[:i] + requires = {annot: False for annot in meta.requires} + if requires: + for prev_name, prev_pipe in prev_pipes: + prev_meta = nlp.get_pipe_meta(prev_name) + for annot in prev_meta.assigns: + requires[annot] = True + result["problems"][name] = [ + annot for annot, fulfilled in requires.items() if not fulfilled + ] + result["attrs"] = {attr: get_attr_info(nlp, attr) for attr in all_attrs} + return result + + +def print_pipe_analysis( + analysis: Dict[str, Dict[str, Union[List[str], Dict]]], + *, + keys: List[str] = DEFAULT_KEYS, +) -> None: + """Print a formatted version of the pipe analysis produced by analyze_pipes. + + analysis (Dict[str, Union[List[str], Dict[str, List[str]]]]): The analysis. + keys (List[str]): The meta keys to show in the table. + """ + msg.divider("Pipeline Overview") + header = ["#", "Component", *[key.capitalize() for key in keys]] + summary: ItemsView = analysis["summary"].items() + body = [[i, n, *[v for v in m.values()]] for i, (n, m) in enumerate(summary)] + msg.table(body, header=header, divider=True, multiline=True) + n_problems = sum(len(p) for p in analysis["problems"].values()) + if any(p for p in analysis["problems"].values()): + msg.divider(f"Problems ({n_problems})") + for name, problem in analysis["problems"].items(): + if problem: + msg.warn(f"'{name}' requirements not met: {', '.join(problem)}") + else: + msg.good("No problems found.") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/py.typed b/TTS/Kokoro/.venv/Lib/site-packages/spacy/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/registrations.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/registrations.py new file mode 100644 index 0000000000000000000000000000000000000000..4f8b5c5286df50da861dcec575a4d20671b38b70 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/registrations.py @@ -0,0 +1,246 @@ +"""Centralized registry population for spaCy config + +This module centralizes registry decorations to prevent circular import issues +with Cython annotation changes from __future__ import annotations. Functions +remain in their original locations, but decoration is moved here. + +Component definitions and registrations are in spacy/pipeline/factories.py +""" + +# Global flag to track if registry has been populated +REGISTRY_POPULATED = False + + +def populate_registry() -> None: + """Populate the registry with all necessary components. + + This function should be called before accessing the registry, to ensure + it's populated. The function uses a global flag to prevent repopulation. + """ + global REGISTRY_POPULATED + if REGISTRY_POPULATED: + return + + # Import all necessary modules + from .lang.ja import create_tokenizer as create_japanese_tokenizer + from .lang.ko import create_tokenizer as create_korean_tokenizer + from .lang.th import create_thai_tokenizer + from .lang.vi import create_vietnamese_tokenizer + from .lang.zh import create_chinese_tokenizer + from .language import load_lookups_data + from .matcher.levenshtein import make_levenshtein_compare + from .ml.models.entity_linker import ( + create_candidates, + create_candidates_batch, + empty_kb, + empty_kb_for_config, + load_kb, + ) + from .pipeline.attributeruler import make_attribute_ruler_scorer + from .pipeline.dep_parser import make_parser_scorer + + # Import the functions we refactored by removing direct registry decorators + from .pipeline.entity_linker import make_entity_linker_scorer + from .pipeline.entityruler import ( + make_entity_ruler_scorer as make_entityruler_scorer, + ) + from .pipeline.lemmatizer import make_lemmatizer_scorer + from .pipeline.morphologizer import make_morphologizer_scorer + from .pipeline.ner import make_ner_scorer + from .pipeline.senter import make_senter_scorer + from .pipeline.span_finder import make_span_finder_scorer + from .pipeline.span_ruler import ( + make_overlapping_labeled_spans_scorer, + make_preserve_existing_ents_filter, + make_prioritize_new_ents_filter, + ) + from .pipeline.spancat import ( + build_ngram_range_suggester, + build_ngram_suggester, + build_preset_spans_suggester, + make_spancat_scorer, + ) + + # Import all pipeline components that were using registry decorators + from .pipeline.tagger import make_tagger_scorer + from .pipeline.textcat import make_textcat_scorer + from .pipeline.textcat_multilabel import make_textcat_multilabel_scorer + from .util import make_first_longest_spans_filter, registry + + # Register miscellaneous components + registry.misc("spacy.first_longest_spans_filter.v1")( + make_first_longest_spans_filter + ) + registry.misc("spacy.ngram_suggester.v1")(build_ngram_suggester) + registry.misc("spacy.ngram_range_suggester.v1")(build_ngram_range_suggester) + registry.misc("spacy.preset_spans_suggester.v1")(build_preset_spans_suggester) + registry.misc("spacy.prioritize_new_ents_filter.v1")( + make_prioritize_new_ents_filter + ) + registry.misc("spacy.prioritize_existing_ents_filter.v1")( + make_preserve_existing_ents_filter + ) + registry.misc("spacy.levenshtein_compare.v1")(make_levenshtein_compare) + # KB-related registrations + registry.misc("spacy.KBFromFile.v1")(load_kb) + registry.misc("spacy.EmptyKB.v2")(empty_kb_for_config) + registry.misc("spacy.EmptyKB.v1")(empty_kb) + registry.misc("spacy.CandidateGenerator.v1")(create_candidates) + registry.misc("spacy.CandidateBatchGenerator.v1")(create_candidates_batch) + registry.misc("spacy.LookupsDataLoader.v1")(load_lookups_data) + + # Need to get references to the existing functions in registry by importing the function that is there + # For the registry that was previously decorated + + # Import ML components that use registry + from .language import create_tokenizer + from .ml._precomputable_affine import PrecomputableAffine + from .ml.callbacks import ( + create_models_and_pipes_with_nvtx_range, + create_models_with_nvtx_range, + ) + from .ml.extract_ngrams import extract_ngrams + from .ml.extract_spans import extract_spans + + # Import decorator-removed ML components + from .ml.featureextractor import FeatureExtractor + from .ml.models.entity_linker import build_nel_encoder + from .ml.models.multi_task import ( + create_pretrain_characters, + create_pretrain_vectors, + ) + from .ml.models.parser import build_tb_parser_model + from .ml.models.span_finder import build_finder_model + from .ml.models.spancat import ( + build_linear_logistic, + build_mean_max_reducer, + build_spancat_model, + ) + from .ml.models.tagger import build_tagger_model + from .ml.models.textcat import ( + build_bow_text_classifier, + build_bow_text_classifier_v3, + build_reduce_text_classifier, + build_simple_cnn_text_classifier, + build_text_classifier_lowdata, + build_text_classifier_v2, + build_textcat_parametric_attention_v1, + ) + from .ml.models.tok2vec import ( + BiLSTMEncoder, + CharacterEmbed, + MaxoutWindowEncoder, + MishWindowEncoder, + MultiHashEmbed, + build_hash_embed_cnn_tok2vec, + build_Tok2Vec_model, + tok2vec_listener_v1, + ) + from .ml.staticvectors import StaticVectors + from .ml.tb_framework import TransitionModel + from .training.augment import ( + create_combined_augmenter, + create_lower_casing_augmenter, + create_orth_variants_augmenter, + ) + from .training.batchers import ( + configure_minibatch, + configure_minibatch_by_padded_size, + configure_minibatch_by_words, + ) + from .training.callbacks import create_copy_from_base_model + from .training.loggers import console_logger, console_logger_v3 + + # Register scorers + registry.scorers("spacy.tagger_scorer.v1")(make_tagger_scorer) + registry.scorers("spacy.ner_scorer.v1")(make_ner_scorer) + # span_ruler_scorer removed as it's not in span_ruler.py + registry.scorers("spacy.entity_ruler_scorer.v1")(make_entityruler_scorer) + registry.scorers("spacy.senter_scorer.v1")(make_senter_scorer) + registry.scorers("spacy.textcat_scorer.v1")(make_textcat_scorer) + registry.scorers("spacy.textcat_scorer.v2")(make_textcat_scorer) + registry.scorers("spacy.textcat_multilabel_scorer.v1")( + make_textcat_multilabel_scorer + ) + registry.scorers("spacy.textcat_multilabel_scorer.v2")( + make_textcat_multilabel_scorer + ) + registry.scorers("spacy.lemmatizer_scorer.v1")(make_lemmatizer_scorer) + registry.scorers("spacy.span_finder_scorer.v1")(make_span_finder_scorer) + registry.scorers("spacy.spancat_scorer.v1")(make_spancat_scorer) + registry.scorers("spacy.entity_linker_scorer.v1")(make_entity_linker_scorer) + registry.scorers("spacy.overlapping_labeled_spans_scorer.v1")( + make_overlapping_labeled_spans_scorer + ) + registry.scorers("spacy.attribute_ruler_scorer.v1")(make_attribute_ruler_scorer) + registry.scorers("spacy.parser_scorer.v1")(make_parser_scorer) + registry.scorers("spacy.morphologizer_scorer.v1")(make_morphologizer_scorer) + + # Register tokenizers + registry.tokenizers("spacy.Tokenizer.v1")(create_tokenizer) + registry.tokenizers("spacy.ja.JapaneseTokenizer")(create_japanese_tokenizer) + registry.tokenizers("spacy.zh.ChineseTokenizer")(create_chinese_tokenizer) + registry.tokenizers("spacy.ko.KoreanTokenizer")(create_korean_tokenizer) + registry.tokenizers("spacy.vi.VietnameseTokenizer")(create_vietnamese_tokenizer) + registry.tokenizers("spacy.th.ThaiTokenizer")(create_thai_tokenizer) + + # Register tok2vec architectures we've modified + registry.architectures("spacy.Tok2VecListener.v1")(tok2vec_listener_v1) + registry.architectures("spacy.HashEmbedCNN.v2")(build_hash_embed_cnn_tok2vec) + registry.architectures("spacy.Tok2Vec.v2")(build_Tok2Vec_model) + registry.architectures("spacy.MultiHashEmbed.v2")(MultiHashEmbed) + registry.architectures("spacy.CharacterEmbed.v2")(CharacterEmbed) + registry.architectures("spacy.MaxoutWindowEncoder.v2")(MaxoutWindowEncoder) + registry.architectures("spacy.MishWindowEncoder.v2")(MishWindowEncoder) + registry.architectures("spacy.TorchBiLSTMEncoder.v1")(BiLSTMEncoder) + registry.architectures("spacy.EntityLinker.v2")(build_nel_encoder) + registry.architectures("spacy.TextCatCNN.v2")(build_simple_cnn_text_classifier) + registry.architectures("spacy.TextCatBOW.v2")(build_bow_text_classifier) + registry.architectures("spacy.TextCatBOW.v3")(build_bow_text_classifier_v3) + registry.architectures("spacy.TextCatEnsemble.v2")(build_text_classifier_v2) + registry.architectures("spacy.TextCatLowData.v1")(build_text_classifier_lowdata) + registry.architectures("spacy.TextCatParametricAttention.v1")( + build_textcat_parametric_attention_v1 + ) + registry.architectures("spacy.TextCatReduce.v1")(build_reduce_text_classifier) + registry.architectures("spacy.SpanCategorizer.v1")(build_spancat_model) + registry.architectures("spacy.SpanFinder.v1")(build_finder_model) + registry.architectures("spacy.TransitionBasedParser.v2")(build_tb_parser_model) + registry.architectures("spacy.PretrainVectors.v1")(create_pretrain_vectors) + registry.architectures("spacy.PretrainCharacters.v1")(create_pretrain_characters) + registry.architectures("spacy.Tagger.v2")(build_tagger_model) + + # Register layers + registry.layers("spacy.FeatureExtractor.v1")(FeatureExtractor) + registry.layers("spacy.extract_spans.v1")(extract_spans) + registry.layers("spacy.extract_ngrams.v1")(extract_ngrams) + registry.layers("spacy.LinearLogistic.v1")(build_linear_logistic) + registry.layers("spacy.mean_max_reducer.v1")(build_mean_max_reducer) + registry.layers("spacy.StaticVectors.v2")(StaticVectors) + registry.layers("spacy.PrecomputableAffine.v1")(PrecomputableAffine) + registry.layers("spacy.CharEmbed.v1")(CharacterEmbed) + registry.layers("spacy.TransitionModel.v1")(TransitionModel) + + # Register callbacks + registry.callbacks("spacy.copy_from_base_model.v1")(create_copy_from_base_model) + registry.callbacks("spacy.models_with_nvtx_range.v1")(create_models_with_nvtx_range) + registry.callbacks("spacy.models_and_pipes_with_nvtx_range.v1")( + create_models_and_pipes_with_nvtx_range + ) + + # Register loggers + registry.loggers("spacy.ConsoleLogger.v2")(console_logger) + registry.loggers("spacy.ConsoleLogger.v3")(console_logger_v3) + + # Register batchers + registry.batchers("spacy.batch_by_padded.v1")(configure_minibatch_by_padded_size) + registry.batchers("spacy.batch_by_words.v1")(configure_minibatch_by_words) + registry.batchers("spacy.batch_by_sequence.v1")(configure_minibatch) + + # Register augmenters + registry.augmenters("spacy.combined_augmenter.v1")(create_combined_augmenter) + registry.augmenters("spacy.lower_case.v1")(create_lower_casing_augmenter) + registry.augmenters("spacy.orth_variants.v1")(create_orth_variants_augmenter) + + # Set the flag to indicate that the registry has been populated + REGISTRY_POPULATED = True diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/schemas.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/schemas.py new file mode 100644 index 0000000000000000000000000000000000000000..049c9f7da515786a1c661b52c1469991a6204f5e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/schemas.py @@ -0,0 +1,534 @@ +import inspect +import re +from collections import defaultdict +from enum import Enum +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Dict, + Iterable, + List, + Optional, + Tuple, + Type, + TypeVar, + Union, +) + +try: + from pydantic.v1 import ( + BaseModel, + ConstrainedStr, + Field, + StrictBool, + StrictFloat, + StrictInt, + StrictStr, + ValidationError, + create_model, + validator, + ) + from pydantic.v1.main import ModelMetaclass +except ImportError: + from pydantic import ( # type: ignore + BaseModel, + ConstrainedStr, + Field, + StrictBool, + StrictFloat, + StrictInt, + StrictStr, + ValidationError, + create_model, + validator, + ) + from pydantic.main import ModelMetaclass # type: ignore +from thinc.api import ConfigValidationError, Model, Optimizer +from thinc.config import Promise + +from .attrs import NAMES +from .compat import Literal +from .lookups import Lookups +from .util import is_cython_func + +if TYPE_CHECKING: + # This lets us add type hints for mypy etc. without causing circular imports + from .language import Language # noqa: F401 + from .training import Example # noqa: F401 + from .vocab import Vocab # noqa: F401 + + +# fmt: off +ItemT = TypeVar("ItemT") +Batcher = Union[Callable[[Iterable[ItemT]], Iterable[List[ItemT]]], Promise] +Reader = Union[Callable[["Language", str], Iterable["Example"]], Promise] +Logger = Union[Callable[["Language"], Tuple[Callable[[Dict[str, Any]], None], Callable]], Promise] +# fmt: on + + +def validate(schema: Type[BaseModel], obj: Dict[str, Any]) -> List[str]: + """Validate data against a given pydantic schema. + + obj (Dict[str, Any]): JSON-serializable data to validate. + schema (pydantic.BaseModel): The schema to validate against. + RETURNS (List[str]): A list of error messages, if available. + """ + try: + schema(**obj) + return [] + except ValidationError as e: + errors = e.errors() + data = defaultdict(list) + for error in errors: + err_loc = " -> ".join([str(p) for p in error.get("loc", [])]) + data[err_loc].append(error.get("msg")) + return [f"[{loc}] {', '.join(msg)}" for loc, msg in data.items()] # type: ignore[arg-type] + + +# Initialization + + +class ArgSchemaConfig: + extra = "forbid" + arbitrary_types_allowed = True + + +class ArgSchemaConfigExtra: + extra = "forbid" + arbitrary_types_allowed = True + + +def get_arg_model( + func: Callable, + *, + exclude: Iterable[str] = tuple(), + name: str = "ArgModel", + strict: bool = True, +) -> ModelMetaclass: + """Generate a pydantic model for function arguments. + + func (Callable): The function to generate the schema for. + exclude (Iterable[str]): Parameter names to ignore. + name (str): Name of created model class. + strict (bool): Don't allow extra arguments if no variable keyword arguments + are allowed on the function. + RETURNS (ModelMetaclass): A pydantic model. + """ + sig_args = {} + try: + sig = inspect.signature(func) + except ValueError: + # Typically happens if the method is part of a Cython module without + # binding=True. Here we just use an empty model that allows everything. + return create_model(name, __config__=ArgSchemaConfigExtra) # type: ignore[arg-type, return-value] + has_variable = False + for param in sig.parameters.values(): + if param.name in exclude: + continue + if param.kind == param.VAR_KEYWORD: + # The function allows variable keyword arguments so we shouldn't + # include **kwargs etc. in the schema and switch to non-strict + # mode and pass through all other values + has_variable = True + continue + # If no annotation is specified assume it's anything + annotation = param.annotation if param.annotation != param.empty else Any + # If no default value is specified assume that it's required. Cython + # functions/methods will have param.empty for default value None so we + # need to treat them differently + default_empty = None if is_cython_func(func) else ... + default = param.default if param.default != param.empty else default_empty + sig_args[param.name] = (annotation, default) + is_strict = strict and not has_variable + sig_args["__config__"] = ArgSchemaConfig if is_strict else ArgSchemaConfigExtra # type: ignore[assignment] + return create_model(name, **sig_args) # type: ignore[call-overload, arg-type, return-value] + + +def validate_init_settings( + func: Callable, + settings: Dict[str, Any], + *, + section: Optional[str] = None, + name: str = "", + exclude: Iterable[str] = ("get_examples", "nlp"), +) -> Dict[str, Any]: + """Validate initialization settings against the expected arguments in + the method signature. Will parse values if possible (e.g. int to string) + and return the updated settings dict. Will raise a ConfigValidationError + if types don't match or required values are missing. + + func (Callable): The initialize method of a given component etc. + settings (Dict[str, Any]): The settings from the respective [initialize] block. + section (str): Initialize section, for error message. + name (str): Name of the block in the section. + exclude (Iterable[str]): Parameter names to exclude from schema. + RETURNS (Dict[str, Any]): The validated settings. + """ + schema = get_arg_model(func, exclude=exclude, name="InitArgModel") + try: + return schema(**settings).dict() + except ValidationError as e: + block = "initialize" if not section else f"initialize.{section}" + title = f"Error validating initialization settings in [{block}]" + raise ConfigValidationError( + title=title, errors=e.errors(), config=settings, parent=name + ) from None + + +# Matcher token patterns + + +def validate_token_pattern(obj: list) -> List[str]: + # Try to convert non-string keys (e.g. {ORTH: "foo"} -> {"ORTH": "foo"}) + get_key = lambda k: NAMES[k] if isinstance(k, int) and k < len(NAMES) else k + if isinstance(obj, list): + converted = [] + for pattern in obj: + if isinstance(pattern, dict): + pattern = {get_key(k): v for k, v in pattern.items()} + converted.append(pattern) + obj = converted + return validate(TokenPatternSchema, {"pattern": obj}) + + +class TokenPatternString(BaseModel): + REGEX: Optional[Union[StrictStr, "TokenPatternString"]] = Field(None, alias="regex") + IN: Optional[List[StrictStr]] = Field(None, alias="in") + NOT_IN: Optional[List[StrictStr]] = Field(None, alias="not_in") + IS_SUBSET: Optional[List[StrictStr]] = Field(None, alias="is_subset") + IS_SUPERSET: Optional[List[StrictStr]] = Field(None, alias="is_superset") + INTERSECTS: Optional[List[StrictStr]] = Field(None, alias="intersects") + FUZZY: Optional[Union[StrictStr, "TokenPatternString"]] = Field(None, alias="fuzzy") + FUZZY1: Optional[Union[StrictStr, "TokenPatternString"]] = Field( + None, alias="fuzzy1" + ) + FUZZY2: Optional[Union[StrictStr, "TokenPatternString"]] = Field( + None, alias="fuzzy2" + ) + FUZZY3: Optional[Union[StrictStr, "TokenPatternString"]] = Field( + None, alias="fuzzy3" + ) + FUZZY4: Optional[Union[StrictStr, "TokenPatternString"]] = Field( + None, alias="fuzzy4" + ) + FUZZY5: Optional[Union[StrictStr, "TokenPatternString"]] = Field( + None, alias="fuzzy5" + ) + FUZZY6: Optional[Union[StrictStr, "TokenPatternString"]] = Field( + None, alias="fuzzy6" + ) + FUZZY7: Optional[Union[StrictStr, "TokenPatternString"]] = Field( + None, alias="fuzzy7" + ) + FUZZY8: Optional[Union[StrictStr, "TokenPatternString"]] = Field( + None, alias="fuzzy8" + ) + FUZZY9: Optional[Union[StrictStr, "TokenPatternString"]] = Field( + None, alias="fuzzy9" + ) + + class Config: + extra = "forbid" + allow_population_by_field_name = True # allow alias and field name + + @validator("*", pre=True, each_item=True, allow_reuse=True) + def raise_for_none(cls, v): + if v is None: + raise ValueError("None / null is not allowed") + return v + + +class TokenPatternNumber(BaseModel): + REGEX: Optional[StrictStr] = Field(None, alias="regex") + IN: Optional[List[StrictInt]] = Field(None, alias="in") + NOT_IN: Optional[List[StrictInt]] = Field(None, alias="not_in") + IS_SUBSET: Optional[List[StrictInt]] = Field(None, alias="is_subset") + IS_SUPERSET: Optional[List[StrictInt]] = Field(None, alias="is_superset") + INTERSECTS: Optional[List[StrictInt]] = Field(None, alias="intersects") + EQ: Optional[Union[StrictInt, StrictFloat]] = Field(None, alias="==") + NEQ: Optional[Union[StrictInt, StrictFloat]] = Field(None, alias="!=") + GEQ: Optional[Union[StrictInt, StrictFloat]] = Field(None, alias=">=") + LEQ: Optional[Union[StrictInt, StrictFloat]] = Field(None, alias="<=") + GT: Optional[Union[StrictInt, StrictFloat]] = Field(None, alias=">") + LT: Optional[Union[StrictInt, StrictFloat]] = Field(None, alias="<") + + class Config: + extra = "forbid" + allow_population_by_field_name = True # allow alias and field name + + @validator("*", pre=True, each_item=True, allow_reuse=True) + def raise_for_none(cls, v): + if v is None: + raise ValueError("None / null is not allowed") + return v + + +class TokenPatternOperatorSimple(str, Enum): + plus: StrictStr = StrictStr("+") + star: StrictStr = StrictStr("*") + question: StrictStr = StrictStr("?") + exclamation: StrictStr = StrictStr("!") + + +class TokenPatternOperatorMinMax(ConstrainedStr): + regex = re.compile(r"^({\d+}|{\d+,\d*}|{\d*,\d+})$") + + +TokenPatternOperator = Union[TokenPatternOperatorSimple, TokenPatternOperatorMinMax] +StringValue = Union[TokenPatternString, StrictStr] +NumberValue = Union[TokenPatternNumber, StrictInt, StrictFloat] +UnderscoreValue = Union[ + TokenPatternString, TokenPatternNumber, str, int, float, list, bool +] +IobValue = Literal["", "I", "O", "B", 0, 1, 2, 3] + + +class TokenPattern(BaseModel): + orth: Optional[StringValue] = None + text: Optional[StringValue] = None + lower: Optional[StringValue] = None + pos: Optional[StringValue] = None + tag: Optional[StringValue] = None + morph: Optional[StringValue] = None + dep: Optional[StringValue] = None + lemma: Optional[StringValue] = None + shape: Optional[StringValue] = None + ent_type: Optional[StringValue] = None + ent_iob: Optional[IobValue] = None + ent_id: Optional[StringValue] = None + ent_kb_id: Optional[StringValue] = None + norm: Optional[StringValue] = None + length: Optional[NumberValue] = None + spacy: Optional[StrictBool] = None + is_alpha: Optional[StrictBool] = None + is_ascii: Optional[StrictBool] = None + is_digit: Optional[StrictBool] = None + is_lower: Optional[StrictBool] = None + is_upper: Optional[StrictBool] = None + is_title: Optional[StrictBool] = None + is_punct: Optional[StrictBool] = None + is_space: Optional[StrictBool] = None + is_bracket: Optional[StrictBool] = None + is_quote: Optional[StrictBool] = None + is_left_punct: Optional[StrictBool] = None + is_right_punct: Optional[StrictBool] = None + is_currency: Optional[StrictBool] = None + is_stop: Optional[StrictBool] = None + is_sent_start: Optional[StrictBool] = None + sent_start: Optional[StrictBool] = None + like_num: Optional[StrictBool] = None + like_url: Optional[StrictBool] = None + like_email: Optional[StrictBool] = None + op: Optional[TokenPatternOperator] = None + underscore: Optional[Dict[StrictStr, UnderscoreValue]] = Field(None, alias="_") + + class Config: + extra = "forbid" + allow_population_by_field_name = True + alias_generator = lambda value: value.upper() + + @validator("*", pre=True, allow_reuse=True) + def raise_for_none(cls, v): + if v is None: + raise ValueError("None / null is not allowed") + return v + + +class TokenPatternSchema(BaseModel): + pattern: List[TokenPattern] = Field(..., min_items=1) + + class Config: + extra = "forbid" + + +# Model meta + + +class ModelMetaSchema(BaseModel): + # fmt: off + lang: StrictStr = Field(..., title="Two-letter language code, e.g. 'en'") + name: StrictStr = Field(..., title="Model name") + version: StrictStr = Field(..., title="Model version") + spacy_version: StrictStr = Field("", title="Compatible spaCy version identifier") + parent_package: StrictStr = Field("spacy", title="Name of parent spaCy package, e.g. spacy or spacy-nightly") + requirements: List[StrictStr] = Field([], title="Additional Python package dependencies, used for the Python package setup") + pipeline: List[StrictStr] = Field([], title="Names of pipeline components") + description: StrictStr = Field("", title="Model description") + license: StrictStr = Field("", title="Model license") + author: StrictStr = Field("", title="Model author name") + email: StrictStr = Field("", title="Model author email") + url: StrictStr = Field("", title="Model author URL") + sources: Optional[Union[List[StrictStr], List[Dict[str, str]]]] = Field(None, title="Training data sources") + vectors: Dict[str, Any] = Field({}, title="Included word vectors") + labels: Dict[str, List[str]] = Field({}, title="Component labels, keyed by component name") + performance: Dict[str, Any] = Field({}, title="Accuracy and speed numbers") + spacy_git_version: StrictStr = Field("", title="Commit of spaCy version used") + # fmt: on + + +# Config schema +# We're not setting any defaults here (which is too messy) and are making all +# fields required, so we can raise validation errors for missing values. To +# provide a default, we include a separate .cfg file with all values and +# check that against this schema in the test suite to make sure it's always +# up to date. + + +class ConfigSchemaTraining(BaseModel): + # fmt: off + dev_corpus: StrictStr = Field(..., title="Path in the config to the dev data") + train_corpus: StrictStr = Field(..., title="Path in the config to the training data") + batcher: Batcher = Field(..., title="Batcher for the training data") + dropout: StrictFloat = Field(..., title="Dropout rate") + patience: StrictInt = Field(..., title="How many steps to continue without improvement in evaluation score") + max_epochs: StrictInt = Field(..., title="Maximum number of epochs to train for") + max_steps: StrictInt = Field(..., title="Maximum number of update steps to train for") + eval_frequency: StrictInt = Field(..., title="How often to evaluate during training (steps)") + seed: Optional[StrictInt] = Field(..., title="Random seed") + gpu_allocator: Optional[StrictStr] = Field(..., title="Memory allocator when running on GPU") + accumulate_gradient: StrictInt = Field(..., title="Whether to divide the batch up into substeps") + score_weights: Dict[StrictStr, Optional[Union[StrictFloat, StrictInt]]] = Field(..., title="Scores to report and their weights for selecting final model") + optimizer: Optimizer = Field(..., title="The optimizer to use") + logger: Logger = Field(..., title="The logger to track training progress") + frozen_components: List[str] = Field(..., title="Pipeline components that shouldn't be updated during training") + annotating_components: List[str] = Field(..., title="Pipeline components that should set annotations during training") + before_to_disk: Optional[Callable[["Language"], "Language"]] = Field(..., title="Optional callback to modify nlp object after training, before it's saved to disk") + before_update: Optional[Callable[["Language", Dict[str, Any]], None]] = Field(..., title="Optional callback that is invoked at the start of each training step") + # fmt: on + + class Config: + extra = "forbid" + arbitrary_types_allowed = True + + +class ConfigSchemaNlp(BaseModel): + # fmt: off + lang: StrictStr = Field(..., title="The base language to use") + pipeline: List[StrictStr] = Field(..., title="The pipeline component names in order") + disabled: List[StrictStr] = Field(..., title="Pipeline components to disable by default") + tokenizer: Callable = Field(..., title="The tokenizer to use") + before_creation: Optional[Callable[[Type["Language"]], Type["Language"]]] = Field(..., title="Optional callback to modify Language class before initialization") + after_creation: Optional[Callable[["Language"], "Language"]] = Field(..., title="Optional callback to modify nlp object after creation and before the pipeline is constructed") + after_pipeline_creation: Optional[Callable[["Language"], "Language"]] = Field(..., title="Optional callback to modify nlp object after the pipeline is constructed") + batch_size: Optional[int] = Field(..., title="Default batch size") + vectors: Callable = Field(..., title="Vectors implementation") + # fmt: on + + class Config: + extra = "forbid" + arbitrary_types_allowed = True + + +class ConfigSchemaPretrainEmpty(BaseModel): + class Config: + extra = "forbid" + + +class ConfigSchemaPretrain(BaseModel): + # fmt: off + max_epochs: StrictInt = Field(..., title="Maximum number of epochs to train for") + dropout: StrictFloat = Field(..., title="Dropout rate") + n_save_every: Optional[StrictInt] = Field(..., title="Saving additional temporary model after n batches within an epoch") + n_save_epoch: Optional[StrictInt] = Field(..., title="Saving model after every n epoch") + optimizer: Optimizer = Field(..., title="The optimizer to use") + corpus: StrictStr = Field(..., title="Path in the config to the training data") + batcher: Batcher = Field(..., title="Batcher for the training data") + component: str = Field(..., title="Component to find the layer to pretrain") + layer: str = Field(..., title="Layer to pretrain. Whole model if empty.") + objective: Callable[["Vocab", Model], Model] = Field(..., title="A function that creates the pretraining objective.") + # fmt: on + + class Config: + extra = "forbid" + arbitrary_types_allowed = True + + +class ConfigSchemaInit(BaseModel): + # fmt: off + vocab_data: Optional[StrictStr] = Field(..., title="Path to JSON-formatted vocabulary file") + lookups: Optional[Lookups] = Field(..., title="Vocabulary lookups, e.g. lexeme normalization") + vectors: Optional[StrictStr] = Field(..., title="Path to vectors") + init_tok2vec: Optional[StrictStr] = Field(..., title="Path to pretrained tok2vec weights") + tokenizer: Dict[StrictStr, Any] = Field(..., help="Arguments to be passed into Tokenizer.initialize") + components: Dict[StrictStr, Dict[StrictStr, Any]] = Field(..., help="Arguments for TrainablePipe.initialize methods of pipeline components, keyed by component") + before_init: Optional[Callable[["Language"], "Language"]] = Field(..., title="Optional callback to modify nlp object before initialization") + after_init: Optional[Callable[["Language"], "Language"]] = Field(..., title="Optional callback to modify nlp object after initialization") + # fmt: on + + class Config: + extra = "forbid" + arbitrary_types_allowed = True + + +class ConfigSchema(BaseModel): + training: ConfigSchemaTraining + nlp: ConfigSchemaNlp + pretraining: Union[ConfigSchemaPretrain, ConfigSchemaPretrainEmpty] = {} # type: ignore[assignment] + components: Dict[str, Dict[str, Any]] + corpora: Dict[str, Reader] + initialize: ConfigSchemaInit + + class Config: + extra = "allow" + arbitrary_types_allowed = True + + +CONFIG_SCHEMAS = { + "nlp": ConfigSchemaNlp, + "training": ConfigSchemaTraining, + "pretraining": ConfigSchemaPretrain, + "initialize": ConfigSchemaInit, +} + +# Recommendations for init config workflows + + +class RecommendationTrfItem(BaseModel): + name: str + size_factor: int + + +class RecommendationTrf(BaseModel): + efficiency: RecommendationTrfItem + accuracy: RecommendationTrfItem + + +class RecommendationSchema(BaseModel): + word_vectors: Optional[str] = None + transformer: Optional[RecommendationTrf] = None + has_letters: bool = True + + +class DocJSONSchema(BaseModel): + """ + JSON/dict format for JSON representation of Doc objects. + """ + + cats: Optional[Dict[StrictStr, StrictFloat]] = Field( + None, title="Categories with corresponding probabilities" + ) + ents: Optional[List[Dict[StrictStr, Union[StrictInt, StrictStr]]]] = Field( + None, title="Information on entities" + ) + sents: Optional[List[Dict[StrictStr, StrictInt]]] = Field( + None, title="Indices of sentences' start and end indices" + ) + text: StrictStr = Field(..., title="Document text") + spans: Optional[ + Dict[StrictStr, List[Dict[StrictStr, Union[StrictStr, StrictInt]]]] + ] = Field(None, title="Span information - end/start indices, label, KB ID") + tokens: List[Dict[StrictStr, Union[StrictStr, StrictInt]]] = Field( + ..., title="Token information - ID, start, annotations" + ) + underscore_doc: Optional[Dict[StrictStr, Any]] = Field( + None, + title="Any custom data stored in the document's _ attribute", + alias="_", + ) + underscore_token: Optional[Dict[StrictStr, List[Dict[StrictStr, Any]]]] = Field( + None, title="Any custom data stored in the token's _ attribute" + ) + underscore_span: Optional[Dict[StrictStr, List[Dict[StrictStr, Any]]]] = Field( + None, title="Any custom data stored in the span's _ attribute" + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/scorer.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..4abd69125bb94d7a7ced23dbaf00f62e1c748f38 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/scorer.py @@ -0,0 +1,1167 @@ +from collections import defaultdict +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Dict, + Iterable, + List, + Optional, + Set, + Tuple, +) + +import numpy as np + +from .errors import Errors +from .morphology import Morphology +from .tokens import Doc, Span, Token +from .training import Example +from .util import SimpleFrozenList, get_lang_class + +if TYPE_CHECKING: + # This lets us add type hints for mypy etc. without causing circular imports + from .language import Language # noqa: F401 + + +DEFAULT_PIPELINE = ("senter", "tagger", "morphologizer", "parser", "ner", "textcat") +MISSING_VALUES = frozenset([None, 0, ""]) + + +class PRFScore: + """A precision / recall / F score.""" + + def __init__( + self, + *, + tp: int = 0, + fp: int = 0, + fn: int = 0, + ) -> None: + self.tp = tp + self.fp = fp + self.fn = fn + + def __len__(self) -> int: + return self.tp + self.fp + self.fn + + def __iadd__(self, other): + self.tp += other.tp + self.fp += other.fp + self.fn += other.fn + return self + + def __add__(self, other): + return PRFScore( + tp=self.tp + other.tp, fp=self.fp + other.fp, fn=self.fn + other.fn + ) + + def score_set(self, cand: set, gold: set) -> None: + self.tp += len(cand.intersection(gold)) + self.fp += len(cand - gold) + self.fn += len(gold - cand) + + @property + def precision(self) -> float: + return self.tp / (self.tp + self.fp + 1e-100) + + @property + def recall(self) -> float: + return self.tp / (self.tp + self.fn + 1e-100) + + @property + def fscore(self) -> float: + p = self.precision + r = self.recall + return 2 * ((p * r) / (p + r + 1e-100)) + + def to_dict(self) -> Dict[str, float]: + return {"p": self.precision, "r": self.recall, "f": self.fscore} + + +class ROCAUCScore: + """An AUC ROC score. This is only defined for binary classification. + Use the method is_binary before calculating the score, otherwise it + may throw an error.""" + + def __init__(self) -> None: + self.golds: List[Any] = [] + self.cands: List[Any] = [] + self.saved_score = 0.0 + self.saved_score_at_len = 0 + + def score_set(self, cand, gold) -> None: + self.cands.append(cand) + self.golds.append(gold) + + def is_binary(self): + return len(np.unique(self.golds)) == 2 + + @property + def score(self): + if not self.is_binary(): + raise ValueError(Errors.E165.format(label=set(self.golds))) + if len(self.golds) == self.saved_score_at_len: + return self.saved_score + self.saved_score = _roc_auc_score(self.golds, self.cands) + self.saved_score_at_len = len(self.golds) + return self.saved_score + + +class Scorer: + """Compute evaluation scores.""" + + def __init__( + self, + nlp: Optional["Language"] = None, + default_lang: str = "xx", + default_pipeline: Iterable[str] = DEFAULT_PIPELINE, + **cfg, + ) -> None: + """Initialize the Scorer. + + DOCS: https://spacy.io/api/scorer#init + """ + self.cfg = cfg + if nlp: + self.nlp = nlp + else: + nlp = get_lang_class(default_lang)() + for pipe in default_pipeline: + nlp.add_pipe(pipe) + self.nlp = nlp + + def score( + self, examples: Iterable[Example], *, per_component: bool = False + ) -> Dict[str, Any]: + """Evaluate a list of Examples. + + examples (Iterable[Example]): The predicted annotations + correct annotations. + per_component (bool): Whether to return the scores keyed by component + name. Defaults to False. + RETURNS (Dict): A dictionary of scores. + + DOCS: https://spacy.io/api/scorer#score + """ + scores = {} + if hasattr(self.nlp.tokenizer, "score"): + if per_component: + scores["tokenizer"] = self.nlp.tokenizer.score(examples, **self.cfg) + else: + scores.update(self.nlp.tokenizer.score(examples, **self.cfg)) # type: ignore + for name, component in self.nlp.pipeline: + if hasattr(component, "score"): + if per_component: + scores[name] = component.score(examples, **self.cfg) + else: + scores.update(component.score(examples, **self.cfg)) + return scores + + @staticmethod + def score_tokenization(examples: Iterable[Example], **cfg) -> Dict[str, Any]: + """Returns accuracy and PRF scores for tokenization. + * token_acc: # correct tokens / # gold tokens + * token_p/r/f: PRF for token character spans + + examples (Iterable[Example]): Examples to score + RETURNS (Dict[str, Any]): A dictionary containing the scores + token_acc/p/r/f. + + DOCS: https://spacy.io/api/scorer#score_tokenization + """ + acc_score = PRFScore() + prf_score = PRFScore() + for example in examples: + gold_doc = example.reference + pred_doc = example.predicted + if gold_doc.has_unknown_spaces: + continue + align = example.alignment + gold_spans = set() + pred_spans = set() + for token in gold_doc: + if token.orth_.isspace(): + continue + gold_spans.add((token.idx, token.idx + len(token))) + for token in pred_doc: + if token.orth_.isspace(): + continue + pred_spans.add((token.idx, token.idx + len(token))) + if align.x2y.lengths[token.i] != 1: + acc_score.fp += 1 + else: + acc_score.tp += 1 + prf_score.score_set(pred_spans, gold_spans) + if len(acc_score) > 0: + return { + "token_acc": acc_score.precision, + "token_p": prf_score.precision, + "token_r": prf_score.recall, + "token_f": prf_score.fscore, + } + else: + return { + "token_acc": None, + "token_p": None, + "token_r": None, + "token_f": None, + } + + @staticmethod + def score_token_attr( + examples: Iterable[Example], + attr: str, + *, + getter: Callable[[Token, str], Any] = getattr, + missing_values: Set[Any] = MISSING_VALUES, # type: ignore[assignment] + **cfg, + ) -> Dict[str, Any]: + """Returns an accuracy score for a token-level attribute. + + examples (Iterable[Example]): Examples to score + attr (str): The attribute to score. + getter (Callable[[Token, str], Any]): Defaults to getattr. If provided, + getter(token, attr) should return the value of the attribute for an + individual token. + missing_values (Set[Any]): Attribute values to treat as missing annotation + in the reference annotation. + RETURNS (Dict[str, Any]): A dictionary containing the accuracy score + under the key attr_acc. + + DOCS: https://spacy.io/api/scorer#score_token_attr + """ + tag_score = PRFScore() + for example in examples: + gold_doc = example.reference + pred_doc = example.predicted + align = example.alignment + gold_tags = set() + missing_indices = set() + for gold_i, token in enumerate(gold_doc): + value = getter(token, attr) + if value not in missing_values: + gold_tags.add((gold_i, getter(token, attr))) + else: + missing_indices.add(gold_i) + pred_tags = set() + for token in pred_doc: + if token.orth_.isspace(): + continue + if align.x2y.lengths[token.i] == 1: + gold_i = align.x2y[token.i][0] + if gold_i not in missing_indices: + pred_tags.add((gold_i, getter(token, attr))) + tag_score.score_set(pred_tags, gold_tags) + score_key = f"{attr}_acc" + if len(tag_score) == 0: + return {score_key: None} + else: + return {score_key: tag_score.fscore} + + @staticmethod + def score_token_attr_per_feat( + examples: Iterable[Example], + attr: str, + *, + getter: Callable[[Token, str], Any] = getattr, + missing_values: Set[Any] = MISSING_VALUES, # type: ignore[assignment] + **cfg, + ) -> Dict[str, Any]: + """Return micro PRF and PRF scores per feat for a token attribute in + UFEATS format. + + examples (Iterable[Example]): Examples to score + attr (str): The attribute to score. + getter (Callable[[Token, str], Any]): Defaults to getattr. If provided, + getter(token, attr) should return the value of the attribute for an + individual token. + missing_values (Set[Any]): Attribute values to treat as missing + annotation in the reference annotation. + RETURNS (dict): A dictionary containing the micro PRF scores under the + key attr_micro_p/r/f and the per-feat PRF scores under + attr_per_feat. + """ + micro_score = PRFScore() + per_feat = {} + for example in examples: + pred_doc = example.predicted + gold_doc = example.reference + align = example.alignment + gold_per_feat: Dict[str, Set] = {} + missing_indices = set() + for gold_i, token in enumerate(gold_doc): + value = getter(token, attr) + morph = gold_doc.vocab.strings[value] + if value not in missing_values and morph != Morphology.EMPTY_MORPH: + for feat in morph.split(Morphology.FEATURE_SEP): + field, values = feat.split(Morphology.FIELD_SEP) + if field not in per_feat: + per_feat[field] = PRFScore() + if field not in gold_per_feat: + gold_per_feat[field] = set() + gold_per_feat[field].add((gold_i, feat)) + else: + missing_indices.add(gold_i) + pred_per_feat: Dict[str, Set] = {} + for token in pred_doc: + if token.orth_.isspace(): + continue + if align.x2y.lengths[token.i] == 1: + gold_i = align.x2y[token.i][0] + if gold_i not in missing_indices: + value = getter(token, attr) + morph = gold_doc.vocab.strings[value] + if ( + value not in missing_values + and morph != Morphology.EMPTY_MORPH + ): + for feat in morph.split(Morphology.FEATURE_SEP): + field, values = feat.split(Morphology.FIELD_SEP) + if field not in per_feat: + per_feat[field] = PRFScore() + if field not in pred_per_feat: + pred_per_feat[field] = set() + pred_per_feat[field].add((gold_i, feat)) + for field in per_feat: + micro_score.score_set( + pred_per_feat.get(field, set()), gold_per_feat.get(field, set()) + ) + per_feat[field].score_set( + pred_per_feat.get(field, set()), gold_per_feat.get(field, set()) + ) + result: Dict[str, Any] = {} + if len(micro_score) > 0: + result[f"{attr}_micro_p"] = micro_score.precision + result[f"{attr}_micro_r"] = micro_score.recall + result[f"{attr}_micro_f"] = micro_score.fscore + result[f"{attr}_per_feat"] = {k: v.to_dict() for k, v in per_feat.items()} + else: + result[f"{attr}_micro_p"] = None + result[f"{attr}_micro_r"] = None + result[f"{attr}_micro_f"] = None + result[f"{attr}_per_feat"] = None + return result + + @staticmethod + def score_spans( + examples: Iterable[Example], + attr: str, + *, + getter: Callable[[Doc, str], Iterable[Span]] = getattr, + has_annotation: Optional[Callable[[Doc], bool]] = None, + labeled: bool = True, + allow_overlap: bool = False, + **cfg, + ) -> Dict[str, Any]: + """Returns PRF scores for labeled spans. + + examples (Iterable[Example]): Examples to score + attr (str): The attribute to score. + getter (Callable[[Doc, str], Iterable[Span]]): Defaults to getattr. If + provided, getter(doc, attr) should return the spans for the + individual doc. + has_annotation (Optional[Callable[[Doc], bool]]) should return whether a `Doc` + has annotation for this `attr`. Docs without annotation are skipped for + scoring purposes. + labeled (bool): Whether or not to include label information in + the evaluation. If set to 'False', two spans will be considered + equal if their start and end match, irrespective of their label. + allow_overlap (bool): Whether or not to allow overlapping spans. + If set to 'False', the alignment will automatically resolve conflicts. + RETURNS (Dict[str, Any]): A dictionary containing the PRF scores under + the keys attr_p/r/f and the per-type PRF scores under attr_per_type. + + DOCS: https://spacy.io/api/scorer#score_spans + """ + score = PRFScore() + score_per_type = dict() + for example in examples: + pred_doc = example.predicted + gold_doc = example.reference + # Option to handle docs without annotation for this attribute + if has_annotation is not None and not has_annotation(gold_doc): + continue + # Find all labels in gold + labels = set([k.label_ for k in getter(gold_doc, attr)]) + # If labeled, find all labels in pred + if has_annotation is None or ( + has_annotation is not None and has_annotation(pred_doc) + ): + labels |= set([k.label_ for k in getter(pred_doc, attr)]) + # Set up all labels for per type scoring and prepare gold per type + gold_per_type: Dict[str, Set] = {label: set() for label in labels} + for label in labels: + if label not in score_per_type: + score_per_type[label] = PRFScore() + # Find all predidate labels, for all and per type + gold_spans = set() + pred_spans = set() + for span in getter(gold_doc, attr): + gold_span: Tuple + if labeled: + gold_span = (span.label_, span.start, span.end - 1) + else: + gold_span = (span.start, span.end - 1) + gold_spans.add(gold_span) + gold_per_type[span.label_].add(gold_span) + pred_per_type: Dict[str, Set] = {label: set() for label in labels} + if has_annotation is None or ( + has_annotation is not None and has_annotation(pred_doc) + ): + for span in example.get_aligned_spans_x2y( + getter(pred_doc, attr), allow_overlap + ): + pred_span: Tuple + if labeled: + pred_span = (span.label_, span.start, span.end - 1) + else: + pred_span = (span.start, span.end - 1) + pred_spans.add(pred_span) + pred_per_type[span.label_].add(pred_span) + # Scores per label + if labeled: + for k, v in score_per_type.items(): + if k in pred_per_type: + v.score_set(pred_per_type[k], gold_per_type[k]) + # Score for all labels + score.score_set(pred_spans, gold_spans) + # Assemble final result + final_scores: Dict[str, Any] = { + f"{attr}_p": None, + f"{attr}_r": None, + f"{attr}_f": None, + } + if labeled: + final_scores[f"{attr}_per_type"] = None + if len(score) > 0: + final_scores[f"{attr}_p"] = score.precision + final_scores[f"{attr}_r"] = score.recall + final_scores[f"{attr}_f"] = score.fscore + if labeled: + final_scores[f"{attr}_per_type"] = { + k: v.to_dict() for k, v in score_per_type.items() + } + return final_scores + + @staticmethod + def score_cats( + examples: Iterable[Example], + attr: str, + *, + getter: Callable[[Doc, str], Any] = getattr, + labels: Iterable[str] = SimpleFrozenList(), + multi_label: bool = True, + positive_label: Optional[str] = None, + threshold: Optional[float] = None, + **cfg, + ) -> Dict[str, Any]: + """Returns PRF and ROC AUC scores for a doc-level attribute with a + dict with scores for each label like Doc.cats. The reported overall + score depends on the scorer settings. + + examples (Iterable[Example]): Examples to score + attr (str): The attribute to score. + getter (Callable[[Doc, str], Any]): Defaults to getattr. If provided, + getter(doc, attr) should return the values for the individual doc. + labels (Iterable[str]): The set of possible labels. Defaults to []. + multi_label (bool): Whether the attribute allows multiple labels. + Defaults to True. When set to False (exclusive labels), missing + gold labels are interpreted as 0.0 and the threshold is set to 0.0. + positive_label (str): The positive label for a binary task with + exclusive classes. Defaults to None. + threshold (float): Cutoff to consider a prediction "positive". Defaults + to 0.5 for multi-label, and 0.0 (i.e. whatever's highest scoring) + otherwise. + RETURNS (Dict[str, Any]): A dictionary containing the scores, with + inapplicable scores as None: + for all: + attr_score (one of attr_micro_f / attr_macro_f / attr_macro_auc), + attr_score_desc (text description of the overall score), + attr_micro_p, + attr_micro_r, + attr_micro_f, + attr_macro_p, + attr_macro_r, + attr_macro_f, + attr_macro_auc, + attr_f_per_type, + attr_auc_per_type + + DOCS: https://spacy.io/api/scorer#score_cats + """ + if threshold is None: + threshold = 0.5 if multi_label else 0.0 + if not multi_label: + threshold = 0.0 + f_per_type = {label: PRFScore() for label in labels} + auc_per_type = {label: ROCAUCScore() for label in labels} + labels = set(labels) + for example in examples: + # Through this loop, None in the gold_cats indicates missing label. + pred_cats = getter(example.predicted, attr) + pred_cats = {k: v for k, v in pred_cats.items() if k in labels} + gold_cats = getter(example.reference, attr) + gold_cats = {k: v for k, v in gold_cats.items() if k in labels} + + for label in labels: + pred_score = pred_cats.get(label, 0.0) + gold_score = gold_cats.get(label) + if not gold_score and not multi_label: + gold_score = 0.0 + if gold_score is not None: + auc_per_type[label].score_set(pred_score, gold_score) + if multi_label: + for label in labels: + pred_score = pred_cats.get(label, 0.0) + gold_score = gold_cats.get(label) + if gold_score is not None: + if pred_score >= threshold and gold_score > 0: + f_per_type[label].tp += 1 + elif pred_score >= threshold and gold_score == 0: + f_per_type[label].fp += 1 + elif pred_score < threshold and gold_score > 0: + f_per_type[label].fn += 1 + elif pred_cats and gold_cats: + # Get the highest-scoring for each. + pred_label, pred_score = max(pred_cats.items(), key=lambda it: it[1]) + gold_label, gold_score = max(gold_cats.items(), key=lambda it: it[1]) + if pred_label == gold_label: + f_per_type[pred_label].tp += 1 + else: + f_per_type[gold_label].fn += 1 + f_per_type[pred_label].fp += 1 + elif gold_cats: + gold_label, gold_score = max(gold_cats, key=lambda it: it[1]) + if gold_score > 0: + f_per_type[gold_label].fn += 1 + elif pred_cats: + pred_label, pred_score = max(pred_cats.items(), key=lambda it: it[1]) + f_per_type[pred_label].fp += 1 + micro_prf = PRFScore() + for label_prf in f_per_type.values(): + micro_prf.tp += label_prf.tp + micro_prf.fn += label_prf.fn + micro_prf.fp += label_prf.fp + n_cats = len(f_per_type) + 1e-100 + macro_p = sum(prf.precision for prf in f_per_type.values()) / n_cats + macro_r = sum(prf.recall for prf in f_per_type.values()) / n_cats + macro_f = sum(prf.fscore for prf in f_per_type.values()) / n_cats + # Limit macro_auc to those labels with gold annotations, + # but still divide by all cats to avoid artificial boosting of datasets with missing labels + macro_auc = ( + sum(auc.score if auc.is_binary() else 0.0 for auc in auc_per_type.values()) + / n_cats + ) + results: Dict[str, Any] = { + f"{attr}_score": None, + f"{attr}_score_desc": None, + f"{attr}_micro_p": micro_prf.precision, + f"{attr}_micro_r": micro_prf.recall, + f"{attr}_micro_f": micro_prf.fscore, + f"{attr}_macro_p": macro_p, + f"{attr}_macro_r": macro_r, + f"{attr}_macro_f": macro_f, + f"{attr}_macro_auc": macro_auc, + f"{attr}_f_per_type": {k: v.to_dict() for k, v in f_per_type.items()}, + f"{attr}_auc_per_type": { + k: v.score if v.is_binary() else None for k, v in auc_per_type.items() + }, + } + if len(labels) == 2 and not multi_label and positive_label: + positive_label_f = results[f"{attr}_f_per_type"][positive_label]["f"] + results[f"{attr}_score"] = positive_label_f + results[f"{attr}_score_desc"] = f"F ({positive_label})" + elif not multi_label: + results[f"{attr}_score"] = results[f"{attr}_macro_f"] + results[f"{attr}_score_desc"] = "macro F" + else: + results[f"{attr}_score"] = results[f"{attr}_macro_auc"] + results[f"{attr}_score_desc"] = "macro AUC" + return results + + @staticmethod + def score_links( + examples: Iterable[Example], *, negative_labels: Iterable[str], **cfg + ) -> Dict[str, Any]: + """Returns PRF for predicted links on the entity level. + To disentangle the performance of the NEL from the NER, + this method only evaluates NEL links for entities that overlap + between the gold reference and the predictions. + + examples (Iterable[Example]): Examples to score + negative_labels (Iterable[str]): The string values that refer to no annotation (e.g. "NIL") + RETURNS (Dict[str, Any]): A dictionary containing the scores. + + DOCS: https://spacy.io/api/scorer#score_links + """ + f_per_type = {} + for example in examples: + gold_ent_by_offset = {} + for gold_ent in example.reference.ents: + gold_ent_by_offset[(gold_ent.start_char, gold_ent.end_char)] = gold_ent + + for pred_ent in example.predicted.ents: + gold_span = gold_ent_by_offset.get( + (pred_ent.start_char, pred_ent.end_char), None + ) + if gold_span is not None: + label = gold_span.label_ + if label not in f_per_type: + f_per_type[label] = PRFScore() + gold = gold_span.kb_id_ + # only evaluating entities that overlap between gold and pred, + # to disentangle the performance of the NEL from the NER + if gold is not None: + pred = pred_ent.kb_id_ + if gold in negative_labels and pred in negative_labels: + # ignore true negatives + pass + elif gold == pred: + f_per_type[label].tp += 1 + elif gold in negative_labels: + f_per_type[label].fp += 1 + elif pred in negative_labels: + f_per_type[label].fn += 1 + else: + # a wrong prediction (e.g. Q42 != Q3) counts as both a FP as well as a FN + f_per_type[label].fp += 1 + f_per_type[label].fn += 1 + micro_prf = PRFScore() + for label_prf in f_per_type.values(): + micro_prf.tp += label_prf.tp + micro_prf.fn += label_prf.fn + micro_prf.fp += label_prf.fp + n_labels = len(f_per_type) + 1e-100 + macro_p = sum(prf.precision for prf in f_per_type.values()) / n_labels + macro_r = sum(prf.recall for prf in f_per_type.values()) / n_labels + macro_f = sum(prf.fscore for prf in f_per_type.values()) / n_labels + results = { + f"nel_score": micro_prf.fscore, + f"nel_score_desc": "micro F", + f"nel_micro_p": micro_prf.precision, + f"nel_micro_r": micro_prf.recall, + f"nel_micro_f": micro_prf.fscore, + f"nel_macro_p": macro_p, + f"nel_macro_r": macro_r, + f"nel_macro_f": macro_f, + f"nel_f_per_type": {k: v.to_dict() for k, v in f_per_type.items()}, + } + return results + + @staticmethod + def score_deps( + examples: Iterable[Example], + attr: str, + *, + getter: Callable[[Token, str], Any] = getattr, + head_attr: str = "head", + head_getter: Callable[[Token, str], Token] = getattr, + ignore_labels: Iterable[str] = SimpleFrozenList(), + missing_values: Set[Any] = MISSING_VALUES, # type: ignore[assignment] + **cfg, + ) -> Dict[str, Any]: + """Returns the UAS, LAS, and LAS per type scores for dependency + parses. + + examples (Iterable[Example]): Examples to score + attr (str): The attribute containing the dependency label. + getter (Callable[[Token, str], Any]): Defaults to getattr. If provided, + getter(token, attr) should return the value of the attribute for an + individual token. + head_attr (str): The attribute containing the head token. Defaults to + 'head'. + head_getter (Callable[[Token, str], Token]): Defaults to getattr. If provided, + head_getter(token, attr) should return the value of the head for an + individual token. + ignore_labels (Tuple): Labels to ignore while scoring (e.g., punct). + missing_values (Set[Any]): Attribute values to treat as missing annotation + in the reference annotation. + RETURNS (Dict[str, Any]): A dictionary containing the scores: + attr_uas, attr_las, and attr_las_per_type. + + DOCS: https://spacy.io/api/scorer#score_deps + """ + unlabelled = PRFScore() + labelled = PRFScore() + labelled_per_dep = dict() + missing_indices = set() + for example in examples: + gold_doc = example.reference + pred_doc = example.predicted + align = example.alignment + gold_deps = set() + gold_deps_per_dep: Dict[str, Set] = {} + for gold_i, token in enumerate(gold_doc): + dep = getter(token, attr) + head = head_getter(token, head_attr) + if dep not in missing_values: + if dep not in ignore_labels: + gold_deps.add((gold_i, head.i, dep)) + if dep not in labelled_per_dep: + labelled_per_dep[dep] = PRFScore() + if dep not in gold_deps_per_dep: + gold_deps_per_dep[dep] = set() + gold_deps_per_dep[dep].add((gold_i, head.i, dep)) + else: + missing_indices.add(gold_i) + pred_deps = set() + pred_deps_per_dep: Dict[str, Set] = {} + for token in pred_doc: + if token.orth_.isspace(): + continue + if align.x2y.lengths[token.i] != 1: + gold_i = None # type: ignore + else: + gold_i = align.x2y[token.i][0] + if gold_i not in missing_indices: + dep = getter(token, attr) + head = head_getter(token, head_attr) + if dep not in ignore_labels and token.orth_.strip(): + if align.x2y.lengths[head.i] == 1: + gold_head = align.x2y[head.i][0] + else: + gold_head = None + # None is indistinct, so we can't just add it to the set + # Multiple (None, None) deps are possible + if gold_i is None or gold_head is None: + unlabelled.fp += 1 + labelled.fp += 1 + else: + pred_deps.add((gold_i, gold_head, dep)) + if dep not in labelled_per_dep: + labelled_per_dep[dep] = PRFScore() + if dep not in pred_deps_per_dep: + pred_deps_per_dep[dep] = set() + pred_deps_per_dep[dep].add((gold_i, gold_head, dep)) + labelled.score_set(pred_deps, gold_deps) + for dep in labelled_per_dep: + labelled_per_dep[dep].score_set( + pred_deps_per_dep.get(dep, set()), gold_deps_per_dep.get(dep, set()) + ) + unlabelled.score_set( + set(item[:2] for item in pred_deps), set(item[:2] for item in gold_deps) + ) + if len(unlabelled) > 0: + return { + f"{attr}_uas": unlabelled.fscore, + f"{attr}_las": labelled.fscore, + f"{attr}_las_per_type": { + k: v.to_dict() for k, v in labelled_per_dep.items() + }, + } + else: + return { + f"{attr}_uas": None, + f"{attr}_las": None, + f"{attr}_las_per_type": None, + } + + +def get_ner_prf(examples: Iterable[Example], **kwargs) -> Dict[str, Any]: + """Compute micro-PRF and per-entity PRF scores for a sequence of examples.""" + score_per_type = defaultdict(PRFScore) + for eg in examples: + if not eg.y.has_annotation("ENT_IOB"): + continue + golds = {(e.label_, e.start, e.end) for e in eg.y.ents} + align_x2y = eg.alignment.x2y + for pred_ent in eg.x.ents: + if pred_ent.label_ not in score_per_type: + score_per_type[pred_ent.label_] = PRFScore() + indices = align_x2y[pred_ent.start : pred_ent.end] + if len(indices): + g_span = eg.y[indices[0] : indices[-1] + 1] + # Check we aren't missing annotation on this span. If so, + # our prediction is neither right nor wrong, we just + # ignore it. + if all(token.ent_iob != 0 for token in g_span): + key = (pred_ent.label_, indices[0], indices[-1] + 1) + if key in golds: + score_per_type[pred_ent.label_].tp += 1 + golds.remove(key) + else: + score_per_type[pred_ent.label_].fp += 1 + for label, start, end in golds: + score_per_type[label].fn += 1 + totals = PRFScore() + for prf in score_per_type.values(): + totals += prf + if len(totals) > 0: + return { + "ents_p": totals.precision, + "ents_r": totals.recall, + "ents_f": totals.fscore, + "ents_per_type": {k: v.to_dict() for k, v in score_per_type.items()}, + } + else: + return { + "ents_p": None, + "ents_r": None, + "ents_f": None, + "ents_per_type": None, + } + + +# The following implementation of trapezoid() is adapted from SciPy, +# which is distributed under the New BSD License. +# Copyright (c) 2001-2002 Enthought, Inc. 2003-2023, SciPy Developers. +# See licenses/3rd_party_licenses.txt +def trapezoid(y, x=None, dx=1.0, axis=-1): + r""" + Integrate along the given axis using the composite trapezoidal rule. + + If `x` is provided, the integration happens in sequence along its + elements - they are not sorted. + + Integrate `y` (`x`) along each 1d slice on the given axis, compute + :math:`\int y(x) dx`. + When `x` is specified, this integrates along the parametric curve, + computing :math:`\int_t y(t) dt = + \int_t y(t) \left.\frac{dx}{dt}\right|_{x=x(t)} dt`. + + Parameters + ---------- + y : array_like + Input array to integrate. + x : array_like, optional + The sample points corresponding to the `y` values. If `x` is None, + the sample points are assumed to be evenly spaced `dx` apart. The + default is None. + dx : scalar, optional + The spacing between sample points when `x` is None. The default is 1. + axis : int, optional + The axis along which to integrate. + + Returns + ------- + trapezoid : float or ndarray + Definite integral of `y` = n-dimensional array as approximated along + a single axis by the trapezoidal rule. If `y` is a 1-dimensional array, + then the result is a float. If `n` is greater than 1, then the result + is an `n`-1 dimensional array. + + See Also + -------- + cumulative_trapezoid, simpson, romb + + Notes + ----- + Image [2]_ illustrates trapezoidal rule -- y-axis locations of points + will be taken from `y` array, by default x-axis distances between + points will be 1.0, alternatively they can be provided with `x` array + or with `dx` scalar. Return value will be equal to combined area under + the red lines. + + References + ---------- + .. [1] Wikipedia page: https://en.wikipedia.org/wiki/Trapezoidal_rule + + .. [2] Illustration image: + https://en.wikipedia.org/wiki/File:Composite_trapezoidal_rule_illustration.png + + Examples + -------- + Use the trapezoidal rule on evenly spaced points: + + >>> import numpy as np + >>> from scipy import integrate + >>> integrate.trapezoid([1, 2, 3]) + 4.0 + + The spacing between sample points can be selected by either the + ``x`` or ``dx`` arguments: + + >>> integrate.trapezoid([1, 2, 3], x=[4, 6, 8]) + 8.0 + >>> integrate.trapezoid([1, 2, 3], dx=2) + 8.0 + + Using a decreasing ``x`` corresponds to integrating in reverse: + + >>> integrate.trapezoid([1, 2, 3], x=[8, 6, 4]) + -8.0 + + More generally ``x`` is used to integrate along a parametric curve. We can + estimate the integral :math:`\int_0^1 x^2 = 1/3` using: + + >>> x = np.linspace(0, 1, num=50) + >>> y = x**2 + >>> integrate.trapezoid(y, x) + 0.33340274885464394 + + Or estimate the area of a circle, noting we repeat the sample which closes + the curve: + + >>> theta = np.linspace(0, 2 * np.pi, num=1000, endpoint=True) + >>> integrate.trapezoid(np.cos(theta), x=np.sin(theta)) + 3.141571941375841 + + ``trapezoid`` can be applied along a specified axis to do multiple + computations in one call: + + >>> a = np.arange(6).reshape(2, 3) + >>> a + array([[0, 1, 2], + [3, 4, 5]]) + >>> integrate.trapezoid(a, axis=0) + array([1.5, 2.5, 3.5]) + >>> integrate.trapezoid(a, axis=1) + array([2., 8.]) + """ + y = np.asanyarray(y) + if x is None: + d = dx + else: + x = np.asanyarray(x) + if x.ndim == 1: + d = np.diff(x) + # reshape to correct shape + shape = [1] * y.ndim + shape[axis] = d.shape[0] + d = d.reshape(shape) + else: + d = np.diff(x, axis=axis) + nd = y.ndim + slice1 = [slice(None)] * nd + slice2 = [slice(None)] * nd + slice1[axis] = slice(1, None) + slice2[axis] = slice(None, -1) + try: + ret = (d * (y[tuple(slice1)] + y[tuple(slice2)]) / 2.0).sum(axis) + except ValueError: + # Operations didn't work, cast to ndarray + d = np.asarray(d) + y = np.asarray(y) + ret = np.add.reduce(d * (y[tuple(slice1)] + y[tuple(slice2)]) / 2.0, axis) + return ret + + +# The following implementation of roc_auc_score() is adapted from +# scikit-learn, which is distributed under the New BSD License. +# Copyright (c) 2007–2019 The scikit-learn developers. +# See licenses/3rd_party_licenses.txt +def _roc_auc_score(y_true, y_score): + """Compute Area Under the Receiver Operating Characteristic Curve (ROC AUC) + from prediction scores. + + Note: this implementation is restricted to the binary classification task + + Parameters + ---------- + y_true : array, shape = [n_samples] or [n_samples, n_classes] + True binary labels or binary label indicators. + The multiclass case expects shape = [n_samples] and labels + with values in ``range(n_classes)``. + + y_score : array, shape = [n_samples] or [n_samples, n_classes] + Target scores, can either be probability estimates of the positive + class, confidence values, or non-thresholded measure of decisions + (as returned by "decision_function" on some classifiers). For binary + y_true, y_score is supposed to be the score of the class with greater + label. The multiclass case expects shape = [n_samples, n_classes] + where the scores correspond to probability estimates. + + Returns + ------- + auc : float + + References + ---------- + .. [1] `Wikipedia entry for the Receiver operating characteristic + `_ + + .. [2] Fawcett T. An introduction to ROC analysis[J]. Pattern Recognition + Letters, 2006, 27(8):861-874. + + .. [3] `Analyzing a portion of the ROC curve. McClish, 1989 + `_ + """ + if len(np.unique(y_true)) != 2: + raise ValueError(Errors.E165.format(label=np.unique(y_true))) + fpr, tpr, _ = _roc_curve(y_true, y_score) + return _auc(fpr, tpr) + + +def _roc_curve(y_true, y_score): + """Compute Receiver operating characteristic (ROC) + + Note: this implementation is restricted to the binary classification task. + + Parameters + ---------- + + y_true : array, shape = [n_samples] + True binary labels. If labels are not either {-1, 1} or {0, 1}, then + pos_label should be explicitly given. + + y_score : array, shape = [n_samples] + Target scores, can either be probability estimates of the positive + class, confidence values, or non-thresholded measure of decisions + (as returned by "decision_function" on some classifiers). + + Returns + ------- + fpr : array, shape = [>2] + Increasing false positive rates such that element i is the false + positive rate of predictions with score >= thresholds[i]. + + tpr : array, shape = [>2] + Increasing true positive rates such that element i is the true + positive rate of predictions with score >= thresholds[i]. + + thresholds : array, shape = [n_thresholds] + Decreasing thresholds on the decision function used to compute + fpr and tpr. `thresholds[0]` represents no instances being predicted + and is arbitrarily set to `max(y_score) + 1`. + + Notes + ----- + Since the thresholds are sorted from low to high values, they + are reversed upon returning them to ensure they correspond to both ``fpr`` + and ``tpr``, which are sorted in reversed order during their calculation. + + References + ---------- + .. [1] `Wikipedia entry for the Receiver operating characteristic + `_ + + .. [2] Fawcett T. An introduction to ROC analysis[J]. Pattern Recognition + Letters, 2006, 27(8):861-874. + """ + fps, tps, thresholds = _binary_clf_curve(y_true, y_score) + + # Add an extra threshold position + # to make sure that the curve starts at (0, 0) + tps = np.r_[0, tps] + fps = np.r_[0, fps] + thresholds = np.r_[thresholds[0] + 1, thresholds] + + if fps[-1] <= 0: + fpr = np.repeat(np.nan, fps.shape) + else: + fpr = fps / fps[-1] + + if tps[-1] <= 0: + tpr = np.repeat(np.nan, tps.shape) + else: + tpr = tps / tps[-1] + + return fpr, tpr, thresholds + + +def _binary_clf_curve(y_true, y_score): + """Calculate true and false positives per binary classification threshold. + + Parameters + ---------- + y_true : array, shape = [n_samples] + True targets of binary classification + + y_score : array, shape = [n_samples] + Estimated probabilities or decision function + + Returns + ------- + fps : array, shape = [n_thresholds] + A count of false positives, at index i being the number of negative + samples assigned a score >= thresholds[i]. The total number of + negative samples is equal to fps[-1] (thus true negatives are given by + fps[-1] - fps). + + tps : array, shape = [n_thresholds <= len(np.unique(y_score))] + An increasing count of true positives, at index i being the number + of positive samples assigned a score >= thresholds[i]. The total + number of positive samples is equal to tps[-1] (thus false negatives + are given by tps[-1] - tps). + + thresholds : array, shape = [n_thresholds] + Decreasing score values. + """ + pos_label = 1.0 + + y_true = np.ravel(y_true) + y_score = np.ravel(y_score) + + # make y_true a boolean vector + y_true = y_true == pos_label + + # sort scores and corresponding truth values + desc_score_indices = np.argsort(y_score, kind="mergesort")[::-1] + y_score = y_score[desc_score_indices] + y_true = y_true[desc_score_indices] + weight = 1.0 + + # y_score typically has many tied values. Here we extract + # the indices associated with the distinct values. We also + # concatenate a value for the end of the curve. + distinct_value_indices = np.where(np.diff(y_score))[0] + threshold_idxs = np.r_[distinct_value_indices, y_true.size - 1] + + # accumulate the true positives with decreasing threshold + tps = _stable_cumsum(y_true * weight)[threshold_idxs] + fps = 1 + threshold_idxs - tps + return fps, tps, y_score[threshold_idxs] + + +def _stable_cumsum(arr, axis=None, rtol=1e-05, atol=1e-08): + """Use high precision for cumsum and check that final value matches sum + + Parameters + ---------- + arr : array-like + To be cumulatively summed as flat + axis : int, optional + Axis along which the cumulative sum is computed. + The default (None) is to compute the cumsum over the flattened array. + rtol : float + Relative tolerance, see ``np.allclose`` + atol : float + Absolute tolerance, see ``np.allclose`` + """ + out = np.cumsum(arr, axis=axis, dtype=np.float64) + expected = np.sum(arr, axis=axis, dtype=np.float64) + if not np.all( + np.isclose( + out.take(-1, axis=axis), expected, rtol=rtol, atol=atol, equal_nan=True + ) + ): + raise ValueError(Errors.E163) + return out + + +def _auc(x, y): + """Compute Area Under the Curve (AUC) using the trapezoidal rule + + This is a general function, given points on a curve. For computing the + area under the ROC-curve, see :func:`roc_auc_score`. + + Parameters + ---------- + x : array, shape = [n] + x coordinates. These must be either monotonic increasing or monotonic + decreasing. + y : array, shape = [n] + y coordinates. + + Returns + ------- + auc : float + """ + x = np.ravel(x) + y = np.ravel(y) + + direction = 1 + dx = np.diff(x) + if np.any(dx < 0): + if np.all(dx <= 0): + direction = -1 + else: + raise ValueError(Errors.E164.format(x=x)) + + area = direction * trapezoid(y, x) + if isinstance(area, np.memmap): + # Reductions such as .sum used internally in trapezoid do not return a + # scalar by default for numpy.memmap instances contrary to + # regular numpy.ndarray instances. + area = area.dtype.type(area) + return area diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/strings.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/strings.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b6cd754ade03244999afef3231e15f7f31035323 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/strings.cpp @@ -0,0 +1,18853 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.strings", + "sources": [ + "spacy/strings.pyx" + ] + }, + "module_name": "spacy.strings" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +/* InitLimitedAPI */ +#if defined(Py_LIMITED_API) + #if !defined(CYTHON_LIMITED_API) + #define CYTHON_LIMITED_API 1 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef _MSC_VER + #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") + #else + #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. + #endif +#endif + +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x03080000 + #error Cython requires Python 3.8+. +#else +#define __PYX_ABI_VERSION "3_2_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* CModulePreamble */ +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#define __PYX_COMMA , +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) + #endif + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 1 + #endif + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #ifdef Py_GIL_DISABLED + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 + #else + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #endif + #if PY_VERSION_HEX < 0x030A0000 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #elif !defined(CYTHON_USE_TYPE_SLOTS) + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLIST_INTERNALS) + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #elif !defined(CYTHON_FAST_GIL) + #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #ifndef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif + #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work + #elif !defined(CYTHON_IMMORTAL_CONSTANTS) + #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif +#endif +#ifndef CYTHON_COMPRESS_STRINGS + #define CYTHON_COMPRESS_STRINGS 1 +#endif +#ifndef CYTHON_FAST_PYCCALL +#define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL +#endif +#ifndef CYTHON_VECTORCALL +#if CYTHON_COMPILING_IN_LIMITED_API +#define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) +#else +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) +#endif +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#include +typedef uintptr_t __pyx_uintptr_t; +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif +#ifndef Py_UNREACHABLE + #define Py_UNREACHABLE() assert(0); abort() +#endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* PythonCompatibility */ +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#define __Pyx_BUILTIN_MODULE_NAME "builtins" +#define __Pyx_DefaultClassType PyType_Type +#if CYTHON_COMPILING_IN_LIMITED_API + #ifndef CO_OPTIMIZED + static int CO_OPTIMIZED; + #endif + #ifndef CO_NEWLOCALS + static int CO_NEWLOCALS; + #endif + #ifndef CO_VARARGS + static int CO_VARARGS; + #endif + #ifndef CO_VARKEYWORDS + static int CO_VARKEYWORDS; + #endif + #ifndef CO_ASYNC_GENERATOR + static int CO_ASYNC_GENERATOR; + #endif + #ifndef CO_GENERATOR + static int CO_GENERATOR; + #endif + #ifndef CO_COROUTINE + static int CO_COROUTINE; + #endif +#else + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 + #endif +#endif +static int __Pyx_init_co_variables(void); +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif +#ifndef Py_TPFLAGS_IMMUTABLETYPE + #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) +#endif +#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION + #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) +#endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#ifndef METH_FASTCALL + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #if PY_VERSION_HEX >= 0x030d00A4 + # define __Pyx_PyCFunctionFast PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords + #else + # define __Pyx_PyCFunctionFast _PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords + #endif +#endif +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX >= 0x030900B1 +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) +#else +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) +#endif +#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) +#elif !CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) +static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { + return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; +} +#endif +static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; +#else + return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +#endif +} +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) +#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) +#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) +#elif CYTHON_COMPILING_IN_GRAAL + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#endif +#if CYTHON_USE_MODULE_STATE +static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) +#else +#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) +#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) +#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) + #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) + #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ + ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ + (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ + __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) + #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) + #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) +#endif +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) +#endif +#define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) +#if CYTHON_USE_TYPE_SPECS +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE((PyObject*)obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#else + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #else + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #endif +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif +#endif +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#elif CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) +#endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif +enum __Pyx_ReferenceSharing { + __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check + __Pyx_ReferenceSharing_OwnStrongReference, + __Pyx_ReferenceSharing_FunctionArgument, + __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar +}; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ + (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ + (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ + (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) +#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) +#else +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) +#endif +#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) + #else + #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) + #endif +#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) + #endif +#else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) +#endif +#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ + __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) +#else + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) +#endif +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyObject_GetItem(dict, key); + if (*result == NULL) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + return 0; + } + return -1; + } + return 1; +} +#else +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyDict_GetItemWithError(dict, key); + if (*result == NULL) { + return PyErr_Occurred() ? -1 : 0; + } + Py_INCREF(*result); + return 1; +} +#endif +#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST + #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) +#else + #define __Pyx_VISIT_CONST(obj) +#endif +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) +#else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) +#endif +#if CYTHON_ASSUME_SAFE_SIZE + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) +#else + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) +#endif +#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t +#define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t +#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 + #define __Pyx_PySendResult PySendResult +#else + typedef enum { + PYGEN_RETURN = 0, + PYGEN_ERROR = -1, + PYGEN_NEXT = 1, + } __Pyx_PySendResult; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 + typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); +#else + #define __Pyx_pyiter_sendfunc sendfunc +#endif +#if !CYTHON_USE_AM_SEND +#define __PYX_HAS_PY_AM_SEND 0 +#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 +#define __PYX_HAS_PY_AM_SEND 1 +#else +#define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation +#endif +#if __PYX_HAS_PY_AM_SEND < 2 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods +#else + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + __Pyx_pyiter_sendfunc am_send; + } __Pyx_PyAsyncMethodsStruct; + #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) +#endif +#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 + #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) +#else + #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) +#endif +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() +#else +#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 +#ifdef __cplusplus +extern "C" +#endif +PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { + int value; + PyObject *py_value = PyObject_GetAttrString(inspect, name); + if (!py_value) return 0; + value = (int) PyLong_AsLong(py_value); + Py_DECREF(py_value); + *write_to = value; + return value != -1 || !PyErr_Occurred(); +} +static int __Pyx_init_co_variables(void) { + PyObject *inspect; + int result; + inspect = PyImport_ImportModule("inspect"); + result = +#if !defined(CO_OPTIMIZED) + __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && +#endif +#if !defined(CO_NEWLOCALS) + __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && +#endif +#if !defined(CO_VARARGS) + __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && +#endif +#if !defined(CO_VARKEYWORDS) + __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && +#endif +#if !defined(CO_ASYNC_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && +#endif +#if !defined(CO_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && +#endif +#if !defined(CO_COROUTINE) + __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && +#endif + 1; + Py_DECREF(inspect); + return result ? 0 : -1; +} +#else +static int __Pyx_init_co_variables(void) { + return 0; // It's a limited API-only feature +} +#endif + +/* MathInitCode */ +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #ifndef _USE_MATH_DEFINES + #define _USE_MATH_DEFINES + #endif +#endif +#include +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 +#endif +#ifndef CYTHON_CLINE_IN_TRACEBACK +#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#endif +#if CYTHON_CLINE_IN_TRACEBACK +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } +#else +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } +#endif +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__strings +#define __PYX_HAVE_API__spacy__strings +/* Early includes */ +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) +#else + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) +#endif +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) + return Py_NewRef(obj); +#else + Py_INCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) + return Py_XNewRef(obj); +#else + Py_XINCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) +#else +#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) +#endif +#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) +#else + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +/* PretendToInitialize */ +#ifdef __cplusplus +#if __cplusplus > 201103L +#include +#endif +template +static void __Pyx_pretend_to_initialize(T* ptr) { +#if __cplusplus > 201103L + if ((std::is_trivially_default_constructible::value)) +#endif + *ptr = T(); + (void)ptr; +} +#else +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#endif + + +#if !CYTHON_USE_MODULE_STATE +static PyObject *__pyx_m = NULL; +#endif +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * const __pyx_cfilenm = __FILE__; +static const char *__pyx_filename; + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/strings.pyx", + "spacy/strings.pxd", + "cymem/cymem.pxd", + "preshed/maps.pxd", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* Atomics.proto (used by UnpackUnboundCMethod) */ +#include +#ifndef CYTHON_ATOMICS + #define CYTHON_ATOMICS 1 +#endif +#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS +#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __pyx_atomic_int_type int +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_ptr_type atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) atomic_load(value) + #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_ptr_type std::atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) std::atomic_load(value) + #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ + (__GNUC_MINOR__ > 1 ||\ + (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) + #define __pyx_atomic_ptr_type void* + #define __pyx_nonatomic_ptr_type void* + #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) + #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #warning "Using GNU atomics" + #endif +#elif CYTHON_ATOMICS && defined(_MSC_VER) + #include + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type long + #define __pyx_atomic_ptr_type void* + #undef __pyx_nonatomic_int_type + #define __pyx_nonatomic_int_type long + #define __pyx_nonatomic_ptr_type void* + #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) + #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) + #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) + #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value + #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #pragma message ("Using MSVC atomics") + #endif +#else + #undef CYTHON_ATOMICS + #define CYTHON_ATOMICS 0 + #ifdef __PYX_DEBUG_ATOMICS + #warning "Not using atomics" + #endif +#endif + +/* CriticalSectionsDefinition.proto (used by CriticalSections) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection void* +#define __Pyx_PyCriticalSection2 void* +#define __Pyx_PyCriticalSection_End(cs) +#define __Pyx_PyCriticalSection2_End(cs) +#else +#define __Pyx_PyCriticalSection PyCriticalSection +#define __Pyx_PyCriticalSection2 PyCriticalSection2 +#define __Pyx_PyCriticalSection_End PyCriticalSection_End +#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End +#endif + +/* CriticalSections.proto (used by ParseKeywordsImpl) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs) +#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs) +#else +#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin +#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin +#endif +#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_BEGIN_CRITICAL_SECTION(o) { +#define __Pyx_END_CRITICAL_SECTION() } +#else +#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION +#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION +#endif + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* #### Code section: numeric_typedefs ### */ + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone; +struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "spacy/strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "spacy/strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "spacy/strings.pyx":194 + * return self.keys.size() + self._transient_keys.size() + * + * @contextmanager # <<<<<<<<<<<<<< + * def memory_zone(self, mem: Optional[Pool] = None) -> Pool: + * """Begin a block where all resources allocated during the block will +*/ +struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone { + PyObject_HEAD + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key; + PyObject *__pyx_v_mem; + struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self; +}; + + +/* "spacy/strings.pyx":286 + * return False + * + * def __iter__(self): # <<<<<<<<<<<<<< + * """Iterate over the strings in the store, in order. + * +*/ +struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__ { + PyObject_HEAD + int __pyx_v_i; + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key; + struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self; + __pyx_t_5spacy_7strings_Utf8Str *__pyx_v_utf8str; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> ::size_type __pyx_t_0; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> ::size_type __pyx_t_1; + int __pyx_t_2; +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "spacy/strings.pyx":116 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * """Look up strings by 64-bit hashes. + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; +static __pyx_t_5spacy_7strings_Utf8Str const *__pyx_f_5spacy_7strings_11StringStore__intern_utf8(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +/* #### Code section: utility_code_proto ### */ + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* GetTopmostException.proto (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* PyThreadStateGet.proto (used by SaveResetException) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* TupleAndListFromArray.proto (used by fastcall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +#endif +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto (used by BytesEquals) */ +#include + +/* BytesEquals.proto (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i)) +#else + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i)) +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i]) + #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); + #else + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #endif +#else + #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS +#endif +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start) +#else +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* py_dict_items.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); + +/* CallCFunction.proto (used by CallUnboundCMethod0) */ +#define __Pyx_CallCFunction(cfunc, self, args)\ + ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args) +#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\ + ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs) +#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\ + ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs) +#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ + ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) + +/* PyObjectCall.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto (used by PyObjectCallOneArg) */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); + +/* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* PyObjectGetAttrStr.proto (used by UnpackUnboundCMethod) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ +typedef struct { + PyObject *type; + PyObject **method_name; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS + __pyx_atomic_int_type initialized; +#endif + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) { +#if !CYTHON_ATOMICS + return 1; +#else + __pyx_nonatomic_int_type expected = 0; + if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) { + return 0; + } + return expected; +#endif +} +static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) { +#if CYTHON_ATOMICS + __pyx_atomic_store(&cfunc->initialized, 2); +#endif +} +#else +#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2 +#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc) +#endif + +/* CallUnboundCMethod0.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#else +#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) +#endif + +/* py_dict_values.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); + +/* OwnedDictNext.proto (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue); +#else +CYTHON_INLINE +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue); +#endif + +/* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywordsImpl.export */ +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name +); +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* CallUnboundCMethod2.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); +#else +#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) +#endif + +/* ParseKeywords.proto */ +static CYTHON_INLINE int __Pyx_ParseKeywords( + PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[], + PyObject *kwds2, PyObject *values[], + Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto (used by GetModuleGlobalName) */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* PyDictVersioning.proto (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* PyObjectFastCallMethod.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) +#else +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); +#endif + +/* ArgTypeTestFunc.export */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) + +/* decode_c_string_utf16.proto (used by decode_c_string) */ +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 0; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = -1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} + +/* decode_c_string.proto */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + const char* cstring, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); + +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long, int b_is_constant); + +/* ModInt[long].proto */ +static CYTHON_INLINE long __Pyx_mod_long(long, long, int b_is_constant); + +/* PyObjectVectorCallKwBuilder.proto (used by PyObjectVectorCallMethodKwBuilder) */ +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#if CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall +#endif +#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict +#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) +#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) +#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) +#endif + +/* PyObjectVectorCallMethodKwBuilder.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod +#else +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#endif + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* PyKeyError_Check.proto */ +#define __Pyx_PyExc_KeyError_Check(obj) __Pyx_TypeCheck(obj, PyExc_KeyError) + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* PyTypeError_Check.proto */ +#define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) + +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); + +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* KeywordStringCheck.proto */ +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(const char* function_name, PyObject *kw); + +/* AllocateExtensionType.proto */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); + +/* DefaultPlacementNew.proto */ +#include +template +void __Pyx_default_placement_construct(T* x) { + new (static_cast(x)) T(); +} + +/* CallTypeTraverse.proto */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0 +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg); +#endif + +/* CheckTypeForFreelists.proto */ +#if CYTHON_USE_FREELISTS +#if CYTHON_USE_TYPE_SPECS +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT +#else +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE) +#endif +#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\ + (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\ + (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS))) +#endif + +/* FunctionExport.proto */ +static int __Pyx_ExportFunction(PyObject *api_dict, const char *name, void (*f)(void), const char *sig); + +/* GetApiDict.proto */ +static PyObject *__Pyx_ApiExport_GetApiDict(void); + +/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp); +#endif + +/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v); +#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v) + +/* FixUpExtensionType.proto */ +static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); + +/* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); +#endif + +/* PyObjectCallMethod0.proto (used by PyType_Ready) */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto (used by PyType_Ready) */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* GetVTable.proto (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +static int __Pyx_MergeVtables(PyTypeObject *type); + +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* HasAttr.proto (used by ImportImpl) */ +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n) +#else +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +#endif + +/* ImportImpl.export */ +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); + +/* Import.proto */ +static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* dict_setdefault.proto (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); + +/* AddModuleRef.proto (used by FetchSharedCythonModule) */ +#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ + __PYX_LIMITED_VERSION_HEX < 0x030d0000) + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); +#else + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#endif + +/* FetchSharedCythonModule.proto (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto (used by CommonTypesMetaclass) */ +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases); + +/* CommonTypesMetaclass.proto (used by CythonFunctionShared) */ +static int __pyx_CommonTypesMetaclass_init(PyObject *module); +#define __Pyx_CommonTypesMetaclass_USED + +/* PyMethodNew.proto (used by CythonFunctionShared) */ +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ); + +/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto (used by CythonFunction) */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_dict; +#endif + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + PyObject *defaults; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#undef __Pyx_CyOrPyCFunction_Check +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType) +#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType) +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)); +#undef __Pyx_IsSameCFunction +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, + PyTypeObject *defaults_type); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* GetNameInClass.proto */ +#define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name) +static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name); + +/* CLineInTraceback.proto (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#else +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#endif + +/* CodeObjectCache.proto (used by AddTraceback) */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject __Pyx_CachedCodeObjectType; +#else +typedef PyCodeObject __Pyx_CachedCodeObjectType; +#endif +typedef struct { + __Pyx_CachedCodeObjectType* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_int_type accessor_count; + #endif +}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#else +static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); +#endif +#else // !LIMITED_API +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { + return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); +} +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +#ifdef PyExceptionInstance_Check + #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) +#else + #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) +#endif + +/* GetRuntimeVersion.proto */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +static unsigned long __Pyx_cached_runtime_version = 0; +static void __Pyx_init_runtime_version(void); +#else +#define __Pyx_init_runtime_version() +#endif +static unsigned long __Pyx_get_runtime_version(void); + +/* SwapException.proto (used by CoroutineBase) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* IterNextPlain.proto (used by CoroutineBase) */ +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void); +#endif + +/* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectCallMethod1.proto (used by CoroutineBase) */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* ReturnWithStopIteration.proto (used by CoroutineBase) */ +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext); + +/* CoroutineBase.proto (used by Generator) */ +struct __pyx_CoroutineObject; +typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_ExcInfoStruct _PyErr_StackItem +#else +typedef struct { + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; +} __Pyx_ExcInfoStruct; +#endif +typedef struct __pyx_CoroutineObject { + PyObject_HEAD + __pyx_coroutine_body_t body; + PyObject *closure; + __Pyx_ExcInfoStruct gi_exc_state; +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *gi_weakreflist; +#endif + PyObject *classobj; + PyObject *yieldfrom; + __Pyx_pyiter_sendfunc yieldfrom_am_send; + PyObject *gi_name; + PyObject *gi_qualname; + PyObject *gi_modulename; + PyObject *gi_code; + PyObject *gi_frame; +#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE) + PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count]; + uint64_t __pyx_pymonitoring_version; +#endif + int resume_label; + char is_running; +} __pyx_CoroutineObject; +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); +static int __Pyx_Coroutine_clear(PyObject *self); +static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval); +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); +static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval); +static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_Coroutine_SwapException(self) +#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) +#else +#define __Pyx_Coroutine_SwapException(self) {\ + __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ + __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ + } +#define __Pyx_Coroutine_ResetAndClearException(self) {\ + __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ + (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ + } +#endif +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) +#endif +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen); +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen); +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen); +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure); +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send); +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg); + +/* Generator.proto */ +#define __Pyx_Generator_USED +#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType) +#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\ + __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name) +static PyObject *__Pyx_Generator_Next(PyObject *self); +static int __pyx_Generator_init(PyObject *module); +static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self); + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); + +/* DecompressString.proto */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); + +/* MultiPhaseInitModuleState.proto */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +static PyObject *__Pyx_State_FindModule(void*); +static int __Pyx_State_AddModule(PyObject* module, void*); +static int __Pyx_State_RemoveModule(void*); +#elif CYTHON_USE_MODULE_STATE +#define __Pyx_State_FindModule PyState_FindModule +#define __Pyx_State_AddModule PyState_AddModule +#define __Pyx_State_RemoveModule PyState_RemoveModule +#endif + +/* #### Code section: module_declarations ### */ +/* CythonABIVersion.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API + #if CYTHON_METH_FASTCALL + #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" + #else + #define __PYX_FASTCALL_ABI_SUFFIX + #endif + #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#else + #define __PYX_LIMITED_ABI_SUFFIX +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + #define __PYX_AM_SEND_ABI_SUFFIX +#elif __PYX_HAS_PY_AM_SEND == 2 + #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" +#else + #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" +#endif +#ifndef __PYX_MONITORING_ABI_SUFFIX + #define __PYX_MONITORING_ABI_SUFFIX +#endif +#if CYTHON_USE_TP_FINALIZE + #define __PYX_TP_FINALIZE_ABI_SUFFIX +#else + #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" +#endif +#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) + #define __PYX_FREELISTS_ABI_SUFFIX +#else + #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" +#endif +#define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." + +static __pyx_t_5spacy_7strings_Utf8Str const *__pyx_f_5spacy_7strings_11StringStore_intern_unicode(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_py_string, int __pyx_v_allow_transient); /* proto*/ +static __pyx_t_5spacy_7strings_Utf8Str const *__pyx_f_5spacy_7strings_11StringStore__intern_utf8(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, char *__pyx_v_utf8_string, int __pyx_v_length, __pyx_t_5spacy_8typedefs_hash_t *__pyx_v_precalculated_hash, int __pyx_v_allow_transient); /* proto*/ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint32_t (*__pyx_f_10murmurhash_4mrmr_hash32)(void *, int, uint32_t); /*proto*/ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "preshed.maps" */ +static void *(*__pyx_f_7preshed_4maps_map_clear)(struct __pyx_t_7preshed_4maps_MapStruct *, __pyx_t_7preshed_4maps_key_t const ); /*proto*/ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "cython" */ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "spacy.strings" */ +static __pyx_t_5spacy_8typedefs_hash_t __pyx_f_5spacy_7strings_hash_string(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static __pyx_t_5spacy_8typedefs_hash_t __pyx_f_5spacy_7strings_hash_utf8(char *, int); /*proto*/ +static PyObject *__pyx_f_5spacy_7strings_decode_Utf8Str(__pyx_t_5spacy_7strings_Utf8Str const *); /*proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_7strings__try_coerce_to_hash(PyObject *, __pyx_t_5spacy_8typedefs_hash_t *); /*proto*/ +static __pyx_t_5spacy_7strings_Utf8Str *__pyx_f_5spacy_7strings__allocate(struct __pyx_obj_5cymem_5cymem_Pool *, unsigned char const *, uint32_t); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.strings" +extern int __pyx_module_is_main_spacy__strings; +int __pyx_module_is_main_spacy__strings = 0; + +/* Implementation of "spacy.strings" */ +/* #### Code section: global_var ### */ +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static PyObject *__pyx_pf_5spacy_7strings_get_string_id(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_2hash_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string); /* proto */ +static int __pyx_pf_5spacy_7strings_11StringStore___init__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_strings, CYTHON_UNUSED PyObject *__pyx_v_freeze); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_2__getitem__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_string_or_id); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_4as_int(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_6as_string(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static Py_ssize_t __pyx_pf_5spacy_7strings_11StringStore_8__len__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_10memory_zone(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_mem); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_13add(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_string, PyObject *__pyx_v_allow_transient); /* proto */ +static Py_ssize_t __pyx_pf_5spacy_7strings_11StringStore_15__len__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_7strings_11StringStore_17__contains__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_string_or_id); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_19__iter__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_22__reduce__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_24values(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_26to_disk(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_path); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_28from_disk(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_path); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_30to_bytes(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_32from_bytes(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_bytes_data, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_34_reset_and_load(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_strings); /* proto */ +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_4_map___get__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_7strings_11StringStore_4_map_2__set__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_7strings_11StringStore_4_map_4__del__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self); /* proto */ +static PyObject *__pyx_tp_new_5spacy_7strings_StringStore(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_7strings___pyx_scope_struct__memory_zone(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_7strings___pyx_scope_struct_1___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +/* SmallCodeConfig */ +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyObject *__pyx_type_5spacy_7strings_StringStore; + PyObject *__pyx_type_5spacy_7strings___pyx_scope_struct__memory_zone; + PyObject *__pyx_type_5spacy_7strings___pyx_scope_struct_1___iter__; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyTypeObject *__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone; + PyTypeObject *__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + PyObject *__pyx_tuple[1]; + PyObject *__pyx_codeobj_tab[14]; + PyObject *__pyx_string_tab[140]; + PyObject *__pyx_number_tab[1]; +/* #### Code section: module_state_contents ### */ + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone *__pyx_freelist_5spacy_7strings___pyx_scope_struct__memory_zone[8]; +int __pyx_freecount_5spacy_7strings___pyx_scope_struct__memory_zone; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__ *__pyx_freelist_5spacy_7strings___pyx_scope_struct_1___iter__[8]; +int __pyx_freecount_5spacy_7strings___pyx_scope_struct_1___iter__; +#endif +/* CommonTypesMetaclass.module_state_decls */ +PyTypeObject *__pyx_CommonTypesMetaclassType; + +/* CachedMethodType.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API +PyObject *__Pyx_CachedMethodType; +#endif + +/* CythonFunctionShared.module_state_decls */ +PyTypeObject *__pyx_CyFunctionType; + +/* CodeObjectCache.module_state_decls */ +struct __Pyx_CodeObjectCache __pyx_code_cache; + +/* IterNextPlain.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache; +#endif + +/* Generator.module_state_decls */ +PyTypeObject *__pyx_GeneratorType; + +/* #### Code section: module_state_end ### */ +} __pyx_mstatetype; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { +extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) + +#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstatetype __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: constant_name_defines ### */ +#define __pyx_kp_u_ __pyx_string_tab[0] +#define __pyx_kp_u_List_int __pyx_string_tab[1] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[2] +#define __pyx_kp_u_Optional_Pool __pyx_string_tab[3] +#define __pyx_kp_u_Optional_bool __pyx_string_tab[4] +#define __pyx_kp_u__2 __pyx_string_tab[5] +#define __pyx_kp_u__3 __pyx_string_tab[6] +#define __pyx_kp_u_add_note __pyx_string_tab[7] +#define __pyx_kp_u_disable __pyx_string_tab[8] +#define __pyx_kp_u_enable __pyx_string_tab[9] +#define __pyx_kp_u_gc __pyx_string_tab[10] +#define __pyx_kp_u_isenabled __pyx_string_tab[11] +#define __pyx_kp_u_spacy __pyx_string_tab[12] +#define __pyx_kp_u_spacy_contextlib __pyx_string_tab[13] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[14] +#define __pyx_kp_u_spacy_srsly __pyx_string_tab[15] +#define __pyx_kp_u_spacy_strings_pyx __pyx_string_tab[16] +#define __pyx_kp_u_spacy_symbols __pyx_string_tab[17] +#define __pyx_kp_u_spacy_typing __pyx_string_tab[18] +#define __pyx_n_u_ __pyx_string_tab[19] +#define __pyx_n_u_E017 __pyx_string_tab[20] +#define __pyx_n_u_E018 __pyx_string_tab[21] +#define __pyx_n_u_Errors __pyx_string_tab[22] +#define __pyx_n_u_IDS __pyx_string_tab[23] +#define __pyx_n_u_List __pyx_string_tab[24] +#define __pyx_n_u_NAMES __pyx_string_tab[25] +#define __pyx_n_u_Optional __pyx_string_tab[26] +#define __pyx_n_u_Pool __pyx_string_tab[27] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[28] +#define __pyx_n_u_SYMBOLS_BY_INT __pyx_string_tab[29] +#define __pyx_n_u_SYMBOLS_BY_STR __pyx_string_tab[30] +#define __pyx_n_u_StringStore __pyx_string_tab[31] +#define __pyx_n_u_StringStore___iter __pyx_string_tab[32] +#define __pyx_n_u_StringStore___reduce __pyx_string_tab[33] +#define __pyx_n_u_StringStore__reset_and_load __pyx_string_tab[34] +#define __pyx_n_u_StringStore_add __pyx_string_tab[35] +#define __pyx_n_u_StringStore_as_int __pyx_string_tab[36] +#define __pyx_n_u_StringStore_as_string __pyx_string_tab[37] +#define __pyx_n_u_StringStore_from_bytes __pyx_string_tab[38] +#define __pyx_n_u_StringStore_from_disk __pyx_string_tab[39] +#define __pyx_n_u_StringStore_memory_zone __pyx_string_tab[40] +#define __pyx_n_u_StringStore_to_bytes __pyx_string_tab[41] +#define __pyx_n_u_StringStore_to_disk __pyx_string_tab[42] +#define __pyx_n_u_StringStore_values __pyx_string_tab[43] +#define __pyx_n_u_add __pyx_string_tab[44] +#define __pyx_n_u_allow_transient __pyx_string_tab[45] +#define __pyx_n_u_as_int __pyx_string_tab[46] +#define __pyx_n_u_as_string __pyx_string_tab[47] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[48] +#define __pyx_n_u_bytes_data __pyx_string_tab[49] +#define __pyx_n_u_chars __pyx_string_tab[50] +#define __pyx_n_u_class_getitem __pyx_string_tab[51] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[52] +#define __pyx_n_u_close __pyx_string_tab[53] +#define __pyx_n_u_contextlib __pyx_string_tab[54] +#define __pyx_n_u_contextmanager __pyx_string_tab[55] +#define __pyx_n_u_dict __pyx_string_tab[56] +#define __pyx_n_u_encode __pyx_string_tab[57] +#define __pyx_n_u_ensure_path __pyx_string_tab[58] +#define __pyx_n_u_errors __pyx_string_tab[59] +#define __pyx_n_u_format __pyx_string_tab[60] +#define __pyx_n_u_freeze __pyx_string_tab[61] +#define __pyx_n_u_from_bytes __pyx_string_tab[62] +#define __pyx_n_u_from_disk __pyx_string_tab[63] +#define __pyx_n_u_func __pyx_string_tab[64] +#define __pyx_n_u_get __pyx_string_tab[65] +#define __pyx_n_u_get_string_id __pyx_string_tab[66] +#define __pyx_n_u_hash_string __pyx_string_tab[67] +#define __pyx_n_u_hash_value __pyx_string_tab[68] +#define __pyx_n_u_hashes __pyx_string_tab[69] +#define __pyx_n_u_i __pyx_string_tab[70] +#define __pyx_n_u_int __pyx_string_tab[71] +#define __pyx_n_u_is_coroutine __pyx_string_tab[72] +#define __pyx_n_u_items __pyx_string_tab[73] +#define __pyx_n_u_iter __pyx_string_tab[74] +#define __pyx_n_u_json_dumps __pyx_string_tab[75] +#define __pyx_n_u_json_loads __pyx_string_tab[76] +#define __pyx_n_u_key __pyx_string_tab[77] +#define __pyx_n_u_keys __pyx_string_tab[78] +#define __pyx_n_u_kwargs __pyx_string_tab[79] +#define __pyx_n_u_main __pyx_string_tab[80] +#define __pyx_n_u_mem __pyx_string_tab[81] +#define __pyx_n_u_memory_zone __pyx_string_tab[82] +#define __pyx_n_u_module __pyx_string_tab[83] +#define __pyx_n_u_name __pyx_string_tab[84] +#define __pyx_n_u_next __pyx_string_tab[85] +#define __pyx_n_u_path __pyx_string_tab[86] +#define __pyx_n_u_pop __pyx_string_tab[87] +#define __pyx_n_u_prev __pyx_string_tab[88] +#define __pyx_n_u_pyx_capi __pyx_string_tab[89] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[90] +#define __pyx_n_u_qualname __pyx_string_tab[91] +#define __pyx_n_u_read_json __pyx_string_tab[92] +#define __pyx_n_u_reduce __pyx_string_tab[93] +#define __pyx_n_u_reset_and_load __pyx_string_tab[94] +#define __pyx_n_u_return __pyx_string_tab[95] +#define __pyx_n_u_self __pyx_string_tab[96] +#define __pyx_n_u_send __pyx_string_tab[97] +#define __pyx_n_u_set_name __pyx_string_tab[98] +#define __pyx_n_u_setdefault __pyx_string_tab[99] +#define __pyx_n_u_size __pyx_string_tab[100] +#define __pyx_n_u_spacy_strings __pyx_string_tab[101] +#define __pyx_n_u_srsly __pyx_string_tab[102] +#define __pyx_n_u_str __pyx_string_tab[103] +#define __pyx_n_u_str_hash __pyx_string_tab[104] +#define __pyx_n_u_string __pyx_string_tab[105] +#define __pyx_n_u_strings __pyx_string_tab[106] +#define __pyx_n_u_symbol __pyx_string_tab[107] +#define __pyx_n_u_symbols __pyx_string_tab[108] +#define __pyx_n_u_test __pyx_string_tab[109] +#define __pyx_n_u_throw __pyx_string_tab[110] +#define __pyx_n_u_to_bytes __pyx_string_tab[111] +#define __pyx_n_u_to_disk __pyx_string_tab[112] +#define __pyx_n_u_transient_hashes __pyx_string_tab[113] +#define __pyx_n_u_typing __pyx_string_tab[114] +#define __pyx_n_u_utf8 __pyx_string_tab[115] +#define __pyx_n_u_utf8str __pyx_string_tab[116] +#define __pyx_n_u_util __pyx_string_tab[117] +#define __pyx_n_u_value __pyx_string_tab[118] +#define __pyx_n_u_value_type __pyx_string_tab[119] +#define __pyx_n_u_values __pyx_string_tab[120] +#define __pyx_n_u_word __pyx_string_tab[121] +#define __pyx_n_u_write_json __pyx_string_tab[122] +#define __pyx_kp_b_PyObject___pyx_t_5spacy_7strings __pyx_string_tab[123] +#define __pyx_kp_b_iso88591_00A_4q_1_3a_d_wd_Qha_wc_Qa_V7_1 __pyx_string_tab[124] +#define __pyx_kp_b_iso88591_A __pyx_string_tab[125] +#define __pyx_kp_b_iso88591_A_0 __pyx_string_tab[126] +#define __pyx_kp_b_iso88591_A_1_t1A_AQ_HA_AV_1_q __pyx_string_tab[127] +#define __pyx_kp_b_iso88591_A_4z_q_1_4q __pyx_string_tab[128] +#define __pyx_kp_b_iso88591_A_F_9AWCq __pyx_string_tab[129] +#define __pyx_kp_b_iso88591_A_G4q_T_HHA_E_q_F_Ja_AX_Q __pyx_string_tab[130] +#define __pyx_kp_b_iso88591_A_Qe1_1_4q __pyx_string_tab[131] +#define __pyx_kp_b_iso88591_A_aq_k_vQ __pyx_string_tab[132] +#define __pyx_kp_b_iso88591_A_t_q_q __pyx_string_tab[133] +#define __pyx_kp_b_iso88591_A_t_q_z_t1A_AQ_HA_AV_1_q __pyx_string_tab[134] +#define __pyx_kp_b_iso88591_A_uKwaq __pyx_string_tab[135] +#define __pyx_kp_b_iso88591_fE_E_at6_a_5_F_1_1F_D_8_Q_E_at __pyx_string_tab[136] +#define __pyx_kp_b_iso88591_z_q_3auCq_1_t1E_7_1_Cwaq_9AWCq __pyx_string_tab[137] +#define __pyx_kp_b_uint32_t_void_int_uint32_t_uint6 __pyx_string_tab[138] +#define __pyx_kp_b_void_struct___pyx_t_7preshed_4ma __pyx_string_tab[139] +#define __pyx_int_0 __pyx_number_tab[0] +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { + __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #if CYTHON_PEP489_MULTI_PHASE_INIT + __Pyx_State_RemoveModule(NULL); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7strings___pyx_scope_struct__memory_zone); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7strings___pyx_scope_struct_1___iter__); + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<14; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<140; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } +/* #### Code section: module_state_clear_contents ### */ +/* CommonTypesMetaclass.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + +/* Generator.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_GeneratorType); + +/* #### Code section: module_state_clear_end ### */ +return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7strings___pyx_scope_struct__memory_zone); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7strings___pyx_scope_struct_1___iter__); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<14; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<140; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } +/* #### Code section: module_state_traverse_contents ### */ +/* CommonTypesMetaclass.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + +/* Generator.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_GeneratorType); + +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "spacy/strings.pyx":24 + * + * # Not particularly elegant, but this is faster than `isinstance(key, numbers.Integral)` + * cdef inline bint _try_coerce_to_hash(object key, hash_t* out_hash): # <<<<<<<<<<<<<< + * try: + * out_hash[0] = key +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_7strings__try_coerce_to_hash(PyObject *__pyx_v_key, __pyx_t_5spacy_8typedefs_hash_t *__pyx_v_out_hash) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_try_coerce_to_hash", 0); + + /* "spacy/strings.pyx":25 + * # Not particularly elegant, but this is faster than `isinstance(key, numbers.Integral)` + * cdef inline bint _try_coerce_to_hash(object key, hash_t* out_hash): + * try: # <<<<<<<<<<<<<< + * out_hash[0] = key + * return True +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "spacy/strings.pyx":26 + * cdef inline bint _try_coerce_to_hash(object key, hash_t* out_hash): + * try: + * out_hash[0] = key # <<<<<<<<<<<<<< + * return True + * except: # no-cython-lint +*/ + __pyx_t_4 = __Pyx_PyLong_As_uint64_t(__pyx_v_key); if (unlikely((__pyx_t_4 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L3_error) + (__pyx_v_out_hash[0]) = __pyx_t_4; + + /* "spacy/strings.pyx":27 + * try: + * out_hash[0] = key + * return True # <<<<<<<<<<<<<< + * except: # no-cython-lint + * return False +*/ + __pyx_r = 1; + goto __pyx_L7_try_return; + + /* "spacy/strings.pyx":25 + * # Not particularly elegant, but this is faster than `isinstance(key, numbers.Integral)` + * cdef inline bint _try_coerce_to_hash(object key, hash_t* out_hash): + * try: # <<<<<<<<<<<<<< + * out_hash[0] = key + * return True +*/ + } + __pyx_L3_error:; + + /* "spacy/strings.pyx":28 + * out_hash[0] = key + * return True + * except: # no-cython-lint # <<<<<<<<<<<<<< + * return False + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + + /* "spacy/strings.pyx":29 + * return True + * except: # no-cython-lint + * return False # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L6_except_return; + } + + /* "spacy/strings.pyx":25 + * # Not particularly elegant, but this is faster than `isinstance(key, numbers.Integral)` + * cdef inline bint _try_coerce_to_hash(object key, hash_t* out_hash): + * try: # <<<<<<<<<<<<<< + * out_hash[0] = key + * return True +*/ + __pyx_L7_try_return:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L0; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L0; + } + + /* "spacy/strings.pyx":24 + * + * # Not particularly elegant, but this is faster than `isinstance(key, numbers.Integral)` + * cdef inline bint _try_coerce_to_hash(object key, hash_t* out_hash): # <<<<<<<<<<<<<< + * try: + * out_hash[0] = key +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":32 + * + * + * def get_string_id(key): # <<<<<<<<<<<<<< + * """Get a string ID, handling the reserved symbols correctly. If the key is + * already an ID, return it. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_1get_string_id(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_get_string_id, "get_string_id(key)\n\nGet a string ID, handling the reserved symbols correctly. If the key is\nalready an ID, return it.\n\nThis function optimises for convenience over performance, so shouldn't be\nused in tight loops."); +static PyMethodDef __pyx_mdef_5spacy_7strings_1get_string_id = {"get_string_id", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_1get_string_id, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_get_string_id}; +static PyObject *__pyx_pw_5spacy_7strings_1get_string_id(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_key = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_string_id (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 32, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 32, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_string_id", 0) < (0)) __PYX_ERR(0, 32, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_string_id", 1, 1, 1, i); __PYX_ERR(0, 32, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 32, __pyx_L3_error) + } + __pyx_v_key = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_string_id", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 32, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.strings.get_string_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7strings_get_string_id(__pyx_self, __pyx_v_key); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_get_string_id(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key) { + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_str_hash; + PyObject *__pyx_v_symbol = NULL; + PyObject *__pyx_v_chars = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + char *__pyx_t_8; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_string_id", 0); + + /* "spacy/strings.pyx":40 + * """ + * cdef hash_t str_hash + * if isinstance(key, str): # <<<<<<<<<<<<<< + * if len(key) == 0: + * return 0 +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":41 + * cdef hash_t str_hash + * if isinstance(key, str): + * if len(key) == 0: # <<<<<<<<<<<<<< + * return 0 + * +*/ + __pyx_t_2 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_2 == 0); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":42 + * if isinstance(key, str): + * if len(key) == 0: + * return 0 # <<<<<<<<<<<<<< + * + * symbol = SYMBOLS_BY_STR.get(key, None) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_r = __pyx_mstate_global->__pyx_int_0; + goto __pyx_L0; + + /* "spacy/strings.pyx":41 + * cdef hash_t str_hash + * if isinstance(key, str): + * if len(key) == 0: # <<<<<<<<<<<<<< + * return 0 + * +*/ + } + + /* "spacy/strings.pyx":44 + * return 0 + * + * symbol = SYMBOLS_BY_STR.get(key, None) # <<<<<<<<<<<<<< + * if symbol is not None: + * return symbol +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_SYMBOLS_BY_STR); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_key, Py_None}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_symbol = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/strings.pyx":45 + * + * symbol = SYMBOLS_BY_STR.get(key, None) + * if symbol is not None: # <<<<<<<<<<<<<< + * return symbol + * else: +*/ + __pyx_t_1 = (__pyx_v_symbol != Py_None); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":46 + * symbol = SYMBOLS_BY_STR.get(key, None) + * if symbol is not None: + * return symbol # <<<<<<<<<<<<<< + * else: + * chars = key.encode("utf8") +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_symbol); + __pyx_r = __pyx_v_symbol; + goto __pyx_L0; + + /* "spacy/strings.pyx":45 + * + * symbol = SYMBOLS_BY_STR.get(key, None) + * if symbol is not None: # <<<<<<<<<<<<<< + * return symbol + * else: +*/ + } + + /* "spacy/strings.pyx":48 + * return symbol + * else: + * chars = key.encode("utf8") # <<<<<<<<<<<<<< + * return hash_utf8(chars, len(chars)) + * elif _try_coerce_to_hash(key, &str_hash): +*/ + /*else*/ { + __pyx_t_6 = __pyx_v_key; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_n_u_utf8}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_chars = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/strings.pyx":49 + * else: + * chars = key.encode("utf8") + * return hash_utf8(chars, len(chars)) # <<<<<<<<<<<<<< + * elif _try_coerce_to_hash(key, &str_hash): + * # Coerce the integral key to the expected primitive hash type. +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_8 = __Pyx_PyObject_AsWritableString(__pyx_v_chars); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_chars); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_9 = __pyx_f_5spacy_7strings_hash_utf8(__pyx_t_8, __pyx_t_2); if (unlikely(__pyx_t_9 == ((__pyx_t_5spacy_8typedefs_hash_t)-1LL) && PyErr_Occurred())) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_From_uint64_t(__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + + /* "spacy/strings.pyx":40 + * """ + * cdef hash_t str_hash + * if isinstance(key, str): # <<<<<<<<<<<<<< + * if len(key) == 0: + * return 0 +*/ + } + + /* "spacy/strings.pyx":50 + * chars = key.encode("utf8") + * return hash_utf8(chars, len(chars)) + * elif _try_coerce_to_hash(key, &str_hash): # <<<<<<<<<<<<<< + * # Coerce the integral key to the expected primitive hash type. + * # This ensures that custom/overloaded "primitive" data types +*/ + __pyx_t_1 = __pyx_f_5spacy_7strings__try_coerce_to_hash(__pyx_v_key, (&__pyx_v_str_hash)); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/strings.pyx":56 + * # downsteam (as these are internally implemented as custom PyObjects + * # whose comparison operators can incur a significant overhead). + * return str_hash # <<<<<<<<<<<<<< + * else: + * # TODO: Raise an error instead +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyLong_From_uint64_t(__pyx_v_str_hash); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/strings.pyx":50 + * chars = key.encode("utf8") + * return hash_utf8(chars, len(chars)) + * elif _try_coerce_to_hash(key, &str_hash): # <<<<<<<<<<<<<< + * # Coerce the integral key to the expected primitive hash type. + * # This ensures that custom/overloaded "primitive" data types +*/ + } + + /* "spacy/strings.pyx":59 + * else: + * # TODO: Raise an error instead + * return key # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_key); + __pyx_r = __pyx_v_key; + goto __pyx_L0; + } + + /* "spacy/strings.pyx":32 + * + * + * def get_string_id(key): # <<<<<<<<<<<<<< + * """Get a string ID, handling the reserved symbols correctly. If the key is + * already an ID, return it. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.strings.get_string_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_symbol); + __Pyx_XDECREF(__pyx_v_chars); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":62 + * + * + * cpdef hash_t hash_string(str string) except 0: # <<<<<<<<<<<<<< + * chars = string.encode("utf8") + * return hash_utf8(chars, len(chars)) +*/ + +static PyObject *__pyx_pw_5spacy_7strings_3hash_string(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static __pyx_t_5spacy_8typedefs_hash_t __pyx_f_5spacy_7strings_hash_string(PyObject *__pyx_v_string, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_v_chars = NULL; + __pyx_t_5spacy_8typedefs_hash_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("hash_string", 0); + + /* "spacy/strings.pyx":63 + * + * cpdef hash_t hash_string(str string) except 0: + * chars = string.encode("utf8") # <<<<<<<<<<<<<< + * return hash_utf8(chars, len(chars)) + * +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); + __PYX_ERR(0, 63, __pyx_L1_error) + } + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_chars = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":64 + * cpdef hash_t hash_string(str string) except 0: + * chars = string.encode("utf8") + * return hash_utf8(chars, len(chars)) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_chars); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(__pyx_v_chars); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_4 = __pyx_f_5spacy_7strings_hash_utf8(__pyx_t_2, __pyx_t_3); if (unlikely(__pyx_t_4 == ((__pyx_t_5spacy_8typedefs_hash_t)-1LL) && PyErr_Occurred())) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_r = __pyx_t_4; + goto __pyx_L0; + + /* "spacy/strings.pyx":62 + * + * + * cpdef hash_t hash_string(str string) except 0: # <<<<<<<<<<<<<< + * chars = string.encode("utf8") + * return hash_utf8(chars, len(chars)) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.strings.hash_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_chars); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_3hash_string(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_2hash_string, "hash_string(str string) -> hash_t"); +static PyMethodDef __pyx_mdef_5spacy_7strings_3hash_string = {"hash_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_3hash_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_2hash_string}; +static PyObject *__pyx_pw_5spacy_7strings_3hash_string(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_string = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("hash_string (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_string,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 62, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 62, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "hash_string", 0) < (0)) __PYX_ERR(0, 62, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("hash_string", 1, 1, 1, i); __PYX_ERR(0, 62, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 62, __pyx_L3_error) + } + __pyx_v_string = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("hash_string", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 62, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.strings.hash_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_string), (&PyUnicode_Type), 1, "string", 1))) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_7strings_2hash_string(__pyx_self, __pyx_v_string); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_2hash_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("hash_string", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5spacy_7strings_hash_string(__pyx_v_string, 1); if (unlikely(__pyx_t_1 == ((__pyx_t_5spacy_8typedefs_hash_t)0))) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.strings.hash_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":67 + * + * + * cdef hash_t hash_utf8(char* utf8_string, int length) nogil: # <<<<<<<<<<<<<< + * return hash64(utf8_string, length, 1) + * +*/ + +static __pyx_t_5spacy_8typedefs_hash_t __pyx_f_5spacy_7strings_hash_utf8(char *__pyx_v_utf8_string, int __pyx_v_length) { + __pyx_t_5spacy_8typedefs_hash_t __pyx_r; + + /* "spacy/strings.pyx":68 + * + * cdef hash_t hash_utf8(char* utf8_string, int length) nogil: + * return hash64(utf8_string, length, 1) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_f_10murmurhash_4mrmr_hash64(__pyx_v_utf8_string, __pyx_v_length, 1); + goto __pyx_L0; + + /* "spacy/strings.pyx":67 + * + * + * cdef hash_t hash_utf8(char* utf8_string, int length) nogil: # <<<<<<<<<<<<<< + * return hash64(utf8_string, length, 1) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/strings.pyx":71 + * + * + * cdef uint32_t hash32_utf8(char* utf8_string, int length) nogil: # <<<<<<<<<<<<<< + * return hash32(utf8_string, length, 1) + * +*/ + +static uint32_t __pyx_f_5spacy_7strings_hash32_utf8(char *__pyx_v_utf8_string, int __pyx_v_length) { + uint32_t __pyx_r; + + /* "spacy/strings.pyx":72 + * + * cdef uint32_t hash32_utf8(char* utf8_string, int length) nogil: + * return hash32(utf8_string, length, 1) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_f_10murmurhash_4mrmr_hash32(__pyx_v_utf8_string, __pyx_v_length, 1); + goto __pyx_L0; + + /* "spacy/strings.pyx":71 + * + * + * cdef uint32_t hash32_utf8(char* utf8_string, int length) nogil: # <<<<<<<<<<<<<< + * return hash32(utf8_string, length, 1) + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/strings.pyx":75 + * + * + * cdef str decode_Utf8Str(const Utf8Str* string): # <<<<<<<<<<<<<< + * cdef int i, length + * if string.s[0] < sizeof(string.s) and string.s[0] != 0: +*/ + +static PyObject *__pyx_f_5spacy_7strings_decode_Utf8Str(__pyx_t_5spacy_7strings_Utf8Str const *__pyx_v_string) { + int __pyx_v_i; + int __pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("decode_Utf8Str", 0); + + /* "spacy/strings.pyx":77 + * cdef str decode_Utf8Str(const Utf8Str* string): + * cdef int i, length + * if string.s[0] < sizeof(string.s) and string.s[0] != 0: # <<<<<<<<<<<<<< + * return string.s[1:string.s[0]+1].decode("utf8") + * elif string.p[0] < 255: +*/ + __pyx_t_2 = ((__pyx_v_string->s[0]) < (sizeof(__pyx_v_string->s))); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_string->s[0]) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/strings.pyx":78 + * cdef int i, length + * if string.s[0] < sizeof(string.s) and string.s[0] != 0: + * return string.s[1:string.s[0]+1].decode("utf8") # <<<<<<<<<<<<<< + * elif string.p[0] < 255: + * return string.p[1:string.p[0]+1].decode("utf8") +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_decode_c_string(((char const *)__pyx_v_string->s), 1, ((__pyx_v_string->s[0]) + 1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/strings.pyx":77 + * cdef str decode_Utf8Str(const Utf8Str* string): + * cdef int i, length + * if string.s[0] < sizeof(string.s) and string.s[0] != 0: # <<<<<<<<<<<<<< + * return string.s[1:string.s[0]+1].decode("utf8") + * elif string.p[0] < 255: +*/ + } + + /* "spacy/strings.pyx":79 + * if string.s[0] < sizeof(string.s) and string.s[0] != 0: + * return string.s[1:string.s[0]+1].decode("utf8") + * elif string.p[0] < 255: # <<<<<<<<<<<<<< + * return string.p[1:string.p[0]+1].decode("utf8") + * else: +*/ + __pyx_t_1 = ((__pyx_v_string->p[0]) < 0xFF); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":80 + * return string.s[1:string.s[0]+1].decode("utf8") + * elif string.p[0] < 255: + * return string.p[1:string.p[0]+1].decode("utf8") # <<<<<<<<<<<<<< + * else: + * i = 0 +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_decode_c_string(((char const *)__pyx_v_string->p), 1, ((__pyx_v_string->p[0]) + 1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/strings.pyx":79 + * if string.s[0] < sizeof(string.s) and string.s[0] != 0: + * return string.s[1:string.s[0]+1].decode("utf8") + * elif string.p[0] < 255: # <<<<<<<<<<<<<< + * return string.p[1:string.p[0]+1].decode("utf8") + * else: +*/ + } + + /* "spacy/strings.pyx":82 + * return string.p[1:string.p[0]+1].decode("utf8") + * else: + * i = 0 # <<<<<<<<<<<<<< + * length = 0 + * while string.p[i] == 255: +*/ + /*else*/ { + __pyx_v_i = 0; + + /* "spacy/strings.pyx":83 + * else: + * i = 0 + * length = 0 # <<<<<<<<<<<<<< + * while string.p[i] == 255: + * i += 1 +*/ + __pyx_v_length = 0; + + /* "spacy/strings.pyx":84 + * i = 0 + * length = 0 + * while string.p[i] == 255: # <<<<<<<<<<<<<< + * i += 1 + * length += 255 +*/ + while (1) { + __pyx_t_1 = ((__pyx_v_string->p[__pyx_v_i]) == 0xFF); + if (!__pyx_t_1) break; + + /* "spacy/strings.pyx":85 + * length = 0 + * while string.p[i] == 255: + * i += 1 # <<<<<<<<<<<<<< + * length += 255 + * length += string.p[i] +*/ + __pyx_v_i = (__pyx_v_i + 1); + + /* "spacy/strings.pyx":86 + * while string.p[i] == 255: + * i += 1 + * length += 255 # <<<<<<<<<<<<<< + * length += string.p[i] + * i += 1 +*/ + __pyx_v_length = (__pyx_v_length + 0xFF); + } + + /* "spacy/strings.pyx":87 + * i += 1 + * length += 255 + * length += string.p[i] # <<<<<<<<<<<<<< + * i += 1 + * return string.p[i:length + i].decode("utf8") +*/ + __pyx_v_length = (__pyx_v_length + (__pyx_v_string->p[__pyx_v_i])); + + /* "spacy/strings.pyx":88 + * length += 255 + * length += string.p[i] + * i += 1 # <<<<<<<<<<<<<< + * return string.p[i:length + i].decode("utf8") + * +*/ + __pyx_v_i = (__pyx_v_i + 1); + + /* "spacy/strings.pyx":89 + * length += string.p[i] + * i += 1 + * return string.p[i:length + i].decode("utf8") # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_decode_c_string(((char const *)__pyx_v_string->p), __pyx_v_i, (__pyx_v_length + __pyx_v_i), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + } + + /* "spacy/strings.pyx":75 + * + * + * cdef str decode_Utf8Str(const Utf8Str* string): # <<<<<<<<<<<<<< + * cdef int i, length + * if string.s[0] < sizeof(string.s) and string.s[0] != 0: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.strings.decode_Utf8Str", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":92 + * + * + * cdef Utf8Str* _allocate(Pool mem, const unsigned char* chars, uint32_t length) except *: # <<<<<<<<<<<<<< + * cdef int n_length_bytes + * cdef int i +*/ + +static __pyx_t_5spacy_7strings_Utf8Str *__pyx_f_5spacy_7strings__allocate(struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, unsigned char const *__pyx_v_chars, uint32_t __pyx_v_length) { + int __pyx_v_n_length_bytes; + int __pyx_v_i; + __pyx_t_5spacy_7strings_Utf8Str *__pyx_v_string; + __pyx_t_5spacy_7strings_Utf8Str *__pyx_r; + void *__pyx_t_1; + int __pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "spacy/strings.pyx":95 + * cdef int n_length_bytes + * cdef int i + * cdef Utf8Str* string = mem.alloc(1, sizeof(Utf8Str)) # <<<<<<<<<<<<<< + * if length < sizeof(string.s): + * string.s[0] = length +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, 1, (sizeof(__pyx_t_5spacy_7strings_Utf8Str))); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_v_string = ((__pyx_t_5spacy_7strings_Utf8Str *)__pyx_t_1); + + /* "spacy/strings.pyx":96 + * cdef int i + * cdef Utf8Str* string = mem.alloc(1, sizeof(Utf8Str)) + * if length < sizeof(string.s): # <<<<<<<<<<<<<< + * string.s[0] = length + * memcpy(&string.s[1], chars, length) +*/ + __pyx_t_2 = (__pyx_v_length < (sizeof(__pyx_v_string->s))); + if (__pyx_t_2) { + + /* "spacy/strings.pyx":97 + * cdef Utf8Str* string = mem.alloc(1, sizeof(Utf8Str)) + * if length < sizeof(string.s): + * string.s[0] = length # <<<<<<<<<<<<<< + * memcpy(&string.s[1], chars, length) + * return string +*/ + (__pyx_v_string->s[0]) = ((unsigned char)__pyx_v_length); + + /* "spacy/strings.pyx":98 + * if length < sizeof(string.s): + * string.s[0] = length + * memcpy(&string.s[1], chars, length) # <<<<<<<<<<<<<< + * return string + * elif length < 255: +*/ + (void)(memcpy((&(__pyx_v_string->s[1])), __pyx_v_chars, __pyx_v_length)); + + /* "spacy/strings.pyx":99 + * string.s[0] = length + * memcpy(&string.s[1], chars, length) + * return string # <<<<<<<<<<<<<< + * elif length < 255: + * string.p = mem.alloc(length + 1, sizeof(unsigned char)) +*/ + __pyx_r = __pyx_v_string; + goto __pyx_L0; + + /* "spacy/strings.pyx":96 + * cdef int i + * cdef Utf8Str* string = mem.alloc(1, sizeof(Utf8Str)) + * if length < sizeof(string.s): # <<<<<<<<<<<<<< + * string.s[0] = length + * memcpy(&string.s[1], chars, length) +*/ + } + + /* "spacy/strings.pyx":100 + * memcpy(&string.s[1], chars, length) + * return string + * elif length < 255: # <<<<<<<<<<<<<< + * string.p = mem.alloc(length + 1, sizeof(unsigned char)) + * string.p[0] = length +*/ + __pyx_t_2 = (__pyx_v_length < 0xFF); + if (__pyx_t_2) { + + /* "spacy/strings.pyx":101 + * return string + * elif length < 255: + * string.p = mem.alloc(length + 1, sizeof(unsigned char)) # <<<<<<<<<<<<<< + * string.p[0] = length + * memcpy(&string.p[1], chars, length) +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, (__pyx_v_length + 1), (sizeof(unsigned char))); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_v_string->p = ((unsigned char *)__pyx_t_1); + + /* "spacy/strings.pyx":102 + * elif length < 255: + * string.p = mem.alloc(length + 1, sizeof(unsigned char)) + * string.p[0] = length # <<<<<<<<<<<<<< + * memcpy(&string.p[1], chars, length) + * return string +*/ + (__pyx_v_string->p[0]) = __pyx_v_length; + + /* "spacy/strings.pyx":103 + * string.p = mem.alloc(length + 1, sizeof(unsigned char)) + * string.p[0] = length + * memcpy(&string.p[1], chars, length) # <<<<<<<<<<<<<< + * return string + * else: +*/ + (void)(memcpy((&(__pyx_v_string->p[1])), __pyx_v_chars, __pyx_v_length)); + + /* "spacy/strings.pyx":104 + * string.p[0] = length + * memcpy(&string.p[1], chars, length) + * return string # <<<<<<<<<<<<<< + * else: + * i = 0 +*/ + __pyx_r = __pyx_v_string; + goto __pyx_L0; + + /* "spacy/strings.pyx":100 + * memcpy(&string.s[1], chars, length) + * return string + * elif length < 255: # <<<<<<<<<<<<<< + * string.p = mem.alloc(length + 1, sizeof(unsigned char)) + * string.p[0] = length +*/ + } + + /* "spacy/strings.pyx":106 + * return string + * else: + * i = 0 # <<<<<<<<<<<<<< + * n_length_bytes = (length // 255) + 1 + * string.p = mem.alloc(length + n_length_bytes, sizeof(unsigned char)) +*/ + /*else*/ { + __pyx_v_i = 0; + + /* "spacy/strings.pyx":107 + * else: + * i = 0 + * n_length_bytes = (length // 255) + 1 # <<<<<<<<<<<<<< + * string.p = mem.alloc(length + n_length_bytes, sizeof(unsigned char)) + * for i in range(n_length_bytes-1): +*/ + __pyx_v_n_length_bytes = (__Pyx_div_long(__pyx_v_length, 0xFF, 1) + 1); + + /* "spacy/strings.pyx":108 + * i = 0 + * n_length_bytes = (length // 255) + 1 + * string.p = mem.alloc(length + n_length_bytes, sizeof(unsigned char)) # <<<<<<<<<<<<<< + * for i in range(n_length_bytes-1): + * string.p[i] = 255 +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, (__pyx_v_length + __pyx_v_n_length_bytes), (sizeof(unsigned char))); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_v_string->p = ((unsigned char *)__pyx_t_1); + + /* "spacy/strings.pyx":109 + * n_length_bytes = (length // 255) + 1 + * string.p = mem.alloc(length + n_length_bytes, sizeof(unsigned char)) + * for i in range(n_length_bytes-1): # <<<<<<<<<<<<<< + * string.p[i] = 255 + * string.p[n_length_bytes-1] = length % 255 +*/ + __pyx_t_3 = (__pyx_v_n_length_bytes - 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "spacy/strings.pyx":110 + * string.p = mem.alloc(length + n_length_bytes, sizeof(unsigned char)) + * for i in range(n_length_bytes-1): + * string.p[i] = 255 # <<<<<<<<<<<<<< + * string.p[n_length_bytes-1] = length % 255 + * memcpy(&string.p[n_length_bytes], chars, length) +*/ + (__pyx_v_string->p[__pyx_v_i]) = 0xFF; + } + + /* "spacy/strings.pyx":111 + * for i in range(n_length_bytes-1): + * string.p[i] = 255 + * string.p[n_length_bytes-1] = length % 255 # <<<<<<<<<<<<<< + * memcpy(&string.p[n_length_bytes], chars, length) + * return string +*/ + (__pyx_v_string->p[(__pyx_v_n_length_bytes - 1)]) = __Pyx_mod_long(__pyx_v_length, 0xFF, 1); + + /* "spacy/strings.pyx":112 + * string.p[i] = 255 + * string.p[n_length_bytes-1] = length % 255 + * memcpy(&string.p[n_length_bytes], chars, length) # <<<<<<<<<<<<<< + * return string + * +*/ + (void)(memcpy((&(__pyx_v_string->p[__pyx_v_n_length_bytes])), __pyx_v_chars, __pyx_v_length)); + + /* "spacy/strings.pyx":113 + * string.p[n_length_bytes-1] = length % 255 + * memcpy(&string.p[n_length_bytes], chars, length) + * return string # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_string; + goto __pyx_L0; + } + + /* "spacy/strings.pyx":92 + * + * + * cdef Utf8Str* _allocate(Pool mem, const unsigned char* chars, uint32_t length) except *: # <<<<<<<<<<<<<< + * cdef int n_length_bytes + * cdef int i +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.strings._allocate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/strings.pyx":121 + * DOCS: https://spacy.io/api/stringstore + * """ + * def __init__(self, strings=None, freeze=False): # <<<<<<<<<<<<<< + * """Create the StringStore. + * +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_7strings_11StringStore_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore___init__, "Create the StringStore.\n\n strings (iterable): A sequence of unicode strings to add to the store.\n "); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_7strings_11StringStore___init__; +#endif +static int __pyx_pw_5spacy_7strings_11StringStore_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_strings = 0; + CYTHON_UNUSED PyObject *__pyx_v_freeze = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_strings,&__pyx_mstate_global->__pyx_n_u_freeze,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 121, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 121, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 121, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 121, __pyx_L3_error) + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False)); + } else { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 121, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 121, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False)); + } + __pyx_v_strings = values[0]; + __pyx_v_freeze = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 121, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.strings.StringStore.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore___init__(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), __pyx_v_strings, __pyx_v_freeze); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7strings_11StringStore___init__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_strings, CYTHON_UNUSED PyObject *__pyx_v_freeze) { + PyObject *__pyx_v_string = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/strings.pyx":126 + * strings (iterable): A sequence of unicode strings to add to the store. + * """ + * self.mem = Pool() # <<<<<<<<<<<<<< + * self._non_temp_mem = self.mem + * self._map = PreshMap() +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->mem); + __Pyx_DECREF((PyObject *)__pyx_v_self->mem); + __pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":127 + * """ + * self.mem = Pool() + * self._non_temp_mem = self.mem # <<<<<<<<<<<<<< + * self._map = PreshMap() + * if strings is not None: +*/ + __pyx_t_1 = ((PyObject *)__pyx_v_self->mem); + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_non_temp_mem); + __Pyx_DECREF((PyObject *)__pyx_v_self->_non_temp_mem); + __pyx_v_self->_non_temp_mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":128 + * self.mem = Pool() + * self._non_temp_mem = self.mem + * self._map = PreshMap() # <<<<<<<<<<<<<< + * if strings is not None: + * for string in strings: +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_7preshed_4maps_PreshMap, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_map); + __Pyx_DECREF((PyObject *)__pyx_v_self->_map); + __pyx_v_self->_map = ((struct __pyx_obj_7preshed_4maps_PreshMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":129 + * self._non_temp_mem = self.mem + * self._map = PreshMap() + * if strings is not None: # <<<<<<<<<<<<<< + * for string in strings: + * self.add(string, allow_transient=False) +*/ + __pyx_t_4 = (__pyx_v_strings != Py_None); + if (__pyx_t_4) { + + /* "spacy/strings.pyx":130 + * self._map = PreshMap() + * if strings is not None: + * for string in strings: # <<<<<<<<<<<<<< + * self.add(string, allow_transient=False) + * +*/ + if (likely(PyList_CheckExact(__pyx_v_strings)) || PyTuple_CheckExact(__pyx_v_strings)) { + __pyx_t_1 = __pyx_v_strings; __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_strings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 130, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 130, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 130, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_5); + #endif + ++__pyx_t_5; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_6(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 130, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_string, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/strings.pyx":131 + * if strings is not None: + * for string in strings: + * self.add(string, allow_transient=False) # <<<<<<<<<<<<<< + * + * def __getitem__(self, object string_or_id): +*/ + __pyx_t_7 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_v_string}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_False, __pyx_t_8, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":130 + * self._map = PreshMap() + * if strings is not None: + * for string in strings: # <<<<<<<<<<<<<< + * self.add(string, allow_transient=False) + * +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/strings.pyx":129 + * self._non_temp_mem = self.mem + * self._map = PreshMap() + * if strings is not None: # <<<<<<<<<<<<<< + * for string in strings: + * self.add(string, allow_transient=False) +*/ + } + + /* "spacy/strings.pyx":121 + * DOCS: https://spacy.io/api/stringstore + * """ + * def __init__(self, strings=None, freeze=False): # <<<<<<<<<<<<<< + * """Create the StringStore. + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.strings.StringStore.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_string); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":133 + * self.add(string, allow_transient=False) + * + * def __getitem__(self, object string_or_id): # <<<<<<<<<<<<<< + * """Retrieve a string from a given hash, or vice versa. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_string_or_id); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_2__getitem__, "StringStore.__getitem__(self, string_or_id)\n\nRetrieve a string from a given hash, or vice versa.\n\nstring_or_id (bytes, str or uint64): The value to encode.\nReturns (str / uint64): The value to be retrieved."); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_7strings_11StringStore_2__getitem__; +#endif +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_string_or_id) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_2__getitem__(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), ((PyObject *)__pyx_v_string_or_id)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_2__getitem__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_string_or_id) { + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_str_hash; + __pyx_t_5spacy_7strings_Utf8Str *__pyx_v_utf8str; + PyObject *__pyx_v_symbol = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_8; + char *__pyx_t_9; + void *__pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + __pyx_t_7preshed_4maps_key_t __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "spacy/strings.pyx":140 + * """ + * cdef hash_t str_hash + * cdef Utf8Str* utf8str = NULL # <<<<<<<<<<<<<< + * + * if isinstance(string_or_id, str): +*/ + __pyx_v_utf8str = NULL; + + /* "spacy/strings.pyx":142 + * cdef Utf8Str* utf8str = NULL + * + * if isinstance(string_or_id, str): # <<<<<<<<<<<<<< + * if len(string_or_id) == 0: + * return 0 +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_string_or_id); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":143 + * + * if isinstance(string_or_id, str): + * if len(string_or_id) == 0: # <<<<<<<<<<<<<< + * return 0 + * +*/ + __pyx_t_2 = PyObject_Length(__pyx_v_string_or_id); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_2 == 0); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":144 + * if isinstance(string_or_id, str): + * if len(string_or_id) == 0: + * return 0 # <<<<<<<<<<<<<< + * + * # Return early if the string is found in the symbols LUT. +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_r = __pyx_mstate_global->__pyx_int_0; + goto __pyx_L0; + + /* "spacy/strings.pyx":143 + * + * if isinstance(string_or_id, str): + * if len(string_or_id) == 0: # <<<<<<<<<<<<<< + * return 0 + * +*/ + } + + /* "spacy/strings.pyx":147 + * + * # Return early if the string is found in the symbols LUT. + * symbol = SYMBOLS_BY_STR.get(string_or_id, None) # <<<<<<<<<<<<<< + * if symbol is not None: + * return symbol +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_SYMBOLS_BY_STR); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_string_or_id, Py_None}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_symbol = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/strings.pyx":148 + * # Return early if the string is found in the symbols LUT. + * symbol = SYMBOLS_BY_STR.get(string_or_id, None) + * if symbol is not None: # <<<<<<<<<<<<<< + * return symbol + * else: +*/ + __pyx_t_1 = (__pyx_v_symbol != Py_None); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":149 + * symbol = SYMBOLS_BY_STR.get(string_or_id, None) + * if symbol is not None: + * return symbol # <<<<<<<<<<<<<< + * else: + * return hash_string(string_or_id) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_symbol); + __pyx_r = __pyx_v_symbol; + goto __pyx_L0; + + /* "spacy/strings.pyx":148 + * # Return early if the string is found in the symbols LUT. + * symbol = SYMBOLS_BY_STR.get(string_or_id, None) + * if symbol is not None: # <<<<<<<<<<<<<< + * return symbol + * else: +*/ + } + + /* "spacy/strings.pyx":151 + * return symbol + * else: + * return hash_string(string_or_id) # <<<<<<<<<<<<<< + * elif isinstance(string_or_id, bytes): + * return hash_utf8(string_or_id, len(string_or_id)) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __pyx_v_string_or_id; + __Pyx_INCREF(__pyx_t_3); + if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_3))) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_8 = __pyx_f_5spacy_7strings_hash_string(((PyObject*)__pyx_t_3), 0); if (unlikely(__pyx_t_8 == ((__pyx_t_5spacy_8typedefs_hash_t)0))) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyLong_From_uint64_t(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + + /* "spacy/strings.pyx":142 + * cdef Utf8Str* utf8str = NULL + * + * if isinstance(string_or_id, str): # <<<<<<<<<<<<<< + * if len(string_or_id) == 0: + * return 0 +*/ + } + + /* "spacy/strings.pyx":152 + * else: + * return hash_string(string_or_id) + * elif isinstance(string_or_id, bytes): # <<<<<<<<<<<<<< + * return hash_utf8(string_or_id, len(string_or_id)) + * elif _try_coerce_to_hash(string_or_id, &str_hash): +*/ + __pyx_t_1 = PyBytes_Check(__pyx_v_string_or_id); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":153 + * return hash_string(string_or_id) + * elif isinstance(string_or_id, bytes): + * return hash_utf8(string_or_id, len(string_or_id)) # <<<<<<<<<<<<<< + * elif _try_coerce_to_hash(string_or_id, &str_hash): + * if str_hash == 0: +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_9 = __Pyx_PyObject_AsWritableString(__pyx_v_string_or_id); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_string_or_id); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_8 = __pyx_f_5spacy_7strings_hash_utf8(__pyx_t_9, __pyx_t_2); if (unlikely(__pyx_t_8 == ((__pyx_t_5spacy_8typedefs_hash_t)-1LL) && PyErr_Occurred())) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyLong_From_uint64_t(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/strings.pyx":152 + * else: + * return hash_string(string_or_id) + * elif isinstance(string_or_id, bytes): # <<<<<<<<<<<<<< + * return hash_utf8(string_or_id, len(string_or_id)) + * elif _try_coerce_to_hash(string_or_id, &str_hash): +*/ + } + + /* "spacy/strings.pyx":154 + * elif isinstance(string_or_id, bytes): + * return hash_utf8(string_or_id, len(string_or_id)) + * elif _try_coerce_to_hash(string_or_id, &str_hash): # <<<<<<<<<<<<<< + * if str_hash == 0: + * return "" +*/ + __pyx_t_1 = __pyx_f_5spacy_7strings__try_coerce_to_hash(__pyx_v_string_or_id, (&__pyx_v_str_hash)); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/strings.pyx":155 + * return hash_utf8(string_or_id, len(string_or_id)) + * elif _try_coerce_to_hash(string_or_id, &str_hash): + * if str_hash == 0: # <<<<<<<<<<<<<< + * return "" + * elif str_hash < len(SYMBOLS_BY_INT): +*/ + __pyx_t_1 = (__pyx_v_str_hash == 0); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":156 + * elif _try_coerce_to_hash(string_or_id, &str_hash): + * if str_hash == 0: + * return "" # <<<<<<<<<<<<<< + * elif str_hash < len(SYMBOLS_BY_INT): + * return SYMBOLS_BY_INT[str_hash] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_); + __pyx_r = __pyx_mstate_global->__pyx_kp_u_; + goto __pyx_L0; + + /* "spacy/strings.pyx":155 + * return hash_utf8(string_or_id, len(string_or_id)) + * elif _try_coerce_to_hash(string_or_id, &str_hash): + * if str_hash == 0: # <<<<<<<<<<<<<< + * return "" + * elif str_hash < len(SYMBOLS_BY_INT): +*/ + } + + /* "spacy/strings.pyx":157 + * if str_hash == 0: + * return "" + * elif str_hash < len(SYMBOLS_BY_INT): # <<<<<<<<<<<<<< + * return SYMBOLS_BY_INT[str_hash] + * else: +*/ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SYMBOLS_BY_INT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = (__pyx_v_str_hash < __pyx_t_2); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":158 + * return "" + * elif str_hash < len(SYMBOLS_BY_INT): + * return SYMBOLS_BY_INT[str_hash] # <<<<<<<<<<<<<< + * else: + * utf8str = self._map.get(str_hash) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SYMBOLS_BY_INT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_str_hash, __pyx_t_5spacy_8typedefs_hash_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "spacy/strings.pyx":157 + * if str_hash == 0: + * return "" + * elif str_hash < len(SYMBOLS_BY_INT): # <<<<<<<<<<<<<< + * return SYMBOLS_BY_INT[str_hash] + * else: +*/ + } + + /* "spacy/strings.pyx":160 + * return SYMBOLS_BY_INT[str_hash] + * else: + * utf8str = self._map.get(str_hash) # <<<<<<<<<<<<<< + * if utf8str is NULL: + * raise KeyError(Errors.E018.format(hash_value=string_or_id)) +*/ + /*else*/ { + __pyx_t_10 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_map->__pyx_vtab)->get(__pyx_v_self->_map, __pyx_v_str_hash); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_v_utf8str = ((__pyx_t_5spacy_7strings_Utf8Str *)__pyx_t_10); + + /* "spacy/strings.pyx":161 + * else: + * utf8str = self._map.get(str_hash) + * if utf8str is NULL: # <<<<<<<<<<<<<< + * raise KeyError(Errors.E018.format(hash_value=string_or_id)) + * else: +*/ + __pyx_t_1 = (__pyx_v_utf8str == NULL); + if (unlikely(__pyx_t_1)) { + + /* "spacy/strings.pyx":162 + * utf8str = self._map.get(str_hash) + * if utf8str is NULL: + * raise KeyError(Errors.E018.format(hash_value=string_or_id)) # <<<<<<<<<<<<<< + * else: + * return decode_Utf8Str(utf8str) +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_E018); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_5 = __pyx_t_12; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, NULL}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_hash_value, __pyx_v_string_or_id, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_7 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_KeyError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 162, __pyx_L1_error) + + /* "spacy/strings.pyx":161 + * else: + * utf8str = self._map.get(str_hash) + * if utf8str is NULL: # <<<<<<<<<<<<<< + * raise KeyError(Errors.E018.format(hash_value=string_or_id)) + * else: +*/ + } + + /* "spacy/strings.pyx":164 + * raise KeyError(Errors.E018.format(hash_value=string_or_id)) + * else: + * return decode_Utf8Str(utf8str) # <<<<<<<<<<<<<< + * else: + * # TODO: Raise an error instead +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = __pyx_f_5spacy_7strings_decode_Utf8Str(__pyx_v_utf8str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + } + } + + /* "spacy/strings.pyx":154 + * elif isinstance(string_or_id, bytes): + * return hash_utf8(string_or_id, len(string_or_id)) + * elif _try_coerce_to_hash(string_or_id, &str_hash): # <<<<<<<<<<<<<< + * if str_hash == 0: + * return "" +*/ + } + + /* "spacy/strings.pyx":167 + * else: + * # TODO: Raise an error instead + * utf8str = self._map.get(string_or_id) # <<<<<<<<<<<<<< + * if utf8str is NULL: + * raise KeyError(Errors.E018.format(hash_value=string_or_id)) +*/ + /*else*/ { + __pyx_t_13 = __Pyx_PyLong_As_uint64_t(__pyx_v_string_or_id); if (unlikely((__pyx_t_13 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_10 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_map->__pyx_vtab)->get(__pyx_v_self->_map, __pyx_t_13); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_v_utf8str = ((__pyx_t_5spacy_7strings_Utf8Str *)__pyx_t_10); + + /* "spacy/strings.pyx":168 + * # TODO: Raise an error instead + * utf8str = self._map.get(string_or_id) + * if utf8str is NULL: # <<<<<<<<<<<<<< + * raise KeyError(Errors.E018.format(hash_value=string_or_id)) + * else: +*/ + __pyx_t_1 = (__pyx_v_utf8str == NULL); + if (unlikely(__pyx_t_1)) { + + /* "spacy/strings.pyx":169 + * utf8str = self._map.get(string_or_id) + * if utf8str is NULL: + * raise KeyError(Errors.E018.format(hash_value=string_or_id)) # <<<<<<<<<<<<<< + * else: + * return decode_Utf8Str(utf8str) +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_E018); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_12 = __pyx_t_5; + __Pyx_INCREF(__pyx_t_12); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_12, NULL}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_hash_value, __pyx_v_string_or_id, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_7 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_KeyError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 169, __pyx_L1_error) + + /* "spacy/strings.pyx":168 + * # TODO: Raise an error instead + * utf8str = self._map.get(string_or_id) + * if utf8str is NULL: # <<<<<<<<<<<<<< + * raise KeyError(Errors.E018.format(hash_value=string_or_id)) + * else: +*/ + } + + /* "spacy/strings.pyx":171 + * raise KeyError(Errors.E018.format(hash_value=string_or_id)) + * else: + * return decode_Utf8Str(utf8str) # <<<<<<<<<<<<<< + * + * def as_int(self, key): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = __pyx_f_5spacy_7strings_decode_Utf8Str(__pyx_v_utf8str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + } + } + + /* "spacy/strings.pyx":133 + * self.add(string, allow_transient=False) + * + * def __getitem__(self, object string_or_id): # <<<<<<<<<<<<<< + * """Retrieve a string from a given hash, or vice versa. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("spacy.strings.StringStore.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_symbol); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":173 + * return decode_Utf8Str(utf8str) + * + * def as_int(self, key): # <<<<<<<<<<<<<< + * """If key is an int, return it; otherwise, get the int value.""" + * if not isinstance(key, str): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_5as_int(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_4as_int, "StringStore.as_int(self, key)\n\nIf key is an int, return it; otherwise, get the int value."); +static PyMethodDef __pyx_mdef_5spacy_7strings_11StringStore_5as_int = {"as_int", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_5as_int, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_4as_int}; +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_5as_int(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_key = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("as_int (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 173, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 173, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "as_int", 0) < (0)) __PYX_ERR(0, 173, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("as_int", 1, 1, 1, i); __PYX_ERR(0, 173, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 173, __pyx_L3_error) + } + __pyx_v_key = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("as_int", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 173, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.strings.StringStore.as_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_4as_int(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), __pyx_v_key); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_4as_int(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("as_int", 0); + + /* "spacy/strings.pyx":175 + * def as_int(self, key): + * """If key is an int, return it; otherwise, get the int value.""" + * if not isinstance(key, str): # <<<<<<<<<<<<<< + * return key + * else: +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "spacy/strings.pyx":176 + * """If key is an int, return it; otherwise, get the int value.""" + * if not isinstance(key, str): + * return key # <<<<<<<<<<<<<< + * else: + * return self[key] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_key); + __pyx_r = __pyx_v_key; + goto __pyx_L0; + + /* "spacy/strings.pyx":175 + * def as_int(self, key): + * """If key is an int, return it; otherwise, get the int value.""" + * if not isinstance(key, str): # <<<<<<<<<<<<<< + * return key + * else: +*/ + } + + /* "spacy/strings.pyx":178 + * return key + * else: + * return self[key] # <<<<<<<<<<<<<< + * + * def as_string(self, key): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + + /* "spacy/strings.pyx":173 + * return decode_Utf8Str(utf8str) + * + * def as_int(self, key): # <<<<<<<<<<<<<< + * """If key is an int, return it; otherwise, get the int value.""" + * if not isinstance(key, str): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.strings.StringStore.as_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":180 + * return self[key] + * + * def as_string(self, key): # <<<<<<<<<<<<<< + * """If key is a string, return it; otherwise, get the string value.""" + * if isinstance(key, str): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_7as_string(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_6as_string, "StringStore.as_string(self, key)\n\nIf key is a string, return it; otherwise, get the string value."); +static PyMethodDef __pyx_mdef_5spacy_7strings_11StringStore_7as_string = {"as_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_7as_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_6as_string}; +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_7as_string(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_key = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("as_string (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 180, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 180, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "as_string", 0) < (0)) __PYX_ERR(0, 180, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("as_string", 1, 1, 1, i); __PYX_ERR(0, 180, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 180, __pyx_L3_error) + } + __pyx_v_key = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("as_string", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 180, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.strings.StringStore.as_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_6as_string(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), __pyx_v_key); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_6as_string(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("as_string", 0); + + /* "spacy/strings.pyx":182 + * def as_string(self, key): + * """If key is a string, return it; otherwise, get the string value.""" + * if isinstance(key, str): # <<<<<<<<<<<<<< + * return key + * else: +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":183 + * """If key is a string, return it; otherwise, get the string value.""" + * if isinstance(key, str): + * return key # <<<<<<<<<<<<<< + * else: + * return self[key] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_key); + __pyx_r = __pyx_v_key; + goto __pyx_L0; + + /* "spacy/strings.pyx":182 + * def as_string(self, key): + * """If key is a string, return it; otherwise, get the string value.""" + * if isinstance(key, str): # <<<<<<<<<<<<<< + * return key + * else: +*/ + } + + /* "spacy/strings.pyx":185 + * return key + * else: + * return self[key] # <<<<<<<<<<<<<< + * + * def __len__(self) -> int: +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "spacy/strings.pyx":180 + * return self[key] + * + * def as_string(self, key): # <<<<<<<<<<<<<< + * """If key is a string, return it; otherwise, get the string value.""" + * if isinstance(key, str): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.strings.StringStore.as_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":187 + * return self[key] + * + * def __len__(self) -> int: # <<<<<<<<<<<<<< + * """The number of strings in the store. + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_5spacy_7strings_11StringStore_9__len__(PyObject *__pyx_v_self); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_8__len__, "StringStore.__len__(self) -> int\n\nThe number of strings in the store.\n\nRETURNS (int): The number of strings in the store."); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_7strings_11StringStore_8__len__; +#endif +static Py_ssize_t __pyx_pw_5spacy_7strings_11StringStore_9__len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_8__len__(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_pf_5spacy_7strings_11StringStore_8__len__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self) { + Py_ssize_t __pyx_r; + + /* "spacy/strings.pyx":192 + * RETURNS (int): The number of strings in the store. + * """ + * return self.keys.size() + self._transient_keys.size() # <<<<<<<<<<<<<< + * + * @contextmanager +*/ + __pyx_r = (__pyx_v_self->keys.size() + __pyx_v_self->_transient_keys.size()); + goto __pyx_L0; + + /* "spacy/strings.pyx":187 + * return self[key] + * + * def __len__(self) -> int: # <<<<<<<<<<<<<< + * """The number of strings in the store. + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_7strings_11StringStore_12generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/strings.pyx":194 + * return self.keys.size() + self._transient_keys.size() + * + * @contextmanager # <<<<<<<<<<<<<< + * def memory_zone(self, mem: Optional[Pool] = None) -> Pool: + * """Begin a block where all resources allocated during the block will +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_11memory_zone(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_10memory_zone, "StringStore.memory_zone(self, mem: Optional[Pool] = None) -> Pool\n\nBegin a block where all resources allocated during the block will\nbe freed at the end of it. If a resources was created within the\nmemory zone block, accessing it outside the block is invalid.\nBehaviour of this invalid access is undefined. Memory zones should\nnot be nested.\n\nThe memory zone is helpful for services that need to process large\nvolumes of text with a defined memory budget."); +static PyMethodDef __pyx_mdef_5spacy_7strings_11StringStore_11memory_zone = {"memory_zone", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_11memory_zone, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_10memory_zone}; +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_11memory_zone(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_mem = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("memory_zone (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_mem,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 194, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 194, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "memory_zone", 0) < (0)) __PYX_ERR(0, 194, __pyx_L3_error) + + /* "spacy/strings.pyx":195 + * + * @contextmanager + * def memory_zone(self, mem: Optional[Pool] = None) -> Pool: # <<<<<<<<<<<<<< + * """Begin a block where all resources allocated during the block will + * be freed at the end of it. If a resources was created within the +*/ + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + } else { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 194, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_mem = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("memory_zone", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 194, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.strings.StringStore.memory_zone", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_10memory_zone(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), __pyx_v_mem); + + /* "spacy/strings.pyx":194 + * return self.keys.size() + self._transient_keys.size() + * + * @contextmanager # <<<<<<<<<<<<<< + * def memory_zone(self, mem: Optional[Pool] = None) -> Pool: + * """Begin a block where all resources allocated during the block will +*/ + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_10memory_zone(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_mem) { + struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memory_zone", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone *)__pyx_tp_new_5spacy_7strings___pyx_scope_struct__memory_zone(__pyx_mstate_global->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 194, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_mem = __pyx_v_mem; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_mem); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_mem); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_7strings_11StringStore_12generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_memory_zone, __pyx_mstate_global->__pyx_n_u_StringStore_memory_zone, __pyx_mstate_global->__pyx_n_u_spacy_strings); if (unlikely(!gen)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.strings.StringStore.memory_zone", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_7strings_11StringStore_12generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone *__pyx_cur_scope = ((struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> ::iterator __pyx_t_5; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("memory_zone", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L5_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 194, __pyx_L1_error) + } + + /* "spacy/strings.pyx":205 + * volumes of text with a defined memory budget. + * """ + * if mem is None: # <<<<<<<<<<<<<< + * mem = Pool() + * self.mem = mem +*/ + __pyx_t_1 = (__pyx_cur_scope->__pyx_v_mem == Py_None); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":206 + * """ + * if mem is None: + * mem = Pool() # <<<<<<<<<<<<<< + * self.mem = mem + * yield mem +*/ + __pyx_t_3 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + } + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_mem); + __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_mem, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/strings.pyx":205 + * volumes of text with a defined memory budget. + * """ + * if mem is None: # <<<<<<<<<<<<<< + * mem = Pool() + * self.mem = mem +*/ + } + + /* "spacy/strings.pyx":207 + * if mem is None: + * mem = Pool() + * self.mem = mem # <<<<<<<<<<<<<< + * yield mem + * for key in self._transient_keys: +*/ + __pyx_t_2 = __pyx_cur_scope->__pyx_v_mem; + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool))))) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF((PyObject *)__pyx_cur_scope->__pyx_v_self->mem); + __Pyx_DECREF((PyObject *)__pyx_cur_scope->__pyx_v_self->mem); + __pyx_cur_scope->__pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/strings.pyx":208 + * mem = Pool() + * self.mem = mem + * yield mem # <<<<<<<<<<<<<< + * for key in self._transient_keys: + * map_clear(self._map.c_map, key) +*/ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_mem); + __pyx_r = __pyx_cur_scope->__pyx_v_mem; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L5_resume_from_yield:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 208, __pyx_L1_error) + + /* "spacy/strings.pyx":209 + * self.mem = mem + * yield mem + * for key in self._transient_keys: # <<<<<<<<<<<<<< + * map_clear(self._map.c_map, key) + * self._transient_keys.clear() +*/ + __pyx_t_5 = __pyx_cur_scope->__pyx_v_self->_transient_keys.begin(); + for (; __pyx_t_5 != __pyx_cur_scope->__pyx_v_self->_transient_keys.end(); ++__pyx_t_5) { + __pyx_t_6 = *__pyx_t_5; + __pyx_cur_scope->__pyx_v_key = __pyx_t_6; + + /* "spacy/strings.pyx":210 + * yield mem + * for key in self._transient_keys: + * map_clear(self._map.c_map, key) # <<<<<<<<<<<<<< + * self._transient_keys.clear() + * self.mem = self._non_temp_mem +*/ + __pyx_f_7preshed_4maps_map_clear(__pyx_cur_scope->__pyx_v_self->_map->c_map, __pyx_cur_scope->__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 210, __pyx_L1_error) + + /* "spacy/strings.pyx":209 + * self.mem = mem + * yield mem + * for key in self._transient_keys: # <<<<<<<<<<<<<< + * map_clear(self._map.c_map, key) + * self._transient_keys.clear() +*/ + } + + /* "spacy/strings.pyx":211 + * for key in self._transient_keys: + * map_clear(self._map.c_map, key) + * self._transient_keys.clear() # <<<<<<<<<<<<<< + * self.mem = self._non_temp_mem + * +*/ + __pyx_cur_scope->__pyx_v_self->_transient_keys.clear(); + + /* "spacy/strings.pyx":212 + * map_clear(self._map.c_map, key) + * self._transient_keys.clear() + * self.mem = self._non_temp_mem # <<<<<<<<<<<<<< + * + * def add(self, string: str, allow_transient: Optional[bool] = None) -> int: +*/ + __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->_non_temp_mem); + __Pyx_INCREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF((PyObject *)__pyx_cur_scope->__pyx_v_self->mem); + __Pyx_DECREF((PyObject *)__pyx_cur_scope->__pyx_v_self->mem); + __pyx_cur_scope->__pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_2); + __pyx_t_2 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "spacy/strings.pyx":194 + * return self.keys.size() + self._transient_keys.size() + * + * @contextmanager # <<<<<<<<<<<<<< + * def memory_zone(self, mem: Optional[Pool] = None) -> Pool: + * """Begin a block where all resources allocated during the block will +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("memory_zone", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":214 + * self.mem = self._non_temp_mem + * + * def add(self, string: str, allow_transient: Optional[bool] = None) -> int: # <<<<<<<<<<<<<< + * """Add a string to the StringStore. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_14add(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_13add, "StringStore.add(self, string: str, allow_transient: Optional[bool] = None) -> int\n\nAdd a string to the StringStore.\n\nstring (str): The string to add.\nallow_transient (bool): Allow the string to be stored in the 'transient'\n map, which will be flushed at the end of the memory zone. Strings\n encountered during arbitrary text processing should be added\n with allow_transient=True, while labels and other strings used\n internally should not.\nRETURNS (uint64): The string's hash value."); +static PyMethodDef __pyx_mdef_5spacy_7strings_11StringStore_14add = {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_14add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_13add}; +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_14add(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_string = 0; + PyObject *__pyx_v_allow_transient = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_string,&__pyx_mstate_global->__pyx_n_u_allow_transient,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 214, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 214, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 214, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "add", 0) < (0)) __PYX_ERR(0, 214, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add", 0, 1, 2, i); __PYX_ERR(0, 214, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 214, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 214, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_string = values[0]; + __pyx_v_allow_transient = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 214, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.strings.StringStore.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_13add(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), __pyx_v_string, __pyx_v_allow_transient); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_13add(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_string, PyObject *__pyx_v_allow_transient) { + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_str_hash; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + char *__pyx_t_6; + Py_ssize_t __pyx_t_7; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("add", 0); + __Pyx_INCREF(__pyx_v_string); + __Pyx_INCREF(__pyx_v_allow_transient); + + /* "spacy/strings.pyx":225 + * RETURNS (uint64): The string's hash value. + * """ + * if not string: # <<<<<<<<<<<<<< + * return 0 + * if allow_transient is None: +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_string); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "spacy/strings.pyx":226 + * """ + * if not string: + * return 0 # <<<<<<<<<<<<<< + * if allow_transient is None: + * allow_transient = self.mem is not self._non_temp_mem +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_r = __pyx_mstate_global->__pyx_int_0; + goto __pyx_L0; + + /* "spacy/strings.pyx":225 + * RETURNS (uint64): The string's hash value. + * """ + * if not string: # <<<<<<<<<<<<<< + * return 0 + * if allow_transient is None: +*/ + } + + /* "spacy/strings.pyx":227 + * if not string: + * return 0 + * if allow_transient is None: # <<<<<<<<<<<<<< + * allow_transient = self.mem is not self._non_temp_mem + * cdef hash_t str_hash +*/ + __pyx_t_2 = (__pyx_v_allow_transient == Py_None); + if (__pyx_t_2) { + + /* "spacy/strings.pyx":228 + * return 0 + * if allow_transient is None: + * allow_transient = self.mem is not self._non_temp_mem # <<<<<<<<<<<<<< + * cdef hash_t str_hash + * if isinstance(string, str): +*/ + __pyx_t_2 = (__pyx_v_self->mem != __pyx_v_self->_non_temp_mem); + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF_SET(__pyx_v_allow_transient, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/strings.pyx":227 + * if not string: + * return 0 + * if allow_transient is None: # <<<<<<<<<<<<<< + * allow_transient = self.mem is not self._non_temp_mem + * cdef hash_t str_hash +*/ + } + + /* "spacy/strings.pyx":230 + * allow_transient = self.mem is not self._non_temp_mem + * cdef hash_t str_hash + * if isinstance(string, str): # <<<<<<<<<<<<<< + * if string in SYMBOLS_BY_STR: + * return SYMBOLS_BY_STR[string] +*/ + __pyx_t_2 = PyUnicode_Check(__pyx_v_string); + if (__pyx_t_2) { + + /* "spacy/strings.pyx":231 + * cdef hash_t str_hash + * if isinstance(string, str): + * if string in SYMBOLS_BY_STR: # <<<<<<<<<<<<<< + * return SYMBOLS_BY_STR[string] + * +*/ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SYMBOLS_BY_STR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_string, __pyx_t_3, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "spacy/strings.pyx":232 + * if isinstance(string, str): + * if string in SYMBOLS_BY_STR: + * return SYMBOLS_BY_STR[string] # <<<<<<<<<<<<<< + * + * string = string.encode("utf8") +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SYMBOLS_BY_STR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_string); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "spacy/strings.pyx":231 + * cdef hash_t str_hash + * if isinstance(string, str): + * if string in SYMBOLS_BY_STR: # <<<<<<<<<<<<<< + * return SYMBOLS_BY_STR[string] + * +*/ + } + + /* "spacy/strings.pyx":234 + * return SYMBOLS_BY_STR[string] + * + * string = string.encode("utf8") # <<<<<<<<<<<<<< + * str_hash = hash_utf8(string, len(string)) + * self._intern_utf8(string, len(string), &str_hash, allow_transient) +*/ + __pyx_t_3 = __pyx_v_string; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_utf8}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_string, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/strings.pyx":235 + * + * string = string.encode("utf8") + * str_hash = hash_utf8(string, len(string)) # <<<<<<<<<<<<<< + * self._intern_utf8(string, len(string), &str_hash, allow_transient) + * elif isinstance(string, bytes): +*/ + __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_string); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L1_error) + __pyx_t_7 = PyObject_Length(__pyx_v_string); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 235, __pyx_L1_error) + __pyx_t_8 = __pyx_f_5spacy_7strings_hash_utf8(__pyx_t_6, __pyx_t_7); if (unlikely(__pyx_t_8 == ((__pyx_t_5spacy_8typedefs_hash_t)-1LL) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L1_error) + __pyx_v_str_hash = __pyx_t_8; + + /* "spacy/strings.pyx":236 + * string = string.encode("utf8") + * str_hash = hash_utf8(string, len(string)) + * self._intern_utf8(string, len(string), &str_hash, allow_transient) # <<<<<<<<<<<<<< + * elif isinstance(string, bytes): + * if string in SYMBOLS_BY_STR: +*/ + __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_string); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L1_error) + __pyx_t_7 = PyObject_Length(__pyx_v_string); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 236, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_allow_transient); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L1_error) + __pyx_f_5spacy_7strings_11StringStore__intern_utf8(__pyx_v_self, __pyx_t_6, __pyx_t_7, (&__pyx_v_str_hash), __pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L1_error) + + /* "spacy/strings.pyx":230 + * allow_transient = self.mem is not self._non_temp_mem + * cdef hash_t str_hash + * if isinstance(string, str): # <<<<<<<<<<<<<< + * if string in SYMBOLS_BY_STR: + * return SYMBOLS_BY_STR[string] +*/ + goto __pyx_L5; + } + + /* "spacy/strings.pyx":237 + * str_hash = hash_utf8(string, len(string)) + * self._intern_utf8(string, len(string), &str_hash, allow_transient) + * elif isinstance(string, bytes): # <<<<<<<<<<<<<< + * if string in SYMBOLS_BY_STR: + * return SYMBOLS_BY_STR[string] +*/ + __pyx_t_2 = PyBytes_Check(__pyx_v_string); + if (likely(__pyx_t_2)) { + + /* "spacy/strings.pyx":238 + * self._intern_utf8(string, len(string), &str_hash, allow_transient) + * elif isinstance(string, bytes): + * if string in SYMBOLS_BY_STR: # <<<<<<<<<<<<<< + * return SYMBOLS_BY_STR[string] + * str_hash = hash_utf8(string, len(string)) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_SYMBOLS_BY_STR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_string, __pyx_t_4, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 238, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "spacy/strings.pyx":239 + * elif isinstance(string, bytes): + * if string in SYMBOLS_BY_STR: + * return SYMBOLS_BY_STR[string] # <<<<<<<<<<<<<< + * str_hash = hash_utf8(string, len(string)) + * self._intern_utf8(string, len(string), &str_hash, allow_transient) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_SYMBOLS_BY_STR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_v_string); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/strings.pyx":238 + * self._intern_utf8(string, len(string), &str_hash, allow_transient) + * elif isinstance(string, bytes): + * if string in SYMBOLS_BY_STR: # <<<<<<<<<<<<<< + * return SYMBOLS_BY_STR[string] + * str_hash = hash_utf8(string, len(string)) +*/ + } + + /* "spacy/strings.pyx":240 + * if string in SYMBOLS_BY_STR: + * return SYMBOLS_BY_STR[string] + * str_hash = hash_utf8(string, len(string)) # <<<<<<<<<<<<<< + * self._intern_utf8(string, len(string), &str_hash, allow_transient) + * else: +*/ + __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_string); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_7 = PyObject_Length(__pyx_v_string); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_8 = __pyx_f_5spacy_7strings_hash_utf8(__pyx_t_6, __pyx_t_7); if (unlikely(__pyx_t_8 == ((__pyx_t_5spacy_8typedefs_hash_t)-1LL) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_v_str_hash = __pyx_t_8; + + /* "spacy/strings.pyx":241 + * return SYMBOLS_BY_STR[string] + * str_hash = hash_utf8(string, len(string)) + * self._intern_utf8(string, len(string), &str_hash, allow_transient) # <<<<<<<<<<<<<< + * else: + * raise TypeError(Errors.E017.format(value_type=type(string))) +*/ + __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_string); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_7 = PyObject_Length(__pyx_v_string); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_allow_transient); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_f_5spacy_7strings_11StringStore__intern_utf8(__pyx_v_self, __pyx_t_6, __pyx_t_7, (&__pyx_v_str_hash), __pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) + + /* "spacy/strings.pyx":237 + * str_hash = hash_utf8(string, len(string)) + * self._intern_utf8(string, len(string), &str_hash, allow_transient) + * elif isinstance(string, bytes): # <<<<<<<<<<<<<< + * if string in SYMBOLS_BY_STR: + * return SYMBOLS_BY_STR[string] +*/ + goto __pyx_L5; + } + + /* "spacy/strings.pyx":243 + * self._intern_utf8(string, len(string), &str_hash, allow_transient) + * else: + * raise TypeError(Errors.E017.format(value_type=type(string))) # <<<<<<<<<<<<<< + * return str_hash + * +*/ + /*else*/ { + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_E017); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_10 = __pyx_t_12; + __Pyx_INCREF(__pyx_t_10); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_10, NULL}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_value_type, ((PyObject *)Py_TYPE(__pyx_v_string)), __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_t_9 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + } + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_9}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 243, __pyx_L1_error) + } + __pyx_L5:; + + /* "spacy/strings.pyx":244 + * else: + * raise TypeError(Errors.E017.format(value_type=type(string))) + * return str_hash # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyLong_From_uint64_t(__pyx_v_str_hash); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/strings.pyx":214 + * self.mem = self._non_temp_mem + * + * def add(self, string: str, allow_transient: Optional[bool] = None) -> int: # <<<<<<<<<<<<<< + * """Add a string to the StringStore. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("spacy.strings.StringStore.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_string); + __Pyx_XDECREF(__pyx_v_allow_transient); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":246 + * return str_hash + * + * def __len__(self): # <<<<<<<<<<<<<< + * """The number of strings in the store. + * if string in SYMBOLS_BY_STR: +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_5spacy_7strings_11StringStore_16__len__(PyObject *__pyx_v_self); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_15__len__, "StringStore.__len__(self)\n\nThe number of strings in the store.\nif string in SYMBOLS_BY_STR:\n return SYMBOLS_BY_STR[string]\nelse:\n return self._intern_str(string, allow_transient)\n\nRETURNS (int): The number of strings in the store."); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_7strings_11StringStore_15__len__; +#endif +static Py_ssize_t __pyx_pw_5spacy_7strings_11StringStore_16__len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_15__len__(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_pf_5spacy_7strings_11StringStore_15__len__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self) { + Py_ssize_t __pyx_r; + + /* "spacy/strings.pyx":255 + * RETURNS (int): The number of strings in the store. + * """ + * return self.keys.size() + self._transient_keys.size() # <<<<<<<<<<<<<< + * + * def __contains__(self, string_or_id not None): +*/ + __pyx_r = (__pyx_v_self->keys.size() + __pyx_v_self->_transient_keys.size()); + goto __pyx_L0; + + /* "spacy/strings.pyx":246 + * return str_hash + * + * def __len__(self): # <<<<<<<<<<<<<< + * """The number of strings in the store. + * if string in SYMBOLS_BY_STR: +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/strings.pyx":257 + * return self.keys.size() + self._transient_keys.size() + * + * def __contains__(self, string_or_id not None): # <<<<<<<<<<<<<< + * """Check whether a string or ID is in the store. + * +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_7strings_11StringStore_18__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_string_or_id); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_17__contains__, "StringStore.__contains__(self, string_or_id)\n\nCheck whether a string or ID is in the store.\n\nstring_or_id (str or int): The string to check.\nRETURNS (bool): Whether the store contains the string."); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_7strings_11StringStore_17__contains__; +#endif +static int __pyx_pw_5spacy_7strings_11StringStore_18__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_string_or_id) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + if (unlikely(((PyObject *)__pyx_v_string_or_id) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "string_or_id"); __PYX_ERR(0, 257, __pyx_L1_error) + } + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_17__contains__(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), ((PyObject *)__pyx_v_string_or_id)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + goto __pyx_L5_cleaned_up; + __pyx_L0:; + __pyx_L5_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7strings_11StringStore_17__contains__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_string_or_id) { + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_str_hash; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_4; + __pyx_t_7preshed_4maps_key_t __pyx_t_5; + void *__pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__contains__", 0); + + /* "spacy/strings.pyx":264 + * """ + * cdef hash_t str_hash + * if isinstance(string_or_id, str): # <<<<<<<<<<<<<< + * if len(string_or_id) == 0: + * return True +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_string_or_id); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":265 + * cdef hash_t str_hash + * if isinstance(string_or_id, str): + * if len(string_or_id) == 0: # <<<<<<<<<<<<<< + * return True + * elif string_or_id in SYMBOLS_BY_STR: +*/ + __pyx_t_2 = PyObject_Length(__pyx_v_string_or_id); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 265, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_2 == 0); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":266 + * if isinstance(string_or_id, str): + * if len(string_or_id) == 0: + * return True # <<<<<<<<<<<<<< + * elif string_or_id in SYMBOLS_BY_STR: + * return True +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/strings.pyx":265 + * cdef hash_t str_hash + * if isinstance(string_or_id, str): + * if len(string_or_id) == 0: # <<<<<<<<<<<<<< + * return True + * elif string_or_id in SYMBOLS_BY_STR: +*/ + } + + /* "spacy/strings.pyx":267 + * if len(string_or_id) == 0: + * return True + * elif string_or_id in SYMBOLS_BY_STR: # <<<<<<<<<<<<<< + * return True + * str_hash = hash_string(string_or_id) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SYMBOLS_BY_STR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_string_or_id, __pyx_t_3, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "spacy/strings.pyx":268 + * return True + * elif string_or_id in SYMBOLS_BY_STR: + * return True # <<<<<<<<<<<<<< + * str_hash = hash_string(string_or_id) + * elif _try_coerce_to_hash(string_or_id, &str_hash): +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/strings.pyx":267 + * if len(string_or_id) == 0: + * return True + * elif string_or_id in SYMBOLS_BY_STR: # <<<<<<<<<<<<<< + * return True + * str_hash = hash_string(string_or_id) +*/ + } + + /* "spacy/strings.pyx":269 + * elif string_or_id in SYMBOLS_BY_STR: + * return True + * str_hash = hash_string(string_or_id) # <<<<<<<<<<<<<< + * elif _try_coerce_to_hash(string_or_id, &str_hash): + * pass +*/ + __pyx_t_3 = __pyx_v_string_or_id; + __Pyx_INCREF(__pyx_t_3); + if (!(likely(PyUnicode_CheckExact(__pyx_t_3)) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_3))) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_4 = __pyx_f_5spacy_7strings_hash_string(((PyObject*)__pyx_t_3), 0); if (unlikely(__pyx_t_4 == ((__pyx_t_5spacy_8typedefs_hash_t)0))) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_str_hash = __pyx_t_4; + + /* "spacy/strings.pyx":264 + * """ + * cdef hash_t str_hash + * if isinstance(string_or_id, str): # <<<<<<<<<<<<<< + * if len(string_or_id) == 0: + * return True +*/ + goto __pyx_L3; + } + + /* "spacy/strings.pyx":270 + * return True + * str_hash = hash_string(string_or_id) + * elif _try_coerce_to_hash(string_or_id, &str_hash): # <<<<<<<<<<<<<< + * pass + * else: +*/ + __pyx_t_1 = __pyx_f_5spacy_7strings__try_coerce_to_hash(__pyx_v_string_or_id, (&__pyx_v_str_hash)); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error) + if (__pyx_t_1) { + goto __pyx_L3; + } + + /* "spacy/strings.pyx":274 + * else: + * # TODO: Raise an error instead + * if self._map.get(string_or_id) is not NULL: # <<<<<<<<<<<<<< + * return True + * else: +*/ + /*else*/ { + __pyx_t_5 = __Pyx_PyLong_As_uint64_t(__pyx_v_string_or_id); if (unlikely((__pyx_t_5 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_6 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_map->__pyx_vtab)->get(__pyx_v_self->_map, __pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_6 != NULL); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":275 + * # TODO: Raise an error instead + * if self._map.get(string_or_id) is not NULL: + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/strings.pyx":274 + * else: + * # TODO: Raise an error instead + * if self._map.get(string_or_id) is not NULL: # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "spacy/strings.pyx":277 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * if str_hash < len(SYMBOLS_BY_INT): + * return True +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + } + __pyx_L3:; + + /* "spacy/strings.pyx":278 + * else: + * return False + * if str_hash < len(SYMBOLS_BY_INT): # <<<<<<<<<<<<<< + * return True + * else: +*/ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SYMBOLS_BY_INT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = (__pyx_v_str_hash < __pyx_t_2); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":279 + * return False + * if str_hash < len(SYMBOLS_BY_INT): + * return True # <<<<<<<<<<<<<< + * else: + * if self._map.get(str_hash) is not NULL: +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/strings.pyx":278 + * else: + * return False + * if str_hash < len(SYMBOLS_BY_INT): # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "spacy/strings.pyx":281 + * return True + * else: + * if self._map.get(str_hash) is not NULL: # <<<<<<<<<<<<<< + * return True + * else: +*/ + /*else*/ { + __pyx_t_6 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_map->__pyx_vtab)->get(__pyx_v_self->_map, __pyx_v_str_hash); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_6 != NULL); + if (__pyx_t_1) { + + /* "spacy/strings.pyx":282 + * else: + * if self._map.get(str_hash) is not NULL: + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/strings.pyx":281 + * return True + * else: + * if self._map.get(str_hash) is not NULL: # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "spacy/strings.pyx":284 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * def __iter__(self): +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + } + + /* "spacy/strings.pyx":257 + * return self.keys.size() + self._transient_keys.size() + * + * def __contains__(self, string_or_id not None): # <<<<<<<<<<<<<< + * """Check whether a string or ID is in the store. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.strings.StringStore.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_7strings_11StringStore_21generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/strings.pyx":286 + * return False + * + * def __iter__(self): # <<<<<<<<<<<<<< + * """Iterate over the strings in the store, in order. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_20__iter__(PyObject *__pyx_v_self); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_19__iter__, "StringStore.__iter__(self)\n\nIterate over the strings in the store, in order.\n\nYIELDS (str): A string in the store."); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_7strings_11StringStore_19__iter__; +#endif +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_20__iter__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_19__iter__(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_19__iter__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self) { + struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__ *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__ *)__pyx_tp_new_5spacy_7strings___pyx_scope_struct_1___iter__(__pyx_mstate_global->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__ *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 286, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_7strings_11StringStore_21generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_StringStore___iter, __pyx_mstate_global->__pyx_n_u_spacy_strings); if (unlikely(!gen)) __PYX_ERR(0, 286, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.strings.StringStore.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_7strings_11StringStore_21generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__ *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> ::size_type __pyx_t_1; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> ::size_type __pyx_t_2; + int __pyx_t_3; + void *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + case 2: goto __pyx_L9_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 286, __pyx_L1_error) + } + + /* "spacy/strings.pyx":293 + * cdef int i + * cdef hash_t key + * for i in range(self.keys.size()): # <<<<<<<<<<<<<< + * key = self.keys[i] + * utf8str = self._map.get(key) +*/ + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->keys.size(); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_cur_scope->__pyx_v_i = __pyx_t_3; + + /* "spacy/strings.pyx":294 + * cdef hash_t key + * for i in range(self.keys.size()): + * key = self.keys[i] # <<<<<<<<<<<<<< + * utf8str = self._map.get(key) + * yield decode_Utf8Str(utf8str) +*/ + __pyx_cur_scope->__pyx_v_key = (__pyx_cur_scope->__pyx_v_self->keys[__pyx_cur_scope->__pyx_v_i]); + + /* "spacy/strings.pyx":295 + * for i in range(self.keys.size()): + * key = self.keys[i] + * utf8str = self._map.get(key) # <<<<<<<<<<<<<< + * yield decode_Utf8Str(utf8str) + * for i in range(self._transient_keys.size()): +*/ + __pyx_t_4 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_cur_scope->__pyx_v_self->_map->__pyx_vtab)->get(__pyx_cur_scope->__pyx_v_self->_map, __pyx_cur_scope->__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L1_error) + __pyx_cur_scope->__pyx_v_utf8str = ((__pyx_t_5spacy_7strings_Utf8Str *)__pyx_t_4); + + /* "spacy/strings.pyx":296 + * key = self.keys[i] + * utf8str = self._map.get(key) + * yield decode_Utf8Str(utf8str) # <<<<<<<<<<<<<< + * for i in range(self._transient_keys.size()): + * key = self._transient_keys[i] +*/ + __pyx_t_5 = __pyx_f_5spacy_7strings_decode_Utf8Str(__pyx_cur_scope->__pyx_v_utf8str); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 296, __pyx_L1_error) + } + + /* "spacy/strings.pyx":297 + * utf8str = self._map.get(key) + * yield decode_Utf8Str(utf8str) + * for i in range(self._transient_keys.size()): # <<<<<<<<<<<<<< + * key = self._transient_keys[i] + * utf8str = self._map.get(key) +*/ + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->_transient_keys.size(); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_cur_scope->__pyx_v_i = __pyx_t_3; + + /* "spacy/strings.pyx":298 + * yield decode_Utf8Str(utf8str) + * for i in range(self._transient_keys.size()): + * key = self._transient_keys[i] # <<<<<<<<<<<<<< + * utf8str = self._map.get(key) + * yield decode_Utf8Str(utf8str) +*/ + __pyx_cur_scope->__pyx_v_key = (__pyx_cur_scope->__pyx_v_self->_transient_keys[__pyx_cur_scope->__pyx_v_i]); + + /* "spacy/strings.pyx":299 + * for i in range(self._transient_keys.size()): + * key = self._transient_keys[i] + * utf8str = self._map.get(key) # <<<<<<<<<<<<<< + * yield decode_Utf8Str(utf8str) + * +*/ + __pyx_t_4 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_cur_scope->__pyx_v_self->_map->__pyx_vtab)->get(__pyx_cur_scope->__pyx_v_self->_map, __pyx_cur_scope->__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L1_error) + __pyx_cur_scope->__pyx_v_utf8str = ((__pyx_t_5spacy_7strings_Utf8Str *)__pyx_t_4); + + /* "spacy/strings.pyx":300 + * key = self._transient_keys[i] + * utf8str = self._map.get(key) + * yield decode_Utf8Str(utf8str) # <<<<<<<<<<<<<< + * + * def __reduce__(self): +*/ + __pyx_t_5 = __pyx_f_5spacy_7strings_decode_Utf8Str(__pyx_cur_scope->__pyx_v_utf8str); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 300, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 2; + return __pyx_r; + __pyx_L9_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 300, __pyx_L1_error) + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "spacy/strings.pyx":286 + * return False + * + * def __iter__(self): # <<<<<<<<<<<<<< + * """Iterate over the strings in the store, in order. + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":302 + * yield decode_Utf8Str(utf8str) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * strings = list(self) + * return (StringStore, (strings,), None, None, None) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_23__reduce__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_22__reduce__, "StringStore.__reduce__(self)"); +static PyMethodDef __pyx_mdef_5spacy_7strings_11StringStore_23__reduce__ = {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_23__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_22__reduce__}; +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_23__reduce__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_22__reduce__(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_22__reduce__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self) { + PyObject *__pyx_v_strings = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "spacy/strings.pyx":303 + * + * def __reduce__(self): + * strings = list(self) # <<<<<<<<<<<<<< + * return (StringStore, (strings,), None, None, None) + * +*/ + __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_strings = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":304 + * def __reduce__(self): + * strings = list(self) + * return (StringStore, (strings,), None, None, None) # <<<<<<<<<<<<<< + * + * def values(self) -> List[int]: +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_strings); + __Pyx_GIVEREF(__pyx_v_strings); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_strings) != (0)) __PYX_ERR(0, 304, __pyx_L1_error); + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore); + __Pyx_GIVEREF((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore)) != (0)) __PYX_ERR(0, 304, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 304, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None) != (0)) __PYX_ERR(0, 304, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 3, Py_None) != (0)) __PYX_ERR(0, 304, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 4, Py_None) != (0)) __PYX_ERR(0, 304, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/strings.pyx":302 + * yield decode_Utf8Str(utf8str) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * strings = list(self) + * return (StringStore, (strings,), None, None, None) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.strings.StringStore.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_strings); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":306 + * return (StringStore, (strings,), None, None, None) + * + * def values(self) -> List[int]: # <<<<<<<<<<<<<< + * """Iterate over the stored strings hashes in insertion order. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_25values(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_24values, "StringStore.values(self) -> List[int]\n\nIterate over the stored strings hashes in insertion order.\n\nRETURNS: A list of string hashs."); +static PyMethodDef __pyx_mdef_5spacy_7strings_11StringStore_25values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_25values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_24values}; +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_25values(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("values (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("values", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_24values(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_24values(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self) { + int __pyx_v_i; + PyObject *__pyx_v_hashes = NULL; + PyObject *__pyx_v_transient_hashes = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> ::size_type __pyx_t_8; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> ::size_type __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("values", 0); + + /* "spacy/strings.pyx":312 + * """ + * cdef int i + * hashes = [None] * self._keys.size() # <<<<<<<<<<<<<< + * for i in range(self._keys.size()): + * hashes[i] = self._keys[i] +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_keys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_size, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(0, 312, __pyx_L1_error); + { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_temp); + __Pyx_DECREF(__pyx_t_3); + __pyx_t_3 = __pyx_temp; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_hashes = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/strings.pyx":313 + * cdef int i + * hashes = [None] * self._keys.size() + * for i in range(self._keys.size()): # <<<<<<<<<<<<<< + * hashes[i] = self._keys[i] + * transient_hashes = [None] * self._transient_keys.size() +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_keys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_size, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __pyx_t_5; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "spacy/strings.pyx":314 + * hashes = [None] * self._keys.size() + * for i in range(self._keys.size()): + * hashes[i] = self._keys[i] # <<<<<<<<<<<<<< + * transient_hashes = [None] * self._transient_keys.size() + * for i in range(self._transient_keys.size()): +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_keys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely((__Pyx_SetItemInt(__pyx_v_hashes, __pyx_v_i, __pyx_t_2, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "spacy/strings.pyx":315 + * for i in range(self._keys.size()): + * hashes[i] = self._keys[i] + * transient_hashes = [None] * self._transient_keys.size() # <<<<<<<<<<<<<< + * for i in range(self._transient_keys.size()): + * transient_hashes[i] = self._transient_keys[i] +*/ + __pyx_t_8 = __pyx_v_self->_transient_keys.size(); + __pyx_t_2 = PyList_New(1 * (__pyx_t_8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_t_8; __pyx_temp++) { + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, __pyx_temp, Py_None) != (0)) __PYX_ERR(0, 315, __pyx_L1_error); + } + } + __pyx_v_transient_hashes = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/strings.pyx":316 + * hashes[i] = self._keys[i] + * transient_hashes = [None] * self._transient_keys.size() + * for i in range(self._transient_keys.size()): # <<<<<<<<<<<<<< + * transient_hashes[i] = self._transient_keys[i] + * return hashes + transient_hashes +*/ + __pyx_t_8 = __pyx_v_self->_transient_keys.size(); + __pyx_t_9 = __pyx_t_8; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_9; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "spacy/strings.pyx":317 + * transient_hashes = [None] * self._transient_keys.size() + * for i in range(self._transient_keys.size()): + * transient_hashes[i] = self._transient_keys[i] # <<<<<<<<<<<<<< + * return hashes + transient_hashes + * +*/ + __pyx_t_2 = __Pyx_PyLong_From_uint64_t((__pyx_v_self->_transient_keys[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((__Pyx_SetItemInt(__pyx_v_transient_hashes, __pyx_v_i, __pyx_t_2, int, 1, __Pyx_PyLong_From_int, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 317, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "spacy/strings.pyx":318 + * for i in range(self._transient_keys.size()): + * transient_hashes[i] = self._transient_keys[i] + * return hashes + transient_hashes # <<<<<<<<<<<<<< + * + * def to_disk(self, path): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyNumber_Add(__pyx_v_hashes, __pyx_v_transient_hashes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/strings.pyx":306 + * return (StringStore, (strings,), None, None, None) + * + * def values(self) -> List[int]: # <<<<<<<<<<<<<< + * """Iterate over the stored strings hashes in insertion order. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.strings.StringStore.values", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_hashes); + __Pyx_XDECREF(__pyx_v_transient_hashes); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":320 + * return hashes + transient_hashes + * + * def to_disk(self, path): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_27to_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_26to_disk, "StringStore.to_disk(self, path)\n\nSave the current state to a directory.\n\npath (str / Path): A path to a directory, which will be created if\n it doesn't exist. Paths may be either strings or Path-like objects."); +static PyMethodDef __pyx_mdef_5spacy_7strings_11StringStore_27to_disk = {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_27to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_26to_disk}; +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_27to_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_disk (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 320, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 320, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "to_disk", 0) < (0)) __PYX_ERR(0, 320, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, i); __PYX_ERR(0, 320, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 320, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 320, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.strings.StringStore.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_26to_disk(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), __pyx_v_path); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_26to_disk(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_path) { + PyObject *__pyx_v_strings = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_disk", 0); + __Pyx_INCREF(__pyx_v_path); + + /* "spacy/strings.pyx":326 + * it doesn't exist. Paths may be either strings or Path-like objects. + * """ + * path = util.ensure_path(path) # <<<<<<<<<<<<<< + * strings = sorted(self) + * srsly.write_json(path, strings) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ensure_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":327 + * """ + * path = util.ensure_path(path) + * strings = sorted(self) # <<<<<<<<<<<<<< + * srsly.write_json(path, strings) + * +*/ + __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 327, __pyx_L1_error) + __pyx_v_strings = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":328 + * path = util.ensure_path(path) + * strings = sorted(self) + * srsly.write_json(path, strings) # <<<<<<<<<<<<<< + * + * def from_disk(self, path): +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_write_json); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_path, __pyx_v_strings}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/strings.pyx":320 + * return hashes + transient_hashes + * + * def to_disk(self, path): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.strings.StringStore.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_strings); + __Pyx_XDECREF(__pyx_v_path); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":330 + * srsly.write_json(path, strings) + * + * def from_disk(self, path): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_29from_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_28from_disk, "StringStore.from_disk(self, path)\n\nLoads state from a directory. Modifies the object in place and\nreturns it.\n\npath (str / Path): A path to a directory. Paths may be either\n strings or `Path`-like objects.\nRETURNS (StringStore): The modified `StringStore` object."); +static PyMethodDef __pyx_mdef_5spacy_7strings_11StringStore_29from_disk = {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_29from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_28from_disk}; +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_29from_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_disk (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 330, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 330, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_disk", 0) < (0)) __PYX_ERR(0, 330, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_disk", 1, 1, 1, i); __PYX_ERR(0, 330, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 330, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 330, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.strings.StringStore.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_28from_disk(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), __pyx_v_path); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_28from_disk(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_path) { + PyObject *__pyx_v_strings = NULL; + PyObject *__pyx_v_prev = NULL; + PyObject *__pyx_v_word = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_disk", 0); + __Pyx_INCREF(__pyx_v_path); + + /* "spacy/strings.pyx":338 + * RETURNS (StringStore): The modified `StringStore` object. + * """ + * path = util.ensure_path(path) # <<<<<<<<<<<<<< + * strings = srsly.read_json(path) + * prev = list(self) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 338, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ensure_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 338, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":339 + * """ + * path = util.ensure_path(path) + * strings = srsly.read_json(path) # <<<<<<<<<<<<<< + * prev = list(self) + * self._reset_and_load(strings) +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_read_json); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_strings = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":340 + * path = util.ensure_path(path) + * strings = srsly.read_json(path) + * prev = list(self) # <<<<<<<<<<<<<< + * self._reset_and_load(strings) + * for word in prev: +*/ + __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_prev = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":341 + * strings = srsly.read_json(path) + * prev = list(self) + * self._reset_and_load(strings) # <<<<<<<<<<<<<< + * for word in prev: + * self.add(word, allow_transient=False) +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_strings}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reset_and_load, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/strings.pyx":342 + * prev = list(self) + * self._reset_and_load(strings) + * for word in prev: # <<<<<<<<<<<<<< + * self.add(word, allow_transient=False) + * return self +*/ + __pyx_t_1 = __pyx_v_prev; __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 342, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/strings.pyx":343 + * self._reset_and_load(strings) + * for word in prev: + * self.add(word, allow_transient=False) # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_v_word}; + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_False, __pyx_t_2, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/strings.pyx":342 + * prev = list(self) + * self._reset_and_load(strings) + * for word in prev: # <<<<<<<<<<<<<< + * self.add(word, allow_transient=False) + * return self +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/strings.pyx":344 + * for word in prev: + * self.add(word, allow_transient=False) + * return self # <<<<<<<<<<<<<< + * + * def to_bytes(self, **kwargs): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "spacy/strings.pyx":330 + * srsly.write_json(path, strings) + * + * def from_disk(self, path): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.strings.StringStore.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_strings); + __Pyx_XDECREF(__pyx_v_prev); + __Pyx_XDECREF(__pyx_v_word); + __Pyx_XDECREF(__pyx_v_path); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":346 + * return self + * + * def to_bytes(self, **kwargs): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_31to_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_30to_bytes, "StringStore.to_bytes(self, **kwargs)\n\nSerialize the current state to a binary string.\n\nRETURNS (bytes): The serialized form of the `StringStore` object."); +static PyMethodDef __pyx_mdef_5spacy_7strings_11StringStore_31to_bytes = {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_31to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_30to_bytes}; +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_31to_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_bytes (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_bytes", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (__pyx_kwds_len > 0) { + if (unlikely(__Pyx_CheckKeywordStrings("to_bytes", __pyx_kwds) == -1)) return NULL; + } + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_30to_bytes(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_30to_bytes(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_bytes", 0); + + /* "spacy/strings.pyx":351 + * RETURNS (bytes): The serialized form of the `StringStore` object. + * """ + * return srsly.json_dumps(sorted(self)) # <<<<<<<<<<<<<< + * + * def from_bytes(self, bytes_data, **kwargs): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_json_dumps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely((PyList_Sort(__pyx_t_3) < 0))) __PYX_ERR(0, 351, __pyx_L1_error) + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/strings.pyx":346 + * return self + * + * def to_bytes(self, **kwargs): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.strings.StringStore.to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":353 + * return srsly.json_dumps(sorted(self)) + * + * def from_bytes(self, bytes_data, **kwargs): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_33from_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_32from_bytes, "StringStore.from_bytes(self, bytes_data, **kwargs)\n\nLoad state from a binary string.\n\nbytes_data (bytes): The data to load from.\nRETURNS (StringStore): The `StringStore` object."); +static PyMethodDef __pyx_mdef_5spacy_7strings_11StringStore_33from_bytes = {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_33from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_32from_bytes}; +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_33from_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_bytes_data = 0; + CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_bytes (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_bytes_data,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 353, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 353, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "from_bytes", 1) < (0)) __PYX_ERR(0, 353, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_bytes", 1, 1, 1, i); __PYX_ERR(0, 353, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 353, __pyx_L3_error) + } + __pyx_v_bytes_data = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_bytes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 353, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_XDECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("spacy.strings.StringStore.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_32from_bytes(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), __pyx_v_bytes_data, __pyx_v_kwargs); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_32from_bytes(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_bytes_data, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { + PyObject *__pyx_v_strings = NULL; + PyObject *__pyx_v_prev = NULL; + PyObject *__pyx_v_word = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_bytes", 0); + + /* "spacy/strings.pyx":359 + * RETURNS (StringStore): The `StringStore` object. + * """ + * strings = srsly.json_loads(bytes_data) # <<<<<<<<<<<<<< + * prev = list(self) + * self._reset_and_load(strings) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_json_loads); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_bytes_data}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_strings = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":360 + * """ + * strings = srsly.json_loads(bytes_data) + * prev = list(self) # <<<<<<<<<<<<<< + * self._reset_and_load(strings) + * for word in prev: +*/ + __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_prev = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":361 + * strings = srsly.json_loads(bytes_data) + * prev = list(self) + * self._reset_and_load(strings) # <<<<<<<<<<<<<< + * for word in prev: + * self.add(word, allow_transient=False) +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_strings}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reset_and_load, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/strings.pyx":362 + * prev = list(self) + * self._reset_and_load(strings) + * for word in prev: # <<<<<<<<<<<<<< + * self.add(word, allow_transient=False) + * return self +*/ + __pyx_t_1 = __pyx_v_prev; __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 362, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/strings.pyx":363 + * self._reset_and_load(strings) + * for word in prev: + * self.add(word, allow_transient=False) # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_word}; + __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_False, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 363, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/strings.pyx":362 + * prev = list(self) + * self._reset_and_load(strings) + * for word in prev: # <<<<<<<<<<<<<< + * self.add(word, allow_transient=False) + * return self +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/strings.pyx":364 + * for word in prev: + * self.add(word, allow_transient=False) + * return self # <<<<<<<<<<<<<< + * + * def _reset_and_load(self, strings): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "spacy/strings.pyx":353 + * return srsly.json_dumps(sorted(self)) + * + * def from_bytes(self, bytes_data, **kwargs): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.strings.StringStore.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_strings); + __Pyx_XDECREF(__pyx_v_prev); + __Pyx_XDECREF(__pyx_v_word); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":366 + * return self + * + * def _reset_and_load(self, strings): # <<<<<<<<<<<<<< + * self.mem = Pool() + * self._non_temp_mem = self.mem +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_35_reset_and_load(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7strings_11StringStore_34_reset_and_load, "StringStore._reset_and_load(self, strings)"); +static PyMethodDef __pyx_mdef_5spacy_7strings_11StringStore_35_reset_and_load = {"_reset_and_load", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_35_reset_and_load, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_34_reset_and_load}; +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_35_reset_and_load(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_strings = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_reset_and_load (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_strings,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 366, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 366, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_reset_and_load", 0) < (0)) __PYX_ERR(0, 366, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_reset_and_load", 1, 1, 1, i); __PYX_ERR(0, 366, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 366, __pyx_L3_error) + } + __pyx_v_strings = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_reset_and_load", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 366, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.strings.StringStore._reset_and_load", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_34_reset_and_load(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), __pyx_v_strings); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_34_reset_and_load(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_strings) { + PyObject *__pyx_v_string = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_reset_and_load", 0); + + /* "spacy/strings.pyx":367 + * + * def _reset_and_load(self, strings): + * self.mem = Pool() # <<<<<<<<<<<<<< + * self._non_temp_mem = self.mem + * self._map = PreshMap() +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->mem); + __Pyx_DECREF((PyObject *)__pyx_v_self->mem); + __pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":368 + * def _reset_and_load(self, strings): + * self.mem = Pool() + * self._non_temp_mem = self.mem # <<<<<<<<<<<<<< + * self._map = PreshMap() + * self.keys.clear() +*/ + __pyx_t_1 = ((PyObject *)__pyx_v_self->mem); + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_non_temp_mem); + __Pyx_DECREF((PyObject *)__pyx_v_self->_non_temp_mem); + __pyx_v_self->_non_temp_mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":369 + * self.mem = Pool() + * self._non_temp_mem = self.mem + * self._map = PreshMap() # <<<<<<<<<<<<<< + * self.keys.clear() + * self._transient_keys.clear() +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_7preshed_4maps_PreshMap, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_map); + __Pyx_DECREF((PyObject *)__pyx_v_self->_map); + __pyx_v_self->_map = ((struct __pyx_obj_7preshed_4maps_PreshMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":370 + * self._non_temp_mem = self.mem + * self._map = PreshMap() + * self.keys.clear() # <<<<<<<<<<<<<< + * self._transient_keys.clear() + * for string in strings: +*/ + __pyx_v_self->keys.clear(); + + /* "spacy/strings.pyx":371 + * self._map = PreshMap() + * self.keys.clear() + * self._transient_keys.clear() # <<<<<<<<<<<<<< + * for string in strings: + * self.add(string, allow_transient=False) +*/ + __pyx_v_self->_transient_keys.clear(); + + /* "spacy/strings.pyx":372 + * self.keys.clear() + * self._transient_keys.clear() + * for string in strings: # <<<<<<<<<<<<<< + * self.add(string, allow_transient=False) + * +*/ + if (likely(PyList_CheckExact(__pyx_v_strings)) || PyTuple_CheckExact(__pyx_v_strings)) { + __pyx_t_1 = __pyx_v_strings; __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_strings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 372, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_4; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 372, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); + #endif + ++__pyx_t_4; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 372, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_string, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/strings.pyx":373 + * self._transient_keys.clear() + * for string in strings: + * self.add(string, allow_transient=False) # <<<<<<<<<<<<<< + * + * cdef const Utf8Str* intern_unicode(self, str py_string, bint allow_transient): +*/ + __pyx_t_6 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, __pyx_v_string}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_False, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 373, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":372 + * self.keys.clear() + * self._transient_keys.clear() + * for string in strings: # <<<<<<<<<<<<<< + * self.add(string, allow_transient=False) + * +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/strings.pyx":366 + * return self + * + * def _reset_and_load(self, strings): # <<<<<<<<<<<<<< + * self.mem = Pool() + * self._non_temp_mem = self.mem +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.strings.StringStore._reset_and_load", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_string); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":375 + * self.add(string, allow_transient=False) + * + * cdef const Utf8Str* intern_unicode(self, str py_string, bint allow_transient): # <<<<<<<<<<<<<< + * # 0 means missing, but we don't bother offsetting the index. + * cdef bytes byte_string = py_string.encode("utf8") +*/ + +static __pyx_t_5spacy_7strings_Utf8Str const *__pyx_f_5spacy_7strings_11StringStore_intern_unicode(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_py_string, int __pyx_v_allow_transient) { + PyObject *__pyx_v_byte_string = 0; + __pyx_t_5spacy_7strings_Utf8Str const *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + __pyx_t_5spacy_7strings_Utf8Str const *__pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("intern_unicode", 0); + + /* "spacy/strings.pyx":377 + * cdef const Utf8Str* intern_unicode(self, str py_string, bint allow_transient): + * # 0 means missing, but we don't bother offsetting the index. + * cdef bytes byte_string = py_string.encode("utf8") # <<<<<<<<<<<<<< + * return self._intern_utf8(byte_string, len(byte_string), NULL, allow_transient) + * +*/ + if (unlikely(__pyx_v_py_string == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); + __PYX_ERR(0, 377, __pyx_L1_error) + } + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_py_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_byte_string = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/strings.pyx":378 + * # 0 means missing, but we don't bother offsetting the index. + * cdef bytes byte_string = py_string.encode("utf8") + * return self._intern_utf8(byte_string, len(byte_string), NULL, allow_transient) # <<<<<<<<<<<<<< + * + * @cython.final +*/ + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_byte_string); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(__pyx_v_byte_string); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_t_4 = __pyx_f_5spacy_7strings_11StringStore__intern_utf8(__pyx_v_self, __pyx_t_2, __pyx_t_3, NULL, __pyx_v_allow_transient); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_r = __pyx_t_4; + goto __pyx_L0; + + /* "spacy/strings.pyx":375 + * self.add(string, allow_transient=False) + * + * cdef const Utf8Str* intern_unicode(self, str py_string, bint allow_transient): # <<<<<<<<<<<<<< + * # 0 means missing, but we don't bother offsetting the index. + * cdef bytes byte_string = py_string.encode("utf8") +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.strings.StringStore.intern_unicode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_byte_string); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pyx":380 + * return self._intern_utf8(byte_string, len(byte_string), NULL, allow_transient) + * + * @cython.final # <<<<<<<<<<<<<< + * cdef const Utf8Str* _intern_utf8(self, char* utf8_string, int length, hash_t* precalculated_hash, bint allow_transient): + * # TODO: This function's API/behaviour is an unholy mess... +*/ + +static __pyx_t_5spacy_7strings_Utf8Str const *__pyx_f_5spacy_7strings_11StringStore__intern_utf8(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, char *__pyx_v_utf8_string, int __pyx_v_length, __pyx_t_5spacy_8typedefs_hash_t *__pyx_v_precalculated_hash, int __pyx_v_allow_transient) { + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key; + __pyx_t_5spacy_7strings_Utf8Str *__pyx_v_value; + __pyx_t_5spacy_7strings_Utf8Str const *__pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_1; + int __pyx_t_2; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_3; + void *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + __pyx_t_5spacy_7strings_Utf8Str *__pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_intern_utf8", 0); + + /* "spacy/strings.pyx":384 + * # TODO: This function's API/behaviour is an unholy mess... + * # 0 means missing, but we don't bother offsetting the index. + * cdef hash_t key = precalculated_hash[0] if precalculated_hash is not NULL else hash_utf8(utf8_string, length) # <<<<<<<<<<<<<< + * cdef Utf8Str* value = self._map.get(key) + * if value is not NULL: +*/ + __pyx_t_2 = (__pyx_v_precalculated_hash != NULL); + if (__pyx_t_2) { + __pyx_t_1 = (__pyx_v_precalculated_hash[0]); + } else { + __pyx_t_3 = __pyx_f_5spacy_7strings_hash_utf8(__pyx_v_utf8_string, __pyx_v_length); if (unlikely(__pyx_t_3 == ((__pyx_t_5spacy_8typedefs_hash_t)-1LL) && PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L1_error) + __pyx_t_1 = __pyx_t_3; + } + __pyx_v_key = __pyx_t_1; + + /* "spacy/strings.pyx":385 + * # 0 means missing, but we don't bother offsetting the index. + * cdef hash_t key = precalculated_hash[0] if precalculated_hash is not NULL else hash_utf8(utf8_string, length) + * cdef Utf8Str* value = self._map.get(key) # <<<<<<<<<<<<<< + * if value is not NULL: + * return value +*/ + __pyx_t_4 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_map->__pyx_vtab)->get(__pyx_v_self->_map, __pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L1_error) + __pyx_v_value = ((__pyx_t_5spacy_7strings_Utf8Str *)__pyx_t_4); + + /* "spacy/strings.pyx":386 + * cdef hash_t key = precalculated_hash[0] if precalculated_hash is not NULL else hash_utf8(utf8_string, length) + * cdef Utf8Str* value = self._map.get(key) + * if value is not NULL: # <<<<<<<<<<<<<< + * return value + * if allow_transient: +*/ + __pyx_t_2 = (__pyx_v_value != NULL); + if (__pyx_t_2) { + + /* "spacy/strings.pyx":387 + * cdef Utf8Str* value = self._map.get(key) + * if value is not NULL: + * return value # <<<<<<<<<<<<<< + * if allow_transient: + * value = _allocate(self.mem, utf8_string, length) +*/ + __pyx_r = __pyx_v_value; + goto __pyx_L0; + + /* "spacy/strings.pyx":386 + * cdef hash_t key = precalculated_hash[0] if precalculated_hash is not NULL else hash_utf8(utf8_string, length) + * cdef Utf8Str* value = self._map.get(key) + * if value is not NULL: # <<<<<<<<<<<<<< + * return value + * if allow_transient: +*/ + } + + /* "spacy/strings.pyx":388 + * if value is not NULL: + * return value + * if allow_transient: # <<<<<<<<<<<<<< + * value = _allocate(self.mem, utf8_string, length) + * else: +*/ + if (__pyx_v_allow_transient) { + + /* "spacy/strings.pyx":389 + * return value + * if allow_transient: + * value = _allocate(self.mem, utf8_string, length) # <<<<<<<<<<<<<< + * else: + * value = _allocate(self._non_temp_mem, utf8_string, length) +*/ + __pyx_t_5 = ((PyObject *)__pyx_v_self->mem); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __pyx_f_5spacy_7strings__allocate(((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_5), ((unsigned char *)__pyx_v_utf8_string), __pyx_v_length); if (unlikely(__pyx_t_6 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_value = __pyx_t_6; + + /* "spacy/strings.pyx":388 + * if value is not NULL: + * return value + * if allow_transient: # <<<<<<<<<<<<<< + * value = _allocate(self.mem, utf8_string, length) + * else: +*/ + goto __pyx_L4; + } + + /* "spacy/strings.pyx":391 + * value = _allocate(self.mem, utf8_string, length) + * else: + * value = _allocate(self._non_temp_mem, utf8_string, length) # <<<<<<<<<<<<<< + * self._map.set(key, value) + * if allow_transient and self.mem is not self._non_temp_mem: +*/ + /*else*/ { + __pyx_t_5 = ((PyObject *)__pyx_v_self->_non_temp_mem); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __pyx_f_5spacy_7strings__allocate(((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_5), ((unsigned char *)__pyx_v_utf8_string), __pyx_v_length); if (unlikely(__pyx_t_6 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 391, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_value = __pyx_t_6; + } + __pyx_L4:; + + /* "spacy/strings.pyx":392 + * else: + * value = _allocate(self._non_temp_mem, utf8_string, length) + * self._map.set(key, value) # <<<<<<<<<<<<<< + * if allow_transient and self.mem is not self._non_temp_mem: + * self._transient_keys.push_back(key) +*/ + ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_map->__pyx_vtab)->set(__pyx_v_self->_map, __pyx_v_key, __pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 392, __pyx_L1_error) + + /* "spacy/strings.pyx":393 + * value = _allocate(self._non_temp_mem, utf8_string, length) + * self._map.set(key, value) + * if allow_transient and self.mem is not self._non_temp_mem: # <<<<<<<<<<<<<< + * self._transient_keys.push_back(key) + * else: +*/ + if (__pyx_v_allow_transient) { + } else { + __pyx_t_2 = __pyx_v_allow_transient; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_7 = (__pyx_v_self->mem != __pyx_v_self->_non_temp_mem); + __pyx_t_2 = __pyx_t_7; + __pyx_L6_bool_binop_done:; + if (__pyx_t_2) { + + /* "spacy/strings.pyx":394 + * self._map.set(key, value) + * if allow_transient and self.mem is not self._non_temp_mem: + * self._transient_keys.push_back(key) # <<<<<<<<<<<<<< + * else: + * self.keys.push_back(key) +*/ + try { + __pyx_v_self->_transient_keys.push_back(__pyx_v_key); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 394, __pyx_L1_error) + } + + /* "spacy/strings.pyx":393 + * value = _allocate(self._non_temp_mem, utf8_string, length) + * self._map.set(key, value) + * if allow_transient and self.mem is not self._non_temp_mem: # <<<<<<<<<<<<<< + * self._transient_keys.push_back(key) + * else: +*/ + goto __pyx_L5; + } + + /* "spacy/strings.pyx":396 + * self._transient_keys.push_back(key) + * else: + * self.keys.push_back(key) # <<<<<<<<<<<<<< + * return value +*/ + /*else*/ { + try { + __pyx_v_self->keys.push_back(__pyx_v_key); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 396, __pyx_L1_error) + } + } + __pyx_L5:; + + /* "spacy/strings.pyx":397 + * else: + * self.keys.push_back(key) + * return value # <<<<<<<<<<<<<< +*/ + __pyx_r = __pyx_v_value; + goto __pyx_L0; + + /* "spacy/strings.pyx":380 + * return self._intern_utf8(byte_string, len(byte_string), NULL, allow_transient) + * + * @cython.final # <<<<<<<<<<<<<< + * cdef const Utf8Str* _intern_utf8(self, char* utf8_string, int length, hash_t* precalculated_hash, bint allow_transient): + * # TODO: This function's API/behaviour is an unholy mess... +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.strings.StringStore._intern_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/strings.pxd":26 + * + * cdef vector[hash_t] keys + * cdef public PreshMap _map # <<<<<<<<<<<<<< + * + * cdef const Utf8Str* intern_unicode(self, str py_string, bint allow_transient) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_4_map_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7strings_11StringStore_4_map_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_4_map___get__(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7strings_11StringStore_4_map___get__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self->_map); + __pyx_r = ((PyObject *)__pyx_v_self->_map); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_7strings_11StringStore_4_map_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_7strings_11StringStore_4_map_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_4_map_2__set__(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7strings_11StringStore_4_map_2__set__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __pyx_v_value; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_7preshed_4maps_PreshMap))))) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_map); + __Pyx_DECREF((PyObject *)__pyx_v_self->_map); + __pyx_v_self->_map = ((struct __pyx_obj_7preshed_4maps_PreshMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.strings.StringStore._map.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_7strings_11StringStore_4_map_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_7strings_11StringStore_4_map_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7strings_11StringStore_4_map_4__del__(((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7strings_11StringStore_4_map_4__del__(struct __pyx_obj_5spacy_7strings_StringStore *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_map); + __Pyx_DECREF((PyObject *)__pyx_v_self->_map); + __pyx_v_self->_map = ((struct __pyx_obj_7preshed_4maps_PreshMap *)Py_None); + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ +static struct __pyx_vtabstruct_5spacy_7strings_StringStore __pyx_vtable_5spacy_7strings_StringStore; + +static PyObject *__pyx_tp_new_5spacy_7strings_StringStore(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_7strings_StringStore *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_7strings_StringStore *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_7strings_StringStore; + __Pyx_default_placement_construct(&(p->keys)); + __Pyx_default_placement_construct(&(p->_transient_keys)); + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + p->_map = ((struct __pyx_obj_7preshed_4maps_PreshMap *)Py_None); Py_INCREF(Py_None); + p->_non_temp_mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5spacy_7strings_StringStore(PyObject *o) { + struct __pyx_obj_5spacy_7strings_StringStore *p = (struct __pyx_obj_5spacy_7strings_StringStore *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7strings_StringStore) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + __Pyx_call_destructor(p->keys); + __Pyx_call_destructor(p->_transient_keys); + Py_CLEAR(p->mem); + Py_CLEAR(p->_map); + Py_CLEAR(p->_non_temp_mem); + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static int __pyx_tp_traverse_5spacy_7strings_StringStore(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7strings_StringStore *p = (struct __pyx_obj_5spacy_7strings_StringStore *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->mem) { + e = (*v)(((PyObject *)p->mem), a); if (e) return e; + } + if (p->_map) { + e = (*v)(((PyObject *)p->_map), a); if (e) return e; + } + if (p->_non_temp_mem) { + e = (*v)(((PyObject *)p->_non_temp_mem), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_7strings_StringStore(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_7strings_StringStore *p = (struct __pyx_obj_5spacy_7strings_StringStore *)o; + tmp = ((PyObject*)p->mem); + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_map); + p->_map = ((struct __pyx_obj_7preshed_4maps_PreshMap *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_non_temp_mem); + p->_non_temp_mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_sq_item_5spacy_7strings_StringStore(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_5spacy_7strings_11StringStore__map(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7strings_11StringStore_4_map_1__get__(o); +} + +static int __pyx_setprop_5spacy_7strings_11StringStore__map(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_7strings_11StringStore_4_map_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_7strings_11StringStore_4_map_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_5spacy_7strings_StringStore[] = { + {"as_int", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_5as_int, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_4as_int}, + {"as_string", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_7as_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_6as_string}, + {"memory_zone", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_11memory_zone, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_10memory_zone}, + {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_14add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_13add}, + {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_23__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_22__reduce__}, + {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_25values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_24values}, + {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_27to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_26to_disk}, + {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_29from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_28from_disk}, + {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_31to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_30to_bytes}, + {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_33from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_32from_bytes}, + {"_reset_and_load", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7strings_11StringStore_35_reset_and_load, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7strings_11StringStore_34_reset_and_load}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5spacy_7strings_StringStore[] = { + {"_map", __pyx_getprop_5spacy_7strings_11StringStore__map, __pyx_setprop_5spacy_7strings_11StringStore__map, PyDoc_STR("_map: preshed.maps.PreshMap"), 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7strings_StringStore_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7strings_StringStore}, + {Py_sq_length, (void *)__pyx_pw_5spacy_7strings_11StringStore_16__len__}, + {Py_sq_item, (void *)__pyx_sq_item_5spacy_7strings_StringStore}, + {Py_sq_contains, (void *)__pyx_pw_5spacy_7strings_11StringStore_18__contains__}, + {Py_mp_length, (void *)__pyx_pw_5spacy_7strings_11StringStore_16__len__}, + {Py_mp_subscript, (void *)__pyx_pw_5spacy_7strings_11StringStore_3__getitem__}, + {Py_tp_doc, (void *)PyDoc_STR("StringStore(strings=None, freeze=False)\n\nLook up strings by 64-bit hashes.\n\nDOCS: https://spacy.io/api/stringstore")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7strings_StringStore}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_7strings_StringStore}, + {Py_tp_iter, (void *)__pyx_pw_5spacy_7strings_11StringStore_20__iter__}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_7strings_StringStore}, + {Py_tp_getset, (void *)__pyx_getsets_5spacy_7strings_StringStore}, + {Py_tp_init, (void *)__pyx_pw_5spacy_7strings_11StringStore_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7strings_StringStore}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7strings_StringStore_spec = { + "spacy.strings.StringStore", + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7strings_StringStore_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_StringStore = { + __pyx_pw_5spacy_7strings_11StringStore_16__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_5spacy_7strings_StringStore, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + __pyx_pw_5spacy_7strings_11StringStore_18__contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_StringStore = { + __pyx_pw_5spacy_7strings_11StringStore_16__len__, /*mp_length*/ + __pyx_pw_5spacy_7strings_11StringStore_3__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_5spacy_7strings_StringStore = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.strings.""StringStore", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7strings_StringStore, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_StringStore, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_StringStore, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + PyDoc_STR("StringStore(strings=None, freeze=False)\n\nLook up strings by 64-bit hashes.\n\nDOCS: https://spacy.io/api/stringstore"), /*tp_doc*/ + __pyx_tp_traverse_5spacy_7strings_StringStore, /*tp_traverse*/ + __pyx_tp_clear_5spacy_7strings_StringStore, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_5spacy_7strings_11StringStore_20__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_7strings_StringStore, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5spacy_7strings_StringStore, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_5spacy_7strings_11StringStore_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7strings_StringStore, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_7strings___pyx_scope_struct__memory_zone(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7strings___pyx_scope_struct__memory_zone > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone, sizeof(struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_7strings___pyx_scope_struct__memory_zone[--__pyx_mstate_global->__pyx_freecount_5spacy_7strings___pyx_scope_struct__memory_zone]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_7strings___pyx_scope_struct__memory_zone(PyObject *o) { + struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone *p = (struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7strings___pyx_scope_struct__memory_zone) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_mem); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7strings___pyx_scope_struct__memory_zone < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone, sizeof(struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_7strings___pyx_scope_struct__memory_zone[__pyx_mstate_global->__pyx_freecount_5spacy_7strings___pyx_scope_struct__memory_zone++] = ((struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_7strings___pyx_scope_struct__memory_zone(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone *p = (struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_mem) { + e = (*v)(p->__pyx_v_mem, a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7strings___pyx_scope_struct__memory_zone_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7strings___pyx_scope_struct__memory_zone}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7strings___pyx_scope_struct__memory_zone}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7strings___pyx_scope_struct__memory_zone}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7strings___pyx_scope_struct__memory_zone_spec = { + "spacy.strings.__pyx_scope_struct__memory_zone", + sizeof(struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7strings___pyx_scope_struct__memory_zone_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_7strings___pyx_scope_struct__memory_zone = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.strings.""__pyx_scope_struct__memory_zone", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7strings___pyx_scope_struct__memory_zone), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7strings___pyx_scope_struct__memory_zone, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_7strings___pyx_scope_struct__memory_zone, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7strings___pyx_scope_struct__memory_zone, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_7strings___pyx_scope_struct_1___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7strings___pyx_scope_struct_1___iter__ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__, sizeof(struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_7strings___pyx_scope_struct_1___iter__[--__pyx_mstate_global->__pyx_freecount_5spacy_7strings___pyx_scope_struct_1___iter__]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_7strings___pyx_scope_struct_1___iter__(PyObject *o) { + struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__ *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7strings___pyx_scope_struct_1___iter__) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7strings___pyx_scope_struct_1___iter__ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__, sizeof(struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_7strings___pyx_scope_struct_1___iter__[__pyx_mstate_global->__pyx_freecount_5spacy_7strings___pyx_scope_struct_1___iter__++] = ((struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__ *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_7strings___pyx_scope_struct_1___iter__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__ *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7strings___pyx_scope_struct_1___iter___slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7strings___pyx_scope_struct_1___iter__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7strings___pyx_scope_struct_1___iter__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7strings___pyx_scope_struct_1___iter__}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7strings___pyx_scope_struct_1___iter___spec = { + "spacy.strings.__pyx_scope_struct_1___iter__", + sizeof(struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7strings___pyx_scope_struct_1___iter___slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_7strings___pyx_scope_struct_1___iter__ = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.strings.""__pyx_scope_struct_1___iter__", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7strings___pyx_scope_struct_1___iter__), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7strings___pyx_scope_struct_1___iter__, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_7strings___pyx_scope_struct_1___iter__, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7strings___pyx_scope_struct_1___iter__, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +/* #### Code section: initfunc_declarations ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ +/* #### Code section: init_module ### */ + +static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + { + __pyx_t_1 = __Pyx_ApiExport_GetApiDict(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_export_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_PyObject___pyx_t_5spacy_7strings); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_export_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_export_name = __pyx_export_signature + 168; + void (*const __pyx_export_pointers[])(void) = {(void (*)(void))&__pyx_f_5spacy_7strings_decode_Utf8Str, (void (*)(void))&__pyx_f_5spacy_7strings_hash_string, (void (*)(void))&__pyx_f_5spacy_7strings_hash_utf8, (void (*)(void)) NULL}; + void (*const *__pyx_export_pointer)(void) = __pyx_export_pointers; + const char *__pyx_export_current_signature = __pyx_export_signature; + while (*__pyx_export_pointer) { + if (__Pyx_ExportFunction(__pyx_t_1, __pyx_export_name, *__pyx_export_pointer, __pyx_export_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_export_pointer; + __pyx_export_name = strchr(__pyx_export_name, '\0') + 1; + __pyx_export_signature = strchr(__pyx_export_signature, '\0') + 1; + if (*__pyx_export_signature != '\0') __pyx_export_current_signature = __pyx_export_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_5spacy_7strings_StringStore = &__pyx_vtable_5spacy_7strings_StringStore; + __pyx_vtable_5spacy_7strings_StringStore.intern_unicode = (__pyx_t_5spacy_7strings_Utf8Str const *(*)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int))__pyx_f_5spacy_7strings_11StringStore_intern_unicode; + __pyx_vtable_5spacy_7strings_StringStore._intern_utf8 = (__pyx_t_5spacy_7strings_Utf8Str const *(*)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int))__pyx_f_5spacy_7strings_11StringStore__intern_utf8; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7strings_StringStore_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore)) __PYX_ERR(0, 116, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7strings_StringStore_spec, __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) < (0)) __PYX_ERR(0, 116, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = &__pyx_type_5spacy_7strings_StringStore; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) < (0)) __PYX_ERR(0, 116, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 116, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_7strings_11StringStore___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_7strings_11StringStore___init__.doc = __pyx_doc_5spacy_7strings_11StringStore___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_7strings_11StringStore___init__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 116, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_7strings_11StringStore_2__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_7strings_11StringStore_2__getitem__.doc = __pyx_doc_5spacy_7strings_11StringStore_2__getitem__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_7strings_11StringStore_2__getitem__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(0, 116, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_7strings_11StringStore_8__len__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_7strings_11StringStore_8__len__.doc = __pyx_doc_5spacy_7strings_11StringStore_8__len__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_7strings_11StringStore_8__len__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(0, 116, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_7strings_11StringStore_15__len__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_7strings_11StringStore_15__len__.doc = __pyx_doc_5spacy_7strings_11StringStore_15__len__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_7strings_11StringStore_15__len__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(0, 116, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_7strings_11StringStore_17__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_7strings_11StringStore_17__contains__.doc = __pyx_doc_5spacy_7strings_11StringStore_17__contains__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_7strings_11StringStore_17__contains__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(0, 116, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_7strings_11StringStore_19__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_7strings_11StringStore_19__iter__.doc = __pyx_doc_5spacy_7strings_11StringStore_19__iter__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_7strings_11StringStore_19__iter__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore, __pyx_vtabptr_5spacy_7strings_StringStore) < (0)) __PYX_ERR(0, 116, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) < (0)) __PYX_ERR(0, 116, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_StringStore, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) < (0)) __PYX_ERR(0, 116, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7strings___pyx_scope_struct__memory_zone_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone)) __PYX_ERR(0, 194, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7strings___pyx_scope_struct__memory_zone_spec, __pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone) < (0)) __PYX_ERR(0, 194, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone = &__pyx_type_5spacy_7strings___pyx_scope_struct__memory_zone; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone) < (0)) __PYX_ERR(0, 194, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct__memory_zone->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7strings___pyx_scope_struct_1___iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__)) __PYX_ERR(0, 286, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7strings___pyx_scope_struct_1___iter___spec, __pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__) < (0)) __PYX_ERR(0, 286, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__ = &__pyx_type_5spacy_7strings___pyx_scope_struct_1___iter__; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__) < (0)) __PYX_ERR(0, 286, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7strings___pyx_scope_struct_1___iter__->tp_getattro = PyObject_GenericGetAttr; + } + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(2, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(2, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(2, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(2, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(2, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(3, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(3, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(3, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(3, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("murmurhash.mrmr"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_uint32_t_void_int_uint32_t_uint6); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 66; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash32, (void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (void (**)(void)) NULL}; + void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportFunction_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + { + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_void_struct___pyx_t_7preshed_4ma); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 87; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_7preshed_4maps_map_clear, (void (**)(void)) NULL}; + void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportFunction_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_strings(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_strings}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #endif + #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE + {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, + #endif + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "strings", + 0, /* m_doc */ + #if CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstatetype), /* m_size */ + #else + (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif + +/* PyModInitFuncType */ +#ifndef CYTHON_NO_PYINIT_EXPORT + #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#else + #ifdef __cplusplus + #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * + #else + #define __Pyx_PyMODINIT_FUNC PyObject * + #endif +#endif + +__Pyx_PyMODINIT_FUNC PyInit_strings(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_strings(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +/* ModuleCreationPEP489 */ +#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) +static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { + { + PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think + if (!module) { + PyErr_Clear(); // just try the 3.8-3.12 version + module = PyImport_ImportModule("_xxsubinterpreters"); + if (!module) goto bad; + } + PyObject *current = PyObject_CallMethod(module, "get_current", NULL); + Py_DECREF(module); + if (!current) goto bad; + if (PyTuple_Check(current)) { + PyObject *new_current = PySequence_GetItem(current, 0); + Py_DECREF(current); + current = new_current; + if (!new_current) goto bad; + } + long long as_c_int = PyLong_AsLongLong(current); + Py_DECREF(current); + return as_c_int; + } + bad: + PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); + return -1; +} +#endif +#if !CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + static PY_INT64_T main_interpreter_id = -1; +#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_GRAAL + PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) + PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); +#elif CYTHON_COMPILING_IN_LIMITED_API + PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); +#else + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); +#endif + if (unlikely(current_id == -1)) { + return -1; + } + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return 0; + } else if (unlikely(main_interpreter_id != current_id)) { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#endif +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + #if !CYTHON_USE_MODULE_STATE + if (__Pyx_check_single_interpreter()) + return NULL; + #endif + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_strings(PyObject *__pyx_pyinit_module) +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + __pyx_mstatetype *__pyx_mstate = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'strings' has already been imported. Re-initialisation is not supported."); + return -1; + } + #else + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_t_1 = __pyx_pyinit_module; + Py_INCREF(__pyx_t_1); + #else + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #if CYTHON_USE_MODULE_STATE + { + int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "strings" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = __pyx_t_1; + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); + #endif + __pyx_mstate = __pyx_mstate_global; + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_mstate->__pyx_d); + __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /* ImportRefnannyAPI */ + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + +__Pyx_RefNannySetupContext("PyInit_strings", 0); + __Pyx_init_runtime_version(); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Library function declarations ---*/ + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_module_is_main_spacy__strings) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "spacy.strings")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.strings", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(__pyx_mstate); + (void)__Pyx_modinit_variable_export_code(__pyx_mstate); + if (unlikely((__Pyx_modinit_function_export_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_variable_import_code(__pyx_mstate); + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "spacy/strings.pyx":5 + * cimport cython + * + * from contextlib import contextmanager # <<<<<<<<<<<<<< + * from typing import List, Optional + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_contextmanager}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_contextlib, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_contextlib, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_contextmanager}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":6 + * + * from contextlib import contextmanager + * from typing import List, Optional # <<<<<<<<<<<<<< + * + * from libc.stdint cimport uint32_t +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_List,__pyx_mstate_global->__pyx_n_u_Optional}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, __pyx_imported_names, 2, __pyx_mstate_global->__pyx_kp_u_spacy_typing, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_List,__pyx_mstate_global->__pyx_n_u_Optional}; + for (__pyx_t_3=0; __pyx_t_3 < 2; __pyx_t_3++) { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":13 + * from preshed.maps cimport map_clear + * + * import srsly # <<<<<<<<<<<<<< + * + * from .typedefs cimport hash_t +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_srsly, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_srsly, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_srsly, __pyx_t_2) < (0)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":17 + * from .typedefs cimport hash_t + * + * from . import util # <<<<<<<<<<<<<< + * from .errors import Errors + * from .symbols import IDS as SYMBOLS_BY_STR +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":18 + * + * from . import util + * from .errors import Errors # <<<<<<<<<<<<<< + * from .symbols import IDS as SYMBOLS_BY_STR + * from .symbols import NAMES as SYMBOLS_BY_INT +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":19 + * from . import util + * from .errors import Errors + * from .symbols import IDS as SYMBOLS_BY_STR # <<<<<<<<<<<<<< + * from .symbols import NAMES as SYMBOLS_BY_INT + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IDS}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_symbols, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_symbols, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IDS}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + switch (__pyx_t_3) { + case 0: + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_SYMBOLS_BY_STR, __pyx_t_4) < (0)) __PYX_ERR(0, 19, __pyx_L1_error) + break; + default:; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":20 + * from .errors import Errors + * from .symbols import IDS as SYMBOLS_BY_STR + * from .symbols import NAMES as SYMBOLS_BY_INT # <<<<<<<<<<<<<< + * + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_NAMES}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_symbols, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_symbols, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_NAMES}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + switch (__pyx_t_3) { + case 0: + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_SYMBOLS_BY_INT, __pyx_t_4) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) + break; + default:; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":32 + * + * + * def get_string_id(key): # <<<<<<<<<<<<<< + * """Get a string ID, handling the reserved symbols correctly. If the key is + * already an ID, return it. +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_1get_string_id, 0, __pyx_mstate_global->__pyx_n_u_get_string_id, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_string_id, __pyx_t_2) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":62 + * + * + * cpdef hash_t hash_string(str string) except 0: # <<<<<<<<<<<<<< + * chars = string.encode("utf8") + * return hash_utf8(chars, len(chars)) +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_3hash_string, 0, __pyx_mstate_global->__pyx_n_u_hash_string, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_hash_string, __pyx_t_2) < (0)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":173 + * return decode_Utf8Str(utf8str) + * + * def as_int(self, key): # <<<<<<<<<<<<<< + * """If key is an int, return it; otherwise, get the int value.""" + * if not isinstance(key, str): +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_11StringStore_5as_int, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StringStore_as_int, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_as_int, __pyx_t_2) < (0)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":180 + * return self[key] + * + * def as_string(self, key): # <<<<<<<<<<<<<< + * """If key is a string, return it; otherwise, get the string value.""" + * if isinstance(key, str): +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_11StringStore_7as_string, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StringStore_as_string, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_as_string, __pyx_t_2) < (0)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/strings.pyx":194 + * return self.keys.size() + self._transient_keys.size() + * + * @contextmanager # <<<<<<<<<<<<<< + * def memory_zone(self, mem: Optional[Pool] = None) -> Pool: + * """Begin a block where all resources allocated during the block will +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_mem, __pyx_mstate_global->__pyx_kp_u_Optional_Pool) < (0)) __PYX_ERR(0, 194, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_Pool) < (0)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_11StringStore_11memory_zone, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StringStore_memory_zone, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0]); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_memory_zone, __pyx_t_4) < (0)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_contextmanager); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetNameInClass(__pyx_t_6, (PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_memory_zone); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_memory_zone, __pyx_t_4) < (0)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/strings.pyx":214 + * self.mem = self._non_temp_mem + * + * def add(self, string: str, allow_transient: Optional[bool] = None) -> int: # <<<<<<<<<<<<<< + * """Add a string to the StringStore. + * +*/ + __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_string, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 214, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_allow_transient, __pyx_mstate_global->__pyx_kp_u_Optional_bool) < (0)) __PYX_ERR(0, 214, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 214, __pyx_L1_error) + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_11StringStore_14add, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StringStore_add, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[0]); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_add, __pyx_t_5) < (0)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/strings.pyx":302 + * yield decode_Utf8Str(utf8str) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * strings = list(self) + * return (StringStore, (strings,), None, None, None) +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_11StringStore_23__reduce__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StringStore___reduce, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_reduce, __pyx_t_5) < (0)) __PYX_ERR(0, 302, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/strings.pyx":306 + * return (StringStore, (strings,), None, None, None) + * + * def values(self) -> List[int]: # <<<<<<<<<<<<<< + * """Iterate over the stored strings hashes in insertion order. + * +*/ + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_List_int) < (0)) __PYX_ERR(0, 306, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_11StringStore_25values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StringStore_values, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_4) < (0)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/strings.pyx":320 + * return hashes + transient_hashes + * + * def to_disk(self, path): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_11StringStore_27to_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StringStore_to_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_to_disk, __pyx_t_4) < (0)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/strings.pyx":330 + * srsly.write_json(path, strings) + * + * def from_disk(self, path): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_11StringStore_29from_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StringStore_from_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_from_disk, __pyx_t_4) < (0)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/strings.pyx":346 + * return self + * + * def to_bytes(self, **kwargs): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_11StringStore_31to_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StringStore_to_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_t_4) < (0)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/strings.pyx":353 + * return srsly.json_dumps(sorted(self)) + * + * def from_bytes(self, bytes_data, **kwargs): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_11StringStore_33from_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StringStore_from_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_t_4) < (0)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/strings.pyx":366 + * return self + * + * def _reset_and_load(self, strings): # <<<<<<<<<<<<<< + * self.mem = Pool() + * self._non_temp_mem = self.mem +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7strings_11StringStore_35_reset_and_load, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_StringStore__reset_and_load, NULL, __pyx_mstate_global->__pyx_n_u_spacy_strings, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_mstate_global->__pyx_n_u_reset_and_load, __pyx_t_4) < (0)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/strings.pyx":1 + * # cython: infer_types=True # <<<<<<<<<<<<<< + * # cython: profile=False + * cimport cython +*/ + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_4) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.strings", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init spacy.strings"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #else + return __pyx_m; + #endif +} +/* #### Code section: pystring_table ### */ +/* #### Code section: cached_builtins ### */ + +static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + + /* Cached unbound methods */ + __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; + return 0; +} +/* #### Code section: cached_constants ### */ + +static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "spacy/strings.pyx":194 + * return self.keys.size() + self._transient_keys.size() + * + * @contextmanager # <<<<<<<<<<<<<< + * def memory_zone(self, mem: Optional[Pool] = None) -> Pool: + * """Begin a block where all resources allocated during the block will +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + { + const struct { const unsigned int length: 8; } index[] = {{0},{9},{179},{14},{14},{1},{1},{8},{7},{6},{2},{9},{6},{16},{12},{11},{17},{13},{12},{0},{4},{4},{6},{3},{4},{5},{8},{4},{20},{14},{14},{11},{20},{22},{27},{15},{18},{21},{22},{21},{23},{20},{19},{18},{3},{15},{6},{9},{18},{10},{5},{17},{18},{5},{10},{14},{8},{6},{11},{6},{6},{6},{10},{9},{8},{3},{13},{11},{10},{6},{1},{3},{13},{5},{8},{10},{10},{3},{5},{6},{8},{3},{11},{10},{8},{4},{4},{3},{4},{12},{14},{12},{9},{10},{15},{6},{4},{4},{12},{10},{4},{13},{5},{3},{8},{6},{7},{6},{7},{8},{5},{8},{7},{16},{6},{4},{7},{4},{5},{10},{6},{4},{10},{204},{217},{2},{9},{60},{29},{31},{70},{27},{24},{33},{71},{17},{117},{111},{79},{96}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1521 bytes) */ +const char* const cstring = "BZh91AY&SYWIa4\000\001\n\177\377\367\177\377\377\367\377\377\364\277\377\377\352\277\377\377\371@@@@@@@@@@@@@\000@\000P\005^8\254\331\327Z\235\246\3333k\203\202Tj\n\217iOSi\036\247\251\265=\222m\031\024\362F\236\246\232zz\247\250\310\000\032hhmC\324mA\223\324z\232i\352\017OR<\247\244\032!0!\242dF\322mQ\351\251\240=A\241\240\321\240\000\000\000\000\000\006\200\000\003M\004MM2\t\251\345&\364L\2156\242zOQ\264L\000\324\311\201\006A\2041\006\010i\246&L\0021\006\000\t\200\000\230\000\000\000\000\000\000\000\000\000\000\000\000%5\021\224d\321\030\024\330\243\310M\006\203@\000\006\200\006\200\000\000\000\000bi\223J\266cQ\352ti\354Cq\356\362?\274\313?A2\0224W\361\372\013P\234\322g\327\376\352\303U!0\302A\215\010\000\371\241N\353]L\360\224\ni\204$\"Q!^\225\240\230\036\2522\032\321H\220\203\017bJ\024\n\205l@N\010\306\002r\002\001\022\022\242\3164$6b\227h?\373X\243\355f,!\310\273{\370\363\004\376JeP\276M\217#\r\216g\201\252\363lH\t\371\336\345o\353qU\227\031e*\n\357d\003)\032>\345w\321fFQ\215\263q\3242\362\311 \377\230\003\030\333\206\000qRH f\355\3621\370r\"|\033B\250\352\007\t/\001\211\233\310\351\225\313e\274a\366\207\222'\202\316k\226MXvs\273\006\370R\2233\320\327P\245>\277\266iS\374/\246\220\017H\312\262\010\335\3678l\005\304\026\215\221WpH(\255\242I\013#S}\357%]\210\\\345e\251\262J8\013\t4\2454\313\303[g\316\306\351\263#6bV\272M$Og\227/\357\275#E\364\2412a\3113\r\004\0327&me9\003W\312J\025\232Xl\210q\254|\3709\337=\033\371u\347\021h\022\220\300](\312s\224Z\260\3660\264L\232\322i\306Db\302\2455\035\220\372\010\217TS\027\2474\240\351\324=\231\2658\301C\325+q=,Kx\244\347O)\2201\004\275\035!'{B\343\207\200\325\253\344aS\244\213IB\013\nY\277\244\312\247\331\241\003B\3100C\367\0044H\320\365<\347O\346\202!K\343\356r\203\2522\271\305\367\337 \242\245y1\016v\021\300\214\362'\203\"\341\331\022\250\203\026\212el\347\273qD\367zz\211\233y\362k\353\274@V\023\215<\252Y?\241\224\255\026]t}d\252\010\341#\217Y\032\234\215\300,\257-\276 \2176\3321Y6\242\212\"\013\006\020\351r#*\206b\030Q""\223q\252pL[I\253*\t\205E\247\016]\226\277U\224\262\005\030\346\342\006\234\004m]\323Z\330\337\320\220\350\224f\207\271b\010rv\210\377\210{%+\261P\265\row\n\2561\003@\347\317>c\004%\266\332\030\211\337`\2610\036f\026\022\334\366\023\255)\355\263t\262\n\022\242)4\240]\253\004\010\200Vcd\n*\014\013\034\000\221\002\322\276\300\212\336\220\260\300`\301\221\321(\252r\334\302{\204\367\025\330\nT\344\221\230C0\260\004B\031\027\235b\220\\\253JWJ\230\336\223\306\304\007V\276I#<**\ng`L)\t~\245)U\ti\n\"\341\251\310\277F@\265V\014\001U1\353\225s\032f\205\334\023=\024)gu\016I\222p\3674\365c\031\243\024\210\224\254\242(a\244\274\372\036@\214\006\022I\315Xr\t\333\024\253>CE\2544\341\202\310N\030C\310/Dfd\211\002\310\261\002\210\242\274gz@\243\272#A\020\254\357L\320\026eU{\301\206\005\355T\242&\323)\326\003k\270B\232\241S\342\326X0\027\005\323\244\245\024\003|\"m\254\306\213\367\034X5\352i\200mt\323S\013\254\363Y\301\252>\232\274)\201\025\245|\2166t\334&JlF\026\255\223\010\007\030\222@\270Z\2464T\301P\231\017\000\0302hD\362\274\252j-p\310\006\034l\236\033d7L\236\325D\010UX\2440@Ir\202\032x\345u\370\347\350\301\342\305\266\227\357\332\002\356I\r5y\262\202\0223\225K \200\320\034\021\2536\031U\327\021e\023\"\360\0243OP\321I\322\360\013#8\274CeI\327y(/\351\034\034D\t\010uL\304\341\3542\030H\245D\326I\342M\034\220\312\312V\365%0\230\n\030\307\226\246Y\256\361\347;:\234W&\234R*\n\251\024\333\263\304\027\240\353#Je,\254\274\203R\010D\204p\0003\0313\313\005@\306\270\315$K\354~\351\343\260U!r\321\311\257)m\036l(\315v\222^\264\267oaj\026\240\271\255smP\"\013+-\024\302\n\323\371ZT\244\026\273\311\335\211\232#JTx\021\202\351\205~c|\265\270\211\031\272\360aC\371\325U\0230\374G\201\207\263\326-\241\241g:\037\327\225\023g\302\305\272y\311\322\022\017\312\357`\262\224\261o\004\017\343\205\230K\0052\372\324\376\276\206\375XH\352A\210\206\247\017\033\375\301e\252w\257\3232E\025\264\250\264^\264\021\005,o\3728\n:T\007\307\247\272N\3175\016\201\2574\310\255C\016\n\346YW\213\245\201\333$\342\354\034+""\221\303\212\307`n^J\356\271\253\252\037\2753;\202\317\357&\265\267t\262\035\323\202\026\030@c\010\352\036\370r0\2603\006\004\031\225i\020\342I8r\206N\306D\230\367\213\271\"\234(H+\244\260\232\000"; + PyObject *data = __Pyx_DecompressString(cstring, 1521, 2); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1394 bytes) */ +const char* const cstring = "x\332\225U\315O\033G\024\267+R\231\3424\2304$\315W\227\n\022h\023\212\203\003\244\252T9\004\232\244\t\301q>\032E\321h\274;\306\033\326;\366\314,\316\022\251\342\350\343\034\347\270G\037}\364\261\307\036}\364\221?\201?\241ov\0260\244\225R\311\273\373\346\315\233\367~\357\367\336\033?q\271x\353\372\342\335\006\025\304\0225,\254\325P\324\250o\271\334r\210\347V\010\303\202x\241\305\005smA\2306\362\255\315\265\315\333\205\225\202\205}\307b\344=\261\005\267xP\261=\3149\341\026\255Z\225\300\365\204\353[\"l\020>o=\252Z!\r,\237\020\307\022\324j\200\335\360\001Q#\276\305\211\320\202u\023\373>\025X\270\324Gp\334\365\267nZ\216\313 \210\273C\364\351u\354q2\377\254\241-\260\367v\223R\357\335\321\252\242W\363\277b\307A\340\2058.\307\025\217\020_\277\267l\227\033\311\341\rl\207\363\346mS_\220\017\002\2625k\302\030e<\261`\334\013c\361'M\201\277\305\347\033\341\207d/\254W\250\227\030\032\244k\013\371exV\326b\027\217\036\224\237\000\303\033\305\247k\345C\200\032-B\233\341\007x\036\000\245h\003B?'\325\362\233\247\367\237=)\243\373o\320\243\215\027C\253\362\213\347\3458rYPF\206\304y\204\\\250\010B'u\2148\201MNi\031\001v\021\224\013y\024;\303[@\324\211%G\320\017\2474w\211/\014\316#l\230\207\276\355R(%\243\001\364\035\341\261s\344`\201\355\032f\034\241\270\327\320\026\021@Z]/\301\n|h\2276\251`{\333\366('\307\275\220Hu\354\343-\315\262\243\213\205\210oS\007\332\211\007\214\240\006\206~\215+]\245\254\216E\225\021\262K\216\2719\342\003\241j\340\333HG\207_\202\031\271N\r\363Z\262\212\3058[-\021\356Bz\310\345\350(#\r\233\037\226\374=\207\341p\202z\203\307\222.*\337&!\202\207o\2670\333\002\313:\206\354\020\320?T\001XS'\360\340\213\220\217\353\360\365!G\235G\2036\032\214\354 \004\355\215l\334p\265\211\226w\204\036\030\275j\006\3303\207\030\301\216\301p\324n\247Z\214\021\0210\237\023\257\n\023\347 \244\367\314Y\220\034R\305\201'\270\273K\222I2\243e""\206M0\370!\315B\242N6\315\264\2317B@/\224C\324\030m\035\266R\322>G=\202\014\223f2\003Q]\321\017x\003:\275\230\351\370\245\357\030#\361\026eN\213\001\303qn\233\341\263\212\276\332\254\037f\r\023\002\335\215\341\242\345\004\022z\t\016\241[-\350\025\016vs\251S\206+\3327d\313c(HX\263\307NoYPa\313\034\340\333nCc\207B\330\265\317\360\242[:\3610\227r\210n\311C,\251\241\2362\262\316\272?r\271\177y\241\277P\374\353\333\277\247\016&S\243\331v\241\335\034d\317\313\374 3\326\037\273\242\026\025\036d\257+'\232\211Z\035\247;\265\237\031k\377,K\262\246\365\347\332-i\253\334`\374\242\3743*Ex?{A\276R\313\321T\224\037d/\3120JG\227:\347;\305Ni\220\035\227gUI\325\"\273\223\353\314u\363\335\307=<8{Q6U&J\177\352\351s\216\357g'\344\234\312\253\365\030\033\356|\354M\367p\2579\310\234k7\367\212{\305\301w\013\335\321^n\257x\220M\215\236\2273\362c\014\014\266\205\314\313\342 \223\355g\257\252\242*\201\324~\010\n\0102\"\213\362U\377\312\217\235|\342F\347[h\357\252\234\232Q\206\230}x\025\000w\272\237\272\325)\016F\262\355uy\023\366\247\006#c\355{p\376\265ZU\315(\275\247#\264\177\323\266q\250k\352E\2243\241\036\252xoMN&{W!\211)\255z,\361!\214?\372\327nwJ\006\201f\234\250\374\311\370:\300\204\234\226X;\031\227_\253\355\316dg\247[2\t\217C\226\277h\034\203\314%\225\006j3g\333oA\230T\220\325\301\370\t\203\t g7\312i\010\377\213\234\203\257\264\233@\376\256Z\021\216\232\375\021\210\244cO\310\234\274\241\276P\323\252\032\255ur&\327\013\000T\250\245\350\202\256\356\204\234\222w\325\210N[\227\344J\\\306\357\243\007\375\331\225\336\231^i\350\204\216w\267\013-\242\321\274\214\246\3737\226\272\270\033W\271%+\300B\032\2229\223\331\333\205\2303\232\211\261\366b\033\003\250U\231\324+\223\223\327\225\210\362\006\312X{Y\227+\241\362\0330k)lJ{\017\"\274\216V\243f'=\0305\341\000\235!\263y\360e\374\t`\266\026\357\350a\333\241\256\223\014\333-\353P=\227\322\322R\341_\r\264z.\036\276\305;\361g\251`lf\365\355c\037N\275@\313p\345\302\025\345\240B\03578z\212\033ec\000\336\376\303F\337\362\"\271p\346R\240\202\1772\202""\331?6:\313\274"; + PyObject *data = __Pyx_DecompressString(cstring, 1394, 1); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #else /* compression: none (2506 bytes) */ +const char* const bytes = "List[int]Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Optional[Pool]Optional[bool].?add_notedisableenablegcisenabledspacy.spacy.contextlibspacy.errorsspacy.srslyspacy/strings.pyxspacy.symbolsspacy.typingE017E018ErrorsIDSListNAMESOptionalPool__Pyx_PyDict_NextRefSYMBOLS_BY_INTSYMBOLS_BY_STRStringStoreStringStore.__iter__StringStore.__reduce__StringStore._reset_and_loadStringStore.addStringStore.as_intStringStore.as_stringStringStore.from_bytesStringStore.from_diskStringStore.memory_zoneStringStore.to_bytesStringStore.to_diskStringStore.valuesaddallow_transientas_intas_stringasyncio.coroutinesbytes_datachars__class_getitem__cline_in_tracebackclosecontextlibcontextmanager__dict__encodeensure_patherrorsformatfreezefrom_bytesfrom_disk__func__getget_string_idhash_stringhash_valuehashesiint_is_coroutineitems__iter__json_dumpsjson_loadskey_keyskwargs__main__memmemory_zone__module____name__nextpathpopprev__pyx_capi____pyx_vtable____qualname__read_json__reduce___reset_and_loadreturnselfsend__set_name__setdefaultsizespacy.stringssrslystrstr_hashstringstringssymbolsymbols__test__throwto_bytesto_disktransient_hashestypingutf8utf8strutilvaluevalue_typevalueswordwrite_jsonPyObject *(__pyx_t_5spacy_7strings_Utf8Str const *)\000__pyx_t_5spacy_8typedefs_hash_t (PyObject *, int __pyx_skip_dispatch)\000__pyx_t_5spacy_8typedefs_hash_t (char *, int)\000decode_Utf8Str\000hash_string\000hash_utf8\320\004\032\320\0320\3200A\300\031\310!\360\026\000\t\014\2104\210q\330\014\023\2201\330\010\013\320\013\033\2303\230a\330\014\036\230d\240%\240w\250d\260!\340\010\013\210:\220Q\220h\230a\330\014\017\210w\220c\230\021\330\020\027\220~\240Q\240a\340\014\025\220V\2307\240!\2401\330\014\027\220y\240\001\240\030\250\023\250A\250Q\330\014\020\220\r\230Q\230h\240c\250\021\250)\2601\260J\270a\330\r\027\220q\230\010\240\001\330\014\017\210w\220c\230\021\330\020\027\220~\240Q""\240a\330\014\027\220y\240\001\240\030\250\023\250A\250Q\330\014\020\220\r\230Q\230h\240c\250\021\250)\2601\260J\270a\340\014\022\220)\2301\230F\240%\240w\250a\250{\270$\270a\270q\330\010\017\210q\200A\200A\330\0370\260\t\270\021\200A\360\014\000\t\023\220%\220{\240!\2401\330\010\017\210t\2201\220A\330\010\014\320\014\034\230A\230Q\330\010\014\210H\220A\330\014\020\220\004\220A\220V\320\033+\2501\330\010\017\210q\200A\340\010\013\2104\210z\230\021\230%\230q\330\014\023\2201\340\014\023\2204\220q\230\001\320\000,\250A\330\004\014\210F\220'\230\021\230!\330\004\013\2109\220A\220W\230C\230q\240\001\200A\330\010\014\210G\2204\220q\330\010\014\320\014\035\230T\240\021\330\010\014\210H\220H\230A\330\010\014\210E\220\026\220q\330\010\014\320\014\034\230F\240!\330\010\014\210J\220a\330\014\020\220\004\220A\220X\320\035-\250Q\200A\340\010\013\210:\220Q\220e\2301\330\014\023\2201\340\014\023\2204\220q\230\001\200A\330\010\022\220$\220a\220q\330\010\020\220\016\230k\250\026\250v\260Q\200A\360\014\000\t\020\210t\220<\230q\240\001\330\010\030\230\001\230\021\330\010\r\210[\230\001\230\026\230q\200A\360\020\000\t\020\210t\220<\230q\240\001\330\010\022\220%\220z\240\021\240!\330\010\017\210t\2201\220A\330\010\014\320\014\034\230A\230Q\330\010\014\210H\220A\330\014\020\220\004\220A\220V\320\033+\2501\330\010\017\210q\200A\360\n\000\t\020\210u\220K\230w\240a\240q\320\004\030\230\001\360\014\000\t\022\220\021\220&\230\002\230$\230f\240E\250\021\330\010\014\210E\220\025\220a\220t\2306\240\025\240a\330\014\022\220!\2205\230\004\230F\240!\2401\330\010\033\2301\230F\240\"\240D\320(8\270\005\270Q\330\010\014\210E\220\025\220a\220t\320\033+\2505\260\001\330\014\034\230A\230U\240$\320&6\260a\260q\330\010\017\210w\220b\230\001\200\001\360\020\000\005\010\200z\220\021\220%\220q\330\010\013\2103\210a\210u\220C\220q\330\014\023\2201\340\010\021\220\036\230t\2401\240E\250\021\330\010\013\2107\220'\230\021\330\014\023\2201\340\014\024\220C\220w\230a\230q\330\014\023\2209\230A\230W\240C\240q\250""\001\330\t\034\230A\230U\240!\2401\360\014\000\t\020\210q\360\006\000\t\020\210quint32_t (void *, int, uint32_t)\000uint64_t (void *, int, uint64_t)\000hash32\000hash64void *(struct __pyx_t_7preshed_4maps_MapStruct *, __pyx_t_7preshed_4maps_key_t const )\000map_clear"; + PyObject *data = NULL; + CYTHON_UNUSED_VAR(__Pyx_DecompressString); + #endif + PyObject **stringtab = __pyx_mstate->__pyx_string_tab; + Py_ssize_t pos = 0; + for (int i = 0; i < 123; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 19) PyUnicode_InternInPlace(&string); + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + stringtab[i] = string; + pos += bytes_length; + } + for (int i = 123; i < 140; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); + stringtab[i] = string; + pos += bytes_length; + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + Py_XDECREF(data); + for (Py_ssize_t i = 0; i < 140; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 123; + for (Py_ssize_t i=0; i<17; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + } + { + PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 0; + int8_t const cint_constants_1[] = {0}; + for (int i = 0; i < 1; i++) { + numbertab[i] = PyLong_FromLong(cint_constants_1[i - 0]); + if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_number_tab; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_codeobjects ### */ +typedef struct { + unsigned int argcount : 2; + unsigned int num_posonly_args : 1; + unsigned int num_kwonly_args : 1; + unsigned int nlocals : 3; + unsigned int flags : 10; + unsigned int first_line : 9; +} __Pyx_PyCode_New_function_description; +/* NewCodeObj.proto */ +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +); + + +static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { + PyObject* tuple_dedup_map = PyDict_New(); + if (unlikely(!tuple_dedup_map)) return -1; + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 194}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_mem, __pyx_mstate->__pyx_n_u_key}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_memory_zone, __pyx_mstate->__pyx_kp_b_iso88591_A_0, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 286}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_utf8str}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 32}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_str_hash, __pyx_mstate->__pyx_n_u_symbol, __pyx_mstate->__pyx_n_u_chars}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_get_string_id, __pyx_mstate->__pyx_kp_b_iso88591_z_q_3auCq_1_t1E_7_1_Cwaq_9AWCq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 62}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_string}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_hash_string, __pyx_mstate->__pyx_kp_b_iso88591_A_F_9AWCq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 173}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_as_int, __pyx_mstate->__pyx_kp_b_iso88591_A_4z_q_1_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 180}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key}; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_as_string, __pyx_mstate->__pyx_kp_b_iso88591_A_Qe1_1_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 214}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_string, __pyx_mstate->__pyx_n_u_allow_transient, __pyx_mstate->__pyx_n_u_str_hash}; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_add, __pyx_mstate->__pyx_kp_b_iso88591_00A_4q_1_3a_d_wd_Qha_wc_Qa_V7_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 302}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_strings}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_reduce, __pyx_mstate->__pyx_kp_b_iso88591_A_aq_k_vQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 306}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_hashes, __pyx_mstate->__pyx_n_u_transient_hashes}; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_kp_b_iso88591_fE_E_at6_a_5_F_1_1F_D_8_Q_E_at, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 320}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_strings}; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_to_disk, __pyx_mstate->__pyx_kp_b_iso88591_A_t_q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 330}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_strings, __pyx_mstate->__pyx_n_u_prev, __pyx_mstate->__pyx_n_u_word}; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_from_disk, __pyx_mstate->__pyx_kp_b_iso88591_A_t_q_z_t1A_AQ_HA_AV_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 346}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_kwargs}; + __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_to_bytes, __pyx_mstate->__pyx_kp_b_iso88591_A_uKwaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 353}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_bytes_data, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_strings, __pyx_mstate->__pyx_n_u_prev, __pyx_mstate->__pyx_n_u_word}; + __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_from_bytes, __pyx_mstate->__pyx_kp_b_iso88591_A_1_t1A_AQ_HA_AV_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 366}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_strings, __pyx_mstate->__pyx_n_u_string}; + __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_strings_pyx, __pyx_mstate->__pyx_n_u_reset_and_load, __pyx_mstate->__pyx_kp_b_iso88591_A_G4q_T_HHA_E_q_F_Ja_AX_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad; + } + Py_DECREF(tuple_dedup_map); + return 0; + bad: + Py_DECREF(tuple_dedup_map); + return -1; +} +/* #### Code section: init_globals ### */ + +static int __Pyx_InitGlobals(void) { + /* PythonCompatibility.init */ + if (likely(__Pyx_init_co_variables() == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CommonTypesMetaclass.init */ + if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CachedMethodType.init */ + #if CYTHON_COMPILING_IN_LIMITED_API + { + PyObject *typesModule=NULL; + typesModule = PyImport_ImportModule("types"); + if (typesModule) { + __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + } + } // error handling follows + #endif + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CythonFunctionShared.init */ + if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* Generator.init */ + if (likely(__pyx_Generator_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* GetTopmostException (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* TupleAndListFromArray (used by fastcall) */ +#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + Py_ssize_t i; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + for (i = 0; i < n; i++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + return res; +} +#elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\ + !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + return PyObject_RichCompareBool(s1, s2, equals); +#else + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length, length2; + int kind; + void *data1, *data2; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + #endif + length = __Pyx_PyUnicode_GET_LENGTH(s1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length < 0)) return -1; + #endif + length2 = __Pyx_PyUnicode_GET_LENGTH(s2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length2 < 0)) return -1; + #endif + if (length != length2) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + return (equals == Py_EQ); +return_ne: + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(n == -1)) return NULL; + #endif + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + if (s == namei) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; + return kwvalues[i]; + } + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { + Py_ssize_t i, nkwargs; + PyObject *dict; +#if !CYTHON_ASSUME_SAFE_SIZE + nkwargs = PyTuple_Size(kwnames); + if (unlikely(nkwargs < 0)) return NULL; +#else + nkwargs = PyTuple_GET_SIZE(kwnames); +#endif + dict = PyDict_New(); + if (unlikely(!dict)) + return NULL; + for (i=0; itp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall (used by PyObjectCallOneArg) */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API + #if PY_VERSION_HEX < 0x03090000 + #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) + #elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { + PyTypeObject *tp = Py_TYPE(callable); + #if defined(__Pyx_CyFunction_USED) + if (__Pyx_CyFunction_CheckExact(callable)) { + return __Pyx_CyFunction_func_vectorcall(callable); + } + #endif + if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { + return NULL; + } + assert(PyCallable_Check(callable)); + Py_ssize_t offset = tp->tp_vectorcall_offset; + assert(offset > 0); + vectorcallfunc ptr; + memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); + return ptr; +} + #else + #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) + #endif +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if CYTHON_COMPILING_IN_LIMITED_API + return PyObject_Vectorcall(func, args, _nargs, NULL); + #else + vectorcallfunc f = __Pyx_PyVectorcall_Function(func); + if (f) { + return f(func, args, _nargs, NULL); + } + #endif + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* PyObjectCallOneArg (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetAttrStr (used by UnpackUnboundCMethod) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + PyObject *result; + PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + if (unlikely(!selfless_args)) return NULL; + result = PyObject_Call(method, selfless_args, kwargs); + Py_DECREF(selfless_args); + return result; +} +#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { + return _PyObject_Vectorcall + (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames); +} +#else +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { + return +#if PY_VERSION_HEX < 0x03090000 + _PyObject_Vectorcall +#else + PyObject_Vectorcall +#endif + (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames); +} +#endif +static PyMethodDef __Pyx_UnboundCMethod_Def = { + "CythonUnboundCMethod", + __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 + METH_VARARGS | METH_KEYWORDS, +#else + METH_FASTCALL | METH_KEYWORDS, +#endif + NULL +}; +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method, *result=NULL; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + result = method; +#if CYTHON_COMPILING_IN_CPYTHON + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } else +#endif +#if CYTHON_COMPILING_IN_PYPY +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); +#endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); +#endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + result = unbound_method; + } + } +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + if (unlikely(target->method)) { + Py_DECREF(result); + } else +#endif + target->method = result; + return 0; +} + +/* CallUnboundCMethod0 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + if (likely(cfunc->flag == METH_NOARGS)) + return __Pyx_CallCFunction(cfunc, self, NULL); + if (likely(cfunc->flag == METH_FASTCALL)) + return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0); + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL); + if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS))) + return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (cfunc->flag == METH_VARARGS) + return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple); + return __Pyx__CallUnboundCMethod0(cfunc, self); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + PyObject *result; + if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; + result = __Pyx_PyObject_CallOneArg(cfunc->method, self); + return result; +} + +/* py_dict_items (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d); +} + +/* py_dict_values (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d); +} + +/* OwnedDictNext (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) { + PyObject *next = NULL; + if (!*ppos) { + if (pvalue) { + PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p); + if (unlikely(!dictview)) goto bad; + *ppos = PyObject_GetIter(dictview); + Py_DECREF(dictview); + } else { + *ppos = PyObject_GetIter(p); + } + if (unlikely(!*ppos)) goto bad; + } + next = PyIter_Next(*ppos); + if (!next) { + if (PyErr_Occurred()) goto bad; + return 0; + } + if (pkey && pvalue) { + *pkey = __Pyx_PySequence_ITEM(next, 0); + if (unlikely(*pkey)) goto bad; + *pvalue = __Pyx_PySequence_ITEM(next, 1); + if (unlikely(*pvalue)) goto bad; + Py_DECREF(next); + } else if (pkey) { + *pkey = next; + } else { + assert(pvalue); + *pvalue = next; + } + return 1; + bad: + Py_XDECREF(next); +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 + PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef"); +#else + PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef); +#endif + if (pkey) *pkey = NULL; + if (pvalue) *pvalue = NULL; + return 0; +} +#else // !CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) { + int result = PyDict_Next(p, ppos, pkey, pvalue); + if (likely(result == 1)) { + if (pkey) Py_INCREF(*pkey); + if (pvalue) Py_INCREF(*pvalue); + } + return result; +} +#endif + +/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); +} + +/* CallUnboundCMethod2 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, args, 2); + } + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *result = NULL; + PyObject *args = PyTuple_New(2); + if (unlikely(!args)) return NULL; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + return result; + } +#endif + { + PyObject *args[4] = {NULL, self, arg1, arg2}; + return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } +} + +/* ParseKeywordsImpl (used by ParseKeywords) */ +static int __Pyx_ValidateDuplicatePosArgs( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char* function_name) +{ + PyObject ** const *name = argnames; + while (name != first_kw_arg) { + PyObject *key = **name; + int found = PyDict_Contains(kwds, key); + if (unlikely(found)) { + if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; + } + name++; + } + return 0; +bad: + return -1; +} +#if CYTHON_USE_UNICODE_INTERNALS +static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) { + int kind; + Py_ssize_t len = PyUnicode_GET_LENGTH(s1); + if (len != PyUnicode_GET_LENGTH(s2)) return 0; + kind = PyUnicode_KIND(s1); + if (kind != PyUnicode_KIND(s2)) return 0; + const void *data1 = PyUnicode_DATA(s1); + const void *data2 = PyUnicode_DATA(s2); + return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0); +} +#endif +static int __Pyx_MatchKeywordArg_str( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + #if CYTHON_USE_UNICODE_INTERNALS + Py_hash_t key_hash = ((PyASCIIObject*)key)->hash; + if (unlikely(key_hash == -1)) { + key_hash = PyObject_Hash(key); + if (unlikely(key_hash == -1)) + goto bad; + } + #endif + name = first_kw_arg; + while (*name) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) { + *index_found = (size_t) (name - argnames); + return 1; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + *index_found = (size_t) (name - argnames); + return 1; + } + } + #endif + name++; + } + name = argnames; + while (name != first_kw_arg) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) { + if (__Pyx_UnicodeKeywordsEqual(name_str, key)) + goto arg_passed_twice; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + if (unlikely(name_str == key)) goto arg_passed_twice; + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + } + #endif + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +bad: + return -1; +} +static int __Pyx_MatchKeywordArg_nostr( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; + name = first_kw_arg; + while (*name) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (cmp == 1) { + *index_found = (size_t) (name - argnames); + return 1; + } + if (unlikely(cmp == -1)) goto bad; + name++; + } + name = argnames; + while (name != first_kw_arg) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (unlikely(cmp != 0)) { + if (cmp == 1) goto arg_passed_twice; + else goto bad; + } + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +bad: + return -1; +} +static CYTHON_INLINE int __Pyx_MatchKeywordArg( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + return likely(PyUnicode_CheckExact(key)) ? + __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) : + __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name); +} +static void __Pyx_RejectUnknownKeyword( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char *function_name) +{ + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; + #else + Py_ssize_t pos = 0; + #endif + PyObject *key = NULL; + __Pyx_BEGIN_CRITICAL_SECTION(kwds); + while ( + #if CYTHON_AVOID_BORROWED_REFS + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL) + #else + PyDict_Next(kwds, &pos, &key, NULL) + #endif + ) { + PyObject** const *name = first_kw_arg; + while (*name && (**name != key)) name++; + if (!*name) { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp != 1) { + if (cmp == 0) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + break; + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + } + __Pyx_END_CRITICAL_SECTION(); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); + #endif + assert(PyErr_Occurred()); +} +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t extracted = 0; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + name = first_kw_arg; + while (*name && num_kwargs > extracted) { + PyObject * key = **name; + PyObject *value; + int found = 0; + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + found = PyDict_GetItemRef(kwds, key, &value); + #else + value = PyDict_GetItemWithError(kwds, key); + if (value) { + Py_INCREF(value); + found = 1; + } else { + if (unlikely(PyErr_Occurred())) goto bad; + } + #endif + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + extracted++; + } + name++; + } + if (num_kwargs > extracted) { + if (ignore_unknown_kwargs) { + if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1)) + goto bad; + } else { + __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name); + goto bad; + } + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t len; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + if (PyDict_Update(kwds2, kwds) < 0) goto bad; + name = first_kw_arg; + while (*name) { + PyObject *key = **name; + PyObject *value; +#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)) + int found = PyDict_Pop(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int found = PyDict_GetItemRef(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad; + } +#else + #if CYTHON_COMPILING_IN_CPYTHON + value = _PyDict_Pop(kwds2, key, kwds2); + #else + value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2); + #endif + if (value == kwds2) { + Py_DECREF(value); + } else { + if (unlikely(!value)) goto bad; + values[name-argnames] = value; + } +#endif + name++; + } + len = PyDict_Size(kwds2); + if (len > 0) { + return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name); + } else if (unlikely(len == -1)) { + goto bad; + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject *key = NULL; + PyObject** const * name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) { +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); +#else + key = __Pyx_PyTuple_GET_ITEM(kwds, pos); +#endif +#if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!key)) goto bad; +#endif + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + PyObject *value = kwvalues[pos]; + values[name-argnames] = __Pyx_NewRef(value); + } else { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp == 1) { + PyObject *value = kwvalues[pos]; + values[index_found] = __Pyx_NewRef(value); + } else { + if (unlikely(cmp == -1)) goto bad; + if (kwds2) { + PyObject *value = kwvalues[pos]; + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else if (!ignore_unknown_kwargs) { + goto invalid_keyword; + } + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + key = NULL; + #endif + } + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + goto bad; +bad: + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(key); + #endif + return -1; +} + +/* ParseKeywords */ +static int __Pyx_ParseKeywords( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) + return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); + else if (kwds2) + return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name); + else + return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); +} + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName (used by GetModuleGlobalName) */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, + "name '%U' is not defined", name); + } + return result; +} + +/* PyDictVersioning (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + if (!PyErr_Occurred()) + PyErr_SetNone(PyExc_NameError); + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } + PyErr_Clear(); +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return result; + } +#else + result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyObjectFastCallMethod */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { + PyObject *result; + PyObject *attr = PyObject_GetAttr(args[0], name); + if (unlikely(!attr)) + return NULL; + result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); + Py_DECREF(attr); + return result; +} +#endif + +/* ArgTypeTestFunc (used by ArgTypeTest) */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode; + int from_annotation_subclass = 0; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (!exact) { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } else if (exact == 2) { + if (__Pyx_TypeCheck(obj, type)) { + from_annotation_subclass = 1; + extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately; + } + } + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")" +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + "%s%U" +#endif + , name, type_name, obj_type_name +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + , (from_annotation_subclass ? ". " : ""), extra_info +#endif + ); +#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + if (exact == 2 && from_annotation_subclass) { + PyObject *res; + PyObject *vargs[2]; + vargs[0] = PyErr_GetRaisedException(); + vargs[1] = extra_info; + res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL); + Py_XDECREF(res); + PyErr_SetRaisedException(vargs[0]); + } +#endif + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* decode_c_string */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + const char* cstring, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { + Py_ssize_t length; + if (unlikely((start < 0) | (stop < 0))) { + size_t slen = strlen(cstring); + if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, + "c-string too long to convert to Python"); + return NULL; + } + length = (Py_ssize_t) slen; + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + } + if (unlikely(stop <= start)) + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode); + length = stop - start; + cstring += start; + if (decode_func) { + return decode_func(cstring, length, errors); + } else { + return PyUnicode_Decode(cstring, length, encoding, errors); + } +} + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b, int b_is_constant) { + long q = a / b; + long r = a - q*b; + long adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* ModInt[long] */ +static CYTHON_INLINE long __Pyx_mod_long(long a, long b, int b_is_constant) { + long r = a % b; + long adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return r + adapt_python * b; +} + +/* PyObjectVectorCallKwBuilder (used by PyObjectVectorCallMethodKwBuilder) */ +#if CYTHON_VECTORCALL +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_PyObject_FastCallDict; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + args[n] = value; + return 0; +} +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_VectorcallBuilder_AddArgStr; + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); +} +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + PyObject *pyKey = PyUnicode_FromString(key); + if (!pyKey) return -1; + return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); +} +#else // CYTHON_VECTORCALL +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return PyDict_SetItem(builder, key, value); +} +#endif + +/* PyObjectVectorCallMethodKwBuilder */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) { + PyObject *result; + PyObject *obj = PyObject_GetAttr(args[0], name); + if (unlikely(!obj)) + return NULL; + result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames); + Py_DECREF(obj); + return result; +} +#endif + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* RaiseException */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); +#elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#endif + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* RejectKeywords */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) { + PyObject *key = NULL; + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) { + key = __Pyx_PySequence_ITEM(kwds, 0); + } else { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; +#else + Py_ssize_t pos = 0; +#endif +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return; +#endif + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL); +#if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); +#endif + } + if (likely(key)) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + Py_DECREF(key); + } +} + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) { + Py_INCREF(v); + return PyList_SetItem(o, n, v); + } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old; + Py_INCREF(v); + old = PyList_GET_ITEM(o, n); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 0; + } + } else +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_SetItem(o, i, v); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v); +} + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + const char* function_name, + PyObject *kw) +{ +#if CYTHON_COMPILING_IN_PYPY && !defined(PyArg_ValidateKeywordArguments) + CYTHON_UNUSED_VAR(function_name); + CYTHON_UNUSED_VAR(kw); + return 0; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { +#if PY_VERSION_HEX >= 0x03090000 + CYTHON_UNUSED_VAR(function_name); +#else + Py_ssize_t kwsize; + #if CYTHON_ASSUME_SAFE_SIZE + kwsize = PyTuple_GET_SIZE(kw); + #else + kwsize = PyTuple_Size(kw); + if (unlikely(kwsize < 0)) return -1; + #endif + for (Py_ssize_t pos = 0; pos < kwsize; pos++) { + PyObject* key = NULL; + #if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); + #else + key = PyTuple_GetItem(kw, pos); + if (unlikely(!key)) return -1; + #endif + if (unlikely(!PyUnicode_Check(key))) { + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return -1; + } + } +#endif + } else { + if (unlikely(!PyArg_ValidateKeywordArguments(kw))) return -1; + } + return 0; +#endif +} + +/* AllocateExtensionType */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) { + if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc); + return alloc_func(t, 0); + } else { + newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc); + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) { + PyObject *new_str = PyUnicode_FromString("__new__"); + if (likely(new_str)) { + PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL); + Py_DECREF(new_str); + return o; + } else + return NULL; + } else + #endif + return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0); + } +} + +/* CallTypeTraverse */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) { + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000 + if (__Pyx_get_runtime_version() < 0x03090000) return 0; + #endif + if (!always_call) { + PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*); + unsigned long flags = PyType_GetFlags(base); + if (flags & Py_TPFLAGS_HEAPTYPE) { + return 0; + } + } + Py_VISIT((PyObject*)Py_TYPE(o)); + return 0; +} +#endif + +/* FunctionExport */ +static int __Pyx_ExportFunction(PyObject *api_dict, const char *name, void (*f)(void), const char *sig) { + PyObject *cobj; + union { + void (*fp)(void); + void *p; + } tmp; + tmp.fp = f; + cobj = PyCapsule_New(tmp.p, sig, 0); + if (!cobj) + goto bad; + if (PyDict_SetItemString(api_dict, name, cobj) < 0) + goto bad; + Py_DECREF(cobj); + return 0; +bad: + Py_XDECREF(cobj); + return -1; +} + +/* GetApiDict */ +static PyObject *__Pyx_ApiExport_GetApiDict(void) { + PyObject *d; + if (__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_capi, &d) == -1) + return NULL; + if (!d) { + d = PyDict_New(); + if (!d) + goto bad; + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_pyx_capi, d) < 0) + goto bad; + } + return d; +bad: + Py_XDECREF(d); + return NULL; +} + +/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static Py_ssize_t __Pyx_GetTypeDictOffset(void) { + PyObject *tp_dictoffset_o; + Py_ssize_t tp_dictoffset; + tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__"); + if (unlikely(!tp_dictoffset_o)) return -1; + tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o); + Py_DECREF(tp_dictoffset_o); + if (unlikely(tp_dictoffset == 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' doesn't have a dictoffset"); + return -1; + } else if (unlikely(tp_dictoffset < 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' has an unexpected negative dictoffset. " + "Please report this as Cython bug"); + return -1; + } + return tp_dictoffset; +} +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) { + static Py_ssize_t tp_dictoffset = 0; + if (unlikely(tp_dictoffset == 0)) { + tp_dictoffset = __Pyx_GetTypeDictOffset(); + if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) { + tp_dictoffset = 0; // try again next time? + return NULL; + } + } + return *(PyObject**)((char*)tp + tp_dictoffset); +} +#endif + +/* SetItemOnTypeDict (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) { + int result; + PyObject *tp_dict; +#if CYTHON_COMPILING_IN_LIMITED_API + tp_dict = __Pyx_GetTypeDict(tp); + if (unlikely(!tp_dict)) return -1; +#else + tp_dict = tp->tp_dict; +#endif + result = PyDict_SetItem(tp_dict, k, v); + if (likely(!result)) { + PyType_Modified(tp); + if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) { + PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL); + if (!setNameResult) return -1; + Py_DECREF(setNameResult); + } + } + return result; +} + +/* FixUpExtensionType */ +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if __PYX_LIMITED_VERSION_HEX > 0x030900B1 + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#else + const PyType_Slot *slot = spec->slots; + int changed = 0; +#if !CYTHON_COMPILING_IN_LIMITED_API + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { +#if !CYTHON_COMPILING_IN_CPYTHON + const +#endif // !CYTHON_COMPILING_IN_CPYTHON) + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_vectorcall_offset = memb->offset; + changed = 1; + } +#endif // CYTHON_METH_FASTCALL +#if !CYTHON_COMPILING_IN_PYPY + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } +#endif // !CYTHON_COMPILING_IN_PYPY + } + memb++; + } + } +#endif // !CYTHON_COMPILING_IN_LIMITED_API +#if !CYTHON_COMPILING_IN_PYPY + slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_getset) + slot++; + if (slot && slot->slot == Py_tp_getset) { + PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc; + while (getset && getset->name) { + if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) { + PyObject *descr = PyDescr_NewGetSet(type, getset); + if (unlikely(!descr)) + return -1; + #if CYTHON_COMPILING_IN_LIMITED_API + PyObject *pyname = PyUnicode_FromString(getset->name); + if (unlikely(!pyname)) { + Py_DECREF(descr); + return -1; + } + int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr); + Py_DECREF(pyname); + #else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + #endif + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } + ++getset; + } + } +#else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#endif // !CYTHON_COMPILING_IN_PYPY + if (changed) + PyType_Modified(type); +#endif // PY_VERSION_HEX > 0x030900B1 + return 0; +} + +/* PyObjectCallNoArg (used by PyObjectCallMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg[2] = {NULL, NULL}; + return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod (used by PyObjectCallMethod0) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } +#endif + *method = attr; + return 0; +} +#endif + +/* PyObjectCallMethod0 (used by PyType_Ready) */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[1] = {obj}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_CallNoArg; + return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +#endif +} + +/* ValidateBasesTuple (used by PyType_Ready) */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_SIZE + n = PyTuple_GET_SIZE(bases); +#else + n = PyTuple_Size(bases); + if (unlikely(n < 0)) return -1; +#endif + for (i = 1; i < n; i++) + { + PyTypeObject *b; +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + if (dictoffset == 0) + { + Py_ssize_t b_dictoffset = 0; +#if CYTHON_USE_TYPE_SLOTS + b_dictoffset = b->tp_dictoffset; +#else + PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__"); + if (!py_b_dictoffset) goto dictoffset_return; + b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset); + Py_DECREF(py_b_dictoffset); + if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return; +#endif + if (b_dictoffset) { + { + __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); + } +#if !CYTHON_USE_TYPE_SLOTS + dictoffset_return: +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + } +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + } + return 0; +} +#endif + +/* PyType_Ready */ +CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) { + while (t) { + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases) { + return 1; + } + t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*); + } + return 0; +} +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + if (!__Pyx_PyType_HasMultipleInheritance(t)) { + return PyType_Ready(t); + } + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\ + !CYTHON_COMPILING_IN_GRAAL + gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* GetVTable (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i=0; + Py_ssize_t size; + void** base_vtables; + __Pyx_TypeName tp_base_name = NULL; + __Pyx_TypeName base_name = NULL; + void* unknown = (void*)-1; + PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); + int base_depth = 0; + { + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (base) { + base_depth += 1; + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; +#if CYTHON_COMPILING_IN_LIMITED_API + size = PyTuple_Size(bases); + if (size < 0) goto other_failure; +#else + size = PyTuple_GET_SIZE(bases); +#endif + for (i = 1; i < size; i++) { + PyObject *basei; + void* base_vtable; +#if CYTHON_AVOID_BORROWED_REFS + basei = PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#else + basei = PyTuple_GET_ITEM(bases, i); +#endif + base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + if (base_vtable != NULL) { + int j; + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + } + PyErr_Clear(); + PyMem_Free(base_vtables); + return 0; +bad: + { + PyTypeObject* basei = NULL; + PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); +#if CYTHON_AVOID_BORROWED_REFS + basei = (PyTypeObject*)PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = (PyTypeObject*)PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#else + basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); +#endif + base_name = __Pyx_PyType_GetFullyQualifiedName(basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + } + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); +#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +really_bad: // bad has failed! +#endif + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +other_failure: +#endif + PyMem_Free(base_vtables); + return -1; +} + +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_2_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size) +{ + PyObject *result = 0; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) + PyObject *py_basicsize; + PyObject *py_itemsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) ) + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; +#else + if (size == 0) { + return (PyTypeObject *)result; + } + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize+itemsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_1 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_1 && (size_t)basicsize > size) { + if (PyErr_WarnFormat(NULL, 0, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize) < 0) { + goto bad; + } + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; +} +#endif + +/* PxdImportShared (used by FunctionImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(PyObject *module, const char *name, void **p, const char *sig, const char *what) { + PyObject *d = 0; + PyObject *cobj = 0; + d = PyObject_GetAttrString(module, "__pyx_capi__"); + if (!d) + goto bad; +#if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000) + PyDict_GetItemStringRef(d, name, &cobj); +#else + cobj = PyDict_GetItemString(d, name); + Py_XINCREF(cobj); +#endif + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%.200s does not export expected C %.8s %.200s", + PyModule_GetName(module), what, name); + goto bad; + } + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C %.8s %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", + what, PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); + goto bad; + } + *p = PyCapsule_GetPointer(cobj, sig); + if (!(*p)) + goto bad; + Py_DECREF(d); + Py_DECREF(cobj); + return 0; +bad: + Py_XDECREF(d); + Py_XDECREF(cobj); + return -1; +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* HasAttr (used by ImportImpl) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!PyUnicode_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (!r) { + return (unlikely(PyErr_Occurred())) ? -1 : 0; + } else { + Py_DECREF(r); + return 1; + } +} +#endif + +/* ImportImpl (used by Import) */ +static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) { + PyObject *imported_module = PyImport_GetModule(qualname); + if (unlikely(!imported_module)) { + *module = NULL; + if (PyErr_Occurred()) { + return -1; + } + return 0; + } + *module = imported_module; + return 1; +} +static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) { + PyObject *imported_module; + PyObject *top_level_package_name; + Py_ssize_t i; + int status, module_found; + Py_ssize_t dot_index; + module_found = __Pyx__Import_GetModule(qualname, &imported_module); + if (unlikely(!module_found || module_found == -1)) { + *module = NULL; + return module_found; + } + if (imported_names) { + for (i = 0; i < len_imported_names; i++) { + PyObject *imported_name = imported_names[i]; +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 + int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name); +#else + int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name); + if (unlikely(has_imported_attribute == -1)) goto error; +#endif + if (!has_imported_attribute) { + goto not_found; + } + } + *module = imported_module; + return 1; + } + dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1); + if (dot_index == -1) { + *module = imported_module; + return 1; + } + if (unlikely(dot_index == -2)) goto error; + top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index); + if (unlikely(!top_level_package_name)) goto error; + Py_DECREF(imported_module); + status = __Pyx__Import_GetModule(top_level_package_name, module); + Py_DECREF(top_level_package_name); + return status; +error: + Py_DECREF(imported_module); + *module = NULL; + return -1; +not_found: + Py_DECREF(imported_module); + *module = NULL; + return 0; +} +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *from_list = 0; + int module_found; + if (!qualname) { + qualname = name; + } + module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module); + if (likely(module_found == 1)) { + return module; + } else if (unlikely(module_found == -1)) { + return NULL; + } + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + if (imported_names) { +#if CYTHON_COMPILING_IN_CPYTHON + from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names); + if (unlikely(!from_list)) + goto bad; +#else + from_list = PyList_New(len_imported_names); + if (unlikely(!from_list)) goto bad; + for (Py_ssize_t i=0; i__pyx_d, level); +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__2); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\ + CYTHON_COMPILING_IN_GRAAL + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); + } + return value; +} + +/* dict_setdefault (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + PyObject *args[] = {d, key, default_value}; + value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#elif CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#else + value = PyDict_SetDefault(d, key, default_value); + if (unlikely(!value)) return NULL; + Py_INCREF(value); +#endif + return value; +} + +/* AddModuleRef (used by FetchSharedCythonModule) */ +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { + PyObject *module_dict = PyImport_GetModuleDict(); + PyObject *m; + if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { + return NULL; + } + if (m != NULL && PyModule_Check(m)) { + return m; + } + Py_XDECREF(m); + m = PyModule_NewObject(name); + if (m == NULL) + return NULL; + if (PyDict_CheckExact(module_dict)) { + PyObject *new_m; + (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); + Py_DECREF(m); + return new_m; + } else { + if (PyObject_SetItem(module_dict, name, m) != 0) { + Py_DECREF(m); + return NULL; + } + return m; + } + } + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *py_name = PyUnicode_FromString(name); + if (!py_name) return NULL; + PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); + Py_DECREF(py_name); + return module; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } +#endif + +/* FetchSharedCythonModule (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME); +} + +/* FetchCommonType (used by CommonTypesMetaclass) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases); + if (result && metaclass) { + PyObject *old_tp = (PyObject*)Py_TYPE(result); + Py_INCREF((PyObject*)metaclass); +#if __PYX_LIMITED_VERSION_HEX >= 0x03090000 + Py_SET_TYPE(result, metaclass); +#else + result->ob_type = metaclass; +#endif + Py_DECREF(old_tp); + } + return result; +} +#else +#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b) +#endif +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t expected_basicsize) { + Py_ssize_t basicsize; + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (expected_basicsize == 0) { + return 0; // size is inherited, nothing useful to check + } +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) return -1; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = NULL; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; +#else + basicsize = ((PyTypeObject*) cached_type)->tp_basicsize; +#endif + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name; + int get_item_ref_result; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + py_object_name = PyUnicode_FromString(object_name); + if (!py_object_name) return NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) goto done; + abi_module_dict = PyModule_GetDict(abi_module); + if (!abi_module_dict) goto done; + get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type); + if (get_item_ref_result == 1) { + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else if (unlikely(get_item_ref_result == -1)) { + goto bad; + } + cached_type = __Pyx_PyType_FromMetaclass( + metaclass, + CYTHON_USE_MODULE_STATE ? module : abi_module, + spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type); + if (unlikely(new_cached_type != cached_type)) { + if (unlikely(!new_cached_type)) goto bad; + Py_DECREF(cached_type); + cached_type = new_cached_type; + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else { + Py_DECREF(new_cached_type); + } +done: + Py_XDECREF(abi_module); + Py_DECREF(py_object_name); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +/* CommonTypesMetaclass (used by CythonFunctionShared) */ +static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) { + return PyUnicode_FromString(__PYX_ABI_MODULE_NAME); +} +#if __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) { + PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types"); + return NULL; +} +static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) { + PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable"); + return -1; +} +#endif +static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = { + {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = { + {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset}, + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr}, + #endif + {0, 0} +}; +static PyType_Spec __pyx_CommonTypesMetaclass_spec = { + __PYX_TYPE_MODULE_PREFIX "_common_types_metatype", + 0, + 0, + Py_TPFLAGS_IMMUTABLETYPE | + Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT, + __pyx_CommonTypesMetaclass_slots +}; +static int __pyx_CommonTypesMetaclass_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + PyObject *bases = PyTuple_Pack(1, &PyType_Type); + if (unlikely(!bases)) { + return -1; + } + mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases); + Py_DECREF(bases); + if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) { + return -1; + } + return 0; +} + +/* PyMethodNew (used by CythonFunctionShared) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *result; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + { + PyObject *args[] = {func, self}; + result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL); + } + #else + result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL); + #endif + return result; +} +#else +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#endif + +/* PyVectorcallFastCallDict (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i; + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos; + #else + Py_ssize_t pos; + #endif + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + #if !CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t nkw = PyDict_Size(kw); + if (unlikely(nkw == -1)) return NULL; + #else + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + #endif + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = 0; + i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) { + keys_are_strings &= + #if CYTHON_COMPILING_IN_LIMITED_API + PyType_GetFlags(Py_TYPE(key)); + #else + Py_TYPE(key)->tp_flags; + #endif + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup; + #else + PyTuple_SET_ITEM(kwnames, i, key); + #endif + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(pos); + #endif + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + Py_ssize_t kw_size = + likely(kw == NULL) ? + 0 : +#if !CYTHON_ASSUME_SAFE_SIZE + PyDict_Size(kw); +#else + PyDict_GET_SIZE(kw); +#endif + if (kw_size == 0) { + return vc(func, args, nargs, NULL); + } +#if !CYTHON_ASSUME_SAFE_SIZE + else if (unlikely(kw_size == -1)) { + return NULL; + } +#endif + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif + +/* CythonFunctionShared (used by CythonFunction) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) { + if (__Pyx_CyFunction_Check(func)) { + return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; + } else if (PyCFunction_Check(func)) { + return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; + } + return 0; +} +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) { + int result; + PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func); + if (unlikely(!newFunc)) { + PyErr_Clear(); // It's only an optimization, so don't throw an error + return 0; + } + result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc); + Py_DECREF(newFunc); + return result; + } + return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc); +} +#else +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if (PyMethod_Check(func)) { + func = PyMethod_GET_FUNCTION(func); + } + return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +} +#endif +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + PyObject *result; + CYTHON_UNUSED_VAR(closure); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_doc_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#else + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_name_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_name, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + PyObject *result; + __Pyx_BEGIN_CRITICAL_SECTION(op); + Py_INCREF(op->func_qualname); + result = op->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +#endif +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_defaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_kwdefaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_annotations_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) { + int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; + if (is_coroutine) { + PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(is_coroutine_value)) { + return is_coroutine_value; + } +ignore: + PyErr_Clear(); + } + return __Pyx_PyBool_FromLong(is_coroutine); +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + result = __Pyx_CyFunction_get_is_coroutine_value(op); + if (unlikely(!result)) + return NULL; + __Pyx_BEGIN_CRITICAL_SECTION(op); + if (op->func_is_coroutine) { + Py_DECREF(result); + result = __Pyx_NewRef(op->func_is_coroutine); + } else { + op->func_is_coroutine = __Pyx_NewRef(result); + } + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, message, size); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + name, message, size); +#endif +} +static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s", + py_name, message); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s", + name, message); +#endif +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, +#else + {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, +#endif + {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#endif +#if CYTHON_METH_FASTCALL +#if CYTHON_COMPILING_IN_LIMITED_API + {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else + {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(args); + __Pyx_BEGIN_CRITICAL_SECTION(m); + Py_INCREF(m->func_qualname); + result = m->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + op->func_dict = NULL; +#endif + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func_dict); +#elif PY_VERSION_HEX < 0x030d0000 + _PyObject_ClearManagedDict((PyObject*)m); +#else + PyObject_ClearManagedDict((PyObject*)m); +#endif + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + Py_CLEAR(m->defaults); + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + { + int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg); + if (e) return e; + } + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func_dict); +#else + { + int e = +#if PY_VERSION_HEX < 0x030d0000 + _PyObject_VisitManagedDict +#else + PyObject_VisitManagedDict +#endif + ((PyObject*)m, visit, arg); + if (e != 0) return e; + } +#endif + __Pyx_VISIT_CONST(m->func_name); + __Pyx_VISIT_CONST(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + __Pyx_VISIT_CONST(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + Py_VISIT(m->defaults); + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ + PyObject *repr; + __Pyx_BEGIN_CRITICAL_SECTION(op); + repr = PyUnicode_FromFormat("", + op->func_qualname, (void *)op); + __Pyx_END_CRITICAL_SECTION(); + return repr; +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes no arguments", size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes exactly one argument", size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } + __Pyx_CyFunction_raise_type_error( + (__pyx_CyFunctionObject*)func, "takes no keyword arguments"); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_SIZE + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(argc < 0)) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "needs an argument"); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "takes no keyword arguments"); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes no arguments", nargs); + return NULL; + } + return meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes exactly one argument", nargs); + return NULL; + } + return meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + #if PY_VERSION_HEX < 0x030e00A6 + size_t nargs_value = (size_t) nargs; + #else + Py_ssize_t nargs_value = nargs; + #endif + return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames); +} +#endif +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if CYTHON_METH_FASTCALL +#if defined(Py_TPFLAGS_HAVE_VECTORCALL) + Py_TPFLAGS_HAVE_VECTORCALL | +#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif +#endif // CYTHON_METH_FASTCALL +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_DICT | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +static int __pyx_CyFunction_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL); + if (unlikely(mstate->__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type); + if (unlikely(!m->defaults)) + return NULL; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* GetNameInClass */ +static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) { + PyObject *result; + PyObject *dict; + assert(PyType_Check(nmspace)); +#if CYTHON_USE_TYPE_SLOTS + dict = ((PyTypeObject*)nmspace)->tp_dict; + Py_XINCREF(dict); +#else + dict = PyObject_GetAttr(nmspace, __pyx_mstate_global->__pyx_n_u_dict); +#endif + if (likely(dict)) { + result = PyObject_GetItem(dict, name); + Py_DECREF(dict); + if (result) { + return result; + } + } + PyErr_Clear(); + __Pyx_GetModuleGlobalNameUncached(result, name); + return result; +} + +/* CLineInTraceback (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) +#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); +#else +PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { + PyObject **dict_ptr = _PyObject_GetDictPtr(o); + return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; +} +#endif +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline = NULL; + PyObject *ptype, *pvalue, *ptraceback; + PyObject *cython_runtime_dict; + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, cython_runtime_dict, + __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) + } + if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + Py_XDECREF(use_cline); + Py_XDECREF(cython_runtime_dict); + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache (used by AddTraceback) */ +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { + __Pyx_CachedCodeObjectType* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!code_cache->entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { + return NULL; + } + code_object = code_cache->entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__find_code_object; + return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); + if (old_count < 0) { + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); + return NULL; + } +#endif + __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); +#endif + return result; +#endif +} +static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) +{ + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + code_cache->entries = entries; + code_cache->max_count = 64; + code_cache->count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { + __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_INCREF(code_object); + Py_DECREF(tmp); + return; + } + if (code_cache->count == code_cache->max_count) { + int new_max = code_cache->max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + code_cache->entries = entries; + code_cache->max_count = new_max; + } + for (i=code_cache->count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + code_cache->count++; + Py_INCREF(code_object); +} +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__insert_code_object; + return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type expected = 0; + if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { + return; + } +#endif + __pyx__insert_code_object(code_cache, code_line, code_object); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); +#endif +#endif +} + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!code_object) { + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + } else { + py_funcname = PyUnicode_FromString(funcname); + } + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); + } else { + dict = PyDict_New(); + } + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + } + py_code = PyCode_NewEmpty(filename, funcname, py_line); + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} +#endif + +/* CIntFromPyVerify */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CIntFromPy */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyLong_As_uint64_t(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint64_t val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(uint64_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((uint64_t) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (uint64_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(uint64_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint64_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + int val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (int) -1; + val = __Pyx_PyLong_As_int(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(int) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + int val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (int) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = v; + } + v = NULL; + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((int) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (int) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static __Pyx_TypeName +__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) +{ + PyObject *module = NULL, *name = NULL, *result = NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_qualname); + #else + name = PyType_GetQualName(tp); + #endif + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; + module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_module); + if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; + if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { + result = name; + name = NULL; + goto done; + } + result = PyUnicode_FromFormat("%U.%U", module, name); + if (unlikely(result == NULL)) goto bad; + done: + Py_XDECREF(name); + Py_XDECREF(module); + return result; + bad: + PyErr_Clear(); + if (name) { + result = name; + name = NULL; + } else { + result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__3); + } + goto done; +} +#endif + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + long val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (long) -1; + val = __Pyx_PyLong_As_long(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + long val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (long) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (long) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = v; + } + v = NULL; + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((long) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (long) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); + for (i=0; i>= 8; + ++i; + } + __Pyx_cached_runtime_version = version; + } +} +#endif +static unsigned long __Pyx_get_runtime_version(void) { +#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + return Py_Version & ~0xFFUL; +#else + return __Pyx_cached_runtime_version; +#endif +} + +/* SwapException (used by CoroutineBase) */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* IterNextPlain (used by CoroutineBase) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) { + if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache)) + __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next); + return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) { +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + PyObject *result; + PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI(); + if (unlikely(!next)) return NULL; + result = PyObject_CallFunctionObjArgs(next, iterator, NULL); + return result; +#else + (void)__Pyx_GetBuiltinName; // only for early limited API + iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator); + assert(iternext); + return iternext(iterator); +#endif +} + +/* PyObjectCall2Args (used by PyObjectCallMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectCallMethod1 (used by CoroutineBase) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +#endif +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +#endif +} + +/* ReturnWithStopIteration (used by CoroutineBase) */ +static void __Pyx__ReturnWithStopIteration(PyObject* value, int async); +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) { + if (value == Py_None) { + if (async || !iternext) + PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration); + return; + } + __Pyx__ReturnWithStopIteration(value, async); +} +static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) { +#if CYTHON_COMPILING_IN_CPYTHON + __Pyx_PyThreadState_declare +#endif + PyObject *exc; + PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration; +#if CYTHON_COMPILING_IN_CPYTHON + if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) { + if (PY_VERSION_HEX >= (0x030e00A1)) { + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + } else { + PyObject *args_tuple = PyTuple_New(1); + if (unlikely(!args_tuple)) return; + Py_INCREF(value); + PyTuple_SET_ITEM(args_tuple, 0, value); + exc = PyObject_Call(exc_type, args_tuple, NULL); + Py_DECREF(args_tuple); + } + if (unlikely(!exc)) return; + } else { + Py_INCREF(value); + exc = value; + } + #if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + #if CYTHON_USE_EXC_INFO_STACK + if (!__pyx_tstate->exc_info->exc_value) + #else + if (!__pyx_tstate->exc_type) + #endif + { + Py_INCREF(exc_type); + __Pyx_ErrRestore(exc_type, exc, NULL); + return; + } + #endif +#else + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + if (unlikely(!exc)) return; +#endif + PyErr_SetObject(exc_type, exc); + Py_DECREF(exc); +} + +/* CoroutineBase (used by Generator) */ +#if !CYTHON_COMPILING_IN_LIMITED_API +#include +#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#endif // CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void +__Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) { +#if CYTHON_USE_AM_SEND + gen->yieldfrom_am_send = NULL; +#endif + Py_CLEAR(gen->yieldfrom); +} +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + CYTHON_UNUSED_VAR(__pyx_tstate); + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (likely(et == PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + value = Py_None; + } + else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); + if (unlikely(!value)) goto limited_api_failure; + #else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + #endif + Py_DECREF(ev); + } + else if (unlikely(PyTuple_Check(ev))) { + Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(tuple_size < 0)) { + Py_XDECREF(tb); + Py_DECREF(ev); + Py_DECREF(et); + return -1; + } + #endif + if (tuple_size >= 1) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + value = PyTuple_GET_ITEM(ev, 0); + Py_INCREF(value); +#elif CYTHON_ASSUME_SAFE_MACROS + value = PySequence_ITEM(ev, 0); +#else + value = PySequence_GetItem(ev, 0); + if (!value) goto limited_api_failure; +#endif + } else { + Py_INCREF(Py_None); + value = Py_None; + } + Py_DECREF(ev); + } + else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { + value = ev; + } + if (likely(value)) { + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = value; + return 0; + } + } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); +#else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); +#endif + Py_DECREF(ev); +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!value)) return -1; +#endif + *pvalue = value; + return 0; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS + limited_api_failure: + Py_XDECREF(et); + Py_XDECREF(tb); + Py_XDECREF(ev); + return -1; +#endif +} +static CYTHON_INLINE +__Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) { + if (*retval) { + return PYGEN_NEXT; + } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) { + return PYGEN_RETURN; + } else { + return PYGEN_ERROR; + } +} +static CYTHON_INLINE +void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_CLEAR(exc_state->exc_value); +#else + PyObject *t, *v, *tb; + t = exc_state->exc_type; + v = exc_state->exc_value; + tb = exc_state->exc_traceback; + exc_state->exc_type = NULL; + exc_state->exc_value = NULL; + exc_state->exc_traceback = NULL; + Py_XDECREF(t); + Py_XDECREF(v); + Py_XDECREF(tb); +#endif +} +#define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) { + const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { + msg = "coroutine already executing"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { + msg = "async generator already executing"; + #endif + } else { + msg = "generator already executing"; + } + PyErr_SetString(PyExc_ValueError, msg); +} +static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) { + CYTHON_MAYBE_UNUSED_VAR(gen); + CYTHON_MAYBE_UNUSED_VAR(closing); + #ifdef __Pyx_Coroutine_USED + if (!closing && __Pyx_Coroutine_Check(gen)) { + PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); + } else + #endif + if (value) { + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + PyErr_SetNone(PyExc_StopAsyncIteration); + else + #endif + PyErr_SetNone(PyExc_StopIteration); + } +} +static +__Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) { + __Pyx_PyThreadState_declare + PyThreadState *tstate; + __Pyx_ExcInfoStruct *exc_state; + PyObject *retval; + assert(__Pyx_Coroutine_get_is_running(self)); // Callers should ensure is_running + if (unlikely(self->resume_label == -1)) { + __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); + return PYGEN_ERROR; + } +#if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + tstate = __pyx_tstate; +#else + tstate = __Pyx_PyThreadState_Current; +#endif + exc_state = &self->gi_exc_state; + if (exc_state->exc_value) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + #else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #elif PY_VERSION_HEX >= 0x030B00a4 + exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback; + #else + exc_tb = exc_state->exc_traceback; + #endif + if (exc_tb) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + assert(f->f_back == NULL); + #if PY_VERSION_HEX >= 0x030B00A1 + f->f_back = PyThreadState_GetFrame(tstate); + #else + Py_XINCREF(tstate->frame); + f->f_back = tstate->frame; + #endif + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + Py_DECREF(exc_tb); + #endif + } + #endif + } +#if CYTHON_USE_EXC_INFO_STACK + exc_state->previous_item = tstate->exc_info; + tstate->exc_info = exc_state; +#else + if (exc_state->exc_type) { + __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } else { + __Pyx_Coroutine_ExceptionClear(exc_state); + __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } +#endif + retval = self->body(self, tstate, value); +#if CYTHON_USE_EXC_INFO_STACK + exc_state = &self->gi_exc_state; + tstate->exc_info = exc_state->previous_item; + exc_state->previous_item = NULL; + __Pyx_Coroutine_ResetFrameBackpointer(exc_state); +#endif + *result = retval; + if (self->resume_label == -1) { + return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR; + } + return PYGEN_NEXT; +} +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(exc_state); +#else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 + if (!exc_state->exc_value) return; + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #else + exc_tb = exc_state->exc_traceback; + #endif + if (likely(exc_tb)) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + #if PY_VERSION_HEX >= 0x030B00a4 + Py_DECREF(exc_tb); + #endif + } +#endif +} +#define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\ + ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext)) +static PyObject * +__Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) { + CYTHON_MAYBE_UNUSED_VAR(gen); + if (likely(result == PYGEN_RETURN)) { + int is_async = 0; + #ifdef __Pyx_AsyncGen_USED + is_async = __Pyx_AsyncGen_CheckExact(gen); + #endif + __Pyx_ReturnWithStopIteration(retval, is_async, iternext); + Py_XDECREF(retval); + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE +PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { +#if PY_VERSION_HEX <= 0x030A00A1 + return _PyGen_Send(gen, arg); +#else + PyObject *result; + if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { + if (PyAsyncGen_CheckExact(gen)) { + assert(result == Py_None); + PyErr_SetNone(PyExc_StopAsyncIteration); + } + else if (result == Py_None) { + PyErr_SetNone(PyExc_StopIteration); + } + else { +#if PY_VERSION_HEX < 0x030d00A1 + _PyGen_SetStopIterationValue(result); +#else + if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) { + PyErr_SetObject(PyExc_StopIteration, result); + } else { + PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result); + if (likely(exc != NULL)) { + PyErr_SetObject(PyExc_StopIteration, exc); + Py_DECREF(exc); + } + } +#endif + } + Py_DECREF(result); + result = NULL; + } + return result; +#endif +} +#endif +static CYTHON_INLINE __Pyx_PySendResult +__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) { + __Pyx_PySendResult result; + PyObject *val = NULL; + assert(__Pyx_Coroutine_get_is_running(gen)); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); + result = __Pyx_Coroutine_SendEx(gen, val, retval, 0); + Py_XDECREF(val); + return result; +} +#if CYTHON_USE_AM_SEND +static __Pyx_PySendResult +__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) { + PyObject *ret = NULL; + __Pyx_PySendResult delegate_result, result; + assert(__Pyx_Coroutine_get_is_running(gen)); + delegate_result = gen_am_send(gen->yieldfrom, value, &ret); + if (delegate_result == PYGEN_NEXT) { + assert (ret != NULL); + *retval = ret; + return PYGEN_NEXT; + } + assert (delegate_result != PYGEN_ERROR || ret == NULL); + __Pyx_Coroutine_Undelegate(gen); + result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0); + Py_XDECREF(ret); + return result; +} +#endif +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); +} +static __Pyx_PySendResult +__Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) { + __Pyx_PySendResult result; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #if !CYTHON_USE_AM_SEND + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + ret = __Pyx_async_gen_asend_send(yf, value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + if (PyCoro_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + #endif + { + #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000 + if (value == Py_None && PyIter_Check(yf)) + ret = __Pyx_PyIter_Next_Plain(yf); + else + #endif + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value); + } + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + *retval = ret; + return PYGEN_NEXT; + } + result = __Pyx_Coroutine_FinishDelegation(gen, retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, value, retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return result; +} +static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + CYTHON_UNUSED_VAR(gen); + assert(__Pyx_Coroutine_get_is_running(gen)); + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + if (__Pyx_CoroutineAwait_CheckExact(yf)) { + result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + retval = __Pyx_async_gen_asend_close(yf, NULL); + result = PYGEN_RETURN; + } else + if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { + retval = __Pyx_async_gen_athrow_close(yf, NULL); + result = PYGEN_RETURN; + } else + #endif + { + PyObject *meth; + result = PYGEN_RETURN; + meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close); + if (unlikely(!meth)) { + if (unlikely(PyErr_Occurred())) { + PyErr_WriteUnraisable(yf); + } + } else { + retval = __Pyx_PyObject_CallNoArg(meth); + Py_DECREF(meth); + if (unlikely(!retval)) { + result = PYGEN_ERROR; + } + } + } + Py_XDECREF(retval); + return result == PYGEN_ERROR ? -1 : 0; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Next(yf); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, Py_None); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); + } else + #endif + ret = __Pyx_PyIter_Next_Plain(yf); + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1); +} +static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) { + PyObject *retval = NULL; + __Pyx_PySendResult result; + CYTHON_UNUSED_VAR(arg); + result = __Pyx_Coroutine_Close(self, &retval); + if (unlikely(result == PYGEN_ERROR)) + return NULL; + Py_XDECREF(retval); + Py_RETURN_NONE; +} +static __Pyx_PySendResult +__Pyx_Coroutine_Close(PyObject *self, PyObject **retval) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PySendResult result; + PyObject *yf; + int err = 0; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + yf = gen->yieldfrom; + if (yf) { + Py_INCREF(yf); + err = __Pyx_Coroutine_CloseIter(gen, yf); + __Pyx_Coroutine_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) + PyErr_SetNone(PyExc_GeneratorExit); + result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1); + if (result == PYGEN_ERROR) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_Coroutine_unset_is_running(gen); + if (!__Pyx_PyErr_Occurred()) { + return PYGEN_RETURN; + } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) { + __Pyx_PyErr_Clear(); + return PYGEN_RETURN; + } + return PYGEN_ERROR; + } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) { + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_RETURN; + } else { + const char *msg; + Py_DECREF(*retval); + *retval = NULL; + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(self)) { + msg = "coroutine ignored GeneratorExit"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(self)) { + msg = "async generator ignored GeneratorExit"; + #endif + } else { + msg = "generator ignored GeneratorExit"; + } + PyErr_SetString(PyExc_RuntimeError, msg); + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_ERROR; + } +} +static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, + PyObject *args, int close_on_genexit) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *yf; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) + return __Pyx_Coroutine_AlreadyRunningError(gen); + yf = gen->yieldfrom; + if (yf) { + __Pyx_PySendResult result; + PyObject *ret; + Py_INCREF(yf); + if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { + int err = __Pyx_Coroutine_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Coroutine_Undelegate(gen); + if (err < 0) + goto propagate_exception; + goto throw_here; + } + if (0 + #ifdef __Pyx_Generator_USED + || __Pyx_Generator_CheckExact(yf) + #endif + #ifdef __Pyx_Coroutine_USED + || __Pyx_Coroutine_Check(yf) + #endif + ) { + ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { + ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); + #endif + } else { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (unlikely(PyErr_Occurred())) { + __Pyx_Coroutine_unset_is_running(gen); + return NULL; + } + __Pyx_Coroutine_Undelegate(gen); + goto throw_here; + } + if (likely(args)) { + ret = __Pyx_PyObject_Call(meth, args, NULL); + } else { + PyObject *cargs[4] = {NULL, typ, val, tb}; + ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } + Py_DECREF(meth); + } + Py_DECREF(yf); + if (ret) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &ret); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0); + } +throw_here: + __Pyx_Raise(typ, val, tb, NULL); +propagate_exception: + { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); + } +} +static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { + PyObject *typ; + PyObject *val = NULL; + PyObject *tb = NULL; + if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb))) + return NULL; + return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); +} +static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_VISIT(exc_state->exc_value); +#else + Py_VISIT(exc_state->exc_type); + Py_VISIT(exc_state->exc_value); + Py_VISIT(exc_state->exc_traceback); +#endif + return 0; +} +static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { + { + int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg); + if (e) return e; + } + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); +} +static int __Pyx_Coroutine_clear(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); + } +#endif + Py_CLEAR(gen->gi_code); + Py_CLEAR(gen->gi_frame); + Py_CLEAR(gen->gi_name); + Py_CLEAR(gen->gi_qualname); + Py_CLEAR(gen->gi_modulename); + return 0; +} +static void __Pyx_Coroutine_dealloc(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject_GC_UnTrack(gen); + #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + if (gen->gi_weakreflist != NULL) + #endif + PyObject_ClearWeakRefs(self); + if (gen->resume_label >= 0) { + PyObject_GC_Track(self); +#if CYTHON_USE_TP_FINALIZE + if (unlikely(PyObject_CallFinalizerFromDealloc(self))) +#else + { + destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor); + if (del) del(self); + } + if (unlikely(Py_REFCNT(self) > 0)) +#endif + { + return; + } + PyObject_GC_UnTrack(self); + } +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + /* We have to handle this case for asynchronous generators + right here, because this code has to be between UNTRACK + and GC_Del. */ + Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); + } +#endif + __Pyx_Coroutine_clear(self); + __Pyx_PyHeapTypeObject_GC_Del(gen); +} +#if CYTHON_USE_TP_FINALIZE +static void __Pyx_Coroutine_del(PyObject *self) { + PyObject *error_type, *error_value, *error_traceback; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PyThreadState_declare + if (gen->resume_label < 0) { + return; + } + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; + PyObject *finalizer = agen->ag_finalizer; + if (finalizer && !agen->ag_closed) { + PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); + if (unlikely(!res)) { + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); + return; + } + } +#endif + if (unlikely(gen->resume_label == 0 && !error_value)) { +#ifdef __Pyx_Coroutine_USED +#ifdef __Pyx_Generator_USED + if (!__Pyx_Generator_CheckExact(self)) +#endif + { + PyObject_GC_UnTrack(self); + if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) + PyErr_WriteUnraisable(self); + PyObject_GC_Track(self); + } +#endif + } else { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval); + if (result == PYGEN_ERROR) { + PyErr_WriteUnraisable(self); + } else { + Py_XDECREF(retval); + } + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); +} +#endif +static PyObject * +__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_name; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(self->gi_name, value); + return 0; +} +static PyObject * +__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_qualname; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(self->gi_qualname, value); + return 0; +} +static PyObject * +__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self) +{ +#if !CYTHON_COMPILING_IN_LIMITED_API + PyObject *frame; + #if PY_VERSION_HEX >= 0x030d0000 + Py_BEGIN_CRITICAL_SECTION(self); + #endif + frame = self->gi_frame; + if (!frame) { + if (unlikely(!self->gi_code)) { + Py_RETURN_NONE; + } + PyObject *globals = PyDict_New(); + if (unlikely(!globals)) return NULL; + frame = (PyObject *) PyFrame_New( + PyThreadState_Get(), /*PyThreadState *tstate,*/ + (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ + globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + Py_DECREF(globals); + if (unlikely(!frame)) + return NULL; + if (unlikely(self->gi_frame)) { + Py_DECREF(frame); + frame = self->gi_frame; + } else { + self->gi_frame = frame; + } + } + Py_INCREF(frame); + #if PY_VERSION_HEX >= 0x030d0000 + Py_END_CRITICAL_SECTION(); + #endif + return frame; +#else + CYTHON_UNUSED_VAR(self); + Py_RETURN_NONE; +#endif +} +static PyObject * +__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) { + CYTHON_UNUSED_VAR(context); + PyObject *frame = self->gi_frame; + if (frame) + return __Pyx_NewRef(frame); + return __Pyx__Coroutine_get_frame(self); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); + if (unlikely(!gen)) + return NULL; + return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->yieldfrom_am_send = NULL; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API + gen->gi_exc_state.exc_value = NULL; + #else + gen->gi_exc_state.exc_type = NULL; + gen->gi_exc_state.exc_value = NULL; + gen->gi_exc_state.exc_traceback = NULL; + #endif +#if CYTHON_USE_EXC_INFO_STACK + gen->gi_exc_state.previous_item = NULL; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + gen->gi_weakreflist = NULL; +#endif + Py_XINCREF(qualname); + gen->gi_qualname = qualname; + Py_XINCREF(name); + gen->gi_name = name; + Py_XINCREF(module_name); + gen->gi_modulename = module_name; + Py_XINCREF(code); + gen->gi_code = code; + gen->gi_frame = NULL; + PyObject_GC_Track(gen); + return gen; +} +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + gen->is_running = 1; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; +} +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) { + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + assert(gen->is_running); + gen->is_running = 0; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif +} +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; +} +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) { + CYTHON_UNUSED_VAR(closure); + char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen); + if (result) Py_RETURN_TRUE; + else Py_RETURN_FALSE; +} +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) { + Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type; + if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) { + return; + } + memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async)); + static_amsend_methods->am_send = am_send; + type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods); +} +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); + __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self)); + PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object", + self_type_name); + __Pyx_DECREF_TypeName(self_type_name); + return NULL; +} + +/* Generator */ +static PyMethodDef __pyx_Generator_methods[] = { + {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, + PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, + PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, + PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, + {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0}, + {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; +static PyMemberDef __pyx_Generator_memberlist[] = { + {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, + PyDoc_STR("object being iterated by 'yield from', or None")}, + {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, + {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0}, +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyGetSetDef __pyx_Generator_getsets[] = { + {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, + PyDoc_STR("name of the generator"), 0}, + {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, + PyDoc_STR("qualified name of the generator"), 0}, + {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL, + PyDoc_STR("Frame of the generator"), 0}, + {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_GeneratorType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc}, + {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse}, + {Py_tp_iter, (void *)PyObject_SelfIter}, + {Py_tp_iternext, (void *)__Pyx_Generator_Next}, + {Py_tp_methods, (void *)__pyx_Generator_methods}, + {Py_tp_members, (void *)__pyx_Generator_memberlist}, + {Py_tp_getset, (void *)__pyx_Generator_getsets}, + {Py_tp_getattro, (void *) PyObject_GenericGetAttr}, +#if CYTHON_USE_TP_FINALIZE + {Py_tp_finalize, (void *)__Pyx_Coroutine_del}, +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + {Py_am_send, (void *)__Pyx_Coroutine_AmSend}, +#endif + {0, 0}, +}; +static PyType_Spec __pyx_GeneratorType_spec = { + __PYX_TYPE_MODULE_PREFIX "generator", + sizeof(__pyx_CoroutineObject), + 0, +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_WEAKREF | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND, + __pyx_GeneratorType_slots +}; +#if __PYX_HAS_PY_AM_SEND == 2 +static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async; +#endif +static int __pyx_Generator_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL); + if (unlikely(!mstate->__pyx_GeneratorType)) { + return -1; + } +#if __PYX_HAS_PY_AM_SEND == 2 + __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend); +#endif + return 0; +} +static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *retval = NULL; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + (void) result; + assert (result == PYGEN_RETURN || result == PYGEN_ERROR); + assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL)); + return retval; +} + +/* CheckBinaryVersion */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { + const unsigned long MAJOR_MINOR = 0xFFFF0000UL; + if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) + return 0; + if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) + return 1; + { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compile time Python version %d.%d " + "of module '%.100s' " + "%s " + "runtime version %d.%d", + (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), + __Pyx_MODULE_NAME, + (allow_newer) ? "was newer than" : "does not match", + (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) + ); + return PyErr_WarnEx(NULL, message, 1); + } +} + +/* NewCodeObj */ +#if CYTHON_COMPILING_IN_LIMITED_API + static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + PyObject *version_info; + PyObject *py_minor_version = NULL; + #endif + long minor_version = 0; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + minor_version = 11; + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + Py_DECREF(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + if (type) { + PyErr_Restore(type, value, traceback); + } + return result; + } +#elif PY_VERSION_HEX >= 0x030B0000 + static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1 + if (likely(result)) + result->_co_firsttraceable = 0; + #endif + return result; + } +#elif !CYTHON_COMPILING_IN_PYPY + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +) { + PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL; + Py_ssize_t var_count = (Py_ssize_t) descr.nlocals; + PyObject *varnames_tuple = PyTuple_New(var_count); + if (unlikely(!varnames_tuple)) return NULL; + for (Py_ssize_t i=0; i < var_count; i++) { + Py_INCREF(varnames[i]); + if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done; + } + #if CYTHON_COMPILING_IN_LIMITED_API + varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple); + if (!varnames_tuple_dedup) { + if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done; + varnames_tuple_dedup = varnames_tuple; + } + #else + varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple); + if (unlikely(!varnames_tuple_dedup)) goto done; + #endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(varnames_tuple_dedup); + #endif + if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) { + Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(line_table_length == -1)) goto done; + #endif + Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL; + code_bytes = PyBytes_FromStringAndSize(NULL, code_len); + if (unlikely(!code_bytes)) goto done; + char* c_code_bytes = PyBytes_AsString(code_bytes); + if (unlikely(!c_code_bytes)) goto done; + memset(c_code_bytes, 0, (size_t) code_len); + } + code_obj = (PyObject*) __Pyx__PyCode_New( + (int) descr.argcount, + (int) descr.num_posonly_args, + (int) descr.num_kwonly_args, + (int) descr.nlocals, + 0, + (int) descr.flags, + code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + varnames_tuple_dedup, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + filename, + funcname, + (int) descr.first_line, + (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes + ); +done: + Py_XDECREF(code_bytes); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(varnames_tuple_dedup); + #endif + Py_DECREF(varnames_tuple); + return code_obj; +} + +/* DecompressString */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { + PyObject *module, *decompress, *compressed_bytes, *decompressed; + const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; + PyObject *methodname = PyUnicode_FromString("decompress"); + if (unlikely(!methodname)) return NULL; + #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 + if (algo == 3) { + PyObject *fromlist = Py_BuildValue("[O]", methodname); + if (unlikely(!fromlist)) return NULL; + module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + } else + #endif + module = PyImport_ImportModule(module_name); + if (unlikely(!module)) goto import_failed; + decompress = PyObject_GetAttr(module, methodname); + if (unlikely(!decompress)) goto import_failed; + { + #ifdef __cplusplus + char *memview_bytes = const_cast(s); + #else + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wcast-qual" + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-qual" + #endif + char *memview_bytes = (char*) s; + #if defined(__clang__) + #pragma clang diagnostic pop + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + #endif + #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) + int memview_flags = 0x100; + #else + int memview_flags = PyBUF_READ; + #endif + compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); + } + if (unlikely(!compressed_bytes)) { + Py_DECREF(decompress); + goto bad; + } + decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); + Py_DECREF(compressed_bytes); + Py_DECREF(decompress); + Py_DECREF(module); + Py_DECREF(methodname); + return decompressed; +import_failed: + PyErr_Format(PyExc_ImportError, + "Failed to import '%.20s.decompress' - cannot initialise module strings. " + "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", + module_name, algo); +bad: + Py_XDECREF(module); + Py_DECREF(methodname); + return NULL; +} + +#include +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return __Pyx_PyUnicode_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return PyByteArray_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + { + const char* result; + Py_ssize_t unicode_length; + CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; + #else + result = PyUnicode_AsUTF8AndSize(o, length); + #endif + #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + unicode_length = PyUnicode_GetLength(o); + if (unlikely(unicode_length < 0)) return NULL; + if (unlikely(unicode_length != *length)) { + PyUnicode_AsASCIIString(o); + return NULL; + } + #endif + return result; + } +#else +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +#endif +} +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + if (PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif + if (PyByteArray_Check(o)) { +#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); +#else + *length = PyByteArray_Size(o); + if (*length == -1) return NULL; + return PyByteArray_AsString(o); +#endif + } else + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; + } + __Pyx_DECREF_TypeName(result_type_name); + return result; + } + PyErr_Format(PyExc_TypeError, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", + result_type_name); + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + PyObject *res = NULL; + if (likely(PyLong_Check(x))) + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + if (likely(m && m->nb_int)) { + res = m->nb_int(x); + } +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Long(x); + } +#endif + if (likely(res)) { + if (unlikely(!PyLong_CheckExact(res))) { + return __Pyx_PyNumber_LongWrongResultType(res); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); + } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyLong_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyLong_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { + CYTHON_UNUSED_VAR(b); + return __Pyx_NewRef(Py_None); +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return __Pyx_NewRef(b ? Py_True: Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { + return PyLong_FromSize_t(ival); +} + + +/* MultiPhaseInitModuleState */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 +#else + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 +#endif +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS +#error "Module state with PEP489 requires atomics. Currently that's one of\ + C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" +#endif +#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#define __Pyx_ModuleStateLookup_Lock() +#define __Pyx_ModuleStateLookup_Unlock() +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 +static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; +#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(__cplusplus) && __cplusplus >= 201103L +#include +static std::mutex __Pyx_ModuleStateLookup_mutex; +#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() +#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) +#include +static mtx_t __Pyx_ModuleStateLookup_mutex; +static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; +static void __Pyx_ModuleStateLookup_initialize_mutex(void) { + mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); +} +#define __Pyx_ModuleStateLookup_Lock()\ + call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ + mtx_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(HAVE_PTHREAD_H) +#include +static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; +#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(_WIN32) +#include // synchapi.h on its own doesn't work +static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; +#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#else +#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ + Requires C standard >= C11, or C++ standard >= C++11,\ + or pthreads, or the Windows 32 API, or Python >= 3.13." +#endif +typedef struct { + int64_t id; + PyObject *module; +} __Pyx_InterpreterIdAndModule; +typedef struct { + char interpreter_id_as_index; + Py_ssize_t count; + Py_ssize_t allocated; + __Pyx_InterpreterIdAndModule table[1]; +} __Pyx_ModuleStateLookupData; +#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; +#else +static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; +#endif +static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( + __Pyx_InterpreterIdAndModule* table, + Py_ssize_t count, + int64_t interpreterId) { + __Pyx_InterpreterIdAndModule* begin = table; + __Pyx_InterpreterIdAndModule* end = begin + count; + if (begin->id == interpreterId) { + return begin; + } + while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; + if (halfway->id == interpreterId) { + return halfway; + } + if (halfway->id < interpreterId) { + begin = halfway; + } else { + end = halfway; + } + } + for (; begin < end; ++begin) { + if (begin->id >= interpreterId) return begin; + } + return begin; +} +static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return NULL; +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + { + __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + if (likely(data)) { + __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); + if (likely(data == new_data)) { + goto read_finished; + } + } + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + __Pyx_ModuleStateLookup_Lock(); + __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); + data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + __Pyx_ModuleStateLookup_Unlock(); + } + read_finished:; +#else + __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_InterpreterIdAndModule* found = NULL; + if (unlikely(!data)) goto end; + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + found = data->table+interpreter_id; + } + } else { + found = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + } + end: + { + PyObject *result=NULL; + if (found && found->id == interpreter_id) { + result = found->module; + } +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); +#endif + return result; + } +} +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { + while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); +} +#else +#define __Pyx_ModuleStateLookup_wait_until_no_readers() +#endif +static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { + Py_ssize_t to_allocate = (*old_data)->allocated; + while (to_allocate <= interpreter_id) { + if (to_allocate == 0) to_allocate = 1; + else to_allocate *= 2; + } + __Pyx_ModuleStateLookupData *new_data = *old_data; + if (to_allocate != (*old_data)->allocated) { + new_data = (__Pyx_ModuleStateLookupData *)realloc( + *old_data, + sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + PyErr_NoMemory(); + return -1; + } + for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { + new_data->table[i].id = i; + new_data->table[i].module = NULL; + } + new_data->allocated = to_allocate; + } + new_data->table[interpreter_id].module = module; + if (new_data->count < interpreter_id+1) { + new_data->count = interpreter_id+1; + } + *old_data = new_data; + return 0; +} +static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { + __Pyx_InterpreterIdAndModule *read = data->table; + __Pyx_InterpreterIdAndModule *write = data->table; + __Pyx_InterpreterIdAndModule *end = read + data->count; + for (; readmodule) { + write->id = read->id; + write->module = read->module; + ++write; + } + } + data->count = write - data->table; + for (; writeid = 0; + write->module = NULL; + } + data->interpreter_id_as_index = 0; +} +static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + int result = 0; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_ModuleStateLookupData *new_data = old_data; + if (!new_data) { + new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); + if (!new_data) { + result = -1; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = 1; + new_data->interpreter_id_as_index = 1; + } + __Pyx_ModuleStateLookup_wait_until_no_readers(); + if (new_data->interpreter_id_as_index) { + if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); + goto end; + } + __Pyx_State_ConvertFromInterpIdAsIndex(new_data); + } + { + Py_ssize_t insert_at = 0; + { + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + new_data->table, new_data->count, interpreter_id); + assert(lower_bound); + insert_at = lower_bound - new_data->table; + if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { + lower_bound->module = module; + goto end; // already in table, nothing more to do + } + } + if (new_data->count+1 >= new_data->allocated) { + Py_ssize_t to_allocate = (new_data->count+1)*2; + new_data = + (__Pyx_ModuleStateLookupData*)realloc( + new_data, + sizeof(__Pyx_ModuleStateLookupData) + + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + result = -1; + new_data = old_data; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = to_allocate; + } + ++new_data->count; + int64_t last_id = interpreter_id; + PyObject *last_module = module; + for (Py_ssize_t i=insert_at; icount; ++i) { + int64_t current_id = new_data->table[i].id; + new_data->table[i].id = last_id; + last_id = current_id; + PyObject *current_module = new_data->table[i].module; + new_data->table[i].module = last_module; + last_module = current_module; + } + } + end: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); +#else + __Pyx_ModuleStateLookup_data = new_data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return result; +} +static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; +#endif + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + data->table[interpreter_id].module = NULL; + } + goto done; + } + { + __Pyx_ModuleStateLookup_wait_until_no_readers(); + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + if (!lower_bound) goto done; + if (lower_bound->id != interpreter_id) goto done; + __Pyx_InterpreterIdAndModule *end = data->table+data->count; + for (;lower_boundid = (lower_bound+1)->id; + lower_bound->module = (lower_bound+1)->module; + } + } + --data->count; + if (data->count == 0) { + free(data); + data = NULL; + } + done: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); +#else + __Pyx_ModuleStateLookup_data = data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return 0; +} +#endif + +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ +#endif /* Py_PYTHON_H */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/strings.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/strings.pxd new file mode 100644 index 0000000000000000000000000000000000000000..86b7b257b462a0827ead80b1975bd7b504dfaba0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/strings.pxd @@ -0,0 +1,31 @@ +from cymem.cymem cimport Pool +from libc.stdint cimport int64_t +from libcpp.set cimport set +from libcpp.vector cimport vector +from murmurhash.mrmr cimport hash64 +from preshed.maps cimport PreshMap + +from .typedefs cimport attr_t, hash_t + + +cpdef hash_t hash_string(str string) except 0 +cdef hash_t hash_utf8(char* utf8_string, int length) nogil + +cdef str decode_Utf8Str(const Utf8Str* string) + + +ctypedef union Utf8Str: + unsigned char[8] s + unsigned char* p + + +cdef class StringStore: + cdef Pool mem + + cdef vector[hash_t] keys + cdef public PreshMap _map + + cdef const Utf8Str* intern_unicode(self, str py_string, bint allow_transient) + cdef const Utf8Str* _intern_utf8(self, char* utf8_string, int length, hash_t* precalculated_hash, bint allow_transient) + cdef vector[hash_t] _transient_keys + cdef Pool _non_temp_mem diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/strings.pyi b/TTS/Kokoro/.venv/Lib/site-packages/spacy/strings.pyi new file mode 100644 index 0000000000000000000000000000000000000000..7423863827d951a19c7e27ac08c2b8164e33b45c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/strings.pyi @@ -0,0 +1,25 @@ +from pathlib import Path +from typing import Any, Iterable, Iterator, Optional, Union, overload + +def get_string_id(key: Union[str, int]) -> int: ... + +class StringStore: + def __init__( + self, strings: Optional[Iterable[str]] = ..., freeze: bool = ... + ) -> None: ... + @overload + def __getitem__(self, string_or_id: Union[bytes, str]) -> int: ... + @overload + def __getitem__(self, string_or_id: int) -> str: ... + def as_int(self, key: Union[bytes, str, int]) -> int: ... + def as_string(self, key: Union[bytes, str, int]) -> str: ... + def add(self, string: str) -> int: ... + def __len__(self) -> int: ... + def __contains__(self, string: str) -> bool: ... + def __iter__(self) -> Iterator[str]: ... + def __reduce__(self) -> Any: ... + def to_disk(self, path: Union[str, Path]) -> None: ... + def from_disk(self, path: Union[str, Path]) -> StringStore: ... + def to_bytes(self, **kwargs: Any) -> bytes: ... + def from_bytes(self, bytes_data: bytes, **kwargs: Any) -> StringStore: ... + def _reset_and_load(self, strings: Iterable[str]) -> None: ... diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/strings.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/strings.pyx new file mode 100644 index 0000000000000000000000000000000000000000..03fa1a4c975f8ccbc1ee200124ec816de88cba94 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/strings.pyx @@ -0,0 +1,397 @@ +# cython: infer_types=True +# cython: profile=False +cimport cython + +from contextlib import contextmanager +from typing import List, Optional + +from libc.stdint cimport uint32_t +from libc.string cimport memcpy +from murmurhash.mrmr cimport hash32, hash64 +from preshed.maps cimport map_clear + +import srsly + +from .typedefs cimport hash_t + +from . import util +from .errors import Errors +from .symbols import IDS as SYMBOLS_BY_STR +from .symbols import NAMES as SYMBOLS_BY_INT + + +# Not particularly elegant, but this is faster than `isinstance(key, numbers.Integral)` +cdef inline bint _try_coerce_to_hash(object key, hash_t* out_hash): + try: + out_hash[0] = key + return True + except: # no-cython-lint + return False + + +def get_string_id(key): + """Get a string ID, handling the reserved symbols correctly. If the key is + already an ID, return it. + + This function optimises for convenience over performance, so shouldn't be + used in tight loops. + """ + cdef hash_t str_hash + if isinstance(key, str): + if len(key) == 0: + return 0 + + symbol = SYMBOLS_BY_STR.get(key, None) + if symbol is not None: + return symbol + else: + chars = key.encode("utf8") + return hash_utf8(chars, len(chars)) + elif _try_coerce_to_hash(key, &str_hash): + # Coerce the integral key to the expected primitive hash type. + # This ensures that custom/overloaded "primitive" data types + # such as those implemented by numpy are not inadvertently used + # downsteam (as these are internally implemented as custom PyObjects + # whose comparison operators can incur a significant overhead). + return str_hash + else: + # TODO: Raise an error instead + return key + + +cpdef hash_t hash_string(str string) except 0: + chars = string.encode("utf8") + return hash_utf8(chars, len(chars)) + + +cdef hash_t hash_utf8(char* utf8_string, int length) nogil: + return hash64(utf8_string, length, 1) + + +cdef uint32_t hash32_utf8(char* utf8_string, int length) nogil: + return hash32(utf8_string, length, 1) + + +cdef str decode_Utf8Str(const Utf8Str* string): + cdef int i, length + if string.s[0] < sizeof(string.s) and string.s[0] != 0: + return string.s[1:string.s[0]+1].decode("utf8") + elif string.p[0] < 255: + return string.p[1:string.p[0]+1].decode("utf8") + else: + i = 0 + length = 0 + while string.p[i] == 255: + i += 1 + length += 255 + length += string.p[i] + i += 1 + return string.p[i:length + i].decode("utf8") + + +cdef Utf8Str* _allocate(Pool mem, const unsigned char* chars, uint32_t length) except *: + cdef int n_length_bytes + cdef int i + cdef Utf8Str* string = mem.alloc(1, sizeof(Utf8Str)) + if length < sizeof(string.s): + string.s[0] = length + memcpy(&string.s[1], chars, length) + return string + elif length < 255: + string.p = mem.alloc(length + 1, sizeof(unsigned char)) + string.p[0] = length + memcpy(&string.p[1], chars, length) + return string + else: + i = 0 + n_length_bytes = (length // 255) + 1 + string.p = mem.alloc(length + n_length_bytes, sizeof(unsigned char)) + for i in range(n_length_bytes-1): + string.p[i] = 255 + string.p[n_length_bytes-1] = length % 255 + memcpy(&string.p[n_length_bytes], chars, length) + return string + + +cdef class StringStore: + """Look up strings by 64-bit hashes. + + DOCS: https://spacy.io/api/stringstore + """ + def __init__(self, strings=None, freeze=False): + """Create the StringStore. + + strings (iterable): A sequence of unicode strings to add to the store. + """ + self.mem = Pool() + self._non_temp_mem = self.mem + self._map = PreshMap() + if strings is not None: + for string in strings: + self.add(string, allow_transient=False) + + def __getitem__(self, object string_or_id): + """Retrieve a string from a given hash, or vice versa. + + string_or_id (bytes, str or uint64): The value to encode. + Returns (str / uint64): The value to be retrieved. + """ + cdef hash_t str_hash + cdef Utf8Str* utf8str = NULL + + if isinstance(string_or_id, str): + if len(string_or_id) == 0: + return 0 + + # Return early if the string is found in the symbols LUT. + symbol = SYMBOLS_BY_STR.get(string_or_id, None) + if symbol is not None: + return symbol + else: + return hash_string(string_or_id) + elif isinstance(string_or_id, bytes): + return hash_utf8(string_or_id, len(string_or_id)) + elif _try_coerce_to_hash(string_or_id, &str_hash): + if str_hash == 0: + return "" + elif str_hash < len(SYMBOLS_BY_INT): + return SYMBOLS_BY_INT[str_hash] + else: + utf8str = self._map.get(str_hash) + if utf8str is NULL: + raise KeyError(Errors.E018.format(hash_value=string_or_id)) + else: + return decode_Utf8Str(utf8str) + else: + # TODO: Raise an error instead + utf8str = self._map.get(string_or_id) + if utf8str is NULL: + raise KeyError(Errors.E018.format(hash_value=string_or_id)) + else: + return decode_Utf8Str(utf8str) + + def as_int(self, key): + """If key is an int, return it; otherwise, get the int value.""" + if not isinstance(key, str): + return key + else: + return self[key] + + def as_string(self, key): + """If key is a string, return it; otherwise, get the string value.""" + if isinstance(key, str): + return key + else: + return self[key] + + def __len__(self) -> int: + """The number of strings in the store. + + RETURNS (int): The number of strings in the store. + """ + return self.keys.size() + self._transient_keys.size() + + @contextmanager + def memory_zone(self, mem: Optional[Pool] = None) -> Pool: + """Begin a block where all resources allocated during the block will + be freed at the end of it. If a resources was created within the + memory zone block, accessing it outside the block is invalid. + Behaviour of this invalid access is undefined. Memory zones should + not be nested. + + The memory zone is helpful for services that need to process large + volumes of text with a defined memory budget. + """ + if mem is None: + mem = Pool() + self.mem = mem + yield mem + for key in self._transient_keys: + map_clear(self._map.c_map, key) + self._transient_keys.clear() + self.mem = self._non_temp_mem + + def add(self, string: str, allow_transient: Optional[bool] = None) -> int: + """Add a string to the StringStore. + + string (str): The string to add. + allow_transient (bool): Allow the string to be stored in the 'transient' + map, which will be flushed at the end of the memory zone. Strings + encountered during arbitrary text processing should be added + with allow_transient=True, while labels and other strings used + internally should not. + RETURNS (uint64): The string's hash value. + """ + if not string: + return 0 + if allow_transient is None: + allow_transient = self.mem is not self._non_temp_mem + cdef hash_t str_hash + if isinstance(string, str): + if string in SYMBOLS_BY_STR: + return SYMBOLS_BY_STR[string] + + string = string.encode("utf8") + str_hash = hash_utf8(string, len(string)) + self._intern_utf8(string, len(string), &str_hash, allow_transient) + elif isinstance(string, bytes): + if string in SYMBOLS_BY_STR: + return SYMBOLS_BY_STR[string] + str_hash = hash_utf8(string, len(string)) + self._intern_utf8(string, len(string), &str_hash, allow_transient) + else: + raise TypeError(Errors.E017.format(value_type=type(string))) + return str_hash + + def __len__(self): + """The number of strings in the store. + if string in SYMBOLS_BY_STR: + return SYMBOLS_BY_STR[string] + else: + return self._intern_str(string, allow_transient) + + RETURNS (int): The number of strings in the store. + """ + return self.keys.size() + self._transient_keys.size() + + def __contains__(self, string_or_id not None): + """Check whether a string or ID is in the store. + + string_or_id (str or int): The string to check. + RETURNS (bool): Whether the store contains the string. + """ + cdef hash_t str_hash + if isinstance(string_or_id, str): + if len(string_or_id) == 0: + return True + elif string_or_id in SYMBOLS_BY_STR: + return True + str_hash = hash_string(string_or_id) + elif _try_coerce_to_hash(string_or_id, &str_hash): + pass + else: + # TODO: Raise an error instead + if self._map.get(string_or_id) is not NULL: + return True + else: + return False + if str_hash < len(SYMBOLS_BY_INT): + return True + else: + if self._map.get(str_hash) is not NULL: + return True + else: + return False + + def __iter__(self): + """Iterate over the strings in the store, in order. + + YIELDS (str): A string in the store. + """ + cdef int i + cdef hash_t key + for i in range(self.keys.size()): + key = self.keys[i] + utf8str = self._map.get(key) + yield decode_Utf8Str(utf8str) + for i in range(self._transient_keys.size()): + key = self._transient_keys[i] + utf8str = self._map.get(key) + yield decode_Utf8Str(utf8str) + + def __reduce__(self): + strings = list(self) + return (StringStore, (strings,), None, None, None) + + def values(self) -> List[int]: + """Iterate over the stored strings hashes in insertion order. + + RETURNS: A list of string hashs. + """ + cdef int i + hashes = [None] * self._keys.size() + for i in range(self._keys.size()): + hashes[i] = self._keys[i] + transient_hashes = [None] * self._transient_keys.size() + for i in range(self._transient_keys.size()): + transient_hashes[i] = self._transient_keys[i] + return hashes + transient_hashes + + def to_disk(self, path): + """Save the current state to a directory. + + path (str / Path): A path to a directory, which will be created if + it doesn't exist. Paths may be either strings or Path-like objects. + """ + path = util.ensure_path(path) + strings = sorted(self) + srsly.write_json(path, strings) + + def from_disk(self, path): + """Loads state from a directory. Modifies the object in place and + returns it. + + path (str / Path): A path to a directory. Paths may be either + strings or `Path`-like objects. + RETURNS (StringStore): The modified `StringStore` object. + """ + path = util.ensure_path(path) + strings = srsly.read_json(path) + prev = list(self) + self._reset_and_load(strings) + for word in prev: + self.add(word, allow_transient=False) + return self + + def to_bytes(self, **kwargs): + """Serialize the current state to a binary string. + + RETURNS (bytes): The serialized form of the `StringStore` object. + """ + return srsly.json_dumps(sorted(self)) + + def from_bytes(self, bytes_data, **kwargs): + """Load state from a binary string. + + bytes_data (bytes): The data to load from. + RETURNS (StringStore): The `StringStore` object. + """ + strings = srsly.json_loads(bytes_data) + prev = list(self) + self._reset_and_load(strings) + for word in prev: + self.add(word, allow_transient=False) + return self + + def _reset_and_load(self, strings): + self.mem = Pool() + self._non_temp_mem = self.mem + self._map = PreshMap() + self.keys.clear() + self._transient_keys.clear() + for string in strings: + self.add(string, allow_transient=False) + + cdef const Utf8Str* intern_unicode(self, str py_string, bint allow_transient): + # 0 means missing, but we don't bother offsetting the index. + cdef bytes byte_string = py_string.encode("utf8") + return self._intern_utf8(byte_string, len(byte_string), NULL, allow_transient) + + @cython.final + cdef const Utf8Str* _intern_utf8(self, char* utf8_string, int length, hash_t* precalculated_hash, bint allow_transient): + # TODO: This function's API/behaviour is an unholy mess... + # 0 means missing, but we don't bother offsetting the index. + cdef hash_t key = precalculated_hash[0] if precalculated_hash is not NULL else hash_utf8(utf8_string, length) + cdef Utf8Str* value = self._map.get(key) + if value is not NULL: + return value + if allow_transient: + value = _allocate(self.mem, utf8_string, length) + else: + value = _allocate(self._non_temp_mem, utf8_string, length) + self._map.set(key, value) + if allow_transient and self.mem is not self._non_temp_mem: + self._transient_keys.push_back(key) + else: + self.keys.push_back(key) + return value diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/structs.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/structs.pxd new file mode 100644 index 0000000000000000000000000000000000000000..30bbc1ffce9a5cf8b7d98c0225c5e6bd17d4dbb5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/structs.pxd @@ -0,0 +1,113 @@ +from libc.stdint cimport int32_t, int64_t, uint8_t, uint32_t, uint64_t +from libcpp.unordered_map cimport unordered_map +from libcpp.unordered_set cimport unordered_set +from libcpp.vector cimport vector + +from .parts_of_speech cimport univ_pos_t +from .typedefs cimport attr_t, flags_t, hash_t + + +cdef struct LexemeC: + flags_t flags + + attr_t lang + + attr_t id + attr_t length + + attr_t orth + attr_t lower + attr_t norm + attr_t shape + attr_t prefix + attr_t suffix + + +cdef struct SpanC: + hash_t id + int start + int end + int start_char + int end_char + attr_t label + attr_t kb_id + + +cdef struct TokenC: + const LexemeC* lex + uint64_t morph + univ_pos_t pos + bint spacy + attr_t tag + int idx + attr_t lemma + attr_t norm + int head + attr_t dep + + uint32_t l_kids + uint32_t r_kids + uint32_t l_edge + uint32_t r_edge + + int sent_start + int ent_iob + attr_t ent_type # TODO: Is there a better way to do this? Multiple sources of truth.. + attr_t ent_kb_id + hash_t ent_id + + +cdef struct MorphAnalysisC: + hash_t key + int length + + attr_t* fields + attr_t* features + + +# Internal struct, for storage and disambiguation of entities. +cdef struct KBEntryC: + + # The hash of this entry's unique ID/name in the kB + hash_t entity_hash + + # Allows retrieval of the entity vector, as an index into a vectors table of the KB. + # Can be expanded later to refer to multiple rows (compositional model to reduce storage footprint). + int32_t vector_index + + # Allows retrieval of a struct of non-vector features. + # This is currently not implemented and set to -1 for the common case where there are no features. + int32_t feats_row + + # log probability of entity, based on corpus frequency + float freq + + +# Each alias struct stores a list of Entry pointers with their prior probabilities +# for this specific mention/alias. +cdef struct AliasC: + + # All entry candidates for this alias + vector[int64_t] entry_indices + + # Prior probability P(entity|alias) - should sum up to (at most) 1. + vector[float] probs + + +cdef struct EdgeC: + hash_t label + int32_t head + int32_t tail + + +cdef struct GraphC: + vector[vector[int32_t]] nodes + vector[EdgeC] edges + vector[float] weights + vector[int] n_heads + vector[int] n_tails + vector[int] first_head + vector[int] first_tail + unordered_set[int]* roots + unordered_map[hash_t, int]* node_map + unordered_map[hash_t, int]* edge_map diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/symbols.cp312-win_amd64.pyd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/symbols.cp312-win_amd64.pyd new file mode 100644 index 0000000000000000000000000000000000000000..66e3c91ab7d7859a101192e987c2634882c1aa5b Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/spacy/symbols.cp312-win_amd64.pyd differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/symbols.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/symbols.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0d1a8817348efd4498df404951f7929755e0d34f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/symbols.cpp @@ -0,0 +1,14577 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.symbols", + "sources": [ + "spacy/symbols.pyx" + ] + }, + "module_name": "spacy.symbols" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +/* InitLimitedAPI */ +#if defined(Py_LIMITED_API) + #if !defined(CYTHON_LIMITED_API) + #define CYTHON_LIMITED_API 1 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef _MSC_VER + #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") + #else + #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. + #endif +#endif + +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x03080000 + #error Cython requires Python 3.8+. +#else +#define __PYX_ABI_VERSION "3_2_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* CModulePreamble */ +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#define __PYX_COMMA , +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) + #endif + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 1 + #endif + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #ifdef Py_GIL_DISABLED + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 + #else + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #endif + #if PY_VERSION_HEX < 0x030A0000 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #elif !defined(CYTHON_USE_TYPE_SLOTS) + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLIST_INTERNALS) + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #elif !defined(CYTHON_FAST_GIL) + #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #ifndef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif + #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work + #elif !defined(CYTHON_IMMORTAL_CONSTANTS) + #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif +#endif +#ifndef CYTHON_COMPRESS_STRINGS + #define CYTHON_COMPRESS_STRINGS 1 +#endif +#ifndef CYTHON_FAST_PYCCALL +#define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL +#endif +#ifndef CYTHON_VECTORCALL +#if CYTHON_COMPILING_IN_LIMITED_API +#define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) +#else +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) +#endif +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#include +typedef uintptr_t __pyx_uintptr_t; +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif +#ifndef Py_UNREACHABLE + #define Py_UNREACHABLE() assert(0); abort() +#endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* PythonCompatibility */ +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#define __Pyx_BUILTIN_MODULE_NAME "builtins" +#define __Pyx_DefaultClassType PyType_Type +#if CYTHON_COMPILING_IN_LIMITED_API + #ifndef CO_OPTIMIZED + static int CO_OPTIMIZED; + #endif + #ifndef CO_NEWLOCALS + static int CO_NEWLOCALS; + #endif + #ifndef CO_VARARGS + static int CO_VARARGS; + #endif + #ifndef CO_VARKEYWORDS + static int CO_VARKEYWORDS; + #endif + #ifndef CO_ASYNC_GENERATOR + static int CO_ASYNC_GENERATOR; + #endif + #ifndef CO_GENERATOR + static int CO_GENERATOR; + #endif + #ifndef CO_COROUTINE + static int CO_COROUTINE; + #endif +#else + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 + #endif +#endif +static int __Pyx_init_co_variables(void); +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif +#ifndef Py_TPFLAGS_IMMUTABLETYPE + #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) +#endif +#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION + #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) +#endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#ifndef METH_FASTCALL + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #if PY_VERSION_HEX >= 0x030d00A4 + # define __Pyx_PyCFunctionFast PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords + #else + # define __Pyx_PyCFunctionFast _PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords + #endif +#endif +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX >= 0x030900B1 +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) +#else +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) +#endif +#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) +#elif !CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) +static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { + return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; +} +#endif +static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; +#else + return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +#endif +} +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) +#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) +#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) +#elif CYTHON_COMPILING_IN_GRAAL + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#endif +#if CYTHON_USE_MODULE_STATE +static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) +#else +#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) +#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) +#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) + #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) + #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ + ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ + (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ + __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) + #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) + #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) +#endif +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) +#endif +#define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) +#if CYTHON_USE_TYPE_SPECS +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE((PyObject*)obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#else + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #else + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #endif +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif +#endif +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#elif CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) +#endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif +enum __Pyx_ReferenceSharing { + __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check + __Pyx_ReferenceSharing_OwnStrongReference, + __Pyx_ReferenceSharing_FunctionArgument, + __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar +}; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ + (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ + (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ + (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) +#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) +#else +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) +#endif +#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) + #else + #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) + #endif +#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) + #endif +#else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) +#endif +#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ + __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) +#else + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) +#endif +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyObject_GetItem(dict, key); + if (*result == NULL) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + return 0; + } + return -1; + } + return 1; +} +#else +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyDict_GetItemWithError(dict, key); + if (*result == NULL) { + return PyErr_Occurred() ? -1 : 0; + } + Py_INCREF(*result); + return 1; +} +#endif +#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST + #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) +#else + #define __Pyx_VISIT_CONST(obj) +#endif +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) +#else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) +#endif +#if CYTHON_ASSUME_SAFE_SIZE + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) +#else + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) +#endif +#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t +#define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t +#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 + #define __Pyx_PySendResult PySendResult +#else + typedef enum { + PYGEN_RETURN = 0, + PYGEN_ERROR = -1, + PYGEN_NEXT = 1, + } __Pyx_PySendResult; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 + typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); +#else + #define __Pyx_pyiter_sendfunc sendfunc +#endif +#if !CYTHON_USE_AM_SEND +#define __PYX_HAS_PY_AM_SEND 0 +#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 +#define __PYX_HAS_PY_AM_SEND 1 +#else +#define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation +#endif +#if __PYX_HAS_PY_AM_SEND < 2 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods +#else + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + __Pyx_pyiter_sendfunc am_send; + } __Pyx_PyAsyncMethodsStruct; + #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) +#endif +#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 + #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) +#else + #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) +#endif +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() +#else +#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 +#ifdef __cplusplus +extern "C" +#endif +PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { + int value; + PyObject *py_value = PyObject_GetAttrString(inspect, name); + if (!py_value) return 0; + value = (int) PyLong_AsLong(py_value); + Py_DECREF(py_value); + *write_to = value; + return value != -1 || !PyErr_Occurred(); +} +static int __Pyx_init_co_variables(void) { + PyObject *inspect; + int result; + inspect = PyImport_ImportModule("inspect"); + result = +#if !defined(CO_OPTIMIZED) + __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && +#endif +#if !defined(CO_NEWLOCALS) + __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && +#endif +#if !defined(CO_VARARGS) + __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && +#endif +#if !defined(CO_VARKEYWORDS) + __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && +#endif +#if !defined(CO_ASYNC_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && +#endif +#if !defined(CO_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && +#endif +#if !defined(CO_COROUTINE) + __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && +#endif + 1; + Py_DECREF(inspect); + return result ? 0 : -1; +} +#else +static int __Pyx_init_co_variables(void) { + return 0; // It's a limited API-only feature +} +#endif + +/* MathInitCode */ +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #ifndef _USE_MATH_DEFINES + #define _USE_MATH_DEFINES + #endif +#endif +#include +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 +#endif +#ifndef CYTHON_CLINE_IN_TRACEBACK +#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#endif +#if CYTHON_CLINE_IN_TRACEBACK +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } +#else +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } +#endif +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__symbols +#define __PYX_HAVE_API__spacy__symbols +/* Early includes */ +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) +#else + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) +#endif +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) + return Py_NewRef(obj); +#else + Py_INCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) + return Py_XNewRef(obj); +#else + Py_XINCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) +#else +#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) +#endif +#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) +#else + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +/* PretendToInitialize */ +#ifdef __cplusplus +#if __cplusplus > 201103L +#include +#endif +template +static void __Pyx_pretend_to_initialize(T* ptr) { +#if __cplusplus > 201103L + if ((std::is_trivially_default_constructible::value)) +#endif + *ptr = T(); + (void)ptr; +} +#else +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#endif + + +#if !CYTHON_USE_MODULE_STATE +static PyObject *__pyx_m = NULL; +#endif +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * const __pyx_cfilenm = __FILE__; +static const char *__pyx_filename; + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/symbols.pyx", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* Atomics.proto (used by UnpackUnboundCMethod) */ +#include +#ifndef CYTHON_ATOMICS + #define CYTHON_ATOMICS 1 +#endif +#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS +#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __pyx_atomic_int_type int +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_ptr_type atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) atomic_load(value) + #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_ptr_type std::atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) std::atomic_load(value) + #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ + (__GNUC_MINOR__ > 1 ||\ + (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) + #define __pyx_atomic_ptr_type void* + #define __pyx_nonatomic_ptr_type void* + #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) + #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #warning "Using GNU atomics" + #endif +#elif CYTHON_ATOMICS && defined(_MSC_VER) + #include + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type long + #define __pyx_atomic_ptr_type void* + #undef __pyx_nonatomic_int_type + #define __pyx_nonatomic_int_type long + #define __pyx_nonatomic_ptr_type void* + #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) + #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) + #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) + #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value + #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #pragma message ("Using MSVC atomics") + #endif +#else + #undef CYTHON_ATOMICS + #define CYTHON_ATOMICS 0 + #ifdef __PYX_DEBUG_ATOMICS + #warning "Not using atomics" + #endif +#endif + +/* CriticalSectionsDefinition.proto (used by CriticalSections) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection void* +#define __Pyx_PyCriticalSection2 void* +#define __Pyx_PyCriticalSection_End(cs) +#define __Pyx_PyCriticalSection2_End(cs) +#else +#define __Pyx_PyCriticalSection PyCriticalSection +#define __Pyx_PyCriticalSection2 PyCriticalSection2 +#define __Pyx_PyCriticalSection_End PyCriticalSection_End +#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End +#endif + +/* CriticalSections.proto (used by ParseKeywordsImpl) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs) +#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs) +#else +#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin +#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin +#endif +#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_BEGIN_CRITICAL_SECTION(o) { +#define __Pyx_END_CRITICAL_SECTION() } +#else +#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION +#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION +#endif + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ + +/* "spacy/symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; +/* #### Code section: utility_code_proto ### */ + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto (used by PyErrFetchRestore) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* TupleAndListFromArray.proto (used by fastcall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +#endif +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto (used by BytesEquals) */ +#include + +/* BytesEquals.proto (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i)) +#else + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i)) +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i]) + #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); + #else + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #endif +#else + #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS +#endif +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start) +#else +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* py_dict_items.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); + +/* CallCFunction.proto (used by CallUnboundCMethod0) */ +#define __Pyx_CallCFunction(cfunc, self, args)\ + ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args) +#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\ + ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs) +#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\ + ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs) +#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ + ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) + +/* PyObjectCall.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto (used by PyObjectCallOneArg) */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); + +/* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ +typedef struct { + PyObject *type; + PyObject **method_name; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS + __pyx_atomic_int_type initialized; +#endif + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) { +#if !CYTHON_ATOMICS + return 1; +#else + __pyx_nonatomic_int_type expected = 0; + if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) { + return 0; + } + return expected; +#endif +} +static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) { +#if CYTHON_ATOMICS + __pyx_atomic_store(&cfunc->initialized, 2); +#endif +} +#else +#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2 +#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc) +#endif + +/* CallUnboundCMethod0.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#else +#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) +#endif + +/* py_dict_values.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); + +/* OwnedDictNext.proto (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue); +#else +CYTHON_INLINE +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue); +#endif + +/* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywordsImpl.export */ +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name +); +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* CallUnboundCMethod2.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); +#else +#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) +#endif + +/* ParseKeywords.proto */ +static CYTHON_INLINE int __Pyx_ParseKeywords( + PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[], + PyObject *kwds2, PyObject *values[], + Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* dict_setdefault.proto (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); + +/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp); +#endif + +/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v); +#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v) + +/* FixUpExtensionType.proto (used by FetchCommonType) */ +static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); + +/* AddModuleRef.proto (used by FetchSharedCythonModule) */ +#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ + __PYX_LIMITED_VERSION_HEX < 0x030d0000) + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); +#else + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#endif + +/* FetchSharedCythonModule.proto (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto (used by CommonTypesMetaclass) */ +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases); + +/* CommonTypesMetaclass.proto (used by CythonFunctionShared) */ +static int __pyx_CommonTypesMetaclass_init(PyObject *module); +#define __Pyx_CommonTypesMetaclass_USED + +/* CallTypeTraverse.proto (used by CythonFunctionShared) */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0 +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg); +#endif + +/* PyMethodNew.proto (used by CythonFunctionShared) */ +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ); + +/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto (used by CythonFunction) */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_dict; +#endif + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + PyObject *defaults; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#undef __Pyx_CyOrPyCFunction_Check +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType) +#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType) +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)); +#undef __Pyx_IsSameCFunction +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, + PyTypeObject *defaults_type); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* PyDictVersioning.proto (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* PyObjectVectorCallKwBuilder.proto */ +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#if CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall +#endif +#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict +#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) +#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) +#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) +#endif + +/* ListCompAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + L->ob_item[len] = x; + #else + PyList_SET_ITEM(list, len, x); + #endif + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +/* PyObjectFastCallMethod.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) +#else +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); +#endif + +/* CLineInTraceback.proto (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#else +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#endif + +/* CodeObjectCache.proto (used by AddTraceback) */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject __Pyx_CachedCodeObjectType; +#else +typedef PyCodeObject __Pyx_CachedCodeObjectType; +#endif +typedef struct { + __Pyx_CachedCodeObjectType* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_int_type accessor_count; + #endif +}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(enum __pyx_t_5spacy_7symbols_symbol_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* Globals.proto */ +static PyObject* __Pyx_Globals(void); + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#else +static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); +#endif +#else // !LIMITED_API +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { + return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); +} +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +#ifdef PyExceptionInstance_Check + #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) +#else + #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) +#endif + +/* GetRuntimeVersion.proto */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +static unsigned long __Pyx_cached_runtime_version = 0; +static void __Pyx_init_runtime_version(void); +#else +#define __Pyx_init_runtime_version() +#endif +static unsigned long __Pyx_get_runtime_version(void); + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); + +/* DecompressString.proto */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); + +/* MultiPhaseInitModuleState.proto */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +static PyObject *__Pyx_State_FindModule(void*); +static int __Pyx_State_AddModule(PyObject* module, void*); +static int __Pyx_State_RemoveModule(void*); +#elif CYTHON_USE_MODULE_STATE +#define __Pyx_State_FindModule PyState_FindModule +#define __Pyx_State_AddModule PyState_AddModule +#define __Pyx_State_RemoveModule PyState_RemoveModule +#endif + +/* #### Code section: module_declarations ### */ +/* CythonABIVersion.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API + #if CYTHON_METH_FASTCALL + #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" + #else + #define __PYX_FASTCALL_ABI_SUFFIX + #endif + #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#else + #define __PYX_LIMITED_ABI_SUFFIX +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + #define __PYX_AM_SEND_ABI_SUFFIX +#elif __PYX_HAS_PY_AM_SEND == 2 + #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" +#else + #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" +#endif +#ifndef __PYX_MONITORING_ABI_SUFFIX + #define __PYX_MONITORING_ABI_SUFFIX +#endif +#if CYTHON_USE_TP_FINALIZE + #define __PYX_TP_FINALIZE_ABI_SUFFIX +#else + #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" +#endif +#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) + #define __PYX_FREELISTS_ABI_SUFFIX +#else + #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" +#endif +#define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." + + +/* Module declarations from "spacy.symbols" */ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.symbols" +extern int __pyx_module_is_main_spacy__symbols; +int __pyx_module_is_main_spacy__symbols = 0; + +/* Implementation of "spacy.symbols" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_sorted; +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static PyObject *__pyx_pf_5spacy_7symbols_sort_nums(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +/* SmallCodeConfig */ +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + PyObject *__pyx_codeobj_tab[1]; + PyObject *__pyx_string_tab[484]; +/* #### Code section: module_state_contents ### */ +/* CommonTypesMetaclass.module_state_decls */ +PyTypeObject *__pyx_CommonTypesMetaclassType; + +/* CachedMethodType.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API +PyObject *__Pyx_CachedMethodType; +#endif + +/* CythonFunctionShared.module_state_decls */ +PyTypeObject *__pyx_CyFunctionType; + +/* CodeObjectCache.module_state_decls */ +struct __Pyx_CodeObjectCache __pyx_code_cache; + +/* #### Code section: module_state_end ### */ +} __pyx_mstatetype; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { +extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) + +#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstatetype __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: constant_name_defines ### */ +#define __pyx_kp_u_ __pyx_string_tab[0] +#define __pyx_kp_u__3 __pyx_string_tab[1] +#define __pyx_kp_u_spacy_symbols_pyx __pyx_string_tab[2] +#define __pyx_n_u_ADJ __pyx_string_tab[3] +#define __pyx_n_u_ADP __pyx_string_tab[4] +#define __pyx_n_u_ADV __pyx_string_tab[5] +#define __pyx_n_u_AUX __pyx_string_tab[6] +#define __pyx_n_u_CARDINAL __pyx_string_tab[7] +#define __pyx_n_u_CCONJ __pyx_string_tab[8] +#define __pyx_n_u_CLUSTER __pyx_string_tab[9] +#define __pyx_n_u_CONJ __pyx_string_tab[10] +#define __pyx_n_u_DATE __pyx_string_tab[11] +#define __pyx_n_u_DEP __pyx_string_tab[12] +#define __pyx_n_u_DEPRECATED001 __pyx_string_tab[13] +#define __pyx_n_u_DEPRECATED002 __pyx_string_tab[14] +#define __pyx_n_u_DEPRECATED003 __pyx_string_tab[15] +#define __pyx_n_u_DEPRECATED004 __pyx_string_tab[16] +#define __pyx_n_u_DEPRECATED005 __pyx_string_tab[17] +#define __pyx_n_u_DEPRECATED006 __pyx_string_tab[18] +#define __pyx_n_u_DEPRECATED007 __pyx_string_tab[19] +#define __pyx_n_u_DEPRECATED008 __pyx_string_tab[20] +#define __pyx_n_u_DEPRECATED009 __pyx_string_tab[21] +#define __pyx_n_u_DEPRECATED010 __pyx_string_tab[22] +#define __pyx_n_u_DEPRECATED011 __pyx_string_tab[23] +#define __pyx_n_u_DEPRECATED012 __pyx_string_tab[24] +#define __pyx_n_u_DEPRECATED013 __pyx_string_tab[25] +#define __pyx_n_u_DEPRECATED014 __pyx_string_tab[26] +#define __pyx_n_u_DEPRECATED015 __pyx_string_tab[27] +#define __pyx_n_u_DEPRECATED016 __pyx_string_tab[28] +#define __pyx_n_u_DEPRECATED017 __pyx_string_tab[29] +#define __pyx_n_u_DEPRECATED018 __pyx_string_tab[30] +#define __pyx_n_u_DEPRECATED019 __pyx_string_tab[31] +#define __pyx_n_u_DEPRECATED020 __pyx_string_tab[32] +#define __pyx_n_u_DEPRECATED021 __pyx_string_tab[33] +#define __pyx_n_u_DEPRECATED022 __pyx_string_tab[34] +#define __pyx_n_u_DEPRECATED023 __pyx_string_tab[35] +#define __pyx_n_u_DEPRECATED024 __pyx_string_tab[36] +#define __pyx_n_u_DEPRECATED025 __pyx_string_tab[37] +#define __pyx_n_u_DEPRECATED026 __pyx_string_tab[38] +#define __pyx_n_u_DEPRECATED027 __pyx_string_tab[39] +#define __pyx_n_u_DEPRECATED028 __pyx_string_tab[40] +#define __pyx_n_u_DEPRECATED029 __pyx_string_tab[41] +#define __pyx_n_u_DEPRECATED030 __pyx_string_tab[42] +#define __pyx_n_u_DEPRECATED031 __pyx_string_tab[43] +#define __pyx_n_u_DEPRECATED032 __pyx_string_tab[44] +#define __pyx_n_u_DEPRECATED033 __pyx_string_tab[45] +#define __pyx_n_u_DEPRECATED034 __pyx_string_tab[46] +#define __pyx_n_u_DEPRECATED035 __pyx_string_tab[47] +#define __pyx_n_u_DEPRECATED036 __pyx_string_tab[48] +#define __pyx_n_u_DEPRECATED037 __pyx_string_tab[49] +#define __pyx_n_u_DEPRECATED038 __pyx_string_tab[50] +#define __pyx_n_u_DEPRECATED039 __pyx_string_tab[51] +#define __pyx_n_u_DEPRECATED040 __pyx_string_tab[52] +#define __pyx_n_u_DEPRECATED041 __pyx_string_tab[53] +#define __pyx_n_u_DEPRECATED042 __pyx_string_tab[54] +#define __pyx_n_u_DEPRECATED043 __pyx_string_tab[55] +#define __pyx_n_u_DEPRECATED044 __pyx_string_tab[56] +#define __pyx_n_u_DEPRECATED045 __pyx_string_tab[57] +#define __pyx_n_u_DEPRECATED046 __pyx_string_tab[58] +#define __pyx_n_u_DEPRECATED047 __pyx_string_tab[59] +#define __pyx_n_u_DEPRECATED048 __pyx_string_tab[60] +#define __pyx_n_u_DEPRECATED049 __pyx_string_tab[61] +#define __pyx_n_u_DEPRECATED050 __pyx_string_tab[62] +#define __pyx_n_u_DEPRECATED051 __pyx_string_tab[63] +#define __pyx_n_u_DEPRECATED052 __pyx_string_tab[64] +#define __pyx_n_u_DEPRECATED053 __pyx_string_tab[65] +#define __pyx_n_u_DEPRECATED054 __pyx_string_tab[66] +#define __pyx_n_u_DEPRECATED055 __pyx_string_tab[67] +#define __pyx_n_u_DEPRECATED056 __pyx_string_tab[68] +#define __pyx_n_u_DEPRECATED057 __pyx_string_tab[69] +#define __pyx_n_u_DEPRECATED058 __pyx_string_tab[70] +#define __pyx_n_u_DEPRECATED059 __pyx_string_tab[71] +#define __pyx_n_u_DEPRECATED060 __pyx_string_tab[72] +#define __pyx_n_u_DEPRECATED061 __pyx_string_tab[73] +#define __pyx_n_u_DEPRECATED062 __pyx_string_tab[74] +#define __pyx_n_u_DEPRECATED063 __pyx_string_tab[75] +#define __pyx_n_u_DEPRECATED064 __pyx_string_tab[76] +#define __pyx_n_u_DEPRECATED065 __pyx_string_tab[77] +#define __pyx_n_u_DEPRECATED066 __pyx_string_tab[78] +#define __pyx_n_u_DEPRECATED067 __pyx_string_tab[79] +#define __pyx_n_u_DEPRECATED068 __pyx_string_tab[80] +#define __pyx_n_u_DEPRECATED069 __pyx_string_tab[81] +#define __pyx_n_u_DEPRECATED070 __pyx_string_tab[82] +#define __pyx_n_u_DEPRECATED071 __pyx_string_tab[83] +#define __pyx_n_u_DEPRECATED072 __pyx_string_tab[84] +#define __pyx_n_u_DEPRECATED073 __pyx_string_tab[85] +#define __pyx_n_u_DEPRECATED074 __pyx_string_tab[86] +#define __pyx_n_u_DEPRECATED075 __pyx_string_tab[87] +#define __pyx_n_u_DEPRECATED076 __pyx_string_tab[88] +#define __pyx_n_u_DEPRECATED077 __pyx_string_tab[89] +#define __pyx_n_u_DEPRECATED078 __pyx_string_tab[90] +#define __pyx_n_u_DEPRECATED079 __pyx_string_tab[91] +#define __pyx_n_u_DEPRECATED080 __pyx_string_tab[92] +#define __pyx_n_u_DEPRECATED081 __pyx_string_tab[93] +#define __pyx_n_u_DEPRECATED082 __pyx_string_tab[94] +#define __pyx_n_u_DEPRECATED083 __pyx_string_tab[95] +#define __pyx_n_u_DEPRECATED084 __pyx_string_tab[96] +#define __pyx_n_u_DEPRECATED085 __pyx_string_tab[97] +#define __pyx_n_u_DEPRECATED086 __pyx_string_tab[98] +#define __pyx_n_u_DEPRECATED087 __pyx_string_tab[99] +#define __pyx_n_u_DEPRECATED088 __pyx_string_tab[100] +#define __pyx_n_u_DEPRECATED089 __pyx_string_tab[101] +#define __pyx_n_u_DEPRECATED090 __pyx_string_tab[102] +#define __pyx_n_u_DEPRECATED091 __pyx_string_tab[103] +#define __pyx_n_u_DEPRECATED092 __pyx_string_tab[104] +#define __pyx_n_u_DEPRECATED093 __pyx_string_tab[105] +#define __pyx_n_u_DEPRECATED094 __pyx_string_tab[106] +#define __pyx_n_u_DEPRECATED095 __pyx_string_tab[107] +#define __pyx_n_u_DEPRECATED096 __pyx_string_tab[108] +#define __pyx_n_u_DEPRECATED097 __pyx_string_tab[109] +#define __pyx_n_u_DEPRECATED098 __pyx_string_tab[110] +#define __pyx_n_u_DEPRECATED099 __pyx_string_tab[111] +#define __pyx_n_u_DEPRECATED100 __pyx_string_tab[112] +#define __pyx_n_u_DEPRECATED101 __pyx_string_tab[113] +#define __pyx_n_u_DEPRECATED102 __pyx_string_tab[114] +#define __pyx_n_u_DEPRECATED103 __pyx_string_tab[115] +#define __pyx_n_u_DEPRECATED104 __pyx_string_tab[116] +#define __pyx_n_u_DEPRECATED105 __pyx_string_tab[117] +#define __pyx_n_u_DEPRECATED106 __pyx_string_tab[118] +#define __pyx_n_u_DEPRECATED107 __pyx_string_tab[119] +#define __pyx_n_u_DEPRECATED108 __pyx_string_tab[120] +#define __pyx_n_u_DEPRECATED109 __pyx_string_tab[121] +#define __pyx_n_u_DEPRECATED110 __pyx_string_tab[122] +#define __pyx_n_u_DEPRECATED111 __pyx_string_tab[123] +#define __pyx_n_u_DEPRECATED112 __pyx_string_tab[124] +#define __pyx_n_u_DEPRECATED113 __pyx_string_tab[125] +#define __pyx_n_u_DEPRECATED114 __pyx_string_tab[126] +#define __pyx_n_u_DEPRECATED115 __pyx_string_tab[127] +#define __pyx_n_u_DEPRECATED116 __pyx_string_tab[128] +#define __pyx_n_u_DEPRECATED117 __pyx_string_tab[129] +#define __pyx_n_u_DEPRECATED118 __pyx_string_tab[130] +#define __pyx_n_u_DEPRECATED119 __pyx_string_tab[131] +#define __pyx_n_u_DEPRECATED120 __pyx_string_tab[132] +#define __pyx_n_u_DEPRECATED121 __pyx_string_tab[133] +#define __pyx_n_u_DEPRECATED122 __pyx_string_tab[134] +#define __pyx_n_u_DEPRECATED123 __pyx_string_tab[135] +#define __pyx_n_u_DEPRECATED124 __pyx_string_tab[136] +#define __pyx_n_u_DEPRECATED125 __pyx_string_tab[137] +#define __pyx_n_u_DEPRECATED126 __pyx_string_tab[138] +#define __pyx_n_u_DEPRECATED127 __pyx_string_tab[139] +#define __pyx_n_u_DEPRECATED128 __pyx_string_tab[140] +#define __pyx_n_u_DEPRECATED129 __pyx_string_tab[141] +#define __pyx_n_u_DEPRECATED130 __pyx_string_tab[142] +#define __pyx_n_u_DEPRECATED131 __pyx_string_tab[143] +#define __pyx_n_u_DEPRECATED132 __pyx_string_tab[144] +#define __pyx_n_u_DEPRECATED133 __pyx_string_tab[145] +#define __pyx_n_u_DEPRECATED134 __pyx_string_tab[146] +#define __pyx_n_u_DEPRECATED135 __pyx_string_tab[147] +#define __pyx_n_u_DEPRECATED136 __pyx_string_tab[148] +#define __pyx_n_u_DEPRECATED137 __pyx_string_tab[149] +#define __pyx_n_u_DEPRECATED138 __pyx_string_tab[150] +#define __pyx_n_u_DEPRECATED139 __pyx_string_tab[151] +#define __pyx_n_u_DEPRECATED140 __pyx_string_tab[152] +#define __pyx_n_u_DEPRECATED141 __pyx_string_tab[153] +#define __pyx_n_u_DEPRECATED142 __pyx_string_tab[154] +#define __pyx_n_u_DEPRECATED143 __pyx_string_tab[155] +#define __pyx_n_u_DEPRECATED144 __pyx_string_tab[156] +#define __pyx_n_u_DEPRECATED145 __pyx_string_tab[157] +#define __pyx_n_u_DEPRECATED146 __pyx_string_tab[158] +#define __pyx_n_u_DEPRECATED147 __pyx_string_tab[159] +#define __pyx_n_u_DEPRECATED148 __pyx_string_tab[160] +#define __pyx_n_u_DEPRECATED149 __pyx_string_tab[161] +#define __pyx_n_u_DEPRECATED150 __pyx_string_tab[162] +#define __pyx_n_u_DEPRECATED151 __pyx_string_tab[163] +#define __pyx_n_u_DEPRECATED152 __pyx_string_tab[164] +#define __pyx_n_u_DEPRECATED153 __pyx_string_tab[165] +#define __pyx_n_u_DEPRECATED154 __pyx_string_tab[166] +#define __pyx_n_u_DEPRECATED155 __pyx_string_tab[167] +#define __pyx_n_u_DEPRECATED156 __pyx_string_tab[168] +#define __pyx_n_u_DEPRECATED157 __pyx_string_tab[169] +#define __pyx_n_u_DEPRECATED158 __pyx_string_tab[170] +#define __pyx_n_u_DEPRECATED159 __pyx_string_tab[171] +#define __pyx_n_u_DEPRECATED160 __pyx_string_tab[172] +#define __pyx_n_u_DEPRECATED161 __pyx_string_tab[173] +#define __pyx_n_u_DEPRECATED162 __pyx_string_tab[174] +#define __pyx_n_u_DEPRECATED163 __pyx_string_tab[175] +#define __pyx_n_u_DEPRECATED164 __pyx_string_tab[176] +#define __pyx_n_u_DEPRECATED165 __pyx_string_tab[177] +#define __pyx_n_u_DEPRECATED166 __pyx_string_tab[178] +#define __pyx_n_u_DEPRECATED167 __pyx_string_tab[179] +#define __pyx_n_u_DEPRECATED168 __pyx_string_tab[180] +#define __pyx_n_u_DEPRECATED169 __pyx_string_tab[181] +#define __pyx_n_u_DEPRECATED170 __pyx_string_tab[182] +#define __pyx_n_u_DEPRECATED171 __pyx_string_tab[183] +#define __pyx_n_u_DEPRECATED172 __pyx_string_tab[184] +#define __pyx_n_u_DEPRECATED173 __pyx_string_tab[185] +#define __pyx_n_u_DEPRECATED174 __pyx_string_tab[186] +#define __pyx_n_u_DEPRECATED175 __pyx_string_tab[187] +#define __pyx_n_u_DEPRECATED176 __pyx_string_tab[188] +#define __pyx_n_u_DEPRECATED177 __pyx_string_tab[189] +#define __pyx_n_u_DEPRECATED178 __pyx_string_tab[190] +#define __pyx_n_u_DEPRECATED179 __pyx_string_tab[191] +#define __pyx_n_u_DEPRECATED180 __pyx_string_tab[192] +#define __pyx_n_u_DEPRECATED181 __pyx_string_tab[193] +#define __pyx_n_u_DEPRECATED182 __pyx_string_tab[194] +#define __pyx_n_u_DEPRECATED183 __pyx_string_tab[195] +#define __pyx_n_u_DEPRECATED184 __pyx_string_tab[196] +#define __pyx_n_u_DEPRECATED185 __pyx_string_tab[197] +#define __pyx_n_u_DEPRECATED186 __pyx_string_tab[198] +#define __pyx_n_u_DEPRECATED187 __pyx_string_tab[199] +#define __pyx_n_u_DEPRECATED188 __pyx_string_tab[200] +#define __pyx_n_u_DEPRECATED189 __pyx_string_tab[201] +#define __pyx_n_u_DEPRECATED190 __pyx_string_tab[202] +#define __pyx_n_u_DEPRECATED191 __pyx_string_tab[203] +#define __pyx_n_u_DEPRECATED192 __pyx_string_tab[204] +#define __pyx_n_u_DEPRECATED193 __pyx_string_tab[205] +#define __pyx_n_u_DEPRECATED194 __pyx_string_tab[206] +#define __pyx_n_u_DEPRECATED195 __pyx_string_tab[207] +#define __pyx_n_u_DEPRECATED196 __pyx_string_tab[208] +#define __pyx_n_u_DEPRECATED197 __pyx_string_tab[209] +#define __pyx_n_u_DEPRECATED198 __pyx_string_tab[210] +#define __pyx_n_u_DEPRECATED199 __pyx_string_tab[211] +#define __pyx_n_u_DEPRECATED200 __pyx_string_tab[212] +#define __pyx_n_u_DEPRECATED201 __pyx_string_tab[213] +#define __pyx_n_u_DEPRECATED202 __pyx_string_tab[214] +#define __pyx_n_u_DEPRECATED203 __pyx_string_tab[215] +#define __pyx_n_u_DEPRECATED204 __pyx_string_tab[216] +#define __pyx_n_u_DEPRECATED205 __pyx_string_tab[217] +#define __pyx_n_u_DEPRECATED206 __pyx_string_tab[218] +#define __pyx_n_u_DEPRECATED207 __pyx_string_tab[219] +#define __pyx_n_u_DEPRECATED208 __pyx_string_tab[220] +#define __pyx_n_u_DEPRECATED209 __pyx_string_tab[221] +#define __pyx_n_u_DEPRECATED210 __pyx_string_tab[222] +#define __pyx_n_u_DEPRECATED211 __pyx_string_tab[223] +#define __pyx_n_u_DEPRECATED212 __pyx_string_tab[224] +#define __pyx_n_u_DEPRECATED213 __pyx_string_tab[225] +#define __pyx_n_u_DEPRECATED214 __pyx_string_tab[226] +#define __pyx_n_u_DEPRECATED215 __pyx_string_tab[227] +#define __pyx_n_u_DEPRECATED216 __pyx_string_tab[228] +#define __pyx_n_u_DEPRECATED217 __pyx_string_tab[229] +#define __pyx_n_u_DEPRECATED218 __pyx_string_tab[230] +#define __pyx_n_u_DEPRECATED219 __pyx_string_tab[231] +#define __pyx_n_u_DEPRECATED220 __pyx_string_tab[232] +#define __pyx_n_u_DEPRECATED221 __pyx_string_tab[233] +#define __pyx_n_u_DEPRECATED222 __pyx_string_tab[234] +#define __pyx_n_u_DEPRECATED223 __pyx_string_tab[235] +#define __pyx_n_u_DEPRECATED224 __pyx_string_tab[236] +#define __pyx_n_u_DEPRECATED225 __pyx_string_tab[237] +#define __pyx_n_u_DEPRECATED226 __pyx_string_tab[238] +#define __pyx_n_u_DEPRECATED227 __pyx_string_tab[239] +#define __pyx_n_u_DEPRECATED228 __pyx_string_tab[240] +#define __pyx_n_u_DEPRECATED229 __pyx_string_tab[241] +#define __pyx_n_u_DEPRECATED230 __pyx_string_tab[242] +#define __pyx_n_u_DEPRECATED231 __pyx_string_tab[243] +#define __pyx_n_u_DEPRECATED232 __pyx_string_tab[244] +#define __pyx_n_u_DEPRECATED233 __pyx_string_tab[245] +#define __pyx_n_u_DEPRECATED234 __pyx_string_tab[246] +#define __pyx_n_u_DEPRECATED235 __pyx_string_tab[247] +#define __pyx_n_u_DEPRECATED236 __pyx_string_tab[248] +#define __pyx_n_u_DEPRECATED237 __pyx_string_tab[249] +#define __pyx_n_u_DEPRECATED238 __pyx_string_tab[250] +#define __pyx_n_u_DEPRECATED239 __pyx_string_tab[251] +#define __pyx_n_u_DEPRECATED240 __pyx_string_tab[252] +#define __pyx_n_u_DEPRECATED241 __pyx_string_tab[253] +#define __pyx_n_u_DEPRECATED242 __pyx_string_tab[254] +#define __pyx_n_u_DEPRECATED243 __pyx_string_tab[255] +#define __pyx_n_u_DEPRECATED244 __pyx_string_tab[256] +#define __pyx_n_u_DEPRECATED245 __pyx_string_tab[257] +#define __pyx_n_u_DEPRECATED246 __pyx_string_tab[258] +#define __pyx_n_u_DEPRECATED247 __pyx_string_tab[259] +#define __pyx_n_u_DEPRECATED248 __pyx_string_tab[260] +#define __pyx_n_u_DEPRECATED249 __pyx_string_tab[261] +#define __pyx_n_u_DEPRECATED250 __pyx_string_tab[262] +#define __pyx_n_u_DEPRECATED251 __pyx_string_tab[263] +#define __pyx_n_u_DEPRECATED252 __pyx_string_tab[264] +#define __pyx_n_u_DEPRECATED253 __pyx_string_tab[265] +#define __pyx_n_u_DEPRECATED254 __pyx_string_tab[266] +#define __pyx_n_u_DEPRECATED255 __pyx_string_tab[267] +#define __pyx_n_u_DEPRECATED256 __pyx_string_tab[268] +#define __pyx_n_u_DEPRECATED257 __pyx_string_tab[269] +#define __pyx_n_u_DEPRECATED258 __pyx_string_tab[270] +#define __pyx_n_u_DEPRECATED259 __pyx_string_tab[271] +#define __pyx_n_u_DEPRECATED260 __pyx_string_tab[272] +#define __pyx_n_u_DEPRECATED261 __pyx_string_tab[273] +#define __pyx_n_u_DEPRECATED262 __pyx_string_tab[274] +#define __pyx_n_u_DEPRECATED263 __pyx_string_tab[275] +#define __pyx_n_u_DEPRECATED264 __pyx_string_tab[276] +#define __pyx_n_u_DEPRECATED265 __pyx_string_tab[277] +#define __pyx_n_u_DEPRECATED266 __pyx_string_tab[278] +#define __pyx_n_u_DEPRECATED267 __pyx_string_tab[279] +#define __pyx_n_u_DEPRECATED268 __pyx_string_tab[280] +#define __pyx_n_u_DEPRECATED269 __pyx_string_tab[281] +#define __pyx_n_u_DEPRECATED270 __pyx_string_tab[282] +#define __pyx_n_u_DEPRECATED271 __pyx_string_tab[283] +#define __pyx_n_u_DEPRECATED272 __pyx_string_tab[284] +#define __pyx_n_u_DEPRECATED273 __pyx_string_tab[285] +#define __pyx_n_u_DEPRECATED274 __pyx_string_tab[286] +#define __pyx_n_u_DEPRECATED275 __pyx_string_tab[287] +#define __pyx_n_u_DEPRECATED276 __pyx_string_tab[288] +#define __pyx_n_u_DET __pyx_string_tab[289] +#define __pyx_n_u_ENT_ID __pyx_string_tab[290] +#define __pyx_n_u_ENT_IOB __pyx_string_tab[291] +#define __pyx_n_u_ENT_KB_ID __pyx_string_tab[292] +#define __pyx_n_u_ENT_TYPE __pyx_string_tab[293] +#define __pyx_n_u_EOL __pyx_string_tab[294] +#define __pyx_n_u_EVENT __pyx_string_tab[295] +#define __pyx_n_u_FACILITY __pyx_string_tab[296] +#define __pyx_n_u_FLAG19 __pyx_string_tab[297] +#define __pyx_n_u_FLAG20 __pyx_string_tab[298] +#define __pyx_n_u_FLAG21 __pyx_string_tab[299] +#define __pyx_n_u_FLAG22 __pyx_string_tab[300] +#define __pyx_n_u_FLAG23 __pyx_string_tab[301] +#define __pyx_n_u_FLAG24 __pyx_string_tab[302] +#define __pyx_n_u_FLAG25 __pyx_string_tab[303] +#define __pyx_n_u_FLAG26 __pyx_string_tab[304] +#define __pyx_n_u_FLAG27 __pyx_string_tab[305] +#define __pyx_n_u_FLAG28 __pyx_string_tab[306] +#define __pyx_n_u_FLAG29 __pyx_string_tab[307] +#define __pyx_n_u_FLAG30 __pyx_string_tab[308] +#define __pyx_n_u_FLAG31 __pyx_string_tab[309] +#define __pyx_n_u_FLAG32 __pyx_string_tab[310] +#define __pyx_n_u_FLAG33 __pyx_string_tab[311] +#define __pyx_n_u_FLAG34 __pyx_string_tab[312] +#define __pyx_n_u_FLAG35 __pyx_string_tab[313] +#define __pyx_n_u_FLAG36 __pyx_string_tab[314] +#define __pyx_n_u_FLAG37 __pyx_string_tab[315] +#define __pyx_n_u_FLAG38 __pyx_string_tab[316] +#define __pyx_n_u_FLAG39 __pyx_string_tab[317] +#define __pyx_n_u_FLAG40 __pyx_string_tab[318] +#define __pyx_n_u_FLAG41 __pyx_string_tab[319] +#define __pyx_n_u_FLAG42 __pyx_string_tab[320] +#define __pyx_n_u_FLAG43 __pyx_string_tab[321] +#define __pyx_n_u_FLAG44 __pyx_string_tab[322] +#define __pyx_n_u_FLAG45 __pyx_string_tab[323] +#define __pyx_n_u_FLAG46 __pyx_string_tab[324] +#define __pyx_n_u_FLAG47 __pyx_string_tab[325] +#define __pyx_n_u_FLAG48 __pyx_string_tab[326] +#define __pyx_n_u_FLAG49 __pyx_string_tab[327] +#define __pyx_n_u_FLAG50 __pyx_string_tab[328] +#define __pyx_n_u_FLAG51 __pyx_string_tab[329] +#define __pyx_n_u_FLAG52 __pyx_string_tab[330] +#define __pyx_n_u_FLAG53 __pyx_string_tab[331] +#define __pyx_n_u_FLAG54 __pyx_string_tab[332] +#define __pyx_n_u_FLAG55 __pyx_string_tab[333] +#define __pyx_n_u_FLAG56 __pyx_string_tab[334] +#define __pyx_n_u_FLAG57 __pyx_string_tab[335] +#define __pyx_n_u_FLAG58 __pyx_string_tab[336] +#define __pyx_n_u_FLAG59 __pyx_string_tab[337] +#define __pyx_n_u_FLAG60 __pyx_string_tab[338] +#define __pyx_n_u_FLAG61 __pyx_string_tab[339] +#define __pyx_n_u_FLAG62 __pyx_string_tab[340] +#define __pyx_n_u_FLAG63 __pyx_string_tab[341] +#define __pyx_n_u_GPE __pyx_string_tab[342] +#define __pyx_n_u_HEAD __pyx_string_tab[343] +#define __pyx_n_u_ID __pyx_string_tab[344] +#define __pyx_n_u_IDS __pyx_string_tab[345] +#define __pyx_n_u_IDX __pyx_string_tab[346] +#define __pyx_n_u_INTJ __pyx_string_tab[347] +#define __pyx_n_u_IS_ALPHA __pyx_string_tab[348] +#define __pyx_n_u_IS_ASCII __pyx_string_tab[349] +#define __pyx_n_u_IS_BRACKET __pyx_string_tab[350] +#define __pyx_n_u_IS_CURRENCY __pyx_string_tab[351] +#define __pyx_n_u_IS_DIGIT __pyx_string_tab[352] +#define __pyx_n_u_IS_LEFT_PUNCT __pyx_string_tab[353] +#define __pyx_n_u_IS_LOWER __pyx_string_tab[354] +#define __pyx_n_u_IS_OOV_DEPRECATED __pyx_string_tab[355] +#define __pyx_n_u_IS_PUNCT __pyx_string_tab[356] +#define __pyx_n_u_IS_QUOTE __pyx_string_tab[357] +#define __pyx_n_u_IS_RIGHT_PUNCT __pyx_string_tab[358] +#define __pyx_n_u_IS_SPACE __pyx_string_tab[359] +#define __pyx_n_u_IS_STOP __pyx_string_tab[360] +#define __pyx_n_u_IS_TITLE __pyx_string_tab[361] +#define __pyx_n_u_IS_UPPER __pyx_string_tab[362] +#define __pyx_n_u_LANG __pyx_string_tab[363] +#define __pyx_n_u_LANGUAGE __pyx_string_tab[364] +#define __pyx_n_u_LAW __pyx_string_tab[365] +#define __pyx_n_u_LEMMA __pyx_string_tab[366] +#define __pyx_n_u_LENGTH __pyx_string_tab[367] +#define __pyx_n_u_LIKE_EMAIL __pyx_string_tab[368] +#define __pyx_n_u_LIKE_NUM __pyx_string_tab[369] +#define __pyx_n_u_LIKE_URL __pyx_string_tab[370] +#define __pyx_n_u_LOC __pyx_string_tab[371] +#define __pyx_n_u_LOWER __pyx_string_tab[372] +#define __pyx_n_u_MONEY __pyx_string_tab[373] +#define __pyx_n_u_MORPH __pyx_string_tab[374] +#define __pyx_n_u_NAMES __pyx_string_tab[375] +#define __pyx_n_u_NORM __pyx_string_tab[376] +#define __pyx_n_u_NORP __pyx_string_tab[377] +#define __pyx_n_u_NOUN __pyx_string_tab[378] +#define __pyx_n_u_NUM __pyx_string_tab[379] +#define __pyx_n_u_ORDINAL __pyx_string_tab[380] +#define __pyx_n_u_ORG __pyx_string_tab[381] +#define __pyx_n_u_ORTH __pyx_string_tab[382] +#define __pyx_n_u_PART __pyx_string_tab[383] +#define __pyx_n_u_PERCENT __pyx_string_tab[384] +#define __pyx_n_u_PERSON __pyx_string_tab[385] +#define __pyx_n_u_POS __pyx_string_tab[386] +#define __pyx_n_u_PREFIX __pyx_string_tab[387] +#define __pyx_n_u_PROB __pyx_string_tab[388] +#define __pyx_n_u_PRODUCT __pyx_string_tab[389] +#define __pyx_n_u_PRON __pyx_string_tab[390] +#define __pyx_n_u_PROPN __pyx_string_tab[391] +#define __pyx_n_u_PUNCT __pyx_string_tab[392] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[393] +#define __pyx_n_u_QUANTITY __pyx_string_tab[394] +#define __pyx_n_u_SCONJ __pyx_string_tab[395] +#define __pyx_n_u_SENT_START __pyx_string_tab[396] +#define __pyx_n_u_SHAPE __pyx_string_tab[397] +#define __pyx_n_u_SPACE __pyx_string_tab[398] +#define __pyx_n_u_SPACY __pyx_string_tab[399] +#define __pyx_n_u_SUFFIX __pyx_string_tab[400] +#define __pyx_n_u_SYM __pyx_string_tab[401] +#define __pyx_n_u_TAG __pyx_string_tab[402] +#define __pyx_n_u_TIME __pyx_string_tab[403] +#define __pyx_n_u_VERB __pyx_string_tab[404] +#define __pyx_n_u_WORK_OF_ART __pyx_string_tab[405] +#define __pyx_n_u_X __pyx_string_tab[406] +#define __pyx_n_u__2 __pyx_string_tab[407] +#define __pyx_n_u_acl __pyx_string_tab[408] +#define __pyx_n_u_acomp __pyx_string_tab[409] +#define __pyx_n_u_advcl __pyx_string_tab[410] +#define __pyx_n_u_advmod __pyx_string_tab[411] +#define __pyx_n_u_agent __pyx_string_tab[412] +#define __pyx_n_u_amod __pyx_string_tab[413] +#define __pyx_n_u_appos __pyx_string_tab[414] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[415] +#define __pyx_n_u_attr __pyx_string_tab[416] +#define __pyx_n_u_aux __pyx_string_tab[417] +#define __pyx_n_u_auxpass __pyx_string_tab[418] +#define __pyx_n_u_cc __pyx_string_tab[419] +#define __pyx_n_u_ccomp __pyx_string_tab[420] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[421] +#define __pyx_n_u_complm __pyx_string_tab[422] +#define __pyx_n_u_conj __pyx_string_tab[423] +#define __pyx_n_u_cop __pyx_string_tab[424] +#define __pyx_n_u_csubj __pyx_string_tab[425] +#define __pyx_n_u_csubjpass __pyx_string_tab[426] +#define __pyx_n_u_dep __pyx_string_tab[427] +#define __pyx_n_u_det __pyx_string_tab[428] +#define __pyx_n_u_dobj __pyx_string_tab[429] +#define __pyx_n_u_expl __pyx_string_tab[430] +#define __pyx_n_u_func __pyx_string_tab[431] +#define __pyx_n_u_hmod __pyx_string_tab[432] +#define __pyx_n_u_hyph __pyx_string_tab[433] +#define __pyx_n_u_infmod __pyx_string_tab[434] +#define __pyx_n_u_intj __pyx_string_tab[435] +#define __pyx_n_u_iobj __pyx_string_tab[436] +#define __pyx_n_u_is_coroutine __pyx_string_tab[437] +#define __pyx_n_u_it __pyx_string_tab[438] +#define __pyx_n_u_items __pyx_string_tab[439] +#define __pyx_n_u_key __pyx_string_tab[440] +#define __pyx_n_u_main __pyx_string_tab[441] +#define __pyx_n_u_mark __pyx_string_tab[442] +#define __pyx_n_u_meta __pyx_string_tab[443] +#define __pyx_n_u_module __pyx_string_tab[444] +#define __pyx_n_u_name __pyx_string_tab[445] +#define __pyx_n_u_neg __pyx_string_tab[446] +#define __pyx_n_u_nmod __pyx_string_tab[447] +#define __pyx_n_u_nn __pyx_string_tab[448] +#define __pyx_n_u_npadvmod __pyx_string_tab[449] +#define __pyx_n_u_nsubj __pyx_string_tab[450] +#define __pyx_n_u_nsubjpass __pyx_string_tab[451] +#define __pyx_n_u_num __pyx_string_tab[452] +#define __pyx_n_u_number __pyx_string_tab[453] +#define __pyx_n_u_obj __pyx_string_tab[454] +#define __pyx_n_u_obl __pyx_string_tab[455] +#define __pyx_n_u_oprd __pyx_string_tab[456] +#define __pyx_n_u_parataxis __pyx_string_tab[457] +#define __pyx_n_u_partmod __pyx_string_tab[458] +#define __pyx_n_u_pcomp __pyx_string_tab[459] +#define __pyx_n_u_pobj __pyx_string_tab[460] +#define __pyx_n_u_pop __pyx_string_tab[461] +#define __pyx_n_u_poss __pyx_string_tab[462] +#define __pyx_n_u_possessive __pyx_string_tab[463] +#define __pyx_n_u_preconj __pyx_string_tab[464] +#define __pyx_n_u_prep __pyx_string_tab[465] +#define __pyx_n_u_prt __pyx_string_tab[466] +#define __pyx_n_u_punct __pyx_string_tab[467] +#define __pyx_n_u_qualname __pyx_string_tab[468] +#define __pyx_n_u_quantmod __pyx_string_tab[469] +#define __pyx_n_u_rcmod __pyx_string_tab[470] +#define __pyx_n_u_relcl __pyx_string_tab[471] +#define __pyx_n_u_root __pyx_string_tab[472] +#define __pyx_n_u_set_name __pyx_string_tab[473] +#define __pyx_n_u_setdefault __pyx_string_tab[474] +#define __pyx_n_u_sort_nums __pyx_string_tab[475] +#define __pyx_n_u_sorted __pyx_string_tab[476] +#define __pyx_n_u_spacy_symbols __pyx_string_tab[477] +#define __pyx_n_u_test __pyx_string_tab[478] +#define __pyx_n_u_update __pyx_string_tab[479] +#define __pyx_n_u_values __pyx_string_tab[480] +#define __pyx_n_u_x __pyx_string_tab[481] +#define __pyx_n_u_xcomp __pyx_string_tab[482] +#define __pyx_kp_b_iso88591_1AQ __pyx_string_tab[483] +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { + __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #if CYTHON_PEP489_MULTI_PHASE_INIT + __Pyx_State_RemoveModule(NULL); + #endif + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<484; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } +/* #### Code section: module_state_clear_contents ### */ +/* CommonTypesMetaclass.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + +/* #### Code section: module_state_clear_end ### */ +return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<484; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } +/* #### Code section: module_state_traverse_contents ### */ +/* CommonTypesMetaclass.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "spacy/symbols.pyx":473 + * + * + * def sort_nums(x): # <<<<<<<<<<<<<< + * return x[1] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7symbols_1sort_nums(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7symbols_sort_nums, "sort_nums(x)"); +static PyMethodDef __pyx_mdef_5spacy_7symbols_1sort_nums = {"sort_nums", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7symbols_1sort_nums, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7symbols_sort_nums}; +static PyObject *__pyx_pw_5spacy_7symbols_1sort_nums(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_x = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sort_nums (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_x,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 473, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 473, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "sort_nums", 0) < (0)) __PYX_ERR(0, 473, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("sort_nums", 1, 1, 1, i); __PYX_ERR(0, 473, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 473, __pyx_L3_error) + } + __pyx_v_x = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sort_nums", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 473, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.symbols.sort_nums", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7symbols_sort_nums(__pyx_self, __pyx_v_x); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7symbols_sort_nums(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sort_nums", 0); + + /* "spacy/symbols.pyx":474 + * + * def sort_nums(x): + * return x[1] # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/symbols.pyx":473 + * + * + * def sort_nums(x): # <<<<<<<<<<<<<< + * return x[1] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.symbols.sort_nums", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +/* #### Code section: initfunc_declarations ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ +/* #### Code section: init_module ### */ + +static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_symbols(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_symbols}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #endif + #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE + {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, + #endif + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "symbols", + 0, /* m_doc */ + #if CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstatetype), /* m_size */ + #else + (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif + +/* PyModInitFuncType */ +#ifndef CYTHON_NO_PYINIT_EXPORT + #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#else + #ifdef __cplusplus + #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * + #else + #define __Pyx_PyMODINIT_FUNC PyObject * + #endif +#endif + +__Pyx_PyMODINIT_FUNC PyInit_symbols(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_symbols(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +/* ModuleCreationPEP489 */ +#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) +static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { + { + PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think + if (!module) { + PyErr_Clear(); // just try the 3.8-3.12 version + module = PyImport_ImportModule("_xxsubinterpreters"); + if (!module) goto bad; + } + PyObject *current = PyObject_CallMethod(module, "get_current", NULL); + Py_DECREF(module); + if (!current) goto bad; + if (PyTuple_Check(current)) { + PyObject *new_current = PySequence_GetItem(current, 0); + Py_DECREF(current); + current = new_current; + if (!new_current) goto bad; + } + long long as_c_int = PyLong_AsLongLong(current); + Py_DECREF(current); + return as_c_int; + } + bad: + PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); + return -1; +} +#endif +#if !CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + static PY_INT64_T main_interpreter_id = -1; +#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_GRAAL + PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) + PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); +#elif CYTHON_COMPILING_IN_LIMITED_API + PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); +#else + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); +#endif + if (unlikely(current_id == -1)) { + return -1; + } + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return 0; + } else if (unlikely(main_interpreter_id != current_id)) { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#endif +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + #if !CYTHON_USE_MODULE_STATE + if (__Pyx_check_single_interpreter()) + return NULL; + #endif + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_symbols(PyObject *__pyx_pyinit_module) +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + __pyx_mstatetype *__pyx_mstate = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'symbols' has already been imported. Re-initialisation is not supported."); + return -1; + } + #else + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_t_1 = __pyx_pyinit_module; + Py_INCREF(__pyx_t_1); + #else + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #if CYTHON_USE_MODULE_STATE + { + int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "symbols" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = __pyx_t_1; + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); + #endif + __pyx_mstate = __pyx_mstate_global; + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_mstate->__pyx_d); + __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /* ImportRefnannyAPI */ + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + +__Pyx_RefNannySetupContext("PyInit_symbols", 0); + __Pyx_init_runtime_version(); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Library function declarations ---*/ + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_module_is_main_spacy__symbols) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "spacy.symbols")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.symbols", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(__pyx_mstate); + (void)__Pyx_modinit_variable_export_code(__pyx_mstate); + (void)__Pyx_modinit_function_export_code(__pyx_mstate); + (void)__Pyx_modinit_type_init_code(__pyx_mstate); + (void)__Pyx_modinit_type_import_code(__pyx_mstate); + (void)__Pyx_modinit_variable_import_code(__pyx_mstate); + (void)__Pyx_modinit_function_import_code(__pyx_mstate); + /*--- Execution code ---*/ + + /* "spacy/symbols.pyx":4 + * # cython: profile=False + * IDS = { + * "": NIL, # <<<<<<<<<<<<<< + * "IS_ALPHA": IS_ALPHA, + * "IS_ASCII": IS_ASCII, +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(457); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_NIL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":5 + * IDS = { + * "": NIL, + * "IS_ALPHA": IS_ALPHA, # <<<<<<<<<<<<<< + * "IS_ASCII": IS_ASCII, + * "IS_DIGIT": IS_DIGIT, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_ALPHA); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_ALPHA, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":6 + * "": NIL, + * "IS_ALPHA": IS_ALPHA, + * "IS_ASCII": IS_ASCII, # <<<<<<<<<<<<<< + * "IS_DIGIT": IS_DIGIT, + * "IS_LOWER": IS_LOWER, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_ASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_ASCII, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":7 + * "IS_ALPHA": IS_ALPHA, + * "IS_ASCII": IS_ASCII, + * "IS_DIGIT": IS_DIGIT, # <<<<<<<<<<<<<< + * "IS_LOWER": IS_LOWER, + * "IS_PUNCT": IS_PUNCT, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_DIGIT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_DIGIT, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":8 + * "IS_ASCII": IS_ASCII, + * "IS_DIGIT": IS_DIGIT, + * "IS_LOWER": IS_LOWER, # <<<<<<<<<<<<<< + * "IS_PUNCT": IS_PUNCT, + * "IS_SPACE": IS_SPACE, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_LOWER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_LOWER, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":9 + * "IS_DIGIT": IS_DIGIT, + * "IS_LOWER": IS_LOWER, + * "IS_PUNCT": IS_PUNCT, # <<<<<<<<<<<<<< + * "IS_SPACE": IS_SPACE, + * "IS_TITLE": IS_TITLE, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_PUNCT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_PUNCT, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":10 + * "IS_LOWER": IS_LOWER, + * "IS_PUNCT": IS_PUNCT, + * "IS_SPACE": IS_SPACE, # <<<<<<<<<<<<<< + * "IS_TITLE": IS_TITLE, + * "IS_UPPER": IS_UPPER, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_SPACE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_SPACE, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":11 + * "IS_PUNCT": IS_PUNCT, + * "IS_SPACE": IS_SPACE, + * "IS_TITLE": IS_TITLE, # <<<<<<<<<<<<<< + * "IS_UPPER": IS_UPPER, + * "LIKE_URL": LIKE_URL, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_TITLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_TITLE, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":12 + * "IS_SPACE": IS_SPACE, + * "IS_TITLE": IS_TITLE, + * "IS_UPPER": IS_UPPER, # <<<<<<<<<<<<<< + * "LIKE_URL": LIKE_URL, + * "LIKE_NUM": LIKE_NUM, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_UPPER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_UPPER, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":13 + * "IS_TITLE": IS_TITLE, + * "IS_UPPER": IS_UPPER, + * "LIKE_URL": LIKE_URL, # <<<<<<<<<<<<<< + * "LIKE_NUM": LIKE_NUM, + * "LIKE_EMAIL": LIKE_EMAIL, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_LIKE_URL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LIKE_URL, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":14 + * "IS_UPPER": IS_UPPER, + * "LIKE_URL": LIKE_URL, + * "LIKE_NUM": LIKE_NUM, # <<<<<<<<<<<<<< + * "LIKE_EMAIL": LIKE_EMAIL, + * "IS_STOP": IS_STOP, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_LIKE_NUM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LIKE_NUM, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":15 + * "LIKE_URL": LIKE_URL, + * "LIKE_NUM": LIKE_NUM, + * "LIKE_EMAIL": LIKE_EMAIL, # <<<<<<<<<<<<<< + * "IS_STOP": IS_STOP, + * "IS_OOV_DEPRECATED": IS_OOV_DEPRECATED, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_LIKE_EMAIL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LIKE_EMAIL, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":16 + * "LIKE_NUM": LIKE_NUM, + * "LIKE_EMAIL": LIKE_EMAIL, + * "IS_STOP": IS_STOP, # <<<<<<<<<<<<<< + * "IS_OOV_DEPRECATED": IS_OOV_DEPRECATED, + * "IS_BRACKET": IS_BRACKET, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_STOP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_STOP, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":17 + * "LIKE_EMAIL": LIKE_EMAIL, + * "IS_STOP": IS_STOP, + * "IS_OOV_DEPRECATED": IS_OOV_DEPRECATED, # <<<<<<<<<<<<<< + * "IS_BRACKET": IS_BRACKET, + * "IS_QUOTE": IS_QUOTE, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_OOV_DEPRECATED, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":18 + * "IS_STOP": IS_STOP, + * "IS_OOV_DEPRECATED": IS_OOV_DEPRECATED, + * "IS_BRACKET": IS_BRACKET, # <<<<<<<<<<<<<< + * "IS_QUOTE": IS_QUOTE, + * "IS_LEFT_PUNCT": IS_LEFT_PUNCT, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_BRACKET); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_BRACKET, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":19 + * "IS_OOV_DEPRECATED": IS_OOV_DEPRECATED, + * "IS_BRACKET": IS_BRACKET, + * "IS_QUOTE": IS_QUOTE, # <<<<<<<<<<<<<< + * "IS_LEFT_PUNCT": IS_LEFT_PUNCT, + * "IS_RIGHT_PUNCT": IS_RIGHT_PUNCT, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_QUOTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_QUOTE, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":20 + * "IS_BRACKET": IS_BRACKET, + * "IS_QUOTE": IS_QUOTE, + * "IS_LEFT_PUNCT": IS_LEFT_PUNCT, # <<<<<<<<<<<<<< + * "IS_RIGHT_PUNCT": IS_RIGHT_PUNCT, + * "IS_CURRENCY": IS_CURRENCY, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_LEFT_PUNCT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_LEFT_PUNCT, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":21 + * "IS_QUOTE": IS_QUOTE, + * "IS_LEFT_PUNCT": IS_LEFT_PUNCT, + * "IS_RIGHT_PUNCT": IS_RIGHT_PUNCT, # <<<<<<<<<<<<<< + * "IS_CURRENCY": IS_CURRENCY, + * +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_RIGHT_PUNCT, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":22 + * "IS_LEFT_PUNCT": IS_LEFT_PUNCT, + * "IS_RIGHT_PUNCT": IS_RIGHT_PUNCT, + * "IS_CURRENCY": IS_CURRENCY, # <<<<<<<<<<<<<< + * + * "FLAG19": FLAG19, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IS_CURRENCY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IS_CURRENCY, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":24 + * "IS_CURRENCY": IS_CURRENCY, + * + * "FLAG19": FLAG19, # <<<<<<<<<<<<<< + * "FLAG20": FLAG20, + * "FLAG21": FLAG21, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG19); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG19, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":25 + * + * "FLAG19": FLAG19, + * "FLAG20": FLAG20, # <<<<<<<<<<<<<< + * "FLAG21": FLAG21, + * "FLAG22": FLAG22, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG20); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG20, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":26 + * "FLAG19": FLAG19, + * "FLAG20": FLAG20, + * "FLAG21": FLAG21, # <<<<<<<<<<<<<< + * "FLAG22": FLAG22, + * "FLAG23": FLAG23, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG21); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG21, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":27 + * "FLAG20": FLAG20, + * "FLAG21": FLAG21, + * "FLAG22": FLAG22, # <<<<<<<<<<<<<< + * "FLAG23": FLAG23, + * "FLAG24": FLAG24, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG22); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG22, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":28 + * "FLAG21": FLAG21, + * "FLAG22": FLAG22, + * "FLAG23": FLAG23, # <<<<<<<<<<<<<< + * "FLAG24": FLAG24, + * "FLAG25": FLAG25, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG23); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG23, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":29 + * "FLAG22": FLAG22, + * "FLAG23": FLAG23, + * "FLAG24": FLAG24, # <<<<<<<<<<<<<< + * "FLAG25": FLAG25, + * "FLAG26": FLAG26, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG24); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG24, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":30 + * "FLAG23": FLAG23, + * "FLAG24": FLAG24, + * "FLAG25": FLAG25, # <<<<<<<<<<<<<< + * "FLAG26": FLAG26, + * "FLAG27": FLAG27, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG25); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG25, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":31 + * "FLAG24": FLAG24, + * "FLAG25": FLAG25, + * "FLAG26": FLAG26, # <<<<<<<<<<<<<< + * "FLAG27": FLAG27, + * "FLAG28": FLAG28, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG26); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG26, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":32 + * "FLAG25": FLAG25, + * "FLAG26": FLAG26, + * "FLAG27": FLAG27, # <<<<<<<<<<<<<< + * "FLAG28": FLAG28, + * "FLAG29": FLAG29, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG27); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG27, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":33 + * "FLAG26": FLAG26, + * "FLAG27": FLAG27, + * "FLAG28": FLAG28, # <<<<<<<<<<<<<< + * "FLAG29": FLAG29, + * "FLAG30": FLAG30, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG28); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG28, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":34 + * "FLAG27": FLAG27, + * "FLAG28": FLAG28, + * "FLAG29": FLAG29, # <<<<<<<<<<<<<< + * "FLAG30": FLAG30, + * "FLAG31": FLAG31, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG29); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG29, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":35 + * "FLAG28": FLAG28, + * "FLAG29": FLAG29, + * "FLAG30": FLAG30, # <<<<<<<<<<<<<< + * "FLAG31": FLAG31, + * "FLAG32": FLAG32, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG30); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG30, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":36 + * "FLAG29": FLAG29, + * "FLAG30": FLAG30, + * "FLAG31": FLAG31, # <<<<<<<<<<<<<< + * "FLAG32": FLAG32, + * "FLAG33": FLAG33, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG31); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG31, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":37 + * "FLAG30": FLAG30, + * "FLAG31": FLAG31, + * "FLAG32": FLAG32, # <<<<<<<<<<<<<< + * "FLAG33": FLAG33, + * "FLAG34": FLAG34, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG32, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":38 + * "FLAG31": FLAG31, + * "FLAG32": FLAG32, + * "FLAG33": FLAG33, # <<<<<<<<<<<<<< + * "FLAG34": FLAG34, + * "FLAG35": FLAG35, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG33); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG33, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":39 + * "FLAG32": FLAG32, + * "FLAG33": FLAG33, + * "FLAG34": FLAG34, # <<<<<<<<<<<<<< + * "FLAG35": FLAG35, + * "FLAG36": FLAG36, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG34); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG34, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":40 + * "FLAG33": FLAG33, + * "FLAG34": FLAG34, + * "FLAG35": FLAG35, # <<<<<<<<<<<<<< + * "FLAG36": FLAG36, + * "FLAG37": FLAG37, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG35); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG35, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":41 + * "FLAG34": FLAG34, + * "FLAG35": FLAG35, + * "FLAG36": FLAG36, # <<<<<<<<<<<<<< + * "FLAG37": FLAG37, + * "FLAG38": FLAG38, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG36); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG36, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":42 + * "FLAG35": FLAG35, + * "FLAG36": FLAG36, + * "FLAG37": FLAG37, # <<<<<<<<<<<<<< + * "FLAG38": FLAG38, + * "FLAG39": FLAG39, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG37); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG37, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":43 + * "FLAG36": FLAG36, + * "FLAG37": FLAG37, + * "FLAG38": FLAG38, # <<<<<<<<<<<<<< + * "FLAG39": FLAG39, + * "FLAG40": FLAG40, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG38); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG38, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":44 + * "FLAG37": FLAG37, + * "FLAG38": FLAG38, + * "FLAG39": FLAG39, # <<<<<<<<<<<<<< + * "FLAG40": FLAG40, + * "FLAG41": FLAG41, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG39); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG39, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":45 + * "FLAG38": FLAG38, + * "FLAG39": FLAG39, + * "FLAG40": FLAG40, # <<<<<<<<<<<<<< + * "FLAG41": FLAG41, + * "FLAG42": FLAG42, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG40); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG40, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":46 + * "FLAG39": FLAG39, + * "FLAG40": FLAG40, + * "FLAG41": FLAG41, # <<<<<<<<<<<<<< + * "FLAG42": FLAG42, + * "FLAG43": FLAG43, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG41); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG41, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":47 + * "FLAG40": FLAG40, + * "FLAG41": FLAG41, + * "FLAG42": FLAG42, # <<<<<<<<<<<<<< + * "FLAG43": FLAG43, + * "FLAG44": FLAG44, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG42); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG42, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":48 + * "FLAG41": FLAG41, + * "FLAG42": FLAG42, + * "FLAG43": FLAG43, # <<<<<<<<<<<<<< + * "FLAG44": FLAG44, + * "FLAG45": FLAG45, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG43); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG43, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":49 + * "FLAG42": FLAG42, + * "FLAG43": FLAG43, + * "FLAG44": FLAG44, # <<<<<<<<<<<<<< + * "FLAG45": FLAG45, + * "FLAG46": FLAG46, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG44); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG44, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":50 + * "FLAG43": FLAG43, + * "FLAG44": FLAG44, + * "FLAG45": FLAG45, # <<<<<<<<<<<<<< + * "FLAG46": FLAG46, + * "FLAG47": FLAG47, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG45); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG45, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":51 + * "FLAG44": FLAG44, + * "FLAG45": FLAG45, + * "FLAG46": FLAG46, # <<<<<<<<<<<<<< + * "FLAG47": FLAG47, + * "FLAG48": FLAG48, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG46); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG46, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":52 + * "FLAG45": FLAG45, + * "FLAG46": FLAG46, + * "FLAG47": FLAG47, # <<<<<<<<<<<<<< + * "FLAG48": FLAG48, + * "FLAG49": FLAG49, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG47); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG47, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":53 + * "FLAG46": FLAG46, + * "FLAG47": FLAG47, + * "FLAG48": FLAG48, # <<<<<<<<<<<<<< + * "FLAG49": FLAG49, + * "FLAG50": FLAG50, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG48); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG48, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":54 + * "FLAG47": FLAG47, + * "FLAG48": FLAG48, + * "FLAG49": FLAG49, # <<<<<<<<<<<<<< + * "FLAG50": FLAG50, + * "FLAG51": FLAG51, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG49); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG49, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":55 + * "FLAG48": FLAG48, + * "FLAG49": FLAG49, + * "FLAG50": FLAG50, # <<<<<<<<<<<<<< + * "FLAG51": FLAG51, + * "FLAG52": FLAG52, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG50); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG50, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":56 + * "FLAG49": FLAG49, + * "FLAG50": FLAG50, + * "FLAG51": FLAG51, # <<<<<<<<<<<<<< + * "FLAG52": FLAG52, + * "FLAG53": FLAG53, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG51); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG51, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":57 + * "FLAG50": FLAG50, + * "FLAG51": FLAG51, + * "FLAG52": FLAG52, # <<<<<<<<<<<<<< + * "FLAG53": FLAG53, + * "FLAG54": FLAG54, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG52); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG52, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":58 + * "FLAG51": FLAG51, + * "FLAG52": FLAG52, + * "FLAG53": FLAG53, # <<<<<<<<<<<<<< + * "FLAG54": FLAG54, + * "FLAG55": FLAG55, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG53); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG53, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":59 + * "FLAG52": FLAG52, + * "FLAG53": FLAG53, + * "FLAG54": FLAG54, # <<<<<<<<<<<<<< + * "FLAG55": FLAG55, + * "FLAG56": FLAG56, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG54); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG54, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":60 + * "FLAG53": FLAG53, + * "FLAG54": FLAG54, + * "FLAG55": FLAG55, # <<<<<<<<<<<<<< + * "FLAG56": FLAG56, + * "FLAG57": FLAG57, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG55); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG55, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":61 + * "FLAG54": FLAG54, + * "FLAG55": FLAG55, + * "FLAG56": FLAG56, # <<<<<<<<<<<<<< + * "FLAG57": FLAG57, + * "FLAG58": FLAG58, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG56); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG56, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":62 + * "FLAG55": FLAG55, + * "FLAG56": FLAG56, + * "FLAG57": FLAG57, # <<<<<<<<<<<<<< + * "FLAG58": FLAG58, + * "FLAG59": FLAG59, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG57); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG57, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":63 + * "FLAG56": FLAG56, + * "FLAG57": FLAG57, + * "FLAG58": FLAG58, # <<<<<<<<<<<<<< + * "FLAG59": FLAG59, + * "FLAG60": FLAG60, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG58); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG58, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":64 + * "FLAG57": FLAG57, + * "FLAG58": FLAG58, + * "FLAG59": FLAG59, # <<<<<<<<<<<<<< + * "FLAG60": FLAG60, + * "FLAG61": FLAG61, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG59); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG59, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":65 + * "FLAG58": FLAG58, + * "FLAG59": FLAG59, + * "FLAG60": FLAG60, # <<<<<<<<<<<<<< + * "FLAG61": FLAG61, + * "FLAG62": FLAG62, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG60); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG60, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":66 + * "FLAG59": FLAG59, + * "FLAG60": FLAG60, + * "FLAG61": FLAG61, # <<<<<<<<<<<<<< + * "FLAG62": FLAG62, + * "FLAG63": FLAG63, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG61); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG61, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":67 + * "FLAG60": FLAG60, + * "FLAG61": FLAG61, + * "FLAG62": FLAG62, # <<<<<<<<<<<<<< + * "FLAG63": FLAG63, + * +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG62); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG62, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":68 + * "FLAG61": FLAG61, + * "FLAG62": FLAG62, + * "FLAG63": FLAG63, # <<<<<<<<<<<<<< + * + * "ID": ID, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FLAG63); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FLAG63, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":70 + * "FLAG63": FLAG63, + * + * "ID": ID, # <<<<<<<<<<<<<< + * "ORTH": ORTH, + * "LOWER": LOWER, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_ID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ID, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":71 + * + * "ID": ID, + * "ORTH": ORTH, # <<<<<<<<<<<<<< + * "LOWER": LOWER, + * "NORM": NORM, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_ORTH); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ORTH, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":72 + * "ID": ID, + * "ORTH": ORTH, + * "LOWER": LOWER, # <<<<<<<<<<<<<< + * "NORM": NORM, + * "SHAPE": SHAPE, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_LOWER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LOWER, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":73 + * "ORTH": ORTH, + * "LOWER": LOWER, + * "NORM": NORM, # <<<<<<<<<<<<<< + * "SHAPE": SHAPE, + * "PREFIX": PREFIX, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_NORM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_NORM, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":74 + * "LOWER": LOWER, + * "NORM": NORM, + * "SHAPE": SHAPE, # <<<<<<<<<<<<<< + * "PREFIX": PREFIX, + * "SUFFIX": SUFFIX, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_SHAPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SHAPE, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":75 + * "NORM": NORM, + * "SHAPE": SHAPE, + * "PREFIX": PREFIX, # <<<<<<<<<<<<<< + * "SUFFIX": SUFFIX, + * +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_PREFIX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PREFIX, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":76 + * "SHAPE": SHAPE, + * "PREFIX": PREFIX, + * "SUFFIX": SUFFIX, # <<<<<<<<<<<<<< + * + * "LENGTH": LENGTH, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_SUFFIX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SUFFIX, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":78 + * "SUFFIX": SUFFIX, + * + * "LENGTH": LENGTH, # <<<<<<<<<<<<<< + * "CLUSTER": CLUSTER, + * "LEMMA": LEMMA, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_LENGTH); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LENGTH, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":79 + * + * "LENGTH": LENGTH, + * "CLUSTER": CLUSTER, # <<<<<<<<<<<<<< + * "LEMMA": LEMMA, + * "POS": POS, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_CLUSTER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_CLUSTER, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":80 + * "LENGTH": LENGTH, + * "CLUSTER": CLUSTER, + * "LEMMA": LEMMA, # <<<<<<<<<<<<<< + * "POS": POS, + * "TAG": TAG, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_LEMMA); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LEMMA, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":81 + * "CLUSTER": CLUSTER, + * "LEMMA": LEMMA, + * "POS": POS, # <<<<<<<<<<<<<< + * "TAG": TAG, + * "DEP": DEP, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_POS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_POS, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":82 + * "LEMMA": LEMMA, + * "POS": POS, + * "TAG": TAG, # <<<<<<<<<<<<<< + * "DEP": DEP, + * "ENT_IOB": ENT_IOB, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_TAG); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TAG, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":83 + * "POS": POS, + * "TAG": TAG, + * "DEP": DEP, # <<<<<<<<<<<<<< + * "ENT_IOB": ENT_IOB, + * "ENT_TYPE": ENT_TYPE, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEP, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":84 + * "TAG": TAG, + * "DEP": DEP, + * "ENT_IOB": ENT_IOB, # <<<<<<<<<<<<<< + * "ENT_TYPE": ENT_TYPE, + * "ENT_ID": ENT_ID, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_ENT_IOB); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ENT_IOB, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":85 + * "DEP": DEP, + * "ENT_IOB": ENT_IOB, + * "ENT_TYPE": ENT_TYPE, # <<<<<<<<<<<<<< + * "ENT_ID": ENT_ID, + * "ENT_KB_ID": ENT_KB_ID, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_ENT_TYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ENT_TYPE, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":86 + * "ENT_IOB": ENT_IOB, + * "ENT_TYPE": ENT_TYPE, + * "ENT_ID": ENT_ID, # <<<<<<<<<<<<<< + * "ENT_KB_ID": ENT_KB_ID, + * "HEAD": HEAD, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_ENT_ID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ENT_ID, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":87 + * "ENT_TYPE": ENT_TYPE, + * "ENT_ID": ENT_ID, + * "ENT_KB_ID": ENT_KB_ID, # <<<<<<<<<<<<<< + * "HEAD": HEAD, + * "SENT_START": SENT_START, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_ENT_KB_ID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ENT_KB_ID, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":88 + * "ENT_ID": ENT_ID, + * "ENT_KB_ID": ENT_KB_ID, + * "HEAD": HEAD, # <<<<<<<<<<<<<< + * "SENT_START": SENT_START, + * "SPACY": SPACY, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_HEAD); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_HEAD, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":89 + * "ENT_KB_ID": ENT_KB_ID, + * "HEAD": HEAD, + * "SENT_START": SENT_START, # <<<<<<<<<<<<<< + * "SPACY": SPACY, + * "PROB": PROB, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_SENT_START); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SENT_START, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":90 + * "HEAD": HEAD, + * "SENT_START": SENT_START, + * "SPACY": SPACY, # <<<<<<<<<<<<<< + * "PROB": PROB, + * "LANG": LANG, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_SPACY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SPACY, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":91 + * "SENT_START": SENT_START, + * "SPACY": SPACY, + * "PROB": PROB, # <<<<<<<<<<<<<< + * "LANG": LANG, + * "IDX": IDX, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_PROB); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PROB, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":92 + * "SPACY": SPACY, + * "PROB": PROB, + * "LANG": LANG, # <<<<<<<<<<<<<< + * "IDX": IDX, + * +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_LANG); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LANG, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":93 + * "PROB": PROB, + * "LANG": LANG, + * "IDX": IDX, # <<<<<<<<<<<<<< + * + * "ADJ": ADJ, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_IDX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_IDX, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":95 + * "IDX": IDX, + * + * "ADJ": ADJ, # <<<<<<<<<<<<<< + * "ADP": ADP, + * "ADV": ADV, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_ADJ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ADJ, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":96 + * + * "ADJ": ADJ, + * "ADP": ADP, # <<<<<<<<<<<<<< + * "ADV": ADV, + * "AUX": AUX, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_ADP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ADP, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":97 + * "ADJ": ADJ, + * "ADP": ADP, + * "ADV": ADV, # <<<<<<<<<<<<<< + * "AUX": AUX, + * "CONJ": CONJ, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_ADV); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ADV, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":98 + * "ADP": ADP, + * "ADV": ADV, + * "AUX": AUX, # <<<<<<<<<<<<<< + * "CONJ": CONJ, + * "CCONJ": CCONJ, # U20 +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_AUX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_AUX, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":99 + * "ADV": ADV, + * "AUX": AUX, + * "CONJ": CONJ, # <<<<<<<<<<<<<< + * "CCONJ": CCONJ, # U20 + * "DET": DET, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_CONJ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_CONJ, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":100 + * "AUX": AUX, + * "CONJ": CONJ, + * "CCONJ": CCONJ, # U20 # <<<<<<<<<<<<<< + * "DET": DET, + * "INTJ": INTJ, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_CCONJ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_CCONJ, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":101 + * "CONJ": CONJ, + * "CCONJ": CCONJ, # U20 + * "DET": DET, # <<<<<<<<<<<<<< + * "INTJ": INTJ, + * "NOUN": NOUN, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DET); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DET, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":102 + * "CCONJ": CCONJ, # U20 + * "DET": DET, + * "INTJ": INTJ, # <<<<<<<<<<<<<< + * "NOUN": NOUN, + * "NUM": NUM, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_INTJ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_INTJ, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":103 + * "DET": DET, + * "INTJ": INTJ, + * "NOUN": NOUN, # <<<<<<<<<<<<<< + * "NUM": NUM, + * "PART": PART, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_NOUN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_NOUN, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":104 + * "INTJ": INTJ, + * "NOUN": NOUN, + * "NUM": NUM, # <<<<<<<<<<<<<< + * "PART": PART, + * "PRON": PRON, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_NUM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_NUM, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":105 + * "NOUN": NOUN, + * "NUM": NUM, + * "PART": PART, # <<<<<<<<<<<<<< + * "PRON": PRON, + * "PROPN": PROPN, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_PART); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PART, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":106 + * "NUM": NUM, + * "PART": PART, + * "PRON": PRON, # <<<<<<<<<<<<<< + * "PROPN": PROPN, + * "PUNCT": PUNCT, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_PRON); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PRON, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":107 + * "PART": PART, + * "PRON": PRON, + * "PROPN": PROPN, # <<<<<<<<<<<<<< + * "PUNCT": PUNCT, + * "SCONJ": SCONJ, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_PROPN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PROPN, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":108 + * "PRON": PRON, + * "PROPN": PROPN, + * "PUNCT": PUNCT, # <<<<<<<<<<<<<< + * "SCONJ": SCONJ, + * "SYM": SYM, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_PUNCT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PUNCT, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":109 + * "PROPN": PROPN, + * "PUNCT": PUNCT, + * "SCONJ": SCONJ, # <<<<<<<<<<<<<< + * "SYM": SYM, + * "VERB": VERB, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_SCONJ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SCONJ, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":110 + * "PUNCT": PUNCT, + * "SCONJ": SCONJ, + * "SYM": SYM, # <<<<<<<<<<<<<< + * "VERB": VERB, + * "X": X, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_SYM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SYM, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":111 + * "SCONJ": SCONJ, + * "SYM": SYM, + * "VERB": VERB, # <<<<<<<<<<<<<< + * "X": X, + * "EOL": EOL, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_VERB); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_VERB, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":112 + * "SYM": SYM, + * "VERB": VERB, + * "X": X, # <<<<<<<<<<<<<< + * "EOL": EOL, + * "SPACE": SPACE, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_X); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_X, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":113 + * "VERB": VERB, + * "X": X, + * "EOL": EOL, # <<<<<<<<<<<<<< + * "SPACE": SPACE, + * +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_EOL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_EOL, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":114 + * "X": X, + * "EOL": EOL, + * "SPACE": SPACE, # <<<<<<<<<<<<<< + * + * "DEPRECATED001": DEPRECATED001, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_SPACE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_SPACE, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":116 + * "SPACE": SPACE, + * + * "DEPRECATED001": DEPRECATED001, # <<<<<<<<<<<<<< + * "DEPRECATED002": DEPRECATED002, + * "DEPRECATED003": DEPRECATED003, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED001); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED001, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":117 + * + * "DEPRECATED001": DEPRECATED001, + * "DEPRECATED002": DEPRECATED002, # <<<<<<<<<<<<<< + * "DEPRECATED003": DEPRECATED003, + * "DEPRECATED004": DEPRECATED004, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED002); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED002, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":118 + * "DEPRECATED001": DEPRECATED001, + * "DEPRECATED002": DEPRECATED002, + * "DEPRECATED003": DEPRECATED003, # <<<<<<<<<<<<<< + * "DEPRECATED004": DEPRECATED004, + * "DEPRECATED005": DEPRECATED005, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED003); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED003, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":119 + * "DEPRECATED002": DEPRECATED002, + * "DEPRECATED003": DEPRECATED003, + * "DEPRECATED004": DEPRECATED004, # <<<<<<<<<<<<<< + * "DEPRECATED005": DEPRECATED005, + * "DEPRECATED006": DEPRECATED006, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED004); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED004, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":120 + * "DEPRECATED003": DEPRECATED003, + * "DEPRECATED004": DEPRECATED004, + * "DEPRECATED005": DEPRECATED005, # <<<<<<<<<<<<<< + * "DEPRECATED006": DEPRECATED006, + * "DEPRECATED007": DEPRECATED007, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED005); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED005, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":121 + * "DEPRECATED004": DEPRECATED004, + * "DEPRECATED005": DEPRECATED005, + * "DEPRECATED006": DEPRECATED006, # <<<<<<<<<<<<<< + * "DEPRECATED007": DEPRECATED007, + * "DEPRECATED008": DEPRECATED008, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED006); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED006, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":122 + * "DEPRECATED005": DEPRECATED005, + * "DEPRECATED006": DEPRECATED006, + * "DEPRECATED007": DEPRECATED007, # <<<<<<<<<<<<<< + * "DEPRECATED008": DEPRECATED008, + * "DEPRECATED009": DEPRECATED009, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED007); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED007, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":123 + * "DEPRECATED006": DEPRECATED006, + * "DEPRECATED007": DEPRECATED007, + * "DEPRECATED008": DEPRECATED008, # <<<<<<<<<<<<<< + * "DEPRECATED009": DEPRECATED009, + * "DEPRECATED010": DEPRECATED010, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED008); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED008, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":124 + * "DEPRECATED007": DEPRECATED007, + * "DEPRECATED008": DEPRECATED008, + * "DEPRECATED009": DEPRECATED009, # <<<<<<<<<<<<<< + * "DEPRECATED010": DEPRECATED010, + * "DEPRECATED011": DEPRECATED011, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED009); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED009, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":125 + * "DEPRECATED008": DEPRECATED008, + * "DEPRECATED009": DEPRECATED009, + * "DEPRECATED010": DEPRECATED010, # <<<<<<<<<<<<<< + * "DEPRECATED011": DEPRECATED011, + * "DEPRECATED012": DEPRECATED012, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED010); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED010, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":126 + * "DEPRECATED009": DEPRECATED009, + * "DEPRECATED010": DEPRECATED010, + * "DEPRECATED011": DEPRECATED011, # <<<<<<<<<<<<<< + * "DEPRECATED012": DEPRECATED012, + * "DEPRECATED013": DEPRECATED013, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED011); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED011, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":127 + * "DEPRECATED010": DEPRECATED010, + * "DEPRECATED011": DEPRECATED011, + * "DEPRECATED012": DEPRECATED012, # <<<<<<<<<<<<<< + * "DEPRECATED013": DEPRECATED013, + * "DEPRECATED014": DEPRECATED014, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED012); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED012, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":128 + * "DEPRECATED011": DEPRECATED011, + * "DEPRECATED012": DEPRECATED012, + * "DEPRECATED013": DEPRECATED013, # <<<<<<<<<<<<<< + * "DEPRECATED014": DEPRECATED014, + * "DEPRECATED015": DEPRECATED015, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED013); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED013, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":129 + * "DEPRECATED012": DEPRECATED012, + * "DEPRECATED013": DEPRECATED013, + * "DEPRECATED014": DEPRECATED014, # <<<<<<<<<<<<<< + * "DEPRECATED015": DEPRECATED015, + * "DEPRECATED016": DEPRECATED016, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED014); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED014, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":130 + * "DEPRECATED013": DEPRECATED013, + * "DEPRECATED014": DEPRECATED014, + * "DEPRECATED015": DEPRECATED015, # <<<<<<<<<<<<<< + * "DEPRECATED016": DEPRECATED016, + * "DEPRECATED017": DEPRECATED017, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED015); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED015, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":131 + * "DEPRECATED014": DEPRECATED014, + * "DEPRECATED015": DEPRECATED015, + * "DEPRECATED016": DEPRECATED016, # <<<<<<<<<<<<<< + * "DEPRECATED017": DEPRECATED017, + * "DEPRECATED018": DEPRECATED018, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED016); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED016, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":132 + * "DEPRECATED015": DEPRECATED015, + * "DEPRECATED016": DEPRECATED016, + * "DEPRECATED017": DEPRECATED017, # <<<<<<<<<<<<<< + * "DEPRECATED018": DEPRECATED018, + * "DEPRECATED019": DEPRECATED019, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED017); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED017, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":133 + * "DEPRECATED016": DEPRECATED016, + * "DEPRECATED017": DEPRECATED017, + * "DEPRECATED018": DEPRECATED018, # <<<<<<<<<<<<<< + * "DEPRECATED019": DEPRECATED019, + * "DEPRECATED020": DEPRECATED020, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED018); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED018, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":134 + * "DEPRECATED017": DEPRECATED017, + * "DEPRECATED018": DEPRECATED018, + * "DEPRECATED019": DEPRECATED019, # <<<<<<<<<<<<<< + * "DEPRECATED020": DEPRECATED020, + * "DEPRECATED021": DEPRECATED021, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED019); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED019, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":135 + * "DEPRECATED018": DEPRECATED018, + * "DEPRECATED019": DEPRECATED019, + * "DEPRECATED020": DEPRECATED020, # <<<<<<<<<<<<<< + * "DEPRECATED021": DEPRECATED021, + * "DEPRECATED022": DEPRECATED022, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED020); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED020, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":136 + * "DEPRECATED019": DEPRECATED019, + * "DEPRECATED020": DEPRECATED020, + * "DEPRECATED021": DEPRECATED021, # <<<<<<<<<<<<<< + * "DEPRECATED022": DEPRECATED022, + * "DEPRECATED023": DEPRECATED023, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED021); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED021, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":137 + * "DEPRECATED020": DEPRECATED020, + * "DEPRECATED021": DEPRECATED021, + * "DEPRECATED022": DEPRECATED022, # <<<<<<<<<<<<<< + * "DEPRECATED023": DEPRECATED023, + * "DEPRECATED024": DEPRECATED024, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED022); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED022, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":138 + * "DEPRECATED021": DEPRECATED021, + * "DEPRECATED022": DEPRECATED022, + * "DEPRECATED023": DEPRECATED023, # <<<<<<<<<<<<<< + * "DEPRECATED024": DEPRECATED024, + * "DEPRECATED025": DEPRECATED025, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED023); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED023, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":139 + * "DEPRECATED022": DEPRECATED022, + * "DEPRECATED023": DEPRECATED023, + * "DEPRECATED024": DEPRECATED024, # <<<<<<<<<<<<<< + * "DEPRECATED025": DEPRECATED025, + * "DEPRECATED026": DEPRECATED026, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED024); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED024, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":140 + * "DEPRECATED023": DEPRECATED023, + * "DEPRECATED024": DEPRECATED024, + * "DEPRECATED025": DEPRECATED025, # <<<<<<<<<<<<<< + * "DEPRECATED026": DEPRECATED026, + * "DEPRECATED027": DEPRECATED027, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED025); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED025, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":141 + * "DEPRECATED024": DEPRECATED024, + * "DEPRECATED025": DEPRECATED025, + * "DEPRECATED026": DEPRECATED026, # <<<<<<<<<<<<<< + * "DEPRECATED027": DEPRECATED027, + * "DEPRECATED028": DEPRECATED028, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED026); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED026, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":142 + * "DEPRECATED025": DEPRECATED025, + * "DEPRECATED026": DEPRECATED026, + * "DEPRECATED027": DEPRECATED027, # <<<<<<<<<<<<<< + * "DEPRECATED028": DEPRECATED028, + * "DEPRECATED029": DEPRECATED029, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED027); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED027, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":143 + * "DEPRECATED026": DEPRECATED026, + * "DEPRECATED027": DEPRECATED027, + * "DEPRECATED028": DEPRECATED028, # <<<<<<<<<<<<<< + * "DEPRECATED029": DEPRECATED029, + * "DEPRECATED030": DEPRECATED030, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED028); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED028, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":144 + * "DEPRECATED027": DEPRECATED027, + * "DEPRECATED028": DEPRECATED028, + * "DEPRECATED029": DEPRECATED029, # <<<<<<<<<<<<<< + * "DEPRECATED030": DEPRECATED030, + * "DEPRECATED031": DEPRECATED031, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED029); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED029, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":145 + * "DEPRECATED028": DEPRECATED028, + * "DEPRECATED029": DEPRECATED029, + * "DEPRECATED030": DEPRECATED030, # <<<<<<<<<<<<<< + * "DEPRECATED031": DEPRECATED031, + * "DEPRECATED032": DEPRECATED032, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED030); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED030, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":146 + * "DEPRECATED029": DEPRECATED029, + * "DEPRECATED030": DEPRECATED030, + * "DEPRECATED031": DEPRECATED031, # <<<<<<<<<<<<<< + * "DEPRECATED032": DEPRECATED032, + * "DEPRECATED033": DEPRECATED033, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED031); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED031, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":147 + * "DEPRECATED030": DEPRECATED030, + * "DEPRECATED031": DEPRECATED031, + * "DEPRECATED032": DEPRECATED032, # <<<<<<<<<<<<<< + * "DEPRECATED033": DEPRECATED033, + * "DEPRECATED034": DEPRECATED034, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED032); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED032, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":148 + * "DEPRECATED031": DEPRECATED031, + * "DEPRECATED032": DEPRECATED032, + * "DEPRECATED033": DEPRECATED033, # <<<<<<<<<<<<<< + * "DEPRECATED034": DEPRECATED034, + * "DEPRECATED035": DEPRECATED035, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED033); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED033, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":149 + * "DEPRECATED032": DEPRECATED032, + * "DEPRECATED033": DEPRECATED033, + * "DEPRECATED034": DEPRECATED034, # <<<<<<<<<<<<<< + * "DEPRECATED035": DEPRECATED035, + * "DEPRECATED036": DEPRECATED036, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED034); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED034, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":150 + * "DEPRECATED033": DEPRECATED033, + * "DEPRECATED034": DEPRECATED034, + * "DEPRECATED035": DEPRECATED035, # <<<<<<<<<<<<<< + * "DEPRECATED036": DEPRECATED036, + * "DEPRECATED037": DEPRECATED037, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED035); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED035, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":151 + * "DEPRECATED034": DEPRECATED034, + * "DEPRECATED035": DEPRECATED035, + * "DEPRECATED036": DEPRECATED036, # <<<<<<<<<<<<<< + * "DEPRECATED037": DEPRECATED037, + * "DEPRECATED038": DEPRECATED038, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED036); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED036, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":152 + * "DEPRECATED035": DEPRECATED035, + * "DEPRECATED036": DEPRECATED036, + * "DEPRECATED037": DEPRECATED037, # <<<<<<<<<<<<<< + * "DEPRECATED038": DEPRECATED038, + * "DEPRECATED039": DEPRECATED039, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED037); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED037, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":153 + * "DEPRECATED036": DEPRECATED036, + * "DEPRECATED037": DEPRECATED037, + * "DEPRECATED038": DEPRECATED038, # <<<<<<<<<<<<<< + * "DEPRECATED039": DEPRECATED039, + * "DEPRECATED040": DEPRECATED040, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED038); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED038, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":154 + * "DEPRECATED037": DEPRECATED037, + * "DEPRECATED038": DEPRECATED038, + * "DEPRECATED039": DEPRECATED039, # <<<<<<<<<<<<<< + * "DEPRECATED040": DEPRECATED040, + * "DEPRECATED041": DEPRECATED041, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED039); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED039, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":155 + * "DEPRECATED038": DEPRECATED038, + * "DEPRECATED039": DEPRECATED039, + * "DEPRECATED040": DEPRECATED040, # <<<<<<<<<<<<<< + * "DEPRECATED041": DEPRECATED041, + * "DEPRECATED042": DEPRECATED042, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED040); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED040, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":156 + * "DEPRECATED039": DEPRECATED039, + * "DEPRECATED040": DEPRECATED040, + * "DEPRECATED041": DEPRECATED041, # <<<<<<<<<<<<<< + * "DEPRECATED042": DEPRECATED042, + * "DEPRECATED043": DEPRECATED043, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED041); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED041, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":157 + * "DEPRECATED040": DEPRECATED040, + * "DEPRECATED041": DEPRECATED041, + * "DEPRECATED042": DEPRECATED042, # <<<<<<<<<<<<<< + * "DEPRECATED043": DEPRECATED043, + * "DEPRECATED044": DEPRECATED044, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED042); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED042, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":158 + * "DEPRECATED041": DEPRECATED041, + * "DEPRECATED042": DEPRECATED042, + * "DEPRECATED043": DEPRECATED043, # <<<<<<<<<<<<<< + * "DEPRECATED044": DEPRECATED044, + * "DEPRECATED045": DEPRECATED045, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED043); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED043, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":159 + * "DEPRECATED042": DEPRECATED042, + * "DEPRECATED043": DEPRECATED043, + * "DEPRECATED044": DEPRECATED044, # <<<<<<<<<<<<<< + * "DEPRECATED045": DEPRECATED045, + * "DEPRECATED046": DEPRECATED046, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED044); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED044, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":160 + * "DEPRECATED043": DEPRECATED043, + * "DEPRECATED044": DEPRECATED044, + * "DEPRECATED045": DEPRECATED045, # <<<<<<<<<<<<<< + * "DEPRECATED046": DEPRECATED046, + * "DEPRECATED047": DEPRECATED047, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED045); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED045, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":161 + * "DEPRECATED044": DEPRECATED044, + * "DEPRECATED045": DEPRECATED045, + * "DEPRECATED046": DEPRECATED046, # <<<<<<<<<<<<<< + * "DEPRECATED047": DEPRECATED047, + * "DEPRECATED048": DEPRECATED048, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED046); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED046, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":162 + * "DEPRECATED045": DEPRECATED045, + * "DEPRECATED046": DEPRECATED046, + * "DEPRECATED047": DEPRECATED047, # <<<<<<<<<<<<<< + * "DEPRECATED048": DEPRECATED048, + * "DEPRECATED049": DEPRECATED049, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED047); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED047, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":163 + * "DEPRECATED046": DEPRECATED046, + * "DEPRECATED047": DEPRECATED047, + * "DEPRECATED048": DEPRECATED048, # <<<<<<<<<<<<<< + * "DEPRECATED049": DEPRECATED049, + * "DEPRECATED050": DEPRECATED050, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED048); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED048, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":164 + * "DEPRECATED047": DEPRECATED047, + * "DEPRECATED048": DEPRECATED048, + * "DEPRECATED049": DEPRECATED049, # <<<<<<<<<<<<<< + * "DEPRECATED050": DEPRECATED050, + * "DEPRECATED051": DEPRECATED051, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED049); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED049, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":165 + * "DEPRECATED048": DEPRECATED048, + * "DEPRECATED049": DEPRECATED049, + * "DEPRECATED050": DEPRECATED050, # <<<<<<<<<<<<<< + * "DEPRECATED051": DEPRECATED051, + * "DEPRECATED052": DEPRECATED052, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED050); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED050, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":166 + * "DEPRECATED049": DEPRECATED049, + * "DEPRECATED050": DEPRECATED050, + * "DEPRECATED051": DEPRECATED051, # <<<<<<<<<<<<<< + * "DEPRECATED052": DEPRECATED052, + * "DEPRECATED053": DEPRECATED053, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED051); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED051, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":167 + * "DEPRECATED050": DEPRECATED050, + * "DEPRECATED051": DEPRECATED051, + * "DEPRECATED052": DEPRECATED052, # <<<<<<<<<<<<<< + * "DEPRECATED053": DEPRECATED053, + * "DEPRECATED054": DEPRECATED054, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED052); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED052, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":168 + * "DEPRECATED051": DEPRECATED051, + * "DEPRECATED052": DEPRECATED052, + * "DEPRECATED053": DEPRECATED053, # <<<<<<<<<<<<<< + * "DEPRECATED054": DEPRECATED054, + * "DEPRECATED055": DEPRECATED055, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED053); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED053, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":169 + * "DEPRECATED052": DEPRECATED052, + * "DEPRECATED053": DEPRECATED053, + * "DEPRECATED054": DEPRECATED054, # <<<<<<<<<<<<<< + * "DEPRECATED055": DEPRECATED055, + * "DEPRECATED056": DEPRECATED056, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED054); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED054, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":170 + * "DEPRECATED053": DEPRECATED053, + * "DEPRECATED054": DEPRECATED054, + * "DEPRECATED055": DEPRECATED055, # <<<<<<<<<<<<<< + * "DEPRECATED056": DEPRECATED056, + * "DEPRECATED057": DEPRECATED057, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED055); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED055, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":171 + * "DEPRECATED054": DEPRECATED054, + * "DEPRECATED055": DEPRECATED055, + * "DEPRECATED056": DEPRECATED056, # <<<<<<<<<<<<<< + * "DEPRECATED057": DEPRECATED057, + * "DEPRECATED058": DEPRECATED058, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED056); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED056, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":172 + * "DEPRECATED055": DEPRECATED055, + * "DEPRECATED056": DEPRECATED056, + * "DEPRECATED057": DEPRECATED057, # <<<<<<<<<<<<<< + * "DEPRECATED058": DEPRECATED058, + * "DEPRECATED059": DEPRECATED059, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED057); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED057, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":173 + * "DEPRECATED056": DEPRECATED056, + * "DEPRECATED057": DEPRECATED057, + * "DEPRECATED058": DEPRECATED058, # <<<<<<<<<<<<<< + * "DEPRECATED059": DEPRECATED059, + * "DEPRECATED060": DEPRECATED060, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED058); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED058, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":174 + * "DEPRECATED057": DEPRECATED057, + * "DEPRECATED058": DEPRECATED058, + * "DEPRECATED059": DEPRECATED059, # <<<<<<<<<<<<<< + * "DEPRECATED060": DEPRECATED060, + * "DEPRECATED061": DEPRECATED061, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED059); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED059, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":175 + * "DEPRECATED058": DEPRECATED058, + * "DEPRECATED059": DEPRECATED059, + * "DEPRECATED060": DEPRECATED060, # <<<<<<<<<<<<<< + * "DEPRECATED061": DEPRECATED061, + * "DEPRECATED062": DEPRECATED062, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED060); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED060, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":176 + * "DEPRECATED059": DEPRECATED059, + * "DEPRECATED060": DEPRECATED060, + * "DEPRECATED061": DEPRECATED061, # <<<<<<<<<<<<<< + * "DEPRECATED062": DEPRECATED062, + * "DEPRECATED063": DEPRECATED063, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED061); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED061, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":177 + * "DEPRECATED060": DEPRECATED060, + * "DEPRECATED061": DEPRECATED061, + * "DEPRECATED062": DEPRECATED062, # <<<<<<<<<<<<<< + * "DEPRECATED063": DEPRECATED063, + * "DEPRECATED064": DEPRECATED064, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED062); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED062, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":178 + * "DEPRECATED061": DEPRECATED061, + * "DEPRECATED062": DEPRECATED062, + * "DEPRECATED063": DEPRECATED063, # <<<<<<<<<<<<<< + * "DEPRECATED064": DEPRECATED064, + * "DEPRECATED065": DEPRECATED065, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED063); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED063, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":179 + * "DEPRECATED062": DEPRECATED062, + * "DEPRECATED063": DEPRECATED063, + * "DEPRECATED064": DEPRECATED064, # <<<<<<<<<<<<<< + * "DEPRECATED065": DEPRECATED065, + * "DEPRECATED066": DEPRECATED066, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED064); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED064, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":180 + * "DEPRECATED063": DEPRECATED063, + * "DEPRECATED064": DEPRECATED064, + * "DEPRECATED065": DEPRECATED065, # <<<<<<<<<<<<<< + * "DEPRECATED066": DEPRECATED066, + * "DEPRECATED067": DEPRECATED067, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED065); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED065, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":181 + * "DEPRECATED064": DEPRECATED064, + * "DEPRECATED065": DEPRECATED065, + * "DEPRECATED066": DEPRECATED066, # <<<<<<<<<<<<<< + * "DEPRECATED067": DEPRECATED067, + * "DEPRECATED068": DEPRECATED068, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED066); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED066, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":182 + * "DEPRECATED065": DEPRECATED065, + * "DEPRECATED066": DEPRECATED066, + * "DEPRECATED067": DEPRECATED067, # <<<<<<<<<<<<<< + * "DEPRECATED068": DEPRECATED068, + * "DEPRECATED069": DEPRECATED069, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED067); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED067, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":183 + * "DEPRECATED066": DEPRECATED066, + * "DEPRECATED067": DEPRECATED067, + * "DEPRECATED068": DEPRECATED068, # <<<<<<<<<<<<<< + * "DEPRECATED069": DEPRECATED069, + * "DEPRECATED070": DEPRECATED070, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED068); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED068, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":184 + * "DEPRECATED067": DEPRECATED067, + * "DEPRECATED068": DEPRECATED068, + * "DEPRECATED069": DEPRECATED069, # <<<<<<<<<<<<<< + * "DEPRECATED070": DEPRECATED070, + * "DEPRECATED071": DEPRECATED071, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED069); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED069, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":185 + * "DEPRECATED068": DEPRECATED068, + * "DEPRECATED069": DEPRECATED069, + * "DEPRECATED070": DEPRECATED070, # <<<<<<<<<<<<<< + * "DEPRECATED071": DEPRECATED071, + * "DEPRECATED072": DEPRECATED072, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED070); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED070, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":186 + * "DEPRECATED069": DEPRECATED069, + * "DEPRECATED070": DEPRECATED070, + * "DEPRECATED071": DEPRECATED071, # <<<<<<<<<<<<<< + * "DEPRECATED072": DEPRECATED072, + * "DEPRECATED073": DEPRECATED073, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED071); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED071, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":187 + * "DEPRECATED070": DEPRECATED070, + * "DEPRECATED071": DEPRECATED071, + * "DEPRECATED072": DEPRECATED072, # <<<<<<<<<<<<<< + * "DEPRECATED073": DEPRECATED073, + * "DEPRECATED074": DEPRECATED074, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED072); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED072, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":188 + * "DEPRECATED071": DEPRECATED071, + * "DEPRECATED072": DEPRECATED072, + * "DEPRECATED073": DEPRECATED073, # <<<<<<<<<<<<<< + * "DEPRECATED074": DEPRECATED074, + * "DEPRECATED075": DEPRECATED075, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED073); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 188, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED073, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":189 + * "DEPRECATED072": DEPRECATED072, + * "DEPRECATED073": DEPRECATED073, + * "DEPRECATED074": DEPRECATED074, # <<<<<<<<<<<<<< + * "DEPRECATED075": DEPRECATED075, + * "DEPRECATED076": DEPRECATED076, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED074); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED074, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":190 + * "DEPRECATED073": DEPRECATED073, + * "DEPRECATED074": DEPRECATED074, + * "DEPRECATED075": DEPRECATED075, # <<<<<<<<<<<<<< + * "DEPRECATED076": DEPRECATED076, + * "DEPRECATED077": DEPRECATED077, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED075); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED075, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":191 + * "DEPRECATED074": DEPRECATED074, + * "DEPRECATED075": DEPRECATED075, + * "DEPRECATED076": DEPRECATED076, # <<<<<<<<<<<<<< + * "DEPRECATED077": DEPRECATED077, + * "DEPRECATED078": DEPRECATED078, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED076); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED076, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":192 + * "DEPRECATED075": DEPRECATED075, + * "DEPRECATED076": DEPRECATED076, + * "DEPRECATED077": DEPRECATED077, # <<<<<<<<<<<<<< + * "DEPRECATED078": DEPRECATED078, + * "DEPRECATED079": DEPRECATED079, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED077); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED077, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":193 + * "DEPRECATED076": DEPRECATED076, + * "DEPRECATED077": DEPRECATED077, + * "DEPRECATED078": DEPRECATED078, # <<<<<<<<<<<<<< + * "DEPRECATED079": DEPRECATED079, + * "DEPRECATED080": DEPRECATED080, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED078); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED078, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":194 + * "DEPRECATED077": DEPRECATED077, + * "DEPRECATED078": DEPRECATED078, + * "DEPRECATED079": DEPRECATED079, # <<<<<<<<<<<<<< + * "DEPRECATED080": DEPRECATED080, + * "DEPRECATED081": DEPRECATED081, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED079); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED079, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":195 + * "DEPRECATED078": DEPRECATED078, + * "DEPRECATED079": DEPRECATED079, + * "DEPRECATED080": DEPRECATED080, # <<<<<<<<<<<<<< + * "DEPRECATED081": DEPRECATED081, + * "DEPRECATED082": DEPRECATED082, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED080); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED080, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":196 + * "DEPRECATED079": DEPRECATED079, + * "DEPRECATED080": DEPRECATED080, + * "DEPRECATED081": DEPRECATED081, # <<<<<<<<<<<<<< + * "DEPRECATED082": DEPRECATED082, + * "DEPRECATED083": DEPRECATED083, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED081); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED081, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":197 + * "DEPRECATED080": DEPRECATED080, + * "DEPRECATED081": DEPRECATED081, + * "DEPRECATED082": DEPRECATED082, # <<<<<<<<<<<<<< + * "DEPRECATED083": DEPRECATED083, + * "DEPRECATED084": DEPRECATED084, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED082); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED082, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":198 + * "DEPRECATED081": DEPRECATED081, + * "DEPRECATED082": DEPRECATED082, + * "DEPRECATED083": DEPRECATED083, # <<<<<<<<<<<<<< + * "DEPRECATED084": DEPRECATED084, + * "DEPRECATED085": DEPRECATED085, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED083); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 198, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED083, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":199 + * "DEPRECATED082": DEPRECATED082, + * "DEPRECATED083": DEPRECATED083, + * "DEPRECATED084": DEPRECATED084, # <<<<<<<<<<<<<< + * "DEPRECATED085": DEPRECATED085, + * "DEPRECATED086": DEPRECATED086, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED084); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED084, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":200 + * "DEPRECATED083": DEPRECATED083, + * "DEPRECATED084": DEPRECATED084, + * "DEPRECATED085": DEPRECATED085, # <<<<<<<<<<<<<< + * "DEPRECATED086": DEPRECATED086, + * "DEPRECATED087": DEPRECATED087, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED085); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED085, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":201 + * "DEPRECATED084": DEPRECATED084, + * "DEPRECATED085": DEPRECATED085, + * "DEPRECATED086": DEPRECATED086, # <<<<<<<<<<<<<< + * "DEPRECATED087": DEPRECATED087, + * "DEPRECATED088": DEPRECATED088, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED086); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED086, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":202 + * "DEPRECATED085": DEPRECATED085, + * "DEPRECATED086": DEPRECATED086, + * "DEPRECATED087": DEPRECATED087, # <<<<<<<<<<<<<< + * "DEPRECATED088": DEPRECATED088, + * "DEPRECATED089": DEPRECATED089, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED087); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED087, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":203 + * "DEPRECATED086": DEPRECATED086, + * "DEPRECATED087": DEPRECATED087, + * "DEPRECATED088": DEPRECATED088, # <<<<<<<<<<<<<< + * "DEPRECATED089": DEPRECATED089, + * "DEPRECATED090": DEPRECATED090, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED088); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED088, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":204 + * "DEPRECATED087": DEPRECATED087, + * "DEPRECATED088": DEPRECATED088, + * "DEPRECATED089": DEPRECATED089, # <<<<<<<<<<<<<< + * "DEPRECATED090": DEPRECATED090, + * "DEPRECATED091": DEPRECATED091, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED089); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED089, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":205 + * "DEPRECATED088": DEPRECATED088, + * "DEPRECATED089": DEPRECATED089, + * "DEPRECATED090": DEPRECATED090, # <<<<<<<<<<<<<< + * "DEPRECATED091": DEPRECATED091, + * "DEPRECATED092": DEPRECATED092, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED090); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED090, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":206 + * "DEPRECATED089": DEPRECATED089, + * "DEPRECATED090": DEPRECATED090, + * "DEPRECATED091": DEPRECATED091, # <<<<<<<<<<<<<< + * "DEPRECATED092": DEPRECATED092, + * "DEPRECATED093": DEPRECATED093, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED091); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED091, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":207 + * "DEPRECATED090": DEPRECATED090, + * "DEPRECATED091": DEPRECATED091, + * "DEPRECATED092": DEPRECATED092, # <<<<<<<<<<<<<< + * "DEPRECATED093": DEPRECATED093, + * "DEPRECATED094": DEPRECATED094, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED092); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED092, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":208 + * "DEPRECATED091": DEPRECATED091, + * "DEPRECATED092": DEPRECATED092, + * "DEPRECATED093": DEPRECATED093, # <<<<<<<<<<<<<< + * "DEPRECATED094": DEPRECATED094, + * "DEPRECATED095": DEPRECATED095, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED093); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED093, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":209 + * "DEPRECATED092": DEPRECATED092, + * "DEPRECATED093": DEPRECATED093, + * "DEPRECATED094": DEPRECATED094, # <<<<<<<<<<<<<< + * "DEPRECATED095": DEPRECATED095, + * "DEPRECATED096": DEPRECATED096, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED094); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED094, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":210 + * "DEPRECATED093": DEPRECATED093, + * "DEPRECATED094": DEPRECATED094, + * "DEPRECATED095": DEPRECATED095, # <<<<<<<<<<<<<< + * "DEPRECATED096": DEPRECATED096, + * "DEPRECATED097": DEPRECATED097, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED095); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED095, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":211 + * "DEPRECATED094": DEPRECATED094, + * "DEPRECATED095": DEPRECATED095, + * "DEPRECATED096": DEPRECATED096, # <<<<<<<<<<<<<< + * "DEPRECATED097": DEPRECATED097, + * "DEPRECATED098": DEPRECATED098, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED096); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED096, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":212 + * "DEPRECATED095": DEPRECATED095, + * "DEPRECATED096": DEPRECATED096, + * "DEPRECATED097": DEPRECATED097, # <<<<<<<<<<<<<< + * "DEPRECATED098": DEPRECATED098, + * "DEPRECATED099": DEPRECATED099, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED097); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED097, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":213 + * "DEPRECATED096": DEPRECATED096, + * "DEPRECATED097": DEPRECATED097, + * "DEPRECATED098": DEPRECATED098, # <<<<<<<<<<<<<< + * "DEPRECATED099": DEPRECATED099, + * "DEPRECATED100": DEPRECATED100, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED098); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED098, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":214 + * "DEPRECATED097": DEPRECATED097, + * "DEPRECATED098": DEPRECATED098, + * "DEPRECATED099": DEPRECATED099, # <<<<<<<<<<<<<< + * "DEPRECATED100": DEPRECATED100, + * "DEPRECATED101": DEPRECATED101, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED099); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED099, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":215 + * "DEPRECATED098": DEPRECATED098, + * "DEPRECATED099": DEPRECATED099, + * "DEPRECATED100": DEPRECATED100, # <<<<<<<<<<<<<< + * "DEPRECATED101": DEPRECATED101, + * "DEPRECATED102": DEPRECATED102, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED100); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED100, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":216 + * "DEPRECATED099": DEPRECATED099, + * "DEPRECATED100": DEPRECATED100, + * "DEPRECATED101": DEPRECATED101, # <<<<<<<<<<<<<< + * "DEPRECATED102": DEPRECATED102, + * "DEPRECATED103": DEPRECATED103, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED101); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED101, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":217 + * "DEPRECATED100": DEPRECATED100, + * "DEPRECATED101": DEPRECATED101, + * "DEPRECATED102": DEPRECATED102, # <<<<<<<<<<<<<< + * "DEPRECATED103": DEPRECATED103, + * "DEPRECATED104": DEPRECATED104, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED102); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED102, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":218 + * "DEPRECATED101": DEPRECATED101, + * "DEPRECATED102": DEPRECATED102, + * "DEPRECATED103": DEPRECATED103, # <<<<<<<<<<<<<< + * "DEPRECATED104": DEPRECATED104, + * "DEPRECATED105": DEPRECATED105, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED103); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED103, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":219 + * "DEPRECATED102": DEPRECATED102, + * "DEPRECATED103": DEPRECATED103, + * "DEPRECATED104": DEPRECATED104, # <<<<<<<<<<<<<< + * "DEPRECATED105": DEPRECATED105, + * "DEPRECATED106": DEPRECATED106, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED104); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED104, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":220 + * "DEPRECATED103": DEPRECATED103, + * "DEPRECATED104": DEPRECATED104, + * "DEPRECATED105": DEPRECATED105, # <<<<<<<<<<<<<< + * "DEPRECATED106": DEPRECATED106, + * "DEPRECATED107": DEPRECATED107, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED105); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED105, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":221 + * "DEPRECATED104": DEPRECATED104, + * "DEPRECATED105": DEPRECATED105, + * "DEPRECATED106": DEPRECATED106, # <<<<<<<<<<<<<< + * "DEPRECATED107": DEPRECATED107, + * "DEPRECATED108": DEPRECATED108, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED106); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED106, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":222 + * "DEPRECATED105": DEPRECATED105, + * "DEPRECATED106": DEPRECATED106, + * "DEPRECATED107": DEPRECATED107, # <<<<<<<<<<<<<< + * "DEPRECATED108": DEPRECATED108, + * "DEPRECATED109": DEPRECATED109, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED107); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED107, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":223 + * "DEPRECATED106": DEPRECATED106, + * "DEPRECATED107": DEPRECATED107, + * "DEPRECATED108": DEPRECATED108, # <<<<<<<<<<<<<< + * "DEPRECATED109": DEPRECATED109, + * "DEPRECATED110": DEPRECATED110, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED108); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED108, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":224 + * "DEPRECATED107": DEPRECATED107, + * "DEPRECATED108": DEPRECATED108, + * "DEPRECATED109": DEPRECATED109, # <<<<<<<<<<<<<< + * "DEPRECATED110": DEPRECATED110, + * "DEPRECATED111": DEPRECATED111, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED109); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED109, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":225 + * "DEPRECATED108": DEPRECATED108, + * "DEPRECATED109": DEPRECATED109, + * "DEPRECATED110": DEPRECATED110, # <<<<<<<<<<<<<< + * "DEPRECATED111": DEPRECATED111, + * "DEPRECATED112": DEPRECATED112, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED110); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED110, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":226 + * "DEPRECATED109": DEPRECATED109, + * "DEPRECATED110": DEPRECATED110, + * "DEPRECATED111": DEPRECATED111, # <<<<<<<<<<<<<< + * "DEPRECATED112": DEPRECATED112, + * "DEPRECATED113": DEPRECATED113, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED111); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED111, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":227 + * "DEPRECATED110": DEPRECATED110, + * "DEPRECATED111": DEPRECATED111, + * "DEPRECATED112": DEPRECATED112, # <<<<<<<<<<<<<< + * "DEPRECATED113": DEPRECATED113, + * "DEPRECATED114": DEPRECATED114, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED112); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED112, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":228 + * "DEPRECATED111": DEPRECATED111, + * "DEPRECATED112": DEPRECATED112, + * "DEPRECATED113": DEPRECATED113, # <<<<<<<<<<<<<< + * "DEPRECATED114": DEPRECATED114, + * "DEPRECATED115": DEPRECATED115, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED113); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED113, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":229 + * "DEPRECATED112": DEPRECATED112, + * "DEPRECATED113": DEPRECATED113, + * "DEPRECATED114": DEPRECATED114, # <<<<<<<<<<<<<< + * "DEPRECATED115": DEPRECATED115, + * "DEPRECATED116": DEPRECATED116, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED114); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED114, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":230 + * "DEPRECATED113": DEPRECATED113, + * "DEPRECATED114": DEPRECATED114, + * "DEPRECATED115": DEPRECATED115, # <<<<<<<<<<<<<< + * "DEPRECATED116": DEPRECATED116, + * "DEPRECATED117": DEPRECATED117, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED115); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED115, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":231 + * "DEPRECATED114": DEPRECATED114, + * "DEPRECATED115": DEPRECATED115, + * "DEPRECATED116": DEPRECATED116, # <<<<<<<<<<<<<< + * "DEPRECATED117": DEPRECATED117, + * "DEPRECATED118": DEPRECATED118, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED116); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED116, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":232 + * "DEPRECATED115": DEPRECATED115, + * "DEPRECATED116": DEPRECATED116, + * "DEPRECATED117": DEPRECATED117, # <<<<<<<<<<<<<< + * "DEPRECATED118": DEPRECATED118, + * "DEPRECATED119": DEPRECATED119, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED117); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED117, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":233 + * "DEPRECATED116": DEPRECATED116, + * "DEPRECATED117": DEPRECATED117, + * "DEPRECATED118": DEPRECATED118, # <<<<<<<<<<<<<< + * "DEPRECATED119": DEPRECATED119, + * "DEPRECATED120": DEPRECATED120, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED118); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED118, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":234 + * "DEPRECATED117": DEPRECATED117, + * "DEPRECATED118": DEPRECATED118, + * "DEPRECATED119": DEPRECATED119, # <<<<<<<<<<<<<< + * "DEPRECATED120": DEPRECATED120, + * "DEPRECATED121": DEPRECATED121, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED119); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED119, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":235 + * "DEPRECATED118": DEPRECATED118, + * "DEPRECATED119": DEPRECATED119, + * "DEPRECATED120": DEPRECATED120, # <<<<<<<<<<<<<< + * "DEPRECATED121": DEPRECATED121, + * "DEPRECATED122": DEPRECATED122, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED120); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED120, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":236 + * "DEPRECATED119": DEPRECATED119, + * "DEPRECATED120": DEPRECATED120, + * "DEPRECATED121": DEPRECATED121, # <<<<<<<<<<<<<< + * "DEPRECATED122": DEPRECATED122, + * "DEPRECATED123": DEPRECATED123, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED121); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED121, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":237 + * "DEPRECATED120": DEPRECATED120, + * "DEPRECATED121": DEPRECATED121, + * "DEPRECATED122": DEPRECATED122, # <<<<<<<<<<<<<< + * "DEPRECATED123": DEPRECATED123, + * "DEPRECATED124": DEPRECATED124, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED122); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED122, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":238 + * "DEPRECATED121": DEPRECATED121, + * "DEPRECATED122": DEPRECATED122, + * "DEPRECATED123": DEPRECATED123, # <<<<<<<<<<<<<< + * "DEPRECATED124": DEPRECATED124, + * "DEPRECATED125": DEPRECATED125, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED123); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED123, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":239 + * "DEPRECATED122": DEPRECATED122, + * "DEPRECATED123": DEPRECATED123, + * "DEPRECATED124": DEPRECATED124, # <<<<<<<<<<<<<< + * "DEPRECATED125": DEPRECATED125, + * "DEPRECATED126": DEPRECATED126, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED124); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED124, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":240 + * "DEPRECATED123": DEPRECATED123, + * "DEPRECATED124": DEPRECATED124, + * "DEPRECATED125": DEPRECATED125, # <<<<<<<<<<<<<< + * "DEPRECATED126": DEPRECATED126, + * "DEPRECATED127": DEPRECATED127, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED125); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED125, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":241 + * "DEPRECATED124": DEPRECATED124, + * "DEPRECATED125": DEPRECATED125, + * "DEPRECATED126": DEPRECATED126, # <<<<<<<<<<<<<< + * "DEPRECATED127": DEPRECATED127, + * "DEPRECATED128": DEPRECATED128, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED126); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED126, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":242 + * "DEPRECATED125": DEPRECATED125, + * "DEPRECATED126": DEPRECATED126, + * "DEPRECATED127": DEPRECATED127, # <<<<<<<<<<<<<< + * "DEPRECATED128": DEPRECATED128, + * "DEPRECATED129": DEPRECATED129, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED127); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED127, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":243 + * "DEPRECATED126": DEPRECATED126, + * "DEPRECATED127": DEPRECATED127, + * "DEPRECATED128": DEPRECATED128, # <<<<<<<<<<<<<< + * "DEPRECATED129": DEPRECATED129, + * "DEPRECATED130": DEPRECATED130, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED128); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED128, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":244 + * "DEPRECATED127": DEPRECATED127, + * "DEPRECATED128": DEPRECATED128, + * "DEPRECATED129": DEPRECATED129, # <<<<<<<<<<<<<< + * "DEPRECATED130": DEPRECATED130, + * "DEPRECATED131": DEPRECATED131, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED129); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED129, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":245 + * "DEPRECATED128": DEPRECATED128, + * "DEPRECATED129": DEPRECATED129, + * "DEPRECATED130": DEPRECATED130, # <<<<<<<<<<<<<< + * "DEPRECATED131": DEPRECATED131, + * "DEPRECATED132": DEPRECATED132, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED130); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED130, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":246 + * "DEPRECATED129": DEPRECATED129, + * "DEPRECATED130": DEPRECATED130, + * "DEPRECATED131": DEPRECATED131, # <<<<<<<<<<<<<< + * "DEPRECATED132": DEPRECATED132, + * "DEPRECATED133": DEPRECATED133, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED131); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 246, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED131, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":247 + * "DEPRECATED130": DEPRECATED130, + * "DEPRECATED131": DEPRECATED131, + * "DEPRECATED132": DEPRECATED132, # <<<<<<<<<<<<<< + * "DEPRECATED133": DEPRECATED133, + * "DEPRECATED134": DEPRECATED134, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED132); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED132, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":248 + * "DEPRECATED131": DEPRECATED131, + * "DEPRECATED132": DEPRECATED132, + * "DEPRECATED133": DEPRECATED133, # <<<<<<<<<<<<<< + * "DEPRECATED134": DEPRECATED134, + * "DEPRECATED135": DEPRECATED135, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED133); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED133, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":249 + * "DEPRECATED132": DEPRECATED132, + * "DEPRECATED133": DEPRECATED133, + * "DEPRECATED134": DEPRECATED134, # <<<<<<<<<<<<<< + * "DEPRECATED135": DEPRECATED135, + * "DEPRECATED136": DEPRECATED136, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED134); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED134, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":250 + * "DEPRECATED133": DEPRECATED133, + * "DEPRECATED134": DEPRECATED134, + * "DEPRECATED135": DEPRECATED135, # <<<<<<<<<<<<<< + * "DEPRECATED136": DEPRECATED136, + * "DEPRECATED137": DEPRECATED137, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED135); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED135, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":251 + * "DEPRECATED134": DEPRECATED134, + * "DEPRECATED135": DEPRECATED135, + * "DEPRECATED136": DEPRECATED136, # <<<<<<<<<<<<<< + * "DEPRECATED137": DEPRECATED137, + * "DEPRECATED138": DEPRECATED138, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED136); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED136, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":252 + * "DEPRECATED135": DEPRECATED135, + * "DEPRECATED136": DEPRECATED136, + * "DEPRECATED137": DEPRECATED137, # <<<<<<<<<<<<<< + * "DEPRECATED138": DEPRECATED138, + * "DEPRECATED139": DEPRECATED139, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED137); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED137, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":253 + * "DEPRECATED136": DEPRECATED136, + * "DEPRECATED137": DEPRECATED137, + * "DEPRECATED138": DEPRECATED138, # <<<<<<<<<<<<<< + * "DEPRECATED139": DEPRECATED139, + * "DEPRECATED140": DEPRECATED140, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED138); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED138, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":254 + * "DEPRECATED137": DEPRECATED137, + * "DEPRECATED138": DEPRECATED138, + * "DEPRECATED139": DEPRECATED139, # <<<<<<<<<<<<<< + * "DEPRECATED140": DEPRECATED140, + * "DEPRECATED141": DEPRECATED141, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED139); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED139, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":255 + * "DEPRECATED138": DEPRECATED138, + * "DEPRECATED139": DEPRECATED139, + * "DEPRECATED140": DEPRECATED140, # <<<<<<<<<<<<<< + * "DEPRECATED141": DEPRECATED141, + * "DEPRECATED142": DEPRECATED142, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED140); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED140, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":256 + * "DEPRECATED139": DEPRECATED139, + * "DEPRECATED140": DEPRECATED140, + * "DEPRECATED141": DEPRECATED141, # <<<<<<<<<<<<<< + * "DEPRECATED142": DEPRECATED142, + * "DEPRECATED143": DEPRECATED143, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED141); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED141, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":257 + * "DEPRECATED140": DEPRECATED140, + * "DEPRECATED141": DEPRECATED141, + * "DEPRECATED142": DEPRECATED142, # <<<<<<<<<<<<<< + * "DEPRECATED143": DEPRECATED143, + * "DEPRECATED144": DEPRECATED144, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED142); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED142, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":258 + * "DEPRECATED141": DEPRECATED141, + * "DEPRECATED142": DEPRECATED142, + * "DEPRECATED143": DEPRECATED143, # <<<<<<<<<<<<<< + * "DEPRECATED144": DEPRECATED144, + * "DEPRECATED145": DEPRECATED145, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED143); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED143, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":259 + * "DEPRECATED142": DEPRECATED142, + * "DEPRECATED143": DEPRECATED143, + * "DEPRECATED144": DEPRECATED144, # <<<<<<<<<<<<<< + * "DEPRECATED145": DEPRECATED145, + * "DEPRECATED146": DEPRECATED146, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED144); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED144, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":260 + * "DEPRECATED143": DEPRECATED143, + * "DEPRECATED144": DEPRECATED144, + * "DEPRECATED145": DEPRECATED145, # <<<<<<<<<<<<<< + * "DEPRECATED146": DEPRECATED146, + * "DEPRECATED147": DEPRECATED147, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED145); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED145, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":261 + * "DEPRECATED144": DEPRECATED144, + * "DEPRECATED145": DEPRECATED145, + * "DEPRECATED146": DEPRECATED146, # <<<<<<<<<<<<<< + * "DEPRECATED147": DEPRECATED147, + * "DEPRECATED148": DEPRECATED148, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED146); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED146, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":262 + * "DEPRECATED145": DEPRECATED145, + * "DEPRECATED146": DEPRECATED146, + * "DEPRECATED147": DEPRECATED147, # <<<<<<<<<<<<<< + * "DEPRECATED148": DEPRECATED148, + * "DEPRECATED149": DEPRECATED149, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED147); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED147, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":263 + * "DEPRECATED146": DEPRECATED146, + * "DEPRECATED147": DEPRECATED147, + * "DEPRECATED148": DEPRECATED148, # <<<<<<<<<<<<<< + * "DEPRECATED149": DEPRECATED149, + * "DEPRECATED150": DEPRECATED150, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED148); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED148, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":264 + * "DEPRECATED147": DEPRECATED147, + * "DEPRECATED148": DEPRECATED148, + * "DEPRECATED149": DEPRECATED149, # <<<<<<<<<<<<<< + * "DEPRECATED150": DEPRECATED150, + * "DEPRECATED151": DEPRECATED151, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED149); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED149, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":265 + * "DEPRECATED148": DEPRECATED148, + * "DEPRECATED149": DEPRECATED149, + * "DEPRECATED150": DEPRECATED150, # <<<<<<<<<<<<<< + * "DEPRECATED151": DEPRECATED151, + * "DEPRECATED152": DEPRECATED152, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED150); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED150, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":266 + * "DEPRECATED149": DEPRECATED149, + * "DEPRECATED150": DEPRECATED150, + * "DEPRECATED151": DEPRECATED151, # <<<<<<<<<<<<<< + * "DEPRECATED152": DEPRECATED152, + * "DEPRECATED153": DEPRECATED153, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED151); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED151, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":267 + * "DEPRECATED150": DEPRECATED150, + * "DEPRECATED151": DEPRECATED151, + * "DEPRECATED152": DEPRECATED152, # <<<<<<<<<<<<<< + * "DEPRECATED153": DEPRECATED153, + * "DEPRECATED154": DEPRECATED154, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED152); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED152, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":268 + * "DEPRECATED151": DEPRECATED151, + * "DEPRECATED152": DEPRECATED152, + * "DEPRECATED153": DEPRECATED153, # <<<<<<<<<<<<<< + * "DEPRECATED154": DEPRECATED154, + * "DEPRECATED155": DEPRECATED155, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED153); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED153, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":269 + * "DEPRECATED152": DEPRECATED152, + * "DEPRECATED153": DEPRECATED153, + * "DEPRECATED154": DEPRECATED154, # <<<<<<<<<<<<<< + * "DEPRECATED155": DEPRECATED155, + * "DEPRECATED156": DEPRECATED156, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED154); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED154, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":270 + * "DEPRECATED153": DEPRECATED153, + * "DEPRECATED154": DEPRECATED154, + * "DEPRECATED155": DEPRECATED155, # <<<<<<<<<<<<<< + * "DEPRECATED156": DEPRECATED156, + * "DEPRECATED157": DEPRECATED157, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED155); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED155, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":271 + * "DEPRECATED154": DEPRECATED154, + * "DEPRECATED155": DEPRECATED155, + * "DEPRECATED156": DEPRECATED156, # <<<<<<<<<<<<<< + * "DEPRECATED157": DEPRECATED157, + * "DEPRECATED158": DEPRECATED158, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED156); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED156, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":272 + * "DEPRECATED155": DEPRECATED155, + * "DEPRECATED156": DEPRECATED156, + * "DEPRECATED157": DEPRECATED157, # <<<<<<<<<<<<<< + * "DEPRECATED158": DEPRECATED158, + * "DEPRECATED159": DEPRECATED159, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED157); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED157, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":273 + * "DEPRECATED156": DEPRECATED156, + * "DEPRECATED157": DEPRECATED157, + * "DEPRECATED158": DEPRECATED158, # <<<<<<<<<<<<<< + * "DEPRECATED159": DEPRECATED159, + * "DEPRECATED160": DEPRECATED160, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED158); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED158, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":274 + * "DEPRECATED157": DEPRECATED157, + * "DEPRECATED158": DEPRECATED158, + * "DEPRECATED159": DEPRECATED159, # <<<<<<<<<<<<<< + * "DEPRECATED160": DEPRECATED160, + * "DEPRECATED161": DEPRECATED161, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED159); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED159, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":275 + * "DEPRECATED158": DEPRECATED158, + * "DEPRECATED159": DEPRECATED159, + * "DEPRECATED160": DEPRECATED160, # <<<<<<<<<<<<<< + * "DEPRECATED161": DEPRECATED161, + * "DEPRECATED162": DEPRECATED162, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED160); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED160, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":276 + * "DEPRECATED159": DEPRECATED159, + * "DEPRECATED160": DEPRECATED160, + * "DEPRECATED161": DEPRECATED161, # <<<<<<<<<<<<<< + * "DEPRECATED162": DEPRECATED162, + * "DEPRECATED163": DEPRECATED163, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED161); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED161, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":277 + * "DEPRECATED160": DEPRECATED160, + * "DEPRECATED161": DEPRECATED161, + * "DEPRECATED162": DEPRECATED162, # <<<<<<<<<<<<<< + * "DEPRECATED163": DEPRECATED163, + * "DEPRECATED164": DEPRECATED164, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED162); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED162, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":278 + * "DEPRECATED161": DEPRECATED161, + * "DEPRECATED162": DEPRECATED162, + * "DEPRECATED163": DEPRECATED163, # <<<<<<<<<<<<<< + * "DEPRECATED164": DEPRECATED164, + * "DEPRECATED165": DEPRECATED165, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED163); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED163, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":279 + * "DEPRECATED162": DEPRECATED162, + * "DEPRECATED163": DEPRECATED163, + * "DEPRECATED164": DEPRECATED164, # <<<<<<<<<<<<<< + * "DEPRECATED165": DEPRECATED165, + * "DEPRECATED166": DEPRECATED166, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED164); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED164, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":280 + * "DEPRECATED163": DEPRECATED163, + * "DEPRECATED164": DEPRECATED164, + * "DEPRECATED165": DEPRECATED165, # <<<<<<<<<<<<<< + * "DEPRECATED166": DEPRECATED166, + * "DEPRECATED167": DEPRECATED167, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED165); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED165, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":281 + * "DEPRECATED164": DEPRECATED164, + * "DEPRECATED165": DEPRECATED165, + * "DEPRECATED166": DEPRECATED166, # <<<<<<<<<<<<<< + * "DEPRECATED167": DEPRECATED167, + * "DEPRECATED168": DEPRECATED168, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED166); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED166, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":282 + * "DEPRECATED165": DEPRECATED165, + * "DEPRECATED166": DEPRECATED166, + * "DEPRECATED167": DEPRECATED167, # <<<<<<<<<<<<<< + * "DEPRECATED168": DEPRECATED168, + * "DEPRECATED169": DEPRECATED169, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED167); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED167, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":283 + * "DEPRECATED166": DEPRECATED166, + * "DEPRECATED167": DEPRECATED167, + * "DEPRECATED168": DEPRECATED168, # <<<<<<<<<<<<<< + * "DEPRECATED169": DEPRECATED169, + * "DEPRECATED170": DEPRECATED170, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED168); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED168, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":284 + * "DEPRECATED167": DEPRECATED167, + * "DEPRECATED168": DEPRECATED168, + * "DEPRECATED169": DEPRECATED169, # <<<<<<<<<<<<<< + * "DEPRECATED170": DEPRECATED170, + * "DEPRECATED171": DEPRECATED171, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED169); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED169, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":285 + * "DEPRECATED168": DEPRECATED168, + * "DEPRECATED169": DEPRECATED169, + * "DEPRECATED170": DEPRECATED170, # <<<<<<<<<<<<<< + * "DEPRECATED171": DEPRECATED171, + * "DEPRECATED172": DEPRECATED172, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED170); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED170, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":286 + * "DEPRECATED169": DEPRECATED169, + * "DEPRECATED170": DEPRECATED170, + * "DEPRECATED171": DEPRECATED171, # <<<<<<<<<<<<<< + * "DEPRECATED172": DEPRECATED172, + * "DEPRECATED173": DEPRECATED173, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED171); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 286, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED171, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":287 + * "DEPRECATED170": DEPRECATED170, + * "DEPRECATED171": DEPRECATED171, + * "DEPRECATED172": DEPRECATED172, # <<<<<<<<<<<<<< + * "DEPRECATED173": DEPRECATED173, + * "DEPRECATED174": DEPRECATED174, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED172); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED172, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":288 + * "DEPRECATED171": DEPRECATED171, + * "DEPRECATED172": DEPRECATED172, + * "DEPRECATED173": DEPRECATED173, # <<<<<<<<<<<<<< + * "DEPRECATED174": DEPRECATED174, + * "DEPRECATED175": DEPRECATED175, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED173); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED173, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":289 + * "DEPRECATED172": DEPRECATED172, + * "DEPRECATED173": DEPRECATED173, + * "DEPRECATED174": DEPRECATED174, # <<<<<<<<<<<<<< + * "DEPRECATED175": DEPRECATED175, + * "DEPRECATED176": DEPRECATED176, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED174); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED174, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":290 + * "DEPRECATED173": DEPRECATED173, + * "DEPRECATED174": DEPRECATED174, + * "DEPRECATED175": DEPRECATED175, # <<<<<<<<<<<<<< + * "DEPRECATED176": DEPRECATED176, + * "DEPRECATED177": DEPRECATED177, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED175); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED175, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":291 + * "DEPRECATED174": DEPRECATED174, + * "DEPRECATED175": DEPRECATED175, + * "DEPRECATED176": DEPRECATED176, # <<<<<<<<<<<<<< + * "DEPRECATED177": DEPRECATED177, + * "DEPRECATED178": DEPRECATED178, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED176); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED176, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":292 + * "DEPRECATED175": DEPRECATED175, + * "DEPRECATED176": DEPRECATED176, + * "DEPRECATED177": DEPRECATED177, # <<<<<<<<<<<<<< + * "DEPRECATED178": DEPRECATED178, + * "DEPRECATED179": DEPRECATED179, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED177); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED177, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":293 + * "DEPRECATED176": DEPRECATED176, + * "DEPRECATED177": DEPRECATED177, + * "DEPRECATED178": DEPRECATED178, # <<<<<<<<<<<<<< + * "DEPRECATED179": DEPRECATED179, + * "DEPRECATED180": DEPRECATED180, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED178); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED178, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":294 + * "DEPRECATED177": DEPRECATED177, + * "DEPRECATED178": DEPRECATED178, + * "DEPRECATED179": DEPRECATED179, # <<<<<<<<<<<<<< + * "DEPRECATED180": DEPRECATED180, + * "DEPRECATED181": DEPRECATED181, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED179); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 294, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED179, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":295 + * "DEPRECATED178": DEPRECATED178, + * "DEPRECATED179": DEPRECATED179, + * "DEPRECATED180": DEPRECATED180, # <<<<<<<<<<<<<< + * "DEPRECATED181": DEPRECATED181, + * "DEPRECATED182": DEPRECATED182, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED180); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED180, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":296 + * "DEPRECATED179": DEPRECATED179, + * "DEPRECATED180": DEPRECATED180, + * "DEPRECATED181": DEPRECATED181, # <<<<<<<<<<<<<< + * "DEPRECATED182": DEPRECATED182, + * "DEPRECATED183": DEPRECATED183, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED181); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED181, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":297 + * "DEPRECATED180": DEPRECATED180, + * "DEPRECATED181": DEPRECATED181, + * "DEPRECATED182": DEPRECATED182, # <<<<<<<<<<<<<< + * "DEPRECATED183": DEPRECATED183, + * "DEPRECATED184": DEPRECATED184, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED182); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED182, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":298 + * "DEPRECATED181": DEPRECATED181, + * "DEPRECATED182": DEPRECATED182, + * "DEPRECATED183": DEPRECATED183, # <<<<<<<<<<<<<< + * "DEPRECATED184": DEPRECATED184, + * "DEPRECATED185": DEPRECATED185, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED183); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED183, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":299 + * "DEPRECATED182": DEPRECATED182, + * "DEPRECATED183": DEPRECATED183, + * "DEPRECATED184": DEPRECATED184, # <<<<<<<<<<<<<< + * "DEPRECATED185": DEPRECATED185, + * "DEPRECATED186": DEPRECATED186, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED184); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED184, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":300 + * "DEPRECATED183": DEPRECATED183, + * "DEPRECATED184": DEPRECATED184, + * "DEPRECATED185": DEPRECATED185, # <<<<<<<<<<<<<< + * "DEPRECATED186": DEPRECATED186, + * "DEPRECATED187": DEPRECATED187, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED185); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED185, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":301 + * "DEPRECATED184": DEPRECATED184, + * "DEPRECATED185": DEPRECATED185, + * "DEPRECATED186": DEPRECATED186, # <<<<<<<<<<<<<< + * "DEPRECATED187": DEPRECATED187, + * "DEPRECATED188": DEPRECATED188, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED186); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED186, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":302 + * "DEPRECATED185": DEPRECATED185, + * "DEPRECATED186": DEPRECATED186, + * "DEPRECATED187": DEPRECATED187, # <<<<<<<<<<<<<< + * "DEPRECATED188": DEPRECATED188, + * "DEPRECATED189": DEPRECATED189, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED187); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED187, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":303 + * "DEPRECATED186": DEPRECATED186, + * "DEPRECATED187": DEPRECATED187, + * "DEPRECATED188": DEPRECATED188, # <<<<<<<<<<<<<< + * "DEPRECATED189": DEPRECATED189, + * "DEPRECATED190": DEPRECATED190, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED188); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED188, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":304 + * "DEPRECATED187": DEPRECATED187, + * "DEPRECATED188": DEPRECATED188, + * "DEPRECATED189": DEPRECATED189, # <<<<<<<<<<<<<< + * "DEPRECATED190": DEPRECATED190, + * "DEPRECATED191": DEPRECATED191, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED189); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED189, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":305 + * "DEPRECATED188": DEPRECATED188, + * "DEPRECATED189": DEPRECATED189, + * "DEPRECATED190": DEPRECATED190, # <<<<<<<<<<<<<< + * "DEPRECATED191": DEPRECATED191, + * "DEPRECATED192": DEPRECATED192, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED190); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED190, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":306 + * "DEPRECATED189": DEPRECATED189, + * "DEPRECATED190": DEPRECATED190, + * "DEPRECATED191": DEPRECATED191, # <<<<<<<<<<<<<< + * "DEPRECATED192": DEPRECATED192, + * "DEPRECATED193": DEPRECATED193, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED191); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED191, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":307 + * "DEPRECATED190": DEPRECATED190, + * "DEPRECATED191": DEPRECATED191, + * "DEPRECATED192": DEPRECATED192, # <<<<<<<<<<<<<< + * "DEPRECATED193": DEPRECATED193, + * "DEPRECATED194": DEPRECATED194, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED192); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED192, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":308 + * "DEPRECATED191": DEPRECATED191, + * "DEPRECATED192": DEPRECATED192, + * "DEPRECATED193": DEPRECATED193, # <<<<<<<<<<<<<< + * "DEPRECATED194": DEPRECATED194, + * "DEPRECATED195": DEPRECATED195, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED193); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED193, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":309 + * "DEPRECATED192": DEPRECATED192, + * "DEPRECATED193": DEPRECATED193, + * "DEPRECATED194": DEPRECATED194, # <<<<<<<<<<<<<< + * "DEPRECATED195": DEPRECATED195, + * "DEPRECATED196": DEPRECATED196, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED194); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED194, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":310 + * "DEPRECATED193": DEPRECATED193, + * "DEPRECATED194": DEPRECATED194, + * "DEPRECATED195": DEPRECATED195, # <<<<<<<<<<<<<< + * "DEPRECATED196": DEPRECATED196, + * "DEPRECATED197": DEPRECATED197, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED195); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED195, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":311 + * "DEPRECATED194": DEPRECATED194, + * "DEPRECATED195": DEPRECATED195, + * "DEPRECATED196": DEPRECATED196, # <<<<<<<<<<<<<< + * "DEPRECATED197": DEPRECATED197, + * "DEPRECATED198": DEPRECATED198, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED196); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED196, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":312 + * "DEPRECATED195": DEPRECATED195, + * "DEPRECATED196": DEPRECATED196, + * "DEPRECATED197": DEPRECATED197, # <<<<<<<<<<<<<< + * "DEPRECATED198": DEPRECATED198, + * "DEPRECATED199": DEPRECATED199, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED197); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED197, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":313 + * "DEPRECATED196": DEPRECATED196, + * "DEPRECATED197": DEPRECATED197, + * "DEPRECATED198": DEPRECATED198, # <<<<<<<<<<<<<< + * "DEPRECATED199": DEPRECATED199, + * "DEPRECATED200": DEPRECATED200, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED198); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED198, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":314 + * "DEPRECATED197": DEPRECATED197, + * "DEPRECATED198": DEPRECATED198, + * "DEPRECATED199": DEPRECATED199, # <<<<<<<<<<<<<< + * "DEPRECATED200": DEPRECATED200, + * "DEPRECATED201": DEPRECATED201, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED199); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED199, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":315 + * "DEPRECATED198": DEPRECATED198, + * "DEPRECATED199": DEPRECATED199, + * "DEPRECATED200": DEPRECATED200, # <<<<<<<<<<<<<< + * "DEPRECATED201": DEPRECATED201, + * "DEPRECATED202": DEPRECATED202, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED200); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED200, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":316 + * "DEPRECATED199": DEPRECATED199, + * "DEPRECATED200": DEPRECATED200, + * "DEPRECATED201": DEPRECATED201, # <<<<<<<<<<<<<< + * "DEPRECATED202": DEPRECATED202, + * "DEPRECATED203": DEPRECATED203, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED201); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED201, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":317 + * "DEPRECATED200": DEPRECATED200, + * "DEPRECATED201": DEPRECATED201, + * "DEPRECATED202": DEPRECATED202, # <<<<<<<<<<<<<< + * "DEPRECATED203": DEPRECATED203, + * "DEPRECATED204": DEPRECATED204, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED202); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED202, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":318 + * "DEPRECATED201": DEPRECATED201, + * "DEPRECATED202": DEPRECATED202, + * "DEPRECATED203": DEPRECATED203, # <<<<<<<<<<<<<< + * "DEPRECATED204": DEPRECATED204, + * "DEPRECATED205": DEPRECATED205, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED203); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED203, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":319 + * "DEPRECATED202": DEPRECATED202, + * "DEPRECATED203": DEPRECATED203, + * "DEPRECATED204": DEPRECATED204, # <<<<<<<<<<<<<< + * "DEPRECATED205": DEPRECATED205, + * "DEPRECATED206": DEPRECATED206, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED204); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED204, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":320 + * "DEPRECATED203": DEPRECATED203, + * "DEPRECATED204": DEPRECATED204, + * "DEPRECATED205": DEPRECATED205, # <<<<<<<<<<<<<< + * "DEPRECATED206": DEPRECATED206, + * "DEPRECATED207": DEPRECATED207, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED205); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED205, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":321 + * "DEPRECATED204": DEPRECATED204, + * "DEPRECATED205": DEPRECATED205, + * "DEPRECATED206": DEPRECATED206, # <<<<<<<<<<<<<< + * "DEPRECATED207": DEPRECATED207, + * "DEPRECATED208": DEPRECATED208, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED206); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED206, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":322 + * "DEPRECATED205": DEPRECATED205, + * "DEPRECATED206": DEPRECATED206, + * "DEPRECATED207": DEPRECATED207, # <<<<<<<<<<<<<< + * "DEPRECATED208": DEPRECATED208, + * "DEPRECATED209": DEPRECATED209, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED207); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED207, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":323 + * "DEPRECATED206": DEPRECATED206, + * "DEPRECATED207": DEPRECATED207, + * "DEPRECATED208": DEPRECATED208, # <<<<<<<<<<<<<< + * "DEPRECATED209": DEPRECATED209, + * "DEPRECATED210": DEPRECATED210, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED208); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 323, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED208, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":324 + * "DEPRECATED207": DEPRECATED207, + * "DEPRECATED208": DEPRECATED208, + * "DEPRECATED209": DEPRECATED209, # <<<<<<<<<<<<<< + * "DEPRECATED210": DEPRECATED210, + * "DEPRECATED211": DEPRECATED211, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED209); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED209, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":325 + * "DEPRECATED208": DEPRECATED208, + * "DEPRECATED209": DEPRECATED209, + * "DEPRECATED210": DEPRECATED210, # <<<<<<<<<<<<<< + * "DEPRECATED211": DEPRECATED211, + * "DEPRECATED212": DEPRECATED212, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED210); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED210, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":326 + * "DEPRECATED209": DEPRECATED209, + * "DEPRECATED210": DEPRECATED210, + * "DEPRECATED211": DEPRECATED211, # <<<<<<<<<<<<<< + * "DEPRECATED212": DEPRECATED212, + * "DEPRECATED213": DEPRECATED213, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED211); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED211, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":327 + * "DEPRECATED210": DEPRECATED210, + * "DEPRECATED211": DEPRECATED211, + * "DEPRECATED212": DEPRECATED212, # <<<<<<<<<<<<<< + * "DEPRECATED213": DEPRECATED213, + * "DEPRECATED214": DEPRECATED214, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED212); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED212, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":328 + * "DEPRECATED211": DEPRECATED211, + * "DEPRECATED212": DEPRECATED212, + * "DEPRECATED213": DEPRECATED213, # <<<<<<<<<<<<<< + * "DEPRECATED214": DEPRECATED214, + * "DEPRECATED215": DEPRECATED215, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED213); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED213, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":329 + * "DEPRECATED212": DEPRECATED212, + * "DEPRECATED213": DEPRECATED213, + * "DEPRECATED214": DEPRECATED214, # <<<<<<<<<<<<<< + * "DEPRECATED215": DEPRECATED215, + * "DEPRECATED216": DEPRECATED216, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED214); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 329, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED214, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":330 + * "DEPRECATED213": DEPRECATED213, + * "DEPRECATED214": DEPRECATED214, + * "DEPRECATED215": DEPRECATED215, # <<<<<<<<<<<<<< + * "DEPRECATED216": DEPRECATED216, + * "DEPRECATED217": DEPRECATED217, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED215); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED215, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":331 + * "DEPRECATED214": DEPRECATED214, + * "DEPRECATED215": DEPRECATED215, + * "DEPRECATED216": DEPRECATED216, # <<<<<<<<<<<<<< + * "DEPRECATED217": DEPRECATED217, + * "DEPRECATED218": DEPRECATED218, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED216); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED216, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":332 + * "DEPRECATED215": DEPRECATED215, + * "DEPRECATED216": DEPRECATED216, + * "DEPRECATED217": DEPRECATED217, # <<<<<<<<<<<<<< + * "DEPRECATED218": DEPRECATED218, + * "DEPRECATED219": DEPRECATED219, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED217); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED217, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":333 + * "DEPRECATED216": DEPRECATED216, + * "DEPRECATED217": DEPRECATED217, + * "DEPRECATED218": DEPRECATED218, # <<<<<<<<<<<<<< + * "DEPRECATED219": DEPRECATED219, + * "DEPRECATED220": DEPRECATED220, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED218); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED218, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":334 + * "DEPRECATED217": DEPRECATED217, + * "DEPRECATED218": DEPRECATED218, + * "DEPRECATED219": DEPRECATED219, # <<<<<<<<<<<<<< + * "DEPRECATED220": DEPRECATED220, + * "DEPRECATED221": DEPRECATED221, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED219); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED219, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":335 + * "DEPRECATED218": DEPRECATED218, + * "DEPRECATED219": DEPRECATED219, + * "DEPRECATED220": DEPRECATED220, # <<<<<<<<<<<<<< + * "DEPRECATED221": DEPRECATED221, + * "DEPRECATED222": DEPRECATED222, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED220); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 335, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED220, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":336 + * "DEPRECATED219": DEPRECATED219, + * "DEPRECATED220": DEPRECATED220, + * "DEPRECATED221": DEPRECATED221, # <<<<<<<<<<<<<< + * "DEPRECATED222": DEPRECATED222, + * "DEPRECATED223": DEPRECATED223, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED221); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED221, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":337 + * "DEPRECATED220": DEPRECATED220, + * "DEPRECATED221": DEPRECATED221, + * "DEPRECATED222": DEPRECATED222, # <<<<<<<<<<<<<< + * "DEPRECATED223": DEPRECATED223, + * "DEPRECATED224": DEPRECATED224, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED222); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED222, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":338 + * "DEPRECATED221": DEPRECATED221, + * "DEPRECATED222": DEPRECATED222, + * "DEPRECATED223": DEPRECATED223, # <<<<<<<<<<<<<< + * "DEPRECATED224": DEPRECATED224, + * "DEPRECATED225": DEPRECATED225, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED223); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 338, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED223, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":339 + * "DEPRECATED222": DEPRECATED222, + * "DEPRECATED223": DEPRECATED223, + * "DEPRECATED224": DEPRECATED224, # <<<<<<<<<<<<<< + * "DEPRECATED225": DEPRECATED225, + * "DEPRECATED226": DEPRECATED226, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED224); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED224, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":340 + * "DEPRECATED223": DEPRECATED223, + * "DEPRECATED224": DEPRECATED224, + * "DEPRECATED225": DEPRECATED225, # <<<<<<<<<<<<<< + * "DEPRECATED226": DEPRECATED226, + * "DEPRECATED227": DEPRECATED227, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED225); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED225, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":341 + * "DEPRECATED224": DEPRECATED224, + * "DEPRECATED225": DEPRECATED225, + * "DEPRECATED226": DEPRECATED226, # <<<<<<<<<<<<<< + * "DEPRECATED227": DEPRECATED227, + * "DEPRECATED228": DEPRECATED228, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED226); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED226, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":342 + * "DEPRECATED225": DEPRECATED225, + * "DEPRECATED226": DEPRECATED226, + * "DEPRECATED227": DEPRECATED227, # <<<<<<<<<<<<<< + * "DEPRECATED228": DEPRECATED228, + * "DEPRECATED229": DEPRECATED229, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED227); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED227, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":343 + * "DEPRECATED226": DEPRECATED226, + * "DEPRECATED227": DEPRECATED227, + * "DEPRECATED228": DEPRECATED228, # <<<<<<<<<<<<<< + * "DEPRECATED229": DEPRECATED229, + * "DEPRECATED230": DEPRECATED230, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED228); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED228, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":344 + * "DEPRECATED227": DEPRECATED227, + * "DEPRECATED228": DEPRECATED228, + * "DEPRECATED229": DEPRECATED229, # <<<<<<<<<<<<<< + * "DEPRECATED230": DEPRECATED230, + * "DEPRECATED231": DEPRECATED231, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED229); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 344, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED229, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":345 + * "DEPRECATED228": DEPRECATED228, + * "DEPRECATED229": DEPRECATED229, + * "DEPRECATED230": DEPRECATED230, # <<<<<<<<<<<<<< + * "DEPRECATED231": DEPRECATED231, + * "DEPRECATED232": DEPRECATED232, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED230); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED230, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":346 + * "DEPRECATED229": DEPRECATED229, + * "DEPRECATED230": DEPRECATED230, + * "DEPRECATED231": DEPRECATED231, # <<<<<<<<<<<<<< + * "DEPRECATED232": DEPRECATED232, + * "DEPRECATED233": DEPRECATED233, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED231); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED231, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":347 + * "DEPRECATED230": DEPRECATED230, + * "DEPRECATED231": DEPRECATED231, + * "DEPRECATED232": DEPRECATED232, # <<<<<<<<<<<<<< + * "DEPRECATED233": DEPRECATED233, + * "DEPRECATED234": DEPRECATED234, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED232); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED232, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":348 + * "DEPRECATED231": DEPRECATED231, + * "DEPRECATED232": DEPRECATED232, + * "DEPRECATED233": DEPRECATED233, # <<<<<<<<<<<<<< + * "DEPRECATED234": DEPRECATED234, + * "DEPRECATED235": DEPRECATED235, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED233); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED233, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":349 + * "DEPRECATED232": DEPRECATED232, + * "DEPRECATED233": DEPRECATED233, + * "DEPRECATED234": DEPRECATED234, # <<<<<<<<<<<<<< + * "DEPRECATED235": DEPRECATED235, + * "DEPRECATED236": DEPRECATED236, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED234); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 349, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED234, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":350 + * "DEPRECATED233": DEPRECATED233, + * "DEPRECATED234": DEPRECATED234, + * "DEPRECATED235": DEPRECATED235, # <<<<<<<<<<<<<< + * "DEPRECATED236": DEPRECATED236, + * "DEPRECATED237": DEPRECATED237, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED235); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 350, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED235, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":351 + * "DEPRECATED234": DEPRECATED234, + * "DEPRECATED235": DEPRECATED235, + * "DEPRECATED236": DEPRECATED236, # <<<<<<<<<<<<<< + * "DEPRECATED237": DEPRECATED237, + * "DEPRECATED238": DEPRECATED238, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED236); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED236, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":352 + * "DEPRECATED235": DEPRECATED235, + * "DEPRECATED236": DEPRECATED236, + * "DEPRECATED237": DEPRECATED237, # <<<<<<<<<<<<<< + * "DEPRECATED238": DEPRECATED238, + * "DEPRECATED239": DEPRECATED239, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED237); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED237, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":353 + * "DEPRECATED236": DEPRECATED236, + * "DEPRECATED237": DEPRECATED237, + * "DEPRECATED238": DEPRECATED238, # <<<<<<<<<<<<<< + * "DEPRECATED239": DEPRECATED239, + * "DEPRECATED240": DEPRECATED240, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED238); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED238, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":354 + * "DEPRECATED237": DEPRECATED237, + * "DEPRECATED238": DEPRECATED238, + * "DEPRECATED239": DEPRECATED239, # <<<<<<<<<<<<<< + * "DEPRECATED240": DEPRECATED240, + * "DEPRECATED241": DEPRECATED241, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED239); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED239, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":355 + * "DEPRECATED238": DEPRECATED238, + * "DEPRECATED239": DEPRECATED239, + * "DEPRECATED240": DEPRECATED240, # <<<<<<<<<<<<<< + * "DEPRECATED241": DEPRECATED241, + * "DEPRECATED242": DEPRECATED242, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED240); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED240, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":356 + * "DEPRECATED239": DEPRECATED239, + * "DEPRECATED240": DEPRECATED240, + * "DEPRECATED241": DEPRECATED241, # <<<<<<<<<<<<<< + * "DEPRECATED242": DEPRECATED242, + * "DEPRECATED243": DEPRECATED243, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED241); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED241, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":357 + * "DEPRECATED240": DEPRECATED240, + * "DEPRECATED241": DEPRECATED241, + * "DEPRECATED242": DEPRECATED242, # <<<<<<<<<<<<<< + * "DEPRECATED243": DEPRECATED243, + * "DEPRECATED244": DEPRECATED244, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED242); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED242, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":358 + * "DEPRECATED241": DEPRECATED241, + * "DEPRECATED242": DEPRECATED242, + * "DEPRECATED243": DEPRECATED243, # <<<<<<<<<<<<<< + * "DEPRECATED244": DEPRECATED244, + * "DEPRECATED245": DEPRECATED245, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED243); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED243, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":359 + * "DEPRECATED242": DEPRECATED242, + * "DEPRECATED243": DEPRECATED243, + * "DEPRECATED244": DEPRECATED244, # <<<<<<<<<<<<<< + * "DEPRECATED245": DEPRECATED245, + * "DEPRECATED246": DEPRECATED246, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED244); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED244, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":360 + * "DEPRECATED243": DEPRECATED243, + * "DEPRECATED244": DEPRECATED244, + * "DEPRECATED245": DEPRECATED245, # <<<<<<<<<<<<<< + * "DEPRECATED246": DEPRECATED246, + * "DEPRECATED247": DEPRECATED247, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED245); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED245, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":361 + * "DEPRECATED244": DEPRECATED244, + * "DEPRECATED245": DEPRECATED245, + * "DEPRECATED246": DEPRECATED246, # <<<<<<<<<<<<<< + * "DEPRECATED247": DEPRECATED247, + * "DEPRECATED248": DEPRECATED248, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED246); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED246, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":362 + * "DEPRECATED245": DEPRECATED245, + * "DEPRECATED246": DEPRECATED246, + * "DEPRECATED247": DEPRECATED247, # <<<<<<<<<<<<<< + * "DEPRECATED248": DEPRECATED248, + * "DEPRECATED249": DEPRECATED249, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED247); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED247, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":363 + * "DEPRECATED246": DEPRECATED246, + * "DEPRECATED247": DEPRECATED247, + * "DEPRECATED248": DEPRECATED248, # <<<<<<<<<<<<<< + * "DEPRECATED249": DEPRECATED249, + * "DEPRECATED250": DEPRECATED250, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED248); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED248, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":364 + * "DEPRECATED247": DEPRECATED247, + * "DEPRECATED248": DEPRECATED248, + * "DEPRECATED249": DEPRECATED249, # <<<<<<<<<<<<<< + * "DEPRECATED250": DEPRECATED250, + * "DEPRECATED251": DEPRECATED251, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED249); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED249, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":365 + * "DEPRECATED248": DEPRECATED248, + * "DEPRECATED249": DEPRECATED249, + * "DEPRECATED250": DEPRECATED250, # <<<<<<<<<<<<<< + * "DEPRECATED251": DEPRECATED251, + * "DEPRECATED252": DEPRECATED252, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED250); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED250, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":366 + * "DEPRECATED249": DEPRECATED249, + * "DEPRECATED250": DEPRECATED250, + * "DEPRECATED251": DEPRECATED251, # <<<<<<<<<<<<<< + * "DEPRECATED252": DEPRECATED252, + * "DEPRECATED253": DEPRECATED253, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED251); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED251, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":367 + * "DEPRECATED250": DEPRECATED250, + * "DEPRECATED251": DEPRECATED251, + * "DEPRECATED252": DEPRECATED252, # <<<<<<<<<<<<<< + * "DEPRECATED253": DEPRECATED253, + * "DEPRECATED254": DEPRECATED254, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED252); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED252, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":368 + * "DEPRECATED251": DEPRECATED251, + * "DEPRECATED252": DEPRECATED252, + * "DEPRECATED253": DEPRECATED253, # <<<<<<<<<<<<<< + * "DEPRECATED254": DEPRECATED254, + * "DEPRECATED255": DEPRECATED255, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED253); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED253, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":369 + * "DEPRECATED252": DEPRECATED252, + * "DEPRECATED253": DEPRECATED253, + * "DEPRECATED254": DEPRECATED254, # <<<<<<<<<<<<<< + * "DEPRECATED255": DEPRECATED255, + * "DEPRECATED256": DEPRECATED256, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED254); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED254, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":370 + * "DEPRECATED253": DEPRECATED253, + * "DEPRECATED254": DEPRECATED254, + * "DEPRECATED255": DEPRECATED255, # <<<<<<<<<<<<<< + * "DEPRECATED256": DEPRECATED256, + * "DEPRECATED257": DEPRECATED257, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED255); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED255, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":371 + * "DEPRECATED254": DEPRECATED254, + * "DEPRECATED255": DEPRECATED255, + * "DEPRECATED256": DEPRECATED256, # <<<<<<<<<<<<<< + * "DEPRECATED257": DEPRECATED257, + * "DEPRECATED258": DEPRECATED258, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED256); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED256, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":372 + * "DEPRECATED255": DEPRECATED255, + * "DEPRECATED256": DEPRECATED256, + * "DEPRECATED257": DEPRECATED257, # <<<<<<<<<<<<<< + * "DEPRECATED258": DEPRECATED258, + * "DEPRECATED259": DEPRECATED259, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED257); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED257, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":373 + * "DEPRECATED256": DEPRECATED256, + * "DEPRECATED257": DEPRECATED257, + * "DEPRECATED258": DEPRECATED258, # <<<<<<<<<<<<<< + * "DEPRECATED259": DEPRECATED259, + * "DEPRECATED260": DEPRECATED260, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED258); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED258, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":374 + * "DEPRECATED257": DEPRECATED257, + * "DEPRECATED258": DEPRECATED258, + * "DEPRECATED259": DEPRECATED259, # <<<<<<<<<<<<<< + * "DEPRECATED260": DEPRECATED260, + * "DEPRECATED261": DEPRECATED261, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED259); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED259, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":375 + * "DEPRECATED258": DEPRECATED258, + * "DEPRECATED259": DEPRECATED259, + * "DEPRECATED260": DEPRECATED260, # <<<<<<<<<<<<<< + * "DEPRECATED261": DEPRECATED261, + * "DEPRECATED262": DEPRECATED262, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED260); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED260, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":376 + * "DEPRECATED259": DEPRECATED259, + * "DEPRECATED260": DEPRECATED260, + * "DEPRECATED261": DEPRECATED261, # <<<<<<<<<<<<<< + * "DEPRECATED262": DEPRECATED262, + * "DEPRECATED263": DEPRECATED263, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED261); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED261, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":377 + * "DEPRECATED260": DEPRECATED260, + * "DEPRECATED261": DEPRECATED261, + * "DEPRECATED262": DEPRECATED262, # <<<<<<<<<<<<<< + * "DEPRECATED263": DEPRECATED263, + * "DEPRECATED264": DEPRECATED264, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED262); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED262, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":378 + * "DEPRECATED261": DEPRECATED261, + * "DEPRECATED262": DEPRECATED262, + * "DEPRECATED263": DEPRECATED263, # <<<<<<<<<<<<<< + * "DEPRECATED264": DEPRECATED264, + * "DEPRECATED265": DEPRECATED265, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED263); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED263, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":379 + * "DEPRECATED262": DEPRECATED262, + * "DEPRECATED263": DEPRECATED263, + * "DEPRECATED264": DEPRECATED264, # <<<<<<<<<<<<<< + * "DEPRECATED265": DEPRECATED265, + * "DEPRECATED266": DEPRECATED266, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED264); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED264, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":380 + * "DEPRECATED263": DEPRECATED263, + * "DEPRECATED264": DEPRECATED264, + * "DEPRECATED265": DEPRECATED265, # <<<<<<<<<<<<<< + * "DEPRECATED266": DEPRECATED266, + * "DEPRECATED267": DEPRECATED267, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED265); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED265, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":381 + * "DEPRECATED264": DEPRECATED264, + * "DEPRECATED265": DEPRECATED265, + * "DEPRECATED266": DEPRECATED266, # <<<<<<<<<<<<<< + * "DEPRECATED267": DEPRECATED267, + * "DEPRECATED268": DEPRECATED268, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED266); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED266, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":382 + * "DEPRECATED265": DEPRECATED265, + * "DEPRECATED266": DEPRECATED266, + * "DEPRECATED267": DEPRECATED267, # <<<<<<<<<<<<<< + * "DEPRECATED268": DEPRECATED268, + * "DEPRECATED269": DEPRECATED269, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED267); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED267, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":383 + * "DEPRECATED266": DEPRECATED266, + * "DEPRECATED267": DEPRECATED267, + * "DEPRECATED268": DEPRECATED268, # <<<<<<<<<<<<<< + * "DEPRECATED269": DEPRECATED269, + * "DEPRECATED270": DEPRECATED270, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED268); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED268, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":384 + * "DEPRECATED267": DEPRECATED267, + * "DEPRECATED268": DEPRECATED268, + * "DEPRECATED269": DEPRECATED269, # <<<<<<<<<<<<<< + * "DEPRECATED270": DEPRECATED270, + * "DEPRECATED271": DEPRECATED271, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED269); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED269, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":385 + * "DEPRECATED268": DEPRECATED268, + * "DEPRECATED269": DEPRECATED269, + * "DEPRECATED270": DEPRECATED270, # <<<<<<<<<<<<<< + * "DEPRECATED271": DEPRECATED271, + * "DEPRECATED272": DEPRECATED272, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED270); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 385, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED270, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":386 + * "DEPRECATED269": DEPRECATED269, + * "DEPRECATED270": DEPRECATED270, + * "DEPRECATED271": DEPRECATED271, # <<<<<<<<<<<<<< + * "DEPRECATED272": DEPRECATED272, + * "DEPRECATED273": DEPRECATED273, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED271); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED271, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":387 + * "DEPRECATED270": DEPRECATED270, + * "DEPRECATED271": DEPRECATED271, + * "DEPRECATED272": DEPRECATED272, # <<<<<<<<<<<<<< + * "DEPRECATED273": DEPRECATED273, + * "DEPRECATED274": DEPRECATED274, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED272); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED272, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":388 + * "DEPRECATED271": DEPRECATED271, + * "DEPRECATED272": DEPRECATED272, + * "DEPRECATED273": DEPRECATED273, # <<<<<<<<<<<<<< + * "DEPRECATED274": DEPRECATED274, + * "DEPRECATED275": DEPRECATED275, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED273); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED273, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":389 + * "DEPRECATED272": DEPRECATED272, + * "DEPRECATED273": DEPRECATED273, + * "DEPRECATED274": DEPRECATED274, # <<<<<<<<<<<<<< + * "DEPRECATED275": DEPRECATED275, + * "DEPRECATED276": DEPRECATED276, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED274); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED274, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":390 + * "DEPRECATED273": DEPRECATED273, + * "DEPRECATED274": DEPRECATED274, + * "DEPRECATED275": DEPRECATED275, # <<<<<<<<<<<<<< + * "DEPRECATED276": DEPRECATED276, + * +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED275); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED275, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":391 + * "DEPRECATED274": DEPRECATED274, + * "DEPRECATED275": DEPRECATED275, + * "DEPRECATED276": DEPRECATED276, # <<<<<<<<<<<<<< + * + * "PERSON": PERSON, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DEPRECATED276); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DEPRECATED276, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":393 + * "DEPRECATED276": DEPRECATED276, + * + * "PERSON": PERSON, # <<<<<<<<<<<<<< + * "NORP": NORP, + * "FACILITY": FACILITY, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_PERSON); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PERSON, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":394 + * + * "PERSON": PERSON, + * "NORP": NORP, # <<<<<<<<<<<<<< + * "FACILITY": FACILITY, + * "ORG": ORG, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_NORP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 394, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_NORP, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":395 + * "PERSON": PERSON, + * "NORP": NORP, + * "FACILITY": FACILITY, # <<<<<<<<<<<<<< + * "ORG": ORG, + * "GPE": GPE, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_FACILITY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 395, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FACILITY, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":396 + * "NORP": NORP, + * "FACILITY": FACILITY, + * "ORG": ORG, # <<<<<<<<<<<<<< + * "GPE": GPE, + * "LOC": LOC, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_ORG); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ORG, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":397 + * "FACILITY": FACILITY, + * "ORG": ORG, + * "GPE": GPE, # <<<<<<<<<<<<<< + * "LOC": LOC, + * "PRODUCT": PRODUCT, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_GPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 397, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_GPE, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":398 + * "ORG": ORG, + * "GPE": GPE, + * "LOC": LOC, # <<<<<<<<<<<<<< + * "PRODUCT": PRODUCT, + * "EVENT": EVENT, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_LOC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LOC, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":399 + * "GPE": GPE, + * "LOC": LOC, + * "PRODUCT": PRODUCT, # <<<<<<<<<<<<<< + * "EVENT": EVENT, + * "WORK_OF_ART": WORK_OF_ART, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_PRODUCT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PRODUCT, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":400 + * "LOC": LOC, + * "PRODUCT": PRODUCT, + * "EVENT": EVENT, # <<<<<<<<<<<<<< + * "WORK_OF_ART": WORK_OF_ART, + * "LANGUAGE": LANGUAGE, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_EVENT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_EVENT, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":401 + * "PRODUCT": PRODUCT, + * "EVENT": EVENT, + * "WORK_OF_ART": WORK_OF_ART, # <<<<<<<<<<<<<< + * "LANGUAGE": LANGUAGE, + * +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_WORK_OF_ART); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_WORK_OF_ART, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":402 + * "EVENT": EVENT, + * "WORK_OF_ART": WORK_OF_ART, + * "LANGUAGE": LANGUAGE, # <<<<<<<<<<<<<< + * + * "DATE": DATE, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_LANGUAGE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LANGUAGE, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":404 + * "LANGUAGE": LANGUAGE, + * + * "DATE": DATE, # <<<<<<<<<<<<<< + * "TIME": TIME, + * "PERCENT": PERCENT, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_DATE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_DATE, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":405 + * + * "DATE": DATE, + * "TIME": TIME, # <<<<<<<<<<<<<< + * "PERCENT": PERCENT, + * "MONEY": MONEY, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_TIME); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TIME, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":406 + * "DATE": DATE, + * "TIME": TIME, + * "PERCENT": PERCENT, # <<<<<<<<<<<<<< + * "MONEY": MONEY, + * "QUANTITY": QUANTITY, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_PERCENT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PERCENT, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":407 + * "TIME": TIME, + * "PERCENT": PERCENT, + * "MONEY": MONEY, # <<<<<<<<<<<<<< + * "QUANTITY": QUANTITY, + * "ORDINAL": ORDINAL, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_MONEY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_MONEY, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":408 + * "PERCENT": PERCENT, + * "MONEY": MONEY, + * "QUANTITY": QUANTITY, # <<<<<<<<<<<<<< + * "ORDINAL": ORDINAL, + * "CARDINAL": CARDINAL, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_QUANTITY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_QUANTITY, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":409 + * "MONEY": MONEY, + * "QUANTITY": QUANTITY, + * "ORDINAL": ORDINAL, # <<<<<<<<<<<<<< + * "CARDINAL": CARDINAL, + * +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_ORDINAL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ORDINAL, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":410 + * "QUANTITY": QUANTITY, + * "ORDINAL": ORDINAL, + * "CARDINAL": CARDINAL, # <<<<<<<<<<<<<< + * + * "acomp": acomp, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_CARDINAL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_CARDINAL, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":412 + * "CARDINAL": CARDINAL, + * + * "acomp": acomp, # <<<<<<<<<<<<<< + * "advcl": advcl, + * "advmod": advmod, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_acomp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_acomp, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":413 + * + * "acomp": acomp, + * "advcl": advcl, # <<<<<<<<<<<<<< + * "advmod": advmod, + * "agent": agent, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_advcl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_advcl, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":414 + * "acomp": acomp, + * "advcl": advcl, + * "advmod": advmod, # <<<<<<<<<<<<<< + * "agent": agent, + * "amod": amod, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_advmod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_advmod, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":415 + * "advcl": advcl, + * "advmod": advmod, + * "agent": agent, # <<<<<<<<<<<<<< + * "amod": amod, + * "appos": appos, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_agent); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_agent, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":416 + * "advmod": advmod, + * "agent": agent, + * "amod": amod, # <<<<<<<<<<<<<< + * "appos": appos, + * "attr": attr, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_amod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_amod, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":417 + * "agent": agent, + * "amod": amod, + * "appos": appos, # <<<<<<<<<<<<<< + * "attr": attr, + * "aux": aux, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_appos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_appos, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":418 + * "amod": amod, + * "appos": appos, + * "attr": attr, # <<<<<<<<<<<<<< + * "aux": aux, + * "auxpass": auxpass, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_attr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_attr, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":419 + * "appos": appos, + * "attr": attr, + * "aux": aux, # <<<<<<<<<<<<<< + * "auxpass": auxpass, + * "cc": cc, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_aux); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_aux, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":420 + * "attr": attr, + * "aux": aux, + * "auxpass": auxpass, # <<<<<<<<<<<<<< + * "cc": cc, + * "ccomp": ccomp, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_auxpass); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 420, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_auxpass, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":421 + * "aux": aux, + * "auxpass": auxpass, + * "cc": cc, # <<<<<<<<<<<<<< + * "ccomp": ccomp, + * "complm": complm, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_cc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 421, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_cc, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":422 + * "auxpass": auxpass, + * "cc": cc, + * "ccomp": ccomp, # <<<<<<<<<<<<<< + * "complm": complm, + * "conj": conj, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_ccomp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ccomp, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":423 + * "cc": cc, + * "ccomp": ccomp, + * "complm": complm, # <<<<<<<<<<<<<< + * "conj": conj, + * "cop": cop, # U20 +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_complm); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_complm, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":424 + * "ccomp": ccomp, + * "complm": complm, + * "conj": conj, # <<<<<<<<<<<<<< + * "cop": cop, # U20 + * "csubj": csubj, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_conj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_conj, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":425 + * "complm": complm, + * "conj": conj, + * "cop": cop, # U20 # <<<<<<<<<<<<<< + * "csubj": csubj, + * "csubjpass": csubjpass, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_cop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_cop, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":426 + * "conj": conj, + * "cop": cop, # U20 + * "csubj": csubj, # <<<<<<<<<<<<<< + * "csubjpass": csubjpass, + * "dep": dep, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_csubj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_csubj, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":427 + * "cop": cop, # U20 + * "csubj": csubj, + * "csubjpass": csubjpass, # <<<<<<<<<<<<<< + * "dep": dep, + * "det": det, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_csubjpass); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_csubjpass, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":428 + * "csubj": csubj, + * "csubjpass": csubjpass, + * "dep": dep, # <<<<<<<<<<<<<< + * "det": det, + * "dobj": dobj, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_dep); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_dep, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":429 + * "csubjpass": csubjpass, + * "dep": dep, + * "det": det, # <<<<<<<<<<<<<< + * "dobj": dobj, + * "expl": expl, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_det); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_det, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":430 + * "dep": dep, + * "det": det, + * "dobj": dobj, # <<<<<<<<<<<<<< + * "expl": expl, + * "hmod": hmod, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_dobj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_dobj, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":431 + * "det": det, + * "dobj": dobj, + * "expl": expl, # <<<<<<<<<<<<<< + * "hmod": hmod, + * "hyph": hyph, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_expl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_expl, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":432 + * "dobj": dobj, + * "expl": expl, + * "hmod": hmod, # <<<<<<<<<<<<<< + * "hyph": hyph, + * "infmod": infmod, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_hmod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_hmod, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":433 + * "expl": expl, + * "hmod": hmod, + * "hyph": hyph, # <<<<<<<<<<<<<< + * "infmod": infmod, + * "intj": intj, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_hyph); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_hyph, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":434 + * "hmod": hmod, + * "hyph": hyph, + * "infmod": infmod, # <<<<<<<<<<<<<< + * "intj": intj, + * "iobj": iobj, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_infmod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_infmod, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":435 + * "hyph": hyph, + * "infmod": infmod, + * "intj": intj, # <<<<<<<<<<<<<< + * "iobj": iobj, + * "mark": mark, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_intj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 435, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_intj, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":436 + * "infmod": infmod, + * "intj": intj, + * "iobj": iobj, # <<<<<<<<<<<<<< + * "mark": mark, + * "meta": meta, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_iobj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_iobj, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":437 + * "intj": intj, + * "iobj": iobj, + * "mark": mark, # <<<<<<<<<<<<<< + * "meta": meta, + * "neg": neg, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_mark); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_mark, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":438 + * "iobj": iobj, + * "mark": mark, + * "meta": meta, # <<<<<<<<<<<<<< + * "neg": neg, + * "nmod": nmod, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_meta); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_meta, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":439 + * "mark": mark, + * "meta": meta, + * "neg": neg, # <<<<<<<<<<<<<< + * "nmod": nmod, + * "nn": nn, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_neg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_neg, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":440 + * "meta": meta, + * "neg": neg, + * "nmod": nmod, # <<<<<<<<<<<<<< + * "nn": nn, + * "npadvmod": npadvmod, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_nmod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_nmod, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":441 + * "neg": neg, + * "nmod": nmod, + * "nn": nn, # <<<<<<<<<<<<<< + * "npadvmod": npadvmod, + * "nsubj": nsubj, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_nn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_nn, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":442 + * "nmod": nmod, + * "nn": nn, + * "npadvmod": npadvmod, # <<<<<<<<<<<<<< + * "nsubj": nsubj, + * "nsubjpass": nsubjpass, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_npadvmod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_npadvmod, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":443 + * "nn": nn, + * "npadvmod": npadvmod, + * "nsubj": nsubj, # <<<<<<<<<<<<<< + * "nsubjpass": nsubjpass, + * "num": num, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_nsubj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_nsubj, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":444 + * "npadvmod": npadvmod, + * "nsubj": nsubj, + * "nsubjpass": nsubjpass, # <<<<<<<<<<<<<< + * "num": num, + * "number": number, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_nsubjpass); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_nsubjpass, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":445 + * "nsubj": nsubj, + * "nsubjpass": nsubjpass, + * "num": num, # <<<<<<<<<<<<<< + * "number": number, + * "oprd": oprd, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_num); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_num, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":446 + * "nsubjpass": nsubjpass, + * "num": num, + * "number": number, # <<<<<<<<<<<<<< + * "oprd": oprd, + * "obj": obj, # U20 +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_number); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_number, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":447 + * "num": num, + * "number": number, + * "oprd": oprd, # <<<<<<<<<<<<<< + * "obj": obj, # U20 + * "obl": obl, # U20 +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_oprd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_oprd, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":448 + * "number": number, + * "oprd": oprd, + * "obj": obj, # U20 # <<<<<<<<<<<<<< + * "obl": obl, # U20 + * "parataxis": parataxis, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_obj, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":449 + * "oprd": oprd, + * "obj": obj, # U20 + * "obl": obl, # U20 # <<<<<<<<<<<<<< + * "parataxis": parataxis, + * "partmod": partmod, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_obl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_obl, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":450 + * "obj": obj, # U20 + * "obl": obl, # U20 + * "parataxis": parataxis, # <<<<<<<<<<<<<< + * "partmod": partmod, + * "pcomp": pcomp, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_parataxis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 450, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_parataxis, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":451 + * "obl": obl, # U20 + * "parataxis": parataxis, + * "partmod": partmod, # <<<<<<<<<<<<<< + * "pcomp": pcomp, + * "pobj": pobj, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_partmod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_partmod, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":452 + * "parataxis": parataxis, + * "partmod": partmod, + * "pcomp": pcomp, # <<<<<<<<<<<<<< + * "pobj": pobj, + * "poss": poss, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_pcomp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pcomp, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":453 + * "partmod": partmod, + * "pcomp": pcomp, + * "pobj": pobj, # <<<<<<<<<<<<<< + * "poss": poss, + * "possessive": possessive, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_pobj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pobj, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":454 + * "pcomp": pcomp, + * "pobj": pobj, + * "poss": poss, # <<<<<<<<<<<<<< + * "possessive": possessive, + * "preconj": preconj, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_poss); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_poss, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":455 + * "pobj": pobj, + * "poss": poss, + * "possessive": possessive, # <<<<<<<<<<<<<< + * "preconj": preconj, + * "prep": prep, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_possessive); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_possessive, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":456 + * "poss": poss, + * "possessive": possessive, + * "preconj": preconj, # <<<<<<<<<<<<<< + * "prep": prep, + * "prt": prt, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_preconj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_preconj, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":457 + * "possessive": possessive, + * "preconj": preconj, + * "prep": prep, # <<<<<<<<<<<<<< + * "prt": prt, + * "punct": punct, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_prep); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_prep, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":458 + * "preconj": preconj, + * "prep": prep, + * "prt": prt, # <<<<<<<<<<<<<< + * "punct": punct, + * "quantmod": quantmod, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_prt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_prt, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":459 + * "prep": prep, + * "prt": prt, + * "punct": punct, # <<<<<<<<<<<<<< + * "quantmod": quantmod, + * "rcmod": rcmod, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_punct); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 459, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_punct, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":460 + * "prt": prt, + * "punct": punct, + * "quantmod": quantmod, # <<<<<<<<<<<<<< + * "rcmod": rcmod, + * "relcl": relcl, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_quantmod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 460, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_quantmod, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":461 + * "punct": punct, + * "quantmod": quantmod, + * "rcmod": rcmod, # <<<<<<<<<<<<<< + * "relcl": relcl, + * "root": root, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_rcmod); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_rcmod, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":462 + * "quantmod": quantmod, + * "rcmod": rcmod, + * "relcl": relcl, # <<<<<<<<<<<<<< + * "root": root, + * "xcomp": xcomp, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_relcl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_relcl, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":463 + * "rcmod": rcmod, + * "relcl": relcl, + * "root": root, # <<<<<<<<<<<<<< + * "xcomp": xcomp, + * +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_root); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_root, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":464 + * "relcl": relcl, + * "root": root, + * "xcomp": xcomp, # <<<<<<<<<<<<<< + * + * "acl": acl, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_xcomp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_xcomp, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":466 + * "xcomp": xcomp, + * + * "acl": acl, # <<<<<<<<<<<<<< + * "LAW": LAW, + * "MORPH": MORPH, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_acl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_acl, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":467 + * + * "acl": acl, + * "LAW": LAW, # <<<<<<<<<<<<<< + * "MORPH": MORPH, + * "_": _, +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_LAW); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LAW, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":468 + * "acl": acl, + * "LAW": LAW, + * "MORPH": MORPH, # <<<<<<<<<<<<<< + * "_": _, + * } +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols_MORPH); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 468, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_MORPH, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/symbols.pyx":469 + * "LAW": LAW, + * "MORPH": MORPH, + * "_": _, # <<<<<<<<<<<<<< + * } + * +*/ + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(__pyx_e_5spacy_7symbols__); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 469, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u__2, __pyx_t_3) < (0)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_IDS, __pyx_t_2) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/symbols.pyx":473 + * + * + * def sort_nums(x): # <<<<<<<<<<<<<< + * return x[1] + * +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7symbols_1sort_nums, 0, __pyx_mstate_global->__pyx_n_u_sort_nums, NULL, __pyx_mstate_global->__pyx_n_u_spacy_symbols, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_sort_nums, __pyx_t_2) < (0)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/symbols.pyx":477 + * + * + * NAMES = [it[0] for it in sorted(IDS.items(), key=sort_nums)] # <<<<<<<<<<<<<< + * # Unfortunate hack here, to work around problem with long cpdef enum + * # (which is generating an enormous amount of C++ in Cython 0.24+) +*/ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + __pyx_t_6 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_IDS); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_items); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_sort_nums); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_key, __pyx_t_8, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 477, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_builtin_sorted, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6); + __pyx_t_10 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 477, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_6))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 477, __pyx_L1_error) + #endif + if (__pyx_t_10 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_10; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 477, __pyx_L1_error) + #endif + if (__pyx_t_10 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_10); + #endif + ++__pyx_t_10; + } + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error) + } else { + __pyx_t_3 = __pyx_t_11(__pyx_t_6); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 477, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_it, __pyx_t_3) < (0)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_it); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NAMES, __pyx_t_2) < (0)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/symbols.pyx":481 + * # (which is generating an enormous amount of C++ in Cython 0.24+) + * # We keep the enum cdef, and just make sure the names are available to Python + * locals().update(IDS) # <<<<<<<<<<<<<< + * +*/ + __pyx_t_8 = __Pyx_Globals(); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_IDS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/symbols.pyx":1 + * # cython: optimize.unpack_method_calls=False # <<<<<<<<<<<<<< + * # cython: profile=False + * IDS = { +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.symbols", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init spacy.symbols"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #else + return __pyx_m; + #endif +} +/* #### Code section: pystring_table ### */ +/* #### Code section: cached_builtins ### */ + +static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_sorted); if (!__pyx_builtin_sorted) __PYX_ERR(0, 477, __pyx_L1_error) + + /* Cached unbound methods */ + __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cached_constants ### */ + +static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + __Pyx_RefNannyFinishContext(); + return 0; +} +/* #### Code section: init_constants ### */ + +static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + { + const struct { const unsigned int length: 5; } index[] = {{0},{1},{17},{3},{3},{3},{3},{8},{5},{7},{4},{4},{3},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{13},{3},{6},{7},{9},{8},{3},{5},{8},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{6},{3},{4},{2},{3},{3},{4},{8},{8},{10},{11},{8},{13},{8},{17},{8},{8},{14},{8},{7},{8},{8},{4},{8},{3},{5},{6},{10},{8},{8},{3},{5},{5},{5},{5},{4},{4},{4},{3},{7},{3},{4},{4},{7},{6},{3},{6},{4},{7},{4},{5},{5},{20},{8},{5},{10},{5},{5},{5},{6},{3},{3},{4},{4},{11},{1},{1},{3},{5},{5},{6},{5},{4},{5},{18},{4},{3},{7},{2},{5},{18},{6},{4},{3},{5},{9},{3},{3},{4},{4},{8},{4},{4},{6},{4},{4},{13},{2},{5},{3},{8},{4},{4},{10},{8},{3},{4},{2},{8},{5},{9},{3},{6},{3},{3},{4},{9},{7},{5},{4},{3},{4},{10},{7},{4},{3},{5},{12},{8},{5},{5},{4},{12},{10},{9},{6},{13},{8},{6},{6},{1},{5},{11}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1125 bytes) */ +const char* const cstring = "BZh91AY&SY\007\340fm\000\001\320_\302d\010\000\001\377\340\277\377\377\340\277\377\377`@@\000@P\005\\9\004\036\201H\003\240\210\221\351=F\246\236\246\236S\320A\240\000\r\000\000\001\241\314&\0010\002a0\232`\000\0012i\240b\2314\221\377\352\252MF\211\210\033\365G\352\237\251 z#\324\003@0\032\204J\223\377\375UT\377\325=?R\244\032\000h\000\000\000h\000\000i\242\000\231\r\022aMM\250\332\2154\017M \301\0314\317Ry<\377\317\366\357\247\343\373]\\Ur\3708\325\212\340\025\212\n\305\005b\202\261AX\240\254PV(+\0247\267\271\234\336w?\241\321\351I$\222I$\222Iwwz\254V\333eX\240\254PV(+\024\025\212\n\305\005b\202\261AX\241\330\033m\266\323\177~I$\222\0003\234\347=\274\355{\034y\325\257j\252\252\265\355UUV\275\252\252\252\327\265UUZ\366\252\252\253^\325UU{\325Uc\030\3061\214c\030\016\\\371\204\222I$\222Iwwy\316\355\000\000\000\000\000\316s\235\265\251$\222I$\222I.\356\3579\335\240\000\000\000\000\031\316s\266\265$\222I$\222I%\335\336sz\000\000\000\000\001\273v\355\266\326\244\222I$\222I$\273\273\316o@\0061\214bffffffffgM4\343\307\227 \000\0039\316xp\314\314\314\314\314\314\314\314\314\314\314DDD\3479\341\300\000\000UUi\244DDDDDDDDDFs\234\350\000\000\025UZi\021\021\021\021\021\021\021\021\021\021\234\347:\000\000\006s\234\347\257\256\333\372'\253\267\354\307\335{^\366\354\354\364\365\375\363\033\306\226\323>\216\231v\370\010i\341\352\302\004\010\000\217\354\363\342D\266\311\357\302`\344e@\020^\326\267\037\312\323\362k\256\272\353\344\337}\367\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000w\271t\367q\340\267MZ\274S>\177,\020 @\007\224\"\004\000l\274\325\271\267~K\003\345|;\274~\305\320\204@\200\010V\037\234\304uCM\3723\266/\307\315\321\365~\233m\266\333m\266\333\356\000\000\000\000s\337{^\367\266\366\360y:f\243\350\327\217\213\021\266\326\361\333NS\257=o<\317\035\363\357|\241\320\212InM\315\332\307\310!\240cl\362J\305\002 3\245\243>\346\333\315\177\267!V\204\354\246\261h\367:Ap""\034(\300>\261R\250\334'\263\201\204$\2412\301l\256Y\363\272U\357\321_\035(\307[f\331\304U6\327\377b\276Ij\334\"\004\000Y`\3656Ux\n\031\226\t\364:\363\276\361\255TMhe\247$D\354\332\301\020 \002Sm\270d].I\224\003F,\365\016yrs\344\242\023\364kG\216\000Y\365\022\347\234\363\021F\343\273\364\034\004\345v\rV\324\247\234\302\024!\203r\363\263\211\364M\221\210&\014\307\333\361\361\375>^\327\344I\360^\345\230w\305Q\344\224\021+\364\376\333/\232\023\360\371\365\372\321(\317\204\010\026\253\227\363n\311g/e\t$\020\243|\210\246\314E\357\235\235\325\327\245\266\307\373\006\353j\r\003\361\242\260\ruJ\2224\t2\024\353\331\241p\016\177\247\026FP;\023o\264\361\327\2265\202\"X\260Q}\301c\341\370\241\2649\302\271\342\3448\240Y;|\330Gel\344\334C\335\220^\321\253\223gv6\336M\035\250\312\271 \316\235\007\312\360ve\354R#\247\033\003\306\260\327\247\0328G\217\031\304 \3421\202\202\006\030QP\311\243\303\tgV\345\220{\243\215v\214+#2\330\234\211\203\367\355\216\341\244m\000KKZ\000\316a\273\237\222L\032\032\032u\223TNk&m\260J\365\316:\300Fq\334\316*\032\271\273p\320y/\323X\375E\000l:I\323y\334<^6#\260f\242l\201*\r\"&\260\223\265?I\247\376.\344\212p\241 \017\300\314\332"; + PyObject *data = __Pyx_DecompressString(cstring, 1125, 2); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1438 bytes) */ +const char* const cstring = "x\332M\330\317r\233V\024\200\361\351Lw}\227\324\347\360G\322\252\203%,\023# \010%\366\212\301\010'r$\240\002y\354]\227y\304>N/7I\363%\326\345^Y\307|J<\277\205\376\032\372\252~\373sx;=v\307\341]\377\366\032\254\336\007\253,X}\014v\367\313 _EI\020/\227i\362~\031\357\266E\230O\333UP\204\25303_y\270\234\366WW\302\203\362\340\360\340\362\340\361\340\3630\343a\316\303\002\007\271\342\201\005\302\002a\201\260@X ,\020\026\010\013\204\005\312\002e\201\262@Y\240,P\026(\013\224\005\312\002e\201\303\002\207\005\016\013\034\0268,pX\340\260\300a\201\303\002\207\005.\013\\\026\270,pY\340\262\300e\201\313\002\227\005.\013\\\026x,\360X\340\261\300c\201\307\002\217\005\036\013<\026x,\360X\340\263\300g\201\317\002\237\005>\013|\026\370,\360Y\340\263\300g\301\214\0053\026\314X0c\301\214\0053\026\314X0c\301\214\0053\026\314Y0g\301\234\005s\026\314Y0g\301\234\005s\026\314Y0g\301\202\005\013\026,X\260`\301\202\005\013\026,X\260`\301\202\005\013\024\310\325\025\017\302\203\362\340\360\340\362\340\361\340\3630\343a\316\003\013h\242\320D\241\211B\023\205&\nM\024\232(4Qh\242\320D\241\211B\023\205&\nM\024\232(4Qh\242\320D\241\211B\023\205&\nM\024\232(4Qh\242\320D\241\211B\023\205&\nM\024\232(4Qh\242\320D\241\211B\023\205&\nM\024\232(4Qh\242\320D\241\211B\023\205&\nM\024\232(4Qh\242\320D\241\211B\023\205&\nM\024\232(4Qh\242\320D\241\211B\023\205&\nM\024\232(4Qh\242\320D\241\211B\023\205&\nM\024\232(4Qh\242\320D\241\211B\023\205&\nM\024\232(4Qh\242\320D\241\211B\023\205&\nM\024\232(4Qh\242\320D\245\211J\023\225&*MT\232\2504Qi\242\322D\245\211J\023\225&*MT\232\2504Qi\242\322D\245\211J\023\225&*MT\232\2504Qi\242\322D\245\211J\023\225&*MT\232\2504Qi\242\322D\245\211J\023\225&*MT\232\2504Qi\242\322D\245\211J\023\225&*MT\232\2504Qi\242\322D\245\211J\023\225&*MT\232\2504Qi\242\322D\245\211J\023\225&*MT\232\2504Qi\242\322D\245\211J\023\225&*MT\232\2504Qi\242\322D\245\211J\023\225&*M\324\311\304\"L\2122Z\3315\275\236.w\327?\316\305C\026\206i\034~4\207\233`\031\305Q\361p\023\007kYL\253^\331U\354\252vu""\354\352\332\325\263\253o\327\231]\347v\265\263\216\235u\354\254cg\035;\353\330Y\307\316:v\326\261\263\216\235u\354\254kg];\353\332Y\327\316\272v\326\265\263\256\235u\355\254kg];\353\331Y\317\316zv\326\263\263\236\235\365\354\254gg=;\353\331Y\317\316\372v\326\267\263\276\235\365\235u\026\336\206\301*2\177\267\321\352>J\212\367\321\266\014\342\3546\230\256\333e\024\231\353u\036,\357\302\302\354\226\273<\017\223\345\203\331\256\242u4=\025\2077E\231\355\222\245=\244\237\302\334\\\323\364c\371\353\377\311<\361\363\005\037vi\021\232k\036\255o\177\215m\263`9=\273-\322\314\\\212\250\210\247\343.\313\302<\016\222\365\364\330\005\3530\016>\305\341f\023\304a\262.n\343\350.,\303M\020\305v\227\3546\366\272\313\3438]\332\222M\232\204\017\2334\317n\223`\023n\2234\337\230G\226\244\273\304\274:\375\376\351B\232\257\323\274\270\315\202\2740\267[\232\337\025s\331\246I\226n\315\033\270\211\356\263<\2756\217\325nY\230Kb\036Yb\313\3132{{5\217\325\241\036\313\244y\035\363\346\351\303.HL\377\303v\372\240b;\375\026n\013\363\223\267\267A\026\332\2679-\017\333\335\215\371\301\333\207M\021\254\213hc~C\363\353Oi~W\2467\245y\365}Y\325\307\252\356N}\265\1771\273\375\313\251\333W\237\233v\254\246M\337wC5\274\265\365\241{Ww\347\3562\036\332f\250\306\361\\]^\315W_\rCm\376\230\371\372h\276U\036\332\322|\257n\036\253\372\353\364\354\361Tw\355s\335\365\365py|\266\3134\263o\372}3\356\273\307\347\346\265?\226\345\323\245\255\313\362\213\271\345\227\267\376\313\241}2\273C;>\037\314+\312\303P\376\177\357\303x\030\233\323\360\265y+\313Se\356f\326\363\327S3Vf\327\355/\307\2464\177\332\352d\256m\363\2715\317\265m\333\177\177_\355t\373\366gC{9\231\257\307\346l\356\321=\036\273\376\274\357\253s5V\257\207\301lF3\320Oo\2417\337\357\273\351_b\230\036\3150\034^\232\376\334Lo\314\\\372\376<\366&\177,\313\277/\325\361\373\255\315\256\235~\300\271\236\226\346X\037\317]g^14\343\2178\263\3337O\325\3458\016\335\331__pyx_string_tab; + Py_ssize_t pos = 0; + for (int i = 0; i < 483; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 3) PyUnicode_InternInPlace(&string); + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + stringtab[i] = string; + pos += bytes_length; + } + for (int i = 483; i < 484; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); + stringtab[i] = string; + pos += bytes_length; + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + Py_XDECREF(data); + for (Py_ssize_t i = 0; i < 484; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 483; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + } + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_codeobjects ### */ +typedef struct { + unsigned int argcount : 1; + unsigned int num_posonly_args : 1; + unsigned int num_kwonly_args : 1; + unsigned int nlocals : 1; + unsigned int flags : 10; + unsigned int first_line : 9; +} __Pyx_PyCode_New_function_description; +/* NewCodeObj.proto */ +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +); + + +static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { + PyObject* tuple_dedup_map = PyDict_New(); + if (unlikely(!tuple_dedup_map)) return -1; + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 473}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_x}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_symbols_pyx, __pyx_mstate->__pyx_n_u_sort_nums, __pyx_mstate->__pyx_kp_b_iso88591_1AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + Py_DECREF(tuple_dedup_map); + return 0; + bad: + Py_DECREF(tuple_dedup_map); + return -1; +} +/* #### Code section: init_globals ### */ + +static int __Pyx_InitGlobals(void) { + /* PythonCompatibility.init */ + if (likely(__Pyx_init_co_variables() == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CommonTypesMetaclass.init */ + if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CachedMethodType.init */ + #if CYTHON_COMPILING_IN_LIMITED_API + { + PyObject *typesModule=NULL; + typesModule = PyImport_ImportModule("types"); + if (typesModule) { + __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + } + } // error handling follows + #endif + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CythonFunctionShared.init */ + if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, + "name '%U' is not defined", name); + } + return result; +} + +/* TupleAndListFromArray (used by fastcall) */ +#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + Py_ssize_t i; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + for (i = 0; i < n; i++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + return res; +} +#elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\ + !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + return PyObject_RichCompareBool(s1, s2, equals); +#else + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length, length2; + int kind; + void *data1, *data2; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + #endif + length = __Pyx_PyUnicode_GET_LENGTH(s1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length < 0)) return -1; + #endif + length2 = __Pyx_PyUnicode_GET_LENGTH(s2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length2 < 0)) return -1; + #endif + if (length != length2) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + return (equals == Py_EQ); +return_ne: + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(n == -1)) return NULL; + #endif + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + if (s == namei) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; + return kwvalues[i]; + } + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { + Py_ssize_t i, nkwargs; + PyObject *dict; +#if !CYTHON_ASSUME_SAFE_SIZE + nkwargs = PyTuple_Size(kwnames); + if (unlikely(nkwargs < 0)) return NULL; +#else + nkwargs = PyTuple_GET_SIZE(kwnames); +#endif + dict = PyDict_New(); + if (unlikely(!dict)) + return NULL; + for (i=0; itp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall (used by PyObjectCallOneArg) */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API + #if PY_VERSION_HEX < 0x03090000 + #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) + #elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { + PyTypeObject *tp = Py_TYPE(callable); + #if defined(__Pyx_CyFunction_USED) + if (__Pyx_CyFunction_CheckExact(callable)) { + return __Pyx_CyFunction_func_vectorcall(callable); + } + #endif + if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { + return NULL; + } + assert(PyCallable_Check(callable)); + Py_ssize_t offset = tp->tp_vectorcall_offset; + assert(offset > 0); + vectorcallfunc ptr; + memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); + return ptr; +} + #else + #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) + #endif +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if CYTHON_COMPILING_IN_LIMITED_API + return PyObject_Vectorcall(func, args, _nargs, NULL); + #else + vectorcallfunc f = __Pyx_PyVectorcall_Function(func); + if (f) { + return f(func, args, _nargs, NULL); + } + #endif + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* PyObjectCallOneArg (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + PyObject *result; + PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + if (unlikely(!selfless_args)) return NULL; + result = PyObject_Call(method, selfless_args, kwargs); + Py_DECREF(selfless_args); + return result; +} +#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { + return _PyObject_Vectorcall + (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames); +} +#else +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { + return +#if PY_VERSION_HEX < 0x03090000 + _PyObject_Vectorcall +#else + PyObject_Vectorcall +#endif + (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames); +} +#endif +static PyMethodDef __Pyx_UnboundCMethod_Def = { + "CythonUnboundCMethod", + __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 + METH_VARARGS | METH_KEYWORDS, +#else + METH_FASTCALL | METH_KEYWORDS, +#endif + NULL +}; +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method, *result=NULL; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + result = method; +#if CYTHON_COMPILING_IN_CPYTHON + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } else +#endif +#if CYTHON_COMPILING_IN_PYPY +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); +#endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); +#endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + result = unbound_method; + } + } +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + if (unlikely(target->method)) { + Py_DECREF(result); + } else +#endif + target->method = result; + return 0; +} + +/* CallUnboundCMethod0 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + if (likely(cfunc->flag == METH_NOARGS)) + return __Pyx_CallCFunction(cfunc, self, NULL); + if (likely(cfunc->flag == METH_FASTCALL)) + return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0); + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL); + if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS))) + return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (cfunc->flag == METH_VARARGS) + return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple); + return __Pyx__CallUnboundCMethod0(cfunc, self); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + PyObject *result; + if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; + result = __Pyx_PyObject_CallOneArg(cfunc->method, self); + return result; +} + +/* py_dict_items (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d); +} + +/* py_dict_values (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d); +} + +/* OwnedDictNext (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) { + PyObject *next = NULL; + if (!*ppos) { + if (pvalue) { + PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p); + if (unlikely(!dictview)) goto bad; + *ppos = PyObject_GetIter(dictview); + Py_DECREF(dictview); + } else { + *ppos = PyObject_GetIter(p); + } + if (unlikely(!*ppos)) goto bad; + } + next = PyIter_Next(*ppos); + if (!next) { + if (PyErr_Occurred()) goto bad; + return 0; + } + if (pkey && pvalue) { + *pkey = __Pyx_PySequence_ITEM(next, 0); + if (unlikely(*pkey)) goto bad; + *pvalue = __Pyx_PySequence_ITEM(next, 1); + if (unlikely(*pvalue)) goto bad; + Py_DECREF(next); + } else if (pkey) { + *pkey = next; + } else { + assert(pvalue); + *pvalue = next; + } + return 1; + bad: + Py_XDECREF(next); +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 + PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef"); +#else + PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef); +#endif + if (pkey) *pkey = NULL; + if (pvalue) *pvalue = NULL; + return 0; +} +#else // !CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) { + int result = PyDict_Next(p, ppos, pkey, pvalue); + if (likely(result == 1)) { + if (pkey) Py_INCREF(*pkey); + if (pvalue) Py_INCREF(*pvalue); + } + return result; +} +#endif + +/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); +} + +/* CallUnboundCMethod2 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, args, 2); + } + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *result = NULL; + PyObject *args = PyTuple_New(2); + if (unlikely(!args)) return NULL; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + return result; + } +#endif + { + PyObject *args[4] = {NULL, self, arg1, arg2}; + return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } +} + +/* ParseKeywordsImpl (used by ParseKeywords) */ +static int __Pyx_ValidateDuplicatePosArgs( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char* function_name) +{ + PyObject ** const *name = argnames; + while (name != first_kw_arg) { + PyObject *key = **name; + int found = PyDict_Contains(kwds, key); + if (unlikely(found)) { + if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; + } + name++; + } + return 0; +bad: + return -1; +} +#if CYTHON_USE_UNICODE_INTERNALS +static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) { + int kind; + Py_ssize_t len = PyUnicode_GET_LENGTH(s1); + if (len != PyUnicode_GET_LENGTH(s2)) return 0; + kind = PyUnicode_KIND(s1); + if (kind != PyUnicode_KIND(s2)) return 0; + const void *data1 = PyUnicode_DATA(s1); + const void *data2 = PyUnicode_DATA(s2); + return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0); +} +#endif +static int __Pyx_MatchKeywordArg_str( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + #if CYTHON_USE_UNICODE_INTERNALS + Py_hash_t key_hash = ((PyASCIIObject*)key)->hash; + if (unlikely(key_hash == -1)) { + key_hash = PyObject_Hash(key); + if (unlikely(key_hash == -1)) + goto bad; + } + #endif + name = first_kw_arg; + while (*name) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) { + *index_found = (size_t) (name - argnames); + return 1; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + *index_found = (size_t) (name - argnames); + return 1; + } + } + #endif + name++; + } + name = argnames; + while (name != first_kw_arg) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) { + if (__Pyx_UnicodeKeywordsEqual(name_str, key)) + goto arg_passed_twice; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + if (unlikely(name_str == key)) goto arg_passed_twice; + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + } + #endif + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +bad: + return -1; +} +static int __Pyx_MatchKeywordArg_nostr( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; + name = first_kw_arg; + while (*name) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (cmp == 1) { + *index_found = (size_t) (name - argnames); + return 1; + } + if (unlikely(cmp == -1)) goto bad; + name++; + } + name = argnames; + while (name != first_kw_arg) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (unlikely(cmp != 0)) { + if (cmp == 1) goto arg_passed_twice; + else goto bad; + } + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +bad: + return -1; +} +static CYTHON_INLINE int __Pyx_MatchKeywordArg( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + return likely(PyUnicode_CheckExact(key)) ? + __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) : + __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name); +} +static void __Pyx_RejectUnknownKeyword( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char *function_name) +{ + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; + #else + Py_ssize_t pos = 0; + #endif + PyObject *key = NULL; + __Pyx_BEGIN_CRITICAL_SECTION(kwds); + while ( + #if CYTHON_AVOID_BORROWED_REFS + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL) + #else + PyDict_Next(kwds, &pos, &key, NULL) + #endif + ) { + PyObject** const *name = first_kw_arg; + while (*name && (**name != key)) name++; + if (!*name) { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp != 1) { + if (cmp == 0) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + break; + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + } + __Pyx_END_CRITICAL_SECTION(); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); + #endif + assert(PyErr_Occurred()); +} +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t extracted = 0; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + name = first_kw_arg; + while (*name && num_kwargs > extracted) { + PyObject * key = **name; + PyObject *value; + int found = 0; + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + found = PyDict_GetItemRef(kwds, key, &value); + #else + value = PyDict_GetItemWithError(kwds, key); + if (value) { + Py_INCREF(value); + found = 1; + } else { + if (unlikely(PyErr_Occurred())) goto bad; + } + #endif + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + extracted++; + } + name++; + } + if (num_kwargs > extracted) { + if (ignore_unknown_kwargs) { + if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1)) + goto bad; + } else { + __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name); + goto bad; + } + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t len; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + if (PyDict_Update(kwds2, kwds) < 0) goto bad; + name = first_kw_arg; + while (*name) { + PyObject *key = **name; + PyObject *value; +#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)) + int found = PyDict_Pop(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int found = PyDict_GetItemRef(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad; + } +#else + #if CYTHON_COMPILING_IN_CPYTHON + value = _PyDict_Pop(kwds2, key, kwds2); + #else + value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2); + #endif + if (value == kwds2) { + Py_DECREF(value); + } else { + if (unlikely(!value)) goto bad; + values[name-argnames] = value; + } +#endif + name++; + } + len = PyDict_Size(kwds2); + if (len > 0) { + return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name); + } else if (unlikely(len == -1)) { + goto bad; + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject *key = NULL; + PyObject** const * name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) { +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); +#else + key = __Pyx_PyTuple_GET_ITEM(kwds, pos); +#endif +#if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!key)) goto bad; +#endif + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + PyObject *value = kwvalues[pos]; + values[name-argnames] = __Pyx_NewRef(value); + } else { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp == 1) { + PyObject *value = kwvalues[pos]; + values[index_found] = __Pyx_NewRef(value); + } else { + if (unlikely(cmp == -1)) goto bad; + if (kwds2) { + PyObject *value = kwvalues[pos]; + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else if (!ignore_unknown_kwargs) { + goto invalid_keyword; + } + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + key = NULL; + #endif + } + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + goto bad; +bad: + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(key); + #endif + return -1; +} + +/* ParseKeywords */ +static int __Pyx_ParseKeywords( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) + return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); + else if (kwds2) + return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name); + else + return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); +} + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* dict_setdefault (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + PyObject *args[] = {d, key, default_value}; + value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#elif CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#else + value = PyDict_SetDefault(d, key, default_value); + if (unlikely(!value)) return NULL; + Py_INCREF(value); +#endif + return value; +} + +/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static Py_ssize_t __Pyx_GetTypeDictOffset(void) { + PyObject *tp_dictoffset_o; + Py_ssize_t tp_dictoffset; + tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__"); + if (unlikely(!tp_dictoffset_o)) return -1; + tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o); + Py_DECREF(tp_dictoffset_o); + if (unlikely(tp_dictoffset == 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' doesn't have a dictoffset"); + return -1; + } else if (unlikely(tp_dictoffset < 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' has an unexpected negative dictoffset. " + "Please report this as Cython bug"); + return -1; + } + return tp_dictoffset; +} +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) { + static Py_ssize_t tp_dictoffset = 0; + if (unlikely(tp_dictoffset == 0)) { + tp_dictoffset = __Pyx_GetTypeDictOffset(); + if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) { + tp_dictoffset = 0; // try again next time? + return NULL; + } + } + return *(PyObject**)((char*)tp + tp_dictoffset); +} +#endif + +/* SetItemOnTypeDict (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) { + int result; + PyObject *tp_dict; +#if CYTHON_COMPILING_IN_LIMITED_API + tp_dict = __Pyx_GetTypeDict(tp); + if (unlikely(!tp_dict)) return -1; +#else + tp_dict = tp->tp_dict; +#endif + result = PyDict_SetItem(tp_dict, k, v); + if (likely(!result)) { + PyType_Modified(tp); + if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) { + PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL); + if (!setNameResult) return -1; + Py_DECREF(setNameResult); + } + } + return result; +} + +/* FixUpExtensionType (used by FetchCommonType) */ +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if __PYX_LIMITED_VERSION_HEX > 0x030900B1 + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#else + const PyType_Slot *slot = spec->slots; + int changed = 0; +#if !CYTHON_COMPILING_IN_LIMITED_API + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { +#if !CYTHON_COMPILING_IN_CPYTHON + const +#endif // !CYTHON_COMPILING_IN_CPYTHON) + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_vectorcall_offset = memb->offset; + changed = 1; + } +#endif // CYTHON_METH_FASTCALL +#if !CYTHON_COMPILING_IN_PYPY + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } +#endif // !CYTHON_COMPILING_IN_PYPY + } + memb++; + } + } +#endif // !CYTHON_COMPILING_IN_LIMITED_API +#if !CYTHON_COMPILING_IN_PYPY + slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_getset) + slot++; + if (slot && slot->slot == Py_tp_getset) { + PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc; + while (getset && getset->name) { + if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) { + PyObject *descr = PyDescr_NewGetSet(type, getset); + if (unlikely(!descr)) + return -1; + #if CYTHON_COMPILING_IN_LIMITED_API + PyObject *pyname = PyUnicode_FromString(getset->name); + if (unlikely(!pyname)) { + Py_DECREF(descr); + return -1; + } + int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr); + Py_DECREF(pyname); + #else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + #endif + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } + ++getset; + } + } +#else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#endif // !CYTHON_COMPILING_IN_PYPY + if (changed) + PyType_Modified(type); +#endif // PY_VERSION_HEX > 0x030900B1 + return 0; +} + +/* AddModuleRef (used by FetchSharedCythonModule) */ +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { + PyObject *module_dict = PyImport_GetModuleDict(); + PyObject *m; + if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { + return NULL; + } + if (m != NULL && PyModule_Check(m)) { + return m; + } + Py_XDECREF(m); + m = PyModule_NewObject(name); + if (m == NULL) + return NULL; + if (PyDict_CheckExact(module_dict)) { + PyObject *new_m; + (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); + Py_DECREF(m); + return new_m; + } else { + if (PyObject_SetItem(module_dict, name, m) != 0) { + Py_DECREF(m); + return NULL; + } + return m; + } + } + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *py_name = PyUnicode_FromString(name); + if (!py_name) return NULL; + PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); + Py_DECREF(py_name); + return module; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } +#endif + +/* FetchSharedCythonModule (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME); +} + +/* FetchCommonType (used by CommonTypesMetaclass) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases); + if (result && metaclass) { + PyObject *old_tp = (PyObject*)Py_TYPE(result); + Py_INCREF((PyObject*)metaclass); +#if __PYX_LIMITED_VERSION_HEX >= 0x03090000 + Py_SET_TYPE(result, metaclass); +#else + result->ob_type = metaclass; +#endif + Py_DECREF(old_tp); + } + return result; +} +#else +#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b) +#endif +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t expected_basicsize) { + Py_ssize_t basicsize; + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (expected_basicsize == 0) { + return 0; // size is inherited, nothing useful to check + } +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) return -1; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = NULL; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; +#else + basicsize = ((PyTypeObject*) cached_type)->tp_basicsize; +#endif + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name; + int get_item_ref_result; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + py_object_name = PyUnicode_FromString(object_name); + if (!py_object_name) return NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) goto done; + abi_module_dict = PyModule_GetDict(abi_module); + if (!abi_module_dict) goto done; + get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type); + if (get_item_ref_result == 1) { + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else if (unlikely(get_item_ref_result == -1)) { + goto bad; + } + cached_type = __Pyx_PyType_FromMetaclass( + metaclass, + CYTHON_USE_MODULE_STATE ? module : abi_module, + spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type); + if (unlikely(new_cached_type != cached_type)) { + if (unlikely(!new_cached_type)) goto bad; + Py_DECREF(cached_type); + cached_type = new_cached_type; + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else { + Py_DECREF(new_cached_type); + } +done: + Py_XDECREF(abi_module); + Py_DECREF(py_object_name); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +/* CommonTypesMetaclass (used by CythonFunctionShared) */ +static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) { + return PyUnicode_FromString(__PYX_ABI_MODULE_NAME); +} +#if __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) { + PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types"); + return NULL; +} +static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) { + PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable"); + return -1; +} +#endif +static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = { + {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = { + {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset}, + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr}, + #endif + {0, 0} +}; +static PyType_Spec __pyx_CommonTypesMetaclass_spec = { + __PYX_TYPE_MODULE_PREFIX "_common_types_metatype", + 0, + 0, + Py_TPFLAGS_IMMUTABLETYPE | + Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT, + __pyx_CommonTypesMetaclass_slots +}; +static int __pyx_CommonTypesMetaclass_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + PyObject *bases = PyTuple_Pack(1, &PyType_Type); + if (unlikely(!bases)) { + return -1; + } + mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases); + Py_DECREF(bases); + if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) { + return -1; + } + return 0; +} + +/* CallTypeTraverse (used by CythonFunctionShared) */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) { + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000 + if (__Pyx_get_runtime_version() < 0x03090000) return 0; + #endif + if (!always_call) { + PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*); + unsigned long flags = PyType_GetFlags(base); + if (flags & Py_TPFLAGS_HEAPTYPE) { + return 0; + } + } + Py_VISIT((PyObject*)Py_TYPE(o)); + return 0; +} +#endif + +/* PyMethodNew (used by CythonFunctionShared) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *result; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + { + PyObject *args[] = {func, self}; + result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL); + } + #else + result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL); + #endif + return result; +} +#else +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#endif + +/* PyVectorcallFastCallDict (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i; + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos; + #else + Py_ssize_t pos; + #endif + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + #if !CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t nkw = PyDict_Size(kw); + if (unlikely(nkw == -1)) return NULL; + #else + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + #endif + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = 0; + i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) { + keys_are_strings &= + #if CYTHON_COMPILING_IN_LIMITED_API + PyType_GetFlags(Py_TYPE(key)); + #else + Py_TYPE(key)->tp_flags; + #endif + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup; + #else + PyTuple_SET_ITEM(kwnames, i, key); + #endif + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(pos); + #endif + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + Py_ssize_t kw_size = + likely(kw == NULL) ? + 0 : +#if !CYTHON_ASSUME_SAFE_SIZE + PyDict_Size(kw); +#else + PyDict_GET_SIZE(kw); +#endif + if (kw_size == 0) { + return vc(func, args, nargs, NULL); + } +#if !CYTHON_ASSUME_SAFE_SIZE + else if (unlikely(kw_size == -1)) { + return NULL; + } +#endif + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif + +/* CythonFunctionShared (used by CythonFunction) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) { + if (__Pyx_CyFunction_Check(func)) { + return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; + } else if (PyCFunction_Check(func)) { + return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; + } + return 0; +} +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) { + int result; + PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func); + if (unlikely(!newFunc)) { + PyErr_Clear(); // It's only an optimization, so don't throw an error + return 0; + } + result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc); + Py_DECREF(newFunc); + return result; + } + return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc); +} +#else +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if (PyMethod_Check(func)) { + func = PyMethod_GET_FUNCTION(func); + } + return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +} +#endif +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + PyObject *result; + CYTHON_UNUSED_VAR(closure); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_doc_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#else + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_name_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_name, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + PyObject *result; + __Pyx_BEGIN_CRITICAL_SECTION(op); + Py_INCREF(op->func_qualname); + result = op->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +#endif +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_defaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_kwdefaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_annotations_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) { + int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; + if (is_coroutine) { + PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(is_coroutine_value)) { + return is_coroutine_value; + } +ignore: + PyErr_Clear(); + } + return __Pyx_PyBool_FromLong(is_coroutine); +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + result = __Pyx_CyFunction_get_is_coroutine_value(op); + if (unlikely(!result)) + return NULL; + __Pyx_BEGIN_CRITICAL_SECTION(op); + if (op->func_is_coroutine) { + Py_DECREF(result); + result = __Pyx_NewRef(op->func_is_coroutine); + } else { + op->func_is_coroutine = __Pyx_NewRef(result); + } + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, message, size); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + name, message, size); +#endif +} +static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s", + py_name, message); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s", + name, message); +#endif +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, +#else + {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, +#endif + {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#endif +#if CYTHON_METH_FASTCALL +#if CYTHON_COMPILING_IN_LIMITED_API + {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else + {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(args); + __Pyx_BEGIN_CRITICAL_SECTION(m); + Py_INCREF(m->func_qualname); + result = m->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + op->func_dict = NULL; +#endif + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func_dict); +#elif PY_VERSION_HEX < 0x030d0000 + _PyObject_ClearManagedDict((PyObject*)m); +#else + PyObject_ClearManagedDict((PyObject*)m); +#endif + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + Py_CLEAR(m->defaults); + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + { + int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg); + if (e) return e; + } + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func_dict); +#else + { + int e = +#if PY_VERSION_HEX < 0x030d0000 + _PyObject_VisitManagedDict +#else + PyObject_VisitManagedDict +#endif + ((PyObject*)m, visit, arg); + if (e != 0) return e; + } +#endif + __Pyx_VISIT_CONST(m->func_name); + __Pyx_VISIT_CONST(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + __Pyx_VISIT_CONST(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + Py_VISIT(m->defaults); + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ + PyObject *repr; + __Pyx_BEGIN_CRITICAL_SECTION(op); + repr = PyUnicode_FromFormat("", + op->func_qualname, (void *)op); + __Pyx_END_CRITICAL_SECTION(); + return repr; +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes no arguments", size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes exactly one argument", size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } + __Pyx_CyFunction_raise_type_error( + (__pyx_CyFunctionObject*)func, "takes no keyword arguments"); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_SIZE + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(argc < 0)) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "needs an argument"); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "takes no keyword arguments"); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes no arguments", nargs); + return NULL; + } + return meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes exactly one argument", nargs); + return NULL; + } + return meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + #if PY_VERSION_HEX < 0x030e00A6 + size_t nargs_value = (size_t) nargs; + #else + Py_ssize_t nargs_value = nargs; + #endif + return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames); +} +#endif +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if CYTHON_METH_FASTCALL +#if defined(Py_TPFLAGS_HAVE_VECTORCALL) + Py_TPFLAGS_HAVE_VECTORCALL | +#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif +#endif // CYTHON_METH_FASTCALL +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_DICT | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +static int __pyx_CyFunction_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL); + if (unlikely(mstate->__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type); + if (unlikely(!m->defaults)) + return NULL; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* PyDictVersioning (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + if (!PyErr_Occurred()) + PyErr_SetNone(PyExc_NameError); + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } + PyErr_Clear(); +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return result; + } +#else + result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyObjectVectorCallKwBuilder */ +#if CYTHON_VECTORCALL +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_PyObject_FastCallDict; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + args[n] = value; + return 0; +} +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_VectorcallBuilder_AddArgStr; + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); +} +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + PyObject *pyKey = PyUnicode_FromString(key); + if (!pyKey) return -1; + return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); +} +#else // CYTHON_VECTORCALL +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return PyDict_SetItem(builder, key, value); +} +#endif + +/* PyObjectFastCallMethod */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { + PyObject *result; + PyObject *attr = PyObject_GetAttr(args[0], name); + if (unlikely(!attr)) + return NULL; + result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); + Py_DECREF(attr); + return result; +} +#endif + +/* CLineInTraceback (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) +#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); +#else +PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { + PyObject **dict_ptr = _PyObject_GetDictPtr(o); + return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; +} +#endif +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline = NULL; + PyObject *ptype, *pvalue, *ptraceback; + PyObject *cython_runtime_dict; + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, cython_runtime_dict, + __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) + } + if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + Py_XDECREF(use_cline); + Py_XDECREF(cython_runtime_dict); + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache (used by AddTraceback) */ +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { + __Pyx_CachedCodeObjectType* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!code_cache->entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { + return NULL; + } + code_object = code_cache->entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__find_code_object; + return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); + if (old_count < 0) { + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); + return NULL; + } +#endif + __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); +#endif + return result; +#endif +} +static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) +{ + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + code_cache->entries = entries; + code_cache->max_count = 64; + code_cache->count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { + __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_INCREF(code_object); + Py_DECREF(tmp); + return; + } + if (code_cache->count == code_cache->max_count) { + int new_max = code_cache->max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + code_cache->entries = entries; + code_cache->max_count = new_max; + } + for (i=code_cache->count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + code_cache->count++; + Py_INCREF(code_object); +} +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__insert_code_object; + return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type expected = 0; + if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { + return; + } +#endif + __pyx__insert_code_object(code_cache, code_line, code_object); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); +#endif +#endif +} + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!code_object) { + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + } else { + py_funcname = PyUnicode_FromString(funcname); + } + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); + } else { + dict = PyDict_New(); + } + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + } + py_code = PyCode_NewEmpty(filename, funcname, py_line); + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} +#endif + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_5spacy_7symbols_symbol_t(enum __pyx_t_5spacy_7symbols_symbol_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum __pyx_t_5spacy_7symbols_symbol_t neg_one = (enum __pyx_t_5spacy_7symbols_symbol_t) -1, const_zero = (enum __pyx_t_5spacy_7symbols_symbol_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(enum __pyx_t_5spacy_7symbols_symbol_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(enum __pyx_t_5spacy_7symbols_symbol_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(enum __pyx_t_5spacy_7symbols_symbol_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(enum __pyx_t_5spacy_7symbols_symbol_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(enum __pyx_t_5spacy_7symbols_symbol_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_5spacy_7symbols_symbol_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum __pyx_t_5spacy_7symbols_symbol_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* Globals */ +static PyObject* __Pyx_Globals(void) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_d); +} + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static __Pyx_TypeName +__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) +{ + PyObject *module = NULL, *name = NULL, *result = NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_qualname); + #else + name = PyType_GetQualName(tp); + #endif + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; + module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_module); + if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; + if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { + result = name; + name = NULL; + goto done; + } + result = PyUnicode_FromFormat("%U.%U", module, name); + if (unlikely(result == NULL)) goto bad; + done: + Py_XDECREF(name); + Py_XDECREF(module); + return result; + bad: + PyErr_Clear(); + if (name) { + result = name; + name = NULL; + } else { + result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__3); + } + goto done; +} +#endif + +/* CIntFromPyVerify (used by CIntFromPy) */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + long val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (long) -1; + val = __Pyx_PyLong_As_long(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + long val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (long) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (long) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = v; + } + v = NULL; + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((long) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (long) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + int val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (int) -1; + val = __Pyx_PyLong_As_int(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(int) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + int val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (int) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = v; + } + v = NULL; + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((int) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (int) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); + for (i=0; i>= 8; + ++i; + } + __Pyx_cached_runtime_version = version; + } +} +#endif +static unsigned long __Pyx_get_runtime_version(void) { +#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + return Py_Version & ~0xFFUL; +#else + return __Pyx_cached_runtime_version; +#endif +} + +/* CheckBinaryVersion */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { + const unsigned long MAJOR_MINOR = 0xFFFF0000UL; + if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) + return 0; + if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) + return 1; + { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compile time Python version %d.%d " + "of module '%.100s' " + "%s " + "runtime version %d.%d", + (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), + __Pyx_MODULE_NAME, + (allow_newer) ? "was newer than" : "does not match", + (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) + ); + return PyErr_WarnEx(NULL, message, 1); + } +} + +/* NewCodeObj */ +#if CYTHON_COMPILING_IN_LIMITED_API + static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + PyObject *version_info; + PyObject *py_minor_version = NULL; + #endif + long minor_version = 0; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + minor_version = 11; + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + Py_DECREF(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + if (type) { + PyErr_Restore(type, value, traceback); + } + return result; + } +#elif PY_VERSION_HEX >= 0x030B0000 + static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1 + if (likely(result)) + result->_co_firsttraceable = 0; + #endif + return result; + } +#elif !CYTHON_COMPILING_IN_PYPY + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +) { + PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL; + Py_ssize_t var_count = (Py_ssize_t) descr.nlocals; + PyObject *varnames_tuple = PyTuple_New(var_count); + if (unlikely(!varnames_tuple)) return NULL; + for (Py_ssize_t i=0; i < var_count; i++) { + Py_INCREF(varnames[i]); + if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done; + } + #if CYTHON_COMPILING_IN_LIMITED_API + varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple); + if (!varnames_tuple_dedup) { + if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done; + varnames_tuple_dedup = varnames_tuple; + } + #else + varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple); + if (unlikely(!varnames_tuple_dedup)) goto done; + #endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(varnames_tuple_dedup); + #endif + if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) { + Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(line_table_length == -1)) goto done; + #endif + Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL; + code_bytes = PyBytes_FromStringAndSize(NULL, code_len); + if (unlikely(!code_bytes)) goto done; + char* c_code_bytes = PyBytes_AsString(code_bytes); + if (unlikely(!c_code_bytes)) goto done; + memset(c_code_bytes, 0, (size_t) code_len); + } + code_obj = (PyObject*) __Pyx__PyCode_New( + (int) descr.argcount, + (int) descr.num_posonly_args, + (int) descr.num_kwonly_args, + (int) descr.nlocals, + 0, + (int) descr.flags, + code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + varnames_tuple_dedup, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + filename, + funcname, + (int) descr.first_line, + (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes + ); +done: + Py_XDECREF(code_bytes); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(varnames_tuple_dedup); + #endif + Py_DECREF(varnames_tuple); + return code_obj; +} + +/* DecompressString */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { + PyObject *module, *decompress, *compressed_bytes, *decompressed; + const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; + PyObject *methodname = PyUnicode_FromString("decompress"); + if (unlikely(!methodname)) return NULL; + #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 + if (algo == 3) { + PyObject *fromlist = Py_BuildValue("[O]", methodname); + if (unlikely(!fromlist)) return NULL; + module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + } else + #endif + module = PyImport_ImportModule(module_name); + if (unlikely(!module)) goto import_failed; + decompress = PyObject_GetAttr(module, methodname); + if (unlikely(!decompress)) goto import_failed; + { + #ifdef __cplusplus + char *memview_bytes = const_cast(s); + #else + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wcast-qual" + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-qual" + #endif + char *memview_bytes = (char*) s; + #if defined(__clang__) + #pragma clang diagnostic pop + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + #endif + #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) + int memview_flags = 0x100; + #else + int memview_flags = PyBUF_READ; + #endif + compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); + } + if (unlikely(!compressed_bytes)) { + Py_DECREF(decompress); + goto bad; + } + decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); + Py_DECREF(compressed_bytes); + Py_DECREF(decompress); + Py_DECREF(module); + Py_DECREF(methodname); + return decompressed; +import_failed: + PyErr_Format(PyExc_ImportError, + "Failed to import '%.20s.decompress' - cannot initialise module strings. " + "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", + module_name, algo); +bad: + Py_XDECREF(module); + Py_DECREF(methodname); + return NULL; +} + +#include +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return __Pyx_PyUnicode_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return PyByteArray_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + { + const char* result; + Py_ssize_t unicode_length; + CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; + #else + result = PyUnicode_AsUTF8AndSize(o, length); + #endif + #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + unicode_length = PyUnicode_GetLength(o); + if (unlikely(unicode_length < 0)) return NULL; + if (unlikely(unicode_length != *length)) { + PyUnicode_AsASCIIString(o); + return NULL; + } + #endif + return result; + } +#else +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +#endif +} +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + if (PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif + if (PyByteArray_Check(o)) { +#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); +#else + *length = PyByteArray_Size(o); + if (*length == -1) return NULL; + return PyByteArray_AsString(o); +#endif + } else + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; + } + __Pyx_DECREF_TypeName(result_type_name); + return result; + } + PyErr_Format(PyExc_TypeError, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", + result_type_name); + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + PyObject *res = NULL; + if (likely(PyLong_Check(x))) + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + if (likely(m && m->nb_int)) { + res = m->nb_int(x); + } +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Long(x); + } +#endif + if (likely(res)) { + if (unlikely(!PyLong_CheckExact(res))) { + return __Pyx_PyNumber_LongWrongResultType(res); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); + } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyLong_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyLong_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { + CYTHON_UNUSED_VAR(b); + return __Pyx_NewRef(Py_None); +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return __Pyx_NewRef(b ? Py_True: Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { + return PyLong_FromSize_t(ival); +} + + +/* MultiPhaseInitModuleState */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 +#else + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 +#endif +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS +#error "Module state with PEP489 requires atomics. Currently that's one of\ + C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" +#endif +#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#define __Pyx_ModuleStateLookup_Lock() +#define __Pyx_ModuleStateLookup_Unlock() +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 +static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; +#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(__cplusplus) && __cplusplus >= 201103L +#include +static std::mutex __Pyx_ModuleStateLookup_mutex; +#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() +#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) +#include +static mtx_t __Pyx_ModuleStateLookup_mutex; +static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; +static void __Pyx_ModuleStateLookup_initialize_mutex(void) { + mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); +} +#define __Pyx_ModuleStateLookup_Lock()\ + call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ + mtx_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(HAVE_PTHREAD_H) +#include +static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; +#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(_WIN32) +#include // synchapi.h on its own doesn't work +static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; +#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#else +#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ + Requires C standard >= C11, or C++ standard >= C++11,\ + or pthreads, or the Windows 32 API, or Python >= 3.13." +#endif +typedef struct { + int64_t id; + PyObject *module; +} __Pyx_InterpreterIdAndModule; +typedef struct { + char interpreter_id_as_index; + Py_ssize_t count; + Py_ssize_t allocated; + __Pyx_InterpreterIdAndModule table[1]; +} __Pyx_ModuleStateLookupData; +#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; +#else +static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; +#endif +static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( + __Pyx_InterpreterIdAndModule* table, + Py_ssize_t count, + int64_t interpreterId) { + __Pyx_InterpreterIdAndModule* begin = table; + __Pyx_InterpreterIdAndModule* end = begin + count; + if (begin->id == interpreterId) { + return begin; + } + while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; + if (halfway->id == interpreterId) { + return halfway; + } + if (halfway->id < interpreterId) { + begin = halfway; + } else { + end = halfway; + } + } + for (; begin < end; ++begin) { + if (begin->id >= interpreterId) return begin; + } + return begin; +} +static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return NULL; +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + { + __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + if (likely(data)) { + __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); + if (likely(data == new_data)) { + goto read_finished; + } + } + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + __Pyx_ModuleStateLookup_Lock(); + __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); + data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + __Pyx_ModuleStateLookup_Unlock(); + } + read_finished:; +#else + __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_InterpreterIdAndModule* found = NULL; + if (unlikely(!data)) goto end; + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + found = data->table+interpreter_id; + } + } else { + found = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + } + end: + { + PyObject *result=NULL; + if (found && found->id == interpreter_id) { + result = found->module; + } +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); +#endif + return result; + } +} +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { + while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); +} +#else +#define __Pyx_ModuleStateLookup_wait_until_no_readers() +#endif +static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { + Py_ssize_t to_allocate = (*old_data)->allocated; + while (to_allocate <= interpreter_id) { + if (to_allocate == 0) to_allocate = 1; + else to_allocate *= 2; + } + __Pyx_ModuleStateLookupData *new_data = *old_data; + if (to_allocate != (*old_data)->allocated) { + new_data = (__Pyx_ModuleStateLookupData *)realloc( + *old_data, + sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + PyErr_NoMemory(); + return -1; + } + for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { + new_data->table[i].id = i; + new_data->table[i].module = NULL; + } + new_data->allocated = to_allocate; + } + new_data->table[interpreter_id].module = module; + if (new_data->count < interpreter_id+1) { + new_data->count = interpreter_id+1; + } + *old_data = new_data; + return 0; +} +static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { + __Pyx_InterpreterIdAndModule *read = data->table; + __Pyx_InterpreterIdAndModule *write = data->table; + __Pyx_InterpreterIdAndModule *end = read + data->count; + for (; readmodule) { + write->id = read->id; + write->module = read->module; + ++write; + } + } + data->count = write - data->table; + for (; writeid = 0; + write->module = NULL; + } + data->interpreter_id_as_index = 0; +} +static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + int result = 0; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_ModuleStateLookupData *new_data = old_data; + if (!new_data) { + new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); + if (!new_data) { + result = -1; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = 1; + new_data->interpreter_id_as_index = 1; + } + __Pyx_ModuleStateLookup_wait_until_no_readers(); + if (new_data->interpreter_id_as_index) { + if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); + goto end; + } + __Pyx_State_ConvertFromInterpIdAsIndex(new_data); + } + { + Py_ssize_t insert_at = 0; + { + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + new_data->table, new_data->count, interpreter_id); + assert(lower_bound); + insert_at = lower_bound - new_data->table; + if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { + lower_bound->module = module; + goto end; // already in table, nothing more to do + } + } + if (new_data->count+1 >= new_data->allocated) { + Py_ssize_t to_allocate = (new_data->count+1)*2; + new_data = + (__Pyx_ModuleStateLookupData*)realloc( + new_data, + sizeof(__Pyx_ModuleStateLookupData) + + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + result = -1; + new_data = old_data; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = to_allocate; + } + ++new_data->count; + int64_t last_id = interpreter_id; + PyObject *last_module = module; + for (Py_ssize_t i=insert_at; icount; ++i) { + int64_t current_id = new_data->table[i].id; + new_data->table[i].id = last_id; + last_id = current_id; + PyObject *current_module = new_data->table[i].module; + new_data->table[i].module = last_module; + last_module = current_module; + } + } + end: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); +#else + __Pyx_ModuleStateLookup_data = new_data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return result; +} +static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; +#endif + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + data->table[interpreter_id].module = NULL; + } + goto done; + } + { + __Pyx_ModuleStateLookup_wait_until_no_readers(); + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + if (!lower_bound) goto done; + if (lower_bound->id != interpreter_id) goto done; + __Pyx_InterpreterIdAndModule *end = data->table+data->count; + for (;lower_boundid = (lower_bound+1)->id; + lower_bound->module = (lower_bound+1)->module; + } + } + --data->count; + if (data->count == 0) { + free(data); + data = NULL; + } + done: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); +#else + __Pyx_ModuleStateLookup_data = data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return 0; +} +#endif + +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ +#endif /* Py_PYTHON_H */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/symbols.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/symbols.pxd new file mode 100644 index 0000000000000000000000000000000000000000..3a7a153187a0479fc139900790cdfaa67039ff1f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/symbols.pxd @@ -0,0 +1,469 @@ +cdef enum symbol_t: + NIL + IS_ALPHA + IS_ASCII + IS_DIGIT + IS_LOWER + IS_PUNCT + IS_SPACE + IS_TITLE + IS_UPPER + LIKE_URL + LIKE_NUM + LIKE_EMAIL + IS_STOP + IS_OOV_DEPRECATED + IS_BRACKET + IS_QUOTE + IS_LEFT_PUNCT + IS_RIGHT_PUNCT + IS_CURRENCY + + FLAG19 = 19 + FLAG20 + FLAG21 + FLAG22 + FLAG23 + FLAG24 + FLAG25 + FLAG26 + FLAG27 + FLAG28 + FLAG29 + FLAG30 + FLAG31 + FLAG32 + FLAG33 + FLAG34 + FLAG35 + FLAG36 + FLAG37 + FLAG38 + FLAG39 + FLAG40 + FLAG41 + FLAG42 + FLAG43 + FLAG44 + FLAG45 + FLAG46 + FLAG47 + FLAG48 + FLAG49 + FLAG50 + FLAG51 + FLAG52 + FLAG53 + FLAG54 + FLAG55 + FLAG56 + FLAG57 + FLAG58 + FLAG59 + FLAG60 + FLAG61 + FLAG62 + FLAG63 + + ID + ORTH + LOWER + NORM + SHAPE + PREFIX + SUFFIX + + LENGTH + CLUSTER + LEMMA + POS + TAG + DEP + ENT_IOB + ENT_TYPE + HEAD + SENT_START + SPACY + PROB + LANG + + ADJ + ADP + ADV + AUX + CONJ + CCONJ # U20 + DET + INTJ + NOUN + NUM + PART + PRON + PROPN + PUNCT + SCONJ + SYM + VERB + X + EOL + SPACE + + DEPRECATED001 + DEPRECATED002 + DEPRECATED003 + DEPRECATED004 + DEPRECATED005 + DEPRECATED006 + DEPRECATED007 + DEPRECATED008 + DEPRECATED009 + DEPRECATED010 + DEPRECATED011 + DEPRECATED012 + DEPRECATED013 + DEPRECATED014 + DEPRECATED015 + DEPRECATED016 + DEPRECATED017 + DEPRECATED018 + DEPRECATED019 + DEPRECATED020 + DEPRECATED021 + DEPRECATED022 + DEPRECATED023 + DEPRECATED024 + DEPRECATED025 + DEPRECATED026 + DEPRECATED027 + DEPRECATED028 + DEPRECATED029 + DEPRECATED030 + DEPRECATED031 + DEPRECATED032 + DEPRECATED033 + DEPRECATED034 + DEPRECATED035 + DEPRECATED036 + DEPRECATED037 + DEPRECATED038 + DEPRECATED039 + DEPRECATED040 + DEPRECATED041 + DEPRECATED042 + DEPRECATED043 + DEPRECATED044 + DEPRECATED045 + DEPRECATED046 + DEPRECATED047 + DEPRECATED048 + DEPRECATED049 + DEPRECATED050 + DEPRECATED051 + DEPRECATED052 + DEPRECATED053 + DEPRECATED054 + DEPRECATED055 + DEPRECATED056 + DEPRECATED057 + DEPRECATED058 + DEPRECATED059 + DEPRECATED060 + DEPRECATED061 + DEPRECATED062 + DEPRECATED063 + DEPRECATED064 + DEPRECATED065 + DEPRECATED066 + DEPRECATED067 + DEPRECATED068 + DEPRECATED069 + DEPRECATED070 + DEPRECATED071 + DEPRECATED072 + DEPRECATED073 + DEPRECATED074 + DEPRECATED075 + DEPRECATED076 + DEPRECATED077 + DEPRECATED078 + DEPRECATED079 + DEPRECATED080 + DEPRECATED081 + DEPRECATED082 + DEPRECATED083 + DEPRECATED084 + DEPRECATED085 + DEPRECATED086 + DEPRECATED087 + DEPRECATED088 + DEPRECATED089 + DEPRECATED090 + DEPRECATED091 + DEPRECATED092 + DEPRECATED093 + DEPRECATED094 + DEPRECATED095 + DEPRECATED096 + DEPRECATED097 + DEPRECATED098 + DEPRECATED099 + DEPRECATED100 + DEPRECATED101 + DEPRECATED102 + DEPRECATED103 + DEPRECATED104 + DEPRECATED105 + DEPRECATED106 + DEPRECATED107 + DEPRECATED108 + DEPRECATED109 + DEPRECATED110 + DEPRECATED111 + DEPRECATED112 + DEPRECATED113 + DEPRECATED114 + DEPRECATED115 + DEPRECATED116 + DEPRECATED117 + DEPRECATED118 + DEPRECATED119 + DEPRECATED120 + DEPRECATED121 + DEPRECATED122 + DEPRECATED123 + DEPRECATED124 + DEPRECATED125 + DEPRECATED126 + DEPRECATED127 + DEPRECATED128 + DEPRECATED129 + DEPRECATED130 + DEPRECATED131 + DEPRECATED132 + DEPRECATED133 + DEPRECATED134 + DEPRECATED135 + DEPRECATED136 + DEPRECATED137 + DEPRECATED138 + DEPRECATED139 + DEPRECATED140 + DEPRECATED141 + DEPRECATED142 + DEPRECATED143 + DEPRECATED144 + DEPRECATED145 + DEPRECATED146 + DEPRECATED147 + DEPRECATED148 + DEPRECATED149 + DEPRECATED150 + DEPRECATED151 + DEPRECATED152 + DEPRECATED153 + DEPRECATED154 + DEPRECATED155 + DEPRECATED156 + DEPRECATED157 + DEPRECATED158 + DEPRECATED159 + DEPRECATED160 + DEPRECATED161 + DEPRECATED162 + DEPRECATED163 + DEPRECATED164 + DEPRECATED165 + DEPRECATED166 + DEPRECATED167 + DEPRECATED168 + DEPRECATED169 + DEPRECATED170 + DEPRECATED171 + DEPRECATED172 + DEPRECATED173 + DEPRECATED174 + DEPRECATED175 + DEPRECATED176 + DEPRECATED177 + DEPRECATED178 + DEPRECATED179 + DEPRECATED180 + DEPRECATED181 + DEPRECATED182 + DEPRECATED183 + DEPRECATED184 + DEPRECATED185 + DEPRECATED186 + DEPRECATED187 + DEPRECATED188 + DEPRECATED189 + DEPRECATED190 + DEPRECATED191 + DEPRECATED192 + DEPRECATED193 + DEPRECATED194 + DEPRECATED195 + DEPRECATED196 + DEPRECATED197 + DEPRECATED198 + DEPRECATED199 + DEPRECATED200 + DEPRECATED201 + DEPRECATED202 + DEPRECATED203 + DEPRECATED204 + DEPRECATED205 + DEPRECATED206 + DEPRECATED207 + DEPRECATED208 + DEPRECATED209 + DEPRECATED210 + DEPRECATED211 + DEPRECATED212 + DEPRECATED213 + DEPRECATED214 + DEPRECATED215 + DEPRECATED216 + DEPRECATED217 + DEPRECATED218 + DEPRECATED219 + DEPRECATED220 + DEPRECATED221 + DEPRECATED222 + DEPRECATED223 + DEPRECATED224 + DEPRECATED225 + DEPRECATED226 + DEPRECATED227 + DEPRECATED228 + DEPRECATED229 + DEPRECATED230 + DEPRECATED231 + DEPRECATED232 + DEPRECATED233 + DEPRECATED234 + DEPRECATED235 + DEPRECATED236 + DEPRECATED237 + DEPRECATED238 + DEPRECATED239 + DEPRECATED240 + DEPRECATED241 + DEPRECATED242 + DEPRECATED243 + DEPRECATED244 + DEPRECATED245 + DEPRECATED246 + DEPRECATED247 + DEPRECATED248 + DEPRECATED249 + DEPRECATED250 + DEPRECATED251 + DEPRECATED252 + DEPRECATED253 + DEPRECATED254 + DEPRECATED255 + DEPRECATED256 + DEPRECATED257 + DEPRECATED258 + DEPRECATED259 + DEPRECATED260 + DEPRECATED261 + DEPRECATED262 + DEPRECATED263 + DEPRECATED264 + DEPRECATED265 + DEPRECATED266 + DEPRECATED267 + DEPRECATED268 + DEPRECATED269 + DEPRECATED270 + DEPRECATED271 + DEPRECATED272 + DEPRECATED273 + DEPRECATED274 + DEPRECATED275 + DEPRECATED276 + + PERSON + NORP + FACILITY + ORG + GPE + LOC + PRODUCT + EVENT + WORK_OF_ART + LANGUAGE + LAW + + DATE + TIME + PERCENT + MONEY + QUANTITY + ORDINAL + CARDINAL + + acomp + advcl + advmod + agent + amod + appos + attr + aux + auxpass + cc + ccomp + complm + conj + cop # U20 + csubj + csubjpass + dep + det + dobj + expl + hmod + hyph + infmod + intj + iobj + mark + meta + neg + nmod + nn + npadvmod + nsubj + nsubjpass + num + number + oprd + obj # U20 + obl # U20 + parataxis + partmod + pcomp + pobj + poss + possessive + preconj + prep + prt + punct + quantmod + relcl + rcmod + root + xcomp + + acl + + ENT_KB_ID + MORPH + ENT_ID + + IDX + _ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/symbols.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/symbols.pyx new file mode 100644 index 0000000000000000000000000000000000000000..89a854918976a0c027b5409e7da5ea30588853c3 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/symbols.pyx @@ -0,0 +1,482 @@ +# cython: optimize.unpack_method_calls=False +# cython: profile=False +IDS = { + "": NIL, + "IS_ALPHA": IS_ALPHA, + "IS_ASCII": IS_ASCII, + "IS_DIGIT": IS_DIGIT, + "IS_LOWER": IS_LOWER, + "IS_PUNCT": IS_PUNCT, + "IS_SPACE": IS_SPACE, + "IS_TITLE": IS_TITLE, + "IS_UPPER": IS_UPPER, + "LIKE_URL": LIKE_URL, + "LIKE_NUM": LIKE_NUM, + "LIKE_EMAIL": LIKE_EMAIL, + "IS_STOP": IS_STOP, + "IS_OOV_DEPRECATED": IS_OOV_DEPRECATED, + "IS_BRACKET": IS_BRACKET, + "IS_QUOTE": IS_QUOTE, + "IS_LEFT_PUNCT": IS_LEFT_PUNCT, + "IS_RIGHT_PUNCT": IS_RIGHT_PUNCT, + "IS_CURRENCY": IS_CURRENCY, + + "FLAG19": FLAG19, + "FLAG20": FLAG20, + "FLAG21": FLAG21, + "FLAG22": FLAG22, + "FLAG23": FLAG23, + "FLAG24": FLAG24, + "FLAG25": FLAG25, + "FLAG26": FLAG26, + "FLAG27": FLAG27, + "FLAG28": FLAG28, + "FLAG29": FLAG29, + "FLAG30": FLAG30, + "FLAG31": FLAG31, + "FLAG32": FLAG32, + "FLAG33": FLAG33, + "FLAG34": FLAG34, + "FLAG35": FLAG35, + "FLAG36": FLAG36, + "FLAG37": FLAG37, + "FLAG38": FLAG38, + "FLAG39": FLAG39, + "FLAG40": FLAG40, + "FLAG41": FLAG41, + "FLAG42": FLAG42, + "FLAG43": FLAG43, + "FLAG44": FLAG44, + "FLAG45": FLAG45, + "FLAG46": FLAG46, + "FLAG47": FLAG47, + "FLAG48": FLAG48, + "FLAG49": FLAG49, + "FLAG50": FLAG50, + "FLAG51": FLAG51, + "FLAG52": FLAG52, + "FLAG53": FLAG53, + "FLAG54": FLAG54, + "FLAG55": FLAG55, + "FLAG56": FLAG56, + "FLAG57": FLAG57, + "FLAG58": FLAG58, + "FLAG59": FLAG59, + "FLAG60": FLAG60, + "FLAG61": FLAG61, + "FLAG62": FLAG62, + "FLAG63": FLAG63, + + "ID": ID, + "ORTH": ORTH, + "LOWER": LOWER, + "NORM": NORM, + "SHAPE": SHAPE, + "PREFIX": PREFIX, + "SUFFIX": SUFFIX, + + "LENGTH": LENGTH, + "CLUSTER": CLUSTER, + "LEMMA": LEMMA, + "POS": POS, + "TAG": TAG, + "DEP": DEP, + "ENT_IOB": ENT_IOB, + "ENT_TYPE": ENT_TYPE, + "ENT_ID": ENT_ID, + "ENT_KB_ID": ENT_KB_ID, + "HEAD": HEAD, + "SENT_START": SENT_START, + "SPACY": SPACY, + "PROB": PROB, + "LANG": LANG, + "IDX": IDX, + + "ADJ": ADJ, + "ADP": ADP, + "ADV": ADV, + "AUX": AUX, + "CONJ": CONJ, + "CCONJ": CCONJ, # U20 + "DET": DET, + "INTJ": INTJ, + "NOUN": NOUN, + "NUM": NUM, + "PART": PART, + "PRON": PRON, + "PROPN": PROPN, + "PUNCT": PUNCT, + "SCONJ": SCONJ, + "SYM": SYM, + "VERB": VERB, + "X": X, + "EOL": EOL, + "SPACE": SPACE, + + "DEPRECATED001": DEPRECATED001, + "DEPRECATED002": DEPRECATED002, + "DEPRECATED003": DEPRECATED003, + "DEPRECATED004": DEPRECATED004, + "DEPRECATED005": DEPRECATED005, + "DEPRECATED006": DEPRECATED006, + "DEPRECATED007": DEPRECATED007, + "DEPRECATED008": DEPRECATED008, + "DEPRECATED009": DEPRECATED009, + "DEPRECATED010": DEPRECATED010, + "DEPRECATED011": DEPRECATED011, + "DEPRECATED012": DEPRECATED012, + "DEPRECATED013": DEPRECATED013, + "DEPRECATED014": DEPRECATED014, + "DEPRECATED015": DEPRECATED015, + "DEPRECATED016": DEPRECATED016, + "DEPRECATED017": DEPRECATED017, + "DEPRECATED018": DEPRECATED018, + "DEPRECATED019": DEPRECATED019, + "DEPRECATED020": DEPRECATED020, + "DEPRECATED021": DEPRECATED021, + "DEPRECATED022": DEPRECATED022, + "DEPRECATED023": DEPRECATED023, + "DEPRECATED024": DEPRECATED024, + "DEPRECATED025": DEPRECATED025, + "DEPRECATED026": DEPRECATED026, + "DEPRECATED027": DEPRECATED027, + "DEPRECATED028": DEPRECATED028, + "DEPRECATED029": DEPRECATED029, + "DEPRECATED030": DEPRECATED030, + "DEPRECATED031": DEPRECATED031, + "DEPRECATED032": DEPRECATED032, + "DEPRECATED033": DEPRECATED033, + "DEPRECATED034": DEPRECATED034, + "DEPRECATED035": DEPRECATED035, + "DEPRECATED036": DEPRECATED036, + "DEPRECATED037": DEPRECATED037, + "DEPRECATED038": DEPRECATED038, + "DEPRECATED039": DEPRECATED039, + "DEPRECATED040": DEPRECATED040, + "DEPRECATED041": DEPRECATED041, + "DEPRECATED042": DEPRECATED042, + "DEPRECATED043": DEPRECATED043, + "DEPRECATED044": DEPRECATED044, + "DEPRECATED045": DEPRECATED045, + "DEPRECATED046": DEPRECATED046, + "DEPRECATED047": DEPRECATED047, + "DEPRECATED048": DEPRECATED048, + "DEPRECATED049": DEPRECATED049, + "DEPRECATED050": DEPRECATED050, + "DEPRECATED051": DEPRECATED051, + "DEPRECATED052": DEPRECATED052, + "DEPRECATED053": DEPRECATED053, + "DEPRECATED054": DEPRECATED054, + "DEPRECATED055": DEPRECATED055, + "DEPRECATED056": DEPRECATED056, + "DEPRECATED057": DEPRECATED057, + "DEPRECATED058": DEPRECATED058, + "DEPRECATED059": DEPRECATED059, + "DEPRECATED060": DEPRECATED060, + "DEPRECATED061": DEPRECATED061, + "DEPRECATED062": DEPRECATED062, + "DEPRECATED063": DEPRECATED063, + "DEPRECATED064": DEPRECATED064, + "DEPRECATED065": DEPRECATED065, + "DEPRECATED066": DEPRECATED066, + "DEPRECATED067": DEPRECATED067, + "DEPRECATED068": DEPRECATED068, + "DEPRECATED069": DEPRECATED069, + "DEPRECATED070": DEPRECATED070, + "DEPRECATED071": DEPRECATED071, + "DEPRECATED072": DEPRECATED072, + "DEPRECATED073": DEPRECATED073, + "DEPRECATED074": DEPRECATED074, + "DEPRECATED075": DEPRECATED075, + "DEPRECATED076": DEPRECATED076, + "DEPRECATED077": DEPRECATED077, + "DEPRECATED078": DEPRECATED078, + "DEPRECATED079": DEPRECATED079, + "DEPRECATED080": DEPRECATED080, + "DEPRECATED081": DEPRECATED081, + "DEPRECATED082": DEPRECATED082, + "DEPRECATED083": DEPRECATED083, + "DEPRECATED084": DEPRECATED084, + "DEPRECATED085": DEPRECATED085, + "DEPRECATED086": DEPRECATED086, + "DEPRECATED087": DEPRECATED087, + "DEPRECATED088": DEPRECATED088, + "DEPRECATED089": DEPRECATED089, + "DEPRECATED090": DEPRECATED090, + "DEPRECATED091": DEPRECATED091, + "DEPRECATED092": DEPRECATED092, + "DEPRECATED093": DEPRECATED093, + "DEPRECATED094": DEPRECATED094, + "DEPRECATED095": DEPRECATED095, + "DEPRECATED096": DEPRECATED096, + "DEPRECATED097": DEPRECATED097, + "DEPRECATED098": DEPRECATED098, + "DEPRECATED099": DEPRECATED099, + "DEPRECATED100": DEPRECATED100, + "DEPRECATED101": DEPRECATED101, + "DEPRECATED102": DEPRECATED102, + "DEPRECATED103": DEPRECATED103, + "DEPRECATED104": DEPRECATED104, + "DEPRECATED105": DEPRECATED105, + "DEPRECATED106": DEPRECATED106, + "DEPRECATED107": DEPRECATED107, + "DEPRECATED108": DEPRECATED108, + "DEPRECATED109": DEPRECATED109, + "DEPRECATED110": DEPRECATED110, + "DEPRECATED111": DEPRECATED111, + "DEPRECATED112": DEPRECATED112, + "DEPRECATED113": DEPRECATED113, + "DEPRECATED114": DEPRECATED114, + "DEPRECATED115": DEPRECATED115, + "DEPRECATED116": DEPRECATED116, + "DEPRECATED117": DEPRECATED117, + "DEPRECATED118": DEPRECATED118, + "DEPRECATED119": DEPRECATED119, + "DEPRECATED120": DEPRECATED120, + "DEPRECATED121": DEPRECATED121, + "DEPRECATED122": DEPRECATED122, + "DEPRECATED123": DEPRECATED123, + "DEPRECATED124": DEPRECATED124, + "DEPRECATED125": DEPRECATED125, + "DEPRECATED126": DEPRECATED126, + "DEPRECATED127": DEPRECATED127, + "DEPRECATED128": DEPRECATED128, + "DEPRECATED129": DEPRECATED129, + "DEPRECATED130": DEPRECATED130, + "DEPRECATED131": DEPRECATED131, + "DEPRECATED132": DEPRECATED132, + "DEPRECATED133": DEPRECATED133, + "DEPRECATED134": DEPRECATED134, + "DEPRECATED135": DEPRECATED135, + "DEPRECATED136": DEPRECATED136, + "DEPRECATED137": DEPRECATED137, + "DEPRECATED138": DEPRECATED138, + "DEPRECATED139": DEPRECATED139, + "DEPRECATED140": DEPRECATED140, + "DEPRECATED141": DEPRECATED141, + "DEPRECATED142": DEPRECATED142, + "DEPRECATED143": DEPRECATED143, + "DEPRECATED144": DEPRECATED144, + "DEPRECATED145": DEPRECATED145, + "DEPRECATED146": DEPRECATED146, + "DEPRECATED147": DEPRECATED147, + "DEPRECATED148": DEPRECATED148, + "DEPRECATED149": DEPRECATED149, + "DEPRECATED150": DEPRECATED150, + "DEPRECATED151": DEPRECATED151, + "DEPRECATED152": DEPRECATED152, + "DEPRECATED153": DEPRECATED153, + "DEPRECATED154": DEPRECATED154, + "DEPRECATED155": DEPRECATED155, + "DEPRECATED156": DEPRECATED156, + "DEPRECATED157": DEPRECATED157, + "DEPRECATED158": DEPRECATED158, + "DEPRECATED159": DEPRECATED159, + "DEPRECATED160": DEPRECATED160, + "DEPRECATED161": DEPRECATED161, + "DEPRECATED162": DEPRECATED162, + "DEPRECATED163": DEPRECATED163, + "DEPRECATED164": DEPRECATED164, + "DEPRECATED165": DEPRECATED165, + "DEPRECATED166": DEPRECATED166, + "DEPRECATED167": DEPRECATED167, + "DEPRECATED168": DEPRECATED168, + "DEPRECATED169": DEPRECATED169, + "DEPRECATED170": DEPRECATED170, + "DEPRECATED171": DEPRECATED171, + "DEPRECATED172": DEPRECATED172, + "DEPRECATED173": DEPRECATED173, + "DEPRECATED174": DEPRECATED174, + "DEPRECATED175": DEPRECATED175, + "DEPRECATED176": DEPRECATED176, + "DEPRECATED177": DEPRECATED177, + "DEPRECATED178": DEPRECATED178, + "DEPRECATED179": DEPRECATED179, + "DEPRECATED180": DEPRECATED180, + "DEPRECATED181": DEPRECATED181, + "DEPRECATED182": DEPRECATED182, + "DEPRECATED183": DEPRECATED183, + "DEPRECATED184": DEPRECATED184, + "DEPRECATED185": DEPRECATED185, + "DEPRECATED186": DEPRECATED186, + "DEPRECATED187": DEPRECATED187, + "DEPRECATED188": DEPRECATED188, + "DEPRECATED189": DEPRECATED189, + "DEPRECATED190": DEPRECATED190, + "DEPRECATED191": DEPRECATED191, + "DEPRECATED192": DEPRECATED192, + "DEPRECATED193": DEPRECATED193, + "DEPRECATED194": DEPRECATED194, + "DEPRECATED195": DEPRECATED195, + "DEPRECATED196": DEPRECATED196, + "DEPRECATED197": DEPRECATED197, + "DEPRECATED198": DEPRECATED198, + "DEPRECATED199": DEPRECATED199, + "DEPRECATED200": DEPRECATED200, + "DEPRECATED201": DEPRECATED201, + "DEPRECATED202": DEPRECATED202, + "DEPRECATED203": DEPRECATED203, + "DEPRECATED204": DEPRECATED204, + "DEPRECATED205": DEPRECATED205, + "DEPRECATED206": DEPRECATED206, + "DEPRECATED207": DEPRECATED207, + "DEPRECATED208": DEPRECATED208, + "DEPRECATED209": DEPRECATED209, + "DEPRECATED210": DEPRECATED210, + "DEPRECATED211": DEPRECATED211, + "DEPRECATED212": DEPRECATED212, + "DEPRECATED213": DEPRECATED213, + "DEPRECATED214": DEPRECATED214, + "DEPRECATED215": DEPRECATED215, + "DEPRECATED216": DEPRECATED216, + "DEPRECATED217": DEPRECATED217, + "DEPRECATED218": DEPRECATED218, + "DEPRECATED219": DEPRECATED219, + "DEPRECATED220": DEPRECATED220, + "DEPRECATED221": DEPRECATED221, + "DEPRECATED222": DEPRECATED222, + "DEPRECATED223": DEPRECATED223, + "DEPRECATED224": DEPRECATED224, + "DEPRECATED225": DEPRECATED225, + "DEPRECATED226": DEPRECATED226, + "DEPRECATED227": DEPRECATED227, + "DEPRECATED228": DEPRECATED228, + "DEPRECATED229": DEPRECATED229, + "DEPRECATED230": DEPRECATED230, + "DEPRECATED231": DEPRECATED231, + "DEPRECATED232": DEPRECATED232, + "DEPRECATED233": DEPRECATED233, + "DEPRECATED234": DEPRECATED234, + "DEPRECATED235": DEPRECATED235, + "DEPRECATED236": DEPRECATED236, + "DEPRECATED237": DEPRECATED237, + "DEPRECATED238": DEPRECATED238, + "DEPRECATED239": DEPRECATED239, + "DEPRECATED240": DEPRECATED240, + "DEPRECATED241": DEPRECATED241, + "DEPRECATED242": DEPRECATED242, + "DEPRECATED243": DEPRECATED243, + "DEPRECATED244": DEPRECATED244, + "DEPRECATED245": DEPRECATED245, + "DEPRECATED246": DEPRECATED246, + "DEPRECATED247": DEPRECATED247, + "DEPRECATED248": DEPRECATED248, + "DEPRECATED249": DEPRECATED249, + "DEPRECATED250": DEPRECATED250, + "DEPRECATED251": DEPRECATED251, + "DEPRECATED252": DEPRECATED252, + "DEPRECATED253": DEPRECATED253, + "DEPRECATED254": DEPRECATED254, + "DEPRECATED255": DEPRECATED255, + "DEPRECATED256": DEPRECATED256, + "DEPRECATED257": DEPRECATED257, + "DEPRECATED258": DEPRECATED258, + "DEPRECATED259": DEPRECATED259, + "DEPRECATED260": DEPRECATED260, + "DEPRECATED261": DEPRECATED261, + "DEPRECATED262": DEPRECATED262, + "DEPRECATED263": DEPRECATED263, + "DEPRECATED264": DEPRECATED264, + "DEPRECATED265": DEPRECATED265, + "DEPRECATED266": DEPRECATED266, + "DEPRECATED267": DEPRECATED267, + "DEPRECATED268": DEPRECATED268, + "DEPRECATED269": DEPRECATED269, + "DEPRECATED270": DEPRECATED270, + "DEPRECATED271": DEPRECATED271, + "DEPRECATED272": DEPRECATED272, + "DEPRECATED273": DEPRECATED273, + "DEPRECATED274": DEPRECATED274, + "DEPRECATED275": DEPRECATED275, + "DEPRECATED276": DEPRECATED276, + + "PERSON": PERSON, + "NORP": NORP, + "FACILITY": FACILITY, + "ORG": ORG, + "GPE": GPE, + "LOC": LOC, + "PRODUCT": PRODUCT, + "EVENT": EVENT, + "WORK_OF_ART": WORK_OF_ART, + "LANGUAGE": LANGUAGE, + + "DATE": DATE, + "TIME": TIME, + "PERCENT": PERCENT, + "MONEY": MONEY, + "QUANTITY": QUANTITY, + "ORDINAL": ORDINAL, + "CARDINAL": CARDINAL, + + "acomp": acomp, + "advcl": advcl, + "advmod": advmod, + "agent": agent, + "amod": amod, + "appos": appos, + "attr": attr, + "aux": aux, + "auxpass": auxpass, + "cc": cc, + "ccomp": ccomp, + "complm": complm, + "conj": conj, + "cop": cop, # U20 + "csubj": csubj, + "csubjpass": csubjpass, + "dep": dep, + "det": det, + "dobj": dobj, + "expl": expl, + "hmod": hmod, + "hyph": hyph, + "infmod": infmod, + "intj": intj, + "iobj": iobj, + "mark": mark, + "meta": meta, + "neg": neg, + "nmod": nmod, + "nn": nn, + "npadvmod": npadvmod, + "nsubj": nsubj, + "nsubjpass": nsubjpass, + "num": num, + "number": number, + "oprd": oprd, + "obj": obj, # U20 + "obl": obl, # U20 + "parataxis": parataxis, + "partmod": partmod, + "pcomp": pcomp, + "pobj": pobj, + "poss": poss, + "possessive": possessive, + "preconj": preconj, + "prep": prep, + "prt": prt, + "punct": punct, + "quantmod": quantmod, + "rcmod": rcmod, + "relcl": relcl, + "root": root, + "xcomp": xcomp, + + "acl": acl, + "LAW": LAW, + "MORPH": MORPH, + "_": _, +} + + +def sort_nums(x): + return x[1] + + +NAMES = [it[0] for it in sorted(IDS.items(), key=sort_nums)] +# Unfortunate hack here, to work around problem with long cpdef enum +# (which is generating an enormous amount of C++ in Cython 0.24+) +# We keep the enum cdef, and just make sure the names are available to Python +locals().update(IDS) + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokenizer.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokenizer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f9c68dcc5b74ba169d8132e448a90298e6322008 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokenizer.cpp @@ -0,0 +1,54093 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayscalars.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarraytypes.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ufuncobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include\\Python.h" + ], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.tokenizer", + "sources": [ + "spacy/tokenizer.pyx" + ] + }, + "module_name": "spacy.tokenizer" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +/* InitLimitedAPI */ +#if defined(Py_LIMITED_API) + #if !defined(CYTHON_LIMITED_API) + #define CYTHON_LIMITED_API 1 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef _MSC_VER + #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") + #else + #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. + #endif +#endif + +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x03080000 + #error Cython requires Python 3.8+. +#else +#define __PYX_ABI_VERSION "3_2_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* CModulePreamble */ +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#define __PYX_COMMA , +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) + #endif + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 1 + #endif + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #ifdef Py_GIL_DISABLED + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 + #else + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #endif + #if PY_VERSION_HEX < 0x030A0000 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #elif !defined(CYTHON_USE_TYPE_SLOTS) + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLIST_INTERNALS) + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #elif !defined(CYTHON_FAST_GIL) + #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #ifndef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif + #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work + #elif !defined(CYTHON_IMMORTAL_CONSTANTS) + #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif +#endif +#ifndef CYTHON_COMPRESS_STRINGS + #define CYTHON_COMPRESS_STRINGS 1 +#endif +#ifndef CYTHON_FAST_PYCCALL +#define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL +#endif +#ifndef CYTHON_VECTORCALL +#if CYTHON_COMPILING_IN_LIMITED_API +#define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) +#else +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) +#endif +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#include +typedef uintptr_t __pyx_uintptr_t; +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif +#ifndef Py_UNREACHABLE + #define Py_UNREACHABLE() assert(0); abort() +#endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* PythonCompatibility */ +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#define __Pyx_BUILTIN_MODULE_NAME "builtins" +#define __Pyx_DefaultClassType PyType_Type +#if CYTHON_COMPILING_IN_LIMITED_API + #ifndef CO_OPTIMIZED + static int CO_OPTIMIZED; + #endif + #ifndef CO_NEWLOCALS + static int CO_NEWLOCALS; + #endif + #ifndef CO_VARARGS + static int CO_VARARGS; + #endif + #ifndef CO_VARKEYWORDS + static int CO_VARKEYWORDS; + #endif + #ifndef CO_ASYNC_GENERATOR + static int CO_ASYNC_GENERATOR; + #endif + #ifndef CO_GENERATOR + static int CO_GENERATOR; + #endif + #ifndef CO_COROUTINE + static int CO_COROUTINE; + #endif +#else + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 + #endif +#endif +static int __Pyx_init_co_variables(void); +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif +#ifndef Py_TPFLAGS_IMMUTABLETYPE + #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) +#endif +#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION + #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) +#endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#ifndef METH_FASTCALL + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #if PY_VERSION_HEX >= 0x030d00A4 + # define __Pyx_PyCFunctionFast PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords + #else + # define __Pyx_PyCFunctionFast _PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords + #endif +#endif +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX >= 0x030900B1 +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) +#else +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) +#endif +#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) +#elif !CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) +static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { + return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; +} +#endif +static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; +#else + return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +#endif +} +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) +#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) +#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) +#elif CYTHON_COMPILING_IN_GRAAL + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#endif +#if CYTHON_USE_MODULE_STATE +static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) +#else +#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) +#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) +#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) + #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) + #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ + ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ + (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ + __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) + #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) + #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) +#endif +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) +#endif +#define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) +#if CYTHON_USE_TYPE_SPECS +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE((PyObject*)obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#else + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #else + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #endif +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif +#endif +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#elif CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) +#endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif +enum __Pyx_ReferenceSharing { + __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check + __Pyx_ReferenceSharing_OwnStrongReference, + __Pyx_ReferenceSharing_FunctionArgument, + __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar +}; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ + (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ + (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ + (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) +#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) +#else +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) +#endif +#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) + #else + #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) + #endif +#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) + #endif +#else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) +#endif +#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ + __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) +#else + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) +#endif +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyObject_GetItem(dict, key); + if (*result == NULL) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + return 0; + } + return -1; + } + return 1; +} +#else +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyDict_GetItemWithError(dict, key); + if (*result == NULL) { + return PyErr_Occurred() ? -1 : 0; + } + Py_INCREF(*result); + return 1; +} +#endif +#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST + #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) +#else + #define __Pyx_VISIT_CONST(obj) +#endif +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) +#else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) +#endif +#if CYTHON_ASSUME_SAFE_SIZE + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) +#else + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) +#endif +#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t +#define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t +#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 + #define __Pyx_PySendResult PySendResult +#else + typedef enum { + PYGEN_RETURN = 0, + PYGEN_ERROR = -1, + PYGEN_NEXT = 1, + } __Pyx_PySendResult; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 + typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); +#else + #define __Pyx_pyiter_sendfunc sendfunc +#endif +#if !CYTHON_USE_AM_SEND +#define __PYX_HAS_PY_AM_SEND 0 +#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 +#define __PYX_HAS_PY_AM_SEND 1 +#else +#define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation +#endif +#if __PYX_HAS_PY_AM_SEND < 2 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods +#else + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + __Pyx_pyiter_sendfunc am_send; + } __Pyx_PyAsyncMethodsStruct; + #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) +#endif +#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 + #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) +#else + #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) +#endif +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() +#else +#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 +#ifdef __cplusplus +extern "C" +#endif +PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { + int value; + PyObject *py_value = PyObject_GetAttrString(inspect, name); + if (!py_value) return 0; + value = (int) PyLong_AsLong(py_value); + Py_DECREF(py_value); + *write_to = value; + return value != -1 || !PyErr_Occurred(); +} +static int __Pyx_init_co_variables(void) { + PyObject *inspect; + int result; + inspect = PyImport_ImportModule("inspect"); + result = +#if !defined(CO_OPTIMIZED) + __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && +#endif +#if !defined(CO_NEWLOCALS) + __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && +#endif +#if !defined(CO_VARARGS) + __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && +#endif +#if !defined(CO_VARKEYWORDS) + __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && +#endif +#if !defined(CO_ASYNC_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && +#endif +#if !defined(CO_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && +#endif +#if !defined(CO_COROUTINE) + __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && +#endif + 1; + Py_DECREF(inspect); + return result ? 0 : -1; +} +#else +static int __Pyx_init_co_variables(void) { + return 0; // It's a limited API-only feature +} +#endif + +/* MathInitCode */ +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #ifndef _USE_MATH_DEFINES + #define _USE_MATH_DEFINES + #endif +#endif +#include +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 +#endif +#ifndef CYTHON_CLINE_IN_TRACEBACK +#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#endif +#if CYTHON_CLINE_IN_TRACEBACK +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } +#else +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } +#endif +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__tokenizer +#define __PYX_HAVE_API__spacy__tokenizer +/* Early includes */ +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include +#include +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include +#include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + +#include "numpy/arrayobject.h" +#include "numpy/ndarrayobject.h" +#include "numpy/ndarraytypes.h" +#include "numpy/arrayscalars.h" +#include "numpy/ufuncobject.h" +#include +#include +#include "pythread.h" +#include +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) +#else + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) +#endif +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) + return Py_NewRef(obj); +#else + Py_INCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) + return Py_XNewRef(obj); +#else + Py_XINCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) +#else +#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) +#endif +#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) +#else + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +/* PretendToInitialize */ +#ifdef __cplusplus +#if __cplusplus > 201103L +#include +#endif +template +static void __Pyx_pretend_to_initialize(T* ptr) { +#if __cplusplus > 201103L + if ((std::is_trivially_default_constructible::value)) +#endif + *ptr = T(); + (void)ptr; +} +#else +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#endif + + +#if !CYTHON_USE_MODULE_STATE +static PyObject *__pyx_m = NULL; +#endif +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * const __pyx_cfilenm = __FILE__; +static const char *__pyx_filename; + +/* Header.proto */ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER)) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/tokenizer.pyx", + "", + "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd", + "spacy/lexeme.pxd", + "spacy/tokenizer.pxd", + "cymem/cymem.pxd", + "preshed/maps.pxd", + "cpython/type.pxd", + "spacy/strings.pxd", + "spacy/morphology.pxd", + "spacy/vocab.pxd", + "spacy/tokens/doc.pxd", + "spacy/matcher/phrasematcher.pxd", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* Atomics.proto (used by UnpackUnboundCMethod) */ +#include +#ifndef CYTHON_ATOMICS + #define CYTHON_ATOMICS 1 +#endif +#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS +#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __pyx_atomic_int_type int +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_ptr_type atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) atomic_load(value) + #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_ptr_type std::atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) std::atomic_load(value) + #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ + (__GNUC_MINOR__ > 1 ||\ + (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) + #define __pyx_atomic_ptr_type void* + #define __pyx_nonatomic_ptr_type void* + #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) + #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #warning "Using GNU atomics" + #endif +#elif CYTHON_ATOMICS && defined(_MSC_VER) + #include + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type long + #define __pyx_atomic_ptr_type void* + #undef __pyx_nonatomic_int_type + #define __pyx_nonatomic_int_type long + #define __pyx_nonatomic_ptr_type void* + #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) + #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) + #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) + #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value + #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #pragma message ("Using MSVC atomics") + #endif +#else + #undef CYTHON_ATOMICS + #define CYTHON_ATOMICS 0 + #ifdef __PYX_DEBUG_ATOMICS + #warning "Not using atomics" + #endif +#endif + +/* CriticalSectionsDefinition.proto (used by CriticalSections) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection void* +#define __Pyx_PyCriticalSection2 void* +#define __Pyx_PyCriticalSection_End(cs) +#define __Pyx_PyCriticalSection2_End(cs) +#else +#define __Pyx_PyCriticalSection PyCriticalSection +#define __Pyx_PyCriticalSection2 PyCriticalSection2 +#define __Pyx_PyCriticalSection_End PyCriticalSection_End +#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End +#endif + +/* CriticalSections.proto (used by ParseKeywordsImpl) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs) +#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs) +#else +#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin +#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin +#endif +#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_BEGIN_CRITICAL_SECTION(o) { +#define __Pyx_END_CRITICAL_SECTION() } +#else +#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION +#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION +#endif + +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* BufferFormatStructs.proto */ +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; + const struct __Pyx_StructField_* fields; + size_t size; + size_t arraysize[8]; + int ndim; + char typegroup; + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + const __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + const __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +#define __Pyx_MEMSLICE_INIT { 0, 0, { 0 }, { 0 }, { 0 } } +#if CYTHON_ATOMICS + #define __pyx_add_acquisition_count(memview)\ + __pyx_atomic_incr_relaxed(__pyx_get_slice_count_pointer(memview)) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_atomic_decr_acq_rel(__pyx_get_slice_count_pointer(memview)) +#else + #define __pyx_add_acquisition_count(memview)\ + __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) +#endif + +/* #### Code section: numeric_typedefs ### */ + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":743 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t +*/ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":744 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t +*/ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":745 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * +*/ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":746 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_uint8 uint8_t +*/ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":748 + * ctypedef npy_int64 int64_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t +*/ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":749 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t +*/ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":750 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * +*/ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":751 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_float32 float32_t +*/ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":753 + * ctypedef npy_uint64 uint64_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t +*/ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":754 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t +*/ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":761 + * ctypedef double complex complex128_t + * + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * +*/ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":762 + * + * ctypedef npy_longlong longlong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t +*/ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":764 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * +*/ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":765 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t +*/ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":767 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t +*/ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":768 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * +*/ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":769 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef float complex cfloat_t +*/ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* #### Code section: complex_type_declarations ### */ +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< long double > __pyx_t_long_double_complex; + #else + typedef long double _Complex __pyx_t_long_double_complex; + #endif +#else + typedef struct { long double real, imag; } __pyx_t_long_double_complex; +#endif +static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_10morphology_Morphology; +struct __pyx_obj_5spacy_5vocab_Vocab; +struct __pyx_obj_5spacy_6tokens_3doc_Doc; +struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher; +struct __pyx_obj_5spacy_6lexeme_Lexeme; +struct __pyx_obj_5spacy_9tokenizer_Tokenizer; +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe; +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain; +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr; +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr; +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr; +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes; +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes; +struct __pyx_array_obj; +struct __pyx_MemviewEnum_obj; +struct __pyx_memoryview_obj; +struct __pyx_memoryviewslice_obj; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; + +/* "parts_of_speech.pxd":4 + * + * + * cpdef enum univ_pos_t: # <<<<<<<<<<<<<< + * NO_TAG = 0 + * ADJ = symbols.ADJ +*/ +enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t { + + /* "parts_of_speech.pxd":6 + * cpdef enum univ_pos_t: + * NO_TAG = 0 + * ADJ = symbols.ADJ # <<<<<<<<<<<<<< + * ADP + * ADV +*/ + __pyx_e_5spacy_15parts_of_speech_NO_TAG = 0, + __pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_15parts_of_speech_ADP, + __pyx_e_5spacy_15parts_of_speech_ADV, + __pyx_e_5spacy_15parts_of_speech_AUX, + __pyx_e_5spacy_15parts_of_speech_CONJ, + __pyx_e_5spacy_15parts_of_speech_CCONJ, + __pyx_e_5spacy_15parts_of_speech_DET, + __pyx_e_5spacy_15parts_of_speech_INTJ, + __pyx_e_5spacy_15parts_of_speech_NOUN, + __pyx_e_5spacy_15parts_of_speech_NUM, + __pyx_e_5spacy_15parts_of_speech_PART, + __pyx_e_5spacy_15parts_of_speech_PRON, + __pyx_e_5spacy_15parts_of_speech_PROPN, + __pyx_e_5spacy_15parts_of_speech_PUNCT, + __pyx_e_5spacy_15parts_of_speech_SCONJ, + __pyx_e_5spacy_15parts_of_speech_SYM, + __pyx_e_5spacy_15parts_of_speech_VERB, + __pyx_e_5spacy_15parts_of_speech_X, + __pyx_e_5spacy_15parts_of_speech_EOL, + __pyx_e_5spacy_15parts_of_speech_SPACE +}; +struct __pyx_t_5spacy_7structs_LexemeC; +struct __pyx_t_5spacy_7structs_SpanC; +struct __pyx_t_5spacy_7structs_TokenC; +struct __pyx_t_5spacy_7structs_MorphAnalysisC; +struct __pyx_t_5spacy_7structs_KBEntryC; +struct __pyx_t_5spacy_7structs_AliasC; +struct __pyx_t_5spacy_7structs_EdgeC; +struct __pyx_t_5spacy_7structs_GraphC; + +/* "structs.pxd":10 + * + * + * cdef struct LexemeC: # <<<<<<<<<<<<<< + * flags_t flags + * +*/ +struct __pyx_t_5spacy_7structs_LexemeC { + __pyx_t_5spacy_8typedefs_flags_t flags; + __pyx_t_5spacy_8typedefs_attr_t lang; + __pyx_t_5spacy_8typedefs_attr_t id; + __pyx_t_5spacy_8typedefs_attr_t length; + __pyx_t_5spacy_8typedefs_attr_t orth; + __pyx_t_5spacy_8typedefs_attr_t lower; + __pyx_t_5spacy_8typedefs_attr_t norm; + __pyx_t_5spacy_8typedefs_attr_t shape; + __pyx_t_5spacy_8typedefs_attr_t prefix; + __pyx_t_5spacy_8typedefs_attr_t suffix; +}; + +/* "structs.pxd":26 + * + * + * cdef struct SpanC: # <<<<<<<<<<<<<< + * hash_t id + * int start +*/ +struct __pyx_t_5spacy_7structs_SpanC { + __pyx_t_5spacy_8typedefs_hash_t id; + int start; + int end; + int start_char; + int end_char; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_attr_t kb_id; +}; + +/* "structs.pxd":36 + * + * + * cdef struct TokenC: # <<<<<<<<<<<<<< + * const LexemeC* lex + * uint64_t morph +*/ +struct __pyx_t_5spacy_7structs_TokenC { + struct __pyx_t_5spacy_7structs_LexemeC const *lex; + uint64_t morph; + enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos; + int spacy; + __pyx_t_5spacy_8typedefs_attr_t tag; + int idx; + __pyx_t_5spacy_8typedefs_attr_t lemma; + __pyx_t_5spacy_8typedefs_attr_t norm; + int head; + __pyx_t_5spacy_8typedefs_attr_t dep; + uint32_t l_kids; + uint32_t r_kids; + uint32_t l_edge; + uint32_t r_edge; + int sent_start; + int ent_iob; + __pyx_t_5spacy_8typedefs_attr_t ent_type; + __pyx_t_5spacy_8typedefs_attr_t ent_kb_id; + __pyx_t_5spacy_8typedefs_hash_t ent_id; +}; + +/* "structs.pxd":60 + * + * + * cdef struct MorphAnalysisC: # <<<<<<<<<<<<<< + * hash_t key + * int length +*/ +struct __pyx_t_5spacy_7structs_MorphAnalysisC { + __pyx_t_5spacy_8typedefs_hash_t key; + int length; + __pyx_t_5spacy_8typedefs_attr_t *fields; + __pyx_t_5spacy_8typedefs_attr_t *features; +}; + +/* "structs.pxd":69 + * + * # Internal struct, for storage and disambiguation of entities. + * cdef struct KBEntryC: # <<<<<<<<<<<<<< + * + * # The hash of this entry's unique ID/name in the kB +*/ +struct __pyx_t_5spacy_7structs_KBEntryC { + __pyx_t_5spacy_8typedefs_hash_t entity_hash; + int32_t vector_index; + int32_t feats_row; + float freq; +}; + +/* "structs.pxd":88 + * # Each alias struct stores a list of Entry pointers with their prior probabilities + * # for this specific mention/alias. + * cdef struct AliasC: # <<<<<<<<<<<<<< + * + * # All entry candidates for this alias +*/ +struct __pyx_t_5spacy_7structs_AliasC { + std::vector entry_indices; + std::vector probs; +}; + +/* "structs.pxd":97 + * + * + * cdef struct EdgeC: # <<<<<<<<<<<<<< + * hash_t label + * int32_t head +*/ +struct __pyx_t_5spacy_7structs_EdgeC { + __pyx_t_5spacy_8typedefs_hash_t label; + int32_t head; + int32_t tail; +}; + +/* "structs.pxd":103 + * + * + * cdef struct GraphC: # <<<<<<<<<<<<<< + * vector[vector[int32_t]] nodes + * vector[EdgeC] edges +*/ +struct __pyx_t_5spacy_7structs_GraphC { + std::vector > nodes; + std::vector edges; + std::vector weights; + std::vector n_heads; + std::vector n_tails; + std::vector first_head; + std::vector first_tail; + std::unordered_set *roots; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *node_map; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *edge_map; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; +union __pyx_t_5spacy_5vocab_LexemesOrTokens; +struct __pyx_t_5spacy_5vocab__Cached; + +/* "vocab.pxd":15 + * + * + * cdef union LexemesOrTokens: # <<<<<<<<<<<<<< + * const LexemeC* const* lexemes + * const TokenC* tokens +*/ +union __pyx_t_5spacy_5vocab_LexemesOrTokens { + struct __pyx_t_5spacy_7structs_LexemeC const *const *lexemes; + struct __pyx_t_5spacy_7structs_TokenC const *tokens; +}; + +/* "vocab.pxd":20 + * + * + * cdef struct _Cached: # <<<<<<<<<<<<<< + * LexemesOrTokens data + * bint is_lex +*/ +struct __pyx_t_5spacy_5vocab__Cached { + union __pyx_t_5spacy_5vocab_LexemesOrTokens data; + int is_lex; + int length; +}; + +/* "tokens/doc.pxd":14 + * + * + * ctypedef const LexemeC* const_Lexeme_ptr # <<<<<<<<<<<<<< + * ctypedef const TokenC* const_TokenC_ptr + * +*/ +typedef struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr; + +/* "tokens/doc.pxd":15 + * + * ctypedef const LexemeC* const_Lexeme_ptr + * ctypedef const TokenC* const_TokenC_ptr # <<<<<<<<<<<<<< + * + * ctypedef fused LexemeOrToken: +*/ +typedef struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr; + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_10morphology_Morphology { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_7preshed_4maps_PreshMap *tags; +}; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_5vocab_Vocab { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_5spacy_10morphology_Morphology *morphology; + PyObject *_vectors; + PyObject *_lookups; + PyObject *writing_system; + PyObject *get_noun_chunks; + int length; + PyObject *_unused_object; + PyObject *lex_attr_getters; + PyObject *cfg; + struct __pyx_obj_7preshed_4maps_PreshMap *_by_orth; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; + std::vector<__pyx_t_5spacy_8typedefs_attr_t> _transient_orths; +}; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6tokens_3doc_Doc { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + PyObject *_vector; + PyObject *_vector_norm; + PyObject *tensor; + PyObject *cats; + PyObject *user_data; + PyObject *spans; + struct __pyx_t_5spacy_7structs_TokenC *c; + float sentiment; + PyObject *user_hooks; + PyObject *user_token_hooks; + PyObject *user_span_hooks; + int has_unknown_spaces; + PyObject *_context; + int length; + int max_length; + PyObject *noun_chunks_iterator; + PyObject *__weakref__; +}; + + +/* "matcher/phrasematcher.pxd":11 + * + * + * cdef class PhraseMatcher: # <<<<<<<<<<<<<< + * cdef readonly Vocab vocab + * cdef attr_id_t attr +*/ +struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7matcher_13phrasematcher_PhraseMatcher *__pyx_vtab; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + enum __pyx_t_5spacy_5attrs_attr_id_t attr; + PyObject *_callbacks; + PyObject *_docs; + int _validate; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + __pyx_t_7preshed_4maps_key_t _terminal_hash; +}; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6lexeme_Lexeme { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtab; + struct __pyx_t_5spacy_7structs_LexemeC *c; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + __pyx_t_5spacy_8typedefs_attr_t orth; +}; + + +/* "spacy/tokenizer.pxd":13 + * + * + * cdef class Tokenizer: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef PreshMap _cache +*/ +struct __pyx_obj_5spacy_9tokenizer_Tokenizer { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_7preshed_4maps_PreshMap *_cache; + struct __pyx_obj_7preshed_4maps_PreshMap *_specials; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + PyObject *_token_match; + PyObject *_url_match; + PyObject *_prefix_search; + PyObject *_suffix_search; + PyObject *_infix_finditer; + PyObject *_rules; + struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher *_special_matcher; + int _faster_heuristics; + int max_cache_size; +}; + + +/* "spacy/tokenizer.pyx":212 + * return doc + * + * def pipe(self, texts, batch_size=1000): # <<<<<<<<<<<<<< + * """Tokenize a stream of texts. + * +*/ +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe { + PyObject_HEAD + PyObject *__pyx_v_batch_size; + struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self; + PyObject *__pyx_v_text; + PyObject *__pyx_v_texts; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "spacy/tokenizer.pyx":631 + * self._load_special_cases(self._rules) + * + * def explain(self, text): # <<<<<<<<<<<<<< + * """A debugging tokenizer that provides information about which + * tokenizer rule or pattern was matched for each token. The tokens +*/ +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain { + PyObject_HEAD + struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self; +}; + + +/* "spacy/tokenizer.pyx":665 + * while substring: + * if substring in special_cases: + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) # <<<<<<<<<<<<<< + * substring = '' + * continue +*/ +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr { + PyObject_HEAD + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *__pyx_outer_scope; + PyObject *__pyx_genexpr_arg_0; + PyObject *__pyx_v_e; + PyObject *__pyx_v_i; + PyObject *__pyx_t_0; + PyObject *__pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); +}; + + +/* "spacy/tokenizer.pyx":674 + * break + * if substring in special_cases: + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) # <<<<<<<<<<<<<< + * substring = '' + * break +*/ +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr { + PyObject_HEAD + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *__pyx_outer_scope; + PyObject *__pyx_genexpr_arg_0; + PyObject *__pyx_v_e; + PyObject *__pyx_v_i; + PyObject *__pyx_t_0; + PyObject *__pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); +}; + + +/* "spacy/tokenizer.pyx":702 + * substring = '' + * elif substring in special_cases: + * tokens.extend((f"SPECIAL-{i + 1}", self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) # <<<<<<<<<<<<<< + * substring = '' + * elif list(infix_finditer(substring)): +*/ +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr { + PyObject_HEAD + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *__pyx_outer_scope; + PyObject *__pyx_genexpr_arg_0; + PyObject *__pyx_v_e; + PyObject *__pyx_v_i; + PyObject *__pyx_t_0; + PyObject *__pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); +}; + + +/* "spacy/tokenizer.pyx":790 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes { + PyObject_HEAD + PyObject *__pyx_v_exclude; + struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self; +}; + + +/* "spacy/tokenizer.pyx":810 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, bytes_data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes { + PyObject_HEAD + PyObject *__pyx_v_data; + PyObject *__pyx_v_exclude; + struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self; +}; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ +struct __pyx_array_obj { + PyObject_HEAD + struct __pyx_vtabstruct_array *__pyx_vtab; + char *data; + Py_ssize_t len; + char *format; + int ndim; + Py_ssize_t *_shape; + Py_ssize_t *_strides; + Py_ssize_t itemsize; + PyObject *mode; + PyObject *_format; + void (*callback_free_data)(void *); + int free_data; + int dtype_is_object; +}; + + +/* "View.MemoryView":299 + * + * + * @cname('__pyx_MemviewEnum') # <<<<<<<<<<<<<< + * cdef class Enum(object): + * cdef object name +*/ +struct __pyx_MemviewEnum_obj { + PyObject_HEAD + PyObject *name; +}; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ +struct __pyx_memoryview_obj { + PyObject_HEAD + struct __pyx_vtabstruct_memoryview *__pyx_vtab; + PyObject *obj; + PyObject *_size; + void *_unused; + PyThread_type_lock lock; + __pyx_atomic_int_type acquisition_count; + Py_buffer view; + int flags; + int dtype_is_object; + __Pyx_TypeInfo const *typeinfo; +}; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ +struct __pyx_memoryviewslice_obj { + struct __pyx_memoryview_obj __pyx_base; + __Pyx_memviewslice from_slice; + PyObject *from_object; + PyObject *(*to_object_func)(char *); + int (*to_dtype_func)(char *, PyObject *); +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_10morphology_Morphology { + struct __pyx_t_5spacy_7structs_MorphAnalysisC (*create_morph_tag)(struct __pyx_obj_5spacy_10morphology_Morphology *, PyObject *); + int (*insert)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_MorphAnalysisC); +}; +static struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtabptr_5spacy_10morphology_Morphology; + + +/* "vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_5vocab_Vocab { + struct __pyx_t_5spacy_7structs_LexemeC const *(*get)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*get_by_orth)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8typedefs_attr_t); + struct __pyx_t_5spacy_7structs_TokenC const *(*make_fused_token)(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*_new_lexeme)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + int (*_add_lex_to_vocab)(struct __pyx_obj_5spacy_5vocab_Vocab *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_t_5spacy_7structs_LexemeC const *, int); +}; +static struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtabptr_5spacy_5vocab_Vocab; + + +/* "tokens/doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc { + PyArrayObject *(*to_array)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, PyObject *, int __pyx_skip_dispatch); + int (*__pyx_fuse_0push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr, int); + int (*__pyx_fuse_1push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr, int); +}; +static struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtabptr_5spacy_6tokens_3doc_Doc; + + +/* "matcher/phrasematcher.pxd":11 + * + * + * cdef class PhraseMatcher: # <<<<<<<<<<<<<< + * cdef readonly Vocab vocab + * cdef attr_id_t attr +*/ + +struct __pyx_vtabstruct_5spacy_7matcher_13phrasematcher_PhraseMatcher { + void (*find_matches)(struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *, int, int, std::vector *); +}; +static struct __pyx_vtabstruct_5spacy_7matcher_13phrasematcher_PhraseMatcher *__pyx_vtabptr_5spacy_7matcher_13phrasematcher_PhraseMatcher; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme { + struct __pyx_obj_5spacy_6lexeme_Lexeme *(*from_ptr)(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); + void (*set_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_attr_t (*get_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_check_flag)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_set_flag)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); +}; +static struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtabptr_5spacy_6lexeme_Lexeme; +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); + + +/* "spacy/tokenizer.pyx":25 + * + * + * cdef class Tokenizer: # <<<<<<<<<<<<<< + * """Segment text, and create Doc objects with the discovered segment + * boundaries. +*/ + +struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer { + struct __pyx_obj_5spacy_6tokens_3doc_Doc *(*_tokenize_affixes)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, PyObject *, int); + int (*_apply_special_cases)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); + void (*_filter_special_spans)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, std::vector &, std::vector &, int); + PyObject *(*_prepare_special_spans)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *, std::vector &); + int (*_retokenize_special_spans)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *, struct __pyx_t_5spacy_7structs_TokenC *, PyObject *); + int (*_try_specials_and_cache)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_obj_5spacy_6tokens_3doc_Doc *, int *, int); + int (*_tokenize)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *, PyObject *, __pyx_t_5spacy_8typedefs_hash_t, int *, int); + PyObject *(*_split_affixes)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *, std::vector *, std::vector *, int *, int); + int (*_attach_tokens)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *, PyObject *, std::vector *, std::vector *, int *, int); + int (*_save_cached)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_t_5spacy_7structs_TokenC const *, __pyx_t_5spacy_8typedefs_hash_t, int *, int); +}; +static struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *__pyx_vtabptr_5spacy_9tokenizer_Tokenizer; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ + +struct __pyx_vtabstruct_array { + PyObject *(*get_memview)(struct __pyx_array_obj *); +}; +static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ + +struct __pyx_vtabstruct_memoryview { + char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); + PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); +}; +static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ + +struct __pyx_vtabstruct__memoryviewslice { + struct __pyx_vtabstruct_memoryview __pyx_base; +}; +static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### Code section: utility_code_proto ### */ + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto (used by PyErrFetchRestore) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* TupleAndListFromArray.proto (used by fastcall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +#endif +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto (used by BytesEquals) */ +#include + +/* BytesEquals.proto (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i)) +#else + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i)) +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i]) + #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); + #else + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #endif +#else + #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS +#endif +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start) +#else +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* py_dict_items.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); + +/* CallCFunction.proto (used by CallUnboundCMethod0) */ +#define __Pyx_CallCFunction(cfunc, self, args)\ + ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args) +#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\ + ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs) +#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\ + ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs) +#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ + ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) + +/* PyObjectCall.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto (used by PyObjectCallOneArg) */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); + +/* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ +typedef struct { + PyObject *type; + PyObject **method_name; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS + __pyx_atomic_int_type initialized; +#endif + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) { +#if !CYTHON_ATOMICS + return 1; +#else + __pyx_nonatomic_int_type expected = 0; + if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) { + return 0; + } + return expected; +#endif +} +static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) { +#if CYTHON_ATOMICS + __pyx_atomic_store(&cfunc->initialized, 2); +#endif +} +#else +#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2 +#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc) +#endif + +/* CallUnboundCMethod0.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#else +#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) +#endif + +/* py_dict_values.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); + +/* OwnedDictNext.proto (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue); +#else +CYTHON_INLINE +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue); +#endif + +/* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywordsImpl.export */ +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name +); +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* CallUnboundCMethod2.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); +#else +#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) +#endif + +/* ParseKeywords.proto */ +static CYTHON_INLINE int __Pyx_ParseKeywords( + PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[], + PyObject *kwds2, PyObject *values[], + Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* ArgTypeTestFunc.export */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) + +/* PyValueError_Check.proto */ +#define __Pyx_PyExc_ValueError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ValueError) + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* PyObjectFastCallMethod.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) +#else +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); +#endif + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* PyMemoryError_Check.proto */ +#define __Pyx_PyExc_MemoryError_Check(obj) __Pyx_TypeCheck(obj, PyExc_MemoryError) + +/* BuildPyUnicode.proto (used by COrdinalToPyUnicode) */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength, + int prepend_sign, char padding_char); + +/* COrdinalToPyUnicode.proto (used by CIntToPyUnicode) */ +static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value); +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t width, char padding_char); + +/* GCCDiagnostics.proto (used by CIntToPyUnicode) */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* IncludeStdlibH.proto (used by CIntToPyUnicode) */ +#include + +/* CIntToPyUnicode.proto */ +#define __Pyx_PyUnicode_From_int(value, width, padding_char, format_char) (\ + ((format_char) == ('c')) ?\ + __Pyx_uchar___Pyx_PyUnicode_From_int(value, width, padding_char) :\ + __Pyx____Pyx_PyUnicode_From_int(value, width, padding_char, format_char)\ + ) +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char); +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); + +/* CIntToPyUnicode.proto */ +#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\ + ((format_char) == ('c')) ?\ + __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\ + __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\ + ) +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char); +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char); + +/* JoinPyUnicode.export */ +static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char); + +/* PyObjectFormatSimple.proto */ +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#elif CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ + likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ + PyObject_Format(s, f)) +#else + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#endif + +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); + +/* PyTypeError_Check.proto */ +#define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t, int b_is_constant); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + +/* PyDictVersioning.proto (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000 + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + +/* PyAssertionError_Check.proto */ +#define __Pyx_PyExc_AssertionError_Check(obj) __Pyx_TypeCheck(obj, PyExc_AssertionError) + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* GetTopmostException.proto (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* SwapException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* HasAttr.proto (used by ImportImpl) */ +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n) +#else +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +#endif + +/* ImportImpl.export */ +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); + +/* Import.proto */ +static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level); + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { + return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); +} +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +#ifdef PyExceptionInstance_Check + #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) +#else + #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) +#endif + +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +/* ListCompAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + L->ob_item[len] = x; + #else + PyList_SET_ITEM(list, len, x); + #endif + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); + +/* PyObjectFormatAndDecref.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f); +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f); + +/* PyObjectFormat.proto */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f); +#else +#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f) +#endif + +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* RaiseUnboundLocalError.proto */ +static void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* PyIndexError_Check.proto */ +#define __Pyx_PyExc_IndexError_Check(obj) __Pyx_TypeCheck(obj, PyExc_IndexError) + +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long, int b_is_constant); + +/* PyImportError_Check.proto */ +#define __Pyx_PyExc_ImportError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ImportError) + +/* tp_new.proto */ +#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL) +static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs); + +/* PyObjectDelAttr.proto (used by PyObjectSetAttrStr) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +#define __Pyx_PyObject_DelAttr(o, n) PyObject_SetAttr(o, n, NULL) +#else +#define __Pyx_PyObject_DelAttr(o, n) PyObject_DelAttr(o, n) +#endif + +/* PyObjectSetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); +#else +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif + +/* PyObjectVectorCallKwBuilder.proto (used by PyObjectVectorCallMethodKwBuilder) */ +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#if CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall +#endif +#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict +#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) +#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) +#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) +#endif + +/* PyObjectVectorCallMethodKwBuilder.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod +#else +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#endif + +/* py_unicode_predicate.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_Py_UNICODE_ISSPACE(Py_UCS4 uchar); +#else +#define __Pyx_Py_UNICODE_ISSPACE(u) Py_UNICODE_ISSPACE(u) +#endif + +/* SetStringIndexingError.proto (used by GetItemIntUnicode) */ +static void __Pyx_SetStringIndexingError(const char* message, int has_gil); + +/* GetItemIntUnicode.proto */ +#define __Pyx_GetItemInt_Unicode(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Unicode_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, has_gil) :\ + (__Pyx_SetStringIndexingError("string index out of range", has_gil), (Py_UCS4)-1)) +static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py_ssize_t i, + int wraparound, int boundscheck, int has_gil); + +/* unicode_iter.proto */ +static CYTHON_INLINE int __Pyx_init_unicode_iteration( + PyObject* ustring, Py_ssize_t *length, void** data, int *kind); + +/* PyUnicode_Substring.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring( + PyObject* text, Py_ssize_t start, Py_ssize_t stop); + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* SliceObject.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* PyLongCompare.proto */ +static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* PyUnicodeContains.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_ContainsTF(PyObject* substring, PyObject* text, int eq) { + int result = PyUnicode_Contains(text, substring); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* PyLongBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) +#endif + +/* PyObject_Unicode.proto */ +#define __Pyx_PyObject_Unicode(obj)\ + (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) + +/* RaiseClosureNameError.proto */ +static void __Pyx_RaiseClosureNameError(const char *varname); + +/* PyDictContains.proto */ +static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* ListExtend.proto */ +static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00a2 + return PyList_Extend(L, v); +#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 + PyObject* none = _PyList_Extend((PyListObject*)L, v); + if (unlikely(!none)) + return -1; + Py_DECREF(none); + return 0; +#else + return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); +#endif +} + +/* DictGetItem.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); +#define __Pyx_PyObject_Dict_GetItem(obj, name)\ + (likely(PyDict_CheckExact(obj)) ?\ + __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) +#else +#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) +#endif + +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + L->ob_item[len] = x; + #else + PyList_SET_ITEM(list, len, x); + #endif + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +/* PyLongCompare.proto */ +static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* PyObjectLookupSpecial.proto */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0) +#define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1) +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error); +#else +#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n) +#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) +#endif + +/* dict_setdefault.proto (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); + +/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp); +#endif + +/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v); +#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v) + +/* FixUpExtensionType.proto (used by FetchCommonType) */ +static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); + +/* AddModuleRef.proto (used by FetchSharedCythonModule) */ +#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ + __PYX_LIMITED_VERSION_HEX < 0x030d0000) + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); +#else + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#endif + +/* FetchSharedCythonModule.proto (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto (used by CommonTypesMetaclass) */ +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases); + +/* CommonTypesMetaclass.proto (used by CythonFunctionShared) */ +static int __pyx_CommonTypesMetaclass_init(PyObject *module); +#define __Pyx_CommonTypesMetaclass_USED + +/* CallTypeTraverse.proto (used by CythonFunctionShared) */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0 +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg); +#endif + +/* PyMethodNew.proto (used by CythonFunctionShared) */ +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ); + +/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto (used by CythonFunction) */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_dict; +#endif + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + PyObject *defaults; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#undef __Pyx_CyOrPyCFunction_Check +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType) +#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType) +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)); +#undef __Pyx_IsSameCFunction +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, + PyTypeObject *defaults_type); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* AllocateExtensionType.proto */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); + +/* CheckTypeForFreelists.proto */ +#if CYTHON_USE_FREELISTS +#if CYTHON_USE_TYPE_SPECS +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT +#else +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE) +#endif +#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\ + (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\ + (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS))) +#endif + +/* DefaultPlacementNew.proto */ +#include +template +void __Pyx_default_placement_construct(T* x) { + new (static_cast(x)) T(); +} + +/* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); +#endif + +/* PyObjectCallMethod0.proto (used by PyType_Ready) */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto (used by PyType_Ready) */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* GetVTable.proto (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +static int __Pyx_MergeVtables(PyTypeObject *type); + +/* DelItemOnTypeDict.proto (used by SetupReduce) */ +static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k); +#define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k) + +/* SetupReduce.proto */ +static int __Pyx_setup_reduce(PyObject* type_obj); + +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* VoidPtrImport.proto */ +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig); + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* CLineInTraceback.proto (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#else +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#endif + +/* CodeObjectCache.proto (used by AddTraceback) */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject __Pyx_CachedCodeObjectType; +#else +typedef PyCodeObject __Pyx_CachedCodeObjectType; +#endif +typedef struct { + __Pyx_CachedCodeObjectType* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_int_type accessor_count; + #endif +}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* UnicodeAsUCS4.proto */ +static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*); + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* RealImag.proto */ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(__cplusplus) && CYTHON_CCOMPLEX\ + && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_double(a, b) ((a)==(b)) + #define __Pyx_c_sum_double(a, b) ((a)+(b)) + #define __Pyx_c_diff_double(a, b) ((a)-(b)) + #define __Pyx_c_prod_double(a, b) ((a)*(b)) + #define __Pyx_c_quot_double(a, b) ((a)/(b)) + #define __Pyx_c_neg_double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_double(z) ((z)==(double)0) + #define __Pyx_c_conj_double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (::std::abs(z)) + #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_double(z) ((z)==0) + #define __Pyx_c_conj_double(z) (conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (cabs(z)) + #define __Pyx_c_pow_double(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_long__double(a, b) ((a)==(b)) + #define __Pyx_c_sum_long__double(a, b) ((a)+(b)) + #define __Pyx_c_diff_long__double(a, b) ((a)-(b)) + #define __Pyx_c_prod_long__double(a, b) ((a)*(b)) + #define __Pyx_c_quot_long__double(a, b) ((a)/(b)) + #define __Pyx_c_neg_long__double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0) + #define __Pyx_c_conj_long__double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (::std::abs(z)) + #define __Pyx_c_pow_long__double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_long__double(z) ((z)==0) + #define __Pyx_c_conj_long__double(z) (conjl(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (cabsl(z)) + #define __Pyx_c_pow_long__double(a, b) (cpowl(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex); + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + #endif +#endif + +/* BufferStructDeclare.proto */ +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +/* MemviewRefcount.proto */ +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + +/* MemviewSliceIsContig.proto */ +static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim); + +/* OverlappingSlices.proto */ +static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize); + +/* MemviewSliceInit.proto */ +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* ObjectAsUCS4.proto */ +static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject*); +static CYTHON_INLINE Py_UCS4 __Pyx_PyObject_AsPy_UCS4(PyObject *x) { + return (likely(PyUnicode_Check(x)) ? __Pyx_PyUnicode_AsPy_UCS4(x) : __Pyx__PyObject_AsPy_UCS4(x)); +} + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* MemviewSliceCopy.proto */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object); + +/* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectCallMethod1.proto (used by UpdateUnpickledDict) */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* UpdateUnpickledDict.proto */ +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index); + +/* CheckUnpickleChecksum.proto */ +static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members); + +/* CIntFromPy.proto */ +static CYTHON_INLINE char __Pyx_PyLong_As_char(PyObject *); + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#else +static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); +#endif +#else // !LIMITED_API +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + +/* GetRuntimeVersion.proto */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +static unsigned long __Pyx_cached_runtime_version = 0; +static void __Pyx_init_runtime_version(void); +#else +#define __Pyx_init_runtime_version() +#endif +static unsigned long __Pyx_get_runtime_version(void); + +/* IterNextPlain.proto (used by CoroutineBase) */ +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void); +#endif + +/* ReturnWithStopIteration.proto (used by CoroutineBase) */ +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext); + +/* CoroutineBase.proto (used by Generator) */ +struct __pyx_CoroutineObject; +typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_ExcInfoStruct _PyErr_StackItem +#else +typedef struct { + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; +} __Pyx_ExcInfoStruct; +#endif +typedef struct __pyx_CoroutineObject { + PyObject_HEAD + __pyx_coroutine_body_t body; + PyObject *closure; + __Pyx_ExcInfoStruct gi_exc_state; +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *gi_weakreflist; +#endif + PyObject *classobj; + PyObject *yieldfrom; + __Pyx_pyiter_sendfunc yieldfrom_am_send; + PyObject *gi_name; + PyObject *gi_qualname; + PyObject *gi_modulename; + PyObject *gi_code; + PyObject *gi_frame; +#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE) + PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count]; + uint64_t __pyx_pymonitoring_version; +#endif + int resume_label; + char is_running; +} __pyx_CoroutineObject; +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); +static int __Pyx_Coroutine_clear(PyObject *self); +static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval); +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); +static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval); +static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_Coroutine_SwapException(self) +#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) +#else +#define __Pyx_Coroutine_SwapException(self) {\ + __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ + __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ + } +#define __Pyx_Coroutine_ResetAndClearException(self) {\ + __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ + (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ + } +#endif +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) +#endif +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen); +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen); +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen); +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure); +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send); +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg); + +/* Generator.proto */ +#define __Pyx_Generator_USED +#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType) +#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\ + __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name) +static PyObject *__Pyx_Generator_Next(PyObject *self); +static int __pyx_Generator_init(PyObject *module); +static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self); + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); + +/* DecompressString.proto */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); + +/* MultiPhaseInitModuleState.proto */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +static PyObject *__Pyx_State_FindModule(void*); +static int __Pyx_State_AddModule(PyObject* module, void*); +static int __Pyx_State_RemoveModule(void*); +#elif CYTHON_USE_MODULE_STATE +#define __Pyx_State_FindModule PyState_FindModule +#define __Pyx_State_AddModule PyState_AddModule +#define __Pyx_State_RemoveModule PyState_RemoveModule +#endif + +/* #### Code section: module_declarations ### */ +/* CythonABIVersion.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API + #if CYTHON_METH_FASTCALL + #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" + #else + #define __PYX_FASTCALL_ABI_SUFFIX + #endif + #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#else + #define __PYX_LIMITED_ABI_SUFFIX +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + #define __PYX_AM_SEND_ABI_SUFFIX +#elif __PYX_HAS_PY_AM_SEND == 2 + #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" +#else + #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" +#endif +#ifndef __PYX_MONITORING_ABI_SUFFIX + #define __PYX_MONITORING_ABI_SUFFIX +#endif +#if CYTHON_USE_TP_FINALIZE + #define __PYX_TP_FINALIZE_ABI_SUFFIX +#else + #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" +#endif +#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) + #define __PYX_FREELISTS_ABI_SUFFIX +#else + #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" +#endif +#define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab); /* proto*/ +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value); /* proto*/ +static struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_f_5spacy_9tokenizer_9Tokenizer__tokenize_affixes(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_string, int __pyx_v_with_special_cases); /* proto*/ +static int __pyx_f_5spacy_9tokenizer_9Tokenizer__apply_special_cases(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc); /* proto*/ +static void __pyx_f_5spacy_9tokenizer_9Tokenizer__filter_special_spans(CYTHON_UNUSED struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, std::vector &__pyx_v_original, std::vector &__pyx_v_filtered, CYTHON_UNUSED int __pyx_v_doc_len); /* proto*/ +static PyObject *__pyx_f_5spacy_9tokenizer_9Tokenizer__prepare_special_spans(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc, std::vector &__pyx_v_filtered); /* proto*/ +static int __pyx_f_5spacy_9tokenizer_9Tokenizer__retokenize_special_spans(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc, struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_tokens, PyObject *__pyx_v_span_data); /* proto*/ +static int __pyx_f_5spacy_9tokenizer_9Tokenizer__try_specials_and_cache(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_tokens, int *__pyx_v_has_special, int __pyx_v_with_special_cases); /* proto*/ +static int __pyx_f_5spacy_9tokenizer_9Tokenizer__tokenize(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_tokens, PyObject *__pyx_v_span, __pyx_t_5spacy_8typedefs_hash_t __pyx_v_orig_key, int *__pyx_v_has_special, int __pyx_v_with_special_cases); /* proto*/ +static PyObject *__pyx_f_5spacy_9tokenizer_9Tokenizer__split_affixes(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, PyObject *__pyx_v_string, std::vector *__pyx_v_prefixes, std::vector *__pyx_v_suffixes, CYTHON_UNUSED int *__pyx_v_has_special, int __pyx_v_with_special_cases); /* proto*/ +static int __pyx_f_5spacy_9tokenizer_9Tokenizer__attach_tokens(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_tokens, PyObject *__pyx_v_string, std::vector *__pyx_v_prefixes, std::vector *__pyx_v_suffixes, int *__pyx_v_has_special, int __pyx_v_with_special_cases); /* proto*/ +static int __pyx_f_5spacy_9tokenizer_9Tokenizer__save_cached(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_tokens, __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key, int *__pyx_v_has_special, int __pyx_v_n); /* proto*/ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "preshed.maps" */ + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.attrs" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.unordered_map" */ + +/* Module declarations from "libcpp.unordered_set" */ + +/* Module declarations from "spacy.parts_of_speech" */ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "spacy.structs" */ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libc.stdio" */ + +/* Module declarations from "__builtin__" */ + +/* Module declarations from "cpython.type" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "cpython.object" */ + +/* Module declarations from "cpython.ref" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "spacy.strings" */ +static __pyx_t_5spacy_8typedefs_hash_t (*__pyx_f_5spacy_7strings_hash_string)(PyObject *, int __pyx_skip_dispatch); /*proto*/ + +/* Module declarations from "spacy.morphology" */ + +/* Module declarations from "spacy.vocab" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_5vocab_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_5vocab_EMPTY_LEXEME (*__pyx_vp_5spacy_5vocab_EMPTY_LEXEME) + +/* Module declarations from "spacy.tokens.doc" */ + +/* Module declarations from "spacy.matcher.phrasematcher" */ + +/* Module declarations from "cython.view" */ + +/* Module declarations from "cython.dataclasses" */ + +/* Module declarations from "cython" */ + +/* Module declarations from "spacy.lexeme" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_6lexeme_EMPTY_LEXEME (*__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME) +static __pyx_t_5spacy_8typedefs_attr_t *__pyx_vp_5spacy_6lexeme_OOV_RANK = 0; +#define __pyx_v_5spacy_6lexeme_OOV_RANK (*__pyx_vp_5spacy_6lexeme_OOV_RANK) + +/* Module declarations from "spacy.tokenizer" */ +static PyObject *__pyx_collections_abc_Sequence = 0; +static PyObject *generic = 0; +static PyObject *strided = 0; +static PyObject *indirect = 0; +static PyObject *contiguous = 0; +static PyObject *indirect_contiguous = 0; +static int __pyx_memoryview_thread_locks_used; +static PyThread_type_lock __pyx_memoryview_thread_locks[8]; +static int __pyx_f_5spacy_9tokenizer_len_start_cmp(struct __pyx_t_5spacy_7structs_SpanC, struct __pyx_t_5spacy_7structs_SpanC); /*proto*/ +static int __pyx_f_5spacy_9tokenizer_start_cmp(struct __pyx_t_5spacy_7structs_SpanC, struct __pyx_t_5spacy_7structs_SpanC); /*proto*/ +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ +static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char const *, char *); /*proto*/ +static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo const *); /*proto*/ +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ +static PyObject *_unellipsify(PyObject *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ +static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/ +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/ +static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/ +static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/ +static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/ +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/ +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ +static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ +static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.tokenizer" +extern int __pyx_module_is_main_spacy__tokenizer; +int __pyx_module_is_main_spacy__tokenizer = 0; + +/* Implementation of "spacy.tokenizer" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_reversed; +static PyObject *__pyx_builtin_zip; +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin___import__; +static PyObject *__pyx_builtin_Ellipsis; +static PyObject *__pyx_builtin_id; +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer___init__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab, PyObject *__pyx_v_rules, PyObject *__pyx_v_prefix_search, PyObject *__pyx_v_suffix_search, PyObject *__pyx_v_infix_finditer, PyObject *__pyx_v_token_match, PyObject *__pyx_v_url_match, PyObject *__pyx_v_faster_heuristics, PyObject *__pyx_v_max_cache_size); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_11token_match___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_11token_match_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_token_match); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_9url_match___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_9url_match_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_url_match); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_13prefix_search___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_13prefix_search_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_prefix_search); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_13suffix_search___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_13suffix_search_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_suffix_search); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_14infix_finditer___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_14infix_finditer_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_infix_finditer); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_5rules___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_5rules_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_rules); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_17faster_heuristics___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_17faster_heuristics_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_faster_heuristics); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_2__reduce__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_4__call__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_string); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_6pipe(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_texts, CYTHON_UNUSED PyObject *__pyx_v_batch_size); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_9_flush_cache(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_11_reset_cache(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_keys); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_13_flush_specials(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_15find_infix(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_string); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_17find_prefix(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_string); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_19find_suffix(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_string); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_21_load_special_cases(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_special_cases); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_23_validate_special_case(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_chunk, PyObject *__pyx_v_substrings); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_25add_special_case(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_string, PyObject *__pyx_v_substrings); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_27_reload_special_cases(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_7explain_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_7explain_3genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_7explain_6genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_29explain(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_text); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_31score(CYTHON_UNUSED struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_examples, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_33to_disk(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_35from_disk(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda4(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda5(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda6(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda7(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda8(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda9(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda10(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_37to_bytes(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda11(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda12(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda13(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda14(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda15(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda16(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda17(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda18(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_39from_bytes(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_bytes_data, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_5vocab___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_14max_cache_size___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_14max_cache_size_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_5spacy_9tokenizer__get_regex_pattern(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_regex); /* proto */ +static PyObject *__pyx_tp_new_5spacy_9tokenizer_Tokenizer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct__pipe(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_1_explain(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +/* SmallCodeConfig */ +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_7cpython_4type_type; + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyTypeObject *__pyx_ptype_5spacy_10morphology_Morphology; + PyTypeObject *__pyx_ptype_5spacy_5vocab_Vocab; + PyTypeObject *__pyx_ptype_5spacy_6tokens_3doc_Doc; + PyTypeObject *__pyx_ptype_5spacy_7matcher_13phrasematcher_PhraseMatcher; + PyTypeObject *__pyx_ptype_5spacy_6lexeme_Lexeme; + PyObject *__pyx_type_5spacy_9tokenizer_Tokenizer; + PyObject *__pyx_type_5spacy_9tokenizer___pyx_scope_struct__pipe; + PyObject *__pyx_type_5spacy_9tokenizer___pyx_scope_struct_1_explain; + PyObject *__pyx_type_5spacy_9tokenizer___pyx_scope_struct_2_genexpr; + PyObject *__pyx_type_5spacy_9tokenizer___pyx_scope_struct_3_genexpr; + PyObject *__pyx_type_5spacy_9tokenizer___pyx_scope_struct_4_genexpr; + PyObject *__pyx_type_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes; + PyObject *__pyx_type_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes; + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + PyTypeObject *__pyx_ptype_5spacy_9tokenizer_Tokenizer; + PyTypeObject *__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe; + PyTypeObject *__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain; + PyTypeObject *__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr; + PyTypeObject *__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr; + PyTypeObject *__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr; + PyTypeObject *__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes; + PyTypeObject *__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes; + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + PyObject *__pyx_k__8; + PyObject *__pyx_k__9; + PyObject *__pyx_k__10; + PyObject *__pyx_slice[1]; + PyObject *__pyx_tuple[4]; + PyObject *__pyx_codeobj_tab[38]; + PyObject *__pyx_string_tab[338]; + PyObject *__pyx_number_tab[6]; +/* #### Code section: module_state_contents ### */ +/* CommonTypesMetaclass.module_state_decls */ +PyTypeObject *__pyx_CommonTypesMetaclassType; + +/* CachedMethodType.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API +PyObject *__Pyx_CachedMethodType; +#endif + +/* CythonFunctionShared.module_state_decls */ +PyTypeObject *__pyx_CyFunctionType; + + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe *__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct__pipe[8]; +int __pyx_freecount_5spacy_9tokenizer___pyx_scope_struct__pipe; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_1_explain[8]; +int __pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_1_explain; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr *__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_2_genexpr[8]; +int __pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_2_genexpr; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr *__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_3_genexpr[8]; +int __pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_3_genexpr; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr *__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_4_genexpr[8]; +int __pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_4_genexpr; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes[8]; +int __pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes[8]; +int __pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes; +#endif +/* CodeObjectCache.module_state_decls */ +struct __Pyx_CodeObjectCache __pyx_code_cache; + +/* IterNextPlain.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache; +#endif + +/* Generator.module_state_decls */ +PyTypeObject *__pyx_GeneratorType; + +/* #### Code section: module_state_end ### */ +} __pyx_mstatetype; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { +extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) + +#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstatetype __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: constant_name_defines ### */ +#define __pyx_kp_u_ __pyx_string_tab[0] +#define __pyx_kp_u_All_dimensions_preceding_dimensi __pyx_string_tab[1] +#define __pyx_kp_u_Buffer_view_does_not_expose_stri __pyx_string_tab[2] +#define __pyx_kp_u_Can_only_create_a_buffer_that_is __pyx_string_tab[3] +#define __pyx_kp_u_Cannot_assign_to_read_only_memor __pyx_string_tab[4] +#define __pyx_kp_u_Cannot_create_writable_memory_vi __pyx_string_tab[5] +#define __pyx_kp_u_Cannot_index_with_type __pyx_string_tab[6] +#define __pyx_kp_u_Cannot_transpose_memoryview_with __pyx_string_tab[7] +#define __pyx_kp_u_Create_a_Tokenizer_to_create_Doc __pyx_string_tab[8] +#define __pyx_kp_u_Dimension_d_is_not_direct __pyx_string_tab[9] +#define __pyx_kp_u_Empty_shape_tuple_for_cython_arr __pyx_string_tab[10] +#define __pyx_kp_u_Index_out_of_bounds_axis_d __pyx_string_tab[11] +#define __pyx_kp_u_Indirect_dimensions_not_supporte __pyx_string_tab[12] +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_string_tab[13] +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_string_tab[14] +#define __pyx_kp_u_MemoryView_of __pyx_string_tab[15] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[16] +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_string_tab[17] +#define __pyx_kp_u_SPECIAL __pyx_string_tab[18] +#define __pyx_kp_u_Step_may_not_be_zero_axis_d __pyx_string_tab[19] +#define __pyx_kp_u_Tokenizer___init___line_31 __pyx_string_tab[20] +#define __pyx_kp_u_Tokenizer_score __pyx_string_tab[21] +#define __pyx_kp_u_Unable_to_convert_item_to_object __pyx_string_tab[22] +#define __pyx_kp_u__11 __pyx_string_tab[23] +#define __pyx_kp_u__2 __pyx_string_tab[24] +#define __pyx_kp_u__3 __pyx_string_tab[25] +#define __pyx_kp_u__4 __pyx_string_tab[26] +#define __pyx_kp_u__5 __pyx_string_tab[27] +#define __pyx_kp_u__6 __pyx_string_tab[28] +#define __pyx_kp_u__7 __pyx_string_tab[29] +#define __pyx_kp_u_a __pyx_string_tab[30] +#define __pyx_kp_u_add_note __pyx_string_tab[31] +#define __pyx_kp_u_and __pyx_string_tab[32] +#define __pyx_kp_u_at_0x __pyx_string_tab[33] +#define __pyx_kp_u_collections_abc __pyx_string_tab[34] +#define __pyx_kp_u_contiguous_and_direct __pyx_string_tab[35] +#define __pyx_kp_u_contiguous_and_indirect __pyx_string_tab[36] +#define __pyx_kp_u_disable __pyx_string_tab[37] +#define __pyx_kp_u_enable __pyx_string_tab[38] +#define __pyx_kp_u_gc __pyx_string_tab[39] +#define __pyx_kp_u_got __pyx_string_tab[40] +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_string_tab[41] +#define __pyx_kp_u_isenabled __pyx_string_tab[42] +#define __pyx_kp_u_itemsize_0_for_cython_array __pyx_string_tab[43] +#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[44] +#define __pyx_kp_u_numpy__core_multiarray_failed_to __pyx_string_tab[45] +#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[46] +#define __pyx_kp_u_object __pyx_string_tab[47] +#define __pyx_kp_u_self_name_is_not_None __pyx_string_tab[48] +#define __pyx_kp_u_spacy __pyx_string_tab[49] +#define __pyx_kp_u_spacy_attrs __pyx_string_tab[50] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[51] +#define __pyx_kp_u_spacy_re __pyx_string_tab[52] +#define __pyx_kp_u_spacy_scorer __pyx_string_tab[53] +#define __pyx_kp_u_spacy_symbols __pyx_string_tab[54] +#define __pyx_kp_u_spacy_tokenizer_pyx __pyx_string_tab[55] +#define __pyx_kp_u_spacy_tokens __pyx_string_tab[56] +#define __pyx_kp_u_spacy_training __pyx_string_tab[57] +#define __pyx_kp_u_spacy_util __pyx_string_tab[58] +#define __pyx_kp_u_strided_and_direct __pyx_string_tab[59] +#define __pyx_kp_u_strided_and_direct_or_indirect __pyx_string_tab[60] +#define __pyx_kp_u_strided_and_indirect __pyx_string_tab[61] +#define __pyx_kp_u_unable_to_allocate_array_data __pyx_string_tab[62] +#define __pyx_kp_u_unable_to_allocate_shape_and_str __pyx_string_tab[63] +#define __pyx_n_u_ASCII __pyx_string_tab[64] +#define __pyx_n_u_E025 __pyx_string_tab[65] +#define __pyx_n_u_E1005 __pyx_string_tab[66] +#define __pyx_n_u_E997 __pyx_string_tab[67] +#define __pyx_n_u_Ellipsis __pyx_string_tab[68] +#define __pyx_n_u_Errors __pyx_string_tab[69] +#define __pyx_n_u_INFIX __pyx_string_tab[70] +#define __pyx_n_u_NORM __pyx_string_tab[71] +#define __pyx_n_u_ORTH __pyx_string_tab[72] +#define __pyx_n_u_PREFIX __pyx_string_tab[73] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[74] +#define __pyx_n_u_SUFFIX __pyx_string_tab[75] +#define __pyx_n_u_Scorer __pyx_string_tab[76] +#define __pyx_n_u_Sequence __pyx_string_tab[77] +#define __pyx_n_u_Span __pyx_string_tab[78] +#define __pyx_n_u_TOKEN __pyx_string_tab[79] +#define __pyx_n_u_TOKEN_MATCH __pyx_string_tab[80] +#define __pyx_n_u_Tokenizer __pyx_string_tab[81] +#define __pyx_n_u_Tokenizer___reduce __pyx_string_tab[82] +#define __pyx_n_u_Tokenizer__flush_cache __pyx_string_tab[83] +#define __pyx_n_u_Tokenizer__flush_specials __pyx_string_tab[84] +#define __pyx_n_u_Tokenizer__load_special_cases __pyx_string_tab[85] +#define __pyx_n_u_Tokenizer__reload_special_cases __pyx_string_tab[86] +#define __pyx_n_u_Tokenizer__reset_cache __pyx_string_tab[87] +#define __pyx_n_u_Tokenizer__validate_special_case __pyx_string_tab[88] +#define __pyx_n_u_Tokenizer_add_special_case __pyx_string_tab[89] +#define __pyx_n_u_Tokenizer_explain __pyx_string_tab[90] +#define __pyx_n_u_Tokenizer_find_infix __pyx_string_tab[91] +#define __pyx_n_u_Tokenizer_find_prefix __pyx_string_tab[92] +#define __pyx_n_u_Tokenizer_find_suffix __pyx_string_tab[93] +#define __pyx_n_u_Tokenizer_from_bytes __pyx_string_tab[94] +#define __pyx_n_u_Tokenizer_from_disk __pyx_string_tab[95] +#define __pyx_n_u_Tokenizer_pipe __pyx_string_tab[96] +#define __pyx_n_u_Tokenizer_score __pyx_string_tab[97] +#define __pyx_n_u_Tokenizer_to_bytes __pyx_string_tab[98] +#define __pyx_n_u_Tokenizer_to_disk __pyx_string_tab[99] +#define __pyx_n_u_URL_MATCH __pyx_string_tab[100] +#define __pyx_n_u_View_MemoryView __pyx_string_tab[101] +#define __pyx_n_u__6 __pyx_string_tab[102] +#define __pyx_n_u_abc __pyx_string_tab[103] +#define __pyx_n_u_add __pyx_string_tab[104] +#define __pyx_n_u_add_special_case __pyx_string_tab[105] +#define __pyx_n_u_allocate_buffer __pyx_string_tab[106] +#define __pyx_n_u_args __pyx_string_tab[107] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[108] +#define __pyx_n_u_attr __pyx_string_tab[109] +#define __pyx_n_u_attrs __pyx_string_tab[110] +#define __pyx_n_u_b __pyx_string_tab[111] +#define __pyx_n_u_base __pyx_string_tab[112] +#define __pyx_n_u_batch_size __pyx_string_tab[113] +#define __pyx_n_u_bytes_data __pyx_string_tab[114] +#define __pyx_n_u_c __pyx_string_tab[115] +#define __pyx_n_u_cached __pyx_string_tab[116] +#define __pyx_n_u_chunk __pyx_string_tab[117] +#define __pyx_n_u_class __pyx_string_tab[118] +#define __pyx_n_u_class_getitem __pyx_string_tab[119] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[120] +#define __pyx_n_u_close __pyx_string_tab[121] +#define __pyx_n_u_compile __pyx_string_tab[122] +#define __pyx_n_u_count __pyx_string_tab[123] +#define __pyx_n_u_d __pyx_string_tab[124] +#define __pyx_n_u_data __pyx_string_tab[125] +#define __pyx_n_u_deserializers __pyx_string_tab[126] +#define __pyx_n_u_dict __pyx_string_tab[127] +#define __pyx_n_u_do_deprecated __pyx_string_tab[128] +#define __pyx_n_u_doc __pyx_string_tab[129] +#define __pyx_n_u_dtype_is_object __pyx_string_tab[130] +#define __pyx_n_u_e __pyx_string_tab[131] +#define __pyx_n_u_encode __pyx_string_tab[132] +#define __pyx_n_u_end __pyx_string_tab[133] +#define __pyx_n_u_ensure_path __pyx_string_tab[134] +#define __pyx_n_u_enter __pyx_string_tab[135] +#define __pyx_n_u_enumerate __pyx_string_tab[136] +#define __pyx_n_u_error __pyx_string_tab[137] +#define __pyx_n_u_errors __pyx_string_tab[138] +#define __pyx_n_u_examples __pyx_string_tab[139] +#define __pyx_n_u_exc __pyx_string_tab[140] +#define __pyx_n_u_exceptions __pyx_string_tab[141] +#define __pyx_n_u_exclude __pyx_string_tab[142] +#define __pyx_n_u_exit __pyx_string_tab[143] +#define __pyx_n_u_explain __pyx_string_tab[144] +#define __pyx_n_u_explain_locals_genexpr __pyx_string_tab[145] +#define __pyx_n_u_faster_heuristics __pyx_string_tab[146] +#define __pyx_n_u_file __pyx_string_tab[147] +#define __pyx_n_u_filter_spans __pyx_string_tab[148] +#define __pyx_n_u_final_tokens __pyx_string_tab[149] +#define __pyx_n_u_find_infix __pyx_string_tab[150] +#define __pyx_n_u_find_prefix __pyx_string_tab[151] +#define __pyx_n_u_find_suffix __pyx_string_tab[152] +#define __pyx_n_u_finditer __pyx_string_tab[153] +#define __pyx_n_u_flags __pyx_string_tab[154] +#define __pyx_n_u_flush_cache __pyx_string_tab[155] +#define __pyx_n_u_flush_specials __pyx_string_tab[156] +#define __pyx_n_u_format __pyx_string_tab[157] +#define __pyx_n_u_fortran __pyx_string_tab[158] +#define __pyx_n_u_from_bytes __pyx_string_tab[159] +#define __pyx_n_u_from_bytes_locals_lambda __pyx_string_tab[160] +#define __pyx_n_u_from_disk __pyx_string_tab[161] +#define __pyx_n_u_func __pyx_string_tab[162] +#define __pyx_n_u_genexpr __pyx_string_tab[163] +#define __pyx_n_u_get __pyx_string_tab[164] +#define __pyx_n_u_get_regex_pattern __pyx_string_tab[165] +#define __pyx_n_u_get_words_and_spaces __pyx_string_tab[166] +#define __pyx_n_u_getstate __pyx_string_tab[167] +#define __pyx_n_u_i __pyx_string_tab[168] +#define __pyx_n_u_id __pyx_string_tab[169] +#define __pyx_n_u_import __pyx_string_tab[170] +#define __pyx_n_u_in_memory_zone __pyx_string_tab[171] +#define __pyx_n_u_index __pyx_string_tab[172] +#define __pyx_n_u_infix_finditer __pyx_string_tab[173] +#define __pyx_n_u_infixes __pyx_string_tab[174] +#define __pyx_n_u_intify_attrs __pyx_string_tab[175] +#define __pyx_n_u_is_coroutine __pyx_string_tab[176] +#define __pyx_n_u_isspace __pyx_string_tab[177] +#define __pyx_n_u_items __pyx_string_tab[178] +#define __pyx_n_u_itemsize __pyx_string_tab[179] +#define __pyx_n_u_j __pyx_string_tab[180] +#define __pyx_n_u_k __pyx_string_tab[181] +#define __pyx_n_u_key __pyx_string_tab[182] +#define __pyx_n_u_keys __pyx_string_tab[183] +#define __pyx_n_u_kwargs __pyx_string_tab[184] +#define __pyx_n_u_label __pyx_string_tab[185] +#define __pyx_n_u_label_2 __pyx_string_tab[186] +#define __pyx_n_u_lambda __pyx_string_tab[187] +#define __pyx_n_u_length __pyx_string_tab[188] +#define __pyx_n_u_load_special_cases __pyx_string_tab[189] +#define __pyx_n_u_m_id __pyx_string_tab[190] +#define __pyx_n_u_main __pyx_string_tab[191] +#define __pyx_n_u_match __pyx_string_tab[192] +#define __pyx_n_u_matches __pyx_string_tab[193] +#define __pyx_n_u_max_cache_size __pyx_string_tab[194] +#define __pyx_n_u_memview __pyx_string_tab[195] +#define __pyx_n_u_mode __pyx_string_tab[196] +#define __pyx_n_u_module __pyx_string_tab[197] +#define __pyx_n_u_name __pyx_string_tab[198] +#define __pyx_n_u_name_2 __pyx_string_tab[199] +#define __pyx_n_u_ndim __pyx_string_tab[200] +#define __pyx_n_u_new __pyx_string_tab[201] +#define __pyx_n_u_next __pyx_string_tab[202] +#define __pyx_n_u_obj __pyx_string_tab[203] +#define __pyx_n_u_offset __pyx_string_tab[204] +#define __pyx_n_u_open __pyx_string_tab[205] +#define __pyx_n_u_orth __pyx_string_tab[206] +#define __pyx_n_u_pack __pyx_string_tab[207] +#define __pyx_n_u_path __pyx_string_tab[208] +#define __pyx_n_u_pattern __pyx_string_tab[209] +#define __pyx_n_u_pipe __pyx_string_tab[210] +#define __pyx_n_u_pop __pyx_string_tab[211] +#define __pyx_n_u_prefix_search __pyx_string_tab[212] +#define __pyx_n_u_pyx_checksum __pyx_string_tab[213] +#define __pyx_n_u_pyx_state __pyx_string_tab[214] +#define __pyx_n_u_pyx_type __pyx_string_tab[215] +#define __pyx_n_u_pyx_unpickle_Enum __pyx_string_tab[216] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[217] +#define __pyx_n_u_qualname __pyx_string_tab[218] +#define __pyx_n_u_rb __pyx_string_tab[219] +#define __pyx_n_u_re __pyx_string_tab[220] +#define __pyx_n_u_read __pyx_string_tab[221] +#define __pyx_n_u_realloc __pyx_string_tab[222] +#define __pyx_n_u_reduce __pyx_string_tab[223] +#define __pyx_n_u_reduce_cython __pyx_string_tab[224] +#define __pyx_n_u_reduce_ex __pyx_string_tab[225] +#define __pyx_n_u_regex __pyx_string_tab[226] +#define __pyx_n_u_register __pyx_string_tab[227] +#define __pyx_n_u_reload_special_cases __pyx_string_tab[228] +#define __pyx_n_u_reset_cache __pyx_string_tab[229] +#define __pyx_n_u_reversed __pyx_string_tab[230] +#define __pyx_n_u_rules __pyx_string_tab[231] +#define __pyx_n_u_s __pyx_string_tab[232] +#define __pyx_n_u_score __pyx_string_tab[233] +#define __pyx_n_u_score_tokenization __pyx_string_tab[234] +#define __pyx_n_u_scorer __pyx_string_tab[235] +#define __pyx_n_u_search __pyx_string_tab[236] +#define __pyx_n_u_self __pyx_string_tab[237] +#define __pyx_n_u_self_2 __pyx_string_tab[238] +#define __pyx_n_u_send __pyx_string_tab[239] +#define __pyx_n_u_serializers __pyx_string_tab[240] +#define __pyx_n_u_set_name __pyx_string_tab[241] +#define __pyx_n_u_setdefault __pyx_string_tab[242] +#define __pyx_n_u_setstate __pyx_string_tab[243] +#define __pyx_n_u_setstate_cython __pyx_string_tab[244] +#define __pyx_n_u_shape __pyx_string_tab[245] +#define __pyx_n_u_size __pyx_string_tab[246] +#define __pyx_n_u_space __pyx_string_tab[247] +#define __pyx_n_u_spaces __pyx_string_tab[248] +#define __pyx_n_u_spacy_tokenizer __pyx_string_tab[249] +#define __pyx_n_u_span __pyx_string_tab[250] +#define __pyx_n_u_spans __pyx_string_tab[251] +#define __pyx_n_u_spans_by_start __pyx_string_tab[252] +#define __pyx_n_u_spec __pyx_string_tab[253] +#define __pyx_n_u_special_cases __pyx_string_tab[254] +#define __pyx_n_u_special_token __pyx_string_tab[255] +#define __pyx_n_u_special_tokens __pyx_string_tab[256] +#define __pyx_n_u_split __pyx_string_tab[257] +#define __pyx_n_u_stale_special __pyx_string_tab[258] +#define __pyx_n_u_start __pyx_string_tab[259] +#define __pyx_n_u_step __pyx_string_tab[260] +#define __pyx_n_u_stop __pyx_string_tab[261] +#define __pyx_n_u_string __pyx_string_tab[262] +#define __pyx_n_u_strings_map __pyx_string_tab[263] +#define __pyx_n_u_struct __pyx_string_tab[264] +#define __pyx_n_u_substring __pyx_string_tab[265] +#define __pyx_n_u_substrings __pyx_string_tab[266] +#define __pyx_n_u_suffix_search __pyx_string_tab[267] +#define __pyx_n_u_suffixes __pyx_string_tab[268] +#define __pyx_n_u_symbols __pyx_string_tab[269] +#define __pyx_n_u_t __pyx_string_tab[270] +#define __pyx_n_u_t_spaces __pyx_string_tab[271] +#define __pyx_n_u_t_words __pyx_string_tab[272] +#define __pyx_n_u_test __pyx_string_tab[273] +#define __pyx_n_u_text __pyx_string_tab[274] +#define __pyx_n_u_texts __pyx_string_tab[275] +#define __pyx_n_u_throw __pyx_string_tab[276] +#define __pyx_n_u_to_bytes __pyx_string_tab[277] +#define __pyx_n_u_to_bytes_locals_lambda __pyx_string_tab[278] +#define __pyx_n_u_to_disk __pyx_string_tab[279] +#define __pyx_n_u_token_attrs __pyx_string_tab[280] +#define __pyx_n_u_token_match __pyx_string_tab[281] +#define __pyx_n_u_tokens __pyx_string_tab[282] +#define __pyx_n_u_training __pyx_string_tab[283] +#define __pyx_n_u_unpack __pyx_string_tab[284] +#define __pyx_n_u_update __pyx_string_tab[285] +#define __pyx_n_u_url_match __pyx_string_tab[286] +#define __pyx_n_u_util __pyx_string_tab[287] +#define __pyx_n_u_validate_examples __pyx_string_tab[288] +#define __pyx_n_u_validate_special_case __pyx_string_tab[289] +#define __pyx_n_u_value __pyx_string_tab[290] +#define __pyx_n_u_values __pyx_string_tab[291] +#define __pyx_n_u_vocab __pyx_string_tab[292] +#define __pyx_n_u_wb __pyx_string_tab[293] +#define __pyx_n_u_word __pyx_string_tab[294] +#define __pyx_n_u_words __pyx_string_tab[295] +#define __pyx_n_u_write __pyx_string_tab[296] +#define __pyx_n_u_x __pyx_string_tab[297] +#define __pyx_n_u_zip __pyx_string_tab[298] +#define __pyx_kp_b_iso88591_0_Q_q_Q_Q_Q_a_1_IQ_Q_Q_a_O1_M_K __pyx_string_tab[299] +#define __pyx_kp_b_iso88591_1 __pyx_string_tab[300] +#define __pyx_kp_b_iso88591_31D __pyx_string_tab[301] +#define __pyx_kp_b_iso88591_4 __pyx_string_tab[302] +#define __pyx_kp_b_iso88591_4_PPQ __pyx_string_tab[303] +#define __pyx_kp_b_iso88591_86_Je9A __pyx_string_tab[304] +#define __pyx_kp_b_iso88591_8_5Qd __pyx_string_tab[305] +#define __pyx_kp_b_iso88591_A_1HA_T_4t6_Q_j_1A_j_e_T_8_k_j_A __pyx_string_tab[306] +#define __pyx_kp_b_iso88591_A_4_c_1_N_1_q_T_Be6_gZq __pyx_string_tab[307] +#define __pyx_kp_b_iso88591_A_4_s_1_t1D_q __pyx_string_tab[308] +#define __pyx_kp_b_iso88591_A_A_A_A_A_A_A_A_L_fA __pyx_string_tab[309] +#define __pyx_kp_b_iso88591_A_A_A_BhauA_A_A_BhauA_Q_Q_Rxq_Q __pyx_string_tab[310] +#define __pyx_kp_b_iso88591_A_A_v __pyx_string_tab[311] +#define __pyx_kp_b_iso88591_A_E_Zt7_aq_G1A_wgQ_D_Qa __pyx_string_tab[312] +#define __pyx_kp_b_iso88591_A_M_4t7_a __pyx_string_tab[313] +#define __pyx_kp_b_iso88591_A_M_A_Q __pyx_string_tab[314] +#define __pyx_kp_b_iso88591_A_Qd_E_Q_Zt_T_Jaq_wgQ_D_Qa __pyx_string_tab[315] +#define __pyx_kp_b_iso88591_A_QfO6_XQ_r_aq_AV4xq_6_A_AV5_q_g __pyx_string_tab[316] +#define __pyx_kp_b_iso88591_A_V1M_q_QgQ __pyx_string_tab[317] +#define __pyx_kp_b_iso88591_A_t_q_ay_q_IS __pyx_string_tab[318] +#define __pyx_kp_b_iso88591_D_1IQ __pyx_string_tab[319] +#define __pyx_kp_b_iso88591_Q __pyx_string_tab[320] +#define __pyx_kp_b_iso88591_Q_2 __pyx_string_tab[321] +#define __pyx_kp_b_iso88591_T_A_A __pyx_string_tab[322] +#define __pyx_kp_b_iso88591_XT_y __pyx_string_tab[323] +#define __pyx_kp_b_iso88591_X_7q_A __pyx_string_tab[324] +#define __pyx_kp_b_iso88591_Zt6_AS __pyx_string_tab[325] +#define __pyx_kp_b_iso88591_Zt_a7H __pyx_string_tab[326] +#define __pyx_kp_b_iso88591_a_t_q_ay_e1_Kq_HA_q __pyx_string_tab[327] +#define __pyx_kp_b_iso88591_gQd_q __pyx_string_tab[328] +#define __pyx_kp_b_iso88591_h_8_Q __pyx_string_tab[329] +#define __pyx_kp_b_iso88591_j_Kq8J __pyx_string_tab[330] +#define __pyx_kp_b_iso88591_q __pyx_string_tab[331] +#define __pyx_kp_b_iso88591_q_Q_Q_Q_a_1_t9A __pyx_string_tab[332] +#define __pyx_kp_b_pyx_t_5spacy_8typedefs_attr_t __pyx_string_tab[333] +#define __pyx_kp_b_pyx_t_5spacy_8typedefs_hash_t __pyx_string_tab[334] +#define __pyx_kp_b_struct___pyx_t_5spacy_7structs_L __pyx_string_tab[335] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_hash6 __pyx_string_tab[336] +#define __pyx_n_b_O __pyx_string_tab[337] +#define __pyx_int_0 __pyx_number_tab[0] +#define __pyx_int_neg_1 __pyx_number_tab[1] +#define __pyx_int_1 __pyx_number_tab[2] +#define __pyx_int_1000 __pyx_number_tab[3] +#define __pyx_int_10000 __pyx_number_tab[4] +#define __pyx_int_136983863 __pyx_number_tab[5] +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { + __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #if CYTHON_PEP489_MULTI_PHASE_INIT + __Pyx_State_RemoveModule(NULL); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7matcher_13phrasematcher_PhraseMatcher); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_9tokenizer_Tokenizer); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_9tokenizer_Tokenizer); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct__pipe); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct_1_explain); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct_2_genexpr); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct_3_genexpr); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct_4_genexpr); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + Py_CLEAR(clear_module_state->__pyx_k__8); + Py_CLEAR(clear_module_state->__pyx_k__9); + Py_CLEAR(clear_module_state->__pyx_k__10); + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } + for (int i=0; i<4; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<38; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<338; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<6; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } +/* #### Code section: module_state_clear_contents ### */ +/* CommonTypesMetaclass.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + +/* Generator.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_GeneratorType); + +/* #### Code section: module_state_clear_end ### */ +return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7matcher_13phrasematcher_PhraseMatcher); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_9tokenizer_Tokenizer); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_9tokenizer_Tokenizer); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct__pipe); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct_1_explain); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct_2_genexpr); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct_3_genexpr); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct_4_genexpr); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + Py_VISIT(traverse_module_state->__pyx_k__8); + Py_VISIT(traverse_module_state->__pyx_k__9); + Py_VISIT(traverse_module_state->__pyx_k__10); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } + for (int i=0; i<4; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<38; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<338; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<6; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } +/* #### Code section: module_state_traverse_contents ### */ +/* CommonTypesMetaclass.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + +/* Generator.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_GeneratorType); + +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + +/* Python wrapper */ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_shape,&__pyx_mstate_global->__pyx_n_u_itemsize,&__pyx_mstate_global->__pyx_n_u_format,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_allocate_buffer,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 129, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(1, 129, __pyx_L3_error) + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, i); __PYX_ERR(1, 129, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + } + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 129, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 130, __pyx_L3_error) + } else { + + /* "View.MemoryView":130 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx +*/ + __pyx_v_allocate_buffer = ((int)1); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 129, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 129, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 129, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11[5]; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); + + /* "View.MemoryView":135 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * +*/ + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 135, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 135, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); + + /* "View.MemoryView":136 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: +*/ + __pyx_v_self->itemsize = __pyx_v_itemsize; + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":139 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 139, __pyx_L1_error) + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + } + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":142 + * + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 142, __pyx_L1_error) + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + } + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + + /* "View.MemoryView":145 + * + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format +*/ + __pyx_t_5 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + } + + /* "View.MemoryView":146 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * +*/ + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 146, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":147 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * + * +*/ + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 147, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_7; + + /* "View.MemoryView":150 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * +*/ + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + + /* "View.MemoryView":151 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: +*/ + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":154 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 154, __pyx_L1_error) + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + } + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + __pyx_t_8 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 157, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); + #endif + ++__pyx_t_1; + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_8; + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":159 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim + * +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis; + __pyx_t_11[1] = __pyx_t_5; + __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_; + __pyx_t_11[3] = __pyx_t_10; + __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__2; + __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127); + if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 159, __pyx_L1_error) + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + } + + /* "View.MemoryView":160 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order +*/ + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 163, __pyx_L1_error) + if (__pyx_t_3) { + + /* "View.MemoryView":164 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': +*/ + __pyx_v_order = 'C'; + + /* "View.MemoryView":165 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_c; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 166, __pyx_L1_error) + if (likely(__pyx_t_3)) { + + /* "View.MemoryView":167 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: +*/ + __pyx_v_order = 'F'; + + /* "View.MemoryView":168 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_fortran; + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":170 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) +*/ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 170, __pyx_L1_error) + } + __pyx_L11:; + + /* "View.MemoryView":172 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer +*/ + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); + + /* "View.MemoryView":174 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * +*/ + __pyx_v_self->free_data = __pyx_v_allocate_buffer; + + /* "View.MemoryView":175 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: +*/ + __pyx_t_12 = PyObject_RichCompare(__pyx_v_format, __pyx_mstate_global->__pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 175, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 175, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + if (__pyx_v_allocate_buffer) { + + /* "View.MemoryView":178 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_t_8 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 178, __pyx_L1_error) + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + } + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":182 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": +*/ + __pyx_v_bufmode = -1; + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 184, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":185 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":187 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." +*/ + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + } + __pyx_L4:; + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":189 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 189, __pyx_L1_error) + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + } + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + } + + /* "View.MemoryView":190 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len + * +*/ + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; + + /* "View.MemoryView":191 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":194 + * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides +*/ + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; + + /* "View.MemoryView":195 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: +*/ + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":196 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 +*/ + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":198 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL +*/ + /*else*/ { + __pyx_v_info->ndim = 1; + + /* "View.MemoryView":199 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; + } + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":200 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< + * + * info.suboffsets = NULL +*/ + __pyx_v_info->strides = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":202 + * info.strides = NULL + * + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 +*/ + __pyx_v_info->suboffsets = NULL; + + /* "View.MemoryView":203 + * + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL +*/ + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":204 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self +*/ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":205 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; + } + __pyx_v_info->format = __pyx_t_2; + + /* "View.MemoryView":206 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< + * + * def __dealloc__(array self): +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + +/* Python wrapper */ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":210 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: +*/ + __pyx_v_self->callback_free_data(__pyx_v_self->data); + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":213 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + } + + /* "View.MemoryView":214 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) + * +*/ + free(__pyx_v_self->data); + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + } + __pyx_L3:; + + /* "View.MemoryView":215 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + * + * @property +*/ + PyObject_Free(__pyx_v_self->_shape); + + /* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":219 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< + * + * @cname('get_memview') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); + + /* "View.MemoryView":223 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) + * +*/ + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + + /* "View.MemoryView":224 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + + /* "View.MemoryView":227 + * + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< + * + * def __getattr__(self, attr): +*/ + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); + + /* "View.MemoryView":230 + * + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, item): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":233 + * + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< + * + * def __setitem__(self, item, value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "View.MemoryView":236 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":252 + * cdef PyObject **p + * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: +*/ + __pyx_v_self->free_data = 1; + + /* "View.MemoryView":253 + * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." +*/ + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":255 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 255, __pyx_L1_error) + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":258 + * + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None +*/ + __pyx_v_p = ((PyObject **)__pyx_v_self->data); + + /* "View.MemoryView":259 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) +*/ + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize, 0); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":260 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 +*/ + (__pyx_v_p[__pyx_v_i]) = Py_None; + + /* "View.MemoryView":261 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 + * +*/ + Py_INCREF(Py_None); + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + } + + /* "View.MemoryView":262 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char const *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); + + /* "View.MemoryView":268 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< + * + * if buf is NULL: +*/ + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_fortran; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":271 + * + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) +*/ + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":273 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf + * +*/ + /*else*/ { + __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_allocate_buffer, Py_False) < (0)) __PYX_ERR(1, 273, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":274 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->data = __pyx_v_buf; + } + __pyx_L3:; + + /* "View.MemoryView":276 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + +/* Python wrapper */ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 302, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 302, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(1, 302, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(1, 302, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 302, __pyx_L3_error) + } + __pyx_v_name = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 302, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "View.MemoryView":303 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name +*/ + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; + + /* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":305 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< + * + * cdef generic = Enum("") +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; + + /* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('self.name is not None',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[0]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('self.name is not None',) + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 16, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 16, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 16, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error) + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_v___pyx_state; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(1, 17, __pyx_L1_error) + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 17, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + +/* Python wrapper */ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_obj,&__pyx_mstate_global->__pyx_n_u_flags,&__pyx_mstate_global->__pyx_n_u_dtype_is_object,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 348, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(1, 348, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, i); __PYX_ERR(1, 348, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 348, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "View.MemoryView":349 + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: +*/ + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; + + /* "View.MemoryView":350 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) +*/ + __pyx_v_self->flags = __pyx_v_flags; + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_mstate_global->__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":352 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None +*/ + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 352, __pyx_L1_error) + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":354 + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + + /* "View.MemoryView":355 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + } + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + __pyx_t_2 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L9_bool_binop_done; + } + + /* "View.MemoryView":361 + * if (__pyx_memoryview_thread_locks_used < 8 and + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 +*/ + __pyx_t_2 = (!__PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()); + __pyx_t_1 = __pyx_t_2; + __pyx_L9_bool_binop_done:; + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":362 + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: +*/ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + + /* "View.MemoryView":363 + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":365 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError +*/ + __pyx_v_self->lock = PyThread_allocate_lock(); + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":367 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 367, __pyx_L1_error) + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + } + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":370 + * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object +*/ + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L14_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":372 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 +*/ + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L13:; + + /* "View.MemoryView":374 + * self.dtype_is_object = dtype_is_object + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL + * +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 374, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 374, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 374, __pyx_L1_error) + #endif + + /* "View.MemoryView":375 + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(memoryview self): +*/ + __pyx_v_self->typeinfo = NULL; + + /* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + +/* Python wrapper */ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":379 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * PyBuffer_Release(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * +*/ + PyBuffer_Release((&__pyx_v_self->view)); + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":382 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + + /* "View.MemoryView":383 + * + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i +*/ + Py_DECREF(Py_None); + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + } + __pyx_L3:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":388 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 +*/ + __pyx_t_1 = __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING(); + if (__pyx_t_1) { + __pyx_t_2 = 0; + } else { + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + } + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { + + /* "View.MemoryView":390 + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { + + /* "View.MemoryView":393 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + + /* "View.MemoryView":392 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break +*/ + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + } + + /* "View.MemoryView":394 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + } + } + /*else*/ { + + /* "View.MemoryView":396 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: +*/ + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + } + + /* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_item_pointer", 0); + + /* "View.MemoryView":400 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + * + * for dim, idx in enumerate(index): +*/ + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 402, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 402, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 402, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); + + /* "View.MemoryView":403 + * + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + * + * return itemp +*/ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":405 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + * return itemp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_itemp; + goto __pyx_L0; + + /* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_idx); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { + + /* "View.MemoryView":410 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + } + + /* "View.MemoryView":412 + * return self + * + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * cdef char *itemp +*/ + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 412, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 412, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 415, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":416 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + } + + /* "View.MemoryView":418 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) + * +*/ + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(1, 418, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; + + /* "View.MemoryView":419 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + * + * def __setitem__(memoryview self, object index, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + if (unlikely(__pyx_v_self->view.readonly)) { + + /* "View.MemoryView":423 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< + * + * have_slices, index = _unellipsify(index, self.view.ndim) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 423, __pyx_L1_error) + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + } + + /* "View.MemoryView":425 + * raise TypeError, "Cannot assign to read-only memoryview" + * + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * if have_slices: +*/ + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 425, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 425, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 427, __pyx_L1_error) + if (__pyx_t_4) { + + /* "View.MemoryView":428 + * + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + __pyx_t_4 = (__pyx_v_obj != Py_None); + if (__pyx_t_4) { + + /* "View.MemoryView":430 + * obj = self.is_slice(value) + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":432 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) +*/ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 432, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":434 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + * + * cdef is_slice(self, obj): +*/ + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; + + /* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "View.MemoryView":439 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: +*/ + __pyx_t_7 = NULL; + __pyx_t_8 = __Pyx_PyLong_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + + /* "View.MemoryView":440 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None +*/ + __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 440, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_obj, __pyx_t_8, __pyx_t_9}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_10, (4-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF((PyObject *)__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_obj, ((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":441 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError)))); + if (__pyx_t_11) { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":442 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< + * + * return obj +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; + } + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + } + + /* "View.MemoryView":444 + * return None + * + * return obj # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assignment(self, dst, src): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; + + /* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * +*/ + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); + + /* "View.MemoryView":450 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) +*/ + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); + + /* "View.MemoryView":452 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 452, __pyx_L1_error) + + /* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[128]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + + /* "View.MemoryView":456 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item + * +*/ + __pyx_v_tmp = NULL; + + /* "View.MemoryView":461 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< + * + * if self.view.itemsize > sizeof(array): +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 461, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { + + /* "View.MemoryView":464 + * + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError +*/ + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":466 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 466, __pyx_L1_error) + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + } + + /* "View.MemoryView":467 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array +*/ + __pyx_v_item = __pyx_v_tmp; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":469 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< + * + * try: +*/ + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; + + /* "View.MemoryView":471 + * item = array + * + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value +*/ + /*try:*/ { + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":473 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) +*/ + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":475 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":480 + * + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) +*/ + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 480, __pyx_L6_error) + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + } + + /* "View.MemoryView":481 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: +*/ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } + + /* "View.MemoryView":484 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< + * + * cdef setitem_indexed(self, index, value): +*/ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } + + /* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_indexed", 0); + + /* "View.MemoryView":487 + * + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) + * +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 487, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; + + /* "View.MemoryView":488 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":493 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem + * +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 493, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":496 + * cdef bytes bytesitem + * + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) +*/ + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { + + /* "View.MemoryView":498 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" +*/ + __pyx_t_5 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unpack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + } + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + /*else:*/ { + __pyx_t_8 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 502, __pyx_L5_except_error) + __pyx_t_9 = (__pyx_t_8 == 1); + if (__pyx_t_9) { + + /* "View.MemoryView":503 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 503, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + } + + /* "View.MemoryView":504 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "View.MemoryView":499 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: +*/ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_5); + __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; + if (__pyx_t_11) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_1); + + /* "View.MemoryView":500 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 500, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; + } + + /* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + char *__pyx_t_11; + Py_ssize_t __pyx_t_12; + char *__pyx_t_13; + char *__pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":509 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 509, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + __pyx_t_3 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_3) { + + /* "View.MemoryView":515 + * + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 515, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 515, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":517 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< + * + * for i, c in enumerate(bytesvalue): +*/ + /*else*/ { + __pyx_t_6 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_value}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 517, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 519, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_9 = __pyx_v_bytesvalue; + __pyx_t_11 = __Pyx_PyBytes_AsWritableString(__pyx_t_9); if (unlikely(__pyx_t_11 == ((char *)NULL))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyBytes_GET_SIZE(__pyx_t_9); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_13 = (__pyx_t_11 + __pyx_t_12); + for (__pyx_t_14 = __pyx_t_11; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { + __pyx_t_10 = __pyx_t_14; + __pyx_v_c = (__pyx_t_10[0]); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_v_i = __pyx_t_8; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":525 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 525, __pyx_L1_error) + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + } + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":528 + * + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":530 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + /*else*/ { + __pyx_v_info->shape = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":533 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":535 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_INDIRECT: +*/ + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":538 + * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":540 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + /*else*/ { + __pyx_v_info->suboffsets = NULL; + } + __pyx_L8:; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":543 + * + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL +*/ + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":545 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< + * + * info.buf = self.view.buf +*/ + /*else*/ { + __pyx_v_info->format = NULL; + } + __pyx_L9:; + + /* "View.MemoryView":547 + * info.format = NULL + * + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize +*/ + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; + + /* "View.MemoryView":548 + * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len +*/ + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; + + /* "View.MemoryView":549 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly +*/ + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; + + /* "View.MemoryView":550 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self +*/ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; + + /* "View.MemoryView":551 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; + + /* "View.MemoryView":552 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":557 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result +*/ + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 557, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":558 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 558, __pyx_L1_error) + + /* "View.MemoryView":559 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":563 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":566 + * + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; + goto __pyx_L0; + + /* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":570 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyLong_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":576 + * if self.view.strides == NULL: + * + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 576, __pyx_L1_error) + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + } + + /* "View.MemoryView":578 + * raise ValueError, "Buffer view does not expose strides" + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[1], __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + } + + /* "View.MemoryView":585 + * return (-1,) * self.view.ndim + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":589 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":593 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":597 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":602 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< + * + * for length in self.view.shape[:self.view.ndim]: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); + __pyx_v_result = __pyx_mstate_global->__pyx_int_1; + + /* "View.MemoryView":604 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length + * +*/ + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyLong_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; + + /* "View.MemoryView":605 + * + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< + * + * self._size = result +*/ + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; + } + + /* "View.MemoryView":607 + * result *= length + * + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size +*/ + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + } + + /* "View.MemoryView":609 + * self._size = result + * + * return self._size # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; + goto __pyx_L0; + + /* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { + + /* "View.MemoryView":613 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + } + + /* "View.MemoryView":615 + * return self.view.shape[0] + * + * return 0 # <<<<<<<<<<<<<< + * + * def __repr__(self): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[5]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":619 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): +*/ + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_4[1] = __pyx_t_2; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_at_0x; + __pyx_t_4[3] = __pyx_t_3; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__3; + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3[3]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "View.MemoryView":622 + * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_3[1] = __pyx_t_2; + __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u_object; + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_c_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); + + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":629 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + * + * def is_f_contig(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_f_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_f_contig", 0); + + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 634, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":635 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * + * def copy(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":639 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &mslice) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + + /* "View.MemoryView":641 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + + /* "View.MemoryView":642 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char const *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 642, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":647 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * + * def copy_fortran(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy_fortran", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":651 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &src) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + + /* "View.MemoryView":653 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + + /* "View.MemoryView":654 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char const *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 654, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; + + /* "View.MemoryView":659 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo const *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + + /* "View.MemoryView":664 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_o, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":665 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_v_result->typeinfo = __pyx_v_typeinfo; + + /* "View.MemoryView":666 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_check') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":670 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + * + * cdef tuple _unellipsify(object index, int ndim): +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6[3]; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); + + /* "View.MemoryView":678 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< + * + * result = [slice(None)] * ndim +*/ + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(1, 678, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(1, 680, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":681 + * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 +*/ + __pyx_v_have_slices = 0; + + /* "View.MemoryView":682 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: +*/ + __pyx_v_seen_ellipsis = 0; + + /* "View.MemoryView":683 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: +*/ + __pyx_v_idx = 0; + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 684, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 684, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); + #endif + ++__pyx_t_4; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 684, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":687 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 687, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 687, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); + + /* "View.MemoryView":688 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: +*/ + __pyx_v_seen_ellipsis = 1; + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + } + + /* "View.MemoryView":689 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { + + /* "View.MemoryView":692 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":694 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 +*/ + __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type; + __pyx_t_6[1] = __pyx_t_3; + __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4; + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 694, __pyx_L1_error) + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + } + __pyx_L7:; + + /* "View.MemoryView":695 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 + * +*/ + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(1, 695, __pyx_L1_error) + } + __pyx_L5:; + + /* "View.MemoryView":696 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx +*/ + __pyx_v_idx = (__pyx_v_idx + 1); + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":698 + * idx += 1 + * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) + * +*/ + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); + + /* "View.MemoryView":699 + * + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: +*/ + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":702 + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" +*/ + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { + + /* "View.MemoryView":704 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 704, __pyx_L1_error) + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + } + } + + /* "View.MemoryView":705 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memview_slice", 0); + + /* "View.MemoryView":713 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst +*/ + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; + + /* "View.MemoryView":720 + * + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj +*/ + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + + /* "View.MemoryView":724 + * cdef _memoryviewslice memviewsliceobj + * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 724, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 724, __pyx_L1_error) + #endif + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":727 + * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 727, __pyx_L1_error) + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":728 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) +*/ + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":730 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + + /* "View.MemoryView":731 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; + + /* "View.MemoryView":737 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data + * +*/ + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; + + /* "View.MemoryView":738 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; + + /* "View.MemoryView":743 + * + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex +*/ + __pyx_v_p_dst = (&__pyx_v_dst); + + /* "View.MemoryView":744 + * + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step +*/ + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 748, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6)); + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 748, __pyx_L1_error) + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 748, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":750 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 750, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; + + /* "View.MemoryView":751 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 751, __pyx_L1_error) + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":758 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 +*/ + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + + /* "View.MemoryView":759 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 +*/ + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + + /* "View.MemoryView":760 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: +*/ + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + + /* "View.MemoryView":761 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":763 + * new_ndim += 1 + * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 +*/ + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; + + /* "View.MemoryView":764 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; + + /* "View.MemoryView":765 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< + * + * have_start = index.start is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 765, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 765, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; + + /* "View.MemoryView":767 + * step = index.step or 0 + * + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; + + /* "View.MemoryView":768 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; + + /* "View.MemoryView":769 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< + * + * slice_memviewslice( +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; + + /* "View.MemoryView":771 + * have_step = index.step is not None + * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 771, __pyx_L1_error) + + /* "View.MemoryView":777 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":781 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":782 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 782, __pyx_L1_error) } + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 780, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + } + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":786 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 785, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { + + /* "View.MemoryView":817 + * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + } + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":819 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 819, __pyx_L1_error) + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":823 + * + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) +*/ + __pyx_v_negative_step = (__pyx_v_step < 0); + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":825 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 825, __pyx_L1_error) + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":827 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 + * +*/ + /*else*/ { + __pyx_v_negative_step = 0; + + /* "View.MemoryView":828 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_step = 1; + } + __pyx_L6:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":833 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":835 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: +*/ + __pyx_v_start = 0; + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + } + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + if (__pyx_v_negative_step) { + + /* "View.MemoryView":838 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":840 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + } + __pyx_L9:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":843 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":845 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< + * + * if have_stop: +*/ + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":849 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 +*/ + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":851 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape +*/ + __pyx_v_stop = 0; + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + } + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + goto __pyx_L14; + } + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":853 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + __pyx_v_stop = __pyx_v_shape; + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + } + __pyx_L14:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":856 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape +*/ + __pyx_v_stop = -1L; + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + goto __pyx_L16; + } + + /* "View.MemoryView":858 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; + + /* "View.MemoryView":862 + * + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: +*/ + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":865 + * + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< + * + * if new_shape < 0: +*/ + __pyx_v_new_shape = (__pyx_v_new_shape + 1); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + } + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":868 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_new_shape = 0; + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + } + + /* "View.MemoryView":871 + * + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset +*/ + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); + + /* "View.MemoryView":872 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset + * +*/ + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + + /* "View.MemoryView":873 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + } + __pyx_L3:; + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":877 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride +*/ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + goto __pyx_L19; + } + + /* "View.MemoryView":879 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + * + * if suboffset >= 0: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":884 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " +*/ + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + goto __pyx_L22; + } + + /* "View.MemoryView":886 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: +*/ + /*else*/ { + + /* "View.MemoryView":887 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 886, __pyx_L1_error) + } + __pyx_L22:; + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + goto __pyx_L21; + } + + /* "View.MemoryView":889 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + * + * return 0 +*/ + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + } + + /* "View.MemoryView":891 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[3]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pybuffer_index", 0); + + /* "View.MemoryView":899 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp +*/ + __pyx_v_suboffset = -1L; + + /* "View.MemoryView":900 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp + * +*/ + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":904 + * + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: +*/ + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize, 0); + + /* "View.MemoryView":905 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] +*/ + __pyx_v_stride = __pyx_v_itemsize; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":907 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: +*/ + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + + /* "View.MemoryView":908 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] +*/ + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":910 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + * + * if index < 0: +*/ + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + } + } + __pyx_L3:; + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":913 + * + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" +*/ + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":915 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * if index >= shape: +*/ + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_3; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 915, __pyx_L1_error) + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + } + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":918 + * + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_5; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127); + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 918, __pyx_L1_error) + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":920 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset +*/ + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":922 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + * + * return resultp +*/ + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + } + + /* "View.MemoryView":924 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; + + /* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":931 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t *shape = memslice.shape +*/ + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; + + /* "View.MemoryView":933 + * cdef int ndim = memslice.memview.view.ndim + * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides + * +*/ + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; + + /* "View.MemoryView":934 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; + + /* "View.MemoryView":938 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] +*/ + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2, 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":939 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] +*/ + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + + /* "View.MemoryView":940 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] + * +*/ + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + + /* "View.MemoryView":941 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: +*/ + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { + + /* "View.MemoryView":944 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 944, __pyx_L1_error) + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + } + } + + /* "View.MemoryView":946 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + +/* Python wrapper */ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + + /* "View.MemoryView":965 + * + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); + + /* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":969 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 969, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + } + + /* "View.MemoryView":971 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 971, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":975 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) +*/ + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 975, __pyx_L1_error) + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":977 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":980 + * + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; + goto __pyx_L0; + + /* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TypeInfo const *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":1009 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + } + + /* "View.MemoryView":1014 + * + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice +*/ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_mstate_global->__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1016 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * +*/ + __pyx_v_result->from_slice = __pyx_v_memviewslice; + + /* "View.MemoryView":1017 + * + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() +*/ + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + + /* "View.MemoryView":1019 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo + * +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1019, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; + + /* "View.MemoryView":1020 + * + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * + * result.view = memviewslice.memview.view +*/ + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + + /* "View.MemoryView":1022 + * result.typeinfo = memviewslice.memview.typeinfo + * + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim +*/ + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; + + /* "View.MemoryView":1023 + * + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None +*/ + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); + + /* "View.MemoryView":1024 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; + + /* "View.MemoryView":1025 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + + /* "View.MemoryView":1026 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1029 + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO +*/ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1031 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape +*/ + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; + + /* "View.MemoryView":1033 + * result.flags = PyBUF_RECORDS_RO + * + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides + * +*/ + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); + + /* "View.MemoryView":1034 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + + /* "View.MemoryView":1037 + * + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: +*/ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; + + /* "View.MemoryView":1038 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets +*/ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1040 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + + /* "View.MemoryView":1041 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< + * + * result.view.len = result.view.itemsize +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + } + } + __pyx_L6_break:; + + /* "View.MemoryView":1043 + * break + * + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length +*/ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + + /* "View.MemoryView":1044 + * + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * +*/ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyLong_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1045 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< + * + * result.to_object_func = to_object_func +*/ + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } + + /* "View.MemoryView":1047 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func + * +*/ + __pyx_v_result->to_object_func = __pyx_v_to_object_func; + + /* "View.MemoryView":1048 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + + /* "View.MemoryView":1050 + * result.to_dtype_func = to_dtype_func + * + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1057 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 1057, __pyx_L1_error) + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1058 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) +*/ + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + } + + /* "View.MemoryView":1060 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + + /* "View.MemoryView":1061 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_slice_copy') +*/ + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } + + /* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_obj); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + + /* "View.MemoryView":1068 + * cdef (Py_ssize_t*) shape, strides, suboffsets + * + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets +*/ + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; + + /* "View.MemoryView":1069 + * + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets + * +*/ + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; + + /* "View.MemoryView":1070 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< + * + * dst.memview = <__pyx_memoryview *> memview +*/ + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; + + /* "View.MemoryView":1072 + * suboffsets = memview.view.suboffsets + * + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf + * +*/ + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + + /* "View.MemoryView":1073 + * + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< + * + * for dim in range(memview.view.ndim): +*/ + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + + /* "View.MemoryView":1075 + * dst.data = memview.view.buf + * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] +*/ + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; + + /* "View.MemoryView":1076 + * + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 +*/ + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + + /* "View.MemoryView":1077 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * +*/ + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + + /* "View.MemoryView":1078 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object') +*/ + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } + + /* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy", 0); + + /* "View.MemoryView":1084 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * +*/ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1085 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object_from_slice') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1096 + * + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: +*/ + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; + + /* "View.MemoryView":1097 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL +*/ + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1099 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL + * +*/ + /*else*/ { + __pyx_v_to_object_func = NULL; + + /* "View.MemoryView":1100 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, +*/ + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; + + /* "View.MemoryView":1102 + * to_dtype_func = NULL + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) +*/ + __Pyx_XDECREF(__pyx_r); + + /* "View.MemoryView":1104 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1111 + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') +*/ + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1119 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 + * +*/ + __pyx_v_c_stride = 0; + + /* "View.MemoryView":1120 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_f_stride = 0; + + /* "View.MemoryView":1122 + * cdef Py_ssize_t f_stride = 0 + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1124 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1125 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + goto __pyx_L4_break; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L4_break:; + + /* "View.MemoryView":1127 + * break + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] +*/ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1129 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1130 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): +*/ + goto __pyx_L7_break; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L7_break:; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { + + /* "View.MemoryView":1133 + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' +*/ + __pyx_r = 'C'; + goto __pyx_L0; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + } + + /* "View.MemoryView":1135 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< + * + * @cython.cdivision(True) +*/ + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } + + /* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1145 + * + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] +*/ + __pyx_v_src_extent = (__pyx_v_src_shape[0]); + + /* "View.MemoryView":1146 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] +*/ + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + + /* "View.MemoryView":1147 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] + * +*/ + __pyx_v_src_stride = (__pyx_v_src_strides[0]); + + /* "View.MemoryView":1148 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + + /* "View.MemoryView":1152 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: +*/ + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":1153 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1155 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1156 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + + /* "View.MemoryView":1157 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1158 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L4:; + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1160 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1161 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, +*/ + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + + /* "View.MemoryView":1165 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1166 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + + /* "View.MemoryView":1171 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) + * +*/ + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + + /* "View.MemoryView":1177 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + * + * for shape in src.shape[:ndim]: +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; + + /* "View.MemoryView":1179 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape + * +*/ + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); + + /* "View.MemoryView":1180 + * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< + * + * return size +*/ + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } + + /* "View.MemoryView":1182 + * size *= shape + * + * return size # <<<<<<<<<<<<<< + * + * @cname('__pyx_fill_contig_strides_array') +*/ + __pyx_r = __pyx_v_size; + goto __pyx_L0; + + /* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { + + /* "View.MemoryView":1195 + * + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; + + /* "View.MemoryView":1196 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1197 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1199 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; + + /* "View.MemoryView":1200 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1201 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * + * return stride +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + } + __pyx_L3:; + + /* "View.MemoryView":1203 + * stride *= shape[idx] + * + * return stride # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_data_to_temp') +*/ + __pyx_r = __pyx_v_stride; + goto __pyx_L0; + + /* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1217 + * cdef void *result + * + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) + * +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1218 + * + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * + * result = malloc(size) +*/ + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); + + /* "View.MemoryView":1220 + * cdef size_t size = slice_get_size(src, ndim) + * + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() +*/ + __pyx_v_result = malloc(__pyx_v_size); + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { + + /* "View.MemoryView":1222 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1222, __pyx_L1_error) + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + } + + /* "View.MemoryView":1225 + * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): +*/ + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + + /* "View.MemoryView":1226 + * + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] +*/ + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; + + /* "View.MemoryView":1227 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1228 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + + /* "View.MemoryView":1229 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) +*/ + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1231 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * + * +*/ + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); + + /* "View.MemoryView":1234 + * + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1236 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * + * if slice_is_contig(src[0], order, ndim): +*/ + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + } + } + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1239 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) +*/ + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":1241 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + * + * return result +*/ + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; + + /* "View.MemoryView":1243 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[7]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_extents", 0); + + /* "View.MemoryView":1250 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_dim') +*/ + __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi; + __pyx_t_4[1] = __pyx_t_1; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_got; + __pyx_t_4[3] = __pyx_t_2; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u_and; + __pyx_t_4[5] = __pyx_t_3; + __pyx_t_4[6] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 7, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 1250, __pyx_L1_error) + + /* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1254 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err') +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1254, __pyx_L1_error) + + /* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1258 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_no_memory') +*/ + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1258, __pyx_L1_error) + + /* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1262 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< + * + * +*/ + PyErr_NoMemory(); __PYX_ERR(1, 1262, __pyx_L1_error) + + /* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1274 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i +*/ + __pyx_v_tmpdata = NULL; + + /* "View.MemoryView":1275 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) +*/ + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1277 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + + /* "View.MemoryView":1278 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp +*/ + __pyx_v_broadcasting = 0; + + /* "View.MemoryView":1279 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp + * +*/ + __pyx_v_direct_copy = 0; + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1283 + * + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1285 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + } + __pyx_L3:; + + /* "View.MemoryView":1287 + * broadcast_leading(&dst, dst_ndim, src_ndim) + * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; + + /* "View.MemoryView":1289 + * cdef int ndim = max(src_ndim, dst_ndim) + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: +*/ + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1292 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: +*/ + __pyx_v_broadcasting = 1; + + /* "View.MemoryView":1293 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) +*/ + (__pyx_v_src.strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":1295 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< + * + * if src.suboffsets[i] >= 0: +*/ + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1295, __pyx_L1_error) + } + __pyx_L7:; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + } + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":1298 + * + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + * + * if slices_overlap(&src, &dst, ndim, itemsize): +*/ + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1298, __pyx_L1_error) + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + } + } + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { + + /* "View.MemoryView":1303 + * + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + } + + /* "View.MemoryView":1305 + * order = get_best_order(&dst, ndim) + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp + * +*/ + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1305, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; + + /* "View.MemoryView":1306 + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: +*/ + __pyx_v_src = __pyx_v_tmp; + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1312 + * + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1314 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + * + * if direct_copy: +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + } + __pyx_L12:; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + if (__pyx_v_direct_copy) { + + /* "View.MemoryView":1318 + * if direct_copy: + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1319 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) +*/ + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + + /* "View.MemoryView":1320 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1321 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1322 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + } + if (__pyx_t_2) { + + /* "View.MemoryView":1327 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) + * +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) + + /* "View.MemoryView":1328 + * + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1328, __pyx_L1_error) + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1330 + * transpose_memslice(&dst) + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1331 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * +*/ + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1332 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * free(tmpdata) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1334 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1335 + * + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "View.MemoryView":1342 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + + /* "View.MemoryView":1344 + * cdef int offset = ndim_other - ndim + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1345 + * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] +*/ + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); + + /* "View.MemoryView":1346 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * +*/ + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1347 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + * + * for i in range(offset): +*/ + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); + } + + /* "View.MemoryView":1349 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] +*/ + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1350 + * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 +*/ + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + + /* "View.MemoryView":1351 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + + /* "View.MemoryView":1352 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + if (__pyx_v_dtype_is_object) { + + /* "View.MemoryView":1363 + * + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') +*/ + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + } + + /* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1369 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ + __Pyx_PyGILState_Release(__pyx_gilstate_save); +} + +/* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1375 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * + * for i in range(shape[0]): +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1377 + * cdef Py_ssize_t stride = strides[0] + * + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: +*/ + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + if (__pyx_v_inc) { + + /* "View.MemoryView":1380 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) +*/ + Py_INCREF((((PyObject **)__pyx_v_data)[0])); + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":1382 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) +*/ + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":1384 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< + * + * data += stride +*/ + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; + + /* "View.MemoryView":1386 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { + + /* "View.MemoryView":1395 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1396 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1397 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + + /* "View.MemoryView":1405 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] + * +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1406 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_extent = (__pyx_v_shape[0]); + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1409 + * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride +*/ + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1410 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: +*/ + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); + + /* "View.MemoryView":1411 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1413 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride +*/ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1414 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1415 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 4, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_Enum", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, i); __PYX_ERR(1, 4, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, ((char const *)"name")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_MemviewEnum_type); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): +*/ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 9, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) # <<<<<<<<<<<<<< +*/ + __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":244 + * @property + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_ELSIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":248 + * @property + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) # <<<<<<<<<<<<<< + * + * # Use fields/names with care as they may be NULL. You must check +*/ + __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("fields", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":254 + * @property + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("names", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":258 + * @property + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) # <<<<<<<<<<<<<< + * + * # Use PyDataType_HASSUBARRAY to test whether this field is +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_NAMES(__pyx_v_self); + __Pyx_INCREF(((PyObject*)__pyx_t_1)); + __pyx_r = ((PyObject*)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) { + PyArray_ArrayDescr *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":265 + * @property + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_SUBARRAY(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) { + npy_uint64 __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":270 + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" + * return PyDataType_FLAGS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyDataType_FLAGS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":282 + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" + * return PyArray_MultiIter_NUMITER(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":287 + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" + * return PyArray_MultiIter_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":292 + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" + * return PyArray_MultiIter_INDEX(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":297 + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" + * return PyArray_MultiIter_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":302 + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" + * return PyArray_MultiIter_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) { + void **__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":308 + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. + * On return, the iterators are adjusted for broadcasting.""" + * return PyArray_MultiIter_ITERS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":326 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":332 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":338 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":346 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":353 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":359 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":368 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":777 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":780 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":793 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape; + __Pyx_INCREF(((PyObject*)__pyx_t_2)); + __pyx_r = ((PyObject*)__pyx_t_2); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":795 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_r = __pyx_mstate_global->__pyx_empty_tuple; + goto __pyx_L0; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":995 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * +*/ + Py_INCREF(__pyx_v_base); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":996 + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): +*/ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 996, __pyx_L1_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":999 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None +*/ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1001 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1002 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_array", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1008 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") +*/ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1008, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1009 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.multiarray failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1009, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1010 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1010, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1010, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1014 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1014, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1015 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1015, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1016 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1016, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1016, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1020 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1020, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1021 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1021, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1022 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1022, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1022, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1037 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1052 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1062 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1069 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1076 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self = 0; + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_ptr", 0); + + /* "lexeme.pxd":31 + * @staticmethod + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) # <<<<<<<<<<<<<< + * self.c = lex + * self.vocab = vocab +*/ + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_vocab)) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme)))) __PYX_ERR(3, 31, __pyx_L1_error) + __pyx_v_self = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "lexeme.pxd":32 + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex # <<<<<<<<<<<<<< + * self.vocab = vocab + * self.orth = lex.orth +*/ + __pyx_v_self->c = __pyx_v_lex; + + /* "lexeme.pxd":33 + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex + * self.vocab = vocab # <<<<<<<<<<<<<< + * self.orth = lex.orth + * return self +*/ + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + __Pyx_GOTREF((PyObject *)__pyx_v_self->vocab); + __Pyx_DECREF((PyObject *)__pyx_v_self->vocab); + __pyx_v_self->vocab = __pyx_v_vocab; + + /* "lexeme.pxd":34 + * self.c = lex + * self.vocab = vocab + * self.orth = lex.orth # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = __pyx_v_lex->orth; + __pyx_v_self->orth = __pyx_t_3; + + /* "lexeme.pxd":35 + * self.vocab = vocab + * self.orth = lex.orth + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value) { + int __pyx_t_1; + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + __pyx_t_1 = (__pyx_v_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":40 + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) # <<<<<<<<<<<<<< + * elif name == ID: + * lex.id = value +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_lex, __pyx_v_name, __pyx_v_value)); + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":42 + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: + * lex.id = value # <<<<<<<<<<<<<< + * elif name == LOWER: + * lex.lower = value +*/ + __pyx_v_lex->id = __pyx_v_value; + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":44 + * lex.id = value + * elif name == LOWER: + * lex.lower = value # <<<<<<<<<<<<<< + * elif name == NORM: + * lex.norm = value +*/ + __pyx_v_lex->lower = __pyx_v_value; + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":46 + * lex.lower = value + * elif name == NORM: + * lex.norm = value # <<<<<<<<<<<<<< + * elif name == SHAPE: + * lex.shape = value +*/ + __pyx_v_lex->norm = __pyx_v_value; + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":48 + * lex.norm = value + * elif name == SHAPE: + * lex.shape = value # <<<<<<<<<<<<<< + * elif name == PREFIX: + * lex.prefix = value +*/ + __pyx_v_lex->shape = __pyx_v_value; + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":50 + * lex.shape = value + * elif name == PREFIX: + * lex.prefix = value # <<<<<<<<<<<<<< + * elif name == SUFFIX: + * lex.suffix = value +*/ + __pyx_v_lex->prefix = __pyx_v_value; + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":52 + * lex.prefix = value + * elif name == SUFFIX: + * lex.suffix = value # <<<<<<<<<<<<<< + * elif name == LANG: + * lex.lang = value +*/ + __pyx_v_lex->suffix = __pyx_v_value; + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":54 + * lex.suffix = value + * elif name == LANG: + * lex.lang = value # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_lex->lang = __pyx_v_value; + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + } + __pyx_L3:; + + /* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ +} + +/* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + __pyx_t_1 = (__pyx_v_feat_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_lex, __pyx_v_feat_name); + if (__pyx_t_1) { + + /* "lexeme.pxd":60 + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "lexeme.pxd":62 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * elif feat_name == ID: + * return lex.id +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + } + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":64 + * return 0 + * elif feat_name == ID: + * return lex.id # <<<<<<<<<<<<<< + * elif feat_name == ORTH: + * return lex.orth +*/ + __pyx_r = __pyx_v_lex->id; + goto __pyx_L0; + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + } + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ORTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":66 + * return lex.id + * elif feat_name == ORTH: + * return lex.orth # <<<<<<<<<<<<<< + * elif feat_name == LOWER: + * return lex.lower +*/ + __pyx_r = __pyx_v_lex->orth; + goto __pyx_L0; + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + } + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":68 + * return lex.orth + * elif feat_name == LOWER: + * return lex.lower # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * return lex.norm +*/ + __pyx_r = __pyx_v_lex->lower; + goto __pyx_L0; + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + } + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":70 + * return lex.lower + * elif feat_name == NORM: + * return lex.norm # <<<<<<<<<<<<<< + * elif feat_name == SHAPE: + * return lex.shape +*/ + __pyx_r = __pyx_v_lex->norm; + goto __pyx_L0; + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + } + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":72 + * return lex.norm + * elif feat_name == SHAPE: + * return lex.shape # <<<<<<<<<<<<<< + * elif feat_name == PREFIX: + * return lex.prefix +*/ + __pyx_r = __pyx_v_lex->shape; + goto __pyx_L0; + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + } + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":74 + * return lex.shape + * elif feat_name == PREFIX: + * return lex.prefix # <<<<<<<<<<<<<< + * elif feat_name == SUFFIX: + * return lex.suffix +*/ + __pyx_r = __pyx_v_lex->prefix; + goto __pyx_L0; + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + } + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":76 + * return lex.prefix + * elif feat_name == SUFFIX: + * return lex.suffix # <<<<<<<<<<<<<< + * elif feat_name == LENGTH: + * return lex.length +*/ + __pyx_r = __pyx_v_lex->suffix; + goto __pyx_L0; + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + } + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LENGTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":78 + * return lex.suffix + * elif feat_name == LENGTH: + * return lex.length # <<<<<<<<<<<<<< + * elif feat_name == LANG: + * return lex.lang +*/ + __pyx_r = __pyx_v_lex->length; + goto __pyx_L0; + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + } + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":80 + * return lex.length + * elif feat_name == LANG: + * return lex.lang # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = __pyx_v_lex->lang; + goto __pyx_L0; + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + } + + /* "lexeme.pxd":82 + * return lex.lang + * else: + * return 0 # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":86 + * @staticmethod + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if lexeme.flags & (one << flag_id): + * return True +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = ((__pyx_v_lexeme->flags & (__pyx_v_one << __pyx_v_flag_id)) != 0); + if (__pyx_t_1) { + + /* "lexeme.pxd":88 + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "lexeme.pxd":90 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + + /* "lexeme.pxd":94 + * @staticmethod + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if value: + * lex.flags |= one << flag_id +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + if (__pyx_v_value) { + + /* "lexeme.pxd":96 + * cdef flags_t one = 1 + * if value: + * lex.flags |= one << flag_id # <<<<<<<<<<<<<< + * else: + * lex.flags &= ~(one << flag_id) +*/ + __pyx_v_lex->flags = (__pyx_v_lex->flags | (__pyx_v_one << __pyx_v_flag_id)); + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":98 + * lex.flags |= one << flag_id + * else: + * lex.flags &= ~(one << flag_id) # <<<<<<<<<<<<<< +*/ + /*else*/ { + __pyx_v_lex->flags = (__pyx_v_lex->flags & (~(__pyx_v_one << __pyx_v_flag_id))); + } + __pyx_L3:; + + /* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":31 + * DOCS: https://spacy.io/api/tokenizer + * """ + * def __init__(self, Vocab vocab, rules=None, prefix_search=None, # <<<<<<<<<<<<<< + * suffix_search=None, infix_finditer=None, token_match=None, + * url_match=None, faster_heuristics=True, max_cache_size=10000): +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer___init__, "Create a `Tokenizer`, to create `Doc` objects given unicode text.\n\n vocab (Vocab): A storage container for lexical types.\n rules (dict): Exceptions and special-cases for the tokenizer.\n prefix_search (callable): A function matching the signature of\n `re.compile(string).search` to match prefixes.\n suffix_search (callable): A function matching the signature of\n `re.compile(string).search` to match suffixes.\n infix_finditer (callable): A function matching the signature of\n `re.compile(string).finditer` to find infixes.\n token_match (callable): A function matching the signature of\n `re.compile(string).match`, for matching strings to be\n recognized as tokens.\n url_match (callable): A function matching the signature of\n `re.compile(string).match`, for matching strings to be\n recognized as urls.\n faster_heuristics (bool): Whether to restrict the final\n Matcher-based pass for rules to those containing affixes or space.\n Defaults to True.\n max_cache_size (int): Maximum number of tokenization chunks to cache.\n\n EXAMPLE:\n >>> tokenizer = Tokenizer(nlp.vocab)\n\n DOCS: https://spacy.io/api/tokenizer#init\n "); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_9tokenizer_9Tokenizer___init__; +#endif +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab = 0; + PyObject *__pyx_v_rules = 0; + PyObject *__pyx_v_prefix_search = 0; + PyObject *__pyx_v_suffix_search = 0; + PyObject *__pyx_v_infix_finditer = 0; + PyObject *__pyx_v_token_match = 0; + PyObject *__pyx_v_url_match = 0; + PyObject *__pyx_v_faster_heuristics = 0; + PyObject *__pyx_v_max_cache_size = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_vocab,&__pyx_mstate_global->__pyx_n_u_rules,&__pyx_mstate_global->__pyx_n_u_prefix_search,&__pyx_mstate_global->__pyx_n_u_suffix_search,&__pyx_mstate_global->__pyx_n_u_infix_finditer,&__pyx_mstate_global->__pyx_n_u_token_match,&__pyx_mstate_global->__pyx_n_u_url_match,&__pyx_mstate_global->__pyx_n_u_faster_heuristics,&__pyx_mstate_global->__pyx_n_u_max_cache_size,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 31, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 9: + values[8] = __Pyx_ArgRef_VARARGS(__pyx_args, 8); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 8: + values[7] = __Pyx_ArgRef_VARARGS(__pyx_args, 7); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 7: + values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 6: + values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 31, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + + /* "spacy/tokenizer.pyx":32 + * """ + * def __init__(self, Vocab vocab, rules=None, prefix_search=None, + * suffix_search=None, infix_finditer=None, token_match=None, # <<<<<<<<<<<<<< + * url_match=None, faster_heuristics=True, max_cache_size=10000): + * """Create a `Tokenizer`, to create `Doc` objects given unicode text. +*/ + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None)); + + /* "spacy/tokenizer.pyx":33 + * def __init__(self, Vocab vocab, rules=None, prefix_search=None, + * suffix_search=None, infix_finditer=None, token_match=None, + * url_match=None, faster_heuristics=True, max_cache_size=10000): # <<<<<<<<<<<<<< + * """Create a `Tokenizer`, to create `Doc` objects given unicode text. + * +*/ + if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_True)); + if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_10000)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 9, i); __PYX_ERR(0, 31, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 9: + values[8] = __Pyx_ArgRef_VARARGS(__pyx_args, 8); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[8])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 8: + values[7] = __Pyx_ArgRef_VARARGS(__pyx_args, 7); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 7: + values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 6: + values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 31, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 31, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + + /* "spacy/tokenizer.pyx":31 + * DOCS: https://spacy.io/api/tokenizer + * """ + * def __init__(self, Vocab vocab, rules=None, prefix_search=None, # <<<<<<<<<<<<<< + * suffix_search=None, infix_finditer=None, token_match=None, + * url_match=None, faster_heuristics=True, max_cache_size=10000): +*/ + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + + /* "spacy/tokenizer.pyx":32 + * """ + * def __init__(self, Vocab vocab, rules=None, prefix_search=None, + * suffix_search=None, infix_finditer=None, token_match=None, # <<<<<<<<<<<<<< + * url_match=None, faster_heuristics=True, max_cache_size=10000): + * """Create a `Tokenizer`, to create `Doc` objects given unicode text. +*/ + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None)); + + /* "spacy/tokenizer.pyx":33 + * def __init__(self, Vocab vocab, rules=None, prefix_search=None, + * suffix_search=None, infix_finditer=None, token_match=None, + * url_match=None, faster_heuristics=True, max_cache_size=10000): # <<<<<<<<<<<<<< + * """Create a `Tokenizer`, to create `Doc` objects given unicode text. + * +*/ + if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_True)); + if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_10000)); + } + __pyx_v_vocab = ((struct __pyx_obj_5spacy_5vocab_Vocab *)values[0]); + __pyx_v_rules = values[1]; + __pyx_v_prefix_search = values[2]; + __pyx_v_suffix_search = values[3]; + __pyx_v_infix_finditer = values[4]; + __pyx_v_token_match = values[5]; + __pyx_v_url_match = values[6]; + __pyx_v_faster_heuristics = values[7]; + __pyx_v_max_cache_size = values[8]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 9, __pyx_nargs); __PYX_ERR(0, 31, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vocab), __pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, 1, "vocab", 0))) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer___init__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_vocab, __pyx_v_rules, __pyx_v_prefix_search, __pyx_v_suffix_search, __pyx_v_infix_finditer, __pyx_v_token_match, __pyx_v_url_match, __pyx_v_faster_heuristics, __pyx_v_max_cache_size); + + /* "spacy/tokenizer.pyx":31 + * DOCS: https://spacy.io/api/tokenizer + * """ + * def __init__(self, Vocab vocab, rules=None, prefix_search=None, # <<<<<<<<<<<<<< + * suffix_search=None, infix_finditer=None, token_match=None, + * url_match=None, faster_heuristics=True, max_cache_size=10000): +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer___init__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab, PyObject *__pyx_v_rules, PyObject *__pyx_v_prefix_search, PyObject *__pyx_v_suffix_search, PyObject *__pyx_v_infix_finditer, PyObject *__pyx_v_token_match, PyObject *__pyx_v_url_match, PyObject *__pyx_v_faster_heuristics, PyObject *__pyx_v_max_cache_size) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/tokenizer.pyx":60 + * DOCS: https://spacy.io/api/tokenizer#init + * """ + * self.mem = Pool() # <<<<<<<<<<<<<< + * self._cache = PreshMap() + * self._specials = PreshMap() +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->mem); + __Pyx_DECREF((PyObject *)__pyx_v_self->mem); + __pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":61 + * """ + * self.mem = Pool() + * self._cache = PreshMap() # <<<<<<<<<<<<<< + * self._specials = PreshMap() + * self.token_match = token_match +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_7preshed_4maps_PreshMap, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_cache); + __Pyx_DECREF((PyObject *)__pyx_v_self->_cache); + __pyx_v_self->_cache = ((struct __pyx_obj_7preshed_4maps_PreshMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":62 + * self.mem = Pool() + * self._cache = PreshMap() + * self._specials = PreshMap() # <<<<<<<<<<<<<< + * self.token_match = token_match + * self.url_match = url_match +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_7preshed_4maps_PreshMap, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_specials); + __Pyx_DECREF((PyObject *)__pyx_v_self->_specials); + __pyx_v_self->_specials = ((struct __pyx_obj_7preshed_4maps_PreshMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":63 + * self._cache = PreshMap() + * self._specials = PreshMap() + * self.token_match = token_match # <<<<<<<<<<<<<< + * self.url_match = url_match + * self.prefix_search = prefix_search +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_token_match, __pyx_v_token_match) < (0)) __PYX_ERR(0, 63, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":64 + * self._specials = PreshMap() + * self.token_match = token_match + * self.url_match = url_match # <<<<<<<<<<<<<< + * self.prefix_search = prefix_search + * self.suffix_search = suffix_search +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_url_match, __pyx_v_url_match) < (0)) __PYX_ERR(0, 64, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":65 + * self.token_match = token_match + * self.url_match = url_match + * self.prefix_search = prefix_search # <<<<<<<<<<<<<< + * self.suffix_search = suffix_search + * self.infix_finditer = infix_finditer +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_prefix_search, __pyx_v_prefix_search) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":66 + * self.url_match = url_match + * self.prefix_search = prefix_search + * self.suffix_search = suffix_search # <<<<<<<<<<<<<< + * self.infix_finditer = infix_finditer + * self.vocab = vocab +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_suffix_search, __pyx_v_suffix_search) < (0)) __PYX_ERR(0, 66, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":67 + * self.prefix_search = prefix_search + * self.suffix_search = suffix_search + * self.infix_finditer = infix_finditer # <<<<<<<<<<<<<< + * self.vocab = vocab + * self.faster_heuristics = faster_heuristics +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_infix_finditer, __pyx_v_infix_finditer) < (0)) __PYX_ERR(0, 67, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":68 + * self.suffix_search = suffix_search + * self.infix_finditer = infix_finditer + * self.vocab = vocab # <<<<<<<<<<<<<< + * self.faster_heuristics = faster_heuristics + * self._rules = {} +*/ + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + __Pyx_GOTREF((PyObject *)__pyx_v_self->vocab); + __Pyx_DECREF((PyObject *)__pyx_v_self->vocab); + __pyx_v_self->vocab = __pyx_v_vocab; + + /* "spacy/tokenizer.pyx":69 + * self.infix_finditer = infix_finditer + * self.vocab = vocab + * self.faster_heuristics = faster_heuristics # <<<<<<<<<<<<<< + * self._rules = {} + * self._special_matcher = PhraseMatcher(self.vocab) +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_faster_heuristics, __pyx_v_faster_heuristics) < (0)) __PYX_ERR(0, 69, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":70 + * self.vocab = vocab + * self.faster_heuristics = faster_heuristics + * self._rules = {} # <<<<<<<<<<<<<< + * self._special_matcher = PhraseMatcher(self.vocab) + * self._load_special_cases(rules) +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->_rules); + __Pyx_DECREF(__pyx_v_self->_rules); + __pyx_v_self->_rules = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":71 + * self.faster_heuristics = faster_heuristics + * self._rules = {} + * self._special_matcher = PhraseMatcher(self.vocab) # <<<<<<<<<<<<<< + * self._load_special_cases(rules) + * self.max_cache_size = max_cache_size +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self->vocab)}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_7matcher_13phrasematcher_PhraseMatcher, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_special_matcher); + __Pyx_DECREF((PyObject *)__pyx_v_self->_special_matcher); + __pyx_v_self->_special_matcher = ((struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":72 + * self._rules = {} + * self._special_matcher = PhraseMatcher(self.vocab) + * self._load_special_cases(rules) # <<<<<<<<<<<<<< + * self.max_cache_size = max_cache_size + * +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_rules}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_load_special_cases, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":73 + * self._special_matcher = PhraseMatcher(self.vocab) + * self._load_special_cases(rules) + * self.max_cache_size = max_cache_size # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_v_max_cache_size); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_v_self->max_cache_size = __pyx_t_4; + + /* "spacy/tokenizer.pyx":31 + * DOCS: https://spacy.io/api/tokenizer + * """ + * def __init__(self, Vocab vocab, rules=None, prefix_search=None, # <<<<<<<<<<<<<< + * suffix_search=None, infix_finditer=None, token_match=None, + * url_match=None, faster_heuristics=True, max_cache_size=10000): +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":75 + * self.max_cache_size = max_cache_size + * + * @property # <<<<<<<<<<<<<< + * def token_match(self): + * return self._token_match +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_11token_match_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_11token_match_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_11token_match___get__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_11token_match___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/tokenizer.pyx":77 + * @property + * def token_match(self): + * return self._token_match # <<<<<<<<<<<<<< + * + * @token_match.setter +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_token_match); + __pyx_r = __pyx_v_self->_token_match; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":75 + * self.max_cache_size = max_cache_size + * + * @property # <<<<<<<<<<<<<< + * def token_match(self): + * return self._token_match +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":79 + * return self._token_match + * + * @token_match.setter # <<<<<<<<<<<<<< + * def token_match(self, token_match): + * self._token_match = token_match +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_11token_match_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_token_match); /*proto*/ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_11token_match_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_token_match) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_11token_match_2__set__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), ((PyObject *)__pyx_v_token_match)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_11token_match_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_token_match) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/tokenizer.pyx":81 + * @token_match.setter + * def token_match(self, token_match): + * self._token_match = token_match # <<<<<<<<<<<<<< + * self._reload_special_cases() + * +*/ + __Pyx_INCREF(__pyx_v_token_match); + __Pyx_GIVEREF(__pyx_v_token_match); + __Pyx_GOTREF(__pyx_v_self->_token_match); + __Pyx_DECREF(__pyx_v_self->_token_match); + __pyx_v_self->_token_match = __pyx_v_token_match; + + /* "spacy/tokenizer.pyx":82 + * def token_match(self, token_match): + * self._token_match = token_match + * self._reload_special_cases() # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reload_special_cases, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":79 + * return self._token_match + * + * @token_match.setter # <<<<<<<<<<<<<< + * def token_match(self, token_match): + * self._token_match = token_match +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.token_match.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":84 + * self._reload_special_cases() + * + * @property # <<<<<<<<<<<<<< + * def url_match(self): + * return self._url_match +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_9url_match_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_9url_match_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_9url_match___get__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_9url_match___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/tokenizer.pyx":86 + * @property + * def url_match(self): + * return self._url_match # <<<<<<<<<<<<<< + * + * @url_match.setter +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_url_match); + __pyx_r = __pyx_v_self->_url_match; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":84 + * self._reload_special_cases() + * + * @property # <<<<<<<<<<<<<< + * def url_match(self): + * return self._url_match +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":88 + * return self._url_match + * + * @url_match.setter # <<<<<<<<<<<<<< + * def url_match(self, url_match): + * self._url_match = url_match +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_9url_match_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url_match); /*proto*/ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_9url_match_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_url_match) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_9url_match_2__set__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), ((PyObject *)__pyx_v_url_match)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_9url_match_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_url_match) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/tokenizer.pyx":90 + * @url_match.setter + * def url_match(self, url_match): + * self._url_match = url_match # <<<<<<<<<<<<<< + * self._reload_special_cases() + * +*/ + __Pyx_INCREF(__pyx_v_url_match); + __Pyx_GIVEREF(__pyx_v_url_match); + __Pyx_GOTREF(__pyx_v_self->_url_match); + __Pyx_DECREF(__pyx_v_self->_url_match); + __pyx_v_self->_url_match = __pyx_v_url_match; + + /* "spacy/tokenizer.pyx":91 + * def url_match(self, url_match): + * self._url_match = url_match + * self._reload_special_cases() # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reload_special_cases, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":88 + * return self._url_match + * + * @url_match.setter # <<<<<<<<<<<<<< + * def url_match(self, url_match): + * self._url_match = url_match +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.url_match.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":93 + * self._reload_special_cases() + * + * @property # <<<<<<<<<<<<<< + * def prefix_search(self): + * return self._prefix_search +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_13prefix_search_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_13prefix_search_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_13prefix_search___get__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_13prefix_search___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/tokenizer.pyx":95 + * @property + * def prefix_search(self): + * return self._prefix_search # <<<<<<<<<<<<<< + * + * @prefix_search.setter +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_prefix_search); + __pyx_r = __pyx_v_self->_prefix_search; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":93 + * self._reload_special_cases() + * + * @property # <<<<<<<<<<<<<< + * def prefix_search(self): + * return self._prefix_search +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":97 + * return self._prefix_search + * + * @prefix_search.setter # <<<<<<<<<<<<<< + * def prefix_search(self, prefix_search): + * self._prefix_search = prefix_search +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_13prefix_search_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prefix_search); /*proto*/ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_13prefix_search_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_prefix_search) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_13prefix_search_2__set__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), ((PyObject *)__pyx_v_prefix_search)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_13prefix_search_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_prefix_search) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/tokenizer.pyx":99 + * @prefix_search.setter + * def prefix_search(self, prefix_search): + * self._prefix_search = prefix_search # <<<<<<<<<<<<<< + * self._reload_special_cases() + * +*/ + __Pyx_INCREF(__pyx_v_prefix_search); + __Pyx_GIVEREF(__pyx_v_prefix_search); + __Pyx_GOTREF(__pyx_v_self->_prefix_search); + __Pyx_DECREF(__pyx_v_self->_prefix_search); + __pyx_v_self->_prefix_search = __pyx_v_prefix_search; + + /* "spacy/tokenizer.pyx":100 + * def prefix_search(self, prefix_search): + * self._prefix_search = prefix_search + * self._reload_special_cases() # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reload_special_cases, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":97 + * return self._prefix_search + * + * @prefix_search.setter # <<<<<<<<<<<<<< + * def prefix_search(self, prefix_search): + * self._prefix_search = prefix_search +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.prefix_search.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":102 + * self._reload_special_cases() + * + * @property # <<<<<<<<<<<<<< + * def suffix_search(self): + * return self._suffix_search +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_13suffix_search_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_13suffix_search_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_13suffix_search___get__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_13suffix_search___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/tokenizer.pyx":104 + * @property + * def suffix_search(self): + * return self._suffix_search # <<<<<<<<<<<<<< + * + * @suffix_search.setter +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_suffix_search); + __pyx_r = __pyx_v_self->_suffix_search; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":102 + * self._reload_special_cases() + * + * @property # <<<<<<<<<<<<<< + * def suffix_search(self): + * return self._suffix_search +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":106 + * return self._suffix_search + * + * @suffix_search.setter # <<<<<<<<<<<<<< + * def suffix_search(self, suffix_search): + * self._suffix_search = suffix_search +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_13suffix_search_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_suffix_search); /*proto*/ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_13suffix_search_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_suffix_search) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_13suffix_search_2__set__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), ((PyObject *)__pyx_v_suffix_search)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_13suffix_search_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_suffix_search) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/tokenizer.pyx":108 + * @suffix_search.setter + * def suffix_search(self, suffix_search): + * self._suffix_search = suffix_search # <<<<<<<<<<<<<< + * self._reload_special_cases() + * +*/ + __Pyx_INCREF(__pyx_v_suffix_search); + __Pyx_GIVEREF(__pyx_v_suffix_search); + __Pyx_GOTREF(__pyx_v_self->_suffix_search); + __Pyx_DECREF(__pyx_v_self->_suffix_search); + __pyx_v_self->_suffix_search = __pyx_v_suffix_search; + + /* "spacy/tokenizer.pyx":109 + * def suffix_search(self, suffix_search): + * self._suffix_search = suffix_search + * self._reload_special_cases() # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reload_special_cases, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":106 + * return self._suffix_search + * + * @suffix_search.setter # <<<<<<<<<<<<<< + * def suffix_search(self, suffix_search): + * self._suffix_search = suffix_search +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.suffix_search.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":111 + * self._reload_special_cases() + * + * @property # <<<<<<<<<<<<<< + * def infix_finditer(self): + * return self._infix_finditer +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_14infix_finditer_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_14infix_finditer_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_14infix_finditer___get__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_14infix_finditer___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/tokenizer.pyx":113 + * @property + * def infix_finditer(self): + * return self._infix_finditer # <<<<<<<<<<<<<< + * + * @infix_finditer.setter +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_infix_finditer); + __pyx_r = __pyx_v_self->_infix_finditer; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":111 + * self._reload_special_cases() + * + * @property # <<<<<<<<<<<<<< + * def infix_finditer(self): + * return self._infix_finditer +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":115 + * return self._infix_finditer + * + * @infix_finditer.setter # <<<<<<<<<<<<<< + * def infix_finditer(self, infix_finditer): + * self._infix_finditer = infix_finditer +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_14infix_finditer_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_infix_finditer); /*proto*/ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_14infix_finditer_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_infix_finditer) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_14infix_finditer_2__set__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), ((PyObject *)__pyx_v_infix_finditer)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_14infix_finditer_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_infix_finditer) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/tokenizer.pyx":117 + * @infix_finditer.setter + * def infix_finditer(self, infix_finditer): + * self._infix_finditer = infix_finditer # <<<<<<<<<<<<<< + * self._reload_special_cases() + * +*/ + __Pyx_INCREF(__pyx_v_infix_finditer); + __Pyx_GIVEREF(__pyx_v_infix_finditer); + __Pyx_GOTREF(__pyx_v_self->_infix_finditer); + __Pyx_DECREF(__pyx_v_self->_infix_finditer); + __pyx_v_self->_infix_finditer = __pyx_v_infix_finditer; + + /* "spacy/tokenizer.pyx":118 + * def infix_finditer(self, infix_finditer): + * self._infix_finditer = infix_finditer + * self._reload_special_cases() # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reload_special_cases, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":115 + * return self._infix_finditer + * + * @infix_finditer.setter # <<<<<<<<<<<<<< + * def infix_finditer(self, infix_finditer): + * self._infix_finditer = infix_finditer +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.infix_finditer.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":120 + * self._reload_special_cases() + * + * @property # <<<<<<<<<<<<<< + * def rules(self): + * return self._rules +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_5rules_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_5rules_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_5rules___get__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_5rules___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/tokenizer.pyx":122 + * @property + * def rules(self): + * return self._rules # <<<<<<<<<<<<<< + * + * @rules.setter +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_rules); + __pyx_r = __pyx_v_self->_rules; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":120 + * self._reload_special_cases() + * + * @property # <<<<<<<<<<<<<< + * def rules(self): + * return self._rules +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":124 + * return self._rules + * + * @rules.setter # <<<<<<<<<<<<<< + * def rules(self, rules): + * self._rules = {} +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_5rules_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_rules); /*proto*/ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_5rules_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_rules) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_5rules_2__set__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), ((PyObject *)__pyx_v_rules)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_5rules_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_rules) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/tokenizer.pyx":126 + * @rules.setter + * def rules(self, rules): + * self._rules = {} # <<<<<<<<<<<<<< + * self._flush_cache() + * self._flush_specials() +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->_rules); + __Pyx_DECREF(__pyx_v_self->_rules); + __pyx_v_self->_rules = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":127 + * def rules(self, rules): + * self._rules = {} + * self._flush_cache() # <<<<<<<<<<<<<< + * self._flush_specials() + * self._cache = PreshMap() +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_flush_cache, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":128 + * self._rules = {} + * self._flush_cache() + * self._flush_specials() # <<<<<<<<<<<<<< + * self._cache = PreshMap() + * self._specials = PreshMap() +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_flush_specials, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":129 + * self._flush_cache() + * self._flush_specials() + * self._cache = PreshMap() # <<<<<<<<<<<<<< + * self._specials = PreshMap() + * self._load_special_cases(rules) +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_7preshed_4maps_PreshMap, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_cache); + __Pyx_DECREF((PyObject *)__pyx_v_self->_cache); + __pyx_v_self->_cache = ((struct __pyx_obj_7preshed_4maps_PreshMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":130 + * self._flush_specials() + * self._cache = PreshMap() + * self._specials = PreshMap() # <<<<<<<<<<<<<< + * self._load_special_cases(rules) + * +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_7preshed_4maps_PreshMap, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_specials); + __Pyx_DECREF((PyObject *)__pyx_v_self->_specials); + __pyx_v_self->_specials = ((struct __pyx_obj_7preshed_4maps_PreshMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":131 + * self._cache = PreshMap() + * self._specials = PreshMap() + * self._load_special_cases(rules) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_rules}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_load_special_cases, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":124 + * return self._rules + * + * @rules.setter # <<<<<<<<<<<<<< + * def rules(self, rules): + * self._rules = {} +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.rules.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":133 + * self._load_special_cases(rules) + * + * @property # <<<<<<<<<<<<<< + * def faster_heuristics(self): + * return bool(self._faster_heuristics) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_17faster_heuristics_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_17faster_heuristics_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_17faster_heuristics___get__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_17faster_heuristics___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/tokenizer.pyx":135 + * @property + * def faster_heuristics(self): + * return bool(self._faster_heuristics) # <<<<<<<<<<<<<< + * + * @faster_heuristics.setter +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong((!(!(__pyx_v_self->_faster_heuristics != 0)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":133 + * self._load_special_cases(rules) + * + * @property # <<<<<<<<<<<<<< + * def faster_heuristics(self): + * return bool(self._faster_heuristics) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.faster_heuristics.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":137 + * return bool(self._faster_heuristics) + * + * @faster_heuristics.setter # <<<<<<<<<<<<<< + * def faster_heuristics(self, faster_heuristics): + * self._faster_heuristics = bool(faster_heuristics) +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_17faster_heuristics_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_faster_heuristics); /*proto*/ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_17faster_heuristics_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_faster_heuristics) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_17faster_heuristics_2__set__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), ((PyObject *)__pyx_v_faster_heuristics)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_17faster_heuristics_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_faster_heuristics) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/tokenizer.pyx":139 + * @faster_heuristics.setter + * def faster_heuristics(self, faster_heuristics): + * self._faster_heuristics = bool(faster_heuristics) # <<<<<<<<<<<<<< + * self._reload_special_cases() + * +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_faster_heuristics); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_v_self->_faster_heuristics = (!(!__pyx_t_1)); + + /* "spacy/tokenizer.pyx":140 + * def faster_heuristics(self, faster_heuristics): + * self._faster_heuristics = bool(faster_heuristics) + * self._reload_special_cases() # <<<<<<<<<<<<<< + * + * def __reduce__(self): +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reload_special_cases, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":137 + * return bool(self._faster_heuristics) + * + * @faster_heuristics.setter # <<<<<<<<<<<<<< + * def faster_heuristics(self, faster_heuristics): + * self._faster_heuristics = bool(faster_heuristics) +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.faster_heuristics.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":142 + * self._reload_special_cases() + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * args = (self.vocab, + * self.rules, +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_3__reduce__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_2__reduce__, "Tokenizer.__reduce__(self)"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_3__reduce__ = {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_3__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_2__reduce__}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_3__reduce__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_2__reduce__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_2__reduce__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_v_args = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "spacy/tokenizer.pyx":144 + * def __reduce__(self): + * args = (self.vocab, + * self.rules, # <<<<<<<<<<<<<< + * self.prefix_search, + * self.suffix_search, +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_rules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "spacy/tokenizer.pyx":145 + * args = (self.vocab, + * self.rules, + * self.prefix_search, # <<<<<<<<<<<<<< + * self.suffix_search, + * self.infix_finditer, +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_prefix_search); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "spacy/tokenizer.pyx":146 + * self.rules, + * self.prefix_search, + * self.suffix_search, # <<<<<<<<<<<<<< + * self.infix_finditer, + * self.token_match, +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_suffix_search); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "spacy/tokenizer.pyx":147 + * self.prefix_search, + * self.suffix_search, + * self.infix_finditer, # <<<<<<<<<<<<<< + * self.token_match, + * self.url_match) +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_infix_finditer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "spacy/tokenizer.pyx":148 + * self.suffix_search, + * self.infix_finditer, + * self.token_match, # <<<<<<<<<<<<<< + * self.url_match) + * return (self.__class__, args, None, None) +*/ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_token_match); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + + /* "spacy/tokenizer.pyx":149 + * self.infix_finditer, + * self.token_match, + * self.url_match) # <<<<<<<<<<<<<< + * return (self.__class__, args, None, None) + * +*/ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_url_match); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + + /* "spacy/tokenizer.pyx":143 + * + * def __reduce__(self): + * args = (self.vocab, # <<<<<<<<<<<<<< + * self.rules, + * self.prefix_search, +*/ + __pyx_t_7 = PyTuple_New(7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF((PyObject *)__pyx_v_self->vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->vocab); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_self->vocab)) != (0)) __PYX_ERR(0, 143, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 143, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 143, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_3) != (0)) __PYX_ERR(0, 143, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_4) != (0)) __PYX_ERR(0, 143, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_5) != (0)) __PYX_ERR(0, 143, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 6, __pyx_t_6) != (0)) __PYX_ERR(0, 143, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_v_args = ((PyObject*)__pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/tokenizer.pyx":150 + * self.token_match, + * self.url_match) + * return (self.__class__, args, None, None) # <<<<<<<<<<<<<< + * + * def __call__(self, str string): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7) != (0)) __PYX_ERR(0, 150, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_args) != (0)) __PYX_ERR(0, 150, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, Py_None) != (0)) __PYX_ERR(0, 150, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, Py_None) != (0)) __PYX_ERR(0, 150, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":142 + * self._reload_special_cases() + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * args = (self.vocab, + * self.rules, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_args); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":152 + * return (self.__class__, args, None, None) + * + * def __call__(self, str string): # <<<<<<<<<<<<<< + * """Tokenize a string. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_4__call__, "Tokenizer.__call__(self, str string)\n\nTokenize a string.\n\nstring (str): The string to tokenize.\nRETURNS (Doc): A container for linguistic annotations.\n\nDOCS: https://spacy.io/api/tokenizer#call"); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_9tokenizer_9Tokenizer_4__call__; +#endif +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_string = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_string,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 152, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 152, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__call__", 0) < (0)) __PYX_ERR(0, 152, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(0, 152, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 152, __pyx_L3_error) + } + __pyx_v_string = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 152, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_string), (&PyUnicode_Type), 1, "string", 1))) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_4__call__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_string); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_4__call__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_string) { + struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__call__", 0); + + /* "spacy/tokenizer.pyx":160 + * DOCS: https://spacy.io/api/tokenizer#call + * """ + * doc = self._tokenize_affixes(string, True) # <<<<<<<<<<<<<< + * self._apply_special_cases(doc) + * return doc +*/ + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_tokenize_affixes(__pyx_v_self, __pyx_v_string, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_doc = ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":161 + * """ + * doc = self._tokenize_affixes(string, True) + * self._apply_special_cases(doc) # <<<<<<<<<<<<<< + * return doc + * +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_apply_special_cases(__pyx_v_self, __pyx_v_doc); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 161, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":162 + * doc = self._tokenize_affixes(string, True) + * self._apply_special_cases(doc) + * return doc # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __pyx_r = ((PyObject *)__pyx_v_doc); + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":152 + * return (self.__class__, args, None, None) + * + * def __call__(self, str string): # <<<<<<<<<<<<<< + * """Tokenize a string. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_doc); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":164 + * return doc + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * cdef Doc _tokenize_affixes(self, str string, bint with_special_cases): + * """Tokenize according to affix and token_match settings. +*/ + +static struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_f_5spacy_9tokenizer_9Tokenizer__tokenize_affixes(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_string, int __pyx_v_with_special_cases) { + int __pyx_v_length; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc = 0; + int __pyx_v_i; + int __pyx_v_start; + int __pyx_v_has_special; + int __pyx_v_in_ws; + PyObject *__pyx_v_span = 0; + Py_UCS4 __pyx_v_uc; + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + Py_UCS4 __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + Py_ssize_t __pyx_t_13; + void *__pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_18; + int __pyx_t_19; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_tokenize_affixes", 0); + + /* "spacy/tokenizer.pyx":171 + * RETURNS (Doc): A container for linguistic annotations. + * """ + * if len(string) >= (2 ** 30): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E025.format(length=len(string))) + * cdef int length = len(string) +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 171, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_string); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_1 >= 0x40000000); + if (unlikely(__pyx_t_2)) { + + /* "spacy/tokenizer.pyx":172 + * """ + * if len(string) >= (2 ** 30): + * raise ValueError(Errors.E025.format(length=len(string))) # <<<<<<<<<<<<<< + * cdef int length = len(string) + * cdef Doc doc = Doc(self.vocab) +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E025); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 172, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_string); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_7 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_length, __pyx_t_7, __pyx_t_10, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 172, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":171 + * RETURNS (Doc): A container for linguistic annotations. + * """ + * if len(string) >= (2 ** 30): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E025.format(length=len(string))) + * cdef int length = len(string) +*/ + } + + /* "spacy/tokenizer.pyx":173 + * if len(string) >= (2 ** 30): + * raise ValueError(Errors.E025.format(length=len(string))) + * cdef int length = len(string) # <<<<<<<<<<<<<< + * cdef Doc doc = Doc(self.vocab) + * if length == 0: +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 173, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_string); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_v_length = __pyx_t_1; + + /* "spacy/tokenizer.pyx":174 + * raise ValueError(Errors.E025.format(length=len(string))) + * cdef int length = len(string) + * cdef Doc doc = Doc(self.vocab) # <<<<<<<<<<<<<< + * if length == 0: + * return doc +*/ + __pyx_t_5 = NULL; + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_self->vocab)}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_6tokens_3doc_Doc, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + } + __pyx_v_doc = ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":175 + * cdef int length = len(string) + * cdef Doc doc = Doc(self.vocab) + * if length == 0: # <<<<<<<<<<<<<< + * return doc + * cdef int i = 0 +*/ + __pyx_t_2 = (__pyx_v_length == 0); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":176 + * cdef Doc doc = Doc(self.vocab) + * if length == 0: + * return doc # <<<<<<<<<<<<<< + * cdef int i = 0 + * cdef int start = 0 +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __pyx_r = __pyx_v_doc; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":175 + * cdef int length = len(string) + * cdef Doc doc = Doc(self.vocab) + * if length == 0: # <<<<<<<<<<<<<< + * return doc + * cdef int i = 0 +*/ + } + + /* "spacy/tokenizer.pyx":177 + * if length == 0: + * return doc + * cdef int i = 0 # <<<<<<<<<<<<<< + * cdef int start = 0 + * cdef int has_special = 0 +*/ + __pyx_v_i = 0; + + /* "spacy/tokenizer.pyx":178 + * return doc + * cdef int i = 0 + * cdef int start = 0 # <<<<<<<<<<<<<< + * cdef int has_special = 0 + * cdef bint in_ws = string[0].isspace() +*/ + __pyx_v_start = 0; + + /* "spacy/tokenizer.pyx":179 + * cdef int i = 0 + * cdef int start = 0 + * cdef int has_special = 0 # <<<<<<<<<<<<<< + * cdef bint in_ws = string[0].isspace() + * cdef str span +*/ + __pyx_v_has_special = 0; + + /* "spacy/tokenizer.pyx":180 + * cdef int start = 0 + * cdef int has_special = 0 + * cdef bint in_ws = string[0].isspace() # <<<<<<<<<<<<<< + * cdef str span + * # The task here is much like string.split, but not quite +*/ + __pyx_t_11 = __Pyx_GetItemInt_Unicode(__pyx_v_string, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 0, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(__pyx_t_11 == (Py_UCS4)-1)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py_UNICODE_ISSPACE(__pyx_t_11); + __pyx_v_in_ws = __pyx_t_2; + + /* "spacy/tokenizer.pyx":186 + * # spans that are exactly ' '. So, our sequences will all be separated + * # by either ' ' or nothing. + * for uc in string: # <<<<<<<<<<<<<< + * if uc.isspace() != in_ws: + * if start < i: +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(0, 186, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_string); + __pyx_t_12 = __pyx_v_string; + __pyx_t_16 = __Pyx_init_unicode_iteration(__pyx_t_12, (&__pyx_t_13), (&__pyx_t_14), (&__pyx_t_15)); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 186, __pyx_L1_error) + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_13; __pyx_t_17++) { + __pyx_t_1 = __pyx_t_17; + __pyx_v_uc = __Pyx_PyUnicode_READ(__pyx_t_15, __pyx_t_14, __pyx_t_1); + + /* "spacy/tokenizer.pyx":187 + * # by either ' ' or nothing. + * for uc in string: + * if uc.isspace() != in_ws: # <<<<<<<<<<<<<< + * if start < i: + * # When we want to make this fast, get the data buffer once +*/ + __pyx_t_2 = __Pyx_Py_UNICODE_ISSPACE(__pyx_v_uc); + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_in_ws); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":188 + * for uc in string: + * if uc.isspace() != in_ws: + * if start < i: # <<<<<<<<<<<<<< + * # When we want to make this fast, get the data buffer once + * # with PyUnicode_AS_DATA, and then maintain a start_byte +*/ + __pyx_t_2 = (__pyx_v_start < __pyx_v_i); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":193 + * # and end_byte, so we can call hash64 directly. That way + * # we don't have to create the slice when we hit the cache. + * span = string[start:i] # <<<<<<<<<<<<<< + * key = hash_string(span) + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 193, __pyx_L1_error) + } + __pyx_t_4 = __Pyx_PyUnicode_Substring(__pyx_v_string, __pyx_v_start, __pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_span, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":194 + * # we don't have to create the slice when we hit the cache. + * span = string[start:i] + * key = hash_string(span) # <<<<<<<<<<<<<< + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): + * self._tokenize(doc, span, key, &has_special, with_special_cases) +*/ + __pyx_t_18 = __pyx_f_5spacy_7strings_hash_string(__pyx_v_span, 0); if (unlikely(__pyx_t_18 == ((__pyx_t_5spacy_8typedefs_hash_t)0))) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_v_key = __pyx_t_18; + + /* "spacy/tokenizer.pyx":195 + * span = string[start:i] + * key = hash_string(span) + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): # <<<<<<<<<<<<<< + * self._tokenize(doc, span, key, &has_special, with_special_cases) + * if uc == ' ': +*/ + __pyx_t_16 = ((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_try_specials_and_cache(__pyx_v_self, __pyx_v_key, __pyx_v_doc, (&__pyx_v_has_special), __pyx_v_with_special_cases); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_t_2 = (!(__pyx_t_16 != 0)); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":196 + * key = hash_string(span) + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): + * self._tokenize(doc, span, key, &has_special, with_special_cases) # <<<<<<<<<<<<<< + * if uc == ' ': + * doc.c[doc.length - 1].spacy = True +*/ + __pyx_t_16 = ((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_tokenize(__pyx_v_self, __pyx_v_doc, __pyx_v_span, __pyx_v_key, (&__pyx_v_has_special), __pyx_v_with_special_cases); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 196, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":195 + * span = string[start:i] + * key = hash_string(span) + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): # <<<<<<<<<<<<<< + * self._tokenize(doc, span, key, &has_special, with_special_cases) + * if uc == ' ': +*/ + } + + /* "spacy/tokenizer.pyx":188 + * for uc in string: + * if uc.isspace() != in_ws: + * if start < i: # <<<<<<<<<<<<<< + * # When we want to make this fast, get the data buffer once + * # with PyUnicode_AS_DATA, and then maintain a start_byte +*/ + } + + /* "spacy/tokenizer.pyx":197 + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): + * self._tokenize(doc, span, key, &has_special, with_special_cases) + * if uc == ' ': # <<<<<<<<<<<<<< + * doc.c[doc.length - 1].spacy = True + * start = i + 1 +*/ + __pyx_t_2 = (__pyx_v_uc == 32); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":198 + * self._tokenize(doc, span, key, &has_special, with_special_cases) + * if uc == ' ': + * doc.c[doc.length - 1].spacy = True # <<<<<<<<<<<<<< + * start = i + 1 + * else: +*/ + (__pyx_v_doc->c[(__pyx_v_doc->length - 1)]).spacy = 1; + + /* "spacy/tokenizer.pyx":199 + * if uc == ' ': + * doc.c[doc.length - 1].spacy = True + * start = i + 1 # <<<<<<<<<<<<<< + * else: + * start = i +*/ + __pyx_v_start = (__pyx_v_i + 1); + + /* "spacy/tokenizer.pyx":197 + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): + * self._tokenize(doc, span, key, &has_special, with_special_cases) + * if uc == ' ': # <<<<<<<<<<<<<< + * doc.c[doc.length - 1].spacy = True + * start = i + 1 +*/ + goto __pyx_L10; + } + + /* "spacy/tokenizer.pyx":201 + * start = i + 1 + * else: + * start = i # <<<<<<<<<<<<<< + * in_ws = not in_ws + * i += 1 +*/ + /*else*/ { + __pyx_v_start = __pyx_v_i; + } + __pyx_L10:; + + /* "spacy/tokenizer.pyx":202 + * else: + * start = i + * in_ws = not in_ws # <<<<<<<<<<<<<< + * i += 1 + * if start < i: +*/ + __pyx_v_in_ws = (!__pyx_v_in_ws); + + /* "spacy/tokenizer.pyx":187 + * # by either ' ' or nothing. + * for uc in string: + * if uc.isspace() != in_ws: # <<<<<<<<<<<<<< + * if start < i: + * # When we want to make this fast, get the data buffer once +*/ + } + + /* "spacy/tokenizer.pyx":203 + * start = i + * in_ws = not in_ws + * i += 1 # <<<<<<<<<<<<<< + * if start < i: + * span = string[start:] +*/ + __pyx_v_i = (__pyx_v_i + 1); + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "spacy/tokenizer.pyx":204 + * in_ws = not in_ws + * i += 1 + * if start < i: # <<<<<<<<<<<<<< + * span = string[start:] + * key = hash_string(span) +*/ + __pyx_t_2 = (__pyx_v_start < __pyx_v_i); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":205 + * i += 1 + * if start < i: + * span = string[start:] # <<<<<<<<<<<<<< + * key = hash_string(span) + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 205, __pyx_L1_error) + } + __pyx_t_4 = __Pyx_PyUnicode_Substring(__pyx_v_string, __pyx_v_start, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_span, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":206 + * if start < i: + * span = string[start:] + * key = hash_string(span) # <<<<<<<<<<<<<< + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): + * self._tokenize(doc, span, key, &has_special, with_special_cases) +*/ + __pyx_t_18 = __pyx_f_5spacy_7strings_hash_string(__pyx_v_span, 0); if (unlikely(__pyx_t_18 == ((__pyx_t_5spacy_8typedefs_hash_t)0))) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_v_key = __pyx_t_18; + + /* "spacy/tokenizer.pyx":207 + * span = string[start:] + * key = hash_string(span) + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): # <<<<<<<<<<<<<< + * self._tokenize(doc, span, key, &has_special, with_special_cases) + * doc.c[doc.length - 1].spacy = string[-1] == " " and not in_ws +*/ + __pyx_t_15 = ((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_try_specials_and_cache(__pyx_v_self, __pyx_v_key, __pyx_v_doc, (&__pyx_v_has_special), __pyx_v_with_special_cases); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_2 = (!(__pyx_t_15 != 0)); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":208 + * key = hash_string(span) + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): + * self._tokenize(doc, span, key, &has_special, with_special_cases) # <<<<<<<<<<<<<< + * doc.c[doc.length - 1].spacy = string[-1] == " " and not in_ws + * return doc +*/ + __pyx_t_15 = ((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_tokenize(__pyx_v_self, __pyx_v_doc, __pyx_v_span, __pyx_v_key, (&__pyx_v_has_special), __pyx_v_with_special_cases); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 208, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":207 + * span = string[start:] + * key = hash_string(span) + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): # <<<<<<<<<<<<<< + * self._tokenize(doc, span, key, &has_special, with_special_cases) + * doc.c[doc.length - 1].spacy = string[-1] == " " and not in_ws +*/ + } + + /* "spacy/tokenizer.pyx":209 + * if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): + * self._tokenize(doc, span, key, &has_special, with_special_cases) + * doc.c[doc.length - 1].spacy = string[-1] == " " and not in_ws # <<<<<<<<<<<<<< + * return doc + * +*/ + __pyx_t_11 = __Pyx_GetItemInt_Unicode(__pyx_v_string, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 0, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(__pyx_t_11 == (Py_UCS4)-1)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_19 = (__pyx_t_11 == 32); + if (__pyx_t_19) { + } else { + __pyx_t_2 = __pyx_t_19; + goto __pyx_L13_bool_binop_done; + } + __pyx_t_19 = (!__pyx_v_in_ws); + __pyx_t_2 = __pyx_t_19; + __pyx_L13_bool_binop_done:; + (__pyx_v_doc->c[(__pyx_v_doc->length - 1)]).spacy = __pyx_t_2; + + /* "spacy/tokenizer.pyx":204 + * in_ws = not in_ws + * i += 1 + * if start < i: # <<<<<<<<<<<<<< + * span = string[start:] + * key = hash_string(span) +*/ + } + + /* "spacy/tokenizer.pyx":210 + * self._tokenize(doc, span, key, &has_special, with_special_cases) + * doc.c[doc.length - 1].spacy = string[-1] == " " and not in_ws + * return doc # <<<<<<<<<<<<<< + * + * def pipe(self, texts, batch_size=1000): +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __pyx_r = __pyx_v_doc; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":164 + * return doc + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * cdef Doc _tokenize_affixes(self, str string, bint with_special_cases): + * """Tokenize according to affix and token_match settings. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._tokenize_affixes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_doc); + __Pyx_XDECREF(__pyx_v_span); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_9tokenizer_9Tokenizer_8generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/tokenizer.pyx":212 + * return doc + * + * def pipe(self, texts, batch_size=1000): # <<<<<<<<<<<<<< + * """Tokenize a stream of texts. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_7pipe(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_6pipe, "Tokenizer.pipe(self, texts, batch_size=1000)\n\nTokenize a stream of texts.\n\ntexts: A sequence of unicode texts.\nbatch_size (int): Number of texts to accumulate in an internal buffer.\nDefaults to 1000.\nYIELDS (Doc): A sequence of Doc objects, in order.\n\nDOCS: https://spacy.io/api/tokenizer#pipe"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_7pipe = {"pipe", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_7pipe, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_6pipe}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_7pipe(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_texts = 0; + CYTHON_UNUSED PyObject *__pyx_v_batch_size = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pipe (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_texts,&__pyx_mstate_global->__pyx_n_u_batch_size,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 212, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 212, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 212, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "pipe", 0) < (0)) __PYX_ERR(0, 212, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1000)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pipe", 0, 1, 2, i); __PYX_ERR(0, 212, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 212, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 212, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1000)); + } + __pyx_v_texts = values[0]; + __pyx_v_batch_size = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("pipe", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 212, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.pipe", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_6pipe(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_texts, __pyx_v_batch_size); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_6pipe(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_texts, CYTHON_UNUSED PyObject *__pyx_v_batch_size) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pipe", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct__pipe(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 212, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_texts = __pyx_v_texts; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_texts); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_texts); + __pyx_cur_scope->__pyx_v_batch_size = __pyx_v_batch_size; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_batch_size); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_batch_size); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_9tokenizer_9Tokenizer_8generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_pipe, __pyx_mstate_global->__pyx_n_u_Tokenizer_pipe, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer); if (unlikely(!gen)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.pipe", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_9tokenizer_9Tokenizer_8generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe *__pyx_cur_scope = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pipe", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 212, __pyx_L1_error) + } + + /* "spacy/tokenizer.pyx":222 + * DOCS: https://spacy.io/api/tokenizer#pipe + * """ + * for text in texts: # <<<<<<<<<<<<<< + * yield self(text) + * +*/ + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_texts)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_texts)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_v_texts; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_texts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 222, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 222, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 222, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_text); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_text, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":223 + * """ + * for text in texts: + * yield self(text) # <<<<<<<<<<<<<< + * + * def _flush_cache(self): +*/ + __pyx_t_5 = NULL; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_t_6 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_t_7 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_text}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 223, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":222 + * DOCS: https://spacy.io/api/tokenizer#pipe + * """ + * for text in texts: # <<<<<<<<<<<<<< + * yield self(text) + * +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "spacy/tokenizer.pyx":212 + * return doc + * + * def pipe(self, texts, batch_size=1000): # <<<<<<<<<<<<<< + * """Tokenize a stream of texts. + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("pipe", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":225 + * yield self(text) + * + * def _flush_cache(self): # <<<<<<<<<<<<<< + * self._reset_cache([key for key in self._cache]) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10_flush_cache(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_9_flush_cache, "Tokenizer._flush_cache(self)"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_10_flush_cache = {"_flush_cache", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_10_flush_cache, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_9_flush_cache}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10_flush_cache(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_flush_cache (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_flush_cache", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_flush_cache", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_9_flush_cache(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_9_flush_cache(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_flush_cache", 0); + + /* "spacy/tokenizer.pyx":226 + * + * def _flush_cache(self): + * self._reset_cache([key for key in self._cache]) # <<<<<<<<<<<<<< + * + * def _reset_cache(self, keys): +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->_cache))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->_cache))) { + __pyx_t_4 = ((PyObject *)__pyx_v_self->_cache); __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->_cache)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 226, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 226, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 226, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5)); + #else + __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); + #endif + ++__pyx_t_5; + } + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 226, __pyx_L1_error) + } else { + __pyx_t_7 = __pyx_t_6(__pyx_t_4); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 226, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_7); + __pyx_t_7 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_v_key))) __PYX_ERR(0, 226, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reset_cache, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":225 + * yield self(text) + * + * def _flush_cache(self): # <<<<<<<<<<<<<< + * self._reset_cache([key for key in self._cache]) + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._flush_cache", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":228 + * self._reset_cache([key for key in self._cache]) + * + * def _reset_cache(self, keys): # <<<<<<<<<<<<<< + * for k in keys: + * cached = <_Cached*>self._cache.get(k) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_12_reset_cache(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_11_reset_cache, "Tokenizer._reset_cache(self, keys)"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_12_reset_cache = {"_reset_cache", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_12_reset_cache, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_11_reset_cache}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_12_reset_cache(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_keys = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_reset_cache (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_keys,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 228, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 228, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_reset_cache", 0) < (0)) __PYX_ERR(0, 228, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_reset_cache", 1, 1, 1, i); __PYX_ERR(0, 228, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 228, __pyx_L3_error) + } + __pyx_v_keys = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_reset_cache", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 228, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._reset_cache", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_11_reset_cache(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_keys); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_11_reset_cache(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_keys) { + PyObject *__pyx_v_k = NULL; + struct __pyx_t_5spacy_5vocab__Cached *__pyx_v_cached; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + __pyx_t_7preshed_4maps_key_t __pyx_t_5; + void *__pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_reset_cache", 0); + + /* "spacy/tokenizer.pyx":229 + * + * def _reset_cache(self, keys): + * for k in keys: # <<<<<<<<<<<<<< + * cached = <_Cached*>self._cache.get(k) + * del self._cache[k] +*/ + if (likely(PyList_CheckExact(__pyx_v_keys)) || PyTuple_CheckExact(__pyx_v_keys)) { + __pyx_t_1 = __pyx_v_keys; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 229, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 229, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 229, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":230 + * def _reset_cache(self, keys): + * for k in keys: + * cached = <_Cached*>self._cache.get(k) # <<<<<<<<<<<<<< + * del self._cache[k] + * if cached is not NULL: +*/ + __pyx_t_5 = __Pyx_PyLong_As_uint64_t(__pyx_v_k); if (unlikely((__pyx_t_5 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L1_error) + __pyx_t_6 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_cache->__pyx_vtab)->get(__pyx_v_self->_cache, __pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L1_error) + __pyx_v_cached = ((struct __pyx_t_5spacy_5vocab__Cached *)__pyx_t_6); + + /* "spacy/tokenizer.pyx":231 + * for k in keys: + * cached = <_Cached*>self._cache.get(k) + * del self._cache[k] # <<<<<<<<<<<<<< + * if cached is not NULL: + * self.mem.free(cached) +*/ + if (unlikely((PyObject_DelItem(((PyObject *)__pyx_v_self->_cache), __pyx_v_k) < 0))) __PYX_ERR(0, 231, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":232 + * cached = <_Cached*>self._cache.get(k) + * del self._cache[k] + * if cached is not NULL: # <<<<<<<<<<<<<< + * self.mem.free(cached) + * +*/ + __pyx_t_7 = (__pyx_v_cached != NULL); + if (__pyx_t_7) { + + /* "spacy/tokenizer.pyx":233 + * del self._cache[k] + * if cached is not NULL: + * self.mem.free(cached) # <<<<<<<<<<<<<< + * + * def _flush_specials(self): +*/ + ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->free(__pyx_v_self->mem, __pyx_v_cached); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":232 + * cached = <_Cached*>self._cache.get(k) + * del self._cache[k] + * if cached is not NULL: # <<<<<<<<<<<<<< + * self.mem.free(cached) + * +*/ + } + + /* "spacy/tokenizer.pyx":229 + * + * def _reset_cache(self, keys): + * for k in keys: # <<<<<<<<<<<<<< + * cached = <_Cached*>self._cache.get(k) + * del self._cache[k] +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":228 + * self._reset_cache([key for key in self._cache]) + * + * def _reset_cache(self, keys): # <<<<<<<<<<<<<< + * for k in keys: + * cached = <_Cached*>self._cache.get(k) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._reset_cache", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_k); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":235 + * self.mem.free(cached) + * + * def _flush_specials(self): # <<<<<<<<<<<<<< + * self._special_matcher = PhraseMatcher(self.vocab) + * for k in self._specials: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_14_flush_specials(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_13_flush_specials, "Tokenizer._flush_specials(self)"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_14_flush_specials = {"_flush_specials", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_14_flush_specials, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_13_flush_specials}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_14_flush_specials(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_flush_specials (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_flush_specials", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_flush_specials", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_13_flush_specials(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_13_flush_specials(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_v_k = NULL; + struct __pyx_t_5spacy_5vocab__Cached *__pyx_v_cached; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + __pyx_t_7preshed_4maps_key_t __pyx_t_6; + void *__pyx_t_7; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_flush_specials", 0); + + /* "spacy/tokenizer.pyx":236 + * + * def _flush_specials(self): + * self._special_matcher = PhraseMatcher(self.vocab) # <<<<<<<<<<<<<< + * for k in self._specials: + * cached = <_Cached*>self._specials.get(k) +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self->vocab)}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_7matcher_13phrasematcher_PhraseMatcher, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_special_matcher); + __Pyx_DECREF((PyObject *)__pyx_v_self->_special_matcher); + __pyx_v_self->_special_matcher = ((struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":237 + * def _flush_specials(self): + * self._special_matcher = PhraseMatcher(self.vocab) + * for k in self._specials: # <<<<<<<<<<<<<< + * cached = <_Cached*>self._specials.get(k) + * del self._specials[k] +*/ + if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->_specials))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->_specials))) { + __pyx_t_1 = ((PyObject *)__pyx_v_self->_specials); __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self->_specials)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 237, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 237, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_4; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 237, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); + #endif + ++__pyx_t_4; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 237, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":238 + * self._special_matcher = PhraseMatcher(self.vocab) + * for k in self._specials: + * cached = <_Cached*>self._specials.get(k) # <<<<<<<<<<<<<< + * del self._specials[k] + * if cached is not NULL: +*/ + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_v_k); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_7 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_specials->__pyx_vtab)->get(__pyx_v_self->_specials, __pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_v_cached = ((struct __pyx_t_5spacy_5vocab__Cached *)__pyx_t_7); + + /* "spacy/tokenizer.pyx":239 + * for k in self._specials: + * cached = <_Cached*>self._specials.get(k) + * del self._specials[k] # <<<<<<<<<<<<<< + * if cached is not NULL: + * self.mem.free(cached) +*/ + if (unlikely((PyObject_DelItem(((PyObject *)__pyx_v_self->_specials), __pyx_v_k) < 0))) __PYX_ERR(0, 239, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":240 + * cached = <_Cached*>self._specials.get(k) + * del self._specials[k] + * if cached is not NULL: # <<<<<<<<<<<<<< + * self.mem.free(cached) + * +*/ + __pyx_t_8 = (__pyx_v_cached != NULL); + if (__pyx_t_8) { + + /* "spacy/tokenizer.pyx":241 + * del self._specials[k] + * if cached is not NULL: + * self.mem.free(cached) # <<<<<<<<<<<<<< + * + * cdef int _apply_special_cases(self, Doc doc) except -1: +*/ + ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->free(__pyx_v_self->mem, __pyx_v_cached); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":240 + * cached = <_Cached*>self._specials.get(k) + * del self._specials[k] + * if cached is not NULL: # <<<<<<<<<<<<<< + * self.mem.free(cached) + * +*/ + } + + /* "spacy/tokenizer.pyx":237 + * def _flush_specials(self): + * self._special_matcher = PhraseMatcher(self.vocab) + * for k in self._specials: # <<<<<<<<<<<<<< + * cached = <_Cached*>self._specials.get(k) + * del self._specials[k] +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":235 + * self.mem.free(cached) + * + * def _flush_specials(self): # <<<<<<<<<<<<<< + * self._special_matcher = PhraseMatcher(self.vocab) + * for k in self._specials: +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._flush_specials", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_k); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":243 + * self.mem.free(cached) + * + * cdef int _apply_special_cases(self, Doc doc) except -1: # <<<<<<<<<<<<<< + * """Retokenize doc according to special cases. + * +*/ + +static int __pyx_f_5spacy_9tokenizer_9Tokenizer__apply_special_cases(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc) { + int __pyx_v_i; + int __pyx_v_max_length; + int __pyx_v_modify_in_place; + struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem = 0; + std::vector __pyx_v_c_matches; + std::vector __pyx_v_c_filtered; + int __pyx_v_offset; + int __pyx_v_modified_doc_length; + PyObject *__pyx_v_span_data = NULL; + struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_tokens; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *(*__pyx_t_8)(PyObject *); + int __pyx_t_9; + struct __pyx_t_5spacy_7structs_TokenC *__pyx_t_10; + void *__pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_apply_special_cases", 0); + + /* "spacy/tokenizer.pyx":249 + * """ + * cdef int i + * cdef int max_length = 0 # <<<<<<<<<<<<<< + * cdef bint modify_in_place + * cdef Pool mem = Pool() +*/ + __pyx_v_max_length = 0; + + /* "spacy/tokenizer.pyx":251 + * cdef int max_length = 0 + * cdef bint modify_in_place + * cdef Pool mem = Pool() # <<<<<<<<<<<<<< + * cdef vector[SpanC] c_matches + * cdef vector[SpanC] c_filtered +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":257 + * cdef int modified_doc_length + * # Find matches for special cases + * self._special_matcher.find_matches(doc, 0, doc.length, &c_matches) # <<<<<<<<<<<<<< + * # Skip processing if no matches + * if c_matches.size() == 0: +*/ + ((struct __pyx_vtabstruct_5spacy_7matcher_13phrasematcher_PhraseMatcher *)__pyx_v_self->_special_matcher->__pyx_vtab)->find_matches(__pyx_v_self->_special_matcher, __pyx_v_doc, 0, __pyx_v_doc->length, (&__pyx_v_c_matches)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":259 + * self._special_matcher.find_matches(doc, 0, doc.length, &c_matches) + * # Skip processing if no matches + * if c_matches.size() == 0: # <<<<<<<<<<<<<< + * return True + * self._filter_special_spans(c_matches, c_filtered, doc.length) +*/ + __pyx_t_4 = (__pyx_v_c_matches.size() == 0); + if (__pyx_t_4) { + + /* "spacy/tokenizer.pyx":260 + * # Skip processing if no matches + * if c_matches.size() == 0: + * return True # <<<<<<<<<<<<<< + * self._filter_special_spans(c_matches, c_filtered, doc.length) + * # Put span info in span.start-indexed dict and calculate maximum +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":259 + * self._special_matcher.find_matches(doc, 0, doc.length, &c_matches) + * # Skip processing if no matches + * if c_matches.size() == 0: # <<<<<<<<<<<<<< + * return True + * self._filter_special_spans(c_matches, c_filtered, doc.length) +*/ + } + + /* "spacy/tokenizer.pyx":261 + * if c_matches.size() == 0: + * return True + * self._filter_special_spans(c_matches, c_filtered, doc.length) # <<<<<<<<<<<<<< + * # Put span info in span.start-indexed dict and calculate maximum + * # intermediate document size +*/ + ((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_filter_special_spans(__pyx_v_self, __pyx_v_c_matches, __pyx_v_c_filtered, __pyx_v_doc->length); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 261, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":264 + * # Put span info in span.start-indexed dict and calculate maximum + * # intermediate document size + * (span_data, max_length, modify_in_place) = self._prepare_special_spans(doc, c_filtered) # <<<<<<<<<<<<<< + * # If modifications never increase doc length, can modify in place + * if modify_in_place: +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_prepare_special_spans(__pyx_v_self, __pyx_v_doc, __pyx_v_c_filtered); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 264, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); + __Pyx_INCREF(__pyx_t_6); + } else { + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + } + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); + index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < (0)) __PYX_ERR(0, 264, __pyx_L1_error) + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L5_unpacking_done; + __pyx_L4_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 264, __pyx_L1_error) + __pyx_L5_unpacking_done:; + } + __pyx_t_9 = __Pyx_PyLong_As_int(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_span_data = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_v_max_length = __pyx_t_9; + __pyx_v_modify_in_place = __pyx_t_4; + + /* "spacy/tokenizer.pyx":266 + * (span_data, max_length, modify_in_place) = self._prepare_special_spans(doc, c_filtered) + * # If modifications never increase doc length, can modify in place + * if modify_in_place: # <<<<<<<<<<<<<< + * tokens = doc.c + * # Otherwise create a separate array to store modified tokens +*/ + if (__pyx_v_modify_in_place) { + + /* "spacy/tokenizer.pyx":267 + * # If modifications never increase doc length, can modify in place + * if modify_in_place: + * tokens = doc.c # <<<<<<<<<<<<<< + * # Otherwise create a separate array to store modified tokens + * else: +*/ + __pyx_t_10 = __pyx_v_doc->c; + __pyx_v_tokens = __pyx_t_10; + + /* "spacy/tokenizer.pyx":266 + * (span_data, max_length, modify_in_place) = self._prepare_special_spans(doc, c_filtered) + * # If modifications never increase doc length, can modify in place + * if modify_in_place: # <<<<<<<<<<<<<< + * tokens = doc.c + * # Otherwise create a separate array to store modified tokens +*/ + goto __pyx_L6; + } + + /* "spacy/tokenizer.pyx":270 + * # Otherwise create a separate array to store modified tokens + * else: + * assert max_length > 0 # <<<<<<<<<<<<<< + * tokens = mem.alloc(max_length, sizeof(TokenC)) + * # Modify tokenization according to filtered special cases +*/ + /*else*/ { + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = (__pyx_v_max_length > 0); + if (unlikely(!__pyx_t_4)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 270, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 270, __pyx_L1_error) + #endif + + /* "spacy/tokenizer.pyx":271 + * else: + * assert max_length > 0 + * tokens = mem.alloc(max_length, sizeof(TokenC)) # <<<<<<<<<<<<<< + * # Modify tokenization according to filtered special cases + * offset = self._retokenize_special_spans(doc, tokens, span_data) +*/ + __pyx_t_11 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, __pyx_v_max_length, (sizeof(struct __pyx_t_5spacy_7structs_TokenC))); if (unlikely(__pyx_t_11 == ((void *)NULL))) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_v_tokens = ((struct __pyx_t_5spacy_7structs_TokenC *)__pyx_t_11); + } + __pyx_L6:; + + /* "spacy/tokenizer.pyx":273 + * tokens = mem.alloc(max_length, sizeof(TokenC)) + * # Modify tokenization according to filtered special cases + * offset = self._retokenize_special_spans(doc, tokens, span_data) # <<<<<<<<<<<<<< + * # Allocate more memory for doc if needed + * modified_doc_length = doc.length + offset +*/ + __pyx_t_9 = ((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_retokenize_special_spans(__pyx_v_self, __pyx_v_doc, __pyx_v_tokens, __pyx_v_span_data); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error) + __pyx_v_offset = __pyx_t_9; + + /* "spacy/tokenizer.pyx":275 + * offset = self._retokenize_special_spans(doc, tokens, span_data) + * # Allocate more memory for doc if needed + * modified_doc_length = doc.length + offset # <<<<<<<<<<<<<< + * while modified_doc_length >= doc.max_length: + * doc._realloc(doc.max_length * 2) +*/ + __pyx_v_modified_doc_length = (__pyx_v_doc->length + __pyx_v_offset); + + /* "spacy/tokenizer.pyx":276 + * # Allocate more memory for doc if needed + * modified_doc_length = doc.length + offset + * while modified_doc_length >= doc.max_length: # <<<<<<<<<<<<<< + * doc._realloc(doc.max_length * 2) + * # If not modified in place, copy tokens back to doc +*/ + while (1) { + __pyx_t_4 = (__pyx_v_modified_doc_length >= __pyx_v_doc->max_length); + if (!__pyx_t_4) break; + + /* "spacy/tokenizer.pyx":277 + * modified_doc_length = doc.length + offset + * while modified_doc_length >= doc.max_length: + * doc._realloc(doc.max_length * 2) # <<<<<<<<<<<<<< + * # If not modified in place, copy tokens back to doc + * if not modify_in_place: +*/ + __pyx_t_6 = ((PyObject *)__pyx_v_doc); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyLong_From_long((__pyx_v_doc->max_length * 2)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_realloc, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "spacy/tokenizer.pyx":279 + * doc._realloc(doc.max_length * 2) + * # If not modified in place, copy tokens back to doc + * if not modify_in_place: # <<<<<<<<<<<<<< + * memcpy(doc.c, tokens, max_length * sizeof(TokenC)) + * for i in range(doc.length + offset, doc.length): +*/ + __pyx_t_4 = (!__pyx_v_modify_in_place); + if (__pyx_t_4) { + + /* "spacy/tokenizer.pyx":280 + * # If not modified in place, copy tokens back to doc + * if not modify_in_place: + * memcpy(doc.c, tokens, max_length * sizeof(TokenC)) # <<<<<<<<<<<<<< + * for i in range(doc.length + offset, doc.length): + * memset(&doc.c[i], 0, sizeof(TokenC)) +*/ + (void)(memcpy(__pyx_v_doc->c, __pyx_v_tokens, (__pyx_v_max_length * (sizeof(struct __pyx_t_5spacy_7structs_TokenC))))); + + /* "spacy/tokenizer.pyx":279 + * doc._realloc(doc.max_length * 2) + * # If not modified in place, copy tokens back to doc + * if not modify_in_place: # <<<<<<<<<<<<<< + * memcpy(doc.c, tokens, max_length * sizeof(TokenC)) + * for i in range(doc.length + offset, doc.length): +*/ + } + + /* "spacy/tokenizer.pyx":281 + * if not modify_in_place: + * memcpy(doc.c, tokens, max_length * sizeof(TokenC)) + * for i in range(doc.length + offset, doc.length): # <<<<<<<<<<<<<< + * memset(&doc.c[i], 0, sizeof(TokenC)) + * doc.c[i].lex = &EMPTY_LEXEME +*/ + __pyx_t_9 = __pyx_v_doc->length; + __pyx_t_12 = __pyx_t_9; + for (__pyx_t_13 = (__pyx_v_doc->length + __pyx_v_offset); __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_i = __pyx_t_13; + + /* "spacy/tokenizer.pyx":282 + * memcpy(doc.c, tokens, max_length * sizeof(TokenC)) + * for i in range(doc.length + offset, doc.length): + * memset(&doc.c[i], 0, sizeof(TokenC)) # <<<<<<<<<<<<<< + * doc.c[i].lex = &EMPTY_LEXEME + * doc.length = doc.length + offset +*/ + (void)(memset((&(__pyx_v_doc->c[__pyx_v_i])), 0, (sizeof(struct __pyx_t_5spacy_7structs_TokenC)))); + + /* "spacy/tokenizer.pyx":283 + * for i in range(doc.length + offset, doc.length): + * memset(&doc.c[i], 0, sizeof(TokenC)) + * doc.c[i].lex = &EMPTY_LEXEME # <<<<<<<<<<<<<< + * doc.length = doc.length + offset + * return True +*/ + (__pyx_v_doc->c[__pyx_v_i]).lex = (&__pyx_v_5spacy_6lexeme_EMPTY_LEXEME); + } + + /* "spacy/tokenizer.pyx":284 + * memset(&doc.c[i], 0, sizeof(TokenC)) + * doc.c[i].lex = &EMPTY_LEXEME + * doc.length = doc.length + offset # <<<<<<<<<<<<<< + * return True + * +*/ + __pyx_v_doc->length = (__pyx_v_doc->length + __pyx_v_offset); + + /* "spacy/tokenizer.pyx":285 + * doc.c[i].lex = &EMPTY_LEXEME + * doc.length = doc.length + offset + * return True # <<<<<<<<<<<<<< + * + * cdef void _filter_special_spans(self, vector[SpanC] &original, vector[SpanC] &filtered, int doc_len) nogil: +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":243 + * self.mem.free(cached) + * + * cdef int _apply_special_cases(self, Doc doc) except -1: # <<<<<<<<<<<<<< + * """Retokenize doc according to special cases. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._apply_special_cases", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_mem); + __Pyx_XDECREF(__pyx_v_span_data); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":287 + * return True + * + * cdef void _filter_special_spans(self, vector[SpanC] &original, vector[SpanC] &filtered, int doc_len) nogil: # <<<<<<<<<<<<<< + * + * cdef int seen_i +*/ + +static void __pyx_f_5spacy_9tokenizer_9Tokenizer__filter_special_spans(CYTHON_UNUSED struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, std::vector &__pyx_v_original, std::vector &__pyx_v_filtered, CYTHON_UNUSED int __pyx_v_doc_len) { + int __pyx_v_seen_i; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_span; + std::set __pyx_v_seen_tokens; + int __pyx_v_orig_i; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "spacy/tokenizer.pyx":292 + * cdef SpanC span + * cdef stdset[int] seen_tokens + * stdsort(original.begin(), original.end(), len_start_cmp) # <<<<<<<<<<<<<< + * cdef int orig_i = original.size() - 1 + * while orig_i >= 0: +*/ + sort(__pyx_v_original.begin(), __pyx_v_original.end(), __pyx_f_5spacy_9tokenizer_len_start_cmp); + + /* "spacy/tokenizer.pyx":293 + * cdef stdset[int] seen_tokens + * stdsort(original.begin(), original.end(), len_start_cmp) + * cdef int orig_i = original.size() - 1 # <<<<<<<<<<<<<< + * while orig_i >= 0: + * span = original[orig_i] +*/ + __pyx_v_orig_i = (__pyx_v_original.size() - 1); + + /* "spacy/tokenizer.pyx":294 + * stdsort(original.begin(), original.end(), len_start_cmp) + * cdef int orig_i = original.size() - 1 + * while orig_i >= 0: # <<<<<<<<<<<<<< + * span = original[orig_i] + * if not seen_tokens.count(span.start) and not seen_tokens.count(span.end - 1): +*/ + while (1) { + __pyx_t_1 = (__pyx_v_orig_i >= 0); + if (!__pyx_t_1) break; + + /* "spacy/tokenizer.pyx":295 + * cdef int orig_i = original.size() - 1 + * while orig_i >= 0: + * span = original[orig_i] # <<<<<<<<<<<<<< + * if not seen_tokens.count(span.start) and not seen_tokens.count(span.end - 1): + * filtered.push_back(span) +*/ + __pyx_v_span = (__pyx_v_original[__pyx_v_orig_i]); + + /* "spacy/tokenizer.pyx":296 + * while orig_i >= 0: + * span = original[orig_i] + * if not seen_tokens.count(span.start) and not seen_tokens.count(span.end - 1): # <<<<<<<<<<<<<< + * filtered.push_back(span) + * for seen_i in range(span.start, span.end): +*/ + __pyx_t_2 = (!(__pyx_v_seen_tokens.count(__pyx_v_span.start) != 0)); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_2 = (!(__pyx_v_seen_tokens.count((__pyx_v_span.end - 1)) != 0)); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":297 + * span = original[orig_i] + * if not seen_tokens.count(span.start) and not seen_tokens.count(span.end - 1): + * filtered.push_back(span) # <<<<<<<<<<<<<< + * for seen_i in range(span.start, span.end): + * seen_tokens.insert(seen_i) +*/ + try { + __pyx_v_filtered.push_back(__pyx_v_span); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(0, 297, __pyx_L1_error) + } + + /* "spacy/tokenizer.pyx":296 + * while orig_i >= 0: + * span = original[orig_i] + * if not seen_tokens.count(span.start) and not seen_tokens.count(span.end - 1): # <<<<<<<<<<<<<< + * filtered.push_back(span) + * for seen_i in range(span.start, span.end): +*/ + } + + /* "spacy/tokenizer.pyx":298 + * if not seen_tokens.count(span.start) and not seen_tokens.count(span.end - 1): + * filtered.push_back(span) + * for seen_i in range(span.start, span.end): # <<<<<<<<<<<<<< + * seen_tokens.insert(seen_i) + * orig_i -= 1 +*/ + __pyx_t_3 = __pyx_v_span.end; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = __pyx_v_span.start; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_seen_i = __pyx_t_5; + + /* "spacy/tokenizer.pyx":299 + * filtered.push_back(span) + * for seen_i in range(span.start, span.end): + * seen_tokens.insert(seen_i) # <<<<<<<<<<<<<< + * orig_i -= 1 + * stdsort(filtered.begin(), filtered.end(), start_cmp) +*/ + try { + __pyx_v_seen_tokens.insert(__pyx_v_seen_i); + } catch(...) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_CppExn2PyErr(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __PYX_ERR(0, 299, __pyx_L1_error) + } + } + + /* "spacy/tokenizer.pyx":300 + * for seen_i in range(span.start, span.end): + * seen_tokens.insert(seen_i) + * orig_i -= 1 # <<<<<<<<<<<<<< + * stdsort(filtered.begin(), filtered.end(), start_cmp) + * +*/ + __pyx_v_orig_i = (__pyx_v_orig_i - 1); + } + + /* "spacy/tokenizer.pyx":301 + * seen_tokens.insert(seen_i) + * orig_i -= 1 + * stdsort(filtered.begin(), filtered.end(), start_cmp) # <<<<<<<<<<<<<< + * + * cdef object _prepare_special_spans(self, Doc doc, vector[SpanC] &filtered): +*/ + sort(__pyx_v_filtered.begin(), __pyx_v_filtered.end(), __pyx_f_5spacy_9tokenizer_start_cmp); + + /* "spacy/tokenizer.pyx":287 + * return True + * + * cdef void _filter_special_spans(self, vector[SpanC] &original, vector[SpanC] &filtered, int doc_len) nogil: # <<<<<<<<<<<<<< + * + * cdef int seen_i +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._filter_special_spans", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; +} + +/* "spacy/tokenizer.pyx":303 + * stdsort(filtered.begin(), filtered.end(), start_cmp) + * + * cdef object _prepare_special_spans(self, Doc doc, vector[SpanC] &filtered): # <<<<<<<<<<<<<< + * spans = [doc[match.start:match.end] for match in filtered] + * cdef bint modify_in_place = True +*/ + +static PyObject *__pyx_f_5spacy_9tokenizer_9Tokenizer__prepare_special_spans(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc, std::vector &__pyx_v_filtered) { + PyObject *__pyx_v_spans = NULL; + int __pyx_v_modify_in_place; + int __pyx_v_curr_length; + int __pyx_v_max_length; + int __pyx_v_span_length_diff; + PyObject *__pyx_v_span_data = NULL; + PyObject *__pyx_v_span = NULL; + PyObject *__pyx_v_rule = NULL; + struct __pyx_t_5spacy_7structs_SpanC __pyx_v_match; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + std::vector ::iterator __pyx_t_2; + struct __pyx_t_5spacy_7structs_SpanC __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_prepare_special_spans", 0); + + /* "spacy/tokenizer.pyx":304 + * + * cdef object _prepare_special_spans(self, Doc doc, vector[SpanC] &filtered): + * spans = [doc[match.start:match.end] for match in filtered] # <<<<<<<<<<<<<< + * cdef bint modify_in_place = True + * cdef int curr_length = doc.length +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_filtered.begin(); + for (; __pyx_t_2 != __pyx_v_filtered.end(); ++__pyx_t_2) { + __pyx_t_3 = *__pyx_t_2; + __pyx_v_match = __pyx_t_3; + __pyx_t_4 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_doc), __pyx_v_match.start, __pyx_v_match.end, NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_v_spans = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":305 + * cdef object _prepare_special_spans(self, Doc doc, vector[SpanC] &filtered): + * spans = [doc[match.start:match.end] for match in filtered] + * cdef bint modify_in_place = True # <<<<<<<<<<<<<< + * cdef int curr_length = doc.length + * cdef int max_length = 0 +*/ + __pyx_v_modify_in_place = 1; + + /* "spacy/tokenizer.pyx":306 + * spans = [doc[match.start:match.end] for match in filtered] + * cdef bint modify_in_place = True + * cdef int curr_length = doc.length # <<<<<<<<<<<<<< + * cdef int max_length = 0 + * cdef int span_length_diff = 0 +*/ + __pyx_t_5 = __pyx_v_doc->length; + __pyx_v_curr_length = __pyx_t_5; + + /* "spacy/tokenizer.pyx":307 + * cdef bint modify_in_place = True + * cdef int curr_length = doc.length + * cdef int max_length = 0 # <<<<<<<<<<<<<< + * cdef int span_length_diff = 0 + * span_data = {} +*/ + __pyx_v_max_length = 0; + + /* "spacy/tokenizer.pyx":308 + * cdef int curr_length = doc.length + * cdef int max_length = 0 + * cdef int span_length_diff = 0 # <<<<<<<<<<<<<< + * span_data = {} + * for span in spans: +*/ + __pyx_v_span_length_diff = 0; + + /* "spacy/tokenizer.pyx":309 + * cdef int max_length = 0 + * cdef int span_length_diff = 0 + * span_data = {} # <<<<<<<<<<<<<< + * for span in spans: + * rule = self._rules.get(span.text, None) +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_span_data = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":310 + * cdef int span_length_diff = 0 + * span_data = {} + * for span in spans: # <<<<<<<<<<<<<< + * rule = self._rules.get(span.text, None) + * span_length_diff = 0 +*/ + __pyx_t_1 = __pyx_v_spans; __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 310, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_span, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":311 + * span_data = {} + * for span in spans: + * rule = self._rules.get(span.text, None) # <<<<<<<<<<<<<< + * span_length_diff = 0 + * if rule: +*/ + __pyx_t_7 = __pyx_v_self->_rules; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_8, Py_None}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_rule, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":312 + * for span in spans: + * rule = self._rules.get(span.text, None) + * span_length_diff = 0 # <<<<<<<<<<<<<< + * if rule: + * span_length_diff = len(rule) - (span.end - span.start) +*/ + __pyx_v_span_length_diff = 0; + + /* "spacy/tokenizer.pyx":313 + * rule = self._rules.get(span.text, None) + * span_length_diff = 0 + * if rule: # <<<<<<<<<<<<<< + * span_length_diff = len(rule) - (span.end - span.start) + * if span_length_diff > 0: +*/ + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_rule); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 313, __pyx_L1_error) + if (__pyx_t_10) { + + /* "spacy/tokenizer.pyx":314 + * span_length_diff = 0 + * if rule: + * span_length_diff = len(rule) - (span.end - span.start) # <<<<<<<<<<<<<< + * if span_length_diff > 0: + * modify_in_place = False +*/ + __pyx_t_11 = PyObject_Length(__pyx_v_rule); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 314, __pyx_L1_error) + __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_mstate_global->__pyx_n_u_end); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_12 = PyNumber_Subtract(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Subtract(__pyx_t_4, __pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_5 = __Pyx_PyLong_As_int(__pyx_t_7); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_span_length_diff = __pyx_t_5; + + /* "spacy/tokenizer.pyx":313 + * rule = self._rules.get(span.text, None) + * span_length_diff = 0 + * if rule: # <<<<<<<<<<<<<< + * span_length_diff = len(rule) - (span.end - span.start) + * if span_length_diff > 0: +*/ + } + + /* "spacy/tokenizer.pyx":315 + * if rule: + * span_length_diff = len(rule) - (span.end - span.start) + * if span_length_diff > 0: # <<<<<<<<<<<<<< + * modify_in_place = False + * curr_length += span_length_diff +*/ + __pyx_t_10 = (__pyx_v_span_length_diff > 0); + if (__pyx_t_10) { + + /* "spacy/tokenizer.pyx":316 + * span_length_diff = len(rule) - (span.end - span.start) + * if span_length_diff > 0: + * modify_in_place = False # <<<<<<<<<<<<<< + * curr_length += span_length_diff + * if curr_length > max_length: +*/ + __pyx_v_modify_in_place = 0; + + /* "spacy/tokenizer.pyx":315 + * if rule: + * span_length_diff = len(rule) - (span.end - span.start) + * if span_length_diff > 0: # <<<<<<<<<<<<<< + * modify_in_place = False + * curr_length += span_length_diff +*/ + } + + /* "spacy/tokenizer.pyx":317 + * if span_length_diff > 0: + * modify_in_place = False + * curr_length += span_length_diff # <<<<<<<<<<<<<< + * if curr_length > max_length: + * max_length = curr_length +*/ + __pyx_v_curr_length = (__pyx_v_curr_length + __pyx_v_span_length_diff); + + /* "spacy/tokenizer.pyx":318 + * modify_in_place = False + * curr_length += span_length_diff + * if curr_length > max_length: # <<<<<<<<<<<<<< + * max_length = curr_length + * span_data[span.start] = (span.text, span.start, span.end, span_length_diff) +*/ + __pyx_t_10 = (__pyx_v_curr_length > __pyx_v_max_length); + if (__pyx_t_10) { + + /* "spacy/tokenizer.pyx":319 + * curr_length += span_length_diff + * if curr_length > max_length: + * max_length = curr_length # <<<<<<<<<<<<<< + * span_data[span.start] = (span.text, span.start, span.end, span_length_diff) + * return (span_data, max_length, modify_in_place) +*/ + __pyx_v_max_length = __pyx_v_curr_length; + + /* "spacy/tokenizer.pyx":318 + * modify_in_place = False + * curr_length += span_length_diff + * if curr_length > max_length: # <<<<<<<<<<<<<< + * max_length = curr_length + * span_data[span.start] = (span.text, span.start, span.end, span_length_diff) +*/ + } + + /* "spacy/tokenizer.pyx":320 + * if curr_length > max_length: + * max_length = curr_length + * span_data[span.start] = (span.text, span.start, span.end, span_length_diff) # <<<<<<<<<<<<<< + * return (span_data, max_length, modify_in_place) + * +*/ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_mstate_global->__pyx_n_u_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_v_span_length_diff); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_13 = PyTuple_New(4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_7) != (0)) __PYX_ERR(0, 320, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12) != (0)) __PYX_ERR(0, 320, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_4) != (0)) __PYX_ERR(0, 320, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_8) != (0)) __PYX_ERR(0, 320, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_12 = 0; + __pyx_t_4 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (unlikely((PyDict_SetItem(__pyx_v_span_data, __pyx_t_8, __pyx_t_13) < 0))) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + + /* "spacy/tokenizer.pyx":310 + * cdef int span_length_diff = 0 + * span_data = {} + * for span in spans: # <<<<<<<<<<<<<< + * rule = self._rules.get(span.text, None) + * span_length_diff = 0 +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":321 + * max_length = curr_length + * span_data[span.start] = (span.text, span.start, span.end, span_length_diff) + * return (span_data, max_length, modify_in_place) # <<<<<<<<<<<<<< + * + * cdef int _retokenize_special_spans(self, Doc doc, TokenC* tokens, object span_data): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_max_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = __Pyx_PyBool_FromLong(__pyx_v_modify_in_place); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_span_data); + __Pyx_GIVEREF(__pyx_v_span_data); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_span_data) != (0)) __PYX_ERR(0, 321, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 321, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_13); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_13) != (0)) __PYX_ERR(0, 321, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_13 = 0; + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":303 + * stdsort(filtered.begin(), filtered.end(), start_cmp) + * + * cdef object _prepare_special_spans(self, Doc doc, vector[SpanC] &filtered): # <<<<<<<<<<<<<< + * spans = [doc[match.start:match.end] for match in filtered] + * cdef bint modify_in_place = True +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._prepare_special_spans", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_spans); + __Pyx_XDECREF(__pyx_v_span_data); + __Pyx_XDECREF(__pyx_v_span); + __Pyx_XDECREF(__pyx_v_rule); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":323 + * return (span_data, max_length, modify_in_place) + * + * cdef int _retokenize_special_spans(self, Doc doc, TokenC* tokens, object span_data): # <<<<<<<<<<<<<< + * cdef int i = 0 + * cdef int j = 0 +*/ + +static int __pyx_f_5spacy_9tokenizer_9Tokenizer__retokenize_special_spans(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc, struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_tokens, PyObject *__pyx_v_span_data) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_offset; + struct __pyx_t_5spacy_5vocab__Cached *__pyx_v_cached; + int __pyx_v_idx_offset; + int __pyx_v_orig_final_spacy; + int __pyx_v_orig_idx; + int __pyx_v_span_start; + int __pyx_v_span_end; + PyObject *__pyx_v_span = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_retokenize_special_spans", 0); + + /* "spacy/tokenizer.pyx":324 + * + * cdef int _retokenize_special_spans(self, Doc doc, TokenC* tokens, object span_data): + * cdef int i = 0 # <<<<<<<<<<<<<< + * cdef int j = 0 + * cdef int offset = 0 +*/ + __pyx_v_i = 0; + + /* "spacy/tokenizer.pyx":325 + * cdef int _retokenize_special_spans(self, Doc doc, TokenC* tokens, object span_data): + * cdef int i = 0 + * cdef int j = 0 # <<<<<<<<<<<<<< + * cdef int offset = 0 + * cdef _Cached* cached +*/ + __pyx_v_j = 0; + + /* "spacy/tokenizer.pyx":326 + * cdef int i = 0 + * cdef int j = 0 + * cdef int offset = 0 # <<<<<<<<<<<<<< + * cdef _Cached* cached + * cdef int idx_offset = 0 +*/ + __pyx_v_offset = 0; + + /* "spacy/tokenizer.pyx":328 + * cdef int offset = 0 + * cdef _Cached* cached + * cdef int idx_offset = 0 # <<<<<<<<<<<<<< + * cdef int orig_final_spacy + * cdef int orig_idx +*/ + __pyx_v_idx_offset = 0; + + /* "spacy/tokenizer.pyx":333 + * cdef int span_start + * cdef int span_end + * while i < doc.length: # <<<<<<<<<<<<<< + * if i not in span_data: + * tokens[i + offset] = doc.c[i] +*/ + while (1) { + __pyx_t_1 = (__pyx_v_i < __pyx_v_doc->length); + if (!__pyx_t_1) break; + + /* "spacy/tokenizer.pyx":334 + * cdef int span_end + * while i < doc.length: + * if i not in span_data: # <<<<<<<<<<<<<< + * tokens[i + offset] = doc.c[i] + * i += 1 +*/ + __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_v_span_data, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":335 + * while i < doc.length: + * if i not in span_data: + * tokens[i + offset] = doc.c[i] # <<<<<<<<<<<<<< + * i += 1 + * else: +*/ + (__pyx_v_tokens[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_doc->c[__pyx_v_i]); + + /* "spacy/tokenizer.pyx":336 + * if i not in span_data: + * tokens[i + offset] = doc.c[i] + * i += 1 # <<<<<<<<<<<<<< + * else: + * span = span_data[i] +*/ + __pyx_v_i = (__pyx_v_i + 1); + + /* "spacy/tokenizer.pyx":334 + * cdef int span_end + * while i < doc.length: + * if i not in span_data: # <<<<<<<<<<<<<< + * tokens[i + offset] = doc.c[i] + * i += 1 +*/ + goto __pyx_L5; + } + + /* "spacy/tokenizer.pyx":338 + * i += 1 + * else: + * span = span_data[i] # <<<<<<<<<<<<<< + * span_start = span[1] + * span_end = span[2] +*/ + /*else*/ { + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_span_data, __pyx_v_i, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_span, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":339 + * else: + * span = span_data[i] + * span_start = span[1] # <<<<<<<<<<<<<< + * span_end = span[2] + * cached = <_Cached*>self._specials.get(hash_string(span[0])) +*/ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_span, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_span_start = __pyx_t_3; + + /* "spacy/tokenizer.pyx":340 + * span = span_data[i] + * span_start = span[1] + * span_end = span[2] # <<<<<<<<<<<<<< + * cached = <_Cached*>self._specials.get(hash_string(span[0])) + * if cached == NULL: +*/ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_span, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_span_end = __pyx_t_3; + + /* "spacy/tokenizer.pyx":341 + * span_start = span[1] + * span_end = span[2] + * cached = <_Cached*>self._specials.get(hash_string(span[0])) # <<<<<<<<<<<<<< + * if cached == NULL: + * # Copy original tokens if no rule found +*/ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_span, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_2))) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_t_4 = __pyx_f_5spacy_7strings_hash_string(((PyObject*)__pyx_t_2), 0); if (unlikely(__pyx_t_4 == ((__pyx_t_5spacy_8typedefs_hash_t)0))) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_specials->__pyx_vtab)->get(__pyx_v_self->_specials, __pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_v_cached = ((struct __pyx_t_5spacy_5vocab__Cached *)__pyx_t_5); + + /* "spacy/tokenizer.pyx":342 + * span_end = span[2] + * cached = <_Cached*>self._specials.get(hash_string(span[0])) + * if cached == NULL: # <<<<<<<<<<<<<< + * # Copy original tokens if no rule found + * for j in range(span_end - span_start): +*/ + __pyx_t_1 = (__pyx_v_cached == NULL); + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":344 + * if cached == NULL: + * # Copy original tokens if no rule found + * for j in range(span_end - span_start): # <<<<<<<<<<<<<< + * tokens[i + offset + j] = doc.c[i + j] + * i += span_end - span_start +*/ + __pyx_t_3 = (__pyx_v_span_end - __pyx_v_span_start); + __pyx_t_6 = __pyx_t_3; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_j = __pyx_t_7; + + /* "spacy/tokenizer.pyx":345 + * # Copy original tokens if no rule found + * for j in range(span_end - span_start): + * tokens[i + offset + j] = doc.c[i + j] # <<<<<<<<<<<<<< + * i += span_end - span_start + * else: +*/ + (__pyx_v_tokens[((__pyx_v_i + __pyx_v_offset) + __pyx_v_j)]) = (__pyx_v_doc->c[(__pyx_v_i + __pyx_v_j)]); + } + + /* "spacy/tokenizer.pyx":346 + * for j in range(span_end - span_start): + * tokens[i + offset + j] = doc.c[i + j] + * i += span_end - span_start # <<<<<<<<<<<<<< + * else: + * # Copy special case tokens into doc and adjust token and +*/ + __pyx_v_i = (__pyx_v_i + (__pyx_v_span_end - __pyx_v_span_start)); + + /* "spacy/tokenizer.pyx":342 + * span_end = span[2] + * cached = <_Cached*>self._specials.get(hash_string(span[0])) + * if cached == NULL: # <<<<<<<<<<<<<< + * # Copy original tokens if no rule found + * for j in range(span_end - span_start): +*/ + goto __pyx_L6; + } + + /* "spacy/tokenizer.pyx":350 + * # Copy special case tokens into doc and adjust token and + * # character offsets + * idx_offset = 0 # <<<<<<<<<<<<<< + * orig_final_spacy = doc.c[span_end - 1].spacy + * orig_idx = doc.c[i].idx +*/ + /*else*/ { + __pyx_v_idx_offset = 0; + + /* "spacy/tokenizer.pyx":351 + * # character offsets + * idx_offset = 0 + * orig_final_spacy = doc.c[span_end - 1].spacy # <<<<<<<<<<<<<< + * orig_idx = doc.c[i].idx + * for j in range(cached.length): +*/ + __pyx_t_1 = (__pyx_v_doc->c[(__pyx_v_span_end - 1)]).spacy; + __pyx_v_orig_final_spacy = __pyx_t_1; + + /* "spacy/tokenizer.pyx":352 + * idx_offset = 0 + * orig_final_spacy = doc.c[span_end - 1].spacy + * orig_idx = doc.c[i].idx # <<<<<<<<<<<<<< + * for j in range(cached.length): + * tokens[i + offset + j] = cached.data.tokens[j] +*/ + __pyx_t_3 = (__pyx_v_doc->c[__pyx_v_i]).idx; + __pyx_v_orig_idx = __pyx_t_3; + + /* "spacy/tokenizer.pyx":353 + * orig_final_spacy = doc.c[span_end - 1].spacy + * orig_idx = doc.c[i].idx + * for j in range(cached.length): # <<<<<<<<<<<<<< + * tokens[i + offset + j] = cached.data.tokens[j] + * tokens[i + offset + j].idx = orig_idx + idx_offset +*/ + __pyx_t_3 = __pyx_v_cached->length; + __pyx_t_6 = __pyx_t_3; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_j = __pyx_t_7; + + /* "spacy/tokenizer.pyx":354 + * orig_idx = doc.c[i].idx + * for j in range(cached.length): + * tokens[i + offset + j] = cached.data.tokens[j] # <<<<<<<<<<<<<< + * tokens[i + offset + j].idx = orig_idx + idx_offset + * idx_offset += cached.data.tokens[j].lex.length +*/ + (__pyx_v_tokens[((__pyx_v_i + __pyx_v_offset) + __pyx_v_j)]) = (__pyx_v_cached->data.tokens[__pyx_v_j]); + + /* "spacy/tokenizer.pyx":355 + * for j in range(cached.length): + * tokens[i + offset + j] = cached.data.tokens[j] + * tokens[i + offset + j].idx = orig_idx + idx_offset # <<<<<<<<<<<<<< + * idx_offset += cached.data.tokens[j].lex.length + * if cached.data.tokens[j].spacy: +*/ + (__pyx_v_tokens[((__pyx_v_i + __pyx_v_offset) + __pyx_v_j)]).idx = (__pyx_v_orig_idx + __pyx_v_idx_offset); + + /* "spacy/tokenizer.pyx":356 + * tokens[i + offset + j] = cached.data.tokens[j] + * tokens[i + offset + j].idx = orig_idx + idx_offset + * idx_offset += cached.data.tokens[j].lex.length # <<<<<<<<<<<<<< + * if cached.data.tokens[j].spacy: + * idx_offset += 1 +*/ + __pyx_v_idx_offset = (__pyx_v_idx_offset + (__pyx_v_cached->data.tokens[__pyx_v_j]).lex->length); + + /* "spacy/tokenizer.pyx":357 + * tokens[i + offset + j].idx = orig_idx + idx_offset + * idx_offset += cached.data.tokens[j].lex.length + * if cached.data.tokens[j].spacy: # <<<<<<<<<<<<<< + * idx_offset += 1 + * tokens[i + offset + cached.length - 1].spacy = orig_final_spacy +*/ + __pyx_t_1 = ((__pyx_v_cached->data.tokens[__pyx_v_j]).spacy != 0); + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":358 + * idx_offset += cached.data.tokens[j].lex.length + * if cached.data.tokens[j].spacy: + * idx_offset += 1 # <<<<<<<<<<<<<< + * tokens[i + offset + cached.length - 1].spacy = orig_final_spacy + * i += span_end - span_start +*/ + __pyx_v_idx_offset = (__pyx_v_idx_offset + 1); + + /* "spacy/tokenizer.pyx":357 + * tokens[i + offset + j].idx = orig_idx + idx_offset + * idx_offset += cached.data.tokens[j].lex.length + * if cached.data.tokens[j].spacy: # <<<<<<<<<<<<<< + * idx_offset += 1 + * tokens[i + offset + cached.length - 1].spacy = orig_final_spacy +*/ + } + } + + /* "spacy/tokenizer.pyx":359 + * if cached.data.tokens[j].spacy: + * idx_offset += 1 + * tokens[i + offset + cached.length - 1].spacy = orig_final_spacy # <<<<<<<<<<<<<< + * i += span_end - span_start + * offset += span[3] +*/ + (__pyx_v_tokens[(((__pyx_v_i + __pyx_v_offset) + __pyx_v_cached->length) - 1)]).spacy = __pyx_v_orig_final_spacy; + + /* "spacy/tokenizer.pyx":360 + * idx_offset += 1 + * tokens[i + offset + cached.length - 1].spacy = orig_final_spacy + * i += span_end - span_start # <<<<<<<<<<<<<< + * offset += span[3] + * return offset +*/ + __pyx_v_i = (__pyx_v_i + (__pyx_v_span_end - __pyx_v_span_start)); + + /* "spacy/tokenizer.pyx":361 + * tokens[i + offset + cached.length - 1].spacy = orig_final_spacy + * i += span_end - span_start + * offset += span[3] # <<<<<<<<<<<<<< + * return offset + * +*/ + __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_span, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_9); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_offset = __pyx_t_3; + } + __pyx_L6:; + } + __pyx_L5:; + } + + /* "spacy/tokenizer.pyx":362 + * i += span_end - span_start + * offset += span[3] + * return offset # <<<<<<<<<<<<<< + * + * cdef int _try_specials_and_cache(self, hash_t key, Doc tokens, int* has_special, bint with_special_cases) except -1: +*/ + __pyx_r = __pyx_v_offset; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":323 + * return (span_data, max_length, modify_in_place) + * + * cdef int _retokenize_special_spans(self, Doc doc, TokenC* tokens, object span_data): # <<<<<<<<<<<<<< + * cdef int i = 0 + * cdef int j = 0 +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._retokenize_special_spans", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_span); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":364 + * return offset + * + * cdef int _try_specials_and_cache(self, hash_t key, Doc tokens, int* has_special, bint with_special_cases) except -1: # <<<<<<<<<<<<<< + * cdef bint specials_hit = 0 + * cdef bint cache_hit = 0 +*/ + +static int __pyx_f_5spacy_9tokenizer_9Tokenizer__try_specials_and_cache(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_tokens, int *__pyx_v_has_special, int __pyx_v_with_special_cases) { + int __pyx_v_specials_hit; + int __pyx_v_cache_hit; + int __pyx_v_i; + struct __pyx_t_5spacy_5vocab__Cached *__pyx_v_cached; + int __pyx_r; + void *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "spacy/tokenizer.pyx":365 + * + * cdef int _try_specials_and_cache(self, hash_t key, Doc tokens, int* has_special, bint with_special_cases) except -1: + * cdef bint specials_hit = 0 # <<<<<<<<<<<<<< + * cdef bint cache_hit = 0 + * cdef int i +*/ + __pyx_v_specials_hit = 0; + + /* "spacy/tokenizer.pyx":366 + * cdef int _try_specials_and_cache(self, hash_t key, Doc tokens, int* has_special, bint with_special_cases) except -1: + * cdef bint specials_hit = 0 + * cdef bint cache_hit = 0 # <<<<<<<<<<<<<< + * cdef int i + * if with_special_cases: +*/ + __pyx_v_cache_hit = 0; + + /* "spacy/tokenizer.pyx":368 + * cdef bint cache_hit = 0 + * cdef int i + * if with_special_cases: # <<<<<<<<<<<<<< + * cached = <_Cached*>self._specials.get(key) + * if cached == NULL: +*/ + if (__pyx_v_with_special_cases) { + + /* "spacy/tokenizer.pyx":369 + * cdef int i + * if with_special_cases: + * cached = <_Cached*>self._specials.get(key) # <<<<<<<<<<<<<< + * if cached == NULL: + * specials_hit = False +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_specials->__pyx_vtab)->get(__pyx_v_self->_specials, __pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L1_error) + __pyx_v_cached = ((struct __pyx_t_5spacy_5vocab__Cached *)__pyx_t_1); + + /* "spacy/tokenizer.pyx":370 + * if with_special_cases: + * cached = <_Cached*>self._specials.get(key) + * if cached == NULL: # <<<<<<<<<<<<<< + * specials_hit = False + * else: +*/ + __pyx_t_2 = (__pyx_v_cached == NULL); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":371 + * cached = <_Cached*>self._specials.get(key) + * if cached == NULL: + * specials_hit = False # <<<<<<<<<<<<<< + * else: + * for i in range(cached.length): +*/ + __pyx_v_specials_hit = 0; + + /* "spacy/tokenizer.pyx":370 + * if with_special_cases: + * cached = <_Cached*>self._specials.get(key) + * if cached == NULL: # <<<<<<<<<<<<<< + * specials_hit = False + * else: +*/ + goto __pyx_L4; + } + + /* "spacy/tokenizer.pyx":373 + * specials_hit = False + * else: + * for i in range(cached.length): # <<<<<<<<<<<<<< + * tokens.push_back(&cached.data.tokens[i], False) + * has_special[0] = 1 +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_cached->length; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "spacy/tokenizer.pyx":374 + * else: + * for i in range(cached.length): + * tokens.push_back(&cached.data.tokens[i], False) # <<<<<<<<<<<<<< + * has_special[0] = 1 + * specials_hit = True +*/ + __pyx_t_6 = ((struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *)__pyx_v_tokens->__pyx_vtab)->__pyx_fuse_1push_back(__pyx_v_tokens, (&(__pyx_v_cached->data.tokens[__pyx_v_i])), 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 374, __pyx_L1_error) + } + + /* "spacy/tokenizer.pyx":375 + * for i in range(cached.length): + * tokens.push_back(&cached.data.tokens[i], False) + * has_special[0] = 1 # <<<<<<<<<<<<<< + * specials_hit = True + * if not specials_hit: +*/ + (__pyx_v_has_special[0]) = 1; + + /* "spacy/tokenizer.pyx":376 + * tokens.push_back(&cached.data.tokens[i], False) + * has_special[0] = 1 + * specials_hit = True # <<<<<<<<<<<<<< + * if not specials_hit: + * cached = <_Cached*>self._cache.get(key) +*/ + __pyx_v_specials_hit = 1; + } + __pyx_L4:; + + /* "spacy/tokenizer.pyx":368 + * cdef bint cache_hit = 0 + * cdef int i + * if with_special_cases: # <<<<<<<<<<<<<< + * cached = <_Cached*>self._specials.get(key) + * if cached == NULL: +*/ + } + + /* "spacy/tokenizer.pyx":377 + * has_special[0] = 1 + * specials_hit = True + * if not specials_hit: # <<<<<<<<<<<<<< + * cached = <_Cached*>self._cache.get(key) + * if cached == NULL: +*/ + __pyx_t_2 = (!__pyx_v_specials_hit); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":378 + * specials_hit = True + * if not specials_hit: + * cached = <_Cached*>self._cache.get(key) # <<<<<<<<<<<<<< + * if cached == NULL: + * cache_hit = False +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_cache->__pyx_vtab)->get(__pyx_v_self->_cache, __pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_v_cached = ((struct __pyx_t_5spacy_5vocab__Cached *)__pyx_t_1); + + /* "spacy/tokenizer.pyx":379 + * if not specials_hit: + * cached = <_Cached*>self._cache.get(key) + * if cached == NULL: # <<<<<<<<<<<<<< + * cache_hit = False + * else: +*/ + __pyx_t_2 = (__pyx_v_cached == NULL); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":380 + * cached = <_Cached*>self._cache.get(key) + * if cached == NULL: + * cache_hit = False # <<<<<<<<<<<<<< + * else: + * if cached.is_lex: +*/ + __pyx_v_cache_hit = 0; + + /* "spacy/tokenizer.pyx":379 + * if not specials_hit: + * cached = <_Cached*>self._cache.get(key) + * if cached == NULL: # <<<<<<<<<<<<<< + * cache_hit = False + * else: +*/ + goto __pyx_L8; + } + + /* "spacy/tokenizer.pyx":382 + * cache_hit = False + * else: + * if cached.is_lex: # <<<<<<<<<<<<<< + * for i in range(cached.length): + * tokens.push_back(cached.data.lexemes[i], False) +*/ + /*else*/ { + if (__pyx_v_cached->is_lex) { + + /* "spacy/tokenizer.pyx":383 + * else: + * if cached.is_lex: + * for i in range(cached.length): # <<<<<<<<<<<<<< + * tokens.push_back(cached.data.lexemes[i], False) + * else: +*/ + __pyx_t_3 = __pyx_v_cached->length; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "spacy/tokenizer.pyx":384 + * if cached.is_lex: + * for i in range(cached.length): + * tokens.push_back(cached.data.lexemes[i], False) # <<<<<<<<<<<<<< + * else: + * for i in range(cached.length): +*/ + __pyx_t_6 = ((struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *)__pyx_v_tokens->__pyx_vtab)->__pyx_fuse_0push_back(__pyx_v_tokens, (__pyx_v_cached->data.lexemes[__pyx_v_i]), 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 384, __pyx_L1_error) + } + + /* "spacy/tokenizer.pyx":382 + * cache_hit = False + * else: + * if cached.is_lex: # <<<<<<<<<<<<<< + * for i in range(cached.length): + * tokens.push_back(cached.data.lexemes[i], False) +*/ + goto __pyx_L9; + } + + /* "spacy/tokenizer.pyx":386 + * tokens.push_back(cached.data.lexemes[i], False) + * else: + * for i in range(cached.length): # <<<<<<<<<<<<<< + * tokens.push_back(&cached.data.tokens[i], False) + * cache_hit = True +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_cached->length; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "spacy/tokenizer.pyx":387 + * else: + * for i in range(cached.length): + * tokens.push_back(&cached.data.tokens[i], False) # <<<<<<<<<<<<<< + * cache_hit = True + * if not specials_hit and not cache_hit: +*/ + __pyx_t_6 = ((struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *)__pyx_v_tokens->__pyx_vtab)->__pyx_fuse_1push_back(__pyx_v_tokens, (&(__pyx_v_cached->data.tokens[__pyx_v_i])), 0); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 387, __pyx_L1_error) + } + } + __pyx_L9:; + + /* "spacy/tokenizer.pyx":388 + * for i in range(cached.length): + * tokens.push_back(&cached.data.tokens[i], False) + * cache_hit = True # <<<<<<<<<<<<<< + * if not specials_hit and not cache_hit: + * return False +*/ + __pyx_v_cache_hit = 1; + } + __pyx_L8:; + + /* "spacy/tokenizer.pyx":377 + * has_special[0] = 1 + * specials_hit = True + * if not specials_hit: # <<<<<<<<<<<<<< + * cached = <_Cached*>self._cache.get(key) + * if cached == NULL: +*/ + } + + /* "spacy/tokenizer.pyx":389 + * tokens.push_back(&cached.data.tokens[i], False) + * cache_hit = True + * if not specials_hit and not cache_hit: # <<<<<<<<<<<<<< + * return False + * return True +*/ + __pyx_t_7 = (!__pyx_v_specials_hit); + if (__pyx_t_7) { + } else { + __pyx_t_2 = __pyx_t_7; + goto __pyx_L15_bool_binop_done; + } + __pyx_t_7 = (!__pyx_v_cache_hit); + __pyx_t_2 = __pyx_t_7; + __pyx_L15_bool_binop_done:; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":390 + * cache_hit = True + * if not specials_hit and not cache_hit: + * return False # <<<<<<<<<<<<<< + * return True + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":389 + * tokens.push_back(&cached.data.tokens[i], False) + * cache_hit = True + * if not specials_hit and not cache_hit: # <<<<<<<<<<<<<< + * return False + * return True +*/ + } + + /* "spacy/tokenizer.pyx":391 + * if not specials_hit and not cache_hit: + * return False + * return True # <<<<<<<<<<<<<< + * + * cdef int _tokenize(self, Doc tokens, str span, hash_t orig_key, int* has_special, bint with_special_cases) except -1: +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":364 + * return offset + * + * cdef int _try_specials_and_cache(self, hash_t key, Doc tokens, int* has_special, bint with_special_cases) except -1: # <<<<<<<<<<<<<< + * cdef bint specials_hit = 0 + * cdef bint cache_hit = 0 +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._try_specials_and_cache", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":393 + * return True + * + * cdef int _tokenize(self, Doc tokens, str span, hash_t orig_key, int* has_special, bint with_special_cases) except -1: # <<<<<<<<<<<<<< + * cdef vector[LexemeC*] prefixes + * cdef vector[LexemeC*] suffixes +*/ + +static int __pyx_f_5spacy_9tokenizer_9Tokenizer__tokenize(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_tokens, PyObject *__pyx_v_span, __pyx_t_5spacy_8typedefs_hash_t __pyx_v_orig_key, int *__pyx_v_has_special, int __pyx_v_with_special_cases) { + std::vector __pyx_v_prefixes; + std::vector __pyx_v_suffixes; + int __pyx_v_orig_size; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_tokenize", 0); + __Pyx_INCREF(__pyx_v_span); + + /* "spacy/tokenizer.pyx":397 + * cdef vector[LexemeC*] suffixes + * cdef int orig_size + * orig_size = tokens.length # <<<<<<<<<<<<<< + * span = self._split_affixes(tokens.mem, span, &prefixes, &suffixes, + * has_special, with_special_cases) +*/ + __pyx_t_1 = __pyx_v_tokens->length; + __pyx_v_orig_size = __pyx_t_1; + + /* "spacy/tokenizer.pyx":398 + * cdef int orig_size + * orig_size = tokens.length + * span = self._split_affixes(tokens.mem, span, &prefixes, &suffixes, # <<<<<<<<<<<<<< + * has_special, with_special_cases) + * self._attach_tokens(tokens, span, &prefixes, &suffixes, has_special, +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_tokens->mem); + __Pyx_INCREF(__pyx_t_2); + + /* "spacy/tokenizer.pyx":399 + * orig_size = tokens.length + * span = self._split_affixes(tokens.mem, span, &prefixes, &suffixes, + * has_special, with_special_cases) # <<<<<<<<<<<<<< + * self._attach_tokens(tokens, span, &prefixes, &suffixes, has_special, + * with_special_cases) +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_split_affixes(__pyx_v_self, ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_2), __pyx_v_span, (&__pyx_v_prefixes), (&__pyx_v_suffixes), __pyx_v_has_special, __pyx_v_with_special_cases); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_span, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":400 + * span = self._split_affixes(tokens.mem, span, &prefixes, &suffixes, + * has_special, with_special_cases) + * self._attach_tokens(tokens, span, &prefixes, &suffixes, has_special, # <<<<<<<<<<<<<< + * with_special_cases) + * if len(self._cache) < self.max_cache_size: +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_attach_tokens(__pyx_v_self, __pyx_v_tokens, __pyx_v_span, (&__pyx_v_prefixes), (&__pyx_v_suffixes), __pyx_v_has_special, __pyx_v_with_special_cases); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 400, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":402 + * self._attach_tokens(tokens, span, &prefixes, &suffixes, has_special, + * with_special_cases) + * if len(self._cache) < self.max_cache_size: # <<<<<<<<<<<<<< + * self._save_cached(&tokens.c[orig_size], orig_key, has_special, + * tokens.length - orig_size) +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self->_cache); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = (__pyx_t_4 < __pyx_v_self->max_cache_size); + if (__pyx_t_5) { + + /* "spacy/tokenizer.pyx":403 + * with_special_cases) + * if len(self._cache) < self.max_cache_size: + * self._save_cached(&tokens.c[orig_size], orig_key, has_special, # <<<<<<<<<<<<<< + * tokens.length - orig_size) + * +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_save_cached(__pyx_v_self, (&(__pyx_v_tokens->c[__pyx_v_orig_size])), __pyx_v_orig_key, __pyx_v_has_special, (__pyx_v_tokens->length - __pyx_v_orig_size)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 403, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":402 + * self._attach_tokens(tokens, span, &prefixes, &suffixes, has_special, + * with_special_cases) + * if len(self._cache) < self.max_cache_size: # <<<<<<<<<<<<<< + * self._save_cached(&tokens.c[orig_size], orig_key, has_special, + * tokens.length - orig_size) +*/ + } + + /* "spacy/tokenizer.pyx":393 + * return True + * + * cdef int _tokenize(self, Doc tokens, str span, hash_t orig_key, int* has_special, bint with_special_cases) except -1: # <<<<<<<<<<<<<< + * cdef vector[LexemeC*] prefixes + * cdef vector[LexemeC*] suffixes +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._tokenize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_span); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":406 + * tokens.length - orig_size) + * + * cdef str _split_affixes( # <<<<<<<<<<<<<< + * self, + * Pool mem, +*/ + +static PyObject *__pyx_f_5spacy_9tokenizer_9Tokenizer__split_affixes(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, PyObject *__pyx_v_string, std::vector *__pyx_v_prefixes, std::vector *__pyx_v_suffixes, CYTHON_UNUSED int *__pyx_v_has_special, int __pyx_v_with_special_cases) { + PyObject *__pyx_v_prefix = 0; + PyObject *__pyx_v_suffix = 0; + PyObject *__pyx_v_minus_pre = 0; + PyObject *__pyx_v_minus_suf = 0; + size_t __pyx_v_last_size; + PyObject *__pyx_v_pre_len = NULL; + PyObject *__pyx_v_suf_len = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_7; + void *__pyx_t_8; + Py_ssize_t __pyx_t_9; + struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_10; + PyObject *__pyx_t_11 = NULL; + Py_ssize_t __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_split_affixes", 0); + __Pyx_INCREF(__pyx_v_string); + + /* "spacy/tokenizer.pyx":419 + * cdef str minus_pre + * cdef str minus_suf + * cdef size_t last_size = 0 # <<<<<<<<<<<<<< + * while string and len(string) != last_size: + * if self.token_match and self.token_match(string): +*/ + __pyx_v_last_size = 0; + + /* "spacy/tokenizer.pyx":420 + * cdef str minus_suf + * cdef size_t last_size = 0 + * while string and len(string) != last_size: # <<<<<<<<<<<<<< + * if self.token_match and self.token_match(string): + * break +*/ + while (1) { + if (__pyx_v_string == Py_None) __pyx_t_2 = 0; + else + { + Py_ssize_t __pyx_temp = __Pyx_PyUnicode_IS_TRUE(__pyx_v_string); + if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 420, __pyx_L1_error) + __pyx_t_2 = (__pyx_temp != 0); + } + + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 420, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_string); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 420, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_3 != __pyx_v_last_size); + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + if (!__pyx_t_1) break; + + /* "spacy/tokenizer.pyx":421 + * cdef size_t last_size = 0 + * while string and len(string) != last_size: + * if self.token_match and self.token_match(string): # <<<<<<<<<<<<<< + * break + * if with_special_cases and self._specials.get(hash_string(string)) != NULL: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_token_match); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 421, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 421, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_5 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_string}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_token_match, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 421, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 421, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __pyx_t_2; + __pyx_L8_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":422 + * while string and len(string) != last_size: + * if self.token_match and self.token_match(string): + * break # <<<<<<<<<<<<<< + * if with_special_cases and self._specials.get(hash_string(string)) != NULL: + * break +*/ + goto __pyx_L4_break; + + /* "spacy/tokenizer.pyx":421 + * cdef size_t last_size = 0 + * while string and len(string) != last_size: + * if self.token_match and self.token_match(string): # <<<<<<<<<<<<<< + * break + * if with_special_cases and self._specials.get(hash_string(string)) != NULL: +*/ + } + + /* "spacy/tokenizer.pyx":423 + * if self.token_match and self.token_match(string): + * break + * if with_special_cases and self._specials.get(hash_string(string)) != NULL: # <<<<<<<<<<<<<< + * break + * last_size = len(string) +*/ + if (__pyx_v_with_special_cases) { + } else { + __pyx_t_1 = __pyx_v_with_special_cases; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_7 = __pyx_f_5spacy_7strings_hash_string(__pyx_v_string, 0); if (unlikely(__pyx_t_7 == ((__pyx_t_5spacy_8typedefs_hash_t)0))) __PYX_ERR(0, 423, __pyx_L1_error) + __pyx_t_8 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_specials->__pyx_vtab)->get(__pyx_v_self->_specials, __pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 423, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_8 != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L11_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":424 + * break + * if with_special_cases and self._specials.get(hash_string(string)) != NULL: + * break # <<<<<<<<<<<<<< + * last_size = len(string) + * pre_len = self.find_prefix(string) +*/ + goto __pyx_L4_break; + + /* "spacy/tokenizer.pyx":423 + * if self.token_match and self.token_match(string): + * break + * if with_special_cases and self._specials.get(hash_string(string)) != NULL: # <<<<<<<<<<<<<< + * break + * last_size = len(string) +*/ + } + + /* "spacy/tokenizer.pyx":425 + * if with_special_cases and self._specials.get(hash_string(string)) != NULL: + * break + * last_size = len(string) # <<<<<<<<<<<<<< + * pre_len = self.find_prefix(string) + * if pre_len != 0: +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 425, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_string); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 425, __pyx_L1_error) + __pyx_v_last_size = __pyx_t_3; + + /* "spacy/tokenizer.pyx":426 + * break + * last_size = len(string) + * pre_len = self.find_prefix(string) # <<<<<<<<<<<<<< + * if pre_len != 0: + * prefix = string[:pre_len] +*/ + __pyx_t_5 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_string}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_find_prefix, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_pre_len, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":427 + * last_size = len(string) + * pre_len = self.find_prefix(string) + * if pre_len != 0: # <<<<<<<<<<<<<< + * prefix = string[:pre_len] + * minus_pre = string[pre_len:] +*/ + __pyx_t_1 = (__Pyx_PyLong_BoolNeObjC(__pyx_v_pre_len, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 427, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":428 + * pre_len = self.find_prefix(string) + * if pre_len != 0: + * prefix = string[:pre_len] # <<<<<<<<<<<<<< + * minus_pre = string[pre_len:] + * if minus_pre and with_special_cases and self._specials.get(hash_string(minus_pre)) != NULL: +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 428, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_pre_len); + __pyx_t_4 = __pyx_v_pre_len; + __pyx_t_1 = (__pyx_t_4 == Py_None); + if (__pyx_t_1) { + __pyx_t_3 = PY_SSIZE_T_MAX; + } else { + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_3 = __pyx_t_9; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyUnicode_Substring(__pyx_v_string, 0, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_prefix, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":429 + * if pre_len != 0: + * prefix = string[:pre_len] + * minus_pre = string[pre_len:] # <<<<<<<<<<<<<< + * if minus_pre and with_special_cases and self._specials.get(hash_string(minus_pre)) != NULL: + * string = minus_pre +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 429, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_pre_len); + __pyx_t_4 = __pyx_v_pre_len; + __pyx_t_1 = (__pyx_t_4 == Py_None); + if (__pyx_t_1) { + __pyx_t_3 = 0; + } else { + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_3 = __pyx_t_9; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyUnicode_Substring(__pyx_v_string, __pyx_t_3, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_minus_pre, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":430 + * prefix = string[:pre_len] + * minus_pre = string[pre_len:] + * if minus_pre and with_special_cases and self._specials.get(hash_string(minus_pre)) != NULL: # <<<<<<<<<<<<<< + * string = minus_pre + * prefixes.push_back(self.vocab.get(mem, prefix)) +*/ + { + Py_ssize_t __pyx_temp = __Pyx_PyUnicode_IS_TRUE(__pyx_v_minus_pre); + if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 430, __pyx_L1_error) + __pyx_t_2 = (__pyx_temp != 0); + } + + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L15_bool_binop_done; + } + if (__pyx_v_with_special_cases) { + } else { + __pyx_t_1 = __pyx_v_with_special_cases; + goto __pyx_L15_bool_binop_done; + } + __pyx_t_7 = __pyx_f_5spacy_7strings_hash_string(__pyx_v_minus_pre, 0); if (unlikely(__pyx_t_7 == ((__pyx_t_5spacy_8typedefs_hash_t)0))) __PYX_ERR(0, 430, __pyx_L1_error) + __pyx_t_8 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_specials->__pyx_vtab)->get(__pyx_v_self->_specials, __pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 430, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_8 != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L15_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":431 + * minus_pre = string[pre_len:] + * if minus_pre and with_special_cases and self._specials.get(hash_string(minus_pre)) != NULL: + * string = minus_pre # <<<<<<<<<<<<<< + * prefixes.push_back(self.vocab.get(mem, prefix)) + * break +*/ + __Pyx_INCREF(__pyx_v_minus_pre); + __Pyx_DECREF_SET(__pyx_v_string, __pyx_v_minus_pre); + + /* "spacy/tokenizer.pyx":432 + * if minus_pre and with_special_cases and self._specials.get(hash_string(minus_pre)) != NULL: + * string = minus_pre + * prefixes.push_back(self.vocab.get(mem, prefix)) # <<<<<<<<<<<<<< + * break + * suf_len = self.find_suffix(string[pre_len:]) +*/ + __pyx_t_10 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->vocab->__pyx_vtab)->get(__pyx_v_self->vocab, __pyx_v_mem, __pyx_v_prefix); if (unlikely(__pyx_t_10 == ((void *)NULL))) __PYX_ERR(0, 432, __pyx_L1_error) + try { + __pyx_v_prefixes->push_back(__pyx_t_10); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 432, __pyx_L1_error) + } + + /* "spacy/tokenizer.pyx":433 + * string = minus_pre + * prefixes.push_back(self.vocab.get(mem, prefix)) + * break # <<<<<<<<<<<<<< + * suf_len = self.find_suffix(string[pre_len:]) + * if suf_len != 0: +*/ + goto __pyx_L4_break; + + /* "spacy/tokenizer.pyx":430 + * prefix = string[:pre_len] + * minus_pre = string[pre_len:] + * if minus_pre and with_special_cases and self._specials.get(hash_string(minus_pre)) != NULL: # <<<<<<<<<<<<<< + * string = minus_pre + * prefixes.push_back(self.vocab.get(mem, prefix)) +*/ + } + + /* "spacy/tokenizer.pyx":427 + * last_size = len(string) + * pre_len = self.find_prefix(string) + * if pre_len != 0: # <<<<<<<<<<<<<< + * prefix = string[:pre_len] + * minus_pre = string[pre_len:] +*/ + } + + /* "spacy/tokenizer.pyx":434 + * prefixes.push_back(self.vocab.get(mem, prefix)) + * break + * suf_len = self.find_suffix(string[pre_len:]) # <<<<<<<<<<<<<< + * if suf_len != 0: + * suffix = string[-suf_len:] +*/ + __pyx_t_5 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_5); + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 434, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_pre_len); + __pyx_t_11 = __pyx_v_pre_len; + __pyx_t_1 = (__pyx_t_11 == Py_None); + if (__pyx_t_1) { + __pyx_t_3 = 0; + } else { + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_11); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 434, __pyx_L1_error) + __pyx_t_3 = __pyx_t_9; + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyUnicode_Substring(__pyx_v_string, __pyx_t_3, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_11}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_find_suffix, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_suf_len, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":435 + * break + * suf_len = self.find_suffix(string[pre_len:]) + * if suf_len != 0: # <<<<<<<<<<<<<< + * suffix = string[-suf_len:] + * minus_suf = string[:-suf_len] +*/ + __pyx_t_1 = (__Pyx_PyLong_BoolNeObjC(__pyx_v_suf_len, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 435, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":436 + * suf_len = self.find_suffix(string[pre_len:]) + * if suf_len != 0: + * suffix = string[-suf_len:] # <<<<<<<<<<<<<< + * minus_suf = string[:-suf_len] + * if minus_suf and with_special_cases and self._specials.get(hash_string(minus_suf)) != NULL: +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 436, __pyx_L1_error) + } + __pyx_t_4 = PyNumber_Negative(__pyx_v_suf_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = (__pyx_t_4 == Py_None); + if (__pyx_t_1) { + __pyx_t_3 = 0; + } else { + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 436, __pyx_L1_error) + __pyx_t_3 = __pyx_t_9; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyUnicode_Substring(__pyx_v_string, __pyx_t_3, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_suffix, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":437 + * if suf_len != 0: + * suffix = string[-suf_len:] + * minus_suf = string[:-suf_len] # <<<<<<<<<<<<<< + * if minus_suf and with_special_cases and self._specials.get(hash_string(minus_suf)) != NULL: + * string = minus_suf +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 437, __pyx_L1_error) + } + __pyx_t_4 = PyNumber_Negative(__pyx_v_suf_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = (__pyx_t_4 == Py_None); + if (__pyx_t_1) { + __pyx_t_3 = PY_SSIZE_T_MAX; + } else { + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 437, __pyx_L1_error) + __pyx_t_3 = __pyx_t_9; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyUnicode_Substring(__pyx_v_string, 0, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_minus_suf, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":438 + * suffix = string[-suf_len:] + * minus_suf = string[:-suf_len] + * if minus_suf and with_special_cases and self._specials.get(hash_string(minus_suf)) != NULL: # <<<<<<<<<<<<<< + * string = minus_suf + * suffixes.push_back(self.vocab.get(mem, suffix)) +*/ + { + Py_ssize_t __pyx_temp = __Pyx_PyUnicode_IS_TRUE(__pyx_v_minus_suf); + if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_2 = (__pyx_temp != 0); + } + + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L20_bool_binop_done; + } + if (__pyx_v_with_special_cases) { + } else { + __pyx_t_1 = __pyx_v_with_special_cases; + goto __pyx_L20_bool_binop_done; + } + __pyx_t_7 = __pyx_f_5spacy_7strings_hash_string(__pyx_v_minus_suf, 0); if (unlikely(__pyx_t_7 == ((__pyx_t_5spacy_8typedefs_hash_t)0))) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_8 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_specials->__pyx_vtab)->get(__pyx_v_self->_specials, __pyx_t_7); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_8 != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L20_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":439 + * minus_suf = string[:-suf_len] + * if minus_suf and with_special_cases and self._specials.get(hash_string(minus_suf)) != NULL: + * string = minus_suf # <<<<<<<<<<<<<< + * suffixes.push_back(self.vocab.get(mem, suffix)) + * break +*/ + __Pyx_INCREF(__pyx_v_minus_suf); + __Pyx_DECREF_SET(__pyx_v_string, __pyx_v_minus_suf); + + /* "spacy/tokenizer.pyx":440 + * if minus_suf and with_special_cases and self._specials.get(hash_string(minus_suf)) != NULL: + * string = minus_suf + * suffixes.push_back(self.vocab.get(mem, suffix)) # <<<<<<<<<<<<<< + * break + * if pre_len and suf_len and (pre_len + suf_len) <= len(string): +*/ + __pyx_t_10 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->vocab->__pyx_vtab)->get(__pyx_v_self->vocab, __pyx_v_mem, __pyx_v_suffix); if (unlikely(__pyx_t_10 == ((void *)NULL))) __PYX_ERR(0, 440, __pyx_L1_error) + try { + __pyx_v_suffixes->push_back(__pyx_t_10); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 440, __pyx_L1_error) + } + + /* "spacy/tokenizer.pyx":441 + * string = minus_suf + * suffixes.push_back(self.vocab.get(mem, suffix)) + * break # <<<<<<<<<<<<<< + * if pre_len and suf_len and (pre_len + suf_len) <= len(string): + * string = string[pre_len:-suf_len] +*/ + goto __pyx_L4_break; + + /* "spacy/tokenizer.pyx":438 + * suffix = string[-suf_len:] + * minus_suf = string[:-suf_len] + * if minus_suf and with_special_cases and self._specials.get(hash_string(minus_suf)) != NULL: # <<<<<<<<<<<<<< + * string = minus_suf + * suffixes.push_back(self.vocab.get(mem, suffix)) +*/ + } + + /* "spacy/tokenizer.pyx":435 + * break + * suf_len = self.find_suffix(string[pre_len:]) + * if suf_len != 0: # <<<<<<<<<<<<<< + * suffix = string[-suf_len:] + * minus_suf = string[:-suf_len] +*/ + } + + /* "spacy/tokenizer.pyx":442 + * suffixes.push_back(self.vocab.get(mem, suffix)) + * break + * if pre_len and suf_len and (pre_len + suf_len) <= len(string): # <<<<<<<<<<<<<< + * string = string[pre_len:-suf_len] + * prefixes.push_back(self.vocab.get(mem, prefix)) +*/ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pre_len); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 442, __pyx_L1_error) + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L24_bool_binop_done; + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_suf_len); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 442, __pyx_L1_error) + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L24_bool_binop_done; + } + __pyx_t_4 = PyNumber_Add(__pyx_v_pre_len, __pyx_v_suf_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 442, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_string); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 442, __pyx_L1_error) + __pyx_t_11 = PyLong_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_11, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 442, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 442, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __pyx_t_2; + __pyx_L24_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":443 + * break + * if pre_len and suf_len and (pre_len + suf_len) <= len(string): + * string = string[pre_len:-suf_len] # <<<<<<<<<<<<<< + * prefixes.push_back(self.vocab.get(mem, prefix)) + * suffixes.push_back(self.vocab.get(mem, suffix)) +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 443, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_pre_len); + __pyx_t_5 = __pyx_v_pre_len; + __pyx_t_1 = (__pyx_t_5 == Py_None); + if (__pyx_t_1) { + __pyx_t_3 = 0; + } else { + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L1_error) + __pyx_t_3 = __pyx_t_9; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Negative(__pyx_v_suf_len); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = (__pyx_t_5 == Py_None); + if (__pyx_t_1) { + __pyx_t_9 = PY_SSIZE_T_MAX; + } else { + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L1_error) + __pyx_t_9 = __pyx_t_12; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyUnicode_Substring(__pyx_v_string, __pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_string, ((PyObject*)__pyx_t_5)); + __pyx_t_5 = 0; + + /* "spacy/tokenizer.pyx":444 + * if pre_len and suf_len and (pre_len + suf_len) <= len(string): + * string = string[pre_len:-suf_len] + * prefixes.push_back(self.vocab.get(mem, prefix)) # <<<<<<<<<<<<<< + * suffixes.push_back(self.vocab.get(mem, suffix)) + * elif pre_len: +*/ + if (unlikely(!__pyx_v_prefix)) { __Pyx_RaiseUnboundLocalError("prefix"); __PYX_ERR(0, 444, __pyx_L1_error) } + __pyx_t_10 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->vocab->__pyx_vtab)->get(__pyx_v_self->vocab, __pyx_v_mem, __pyx_v_prefix); if (unlikely(__pyx_t_10 == ((void *)NULL))) __PYX_ERR(0, 444, __pyx_L1_error) + try { + __pyx_v_prefixes->push_back(__pyx_t_10); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 444, __pyx_L1_error) + } + + /* "spacy/tokenizer.pyx":445 + * string = string[pre_len:-suf_len] + * prefixes.push_back(self.vocab.get(mem, prefix)) + * suffixes.push_back(self.vocab.get(mem, suffix)) # <<<<<<<<<<<<<< + * elif pre_len: + * string = minus_pre +*/ + if (unlikely(!__pyx_v_suffix)) { __Pyx_RaiseUnboundLocalError("suffix"); __PYX_ERR(0, 445, __pyx_L1_error) } + __pyx_t_10 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->vocab->__pyx_vtab)->get(__pyx_v_self->vocab, __pyx_v_mem, __pyx_v_suffix); if (unlikely(__pyx_t_10 == ((void *)NULL))) __PYX_ERR(0, 445, __pyx_L1_error) + try { + __pyx_v_suffixes->push_back(__pyx_t_10); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 445, __pyx_L1_error) + } + + /* "spacy/tokenizer.pyx":442 + * suffixes.push_back(self.vocab.get(mem, suffix)) + * break + * if pre_len and suf_len and (pre_len + suf_len) <= len(string): # <<<<<<<<<<<<<< + * string = string[pre_len:-suf_len] + * prefixes.push_back(self.vocab.get(mem, prefix)) +*/ + goto __pyx_L23; + } + + /* "spacy/tokenizer.pyx":446 + * prefixes.push_back(self.vocab.get(mem, prefix)) + * suffixes.push_back(self.vocab.get(mem, suffix)) + * elif pre_len: # <<<<<<<<<<<<<< + * string = minus_pre + * prefixes.push_back(self.vocab.get(mem, prefix)) +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pre_len); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 446, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":447 + * suffixes.push_back(self.vocab.get(mem, suffix)) + * elif pre_len: + * string = minus_pre # <<<<<<<<<<<<<< + * prefixes.push_back(self.vocab.get(mem, prefix)) + * elif suf_len: +*/ + if (unlikely(!__pyx_v_minus_pre)) { __Pyx_RaiseUnboundLocalError("minus_pre"); __PYX_ERR(0, 447, __pyx_L1_error) } + __Pyx_INCREF(__pyx_v_minus_pre); + __Pyx_DECREF_SET(__pyx_v_string, __pyx_v_minus_pre); + + /* "spacy/tokenizer.pyx":448 + * elif pre_len: + * string = minus_pre + * prefixes.push_back(self.vocab.get(mem, prefix)) # <<<<<<<<<<<<<< + * elif suf_len: + * string = minus_suf +*/ + if (unlikely(!__pyx_v_prefix)) { __Pyx_RaiseUnboundLocalError("prefix"); __PYX_ERR(0, 448, __pyx_L1_error) } + __pyx_t_10 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->vocab->__pyx_vtab)->get(__pyx_v_self->vocab, __pyx_v_mem, __pyx_v_prefix); if (unlikely(__pyx_t_10 == ((void *)NULL))) __PYX_ERR(0, 448, __pyx_L1_error) + try { + __pyx_v_prefixes->push_back(__pyx_t_10); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 448, __pyx_L1_error) + } + + /* "spacy/tokenizer.pyx":446 + * prefixes.push_back(self.vocab.get(mem, prefix)) + * suffixes.push_back(self.vocab.get(mem, suffix)) + * elif pre_len: # <<<<<<<<<<<<<< + * string = minus_pre + * prefixes.push_back(self.vocab.get(mem, prefix)) +*/ + goto __pyx_L23; + } + + /* "spacy/tokenizer.pyx":449 + * string = minus_pre + * prefixes.push_back(self.vocab.get(mem, prefix)) + * elif suf_len: # <<<<<<<<<<<<<< + * string = minus_suf + * suffixes.push_back(self.vocab.get(mem, suffix)) +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_suf_len); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 449, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":450 + * prefixes.push_back(self.vocab.get(mem, prefix)) + * elif suf_len: + * string = minus_suf # <<<<<<<<<<<<<< + * suffixes.push_back(self.vocab.get(mem, suffix)) + * return string +*/ + if (unlikely(!__pyx_v_minus_suf)) { __Pyx_RaiseUnboundLocalError("minus_suf"); __PYX_ERR(0, 450, __pyx_L1_error) } + __Pyx_INCREF(__pyx_v_minus_suf); + __Pyx_DECREF_SET(__pyx_v_string, __pyx_v_minus_suf); + + /* "spacy/tokenizer.pyx":451 + * elif suf_len: + * string = minus_suf + * suffixes.push_back(self.vocab.get(mem, suffix)) # <<<<<<<<<<<<<< + * return string + * +*/ + if (unlikely(!__pyx_v_suffix)) { __Pyx_RaiseUnboundLocalError("suffix"); __PYX_ERR(0, 451, __pyx_L1_error) } + __pyx_t_10 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->vocab->__pyx_vtab)->get(__pyx_v_self->vocab, __pyx_v_mem, __pyx_v_suffix); if (unlikely(__pyx_t_10 == ((void *)NULL))) __PYX_ERR(0, 451, __pyx_L1_error) + try { + __pyx_v_suffixes->push_back(__pyx_t_10); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 451, __pyx_L1_error) + } + + /* "spacy/tokenizer.pyx":449 + * string = minus_pre + * prefixes.push_back(self.vocab.get(mem, prefix)) + * elif suf_len: # <<<<<<<<<<<<<< + * string = minus_suf + * suffixes.push_back(self.vocab.get(mem, suffix)) +*/ + } + __pyx_L23:; + } + __pyx_L4_break:; + + /* "spacy/tokenizer.pyx":452 + * string = minus_suf + * suffixes.push_back(self.vocab.get(mem, suffix)) + * return string # <<<<<<<<<<<<<< + * + * cdef int _attach_tokens(self, Doc tokens, str string, +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_string); + __pyx_r = __pyx_v_string; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":406 + * tokens.length - orig_size) + * + * cdef str _split_affixes( # <<<<<<<<<<<<<< + * self, + * Pool mem, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._split_affixes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_prefix); + __Pyx_XDECREF(__pyx_v_suffix); + __Pyx_XDECREF(__pyx_v_minus_pre); + __Pyx_XDECREF(__pyx_v_minus_suf); + __Pyx_XDECREF(__pyx_v_pre_len); + __Pyx_XDECREF(__pyx_v_suf_len); + __Pyx_XDECREF(__pyx_v_string); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":454 + * return string + * + * cdef int _attach_tokens(self, Doc tokens, str string, # <<<<<<<<<<<<<< + * vector[const LexemeC*] *prefixes, + * vector[const LexemeC*] *suffixes, +*/ + +static int __pyx_f_5spacy_9tokenizer_9Tokenizer__attach_tokens(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_tokens, PyObject *__pyx_v_string, std::vector *__pyx_v_prefixes, std::vector *__pyx_v_suffixes, int *__pyx_v_has_special, int __pyx_v_with_special_cases) { + struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme; + PyObject *__pyx_v_span = 0; + int __pyx_v_i; + PyObject *__pyx_v_matches = NULL; + PyObject *__pyx_v_start = NULL; + long __pyx_v_start_before_infixes; + PyObject *__pyx_v_match = NULL; + PyObject *__pyx_v_infix_start = NULL; + PyObject *__pyx_v_infix_end = NULL; + PyObject *__pyx_v_infix_span = NULL; + std::vector ::reverse_iterator __pyx_v_it; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + std::vector ::size_type __pyx_t_2; + std::vector ::size_type __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_11; + long __pyx_t_12; + Py_ssize_t __pyx_t_13; + PyObject *(*__pyx_t_14)(PyObject *); + PyObject *__pyx_t_15 = NULL; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_attach_tokens", 0); + + /* "spacy/tokenizer.pyx":462 + * cdef str span + * cdef int i + * if prefixes.size(): # <<<<<<<<<<<<<< + * for i in range(prefixes.size()): + * tokens.push_back(prefixes[0][i], False) +*/ + __pyx_t_1 = (__pyx_v_prefixes->size() != 0); + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":463 + * cdef int i + * if prefixes.size(): + * for i in range(prefixes.size()): # <<<<<<<<<<<<<< + * tokens.push_back(prefixes[0][i], False) + * if string: +*/ + __pyx_t_2 = __pyx_v_prefixes->size(); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "spacy/tokenizer.pyx":464 + * if prefixes.size(): + * for i in range(prefixes.size()): + * tokens.push_back(prefixes[0][i], False) # <<<<<<<<<<<<<< + * if string: + * if self._try_specials_and_cache(hash_string(string), tokens, has_special, with_special_cases): +*/ + __pyx_t_5 = ((struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *)__pyx_v_tokens->__pyx_vtab)->__pyx_fuse_0push_back(__pyx_v_tokens, ((__pyx_v_prefixes[0])[__pyx_v_i]), 0); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 464, __pyx_L1_error) + } + + /* "spacy/tokenizer.pyx":462 + * cdef str span + * cdef int i + * if prefixes.size(): # <<<<<<<<<<<<<< + * for i in range(prefixes.size()): + * tokens.push_back(prefixes[0][i], False) +*/ + } + + /* "spacy/tokenizer.pyx":465 + * for i in range(prefixes.size()): + * tokens.push_back(prefixes[0][i], False) + * if string: # <<<<<<<<<<<<<< + * if self._try_specials_and_cache(hash_string(string), tokens, has_special, with_special_cases): + * pass +*/ + if (__pyx_v_string == Py_None) __pyx_t_1 = 0; + else + { + Py_ssize_t __pyx_temp = __Pyx_PyUnicode_IS_TRUE(__pyx_v_string); + if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 465, __pyx_L1_error) + __pyx_t_1 = (__pyx_temp != 0); + } + + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":466 + * tokens.push_back(prefixes[0][i], False) + * if string: + * if self._try_specials_and_cache(hash_string(string), tokens, has_special, with_special_cases): # <<<<<<<<<<<<<< + * pass + * elif ( +*/ + __pyx_t_6 = __pyx_f_5spacy_7strings_hash_string(__pyx_v_string, 0); if (unlikely(__pyx_t_6 == ((__pyx_t_5spacy_8typedefs_hash_t)0))) __PYX_ERR(0, 466, __pyx_L1_error) + __pyx_t_4 = ((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_try_specials_and_cache(__pyx_v_self, __pyx_t_6, __pyx_v_tokens, __pyx_v_has_special, __pyx_v_with_special_cases); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 466, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_4 != 0); + if (__pyx_t_1) { + goto __pyx_L7; + } + + /* "spacy/tokenizer.pyx":469 + * pass + * elif ( + * (self.token_match and self.token_match(string)) or # <<<<<<<<<<<<<< + * (self.url_match and self.url_match(string)) + * ): +*/ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_token_match); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 469, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 469, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!__pyx_t_8) { + goto __pyx_L9_next_or; + } else { + } + __pyx_t_9 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_9); + __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_string}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_token_match, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 469, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 469, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!__pyx_t_8) { + } else { + __pyx_t_1 = __pyx_t_8; + goto __pyx_L8_bool_binop_done; + } + __pyx_L9_next_or:; + + /* "spacy/tokenizer.pyx":470 + * elif ( + * (self.token_match and self.token_match(string)) or + * (self.url_match and self.url_match(string)) # <<<<<<<<<<<<<< + * ): + * +*/ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_url_match); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_8) { + } else { + __pyx_t_1 = __pyx_t_8; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_9 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_9); + __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_string}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_url_match, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_1 = __pyx_t_8; + __pyx_L8_bool_binop_done:; + + /* "spacy/tokenizer.pyx":468 + * if self._try_specials_and_cache(hash_string(string), tokens, has_special, with_special_cases): + * pass + * elif ( # <<<<<<<<<<<<<< + * (self.token_match and self.token_match(string)) or + * (self.url_match and self.url_match(string)) +*/ + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":476 + * # fix up the outermost one, with reference to the original. + * # See Issue #859 + * tokens.push_back(self.vocab.get(tokens.mem, string), False) # <<<<<<<<<<<<<< + * else: + * matches = self.find_infix(string) +*/ + __pyx_t_7 = ((PyObject *)__pyx_v_tokens->mem); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_11 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->vocab->__pyx_vtab)->get(__pyx_v_self->vocab, ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_7), __pyx_v_string); if (unlikely(__pyx_t_11 == ((void *)NULL))) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = ((struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *)__pyx_v_tokens->__pyx_vtab)->__pyx_fuse_0push_back(__pyx_v_tokens, __pyx_t_11, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 476, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":468 + * if self._try_specials_and_cache(hash_string(string), tokens, has_special, with_special_cases): + * pass + * elif ( # <<<<<<<<<<<<<< + * (self.token_match and self.token_match(string)) or + * (self.url_match and self.url_match(string)) +*/ + goto __pyx_L7; + } + + /* "spacy/tokenizer.pyx":478 + * tokens.push_back(self.vocab.get(tokens.mem, string), False) + * else: + * matches = self.find_infix(string) # <<<<<<<<<<<<<< + * if not matches: + * tokens.push_back(self.vocab.get(tokens.mem, string), False) +*/ + /*else*/ { + __pyx_t_9 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_9); + __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_string}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_find_infix, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 478, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_v_matches = __pyx_t_7; + __pyx_t_7 = 0; + + /* "spacy/tokenizer.pyx":479 + * else: + * matches = self.find_infix(string) + * if not matches: # <<<<<<<<<<<<<< + * tokens.push_back(self.vocab.get(tokens.mem, string), False) + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_matches); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 479, __pyx_L1_error) + __pyx_t_8 = (!__pyx_t_1); + if (__pyx_t_8) { + + /* "spacy/tokenizer.pyx":480 + * matches = self.find_infix(string) + * if not matches: + * tokens.push_back(self.vocab.get(tokens.mem, string), False) # <<<<<<<<<<<<<< + * else: + * # Let's say we have dyn-o-mite-dave - the regex finds the +*/ + __pyx_t_7 = ((PyObject *)__pyx_v_tokens->mem); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_11 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->vocab->__pyx_vtab)->get(__pyx_v_self->vocab, ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_7), __pyx_v_string); if (unlikely(__pyx_t_11 == ((void *)NULL))) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = ((struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *)__pyx_v_tokens->__pyx_vtab)->__pyx_fuse_0push_back(__pyx_v_tokens, __pyx_t_11, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 480, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":479 + * else: + * matches = self.find_infix(string) + * if not matches: # <<<<<<<<<<<<<< + * tokens.push_back(self.vocab.get(tokens.mem, string), False) + * else: +*/ + goto __pyx_L12; + } + + /* "spacy/tokenizer.pyx":484 + * # Let's say we have dyn-o-mite-dave - the regex finds the + * # start and end positions of the hyphens + * start = 0 # <<<<<<<<<<<<<< + * start_before_infixes = start + * for match in matches: +*/ + /*else*/ { + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_v_start = __pyx_mstate_global->__pyx_int_0; + + /* "spacy/tokenizer.pyx":485 + * # start and end positions of the hyphens + * start = 0 + * start_before_infixes = start # <<<<<<<<<<<<<< + * for match in matches: + * infix_start = match.start() +*/ + __pyx_t_12 = __Pyx_PyLong_As_long(__pyx_v_start); if (unlikely((__pyx_t_12 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 485, __pyx_L1_error) + __pyx_v_start_before_infixes = __pyx_t_12; + + /* "spacy/tokenizer.pyx":486 + * start = 0 + * start_before_infixes = start + * for match in matches: # <<<<<<<<<<<<<< + * infix_start = match.start() + * infix_end = match.end() +*/ + if (likely(PyList_CheckExact(__pyx_v_matches)) || PyTuple_CheckExact(__pyx_v_matches)) { + __pyx_t_7 = __pyx_v_matches; __Pyx_INCREF(__pyx_t_7); + __pyx_t_13 = 0; + __pyx_t_14 = NULL; + } else { + __pyx_t_13 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_matches); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 486, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_14)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 486, __pyx_L1_error) + #endif + if (__pyx_t_13 >= __pyx_temp) break; + } + __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_13, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_13; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 486, __pyx_L1_error) + #endif + if (__pyx_t_13 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_13)); + #else + __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_13); + #endif + ++__pyx_t_13; + } + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 486, __pyx_L1_error) + } else { + __pyx_t_9 = __pyx_t_14(__pyx_t_7); + if (unlikely(!__pyx_t_9)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 486, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_9); + __Pyx_XDECREF_SET(__pyx_v_match, __pyx_t_9); + __pyx_t_9 = 0; + + /* "spacy/tokenizer.pyx":487 + * start_before_infixes = start + * for match in matches: + * infix_start = match.start() # <<<<<<<<<<<<<< + * infix_end = match.end() + * +*/ + __pyx_t_15 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_15); + __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, NULL}; + __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_start, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_XDECREF_SET(__pyx_v_infix_start, __pyx_t_9); + __pyx_t_9 = 0; + + /* "spacy/tokenizer.pyx":488 + * for match in matches: + * infix_start = match.start() + * infix_end = match.end() # <<<<<<<<<<<<<< + * + * if infix_start == start_before_infixes: +*/ + __pyx_t_15 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_15); + __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, NULL}; + __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_end, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_XDECREF_SET(__pyx_v_infix_end, __pyx_t_9); + __pyx_t_9 = 0; + + /* "spacy/tokenizer.pyx":490 + * infix_end = match.end() + * + * if infix_start == start_before_infixes: # <<<<<<<<<<<<<< + * continue + * +*/ + __pyx_t_9 = __Pyx_PyLong_From_long(__pyx_v_start_before_infixes); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_15 = PyObject_RichCompare(__pyx_v_infix_start, __pyx_t_9, Py_EQ); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (__pyx_t_8) { + + /* "spacy/tokenizer.pyx":491 + * + * if infix_start == start_before_infixes: + * continue # <<<<<<<<<<<<<< + * + * if infix_start != start: +*/ + goto __pyx_L13_continue; + + /* "spacy/tokenizer.pyx":490 + * infix_end = match.end() + * + * if infix_start == start_before_infixes: # <<<<<<<<<<<<<< + * continue + * +*/ + } + + /* "spacy/tokenizer.pyx":493 + * continue + * + * if infix_start != start: # <<<<<<<<<<<<<< + * span = string[start:infix_start] + * tokens.push_back(self.vocab.get(tokens.mem, span), False) +*/ + __pyx_t_15 = PyObject_RichCompare(__pyx_v_infix_start, __pyx_v_start, Py_NE); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 493, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (__pyx_t_8) { + + /* "spacy/tokenizer.pyx":494 + * + * if infix_start != start: + * span = string[start:infix_start] # <<<<<<<<<<<<<< + * tokens.push_back(self.vocab.get(tokens.mem, span), False) + * +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 494, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_start); + __pyx_t_15 = __pyx_v_start; + __pyx_t_8 = (__pyx_t_15 == Py_None); + if (__pyx_t_8) { + __pyx_t_16 = 0; + } else { + __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_t_15); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 494, __pyx_L1_error) + __pyx_t_16 = __pyx_t_17; + } + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_INCREF(__pyx_v_infix_start); + __pyx_t_15 = __pyx_v_infix_start; + __pyx_t_8 = (__pyx_t_15 == Py_None); + if (__pyx_t_8) { + __pyx_t_17 = PY_SSIZE_T_MAX; + } else { + __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_t_15); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 494, __pyx_L1_error) + __pyx_t_17 = __pyx_t_18; + } + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyUnicode_Substring(__pyx_v_string, __pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_XDECREF_SET(__pyx_v_span, ((PyObject*)__pyx_t_15)); + __pyx_t_15 = 0; + + /* "spacy/tokenizer.pyx":495 + * if infix_start != start: + * span = string[start:infix_start] + * tokens.push_back(self.vocab.get(tokens.mem, span), False) # <<<<<<<<<<<<<< + * + * if infix_start != infix_end: +*/ + __pyx_t_15 = ((PyObject *)__pyx_v_tokens->mem); + __Pyx_INCREF(__pyx_t_15); + __pyx_t_11 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->vocab->__pyx_vtab)->get(__pyx_v_self->vocab, ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_15), __pyx_v_span); if (unlikely(__pyx_t_11 == ((void *)NULL))) __PYX_ERR(0, 495, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_4 = ((struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *)__pyx_v_tokens->__pyx_vtab)->__pyx_fuse_0push_back(__pyx_v_tokens, __pyx_t_11, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 495, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":493 + * continue + * + * if infix_start != start: # <<<<<<<<<<<<<< + * span = string[start:infix_start] + * tokens.push_back(self.vocab.get(tokens.mem, span), False) +*/ + } + + /* "spacy/tokenizer.pyx":497 + * tokens.push_back(self.vocab.get(tokens.mem, span), False) + * + * if infix_start != infix_end: # <<<<<<<<<<<<<< + * # If infix_start != infix_end, it means the infix + * # token is non-empty. Empty infix tokens are useful +*/ + __pyx_t_15 = PyObject_RichCompare(__pyx_v_infix_start, __pyx_v_infix_end, Py_NE); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 497, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 497, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (__pyx_t_8) { + + /* "spacy/tokenizer.pyx":502 + * # for tokenization in some languages (see + * # https://github.com/explosion/spaCy/issues/768) + * infix_span = string[infix_start:infix_end] # <<<<<<<<<<<<<< + * tokens.push_back(self.vocab.get(tokens.mem, infix_span), False) + * start = infix_end +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 502, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_infix_start); + __pyx_t_15 = __pyx_v_infix_start; + __pyx_t_8 = (__pyx_t_15 == Py_None); + if (__pyx_t_8) { + __pyx_t_17 = 0; + } else { + __pyx_t_16 = __Pyx_PyIndex_AsSsize_t(__pyx_t_15); if (unlikely((__pyx_t_16 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_17 = __pyx_t_16; + } + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_INCREF(__pyx_v_infix_end); + __pyx_t_15 = __pyx_v_infix_end; + __pyx_t_8 = (__pyx_t_15 == Py_None); + if (__pyx_t_8) { + __pyx_t_16 = PY_SSIZE_T_MAX; + } else { + __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_t_15); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_16 = __pyx_t_18; + } + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyUnicode_Substring(__pyx_v_string, __pyx_t_17, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 502, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_XDECREF_SET(__pyx_v_infix_span, ((PyObject*)__pyx_t_15)); + __pyx_t_15 = 0; + + /* "spacy/tokenizer.pyx":503 + * # https://github.com/explosion/spaCy/issues/768) + * infix_span = string[infix_start:infix_end] + * tokens.push_back(self.vocab.get(tokens.mem, infix_span), False) # <<<<<<<<<<<<<< + * start = infix_end + * span = string[start:] +*/ + __pyx_t_15 = ((PyObject *)__pyx_v_tokens->mem); + __Pyx_INCREF(__pyx_t_15); + __pyx_t_11 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->vocab->__pyx_vtab)->get(__pyx_v_self->vocab, ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_15), __pyx_v_infix_span); if (unlikely(__pyx_t_11 == ((void *)NULL))) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_4 = ((struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *)__pyx_v_tokens->__pyx_vtab)->__pyx_fuse_0push_back(__pyx_v_tokens, __pyx_t_11, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 503, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":497 + * tokens.push_back(self.vocab.get(tokens.mem, span), False) + * + * if infix_start != infix_end: # <<<<<<<<<<<<<< + * # If infix_start != infix_end, it means the infix + * # token is non-empty. Empty infix tokens are useful +*/ + } + + /* "spacy/tokenizer.pyx":504 + * infix_span = string[infix_start:infix_end] + * tokens.push_back(self.vocab.get(tokens.mem, infix_span), False) + * start = infix_end # <<<<<<<<<<<<<< + * span = string[start:] + * if span: +*/ + __Pyx_INCREF(__pyx_v_infix_end); + __Pyx_DECREF_SET(__pyx_v_start, __pyx_v_infix_end); + + /* "spacy/tokenizer.pyx":486 + * start = 0 + * start_before_infixes = start + * for match in matches: # <<<<<<<<<<<<<< + * infix_start = match.start() + * infix_end = match.end() +*/ + __pyx_L13_continue:; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/tokenizer.pyx":505 + * tokens.push_back(self.vocab.get(tokens.mem, infix_span), False) + * start = infix_end + * span = string[start:] # <<<<<<<<<<<<<< + * if span: + * tokens.push_back(self.vocab.get(tokens.mem, span), False) +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 505, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_start); + __pyx_t_7 = __pyx_v_start; + __pyx_t_8 = (__pyx_t_7 == Py_None); + if (__pyx_t_8) { + __pyx_t_13 = 0; + } else { + __pyx_t_16 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_16 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_13 = __pyx_t_16; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyUnicode_Substring(__pyx_v_string, __pyx_t_13, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 505, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_span, ((PyObject*)__pyx_t_7)); + __pyx_t_7 = 0; + + /* "spacy/tokenizer.pyx":506 + * start = infix_end + * span = string[start:] + * if span: # <<<<<<<<<<<<<< + * tokens.push_back(self.vocab.get(tokens.mem, span), False) + * cdef vector[const LexemeC*].reverse_iterator it = suffixes.rbegin() +*/ + { + Py_ssize_t __pyx_temp = __Pyx_PyUnicode_IS_TRUE(__pyx_v_span); + if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 506, __pyx_L1_error) + __pyx_t_8 = (__pyx_temp != 0); + } + + if (__pyx_t_8) { + + /* "spacy/tokenizer.pyx":507 + * span = string[start:] + * if span: + * tokens.push_back(self.vocab.get(tokens.mem, span), False) # <<<<<<<<<<<<<< + * cdef vector[const LexemeC*].reverse_iterator it = suffixes.rbegin() + * while it != suffixes.rend(): +*/ + __pyx_t_7 = ((PyObject *)__pyx_v_tokens->mem); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_11 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->vocab->__pyx_vtab)->get(__pyx_v_self->vocab, ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_7), __pyx_v_span); if (unlikely(__pyx_t_11 == ((void *)NULL))) __PYX_ERR(0, 507, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = ((struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *)__pyx_v_tokens->__pyx_vtab)->__pyx_fuse_0push_back(__pyx_v_tokens, __pyx_t_11, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 507, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":506 + * start = infix_end + * span = string[start:] + * if span: # <<<<<<<<<<<<<< + * tokens.push_back(self.vocab.get(tokens.mem, span), False) + * cdef vector[const LexemeC*].reverse_iterator it = suffixes.rbegin() +*/ + } + } + __pyx_L12:; + } + __pyx_L7:; + + /* "spacy/tokenizer.pyx":465 + * for i in range(prefixes.size()): + * tokens.push_back(prefixes[0][i], False) + * if string: # <<<<<<<<<<<<<< + * if self._try_specials_and_cache(hash_string(string), tokens, has_special, with_special_cases): + * pass +*/ + } + + /* "spacy/tokenizer.pyx":508 + * if span: + * tokens.push_back(self.vocab.get(tokens.mem, span), False) + * cdef vector[const LexemeC*].reverse_iterator it = suffixes.rbegin() # <<<<<<<<<<<<<< + * while it != suffixes.rend(): + * lexeme = deref(it) +*/ + __pyx_v_it = __pyx_v_suffixes->rbegin(); + + /* "spacy/tokenizer.pyx":509 + * tokens.push_back(self.vocab.get(tokens.mem, span), False) + * cdef vector[const LexemeC*].reverse_iterator it = suffixes.rbegin() + * while it != suffixes.rend(): # <<<<<<<<<<<<<< + * lexeme = deref(it) + * preinc(it) +*/ + while (1) { + __pyx_t_8 = (__pyx_v_it != __pyx_v_suffixes->rend()); + if (!__pyx_t_8) break; + + /* "spacy/tokenizer.pyx":510 + * cdef vector[const LexemeC*].reverse_iterator it = suffixes.rbegin() + * while it != suffixes.rend(): + * lexeme = deref(it) # <<<<<<<<<<<<<< + * preinc(it) + * tokens.push_back(lexeme, False) +*/ + __pyx_v_lexeme = (*__pyx_v_it); + + /* "spacy/tokenizer.pyx":511 + * while it != suffixes.rend(): + * lexeme = deref(it) + * preinc(it) # <<<<<<<<<<<<<< + * tokens.push_back(lexeme, False) + * +*/ + (void)((++__pyx_v_it)); + + /* "spacy/tokenizer.pyx":512 + * lexeme = deref(it) + * preinc(it) + * tokens.push_back(lexeme, False) # <<<<<<<<<<<<<< + * + * cdef int _save_cached(self, const TokenC* tokens, hash_t key, +*/ + __pyx_t_4 = ((struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *)__pyx_v_tokens->__pyx_vtab)->__pyx_fuse_0push_back(__pyx_v_tokens, __pyx_v_lexeme, 0); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 512, __pyx_L1_error) + } + + /* "spacy/tokenizer.pyx":454 + * return string + * + * cdef int _attach_tokens(self, Doc tokens, str string, # <<<<<<<<<<<<<< + * vector[const LexemeC*] *prefixes, + * vector[const LexemeC*] *suffixes, +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._attach_tokens", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_span); + __Pyx_XDECREF(__pyx_v_matches); + __Pyx_XDECREF(__pyx_v_start); + __Pyx_XDECREF(__pyx_v_match); + __Pyx_XDECREF(__pyx_v_infix_start); + __Pyx_XDECREF(__pyx_v_infix_end); + __Pyx_XDECREF(__pyx_v_infix_span); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":514 + * tokens.push_back(lexeme, False) + * + * cdef int _save_cached(self, const TokenC* tokens, hash_t key, # <<<<<<<<<<<<<< + * int* has_special, int n) except -1: + * cdef int i +*/ + +static int __pyx_f_5spacy_9tokenizer_9Tokenizer__save_cached(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_tokens, __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key, int *__pyx_v_has_special, int __pyx_v_n) { + int __pyx_v_i; + struct __pyx_t_5spacy_5vocab__Cached *__pyx_v_cached; + struct __pyx_t_5spacy_7structs_LexemeC const **__pyx_v_lexemes; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + void *__pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_save_cached", 0); + + /* "spacy/tokenizer.pyx":517 + * int* has_special, int n) except -1: + * cdef int i + * if n <= 0: # <<<<<<<<<<<<<< + * # avoid mem alloc of zero length + * return 0 +*/ + __pyx_t_1 = (__pyx_v_n <= 0); + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":519 + * if n <= 0: + * # avoid mem alloc of zero length + * return 0 # <<<<<<<<<<<<<< + * if self.vocab.in_memory_zone: + * return 0 +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":517 + * int* has_special, int n) except -1: + * cdef int i + * if n <= 0: # <<<<<<<<<<<<<< + * # avoid mem alloc of zero length + * return 0 +*/ + } + + /* "spacy/tokenizer.pyx":520 + * # avoid mem alloc of zero length + * return 0 + * if self.vocab.in_memory_zone: # <<<<<<<<<<<<<< + * return 0 + * # See #1250 +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->vocab), __pyx_mstate_global->__pyx_n_u_in_memory_zone); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":521 + * return 0 + * if self.vocab.in_memory_zone: + * return 0 # <<<<<<<<<<<<<< + * # See #1250 + * if has_special[0]: +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":520 + * # avoid mem alloc of zero length + * return 0 + * if self.vocab.in_memory_zone: # <<<<<<<<<<<<<< + * return 0 + * # See #1250 +*/ + } + + /* "spacy/tokenizer.pyx":523 + * return 0 + * # See #1250 + * if has_special[0]: # <<<<<<<<<<<<<< + * return 0 + * cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) +*/ + __pyx_t_1 = ((__pyx_v_has_special[0]) != 0); + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":524 + * # See #1250 + * if has_special[0]: + * return 0 # <<<<<<<<<<<<<< + * cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) + * cached.length = n +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":523 + * return 0 + * # See #1250 + * if has_special[0]: # <<<<<<<<<<<<<< + * return 0 + * cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) +*/ + } + + /* "spacy/tokenizer.pyx":525 + * if has_special[0]: + * return 0 + * cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) # <<<<<<<<<<<<<< + * cached.length = n + * cached.is_lex = True +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->alloc(__pyx_v_self->mem, 1, (sizeof(struct __pyx_t_5spacy_5vocab__Cached))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 525, __pyx_L1_error) + __pyx_v_cached = ((struct __pyx_t_5spacy_5vocab__Cached *)__pyx_t_3); + + /* "spacy/tokenizer.pyx":526 + * return 0 + * cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) + * cached.length = n # <<<<<<<<<<<<<< + * cached.is_lex = True + * lexemes = self.mem.alloc(n, sizeof(LexemeC**)) +*/ + __pyx_v_cached->length = __pyx_v_n; + + /* "spacy/tokenizer.pyx":527 + * cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) + * cached.length = n + * cached.is_lex = True # <<<<<<<<<<<<<< + * lexemes = self.mem.alloc(n, sizeof(LexemeC**)) + * for i in range(n): +*/ + __pyx_v_cached->is_lex = 1; + + /* "spacy/tokenizer.pyx":528 + * cached.length = n + * cached.is_lex = True + * lexemes = self.mem.alloc(n, sizeof(LexemeC**)) # <<<<<<<<<<<<<< + * for i in range(n): + * lexemes[i] = tokens[i].lex +*/ + __pyx_t_3 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->alloc(__pyx_v_self->mem, __pyx_v_n, (sizeof(struct __pyx_t_5spacy_7structs_LexemeC **))); if (unlikely(__pyx_t_3 == ((void *)NULL))) __PYX_ERR(0, 528, __pyx_L1_error) + __pyx_v_lexemes = ((struct __pyx_t_5spacy_7structs_LexemeC const **)__pyx_t_3); + + /* "spacy/tokenizer.pyx":529 + * cached.is_lex = True + * lexemes = self.mem.alloc(n, sizeof(LexemeC**)) + * for i in range(n): # <<<<<<<<<<<<<< + * lexemes[i] = tokens[i].lex + * cached.data.lexemes = lexemes +*/ + __pyx_t_4 = __pyx_v_n; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "spacy/tokenizer.pyx":530 + * lexemes = self.mem.alloc(n, sizeof(LexemeC**)) + * for i in range(n): + * lexemes[i] = tokens[i].lex # <<<<<<<<<<<<<< + * cached.data.lexemes = lexemes + * self._cache.set(key, cached) +*/ + __pyx_t_7 = (__pyx_v_tokens[__pyx_v_i]).lex; + (__pyx_v_lexemes[__pyx_v_i]) = __pyx_t_7; + } + + /* "spacy/tokenizer.pyx":531 + * for i in range(n): + * lexemes[i] = tokens[i].lex + * cached.data.lexemes = lexemes # <<<<<<<<<<<<<< + * self._cache.set(key, cached) + * +*/ + __pyx_v_cached->data.lexemes = ((struct __pyx_t_5spacy_7structs_LexemeC const *const *)__pyx_v_lexemes); + + /* "spacy/tokenizer.pyx":532 + * lexemes[i] = tokens[i].lex + * cached.data.lexemes = lexemes + * self._cache.set(key, cached) # <<<<<<<<<<<<<< + * + * def find_infix(self, str string): +*/ + ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_cache->__pyx_vtab)->set(__pyx_v_self->_cache, __pyx_v_key, __pyx_v_cached); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":514 + * tokens.push_back(lexeme, False) + * + * cdef int _save_cached(self, const TokenC* tokens, hash_t key, # <<<<<<<<<<<<<< + * int* has_special, int n) except -1: + * cdef int i +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._save_cached", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":534 + * self._cache.set(key, cached) + * + * def find_infix(self, str string): # <<<<<<<<<<<<<< + * """Find internal split points of the string, such as hyphens. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_16find_infix(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_15find_infix, "Tokenizer.find_infix(self, str string)\n\nFind internal split points of the string, such as hyphens.\n\nstring (str): The string to segment.\nRETURNS (list): A list of `re.MatchObject` objects that have `.start()`\n and `.end()` methods, denoting the placement of internal segment\n separators, e.g. hyphens.\n\nDOCS: https://spacy.io/api/tokenizer#find_infix"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_16find_infix = {"find_infix", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_16find_infix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_15find_infix}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_16find_infix(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_string = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("find_infix (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_string,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 534, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 534, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "find_infix", 0) < (0)) __PYX_ERR(0, 534, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("find_infix", 1, 1, 1, i); __PYX_ERR(0, 534, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 534, __pyx_L3_error) + } + __pyx_v_string = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("find_infix", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 534, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.find_infix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_string), (&PyUnicode_Type), 1, "string", 1))) __PYX_ERR(0, 534, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_15find_infix(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_string); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_15find_infix(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_string) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("find_infix", 0); + + /* "spacy/tokenizer.pyx":544 + * DOCS: https://spacy.io/api/tokenizer#find_infix + * """ + * if self.infix_finditer is None: # <<<<<<<<<<<<<< + * return 0 + * return list(self.infix_finditer(string)) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_infix_finditer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__pyx_t_1 == Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":545 + * """ + * if self.infix_finditer is None: + * return 0 # <<<<<<<<<<<<<< + * return list(self.infix_finditer(string)) + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_r = __pyx_mstate_global->__pyx_int_0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":544 + * DOCS: https://spacy.io/api/tokenizer#find_infix + * """ + * if self.infix_finditer is None: # <<<<<<<<<<<<<< + * return 0 + * return list(self.infix_finditer(string)) +*/ + } + + /* "spacy/tokenizer.pyx":546 + * if self.infix_finditer is None: + * return 0 + * return list(self.infix_finditer(string)) # <<<<<<<<<<<<<< + * + * def find_prefix(self, str string): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_string}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_infix_finditer, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":534 + * self._cache.set(key, cached) + * + * def find_infix(self, str string): # <<<<<<<<<<<<<< + * """Find internal split points of the string, such as hyphens. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.find_infix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":548 + * return list(self.infix_finditer(string)) + * + * def find_prefix(self, str string): # <<<<<<<<<<<<<< + * """Find the length of a prefix that should be segmented from the + * string, or None if no prefix rules match. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_18find_prefix(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_17find_prefix, "Tokenizer.find_prefix(self, str string)\n\nFind the length of a prefix that should be segmented from the\nstring, or None if no prefix rules match.\n\nstring (str): The string to segment.\nRETURNS (int): The length of the prefix if present, otherwise `None`.\n\nDOCS: https://spacy.io/api/tokenizer#find_prefix"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_18find_prefix = {"find_prefix", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_18find_prefix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_17find_prefix}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_18find_prefix(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_string = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("find_prefix (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_string,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 548, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 548, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "find_prefix", 0) < (0)) __PYX_ERR(0, 548, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("find_prefix", 1, 1, 1, i); __PYX_ERR(0, 548, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 548, __pyx_L3_error) + } + __pyx_v_string = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("find_prefix", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 548, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.find_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_string), (&PyUnicode_Type), 1, "string", 1))) __PYX_ERR(0, 548, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_17find_prefix(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_string); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_17find_prefix(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_string) { + PyObject *__pyx_v_match = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("find_prefix", 0); + + /* "spacy/tokenizer.pyx":557 + * DOCS: https://spacy.io/api/tokenizer#find_prefix + * """ + * if self.prefix_search is None: # <<<<<<<<<<<<<< + * return 0 + * match = self.prefix_search(string) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_prefix_search); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__pyx_t_1 == Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":558 + * """ + * if self.prefix_search is None: + * return 0 # <<<<<<<<<<<<<< + * match = self.prefix_search(string) + * return (match.end() - match.start()) if match is not None else 0 +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_r = __pyx_mstate_global->__pyx_int_0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":557 + * DOCS: https://spacy.io/api/tokenizer#find_prefix + * """ + * if self.prefix_search is None: # <<<<<<<<<<<<<< + * return 0 + * match = self.prefix_search(string) +*/ + } + + /* "spacy/tokenizer.pyx":559 + * if self.prefix_search is None: + * return 0 + * match = self.prefix_search(string) # <<<<<<<<<<<<<< + * return (match.end() - match.start()) if match is not None else 0 + * +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_string}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_prefix_search, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_match = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":560 + * return 0 + * match = self.prefix_search(string) + * return (match.end() - match.start()) if match is not None else 0 # <<<<<<<<<<<<<< + * + * def find_suffix(self, str string): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = (__pyx_v_match != Py_None); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_end, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 560, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_6 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_start, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 560, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 560, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __pyx_t_6; + __pyx_t_6 = 0; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_1 = __pyx_mstate_global->__pyx_int_0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":548 + * return list(self.infix_finditer(string)) + * + * def find_prefix(self, str string): # <<<<<<<<<<<<<< + * """Find the length of a prefix that should be segmented from the + * string, or None if no prefix rules match. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.find_prefix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_match); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":562 + * return (match.end() - match.start()) if match is not None else 0 + * + * def find_suffix(self, str string): # <<<<<<<<<<<<<< + * """Find the length of a suffix that should be segmented from the + * string, or None if no suffix rules match. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_20find_suffix(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_19find_suffix, "Tokenizer.find_suffix(self, str string)\n\nFind the length of a suffix that should be segmented from the\nstring, or None if no suffix rules match.\n\nstring (str): The string to segment.\nReturns (int): The length of the suffix if present, otherwise `None`.\n\nDOCS: https://spacy.io/api/tokenizer#find_suffix"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_20find_suffix = {"find_suffix", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_20find_suffix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_19find_suffix}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_20find_suffix(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_string = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("find_suffix (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_string,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 562, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 562, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "find_suffix", 0) < (0)) __PYX_ERR(0, 562, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("find_suffix", 1, 1, 1, i); __PYX_ERR(0, 562, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 562, __pyx_L3_error) + } + __pyx_v_string = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("find_suffix", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 562, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.find_suffix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_string), (&PyUnicode_Type), 1, "string", 1))) __PYX_ERR(0, 562, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_19find_suffix(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_string); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_19find_suffix(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_string) { + PyObject *__pyx_v_match = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("find_suffix", 0); + + /* "spacy/tokenizer.pyx":571 + * DOCS: https://spacy.io/api/tokenizer#find_suffix + * """ + * if self.suffix_search is None: # <<<<<<<<<<<<<< + * return 0 + * match = self.suffix_search(string) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_suffix_search); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__pyx_t_1 == Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":572 + * """ + * if self.suffix_search is None: + * return 0 # <<<<<<<<<<<<<< + * match = self.suffix_search(string) + * return (match.end() - match.start()) if match is not None else 0 +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_r = __pyx_mstate_global->__pyx_int_0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":571 + * DOCS: https://spacy.io/api/tokenizer#find_suffix + * """ + * if self.suffix_search is None: # <<<<<<<<<<<<<< + * return 0 + * match = self.suffix_search(string) +*/ + } + + /* "spacy/tokenizer.pyx":573 + * if self.suffix_search is None: + * return 0 + * match = self.suffix_search(string) # <<<<<<<<<<<<<< + * return (match.end() - match.start()) if match is not None else 0 + * +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_string}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_suffix_search, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_match = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":574 + * return 0 + * match = self.suffix_search(string) + * return (match.end() - match.start()) if match is not None else 0 # <<<<<<<<<<<<<< + * + * def _load_special_cases(self, special_cases): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = (__pyx_v_match != Py_None); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_end, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_6 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_start, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 574, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __pyx_t_6; + __pyx_t_6 = 0; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_1 = __pyx_mstate_global->__pyx_int_0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":562 + * return (match.end() - match.start()) if match is not None else 0 + * + * def find_suffix(self, str string): # <<<<<<<<<<<<<< + * """Find the length of a suffix that should be segmented from the + * string, or None if no suffix rules match. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.find_suffix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_match); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":576 + * return (match.end() - match.start()) if match is not None else 0 + * + * def _load_special_cases(self, special_cases): # <<<<<<<<<<<<<< + * """Add special-case tokenization rules.""" + * if special_cases is not None: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_22_load_special_cases(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_21_load_special_cases, "Tokenizer._load_special_cases(self, special_cases)\n\nAdd special-case tokenization rules."); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_22_load_special_cases = {"_load_special_cases", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_22_load_special_cases, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_21_load_special_cases}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_22_load_special_cases(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_special_cases = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_load_special_cases (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_special_cases,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 576, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 576, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_load_special_cases", 0) < (0)) __PYX_ERR(0, 576, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_load_special_cases", 1, 1, 1, i); __PYX_ERR(0, 576, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 576, __pyx_L3_error) + } + __pyx_v_special_cases = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_load_special_cases", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 576, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._load_special_cases", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_21_load_special_cases(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_special_cases); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_21_load_special_cases(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_special_cases) { + PyObject *__pyx_v_chunk = NULL; + PyObject *__pyx_v_substrings = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_load_special_cases", 0); + + /* "spacy/tokenizer.pyx":578 + * def _load_special_cases(self, special_cases): + * """Add special-case tokenization rules.""" + * if special_cases is not None: # <<<<<<<<<<<<<< + * for chunk, substrings in sorted(special_cases.items()): + * self.add_special_case(chunk, substrings) +*/ + __pyx_t_1 = (__pyx_v_special_cases != Py_None); + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":579 + * """Add special-case tokenization rules.""" + * if special_cases is not None: + * for chunk, substrings in sorted(special_cases.items()): # <<<<<<<<<<<<<< + * self.add_special_case(chunk, substrings) + * +*/ + __pyx_t_3 = __pyx_v_special_cases; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_3 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely((PyList_Sort(__pyx_t_3) < 0))) __PYX_ERR(0, 579, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 579, __pyx_L1_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 579, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_7); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); + index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 579, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 579, __pyx_L1_error) + __pyx_L7_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_chunk, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_substrings, __pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/tokenizer.pyx":580 + * if special_cases is not None: + * for chunk, substrings in sorted(special_cases.items()): + * self.add_special_case(chunk, substrings) # <<<<<<<<<<<<<< + * + * def _validate_special_case(self, chunk, substrings): +*/ + __pyx_t_7 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_chunk, __pyx_v_substrings}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add_special_case, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 580, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":579 + * """Add special-case tokenization rules.""" + * if special_cases is not None: + * for chunk, substrings in sorted(special_cases.items()): # <<<<<<<<<<<<<< + * self.add_special_case(chunk, substrings) + * +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":578 + * def _load_special_cases(self, special_cases): + * """Add special-case tokenization rules.""" + * if special_cases is not None: # <<<<<<<<<<<<<< + * for chunk, substrings in sorted(special_cases.items()): + * self.add_special_case(chunk, substrings) +*/ + } + + /* "spacy/tokenizer.pyx":576 + * return (match.end() - match.start()) if match is not None else 0 + * + * def _load_special_cases(self, special_cases): # <<<<<<<<<<<<<< + * """Add special-case tokenization rules.""" + * if special_cases is not None: +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._load_special_cases", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_chunk); + __Pyx_XDECREF(__pyx_v_substrings); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":582 + * self.add_special_case(chunk, substrings) + * + * def _validate_special_case(self, chunk, substrings): # <<<<<<<<<<<<<< + * """Check whether the `ORTH` fields match the string. Check that + * additional features beyond `ORTH` and `NORM` are not set by the +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_24_validate_special_case(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_23_validate_special_case, "Tokenizer._validate_special_case(self, chunk, substrings)\n\nCheck whether the `ORTH` fields match the string. Check that\nadditional features beyond `ORTH` and `NORM` are not set by the\nexception.\n\nchunk (str): The string to specially tokenize.\nsubstrings (iterable): A sequence of dicts, where each dict describes\n a token and its attributes."); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_24_validate_special_case = {"_validate_special_case", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_24_validate_special_case, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_23_validate_special_case}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_24_validate_special_case(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_chunk = 0; + PyObject *__pyx_v_substrings = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_validate_special_case (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_chunk,&__pyx_mstate_global->__pyx_n_u_substrings,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 582, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 582, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 582, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_validate_special_case", 0) < (0)) __PYX_ERR(0, 582, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_validate_special_case", 1, 2, 2, i); __PYX_ERR(0, 582, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 582, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 582, __pyx_L3_error) + } + __pyx_v_chunk = values[0]; + __pyx_v_substrings = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_validate_special_case", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 582, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._validate_special_case", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_23_validate_special_case(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_chunk, __pyx_v_substrings); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_23_validate_special_case(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_chunk, PyObject *__pyx_v_substrings) { + PyObject *__pyx_v_attrs = NULL; + PyObject *__pyx_v_orth = NULL; + PyObject *__pyx_v_substring = NULL; + PyObject *__pyx_v_attr = NULL; + PyObject *__pyx_v_spec = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_t_12; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_validate_special_case", 0); + + /* "spacy/tokenizer.pyx":591 + * a token and its attributes. + * """ + * attrs = [intify_attrs(spec, _do_deprecated=True) for spec in substrings] # <<<<<<<<<<<<<< + * orth = "".join([spec[ORTH] for spec in attrs]) + * if chunk != orth: +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_v_substrings)) || PyTuple_CheckExact(__pyx_v_substrings)) { + __pyx_t_2 = __pyx_v_substrings; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_substrings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 591, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 591, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 591, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 591, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 591, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_spec, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_6 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_intify_attrs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); + assert(__pyx_t_6); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_7, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, __pyx_v_spec}; + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_do_deprecated, Py_True, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 591, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_attrs = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":592 + * """ + * attrs = [intify_attrs(spec, _do_deprecated=True) for spec in substrings] + * orth = "".join([spec[ORTH] for spec in attrs]) # <<<<<<<<<<<<<< + * if chunk != orth: + * raise ValueError(Errors.E997.format(chunk=chunk, orth=orth, token_attrs=substrings)) +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_attrs; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 592, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_spec, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ORTH); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_spec, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_orth = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":593 + * attrs = [intify_attrs(spec, _do_deprecated=True) for spec in substrings] + * orth = "".join([spec[ORTH] for spec in attrs]) + * if chunk != orth: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E997.format(chunk=chunk, orth=orth, token_attrs=substrings)) + * for substring in attrs: +*/ + __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_v_chunk, __pyx_v_orth, Py_NE)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 593, __pyx_L1_error) + if (unlikely(__pyx_t_10)) { + + /* "spacy/tokenizer.pyx":594 + * orth = "".join([spec[ORTH] for spec in attrs]) + * if chunk != orth: + * raise ValueError(Errors.E997.format(chunk=chunk, orth=orth, token_attrs=substrings)) # <<<<<<<<<<<<<< + * for substring in attrs: + * for attr in substring: +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_E997); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_5 = __pyx_t_6; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_5, NULL}; + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_chunk, __pyx_v_chunk, __pyx_t_9, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 594, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_orth, __pyx_v_orth, __pyx_t_9, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 594, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_token_attrs, __pyx_v_substrings, __pyx_t_9, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 594, __pyx_L1_error) + __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_7}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 594, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":593 + * attrs = [intify_attrs(spec, _do_deprecated=True) for spec in substrings] + * orth = "".join([spec[ORTH] for spec in attrs]) + * if chunk != orth: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E997.format(chunk=chunk, orth=orth, token_attrs=substrings)) + * for substring in attrs: +*/ + } + + /* "spacy/tokenizer.pyx":595 + * if chunk != orth: + * raise ValueError(Errors.E997.format(chunk=chunk, orth=orth, token_attrs=substrings)) + * for substring in attrs: # <<<<<<<<<<<<<< + * for attr in substring: + * if attr not in (ORTH, NORM): +*/ + __pyx_t_2 = __pyx_v_attrs; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 595, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF_SET(__pyx_v_substring, __pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/tokenizer.pyx":596 + * raise ValueError(Errors.E997.format(chunk=chunk, orth=orth, token_attrs=substrings)) + * for substring in attrs: + * for attr in substring: # <<<<<<<<<<<<<< + * if attr not in (ORTH, NORM): + * raise ValueError(Errors.E1005.format(attr=self.vocab.strings[attr], chunk=chunk)) +*/ + if (likely(PyList_CheckExact(__pyx_v_substring)) || PyTuple_CheckExact(__pyx_v_substring)) { + __pyx_t_7 = __pyx_v_substring; __Pyx_INCREF(__pyx_t_7); + __pyx_t_11 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_substring); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 596, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 596, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 596, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_11)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_7); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 596, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_attr, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":597 + * for substring in attrs: + * for attr in substring: + * if attr not in (ORTH, NORM): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E1005.format(attr=self.vocab.strings[attr], chunk=chunk)) + * +*/ + __Pyx_INCREF(__pyx_v_attr); + __pyx_t_1 = __pyx_v_attr; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ORTH); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_12) { + } else { + __pyx_t_10 = __pyx_t_12; + goto __pyx_L15_bool_binop_done; + } + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_9, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_10 = __pyx_t_12; + __pyx_L15_bool_binop_done:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_12 = __pyx_t_10; + if (unlikely(__pyx_t_12)) { + + /* "spacy/tokenizer.pyx":598 + * for attr in substring: + * if attr not in (ORTH, NORM): + * raise ValueError(Errors.E1005.format(attr=self.vocab.strings[attr], chunk=chunk)) # <<<<<<<<<<<<<< + * + * def add_special_case(self, str string, substrings): +*/ + __pyx_t_6 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_E1005); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_5 = __pyx_t_14; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_13 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->vocab->strings), __pyx_v_attr); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_5, NULL}; + __pyx_t_15 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_attr, __pyx_t_13, __pyx_t_15, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 598, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_chunk, __pyx_v_chunk, __pyx_t_15, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 598, __pyx_L1_error) + __pyx_t_9 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_15); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + } + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_9}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 598, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":597 + * for substring in attrs: + * for attr in substring: + * if attr not in (ORTH, NORM): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E1005.format(attr=self.vocab.strings[attr], chunk=chunk)) + * +*/ + } + + /* "spacy/tokenizer.pyx":596 + * raise ValueError(Errors.E997.format(chunk=chunk, orth=orth, token_attrs=substrings)) + * for substring in attrs: + * for attr in substring: # <<<<<<<<<<<<<< + * if attr not in (ORTH, NORM): + * raise ValueError(Errors.E1005.format(attr=self.vocab.strings[attr], chunk=chunk)) +*/ + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/tokenizer.pyx":595 + * if chunk != orth: + * raise ValueError(Errors.E997.format(chunk=chunk, orth=orth, token_attrs=substrings)) + * for substring in attrs: # <<<<<<<<<<<<<< + * for attr in substring: + * if attr not in (ORTH, NORM): +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":582 + * self.add_special_case(chunk, substrings) + * + * def _validate_special_case(self, chunk, substrings): # <<<<<<<<<<<<<< + * """Check whether the `ORTH` fields match the string. Check that + * additional features beyond `ORTH` and `NORM` are not set by the +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._validate_special_case", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_attrs); + __Pyx_XDECREF(__pyx_v_orth); + __Pyx_XDECREF(__pyx_v_substring); + __Pyx_XDECREF(__pyx_v_attr); + __Pyx_XDECREF(__pyx_v_spec); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":600 + * raise ValueError(Errors.E1005.format(attr=self.vocab.strings[attr], chunk=chunk)) + * + * def add_special_case(self, str string, substrings): # <<<<<<<<<<<<<< + * """Add a special-case tokenization rule. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_26add_special_case(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_25add_special_case, "Tokenizer.add_special_case(self, str string, substrings)\n\nAdd a special-case tokenization rule.\n\nstring (str): The string to specially tokenize.\nsubstrings (iterable): A sequence of dicts, where each dict describes\n a token and its attributes. The `ORTH` fields of the attributes\n must exactly match the string when they are concatenated.\n\nDOCS: https://spacy.io/api/tokenizer#add_special_case"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_26add_special_case = {"add_special_case", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_26add_special_case, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_25add_special_case}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_26add_special_case(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_string = 0; + PyObject *__pyx_v_substrings = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_special_case (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_string,&__pyx_mstate_global->__pyx_n_u_substrings,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 600, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 600, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 600, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "add_special_case", 0) < (0)) __PYX_ERR(0, 600, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add_special_case", 1, 2, 2, i); __PYX_ERR(0, 600, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 600, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 600, __pyx_L3_error) + } + __pyx_v_string = ((PyObject*)values[0]); + __pyx_v_substrings = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_special_case", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 600, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.add_special_case", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_string), (&PyUnicode_Type), 1, "string", 1))) __PYX_ERR(0, 600, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_25add_special_case(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_string, __pyx_v_substrings); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_25add_special_case(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_string, PyObject *__pyx_v_substrings) { + struct __pyx_t_5spacy_5vocab__Cached *__pyx_v_cached; + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key; + struct __pyx_t_5spacy_5vocab__Cached *__pyx_v_stale_special; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + void *__pyx_t_4; + Py_ssize_t __pyx_t_5; + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_6; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("add_special_case", 0); + __Pyx_INCREF(__pyx_v_substrings); + + /* "spacy/tokenizer.pyx":610 + * DOCS: https://spacy.io/api/tokenizer#add_special_case + * """ + * self._validate_special_case(string, substrings) # <<<<<<<<<<<<<< + * substrings = list(substrings) + * cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_string, __pyx_v_substrings}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_validate_special_case, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":611 + * """ + * self._validate_special_case(string, substrings) + * substrings = list(substrings) # <<<<<<<<<<<<<< + * cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) + * cached.length = len(substrings) +*/ + __pyx_t_1 = PySequence_List(__pyx_v_substrings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_substrings, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":612 + * self._validate_special_case(string, substrings) + * substrings = list(substrings) + * cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) # <<<<<<<<<<<<<< + * cached.length = len(substrings) + * cached.is_lex = False +*/ + __pyx_t_4 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->alloc(__pyx_v_self->mem, 1, (sizeof(struct __pyx_t_5spacy_5vocab__Cached))); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(0, 612, __pyx_L1_error) + __pyx_v_cached = ((struct __pyx_t_5spacy_5vocab__Cached *)__pyx_t_4); + + /* "spacy/tokenizer.pyx":613 + * substrings = list(substrings) + * cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) + * cached.length = len(substrings) # <<<<<<<<<<<<<< + * cached.is_lex = False + * cached.data.tokens = self.vocab.make_fused_token(substrings) +*/ + __pyx_t_5 = PyObject_Length(__pyx_v_substrings); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 613, __pyx_L1_error) + __pyx_v_cached->length = __pyx_t_5; + + /* "spacy/tokenizer.pyx":614 + * cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) + * cached.length = len(substrings) + * cached.is_lex = False # <<<<<<<<<<<<<< + * cached.data.tokens = self.vocab.make_fused_token(substrings) + * key = hash_string(string) +*/ + __pyx_v_cached->is_lex = 0; + + /* "spacy/tokenizer.pyx":615 + * cached.length = len(substrings) + * cached.is_lex = False + * cached.data.tokens = self.vocab.make_fused_token(substrings) # <<<<<<<<<<<<<< + * key = hash_string(string) + * stale_special = <_Cached*>self._specials.get(key) +*/ + __pyx_t_6 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->vocab->__pyx_vtab)->make_fused_token(__pyx_v_self->vocab, __pyx_v_substrings); if (unlikely(__pyx_t_6 == ((void *)NULL))) __PYX_ERR(0, 615, __pyx_L1_error) + __pyx_v_cached->data.tokens = __pyx_t_6; + + /* "spacy/tokenizer.pyx":616 + * cached.is_lex = False + * cached.data.tokens = self.vocab.make_fused_token(substrings) + * key = hash_string(string) # <<<<<<<<<<<<<< + * stale_special = <_Cached*>self._specials.get(key) + * self._specials.set(key, cached) +*/ + __pyx_t_7 = __pyx_f_5spacy_7strings_hash_string(__pyx_v_string, 0); if (unlikely(__pyx_t_7 == ((__pyx_t_5spacy_8typedefs_hash_t)0))) __PYX_ERR(0, 616, __pyx_L1_error) + __pyx_v_key = __pyx_t_7; + + /* "spacy/tokenizer.pyx":617 + * cached.data.tokens = self.vocab.make_fused_token(substrings) + * key = hash_string(string) + * stale_special = <_Cached*>self._specials.get(key) # <<<<<<<<<<<<<< + * self._specials.set(key, cached) + * if stale_special is not NULL: +*/ + __pyx_t_4 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_specials->__pyx_vtab)->get(__pyx_v_self->_specials, __pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 617, __pyx_L1_error) + __pyx_v_stale_special = ((struct __pyx_t_5spacy_5vocab__Cached *)__pyx_t_4); + + /* "spacy/tokenizer.pyx":618 + * key = hash_string(string) + * stale_special = <_Cached*>self._specials.get(key) + * self._specials.set(key, cached) # <<<<<<<<<<<<<< + * if stale_special is not NULL: + * self.mem.free(stale_special) +*/ + ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_specials->__pyx_vtab)->set(__pyx_v_self->_specials, __pyx_v_key, __pyx_v_cached); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 618, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":619 + * stale_special = <_Cached*>self._specials.get(key) + * self._specials.set(key, cached) + * if stale_special is not NULL: # <<<<<<<<<<<<<< + * self.mem.free(stale_special) + * self._rules[string] = substrings +*/ + __pyx_t_8 = (__pyx_v_stale_special != NULL); + if (__pyx_t_8) { + + /* "spacy/tokenizer.pyx":620 + * self._specials.set(key, cached) + * if stale_special is not NULL: + * self.mem.free(stale_special) # <<<<<<<<<<<<<< + * self._rules[string] = substrings + * self._flush_cache() +*/ + ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->free(__pyx_v_self->mem, __pyx_v_stale_special); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 620, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":619 + * stale_special = <_Cached*>self._specials.get(key) + * self._specials.set(key, cached) + * if stale_special is not NULL: # <<<<<<<<<<<<<< + * self.mem.free(stale_special) + * self._rules[string] = substrings +*/ + } + + /* "spacy/tokenizer.pyx":621 + * if stale_special is not NULL: + * self.mem.free(stale_special) + * self._rules[string] = substrings # <<<<<<<<<<<<<< + * self._flush_cache() + * if not self.faster_heuristics or self.find_prefix(string) or self.find_infix(string) or self.find_suffix(string) or " " in string: +*/ + if (unlikely((PyObject_SetItem(__pyx_v_self->_rules, __pyx_v_string, __pyx_v_substrings) < 0))) __PYX_ERR(0, 621, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":622 + * self.mem.free(stale_special) + * self._rules[string] = substrings + * self._flush_cache() # <<<<<<<<<<<<<< + * if not self.faster_heuristics or self.find_prefix(string) or self.find_infix(string) or self.find_suffix(string) or " " in string: + * self._special_matcher.add(string, None, self._tokenize_affixes(string, False)) +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_flush_cache, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":623 + * self._rules[string] = substrings + * self._flush_cache() + * if not self.faster_heuristics or self.find_prefix(string) or self.find_infix(string) or self.find_suffix(string) or " " in string: # <<<<<<<<<<<<<< + * self._special_matcher.add(string, None, self._tokenize_affixes(string, False)) + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_faster_heuristics); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = (!__pyx_t_9); + if (!__pyx_t_10) { + } else { + __pyx_t_8 = __pyx_t_10; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_string}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_find_prefix, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_10) { + } else { + __pyx_t_8 = __pyx_t_10; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_string}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_find_infix, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_10) { + } else { + __pyx_t_8 = __pyx_t_10; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_string}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_find_suffix, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_10) { + } else { + __pyx_t_8 = __pyx_t_10; + goto __pyx_L5_bool_binop_done; + } + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 623, __pyx_L1_error) + } + __pyx_t_10 = (__Pyx_PyUnicode_ContainsTF(__pyx_mstate_global->__pyx_kp_u__7, __pyx_v_string, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 623, __pyx_L1_error) + __pyx_t_8 = __pyx_t_10; + __pyx_L5_bool_binop_done:; + if (__pyx_t_8) { + + /* "spacy/tokenizer.pyx":624 + * self._flush_cache() + * if not self.faster_heuristics or self.find_prefix(string) or self.find_infix(string) or self.find_suffix(string) or " " in string: + * self._special_matcher.add(string, None, self._tokenize_affixes(string, False)) # <<<<<<<<<<<<<< + * + * def _reload_special_cases(self): +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self->_special_matcher); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_11 = ((PyObject *)((struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer *)__pyx_v_self->__pyx_vtab)->_tokenize_affixes(__pyx_v_self, __pyx_v_string, 0)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_string, Py_None, __pyx_t_11}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":623 + * self._rules[string] = substrings + * self._flush_cache() + * if not self.faster_heuristics or self.find_prefix(string) or self.find_infix(string) or self.find_suffix(string) or " " in string: # <<<<<<<<<<<<<< + * self._special_matcher.add(string, None, self._tokenize_affixes(string, False)) + * +*/ + } + + /* "spacy/tokenizer.pyx":600 + * raise ValueError(Errors.E1005.format(attr=self.vocab.strings[attr], chunk=chunk)) + * + * def add_special_case(self, str string, substrings): # <<<<<<<<<<<<<< + * """Add a special-case tokenization rule. + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.add_special_case", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_substrings); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":626 + * self._special_matcher.add(string, None, self._tokenize_affixes(string, False)) + * + * def _reload_special_cases(self): # <<<<<<<<<<<<<< + * self._flush_cache() + * self._flush_specials() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_28_reload_special_cases(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_27_reload_special_cases, "Tokenizer._reload_special_cases(self)"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_28_reload_special_cases = {"_reload_special_cases", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_28_reload_special_cases, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_27_reload_special_cases}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_28_reload_special_cases(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_reload_special_cases (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_reload_special_cases", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_reload_special_cases", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_27_reload_special_cases(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_27_reload_special_cases(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_reload_special_cases", 0); + + /* "spacy/tokenizer.pyx":627 + * + * def _reload_special_cases(self): + * self._flush_cache() # <<<<<<<<<<<<<< + * self._flush_specials() + * self._load_special_cases(self._rules) +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_flush_cache, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":628 + * def _reload_special_cases(self): + * self._flush_cache() + * self._flush_specials() # <<<<<<<<<<<<<< + * self._load_special_cases(self._rules) + * +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_flush_specials, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":629 + * self._flush_cache() + * self._flush_specials() + * self._load_special_cases(self._rules) # <<<<<<<<<<<<<< + * + * def explain(self, text): +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_self->_rules}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_load_special_cases, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":626 + * self._special_matcher.add(string, None, self._tokenize_affixes(string, False)) + * + * def _reload_special_cases(self): # <<<<<<<<<<<<<< + * self._flush_cache() + * self._flush_specials() +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer._reload_special_cases", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":631 + * self._load_special_cases(self._rules) + * + * def explain(self, text): # <<<<<<<<<<<<<< + * """A debugging tokenizer that provides information about which + * tokenizer rule or pattern was matched for each token. The tokens +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_30explain(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_29explain, "Tokenizer.explain(self, text)\n\nA debugging tokenizer that provides information about which\ntokenizer rule or pattern was matched for each token. The tokens\nproduced are identical to `nlp.tokenizer()` except for whitespace\ntokens.\n\nstring (str): The string to tokenize.\nRETURNS (list): A list of (pattern_string, token_string) tuples\n\nDOCS: https://spacy.io/api/tokenizer#explain"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_30explain = {"explain", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_30explain, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_29explain}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_30explain(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_text = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("explain (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_text,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 631, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 631, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "explain", 0) < (0)) __PYX_ERR(0, 631, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("explain", 1, 1, 1, i); __PYX_ERR(0, 631, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 631, __pyx_L3_error) + } + __pyx_v_text = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("explain", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 631, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.explain", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_29explain(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_text); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/tokenizer.pyx":665 + * while substring: + * if substring in special_cases: + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) # <<<<<<<<<<<<<< + * substring = '' + * continue +*/ + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_7explain_genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_2_genexpr(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 665, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *) __pyx_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0; + __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_2generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_explain_locals_genexpr, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer); if (unlikely(!gen)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.explain.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("genexpr", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 665, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_1 = __pyx_mstate_global->__pyx_int_0; + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 665, __pyx_L1_error) } + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) { + __pyx_t_2 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 665, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 665, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 665, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 665, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 665, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_cur_scope->__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_SPECIAL, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 665, __pyx_L1_error) } + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ORTH); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_e, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->vocab->strings), __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 665, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 665, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __pyx_cur_scope->__pyx_t_3 = __pyx_t_4; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + __pyx_t_4 = __pyx_cur_scope->__pyx_t_3; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 665, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_5generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/tokenizer.pyx":674 + * break + * if substring in special_cases: + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) # <<<<<<<<<<<<<< + * substring = '' + * break +*/ + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_7explain_3genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_3_genexpr(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 674, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *) __pyx_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0; + __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_5generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_explain_locals_genexpr, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer); if (unlikely(!gen)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.explain.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_5generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("genexpr", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 674, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_1 = __pyx_mstate_global->__pyx_int_0; + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 674, __pyx_L1_error) } + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) { + __pyx_t_2 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 674, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 674, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 674, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 674, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 674, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_cur_scope->__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_SPECIAL, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 674, __pyx_L1_error) } + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ORTH); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_e, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->vocab->strings), __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 674, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 674, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __pyx_cur_scope->__pyx_t_3 = __pyx_t_4; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + __pyx_t_4 = __pyx_cur_scope->__pyx_t_3; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 674, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_8generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/tokenizer.pyx":702 + * substring = '' + * elif substring in special_cases: + * tokens.extend((f"SPECIAL-{i + 1}", self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) # <<<<<<<<<<<<<< + * substring = '' + * elif list(infix_finditer(substring)): +*/ + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_7explain_6genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_4_genexpr(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 702, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *) __pyx_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope); + __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0; + __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_8generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_explain_locals_genexpr, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer); if (unlikely(!gen)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.explain.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_8generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("genexpr", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 702, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_1 = __pyx_mstate_global->__pyx_int_0; + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 702, __pyx_L1_error) } + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) { + __pyx_t_2 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 702, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 702, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 702, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 702, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 702, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_cur_scope->__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_SPECIAL, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 702, __pyx_L1_error) } + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ORTH); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_e, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->vocab->strings), __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 702, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 702, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __pyx_cur_scope->__pyx_t_3 = __pyx_t_4; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + __pyx_t_4 = __pyx_cur_scope->__pyx_t_3; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 702, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":631 + * self._load_special_cases(self._rules) + * + * def explain(self, text): # <<<<<<<<<<<<<< + * """A debugging tokenizer that provides information about which + * tokenizer rule or pattern was matched for each token. The tokens +*/ + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_29explain(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_text) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *__pyx_cur_scope; + PyObject *__pyx_v_prefix_search = NULL; + PyObject *__pyx_v_suffix_search = NULL; + PyObject *__pyx_v_infix_finditer = NULL; + PyObject *__pyx_v_token_match = NULL; + PyObject *__pyx_v_url_match = NULL; + PyObject *__pyx_v_special_cases = NULL; + PyObject *__pyx_v_orth = NULL; + PyObject *__pyx_v_special_tokens = NULL; + PyObject *__pyx_v_tokens = NULL; + PyObject *__pyx_v_substring = NULL; + PyObject *__pyx_v_suffixes = NULL; + PyObject *__pyx_v_split = NULL; + PyObject *__pyx_v_infixes = NULL; + PyObject *__pyx_v_offset = NULL; + PyObject *__pyx_v_match = NULL; + PyObject *__pyx_v_words = NULL; + PyObject *__pyx_v_spaces = NULL; + PyObject *__pyx_v_t_words = NULL; + PyObject *__pyx_v_t_spaces = NULL; + PyObject *__pyx_v_word = NULL; + PyObject *__pyx_v_space = NULL; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc = NULL; + PyObject *__pyx_v_matches = NULL; + PyObject *__pyx_v_spans = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_final_tokens = NULL; + PyObject *__pyx_v_spans_by_start = NULL; + PyObject *__pyx_v_span = NULL; + PyObject *__pyx_v_exc = NULL; + PyObject *__pyx_v_j = NULL; + PyObject *__pyx_v_special_token = NULL; + PyObject *__pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_2generator1 = 0; + PyObject *__pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_5generator2 = 0; + PyObject *__pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_8generator3 = 0; + PyObject *__pyx_v_t = NULL; + PyObject *__pyx_v_m_id = NULL; + PyObject *__pyx_v_s = NULL; + PyObject *__pyx_v_e = NULL; + PyObject *__pyx_8genexpr3__pyx_v_s = NULL; + PyObject *__pyx_v_d = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + PyObject *(*__pyx_t_10)(PyObject *); + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("explain", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_1_explain(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 631, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + + /* "spacy/tokenizer.pyx":642 + * DOCS: https://spacy.io/api/tokenizer#explain + * """ + * prefix_search = self.prefix_search # <<<<<<<<<<<<<< + * if prefix_search is None: + * prefix_search = re.compile("a^").search +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_prefix_search); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_prefix_search = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":643 + * """ + * prefix_search = self.prefix_search + * if prefix_search is None: # <<<<<<<<<<<<<< + * prefix_search = re.compile("a^").search + * suffix_search = self.suffix_search +*/ + __pyx_t_2 = (__pyx_v_prefix_search == Py_None); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":644 + * prefix_search = self.prefix_search + * if prefix_search is None: + * prefix_search = re.compile("a^").search # <<<<<<<<<<<<<< + * suffix_search = self.suffix_search + * if suffix_search is None: +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_re); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_compile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_a}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_search); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_prefix_search, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/tokenizer.pyx":643 + * """ + * prefix_search = self.prefix_search + * if prefix_search is None: # <<<<<<<<<<<<<< + * prefix_search = re.compile("a^").search + * suffix_search = self.suffix_search +*/ + } + + /* "spacy/tokenizer.pyx":645 + * if prefix_search is None: + * prefix_search = re.compile("a^").search + * suffix_search = self.suffix_search # <<<<<<<<<<<<<< + * if suffix_search is None: + * suffix_search = re.compile("a^").search +*/ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_suffix_search); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_suffix_search = __pyx_t_5; + __pyx_t_5 = 0; + + /* "spacy/tokenizer.pyx":646 + * prefix_search = re.compile("a^").search + * suffix_search = self.suffix_search + * if suffix_search is None: # <<<<<<<<<<<<<< + * suffix_search = re.compile("a^").search + * infix_finditer = self.infix_finditer +*/ + __pyx_t_2 = (__pyx_v_suffix_search == Py_None); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":647 + * suffix_search = self.suffix_search + * if suffix_search is None: + * suffix_search = re.compile("a^").search # <<<<<<<<<<<<<< + * infix_finditer = self.infix_finditer + * if infix_finditer is None: +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_re); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_compile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_a}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_search); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF_SET(__pyx_v_suffix_search, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":646 + * prefix_search = re.compile("a^").search + * suffix_search = self.suffix_search + * if suffix_search is None: # <<<<<<<<<<<<<< + * suffix_search = re.compile("a^").search + * infix_finditer = self.infix_finditer +*/ + } + + /* "spacy/tokenizer.pyx":648 + * if suffix_search is None: + * suffix_search = re.compile("a^").search + * infix_finditer = self.infix_finditer # <<<<<<<<<<<<<< + * if infix_finditer is None: + * infix_finditer = re.compile("a^").finditer +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_infix_finditer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_infix_finditer = __pyx_t_4; + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":649 + * suffix_search = re.compile("a^").search + * infix_finditer = self.infix_finditer + * if infix_finditer is None: # <<<<<<<<<<<<<< + * infix_finditer = re.compile("a^").finditer + * token_match = self.token_match +*/ + __pyx_t_2 = (__pyx_v_infix_finditer == Py_None); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":650 + * infix_finditer = self.infix_finditer + * if infix_finditer is None: + * infix_finditer = re.compile("a^").finditer # <<<<<<<<<<<<<< + * token_match = self.token_match + * if token_match is None: +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_re); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 650, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_compile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 650, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_a}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 650, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_finditer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 650, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_infix_finditer, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":649 + * suffix_search = re.compile("a^").search + * infix_finditer = self.infix_finditer + * if infix_finditer is None: # <<<<<<<<<<<<<< + * infix_finditer = re.compile("a^").finditer + * token_match = self.token_match +*/ + } + + /* "spacy/tokenizer.pyx":651 + * if infix_finditer is None: + * infix_finditer = re.compile("a^").finditer + * token_match = self.token_match # <<<<<<<<<<<<<< + * if token_match is None: + * token_match = re.compile("a^").match +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_token_match); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 651, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_token_match = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":652 + * infix_finditer = re.compile("a^").finditer + * token_match = self.token_match + * if token_match is None: # <<<<<<<<<<<<<< + * token_match = re.compile("a^").match + * url_match = self.url_match +*/ + __pyx_t_2 = (__pyx_v_token_match == Py_None); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":653 + * token_match = self.token_match + * if token_match is None: + * token_match = re.compile("a^").match # <<<<<<<<<<<<<< + * url_match = self.url_match + * if url_match is None: +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_re); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 653, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_compile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_a}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 653, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_match); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_token_match, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":652 + * infix_finditer = re.compile("a^").finditer + * token_match = self.token_match + * if token_match is None: # <<<<<<<<<<<<<< + * token_match = re.compile("a^").match + * url_match = self.url_match +*/ + } + + /* "spacy/tokenizer.pyx":654 + * if token_match is None: + * token_match = re.compile("a^").match + * url_match = self.url_match # <<<<<<<<<<<<<< + * if url_match is None: + * url_match = re.compile("a^").match +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_url_match); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_url_match = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":655 + * token_match = re.compile("a^").match + * url_match = self.url_match + * if url_match is None: # <<<<<<<<<<<<<< + * url_match = re.compile("a^").match + * special_cases = {} +*/ + __pyx_t_2 = (__pyx_v_url_match == Py_None); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":656 + * url_match = self.url_match + * if url_match is None: + * url_match = re.compile("a^").match # <<<<<<<<<<<<<< + * special_cases = {} + * for orth, special_tokens in self.rules.items(): +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_re); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_compile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_a}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_match); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_url_match, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/tokenizer.pyx":655 + * token_match = re.compile("a^").match + * url_match = self.url_match + * if url_match is None: # <<<<<<<<<<<<<< + * url_match = re.compile("a^").match + * special_cases = {} +*/ + } + + /* "spacy/tokenizer.pyx":657 + * if url_match is None: + * url_match = re.compile("a^").match + * special_cases = {} # <<<<<<<<<<<<<< + * for orth, special_tokens in self.rules.items(): + * special_cases[orth] = [intify_attrs(special_token, strings_map=self.vocab.strings, _do_deprecated=True) for special_token in special_tokens] +*/ + __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 657, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_special_cases = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/tokenizer.pyx":658 + * url_match = re.compile("a^").match + * special_cases = {} + * for orth, special_tokens in self.rules.items(): # <<<<<<<<<<<<<< + * special_cases[orth] = [intify_attrs(special_token, strings_map=self.vocab.strings, _do_deprecated=True) for special_token in special_tokens] + * tokens = [] +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_rules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_3 = __pyx_t_5; __Pyx_INCREF(__pyx_t_3); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 658, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 658, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 658, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 658, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_8(__pyx_t_3); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 658, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 658, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_4); + } + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); + index = 0; __pyx_t_1 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_1); + index = 1; __pyx_t_4 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_4)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < (0)) __PYX_ERR(0, 658, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L11_unpacking_done; + __pyx_L10_unpacking_failed:; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 658, __pyx_L1_error) + __pyx_L11_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_orth, __pyx_t_1); + __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_special_tokens, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":659 + * special_cases = {} + * for orth, special_tokens in self.rules.items(): + * special_cases[orth] = [intify_attrs(special_token, strings_map=self.vocab.strings, _do_deprecated=True) for special_token in special_tokens] # <<<<<<<<<<<<<< + * tokens = [] + * for substring in text.split(): +*/ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (likely(PyList_CheckExact(__pyx_v_special_tokens)) || PyTuple_CheckExact(__pyx_v_special_tokens)) { + __pyx_t_4 = __pyx_v_special_tokens; __Pyx_INCREF(__pyx_t_4); + __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_special_tokens); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 659, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 659, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 659, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_11)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_12(__pyx_t_4); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 659, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_special_token, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_9 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_intify_attrs); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_13); + assert(__pyx_t_9); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_13, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_9, __pyx_v_special_token}; + __pyx_t_14 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_strings_map, ((PyObject *)__pyx_cur_scope->__pyx_v_self->vocab->strings), __pyx_t_14, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 659, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_do_deprecated, Py_True, __pyx_t_14, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 659, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_14); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely((PyDict_SetItem(__pyx_v_special_cases, __pyx_v_orth, __pyx_t_5) < 0))) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/tokenizer.pyx":658 + * url_match = re.compile("a^").match + * special_cases = {} + * for orth, special_tokens in self.rules.items(): # <<<<<<<<<<<<<< + * special_cases[orth] = [intify_attrs(special_token, strings_map=self.vocab.strings, _do_deprecated=True) for special_token in special_tokens] + * tokens = [] +*/ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":660 + * for orth, special_tokens in self.rules.items(): + * special_cases[orth] = [intify_attrs(special_token, strings_map=self.vocab.strings, _do_deprecated=True) for special_token in special_tokens] + * tokens = [] # <<<<<<<<<<<<<< + * for substring in text.split(): + * suffixes = [] +*/ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 660, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_tokens = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":661 + * special_cases[orth] = [intify_attrs(special_token, strings_map=self.vocab.strings, _do_deprecated=True) for special_token in special_tokens] + * tokens = [] + * for substring in text.split(): # <<<<<<<<<<<<<< + * suffixes = [] + * while substring: +*/ + __pyx_t_5 = __pyx_v_text; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_split, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 661, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 661, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 661, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 661, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error) + } else { + __pyx_t_3 = __pyx_t_8(__pyx_t_5); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 661, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_substring, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":662 + * tokens = [] + * for substring in text.split(): + * suffixes = [] # <<<<<<<<<<<<<< + * while substring: + * if substring in special_cases: +*/ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_suffixes, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":663 + * for substring in text.split(): + * suffixes = [] + * while substring: # <<<<<<<<<<<<<< + * if substring in special_cases: + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) +*/ + while (1) { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_substring); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 663, __pyx_L1_error) + if (!__pyx_t_2) break; + + /* "spacy/tokenizer.pyx":664 + * suffixes = [] + * while substring: + * if substring in special_cases: # <<<<<<<<<<<<<< + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' +*/ + __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_substring, __pyx_v_special_cases, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 664, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":665 + * while substring: + * if substring in special_cases: + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) # <<<<<<<<<<<<<< + * substring = '' + * continue +*/ + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_special_cases, __pyx_v_substring); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __pyx_pf_5spacy_9tokenizer_9Tokenizer_7explain_genexpr(((PyObject*)__pyx_cur_scope), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_tokens, __pyx_t_4); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 665, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":666 + * if substring in special_cases: + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' # <<<<<<<<<<<<<< + * continue + * while prefix_search(substring) or suffix_search(substring): +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__6); + __Pyx_DECREF_SET(__pyx_v_substring, __pyx_mstate_global->__pyx_kp_u__6); + + /* "spacy/tokenizer.pyx":667 + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' + * continue # <<<<<<<<<<<<<< + * while prefix_search(substring) or suffix_search(substring): + * if token_match(substring): +*/ + goto __pyx_L18_continue; + + /* "spacy/tokenizer.pyx":664 + * suffixes = [] + * while substring: + * if substring in special_cases: # <<<<<<<<<<<<<< + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' +*/ + } + + /* "spacy/tokenizer.pyx":668 + * substring = '' + * continue + * while prefix_search(substring) or suffix_search(substring): # <<<<<<<<<<<<<< + * if token_match(substring): + * tokens.append(("TOKEN_MATCH", substring)) +*/ + while (1) { + __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_prefix_search); + __pyx_t_1 = __pyx_v_prefix_search; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_substring}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_16) { + } else { + __pyx_t_2 = __pyx_t_16; + goto __pyx_L23_bool_binop_done; + } + __pyx_t_1 = NULL; + __Pyx_INCREF(__pyx_v_suffix_search); + __pyx_t_3 = __pyx_v_suffix_search; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_substring}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __pyx_t_16; + __pyx_L23_bool_binop_done:; + if (!__pyx_t_2) break; + + /* "spacy/tokenizer.pyx":669 + * continue + * while prefix_search(substring) or suffix_search(substring): + * if token_match(substring): # <<<<<<<<<<<<<< + * tokens.append(("TOKEN_MATCH", substring)) + * substring = '' +*/ + __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_token_match); + __pyx_t_1 = __pyx_v_token_match; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_substring}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 669, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":670 + * while prefix_search(substring) or suffix_search(substring): + * if token_match(substring): + * tokens.append(("TOKEN_MATCH", substring)) # <<<<<<<<<<<<<< + * substring = '' + * break +*/ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 670, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_TOKEN_MATCH); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_TOKEN_MATCH); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_TOKEN_MATCH) != (0)) __PYX_ERR(0, 670, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_substring); + __Pyx_GIVEREF(__pyx_v_substring); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_substring) != (0)) __PYX_ERR(0, 670, __pyx_L1_error); + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_tokens, __pyx_t_4); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 670, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":671 + * if token_match(substring): + * tokens.append(("TOKEN_MATCH", substring)) + * substring = '' # <<<<<<<<<<<<<< + * break + * if substring in special_cases: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__6); + __Pyx_DECREF_SET(__pyx_v_substring, __pyx_mstate_global->__pyx_kp_u__6); + + /* "spacy/tokenizer.pyx":672 + * tokens.append(("TOKEN_MATCH", substring)) + * substring = '' + * break # <<<<<<<<<<<<<< + * if substring in special_cases: + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) +*/ + goto __pyx_L22_break; + + /* "spacy/tokenizer.pyx":669 + * continue + * while prefix_search(substring) or suffix_search(substring): + * if token_match(substring): # <<<<<<<<<<<<<< + * tokens.append(("TOKEN_MATCH", substring)) + * substring = '' +*/ + } + + /* "spacy/tokenizer.pyx":673 + * substring = '' + * break + * if substring in special_cases: # <<<<<<<<<<<<<< + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' +*/ + __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_substring, __pyx_v_special_cases, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 673, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":674 + * break + * if substring in special_cases: + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) # <<<<<<<<<<<<<< + * substring = '' + * break +*/ + __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_special_cases, __pyx_v_substring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __pyx_pf_5spacy_9tokenizer_9Tokenizer_7explain_3genexpr(((PyObject*)__pyx_cur_scope), __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_tokens, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":675 + * if substring in special_cases: + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' # <<<<<<<<<<<<<< + * break + * if prefix_search(substring): +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__6); + __Pyx_DECREF_SET(__pyx_v_substring, __pyx_mstate_global->__pyx_kp_u__6); + + /* "spacy/tokenizer.pyx":676 + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' + * break # <<<<<<<<<<<<<< + * if prefix_search(substring): + * split = prefix_search(substring).end() +*/ + goto __pyx_L22_break; + + /* "spacy/tokenizer.pyx":673 + * substring = '' + * break + * if substring in special_cases: # <<<<<<<<<<<<<< + * tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' +*/ + } + + /* "spacy/tokenizer.pyx":677 + * substring = '' + * break + * if prefix_search(substring): # <<<<<<<<<<<<<< + * split = prefix_search(substring).end() + * # break if pattern matches the empty string +*/ + __pyx_t_4 = NULL; + __Pyx_INCREF(__pyx_v_prefix_search); + __pyx_t_3 = __pyx_v_prefix_search; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_substring}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":678 + * break + * if prefix_search(substring): + * split = prefix_search(substring).end() # <<<<<<<<<<<<<< + * # break if pattern matches the empty string + * if split == 0: +*/ + __pyx_t_13 = NULL; + __Pyx_INCREF(__pyx_v_prefix_search); + __pyx_t_14 = __pyx_v_prefix_search; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_14))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14); + assert(__pyx_t_13); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_14, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_v_substring}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_3 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_end, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_split, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":680 + * split = prefix_search(substring).end() + * # break if pattern matches the empty string + * if split == 0: # <<<<<<<<<<<<<< + * break + * tokens.append(("PREFIX", substring[:split])) +*/ + __pyx_t_2 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_split, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 680, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":681 + * # break if pattern matches the empty string + * if split == 0: + * break # <<<<<<<<<<<<<< + * tokens.append(("PREFIX", substring[:split])) + * substring = substring[split:] +*/ + goto __pyx_L22_break; + + /* "spacy/tokenizer.pyx":680 + * split = prefix_search(substring).end() + * # break if pattern matches the empty string + * if split == 0: # <<<<<<<<<<<<<< + * break + * tokens.append(("PREFIX", substring[:split])) +*/ + } + + /* "spacy/tokenizer.pyx":682 + * if split == 0: + * break + * tokens.append(("PREFIX", substring[:split])) # <<<<<<<<<<<<<< + * substring = substring[split:] + * if substring in special_cases: +*/ + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_substring, 0, 0, NULL, &__pyx_v_split, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PREFIX); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PREFIX); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_PREFIX) != (0)) __PYX_ERR(0, 682, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 682, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_tokens, __pyx_t_4); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":683 + * break + * tokens.append(("PREFIX", substring[:split])) + * substring = substring[split:] # <<<<<<<<<<<<<< + * if substring in special_cases: + * continue +*/ + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_substring, 0, 0, &__pyx_v_split, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_substring, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":684 + * tokens.append(("PREFIX", substring[:split])) + * substring = substring[split:] + * if substring in special_cases: # <<<<<<<<<<<<<< + * continue + * if suffix_search(substring): +*/ + __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_substring, __pyx_v_special_cases, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 684, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":685 + * substring = substring[split:] + * if substring in special_cases: + * continue # <<<<<<<<<<<<<< + * if suffix_search(substring): + * split = suffix_search(substring).start() +*/ + goto __pyx_L21_continue; + + /* "spacy/tokenizer.pyx":684 + * tokens.append(("PREFIX", substring[:split])) + * substring = substring[split:] + * if substring in special_cases: # <<<<<<<<<<<<<< + * continue + * if suffix_search(substring): +*/ + } + + /* "spacy/tokenizer.pyx":677 + * substring = '' + * break + * if prefix_search(substring): # <<<<<<<<<<<<<< + * split = prefix_search(substring).end() + * # break if pattern matches the empty string +*/ + } + + /* "spacy/tokenizer.pyx":686 + * if substring in special_cases: + * continue + * if suffix_search(substring): # <<<<<<<<<<<<<< + * split = suffix_search(substring).start() + * # break if pattern matches the empty string +*/ + __pyx_t_1 = NULL; + __Pyx_INCREF(__pyx_v_suffix_search); + __pyx_t_3 = __pyx_v_suffix_search; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_substring}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 686, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 686, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":687 + * continue + * if suffix_search(substring): + * split = suffix_search(substring).start() # <<<<<<<<<<<<<< + * # break if pattern matches the empty string + * if split == len(substring): +*/ + __pyx_t_14 = NULL; + __Pyx_INCREF(__pyx_v_suffix_search); + __pyx_t_13 = __pyx_v_suffix_search; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13); + assert(__pyx_t_14); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_13, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_v_substring}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = __pyx_t_1; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_start, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_split, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":689 + * split = suffix_search(substring).start() + * # break if pattern matches the empty string + * if split == len(substring): # <<<<<<<<<<<<<< + * break + * suffixes.append(("SUFFIX", substring[split:])) +*/ + __pyx_t_11 = PyObject_Length(__pyx_v_substring); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 689, __pyx_L1_error) + __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_split, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":690 + * # break if pattern matches the empty string + * if split == len(substring): + * break # <<<<<<<<<<<<<< + * suffixes.append(("SUFFIX", substring[split:])) + * substring = substring[:split] +*/ + goto __pyx_L22_break; + + /* "spacy/tokenizer.pyx":689 + * split = suffix_search(substring).start() + * # break if pattern matches the empty string + * if split == len(substring): # <<<<<<<<<<<<<< + * break + * suffixes.append(("SUFFIX", substring[split:])) +*/ + } + + /* "spacy/tokenizer.pyx":691 + * if split == len(substring): + * break + * suffixes.append(("SUFFIX", substring[split:])) # <<<<<<<<<<<<<< + * substring = substring[:split] + * if len(substring) == 0: +*/ + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_substring, 0, 0, &__pyx_v_split, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 691, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_SUFFIX); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_SUFFIX); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_SUFFIX) != (0)) __PYX_ERR(0, 691, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 691, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_suffixes, __pyx_t_4); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 691, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":692 + * break + * suffixes.append(("SUFFIX", substring[split:])) + * substring = substring[:split] # <<<<<<<<<<<<<< + * if len(substring) == 0: + * continue +*/ + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_substring, 0, 0, NULL, &__pyx_v_split, NULL, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_substring, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":686 + * if substring in special_cases: + * continue + * if suffix_search(substring): # <<<<<<<<<<<<<< + * split = suffix_search(substring).start() + * # break if pattern matches the empty string +*/ + } + __pyx_L21_continue:; + } + __pyx_L22_break:; + + /* "spacy/tokenizer.pyx":693 + * suffixes.append(("SUFFIX", substring[split:])) + * substring = substring[:split] + * if len(substring) == 0: # <<<<<<<<<<<<<< + * continue + * if token_match(substring): +*/ + __pyx_t_11 = PyObject_Length(__pyx_v_substring); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 693, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_11 == 0); + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":694 + * substring = substring[:split] + * if len(substring) == 0: + * continue # <<<<<<<<<<<<<< + * if token_match(substring): + * tokens.append(("TOKEN_MATCH", substring)) +*/ + goto __pyx_L18_continue; + + /* "spacy/tokenizer.pyx":693 + * suffixes.append(("SUFFIX", substring[split:])) + * substring = substring[:split] + * if len(substring) == 0: # <<<<<<<<<<<<<< + * continue + * if token_match(substring): +*/ + } + + /* "spacy/tokenizer.pyx":695 + * if len(substring) == 0: + * continue + * if token_match(substring): # <<<<<<<<<<<<<< + * tokens.append(("TOKEN_MATCH", substring)) + * substring = '' +*/ + __pyx_t_1 = NULL; + __Pyx_INCREF(__pyx_v_token_match); + __pyx_t_3 = __pyx_v_token_match; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_substring}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 695, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 695, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":696 + * continue + * if token_match(substring): + * tokens.append(("TOKEN_MATCH", substring)) # <<<<<<<<<<<<<< + * substring = '' + * elif url_match(substring): +*/ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_TOKEN_MATCH); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_TOKEN_MATCH); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_TOKEN_MATCH) != (0)) __PYX_ERR(0, 696, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_substring); + __Pyx_GIVEREF(__pyx_v_substring); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_substring) != (0)) __PYX_ERR(0, 696, __pyx_L1_error); + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_tokens, __pyx_t_4); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":697 + * if token_match(substring): + * tokens.append(("TOKEN_MATCH", substring)) + * substring = '' # <<<<<<<<<<<<<< + * elif url_match(substring): + * tokens.append(("URL_MATCH", substring)) +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__6); + __Pyx_DECREF_SET(__pyx_v_substring, __pyx_mstate_global->__pyx_kp_u__6); + + /* "spacy/tokenizer.pyx":695 + * if len(substring) == 0: + * continue + * if token_match(substring): # <<<<<<<<<<<<<< + * tokens.append(("TOKEN_MATCH", substring)) + * substring = '' +*/ + goto __pyx_L33; + } + + /* "spacy/tokenizer.pyx":698 + * tokens.append(("TOKEN_MATCH", substring)) + * substring = '' + * elif url_match(substring): # <<<<<<<<<<<<<< + * tokens.append(("URL_MATCH", substring)) + * substring = '' +*/ + __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_url_match); + __pyx_t_1 = __pyx_v_url_match; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_substring}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 698, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":699 + * substring = '' + * elif url_match(substring): + * tokens.append(("URL_MATCH", substring)) # <<<<<<<<<<<<<< + * substring = '' + * elif substring in special_cases: +*/ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_URL_MATCH); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_URL_MATCH); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_URL_MATCH) != (0)) __PYX_ERR(0, 699, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_substring); + __Pyx_GIVEREF(__pyx_v_substring); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_substring) != (0)) __PYX_ERR(0, 699, __pyx_L1_error); + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_tokens, __pyx_t_4); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 699, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":700 + * elif url_match(substring): + * tokens.append(("URL_MATCH", substring)) + * substring = '' # <<<<<<<<<<<<<< + * elif substring in special_cases: + * tokens.extend((f"SPECIAL-{i + 1}", self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__6); + __Pyx_DECREF_SET(__pyx_v_substring, __pyx_mstate_global->__pyx_kp_u__6); + + /* "spacy/tokenizer.pyx":698 + * tokens.append(("TOKEN_MATCH", substring)) + * substring = '' + * elif url_match(substring): # <<<<<<<<<<<<<< + * tokens.append(("URL_MATCH", substring)) + * substring = '' +*/ + goto __pyx_L33; + } + + /* "spacy/tokenizer.pyx":701 + * tokens.append(("URL_MATCH", substring)) + * substring = '' + * elif substring in special_cases: # <<<<<<<<<<<<<< + * tokens.extend((f"SPECIAL-{i + 1}", self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' +*/ + __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_substring, __pyx_v_special_cases, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 701, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":702 + * substring = '' + * elif substring in special_cases: + * tokens.extend((f"SPECIAL-{i + 1}", self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) # <<<<<<<<<<<<<< + * substring = '' + * elif list(infix_finditer(substring)): +*/ + __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_special_cases, __pyx_v_substring); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __pyx_pf_5spacy_9tokenizer_9Tokenizer_7explain_6genexpr(((PyObject*)__pyx_cur_scope), __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_tokens, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":703 + * elif substring in special_cases: + * tokens.extend((f"SPECIAL-{i + 1}", self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' # <<<<<<<<<<<<<< + * elif list(infix_finditer(substring)): + * infixes = infix_finditer(substring) +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__6); + __Pyx_DECREF_SET(__pyx_v_substring, __pyx_mstate_global->__pyx_kp_u__6); + + /* "spacy/tokenizer.pyx":701 + * tokens.append(("URL_MATCH", substring)) + * substring = '' + * elif substring in special_cases: # <<<<<<<<<<<<<< + * tokens.extend((f"SPECIAL-{i + 1}", self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' +*/ + goto __pyx_L33; + } + + /* "spacy/tokenizer.pyx":704 + * tokens.extend((f"SPECIAL-{i + 1}", self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' + * elif list(infix_finditer(substring)): # <<<<<<<<<<<<<< + * infixes = infix_finditer(substring) + * offset = 0 +*/ + __pyx_t_4 = NULL; + __Pyx_INCREF(__pyx_v_infix_finditer); + __pyx_t_3 = __pyx_v_infix_finditer; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_substring}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3); + if (unlikely(((!CYTHON_ASSUME_SAFE_SIZE) && __pyx_temp < 0))) __PYX_ERR(0, 704, __pyx_L1_error) + __pyx_t_2 = (__pyx_temp != 0); + } + + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":705 + * substring = '' + * elif list(infix_finditer(substring)): + * infixes = infix_finditer(substring) # <<<<<<<<<<<<<< + * offset = 0 + * for match in infixes: +*/ + __pyx_t_1 = NULL; + __Pyx_INCREF(__pyx_v_infix_finditer); + __pyx_t_4 = __pyx_v_infix_finditer; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_substring}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 705, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF_SET(__pyx_v_infixes, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":706 + * elif list(infix_finditer(substring)): + * infixes = infix_finditer(substring) + * offset = 0 # <<<<<<<<<<<<<< + * for match in infixes: + * if offset == 0 and match.start() == 0: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __Pyx_XDECREF_SET(__pyx_v_offset, __pyx_mstate_global->__pyx_int_0); + + /* "spacy/tokenizer.pyx":707 + * infixes = infix_finditer(substring) + * offset = 0 + * for match in infixes: # <<<<<<<<<<<<<< + * if offset == 0 and match.start() == 0: + * continue +*/ + if (likely(PyList_CheckExact(__pyx_v_infixes)) || PyTuple_CheckExact(__pyx_v_infixes)) { + __pyx_t_3 = __pyx_v_infixes; __Pyx_INCREF(__pyx_t_3); + __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_infixes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 707, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 707, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 707, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 707, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_11)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 707, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_12(__pyx_t_3); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 707, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_match, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":708 + * offset = 0 + * for match in infixes: + * if offset == 0 and match.start() == 0: # <<<<<<<<<<<<<< + * continue + * if substring[offset : match.start()]: +*/ + __pyx_t_16 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_offset, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 708, __pyx_L1_error) + if (__pyx_t_16) { + } else { + __pyx_t_2 = __pyx_t_16; + goto __pyx_L37_bool_binop_done; + } + __pyx_t_1 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_start, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_16 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 708, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __pyx_t_16; + __pyx_L37_bool_binop_done:; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":709 + * for match in infixes: + * if offset == 0 and match.start() == 0: + * continue # <<<<<<<<<<<<<< + * if substring[offset : match.start()]: + * tokens.append(("TOKEN", substring[offset : match.start()])) +*/ + goto __pyx_L34_continue; + + /* "spacy/tokenizer.pyx":708 + * offset = 0 + * for match in infixes: + * if offset == 0 and match.start() == 0: # <<<<<<<<<<<<<< + * continue + * if substring[offset : match.start()]: +*/ + } + + /* "spacy/tokenizer.pyx":710 + * if offset == 0 and match.start() == 0: + * continue + * if substring[offset : match.start()]: # <<<<<<<<<<<<<< + * tokens.append(("TOKEN", substring[offset : match.start()])) + * if substring[match.start() : match.end()]: +*/ + __pyx_t_1 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_start, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 710, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_substring, 0, 0, &__pyx_v_offset, &__pyx_t_4, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 710, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 710, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":711 + * continue + * if substring[offset : match.start()]: + * tokens.append(("TOKEN", substring[offset : match.start()])) # <<<<<<<<<<<<<< + * if substring[match.start() : match.end()]: + * tokens.append(("INFIX", substring[match.start() : match.end()])) +*/ + __pyx_t_4 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_start, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_substring, 0, 0, &__pyx_v_offset, &__pyx_t_1, NULL, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_TOKEN); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_TOKEN); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_TOKEN) != (0)) __PYX_ERR(0, 711, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 711, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_tokens, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":710 + * if offset == 0 and match.start() == 0: + * continue + * if substring[offset : match.start()]: # <<<<<<<<<<<<<< + * tokens.append(("TOKEN", substring[offset : match.start()])) + * if substring[match.start() : match.end()]: +*/ + } + + /* "spacy/tokenizer.pyx":712 + * if substring[offset : match.start()]: + * tokens.append(("TOKEN", substring[offset : match.start()])) + * if substring[match.start() : match.end()]: # <<<<<<<<<<<<<< + * tokens.append(("INFIX", substring[match.start() : match.end()])) + * offset = match.end() +*/ + __pyx_t_4 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_start, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_13 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_13); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_end, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_13 = __Pyx_PyObject_GetSlice(__pyx_v_substring, 0, 0, &__pyx_t_1, &__pyx_t_4, NULL, 0, 0, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 712, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":713 + * tokens.append(("TOKEN", substring[offset : match.start()])) + * if substring[match.start() : match.end()]: + * tokens.append(("INFIX", substring[match.start() : match.end()])) # <<<<<<<<<<<<<< + * offset = match.end() + * if substring[offset:]: +*/ + __pyx_t_4 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_13 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_start, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 713, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + } + __pyx_t_1 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_end, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 713, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_substring, 0, 0, &__pyx_t_13, &__pyx_t_4, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 713, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_INFIX); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_INFIX); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_INFIX) != (0)) __PYX_ERR(0, 713, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 713, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_tokens, __pyx_t_4); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 713, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":712 + * if substring[offset : match.start()]: + * tokens.append(("TOKEN", substring[offset : match.start()])) + * if substring[match.start() : match.end()]: # <<<<<<<<<<<<<< + * tokens.append(("INFIX", substring[match.start() : match.end()])) + * offset = match.end() +*/ + } + + /* "spacy/tokenizer.pyx":714 + * if substring[match.start() : match.end()]: + * tokens.append(("INFIX", substring[match.start() : match.end()])) + * offset = match.end() # <<<<<<<<<<<<<< + * if substring[offset:]: + * tokens.append(("TOKEN", substring[offset:])) +*/ + __pyx_t_1 = __pyx_v_match; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_end, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 714, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_offset, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":707 + * infixes = infix_finditer(substring) + * offset = 0 + * for match in infixes: # <<<<<<<<<<<<<< + * if offset == 0 and match.start() == 0: + * continue +*/ + __pyx_L34_continue:; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":715 + * tokens.append(("INFIX", substring[match.start() : match.end()])) + * offset = match.end() + * if substring[offset:]: # <<<<<<<<<<<<<< + * tokens.append(("TOKEN", substring[offset:])) + * substring = '' +*/ + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_substring, 0, 0, &__pyx_v_offset, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 715, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":716 + * offset = match.end() + * if substring[offset:]: + * tokens.append(("TOKEN", substring[offset:])) # <<<<<<<<<<<<<< + * substring = '' + * elif substring: +*/ + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_substring, 0, 0, &__pyx_v_offset, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 716, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 716, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_TOKEN); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_TOKEN); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_TOKEN) != (0)) __PYX_ERR(0, 716, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 716, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_tokens, __pyx_t_4); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 716, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":715 + * tokens.append(("INFIX", substring[match.start() : match.end()])) + * offset = match.end() + * if substring[offset:]: # <<<<<<<<<<<<<< + * tokens.append(("TOKEN", substring[offset:])) + * substring = '' +*/ + } + + /* "spacy/tokenizer.pyx":717 + * if substring[offset:]: + * tokens.append(("TOKEN", substring[offset:])) + * substring = '' # <<<<<<<<<<<<<< + * elif substring: + * tokens.append(("TOKEN", substring)) +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__6); + __Pyx_DECREF_SET(__pyx_v_substring, __pyx_mstate_global->__pyx_kp_u__6); + + /* "spacy/tokenizer.pyx":704 + * tokens.extend((f"SPECIAL-{i + 1}", self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + * substring = '' + * elif list(infix_finditer(substring)): # <<<<<<<<<<<<<< + * infixes = infix_finditer(substring) + * offset = 0 +*/ + goto __pyx_L33; + } + + /* "spacy/tokenizer.pyx":718 + * tokens.append(("TOKEN", substring[offset:])) + * substring = '' + * elif substring: # <<<<<<<<<<<<<< + * tokens.append(("TOKEN", substring)) + * substring = '' +*/ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_substring); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 718, __pyx_L1_error) + if (__pyx_t_2) { + + /* "spacy/tokenizer.pyx":719 + * substring = '' + * elif substring: + * tokens.append(("TOKEN", substring)) # <<<<<<<<<<<<<< + * substring = '' + * tokens.extend(reversed(suffixes)) +*/ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 719, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_TOKEN); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_TOKEN); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_TOKEN) != (0)) __PYX_ERR(0, 719, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_substring); + __Pyx_GIVEREF(__pyx_v_substring); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_substring) != (0)) __PYX_ERR(0, 719, __pyx_L1_error); + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_tokens, __pyx_t_4); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 719, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":720 + * elif substring: + * tokens.append(("TOKEN", substring)) + * substring = '' # <<<<<<<<<<<<<< + * tokens.extend(reversed(suffixes)) + * # Find matches for special cases handled by special matcher +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__6); + __Pyx_DECREF_SET(__pyx_v_substring, __pyx_mstate_global->__pyx_kp_u__6); + + /* "spacy/tokenizer.pyx":718 + * tokens.append(("TOKEN", substring[offset:])) + * substring = '' + * elif substring: # <<<<<<<<<<<<<< + * tokens.append(("TOKEN", substring)) + * substring = '' +*/ + } + __pyx_L33:; + __pyx_L18_continue:; + } + + /* "spacy/tokenizer.pyx":721 + * tokens.append(("TOKEN", substring)) + * substring = '' + * tokens.extend(reversed(suffixes)) # <<<<<<<<<<<<<< + * # Find matches for special cases handled by special matcher + * words, spaces = get_words_and_spaces([t[1] for t in tokens], text) +*/ + __pyx_t_3 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_suffixes}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_reversed, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 721, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_tokens, __pyx_t_4); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 721, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":661 + * special_cases[orth] = [intify_attrs(special_token, strings_map=self.vocab.strings, _do_deprecated=True) for special_token in special_tokens] + * tokens = [] + * for substring in text.split(): # <<<<<<<<<<<<<< + * suffixes = [] + * while substring: +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/tokenizer.pyx":723 + * tokens.extend(reversed(suffixes)) + * # Find matches for special cases handled by special matcher + * words, spaces = get_words_and_spaces([t[1] for t in tokens], text) # <<<<<<<<<<<<<< + * t_words = [] + * t_spaces = [] +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_words_and_spaces); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = __pyx_v_tokens; __Pyx_INCREF(__pyx_t_13); + __pyx_t_7 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_13); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 723, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_14 = __Pyx_PyList_GetItemRefFast(__pyx_t_13, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_14); + __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_GetItemInt(__pyx_v_t, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_14))) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_text}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 723, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_1); + } + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); + index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L47_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_1 = __pyx_t_10(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L47_unpacking_failed; + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L48_unpacking_done; + __pyx_L47_unpacking_failed:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_L48_unpacking_done:; + } + __pyx_v_words = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_spaces = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":724 + * # Find matches for special cases handled by special matcher + * words, spaces = get_words_and_spaces([t[1] for t in tokens], text) + * t_words = [] # <<<<<<<<<<<<<< + * t_spaces = [] + * for word, space in zip(words, spaces): +*/ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_t_words = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/tokenizer.pyx":725 + * words, spaces = get_words_and_spaces([t[1] for t in tokens], text) + * t_words = [] + * t_spaces = [] # <<<<<<<<<<<<<< + * for word, space in zip(words, spaces): + * if not word.isspace(): +*/ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_t_spaces = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/tokenizer.pyx":726 + * t_words = [] + * t_spaces = [] + * for word, space in zip(words, spaces): # <<<<<<<<<<<<<< + * if not word.isspace(): + * t_words.append(word) +*/ + __pyx_t_1 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_words, __pyx_v_spaces}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 726, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 726, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 726, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 726, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_8(__pyx_t_1); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 726, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 726, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_4); + } + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_13 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13); + index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L51_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_10(__pyx_t_13); if (unlikely(!__pyx_t_4)) goto __pyx_L51_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_13), 2) < (0)) __PYX_ERR(0, 726, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L52_unpacking_done; + __pyx_L51_unpacking_failed:; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 726, __pyx_L1_error) + __pyx_L52_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_space, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":727 + * t_spaces = [] + * for word, space in zip(words, spaces): + * if not word.isspace(): # <<<<<<<<<<<<<< + * t_words.append(word) + * t_spaces.append(space) +*/ + __pyx_t_4 = __pyx_v_word; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_isspace, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 727, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 727, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_16 = (!__pyx_t_2); + if (__pyx_t_16) { + + /* "spacy/tokenizer.pyx":728 + * for word, space in zip(words, spaces): + * if not word.isspace(): + * t_words.append(word) # <<<<<<<<<<<<<< + * t_spaces.append(space) + * doc = Doc(self.vocab, words=t_words, spaces=t_spaces) +*/ + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_t_words, __pyx_v_word); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 728, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":729 + * if not word.isspace(): + * t_words.append(word) + * t_spaces.append(space) # <<<<<<<<<<<<<< + * doc = Doc(self.vocab, words=t_words, spaces=t_spaces) + * matches = self._special_matcher(doc) +*/ + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_t_spaces, __pyx_v_space); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 729, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":727 + * t_spaces = [] + * for word, space in zip(words, spaces): + * if not word.isspace(): # <<<<<<<<<<<<<< + * t_words.append(word) + * t_spaces.append(space) +*/ + } + + /* "spacy/tokenizer.pyx":726 + * t_words = [] + * t_spaces = [] + * for word, space in zip(words, spaces): # <<<<<<<<<<<<<< + * if not word.isspace(): + * t_words.append(word) +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":730 + * t_words.append(word) + * t_spaces.append(space) + * doc = Doc(self.vocab, words=t_words, spaces=t_spaces) # <<<<<<<<<<<<<< + * matches = self._special_matcher(doc) + * spans = [Span(doc, s, e, label=m_id) for m_id, s, e in matches] +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_5, ((PyObject *)__pyx_cur_scope->__pyx_v_self->vocab)}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 730, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_words, __pyx_v_t_words, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 730, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_spaces, __pyx_v_t_spaces, __pyx_t_4, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 730, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_6tokens_3doc_Doc, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_doc = ((struct __pyx_obj_5spacy_6tokens_3doc_Doc *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":731 + * t_spaces.append(space) + * doc = Doc(self.vocab, words=t_words, spaces=t_spaces) + * matches = self._special_matcher(doc) # <<<<<<<<<<<<<< + * spans = [Span(doc, s, e, label=m_id) for m_id, s, e in matches] + * spans = util.filter_spans(spans) +*/ + __pyx_t_4 = NULL; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self->_special_matcher); + __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->_special_matcher); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_doc)}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_matches = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":732 + * doc = Doc(self.vocab, words=t_words, spaces=t_spaces) + * matches = self._special_matcher(doc) + * spans = [Span(doc, s, e, label=m_id) for m_id, s, e in matches] # <<<<<<<<<<<<<< + * spans = util.filter_spans(spans) + * # Replace matched tokens with their exceptions +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_v_matches)) || PyTuple_CheckExact(__pyx_v_matches)) { + __pyx_t_5 = __pyx_v_matches; __Pyx_INCREF(__pyx_t_5); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_matches); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 732, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 732, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 732, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 732, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_8(__pyx_t_5); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 732, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 732, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_13); + __pyx_t_14 = PyTuple_GET_ITEM(sequence, 2); + __Pyx_INCREF(__pyx_t_14); + } else { + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_3); + __pyx_t_13 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_13); + __pyx_t_14 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_14); + } + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); + index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L57_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_13 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_13)) goto __pyx_L57_unpacking_failed; + __Pyx_GOTREF(__pyx_t_13); + index = 2; __pyx_t_14 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_14)) goto __pyx_L57_unpacking_failed; + __Pyx_GOTREF(__pyx_t_14); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < (0)) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L58_unpacking_done; + __pyx_L57_unpacking_failed:; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_L58_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_m_id, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_13); + __pyx_t_13 = 0; + __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_14); + __pyx_t_14 = 0; + __pyx_t_14 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_Span); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13); + assert(__pyx_t_14); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_13, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_14, ((PyObject *)__pyx_v_doc), __pyx_v_s, __pyx_v_e}; + __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_label, __pyx_v_m_id, __pyx_t_3, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_6, (4-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_spans = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":733 + * matches = self._special_matcher(doc) + * spans = [Span(doc, s, e, label=m_id) for m_id, s, e in matches] + * spans = util.filter_spans(spans) # <<<<<<<<<<<<<< + * # Replace matched tokens with their exceptions + * i = 0 +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_filter_spans); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_13); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_13, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_spans}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_spans, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":735 + * spans = util.filter_spans(spans) + * # Replace matched tokens with their exceptions + * i = 0 # <<<<<<<<<<<<<< + * final_tokens = [] + * spans_by_start = {s.start: s for s in spans} +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_v_i = __pyx_mstate_global->__pyx_int_0; + + /* "spacy/tokenizer.pyx":736 + * # Replace matched tokens with their exceptions + * i = 0 + * final_tokens = [] # <<<<<<<<<<<<<< + * spans_by_start = {s.start: s for s in spans} + * while i < len(tokens): +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_final_tokens = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":737 + * i = 0 + * final_tokens = [] + * spans_by_start = {s.start: s for s in spans} # <<<<<<<<<<<<<< + * while i < len(tokens): + * if i in spans_by_start: +*/ + { /* enter inner scope */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 737, __pyx_L62_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_v_spans)) || PyTuple_CheckExact(__pyx_v_spans)) { + __pyx_t_13 = __pyx_v_spans; __Pyx_INCREF(__pyx_t_13); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_v_spans); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 737, __pyx_L62_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 737, __pyx_L62_error) + } + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_13))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_13); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 737, __pyx_L62_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_13, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_13); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 737, __pyx_L62_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_7)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_13, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 737, __pyx_L62_error) + } else { + __pyx_t_5 = __pyx_t_8(__pyx_t_13); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 737, __pyx_L62_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_s, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr3__pyx_v_s, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 737, __pyx_L62_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_t_5, (PyObject*)__pyx_8genexpr3__pyx_v_s))) __PYX_ERR(0, 737, __pyx_L62_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_s); __pyx_8genexpr3__pyx_v_s = 0; + goto __pyx_L66_exit_scope; + __pyx_L62_error:; + __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_s); __pyx_8genexpr3__pyx_v_s = 0; + goto __pyx_L1_error; + __pyx_L66_exit_scope:; + } /* exit inner scope */ + __pyx_v_spans_by_start = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":738 + * final_tokens = [] + * spans_by_start = {s.start: s for s in spans} + * while i < len(tokens): # <<<<<<<<<<<<<< + * if i in spans_by_start: + * span = spans_by_start[i] +*/ + while (1) { + __pyx_t_7 = __Pyx_PyList_GET_SIZE(__pyx_v_tokens); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 738, __pyx_L1_error) + __pyx_t_1 = PyLong_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (!__pyx_t_16) break; + + /* "spacy/tokenizer.pyx":739 + * spans_by_start = {s.start: s for s in spans} + * while i < len(tokens): + * if i in spans_by_start: # <<<<<<<<<<<<<< + * span = spans_by_start[i] + * exc = [d[ORTH] for d in special_cases[span.label_]] +*/ + __pyx_t_16 = (__Pyx_PyDict_ContainsTF(__pyx_v_i, __pyx_v_spans_by_start, Py_EQ)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 739, __pyx_L1_error) + if (__pyx_t_16) { + + /* "spacy/tokenizer.pyx":740 + * while i < len(tokens): + * if i in spans_by_start: + * span = spans_by_start[i] # <<<<<<<<<<<<<< + * exc = [d[ORTH] for d in special_cases[span.label_]] + * # The phrase matcher can overmatch for tokens separated by +*/ + __pyx_t_13 = __Pyx_PyDict_GetItem(__pyx_v_spans_by_start, __pyx_v_i); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 740, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_XDECREF_SET(__pyx_v_span, __pyx_t_13); + __pyx_t_13 = 0; + + /* "spacy/tokenizer.pyx":741 + * if i in spans_by_start: + * span = spans_by_start[i] + * exc = [d[ORTH] for d in special_cases[span.label_]] # <<<<<<<<<<<<<< + * # The phrase matcher can overmatch for tokens separated by + * # spaces in the text but not in the underlying rule, so skip +*/ + __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_mstate_global->__pyx_n_u_label_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_special_cases, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 741, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 741, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 741, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 741, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_8(__pyx_t_1); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 741, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ORTH); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_d, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_13, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_exc, ((PyObject*)__pyx_t_13)); + __pyx_t_13 = 0; + + /* "spacy/tokenizer.pyx":745 + * # spaces in the text but not in the underlying rule, so skip + * # cases where the texts aren't identical + * if span.text != "".join([self.vocab.strings[orth] for orth in exc]): # <<<<<<<<<<<<<< + * final_tokens.append(tokens[i]) + * i += 1 +*/ + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_span, __pyx_mstate_global->__pyx_n_u_text); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __pyx_v_exc; __Pyx_INCREF(__pyx_t_4); + __pyx_t_7 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 745, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_orth, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self->vocab->strings), __pyx_v_orth); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__6, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_16 = (__Pyx_PyUnicode_Equals(__pyx_t_13, __pyx_t_4, Py_NE)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_16) { + + /* "spacy/tokenizer.pyx":746 + * # cases where the texts aren't identical + * if span.text != "".join([self.vocab.strings[orth] for orth in exc]): + * final_tokens.append(tokens[i]) # <<<<<<<<<<<<<< + * i += 1 + * else: +*/ + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_tokens, __pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 746, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_final_tokens, __pyx_t_4); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 746, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":747 + * if span.text != "".join([self.vocab.strings[orth] for orth in exc]): + * final_tokens.append(tokens[i]) + * i += 1 # <<<<<<<<<<<<<< + * else: + * for j, orth in enumerate(exc): +*/ + __pyx_t_4 = __Pyx_PyLong_AddObjC(__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":745 + * # spaces in the text but not in the underlying rule, so skip + * # cases where the texts aren't identical + * if span.text != "".join([self.vocab.strings[orth] for orth in exc]): # <<<<<<<<<<<<<< + * final_tokens.append(tokens[i]) + * i += 1 +*/ + goto __pyx_L73; + } + + /* "spacy/tokenizer.pyx":749 + * i += 1 + * else: + * for j, orth in enumerate(exc): # <<<<<<<<<<<<<< + * final_tokens.append((f"SPECIAL-{j + 1}", self.vocab.strings[orth])) + * i += len(span) +*/ + /*else*/ { + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_4 = __pyx_mstate_global->__pyx_int_0; + __pyx_t_13 = __pyx_v_exc; __Pyx_INCREF(__pyx_t_13); + __pyx_t_7 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_13); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 749, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_13, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_orth, __pyx_t_1); + __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_4); + __pyx_t_1 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); + __pyx_t_4 = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":750 + * else: + * for j, orth in enumerate(exc): + * final_tokens.append((f"SPECIAL-{j + 1}", self.vocab.strings[orth])) # <<<<<<<<<<<<<< + * i += len(span) + * else: +*/ + __pyx_t_1 = __Pyx_PyLong_AddObjC(__pyx_v_j, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_SPECIAL, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self->vocab->strings), __pyx_v_orth); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 750, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 750, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_5 = 0; + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_final_tokens, __pyx_t_3); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":749 + * i += 1 + * else: + * for j, orth in enumerate(exc): # <<<<<<<<<<<<<< + * final_tokens.append((f"SPECIAL-{j + 1}", self.vocab.strings[orth])) + * i += len(span) +*/ + } + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":751 + * for j, orth in enumerate(exc): + * final_tokens.append((f"SPECIAL-{j + 1}", self.vocab.strings[orth])) + * i += len(span) # <<<<<<<<<<<<<< + * else: + * final_tokens.append(tokens[i]) +*/ + __pyx_t_7 = PyObject_Length(__pyx_v_span); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 751, __pyx_L1_error) + __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 751, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_13 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 751, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_13); + __pyx_t_13 = 0; + } + __pyx_L73:; + + /* "spacy/tokenizer.pyx":739 + * spans_by_start = {s.start: s for s in spans} + * while i < len(tokens): + * if i in spans_by_start: # <<<<<<<<<<<<<< + * span = spans_by_start[i] + * exc = [d[ORTH] for d in special_cases[span.label_]] +*/ + goto __pyx_L69; + } + + /* "spacy/tokenizer.pyx":753 + * i += len(span) + * else: + * final_tokens.append(tokens[i]) # <<<<<<<<<<<<<< + * i += 1 + * return final_tokens +*/ + /*else*/ { + __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_tokens, __pyx_v_i); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_final_tokens, __pyx_t_13); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + + /* "spacy/tokenizer.pyx":754 + * else: + * final_tokens.append(tokens[i]) + * i += 1 # <<<<<<<<<<<<<< + * return final_tokens + * +*/ + __pyx_t_13 = __Pyx_PyLong_AddObjC(__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_13); + __pyx_t_13 = 0; + } + __pyx_L69:; + } + + /* "spacy/tokenizer.pyx":755 + * final_tokens.append(tokens[i]) + * i += 1 + * return final_tokens # <<<<<<<<<<<<<< + * + * def score(self, examples, **kwargs): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_final_tokens); + __pyx_r = __pyx_v_final_tokens; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":631 + * self._load_special_cases(self._rules) + * + * def explain(self, text): # <<<<<<<<<<<<<< + * """A debugging tokenizer that provides information about which + * tokenizer rule or pattern was matched for each token. The tokens +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.explain", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_prefix_search); + __Pyx_XDECREF(__pyx_v_suffix_search); + __Pyx_XDECREF(__pyx_v_infix_finditer); + __Pyx_XDECREF(__pyx_v_token_match); + __Pyx_XDECREF(__pyx_v_url_match); + __Pyx_XDECREF(__pyx_v_special_cases); + __Pyx_XDECREF(__pyx_v_orth); + __Pyx_XDECREF(__pyx_v_special_tokens); + __Pyx_XDECREF(__pyx_v_tokens); + __Pyx_XDECREF(__pyx_v_substring); + __Pyx_XDECREF(__pyx_v_suffixes); + __Pyx_XDECREF(__pyx_v_split); + __Pyx_XDECREF(__pyx_v_infixes); + __Pyx_XDECREF(__pyx_v_offset); + __Pyx_XDECREF(__pyx_v_match); + __Pyx_XDECREF(__pyx_v_words); + __Pyx_XDECREF(__pyx_v_spaces); + __Pyx_XDECREF(__pyx_v_t_words); + __Pyx_XDECREF(__pyx_v_t_spaces); + __Pyx_XDECREF(__pyx_v_word); + __Pyx_XDECREF(__pyx_v_space); + __Pyx_XDECREF((PyObject *)__pyx_v_doc); + __Pyx_XDECREF(__pyx_v_matches); + __Pyx_XDECREF(__pyx_v_spans); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_final_tokens); + __Pyx_XDECREF(__pyx_v_spans_by_start); + __Pyx_XDECREF(__pyx_v_span); + __Pyx_XDECREF(__pyx_v_exc); + __Pyx_XDECREF(__pyx_v_j); + __Pyx_XDECREF(__pyx_v_special_token); + __Pyx_XDECREF(__pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_2generator1); + __Pyx_XDECREF(__pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_5generator2); + __Pyx_XDECREF(__pyx_gb_5spacy_9tokenizer_9Tokenizer_7explain_8generator3); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_m_id); + __Pyx_XDECREF(__pyx_v_s); + __Pyx_XDECREF(__pyx_v_e); + __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_s); + __Pyx_XDECREF(__pyx_v_d); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":757 + * return final_tokens + * + * def score(self, examples, **kwargs): # <<<<<<<<<<<<<< + * validate_examples(examples, "Tokenizer.score") + * return Scorer.score_tokenization(examples) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_32score(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_31score, "Tokenizer.score(self, examples, **kwargs)"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_32score = {"score", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_32score, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_31score}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_32score(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_examples = 0; + CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("score (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_examples,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 757, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 757, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "score", 1) < (0)) __PYX_ERR(0, 757, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("score", 1, 1, 1, i); __PYX_ERR(0, 757, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 757, __pyx_L3_error) + } + __pyx_v_examples = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("score", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 757, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_XDECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.score", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_31score(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_examples, __pyx_v_kwargs); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_31score(CYTHON_UNUSED struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_examples, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("score", 0); + + /* "spacy/tokenizer.pyx":758 + * + * def score(self, examples, **kwargs): + * validate_examples(examples, "Tokenizer.score") # <<<<<<<<<<<<<< + * return Scorer.score_tokenization(examples) + * +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_validate_examples); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_examples, __pyx_mstate_global->__pyx_kp_u_Tokenizer_score}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":759 + * def score(self, examples, **kwargs): + * validate_examples(examples, "Tokenizer.score") + * return Scorer.score_tokenization(examples) # <<<<<<<<<<<<<< + * + * def to_disk(self, path, **kwargs): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Scorer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_score_tokenization); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_examples}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":757 + * return final_tokens + * + * def score(self, examples, **kwargs): # <<<<<<<<<<<<<< + * validate_examples(examples, "Tokenizer.score") + * return Scorer.score_tokenization(examples) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.score", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":761 + * return Scorer.score_tokenization(examples) + * + * def to_disk(self, path, **kwargs): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_34to_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_33to_disk, "Tokenizer.to_disk(self, path, **kwargs)\n\nSave the current state to a directory.\n\npath (str / Path): A path to a directory, which will be created if\n it doesn't exist.\nexclude (list): String names of serialization fields to exclude.\n\nDOCS: https://spacy.io/api/tokenizer#to_disk"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_34to_disk = {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_34to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_33to_disk}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_34to_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_disk (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 761, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 761, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "to_disk", 1) < (0)) __PYX_ERR(0, 761, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, i); __PYX_ERR(0, 761, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 761, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 761, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_33to_disk(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_path, __pyx_v_kwargs); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_33to_disk(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_v_file_ = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_disk", 0); + __Pyx_INCREF(__pyx_v_path); + + /* "spacy/tokenizer.pyx":770 + * DOCS: https://spacy.io/api/tokenizer#to_disk + * """ + * path = util.ensure_path(path) # <<<<<<<<<<<<<< + * with path.open("wb") as file_: + * file_.write(self.to_bytes(**kwargs)) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 770, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ensure_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 770, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 770, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":771 + * """ + * path = util.ensure_path(path) + * with path.open("wb") as file_: # <<<<<<<<<<<<<< + * file_.write(self.to_bytes(**kwargs)) + * +*/ + /*with:*/ { + __pyx_t_4 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_wb}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_open, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 771, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 771, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*try:*/ { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + /*try:*/ { + __pyx_v_file_ = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":772 + * path = util.ensure_path(path) + * with path.open("wb") as file_: + * file_.write(self.to_bytes(**kwargs)) # <<<<<<<<<<<<<< + * + * def from_disk(self, path, *, exclude=tuple()): +*/ + __pyx_t_1 = __pyx_v_file_; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_to_bytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 772, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 772, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_mstate_global->__pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 772, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_10}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_write, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 772, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":771 + * """ + * path = util.ensure_path(path) + * with path.open("wb") as file_: # <<<<<<<<<<<<<< + * file_.write(self.to_bytes(**kwargs)) + * +*/ + } + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L12_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + /*except:*/ { + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_10, &__pyx_t_1) < 0) __PYX_ERR(0, 771, __pyx_L9_except_error) + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 771, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_12 < (0)) __PYX_ERR(0, 771, __pyx_L9_except_error) + __pyx_t_13 = (!__pyx_t_12); + if (unlikely(__pyx_t_13)) { + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_10, __pyx_t_1); + __pyx_t_3 = 0; __pyx_t_10 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 771, __pyx_L9_except_error) + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_except_error:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + goto __pyx_L1_error; + __pyx_L8_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_L12_try_end:; + } + } + /*finally:*/ { + /*normal exit:*/{ + if (__pyx_t_6) { + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + goto __pyx_L6; + } + __pyx_L6:; + } + goto __pyx_L16; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L1_error; + __pyx_L16:; + } + + /* "spacy/tokenizer.pyx":761 + * return Scorer.score_tokenization(examples) + * + * def to_disk(self, path, **kwargs): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_file_); + __Pyx_XDECREF(__pyx_v_path); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":774 + * file_.write(self.to_bytes(**kwargs)) + * + * def from_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_36from_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_35from_disk, "Tokenizer.from_disk(self, path, *, exclude=tuple())\n\nLoads state from a directory. Modifies the object in place and\nreturns it.\n\npath (str / Path): A path to a directory.\nexclude (list): String names of serialization fields to exclude.\nRETURNS (Tokenizer): The modified `Tokenizer` object.\n\nDOCS: https://spacy.io/api/tokenizer#from_disk"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_36from_disk = {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_36from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_35from_disk}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_36from_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + PyObject *__pyx_v_exclude = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_disk (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_exclude,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 774, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 774, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_disk", 0) < (0)) __PYX_ERR(0, 774, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__8); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_disk", 1, 1, 1, i); __PYX_ERR(0, 774, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 774, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__8); + } + __pyx_v_path = values[0]; + __pyx_v_exclude = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 774, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_35from_disk(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_path, __pyx_v_exclude); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_35from_disk(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_exclude) { + PyObject *__pyx_v_file_ = NULL; + PyObject *__pyx_v_bytes_data = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_disk", 0); + __Pyx_INCREF(__pyx_v_path); + + /* "spacy/tokenizer.pyx":784 + * DOCS: https://spacy.io/api/tokenizer#from_disk + * """ + * path = util.ensure_path(path) # <<<<<<<<<<<<<< + * with path.open("rb") as file_: + * bytes_data = file_.read() +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ensure_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":785 + * """ + * path = util.ensure_path(path) + * with path.open("rb") as file_: # <<<<<<<<<<<<<< + * bytes_data = file_.read() + * self.from_bytes(bytes_data, exclude=exclude) +*/ + /*with:*/ { + __pyx_t_4 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_rb}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_open, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 785, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 785, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*try:*/ { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + /*try:*/ { + __pyx_v_file_ = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":786 + * path = util.ensure_path(path) + * with path.open("rb") as file_: + * bytes_data = file_.read() # <<<<<<<<<<<<<< + * self.from_bytes(bytes_data, exclude=exclude) + * return self +*/ + __pyx_t_1 = __pyx_v_file_; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_read, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_bytes_data = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":785 + * """ + * path = util.ensure_path(path) + * with path.open("rb") as file_: # <<<<<<<<<<<<<< + * bytes_data = file_.read() + * self.from_bytes(bytes_data, exclude=exclude) +*/ + } + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L12_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + /*except:*/ { + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_4) < 0) __PYX_ERR(0, 785, __pyx_L9_except_error) + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 785, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_11 < (0)) __PYX_ERR(0, 785, __pyx_L9_except_error) + __pyx_t_12 = (!__pyx_t_11); + if (unlikely(__pyx_t_12)) { + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_1, __pyx_t_4); + __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0; + __PYX_ERR(0, 785, __pyx_L9_except_error) + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_except_error:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + goto __pyx_L1_error; + __pyx_L8_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_L12_try_end:; + } + } + /*finally:*/ { + /*normal exit:*/{ + if (__pyx_t_6) { + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + goto __pyx_L6; + } + __pyx_L6:; + } + goto __pyx_L16; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L1_error; + __pyx_L16:; + } + + /* "spacy/tokenizer.pyx":787 + * with path.open("rb") as file_: + * bytes_data = file_.read() + * self.from_bytes(bytes_data, exclude=exclude) # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_1 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_1); + if (unlikely(!__pyx_v_bytes_data)) { __Pyx_RaiseUnboundLocalError("bytes_data"); __PYX_ERR(0, 787, __pyx_L1_error) } + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_v_bytes_data}; + __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 787, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_exclude, __pyx_v_exclude, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 787, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":788 + * bytes_data = file_.read() + * self.from_bytes(bytes_data, exclude=exclude) + * return self # <<<<<<<<<<<<<< + * + * def to_bytes(self, *, exclude=tuple()): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":774 + * file_.write(self.to_bytes(**kwargs)) + * + * def from_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_file_); + __Pyx_XDECREF(__pyx_v_bytes_data); + __Pyx_XDECREF(__pyx_v_path); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":790 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_38to_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_37to_bytes, "Tokenizer.to_bytes(self, *, exclude=tuple())\n\nSerialize the current state to a binary string.\n\nexclude (list): String names of serialization fields to exclude.\nRETURNS (bytes): The serialized form of the `Tokenizer` object.\n\nDOCS: https://spacy.io/api/tokenizer#to_bytes"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_38to_bytes = {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_38to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_37to_bytes}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_38to_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_exclude = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_bytes (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exclude,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 790, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "to_bytes", 0) < (0)) __PYX_ERR(0, 790, __pyx_L3_error) + if (!values[0]) values[0] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__9); + } else if (unlikely(__pyx_nargs != 0)) { + goto __pyx_L5_argtuple_error; + } else { + if (!values[0]) values[0] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__9); + } + __pyx_v_exclude = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_bytes", 1, 0, 0, __pyx_nargs); __PYX_ERR(0, 790, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_37to_bytes(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_exclude); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":799 + * """ + * serializers = { + * "vocab": lambda: self.vocab.to_bytes(exclude=exclude), # <<<<<<<<<<<<<< + * "prefix_search": lambda: _get_regex_pattern(self.prefix_search), + * "suffix_search": lambda: _get_regex_pattern(self.suffix_search), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_lambda3 = {"lambda3", (PyCFunction)__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_lambda3, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda3", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 799, __pyx_L1_error) } + __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->vocab); + __Pyx_INCREF(__pyx_t_2); + if (unlikely(!__pyx_cur_scope->__pyx_v_exclude)) { __Pyx_RaiseClosureNameError("exclude"); __PYX_ERR(0, 799, __pyx_L1_error) } + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_exclude, __pyx_cur_scope->__pyx_v_exclude, __pyx_t_4, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 799, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_bytes.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":800 + * serializers = { + * "vocab": lambda: self.vocab.to_bytes(exclude=exclude), + * "prefix_search": lambda: _get_regex_pattern(self.prefix_search), # <<<<<<<<<<<<<< + * "suffix_search": lambda: _get_regex_pattern(self.suffix_search), + * "infix_finditer": lambda: _get_regex_pattern(self.infix_finditer), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_1lambda4(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_1lambda4 = {"lambda4", (PyCFunction)__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_1lambda4, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_1lambda4(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda4 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda4(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda4(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda4", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_regex_pattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 800, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 800, __pyx_L1_error) } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_prefix_search); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 800, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_bytes.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":801 + * "vocab": lambda: self.vocab.to_bytes(exclude=exclude), + * "prefix_search": lambda: _get_regex_pattern(self.prefix_search), + * "suffix_search": lambda: _get_regex_pattern(self.suffix_search), # <<<<<<<<<<<<<< + * "infix_finditer": lambda: _get_regex_pattern(self.infix_finditer), + * "token_match": lambda: _get_regex_pattern(self.token_match), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_2lambda5(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_2lambda5 = {"lambda5", (PyCFunction)__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_2lambda5, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_2lambda5(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda5 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda5(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda5(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda5", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_regex_pattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 801, __pyx_L1_error) } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_suffix_search); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 801, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_bytes.lambda5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":802 + * "prefix_search": lambda: _get_regex_pattern(self.prefix_search), + * "suffix_search": lambda: _get_regex_pattern(self.suffix_search), + * "infix_finditer": lambda: _get_regex_pattern(self.infix_finditer), # <<<<<<<<<<<<<< + * "token_match": lambda: _get_regex_pattern(self.token_match), + * "url_match": lambda: _get_regex_pattern(self.url_match), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_3lambda6(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_3lambda6 = {"lambda6", (PyCFunction)__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_3lambda6, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_3lambda6(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda6 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda6(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda6(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda6", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_regex_pattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 802, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 802, __pyx_L1_error) } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_infix_finditer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 802, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_bytes.lambda6", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":803 + * "suffix_search": lambda: _get_regex_pattern(self.suffix_search), + * "infix_finditer": lambda: _get_regex_pattern(self.infix_finditer), + * "token_match": lambda: _get_regex_pattern(self.token_match), # <<<<<<<<<<<<<< + * "url_match": lambda: _get_regex_pattern(self.url_match), + * "exceptions": lambda: dict(sorted(self._rules.items())), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_4lambda7(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_4lambda7 = {"lambda7", (PyCFunction)__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_4lambda7, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_4lambda7(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda7 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda7(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda7(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda7", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_regex_pattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 803, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 803, __pyx_L1_error) } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_token_match); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 803, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_bytes.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":804 + * "infix_finditer": lambda: _get_regex_pattern(self.infix_finditer), + * "token_match": lambda: _get_regex_pattern(self.token_match), + * "url_match": lambda: _get_regex_pattern(self.url_match), # <<<<<<<<<<<<<< + * "exceptions": lambda: dict(sorted(self._rules.items())), + * "faster_heuristics": lambda: self.faster_heuristics, +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_5lambda8(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_5lambda8 = {"lambda8", (PyCFunction)__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_5lambda8, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_5lambda8(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda8 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda8(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda8(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda8", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_regex_pattern); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 804, __pyx_L1_error) } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_url_match); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_bytes.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":805 + * "token_match": lambda: _get_regex_pattern(self.token_match), + * "url_match": lambda: _get_regex_pattern(self.url_match), + * "exceptions": lambda: dict(sorted(self._rules.items())), # <<<<<<<<<<<<<< + * "faster_heuristics": lambda: self.faster_heuristics, + * } +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_6lambda9(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_6lambda9 = {"lambda9", (PyCFunction)__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_6lambda9, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_6lambda9(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda9 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda9(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda9(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda9", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 805, __pyx_L1_error) } + __pyx_t_4 = __pyx_cur_scope->__pyx_v_self->_rules; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_4 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely((PyList_Sort(__pyx_t_4) < 0))) __PYX_ERR(0, 805, __pyx_L1_error) + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_bytes.lambda9", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":806 + * "url_match": lambda: _get_regex_pattern(self.url_match), + * "exceptions": lambda: dict(sorted(self._rules.items())), + * "faster_heuristics": lambda: self.faster_heuristics, # <<<<<<<<<<<<<< + * } + * return util.to_bytes(serializers, exclude) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_7lambda10(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_7lambda10 = {"lambda10", (PyCFunction)__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_7lambda10, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_8to_bytes_7lambda10(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda10 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda10(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda10(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda10", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 806, __pyx_L1_error) } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_faster_heuristics); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_bytes.lambda10", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":790 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_37to_bytes(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_exclude) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *__pyx_cur_scope; + PyObject *__pyx_v_serializers = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_bytes", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 790, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_exclude = __pyx_v_exclude; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_exclude); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_exclude); + + /* "spacy/tokenizer.pyx":799 + * """ + * serializers = { + * "vocab": lambda: self.vocab.to_bytes(exclude=exclude), # <<<<<<<<<<<<<< + * "prefix_search": lambda: _get_regex_pattern(self.prefix_search), + * "suffix_search": lambda: _get_regex_pattern(self.suffix_search), +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_lambda3, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_vocab, __pyx_t_2) < (0)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":800 + * serializers = { + * "vocab": lambda: self.vocab.to_bytes(exclude=exclude), + * "prefix_search": lambda: _get_regex_pattern(self.prefix_search), # <<<<<<<<<<<<<< + * "suffix_search": lambda: _get_regex_pattern(self.suffix_search), + * "infix_finditer": lambda: _get_regex_pattern(self.infix_finditer), +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_1lambda4, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 800, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_prefix_search, __pyx_t_2) < (0)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":801 + * "vocab": lambda: self.vocab.to_bytes(exclude=exclude), + * "prefix_search": lambda: _get_regex_pattern(self.prefix_search), + * "suffix_search": lambda: _get_regex_pattern(self.suffix_search), # <<<<<<<<<<<<<< + * "infix_finditer": lambda: _get_regex_pattern(self.infix_finditer), + * "token_match": lambda: _get_regex_pattern(self.token_match), +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_2lambda5, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 801, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_suffix_search, __pyx_t_2) < (0)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":802 + * "prefix_search": lambda: _get_regex_pattern(self.prefix_search), + * "suffix_search": lambda: _get_regex_pattern(self.suffix_search), + * "infix_finditer": lambda: _get_regex_pattern(self.infix_finditer), # <<<<<<<<<<<<<< + * "token_match": lambda: _get_regex_pattern(self.token_match), + * "url_match": lambda: _get_regex_pattern(self.url_match), +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_3lambda6, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 802, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_infix_finditer, __pyx_t_2) < (0)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":803 + * "suffix_search": lambda: _get_regex_pattern(self.suffix_search), + * "infix_finditer": lambda: _get_regex_pattern(self.infix_finditer), + * "token_match": lambda: _get_regex_pattern(self.token_match), # <<<<<<<<<<<<<< + * "url_match": lambda: _get_regex_pattern(self.url_match), + * "exceptions": lambda: dict(sorted(self._rules.items())), +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_4lambda7, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_token_match, __pyx_t_2) < (0)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":804 + * "infix_finditer": lambda: _get_regex_pattern(self.infix_finditer), + * "token_match": lambda: _get_regex_pattern(self.token_match), + * "url_match": lambda: _get_regex_pattern(self.url_match), # <<<<<<<<<<<<<< + * "exceptions": lambda: dict(sorted(self._rules.items())), + * "faster_heuristics": lambda: self.faster_heuristics, +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_5lambda8, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_url_match, __pyx_t_2) < (0)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":805 + * "token_match": lambda: _get_regex_pattern(self.token_match), + * "url_match": lambda: _get_regex_pattern(self.url_match), + * "exceptions": lambda: dict(sorted(self._rules.items())), # <<<<<<<<<<<<<< + * "faster_heuristics": lambda: self.faster_heuristics, + * } +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_6lambda9, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exceptions, __pyx_t_2) < (0)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":806 + * "url_match": lambda: _get_regex_pattern(self.url_match), + * "exceptions": lambda: dict(sorted(self._rules.items())), + * "faster_heuristics": lambda: self.faster_heuristics, # <<<<<<<<<<<<<< + * } + * return util.to_bytes(serializers, exclude) +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_8to_bytes_7lambda10, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 806, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_faster_heuristics, __pyx_t_2) < (0)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_serializers = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":808 + * "faster_heuristics": lambda: self.faster_heuristics, + * } + * return util.to_bytes(serializers, exclude) # <<<<<<<<<<<<<< + * + * def from_bytes(self, bytes_data, *, exclude=tuple()): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 808, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_to_bytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 808, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_serializers, __pyx_cur_scope->__pyx_v_exclude}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 808, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":790 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_serializers); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":810 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, bytes_data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_40from_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer_9Tokenizer_39from_bytes, "Tokenizer.from_bytes(self, bytes_data, *, exclude=tuple())\n\nLoad state from a binary string.\n\nbytes_data (bytes): The data to load from.\nexclude (list): String names of serialization fields to exclude.\nRETURNS (Tokenizer): The `Tokenizer` object.\n\nDOCS: https://spacy.io/api/tokenizer#from_bytes"); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_40from_bytes = {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_40from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_39from_bytes}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_40from_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_bytes_data = 0; + PyObject *__pyx_v_exclude = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_bytes (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_bytes_data,&__pyx_mstate_global->__pyx_n_u_exclude,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 810, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 810, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_bytes", 0) < (0)) __PYX_ERR(0, 810, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__10); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_bytes", 1, 1, 1, i); __PYX_ERR(0, 810, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 810, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__10); + } + __pyx_v_bytes_data = values[0]; + __pyx_v_exclude = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_bytes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 810, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_39from_bytes(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), __pyx_v_bytes_data, __pyx_v_exclude); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":821 + * data = {} + * deserializers = { + * "vocab": lambda b: self.vocab.from_bytes(b, exclude=exclude), # <<<<<<<<<<<<<< + * "prefix_search": lambda b: data.setdefault("prefix_search", b), + * "suffix_search": lambda b: data.setdefault("suffix_search", b), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_lambda11(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_lambda11 = {"lambda11", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_lambda11, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_lambda11(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda11 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 821, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 821, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda11", 0) < (0)) __PYX_ERR(0, 821, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda11", 1, 1, 1, i); __PYX_ERR(0, 821, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 821, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda11", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 821, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda11", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda11(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda11(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda11", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 821, __pyx_L1_error) } + __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->vocab); + __Pyx_INCREF(__pyx_t_2); + if (unlikely(!__pyx_cur_scope->__pyx_v_exclude)) { __Pyx_RaiseClosureNameError("exclude"); __PYX_ERR(0, 821, __pyx_L1_error) } + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_b}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_exclude, __pyx_cur_scope->__pyx_v_exclude, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 821, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda11", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":822 + * deserializers = { + * "vocab": lambda b: self.vocab.from_bytes(b, exclude=exclude), + * "prefix_search": lambda b: data.setdefault("prefix_search", b), # <<<<<<<<<<<<<< + * "suffix_search": lambda b: data.setdefault("suffix_search", b), + * "infix_finditer": lambda b: data.setdefault("infix_finditer", b), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_1lambda12(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_1lambda12 = {"lambda12", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_1lambda12, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_1lambda12(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda12 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 822, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 822, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda12", 0) < (0)) __PYX_ERR(0, 822, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda12", 1, 1, 1, i); __PYX_ERR(0, 822, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 822, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda12", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 822, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda12", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda12(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda12(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda12", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_data)) { __Pyx_RaiseClosureNameError("data"); __PYX_ERR(0, 822, __pyx_L1_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_data == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "setdefault"); + __PYX_ERR(0, 822, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyDict_SetDefault(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_prefix_search, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda12", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":823 + * "vocab": lambda b: self.vocab.from_bytes(b, exclude=exclude), + * "prefix_search": lambda b: data.setdefault("prefix_search", b), + * "suffix_search": lambda b: data.setdefault("suffix_search", b), # <<<<<<<<<<<<<< + * "infix_finditer": lambda b: data.setdefault("infix_finditer", b), + * "token_match": lambda b: data.setdefault("token_match", b), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_2lambda13(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_2lambda13 = {"lambda13", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_2lambda13, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_2lambda13(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda13 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 823, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 823, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda13", 0) < (0)) __PYX_ERR(0, 823, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda13", 1, 1, 1, i); __PYX_ERR(0, 823, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 823, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda13", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 823, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda13", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda13(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda13(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda13", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_data)) { __Pyx_RaiseClosureNameError("data"); __PYX_ERR(0, 823, __pyx_L1_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_data == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "setdefault"); + __PYX_ERR(0, 823, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyDict_SetDefault(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_suffix_search, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda13", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":824 + * "prefix_search": lambda b: data.setdefault("prefix_search", b), + * "suffix_search": lambda b: data.setdefault("suffix_search", b), + * "infix_finditer": lambda b: data.setdefault("infix_finditer", b), # <<<<<<<<<<<<<< + * "token_match": lambda b: data.setdefault("token_match", b), + * "url_match": lambda b: data.setdefault("url_match", b), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_3lambda14(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_3lambda14 = {"lambda14", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_3lambda14, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_3lambda14(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda14 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 824, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 824, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda14", 0) < (0)) __PYX_ERR(0, 824, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda14", 1, 1, 1, i); __PYX_ERR(0, 824, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 824, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda14", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 824, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda14", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda14(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda14(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda14", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_data)) { __Pyx_RaiseClosureNameError("data"); __PYX_ERR(0, 824, __pyx_L1_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_data == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "setdefault"); + __PYX_ERR(0, 824, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyDict_SetDefault(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_infix_finditer, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda14", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":825 + * "suffix_search": lambda b: data.setdefault("suffix_search", b), + * "infix_finditer": lambda b: data.setdefault("infix_finditer", b), + * "token_match": lambda b: data.setdefault("token_match", b), # <<<<<<<<<<<<<< + * "url_match": lambda b: data.setdefault("url_match", b), + * "exceptions": lambda b: data.setdefault("rules", b), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_4lambda15(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_4lambda15 = {"lambda15", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_4lambda15, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_4lambda15(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda15 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 825, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 825, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda15", 0) < (0)) __PYX_ERR(0, 825, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda15", 1, 1, 1, i); __PYX_ERR(0, 825, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 825, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda15", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 825, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda15", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda15(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda15(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda15", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_data)) { __Pyx_RaiseClosureNameError("data"); __PYX_ERR(0, 825, __pyx_L1_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_data == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "setdefault"); + __PYX_ERR(0, 825, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyDict_SetDefault(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_token_match, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 825, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda15", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":826 + * "infix_finditer": lambda b: data.setdefault("infix_finditer", b), + * "token_match": lambda b: data.setdefault("token_match", b), + * "url_match": lambda b: data.setdefault("url_match", b), # <<<<<<<<<<<<<< + * "exceptions": lambda b: data.setdefault("rules", b), + * "faster_heuristics": lambda b: data.setdefault("faster_heuristics", b), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_5lambda16(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_5lambda16 = {"lambda16", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_5lambda16, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_5lambda16(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda16 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 826, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 826, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda16", 0) < (0)) __PYX_ERR(0, 826, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda16", 1, 1, 1, i); __PYX_ERR(0, 826, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 826, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda16", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 826, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda16", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda16(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda16(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda16", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_data)) { __Pyx_RaiseClosureNameError("data"); __PYX_ERR(0, 826, __pyx_L1_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_data == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "setdefault"); + __PYX_ERR(0, 826, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyDict_SetDefault(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_url_match, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda16", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":827 + * "token_match": lambda b: data.setdefault("token_match", b), + * "url_match": lambda b: data.setdefault("url_match", b), + * "exceptions": lambda b: data.setdefault("rules", b), # <<<<<<<<<<<<<< + * "faster_heuristics": lambda b: data.setdefault("faster_heuristics", b), + * } +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_6lambda17(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_6lambda17 = {"lambda17", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_6lambda17, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_6lambda17(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda17 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 827, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 827, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda17", 0) < (0)) __PYX_ERR(0, 827, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda17", 1, 1, 1, i); __PYX_ERR(0, 827, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 827, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda17", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 827, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda17", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda17(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda17(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda17", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_data)) { __Pyx_RaiseClosureNameError("data"); __PYX_ERR(0, 827, __pyx_L1_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_data == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "setdefault"); + __PYX_ERR(0, 827, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyDict_SetDefault(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_rules, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda17", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":828 + * "url_match": lambda b: data.setdefault("url_match", b), + * "exceptions": lambda b: data.setdefault("rules", b), + * "faster_heuristics": lambda b: data.setdefault("faster_heuristics", b), # <<<<<<<<<<<<<< + * } + * # reset all properties and flush all caches (through rules), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_7lambda18(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_7lambda18 = {"lambda18", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_7lambda18, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_10from_bytes_7lambda18(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda18 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 828, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 828, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda18", 0) < (0)) __PYX_ERR(0, 828, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda18", 1, 1, 1, i); __PYX_ERR(0, 828, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 828, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda18", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 828, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda18", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda18(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda18(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda18", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_data)) { __Pyx_RaiseClosureNameError("data"); __PYX_ERR(0, 828, __pyx_L1_error) } + if (unlikely(__pyx_cur_scope->__pyx_v_data == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "setdefault"); + __PYX_ERR(0, 828, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyDict_SetDefault(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_faster_heuristics, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes.lambda18", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":810 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, bytes_data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_39from_bytes(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_bytes_data, PyObject *__pyx_v_exclude) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *__pyx_cur_scope; + PyObject *__pyx_v_deserializers = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_bytes", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 810, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_exclude = __pyx_v_exclude; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_exclude); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_exclude); + + /* "spacy/tokenizer.pyx":819 + * DOCS: https://spacy.io/api/tokenizer#from_bytes + * """ + * data = {} # <<<<<<<<<<<<<< + * deserializers = { + * "vocab": lambda b: self.vocab.from_bytes(b, exclude=exclude), +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 819, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_data = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":821 + * data = {} + * deserializers = { + * "vocab": lambda b: self.vocab.from_bytes(b, exclude=exclude), # <<<<<<<<<<<<<< + * "prefix_search": lambda b: data.setdefault("prefix_search", b), + * "suffix_search": lambda b: data.setdefault("suffix_search", b), +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_lambda11, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_vocab, __pyx_t_2) < (0)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":822 + * deserializers = { + * "vocab": lambda b: self.vocab.from_bytes(b, exclude=exclude), + * "prefix_search": lambda b: data.setdefault("prefix_search", b), # <<<<<<<<<<<<<< + * "suffix_search": lambda b: data.setdefault("suffix_search", b), + * "infix_finditer": lambda b: data.setdefault("infix_finditer", b), +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_1lambda12, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_prefix_search, __pyx_t_2) < (0)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":823 + * "vocab": lambda b: self.vocab.from_bytes(b, exclude=exclude), + * "prefix_search": lambda b: data.setdefault("prefix_search", b), + * "suffix_search": lambda b: data.setdefault("suffix_search", b), # <<<<<<<<<<<<<< + * "infix_finditer": lambda b: data.setdefault("infix_finditer", b), + * "token_match": lambda b: data.setdefault("token_match", b), +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_2lambda13, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_suffix_search, __pyx_t_2) < (0)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":824 + * "prefix_search": lambda b: data.setdefault("prefix_search", b), + * "suffix_search": lambda b: data.setdefault("suffix_search", b), + * "infix_finditer": lambda b: data.setdefault("infix_finditer", b), # <<<<<<<<<<<<<< + * "token_match": lambda b: data.setdefault("token_match", b), + * "url_match": lambda b: data.setdefault("url_match", b), +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_3lambda14, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_infix_finditer, __pyx_t_2) < (0)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":825 + * "suffix_search": lambda b: data.setdefault("suffix_search", b), + * "infix_finditer": lambda b: data.setdefault("infix_finditer", b), + * "token_match": lambda b: data.setdefault("token_match", b), # <<<<<<<<<<<<<< + * "url_match": lambda b: data.setdefault("url_match", b), + * "exceptions": lambda b: data.setdefault("rules", b), +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_4lambda15, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_token_match, __pyx_t_2) < (0)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":826 + * "infix_finditer": lambda b: data.setdefault("infix_finditer", b), + * "token_match": lambda b: data.setdefault("token_match", b), + * "url_match": lambda b: data.setdefault("url_match", b), # <<<<<<<<<<<<<< + * "exceptions": lambda b: data.setdefault("rules", b), + * "faster_heuristics": lambda b: data.setdefault("faster_heuristics", b), +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_5lambda16, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_url_match, __pyx_t_2) < (0)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":827 + * "token_match": lambda b: data.setdefault("token_match", b), + * "url_match": lambda b: data.setdefault("url_match", b), + * "exceptions": lambda b: data.setdefault("rules", b), # <<<<<<<<<<<<<< + * "faster_heuristics": lambda b: data.setdefault("faster_heuristics", b), + * } +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_6lambda17, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exceptions, __pyx_t_2) < (0)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/tokenizer.pyx":828 + * "url_match": lambda b: data.setdefault("url_match", b), + * "exceptions": lambda b: data.setdefault("rules", b), + * "faster_heuristics": lambda b: data.setdefault("faster_heuristics", b), # <<<<<<<<<<<<<< + * } + * # reset all properties and flush all caches (through rules), +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_10from_bytes_7lambda18, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_faster_heuristics, __pyx_t_2) < (0)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_deserializers = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":833 + * # reset rules first so that _reload_special_cases is trivial/fast as + * # the other properties are reset + * self.rules = {} # <<<<<<<<<<<<<< + * self.prefix_search = None + * self.suffix_search = None +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_rules, __pyx_t_1) < (0)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":834 + * # the other properties are reset + * self.rules = {} + * self.prefix_search = None # <<<<<<<<<<<<<< + * self.suffix_search = None + * self.infix_finditer = None +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_prefix_search, Py_None) < (0)) __PYX_ERR(0, 834, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":835 + * self.rules = {} + * self.prefix_search = None + * self.suffix_search = None # <<<<<<<<<<<<<< + * self.infix_finditer = None + * self.token_match = None +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_suffix_search, Py_None) < (0)) __PYX_ERR(0, 835, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":836 + * self.prefix_search = None + * self.suffix_search = None + * self.infix_finditer = None # <<<<<<<<<<<<<< + * self.token_match = None + * self.url_match = None +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_infix_finditer, Py_None) < (0)) __PYX_ERR(0, 836, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":837 + * self.suffix_search = None + * self.infix_finditer = None + * self.token_match = None # <<<<<<<<<<<<<< + * self.url_match = None + * util.from_bytes(bytes_data, deserializers, exclude) +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_token_match, Py_None) < (0)) __PYX_ERR(0, 837, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":838 + * self.infix_finditer = None + * self.token_match = None + * self.url_match = None # <<<<<<<<<<<<<< + * util.from_bytes(bytes_data, deserializers, exclude) + * if "prefix_search" in data and isinstance(data["prefix_search"], str): +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_url_match, Py_None) < (0)) __PYX_ERR(0, 838, __pyx_L1_error) + + /* "spacy/tokenizer.pyx":839 + * self.token_match = None + * self.url_match = None + * util.from_bytes(bytes_data, deserializers, exclude) # <<<<<<<<<<<<<< + * if "prefix_search" in data and isinstance(data["prefix_search"], str): + * self.prefix_search = re.compile(data["prefix_search"]).search +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 839, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_from_bytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 839, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_bytes_data, __pyx_v_deserializers, __pyx_cur_scope->__pyx_v_exclude}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":840 + * self.url_match = None + * util.from_bytes(bytes_data, deserializers, exclude) + * if "prefix_search" in data and isinstance(data["prefix_search"], str): # <<<<<<<<<<<<<< + * self.prefix_search = re.compile(data["prefix_search"]).search + * if "suffix_search" in data and isinstance(data["suffix_search"], str): +*/ + __pyx_t_7 = (__Pyx_PyDict_ContainsTF(__pyx_mstate_global->__pyx_n_u_prefix_search, __pyx_cur_scope->__pyx_v_data, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 840, __pyx_L1_error) + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_prefix_search); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyUnicode_Check(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __pyx_t_7; + __pyx_L4_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/tokenizer.pyx":841 + * util.from_bytes(bytes_data, deserializers, exclude) + * if "prefix_search" in data and isinstance(data["prefix_search"], str): + * self.prefix_search = re.compile(data["prefix_search"]).search # <<<<<<<<<<<<<< + * if "suffix_search" in data and isinstance(data["suffix_search"], str): + * self.suffix_search = re.compile(data["suffix_search"]).search +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_compile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_prefix_search); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_search); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_prefix_search, __pyx_t_3) < (0)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":840 + * self.url_match = None + * util.from_bytes(bytes_data, deserializers, exclude) + * if "prefix_search" in data and isinstance(data["prefix_search"], str): # <<<<<<<<<<<<<< + * self.prefix_search = re.compile(data["prefix_search"]).search + * if "suffix_search" in data and isinstance(data["suffix_search"], str): +*/ + } + + /* "spacy/tokenizer.pyx":842 + * if "prefix_search" in data and isinstance(data["prefix_search"], str): + * self.prefix_search = re.compile(data["prefix_search"]).search + * if "suffix_search" in data and isinstance(data["suffix_search"], str): # <<<<<<<<<<<<<< + * self.suffix_search = re.compile(data["suffix_search"]).search + * if "infix_finditer" in data and isinstance(data["infix_finditer"], str): +*/ + __pyx_t_7 = (__Pyx_PyDict_ContainsTF(__pyx_mstate_global->__pyx_n_u_suffix_search, __pyx_cur_scope->__pyx_v_data, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 842, __pyx_L1_error) + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_suffix_search); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 842, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyUnicode_Check(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __pyx_t_7; + __pyx_L7_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/tokenizer.pyx":843 + * self.prefix_search = re.compile(data["prefix_search"]).search + * if "suffix_search" in data and isinstance(data["suffix_search"], str): + * self.suffix_search = re.compile(data["suffix_search"]).search # <<<<<<<<<<<<<< + * if "infix_finditer" in data and isinstance(data["infix_finditer"], str): + * self.infix_finditer = re.compile(data["infix_finditer"]).finditer +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 843, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_compile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_suffix_search); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 843, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_2}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 843, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_search); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_suffix_search, __pyx_t_4) < (0)) __PYX_ERR(0, 843, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":842 + * if "prefix_search" in data and isinstance(data["prefix_search"], str): + * self.prefix_search = re.compile(data["prefix_search"]).search + * if "suffix_search" in data and isinstance(data["suffix_search"], str): # <<<<<<<<<<<<<< + * self.suffix_search = re.compile(data["suffix_search"]).search + * if "infix_finditer" in data and isinstance(data["infix_finditer"], str): +*/ + } + + /* "spacy/tokenizer.pyx":844 + * if "suffix_search" in data and isinstance(data["suffix_search"], str): + * self.suffix_search = re.compile(data["suffix_search"]).search + * if "infix_finditer" in data and isinstance(data["infix_finditer"], str): # <<<<<<<<<<<<<< + * self.infix_finditer = re.compile(data["infix_finditer"]).finditer + * if "token_match" in data and isinstance(data["token_match"], str): +*/ + __pyx_t_7 = (__Pyx_PyDict_ContainsTF(__pyx_mstate_global->__pyx_n_u_infix_finditer, __pyx_cur_scope->__pyx_v_data, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 844, __pyx_L1_error) + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L10_bool_binop_done; + } + __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_infix_finditer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 844, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyUnicode_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __pyx_t_7; + __pyx_L10_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/tokenizer.pyx":845 + * self.suffix_search = re.compile(data["suffix_search"]).search + * if "infix_finditer" in data and isinstance(data["infix_finditer"], str): + * self.infix_finditer = re.compile(data["infix_finditer"]).finditer # <<<<<<<<<<<<<< + * if "token_match" in data and isinstance(data["token_match"], str): + * self.token_match = re.compile(data["token_match"]).match +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_compile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_infix_finditer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_2}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_finditer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_infix_finditer, __pyx_t_1) < (0)) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/tokenizer.pyx":844 + * if "suffix_search" in data and isinstance(data["suffix_search"], str): + * self.suffix_search = re.compile(data["suffix_search"]).search + * if "infix_finditer" in data and isinstance(data["infix_finditer"], str): # <<<<<<<<<<<<<< + * self.infix_finditer = re.compile(data["infix_finditer"]).finditer + * if "token_match" in data and isinstance(data["token_match"], str): +*/ + } + + /* "spacy/tokenizer.pyx":846 + * if "infix_finditer" in data and isinstance(data["infix_finditer"], str): + * self.infix_finditer = re.compile(data["infix_finditer"]).finditer + * if "token_match" in data and isinstance(data["token_match"], str): # <<<<<<<<<<<<<< + * self.token_match = re.compile(data["token_match"]).match + * if "url_match" in data and isinstance(data["url_match"], str): +*/ + __pyx_t_7 = (__Pyx_PyDict_ContainsTF(__pyx_mstate_global->__pyx_n_u_token_match, __pyx_cur_scope->__pyx_v_data, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 846, __pyx_L1_error) + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L13_bool_binop_done; + } + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_token_match); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 846, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyUnicode_Check(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __pyx_t_7; + __pyx_L13_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/tokenizer.pyx":847 + * self.infix_finditer = re.compile(data["infix_finditer"]).finditer + * if "token_match" in data and isinstance(data["token_match"], str): + * self.token_match = re.compile(data["token_match"]).match # <<<<<<<<<<<<<< + * if "url_match" in data and isinstance(data["url_match"], str): + * self.url_match = re.compile(data["url_match"]).match +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_compile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_token_match); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_match); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_token_match, __pyx_t_3) < (0)) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/tokenizer.pyx":846 + * if "infix_finditer" in data and isinstance(data["infix_finditer"], str): + * self.infix_finditer = re.compile(data["infix_finditer"]).finditer + * if "token_match" in data and isinstance(data["token_match"], str): # <<<<<<<<<<<<<< + * self.token_match = re.compile(data["token_match"]).match + * if "url_match" in data and isinstance(data["url_match"], str): +*/ + } + + /* "spacy/tokenizer.pyx":848 + * if "token_match" in data and isinstance(data["token_match"], str): + * self.token_match = re.compile(data["token_match"]).match + * if "url_match" in data and isinstance(data["url_match"], str): # <<<<<<<<<<<<<< + * self.url_match = re.compile(data["url_match"]).match + * if "faster_heuristics" in data: +*/ + __pyx_t_7 = (__Pyx_PyDict_ContainsTF(__pyx_mstate_global->__pyx_n_u_url_match, __pyx_cur_scope->__pyx_v_data, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 848, __pyx_L1_error) + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L16_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_url_match); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyUnicode_Check(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __pyx_t_7; + __pyx_L16_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/tokenizer.pyx":849 + * self.token_match = re.compile(data["token_match"]).match + * if "url_match" in data and isinstance(data["url_match"], str): + * self.url_match = re.compile(data["url_match"]).match # <<<<<<<<<<<<<< + * if "faster_heuristics" in data: + * self.faster_heuristics = data["faster_heuristics"] +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_compile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 849, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_url_match); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_2}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 849, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_match); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 849, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_url_match, __pyx_t_4) < (0)) __PYX_ERR(0, 849, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":848 + * if "token_match" in data and isinstance(data["token_match"], str): + * self.token_match = re.compile(data["token_match"]).match + * if "url_match" in data and isinstance(data["url_match"], str): # <<<<<<<<<<<<<< + * self.url_match = re.compile(data["url_match"]).match + * if "faster_heuristics" in data: +*/ + } + + /* "spacy/tokenizer.pyx":850 + * if "url_match" in data and isinstance(data["url_match"], str): + * self.url_match = re.compile(data["url_match"]).match + * if "faster_heuristics" in data: # <<<<<<<<<<<<<< + * self.faster_heuristics = data["faster_heuristics"] + * # always load rules last so that all other settings are set before the +*/ + __pyx_t_6 = (__Pyx_PyDict_ContainsTF(__pyx_mstate_global->__pyx_n_u_faster_heuristics, __pyx_cur_scope->__pyx_v_data, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 850, __pyx_L1_error) + if (__pyx_t_6) { + + /* "spacy/tokenizer.pyx":851 + * self.url_match = re.compile(data["url_match"]).match + * if "faster_heuristics" in data: + * self.faster_heuristics = data["faster_heuristics"] # <<<<<<<<<<<<<< + * # always load rules last so that all other settings are set before the + * # internal tokenization for the phrase matcher +*/ + __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_faster_heuristics); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 851, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_faster_heuristics, __pyx_t_4) < (0)) __PYX_ERR(0, 851, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":850 + * if "url_match" in data and isinstance(data["url_match"], str): + * self.url_match = re.compile(data["url_match"]).match + * if "faster_heuristics" in data: # <<<<<<<<<<<<<< + * self.faster_heuristics = data["faster_heuristics"] + * # always load rules last so that all other settings are set before the +*/ + } + + /* "spacy/tokenizer.pyx":854 + * # always load rules last so that all other settings are set before the + * # internal tokenization for the phrase matcher + * if "rules" in data and isinstance(data["rules"], dict): # <<<<<<<<<<<<<< + * self.rules = data["rules"] + * return self +*/ + __pyx_t_7 = (__Pyx_PyDict_ContainsTF(__pyx_mstate_global->__pyx_n_u_rules, __pyx_cur_scope->__pyx_v_data, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 854, __pyx_L1_error) + if (__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L20_bool_binop_done; + } + __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_rules); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 854, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyDict_Check(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __pyx_t_7; + __pyx_L20_bool_binop_done:; + if (__pyx_t_6) { + + /* "spacy/tokenizer.pyx":855 + * # internal tokenization for the phrase matcher + * if "rules" in data and isinstance(data["rules"], dict): + * self.rules = data["rules"] # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_mstate_global->__pyx_n_u_rules); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 855, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_rules, __pyx_t_4) < (0)) __PYX_ERR(0, 855, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":854 + * # always load rules last so that all other settings are set before the + * # internal tokenization for the phrase matcher + * if "rules" in data and isinstance(data["rules"], dict): # <<<<<<<<<<<<<< + * self.rules = data["rules"] + * return self +*/ + } + + /* "spacy/tokenizer.pyx":856 + * if "rules" in data and isinstance(data["rules"], dict): + * self.rules = data["rules"] + * return self # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":810 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, bytes_data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_deserializers); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pxd":17 + * cdef PreshMap _cache + * cdef PreshMap _specials + * cdef readonly Vocab vocab # <<<<<<<<<<<<<< + * + * cdef object _token_match +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_5vocab_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_5vocab_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_5vocab___get__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_5vocab___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self->vocab); + __pyx_r = ((PyObject *)__pyx_v_self->vocab); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pxd":28 + * # TODO convert to bool in v4 + * cdef int _faster_heuristics + * cdef public int max_cache_size # <<<<<<<<<<<<<< + * + * cdef Doc _tokenize_affixes(self, str string, bint with_special_cases) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_14max_cache_size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_9tokenizer_9Tokenizer_14max_cache_size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_14max_cache_size___get__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer_9Tokenizer_14max_cache_size___get__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->max_cache_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.max_cache_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_14max_cache_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_9tokenizer_9Tokenizer_14max_cache_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_9tokenizer_9Tokenizer_14max_cache_size_2__set__(((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_9tokenizer_9Tokenizer_14max_cache_size_2__set__(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 28, __pyx_L1_error) + __pyx_v_self->max_cache_size = __pyx_t_1; + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.tokenizer.Tokenizer.max_cache_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":859 + * + * + * def _get_regex_pattern(regex): # <<<<<<<<<<<<<< + * """Get a pattern string for a regex, or None if the pattern is None.""" + * return None if regex is None else regex.__self__.pattern +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_9tokenizer_1_get_regex_pattern(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_9tokenizer__get_regex_pattern, "_get_regex_pattern(regex)\n\nGet a pattern string for a regex, or None if the pattern is None."); +static PyMethodDef __pyx_mdef_5spacy_9tokenizer_1_get_regex_pattern = {"_get_regex_pattern", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_1_get_regex_pattern, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer__get_regex_pattern}; +static PyObject *__pyx_pw_5spacy_9tokenizer_1_get_regex_pattern(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_regex = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_regex_pattern (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_regex,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 859, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 859, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_regex_pattern", 0) < (0)) __PYX_ERR(0, 859, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_regex_pattern", 1, 1, 1, i); __PYX_ERR(0, 859, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 859, __pyx_L3_error) + } + __pyx_v_regex = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_get_regex_pattern", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 859, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.tokenizer._get_regex_pattern", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_9tokenizer__get_regex_pattern(__pyx_self, __pyx_v_regex); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_9tokenizer__get_regex_pattern(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_regex) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_regex_pattern", 0); + + /* "spacy/tokenizer.pyx":861 + * def _get_regex_pattern(regex): + * """Get a pattern string for a regex, or None if the pattern is None.""" + * return None if regex is None else regex.__self__.pattern # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = (__pyx_v_regex == Py_None); + if (__pyx_t_2) { + __Pyx_INCREF(Py_None); + __pyx_t_1 = Py_None; + } else { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_regex, __pyx_mstate_global->__pyx_n_u_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 861, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pattern); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 861, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":859 + * + * + * def _get_regex_pattern(regex): # <<<<<<<<<<<<<< + * """Get a pattern string for a regex, or None if the pattern is None.""" + * return None if regex is None else regex.__self__.pattern +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.tokenizer._get_regex_pattern", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":870 + * + * + * cdef bint len_start_cmp(SpanC a, SpanC b) noexcept nogil: # <<<<<<<<<<<<<< + * if a.end - a.start == b.end - b.start: + * return b.start < a.start +*/ + +static int __pyx_f_5spacy_9tokenizer_len_start_cmp(struct __pyx_t_5spacy_7structs_SpanC __pyx_v_a, struct __pyx_t_5spacy_7structs_SpanC __pyx_v_b) { + int __pyx_r; + int __pyx_t_1; + + /* "spacy/tokenizer.pyx":871 + * + * cdef bint len_start_cmp(SpanC a, SpanC b) noexcept nogil: + * if a.end - a.start == b.end - b.start: # <<<<<<<<<<<<<< + * return b.start < a.start + * return a.end - a.start < b.end - b.start +*/ + __pyx_t_1 = ((__pyx_v_a.end - __pyx_v_a.start) == (__pyx_v_b.end - __pyx_v_b.start)); + if (__pyx_t_1) { + + /* "spacy/tokenizer.pyx":872 + * cdef bint len_start_cmp(SpanC a, SpanC b) noexcept nogil: + * if a.end - a.start == b.end - b.start: + * return b.start < a.start # <<<<<<<<<<<<<< + * return a.end - a.start < b.end - b.start + * +*/ + __pyx_r = (__pyx_v_b.start < __pyx_v_a.start); + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":871 + * + * cdef bint len_start_cmp(SpanC a, SpanC b) noexcept nogil: + * if a.end - a.start == b.end - b.start: # <<<<<<<<<<<<<< + * return b.start < a.start + * return a.end - a.start < b.end - b.start +*/ + } + + /* "spacy/tokenizer.pyx":873 + * if a.end - a.start == b.end - b.start: + * return b.start < a.start + * return a.end - a.start < b.end - b.start # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((__pyx_v_a.end - __pyx_v_a.start) < (__pyx_v_b.end - __pyx_v_b.start)); + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":870 + * + * + * cdef bint len_start_cmp(SpanC a, SpanC b) noexcept nogil: # <<<<<<<<<<<<<< + * if a.end - a.start == b.end - b.start: + * return b.start < a.start +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/tokenizer.pyx":876 + * + * + * cdef bint start_cmp(SpanC a, SpanC b) noexcept nogil: # <<<<<<<<<<<<<< + * return a.start < b.start +*/ + +static int __pyx_f_5spacy_9tokenizer_start_cmp(struct __pyx_t_5spacy_7structs_SpanC __pyx_v_a, struct __pyx_t_5spacy_7structs_SpanC __pyx_v_b) { + int __pyx_r; + + /* "spacy/tokenizer.pyx":877 + * + * cdef bint start_cmp(SpanC a, SpanC b) noexcept nogil: + * return a.start < b.start # <<<<<<<<<<<<<< +*/ + __pyx_r = (__pyx_v_a.start < __pyx_v_b.start); + goto __pyx_L0; + + /* "spacy/tokenizer.pyx":876 + * + * + * cdef bint start_cmp(SpanC a, SpanC b) noexcept nogil: # <<<<<<<<<<<<<< + * return a.start < b.start +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ +static struct __pyx_vtabstruct_5spacy_9tokenizer_Tokenizer __pyx_vtable_5spacy_9tokenizer_Tokenizer; + +static PyObject *__pyx_tp_new_5spacy_9tokenizer_Tokenizer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_9tokenizer_Tokenizer *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_9tokenizer_Tokenizer; + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + p->_cache = ((struct __pyx_obj_7preshed_4maps_PreshMap *)Py_None); Py_INCREF(Py_None); + p->_specials = ((struct __pyx_obj_7preshed_4maps_PreshMap *)Py_None); Py_INCREF(Py_None); + p->vocab = ((struct __pyx_obj_5spacy_5vocab_Vocab *)Py_None); Py_INCREF(Py_None); + p->_token_match = Py_None; Py_INCREF(Py_None); + p->_url_match = Py_None; Py_INCREF(Py_None); + p->_prefix_search = Py_None; Py_INCREF(Py_None); + p->_suffix_search = Py_None; Py_INCREF(Py_None); + p->_infix_finditer = Py_None; Py_INCREF(Py_None); + p->_rules = Py_None; Py_INCREF(Py_None); + p->_special_matcher = ((struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5spacy_9tokenizer_Tokenizer(PyObject *o) { + struct __pyx_obj_5spacy_9tokenizer_Tokenizer *p = (struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_9tokenizer_Tokenizer) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->mem); + Py_CLEAR(p->_cache); + Py_CLEAR(p->_specials); + Py_CLEAR(p->vocab); + Py_CLEAR(p->_token_match); + Py_CLEAR(p->_url_match); + Py_CLEAR(p->_prefix_search); + Py_CLEAR(p->_suffix_search); + Py_CLEAR(p->_infix_finditer); + Py_CLEAR(p->_rules); + Py_CLEAR(p->_special_matcher); + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static int __pyx_tp_traverse_5spacy_9tokenizer_Tokenizer(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_9tokenizer_Tokenizer *p = (struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->mem) { + e = (*v)(((PyObject *)p->mem), a); if (e) return e; + } + if (p->_cache) { + e = (*v)(((PyObject *)p->_cache), a); if (e) return e; + } + if (p->_specials) { + e = (*v)(((PyObject *)p->_specials), a); if (e) return e; + } + if (p->vocab) { + e = (*v)(((PyObject *)p->vocab), a); if (e) return e; + } + if (p->_token_match) { + e = (*v)(p->_token_match, a); if (e) return e; + } + if (p->_url_match) { + e = (*v)(p->_url_match, a); if (e) return e; + } + if (p->_prefix_search) { + e = (*v)(p->_prefix_search, a); if (e) return e; + } + if (p->_suffix_search) { + e = (*v)(p->_suffix_search, a); if (e) return e; + } + if (p->_infix_finditer) { + e = (*v)(p->_infix_finditer, a); if (e) return e; + } + if (p->_rules) { + e = (*v)(p->_rules, a); if (e) return e; + } + if (p->_special_matcher) { + e = (*v)(((PyObject *)p->_special_matcher), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_9tokenizer_Tokenizer(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_9tokenizer_Tokenizer *p = (struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)o; + tmp = ((PyObject*)p->mem); + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_cache); + p->_cache = ((struct __pyx_obj_7preshed_4maps_PreshMap *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_specials); + p->_specials = ((struct __pyx_obj_7preshed_4maps_PreshMap *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->vocab); + p->vocab = ((struct __pyx_obj_5spacy_5vocab_Vocab *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_token_match); + p->_token_match = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_url_match); + p->_url_match = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_prefix_search); + p->_prefix_search = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_suffix_search); + p->_suffix_search = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_infix_finditer); + p->_infix_finditer = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_rules); + p->_rules = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_special_matcher); + p->_special_matcher = ((struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_5spacy_9tokenizer_9Tokenizer_token_match(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_11token_match_1__get__(o); +} + +static int __pyx_setprop_5spacy_9tokenizer_9Tokenizer_token_match(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_11token_match_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_9tokenizer_9Tokenizer_url_match(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_9url_match_1__get__(o); +} + +static int __pyx_setprop_5spacy_9tokenizer_9Tokenizer_url_match(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_9url_match_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_9tokenizer_9Tokenizer_prefix_search(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_13prefix_search_1__get__(o); +} + +static int __pyx_setprop_5spacy_9tokenizer_9Tokenizer_prefix_search(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_13prefix_search_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_9tokenizer_9Tokenizer_suffix_search(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_13suffix_search_1__get__(o); +} + +static int __pyx_setprop_5spacy_9tokenizer_9Tokenizer_suffix_search(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_13suffix_search_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_9tokenizer_9Tokenizer_infix_finditer(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_14infix_finditer_1__get__(o); +} + +static int __pyx_setprop_5spacy_9tokenizer_9Tokenizer_infix_finditer(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_14infix_finditer_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_9tokenizer_9Tokenizer_rules(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_5rules_1__get__(o); +} + +static int __pyx_setprop_5spacy_9tokenizer_9Tokenizer_rules(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_5rules_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_9tokenizer_9Tokenizer_faster_heuristics(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_17faster_heuristics_1__get__(o); +} + +static int __pyx_setprop_5spacy_9tokenizer_9Tokenizer_faster_heuristics(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_17faster_heuristics_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_9tokenizer_9Tokenizer_vocab(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_5vocab_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_9tokenizer_9Tokenizer_max_cache_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_14max_cache_size_1__get__(o); +} + +static int __pyx_setprop_5spacy_9tokenizer_9Tokenizer_max_cache_size(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_9tokenizer_9Tokenizer_14max_cache_size_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_5spacy_9tokenizer_Tokenizer[] = { + {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_3__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_2__reduce__}, + {"pipe", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_7pipe, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_6pipe}, + {"_flush_cache", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_10_flush_cache, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_9_flush_cache}, + {"_reset_cache", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_12_reset_cache, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_11_reset_cache}, + {"_flush_specials", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_14_flush_specials, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_13_flush_specials}, + {"find_infix", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_16find_infix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_15find_infix}, + {"find_prefix", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_18find_prefix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_17find_prefix}, + {"find_suffix", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_20find_suffix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_19find_suffix}, + {"_load_special_cases", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_22_load_special_cases, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_21_load_special_cases}, + {"_validate_special_case", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_24_validate_special_case, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_23_validate_special_case}, + {"add_special_case", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_26add_special_case, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_25add_special_case}, + {"_reload_special_cases", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_28_reload_special_cases, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_27_reload_special_cases}, + {"explain", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_30explain, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_29explain}, + {"score", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_32score, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_31score}, + {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_34to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_33to_disk}, + {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_36from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_35from_disk}, + {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_38to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_37to_bytes}, + {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_9tokenizer_9Tokenizer_40from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_9tokenizer_9Tokenizer_39from_bytes}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5spacy_9tokenizer_Tokenizer[] = { + {"token_match", __pyx_getprop_5spacy_9tokenizer_9Tokenizer_token_match, __pyx_setprop_5spacy_9tokenizer_9Tokenizer_token_match, 0, 0}, + {"url_match", __pyx_getprop_5spacy_9tokenizer_9Tokenizer_url_match, __pyx_setprop_5spacy_9tokenizer_9Tokenizer_url_match, 0, 0}, + {"prefix_search", __pyx_getprop_5spacy_9tokenizer_9Tokenizer_prefix_search, __pyx_setprop_5spacy_9tokenizer_9Tokenizer_prefix_search, 0, 0}, + {"suffix_search", __pyx_getprop_5spacy_9tokenizer_9Tokenizer_suffix_search, __pyx_setprop_5spacy_9tokenizer_9Tokenizer_suffix_search, 0, 0}, + {"infix_finditer", __pyx_getprop_5spacy_9tokenizer_9Tokenizer_infix_finditer, __pyx_setprop_5spacy_9tokenizer_9Tokenizer_infix_finditer, 0, 0}, + {"rules", __pyx_getprop_5spacy_9tokenizer_9Tokenizer_rules, __pyx_setprop_5spacy_9tokenizer_9Tokenizer_rules, 0, 0}, + {"faster_heuristics", __pyx_getprop_5spacy_9tokenizer_9Tokenizer_faster_heuristics, __pyx_setprop_5spacy_9tokenizer_9Tokenizer_faster_heuristics, 0, 0}, + {"vocab", __pyx_getprop_5spacy_9tokenizer_9Tokenizer_vocab, 0, 0, 0}, + {"max_cache_size", __pyx_getprop_5spacy_9tokenizer_9Tokenizer_max_cache_size, __pyx_setprop_5spacy_9tokenizer_9Tokenizer_max_cache_size, PyDoc_STR("max_cache_size: 'int'"), 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_9tokenizer_Tokenizer_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_9tokenizer_Tokenizer}, + {Py_tp_call, (void *)__pyx_pw_5spacy_9tokenizer_9Tokenizer_5__call__}, + {Py_tp_doc, (void *)PyDoc_STR("Tokenizer(Vocab vocab, rules=None, prefix_search=None, suffix_search=None, infix_finditer=None, token_match=None, url_match=None, faster_heuristics=True, max_cache_size=10000)\n\nSegment text, and create Doc objects with the discovered segment\nboundaries.\n\nDOCS: https://spacy.io/api/tokenizer")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_9tokenizer_Tokenizer}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_9tokenizer_Tokenizer}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_9tokenizer_Tokenizer}, + {Py_tp_getset, (void *)__pyx_getsets_5spacy_9tokenizer_Tokenizer}, + {Py_tp_init, (void *)__pyx_pw_5spacy_9tokenizer_9Tokenizer_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_9tokenizer_Tokenizer}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_9tokenizer_Tokenizer_spec = { + "spacy.tokenizer.Tokenizer", + sizeof(struct __pyx_obj_5spacy_9tokenizer_Tokenizer), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_9tokenizer_Tokenizer_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_9tokenizer_Tokenizer = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.tokenizer.""Tokenizer", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_9tokenizer_Tokenizer), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_9tokenizer_Tokenizer, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __pyx_pw_5spacy_9tokenizer_9Tokenizer_5__call__, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + PyDoc_STR("Tokenizer(Vocab vocab, rules=None, prefix_search=None, suffix_search=None, infix_finditer=None, token_match=None, url_match=None, faster_heuristics=True, max_cache_size=10000)\n\nSegment text, and create Doc objects with the discovered segment\nboundaries.\n\nDOCS: https://spacy.io/api/tokenizer"), /*tp_doc*/ + __pyx_tp_traverse_5spacy_9tokenizer_Tokenizer, /*tp_traverse*/ + __pyx_tp_clear_5spacy_9tokenizer_Tokenizer, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_9tokenizer_Tokenizer, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5spacy_9tokenizer_Tokenizer, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_5spacy_9tokenizer_9Tokenizer_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_9tokenizer_Tokenizer, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct__pipe(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct__pipe > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct__pipe[--__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct__pipe]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct__pipe(PyObject *o) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct__pipe) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_batch_size); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_text); + Py_CLEAR(p->__pyx_v_texts); + Py_CLEAR(p->__pyx_t_0); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct__pipe < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct__pipe[__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct__pipe++] = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct__pipe(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_batch_size) { + e = (*v)(p->__pyx_v_batch_size, a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + if (p->__pyx_v_text) { + e = (*v)(p->__pyx_v_text, a); if (e) return e; + } + if (p->__pyx_v_texts) { + e = (*v)(p->__pyx_v_texts, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_9tokenizer___pyx_scope_struct__pipe_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct__pipe}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct__pipe}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct__pipe}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_9tokenizer___pyx_scope_struct__pipe_spec = { + "spacy.tokenizer.__pyx_scope_struct__pipe", + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_9tokenizer___pyx_scope_struct__pipe_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_9tokenizer___pyx_scope_struct__pipe = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.tokenizer.""__pyx_scope_struct__pipe", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct__pipe), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct__pipe, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct__pipe, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct__pipe, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_1_explain(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_1_explain > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_1_explain[--__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_1_explain]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_1_explain(PyObject *o) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_1_explain) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_1_explain < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_1_explain[__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_1_explain++] = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_1_explain(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_9tokenizer___pyx_scope_struct_1_explain(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain *)o; + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_9tokenizer___pyx_scope_struct_1_explain_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_1_explain}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_1_explain}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_9tokenizer___pyx_scope_struct_1_explain}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_1_explain}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_9tokenizer___pyx_scope_struct_1_explain_spec = { + "spacy.tokenizer.__pyx_scope_struct_1_explain", + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_9tokenizer___pyx_scope_struct_1_explain_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_9tokenizer___pyx_scope_struct_1_explain = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.tokenizer.""__pyx_scope_struct_1_explain", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_1_explain), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_1_explain, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_1_explain, /*tp_traverse*/ + __pyx_tp_clear_5spacy_9tokenizer___pyx_scope_struct_1_explain, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_1_explain, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_2_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_2_genexpr[--__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_2_genexpr]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_2_genexpr(PyObject *o) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_2_genexpr) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_genexpr_arg_0); + Py_CLEAR(p->__pyx_v_e); + Py_CLEAR(p->__pyx_v_i); + Py_CLEAR(p->__pyx_t_0); + Py_CLEAR(p->__pyx_t_1); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_2_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_2_genexpr[__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_genexpr_arg_0) { + e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e; + } + if (p->__pyx_v_e) { + e = (*v)(p->__pyx_v_e, a); if (e) return e; + } + if (p->__pyx_v_i) { + e = (*v)(p->__pyx_v_i, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + if (p->__pyx_t_1) { + e = (*v)(p->__pyx_t_1, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_9tokenizer___pyx_scope_struct_2_genexpr_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_2_genexpr}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_2_genexpr}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_2_genexpr}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_9tokenizer___pyx_scope_struct_2_genexpr_spec = { + "spacy.tokenizer.__pyx_scope_struct_2_genexpr", + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_9tokenizer___pyx_scope_struct_2_genexpr_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_9tokenizer___pyx_scope_struct_2_genexpr = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.tokenizer.""__pyx_scope_struct_2_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_2_genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_2_genexpr, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_2_genexpr, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_2_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_3_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_3_genexpr[--__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_3_genexpr]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_3_genexpr(PyObject *o) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_3_genexpr) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_genexpr_arg_0); + Py_CLEAR(p->__pyx_v_e); + Py_CLEAR(p->__pyx_v_i); + Py_CLEAR(p->__pyx_t_0); + Py_CLEAR(p->__pyx_t_1); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_3_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_3_genexpr[__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_genexpr_arg_0) { + e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e; + } + if (p->__pyx_v_e) { + e = (*v)(p->__pyx_v_e, a); if (e) return e; + } + if (p->__pyx_v_i) { + e = (*v)(p->__pyx_v_i, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + if (p->__pyx_t_1) { + e = (*v)(p->__pyx_t_1, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_9tokenizer___pyx_scope_struct_3_genexpr_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_3_genexpr}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_3_genexpr}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_3_genexpr}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_9tokenizer___pyx_scope_struct_3_genexpr_spec = { + "spacy.tokenizer.__pyx_scope_struct_3_genexpr", + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_9tokenizer___pyx_scope_struct_3_genexpr_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_9tokenizer___pyx_scope_struct_3_genexpr = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.tokenizer.""__pyx_scope_struct_3_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_3_genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_3_genexpr, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_3_genexpr, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_3_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_4_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_4_genexpr[--__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_4_genexpr]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_4_genexpr(PyObject *o) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_4_genexpr) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_genexpr_arg_0); + Py_CLEAR(p->__pyx_v_e); + Py_CLEAR(p->__pyx_v_i); + Py_CLEAR(p->__pyx_t_0); + Py_CLEAR(p->__pyx_t_1); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_4_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_4_genexpr[__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_genexpr_arg_0) { + e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e; + } + if (p->__pyx_v_e) { + e = (*v)(p->__pyx_v_e, a); if (e) return e; + } + if (p->__pyx_v_i) { + e = (*v)(p->__pyx_v_i, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + if (p->__pyx_t_1) { + e = (*v)(p->__pyx_t_1, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_9tokenizer___pyx_scope_struct_4_genexpr_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_4_genexpr}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_4_genexpr}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_4_genexpr}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_9tokenizer___pyx_scope_struct_4_genexpr_spec = { + "spacy.tokenizer.__pyx_scope_struct_4_genexpr", + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_9tokenizer___pyx_scope_struct_4_genexpr_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_9tokenizer___pyx_scope_struct_4_genexpr = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.tokenizer.""__pyx_scope_struct_4_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_4_genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_4_genexpr, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_4_genexpr, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_4_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes[--__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes(PyObject *o) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_exclude); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes[__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes++] = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_exclude) { + e = (*v)(p->__pyx_v_exclude, a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes *)o; + tmp = ((PyObject*)p->__pyx_v_exclude); + p->__pyx_v_exclude = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes_spec = { + "spacy.tokenizer.__pyx_scope_struct_5_to_bytes", + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.tokenizer.""__pyx_scope_struct_5_to_bytes", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes, /*tp_traverse*/ + __pyx_tp_clear_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes[--__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes(PyObject *o) { + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_data); + Py_CLEAR(p->__pyx_v_exclude); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes, sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes[__pyx_mstate_global->__pyx_freecount_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes++] = ((struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_data) { + e = (*v)(p->__pyx_v_data, a); if (e) return e; + } + if (p->__pyx_v_exclude) { + e = (*v)(p->__pyx_v_exclude, a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *p = (struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes *)o; + tmp = ((PyObject*)p->__pyx_v_data); + p->__pyx_v_data = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_exclude); + p->__pyx_v_exclude = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_5spacy_9tokenizer_Tokenizer *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes_spec = { + "spacy.tokenizer.__pyx_scope_struct_6_from_bytes", + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.tokenizer.""__pyx_scope_struct_6_from_bytes", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes, /*tp_traverse*/ + __pyx_tp_clear_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif +static struct __pyx_vtabstruct_array __pyx_vtable_array; + +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_array___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "spacy.tokenizer.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_array = { + __pyx_array___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_array = { + __pyx_array___len__, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.tokenizer.""array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_array, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_array, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_array, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_array, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_MemviewEnum_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_MemviewEnum_obj *)o); + p->name = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_Enum(PyObject *o) { + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_Enum(PyObject *o) { + PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_Enum[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "spacy.tokenizer.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_MemviewEnum_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_MemviewEnum = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.tokenizer.""Enum", /*tp_name*/ + sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_Enum, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_MemviewEnum___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_Enum, /*tp_traverse*/ + __pyx_tp_clear_Enum, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_Enum, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_MemviewEnum___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_Enum, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif +static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; + +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryview_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryview_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_memoryview; + p->obj = Py_None; Py_INCREF(Py_None); + p->_size = Py_None; Py_INCREF(Py_None); + p->view.obj = NULL; + if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_memoryview(PyObject *o) { + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_memoryview___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->obj); + Py_CLEAR(p->_size); + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->obj) { + e = (*v)(p->obj, a); if (e) return e; + } + if (p->_size) { + e = (*v)(p->_size, a); if (e) return e; + } + if (p->view.obj) { + e = (*v)(p->view.obj, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_memoryview(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + tmp = ((PyObject*)p->obj); + p->obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_size); + p->_size = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + Py_CLEAR(p->view.obj); + return 0; +} + +static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_memoryview___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); +} + +static PyMethodDef __pyx_methods_memoryview[] = { + {"is_c_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_memoryview[] = { + {"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0}, + {"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0}, + {"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0}, + {"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0}, + {"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0}, + {"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0}, + {"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0}, + {"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0}, + {"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "spacy.tokenizer.memoryview", + sizeof(struct __pyx_memoryview_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_memoryview_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_memoryview = { + __pyx_memoryview___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_memoryview, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_memoryview = { + __pyx_memoryview___len__, /*mp_length*/ + __pyx_memoryview___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_memoryview = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.tokenizer.""memoryview", /*tp_name*/ + sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_memoryview___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_memoryview___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_memoryview, /*tp_traverse*/ + __pyx_tp_clear_memoryview, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_memoryview, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_memoryview, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_memoryview, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif +static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; + +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryviewslice_obj *p; + PyObject *o = __pyx_tp_new_memoryview(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryviewslice_obj *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + __Pyx_default_placement_construct(&(p->from_slice)); + p->from_object = Py_None; Py_INCREF(Py_None); + p->from_slice.memview = NULL; + return o; +} + +static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_memoryviewslice___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->from_slice); + Py_CLEAR(p->from_object); + PyObject_GC_Track(o); + __pyx_tp_dealloc_memoryview(o); +} + +static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; + if (p->from_object) { + e = (*v)(p->from_object, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear__memoryviewslice(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + __pyx_tp_clear_memoryview(o); + tmp = ((PyObject*)p->from_object); + p->from_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); + return 0; +} + +static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "spacy.tokenizer._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_memoryviewslice = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.tokenizer.""_memoryviewslice", /*tp_name*/ + sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ + __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ + __pyx_tp_clear__memoryviewslice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods__memoryviewslice, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new__memoryviewslice, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +/* #### Code section: initfunc_declarations ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ +/* #### Code section: init_module ### */ + +static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); + generic = Py_None; Py_INCREF(Py_None); + strided = Py_None; Py_INCREF(Py_None); + indirect = Py_None; Py_INCREF(Py_None); + contiguous = Py_None; Py_INCREF(Py_None); + indirect_contiguous = Py_None; Py_INCREF(Py_None); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_5spacy_9tokenizer_Tokenizer = &__pyx_vtable_5spacy_9tokenizer_Tokenizer; + __pyx_vtable_5spacy_9tokenizer_Tokenizer._tokenize_affixes = (struct __pyx_obj_5spacy_6tokens_3doc_Doc *(*)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, PyObject *, int))__pyx_f_5spacy_9tokenizer_9Tokenizer__tokenize_affixes; + __pyx_vtable_5spacy_9tokenizer_Tokenizer._apply_special_cases = (int (*)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *))__pyx_f_5spacy_9tokenizer_9Tokenizer__apply_special_cases; + __pyx_vtable_5spacy_9tokenizer_Tokenizer._filter_special_spans = (void (*)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, std::vector &, std::vector &, int))__pyx_f_5spacy_9tokenizer_9Tokenizer__filter_special_spans; + __pyx_vtable_5spacy_9tokenizer_Tokenizer._prepare_special_spans = (PyObject *(*)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *, std::vector &))__pyx_f_5spacy_9tokenizer_9Tokenizer__prepare_special_spans; + __pyx_vtable_5spacy_9tokenizer_Tokenizer._retokenize_special_spans = (int (*)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *, struct __pyx_t_5spacy_7structs_TokenC *, PyObject *))__pyx_f_5spacy_9tokenizer_9Tokenizer__retokenize_special_spans; + __pyx_vtable_5spacy_9tokenizer_Tokenizer._try_specials_and_cache = (int (*)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_obj_5spacy_6tokens_3doc_Doc *, int *, int))__pyx_f_5spacy_9tokenizer_9Tokenizer__try_specials_and_cache; + __pyx_vtable_5spacy_9tokenizer_Tokenizer._tokenize = (int (*)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *, PyObject *, __pyx_t_5spacy_8typedefs_hash_t, int *, int))__pyx_f_5spacy_9tokenizer_9Tokenizer__tokenize; + __pyx_vtable_5spacy_9tokenizer_Tokenizer._split_affixes = (PyObject *(*)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *, std::vector *, std::vector *, int *, int))__pyx_f_5spacy_9tokenizer_9Tokenizer__split_affixes; + __pyx_vtable_5spacy_9tokenizer_Tokenizer._attach_tokens = (int (*)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_obj_5spacy_6tokens_3doc_Doc *, PyObject *, std::vector *, std::vector *, int *, int))__pyx_f_5spacy_9tokenizer_9Tokenizer__attach_tokens; + __pyx_vtable_5spacy_9tokenizer_Tokenizer._save_cached = (int (*)(struct __pyx_obj_5spacy_9tokenizer_Tokenizer *, struct __pyx_t_5spacy_7structs_TokenC const *, __pyx_t_5spacy_8typedefs_hash_t, int *, int))__pyx_f_5spacy_9tokenizer_9Tokenizer__save_cached; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_9tokenizer_Tokenizer_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer)) __PYX_ERR(0, 25, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_9tokenizer_Tokenizer_spec, __pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer = &__pyx_type_5spacy_9tokenizer_Tokenizer; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 25, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_9tokenizer_9Tokenizer___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_9tokenizer_9Tokenizer___init__.doc = __pyx_doc_5spacy_9tokenizer_9Tokenizer___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_9tokenizer_9Tokenizer___init__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(0, 25, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_9tokenizer_9Tokenizer_4__call__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_9tokenizer_9Tokenizer_4__call__.doc = __pyx_doc_5spacy_9tokenizer_9Tokenizer_4__call__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_9tokenizer_9Tokenizer_4__call__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_vtabptr_5spacy_9tokenizer_Tokenizer) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Tokenizer, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_9tokenizer_Tokenizer) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_9tokenizer___pyx_scope_struct__pipe_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe)) __PYX_ERR(0, 212, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_9tokenizer___pyx_scope_struct__pipe_spec, __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe) < (0)) __PYX_ERR(0, 212, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe = &__pyx_type_5spacy_9tokenizer___pyx_scope_struct__pipe; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe) < (0)) __PYX_ERR(0, 212, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct__pipe->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_9tokenizer___pyx_scope_struct_1_explain_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain)) __PYX_ERR(0, 631, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_9tokenizer___pyx_scope_struct_1_explain_spec, __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain) < (0)) __PYX_ERR(0, 631, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain = &__pyx_type_5spacy_9tokenizer___pyx_scope_struct_1_explain; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain) < (0)) __PYX_ERR(0, 631, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_1_explain->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_9tokenizer___pyx_scope_struct_2_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr)) __PYX_ERR(0, 665, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_9tokenizer___pyx_scope_struct_2_genexpr_spec, __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 665, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr = &__pyx_type_5spacy_9tokenizer___pyx_scope_struct_2_genexpr; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr) < (0)) __PYX_ERR(0, 665, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_2_genexpr->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_9tokenizer___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 674, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_9tokenizer___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 674, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr = &__pyx_type_5spacy_9tokenizer___pyx_scope_struct_3_genexpr; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 674, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_3_genexpr->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_9tokenizer___pyx_scope_struct_4_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr)) __PYX_ERR(0, 702, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_9tokenizer___pyx_scope_struct_4_genexpr_spec, __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 702, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr = &__pyx_type_5spacy_9tokenizer___pyx_scope_struct_4_genexpr; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 702, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_4_genexpr->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes)) __PYX_ERR(0, 790, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes_spec, __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes) < (0)) __PYX_ERR(0, 790, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes = &__pyx_type_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes) < (0)) __PYX_ERR(0, 790, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_5_to_bytes->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes)) __PYX_ERR(0, 810, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes_spec, __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes) < (0)) __PYX_ERR(0, 810, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes = &__pyx_type_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes) < (0)) __PYX_ERR(0, 810, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_9tokenizer___pyx_scope_struct_6_from_bytes->tp_getattro = PyObject_GenericGetAttr; + } + #endif + __pyx_vtabptr_array = &__pyx_vtable_array; + __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_array_type)) __PYX_ERR(1, 110, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #else + __pyx_mstate->__pyx_array_type = &__pyx_type___pyx_array; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_array_type); + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_array_type, __pyx_vtabptr_array) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_MemviewEnum_type)) __PYX_ERR(1, 299, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #else + __pyx_mstate->__pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_MemviewEnum_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_MemviewEnum_type->tp_dictoffset && __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_memoryview_type)) __PYX_ERR(1, 334, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryview_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryview_type->tp_dictoffset && __pyx_mstate->__pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryview_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryview_type, __pyx_vtabptr_memoryview) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_mstate->__pyx_memoryviewslice_type)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate_global->__pyx_memoryviewslice_type->tp_base = __pyx_mstate_global->__pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryviewslice_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryviewslice_type->tp_dictoffset && __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(5, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(5, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(5, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(5, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(5, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(5, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(5, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(6, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(6, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(6, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(6, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_1(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + 0, 0, + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(7, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "dtype", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #else + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 228, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flatiter", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #else + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 273, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "broadcast", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #else + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 277, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ndarray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #else + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 316, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "generic", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "number", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "integer", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(2, 829, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "signedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 831, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "unsignedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 833, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "inexact", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 835, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "floating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(2, 837, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "complexfloating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 839, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flexible", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 841, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "character", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(2, 843, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ufunc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #else + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 907, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(8, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(8, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.morphology"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.morphology", "Morphology", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #else + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) __PYX_ERR(9, 11, __pyx_L1_error) + __pyx_vtabptr_5spacy_10morphology_Morphology = (struct __pyx_vtabstruct_5spacy_10morphology_Morphology*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology); if (unlikely(!__pyx_vtabptr_5spacy_10morphology_Morphology)) __PYX_ERR(9, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.vocab", "Vocab", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #else + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_5vocab_Vocab), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) __PYX_ERR(10, 26, __pyx_L1_error) + __pyx_vtabptr_5spacy_5vocab_Vocab = (struct __pyx_vtabstruct_5spacy_5vocab_Vocab*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab); if (unlikely(!__pyx_vtabptr_5spacy_5vocab_Vocab)) __PYX_ERR(10, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.tokens.doc"); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.tokens.doc", "Doc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #else + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc) __PYX_ERR(11, 37, __pyx_L1_error) + __pyx_vtabptr_5spacy_6tokens_3doc_Doc = (struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc); if (unlikely(!__pyx_vtabptr_5spacy_6tokens_3doc_Doc)) __PYX_ERR(11, 37, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.matcher.phrasematcher"); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7matcher_13phrasematcher_PhraseMatcher = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.matcher.phrasematcher", "PhraseMatcher", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher), + #else + sizeof(struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7matcher_13phrasematcher_PhraseMatcher), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7matcher_13phrasematcher_PhraseMatcher) __PYX_ERR(12, 11, __pyx_L1_error) + __pyx_vtabptr_5spacy_7matcher_13phrasematcher_PhraseMatcher = (struct __pyx_vtabstruct_5spacy_7matcher_13phrasematcher_PhraseMatcher*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7matcher_13phrasematcher_PhraseMatcher); if (unlikely(!__pyx_vtabptr_5spacy_7matcher_13phrasematcher_PhraseMatcher)) __PYX_ERR(12, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.lexeme"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.lexeme", "Lexeme", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #else + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) __PYX_ERR(3, 24, __pyx_L1_error) + __pyx_vtabptr_5spacy_6lexeme_Lexeme = (struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme); if (unlikely(!__pyx_vtabptr_5spacy_6lexeme_Lexeme)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("spacy.vocab"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_struct___pyx_t_5spacy_7structs_L); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 39; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_5vocab_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + { + __pyx_t_1 = PyImport_ImportModule("spacy.lexeme"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_pyx_t_5spacy_8typedefs_attr_t); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 71; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_6lexeme_OOV_RANK, (void **)&__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("murmurhash.mrmr"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_uint64_t_void_int_uint64_t_hash6); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 33; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (void (**)(void)) NULL}; + void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportFunction_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + { + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_pyx_t_5spacy_8typedefs_hash_t); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 70; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_5spacy_7strings_hash_string, (void (**)(void)) NULL}; + void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportFunction_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_tokenizer(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_tokenizer}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #endif + #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE + {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, + #endif + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "tokenizer", + 0, /* m_doc */ + #if CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstatetype), /* m_size */ + #else + (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif + +/* PyModInitFuncType */ +#ifndef CYTHON_NO_PYINIT_EXPORT + #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#else + #ifdef __cplusplus + #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * + #else + #define __Pyx_PyMODINIT_FUNC PyObject * + #endif +#endif + +__Pyx_PyMODINIT_FUNC PyInit_tokenizer(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_tokenizer(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +/* ModuleCreationPEP489 */ +#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) +static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { + { + PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think + if (!module) { + PyErr_Clear(); // just try the 3.8-3.12 version + module = PyImport_ImportModule("_xxsubinterpreters"); + if (!module) goto bad; + } + PyObject *current = PyObject_CallMethod(module, "get_current", NULL); + Py_DECREF(module); + if (!current) goto bad; + if (PyTuple_Check(current)) { + PyObject *new_current = PySequence_GetItem(current, 0); + Py_DECREF(current); + current = new_current; + if (!new_current) goto bad; + } + long long as_c_int = PyLong_AsLongLong(current); + Py_DECREF(current); + return as_c_int; + } + bad: + PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); + return -1; +} +#endif +#if !CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + static PY_INT64_T main_interpreter_id = -1; +#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_GRAAL + PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) + PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); +#elif CYTHON_COMPILING_IN_LIMITED_API + PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); +#else + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); +#endif + if (unlikely(current_id == -1)) { + return -1; + } + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return 0; + } else if (unlikely(main_interpreter_id != current_id)) { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#endif +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + #if !CYTHON_USE_MODULE_STATE + if (__Pyx_check_single_interpreter()) + return NULL; + #endif + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_tokenizer(PyObject *__pyx_pyinit_module) +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + __pyx_mstatetype *__pyx_mstate = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + static PyThread_type_lock __pyx_t_7[8]; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'tokenizer' has already been imported. Re-initialisation is not supported."); + return -1; + } + #else + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_t_1 = __pyx_pyinit_module; + Py_INCREF(__pyx_t_1); + #else + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #if CYTHON_USE_MODULE_STATE + { + int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "tokenizer" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = __pyx_t_1; + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); + #endif + __pyx_mstate = __pyx_mstate_global; + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_mstate->__pyx_d); + __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /* ImportRefnannyAPI */ + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + +__Pyx_RefNannySetupContext("PyInit_tokenizer", 0); + __Pyx_init_runtime_version(); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Library function declarations ---*/ + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_module_is_main_spacy__tokenizer) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "spacy.tokenizer")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.tokenizer", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(__pyx_mstate); + (void)__Pyx_modinit_variable_export_code(__pyx_mstate); + (void)__Pyx_modinit_function_export_code(__pyx_mstate); + if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_variable_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":101 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * except: + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_collections_abc}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin___import__, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":102 + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":104 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + goto __pyx_L3_exception_handled; + } + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":240 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":241 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L15_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":242 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L11_exception_handled; + } + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L15_try_end:; + } + + /* "View.MemoryView":307 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct_or_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 307, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":308 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 308, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":309 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":312 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 312, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":313 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 313, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":321 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), +*/ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":322 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), +*/ + __pyx_t_7[0] = PyThread_allocate_lock(); + __pyx_t_7[1] = PyThread_allocate_lock(); + __pyx_t_7[2] = PyThread_allocate_lock(); + __pyx_t_7[3] = PyThread_allocate_lock(); + __pyx_t_7[4] = PyThread_allocate_lock(); + __pyx_t_7[5] = PyThread_allocate_lock(); + __pyx_t_7[6] = PyThread_allocate_lock(); + __pyx_t_7[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":984 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":985 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L23_try_end; + __pyx_L18_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":986 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L19_exception_handled; + } + __pyx_L19_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L23_try_end:; + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(1, 990, __pyx_L26_error) + if (__pyx_t_8) { + + /* "View.MemoryView":994 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_memoryviewslice_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":995 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_array_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 995, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L31_try_end; + __pyx_L26_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":996 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L27_exception_handled; + } + __pyx_L27_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L31_try_end:; + } + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_mstate_global->__pyx_n_u_View_MemoryView); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum, __pyx_t_4) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":10 + * from preshed.maps cimport PreshMap + * + * import re # <<<<<<<<<<<<<< + * from .lexeme cimport EMPTY_LEXEME + * from .strings cimport hash_string +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_re, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_re, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_re, __pyx_t_4) < (0)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":15 + * from .tokens.doc cimport Doc + * + * from . import util # <<<<<<<<<<<<<< + * from .attrs import intify_attrs + * from .errors import Errors +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u__6, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":16 + * + * from . import util + * from .attrs import intify_attrs # <<<<<<<<<<<<<< + * from .errors import Errors + * from .scorer import Scorer +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_intify_attrs}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_attrs, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_attrs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_intify_attrs}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":17 + * from . import util + * from .attrs import intify_attrs + * from .errors import Errors # <<<<<<<<<<<<<< + * from .scorer import Scorer + * from .symbols import NORM, ORTH +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":18 + * from .attrs import intify_attrs + * from .errors import Errors + * from .scorer import Scorer # <<<<<<<<<<<<<< + * from .symbols import NORM, ORTH + * from .tokens import Span +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Scorer}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_scorer, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_scorer, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Scorer}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":19 + * from .errors import Errors + * from .scorer import Scorer + * from .symbols import NORM, ORTH # <<<<<<<<<<<<<< + * from .tokens import Span + * from .training import validate_examples +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_NORM,__pyx_mstate_global->__pyx_n_u_ORTH}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_symbols, __pyx_imported_names, 2, __pyx_mstate_global->__pyx_kp_u_spacy_symbols, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_NORM,__pyx_mstate_global->__pyx_n_u_ORTH}; + for (__pyx_t_9=0; __pyx_t_9 < 2; __pyx_t_9++) { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":20 + * from .scorer import Scorer + * from .symbols import NORM, ORTH + * from .tokens import Span # <<<<<<<<<<<<<< + * from .training import validate_examples + * from .util import get_words_and_spaces +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Span}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_tokens, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_tokens, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Span}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":21 + * from .symbols import NORM, ORTH + * from .tokens import Span + * from .training import validate_examples # <<<<<<<<<<<<<< + * from .util import get_words_and_spaces + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_validate_examples}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_training, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_training, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_validate_examples}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":22 + * from .tokens import Span + * from .training import validate_examples + * from .util import get_words_and_spaces # <<<<<<<<<<<<<< + * + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_get_words_and_spaces}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_util, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_util, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_get_words_and_spaces}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":142 + * self._reload_special_cases() + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * args = (self.vocab, + * self.rules, +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_3__reduce__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer___reduce, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_reduce, __pyx_t_4) < (0)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":212 + * return doc + * + * def pipe(self, texts, batch_size=1000): # <<<<<<<<<<<<<< + * """Tokenize a stream of texts. + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_7pipe, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer_pipe, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_pipe, __pyx_t_4) < (0)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":225 + * yield self(text) + * + * def _flush_cache(self): # <<<<<<<<<<<<<< + * self._reset_cache([key for key in self._cache]) + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_10_flush_cache, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer__flush_cache, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_flush_cache, __pyx_t_4) < (0)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":228 + * self._reset_cache([key for key in self._cache]) + * + * def _reset_cache(self, keys): # <<<<<<<<<<<<<< + * for k in keys: + * cached = <_Cached*>self._cache.get(k) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_12_reset_cache, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer__reset_cache, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_reset_cache, __pyx_t_4) < (0)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":235 + * self.mem.free(cached) + * + * def _flush_specials(self): # <<<<<<<<<<<<<< + * self._special_matcher = PhraseMatcher(self.vocab) + * for k in self._specials: +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_14_flush_specials, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer__flush_specials, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_flush_specials, __pyx_t_4) < (0)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":534 + * self._cache.set(key, cached) + * + * def find_infix(self, str string): # <<<<<<<<<<<<<< + * """Find internal split points of the string, such as hyphens. + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_16find_infix, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer_find_infix, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_find_infix, __pyx_t_4) < (0)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":548 + * return list(self.infix_finditer(string)) + * + * def find_prefix(self, str string): # <<<<<<<<<<<<<< + * """Find the length of a prefix that should be segmented from the + * string, or None if no prefix rules match. +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_18find_prefix, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer_find_prefix, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_find_prefix, __pyx_t_4) < (0)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":562 + * return (match.end() - match.start()) if match is not None else 0 + * + * def find_suffix(self, str string): # <<<<<<<<<<<<<< + * """Find the length of a suffix that should be segmented from the + * string, or None if no suffix rules match. +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_20find_suffix, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer_find_suffix, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_find_suffix, __pyx_t_4) < (0)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":576 + * return (match.end() - match.start()) if match is not None else 0 + * + * def _load_special_cases(self, special_cases): # <<<<<<<<<<<<<< + * """Add special-case tokenization rules.""" + * if special_cases is not None: +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_22_load_special_cases, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer__load_special_cases, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_load_special_cases, __pyx_t_4) < (0)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":582 + * self.add_special_case(chunk, substrings) + * + * def _validate_special_case(self, chunk, substrings): # <<<<<<<<<<<<<< + * """Check whether the `ORTH` fields match the string. Check that + * additional features beyond `ORTH` and `NORM` are not set by the +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_24_validate_special_case, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer__validate_special_case, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_validate_special_case, __pyx_t_4) < (0)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":600 + * raise ValueError(Errors.E1005.format(attr=self.vocab.strings[attr], chunk=chunk)) + * + * def add_special_case(self, str string, substrings): # <<<<<<<<<<<<<< + * """Add a special-case tokenization rule. + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_26add_special_case, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer_add_special_case, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_add_special_case, __pyx_t_4) < (0)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":626 + * self._special_matcher.add(string, None, self._tokenize_affixes(string, False)) + * + * def _reload_special_cases(self): # <<<<<<<<<<<<<< + * self._flush_cache() + * self._flush_specials() +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_28_reload_special_cases, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer__reload_special_cases, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_reload_special_cases, __pyx_t_4) < (0)) __PYX_ERR(0, 626, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":631 + * self._load_special_cases(self._rules) + * + * def explain(self, text): # <<<<<<<<<<<<<< + * """A debugging tokenizer that provides information about which + * tokenizer rule or pattern was matched for each token. The tokens +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_30explain, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer_explain, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_explain, __pyx_t_4) < (0)) __PYX_ERR(0, 631, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":757 + * return final_tokens + * + * def score(self, examples, **kwargs): # <<<<<<<<<<<<<< + * validate_examples(examples, "Tokenizer.score") + * return Scorer.score_tokenization(examples) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_32score, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer_score, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 757, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_score, __pyx_t_4) < (0)) __PYX_ERR(0, 757, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":761 + * return Scorer.score_tokenization(examples) + * + * def to_disk(self, path, **kwargs): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_34to_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer_to_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_to_disk, __pyx_t_4) < (0)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":774 + * file_.write(self.to_bytes(**kwargs)) + * + * def from_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_mstate_global->__pyx_k__8 = __pyx_t_4; + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_5) < (0)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_36from_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer_from_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_from_disk, __pyx_t_5) < (0)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/tokenizer.pyx":790 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + __pyx_t_4 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_mstate_global->__pyx_k__9 = __pyx_t_5; + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_4) < (0)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_38to_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer_to_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_4, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_t_4) < (0)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/tokenizer.pyx":810 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, bytes_data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 810, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_mstate_global->__pyx_k__10 = __pyx_t_4; + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 810, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 810, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_5) < (0)) __PYX_ERR(0, 810, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_9Tokenizer_40from_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Tokenizer_from_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 810, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_9tokenizer_Tokenizer, __pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_t_5) < (0)) __PYX_ERR(0, 810, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/tokenizer.pyx":859 + * + * + * def _get_regex_pattern(regex): # <<<<<<<<<<<<<< + * """Get a pattern string for a regex, or None if the pattern is None.""" + * return None if regex is None else regex.__self__.pattern +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_9tokenizer_1_get_regex_pattern, 0, __pyx_mstate_global->__pyx_n_u_get_regex_pattern, NULL, __pyx_mstate_global->__pyx_n_u_spacy_tokenizer, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 859, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_regex_pattern, __pyx_t_5) < (0)) __PYX_ERR(0, 859, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/tokenizer.pyx":1 + * # cython: embedsignature=True, binding=True # <<<<<<<<<<<<<< + * cimport cython + * from cymem.cymem cimport Pool +*/ + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Tokenizer___init___line_31, __pyx_mstate_global->__pyx_kp_u_Create_a_Tokenizer_to_create_Doc) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_5) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.tokenizer", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init spacy.tokenizer"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #else + return __pyx_m; + #endif +} +/* #### Code section: pystring_table ### */ +/* #### Code section: cached_builtins ### */ + +static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(0, 721, __pyx_L1_error) + __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 726, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 749, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 101, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 409, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(1, 619, __pyx_L1_error) + + /* Cached unbound methods */ + __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cached_constants ### */ + +static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_self_name_is_not_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[1], 0, __pyx_mstate_global->__pyx_int_neg_1) != (0)) __PYX_ERR(1, 583, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + + /* "spacy/tokenizer.pyx":771 + * """ + * path = util.ensure_path(path) + * with path.open("wb") as file_: # <<<<<<<<<<<<<< + * file_.write(self.to_bytes(**kwargs)) + * +*/ + __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]); + + /* "spacy/tokenizer.pyx":212 + * return doc + * + * def pipe(self, texts, batch_size=1000): # <<<<<<<<<<<<<< + * """Tokenize a stream of texts. + * +*/ + __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_int_1000); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<4; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_slice; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + { + const struct { const unsigned int length: 11; } index[] = {{2},{68},{35},{54},{37},{60},{24},{52},{1303},{26},{34},{29},{33},{45},{22},{15},{179},{37},{8},{30},{28},{15},{32},{1},{1},{1},{1},{1},{0},{1},{2},{8},{5},{6},{15},{23},{25},{7},{6},{2},{6},{35},{9},{30},{50},{39},{34},{8},{21},{6},{11},{12},{8},{12},{13},{19},{12},{14},{10},{20},{32},{22},{30},{37},{5},{4},{5},{4},{8},{6},{5},{4},{4},{6},{20},{6},{6},{8},{4},{5},{11},{9},{20},{22},{25},{29},{31},{22},{32},{26},{17},{20},{21},{21},{20},{19},{14},{15},{18},{17},{9},{15},{0},{3},{3},{16},{15},{4},{18},{4},{5},{1},{4},{10},{10},{1},{6},{5},{9},{17},{18},{5},{7},{5},{1},{4},{13},{8},{14},{3},{15},{1},{6},{3},{11},{9},{9},{5},{6},{8},{3},{10},{7},{8},{7},{24},{17},{5},{12},{12},{10},{11},{11},{8},{5},{12},{15},{6},{7},{10},{28},{9},{8},{7},{3},{18},{20},{12},{1},{2},{10},{14},{5},{14},{7},{12},{13},{7},{5},{8},{1},{1},{3},{4},{6},{5},{6},{8},{6},{19},{4},{8},{5},{7},{14},{7},{4},{10},{4},{8},{4},{7},{4},{3},{6},{4},{4},{4},{4},{7},{4},{3},{13},{14},{11},{10},{19},{14},{12},{2},{2},{4},{8},{10},{17},{13},{5},{8},{21},{12},{8},{5},{1},{5},{18},{6},{6},{8},{4},{4},{11},{12},{10},{12},{19},{5},{4},{5},{6},{15},{4},{5},{14},{4},{13},{13},{14},{5},{13},{5},{4},{4},{6},{11},{6},{9},{10},{13},{8},{7},{1},{8},{7},{8},{4},{5},{5},{8},{26},{7},{11},{11},{6},{8},{6},{6},{9},{4},{17},{22},{5},{6},{5},{2},{4},{5},{5},{1},{3},{403},{2},{11},{12},{14},{19},{11},{250},{58},{36},{52},{1125},{23},{55},{21},{29},{71},{145},{40},{41},{12},{5},{6},{12},{14},{11},{16},{13},{58},{16},{11},{13},{2},{65},{92},{81},{51},{39},{1}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (3997 bytes) */ +const char* const cstring = "BZh91AY&SY\021\323\314z\000\003\030\377\377\377\377\377\377\377\367\377\377\277\377\377\367\377\377\377\377\300@@@@@@@@@@@@\000@\000`\017M\337\033\306\314\26697{s\323xc$\355\324\232\344\256\2317:\256-\255\335\222\201]\236\000\003\300jz$EM\033Q\352~\246#\311G\352mS\312zzS\331OM'\241\215M3@\224\374\202\236\223O5O\324\237\240SO5CM\036\223\322~\222z\236#&\3254\365\004\241\002b\0024)\232\233BO&\t\242= \324d\032z \304\000h\320\001\246\215\000\006\200\014\200\006\232\t\2244Q\031\030\231C@\320\362\200\320\320\032\000\001\246\232z\200\r\000\000\000\032\000\000\004\246\204I\204I\264)\265\017CiOC\321OH\365\032x\243F\200\000\006\206\200\000\320\017P\000\000\r\000A\223\000&\00112d\300\000\230\023\00110L\000\000\000\000\231\030\t\201\014 \004\211\020\nh\323Bl*m0\247\264\243h\322x\246\23142\017Q\240\031\000\000\000\003C\023FCM\000\016\306\014\030X]\254\004PN&\004\021b\232\033\222\001\003\322\321\313\311\325\355\035=k\177\254\024e\366\263\375Ak\022`(\nP\233\027 8\376\271|\3177,'-m\372\252\221\227\375\376\201\331\000\227D\240d*`L\223'#!\0045kZ\024\257\3741ra&\000I E\202*\252\274\032I\023\235\330\355\305\300q1\270\001\364c\257\325GT\273C\215\302\013\307\025\240\233\r! \233\030\320\330\306:\024\200)\030\264('\203MW*E[\r\30661\323f\216\215\251\006\032\321b\254\2614\304p\256\234\371\005\021\231\230\200\331\322\200\321\030\027\020X\236.\250\230\201,,X\352\201\2469\022\035\022C\273\235\0012\301$\223\232d\211\222\210\024\354\230\225R\205\022\211jT\2764\n5\305\024\242R\224)\177A\205kU\245(cA\274\271]eP[\013\247y\220\250\005\323\234\332l\325,\246\227\311mbC\232>h\310\3610\262w\300\354$#\215\030\t\004\205\363\220\255|\300\315\205hN\256M\032\342\000\325\022:\277\211\3328\204\273[=j;,\237`#\235]}\0149\252\342\325\274\210\347\035\346c\273\244\3416\336\2201\347\021\325_\356\240\372dI\036z\260a\207\013I\0145\003]]\244S\016D\334+;\336WCt>G\357\257\345=l_L\317\257\205\206\005|\344\031\325\3272p\036\325\236\ta\014\242\366t,\024r\037\332,\267\222=\331U\352=\177\275!\375,C\027\221\265k\233\335\376+Gb""\326\275\247:\276\346B\220~\210432\031S\321*!\002\3060\244\024<\035\\\001\r\233gS\261\356K]s\331\253\233a\251\255\202\314\307\265\225-\250f\376\347'uPn*wQ\273V\362\212\353\345\0219\033\324\304\252!Nr\242\014\347B~\177\204\214\013\263\245\227\304\245\260\274\364\225 @/+)W\244+~X\324\234\275kjy\036O\027nW\206\030!\351\334e\004D\325\332A\242\036^]\316\347\207\243B\023A\32099O\261\226\333\306\275'\316[\365\206\256\357\323\371\263\303\003{]\263\350\032L\014\273E#\355\267OLd8Q\245T\211c\230\362\033\350\266 \247[BP\244C\211\247y\373\036/6\357c\365\256\267\037\301\340\215~\224\355\033\006|\202m\306\3263\252M\023\234\327\202\256\030bx\302\302\241\351\373\335/u\277\361\022)0\235\305\321\366\257\277\341\005)D\247\335\362\271\212\312D\222W\036g\267jZJG\337\361\301 T\211\023\303\355U\372J\357\340\362\303\004\2249\204\375j\236\347]\364(P\305\325\340<\376\277\217\233\010\337w\025\226\364\254\214\024\327\232\261\251y\261\2706\356EQ\025\372>\315\302\352~_\206oX\243K_{M\2403\t\010\031\034\270\217M\024\230\263p\354\372\245\315\242\024*#Y(\033)\014y\326J\031\343\326#w\343b\302xd\257s\341\370\341\357\370\242\314G\361\000\200\314A\335\314?\004^!I\374h\303\344=\322y\324\233\035<\273xg\207d\322\305\263\237\330\353\375\373\026Y\222\270\337w]F\317\306JK\004\261\274\373\3133W\177\245\327V\251\302\230\334v\372\345\221g\3005q\364\021-\344\217\323\343\334r)j\235\261\320c\233>\316\253\204\235\274\023\346\241m\tx\275\2363\265\257\227_\016Yl/\357\337g\234~\3662\375\253\356Cm;Z\205\334\034o\010f\330!\253H\253\224}\361\323\2643X\245\305dV\354[z\227\255\313\013\230\273o\217\246\303\325^\037W\315\364\264\332Zh\356\332/\255\305jfa\327~\274<\010\251?a\035\357>J\356\037\0258\36333M\344\335\002\335\005\2615\356\346M\335\334W\271zX_}\270\273\016D\351 \2720\247\361\376y\027E!\027T\354\234l\313\235\261\303K(h\207\205\213\262p\315\216eZ\326vX\245]\316H\256\r\207FMoZ\323\341\361\252\247\300\227\355\243\216\267p2\357m\226nG+\243\220\345\361\277\006\272\335',\331H\331gl\271\204\223Rp\013\264\200.\272f+\000i\360Rw""\331 \020dL\226q\203\251\341\014\031#\\,4\335\337<\331T\252bR\216\345\260\274\010D\004\245\21673`\034$\344Z\252\235\202\030\007R\314\342\027\264\016\005\t\3153rou\270\277\355\325\361ua\200.\263G\240\207\272\342\271\243X\230m\320GB2\014\332\026.\226\313\225\007\201\365\030@\324\233\301\235\327\312\224\245\333\342\233\360ey\177\320\261D\031G\377\224\030z\027\320_e\310\377\212\244J$\320\355\233\336\205\331\334!\271\317\017Z\010\345\210z\3722D\206\3750\326f8\320X\206\225\3130\300\024p\214qA\205g\005VA\340\264\213\352\341\346(u(\276E\005g\365K\203J\363\252\374i\242\372\260\275\3133\335d\331\310\344=\3444o\022FU\274\361\313\0100\247\250\370\304o\nl\355z-\233\316B\364\304\0347\007\241\314\203\320G\232bi\260cb\307\211\310Z\247\217\353\362e\266\361)$8\326\031`\204Q\351\245Dd\266\361\226\230\"+\2422\214\271\221\254`\032cc$+\\6\202O_:+ISuV\271\271\370\267\310\337\314\252\272\311k\242.9\343+1\256kQM4+\0100\r@\300B\025\3148Cd\000\241a\253\230\315\257m\267!\234n\214'\205\010v\202\203\017\036jQ\352\303\003\032Q\326\332\321N\355\226\006\266\3361X\242\316\020\032\264\260\246\003m\341\212\013(T(F\373\240w\001o\034x\201\266\t\334d\021\233\361\206|\211\250\345\361\3535\365u`\273\001\353\313\272=\350Y\316\350b\205\222A\332\335\340\212pF\220\244\004&-\261\206(\231\006\200\343\030\025\000\234p%\2505\224,\022^\264\2650\201\014\203\000\001\002WF\022\210\222\241\354\377\313\242\022J\2532\212\311:\\\005H\332\312j\265\035\010\325\013]\032\257\306c\324\212\014A\222%\215nTI3\312%\344q<\002\203\321p\323\320\225\321\232\215\250\312\002\"f\244\304P\307\206\325X9\264\034\355\217\223\253S\335\241Pt3\032\212FS\216\264\255x\202\252,\321\256\324\017\246\235\362\342\327\\U\017\225\n\206\202\003\032\025\243\225b\243\241e\222\302\332YF!;&\365\216\270\246\265Qh\314*\301D\345FT\255e\343\205c\246\326O\232^\2126,\320\224\244Y{\2359\311c6\366M\260\313\227g{ \216\014\032\2174\350\342\232\325F@\310\327\035\253ra\266\036(z\215\316\"0\335t\014\312\250\2542\263Z\360\261\022\316\315\347:\223^\272\031V\226!\216\303f""\302\240\023\323l\361X)\004\245\004\3201\337\2115\260TH\246\361p\\u\234a\230\242\256l\304\021\020\014\"\003t\277!\023\001\215pH\200$\201\231\315[io\214\334\334\361\004\304T\237kj\307C\310\362\365\253l\221\253&G\241i\343UQVS\324\"\244\233\240\334;!z\007\235\n\016\035\036\001H\244qH\003\215\262\002\201\250-bm\305\251b\3755wB&\014\003\324\026i\353\313\\\367.\203K\370X\305U\021EU9\2564ud!\240*\026\\=\312\206\256\235&\222\305h\335\031MB\036qlh\375\202\005\013\023\030\322\025#\216\347\216\213\207\266j\353\355\025\025\275=t\220i\3703\337\240\245\311\273u\014\347c\355\363\241\006\001\252*h\301\221r\225\301\032\001j\032/\275IZ\354d\327T\t\013\266\360\272hq[[\036z\262d2\361\262\034O\026Y\"\244\365g!&\253\201\241Ub\3630|\222\261\223\017p\3441\2642;\207#\"9.\227,\241r?|kA\001\305\024k\204\263t1\000\014\302H\224\326\241\t\243\340\333\264*\024\022\210VsC\304\302\035\335(g\037\021\335\311%\267\232\212\326,\256D\354\\6$\010\022#u\332\307p(K\230\360vUy\035\306\261\000e@J\261\014\345\243\004\244c\255T\213\255\245\3516\306\306]Yuj\226V\307\t6\332M{\020R\"\031\373L\267E\274\235\002\315\231\302\214\030\3231x\233\224\214\241yb\211qv\3163\220\252\324\344\215\305b6\246Sb\\\366\300\033\023J\374\362\227\305\003h\026\254\310m\027\007\346oS\266%\232\301\255\277:\257(H\022}\220\250\330\323J\031\"\227+\315 ^\343>8\202\250\252&\034W\225\341L.N\ne\312%\366\260\007\211B\301x:\2265\277\310J1 \017%\215\367\261\002\335B;\272\351$\340O\0265\253\241\n\362\313\034:(\347Xm\306S\305\213\222B\030G\217\313\215\375\377\n\367\220^\316\204n\304N\300\336)\016jR\224\262\310u\020:,2\336\310H\022\020\220\300i!;D'\304\014\032)P\030Q\337\"\002\036\022\272u\271\314\317(\236l\302\304\245Q\016\214\223\023_>\240@\275C\247l\265\330\236S\210\216^,T\006e4\364:xH\364\257\336\357gD\372\034\035/\230m\210b\3521\035\201}\201\363\246\021\321pO\241\231\331\257Lk\316\177gcN\036B8OR\034\363V~\237\010w\037\024\304;\356'%\323\034\016\355\355C$\336dy|.\217}}\374\201\317\2157\303\263\366K\307\212t\347\226\037\314s\017 \307B\\\004\022\316l{\234W6m\252\2279\321\035\t\345!B\371\234\217\342\263\370\265\216\000@\332\016\031>\266\270d\2702\022F\261%\226:\031\306\210\300\262\317\312\251\000\364f[\366\016,\324\020h\251V\030\031j\314\254\334\333\337\322\016L0\343\021\204\373\232\271\242c\207\244\r\0027\301\300\252\223xx\322\013\242\034D\204'M\352\344y\252\341\035\215\240E\333\256\272\002\214\205Y\272!\355\242\313=l~\225\362o\035\330\027\203\226\366\351\340\327\riP\225\310\006\275\345`\322\330\245\0338T\004\026q\324\rms\002\260\361\367\335\343\367\376\254\254\3113\333\306\347N\233\214\357i\317\375\353B\275h \264""\255\026\032\266\203K\035\016\224\016 \2769\354Y'\357\026\030y\027Uan\252\217B*V\316\354)\207\\j\241f\335\207}\210\350\202D\032\242\314\177\177U\215El\"j\340L~\260\323\306\246\352\245Z\242\265b\324\004\2314\345\336Q]\2507\210\335i\005\352\024\237\336n\030D}\337,\ne}\276n\215\352\242\240!tF\224W\351Qm*At=\334\264\237\334!\360\264CM\t\263\250h\334p\212;\216\207]K\220Z\3726t\362\361\024\024\226u5\365\023gO\265A\263\315\323\242v\246\216\271\357\036Z\324\026\334\024\317\322\004M\321]\217\034\3417\204\204\362nz.\275vr\317y\3012e\320z\236\320.\004\211\237+8\223\301,pfJ\004J\251\"F\271\221PeG\022\006\256\246\347\375\227\227#YP\353\357e\370u\274+\347\335\327\226\346\024|\237\303mR=\232\265\331\036\312\237\004\177\005|\241\223\323i-\360T\217\373~_\240\271o\032-\037L\277<>\326\314>\356\207\367kTA\022\2657\303\335\225\264\362vq\350\374\371\032\034\332\240p\206W\201\374\260F\335\211s\027\356\25364)8\"t\315\246a\344\230\234\371\220\373\230\003\352\330\207\364H\304\330\302~\374\253\362\367\3620\261\242\244C\213\336\211\212\215\265\334B9WWi\2132\353\273\230G\r!Y\315\232\031\232\010\246\357\260\264(*lZ\312$\025r\353Ib&\242,e\255\350r\227\n\231P\256'\021\002\310\214 `Wv\002@\212\230h13\340\251\372^4\213t\2161\265\361\274\223V 8\216^P\356\322hq-\213I\301AzV\305\260\262\275\270\t\315\353\250[\031\242\005\037\374]\311\024\341B@GO1\350"; + PyObject *data = __Pyx_DecompressString(cstring, 3997, 2); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (3939 bytes) */ +const char* const cstring = "x\332\315XKw\023\307\266\266\034\007\014\230\213\r\2621\217\223\333\002\023\233,Pp\260\215q\210\263\024[\004\003\306o\302a\335\244iu\227\244\306\255n\251\037\266D\316\271a\350\241\206=\354a\0175\324\320C\017{\250!?\201\237p\277]\325z\030ss\317:\353\254\263\256\227\335\217\352\252]\373\361\355o\357\362\202\2241\014I\323K\314tt\313t\244\262\315T\246\351f\241;(\335\322\244\222\347\270R\216I\272\251\261*\323$\305\324$\323r%\307\3201\375'/\237g\266\264\247\263}I\263\230\303?\261j\331r\230\344\270\266\2561gI1%\3134j\222j3\305e\222\"\345\304\"\267\250\270\222\356H\252e\272z\301\263<\007\233H%V\262\354Z\032\253H\224\3428z\301\224\\K\302b\355.\227#f\320\226\361\244X\360\276\255\273J\316`\361\004\241T\336\266J\177\266\226\233%\355\353nQrke&M\306\343\256\255\230\0167\243\273DL\303\n\035\256r{|\267\324\266\354\315\266\265\313L\375\035\263\337\334!\245c\315\336,[\352\033\311\312\275\3052G*\350{\314\224\377\227\253\320\226\314\225\240\027\261c\257\n<2\262P\360_\276?_\t\220\022\014:R\304G\207T\312\261c\"\000x\253@0\001\0018B\263\036M=\333\370\177\251'\364\352\3212\2578p\270\\d\236\255;\256\256\"Qr\226e@\323_\212\014\212\331\202fH8\262\2334E\\\024\343\230\374UR\201\331ws\310!M*\203\236\270f\"\357\260\334-\022e\304\271J\252*\002X\022&9eEe\351c\342\226Y^\361\014\227/\335\266\275\236\257%\245*\253\n\366\222\035X#M\351&e\364\252R\325K^I2\275R\016\372Z\371v\372*\334\315j\3213w\2710\276\264\207V\262\2572\253\353\317\263\013\307v_\\\\\354\246\277\364\203\324!\257)\323(\2479\023\335\356\212X^[\332Z\220\212\256[v\026\276\375\226\214\251""\245u\353[\245\254\177\333\021r\023F\273\335\025\275uD\027\265Apg\266Tvk\222ST\300\270\256W\006g\223\027\325\032\334g\246\025\333Vj+\234\227-\317%#s\226gj\010\027\254w \353\366\312I\n\0265\311+\227-\333e\332\212\271\247\030:\212\027\030\366\016\325#LF\274&\325I\n\304$6#~\237\274#\025\260\252=Y\250\203\022\304\267y\264\312y\377%\361>Txa\201\307y\305Z\342Z\222=\0323t\204\001\014\217\312\"`#\312\232)\255g\327\357\316\314\317p\336\265\231\340}\307\313\251\006\020Ch\200M\236n\270\330L0\270\264\222\227j\226'\231\014j\"~\034Y=\013\200FSr\230\200\345$/Q<\3442\226\003f\223\261_QYh\365c\305pXz\355\230\363\240r\\w\025UeN\333\233[\353\331\245\225\314\363\273[.+\003t5\356G\224{\004\323\352:\274\203\214\264,S\210eY\2322P\214\244\373\323=\337\034\325\262\331\216\311k0a\3202\367\230\215\022\353\262\022\275\213\372\367czq\362\266\244\374\246h\232l\222S\311E\022\374z\257\252Z\206\3018a8i%\247>\352i\014h\2220q\361\323\341v=^\324t\207\266f\\\201\202*MQp\013\034sd7e#j-3]\336gt\233\034\335\021K\210\217K<\333\036\375 \335;\201H\323B\300y\272J\262l3\315S\031\334\240y\334V\3232\357\002\000{\250\257\370\252\n\037!K\313\265\264L^I\227\260N\347r\300C 8\036e\275Dp\355\235\346\201\343\212'f\304\256[t\230\221O\233J\211\265\263\351\205e2\221\211\342\252\270\256\355\210Gf\333V\373\331nO\242=\354\370\271V\312Y\206\230\320M\340t\271V\025\337\005\307\307\317\266`3\361\346\271\272\361H4w\332\261\300\234\034\243l\353\304\347\330\367\316\250\327\301\013*\007(\207\020\301\335\244)\256\222\376\314W\221\246\274\241\021\rf:\263\265\264\262\222\275\367\335lv\372\336\275\331\354\303\207\017\262\206\241\227\035\335\311r'\254\274x\274\362\352\305\332\346\352\332\346\366\223\365\315,\336dy\275V\305\3372rV~\001Xl\262\374\326\316c|\331\342>\332b\025\217\231*\333*+\346\366\332\263\354\013~\221W3\333KO:\200\357\315\2126 z\306\362\206\347\024\005\211\237\030\215{1\247\347\203a)Z{\\\346=Z\317G\233\375\037\237\301\r'\266\342\264\006\227\035[\326\375N\031\370\371/ L\003\021\357\016P\203\"\363\006\345\2231\321\272}2(\272""\251\236A\364\340r\256\346\366\252\314\307\220\261\273\335\241\262^f\237\220I\367\325\265>\225\200\021Z\277\263\371\\\204\205\230:\335%m\020\010\014\374\324\3066\212d\301\205\212]p\024\247f\252\272\205\316\303F\271\001\2519\224E<\223rT\346sT\362y\025\346\n\310\204K\225\273Z\343\365\026\351N$-\313\355\207\002s\211I\350\025\322\3406\031\342T\310QwU\003\355A\334\342\250\340eW#i\3000\350\t\301\202Y\220C\335;\204i\260\217\321\241\014\352j\232\245jT)d\335\221\005\031\200\347\350\374\300P'M\007\315\224\\\006s\3102\350\r=\016n^\211W&N\003\202\013XU)\241\324\342\256\262\316\311\000O\206\247\001\2708P\270t\345\221\217o\351G\344-\303YL\027\030\215\331'Z\250<\014A\227l\320(\330\301tx\313$\013\362\350\242\246\007+=\010i\367\300yC)8\275\351\362I\222\200\211A\213q\321\356\202\251\373\324\325\363\221\241\224r\232\262\330\201\227,S\023*\313\261\001\210\r\305\007\tS`Ur\031\2667i`\337\2625GVH7j\323\034Z\341:.AE\326u\r\027\316\304T\376dq\"\224\337\201|\371\361\361\370Y!\356\343\321\260\351\371\232\314qDQ\353\300K\347\244\312D\261\211+\316\333\335]V\303\257\263\273O\220D\007\315\014~\221\333\006\031\314, \276'Y\240$\223v%DK\026=8\277`\374X\003\t\225\351\004K\375\020\246Y\032\372U\324'T\222\316\025\365\020W\266O\227\252\013\214Y\371\343\021\222\341B\363oG3G{\321\216\034\311fd\272\221[\205\367k\211\247\024\204\247\375\317\372\tK#\"\256I\377%|;t\271^i\r]\254\247Z\303\227\000\240-`!y\325\237D\212N\267\222\022\275\215\266\206\307\352%`\362Y\3504\3566+\207\030\273\\\377\235Gf\374+\277\020l\006\1774\224\326\370D\220i\215_\241o\357\202K\364,\276Uz\277\374\035fn\264\306\245\340<\322\361ms\240\231\3710~\315\237\343\363\257\377\245\275\344]\343J\363F3C\013W0\017\262\257\371\013\301\026<\2009'\245\234j*m)K\024p.I\nN\007vx\265\361\260\231in\010I\233a\205\214\274_W\240\375MH \323.\325\277\367\025\277\3226\372\307FJ\230=\372U\357\360\017\215D<,`v\334E\243\024\202t\230\010GZ\311\257|\023\224\002\331\304\253\311q\377\014\360\014\345\036`\303\315\300\rg\201\\\265y\251)\314\275\346?\204)\177\rYc\016\031{\375F0\031^\004+\25447\232\372\241w\3648\332\334jO\332\t\277\006\353\3574'@k\307&\262\303\271\243\321#\026m\375\022\375\362\2525\236\nF\003\r@\202\233jA\2026\027>\2555\316 o\333\306\215\265-x\010\264\362!@`2\006\322\364\007$P-\032\277C\206\200\360*\215/@\311^s\005$;HH\031\344I\006\034\326o\203\343\025\177?@\275\241\234\233\251W\341\263\341\313\365}\356\274\341q\377\264_\t8;\251\365\221\372D\275\350\347\021\210_\000[\010\232\210\306&y\274\220y\211z\262\276\001\232\275\017\002\030\013\366\300\366c\r\247y\253Y\021i\271\032\214\004\251\017\330\022\013\t\260\203\344\361\224?\037|\007\246\036\005B\260C\256\336_\277\t!\\\027\273~\211\362\372r\375\277A7\n!XA)K\370c`\321\331\360\274`\334\217\203}#I(\275\007\330\367\007\267H\027\360\333\313\306|s\272\371\370p\342\260x\244\220sN\343\303)\362C+\211m? \250_`\347\207<\314\000\326\317\341w\341\353F\245\331\017\314f\017\223\207/9\247\201\032i:\250\301\337\3700|\335\377\031\t\3648L\205\323\255a\252\326Di\3573\302\216o\000~\274\357E\243S\204!\032\036:\310\"MQ\327_C\337\007\274\354T\004G\377\314Y\037\026\356\327\013@\3300""\361\305\227T\210\304\262U\356\227\231\366\252\316 /\361\327\211\260pG\274\211\206\337\267\337\316\213\332(\266MR/!6^\240\242\333H\211\215\237\362\220~vcb\357\021\204\360:^\363\350\026\346\232\311\346\253Cn\244]\037\345\236\007W\202nf\202*\354\000\271\315\361\360\000s\337\360\361\331\3604PF\234\276s\370\365\321\020\371.V\033[\017\202\364\220\246\263\376 \270Y!\340\302a\301\313p\256q\031\205n\264\251a\311 \252k\264\361*z\365[\364\233\374>\363\241\267\256\235\006\006^\242\335Xm\216\001N\303\311(y\013\230(\204\033B\361a\340\366\021G\351\371\021\256l\215\226\215\324\307\270\326+D;\330p9<\207\352\216|\213\006h\3658p\262\001N\332\016\257\241\250\312\207\231\372+\252\275\310\262Dc\2749\342\277\212n=\000$\300o\334\221s|\332Vs\3600\341\277\006\013|O\355\320\223\243D4p\233\320K5\354\363j\\\361GQ\360\246\273\255\030\357\013\200\035$\352\004\331\200\270M\222]~1\372\232\352~\262\271\341\277EW\363\214Z(\324\327\240\022\r\334 h\177\034\356;s\366\037\355\024?\360\n\372\020\261\3715L\305\347%y\226\037\003\344y:9\341,\341\360VXv\373Do.}2\355A\334\262\313\317Y\025\347\275\245\276\265\265\227\362f\346\305\263\276\354\352\372\366_\345\347\331W\331\325\354\377*\273\250\340\304\355JS\353\2655\376\377\005\351\233;\022\316\260\361.\316\256^\246\236\274L\355\365\355>>\271sf\370G\224\351\325\301\203\334\271\031\332l\317\322\265x\243;R{X\210\237\233Y\373\037\312W\254\302"; + PyObject *data = __Pyx_DecompressString(cstring, 3939, 1); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #else /* compression: none (7843 bytes) */ +const char* const bytes = ": All dimensions preceding dimension %d must be indexed and not slicedBuffer view does not expose stridesCan only create a buffer that is contiguous in memory.Cannot assign to read-only memoryviewCannot create writable memory view from read-only memoryviewCannot index with type 'Cannot transpose memoryview with indirect dimensionsCreate a `Tokenizer`, to create `Doc` objects given unicode text.\n\n vocab (Vocab): A storage container for lexical types.\n rules (dict): Exceptions and special-cases for the tokenizer.\n prefix_search (callable): A function matching the signature of\n `re.compile(string).search` to match prefixes.\n suffix_search (callable): A function matching the signature of\n `re.compile(string).search` to match suffixes.\n infix_finditer (callable): A function matching the signature of\n `re.compile(string).finditer` to find infixes.\n token_match (callable): A function matching the signature of\n `re.compile(string).match`, for matching strings to be\n recognized as tokens.\n url_match (callable): A function matching the signature of\n `re.compile(string).match`, for matching strings to be\n recognized as urls.\n faster_heuristics (bool): Whether to restrict the final\n Matcher-based pass for rules to those containing affixes or space.\n Defaults to True.\n max_cache_size (int): Maximum number of tokenization chunks to cache.\n\n EXAMPLE:\n >>> tokenizer = Tokenizer(nlp.vocab)\n\n DOCS: https://spacy.io/api/tokenizer#init\n Dimension %d is not directEmpty shape tuple for cython.arrayIndex out of bounds (axis %d)Indirect dimensions not supportedInvalid mode, expected 'c' or 'fortran', got Invalid shape in axis ') a^add_note and at 0xcollections.abcdisableenablegc (got got differing extents in dimension isenableditemsize <= 0 for cython.arrayno default __reduce__ due to non-trivial __cinit__numpy._core.multiarray failed to importnumpy._core.umath failed to import object>self.name is not Nonespacy.spacy.attrsspacy.errorsspacy.respacy.scorerspacy.symbolsspacy/tokenizer.pyxspacy.tokensspacy.trainingspacy.utilunable to allocate array data.unable to allocate shape and strides.ASCIIE025E1005E997EllipsisErrorsINFIXNORMORTHPREFIX__Pyx_PyDict_NextRefSUFFIXScorerSequenceSpanTOKENTOKEN_MATCHTokenizerTokenizer.__reduce__Tokenizer._flush_cacheTokenizer._flush_specialsTokenizer._load_special_casesTokenizer._reload_special_casesTokenizer._reset_cacheTokenizer._validate_special_caseTokenizer.add_special_caseTokenizer.explainTokenizer.find_infixTokenizer.find_prefixTokenizer.find_suffixTokenizer.from_bytesTokenizer.from_diskTokenizer.pipeTokenizer.scoreTokenizer.to_bytesTokenizer.to_diskURL_MATCHView.MemoryViewabcaddadd_special_caseallocate_bufferargsasyncio.coroutinesattrattrsbbasebatch_sizebytes_dataccachedchunk__class____class_getitem__cline_in_tracebackclosecompilecountddatadeserializers__dict___do_deprecateddocdtype_is_objecteencodeendensure_path__enter__enumerateerrorerrorsexamplesexcexceptionsexclude__exit__explainexplain..genexprfaster_heuristicsfile_filter_spansfinal_tokensfind_infixfind_prefixfind_suffixfinditerflags_flush_cache_flush_specialsformatfortranfrom_bytesfrom_bytes..from_disk__func__genexprget_get_regex_patternget_words_and_spaces__getstate__iid__import__in_memory_zoneindexinfix_finditerinfixesintify_attrs_is_coroutineisspaceitemsit""emsizejkkeykeyskwargslabellabel_length_load_special_casesm_id__main__matchmatchesmax_cache_sizememviewmode__module__name__name__ndim__new__nextobjoffsetopenorthpackpathpatternpipepopprefix_search__pyx_checksum__pyx_state__pyx_type__pyx_unpickle_Enum__pyx_vtable____qualname__rbreread_realloc__reduce____reduce_cython____reduce_ex__regexregister_reload_special_cases_reset_cachereversedrulessscorescore_tokenizationscorersearch__self__selfsendserializers__set_name__setdefault__setstate____setstate_cython__shapesizespacespacesspacy.tokenizerspanspansspans_by_startspecspecial_casesspecial_tokenspecial_tokenssplitstale_specialstartstepstopstringstrings_mapstructsubstringsubstringssuffix_searchsuffixessymbolstt_spacest_words__test__texttextsthrowto_bytesto_bytes..to_disktoken_attrstoken_matchtokenstrainingunpackupdateurl_matchutilvalidate_examples_validate_special_casevaluevaluesvocabwbwordwordswritexzip\320\0040\260\005\260Q\360\022\000\t\020\210q\330\010\t\330\014\025\220Q\330\014\035\230Q\330\014\035\230Q\330\014\036\230a\330\014\033\2301\330\014\031\230\021\330\014\032\230!\330\014!\240\021\360\n\000\t\r\210I\220Q\330\010\014\320\014\035\230Q\330\010\014\320\014\035\230Q\330\010\014\320\014\036\230a\330\010\014\210O\2301\330\010\014\210M\230\021\330\010\014\210K\220q\230\014\240O\2601\330\010\013\320\013\033\2303\230e\2404\240z\260\021\260$\260a\3207I\310\021\330\014\020\320\020!\240\022\2408\2501\250D\260\001\3201B\300!\330\010\013\320\013\033\2303\230e\2404\240z\260\021\260$\260a\3207I\310\021\330\014\020\320\020!\240\022\2408\2501\250D\260\001\3201B\300!\330\010\013\320\013\034\230C\230u\240D\250\n\260!\2604\260q\3208K\3101\330\014\020\320\020\"\240\"\240H\250A\250T\260\021\3202D\300A\330\010\013\210>\230\023\230E\240\024\240Z\250q\260\004\260A\3205E\300Q\330\014\020\220\017\230r\240\030\250\021\250$\250a\250\177\270a\330\010\013\210<\220s\230%\230t\240:\250Q\250d\260!\260>\300\021\330\014\020\220\r\230R\230x\240q\250\004\250A\250]\270!\330""\010\013\320\013\037\230s\240!\330\014\020\320\020%\240T\250\021\250!\360\006\000\t\014\2108\2203\220e\2304\230z\250\021\250$\250a\250z\270\021\330\014\020\220\t\230\024\230Q\230a\330\010\017\210q\2401\230\030\320!3\2601\260D\270\001\230\032\2404\240{\260!\260=\300\001\240\032\2504\250{\270!\320;P\320PQ\200\001\340\004\013\2108\2206\230\023\230J\240e\2509\260A\2308\320#5\260Q\260d\270!\200A\360\024\000\t\r\320\014#\2401\240H\250A\330\010\025\220T\230\021\230!\330\010\021\220\032\2304\230t\2406\250\021\250#\250Q\330\010\016\210j\230\003\2301\230A\330\010\016\210j\230\001\330\010\016\210e\220:\230T\240\026\320'8\270\001\270\021\330\010\016\210k\230\021\230!\330\010\030\230\n\240$\240j\260\004\260A\260Q\330\010\014\210J\220d\230!\2305\240\001\330\010\013\210>\230\027\240\001\330\014\020\220\004\220E\230\021\230!\330\010\014\210G\2201\220J\230a\330\010\014\210M\230\021\330\010\013\2104\210t\320\023&\240c\250\024\250\\\270\021\270(\300#\300T\310\033\320TU\320U]\320]`\320`d\320dp\320pq\320qy\320y|\360\000\000}\001A\002\360\000\000A\002D\002\360\000\000D\002E\002\330\014\020\320\020!\240\024\240Q\240h\250f\260D\3208J\310!\3108\320ST\200A\360\022\000\t\014\2104\210\177\230c\240\021\330\014\023\2201\330\010\020\220\004\220N\240!\2401\330\010\017\210q\220\005\220T\230\023\230B\230e\2406\250\027\260\006\260g\270Z\300q\200A\360\024\000\t\014\2104\320\017\037\230s\240!\330\014\023\2201\330\010\017\210t\2201\220D\230\017\240q\250\001\200A\330\010\020\220\004\220A\330\020\024\220A\330\020\024\220A\330\020\024\220A\330\020\024\220A\330\020\024\220A\330\020\024\220A\330\010\020\220\004\220L\240\006\240f\250A\200A\360\026\000\t\031\230\004\230A\330\010\013\210>\230\023\230A\330\014\034\230B\230h\240a\240u\250A\330\010\030\230\004\230A\330\010\013\210>\230\023\230A\330\014\034\230B\230h\240a\240u\250A\330\010\031\230\024\230Q\330\010\013\210?\230#\230Q\330\014\035\230R\230x\240q\250\005\250Q\330\010\026\220d\230!\330\010\013\210<\220s\230!\330\014\032\230\"\230H\240A\240U\250!\330""\010\024\220D\230\001\330\010\013\210:\220S\230\001\330\014\030\230\002\230(\240!\2405\250\001\330\010\030\230\001\330\010\014\210F\320\022$\240D\250\006\250f\260A\330\014\031\230\021\230(\240!\240<\250q\260\017\270|\3104\310v\320U_\320_n\320nt\320tx\360\000\000y\001J\002\360\000\000J\002K\002\330\010\021\220\021\330\010\014\210M\230\024\230V\2401\330\014\027\220q\330\014\022\220!\330\020\023\220:\230S\240\001\330\024\032\230'\240\022\2401\330\024 \240\001\330\024\025\330\020\026\220m\2401\240K\250s\260-\270q\300\001\330\024\027\220{\240!\2401\330\030\036\230g\240R\240\177\260a\330\030$\240A\330\030\031\330\024\027\220z\240\023\240A\330\030\036\230g\240R\240q\330\030$\240A\330\030\031\330\024\027\220}\240A\240Q\330\030 \240\r\250Q\250j\270\004\270A\340\030\033\2306\240\023\240A\330\034\035\330\030\036\230g\240R\240z\260\031\270\"\270A\330\030$\240I\250Q\250a\330\030\033\230:\240S\250\001\330\034\035\330\024\027\220}\240A\240Q\330\030 \240\r\250Q\250j\270\006\270a\340\030\033\2306\240\023\240C\240q\250\001\330\034\035\330\030 \240\007\240r\250\032\2609\270A\270Q\330\030$\240I\250R\250q\330\020\023\2203\220a\220{\240#\240Q\330\024\025\330\020\023\220;\230a\230q\330\024\032\230'\240\022\240?\260!\330\024 \240\001\330\025\036\230a\230q\330\024\032\230'\240\022\240=\260\001\330\024 \240\001\330\025\037\230s\240!\330\024\032\230'\240\022\2401\330\024 \240\001\330\025\031\230\021\230.\250\001\250\021\330\024\036\230n\250A\250Q\330\024\035\230Q\330\024\030\230\t\240\021\330\030\033\2307\240#\240R\240t\2505\260\006\260c\270\023\270A\330\034\035\330\030\033\2309\240A\240Y\250e\2606\270\021\330\034\"\240'\250\022\2509\260I\270Q\270i\300u\310F\320RS\330\030\033\2309\240A\240U\250&\260\005\260U\270$\270a\330\034\"\240'\250\022\2509\260I\270Q\270e\3006\310\025\310e\320SW\320WX\330\030!\240\025\240d\250!\330\024\027\220y\240\001\240\021\330\030\036\230g\240R\240y\260\t\270\021\270!\330\024 \240\001\330\025\026\330\024\032\230'\240\022\2409\250A\330\024 \240\001\330\014\022\220'""\230\021\230(\240!\2401\340\010\017\210y\320\030,\250A\250Q\250a\250q\260\003\2604\260u\270I\300Q\330\010\022\220!\330\010\023\2201\330\010\014\210F\220)\2303\230a\230w\240a\330\014\017\210t\2204\220x\230q\330\020\027\220w\230a\230q\330\020\030\230\007\230q\240\001\330\010\016\210c\220\021\220$\220h\230f\240I\250W\260A\330\010\022\220$\320\026'\240q\250\001\330\010\020\220\001\220\024\220Q\220e\2303\230c\240\026\240v\250T\260\026\260s\270%\270q\330\010\020\220\004\220M\240\021\240!\340\010\014\210A\330\010\027\220q\330\010\031\230\021\230!\2308\2402\240T\250\025\250a\330\010\016\210b\220\002\220#\220Q\220a\330\014\017\210r\220\023\220A\330\020\027\220~\240Q\240a\330\020\026\220a\220q\230\001\230\026\230t\2405\250\r\260Q\260d\270!\360\010\000\021\024\2204\220v\230S\240\002\240%\240q\250\001\250\024\250V\2608\2701\270F\300$\300h\310a\330\024 \240\007\240q\250\006\250a\250q\330\024\031\230\021\340\024\030\230\003\2308\2409\250A\250Q\330\030$\240G\2502\250Z\260q\270\002\270\"\270E\300\024\300V\3108\320ST\320TU\330\024\031\230\023\230A\230Q\340\020\034\230G\2401\240F\250!\2501\330\020\025\220Q\330\010\017\210q\200A\330\010\031\230\021\230*\240A\330\010\017\210v\320\025(\250\001\250\021\200A\330\010\014\210E\220\021\330\014\025\220Z\230t\2407\250$\250a\250q\330\014\020\220\004\220G\2301\230A\330\014\017\210w\220g\230Q\330\020\024\220D\230\005\230Q\230a\200A\330\010\014\210M\230\021\230!\2304\230t\2407\250$\250a\200A\330\010\014\210M\230\021\330\010\014\320\014\034\230A\330\010\014\320\014 \240\001\240\024\240Q\200A\330\010\014\320\014 \240\r\250Q\250d\260!\330\010\014\210E\220\024\220Q\330\014\025\220Z\230t\240:\250T\260\021\260!\330\014\020\220\004\220J\230a\230q\330\014\017\210w\220g\230Q\330\020\024\220D\230\005\230Q\230a\200A\360\022\000\t\021\220\001\220\034\230Q\230f\240O\2606\270\024\270X\300Q\330\010\017\210r\220\025\220a\220q\230\004\230A\230V\2404\240x\250q\330\010\013\2106\220\023\220A\330\014\022\220*\230A\230V\2405\250\007\250q\260\006\260g\270U\300&\310\014""\320TU\330\010\014\210M\230\021\330\014\020\220\010\230\001\330\020\023\2205\230\010\240\006\240a\330\024\032\230*\240A\240V\2506\260\027\270\001\270\025\270d\300&\310\010\320PQ\320QX\320X^\320^_\200A\340\010\013\210>\230\027\240\001\330\014\020\220\007\220~\240V\2501\250M\270\026\270q\330\020\024\320\024%\240Q\240g\250Q\200A\360\022\000\t\020\210t\220<\230q\240\001\330\r\021\220\025\220a\220y\240\001\330\014\021\220\026\220q\230\004\230I\240S\250\001\230*\240D\250\013\2601\260I\270Q\320\004%\240Q\240\030\250\024\250Q\230:\240T\250\033\260A\260_\300A\220X\230T\240\026\240y\260\001\260\030\270\021\230X\320%7\260q\270\004\270A\220Z\230t\2406\250\033\260A\260S\270\010\300\001\230Z\240t\250;\260a\3207H\310\001\320\004)\250\025\250a\360\024\000\t\020\210t\220<\230q\240\001\330\r\021\220\025\220a\220y\240\001\330\014\031\230\025\230e\2401\330\010\014\210K\220q\230\014\240H\250A\330\010\017\210q\230(\240$\240g\250Q\250d\260'\270\026\270q\230h\320&8\270\001\270\024\270Q\230j\250\004\250K\260q\3208J\310!\240q\320\004\"\240%\240q\360\020\000\t\n\330\014\025\220Q\330\014\035\230Q\330\014\035\230Q\330\014\036\230a\330\014\033\2301\330\014\031\230\021\330\014\032\230!\330\014!\240\021\340\010\017\210t\2209\230A\230]\250!__pyx_t_5spacy_8typedefs_attr_t\000struct __pyx_t_5spacy_7structs_LexemeC\000OOV_RANK\000EMPTY_LEXEME__pyx_t_5spacy_8typedefs_hash_t (PyObject *, int __pyx_skip_dispatch)\000hash_stringstruct __pyx_t_5spacy_7structs_LexemeC\000EMPTY_LEXEMEuint64_t (void *, int, uint64_t)\000hash64O"; + PyObject *data = NULL; + CYTHON_UNUSED_VAR(__Pyx_DecompressString); + #endif + PyObject **stringtab = __pyx_mstate->__pyx_string_tab; + Py_ssize_t pos = 0; + for (int i = 0; i < 299; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 64) PyUnicode_InternInPlace(&string); + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + stringtab[i] = string; + pos += bytes_length; + } + for (int i = 299; i < 338; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); + stringtab[i] = string; + pos += bytes_length; + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + Py_XDECREF(data); + for (Py_ssize_t i = 0; i < 338; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 299; + for (Py_ssize_t i=0; i<39; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + } + { + PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 0; + int8_t const cint_constants_1[] = {0,-1,1}; + int16_t const cint_constants_2[] = {1000,10000}; + int32_t const cint_constants_4[] = {136983863L}; + for (int i = 0; i < 6; i++) { + numbertab[i] = PyLong_FromLong((i < 3 ? cint_constants_1[i - 0] : (i < 5 ? cint_constants_2[i - 3] : cint_constants_4[i - 5]))); + if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_number_tab; + for (Py_ssize_t i=0; i<6; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_codeobjects ### */ +typedef struct { + unsigned int argcount : 2; + unsigned int num_posonly_args : 1; + unsigned int num_kwonly_args : 1; + unsigned int nlocals : 6; + unsigned int flags : 10; + unsigned int first_line : 10; +} __Pyx_PyCode_New_function_description; +/* NewCodeObj.proto */ +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +); + + +static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { + PyObject* tuple_dedup_map = PyDict_New(); + if (unlikely(!tuple_dedup_map)) return -1; + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 212}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_texts, __pyx_mstate->__pyx_n_u_batch_size, __pyx_mstate->__pyx_n_u_text}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_pipe, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 665}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_e}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 674}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_e}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 702}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_e}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 799}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_XT_y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 800}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_X_7q_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 801}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_X_7q_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 802}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_h_8_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 803}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_8_5Qd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 804}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_31D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 805}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_gQd_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 806}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_Q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 821}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_Zt6_AS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 822}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_Zt_a7H, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 823}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_Zt_a7H, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 824}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_j_Kq8J, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 825}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_T_A_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 826}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_4, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 827}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_D_1IQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 828}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_4_PPQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 142}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_args}; + __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_reduce, __pyx_mstate->__pyx_kp_b_iso88591_A_A_A_A_A_A_A_A_L_fA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 225}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_key}; + __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_flush_cache, __pyx_mstate->__pyx_kp_b_iso88591_A_M_4t7_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 228}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_cached}; + __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_reset_cache, __pyx_mstate->__pyx_kp_b_iso88591_A_E_Zt7_aq_G1A_wgQ_D_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 235}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_cached}; + __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_flush_specials, __pyx_mstate->__pyx_kp_b_iso88591_A_Qd_E_Q_Zt_T_Jaq_wgQ_D_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 534}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_string}; + __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_find_infix, __pyx_mstate->__pyx_kp_b_iso88591_A_4_s_1_t1D_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 548}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_string, __pyx_mstate->__pyx_n_u_match}; + __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_find_prefix, __pyx_mstate->__pyx_kp_b_iso88591_A_4_c_1_N_1_q_T_Be6_gZq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 562}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_string, __pyx_mstate->__pyx_n_u_match}; + __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_find_suffix, __pyx_mstate->__pyx_kp_b_iso88591_A_4_c_1_N_1_q_T_Be6_gZq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 576}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_special_cases, __pyx_mstate->__pyx_n_u_chunk, __pyx_mstate->__pyx_n_u_substrings}; + __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_load_special_cases, __pyx_mstate->__pyx_kp_b_iso88591_A_V1M_q_QgQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 582}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_chunk, __pyx_mstate->__pyx_n_u_substrings, __pyx_mstate->__pyx_n_u_attrs, __pyx_mstate->__pyx_n_u_orth, __pyx_mstate->__pyx_n_u_substring, __pyx_mstate->__pyx_n_u_attr, __pyx_mstate->__pyx_n_u_spec}; + __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_validate_special_case, __pyx_mstate->__pyx_kp_b_iso88591_A_QfO6_XQ_r_aq_AV4xq_6_A_AV5_q_g, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 600}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_string, __pyx_mstate->__pyx_n_u_substrings, __pyx_mstate->__pyx_n_u_cached, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_stale_special}; + __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_add_special_case, __pyx_mstate->__pyx_kp_b_iso88591_A_1HA_T_4t6_Q_j_1A_j_e_T_8_k_j_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 626}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2}; + __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_reload_special_cases, __pyx_mstate->__pyx_kp_b_iso88591_A_M_A_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 43, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 631}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_text, __pyx_mstate->__pyx_n_u_prefix_search, __pyx_mstate->__pyx_n_u_suffix_search, __pyx_mstate->__pyx_n_u_infix_finditer, __pyx_mstate->__pyx_n_u_token_match, __pyx_mstate->__pyx_n_u_url_match, __pyx_mstate->__pyx_n_u_special_cases, __pyx_mstate->__pyx_n_u_orth, __pyx_mstate->__pyx_n_u_special_tokens, __pyx_mstate->__pyx_n_u_tokens, __pyx_mstate->__pyx_n_u_substring, __pyx_mstate->__pyx_n_u_suffixes, __pyx_mstate->__pyx_n_u_split, __pyx_mstate->__pyx_n_u_infixes, __pyx_mstate->__pyx_n_u_offset, __pyx_mstate->__pyx_n_u_match, __pyx_mstate->__pyx_n_u_words, __pyx_mstate->__pyx_n_u_spaces, __pyx_mstate->__pyx_n_u_t_words, __pyx_mstate->__pyx_n_u_t_spaces, __pyx_mstate->__pyx_n_u_word, __pyx_mstate->__pyx_n_u_space, __pyx_mstate->__pyx_n_u_doc, __pyx_mstate->__pyx_n_u_matches, __pyx_mstate->__pyx_n_u_spans, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_final_tokens, __pyx_mstate->__pyx_n_u_spans_by_start, __pyx_mstate->__pyx_n_u_span, __pyx_mstate->__pyx_n_u_exc, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_special_token, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_t, __pyx_mstate->__pyx_n_u_m_id, __pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_d}; + __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_explain, __pyx_mstate->__pyx_kp_b_iso88591_A_A_A_BhauA_A_A_BhauA_Q_Q_Rxq_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 757}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_examples, __pyx_mstate->__pyx_n_u_kwargs}; + __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_score, __pyx_mstate->__pyx_kp_b_iso88591_A_A_v, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 761}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_file}; + __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_to_disk, __pyx_mstate->__pyx_kp_b_iso88591_A_t_q_ay_q_IS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 774}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_exclude, __pyx_mstate->__pyx_n_u_file, __pyx_mstate->__pyx_n_u_bytes_data}; + __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_from_disk, __pyx_mstate->__pyx_kp_b_iso88591_a_t_q_ay_e1_Kq_HA_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 1, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 790}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_exclude, __pyx_mstate->__pyx_n_u_serializers}; + __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_to_bytes, __pyx_mstate->__pyx_kp_b_iso88591_q_Q_Q_Q_a_1_t9A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 810}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self_2, __pyx_mstate->__pyx_n_u_bytes_data, __pyx_mstate->__pyx_n_u_exclude, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_deserializers}; + __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_from_bytes, __pyx_mstate->__pyx_kp_b_iso88591_0_Q_q_Q_Q_Q_a_1_IQ_Q_Q_a_O1_M_K, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 859}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_regex}; + __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_tokenizer_pyx, __pyx_mstate->__pyx_n_u_get_regex_pattern, __pyx_mstate->__pyx_kp_b_iso88591_86_Je9A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) goto bad; + } + Py_DECREF(tuple_dedup_map); + return 0; + bad: + Py_DECREF(tuple_dedup_map); + return -1; +} +/* #### Code section: init_globals ### */ + +static int __Pyx_InitGlobals(void) { + /* PythonCompatibility.init */ + if (likely(__Pyx_init_co_variables() == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CommonTypesMetaclass.init */ + if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CachedMethodType.init */ + #if CYTHON_COMPILING_IN_LIMITED_API + { + PyObject *typesModule=NULL; + typesModule = PyImport_ImportModule("types"); + if (typesModule) { + __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + } + } // error handling follows + #endif + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CythonFunctionShared.init */ + if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* Generator.init */ + if (likely(__pyx_Generator_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, + "name '%U' is not defined", name); + } + return result; +} + +/* TupleAndListFromArray (used by fastcall) */ +#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + Py_ssize_t i; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + for (i = 0; i < n; i++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + return res; +} +#elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\ + !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + return PyObject_RichCompareBool(s1, s2, equals); +#else + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length, length2; + int kind; + void *data1, *data2; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + #endif + length = __Pyx_PyUnicode_GET_LENGTH(s1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length < 0)) return -1; + #endif + length2 = __Pyx_PyUnicode_GET_LENGTH(s2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length2 < 0)) return -1; + #endif + if (length != length2) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + return (equals == Py_EQ); +return_ne: + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(n == -1)) return NULL; + #endif + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + if (s == namei) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; + return kwvalues[i]; + } + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { + Py_ssize_t i, nkwargs; + PyObject *dict; +#if !CYTHON_ASSUME_SAFE_SIZE + nkwargs = PyTuple_Size(kwnames); + if (unlikely(nkwargs < 0)) return NULL; +#else + nkwargs = PyTuple_GET_SIZE(kwnames); +#endif + dict = PyDict_New(); + if (unlikely(!dict)) + return NULL; + for (i=0; itp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall (used by PyObjectCallOneArg) */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API + #if PY_VERSION_HEX < 0x03090000 + #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) + #elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { + PyTypeObject *tp = Py_TYPE(callable); + #if defined(__Pyx_CyFunction_USED) + if (__Pyx_CyFunction_CheckExact(callable)) { + return __Pyx_CyFunction_func_vectorcall(callable); + } + #endif + if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { + return NULL; + } + assert(PyCallable_Check(callable)); + Py_ssize_t offset = tp->tp_vectorcall_offset; + assert(offset > 0); + vectorcallfunc ptr; + memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); + return ptr; +} + #else + #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) + #endif +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if CYTHON_COMPILING_IN_LIMITED_API + return PyObject_Vectorcall(func, args, _nargs, NULL); + #else + vectorcallfunc f = __Pyx_PyVectorcall_Function(func); + if (f) { + return f(func, args, _nargs, NULL); + } + #endif + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* PyObjectCallOneArg (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + PyObject *result; + PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + if (unlikely(!selfless_args)) return NULL; + result = PyObject_Call(method, selfless_args, kwargs); + Py_DECREF(selfless_args); + return result; +} +#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { + return _PyObject_Vectorcall + (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames); +} +#else +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { + return +#if PY_VERSION_HEX < 0x03090000 + _PyObject_Vectorcall +#else + PyObject_Vectorcall +#endif + (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames); +} +#endif +static PyMethodDef __Pyx_UnboundCMethod_Def = { + "CythonUnboundCMethod", + __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 + METH_VARARGS | METH_KEYWORDS, +#else + METH_FASTCALL | METH_KEYWORDS, +#endif + NULL +}; +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method, *result=NULL; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + result = method; +#if CYTHON_COMPILING_IN_CPYTHON + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } else +#endif +#if CYTHON_COMPILING_IN_PYPY +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); +#endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); +#endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + result = unbound_method; + } + } +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + if (unlikely(target->method)) { + Py_DECREF(result); + } else +#endif + target->method = result; + return 0; +} + +/* CallUnboundCMethod0 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + if (likely(cfunc->flag == METH_NOARGS)) + return __Pyx_CallCFunction(cfunc, self, NULL); + if (likely(cfunc->flag == METH_FASTCALL)) + return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0); + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL); + if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS))) + return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (cfunc->flag == METH_VARARGS) + return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple); + return __Pyx__CallUnboundCMethod0(cfunc, self); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + PyObject *result; + if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; + result = __Pyx_PyObject_CallOneArg(cfunc->method, self); + return result; +} + +/* py_dict_items (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d); +} + +/* py_dict_values (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d); +} + +/* OwnedDictNext (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) { + PyObject *next = NULL; + if (!*ppos) { + if (pvalue) { + PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p); + if (unlikely(!dictview)) goto bad; + *ppos = PyObject_GetIter(dictview); + Py_DECREF(dictview); + } else { + *ppos = PyObject_GetIter(p); + } + if (unlikely(!*ppos)) goto bad; + } + next = PyIter_Next(*ppos); + if (!next) { + if (PyErr_Occurred()) goto bad; + return 0; + } + if (pkey && pvalue) { + *pkey = __Pyx_PySequence_ITEM(next, 0); + if (unlikely(*pkey)) goto bad; + *pvalue = __Pyx_PySequence_ITEM(next, 1); + if (unlikely(*pvalue)) goto bad; + Py_DECREF(next); + } else if (pkey) { + *pkey = next; + } else { + assert(pvalue); + *pvalue = next; + } + return 1; + bad: + Py_XDECREF(next); +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 + PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef"); +#else + PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef); +#endif + if (pkey) *pkey = NULL; + if (pvalue) *pvalue = NULL; + return 0; +} +#else // !CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) { + int result = PyDict_Next(p, ppos, pkey, pvalue); + if (likely(result == 1)) { + if (pkey) Py_INCREF(*pkey); + if (pvalue) Py_INCREF(*pvalue); + } + return result; +} +#endif + +/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); +} + +/* CallUnboundCMethod2 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, args, 2); + } + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *result = NULL; + PyObject *args = PyTuple_New(2); + if (unlikely(!args)) return NULL; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + return result; + } +#endif + { + PyObject *args[4] = {NULL, self, arg1, arg2}; + return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } +} + +/* ParseKeywordsImpl (used by ParseKeywords) */ +static int __Pyx_ValidateDuplicatePosArgs( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char* function_name) +{ + PyObject ** const *name = argnames; + while (name != first_kw_arg) { + PyObject *key = **name; + int found = PyDict_Contains(kwds, key); + if (unlikely(found)) { + if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; + } + name++; + } + return 0; +bad: + return -1; +} +#if CYTHON_USE_UNICODE_INTERNALS +static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) { + int kind; + Py_ssize_t len = PyUnicode_GET_LENGTH(s1); + if (len != PyUnicode_GET_LENGTH(s2)) return 0; + kind = PyUnicode_KIND(s1); + if (kind != PyUnicode_KIND(s2)) return 0; + const void *data1 = PyUnicode_DATA(s1); + const void *data2 = PyUnicode_DATA(s2); + return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0); +} +#endif +static int __Pyx_MatchKeywordArg_str( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + #if CYTHON_USE_UNICODE_INTERNALS + Py_hash_t key_hash = ((PyASCIIObject*)key)->hash; + if (unlikely(key_hash == -1)) { + key_hash = PyObject_Hash(key); + if (unlikely(key_hash == -1)) + goto bad; + } + #endif + name = first_kw_arg; + while (*name) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) { + *index_found = (size_t) (name - argnames); + return 1; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + *index_found = (size_t) (name - argnames); + return 1; + } + } + #endif + name++; + } + name = argnames; + while (name != first_kw_arg) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) { + if (__Pyx_UnicodeKeywordsEqual(name_str, key)) + goto arg_passed_twice; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + if (unlikely(name_str == key)) goto arg_passed_twice; + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + } + #endif + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +bad: + return -1; +} +static int __Pyx_MatchKeywordArg_nostr( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; + name = first_kw_arg; + while (*name) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (cmp == 1) { + *index_found = (size_t) (name - argnames); + return 1; + } + if (unlikely(cmp == -1)) goto bad; + name++; + } + name = argnames; + while (name != first_kw_arg) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (unlikely(cmp != 0)) { + if (cmp == 1) goto arg_passed_twice; + else goto bad; + } + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +bad: + return -1; +} +static CYTHON_INLINE int __Pyx_MatchKeywordArg( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + return likely(PyUnicode_CheckExact(key)) ? + __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) : + __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name); +} +static void __Pyx_RejectUnknownKeyword( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char *function_name) +{ + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; + #else + Py_ssize_t pos = 0; + #endif + PyObject *key = NULL; + __Pyx_BEGIN_CRITICAL_SECTION(kwds); + while ( + #if CYTHON_AVOID_BORROWED_REFS + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL) + #else + PyDict_Next(kwds, &pos, &key, NULL) + #endif + ) { + PyObject** const *name = first_kw_arg; + while (*name && (**name != key)) name++; + if (!*name) { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp != 1) { + if (cmp == 0) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + break; + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + } + __Pyx_END_CRITICAL_SECTION(); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); + #endif + assert(PyErr_Occurred()); +} +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t extracted = 0; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + name = first_kw_arg; + while (*name && num_kwargs > extracted) { + PyObject * key = **name; + PyObject *value; + int found = 0; + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + found = PyDict_GetItemRef(kwds, key, &value); + #else + value = PyDict_GetItemWithError(kwds, key); + if (value) { + Py_INCREF(value); + found = 1; + } else { + if (unlikely(PyErr_Occurred())) goto bad; + } + #endif + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + extracted++; + } + name++; + } + if (num_kwargs > extracted) { + if (ignore_unknown_kwargs) { + if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1)) + goto bad; + } else { + __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name); + goto bad; + } + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t len; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + if (PyDict_Update(kwds2, kwds) < 0) goto bad; + name = first_kw_arg; + while (*name) { + PyObject *key = **name; + PyObject *value; +#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)) + int found = PyDict_Pop(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int found = PyDict_GetItemRef(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad; + } +#else + #if CYTHON_COMPILING_IN_CPYTHON + value = _PyDict_Pop(kwds2, key, kwds2); + #else + value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2); + #endif + if (value == kwds2) { + Py_DECREF(value); + } else { + if (unlikely(!value)) goto bad; + values[name-argnames] = value; + } +#endif + name++; + } + len = PyDict_Size(kwds2); + if (len > 0) { + return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name); + } else if (unlikely(len == -1)) { + goto bad; + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject *key = NULL; + PyObject** const * name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) { +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); +#else + key = __Pyx_PyTuple_GET_ITEM(kwds, pos); +#endif +#if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!key)) goto bad; +#endif + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + PyObject *value = kwvalues[pos]; + values[name-argnames] = __Pyx_NewRef(value); + } else { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp == 1) { + PyObject *value = kwvalues[pos]; + values[index_found] = __Pyx_NewRef(value); + } else { + if (unlikely(cmp == -1)) goto bad; + if (kwds2) { + PyObject *value = kwvalues[pos]; + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else if (!ignore_unknown_kwargs) { + goto invalid_keyword; + } + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + key = NULL; + #endif + } + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + goto bad; +bad: + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(key); + #endif + return -1; +} + +/* ParseKeywords */ +static int __Pyx_ParseKeywords( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) + return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); + else if (kwds2) + return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name); + else + return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); +} + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* ArgTypeTestFunc (used by ArgTypeTest) */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode; + int from_annotation_subclass = 0; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (!exact) { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } else if (exact == 2) { + if (__Pyx_TypeCheck(obj, type)) { + from_annotation_subclass = 1; + extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately; + } + } + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")" +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + "%s%U" +#endif + , name, type_name, obj_type_name +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + , (from_annotation_subclass ? ". " : ""), extra_info +#endif + ); +#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + if (exact == 2 && from_annotation_subclass) { + PyObject *res; + PyObject *vargs[2]; + vargs[0] = PyErr_GetRaisedException(); + vargs[1] = extra_info; + res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL); + Py_XDECREF(res); + PyErr_SetRaisedException(vargs[0]); + } +#endif + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* RaiseException */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); +#elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} + +/* PyObjectFastCallMethod */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { + PyObject *result; + PyObject *attr = PyObject_GetAttr(args[0], name); + if (unlikely(!attr)) + return NULL; + result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); + Py_DECREF(attr); + return result; +} +#endif + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* CIntToDigits (used by CIntToPyUnicode) */ +static const char DIGIT_PAIRS_10[2*10*10+1] = { + "00010203040506070809" + "10111213141516171819" + "20212223242526272829" + "30313233343536373839" + "40414243444546474849" + "50515253545556575859" + "60616263646566676869" + "70717273747576777879" + "80818283848586878889" + "90919293949596979899" +}; +static const char DIGIT_PAIRS_8[2*8*8+1] = { + "0001020304050607" + "1011121314151617" + "2021222324252627" + "3031323334353637" + "4041424344454647" + "5051525354555657" + "6061626364656667" + "7071727374757677" +}; +static const char DIGITS_HEX[2*16+1] = { + "0123456789abcdef" + "0123456789ABCDEF" +}; + +/* BuildPyUnicode (used by COrdinalToPyUnicode) */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength, + int prepend_sign, char padding_char) { + PyObject *uval; + Py_ssize_t uoffset = ulength - clength; +#if CYTHON_USE_UNICODE_INTERNALS + Py_ssize_t i; + void *udata; + uval = PyUnicode_New(ulength, 127); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_DATA(uval); + if (uoffset > 0) { + i = 0; + if (prepend_sign) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); + i++; + } + for (; i < uoffset; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); + } + } + for (i=0; i < clength; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); + } +#else + { + PyObject *sign = NULL, *padding = NULL; + uval = NULL; + if (uoffset > 0) { + prepend_sign = !!prepend_sign; + if (uoffset > prepend_sign) { + padding = PyUnicode_FromOrdinal(padding_char); + if (likely(padding) && uoffset > prepend_sign + 1) { + PyObject *tmp = PySequence_Repeat(padding, uoffset - prepend_sign); + Py_DECREF(padding); + padding = tmp; + } + if (unlikely(!padding)) goto done_or_error; + } + if (prepend_sign) { + sign = PyUnicode_FromOrdinal('-'); + if (unlikely(!sign)) goto done_or_error; + } + } + uval = PyUnicode_DecodeASCII(chars, clength, NULL); + if (likely(uval) && padding) { + PyObject *tmp = PyUnicode_Concat(padding, uval); + Py_DECREF(uval); + uval = tmp; + } + if (likely(uval) && sign) { + PyObject *tmp = PyUnicode_Concat(sign, uval); + Py_DECREF(uval); + uval = tmp; + } +done_or_error: + Py_XDECREF(padding); + Py_XDECREF(sign); + } +#endif + return uval; +} + +/* COrdinalToPyUnicode (used by CIntToPyUnicode) */ +static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value) { + return value <= 1114111; +} +static PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t ulength, char padding_char) { + Py_ssize_t padding_length = ulength - 1; + if (likely((padding_length <= 250) && (value < 0xD800 || value > 0xDFFF))) { + char chars[256]; + if (value <= 255) { + memset(chars, padding_char, (size_t) padding_length); + chars[ulength-1] = (char) value; + return PyUnicode_DecodeLatin1(chars, ulength, NULL); + } + char *cpos = chars + sizeof(chars); + if (value < 0x800) { + *--cpos = (char) (0x80 | (value & 0x3f)); + value >>= 6; + *--cpos = (char) (0xc0 | (value & 0x1f)); + } else if (value < 0x10000) { + *--cpos = (char) (0x80 | (value & 0x3f)); + value >>= 6; + *--cpos = (char) (0x80 | (value & 0x3f)); + value >>= 6; + *--cpos = (char) (0xe0 | (value & 0x0f)); + } else { + *--cpos = (char) (0x80 | (value & 0x3f)); + value >>= 6; + *--cpos = (char) (0x80 | (value & 0x3f)); + value >>= 6; + *--cpos = (char) (0x80 | (value & 0x3f)); + value >>= 6; + *--cpos = (char) (0xf0 | (value & 0x07)); + } + cpos -= padding_length; + memset(cpos, padding_char, (size_t) padding_length); + return PyUnicode_DecodeUTF8(cpos, chars + sizeof(chars) - cpos, NULL); + } + if (value <= 127 && CYTHON_USE_UNICODE_INTERNALS) { + const char chars[1] = {(char) value}; + return __Pyx_PyUnicode_BuildFromAscii(ulength, chars, 1, 0, padding_char); + } + { + PyObject *uchar, *padding_uchar, *padding, *result; + padding_uchar = PyUnicode_FromOrdinal(padding_char); + if (unlikely(!padding_uchar)) return NULL; + padding = PySequence_Repeat(padding_uchar, padding_length); + Py_DECREF(padding_uchar); + if (unlikely(!padding)) return NULL; + uchar = PyUnicode_FromOrdinal(value); + if (unlikely(!uchar)) { + Py_DECREF(padding); + return NULL; + } + result = PyUnicode_Concat(padding, uchar); + Py_DECREF(padding); + Py_DECREF(uchar); + return result; + } +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!(is_unsigned || value == 0 || value > 0) || + !(sizeof(value) <= 2 || value & ~ (int) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) { + PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)"); + return NULL; + } + if (width <= 1) { + return PyUnicode_FromOrdinal((int) value); + } + return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char); +} +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(int)*3+2]; + char *dpos, *end = digits + sizeof(int)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + int remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (int) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (int) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (int) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!(is_unsigned || value == 0 || value > 0) || + !(sizeof(value) <= 2 || value & ~ (Py_ssize_t) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) { + PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)"); + return NULL; + } + if (width <= 1) { + return PyUnicode_FromOrdinal((int) value); + } + return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char); +} +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (Py_ssize_t) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (Py_ssize_t) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (Py_ssize_t) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* JoinPyUnicode */ +static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind, kind_shift; + Py_ssize_t i, char_pos; + void *result_udata; + if (max_char > 1114111) max_char = 1114111; + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; + result_udata = PyUnicode_DATA(result_uval); + assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - result_ulength < 0)) + goto overflow; + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = values[i]; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_PyUnicode_READY(uval) == (-1)) + goto bad; + #endif + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(ulength < 0)) goto bad; + #endif + if (unlikely(!ulength)) + continue; + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (ukind == result_ukind) { + memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); + } else { + #if PY_VERSION_HEX >= 0x030d0000 + if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; + #elif CYTHON_COMPILING_IN_CPYTHON || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); + } + #endif + } + char_pos += ulength; + } + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; +#else + Py_ssize_t i; + PyObject *result = NULL; + PyObject *value_tuple = PyTuple_New(value_count); + if (unlikely(!value_tuple)) return NULL; + CYTHON_UNUSED_VAR(max_char); + CYTHON_UNUSED_VAR(result_ulength); + for (i=0; i__pyx_empty_unicode, value_tuple); +bad: + Py_DECREF(value_tuple); + return result; +#endif +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#endif + +/* RejectKeywords */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) { + PyObject *key = NULL; + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) { + key = __Pyx_PySequence_ITEM(kwds, 0); + } else { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; +#else + Py_ssize_t pos = 0; +#endif +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return; +#endif + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL); +#if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); +#endif + } + if (likely(key)) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + Py_DECREF(key); + } +} + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b, int b_is_constant) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + Py_ssize_t adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* GetAttr3 */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int res = PyObject_GetOptionalAttr(o, n, &r); + return (res != 0) ? r : __Pyx_NewRef(d); +#else + #if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } + #endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +#endif +} + +/* PyDictVersioning (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + if (!PyErr_Occurred()) + PyErr_SetNone(PyExc_NameError); + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } + PyErr_Clear(); +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return result; + } +#else + result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* GetTopmostException (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} +#endif + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif +{ + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C0000 + local_value = tstate->current_exception; + tstate->current_exception = 0; + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000 + local_value = PyErr_GetRaisedException(); +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif +#if __PYX_LIMITED_VERSION_HEX > 0x030C0000 + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } +#else + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } +#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000 + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif + } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + PyErr_SetHandledException(local_value); + Py_XDECREF(local_value); + Py_XDECREF(local_type); + Py_XDECREF(local_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000 +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +#endif +} + +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* HasAttr (used by ImportImpl) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!PyUnicode_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (!r) { + return (unlikely(PyErr_Occurred())) ? -1 : 0; + } else { + Py_DECREF(r); + return 1; + } +} +#endif + +/* ImportImpl (used by Import) */ +static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) { + PyObject *imported_module = PyImport_GetModule(qualname); + if (unlikely(!imported_module)) { + *module = NULL; + if (PyErr_Occurred()) { + return -1; + } + return 0; + } + *module = imported_module; + return 1; +} +static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) { + PyObject *imported_module; + PyObject *top_level_package_name; + Py_ssize_t i; + int status, module_found; + Py_ssize_t dot_index; + module_found = __Pyx__Import_GetModule(qualname, &imported_module); + if (unlikely(!module_found || module_found == -1)) { + *module = NULL; + return module_found; + } + if (imported_names) { + for (i = 0; i < len_imported_names; i++) { + PyObject *imported_name = imported_names[i]; +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 + int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name); +#else + int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name); + if (unlikely(has_imported_attribute == -1)) goto error; +#endif + if (!has_imported_attribute) { + goto not_found; + } + } + *module = imported_module; + return 1; + } + dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1); + if (dot_index == -1) { + *module = imported_module; + return 1; + } + if (unlikely(dot_index == -2)) goto error; + top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index); + if (unlikely(!top_level_package_name)) goto error; + Py_DECREF(imported_module); + status = __Pyx__Import_GetModule(top_level_package_name, module); + Py_DECREF(top_level_package_name); + return status; +error: + Py_DECREF(imported_module); + *module = NULL; + return -1; +not_found: + Py_DECREF(imported_module); + *module = NULL; + return 0; +} +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *from_list = 0; + int module_found; + if (!qualname) { + qualname = name; + } + module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module); + if (likely(module_found == 1)) { + return module; + } else if (unlikely(module_found == -1)) { + return NULL; + } + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + if (imported_names) { +#if CYTHON_COMPILING_IN_CPYTHON + from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names); + if (unlikely(!from_list)) + goto bad; +#else + from_list = PyList_New(len_imported_names); + if (unlikely(!from_list)) goto bad; + for (Py_ssize_t i=0; i__pyx_d, level); +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); + for (i=0; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } +} + +/* PyObjectFormatAndDecref */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) { + if (unlikely(!s)) return NULL; + if (likely(PyUnicode_CheckExact(s))) return s; + return __Pyx_PyObject_FormatAndDecref(s, f); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) { + PyObject *result; + if (unlikely(!s)) return NULL; + result = PyObject_Format(s, f); + Py_DECREF(s); + return result; +} + +/* PyObjectFormat */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { + int ret; + _PyUnicodeWriter writer; + if (likely(PyFloat_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyFloat_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else if (likely(PyLong_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyLong_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else { + return PyObject_Format(obj, format_spec); + } + if (unlikely(ret == -1)) { + _PyUnicodeWriter_Dealloc(&writer); + return NULL; + } + return _PyUnicodeWriter_Finish(&writer); +} +#endif + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) { + Py_INCREF(v); + return PyList_SetItem(o, n, v); + } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old; + Py_INCREF(v); + old = PyList_GET_ITEM(o, n); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 0; + } + } else +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_SetItem(o, i, v); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v); +} + +/* RaiseUnboundLocalError */ +static void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b, int b_is_constant) { + long q = a / b; + long r = a - q*b; + long adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* tp_new */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __Pyx_tp_new_fallback(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + PyObject *new_func = NULL, *new_args = NULL, *obj; + Py_ssize_t i, nargs = PyTuple_Size(args); + if (unlikely(nargs < 0)) goto bad; + new_args = PyTuple_New(nargs + 1); + if (unlikely(!new_args)) goto bad; + for (i = 0; i < nargs + 1; i++) { + PyObject *item = (i == 0) ? type_obj : PyTuple_GetItem(args, i - 1); + if (unlikely(!item)) goto bad; + Py_INCREF(item); + if (unlikely(PyTuple_SetItem(new_args, i, item)) < 0) goto bad; + } + new_func = PyObject_GetAttrString(type_obj, "__new__"); + if (unlikely(!new_func)) goto bad; + obj = PyObject_Call(new_func, new_args, kwargs); + Py_DECREF(new_func); + Py_DECREF(new_args); + return obj; + bad: + Py_XDECREF(new_func); + Py_XDECREF(new_args); + return NULL; +} +#endif +static PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + newfunc tp_new = __Pyx_PyType_TryGetSlot((PyTypeObject*)type_obj, tp_new, newfunc); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) return __Pyx_tp_new_fallback(type_obj, args, kwargs); +#else + assert(tp_new != NULL); +#endif + return tp_new((PyTypeObject*)type_obj, args, kwargs); +} + +/* PyObjectSetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); + return PyObject_SetAttr(obj, attr_name, value); +} +#endif + +/* PyObjectVectorCallKwBuilder (used by PyObjectVectorCallMethodKwBuilder) */ +#if CYTHON_VECTORCALL +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_PyObject_FastCallDict; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + args[n] = value; + return 0; +} +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_VectorcallBuilder_AddArgStr; + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); +} +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + PyObject *pyKey = PyUnicode_FromString(key); + if (!pyKey) return -1; + return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); +} +#else // CYTHON_VECTORCALL +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return PyDict_SetItem(builder, key, value); +} +#endif + +/* PyObjectVectorCallMethodKwBuilder */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) { + PyObject *result; + PyObject *obj = PyObject_GetAttr(args[0], name); + if (unlikely(!obj)) + return NULL; + result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames); + Py_DECREF(obj); + return result; +} +#endif + +/* py_unicode_predicate */ +#if CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_Py_UNICODE_ISSPACE(Py_UCS4 uchar) { + int result; + PyObject *py_result, *ustring; + if (uchar < 133) { + switch (uchar) { + case 9: + case 10: + case 11: + case 12: + case 13: + case 28: + case 29: + case 30: + case 31: + case (Py_UCS4)' ': + return 1; + } + return 0; + } + ustring = PyUnicode_FromOrdinal(uchar); + if (!ustring) goto bad; + py_result = PyObject_CallMethod(ustring, "isspace", NULL); + Py_DECREF(ustring); + if (!py_result) goto bad; + result = PyObject_IsTrue(py_result); + Py_DECREF(py_result); + if (result == -1) goto bad; + return result != 0; +bad: + PyErr_Clear(); + return 0; +} +#endif + +/* SetStringIndexingError (used by GetItemIntUnicode) */ +static void __Pyx_SetStringIndexingError(const char* message, int has_gil) { + if (!has_gil) { + PyGILState_STATE gil_state = PyGILState_Ensure(); + PyErr_SetString(PyExc_IndexError, message); + PyGILState_Release(gil_state); + } else + PyErr_SetString(PyExc_IndexError, message); +} + +/* GetItemIntUnicode */ +static CYTHON_INLINE Py_UCS4 __Pyx_GetItemInt_Unicode_Fast(PyObject* ustring, Py_ssize_t i, + int wraparound, int boundscheck, int has_gil) { + Py_ssize_t length; + if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return (Py_UCS4)-1; + if (wraparound | boundscheck) { + length = __Pyx_PyUnicode_GET_LENGTH(ustring); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length < 0)) return (Py_UCS4)-1; + #endif + if (wraparound & unlikely(i < 0)) i += length; + if ((!boundscheck) || likely(__Pyx_is_valid_index(i, length))) { + return __Pyx_PyUnicode_READ_CHAR(ustring, i); + } else { + __Pyx_SetStringIndexingError("string index out of range", has_gil); + return (Py_UCS4)-1; + } + } else { + return __Pyx_PyUnicode_READ_CHAR(ustring, i); + } +} + +/* unicode_iter */ +static CYTHON_INLINE int __Pyx_init_unicode_iteration( + PyObject* ustring, Py_ssize_t *length, void** data, int *kind) { +#if CYTHON_COMPILING_IN_LIMITED_API + *kind = 0; + *length = PyUnicode_GetLength(ustring); + *data = (void*)ustring; +#else + if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return -1; + *kind = PyUnicode_KIND(ustring); + *length = PyUnicode_GET_LENGTH(ustring); + *data = PyUnicode_DATA(ustring); +#endif + return 0; +} + +/* PyUnicode_Substring */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring( + PyObject* text, Py_ssize_t start, Py_ssize_t stop) { + Py_ssize_t length; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(__Pyx_PyUnicode_READY(text) == -1)) return NULL; + #endif + length = __Pyx_PyUnicode_GET_LENGTH(text); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length < 0)) return NULL; + #endif + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + else if (stop > length) + stop = length; + if (stop <= start) + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode); + if (start == 0 && stop == length) + return __Pyx_NewRef(text); +#if CYTHON_COMPILING_IN_LIMITED_API + return PyUnicode_Substring(text, start, stop); +#else + return PyUnicode_FromKindAndData(PyUnicode_KIND(text), + PyUnicode_1BYTE_DATA(text) + start*PyUnicode_KIND(text), stop-start); +#endif +} + +/* IterFinish */ +static CYTHON_INLINE int __Pyx_IterFinish(void) { + PyObject* exc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (unlikely(exc_type)) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) + return -1; + __Pyx_PyErr_Clear(); + return 0; + } + return 0; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* SliceObject */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { + __Pyx_TypeName obj_type_name; +#if CYTHON_USE_TYPE_SLOTS + PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyLong_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyLong_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_USE_TYPE_SLOTS + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); +bad: + return NULL; +} + +/* PyLongCompare */ +static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + return 0; + } + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + int unequal; + unsigned long uintval; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + if (intval == 0) { + return (__Pyx_PyLong_IsZero(op1) != 1); + } else if (intval < 0) { + if (__Pyx_PyLong_IsNonNeg(op1)) + return 1; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + return 1; + } + uintval = (unsigned long) intval; +#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 4)) { + unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 3)) { + unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 2)) { + unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 1)) { + unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif + unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); + return (unequal != 0); + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(op1); + return ((double)a != (double)b); + } + return __Pyx_PyObject_IsTrueAndDecref( + PyObject_RichCompare(op1, op2, Py_NE)); +} + +/* PyLongBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) { + return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); +} +#if CYTHON_USE_PYLONG_INTERNALS +static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + const long b = intval; + long a; + const PY_LONG_LONG llb = intval; + PY_LONG_LONG lla; + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op2); + } + const int is_positive = __Pyx_PyLong_IsPos(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + if (likely(size == 1)) { + a = (long) digits[0]; + if (!is_positive) a *= -1; + } else { + switch (size) { + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) a *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) lla *= -1; + goto calculate_long_long; + } + break; + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) a *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) lla *= -1; + goto calculate_long_long; + } + break; + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) a *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) lla *= -1; + goto calculate_long_long; + } + break; + } + return PyLong_Type.tp_as_number->nb_add(op1, op2); + } + calculate_long: + { + long x; + x = a + b; + return PyLong_FromLong(x); + } + calculate_long_long: + { + PY_LONG_LONG llx; + llx = lla + llb; + return PyLong_FromLongLong(llx); + } + +} +#endif +static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) { + CYTHON_UNUSED_VAR(zerodivision_check); + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(float_val); + double result; + + result = ((double)a) + (double)b; + return PyFloat_FromDouble(result); +} +static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(zerodivision_check); + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check); + } + #endif + if (PyFloat_CheckExact(op1)) { + return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check); + } + return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace); +} +#endif + +/* RaiseClosureNameError */ +static void __Pyx_RaiseClosureNameError(const char *varname) { + PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); +} + +/* DictGetItem */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } + } + return value; +} +#endif + +/* PyLongCompare */ +static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + return 1; + } + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + int unequal; + unsigned long uintval; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + if (intval == 0) { + return (__Pyx_PyLong_IsZero(op1) == 1); + } else if (intval < 0) { + if (__Pyx_PyLong_IsNonNeg(op1)) + return 0; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + return 0; + } + uintval = (unsigned long) intval; +#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 4)) { + unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 3)) { + unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 2)) { + unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 1)) { + unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif + unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); + return (unequal == 0); + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(op1); + return ((double)a == (double)b); + } + return __Pyx_PyObject_IsTrueAndDecref( + PyObject_RichCompare(op1, op2, Py_EQ)); +} + +/* PyObjectLookupSpecial */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) { + PyObject *res; + PyTypeObject *tp = Py_TYPE(obj); + res = _PyType_Lookup(tp, attr_name); + if (likely(res)) { + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (!f) { + Py_INCREF(res); + } else { + res = f(res, obj, (PyObject *)tp); + } + } else if (with_error) { + PyErr_SetObject(PyExc_AttributeError, attr_name); + } + return res; +} +#endif + +/* dict_setdefault (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + PyObject *args[] = {d, key, default_value}; + value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#elif CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#else + value = PyDict_SetDefault(d, key, default_value); + if (unlikely(!value)) return NULL; + Py_INCREF(value); +#endif + return value; +} + +/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static Py_ssize_t __Pyx_GetTypeDictOffset(void) { + PyObject *tp_dictoffset_o; + Py_ssize_t tp_dictoffset; + tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__"); + if (unlikely(!tp_dictoffset_o)) return -1; + tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o); + Py_DECREF(tp_dictoffset_o); + if (unlikely(tp_dictoffset == 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' doesn't have a dictoffset"); + return -1; + } else if (unlikely(tp_dictoffset < 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' has an unexpected negative dictoffset. " + "Please report this as Cython bug"); + return -1; + } + return tp_dictoffset; +} +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) { + static Py_ssize_t tp_dictoffset = 0; + if (unlikely(tp_dictoffset == 0)) { + tp_dictoffset = __Pyx_GetTypeDictOffset(); + if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) { + tp_dictoffset = 0; // try again next time? + return NULL; + } + } + return *(PyObject**)((char*)tp + tp_dictoffset); +} +#endif + +/* SetItemOnTypeDict (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) { + int result; + PyObject *tp_dict; +#if CYTHON_COMPILING_IN_LIMITED_API + tp_dict = __Pyx_GetTypeDict(tp); + if (unlikely(!tp_dict)) return -1; +#else + tp_dict = tp->tp_dict; +#endif + result = PyDict_SetItem(tp_dict, k, v); + if (likely(!result)) { + PyType_Modified(tp); + if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) { + PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL); + if (!setNameResult) return -1; + Py_DECREF(setNameResult); + } + } + return result; +} + +/* FixUpExtensionType (used by FetchCommonType) */ +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if __PYX_LIMITED_VERSION_HEX > 0x030900B1 + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#else + const PyType_Slot *slot = spec->slots; + int changed = 0; +#if !CYTHON_COMPILING_IN_LIMITED_API + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { +#if !CYTHON_COMPILING_IN_CPYTHON + const +#endif // !CYTHON_COMPILING_IN_CPYTHON) + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_vectorcall_offset = memb->offset; + changed = 1; + } +#endif // CYTHON_METH_FASTCALL +#if !CYTHON_COMPILING_IN_PYPY + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } +#endif // !CYTHON_COMPILING_IN_PYPY + } + memb++; + } + } +#endif // !CYTHON_COMPILING_IN_LIMITED_API +#if !CYTHON_COMPILING_IN_PYPY + slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_getset) + slot++; + if (slot && slot->slot == Py_tp_getset) { + PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc; + while (getset && getset->name) { + if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) { + PyObject *descr = PyDescr_NewGetSet(type, getset); + if (unlikely(!descr)) + return -1; + #if CYTHON_COMPILING_IN_LIMITED_API + PyObject *pyname = PyUnicode_FromString(getset->name); + if (unlikely(!pyname)) { + Py_DECREF(descr); + return -1; + } + int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr); + Py_DECREF(pyname); + #else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + #endif + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } + ++getset; + } + } +#else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#endif // !CYTHON_COMPILING_IN_PYPY + if (changed) + PyType_Modified(type); +#endif // PY_VERSION_HEX > 0x030900B1 + return 0; +} + +/* AddModuleRef (used by FetchSharedCythonModule) */ +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { + PyObject *module_dict = PyImport_GetModuleDict(); + PyObject *m; + if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { + return NULL; + } + if (m != NULL && PyModule_Check(m)) { + return m; + } + Py_XDECREF(m); + m = PyModule_NewObject(name); + if (m == NULL) + return NULL; + if (PyDict_CheckExact(module_dict)) { + PyObject *new_m; + (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); + Py_DECREF(m); + return new_m; + } else { + if (PyObject_SetItem(module_dict, name, m) != 0) { + Py_DECREF(m); + return NULL; + } + return m; + } + } + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *py_name = PyUnicode_FromString(name); + if (!py_name) return NULL; + PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); + Py_DECREF(py_name); + return module; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } +#endif + +/* FetchSharedCythonModule (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME); +} + +/* FetchCommonType (used by CommonTypesMetaclass) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases); + if (result && metaclass) { + PyObject *old_tp = (PyObject*)Py_TYPE(result); + Py_INCREF((PyObject*)metaclass); +#if __PYX_LIMITED_VERSION_HEX >= 0x03090000 + Py_SET_TYPE(result, metaclass); +#else + result->ob_type = metaclass; +#endif + Py_DECREF(old_tp); + } + return result; +} +#else +#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b) +#endif +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t expected_basicsize) { + Py_ssize_t basicsize; + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (expected_basicsize == 0) { + return 0; // size is inherited, nothing useful to check + } +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) return -1; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = NULL; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; +#else + basicsize = ((PyTypeObject*) cached_type)->tp_basicsize; +#endif + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name; + int get_item_ref_result; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + py_object_name = PyUnicode_FromString(object_name); + if (!py_object_name) return NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) goto done; + abi_module_dict = PyModule_GetDict(abi_module); + if (!abi_module_dict) goto done; + get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type); + if (get_item_ref_result == 1) { + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else if (unlikely(get_item_ref_result == -1)) { + goto bad; + } + cached_type = __Pyx_PyType_FromMetaclass( + metaclass, + CYTHON_USE_MODULE_STATE ? module : abi_module, + spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type); + if (unlikely(new_cached_type != cached_type)) { + if (unlikely(!new_cached_type)) goto bad; + Py_DECREF(cached_type); + cached_type = new_cached_type; + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else { + Py_DECREF(new_cached_type); + } +done: + Py_XDECREF(abi_module); + Py_DECREF(py_object_name); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +/* CommonTypesMetaclass (used by CythonFunctionShared) */ +static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) { + return PyUnicode_FromString(__PYX_ABI_MODULE_NAME); +} +#if __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) { + PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types"); + return NULL; +} +static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) { + PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable"); + return -1; +} +#endif +static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = { + {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = { + {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset}, + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr}, + #endif + {0, 0} +}; +static PyType_Spec __pyx_CommonTypesMetaclass_spec = { + __PYX_TYPE_MODULE_PREFIX "_common_types_metatype", + 0, + 0, + Py_TPFLAGS_IMMUTABLETYPE | + Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT, + __pyx_CommonTypesMetaclass_slots +}; +static int __pyx_CommonTypesMetaclass_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + PyObject *bases = PyTuple_Pack(1, &PyType_Type); + if (unlikely(!bases)) { + return -1; + } + mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases); + Py_DECREF(bases); + if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) { + return -1; + } + return 0; +} + +/* CallTypeTraverse (used by CythonFunctionShared) */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) { + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000 + if (__Pyx_get_runtime_version() < 0x03090000) return 0; + #endif + if (!always_call) { + PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*); + unsigned long flags = PyType_GetFlags(base); + if (flags & Py_TPFLAGS_HEAPTYPE) { + return 0; + } + } + Py_VISIT((PyObject*)Py_TYPE(o)); + return 0; +} +#endif + +/* PyMethodNew (used by CythonFunctionShared) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *result; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + { + PyObject *args[] = {func, self}; + result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL); + } + #else + result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL); + #endif + return result; +} +#else +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#endif + +/* PyVectorcallFastCallDict (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i; + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos; + #else + Py_ssize_t pos; + #endif + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + #if !CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t nkw = PyDict_Size(kw); + if (unlikely(nkw == -1)) return NULL; + #else + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + #endif + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = 0; + i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) { + keys_are_strings &= + #if CYTHON_COMPILING_IN_LIMITED_API + PyType_GetFlags(Py_TYPE(key)); + #else + Py_TYPE(key)->tp_flags; + #endif + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup; + #else + PyTuple_SET_ITEM(kwnames, i, key); + #endif + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(pos); + #endif + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + Py_ssize_t kw_size = + likely(kw == NULL) ? + 0 : +#if !CYTHON_ASSUME_SAFE_SIZE + PyDict_Size(kw); +#else + PyDict_GET_SIZE(kw); +#endif + if (kw_size == 0) { + return vc(func, args, nargs, NULL); + } +#if !CYTHON_ASSUME_SAFE_SIZE + else if (unlikely(kw_size == -1)) { + return NULL; + } +#endif + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif + +/* CythonFunctionShared (used by CythonFunction) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) { + if (__Pyx_CyFunction_Check(func)) { + return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; + } else if (PyCFunction_Check(func)) { + return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; + } + return 0; +} +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) { + int result; + PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func); + if (unlikely(!newFunc)) { + PyErr_Clear(); // It's only an optimization, so don't throw an error + return 0; + } + result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc); + Py_DECREF(newFunc); + return result; + } + return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc); +} +#else +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if (PyMethod_Check(func)) { + func = PyMethod_GET_FUNCTION(func); + } + return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +} +#endif +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + PyObject *result; + CYTHON_UNUSED_VAR(closure); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_doc_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#else + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_name_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_name, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + PyObject *result; + __Pyx_BEGIN_CRITICAL_SECTION(op); + Py_INCREF(op->func_qualname); + result = op->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +#endif +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_defaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_kwdefaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_annotations_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) { + int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; + if (is_coroutine) { + PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(is_coroutine_value)) { + return is_coroutine_value; + } +ignore: + PyErr_Clear(); + } + return __Pyx_PyBool_FromLong(is_coroutine); +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + result = __Pyx_CyFunction_get_is_coroutine_value(op); + if (unlikely(!result)) + return NULL; + __Pyx_BEGIN_CRITICAL_SECTION(op); + if (op->func_is_coroutine) { + Py_DECREF(result); + result = __Pyx_NewRef(op->func_is_coroutine); + } else { + op->func_is_coroutine = __Pyx_NewRef(result); + } + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, message, size); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + name, message, size); +#endif +} +static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s", + py_name, message); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s", + name, message); +#endif +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, +#else + {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, +#endif + {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#endif +#if CYTHON_METH_FASTCALL +#if CYTHON_COMPILING_IN_LIMITED_API + {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else + {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(args); + __Pyx_BEGIN_CRITICAL_SECTION(m); + Py_INCREF(m->func_qualname); + result = m->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + op->func_dict = NULL; +#endif + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func_dict); +#elif PY_VERSION_HEX < 0x030d0000 + _PyObject_ClearManagedDict((PyObject*)m); +#else + PyObject_ClearManagedDict((PyObject*)m); +#endif + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + Py_CLEAR(m->defaults); + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + { + int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg); + if (e) return e; + } + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func_dict); +#else + { + int e = +#if PY_VERSION_HEX < 0x030d0000 + _PyObject_VisitManagedDict +#else + PyObject_VisitManagedDict +#endif + ((PyObject*)m, visit, arg); + if (e != 0) return e; + } +#endif + __Pyx_VISIT_CONST(m->func_name); + __Pyx_VISIT_CONST(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + __Pyx_VISIT_CONST(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + Py_VISIT(m->defaults); + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ + PyObject *repr; + __Pyx_BEGIN_CRITICAL_SECTION(op); + repr = PyUnicode_FromFormat("", + op->func_qualname, (void *)op); + __Pyx_END_CRITICAL_SECTION(); + return repr; +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes no arguments", size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes exactly one argument", size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } + __Pyx_CyFunction_raise_type_error( + (__pyx_CyFunctionObject*)func, "takes no keyword arguments"); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_SIZE + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(argc < 0)) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "needs an argument"); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "takes no keyword arguments"); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes no arguments", nargs); + return NULL; + } + return meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes exactly one argument", nargs); + return NULL; + } + return meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + #if PY_VERSION_HEX < 0x030e00A6 + size_t nargs_value = (size_t) nargs; + #else + Py_ssize_t nargs_value = nargs; + #endif + return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames); +} +#endif +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if CYTHON_METH_FASTCALL +#if defined(Py_TPFLAGS_HAVE_VECTORCALL) + Py_TPFLAGS_HAVE_VECTORCALL | +#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif +#endif // CYTHON_METH_FASTCALL +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_DICT | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +static int __pyx_CyFunction_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL); + if (unlikely(mstate->__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type); + if (unlikely(!m->defaults)) + return NULL; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* AllocateExtensionType */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) { + if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc); + return alloc_func(t, 0); + } else { + newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc); + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) { + PyObject *new_str = PyUnicode_FromString("__new__"); + if (likely(new_str)) { + PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL); + Py_DECREF(new_str); + return o; + } else + return NULL; + } else + #endif + return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0); + } +} + +/* PyObjectCallNoArg (used by PyObjectCallMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg[2] = {NULL, NULL}; + return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod (used by PyObjectCallMethod0) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } +#endif + *method = attr; + return 0; +} +#endif + +/* PyObjectCallMethod0 (used by PyType_Ready) */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[1] = {obj}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_CallNoArg; + return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +#endif +} + +/* ValidateBasesTuple (used by PyType_Ready) */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_SIZE + n = PyTuple_GET_SIZE(bases); +#else + n = PyTuple_Size(bases); + if (unlikely(n < 0)) return -1; +#endif + for (i = 1; i < n; i++) + { + PyTypeObject *b; +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + if (dictoffset == 0) + { + Py_ssize_t b_dictoffset = 0; +#if CYTHON_USE_TYPE_SLOTS + b_dictoffset = b->tp_dictoffset; +#else + PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__"); + if (!py_b_dictoffset) goto dictoffset_return; + b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset); + Py_DECREF(py_b_dictoffset); + if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return; +#endif + if (b_dictoffset) { + { + __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); + } +#if !CYTHON_USE_TYPE_SLOTS + dictoffset_return: +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + } +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + } + return 0; +} +#endif + +/* PyType_Ready */ +CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) { + while (t) { + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases) { + return 1; + } + t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*); + } + return 0; +} +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + if (!__Pyx_PyType_HasMultipleInheritance(t)) { + return PyType_Ready(t); + } + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\ + !CYTHON_COMPILING_IN_GRAAL + gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* GetVTable (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i=0; + Py_ssize_t size; + void** base_vtables; + __Pyx_TypeName tp_base_name = NULL; + __Pyx_TypeName base_name = NULL; + void* unknown = (void*)-1; + PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); + int base_depth = 0; + { + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (base) { + base_depth += 1; + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; +#if CYTHON_COMPILING_IN_LIMITED_API + size = PyTuple_Size(bases); + if (size < 0) goto other_failure; +#else + size = PyTuple_GET_SIZE(bases); +#endif + for (i = 1; i < size; i++) { + PyObject *basei; + void* base_vtable; +#if CYTHON_AVOID_BORROWED_REFS + basei = PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#else + basei = PyTuple_GET_ITEM(bases, i); +#endif + base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + if (base_vtable != NULL) { + int j; + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + } + PyErr_Clear(); + PyMem_Free(base_vtables); + return 0; +bad: + { + PyTypeObject* basei = NULL; + PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); +#if CYTHON_AVOID_BORROWED_REFS + basei = (PyTypeObject*)PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = (PyTypeObject*)PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#else + basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); +#endif + base_name = __Pyx_PyType_GetFullyQualifiedName(basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + } + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); +#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +really_bad: // bad has failed! +#endif + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +other_failure: +#endif + PyMem_Free(base_vtables); + return -1; +} + +/* DelItemOnTypeDict (used by SetupReduce) */ +static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) { + int result; + PyObject *tp_dict; +#if CYTHON_COMPILING_IN_LIMITED_API + tp_dict = __Pyx_GetTypeDict(tp); + if (unlikely(!tp_dict)) return -1; +#else + tp_dict = tp->tp_dict; +#endif + result = PyDict_DelItem(tp_dict, k); + if (likely(!result)) PyType_Modified(tp); + return result; +} + +/* SetupReduce */ +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_name_2); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate); +#else + getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate); + if (!getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (getstate) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); +#else + object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); + if (!object_getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (object_getstate != getstate) { + goto __PYX_GOOD; + } + } +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); + if (likely(reduce_cython)) { + ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); + if (likely(setstate_cython)) { + ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } + } + PyType_Modified((PyTypeObject*)type_obj); + } + } + goto __PYX_GOOD; +__PYX_BAD: + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); + } + ret = -1; +__PYX_GOOD: +#if !CYTHON_USE_PYTYPE_LOOKUP + Py_XDECREF(object_reduce); + Py_XDECREF(object_reduce_ex); + Py_XDECREF(object_getstate); + Py_XDECREF(getstate); +#endif + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; +} + +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_2_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size) +{ + PyObject *result = 0; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) + PyObject *py_basicsize; + PyObject *py_itemsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) ) + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; +#else + if (size == 0) { + return (PyTypeObject *)result; + } + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize+itemsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_1 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_1 && (size_t)basicsize > size) { + if (PyErr_WarnFormat(NULL, 0, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize) < 0) { + goto bad; + } + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; +} +#endif + +/* PxdImportShared (used by VoidPtrImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(PyObject *module, const char *name, void **p, const char *sig, const char *what) { + PyObject *d = 0; + PyObject *cobj = 0; + d = PyObject_GetAttrString(module, "__pyx_capi__"); + if (!d) + goto bad; +#if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000) + PyDict_GetItemStringRef(d, name, &cobj); +#else + cobj = PyDict_GetItemString(d, name); + Py_XINCREF(cobj); +#endif + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%.200s does not export expected C %.8s %.200s", + PyModule_GetName(module), what, name); + goto bad; + } + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C %.8s %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", + what, PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); + goto bad; + } + *p = PyCapsule_GetPointer(cobj, sig); + if (!(*p)) + goto bad; + Py_DECREF(d); + Py_DECREF(cobj); + return 0; +bad: + Py_XDECREF(d); + Py_XDECREF(cobj); + return -1; +} +#endif + +/* VoidPtrImport */ +#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +#define __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig) { + return __Pyx_ImportFromPxd_3_2_1(module, name, p, sig, "variable"); +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__2); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\ + CYTHON_COMPILING_IN_GRAAL + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); + } + return value; +} + +/* CLineInTraceback (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) +#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); +#else +PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { + PyObject **dict_ptr = _PyObject_GetDictPtr(o); + return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; +} +#endif +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline = NULL; + PyObject *ptype, *pvalue, *ptraceback; + PyObject *cython_runtime_dict; + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, cython_runtime_dict, + __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) + } + if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + Py_XDECREF(use_cline); + Py_XDECREF(cython_runtime_dict); + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache (used by AddTraceback) */ +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { + __Pyx_CachedCodeObjectType* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!code_cache->entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { + return NULL; + } + code_object = code_cache->entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__find_code_object; + return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); + if (old_count < 0) { + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); + return NULL; + } +#endif + __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); +#endif + return result; +#endif +} +static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) +{ + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + code_cache->entries = entries; + code_cache->max_count = 64; + code_cache->count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { + __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_INCREF(code_object); + Py_DECREF(tmp); + return; + } + if (code_cache->count == code_cache->max_count) { + int new_max = code_cache->max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + code_cache->entries = entries; + code_cache->max_count = new_max; + } + for (i=code_cache->count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + code_cache->count++; + Py_INCREF(code_object); +} +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__insert_code_object; + return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type expected = 0; + if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { + return; + } +#endif + __pyx__insert_code_object(code_cache, code_line, code_object); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); +#endif +#endif +} + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!code_object) { + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + } else { + py_funcname = PyUnicode_FromString(funcname); + } + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); + } else { + dict = PyDict_New(); + } + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + } + py_code = PyCode_NewEmpty(filename, funcname, py_line); + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} +#endif + +/* CIntFromPyVerify */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* UnicodeAsUCS4 */ +static void __Pyx_PyUnicode_AsPy_UCS4_error(Py_ssize_t length) { + if (likely(length >= 0)) { + PyErr_Format(PyExc_ValueError, + "only single character unicode strings can be converted to Py_UCS4, " + "got length %" CYTHON_FORMAT_SSIZE_T "d", length); + } +} +static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) { + Py_ssize_t length = __Pyx_PyUnicode_GET_LENGTH(x); + if (unlikely(length != 1)) { + __Pyx_PyUnicode_AsPy_UCS4_error(length); + return (Py_UCS4)-1; + } + return __Pyx_PyUnicode_READ_CHAR(x, 0); +} + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_float(a, a); + case 3: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); + case 4: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powf(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2f(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_double(a, a); + case 3: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); + case 4: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = pow(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return ::std::complex< long double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + __pyx_t_long_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsl(b.real) >= fabsl(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + long double r = b.imag / b.real; + long double s = (long double)(1.0) / (b.real + b.imag * r); + return __pyx_t_long_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + long double r = b.real / b.imag; + long double s = (long double)(1.0) / (b.imag + b.real * r); + return __pyx_t_long_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + long double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_long_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtl(z.real*z.real + z.imag*z.imag); + #else + return hypotl(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + long double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + long double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_long__double(a, a); + case 3: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, a); + case 4: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powl(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2l(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_long__double(a); + theta = atan2l(a.imag, a.real); + } + lnr = logl(r); + z_r = expl(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosl(z_theta); + z.imag = z_r * sinl(z_theta); + return z; + } + #endif +#endif + +/* MemviewRefcount */ +#include +#ifndef _Py_NO_RETURN +#define _Py_NO_RETURN +#endif +_Py_NO_RETURN +static void __pyx_fatalerror(const char *fmt, ...) { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + +/* MemviewSliceIsContig */ +static int +__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) +{ + int i, index, step, start; + Py_ssize_t itemsize = mvs.memview->view.itemsize; + if (order == 'F') { + step = 1; + start = 0; + } else { + step = -1; + start = ndim - 1; + } + for (i = 0; i < ndim; i++) { + index = start + step * i; + if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize) + return 0; + itemsize *= mvs.shape[index]; + } + return 1; +} + +/* OverlappingSlices */ +static void +__pyx_get_array_memory_extents(__Pyx_memviewslice *slice, + void **out_start, void **out_end, + int ndim, size_t itemsize) +{ + char *start, *end; + int i; + start = end = slice->data; + for (i = 0; i < ndim; i++) { + Py_ssize_t stride = slice->strides[i]; + Py_ssize_t extent = slice->shape[i]; + if (extent == 0) { + *out_start = *out_end = start; + return; + } else { + if (stride > 0) + end += stride * (extent - 1); + else + start += stride * (extent - 1); + } + } + *out_start = start; + *out_end = end + itemsize; +} +static int +__pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize) +{ + void *start1, *end1, *start2, *end2; + __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize); + __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize); + return (start1 < end2) && (start2 < end1); +} + +/* MemviewSliceInit */ +static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF((PyObject*)memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + int val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (int) -1; + val = __Pyx_PyLong_As_int(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(int) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + int val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (int) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = v; + } + v = NULL; + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((int) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (int) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPy */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyLong_As_uint64_t(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint64_t val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(uint64_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((uint64_t) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (uint64_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + long val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (long) -1; + val = __Pyx_PyLong_As_long(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + long val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (long) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (long) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = v; + } + v = NULL; + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((long) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (long) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* ObjectAsUCS4 */ +static void __Pyx__PyObject_AsPy_UCS4_raise_error(long ival) { + if (ival < 0) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_OverflowError, + "cannot convert negative value to Py_UCS4"); + } else { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to Py_UCS4"); + } +} +static Py_UCS4 __Pyx__PyObject_AsPy_UCS4(PyObject* x) { + long ival; + ival = __Pyx_PyLong_As_long(x); + if (unlikely(!__Pyx_is_valid_index(ival, 1114111 + 1))) { + __Pyx__PyObject_AsPy_UCS4_raise_error(ival); + return (Py_UCS4)-1; + } + return (Py_UCS4)ival; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(uint64_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint64_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* MemviewSliceCopy */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object) +{ + __Pyx_RefNannyDeclarations + int i; + __Pyx_memviewslice new_mvs = __Pyx_MEMSLICE_INIT; + struct __pyx_memoryview_obj *from_memview = from_mvs->memview; + Py_buffer *buf = &from_memview->view; + PyObject *shape_tuple = NULL; + PyObject *temp_int = NULL; + struct __pyx_array_obj *array_obj = NULL; + struct __pyx_memoryview_obj *memview_obj = NULL; + __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); + for (i = 0; i < ndim; i++) { + if (unlikely(from_mvs->suboffsets[i] >= 0)) { + PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " + "indirect dimensions (axis %d)", i); + goto fail; + } + } + shape_tuple = PyTuple_New(ndim); + if (unlikely(!shape_tuple)) { + goto fail; + } + __Pyx_GOTREF(shape_tuple); + for(i = 0; i < ndim; i++) { + temp_int = PyLong_FromSsize_t(from_mvs->shape[i]); + if(unlikely(!temp_int)) { + goto fail; + } else { +#if CYTHON_ASSUME_SAFE_MACROS + PyTuple_SET_ITEM(shape_tuple, i, temp_int); +#else + if (PyTuple_SetItem(shape_tuple, i, temp_int) < 0) { + goto fail; + } +#endif + temp_int = NULL; + } + } + array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, mode, NULL); + if (unlikely(!array_obj)) { + goto fail; + } + __Pyx_GOTREF(array_obj); + memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( + (PyObject *) array_obj, contig_flag, + dtype_is_object, + from_mvs->memview->typeinfo); + if (unlikely(!memview_obj)) + goto fail; + if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0)) + goto fail; + if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim, + dtype_is_object) < 0)) + goto fail; + goto no_fail; +fail: + __Pyx_XDECREF((PyObject *) new_mvs.memview); + new_mvs.memview = NULL; + new_mvs.data = NULL; +no_fail: + __Pyx_XDECREF(shape_tuple); + __Pyx_XDECREF(temp_int); + __Pyx_XDECREF((PyObject *) array_obj); + __Pyx_RefNannyFinishContext(); + return new_mvs; +} + +/* PyObjectCall2Args (used by PyObjectCallMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectCallMethod1 (used by UpdateUnpickledDict) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +#endif +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +#endif +} + +/* UpdateUnpickledDict */ +static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + PyObject *state_dict = __Pyx_PySequence_ITEM(state, index); + if (unlikely(!state_dict)) { + return -1; + } + int non_empty = PyObject_IsTrue(state_dict); + if (non_empty == 0) { + Py_DECREF(state_dict); + return 0; + } else if (unlikely(non_empty == -1)) { + return -1; + } + PyObject *dict; + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + dict = PyObject_GetAttrString(obj, "__dict__"); + #else + dict = PyObject_GenericGetDict(obj, NULL); + #endif + if (unlikely(!dict)) { + Py_DECREF(state_dict); + return -1; + } + int result; + if (likely(PyDict_CheckExact(dict))) { + result = PyDict_Update(dict, state_dict); + } else { + PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict); + if (likely(obj_result)) { + Py_DECREF(obj_result); + result = 0; + } else { + result = -1; + } + } + Py_DECREF(state_dict); + Py_DECREF(dict); + return result; +} +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(state_size == -1)) return -1; + #endif + if (state_size <= index) { + return 0; + } + return __Pyx__UpdateUnpickledDict(obj, state, index); +} + +/* CheckUnpickleChecksum */ +static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + PyObject *pickle_module = PyImport_ImportModule("pickle"); + if (unlikely(!pickle_module)) return; + PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError"); + Py_DECREF(pickle_module); + if (unlikely(!pickle_error)) return; + if (checksum2 == checksum1) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))", + checksum, checksum1, members); + } else if (checksum3 == checksum2) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, members); + } else { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, checksum3, members); + } + Py_DECREF(pickle_error); +} +static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + int found = 0; + found |= checksum1 == checksum; + found |= checksum2 == checksum; + found |= checksum3 == checksum; + if (likely(found)) + return 0; + __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members); + return -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE char __Pyx_PyLong_As_char(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const char neg_one = (char) -1, const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + char val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (char) -1; + val = __Pyx_PyLong_As_char(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (char) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(char) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(char) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + char val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (char) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (char) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (char) -1; + } else { + stepval = v; + } + v = NULL; + val = (char) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((char) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (char) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to char"); + return (char) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to char"); + return (char) -1; +} + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static __Pyx_TypeName +__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) +{ + PyObject *module = NULL, *name = NULL, *result = NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_qualname); + #else + name = PyType_GetQualName(tp); + #endif + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; + module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_module); + if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; + if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { + result = name; + name = NULL; + goto done; + } + result = PyUnicode_FromFormat("%U.%U", module, name); + if (unlikely(result == NULL)) goto bad; + done: + Py_XDECREF(name); + Py_XDECREF(module); + return result; + bad: + PyErr_Clear(); + if (name) { + result = name; + name = NULL; + } else { + result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__11); + } + goto done; +} +#endif + +/* GetRuntimeVersion */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +void __Pyx_init_runtime_version(void) { + if (__Pyx_cached_runtime_version == 0) { + const char* rt_version = Py_GetVersion(); + unsigned long version = 0; + unsigned long factor = 0x01000000UL; + unsigned int digit = 0; + int i = 0; + while (factor) { + while ('0' <= rt_version[i] && rt_version[i] <= '9') { + digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); + ++i; + } + version += factor * digit; + if (rt_version[i] != '.') + break; + digit = 0; + factor >>= 8; + ++i; + } + __Pyx_cached_runtime_version = version; + } +} +#endif +static unsigned long __Pyx_get_runtime_version(void) { +#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + return Py_Version & ~0xFFUL; +#else + return __Pyx_cached_runtime_version; +#endif +} + +/* IterNextPlain (used by CoroutineBase) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) { + if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache)) + __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next); + return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) { +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + PyObject *result; + PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI(); + if (unlikely(!next)) return NULL; + result = PyObject_CallFunctionObjArgs(next, iterator, NULL); + return result; +#else + (void)__Pyx_GetBuiltinName; // only for early limited API + iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator); + assert(iternext); + return iternext(iterator); +#endif +} + +/* ReturnWithStopIteration (used by CoroutineBase) */ +static void __Pyx__ReturnWithStopIteration(PyObject* value, int async); +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) { + if (value == Py_None) { + if (async || !iternext) + PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration); + return; + } + __Pyx__ReturnWithStopIteration(value, async); +} +static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) { +#if CYTHON_COMPILING_IN_CPYTHON + __Pyx_PyThreadState_declare +#endif + PyObject *exc; + PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration; +#if CYTHON_COMPILING_IN_CPYTHON + if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) { + if (PY_VERSION_HEX >= (0x030e00A1)) { + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + } else { + PyObject *args_tuple = PyTuple_New(1); + if (unlikely(!args_tuple)) return; + Py_INCREF(value); + PyTuple_SET_ITEM(args_tuple, 0, value); + exc = PyObject_Call(exc_type, args_tuple, NULL); + Py_DECREF(args_tuple); + } + if (unlikely(!exc)) return; + } else { + Py_INCREF(value); + exc = value; + } + #if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + #if CYTHON_USE_EXC_INFO_STACK + if (!__pyx_tstate->exc_info->exc_value) + #else + if (!__pyx_tstate->exc_type) + #endif + { + Py_INCREF(exc_type); + __Pyx_ErrRestore(exc_type, exc, NULL); + return; + } + #endif +#else + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + if (unlikely(!exc)) return; +#endif + PyErr_SetObject(exc_type, exc); + Py_DECREF(exc); +} + +/* CoroutineBase (used by Generator) */ +#if !CYTHON_COMPILING_IN_LIMITED_API +#include +#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#endif // CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void +__Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) { +#if CYTHON_USE_AM_SEND + gen->yieldfrom_am_send = NULL; +#endif + Py_CLEAR(gen->yieldfrom); +} +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + CYTHON_UNUSED_VAR(__pyx_tstate); + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (likely(et == PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + value = Py_None; + } + else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); + if (unlikely(!value)) goto limited_api_failure; + #else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + #endif + Py_DECREF(ev); + } + else if (unlikely(PyTuple_Check(ev))) { + Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(tuple_size < 0)) { + Py_XDECREF(tb); + Py_DECREF(ev); + Py_DECREF(et); + return -1; + } + #endif + if (tuple_size >= 1) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + value = PyTuple_GET_ITEM(ev, 0); + Py_INCREF(value); +#elif CYTHON_ASSUME_SAFE_MACROS + value = PySequence_ITEM(ev, 0); +#else + value = PySequence_GetItem(ev, 0); + if (!value) goto limited_api_failure; +#endif + } else { + Py_INCREF(Py_None); + value = Py_None; + } + Py_DECREF(ev); + } + else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { + value = ev; + } + if (likely(value)) { + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = value; + return 0; + } + } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); +#else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); +#endif + Py_DECREF(ev); +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!value)) return -1; +#endif + *pvalue = value; + return 0; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS + limited_api_failure: + Py_XDECREF(et); + Py_XDECREF(tb); + Py_XDECREF(ev); + return -1; +#endif +} +static CYTHON_INLINE +__Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) { + if (*retval) { + return PYGEN_NEXT; + } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) { + return PYGEN_RETURN; + } else { + return PYGEN_ERROR; + } +} +static CYTHON_INLINE +void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_CLEAR(exc_state->exc_value); +#else + PyObject *t, *v, *tb; + t = exc_state->exc_type; + v = exc_state->exc_value; + tb = exc_state->exc_traceback; + exc_state->exc_type = NULL; + exc_state->exc_value = NULL; + exc_state->exc_traceback = NULL; + Py_XDECREF(t); + Py_XDECREF(v); + Py_XDECREF(tb); +#endif +} +#define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) { + const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { + msg = "coroutine already executing"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { + msg = "async generator already executing"; + #endif + } else { + msg = "generator already executing"; + } + PyErr_SetString(PyExc_ValueError, msg); +} +static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) { + CYTHON_MAYBE_UNUSED_VAR(gen); + CYTHON_MAYBE_UNUSED_VAR(closing); + #ifdef __Pyx_Coroutine_USED + if (!closing && __Pyx_Coroutine_Check(gen)) { + PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); + } else + #endif + if (value) { + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + PyErr_SetNone(PyExc_StopAsyncIteration); + else + #endif + PyErr_SetNone(PyExc_StopIteration); + } +} +static +__Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) { + __Pyx_PyThreadState_declare + PyThreadState *tstate; + __Pyx_ExcInfoStruct *exc_state; + PyObject *retval; + assert(__Pyx_Coroutine_get_is_running(self)); // Callers should ensure is_running + if (unlikely(self->resume_label == -1)) { + __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); + return PYGEN_ERROR; + } +#if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + tstate = __pyx_tstate; +#else + tstate = __Pyx_PyThreadState_Current; +#endif + exc_state = &self->gi_exc_state; + if (exc_state->exc_value) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + #else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #elif PY_VERSION_HEX >= 0x030B00a4 + exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback; + #else + exc_tb = exc_state->exc_traceback; + #endif + if (exc_tb) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + assert(f->f_back == NULL); + #if PY_VERSION_HEX >= 0x030B00A1 + f->f_back = PyThreadState_GetFrame(tstate); + #else + Py_XINCREF(tstate->frame); + f->f_back = tstate->frame; + #endif + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + Py_DECREF(exc_tb); + #endif + } + #endif + } +#if CYTHON_USE_EXC_INFO_STACK + exc_state->previous_item = tstate->exc_info; + tstate->exc_info = exc_state; +#else + if (exc_state->exc_type) { + __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } else { + __Pyx_Coroutine_ExceptionClear(exc_state); + __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } +#endif + retval = self->body(self, tstate, value); +#if CYTHON_USE_EXC_INFO_STACK + exc_state = &self->gi_exc_state; + tstate->exc_info = exc_state->previous_item; + exc_state->previous_item = NULL; + __Pyx_Coroutine_ResetFrameBackpointer(exc_state); +#endif + *result = retval; + if (self->resume_label == -1) { + return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR; + } + return PYGEN_NEXT; +} +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(exc_state); +#else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 + if (!exc_state->exc_value) return; + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #else + exc_tb = exc_state->exc_traceback; + #endif + if (likely(exc_tb)) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + #if PY_VERSION_HEX >= 0x030B00a4 + Py_DECREF(exc_tb); + #endif + } +#endif +} +#define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\ + ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext)) +static PyObject * +__Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) { + CYTHON_MAYBE_UNUSED_VAR(gen); + if (likely(result == PYGEN_RETURN)) { + int is_async = 0; + #ifdef __Pyx_AsyncGen_USED + is_async = __Pyx_AsyncGen_CheckExact(gen); + #endif + __Pyx_ReturnWithStopIteration(retval, is_async, iternext); + Py_XDECREF(retval); + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE +PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { +#if PY_VERSION_HEX <= 0x030A00A1 + return _PyGen_Send(gen, arg); +#else + PyObject *result; + if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { + if (PyAsyncGen_CheckExact(gen)) { + assert(result == Py_None); + PyErr_SetNone(PyExc_StopAsyncIteration); + } + else if (result == Py_None) { + PyErr_SetNone(PyExc_StopIteration); + } + else { +#if PY_VERSION_HEX < 0x030d00A1 + _PyGen_SetStopIterationValue(result); +#else + if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) { + PyErr_SetObject(PyExc_StopIteration, result); + } else { + PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result); + if (likely(exc != NULL)) { + PyErr_SetObject(PyExc_StopIteration, exc); + Py_DECREF(exc); + } + } +#endif + } + Py_DECREF(result); + result = NULL; + } + return result; +#endif +} +#endif +static CYTHON_INLINE __Pyx_PySendResult +__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) { + __Pyx_PySendResult result; + PyObject *val = NULL; + assert(__Pyx_Coroutine_get_is_running(gen)); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); + result = __Pyx_Coroutine_SendEx(gen, val, retval, 0); + Py_XDECREF(val); + return result; +} +#if CYTHON_USE_AM_SEND +static __Pyx_PySendResult +__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) { + PyObject *ret = NULL; + __Pyx_PySendResult delegate_result, result; + assert(__Pyx_Coroutine_get_is_running(gen)); + delegate_result = gen_am_send(gen->yieldfrom, value, &ret); + if (delegate_result == PYGEN_NEXT) { + assert (ret != NULL); + *retval = ret; + return PYGEN_NEXT; + } + assert (delegate_result != PYGEN_ERROR || ret == NULL); + __Pyx_Coroutine_Undelegate(gen); + result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0); + Py_XDECREF(ret); + return result; +} +#endif +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); +} +static __Pyx_PySendResult +__Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) { + __Pyx_PySendResult result; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #if !CYTHON_USE_AM_SEND + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + ret = __Pyx_async_gen_asend_send(yf, value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + if (PyCoro_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + #endif + { + #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000 + if (value == Py_None && PyIter_Check(yf)) + ret = __Pyx_PyIter_Next_Plain(yf); + else + #endif + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value); + } + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + *retval = ret; + return PYGEN_NEXT; + } + result = __Pyx_Coroutine_FinishDelegation(gen, retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, value, retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return result; +} +static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + CYTHON_UNUSED_VAR(gen); + assert(__Pyx_Coroutine_get_is_running(gen)); + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + if (__Pyx_CoroutineAwait_CheckExact(yf)) { + result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + retval = __Pyx_async_gen_asend_close(yf, NULL); + result = PYGEN_RETURN; + } else + if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { + retval = __Pyx_async_gen_athrow_close(yf, NULL); + result = PYGEN_RETURN; + } else + #endif + { + PyObject *meth; + result = PYGEN_RETURN; + meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close); + if (unlikely(!meth)) { + if (unlikely(PyErr_Occurred())) { + PyErr_WriteUnraisable(yf); + } + } else { + retval = __Pyx_PyObject_CallNoArg(meth); + Py_DECREF(meth); + if (unlikely(!retval)) { + result = PYGEN_ERROR; + } + } + } + Py_XDECREF(retval); + return result == PYGEN_ERROR ? -1 : 0; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Next(yf); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, Py_None); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); + } else + #endif + ret = __Pyx_PyIter_Next_Plain(yf); + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1); +} +static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) { + PyObject *retval = NULL; + __Pyx_PySendResult result; + CYTHON_UNUSED_VAR(arg); + result = __Pyx_Coroutine_Close(self, &retval); + if (unlikely(result == PYGEN_ERROR)) + return NULL; + Py_XDECREF(retval); + Py_RETURN_NONE; +} +static __Pyx_PySendResult +__Pyx_Coroutine_Close(PyObject *self, PyObject **retval) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PySendResult result; + PyObject *yf; + int err = 0; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + yf = gen->yieldfrom; + if (yf) { + Py_INCREF(yf); + err = __Pyx_Coroutine_CloseIter(gen, yf); + __Pyx_Coroutine_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) + PyErr_SetNone(PyExc_GeneratorExit); + result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1); + if (result == PYGEN_ERROR) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_Coroutine_unset_is_running(gen); + if (!__Pyx_PyErr_Occurred()) { + return PYGEN_RETURN; + } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) { + __Pyx_PyErr_Clear(); + return PYGEN_RETURN; + } + return PYGEN_ERROR; + } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) { + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_RETURN; + } else { + const char *msg; + Py_DECREF(*retval); + *retval = NULL; + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(self)) { + msg = "coroutine ignored GeneratorExit"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(self)) { + msg = "async generator ignored GeneratorExit"; + #endif + } else { + msg = "generator ignored GeneratorExit"; + } + PyErr_SetString(PyExc_RuntimeError, msg); + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_ERROR; + } +} +static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, + PyObject *args, int close_on_genexit) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *yf; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) + return __Pyx_Coroutine_AlreadyRunningError(gen); + yf = gen->yieldfrom; + if (yf) { + __Pyx_PySendResult result; + PyObject *ret; + Py_INCREF(yf); + if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { + int err = __Pyx_Coroutine_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Coroutine_Undelegate(gen); + if (err < 0) + goto propagate_exception; + goto throw_here; + } + if (0 + #ifdef __Pyx_Generator_USED + || __Pyx_Generator_CheckExact(yf) + #endif + #ifdef __Pyx_Coroutine_USED + || __Pyx_Coroutine_Check(yf) + #endif + ) { + ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { + ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); + #endif + } else { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (unlikely(PyErr_Occurred())) { + __Pyx_Coroutine_unset_is_running(gen); + return NULL; + } + __Pyx_Coroutine_Undelegate(gen); + goto throw_here; + } + if (likely(args)) { + ret = __Pyx_PyObject_Call(meth, args, NULL); + } else { + PyObject *cargs[4] = {NULL, typ, val, tb}; + ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } + Py_DECREF(meth); + } + Py_DECREF(yf); + if (ret) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &ret); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0); + } +throw_here: + __Pyx_Raise(typ, val, tb, NULL); +propagate_exception: + { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); + } +} +static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { + PyObject *typ; + PyObject *val = NULL; + PyObject *tb = NULL; + if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb))) + return NULL; + return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); +} +static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_VISIT(exc_state->exc_value); +#else + Py_VISIT(exc_state->exc_type); + Py_VISIT(exc_state->exc_value); + Py_VISIT(exc_state->exc_traceback); +#endif + return 0; +} +static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { + { + int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg); + if (e) return e; + } + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); +} +static int __Pyx_Coroutine_clear(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); + } +#endif + Py_CLEAR(gen->gi_code); + Py_CLEAR(gen->gi_frame); + Py_CLEAR(gen->gi_name); + Py_CLEAR(gen->gi_qualname); + Py_CLEAR(gen->gi_modulename); + return 0; +} +static void __Pyx_Coroutine_dealloc(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject_GC_UnTrack(gen); + #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + if (gen->gi_weakreflist != NULL) + #endif + PyObject_ClearWeakRefs(self); + if (gen->resume_label >= 0) { + PyObject_GC_Track(self); +#if CYTHON_USE_TP_FINALIZE + if (unlikely(PyObject_CallFinalizerFromDealloc(self))) +#else + { + destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor); + if (del) del(self); + } + if (unlikely(Py_REFCNT(self) > 0)) +#endif + { + return; + } + PyObject_GC_UnTrack(self); + } +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + /* We have to handle this case for asynchronous generators + right here, because this code has to be between UNTRACK + and GC_Del. */ + Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); + } +#endif + __Pyx_Coroutine_clear(self); + __Pyx_PyHeapTypeObject_GC_Del(gen); +} +#if CYTHON_USE_TP_FINALIZE +static void __Pyx_Coroutine_del(PyObject *self) { + PyObject *error_type, *error_value, *error_traceback; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PyThreadState_declare + if (gen->resume_label < 0) { + return; + } + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; + PyObject *finalizer = agen->ag_finalizer; + if (finalizer && !agen->ag_closed) { + PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); + if (unlikely(!res)) { + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); + return; + } + } +#endif + if (unlikely(gen->resume_label == 0 && !error_value)) { +#ifdef __Pyx_Coroutine_USED +#ifdef __Pyx_Generator_USED + if (!__Pyx_Generator_CheckExact(self)) +#endif + { + PyObject_GC_UnTrack(self); + if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) + PyErr_WriteUnraisable(self); + PyObject_GC_Track(self); + } +#endif + } else { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval); + if (result == PYGEN_ERROR) { + PyErr_WriteUnraisable(self); + } else { + Py_XDECREF(retval); + } + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); +} +#endif +static PyObject * +__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_name; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(self->gi_name, value); + return 0; +} +static PyObject * +__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_qualname; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(self->gi_qualname, value); + return 0; +} +static PyObject * +__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self) +{ +#if !CYTHON_COMPILING_IN_LIMITED_API + PyObject *frame; + #if PY_VERSION_HEX >= 0x030d0000 + Py_BEGIN_CRITICAL_SECTION(self); + #endif + frame = self->gi_frame; + if (!frame) { + if (unlikely(!self->gi_code)) { + Py_RETURN_NONE; + } + PyObject *globals = PyDict_New(); + if (unlikely(!globals)) return NULL; + frame = (PyObject *) PyFrame_New( + PyThreadState_Get(), /*PyThreadState *tstate,*/ + (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ + globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + Py_DECREF(globals); + if (unlikely(!frame)) + return NULL; + if (unlikely(self->gi_frame)) { + Py_DECREF(frame); + frame = self->gi_frame; + } else { + self->gi_frame = frame; + } + } + Py_INCREF(frame); + #if PY_VERSION_HEX >= 0x030d0000 + Py_END_CRITICAL_SECTION(); + #endif + return frame; +#else + CYTHON_UNUSED_VAR(self); + Py_RETURN_NONE; +#endif +} +static PyObject * +__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) { + CYTHON_UNUSED_VAR(context); + PyObject *frame = self->gi_frame; + if (frame) + return __Pyx_NewRef(frame); + return __Pyx__Coroutine_get_frame(self); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); + if (unlikely(!gen)) + return NULL; + return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->yieldfrom_am_send = NULL; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API + gen->gi_exc_state.exc_value = NULL; + #else + gen->gi_exc_state.exc_type = NULL; + gen->gi_exc_state.exc_value = NULL; + gen->gi_exc_state.exc_traceback = NULL; + #endif +#if CYTHON_USE_EXC_INFO_STACK + gen->gi_exc_state.previous_item = NULL; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + gen->gi_weakreflist = NULL; +#endif + Py_XINCREF(qualname); + gen->gi_qualname = qualname; + Py_XINCREF(name); + gen->gi_name = name; + Py_XINCREF(module_name); + gen->gi_modulename = module_name; + Py_XINCREF(code); + gen->gi_code = code; + gen->gi_frame = NULL; + PyObject_GC_Track(gen); + return gen; +} +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + gen->is_running = 1; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; +} +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) { + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + assert(gen->is_running); + gen->is_running = 0; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif +} +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; +} +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) { + CYTHON_UNUSED_VAR(closure); + char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen); + if (result) Py_RETURN_TRUE; + else Py_RETURN_FALSE; +} +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) { + Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type; + if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) { + return; + } + memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async)); + static_amsend_methods->am_send = am_send; + type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods); +} +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); + __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self)); + PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object", + self_type_name); + __Pyx_DECREF_TypeName(self_type_name); + return NULL; +} + +/* Generator */ +static PyMethodDef __pyx_Generator_methods[] = { + {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, + PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, + PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, + PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, + {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0}, + {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; +static PyMemberDef __pyx_Generator_memberlist[] = { + {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, + PyDoc_STR("object being iterated by 'yield from', or None")}, + {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, + {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0}, +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyGetSetDef __pyx_Generator_getsets[] = { + {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, + PyDoc_STR("name of the generator"), 0}, + {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, + PyDoc_STR("qualified name of the generator"), 0}, + {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL, + PyDoc_STR("Frame of the generator"), 0}, + {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_GeneratorType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc}, + {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse}, + {Py_tp_iter, (void *)PyObject_SelfIter}, + {Py_tp_iternext, (void *)__Pyx_Generator_Next}, + {Py_tp_methods, (void *)__pyx_Generator_methods}, + {Py_tp_members, (void *)__pyx_Generator_memberlist}, + {Py_tp_getset, (void *)__pyx_Generator_getsets}, + {Py_tp_getattro, (void *) PyObject_GenericGetAttr}, +#if CYTHON_USE_TP_FINALIZE + {Py_tp_finalize, (void *)__Pyx_Coroutine_del}, +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + {Py_am_send, (void *)__Pyx_Coroutine_AmSend}, +#endif + {0, 0}, +}; +static PyType_Spec __pyx_GeneratorType_spec = { + __PYX_TYPE_MODULE_PREFIX "generator", + sizeof(__pyx_CoroutineObject), + 0, +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_WEAKREF | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND, + __pyx_GeneratorType_slots +}; +#if __PYX_HAS_PY_AM_SEND == 2 +static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async; +#endif +static int __pyx_Generator_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL); + if (unlikely(!mstate->__pyx_GeneratorType)) { + return -1; + } +#if __PYX_HAS_PY_AM_SEND == 2 + __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend); +#endif + return 0; +} +static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *retval = NULL; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + (void) result; + assert (result == PYGEN_RETURN || result == PYGEN_ERROR); + assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL)); + return retval; +} + +/* CheckBinaryVersion */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { + const unsigned long MAJOR_MINOR = 0xFFFF0000UL; + if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) + return 0; + if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) + return 1; + { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compile time Python version %d.%d " + "of module '%.100s' " + "%s " + "runtime version %d.%d", + (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), + __Pyx_MODULE_NAME, + (allow_newer) ? "was newer than" : "does not match", + (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) + ); + return PyErr_WarnEx(NULL, message, 1); + } +} + +/* NewCodeObj */ +#if CYTHON_COMPILING_IN_LIMITED_API + static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + PyObject *version_info; + PyObject *py_minor_version = NULL; + #endif + long minor_version = 0; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + minor_version = 11; + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + Py_DECREF(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + if (type) { + PyErr_Restore(type, value, traceback); + } + return result; + } +#elif PY_VERSION_HEX >= 0x030B0000 + static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1 + if (likely(result)) + result->_co_firsttraceable = 0; + #endif + return result; + } +#elif !CYTHON_COMPILING_IN_PYPY + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +) { + PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL; + Py_ssize_t var_count = (Py_ssize_t) descr.nlocals; + PyObject *varnames_tuple = PyTuple_New(var_count); + if (unlikely(!varnames_tuple)) return NULL; + for (Py_ssize_t i=0; i < var_count; i++) { + Py_INCREF(varnames[i]); + if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done; + } + #if CYTHON_COMPILING_IN_LIMITED_API + varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple); + if (!varnames_tuple_dedup) { + if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done; + varnames_tuple_dedup = varnames_tuple; + } + #else + varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple); + if (unlikely(!varnames_tuple_dedup)) goto done; + #endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(varnames_tuple_dedup); + #endif + if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) { + Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(line_table_length == -1)) goto done; + #endif + Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL; + code_bytes = PyBytes_FromStringAndSize(NULL, code_len); + if (unlikely(!code_bytes)) goto done; + char* c_code_bytes = PyBytes_AsString(code_bytes); + if (unlikely(!c_code_bytes)) goto done; + memset(c_code_bytes, 0, (size_t) code_len); + } + code_obj = (PyObject*) __Pyx__PyCode_New( + (int) descr.argcount, + (int) descr.num_posonly_args, + (int) descr.num_kwonly_args, + (int) descr.nlocals, + 0, + (int) descr.flags, + code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + varnames_tuple_dedup, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + filename, + funcname, + (int) descr.first_line, + (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes + ); +done: + Py_XDECREF(code_bytes); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(varnames_tuple_dedup); + #endif + Py_DECREF(varnames_tuple); + return code_obj; +} + +/* DecompressString */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { + PyObject *module, *decompress, *compressed_bytes, *decompressed; + const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; + PyObject *methodname = PyUnicode_FromString("decompress"); + if (unlikely(!methodname)) return NULL; + #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 + if (algo == 3) { + PyObject *fromlist = Py_BuildValue("[O]", methodname); + if (unlikely(!fromlist)) return NULL; + module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + } else + #endif + module = PyImport_ImportModule(module_name); + if (unlikely(!module)) goto import_failed; + decompress = PyObject_GetAttr(module, methodname); + if (unlikely(!decompress)) goto import_failed; + { + #ifdef __cplusplus + char *memview_bytes = const_cast(s); + #else + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wcast-qual" + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-qual" + #endif + char *memview_bytes = (char*) s; + #if defined(__clang__) + #pragma clang diagnostic pop + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + #endif + #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) + int memview_flags = 0x100; + #else + int memview_flags = PyBUF_READ; + #endif + compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); + } + if (unlikely(!compressed_bytes)) { + Py_DECREF(decompress); + goto bad; + } + decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); + Py_DECREF(compressed_bytes); + Py_DECREF(decompress); + Py_DECREF(module); + Py_DECREF(methodname); + return decompressed; +import_failed: + PyErr_Format(PyExc_ImportError, + "Failed to import '%.20s.decompress' - cannot initialise module strings. " + "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", + module_name, algo); +bad: + Py_XDECREF(module); + Py_DECREF(methodname); + return NULL; +} + +#include +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return __Pyx_PyUnicode_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return PyByteArray_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + { + const char* result; + Py_ssize_t unicode_length; + CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; + #else + result = PyUnicode_AsUTF8AndSize(o, length); + #endif + #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + unicode_length = PyUnicode_GetLength(o); + if (unlikely(unicode_length < 0)) return NULL; + if (unlikely(unicode_length != *length)) { + PyUnicode_AsASCIIString(o); + return NULL; + } + #endif + return result; + } +#else +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +#endif +} +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + if (PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif + if (PyByteArray_Check(o)) { +#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); +#else + *length = PyByteArray_Size(o); + if (*length == -1) return NULL; + return PyByteArray_AsString(o); +#endif + } else + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; + } + __Pyx_DECREF_TypeName(result_type_name); + return result; + } + PyErr_Format(PyExc_TypeError, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", + result_type_name); + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + PyObject *res = NULL; + if (likely(PyLong_Check(x))) + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + if (likely(m && m->nb_int)) { + res = m->nb_int(x); + } +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Long(x); + } +#endif + if (likely(res)) { + if (unlikely(!PyLong_CheckExact(res))) { + return __Pyx_PyNumber_LongWrongResultType(res); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); + } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyLong_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyLong_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { + CYTHON_UNUSED_VAR(b); + return __Pyx_NewRef(Py_None); +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return __Pyx_NewRef(b ? Py_True: Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { + return PyLong_FromSize_t(ival); +} + + +/* MultiPhaseInitModuleState */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 +#else + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 +#endif +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS +#error "Module state with PEP489 requires atomics. Currently that's one of\ + C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" +#endif +#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#define __Pyx_ModuleStateLookup_Lock() +#define __Pyx_ModuleStateLookup_Unlock() +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 +static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; +#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(__cplusplus) && __cplusplus >= 201103L +#include +static std::mutex __Pyx_ModuleStateLookup_mutex; +#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() +#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) +#include +static mtx_t __Pyx_ModuleStateLookup_mutex; +static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; +static void __Pyx_ModuleStateLookup_initialize_mutex(void) { + mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); +} +#define __Pyx_ModuleStateLookup_Lock()\ + call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ + mtx_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(HAVE_PTHREAD_H) +#include +static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; +#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(_WIN32) +#include // synchapi.h on its own doesn't work +static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; +#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#else +#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ + Requires C standard >= C11, or C++ standard >= C++11,\ + or pthreads, or the Windows 32 API, or Python >= 3.13." +#endif +typedef struct { + int64_t id; + PyObject *module; +} __Pyx_InterpreterIdAndModule; +typedef struct { + char interpreter_id_as_index; + Py_ssize_t count; + Py_ssize_t allocated; + __Pyx_InterpreterIdAndModule table[1]; +} __Pyx_ModuleStateLookupData; +#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; +#else +static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; +#endif +static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( + __Pyx_InterpreterIdAndModule* table, + Py_ssize_t count, + int64_t interpreterId) { + __Pyx_InterpreterIdAndModule* begin = table; + __Pyx_InterpreterIdAndModule* end = begin + count; + if (begin->id == interpreterId) { + return begin; + } + while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; + if (halfway->id == interpreterId) { + return halfway; + } + if (halfway->id < interpreterId) { + begin = halfway; + } else { + end = halfway; + } + } + for (; begin < end; ++begin) { + if (begin->id >= interpreterId) return begin; + } + return begin; +} +static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return NULL; +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + { + __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + if (likely(data)) { + __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); + if (likely(data == new_data)) { + goto read_finished; + } + } + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + __Pyx_ModuleStateLookup_Lock(); + __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); + data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + __Pyx_ModuleStateLookup_Unlock(); + } + read_finished:; +#else + __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_InterpreterIdAndModule* found = NULL; + if (unlikely(!data)) goto end; + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + found = data->table+interpreter_id; + } + } else { + found = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + } + end: + { + PyObject *result=NULL; + if (found && found->id == interpreter_id) { + result = found->module; + } +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); +#endif + return result; + } +} +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { + while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); +} +#else +#define __Pyx_ModuleStateLookup_wait_until_no_readers() +#endif +static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { + Py_ssize_t to_allocate = (*old_data)->allocated; + while (to_allocate <= interpreter_id) { + if (to_allocate == 0) to_allocate = 1; + else to_allocate *= 2; + } + __Pyx_ModuleStateLookupData *new_data = *old_data; + if (to_allocate != (*old_data)->allocated) { + new_data = (__Pyx_ModuleStateLookupData *)realloc( + *old_data, + sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + PyErr_NoMemory(); + return -1; + } + for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { + new_data->table[i].id = i; + new_data->table[i].module = NULL; + } + new_data->allocated = to_allocate; + } + new_data->table[interpreter_id].module = module; + if (new_data->count < interpreter_id+1) { + new_data->count = interpreter_id+1; + } + *old_data = new_data; + return 0; +} +static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { + __Pyx_InterpreterIdAndModule *read = data->table; + __Pyx_InterpreterIdAndModule *write = data->table; + __Pyx_InterpreterIdAndModule *end = read + data->count; + for (; readmodule) { + write->id = read->id; + write->module = read->module; + ++write; + } + } + data->count = write - data->table; + for (; writeid = 0; + write->module = NULL; + } + data->interpreter_id_as_index = 0; +} +static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + int result = 0; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_ModuleStateLookupData *new_data = old_data; + if (!new_data) { + new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); + if (!new_data) { + result = -1; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = 1; + new_data->interpreter_id_as_index = 1; + } + __Pyx_ModuleStateLookup_wait_until_no_readers(); + if (new_data->interpreter_id_as_index) { + if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); + goto end; + } + __Pyx_State_ConvertFromInterpIdAsIndex(new_data); + } + { + Py_ssize_t insert_at = 0; + { + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + new_data->table, new_data->count, interpreter_id); + assert(lower_bound); + insert_at = lower_bound - new_data->table; + if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { + lower_bound->module = module; + goto end; // already in table, nothing more to do + } + } + if (new_data->count+1 >= new_data->allocated) { + Py_ssize_t to_allocate = (new_data->count+1)*2; + new_data = + (__Pyx_ModuleStateLookupData*)realloc( + new_data, + sizeof(__Pyx_ModuleStateLookupData) + + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + result = -1; + new_data = old_data; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = to_allocate; + } + ++new_data->count; + int64_t last_id = interpreter_id; + PyObject *last_module = module; + for (Py_ssize_t i=insert_at; icount; ++i) { + int64_t current_id = new_data->table[i].id; + new_data->table[i].id = last_id; + last_id = current_id; + PyObject *current_module = new_data->table[i].module; + new_data->table[i].module = last_module; + last_module = current_module; + } + } + end: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); +#else + __Pyx_ModuleStateLookup_data = new_data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return result; +} +static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; +#endif + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + data->table[interpreter_id].module = NULL; + } + goto done; + } + { + __Pyx_ModuleStateLookup_wait_until_no_readers(); + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + if (!lower_bound) goto done; + if (lower_bound->id != interpreter_id) goto done; + __Pyx_InterpreterIdAndModule *end = data->table+data->count; + for (;lower_boundid = (lower_bound+1)->id; + lower_bound->module = (lower_bound+1)->module; + } + } + --data->count; + if (data->count == 0) { + free(data); + data = NULL; + } + done: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); +#else + __Pyx_ModuleStateLookup_data = data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return 0; +} +#endif + +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ +#endif /* Py_PYTHON_H */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokenizer.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokenizer.pxd new file mode 100644 index 0000000000000000000000000000000000000000..e6ce8e523fdc1a175667a6c9173cc36fec00304f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokenizer.pxd @@ -0,0 +1,86 @@ +from cymem.cymem cimport Pool +from libcpp.vector cimport vector +from preshed.maps cimport PreshMap + +from .matcher.phrasematcher cimport PhraseMatcher +from .strings cimport StringStore +from .structs cimport LexemeC, SpanC, TokenC +from .tokens.doc cimport Doc +from .typedefs cimport hash_t +from .vocab cimport LexemesOrTokens, Vocab, _Cached + + +cdef class Tokenizer: + cdef Pool mem + cdef PreshMap _cache + cdef PreshMap _specials + cdef readonly Vocab vocab + + cdef object _token_match + cdef object _url_match + cdef object _prefix_search + cdef object _suffix_search + cdef object _infix_finditer + cdef object _rules + cdef PhraseMatcher _special_matcher + # TODO convert to bool in v4 + cdef int _faster_heuristics + cdef public int max_cache_size + + cdef Doc _tokenize_affixes(self, str string, bint with_special_cases) + cdef int _apply_special_cases(self, Doc doc) except -1 + cdef void _filter_special_spans( + self, + vector[SpanC] &original, + vector[SpanC] &filtered, + int doc_len, + ) nogil + cdef object _prepare_special_spans( + self, + Doc doc, + vector[SpanC] &filtered, + ) + cdef int _retokenize_special_spans( + self, + Doc doc, + TokenC* tokens, + object span_data, + ) + cdef int _try_specials_and_cache( + self, + hash_t key, + Doc tokens, + int* has_special, + bint with_special_cases, + ) except -1 + cdef int _tokenize( + self, + Doc tokens, + str span, + hash_t key, + int* has_special, + bint with_special_cases, + ) except -1 + cdef str _split_affixes( + self, + Pool mem, + str string, + vector[LexemeC*] *prefixes, + vector[LexemeC*] *suffixes, int* has_special, + bint with_special_cases, + ) + cdef int _attach_tokens( + self, + Doc tokens, + str string, + vector[LexemeC*] *prefixes, + vector[LexemeC*] *suffixes, int* has_special, + bint with_special_cases, + ) except -1 + cdef int _save_cached( + self, + const TokenC* tokens, + hash_t key, + int* has_special, + int n, + ) except -1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokenizer.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokenizer.pyx new file mode 100644 index 0000000000000000000000000000000000000000..62fbd0b41d33726a024ad9c6dda5a5e554801dd9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/tokenizer.pyx @@ -0,0 +1,877 @@ +# cython: embedsignature=True, binding=True +cimport cython +from cymem.cymem cimport Pool +from cython.operator cimport dereference as deref +from cython.operator cimport preincrement as preinc +from libc.string cimport memcpy, memset +from libcpp.set cimport set as stdset +from preshed.maps cimport PreshMap + +import re +from .lexeme cimport EMPTY_LEXEME +from .strings cimport hash_string +from .tokens.doc cimport Doc + +from . import util +from .attrs import intify_attrs +from .errors import Errors +from .scorer import Scorer +from .symbols import NORM, ORTH +from .tokens import Span +from .training import validate_examples +from .util import get_words_and_spaces + + +cdef class Tokenizer: + """Segment text, and create Doc objects with the discovered segment + boundaries. + + DOCS: https://spacy.io/api/tokenizer + """ + def __init__(self, Vocab vocab, rules=None, prefix_search=None, + suffix_search=None, infix_finditer=None, token_match=None, + url_match=None, faster_heuristics=True, max_cache_size=10000): + """Create a `Tokenizer`, to create `Doc` objects given unicode text. + + vocab (Vocab): A storage container for lexical types. + rules (dict): Exceptions and special-cases for the tokenizer. + prefix_search (callable): A function matching the signature of + `re.compile(string).search` to match prefixes. + suffix_search (callable): A function matching the signature of + `re.compile(string).search` to match suffixes. + infix_finditer (callable): A function matching the signature of + `re.compile(string).finditer` to find infixes. + token_match (callable): A function matching the signature of + `re.compile(string).match`, for matching strings to be + recognized as tokens. + url_match (callable): A function matching the signature of + `re.compile(string).match`, for matching strings to be + recognized as urls. + faster_heuristics (bool): Whether to restrict the final + Matcher-based pass for rules to those containing affixes or space. + Defaults to True. + max_cache_size (int): Maximum number of tokenization chunks to cache. + + EXAMPLE: + >>> tokenizer = Tokenizer(nlp.vocab) + + DOCS: https://spacy.io/api/tokenizer#init + """ + self.mem = Pool() + self._cache = PreshMap() + self._specials = PreshMap() + self.token_match = token_match + self.url_match = url_match + self.prefix_search = prefix_search + self.suffix_search = suffix_search + self.infix_finditer = infix_finditer + self.vocab = vocab + self.faster_heuristics = faster_heuristics + self._rules = {} + self._special_matcher = PhraseMatcher(self.vocab) + self._load_special_cases(rules) + self.max_cache_size = max_cache_size + + @property + def token_match(self): + return self._token_match + + @token_match.setter + def token_match(self, token_match): + self._token_match = token_match + self._reload_special_cases() + + @property + def url_match(self): + return self._url_match + + @url_match.setter + def url_match(self, url_match): + self._url_match = url_match + self._reload_special_cases() + + @property + def prefix_search(self): + return self._prefix_search + + @prefix_search.setter + def prefix_search(self, prefix_search): + self._prefix_search = prefix_search + self._reload_special_cases() + + @property + def suffix_search(self): + return self._suffix_search + + @suffix_search.setter + def suffix_search(self, suffix_search): + self._suffix_search = suffix_search + self._reload_special_cases() + + @property + def infix_finditer(self): + return self._infix_finditer + + @infix_finditer.setter + def infix_finditer(self, infix_finditer): + self._infix_finditer = infix_finditer + self._reload_special_cases() + + @property + def rules(self): + return self._rules + + @rules.setter + def rules(self, rules): + self._rules = {} + self._flush_cache() + self._flush_specials() + self._cache = PreshMap() + self._specials = PreshMap() + self._load_special_cases(rules) + + @property + def faster_heuristics(self): + return bool(self._faster_heuristics) + + @faster_heuristics.setter + def faster_heuristics(self, faster_heuristics): + self._faster_heuristics = bool(faster_heuristics) + self._reload_special_cases() + + def __reduce__(self): + args = (self.vocab, + self.rules, + self.prefix_search, + self.suffix_search, + self.infix_finditer, + self.token_match, + self.url_match) + return (self.__class__, args, None, None) + + def __call__(self, str string): + """Tokenize a string. + + string (str): The string to tokenize. + RETURNS (Doc): A container for linguistic annotations. + + DOCS: https://spacy.io/api/tokenizer#call + """ + doc = self._tokenize_affixes(string, True) + self._apply_special_cases(doc) + return doc + + @cython.boundscheck(False) + cdef Doc _tokenize_affixes(self, str string, bint with_special_cases): + """Tokenize according to affix and token_match settings. + + string (str): The string to tokenize. + RETURNS (Doc): A container for linguistic annotations. + """ + if len(string) >= (2 ** 30): + raise ValueError(Errors.E025.format(length=len(string))) + cdef int length = len(string) + cdef Doc doc = Doc(self.vocab) + if length == 0: + return doc + cdef int i = 0 + cdef int start = 0 + cdef int has_special = 0 + cdef bint in_ws = string[0].isspace() + cdef str span + # The task here is much like string.split, but not quite + # We find spans of whitespace and non-space characters, and ignore + # spans that are exactly ' '. So, our sequences will all be separated + # by either ' ' or nothing. + for uc in string: + if uc.isspace() != in_ws: + if start < i: + # When we want to make this fast, get the data buffer once + # with PyUnicode_AS_DATA, and then maintain a start_byte + # and end_byte, so we can call hash64 directly. That way + # we don't have to create the slice when we hit the cache. + span = string[start:i] + key = hash_string(span) + if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): + self._tokenize(doc, span, key, &has_special, with_special_cases) + if uc == ' ': + doc.c[doc.length - 1].spacy = True + start = i + 1 + else: + start = i + in_ws = not in_ws + i += 1 + if start < i: + span = string[start:] + key = hash_string(span) + if not self._try_specials_and_cache(key, doc, &has_special, with_special_cases): + self._tokenize(doc, span, key, &has_special, with_special_cases) + doc.c[doc.length - 1].spacy = string[-1] == " " and not in_ws + return doc + + def pipe(self, texts, batch_size=1000): + """Tokenize a stream of texts. + + texts: A sequence of unicode texts. + batch_size (int): Number of texts to accumulate in an internal buffer. + Defaults to 1000. + YIELDS (Doc): A sequence of Doc objects, in order. + + DOCS: https://spacy.io/api/tokenizer#pipe + """ + for text in texts: + yield self(text) + + def _flush_cache(self): + self._reset_cache([key for key in self._cache]) + + def _reset_cache(self, keys): + for k in keys: + cached = <_Cached*>self._cache.get(k) + del self._cache[k] + if cached is not NULL: + self.mem.free(cached) + + def _flush_specials(self): + self._special_matcher = PhraseMatcher(self.vocab) + for k in self._specials: + cached = <_Cached*>self._specials.get(k) + del self._specials[k] + if cached is not NULL: + self.mem.free(cached) + + cdef int _apply_special_cases(self, Doc doc) except -1: + """Retokenize doc according to special cases. + + doc (Doc): Document. + """ + cdef int i + cdef int max_length = 0 + cdef bint modify_in_place + cdef Pool mem = Pool() + cdef vector[SpanC] c_matches + cdef vector[SpanC] c_filtered + cdef int offset + cdef int modified_doc_length + # Find matches for special cases + self._special_matcher.find_matches(doc, 0, doc.length, &c_matches) + # Skip processing if no matches + if c_matches.size() == 0: + return True + self._filter_special_spans(c_matches, c_filtered, doc.length) + # Put span info in span.start-indexed dict and calculate maximum + # intermediate document size + (span_data, max_length, modify_in_place) = self._prepare_special_spans(doc, c_filtered) + # If modifications never increase doc length, can modify in place + if modify_in_place: + tokens = doc.c + # Otherwise create a separate array to store modified tokens + else: + assert max_length > 0 + tokens = mem.alloc(max_length, sizeof(TokenC)) + # Modify tokenization according to filtered special cases + offset = self._retokenize_special_spans(doc, tokens, span_data) + # Allocate more memory for doc if needed + modified_doc_length = doc.length + offset + while modified_doc_length >= doc.max_length: + doc._realloc(doc.max_length * 2) + # If not modified in place, copy tokens back to doc + if not modify_in_place: + memcpy(doc.c, tokens, max_length * sizeof(TokenC)) + for i in range(doc.length + offset, doc.length): + memset(&doc.c[i], 0, sizeof(TokenC)) + doc.c[i].lex = &EMPTY_LEXEME + doc.length = doc.length + offset + return True + + cdef void _filter_special_spans(self, vector[SpanC] &original, vector[SpanC] &filtered, int doc_len) nogil: + + cdef int seen_i + cdef SpanC span + cdef stdset[int] seen_tokens + stdsort(original.begin(), original.end(), len_start_cmp) + cdef int orig_i = original.size() - 1 + while orig_i >= 0: + span = original[orig_i] + if not seen_tokens.count(span.start) and not seen_tokens.count(span.end - 1): + filtered.push_back(span) + for seen_i in range(span.start, span.end): + seen_tokens.insert(seen_i) + orig_i -= 1 + stdsort(filtered.begin(), filtered.end(), start_cmp) + + cdef object _prepare_special_spans(self, Doc doc, vector[SpanC] &filtered): + spans = [doc[match.start:match.end] for match in filtered] + cdef bint modify_in_place = True + cdef int curr_length = doc.length + cdef int max_length = 0 + cdef int span_length_diff = 0 + span_data = {} + for span in spans: + rule = self._rules.get(span.text, None) + span_length_diff = 0 + if rule: + span_length_diff = len(rule) - (span.end - span.start) + if span_length_diff > 0: + modify_in_place = False + curr_length += span_length_diff + if curr_length > max_length: + max_length = curr_length + span_data[span.start] = (span.text, span.start, span.end, span_length_diff) + return (span_data, max_length, modify_in_place) + + cdef int _retokenize_special_spans(self, Doc doc, TokenC* tokens, object span_data): + cdef int i = 0 + cdef int j = 0 + cdef int offset = 0 + cdef _Cached* cached + cdef int idx_offset = 0 + cdef int orig_final_spacy + cdef int orig_idx + cdef int span_start + cdef int span_end + while i < doc.length: + if i not in span_data: + tokens[i + offset] = doc.c[i] + i += 1 + else: + span = span_data[i] + span_start = span[1] + span_end = span[2] + cached = <_Cached*>self._specials.get(hash_string(span[0])) + if cached == NULL: + # Copy original tokens if no rule found + for j in range(span_end - span_start): + tokens[i + offset + j] = doc.c[i + j] + i += span_end - span_start + else: + # Copy special case tokens into doc and adjust token and + # character offsets + idx_offset = 0 + orig_final_spacy = doc.c[span_end - 1].spacy + orig_idx = doc.c[i].idx + for j in range(cached.length): + tokens[i + offset + j] = cached.data.tokens[j] + tokens[i + offset + j].idx = orig_idx + idx_offset + idx_offset += cached.data.tokens[j].lex.length + if cached.data.tokens[j].spacy: + idx_offset += 1 + tokens[i + offset + cached.length - 1].spacy = orig_final_spacy + i += span_end - span_start + offset += span[3] + return offset + + cdef int _try_specials_and_cache(self, hash_t key, Doc tokens, int* has_special, bint with_special_cases) except -1: + cdef bint specials_hit = 0 + cdef bint cache_hit = 0 + cdef int i + if with_special_cases: + cached = <_Cached*>self._specials.get(key) + if cached == NULL: + specials_hit = False + else: + for i in range(cached.length): + tokens.push_back(&cached.data.tokens[i], False) + has_special[0] = 1 + specials_hit = True + if not specials_hit: + cached = <_Cached*>self._cache.get(key) + if cached == NULL: + cache_hit = False + else: + if cached.is_lex: + for i in range(cached.length): + tokens.push_back(cached.data.lexemes[i], False) + else: + for i in range(cached.length): + tokens.push_back(&cached.data.tokens[i], False) + cache_hit = True + if not specials_hit and not cache_hit: + return False + return True + + cdef int _tokenize(self, Doc tokens, str span, hash_t orig_key, int* has_special, bint with_special_cases) except -1: + cdef vector[LexemeC*] prefixes + cdef vector[LexemeC*] suffixes + cdef int orig_size + orig_size = tokens.length + span = self._split_affixes(tokens.mem, span, &prefixes, &suffixes, + has_special, with_special_cases) + self._attach_tokens(tokens, span, &prefixes, &suffixes, has_special, + with_special_cases) + if len(self._cache) < self.max_cache_size: + self._save_cached(&tokens.c[orig_size], orig_key, has_special, + tokens.length - orig_size) + + cdef str _split_affixes( + self, + Pool mem, + str string, + vector[const LexemeC*] *prefixes, + vector[const LexemeC*] *suffixes, + int* has_special, + bint with_special_cases + ): + cdef str prefix + cdef str suffix + cdef str minus_pre + cdef str minus_suf + cdef size_t last_size = 0 + while string and len(string) != last_size: + if self.token_match and self.token_match(string): + break + if with_special_cases and self._specials.get(hash_string(string)) != NULL: + break + last_size = len(string) + pre_len = self.find_prefix(string) + if pre_len != 0: + prefix = string[:pre_len] + minus_pre = string[pre_len:] + if minus_pre and with_special_cases and self._specials.get(hash_string(minus_pre)) != NULL: + string = minus_pre + prefixes.push_back(self.vocab.get(mem, prefix)) + break + suf_len = self.find_suffix(string[pre_len:]) + if suf_len != 0: + suffix = string[-suf_len:] + minus_suf = string[:-suf_len] + if minus_suf and with_special_cases and self._specials.get(hash_string(minus_suf)) != NULL: + string = minus_suf + suffixes.push_back(self.vocab.get(mem, suffix)) + break + if pre_len and suf_len and (pre_len + suf_len) <= len(string): + string = string[pre_len:-suf_len] + prefixes.push_back(self.vocab.get(mem, prefix)) + suffixes.push_back(self.vocab.get(mem, suffix)) + elif pre_len: + string = minus_pre + prefixes.push_back(self.vocab.get(mem, prefix)) + elif suf_len: + string = minus_suf + suffixes.push_back(self.vocab.get(mem, suffix)) + return string + + cdef int _attach_tokens(self, Doc tokens, str string, + vector[const LexemeC*] *prefixes, + vector[const LexemeC*] *suffixes, + int* has_special, + bint with_special_cases) except -1: + cdef const LexemeC* lexeme + cdef str span + cdef int i + if prefixes.size(): + for i in range(prefixes.size()): + tokens.push_back(prefixes[0][i], False) + if string: + if self._try_specials_and_cache(hash_string(string), tokens, has_special, with_special_cases): + pass + elif ( + (self.token_match and self.token_match(string)) or + (self.url_match and self.url_match(string)) + ): + + # We're always saying 'no' to spaces here -- the caller will + # fix up the outermost one, with reference to the original. + # See Issue #859 + tokens.push_back(self.vocab.get(tokens.mem, string), False) + else: + matches = self.find_infix(string) + if not matches: + tokens.push_back(self.vocab.get(tokens.mem, string), False) + else: + # Let's say we have dyn-o-mite-dave - the regex finds the + # start and end positions of the hyphens + start = 0 + start_before_infixes = start + for match in matches: + infix_start = match.start() + infix_end = match.end() + + if infix_start == start_before_infixes: + continue + + if infix_start != start: + span = string[start:infix_start] + tokens.push_back(self.vocab.get(tokens.mem, span), False) + + if infix_start != infix_end: + # If infix_start != infix_end, it means the infix + # token is non-empty. Empty infix tokens are useful + # for tokenization in some languages (see + # https://github.com/explosion/spaCy/issues/768) + infix_span = string[infix_start:infix_end] + tokens.push_back(self.vocab.get(tokens.mem, infix_span), False) + start = infix_end + span = string[start:] + if span: + tokens.push_back(self.vocab.get(tokens.mem, span), False) + cdef vector[const LexemeC*].reverse_iterator it = suffixes.rbegin() + while it != suffixes.rend(): + lexeme = deref(it) + preinc(it) + tokens.push_back(lexeme, False) + + cdef int _save_cached(self, const TokenC* tokens, hash_t key, + int* has_special, int n) except -1: + cdef int i + if n <= 0: + # avoid mem alloc of zero length + return 0 + if self.vocab.in_memory_zone: + return 0 + # See #1250 + if has_special[0]: + return 0 + cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) + cached.length = n + cached.is_lex = True + lexemes = self.mem.alloc(n, sizeof(LexemeC**)) + for i in range(n): + lexemes[i] = tokens[i].lex + cached.data.lexemes = lexemes + self._cache.set(key, cached) + + def find_infix(self, str string): + """Find internal split points of the string, such as hyphens. + + string (str): The string to segment. + RETURNS (list): A list of `re.MatchObject` objects that have `.start()` + and `.end()` methods, denoting the placement of internal segment + separators, e.g. hyphens. + + DOCS: https://spacy.io/api/tokenizer#find_infix + """ + if self.infix_finditer is None: + return 0 + return list(self.infix_finditer(string)) + + def find_prefix(self, str string): + """Find the length of a prefix that should be segmented from the + string, or None if no prefix rules match. + + string (str): The string to segment. + RETURNS (int): The length of the prefix if present, otherwise `None`. + + DOCS: https://spacy.io/api/tokenizer#find_prefix + """ + if self.prefix_search is None: + return 0 + match = self.prefix_search(string) + return (match.end() - match.start()) if match is not None else 0 + + def find_suffix(self, str string): + """Find the length of a suffix that should be segmented from the + string, or None if no suffix rules match. + + string (str): The string to segment. + Returns (int): The length of the suffix if present, otherwise `None`. + + DOCS: https://spacy.io/api/tokenizer#find_suffix + """ + if self.suffix_search is None: + return 0 + match = self.suffix_search(string) + return (match.end() - match.start()) if match is not None else 0 + + def _load_special_cases(self, special_cases): + """Add special-case tokenization rules.""" + if special_cases is not None: + for chunk, substrings in sorted(special_cases.items()): + self.add_special_case(chunk, substrings) + + def _validate_special_case(self, chunk, substrings): + """Check whether the `ORTH` fields match the string. Check that + additional features beyond `ORTH` and `NORM` are not set by the + exception. + + chunk (str): The string to specially tokenize. + substrings (iterable): A sequence of dicts, where each dict describes + a token and its attributes. + """ + attrs = [intify_attrs(spec, _do_deprecated=True) for spec in substrings] + orth = "".join([spec[ORTH] for spec in attrs]) + if chunk != orth: + raise ValueError(Errors.E997.format(chunk=chunk, orth=orth, token_attrs=substrings)) + for substring in attrs: + for attr in substring: + if attr not in (ORTH, NORM): + raise ValueError(Errors.E1005.format(attr=self.vocab.strings[attr], chunk=chunk)) + + def add_special_case(self, str string, substrings): + """Add a special-case tokenization rule. + + string (str): The string to specially tokenize. + substrings (iterable): A sequence of dicts, where each dict describes + a token and its attributes. The `ORTH` fields of the attributes + must exactly match the string when they are concatenated. + + DOCS: https://spacy.io/api/tokenizer#add_special_case + """ + self._validate_special_case(string, substrings) + substrings = list(substrings) + cached = <_Cached*>self.mem.alloc(1, sizeof(_Cached)) + cached.length = len(substrings) + cached.is_lex = False + cached.data.tokens = self.vocab.make_fused_token(substrings) + key = hash_string(string) + stale_special = <_Cached*>self._specials.get(key) + self._specials.set(key, cached) + if stale_special is not NULL: + self.mem.free(stale_special) + self._rules[string] = substrings + self._flush_cache() + if not self.faster_heuristics or self.find_prefix(string) or self.find_infix(string) or self.find_suffix(string) or " " in string: + self._special_matcher.add(string, None, self._tokenize_affixes(string, False)) + + def _reload_special_cases(self): + self._flush_cache() + self._flush_specials() + self._load_special_cases(self._rules) + + def explain(self, text): + """A debugging tokenizer that provides information about which + tokenizer rule or pattern was matched for each token. The tokens + produced are identical to `nlp.tokenizer()` except for whitespace + tokens. + + string (str): The string to tokenize. + RETURNS (list): A list of (pattern_string, token_string) tuples + + DOCS: https://spacy.io/api/tokenizer#explain + """ + prefix_search = self.prefix_search + if prefix_search is None: + prefix_search = re.compile("a^").search + suffix_search = self.suffix_search + if suffix_search is None: + suffix_search = re.compile("a^").search + infix_finditer = self.infix_finditer + if infix_finditer is None: + infix_finditer = re.compile("a^").finditer + token_match = self.token_match + if token_match is None: + token_match = re.compile("a^").match + url_match = self.url_match + if url_match is None: + url_match = re.compile("a^").match + special_cases = {} + for orth, special_tokens in self.rules.items(): + special_cases[orth] = [intify_attrs(special_token, strings_map=self.vocab.strings, _do_deprecated=True) for special_token in special_tokens] + tokens = [] + for substring in text.split(): + suffixes = [] + while substring: + if substring in special_cases: + tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + substring = '' + continue + while prefix_search(substring) or suffix_search(substring): + if token_match(substring): + tokens.append(("TOKEN_MATCH", substring)) + substring = '' + break + if substring in special_cases: + tokens.extend(("SPECIAL-" + str(i + 1), self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + substring = '' + break + if prefix_search(substring): + split = prefix_search(substring).end() + # break if pattern matches the empty string + if split == 0: + break + tokens.append(("PREFIX", substring[:split])) + substring = substring[split:] + if substring in special_cases: + continue + if suffix_search(substring): + split = suffix_search(substring).start() + # break if pattern matches the empty string + if split == len(substring): + break + suffixes.append(("SUFFIX", substring[split:])) + substring = substring[:split] + if len(substring) == 0: + continue + if token_match(substring): + tokens.append(("TOKEN_MATCH", substring)) + substring = '' + elif url_match(substring): + tokens.append(("URL_MATCH", substring)) + substring = '' + elif substring in special_cases: + tokens.extend((f"SPECIAL-{i + 1}", self.vocab.strings[e[ORTH]]) for i, e in enumerate(special_cases[substring])) + substring = '' + elif list(infix_finditer(substring)): + infixes = infix_finditer(substring) + offset = 0 + for match in infixes: + if offset == 0 and match.start() == 0: + continue + if substring[offset : match.start()]: + tokens.append(("TOKEN", substring[offset : match.start()])) + if substring[match.start() : match.end()]: + tokens.append(("INFIX", substring[match.start() : match.end()])) + offset = match.end() + if substring[offset:]: + tokens.append(("TOKEN", substring[offset:])) + substring = '' + elif substring: + tokens.append(("TOKEN", substring)) + substring = '' + tokens.extend(reversed(suffixes)) + # Find matches for special cases handled by special matcher + words, spaces = get_words_and_spaces([t[1] for t in tokens], text) + t_words = [] + t_spaces = [] + for word, space in zip(words, spaces): + if not word.isspace(): + t_words.append(word) + t_spaces.append(space) + doc = Doc(self.vocab, words=t_words, spaces=t_spaces) + matches = self._special_matcher(doc) + spans = [Span(doc, s, e, label=m_id) for m_id, s, e in matches] + spans = util.filter_spans(spans) + # Replace matched tokens with their exceptions + i = 0 + final_tokens = [] + spans_by_start = {s.start: s for s in spans} + while i < len(tokens): + if i in spans_by_start: + span = spans_by_start[i] + exc = [d[ORTH] for d in special_cases[span.label_]] + # The phrase matcher can overmatch for tokens separated by + # spaces in the text but not in the underlying rule, so skip + # cases where the texts aren't identical + if span.text != "".join([self.vocab.strings[orth] for orth in exc]): + final_tokens.append(tokens[i]) + i += 1 + else: + for j, orth in enumerate(exc): + final_tokens.append((f"SPECIAL-{j + 1}", self.vocab.strings[orth])) + i += len(span) + else: + final_tokens.append(tokens[i]) + i += 1 + return final_tokens + + def score(self, examples, **kwargs): + validate_examples(examples, "Tokenizer.score") + return Scorer.score_tokenization(examples) + + def to_disk(self, path, **kwargs): + """Save the current state to a directory. + + path (str / Path): A path to a directory, which will be created if + it doesn't exist. + exclude (list): String names of serialization fields to exclude. + + DOCS: https://spacy.io/api/tokenizer#to_disk + """ + path = util.ensure_path(path) + with path.open("wb") as file_: + file_.write(self.to_bytes(**kwargs)) + + def from_disk(self, path, *, exclude=tuple()): + """Loads state from a directory. Modifies the object in place and + returns it. + + path (str / Path): A path to a directory. + exclude (list): String names of serialization fields to exclude. + RETURNS (Tokenizer): The modified `Tokenizer` object. + + DOCS: https://spacy.io/api/tokenizer#from_disk + """ + path = util.ensure_path(path) + with path.open("rb") as file_: + bytes_data = file_.read() + self.from_bytes(bytes_data, exclude=exclude) + return self + + def to_bytes(self, *, exclude=tuple()): + """Serialize the current state to a binary string. + + exclude (list): String names of serialization fields to exclude. + RETURNS (bytes): The serialized form of the `Tokenizer` object. + + DOCS: https://spacy.io/api/tokenizer#to_bytes + """ + serializers = { + "vocab": lambda: self.vocab.to_bytes(exclude=exclude), + "prefix_search": lambda: _get_regex_pattern(self.prefix_search), + "suffix_search": lambda: _get_regex_pattern(self.suffix_search), + "infix_finditer": lambda: _get_regex_pattern(self.infix_finditer), + "token_match": lambda: _get_regex_pattern(self.token_match), + "url_match": lambda: _get_regex_pattern(self.url_match), + "exceptions": lambda: dict(sorted(self._rules.items())), + "faster_heuristics": lambda: self.faster_heuristics, + } + return util.to_bytes(serializers, exclude) + + def from_bytes(self, bytes_data, *, exclude=tuple()): + """Load state from a binary string. + + bytes_data (bytes): The data to load from. + exclude (list): String names of serialization fields to exclude. + RETURNS (Tokenizer): The `Tokenizer` object. + + DOCS: https://spacy.io/api/tokenizer#from_bytes + """ + data = {} + deserializers = { + "vocab": lambda b: self.vocab.from_bytes(b, exclude=exclude), + "prefix_search": lambda b: data.setdefault("prefix_search", b), + "suffix_search": lambda b: data.setdefault("suffix_search", b), + "infix_finditer": lambda b: data.setdefault("infix_finditer", b), + "token_match": lambda b: data.setdefault("token_match", b), + "url_match": lambda b: data.setdefault("url_match", b), + "exceptions": lambda b: data.setdefault("rules", b), + "faster_heuristics": lambda b: data.setdefault("faster_heuristics", b), + } + # reset all properties and flush all caches (through rules), + # reset rules first so that _reload_special_cases is trivial/fast as + # the other properties are reset + self.rules = {} + self.prefix_search = None + self.suffix_search = None + self.infix_finditer = None + self.token_match = None + self.url_match = None + util.from_bytes(bytes_data, deserializers, exclude) + if "prefix_search" in data and isinstance(data["prefix_search"], str): + self.prefix_search = re.compile(data["prefix_search"]).search + if "suffix_search" in data and isinstance(data["suffix_search"], str): + self.suffix_search = re.compile(data["suffix_search"]).search + if "infix_finditer" in data and isinstance(data["infix_finditer"], str): + self.infix_finditer = re.compile(data["infix_finditer"]).finditer + if "token_match" in data and isinstance(data["token_match"], str): + self.token_match = re.compile(data["token_match"]).match + if "url_match" in data and isinstance(data["url_match"], str): + self.url_match = re.compile(data["url_match"]).match + if "faster_heuristics" in data: + self.faster_heuristics = data["faster_heuristics"] + # always load rules last so that all other settings are set before the + # internal tokenization for the phrase matcher + if "rules" in data and isinstance(data["rules"], dict): + self.rules = data["rules"] + return self + + +def _get_regex_pattern(regex): + """Get a pattern string for a regex, or None if the pattern is None.""" + return None if regex is None else regex.__self__.pattern + + +cdef extern from "" namespace "std" nogil: + void stdsort "sort"(vector[SpanC].iterator, + vector[SpanC].iterator, + bint (*)(SpanC, SpanC)) + + +cdef bint len_start_cmp(SpanC a, SpanC b) noexcept nogil: + if a.end - a.start == b.end - b.start: + return b.start < a.start + return a.end - a.start < b.end - b.start + + +cdef bint start_cmp(SpanC a, SpanC b) noexcept nogil: + return a.start < b.start diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/ty.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ty.py new file mode 100644 index 0000000000000000000000000000000000000000..07c37b8c21a380ac8ed0f38c59fd7eb6bfc0cd00 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/ty.py @@ -0,0 +1,59 @@ +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Dict, + Iterable, + List, + Optional, + Sequence, +) + +from thinc.api import Model, Optimizer + +from .compat import Protocol, runtime_checkable + +if TYPE_CHECKING: + from .language import Language + from .training import Example + + +@runtime_checkable +class TrainableComponent(Protocol): + model: Any + is_trainable: bool + + def update( + self, + examples: Iterable["Example"], + *, + drop: float = 0.0, + sgd: Optional[Optimizer] = None, + losses: Optional[Dict[str, float]] = None + ) -> Dict[str, float]: ... + + def finish_update(self, sgd: Optimizer) -> None: ... + + +@runtime_checkable +class InitializableComponent(Protocol): + def initialize( + self, + get_examples: Callable[[], Iterable["Example"]], + nlp: "Language", + **kwargs: Any + ): ... + + +@runtime_checkable +class ListenedToComponent(Protocol): + model: Any + listeners: Sequence[Model] + listener_map: Dict[str, Sequence[Model]] + listening_components: List[str] + + def add_listener(self, listener: Model, component_name: str) -> None: ... + + def remove_listener(self, listener: Model, component_name: str) -> bool: ... + + def find_listeners(self, component) -> None: ... diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/typedefs.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/typedefs.pxd new file mode 100644 index 0000000000000000000000000000000000000000..2ac6bc5789c665395f9578f0d74581d2ae9d6f7e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/typedefs.pxd @@ -0,0 +1,9 @@ +from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + +ctypedef float weight_t +ctypedef uint64_t hash_t +ctypedef uint64_t class_t +ctypedef uint64_t attr_t +ctypedef uint64_t flags_t +ctypedef uint16_t len_t +ctypedef uint16_t tag_t diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/typedefs.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/typedefs.pyx new file mode 100644 index 0000000000000000000000000000000000000000..9ced0659d7a537b0bc57c737e11a05e1ad06c6fc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/typedefs.pyx @@ -0,0 +1 @@ +# cython: profile=False diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/util.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy/util.py new file mode 100644 index 0000000000000000000000000000000000000000..a44ebae0619f7ac76eef7c9b3c8744a354ae73a5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/util.py @@ -0,0 +1,1894 @@ +import functools +import importlib +import importlib.util +import inspect +import itertools +import logging +import os +import re +import shlex +import shutil +import socket +import stat +import subprocess +import sys +import tempfile +import warnings +from collections import defaultdict +from contextlib import contextmanager +from pathlib import Path +from types import ModuleType +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Dict, + Generator, + Iterable, + Iterator, + List, + Mapping, + NoReturn, + Optional, + Pattern, + Set, + Tuple, + Type, + Union, + cast, +) + +import catalogue +import numpy +import srsly +import thinc +from catalogue import Registry, RegistryError +from packaging.requirements import Requirement +from packaging.specifiers import InvalidSpecifier, SpecifierSet +from packaging.version import InvalidVersion, Version +from thinc.api import ( + Adam, + Config, + ConfigValidationError, + Model, + NumpyOps, + Optimizer, + get_current_ops, +) + +try: + import cupy.random +except ImportError: + cupy = None + +# These are functions that were previously (v2.x) available from spacy.util +# and have since moved to Thinc. We're importing them here so people's code +# doesn't break, but they should always be imported from Thinc from now on, +# not from spacy.util. +from thinc.api import compounding, decaying, fix_random_seed # noqa: F401 + +from . import about +from .compat import CudaStream, cupy, importlib_metadata, is_windows +from .errors import OLD_MODEL_SHORTCUTS, Errors, Warnings +from .symbols import ORTH + +if TYPE_CHECKING: + # This lets us add type hints for mypy etc. without causing circular imports + from .language import Language, PipeCallable # noqa: F401 + from .tokens import Doc, Span # noqa: F401 + from .vocab import Vocab # noqa: F401 + + +# fmt: off +OOV_RANK = numpy.iinfo(numpy.uint64).max +DEFAULT_OOV_PROB = -20 +LEXEME_NORM_LANGS = ["cs", "da", "de", "el", "en", "grc", "id", "lb", "mk", "pt", "ru", "sr", "ta", "th"] + +# Default order of sections in the config file. Not all sections needs to exist, +# and additional sections are added at the end, in alphabetical order. +CONFIG_SECTION_ORDER = ["paths", "variables", "system", "nlp", "components", "corpora", "training", "pretraining", "initialize"] + +LANG_ALIASES = { + "af": ["afr"], + "am": ["amh"], + "ar": ["ara"], + "az": ["aze"], + "bg": ["bul"], + "bn": ["ben"], + "bo": ["bod", "tib"], + "ca": ["cat"], + "cs": ["ces", "cze"], + "da": ["dan"], + "de": ["deu", "ger"], + "el": ["ell", "gre"], + "en": ["eng"], + "es": ["spa"], + "et": ["est"], + "eu": ["eus", "baq"], + "fa": ["fas", "per"], + "fi": ["fin"], + "fo": ["fao"], + "fr": ["fra", "fre"], + "ga": ["gle"], + "gd": ["gla"], + "gu": ["guj"], + "he": ["heb", "iw"], # "iw" is the obsolete ISO 639-1 code for Hebrew + "hi": ["hin"], + "hr": ["hrv", "scr"], # "scr" is the deprecated ISO 639-2/B for Croatian + "hu": ["hun"], + "hy": ["hye"], + "id": ["ind", "in"], # "in" is the obsolete ISO 639-1 code for Hebrew + "is": ["isl", "ice"], + "it": ["ita"], + "ja": ["jpn"], + "kn": ["kan"], + "ko": ["kor"], + "ky": ["kir"], + "la": ["lat"], + "lb": ["ltz"], + "lg": ["lug"], + "lt": ["lit"], + "lv": ["lav"], + "mk": ["mkd", "mac"], + "ml": ["mal"], + "mr": ["mar"], + "ms": ["msa", "may"], + "nb": ["nob"], + "ne": ["nep"], + "nl": ["nld", "dut"], + "nn": ["nno"], + "pl": ["pol"], + "pt": ["por"], + "ro": ["ron", "rom", "mo", "mol"], # "mo" and "mol" are deprecated codes for Moldavian + "ru": ["rus"], + "sa": ["san"], + "si": ["sin"], + "sk": ["slk", "slo"], + "sl": ["slv"], + "sq": ["sqi", "alb"], + "sr": ["srp", "scc"], # "scc" is the deprecated ISO 639-2/B code for Serbian + "sv": ["swe"], + "ta": ["tam"], + "te": ["tel"], + "th": ["tha"], + "ti": ["tir"], + "tl": ["tgl"], + "tn": ["tsn"], + "tr": ["tur"], + "tt": ["tat"], + "uk": ["ukr"], + "ur": ["urd"], + "vi": ["viw"], + "yo": ["yor"], + "zh": ["zho", "chi"], + + "xx": ["mul"], +} +# fmt: on + +logger = logging.getLogger("spacy") +logger_stream_handler = logging.StreamHandler() +logger_stream_handler.setFormatter( + logging.Formatter("[%(asctime)s] [%(levelname)s] %(message)s") +) +logger.addHandler(logger_stream_handler) + + +class ENV_VARS: + CONFIG_OVERRIDES = "SPACY_CONFIG_OVERRIDES" + + +class registry(thinc.registry): + languages = catalogue.create("spacy", "languages", entry_points=True) + architectures = catalogue.create("spacy", "architectures", entry_points=True) + tokenizers = catalogue.create("spacy", "tokenizers", entry_points=True) + lemmatizers = catalogue.create("spacy", "lemmatizers", entry_points=True) + lookups = catalogue.create("spacy", "lookups", entry_points=True) + displacy_colors = catalogue.create("spacy", "displacy_colors", entry_points=True) + misc = catalogue.create("spacy", "misc", entry_points=True) + # Callback functions used to manipulate nlp object etc. + callbacks = catalogue.create("spacy", "callbacks", entry_points=True) + batchers = catalogue.create("spacy", "batchers", entry_points=True) + readers = catalogue.create("spacy", "readers", entry_points=True) + augmenters = catalogue.create("spacy", "augmenters", entry_points=True) + loggers = catalogue.create("spacy", "loggers", entry_points=True) + scorers = catalogue.create("spacy", "scorers", entry_points=True) + vectors = catalogue.create("spacy", "vectors", entry_points=True) + # These are factories registered via third-party packages and the + # spacy_factories entry point. This registry only exists so we can easily + # load them via the entry points. The "true" factories are added via the + # Language.factory decorator (in the spaCy code base and user code) and those + # are the factories used to initialize components via registry.resolve. + _entry_point_factories = catalogue.create("spacy", "factories", entry_points=True) + factories = catalogue.create("spacy", "internal_factories") + # This is mostly used to get a list of all installed models in the current + # environment. spaCy models packaged with `spacy package` will "advertise" + # themselves via entry points. + models = catalogue.create("spacy", "models", entry_points=True) + cli = catalogue.create("spacy", "cli", entry_points=True) + + @classmethod + def ensure_populated(cls) -> None: + """Ensure the registry is populated with all necessary components.""" + from .registrations import REGISTRY_POPULATED, populate_registry + + if not REGISTRY_POPULATED: + populate_registry() + + @classmethod + def get_registry_names(cls) -> List[str]: + """List all available registries.""" + cls.ensure_populated() + names = [] + for name, value in inspect.getmembers(cls): + if not name.startswith("_") and isinstance(value, Registry): + names.append(name) + return sorted(names) + + @classmethod + def get(cls, registry_name: str, func_name: str) -> Callable: + """Get a registered function from the registry.""" + cls.ensure_populated() + # We're overwriting this classmethod so we're able to provide more + # specific error messages and implement a fallback to spacy-legacy. + if not hasattr(cls, registry_name): + names = ", ".join(cls.get_registry_names()) or "none" + raise RegistryError(Errors.E892.format(name=registry_name, available=names)) + reg = getattr(cls, registry_name) + try: + func = reg.get(func_name) + except RegistryError: + if func_name.startswith("spacy."): + legacy_name = func_name.replace("spacy.", "spacy-legacy.") + try: + return reg.get(legacy_name) + except catalogue.RegistryError: + pass + available = ", ".join(sorted(reg.get_all().keys())) or "none" + raise RegistryError( + Errors.E893.format( + name=func_name, reg_name=registry_name, available=available + ) + ) from None + return func + + @classmethod + def find( + cls, registry_name: str, func_name: str + ) -> Dict[str, Optional[Union[str, int]]]: + """Find information about a registered function, including the + module and path to the file it's defined in, the line number and the + docstring, if available. + + registry_name (str): Name of the catalogue registry. + func_name (str): Name of the registered function. + RETURNS (Dict[str, Optional[Union[str, int]]]): The function info. + """ + cls.ensure_populated() + # We're overwriting this classmethod so we're able to provide more + # specific error messages and implement a fallback to spacy-legacy. + if not hasattr(cls, registry_name): + names = ", ".join(cls.get_registry_names()) or "none" + raise RegistryError(Errors.E892.format(name=registry_name, available=names)) + reg = getattr(cls, registry_name) + try: + func_info = reg.find(func_name) + except RegistryError: + if func_name.startswith("spacy."): + legacy_name = func_name.replace("spacy.", "spacy-legacy.") + try: + return reg.find(legacy_name) + except catalogue.RegistryError: + pass + available = ", ".join(sorted(reg.get_all().keys())) or "none" + raise RegistryError( + Errors.E893.format( + name=func_name, reg_name=registry_name, available=available + ) + ) from None + return func_info + + @classmethod + def has(cls, registry_name: str, func_name: str) -> bool: + """Check whether a function is available in a registry.""" + cls.ensure_populated() + if not hasattr(cls, registry_name): + return False + reg = getattr(cls, registry_name) + if func_name.startswith("spacy."): + legacy_name = func_name.replace("spacy.", "spacy-legacy.") + return func_name in reg or legacy_name in reg + return func_name in reg + + +class SimpleFrozenDict(dict): + """Simplified implementation of a frozen dict, mainly used as default + function or method argument (for arguments that should default to empty + dictionary). Will raise an error if user or spaCy attempts to add to dict. + """ + + def __init__(self, *args, error: str = Errors.E095, **kwargs) -> None: + """Initialize the frozen dict. Can be initialized with pre-defined + values. + + error (str): The error message when user tries to assign to dict. + """ + super().__init__(*args, **kwargs) + self.error = error + + def __setitem__(self, key, value): + raise NotImplementedError(self.error) + + def pop(self, key, default=None): + raise NotImplementedError(self.error) + + def update(self, other): + raise NotImplementedError(self.error) + + +class SimpleFrozenList(list): + """Wrapper class around a list that lets us raise custom errors if certain + attributes/methods are accessed. Mostly used for properties like + Language.pipeline that return an immutable list (and that we don't want to + convert to a tuple to not break too much backwards compatibility). If a user + accidentally calls nlp.pipeline.append(), we can raise a more helpful error. + """ + + def __init__(self, *args, error: str = Errors.E927) -> None: + """Initialize the frozen list. + + error (str): The error message when user tries to mutate the list. + """ + self.error = error + super().__init__(*args) + + def append(self, *args, **kwargs): + raise NotImplementedError(self.error) + + def clear(self, *args, **kwargs): + raise NotImplementedError(self.error) + + def extend(self, *args, **kwargs): + raise NotImplementedError(self.error) + + def insert(self, *args, **kwargs): + raise NotImplementedError(self.error) + + def pop(self, *args, **kwargs): + raise NotImplementedError(self.error) + + def remove(self, *args, **kwargs): + raise NotImplementedError(self.error) + + def reverse(self, *args, **kwargs): + raise NotImplementedError(self.error) + + def sort(self, *args, **kwargs): + raise NotImplementedError(self.error) + + +def lang_class_is_loaded(lang: str) -> bool: + """Check whether a Language class is already loaded. Language classes are + loaded lazily, to avoid expensive setup code associated with the language + data. + + lang (str): Two-letter language code, e.g. 'en'. + RETURNS (bool): Whether a Language class has been loaded. + """ + return lang in registry.languages + + +def find_matching_language(lang: str) -> Optional[str]: + """ + Given a two-letter ISO 639-1 or three-letter ISO 639-3 language code, + find a supported spaCy language. + + Returns the language code if a matching language is available, or None + if there is no matching language. + + >>> find_matching_language('fra') # ISO 639-3 code for French + 'fr' + >>> find_matching_language('fre') # ISO 639-2/B code for French + 'fr' + >>> find_matching_language('iw') # Obsolete ISO 639-1 code for Hebrew + 'he' + >>> find_matching_language('mo') # Deprecated code for Moldavian + 'ro' + >>> find_matching_language('scc') # Deprecated ISO 639-2/B code for Serbian + 'sr' + >>> find_matching_language('zxx') + None + """ + import spacy.lang # noqa: F401 + + # Check aliases + for lang_code, aliases in LANG_ALIASES.items(): + if lang in aliases: + return lang_code + + return None + + +def get_lang_class(lang: str) -> Type["Language"]: + """Import and load a Language class. + + lang (str): Two-letter ISO 639-1 or three-letter ISO 639-3 language code, such as 'en' and 'eng'. + RETURNS (Language): Language class. + """ + # Check if language is registered / entry point is available + if lang in registry.languages: + return registry.languages.get(lang) + else: + # Find the language in the spacy.lang subpackage + try: + module = importlib.import_module(f".lang.{lang}", "spacy") + except ImportError as err: + # Find a matching language. For example, if the language 'eng' is + # requested, we can use language-matching to load `spacy.lang.en`. + match = find_matching_language(lang) + + if match: + lang = match + module = importlib.import_module(f".lang.{lang}", "spacy") + else: + raise ImportError(Errors.E048.format(lang=lang, err=err)) from err + set_lang_class(lang, getattr(module, module.__all__[0])) # type: ignore[attr-defined] + return registry.languages.get(lang) + + +def set_lang_class(name: str, cls: Type["Language"]) -> None: + """Set a custom Language class name that can be loaded via get_lang_class. + + name (str): Name of Language class. + cls (Language): Language class. + """ + registry.languages.register(name, func=cls) + + +def ensure_path(path: Any) -> Any: + """Ensure string is converted to a Path. + + path (Any): Anything. If string, it's converted to Path. + RETURNS: Path or original argument. + """ + if isinstance(path, str): + return Path(path) + else: + return path + + +def load_language_data(path: Union[str, Path]) -> Union[dict, list]: + """Load JSON language data using the given path as a base. If the provided + path isn't present, will attempt to load a gzipped version before giving up. + + path (str / Path): The data to load. + RETURNS: The loaded data. + """ + path = ensure_path(path) + if path.exists(): + return srsly.read_json(path) + path = path.with_suffix(path.suffix + ".gz") + if path.exists(): + return srsly.read_gzip_json(path) + raise ValueError(Errors.E160.format(path=path)) + + +def get_module_path(module: ModuleType) -> Path: + """Get the path of a Python module. + + module (ModuleType): The Python module. + RETURNS (Path): The path. + """ + if not hasattr(module, "__module__"): + raise ValueError(Errors.E169.format(module=repr(module))) + file_path = Path(cast(os.PathLike, sys.modules[module.__module__].__file__)) + return file_path.parent + + +# Default value for passed enable/disable values. +_DEFAULT_EMPTY_PIPES = SimpleFrozenList() + + +def load_model( + name: Union[str, Path], + *, + vocab: Union["Vocab", bool] = True, + disable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + enable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + exclude: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + config: Union[Dict[str, Any], Config] = SimpleFrozenDict(), +) -> "Language": + """Load a model from a package or data path. + + name (str): Package name or model path. + vocab (Vocab / True): Optional vocab to pass in on initialization. If True, + a new Vocab object will be created. + disable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to disable. + enable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to enable. All others will be disabled. + exclude (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to exclude. + config (Dict[str, Any] / Config): Config overrides as nested dict or dict + keyed by section values in dot notation. + RETURNS (Language): The loaded nlp object. + """ + kwargs = { + "vocab": vocab, + "disable": disable, + "enable": enable, + "exclude": exclude, + "config": config, + } + if isinstance(name, str): # name or string path + if name.startswith("blank:"): # shortcut for blank model + return get_lang_class(name.replace("blank:", ""))() + if is_package(name): # installed as package + return load_model_from_package(name, **kwargs) # type: ignore[arg-type] + if Path(name).exists(): # path to model data directory + return load_model_from_path(Path(name), **kwargs) # type: ignore[arg-type] + elif hasattr(name, "exists"): # Path or Path-like to model data + return load_model_from_path(name, **kwargs) # type: ignore[arg-type] + if name in OLD_MODEL_SHORTCUTS: + raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name])) # type: ignore[index] + raise IOError(Errors.E050.format(name=name)) + + +def load_model_from_package( + name: str, + *, + vocab: Union["Vocab", bool] = True, + disable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + enable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + exclude: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + config: Union[Dict[str, Any], Config] = SimpleFrozenDict(), +) -> "Language": + """Load a model from an installed package. + + name (str): The package name. + vocab (Vocab / True): Optional vocab to pass in on initialization. If True, + a new Vocab object will be created. + disable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to disable. Disabled + pipes will be loaded but they won't be run unless you explicitly + enable them by calling nlp.enable_pipe. + enable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to enable. All other + pipes will be disabled (and can be enabled using `nlp.enable_pipe`). + exclude (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to exclude. Excluded + components won't be loaded. + config (Dict[str, Any] / Config): Config overrides as nested dict or dict + keyed by section values in dot notation. + RETURNS (Language): The loaded nlp object. + """ + cls = importlib.import_module(name) + return cls.load(vocab=vocab, disable=disable, enable=enable, exclude=exclude, config=config) # type: ignore[attr-defined] + + +def load_model_from_path( + model_path: Path, + *, + meta: Optional[Dict[str, Any]] = None, + vocab: Union["Vocab", bool] = True, + disable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + enable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + exclude: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + config: Union[Dict[str, Any], Config] = SimpleFrozenDict(), +) -> "Language": + """Load a model from a data directory path. Creates Language class with + pipeline from config.cfg and then calls from_disk() with path. + + model_path (Path): Model path. + meta (Dict[str, Any]): Optional model meta. + vocab (Vocab / True): Optional vocab to pass in on initialization. If True, + a new Vocab object will be created. + disable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to disable. Disabled + pipes will be loaded but they won't be run unless you explicitly + enable them by calling nlp.enable_pipe. + enable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to enable. All other + pipes will be disabled (and can be enabled using `nlp.enable_pipe`). + exclude (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to exclude. Excluded + components won't be loaded. + config (Dict[str, Any] / Config): Config overrides as nested dict or dict + keyed by section values in dot notation. + RETURNS (Language): The loaded nlp object. + """ + if not model_path.exists(): + raise IOError(Errors.E052.format(path=model_path)) + if not meta: + meta = get_model_meta(model_path) + config_path = model_path / "config.cfg" + overrides = dict_to_dot(config, for_overrides=True) + config = load_config(config_path, overrides=overrides) + nlp = load_model_from_config( + config, + vocab=vocab, + disable=disable, + enable=enable, + exclude=exclude, + meta=meta, + ) + return nlp.from_disk(model_path, exclude=exclude, overrides=overrides) + + +def load_model_from_config( + config: Union[Dict[str, Any], Config], + *, + meta: Dict[str, Any] = SimpleFrozenDict(), + vocab: Union["Vocab", bool] = True, + disable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + enable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + exclude: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + auto_fill: bool = False, + validate: bool = True, +) -> "Language": + """Create an nlp object from a config. Expects the full config file including + a section "nlp" containing the settings for the nlp object. + + name (str): Package name or model path. + meta (Dict[str, Any]): Optional model meta. + vocab (Vocab / True): Optional vocab to pass in on initialization. If True, + a new Vocab object will be created. + disable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to disable. Disabled + pipes will be loaded but they won't be run unless you explicitly + enable them by calling nlp.enable_pipe. + enable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to enable. All other + pipes will be disabled (and can be enabled using `nlp.enable_pipe`). + exclude (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to exclude. Excluded + components won't be loaded. + auto_fill (bool): Whether to auto-fill config with missing defaults. + validate (bool): Whether to show config validation errors. + RETURNS (Language): The loaded nlp object. + """ + if "nlp" not in config: + raise ValueError(Errors.E985.format(config=config)) + nlp_config = config["nlp"] + if "lang" not in nlp_config or nlp_config["lang"] is None: + raise ValueError(Errors.E993.format(config=nlp_config)) + # This will automatically handle all codes registered via the languages + # registry, including custom subclasses provided via entry points + lang_cls = get_lang_class(nlp_config["lang"]) + nlp = lang_cls.from_config( + config, + vocab=vocab, + disable=disable, + enable=enable, + exclude=exclude, + auto_fill=auto_fill, + validate=validate, + meta=meta, + ) + return nlp + + +def get_sourced_components( + config: Union[Dict[str, Any], Config], +) -> Dict[str, Dict[str, Any]]: + """RETURNS (List[str]): All sourced components in the original config, + e.g. {"source": "en_core_web_sm"}. If the config contains a key + "factory", we assume it refers to a component factory. + """ + return { + name: cfg + for name, cfg in config.get("components", {}).items() + if "factory" not in cfg and "source" in cfg + } + + +def resolve_dot_names( + config: Config, dot_names: List[Optional[str]] +) -> Tuple[Any, ...]: + """Resolve one or more "dot notation" names, e.g. corpora.train. + The paths could point anywhere into the config, so we don't know which + top-level section we'll be looking within. + + We resolve the whole top-level section, although we could resolve less -- + we could find the lowest part of the tree. + """ + # TODO: include schema? + resolved = {} + output: List[Any] = [] + errors = [] + for name in dot_names: + if name is None: + output.append(name) + else: + section = name.split(".")[0] + # We want to avoid resolving the same thing twice + if section not in resolved: + if registry.is_promise(config[section]): + # Otherwise we can't resolve [corpus] if it's a promise + result = registry.resolve({"config": config[section]})["config"] + else: + result = registry.resolve(config[section]) + resolved[section] = result + try: + output.append(dot_to_object(resolved, name)) # type: ignore[arg-type] + except KeyError: + msg = f"not a valid section reference: {name}" + errors.append({"loc": name.split("."), "msg": msg}) + if errors: + raise ConfigValidationError(config=config, errors=errors) + return tuple(output) + + +def load_model_from_init_py( + init_file: Union[Path, str], + *, + vocab: Union["Vocab", bool] = True, + disable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + enable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + exclude: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, + config: Union[Dict[str, Any], Config] = SimpleFrozenDict(), +) -> "Language": + """Helper function to use in the `load()` method of a model package's + __init__.py. + + vocab (Vocab / True): Optional vocab to pass in on initialization. If True, + a new Vocab object will be created. + disable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to disable. Disabled + pipes will be loaded but they won't be run unless you explicitly + enable them by calling nlp.enable_pipe. + enable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to enable. All other + pipes will be disabled (and can be enabled using `nlp.enable_pipe`). + exclude (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to exclude. Excluded + components won't be loaded. + config (Dict[str, Any] / Config): Config overrides as nested dict or dict + keyed by section values in dot notation. + RETURNS (Language): The loaded nlp object. + """ + model_path = Path(init_file).parent + meta = get_model_meta(model_path) + data_dir = f"{meta['lang']}_{meta['name']}-{meta['version']}" + data_path = model_path / data_dir + if not model_path.exists(): + raise IOError(Errors.E052.format(path=data_path)) + return load_model_from_path( + data_path, + vocab=vocab, + meta=meta, + disable=disable, + enable=enable, + exclude=exclude, + config=config, + ) + + +def load_config( + path: Union[str, Path], + overrides: Dict[str, Any] = SimpleFrozenDict(), + interpolate: bool = False, +) -> Config: + """Load a config file. Takes care of path validation and section order. + + path (Union[str, Path]): Path to the config file or "-" to read from stdin. + overrides: (Dict[str, Any]): Config overrides as nested dict or + dict keyed by section values in dot notation. + interpolate (bool): Whether to interpolate and resolve variables. + RETURNS (Config): The loaded config. + """ + config_path = ensure_path(path) + config = Config(section_order=CONFIG_SECTION_ORDER) + if str(config_path) == "-": # read from standard input + return config.from_str( + sys.stdin.read(), overrides=overrides, interpolate=interpolate + ) + else: + if not config_path or not config_path.is_file(): + raise IOError(Errors.E053.format(path=config_path, name="config file")) + return config.from_disk( + config_path, overrides=overrides, interpolate=interpolate + ) + + +def load_config_from_str( + text: str, overrides: Dict[str, Any] = SimpleFrozenDict(), interpolate: bool = False +): + """Load a full config from a string. Wrapper around Thinc's Config.from_str. + + text (str): The string config to load. + interpolate (bool): Whether to interpolate and resolve variables. + RETURNS (Config): The loaded config. + """ + return Config(section_order=CONFIG_SECTION_ORDER).from_str( + text, overrides=overrides, interpolate=interpolate + ) + + +def get_installed_models() -> List[str]: + """List all model packages currently installed in the environment. + + RETURNS (List[str]): The string names of the models. + """ + return list(registry.models.get_all().keys()) + + +def get_package_version(name: str) -> Optional[str]: + """Get the version of an installed package. Typically used to get model + package versions. + + name (str): The name of the installed Python package. + RETURNS (str / None): The version or None if package not installed. + """ + try: + return importlib_metadata.version(name) # type: ignore[attr-defined] + except importlib_metadata.PackageNotFoundError: # type: ignore[attr-defined] + return None + + +def is_compatible_version( + version: str, constraint: str, prereleases: bool = True +) -> Optional[bool]: + """Check if a version (e.g. "2.0.0") is compatible given a version + constraint (e.g. ">=1.9.0,<2.2.1"). If the constraint is a specific version, + it's interpreted as =={version}. + + version (str): The version to check. + constraint (str): The constraint string. + prereleases (bool): Whether to allow prereleases. If set to False, + prerelease versions will be considered incompatible. + RETURNS (bool / None): Whether the version is compatible, or None if the + version or constraint are invalid. + """ + # Handle cases where exact version is provided as constraint + if constraint[0].isdigit(): + constraint = f"=={constraint}" + try: + spec = SpecifierSet(constraint) + version = Version(version) # type: ignore[assignment] + except (InvalidSpecifier, InvalidVersion): + return None + spec.prereleases = prereleases + return version in spec + + +def is_unconstrained_version( + constraint: str, prereleases: bool = True +) -> Optional[bool]: + # We have an exact version, this is the ultimate constrained version + if constraint[0].isdigit(): + return False + try: + spec = SpecifierSet(constraint) + except InvalidSpecifier: + return None + spec.prereleases = prereleases + specs = [sp for sp in spec] + # We only have one version spec and it defines > or >= + if len(specs) == 1 and specs[0].operator in (">", ">="): + return True + # One specifier is exact version + if any(sp.operator in ("==") for sp in specs): + return False + has_upper = any(sp.operator in ("<", "<=") for sp in specs) + has_lower = any(sp.operator in (">", ">=") for sp in specs) + # We have a version spec that defines an upper and lower bound + if has_upper and has_lower: + return False + # Everything else, like only an upper version, only a lower version etc. + return True + + +def split_requirement(requirement: str) -> Tuple[str, str]: + """Split a requirement like spacy>=1.2.3 into ("spacy", ">=1.2.3").""" + req = Requirement(requirement) + return (req.name, str(req.specifier)) + + +def get_minor_version_range(version: str) -> str: + """Generate a version range like >=1.2.3,<1.3.0 based on a given version + (e.g. of spaCy). + """ + release = Version(version).release + return f">={version},<{release[0]}.{release[1] + 1}.0" + + +def get_model_lower_version(constraint: str) -> Optional[str]: + """From a version range like >=1.2.3,<1.3.0 return the lower pin.""" + try: + specset = SpecifierSet(constraint) + for spec in specset: + if spec.operator in (">=", "==", "~="): + return spec.version + except Exception: + pass + return None + + +def is_prerelease_version(version: str) -> bool: + """Check whether a version is a prerelease version. + + version (str): The version, e.g. "3.0.0.dev1". + RETURNS (bool): Whether the version is a prerelease version. + """ + return Version(version).is_prerelease + + +def get_base_version(version: str) -> str: + """Generate the base version without any prerelease identifiers. + + version (str): The version, e.g. "3.0.0.dev1". + RETURNS (str): The base version, e.g. "3.0.0". + """ + return Version(version).base_version + + +def get_minor_version(version: str) -> Optional[str]: + """Get the major + minor version (without patch or prerelease identifiers). + + version (str): The version. + RETURNS (str): The major + minor version or None if version is invalid. + """ + try: + v = Version(version) + except (TypeError, InvalidVersion): + return None + return f"{v.major}.{v.minor}" + + +def is_minor_version_match(version_a: str, version_b: str) -> bool: + """Compare two versions and check if they match in major and minor, without + patch or prerelease identifiers. Used internally for compatibility checks + that should be insensitive to patch releases. + + version_a (str): The first version + version_b (str): The second version. + RETURNS (bool): Whether the versions match. + """ + a = get_minor_version(version_a) + b = get_minor_version(version_b) + return a is not None and b is not None and a == b + + +def load_meta(path: Union[str, Path]) -> Dict[str, Any]: + """Load a model meta.json from a path and validate its contents. + + path (Union[str, Path]): Path to meta.json. + RETURNS (Dict[str, Any]): The loaded meta. + """ + path = ensure_path(path) + if not path.parent.exists(): + raise IOError(Errors.E052.format(path=path.parent)) + if not path.exists() or not path.is_file(): + raise IOError(Errors.E053.format(path=path.parent, name="meta.json")) + meta = srsly.read_json(path) + for setting in ["lang", "name", "version"]: + if setting not in meta or not meta[setting]: + raise ValueError(Errors.E054.format(setting=setting)) + if "spacy_version" in meta: + if not is_compatible_version(about.__version__, meta["spacy_version"]): + lower_version = get_model_lower_version(meta["spacy_version"]) + lower_version = get_base_version(lower_version) # type: ignore[arg-type] + if lower_version is not None: + lower_version = "v" + lower_version + elif "spacy_git_version" in meta: + lower_version = "git commit " + meta["spacy_git_version"] + else: + lower_version = "version unknown" + warn_msg = Warnings.W095.format( + model=f"{meta['lang']}_{meta['name']}", + model_version=meta["version"], + version=lower_version, + current=about.__version__, + ) + warnings.warn(warn_msg) + if is_unconstrained_version(meta["spacy_version"]): + warn_msg = Warnings.W094.format( + model=f"{meta['lang']}_{meta['name']}", + model_version=meta["version"], + version=meta["spacy_version"], + example=get_minor_version_range(about.__version__), + ) + warnings.warn(warn_msg) + return meta + + +def get_model_meta(path: Union[str, Path]) -> Dict[str, Any]: + """Get model meta.json from a directory path and validate its contents. + + path (str / Path): Path to model directory. + RETURNS (Dict[str, Any]): The model's meta data. + """ + model_path = ensure_path(path) + return load_meta(model_path / "meta.json") + + +def is_package(name: str) -> bool: + """Check if string maps to a package installed via pip. + + name (str): Name of package. + RETURNS (bool): True if installed package, False if not. + """ + try: + importlib_metadata.distribution(name) # type: ignore[attr-defined] + return True + except: # noqa: E722 + return False + + +def get_package_path(name: str) -> Path: + """Get the path to an installed package. + + name (str): Package name. + RETURNS (Path): Path to installed package. + """ + # Here we're importing the module just to find it. This is worryingly + # indirect, but it's otherwise very difficult to find the package. + pkg = importlib.import_module(name) + return Path(cast(Union[str, os.PathLike], pkg.__file__)).parent + + +def replace_model_node(model: Model, target: Model, replacement: Model) -> None: + """Replace a node within a model with a new one, updating refs. + + model (Model): The parent model. + target (Model): The target node. + replacement (Model): The node to replace the target with. + """ + # Place the node into the sublayers + for node in model.walk(): + if target in node.layers: + node.layers[node.layers.index(target)] = replacement + # Now fix any node references + for node in model.walk(): + for ref_name in node.ref_names: + if node.maybe_get_ref(ref_name) is target: + node.set_ref(ref_name, replacement) + + +def split_command(command: str) -> List[str]: + """Split a string command using shlex. Handles platform compatibility. + command (str) : The command to split + RETURNS (List[str]): The split command. + """ + return shlex.split(command, posix=not is_windows) + + +def run_command( + command: Union[str, List[str]], + *, + stdin: Optional[Any] = None, + capture: bool = False, +) -> subprocess.CompletedProcess: + """Run a command on the command line as a subprocess. If the subprocess + returns a non-zero exit code, a system exit is performed. + command (str / List[str]): The command. If provided as a string, the + string will be split using shlex.split. + stdin (Optional[Any]): stdin to read from or None. + capture (bool): Whether to capture the output and errors. If False, + the stdout and stderr will not be redirected, and if there's an error, + sys.exit will be called with the return code. You should use capture=False + when you want to turn over execution to the command, and capture=True + when you want to run the command more like a function. + RETURNS (Optional[CompletedProcess]): The process object. + """ + if isinstance(command, str): + cmd_list = split_command(command) + cmd_str = command + else: + cmd_list = command + cmd_str = " ".join(command) + try: + ret = subprocess.run( + cmd_list, + env=os.environ.copy(), + input=stdin, + encoding="utf8", + check=False, + stdout=subprocess.PIPE if capture else None, + stderr=subprocess.STDOUT if capture else None, + ) + except FileNotFoundError: + # Indicates the *command* wasn't found, it's an error before the command + # is run. + raise FileNotFoundError( + Errors.E970.format(str_command=cmd_str, tool=cmd_list[0]) + ) from None + if ret.returncode != 0 and capture: + message = f"Error running command:\n\n{cmd_str}\n\n" + message += f"Subprocess exited with status {ret.returncode}" + if ret.stdout is not None: + message += f"\n\nProcess log (stdout and stderr):\n\n" + message += ret.stdout + error = subprocess.SubprocessError(message) + error.ret = ret # type: ignore[attr-defined] + error.command = cmd_str # type: ignore[attr-defined] + raise error + elif ret.returncode != 0: + sys.exit(ret.returncode) + return ret + + +@contextmanager +def working_dir(path: Union[str, Path]) -> Iterator[Path]: + """Change current working directory and returns to previous on exit. + path (str / Path): The directory to navigate to. + YIELDS (Path): The absolute path to the current working directory. This + should be used if the block needs to perform actions within the working + directory, to prevent mismatches with relative paths. + """ + prev_cwd = Path.cwd() + current = Path(path).resolve() + os.chdir(str(current)) + try: + yield current + finally: + os.chdir(str(prev_cwd)) + + +@contextmanager +def make_tempdir() -> Generator[Path, None, None]: + """Execute a block in a temporary directory and remove the directory and + its contents at the end of the with block. + YIELDS (Path): The path of the temp directory. + """ + d = Path(tempfile.mkdtemp()) + yield d + + # On Windows, git clones use read-only files, which cause permission errors + # when being deleted. This forcibly fixes permissions. + def force_remove(rmfunc, path, ex): + os.chmod(path, stat.S_IWRITE) + rmfunc(path) + + try: + if sys.version_info >= (3, 12): + shutil.rmtree(str(d), onexc=force_remove) + else: + shutil.rmtree(str(d), onerror=force_remove) + except PermissionError as e: + warnings.warn(Warnings.W091.format(dir=d, msg=e)) + + +def is_in_jupyter() -> bool: + """Check if user is running spaCy from a Jupyter or Colab notebook by + detecting the IPython kernel. Mainly used for the displaCy visualizer. + RETURNS (bool): True if in Jupyter/Colab, False if not. + """ + # https://stackoverflow.com/a/39662359/6400719 + # https://stackoverflow.com/questions/15411967 + try: + if get_ipython().__class__.__name__ == "ZMQInteractiveShell": # type: ignore[name-defined] + return True # Jupyter notebook or qtconsole + if get_ipython().__class__.__module__ == "google.colab._shell": # type: ignore[name-defined] + return True # Colab notebook + except NameError: + pass # Probably standard Python interpreter + # additional check for Colab + try: + import google.colab + + return True # Colab notebook + except ImportError: + pass + return False + + +def is_in_interactive() -> bool: + """Check if user is running spaCy from an interactive Python + shell. Will return True in Jupyter notebooks too. + RETURNS (bool): True if in interactive mode, False if not. + """ + # https://stackoverflow.com/questions/2356399/tell-if-python-is-in-interactive-mode + return hasattr(sys, "ps1") or hasattr(sys, "ps2") + + +def get_object_name(obj: Any) -> str: + """Get a human-readable name of a Python object, e.g. a pipeline component. + + obj (Any): The Python object, typically a function or class. + RETURNS (str): A human-readable name. + """ + if hasattr(obj, "name") and obj.name is not None: + return obj.name + if hasattr(obj, "__name__"): + return obj.__name__ + if hasattr(obj, "__class__") and hasattr(obj.__class__, "__name__"): + return obj.__class__.__name__ + return repr(obj) + + +def is_same_func(func1: Callable, func2: Callable) -> bool: + """Approximately decide whether two functions are the same, even if their + identity is different (e.g. after they have been live reloaded). Mostly + used in the @Language.component and @Language.factory decorators to decide + whether to raise if a factory already exists. Allows decorator to run + multiple times with the same function. + + func1 (Callable): The first function. + func2 (Callable): The second function. + RETURNS (bool): Whether it's the same function (most likely). + """ + if not callable(func1) or not callable(func2): + return False + if not hasattr(func1, "__qualname__") or not hasattr(func2, "__qualname__"): + return False + same_name = func1.__qualname__ == func2.__qualname__ + same_file = inspect.getfile(func1) == inspect.getfile(func2) + same_code = inspect.getsourcelines(func1) == inspect.getsourcelines(func2) + return same_name and same_file and same_code + + +def get_cuda_stream( + require: bool = False, non_blocking: bool = True +) -> Optional[CudaStream]: + ops = get_current_ops() + if CudaStream is None: + return None + elif isinstance(ops, NumpyOps): + return None + else: + return CudaStream(non_blocking=non_blocking) + + +def get_async(stream, numpy_array): + if cupy is None: + return numpy_array + else: + array = cupy.ndarray(numpy_array.shape, order="C", dtype=numpy_array.dtype) + array.set(numpy_array, stream=stream) + return array + + +def read_regex(path: Union[str, Path]) -> Pattern: + path = ensure_path(path) + with path.open(encoding="utf8") as file_: + entries = file_.read().split("\n") + expression = "|".join( + ["^" + re.escape(piece) for piece in entries if piece.strip()] + ) + return re.compile(expression) + + +def compile_prefix_regex(entries: Iterable[Union[str, Pattern]]) -> Pattern: + """Compile a sequence of prefix rules into a regex object. + + entries (Iterable[Union[str, Pattern]]): The prefix rules, e.g. + spacy.lang.punctuation.TOKENIZER_PREFIXES. + RETURNS (Pattern): The regex object. to be used for Tokenizer.prefix_search. + """ + expression = "|".join(["^" + piece for piece in entries if piece.strip()]) # type: ignore[operator, union-attr] + return re.compile(expression) + + +def compile_suffix_regex(entries: Iterable[Union[str, Pattern]]) -> Pattern: + """Compile a sequence of suffix rules into a regex object. + + entries (Iterable[Union[str, Pattern]]): The suffix rules, e.g. + spacy.lang.punctuation.TOKENIZER_SUFFIXES. + RETURNS (Pattern): The regex object. to be used for Tokenizer.suffix_search. + """ + expression = "|".join([piece + "$" for piece in entries if piece.strip()]) # type: ignore[operator, union-attr] + return re.compile(expression) + + +def compile_infix_regex(entries: Iterable[Union[str, Pattern]]) -> Pattern: + """Compile a sequence of infix rules into a regex object. + + entries (Iterable[Union[str, Pattern]]): The infix rules, e.g. + spacy.lang.punctuation.TOKENIZER_INFIXES. + RETURNS (regex object): The regex object. to be used for Tokenizer.infix_finditer. + """ + expression = "|".join([piece for piece in entries if piece.strip()]) # type: ignore[misc, union-attr] + return re.compile(expression) + + +def add_lookups(default_func: Callable[[str], Any], *lookups) -> Callable[[str], Any]: + """Extend an attribute function with special cases. If a word is in the + lookups, the value is returned. Otherwise the previous function is used. + + default_func (callable): The default function to execute. + *lookups (dict): Lookup dictionary mapping string to attribute value. + RETURNS (callable): Lexical attribute getter. + """ + # This is implemented as functools.partial instead of a closure, to allow + # pickle to work. + return functools.partial(_get_attr_unless_lookup, default_func, lookups) + + +def _get_attr_unless_lookup( + default_func: Callable[[str], Any], lookups: Dict[str, Any], string: str +) -> Any: + for lookup in lookups: + if string in lookup: + return lookup[string] # type: ignore[index] + return default_func(string) + + +def update_exc( + base_exceptions: Dict[str, List[dict]], *addition_dicts +) -> Dict[str, List[dict]]: + """Update and validate tokenizer exceptions. Will overwrite exceptions. + + base_exceptions (Dict[str, List[dict]]): Base exceptions. + *addition_dicts (Dict[str, List[dict]]): Exceptions to add to the base dict, in order. + RETURNS (Dict[str, List[dict]]): Combined tokenizer exceptions. + """ + exc = dict(base_exceptions) + for additions in addition_dicts: + for orth, token_attrs in additions.items(): + if not all(isinstance(attr[ORTH], str) for attr in token_attrs): + raise ValueError(Errors.E055.format(key=orth, orths=token_attrs)) + described_orth = "".join(attr[ORTH] for attr in token_attrs) + if orth != described_orth: + raise ValueError(Errors.E056.format(key=orth, orths=described_orth)) + exc.update(additions) + exc = expand_exc(exc, "'", "’") + return exc + + +def expand_exc( + excs: Dict[str, List[dict]], search: str, replace: str +) -> Dict[str, List[dict]]: + """Find string in tokenizer exceptions, duplicate entry and replace string. + For example, to add additional versions with typographic apostrophes. + + excs (Dict[str, List[dict]]): Tokenizer exceptions. + search (str): String to find and replace. + replace (str): Replacement. + RETURNS (Dict[str, List[dict]]): Combined tokenizer exceptions. + """ + + def _fix_token(token, search, replace): + fixed = dict(token) + fixed[ORTH] = fixed[ORTH].replace(search, replace) + return fixed + + new_excs = dict(excs) + for token_string, tokens in excs.items(): + if search in token_string: + new_key = token_string.replace(search, replace) + new_value = [_fix_token(t, search, replace) for t in tokens] + new_excs[new_key] = new_value + return new_excs + + +def normalize_slice( + length: int, start: int, stop: int, step: Optional[int] = None +) -> Tuple[int, int]: + if not (step is None or step == 1): + raise ValueError(Errors.E057) + if start is None: + start = 0 + elif start < 0: + start += length + start = min(length, max(0, start)) + if stop is None: + stop = length + elif stop < 0: + stop += length + stop = min(length, max(start, stop)) + return start, stop + + +def filter_spans(spans: Iterable["Span"]) -> List["Span"]: + """Filter a sequence of spans and remove duplicates or overlaps. Useful for + creating named entities (where one token can only be part of one entity) or + when merging spans with `Retokenizer.merge`. When spans overlap, the (first) + longest span is preferred over shorter spans. + + spans (Iterable[Span]): The spans to filter. + RETURNS (List[Span]): The filtered spans. + """ + get_sort_key = lambda span: (span.end - span.start, -span.start) + sorted_spans = sorted(spans, key=get_sort_key, reverse=True) + result = [] + seen_tokens: Set[int] = set() + for span in sorted_spans: + # Check for end - 1 here because boundaries are inclusive + if span.start not in seen_tokens and span.end - 1 not in seen_tokens: + result.append(span) + seen_tokens.update(range(span.start, span.end)) + result = sorted(result, key=lambda span: span.start) + return result + + +def filter_chain_spans(*spans: Iterable["Span"]) -> List["Span"]: + return filter_spans(itertools.chain(*spans)) + + +def make_first_longest_spans_filter(): + return filter_chain_spans + + +def to_bytes(getters: Dict[str, Callable[[], bytes]], exclude: Iterable[str]) -> bytes: + return srsly.msgpack_dumps(to_dict(getters, exclude)) + + +def from_bytes( + bytes_data: bytes, + setters: Dict[str, Callable[[bytes], Any]], + exclude: Iterable[str], +) -> None: + return from_dict(srsly.msgpack_loads(bytes_data), setters, exclude) # type: ignore[return-value] + + +def to_dict( + getters: Dict[str, Callable[[], Any]], exclude: Iterable[str] +) -> Dict[str, Any]: + serialized = {} + for key, getter in getters.items(): + # Split to support file names like meta.json + if key.split(".")[0] not in exclude: + serialized[key] = getter() + return serialized + + +def from_dict( + msg: Dict[str, Any], + setters: Dict[str, Callable[[Any], Any]], + exclude: Iterable[str], +) -> Dict[str, Any]: + for key, setter in setters.items(): + # Split to support file names like meta.json + if key.split(".")[0] not in exclude and key in msg: + setter(msg[key]) + return msg + + +def to_disk( + path: Union[str, Path], + writers: Dict[str, Callable[[Path], None]], + exclude: Iterable[str], +) -> Path: + path = ensure_path(path) + if not path.exists(): + path.mkdir() + for key, writer in writers.items(): + # Split to support file names like meta.json + if key.split(".")[0] not in exclude: + writer(path / key) + return path + + +def from_disk( + path: Union[str, Path], + readers: Dict[str, Callable[[Path], None]], + exclude: Iterable[str], +) -> Path: + path = ensure_path(path) + for key, reader in readers.items(): + # Split to support file names like meta.json + if key.split(".")[0] not in exclude: + reader(path / key) + return path + + +def import_file(name: str, loc: Union[str, Path]) -> ModuleType: + """Import module from a file. Used to load models from a directory. + + name (str): Name of module to load. + loc (str / Path): Path to the file. + RETURNS: The loaded module. + """ + spec = importlib.util.spec_from_file_location(name, str(loc)) + module = importlib.util.module_from_spec(spec) # type: ignore[arg-type] + spec.loader.exec_module(module) # type: ignore[union-attr] + return module + + +def minify_html(html: str) -> str: + """Perform a template-specific, rudimentary HTML minification for displaCy. + Disclaimer: NOT a general-purpose solution, only removes indentation and + newlines. + + html (str): Markup to minify. + RETURNS (str): "Minified" HTML. + """ + return html.strip().replace(" ", "").replace("\n", "") + + +def escape_html(text: str) -> str: + """Replace <, >, &, " with their HTML encoded representation. Intended to + prevent HTML errors in rendered displaCy markup. + + text (str): The original text. + RETURNS (str): Equivalent text to be safely used within HTML. + """ + text = text.replace("&", "&") + text = text.replace("<", "<") + text = text.replace(">", ">") + text = text.replace('"', """) + return text + + +def get_words_and_spaces( + words: Iterable[str], text: str +) -> Tuple[List[str], List[bool]]: + """Given a list of words and a text, reconstruct the original tokens and + return a list of words and spaces that can be used to create a Doc. This + can help recover destructive tokenization that didn't preserve any + whitespace information. + + words (Iterable[str]): The words. + text (str): The original text. + RETURNS (Tuple[List[str], List[bool]]): The words and spaces. + """ + if "".join("".join(words).split()) != "".join(text.split()): + raise ValueError(Errors.E194.format(text=text, words=words)) + text_words = [] + text_spaces = [] + text_pos = 0 + # normalize words to remove all whitespace tokens + norm_words = [word for word in words if not word.isspace()] + # align words with text + for word in norm_words: + try: + word_start = text[text_pos:].index(word) + except ValueError: + raise ValueError(Errors.E194.format(text=text, words=words)) from None + if word_start > 0: + text_words.append(text[text_pos : text_pos + word_start]) + text_spaces.append(False) + text_pos += word_start + text_words.append(word) + text_spaces.append(False) + text_pos += len(word) + if text_pos < len(text) and text[text_pos] == " ": + text_spaces[-1] = True + text_pos += 1 + if text_pos < len(text): + text_words.append(text[text_pos:]) + text_spaces.append(False) + return (text_words, text_spaces) + + +def copy_config(config: Union[Dict[str, Any], Config]) -> Config: + """Deep copy a Config. Will raise an error if the config contents are not + JSON-serializable. + + config (Config): The config to copy. + RETURNS (Config): The copied config. + """ + try: + return Config(config).copy() + except ValueError: + raise ValueError(Errors.E961.format(config=config)) from None + + +def dot_to_dict(values: Dict[str, Any]) -> Dict[str, dict]: + """Convert dot notation to a dict. For example: {"token.pos": True, + "token._.xyz": True} becomes {"token": {"pos": True, "_": {"xyz": True }}}. + + values (Dict[str, Any]): The key/value pairs to convert. + RETURNS (Dict[str, dict]): The converted values. + """ + result: Dict[str, dict] = {} + for key, value in values.items(): + path = result + parts = key.lower().split(".") + for i, item in enumerate(parts): + is_last = i == len(parts) - 1 + path = path.setdefault(item, value if is_last else {}) + return result + + +def dict_to_dot(obj: Dict[str, dict], *, for_overrides: bool = False) -> Dict[str, Any]: + """Convert dot notation to a dict. For example: {"token": {"pos": True, + "_": {"xyz": True }}} becomes {"token.pos": True, "token._.xyz": True}. + + obj (Dict[str, dict]): The dict to convert. + for_overrides (bool): Whether to enable special handling for registered + functions in overrides. + RETURNS (Dict[str, Any]): The key/value pairs. + """ + return { + ".".join(key): value + for key, value in walk_dict(obj, for_overrides=for_overrides) + } + + +def dot_to_object(config: Config, section: str): + """Convert dot notation of a "section" to a specific part of the Config. + e.g. "training.optimizer" would return the Optimizer object. + Throws an error if the section is not defined in this config. + + config (Config): The config. + section (str): The dot notation of the section in the config. + RETURNS: The object denoted by the section + """ + component = config + parts = section.split(".") + for item in parts: + try: + component = component[item] + except (KeyError, TypeError): + raise KeyError(Errors.E952.format(name=section)) from None + return component + + +def set_dot_to_object(config: Config, section: str, value: Any) -> None: + """Update a config at a given position from a dot notation. + + config (Config): The config. + section (str): The dot notation of the section in the config. + value (Any): The value to set in the config. + """ + component = config + parts = section.split(".") + for i, item in enumerate(parts): + try: + if i == len(parts) - 1: + component[item] = value + else: + component = component[item] + except (KeyError, TypeError): + raise KeyError(Errors.E952.format(name=section)) from None + + +def walk_dict( + node: Dict[str, Any], parent: List[str] = [], *, for_overrides: bool = False +) -> Iterator[Tuple[List[str], Any]]: + """Walk a dict and yield the path and values of the leaves. + + for_overrides (bool): Whether to treat registered functions that start with + @ as final values rather than dicts to traverse. + """ + for key, value in node.items(): + key_parent = [*parent, key] + if isinstance(value, dict) and ( + not for_overrides + or not any(value_key.startswith("@") for value_key in value) + ): + yield from walk_dict(value, key_parent, for_overrides=for_overrides) + else: + yield (key_parent, value) + + +def get_arg_names(func: Callable) -> List[str]: + """Get a list of all named arguments of a function (regular, + keyword-only). + + func (Callable): The function + RETURNS (List[str]): The argument names. + """ + argspec = inspect.getfullargspec(func) + return list(dict.fromkeys([*argspec.args, *argspec.kwonlyargs])) + + +def combine_score_weights( + weights: List[Dict[str, Optional[float]]], + overrides: Dict[str, Optional[float]] = SimpleFrozenDict(), +) -> Dict[str, Optional[float]]: + """Combine and normalize score weights defined by components, e.g. + {"ents_r": 0.2, "ents_p": 0.3, "ents_f": 0.5} and {"some_other_score": 1.0}. + + weights (List[dict]): The weights defined by the components. + overrides (Dict[str, Optional[Union[float, int]]]): Existing scores that + should be preserved. + RETURNS (Dict[str, float]): The combined and normalized weights. + """ + # We divide each weight by the total weight sum. + # We first need to extract all None/null values for score weights that + # shouldn't be shown in the table *or* be weighted + result: Dict[str, Optional[float]] = { + key: value for w_dict in weights for (key, value) in w_dict.items() + } + result.update(overrides) + weight_sum = sum([v if v else 0.0 for v in result.values()]) + for key, value in result.items(): + if value and weight_sum > 0: + result[key] = round(value / weight_sum, 2) + return result + + +class DummyTokenizer: + def __call__(self, text): + raise NotImplementedError + + def pipe(self, texts, **kwargs): + for text in texts: + yield self(text) + + # add dummy methods for to_bytes, from_bytes, to_disk and from_disk to + # allow serialization (see #1557) + def to_bytes(self, **kwargs): + return b"" + + def from_bytes(self, data: bytes, **kwargs) -> "DummyTokenizer": + return self + + def to_disk(self, path: Union[str, Path], **kwargs) -> None: + return None + + def from_disk(self, path: Union[str, Path], **kwargs) -> "DummyTokenizer": + return self + + +def create_default_optimizer() -> Optimizer: + return Adam() + + +def minibatch(items, size): + """Iterate over batches of items. `size` may be an iterator, + so that batch-size can vary on each step. + """ + if isinstance(size, int): + size_ = itertools.repeat(size) + else: + size_ = size + items = iter(items) + while True: + batch_size = next(size_) + batch = list(itertools.islice(items, int(batch_size))) + if len(batch) == 0: + break + yield list(batch) + + +def is_cython_func(func: Callable) -> bool: + """Slightly hacky check for whether a callable is implemented in Cython. + Can be used to implement slightly different behaviors, especially around + inspecting and parameter annotations. Note that this will only return True + for actual cdef functions and methods, not regular Python functions defined + in Python modules. + + func (Callable): The callable to check. + RETURNS (bool): Whether the callable is Cython (probably). + """ + attr = "__pyx_vtable__" + if hasattr(func, attr): # function or class instance + return True + # https://stackoverflow.com/a/55767059 + if ( + hasattr(func, "__qualname__") + and hasattr(func, "__module__") + and func.__module__ in sys.modules + ): # method + cls_func = vars(sys.modules[func.__module__])[func.__qualname__.split(".")[0]] + return hasattr(cls_func, attr) + return False + + +def check_bool_env_var(env_var: str) -> bool: + """Convert the value of an environment variable to a boolean. Add special + check for "0" (falsy) and consider everything else truthy, except unset. + + env_var (str): The name of the environment variable to check. + RETURNS (bool): Its boolean value. + """ + value = os.environ.get(env_var, False) + if value == "0": + return False + return bool(value) + + +def _pipe( + docs: Iterable["Doc"], + proc: "PipeCallable", + name: str, + default_error_handler: Callable[ + [str, "PipeCallable", List["Doc"], Exception], NoReturn + ], + kwargs: Mapping[str, Any], +) -> Iterator["Doc"]: + if hasattr(proc, "pipe"): + yield from proc.pipe(docs, **kwargs) + else: + # We added some args for pipe that __call__ doesn't expect. + kwargs = dict(kwargs) + error_handler = default_error_handler + if hasattr(proc, "get_error_handler"): + error_handler = proc.get_error_handler() + for arg in ["batch_size"]: + if arg in kwargs: + kwargs.pop(arg) + for doc in docs: + try: + doc = proc(doc, **kwargs) # type: ignore[call-arg] + yield doc + except Exception as e: + error_handler(name, proc, [doc], e) + + +def raise_error(proc_name, proc, docs, e): + raise e + + +def ignore_error(proc_name, proc, docs, e): + pass + + +def warn_if_jupyter_cupy(): + """Warn about require_gpu if a jupyter notebook + cupy + mismatched + contextvars vs. thread ops are detected + """ + if is_in_jupyter(): + from thinc.backends.cupy_ops import CupyOps + + if CupyOps.xp is not None: + from thinc.backends import contextvars_eq_thread_ops + + if not contextvars_eq_thread_ops(): + warnings.warn(Warnings.W111) + + +def check_lexeme_norms(vocab, component_name): + lexeme_norms = vocab.lookups.get_table("lexeme_norm", {}) + if len(lexeme_norms) == 0 and vocab.lang in LEXEME_NORM_LANGS: + langs = ", ".join(LEXEME_NORM_LANGS) + logger.debug(Warnings.W033.format(model=component_name, langs=langs)) + + +def to_ternary_int(val) -> int: + """Convert a value to the ternary 1/0/-1 int used for True/None/False in + attributes such as SENT_START: True/1/1.0 is 1 (True), None/0/0.0 is 0 + (None), any other values are -1 (False). + """ + if val is True: + return 1 + elif val is None: + return 0 + elif val is False: + return -1 + elif val == 1: + return 1 + elif val == 0: + return 0 + else: + return -1 + + +# The following implementation of packages_distributions() is adapted from +# importlib_metadata, which is distributed under the Apache 2.0 License. +# Copyright (c) 2017-2019 Jason R. Coombs, Barry Warsaw +# See licenses/3rd_party_licenses.txt +def packages_distributions() -> Dict[str, List[str]]: + """Return a mapping of top-level packages to their distributions. We're + inlining this helper from the importlib_metadata "backport" here, since + it's not available in the builtin importlib.metadata. + """ + pkg_to_dist = defaultdict(list) + for dist in importlib_metadata.distributions(): + for pkg in (dist.read_text("top_level.txt") or "").split(): + pkg_to_dist[pkg].append(dist.metadata["Name"]) + return dict(pkg_to_dist) + + +def all_equal(iterable): + """Return True if all the elements are equal to each other + (or if the input is an empty sequence), False otherwise.""" + g = itertools.groupby(iterable) + return next(g, True) and not next(g, False) + + +def _is_port_in_use(port: int, host: str = "localhost") -> bool: + """Check if 'host:port' is in use. Return True if it is, False otherwise. + + port (int): the port to check + host (str): the host to check (default "localhost") + RETURNS (bool): Whether 'host:port' is in use. + """ + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + try: + s.bind((host, port)) + return False + except socket.error: + return True + finally: + s.close() + + +def find_available_port(start: int, host: str, auto_select: bool = False) -> int: + """Given a starting port and a host, handle finding a port. + + If `auto_select` is False, a busy port will raise an error. + + If `auto_select` is True, the next free higher port will be used. + + start (int): the port to start looking from + host (str): the host to find a port on + auto_select (bool): whether to automatically select a new port if the given port is busy (default False) + RETURNS (int): The port to use. + """ + if not _is_port_in_use(start, host): + return start + + port = start + if not auto_select: + raise ValueError(Errors.E1050.format(port=port)) + + while _is_port_in_use(port, host) and port < 65535: + port += 1 + + if port == 65535 and _is_port_in_use(port, host): + raise ValueError(Errors.E1049.format(host=host)) + + # if we get here, the port changed + warnings.warn(Warnings.W124.format(host=host, port=start, serve_port=port)) + return port diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/vectors.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/vectors.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c43117712d63cbcc4cccf11f0d6e66846d5cfec1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/vectors.cpp @@ -0,0 +1,37977 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.vectors", + "sources": [ + "spacy/vectors.pyx" + ] + }, + "module_name": "spacy.vectors" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +/* InitLimitedAPI */ +#if defined(Py_LIMITED_API) + #if !defined(CYTHON_LIMITED_API) + #define CYTHON_LIMITED_API 1 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef _MSC_VER + #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") + #else + #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. + #endif +#endif + +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x03080000 + #error Cython requires Python 3.8+. +#else +#define __PYX_ABI_VERSION "3_2_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* CModulePreamble */ +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#define __PYX_COMMA , +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) + #endif + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 1 + #endif + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #ifdef Py_GIL_DISABLED + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 + #else + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #endif + #if PY_VERSION_HEX < 0x030A0000 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #elif !defined(CYTHON_USE_TYPE_SLOTS) + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLIST_INTERNALS) + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #elif !defined(CYTHON_FAST_GIL) + #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #ifndef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif + #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work + #elif !defined(CYTHON_IMMORTAL_CONSTANTS) + #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif +#endif +#ifndef CYTHON_COMPRESS_STRINGS + #define CYTHON_COMPRESS_STRINGS 1 +#endif +#ifndef CYTHON_FAST_PYCCALL +#define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL +#endif +#ifndef CYTHON_VECTORCALL +#if CYTHON_COMPILING_IN_LIMITED_API +#define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) +#else +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) +#endif +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#include +typedef uintptr_t __pyx_uintptr_t; +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif +#ifndef Py_UNREACHABLE + #define Py_UNREACHABLE() assert(0); abort() +#endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* PythonCompatibility */ +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#define __Pyx_BUILTIN_MODULE_NAME "builtins" +#define __Pyx_DefaultClassType PyType_Type +#if CYTHON_COMPILING_IN_LIMITED_API + #ifndef CO_OPTIMIZED + static int CO_OPTIMIZED; + #endif + #ifndef CO_NEWLOCALS + static int CO_NEWLOCALS; + #endif + #ifndef CO_VARARGS + static int CO_VARARGS; + #endif + #ifndef CO_VARKEYWORDS + static int CO_VARKEYWORDS; + #endif + #ifndef CO_ASYNC_GENERATOR + static int CO_ASYNC_GENERATOR; + #endif + #ifndef CO_GENERATOR + static int CO_GENERATOR; + #endif + #ifndef CO_COROUTINE + static int CO_COROUTINE; + #endif +#else + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 + #endif +#endif +static int __Pyx_init_co_variables(void); +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif +#ifndef Py_TPFLAGS_IMMUTABLETYPE + #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) +#endif +#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION + #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) +#endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#ifndef METH_FASTCALL + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #if PY_VERSION_HEX >= 0x030d00A4 + # define __Pyx_PyCFunctionFast PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords + #else + # define __Pyx_PyCFunctionFast _PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords + #endif +#endif +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX >= 0x030900B1 +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) +#else +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) +#endif +#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) +#elif !CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) +static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { + return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; +} +#endif +static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; +#else + return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +#endif +} +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) +#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) +#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) +#elif CYTHON_COMPILING_IN_GRAAL + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#endif +#if CYTHON_USE_MODULE_STATE +static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) +#else +#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) +#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) +#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) + #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) + #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ + ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ + (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ + __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) + #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) + #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) +#endif +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) +#endif +#define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) +#if CYTHON_USE_TYPE_SPECS +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE((PyObject*)obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#else + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #else + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #endif +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif +#endif +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#elif CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) +#endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif +enum __Pyx_ReferenceSharing { + __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check + __Pyx_ReferenceSharing_OwnStrongReference, + __Pyx_ReferenceSharing_FunctionArgument, + __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar +}; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ + (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ + (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ + (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) +#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) +#else +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) +#endif +#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) + #else + #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) + #endif +#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) + #endif +#else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) +#endif +#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ + __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) +#else + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) +#endif +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyObject_GetItem(dict, key); + if (*result == NULL) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + return 0; + } + return -1; + } + return 1; +} +#else +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyDict_GetItemWithError(dict, key); + if (*result == NULL) { + return PyErr_Occurred() ? -1 : 0; + } + Py_INCREF(*result); + return 1; +} +#endif +#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST + #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) +#else + #define __Pyx_VISIT_CONST(obj) +#endif +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) +#else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) +#endif +#if CYTHON_ASSUME_SAFE_SIZE + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) +#else + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) +#endif +#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t +#define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t +#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 + #define __Pyx_PySendResult PySendResult +#else + typedef enum { + PYGEN_RETURN = 0, + PYGEN_ERROR = -1, + PYGEN_NEXT = 1, + } __Pyx_PySendResult; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 + typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); +#else + #define __Pyx_pyiter_sendfunc sendfunc +#endif +#if !CYTHON_USE_AM_SEND +#define __PYX_HAS_PY_AM_SEND 0 +#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 +#define __PYX_HAS_PY_AM_SEND 1 +#else +#define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation +#endif +#if __PYX_HAS_PY_AM_SEND < 2 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods +#else + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + __Pyx_pyiter_sendfunc am_send; + } __Pyx_PyAsyncMethodsStruct; + #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) +#endif +#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 + #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) +#else + #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) +#endif +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() +#else +#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 +#ifdef __cplusplus +extern "C" +#endif +PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { + int value; + PyObject *py_value = PyObject_GetAttrString(inspect, name); + if (!py_value) return 0; + value = (int) PyLong_AsLong(py_value); + Py_DECREF(py_value); + *write_to = value; + return value != -1 || !PyErr_Occurred(); +} +static int __Pyx_init_co_variables(void) { + PyObject *inspect; + int result; + inspect = PyImport_ImportModule("inspect"); + result = +#if !defined(CO_OPTIMIZED) + __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && +#endif +#if !defined(CO_NEWLOCALS) + __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && +#endif +#if !defined(CO_VARARGS) + __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && +#endif +#if !defined(CO_VARKEYWORDS) + __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && +#endif +#if !defined(CO_ASYNC_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && +#endif +#if !defined(CO_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && +#endif +#if !defined(CO_COROUTINE) + __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && +#endif + 1; + Py_DECREF(inspect); + return result ? 0 : -1; +} +#else +static int __Pyx_init_co_variables(void) { + return 0; // It's a limited API-only feature +} +#endif + +/* MathInitCode */ +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #ifndef _USE_MATH_DEFINES + #define _USE_MATH_DEFINES + #endif +#endif +#include +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 +#endif +#ifndef CYTHON_CLINE_IN_TRACEBACK +#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#endif +#if CYTHON_CLINE_IN_TRACEBACK +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } +#else +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } +#endif +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__vectors +#define __PYX_HAVE_API__spacy__vectors +/* Early includes */ +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) +#else + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) +#endif +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) + return Py_NewRef(obj); +#else + Py_INCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) + return Py_XNewRef(obj); +#else + Py_XINCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) +#else +#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) +#endif +#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) +#else + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +/* PretendToInitialize */ +#ifdef __cplusplus +#if __cplusplus > 201103L +#include +#endif +template +static void __Pyx_pretend_to_initialize(T* ptr) { +#if __cplusplus > 201103L + if ((std::is_trivially_default_constructible::value)) +#endif + *ptr = T(); + (void)ptr; +} +#else +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#endif + + +#if !CYTHON_USE_MODULE_STATE +static PyObject *__pyx_m = NULL; +#endif +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * const __pyx_cfilenm = __FILE__; +static const char *__pyx_filename; + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/vectors.pyx", + "", + "cymem/cymem.pxd", + "preshed/maps.pxd", + "spacy/strings.pxd", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* Atomics.proto (used by UnpackUnboundCMethod) */ +#include +#ifndef CYTHON_ATOMICS + #define CYTHON_ATOMICS 1 +#endif +#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS +#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __pyx_atomic_int_type int +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_ptr_type atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) atomic_load(value) + #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_ptr_type std::atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) std::atomic_load(value) + #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ + (__GNUC_MINOR__ > 1 ||\ + (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) + #define __pyx_atomic_ptr_type void* + #define __pyx_nonatomic_ptr_type void* + #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) + #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #warning "Using GNU atomics" + #endif +#elif CYTHON_ATOMICS && defined(_MSC_VER) + #include + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type long + #define __pyx_atomic_ptr_type void* + #undef __pyx_nonatomic_int_type + #define __pyx_nonatomic_int_type long + #define __pyx_nonatomic_ptr_type void* + #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) + #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) + #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) + #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value + #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #pragma message ("Using MSVC atomics") + #endif +#else + #undef CYTHON_ATOMICS + #define CYTHON_ATOMICS 0 + #ifdef __PYX_DEBUG_ATOMICS + #warning "Not using atomics" + #endif +#endif + +/* CriticalSectionsDefinition.proto (used by CriticalSections) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection void* +#define __Pyx_PyCriticalSection2 void* +#define __Pyx_PyCriticalSection_End(cs) +#define __Pyx_PyCriticalSection2_End(cs) +#else +#define __Pyx_PyCriticalSection PyCriticalSection +#define __Pyx_PyCriticalSection2 PyCriticalSection2 +#define __Pyx_PyCriticalSection_End PyCriticalSection_End +#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End +#endif + +/* CriticalSections.proto (used by ParseKeywordsImpl) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs) +#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs) +#else +#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin +#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin +#endif +#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_BEGIN_CRITICAL_SECTION(o) { +#define __Pyx_END_CRITICAL_SECTION() } +#else +#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION +#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION +#endif + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* #### Code section: numeric_typedefs ### */ + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_7vectors_BaseVectors; +struct __pyx_obj_5spacy_7vectors_Vectors; +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__; +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values; +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items; +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr; +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr; +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk; +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk; +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes; +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes; + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "spacy/vectors.pyx":45 + * + * + * cdef class BaseVectors: # <<<<<<<<<<<<<< + * def __init__(self, *, strings=None): + * # Make sure abstract BaseVectors is not instantiated. +*/ +struct __pyx_obj_5spacy_7vectors_BaseVectors { + PyObject_HEAD +}; + + +/* "spacy/vectors.pyx":109 + * + * + * cdef class Vectors(BaseVectors): # <<<<<<<<<<<<<< + * """Store, save and load word vectors. + * +*/ +struct __pyx_obj_5spacy_7vectors_Vectors { + struct __pyx_obj_5spacy_7vectors_BaseVectors __pyx_base; + PyObject *strings; + PyObject *name; + PyObject *mode; + PyObject *data; + PyObject *key2row; + std::set _unset; + uint32_t minn; + uint32_t maxn; + uint32_t hash_count; + uint32_t hash_seed; + PyObject *bow; + PyObject *eow; + enum __pyx_t_5spacy_5attrs_attr_id_t attr; +}; + + +/* "spacy/vectors.pyx":298 + * self._unset.erase(self._unset.find(i)) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * """Iterate over the keys in the table. + * +*/ +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__ { + PyObject_HEAD + struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self; +}; + + +/* "spacy/vectors.pyx":380 + * return self.key2row.keys() + * + * def values(self): # <<<<<<<<<<<<<< + * """Iterate over vectors that have been assigned to at least one key. + * +*/ +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values { + PyObject_HEAD + PyObject *__pyx_v_row; + struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self; + PyObject *__pyx_v_vector; + PyObject *__pyx_t_0; + PyObject *__pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "spacy/vectors.pyx":394 + * yield vector + * + * def items(self): # <<<<<<<<<<<<<< + * """Iterate over `(key, vector)` pairs. + * +*/ +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items { + PyObject_HEAD + PyObject *__pyx_v_key; + PyObject *__pyx_v_row; + struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "spacy/vectors.pyx":424 + * ) + * ) + * if sum(arg is None for arg in (key, keys, row, rows)) != 3: # <<<<<<<<<<<<<< + * bad_kwargs = {"key": key, "keys": keys, "row": row, "rows": rows} + * raise ValueError(Errors.E059.format(kwargs=bad_kwargs)) +*/ +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr { + PyObject_HEAD + PyObject *__pyx_genexpr_arg_0; + PyObject *__pyx_v_arg; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; +}; + + +/* "spacy/vectors.pyx":486 + * elif self.mode == Mode.floret: + * keys = [self.strings.as_string(key) for key in keys] + * if sum(len(key) for key in keys) == 0: # <<<<<<<<<<<<<< + * return ops.xp.zeros((len(keys), self.data.shape[1])) + * unique_keys = tuple(set(keys)) +*/ +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr { + PyObject_HEAD + PyObject *__pyx_genexpr_arg_0; + PyObject *__pyx_v_key; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "spacy/vectors.pyx":648 + * self.attr = cfg.get("attr", ORTH) + * + * def to_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk { + PyObject_HEAD + PyObject *__pyx_v_save_array; + PyObject *__pyx_v_save_vectors; + struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self; + PyObject *__pyx_v_xp; +}; + + +/* "spacy/vectors.pyx":678 + * return util.to_disk(path, serializers, exclude) + * + * def from_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk { + PyObject_HEAD + struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self; +}; + + +/* "spacy/vectors.pyx":722 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes { + PyObject_HEAD + struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self; +}; + + +/* "spacy/vectors.pyx":745 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes { + PyObject_HEAD + struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self; +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; +/* #### Code section: utility_code_proto ### */ + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto (used by PyErrFetchRestore) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* TupleAndListFromArray.proto (used by fastcall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +#endif +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto (used by BytesEquals) */ +#include + +/* BytesEquals.proto (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i)) +#else + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i)) +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i]) + #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); + #else + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #endif +#else + #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS +#endif +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start) +#else +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* py_dict_items.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); + +/* CallCFunction.proto (used by CallUnboundCMethod0) */ +#define __Pyx_CallCFunction(cfunc, self, args)\ + ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args) +#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\ + ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs) +#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\ + ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs) +#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ + ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) + +/* PyObjectCall.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto (used by PyObjectCallOneArg) */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); + +/* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ +typedef struct { + PyObject *type; + PyObject **method_name; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS + __pyx_atomic_int_type initialized; +#endif + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) { +#if !CYTHON_ATOMICS + return 1; +#else + __pyx_nonatomic_int_type expected = 0; + if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) { + return 0; + } + return expected; +#endif +} +static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) { +#if CYTHON_ATOMICS + __pyx_atomic_store(&cfunc->initialized, 2); +#endif +} +#else +#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2 +#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc) +#endif + +/* CallUnboundCMethod0.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#else +#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) +#endif + +/* py_dict_values.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); + +/* OwnedDictNext.proto (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue); +#else +CYTHON_INLINE +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue); +#endif + +/* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywordsImpl.export */ +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name +); +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* CallUnboundCMethod2.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); +#else +#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) +#endif + +/* ParseKeywords.proto */ +static CYTHON_INLINE int __Pyx_ParseKeywords( + PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[], + PyObject *kwds2, PyObject *values[], + Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* PyObjectFastCallMethod.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) +#else +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); +#endif + +/* PyTypeError_Check.proto */ +#define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) + +/* PyDictVersioning.proto (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* PyObjectVectorCallKwBuilder.proto (used by PyObjectVectorCallMethodKwBuilder) */ +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#if CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall +#endif +#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict +#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) +#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) +#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) +#endif + +/* PyObjectVectorCallMethodKwBuilder.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod +#else +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#endif + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* PyNotImplementedError_Check.proto */ +#define __Pyx_PyExc_NotImplementedError_Check(obj) __Pyx_TypeCheck(obj, PyExc_NotImplementedError) + +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); + +/* KeywordStringCheck.proto */ +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(const char* function_name, PyObject *kw); + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + +/* dict_setdefault.proto (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); + +/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp); +#endif + +/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v); +#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v) + +/* FixUpExtensionType.proto (used by FetchCommonType) */ +static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); + +/* AddModuleRef.proto (used by FetchSharedCythonModule) */ +#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ + __PYX_LIMITED_VERSION_HEX < 0x030d0000) + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); +#else + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#endif + +/* FetchSharedCythonModule.proto (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto (used by CommonTypesMetaclass) */ +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases); + +/* CommonTypesMetaclass.proto (used by CythonFunctionShared) */ +static int __pyx_CommonTypesMetaclass_init(PyObject *module); +#define __Pyx_CommonTypesMetaclass_USED + +/* CallTypeTraverse.proto (used by CythonFunctionShared) */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0 +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg); +#endif + +/* PyMethodNew.proto (used by CythonFunctionShared) */ +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ); + +/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto (used by CythonFunction) */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_dict; +#endif + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + PyObject *defaults; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#undef __Pyx_CyOrPyCFunction_Check +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType) +#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType) +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)); +#undef __Pyx_IsSameCFunction +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, + PyTypeObject *defaults_type); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* PyValueError_Check.proto */ +#define __Pyx_PyExc_ValueError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ValueError) + +/* PyObject_Unicode.proto */ +#define __Pyx_PyObject_Unicode(obj)\ + (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* PyRange_Check.proto */ +#if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check) + #define PyRange_Check(obj) __Pyx_TypeCheck((obj), &PyRange_Type) +#endif + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* MoveIfSupported.proto */ +#if CYTHON_USE_CPP_STD_MOVE + #include + #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x) +#else + #define __PYX_STD_MOVE_IF_SUPPORTED(x) x +#endif + +/* PyLongBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) +#endif + +/* PyKeyError_Check.proto */ +#define __Pyx_PyExc_KeyError_Check(obj) __Pyx_TypeCheck(obj, PyExc_KeyError) + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* GetTopmostException.proto (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto (used by CoroutineBase) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* SwapException.proto (used by CoroutineBase) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* IterNextPlain.proto (used by CoroutineBase) */ +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void); +#endif + +/* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectGetMethod.proto (used by PyObjectCallMethod1) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); +#endif + +/* PyObjectCallMethod1.proto (used by CoroutineBase) */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* PyObjectCallNoArg.proto (used by CoroutineBase) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* ReturnWithStopIteration.proto (used by CoroutineBase) */ +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext); + +/* CoroutineBase.proto (used by Generator) */ +struct __pyx_CoroutineObject; +typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_ExcInfoStruct _PyErr_StackItem +#else +typedef struct { + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; +} __Pyx_ExcInfoStruct; +#endif +typedef struct __pyx_CoroutineObject { + PyObject_HEAD + __pyx_coroutine_body_t body; + PyObject *closure; + __Pyx_ExcInfoStruct gi_exc_state; +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *gi_weakreflist; +#endif + PyObject *classobj; + PyObject *yieldfrom; + __Pyx_pyiter_sendfunc yieldfrom_am_send; + PyObject *gi_name; + PyObject *gi_qualname; + PyObject *gi_modulename; + PyObject *gi_code; + PyObject *gi_frame; +#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE) + PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count]; + uint64_t __pyx_pymonitoring_version; +#endif + int resume_label; + char is_running; +} __pyx_CoroutineObject; +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); +static int __Pyx_Coroutine_clear(PyObject *self); +static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval); +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); +static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval); +static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_Coroutine_SwapException(self) +#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) +#else +#define __Pyx_Coroutine_SwapException(self) {\ + __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ + __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ + } +#define __Pyx_Coroutine_ResetAndClearException(self) {\ + __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ + (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ + } +#endif +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) +#endif +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen); +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen); +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen); +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure); +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send); +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg); + +/* Generator.proto (used by GeneratorYieldFrom) */ +#define __Pyx_Generator_USED +#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType) +#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\ + __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name) +static PyObject *__Pyx_Generator_Next(PyObject *self); +static int __pyx_Generator_init(PyObject *module); +static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self); + +/* GeneratorYieldFrom.proto */ +static CYTHON_INLINE __Pyx_PySendResult __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval); + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + L->ob_item[len] = x; + #else + PyList_SET_ITEM(list, len, x); + #endif + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +/* RaiseUnboundLocalError.proto */ +static void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* PyLongCompare.proto */ +static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* ListCompAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + L->ob_item[len] = x; + #else + PyList_SET_ITEM(list, len, x); + #endif + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +/* DictGetItem.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); +#define __Pyx_PyObject_Dict_GetItem(obj, name)\ + (likely(PyDict_CheckExact(obj)) ?\ + __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) +#else +#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) +#endif + +/* ArgTypeTestFunc.export */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) + +/* SliceTupleAndList.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); +#else +#define __Pyx_PyList_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop) +#define __Pyx_PyTuple_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop) +#endif + +/* UnicodeConcatInPlace.proto */ +# if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_REFNANNY + #define __Pyx_PyUnicode_ConcatInPlace(left, right, unsafe_shared) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, unsafe_shared, __pyx_refnanny) + #else + #define __Pyx_PyUnicode_ConcatInPlace(left, right, unsafe_shared) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, unsafe_shared) + #endif + #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_DefinitelyUnique) + #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_OwnStrongReference) + #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_DefinitelyUnique) + #define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace(left, right) __Pyx_PyUnicode_ConcatInPlace(left, right, __Pyx_ReferenceSharing_SharedReference) + static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right, int unsafe_shared + #if CYTHON_REFNANNY + , void* __pyx_refnanny + #endif + ); +#else +#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace __Pyx_PyUnicode_Concat +#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace __Pyx_PyUnicode_Concat +#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace __Pyx_PyUnicode_Concat +#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace __Pyx_PyUnicode_Concat +#endif +#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlaceSafe(left, right)\ + ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\ + PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_DefinitelyUniqueInPlace(left, right)) +#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(left, right)\ + ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\ + PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlace(left, right)) +#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlaceSafe(left, right)\ + ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\ + PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_FunctionArgumentInPlace(left, right)) +#define __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlaceSafe(left, right)\ + ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\ + PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_SharedReferenceInPlace(left, right)) + +/* PyUnicode_Substring.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring( + PyObject* text, Py_ssize_t start, Py_ssize_t stop); + +/* PyLongCompare.proto */ +static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* append.proto */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); + +/* PyLongCompare.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* SliceObject.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +/* SliceObject.proto */ +#define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\ + __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound) +static CYTHON_INLINE int __Pyx_PyObject_SetSlice( + PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +/* PyDictContains.proto */ +static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* PyObjectLookupSpecial.proto */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0) +#define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1) +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error); +#else +#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n) +#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) +#endif + +/* RaiseClosureNameError.proto */ +static void __Pyx_RaiseClosureNameError(const char *varname); + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* HasAttr.proto */ +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n) +#else +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +#endif + +/* pyfrozenset_new.proto (used by PySetContains) */ +static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it); + +/* PySetContains.proto */ +static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq); + +/* AllocateExtensionType.proto */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); + +/* DefaultPlacementNew.proto */ +#include +template +void __Pyx_default_placement_construct(T* x) { + new (static_cast(x)) T(); +} + +/* CallNextTpTraverse.proto */ +static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse); + +/* CallNextTpClear.proto */ +static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear); + +/* CheckTypeForFreelists.proto */ +#if CYTHON_USE_FREELISTS +#if CYTHON_USE_TYPE_SPECS +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT +#else +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE) +#endif +#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\ + (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\ + (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS))) +#endif + +/* PyObjectCallMethod0.proto (used by PyType_Ready) */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto (used by PyType_Ready) */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + +/* DelItemOnTypeDict.proto (used by SetupReduce) */ +static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k); +#define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k) + +/* SetupReduce.proto */ +static int __Pyx_setup_reduce(PyObject* type_obj); + +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* ImportImpl.export */ +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); + +/* Import.proto */ +static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* Py3UpdateBases.proto */ +static PyObject* __Pyx_PEP560_update_bases(PyObject *bases); + +/* CalculateMetaclass.proto */ +static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); + +/* SetNameInClass.proto */ +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 +#define __Pyx_SetNameInClass(ns, name, value)\ + (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value)) +#elif CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_SetNameInClass(ns, name, value)\ + (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value)) +#else +#define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value) +#endif + +/* ClassMethod.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +#include "descrobject.h" +#endif +CYTHON_UNUSED static PyObject* __Pyx_Method_ClassMethod(PyObject *method); + +/* Py3ClassCreate.proto */ +static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, + PyObject *mkw, PyObject *modname, PyObject *doc); +static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, + PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); + +/* CLineInTraceback.proto (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#else +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#endif + +/* CodeObjectCache.proto (used by AddTraceback) */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject __Pyx_CachedCodeObjectType; +#else +typedef PyCodeObject __Pyx_CachedCodeObjectType; +#endif +typedef struct { + __Pyx_CachedCodeObjectType* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_int_type accessor_count; + #endif +}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* CheckUnpickleChecksum.proto */ +static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members); + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint32_t __Pyx_PyLong_As_uint32_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE enum __pyx_t_5spacy_5attrs_attr_id_t __Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(enum __pyx_t_5spacy_5attrs_attr_id_t value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint32_t(uint32_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* UpdateUnpickledDict.proto */ +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index); + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#else +static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); +#endif +#else // !LIMITED_API +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { + return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); +} +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +#ifdef PyExceptionInstance_Check + #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) +#else + #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) +#endif + +/* GetRuntimeVersion.proto */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +static unsigned long __Pyx_cached_runtime_version = 0; +static void __Pyx_init_runtime_version(void); +#else +#define __Pyx_init_runtime_version() +#endif +static unsigned long __Pyx_get_runtime_version(void); + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); + +/* DecompressString.proto */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); + +/* MultiPhaseInitModuleState.proto */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +static PyObject *__Pyx_State_FindModule(void*); +static int __Pyx_State_AddModule(PyObject* module, void*); +static int __Pyx_State_RemoveModule(void*); +#elif CYTHON_USE_MODULE_STATE +#define __Pyx_State_FindModule PyState_FindModule +#define __Pyx_State_AddModule PyState_AddModule +#define __Pyx_State_RemoveModule PyState_RemoveModule +#endif + +/* #### Code section: module_declarations ### */ +/* CythonABIVersion.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API + #if CYTHON_METH_FASTCALL + #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" + #else + #define __PYX_FASTCALL_ABI_SUFFIX + #endif + #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#else + #define __PYX_LIMITED_ABI_SUFFIX +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + #define __PYX_AM_SEND_ABI_SUFFIX +#elif __PYX_HAS_PY_AM_SEND == 2 + #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" +#else + #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" +#endif +#ifndef __PYX_MONITORING_ABI_SUFFIX + #define __PYX_MONITORING_ABI_SUFFIX +#endif +#if CYTHON_USE_TP_FINALIZE + #define __PYX_TP_FINALIZE_ABI_SUFFIX +#else + #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" +#endif +#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) + #define __PYX_FREELISTS_ABI_SUFFIX +#else + #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" +#endif +#define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." + + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ +static void (*__pyx_f_10murmurhash_4mrmr_hash128_x64)(void const *, int, uint32_t, void *); /*proto*/ + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.attrs" */ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "preshed.maps" */ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "spacy.strings" */ + +/* Module declarations from "spacy.vectors" */ +static PyObject *__pyx_f_5spacy_7vectors___pyx_unpickle_BaseVectors__set_state(struct __pyx_obj_5spacy_7vectors_BaseVectors *, PyObject *); /*proto*/ +static std::set __pyx_convert_set_from_py_int(PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.vectors" +extern int __pyx_module_is_main_spacy__vectors; +int __pyx_module_is_main_spacy__vectors = 0; + +/* Implementation of "spacy.vectors" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_sum; +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static PyObject *__pyx_pf_5spacy_7vectors_unpickle_vectors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bytes_data); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_4Mode_values(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls); /* proto */ +static int __pyx_pf_5spacy_7vectors_11BaseVectors___init__(struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_strings); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_2__getitem__(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key); /* proto */ +static int __pyx_pf_5spacy_7vectors_11BaseVectors_4__contains__(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_6is_full(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_8get_batch(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_keys); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_5shape___get__(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_5spacy_7vectors_11BaseVectors_10__len__(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_14vectors_length___get__(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_4size___get__(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_12add(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_vector); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_14to_ops(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ops); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_16to_bytes(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_18from_bytes(struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_20to_disk(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_path, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_22from_disk(struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_path, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_24__reduce_cython__(struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_26__setstate_cython__(struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_19create_mode_vectors_vectors_factory(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vocab); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_2create_mode_vectors(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static int __pyx_pf_5spacy_7vectors_7Vectors___init__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_strings, PyObject *__pyx_v_shape, PyObject *__pyx_v_data, PyObject *__pyx_v_keys, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_minn, PyObject *__pyx_v_maxn, PyObject *__pyx_v_hash_count, PyObject *__pyx_v_hash_seed, PyObject *__pyx_v_bow, PyObject *__pyx_v_eow, PyObject *__pyx_v_attr); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_5shape___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4size___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_7is_full___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_6n_keys___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_2__reduce__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4__getitem__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static int __pyx_pf_5spacy_7vectors_7Vectors_6__setitem__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_vector); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_8__iter__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_5spacy_7vectors_7Vectors_11__len__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_7vectors_7Vectors_13__contains__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_15__eq__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_17resize(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_shape, PyObject *__pyx_v_inplace); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_19keys(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_21values(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_24items(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4find_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_27find(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_keys, PyObject *__pyx_v_row, PyObject *__pyx_v_rows); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_29_get_ngram_hashes(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_s); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_31_get_ngrams(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_9get_batch_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_33get_batch(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_keys); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_35add(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_vector, PyObject *__pyx_v_row); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_37most_similar(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_queries, PyObject *__pyx_v_batch_size, PyObject *__pyx_v_n, PyObject *__pyx_v_sort); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_39to_ops(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_ops); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_41_get_cfg(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_43_set_cfg(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_cfg); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_7to_disk_save_vectors(PyObject *__pyx_self, PyObject *__pyx_v_path); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, PyObject *__pyx_v_arr, PyObject *__pyx_v_file_); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_arr, PyObject *__pyx_v_file_); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda4(PyObject *__pyx_self, PyObject *__pyx_v_p); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda5(PyObject *__pyx_self, PyObject *__pyx_v_p); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda6(PyObject *__pyx_self, PyObject *__pyx_v_p); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda7(PyObject *__pyx_self, PyObject *__pyx_v_p); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_45to_disk(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_9from_disk_load_key2row(PyObject *__pyx_self, PyObject *__pyx_v_path); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_9from_disk_2load_keys(PyObject *__pyx_self, PyObject *__pyx_v_path); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_9from_disk_4load_vectors(PyObject *__pyx_self, PyObject *__pyx_v_path); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_9from_disk_6load_settings(PyObject *__pyx_self, PyObject *__pyx_v_path); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda8(PyObject *__pyx_self, PyObject *__pyx_v_p); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_47from_disk(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_8to_bytes_serialize_weights(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda9(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda10(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda11(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_49to_bytes(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_10from_bytes_deserialize_weights(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda12(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda13(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda14(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_51from_bytes(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_53clear(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_55_sync_unset(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_7strings___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_7vectors_7Vectors_7strings_2__set__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_7vectors_7Vectors_7strings_4__del__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4name___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_7vectors_7Vectors_4name_2__set__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_7vectors_7Vectors_4name_4__del__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4mode___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4data___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_7vectors_7Vectors_4data_2__set__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_7vectors_7Vectors_4data_4__del__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_7key2row___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_7vectors_7Vectors_7key2row_2__set__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_7vectors_7Vectors_7key2row_4__del__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4minn___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4maxn___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_10hash_count___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_9hash_seed___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_3bow___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_3eow___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4attr___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_7vectors_4__pyx_unpickle_BaseVectors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_5spacy_7vectors_BaseVectors(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_7vectors_Vectors(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_1_values(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_2_items(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_5_to_disk(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_6_from_disk(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_7_to_bytes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_8_from_bytes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +/* SmallCodeConfig */ +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyObject *__pyx_type_5spacy_7vectors_BaseVectors; + PyObject *__pyx_type_5spacy_7vectors_Vectors; + PyObject *__pyx_type_5spacy_7vectors___pyx_scope_struct____iter__; + PyObject *__pyx_type_5spacy_7vectors___pyx_scope_struct_1_values; + PyObject *__pyx_type_5spacy_7vectors___pyx_scope_struct_2_items; + PyObject *__pyx_type_5spacy_7vectors___pyx_scope_struct_3_genexpr; + PyObject *__pyx_type_5spacy_7vectors___pyx_scope_struct_4_genexpr; + PyObject *__pyx_type_5spacy_7vectors___pyx_scope_struct_5_to_disk; + PyObject *__pyx_type_5spacy_7vectors___pyx_scope_struct_6_from_disk; + PyObject *__pyx_type_5spacy_7vectors___pyx_scope_struct_7_to_bytes; + PyObject *__pyx_type_5spacy_7vectors___pyx_scope_struct_8_from_bytes; + PyTypeObject *__pyx_ptype_5spacy_7vectors_BaseVectors; + PyTypeObject *__pyx_ptype_5spacy_7vectors_Vectors; + PyTypeObject *__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__; + PyTypeObject *__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values; + PyTypeObject *__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items; + PyTypeObject *__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr; + PyTypeObject *__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr; + PyTypeObject *__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk; + PyTypeObject *__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk; + PyTypeObject *__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes; + PyTypeObject *__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + PyObject *__pyx_k__2; + PyObject *__pyx_k__5; + PyObject *__pyx_k__6; + PyObject *__pyx_k__7; + PyObject *__pyx_k__8; + PyObject *__pyx_slice[2]; + PyObject *__pyx_tuple[12]; + PyObject *__pyx_codeobj_tab[58]; + PyObject *__pyx_string_tab[410]; + PyObject *__pyx_number_tab[9]; +/* #### Code section: module_state_contents ### */ +/* CommonTypesMetaclass.module_state_decls */ +PyTypeObject *__pyx_CommonTypesMetaclassType; + +/* CachedMethodType.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API +PyObject *__Pyx_CachedMethodType; +#endif + +/* CythonFunctionShared.module_state_decls */ +PyTypeObject *__pyx_CyFunctionType; + +/* IterNextPlain.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache; +#endif + +/* Generator.module_state_decls */ +PyTypeObject *__pyx_GeneratorType; + + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__ *__pyx_freelist_5spacy_7vectors___pyx_scope_struct____iter__[8]; +int __pyx_freecount_5spacy_7vectors___pyx_scope_struct____iter__; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values *__pyx_freelist_5spacy_7vectors___pyx_scope_struct_1_values[8]; +int __pyx_freecount_5spacy_7vectors___pyx_scope_struct_1_values; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items *__pyx_freelist_5spacy_7vectors___pyx_scope_struct_2_items[8]; +int __pyx_freecount_5spacy_7vectors___pyx_scope_struct_2_items; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr *__pyx_freelist_5spacy_7vectors___pyx_scope_struct_3_genexpr[8]; +int __pyx_freecount_5spacy_7vectors___pyx_scope_struct_3_genexpr; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr *__pyx_freelist_5spacy_7vectors___pyx_scope_struct_4_genexpr[8]; +int __pyx_freecount_5spacy_7vectors___pyx_scope_struct_4_genexpr; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_freelist_5spacy_7vectors___pyx_scope_struct_5_to_disk[8]; +int __pyx_freecount_5spacy_7vectors___pyx_scope_struct_5_to_disk; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *__pyx_freelist_5spacy_7vectors___pyx_scope_struct_6_from_disk[8]; +int __pyx_freecount_5spacy_7vectors___pyx_scope_struct_6_from_disk; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *__pyx_freelist_5spacy_7vectors___pyx_scope_struct_7_to_bytes[8]; +int __pyx_freecount_5spacy_7vectors___pyx_scope_struct_7_to_bytes; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *__pyx_freelist_5spacy_7vectors___pyx_scope_struct_8_from_bytes[8]; +int __pyx_freecount_5spacy_7vectors___pyx_scope_struct_8_from_bytes; +#endif +/* CodeObjectCache.module_state_decls */ +struct __Pyx_CodeObjectCache __pyx_code_cache; + +/* #### Code section: module_state_end ### */ +} __pyx_mstatetype; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { +extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) + +#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstatetype __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: constant_name_defines ### */ +#define __pyx_kp_u_ __pyx_string_tab[0] +#define __pyx_kp_u_Callable_Vocab_BaseVectors __pyx_string_tab[1] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[2] +#define __pyx_kp_u_Union_str_Path __pyx_string_tab[3] +#define __pyx_kp_u_Use_Vectors_key_instead __pyx_string_tab[4] +#define __pyx_kp_u_Vectors___setitem __pyx_string_tab[5] +#define __pyx_kp_u_Vectors_add __pyx_string_tab[6] +#define __pyx_kp_u_Vectors_resize __pyx_string_tab[7] +#define __pyx_kp_u_Vocab __pyx_string_tab[8] +#define __pyx_kp_u__10 __pyx_string_tab[9] +#define __pyx_kp_u__3 __pyx_string_tab[10] +#define __pyx_kp_u__4 __pyx_string_tab[11] +#define __pyx_kp_u__9 __pyx_string_tab[12] +#define __pyx_kp_u_add_note __pyx_string_tab[13] +#define __pyx_kp_u_disable __pyx_string_tab[14] +#define __pyx_kp_u_enable __pyx_string_tab[15] +#define __pyx_kp_u_gc __pyx_string_tab[16] +#define __pyx_kp_u_isenabled __pyx_string_tab[17] +#define __pyx_kp_u_json __pyx_string_tab[18] +#define __pyx_kp_u_spacy __pyx_string_tab[19] +#define __pyx_kp_u_spacy_Vectors_v1 __pyx_string_tab[20] +#define __pyx_kp_u_spacy_attrs __pyx_string_tab[21] +#define __pyx_kp_u_spacy_enum __pyx_string_tab[22] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[23] +#define __pyx_kp_u_spacy_numpy __pyx_string_tab[24] +#define __pyx_kp_u_spacy_pathlib __pyx_string_tab[25] +#define __pyx_kp_u_spacy_srsly __pyx_string_tab[26] +#define __pyx_kp_u_spacy_strings __pyx_string_tab[27] +#define __pyx_kp_u_spacy_thinc_api __pyx_string_tab[28] +#define __pyx_kp_u_spacy_thinc_backends __pyx_string_tab[29] +#define __pyx_kp_u_spacy_thinc_types __pyx_string_tab[30] +#define __pyx_kp_u_spacy_typing __pyx_string_tab[31] +#define __pyx_kp_u_spacy_vectors_pyx __pyx_string_tab[32] +#define __pyx_kp_u_spacy_vocab __pyx_string_tab[33] +#define __pyx_kp_u_spacy_warnings __pyx_string_tab[34] +#define __pyx_kp_u_stringsource __pyx_string_tab[35] +#define __pyx_kp_u_vectors_cfg __pyx_string_tab[36] +#define __pyx_n_u_ __pyx_string_tab[37] +#define __pyx_n_u_BaseVectors __pyx_string_tab[38] +#define __pyx_n_u_BaseVectors___reduce_cython __pyx_string_tab[39] +#define __pyx_n_u_BaseVectors___setstate_cython __pyx_string_tab[40] +#define __pyx_n_u_BaseVectors_add __pyx_string_tab[41] +#define __pyx_n_u_BaseVectors_from_bytes __pyx_string_tab[42] +#define __pyx_n_u_BaseVectors_from_disk __pyx_string_tab[43] +#define __pyx_n_u_BaseVectors_get_batch __pyx_string_tab[44] +#define __pyx_n_u_BaseVectors_is_full __pyx_string_tab[45] +#define __pyx_n_u_BaseVectors_to_bytes __pyx_string_tab[46] +#define __pyx_n_u_BaseVectors_to_disk __pyx_string_tab[47] +#define __pyx_n_u_BaseVectors_to_ops __pyx_string_tab[48] +#define __pyx_n_u_Callable __pyx_string_tab[49] +#define __pyx_n_u_E058 __pyx_string_tab[50] +#define __pyx_n_u_E059 __pyx_string_tab[51] +#define __pyx_n_u_E060 __pyx_string_tab[52] +#define __pyx_n_u_E1046 __pyx_string_tab[53] +#define __pyx_n_u_E192 __pyx_string_tab[54] +#define __pyx_n_u_E193 __pyx_string_tab[55] +#define __pyx_n_u_E197 __pyx_string_tab[56] +#define __pyx_n_u_E198 __pyx_string_tab[57] +#define __pyx_n_u_E202 __pyx_string_tab[58] +#define __pyx_n_u_E858 __pyx_string_tab[59] +#define __pyx_n_u_E859 __pyx_string_tab[60] +#define __pyx_n_u_E861 __pyx_string_tab[61] +#define __pyx_n_u_E862 __pyx_string_tab[62] +#define __pyx_n_u_E863 __pyx_string_tab[63] +#define __pyx_n_u_E864 __pyx_string_tab[64] +#define __pyx_n_u_Enum __pyx_string_tab[65] +#define __pyx_n_u_Errors __pyx_string_tab[66] +#define __pyx_n_u_False __pyx_string_tab[67] +#define __pyx_n_u_Floats2d __pyx_string_tab[68] +#define __pyx_n_u_IDS __pyx_string_tab[69] +#define __pyx_n_u_Mode __pyx_string_tab[70] +#define __pyx_n_u_Mode_values __pyx_string_tab[71] +#define __pyx_n_u_ORTH __pyx_string_tab[72] +#define __pyx_n_u_Ops __pyx_string_tab[73] +#define __pyx_n_u_Path __pyx_string_tab[74] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[75] +#define __pyx_n_u_T __pyx_string_tab[76] +#define __pyx_n_u_TEXT __pyx_string_tab[77] +#define __pyx_n_u_TYPE_CHECKING __pyx_string_tab[78] +#define __pyx_n_u_Union __pyx_string_tab[79] +#define __pyx_n_u_Vectors __pyx_string_tab[80] +#define __pyx_n_u_Vectors___iter __pyx_string_tab[81] +#define __pyx_n_u_Vectors___reduce __pyx_string_tab[82] +#define __pyx_n_u_Vectors__get_cfg __pyx_string_tab[83] +#define __pyx_n_u_Vectors__get_ngram_hashes __pyx_string_tab[84] +#define __pyx_n_u_Vectors__get_ngrams __pyx_string_tab[85] +#define __pyx_n_u_Vectors__set_cfg __pyx_string_tab[86] +#define __pyx_n_u_Vectors__sync_unset __pyx_string_tab[87] +#define __pyx_n_u_Vectors_add __pyx_string_tab[88] +#define __pyx_n_u_Vectors_clear __pyx_string_tab[89] +#define __pyx_n_u_Vectors_find __pyx_string_tab[90] +#define __pyx_n_u_Vectors_from_bytes __pyx_string_tab[91] +#define __pyx_n_u_Vectors_from_disk __pyx_string_tab[92] +#define __pyx_n_u_Vectors_get_batch __pyx_string_tab[93] +#define __pyx_n_u_Vectors_items __pyx_string_tab[94] +#define __pyx_n_u_Vectors_keys __pyx_string_tab[95] +#define __pyx_n_u_Vectors_most_similar __pyx_string_tab[96] +#define __pyx_n_u_Vectors_resize __pyx_string_tab[97] +#define __pyx_n_u_Vectors_to_bytes __pyx_string_tab[98] +#define __pyx_n_u_Vectors_to_disk __pyx_string_tab[99] +#define __pyx_n_u_Vectors_to_ops __pyx_string_tab[100] +#define __pyx_n_u_Vectors_values __pyx_string_tab[101] +#define __pyx_n_u_Vocab_2 __pyx_string_tab[102] +#define __pyx_n_u_W115 __pyx_string_tab[103] +#define __pyx_n_u_Warnings __pyx_string_tab[104] +#define __pyx_n_u_a_max __pyx_string_tab[105] +#define __pyx_n_u_a_min __pyx_string_tab[106] +#define __pyx_n_u_add __pyx_string_tab[107] +#define __pyx_n_u_allow_pickle __pyx_string_tab[108] +#define __pyx_n_u_alternative __pyx_string_tab[109] +#define __pyx_n_u_append __pyx_string_tab[110] +#define __pyx_n_u_arange __pyx_string_tab[111] +#define __pyx_n_u_arg __pyx_string_tab[112] +#define __pyx_n_u_argpartition __pyx_string_tab[113] +#define __pyx_n_u_argsort __pyx_string_tab[114] +#define __pyx_n_u_around __pyx_string_tab[115] +#define __pyx_n_u_arr __pyx_string_tab[116] +#define __pyx_n_u_as_contig __pyx_string_tab[117] +#define __pyx_n_u_as_string __pyx_string_tab[118] +#define __pyx_n_u_asarray __pyx_string_tab[119] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[120] +#define __pyx_n_u_attr __pyx_string_tab[121] +#define __pyx_n_u_attrs __pyx_string_tab[122] +#define __pyx_n_u_axis __pyx_string_tab[123] +#define __pyx_n_u_b __pyx_string_tab[124] +#define __pyx_n_u_bad_kwargs __pyx_string_tab[125] +#define __pyx_n_u_batch __pyx_string_tab[126] +#define __pyx_n_u_batch_norms __pyx_string_tab[127] +#define __pyx_n_u_batch_size __pyx_string_tab[128] +#define __pyx_n_u_best_rows __pyx_string_tab[129] +#define __pyx_n_u_bow __pyx_string_tab[130] +#define __pyx_n_u_byte_order __pyx_string_tab[131] +#define __pyx_n_u_bytes __pyx_string_tab[132] +#define __pyx_n_u_bytes_data __pyx_string_tab[133] +#define __pyx_n_u_cast __pyx_string_tab[134] +#define __pyx_n_u_cfg __pyx_string_tab[135] +#define __pyx_n_u_chars __pyx_string_tab[136] +#define __pyx_n_u_class __pyx_string_tab[137] +#define __pyx_n_u_class_getitem __pyx_string_tab[138] +#define __pyx_n_u_clear __pyx_string_tab[139] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[140] +#define __pyx_n_u_clip __pyx_string_tab[141] +#define __pyx_n_u_close __pyx_string_tab[142] +#define __pyx_n_u_cls __pyx_string_tab[143] +#define __pyx_n_u_cls_name __pyx_string_tab[144] +#define __pyx_n_u_cols __pyx_string_tab[145] +#define __pyx_n_u_copy __pyx_string_tab[146] +#define __pyx_n_u_copy_shape __pyx_string_tab[147] +#define __pyx_n_u_create_mode_vectors __pyx_string_tab[148] +#define __pyx_n_u_create_mode_vectors_locals_vecto __pyx_string_tab[149] +#define __pyx_n_u_curr_dim __pyx_string_tab[150] +#define __pyx_n_u_data __pyx_string_tab[151] +#define __pyx_n_u_decimals __pyx_string_tab[152] +#define __pyx_n_u_default __pyx_string_tab[153] +#define __pyx_n_u_deserialize_weights __pyx_string_tab[154] +#define __pyx_n_u_deserializers __pyx_string_tab[155] +#define __pyx_n_u_dict __pyx_string_tab[156] +#define __pyx_n_u_dict_2 __pyx_string_tab[157] +#define __pyx_n_u_doc __pyx_string_tab[158] +#define __pyx_n_u_dot __pyx_string_tab[159] +#define __pyx_n_u_dtype __pyx_string_tab[160] +#define __pyx_n_u_enter __pyx_string_tab[161] +#define __pyx_n_u_enum __pyx_string_tab[162] +#define __pyx_n_u_enumerate __pyx_string_tab[163] +#define __pyx_n_u_eow __pyx_string_tab[164] +#define __pyx_n_u_errors __pyx_string_tab[165] +#define __pyx_n_u_exclude __pyx_string_tab[166] +#define __pyx_n_u_exists __pyx_string_tab[167] +#define __pyx_n_u_exit __pyx_string_tab[168] +#define __pyx_n_u_extend __pyx_string_tab[169] +#define __pyx_n_u_f __pyx_string_tab[170] +#define __pyx_n_u_file __pyx_string_tab[171] +#define __pyx_n_u_file_2 __pyx_string_tab[172] +#define __pyx_n_u_filled __pyx_string_tab[173] +#define __pyx_n_u_find __pyx_string_tab[174] +#define __pyx_n_u_find_locals_genexpr __pyx_string_tab[175] +#define __pyx_n_u_floret __pyx_string_tab[176] +#define __pyx_n_u_format __pyx_string_tab[177] +#define __pyx_n_u_from_bytes __pyx_string_tab[178] +#define __pyx_n_u_from_bytes_locals_deserialize_we __pyx_string_tab[179] +#define __pyx_n_u_from_bytes_locals_lambda __pyx_string_tab[180] +#define __pyx_n_u_from_disk __pyx_string_tab[181] +#define __pyx_n_u_from_disk_locals_lambda __pyx_string_tab[182] +#define __pyx_n_u_from_disk_locals_load_key2row __pyx_string_tab[183] +#define __pyx_n_u_from_disk_locals_load_keys __pyx_string_tab[184] +#define __pyx_n_u_from_disk_locals_load_settings __pyx_string_tab[185] +#define __pyx_n_u_from_disk_locals_load_vectors __pyx_string_tab[186] +#define __pyx_n_u_func __pyx_string_tab[187] +#define __pyx_n_u_genexpr __pyx_string_tab[188] +#define __pyx_n_u_get __pyx_string_tab[189] +#define __pyx_n_u_get_array_module __pyx_string_tab[190] +#define __pyx_n_u_get_array_ops __pyx_string_tab[191] +#define __pyx_n_u_get_batch __pyx_string_tab[192] +#define __pyx_n_u_get_batch_locals_genexpr __pyx_string_tab[193] +#define __pyx_n_u_get_cfg __pyx_string_tab[194] +#define __pyx_n_u_get_current_ops __pyx_string_tab[195] +#define __pyx_n_u_get_ngram_hashes __pyx_string_tab[196] +#define __pyx_n_u_get_ngrams __pyx_string_tab[197] +#define __pyx_n_u_get_string_id __pyx_string_tab[198] +#define __pyx_n_u_getstate __pyx_string_tab[199] +#define __pyx_n_u_h __pyx_string_tab[200] +#define __pyx_n_u_hash_count __pyx_string_tab[201] +#define __pyx_n_u_hash_seed __pyx_string_tab[202] +#define __pyx_n_u_i __pyx_string_tab[203] +#define __pyx_n_u_indices __pyx_string_tab[204] +#define __pyx_n_u_inplace __pyx_string_tab[205] +#define __pyx_n_u_int32 __pyx_string_tab[206] +#define __pyx_n_u_is_coroutine __pyx_string_tab[207] +#define __pyx_n_u_is_full __pyx_string_tab[208] +#define __pyx_n_u_items __pyx_string_tab[209] +#define __pyx_n_u_iter __pyx_string_tab[210] +#define __pyx_n_u_j __pyx_string_tab[211] +#define __pyx_n_u_json_dumps __pyx_string_tab[212] +#define __pyx_n_u_json_loads __pyx_string_tab[213] +#define __pyx_n_u_keepdims __pyx_string_tab[214] +#define __pyx_n_u_key __pyx_string_tab[215] +#define __pyx_n_u_key2row __pyx_string_tab[216] +#define __pyx_n_u_keys __pyx_string_tab[217] +#define __pyx_n_u_kwargs __pyx_string_tab[218] +#define __pyx_n_u_lambda __pyx_string_tab[219] +#define __pyx_n_u_lengths __pyx_string_tab[220] +#define __pyx_n_u_linalg __pyx_string_tab[221] +#define __pyx_n_u_load __pyx_string_tab[222] +#define __pyx_n_u_load_key2row __pyx_string_tab[223] +#define __pyx_n_u_load_keys __pyx_string_tab[224] +#define __pyx_n_u_load_settings __pyx_string_tab[225] +#define __pyx_n_u_load_vectors __pyx_string_tab[226] +#define __pyx_n_u_main __pyx_string_tab[227] +#define __pyx_n_u_maxn __pyx_string_tab[228] +#define __pyx_n_u_members __pyx_string_tab[229] +#define __pyx_n_u_metaclass __pyx_string_tab[230] +#define __pyx_n_u_method __pyx_string_tab[231] +#define __pyx_n_u_minn __pyx_string_tab[232] +#define __pyx_n_u_mode __pyx_string_tab[233] +#define __pyx_n_u_modes __pyx_string_tab[234] +#define __pyx_n_u_module __pyx_string_tab[235] +#define __pyx_n_u_most_similar __pyx_string_tab[236] +#define __pyx_n_u_mro_entries __pyx_string_tab[237] +#define __pyx_n_u_msgpack_dumps __pyx_string_tab[238] +#define __pyx_n_u_msgpack_loads __pyx_string_tab[239] +#define __pyx_n_u_n __pyx_string_tab[240] +#define __pyx_n_u_n_rows __pyx_string_tab[241] +#define __pyx_n_u_name __pyx_string_tab[242] +#define __pyx_n_u_name_2 __pyx_string_tab[243] +#define __pyx_n_u_ndindex __pyx_string_tab[244] +#define __pyx_n_u_new __pyx_string_tab[245] +#define __pyx_n_u_new_dim __pyx_string_tab[246] +#define __pyx_n_u_next __pyx_string_tab[247] +#define __pyx_n_u_ngram __pyx_string_tab[248] +#define __pyx_n_u_ngram_rows __pyx_string_tab[249] +#define __pyx_n_u_ngram_size __pyx_string_tab[250] +#define __pyx_n_u_ngrams __pyx_string_tab[251] +#define __pyx_n_u_norm __pyx_string_tab[252] +#define __pyx_n_u_norms __pyx_string_tab[253] +#define __pyx_n_u_numpy __pyx_string_tab[254] +#define __pyx_n_u_numpy_rows __pyx_string_tab[255] +#define __pyx_n_u_open __pyx_string_tab[256] +#define __pyx_n_u_ops __pyx_string_tab[257] +#define __pyx_n_u_out __pyx_string_tab[258] +#define __pyx_n_u_p __pyx_string_tab[259] +#define __pyx_n_u_partition __pyx_string_tab[260] +#define __pyx_n_u_path __pyx_string_tab[261] +#define __pyx_n_u_pathlib __pyx_string_tab[262] +#define __pyx_n_u_pop __pyx_string_tab[263] +#define __pyx_n_u_prepare __pyx_string_tab[264] +#define __pyx_n_u_pyx_checksum __pyx_string_tab[265] +#define __pyx_n_u_pyx_result __pyx_string_tab[266] +#define __pyx_n_u_pyx_state __pyx_string_tab[267] +#define __pyx_n_u_pyx_type __pyx_string_tab[268] +#define __pyx_n_u_pyx_unpickle_BaseVectors __pyx_string_tab[269] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[270] +#define __pyx_n_u_qualname __pyx_string_tab[271] +#define __pyx_n_u_queries __pyx_string_tab[272] +#define __pyx_n_u_read_json __pyx_string_tab[273] +#define __pyx_n_u_read_msgpack __pyx_string_tab[274] +#define __pyx_n_u_reduce __pyx_string_tab[275] +#define __pyx_n_u_reduce_cython __pyx_string_tab[276] +#define __pyx_n_u_reduce_ex __pyx_string_tab[277] +#define __pyx_n_u_reduce_mean __pyx_string_tab[278] +#define __pyx_n_u_refcheck __pyx_string_tab[279] +#define __pyx_n_u_registry __pyx_string_tab[280] +#define __pyx_n_u_removed_items __pyx_string_tab[281] +#define __pyx_n_u_resize __pyx_string_tab[282] +#define __pyx_n_u_resized_array __pyx_string_tab[283] +#define __pyx_n_u_results __pyx_string_tab[284] +#define __pyx_n_u_return __pyx_string_tab[285] +#define __pyx_n_u_row __pyx_string_tab[286] +#define __pyx_n_u_row2key __pyx_string_tab[287] +#define __pyx_n_u_row_index __pyx_string_tab[288] +#define __pyx_n_u_rows __pyx_string_tab[289] +#define __pyx_n_u_s __pyx_string_tab[290] +#define __pyx_n_u_save __pyx_string_tab[291] +#define __pyx_n_u_save_array __pyx_string_tab[292] +#define __pyx_n_u_save_vectors __pyx_string_tab[293] +#define __pyx_n_u_scores __pyx_string_tab[294] +#define __pyx_n_u_self __pyx_string_tab[295] +#define __pyx_n_u_send __pyx_string_tab[296] +#define __pyx_n_u_serialize_weights __pyx_string_tab[297] +#define __pyx_n_u_serializers __pyx_string_tab[298] +#define __pyx_n_u_set_cfg __pyx_string_tab[299] +#define __pyx_n_u_set_name __pyx_string_tab[300] +#define __pyx_n_u_setdefault __pyx_string_tab[301] +#define __pyx_n_u_setstate __pyx_string_tab[302] +#define __pyx_n_u_setstate_cython __pyx_string_tab[303] +#define __pyx_n_u_shape __pyx_string_tab[304] +#define __pyx_n_u_sims __pyx_string_tab[305] +#define __pyx_n_u_size __pyx_string_tab[306] +#define __pyx_n_u_sort __pyx_string_tab[307] +#define __pyx_n_u_sorted_index __pyx_string_tab[308] +#define __pyx_n_u_spacy_vectors __pyx_string_tab[309] +#define __pyx_n_u_srsly __pyx_string_tab[310] +#define __pyx_n_u_start __pyx_string_tab[311] +#define __pyx_n_u_state __pyx_string_tab[312] +#define __pyx_n_u_strings __pyx_string_tab[313] +#define __pyx_n_u_sum __pyx_string_tab[314] +#define __pyx_n_u_sync_unset __pyx_string_tab[315] +#define __pyx_n_u_test __pyx_string_tab[316] +#define __pyx_n_u_thinc_api __pyx_string_tab[317] +#define __pyx_n_u_thinc_backends __pyx_string_tab[318] +#define __pyx_n_u_thinc_types __pyx_string_tab[319] +#define __pyx_n_u_throw __pyx_string_tab[320] +#define __pyx_n_u_to_bytes __pyx_string_tab[321] +#define __pyx_n_u_to_bytes_locals_lambda __pyx_string_tab[322] +#define __pyx_n_u_to_bytes_locals_serialize_weight __pyx_string_tab[323] +#define __pyx_n_u_to_disk __pyx_string_tab[324] +#define __pyx_n_u_to_disk_locals_lambda __pyx_string_tab[325] +#define __pyx_n_u_to_disk_locals_save_vectors __pyx_string_tab[326] +#define __pyx_n_u_to_numpy __pyx_string_tab[327] +#define __pyx_n_u_to_ops __pyx_string_tab[328] +#define __pyx_n_u_typing __pyx_string_tab[329] +#define __pyx_n_u_uint64 __pyx_string_tab[330] +#define __pyx_n_u_unique_keys __pyx_string_tab[331] +#define __pyx_n_u_unpickle_vectors __pyx_string_tab[332] +#define __pyx_n_u_update __pyx_string_tab[333] +#define __pyx_n_u_upper __pyx_string_tab[334] +#define __pyx_n_u_use_setstate __pyx_string_tab[335] +#define __pyx_n_u_utf8_string __pyx_string_tab[336] +#define __pyx_n_u_util __pyx_string_tab[337] +#define __pyx_n_u_value __pyx_string_tab[338] +#define __pyx_n_u_values __pyx_string_tab[339] +#define __pyx_n_u_vecs __pyx_string_tab[340] +#define __pyx_n_u_vector __pyx_string_tab[341] +#define __pyx_n_u_vectors __pyx_string_tab[342] +#define __pyx_n_u_vectors_factory __pyx_string_tab[343] +#define __pyx_n_u_vocab __pyx_string_tab[344] +#define __pyx_n_u_warn __pyx_string_tab[345] +#define __pyx_n_u_warnings __pyx_string_tab[346] +#define __pyx_n_u_wb __pyx_string_tab[347] +#define __pyx_n_u_with_suffix __pyx_string_tab[348] +#define __pyx_n_u_write_json __pyx_string_tab[349] +#define __pyx_n_u_write_msgpack __pyx_string_tab[350] +#define __pyx_n_u_xp __pyx_string_tab[351] +#define __pyx_n_u_zeros __pyx_string_tab[352] +#define __pyx_kp_b_ __pyx_string_tab[353] +#define __pyx_kp_b_iso88591_1 __pyx_string_tab[354] +#define __pyx_kp_b_iso88591_1_1 __pyx_string_tab[355] +#define __pyx_kp_b_iso88591_1_4vS_A_E_wawa_A_c_q_4wa_Qa_4s __pyx_string_tab[356] +#define __pyx_kp_b_iso88591_1_waxuA __pyx_string_tab[357] +#define __pyx_kp_b_iso88591_2_4vS_A_AV5_q_T_A_Qd_q_AQd_gT_3 __pyx_string_tab[358] +#define __pyx_kp_b_iso88591_7_Kq __pyx_string_tab[359] +#define __pyx_kp_b_iso88591_85_1D __pyx_string_tab[360] +#define __pyx_kp_b_iso88591_A __pyx_string_tab[361] +#define __pyx_kp_b_iso88591_A_1M_AXT_Qa_q_q_2Q_q_3a_q_2Q_q_3 __pyx_string_tab[362] +#define __pyx_kp_b_iso88591_A_4vS_A_AT_q_s_a_AT_q_A_A_d_T_t1 __pyx_string_tab[363] +#define __pyx_kp_b_iso88591_A_4vS_A_AV1_Kq_L __pyx_string_tab[364] +#define __pyx_kp_b_iso88591_A_4vS_A_E_wawa_A_Qd_1_uAS_4uF_1 __pyx_string_tab[365] +#define __pyx_kp_b_iso88591_A_4y __pyx_string_tab[366] +#define __pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_D_7_D_1 __pyx_string_tab[367] +#define __pyx_kp_b_iso88591_A_HD_D_Zq_HCt1HA_HCt1HA_N_T_M_D __pyx_string_tab[368] +#define __pyx_kp_b_iso88591_A_a __pyx_string_tab[369] +#define __pyx_kp_b_iso88591_A_d_XWA_E_4t7_q_E_q_CtSZZ __pyx_string_tab[370] +#define __pyx_kp_b_iso88591_A_d_r_Rt1_r_q_e1A_e1D_t6_1_as_Qe __pyx_string_tab[371] +#define __pyx_kp_b_iso88591_A_m1D_4vS_A_4uAU_4uAQ_s_a_1D_5_G __pyx_string_tab[372] +#define __pyx_kp_b_iso88591_A_q __pyx_string_tab[373] +#define __pyx_kp_b_iso88591_A_q_2 __pyx_string_tab[374] +#define __pyx_kp_b_iso88591_A_t1C_5 __pyx_string_tab[375] +#define __pyx_kp_b_iso88591_A_t85 __pyx_string_tab[376] +#define __pyx_kp_b_iso88591_Be1G1 __pyx_string_tab[377] +#define __pyx_kp_b_iso88591_Be1G5_Q __pyx_string_tab[378] +#define __pyx_kp_b_iso88591_HCxq_A __pyx_string_tab[379] +#define __pyx_kp_b_iso88591_T_5_1A __pyx_string_tab[380] +#define __pyx_kp_b_iso88591_U_9A_3iq_G_fA __pyx_string_tab[381] +#define __pyx_kp_b_iso88591_U_Qc_Ya __pyx_string_tab[382] +#define __pyx_kp_b_iso88591_Z_4vS_A_A_e7_Q_3e_c_hfG5_AV5_q __pyx_string_tab[383] +#define __pyx_kp_b_iso88591__11 __pyx_string_tab[384] +#define __pyx_kp_b_iso88591__12 __pyx_string_tab[385] +#define __pyx_kp_b_iso88591_a __pyx_string_tab[386] +#define __pyx_kp_b_iso88591_a_2 __pyx_string_tab[387] +#define __pyx_kp_b_iso88591_a_q __pyx_string_tab[388] +#define __pyx_kp_b_iso88591_a_q_q_A_q_1_Jav_L_q __pyx_string_tab[389] +#define __pyx_kp_b_iso88591_q_0_kQR_haq_7_QnN_1 __pyx_string_tab[390] +#define __pyx_kp_b_iso88591_q_q __pyx_string_tab[391] +#define __pyx_kp_b_iso88591_q_q_q_q_1_Kq_oQ_L_q __pyx_string_tab[392] +#define __pyx_kp_b_iso88591_q_q_q_q_1_t9A __pyx_string_tab[393] +#define __pyx_kp_b_iso88591_t7_HCs_q_1A_q __pyx_string_tab[394] +#define __pyx_kp_b_iso88591_t7_IQe_Qa __pyx_string_tab[395] +#define __pyx_kp_b_iso88591_t7_KuM_WD_a_4wfAQ_vQd_aq __pyx_string_tab[396] +#define __pyx_kp_b_iso88591_t7_uE_Qa_Cwiq_AU_a __pyx_string_tab[397] +#define __pyx_kp_b_iso88591_uA_Qd_3c_q_q_q_1_t81F_q __pyx_string_tab[398] +#define __pyx_kp_b_iso88591_wat7_E_A_Qd_HBhauN_1_oQ_G1A __pyx_string_tab[399] +#define __pyx_kp_b_iso88591_wat7_t5_oQ_uN_3iq_G_a __pyx_string_tab[400] +#define __pyx_kp_b_iso88591_xt89A __pyx_string_tab[401] +#define __pyx_kp_b_iso88591_xuN_4q __pyx_string_tab[402] +#define __pyx_kp_b_iso88591_z_Qa __pyx_string_tab[403] +#define __pyx_kp_b_iso88591_z_X __pyx_string_tab[404] +#define __pyx_kp_b_iso88591_z_XWAU __pyx_string_tab[405] +#define __pyx_kp_b_iso88591_z_XXQa_1A __pyx_string_tab[406] +#define __pyx_kp_b_iso88591_z_XZq_Qa __pyx_string_tab[407] +#define __pyx_kp_b_iso88591_z_nAS_A __pyx_string_tab[408] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_void __pyx_string_tab[409] +#define __pyx_int_0 __pyx_number_tab[0] +#define __pyx_int_neg_1 __pyx_number_tab[1] +#define __pyx_int_1 __pyx_number_tab[2] +#define __pyx_int_2 __pyx_number_tab[3] +#define __pyx_int_3 __pyx_number_tab[4] +#define __pyx_int_4 __pyx_number_tab[5] +#define __pyx_int_5 __pyx_number_tab[6] +#define __pyx_int_1024 __pyx_number_tab[7] +#define __pyx_int_238750788 __pyx_number_tab[8] +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { + __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #if CYTHON_PEP489_MULTI_PHASE_INIT + __Pyx_State_RemoveModule(NULL); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7vectors_BaseVectors); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7vectors_BaseVectors); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7vectors_Vectors); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7vectors_Vectors); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct____iter__); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_1_values); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_2_items); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_3_genexpr); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_4_genexpr); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_5_to_disk); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_6_from_disk); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_7_to_bytes); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_8_from_bytes); + Py_CLEAR(clear_module_state->__pyx_k__2); + Py_CLEAR(clear_module_state->__pyx_k__5); + Py_CLEAR(clear_module_state->__pyx_k__6); + Py_CLEAR(clear_module_state->__pyx_k__7); + Py_CLEAR(clear_module_state->__pyx_k__8); + for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } + for (int i=0; i<12; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<58; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<410; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<9; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } +/* #### Code section: module_state_clear_contents ### */ +/* CommonTypesMetaclass.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + +/* Generator.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_GeneratorType); + +/* #### Code section: module_state_clear_end ### */ +return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7vectors_BaseVectors); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7vectors_BaseVectors); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7vectors_Vectors); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7vectors_Vectors); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct____iter__); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_1_values); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_2_items); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_3_genexpr); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_4_genexpr); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_5_to_disk); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_6_from_disk); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_7_to_bytes); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_7vectors___pyx_scope_struct_8_from_bytes); + Py_VISIT(traverse_module_state->__pyx_k__2); + Py_VISIT(traverse_module_state->__pyx_k__5); + Py_VISIT(traverse_module_state->__pyx_k__6); + Py_VISIT(traverse_module_state->__pyx_k__7); + Py_VISIT(traverse_module_state->__pyx_k__8); + for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } + for (int i=0; i<12; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<58; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<410; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<9; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } +/* #### Code section: module_state_traverse_contents ### */ +/* CommonTypesMetaclass.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + +/* Generator.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_GeneratorType); + +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "set.from_py":158 + * void insert(T&) except + + * + * @cname("__pyx_convert_set_from_py_int") # <<<<<<<<<<<<<< + * cdef set[X] __pyx_convert_set_from_py_int(object o) except *: + * cdef set[X] s +*/ + +static std::set __pyx_convert_set_from_py_int(PyObject *__pyx_v_o) { + std::set __pyx_v_s; + PyObject *__pyx_v_item = NULL; + std::set __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_set_from_py_int", 0); + + /* "set.from_py":161 + * cdef set[X] __pyx_convert_set_from_py_int(object o) except *: + * cdef set[X] s + * for item in o: # <<<<<<<<<<<<<< + * s.insert(item) + * return s +*/ + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 161, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 161, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 161, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 161, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 161, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); + __pyx_t_4 = 0; + + /* "set.from_py":162 + * cdef set[X] s + * for item in o: + * s.insert(item) # <<<<<<<<<<<<<< + * return s + * +*/ + __pyx_t_5 = __Pyx_PyLong_As_int(__pyx_v_item); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 162, __pyx_L1_error) + try { + __pyx_v_s.insert(((int)__pyx_t_5)); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(1, 162, __pyx_L1_error) + } + + /* "set.from_py":161 + * cdef set[X] __pyx_convert_set_from_py_int(object o) except *: + * cdef set[X] s + * for item in o: # <<<<<<<<<<<<<< + * s.insert(item) + * return s +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "set.from_py":163 + * for item in o: + * s.insert(item) + * return s # <<<<<<<<<<<<<< + * +*/ + __pyx_r = __pyx_v_s; + goto __pyx_L0; + + /* "set.from_py":158 + * void insert(T&) except + + * + * @cname("__pyx_convert_set_from_py_int") # <<<<<<<<<<<<<< + * cdef set[X] __pyx_convert_set_from_py_int(object o) except *: + * cdef set[X] s +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("set.from_py.__pyx_convert_set_from_py_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":32 + * + * + * def unpickle_vectors(bytes_data): # <<<<<<<<<<<<<< + * return Vectors().from_bytes(bytes_data) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_1unpickle_vectors(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_unpickle_vectors, "unpickle_vectors(bytes_data)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_1unpickle_vectors = {"unpickle_vectors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_1unpickle_vectors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_unpickle_vectors}; +static PyObject *__pyx_pw_5spacy_7vectors_1unpickle_vectors(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_bytes_data = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unpickle_vectors (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_bytes_data,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 32, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 32, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "unpickle_vectors", 0) < (0)) __PYX_ERR(0, 32, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("unpickle_vectors", 1, 1, 1, i); __PYX_ERR(0, 32, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 32, __pyx_L3_error) + } + __pyx_v_bytes_data = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unpickle_vectors", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 32, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.unpickle_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_unpickle_vectors(__pyx_self, __pyx_v_bytes_data); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_unpickle_vectors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bytes_data) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unpickle_vectors", 0); + + /* "spacy/vectors.pyx":33 + * + * def unpickle_vectors(bytes_data): + * return Vectors().from_bytes(bytes_data) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = NULL; + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + } + __pyx_t_2 = ((PyObject *)__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_bytes_data}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF((PyObject *)__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":32 + * + * + * def unpickle_vectors(bytes_data): # <<<<<<<<<<<<<< + * return Vectors().from_bytes(bytes_data) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.vectors.unpickle_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":40 + * floret = "floret" + * + * @classmethod # <<<<<<<<<<<<<< + * def values(cls): + * return list(cls.__members__.keys()) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_4Mode_1values(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_4Mode_values, "Mode.values(cls)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_4Mode_1values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_4Mode_1values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_4Mode_values}; +static PyObject *__pyx_pw_5spacy_7vectors_4Mode_1values(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_cls = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("values (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_cls,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 40, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 40, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "values", 0) < (0)) __PYX_ERR(0, 40, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("values", 1, 1, 1, i); __PYX_ERR(0, 40, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 40, __pyx_L3_error) + } + __pyx_v_cls = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("values", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 40, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Mode.values", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_4Mode_values(__pyx_self, __pyx_v_cls); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_4Mode_values(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("values", 0); + + /* "spacy/vectors.pyx":42 + * @classmethod + * def values(cls): + * return list(cls.__members__.keys()) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_mstate_global->__pyx_n_u_members); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_keys, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":40 + * floret = "floret" + * + * @classmethod # <<<<<<<<<<<<<< + * def values(cls): + * return list(cls.__members__.keys()) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.vectors.Mode.values", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":46 + * + * cdef class BaseVectors: + * def __init__(self, *, strings=None): # <<<<<<<<<<<<<< + * # Make sure abstract BaseVectors is not instantiated. + * if self.__class__ == BaseVectors: +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_11BaseVectors_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5spacy_7vectors_11BaseVectors_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED PyObject *__pyx_v_strings = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_strings,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 46, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 46, __pyx_L3_error) + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + } else if (unlikely(__pyx_nargs != 0)) { + goto __pyx_L5_argtuple_error; + } else { + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_strings = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); __PYX_ERR(0, 46, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.BaseVectors.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors___init__(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self), __pyx_v_strings); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_11BaseVectors___init__(struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_strings) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "spacy/vectors.pyx":48 + * def __init__(self, *, strings=None): + * # Make sure abstract BaseVectors is not instantiated. + * if self.__class__ == BaseVectors: # <<<<<<<<<<<<<< + * raise TypeError( + * Errors.E1046.format(cls_name=self.__class__.__name__) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_t_3)) { + + /* "spacy/vectors.pyx":49 + * # Make sure abstract BaseVectors is not instantiated. + * if self.__class__ == BaseVectors: + * raise TypeError( # <<<<<<<<<<<<<< + * Errors.E1046.format(cls_name=self.__class__.__name__) + * ) +*/ + __pyx_t_1 = NULL; + + /* "spacy/vectors.pyx":50 + * if self.__class__ == BaseVectors: + * raise TypeError( + * Errors.E1046.format(cls_name=self.__class__.__name__) # <<<<<<<<<<<<<< + * ) + * +*/ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_E1046); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_5 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, NULL}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_cls_name, __pyx_t_8, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_TypeError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 49, __pyx_L1_error) + + /* "spacy/vectors.pyx":48 + * def __init__(self, *, strings=None): + * # Make sure abstract BaseVectors is not instantiated. + * if self.__class__ == BaseVectors: # <<<<<<<<<<<<<< + * raise TypeError( + * Errors.E1046.format(cls_name=self.__class__.__name__) +*/ + } + + /* "spacy/vectors.pyx":46 + * + * cdef class BaseVectors: + * def __init__(self, *, strings=None): # <<<<<<<<<<<<<< + * # Make sure abstract BaseVectors is not instantiated. + * if self.__class__ == BaseVectors: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.vectors.BaseVectors.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":53 + * ) + * + * def __getitem__(self, key): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_2__getitem__(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_2__getitem__(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "spacy/vectors.pyx":54 + * + * def __getitem__(self, key): + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * def __contains__(self, key): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 54, __pyx_L1_error) + + /* "spacy/vectors.pyx":53 + * ) + * + * def __getitem__(self, key): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.BaseVectors.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":56 + * raise NotImplementedError + * + * def __contains__(self, key): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_11BaseVectors_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static int __pyx_pw_5spacy_7vectors_11BaseVectors_5__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_4__contains__(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_11BaseVectors_4__contains__(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key) { + int __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "spacy/vectors.pyx":57 + * + * def __contains__(self, key): + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * def is_full(self): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 57, __pyx_L1_error) + + /* "spacy/vectors.pyx":56 + * raise NotImplementedError + * + * def __contains__(self, key): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.BaseVectors.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + return __pyx_r; +} + +/* "spacy/vectors.pyx":59 + * raise NotImplementedError + * + * def is_full(self): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_7is_full(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_11BaseVectors_6is_full, "BaseVectors.is_full(self)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_11BaseVectors_7is_full = {"is_full", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_7is_full, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_6is_full}; +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_7is_full(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_full (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_full", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_full", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_6is_full(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_6is_full(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_full", 0); + + /* "spacy/vectors.pyx":60 + * + * def is_full(self): + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * def get_batch(self, keys): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 60, __pyx_L1_error) + + /* "spacy/vectors.pyx":59 + * raise NotImplementedError + * + * def is_full(self): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.BaseVectors.is_full", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":62 + * raise NotImplementedError + * + * def get_batch(self, keys): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_9get_batch(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_11BaseVectors_8get_batch, "BaseVectors.get_batch(self, keys)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_11BaseVectors_9get_batch = {"get_batch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_9get_batch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_8get_batch}; +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_9get_batch(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_keys = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_batch (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_keys,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 62, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 62, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_batch", 0) < (0)) __PYX_ERR(0, 62, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_batch", 1, 1, 1, i); __PYX_ERR(0, 62, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 62, __pyx_L3_error) + } + __pyx_v_keys = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_batch", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 62, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.BaseVectors.get_batch", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_8get_batch(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self), __pyx_v_keys); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_8get_batch(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_keys) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_batch", 0); + + /* "spacy/vectors.pyx":63 + * + * def get_batch(self, keys): + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 63, __pyx_L1_error) + + /* "spacy/vectors.pyx":62 + * raise NotImplementedError + * + * def get_batch(self, keys): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.BaseVectors.get_batch", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":65 + * raise NotImplementedError + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * raise NotImplementedError +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_5shape___get__(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_5shape___get__(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/vectors.pyx":67 + * @property + * def shape(self): + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 67, __pyx_L1_error) + + /* "spacy/vectors.pyx":65 + * raise NotImplementedError + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * raise NotImplementedError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.BaseVectors.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":69 + * raise NotImplementedError + * + * def __len__(self): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_5spacy_7vectors_11BaseVectors_11__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_5spacy_7vectors_11BaseVectors_11__len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_10__len__(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_pf_5spacy_7vectors_11BaseVectors_10__len__(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self) { + Py_ssize_t __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "spacy/vectors.pyx":70 + * + * def __len__(self): + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 70, __pyx_L1_error) + + /* "spacy/vectors.pyx":69 + * raise NotImplementedError + * + * def __len__(self): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.BaseVectors.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + return __pyx_r; +} + +/* "spacy/vectors.pyx":72 + * raise NotImplementedError + * + * @property # <<<<<<<<<<<<<< + * def vectors_length(self): + * raise NotImplementedError +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_14vectors_length_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_14vectors_length_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_14vectors_length___get__(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_14vectors_length___get__(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/vectors.pyx":74 + * @property + * def vectors_length(self): + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 74, __pyx_L1_error) + + /* "spacy/vectors.pyx":72 + * raise NotImplementedError + * + * @property # <<<<<<<<<<<<<< + * def vectors_length(self): + * raise NotImplementedError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.BaseVectors.vectors_length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":76 + * raise NotImplementedError + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * raise NotImplementedError +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_4size___get__(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_4size___get__(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/vectors.pyx":78 + * @property + * def size(self): + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * def add(self, key, *, vector=None): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 78, __pyx_L1_error) + + /* "spacy/vectors.pyx":76 + * raise NotImplementedError + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * raise NotImplementedError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.BaseVectors.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":80 + * raise NotImplementedError + * + * def add(self, key, *, vector=None): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_13add(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_11BaseVectors_12add, "BaseVectors.add(self, key, *, vector=None)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_11BaseVectors_13add = {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_13add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_12add}; +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_13add(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_key = 0; + CYTHON_UNUSED PyObject *__pyx_v_vector = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_vector,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 80, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 80, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "add", 0) < (0)) __PYX_ERR(0, 80, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, i); __PYX_ERR(0, 80, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 80, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_key = values[0]; + __pyx_v_vector = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 80, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.BaseVectors.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_12add(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self), __pyx_v_key, __pyx_v_vector); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_12add(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_key, CYTHON_UNUSED PyObject *__pyx_v_vector) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("add", 0); + + /* "spacy/vectors.pyx":81 + * + * def add(self, key, *, vector=None): + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * def to_ops(self, ops: Ops): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 81, __pyx_L1_error) + + /* "spacy/vectors.pyx":80 + * raise NotImplementedError + * + * def add(self, key, *, vector=None): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.BaseVectors.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":83 + * raise NotImplementedError + * + * def to_ops(self, ops: Ops): # <<<<<<<<<<<<<< + * pass + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_15to_ops(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_11BaseVectors_14to_ops, "BaseVectors.to_ops(self, ops: Ops)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_11BaseVectors_15to_ops = {"to_ops", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_15to_ops, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_14to_ops}; +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_15to_ops(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_ops = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_ops (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ops,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 83, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 83, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "to_ops", 0) < (0)) __PYX_ERR(0, 83, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("to_ops", 1, 1, 1, i); __PYX_ERR(0, 83, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 83, __pyx_L3_error) + } + __pyx_v_ops = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_ops", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 83, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.BaseVectors.to_ops", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_14to_ops(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self), __pyx_v_ops); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_14to_ops(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_ops) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_ops", 0); + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":88 + * # add dummy methods for to_bytes, from_bytes, to_disk and from_disk to + * # allow serialization + * def to_bytes(self, **kwargs): # <<<<<<<<<<<<<< + * return b"" + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_17to_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_11BaseVectors_16to_bytes, "BaseVectors.to_bytes(self, **kwargs)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_11BaseVectors_17to_bytes = {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_17to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_16to_bytes}; +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_17to_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_bytes (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_bytes", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (__pyx_kwds_len > 0) { + if (unlikely(__Pyx_CheckKeywordStrings("to_bytes", __pyx_kwds) == -1)) return NULL; + } + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_16to_bytes(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_16to_bytes(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_bytes", 0); + + /* "spacy/vectors.pyx":89 + * # allow serialization + * def to_bytes(self, **kwargs): + * return b"" # <<<<<<<<<<<<<< + * + * def from_bytes(self, data: bytes, **kwargs): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b_); + __pyx_r = __pyx_mstate_global->__pyx_kp_b_; + goto __pyx_L0; + + /* "spacy/vectors.pyx":88 + * # add dummy methods for to_bytes, from_bytes, to_disk and from_disk to + * # allow serialization + * def to_bytes(self, **kwargs): # <<<<<<<<<<<<<< + * return b"" + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":91 + * return b"" + * + * def from_bytes(self, data: bytes, **kwargs): # <<<<<<<<<<<<<< + * return self + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_19from_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_11BaseVectors_18from_bytes, "BaseVectors.from_bytes(self, data: bytes, **kwargs)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_11BaseVectors_19from_bytes = {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_19from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_18from_bytes}; +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_19from_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_data = 0; + CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_bytes (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 91, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 91, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "from_bytes", 1) < (0)) __PYX_ERR(0, 91, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_bytes", 1, 1, 1, i); __PYX_ERR(0, 91, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 91, __pyx_L3_error) + } + __pyx_v_data = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_bytes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 91, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_XDECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("spacy.vectors.BaseVectors.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_18from_bytes(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self), __pyx_v_data, __pyx_v_kwargs); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_18from_bytes(struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_bytes", 0); + + /* "spacy/vectors.pyx":92 + * + * def from_bytes(self, data: bytes, **kwargs): + * return self # <<<<<<<<<<<<<< + * + * def to_disk(self, path: Union[str, Path], **kwargs): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "spacy/vectors.pyx":91 + * return b"" + * + * def from_bytes(self, data: bytes, **kwargs): # <<<<<<<<<<<<<< + * return self + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":94 + * return self + * + * def to_disk(self, path: Union[str, Path], **kwargs): # <<<<<<<<<<<<<< + * return None + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_21to_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_11BaseVectors_20to_disk, "BaseVectors.to_disk(self, path: Union[str, Path], **kwargs)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_11BaseVectors_21to_disk = {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_21to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_20to_disk}; +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_21to_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_path = 0; + CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_disk (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 94, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 94, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "to_disk", 1) < (0)) __PYX_ERR(0, 94, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, i); __PYX_ERR(0, 94, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 94, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 94, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_XDECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("spacy.vectors.BaseVectors.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_20to_disk(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self), __pyx_v_path, __pyx_v_kwargs); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_20to_disk(CYTHON_UNUSED struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_path, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_disk", 0); + + /* "spacy/vectors.pyx":95 + * + * def to_disk(self, path: Union[str, Path], **kwargs): + * return None # <<<<<<<<<<<<<< + * + * def from_disk(self, path: Union[str, Path], **kwargs): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "spacy/vectors.pyx":94 + * return self + * + * def to_disk(self, path: Union[str, Path], **kwargs): # <<<<<<<<<<<<<< + * return None + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":97 + * return None + * + * def from_disk(self, path: Union[str, Path], **kwargs): # <<<<<<<<<<<<<< + * return self + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_23from_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_11BaseVectors_22from_disk, "BaseVectors.from_disk(self, path: Union[str, Path], **kwargs)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_11BaseVectors_23from_disk = {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_23from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_22from_disk}; +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_23from_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_path = 0; + CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_disk (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 97, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 97, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "from_disk", 1) < (0)) __PYX_ERR(0, 97, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_disk", 1, 1, 1, i); __PYX_ERR(0, 97, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 97, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 97, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_XDECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("spacy.vectors.BaseVectors.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_22from_disk(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self), __pyx_v_path, __pyx_v_kwargs); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_22from_disk(struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_path, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_disk", 0); + + /* "spacy/vectors.pyx":98 + * + * def from_disk(self, path: Union[str, Path], **kwargs): + * return self # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "spacy/vectors.pyx":97 + * return None + * + * def from_disk(self, path: Union[str, Path], **kwargs): # <<<<<<<<<<<<<< + * return self + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_25__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_11BaseVectors_24__reduce_cython__, "BaseVectors.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_11BaseVectors_25__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_25__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_24__reduce_cython__}; +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_25__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_24__reduce_cython__(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_24__reduce_cython__(struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_v_state = __pyx_mstate_global->__pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('False',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_BaseVectors, (type(self), 0xe3b0c44, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[0]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_BaseVectors, (type(self), 0xe3b0c44, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('False',) + * if use_setstate: + * return __pyx_unpickle_BaseVectors, (type(self), 0xe3b0c44, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_BaseVectors, (type(self), 0xe3b0c44, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_BaseVectors); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('False',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_BaseVectors, (type(self), 0xe3b0c44, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_BaseVectors, (type(self), 0xe3b0c44, None), state + * else: + * return __pyx_unpickle_BaseVectors, (type(self), 0xe3b0c44, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_BaseVectors__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_BaseVectors); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_238750788); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_238750788); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_238750788) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.vectors.BaseVectors.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_BaseVectors, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_BaseVectors__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_27__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_11BaseVectors_26__setstate_cython__, "BaseVectors.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_11BaseVectors_27__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_27__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_26__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_7vectors_11BaseVectors_27__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 16, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 16, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 16, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error) + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.BaseVectors.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_11BaseVectors_26__setstate_cython__(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_11BaseVectors_26__setstate_cython__(struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_BaseVectors, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_BaseVectors__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_7vectors___pyx_unpickle_BaseVectors__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_BaseVectors, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_BaseVectors__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vectors.BaseVectors.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":101 + * + * + * @util.registry.vectors("spacy.Vectors.v1") # <<<<<<<<<<<<<< + * def create_mode_vectors() -> Callable[["Vocab"], BaseVectors]: + * def vectors_factory(vocab: "Vocab") -> BaseVectors: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_3create_mode_vectors(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_2create_mode_vectors, "create_mode_vectors() -> Callable[['Vocab'], BaseVectors]"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_3create_mode_vectors = {"create_mode_vectors", (PyCFunction)__pyx_pw_5spacy_7vectors_3create_mode_vectors, METH_NOARGS, __pyx_doc_5spacy_7vectors_2create_mode_vectors}; +static PyObject *__pyx_pw_5spacy_7vectors_3create_mode_vectors(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("create_mode_vectors (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_2create_mode_vectors(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":103 + * @util.registry.vectors("spacy.Vectors.v1") + * def create_mode_vectors() -> Callable[["Vocab"], BaseVectors]: + * def vectors_factory(vocab: "Vocab") -> BaseVectors: # <<<<<<<<<<<<<< + * return Vectors(strings=vocab.strings) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_19create_mode_vectors_1vectors_factory(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_19create_mode_vectors_1vectors_factory = {"vectors_factory", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_19create_mode_vectors_1vectors_factory, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_19create_mode_vectors_1vectors_factory(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_vocab = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vectors_factory (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_vocab,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 103, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 103, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "vectors_factory", 0) < (0)) __PYX_ERR(0, 103, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("vectors_factory", 1, 1, 1, i); __PYX_ERR(0, 103, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 103, __pyx_L3_error) + } + __pyx_v_vocab = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("vectors_factory", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 103, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.create_mode_vectors.vectors_factory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_19create_mode_vectors_vectors_factory(__pyx_self, __pyx_v_vocab); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_19create_mode_vectors_vectors_factory(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vocab) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vectors_factory", 0); + + /* "spacy/vectors.pyx":104 + * def create_mode_vectors() -> Callable[["Vocab"], BaseVectors]: + * def vectors_factory(vocab: "Vocab") -> BaseVectors: + * return Vectors(strings=vocab.strings) # <<<<<<<<<<<<<< + * + * return vectors_factory +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_vocab, __pyx_mstate_global->__pyx_n_u_strings); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_strings, __pyx_t_3, __pyx_t_5, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":103 + * @util.registry.vectors("spacy.Vectors.v1") + * def create_mode_vectors() -> Callable[["Vocab"], BaseVectors]: + * def vectors_factory(vocab: "Vocab") -> BaseVectors: # <<<<<<<<<<<<<< + * return Vectors(strings=vocab.strings) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.vectors.create_mode_vectors.vectors_factory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":101 + * + * + * @util.registry.vectors("spacy.Vectors.v1") # <<<<<<<<<<<<<< + * def create_mode_vectors() -> Callable[["Vocab"], BaseVectors]: + * def vectors_factory(vocab: "Vocab") -> BaseVectors: +*/ + +static PyObject *__pyx_pf_5spacy_7vectors_2create_mode_vectors(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_v_vectors_factory = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_mode_vectors", 0); + + /* "spacy/vectors.pyx":103 + * @util.registry.vectors("spacy.Vectors.v1") + * def create_mode_vectors() -> Callable[["Vocab"], BaseVectors]: + * def vectors_factory(vocab: "Vocab") -> BaseVectors: # <<<<<<<<<<<<<< + * return Vectors(strings=vocab.strings) + * +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_vocab, __pyx_mstate_global->__pyx_kp_u_Vocab) < (0)) __PYX_ERR(0, 103, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_BaseVectors) < (0)) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_19create_mode_vectors_1vectors_factory, 0, __pyx_mstate_global->__pyx_n_u_create_mode_vectors_locals_vecto, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_vectors_factory = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":106 + * return Vectors(strings=vocab.strings) + * + * return vectors_factory # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_vectors_factory); + __pyx_r = __pyx_v_vectors_factory; + goto __pyx_L0; + + /* "spacy/vectors.pyx":101 + * + * + * @util.registry.vectors("spacy.Vectors.v1") # <<<<<<<<<<<<<< + * def create_mode_vectors() -> Callable[["Vocab"], BaseVectors]: + * def vectors_factory(vocab: "Vocab") -> BaseVectors: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vectors.create_mode_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_vectors_factory); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":140 + * cdef readonly attr_id_t attr + * + * def __init__(self, *, strings=None, shape=None, data=None, keys=None, name=None, mode=Mode.default, minn=0, maxn=0, hash_count=1, hash_seed=0, bow="<", eow=">", attr="ORTH"): # <<<<<<<<<<<<<< + * """Create a new vector store. + * +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_7Vectors_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors___init__, "Create a new vector store.\n\n strings (StringStore): The string store.\n shape (tuple): Size of the table, as (# entries, # columns)\n data (numpy.ndarray or cupy.ndarray): The vector data.\n keys (iterable): A sequence of keys, aligned with the data.\n name (str): A name to identify the vectors table.\n mode (str): Vectors mode: \"default\" or \"floret\" (default: \"default\").\n minn (int): The floret char ngram minn (default: 0).\n maxn (int): The floret char ngram maxn (default: 0).\n hash_count (int): The floret hash count (1-4, default: 1).\n hash_seed (int): The floret hash seed (default: 0).\n bow (str): The floret BOW string (default: \"<\").\n eow (str): The floret EOW string (default: \">\").\n attr (Union[int, str]): The token attribute for the vector keys\n (default: \"ORTH\").\n\n DOCS: https://spacy.io/api/vectors#init\n "); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_7vectors_7Vectors___init__; +#endif +static int __pyx_pw_5spacy_7vectors_7Vectors_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_strings = 0; + PyObject *__pyx_v_shape = 0; + PyObject *__pyx_v_data = 0; + PyObject *__pyx_v_keys = 0; + PyObject *__pyx_v_name = 0; + PyObject *__pyx_v_mode = 0; + PyObject *__pyx_v_minn = 0; + PyObject *__pyx_v_maxn = 0; + PyObject *__pyx_v_hash_count = 0; + PyObject *__pyx_v_hash_seed = 0; + PyObject *__pyx_v_bow = 0; + PyObject *__pyx_v_eow = 0; + PyObject *__pyx_v_attr = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_strings,&__pyx_mstate_global->__pyx_n_u_shape,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_keys,&__pyx_mstate_global->__pyx_n_u_name_2,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_minn,&__pyx_mstate_global->__pyx_n_u_maxn,&__pyx_mstate_global->__pyx_n_u_hash_count,&__pyx_mstate_global->__pyx_n_u_hash_seed,&__pyx_mstate_global->__pyx_n_u_bow,&__pyx_mstate_global->__pyx_n_u_eow,&__pyx_mstate_global->__pyx_n_u_attr,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 140, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 140, __pyx_L3_error) + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[5]) values[5] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__2); + if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0)); + if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0)); + if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1)); + if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0)); + if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3)); + if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__4)); + if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_ORTH)); + } else if (unlikely(__pyx_nargs != 0)) { + goto __pyx_L5_argtuple_error; + } else { + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[5]) values[5] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__2); + if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0)); + if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0)); + if (!values[8]) values[8] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1)); + if (!values[9]) values[9] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0)); + if (!values[10]) values[10] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__3)); + if (!values[11]) values[11] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_kp_u__4)); + if (!values[12]) values[12] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_ORTH)); + } + __pyx_v_strings = values[0]; + __pyx_v_shape = values[1]; + __pyx_v_data = values[2]; + __pyx_v_keys = values[3]; + __pyx_v_name = values[4]; + __pyx_v_mode = values[5]; + __pyx_v_minn = values[6]; + __pyx_v_maxn = values[7]; + __pyx_v_hash_count = values[8]; + __pyx_v_hash_seed = values[9]; + __pyx_v_bow = values[10]; + __pyx_v_eow = values[11]; + __pyx_v_attr = values[12]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); __PYX_ERR(0, 140, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors___init__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_strings, __pyx_v_shape, __pyx_v_data, __pyx_v_keys, __pyx_v_name, __pyx_v_mode, __pyx_v_minn, __pyx_v_maxn, __pyx_v_hash_count, __pyx_v_hash_seed, __pyx_v_bow, __pyx_v_eow, __pyx_v_attr); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_7Vectors___init__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_strings, PyObject *__pyx_v_shape, PyObject *__pyx_v_data, PyObject *__pyx_v_keys, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, PyObject *__pyx_v_minn, PyObject *__pyx_v_maxn, PyObject *__pyx_v_hash_count, PyObject *__pyx_v_hash_seed, PyObject *__pyx_v_bow, PyObject *__pyx_v_eow, PyObject *__pyx_v_attr) { + PyObject *__pyx_v_ops = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_7genexpr__pyx_v_i = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + uint32_t __pyx_t_12; + enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_t_13; + PyObject *(*__pyx_t_14)(PyObject *); + std::set __pyx_t_15; + std::set __pyx_t_16; + Py_ssize_t __pyx_t_17; + int __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_INCREF(__pyx_v_data); + __Pyx_INCREF(__pyx_v_attr); + + /* "spacy/vectors.pyx":160 + * DOCS: https://spacy.io/api/vectors#init + * """ + * self.strings = strings # <<<<<<<<<<<<<< + * if self.strings is None: + * self.strings = StringStore() +*/ + __Pyx_INCREF(__pyx_v_strings); + __Pyx_GIVEREF(__pyx_v_strings); + __Pyx_GOTREF(__pyx_v_self->strings); + __Pyx_DECREF(__pyx_v_self->strings); + __pyx_v_self->strings = __pyx_v_strings; + + /* "spacy/vectors.pyx":161 + * """ + * self.strings = strings + * if self.strings is None: # <<<<<<<<<<<<<< + * self.strings = StringStore() + * self.name = name +*/ + __pyx_t_1 = (__pyx_v_self->strings == Py_None); + if (__pyx_t_1) { + + /* "spacy/vectors.pyx":162 + * self.strings = strings + * if self.strings is None: + * self.strings = StringStore() # <<<<<<<<<<<<<< + * self.name = name + * if mode not in Mode.values(): +*/ + __pyx_t_3 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->strings); + __Pyx_DECREF(__pyx_v_self->strings); + __pyx_v_self->strings = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":161 + * """ + * self.strings = strings + * if self.strings is None: # <<<<<<<<<<<<<< + * self.strings = StringStore() + * self.name = name +*/ + } + + /* "spacy/vectors.pyx":163 + * if self.strings is None: + * self.strings = StringStore() + * self.name = name # <<<<<<<<<<<<<< + * if mode not in Mode.values(): + * raise ValueError( +*/ + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; + + /* "spacy/vectors.pyx":164 + * self.strings = StringStore() + * self.name = name + * if mode not in Mode.values(): # <<<<<<<<<<<<<< + * raise ValueError( + * Errors.E202.format( +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_values); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_mode, __pyx_t_2, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_t_1)) { + + /* "spacy/vectors.pyx":165 + * self.name = name + * if mode not in Mode.values(): + * raise ValueError( # <<<<<<<<<<<<<< + * Errors.E202.format( + * name="vectors", +*/ + __pyx_t_6 = NULL; + + /* "spacy/vectors.pyx":166 + * if mode not in Mode.values(): + * raise ValueError( + * Errors.E202.format( # <<<<<<<<<<<<<< + * name="vectors", + * mode=mode, +*/ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E202); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_5 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_5); + + /* "spacy/vectors.pyx":169 + * name="vectors", + * mode=mode, + * modes=str(Mode.values()) # <<<<<<<<<<<<<< + * ) + * ) +*/ + __pyx_t_9 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_values); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11); + assert(__pyx_t_9); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_11, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_11 = __Pyx_PyObject_Unicode(__pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_5, NULL}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name_2, __pyx_mstate_global->__pyx_n_u_vectors, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 166, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_v_mode, __pyx_t_7, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 166, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_modes, __pyx_t_11, __pyx_t_7, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 165, __pyx_L1_error) + + /* "spacy/vectors.pyx":164 + * self.strings = StringStore() + * self.name = name + * if mode not in Mode.values(): # <<<<<<<<<<<<<< + * raise ValueError( + * Errors.E202.format( +*/ + } + + /* "spacy/vectors.pyx":172 + * ) + * ) + * self.mode = Mode(mode).value # <<<<<<<<<<<<<< + * self.key2row = {} + * self.minn = minn +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_mode}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_t_6; + __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":173 + * ) + * self.mode = Mode(mode).value + * self.key2row = {} # <<<<<<<<<<<<<< + * self.minn = minn + * self.maxn = maxn +*/ + __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_v_self->key2row); + __Pyx_DECREF(__pyx_v_self->key2row); + __pyx_v_self->key2row = __pyx_t_6; + __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":174 + * self.mode = Mode(mode).value + * self.key2row = {} + * self.minn = minn # <<<<<<<<<<<<<< + * self.maxn = maxn + * self.hash_count = hash_count +*/ + __pyx_t_12 = __Pyx_PyLong_As_uint32_t(__pyx_v_minn); if (unlikely((__pyx_t_12 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_v_self->minn = __pyx_t_12; + + /* "spacy/vectors.pyx":175 + * self.key2row = {} + * self.minn = minn + * self.maxn = maxn # <<<<<<<<<<<<<< + * self.hash_count = hash_count + * self.hash_seed = hash_seed +*/ + __pyx_t_12 = __Pyx_PyLong_As_uint32_t(__pyx_v_maxn); if (unlikely((__pyx_t_12 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_v_self->maxn = __pyx_t_12; + + /* "spacy/vectors.pyx":176 + * self.minn = minn + * self.maxn = maxn + * self.hash_count = hash_count # <<<<<<<<<<<<<< + * self.hash_seed = hash_seed + * self.bow = bow +*/ + __pyx_t_12 = __Pyx_PyLong_As_uint32_t(__pyx_v_hash_count); if (unlikely((__pyx_t_12 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 176, __pyx_L1_error) + __pyx_v_self->hash_count = __pyx_t_12; + + /* "spacy/vectors.pyx":177 + * self.maxn = maxn + * self.hash_count = hash_count + * self.hash_seed = hash_seed # <<<<<<<<<<<<<< + * self.bow = bow + * self.eow = eow +*/ + __pyx_t_12 = __Pyx_PyLong_As_uint32_t(__pyx_v_hash_seed); if (unlikely((__pyx_t_12 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_v_self->hash_seed = __pyx_t_12; + + /* "spacy/vectors.pyx":178 + * self.hash_count = hash_count + * self.hash_seed = hash_seed + * self.bow = bow # <<<<<<<<<<<<<< + * self.eow = eow + * if isinstance(attr, int): +*/ + __pyx_t_6 = __pyx_v_bow; + __Pyx_INCREF(__pyx_t_6); + if (!(likely(PyUnicode_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_6))) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_v_self->bow); + __Pyx_DECREF(__pyx_v_self->bow); + __pyx_v_self->bow = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":179 + * self.hash_seed = hash_seed + * self.bow = bow + * self.eow = eow # <<<<<<<<<<<<<< + * if isinstance(attr, int): + * self.attr = attr +*/ + __pyx_t_6 = __pyx_v_eow; + __Pyx_INCREF(__pyx_t_6); + if (!(likely(PyUnicode_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_6))) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_v_self->eow); + __Pyx_DECREF(__pyx_v_self->eow); + __pyx_v_self->eow = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":180 + * self.bow = bow + * self.eow = eow + * if isinstance(attr, int): # <<<<<<<<<<<<<< + * self.attr = attr + * else: +*/ + __pyx_t_1 = PyLong_Check(__pyx_v_attr); + if (__pyx_t_1) { + + /* "spacy/vectors.pyx":181 + * self.eow = eow + * if isinstance(attr, int): + * self.attr = attr # <<<<<<<<<<<<<< + * else: + * attr = attr.upper() +*/ + __pyx_t_13 = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_v_attr)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_v_self->attr = __pyx_t_13; + + /* "spacy/vectors.pyx":180 + * self.bow = bow + * self.eow = eow + * if isinstance(attr, int): # <<<<<<<<<<<<<< + * self.attr = attr + * else: +*/ + goto __pyx_L5; + } + + /* "spacy/vectors.pyx":183 + * self.attr = attr + * else: + * attr = attr.upper() # <<<<<<<<<<<<<< + * if attr == "TEXT": + * attr = "ORTH" +*/ + /*else*/ { + __pyx_t_2 = __pyx_v_attr; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_attr, __pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":184 + * else: + * attr = attr.upper() + * if attr == "TEXT": # <<<<<<<<<<<<<< + * attr = "ORTH" + * self.attr = IDS.get(attr, ORTH) +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_attr, __pyx_mstate_global->__pyx_n_u_TEXT, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 184, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/vectors.pyx":185 + * attr = attr.upper() + * if attr == "TEXT": + * attr = "ORTH" # <<<<<<<<<<<<<< + * self.attr = IDS.get(attr, ORTH) + * +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ORTH); + __Pyx_DECREF_SET(__pyx_v_attr, __pyx_mstate_global->__pyx_n_u_ORTH); + + /* "spacy/vectors.pyx":184 + * else: + * attr = attr.upper() + * if attr == "TEXT": # <<<<<<<<<<<<<< + * attr = "ORTH" + * self.attr = IDS.get(attr, ORTH) +*/ + } + + /* "spacy/vectors.pyx":186 + * if attr == "TEXT": + * attr = "ORTH" + * self.attr = IDS.get(attr, ORTH) # <<<<<<<<<<<<<< + * + * if self.mode == Mode.default: +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_IDS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_ORTH); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_attr, __pyx_t_3}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_13 = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_t_6)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_self->attr = __pyx_t_13; + } + __pyx_L5:; + + /* "spacy/vectors.pyx":188 + * self.attr = IDS.get(attr, ORTH) + * + * if self.mode == Mode.default: # <<<<<<<<<<<<<< + * if data is None: + * if shape is None: +*/ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 188, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_default); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 188, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 188, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 188, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_1) { + + /* "spacy/vectors.pyx":189 + * + * if self.mode == Mode.default: + * if data is None: # <<<<<<<<<<<<<< + * if shape is None: + * shape = (0, 0) +*/ + __pyx_t_1 = (__pyx_v_data == Py_None); + if (__pyx_t_1) { + + /* "spacy/vectors.pyx":190 + * if self.mode == Mode.default: + * if data is None: + * if shape is None: # <<<<<<<<<<<<<< + * shape = (0, 0) + * ops = get_current_ops() +*/ + __pyx_t_1 = (__pyx_v_shape == Py_None); + if (__pyx_t_1) { + + /* "spacy/vectors.pyx":191 + * if data is None: + * if shape is None: + * shape = (0, 0) # <<<<<<<<<<<<<< + * ops = get_current_ops() + * data = ops.xp.zeros(shape, dtype="f") +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[1]); + __Pyx_DECREF_SET(__pyx_v_shape, __pyx_mstate_global->__pyx_tuple[1]); + + /* "spacy/vectors.pyx":190 + * if self.mode == Mode.default: + * if data is None: + * if shape is None: # <<<<<<<<<<<<<< + * shape = (0, 0) + * ops = get_current_ops() +*/ + } + + /* "spacy/vectors.pyx":192 + * if shape is None: + * shape = (0, 0) + * ops = get_current_ops() # <<<<<<<<<<<<<< + * data = ops.xp.zeros(shape, dtype="f") + * self._unset = cppset[int]({i for i in range(data.shape[0])}) +*/ + __pyx_t_8 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_current_ops); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_8); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_v_ops = __pyx_t_6; + __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":193 + * shape = (0, 0) + * ops = get_current_ops() + * data = ops.xp.zeros(shape, dtype="f") # <<<<<<<<<<<<<< + * self._unset = cppset[int]({i for i in range(data.shape[0])}) + * else: +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_ops, __pyx_mstate_global->__pyx_n_u_xp); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_v_shape}; + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_f, __pyx_t_2, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_zeros, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":194 + * ops = get_current_ops() + * data = ops.xp.zeros(shape, dtype="f") + * self._unset = cppset[int]({i for i in range(data.shape[0])}) # <<<<<<<<<<<<<< + * else: + * self._unset = cppset[int]() +*/ + { /* enter inner scope */ + __pyx_t_6 = PySet_New(NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 194, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_7}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 194, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_8); + } + __pyx_t_7 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 194, __pyx_L12_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + for (;;) { + { + __pyx_t_8 = __pyx_t_14(__pyx_t_7); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 194, __pyx_L12_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_i, __pyx_t_8); + __pyx_t_8 = 0; + if (unlikely(PySet_Add(__pyx_t_6, (PyObject*)__pyx_7genexpr__pyx_v_i))) __PYX_ERR(0, 194, __pyx_L12_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __pyx_7genexpr__pyx_v_i = 0; + goto __pyx_L16_exit_scope; + __pyx_L12_error:; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __pyx_7genexpr__pyx_v_i = 0; + goto __pyx_L1_error; + __pyx_L16_exit_scope:; + } /* exit inner scope */ + __pyx_t_15 = __pyx_convert_set_from_py_int(__pyx_t_6); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + try { + __pyx_t_16 = std::set (__pyx_t_15); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 194, __pyx_L1_error) + } + __pyx_v_self->_unset = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_16); + + /* "spacy/vectors.pyx":189 + * + * if self.mode == Mode.default: + * if data is None: # <<<<<<<<<<<<<< + * if shape is None: + * shape = (0, 0) +*/ + goto __pyx_L8; + } + + /* "spacy/vectors.pyx":196 + * self._unset = cppset[int]({i for i in range(data.shape[0])}) + * else: + * self._unset = cppset[int]() # <<<<<<<<<<<<<< + * self.data = data + * if keys is not None: +*/ + /*else*/ { + try { + __pyx_t_16 = std::set (); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 196, __pyx_L1_error) + } + __pyx_v_self->_unset = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_16); + } + __pyx_L8:; + + /* "spacy/vectors.pyx":197 + * else: + * self._unset = cppset[int]() + * self.data = data # <<<<<<<<<<<<<< + * if keys is not None: + * for i, key in enumerate(keys): +*/ + __Pyx_INCREF(__pyx_v_data); + __Pyx_GIVEREF(__pyx_v_data); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(__pyx_v_self->data); + __pyx_v_self->data = __pyx_v_data; + + /* "spacy/vectors.pyx":198 + * self._unset = cppset[int]() + * self.data = data + * if keys is not None: # <<<<<<<<<<<<<< + * for i, key in enumerate(keys): + * self.add(key, row=i) +*/ + __pyx_t_1 = (__pyx_v_keys != Py_None); + if (__pyx_t_1) { + + /* "spacy/vectors.pyx":199 + * self.data = data + * if keys is not None: + * for i, key in enumerate(keys): # <<<<<<<<<<<<<< + * self.add(key, row=i) + * elif self.mode == Mode.floret: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_6 = __pyx_mstate_global->__pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_keys)) || PyTuple_CheckExact(__pyx_v_keys)) { + __pyx_t_7 = __pyx_v_keys; __Pyx_INCREF(__pyx_t_7); + __pyx_t_17 = 0; + __pyx_t_14 = NULL; + } else { + __pyx_t_17 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_keys); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 199, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_14)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 199, __pyx_L1_error) + #endif + if (__pyx_t_17 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_17, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_17; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 199, __pyx_L1_error) + #endif + if (__pyx_t_17 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_17)); + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_17); + #endif + ++__pyx_t_17; + } + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 199, __pyx_L1_error) + } else { + __pyx_t_8 = __pyx_t_14(__pyx_t_7); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 199, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6); + __pyx_t_8 = __Pyx_PyLong_AddObjC(__pyx_t_6, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); + __pyx_t_6 = __pyx_t_8; + __pyx_t_8 = 0; + + /* "spacy/vectors.pyx":200 + * if keys is not None: + * for i, key in enumerate(keys): + * self.add(key, row=i) # <<<<<<<<<<<<<< + * elif self.mode == Mode.floret: + * if maxn < minn: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_key}; + __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_row, __pyx_v_i, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_8 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/vectors.pyx":199 + * self.data = data + * if keys is not None: + * for i, key in enumerate(keys): # <<<<<<<<<<<<<< + * self.add(key, row=i) + * elif self.mode == Mode.floret: +*/ + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":198 + * self._unset = cppset[int]() + * self.data = data + * if keys is not None: # <<<<<<<<<<<<<< + * for i, key in enumerate(keys): + * self.add(key, row=i) +*/ + } + + /* "spacy/vectors.pyx":188 + * self.attr = IDS.get(attr, ORTH) + * + * if self.mode == Mode.default: # <<<<<<<<<<<<<< + * if data is None: + * if shape is None: +*/ + goto __pyx_L7; + } + + /* "spacy/vectors.pyx":201 + * for i, key in enumerate(keys): + * self.add(key, row=i) + * elif self.mode == Mode.floret: # <<<<<<<<<<<<<< + * if maxn < minn: + * raise ValueError(Errors.E863) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_1) { + + /* "spacy/vectors.pyx":202 + * self.add(key, row=i) + * elif self.mode == Mode.floret: + * if maxn < minn: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E863) + * if hash_count < 1 or hash_count >= 5: +*/ + __pyx_t_6 = PyObject_RichCompare(__pyx_v_maxn, __pyx_v_minn, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(__pyx_t_1)) { + + /* "spacy/vectors.pyx":203 + * elif self.mode == Mode.floret: + * if maxn < minn: + * raise ValueError(Errors.E863) # <<<<<<<<<<<<<< + * if hash_count < 1 or hash_count >= 5: + * raise ValueError(Errors.E862) +*/ + __pyx_t_7 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_E863); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 203, __pyx_L1_error) + + /* "spacy/vectors.pyx":202 + * self.add(key, row=i) + * elif self.mode == Mode.floret: + * if maxn < minn: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E863) + * if hash_count < 1 or hash_count >= 5: +*/ + } + + /* "spacy/vectors.pyx":204 + * if maxn < minn: + * raise ValueError(Errors.E863) + * if hash_count < 1 or hash_count >= 5: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E862) + * if data is None: +*/ + __pyx_t_6 = PyObject_RichCompare(__pyx_v_hash_count, __pyx_mstate_global->__pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_18 < 0))) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!__pyx_t_18) { + } else { + __pyx_t_1 = __pyx_t_18; + goto __pyx_L23_bool_binop_done; + } + __pyx_t_6 = PyObject_RichCompare(__pyx_v_hash_count, __pyx_mstate_global->__pyx_int_5, Py_GE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_18 < 0))) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = __pyx_t_18; + __pyx_L23_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "spacy/vectors.pyx":205 + * raise ValueError(Errors.E863) + * if hash_count < 1 or hash_count >= 5: + * raise ValueError(Errors.E862) # <<<<<<<<<<<<<< + * if data is None: + * raise ValueError(Errors.E864) +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E862); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_8}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 205, __pyx_L1_error) + + /* "spacy/vectors.pyx":204 + * if maxn < minn: + * raise ValueError(Errors.E863) + * if hash_count < 1 or hash_count >= 5: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E862) + * if data is None: +*/ + } + + /* "spacy/vectors.pyx":206 + * if hash_count < 1 or hash_count >= 5: + * raise ValueError(Errors.E862) + * if data is None: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E864) + * if keys is not None: +*/ + __pyx_t_1 = (__pyx_v_data == Py_None); + if (unlikely(__pyx_t_1)) { + + /* "spacy/vectors.pyx":207 + * raise ValueError(Errors.E862) + * if data is None: + * raise ValueError(Errors.E864) # <<<<<<<<<<<<<< + * if keys is not None: + * raise ValueError(Errors.E861) +*/ + __pyx_t_8 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_E864); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_7}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 207, __pyx_L1_error) + + /* "spacy/vectors.pyx":206 + * if hash_count < 1 or hash_count >= 5: + * raise ValueError(Errors.E862) + * if data is None: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E864) + * if keys is not None: +*/ + } + + /* "spacy/vectors.pyx":208 + * if data is None: + * raise ValueError(Errors.E864) + * if keys is not None: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E861) + * self.data = data +*/ + __pyx_t_1 = (__pyx_v_keys != Py_None); + if (unlikely(__pyx_t_1)) { + + /* "spacy/vectors.pyx":209 + * raise ValueError(Errors.E864) + * if keys is not None: + * raise ValueError(Errors.E861) # <<<<<<<<<<<<<< + * self.data = data + * self._unset = cppset[int]() +*/ + __pyx_t_7 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_E861); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 209, __pyx_L1_error) + + /* "spacy/vectors.pyx":208 + * if data is None: + * raise ValueError(Errors.E864) + * if keys is not None: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E861) + * self.data = data +*/ + } + + /* "spacy/vectors.pyx":210 + * if keys is not None: + * raise ValueError(Errors.E861) + * self.data = data # <<<<<<<<<<<<<< + * self._unset = cppset[int]() + * +*/ + __Pyx_INCREF(__pyx_v_data); + __Pyx_GIVEREF(__pyx_v_data); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(__pyx_v_self->data); + __pyx_v_self->data = __pyx_v_data; + + /* "spacy/vectors.pyx":211 + * raise ValueError(Errors.E861) + * self.data = data + * self._unset = cppset[int]() # <<<<<<<<<<<<<< + * + * @property +*/ + try { + __pyx_t_16 = std::set (); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 211, __pyx_L1_error) + } + __pyx_v_self->_unset = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_16); + + /* "spacy/vectors.pyx":201 + * for i, key in enumerate(keys): + * self.add(key, row=i) + * elif self.mode == Mode.floret: # <<<<<<<<<<<<<< + * if maxn < minn: + * raise ValueError(Errors.E863) +*/ + } + __pyx_L7:; + + /* "spacy/vectors.pyx":140 + * cdef readonly attr_id_t attr + * + * def __init__(self, *, strings=None, shape=None, data=None, keys=None, name=None, mode=Mode.default, minn=0, maxn=0, hash_count=1, hash_seed=0, bow="<", eow=">", attr="ORTH"): # <<<<<<<<<<<<<< + * """Create a new vector store. + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.vectors.Vectors.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ops); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); + __Pyx_XDECREF(__pyx_v_shape); + __Pyx_XDECREF(__pyx_v_data); + __Pyx_XDECREF(__pyx_v_attr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":213 + * self._unset = cppset[int]() + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * """Get `(rows, dims)` tuples of number of rows and number of dimensions +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_5shape___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_5shape___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/vectors.pyx":222 + * DOCS: https://spacy.io/api/vectors#shape + * """ + * return self.data.shape # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":213 + * self._unset = cppset[int]() + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * """Get `(rows, dims)` tuples of number of rows and number of dimensions +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vectors.Vectors.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":224 + * return self.data.shape + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * """The vector size i,e. rows * dims. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_4size___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4size___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/vectors.pyx":232 + * DOCS: https://spacy.io/api/vectors#size + * """ + * return self.data.size # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":224 + * return self.data.shape + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * """The vector size i,e. rows * dims. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vectors.Vectors.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":234 + * return self.data.size + * + * @property # <<<<<<<<<<<<<< + * def is_full(self): + * """Whether the vectors table is full. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7is_full_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7is_full_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_7is_full___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_7is_full___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/vectors.pyx":242 + * DOCS: https://spacy.io/api/vectors#is_full + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * return True + * return self._unset.size() == 0 +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":243 + * """ + * if self.mode == Mode.floret: + * return True # <<<<<<<<<<<<<< + * return self._unset.size() == 0 + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + goto __pyx_L0; + + /* "spacy/vectors.pyx":242 + * DOCS: https://spacy.io/api/vectors#is_full + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * return True + * return self._unset.size() == 0 +*/ + } + + /* "spacy/vectors.pyx":244 + * if self.mode == Mode.floret: + * return True + * return self._unset.size() == 0 # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->_unset.size() == 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":234 + * return self.data.size + * + * @property # <<<<<<<<<<<<<< + * def is_full(self): + * """Whether the vectors table is full. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vectors.Vectors.is_full.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":246 + * return self._unset.size() == 0 + * + * @property # <<<<<<<<<<<<<< + * def n_keys(self): + * """Get the number of keys in the table. Note that this is the number +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_6n_keys_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_6n_keys_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_6n_keys___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_6n_keys___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/vectors.pyx":256 + * DOCS: https://spacy.io/api/vectors#n_keys + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * return -1 + * return len(self.key2row) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":257 + * """ + * if self.mode == Mode.floret: + * return -1 # <<<<<<<<<<<<<< + * return len(self.key2row) + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __pyx_r = __pyx_mstate_global->__pyx_int_neg_1; + goto __pyx_L0; + + /* "spacy/vectors.pyx":256 + * DOCS: https://spacy.io/api/vectors#n_keys + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * return -1 + * return len(self.key2row) +*/ + } + + /* "spacy/vectors.pyx":258 + * if self.mode == Mode.floret: + * return -1 + * return len(self.key2row) # <<<<<<<<<<<<<< + * + * def __reduce__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyLong_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":246 + * return self._unset.size() == 0 + * + * @property # <<<<<<<<<<<<<< + * def n_keys(self): + * """Get the number of keys in the table. Note that this is the number +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vectors.Vectors.n_keys.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":260 + * return len(self.key2row) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (unpickle_vectors, (self.to_bytes(),)) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_3__reduce__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_2__reduce__, "Vectors.__reduce__(self)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_3__reduce__ = {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_3__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_2__reduce__}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_3__reduce__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_2__reduce__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_2__reduce__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "spacy/vectors.pyx":261 + * + * def __reduce__(self): + * return (unpickle_vectors, (self.to_bytes(),)) # <<<<<<<<<<<<<< + * + * def __getitem__(self, key): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_unpickle_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 261, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 261, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 261, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":260 + * return len(self.key2row) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (unpickle_vectors, (self.to_bytes(),)) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.vectors.Vectors.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":263 + * return (unpickle_vectors, (self.to_bytes(),)) + * + * def __getitem__(self, key): # <<<<<<<<<<<<<< + * """Get a vector by key. If the key is not found, a KeyError is raised. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_4__getitem__, "Vectors.__getitem__(self, key)\n\nGet a vector by key. If the key is not found, a KeyError is raised.\n\nkey (str/int): The key to get the vector for.\nRETURNS (ndarray): The vector for the key.\n\nDOCS: https://spacy.io/api/vectors#getitem"); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_7vectors_7Vectors_4__getitem__; +#endif +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_4__getitem__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4__getitem__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "spacy/vectors.pyx":271 + * DOCS: https://spacy.io/api/vectors#getitem + * """ + * if self.mode == Mode.default: # <<<<<<<<<<<<<< + * i = self.key2row.get(get_string_id(key), None) + * if i is None: +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":272 + * """ + * if self.mode == Mode.default: + * i = self.key2row.get(get_string_id(key), None) # <<<<<<<<<<<<<< + * if i is None: + * raise KeyError(Errors.E058.format(key=key)) +*/ + __pyx_t_2 = __pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_get_string_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_key}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_4, Py_None}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_i = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":273 + * if self.mode == Mode.default: + * i = self.key2row.get(get_string_id(key), None) + * if i is None: # <<<<<<<<<<<<<< + * raise KeyError(Errors.E058.format(key=key)) + * else: +*/ + __pyx_t_3 = (__pyx_v_i == Py_None); + if (unlikely(__pyx_t_3)) { + + /* "spacy/vectors.pyx":274 + * i = self.key2row.get(get_string_id(key), None) + * if i is None: + * raise KeyError(Errors.E058.format(key=key)) # <<<<<<<<<<<<<< + * else: + * return self.data[i] +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_E058); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_key, __pyx_v_key, __pyx_t_5, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_7 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_KeyError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 274, __pyx_L1_error) + + /* "spacy/vectors.pyx":273 + * if self.mode == Mode.default: + * i = self.key2row.get(get_string_id(key), None) + * if i is None: # <<<<<<<<<<<<<< + * raise KeyError(Errors.E058.format(key=key)) + * else: +*/ + } + + /* "spacy/vectors.pyx":276 + * raise KeyError(Errors.E058.format(key=key)) + * else: + * return self.data[i] # <<<<<<<<<<<<<< + * elif self.mode == Mode.floret: + * return self.get_batch([key])[0] +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_self->data, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + + /* "spacy/vectors.pyx":271 + * DOCS: https://spacy.io/api/vectors#getitem + * """ + * if self.mode == Mode.default: # <<<<<<<<<<<<<< + * i = self.key2row.get(get_string_id(key), None) + * if i is None: +*/ + } + + /* "spacy/vectors.pyx":277 + * else: + * return self.data[i] + * elif self.mode == Mode.floret: # <<<<<<<<<<<<<< + * return self.get_batch([key])[0] + * raise KeyError(Errors.E058.format(key=key)) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":278 + * return self.data[i] + * elif self.mode == Mode.floret: + * return self.get_batch([key])[0] # <<<<<<<<<<<<<< + * raise KeyError(Errors.E058.format(key=key)) + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_key) != (0)) __PYX_ERR(0, 278, __pyx_L1_error); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_batch, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":277 + * else: + * return self.data[i] + * elif self.mode == Mode.floret: # <<<<<<<<<<<<<< + * return self.get_batch([key])[0] + * raise KeyError(Errors.E058.format(key=key)) +*/ + } + + /* "spacy/vectors.pyx":279 + * elif self.mode == Mode.floret: + * return self.get_batch([key])[0] + * raise KeyError(Errors.E058.format(key=key)) # <<<<<<<<<<<<<< + * + * def __setitem__(self, key, vector): +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_E058); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __pyx_t_6; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_8, NULL}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_key, __pyx_v_key, __pyx_t_5, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_7 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_2}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_KeyError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 279, __pyx_L1_error) + + /* "spacy/vectors.pyx":263 + * return (unpickle_vectors, (self.to_bytes(),)) + * + * def __getitem__(self, key): # <<<<<<<<<<<<<< + * """Get a vector by key. If the key is not found, a KeyError is raised. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.vectors.Vectors.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":281 + * raise KeyError(Errors.E058.format(key=key)) + * + * def __setitem__(self, key, vector): # <<<<<<<<<<<<<< + * """Set a vector for the given key. + * +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_7Vectors_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_vector); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_6__setitem__, "Vectors.__setitem__(self, key, vector)\n\nSet a vector for the given key.\n\nkey (str/int): The key to set the vector for.\nvector (ndarray): The vector to set.\n\nDOCS: https://spacy.io/api/vectors#setitem"); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_7vectors_7Vectors_6__setitem__; +#endif +static int __pyx_pw_5spacy_7vectors_7Vectors_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_vector) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_6__setitem__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_vector)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_7Vectors_6__setitem__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_vector) { + PyObject *__pyx_v_i = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_key); + + /* "spacy/vectors.pyx":289 + * DOCS: https://spacy.io/api/vectors#setitem + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W115.format(method="Vectors.__setitem__")) + * return +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":290 + * """ + * if self.mode == Mode.floret: + * warnings.warn(Warnings.W115.format(method="Vectors.__setitem__")) # <<<<<<<<<<<<<< + * return + * key = get_string_id(key) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Warnings); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_W115); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_method, __pyx_mstate_global->__pyx_kp_u_Vectors___setitem, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":291 + * if self.mode == Mode.floret: + * warnings.warn(Warnings.W115.format(method="Vectors.__setitem__")) + * return # <<<<<<<<<<<<<< + * key = get_string_id(key) + * i = self.key2row[key] +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":289 + * DOCS: https://spacy.io/api/vectors#setitem + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W115.format(method="Vectors.__setitem__")) + * return +*/ + } + + /* "spacy/vectors.pyx":292 + * warnings.warn(Warnings.W115.format(method="Vectors.__setitem__")) + * return + * key = get_string_id(key) # <<<<<<<<<<<<<< + * i = self.key2row[key] + * self.data[i] = vector +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_string_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_key}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":293 + * return + * key = get_string_id(key) + * i = self.key2row[key] # <<<<<<<<<<<<<< + * self.data[i] = vector + * if self._unset.count(i): +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_self->key2row, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_i = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":294 + * key = get_string_id(key) + * i = self.key2row[key] + * self.data[i] = vector # <<<<<<<<<<<<<< + * if self._unset.count(i): + * self._unset.erase(self._unset.find(i)) +*/ + if (unlikely((PyObject_SetItem(__pyx_v_self->data, __pyx_v_i, __pyx_v_vector) < 0))) __PYX_ERR(0, 294, __pyx_L1_error) + + /* "spacy/vectors.pyx":295 + * i = self.key2row[key] + * self.data[i] = vector + * if self._unset.count(i): # <<<<<<<<<<<<<< + * self._unset.erase(self._unset.find(i)) + * +*/ + __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_v_i); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L1_error) + __pyx_t_3 = (__pyx_v_self->_unset.count(__pyx_t_10) != 0); + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":296 + * self.data[i] = vector + * if self._unset.count(i): + * self._unset.erase(self._unset.find(i)) # <<<<<<<<<<<<<< + * + * def __iter__(self): +*/ + __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_v_i); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L1_error) + (void)(__pyx_v_self->_unset.erase(__pyx_v_self->_unset.find(__pyx_t_10))); + + /* "spacy/vectors.pyx":295 + * i = self.key2row[key] + * self.data[i] = vector + * if self._unset.count(i): # <<<<<<<<<<<<<< + * self._unset.erase(self._unset.find(i)) + * +*/ + } + + /* "spacy/vectors.pyx":281 + * raise KeyError(Errors.E058.format(key=key)) + * + * def __setitem__(self, key, vector): # <<<<<<<<<<<<<< + * """Set a vector for the given key. + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.vectors.Vectors.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_7vectors_7Vectors_10generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/vectors.pyx":298 + * self._unset.erase(self._unset.find(i)) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * """Iterate over the keys in the table. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9__iter__(PyObject *__pyx_v_self); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_8__iter__, "Vectors.__iter__(self)\n\nIterate over the keys in the table.\n\nYIELDS (int): A key in the table.\n\nDOCS: https://spacy.io/api/vectors#iter"); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_7vectors_7Vectors_8__iter__; +#endif +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9__iter__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_8__iter__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_8__iter__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__ *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__ *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct____iter__(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__ *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 298, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_7vectors_7Vectors_10generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_Vectors___iter, __pyx_mstate_global->__pyx_n_u_spacy_vectors); if (unlikely(!gen)) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.Vectors.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_7vectors_7Vectors_10generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__ *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + __Pyx_PySendResult __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L4_resume_from_yield_from; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 298, __pyx_L1_error) + } + + /* "spacy/vectors.pyx":305 + * DOCS: https://spacy.io/api/vectors#iter + * """ + * yield from self.key2row # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __pyx_t_1 = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_cur_scope->__pyx_v_self->key2row, &__pyx_r); + if (likely(__pyx_t_1 == PYGEN_NEXT)) { + __Pyx_GOTREF(__pyx_r); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L4_resume_from_yield_from:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 305, __pyx_L1_error) + } else if (likely(__pyx_t_1 == PYGEN_RETURN)) { + __Pyx_GOTREF(__pyx_r); + __Pyx_DECREF(__pyx_r); __pyx_r = 0; + } else { + __Pyx_XGOTREF(__pyx_r); + __PYX_ERR(0, 305, __pyx_L1_error) + } + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "spacy/vectors.pyx":298 + * self._unset.erase(self._unset.find(i)) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * """Iterate over the keys in the table. + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":307 + * yield from self.key2row + * + * def __len__(self): # <<<<<<<<<<<<<< + * """Return the number of vectors in the table. + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_5spacy_7vectors_7Vectors_12__len__(PyObject *__pyx_v_self); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_11__len__, "Vectors.__len__(self)\n\nReturn the number of vectors in the table.\n\nRETURNS (int): The number of vectors in the data.\n\nDOCS: https://spacy.io/api/vectors#len"); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_7vectors_7Vectors_11__len__; +#endif +static Py_ssize_t __pyx_pw_5spacy_7vectors_7Vectors_12__len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_11__len__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_pf_5spacy_7vectors_7Vectors_11__len__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__len__", 0); + + /* "spacy/vectors.pyx":314 + * DOCS: https://spacy.io/api/vectors#len + * """ + * return self.data.shape[0] # <<<<<<<<<<<<<< + * + * def __contains__(self, key): +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + /* "spacy/vectors.pyx":307 + * yield from self.key2row + * + * def __len__(self): # <<<<<<<<<<<<<< + * """Return the number of vectors in the table. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vectors.Vectors.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":316 + * return self.data.shape[0] + * + * def __contains__(self, key): # <<<<<<<<<<<<<< + * """Check whether a key has been mapped to a vector entry in the table. + * +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_7Vectors_14__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_13__contains__, "Vectors.__contains__(self, key)\n\nCheck whether a key has been mapped to a vector entry in the table.\n\nkey (int): The key to check.\nRETURNS (bool): Whether the key has a vector entry.\n\nDOCS: https://spacy.io/api/vectors#contains"); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_7vectors_7Vectors_13__contains__; +#endif +static int __pyx_pw_5spacy_7vectors_7Vectors_14__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_13__contains__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_7Vectors_13__contains__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_key) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__contains__", 0); + + /* "spacy/vectors.pyx":324 + * DOCS: https://spacy.io/api/vectors#contains + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * return True + * else: +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 324, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":325 + * """ + * if self.mode == Mode.floret: + * return True # <<<<<<<<<<<<<< + * else: + * return key in self.key2row +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "spacy/vectors.pyx":324 + * DOCS: https://spacy.io/api/vectors#contains + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "spacy/vectors.pyx":327 + * return True + * else: + * return key in self.key2row # <<<<<<<<<<<<<< + * + * def __eq__(self, other): +*/ + /*else*/ { + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_v_self->key2row, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 327, __pyx_L1_error) + __pyx_r = __pyx_t_3; + goto __pyx_L0; + } + + /* "spacy/vectors.pyx":316 + * return self.data.shape[0] + * + * def __contains__(self, key): # <<<<<<<<<<<<<< + * """Check whether a key has been mapped to a vector entry in the table. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vectors.Vectors.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":329 + * return key in self.key2row + * + * def __eq__(self, other): # <<<<<<<<<<<<<< + * # Check for equality, with faster checks first + * return ( +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_16__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_16__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_15__eq__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_15__eq__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + size_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__eq__", 0); + + /* "spacy/vectors.pyx":331 + * def __eq__(self, other): + * # Check for equality, with faster checks first + * return ( # <<<<<<<<<<<<<< + * self.shape == other.shape + * and self.key2row == other.key2row +*/ + __Pyx_XDECREF(__pyx_r); + + /* "spacy/vectors.pyx":332 + * # Check for equality, with faster checks first + * return ( + * self.shape == other.shape # <<<<<<<<<<<<<< + * and self.key2row == other.key2row + * and self.to_bytes(exclude=["strings"]) == other.to_bytes(exclude=["strings"]) +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 332, __pyx_L1_error) + if (__pyx_t_5) { + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L3_bool_binop_done; + } + + /* "spacy/vectors.pyx":333 + * return ( + * self.shape == other.shape + * and self.key2row == other.key2row # <<<<<<<<<<<<<< + * and self.to_bytes(exclude=["strings"]) == other.to_bytes(exclude=["strings"]) + * ) +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_mstate_global->__pyx_n_u_key2row); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_self->key2row, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 333, __pyx_L1_error) + if (__pyx_t_5) { + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L3_bool_binop_done; + } + + /* "spacy/vectors.pyx":334 + * self.shape == other.shape + * and self.key2row == other.key2row + * and self.to_bytes(exclude=["strings"]) == other.to_bytes(exclude=["strings"]) # <<<<<<<<<<<<<< + * ) + * +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_strings); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_strings); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_mstate_global->__pyx_n_u_strings) != (0)) __PYX_ERR(0, 334, __pyx_L1_error); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, NULL}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_2, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_2 = __pyx_v_other; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_strings); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_strings); + if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_strings) != (0)) __PYX_ERR(0, 334, __pyx_L1_error); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_4, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_1 = __pyx_t_8; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":329 + * return key in self.key2row + * + * def __eq__(self, other): # <<<<<<<<<<<<<< + * # Check for equality, with faster checks first + * return ( +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.vectors.Vectors.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":337 + * ) + * + * def resize(self, shape, inplace=False): # <<<<<<<<<<<<<< + * """Resize the underlying vectors array. If inplace=True, the memory + * is reallocated. This may cause other references to the data to become +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_18resize(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_17resize, "Vectors.resize(self, shape, inplace=False)\n\nResize the underlying vectors array. If inplace=True, the memory\nis reallocated. This may cause other references to the data to become\ninvalid, so only use inplace=True if you're sure that's what you want.\n\nIf the number of vectors is reduced, keys mapped to rows that have been\ndeleted are removed. These removed items are returned as a list of\n`(key, row)` tuples.\n\nshape (tuple): A `(rows, dims)` tuple.\ninplace (bool): Reallocate the memory.\nRETURNS (list): The removed items as a list of `(key, row)` tuples.\n\nDOCS: https://spacy.io/api/vectors#resize"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_18resize = {"resize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_18resize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_17resize}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_18resize(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_shape = 0; + PyObject *__pyx_v_inplace = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("resize (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_shape,&__pyx_mstate_global->__pyx_n_u_inplace,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 337, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 337, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 337, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "resize", 0) < (0)) __PYX_ERR(0, 337, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("resize", 0, 1, 2, i); __PYX_ERR(0, 337, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 337, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 337, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_False)); + } + __pyx_v_shape = values[0]; + __pyx_v_inplace = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("resize", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 337, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.resize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_17resize(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_shape, __pyx_v_inplace); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_17resize(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_shape, PyObject *__pyx_v_inplace) { + PyObject *__pyx_v_xp = NULL; + PyObject *__pyx_v_resized_array = NULL; + PyObject *__pyx_v_copy_shape = NULL; + PyObject *__pyx_v_removed_items = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_row = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *(*__pyx_t_13)(PyObject *); + int __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("resize", 0); + + /* "spacy/vectors.pyx":352 + * DOCS: https://spacy.io/api/vectors#resize + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W115.format(method="Vectors.resize")) + * return -1 +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":353 + * """ + * if self.mode == Mode.floret: + * warnings.warn(Warnings.W115.format(method="Vectors.resize")) # <<<<<<<<<<<<<< + * return -1 + * xp = get_array_module(self.data) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Warnings); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_W115); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_method, __pyx_mstate_global->__pyx_kp_u_Vectors_resize, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":354 + * if self.mode == Mode.floret: + * warnings.warn(Warnings.W115.format(method="Vectors.resize")) + * return -1 # <<<<<<<<<<<<<< + * xp = get_array_module(self.data) + * if inplace: +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __pyx_r = __pyx_mstate_global->__pyx_int_neg_1; + goto __pyx_L0; + + /* "spacy/vectors.pyx":352 + * DOCS: https://spacy.io/api/vectors#resize + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W115.format(method="Vectors.resize")) + * return -1 +*/ + } + + /* "spacy/vectors.pyx":355 + * warnings.warn(Warnings.W115.format(method="Vectors.resize")) + * return -1 + * xp = get_array_module(self.data) # <<<<<<<<<<<<<< + * if inplace: + * if shape[1] != self.data.shape[1]: +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_array_module); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_self->data}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_xp = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":356 + * return -1 + * xp = get_array_module(self.data) + * if inplace: # <<<<<<<<<<<<<< + * if shape[1] != self.data.shape[1]: + * raise ValueError(Errors.E193.format(new_dim=shape[1], curr_dim=self.data.shape[1])) +*/ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_inplace); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 356, __pyx_L1_error) + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":357 + * xp = get_array_module(self.data) + * if inplace: + * if shape[1] != self.data.shape[1]: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E193.format(new_dim=shape[1], curr_dim=self.data.shape[1])) + * if xp == numpy: +*/ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_shape, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(__pyx_t_3)) { + + /* "spacy/vectors.pyx":358 + * if inplace: + * if shape[1] != self.data.shape[1]: + * raise ValueError(Errors.E193.format(new_dim=shape[1], curr_dim=self.data.shape[1])) # <<<<<<<<<<<<<< + * if xp == numpy: + * self.data.resize(shape, refcheck=False) +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_E193); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_2 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_shape, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_6, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_2, NULL}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_new_dim, __pyx_t_8, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 358, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_curr_dim, __pyx_t_10, __pyx_t_6, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 358, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_1}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 358, __pyx_L1_error) + + /* "spacy/vectors.pyx":357 + * xp = get_array_module(self.data) + * if inplace: + * if shape[1] != self.data.shape[1]: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E193.format(new_dim=shape[1], curr_dim=self.data.shape[1])) + * if xp == numpy: +*/ + } + + /* "spacy/vectors.pyx":359 + * if shape[1] != self.data.shape[1]: + * raise ValueError(Errors.E193.format(new_dim=shape[1], curr_dim=self.data.shape[1])) + * if xp == numpy: # <<<<<<<<<<<<<< + * self.data.resize(shape, refcheck=False) + * else: +*/ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_xp, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(__pyx_t_3)) { + + /* "spacy/vectors.pyx":360 + * raise ValueError(Errors.E193.format(new_dim=shape[1], curr_dim=self.data.shape[1])) + * if xp == numpy: + * self.data.resize(shape, refcheck=False) # <<<<<<<<<<<<<< + * else: + * raise ValueError(Errors.E192) +*/ + __pyx_t_4 = __pyx_v_self->data; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_v_shape}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_refcheck, Py_False, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 360, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_resize, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":359 + * if shape[1] != self.data.shape[1]: + * raise ValueError(Errors.E193.format(new_dim=shape[1], curr_dim=self.data.shape[1])) + * if xp == numpy: # <<<<<<<<<<<<<< + * self.data.resize(shape, refcheck=False) + * else: +*/ + goto __pyx_L6; + } + + /* "spacy/vectors.pyx":362 + * self.data.resize(shape, refcheck=False) + * else: + * raise ValueError(Errors.E192) # <<<<<<<<<<<<<< + * else: + * resized_array = xp.zeros(shape, dtype=self.data.dtype) +*/ + /*else*/ { + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_E192); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 362, __pyx_L1_error) + } + __pyx_L6:; + + /* "spacy/vectors.pyx":356 + * return -1 + * xp = get_array_module(self.data) + * if inplace: # <<<<<<<<<<<<<< + * if shape[1] != self.data.shape[1]: + * raise ValueError(Errors.E193.format(new_dim=shape[1], curr_dim=self.data.shape[1])) +*/ + goto __pyx_L4; + } + + /* "spacy/vectors.pyx":364 + * raise ValueError(Errors.E192) + * else: + * resized_array = xp.zeros(shape, dtype=self.data.dtype) # <<<<<<<<<<<<<< + * copy_shape = (min(shape[0], self.data.shape[0]), min(shape[1], self.data.shape[1])) + * resized_array[:copy_shape[0], :copy_shape[1]] = self.data[:copy_shape[0], :copy_shape[1]] +*/ + /*else*/ { + __pyx_t_7 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_v_shape}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_5, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 364, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_zeros, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_resized_array = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":365 + * else: + * resized_array = xp.zeros(shape, dtype=self.data.dtype) + * copy_shape = (min(shape[0], self.data.shape[0]), min(shape[1], self.data.shape[1])) # <<<<<<<<<<<<<< + * resized_array[:copy_shape[0], :copy_shape[1]] = self.data[:copy_shape[0], :copy_shape[1]] + * self.data = resized_array +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_shape, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 365, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_3) { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = __pyx_t_4; + } else { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = __pyx_t_1; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_shape, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 365, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_3) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_7 = __pyx_t_1; + } else { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_7 = __pyx_t_4; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 365, __pyx_L1_error); + __Pyx_INCREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 365, __pyx_L1_error); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_copy_shape = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":366 + * resized_array = xp.zeros(shape, dtype=self.data.dtype) + * copy_shape = (min(shape[0], self.data.shape[0]), min(shape[1], self.data.shape[1])) + * resized_array[:copy_shape[0], :copy_shape[1]] = self.data[:copy_shape[0], :copy_shape[1]] # <<<<<<<<<<<<<< + * self.data = resized_array + * self._sync_unset() +*/ + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_copy_shape, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PySlice_New(Py_None, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_copy_shape, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PySlice_New(Py_None, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7) != (0)) __PYX_ERR(0, 366, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 366, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_self->data, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_copy_shape, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PySlice_New(Py_None, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_copy_shape, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PySlice_New(Py_None, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7) != (0)) __PYX_ERR(0, 366, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 366, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_4 = 0; + if (unlikely((PyObject_SetItem(__pyx_v_resized_array, __pyx_t_1, __pyx_t_5) < 0))) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vectors.pyx":367 + * copy_shape = (min(shape[0], self.data.shape[0]), min(shape[1], self.data.shape[1])) + * resized_array[:copy_shape[0], :copy_shape[1]] = self.data[:copy_shape[0], :copy_shape[1]] + * self.data = resized_array # <<<<<<<<<<<<<< + * self._sync_unset() + * removed_items = [] +*/ + __Pyx_INCREF(__pyx_v_resized_array); + __Pyx_GIVEREF(__pyx_v_resized_array); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(__pyx_v_self->data); + __pyx_v_self->data = __pyx_v_resized_array; + } + __pyx_L4:; + + /* "spacy/vectors.pyx":368 + * resized_array[:copy_shape[0], :copy_shape[1]] = self.data[:copy_shape[0], :copy_shape[1]] + * self.data = resized_array + * self._sync_unset() # <<<<<<<<<<<<<< + * removed_items = [] + * for key, row in self.key2row.copy().items(): +*/ + __pyx_t_1 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sync_unset, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vectors.pyx":369 + * self.data = resized_array + * self._sync_unset() + * removed_items = [] # <<<<<<<<<<<<<< + * for key, row in self.key2row.copy().items(): + * if row >= shape[0]: +*/ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_removed_items = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/vectors.pyx":370 + * self._sync_unset() + * removed_items = [] + * for key, row in self.key2row.copy().items(): # <<<<<<<<<<<<<< + * if row >= shape[0]: + * self.key2row.pop(key) +*/ + __pyx_t_7 = __pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_1 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); + __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 370, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 370, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 370, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_11)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 370, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_12(__pyx_t_4); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 370, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 370, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_7); + } + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); + index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed; + __Pyx_GOTREF(__pyx_t_1); + index = 1; __pyx_t_7 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_7)) goto __pyx_L9_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_6), 2) < (0)) __PYX_ERR(0, 370, __pyx_L1_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L10_unpacking_done; + __pyx_L9_unpacking_failed:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 370, __pyx_L1_error) + __pyx_L10_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_1); + __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":371 + * removed_items = [] + * for key, row in self.key2row.copy().items(): + * if row >= shape[0]: # <<<<<<<<<<<<<< + * self.key2row.pop(key) + * removed_items.append((key, row)) +*/ + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_shape, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyObject_RichCompare(__pyx_v_row, __pyx_t_5, Py_GE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":372 + * for key, row in self.key2row.copy().items(): + * if row >= shape[0]: + * self.key2row.pop(key) # <<<<<<<<<<<<<< + * removed_items.append((key, row)) + * return removed_items +*/ + __pyx_t_5 = __pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_key}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pop, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 372, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":373 + * if row >= shape[0]: + * self.key2row.pop(key) + * removed_items.append((key, row)) # <<<<<<<<<<<<<< + * return removed_items + * +*/ + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_key) != (0)) __PYX_ERR(0, 373, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_row); + __Pyx_GIVEREF(__pyx_v_row); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_row) != (0)) __PYX_ERR(0, 373, __pyx_L1_error); + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_removed_items, __pyx_t_7); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":371 + * removed_items = [] + * for key, row in self.key2row.copy().items(): + * if row >= shape[0]: # <<<<<<<<<<<<<< + * self.key2row.pop(key) + * removed_items.append((key, row)) +*/ + } + + /* "spacy/vectors.pyx":370 + * self._sync_unset() + * removed_items = [] + * for key, row in self.key2row.copy().items(): # <<<<<<<<<<<<<< + * if row >= shape[0]: + * self.key2row.pop(key) +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":374 + * self.key2row.pop(key) + * removed_items.append((key, row)) + * return removed_items # <<<<<<<<<<<<<< + * + * def keys(self): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_removed_items); + __pyx_r = __pyx_v_removed_items; + goto __pyx_L0; + + /* "spacy/vectors.pyx":337 + * ) + * + * def resize(self, shape, inplace=False): # <<<<<<<<<<<<<< + * """Resize the underlying vectors array. If inplace=True, the memory + * is reallocated. This may cause other references to the data to become +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("spacy.vectors.Vectors.resize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_xp); + __Pyx_XDECREF(__pyx_v_resized_array); + __Pyx_XDECREF(__pyx_v_copy_shape); + __Pyx_XDECREF(__pyx_v_removed_items); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":376 + * return removed_items + * + * def keys(self): # <<<<<<<<<<<<<< + * """RETURNS (iterable): A sequence of keys in the table.""" + * return self.key2row.keys() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_20keys(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_19keys, "Vectors.keys(self)\n\nRETURNS (iterable): A sequence of keys in the table."); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_20keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_20keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_19keys}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_20keys(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("keys (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("keys", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("keys", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_19keys(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_19keys(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("keys", 0); + + /* "spacy/vectors.pyx":378 + * def keys(self): + * """RETURNS (iterable): A sequence of keys in the table.""" + * return self.key2row.keys() # <<<<<<<<<<<<<< + * + * def values(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_keys, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":376 + * return removed_items + * + * def keys(self): # <<<<<<<<<<<<<< + * """RETURNS (iterable): A sequence of keys in the table.""" + * return self.key2row.keys() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vectors.Vectors.keys", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_7vectors_7Vectors_23generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/vectors.pyx":380 + * return self.key2row.keys() + * + * def values(self): # <<<<<<<<<<<<<< + * """Iterate over vectors that have been assigned to at least one key. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_22values(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_21values, "Vectors.values(self)\n\nIterate over vectors that have been assigned to at least one key.\n\nNote that some vectors may be unassigned, so the number of vectors\nreturned may be less than the length of the vectors table.\n\nYIELDS (ndarray): A vector in the table.\n\nDOCS: https://spacy.io/api/vectors#values"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_22values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_22values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_21values}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_22values(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("values (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("values", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("values", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_21values(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_21values(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("values", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_1_values(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 380, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_7vectors_7Vectors_23generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_values, __pyx_mstate_global->__pyx_n_u_Vectors_values, __pyx_mstate_global->__pyx_n_u_spacy_vectors); if (unlikely(!gen)) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.Vectors.values", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_7vectors_7Vectors_23generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values *__pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("values", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L7_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 380, __pyx_L1_error) + } + + /* "spacy/vectors.pyx":390 + * DOCS: https://spacy.io/api/vectors#values + * """ + * for row, vector in enumerate(range(self.data.shape[0])): # <<<<<<<<<<<<<< + * if not self._unset.count(row): + * yield vector +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_1 = __pyx_mstate_global->__pyx_int_0; + __pyx_t_3 = NULL; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 390, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 390, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 390, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 390, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + { + __pyx_t_2 = __pyx_t_7(__pyx_t_5); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 390, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_vector); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_vector, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_row); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_row, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":391 + * """ + * for row, vector in enumerate(range(self.data.shape[0])): + * if not self._unset.count(row): # <<<<<<<<<<<<<< + * yield vector + * +*/ + __pyx_t_8 = __Pyx_PyLong_As_int(__pyx_cur_scope->__pyx_v_row); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_9 = (!(__pyx_cur_scope->__pyx_v_self->_unset.count(__pyx_t_8) != 0)); + if (__pyx_t_9) { + + /* "spacy/vectors.pyx":392 + * for row, vector in enumerate(range(self.data.shape[0])): + * if not self._unset.count(row): + * yield vector # <<<<<<<<<<<<<< + * + * def items(self): +*/ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_vector); + __pyx_r = __pyx_cur_scope->__pyx_v_vector; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_5); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_5; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_7; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L7_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_5 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_5); + __pyx_t_7 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 392, __pyx_L1_error) + + /* "spacy/vectors.pyx":391 + * """ + * for row, vector in enumerate(range(self.data.shape[0])): + * if not self._unset.count(row): # <<<<<<<<<<<<<< + * yield vector + * +*/ + } + + /* "spacy/vectors.pyx":390 + * DOCS: https://spacy.io/api/vectors#values + * """ + * for row, vector in enumerate(range(self.data.shape[0])): # <<<<<<<<<<<<<< + * if not self._unset.count(row): + * yield vector +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "spacy/vectors.pyx":380 + * return self.key2row.keys() + * + * def values(self): # <<<<<<<<<<<<<< + * """Iterate over vectors that have been assigned to at least one key. + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("values", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_7vectors_7Vectors_26generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/vectors.pyx":394 + * yield vector + * + * def items(self): # <<<<<<<<<<<<<< + * """Iterate over `(key, vector)` pairs. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_25items(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_24items, "Vectors.items(self)\n\nIterate over `(key, vector)` pairs.\n\nYIELDS (tuple): A key/vector pair.\n\nDOCS: https://spacy.io/api/vectors#items"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_25items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_25items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_24items}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_25items(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("items (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("items", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("items", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_24items(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_24items(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("items", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_2_items(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 394, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_7vectors_7Vectors_26generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_items, __pyx_mstate_global->__pyx_n_u_Vectors_items, __pyx_mstate_global->__pyx_n_u_spacy_vectors); if (unlikely(!gen)) __PYX_ERR(0, 394, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.Vectors.items", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_7vectors_7Vectors_26generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items *__pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("items", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L8_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 394, __pyx_L1_error) + } + + /* "spacy/vectors.pyx":401 + * DOCS: https://spacy.io/api/vectors#items + * """ + * for key, row in self.key2row.items(): # <<<<<<<<<<<<<< + * yield key, self.data[row] + * +*/ + __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 401, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 401, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_4; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 401, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4); + #endif + ++__pyx_t_4; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 401, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 401, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_7); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); + index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 401, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 401, __pyx_L1_error) + __pyx_L7_unpacking_done:; + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_row); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_row, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":402 + * """ + * for key, row in self.key2row.items(): + * yield key, self.data[row] # <<<<<<<<<<<<<< + * + * def find(self, *, key=None, keys=None, row=None, rows=None): +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->data, __pyx_cur_scope->__pyx_v_row); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_cur_scope->__pyx_v_key) != (0)) __PYX_ERR(0, 402, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 402, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L8_resume_from_yield:; + __pyx_t_2 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 402, __pyx_L1_error) + + /* "spacy/vectors.pyx":401 + * DOCS: https://spacy.io/api/vectors#items + * """ + * for key, row in self.key2row.items(): # <<<<<<<<<<<<<< + * yield key, self.data[row] + * +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "spacy/vectors.pyx":394 + * yield vector + * + * def items(self): # <<<<<<<<<<<<<< + * """Iterate over `(key, vector)` pairs. + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("items", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":404 + * yield key, self.data[row] + * + * def find(self, *, key=None, keys=None, row=None, rows=None): # <<<<<<<<<<<<<< + * """Look up one or more keys by row, or vice versa. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_28find(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_27find, "Vectors.find(self, *, key=None, keys=None, row=None, rows=None)\n\nLook up one or more keys by row, or vice versa.\n\nkey (Union[int, str]): Find the row that the given key points to.\n Returns int, -1 if missing.\nkeys (Iterable[Union[int, str]]): Find rows that the keys point to.\n Returns ndarray.\nrow (int): Find the first key that points to the row.\n Returns int.\nrows (Iterable[int]): Find the keys that point to the rows.\n Returns ndarray.\nRETURNS: The requested key, keys, row or rows."); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_28find = {"find", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_28find, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_27find}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_28find(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_key = 0; + PyObject *__pyx_v_keys = 0; + PyObject *__pyx_v_row = 0; + PyObject *__pyx_v_rows = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("find (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_keys,&__pyx_mstate_global->__pyx_n_u_row,&__pyx_mstate_global->__pyx_n_u_rows,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 404, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "find", 0) < (0)) __PYX_ERR(0, 404, __pyx_L3_error) + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None)); + } else if (unlikely(__pyx_nargs != 0)) { + goto __pyx_L5_argtuple_error; + } else { + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_key = values[0]; + __pyx_v_keys = values[1]; + __pyx_v_row = values[2]; + __pyx_v_rows = values[3]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("find", 1, 0, 0, __pyx_nargs); __PYX_ERR(0, 404, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.find", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_27find(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_key, __pyx_v_keys, __pyx_v_row, __pyx_v_rows); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_7vectors_7Vectors_4find_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/vectors.pyx":424 + * ) + * ) + * if sum(arg is None for arg in (key, keys, row, rows)) != 3: # <<<<<<<<<<<<<< + * bad_kwargs = {"key": key, "keys": keys, "row": row, "rows": rows} + * raise ValueError(Errors.E059.format(kwargs=bad_kwargs)) +*/ + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4find_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_3_genexpr(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 424, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0; + __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_7vectors_7Vectors_4find_2generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_find_locals_genexpr, __pyx_mstate_global->__pyx_n_u_spacy_vectors); if (unlikely(!gen)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.Vectors.find.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_7vectors_7Vectors_4find_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("genexpr", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 424, __pyx_L1_error) + } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 424, __pyx_L1_error) } + __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 424, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_arg); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_arg, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_4 = (__pyx_cur_scope->__pyx_v_arg == Py_None); + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 424, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":404 + * yield key, self.data[row] + * + * def find(self, *, key=None, keys=None, row=None, rows=None): # <<<<<<<<<<<<<< + * """Look up one or more keys by row, or vice versa. + * +*/ + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_27find(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_keys, PyObject *__pyx_v_row, PyObject *__pyx_v_rows) { + PyObject *__pyx_v_bad_kwargs = NULL; + PyObject *__pyx_v_xp = NULL; + PyObject *__pyx_v_row2key = NULL; + PyObject *__pyx_v_results = NULL; + PyObject *__pyx_gb_5spacy_7vectors_7Vectors_4find_2generator3 = 0; + PyObject *__pyx_8genexpr2__pyx_v_key = NULL; + PyObject *__pyx_8genexpr2__pyx_v_row = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *(*__pyx_t_11)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("find", 0); + __Pyx_INCREF(__pyx_v_key); + __Pyx_INCREF(__pyx_v_keys); + __Pyx_INCREF(__pyx_v_row); + __Pyx_INCREF(__pyx_v_rows); + + /* "spacy/vectors.pyx":417 + * RETURNS: The requested key, keys, row or rows. + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * raise ValueError( + * Errors.E858.format( +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_t_3)) { + + /* "spacy/vectors.pyx":418 + * """ + * if self.mode == Mode.floret: + * raise ValueError( # <<<<<<<<<<<<<< + * Errors.E858.format( + * mode=self.mode, +*/ + __pyx_t_2 = NULL; + + /* "spacy/vectors.pyx":419 + * if self.mode == Mode.floret: + * raise ValueError( + * Errors.E858.format( # <<<<<<<<<<<<<< + * mode=self.mode, + * alternative="Use Vectors[key] instead.", +*/ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_E858); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_5 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_5); + + /* "spacy/vectors.pyx":420 + * raise ValueError( + * Errors.E858.format( + * mode=self.mode, # <<<<<<<<<<<<<< + * alternative="Use Vectors[key] instead.", + * ) +*/ + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_5, NULL}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_v_self->mode, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 419, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alternative, __pyx_mstate_global->__pyx_kp_u_Use_Vectors_key_instead, __pyx_t_6, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 419, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 418, __pyx_L1_error) + + /* "spacy/vectors.pyx":417 + * RETURNS: The requested key, keys, row or rows. + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * raise ValueError( + * Errors.E858.format( +*/ + } + + /* "spacy/vectors.pyx":424 + * ) + * ) + * if sum(arg is None for arg in (key, keys, row, rows)) != 3: # <<<<<<<<<<<<<< + * bad_kwargs = {"key": key, "keys": keys, "row": row, "rows": rows} + * raise ValueError(Errors.E059.format(kwargs=bad_kwargs)) +*/ + __pyx_t_4 = NULL; + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key) != (0)) __PYX_ERR(0, 424, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_keys); + __Pyx_GIVEREF(__pyx_v_keys); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_keys) != (0)) __PYX_ERR(0, 424, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_row); + __Pyx_GIVEREF(__pyx_v_row); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_row) != (0)) __PYX_ERR(0, 424, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_rows); + __Pyx_GIVEREF(__pyx_v_rows); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_rows) != (0)) __PYX_ERR(0, 424, __pyx_L1_error); + __pyx_t_7 = __pyx_pf_5spacy_7vectors_7Vectors_4find_genexpr(NULL, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_sum, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_3, 3, 0)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_t_3)) { + + /* "spacy/vectors.pyx":425 + * ) + * if sum(arg is None for arg in (key, keys, row, rows)) != 3: + * bad_kwargs = {"key": key, "keys": keys, "row": row, "rows": rows} # <<<<<<<<<<<<<< + * raise ValueError(Errors.E059.format(kwargs=bad_kwargs)) + * xp = get_array_module(self.data) +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_key, __pyx_v_key) < (0)) __PYX_ERR(0, 425, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_keys, __pyx_v_keys) < (0)) __PYX_ERR(0, 425, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_row, __pyx_v_row) < (0)) __PYX_ERR(0, 425, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_rows, __pyx_v_rows) < (0)) __PYX_ERR(0, 425, __pyx_L1_error) + __pyx_v_bad_kwargs = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":426 + * if sum(arg is None for arg in (key, keys, row, rows)) != 3: + * bad_kwargs = {"key": key, "keys": keys, "row": row, "rows": rows} + * raise ValueError(Errors.E059.format(kwargs=bad_kwargs)) # <<<<<<<<<<<<<< + * xp = get_array_module(self.data) + * if key is not None: +*/ + __pyx_t_7 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_E059); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = __pyx_t_5; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_kwargs, __pyx_v_bad_kwargs, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 426, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 426, __pyx_L1_error) + + /* "spacy/vectors.pyx":424 + * ) + * ) + * if sum(arg is None for arg in (key, keys, row, rows)) != 3: # <<<<<<<<<<<<<< + * bad_kwargs = {"key": key, "keys": keys, "row": row, "rows": rows} + * raise ValueError(Errors.E059.format(kwargs=bad_kwargs)) +*/ + } + + /* "spacy/vectors.pyx":427 + * bad_kwargs = {"key": key, "keys": keys, "row": row, "rows": rows} + * raise ValueError(Errors.E059.format(kwargs=bad_kwargs)) + * xp = get_array_module(self.data) # <<<<<<<<<<<<<< + * if key is not None: + * key = get_string_id(key) +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_get_array_module); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_7, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_self->data}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_xp = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":428 + * raise ValueError(Errors.E059.format(kwargs=bad_kwargs)) + * xp = get_array_module(self.data) + * if key is not None: # <<<<<<<<<<<<<< + * key = get_string_id(key) + * return self.key2row.get(int(key), -1) +*/ + __pyx_t_3 = (__pyx_v_key != Py_None); + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":429 + * xp = get_array_module(self.data) + * if key is not None: + * key = get_string_id(key) # <<<<<<<<<<<<<< + * return self.key2row.get(int(key), -1) + * elif keys is not None: +*/ + __pyx_t_7 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_string_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_7); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_key}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":430 + * if key is not None: + * key = get_string_id(key) + * return self.key2row.get(int(key), -1) # <<<<<<<<<<<<<< + * elif keys is not None: + * keys = [get_string_id(key) for key in keys] +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_v_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_7, __pyx_mstate_global->__pyx_int_neg_1}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":428 + * raise ValueError(Errors.E059.format(kwargs=bad_kwargs)) + * xp = get_array_module(self.data) + * if key is not None: # <<<<<<<<<<<<<< + * key = get_string_id(key) + * return self.key2row.get(int(key), -1) +*/ + } + + /* "spacy/vectors.pyx":431 + * key = get_string_id(key) + * return self.key2row.get(int(key), -1) + * elif keys is not None: # <<<<<<<<<<<<<< + * keys = [get_string_id(key) for key in keys] + * rows = [self.key2row.get(int(key), -1) for key in keys] +*/ + __pyx_t_3 = (__pyx_v_keys != Py_None); + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":432 + * return self.key2row.get(int(key), -1) + * elif keys is not None: + * keys = [get_string_id(key) for key in keys] # <<<<<<<<<<<<<< + * rows = [self.key2row.get(int(key), -1) for key in keys] + * return xp.asarray(rows, dtype="i") +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_v_keys)) || PyTuple_CheckExact(__pyx_v_keys)) { + __pyx_t_7 = __pyx_v_keys; __Pyx_INCREF(__pyx_t_7); + __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_keys); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 432, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 432, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 432, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 432, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_10(__pyx_t_7); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 432, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_get_string_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_key}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF_SET(__pyx_v_keys, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":433 + * elif keys is not None: + * keys = [get_string_id(key) for key in keys] + * rows = [self.key2row.get(int(key), -1) for key in keys] # <<<<<<<<<<<<<< + * return xp.asarray(rows, dtype="i") + * else: +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_v_keys)) || PyTuple_CheckExact(__pyx_v_keys)) { + __pyx_t_7 = __pyx_v_keys; __Pyx_INCREF(__pyx_t_7); + __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_keys); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 433, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 433, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 433, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 433, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_10(__pyx_t_7); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 433, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_6 = __pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_5, __pyx_mstate_global->__pyx_int_neg_1}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF_SET(__pyx_v_rows, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":434 + * keys = [get_string_id(key) for key in keys] + * rows = [self.key2row.get(int(key), -1) for key in keys] + * return xp.asarray(rows, dtype="i") # <<<<<<<<<<<<<< + * else: + * row2key = {row: key for key, row in self.key2row.items()} +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_v_rows}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_i, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 434, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":431 + * key = get_string_id(key) + * return self.key2row.get(int(key), -1) + * elif keys is not None: # <<<<<<<<<<<<<< + * keys = [get_string_id(key) for key in keys] + * rows = [self.key2row.get(int(key), -1) for key in keys] +*/ + } + + /* "spacy/vectors.pyx":436 + * return xp.asarray(rows, dtype="i") + * else: + * row2key = {row: key for key, row in self.key2row.items()} # <<<<<<<<<<<<<< + * if row is not None: + * return row2key[row] +*/ + /*else*/ { + { /* enter inner scope */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 436, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_7 = __pyx_t_4; __Pyx_INCREF(__pyx_t_7); + __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 436, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 436, __pyx_L14_error) + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 436, __pyx_L14_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 436, __pyx_L14_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 436, __pyx_L14_error) + } else { + __pyx_t_4 = __pyx_t_10(__pyx_t_7); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 436, __pyx_L14_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 436, __pyx_L14_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_6); + } else { + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 436, __pyx_L14_error) + __Pyx_XGOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L14_error) + __Pyx_XGOTREF(__pyx_t_6); + } + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 436, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L14_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); + index = 0; __pyx_t_5 = __pyx_t_11(__pyx_t_2); if (unlikely(!__pyx_t_5)) goto __pyx_L17_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_11(__pyx_t_2); if (unlikely(!__pyx_t_6)) goto __pyx_L17_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_2), 2) < (0)) __PYX_ERR(0, 436, __pyx_L14_error) + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L18_unpacking_done; + __pyx_L17_unpacking_failed:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 436, __pyx_L14_error) + __pyx_L18_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_key, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_row, __pyx_t_6); + __pyx_t_6 = 0; + if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_8genexpr2__pyx_v_row, (PyObject*)__pyx_8genexpr2__pyx_v_key))) __PYX_ERR(0, 436, __pyx_L14_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_key); __pyx_8genexpr2__pyx_v_key = 0; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_row); __pyx_8genexpr2__pyx_v_row = 0; + goto __pyx_L20_exit_scope; + __pyx_L14_error:; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_key); __pyx_8genexpr2__pyx_v_key = 0; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_row); __pyx_8genexpr2__pyx_v_row = 0; + goto __pyx_L1_error; + __pyx_L20_exit_scope:; + } /* exit inner scope */ + __pyx_v_row2key = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":437 + * else: + * row2key = {row: key for key, row in self.key2row.items()} + * if row is not None: # <<<<<<<<<<<<<< + * return row2key[row] + * else: +*/ + __pyx_t_3 = (__pyx_v_row != Py_None); + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":438 + * row2key = {row: key for key, row in self.key2row.items()} + * if row is not None: + * return row2key[row] # <<<<<<<<<<<<<< + * else: + * results = [row2key[row] for row in rows] +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_row2key, __pyx_v_row); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":437 + * else: + * row2key = {row: key for key, row in self.key2row.items()} + * if row is not None: # <<<<<<<<<<<<<< + * return row2key[row] + * else: +*/ + } + + /* "spacy/vectors.pyx":440 + * return row2key[row] + * else: + * results = [row2key[row] for row in rows] # <<<<<<<<<<<<<< + * return xp.asarray(results, dtype="uint64") + * +*/ + /*else*/ { + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_v_rows)) || PyTuple_CheckExact(__pyx_v_rows)) { + __pyx_t_7 = __pyx_v_rows; __Pyx_INCREF(__pyx_t_7); + __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_rows); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 440, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 440, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 440, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 440, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_10(__pyx_t_7); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 440, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_row, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_row2key, __pyx_v_row); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_results = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":441 + * else: + * results = [row2key[row] for row in rows] + * return xp.asarray(results, dtype="uint64") # <<<<<<<<<<<<<< + * + * def _get_ngram_hashes(self, unicode s): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_v_results}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_uint64, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 441, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + } + + /* "spacy/vectors.pyx":404 + * yield key, self.data[row] + * + * def find(self, *, key=None, keys=None, row=None, rows=None): # <<<<<<<<<<<<<< + * """Look up one or more keys by row, or vice versa. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.vectors.Vectors.find", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_bad_kwargs); + __Pyx_XDECREF(__pyx_v_xp); + __Pyx_XDECREF(__pyx_v_row2key); + __Pyx_XDECREF(__pyx_v_results); + __Pyx_XDECREF(__pyx_gb_5spacy_7vectors_7Vectors_4find_2generator3); + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_key); + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_row); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_keys); + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XDECREF(__pyx_v_rows); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":443 + * return xp.asarray(results, dtype="uint64") + * + * def _get_ngram_hashes(self, unicode s): # <<<<<<<<<<<<<< + * """Calculate up to 4 32-bit hash values with MurmurHash3_x64_128 using + * the floret hash settings. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_30_get_ngram_hashes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_29_get_ngram_hashes, "Vectors._get_ngram_hashes(self, str s)\n\nCalculate up to 4 32-bit hash values with MurmurHash3_x64_128 using\nthe floret hash settings.\nkey (str): The string key.\nRETURNS: A list of the integer hashes."); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_30_get_ngram_hashes = {"_get_ngram_hashes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_30_get_ngram_hashes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_29_get_ngram_hashes}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_30_get_ngram_hashes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_s = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_ngram_hashes (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_s,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 443, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 443, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_ngram_hashes", 0) < (0)) __PYX_ERR(0, 443, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_ngram_hashes", 1, 1, 1, i); __PYX_ERR(0, 443, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 443, __pyx_L3_error) + } + __pyx_v_s = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_get_ngram_hashes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 443, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors._get_ngram_hashes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_s), (&PyUnicode_Type), 1, "s", 1))) __PYX_ERR(0, 443, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_29_get_ngram_hashes(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_s); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_29_get_ngram_hashes(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_s) { + uint64_t __pyx_v_out[2]; + PyObject *__pyx_v_chars = NULL; + char *__pyx_v_utf8_string; + PyObject *__pyx_v_rows = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + long __pyx_t_8; + uint32_t __pyx_t_9; + long __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_ngram_hashes", 0); + + /* "spacy/vectors.pyx":451 + * # MurmurHash3_x64_128 returns an array of 2 uint64_t values. + * cdef uint64_t[2] out + * chars = s.encode("utf8") # <<<<<<<<<<<<<< + * cdef char* utf8_string = chars + * hash128_x64(utf8_string, len(chars), self.hash_seed, &out) +*/ + if (unlikely(__pyx_v_s == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); + __PYX_ERR(0, 451, __pyx_L1_error) + } + __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_chars = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":452 + * cdef uint64_t[2] out + * chars = s.encode("utf8") + * cdef char* utf8_string = chars # <<<<<<<<<<<<<< + * hash128_x64(utf8_string, len(chars), self.hash_seed, &out) + * rows = [ +*/ + __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_chars); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_v_utf8_string = __pyx_t_2; + + /* "spacy/vectors.pyx":453 + * chars = s.encode("utf8") + * cdef char* utf8_string = chars + * hash128_x64(utf8_string, len(chars), self.hash_seed, &out) # <<<<<<<<<<<<<< + * rows = [ + * out[0] & 0xffffffffu, +*/ + __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(__pyx_v_chars); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 453, __pyx_L1_error) + __pyx_f_10murmurhash_4mrmr_hash128_x64(__pyx_v_utf8_string, __pyx_t_3, __pyx_v_self->hash_seed, (&__pyx_v_out)); + + /* "spacy/vectors.pyx":455 + * hash128_x64(utf8_string, len(chars), self.hash_seed, &out) + * rows = [ + * out[0] & 0xffffffffu, # <<<<<<<<<<<<<< + * out[0] >> 32, + * out[1] & 0xffffffffu, +*/ + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(((__pyx_v_out[0]) & 0xffffffffU)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "spacy/vectors.pyx":456 + * rows = [ + * out[0] & 0xffffffffu, + * out[0] >> 32, # <<<<<<<<<<<<<< + * out[1] & 0xffffffffu, + * out[1] >> 32, +*/ + __pyx_t_4 = __Pyx_PyLong_From_uint64_t(((__pyx_v_out[0]) >> 32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "spacy/vectors.pyx":457 + * out[0] & 0xffffffffu, + * out[0] >> 32, + * out[1] & 0xffffffffu, # <<<<<<<<<<<<<< + * out[1] >> 32, + * ] +*/ + __pyx_t_5 = __Pyx_PyLong_From_uint64_t(((__pyx_v_out[1]) & 0xffffffffU)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + + /* "spacy/vectors.pyx":458 + * out[0] >> 32, + * out[1] & 0xffffffffu, + * out[1] >> 32, # <<<<<<<<<<<<<< + * ] + * return rows[:min(self.hash_count, 4)] +*/ + __pyx_t_6 = __Pyx_PyLong_From_uint64_t(((__pyx_v_out[1]) >> 32)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + + /* "spacy/vectors.pyx":454 + * cdef char* utf8_string = chars + * hash128_x64(utf8_string, len(chars), self.hash_seed, &out) + * rows = [ # <<<<<<<<<<<<<< + * out[0] & 0xffffffffu, + * out[0] >> 32, +*/ + __pyx_t_7 = PyList_New(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 454, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 454, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 2, __pyx_t_5) != (0)) __PYX_ERR(0, 454, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 3, __pyx_t_6) != (0)) __PYX_ERR(0, 454, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_v_rows = ((PyObject*)__pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":460 + * out[1] >> 32, + * ] + * return rows[:min(self.hash_count, 4)] # <<<<<<<<<<<<<< + * + * def _get_ngrams(self, unicode key): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_8 = 4; + __pyx_t_9 = __pyx_v_self->hash_count; + __pyx_t_11 = (__pyx_t_8 < __pyx_t_9); + if (__pyx_t_11) { + __pyx_t_10 = __pyx_t_8; + } else { + __pyx_t_10 = __pyx_t_9; + } + __pyx_t_7 = __Pyx_PyList_GetSlice(__pyx_v_rows, 0, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 460, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":443 + * return xp.asarray(results, dtype="uint64") + * + * def _get_ngram_hashes(self, unicode s): # <<<<<<<<<<<<<< + * """Calculate up to 4 32-bit hash values with MurmurHash3_x64_128 using + * the floret hash settings. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.vectors.Vectors._get_ngram_hashes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_chars); + __Pyx_XDECREF(__pyx_v_rows); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":462 + * return rows[:min(self.hash_count, 4)] + * + * def _get_ngrams(self, unicode key): # <<<<<<<<<<<<<< + * """Get all padded ngram strings using the ngram settings. + * key (str): The string key. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_32_get_ngrams(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_31_get_ngrams, "Vectors._get_ngrams(self, str key)\n\nGet all padded ngram strings using the ngram settings.\nkey (str): The string key.\nRETURNS: A list of the ngram strings for the padded key."); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_32_get_ngrams = {"_get_ngrams", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_32_get_ngrams, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_31_get_ngrams}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_32_get_ngrams(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_key = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_ngrams (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 462, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 462, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_ngrams", 0) < (0)) __PYX_ERR(0, 462, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_ngrams", 1, 1, 1, i); __PYX_ERR(0, 462, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 462, __pyx_L3_error) + } + __pyx_v_key = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_get_ngrams", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 462, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors._get_ngrams", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyUnicode_Type), 1, "key", 1))) __PYX_ERR(0, 462, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_31_get_ngrams(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_key); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_31_get_ngrams(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_v_ngrams = NULL; + long __pyx_v_ngram_size; + Py_ssize_t __pyx_v_start; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_ngrams", 0); + __Pyx_INCREF(__pyx_v_key); + + /* "spacy/vectors.pyx":467 + * RETURNS: A list of the ngram strings for the padded key. + * """ + * key = self.bow + key + self.eow # <<<<<<<<<<<<<< + * ngrams = [key] + [ + * key[start:start+ngram_size] +*/ + __pyx_t_1 = __Pyx_PyUnicode_ConcatSafe(__pyx_v_self->bow, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_Concat__Pyx_ReferenceSharing_OwnStrongReferenceInPlaceSafe(__pyx_t_1, __pyx_v_self->eow); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_key, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":468 + * """ + * key = self.bow + key + self.eow + * ngrams = [key] + [ # <<<<<<<<<<<<<< + * key[start:start+ngram_size] + * for ngram_size in range(self.minn, self.maxn + 1) +*/ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_key) != (0)) __PYX_ERR(0, 468, __pyx_L1_error); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "spacy/vectors.pyx":470 + * ngrams = [key] + [ + * key[start:start+ngram_size] + * for ngram_size in range(self.minn, self.maxn + 1) # <<<<<<<<<<<<<< + * for start in range(0, len(key) - ngram_size + 1) + * ] +*/ + __pyx_t_3 = (__pyx_v_self->maxn + 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = __pyx_v_self->minn; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_ngram_size = __pyx_t_5; + + /* "spacy/vectors.pyx":471 + * key[start:start+ngram_size] + * for ngram_size in range(self.minn, self.maxn + 1) + * for start in range(0, len(key) - ngram_size + 1) # <<<<<<<<<<<<<< + * ] + * return ngrams +*/ + __pyx_t_6 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_key); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 471, __pyx_L1_error) + __pyx_t_7 = ((__pyx_t_6 - __pyx_v_ngram_size) + 1); + __pyx_t_6 = __pyx_t_7; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_6; __pyx_t_8+=1) { + __pyx_v_start = __pyx_t_8; + + /* "spacy/vectors.pyx":469 + * key = self.bow + key + self.eow + * ngrams = [key] + [ + * key[start:start+ngram_size] # <<<<<<<<<<<<<< + * for ngram_size in range(self.minn, self.maxn + 1) + * for start in range(0, len(key) - ngram_size + 1) +*/ + __pyx_t_9 = __Pyx_PyUnicode_Substring(__pyx_v_key, __pyx_v_start, (__pyx_v_start + __pyx_v_ngram_size)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 469, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 468, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + } + + /* "spacy/vectors.pyx":468 + * """ + * key = self.bow + key + self.eow + * ngrams = [key] + [ # <<<<<<<<<<<<<< + * key[start:start+ngram_size] + * for ngram_size in range(self.minn, self.maxn + 1) +*/ + __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 468, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_ngrams = ((PyObject*)__pyx_t_9); + __pyx_t_9 = 0; + + /* "spacy/vectors.pyx":473 + * for start in range(0, len(key) - ngram_size + 1) + * ] + * return ngrams # <<<<<<<<<<<<<< + * + * def get_batch(self, keys): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ngrams); + __pyx_r = __pyx_v_ngrams; + goto __pyx_L0; + + /* "spacy/vectors.pyx":462 + * return rows[:min(self.hash_count, 4)] + * + * def _get_ngrams(self, unicode key): # <<<<<<<<<<<<<< + * """Get all padded ngram strings using the ngram settings. + * key (str): The string key. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("spacy.vectors.Vectors._get_ngrams", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ngrams); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":475 + * return ngrams + * + * def get_batch(self, keys): # <<<<<<<<<<<<<< + * """Get the vectors for the provided keys efficiently as a batch. + * keys (Iterable[Union[int, str]]): The keys. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_34get_batch(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_33get_batch, "Vectors.get_batch(self, keys)\n\nGet the vectors for the provided keys efficiently as a batch.\nkeys (Iterable[Union[int, str]]): The keys.\nRETURNS: The requested vectors from the vector table."); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_34get_batch = {"get_batch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_34get_batch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_33get_batch}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_34get_batch(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_keys = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_batch (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_keys,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 475, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 475, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_batch", 0) < (0)) __PYX_ERR(0, 475, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_batch", 1, 1, 1, i); __PYX_ERR(0, 475, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 475, __pyx_L3_error) + } + __pyx_v_keys = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_batch", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 475, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.get_batch", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_33get_batch(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_keys); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_7vectors_7Vectors_9get_batch_2generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/vectors.pyx":486 + * elif self.mode == Mode.floret: + * keys = [self.strings.as_string(key) for key in keys] + * if sum(len(key) for key in keys) == 0: # <<<<<<<<<<<<<< + * return ops.xp.zeros((len(keys), self.data.shape[1])) + * unique_keys = tuple(set(keys)) +*/ + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_9get_batch_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("genexpr", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_4_genexpr(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 486, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0; + __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_7vectors_7Vectors_9get_batch_2generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_get_batch_locals_genexpr, __pyx_mstate_global->__pyx_n_u_spacy_vectors); if (unlikely(!gen)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.Vectors.get_batch.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_7vectors_7Vectors_9get_batch_2generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("genexpr", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 486, __pyx_L1_error) + } + if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 486, __pyx_L1_error) } + if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) { + __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 486, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_2; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 486, __pyx_L1_error) + #endif + if (__pyx_t_2 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); + #endif + ++__pyx_t_2; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 486, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 486, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_5 = PyObject_Length(__pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 486, __pyx_L1_error) + __pyx_t_4 = PyLong_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 486, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":475 + * return ngrams + * + * def get_batch(self, keys): # <<<<<<<<<<<<<< + * """Get the vectors for the provided keys efficiently as a batch. + * keys (Iterable[Union[int, str]]): The keys. +*/ + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_33get_batch(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_keys) { + PyObject *__pyx_v_ops = NULL; + PyObject *__pyx_v_rows = NULL; + PyObject *__pyx_v_vecs = NULL; + PyObject *__pyx_v_unique_keys = NULL; + PyObject *__pyx_v_row_index = NULL; + PyObject *__pyx_v_indices = NULL; + PyObject *__pyx_v_lengths = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_ngram_rows = NULL; + PyObject *__pyx_gb_5spacy_7vectors_7Vectors_9get_batch_2generator4 = 0; + PyObject *__pyx_8genexpr4__pyx_v_i = NULL; + PyObject *__pyx_8genexpr4__pyx_v_key = NULL; + PyObject *__pyx_v_ngram = NULL; + PyObject *__pyx_v_h = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + PyObject *(*__pyx_t_13)(PyObject *); + int __pyx_t_14; + PyObject *__pyx_t_15 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_batch", 0); + __Pyx_INCREF(__pyx_v_keys); + + /* "spacy/vectors.pyx":480 + * RETURNS: The requested vectors from the vector table. + * """ + * ops = get_array_ops(self.data) # <<<<<<<<<<<<<< + * if self.mode == Mode.default: + * rows = self.find(keys=keys) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_array_ops); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_self->data}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_ops = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":481 + * """ + * ops = get_array_ops(self.data) + * if self.mode == Mode.default: # <<<<<<<<<<<<<< + * rows = self.find(keys=keys) + * vecs = self.data[rows] +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_default); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "spacy/vectors.pyx":482 + * ops = get_array_ops(self.data) + * if self.mode == Mode.default: + * rows = self.find(keys=keys) # <<<<<<<<<<<<<< + * vecs = self.data[rows] + * elif self.mode == Mode.floret: +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_keys, __pyx_v_keys, __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 482, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_find, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_rows = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":483 + * if self.mode == Mode.default: + * rows = self.find(keys=keys) + * vecs = self.data[rows] # <<<<<<<<<<<<<< + * elif self.mode == Mode.floret: + * keys = [self.strings.as_string(key) for key in keys] +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_self->data, __pyx_v_rows); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_vecs = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":481 + * """ + * ops = get_array_ops(self.data) + * if self.mode == Mode.default: # <<<<<<<<<<<<<< + * rows = self.find(keys=keys) + * vecs = self.data[rows] +*/ + goto __pyx_L3; + } + + /* "spacy/vectors.pyx":484 + * rows = self.find(keys=keys) + * vecs = self.data[rows] + * elif self.mode == Mode.floret: # <<<<<<<<<<<<<< + * keys = [self.strings.as_string(key) for key in keys] + * if sum(len(key) for key in keys) == 0: +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 484, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "spacy/vectors.pyx":485 + * vecs = self.data[rows] + * elif self.mode == Mode.floret: + * keys = [self.strings.as_string(key) for key in keys] # <<<<<<<<<<<<<< + * if sum(len(key) for key in keys) == 0: + * return ops.xp.zeros((len(keys), self.data.shape[1])) +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 485, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_v_keys)) || PyTuple_CheckExact(__pyx_v_keys)) { + __pyx_t_2 = __pyx_v_keys; __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_keys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 485, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 485, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 485, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 485, __pyx_L1_error) + } else { + __pyx_t_3 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 485, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_8 = __pyx_v_self->strings; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_key}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_as_string, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 485, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 485, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_keys, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":486 + * elif self.mode == Mode.floret: + * keys = [self.strings.as_string(key) for key in keys] + * if sum(len(key) for key in keys) == 0: # <<<<<<<<<<<<<< + * return ops.xp.zeros((len(keys), self.data.shape[1])) + * unique_keys = tuple(set(keys)) +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = __pyx_pf_5spacy_7vectors_7Vectors_9get_batch_genexpr(NULL, __pyx_v_keys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_sum, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_5 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "spacy/vectors.pyx":487 + * keys = [self.strings.as_string(key) for key in keys] + * if sum(len(key) for key in keys) == 0: + * return ops.xp.zeros((len(keys), self.data.shape[1])) # <<<<<<<<<<<<<< + * unique_keys = tuple(set(keys)) + * row_index = {key: i for i, key in enumerate(unique_keys)} +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ops, __pyx_mstate_global->__pyx_n_u_xp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_6 = PyObject_Length(__pyx_v_keys); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_8 = PyLong_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_9, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8) != (0)) __PYX_ERR(0, 487, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10) != (0)) __PYX_ERR(0, 487, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_10 = 0; + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_9}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_zeros, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":486 + * elif self.mode == Mode.floret: + * keys = [self.strings.as_string(key) for key in keys] + * if sum(len(key) for key in keys) == 0: # <<<<<<<<<<<<<< + * return ops.xp.zeros((len(keys), self.data.shape[1])) + * unique_keys = tuple(set(keys)) +*/ + } + + /* "spacy/vectors.pyx":488 + * if sum(len(key) for key in keys) == 0: + * return ops.xp.zeros((len(keys), self.data.shape[1])) + * unique_keys = tuple(set(keys)) # <<<<<<<<<<<<<< + * row_index = {key: i for i, key in enumerate(unique_keys)} + * rows = [row_index[key] for key in keys] +*/ + __pyx_t_1 = PySet_New(__pyx_v_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_unique_keys = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":489 + * return ops.xp.zeros((len(keys), self.data.shape[1])) + * unique_keys = tuple(set(keys)) + * row_index = {key: i for i, key in enumerate(unique_keys)} # <<<<<<<<<<<<<< + * rows = [row_index[key] for key in keys] + * indices = [] +*/ + { /* enter inner scope */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_1 = __pyx_mstate_global->__pyx_int_0; + __pyx_t_9 = __pyx_v_unique_keys; __Pyx_INCREF(__pyx_t_9); + __pyx_t_6 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_9); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 489, __pyx_L10_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_6)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_6); + #endif + ++__pyx_t_6; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_key, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_i, __pyx_t_1); + __pyx_t_3 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_8genexpr4__pyx_v_key, (PyObject*)__pyx_8genexpr4__pyx_v_i))) __PYX_ERR(0, 489, __pyx_L10_error) + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_i); __pyx_8genexpr4__pyx_v_i = 0; + __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_key); __pyx_8genexpr4__pyx_v_key = 0; + goto __pyx_L14_exit_scope; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_i); __pyx_8genexpr4__pyx_v_i = 0; + __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_key); __pyx_8genexpr4__pyx_v_key = 0; + goto __pyx_L1_error; + __pyx_L14_exit_scope:; + } /* exit inner scope */ + __pyx_v_row_index = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":490 + * unique_keys = tuple(set(keys)) + * row_index = {key: i for i, key in enumerate(unique_keys)} + * rows = [row_index[key] for key in keys] # <<<<<<<<<<<<<< + * indices = [] + * lengths = [] +*/ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(PyList_CheckExact(__pyx_v_keys)) || PyTuple_CheckExact(__pyx_v_keys)) { + __pyx_t_1 = __pyx_v_keys; __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_keys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 490, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 490, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 490, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6)); + #else + __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 490, __pyx_L1_error) + } else { + __pyx_t_9 = __pyx_t_7(__pyx_t_1); + if (unlikely(!__pyx_t_9)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 490, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_9); + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_row_index, __pyx_v_key); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_rows = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":491 + * row_index = {key: i for i, key in enumerate(unique_keys)} + * rows = [row_index[key] for key in keys] + * indices = [] # <<<<<<<<<<<<<< + * lengths = [] + * for key in unique_keys: +*/ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 491, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_indices = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":492 + * rows = [row_index[key] for key in keys] + * indices = [] + * lengths = [] # <<<<<<<<<<<<<< + * for key in unique_keys: + * if key == "": +*/ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_lengths = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":493 + * indices = [] + * lengths = [] + * for key in unique_keys: # <<<<<<<<<<<<<< + * if key == "": + * ngram_rows = [] +*/ + __pyx_t_2 = __pyx_v_unique_keys; __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 493, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); + #endif + ++__pyx_t_6; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":494 + * lengths = [] + * for key in unique_keys: + * if key == "": # <<<<<<<<<<<<<< + * ngram_rows = [] + * else: +*/ + __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_mstate_global->__pyx_kp_u_, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 494, __pyx_L1_error) + if (__pyx_t_5) { + + /* "spacy/vectors.pyx":495 + * for key in unique_keys: + * if key == "": + * ngram_rows = [] # <<<<<<<<<<<<<< + * else: + * ngram_rows = [ +*/ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_ngram_rows, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":494 + * lengths = [] + * for key in unique_keys: + * if key == "": # <<<<<<<<<<<<<< + * ngram_rows = [] + * else: +*/ + goto __pyx_L20; + } + + /* "spacy/vectors.pyx":497 + * ngram_rows = [] + * else: + * ngram_rows = [ # <<<<<<<<<<<<<< + * h % self.data.shape[0] + * for ngram in self._get_ngrams(key) +*/ + /*else*/ { + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "spacy/vectors.pyx":499 + * ngram_rows = [ + * h % self.data.shape[0] + * for ngram in self._get_ngrams(key) # <<<<<<<<<<<<<< + * for h in self._get_ngram_hashes(ngram) + * ] +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_key}; + __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_ngrams, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + } + if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { + __pyx_t_3 = __pyx_t_9; __Pyx_INCREF(__pyx_t_3); + __pyx_t_11 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 499, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 499, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 499, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_11)); + #else + __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 499, __pyx_L1_error) + } else { + __pyx_t_9 = __pyx_t_7(__pyx_t_3); + if (unlikely(!__pyx_t_9)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 499, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_9); + __Pyx_XDECREF_SET(__pyx_v_ngram, __pyx_t_9); + __pyx_t_9 = 0; + + /* "spacy/vectors.pyx":500 + * h % self.data.shape[0] + * for ngram in self._get_ngrams(key) + * for h in self._get_ngram_hashes(ngram) # <<<<<<<<<<<<<< + * ] + * indices.extend(ngram_rows) +*/ + __pyx_t_10 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_10); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_ngram}; + __pyx_t_9 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_ngram_hashes, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + } + if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { + __pyx_t_10 = __pyx_t_9; __Pyx_INCREF(__pyx_t_10); + __pyx_t_12 = 0; + __pyx_t_13 = NULL; + } else { + __pyx_t_12 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 500, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + for (;;) { + if (likely(!__pyx_t_13)) { + if (likely(PyList_CheckExact(__pyx_t_10))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_10); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 500, __pyx_L1_error) + #endif + if (__pyx_t_12 >= __pyx_temp) break; + } + __pyx_t_9 = __Pyx_PyList_GetItemRefFast(__pyx_t_10, __pyx_t_12, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_12; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_10); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 500, __pyx_L1_error) + #endif + if (__pyx_t_12 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_12)); + #else + __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_12); + #endif + ++__pyx_t_12; + } + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 500, __pyx_L1_error) + } else { + __pyx_t_9 = __pyx_t_13(__pyx_t_10); + if (unlikely(!__pyx_t_9)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 500, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_9); + __Pyx_XDECREF_SET(__pyx_v_h, __pyx_t_9); + __pyx_t_9 = 0; + + /* "spacy/vectors.pyx":498 + * else: + * ngram_rows = [ + * h % self.data.shape[0] # <<<<<<<<<<<<<< + * for ngram in self._get_ngrams(key) + * for h in self._get_ngram_hashes(ngram) +*/ + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 498, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 498, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Remainder(__pyx_v_h, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 498, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 497, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "spacy/vectors.pyx":500 + * h % self.data.shape[0] + * for ngram in self._get_ngrams(key) + * for h in self._get_ngram_hashes(ngram) # <<<<<<<<<<<<<< + * ] + * indices.extend(ngram_rows) +*/ + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vectors.pyx":499 + * ngram_rows = [ + * h % self.data.shape[0] + * for ngram in self._get_ngrams(key) # <<<<<<<<<<<<<< + * for h in self._get_ngram_hashes(ngram) + * ] +*/ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_ngram_rows, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; + } + __pyx_L20:; + + /* "spacy/vectors.pyx":502 + * for h in self._get_ngram_hashes(ngram) + * ] + * indices.extend(ngram_rows) # <<<<<<<<<<<<<< + * lengths.append(len(ngram_rows)) + * indices = ops.asarray(indices, dtype="int32") +*/ + __pyx_t_3 = __pyx_v_indices; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_ngram_rows}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_extend, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":503 + * ] + * indices.extend(ngram_rows) + * lengths.append(len(ngram_rows)) # <<<<<<<<<<<<<< + * indices = ops.asarray(indices, dtype="int32") + * lengths = ops.asarray(lengths, dtype="int32") +*/ + __pyx_t_11 = __Pyx_PyList_GET_SIZE(__pyx_v_ngram_rows); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 503, __pyx_L1_error) + __pyx_t_1 = PyLong_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = __Pyx_PyObject_Append(__pyx_v_lengths, __pyx_t_1); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":493 + * indices = [] + * lengths = [] + * for key in unique_keys: # <<<<<<<<<<<<<< + * if key == "": + * ngram_rows = [] +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":504 + * indices.extend(ngram_rows) + * lengths.append(len(ngram_rows)) + * indices = ops.asarray(indices, dtype="int32") # <<<<<<<<<<<<<< + * lengths = ops.asarray(lengths, dtype="int32") + * vecs = ops.reduce_mean(cast(Floats2d, self.data[indices]), lengths) +*/ + __pyx_t_1 = __pyx_v_ops; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_v_indices}; + __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_int32, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 504, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF_SET(__pyx_v_indices, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":505 + * lengths.append(len(ngram_rows)) + * indices = ops.asarray(indices, dtype="int32") + * lengths = ops.asarray(lengths, dtype="int32") # <<<<<<<<<<<<<< + * vecs = ops.reduce_mean(cast(Floats2d, self.data[indices]), lengths) + * vecs = vecs[rows] +*/ + __pyx_t_3 = __pyx_v_ops; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_v_lengths}; + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_int32, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF_SET(__pyx_v_lengths, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":506 + * indices = ops.asarray(indices, dtype="int32") + * lengths = ops.asarray(lengths, dtype="int32") + * vecs = ops.reduce_mean(cast(Floats2d, self.data[indices]), lengths) # <<<<<<<<<<<<<< + * vecs = vecs[rows] + * return ops.as_contig(vecs) +*/ + __pyx_t_1 = __pyx_v_ops; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_10 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_cast); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Floats2d); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_v_self->data, __pyx_v_indices); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); + assert(__pyx_t_10); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_9, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_t_8, __pyx_t_15}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_3, __pyx_v_lengths}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_reduce_mean, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v_vecs = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":507 + * lengths = ops.asarray(lengths, dtype="int32") + * vecs = ops.reduce_mean(cast(Floats2d, self.data[indices]), lengths) + * vecs = vecs[rows] # <<<<<<<<<<<<<< + * return ops.as_contig(vecs) + * +*/ + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_vecs, __pyx_v_rows); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_vecs, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":484 + * rows = self.find(keys=keys) + * vecs = self.data[rows] + * elif self.mode == Mode.floret: # <<<<<<<<<<<<<< + * keys = [self.strings.as_string(key) for key in keys] + * if sum(len(key) for key in keys) == 0: +*/ + } + __pyx_L3:; + + /* "spacy/vectors.pyx":508 + * vecs = ops.reduce_mean(cast(Floats2d, self.data[indices]), lengths) + * vecs = vecs[rows] + * return ops.as_contig(vecs) # <<<<<<<<<<<<<< + * + * def add(self, key, *, vector=None, row=None): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __pyx_v_ops; + __Pyx_INCREF(__pyx_t_3); + if (unlikely(!__pyx_v_vecs)) { __Pyx_RaiseUnboundLocalError("vecs"); __PYX_ERR(0, 508, __pyx_L1_error) } + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_vecs}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_as_contig, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":475 + * return ngrams + * + * def get_batch(self, keys): # <<<<<<<<<<<<<< + * """Get the vectors for the provided keys efficiently as a batch. + * keys (Iterable[Union[int, str]]): The keys. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("spacy.vectors.Vectors.get_batch", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ops); + __Pyx_XDECREF(__pyx_v_rows); + __Pyx_XDECREF(__pyx_v_vecs); + __Pyx_XDECREF(__pyx_v_unique_keys); + __Pyx_XDECREF(__pyx_v_row_index); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XDECREF(__pyx_v_lengths); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_ngram_rows); + __Pyx_XDECREF(__pyx_gb_5spacy_7vectors_7Vectors_9get_batch_2generator4); + __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_i); + __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_key); + __Pyx_XDECREF(__pyx_v_ngram); + __Pyx_XDECREF(__pyx_v_h); + __Pyx_XDECREF(__pyx_v_keys); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":510 + * return ops.as_contig(vecs) + * + * def add(self, key, *, vector=None, row=None): # <<<<<<<<<<<<<< + * """Add a key to the table. Keys can be mapped to an existing vector + * by setting `row`, or a new vector can be added. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_36add(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_35add, "Vectors.add(self, key, *, vector=None, row=None)\n\nAdd a key to the table. Keys can be mapped to an existing vector\nby setting `row`, or a new vector can be added.\n\nkey (int): The key to add.\nvector (ndarray / None): A vector to add for the key.\nrow (int / None): The row number of a vector to map the key to.\nRETURNS (int): The row the vector was added to.\n\nDOCS: https://spacy.io/api/vectors#add"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_36add = {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_36add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_35add}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_36add(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_key = 0; + PyObject *__pyx_v_vector = 0; + PyObject *__pyx_v_row = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_key,&__pyx_mstate_global->__pyx_n_u_vector,&__pyx_mstate_global->__pyx_n_u_row,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 510, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 510, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "add", 0) < (0)) __PYX_ERR(0, 510, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, i); __PYX_ERR(0, 510, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 510, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_key = values[0]; + __pyx_v_vector = values[1]; + __pyx_v_row = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 510, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_35add(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_key, __pyx_v_vector, __pyx_v_row); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_35add(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_vector, PyObject *__pyx_v_row) { + PyObject *__pyx_v_xp = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("add", 0); + __Pyx_INCREF(__pyx_v_key); + __Pyx_INCREF(__pyx_v_vector); + __Pyx_INCREF(__pyx_v_row); + + /* "spacy/vectors.pyx":521 + * DOCS: https://spacy.io/api/vectors#add + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W115.format(method="Vectors.add")) + * return -1 +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":522 + * """ + * if self.mode == Mode.floret: + * warnings.warn(Warnings.W115.format(method="Vectors.add")) # <<<<<<<<<<<<<< + * return -1 + * # use int for all keys and rows in key2row for more efficient access +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Warnings); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_W115); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_method, __pyx_mstate_global->__pyx_kp_u_Vectors_add, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 522, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":523 + * if self.mode == Mode.floret: + * warnings.warn(Warnings.W115.format(method="Vectors.add")) + * return -1 # <<<<<<<<<<<<<< + * # use int for all keys and rows in key2row for more efficient access + * # and serialization +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __pyx_r = __pyx_mstate_global->__pyx_int_neg_1; + goto __pyx_L0; + + /* "spacy/vectors.pyx":521 + * DOCS: https://spacy.io/api/vectors#add + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * warnings.warn(Warnings.W115.format(method="Vectors.add")) + * return -1 +*/ + } + + /* "spacy/vectors.pyx":526 + * # use int for all keys and rows in key2row for more efficient access + * # and serialization + * key = int(get_string_id(key)) # <<<<<<<<<<<<<< + * if row is not None: + * row = int(row) +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_get_string_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_key}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":527 + * # and serialization + * key = int(get_string_id(key)) + * if row is not None: # <<<<<<<<<<<<<< + * row = int(row) + * if row is None and key in self.key2row: +*/ + __pyx_t_3 = (__pyx_v_row != Py_None); + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":528 + * key = int(get_string_id(key)) + * if row is not None: + * row = int(row) # <<<<<<<<<<<<<< + * if row is None and key in self.key2row: + * row = self.key2row[key] +*/ + __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_v_row); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_row, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":527 + * # and serialization + * key = int(get_string_id(key)) + * if row is not None: # <<<<<<<<<<<<<< + * row = int(row) + * if row is None and key in self.key2row: +*/ + } + + /* "spacy/vectors.pyx":529 + * if row is not None: + * row = int(row) + * if row is None and key in self.key2row: # <<<<<<<<<<<<<< + * row = self.key2row[key] + * elif row is None: +*/ + __pyx_t_10 = (__pyx_v_row == Py_None); + if (__pyx_t_10) { + } else { + __pyx_t_3 = __pyx_t_10; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_v_key, __pyx_v_self->key2row, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 529, __pyx_L1_error) + __pyx_t_3 = __pyx_t_10; + __pyx_L6_bool_binop_done:; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":530 + * row = int(row) + * if row is None and key in self.key2row: + * row = self.key2row[key] # <<<<<<<<<<<<<< + * elif row is None: + * if self.is_full: +*/ + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_self->key2row, __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_row, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":529 + * if row is not None: + * row = int(row) + * if row is None and key in self.key2row: # <<<<<<<<<<<<<< + * row = self.key2row[key] + * elif row is None: +*/ + goto __pyx_L5; + } + + /* "spacy/vectors.pyx":531 + * if row is None and key in self.key2row: + * row = self.key2row[key] + * elif row is None: # <<<<<<<<<<<<<< + * if self.is_full: + * raise ValueError(Errors.E060.format(rows=self.data.shape[0], +*/ + __pyx_t_3 = (__pyx_v_row == Py_None); + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":532 + * row = self.key2row[key] + * elif row is None: + * if self.is_full: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E060.format(rows=self.data.shape[0], + * cols=self.data.shape[1])) +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_full); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(__pyx_t_3)) { + + /* "spacy/vectors.pyx":533 + * elif row is None: + * if self.is_full: + * raise ValueError(Errors.E060.format(rows=self.data.shape[0], # <<<<<<<<<<<<<< + * cols=self.data.shape[1])) + * row = deref(self._unset.begin()) +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 533, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_E060); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 533, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_2 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 533, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 533, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/vectors.pyx":534 + * if self.is_full: + * raise ValueError(Errors.E060.format(rows=self.data.shape[0], + * cols=self.data.shape[1])) # <<<<<<<<<<<<<< + * row = deref(self._unset.begin()) + * if row < self.data.shape[0]: +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_8, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_2, NULL}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 533, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_rows, __pyx_t_6, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 533, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_cols, __pyx_t_11, __pyx_t_8, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 533, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 533, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 533, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 533, __pyx_L1_error) + + /* "spacy/vectors.pyx":532 + * row = self.key2row[key] + * elif row is None: + * if self.is_full: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E060.format(rows=self.data.shape[0], + * cols=self.data.shape[1])) +*/ + } + + /* "spacy/vectors.pyx":535 + * raise ValueError(Errors.E060.format(rows=self.data.shape[0], + * cols=self.data.shape[1])) + * row = deref(self._unset.begin()) # <<<<<<<<<<<<<< + * if row < self.data.shape[0]: + * self.key2row[key] = row +*/ + __pyx_t_4 = __Pyx_PyLong_From_int((*__pyx_v_self->_unset.begin())); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 535, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_row, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":531 + * if row is None and key in self.key2row: + * row = self.key2row[key] + * elif row is None: # <<<<<<<<<<<<<< + * if self.is_full: + * raise ValueError(Errors.E060.format(rows=self.data.shape[0], +*/ + } + __pyx_L5:; + + /* "spacy/vectors.pyx":536 + * cols=self.data.shape[1])) + * row = deref(self._unset.begin()) + * if row < self.data.shape[0]: # <<<<<<<<<<<<<< + * self.key2row[key] = row + * else: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_v_row, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (likely(__pyx_t_3)) { + + /* "spacy/vectors.pyx":537 + * row = deref(self._unset.begin()) + * if row < self.data.shape[0]: + * self.key2row[key] = row # <<<<<<<<<<<<<< + * else: + * raise ValueError(Errors.E197.format(row=row, key=key)) +*/ + if (unlikely((PyObject_SetItem(__pyx_v_self->key2row, __pyx_v_key, __pyx_v_row) < 0))) __PYX_ERR(0, 537, __pyx_L1_error) + + /* "spacy/vectors.pyx":536 + * cols=self.data.shape[1])) + * row = deref(self._unset.begin()) + * if row < self.data.shape[0]: # <<<<<<<<<<<<<< + * self.key2row[key] = row + * else: +*/ + goto __pyx_L9; + } + + /* "spacy/vectors.pyx":539 + * self.key2row[key] = row + * else: + * raise ValueError(Errors.E197.format(row=row, key=key)) # <<<<<<<<<<<<<< + * if vector is not None: + * xp = get_array_module(self.data) +*/ + /*else*/ { + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_E197); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_7 = __pyx_t_11; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_7, NULL}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_row, __pyx_v_row, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 539, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_key, __pyx_v_key, __pyx_t_8, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 539, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_1}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 539, __pyx_L1_error) + } + __pyx_L9:; + + /* "spacy/vectors.pyx":540 + * else: + * raise ValueError(Errors.E197.format(row=row, key=key)) + * if vector is not None: # <<<<<<<<<<<<<< + * xp = get_array_module(self.data) + * vector = xp.asarray(vector) +*/ + __pyx_t_3 = (__pyx_v_vector != Py_None); + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":541 + * raise ValueError(Errors.E197.format(row=row, key=key)) + * if vector is not None: + * xp = get_array_module(self.data) # <<<<<<<<<<<<<< + * vector = xp.asarray(vector) + * self.data[row] = vector +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_get_array_module); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 541, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_self->data}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 541, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_v_xp = __pyx_t_4; + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":542 + * if vector is not None: + * xp = get_array_module(self.data) + * vector = xp.asarray(vector) # <<<<<<<<<<<<<< + * self.data[row] = vector + * if self._unset.count(row): +*/ + __pyx_t_5 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_vector}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_vector, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":543 + * xp = get_array_module(self.data) + * vector = xp.asarray(vector) + * self.data[row] = vector # <<<<<<<<<<<<<< + * if self._unset.count(row): + * self._unset.erase(self._unset.find(row)) +*/ + if (unlikely((PyObject_SetItem(__pyx_v_self->data, __pyx_v_row, __pyx_v_vector) < 0))) __PYX_ERR(0, 543, __pyx_L1_error) + + /* "spacy/vectors.pyx":540 + * else: + * raise ValueError(Errors.E197.format(row=row, key=key)) + * if vector is not None: # <<<<<<<<<<<<<< + * xp = get_array_module(self.data) + * vector = xp.asarray(vector) +*/ + } + + /* "spacy/vectors.pyx":544 + * vector = xp.asarray(vector) + * self.data[row] = vector + * if self._unset.count(row): # <<<<<<<<<<<<<< + * self._unset.erase(self._unset.find(row)) + * return row +*/ + __pyx_t_12 = __Pyx_PyLong_As_int(__pyx_v_row); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 544, __pyx_L1_error) + __pyx_t_3 = (__pyx_v_self->_unset.count(__pyx_t_12) != 0); + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":545 + * self.data[row] = vector + * if self._unset.count(row): + * self._unset.erase(self._unset.find(row)) # <<<<<<<<<<<<<< + * return row + * +*/ + __pyx_t_12 = __Pyx_PyLong_As_int(__pyx_v_row); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 545, __pyx_L1_error) + (void)(__pyx_v_self->_unset.erase(__pyx_v_self->_unset.find(__pyx_t_12))); + + /* "spacy/vectors.pyx":544 + * vector = xp.asarray(vector) + * self.data[row] = vector + * if self._unset.count(row): # <<<<<<<<<<<<<< + * self._unset.erase(self._unset.find(row)) + * return row +*/ + } + + /* "spacy/vectors.pyx":546 + * if self._unset.count(row): + * self._unset.erase(self._unset.find(row)) + * return row # <<<<<<<<<<<<<< + * + * def most_similar(self, queries, *, batch_size=1024, n=1, sort=True): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_row); + __pyx_r = __pyx_v_row; + goto __pyx_L0; + + /* "spacy/vectors.pyx":510 + * return ops.as_contig(vecs) + * + * def add(self, key, *, vector=None, row=None): # <<<<<<<<<<<<<< + * """Add a key to the table. Keys can be mapped to an existing vector + * by setting `row`, or a new vector can be added. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.vectors.Vectors.add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_xp); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_vector); + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":548 + * return row + * + * def most_similar(self, queries, *, batch_size=1024, n=1, sort=True): # <<<<<<<<<<<<<< + * """For each of the given vectors, find the n most similar entries + * to it, by cosine. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_38most_similar(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_37most_similar, "Vectors.most_similar(self, queries, *, batch_size=1024, n=1, sort=True)\n\nFor each of the given vectors, find the n most similar entries\nto it, by cosine.\n\nQueries are by vector. Results are returned as a `(keys, best_rows,\nscores)` tuple. If `queries` is large, the calculations are performed in\nchunks, to avoid consuming too much memory. You can set the `batch_size`\nto control the size/space trade-off during the calculations.\n\nqueries (ndarray): An array with one or more vectors.\nbatch_size (int): The batch size to use.\nn (int): The number of entries to return for each query.\nsort (bool): Whether to sort the n entries returned by score.\nRETURNS (tuple): The most similar entries as a `(keys, best_rows, scores)`\n tuple."); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_38most_similar = {"most_similar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_38most_similar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_37most_similar}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_38most_similar(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_queries = 0; + PyObject *__pyx_v_batch_size = 0; + PyObject *__pyx_v_n = 0; + PyObject *__pyx_v_sort = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("most_similar (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_queries,&__pyx_mstate_global->__pyx_n_u_batch_size,&__pyx_mstate_global->__pyx_n_u_n,&__pyx_mstate_global->__pyx_n_u_sort,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 548, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 548, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "most_similar", 0) < (0)) __PYX_ERR(0, 548, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1024)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1)); + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("most_similar", 1, 1, 1, i); __PYX_ERR(0, 548, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 548, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1024)); + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1)); + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_True)); + } + __pyx_v_queries = values[0]; + __pyx_v_batch_size = values[1]; + __pyx_v_n = values[2]; + __pyx_v_sort = values[3]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("most_similar", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 548, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.most_similar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_37most_similar(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_queries, __pyx_v_batch_size, __pyx_v_n, __pyx_v_sort); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_37most_similar(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_queries, PyObject *__pyx_v_batch_size, PyObject *__pyx_v_n, PyObject *__pyx_v_sort) { + PyObject *__pyx_v_xp = NULL; + PyObject *__pyx_v_filled = NULL; + PyObject *__pyx_v_norms = NULL; + PyObject *__pyx_v_vectors = NULL; + PyObject *__pyx_v_best_rows = NULL; + PyObject *__pyx_v_scores = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_batch = NULL; + PyObject *__pyx_v_batch_norms = NULL; + PyObject *__pyx_v_sims = NULL; + PyObject *__pyx_v_sorted_index = NULL; + PyObject *__pyx_v_j = NULL; + PyObject *__pyx_v_row2key = NULL; + PyObject *__pyx_v_numpy_rows = NULL; + PyObject *__pyx_v_keys = NULL; + PyObject *__pyx_8genexpr5__pyx_v_row = NULL; + PyObject *__pyx_8genexpr6__pyx_v_key = NULL; + PyObject *__pyx_8genexpr6__pyx_v_row = NULL; + PyObject *__pyx_v_row = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + PyObject *(*__pyx_t_13)(PyObject *); + PyObject *(*__pyx_t_14)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("most_similar", 0); + + /* "spacy/vectors.pyx":564 + * tuple. + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E858.format( + * mode=self.mode, +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_t_3)) { + + /* "spacy/vectors.pyx":565 + * """ + * if self.mode == Mode.floret: + * raise ValueError(Errors.E858.format( # <<<<<<<<<<<<<< + * mode=self.mode, + * alternative="", +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_E858); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_5 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_5); + + /* "spacy/vectors.pyx":566 + * if self.mode == Mode.floret: + * raise ValueError(Errors.E858.format( + * mode=self.mode, # <<<<<<<<<<<<<< + * alternative="", + * )) +*/ + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_5, NULL}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_v_self->mode, __pyx_t_6, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 565, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alternative, __pyx_mstate_global->__pyx_kp_u_, __pyx_t_6, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 565, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 565, __pyx_L1_error) + + /* "spacy/vectors.pyx":564 + * tuple. + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E858.format( + * mode=self.mode, +*/ + } + + /* "spacy/vectors.pyx":569 + * alternative="", + * )) + * xp = get_array_module(self.data) # <<<<<<<<<<<<<< + * filled = sorted(list({row for row in self.key2row.values()})) + * if len(filled) < n: +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_get_array_module); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_2, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_self->data}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_xp = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":570 + * )) + * xp = get_array_module(self.data) + * filled = sorted(list({row for row in self.key2row.values()})) # <<<<<<<<<<<<<< + * if len(filled) < n: + * raise ValueError(Errors.E198.format(n=n, n_rows=len(filled))) +*/ + { /* enter inner scope */ + __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_values, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); + __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 570, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 570, __pyx_L6_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 570, __pyx_L6_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 570, __pyx_L6_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L6_error) + } else { + __pyx_t_2 = __pyx_t_10(__pyx_t_4); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 570, __pyx_L6_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_row, __pyx_t_2); + __pyx_t_2 = 0; + if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_8genexpr5__pyx_v_row))) __PYX_ERR(0, 570, __pyx_L6_error) + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_row); __pyx_8genexpr5__pyx_v_row = 0; + goto __pyx_L10_exit_scope; + __pyx_L6_error:; + __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_row); __pyx_8genexpr5__pyx_v_row = 0; + goto __pyx_L1_error; + __pyx_L10_exit_scope:; + } /* exit inner scope */ + __pyx_t_4 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely((PyList_Sort(__pyx_t_1) < 0))) __PYX_ERR(0, 570, __pyx_L1_error) + __pyx_v_filled = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":571 + * xp = get_array_module(self.data) + * filled = sorted(list({row for row in self.key2row.values()})) + * if len(filled) < n: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E198.format(n=n, n_rows=len(filled))) + * filled = xp.asarray(filled) +*/ + __pyx_t_9 = PyObject_Length(__pyx_v_filled); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 571, __pyx_L1_error) + __pyx_t_1 = PyLong_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_v_n, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 571, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(__pyx_t_3)) { + + /* "spacy/vectors.pyx":572 + * filled = sorted(list({row for row in self.key2row.values()})) + * if len(filled) < n: + * raise ValueError(Errors.E198.format(n=n, n_rows=len(filled))) # <<<<<<<<<<<<<< + * filled = xp.asarray(filled) + * +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_E198); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __pyx_t_5; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_9 = PyObject_Length(__pyx_v_filled); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 572, __pyx_L1_error) + __pyx_t_6 = PyLong_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_7, NULL}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_n, __pyx_v_n, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 572, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_n_rows, __pyx_t_6, __pyx_t_11, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 572, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_2}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 572, __pyx_L1_error) + + /* "spacy/vectors.pyx":571 + * xp = get_array_module(self.data) + * filled = sorted(list({row for row in self.key2row.values()})) + * if len(filled) < n: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E198.format(n=n, n_rows=len(filled))) + * filled = xp.asarray(filled) +*/ + } + + /* "spacy/vectors.pyx":573 + * if len(filled) < n: + * raise ValueError(Errors.E198.format(n=n, n_rows=len(filled))) + * filled = xp.asarray(filled) # <<<<<<<<<<<<<< + * + * norms = xp.linalg.norm(self.data[filled], axis=1, keepdims=True) +*/ + __pyx_t_2 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_filled}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_filled, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":575 + * filled = xp.asarray(filled) + * + * norms = xp.linalg.norm(self.data[filled], axis=1, keepdims=True) # <<<<<<<<<<<<<< + * norms[norms == 0] = 1 + * vectors = self.data[filled] / norms +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_xp, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_t_1; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_self->data, __pyx_v_filled); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 575, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_2, __pyx_t_5}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 575, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_11, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 575, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_keepdims, Py_True, __pyx_t_11, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 575, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_norm, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 575, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_v_norms = __pyx_t_4; + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":576 + * + * norms = xp.linalg.norm(self.data[filled], axis=1, keepdims=True) + * norms[norms == 0] = 1 # <<<<<<<<<<<<<< + * vectors = self.data[filled] / norms + * +*/ + __pyx_t_4 = __Pyx_PyLong_EqObjC(__pyx_v_norms, __pyx_mstate_global->__pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((PyObject_SetItem(__pyx_v_norms, __pyx_t_4, __pyx_mstate_global->__pyx_int_1) < 0))) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":577 + * norms = xp.linalg.norm(self.data[filled], axis=1, keepdims=True) + * norms[norms == 0] = 1 + * vectors = self.data[filled] / norms # <<<<<<<<<<<<<< + * + * best_rows = xp.zeros((queries.shape[0], n), dtype='i') +*/ + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_self->data, __pyx_v_filled); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_norms); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_vectors = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":579 + * vectors = self.data[filled] / norms + * + * best_rows = xp.zeros((queries.shape[0], n), dtype='i') # <<<<<<<<<<<<<< + * scores = xp.zeros((queries.shape[0], n), dtype='f') + * # Work in batches, to avoid memory problems. +*/ + __pyx_t_4 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_queries, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_11, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 579, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_n); + __Pyx_GIVEREF(__pyx_v_n); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_n) != (0)) __PYX_ERR(0, 579, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_t_11}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_i, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 579, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_zeros, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_best_rows = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":580 + * + * best_rows = xp.zeros((queries.shape[0], n), dtype='i') + * scores = xp.zeros((queries.shape[0], n), dtype='f') # <<<<<<<<<<<<<< + * # Work in batches, to avoid memory problems. + * for i in range(0, queries.shape[0], batch_size): +*/ + __pyx_t_5 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_queries, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 580, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_11, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 580, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 580, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 580, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_n); + __Pyx_GIVEREF(__pyx_v_n); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_n) != (0)) __PYX_ERR(0, 580, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_t_11}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 580, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_f, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 580, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_zeros, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_scores = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":582 + * scores = xp.zeros((queries.shape[0], n), dtype='f') + * # Work in batches, to avoid memory problems. + * for i in range(0, queries.shape[0], batch_size): # <<<<<<<<<<<<<< + * batch = queries[i : i+batch_size] + * batch_norms = xp.linalg.norm(batch, axis=1, keepdims=True) +*/ + __pyx_t_4 = NULL; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_queries, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_11, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_4, __pyx_mstate_global->__pyx_int_0, __pyx_t_5, __pyx_v_batch_size}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_8, (4-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + { + __pyx_t_1 = __pyx_t_10(__pyx_t_5); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 582, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":583 + * # Work in batches, to avoid memory problems. + * for i in range(0, queries.shape[0], batch_size): + * batch = queries[i : i+batch_size] # <<<<<<<<<<<<<< + * batch_norms = xp.linalg.norm(batch, axis=1, keepdims=True) + * batch_norms[batch_norms == 0] = 1 +*/ + __pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_v_batch_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_queries, 0, 0, &__pyx_v_i, &__pyx_t_1, NULL, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_batch, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":584 + * for i in range(0, queries.shape[0], batch_size): + * batch = queries[i : i+batch_size] + * batch_norms = xp.linalg.norm(batch, axis=1, keepdims=True) # <<<<<<<<<<<<<< + * batch_norms[batch_norms == 0] = 1 + * batch /= batch_norms +*/ + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_xp, __pyx_mstate_global->__pyx_n_u_linalg); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = __pyx_t_11; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_1, __pyx_v_batch}; + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_2, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 584, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_keepdims, Py_True, __pyx_t_2, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 584, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_norm, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_batch_norms, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":585 + * batch = queries[i : i+batch_size] + * batch_norms = xp.linalg.norm(batch, axis=1, keepdims=True) + * batch_norms[batch_norms == 0] = 1 # <<<<<<<<<<<<<< + * batch /= batch_norms + * # batch e.g. (1024, 300) +*/ + __pyx_t_4 = __Pyx_PyLong_EqObjC(__pyx_v_batch_norms, __pyx_mstate_global->__pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((PyObject_SetItem(__pyx_v_batch_norms, __pyx_t_4, __pyx_mstate_global->__pyx_int_1) < 0))) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":586 + * batch_norms = xp.linalg.norm(batch, axis=1, keepdims=True) + * batch_norms[batch_norms == 0] = 1 + * batch /= batch_norms # <<<<<<<<<<<<<< + * # batch e.g. (1024, 300) + * # vectors e.g. (10000, 300) +*/ + __pyx_t_4 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_batch, __pyx_v_batch_norms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 586, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_batch, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":590 + * # vectors e.g. (10000, 300) + * # sims e.g. (1024, 10000) + * sims = xp.dot(batch, vectors.T) # <<<<<<<<<<<<<< + * best_rows[i:i+batch_size] = xp.argpartition(sims, -n, axis=1)[:, -n:] + * scores[i:i+batch_size] = xp.partition(sims, -n, axis=1)[:, -n:] +*/ + __pyx_t_11 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_11); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_vectors, __pyx_mstate_global->__pyx_n_u_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 590, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_v_batch, __pyx_t_2}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_dot, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 590, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_sims, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":591 + * # sims e.g. (1024, 10000) + * sims = xp.dot(batch, vectors.T) + * best_rows[i:i+batch_size] = xp.argpartition(sims, -n, axis=1)[:, -n:] # <<<<<<<<<<<<<< + * scores[i:i+batch_size] = xp.partition(sims, -n, axis=1)[:, -n:] + * +*/ + __pyx_t_2 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_11 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_sims, __pyx_t_11}; + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_1, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 591, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_argpartition, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_1 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = PySlice_New(__pyx_t_1, Py_None, Py_None); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(0, 591, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 591, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_v_batch_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetSlice(__pyx_v_best_rows, __pyx_t_11, 0, 0, &__pyx_v_i, &__pyx_t_1, NULL, 0, 0, 1) < (0)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/vectors.pyx":592 + * sims = xp.dot(batch, vectors.T) + * best_rows[i:i+batch_size] = xp.argpartition(sims, -n, axis=1)[:, -n:] + * scores[i:i+batch_size] = xp.partition(sims, -n, axis=1)[:, -n:] # <<<<<<<<<<<<<< + * + * if sort and n >= 2: +*/ + __pyx_t_1 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_v_sims, __pyx_t_4}; + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_2, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_11 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_partition, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __pyx_t_2 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PySlice_New(__pyx_t_2, Py_None, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(0, 592, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 592, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_11, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_v_i, __pyx_v_batch_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetSlice(__pyx_v_scores, __pyx_t_4, 0, 0, &__pyx_v_i, &__pyx_t_2, NULL, 0, 0, 1) < (0)) __PYX_ERR(0, 592, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":594 + * scores[i:i+batch_size] = xp.partition(sims, -n, axis=1)[:, -n:] + * + * if sort and n >= 2: # <<<<<<<<<<<<<< + * sorted_index = xp.arange(scores.shape[0])[:, None][i:i+batch_size], \ + * xp.argsort(scores[i:i+batch_size], axis=1)[:, ::-1] +*/ + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_sort); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 594, __pyx_L1_error) + if (__pyx_t_12) { + } else { + __pyx_t_3 = __pyx_t_12; + goto __pyx_L15_bool_binop_done; + } + __pyx_t_4 = PyObject_RichCompare(__pyx_v_n, __pyx_mstate_global->__pyx_int_2, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 594, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __pyx_t_12; + __pyx_L15_bool_binop_done:; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":595 + * + * if sort and n >= 2: + * sorted_index = xp.arange(scores.shape[0])[:, None][i:i+batch_size], \ # <<<<<<<<<<<<<< + * xp.argsort(scores[i:i+batch_size], axis=1)[:, ::-1] + * scores[i:i+batch_size] = scores[sorted_index] +*/ + __pyx_t_2 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_scores, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_11, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_arange, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[2]); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_v_i, __pyx_v_batch_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, &__pyx_v_i, &__pyx_t_4, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":596 + * if sort and n >= 2: + * sorted_index = xp.arange(scores.shape[0])[:, None][i:i+batch_size], \ + * xp.argsort(scores[i:i+batch_size], axis=1)[:, ::-1] # <<<<<<<<<<<<<< + * scores[i:i+batch_size] = scores[sorted_index] + * best_rows[i:i+batch_size] = best_rows[sorted_index] +*/ + __pyx_t_1 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_11 = PyNumber_Add(__pyx_v_i, __pyx_v_batch_size); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_scores, 0, 0, &__pyx_v_i, &__pyx_t_11, NULL, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_t_6}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_1, __pyx_t_11, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 596, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_argsort, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3]); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":595 + * + * if sort and n >= 2: + * sorted_index = xp.arange(scores.shape[0])[:, None][i:i+batch_size], \ # <<<<<<<<<<<<<< + * xp.argsort(scores[i:i+batch_size], axis=1)[:, ::-1] + * scores[i:i+batch_size] = scores[sorted_index] +*/ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 595, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 595, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_11 = 0; + __Pyx_XDECREF_SET(__pyx_v_sorted_index, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":597 + * sorted_index = xp.arange(scores.shape[0])[:, None][i:i+batch_size], \ + * xp.argsort(scores[i:i+batch_size], axis=1)[:, ::-1] + * scores[i:i+batch_size] = scores[sorted_index] # <<<<<<<<<<<<<< + * best_rows[i:i+batch_size] = best_rows[sorted_index] + * +*/ + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_scores, __pyx_v_sorted_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = PyNumber_Add(__pyx_v_i, __pyx_v_batch_size); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_PyObject_SetSlice(__pyx_v_scores, __pyx_t_4, 0, 0, &__pyx_v_i, &__pyx_t_11, NULL, 0, 0, 1) < (0)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":598 + * xp.argsort(scores[i:i+batch_size], axis=1)[:, ::-1] + * scores[i:i+batch_size] = scores[sorted_index] + * best_rows[i:i+batch_size] = best_rows[sorted_index] # <<<<<<<<<<<<<< + * + * for i, j in numpy.ndindex(best_rows.shape): +*/ + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_best_rows, __pyx_v_sorted_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = PyNumber_Add(__pyx_v_i, __pyx_v_batch_size); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_PyObject_SetSlice(__pyx_v_best_rows, __pyx_t_4, 0, 0, &__pyx_v_i, &__pyx_t_11, NULL, 0, 0, 1) < (0)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":594 + * scores[i:i+batch_size] = xp.partition(sims, -n, axis=1)[:, -n:] + * + * if sort and n >= 2: # <<<<<<<<<<<<<< + * sorted_index = xp.arange(scores.shape[0])[:, None][i:i+batch_size], \ + * xp.argsort(scores[i:i+batch_size], axis=1)[:, ::-1] +*/ + } + + /* "spacy/vectors.pyx":582 + * scores = xp.zeros((queries.shape[0], n), dtype='f') + * # Work in batches, to avoid memory problems. + * for i in range(0, queries.shape[0], batch_size): # <<<<<<<<<<<<<< + * batch = queries[i : i+batch_size] + * batch_norms = xp.linalg.norm(batch, axis=1, keepdims=True) +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vectors.pyx":600 + * best_rows[i:i+batch_size] = best_rows[sorted_index] + * + * for i, j in numpy.ndindex(best_rows.shape): # <<<<<<<<<<<<<< + * best_rows[i, j] = filled[best_rows[i, j]] + * # Round values really close to 1 or -1 +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_ndindex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_best_rows, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_2, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_11}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_2 = __pyx_t_5; __Pyx_INCREF(__pyx_t_2); + __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 600, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 600, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 600, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 600, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_10(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 600, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 600, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_4); + } + #else + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); + index = 0; __pyx_t_11 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_11)) goto __pyx_L20_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + index = 1; __pyx_t_4 = __pyx_t_13(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L20_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_6), 2) < (0)) __PYX_ERR(0, 600, __pyx_L1_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L21_unpacking_done; + __pyx_L20_unpacking_failed:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 600, __pyx_L1_error) + __pyx_L21_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_11); + __pyx_t_11 = 0; + __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":601 + * + * for i, j in numpy.ndindex(best_rows.shape): + * best_rows[i, j] = filled[best_rows[i, j]] # <<<<<<<<<<<<<< + * # Round values really close to 1 or -1 + * scores = xp.around(scores, decimals=4, out=scores) +*/ + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 601, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_j); + __Pyx_GIVEREF(__pyx_v_j); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 601, __pyx_L1_error); + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_best_rows, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_filled, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i) != (0)) __PYX_ERR(0, 601, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_j); + __Pyx_GIVEREF(__pyx_v_j); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_j) != (0)) __PYX_ERR(0, 601, __pyx_L1_error); + if (unlikely((PyObject_SetItem(__pyx_v_best_rows, __pyx_t_4, __pyx_t_5) < 0))) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vectors.pyx":600 + * best_rows[i:i+batch_size] = best_rows[sorted_index] + * + * for i, j in numpy.ndindex(best_rows.shape): # <<<<<<<<<<<<<< + * best_rows[i, j] = filled[best_rows[i, j]] + * # Round values really close to 1 or -1 +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":603 + * best_rows[i, j] = filled[best_rows[i, j]] + * # Round values really close to 1 or -1 + * scores = xp.around(scores, decimals=4, out=scores) # <<<<<<<<<<<<<< + * # Account for numerical error we want to return in range -1, 1 + * scores = xp.clip(scores, a_min=-1, a_max=1, out=scores) +*/ + __pyx_t_5 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_5, __pyx_v_scores}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_decimals, __pyx_mstate_global->__pyx_int_4, __pyx_t_4, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 603, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_out, __pyx_v_scores, __pyx_t_4, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 603, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_around, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF_SET(__pyx_v_scores, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":605 + * scores = xp.around(scores, decimals=4, out=scores) + * # Account for numerical error we want to return in range -1, 1 + * scores = xp.clip(scores, a_min=-1, a_max=1, out=scores) # <<<<<<<<<<<<<< + * row2key = {row: key for key, row in self.key2row.items()} + * +*/ + __pyx_t_4 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_4, __pyx_v_scores}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_a_min, __pyx_mstate_global->__pyx_int_neg_1, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 605, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_a_max, __pyx_mstate_global->__pyx_int_1, __pyx_t_5, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 605, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_out, __pyx_v_scores, __pyx_t_5, __pyx_callargs+2, 2) < (0)) __PYX_ERR(0, 605, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_clip, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF_SET(__pyx_v_scores, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":606 + * # Account for numerical error we want to return in range -1, 1 + * scores = xp.clip(scores, a_min=-1, a_max=1, out=scores) + * row2key = {row: key for key, row in self.key2row.items()} # <<<<<<<<<<<<<< + * + * numpy_rows = get_current_ops().to_numpy(best_rows) +*/ + { /* enter inner scope */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L25_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 606, __pyx_L25_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); + __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 606, __pyx_L25_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 606, __pyx_L25_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 606, __pyx_L25_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 606, __pyx_L25_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 606, __pyx_L25_error) + } else { + __pyx_t_5 = __pyx_t_10(__pyx_t_4); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 606, __pyx_L25_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 606, __pyx_L25_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_6); + } else { + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 606, __pyx_L25_error) + __Pyx_XGOTREF(__pyx_t_11); + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 606, __pyx_L25_error) + __Pyx_XGOTREF(__pyx_t_6); + } + #else + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 606, __pyx_L25_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 606, __pyx_L25_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L25_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); + index = 0; __pyx_t_11 = __pyx_t_13(__pyx_t_1); if (unlikely(!__pyx_t_11)) goto __pyx_L28_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + index = 1; __pyx_t_6 = __pyx_t_13(__pyx_t_1); if (unlikely(!__pyx_t_6)) goto __pyx_L28_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_1), 2) < (0)) __PYX_ERR(0, 606, __pyx_L25_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L29_unpacking_done; + __pyx_L28_unpacking_failed:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 606, __pyx_L25_error) + __pyx_L29_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_key, __pyx_t_11); + __pyx_t_11 = 0; + __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_row, __pyx_t_6); + __pyx_t_6 = 0; + if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_8genexpr6__pyx_v_row, (PyObject*)__pyx_8genexpr6__pyx_v_key))) __PYX_ERR(0, 606, __pyx_L25_error) + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_key); __pyx_8genexpr6__pyx_v_key = 0; + __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_row); __pyx_8genexpr6__pyx_v_row = 0; + goto __pyx_L31_exit_scope; + __pyx_L25_error:; + __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_key); __pyx_8genexpr6__pyx_v_key = 0; + __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_row); __pyx_8genexpr6__pyx_v_row = 0; + goto __pyx_L1_error; + __pyx_L31_exit_scope:; + } /* exit inner scope */ + __pyx_v_row2key = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":608 + * row2key = {row: key for key, row in self.key2row.items()} + * + * numpy_rows = get_current_ops().to_numpy(best_rows) # <<<<<<<<<<<<<< + * keys = xp.asarray( + * [ +*/ + __pyx_t_6 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_get_current_ops); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11); + assert(__pyx_t_6); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_11, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_4 = __pyx_t_5; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_best_rows}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_numpy, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v_numpy_rows = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":609 + * + * numpy_rows = get_current_ops().to_numpy(best_rows) + * keys = xp.asarray( # <<<<<<<<<<<<<< + * [ + * [row2key[row] for row in numpy_rows[i] if row in row2key] +*/ + __pyx_t_5 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_5); + + /* "spacy/vectors.pyx":610 + * numpy_rows = get_current_ops().to_numpy(best_rows) + * keys = xp.asarray( + * [ # <<<<<<<<<<<<<< + * [row2key[row] for row in numpy_rows[i] if row in row2key] + * for i in range(len(queries)) +*/ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 610, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "spacy/vectors.pyx":612 + * [ + * [row2key[row] for row in numpy_rows[i] if row in row2key] + * for i in range(len(queries)) # <<<<<<<<<<<<<< + * ], + * dtype="uint64" +*/ + __pyx_t_6 = NULL; + __pyx_t_9 = PyObject_Length(__pyx_v_queries); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 612, __pyx_L1_error) + __pyx_t_1 = PyLong_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_1}; + __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 612, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __pyx_t_1 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 612, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + for (;;) { + { + __pyx_t_11 = __pyx_t_10(__pyx_t_1); + if (unlikely(!__pyx_t_11)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 612, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_11); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_11); + __pyx_t_11 = 0; + + /* "spacy/vectors.pyx":611 + * keys = xp.asarray( + * [ + * [row2key[row] for row in numpy_rows[i] if row in row2key] # <<<<<<<<<<<<<< + * for i in range(len(queries)) + * ], +*/ + __pyx_t_11 = PyList_New(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_numpy_rows, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_7 = __pyx_t_6; __Pyx_INCREF(__pyx_t_7); + __pyx_t_9 = 0; + __pyx_t_14 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 611, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(!__pyx_t_14)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 611, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_9, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_9; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 611, __pyx_L1_error) + #endif + if (__pyx_t_9 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9)); + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_9); + #endif + ++__pyx_t_9; + } + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 611, __pyx_L1_error) + } else { + __pyx_t_6 = __pyx_t_14(__pyx_t_7); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 611, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_v_row, __pyx_v_row2key, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 611, __pyx_L1_error) + if (__pyx_t_3) { + __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_row2key, __pyx_v_row); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_11, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_11))) __PYX_ERR(0, 610, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "spacy/vectors.pyx":612 + * [ + * [row2key[row] for row in numpy_rows[i] if row in row2key] + * for i in range(len(queries)) # <<<<<<<<<<<<<< + * ], + * dtype="uint64" +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_uint64, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 609, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v_keys = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":616 + * dtype="uint64" + * ) + * return (keys, best_rows, scores) # <<<<<<<<<<<<<< + * + * def to_ops(self, ops: Ops): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_keys); + __Pyx_GIVEREF(__pyx_v_keys); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_keys) != (0)) __PYX_ERR(0, 616, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_best_rows); + __Pyx_GIVEREF(__pyx_v_best_rows); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_best_rows) != (0)) __PYX_ERR(0, 616, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_scores); + __Pyx_GIVEREF(__pyx_v_scores); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_scores) != (0)) __PYX_ERR(0, 616, __pyx_L1_error); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":548 + * return row + * + * def most_similar(self, queries, *, batch_size=1024, n=1, sort=True): # <<<<<<<<<<<<<< + * """For each of the given vectors, find the n most similar entries + * to it, by cosine. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.vectors.Vectors.most_similar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_xp); + __Pyx_XDECREF(__pyx_v_filled); + __Pyx_XDECREF(__pyx_v_norms); + __Pyx_XDECREF(__pyx_v_vectors); + __Pyx_XDECREF(__pyx_v_best_rows); + __Pyx_XDECREF(__pyx_v_scores); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_batch); + __Pyx_XDECREF(__pyx_v_batch_norms); + __Pyx_XDECREF(__pyx_v_sims); + __Pyx_XDECREF(__pyx_v_sorted_index); + __Pyx_XDECREF(__pyx_v_j); + __Pyx_XDECREF(__pyx_v_row2key); + __Pyx_XDECREF(__pyx_v_numpy_rows); + __Pyx_XDECREF(__pyx_v_keys); + __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_row); + __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_key); + __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_row); + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":618 + * return (keys, best_rows, scores) + * + * def to_ops(self, ops: Ops): # <<<<<<<<<<<<<< + * self.data = ops.asarray(self.data) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_40to_ops(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_39to_ops, "Vectors.to_ops(self, ops: Ops)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_40to_ops = {"to_ops", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_40to_ops, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_39to_ops}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_40to_ops(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_ops = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_ops (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ops,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 618, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 618, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "to_ops", 0) < (0)) __PYX_ERR(0, 618, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("to_ops", 1, 1, 1, i); __PYX_ERR(0, 618, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 618, __pyx_L3_error) + } + __pyx_v_ops = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_ops", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 618, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.to_ops", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_39to_ops(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_ops); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_39to_ops(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_ops) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_ops", 0); + + /* "spacy/vectors.pyx":619 + * + * def to_ops(self, ops: Ops): + * self.data = ops.asarray(self.data) # <<<<<<<<<<<<<< + * + * def _get_cfg(self): +*/ + __pyx_t_2 = __pyx_v_ops; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_self->data}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(__pyx_v_self->data); + __pyx_v_self->data = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":618 + * return (keys, best_rows, scores) + * + * def to_ops(self, ops: Ops): # <<<<<<<<<<<<<< + * self.data = ops.asarray(self.data) + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_ops", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":621 + * self.data = ops.asarray(self.data) + * + * def _get_cfg(self): # <<<<<<<<<<<<<< + * if self.mode == Mode.default: + * return { +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_42_get_cfg(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_41_get_cfg, "Vectors._get_cfg(self)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_42_get_cfg = {"_get_cfg", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_42_get_cfg, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_41_get_cfg}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_42_get_cfg(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_cfg (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_get_cfg", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_get_cfg", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_41_get_cfg(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_41_get_cfg(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_cfg", 0); + + /* "spacy/vectors.pyx":622 + * + * def _get_cfg(self): + * if self.mode == Mode.default: # <<<<<<<<<<<<<< + * return { + * "mode": Mode(self.mode).value, +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 622, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":623 + * def _get_cfg(self): + * if self.mode == Mode.default: + * return { # <<<<<<<<<<<<<< + * "mode": Mode(self.mode).value, + * } +*/ + __Pyx_XDECREF(__pyx_r); + + /* "spacy/vectors.pyx":624 + * if self.mode == Mode.default: + * return { + * "mode": Mode(self.mode).value, # <<<<<<<<<<<<<< + * } + * elif self.mode == Mode.floret: +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_self->mode}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_mode, __pyx_t_5) < (0)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":622 + * + * def _get_cfg(self): + * if self.mode == Mode.default: # <<<<<<<<<<<<<< + * return { + * "mode": Mode(self.mode).value, +*/ + } + + /* "spacy/vectors.pyx":626 + * "mode": Mode(self.mode).value, + * } + * elif self.mode == Mode.floret: # <<<<<<<<<<<<<< + * return { + * "mode": Mode(self.mode).value, +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 626, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 626, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "spacy/vectors.pyx":627 + * } + * elif self.mode == Mode.floret: + * return { # <<<<<<<<<<<<<< + * "mode": Mode(self.mode).value, + * "minn": self.minn, +*/ + __Pyx_XDECREF(__pyx_r); + + /* "spacy/vectors.pyx":628 + * elif self.mode == Mode.floret: + * return { + * "mode": Mode(self.mode).value, # <<<<<<<<<<<<<< + * "minn": self.minn, + * "maxn": self.maxn, +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_self->mode}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_mode, __pyx_t_4) < (0)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":629 + * return { + * "mode": Mode(self.mode).value, + * "minn": self.minn, # <<<<<<<<<<<<<< + * "maxn": self.maxn, + * "hash_count": self.hash_count, +*/ + __pyx_t_4 = __Pyx_PyLong_From_uint32_t(__pyx_v_self->minn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_minn, __pyx_t_4) < (0)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":630 + * "mode": Mode(self.mode).value, + * "minn": self.minn, + * "maxn": self.maxn, # <<<<<<<<<<<<<< + * "hash_count": self.hash_count, + * "hash_seed": self.hash_seed, +*/ + __pyx_t_4 = __Pyx_PyLong_From_uint32_t(__pyx_v_self->maxn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_maxn, __pyx_t_4) < (0)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":631 + * "minn": self.minn, + * "maxn": self.maxn, + * "hash_count": self.hash_count, # <<<<<<<<<<<<<< + * "hash_seed": self.hash_seed, + * "bow": self.bow, +*/ + __pyx_t_4 = __Pyx_PyLong_From_uint32_t(__pyx_v_self->hash_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_hash_count, __pyx_t_4) < (0)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":632 + * "maxn": self.maxn, + * "hash_count": self.hash_count, + * "hash_seed": self.hash_seed, # <<<<<<<<<<<<<< + * "bow": self.bow, + * "eow": self.eow, +*/ + __pyx_t_4 = __Pyx_PyLong_From_uint32_t(__pyx_v_self->hash_seed); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_hash_seed, __pyx_t_4) < (0)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":633 + * "hash_count": self.hash_count, + * "hash_seed": self.hash_seed, + * "bow": self.bow, # <<<<<<<<<<<<<< + * "eow": self.eow, + * "attr": self.attr, +*/ + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_bow, __pyx_v_self->bow) < (0)) __PYX_ERR(0, 628, __pyx_L1_error) + + /* "spacy/vectors.pyx":634 + * "hash_seed": self.hash_seed, + * "bow": self.bow, + * "eow": self.eow, # <<<<<<<<<<<<<< + * "attr": self.attr, + * } +*/ + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_eow, __pyx_v_self->eow) < (0)) __PYX_ERR(0, 628, __pyx_L1_error) + + /* "spacy/vectors.pyx":635 + * "bow": self.bow, + * "eow": self.eow, + * "attr": self.attr, # <<<<<<<<<<<<<< + * } + * +*/ + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_v_self->attr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_attr, __pyx_t_4) < (0)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":626 + * "mode": Mode(self.mode).value, + * } + * elif self.mode == Mode.floret: # <<<<<<<<<<<<<< + * return { + * "mode": Mode(self.mode).value, +*/ + } + + /* "spacy/vectors.pyx":621 + * self.data = ops.asarray(self.data) + * + * def _get_cfg(self): # <<<<<<<<<<<<<< + * if self.mode == Mode.default: + * return { +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.vectors.Vectors._get_cfg", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":638 + * } + * + * def _set_cfg(self, cfg): # <<<<<<<<<<<<<< + * self.mode = Mode(cfg.get("mode", Mode.default)).value + * self.minn = cfg.get("minn", 0) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_44_set_cfg(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_43_set_cfg, "Vectors._set_cfg(self, cfg)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_44_set_cfg = {"_set_cfg", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_44_set_cfg, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_43_set_cfg}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_44_set_cfg(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_cfg = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_set_cfg (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_cfg,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 638, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 638, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_set_cfg", 0) < (0)) __PYX_ERR(0, 638, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_set_cfg", 1, 1, 1, i); __PYX_ERR(0, 638, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 638, __pyx_L3_error) + } + __pyx_v_cfg = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_set_cfg", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 638, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors._set_cfg", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_43_set_cfg(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_cfg); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_43_set_cfg(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_cfg) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + size_t __pyx_t_8; + uint32_t __pyx_t_9; + enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_set_cfg", 0); + + /* "spacy/vectors.pyx":639 + * + * def _set_cfg(self, cfg): + * self.mode = Mode(cfg.get("mode", Mode.default)).value # <<<<<<<<<<<<<< + * self.minn = cfg.get("minn", 0) + * self.maxn = cfg.get("maxn", 0) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __pyx_v_cfg; + __Pyx_INCREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_default); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_mode, __pyx_t_7}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_8 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_8 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/vectors.pyx":640 + * def _set_cfg(self, cfg): + * self.mode = Mode(cfg.get("mode", Mode.default)).value + * self.minn = cfg.get("minn", 0) # <<<<<<<<<<<<<< + * self.maxn = cfg.get("maxn", 0) + * self.hash_count = cfg.get("hash_count", 0) +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[4], NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyLong_As_uint32_t(__pyx_t_1); if (unlikely((__pyx_t_9 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->minn = __pyx_t_9; + + /* "spacy/vectors.pyx":641 + * self.mode = Mode(cfg.get("mode", Mode.default)).value + * self.minn = cfg.get("minn", 0) + * self.maxn = cfg.get("maxn", 0) # <<<<<<<<<<<<<< + * self.hash_count = cfg.get("hash_count", 0) + * self.hash_seed = cfg.get("hash_seed", 0) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[5], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 641, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = __Pyx_PyLong_As_uint32_t(__pyx_t_3); if (unlikely((__pyx_t_9 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 641, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->maxn = __pyx_t_9; + + /* "spacy/vectors.pyx":642 + * self.minn = cfg.get("minn", 0) + * self.maxn = cfg.get("maxn", 0) + * self.hash_count = cfg.get("hash_count", 0) # <<<<<<<<<<<<<< + * self.hash_seed = cfg.get("hash_seed", 0) + * self.bow = cfg.get("bow", "<") +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[6], NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyLong_As_uint32_t(__pyx_t_1); if (unlikely((__pyx_t_9 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 642, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->hash_count = __pyx_t_9; + + /* "spacy/vectors.pyx":643 + * self.maxn = cfg.get("maxn", 0) + * self.hash_count = cfg.get("hash_count", 0) + * self.hash_seed = cfg.get("hash_seed", 0) # <<<<<<<<<<<<<< + * self.bow = cfg.get("bow", "<") + * self.eow = cfg.get("eow", ">") +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[7], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = __Pyx_PyLong_As_uint32_t(__pyx_t_3); if (unlikely((__pyx_t_9 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 643, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->hash_seed = __pyx_t_9; + + /* "spacy/vectors.pyx":644 + * self.hash_count = cfg.get("hash_count", 0) + * self.hash_seed = cfg.get("hash_seed", 0) + * self.bow = cfg.get("bow", "<") # <<<<<<<<<<<<<< + * self.eow = cfg.get("eow", ">") + * self.attr = cfg.get("attr", ORTH) +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[8], NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->bow); + __Pyx_DECREF(__pyx_v_self->bow); + __pyx_v_self->bow = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":645 + * self.hash_seed = cfg.get("hash_seed", 0) + * self.bow = cfg.get("bow", "<") + * self.eow = cfg.get("eow", ">") # <<<<<<<<<<<<<< + * self.attr = cfg.get("attr", ORTH) + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[9], NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_3))) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->eow); + __Pyx_DECREF(__pyx_v_self->eow); + __pyx_v_self->eow = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/vectors.pyx":646 + * self.bow = cfg.get("bow", "<") + * self.eow = cfg.get("eow", ">") + * self.attr = cfg.get("attr", ORTH) # <<<<<<<<<<<<<< + * + * def to_disk(self, path, *, exclude=tuple()): +*/ + __pyx_t_1 = __pyx_v_cfg; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_ORTH); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_mstate_global->__pyx_n_u_attr, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_10 = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_t_3)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 646, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->attr = __pyx_t_10; + + /* "spacy/vectors.pyx":638 + * } + * + * def _set_cfg(self, cfg): # <<<<<<<<<<<<<< + * self.mode = Mode(cfg.get("mode", Mode.default)).value + * self.minn = cfg.get("minn", 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.vectors.Vectors._set_cfg", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":648 + * self.attr = cfg.get("attr", ORTH) + * + * def to_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_46to_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_45to_disk, "Vectors.to_disk(self, path, *, exclude=tuple())\n\nSave the current state to a directory.\n\npath (str / Path): A path to a directory, which will be created if\n it doesn't exists.\n\nDOCS: https://spacy.io/api/vectors#to_disk"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_46to_disk = {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_46to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_45to_disk}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_46to_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + PyObject *__pyx_v_exclude = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_disk (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_exclude,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 648, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 648, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "to_disk", 0) < (0)) __PYX_ERR(0, 648, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__5); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, i); __PYX_ERR(0, 648, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 648, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__5); + } + __pyx_v_path = values[0]; + __pyx_v_exclude = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 648, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_45to_disk(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_path, __pyx_v_exclude); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":662 + * save_array = lambda arr, file_: xp.save(file_, arr) # no-cython-lint + * + * def save_vectors(path): # <<<<<<<<<<<<<< + * # the source of numpy.save indicates that the file object is closed after use. + * # but it seems that somehow this does not happen, as ResourceWarnings are raised here. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_1save_vectors(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_1save_vectors = {"save_vectors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_1save_vectors, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_1save_vectors(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("save_vectors (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 662, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 662, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "save_vectors", 0) < (0)) __PYX_ERR(0, 662, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("save_vectors", 1, 1, 1, i); __PYX_ERR(0, 662, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 662, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("save_vectors", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 662, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.save_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_7to_disk_save_vectors(__pyx_self, __pyx_v_path); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_7to_disk_save_vectors(PyObject *__pyx_self, PyObject *__pyx_v_path) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_outer_scope; + PyObject *__pyx_v_ops = NULL; + PyObject *__pyx_v__file = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("save_vectors", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spacy/vectors.pyx":666 + * # but it seems that somehow this does not happen, as ResourceWarnings are raised here. + * # in order to not rely on this, wrap in context manager. + * ops = get_current_ops() # <<<<<<<<<<<<<< + * with path.open("wb") as _file: + * save_array(ops.to_numpy(self.data, byte_order="<"), _file) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_current_ops); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 666, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_ops = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":667 + * # in order to not rely on this, wrap in context manager. + * ops = get_current_ops() + * with path.open("wb") as _file: # <<<<<<<<<<<<<< + * save_array(ops.to_numpy(self.data, byte_order="<"), _file) + * +*/ + /*with:*/ { + __pyx_t_3 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_wb}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_open, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = NULL; + __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 667, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_6 = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*try:*/ { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + /*try:*/ { + __pyx_v__file = __pyx_t_6; + __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":668 + * ops = get_current_ops() + * with path.open("wb") as _file: + * save_array(ops.to_numpy(self.data, byte_order="<"), _file) # <<<<<<<<<<<<<< + * + * serializers = { +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_save_array)) { __Pyx_RaiseClosureNameError("save_array"); __PYX_ERR(0, 668, __pyx_L7_error) } + __pyx_t_1 = __pyx_v_ops; + __Pyx_INCREF(__pyx_t_1); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 668, __pyx_L7_error) } + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_cur_scope->__pyx_v_self->data}; + __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 668, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_byte_order, __pyx_mstate_global->__pyx_kp_u__3, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 668, __pyx_L7_error) + __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_to_numpy, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 668, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 668, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 668, __pyx_L7_error); + __Pyx_INCREF(__pyx_v__file); + __Pyx_GIVEREF(__pyx_v__file); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v__file) != (0)) __PYX_ERR(0, 668, __pyx_L7_error); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_save_array, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 668, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":667 + * # in order to not rely on this, wrap in context manager. + * ops = get_current_ops() + * with path.open("wb") as _file: # <<<<<<<<<<<<<< + * save_array(ops.to_numpy(self.data, byte_order="<"), _file) + * +*/ + } + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L12_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + /*except:*/ { + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.save_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(0, 667, __pyx_L9_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_Pack(3, __pyx_t_6, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 667, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_11 < (0)) __PYX_ERR(0, 667, __pyx_L9_except_error) + __pyx_t_12 = (!__pyx_t_11); + if (unlikely(__pyx_t_12)) { + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_3, __pyx_t_1); + __pyx_t_6 = 0; __pyx_t_3 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 667, __pyx_L9_except_error) + } + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_except_error:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + goto __pyx_L1_error; + __pyx_L8_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_L12_try_end:; + } + } + /*finally:*/ { + /*normal exit:*/{ + if (__pyx_t_5) { + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[10], NULL); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + goto __pyx_L6; + } + __pyx_L6:; + } + goto __pyx_L16; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L1_error; + __pyx_L16:; + } + + /* "spacy/vectors.pyx":662 + * save_array = lambda arr, file_: xp.save(file_, arr) # no-cython-lint + * + * def save_vectors(path): # <<<<<<<<<<<<<< + * # the source of numpy.save indicates that the file object is closed after use. + * # but it seems that somehow this does not happen, as ResourceWarnings are raised here. +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.save_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ops); + __Pyx_XDECREF(__pyx_v__file); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":658 + * xp = get_array_module(self.data) + * if xp is numpy: + * save_array = lambda arr, file_: xp.save(file_, arr, allow_pickle=False) # no-cython-lint # <<<<<<<<<<<<<< + * else: + * save_array = lambda arr, file_: xp.save(file_, arr) # no-cython-lint +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_2lambda2(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_2lambda2 = {"lambda2", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_2lambda2, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_2lambda2(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_arr = 0; + PyObject *__pyx_v_file_ = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_arr,&__pyx_mstate_global->__pyx_n_u_file,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 658, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 658, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 658, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda2", 0) < (0)) __PYX_ERR(0, 658, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda2", 1, 2, 2, i); __PYX_ERR(0, 658, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 658, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 658, __pyx_L3_error) + } + __pyx_v_arr = values[0]; + __pyx_v_file_ = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda2", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 658, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self, __pyx_v_arr, __pyx_v_file_); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, PyObject *__pyx_v_arr, PyObject *__pyx_v_file_) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda2", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_xp)) { __Pyx_RaiseClosureNameError("xp"); __PYX_ERR(0, 658, __pyx_L1_error) } + __pyx_t_2 = __pyx_cur_scope->__pyx_v_xp; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_file_, __pyx_v_arr}; + __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_pickle, Py_False, __pyx_t_4, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 658, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_save, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":660 + * save_array = lambda arr, file_: xp.save(file_, arr, allow_pickle=False) # no-cython-lint + * else: + * save_array = lambda arr, file_: xp.save(file_, arr) # no-cython-lint # <<<<<<<<<<<<<< + * + * def save_vectors(path): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_3lambda3(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_3lambda3 = {"lambda3", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_3lambda3, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_3lambda3(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_arr = 0; + PyObject *__pyx_v_file_ = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_arr,&__pyx_mstate_global->__pyx_n_u_file,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 660, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 660, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 660, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda3", 0) < (0)) __PYX_ERR(0, 660, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda3", 1, 2, 2, i); __PYX_ERR(0, 660, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 660, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 660, __pyx_L3_error) + } + __pyx_v_arr = values[0]; + __pyx_v_file_ = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda3", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 660, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self, __pyx_v_arr, __pyx_v_file_); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_arr, PyObject *__pyx_v_file_) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda3", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_xp)) { __Pyx_RaiseClosureNameError("xp"); __PYX_ERR(0, 660, __pyx_L1_error) } + __pyx_t_2 = __pyx_cur_scope->__pyx_v_xp; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_file_, __pyx_v_arr}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_save, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":671 + * + * serializers = { + * "strings": lambda p: self.strings.to_disk(p.with_suffix(".json")), # <<<<<<<<<<<<<< + * "vectors": lambda p: save_vectors(p), + * "key2row": lambda p: srsly.write_msgpack(p, self.key2row), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_4lambda4(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_4lambda4 = {"lambda4", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_4lambda4, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_4lambda4(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_p = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda4 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_p,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 671, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 671, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda4", 0) < (0)) __PYX_ERR(0, 671, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda4", 1, 1, 1, i); __PYX_ERR(0, 671, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 671, __pyx_L3_error) + } + __pyx_v_p = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda4", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 671, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda4(__pyx_self, __pyx_v_p); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda4(PyObject *__pyx_self, PyObject *__pyx_v_p) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda4", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 671, __pyx_L1_error) } + __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->strings; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __pyx_v_p; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_json}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_with_suffix, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_disk, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":672 + * serializers = { + * "strings": lambda p: self.strings.to_disk(p.with_suffix(".json")), + * "vectors": lambda p: save_vectors(p), # <<<<<<<<<<<<<< + * "key2row": lambda p: srsly.write_msgpack(p, self.key2row), + * "vectors.cfg": lambda p: srsly.write_json(p, self._get_cfg()), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_5lambda5(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_5lambda5 = {"lambda5", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_5lambda5, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_5lambda5(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_p = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda5 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_p,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 672, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 672, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda5", 0) < (0)) __PYX_ERR(0, 672, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda5", 1, 1, 1, i); __PYX_ERR(0, 672, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 672, __pyx_L3_error) + } + __pyx_v_p = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda5", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 672, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.lambda5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda5(__pyx_self, __pyx_v_p); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda5(PyObject *__pyx_self, PyObject *__pyx_v_p) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda5", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_save_vectors)) { __Pyx_RaiseClosureNameError("save_vectors"); __PYX_ERR(0, 672, __pyx_L1_error) } + __pyx_t_1 = __pyx_pf_5spacy_7vectors_7Vectors_7to_disk_save_vectors(__pyx_cur_scope->__pyx_v_save_vectors, __pyx_v_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 672, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.lambda5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":673 + * "strings": lambda p: self.strings.to_disk(p.with_suffix(".json")), + * "vectors": lambda p: save_vectors(p), + * "key2row": lambda p: srsly.write_msgpack(p, self.key2row), # <<<<<<<<<<<<<< + * "vectors.cfg": lambda p: srsly.write_json(p, self._get_cfg()), + * } +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_6lambda6(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_6lambda6 = {"lambda6", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_6lambda6, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_6lambda6(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_p = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda6 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_p,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 673, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 673, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda6", 0) < (0)) __PYX_ERR(0, 673, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda6", 1, 1, 1, i); __PYX_ERR(0, 673, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 673, __pyx_L3_error) + } + __pyx_v_p = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda6", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 673, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.lambda6", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda6(__pyx_self, __pyx_v_p); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda6(PyObject *__pyx_self, PyObject *__pyx_v_p) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda6", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 673, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_write_msgpack); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 673, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 673, __pyx_L1_error) } + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_p, __pyx_cur_scope->__pyx_v_self->key2row}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.lambda6", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":674 + * "vectors": lambda p: save_vectors(p), + * "key2row": lambda p: srsly.write_msgpack(p, self.key2row), + * "vectors.cfg": lambda p: srsly.write_json(p, self._get_cfg()), # <<<<<<<<<<<<<< + * } + * return util.to_disk(path, serializers, exclude) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_7lambda7(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_7lambda7 = {"lambda7", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_7lambda7, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7to_disk_7lambda7(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_p = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda7 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_p,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 674, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 674, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda7", 0) < (0)) __PYX_ERR(0, 674, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda7", 1, 1, 1, i); __PYX_ERR(0, 674, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 674, __pyx_L3_error) + } + __pyx_v_p = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda7", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 674, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda7(__pyx_self, __pyx_v_p); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda7(PyObject *__pyx_self, PyObject *__pyx_v_p) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda7", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_write_json); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 674, __pyx_L1_error) } + __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_cfg, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_p, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":648 + * self.attr = cfg.get("attr", ORTH) + * + * def to_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_45to_disk(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_exclude) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *__pyx_cur_scope; + PyObject *__pyx_v_serializers = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_disk", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_5_to_disk(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 648, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + + /* "spacy/vectors.pyx":656 + * DOCS: https://spacy.io/api/vectors#to_disk + * """ + * xp = get_array_module(self.data) # <<<<<<<<<<<<<< + * if xp is numpy: + * save_array = lambda arr, file_: xp.save(file_, arr, allow_pickle=False) # no-cython-lint +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_array_module); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_self->data}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_xp = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":657 + * """ + * xp = get_array_module(self.data) + * if xp is numpy: # <<<<<<<<<<<<<< + * save_array = lambda arr, file_: xp.save(file_, arr, allow_pickle=False) # no-cython-lint + * else: +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 657, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = (__pyx_cur_scope->__pyx_v_xp == __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "spacy/vectors.pyx":658 + * xp = get_array_module(self.data) + * if xp is numpy: + * save_array = lambda arr, file_: xp.save(file_, arr, allow_pickle=False) # no-cython-lint # <<<<<<<<<<<<<< + * else: + * save_array = lambda arr, file_: xp.save(file_, arr) # no-cython-lint +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_2lambda2, 0, __pyx_mstate_global->__pyx_n_u_to_disk_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_save_array = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":657 + * """ + * xp = get_array_module(self.data) + * if xp is numpy: # <<<<<<<<<<<<<< + * save_array = lambda arr, file_: xp.save(file_, arr, allow_pickle=False) # no-cython-lint + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/vectors.pyx":660 + * save_array = lambda arr, file_: xp.save(file_, arr, allow_pickle=False) # no-cython-lint + * else: + * save_array = lambda arr, file_: xp.save(file_, arr) # no-cython-lint # <<<<<<<<<<<<<< + * + * def save_vectors(path): +*/ + /*else*/ { + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_3lambda3, 0, __pyx_mstate_global->__pyx_n_u_to_disk_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_save_array = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_L3:; + + /* "spacy/vectors.pyx":662 + * save_array = lambda arr, file_: xp.save(file_, arr) # no-cython-lint + * + * def save_vectors(path): # <<<<<<<<<<<<<< + * # the source of numpy.save indicates that the file object is closed after use. + * # but it seems that somehow this does not happen, as ResourceWarnings are raised here. +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_1save_vectors, 0, __pyx_mstate_global->__pyx_n_u_to_disk_locals_save_vectors, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_save_vectors = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":671 + * + * serializers = { + * "strings": lambda p: self.strings.to_disk(p.with_suffix(".json")), # <<<<<<<<<<<<<< + * "vectors": lambda p: save_vectors(p), + * "key2row": lambda p: srsly.write_msgpack(p, self.key2row), +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_4lambda4, 0, __pyx_mstate_global->__pyx_n_u_to_disk_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_strings, __pyx_t_3) < (0)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/vectors.pyx":672 + * serializers = { + * "strings": lambda p: self.strings.to_disk(p.with_suffix(".json")), + * "vectors": lambda p: save_vectors(p), # <<<<<<<<<<<<<< + * "key2row": lambda p: srsly.write_msgpack(p, self.key2row), + * "vectors.cfg": lambda p: srsly.write_json(p, self._get_cfg()), +*/ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_5lambda5, 0, __pyx_mstate_global->__pyx_n_u_to_disk_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 672, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_vectors, __pyx_t_3) < (0)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/vectors.pyx":673 + * "strings": lambda p: self.strings.to_disk(p.with_suffix(".json")), + * "vectors": lambda p: save_vectors(p), + * "key2row": lambda p: srsly.write_msgpack(p, self.key2row), # <<<<<<<<<<<<<< + * "vectors.cfg": lambda p: srsly.write_json(p, self._get_cfg()), + * } +*/ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_6lambda6, 0, __pyx_mstate_global->__pyx_n_u_to_disk_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 673, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_key2row, __pyx_t_3) < (0)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/vectors.pyx":674 + * "vectors": lambda p: save_vectors(p), + * "key2row": lambda p: srsly.write_msgpack(p, self.key2row), + * "vectors.cfg": lambda p: srsly.write_json(p, self._get_cfg()), # <<<<<<<<<<<<<< + * } + * return util.to_disk(path, serializers, exclude) +*/ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_7to_disk_7lambda7, 0, __pyx_mstate_global->__pyx_n_u_to_disk_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_vectors_cfg, __pyx_t_3) < (0)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_serializers = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":676 + * "vectors.cfg": lambda p: srsly.write_json(p, self._get_cfg()), + * } + * return util.to_disk(path, serializers, exclude) # <<<<<<<<<<<<<< + * + * def from_disk(self, path, *, exclude=tuple()): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_to_disk); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_path, __pyx_v_serializers, __pyx_v_exclude}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":648 + * self.attr = cfg.get("attr", ORTH) + * + * def to_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_serializers); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":678 + * return util.to_disk(path, serializers, exclude) + * + * def from_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_48from_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_47from_disk, "Vectors.from_disk(self, path, *, exclude=tuple())\n\nLoads state from a directory. Modifies the object in place and\nreturns it.\n\npath (str / Path): Directory path, string or Path-like object.\nRETURNS (Vectors): The modified object.\n\nDOCS: https://spacy.io/api/vectors#from_disk"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_48from_disk = {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_48from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_47from_disk}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_48from_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + PyObject *__pyx_v_exclude = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_disk (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_exclude,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 678, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 678, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_disk", 0) < (0)) __PYX_ERR(0, 678, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__6); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_disk", 1, 1, 1, i); __PYX_ERR(0, 678, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 678, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__6); + } + __pyx_v_path = values[0]; + __pyx_v_exclude = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 678, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_47from_disk(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_path, __pyx_v_exclude); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":687 + * DOCS: https://spacy.io/api/vectors#from_disk + * """ + * def load_key2row(path): # <<<<<<<<<<<<<< + * if path.exists(): + * self.key2row = srsly.read_msgpack(path) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_1load_key2row(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_9from_disk_1load_key2row = {"load_key2row", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_1load_key2row, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_1load_key2row(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("load_key2row (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 687, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 687, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "load_key2row", 0) < (0)) __PYX_ERR(0, 687, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("load_key2row", 1, 1, 1, i); __PYX_ERR(0, 687, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 687, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("load_key2row", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 687, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.from_disk.load_key2row", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_9from_disk_load_key2row(__pyx_self, __pyx_v_path); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_9from_disk_load_key2row(PyObject *__pyx_self, PyObject *__pyx_v_path) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *__pyx_outer_scope; + CYTHON_UNUSED PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_row = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + PyObject *(*__pyx_t_10)(PyObject *); + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("load_key2row", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spacy/vectors.pyx":688 + * """ + * def load_key2row(path): + * if path.exists(): # <<<<<<<<<<<<<< + * self.key2row = srsly.read_msgpack(path) + * for key, row in self.key2row.items(): +*/ + __pyx_t_2 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_exists, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "spacy/vectors.pyx":689 + * def load_key2row(path): + * if path.exists(): + * self.key2row = srsly.read_msgpack(path) # <<<<<<<<<<<<<< + * for key, row in self.key2row.items(): + * if self._unset.count(row): +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_read_msgpack); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 689, __pyx_L1_error) } + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->key2row); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->key2row); + __pyx_cur_scope->__pyx_v_self->key2row = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":688 + * """ + * def load_key2row(path): + * if path.exists(): # <<<<<<<<<<<<<< + * self.key2row = srsly.read_msgpack(path) + * for key, row in self.key2row.items(): +*/ + } + + /* "spacy/vectors.pyx":690 + * if path.exists(): + * self.key2row = srsly.read_msgpack(path) + * for key, row in self.key2row.items(): # <<<<<<<<<<<<<< + * if self._unset.count(row): + * self._unset.erase(self._unset.find(row)) +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 690, __pyx_L1_error) } + __pyx_t_6 = __pyx_cur_scope->__pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 690, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_6))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 690, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 690, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_8(__pyx_t_6); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 690, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 690, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_5); + } + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); + index = 0; __pyx_t_2 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < (0)) __PYX_ERR(0, 690, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 690, __pyx_L1_error) + __pyx_L7_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/vectors.pyx":691 + * self.key2row = srsly.read_msgpack(path) + * for key, row in self.key2row.items(): + * if self._unset.count(row): # <<<<<<<<<<<<<< + * self._unset.erase(self._unset.find(row)) + * +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 691, __pyx_L1_error) } + __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_row); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error) + __pyx_t_4 = (__pyx_cur_scope->__pyx_v_self->_unset.count(__pyx_t_11) != 0); + if (__pyx_t_4) { + + /* "spacy/vectors.pyx":692 + * for key, row in self.key2row.items(): + * if self._unset.count(row): + * self._unset.erase(self._unset.find(row)) # <<<<<<<<<<<<<< + * + * def load_keys(path): +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 692, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 692, __pyx_L1_error) } + __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_row); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 692, __pyx_L1_error) + (void)(__pyx_cur_scope->__pyx_v_self->_unset.erase(__pyx_cur_scope->__pyx_v_self->_unset.find(__pyx_t_11))); + + /* "spacy/vectors.pyx":691 + * self.key2row = srsly.read_msgpack(path) + * for key, row in self.key2row.items(): + * if self._unset.count(row): # <<<<<<<<<<<<<< + * self._unset.erase(self._unset.find(row)) + * +*/ + } + + /* "spacy/vectors.pyx":690 + * if path.exists(): + * self.key2row = srsly.read_msgpack(path) + * for key, row in self.key2row.items(): # <<<<<<<<<<<<<< + * if self._unset.count(row): + * self._unset.erase(self._unset.find(row)) +*/ + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":687 + * DOCS: https://spacy.io/api/vectors#from_disk + * """ + * def load_key2row(path): # <<<<<<<<<<<<<< + * if path.exists(): + * self.key2row = srsly.read_msgpack(path) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("spacy.vectors.Vectors.from_disk.load_key2row", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":694 + * self._unset.erase(self._unset.find(row)) + * + * def load_keys(path): # <<<<<<<<<<<<<< + * if path.exists(): + * keys = numpy.load(str(path)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_3load_keys(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_9from_disk_3load_keys = {"load_keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_3load_keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_3load_keys(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("load_keys (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 694, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 694, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "load_keys", 0) < (0)) __PYX_ERR(0, 694, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("load_keys", 1, 1, 1, i); __PYX_ERR(0, 694, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 694, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("load_keys", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 694, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.from_disk.load_keys", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_9from_disk_2load_keys(__pyx_self, __pyx_v_path); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_9from_disk_2load_keys(PyObject *__pyx_self, PyObject *__pyx_v_path) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *__pyx_outer_scope; + PyObject *__pyx_v_keys = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("load_keys", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spacy/vectors.pyx":695 + * + * def load_keys(path): + * if path.exists(): # <<<<<<<<<<<<<< + * keys = numpy.load(str(path)) + * for i, key in enumerate(keys): +*/ + __pyx_t_2 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_exists, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 695, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "spacy/vectors.pyx":696 + * def load_keys(path): + * if path.exists(): + * keys = numpy.load(str(path)) # <<<<<<<<<<<<<< + * for i, key in enumerate(keys): + * self.add(key, row=i) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_load); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_keys = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":697 + * if path.exists(): + * keys = numpy.load(str(path)) + * for i, key in enumerate(keys): # <<<<<<<<<<<<<< + * self.add(key, row=i) + * +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_1 = __pyx_mstate_global->__pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_keys)) || PyTuple_CheckExact(__pyx_v_keys)) { + __pyx_t_6 = __pyx_v_keys; __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_keys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 697, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 697, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_6))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 697, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 697, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 697, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_8(__pyx_t_6); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 697, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); + __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 697, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + + /* "spacy/vectors.pyx":698 + * keys = numpy.load(str(path)) + * for i, key in enumerate(keys): + * self.add(key, row=i) # <<<<<<<<<<<<<< + * + * def load_vectors(path): +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 698, __pyx_L1_error) } + __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_key}; + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_row, __pyx_v_i, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 698, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vectors.pyx":697 + * if path.exists(): + * keys = numpy.load(str(path)) + * for i, key in enumerate(keys): # <<<<<<<<<<<<<< + * self.add(key, row=i) + * +*/ + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":695 + * + * def load_keys(path): + * if path.exists(): # <<<<<<<<<<<<<< + * keys = numpy.load(str(path)) + * for i, key in enumerate(keys): +*/ + } + + /* "spacy/vectors.pyx":694 + * self._unset.erase(self._unset.find(row)) + * + * def load_keys(path): # <<<<<<<<<<<<<< + * if path.exists(): + * keys = numpy.load(str(path)) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("spacy.vectors.Vectors.from_disk.load_keys", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_keys); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":700 + * self.add(key, row=i) + * + * def load_vectors(path): # <<<<<<<<<<<<<< + * ops = get_current_ops() + * if path.exists(): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_5load_vectors(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_9from_disk_5load_vectors = {"load_vectors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_5load_vectors, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_5load_vectors(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("load_vectors (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 700, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 700, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "load_vectors", 0) < (0)) __PYX_ERR(0, 700, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("load_vectors", 1, 1, 1, i); __PYX_ERR(0, 700, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 700, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("load_vectors", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 700, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.from_disk.load_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_9from_disk_4load_vectors(__pyx_self, __pyx_v_path); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_9from_disk_4load_vectors(PyObject *__pyx_self, PyObject *__pyx_v_path) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *__pyx_outer_scope; + PyObject *__pyx_v_ops = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("load_vectors", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spacy/vectors.pyx":701 + * + * def load_vectors(path): + * ops = get_current_ops() # <<<<<<<<<<<<<< + * if path.exists(): + * self.data = ops.xp.load(str(path)) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_current_ops); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 701, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_ops = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":702 + * def load_vectors(path): + * ops = get_current_ops() + * if path.exists(): # <<<<<<<<<<<<<< + * self.data = ops.xp.load(str(path)) + * self.to_ops(ops) +*/ + __pyx_t_3 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_exists, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "spacy/vectors.pyx":703 + * ops = get_current_ops() + * if path.exists(): + * self.data = ops.xp.load(str(path)) # <<<<<<<<<<<<<< + * self.to_ops(ops) + * +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ops, __pyx_mstate_global->__pyx_n_u_xp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_Unicode(__pyx_v_path); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_load, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 703, __pyx_L1_error) } + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->data); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->data); + __pyx_cur_scope->__pyx_v_self->data = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":702 + * def load_vectors(path): + * ops = get_current_ops() + * if path.exists(): # <<<<<<<<<<<<<< + * self.data = ops.xp.load(str(path)) + * self.to_ops(ops) +*/ + } + + /* "spacy/vectors.pyx":704 + * if path.exists(): + * self.data = ops.xp.load(str(path)) + * self.to_ops(ops) # <<<<<<<<<<<<<< + * + * def load_settings(path): +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 704, __pyx_L1_error) } + __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_ops}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_ops, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":700 + * self.add(key, row=i) + * + * def load_vectors(path): # <<<<<<<<<<<<<< + * ops = get_current_ops() + * if path.exists(): +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.vectors.Vectors.from_disk.load_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ops); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":706 + * self.to_ops(ops) + * + * def load_settings(path): # <<<<<<<<<<<<<< + * if path.exists(): + * self._set_cfg(srsly.read_json(path)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_7load_settings(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_9from_disk_7load_settings = {"load_settings", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_7load_settings, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_7load_settings(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("load_settings (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 706, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 706, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "load_settings", 0) < (0)) __PYX_ERR(0, 706, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("load_settings", 1, 1, 1, i); __PYX_ERR(0, 706, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 706, __pyx_L3_error) + } + __pyx_v_path = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("load_settings", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 706, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.from_disk.load_settings", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_9from_disk_6load_settings(__pyx_self, __pyx_v_path); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_9from_disk_6load_settings(PyObject *__pyx_self, PyObject *__pyx_v_path) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("load_settings", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spacy/vectors.pyx":707 + * + * def load_settings(path): + * if path.exists(): # <<<<<<<<<<<<<< + * self._set_cfg(srsly.read_json(path)) + * +*/ + __pyx_t_2 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_exists, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 707, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "spacy/vectors.pyx":708 + * def load_settings(path): + * if path.exists(): + * self._set_cfg(srsly.read_json(path)) # <<<<<<<<<<<<<< + * + * serializers = { +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 708, __pyx_L1_error) } + __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_read_json); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8); + assert(__pyx_t_6); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_path}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_set_cfg, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":707 + * + * def load_settings(path): + * if path.exists(): # <<<<<<<<<<<<<< + * self._set_cfg(srsly.read_json(path)) + * +*/ + } + + /* "spacy/vectors.pyx":706 + * self.to_ops(ops) + * + * def load_settings(path): # <<<<<<<<<<<<<< + * if path.exists(): + * self._set_cfg(srsly.read_json(path)) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.vectors.Vectors.from_disk.load_settings", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":711 + * + * serializers = { + * "strings": lambda p: self.strings.from_disk(p.with_suffix(".json")), # <<<<<<<<<<<<<< + * "vectors": load_vectors, + * "keys": load_keys, +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_8lambda8(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_9from_disk_8lambda8 = {"lambda8", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_8lambda8, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9from_disk_8lambda8(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_p = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda8 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_p,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 711, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 711, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda8", 0) < (0)) __PYX_ERR(0, 711, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda8", 1, 1, 1, i); __PYX_ERR(0, 711, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 711, __pyx_L3_error) + } + __pyx_v_p = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda8", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 711, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.from_disk.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda8(__pyx_self, __pyx_v_p); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda8(PyObject *__pyx_self, PyObject *__pyx_v_p) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda8", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 711, __pyx_L1_error) } + __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->strings; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __pyx_v_p; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_json}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_with_suffix, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_from_disk, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.vectors.Vectors.from_disk.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":678 + * return util.to_disk(path, serializers, exclude) + * + * def from_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_47from_disk(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_exclude) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *__pyx_cur_scope; + PyObject *__pyx_v_load_key2row = 0; + PyObject *__pyx_v_load_keys = 0; + PyObject *__pyx_v_load_vectors = 0; + PyObject *__pyx_v_load_settings = 0; + PyObject *__pyx_v_serializers = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_disk", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_6_from_disk(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 678, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + + /* "spacy/vectors.pyx":687 + * DOCS: https://spacy.io/api/vectors#from_disk + * """ + * def load_key2row(path): # <<<<<<<<<<<<<< + * if path.exists(): + * self.key2row = srsly.read_msgpack(path) +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_9from_disk_1load_key2row, 0, __pyx_mstate_global->__pyx_n_u_from_disk_locals_load_key2row, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_load_key2row = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":694 + * self._unset.erase(self._unset.find(row)) + * + * def load_keys(path): # <<<<<<<<<<<<<< + * if path.exists(): + * keys = numpy.load(str(path)) +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_9from_disk_3load_keys, 0, __pyx_mstate_global->__pyx_n_u_from_disk_locals_load_keys, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_load_keys = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":700 + * self.add(key, row=i) + * + * def load_vectors(path): # <<<<<<<<<<<<<< + * ops = get_current_ops() + * if path.exists(): +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_9from_disk_5load_vectors, 0, __pyx_mstate_global->__pyx_n_u_from_disk_locals_load_vectors, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_load_vectors = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":706 + * self.to_ops(ops) + * + * def load_settings(path): # <<<<<<<<<<<<<< + * if path.exists(): + * self._set_cfg(srsly.read_json(path)) +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_9from_disk_7load_settings, 0, __pyx_mstate_global->__pyx_n_u_from_disk_locals_load_settings, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_load_settings = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":711 + * + * serializers = { + * "strings": lambda p: self.strings.from_disk(p.with_suffix(".json")), # <<<<<<<<<<<<<< + * "vectors": load_vectors, + * "keys": load_keys, +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_9from_disk_8lambda8, 0, __pyx_mstate_global->__pyx_n_u_from_disk_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_strings, __pyx_t_2) < (0)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":712 + * serializers = { + * "strings": lambda p: self.strings.from_disk(p.with_suffix(".json")), + * "vectors": load_vectors, # <<<<<<<<<<<<<< + * "keys": load_keys, + * "key2row": load_key2row, +*/ + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_vectors, __pyx_v_load_vectors) < (0)) __PYX_ERR(0, 711, __pyx_L1_error) + + /* "spacy/vectors.pyx":713 + * "strings": lambda p: self.strings.from_disk(p.with_suffix(".json")), + * "vectors": load_vectors, + * "keys": load_keys, # <<<<<<<<<<<<<< + * "key2row": load_key2row, + * "vectors.cfg": load_settings, +*/ + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_keys, __pyx_v_load_keys) < (0)) __PYX_ERR(0, 711, __pyx_L1_error) + + /* "spacy/vectors.pyx":714 + * "vectors": load_vectors, + * "keys": load_keys, + * "key2row": load_key2row, # <<<<<<<<<<<<<< + * "vectors.cfg": load_settings, + * } +*/ + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_key2row, __pyx_v_load_key2row) < (0)) __PYX_ERR(0, 711, __pyx_L1_error) + + /* "spacy/vectors.pyx":715 + * "keys": load_keys, + * "key2row": load_key2row, + * "vectors.cfg": load_settings, # <<<<<<<<<<<<<< + * } + * +*/ + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_vectors_cfg, __pyx_v_load_settings) < (0)) __PYX_ERR(0, 711, __pyx_L1_error) + __pyx_v_serializers = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":718 + * } + * + * util.from_disk(path, serializers, exclude) # <<<<<<<<<<<<<< + * self._sync_unset() + * return self +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 718, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_from_disk); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 718, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_path, __pyx_v_serializers, __pyx_v_exclude}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":719 + * + * util.from_disk(path, serializers, exclude) + * self._sync_unset() # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_4 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sync_unset, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":720 + * util.from_disk(path, serializers, exclude) + * self._sync_unset() + * return self # <<<<<<<<<<<<<< + * + * def to_bytes(self, *, exclude=tuple()): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + goto __pyx_L0; + + /* "spacy/vectors.pyx":678 + * return util.to_disk(path, serializers, exclude) + * + * def from_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.vectors.Vectors.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_load_key2row); + __Pyx_XDECREF(__pyx_v_load_keys); + __Pyx_XDECREF(__pyx_v_load_vectors); + __Pyx_XDECREF(__pyx_v_load_settings); + __Pyx_XDECREF(__pyx_v_serializers); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":722 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_50to_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_49to_bytes, "Vectors.to_bytes(self, *, exclude=tuple())\n\nSerialize the current state to a binary string.\n\nexclude (list): String names of serialization fields to exclude.\nRETURNS (bytes): The serialized form of the `Vectors` object.\n\nDOCS: https://spacy.io/api/vectors#to_bytes"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_50to_bytes = {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_50to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_49to_bytes}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_50to_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_exclude = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_bytes (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exclude,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 722, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "to_bytes", 0) < (0)) __PYX_ERR(0, 722, __pyx_L3_error) + if (!values[0]) values[0] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__7); + } else if (unlikely(__pyx_nargs != 0)) { + goto __pyx_L5_argtuple_error; + } else { + if (!values[0]) values[0] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__7); + } + __pyx_v_exclude = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_bytes", 1, 0, 0, __pyx_nargs); __PYX_ERR(0, 722, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_49to_bytes(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_exclude); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":730 + * DOCS: https://spacy.io/api/vectors#to_bytes + * """ + * def serialize_weights(): # <<<<<<<<<<<<<< + * if hasattr(self.data, "to_bytes"): + * return self.data.to_bytes() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_8to_bytes_1serialize_weights(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_8to_bytes_1serialize_weights = {"serialize_weights", (PyCFunction)__pyx_pw_5spacy_7vectors_7Vectors_8to_bytes_1serialize_weights, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_8to_bytes_1serialize_weights(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("serialize_weights (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_8to_bytes_serialize_weights(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_8to_bytes_serialize_weights(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *__pyx_outer_scope; + PyObject *__pyx_v_ops = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("serialize_weights", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spacy/vectors.pyx":731 + * """ + * def serialize_weights(): + * if hasattr(self.data, "to_bytes"): # <<<<<<<<<<<<<< + * return self.data.to_bytes() + * else: +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 731, __pyx_L1_error) } + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->data; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __Pyx_HasAttr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_to_bytes); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/vectors.pyx":732 + * def serialize_weights(): + * if hasattr(self.data, "to_bytes"): + * return self.data.to_bytes() # <<<<<<<<<<<<<< + * else: + * ops = get_current_ops() +*/ + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 732, __pyx_L1_error) } + __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":731 + * """ + * def serialize_weights(): + * if hasattr(self.data, "to_bytes"): # <<<<<<<<<<<<<< + * return self.data.to_bytes() + * else: +*/ + } + + /* "spacy/vectors.pyx":734 + * return self.data.to_bytes() + * else: + * ops = get_current_ops() # <<<<<<<<<<<<<< + * return srsly.msgpack_dumps(ops.to_numpy(self.data, byte_order="<")) + * +*/ + /*else*/ { + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_get_current_ops); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 734, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_ops = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":735 + * else: + * ops = get_current_ops() + * return srsly.msgpack_dumps(ops.to_numpy(self.data, byte_order="<")) # <<<<<<<<<<<<<< + * + * serializers = { +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_msgpack_dumps); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __pyx_v_ops; + __Pyx_INCREF(__pyx_t_7); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 735, __pyx_L1_error) } + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_cur_scope->__pyx_v_self->data}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_byte_order, __pyx_mstate_global->__pyx_kp_u__3, __pyx_t_8, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 735, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_to_numpy, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + + /* "spacy/vectors.pyx":730 + * DOCS: https://spacy.io/api/vectors#to_bytes + * """ + * def serialize_weights(): # <<<<<<<<<<<<<< + * if hasattr(self.data, "to_bytes"): + * return self.data.to_bytes() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_bytes.serialize_weights", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ops); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":738 + * + * serializers = { + * "strings": lambda: self.strings.to_bytes(), # <<<<<<<<<<<<<< + * "key2row": lambda: srsly.msgpack_dumps(self.key2row), + * "vectors": serialize_weights, +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_8to_bytes_2lambda9(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_8to_bytes_2lambda9 = {"lambda9", (PyCFunction)__pyx_pw_5spacy_7vectors_7Vectors_8to_bytes_2lambda9, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_8to_bytes_2lambda9(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda9 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda9(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda9(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda9", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 738, __pyx_L1_error) } + __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->strings; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_bytes.lambda9", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":739 + * serializers = { + * "strings": lambda: self.strings.to_bytes(), + * "key2row": lambda: srsly.msgpack_dumps(self.key2row), # <<<<<<<<<<<<<< + * "vectors": serialize_weights, + * "vectors.cfg": lambda: srsly.json_dumps(self._get_cfg()), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_8to_bytes_3lambda10(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_8to_bytes_3lambda10 = {"lambda10", (PyCFunction)__pyx_pw_5spacy_7vectors_7Vectors_8to_bytes_3lambda10, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_8to_bytes_3lambda10(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda10 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda10(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda10(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda10", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 739, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_msgpack_dumps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 739, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 739, __pyx_L1_error) } + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_self->key2row}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_bytes.lambda10", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":741 + * "key2row": lambda: srsly.msgpack_dumps(self.key2row), + * "vectors": serialize_weights, + * "vectors.cfg": lambda: srsly.json_dumps(self._get_cfg()), # <<<<<<<<<<<<<< + * } + * return util.to_bytes(serializers, exclude) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_8to_bytes_4lambda11(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_8to_bytes_4lambda11 = {"lambda11", (PyCFunction)__pyx_pw_5spacy_7vectors_7Vectors_8to_bytes_4lambda11, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_8to_bytes_4lambda11(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda11 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda11(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda11(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda11", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_json_dumps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 741, __pyx_L1_error) } + __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_cfg, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_bytes.lambda11", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":722 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_49to_bytes(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_exclude) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *__pyx_cur_scope; + PyObject *__pyx_v_serialize_weights = 0; + PyObject *__pyx_v_serializers = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_bytes", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_7_to_bytes(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 722, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + + /* "spacy/vectors.pyx":730 + * DOCS: https://spacy.io/api/vectors#to_bytes + * """ + * def serialize_weights(): # <<<<<<<<<<<<<< + * if hasattr(self.data, "to_bytes"): + * return self.data.to_bytes() +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_8to_bytes_1serialize_weights, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_serialize_weight, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_serialize_weights = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":738 + * + * serializers = { + * "strings": lambda: self.strings.to_bytes(), # <<<<<<<<<<<<<< + * "key2row": lambda: srsly.msgpack_dumps(self.key2row), + * "vectors": serialize_weights, +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_8to_bytes_2lambda9, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_strings, __pyx_t_2) < (0)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":739 + * serializers = { + * "strings": lambda: self.strings.to_bytes(), + * "key2row": lambda: srsly.msgpack_dumps(self.key2row), # <<<<<<<<<<<<<< + * "vectors": serialize_weights, + * "vectors.cfg": lambda: srsly.json_dumps(self._get_cfg()), +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_8to_bytes_3lambda10, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_key2row, __pyx_t_2) < (0)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":740 + * "strings": lambda: self.strings.to_bytes(), + * "key2row": lambda: srsly.msgpack_dumps(self.key2row), + * "vectors": serialize_weights, # <<<<<<<<<<<<<< + * "vectors.cfg": lambda: srsly.json_dumps(self._get_cfg()), + * } +*/ + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_vectors, __pyx_v_serialize_weights) < (0)) __PYX_ERR(0, 738, __pyx_L1_error) + + /* "spacy/vectors.pyx":741 + * "key2row": lambda: srsly.msgpack_dumps(self.key2row), + * "vectors": serialize_weights, + * "vectors.cfg": lambda: srsly.json_dumps(self._get_cfg()), # <<<<<<<<<<<<<< + * } + * return util.to_bytes(serializers, exclude) +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_8to_bytes_4lambda11, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_vectors_cfg, __pyx_t_2) < (0)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_serializers = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":743 + * "vectors.cfg": lambda: srsly.json_dumps(self._get_cfg()), + * } + * return util.to_bytes(serializers, exclude) # <<<<<<<<<<<<<< + * + * def from_bytes(self, data, *, exclude=tuple()): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_to_bytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_serializers, __pyx_v_exclude}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vectors.pyx":722 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.vectors.Vectors.to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_serialize_weights); + __Pyx_XDECREF(__pyx_v_serializers); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":745 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_52from_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_51from_bytes, "Vectors.from_bytes(self, data, *, exclude=tuple())\n\nLoad state from a binary string.\n\ndata (bytes): The data to load from.\nexclude (list): String names of serialization fields to exclude.\nRETURNS (Vectors): The `Vectors` object.\n\nDOCS: https://spacy.io/api/vectors#from_bytes"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_52from_bytes = {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_52from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_51from_bytes}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_52from_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_data = 0; + PyObject *__pyx_v_exclude = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_bytes (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_exclude,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 745, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 745, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_bytes", 0) < (0)) __PYX_ERR(0, 745, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__8); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_bytes", 1, 1, 1, i); __PYX_ERR(0, 745, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 745, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__8); + } + __pyx_v_data = values[0]; + __pyx_v_exclude = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_bytes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 745, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_51from_bytes(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), __pyx_v_data, __pyx_v_exclude); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":754 + * DOCS: https://spacy.io/api/vectors#from_bytes + * """ + * def deserialize_weights(b): # <<<<<<<<<<<<<< + * if hasattr(self.data, "from_bytes"): + * self.data.from_bytes() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_10from_bytes_1deserialize_weights(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_10from_bytes_1deserialize_weights = {"deserialize_weights", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_10from_bytes_1deserialize_weights, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_10from_bytes_1deserialize_weights(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("deserialize_weights (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 754, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 754, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "deserialize_weights", 0) < (0)) __PYX_ERR(0, 754, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("deserialize_weights", 1, 1, 1, i); __PYX_ERR(0, 754, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 754, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("deserialize_weights", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 754, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.from_bytes.deserialize_weights", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_10from_bytes_deserialize_weights(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_10from_bytes_deserialize_weights(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *__pyx_outer_scope; + PyObject *__pyx_v_xp = NULL; + PyObject *__pyx_v_ops = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("deserialize_weights", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spacy/vectors.pyx":755 + * """ + * def deserialize_weights(b): + * if hasattr(self.data, "from_bytes"): # <<<<<<<<<<<<<< + * self.data.from_bytes() + * else: +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 755, __pyx_L1_error) } + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->data; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __Pyx_HasAttr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_from_bytes); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/vectors.pyx":756 + * def deserialize_weights(b): + * if hasattr(self.data, "from_bytes"): + * self.data.from_bytes() # <<<<<<<<<<<<<< + * else: + * xp = get_array_module(self.data) +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 756, __pyx_L1_error) } + __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->data; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":755 + * """ + * def deserialize_weights(b): + * if hasattr(self.data, "from_bytes"): # <<<<<<<<<<<<<< + * self.data.from_bytes() + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/vectors.pyx":758 + * self.data.from_bytes() + * else: + * xp = get_array_module(self.data) # <<<<<<<<<<<<<< + * self.data = xp.asarray(srsly.msgpack_loads(b)) + * ops = get_current_ops() +*/ + /*else*/ { + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_get_array_module); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 758, __pyx_L1_error) } + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_self->data}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_xp = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":759 + * else: + * xp = get_array_module(self.data) + * self.data = xp.asarray(srsly.msgpack_loads(b)) # <<<<<<<<<<<<<< + * ops = get_current_ops() + * self.to_ops(ops) +*/ + __pyx_t_5 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_msgpack_loads); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8); + assert(__pyx_t_6); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_b}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 759, __pyx_L1_error) } + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->data); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->data); + __pyx_cur_scope->__pyx_v_self->data = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":760 + * xp = get_array_module(self.data) + * self.data = xp.asarray(srsly.msgpack_loads(b)) + * ops = get_current_ops() # <<<<<<<<<<<<<< + * self.to_ops(ops) + * +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_get_current_ops); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 760, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_ops = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":761 + * self.data = xp.asarray(srsly.msgpack_loads(b)) + * ops = get_current_ops() + * self.to_ops(ops) # <<<<<<<<<<<<<< + * + * deserializers = { +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 761, __pyx_L1_error) } + __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_ops}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_ops, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L3:; + + /* "spacy/vectors.pyx":754 + * DOCS: https://spacy.io/api/vectors#from_bytes + * """ + * def deserialize_weights(b): # <<<<<<<<<<<<<< + * if hasattr(self.data, "from_bytes"): + * self.data.from_bytes() +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.vectors.Vectors.from_bytes.deserialize_weights", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_xp); + __Pyx_XDECREF(__pyx_v_ops); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":764 + * + * deserializers = { + * "strings": lambda b: self.strings.from_bytes(b), # <<<<<<<<<<<<<< + * "key2row": lambda b: self.key2row.update(srsly.msgpack_loads(b)), + * "vectors": deserialize_weights, +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_10from_bytes_2lambda12(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_10from_bytes_2lambda12 = {"lambda12", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_10from_bytes_2lambda12, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_10from_bytes_2lambda12(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda12 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 764, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 764, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda12", 0) < (0)) __PYX_ERR(0, 764, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda12", 1, 1, 1, i); __PYX_ERR(0, 764, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 764, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda12", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 764, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.from_bytes.lambda12", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda12(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda12(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda12", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 764, __pyx_L1_error) } + __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->strings; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_b}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vectors.Vectors.from_bytes.lambda12", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":765 + * deserializers = { + * "strings": lambda b: self.strings.from_bytes(b), + * "key2row": lambda b: self.key2row.update(srsly.msgpack_loads(b)), # <<<<<<<<<<<<<< + * "vectors": deserialize_weights, + * "vectors.cfg": lambda b: self._set_cfg(srsly.json_loads(b)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_10from_bytes_3lambda13(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_10from_bytes_3lambda13 = {"lambda13", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_10from_bytes_3lambda13, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_10from_bytes_3lambda13(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda13 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 765, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 765, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda13", 0) < (0)) __PYX_ERR(0, 765, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda13", 1, 1, 1, i); __PYX_ERR(0, 765, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 765, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda13", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 765, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.from_bytes.lambda13", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda13(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda13(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda13", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 765, __pyx_L1_error) } + __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_msgpack_loads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_b}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.vectors.Vectors.from_bytes.lambda13", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":767 + * "key2row": lambda b: self.key2row.update(srsly.msgpack_loads(b)), + * "vectors": deserialize_weights, + * "vectors.cfg": lambda b: self._set_cfg(srsly.json_loads(b)) # <<<<<<<<<<<<<< + * } + * util.from_bytes(data, deserializers, exclude) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_10from_bytes_4lambda14(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_10from_bytes_4lambda14 = {"lambda14", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_10from_bytes_4lambda14, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_10from_bytes_4lambda14(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda14 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 767, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 767, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda14", 0) < (0)) __PYX_ERR(0, 767, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda14", 1, 1, 1, i); __PYX_ERR(0, 767, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 767, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda14", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 767, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.Vectors.from_bytes.lambda14", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda14(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda14(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda14", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 767, __pyx_L1_error) } + __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_json_loads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_b}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_set_cfg, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.vectors.Vectors.from_bytes.lambda14", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":745 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_51from_bytes(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_exclude) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *__pyx_cur_scope; + PyObject *__pyx_v_deserialize_weights = 0; + PyObject *__pyx_v_deserializers = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_bytes", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_8_from_bytes(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 745, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + + /* "spacy/vectors.pyx":754 + * DOCS: https://spacy.io/api/vectors#from_bytes + * """ + * def deserialize_weights(b): # <<<<<<<<<<<<<< + * if hasattr(self.data, "from_bytes"): + * self.data.from_bytes() +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_10from_bytes_1deserialize_weights, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_deserialize_we, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_deserialize_weights = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":764 + * + * deserializers = { + * "strings": lambda b: self.strings.from_bytes(b), # <<<<<<<<<<<<<< + * "key2row": lambda b: self.key2row.update(srsly.msgpack_loads(b)), + * "vectors": deserialize_weights, +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_10from_bytes_2lambda12, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_strings, __pyx_t_2) < (0)) __PYX_ERR(0, 764, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":765 + * deserializers = { + * "strings": lambda b: self.strings.from_bytes(b), + * "key2row": lambda b: self.key2row.update(srsly.msgpack_loads(b)), # <<<<<<<<<<<<<< + * "vectors": deserialize_weights, + * "vectors.cfg": lambda b: self._set_cfg(srsly.json_loads(b)) +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_10from_bytes_3lambda13, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_key2row, __pyx_t_2) < (0)) __PYX_ERR(0, 764, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":766 + * "strings": lambda b: self.strings.from_bytes(b), + * "key2row": lambda b: self.key2row.update(srsly.msgpack_loads(b)), + * "vectors": deserialize_weights, # <<<<<<<<<<<<<< + * "vectors.cfg": lambda b: self._set_cfg(srsly.json_loads(b)) + * } +*/ + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_vectors, __pyx_v_deserialize_weights) < (0)) __PYX_ERR(0, 764, __pyx_L1_error) + + /* "spacy/vectors.pyx":767 + * "key2row": lambda b: self.key2row.update(srsly.msgpack_loads(b)), + * "vectors": deserialize_weights, + * "vectors.cfg": lambda b: self._set_cfg(srsly.json_loads(b)) # <<<<<<<<<<<<<< + * } + * util.from_bytes(data, deserializers, exclude) +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_10from_bytes_4lambda14, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_kp_u_vectors_cfg, __pyx_t_2) < (0)) __PYX_ERR(0, 764, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_deserializers = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":769 + * "vectors.cfg": lambda b: self._set_cfg(srsly.json_loads(b)) + * } + * util.from_bytes(data, deserializers, exclude) # <<<<<<<<<<<<<< + * self._sync_unset() + * return self +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_from_bytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_data, __pyx_v_deserializers, __pyx_v_exclude}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":770 + * } + * util.from_bytes(data, deserializers, exclude) + * self._sync_unset() # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_4 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sync_unset, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 770, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":771 + * util.from_bytes(data, deserializers, exclude) + * self._sync_unset() + * return self # <<<<<<<<<<<<<< + * + * def clear(self): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + goto __pyx_L0; + + /* "spacy/vectors.pyx":745 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.vectors.Vectors.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_deserialize_weights); + __Pyx_XDECREF(__pyx_v_deserializers); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":773 + * return self + * + * def clear(self): # <<<<<<<<<<<<<< + * """Clear all entries in the vector table. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_54clear(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_53clear, "Vectors.clear(self)\n\nClear all entries in the vector table.\n\nDOCS: https://spacy.io/api/vectors#clear"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_54clear = {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_54clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_53clear}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_54clear(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clear (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("clear", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("clear", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_53clear(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_53clear(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("clear", 0); + + /* "spacy/vectors.pyx":778 + * DOCS: https://spacy.io/api/vectors#clear + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E859) + * self.key2row = {} +*/ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 778, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_floret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 778, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 778, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_t_3)) { + + /* "spacy/vectors.pyx":779 + * """ + * if self.mode == Mode.floret: + * raise ValueError(Errors.E859) # <<<<<<<<<<<<<< + * self.key2row = {} + * self._sync_unset() +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_E859); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 779, __pyx_L1_error) + + /* "spacy/vectors.pyx":778 + * DOCS: https://spacy.io/api/vectors#clear + * """ + * if self.mode == Mode.floret: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E859) + * self.key2row = {} +*/ + } + + /* "spacy/vectors.pyx":780 + * if self.mode == Mode.floret: + * raise ValueError(Errors.E859) + * self.key2row = {} # <<<<<<<<<<<<<< + * self._sync_unset() + * +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->key2row); + __Pyx_DECREF(__pyx_v_self->key2row); + __pyx_v_self->key2row = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":781 + * raise ValueError(Errors.E859) + * self.key2row = {} + * self._sync_unset() # <<<<<<<<<<<<<< + * + * def _sync_unset(self): +*/ + __pyx_t_5 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_sync_unset, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":773 + * return self + * + * def clear(self): # <<<<<<<<<<<<<< + * """Clear all entries in the vector table. + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.vectors.Vectors.clear", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":783 + * self._sync_unset() + * + * def _sync_unset(self): # <<<<<<<<<<<<<< + * filled = {row for row in self.key2row.values()} + * self._unset = cppset[int]({row for row in range(self.data.shape[0]) if row not in filled}) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_56_sync_unset(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_7Vectors_55_sync_unset, "Vectors._sync_unset(self)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_7Vectors_56_sync_unset = {"_sync_unset", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_56_sync_unset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_55_sync_unset}; +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_56_sync_unset(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_sync_unset (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_sync_unset", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_sync_unset", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_55_sync_unset(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_55_sync_unset(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_v_filled = NULL; + PyObject *__pyx_8genexpr7__pyx_v_row = NULL; + PyObject *__pyx_8genexpr8__pyx_v_row = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + std::set __pyx_t_10; + std::set __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_sync_unset", 0); + + /* "spacy/vectors.pyx":784 + * + * def _sync_unset(self): + * filled = {row for row in self.key2row.values()} # <<<<<<<<<<<<<< + * self._unset = cppset[int]({row for row in range(self.data.shape[0]) if row not in filled}) +*/ + { /* enter inner scope */ + __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 784, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_v_self->key2row; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_values, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 784, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 784, __pyx_L5_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 784, __pyx_L5_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_5; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 784, __pyx_L5_error) + #endif + if (__pyx_t_5 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); + #endif + ++__pyx_t_5; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L5_error) + } else { + __pyx_t_2 = __pyx_t_6(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 784, __pyx_L5_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_row, __pyx_t_2); + __pyx_t_2 = 0; + if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_8genexpr7__pyx_v_row))) __PYX_ERR(0, 784, __pyx_L5_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_row); __pyx_8genexpr7__pyx_v_row = 0; + goto __pyx_L9_exit_scope; + __pyx_L5_error:; + __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_row); __pyx_8genexpr7__pyx_v_row = 0; + goto __pyx_L1_error; + __pyx_L9_exit_scope:; + } /* exit inner scope */ + __pyx_v_filled = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vectors.pyx":785 + * def _sync_unset(self): + * filled = {row for row in self.key2row.values()} + * self._unset = cppset[int]({row for row in range(self.data.shape[0]) if row not in filled}) # <<<<<<<<<<<<<< +*/ + { /* enter inner scope */ + __pyx_t_1 = PySet_New(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 785, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = NULL; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 785, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 785, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_8}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 785, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 785, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 785, __pyx_L12_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + { + __pyx_t_3 = __pyx_t_6(__pyx_t_8); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 785, __pyx_L12_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_row, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_9 = (__Pyx_PySet_ContainsTF(__pyx_8genexpr8__pyx_v_row, __pyx_v_filled, Py_NE)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 785, __pyx_L12_error) + if (__pyx_t_9) { + if (unlikely(PySet_Add(__pyx_t_1, (PyObject*)__pyx_8genexpr8__pyx_v_row))) __PYX_ERR(0, 785, __pyx_L12_error) + } + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_row); __pyx_8genexpr8__pyx_v_row = 0; + goto __pyx_L17_exit_scope; + __pyx_L12_error:; + __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_row); __pyx_8genexpr8__pyx_v_row = 0; + goto __pyx_L1_error; + __pyx_L17_exit_scope:; + } /* exit inner scope */ + __pyx_t_10 = __pyx_convert_set_from_py_int(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 785, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + try { + __pyx_t_11 = std::set (__pyx_t_10); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 785, __pyx_L1_error) + } + __pyx_v_self->_unset = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_11); + + /* "spacy/vectors.pyx":783 + * self._sync_unset() + * + * def _sync_unset(self): # <<<<<<<<<<<<<< + * filled = {row for row in self.key2row.values()} + * self._unset = cppset[int]({row for row in range(self.data.shape[0]) if row not in filled}) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.vectors.Vectors._sync_unset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_filled); + __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_row); + __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_row); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":126 + * DOCS: https://spacy.io/api/vectors + * """ + * cdef public object strings # <<<<<<<<<<<<<< + * cdef public object name + * cdef readonly object mode +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7strings_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7strings_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_7strings___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_7strings___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->strings); + __pyx_r = __pyx_v_self->strings; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_7Vectors_7strings_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_7vectors_7Vectors_7strings_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_7strings_2__set__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_7Vectors_7strings_2__set__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->strings); + __Pyx_DECREF(__pyx_v_self->strings); + __pyx_v_self->strings = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_7Vectors_7strings_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_7vectors_7Vectors_7strings_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_7strings_4__del__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_7Vectors_7strings_4__del__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->strings); + __Pyx_DECREF(__pyx_v_self->strings); + __pyx_v_self->strings = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":127 + * """ + * cdef public object strings + * cdef public object name # <<<<<<<<<<<<<< + * cdef readonly object mode + * cdef public object data +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4name_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4name_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_4name___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4name___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_7Vectors_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_7vectors_7Vectors_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_4name_2__set__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_7Vectors_4name_2__set__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_7Vectors_4name_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_7vectors_7Vectors_4name_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_4name_4__del__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_7Vectors_4name_4__del__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":128 + * cdef public object strings + * cdef public object name + * cdef readonly object mode # <<<<<<<<<<<<<< + * cdef public object data + * cdef public object key2row +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4mode_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4mode_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_4mode___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4mode___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->mode); + __pyx_r = __pyx_v_self->mode; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":129 + * cdef public object name + * cdef readonly object mode + * cdef public object data # <<<<<<<<<<<<<< + * cdef public object key2row + * cdef cppset[int] _unset +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4data_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4data_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_4data___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4data___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->data); + __pyx_r = __pyx_v_self->data; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_7Vectors_4data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_7vectors_7Vectors_4data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_4data_2__set__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_7Vectors_4data_2__set__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(__pyx_v_self->data); + __pyx_v_self->data = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_7Vectors_4data_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_7vectors_7Vectors_4data_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_4data_4__del__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_7Vectors_4data_4__del__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(__pyx_v_self->data); + __pyx_v_self->data = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":130 + * cdef readonly object mode + * cdef public object data + * cdef public object key2row # <<<<<<<<<<<<<< + * cdef cppset[int] _unset + * cdef readonly uint32_t minn +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7key2row_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_7key2row_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_7key2row___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_7key2row___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->key2row); + __pyx_r = __pyx_v_self->key2row; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_7Vectors_7key2row_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_7vectors_7Vectors_7key2row_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_7key2row_2__set__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_7Vectors_7key2row_2__set__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->key2row); + __Pyx_DECREF(__pyx_v_self->key2row); + __pyx_v_self->key2row = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_7vectors_7Vectors_7key2row_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_7vectors_7Vectors_7key2row_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_7key2row_4__del__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_7vectors_7Vectors_7key2row_4__del__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->key2row); + __Pyx_DECREF(__pyx_v_self->key2row); + __pyx_v_self->key2row = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":132 + * cdef public object key2row + * cdef cppset[int] _unset + * cdef readonly uint32_t minn # <<<<<<<<<<<<<< + * cdef readonly uint32_t maxn + * cdef readonly uint32_t hash_count +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4minn_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4minn_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_4minn___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4minn___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint32_t(__pyx_v_self->minn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vectors.Vectors.minn.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":133 + * cdef cppset[int] _unset + * cdef readonly uint32_t minn + * cdef readonly uint32_t maxn # <<<<<<<<<<<<<< + * cdef readonly uint32_t hash_count + * cdef readonly uint32_t hash_seed +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4maxn_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4maxn_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_4maxn___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4maxn___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint32_t(__pyx_v_self->maxn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vectors.Vectors.maxn.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":134 + * cdef readonly uint32_t minn + * cdef readonly uint32_t maxn + * cdef readonly uint32_t hash_count # <<<<<<<<<<<<<< + * cdef readonly uint32_t hash_seed + * cdef readonly unicode bow +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_10hash_count_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_10hash_count_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_10hash_count___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_10hash_count___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint32_t(__pyx_v_self->hash_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vectors.Vectors.hash_count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":135 + * cdef readonly uint32_t maxn + * cdef readonly uint32_t hash_count + * cdef readonly uint32_t hash_seed # <<<<<<<<<<<<<< + * cdef readonly unicode bow + * cdef readonly unicode eow +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9hash_seed_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_9hash_seed_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_9hash_seed___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_9hash_seed___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_uint32_t(__pyx_v_self->hash_seed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vectors.Vectors.hash_seed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":136 + * cdef readonly uint32_t hash_count + * cdef readonly uint32_t hash_seed + * cdef readonly unicode bow # <<<<<<<<<<<<<< + * cdef readonly unicode eow + * cdef readonly attr_id_t attr +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_3bow_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_3bow_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_3bow___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_3bow___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->bow); + __pyx_r = __pyx_v_self->bow; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":137 + * cdef readonly uint32_t hash_seed + * cdef readonly unicode bow + * cdef readonly unicode eow # <<<<<<<<<<<<<< + * cdef readonly attr_id_t attr + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_3eow_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_3eow_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_3eow___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_3eow___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->eow); + __pyx_r = __pyx_v_self->eow; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vectors.pyx":138 + * cdef readonly unicode bow + * cdef readonly unicode eow + * cdef readonly attr_id_t attr # <<<<<<<<<<<<<< + * + * def __init__(self, *, strings=None, shape=None, data=None, keys=None, name=None, mode=Mode.default, minn=0, maxn=0, hash_count=1, hash_seed=0, bow="<", eow=">", attr="ORTH"): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4attr_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_7vectors_7Vectors_4attr_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_7vectors_7Vectors_4attr___get__(((struct __pyx_obj_5spacy_7vectors_Vectors *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_7Vectors_4attr___get__(struct __pyx_obj_5spacy_7vectors_Vectors *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_v_self->attr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vectors.Vectors.attr.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_BaseVectors(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_7vectors_5__pyx_unpickle_BaseVectors(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_7vectors_4__pyx_unpickle_BaseVectors, "__pyx_unpickle_BaseVectors(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_7vectors_5__pyx_unpickle_BaseVectors = {"__pyx_unpickle_BaseVectors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_5__pyx_unpickle_BaseVectors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_4__pyx_unpickle_BaseVectors}; +static PyObject *__pyx_pw_5spacy_7vectors_5__pyx_unpickle_BaseVectors(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_BaseVectors (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 4, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_BaseVectors", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseVectors", 1, 3, 3, i); __PYX_ERR(1, 4, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseVectors", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vectors.__pyx_unpickle_BaseVectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_7vectors_4__pyx_unpickle_BaseVectors(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_7vectors_4__pyx_unpickle_BaseVectors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_BaseVectors", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_BaseVectors(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') # <<<<<<<<<<<<<< + * __pyx_result = BaseVectors.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, ((char const *)"")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = BaseVectors.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_BaseVectors__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = BaseVectors.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_BaseVectors__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = BaseVectors.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_BaseVectors__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_BaseVectors__set_state(BaseVectors __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_7vectors___pyx_unpickle_BaseVectors__set_state(((struct __pyx_obj_5spacy_7vectors_BaseVectors *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') + * __pyx_result = BaseVectors.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_BaseVectors__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_BaseVectors__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_BaseVectors__set_state(BaseVectors __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_BaseVectors(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.vectors.__pyx_unpickle_BaseVectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_BaseVectors__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_BaseVectors__set_state(BaseVectors __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + +static PyObject *__pyx_f_5spacy_7vectors___pyx_unpickle_BaseVectors__set_state(struct __pyx_obj_5spacy_7vectors_BaseVectors *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_BaseVectors__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_BaseVectors__set_state(BaseVectors __pyx_result, __pyx_state: tuple): + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 0); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_BaseVectors__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_BaseVectors__set_state(BaseVectors __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 0) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vectors.__pyx_unpickle_BaseVectors__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ + +static PyObject *__pyx_tp_new_5spacy_7vectors_BaseVectors(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + return o; +} + +static void __pyx_tp_dealloc_5spacy_7vectors_BaseVectors(PyObject *o) { + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7vectors_BaseVectors) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static PyObject *__pyx_sq_item_5spacy_7vectors_BaseVectors(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_5spacy_7vectors_11BaseVectors_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_11BaseVectors_5shape_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_11BaseVectors_vectors_length(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_11BaseVectors_14vectors_length_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_11BaseVectors_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_11BaseVectors_4size_1__get__(o); +} + +static PyMethodDef __pyx_methods_5spacy_7vectors_BaseVectors[] = { + {"is_full", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_7is_full, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_6is_full}, + {"get_batch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_9get_batch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_8get_batch}, + {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_13add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_12add}, + {"to_ops", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_15to_ops, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_14to_ops}, + {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_17to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_16to_bytes}, + {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_19from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_18from_bytes}, + {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_21to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_20to_disk}, + {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_23from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_22from_disk}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_25__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_24__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_11BaseVectors_27__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_11BaseVectors_26__setstate_cython__}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5spacy_7vectors_BaseVectors[] = { + {"shape", __pyx_getprop_5spacy_7vectors_11BaseVectors_shape, 0, 0, 0}, + {"vectors_length", __pyx_getprop_5spacy_7vectors_11BaseVectors_vectors_length, 0, 0, 0}, + {"size", __pyx_getprop_5spacy_7vectors_11BaseVectors_size, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7vectors_BaseVectors_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7vectors_BaseVectors}, + {Py_sq_length, (void *)__pyx_pw_5spacy_7vectors_11BaseVectors_11__len__}, + {Py_sq_item, (void *)__pyx_sq_item_5spacy_7vectors_BaseVectors}, + {Py_sq_contains, (void *)__pyx_pw_5spacy_7vectors_11BaseVectors_5__contains__}, + {Py_mp_length, (void *)__pyx_pw_5spacy_7vectors_11BaseVectors_11__len__}, + {Py_mp_subscript, (void *)__pyx_pw_5spacy_7vectors_11BaseVectors_3__getitem__}, + {Py_tp_doc, (void *)PyDoc_STR("BaseVectors(strings=None, *)")}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_7vectors_BaseVectors}, + {Py_tp_getset, (void *)__pyx_getsets_5spacy_7vectors_BaseVectors}, + {Py_tp_init, (void *)__pyx_pw_5spacy_7vectors_11BaseVectors_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7vectors_BaseVectors}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7vectors_BaseVectors_spec = { + "spacy.vectors.BaseVectors", + sizeof(struct __pyx_obj_5spacy_7vectors_BaseVectors), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_5spacy_7vectors_BaseVectors_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_BaseVectors = { + __pyx_pw_5spacy_7vectors_11BaseVectors_11__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_5spacy_7vectors_BaseVectors, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + __pyx_pw_5spacy_7vectors_11BaseVectors_5__contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BaseVectors = { + __pyx_pw_5spacy_7vectors_11BaseVectors_11__len__, /*mp_length*/ + __pyx_pw_5spacy_7vectors_11BaseVectors_3__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_5spacy_7vectors_BaseVectors = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vectors.""BaseVectors", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7vectors_BaseVectors), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7vectors_BaseVectors, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_BaseVectors, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BaseVectors, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + PyDoc_STR("BaseVectors(strings=None, *)"), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_7vectors_BaseVectors, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5spacy_7vectors_BaseVectors, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_5spacy_7vectors_11BaseVectors_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7vectors_BaseVectors, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_7vectors_Vectors(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_5spacy_7vectors_Vectors *p; + PyObject *o = __pyx_tp_new_5spacy_7vectors_BaseVectors(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_7vectors_Vectors *)o); + __Pyx_default_placement_construct(&(p->_unset)); + p->strings = Py_None; Py_INCREF(Py_None); + p->name = Py_None; Py_INCREF(Py_None); + p->mode = Py_None; Py_INCREF(Py_None); + p->data = Py_None; Py_INCREF(Py_None); + p->key2row = Py_None; Py_INCREF(Py_None); + p->bow = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->eow = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5spacy_7vectors_Vectors(PyObject *o) { + struct __pyx_obj_5spacy_7vectors_Vectors *p = (struct __pyx_obj_5spacy_7vectors_Vectors *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7vectors_Vectors) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + __Pyx_call_destructor(p->_unset); + Py_CLEAR(p->strings); + Py_CLEAR(p->name); + Py_CLEAR(p->mode); + Py_CLEAR(p->data); + Py_CLEAR(p->key2row); + Py_CLEAR(p->bow); + Py_CLEAR(p->eow); + __pyx_tp_dealloc_5spacy_7vectors_BaseVectors(o); +} + +static int __pyx_tp_traverse_5spacy_7vectors_Vectors(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7vectors_Vectors *p = (struct __pyx_obj_5spacy_7vectors_Vectors *)o; + #if !CYTHON_USE_MODULE_STATE + e = 0; + if (likely(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors)) { + traverseproc traverse = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, tp_traverse, traverseproc); + if (traverse) { e = traverse(o, v, a); } + } else + #endif + { e = __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5spacy_7vectors_Vectors); } + if (e) return e; + { + e = __Pyx_call_type_traverse(o, 0, v, a); + if (e) return e; + } + if (p->strings) { + e = (*v)(p->strings, a); if (e) return e; + } + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + if (p->mode) { + e = (*v)(p->mode, a); if (e) return e; + } + if (p->data) { + e = (*v)(p->data, a); if (e) return e; + } + if (p->key2row) { + e = (*v)(p->key2row, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_7vectors_Vectors(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_7vectors_Vectors *p = (struct __pyx_obj_5spacy_7vectors_Vectors *)o; + #if !CYTHON_USE_MODULE_STATE + if (likely(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors)) { + inquiry clear = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, tp_clear, inquiry); + if (clear) clear(o); + } else + #endif + { __Pyx_call_next_tp_clear(o, __pyx_tp_clear_5spacy_7vectors_Vectors); } + tmp = ((PyObject*)p->strings); + p->strings = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->mode); + p->mode = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->data); + p->data = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->key2row); + p->key2row = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_sq_item_5spacy_7vectors_Vectors(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_5spacy_7vectors_Vectors(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pw_5spacy_7vectors_7Vectors_7__setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + objobjargproc f = __Pyx_PyType_TryGetSubSlot(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, tp_as_mapping, mp_ass_subscript, objobjargproc); + if (f) + return f(o, i, v); + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_tp_richcompare_5spacy_7vectors_Vectors(PyObject *o1, PyObject *o2, int op) { + switch (op) { + case Py_EQ: { + return __pyx_pw_5spacy_7vectors_7Vectors_16__eq__(o1, o2); + } + case Py_NE: { + PyObject *ret; + ret = __pyx_pw_5spacy_7vectors_7Vectors_16__eq__(o1, o2); + if (likely(ret && ret != Py_NotImplemented)) { + int b = __Pyx_PyObject_IsTrue(ret); + Py_DECREF(ret); + if (unlikely(b < 0)) return NULL; + ret = (b) ? Py_False : Py_True; + Py_INCREF(ret); + } + return ret; + } + default: { + return __Pyx_NewRef(Py_NotImplemented); + } + } +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_5shape_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_4size_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_is_full(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_7is_full_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_n_keys(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_6n_keys_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_strings(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_7strings_1__get__(o); +} + +static int __pyx_setprop_5spacy_7vectors_7Vectors_strings(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_7vectors_7Vectors_7strings_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_7vectors_7Vectors_7strings_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_name(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_4name_1__get__(o); +} + +static int __pyx_setprop_5spacy_7vectors_7Vectors_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_7vectors_7Vectors_4name_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_7vectors_7Vectors_4name_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_mode(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_4mode_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_data(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_4data_1__get__(o); +} + +static int __pyx_setprop_5spacy_7vectors_7Vectors_data(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_7vectors_7Vectors_4data_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_7vectors_7Vectors_4data_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_key2row(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_7key2row_1__get__(o); +} + +static int __pyx_setprop_5spacy_7vectors_7Vectors_key2row(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_7vectors_7Vectors_7key2row_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_7vectors_7Vectors_7key2row_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_minn(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_4minn_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_maxn(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_4maxn_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_hash_count(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_10hash_count_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_hash_seed(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_9hash_seed_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_bow(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_3bow_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_eow(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_3eow_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_7vectors_7Vectors_attr(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_7vectors_7Vectors_4attr_1__get__(o); +} + +static PyMethodDef __pyx_methods_5spacy_7vectors_Vectors[] = { + {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_3__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_2__reduce__}, + {"resize", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_18resize, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_17resize}, + {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_20keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_19keys}, + {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_22values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_21values}, + {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_25items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_24items}, + {"find", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_28find, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_27find}, + {"_get_ngram_hashes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_30_get_ngram_hashes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_29_get_ngram_hashes}, + {"_get_ngrams", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_32_get_ngrams, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_31_get_ngrams}, + {"get_batch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_34get_batch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_33get_batch}, + {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_36add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_35add}, + {"most_similar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_38most_similar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_37most_similar}, + {"to_ops", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_40to_ops, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_39to_ops}, + {"_get_cfg", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_42_get_cfg, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_41_get_cfg}, + {"_set_cfg", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_44_set_cfg, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_43_set_cfg}, + {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_46to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_45to_disk}, + {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_48from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_47from_disk}, + {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_50to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_49to_bytes}, + {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_52from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_51from_bytes}, + {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_54clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_53clear}, + {"_sync_unset", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_7vectors_7Vectors_56_sync_unset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_7vectors_7Vectors_55_sync_unset}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5spacy_7vectors_Vectors[] = { + {"shape", __pyx_getprop_5spacy_7vectors_7Vectors_shape, 0, PyDoc_STR("Get `(rows, dims)` tuples of number of rows and number of dimensions\n in the vector table.\n\n RETURNS (tuple): A `(rows, dims)` pair.\n\n DOCS: https://spacy.io/api/vectors#shape\n "), 0}, + {"size", __pyx_getprop_5spacy_7vectors_7Vectors_size, 0, PyDoc_STR("The vector size i,e. rows * dims.\n\n RETURNS (int): The vector size.\n\n DOCS: https://spacy.io/api/vectors#size\n "), 0}, + {"is_full", __pyx_getprop_5spacy_7vectors_7Vectors_is_full, 0, PyDoc_STR("Whether the vectors table is full.\n\n RETURNS (bool): `True` if no slots are available for new keys.\n\n DOCS: https://spacy.io/api/vectors#is_full\n "), 0}, + {"n_keys", __pyx_getprop_5spacy_7vectors_7Vectors_n_keys, 0, PyDoc_STR("Get the number of keys in the table. Note that this is the number\n of all keys, not just unique vectors.\n\n RETURNS (int): The number of keys in the table for default vectors.\n For floret vectors, return -1.\n\n DOCS: https://spacy.io/api/vectors#n_keys\n "), 0}, + {"strings", __pyx_getprop_5spacy_7vectors_7Vectors_strings, __pyx_setprop_5spacy_7vectors_7Vectors_strings, PyDoc_STR("strings: object"), 0}, + {"name", __pyx_getprop_5spacy_7vectors_7Vectors_name, __pyx_setprop_5spacy_7vectors_7Vectors_name, PyDoc_STR("name: object"), 0}, + {"mode", __pyx_getprop_5spacy_7vectors_7Vectors_mode, 0, 0, 0}, + {"data", __pyx_getprop_5spacy_7vectors_7Vectors_data, __pyx_setprop_5spacy_7vectors_7Vectors_data, PyDoc_STR("data: object"), 0}, + {"key2row", __pyx_getprop_5spacy_7vectors_7Vectors_key2row, __pyx_setprop_5spacy_7vectors_7Vectors_key2row, PyDoc_STR("key2row: object"), 0}, + {"minn", __pyx_getprop_5spacy_7vectors_7Vectors_minn, 0, 0, 0}, + {"maxn", __pyx_getprop_5spacy_7vectors_7Vectors_maxn, 0, 0, 0}, + {"hash_count", __pyx_getprop_5spacy_7vectors_7Vectors_hash_count, 0, 0, 0}, + {"hash_seed", __pyx_getprop_5spacy_7vectors_7Vectors_hash_seed, 0, 0, 0}, + {"bow", __pyx_getprop_5spacy_7vectors_7Vectors_bow, 0, 0, 0}, + {"eow", __pyx_getprop_5spacy_7vectors_7Vectors_eow, 0, 0, 0}, + {"attr", __pyx_getprop_5spacy_7vectors_7Vectors_attr, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7vectors_Vectors_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7vectors_Vectors}, + {Py_sq_length, (void *)__pyx_pw_5spacy_7vectors_7Vectors_12__len__}, + {Py_sq_item, (void *)__pyx_sq_item_5spacy_7vectors_Vectors}, + {Py_sq_contains, (void *)__pyx_pw_5spacy_7vectors_7Vectors_14__contains__}, + {Py_mp_length, (void *)__pyx_pw_5spacy_7vectors_7Vectors_12__len__}, + {Py_mp_subscript, (void *)__pyx_pw_5spacy_7vectors_7Vectors_5__getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_5spacy_7vectors_Vectors}, + {Py_tp_doc, (void *)PyDoc_STR("Vectors(strings=None, *, shape=None, data=None, keys=None, name=None, mode=Mode.default, minn=0, maxn=0, hash_count=1, hash_seed=0, bow='<', eow='>', attr='ORTH')\n\nStore, save and load word vectors.\n\nVectors data is kept in the vectors.data attribute, which should be an\ninstance of numpy.ndarray (for CPU vectors) or cupy.ndarray\n(for GPU vectors).\n\nIn the default mode, `vectors.key2row` is a dictionary mapping word hashes\nto rows in the vectors.data table. Multiple keys can be mapped to the same\nvector, and not all of the rows in the table need to be assigned - so\nlen(list(vectors.keys())) may be greater or smaller than vectors.shape[0].\n\nIn floret mode, the floret settings (minn, maxn, etc.) are used to\ncalculate the vector from the rows corresponding to the key's ngrams.\n\nDOCS: https://spacy.io/api/vectors")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7vectors_Vectors}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_7vectors_Vectors}, + {Py_tp_richcompare, (void *)__pyx_tp_richcompare_5spacy_7vectors_Vectors}, + {Py_tp_iter, (void *)__pyx_pw_5spacy_7vectors_7Vectors_9__iter__}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_7vectors_Vectors}, + {Py_tp_getset, (void *)__pyx_getsets_5spacy_7vectors_Vectors}, + {Py_tp_init, (void *)__pyx_pw_5spacy_7vectors_7Vectors_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7vectors_Vectors}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7vectors_Vectors_spec = { + "spacy.vectors.Vectors", + sizeof(struct __pyx_obj_5spacy_7vectors_Vectors), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7vectors_Vectors_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_Vectors = { + __pyx_pw_5spacy_7vectors_7Vectors_12__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_5spacy_7vectors_Vectors, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + __pyx_pw_5spacy_7vectors_7Vectors_14__contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_Vectors = { + __pyx_pw_5spacy_7vectors_7Vectors_12__len__, /*mp_length*/ + __pyx_pw_5spacy_7vectors_7Vectors_5__getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_5spacy_7vectors_Vectors, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_5spacy_7vectors_Vectors = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vectors.""Vectors", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7vectors_Vectors), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7vectors_Vectors, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_Vectors, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Vectors, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + PyDoc_STR("Vectors(strings=None, *, shape=None, data=None, keys=None, name=None, mode=Mode.default, minn=0, maxn=0, hash_count=1, hash_seed=0, bow='<', eow='>', attr='ORTH')\n\nStore, save and load word vectors.\n\nVectors data is kept in the vectors.data attribute, which should be an\ninstance of numpy.ndarray (for CPU vectors) or cupy.ndarray\n(for GPU vectors).\n\nIn the default mode, `vectors.key2row` is a dictionary mapping word hashes\nto rows in the vectors.data table. Multiple keys can be mapped to the same\nvector, and not all of the rows in the table need to be assigned - so\nlen(list(vectors.keys())) may be greater or smaller than vectors.shape[0].\n\nIn floret mode, the floret settings (minn, maxn, etc.) are used to\ncalculate the vector from the rows corresponding to the key's ngrams.\n\nDOCS: https://spacy.io/api/vectors"), /*tp_doc*/ + __pyx_tp_traverse_5spacy_7vectors_Vectors, /*tp_traverse*/ + __pyx_tp_clear_5spacy_7vectors_Vectors, /*tp_clear*/ + __pyx_tp_richcompare_5spacy_7vectors_Vectors, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_5spacy_7vectors_7Vectors_9__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_7vectors_Vectors, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5spacy_7vectors_Vectors, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_5spacy_7vectors_7Vectors_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7vectors_Vectors, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct____iter__ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct____iter__[--__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct____iter__]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct____iter__(PyObject *o) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__ *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct____iter__) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct____iter__ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct____iter__[__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct____iter__++] = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__ *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__ *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7vectors___pyx_scope_struct____iter___slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct____iter__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct____iter__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct____iter__}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7vectors___pyx_scope_struct____iter___spec = { + "spacy.vectors.__pyx_scope_struct____iter__", + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7vectors___pyx_scope_struct____iter___slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_7vectors___pyx_scope_struct____iter__ = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vectors.""__pyx_scope_struct____iter__", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct____iter__), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct____iter__, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct____iter__, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7vectors___pyx_scope_struct____iter__, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_1_values(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_1_values > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_1_values[--__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_1_values]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_1_values(PyObject *o) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_1_values) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_row); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_vector); + Py_CLEAR(p->__pyx_t_0); + Py_CLEAR(p->__pyx_t_1); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_1_values < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_1_values[__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_1_values++] = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_1_values(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_row) { + e = (*v)(p->__pyx_v_row, a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + if (p->__pyx_v_vector) { + e = (*v)(p->__pyx_v_vector, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + if (p->__pyx_t_1) { + e = (*v)(p->__pyx_t_1, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7vectors___pyx_scope_struct_1_values_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_1_values}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_1_values}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_1_values}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7vectors___pyx_scope_struct_1_values_spec = { + "spacy.vectors.__pyx_scope_struct_1_values", + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7vectors___pyx_scope_struct_1_values_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_7vectors___pyx_scope_struct_1_values = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vectors.""__pyx_scope_struct_1_values", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_1_values), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_1_values, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_1_values, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7vectors___pyx_scope_struct_1_values, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_2_items(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_2_items > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_2_items[--__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_2_items]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_2_items(PyObject *o) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_2_items) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_key); + Py_CLEAR(p->__pyx_v_row); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_t_0); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_2_items < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_2_items[__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_2_items++] = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_2_items(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_key) { + e = (*v)(p->__pyx_v_key, a); if (e) return e; + } + if (p->__pyx_v_row) { + e = (*v)(p->__pyx_v_row, a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7vectors___pyx_scope_struct_2_items_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_2_items}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_2_items}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_2_items}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7vectors___pyx_scope_struct_2_items_spec = { + "spacy.vectors.__pyx_scope_struct_2_items", + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7vectors___pyx_scope_struct_2_items_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_7vectors___pyx_scope_struct_2_items = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vectors.""__pyx_scope_struct_2_items", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_2_items), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_2_items, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_2_items, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7vectors___pyx_scope_struct_2_items, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_3_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_3_genexpr[--__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_3_genexpr]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_3_genexpr(PyObject *o) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_3_genexpr) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_genexpr_arg_0); + Py_CLEAR(p->__pyx_v_arg); + Py_CLEAR(p->__pyx_t_0); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_3_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_3_genexpr[__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_genexpr_arg_0) { + e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e; + } + if (p->__pyx_v_arg) { + e = (*v)(p->__pyx_v_arg, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7vectors___pyx_scope_struct_3_genexpr_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_3_genexpr}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_3_genexpr}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_3_genexpr}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7vectors___pyx_scope_struct_3_genexpr_spec = { + "spacy.vectors.__pyx_scope_struct_3_genexpr", + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7vectors___pyx_scope_struct_3_genexpr_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_7vectors___pyx_scope_struct_3_genexpr = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vectors.""__pyx_scope_struct_3_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_3_genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_3_genexpr, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_3_genexpr, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7vectors___pyx_scope_struct_3_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_4_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_4_genexpr[--__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_4_genexpr]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_4_genexpr(PyObject *o) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_4_genexpr) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_genexpr_arg_0); + Py_CLEAR(p->__pyx_v_key); + Py_CLEAR(p->__pyx_t_0); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_4_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_4_genexpr[__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_genexpr_arg_0) { + e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e; + } + if (p->__pyx_v_key) { + e = (*v)(p->__pyx_v_key, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7vectors___pyx_scope_struct_4_genexpr_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_4_genexpr}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_4_genexpr}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_4_genexpr}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7vectors___pyx_scope_struct_4_genexpr_spec = { + "spacy.vectors.__pyx_scope_struct_4_genexpr", + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7vectors___pyx_scope_struct_4_genexpr_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_7vectors___pyx_scope_struct_4_genexpr = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vectors.""__pyx_scope_struct_4_genexpr", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_4_genexpr), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_4_genexpr, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_4_genexpr, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7vectors___pyx_scope_struct_4_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_5_to_disk(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_5_to_disk > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_5_to_disk[--__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_5_to_disk]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_5_to_disk(PyObject *o) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_5_to_disk) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_save_array); + Py_CLEAR(p->__pyx_v_save_vectors); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_xp); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_5_to_disk < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_5_to_disk[__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_5_to_disk++] = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_5_to_disk(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_save_array) { + e = (*v)(p->__pyx_v_save_array, a); if (e) return e; + } + if (p->__pyx_v_save_vectors) { + e = (*v)(p->__pyx_v_save_vectors, a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + if (p->__pyx_v_xp) { + e = (*v)(p->__pyx_v_xp, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_7vectors___pyx_scope_struct_5_to_disk(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk *)o; + tmp = ((PyObject*)p->__pyx_v_save_array); + p->__pyx_v_save_array = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_save_vectors); + p->__pyx_v_save_vectors = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_5spacy_7vectors_Vectors *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_xp); + p->__pyx_v_xp = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7vectors___pyx_scope_struct_5_to_disk_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_5_to_disk}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_5_to_disk}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_7vectors___pyx_scope_struct_5_to_disk}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_5_to_disk}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7vectors___pyx_scope_struct_5_to_disk_spec = { + "spacy.vectors.__pyx_scope_struct_5_to_disk", + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7vectors___pyx_scope_struct_5_to_disk_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_7vectors___pyx_scope_struct_5_to_disk = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vectors.""__pyx_scope_struct_5_to_disk", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_5_to_disk), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_5_to_disk, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_5_to_disk, /*tp_traverse*/ + __pyx_tp_clear_5spacy_7vectors___pyx_scope_struct_5_to_disk, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7vectors___pyx_scope_struct_5_to_disk, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_6_from_disk(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_6_from_disk > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_6_from_disk[--__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_6_from_disk]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_6_from_disk(PyObject *o) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_6_from_disk) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_6_from_disk < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_6_from_disk[__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_6_from_disk++] = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_6_from_disk(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_7vectors___pyx_scope_struct_6_from_disk(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk *)o; + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_5spacy_7vectors_Vectors *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7vectors___pyx_scope_struct_6_from_disk_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_6_from_disk}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_6_from_disk}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_7vectors___pyx_scope_struct_6_from_disk}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_6_from_disk}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7vectors___pyx_scope_struct_6_from_disk_spec = { + "spacy.vectors.__pyx_scope_struct_6_from_disk", + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7vectors___pyx_scope_struct_6_from_disk_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_7vectors___pyx_scope_struct_6_from_disk = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vectors.""__pyx_scope_struct_6_from_disk", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_6_from_disk), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_6_from_disk, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_6_from_disk, /*tp_traverse*/ + __pyx_tp_clear_5spacy_7vectors___pyx_scope_struct_6_from_disk, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7vectors___pyx_scope_struct_6_from_disk, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_7_to_bytes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_7_to_bytes > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_7_to_bytes[--__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_7_to_bytes]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_7_to_bytes(PyObject *o) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_7_to_bytes) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_7_to_bytes < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_7_to_bytes[__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_7_to_bytes++] = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_7_to_bytes(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_7vectors___pyx_scope_struct_7_to_bytes(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes *)o; + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_5spacy_7vectors_Vectors *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7vectors___pyx_scope_struct_7_to_bytes_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_7_to_bytes}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_7_to_bytes}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_7vectors___pyx_scope_struct_7_to_bytes}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_7_to_bytes}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7vectors___pyx_scope_struct_7_to_bytes_spec = { + "spacy.vectors.__pyx_scope_struct_7_to_bytes", + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7vectors___pyx_scope_struct_7_to_bytes_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_7vectors___pyx_scope_struct_7_to_bytes = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vectors.""__pyx_scope_struct_7_to_bytes", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_7_to_bytes), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_7_to_bytes, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_7_to_bytes, /*tp_traverse*/ + __pyx_tp_clear_5spacy_7vectors___pyx_scope_struct_7_to_bytes, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7vectors___pyx_scope_struct_7_to_bytes, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_8_from_bytes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_8_from_bytes > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_8_from_bytes[--__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_8_from_bytes]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_8_from_bytes(PyObject *o) { + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_8_from_bytes) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_8_from_bytes < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes, sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_7vectors___pyx_scope_struct_8_from_bytes[__pyx_mstate_global->__pyx_freecount_5spacy_7vectors___pyx_scope_struct_8_from_bytes++] = ((struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_8_from_bytes(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_7vectors___pyx_scope_struct_8_from_bytes(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *p = (struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes *)o; + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_5spacy_7vectors_Vectors *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_7vectors___pyx_scope_struct_8_from_bytes_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_8_from_bytes}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_8_from_bytes}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_7vectors___pyx_scope_struct_8_from_bytes}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_7vectors___pyx_scope_struct_8_from_bytes}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_7vectors___pyx_scope_struct_8_from_bytes_spec = { + "spacy.vectors.__pyx_scope_struct_8_from_bytes", + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_7vectors___pyx_scope_struct_8_from_bytes_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_7vectors___pyx_scope_struct_8_from_bytes = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vectors.""__pyx_scope_struct_8_from_bytes", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_7vectors___pyx_scope_struct_8_from_bytes), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_7vectors___pyx_scope_struct_8_from_bytes, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_7vectors___pyx_scope_struct_8_from_bytes, /*tp_traverse*/ + __pyx_tp_clear_5spacy_7vectors___pyx_scope_struct_8_from_bytes, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_7vectors___pyx_scope_struct_8_from_bytes, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +/* #### Code section: initfunc_declarations ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ +/* #### Code section: init_module ### */ + +static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7vectors_BaseVectors = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7vectors_BaseVectors_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors_BaseVectors)) __PYX_ERR(0, 45, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7vectors_BaseVectors_spec, __pyx_mstate->__pyx_ptype_5spacy_7vectors_BaseVectors) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7vectors_BaseVectors = &__pyx_type_5spacy_7vectors_BaseVectors; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7vectors_BaseVectors) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7vectors_BaseVectors); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors_BaseVectors->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7vectors_BaseVectors->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7vectors_BaseVectors->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_BaseVectors, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_7vectors_BaseVectors) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_7vectors_BaseVectors) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7vectors_Vectors_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors)) __PYX_ERR(0, 109, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7vectors_Vectors_spec, __pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors) < (0)) __PYX_ERR(0, 109, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors = &__pyx_type_5spacy_7vectors_Vectors; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors->tp_base = __pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors) < (0)) __PYX_ERR(0, 109, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 109, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_7vectors_7Vectors___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_7vectors_7Vectors___init__.doc = __pyx_doc_5spacy_7vectors_7Vectors___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_7vectors_7Vectors___init__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 109, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_7vectors_7Vectors_4__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_7vectors_7Vectors_4__getitem__.doc = __pyx_doc_5spacy_7vectors_7Vectors_4__getitem__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_7vectors_7Vectors_4__getitem__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 109, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_7vectors_7Vectors_6__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_7vectors_7Vectors_6__setitem__.doc = __pyx_doc_5spacy_7vectors_7Vectors_6__setitem__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_7vectors_7Vectors_6__setitem__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(0, 109, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_7vectors_7Vectors_8__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_7vectors_7Vectors_8__iter__.doc = __pyx_doc_5spacy_7vectors_7Vectors_8__iter__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_7vectors_7Vectors_8__iter__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(0, 109, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_7vectors_7Vectors_11__len__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_7vectors_7Vectors_11__len__.doc = __pyx_doc_5spacy_7vectors_7Vectors_11__len__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_7vectors_7Vectors_11__len__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(0, 109, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_7vectors_7Vectors_13__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_7vectors_7Vectors_13__contains__.doc = __pyx_doc_5spacy_7vectors_7Vectors_13__contains__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_7vectors_7Vectors_13__contains__; + } + } + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Vectors, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_7vectors_Vectors) < (0)) __PYX_ERR(0, 109, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7vectors___pyx_scope_struct____iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__)) __PYX_ERR(0, 298, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7vectors___pyx_scope_struct____iter___spec, __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__) < (0)) __PYX_ERR(0, 298, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__ = &__pyx_type_5spacy_7vectors___pyx_scope_struct____iter__; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__) < (0)) __PYX_ERR(0, 298, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct____iter__->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7vectors___pyx_scope_struct_1_values_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values)) __PYX_ERR(0, 380, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7vectors___pyx_scope_struct_1_values_spec, __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values) < (0)) __PYX_ERR(0, 380, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values = &__pyx_type_5spacy_7vectors___pyx_scope_struct_1_values; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values) < (0)) __PYX_ERR(0, 380, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_1_values->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7vectors___pyx_scope_struct_2_items_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items)) __PYX_ERR(0, 394, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7vectors___pyx_scope_struct_2_items_spec, __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items) < (0)) __PYX_ERR(0, 394, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items = &__pyx_type_5spacy_7vectors___pyx_scope_struct_2_items; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items) < (0)) __PYX_ERR(0, 394, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_2_items->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7vectors___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 424, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7vectors___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 424, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr = &__pyx_type_5spacy_7vectors___pyx_scope_struct_3_genexpr; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr) < (0)) __PYX_ERR(0, 424, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_3_genexpr->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7vectors___pyx_scope_struct_4_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr)) __PYX_ERR(0, 486, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7vectors___pyx_scope_struct_4_genexpr_spec, __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 486, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr = &__pyx_type_5spacy_7vectors___pyx_scope_struct_4_genexpr; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 486, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_4_genexpr->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7vectors___pyx_scope_struct_5_to_disk_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk)) __PYX_ERR(0, 648, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7vectors___pyx_scope_struct_5_to_disk_spec, __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk) < (0)) __PYX_ERR(0, 648, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk = &__pyx_type_5spacy_7vectors___pyx_scope_struct_5_to_disk; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk) < (0)) __PYX_ERR(0, 648, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_5_to_disk->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7vectors___pyx_scope_struct_6_from_disk_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk)) __PYX_ERR(0, 678, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7vectors___pyx_scope_struct_6_from_disk_spec, __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk) < (0)) __PYX_ERR(0, 678, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk = &__pyx_type_5spacy_7vectors___pyx_scope_struct_6_from_disk; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk) < (0)) __PYX_ERR(0, 678, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_6_from_disk->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7vectors___pyx_scope_struct_7_to_bytes_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes)) __PYX_ERR(0, 722, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7vectors___pyx_scope_struct_7_to_bytes_spec, __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes) < (0)) __PYX_ERR(0, 722, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes = &__pyx_type_5spacy_7vectors___pyx_scope_struct_7_to_bytes; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes) < (0)) __PYX_ERR(0, 722, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_7_to_bytes->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_7vectors___pyx_scope_struct_8_from_bytes_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes)) __PYX_ERR(0, 745, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_7vectors___pyx_scope_struct_8_from_bytes_spec, __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes) < (0)) __PYX_ERR(0, 745, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes = &__pyx_type_5spacy_7vectors___pyx_scope_struct_8_from_bytes; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes) < (0)) __PYX_ERR(0, 745, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_7vectors___pyx_scope_struct_8_from_bytes->tp_getattro = PyObject_GenericGetAttr; + } + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(2, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(2, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(2, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(2, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(2, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(3, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(3, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(3, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(3, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(4, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(4, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("murmurhash.mrmr"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_uint64_t_void_int_uint64_t_void); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 76; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash128_x64, (void (**)(void)) NULL}; + void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportFunction_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_vectors(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_vectors}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #endif + #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE + {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, + #endif + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "vectors", + 0, /* m_doc */ + #if CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstatetype), /* m_size */ + #else + (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif + +/* PyModInitFuncType */ +#ifndef CYTHON_NO_PYINIT_EXPORT + #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#else + #ifdef __cplusplus + #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * + #else + #define __Pyx_PyMODINIT_FUNC PyObject * + #endif +#endif + +__Pyx_PyMODINIT_FUNC PyInit_vectors(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_vectors(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +/* ModuleCreationPEP489 */ +#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) +static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { + { + PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think + if (!module) { + PyErr_Clear(); // just try the 3.8-3.12 version + module = PyImport_ImportModule("_xxsubinterpreters"); + if (!module) goto bad; + } + PyObject *current = PyObject_CallMethod(module, "get_current", NULL); + Py_DECREF(module); + if (!current) goto bad; + if (PyTuple_Check(current)) { + PyObject *new_current = PySequence_GetItem(current, 0); + Py_DECREF(current); + current = new_current; + if (!new_current) goto bad; + } + long long as_c_int = PyLong_AsLongLong(current); + Py_DECREF(current); + return as_c_int; + } + bad: + PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); + return -1; +} +#endif +#if !CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + static PY_INT64_T main_interpreter_id = -1; +#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_GRAAL + PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) + PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); +#elif CYTHON_COMPILING_IN_LIMITED_API + PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); +#else + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); +#endif + if (unlikely(current_id == -1)) { + return -1; + } + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return 0; + } else if (unlikely(main_interpreter_id != current_id)) { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#endif +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + #if !CYTHON_USE_MODULE_STATE + if (__Pyx_check_single_interpreter()) + return NULL; + #endif + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_vectors(PyObject *__pyx_pyinit_module) +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + __pyx_mstatetype *__pyx_mstate = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'vectors' has already been imported. Re-initialisation is not supported."); + return -1; + } + #else + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_t_1 = __pyx_pyinit_module; + Py_INCREF(__pyx_t_1); + #else + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #if CYTHON_USE_MODULE_STATE + { + int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "vectors" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = __pyx_t_1; + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); + #endif + __pyx_mstate = __pyx_mstate_global; + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_mstate->__pyx_d); + __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /* ImportRefnannyAPI */ + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + +__Pyx_RefNannySetupContext("PyInit_vectors", 0); + __Pyx_init_runtime_version(); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Library function declarations ---*/ + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_module_is_main_spacy__vectors) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "spacy.vectors")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.vectors", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(__pyx_mstate); + (void)__Pyx_modinit_variable_export_code(__pyx_mstate); + (void)__Pyx_modinit_function_export_code(__pyx_mstate); + if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_variable_import_code(__pyx_mstate); + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "spacy/vectors.pyx":2 + * # cython: infer_types=True, binding=True + * from typing import Callable # <<<<<<<<<<<<<< + * + * from cython.operator cimport dereference as deref +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Callable}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_typing, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Callable}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":9 + * from murmurhash.mrmr cimport hash128_x64 + * + * import warnings # <<<<<<<<<<<<<< + * from enum import Enum + * from pathlib import Path +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_warnings, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_warnings, __pyx_t_2) < (0)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":10 + * + * import warnings + * from enum import Enum # <<<<<<<<<<<<<< + * from pathlib import Path + * from typing import TYPE_CHECKING, Union, cast +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Enum}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_enum, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_enum, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Enum}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":11 + * import warnings + * from enum import Enum + * from pathlib import Path # <<<<<<<<<<<<<< + * from typing import TYPE_CHECKING, Union, cast + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Path}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pathlib, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_pathlib, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Path}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":12 + * from enum import Enum + * from pathlib import Path + * from typing import TYPE_CHECKING, Union, cast # <<<<<<<<<<<<<< + * + * import numpy +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_TYPE_CHECKING,__pyx_mstate_global->__pyx_n_u_Union,__pyx_mstate_global->__pyx_n_u_cast}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, __pyx_imported_names, 3, __pyx_mstate_global->__pyx_kp_u_spacy_typing, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_TYPE_CHECKING,__pyx_mstate_global->__pyx_n_u_Union,__pyx_mstate_global->__pyx_n_u_cast}; + for (__pyx_t_3=0; __pyx_t_3 < 3; __pyx_t_3++) { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":14 + * from typing import TYPE_CHECKING, Union, cast + * + * import numpy # <<<<<<<<<<<<<< + * import srsly + * from thinc.api import Ops, get_array_module, get_current_ops +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numpy, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_numpy, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_numpy, __pyx_t_2) < (0)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":15 + * + * import numpy + * import srsly # <<<<<<<<<<<<<< + * from thinc.api import Ops, get_array_module, get_current_ops + * from thinc.backends import get_array_ops +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_srsly, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_srsly, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_srsly, __pyx_t_2) < (0)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":16 + * import numpy + * import srsly + * from thinc.api import Ops, get_array_module, get_current_ops # <<<<<<<<<<<<<< + * from thinc.backends import get_array_ops + * from thinc.types import Floats2d +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Ops,__pyx_mstate_global->__pyx_n_u_get_array_module,__pyx_mstate_global->__pyx_n_u_get_current_ops}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_thinc_api, __pyx_imported_names, 3, __pyx_mstate_global->__pyx_kp_u_spacy_thinc_api, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Ops,__pyx_mstate_global->__pyx_n_u_get_array_module,__pyx_mstate_global->__pyx_n_u_get_current_ops}; + for (__pyx_t_3=0; __pyx_t_3 < 3; __pyx_t_3++) { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":17 + * import srsly + * from thinc.api import Ops, get_array_module, get_current_ops + * from thinc.backends import get_array_ops # <<<<<<<<<<<<<< + * from thinc.types import Floats2d + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_get_array_ops}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_thinc_backends, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_thinc_backends, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_get_array_ops}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":18 + * from thinc.api import Ops, get_array_module, get_current_ops + * from thinc.backends import get_array_ops + * from thinc.types import Floats2d # <<<<<<<<<<<<<< + * + * from .attrs cimport ORTH, attr_id_t +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Floats2d}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_thinc_types, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_thinc_types, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Floats2d}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":23 + * from .strings cimport StringStore + * + * from . import util # <<<<<<<<<<<<<< + * from .attrs import IDS + * from .errors import Errors, Warnings +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":24 + * + * from . import util + * from .attrs import IDS # <<<<<<<<<<<<<< + * from .errors import Errors, Warnings + * from .strings import get_string_id +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IDS}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_attrs, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_attrs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IDS}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":25 + * from . import util + * from .attrs import IDS + * from .errors import Errors, Warnings # <<<<<<<<<<<<<< + * from .strings import get_string_id + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors,__pyx_mstate_global->__pyx_n_u_Warnings}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 2, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors,__pyx_mstate_global->__pyx_n_u_Warnings}; + for (__pyx_t_3=0; __pyx_t_3 < 2; __pyx_t_3++) { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":26 + * from .attrs import IDS + * from .errors import Errors, Warnings + * from .strings import get_string_id # <<<<<<<<<<<<<< + * + * if TYPE_CHECKING: +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_get_string_id}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_strings, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_strings, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_get_string_id}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":28 + * from .strings import get_string_id + * + * if TYPE_CHECKING: # <<<<<<<<<<<<<< + * from .vocab import Vocab # noqa: F401 # no-cython-lint + * +*/ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TYPE_CHECKING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_5) { + + /* "spacy/vectors.pyx":29 + * + * if TYPE_CHECKING: + * from .vocab import Vocab # noqa: F401 # no-cython-lint # <<<<<<<<<<<<<< + * + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Vocab_2}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_vocab, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_vocab, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + } + __pyx_t_2 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_2); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Vocab_2}; + __pyx_t_3 = 0; { + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":28 + * from .strings import get_string_id + * + * if TYPE_CHECKING: # <<<<<<<<<<<<<< + * from .vocab import Vocab # noqa: F401 # no-cython-lint + * +*/ + } + + /* "spacy/vectors.pyx":32 + * + * + * def unpickle_vectors(bytes_data): # <<<<<<<<<<<<<< + * return Vectors().from_bytes(bytes_data) + * +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_1unpickle_vectors, 0, __pyx_mstate_global->__pyx_n_u_unpickle_vectors, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_unpickle_vectors, __pyx_t_2) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":36 + * + * + * class Mode(str, Enum): # <<<<<<<<<<<<<< + * default = "default" + * floret = "floret" +*/ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_Pack(2, ((PyObject *)(&PyUnicode_Type)), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_Mode, __pyx_mstate_global->__pyx_n_u_Mode, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_2 != __pyx_t_4) { + if (unlikely((PyDict_SetItemString(__pyx_t_7, "__orig_bases__", __pyx_t_4) < 0))) __PYX_ERR(0, 36, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vectors.pyx":37 + * + * class Mode(str, Enum): + * default = "default" # <<<<<<<<<<<<<< + * floret = "floret" + * +*/ + if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_default, __pyx_mstate_global->__pyx_n_u_default) < (0)) __PYX_ERR(0, 37, __pyx_L1_error) + + /* "spacy/vectors.pyx":38 + * class Mode(str, Enum): + * default = "default" + * floret = "floret" # <<<<<<<<<<<<<< + * + * @classmethod +*/ + if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_floret, __pyx_mstate_global->__pyx_n_u_floret) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) + + /* "spacy/vectors.pyx":40 + * floret = "floret" + * + * @classmethod # <<<<<<<<<<<<<< + * def values(cls): + * return list(cls.__members__.keys()) +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_4Mode_1values, __Pyx_CYFUNCTION_CLASSMETHOD, __pyx_mstate_global->__pyx_n_u_Mode_values, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + __pyx_t_8 = __Pyx_Method_ClassMethod(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_8) < (0)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/vectors.pyx":36 + * + * + * class Mode(str, Enum): # <<<<<<<<<<<<<< + * default = "default" + * floret = "floret" +*/ + __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Mode, __pyx_t_2, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_8); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Mode, __pyx_t_8) < (0)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":59 + * raise NotImplementedError + * + * def is_full(self): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_11BaseVectors_7is_full, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseVectors_is_full, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, __pyx_mstate_global->__pyx_n_u_is_full, __pyx_t_2) < (0)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":62 + * raise NotImplementedError + * + * def get_batch(self, keys): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_11BaseVectors_9get_batch, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseVectors_get_batch, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, __pyx_mstate_global->__pyx_n_u_get_batch, __pyx_t_2) < (0)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":80 + * raise NotImplementedError + * + * def add(self, key, *, vector=None): # <<<<<<<<<<<<<< + * raise NotImplementedError + * +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_vector, Py_None) < (0)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_11BaseVectors_13add, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseVectors_add, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_6, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, __pyx_mstate_global->__pyx_n_u_add, __pyx_t_6) < (0)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":83 + * raise NotImplementedError + * + * def to_ops(self, ops: Ops): # <<<<<<<<<<<<<< + * pass + * +*/ + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ops, __pyx_mstate_global->__pyx_n_u_Ops) < (0)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_11BaseVectors_15to_ops, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseVectors_to_ops, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, __pyx_mstate_global->__pyx_n_u_to_ops, __pyx_t_2) < (0)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":88 + * # add dummy methods for to_bytes, from_bytes, to_disk and from_disk to + * # allow serialization + * def to_bytes(self, **kwargs): # <<<<<<<<<<<<<< + * return b"" + * +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_11BaseVectors_17to_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseVectors_to_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, __pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_t_2) < (0)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":91 + * return b"" + * + * def from_bytes(self, data: bytes, **kwargs): # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_data, __pyx_mstate_global->__pyx_n_u_bytes) < (0)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_11BaseVectors_19from_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseVectors_from_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); + #endif + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, __pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_t_6) < (0)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":94 + * return self + * + * def to_disk(self, path: Union[str, Path], **kwargs): # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_path, __pyx_mstate_global->__pyx_kp_u_Union_str_Path) < (0)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_11BaseVectors_21to_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseVectors_to_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); + #endif + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, __pyx_mstate_global->__pyx_n_u_to_disk, __pyx_t_2) < (0)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vectors.pyx":97 + * return None + * + * def from_disk(self, path: Union[str, Path], **kwargs): # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_path, __pyx_mstate_global->__pyx_kp_u_Union_str_Path) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_11BaseVectors_23from_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseVectors_from_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); + #endif + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, __pyx_mstate_global->__pyx_n_u_from_disk, __pyx_t_6) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_11BaseVectors_25__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseVectors___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_6) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_BaseVectors, (type(self), 0xe3b0c44, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_BaseVectors__set_state(self, __pyx_state) +*/ + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_11BaseVectors_27__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseVectors___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_BaseVectors, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_6) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":101 + * + * + * @util.registry.vectors("spacy.Vectors.v1") # <<<<<<<<<<<<<< + * def create_mode_vectors() -> Callable[["Vocab"], BaseVectors]: + * def vectors_factory(vocab: "Vocab") -> BaseVectors: +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_registry); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __pyx_t_9; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_spacy_Vectors_v1}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_vectors, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Callable_Vocab_BaseVectors) < (0)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_3create_mode_vectors, 0, __pyx_mstate_global->__pyx_n_u_create_mode_vectors, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_8); + #endif + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_8}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_create_mode_vectors, __pyx_t_6) < (0)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":140 + * cdef readonly attr_id_t attr + * + * def __init__(self, *, strings=None, shape=None, data=None, keys=None, name=None, mode=Mode.default, minn=0, maxn=0, hash_count=1, hash_seed=0, bow="<", eow=">", attr="ORTH"): # <<<<<<<<<<<<<< + * """Create a new vector store. + * +*/ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_default); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_mstate_global->__pyx_k__2 = __pyx_t_7; + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":260 + * return len(self.key2row) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (unpickle_vectors, (self.to_bytes(),)) + * +*/ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_3__reduce__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors___reduce, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_reduce, __pyx_t_7) < (0)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":337 + * ) + * + * def resize(self, shape, inplace=False): # <<<<<<<<<<<<<< + * """Resize the underlying vectors array. If inplace=True, the memory + * is reallocated. This may cause other references to the data to become +*/ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_18resize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_resize, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 337, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_mstate_global->__pyx_tuple[11]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_resize, __pyx_t_7) < (0)) __PYX_ERR(0, 337, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":376 + * return removed_items + * + * def keys(self): # <<<<<<<<<<<<<< + * """RETURNS (iterable): A sequence of keys in the table.""" + * return self.key2row.keys() +*/ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_20keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_keys, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_7) < (0)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":380 + * return self.key2row.keys() + * + * def values(self): # <<<<<<<<<<<<<< + * """Iterate over vectors that have been assigned to at least one key. + * +*/ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_22values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_values, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_7) < (0)) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":394 + * yield vector + * + * def items(self): # <<<<<<<<<<<<<< + * """Iterate over `(key, vector)` pairs. + * +*/ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_25items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_items, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 394, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_7) < (0)) __PYX_ERR(0, 394, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":404 + * yield key, self.data[row] + * + * def find(self, *, key=None, keys=None, row=None, rows=None): # <<<<<<<<<<<<<< + * """Look up one or more keys by row, or vice versa. + * +*/ + __pyx_t_7 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_key, Py_None) < (0)) __PYX_ERR(0, 404, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_keys, Py_None) < (0)) __PYX_ERR(0, 404, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_row, Py_None) < (0)) __PYX_ERR(0, 404, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_rows, Py_None) < (0)) __PYX_ERR(0, 404, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_28find, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_find, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_6, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_find, __pyx_t_6) < (0)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":443 + * return xp.asarray(results, dtype="uint64") + * + * def _get_ngram_hashes(self, unicode s): # <<<<<<<<<<<<<< + * """Calculate up to 4 32-bit hash values with MurmurHash3_x64_128 using + * the floret hash settings. +*/ + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_30_get_ngram_hashes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors__get_ngram_hashes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_get_ngram_hashes, __pyx_t_6) < (0)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":462 + * return rows[:min(self.hash_count, 4)] + * + * def _get_ngrams(self, unicode key): # <<<<<<<<<<<<<< + * """Get all padded ngram strings using the ngram settings. + * key (str): The string key. +*/ + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_32_get_ngrams, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors__get_ngrams, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[44])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_get_ngrams, __pyx_t_6) < (0)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":475 + * return ngrams + * + * def get_batch(self, keys): # <<<<<<<<<<<<<< + * """Get the vectors for the provided keys efficiently as a batch. + * keys (Iterable[Union[int, str]]): The keys. +*/ + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_34get_batch, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_get_batch, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 475, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_get_batch, __pyx_t_6) < (0)) __PYX_ERR(0, 475, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":510 + * return ops.as_contig(vecs) + * + * def add(self, key, *, vector=None, row=None): # <<<<<<<<<<<<<< + * """Add a key to the table. Keys can be mapped to an existing vector + * by setting `row`, or a new vector can be added. +*/ + __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 510, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_vector, Py_None) < (0)) __PYX_ERR(0, 510, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_row, Py_None) < (0)) __PYX_ERR(0, 510, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_36add, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_add, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[46])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 510, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_7, __pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_add, __pyx_t_7) < (0)) __PYX_ERR(0, 510, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":548 + * return row + * + * def most_similar(self, queries, *, batch_size=1024, n=1, sort=True): # <<<<<<<<<<<<<< + * """For each of the given vectors, find the n most similar entries + * to it, by cosine. +*/ + __pyx_t_7 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_batch_size, __pyx_mstate_global->__pyx_int_1024) < (0)) __PYX_ERR(0, 548, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_n, __pyx_mstate_global->__pyx_int_1) < (0)) __PYX_ERR(0, 548, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_sort, Py_True) < (0)) __PYX_ERR(0, 548, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_38most_similar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_most_similar, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_6, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_most_similar, __pyx_t_6) < (0)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":618 + * return (keys, best_rows, scores) + * + * def to_ops(self, ops: Ops): # <<<<<<<<<<<<<< + * self.data = ops.asarray(self.data) + * +*/ + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ops, __pyx_mstate_global->__pyx_n_u_Ops) < (0)) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_40to_ops, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_to_ops, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_to_ops, __pyx_t_7) < (0)) __PYX_ERR(0, 618, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":621 + * self.data = ops.asarray(self.data) + * + * def _get_cfg(self): # <<<<<<<<<<<<<< + * if self.mode == Mode.default: + * return { +*/ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_42_get_cfg, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors__get_cfg, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_get_cfg, __pyx_t_7) < (0)) __PYX_ERR(0, 621, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":638 + * } + * + * def _set_cfg(self, cfg): # <<<<<<<<<<<<<< + * self.mode = Mode(cfg.get("mode", Mode.default)).value + * self.minn = cfg.get("minn", 0) +*/ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_44_set_cfg, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors__set_cfg, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_set_cfg, __pyx_t_7) < (0)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":648 + * self.attr = cfg.get("attr", ORTH) + * + * def to_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + __pyx_t_6 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_mstate_global->__pyx_k__5 = __pyx_t_7; + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_6) < (0)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_46to_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_to_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[51])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_6, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_to_disk, __pyx_t_6) < (0)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":678 + * return util.to_disk(path, serializers, exclude) + * + * def from_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + __pyx_t_7 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_mstate_global->__pyx_k__6 = __pyx_t_6; + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_7) < (0)) __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_48from_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_from_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_7, __pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_from_disk, __pyx_t_7) < (0)) __PYX_ERR(0, 678, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":722 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + __pyx_t_6 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 722, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_mstate_global->__pyx_k__7 = __pyx_t_7; + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 722, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 722, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + if (PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_6) < (0)) __PYX_ERR(0, 722, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_50to_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_to_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[53])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 722, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_6); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_6, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_t_6) < (0)) __PYX_ERR(0, 722, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "spacy/vectors.pyx":745 + * return util.to_bytes(serializers, exclude) + * + * def from_bytes(self, data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + __pyx_t_7 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_mstate_global->__pyx_k__8 = __pyx_t_6; + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + if (PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_7) < (0)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_52from_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_from_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[54])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_7, __pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_t_7) < (0)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":773 + * return self + * + * def clear(self): # <<<<<<<<<<<<<< + * """Clear all entries in the vector table. + * +*/ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_54clear, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors_clear, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[55])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_clear, __pyx_t_7) < (0)) __PYX_ERR(0, 773, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":783 + * self._sync_unset() + * + * def _sync_unset(self): # <<<<<<<<<<<<<< + * filled = {row for row in self.key2row.values()} + * self._unset = cppset[int]({row for row in range(self.data.shape[0]) if row not in filled}) +*/ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_7Vectors_56_sync_unset, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vectors__sync_unset, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[56])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_7vectors_Vectors, __pyx_mstate_global->__pyx_n_u_sync_unset, __pyx_t_7) < (0)) __PYX_ERR(0, 783, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_BaseVectors(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0xe3b0c44, 0xda39a3e, 0xd41d8cd, b'') +*/ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_7vectors_5__pyx_unpickle_BaseVectors, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_BaseVectors, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vectors, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[57])); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_7); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_BaseVectors, __pyx_t_7) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vectors.pyx":1 + * # cython: infer_types=True, binding=True # <<<<<<<<<<<<<< + * from typing import Callable + * +*/ + __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_7) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init spacy.vectors"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #else + return __pyx_m; + #endif +} +/* #### Code section: pystring_table ### */ +/* #### Code section: cached_builtins ### */ + +static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_sum); if (!__pyx_builtin_sum) __PYX_ERR(0, 424, __pyx_L1_error) + + /* Cached unbound methods */ + __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cached_constants ### */ + +static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('False',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_BaseVectors, (type(self), 0xe3b0c44, None), state +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_n_u_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + + /* "spacy/vectors.pyx":191 + * if data is None: + * if shape is None: + * shape = (0, 0) # <<<<<<<<<<<<<< + * ops = get_current_ops() + * data = ops.xp.zeros(shape, dtype="f") +*/ + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); + + /* "spacy/vectors.pyx":591 + * # sims e.g. (1024, 10000) + * sims = xp.dot(batch, vectors.T) + * best_rows[i:i+batch_size] = xp.argpartition(sims, -n, axis=1)[:, -n:] # <<<<<<<<<<<<<< + * scores[i:i+batch_size] = xp.partition(sims, -n, axis=1)[:, -n:] + * +*/ + __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + + /* "spacy/vectors.pyx":595 + * + * if sort and n >= 2: + * sorted_index = xp.arange(scores.shape[0])[:, None][i:i+batch_size], \ # <<<<<<<<<<<<<< + * xp.argsort(scores[i:i+batch_size], axis=1)[:, ::-1] + * scores[i:i+batch_size] = scores[sorted_index] +*/ + __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_slice[0], Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]); + + /* "spacy/vectors.pyx":596 + * if sort and n >= 2: + * sorted_index = xp.arange(scores.shape[0])[:, None][i:i+batch_size], \ + * xp.argsort(scores[i:i+batch_size], axis=1)[:, ::-1] # <<<<<<<<<<<<<< + * scores[i:i+batch_size] = scores[sorted_index] + * best_rows[i:i+batch_size] = best_rows[sorted_index] +*/ + __pyx_mstate_global->__pyx_slice[1] = PySlice_New(Py_None, Py_None, __pyx_mstate_global->__pyx_int_neg_1); if (unlikely(!__pyx_mstate_global->__pyx_slice[1])) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[1]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]); + __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_slice[0], __pyx_mstate_global->__pyx_slice[1]); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]); + + /* "spacy/vectors.pyx":640 + * def _set_cfg(self, cfg): + * self.mode = Mode(cfg.get("mode", Mode.default)).value + * self.minn = cfg.get("minn", 0) # <<<<<<<<<<<<<< + * self.maxn = cfg.get("maxn", 0) + * self.hash_count = cfg.get("hash_count", 0) +*/ + __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_minn, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]); + + /* "spacy/vectors.pyx":641 + * self.mode = Mode(cfg.get("mode", Mode.default)).value + * self.minn = cfg.get("minn", 0) + * self.maxn = cfg.get("maxn", 0) # <<<<<<<<<<<<<< + * self.hash_count = cfg.get("hash_count", 0) + * self.hash_seed = cfg.get("hash_seed", 0) +*/ + __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_maxn, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 641, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]); + + /* "spacy/vectors.pyx":642 + * self.minn = cfg.get("minn", 0) + * self.maxn = cfg.get("maxn", 0) + * self.hash_count = cfg.get("hash_count", 0) # <<<<<<<<<<<<<< + * self.hash_seed = cfg.get("hash_seed", 0) + * self.bow = cfg.get("bow", "<") +*/ + __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_hash_count, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]); + + /* "spacy/vectors.pyx":643 + * self.maxn = cfg.get("maxn", 0) + * self.hash_count = cfg.get("hash_count", 0) + * self.hash_seed = cfg.get("hash_seed", 0) # <<<<<<<<<<<<<< + * self.bow = cfg.get("bow", "<") + * self.eow = cfg.get("eow", ">") +*/ + __pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_hash_seed, __pyx_mstate_global->__pyx_int_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(0, 643, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[7]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]); + + /* "spacy/vectors.pyx":644 + * self.hash_count = cfg.get("hash_count", 0) + * self.hash_seed = cfg.get("hash_seed", 0) + * self.bow = cfg.get("bow", "<") # <<<<<<<<<<<<<< + * self.eow = cfg.get("eow", ">") + * self.attr = cfg.get("attr", ORTH) +*/ + __pyx_mstate_global->__pyx_tuple[8] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_bow, __pyx_mstate_global->__pyx_kp_u__3); if (unlikely(!__pyx_mstate_global->__pyx_tuple[8])) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[8]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[8]); + + /* "spacy/vectors.pyx":645 + * self.hash_seed = cfg.get("hash_seed", 0) + * self.bow = cfg.get("bow", "<") + * self.eow = cfg.get("eow", ">") # <<<<<<<<<<<<<< + * self.attr = cfg.get("attr", ORTH) + * +*/ + __pyx_mstate_global->__pyx_tuple[9] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_eow, __pyx_mstate_global->__pyx_kp_u__4); if (unlikely(!__pyx_mstate_global->__pyx_tuple[9])) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[9]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]); + + /* "spacy/vectors.pyx":667 + * # in order to not rely on this, wrap in context manager. + * ops = get_current_ops() + * with path.open("wb") as _file: # <<<<<<<<<<<<<< + * save_array(ops.to_numpy(self.data, byte_order="<"), _file) + * +*/ + __pyx_mstate_global->__pyx_tuple[10] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[10])) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[10]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[10]); + + /* "spacy/vectors.pyx":337 + * ) + * + * def resize(self, shape, inplace=False): # <<<<<<<<<<<<<< + * """Resize the underlying vectors array. If inplace=True, the memory + * is reallocated. This may cause other references to the data to become +*/ + __pyx_mstate_global->__pyx_tuple[11] = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[11])) __PYX_ERR(0, 337, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[11]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[11]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<12; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_slice; + for (Py_ssize_t i=0; i<2; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + { + const struct { const unsigned int length: 10; } index[] = {{0},{32},{179},{16},{25},{19},{11},{14},{7},{1},{1},{1},{1},{8},{7},{6},{2},{9},{5},{6},{16},{11},{10},{12},{11},{13},{11},{13},{15},{20},{17},{12},{17},{11},{14},{14},{11},{0},{11},{29},{31},{15},{22},{21},{21},{19},{20},{19},{18},{8},{4},{4},{4},{5},{4},{4},{4},{4},{4},{4},{4},{4},{4},{4},{4},{4},{6},{5},{8},{3},{4},{11},{4},{3},{4},{20},{1},{4},{13},{5},{7},{16},{18},{16},{25},{19},{16},{19},{11},{13},{12},{18},{17},{17},{13},{12},{20},{14},{16},{15},{14},{14},{5},{4},{8},{5},{5},{3},{12},{11},{6},{6},{3},{12},{7},{6},{3},{9},{9},{7},{18},{4},{5},{4},{1},{10},{5},{11},{10},{9},{3},{10},{5},{10},{4},{3},{5},{9},{17},{5},{18},{4},{5},{3},{8},{4},{4},{10},{19},{44},{8},{4},{8},{7},{19},{13},{8},{5},{7},{3},{5},{9},{4},{9},{3},{6},{7},{6},{8},{6},{1},{5},{5},{6},{4},{21},{6},{6},{10},{39},{28},{9},{27},{31},{28},{32},{31},{8},{7},{3},{16},{13},{9},{26},{8},{15},{17},{11},{13},{12},{1},{10},{9},{1},{7},{7},{5},{13},{7},{5},{8},{1},{10},{10},{8},{3},{7},{4},{6},{8},{7},{6},{4},{12},{9},{13},{12},{8},{4},{11},{13},{6},{4},{4},{5},{10},{12},{15},{13},{13},{1},{6},{8},{4},{7},{7},{7},{4},{5},{10},{10},{6},{4},{5},{5},{10},{4},{3},{3},{1},{9},{4},{7},{3},{11},{14},{12},{11},{10},{26},{14},{12},{7},{9},{12},{10},{17},{13},{11},{8},{8},{13},{6},{13},{7},{6},{3},{7},{9},{4},{1},{4},{10},{12},{6},{4},{4},{17},{11},{8},{12},{10},{12},{19},{5},{4},{4},{4},{12},{13},{5},{5},{5},{7},{3},{11},{8},{9},{14},{11},{5},{8},{26},{35},{7},{25},{29},{8},{6},{6},{6},{11},{16},{6},{5},{12},{11},{4},{5},{6},{4},{6},{7},{15},{5},{4},{8},{2},{11},{10},{13},{2},{5},{0},{2},{21},{309},{20},{695},{15},{14},{2},{103},{107},{42},{333},{14},{89},{130},{7},{63},{96},{351},{7},{10},{17},{13},{13},{17},{20},{16},{43},{16},{296},{5},{11},{2},{10},{10},{84},{55},{10},{62},{50},{46},{26},{71},{52},{83},{71},{56},{10},{12},{8},{12},{18},{18},{18},{14},{94}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (3706 bytes) */ +const char* const cstring = "BZh91AY&SY\351\375\t\336\000\003O\377\377\377\377\377\377\377\377\377\375\277\377\377\377\377\377\377\375@@@@@@@@@@@@@\000@\000`\016\237u\340xnn\"\207k\273\227+e\025 \335\303\273Wws\t1]\336\260\324\240\001\000jz\022H\246\322h\336\251\220\007\345F\321\223Pz\236P\374\014\203A\241\244\"x\322\236\247\221\351\252z \375MG\250\364\214\203F\233I\351\032\tD\023\032F\246&\204i\243J\237\212m\032\247\251\351\250\036\241\352\r\0002\000\000\r\006\200\036\240\000\001\240\001\246\215\tH\221\352=L\236\243M\350\232\201\352z\215\036\241\220h\365\031\006@y@\000\320\032\032b\0324\306\243\3244\321\247\250h$B!\001\251\224\311\352\223\307\244O\321B\0324i\240\302\036\240\000\000\320\006\214\200\003#\021\241\2404\001\006\000\t\200\002\030\230&\000\000\214\000\2310L\230\000\021\221\211\210\300C\000\000\t$\010L\221\264OI\352z\024\364ji\251\223\311\033Q\247\244\003\322\000\000\000\000\000\000\320\032\036\241\346\2444%9\206\274\032\2439\344u6rg\330\214\315!\327\217k\266\335p\233N\236NG\271-\" \223\316\253n4\311\352\215\310\020(\202b\237q\204\333\250\305X|\013\2321y2^-\002\023D\217\\\016\272?\326I\314\244\200\220H$\211\3259\013\304\210\337\377\202\006YdwU*(X\\5\353Hc\001\264\206\320\330\r\r\2664\333hc\033W.h\276\215\"E\253-+~\225U\310F\273\010nt`\2605\0105\264&\320\332\004\330\201\261\017o\203\240Y-\r%\265\341\2036\030\2068\337k]+I\006v\300jB\310i1\214m\r0j\301\220\226\2066\233I\264\r\242\365a\264\234\316ycau\256\032V{\363\026B7\233\315/d\321ePE\331%\361e\251\253Ak\326k\035B\212\245\352\003\004\311V\266\224\202j\230(\253\255\230\277\n\342\206KZ%j\341AU\006`d,2\030\276\323\t\366\2630\222\030\2663\312\256\252\013\340T\030\240\224(Y\257\242\010\263\020\232^P(\024)\212R\205\022\252.u\252\025l\tQ'yf\210\276\033\201\324\271\340\320\271\345\305\3275\255\230L\272\254\377\033\2073\372\234\177p\315_\013\370\273\376(M\313\374h\343\357\272\223\023\362F\231\241\375\300\323V\243\335)P\252\315\233!\312\034\315\247\331\357\350>\365\205\266\210\321\323\355\345\206eLf\252\260\232\2239\004\032\273\252V\251\260\341""\333.A\204\311\245\000\205\335o\210\027\344[\014\314\013\224\222\033\177\246\363\242\374,\326`\265J\304\201[z[\346L!$\242$'N<\030d\217\273=\321\370\230\345\362j\274\351\372\201\375 o\327\345(\223\204\365J\025\375rY'\205TJ ag\000\344j\010\024\n\304E\335J\346\323\302v\236o\233\370W\331\355\307\253\272\322\026\3661\344\322\326\221\2549\327t[nydZlD\323\231\214&/\202\035\252^\215>w\332\327\366\316\177\363\316\266#U|\354\272\213\353\232LLg\017OW\325\366\360B`\223\022f\001\241\207\236\325U\322d\311\240aM\244\346\234\237\351\331\247\265\250\314\203k\304\212&\010\221>\236T\336'\247E\362t\2621\206\201q\010B\366z=\360\266\230z\236\340\350P\005C\324Q\017\352\207z\377\237\3505\241\350\255\366\263\242\351%\010\221\360\27477\2334\310\316\022dZSr\350sR\251\316\277\210x]\342\343\352\275\376_]*\336\214\227\230\307\241\271i\223\"3#e^\3177t\302h\023&\023'\311\331\325\336\355\353\360\375\313\236\267y\317\217\233\311\373\227w\370\334h\211\242hi\242h\234\234\273g9\223\234\377[$\211\027\005\301w\233T\220\222I\013\216\257\323h\221iQH\014\340\303\367\272\005\271\372}\344k\032\266{}f\257\346\260\251\360F\255\220p\205\342^\232\t\207\200\354.|]!E\225\312\366g\365ot_\010\313\364?\t\211\001\022\212\214\237\257\007\356\371\347*\n\n\027W\202\351\022%V\025\321\321\334\311\307\267\241\317=w\276UC\273\367\017\307\222\255J]\262\231\372\\`\367ef,\317\231\345\353\355Y)\026\230\362\362\347\232B\226\346W\335!\321#\037&\271`\305\374N4\272Z\322\273\n\243g*\r\326~^\"f\031\303&[\360%\233t!\250\342$\314z\023r\241\326\3764\225\034\200\205\016:\276\377\374\337X\227-:\226}p}\313W\031\251\204\\\r\350\252\252\252\252\270)\211y\225`\023Fy\345\223\006\333m\321\253lK\305\230\215\214\331\223\226\311\304{o\243g\274vN\2307\253Uw\335\231\020G\006]\313\333\252\024\006v\315N\021\206\254\021\014\257\226\251\2667\315\006\274\271\363%6|\374\261k\274\206T0e]\245\254(=B\235\034\223\311\032\223N\270L\024\305\240[\013e\260\271\311\241\317\034\200\300Z\021s\202\300\246g\253\037\326\027H\257\323\300%.\"\237 +\n\321J\034\031:\016\346M""\002\261\304\305\367k^\256\222\253\361T\331.cz\227\261\0331\374\220H\211\034\020\323\252\0257\2422\030\225\035\006\307\302R\237\207%s\353e\036\0243A\035\246\363h\027r\317\356\035\274\006\371\000\350\235\254\2268_\213\2141\301\311\223\263\232\310\252\271\022LUx\253\2433\263\305x\033\210}G\207\330Gj\321\204\272\003\273\027\254\240\021\334\343-y\313x\233\325\025\020\035-B8\2776NeT:\327\203\335\225c1&\220\035r\375\235\243B\377\027\035t\356]\262\353\210\352+\242`\n\211\013X\357i@0\356\235\225\304\342g\220o\320\362\216^\331\323\265+%,.\203\242W\237;\220\336\013\277\227=#\271a\2625B\313x\345*\372B\010%h\342/\024\244D\211\023M\023\200\034\0168S\301\376\337\247o}\357P \250<\206\216t\265\275\313\265\317qH\301Usv\327\270)R\342\225\010\324{E\307L\nJx\rL\032k\352\240\233\004\330\223\033A\376\2725\351\331i\251\300Y\351\265w\266{\346ad\372\303\233)\245\324L]\007\246Q\277(J\030\031\2466\223r$\370V\013P\207=\233\0016\334\374\332O/\300w\026\031\301\031q\232\335\3176O\016\306a\247(\253j\210$\323\251oI\214m\031\305L\3146\3216-\254\325\272\373\242\225\037\022g\235#\264\035\240\355/\020\344q\351\370x\332\361R\330\362\t\337\214c\301a\244\364\";?\227\321\022#\370\3251\330l\r4\357n\304\027\036w?[\254_\234:`e\023\231A\314\342\214\023\312\340\272\240*\212\242\250\030\343\277V\351\nb9\312\256\034;\300e\rB\301TX\216{\320\014A\206\032\3610NN\204\364\034C\234*\342\271\204x\233\023\2368\307!E\177y\247mb18\216\335\031\230\330\334ms\260\2317M\240<\200""\024\036\367yT\265shR]\275\275\271\030(\204\2301\002\307\320]\230\361.\261`hb\330\206k\310Q\244`\30491\001\274'\274<\007Cz\272iI\232H44\r\266\030&\257\254\253\347\343G\n\313'\r3\211\367-x\215\242\335\215\260\241\001'a\307fL\030\363O\204\345QS=\354LZ\345$\363vg.\356\014\313\342\265\3201\261\256VF\333\316\332\344\0367z\021\034\005\300^\010\322\3013k\016\370[\n\251\263kf\256\200e.^\325\314\004g\264\335\356\303\261\313\313\016\000B\021 \344\035\272\033W\237\177\023f\304\332,<_O\357\035\030\021\003\274\356\231\224\013\250\217\264\372A\377\267\356\364\216\244\240^\003\207\035M\267x\236E$\005S\215m_\337\356\345\271 2<\005\350\230\243bu\232\004\230\022\023\300\267vK\344.\206\206\240.5\245\337\213\216F\323\363\371{\210C\2135\314\224Y\331\210\250\263\002C\360z\034\337\024h\213\236Q3C\234k\223\210\271\215\274X\362S\232\201\021\323mq\257\311\336\250\r\256\252\"\356\263\224A1\026\007'\330\225\273#\211;\251Y\314G\214\010\322\323\321\\C\343\232\3014\003\355y_\233\361<\3572\001)\207C\250\225\220\306\\(5\306\020x\341\357%\361\360\214\314\270\005[;\304\001\273\306;\353\226\372\014\010\014\305pB\002*L\357H\353\356O\356@\267\200R\021{\n \300\365Nb\330\032Y|XL\251\312/8\227`\300\322\262\006\314E\3030\334\273\345=\367_q\351\231h\372\234l\372\322\005G\331\306\361\017\013\325\331\003f\007:\240\274\t\351l\026\303\271\273$k.j\214\310\022A\366\335\326\300\342\014\252\241J=\2122U^1\003\302\201)\275$\203\300\235\000\204-O\247Z\007\300\004\254\3112Kw\211\274n0\223\006\032\355\203\357\203\0379\003\3237\320\"m\312\2059\270\305\3579\355\266\301\307\260^5\334\017\233`t\371H\277\204\270\220\232\352\177\t\271\022\\\027\231\317\n\324X=\341\3572\330\216K\274\001\202]\374\312\031\031$G!VU\346\261\223$\213s\245\007\205\234\363x\275\364)\025W\302\221@\374\314\337\312*t\310XQ\333l\253\014F\2053K\213\256\210q5:\024\274\3651\235\252\037 \371\322\202\212Z\233\024>m\372/CF\225\035w\014:z\211\273\253\227_O""\343\370z\332#K\256$\320:!\020\317\352\365-g\260\2361b\317\3537Vp\352N\271\263[\335\020\354\317\237FvY\365\017k\263TT\317\024\035\334\243f\376\256\247'G\247kO\245\240\323z\006r\"'\244\250.d\316\342#\220rs\253O\235\235\317\316\233\267\227\334\365\205\213\035\211E\377/+\265\372\373\007\316\340\307m\327\376\020\211\320\272Ae\016\240b\\\357\"*\204\2112m(\n-\313\205\010=\241j\320N\346\325\275\005\326\305@\303a;:\273\257.\346%\213\233q\017n\351\316E3(\303E<5A\237\200\002\032Du\261XT\3030\351\034\300\225\2222\0211\030\003\024\364$\324`=\331\272/o3\022J\305L\023\025\211\242\241\3149s\001R*\220\247\n\036`\247\3148\206\2008\267\0022E\344\223\377\213\271\"\234(Ht\376\204\357\000"; + PyObject *data = __Pyx_DecompressString(cstring, 3706, 2); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (3828 bytes) */ +const char* const cstring = "x\332\215XKw\323X\266\306`\300)\222\"\316\033\232\252\266\213\204\024\325\220\306y\021\252j\321\313$&\320t\321\030B\205\202K\353\036\313\307\266*\216d\353\310y\324\255\325\213\241\207\032j\250\241\206\032j\350a\206\036z\350\237\300O\350o\037\311\216\363\250^w\255\350\350<\267\316\336\373\333\337\336\316:\253VY\241\312?|\230\377\331PYa\376\343\275\324\023&\370\317\\\265\014S||iX\310e\036,\257\3462\217\026\361,\341y\210g-\267\370`1\267\206Mk\330\264\266\232\301\203\361\352\022\236\345\034\234\232\223>\226(}Z5\230%\026\213\3177\336\374d\0249=\013{\254\332\340\342\237\257\267\236\375\263&\010\272\212\362\352\360\000\317\006\"Ly\311\017\254\327\274\264\265\225{\267\265\365\313\253\234\262\376,\267\376\342\371\313M\211\367\350\306\307\006\006\236\315c<\367\275qa\232\236c\025\312\\\347\0075\263T5Ln\225\340\026f\035\203\375\270w|\340\034M\316\333\366c\225\355\026\212\354q?N\372\235\377\262\347x\t\234\003\330\360\303E\240\342\277,\213?ZC|[\024\005\177\264\336\363\034\350\026|\240DV\000\212(\214%\256\311\345\rd\313\376\030!\327\217\361~\347\214!{d%_\300\003\\G'\317p\326\000WQ/\014)E+\322]\242|\243Th+\302\256\241[\262'Pzh\360\236\246\202-\364Z\025\330\326tkiQ\321(8\243\360\213R\210d\237\036\267\376Jy^)\"W\013\331#\023\210\035\316k\000+\336\207\221\241\311\240a\250\366\370[\0040\360R\244\335\311dB\260=NOxD\366\"\230\200\205!A\360jIP\031x\232^\006i2J\347\262*\213\374\213^D\262\003\265\232rN\335&)\036`\022tsJn\364\220Vt\305\250\232\214.$\253W$\277PB\257\202\205\363\216\313\007E\241\005\264\275\212\366d-;P\305Z\025\350\337K\351\275\367Y\026<\273r\306\022Q\035\020\275\316\025qra\320\312X\224\000\016\253\207\260\250n\200?V\227\033\272\006\000\311P\356\303.:\324\250!\231\361\006\352\004\263!x\337\246\r\253\264\026q\026H\247*K\220\260\016\3019\021\236\215$\234\312\221\262^\247J\275W\255\357\027\366a:E4\220\254\016\366M@L\"8\354E\020>\250\301\371\206\2603\237b\235\257\276\356\304g\234\253\316\357^\346\363\225\013\227\207\233\231v<\355\336\304h\352\302\320ps\271\271g\277q\342N\2663j'\234\2303\355\306\272\330\372\235\223u~vW\274\253^\335\217K\241y:\362\320\236w\2605\331N\246\335dx\257I\373\265} \365\200\204\313\270~\331\311\367T*AJ\236\346\257\332{N\336)\272\363\336$\014Q\357$\2567\353\355\370\237\311\204\324\207\362\220\321p\263\355\370\242\377m\360m+\3759u\312\224'\256\324\031\235\264\267p\221\321[N\266\233\030i\217|%\245\247;\211i\251bV\016g\335\262\267\345\317\004\323-i\343\245&k\036\330\246\223<%\314\277\350\337\366\267\203\365\240N\373\222\366\230\275\346dH\356\250}\021\352N\302\346\026v\306\274\033\376\234/\202\273-\\y\244\231o\226\354u\273\201\253%\3103\034G\236\271O\\\326ML\330O\240\370\023\247\354\376\354e\274\r\230\357i\220\016\005\257:c\316C\367\016dM\340fS~\275\233\030n\346\354I""\250/\234y\370\260\356\305=\211\233M\310\333 \277@\251\341\233\3167\360\032]a\332\277\354\277\t\206Z\320\2014\035v\327\341\366,9!\3779qad\302^$\273@\324\264\027\223\263v\001>M:\013\336E\357\276_\017\256\004,\020\255\271\226y4q\224?\222\250J\343\0140g\377\333}\355\376\346'\375;A,\030\017r\255\261\326r\253~\0040\\o6\354\r\347\242s\033\256\034\375\263c\222lo\312\333\363\363\276*\361\225n-\266\362-\326\252w&\246$D\367\334\274[\300\246$\276\331\010\236\004\345V\236`\312\310\370N\332y\214\323u?\326\031\275\201\3417\322Y\272\367\034\342\030\231c\035\237\31393\320\374.\300!uP\341\204\222\233u\177\001v\204\237\356J[>\204\2445\367\221\267\356Y~&\234Z\201\2563\270\336%o\325\037\3677\202\030\371&\215\3518ly\331\335\2063\022d\202nb\322V\340,M^\003\3703\355\031\202\305Hg4iOC\310\244\204\352M\204\323:<>\033\2500\370(\0053\201A\270i7C1\222&\210\\\261w\334$H!N\301\361\215\375\202\"\001\367Z\361\256\341\364\006\271\352S\366S\366\363\350\205\241\244\035\223\302\021{\010\236Nb\334\316\330?\271\343\320\353\035\300p+\310\007L\306\005\005v\335\276Dn\351u\227\210\034\316\233\355&\210\004V\235\t\347\243\227\376\224\r\343\256\0373\320gFF\303\026A\253\013\336\230\002\316f\035vz)\032\364__\313`\032\375\n\253P|\0324\224\351\277\344\026h\364\305\037\004(\242c\270\371\302\256\323\353\037N\254\035\237u\263\237\277\376\177\021c\347D(_kf:\022|Y\234\272\004\"l\270O\275\264w\206\361\236\001\254\311\326lK;\262\332o\336\265\337\375\253\375/\245\255\374/\235\025\304\247\241\347\300k@\306\220\237\354\366\217\327\273\303\267\020\247\204\254m\357\251?\353\363 C\3016\353p7\343n \024s\024\243\360\341$\320m\035-\0375\332[\357\333\357?\264?\374Og\370\006b\371{\000\235{\337\003\272\245`\243u\271\365\272\365[;\377\272\375z\273\275\315\332\254\320.\250\021\255F\306\350$f\302~\016H\210\2030r\336\030\260\232\014\271|I\262H\226\356\373,\014~r\3016\200\312C\232\254\223\207G\333\243\267\335e\367\320\217}\212!\346/\2174\263\235\370ps\023hz\352\334\003#\307\257~\332knC\345\t\"b\300T\262bW~\032kD\276\355\353\367\020\0131""\177:\270\326zx\004\034\237\230\311\320g\206\233\317\020\3651g\\\336d\006\204\365\336\257\207\323\353\004\004\\>{\316\360%h\002\240q\027|\251\347O\321\371\257$\377\236\031\016\210\242\033|\331d\364J\"O\316b\333\274;\201@\331\366\3513m8.G\334\010CX\336C\360r=\210\003\006S`\254\370\321:\001\201\374\024\242\364z\263\210\314g\302\034\257A\344\231P\342\\\230\010(\220\256Df\207\247\276\214<\177\025\234\262\032\214\021\034F\355\241(\352oKg/z\037\202\213\001\231\214\334\021\312\337\r\311\372T\364\215\333\313\224\037\234\267D\341\275A\2763\030\205D\001\033N\302\375\002\270^A\242\330\0142!lg\333S\367\2757\304\221\323\330{\033a\265\350\276\221\374O\311xJ\246* u\016ls\t7\306\327f$m\025\3348R\302\276\247\301 \261P\376s\304\023\207\235\020h\235\341)\273\327PNF\334\323\275\204\223\356L\200\222\272\324tf(\333\020]R\366\312vfn9\317\335-\357\026\3213\rr\356D{\356!\211\357\342n\373\262 \211:\222\030I\274\032\321\267D\366\251\3418|^\225\216\253{_\2041\027\274@\352\220\026\252;\222\216\205\244\2224\322\374;\356\272G\031\261O\273\004\236X\027\005g\275\235z\340_\013~h\355\200\250;\361q\373\007\247\3422d@0\343\357R\223\304}/\357\351\301\313\2434\345\364\014U""\251\275z\365;o\316\253\207\227\032;u\213\336\005\272a\362s\2568\206\227\037\374|;\376\r\314^\247B T\351\374\323d\317Gp7.\337\224\276',\036[\2312\303:\002\r\222P\345P|\206\201\354\304h\367\300\2660\352\277\207*\354\324\312\013\344\321\237P\347\245\303z}\033>MxW@\016\222\013\366e:\004:\351\007\016\325qEo\336\237\364\231_?!f\032X \002&Nd$u\035')@bt2.Y\017\277\016\332\361y\252OI\351/O@v\211~\376P\016Mve\223\030\222\206\371c\233PI\376\324\275\357E\327\240\037\014\226\214&\231\334\377\344f\273\243\223\355\3119y\341\310NO\244g\033\336\313 \035\310\242\301pe-@\245u\366\214\030\252nV\334!O\326\007r'\351\370\022\304\274$\3314\036l\266~8b2\260\326\274G~V\376`y\t\362X\366\353\366o\356-25\336\224\244>\240\204NF}$,\377m\260@?\301\242\231wD\245\376\357D8\321\314{\242\323\340\026\025\321\230\231tu\234y\203/f\303\037\307\212\225\372v\317\320\212\251\357\356\2450q/\325\233\276{AN\207\213\252\241\013\353\304\226\245E\005\275\360\344\335\013\364\377\273\325e\371\312,\256)\007\253\313\377\001/\334s\257"; + PyObject *data = __Pyx_DecompressString(cstring, 3828, 1); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #else /* compression: none (7375 bytes) */ +const char* const bytes = "Callable[['Vocab'], BaseVectors]Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Union[str, Path]Use Vectors[key] instead.Vectors.__setitem__Vectors.addVectors.resize'Vocab'?<>.add_notedisableenablegcisenabled.jsonspacy.spacy.Vectors.v1spacy.attrsspacy.enumspacy.errorsspacy.numpyspacy.pathlibspacy.srslyspacy.stringsspacy.thinc.apispacy.thinc.backendsspacy.thinc.typesspacy.typingspacy/vectors.pyxspacy.vocabspacy.warningsvectors.cfgBaseVectorsBaseVectors.__reduce_cython__BaseVectors.__setstate_cython__BaseVectors.addBaseVectors.from_bytesBaseVectors.from_diskBaseVectors.get_batchBaseVectors.is_fullBaseVectors.to_bytesBaseVectors.to_diskBaseVectors.to_opsCallableE058E059E060E1046E192E193E197E198E202E858E859E861E862E863E864EnumErrorsFalseFloats2dIDSModeMode.valuesORTHOpsPath__Pyx_PyDict_NextRefTTEXTTYPE_CHECKINGUnionVectorsVectors.__iter__Vectors.__reduce__Vectors._get_cfgVectors._get_ngram_hashesVectors._get_ngramsVectors._set_cfgVectors._sync_unsetVectors.addVectors.clearVectors.findVectors.from_bytesVectors.from_diskVectors.get_batchVectors.itemsVectors.keysVectors.most_similarVectors.resizeVectors.to_bytesVectors.to_diskVectors.to_opsVectors.valuesVocabW115Warningsa_maxa_minaddallow_picklealternativeappendarangeargargpartitionargsortaroundarras_contigas_stringasarrayasyncio.coroutinesattrattrsaxisbbad_kwargsbatchbatch_normsbatch_sizebest_rowsbowbyte_orderbytesbytes_datacastcfgchars__class____class_getitem__clearcline_in_tracebackclipcloseclscls_namecolscopycopy_shapecreate_mode_vectorscreate_mode_vectors..vectors_factorycurr_dimdatadecimalsdefaultdeserialize_weightsdeserializers__dict___dict__doc__dotdtype__enter__enumenumerateeowerrorsexcludeexists__exit__extendffile__filefilledfindfind..genexprfloretformatfrom_bytesfrom_bytes..deserialize_weightsfrom_bytes..from_diskfrom_disk..from_disk..load_key2rowfrom_disk..load_keysfrom_disk..load_settingsfrom_disk..load_vectors__func__genexprgetget_array_moduleget_array_opsget_batchget_batch..genexpr_get_cfgget_current_ops_get_ngram_hashes_get_ngramsget_string_id__getstate__hhash_counthash_seediindicesinplaceint32_is_coroutineis_fullitems__iter__jjson_dumpsjson_loadskeepdimskeykey2rowkeyskwargslengthslinalgloadload_key2rowload_keysload_settingsload_vectors__main__maxn__members____metaclass__methodminnmodemodes__module__most_similar__mro_entries__msgpack_dumpsmsgpack_loadsnn_rows__name__namendindex__new__new_dimnextngramngram_rowsngram_sizengramsnormnormsnumpynumpy_rowsopenopsoutppartitionpathpathlibpop__prepare____pyx_checksum__pyx_result__pyx_state__pyx_type__pyx_unpickle_BaseVectors__pyx_vtable____qualname__queriesread_jsonread_msgpack__reduce____reduce_cython____reduce_ex__reduce_meanrefcheckregistryremoved_itemsresizeresized_arrayresultsreturnrowrow2keyrow_indexrowsssavesave_arraysave_vectorsscoresselfsendserialize_weightsserializers_set_cfg__set_name__setdefault__setstate____setstate_cython__shapesimssizesortsorted_indexspacy.vectorssrslystartstatestringssum_sync_unset__test__thinc.apithinc.backendsthinc.typesthrowto_bytesto_bytes..to_bytes..serialize_weightsto_diskto_disk..to_disk..save_vectorsto_numpyto_opstypinguint64unique_keysunpickle_vectorsupdateupperuse_setstateutf8_stringutilvaluevaluesvecsvectorvectorsvectors_factoryvocabwarnwarningswbwith_suffixwrite_jsonwrite_msgpackxpzeros\2201\200\001\330\035\036\330\004\030\230\007\230|\2501\360\006\000\005\014\2101\320\004!\240\032\2501\360\026\000\t\014\2104\210v\220S\230\004\230A\330\014\024\220E\230\021\230(\240%\240w\250a\250w\260a\330\014\024\220A\360\006\000\t\017\210c\220\021\220-\230q\240\001\330\010\013\2104\210w\220a\330\014\022\220#\220Q\220a\330\010\013\2104\210s\220%\220t\2304\230s\240$\240a\330\014\022\220$\220h\230a\230q\330""\r\021\220\023\220A\330\014\017\210t\2201\330\020\026\220j\240\001\240\026\240u\250G\2601\260E\270\024\270U\300&\310\001\310\021\33049\270\024\270U\300&\310\001\310\021\330\014\022\220%\220q\230\004\230G\2406\250\021\330\010\013\2104\210r\220\024\220U\230&\240\001\240\021\330\014\020\220\010\230\001\230\027\240\001\340\014\022\220*\230A\230V\2405\250\007\250q\260\004\260E\270\024\270Q\330\010\013\2107\220'\230\021\330\014\021\320\021!\240\021\240$\240a\330\014\025\220R\220x\230q\240\001\330\014\020\220\005\220Q\220g\230Q\330\010\013\2104\210w\220f\230A\230Q\330\014\020\220\007\220v\230Q\230d\240'\250\025\250a\250q\330\010\017\210q\320\004\037\230|\2501\330\010\017\210w\220a\220x\230u\240A\320\0042\260(\270(\300!\360 \000\t\014\2104\210v\220S\230\004\230A\330\014\022\220*\230A\230V\2405\250\007\250q\330\020\025\220T\230\021\330\020\034\230A\340\010\r\320\r\035\230Q\230d\240!\330\010\027\220q\230\004\230A\230Q\230d\240$\240g\250T\260\030\270\027\300\001\330\010\013\2103\210a\210x\220r\230\021\330\014\022\220*\230A\230V\2405\250\007\250q\260\002\260#\260W\270C\270q\300\001\330\010\021\220\022\2208\2301\230A\340\010\020\220\002\220'\230\025\230a\230t\2405\250\001\250\031\260%\260s\270)\3001\330\010\r\210Q\210f\220C\220u\230A\330\010\022\220$\220e\2301\230H\240B\240a\340\010\024\220B\220f\230B\230g\240V\2501\250D\260\004\260F\270!\330\010\021\220\022\2206\230\022\2307\240&\250\001\250\024\250T\260\026\260q\340\010\014\210E\220\025\220a\220s\230'\240\026\240q\250\004\250A\330\014\024\220G\2301\230D\240\001\240\021\240!\330\014\032\230\"\230G\2405\250\001\250\027\260\005\260S\270\t\300\021\330\014\027\220q\230\014\240C\240u\250A\330\014\025\220Q\360\010\000\r\024\2202\220T\230\021\230'\240\027\250\001\330\014\025\220Q\220b\230\001\230\021\230.\250\002\250-\260q\270\006\270a\270s\300%\300r\310\024\310Q\310a\330\014\022\220!\2202\220Q\220a\220~\240R\240z\260\021\260&\270\001\270\023\270E\300\022\3004\300q\310\001\340\014\017\210u\220D\230\002\230#\230Q\330\020\037\230r\240""\027\250\001\250\026\250v\260Q\260c\270\024\270U\300!\3002\300Q\300a\300q\330\024\026\220h\230a\230v\240Q\240b\250\001\250\021\250-\260u\270B\270g\300Q\330\020\026\220a\220r\230\021\230!\230>\250\026\250q\260\001\330\020\031\230\021\230\"\230A\230Q\230n\250I\260Q\260a\340\010\014\210C\210u\220E\230\030\240\021\240)\2501\330\014\025\220Q\220c\230\025\230f\240A\240Y\250a\250s\260!\340\010\021\220\022\2207\230!\2308\2409\250C\250t\2601\340\010\021\220\022\2205\230\001\230\030\240\027\250\003\2506\260\023\260D\270\001\330\010\022\220!\2205\230\004\230D\240\005\240W\250D\260\010\270\006\270a\340\010\025\220_\240B\240i\250q\260\001\330\010\017\210r\220\030\230\021\330\014\r\330\020\021\220\027\230\001\230\025\230d\240'\250\032\2601\260C\260s\270$\270c\300\021\330\020\024\220E\230\025\230a\230s\240!\2401\340\014\022\220!\340\010\020\220\006\220k\240\021\200\001\330\004\013\2107\220\"\220K\230q\240\001\2308\2405\250\013\2601\260D\270\t\300\021\200A\200A\360\020\000\t\021\220\001\220\027\230\001\230\021\330\010!\240\021\330\010\023\2201\220M\240\023\240A\240X\250T\260\034\270Q\270a\330\010\017\210q\330\014\017\210q\220\003\2202\220Q\330\014\017\210q\220\003\2203\220a\330\014\017\210q\220\003\2202\220Q\330\014\017\210q\220\003\2203\220a\340\010\017\210t\2206\230\024\230]\250!\200A\330\010\013\2104\210v\220S\230\004\230A\330\014\r\330\020\030\230\004\230A\230T\240\026\240q\340\r\021\220\026\220s\230$\230a\330\014\r\330\020\030\230\004\230A\230T\240\026\240q\330\020\030\230\004\230A\330\020\030\230\004\230A\330\020\036\230d\240!\330\020\035\230T\240\021\330\020\027\220t\2301\330\020\027\220t\2301\330\020\030\230\004\230A\200A\360\n\000\t\014\2104\210v\220S\230\004\230A\330\014\022\220*\230A\230V\2401\330\010\014\210K\220q\330\010\014\210L\230\001\320\004$\240A\360\036\000\t\014\2104\210v\220S\230\004\230A\330\014\024\220E\230\021\230(\240%\240w\250a\250w\260a\330\014\024\220A\330\010\r\320\r\035\230Q\230d\240!\330\010\013\2101\330\014\017\210u\220A\220S\230\003\2304\230u\240F""\250!\2501\330\020\026\220j\240\001\240\026\240u\250G\2601\260H\270E\300\021\300$\300i\310t\320SX\320X^\320^_\320_`\330\014\017\210s\220#\220Q\330\020\024\220E\230\027\240\001\240\027\250\t\260\021\340\020\026\220j\240\001\240\026\240q\340\014\034\230B\230f\240A\240W\250F\260$\260e\2701\330\014\032\230$\230e\2401\240D\250\004\250E\260\026\260q\270\t\300\025\300a\300t\3104\310u\320TZ\320Z[\320[\\\330\014\031\230\022\230:\240Q\240e\250:\260Q\260f\270D\300\005\300R\300z\320QR\320RW\320Wa\320ab\320bc\330\014\020\220\010\230\001\330\010\014\210L\230\001\330\010\030\230\001\330\010\014\210E\220\027\230\004\230H\240E\250\022\2506\260\021\330\014\017\210t\2203\220e\2301\230A\330\020\024\220H\230D\240\001\240\021\330\020\035\230W\240B\240e\2501\330\010\017\210q\200A\330\010\020\320\020#\2404\240y\260\001\200\001\360\010\000\005\r\210A\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017,\250D\260\001\260\027\270\013\3007\310!\340\010\017\320\017,\250D\260\001\260\027\270\013\3001\200A\330\010\014\210H\220D\230\001\230\023\230D\240\001\240\030\250\024\250Z\260q\330\010\014\210H\220C\220t\2301\230H\240A\330\010\014\210H\220C\220t\2301\230H\240A\330\010\014\210N\230#\230T\240\021\240.\260\001\330\010\014\210M\230\023\230D\240\001\240\035\250a\330\010\014\210G\2203\220d\230!\2307\240!\330\010\014\210G\2203\220d\230!\2307\240!\330\010\014\210H\220C\220t\2301\230H\240A\200A\330\010\016\210a\200A\330\010\021\220\021\220$\220d\230'\240\024\240X\250W\260A\330\010\014\320\014\034\230E\240\021\240!\2404\240t\2507\260%\260q\270\004\270E\300\026\300q\310\004\310C\310t\320SZ\320Z[\200A\360\n\000\t\017\210d\220%\220r\230\024\230R\230t\2401\330\010\021\220\021\220%\220r\230\021\330\014\017\210q\220\006\220e\2301\230A\330\014\020\220\016\230e\2401\240D\250\007\250t\2606\270\022\2701\330\014\020\220\t\230\025\230a\230s\240#\240Q\240e\2502\250[\270\002\270!\340\010\017\210q\200A""\360\n\000\t\017\210m\2301\230D\240\001\330\010\013\2104\210v\220S\230\004\230A\330\014\023\2204\220u\230A\230U\240!\330\014\023\2204\220u\230A\230Q\330\r\021\220\026\220s\230$\230a\330\014\023\2201\220D\230\010\240\n\250!\2505\260\004\260G\2701\330\014\017\210s\220$\320\026-\250S\260\001\330\020\027\220s\230#\230V\2402\240S\250\001\250\027\260\004\260E\270\026\270q\300\001\330\014\032\230%\230q\240\003\2401\240A\330\014\030\230\001\230\025\230b\240\004\240C\240w\250i\260q\270\001\330\014\023\2201\220I\230Q\230e\2404\240w\250a\330\014\026\220a\330\014\026\220a\330\014\020\220\007\220q\330\020\023\2204\220s\230!\330\024!\240\021\340\024!\240\021\330\030\032\230\"\230D\240\005\240V\2501\250A\330\030\034\230I\240T\250\034\260Q\260a\330\030\034\230E\240\024\320%7\260q\270\001\340\020\027\220w\230a\230q\330\020\027\220w\230a\230s\240!\2401\330\014\026\220c\230\030\240\021\240)\2506\260\021\330\014\026\220c\230\030\240\021\240)\2506\260\021\330\014\023\2203\220l\240!\2404\240q\250\n\260$\260e\2701\270K\300q\330\014\023\2204\220q\230\001\330\010\017\210s\220*\230A\230Q\200A\330\010\017\210q\320\004\034\230A\330\010\017\210q\200A\340\010\017\210t\2201\220C\220|\2405\250\001\200A\340\010\017\210t\2208\2305\240\001\320\031,\250B\250e\2601\260G\2701\320\031,\250B\250e\2601\260G\2705\300\r\310Q\320\004\032\230!\330\010\014\210H\220C\220x\230q\240\004\240A\230:\240T\250\031\260!\2605\270\013\3001\300A\210\001\360\010\000\r\023\220/\240\021\330\021\025\220U\230!\2309\240A\330\020\032\230!\2303\230i\240q\250\004\250G\260;\270f\300A\230:\240U\250+\260Q\260c\270\024\270Y\300a\320\004\032\230+\240Z\250{\270!\360\032\000\t\014\2104\210v\220S\230\004\230A\330\014\022\220*\230A\330\020\026\220e\2307\240!\330\024\031\230\024\230Q\330\024 \240\001\360\006\000\t\014\2103\210e\320\023>\270c\300\021\330\014\032\230'\240\025\240h\250f\260G\2705\300\010\310\001\330\014\022\220*\230A\230V\2405\250\007\250q\260\007\260q\330\010\r\320\r\035\230Q\230d\240!\330\010\013\2104\210w\220a\330\014\022""\220-\230q\240\001\330\014\023\2204\220x\230t\2401\240C\240q\250\007\250q\330\r\022\220'\230\021\330\014\023\2201\220M\240\021\240%\240t\2507\260!\330\014\023\2201\220D\230\010\240\004\240A\240S\250\001\250\027\260\003\2604\260w\270a\330\014\023\2202\220X\230Q\230f\240F\250!\340\014\026\220a\220u\230D\240\004\240E\250\027\260\004\260H\270F\300!\330\014\017\210t\2207\230!\330\020\027\220w\230a\230q\340\020\032\230!\2307\240!\2405\250\004\250G\2601\330\020\027\220r\230\030\240\021\240)\2506\260\021\320\004\032\230!\200\001\330\004)\250\021\250&\260\001\220a\320\004!\240\021\330\010\016\210a\320\004\036\230a\330\010\017\210q\320\004)\250\025\250a\360\022\000\t\n\360\016\000\t\n\360\014\000\t\n\360\014\000\t\n\360\010\000\t\n\330\014\027\220q\330\014\027\220q\330\014\024\220A\330\014\027\220q\330\014\033\2301\360\006\000\t\r\210J\220a\220v\230]\250!\330\010\014\210L\230\001\330\010\017\210q\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\220;\230h\240a\240q\330\004\007\200|\2207\230!\330\010-\250Q\250n\270N\310!\330\004\013\2101\320\004\037\230q\330\010\017\210q\320\004*\250%\250q\360\022\000\t\n\360\022\000\t\n\330\014\027\220q\330\014\027\220q\330\014\027\220q\330\014\033\2301\340\010\014\210K\220q\230\006\230o\250Q\330\010\014\210L\230\001\330\010\017\210q\320\004\"\240%\240q\360\020\000\t\n\360\016\000\t\n\330\014\027\220q\330\014\027\220q\330\014\027\220q\330\014\033\2301\340\010\017\210t\2209\230A\230]\250!\210\001\330\014\022\220/\240\021\330\014\017\210t\2207\230!\330\020\024\220H\230C\230s\240%\240q\250\003\2501\250A\330\014\020\220\007\220q\230\001\210\001\330\014\017\210t\2207\230!\330\020\024\220I\230Q\230e\240:\250Q\250a\210\001\330\014\017\210t\2207\230!\330\020\024\220K\230u\240M\260\021\260!\330\014\020\220\005\220W\230D\240\010\250\006\250a\330\020\023\2204\220w\230f\240A\240Q\330\024\030\230\007\230v\240Q\240d\250'\260\025\260a\260q\210\001\330\014\017\210t\2207\230!\330\020\027\220u\230E\240\021\240#\240Q\240a\330\020\024\220C\220w""\230i\240q\250\001\330\024\030\230\004\230A\230U\240$\240a\320\004'\240u\250A\360\020\000\t\016\320\r\035\230Q\230d\240!\330\010\013\2103\210c\220\021\330\014\031\230\021\340\014\031\230\021\340\010\t\360\020\000\t\n\330\014\027\220q\330\014\027\220q\330\014\027\220q\330\014\033\2301\340\010\017\210t\2208\2301\230F\240-\250q\210\001\330\014\017\210w\220a\220t\2307\240!\330\020\024\220E\230\033\240A\340\020\025\320\025%\240Q\240d\250!\330\020\024\220H\230B\230h\240a\240u\250N\270!\2701\330\020\026\220o\240Q\330\020\024\220G\2301\230A\210\001\330\014\017\210w\220a\220t\2307\240!\330\020\027\220t\2305\240\t\250\021\340\020\026\220o\240Q\330\020\027\220u\230N\250!\2503\250i\260q\270\004\270G\300;\310a\220x\230t\2408\2509\260A\220x\230u\240N\260!\2604\260q\220z\240\034\250Q\250a\220z\240\024\240X\250[\270\001\270\021\220z\240\024\240X\250W\260A\260U\270.\310\001\310\021\220z\240\024\240X\250X\260Q\260a\260|\3001\300A\220z\240\024\240X\250Z\260q\270\001\270\034\300Q\300a\220z\240\025\240n\260A\260S\270\004\270Auint64_t (void *, int, uint64_t)\000void (void const *, int, uint32_t, void *)\000hash64\000hash128_x64"; + PyObject *data = NULL; + CYTHON_UNUSED_VAR(__Pyx_DecompressString); + #endif + PyObject **stringtab = __pyx_mstate->__pyx_string_tab; + Py_ssize_t pos = 0; + for (int i = 0; i < 353; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 37) PyUnicode_InternInPlace(&string); + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + stringtab[i] = string; + pos += bytes_length; + } + for (int i = 353; i < 410; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); + stringtab[i] = string; + pos += bytes_length; + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + Py_XDECREF(data); + for (Py_ssize_t i = 0; i < 410; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 353; + for (Py_ssize_t i=0; i<57; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + } + { + PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 0; + int8_t const cint_constants_1[] = {0,-1,1,2,3,4,5}; + int16_t const cint_constants_2[] = {1024}; + int32_t const cint_constants_4[] = {238750788L}; + for (int i = 0; i < 9; i++) { + numbertab[i] = PyLong_FromLong((i < 7 ? cint_constants_1[i - 0] : (i < 8 ? cint_constants_2[i - 7] : cint_constants_4[i - 8]))); + if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_number_tab; + for (Py_ssize_t i=0; i<9; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_codeobjects ### */ +typedef struct { + unsigned int argcount : 2; + unsigned int num_posonly_args : 1; + unsigned int num_kwonly_args : 3; + unsigned int nlocals : 5; + unsigned int flags : 10; + unsigned int first_line : 10; +} __Pyx_PyCode_New_function_description; +/* NewCodeObj.proto */ +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +); + + +static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { + PyObject* tuple_dedup_map = PyDict_New(); + if (unlikely(!tuple_dedup_map)) return -1; + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 103}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_vocab}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_vectors_factory, __pyx_mstate->__pyx_kp_b_iso88591_1_waxuA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 298}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 380}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_row, __pyx_mstate->__pyx_n_u_vector}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 394}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_row}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 424}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_arg}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 486}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_key}; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 658}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_arr, __pyx_mstate->__pyx_n_u_file}; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_Be1G5_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 660}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_arr, __pyx_mstate->__pyx_n_u_file}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_Be1G1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 662}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_ops, __pyx_mstate->__pyx_n_u_file_2}; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_save_vectors, __pyx_mstate->__pyx_kp_b_iso88591_U_9A_3iq_G_fA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 671}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_p}; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_z_XXQa_1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 672}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_p}; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_z_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 673}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_p}; + __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_z_nAS_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 674}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_p}; + __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_U_Qc_Ya, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 687}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_row}; + __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_load_key2row, __pyx_mstate->__pyx_kp_b_iso88591_t7_KuM_WD_a_4wfAQ_vQd_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 694}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_key}; + __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_load_keys, __pyx_mstate->__pyx_kp_b_iso88591_t7_uE_Qa_Cwiq_AU_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 700}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_ops}; + __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_load_vectors, __pyx_mstate->__pyx_kp_b_iso88591_t7_HCs_q_1A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 706}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_path}; + __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_load_settings, __pyx_mstate->__pyx_kp_b_iso88591_t7_IQe_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 711}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_p}; + __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_z_XZq_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 730}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_ops}; + __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_serialize_weights, __pyx_mstate->__pyx_kp_b_iso88591_wat7_t5_oQ_uN_3iq_G_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 738}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_xt89A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 739}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_xuN_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 741}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_85_1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 754}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_xp, __pyx_mstate->__pyx_n_u_ops}; + __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_deserialize_weights, __pyx_mstate->__pyx_kp_b_iso88591_wat7_E_A_Qd_HBhauN_1_oQ_G1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 764}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_z_X, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 765}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_z_XWAU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 767}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_T_5_1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 32}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_bytes_data}; + __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_unpickle_vectors, __pyx_mstate->__pyx_kp_b_iso88591_7_Kq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 40}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_cls}; + __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_kp_b_iso88591_A_t1C_5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 59}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_is_full, __pyx_mstate->__pyx_kp_b_iso88591_A_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 62}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_keys}; + __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_get_batch, __pyx_mstate->__pyx_kp_b_iso88591_A_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 80}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_vector}; + __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_add, __pyx_mstate->__pyx_kp_b_iso88591_a_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 83}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ops}; + __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_to_ops, __pyx_mstate->__pyx_kp_b_iso88591__11, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 88}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_kwargs}; + __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_to_bytes, __pyx_mstate->__pyx_kp_b_iso88591_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 91}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_kwargs}; + __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_from_bytes, __pyx_mstate->__pyx_kp_b_iso88591_q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 94}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_kwargs}; + __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_to_disk, __pyx_mstate->__pyx_kp_b_iso88591_A_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 97}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_kwargs}; + __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_from_disk, __pyx_mstate->__pyx_kp_b_iso88591_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_A_G1F_a_vWE_Q_q_q_D_7_D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591__12, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 101}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_vectors_factory, __pyx_mstate->__pyx_n_u_vectors_factory}; + __pyx_mstate_global->__pyx_codeobj_tab[38] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_create_mode_vectors, __pyx_mstate->__pyx_kp_b_iso88591_1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[38])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 260}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[39] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_reduce, __pyx_mstate->__pyx_kp_b_iso88591_A_4y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[39])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 337}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_shape, __pyx_mstate->__pyx_n_u_inplace, __pyx_mstate->__pyx_n_u_xp, __pyx_mstate->__pyx_n_u_resized_array, __pyx_mstate->__pyx_n_u_copy_shape, __pyx_mstate->__pyx_n_u_removed_items, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_row}; + __pyx_mstate_global->__pyx_codeobj_tab[40] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_resize, __pyx_mstate->__pyx_kp_b_iso88591_A_4vS_A_E_wawa_A_Qd_1_uAS_4uF_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[40])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 376}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[41] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_kp_b_iso88591_A_t85, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[41])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 4, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 404}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_n_u_row, __pyx_mstate->__pyx_n_u_rows, __pyx_mstate->__pyx_n_u_bad_kwargs, __pyx_mstate->__pyx_n_u_xp, __pyx_mstate->__pyx_n_u_row2key, __pyx_mstate->__pyx_n_u_results, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_row}; + __pyx_mstate_global->__pyx_codeobj_tab[42] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_find, __pyx_mstate->__pyx_kp_b_iso88591_Z_4vS_A_A_e7_Q_3e_c_hfG5_AV5_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[42])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 443}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_out, __pyx_mstate->__pyx_n_u_chars, __pyx_mstate->__pyx_n_u_utf8_string, __pyx_mstate->__pyx_n_u_rows}; + __pyx_mstate_global->__pyx_codeobj_tab[43] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_get_ngram_hashes, __pyx_mstate->__pyx_kp_b_iso88591_A_1M_AXT_Qa_q_q_2Q_q_3a_q_2Q_q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[43])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 462}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_ngrams, __pyx_mstate->__pyx_n_u_ngram_size, __pyx_mstate->__pyx_n_u_start}; + __pyx_mstate_global->__pyx_codeobj_tab[44] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_get_ngrams, __pyx_mstate->__pyx_kp_b_iso88591_A_d_r_Rt1_r_q_e1A_e1D_t6_1_as_Qe, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[44])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 17, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 475}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_n_u_ops, __pyx_mstate->__pyx_n_u_rows, __pyx_mstate->__pyx_n_u_vecs, __pyx_mstate->__pyx_n_u_unique_keys, __pyx_mstate->__pyx_n_u_row_index, __pyx_mstate->__pyx_n_u_indices, __pyx_mstate->__pyx_n_u_lengths, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_ngram_rows, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_ngram, __pyx_mstate->__pyx_n_u_h}; + __pyx_mstate_global->__pyx_codeobj_tab[45] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_get_batch, __pyx_mstate->__pyx_kp_b_iso88591_A_m1D_4vS_A_4uAU_4uAQ_s_a_1D_5_G, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[45])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 2, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 510}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_vector, __pyx_mstate->__pyx_n_u_row, __pyx_mstate->__pyx_n_u_xp}; + __pyx_mstate_global->__pyx_codeobj_tab[46] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_add, __pyx_mstate->__pyx_kp_b_iso88591_1_4vS_A_E_wawa_A_c_q_4wa_Qa_4s, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[46])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 3, 24, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 548}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_queries, __pyx_mstate->__pyx_n_u_batch_size, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_sort, __pyx_mstate->__pyx_n_u_xp, __pyx_mstate->__pyx_n_u_filled, __pyx_mstate->__pyx_n_u_norms, __pyx_mstate->__pyx_n_u_vectors, __pyx_mstate->__pyx_n_u_best_rows, __pyx_mstate->__pyx_n_u_scores, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_batch, __pyx_mstate->__pyx_n_u_batch_norms, __pyx_mstate->__pyx_n_u_sims, __pyx_mstate->__pyx_n_u_sorted_index, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_row2key, __pyx_mstate->__pyx_n_u_numpy_rows, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_n_u_row, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_row, __pyx_mstate->__pyx_n_u_row}; + __pyx_mstate_global->__pyx_codeobj_tab[47] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_most_similar, __pyx_mstate->__pyx_kp_b_iso88591_2_4vS_A_AV5_q_T_A_Qd_q_AQd_gT_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[47])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 618}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ops}; + __pyx_mstate_global->__pyx_codeobj_tab[48] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_to_ops, __pyx_mstate->__pyx_kp_b_iso88591_HCxq_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[48])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 621}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[49] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_get_cfg, __pyx_mstate->__pyx_kp_b_iso88591_A_4vS_A_AT_q_s_a_AT_q_A_A_d_T_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[49])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 638}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_cfg}; + __pyx_mstate_global->__pyx_codeobj_tab[50] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_set_cfg, __pyx_mstate->__pyx_kp_b_iso88591_A_HD_D_Zq_HCt1HA_HCt1HA_N_T_M_D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[50])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 648}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_exclude, __pyx_mstate->__pyx_n_u_xp, __pyx_mstate->__pyx_n_u_save_array, __pyx_mstate->__pyx_n_u_save_vectors, __pyx_mstate->__pyx_n_u_save_vectors, __pyx_mstate->__pyx_n_u_serializers}; + __pyx_mstate_global->__pyx_codeobj_tab[51] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_to_disk, __pyx_mstate->__pyx_kp_b_iso88591_uA_Qd_3c_q_q_q_1_t81F_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[51])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 678}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_exclude, __pyx_mstate->__pyx_n_u_load_key2row, __pyx_mstate->__pyx_n_u_load_key2row, __pyx_mstate->__pyx_n_u_load_keys, __pyx_mstate->__pyx_n_u_load_keys, __pyx_mstate->__pyx_n_u_load_vectors, __pyx_mstate->__pyx_n_u_load_vectors, __pyx_mstate->__pyx_n_u_load_settings, __pyx_mstate->__pyx_n_u_load_settings, __pyx_mstate->__pyx_n_u_serializers}; + __pyx_mstate_global->__pyx_codeobj_tab[52] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_from_disk, __pyx_mstate->__pyx_kp_b_iso88591_a_q_q_A_q_1_Jav_L_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[52])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 1, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 722}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exclude, __pyx_mstate->__pyx_n_u_serialize_weights, __pyx_mstate->__pyx_n_u_serialize_weights, __pyx_mstate->__pyx_n_u_serializers}; + __pyx_mstate_global->__pyx_codeobj_tab[53] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_to_bytes, __pyx_mstate->__pyx_kp_b_iso88591_q_q_q_q_1_t9A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[53])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 745}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_exclude, __pyx_mstate->__pyx_n_u_deserialize_weights, __pyx_mstate->__pyx_n_u_deserialize_weights, __pyx_mstate->__pyx_n_u_deserializers}; + __pyx_mstate_global->__pyx_codeobj_tab[54] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_from_bytes, __pyx_mstate->__pyx_kp_b_iso88591_q_q_q_q_1_Kq_oQ_L_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[54])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 773}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; + __pyx_mstate_global->__pyx_codeobj_tab[55] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_clear, __pyx_mstate->__pyx_kp_b_iso88591_A_4vS_A_AV1_Kq_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[55])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 783}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_filled, __pyx_mstate->__pyx_n_u_row, __pyx_mstate->__pyx_n_u_row}; + __pyx_mstate_global->__pyx_codeobj_tab[56] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vectors_pyx, __pyx_mstate->__pyx_n_u_sync_unset, __pyx_mstate->__pyx_kp_b_iso88591_A_d_XWA_E_4t7_q_E_q_CtSZZ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[56])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[57] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_BaseVectors, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_haq_7_QnN_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[57])) goto bad; + } + Py_DECREF(tuple_dedup_map); + return 0; + bad: + Py_DECREF(tuple_dedup_map); + return -1; +} +/* #### Code section: init_globals ### */ + +static int __Pyx_InitGlobals(void) { + /* PythonCompatibility.init */ + if (likely(__Pyx_init_co_variables() == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CommonTypesMetaclass.init */ + if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CachedMethodType.init */ + #if CYTHON_COMPILING_IN_LIMITED_API + { + PyObject *typesModule=NULL; + typesModule = PyImport_ImportModule("types"); + if (typesModule) { + __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + } + } // error handling follows + #endif + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CythonFunctionShared.init */ + if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* Generator.init */ + if (likely(__pyx_Generator_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, + "name '%U' is not defined", name); + } + return result; +} + +/* TupleAndListFromArray (used by fastcall) */ +#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + Py_ssize_t i; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + for (i = 0; i < n; i++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + return res; +} +#elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\ + !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + return PyObject_RichCompareBool(s1, s2, equals); +#else + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length, length2; + int kind; + void *data1, *data2; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + #endif + length = __Pyx_PyUnicode_GET_LENGTH(s1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length < 0)) return -1; + #endif + length2 = __Pyx_PyUnicode_GET_LENGTH(s2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length2 < 0)) return -1; + #endif + if (length != length2) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + return (equals == Py_EQ); +return_ne: + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(n == -1)) return NULL; + #endif + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + if (s == namei) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; + return kwvalues[i]; + } + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { + Py_ssize_t i, nkwargs; + PyObject *dict; +#if !CYTHON_ASSUME_SAFE_SIZE + nkwargs = PyTuple_Size(kwnames); + if (unlikely(nkwargs < 0)) return NULL; +#else + nkwargs = PyTuple_GET_SIZE(kwnames); +#endif + dict = PyDict_New(); + if (unlikely(!dict)) + return NULL; + for (i=0; itp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall (used by PyObjectCallOneArg) */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API + #if PY_VERSION_HEX < 0x03090000 + #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) + #elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { + PyTypeObject *tp = Py_TYPE(callable); + #if defined(__Pyx_CyFunction_USED) + if (__Pyx_CyFunction_CheckExact(callable)) { + return __Pyx_CyFunction_func_vectorcall(callable); + } + #endif + if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { + return NULL; + } + assert(PyCallable_Check(callable)); + Py_ssize_t offset = tp->tp_vectorcall_offset; + assert(offset > 0); + vectorcallfunc ptr; + memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); + return ptr; +} + #else + #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) + #endif +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if CYTHON_COMPILING_IN_LIMITED_API + return PyObject_Vectorcall(func, args, _nargs, NULL); + #else + vectorcallfunc f = __Pyx_PyVectorcall_Function(func); + if (f) { + return f(func, args, _nargs, NULL); + } + #endif + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* PyObjectCallOneArg (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + PyObject *result; + PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + if (unlikely(!selfless_args)) return NULL; + result = PyObject_Call(method, selfless_args, kwargs); + Py_DECREF(selfless_args); + return result; +} +#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { + return _PyObject_Vectorcall + (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames); +} +#else +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { + return +#if PY_VERSION_HEX < 0x03090000 + _PyObject_Vectorcall +#else + PyObject_Vectorcall +#endif + (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames); +} +#endif +static PyMethodDef __Pyx_UnboundCMethod_Def = { + "CythonUnboundCMethod", + __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 + METH_VARARGS | METH_KEYWORDS, +#else + METH_FASTCALL | METH_KEYWORDS, +#endif + NULL +}; +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method, *result=NULL; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + result = method; +#if CYTHON_COMPILING_IN_CPYTHON + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } else +#endif +#if CYTHON_COMPILING_IN_PYPY +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); +#endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); +#endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + result = unbound_method; + } + } +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + if (unlikely(target->method)) { + Py_DECREF(result); + } else +#endif + target->method = result; + return 0; +} + +/* CallUnboundCMethod0 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + if (likely(cfunc->flag == METH_NOARGS)) + return __Pyx_CallCFunction(cfunc, self, NULL); + if (likely(cfunc->flag == METH_FASTCALL)) + return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0); + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL); + if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS))) + return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (cfunc->flag == METH_VARARGS) + return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple); + return __Pyx__CallUnboundCMethod0(cfunc, self); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + PyObject *result; + if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; + result = __Pyx_PyObject_CallOneArg(cfunc->method, self); + return result; +} + +/* py_dict_items (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d); +} + +/* py_dict_values (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d); +} + +/* OwnedDictNext (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) { + PyObject *next = NULL; + if (!*ppos) { + if (pvalue) { + PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p); + if (unlikely(!dictview)) goto bad; + *ppos = PyObject_GetIter(dictview); + Py_DECREF(dictview); + } else { + *ppos = PyObject_GetIter(p); + } + if (unlikely(!*ppos)) goto bad; + } + next = PyIter_Next(*ppos); + if (!next) { + if (PyErr_Occurred()) goto bad; + return 0; + } + if (pkey && pvalue) { + *pkey = __Pyx_PySequence_ITEM(next, 0); + if (unlikely(*pkey)) goto bad; + *pvalue = __Pyx_PySequence_ITEM(next, 1); + if (unlikely(*pvalue)) goto bad; + Py_DECREF(next); + } else if (pkey) { + *pkey = next; + } else { + assert(pvalue); + *pvalue = next; + } + return 1; + bad: + Py_XDECREF(next); +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 + PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef"); +#else + PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef); +#endif + if (pkey) *pkey = NULL; + if (pvalue) *pvalue = NULL; + return 0; +} +#else // !CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) { + int result = PyDict_Next(p, ppos, pkey, pvalue); + if (likely(result == 1)) { + if (pkey) Py_INCREF(*pkey); + if (pvalue) Py_INCREF(*pvalue); + } + return result; +} +#endif + +/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); +} + +/* CallUnboundCMethod2 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, args, 2); + } + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *result = NULL; + PyObject *args = PyTuple_New(2); + if (unlikely(!args)) return NULL; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + return result; + } +#endif + { + PyObject *args[4] = {NULL, self, arg1, arg2}; + return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } +} + +/* ParseKeywordsImpl (used by ParseKeywords) */ +static int __Pyx_ValidateDuplicatePosArgs( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char* function_name) +{ + PyObject ** const *name = argnames; + while (name != first_kw_arg) { + PyObject *key = **name; + int found = PyDict_Contains(kwds, key); + if (unlikely(found)) { + if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; + } + name++; + } + return 0; +bad: + return -1; +} +#if CYTHON_USE_UNICODE_INTERNALS +static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) { + int kind; + Py_ssize_t len = PyUnicode_GET_LENGTH(s1); + if (len != PyUnicode_GET_LENGTH(s2)) return 0; + kind = PyUnicode_KIND(s1); + if (kind != PyUnicode_KIND(s2)) return 0; + const void *data1 = PyUnicode_DATA(s1); + const void *data2 = PyUnicode_DATA(s2); + return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0); +} +#endif +static int __Pyx_MatchKeywordArg_str( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + #if CYTHON_USE_UNICODE_INTERNALS + Py_hash_t key_hash = ((PyASCIIObject*)key)->hash; + if (unlikely(key_hash == -1)) { + key_hash = PyObject_Hash(key); + if (unlikely(key_hash == -1)) + goto bad; + } + #endif + name = first_kw_arg; + while (*name) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) { + *index_found = (size_t) (name - argnames); + return 1; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + *index_found = (size_t) (name - argnames); + return 1; + } + } + #endif + name++; + } + name = argnames; + while (name != first_kw_arg) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) { + if (__Pyx_UnicodeKeywordsEqual(name_str, key)) + goto arg_passed_twice; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + if (unlikely(name_str == key)) goto arg_passed_twice; + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + } + #endif + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +bad: + return -1; +} +static int __Pyx_MatchKeywordArg_nostr( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; + name = first_kw_arg; + while (*name) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (cmp == 1) { + *index_found = (size_t) (name - argnames); + return 1; + } + if (unlikely(cmp == -1)) goto bad; + name++; + } + name = argnames; + while (name != first_kw_arg) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (unlikely(cmp != 0)) { + if (cmp == 1) goto arg_passed_twice; + else goto bad; + } + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +bad: + return -1; +} +static CYTHON_INLINE int __Pyx_MatchKeywordArg( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + return likely(PyUnicode_CheckExact(key)) ? + __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) : + __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name); +} +static void __Pyx_RejectUnknownKeyword( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char *function_name) +{ + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; + #else + Py_ssize_t pos = 0; + #endif + PyObject *key = NULL; + __Pyx_BEGIN_CRITICAL_SECTION(kwds); + while ( + #if CYTHON_AVOID_BORROWED_REFS + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL) + #else + PyDict_Next(kwds, &pos, &key, NULL) + #endif + ) { + PyObject** const *name = first_kw_arg; + while (*name && (**name != key)) name++; + if (!*name) { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp != 1) { + if (cmp == 0) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + break; + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + } + __Pyx_END_CRITICAL_SECTION(); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); + #endif + assert(PyErr_Occurred()); +} +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t extracted = 0; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + name = first_kw_arg; + while (*name && num_kwargs > extracted) { + PyObject * key = **name; + PyObject *value; + int found = 0; + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + found = PyDict_GetItemRef(kwds, key, &value); + #else + value = PyDict_GetItemWithError(kwds, key); + if (value) { + Py_INCREF(value); + found = 1; + } else { + if (unlikely(PyErr_Occurred())) goto bad; + } + #endif + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + extracted++; + } + name++; + } + if (num_kwargs > extracted) { + if (ignore_unknown_kwargs) { + if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1)) + goto bad; + } else { + __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name); + goto bad; + } + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t len; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + if (PyDict_Update(kwds2, kwds) < 0) goto bad; + name = first_kw_arg; + while (*name) { + PyObject *key = **name; + PyObject *value; +#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)) + int found = PyDict_Pop(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int found = PyDict_GetItemRef(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad; + } +#else + #if CYTHON_COMPILING_IN_CPYTHON + value = _PyDict_Pop(kwds2, key, kwds2); + #else + value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2); + #endif + if (value == kwds2) { + Py_DECREF(value); + } else { + if (unlikely(!value)) goto bad; + values[name-argnames] = value; + } +#endif + name++; + } + len = PyDict_Size(kwds2); + if (len > 0) { + return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name); + } else if (unlikely(len == -1)) { + goto bad; + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject *key = NULL; + PyObject** const * name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) { +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); +#else + key = __Pyx_PyTuple_GET_ITEM(kwds, pos); +#endif +#if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!key)) goto bad; +#endif + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + PyObject *value = kwvalues[pos]; + values[name-argnames] = __Pyx_NewRef(value); + } else { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp == 1) { + PyObject *value = kwvalues[pos]; + values[index_found] = __Pyx_NewRef(value); + } else { + if (unlikely(cmp == -1)) goto bad; + if (kwds2) { + PyObject *value = kwvalues[pos]; + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else if (!ignore_unknown_kwargs) { + goto invalid_keyword; + } + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + key = NULL; + #endif + } + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + goto bad; +bad: + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(key); + #endif + return -1; +} + +/* ParseKeywords */ +static int __Pyx_ParseKeywords( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) + return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); + else if (kwds2) + return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name); + else + return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); +} + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* PyObjectFastCallMethod */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { + PyObject *result; + PyObject *attr = PyObject_GetAttr(args[0], name); + if (unlikely(!attr)) + return NULL; + result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); + Py_DECREF(attr); + return result; +} +#endif + +/* PyDictVersioning (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + if (!PyErr_Occurred()) + PyErr_SetNone(PyExc_NameError); + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } + PyErr_Clear(); +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return result; + } +#else + result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyObjectVectorCallKwBuilder (used by PyObjectVectorCallMethodKwBuilder) */ +#if CYTHON_VECTORCALL +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_PyObject_FastCallDict; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + args[n] = value; + return 0; +} +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_VectorcallBuilder_AddArgStr; + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); +} +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + PyObject *pyKey = PyUnicode_FromString(key); + if (!pyKey) return -1; + return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); +} +#else // CYTHON_VECTORCALL +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return PyDict_SetItem(builder, key, value); +} +#endif + +/* PyObjectVectorCallMethodKwBuilder */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) { + PyObject *result; + PyObject *obj = PyObject_GetAttr(args[0], name); + if (unlikely(!obj)) + return NULL; + result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames); + Py_DECREF(obj); + return result; +} +#endif + +/* RaiseException */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); +#elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} + +/* RejectKeywords */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) { + PyObject *key = NULL; + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) { + key = __Pyx_PySequence_ITEM(kwds, 0); + } else { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; +#else + Py_ssize_t pos = 0; +#endif +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return; +#endif + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL); +#if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); +#endif + } + if (likely(key)) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + Py_DECREF(key); + } +} + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + const char* function_name, + PyObject *kw) +{ +#if CYTHON_COMPILING_IN_PYPY && !defined(PyArg_ValidateKeywordArguments) + CYTHON_UNUSED_VAR(function_name); + CYTHON_UNUSED_VAR(kw); + return 0; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { +#if PY_VERSION_HEX >= 0x03090000 + CYTHON_UNUSED_VAR(function_name); +#else + Py_ssize_t kwsize; + #if CYTHON_ASSUME_SAFE_SIZE + kwsize = PyTuple_GET_SIZE(kw); + #else + kwsize = PyTuple_Size(kw); + if (unlikely(kwsize < 0)) return -1; + #endif + for (Py_ssize_t pos = 0; pos < kwsize; pos++) { + PyObject* key = NULL; + #if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); + #else + key = PyTuple_GetItem(kw, pos); + if (unlikely(!key)) return -1; + #endif + if (unlikely(!PyUnicode_Check(key))) { + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return -1; + } + } +#endif + } else { + if (unlikely(!PyArg_ValidateKeywordArguments(kw))) return -1; + } + return 0; +#endif +} + +/* GetAttr3 */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int res = PyObject_GetOptionalAttr(o, n, &r); + return (res != 0) ? r : __Pyx_NewRef(d); +#else + #if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } + #endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +#endif +} + +/* dict_setdefault (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + PyObject *args[] = {d, key, default_value}; + value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#elif CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#else + value = PyDict_SetDefault(d, key, default_value); + if (unlikely(!value)) return NULL; + Py_INCREF(value); +#endif + return value; +} + +/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static Py_ssize_t __Pyx_GetTypeDictOffset(void) { + PyObject *tp_dictoffset_o; + Py_ssize_t tp_dictoffset; + tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__"); + if (unlikely(!tp_dictoffset_o)) return -1; + tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o); + Py_DECREF(tp_dictoffset_o); + if (unlikely(tp_dictoffset == 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' doesn't have a dictoffset"); + return -1; + } else if (unlikely(tp_dictoffset < 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' has an unexpected negative dictoffset. " + "Please report this as Cython bug"); + return -1; + } + return tp_dictoffset; +} +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) { + static Py_ssize_t tp_dictoffset = 0; + if (unlikely(tp_dictoffset == 0)) { + tp_dictoffset = __Pyx_GetTypeDictOffset(); + if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) { + tp_dictoffset = 0; // try again next time? + return NULL; + } + } + return *(PyObject**)((char*)tp + tp_dictoffset); +} +#endif + +/* SetItemOnTypeDict (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) { + int result; + PyObject *tp_dict; +#if CYTHON_COMPILING_IN_LIMITED_API + tp_dict = __Pyx_GetTypeDict(tp); + if (unlikely(!tp_dict)) return -1; +#else + tp_dict = tp->tp_dict; +#endif + result = PyDict_SetItem(tp_dict, k, v); + if (likely(!result)) { + PyType_Modified(tp); + if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) { + PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL); + if (!setNameResult) return -1; + Py_DECREF(setNameResult); + } + } + return result; +} + +/* FixUpExtensionType (used by FetchCommonType) */ +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if __PYX_LIMITED_VERSION_HEX > 0x030900B1 + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#else + const PyType_Slot *slot = spec->slots; + int changed = 0; +#if !CYTHON_COMPILING_IN_LIMITED_API + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { +#if !CYTHON_COMPILING_IN_CPYTHON + const +#endif // !CYTHON_COMPILING_IN_CPYTHON) + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_vectorcall_offset = memb->offset; + changed = 1; + } +#endif // CYTHON_METH_FASTCALL +#if !CYTHON_COMPILING_IN_PYPY + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } +#endif // !CYTHON_COMPILING_IN_PYPY + } + memb++; + } + } +#endif // !CYTHON_COMPILING_IN_LIMITED_API +#if !CYTHON_COMPILING_IN_PYPY + slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_getset) + slot++; + if (slot && slot->slot == Py_tp_getset) { + PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc; + while (getset && getset->name) { + if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) { + PyObject *descr = PyDescr_NewGetSet(type, getset); + if (unlikely(!descr)) + return -1; + #if CYTHON_COMPILING_IN_LIMITED_API + PyObject *pyname = PyUnicode_FromString(getset->name); + if (unlikely(!pyname)) { + Py_DECREF(descr); + return -1; + } + int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr); + Py_DECREF(pyname); + #else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + #endif + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } + ++getset; + } + } +#else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#endif // !CYTHON_COMPILING_IN_PYPY + if (changed) + PyType_Modified(type); +#endif // PY_VERSION_HEX > 0x030900B1 + return 0; +} + +/* AddModuleRef (used by FetchSharedCythonModule) */ +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { + PyObject *module_dict = PyImport_GetModuleDict(); + PyObject *m; + if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { + return NULL; + } + if (m != NULL && PyModule_Check(m)) { + return m; + } + Py_XDECREF(m); + m = PyModule_NewObject(name); + if (m == NULL) + return NULL; + if (PyDict_CheckExact(module_dict)) { + PyObject *new_m; + (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); + Py_DECREF(m); + return new_m; + } else { + if (PyObject_SetItem(module_dict, name, m) != 0) { + Py_DECREF(m); + return NULL; + } + return m; + } + } + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *py_name = PyUnicode_FromString(name); + if (!py_name) return NULL; + PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); + Py_DECREF(py_name); + return module; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } +#endif + +/* FetchSharedCythonModule (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME); +} + +/* FetchCommonType (used by CommonTypesMetaclass) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases); + if (result && metaclass) { + PyObject *old_tp = (PyObject*)Py_TYPE(result); + Py_INCREF((PyObject*)metaclass); +#if __PYX_LIMITED_VERSION_HEX >= 0x03090000 + Py_SET_TYPE(result, metaclass); +#else + result->ob_type = metaclass; +#endif + Py_DECREF(old_tp); + } + return result; +} +#else +#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b) +#endif +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t expected_basicsize) { + Py_ssize_t basicsize; + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (expected_basicsize == 0) { + return 0; // size is inherited, nothing useful to check + } +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) return -1; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = NULL; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; +#else + basicsize = ((PyTypeObject*) cached_type)->tp_basicsize; +#endif + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name; + int get_item_ref_result; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + py_object_name = PyUnicode_FromString(object_name); + if (!py_object_name) return NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) goto done; + abi_module_dict = PyModule_GetDict(abi_module); + if (!abi_module_dict) goto done; + get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type); + if (get_item_ref_result == 1) { + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else if (unlikely(get_item_ref_result == -1)) { + goto bad; + } + cached_type = __Pyx_PyType_FromMetaclass( + metaclass, + CYTHON_USE_MODULE_STATE ? module : abi_module, + spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type); + if (unlikely(new_cached_type != cached_type)) { + if (unlikely(!new_cached_type)) goto bad; + Py_DECREF(cached_type); + cached_type = new_cached_type; + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else { + Py_DECREF(new_cached_type); + } +done: + Py_XDECREF(abi_module); + Py_DECREF(py_object_name); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +/* CommonTypesMetaclass (used by CythonFunctionShared) */ +static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) { + return PyUnicode_FromString(__PYX_ABI_MODULE_NAME); +} +#if __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) { + PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types"); + return NULL; +} +static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) { + PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable"); + return -1; +} +#endif +static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = { + {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = { + {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset}, + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr}, + #endif + {0, 0} +}; +static PyType_Spec __pyx_CommonTypesMetaclass_spec = { + __PYX_TYPE_MODULE_PREFIX "_common_types_metatype", + 0, + 0, + Py_TPFLAGS_IMMUTABLETYPE | + Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT, + __pyx_CommonTypesMetaclass_slots +}; +static int __pyx_CommonTypesMetaclass_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + PyObject *bases = PyTuple_Pack(1, &PyType_Type); + if (unlikely(!bases)) { + return -1; + } + mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases); + Py_DECREF(bases); + if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) { + return -1; + } + return 0; +} + +/* CallTypeTraverse (used by CythonFunctionShared) */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) { + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000 + if (__Pyx_get_runtime_version() < 0x03090000) return 0; + #endif + if (!always_call) { + PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*); + unsigned long flags = PyType_GetFlags(base); + if (flags & Py_TPFLAGS_HEAPTYPE) { + return 0; + } + } + Py_VISIT((PyObject*)Py_TYPE(o)); + return 0; +} +#endif + +/* PyMethodNew (used by CythonFunctionShared) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *result; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + { + PyObject *args[] = {func, self}; + result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL); + } + #else + result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL); + #endif + return result; +} +#else +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#endif + +/* PyVectorcallFastCallDict (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i; + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos; + #else + Py_ssize_t pos; + #endif + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + #if !CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t nkw = PyDict_Size(kw); + if (unlikely(nkw == -1)) return NULL; + #else + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + #endif + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = 0; + i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) { + keys_are_strings &= + #if CYTHON_COMPILING_IN_LIMITED_API + PyType_GetFlags(Py_TYPE(key)); + #else + Py_TYPE(key)->tp_flags; + #endif + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup; + #else + PyTuple_SET_ITEM(kwnames, i, key); + #endif + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(pos); + #endif + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + Py_ssize_t kw_size = + likely(kw == NULL) ? + 0 : +#if !CYTHON_ASSUME_SAFE_SIZE + PyDict_Size(kw); +#else + PyDict_GET_SIZE(kw); +#endif + if (kw_size == 0) { + return vc(func, args, nargs, NULL); + } +#if !CYTHON_ASSUME_SAFE_SIZE + else if (unlikely(kw_size == -1)) { + return NULL; + } +#endif + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif + +/* CythonFunctionShared (used by CythonFunction) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) { + if (__Pyx_CyFunction_Check(func)) { + return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; + } else if (PyCFunction_Check(func)) { + return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; + } + return 0; +} +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) { + int result; + PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func); + if (unlikely(!newFunc)) { + PyErr_Clear(); // It's only an optimization, so don't throw an error + return 0; + } + result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc); + Py_DECREF(newFunc); + return result; + } + return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc); +} +#else +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if (PyMethod_Check(func)) { + func = PyMethod_GET_FUNCTION(func); + } + return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +} +#endif +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + PyObject *result; + CYTHON_UNUSED_VAR(closure); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_doc_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#else + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_name_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_name, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + PyObject *result; + __Pyx_BEGIN_CRITICAL_SECTION(op); + Py_INCREF(op->func_qualname); + result = op->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +#endif +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_defaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_kwdefaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_annotations_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) { + int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; + if (is_coroutine) { + PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(is_coroutine_value)) { + return is_coroutine_value; + } +ignore: + PyErr_Clear(); + } + return __Pyx_PyBool_FromLong(is_coroutine); +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + result = __Pyx_CyFunction_get_is_coroutine_value(op); + if (unlikely(!result)) + return NULL; + __Pyx_BEGIN_CRITICAL_SECTION(op); + if (op->func_is_coroutine) { + Py_DECREF(result); + result = __Pyx_NewRef(op->func_is_coroutine); + } else { + op->func_is_coroutine = __Pyx_NewRef(result); + } + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, message, size); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + name, message, size); +#endif +} +static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s", + py_name, message); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s", + name, message); +#endif +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, +#else + {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, +#endif + {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#endif +#if CYTHON_METH_FASTCALL +#if CYTHON_COMPILING_IN_LIMITED_API + {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else + {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(args); + __Pyx_BEGIN_CRITICAL_SECTION(m); + Py_INCREF(m->func_qualname); + result = m->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + op->func_dict = NULL; +#endif + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func_dict); +#elif PY_VERSION_HEX < 0x030d0000 + _PyObject_ClearManagedDict((PyObject*)m); +#else + PyObject_ClearManagedDict((PyObject*)m); +#endif + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + Py_CLEAR(m->defaults); + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + { + int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg); + if (e) return e; + } + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func_dict); +#else + { + int e = +#if PY_VERSION_HEX < 0x030d0000 + _PyObject_VisitManagedDict +#else + PyObject_VisitManagedDict +#endif + ((PyObject*)m, visit, arg); + if (e != 0) return e; + } +#endif + __Pyx_VISIT_CONST(m->func_name); + __Pyx_VISIT_CONST(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + __Pyx_VISIT_CONST(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + Py_VISIT(m->defaults); + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ + PyObject *repr; + __Pyx_BEGIN_CRITICAL_SECTION(op); + repr = PyUnicode_FromFormat("", + op->func_qualname, (void *)op); + __Pyx_END_CRITICAL_SECTION(); + return repr; +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes no arguments", size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes exactly one argument", size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } + __Pyx_CyFunction_raise_type_error( + (__pyx_CyFunctionObject*)func, "takes no keyword arguments"); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_SIZE + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(argc < 0)) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "needs an argument"); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "takes no keyword arguments"); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes no arguments", nargs); + return NULL; + } + return meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes exactly one argument", nargs); + return NULL; + } + return meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + #if PY_VERSION_HEX < 0x030e00A6 + size_t nargs_value = (size_t) nargs; + #else + Py_ssize_t nargs_value = nargs; + #endif + return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames); +} +#endif +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if CYTHON_METH_FASTCALL +#if defined(Py_TPFLAGS_HAVE_VECTORCALL) + Py_TPFLAGS_HAVE_VECTORCALL | +#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif +#endif // CYTHON_METH_FASTCALL +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_DICT | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +static int __pyx_CyFunction_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL); + if (unlikely(mstate->__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type); + if (unlikely(!m->defaults)) + return NULL; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* PyLongBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) { + return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); +} +#if CYTHON_USE_PYLONG_INTERNALS +static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + const long b = intval; + long a; + const PY_LONG_LONG llb = intval; + PY_LONG_LONG lla; + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op2); + } + const int is_positive = __Pyx_PyLong_IsPos(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + if (likely(size == 1)) { + a = (long) digits[0]; + if (!is_positive) a *= -1; + } else { + switch (size) { + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) a *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) lla *= -1; + goto calculate_long_long; + } + break; + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) a *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) lla *= -1; + goto calculate_long_long; + } + break; + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) a *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) lla *= -1; + goto calculate_long_long; + } + break; + } + return PyLong_Type.tp_as_number->nb_add(op1, op2); + } + calculate_long: + { + long x; + x = a + b; + return PyLong_FromLong(x); + } + calculate_long_long: + { + PY_LONG_LONG llx; + llx = lla + llb; + return PyLong_FromLongLong(llx); + } + +} +#endif +static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) { + CYTHON_UNUSED_VAR(zerodivision_check); + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(float_val); + double result; + + result = ((double)a) + (double)b; + return PyFloat_FromDouble(result); +} +static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(zerodivision_check); + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check); + } + #endif + if (PyFloat_CheckExact(op1)) { + return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check); + } + return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace); +} +#endif + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#endif + +/* CoroutineSetYieldFrom (used by GeneratorYieldFrom) */ +static void +__Pyx_Coroutine_Set_Owned_Yield_From(__pyx_CoroutineObject *gen, PyObject *yf) { + assert (!gen->yieldfrom); +#if CYTHON_USE_AM_SEND + assert (!gen->yieldfrom_am_send); + #if PY_VERSION_HEX < 0x030A00F0 + if (__Pyx_PyType_HasFeature(Py_TYPE(yf), __Pyx_TPFLAGS_HAVE_AM_SEND)) + #endif + { + __Pyx_pyiter_sendfunc am_send; + #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 + am_send = __Pyx_PyObject_TryGetSubSlot(yf, tp_as_async, am_send, __Pyx_pyiter_sendfunc); + #else + __Pyx_PyAsyncMethodsStruct* tp_as_async = (__Pyx_PyAsyncMethodsStruct*) Py_TYPE(yf)->tp_as_async; + am_send = tp_as_async ? tp_as_async->am_send : NULL; + #endif + if (likely(am_send)) { + gen->yieldfrom_am_send = am_send; + } + } +#endif + gen->yieldfrom = yf; +} + +/* GetTopmostException (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + +/* SaveResetException (used by CoroutineBase) */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} +#endif + +/* SwapException (used by CoroutineBase) */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* IterNextPlain (used by CoroutineBase) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) { + if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache)) + __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next); + return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) { +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + PyObject *result; + PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI(); + if (unlikely(!next)) return NULL; + result = PyObject_CallFunctionObjArgs(next, iterator, NULL); + return result; +#else + (void)__Pyx_GetBuiltinName; // only for early limited API + iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator); + assert(iternext); + return iternext(iterator); +#endif +} + +/* PyObjectCall2Args (used by PyObjectCallMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod (used by PyObjectCallMethod1) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } +#endif + *method = attr; + return 0; +} +#endif + +/* PyObjectCallMethod1 (used by CoroutineBase) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +#endif +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +#endif +} + +/* PyObjectCallNoArg (used by CoroutineBase) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg[2] = {NULL, NULL}; + return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* ReturnWithStopIteration (used by CoroutineBase) */ +static void __Pyx__ReturnWithStopIteration(PyObject* value, int async); +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) { + if (value == Py_None) { + if (async || !iternext) + PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration); + return; + } + __Pyx__ReturnWithStopIteration(value, async); +} +static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) { +#if CYTHON_COMPILING_IN_CPYTHON + __Pyx_PyThreadState_declare +#endif + PyObject *exc; + PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration; +#if CYTHON_COMPILING_IN_CPYTHON + if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) { + if (PY_VERSION_HEX >= (0x030e00A1)) { + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + } else { + PyObject *args_tuple = PyTuple_New(1); + if (unlikely(!args_tuple)) return; + Py_INCREF(value); + PyTuple_SET_ITEM(args_tuple, 0, value); + exc = PyObject_Call(exc_type, args_tuple, NULL); + Py_DECREF(args_tuple); + } + if (unlikely(!exc)) return; + } else { + Py_INCREF(value); + exc = value; + } + #if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + #if CYTHON_USE_EXC_INFO_STACK + if (!__pyx_tstate->exc_info->exc_value) + #else + if (!__pyx_tstate->exc_type) + #endif + { + Py_INCREF(exc_type); + __Pyx_ErrRestore(exc_type, exc, NULL); + return; + } + #endif +#else + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + if (unlikely(!exc)) return; +#endif + PyErr_SetObject(exc_type, exc); + Py_DECREF(exc); +} + +/* CoroutineBase (used by Generator) */ +#if !CYTHON_COMPILING_IN_LIMITED_API +#include +#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#endif // CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void +__Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) { +#if CYTHON_USE_AM_SEND + gen->yieldfrom_am_send = NULL; +#endif + Py_CLEAR(gen->yieldfrom); +} +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + CYTHON_UNUSED_VAR(__pyx_tstate); + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (likely(et == PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + value = Py_None; + } + else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); + if (unlikely(!value)) goto limited_api_failure; + #else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + #endif + Py_DECREF(ev); + } + else if (unlikely(PyTuple_Check(ev))) { + Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(tuple_size < 0)) { + Py_XDECREF(tb); + Py_DECREF(ev); + Py_DECREF(et); + return -1; + } + #endif + if (tuple_size >= 1) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + value = PyTuple_GET_ITEM(ev, 0); + Py_INCREF(value); +#elif CYTHON_ASSUME_SAFE_MACROS + value = PySequence_ITEM(ev, 0); +#else + value = PySequence_GetItem(ev, 0); + if (!value) goto limited_api_failure; +#endif + } else { + Py_INCREF(Py_None); + value = Py_None; + } + Py_DECREF(ev); + } + else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { + value = ev; + } + if (likely(value)) { + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = value; + return 0; + } + } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); +#else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); +#endif + Py_DECREF(ev); +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!value)) return -1; +#endif + *pvalue = value; + return 0; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS + limited_api_failure: + Py_XDECREF(et); + Py_XDECREF(tb); + Py_XDECREF(ev); + return -1; +#endif +} +static CYTHON_INLINE +__Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) { + if (*retval) { + return PYGEN_NEXT; + } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) { + return PYGEN_RETURN; + } else { + return PYGEN_ERROR; + } +} +static CYTHON_INLINE +void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_CLEAR(exc_state->exc_value); +#else + PyObject *t, *v, *tb; + t = exc_state->exc_type; + v = exc_state->exc_value; + tb = exc_state->exc_traceback; + exc_state->exc_type = NULL; + exc_state->exc_value = NULL; + exc_state->exc_traceback = NULL; + Py_XDECREF(t); + Py_XDECREF(v); + Py_XDECREF(tb); +#endif +} +#define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) { + const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { + msg = "coroutine already executing"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { + msg = "async generator already executing"; + #endif + } else { + msg = "generator already executing"; + } + PyErr_SetString(PyExc_ValueError, msg); +} +static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) { + CYTHON_MAYBE_UNUSED_VAR(gen); + CYTHON_MAYBE_UNUSED_VAR(closing); + #ifdef __Pyx_Coroutine_USED + if (!closing && __Pyx_Coroutine_Check(gen)) { + PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); + } else + #endif + if (value) { + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + PyErr_SetNone(PyExc_StopAsyncIteration); + else + #endif + PyErr_SetNone(PyExc_StopIteration); + } +} +static +__Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) { + __Pyx_PyThreadState_declare + PyThreadState *tstate; + __Pyx_ExcInfoStruct *exc_state; + PyObject *retval; + assert(__Pyx_Coroutine_get_is_running(self)); // Callers should ensure is_running + if (unlikely(self->resume_label == -1)) { + __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); + return PYGEN_ERROR; + } +#if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + tstate = __pyx_tstate; +#else + tstate = __Pyx_PyThreadState_Current; +#endif + exc_state = &self->gi_exc_state; + if (exc_state->exc_value) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + #else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #elif PY_VERSION_HEX >= 0x030B00a4 + exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback; + #else + exc_tb = exc_state->exc_traceback; + #endif + if (exc_tb) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + assert(f->f_back == NULL); + #if PY_VERSION_HEX >= 0x030B00A1 + f->f_back = PyThreadState_GetFrame(tstate); + #else + Py_XINCREF(tstate->frame); + f->f_back = tstate->frame; + #endif + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + Py_DECREF(exc_tb); + #endif + } + #endif + } +#if CYTHON_USE_EXC_INFO_STACK + exc_state->previous_item = tstate->exc_info; + tstate->exc_info = exc_state; +#else + if (exc_state->exc_type) { + __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } else { + __Pyx_Coroutine_ExceptionClear(exc_state); + __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } +#endif + retval = self->body(self, tstate, value); +#if CYTHON_USE_EXC_INFO_STACK + exc_state = &self->gi_exc_state; + tstate->exc_info = exc_state->previous_item; + exc_state->previous_item = NULL; + __Pyx_Coroutine_ResetFrameBackpointer(exc_state); +#endif + *result = retval; + if (self->resume_label == -1) { + return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR; + } + return PYGEN_NEXT; +} +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(exc_state); +#else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 + if (!exc_state->exc_value) return; + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #else + exc_tb = exc_state->exc_traceback; + #endif + if (likely(exc_tb)) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + #if PY_VERSION_HEX >= 0x030B00a4 + Py_DECREF(exc_tb); + #endif + } +#endif +} +#define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\ + ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext)) +static PyObject * +__Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) { + CYTHON_MAYBE_UNUSED_VAR(gen); + if (likely(result == PYGEN_RETURN)) { + int is_async = 0; + #ifdef __Pyx_AsyncGen_USED + is_async = __Pyx_AsyncGen_CheckExact(gen); + #endif + __Pyx_ReturnWithStopIteration(retval, is_async, iternext); + Py_XDECREF(retval); + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE +PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { +#if PY_VERSION_HEX <= 0x030A00A1 + return _PyGen_Send(gen, arg); +#else + PyObject *result; + if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { + if (PyAsyncGen_CheckExact(gen)) { + assert(result == Py_None); + PyErr_SetNone(PyExc_StopAsyncIteration); + } + else if (result == Py_None) { + PyErr_SetNone(PyExc_StopIteration); + } + else { +#if PY_VERSION_HEX < 0x030d00A1 + _PyGen_SetStopIterationValue(result); +#else + if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) { + PyErr_SetObject(PyExc_StopIteration, result); + } else { + PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result); + if (likely(exc != NULL)) { + PyErr_SetObject(PyExc_StopIteration, exc); + Py_DECREF(exc); + } + } +#endif + } + Py_DECREF(result); + result = NULL; + } + return result; +#endif +} +#endif +static CYTHON_INLINE __Pyx_PySendResult +__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) { + __Pyx_PySendResult result; + PyObject *val = NULL; + assert(__Pyx_Coroutine_get_is_running(gen)); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); + result = __Pyx_Coroutine_SendEx(gen, val, retval, 0); + Py_XDECREF(val); + return result; +} +#if CYTHON_USE_AM_SEND +static __Pyx_PySendResult +__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) { + PyObject *ret = NULL; + __Pyx_PySendResult delegate_result, result; + assert(__Pyx_Coroutine_get_is_running(gen)); + delegate_result = gen_am_send(gen->yieldfrom, value, &ret); + if (delegate_result == PYGEN_NEXT) { + assert (ret != NULL); + *retval = ret; + return PYGEN_NEXT; + } + assert (delegate_result != PYGEN_ERROR || ret == NULL); + __Pyx_Coroutine_Undelegate(gen); + result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0); + Py_XDECREF(ret); + return result; +} +#endif +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); +} +static __Pyx_PySendResult +__Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) { + __Pyx_PySendResult result; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #if !CYTHON_USE_AM_SEND + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + ret = __Pyx_async_gen_asend_send(yf, value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + if (PyCoro_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + #endif + { + #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000 + if (value == Py_None && PyIter_Check(yf)) + ret = __Pyx_PyIter_Next_Plain(yf); + else + #endif + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value); + } + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + *retval = ret; + return PYGEN_NEXT; + } + result = __Pyx_Coroutine_FinishDelegation(gen, retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, value, retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return result; +} +static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + CYTHON_UNUSED_VAR(gen); + assert(__Pyx_Coroutine_get_is_running(gen)); + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + if (__Pyx_CoroutineAwait_CheckExact(yf)) { + result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + retval = __Pyx_async_gen_asend_close(yf, NULL); + result = PYGEN_RETURN; + } else + if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { + retval = __Pyx_async_gen_athrow_close(yf, NULL); + result = PYGEN_RETURN; + } else + #endif + { + PyObject *meth; + result = PYGEN_RETURN; + meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close); + if (unlikely(!meth)) { + if (unlikely(PyErr_Occurred())) { + PyErr_WriteUnraisable(yf); + } + } else { + retval = __Pyx_PyObject_CallNoArg(meth); + Py_DECREF(meth); + if (unlikely(!retval)) { + result = PYGEN_ERROR; + } + } + } + Py_XDECREF(retval); + return result == PYGEN_ERROR ? -1 : 0; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Next(yf); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, Py_None); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); + } else + #endif + ret = __Pyx_PyIter_Next_Plain(yf); + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1); +} +static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) { + PyObject *retval = NULL; + __Pyx_PySendResult result; + CYTHON_UNUSED_VAR(arg); + result = __Pyx_Coroutine_Close(self, &retval); + if (unlikely(result == PYGEN_ERROR)) + return NULL; + Py_XDECREF(retval); + Py_RETURN_NONE; +} +static __Pyx_PySendResult +__Pyx_Coroutine_Close(PyObject *self, PyObject **retval) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PySendResult result; + PyObject *yf; + int err = 0; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + yf = gen->yieldfrom; + if (yf) { + Py_INCREF(yf); + err = __Pyx_Coroutine_CloseIter(gen, yf); + __Pyx_Coroutine_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) + PyErr_SetNone(PyExc_GeneratorExit); + result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1); + if (result == PYGEN_ERROR) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_Coroutine_unset_is_running(gen); + if (!__Pyx_PyErr_Occurred()) { + return PYGEN_RETURN; + } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) { + __Pyx_PyErr_Clear(); + return PYGEN_RETURN; + } + return PYGEN_ERROR; + } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) { + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_RETURN; + } else { + const char *msg; + Py_DECREF(*retval); + *retval = NULL; + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(self)) { + msg = "coroutine ignored GeneratorExit"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(self)) { + msg = "async generator ignored GeneratorExit"; + #endif + } else { + msg = "generator ignored GeneratorExit"; + } + PyErr_SetString(PyExc_RuntimeError, msg); + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_ERROR; + } +} +static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, + PyObject *args, int close_on_genexit) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *yf; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) + return __Pyx_Coroutine_AlreadyRunningError(gen); + yf = gen->yieldfrom; + if (yf) { + __Pyx_PySendResult result; + PyObject *ret; + Py_INCREF(yf); + if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { + int err = __Pyx_Coroutine_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Coroutine_Undelegate(gen); + if (err < 0) + goto propagate_exception; + goto throw_here; + } + if (0 + #ifdef __Pyx_Generator_USED + || __Pyx_Generator_CheckExact(yf) + #endif + #ifdef __Pyx_Coroutine_USED + || __Pyx_Coroutine_Check(yf) + #endif + ) { + ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { + ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); + #endif + } else { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (unlikely(PyErr_Occurred())) { + __Pyx_Coroutine_unset_is_running(gen); + return NULL; + } + __Pyx_Coroutine_Undelegate(gen); + goto throw_here; + } + if (likely(args)) { + ret = __Pyx_PyObject_Call(meth, args, NULL); + } else { + PyObject *cargs[4] = {NULL, typ, val, tb}; + ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } + Py_DECREF(meth); + } + Py_DECREF(yf); + if (ret) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &ret); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0); + } +throw_here: + __Pyx_Raise(typ, val, tb, NULL); +propagate_exception: + { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); + } +} +static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { + PyObject *typ; + PyObject *val = NULL; + PyObject *tb = NULL; + if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb))) + return NULL; + return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); +} +static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_VISIT(exc_state->exc_value); +#else + Py_VISIT(exc_state->exc_type); + Py_VISIT(exc_state->exc_value); + Py_VISIT(exc_state->exc_traceback); +#endif + return 0; +} +static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { + { + int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg); + if (e) return e; + } + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); +} +static int __Pyx_Coroutine_clear(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); + } +#endif + Py_CLEAR(gen->gi_code); + Py_CLEAR(gen->gi_frame); + Py_CLEAR(gen->gi_name); + Py_CLEAR(gen->gi_qualname); + Py_CLEAR(gen->gi_modulename); + return 0; +} +static void __Pyx_Coroutine_dealloc(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject_GC_UnTrack(gen); + #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + if (gen->gi_weakreflist != NULL) + #endif + PyObject_ClearWeakRefs(self); + if (gen->resume_label >= 0) { + PyObject_GC_Track(self); +#if CYTHON_USE_TP_FINALIZE + if (unlikely(PyObject_CallFinalizerFromDealloc(self))) +#else + { + destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor); + if (del) del(self); + } + if (unlikely(Py_REFCNT(self) > 0)) +#endif + { + return; + } + PyObject_GC_UnTrack(self); + } +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + /* We have to handle this case for asynchronous generators + right here, because this code has to be between UNTRACK + and GC_Del. */ + Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); + } +#endif + __Pyx_Coroutine_clear(self); + __Pyx_PyHeapTypeObject_GC_Del(gen); +} +#if CYTHON_USE_TP_FINALIZE +static void __Pyx_Coroutine_del(PyObject *self) { + PyObject *error_type, *error_value, *error_traceback; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PyThreadState_declare + if (gen->resume_label < 0) { + return; + } + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; + PyObject *finalizer = agen->ag_finalizer; + if (finalizer && !agen->ag_closed) { + PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); + if (unlikely(!res)) { + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); + return; + } + } +#endif + if (unlikely(gen->resume_label == 0 && !error_value)) { +#ifdef __Pyx_Coroutine_USED +#ifdef __Pyx_Generator_USED + if (!__Pyx_Generator_CheckExact(self)) +#endif + { + PyObject_GC_UnTrack(self); + if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) + PyErr_WriteUnraisable(self); + PyObject_GC_Track(self); + } +#endif + } else { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval); + if (result == PYGEN_ERROR) { + PyErr_WriteUnraisable(self); + } else { + Py_XDECREF(retval); + } + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); +} +#endif +static PyObject * +__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_name; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(self->gi_name, value); + return 0; +} +static PyObject * +__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_qualname; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(self->gi_qualname, value); + return 0; +} +static PyObject * +__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self) +{ +#if !CYTHON_COMPILING_IN_LIMITED_API + PyObject *frame; + #if PY_VERSION_HEX >= 0x030d0000 + Py_BEGIN_CRITICAL_SECTION(self); + #endif + frame = self->gi_frame; + if (!frame) { + if (unlikely(!self->gi_code)) { + Py_RETURN_NONE; + } + PyObject *globals = PyDict_New(); + if (unlikely(!globals)) return NULL; + frame = (PyObject *) PyFrame_New( + PyThreadState_Get(), /*PyThreadState *tstate,*/ + (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ + globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + Py_DECREF(globals); + if (unlikely(!frame)) + return NULL; + if (unlikely(self->gi_frame)) { + Py_DECREF(frame); + frame = self->gi_frame; + } else { + self->gi_frame = frame; + } + } + Py_INCREF(frame); + #if PY_VERSION_HEX >= 0x030d0000 + Py_END_CRITICAL_SECTION(); + #endif + return frame; +#else + CYTHON_UNUSED_VAR(self); + Py_RETURN_NONE; +#endif +} +static PyObject * +__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) { + CYTHON_UNUSED_VAR(context); + PyObject *frame = self->gi_frame; + if (frame) + return __Pyx_NewRef(frame); + return __Pyx__Coroutine_get_frame(self); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); + if (unlikely(!gen)) + return NULL; + return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->yieldfrom_am_send = NULL; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API + gen->gi_exc_state.exc_value = NULL; + #else + gen->gi_exc_state.exc_type = NULL; + gen->gi_exc_state.exc_value = NULL; + gen->gi_exc_state.exc_traceback = NULL; + #endif +#if CYTHON_USE_EXC_INFO_STACK + gen->gi_exc_state.previous_item = NULL; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + gen->gi_weakreflist = NULL; +#endif + Py_XINCREF(qualname); + gen->gi_qualname = qualname; + Py_XINCREF(name); + gen->gi_name = name; + Py_XINCREF(module_name); + gen->gi_modulename = module_name; + Py_XINCREF(code); + gen->gi_code = code; + gen->gi_frame = NULL; + PyObject_GC_Track(gen); + return gen; +} +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + gen->is_running = 1; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; +} +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) { + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + assert(gen->is_running); + gen->is_running = 0; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif +} +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; +} +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) { + CYTHON_UNUSED_VAR(closure); + char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen); + if (result) Py_RETURN_TRUE; + else Py_RETURN_FALSE; +} +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) { + Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type; + if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) { + return; + } + memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async)); + static_amsend_methods->am_send = am_send; + type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods); +} +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); + __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self)); + PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object", + self_type_name); + __Pyx_DECREF_TypeName(self_type_name); + return NULL; +} + +/* Generator (used by GeneratorYieldFrom) */ +static PyMethodDef __pyx_Generator_methods[] = { + {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, + PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, + PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, + PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, + {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0}, + {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; +static PyMemberDef __pyx_Generator_memberlist[] = { + {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, + PyDoc_STR("object being iterated by 'yield from', or None")}, + {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, + {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0}, +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyGetSetDef __pyx_Generator_getsets[] = { + {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, + PyDoc_STR("name of the generator"), 0}, + {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, + PyDoc_STR("qualified name of the generator"), 0}, + {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL, + PyDoc_STR("Frame of the generator"), 0}, + {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_GeneratorType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc}, + {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse}, + {Py_tp_iter, (void *)PyObject_SelfIter}, + {Py_tp_iternext, (void *)__Pyx_Generator_Next}, + {Py_tp_methods, (void *)__pyx_Generator_methods}, + {Py_tp_members, (void *)__pyx_Generator_memberlist}, + {Py_tp_getset, (void *)__pyx_Generator_getsets}, + {Py_tp_getattro, (void *) PyObject_GenericGetAttr}, +#if CYTHON_USE_TP_FINALIZE + {Py_tp_finalize, (void *)__Pyx_Coroutine_del}, +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + {Py_am_send, (void *)__Pyx_Coroutine_AmSend}, +#endif + {0, 0}, +}; +static PyType_Spec __pyx_GeneratorType_spec = { + __PYX_TYPE_MODULE_PREFIX "generator", + sizeof(__pyx_CoroutineObject), + 0, +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_WEAKREF | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND, + __pyx_GeneratorType_slots +}; +#if __PYX_HAS_PY_AM_SEND == 2 +static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async; +#endif +static int __pyx_Generator_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL); + if (unlikely(!mstate->__pyx_GeneratorType)) { + return -1; + } +#if __PYX_HAS_PY_AM_SEND == 2 + __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend); +#endif + return 0; +} +static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *retval = NULL; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + (void) result; + assert (result == PYGEN_RETURN || result == PYGEN_ERROR); + assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL)); + return retval; +} + +/* GeneratorYieldFrom */ +#if CYTHON_USE_TYPE_SLOTS +static void __Pyx_PyIter_CheckErrorAndDecref(PyObject *source) { + __Pyx_TypeName source_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(source)); + PyErr_Format(PyExc_TypeError, + "iter() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", source_type_name); + __Pyx_DECREF_TypeName(source_type_name); + Py_DECREF(source); +} +#endif +static CYTHON_INLINE __Pyx_PySendResult __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval) { + PyObject *source_gen; + __Pyx_PySendResult result; +#ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(source)) { + Py_INCREF(source); + source_gen = source; + result = __Pyx_Coroutine_AmSend(source, Py_None, retval); + } else +#endif + { +#if CYTHON_USE_TYPE_SLOTS + if (likely(Py_TYPE(source)->tp_iter)) { + source_gen = Py_TYPE(source)->tp_iter(source); + if (unlikely(!source_gen)) { + *retval = NULL; + return PYGEN_ERROR; + } + if (unlikely(!PyIter_Check(source_gen))) { + __Pyx_PyIter_CheckErrorAndDecref(source_gen); + *retval = NULL; + return PYGEN_ERROR; + } + } else +#endif + { + source_gen = PyObject_GetIter(source); + if (unlikely(!source_gen)) { + *retval = NULL; + return PYGEN_ERROR; + } + } + *retval = __Pyx_PyIter_Next_Plain(source_gen); + result = __Pyx_Coroutine_status_from_result(retval); + } + if (likely(result == PYGEN_NEXT)) { + __Pyx_Coroutine_Set_Owned_Yield_From(gen, source_gen); + return PYGEN_NEXT; + } + Py_DECREF(source_gen); + return result; +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* IterFinish */ +static CYTHON_INLINE int __Pyx_IterFinish(void) { + PyObject* exc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (unlikely(exc_type)) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) + return -1; + __Pyx_PyErr_Clear(); + return 0; + } + return 0; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* RaiseUnboundLocalError */ +static void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* PyLongCompare */ +static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + return 0; + } + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + int unequal; + unsigned long uintval; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + if (intval == 0) { + return (__Pyx_PyLong_IsZero(op1) != 1); + } else if (intval < 0) { + if (__Pyx_PyLong_IsNonNeg(op1)) + return 1; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + return 1; + } + uintval = (unsigned long) intval; +#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 4)) { + unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 3)) { + unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 2)) { + unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 1)) { + unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif + unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); + return (unequal != 0); + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(op1); + return ((double)a != (double)b); + } + return __Pyx_PyObject_IsTrueAndDecref( + PyObject_RichCompare(op1, op2, Py_NE)); +} + +/* DictGetItem */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } + } + return value; +} +#endif + +/* ArgTypeTestFunc (used by ArgTypeTest) */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode; + int from_annotation_subclass = 0; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (!exact) { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } else if (exact == 2) { + if (__Pyx_TypeCheck(obj, type)) { + from_annotation_subclass = 1; + extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately; + } + } + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")" +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + "%s%U" +#endif + , name, type_name, obj_type_name +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + , (from_annotation_subclass ? ". " : ""), extra_info +#endif + ); +#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + if (exact == 2 && from_annotation_subclass) { + PyObject *res; + PyObject *vargs[2]; + vargs[0] = PyErr_GetRaisedException(); + vargs[1] = extra_info; + res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL); + Py_XDECREF(res); + PyErr_SetRaisedException(vargs[0]); + } +#endif + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* SliceTupleAndList */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) { + Py_ssize_t start = *_start, stop = *_stop, length = *_length; + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + else if (stop > length) + stop = length; + *_length = stop - start; + *_start = start; + *_stop = stop; +} +static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice( + PyObject* src, Py_ssize_t start, Py_ssize_t stop) { + Py_ssize_t length = PyTuple_GET_SIZE(src); + __Pyx_crop_slice(&start, &stop, &length); + return __Pyx_PyTuple_FromArray(((PyTupleObject*)src)->ob_item + start, length); +} +static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice_locked( + PyObject* src, Py_ssize_t start, Py_ssize_t stop) { + Py_ssize_t length = PyList_GET_SIZE(src); + __Pyx_crop_slice(&start, &stop, &length); + if (length <= 0) { + return PyList_New(0); + } + return __Pyx_PyList_FromArray(((PyListObject*)src)->ob_item + start, length); +} +static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice( + PyObject* src, Py_ssize_t start, Py_ssize_t stop) { + PyObject *result; + __Pyx_BEGIN_CRITICAL_SECTION(src); + result = __Pyx_PyList_GetSlice_locked(src, start, stop); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +#endif // CYTHON_COMPILING_IN_CPYTHON + +/* UnicodeConcatInPlace */ +# if CYTHON_COMPILING_IN_CPYTHON +static int +__Pyx_unicode_modifiable(PyObject *unicode, int unsafe_shared) +{ + if (!__Pyx_IS_UNIQUELY_REFERENCED(unicode, unsafe_shared)) + return 0; +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030F0000 + if (PyUnstable_Unicode_GET_CACHED_HASH(unicode) != -1) + return 0; +#endif + if (!PyUnicode_CheckExact(unicode)) + return 0; + if (PyUnicode_CHECK_INTERNED(unicode)) + return 0; + return 1; +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right, int unsafe_shared + #if CYTHON_REFNANNY + , void* __pyx_refnanny + #endif + ) { + PyObject *left = *p_left; + Py_ssize_t left_len, right_len, new_len; + if (unlikely(__Pyx_PyUnicode_READY(left) == -1)) + return NULL; + if (unlikely(__Pyx_PyUnicode_READY(right) == -1)) + return NULL; + left_len = PyUnicode_GET_LENGTH(left); + if (left_len == 0) { + Py_INCREF(right); + return right; + } + right_len = PyUnicode_GET_LENGTH(right); + if (right_len == 0) { + Py_INCREF(left); + return left; + } + if (unlikely(left_len > PY_SSIZE_T_MAX - right_len)) { + PyErr_SetString(PyExc_OverflowError, + "strings are too large to concat"); + return NULL; + } + new_len = left_len + right_len; + if (__Pyx_unicode_modifiable(left, unsafe_shared) + && PyUnicode_CheckExact(right) + && PyUnicode_KIND(right) <= PyUnicode_KIND(left) + && !(PyUnicode_IS_ASCII(left) && !PyUnicode_IS_ASCII(right))) { + int ret; + __Pyx_GIVEREF(*p_left); + ret = PyUnicode_Resize(p_left, new_len); + __Pyx_GOTREF(*p_left); + if (unlikely(ret != 0)) + return NULL; + #if PY_VERSION_HEX >= 0x030d0000 + if (unlikely(PyUnicode_CopyCharacters(*p_left, left_len, right, 0, right_len) < 0)) return NULL; + #else + _PyUnicode_FastCopyCharacters(*p_left, left_len, right, 0, right_len); + #endif + __Pyx_INCREF(*p_left); + __Pyx_GIVEREF(*p_left); + return *p_left; + } else { + return __Pyx_PyUnicode_Concat(left, right); + } + } +#endif + +/* PyUnicode_Substring */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring( + PyObject* text, Py_ssize_t start, Py_ssize_t stop) { + Py_ssize_t length; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(__Pyx_PyUnicode_READY(text) == -1)) return NULL; + #endif + length = __Pyx_PyUnicode_GET_LENGTH(text); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length < 0)) return NULL; + #endif + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + else if (stop > length) + stop = length; + if (stop <= start) + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode); + if (start == 0 && stop == length) + return __Pyx_NewRef(text); +#if CYTHON_COMPILING_IN_LIMITED_API + return PyUnicode_Substring(text, start, stop); +#else + return PyUnicode_FromKindAndData(PyUnicode_KIND(text), + PyUnicode_1BYTE_DATA(text) + start*PyUnicode_KIND(text), stop-start); +#endif +} + +/* PyLongCompare */ +static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + return 1; + } + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + int unequal; + unsigned long uintval; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + if (intval == 0) { + return (__Pyx_PyLong_IsZero(op1) == 1); + } else if (intval < 0) { + if (__Pyx_PyLong_IsNonNeg(op1)) + return 0; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + return 0; + } + uintval = (unsigned long) intval; +#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 4)) { + unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 3)) { + unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 2)) { + unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 1)) { + unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif + unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); + return (unequal == 0); + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(op1); + return ((double)a == (double)b); + } + return __Pyx_PyObject_IsTrueAndDecref( + PyObject_RichCompare(op1, op2, Py_EQ)); +} + +/* append */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; + } else { + PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_mstate_global->__pyx_n_u_append, x); + if (unlikely(!retval)) + return -1; + Py_DECREF(retval); + } + return 0; +} + +/* PyLongCompare */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + Py_RETURN_TRUE; + } + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + int unequal; + unsigned long uintval; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + if (intval == 0) { + if (__Pyx_PyLong_IsZero(op1) == 1) Py_RETURN_TRUE; else Py_RETURN_FALSE; + } else if (intval < 0) { + if (__Pyx_PyLong_IsNonNeg(op1)) + Py_RETURN_FALSE; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + Py_RETURN_FALSE; + } + uintval = (unsigned long) intval; +#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 4)) { + unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 3)) { + unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 2)) { + unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 1)) { + unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif + unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); + if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(op1); + if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; + } + return ( + PyObject_RichCompare(op1, op2, Py_EQ)); +} + +/* SliceObject */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { + __Pyx_TypeName obj_type_name; +#if CYTHON_USE_TYPE_SLOTS + PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyLong_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyLong_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_USE_TYPE_SLOTS + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); +bad: + return NULL; +} + +/* SliceObject */ +static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value, + Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { + __Pyx_TypeName obj_type_name; +#if CYTHON_USE_TYPE_SLOTS + PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_ass_subscript)) +#endif + { + int result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyLong_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyLong_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_USE_TYPE_SLOTS + result = mp->mp_ass_subscript(obj, py_slice, value); +#else + result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object does not support slice %.10s", + obj_type_name, value ? "assignment" : "deletion"); + __Pyx_DECREF_TypeName(obj_type_name); +bad: + return -1; +} + +/* PyObjectLookupSpecial */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) { + PyObject *res; + PyTypeObject *tp = Py_TYPE(obj); + res = _PyType_Lookup(tp, attr_name); + if (likely(res)) { + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (!f) { + Py_INCREF(res); + } else { + res = f(res, obj, (PyObject *)tp); + } + } else if (with_error) { + PyErr_SetObject(PyExc_AttributeError, attr_name); + } + return res; +} +#endif + +/* RaiseClosureNameError */ +static void __Pyx_RaiseClosureNameError(const char *varname) { + PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); +} + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif +{ + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C0000 + local_value = tstate->current_exception; + tstate->current_exception = 0; + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000 + local_value = PyErr_GetRaisedException(); +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif +#if __PYX_LIMITED_VERSION_HEX > 0x030C0000 + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } +#else + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } +#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000 + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif + } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + PyErr_SetHandledException(local_value); + Py_XDECREF(local_value); + Py_XDECREF(local_type); + Py_XDECREF(local_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000 +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +#endif +} + +/* HasAttr */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!PyUnicode_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (!r) { + return (unlikely(PyErr_Occurred())) ? -1 : 0; + } else { + Py_DECREF(r); + return 1; + } +} +#endif + +/* pyfrozenset_new (used by PySetContains) */ +static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) { + if (it) { + PyObject* result; +#if CYTHON_COMPILING_IN_PYPY + PyObject* args; + args = PyTuple_Pack(1, it); + if (unlikely(!args)) + return NULL; + result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL); + Py_DECREF(args); + return result; +#else + if (PyFrozenSet_CheckExact(it)) { + Py_INCREF(it); + return it; + } + result = PyFrozenSet_New(it); + if (unlikely(!result)) + return NULL; + if ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000) +#if CYTHON_COMPILING_IN_LIMITED_API + || __Pyx_get_runtime_version() >= 0x030A0000 +#endif + ) + return result; + { + Py_ssize_t size = __Pyx_PySet_GET_SIZE(result); + if (likely(size > 0)) + return result; +#if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(size < 0)) { + Py_DECREF(result); + return NULL; + } +#endif + } + Py_DECREF(result); +#endif + } + return __Pyx_PyObject_CallNoArg((PyObject*) &PyFrozenSet_Type); +} + +/* PySetContains */ +static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) { + int result = -1; + if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) { + PyObject *tmpkey; + PyErr_Clear(); + tmpkey = __Pyx_PyFrozenSet_New(key); + if (tmpkey != NULL) { + result = PySet_Contains(set, tmpkey); + Py_DECREF(tmpkey); + } + } + return result; +} +static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) { + int result = PySet_Contains(set, key); + if (unlikely(result < 0)) { + result = __Pyx_PySet_ContainsUnhashable(set, key); + } + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* AllocateExtensionType */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) { + if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc); + return alloc_func(t, 0); + } else { + newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc); + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) { + PyObject *new_str = PyUnicode_FromString("__new__"); + if (likely(new_str)) { + PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL); + Py_DECREF(new_str); + return o; + } else + return NULL; + } else + #endif + return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0); + } +} + +/* CallNextTpTraverse */ +static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) { + PyTypeObject* type = Py_TYPE(obj); + traverseproc tp_traverse = NULL; + while (type && __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc) != current_tp_traverse) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (type && (tp_traverse = __Pyx_PyType_GetSlot(type, tp_traverse, traverseproc)) == current_tp_traverse) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + if (type && tp_traverse) + return tp_traverse(obj, v, a); + return 0; +} + +/* CallNextTpClear */ +static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) { + PyTypeObject* type = Py_TYPE(obj); + inquiry tp_clear = NULL; + while (type && __Pyx_PyType_GetSlot(type, tp_clear, inquiry) != current_tp_clear) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (type && (tp_clear = __Pyx_PyType_GetSlot(type, tp_clear, inquiry)) == current_tp_clear) + type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + if (type && tp_clear) + tp_clear(obj); +} + +/* PyObjectCallMethod0 (used by PyType_Ready) */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[1] = {obj}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_CallNoArg; + return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +#endif +} + +/* ValidateBasesTuple (used by PyType_Ready) */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_SIZE + n = PyTuple_GET_SIZE(bases); +#else + n = PyTuple_Size(bases); + if (unlikely(n < 0)) return -1; +#endif + for (i = 1; i < n; i++) + { + PyTypeObject *b; +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + if (dictoffset == 0) + { + Py_ssize_t b_dictoffset = 0; +#if CYTHON_USE_TYPE_SLOTS + b_dictoffset = b->tp_dictoffset; +#else + PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__"); + if (!py_b_dictoffset) goto dictoffset_return; + b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset); + Py_DECREF(py_b_dictoffset); + if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return; +#endif + if (b_dictoffset) { + { + __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); + } +#if !CYTHON_USE_TYPE_SLOTS + dictoffset_return: +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + } +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + } + return 0; +} +#endif + +/* PyType_Ready */ +CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) { + while (t) { + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases) { + return 1; + } + t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*); + } + return 0; +} +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + if (!__Pyx_PyType_HasMultipleInheritance(t)) { + return PyType_Ready(t); + } + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\ + !CYTHON_COMPILING_IN_GRAAL + gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + +/* DelItemOnTypeDict (used by SetupReduce) */ +static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) { + int result; + PyObject *tp_dict; +#if CYTHON_COMPILING_IN_LIMITED_API + tp_dict = __Pyx_GetTypeDict(tp); + if (unlikely(!tp_dict)) return -1; +#else + tp_dict = tp->tp_dict; +#endif + result = PyDict_DelItem(tp_dict, k); + if (likely(!result)) PyType_Modified(tp); + return result; +} + +/* SetupReduce */ +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_name); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate); +#else + getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate); + if (!getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (getstate) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); +#else + object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); + if (!object_getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (object_getstate != getstate) { + goto __PYX_GOOD; + } + } +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); + if (likely(reduce_cython)) { + ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); + if (likely(setstate_cython)) { + ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } + } + PyType_Modified((PyTypeObject*)type_obj); + } + } + goto __PYX_GOOD; +__PYX_BAD: + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); + } + ret = -1; +__PYX_GOOD: +#if !CYTHON_USE_PYTYPE_LOOKUP + Py_XDECREF(object_reduce); + Py_XDECREF(object_reduce_ex); + Py_XDECREF(object_getstate); + Py_XDECREF(getstate); +#endif + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; +} + +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_2_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size) +{ + PyObject *result = 0; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) + PyObject *py_basicsize; + PyObject *py_itemsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) ) + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; +#else + if (size == 0) { + return (PyTypeObject *)result; + } + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize+itemsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_1 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_1 && (size_t)basicsize > size) { + if (PyErr_WarnFormat(NULL, 0, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize) < 0) { + goto bad; + } + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; +} +#endif + +/* GetVTable */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* PxdImportShared (used by FunctionImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(PyObject *module, const char *name, void **p, const char *sig, const char *what) { + PyObject *d = 0; + PyObject *cobj = 0; + d = PyObject_GetAttrString(module, "__pyx_capi__"); + if (!d) + goto bad; +#if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000) + PyDict_GetItemStringRef(d, name, &cobj); +#else + cobj = PyDict_GetItemString(d, name); + Py_XINCREF(cobj); +#endif + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%.200s does not export expected C %.8s %.200s", + PyModule_GetName(module), what, name); + goto bad; + } + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C %.8s %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", + what, PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); + goto bad; + } + *p = PyCapsule_GetPointer(cobj, sig); + if (!(*p)) + goto bad; + Py_DECREF(d); + Py_DECREF(cobj); + return 0; +bad: + Py_XDECREF(d); + Py_XDECREF(cobj); + return -1; +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* ImportImpl (used by Import) */ +static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) { + PyObject *imported_module = PyImport_GetModule(qualname); + if (unlikely(!imported_module)) { + *module = NULL; + if (PyErr_Occurred()) { + return -1; + } + return 0; + } + *module = imported_module; + return 1; +} +static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) { + PyObject *imported_module; + PyObject *top_level_package_name; + Py_ssize_t i; + int status, module_found; + Py_ssize_t dot_index; + module_found = __Pyx__Import_GetModule(qualname, &imported_module); + if (unlikely(!module_found || module_found == -1)) { + *module = NULL; + return module_found; + } + if (imported_names) { + for (i = 0; i < len_imported_names; i++) { + PyObject *imported_name = imported_names[i]; +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 + int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name); +#else + int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name); + if (unlikely(has_imported_attribute == -1)) goto error; +#endif + if (!has_imported_attribute) { + goto not_found; + } + } + *module = imported_module; + return 1; + } + dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1); + if (dot_index == -1) { + *module = imported_module; + return 1; + } + if (unlikely(dot_index == -2)) goto error; + top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index); + if (unlikely(!top_level_package_name)) goto error; + Py_DECREF(imported_module); + status = __Pyx__Import_GetModule(top_level_package_name, module); + Py_DECREF(top_level_package_name); + return status; +error: + Py_DECREF(imported_module); + *module = NULL; + return -1; +not_found: + Py_DECREF(imported_module); + *module = NULL; + return 0; +} +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *from_list = 0; + int module_found; + if (!qualname) { + qualname = name; + } + module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module); + if (likely(module_found == 1)) { + return module; + } else if (unlikely(module_found == -1)) { + return NULL; + } + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + if (imported_names) { +#if CYTHON_COMPILING_IN_CPYTHON + from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names); + if (unlikely(!from_list)) + goto bad; +#else + from_list = PyList_New(len_imported_names); + if (unlikely(!from_list)) goto bad; + for (Py_ssize_t i=0; i__pyx_d, level); +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__9); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\ + CYTHON_COMPILING_IN_GRAAL + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); + } + return value; +} + +/* Py3UpdateBases */ +static PyObject* +__Pyx_PEP560_update_bases(PyObject *bases) +{ + Py_ssize_t i, j, size_bases; + PyObject *base = NULL, *meth, *new_base, *result, *new_bases = NULL; +#if CYTHON_ASSUME_SAFE_SIZE + size_bases = PyTuple_GET_SIZE(bases); +#else + size_bases = PyTuple_Size(bases); + if (size_bases < 0) return NULL; +#endif + for (i = 0; i < size_bases; i++) { +#if CYTHON_AVOID_BORROWED_REFS + Py_CLEAR(base); +#endif +#if CYTHON_ASSUME_SAFE_MACROS + base = PyTuple_GET_ITEM(bases, i); +#else + base = PyTuple_GetItem(bases, i); + if (!base) goto error; +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(base); +#endif + if (PyType_Check(base)) { + if (new_bases) { + if (PyList_Append(new_bases, base) < 0) { + goto error; + } + } + continue; + } + meth = __Pyx_PyObject_GetAttrStrNoError(base, __pyx_mstate_global->__pyx_n_u_mro_entries); + if (!meth && PyErr_Occurred()) { + goto error; + } + if (!meth) { + if (new_bases) { + if (PyList_Append(new_bases, base) < 0) { + goto error; + } + } + continue; + } + new_base = __Pyx_PyObject_CallOneArg(meth, bases); + Py_DECREF(meth); + if (!new_base) { + goto error; + } + if (!PyTuple_Check(new_base)) { + PyErr_SetString(PyExc_TypeError, + "__mro_entries__ must return a tuple"); + Py_DECREF(new_base); + goto error; + } + if (!new_bases) { + if (!(new_bases = PyList_New(i))) { + goto error; + } + for (j = 0; j < i; j++) { + PyObject *base_from_list; +#if CYTHON_ASSUME_SAFE_MACROS + base_from_list = PyTuple_GET_ITEM(bases, j); + PyList_SET_ITEM(new_bases, j, base_from_list); + Py_INCREF(base_from_list); +#else + base_from_list = PyTuple_GetItem(bases, j); + if (!base_from_list) goto error; + Py_INCREF(base_from_list); + if (PyList_SetItem(new_bases, j, base_from_list) < 0) goto error; +#endif + } + } +#if CYTHON_ASSUME_SAFE_SIZE + j = PyList_GET_SIZE(new_bases); +#else + j = PyList_Size(new_bases); + if (j < 0) goto error; +#endif + if (PyList_SetSlice(new_bases, j, j, new_base) < 0) { + goto error; + } + Py_DECREF(new_base); + } + if (!new_bases) { + Py_INCREF(bases); + return bases; + } + result = PyList_AsTuple(new_bases); + Py_DECREF(new_bases); +#if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(base); +#endif + return result; +error: + Py_XDECREF(new_bases); +#if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(base); +#endif + return NULL; +} + +/* CalculateMetaclass */ +static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { + Py_ssize_t i, nbases; +#if CYTHON_ASSUME_SAFE_SIZE + nbases = PyTuple_GET_SIZE(bases); +#else + nbases = PyTuple_Size(bases); + if (nbases < 0) return NULL; +#endif + for (i=0; i < nbases; i++) { + PyTypeObject *tmptype; +#if CYTHON_ASSUME_SAFE_MACROS + PyObject *tmp = PyTuple_GET_ITEM(bases, i); +#else + PyObject *tmp = PyTuple_GetItem(bases, i); + if (!tmp) return NULL; +#endif + tmptype = Py_TYPE(tmp); + if (!metaclass) { + metaclass = tmptype; + continue; + } + if (PyType_IsSubtype(metaclass, tmptype)) + continue; + if (PyType_IsSubtype(tmptype, metaclass)) { + metaclass = tmptype; + continue; + } + PyErr_SetString(PyExc_TypeError, + "metaclass conflict: " + "the metaclass of a derived class " + "must be a (non-strict) subclass " + "of the metaclasses of all its bases"); + return NULL; + } + if (!metaclass) { + metaclass = &PyType_Type; + } + Py_INCREF((PyObject*) metaclass); + return (PyObject*) metaclass; +} + +/* ClassMethod */ +static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { +#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM <= 0x05080000 + if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) { + return PyClassMethod_New(method); + } +#else +#if CYTHON_COMPILING_IN_PYPY + if (PyMethodDescr_Check(method)) +#else + if (__Pyx_TypeCheck(method, &PyMethodDescr_Type)) +#endif + { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyErr_Format( + PyExc_SystemError, + "Cython cannot yet handle classmethod on a MethodDescriptorType (%S) in limited API mode. " + "This is most likely a classmethod in a cdef class method with binding=False. " + "Try setting 'binding' to True.", + method); +#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + PyTypeObject *d_type = GraalPyDescrObject_GetType(method); + return PyDescr_NewClassMethod(d_type, GraalPyMethodDescrObject_GetMethod(method)); +#elif CYTHON_COMPILING_IN_GRAAL + PyTypeObject *d_type = PyDescrObject_GetType(method); + return PyDescr_NewClassMethod(d_type, PyMethodDescrObject_GetMethod(method)); +#else + PyMethodDescrObject *descr = (PyMethodDescrObject *)method; + PyTypeObject *d_type = descr->d_common.d_type; + return PyDescr_NewClassMethod(d_type, descr->d_method); +#endif + } +#endif +#if !CYTHON_COMPILING_IN_LIMITED_API + else if (PyMethod_Check(method)) { + return PyClassMethod_New(PyMethod_GET_FUNCTION(method)); + } + else { + return PyClassMethod_New(method); + } +#else + { + PyObject *func=NULL; + PyObject *builtins, *classmethod, *classmethod_str, *result=NULL; + if (__Pyx_TypeCheck(method, __pyx_mstate_global->__Pyx_CachedMethodType)) { + func = PyObject_GetAttrString(method, "__func__"); + if (!func) goto bad; + } else { + func = method; + Py_INCREF(func); + } + builtins = PyEval_GetBuiltins(); // borrowed + if (unlikely(!builtins)) goto bad; + classmethod_str = PyUnicode_FromString("classmethod"); + if (unlikely(!classmethod_str)) goto bad; + classmethod = PyObject_GetItem(builtins, classmethod_str); + Py_DECREF(classmethod_str); + if (unlikely(!classmethod)) goto bad; + result = PyObject_CallFunctionObjArgs(classmethod, func, NULL); + Py_DECREF(classmethod); + bad: + Py_XDECREF(func); + return result; + } +#endif +} + +/* Py3ClassCreate */ +static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, + PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { + PyObject *ns; + if (metaclass) { + PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_mstate_global->__pyx_n_u_prepare); + if (prep) { + PyObject *pargs[3] = {NULL, name, bases}; + ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw); + Py_DECREF(prep); + } else { + if (unlikely(PyErr_Occurred())) + return NULL; + ns = PyDict_New(); + } + } else { + ns = PyDict_New(); + } + if (unlikely(!ns)) + return NULL; + if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_module, modname) < 0)) goto bad; + if (unlikely(PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_qualname, qualname) < 0)) goto bad; + if (unlikely(doc && PyObject_SetItem(ns, __pyx_mstate_global->__pyx_n_u_doc, doc) < 0)) goto bad; + return ns; +bad: + Py_DECREF(ns); + return NULL; +} +static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, + PyObject *dict, PyObject *mkw, + int calculate_metaclass, int allow_py2_metaclass) { + PyObject *result; + PyObject *owned_metaclass = NULL; + PyObject *margs[4] = {NULL, name, bases, dict}; + if (allow_py2_metaclass) { + owned_metaclass = PyObject_GetItem(dict, __pyx_mstate_global->__pyx_n_u_metaclass); + if (owned_metaclass) { + metaclass = owned_metaclass; + } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { + PyErr_Clear(); + } else { + return NULL; + } + } + if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { + metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); + Py_XDECREF(owned_metaclass); + if (unlikely(!metaclass)) + return NULL; + owned_metaclass = metaclass; + } + result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw); + Py_XDECREF(owned_metaclass); + return result; +} + +/* CLineInTraceback (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) +#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); +#else +PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { + PyObject **dict_ptr = _PyObject_GetDictPtr(o); + return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; +} +#endif +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline = NULL; + PyObject *ptype, *pvalue, *ptraceback; + PyObject *cython_runtime_dict; + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, cython_runtime_dict, + __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) + } + if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + Py_XDECREF(use_cline); + Py_XDECREF(cython_runtime_dict); + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache (used by AddTraceback) */ +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { + __Pyx_CachedCodeObjectType* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!code_cache->entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { + return NULL; + } + code_object = code_cache->entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__find_code_object; + return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); + if (old_count < 0) { + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); + return NULL; + } +#endif + __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); +#endif + return result; +#endif +} +static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) +{ + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + code_cache->entries = entries; + code_cache->max_count = 64; + code_cache->count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { + __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_INCREF(code_object); + Py_DECREF(tmp); + return; + } + if (code_cache->count == code_cache->max_count) { + int new_max = code_cache->max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + code_cache->entries = entries; + code_cache->max_count = new_max; + } + for (i=code_cache->count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + code_cache->count++; + Py_INCREF(code_object); +} +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__insert_code_object; + return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type expected = 0; + if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { + return; + } +#endif + __pyx__insert_code_object(code_cache, code_line, code_object); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); +#endif +#endif +} + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!code_object) { + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + } else { + py_funcname = PyUnicode_FromString(funcname); + } + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); + } else { + dict = PyDict_New(); + } + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + } + py_code = PyCode_NewEmpty(filename, funcname, py_line); + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} +#endif + +/* CheckUnpickleChecksum */ +static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + PyObject *pickle_module = PyImport_ImportModule("pickle"); + if (unlikely(!pickle_module)) return; + PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError"); + Py_DECREF(pickle_module); + if (unlikely(!pickle_error)) return; + if (checksum2 == checksum1) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))", + checksum, checksum1, members); + } else if (checksum3 == checksum2) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, members); + } else { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, checksum3, members); + } + Py_DECREF(pickle_error); +} +static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + int found = 0; + found |= checksum1 == checksum; + found |= checksum2 == checksum; + found |= checksum3 == checksum; + if (likely(found)) + return 0; + __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members); + return -1; +} + +/* CIntFromPyVerify */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + long val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (long) -1; + val = __Pyx_PyLong_As_long(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + long val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (long) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (long) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = v; + } + v = NULL; + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((long) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (long) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE uint32_t __Pyx_PyLong_As_uint32_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint32_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint32_t) -1; + val = __Pyx_PyLong_As_uint32_t(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint32_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(uint32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT)) { + return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT)) { + return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT)) { + return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint32_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint32_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint32_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint32_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint32_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint32_t val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (uint32_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint32_t) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (uint32_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint32_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(uint32_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((uint32_t) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint32_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint32_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint32_t) 1) << (sizeof(uint32_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (uint32_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint32_t"); + return (uint32_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint32_t"); + return (uint32_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE enum __pyx_t_5spacy_5attrs_attr_id_t __Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum __pyx_t_5spacy_5attrs_attr_id_t neg_one = (enum __pyx_t_5spacy_5attrs_attr_id_t) -1, const_zero = (enum __pyx_t_5spacy_5attrs_attr_id_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + enum __pyx_t_5spacy_5attrs_attr_id_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; + val = __Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) >= 2 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) >= 3 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) >= 4 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 2 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((enum __pyx_t_5spacy_5attrs_attr_id_t)-1)*(((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 2 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) ((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 3 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((enum __pyx_t_5spacy_5attrs_attr_id_t)-1)*(((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 3 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) ((((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 4 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((enum __pyx_t_5spacy_5attrs_attr_id_t)-1)*(((((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 4 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) ((((((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_5attrs_attr_id_t, long, PyLong_AsLong(x)) + } else if ((sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_5attrs_attr_id_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + enum __pyx_t_5spacy_5attrs_attr_id_t val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() or PyLong_AsNativeBytes() not available, cannot convert large enums"); + val = (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; +#endif + if (unlikely(ret)) + return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to enum __pyx_t_5spacy_5attrs_attr_id_t"); + return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to enum __pyx_t_5spacy_5attrs_attr_id_t"); + return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(enum __pyx_t_5spacy_5attrs_attr_id_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum __pyx_t_5spacy_5attrs_attr_id_t neg_one = (enum __pyx_t_5spacy_5attrs_attr_id_t) -1, const_zero = (enum __pyx_t_5spacy_5attrs_attr_id_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + int val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (int) -1; + val = __Pyx_PyLong_As_int(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(int) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + int val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (int) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = v; + } + v = NULL; + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((int) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (int) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(uint64_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint64_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint32_t(uint32_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint32_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint32_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint32_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(uint32_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint32_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* UpdateUnpickledDict */ +static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + PyObject *state_dict = __Pyx_PySequence_ITEM(state, index); + if (unlikely(!state_dict)) { + return -1; + } + int non_empty = PyObject_IsTrue(state_dict); + if (non_empty == 0) { + Py_DECREF(state_dict); + return 0; + } else if (unlikely(non_empty == -1)) { + return -1; + } + PyObject *dict; + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + dict = PyObject_GetAttrString(obj, "__dict__"); + #else + dict = PyObject_GenericGetDict(obj, NULL); + #endif + if (unlikely(!dict)) { + Py_DECREF(state_dict); + return -1; + } + int result; + if (likely(PyDict_CheckExact(dict))) { + result = PyDict_Update(dict, state_dict); + } else { + PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict); + if (likely(obj_result)) { + Py_DECREF(obj_result); + result = 0; + } else { + result = -1; + } + } + Py_DECREF(state_dict); + Py_DECREF(dict); + return result; +} +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(state_size == -1)) return -1; + #endif + if (state_size <= index) { + return 0; + } + return __Pyx__UpdateUnpickledDict(obj, state, index); +} + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static __Pyx_TypeName +__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) +{ + PyObject *module = NULL, *name = NULL, *result = NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_qualname); + #else + name = PyType_GetQualName(tp); + #endif + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; + module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_module); + if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; + if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { + result = name; + name = NULL; + goto done; + } + result = PyUnicode_FromFormat("%U.%U", module, name); + if (unlikely(result == NULL)) goto bad; + done: + Py_XDECREF(name); + Py_XDECREF(module); + return result; + bad: + PyErr_Clear(); + if (name) { + result = name; + name = NULL; + } else { + result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__10); + } + goto done; +} +#endif + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); + for (i=0; i>= 8; + ++i; + } + __Pyx_cached_runtime_version = version; + } +} +#endif +static unsigned long __Pyx_get_runtime_version(void) { +#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + return Py_Version & ~0xFFUL; +#else + return __Pyx_cached_runtime_version; +#endif +} + +/* CheckBinaryVersion */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { + const unsigned long MAJOR_MINOR = 0xFFFF0000UL; + if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) + return 0; + if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) + return 1; + { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compile time Python version %d.%d " + "of module '%.100s' " + "%s " + "runtime version %d.%d", + (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), + __Pyx_MODULE_NAME, + (allow_newer) ? "was newer than" : "does not match", + (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) + ); + return PyErr_WarnEx(NULL, message, 1); + } +} + +/* NewCodeObj */ +#if CYTHON_COMPILING_IN_LIMITED_API + static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + PyObject *version_info; + PyObject *py_minor_version = NULL; + #endif + long minor_version = 0; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + minor_version = 11; + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + Py_DECREF(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + if (type) { + PyErr_Restore(type, value, traceback); + } + return result; + } +#elif PY_VERSION_HEX >= 0x030B0000 + static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1 + if (likely(result)) + result->_co_firsttraceable = 0; + #endif + return result; + } +#elif !CYTHON_COMPILING_IN_PYPY + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +) { + PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL; + Py_ssize_t var_count = (Py_ssize_t) descr.nlocals; + PyObject *varnames_tuple = PyTuple_New(var_count); + if (unlikely(!varnames_tuple)) return NULL; + for (Py_ssize_t i=0; i < var_count; i++) { + Py_INCREF(varnames[i]); + if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done; + } + #if CYTHON_COMPILING_IN_LIMITED_API + varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple); + if (!varnames_tuple_dedup) { + if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done; + varnames_tuple_dedup = varnames_tuple; + } + #else + varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple); + if (unlikely(!varnames_tuple_dedup)) goto done; + #endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(varnames_tuple_dedup); + #endif + if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) { + Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(line_table_length == -1)) goto done; + #endif + Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL; + code_bytes = PyBytes_FromStringAndSize(NULL, code_len); + if (unlikely(!code_bytes)) goto done; + char* c_code_bytes = PyBytes_AsString(code_bytes); + if (unlikely(!c_code_bytes)) goto done; + memset(c_code_bytes, 0, (size_t) code_len); + } + code_obj = (PyObject*) __Pyx__PyCode_New( + (int) descr.argcount, + (int) descr.num_posonly_args, + (int) descr.num_kwonly_args, + (int) descr.nlocals, + 0, + (int) descr.flags, + code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + varnames_tuple_dedup, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + filename, + funcname, + (int) descr.first_line, + (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes + ); +done: + Py_XDECREF(code_bytes); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(varnames_tuple_dedup); + #endif + Py_DECREF(varnames_tuple); + return code_obj; +} + +/* DecompressString */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { + PyObject *module, *decompress, *compressed_bytes, *decompressed; + const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; + PyObject *methodname = PyUnicode_FromString("decompress"); + if (unlikely(!methodname)) return NULL; + #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 + if (algo == 3) { + PyObject *fromlist = Py_BuildValue("[O]", methodname); + if (unlikely(!fromlist)) return NULL; + module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + } else + #endif + module = PyImport_ImportModule(module_name); + if (unlikely(!module)) goto import_failed; + decompress = PyObject_GetAttr(module, methodname); + if (unlikely(!decompress)) goto import_failed; + { + #ifdef __cplusplus + char *memview_bytes = const_cast(s); + #else + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wcast-qual" + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-qual" + #endif + char *memview_bytes = (char*) s; + #if defined(__clang__) + #pragma clang diagnostic pop + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + #endif + #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) + int memview_flags = 0x100; + #else + int memview_flags = PyBUF_READ; + #endif + compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); + } + if (unlikely(!compressed_bytes)) { + Py_DECREF(decompress); + goto bad; + } + decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); + Py_DECREF(compressed_bytes); + Py_DECREF(decompress); + Py_DECREF(module); + Py_DECREF(methodname); + return decompressed; +import_failed: + PyErr_Format(PyExc_ImportError, + "Failed to import '%.20s.decompress' - cannot initialise module strings. " + "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", + module_name, algo); +bad: + Py_XDECREF(module); + Py_DECREF(methodname); + return NULL; +} + +#include +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return __Pyx_PyUnicode_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return PyByteArray_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + { + const char* result; + Py_ssize_t unicode_length; + CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; + #else + result = PyUnicode_AsUTF8AndSize(o, length); + #endif + #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + unicode_length = PyUnicode_GetLength(o); + if (unlikely(unicode_length < 0)) return NULL; + if (unlikely(unicode_length != *length)) { + PyUnicode_AsASCIIString(o); + return NULL; + } + #endif + return result; + } +#else +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +#endif +} +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + if (PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif + if (PyByteArray_Check(o)) { +#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); +#else + *length = PyByteArray_Size(o); + if (*length == -1) return NULL; + return PyByteArray_AsString(o); +#endif + } else + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; + } + __Pyx_DECREF_TypeName(result_type_name); + return result; + } + PyErr_Format(PyExc_TypeError, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", + result_type_name); + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + PyObject *res = NULL; + if (likely(PyLong_Check(x))) + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + if (likely(m && m->nb_int)) { + res = m->nb_int(x); + } +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Long(x); + } +#endif + if (likely(res)) { + if (unlikely(!PyLong_CheckExact(res))) { + return __Pyx_PyNumber_LongWrongResultType(res); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); + } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyLong_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyLong_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { + CYTHON_UNUSED_VAR(b); + return __Pyx_NewRef(Py_None); +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return __Pyx_NewRef(b ? Py_True: Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { + return PyLong_FromSize_t(ival); +} + + +/* MultiPhaseInitModuleState */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 +#else + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 +#endif +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS +#error "Module state with PEP489 requires atomics. Currently that's one of\ + C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" +#endif +#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#define __Pyx_ModuleStateLookup_Lock() +#define __Pyx_ModuleStateLookup_Unlock() +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 +static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; +#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(__cplusplus) && __cplusplus >= 201103L +#include +static std::mutex __Pyx_ModuleStateLookup_mutex; +#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() +#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) +#include +static mtx_t __Pyx_ModuleStateLookup_mutex; +static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; +static void __Pyx_ModuleStateLookup_initialize_mutex(void) { + mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); +} +#define __Pyx_ModuleStateLookup_Lock()\ + call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ + mtx_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(HAVE_PTHREAD_H) +#include +static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; +#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(_WIN32) +#include // synchapi.h on its own doesn't work +static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; +#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#else +#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ + Requires C standard >= C11, or C++ standard >= C++11,\ + or pthreads, or the Windows 32 API, or Python >= 3.13." +#endif +typedef struct { + int64_t id; + PyObject *module; +} __Pyx_InterpreterIdAndModule; +typedef struct { + char interpreter_id_as_index; + Py_ssize_t count; + Py_ssize_t allocated; + __Pyx_InterpreterIdAndModule table[1]; +} __Pyx_ModuleStateLookupData; +#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; +#else +static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; +#endif +static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( + __Pyx_InterpreterIdAndModule* table, + Py_ssize_t count, + int64_t interpreterId) { + __Pyx_InterpreterIdAndModule* begin = table; + __Pyx_InterpreterIdAndModule* end = begin + count; + if (begin->id == interpreterId) { + return begin; + } + while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; + if (halfway->id == interpreterId) { + return halfway; + } + if (halfway->id < interpreterId) { + begin = halfway; + } else { + end = halfway; + } + } + for (; begin < end; ++begin) { + if (begin->id >= interpreterId) return begin; + } + return begin; +} +static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return NULL; +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + { + __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + if (likely(data)) { + __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); + if (likely(data == new_data)) { + goto read_finished; + } + } + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + __Pyx_ModuleStateLookup_Lock(); + __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); + data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + __Pyx_ModuleStateLookup_Unlock(); + } + read_finished:; +#else + __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_InterpreterIdAndModule* found = NULL; + if (unlikely(!data)) goto end; + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + found = data->table+interpreter_id; + } + } else { + found = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + } + end: + { + PyObject *result=NULL; + if (found && found->id == interpreter_id) { + result = found->module; + } +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); +#endif + return result; + } +} +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { + while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); +} +#else +#define __Pyx_ModuleStateLookup_wait_until_no_readers() +#endif +static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { + Py_ssize_t to_allocate = (*old_data)->allocated; + while (to_allocate <= interpreter_id) { + if (to_allocate == 0) to_allocate = 1; + else to_allocate *= 2; + } + __Pyx_ModuleStateLookupData *new_data = *old_data; + if (to_allocate != (*old_data)->allocated) { + new_data = (__Pyx_ModuleStateLookupData *)realloc( + *old_data, + sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + PyErr_NoMemory(); + return -1; + } + for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { + new_data->table[i].id = i; + new_data->table[i].module = NULL; + } + new_data->allocated = to_allocate; + } + new_data->table[interpreter_id].module = module; + if (new_data->count < interpreter_id+1) { + new_data->count = interpreter_id+1; + } + *old_data = new_data; + return 0; +} +static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { + __Pyx_InterpreterIdAndModule *read = data->table; + __Pyx_InterpreterIdAndModule *write = data->table; + __Pyx_InterpreterIdAndModule *end = read + data->count; + for (; readmodule) { + write->id = read->id; + write->module = read->module; + ++write; + } + } + data->count = write - data->table; + for (; writeid = 0; + write->module = NULL; + } + data->interpreter_id_as_index = 0; +} +static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + int result = 0; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_ModuleStateLookupData *new_data = old_data; + if (!new_data) { + new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); + if (!new_data) { + result = -1; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = 1; + new_data->interpreter_id_as_index = 1; + } + __Pyx_ModuleStateLookup_wait_until_no_readers(); + if (new_data->interpreter_id_as_index) { + if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); + goto end; + } + __Pyx_State_ConvertFromInterpIdAsIndex(new_data); + } + { + Py_ssize_t insert_at = 0; + { + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + new_data->table, new_data->count, interpreter_id); + assert(lower_bound); + insert_at = lower_bound - new_data->table; + if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { + lower_bound->module = module; + goto end; // already in table, nothing more to do + } + } + if (new_data->count+1 >= new_data->allocated) { + Py_ssize_t to_allocate = (new_data->count+1)*2; + new_data = + (__Pyx_ModuleStateLookupData*)realloc( + new_data, + sizeof(__Pyx_ModuleStateLookupData) + + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + result = -1; + new_data = old_data; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = to_allocate; + } + ++new_data->count; + int64_t last_id = interpreter_id; + PyObject *last_module = module; + for (Py_ssize_t i=insert_at; icount; ++i) { + int64_t current_id = new_data->table[i].id; + new_data->table[i].id = last_id; + last_id = current_id; + PyObject *current_module = new_data->table[i].module; + new_data->table[i].module = last_module; + last_module = current_module; + } + } + end: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); +#else + __Pyx_ModuleStateLookup_data = new_data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return result; +} +static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; +#endif + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + data->table[interpreter_id].module = NULL; + } + goto done; + } + { + __Pyx_ModuleStateLookup_wait_until_no_readers(); + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + if (!lower_bound) goto done; + if (lower_bound->id != interpreter_id) goto done; + __Pyx_InterpreterIdAndModule *end = data->table+data->count; + for (;lower_boundid = (lower_bound+1)->id; + lower_bound->module = (lower_bound+1)->module; + } + } + --data->count; + if (data->count == 0) { + free(data); + data = NULL; + } + done: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); +#else + __Pyx_ModuleStateLookup_data = data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return 0; +} +#endif + +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ +#endif /* Py_PYTHON_H */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/vectors.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/vectors.pyx new file mode 100644 index 0000000000000000000000000000000000000000..cf9fe4bf25c5ce67a15f2b362d39f88f5c32e3ea --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/vectors.pyx @@ -0,0 +1,785 @@ +# cython: infer_types=True, binding=True +from typing import Callable + +from cython.operator cimport dereference as deref +from libc.stdint cimport uint32_t, uint64_t +from libcpp.set cimport set as cppset +from murmurhash.mrmr cimport hash128_x64 + +import warnings +from enum import Enum +from pathlib import Path +from typing import TYPE_CHECKING, Union, cast + +import numpy +import srsly +from thinc.api import Ops, get_array_module, get_current_ops +from thinc.backends import get_array_ops +from thinc.types import Floats2d + +from .attrs cimport ORTH, attr_id_t +from .strings cimport StringStore + +from . import util +from .attrs import IDS +from .errors import Errors, Warnings +from .strings import get_string_id + +if TYPE_CHECKING: + from .vocab import Vocab # noqa: F401 # no-cython-lint + + +def unpickle_vectors(bytes_data): + return Vectors().from_bytes(bytes_data) + + +class Mode(str, Enum): + default = "default" + floret = "floret" + + @classmethod + def values(cls): + return list(cls.__members__.keys()) + + +cdef class BaseVectors: + def __init__(self, *, strings=None): + # Make sure abstract BaseVectors is not instantiated. + if self.__class__ == BaseVectors: + raise TypeError( + Errors.E1046.format(cls_name=self.__class__.__name__) + ) + + def __getitem__(self, key): + raise NotImplementedError + + def __contains__(self, key): + raise NotImplementedError + + def is_full(self): + raise NotImplementedError + + def get_batch(self, keys): + raise NotImplementedError + + @property + def shape(self): + raise NotImplementedError + + def __len__(self): + raise NotImplementedError + + @property + def vectors_length(self): + raise NotImplementedError + + @property + def size(self): + raise NotImplementedError + + def add(self, key, *, vector=None): + raise NotImplementedError + + def to_ops(self, ops: Ops): + pass + + # add dummy methods for to_bytes, from_bytes, to_disk and from_disk to + # allow serialization + def to_bytes(self, **kwargs): + return b"" + + def from_bytes(self, data: bytes, **kwargs): + return self + + def to_disk(self, path: Union[str, Path], **kwargs): + return None + + def from_disk(self, path: Union[str, Path], **kwargs): + return self + + +@util.registry.vectors("spacy.Vectors.v1") +def create_mode_vectors() -> Callable[["Vocab"], BaseVectors]: + def vectors_factory(vocab: "Vocab") -> BaseVectors: + return Vectors(strings=vocab.strings) + + return vectors_factory + + +cdef class Vectors(BaseVectors): + """Store, save and load word vectors. + + Vectors data is kept in the vectors.data attribute, which should be an + instance of numpy.ndarray (for CPU vectors) or cupy.ndarray + (for GPU vectors). + + In the default mode, `vectors.key2row` is a dictionary mapping word hashes + to rows in the vectors.data table. Multiple keys can be mapped to the same + vector, and not all of the rows in the table need to be assigned - so + len(list(vectors.keys())) may be greater or smaller than vectors.shape[0]. + + In floret mode, the floret settings (minn, maxn, etc.) are used to + calculate the vector from the rows corresponding to the key's ngrams. + + DOCS: https://spacy.io/api/vectors + """ + cdef public object strings + cdef public object name + cdef readonly object mode + cdef public object data + cdef public object key2row + cdef cppset[int] _unset + cdef readonly uint32_t minn + cdef readonly uint32_t maxn + cdef readonly uint32_t hash_count + cdef readonly uint32_t hash_seed + cdef readonly unicode bow + cdef readonly unicode eow + cdef readonly attr_id_t attr + + def __init__(self, *, strings=None, shape=None, data=None, keys=None, name=None, mode=Mode.default, minn=0, maxn=0, hash_count=1, hash_seed=0, bow="<", eow=">", attr="ORTH"): + """Create a new vector store. + + strings (StringStore): The string store. + shape (tuple): Size of the table, as (# entries, # columns) + data (numpy.ndarray or cupy.ndarray): The vector data. + keys (iterable): A sequence of keys, aligned with the data. + name (str): A name to identify the vectors table. + mode (str): Vectors mode: "default" or "floret" (default: "default"). + minn (int): The floret char ngram minn (default: 0). + maxn (int): The floret char ngram maxn (default: 0). + hash_count (int): The floret hash count (1-4, default: 1). + hash_seed (int): The floret hash seed (default: 0). + bow (str): The floret BOW string (default: "<"). + eow (str): The floret EOW string (default: ">"). + attr (Union[int, str]): The token attribute for the vector keys + (default: "ORTH"). + + DOCS: https://spacy.io/api/vectors#init + """ + self.strings = strings + if self.strings is None: + self.strings = StringStore() + self.name = name + if mode not in Mode.values(): + raise ValueError( + Errors.E202.format( + name="vectors", + mode=mode, + modes=str(Mode.values()) + ) + ) + self.mode = Mode(mode).value + self.key2row = {} + self.minn = minn + self.maxn = maxn + self.hash_count = hash_count + self.hash_seed = hash_seed + self.bow = bow + self.eow = eow + if isinstance(attr, int): + self.attr = attr + else: + attr = attr.upper() + if attr == "TEXT": + attr = "ORTH" + self.attr = IDS.get(attr, ORTH) + + if self.mode == Mode.default: + if data is None: + if shape is None: + shape = (0, 0) + ops = get_current_ops() + data = ops.xp.zeros(shape, dtype="f") + self._unset = cppset[int]({i for i in range(data.shape[0])}) + else: + self._unset = cppset[int]() + self.data = data + if keys is not None: + for i, key in enumerate(keys): + self.add(key, row=i) + elif self.mode == Mode.floret: + if maxn < minn: + raise ValueError(Errors.E863) + if hash_count < 1 or hash_count >= 5: + raise ValueError(Errors.E862) + if data is None: + raise ValueError(Errors.E864) + if keys is not None: + raise ValueError(Errors.E861) + self.data = data + self._unset = cppset[int]() + + @property + def shape(self): + """Get `(rows, dims)` tuples of number of rows and number of dimensions + in the vector table. + + RETURNS (tuple): A `(rows, dims)` pair. + + DOCS: https://spacy.io/api/vectors#shape + """ + return self.data.shape + + @property + def size(self): + """The vector size i,e. rows * dims. + + RETURNS (int): The vector size. + + DOCS: https://spacy.io/api/vectors#size + """ + return self.data.size + + @property + def is_full(self): + """Whether the vectors table is full. + + RETURNS (bool): `True` if no slots are available for new keys. + + DOCS: https://spacy.io/api/vectors#is_full + """ + if self.mode == Mode.floret: + return True + return self._unset.size() == 0 + + @property + def n_keys(self): + """Get the number of keys in the table. Note that this is the number + of all keys, not just unique vectors. + + RETURNS (int): The number of keys in the table for default vectors. + For floret vectors, return -1. + + DOCS: https://spacy.io/api/vectors#n_keys + """ + if self.mode == Mode.floret: + return -1 + return len(self.key2row) + + def __reduce__(self): + return (unpickle_vectors, (self.to_bytes(),)) + + def __getitem__(self, key): + """Get a vector by key. If the key is not found, a KeyError is raised. + + key (str/int): The key to get the vector for. + RETURNS (ndarray): The vector for the key. + + DOCS: https://spacy.io/api/vectors#getitem + """ + if self.mode == Mode.default: + i = self.key2row.get(get_string_id(key), None) + if i is None: + raise KeyError(Errors.E058.format(key=key)) + else: + return self.data[i] + elif self.mode == Mode.floret: + return self.get_batch([key])[0] + raise KeyError(Errors.E058.format(key=key)) + + def __setitem__(self, key, vector): + """Set a vector for the given key. + + key (str/int): The key to set the vector for. + vector (ndarray): The vector to set. + + DOCS: https://spacy.io/api/vectors#setitem + """ + if self.mode == Mode.floret: + warnings.warn(Warnings.W115.format(method="Vectors.__setitem__")) + return + key = get_string_id(key) + i = self.key2row[key] + self.data[i] = vector + if self._unset.count(i): + self._unset.erase(self._unset.find(i)) + + def __iter__(self): + """Iterate over the keys in the table. + + YIELDS (int): A key in the table. + + DOCS: https://spacy.io/api/vectors#iter + """ + yield from self.key2row + + def __len__(self): + """Return the number of vectors in the table. + + RETURNS (int): The number of vectors in the data. + + DOCS: https://spacy.io/api/vectors#len + """ + return self.data.shape[0] + + def __contains__(self, key): + """Check whether a key has been mapped to a vector entry in the table. + + key (int): The key to check. + RETURNS (bool): Whether the key has a vector entry. + + DOCS: https://spacy.io/api/vectors#contains + """ + if self.mode == Mode.floret: + return True + else: + return key in self.key2row + + def __eq__(self, other): + # Check for equality, with faster checks first + return ( + self.shape == other.shape + and self.key2row == other.key2row + and self.to_bytes(exclude=["strings"]) == other.to_bytes(exclude=["strings"]) + ) + + def resize(self, shape, inplace=False): + """Resize the underlying vectors array. If inplace=True, the memory + is reallocated. This may cause other references to the data to become + invalid, so only use inplace=True if you're sure that's what you want. + + If the number of vectors is reduced, keys mapped to rows that have been + deleted are removed. These removed items are returned as a list of + `(key, row)` tuples. + + shape (tuple): A `(rows, dims)` tuple. + inplace (bool): Reallocate the memory. + RETURNS (list): The removed items as a list of `(key, row)` tuples. + + DOCS: https://spacy.io/api/vectors#resize + """ + if self.mode == Mode.floret: + warnings.warn(Warnings.W115.format(method="Vectors.resize")) + return -1 + xp = get_array_module(self.data) + if inplace: + if shape[1] != self.data.shape[1]: + raise ValueError(Errors.E193.format(new_dim=shape[1], curr_dim=self.data.shape[1])) + if xp == numpy: + self.data.resize(shape, refcheck=False) + else: + raise ValueError(Errors.E192) + else: + resized_array = xp.zeros(shape, dtype=self.data.dtype) + copy_shape = (min(shape[0], self.data.shape[0]), min(shape[1], self.data.shape[1])) + resized_array[:copy_shape[0], :copy_shape[1]] = self.data[:copy_shape[0], :copy_shape[1]] + self.data = resized_array + self._sync_unset() + removed_items = [] + for key, row in self.key2row.copy().items(): + if row >= shape[0]: + self.key2row.pop(key) + removed_items.append((key, row)) + return removed_items + + def keys(self): + """RETURNS (iterable): A sequence of keys in the table.""" + return self.key2row.keys() + + def values(self): + """Iterate over vectors that have been assigned to at least one key. + + Note that some vectors may be unassigned, so the number of vectors + returned may be less than the length of the vectors table. + + YIELDS (ndarray): A vector in the table. + + DOCS: https://spacy.io/api/vectors#values + """ + for row, vector in enumerate(range(self.data.shape[0])): + if not self._unset.count(row): + yield vector + + def items(self): + """Iterate over `(key, vector)` pairs. + + YIELDS (tuple): A key/vector pair. + + DOCS: https://spacy.io/api/vectors#items + """ + for key, row in self.key2row.items(): + yield key, self.data[row] + + def find(self, *, key=None, keys=None, row=None, rows=None): + """Look up one or more keys by row, or vice versa. + + key (Union[int, str]): Find the row that the given key points to. + Returns int, -1 if missing. + keys (Iterable[Union[int, str]]): Find rows that the keys point to. + Returns ndarray. + row (int): Find the first key that points to the row. + Returns int. + rows (Iterable[int]): Find the keys that point to the rows. + Returns ndarray. + RETURNS: The requested key, keys, row or rows. + """ + if self.mode == Mode.floret: + raise ValueError( + Errors.E858.format( + mode=self.mode, + alternative="Use Vectors[key] instead.", + ) + ) + if sum(arg is None for arg in (key, keys, row, rows)) != 3: + bad_kwargs = {"key": key, "keys": keys, "row": row, "rows": rows} + raise ValueError(Errors.E059.format(kwargs=bad_kwargs)) + xp = get_array_module(self.data) + if key is not None: + key = get_string_id(key) + return self.key2row.get(int(key), -1) + elif keys is not None: + keys = [get_string_id(key) for key in keys] + rows = [self.key2row.get(int(key), -1) for key in keys] + return xp.asarray(rows, dtype="i") + else: + row2key = {row: key for key, row in self.key2row.items()} + if row is not None: + return row2key[row] + else: + results = [row2key[row] for row in rows] + return xp.asarray(results, dtype="uint64") + + def _get_ngram_hashes(self, unicode s): + """Calculate up to 4 32-bit hash values with MurmurHash3_x64_128 using + the floret hash settings. + key (str): The string key. + RETURNS: A list of the integer hashes. + """ + # MurmurHash3_x64_128 returns an array of 2 uint64_t values. + cdef uint64_t[2] out + chars = s.encode("utf8") + cdef char* utf8_string = chars + hash128_x64(utf8_string, len(chars), self.hash_seed, &out) + rows = [ + out[0] & 0xffffffffu, + out[0] >> 32, + out[1] & 0xffffffffu, + out[1] >> 32, + ] + return rows[:min(self.hash_count, 4)] + + def _get_ngrams(self, unicode key): + """Get all padded ngram strings using the ngram settings. + key (str): The string key. + RETURNS: A list of the ngram strings for the padded key. + """ + key = self.bow + key + self.eow + ngrams = [key] + [ + key[start:start+ngram_size] + for ngram_size in range(self.minn, self.maxn + 1) + for start in range(0, len(key) - ngram_size + 1) + ] + return ngrams + + def get_batch(self, keys): + """Get the vectors for the provided keys efficiently as a batch. + keys (Iterable[Union[int, str]]): The keys. + RETURNS: The requested vectors from the vector table. + """ + ops = get_array_ops(self.data) + if self.mode == Mode.default: + rows = self.find(keys=keys) + vecs = self.data[rows] + elif self.mode == Mode.floret: + keys = [self.strings.as_string(key) for key in keys] + if sum(len(key) for key in keys) == 0: + return ops.xp.zeros((len(keys), self.data.shape[1])) + unique_keys = tuple(set(keys)) + row_index = {key: i for i, key in enumerate(unique_keys)} + rows = [row_index[key] for key in keys] + indices = [] + lengths = [] + for key in unique_keys: + if key == "": + ngram_rows = [] + else: + ngram_rows = [ + h % self.data.shape[0] + for ngram in self._get_ngrams(key) + for h in self._get_ngram_hashes(ngram) + ] + indices.extend(ngram_rows) + lengths.append(len(ngram_rows)) + indices = ops.asarray(indices, dtype="int32") + lengths = ops.asarray(lengths, dtype="int32") + vecs = ops.reduce_mean(cast(Floats2d, self.data[indices]), lengths) + vecs = vecs[rows] + return ops.as_contig(vecs) + + def add(self, key, *, vector=None, row=None): + """Add a key to the table. Keys can be mapped to an existing vector + by setting `row`, or a new vector can be added. + + key (int): The key to add. + vector (ndarray / None): A vector to add for the key. + row (int / None): The row number of a vector to map the key to. + RETURNS (int): The row the vector was added to. + + DOCS: https://spacy.io/api/vectors#add + """ + if self.mode == Mode.floret: + warnings.warn(Warnings.W115.format(method="Vectors.add")) + return -1 + # use int for all keys and rows in key2row for more efficient access + # and serialization + key = int(get_string_id(key)) + if row is not None: + row = int(row) + if row is None and key in self.key2row: + row = self.key2row[key] + elif row is None: + if self.is_full: + raise ValueError(Errors.E060.format(rows=self.data.shape[0], + cols=self.data.shape[1])) + row = deref(self._unset.begin()) + if row < self.data.shape[0]: + self.key2row[key] = row + else: + raise ValueError(Errors.E197.format(row=row, key=key)) + if vector is not None: + xp = get_array_module(self.data) + vector = xp.asarray(vector) + self.data[row] = vector + if self._unset.count(row): + self._unset.erase(self._unset.find(row)) + return row + + def most_similar(self, queries, *, batch_size=1024, n=1, sort=True): + """For each of the given vectors, find the n most similar entries + to it, by cosine. + + Queries are by vector. Results are returned as a `(keys, best_rows, + scores)` tuple. If `queries` is large, the calculations are performed in + chunks, to avoid consuming too much memory. You can set the `batch_size` + to control the size/space trade-off during the calculations. + + queries (ndarray): An array with one or more vectors. + batch_size (int): The batch size to use. + n (int): The number of entries to return for each query. + sort (bool): Whether to sort the n entries returned by score. + RETURNS (tuple): The most similar entries as a `(keys, best_rows, scores)` + tuple. + """ + if self.mode == Mode.floret: + raise ValueError(Errors.E858.format( + mode=self.mode, + alternative="", + )) + xp = get_array_module(self.data) + filled = sorted(list({row for row in self.key2row.values()})) + if len(filled) < n: + raise ValueError(Errors.E198.format(n=n, n_rows=len(filled))) + filled = xp.asarray(filled) + + norms = xp.linalg.norm(self.data[filled], axis=1, keepdims=True) + norms[norms == 0] = 1 + vectors = self.data[filled] / norms + + best_rows = xp.zeros((queries.shape[0], n), dtype='i') + scores = xp.zeros((queries.shape[0], n), dtype='f') + # Work in batches, to avoid memory problems. + for i in range(0, queries.shape[0], batch_size): + batch = queries[i : i+batch_size] + batch_norms = xp.linalg.norm(batch, axis=1, keepdims=True) + batch_norms[batch_norms == 0] = 1 + batch /= batch_norms + # batch e.g. (1024, 300) + # vectors e.g. (10000, 300) + # sims e.g. (1024, 10000) + sims = xp.dot(batch, vectors.T) + best_rows[i:i+batch_size] = xp.argpartition(sims, -n, axis=1)[:, -n:] + scores[i:i+batch_size] = xp.partition(sims, -n, axis=1)[:, -n:] + + if sort and n >= 2: + sorted_index = xp.arange(scores.shape[0])[:, None][i:i+batch_size], \ + xp.argsort(scores[i:i+batch_size], axis=1)[:, ::-1] + scores[i:i+batch_size] = scores[sorted_index] + best_rows[i:i+batch_size] = best_rows[sorted_index] + + for i, j in numpy.ndindex(best_rows.shape): + best_rows[i, j] = filled[best_rows[i, j]] + # Round values really close to 1 or -1 + scores = xp.around(scores, decimals=4, out=scores) + # Account for numerical error we want to return in range -1, 1 + scores = xp.clip(scores, a_min=-1, a_max=1, out=scores) + row2key = {row: key for key, row in self.key2row.items()} + + numpy_rows = get_current_ops().to_numpy(best_rows) + keys = xp.asarray( + [ + [row2key[row] for row in numpy_rows[i] if row in row2key] + for i in range(len(queries)) + ], + dtype="uint64" + ) + return (keys, best_rows, scores) + + def to_ops(self, ops: Ops): + self.data = ops.asarray(self.data) + + def _get_cfg(self): + if self.mode == Mode.default: + return { + "mode": Mode(self.mode).value, + } + elif self.mode == Mode.floret: + return { + "mode": Mode(self.mode).value, + "minn": self.minn, + "maxn": self.maxn, + "hash_count": self.hash_count, + "hash_seed": self.hash_seed, + "bow": self.bow, + "eow": self.eow, + "attr": self.attr, + } + + def _set_cfg(self, cfg): + self.mode = Mode(cfg.get("mode", Mode.default)).value + self.minn = cfg.get("minn", 0) + self.maxn = cfg.get("maxn", 0) + self.hash_count = cfg.get("hash_count", 0) + self.hash_seed = cfg.get("hash_seed", 0) + self.bow = cfg.get("bow", "<") + self.eow = cfg.get("eow", ">") + self.attr = cfg.get("attr", ORTH) + + def to_disk(self, path, *, exclude=tuple()): + """Save the current state to a directory. + + path (str / Path): A path to a directory, which will be created if + it doesn't exists. + + DOCS: https://spacy.io/api/vectors#to_disk + """ + xp = get_array_module(self.data) + if xp is numpy: + save_array = lambda arr, file_: xp.save(file_, arr, allow_pickle=False) # no-cython-lint + else: + save_array = lambda arr, file_: xp.save(file_, arr) # no-cython-lint + + def save_vectors(path): + # the source of numpy.save indicates that the file object is closed after use. + # but it seems that somehow this does not happen, as ResourceWarnings are raised here. + # in order to not rely on this, wrap in context manager. + ops = get_current_ops() + with path.open("wb") as _file: + save_array(ops.to_numpy(self.data, byte_order="<"), _file) + + serializers = { + "strings": lambda p: self.strings.to_disk(p.with_suffix(".json")), + "vectors": lambda p: save_vectors(p), + "key2row": lambda p: srsly.write_msgpack(p, self.key2row), + "vectors.cfg": lambda p: srsly.write_json(p, self._get_cfg()), + } + return util.to_disk(path, serializers, exclude) + + def from_disk(self, path, *, exclude=tuple()): + """Loads state from a directory. Modifies the object in place and + returns it. + + path (str / Path): Directory path, string or Path-like object. + RETURNS (Vectors): The modified object. + + DOCS: https://spacy.io/api/vectors#from_disk + """ + def load_key2row(path): + if path.exists(): + self.key2row = srsly.read_msgpack(path) + for key, row in self.key2row.items(): + if self._unset.count(row): + self._unset.erase(self._unset.find(row)) + + def load_keys(path): + if path.exists(): + keys = numpy.load(str(path)) + for i, key in enumerate(keys): + self.add(key, row=i) + + def load_vectors(path): + ops = get_current_ops() + if path.exists(): + self.data = ops.xp.load(str(path)) + self.to_ops(ops) + + def load_settings(path): + if path.exists(): + self._set_cfg(srsly.read_json(path)) + + serializers = { + "strings": lambda p: self.strings.from_disk(p.with_suffix(".json")), + "vectors": load_vectors, + "keys": load_keys, + "key2row": load_key2row, + "vectors.cfg": load_settings, + } + + util.from_disk(path, serializers, exclude) + self._sync_unset() + return self + + def to_bytes(self, *, exclude=tuple()): + """Serialize the current state to a binary string. + + exclude (list): String names of serialization fields to exclude. + RETURNS (bytes): The serialized form of the `Vectors` object. + + DOCS: https://spacy.io/api/vectors#to_bytes + """ + def serialize_weights(): + if hasattr(self.data, "to_bytes"): + return self.data.to_bytes() + else: + ops = get_current_ops() + return srsly.msgpack_dumps(ops.to_numpy(self.data, byte_order="<")) + + serializers = { + "strings": lambda: self.strings.to_bytes(), + "key2row": lambda: srsly.msgpack_dumps(self.key2row), + "vectors": serialize_weights, + "vectors.cfg": lambda: srsly.json_dumps(self._get_cfg()), + } + return util.to_bytes(serializers, exclude) + + def from_bytes(self, data, *, exclude=tuple()): + """Load state from a binary string. + + data (bytes): The data to load from. + exclude (list): String names of serialization fields to exclude. + RETURNS (Vectors): The `Vectors` object. + + DOCS: https://spacy.io/api/vectors#from_bytes + """ + def deserialize_weights(b): + if hasattr(self.data, "from_bytes"): + self.data.from_bytes() + else: + xp = get_array_module(self.data) + self.data = xp.asarray(srsly.msgpack_loads(b)) + ops = get_current_ops() + self.to_ops(ops) + + deserializers = { + "strings": lambda b: self.strings.from_bytes(b), + "key2row": lambda b: self.key2row.update(srsly.msgpack_loads(b)), + "vectors": deserialize_weights, + "vectors.cfg": lambda b: self._set_cfg(srsly.json_loads(b)) + } + util.from_bytes(data, deserializers, exclude) + self._sync_unset() + return self + + def clear(self): + """Clear all entries in the vector table. + + DOCS: https://spacy.io/api/vectors#clear + """ + if self.mode == Mode.floret: + raise ValueError(Errors.E859) + self.key2row = {} + self._sync_unset() + + def _sync_unset(self): + filled = {row for row in self.key2row.values()} + self._unset = cppset[int]({row for row in range(self.data.shape[0]) if row not in filled}) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/vocab.cpp b/TTS/Kokoro/.venv/Lib/site-packages/spacy/vocab.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fc32476e25e43bd9ca0c5351bcd1993ec19b0acf --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/vocab.cpp @@ -0,0 +1,52639 @@ +/* Generated by Cython 3.2.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\arrayscalars.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarrayobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ndarraytypes.h", + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include\\numpy\\ufuncobject.h", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include\\Python.h" + ], + "extra_compile_args": [ + "-std=c++11" + ], + "include_dirs": [ + "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-ej_q3m8u\\Lib\\site-packages\\numpy\\_core\\include", + "C:\\Users\\runneradmin\\AppData\\Local\\pypa\\cibuildwheel\\Cache\\nuget-cpython\\python.3.12.10\\tools\\Include" + ], + "language": "c++", + "name": "spacy.vocab", + "sources": [ + "spacy/vocab.pyx" + ] + }, + "module_name": "spacy.vocab" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +/* InitLimitedAPI */ +#if defined(Py_LIMITED_API) + #if !defined(CYTHON_LIMITED_API) + #define CYTHON_LIMITED_API 1 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef _MSC_VER + #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") + #else + #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. + #endif +#endif + +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x03080000 + #error Cython requires Python 3.8+. +#else +#define __PYX_ABI_VERSION "3_2_1" +#define CYTHON_HEX_VERSION 0x030201F0 +#define CYTHON_FUTURE_DIVISION 0 +/* CModulePreamble */ +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#define __PYX_COMMA , +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) + #endif + #undef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) + #endif + #undef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 0 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #undef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING 0 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS 1 + #endif + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #ifdef Py_GIL_DISABLED + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 + #else + #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 + #endif + #if PY_VERSION_HEX < 0x030A0000 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #elif !defined(CYTHON_USE_TYPE_SLOTS) + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLIST_INTERNALS) + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 + #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) + #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_ASSUME_SAFE_SIZE + #define CYTHON_ASSUME_SAFE_SIZE 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #elif !defined(CYTHON_FAST_GIL) + #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #ifndef CYTHON_USE_SYS_MONITORING + #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #ifndef CYTHON_USE_AM_SEND + #define CYTHON_USE_AM_SEND 1 + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif + #ifndef CYTHON_USE_FREELISTS + #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif + #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 + #undef CYTHON_IMMORTAL_CONSTANTS + #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work + #elif !defined(CYTHON_IMMORTAL_CONSTANTS) + #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) + #endif +#endif +#ifndef CYTHON_COMPRESS_STRINGS + #define CYTHON_COMPRESS_STRINGS 1 +#endif +#ifndef CYTHON_FAST_PYCCALL +#define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL +#endif +#ifndef CYTHON_VECTORCALL +#if CYTHON_COMPILING_IN_LIMITED_API +#define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) +#else +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) +#endif +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#include +typedef uintptr_t __pyx_uintptr_t; +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif +#ifndef Py_UNREACHABLE + #define Py_UNREACHABLE() assert(0); abort() +#endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) + +/* CppInitCode */ +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #else + #define CYTHON_INLINE inline + #endif +#endif +template +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } + T *operator->() { return ptr; } + T *operator&() { return ptr; } + operator T&() { return *ptr; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } + private: + T *ptr; +}; + +/* PythonCompatibility */ +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#define __Pyx_BUILTIN_MODULE_NAME "builtins" +#define __Pyx_DefaultClassType PyType_Type +#if CYTHON_COMPILING_IN_LIMITED_API + #ifndef CO_OPTIMIZED + static int CO_OPTIMIZED; + #endif + #ifndef CO_NEWLOCALS + static int CO_NEWLOCALS; + #endif + #ifndef CO_VARARGS + static int CO_VARARGS; + #endif + #ifndef CO_VARKEYWORDS + static int CO_VARKEYWORDS; + #endif + #ifndef CO_ASYNC_GENERATOR + static int CO_ASYNC_GENERATOR; + #endif + #ifndef CO_GENERATOR + static int CO_GENERATOR; + #endif + #ifndef CO_COROUTINE + static int CO_COROUTINE; + #endif +#else + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 + #endif +#endif +static int __Pyx_init_co_variables(void); +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif +#ifndef Py_TPFLAGS_IMMUTABLETYPE + #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) +#endif +#ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION + #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) +#endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#ifndef METH_FASTCALL + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #if PY_VERSION_HEX >= 0x030d00A4 + # define __Pyx_PyCFunctionFast PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords + #else + # define __Pyx_PyCFunctionFast _PyCFunctionFast + # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords + #endif +#endif +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX >= 0x030900B1 +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) +#else +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) +#endif +#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) +#elif !CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) +static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { + return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; +} +#endif +static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; +#else + return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +#endif +} +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) +#if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) +#elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) +#elif CYTHON_COMPILING_IN_GRAAL + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#endif +#if CYTHON_USE_MODULE_STATE +static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) +#else +#define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) +#define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) +#define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) + #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) + #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) + #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ + ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ + (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ + __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) + #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) + #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) +#endif +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) +#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) +#endif +#define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) +#if CYTHON_USE_TYPE_SPECS +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE((PyObject*)obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#else + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #else + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #endif +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif +#endif +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#elif CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) +#endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif +enum __Pyx_ReferenceSharing { + __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check + __Pyx_ReferenceSharing_OwnStrongReference, + __Pyx_ReferenceSharing_FunctionArgument, + __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar +}; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ + (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ + (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ + (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) +#elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) +#else +#define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) +#endif +#if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) + #else + #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) + #endif +#elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) + #else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) + #endif +#else + #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) +#endif +#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ + __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) +#else + #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) +#endif +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyObject_GetItem(dict, key); + if (*result == NULL) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + return 0; + } + return -1; + } + return 1; +} +#else +static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { + *result = PyDict_GetItemWithError(dict, key); + if (*result == NULL) { + return PyErr_Occurred() ? -1 : 0; + } + Py_INCREF(*result); + return 1; +} +#endif +#if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST + #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) +#else + #define __Pyx_VISIT_CONST(obj) +#endif +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) +#else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) +#endif +#if CYTHON_ASSUME_SAFE_SIZE + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) +#else + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) + #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) +#endif +#define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t +#define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t +#if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 + #define __Pyx_PySendResult PySendResult +#else + typedef enum { + PYGEN_RETURN = 0, + PYGEN_ERROR = -1, + PYGEN_NEXT = 1, + } __Pyx_PySendResult; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 + typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); +#else + #define __Pyx_pyiter_sendfunc sendfunc +#endif +#if !CYTHON_USE_AM_SEND +#define __PYX_HAS_PY_AM_SEND 0 +#elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 +#define __PYX_HAS_PY_AM_SEND 1 +#else +#define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation +#endif +#if __PYX_HAS_PY_AM_SEND < 2 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods +#else + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + __Pyx_pyiter_sendfunc am_send; + } __Pyx_PyAsyncMethodsStruct; + #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) +#endif +#if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 + #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) +#else + #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) +#endif +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() +#else +#define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 +#ifdef __cplusplus +extern "C" +#endif +PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { + int value; + PyObject *py_value = PyObject_GetAttrString(inspect, name); + if (!py_value) return 0; + value = (int) PyLong_AsLong(py_value); + Py_DECREF(py_value); + *write_to = value; + return value != -1 || !PyErr_Occurred(); +} +static int __Pyx_init_co_variables(void) { + PyObject *inspect; + int result; + inspect = PyImport_ImportModule("inspect"); + result = +#if !defined(CO_OPTIMIZED) + __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && +#endif +#if !defined(CO_NEWLOCALS) + __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && +#endif +#if !defined(CO_VARARGS) + __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && +#endif +#if !defined(CO_VARKEYWORDS) + __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && +#endif +#if !defined(CO_ASYNC_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && +#endif +#if !defined(CO_GENERATOR) + __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && +#endif +#if !defined(CO_COROUTINE) + __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && +#endif + 1; + Py_DECREF(inspect); + return result ? 0 : -1; +} +#else +static int __Pyx_init_co_variables(void) { + return 0; // It's a limited API-only feature +} +#endif + +/* MathInitCode */ +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #ifndef _USE_MATH_DEFINES + #define _USE_MATH_DEFINES + #endif +#endif +#include +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 +#endif +#ifndef CYTHON_CLINE_IN_TRACEBACK +#define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#endif +#if CYTHON_CLINE_IN_TRACEBACK +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } +#else +#define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } +#endif +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" +#endif + +#define __PYX_HAVE__spacy__vocab +#define __PYX_HAVE_API__spacy__vocab +/* Early includes */ +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include +#include +#include +#include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + +#include "numpy/arrayobject.h" +#include "numpy/ndarrayobject.h" +#include "numpy/ndarraytypes.h" +#include "numpy/arrayscalars.h" +#include "numpy/ufuncobject.h" +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include +#include +#include +#include "pythread.h" +#include +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) +#else + #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) + #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) + #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) +#endif +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) + return Py_NewRef(obj); +#else + Py_INCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) + return Py_XNewRef(obj); +#else + Py_XINCREF(obj); + return obj; +#endif +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) +#else +#define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) +#endif +#define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) +#else + #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +/* PretendToInitialize */ +#ifdef __cplusplus +#if __cplusplus > 201103L +#include +#endif +template +static void __Pyx_pretend_to_initialize(T* ptr) { +#if __cplusplus > 201103L + if ((std::is_trivially_default_constructible::value)) +#endif + *ptr = T(); + (void)ptr; +} +#else +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#endif + + +#if !CYTHON_USE_MODULE_STATE +static PyObject *__pyx_m = NULL; +#endif +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * const __pyx_cfilenm = __FILE__; +static const char *__pyx_filename; + +/* Header.proto */ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER)) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +/* #### Code section: filename_table ### */ + +static const char* const __pyx_f[] = { + "spacy/vocab.pyx", + "", + "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd", + "spacy/lexeme.pxd", + "spacy/tokens/token.pxd", + "spacy/vocab.pxd", + "cymem/cymem.pxd", + "preshed/maps.pxd", + "cpython/type.pxd", + "spacy/strings.pxd", + "spacy/morphology.pxd", + "spacy/tokens/doc.pxd", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* Atomics.proto (used by UnpackUnboundCMethod) */ +#include +#ifndef CYTHON_ATOMICS + #define CYTHON_ATOMICS 1 +#endif +#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS +#define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __pyx_atomic_int_type int +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_ptr_type atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) atomic_load(value) + #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_ptr_type std::atomic_uintptr_t + #define __pyx_nonatomic_ptr_type uintptr_t + #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) + #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #define __pyx_atomic_load(value) std::atomic_load(value) + #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) + #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) + #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) + #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ + (__GNUC_MINOR__ > 1 ||\ + (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) + #define __pyx_atomic_ptr_type void* + #define __pyx_nonatomic_ptr_type void* + #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) + #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) + #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #warning "Using GNU atomics" + #endif +#elif CYTHON_ATOMICS && defined(_MSC_VER) + #include + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type long + #define __pyx_atomic_ptr_type void* + #undef __pyx_nonatomic_int_type + #define __pyx_nonatomic_int_type long + #define __pyx_nonatomic_ptr_type void* + #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) + #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) + #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) + #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) + static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { + __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) + #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) + #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value + #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) + #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) + static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { + __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); + int result = old == *expected; + *expected = old; + return result; + } + #ifdef __PYX_DEBUG_ATOMICS + #pragma message ("Using MSVC atomics") + #endif +#else + #undef CYTHON_ATOMICS + #define CYTHON_ATOMICS 0 + #ifdef __PYX_DEBUG_ATOMICS + #warning "Not using atomics" + #endif +#endif + +/* CriticalSectionsDefinition.proto (used by CriticalSections) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection void* +#define __Pyx_PyCriticalSection2 void* +#define __Pyx_PyCriticalSection_End(cs) +#define __Pyx_PyCriticalSection2_End(cs) +#else +#define __Pyx_PyCriticalSection PyCriticalSection +#define __Pyx_PyCriticalSection2 PyCriticalSection2 +#define __Pyx_PyCriticalSection_End PyCriticalSection_End +#define __Pyx_PyCriticalSection2_End PyCriticalSection2_End +#endif + +/* CriticalSections.proto (used by ParseKeywordsImpl) */ +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs) +#define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs) +#else +#define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin +#define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin +#endif +#if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_BEGIN_CRITICAL_SECTION(o) { +#define __Pyx_END_CRITICAL_SECTION() } +#else +#define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION +#define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION +#endif + +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + +/* IncludeStructmemberH.proto (used by FixUpExtensionType) */ +#include + +/* BufferFormatStructs.proto */ +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; + const struct __Pyx_StructField_* fields; + size_t size; + size_t arraysize[8]; + int ndim; + char typegroup; + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + const __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + const __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +#define __Pyx_MEMSLICE_INIT { 0, 0, { 0 }, { 0 }, { 0 } } +#if CYTHON_ATOMICS + #define __pyx_add_acquisition_count(memview)\ + __pyx_atomic_incr_relaxed(__pyx_get_slice_count_pointer(memview)) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_atomic_decr_acq_rel(__pyx_get_slice_count_pointer(memview)) +#else + #define __pyx_add_acquisition_count(memview)\ + __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) + #define __pyx_sub_acquisition_count(memview)\ + __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) +#endif + +/* #### Code section: numeric_typedefs ### */ + +/* "preshed/maps.pxd":5 + * + * + * ctypedef uint64_t key_t # <<<<<<<<<<<<<< + * + * +*/ +typedef uint64_t __pyx_t_7preshed_4maps_key_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":743 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t +*/ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":744 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t +*/ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":745 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * +*/ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":746 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_uint8 uint8_t +*/ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":748 + * ctypedef npy_int64 int64_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t +*/ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":749 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t +*/ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":750 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * +*/ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":751 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * + * ctypedef npy_float32 float32_t +*/ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":753 + * ctypedef npy_uint64 uint64_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t +*/ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":754 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t +*/ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":761 + * ctypedef double complex complex128_t + * + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * +*/ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":762 + * + * ctypedef npy_longlong longlong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t +*/ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":764 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * +*/ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":765 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t +*/ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":767 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t +*/ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":768 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * +*/ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":769 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef float complex cfloat_t +*/ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "typedefs.pxd":3 + * from libc.stdint cimport int32_t, uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + * + * ctypedef float weight_t # <<<<<<<<<<<<<< + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t +*/ +typedef float __pyx_t_5spacy_8typedefs_weight_t; + +/* "typedefs.pxd":4 + * + * ctypedef float weight_t + * ctypedef uint64_t hash_t # <<<<<<<<<<<<<< + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_hash_t; + +/* "typedefs.pxd":5 + * ctypedef float weight_t + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t # <<<<<<<<<<<<<< + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_class_t; + +/* "typedefs.pxd":6 + * ctypedef uint64_t hash_t + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t # <<<<<<<<<<<<<< + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_attr_t; + +/* "typedefs.pxd":7 + * ctypedef uint64_t class_t + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t # <<<<<<<<<<<<<< + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t +*/ +typedef uint64_t __pyx_t_5spacy_8typedefs_flags_t; + +/* "typedefs.pxd":8 + * ctypedef uint64_t attr_t + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t # <<<<<<<<<<<<<< + * ctypedef uint16_t tag_t +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_len_t; + +/* "typedefs.pxd":9 + * ctypedef uint64_t flags_t + * ctypedef uint16_t len_t + * ctypedef uint16_t tag_t # <<<<<<<<<<<<<< +*/ +typedef uint16_t __pyx_t_5spacy_8typedefs_tag_t; +/* #### Code section: complex_type_declarations ### */ +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +/* Declarations.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + typedef ::std::complex< long double > __pyx_t_long_double_complex; + #else + typedef long double _Complex __pyx_t_long_double_complex; + #endif +#else + typedef struct { long double real, imag; } __pyx_t_long_double_complex; +#endif +static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc; +struct __pyx_obj_5cymem_5cymem_PyFree; +struct __pyx_obj_5cymem_5cymem_Pool; +struct __pyx_obj_5cymem_5cymem_Address; +struct __pyx_obj_7preshed_4maps_PreshMap; +struct __pyx_obj_7preshed_4maps_PreshMapArray; +struct __pyx_obj_5spacy_7strings_StringStore; +struct __pyx_obj_5spacy_10morphology_Morphology; +struct __pyx_obj_5spacy_6lexeme_Lexeme; +struct __pyx_obj_5spacy_6tokens_3doc_Doc; +struct __pyx_obj_5spacy_6tokens_5token_Token; +struct __pyx_obj_5spacy_5vocab_Vocab; +struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone; +struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__; +struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes; +struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes; +struct __pyx_array_obj; +struct __pyx_MemviewEnum_obj; +struct __pyx_memoryview_obj; +struct __pyx_memoryviewslice_obj; + +/* "cymem/cymem.pxd":1 + * ctypedef void* (*malloc_t)(size_t n) # <<<<<<<<<<<<<< + * ctypedef void (*free_t)(void *p) + * +*/ +typedef void *(*__pyx_t_5cymem_5cymem_malloc_t)(size_t); + +/* "cymem/cymem.pxd":2 + * ctypedef void* (*malloc_t)(size_t n) + * ctypedef void (*free_t)(void *p) # <<<<<<<<<<<<<< + * + * cdef class PyMalloc: +*/ +typedef void (*__pyx_t_5cymem_5cymem_free_t)(void *); +struct __pyx_t_7preshed_4maps_Cell; +struct __pyx_t_7preshed_4maps_Result; +struct __pyx_t_7preshed_4maps_MapStruct; + +/* "preshed/maps.pxd":8 + * + * + * cdef struct Cell: # <<<<<<<<<<<<<< + * key_t key + * void* value +*/ +struct __pyx_t_7preshed_4maps_Cell { + __pyx_t_7preshed_4maps_key_t key; + void *value; +}; + +/* "preshed/maps.pxd":13 + * + * + * cdef struct Result: # <<<<<<<<<<<<<< + * int found + * void* value +*/ +struct __pyx_t_7preshed_4maps_Result { + int found; + void *value; +}; + +/* "preshed/maps.pxd":18 + * + * + * cdef struct MapStruct: # <<<<<<<<<<<<<< + * Cell* cells + * void* value_for_empty_key +*/ +struct __pyx_t_7preshed_4maps_MapStruct { + struct __pyx_t_7preshed_4maps_Cell *cells; + void *value_for_empty_key; + void *value_for_del_key; + __pyx_t_7preshed_4maps_key_t length; + __pyx_t_7preshed_4maps_key_t filled; + int is_empty_key_set; + int is_del_key_set; +}; +union __pyx_t_5spacy_7strings_Utf8Str; +typedef union __pyx_t_5spacy_7strings_Utf8Str __pyx_t_5spacy_7strings_Utf8Str; + +/* "strings.pxd":17 + * + * + * ctypedef union Utf8Str: # <<<<<<<<<<<<<< + * unsigned char[8] s + * unsigned char* p +*/ +union __pyx_t_5spacy_7strings_Utf8Str { + unsigned char s[8]; + unsigned char *p; +}; + +/* "symbols.pxd":1 + * cdef enum symbol_t: # <<<<<<<<<<<<<< + * NIL + * IS_ALPHA +*/ +enum __pyx_t_5spacy_7symbols_symbol_t { + __pyx_e_5spacy_7symbols_NIL, + __pyx_e_5spacy_7symbols_IS_ALPHA, + __pyx_e_5spacy_7symbols_IS_ASCII, + __pyx_e_5spacy_7symbols_IS_DIGIT, + __pyx_e_5spacy_7symbols_IS_LOWER, + __pyx_e_5spacy_7symbols_IS_PUNCT, + __pyx_e_5spacy_7symbols_IS_SPACE, + __pyx_e_5spacy_7symbols_IS_TITLE, + __pyx_e_5spacy_7symbols_IS_UPPER, + __pyx_e_5spacy_7symbols_LIKE_URL, + __pyx_e_5spacy_7symbols_LIKE_NUM, + __pyx_e_5spacy_7symbols_LIKE_EMAIL, + __pyx_e_5spacy_7symbols_IS_STOP, + __pyx_e_5spacy_7symbols_IS_OOV_DEPRECATED, + __pyx_e_5spacy_7symbols_IS_BRACKET, + __pyx_e_5spacy_7symbols_IS_QUOTE, + __pyx_e_5spacy_7symbols_IS_LEFT_PUNCT, + __pyx_e_5spacy_7symbols_IS_RIGHT_PUNCT, + __pyx_e_5spacy_7symbols_IS_CURRENCY, + __pyx_e_5spacy_7symbols_FLAG19 = 19, + __pyx_e_5spacy_7symbols_FLAG20, + __pyx_e_5spacy_7symbols_FLAG21, + __pyx_e_5spacy_7symbols_FLAG22, + __pyx_e_5spacy_7symbols_FLAG23, + __pyx_e_5spacy_7symbols_FLAG24, + __pyx_e_5spacy_7symbols_FLAG25, + __pyx_e_5spacy_7symbols_FLAG26, + __pyx_e_5spacy_7symbols_FLAG27, + __pyx_e_5spacy_7symbols_FLAG28, + __pyx_e_5spacy_7symbols_FLAG29, + __pyx_e_5spacy_7symbols_FLAG30, + __pyx_e_5spacy_7symbols_FLAG31, + __pyx_e_5spacy_7symbols_FLAG32, + __pyx_e_5spacy_7symbols_FLAG33, + __pyx_e_5spacy_7symbols_FLAG34, + __pyx_e_5spacy_7symbols_FLAG35, + __pyx_e_5spacy_7symbols_FLAG36, + __pyx_e_5spacy_7symbols_FLAG37, + __pyx_e_5spacy_7symbols_FLAG38, + __pyx_e_5spacy_7symbols_FLAG39, + __pyx_e_5spacy_7symbols_FLAG40, + __pyx_e_5spacy_7symbols_FLAG41, + __pyx_e_5spacy_7symbols_FLAG42, + __pyx_e_5spacy_7symbols_FLAG43, + __pyx_e_5spacy_7symbols_FLAG44, + __pyx_e_5spacy_7symbols_FLAG45, + __pyx_e_5spacy_7symbols_FLAG46, + __pyx_e_5spacy_7symbols_FLAG47, + __pyx_e_5spacy_7symbols_FLAG48, + __pyx_e_5spacy_7symbols_FLAG49, + __pyx_e_5spacy_7symbols_FLAG50, + __pyx_e_5spacy_7symbols_FLAG51, + __pyx_e_5spacy_7symbols_FLAG52, + __pyx_e_5spacy_7symbols_FLAG53, + __pyx_e_5spacy_7symbols_FLAG54, + __pyx_e_5spacy_7symbols_FLAG55, + __pyx_e_5spacy_7symbols_FLAG56, + __pyx_e_5spacy_7symbols_FLAG57, + __pyx_e_5spacy_7symbols_FLAG58, + __pyx_e_5spacy_7symbols_FLAG59, + __pyx_e_5spacy_7symbols_FLAG60, + __pyx_e_5spacy_7symbols_FLAG61, + __pyx_e_5spacy_7symbols_FLAG62, + __pyx_e_5spacy_7symbols_FLAG63, + __pyx_e_5spacy_7symbols_ID, + __pyx_e_5spacy_7symbols_ORTH, + __pyx_e_5spacy_7symbols_LOWER, + __pyx_e_5spacy_7symbols_NORM, + __pyx_e_5spacy_7symbols_SHAPE, + __pyx_e_5spacy_7symbols_PREFIX, + __pyx_e_5spacy_7symbols_SUFFIX, + __pyx_e_5spacy_7symbols_LENGTH, + __pyx_e_5spacy_7symbols_CLUSTER, + __pyx_e_5spacy_7symbols_LEMMA, + __pyx_e_5spacy_7symbols_POS, + __pyx_e_5spacy_7symbols_TAG, + __pyx_e_5spacy_7symbols_DEP, + __pyx_e_5spacy_7symbols_ENT_IOB, + __pyx_e_5spacy_7symbols_ENT_TYPE, + __pyx_e_5spacy_7symbols_HEAD, + __pyx_e_5spacy_7symbols_SENT_START, + __pyx_e_5spacy_7symbols_SPACY, + __pyx_e_5spacy_7symbols_PROB, + __pyx_e_5spacy_7symbols_LANG, + __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_7symbols_ADP, + __pyx_e_5spacy_7symbols_ADV, + __pyx_e_5spacy_7symbols_AUX, + __pyx_e_5spacy_7symbols_CONJ, + __pyx_e_5spacy_7symbols_CCONJ, + __pyx_e_5spacy_7symbols_DET, + __pyx_e_5spacy_7symbols_INTJ, + __pyx_e_5spacy_7symbols_NOUN, + __pyx_e_5spacy_7symbols_NUM, + __pyx_e_5spacy_7symbols_PART, + __pyx_e_5spacy_7symbols_PRON, + __pyx_e_5spacy_7symbols_PROPN, + __pyx_e_5spacy_7symbols_PUNCT, + __pyx_e_5spacy_7symbols_SCONJ, + __pyx_e_5spacy_7symbols_SYM, + __pyx_e_5spacy_7symbols_VERB, + __pyx_e_5spacy_7symbols_X, + __pyx_e_5spacy_7symbols_EOL, + __pyx_e_5spacy_7symbols_SPACE, + __pyx_e_5spacy_7symbols_DEPRECATED001, + __pyx_e_5spacy_7symbols_DEPRECATED002, + __pyx_e_5spacy_7symbols_DEPRECATED003, + __pyx_e_5spacy_7symbols_DEPRECATED004, + __pyx_e_5spacy_7symbols_DEPRECATED005, + __pyx_e_5spacy_7symbols_DEPRECATED006, + __pyx_e_5spacy_7symbols_DEPRECATED007, + __pyx_e_5spacy_7symbols_DEPRECATED008, + __pyx_e_5spacy_7symbols_DEPRECATED009, + __pyx_e_5spacy_7symbols_DEPRECATED010, + __pyx_e_5spacy_7symbols_DEPRECATED011, + __pyx_e_5spacy_7symbols_DEPRECATED012, + __pyx_e_5spacy_7symbols_DEPRECATED013, + __pyx_e_5spacy_7symbols_DEPRECATED014, + __pyx_e_5spacy_7symbols_DEPRECATED015, + __pyx_e_5spacy_7symbols_DEPRECATED016, + __pyx_e_5spacy_7symbols_DEPRECATED017, + __pyx_e_5spacy_7symbols_DEPRECATED018, + __pyx_e_5spacy_7symbols_DEPRECATED019, + __pyx_e_5spacy_7symbols_DEPRECATED020, + __pyx_e_5spacy_7symbols_DEPRECATED021, + __pyx_e_5spacy_7symbols_DEPRECATED022, + __pyx_e_5spacy_7symbols_DEPRECATED023, + __pyx_e_5spacy_7symbols_DEPRECATED024, + __pyx_e_5spacy_7symbols_DEPRECATED025, + __pyx_e_5spacy_7symbols_DEPRECATED026, + __pyx_e_5spacy_7symbols_DEPRECATED027, + __pyx_e_5spacy_7symbols_DEPRECATED028, + __pyx_e_5spacy_7symbols_DEPRECATED029, + __pyx_e_5spacy_7symbols_DEPRECATED030, + __pyx_e_5spacy_7symbols_DEPRECATED031, + __pyx_e_5spacy_7symbols_DEPRECATED032, + __pyx_e_5spacy_7symbols_DEPRECATED033, + __pyx_e_5spacy_7symbols_DEPRECATED034, + __pyx_e_5spacy_7symbols_DEPRECATED035, + __pyx_e_5spacy_7symbols_DEPRECATED036, + __pyx_e_5spacy_7symbols_DEPRECATED037, + __pyx_e_5spacy_7symbols_DEPRECATED038, + __pyx_e_5spacy_7symbols_DEPRECATED039, + __pyx_e_5spacy_7symbols_DEPRECATED040, + __pyx_e_5spacy_7symbols_DEPRECATED041, + __pyx_e_5spacy_7symbols_DEPRECATED042, + __pyx_e_5spacy_7symbols_DEPRECATED043, + __pyx_e_5spacy_7symbols_DEPRECATED044, + __pyx_e_5spacy_7symbols_DEPRECATED045, + __pyx_e_5spacy_7symbols_DEPRECATED046, + __pyx_e_5spacy_7symbols_DEPRECATED047, + __pyx_e_5spacy_7symbols_DEPRECATED048, + __pyx_e_5spacy_7symbols_DEPRECATED049, + __pyx_e_5spacy_7symbols_DEPRECATED050, + __pyx_e_5spacy_7symbols_DEPRECATED051, + __pyx_e_5spacy_7symbols_DEPRECATED052, + __pyx_e_5spacy_7symbols_DEPRECATED053, + __pyx_e_5spacy_7symbols_DEPRECATED054, + __pyx_e_5spacy_7symbols_DEPRECATED055, + __pyx_e_5spacy_7symbols_DEPRECATED056, + __pyx_e_5spacy_7symbols_DEPRECATED057, + __pyx_e_5spacy_7symbols_DEPRECATED058, + __pyx_e_5spacy_7symbols_DEPRECATED059, + __pyx_e_5spacy_7symbols_DEPRECATED060, + __pyx_e_5spacy_7symbols_DEPRECATED061, + __pyx_e_5spacy_7symbols_DEPRECATED062, + __pyx_e_5spacy_7symbols_DEPRECATED063, + __pyx_e_5spacy_7symbols_DEPRECATED064, + __pyx_e_5spacy_7symbols_DEPRECATED065, + __pyx_e_5spacy_7symbols_DEPRECATED066, + __pyx_e_5spacy_7symbols_DEPRECATED067, + __pyx_e_5spacy_7symbols_DEPRECATED068, + __pyx_e_5spacy_7symbols_DEPRECATED069, + __pyx_e_5spacy_7symbols_DEPRECATED070, + __pyx_e_5spacy_7symbols_DEPRECATED071, + __pyx_e_5spacy_7symbols_DEPRECATED072, + __pyx_e_5spacy_7symbols_DEPRECATED073, + __pyx_e_5spacy_7symbols_DEPRECATED074, + __pyx_e_5spacy_7symbols_DEPRECATED075, + __pyx_e_5spacy_7symbols_DEPRECATED076, + __pyx_e_5spacy_7symbols_DEPRECATED077, + __pyx_e_5spacy_7symbols_DEPRECATED078, + __pyx_e_5spacy_7symbols_DEPRECATED079, + __pyx_e_5spacy_7symbols_DEPRECATED080, + __pyx_e_5spacy_7symbols_DEPRECATED081, + __pyx_e_5spacy_7symbols_DEPRECATED082, + __pyx_e_5spacy_7symbols_DEPRECATED083, + __pyx_e_5spacy_7symbols_DEPRECATED084, + __pyx_e_5spacy_7symbols_DEPRECATED085, + __pyx_e_5spacy_7symbols_DEPRECATED086, + __pyx_e_5spacy_7symbols_DEPRECATED087, + __pyx_e_5spacy_7symbols_DEPRECATED088, + __pyx_e_5spacy_7symbols_DEPRECATED089, + __pyx_e_5spacy_7symbols_DEPRECATED090, + __pyx_e_5spacy_7symbols_DEPRECATED091, + __pyx_e_5spacy_7symbols_DEPRECATED092, + __pyx_e_5spacy_7symbols_DEPRECATED093, + __pyx_e_5spacy_7symbols_DEPRECATED094, + __pyx_e_5spacy_7symbols_DEPRECATED095, + __pyx_e_5spacy_7symbols_DEPRECATED096, + __pyx_e_5spacy_7symbols_DEPRECATED097, + __pyx_e_5spacy_7symbols_DEPRECATED098, + __pyx_e_5spacy_7symbols_DEPRECATED099, + __pyx_e_5spacy_7symbols_DEPRECATED100, + __pyx_e_5spacy_7symbols_DEPRECATED101, + __pyx_e_5spacy_7symbols_DEPRECATED102, + __pyx_e_5spacy_7symbols_DEPRECATED103, + __pyx_e_5spacy_7symbols_DEPRECATED104, + __pyx_e_5spacy_7symbols_DEPRECATED105, + __pyx_e_5spacy_7symbols_DEPRECATED106, + __pyx_e_5spacy_7symbols_DEPRECATED107, + __pyx_e_5spacy_7symbols_DEPRECATED108, + __pyx_e_5spacy_7symbols_DEPRECATED109, + __pyx_e_5spacy_7symbols_DEPRECATED110, + __pyx_e_5spacy_7symbols_DEPRECATED111, + __pyx_e_5spacy_7symbols_DEPRECATED112, + __pyx_e_5spacy_7symbols_DEPRECATED113, + __pyx_e_5spacy_7symbols_DEPRECATED114, + __pyx_e_5spacy_7symbols_DEPRECATED115, + __pyx_e_5spacy_7symbols_DEPRECATED116, + __pyx_e_5spacy_7symbols_DEPRECATED117, + __pyx_e_5spacy_7symbols_DEPRECATED118, + __pyx_e_5spacy_7symbols_DEPRECATED119, + __pyx_e_5spacy_7symbols_DEPRECATED120, + __pyx_e_5spacy_7symbols_DEPRECATED121, + __pyx_e_5spacy_7symbols_DEPRECATED122, + __pyx_e_5spacy_7symbols_DEPRECATED123, + __pyx_e_5spacy_7symbols_DEPRECATED124, + __pyx_e_5spacy_7symbols_DEPRECATED125, + __pyx_e_5spacy_7symbols_DEPRECATED126, + __pyx_e_5spacy_7symbols_DEPRECATED127, + __pyx_e_5spacy_7symbols_DEPRECATED128, + __pyx_e_5spacy_7symbols_DEPRECATED129, + __pyx_e_5spacy_7symbols_DEPRECATED130, + __pyx_e_5spacy_7symbols_DEPRECATED131, + __pyx_e_5spacy_7symbols_DEPRECATED132, + __pyx_e_5spacy_7symbols_DEPRECATED133, + __pyx_e_5spacy_7symbols_DEPRECATED134, + __pyx_e_5spacy_7symbols_DEPRECATED135, + __pyx_e_5spacy_7symbols_DEPRECATED136, + __pyx_e_5spacy_7symbols_DEPRECATED137, + __pyx_e_5spacy_7symbols_DEPRECATED138, + __pyx_e_5spacy_7symbols_DEPRECATED139, + __pyx_e_5spacy_7symbols_DEPRECATED140, + __pyx_e_5spacy_7symbols_DEPRECATED141, + __pyx_e_5spacy_7symbols_DEPRECATED142, + __pyx_e_5spacy_7symbols_DEPRECATED143, + __pyx_e_5spacy_7symbols_DEPRECATED144, + __pyx_e_5spacy_7symbols_DEPRECATED145, + __pyx_e_5spacy_7symbols_DEPRECATED146, + __pyx_e_5spacy_7symbols_DEPRECATED147, + __pyx_e_5spacy_7symbols_DEPRECATED148, + __pyx_e_5spacy_7symbols_DEPRECATED149, + __pyx_e_5spacy_7symbols_DEPRECATED150, + __pyx_e_5spacy_7symbols_DEPRECATED151, + __pyx_e_5spacy_7symbols_DEPRECATED152, + __pyx_e_5spacy_7symbols_DEPRECATED153, + __pyx_e_5spacy_7symbols_DEPRECATED154, + __pyx_e_5spacy_7symbols_DEPRECATED155, + __pyx_e_5spacy_7symbols_DEPRECATED156, + __pyx_e_5spacy_7symbols_DEPRECATED157, + __pyx_e_5spacy_7symbols_DEPRECATED158, + __pyx_e_5spacy_7symbols_DEPRECATED159, + __pyx_e_5spacy_7symbols_DEPRECATED160, + __pyx_e_5spacy_7symbols_DEPRECATED161, + __pyx_e_5spacy_7symbols_DEPRECATED162, + __pyx_e_5spacy_7symbols_DEPRECATED163, + __pyx_e_5spacy_7symbols_DEPRECATED164, + __pyx_e_5spacy_7symbols_DEPRECATED165, + __pyx_e_5spacy_7symbols_DEPRECATED166, + __pyx_e_5spacy_7symbols_DEPRECATED167, + __pyx_e_5spacy_7symbols_DEPRECATED168, + __pyx_e_5spacy_7symbols_DEPRECATED169, + __pyx_e_5spacy_7symbols_DEPRECATED170, + __pyx_e_5spacy_7symbols_DEPRECATED171, + __pyx_e_5spacy_7symbols_DEPRECATED172, + __pyx_e_5spacy_7symbols_DEPRECATED173, + __pyx_e_5spacy_7symbols_DEPRECATED174, + __pyx_e_5spacy_7symbols_DEPRECATED175, + __pyx_e_5spacy_7symbols_DEPRECATED176, + __pyx_e_5spacy_7symbols_DEPRECATED177, + __pyx_e_5spacy_7symbols_DEPRECATED178, + __pyx_e_5spacy_7symbols_DEPRECATED179, + __pyx_e_5spacy_7symbols_DEPRECATED180, + __pyx_e_5spacy_7symbols_DEPRECATED181, + __pyx_e_5spacy_7symbols_DEPRECATED182, + __pyx_e_5spacy_7symbols_DEPRECATED183, + __pyx_e_5spacy_7symbols_DEPRECATED184, + __pyx_e_5spacy_7symbols_DEPRECATED185, + __pyx_e_5spacy_7symbols_DEPRECATED186, + __pyx_e_5spacy_7symbols_DEPRECATED187, + __pyx_e_5spacy_7symbols_DEPRECATED188, + __pyx_e_5spacy_7symbols_DEPRECATED189, + __pyx_e_5spacy_7symbols_DEPRECATED190, + __pyx_e_5spacy_7symbols_DEPRECATED191, + __pyx_e_5spacy_7symbols_DEPRECATED192, + __pyx_e_5spacy_7symbols_DEPRECATED193, + __pyx_e_5spacy_7symbols_DEPRECATED194, + __pyx_e_5spacy_7symbols_DEPRECATED195, + __pyx_e_5spacy_7symbols_DEPRECATED196, + __pyx_e_5spacy_7symbols_DEPRECATED197, + __pyx_e_5spacy_7symbols_DEPRECATED198, + __pyx_e_5spacy_7symbols_DEPRECATED199, + __pyx_e_5spacy_7symbols_DEPRECATED200, + __pyx_e_5spacy_7symbols_DEPRECATED201, + __pyx_e_5spacy_7symbols_DEPRECATED202, + __pyx_e_5spacy_7symbols_DEPRECATED203, + __pyx_e_5spacy_7symbols_DEPRECATED204, + __pyx_e_5spacy_7symbols_DEPRECATED205, + __pyx_e_5spacy_7symbols_DEPRECATED206, + __pyx_e_5spacy_7symbols_DEPRECATED207, + __pyx_e_5spacy_7symbols_DEPRECATED208, + __pyx_e_5spacy_7symbols_DEPRECATED209, + __pyx_e_5spacy_7symbols_DEPRECATED210, + __pyx_e_5spacy_7symbols_DEPRECATED211, + __pyx_e_5spacy_7symbols_DEPRECATED212, + __pyx_e_5spacy_7symbols_DEPRECATED213, + __pyx_e_5spacy_7symbols_DEPRECATED214, + __pyx_e_5spacy_7symbols_DEPRECATED215, + __pyx_e_5spacy_7symbols_DEPRECATED216, + __pyx_e_5spacy_7symbols_DEPRECATED217, + __pyx_e_5spacy_7symbols_DEPRECATED218, + __pyx_e_5spacy_7symbols_DEPRECATED219, + __pyx_e_5spacy_7symbols_DEPRECATED220, + __pyx_e_5spacy_7symbols_DEPRECATED221, + __pyx_e_5spacy_7symbols_DEPRECATED222, + __pyx_e_5spacy_7symbols_DEPRECATED223, + __pyx_e_5spacy_7symbols_DEPRECATED224, + __pyx_e_5spacy_7symbols_DEPRECATED225, + __pyx_e_5spacy_7symbols_DEPRECATED226, + __pyx_e_5spacy_7symbols_DEPRECATED227, + __pyx_e_5spacy_7symbols_DEPRECATED228, + __pyx_e_5spacy_7symbols_DEPRECATED229, + __pyx_e_5spacy_7symbols_DEPRECATED230, + __pyx_e_5spacy_7symbols_DEPRECATED231, + __pyx_e_5spacy_7symbols_DEPRECATED232, + __pyx_e_5spacy_7symbols_DEPRECATED233, + __pyx_e_5spacy_7symbols_DEPRECATED234, + __pyx_e_5spacy_7symbols_DEPRECATED235, + __pyx_e_5spacy_7symbols_DEPRECATED236, + __pyx_e_5spacy_7symbols_DEPRECATED237, + __pyx_e_5spacy_7symbols_DEPRECATED238, + __pyx_e_5spacy_7symbols_DEPRECATED239, + __pyx_e_5spacy_7symbols_DEPRECATED240, + __pyx_e_5spacy_7symbols_DEPRECATED241, + __pyx_e_5spacy_7symbols_DEPRECATED242, + __pyx_e_5spacy_7symbols_DEPRECATED243, + __pyx_e_5spacy_7symbols_DEPRECATED244, + __pyx_e_5spacy_7symbols_DEPRECATED245, + __pyx_e_5spacy_7symbols_DEPRECATED246, + __pyx_e_5spacy_7symbols_DEPRECATED247, + __pyx_e_5spacy_7symbols_DEPRECATED248, + __pyx_e_5spacy_7symbols_DEPRECATED249, + __pyx_e_5spacy_7symbols_DEPRECATED250, + __pyx_e_5spacy_7symbols_DEPRECATED251, + __pyx_e_5spacy_7symbols_DEPRECATED252, + __pyx_e_5spacy_7symbols_DEPRECATED253, + __pyx_e_5spacy_7symbols_DEPRECATED254, + __pyx_e_5spacy_7symbols_DEPRECATED255, + __pyx_e_5spacy_7symbols_DEPRECATED256, + __pyx_e_5spacy_7symbols_DEPRECATED257, + __pyx_e_5spacy_7symbols_DEPRECATED258, + __pyx_e_5spacy_7symbols_DEPRECATED259, + __pyx_e_5spacy_7symbols_DEPRECATED260, + __pyx_e_5spacy_7symbols_DEPRECATED261, + __pyx_e_5spacy_7symbols_DEPRECATED262, + __pyx_e_5spacy_7symbols_DEPRECATED263, + __pyx_e_5spacy_7symbols_DEPRECATED264, + __pyx_e_5spacy_7symbols_DEPRECATED265, + __pyx_e_5spacy_7symbols_DEPRECATED266, + __pyx_e_5spacy_7symbols_DEPRECATED267, + __pyx_e_5spacy_7symbols_DEPRECATED268, + __pyx_e_5spacy_7symbols_DEPRECATED269, + __pyx_e_5spacy_7symbols_DEPRECATED270, + __pyx_e_5spacy_7symbols_DEPRECATED271, + __pyx_e_5spacy_7symbols_DEPRECATED272, + __pyx_e_5spacy_7symbols_DEPRECATED273, + __pyx_e_5spacy_7symbols_DEPRECATED274, + __pyx_e_5spacy_7symbols_DEPRECATED275, + __pyx_e_5spacy_7symbols_DEPRECATED276, + __pyx_e_5spacy_7symbols_PERSON, + __pyx_e_5spacy_7symbols_NORP, + __pyx_e_5spacy_7symbols_FACILITY, + __pyx_e_5spacy_7symbols_ORG, + __pyx_e_5spacy_7symbols_GPE, + __pyx_e_5spacy_7symbols_LOC, + __pyx_e_5spacy_7symbols_PRODUCT, + __pyx_e_5spacy_7symbols_EVENT, + __pyx_e_5spacy_7symbols_WORK_OF_ART, + __pyx_e_5spacy_7symbols_LANGUAGE, + __pyx_e_5spacy_7symbols_LAW, + __pyx_e_5spacy_7symbols_DATE, + __pyx_e_5spacy_7symbols_TIME, + __pyx_e_5spacy_7symbols_PERCENT, + __pyx_e_5spacy_7symbols_MONEY, + __pyx_e_5spacy_7symbols_QUANTITY, + __pyx_e_5spacy_7symbols_ORDINAL, + __pyx_e_5spacy_7symbols_CARDINAL, + __pyx_e_5spacy_7symbols_acomp, + __pyx_e_5spacy_7symbols_advcl, + __pyx_e_5spacy_7symbols_advmod, + __pyx_e_5spacy_7symbols_agent, + __pyx_e_5spacy_7symbols_amod, + __pyx_e_5spacy_7symbols_appos, + __pyx_e_5spacy_7symbols_attr, + __pyx_e_5spacy_7symbols_aux, + __pyx_e_5spacy_7symbols_auxpass, + __pyx_e_5spacy_7symbols_cc, + __pyx_e_5spacy_7symbols_ccomp, + __pyx_e_5spacy_7symbols_complm, + __pyx_e_5spacy_7symbols_conj, + __pyx_e_5spacy_7symbols_cop, + __pyx_e_5spacy_7symbols_csubj, + __pyx_e_5spacy_7symbols_csubjpass, + __pyx_e_5spacy_7symbols_dep, + __pyx_e_5spacy_7symbols_det, + __pyx_e_5spacy_7symbols_dobj, + __pyx_e_5spacy_7symbols_expl, + __pyx_e_5spacy_7symbols_hmod, + __pyx_e_5spacy_7symbols_hyph, + __pyx_e_5spacy_7symbols_infmod, + __pyx_e_5spacy_7symbols_intj, + __pyx_e_5spacy_7symbols_iobj, + __pyx_e_5spacy_7symbols_mark, + __pyx_e_5spacy_7symbols_meta, + __pyx_e_5spacy_7symbols_neg, + __pyx_e_5spacy_7symbols_nmod, + __pyx_e_5spacy_7symbols_nn, + __pyx_e_5spacy_7symbols_npadvmod, + __pyx_e_5spacy_7symbols_nsubj, + __pyx_e_5spacy_7symbols_nsubjpass, + __pyx_e_5spacy_7symbols_num, + __pyx_e_5spacy_7symbols_number, + __pyx_e_5spacy_7symbols_oprd, + __pyx_e_5spacy_7symbols_obj, + __pyx_e_5spacy_7symbols_obl, + __pyx_e_5spacy_7symbols_parataxis, + __pyx_e_5spacy_7symbols_partmod, + __pyx_e_5spacy_7symbols_pcomp, + __pyx_e_5spacy_7symbols_pobj, + __pyx_e_5spacy_7symbols_poss, + __pyx_e_5spacy_7symbols_possessive, + __pyx_e_5spacy_7symbols_preconj, + __pyx_e_5spacy_7symbols_prep, + __pyx_e_5spacy_7symbols_prt, + __pyx_e_5spacy_7symbols_punct, + __pyx_e_5spacy_7symbols_quantmod, + __pyx_e_5spacy_7symbols_relcl, + __pyx_e_5spacy_7symbols_rcmod, + __pyx_e_5spacy_7symbols_root, + __pyx_e_5spacy_7symbols_xcomp, + __pyx_e_5spacy_7symbols_acl, + __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_7symbols_MORPH, + __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_7symbols_IDX, + __pyx_e_5spacy_7symbols__ +}; + +/* "parts_of_speech.pxd":4 + * + * + * cpdef enum univ_pos_t: # <<<<<<<<<<<<<< + * NO_TAG = 0 + * ADJ = symbols.ADJ +*/ +enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t { + + /* "parts_of_speech.pxd":6 + * cpdef enum univ_pos_t: + * NO_TAG = 0 + * ADJ = symbols.ADJ # <<<<<<<<<<<<<< + * ADP + * ADV +*/ + __pyx_e_5spacy_15parts_of_speech_NO_TAG = 0, + __pyx_e_5spacy_15parts_of_speech_ADJ = __pyx_e_5spacy_7symbols_ADJ, + __pyx_e_5spacy_15parts_of_speech_ADP, + __pyx_e_5spacy_15parts_of_speech_ADV, + __pyx_e_5spacy_15parts_of_speech_AUX, + __pyx_e_5spacy_15parts_of_speech_CONJ, + __pyx_e_5spacy_15parts_of_speech_CCONJ, + __pyx_e_5spacy_15parts_of_speech_DET, + __pyx_e_5spacy_15parts_of_speech_INTJ, + __pyx_e_5spacy_15parts_of_speech_NOUN, + __pyx_e_5spacy_15parts_of_speech_NUM, + __pyx_e_5spacy_15parts_of_speech_PART, + __pyx_e_5spacy_15parts_of_speech_PRON, + __pyx_e_5spacy_15parts_of_speech_PROPN, + __pyx_e_5spacy_15parts_of_speech_PUNCT, + __pyx_e_5spacy_15parts_of_speech_SCONJ, + __pyx_e_5spacy_15parts_of_speech_SYM, + __pyx_e_5spacy_15parts_of_speech_VERB, + __pyx_e_5spacy_15parts_of_speech_X, + __pyx_e_5spacy_15parts_of_speech_EOL, + __pyx_e_5spacy_15parts_of_speech_SPACE +}; +struct __pyx_t_5spacy_7structs_LexemeC; +struct __pyx_t_5spacy_7structs_SpanC; +struct __pyx_t_5spacy_7structs_TokenC; +struct __pyx_t_5spacy_7structs_MorphAnalysisC; +struct __pyx_t_5spacy_7structs_KBEntryC; +struct __pyx_t_5spacy_7structs_AliasC; +struct __pyx_t_5spacy_7structs_EdgeC; +struct __pyx_t_5spacy_7structs_GraphC; + +/* "structs.pxd":10 + * + * + * cdef struct LexemeC: # <<<<<<<<<<<<<< + * flags_t flags + * +*/ +struct __pyx_t_5spacy_7structs_LexemeC { + __pyx_t_5spacy_8typedefs_flags_t flags; + __pyx_t_5spacy_8typedefs_attr_t lang; + __pyx_t_5spacy_8typedefs_attr_t id; + __pyx_t_5spacy_8typedefs_attr_t length; + __pyx_t_5spacy_8typedefs_attr_t orth; + __pyx_t_5spacy_8typedefs_attr_t lower; + __pyx_t_5spacy_8typedefs_attr_t norm; + __pyx_t_5spacy_8typedefs_attr_t shape; + __pyx_t_5spacy_8typedefs_attr_t prefix; + __pyx_t_5spacy_8typedefs_attr_t suffix; +}; + +/* "structs.pxd":26 + * + * + * cdef struct SpanC: # <<<<<<<<<<<<<< + * hash_t id + * int start +*/ +struct __pyx_t_5spacy_7structs_SpanC { + __pyx_t_5spacy_8typedefs_hash_t id; + int start; + int end; + int start_char; + int end_char; + __pyx_t_5spacy_8typedefs_attr_t label; + __pyx_t_5spacy_8typedefs_attr_t kb_id; +}; + +/* "structs.pxd":36 + * + * + * cdef struct TokenC: # <<<<<<<<<<<<<< + * const LexemeC* lex + * uint64_t morph +*/ +struct __pyx_t_5spacy_7structs_TokenC { + struct __pyx_t_5spacy_7structs_LexemeC const *lex; + uint64_t morph; + enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t pos; + int spacy; + __pyx_t_5spacy_8typedefs_attr_t tag; + int idx; + __pyx_t_5spacy_8typedefs_attr_t lemma; + __pyx_t_5spacy_8typedefs_attr_t norm; + int head; + __pyx_t_5spacy_8typedefs_attr_t dep; + uint32_t l_kids; + uint32_t r_kids; + uint32_t l_edge; + uint32_t r_edge; + int sent_start; + int ent_iob; + __pyx_t_5spacy_8typedefs_attr_t ent_type; + __pyx_t_5spacy_8typedefs_attr_t ent_kb_id; + __pyx_t_5spacy_8typedefs_hash_t ent_id; +}; + +/* "structs.pxd":60 + * + * + * cdef struct MorphAnalysisC: # <<<<<<<<<<<<<< + * hash_t key + * int length +*/ +struct __pyx_t_5spacy_7structs_MorphAnalysisC { + __pyx_t_5spacy_8typedefs_hash_t key; + int length; + __pyx_t_5spacy_8typedefs_attr_t *fields; + __pyx_t_5spacy_8typedefs_attr_t *features; +}; + +/* "structs.pxd":69 + * + * # Internal struct, for storage and disambiguation of entities. + * cdef struct KBEntryC: # <<<<<<<<<<<<<< + * + * # The hash of this entry's unique ID/name in the kB +*/ +struct __pyx_t_5spacy_7structs_KBEntryC { + __pyx_t_5spacy_8typedefs_hash_t entity_hash; + int32_t vector_index; + int32_t feats_row; + float freq; +}; + +/* "structs.pxd":88 + * # Each alias struct stores a list of Entry pointers with their prior probabilities + * # for this specific mention/alias. + * cdef struct AliasC: # <<<<<<<<<<<<<< + * + * # All entry candidates for this alias +*/ +struct __pyx_t_5spacy_7structs_AliasC { + std::vector entry_indices; + std::vector probs; +}; + +/* "structs.pxd":97 + * + * + * cdef struct EdgeC: # <<<<<<<<<<<<<< + * hash_t label + * int32_t head +*/ +struct __pyx_t_5spacy_7structs_EdgeC { + __pyx_t_5spacy_8typedefs_hash_t label; + int32_t head; + int32_t tail; +}; + +/* "structs.pxd":103 + * + * + * cdef struct GraphC: # <<<<<<<<<<<<<< + * vector[vector[int32_t]] nodes + * vector[EdgeC] edges +*/ +struct __pyx_t_5spacy_7structs_GraphC { + std::vector > nodes; + std::vector edges; + std::vector weights; + std::vector n_heads; + std::vector n_tails; + std::vector first_head; + std::vector first_tail; + std::unordered_set *roots; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *node_map; + std::unordered_map<__pyx_t_5spacy_8typedefs_hash_t,int> *edge_map; +}; + +/* "attrs.pxd":5 + * + * + * cdef enum attr_id_t: # <<<<<<<<<<<<<< + * NULL_ATTR + * IS_ALPHA +*/ +enum __pyx_t_5spacy_5attrs_attr_id_t { + + /* "attrs.pxd":96 + * ENT_KB_ID = symbols.ENT_KB_ID + * MORPH + * ENT_ID = symbols.ENT_ID # <<<<<<<<<<<<<< + * + * IDX +*/ + __pyx_e_5spacy_5attrs_NULL_ATTR, + __pyx_e_5spacy_5attrs_IS_ALPHA, + __pyx_e_5spacy_5attrs_IS_ASCII, + __pyx_e_5spacy_5attrs_IS_DIGIT, + __pyx_e_5spacy_5attrs_IS_LOWER, + __pyx_e_5spacy_5attrs_IS_PUNCT, + __pyx_e_5spacy_5attrs_IS_SPACE, + __pyx_e_5spacy_5attrs_IS_TITLE, + __pyx_e_5spacy_5attrs_IS_UPPER, + __pyx_e_5spacy_5attrs_LIKE_URL, + __pyx_e_5spacy_5attrs_LIKE_NUM, + __pyx_e_5spacy_5attrs_LIKE_EMAIL, + __pyx_e_5spacy_5attrs_IS_STOP, + __pyx_e_5spacy_5attrs_IS_OOV_DEPRECATED, + __pyx_e_5spacy_5attrs_IS_BRACKET, + __pyx_e_5spacy_5attrs_IS_QUOTE, + __pyx_e_5spacy_5attrs_IS_LEFT_PUNCT, + __pyx_e_5spacy_5attrs_IS_RIGHT_PUNCT, + __pyx_e_5spacy_5attrs_IS_CURRENCY, + __pyx_e_5spacy_5attrs_FLAG19 = 19, + __pyx_e_5spacy_5attrs_FLAG20, + __pyx_e_5spacy_5attrs_FLAG21, + __pyx_e_5spacy_5attrs_FLAG22, + __pyx_e_5spacy_5attrs_FLAG23, + __pyx_e_5spacy_5attrs_FLAG24, + __pyx_e_5spacy_5attrs_FLAG25, + __pyx_e_5spacy_5attrs_FLAG26, + __pyx_e_5spacy_5attrs_FLAG27, + __pyx_e_5spacy_5attrs_FLAG28, + __pyx_e_5spacy_5attrs_FLAG29, + __pyx_e_5spacy_5attrs_FLAG30, + __pyx_e_5spacy_5attrs_FLAG31, + __pyx_e_5spacy_5attrs_FLAG32, + __pyx_e_5spacy_5attrs_FLAG33, + __pyx_e_5spacy_5attrs_FLAG34, + __pyx_e_5spacy_5attrs_FLAG35, + __pyx_e_5spacy_5attrs_FLAG36, + __pyx_e_5spacy_5attrs_FLAG37, + __pyx_e_5spacy_5attrs_FLAG38, + __pyx_e_5spacy_5attrs_FLAG39, + __pyx_e_5spacy_5attrs_FLAG40, + __pyx_e_5spacy_5attrs_FLAG41, + __pyx_e_5spacy_5attrs_FLAG42, + __pyx_e_5spacy_5attrs_FLAG43, + __pyx_e_5spacy_5attrs_FLAG44, + __pyx_e_5spacy_5attrs_FLAG45, + __pyx_e_5spacy_5attrs_FLAG46, + __pyx_e_5spacy_5attrs_FLAG47, + __pyx_e_5spacy_5attrs_FLAG48, + __pyx_e_5spacy_5attrs_FLAG49, + __pyx_e_5spacy_5attrs_FLAG50, + __pyx_e_5spacy_5attrs_FLAG51, + __pyx_e_5spacy_5attrs_FLAG52, + __pyx_e_5spacy_5attrs_FLAG53, + __pyx_e_5spacy_5attrs_FLAG54, + __pyx_e_5spacy_5attrs_FLAG55, + __pyx_e_5spacy_5attrs_FLAG56, + __pyx_e_5spacy_5attrs_FLAG57, + __pyx_e_5spacy_5attrs_FLAG58, + __pyx_e_5spacy_5attrs_FLAG59, + __pyx_e_5spacy_5attrs_FLAG60, + __pyx_e_5spacy_5attrs_FLAG61, + __pyx_e_5spacy_5attrs_FLAG62, + __pyx_e_5spacy_5attrs_FLAG63, + __pyx_e_5spacy_5attrs_ID, + __pyx_e_5spacy_5attrs_ORTH, + __pyx_e_5spacy_5attrs_LOWER, + __pyx_e_5spacy_5attrs_NORM, + __pyx_e_5spacy_5attrs_SHAPE, + __pyx_e_5spacy_5attrs_PREFIX, + __pyx_e_5spacy_5attrs_SUFFIX, + __pyx_e_5spacy_5attrs_LENGTH, + __pyx_e_5spacy_5attrs_CLUSTER, + __pyx_e_5spacy_5attrs_LEMMA, + __pyx_e_5spacy_5attrs_POS, + __pyx_e_5spacy_5attrs_TAG, + __pyx_e_5spacy_5attrs_DEP, + __pyx_e_5spacy_5attrs_ENT_IOB, + __pyx_e_5spacy_5attrs_ENT_TYPE, + __pyx_e_5spacy_5attrs_HEAD, + __pyx_e_5spacy_5attrs_SENT_START, + __pyx_e_5spacy_5attrs_SPACY, + __pyx_e_5spacy_5attrs_PROB, + __pyx_e_5spacy_5attrs_LANG, + __pyx_e_5spacy_5attrs_ENT_KB_ID = __pyx_e_5spacy_7symbols_ENT_KB_ID, + __pyx_e_5spacy_5attrs_MORPH, + __pyx_e_5spacy_5attrs_ENT_ID = __pyx_e_5spacy_7symbols_ENT_ID, + __pyx_e_5spacy_5attrs_IDX, + __pyx_e_5spacy_5attrs_SENT_END +}; + +/* "doc.pxd":14 + * + * + * ctypedef const LexemeC* const_Lexeme_ptr # <<<<<<<<<<<<<< + * ctypedef const TokenC* const_TokenC_ptr + * +*/ +typedef struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr; + +/* "doc.pxd":15 + * + * ctypedef const LexemeC* const_Lexeme_ptr + * ctypedef const TokenC* const_TokenC_ptr # <<<<<<<<<<<<<< + * + * ctypedef fused LexemeOrToken: +*/ +typedef struct __pyx_t_5spacy_7structs_TokenC const *__pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr; +union __pyx_t_5spacy_5vocab_LexemesOrTokens; +struct __pyx_t_5spacy_5vocab__Cached; + +/* "spacy/vocab.pxd":15 + * + * + * cdef union LexemesOrTokens: # <<<<<<<<<<<<<< + * const LexemeC* const* lexemes + * const TokenC* tokens +*/ +union __pyx_t_5spacy_5vocab_LexemesOrTokens { + struct __pyx_t_5spacy_7structs_LexemeC const *const *lexemes; + struct __pyx_t_5spacy_7structs_TokenC const *tokens; +}; + +/* "spacy/vocab.pxd":20 + * + * + * cdef struct _Cached: # <<<<<<<<<<<<<< + * LexemesOrTokens data + * bint is_lex +*/ +struct __pyx_t_5spacy_5vocab__Cached { + union __pyx_t_5spacy_5vocab_LexemesOrTokens data; + int is_lex; + int length; +}; + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ +struct __pyx_obj_5cymem_5cymem_PyMalloc { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtab; + __pyx_t_5cymem_5cymem_malloc_t malloc; +}; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ +struct __pyx_obj_5cymem_5cymem_PyFree { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtab; + __pyx_t_5cymem_5cymem_free_t free; +}; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ +struct __pyx_obj_5cymem_5cymem_Pool { + PyObject_HEAD + struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtab; + size_t size; + PyObject *addresses; + PyObject *refs; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "cymem/cymem.pxd":28 + * + * + * cdef class Address: # <<<<<<<<<<<<<< + * cdef void* ptr + * cdef readonly PyMalloc pymalloc +*/ +struct __pyx_obj_5cymem_5cymem_Address { + PyObject_HEAD + void *ptr; + struct __pyx_obj_5cymem_5cymem_PyMalloc *pymalloc; + struct __pyx_obj_5cymem_5cymem_PyFree *pyfree; +}; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ +struct __pyx_obj_7preshed_4maps_PreshMap { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtab; + struct __pyx_t_7preshed_4maps_MapStruct *c_map; + struct __pyx_obj_5cymem_5cymem_Pool *mem; +}; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ +struct __pyx_obj_7preshed_4maps_PreshMapArray { + PyObject_HEAD + struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_t_7preshed_4maps_MapStruct *maps; + size_t length; +}; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ +struct __pyx_obj_5spacy_7strings_StringStore { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> keys; + struct __pyx_obj_7preshed_4maps_PreshMap *_map; + std::vector<__pyx_t_5spacy_8typedefs_hash_t> _transient_keys; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; +}; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_10morphology_Morphology { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_7preshed_4maps_PreshMap *tags; +}; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6lexeme_Lexeme { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtab; + struct __pyx_t_5spacy_7structs_LexemeC *c; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + __pyx_t_5spacy_8typedefs_attr_t orth; +}; + + +/* "doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ +struct __pyx_obj_5spacy_6tokens_3doc_Doc { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + PyObject *_vector; + PyObject *_vector_norm; + PyObject *tensor; + PyObject *cats; + PyObject *user_data; + PyObject *spans; + struct __pyx_t_5spacy_7structs_TokenC *c; + float sentiment; + PyObject *user_hooks; + PyObject *user_token_hooks; + PyObject *user_span_hooks; + int has_unknown_spaces; + PyObject *_context; + int length; + int max_length; + PyObject *noun_chunks_iterator; + PyObject *__weakref__; +}; + + +/* "tokens/token.pxd":16 + * cdef const int MISSING_DEP = 0 + * + * cdef class Token: # <<<<<<<<<<<<<< + * cdef readonly Vocab vocab + * cdef TokenC* c +*/ +struct __pyx_obj_5spacy_6tokens_5token_Token { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_6tokens_5token_Token *__pyx_vtab; + struct __pyx_obj_5spacy_5vocab_Vocab *vocab; + struct __pyx_t_5spacy_7structs_TokenC *c; + int i; + struct __pyx_obj_5spacy_6tokens_3doc_Doc *doc; +}; + + +/* "spacy/vocab.pxd":26 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef readonly StringStore strings +*/ +struct __pyx_obj_5spacy_5vocab_Vocab { + PyObject_HEAD + struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtab; + struct __pyx_obj_5cymem_5cymem_Pool *mem; + struct __pyx_obj_5spacy_7strings_StringStore *strings; + struct __pyx_obj_5spacy_10morphology_Morphology *morphology; + PyObject *_vectors; + PyObject *_lookups; + PyObject *writing_system; + PyObject *get_noun_chunks; + int length; + PyObject *_unused_object; + PyObject *lex_attr_getters; + PyObject *cfg; + struct __pyx_obj_7preshed_4maps_PreshMap *_by_orth; + struct __pyx_obj_5cymem_5cymem_Pool *_non_temp_mem; + std::vector<__pyx_t_5spacy_8typedefs_attr_t> _transient_orths; +}; + + +/* "spacy/vocab.pyx":130 + * return self.length + * + * @contextmanager # <<<<<<<<<<<<<< + * def memory_zone(self, mem: Optional[Pool] = None) -> Iterator[Pool]: + * """Begin a block where resources allocated during the block will +*/ +struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone { + PyObject_HEAD + PyObject *__pyx_v_contexts; + PyObject *__pyx_v_mem; + struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self; + PyObject *__pyx_v_stack; + PyObject *__pyx_t_0; + PyObject *__pyx_t_1; + PyObject *__pyx_t_2; + PyObject *__pyx_t_3; +}; + + +/* "spacy/vocab.pyx":274 + * return lex is not NULL + * + * def __iter__(self): # <<<<<<<<<<<<<< + * """Iterate over the lexemes in the vocabulary. + * +*/ +struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__ { + PyObject_HEAD + size_t __pyx_v_addr; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_key; + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_lex; + struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "spacy/vocab.pyx":564 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ +struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes { + PyObject_HEAD + struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self; +}; + + +/* "spacy/vocab.pyx":585 + * return util.to_bytes(getters, exclude) + * + * def from_bytes(self, bytes_data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ +struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes { + PyObject_HEAD + struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self; + PyObject *__pyx_v_serialize_vectors; +}; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ +struct __pyx_array_obj { + PyObject_HEAD + struct __pyx_vtabstruct_array *__pyx_vtab; + char *data; + Py_ssize_t len; + char *format; + int ndim; + Py_ssize_t *_shape; + Py_ssize_t *_strides; + Py_ssize_t itemsize; + PyObject *mode; + PyObject *_format; + void (*callback_free_data)(void *); + int free_data; + int dtype_is_object; +}; + + +/* "View.MemoryView":299 + * + * + * @cname('__pyx_MemviewEnum') # <<<<<<<<<<<<<< + * cdef class Enum(object): + * cdef object name +*/ +struct __pyx_MemviewEnum_obj { + PyObject_HEAD + PyObject *name; +}; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ +struct __pyx_memoryview_obj { + PyObject_HEAD + struct __pyx_vtabstruct_memoryview *__pyx_vtab; + PyObject *obj; + PyObject *_size; + void *_unused; + PyThread_type_lock lock; + __pyx_atomic_int_type acquisition_count; + Py_buffer view; + int flags; + int dtype_is_object; + __Pyx_TypeInfo const *typeinfo; +}; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ +struct __pyx_memoryviewslice_obj { + struct __pyx_memoryview_obj __pyx_base; + __Pyx_memviewslice from_slice; + PyObject *from_object; + PyObject *(*to_object_func)(char *); + int (*to_dtype_func)(char *, PyObject *); +}; + + + +/* "cymem/cymem.pxd":4 + * ctypedef void (*free_t)(void *p) + * + * cdef class PyMalloc: # <<<<<<<<<<<<<< + * cdef malloc_t malloc + * cdef void _set(self, malloc_t malloc) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyMalloc *, __pyx_t_5cymem_5cymem_malloc_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc *__pyx_vtabptr_5cymem_5cymem_PyMalloc; + + +/* "cymem/cymem.pxd":10 + * cdef PyMalloc WrapMalloc(malloc_t malloc) + * + * cdef class PyFree: # <<<<<<<<<<<<<< + * cdef free_t free + * cdef void _set(self, free_t free) +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_PyFree { + void (*_set)(struct __pyx_obj_5cymem_5cymem_PyFree *, __pyx_t_5cymem_5cymem_free_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_PyFree *__pyx_vtabptr_5cymem_5cymem_PyFree; + + +/* "cymem/cymem.pxd":16 + * cdef PyFree WrapFree(free_t free) + * + * cdef class Pool: # <<<<<<<<<<<<<< + * cdef readonly size_t size + * cdef readonly dict addresses +*/ + +struct __pyx_vtabstruct_5cymem_5cymem_Pool { + void *(*alloc)(struct __pyx_obj_5cymem_5cymem_Pool *, size_t, size_t); + void (*free)(struct __pyx_obj_5cymem_5cymem_Pool *, void *); + void *(*realloc)(struct __pyx_obj_5cymem_5cymem_Pool *, void *, size_t); +}; +static struct __pyx_vtabstruct_5cymem_5cymem_Pool *__pyx_vtabptr_5cymem_5cymem_Pool; + + +/* "preshed/maps.pxd":45 + * + * + * cdef class PreshMap: # <<<<<<<<<<<<<< + * cdef MapStruct* c_map + * cdef Pool mem +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMap { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMap *, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMap *__pyx_vtabptr_7preshed_4maps_PreshMap; + + +/* "preshed/maps.pxd":53 + * + * + * cdef class PreshMapArray: # <<<<<<<<<<<<<< + * cdef Pool mem + * cdef MapStruct* maps +*/ + +struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray { + void *(*get)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t); + void (*set)(struct __pyx_obj_7preshed_4maps_PreshMapArray *, size_t, __pyx_t_7preshed_4maps_key_t, void *); +}; +static struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray *__pyx_vtabptr_7preshed_4maps_PreshMapArray; + + +/* "strings.pxd":22 + * + * + * cdef class StringStore: # <<<<<<<<<<<<<< + * cdef Pool mem + * +*/ + +struct __pyx_vtabstruct_5spacy_7strings_StringStore { + __pyx_t_5spacy_7strings_Utf8Str const *(*intern_unicode)(struct __pyx_obj_5spacy_7strings_StringStore *, PyObject *, int); + __pyx_t_5spacy_7strings_Utf8Str const *(*_intern_utf8)(struct __pyx_obj_5spacy_7strings_StringStore *, char *, int, __pyx_t_5spacy_8typedefs_hash_t *, int); +}; +static struct __pyx_vtabstruct_5spacy_7strings_StringStore *__pyx_vtabptr_5spacy_7strings_StringStore; + + +/* "morphology.pxd":11 + * + * + * cdef class Morphology: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly StringStore strings +*/ + +struct __pyx_vtabstruct_5spacy_10morphology_Morphology { + struct __pyx_t_5spacy_7structs_MorphAnalysisC (*create_morph_tag)(struct __pyx_obj_5spacy_10morphology_Morphology *, PyObject *); + int (*insert)(struct __pyx_obj_5spacy_10morphology_Morphology *, struct __pyx_t_5spacy_7structs_MorphAnalysisC); +}; +static struct __pyx_vtabstruct_5spacy_10morphology_Morphology *__pyx_vtabptr_5spacy_10morphology_Morphology; + + +/* "lexeme.pxd":24 + * cdef attr_t OOV_RANK + * + * cdef class Lexeme: # <<<<<<<<<<<<<< + * cdef LexemeC* c + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme { + struct __pyx_obj_5spacy_6lexeme_Lexeme *(*from_ptr)(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); + void (*set_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); + __pyx_t_5spacy_8typedefs_attr_t (*get_struct_attr)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_check_flag)(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + int (*c_set_flag)(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); +}; +static struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme *__pyx_vtabptr_5spacy_6lexeme_Lexeme; +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *, struct __pyx_obj_5spacy_5vocab_Vocab *); +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *, enum __pyx_t_5spacy_5attrs_attr_id_t, int); + + +/* "doc.pxd":37 + * + * + * cdef class Doc: # <<<<<<<<<<<<<< + * cdef readonly Pool mem + * cdef readonly Vocab vocab +*/ + +struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc { + PyArrayObject *(*to_array)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, PyObject *, int __pyx_skip_dispatch); + int (*__pyx_fuse_0push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_Lexeme_ptr, int); + int (*__pyx_fuse_1push_back)(struct __pyx_obj_5spacy_6tokens_3doc_Doc *, __pyx_t_5spacy_6tokens_3doc_const_TokenC_ptr, int); +}; +static struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc *__pyx_vtabptr_5spacy_6tokens_3doc_Doc; + + +/* "tokens/token.pxd":16 + * cdef const int MISSING_DEP = 0 + * + * cdef class Token: # <<<<<<<<<<<<<< + * cdef readonly Vocab vocab + * cdef TokenC* c +*/ + +struct __pyx_vtabstruct_5spacy_6tokens_5token_Token { + struct __pyx_obj_5spacy_6tokens_5token_Token *(*cinit)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_t_5spacy_7structs_TokenC const *, int, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); + int (*check_flag)(struct __pyx_obj_5spacy_6tokens_5token_Token *, enum __pyx_t_5spacy_5attrs_attr_id_t, int __pyx_skip_dispatch); + __pyx_t_5spacy_8typedefs_attr_t (*get_struct_attr)(struct __pyx_t_5spacy_7structs_TokenC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); + __pyx_t_5spacy_8typedefs_attr_t (*set_struct_attr)(struct __pyx_t_5spacy_7structs_TokenC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); + int (*missing_dep)(struct __pyx_t_5spacy_7structs_TokenC const *); + int (*missing_head)(struct __pyx_t_5spacy_7structs_TokenC const *); +}; +static struct __pyx_vtabstruct_5spacy_6tokens_5token_Token *__pyx_vtabptr_5spacy_6tokens_5token_Token; +static CYTHON_INLINE struct __pyx_obj_5spacy_6tokens_5token_Token *__pyx_f_5spacy_6tokens_5token_5Token_cinit(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_t_5spacy_7structs_TokenC const *, int, struct __pyx_obj_5spacy_6tokens_3doc_Doc *); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6tokens_5token_5Token_get_struct_attr(struct __pyx_t_5spacy_7structs_TokenC const *, enum __pyx_t_5spacy_5attrs_attr_id_t); +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6tokens_5token_5Token_set_struct_attr(struct __pyx_t_5spacy_7structs_TokenC *, enum __pyx_t_5spacy_5attrs_attr_id_t, __pyx_t_5spacy_8typedefs_attr_t); +static CYTHON_INLINE int __pyx_f_5spacy_6tokens_5token_5Token_missing_dep(struct __pyx_t_5spacy_7structs_TokenC const *); +static CYTHON_INLINE int __pyx_f_5spacy_6tokens_5token_5Token_missing_head(struct __pyx_t_5spacy_7structs_TokenC const *); + + +/* "spacy/vocab.pyx":46 + * + * + * cdef class Vocab: # <<<<<<<<<<<<<< + * """A look-up table that allows you to access `Lexeme` objects. The `Vocab` + * instance also provides access to the `StringStore`, and owns underlying +*/ + +struct __pyx_vtabstruct_5spacy_5vocab_Vocab { + struct __pyx_t_5spacy_7structs_LexemeC const *(*get)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*get_by_orth)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8typedefs_attr_t); + struct __pyx_t_5spacy_7structs_TokenC const *(*make_fused_token)(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *); + struct __pyx_t_5spacy_7structs_LexemeC const *(*_new_lexeme)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *); + int (*_add_lex_to_vocab)(struct __pyx_obj_5spacy_5vocab_Vocab *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_t_5spacy_7structs_LexemeC const *, int); +}; +static struct __pyx_vtabstruct_5spacy_5vocab_Vocab *__pyx_vtabptr_5spacy_5vocab_Vocab; + + +/* "View.MemoryView":110 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname("__pyx_array") + * cdef class array: +*/ + +struct __pyx_vtabstruct_array { + PyObject *(*get_memview)(struct __pyx_array_obj *); +}; +static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; + + +/* "View.MemoryView":334 + * + * + * @cname('__pyx_memoryview') # <<<<<<<<<<<<<< + * cdef class memoryview: + * +*/ + +struct __pyx_vtabstruct_memoryview { + char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *); + PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); + PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); + PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); +}; +static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; + + +/* "View.MemoryView":951 + * + * + * @cython.collection_type("sequence") # <<<<<<<<<<<<<< + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): +*/ + +struct __pyx_vtabstruct__memoryviewslice { + struct __pyx_vtabstruct_memoryview __pyx_base; +}; +static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### Code section: utility_code_proto ### */ + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto (used by PyErrFetchRestore) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* TupleAndListFromArray.proto (used by fastcall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +#endif +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto (used by BytesEquals) */ +#include + +/* BytesEquals.proto (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i)) +#else + #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i)) +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i]) + #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); + #else + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #endif +#else + #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS +#endif +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start) +#else +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* py_dict_items.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); + +/* CallCFunction.proto (used by CallUnboundCMethod0) */ +#define __Pyx_CallCFunction(cfunc, self, args)\ + ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args) +#define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\ + ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs) +#define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\ + ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs) +#define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ + ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) + +/* PyObjectCall.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto (used by PyObjectCallOneArg) */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); + +/* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ +typedef struct { + PyObject *type; + PyObject **method_name; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS + __pyx_atomic_int_type initialized; +#endif + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) { +#if !CYTHON_ATOMICS + return 1; +#else + __pyx_nonatomic_int_type expected = 0; + if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) { + return 0; + } + return expected; +#endif +} +static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) { +#if CYTHON_ATOMICS + __pyx_atomic_store(&cfunc->initialized, 2); +#endif +} +#else +#define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2 +#define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc) +#endif + +/* CallUnboundCMethod0.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#else +#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) +#endif + +/* py_dict_values.proto (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); + +/* OwnedDictNext.proto (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue); +#else +CYTHON_INLINE +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue); +#endif + +/* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywordsImpl.export */ +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name +); +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* CallUnboundCMethod2.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); +#else +#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) +#endif + +/* ParseKeywords.proto */ +static CYTHON_INLINE int __Pyx_ParseKeywords( + PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[], + PyObject *kwds2, PyObject *values[], + Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs +); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* ArgTypeTestFunc.export */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) + +/* PyValueError_Check.proto */ +#define __Pyx_PyExc_ValueError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ValueError) + +/* RaiseException.export */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* PyObjectFastCallMethod.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) +#else +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); +#endif + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* PyMemoryError_Check.proto */ +#define __Pyx_PyExc_MemoryError_Check(obj) __Pyx_TypeCheck(obj, PyExc_MemoryError) + +/* BuildPyUnicode.proto (used by COrdinalToPyUnicode) */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength, + int prepend_sign, char padding_char); + +/* COrdinalToPyUnicode.proto (used by CIntToPyUnicode) */ +static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value); +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t width, char padding_char); + +/* GCCDiagnostics.proto (used by CIntToPyUnicode) */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* IncludeStdlibH.proto (used by CIntToPyUnicode) */ +#include + +/* CIntToPyUnicode.proto */ +#define __Pyx_PyUnicode_From_int(value, width, padding_char, format_char) (\ + ((format_char) == ('c')) ?\ + __Pyx_uchar___Pyx_PyUnicode_From_int(value, width, padding_char) :\ + __Pyx____Pyx_PyUnicode_From_int(value, width, padding_char, format_char)\ + ) +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char); +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); + +/* CIntToPyUnicode.proto */ +#define __Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char) (\ + ((format_char) == ('c')) ?\ + __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char) :\ + __Pyx____Pyx_PyUnicode_From_Py_ssize_t(value, width, padding_char, format_char)\ + ) +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char); +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char); + +/* JoinPyUnicode.export */ +static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char); + +/* PyObjectFormatSimple.proto */ +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#elif CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ + likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ + PyObject_Format(s, f)) +#else + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#endif + +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* RejectKeywords.export */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); + +/* PyTypeError_Check.proto */ +#define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t, int b_is_constant); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + +/* PyDictVersioning.proto (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000 + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + +/* PyAssertionError_Check.proto */ +#define __Pyx_PyExc_AssertionError_Check(obj) __Pyx_TypeCheck(obj, PyExc_AssertionError) + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* GetTopmostException.proto (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* SwapException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* HasAttr.proto (used by ImportImpl) */ +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n) +#else +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +#endif + +/* ImportImpl.export */ +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); + +/* Import.proto */ +static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level); + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { + return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); +} +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +#ifdef PyExceptionInstance_Check + #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) +#else + #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) +#endif + +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +/* ListCompAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + L->ob_item[len] = x; + #else + PyList_SET_ITEM(list, len, x); + #endif + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); + +/* PyObjectFormatAndDecref.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f); +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f); + +/* PyObjectFormat.proto */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f); +#else +#define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f) +#endif + +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck, int unsafe_shared); + +/* RaiseUnboundLocalError.proto */ +static void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* PyIndexError_Check.proto */ +#define __Pyx_PyExc_IndexError_Check(obj) __Pyx_TypeCheck(obj, PyExc_IndexError) + +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long, int b_is_constant); + +/* PyImportError_Check.proto */ +#define __Pyx_PyExc_ImportError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ImportError) + +/* tp_new.proto */ +#define __Pyx_tp_new(type_obj, args) __Pyx_tp_new_kwargs(type_obj, args, NULL) +static CYTHON_INLINE PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs); + +/* PyObjectVectorCallKwBuilder.proto (used by PyObjectVectorCallMethodKwBuilder) */ +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#if CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall +#endif +#define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); +#else +#define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict +#define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) +#define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) +#define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) +#endif + +/* PyObjectVectorCallMethodKwBuilder.proto */ +#if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 +#define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod +#else +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#endif + +/* RaiseMappingExpected.proto */ +static void __Pyx_RaiseMappingExpectedError(PyObject* arg); + +/* dict_getitem_default.proto */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); + +/* PyObjectCall2Args.proto (used by CallUnboundCMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* CallUnboundCMethod1.proto */ +CYTHON_UNUSED +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#else +#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) +#endif + +/* PyObjectDelAttr.proto (used by PyObjectSetAttrStr) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +#define __Pyx_PyObject_DelAttr(o, n) PyObject_SetAttr(o, n, NULL) +#else +#define __Pyx_PyObject_DelAttr(o, n) PyObject_DelAttr(o, n) +#endif + +/* PyObjectSetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); +#else +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif + +/* PyObjectLookupSpecial.proto */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0) +#define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1) +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error); +#else +#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n) +#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) +#endif + +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + L->ob_item[len] = x; + #else + PyList_SET_ITEM(list, len, x); + #endif + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* PyKeyError_Check.proto */ +#define __Pyx_PyExc_KeyError_Check(obj) __Pyx_TypeCheck(obj, PyExc_KeyError) + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* PyLongBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) +#endif + +/* DictGetItem.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); +#define __Pyx_PyObject_Dict_GetItem(obj, name)\ + (likely(PyDict_CheckExact(obj)) ?\ + __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) +#else +#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) +#endif + +/* SliceObject.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +/* pyint_simplify.proto */ +static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none); + +/* PyLongCompare.proto */ +static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* RaiseClosureNameError.proto */ +static void __Pyx_RaiseClosureNameError(const char *varname); + +/* dict_setdefault.proto (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); + +/* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp); +#endif + +/* SetItemOnTypeDict.proto (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v); +#define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v) + +/* FixUpExtensionType.proto (used by FetchCommonType) */ +static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); + +/* AddModuleRef.proto (used by FetchSharedCythonModule) */ +#if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ + __PYX_LIMITED_VERSION_HEX < 0x030d0000) + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); +#else + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#endif + +/* FetchSharedCythonModule.proto (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto (used by CommonTypesMetaclass) */ +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases); + +/* CommonTypesMetaclass.proto (used by CythonFunctionShared) */ +static int __pyx_CommonTypesMetaclass_init(PyObject *module); +#define __Pyx_CommonTypesMetaclass_USED + +/* CallTypeTraverse.proto (used by CythonFunctionShared) */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#define __Pyx_call_type_traverse(o, always_call, visit, arg) 0 +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg); +#endif + +/* PyMethodNew.proto (used by CythonFunctionShared) */ +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ); + +/* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto (used by CythonFunction) */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_dict; +#endif + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + PyObject *defaults; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#undef __Pyx_CyOrPyCFunction_Check +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType) +#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType) +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)); +#undef __Pyx_IsSameCFunction +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, + PyTypeObject *defaults_type); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* PyNotImplementedError_Check.proto */ +#define __Pyx_PyExc_NotImplementedError_Check(obj) __Pyx_TypeCheck(obj, PyExc_NotImplementedError) + +/* MoveIfSupported.proto */ +#if CYTHON_USE_CPP_STD_MOVE + #include + #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x) +#else + #define __PYX_STD_MOVE_IF_SUPPORTED(x) x +#endif + +/* AllocateExtensionType.proto */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); + +/* DefaultPlacementNew.proto */ +#include +template +void __Pyx_default_placement_construct(T* x) { + new (static_cast(x)) T(); +} + +/* CheckTypeForFreelists.proto */ +#if CYTHON_USE_FREELISTS +#if CYTHON_USE_TYPE_SPECS +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT +#else +#define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size))) +#define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE) +#endif +#define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\ + (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\ + (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS))) +#endif + +/* VoidPtrExport.proto */ +static int __Pyx_ExportVoidPtr(PyObject *api_dict, const char *name, void *p, const char *sig); + +/* GetApiDict.proto */ +static PyObject *__Pyx_ApiExport_GetApiDict(void); + +/* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); +#endif + +/* PyObjectCallMethod0.proto (used by PyType_Ready) */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto (used by PyType_Ready) */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* GetVTable.proto (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +static int __Pyx_MergeVtables(PyTypeObject *type); + +/* DelItemOnTypeDict.proto (used by SetupReduce) */ +static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k); +#define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k) + +/* SetupReduce.proto */ +static int __Pyx_setup_reduce(PyObject* type_obj); + +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto_3_2_1 +#define __PYX_HAVE_RT_ImportType_proto_3_2_1 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_2_1(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_2_1 { + __Pyx_ImportType_CheckSize_Error_3_2_1 = 0, + __Pyx_ImportType_CheckSize_Warn_3_2_1 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_2_1 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size); +#endif + +/* VoidPtrImport.proto */ +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig); + +/* FunctionImport.proto */ +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* GetNameInClass.proto */ +#define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name) +static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name); + +/* CLineInTraceback.proto (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#else +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#endif + +/* CodeObjectCache.proto (used by AddTraceback) */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject __Pyx_CachedCodeObjectType; +#else +typedef PyCodeObject __Pyx_CachedCodeObjectType; +#endif +typedef struct { + __Pyx_CachedCodeObjectType* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_int_type accessor_count; + #endif +}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* LengthHint.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_PyObject_LengthHint(o, defaultval) (defaultval) +#else +#define __Pyx_PyObject_LengthHint(o, defaultval) PyObject_LengthHint(o, defaultval) +#endif + +/* CheckUnpickleChecksum.proto */ +static CYTHON_INLINE int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members); + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include +#include +#include +#include +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::bad_typeid& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* RealImag.proto */ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(__cplusplus) && CYTHON_CCOMPLEX\ + && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_double(a, b) ((a)==(b)) + #define __Pyx_c_sum_double(a, b) ((a)+(b)) + #define __Pyx_c_diff_double(a, b) ((a)-(b)) + #define __Pyx_c_prod_double(a, b) ((a)*(b)) + #define __Pyx_c_quot_double(a, b) ((a)/(b)) + #define __Pyx_c_neg_double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_double(z) ((z)==(double)0) + #define __Pyx_c_conj_double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (::std::abs(z)) + #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_double(z) ((z)==0) + #define __Pyx_c_conj_double(z) (conj(z)) + #if 1 + #define __Pyx_c_abs_double(z) (cabs(z)) + #define __Pyx_c_pow_double(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_long__double(a, b) ((a)==(b)) + #define __Pyx_c_sum_long__double(a, b) ((a)+(b)) + #define __Pyx_c_diff_long__double(a, b) ((a)-(b)) + #define __Pyx_c_prod_long__double(a, b) ((a)*(b)) + #define __Pyx_c_quot_long__double(a, b) ((a)/(b)) + #define __Pyx_c_neg_long__double(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_long__double(z) ((z)==(long double)0) + #define __Pyx_c_conj_long__double(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (::std::abs(z)) + #define __Pyx_c_pow_long__double(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_long__double(z) ((z)==0) + #define __Pyx_c_conj_long__double(z) (conjl(z)) + #if 1 + #define __Pyx_c_abs_long__double(z) (cabsl(z)) + #define __Pyx_c_pow_long__double(a, b) (cpowl(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex); + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex); + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + #endif +#endif + +/* BufferStructDeclare.proto */ +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +/* MemviewRefcount.proto */ +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + +/* MemviewSliceIsContig.proto */ +static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim); + +/* OverlappingSlices.proto */ +static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize); + +/* MemviewSliceInit.proto */ +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(enum __pyx_t_5spacy_5attrs_attr_id_t value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE enum __pyx_t_5spacy_5attrs_attr_id_t __Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *); + +/* MemviewSliceCopy.proto */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object); + +/* PyObjectCallMethod1.proto */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* UpdateUnpickledDict.proto */ +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index); + +/* CIntFromPy.proto */ +static CYTHON_INLINE char __Pyx_PyLong_As_char(PyObject *); + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 +#define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#else +static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); +#endif +#else // !LIMITED_API +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + +/* GetRuntimeVersion.proto */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +static unsigned long __Pyx_cached_runtime_version = 0; +static void __Pyx_init_runtime_version(void); +#else +#define __Pyx_init_runtime_version() +#endif +static unsigned long __Pyx_get_runtime_version(void); + +/* IterNextPlain.proto (used by CoroutineBase) */ +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void); +#endif + +/* ReturnWithStopIteration.proto (used by CoroutineBase) */ +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext); + +/* CoroutineBase.proto (used by Generator) */ +struct __pyx_CoroutineObject; +typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_ExcInfoStruct _PyErr_StackItem +#else +typedef struct { + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; +} __Pyx_ExcInfoStruct; +#endif +typedef struct __pyx_CoroutineObject { + PyObject_HEAD + __pyx_coroutine_body_t body; + PyObject *closure; + __Pyx_ExcInfoStruct gi_exc_state; +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *gi_weakreflist; +#endif + PyObject *classobj; + PyObject *yieldfrom; + __Pyx_pyiter_sendfunc yieldfrom_am_send; + PyObject *gi_name; + PyObject *gi_qualname; + PyObject *gi_modulename; + PyObject *gi_code; + PyObject *gi_frame; +#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE) + PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count]; + uint64_t __pyx_pymonitoring_version; +#endif + int resume_label; + char is_running; +} __pyx_CoroutineObject; +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name); +static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); +static int __Pyx_Coroutine_clear(PyObject *self); +static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval); +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); +static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval); +static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); +#if CYTHON_USE_EXC_INFO_STACK +#define __Pyx_Coroutine_SwapException(self) +#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) +#else +#define __Pyx_Coroutine_SwapException(self) {\ + __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ + __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ + } +#define __Pyx_Coroutine_ResetAndClearException(self) {\ + __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ + (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ + } +#endif +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) +#endif +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen); +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen); +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen); +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure); +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send); +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg); + +/* Generator.proto */ +#define __Pyx_Generator_USED +#define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType) +#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\ + __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name) +static PyObject *__Pyx_Generator_Next(PyObject *self); +static int __pyx_Generator_init(PyObject *module); +static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self); + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); + +/* DecompressString.proto */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); + +/* MultiPhaseInitModuleState.proto */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +static PyObject *__Pyx_State_FindModule(void*); +static int __Pyx_State_AddModule(PyObject* module, void*); +static int __Pyx_State_RemoveModule(void*); +#elif CYTHON_USE_MODULE_STATE +#define __Pyx_State_FindModule PyState_FindModule +#define __Pyx_State_AddModule PyState_AddModule +#define __Pyx_State_RemoveModule PyState_RemoveModule +#endif + +/* #### Code section: module_declarations ### */ +/* CythonABIVersion.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API + #if CYTHON_METH_FASTCALL + #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" + #else + #define __PYX_FASTCALL_ABI_SUFFIX + #endif + #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#else + #define __PYX_LIMITED_ABI_SUFFIX +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + #define __PYX_AM_SEND_ABI_SUFFIX +#elif __PYX_HAS_PY_AM_SEND == 2 + #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" +#else + #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" +#endif +#ifndef __PYX_MONITORING_ABI_SUFFIX + #define __PYX_MONITORING_ABI_SUFFIX +#endif +#if CYTHON_USE_TP_FINALIZE + #define __PYX_TP_FINALIZE_ABI_SUFFIX +#else + #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" +#endif +#if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) + #define __PYX_FREELISTS_ABI_SUFFIX +#else + #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" +#endif +#define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab); /* proto*/ +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value); /* proto*/ +static CYTHON_INLINE struct __pyx_obj_5spacy_6tokens_5token_Token *__pyx_f_5spacy_6tokens_5token_5Token_cinit(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab, CYTHON_UNUSED struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token, int __pyx_v_offset, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6tokens_5token_5Token_get_struct_attr(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name); /* proto*/ +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6tokens_5token_5Token_set_struct_attr(struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_token, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6tokens_5token_5Token_missing_dep(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token); /* proto*/ +static CYTHON_INLINE int __pyx_f_5spacy_6tokens_5token_5Token_missing_head(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token); /* proto*/ +static struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_f_5spacy_5vocab_5Vocab_get(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, PyObject *__pyx_v_string); /* proto*/ +static struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_f_5spacy_5vocab_5Vocab_get_by_orth(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_orth); /* proto*/ +static struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_f_5spacy_5vocab_5Vocab__new_lexeme(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, PyObject *__pyx_v_string); /* proto*/ +static int __pyx_f_5spacy_5vocab_5Vocab__add_lex_to_vocab(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key, struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, int __pyx_v_is_transient); /* proto*/ +static struct __pyx_t_5spacy_7structs_TokenC const *__pyx_f_5spacy_5vocab_5Vocab_make_fused_token(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_substrings); /* proto*/ + +/* Module declarations from "cymem.cymem" */ + +/* Module declarations from "libcpp.vector" */ + +/* Module declarations from "libc.stdint" */ + +/* Module declarations from "murmurhash.mrmr" */ +static uint64_t (*__pyx_f_10murmurhash_4mrmr_hash64)(void *, int, uint64_t); /*proto*/ + +/* Module declarations from "preshed.maps" */ +static void *(*__pyx_f_7preshed_4maps_map_clear)(struct __pyx_t_7preshed_4maps_MapStruct *, __pyx_t_7preshed_4maps_key_t const ); /*proto*/ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libc.stdio" */ + +/* Module declarations from "__builtin__" */ + +/* Module declarations from "cpython.type" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "cpython.object" */ + +/* Module declarations from "cpython.ref" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "numpy" */ + +/* Module declarations from "libcpp.utility" */ + +/* Module declarations from "libcpp.set" */ + +/* Module declarations from "spacy.typedefs" */ + +/* Module declarations from "spacy.strings" */ + +/* Module declarations from "libcpp.unordered_map" */ + +/* Module declarations from "libcpp.unordered_set" */ + +/* Module declarations from "spacy" */ + +/* Module declarations from "spacy.symbols" */ + +/* Module declarations from "spacy.parts_of_speech" */ + +/* Module declarations from "spacy.structs" */ + +/* Module declarations from "spacy.morphology" */ + +/* Module declarations from "spacy.attrs" */ + +/* Module declarations from "spacy.lexeme" */ +static struct __pyx_t_5spacy_7structs_LexemeC *__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME = 0; +#define __pyx_v_5spacy_6lexeme_EMPTY_LEXEME (*__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME) +static __pyx_t_5spacy_8typedefs_attr_t *__pyx_vp_5spacy_6lexeme_OOV_RANK = 0; +#define __pyx_v_5spacy_6lexeme_OOV_RANK (*__pyx_vp_5spacy_6lexeme_OOV_RANK) + +/* Module declarations from "spacy.tokens.doc" */ + +/* Module declarations from "spacy.tokens.token" */ +static int const *__pyx_vp_5spacy_6tokens_5token_MISSING_DEP = 0; +#define __pyx_v_5spacy_6tokens_5token_MISSING_DEP (*__pyx_vp_5spacy_6tokens_5token_MISSING_DEP) + +/* Module declarations from "spacy.vocab" */ +static struct __pyx_t_5spacy_7structs_LexemeC __pyx_v_5spacy_5vocab_EMPTY_LEXEME; +static PyObject *__pyx_collections_abc_Sequence = 0; +static PyObject *generic = 0; +static PyObject *strided = 0; +static PyObject *indirect = 0; +static PyObject *contiguous = 0; +static PyObject *indirect_contiguous = 0; +static int __pyx_memoryview_thread_locks_used; +static PyThread_type_lock __pyx_memoryview_thread_locks[8]; +static PyObject *__pyx_f_5spacy_5vocab___pyx_unpickle_Vocab__set_state(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *); /*proto*/ +static PyObject *__pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t(std::vector<__pyx_t_5spacy_8typedefs_attr_t> const &); /*proto*/ +static std::vector<__pyx_t_5spacy_8typedefs_attr_t> __pyx_convert_vector_from_py___pyx_t_5spacy_8typedefs_attr_t(PyObject *); /*proto*/ +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ +static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char const *, char *); /*proto*/ +static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo const *); /*proto*/ +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ +static PyObject *_unellipsify(PyObject *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ +static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/ +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/ +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ +static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/ +static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/ +static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/ +static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/ +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/ +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ +static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/ +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ +static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "spacy.vocab" +extern int __pyx_module_is_main_spacy__vocab; +int __pyx_module_is_main_spacy__vocab = 0; + +/* Implementation of "spacy.vocab" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin___import__; +static PyObject *__pyx_builtin_Ellipsis; +static PyObject *__pyx_builtin_id; +/* #### Code section: string_decls ### */ +/* #### Code section: decls ### */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */ +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */ +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */ +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */ +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_create_vocab(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lang, PyObject *__pyx_v_defaults, PyObject *__pyx_v_vectors_name); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab___init__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_lex_attr_getters, PyObject *__pyx_v_strings, PyObject *__pyx_v_lookups, PyObject *__pyx_v_oov_prob, PyObject *__pyx_v_vectors_name, PyObject *__pyx_v_writing_system, PyObject *__pyx_v_get_noun_chunks, CYTHON_UNUSED PyObject *__pyx_v_deprecated_kwargs); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_7vectors___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_7vectors_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_vectors); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_4lang___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_14in_memory_zone___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_5spacy_5vocab_5Vocab_2__len__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_4memory_zone(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_mem); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_7add_flag(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_flag_getter, int __pyx_v_flag_id); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_9_clear_transient_orths(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_11__contains__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_13__iter__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_16__getitem__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_id_or_string); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_14vectors_length___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_18reset_vectors(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_width, PyObject *__pyx_v_shape); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_20deduplicate_vectors(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_22prune_vectors(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_nr_row, PyObject *__pyx_v_batch_size); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_24get_vector(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_orth); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_26set_vector(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_orth, PyObject *__pyx_v_vector); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_28has_vector(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_orth); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_7lookups___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_7lookups_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_lookups); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_30to_disk(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_32from_disk(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_8to_bytes_deserialize_vectors(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_34to_bytes(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_10from_bytes_serialize_vectors(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda4(PyObject *__pyx_self, PyObject *__pyx_v_b); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_36from_bytes(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_bytes_data, PyObject *__pyx_v_exclude); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_38_reset_cache(CYTHON_UNUSED struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_keys, CYTHON_UNUSED PyObject *__pyx_v_strings); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_7strings___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_10morphology___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_10morphology_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_10morphology_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_8_vectors___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_8_vectors_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_8_vectors_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_8_lookups___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_8_lookups_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_8_lookups_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_14writing_system___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_14writing_system_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_14writing_system_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_15get_noun_chunks___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_15get_noun_chunks_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_15get_noun_chunks_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_6length___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_14_unused_object___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_14_unused_object_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_14_unused_object_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_16lex_attr_getters___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_16lex_attr_getters_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_16lex_attr_getters_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_3cfg___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_3cfg_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5spacy_5vocab_5Vocab_3cfg_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_40__reduce_cython__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_42__setstate_cython__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_2pickle_vocab(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vocab); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_4unpickle_vocab(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sstore, PyObject *__pyx_v_vectors, PyObject *__pyx_v_morphology, PyObject *__pyx_v__unused_object, PyObject *__pyx_v_lex_attr_getters, PyObject *__pyx_v_lookups, PyObject *__pyx_v_get_noun_chunks); /* proto */ +static PyObject *__pyx_pf_5spacy_5vocab_6__pyx_unpickle_Vocab(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_5spacy_5vocab_Vocab(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_5vocab___pyx_scope_struct__memory_zone(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_5vocab___pyx_scope_struct_1___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_5vocab___pyx_scope_struct_2_to_bytes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_5spacy_5vocab___pyx_scope_struct_3_from_bytes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +/* SmallCodeConfig */ +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyMalloc; + PyTypeObject *__pyx_ptype_5cymem_5cymem_PyFree; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Pool; + PyTypeObject *__pyx_ptype_5cymem_5cymem_Address; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMap; + PyTypeObject *__pyx_ptype_7preshed_4maps_PreshMapArray; + PyTypeObject *__pyx_ptype_7cpython_4type_type; + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + PyTypeObject *__pyx_ptype_5spacy_7strings_StringStore; + PyTypeObject *__pyx_ptype_5spacy_10morphology_Morphology; + PyTypeObject *__pyx_ptype_5spacy_6lexeme_Lexeme; + PyTypeObject *__pyx_ptype_5spacy_6tokens_3doc_Doc; + PyTypeObject *__pyx_ptype_5spacy_6tokens_5token_Token; + PyObject *__pyx_type_5spacy_5vocab_Vocab; + PyObject *__pyx_type_5spacy_5vocab___pyx_scope_struct__memory_zone; + PyObject *__pyx_type_5spacy_5vocab___pyx_scope_struct_1___iter__; + PyObject *__pyx_type_5spacy_5vocab___pyx_scope_struct_2_to_bytes; + PyObject *__pyx_type_5spacy_5vocab___pyx_scope_struct_3_from_bytes; + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + PyTypeObject *__pyx_ptype_5spacy_5vocab_Vocab; + PyTypeObject *__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone; + PyTypeObject *__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__; + PyTypeObject *__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes; + PyTypeObject *__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes; + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; + __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; + PyObject *__pyx_k__6; + PyObject *__pyx_k__7; + PyObject *__pyx_k__10; + PyObject *__pyx_k__11; + PyObject *__pyx_k__12; + PyObject *__pyx_k__13; + PyObject *__pyx_slice[1]; + PyObject *__pyx_tuple[6]; + PyObject *__pyx_codeobj_tab[28]; + PyObject *__pyx_string_tab[375]; + PyObject *__pyx_number_tab[8]; +/* #### Code section: module_state_contents ### */ +/* CommonTypesMetaclass.module_state_decls */ +PyTypeObject *__pyx_CommonTypesMetaclassType; + +/* CachedMethodType.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API +PyObject *__Pyx_CachedMethodType; +#endif + +/* CythonFunctionShared.module_state_decls */ +PyTypeObject *__pyx_CyFunctionType; + + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone *__pyx_freelist_5spacy_5vocab___pyx_scope_struct__memory_zone[8]; +int __pyx_freecount_5spacy_5vocab___pyx_scope_struct__memory_zone; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__ *__pyx_freelist_5spacy_5vocab___pyx_scope_struct_1___iter__[8]; +int __pyx_freecount_5spacy_5vocab___pyx_scope_struct_1___iter__; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *__pyx_freelist_5spacy_5vocab___pyx_scope_struct_2_to_bytes[8]; +int __pyx_freecount_5spacy_5vocab___pyx_scope_struct_2_to_bytes; +#endif + +#if CYTHON_USE_FREELISTS +struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *__pyx_freelist_5spacy_5vocab___pyx_scope_struct_3_from_bytes[8]; +int __pyx_freecount_5spacy_5vocab___pyx_scope_struct_3_from_bytes; +#endif +/* CodeObjectCache.module_state_decls */ +struct __Pyx_CodeObjectCache __pyx_code_cache; + +/* IterNextPlain.module_state_decls */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache; +#endif + +/* Generator.module_state_decls */ +PyTypeObject *__pyx_GeneratorType; + +/* #### Code section: module_state_end ### */ +} __pyx_mstatetype; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { +extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) + +#define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstatetype __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: constant_name_defines ### */ +#define __pyx_kp_u_ __pyx_string_tab[0] +#define __pyx_kp_u_All_dimensions_preceding_dimensi __pyx_string_tab[1] +#define __pyx_kp_u_Buffer_view_does_not_expose_stri __pyx_string_tab[2] +#define __pyx_kp_u_Can_only_create_a_buffer_that_is __pyx_string_tab[3] +#define __pyx_kp_u_Cannot_assign_to_read_only_memor __pyx_string_tab[4] +#define __pyx_kp_u_Cannot_create_writable_memory_vi __pyx_string_tab[5] +#define __pyx_kp_u_Cannot_index_with_type __pyx_string_tab[6] +#define __pyx_kp_u_Cannot_transpose_memoryview_with __pyx_string_tab[7] +#define __pyx_kp_u_Dimension_d_is_not_direct __pyx_string_tab[8] +#define __pyx_kp_u_Empty_shape_tuple_for_cython_arr __pyx_string_tab[9] +#define __pyx_kp_u_Index_out_of_bounds_axis_d __pyx_string_tab[10] +#define __pyx_kp_u_Indirect_dimensions_not_supporte __pyx_string_tab[11] +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_string_tab[12] +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_string_tab[13] +#define __pyx_kp_u_Iterator_Pool __pyx_string_tab[14] +#define __pyx_kp_u_MemoryView_of __pyx_string_tab[15] +#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[16] +#define __pyx_kp_u_Optional_Pool __pyx_string_tab[17] +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_string_tab[18] +#define __pyx_kp_u_Retrieve_a_lexeme_given_an_int_I __pyx_string_tab[19] +#define __pyx_kp_u_Step_may_not_be_zero_axis_d __pyx_string_tab[20] +#define __pyx_kp_u_Unable_to_convert_item_to_object __pyx_string_tab[21] +#define __pyx_kp_u_Vocab___getitem___line_287 __pyx_string_tab[22] +#define __pyx_kp_u__14 __pyx_string_tab[23] +#define __pyx_kp_u__2 __pyx_string_tab[24] +#define __pyx_kp_u__3 __pyx_string_tab[25] +#define __pyx_kp_u__4 __pyx_string_tab[26] +#define __pyx_kp_u__5 __pyx_string_tab[27] +#define __pyx_kp_u__9 __pyx_string_tab[28] +#define __pyx_kp_u_add_note __pyx_string_tab[29] +#define __pyx_kp_u_and __pyx_string_tab[30] +#define __pyx_kp_u_at_0x __pyx_string_tab[31] +#define __pyx_kp_u_collections_abc __pyx_string_tab[32] +#define __pyx_kp_u_contiguous_and_direct __pyx_string_tab[33] +#define __pyx_kp_u_contiguous_and_indirect __pyx_string_tab[34] +#define __pyx_kp_u_disable __pyx_string_tab[35] +#define __pyx_kp_u_enable __pyx_string_tab[36] +#define __pyx_kp_u_gc __pyx_string_tab[37] +#define __pyx_kp_u_got __pyx_string_tab[38] +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_string_tab[39] +#define __pyx_kp_u_isenabled __pyx_string_tab[40] +#define __pyx_kp_u_itemsize_0_for_cython_array __pyx_string_tab[41] +#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[42] +#define __pyx_kp_u_numpy__core_multiarray_failed_to __pyx_string_tab[43] +#define __pyx_kp_u_numpy__core_umath_failed_to_impo __pyx_string_tab[44] +#define __pyx_kp_u_object __pyx_string_tab[45] +#define __pyx_kp_u_self__by_orth_is_not_None_or_sel __pyx_string_tab[46] +#define __pyx_kp_u_self_name_is_not_None __pyx_string_tab[47] +#define __pyx_kp_u_spacy __pyx_string_tab[48] +#define __pyx_kp_u_spacy_attrs __pyx_string_tab[49] +#define __pyx_kp_u_spacy_compat __pyx_string_tab[50] +#define __pyx_kp_u_spacy_contextlib __pyx_string_tab[51] +#define __pyx_kp_u_spacy_errors __pyx_string_tab[52] +#define __pyx_kp_u_spacy_functools __pyx_string_tab[53] +#define __pyx_kp_u_spacy_lang_lex_attrs __pyx_string_tab[54] +#define __pyx_kp_u_spacy_lang_norm_exceptions __pyx_string_tab[55] +#define __pyx_kp_u_spacy_lookups __pyx_string_tab[56] +#define __pyx_kp_u_spacy_numpy __pyx_string_tab[57] +#define __pyx_kp_u_spacy_srsly __pyx_string_tab[58] +#define __pyx_kp_u_spacy_thinc_api __pyx_string_tab[59] +#define __pyx_kp_u_spacy_typing __pyx_string_tab[60] +#define __pyx_kp_u_spacy_vectors __pyx_string_tab[61] +#define __pyx_kp_u_spacy_vocab_pyx __pyx_string_tab[62] +#define __pyx_kp_u_strided_and_direct __pyx_string_tab[63] +#define __pyx_kp_u_strided_and_direct_or_indirect __pyx_string_tab[64] +#define __pyx_kp_u_strided_and_indirect __pyx_string_tab[65] +#define __pyx_kp_u_strings_json __pyx_string_tab[66] +#define __pyx_kp_u_stringsource __pyx_string_tab[67] +#define __pyx_kp_u_unable_to_allocate_array_data __pyx_string_tab[68] +#define __pyx_kp_u_unable_to_allocate_shape_and_str __pyx_string_tab[69] +#define __pyx_n_u_ASCII __pyx_string_tab[70] +#define __pyx_n_u_BASE_NORMS __pyx_string_tab[71] +#define __pyx_n_u_E040 __pyx_string_tab[72] +#define __pyx_n_u_E062 __pyx_string_tab[73] +#define __pyx_n_u_E063 __pyx_string_tab[74] +#define __pyx_n_u_E064 __pyx_string_tab[75] +#define __pyx_n_u_E065 __pyx_string_tab[76] +#define __pyx_n_u_E085 __pyx_string_tab[77] +#define __pyx_n_u_E849 __pyx_string_tab[78] +#define __pyx_n_u_E858 __pyx_string_tab[79] +#define __pyx_n_u_Ellipsis __pyx_string_tab[80] +#define __pyx_n_u_Errors __pyx_string_tab[81] +#define __pyx_n_u_ExitStack __pyx_string_tab[82] +#define __pyx_n_u_IS_STOP __pyx_string_tab[83] +#define __pyx_n_u_Iterator __pyx_string_tab[84] +#define __pyx_n_u_LEX_ATTRS __pyx_string_tab[85] +#define __pyx_n_u_Lookups __pyx_string_tab[86] +#define __pyx_n_u_Mode __pyx_string_tab[87] +#define __pyx_n_u_NORM __pyx_string_tab[88] +#define __pyx_n_u_Optional __pyx_string_tab[89] +#define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[90] +#define __pyx_n_u_Sequence __pyx_string_tab[91] +#define __pyx_n_u_Vectors __pyx_string_tab[92] +#define __pyx_n_u_VectorsMode __pyx_string_tab[93] +#define __pyx_n_u_View_MemoryView __pyx_string_tab[94] +#define __pyx_n_u_Vocab __pyx_string_tab[95] +#define __pyx_n_u_Vocab___iter __pyx_string_tab[96] +#define __pyx_n_u_Vocab___reduce_cython __pyx_string_tab[97] +#define __pyx_n_u_Vocab___setstate_cython __pyx_string_tab[98] +#define __pyx_n_u_Vocab__clear_transient_orths __pyx_string_tab[99] +#define __pyx_n_u_Vocab__reset_cache __pyx_string_tab[100] +#define __pyx_n_u_Vocab_add_flag __pyx_string_tab[101] +#define __pyx_n_u_Vocab_deduplicate_vectors __pyx_string_tab[102] +#define __pyx_n_u_Vocab_from_bytes __pyx_string_tab[103] +#define __pyx_n_u_Vocab_from_disk __pyx_string_tab[104] +#define __pyx_n_u_Vocab_get_vector __pyx_string_tab[105] +#define __pyx_n_u_Vocab_has_vector __pyx_string_tab[106] +#define __pyx_n_u_Vocab_memory_zone __pyx_string_tab[107] +#define __pyx_n_u_Vocab_prune_vectors __pyx_string_tab[108] +#define __pyx_n_u_Vocab_reset_vectors __pyx_string_tab[109] +#define __pyx_n_u_Vocab_set_vector __pyx_string_tab[110] +#define __pyx_n_u_Vocab_to_bytes __pyx_string_tab[111] +#define __pyx_n_u_Vocab_to_disk __pyx_string_tab[112] +#define __pyx_n_u__8 __pyx_string_tab[113] +#define __pyx_n_u__9 __pyx_string_tab[114] +#define __pyx_n_u_abc __pyx_string_tab[115] +#define __pyx_n_u_add __pyx_string_tab[116] +#define __pyx_n_u_add_flag __pyx_string_tab[117] +#define __pyx_n_u_add_lookups __pyx_string_tab[118] +#define __pyx_n_u_addr __pyx_string_tab[119] +#define __pyx_n_u_allocate_buffer __pyx_string_tab[120] +#define __pyx_n_u_allow_transient __pyx_string_tab[121] +#define __pyx_n_u_alternative __pyx_string_tab[122] +#define __pyx_n_u_asarray __pyx_string_tab[123] +#define __pyx_n_u_ascontiguousarray __pyx_string_tab[124] +#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[125] +#define __pyx_n_u_attr __pyx_string_tab[126] +#define __pyx_n_u_attrs __pyx_string_tab[127] +#define __pyx_n_u_axis __pyx_string_tab[128] +#define __pyx_n_u_b __pyx_string_tab[129] +#define __pyx_n_u_base __pyx_string_tab[130] +#define __pyx_n_u_batch_size __pyx_string_tab[131] +#define __pyx_n_u_bit __pyx_string_tab[132] +#define __pyx_n_u_bytes_data __pyx_string_tab[133] +#define __pyx_n_u_c __pyx_string_tab[134] +#define __pyx_n_u_class __pyx_string_tab[135] +#define __pyx_n_u_class_getitem __pyx_string_tab[136] +#define __pyx_n_u_clear_transient_orths __pyx_string_tab[137] +#define __pyx_n_u_cline_in_traceback __pyx_string_tab[138] +#define __pyx_n_u_close __pyx_string_tab[139] +#define __pyx_n_u_compat __pyx_string_tab[140] +#define __pyx_n_u_contextlib __pyx_string_tab[141] +#define __pyx_n_u_contextmanager __pyx_string_tab[142] +#define __pyx_n_u_contexts __pyx_string_tab[143] +#define __pyx_n_u_copy_reg __pyx_string_tab[144] +#define __pyx_n_u_count __pyx_string_tab[145] +#define __pyx_n_u_create_vocab __pyx_string_tab[146] +#define __pyx_n_u_data __pyx_string_tab[147] +#define __pyx_n_u_decode __pyx_string_tab[148] +#define __pyx_n_u_deduplicate_vectors __pyx_string_tab[149] +#define __pyx_n_u_default __pyx_string_tab[150] +#define __pyx_n_u_defaults __pyx_string_tab[151] +#define __pyx_n_u_deserialize_vectors __pyx_string_tab[152] +#define __pyx_n_u_dict __pyx_string_tab[153] +#define __pyx_n_u_dict_2 __pyx_string_tab[154] +#define __pyx_n_u_do_deprecated __pyx_string_tab[155] +#define __pyx_n_u_dtype __pyx_string_tab[156] +#define __pyx_n_u_dtype_is_object __pyx_string_tab[157] +#define __pyx_n_u_encode __pyx_string_tab[158] +#define __pyx_n_u_ensure_path __pyx_string_tab[159] +#define __pyx_n_u_enter __pyx_string_tab[160] +#define __pyx_n_u_enter_context __pyx_string_tab[161] +#define __pyx_n_u_enumerate __pyx_string_tab[162] +#define __pyx_n_u_error __pyx_string_tab[163] +#define __pyx_n_u_errors __pyx_string_tab[164] +#define __pyx_n_u_exclude __pyx_string_tab[165] +#define __pyx_n_u_exists __pyx_string_tab[166] +#define __pyx_n_u_exit __pyx_string_tab[167] +#define __pyx_n_u_f __pyx_string_tab[168] +#define __pyx_n_u_filled __pyx_string_tab[169] +#define __pyx_n_u_flag_getter __pyx_string_tab[170] +#define __pyx_n_u_flag_id __pyx_string_tab[171] +#define __pyx_n_u_flags __pyx_string_tab[172] +#define __pyx_n_u_format __pyx_string_tab[173] +#define __pyx_n_u_fortran __pyx_string_tab[174] +#define __pyx_n_u_from_bytes __pyx_string_tab[175] +#define __pyx_n_u_from_bytes_locals_lambda __pyx_string_tab[176] +#define __pyx_n_u_from_bytes_locals_serialize_vect __pyx_string_tab[177] +#define __pyx_n_u_from_disk __pyx_string_tab[178] +#define __pyx_n_u_func __pyx_string_tab[179] +#define __pyx_n_u_functools __pyx_string_tab[180] +#define __pyx_n_u_get __pyx_string_tab[181] +#define __pyx_n_u_get_array_module __pyx_string_tab[182] +#define __pyx_n_u_get_current_ops __pyx_string_tab[183] +#define __pyx_n_u_get_lang __pyx_string_tab[184] +#define __pyx_n_u_get_noun_chunks __pyx_string_tab[185] +#define __pyx_n_u_get_table __pyx_string_tab[186] +#define __pyx_n_u_get_vector __pyx_string_tab[187] +#define __pyx_n_u_getstate __pyx_string_tab[188] +#define __pyx_n_u_getters __pyx_string_tab[189] +#define __pyx_n_u_has_table __pyx_string_tab[190] +#define __pyx_n_u_has_vector __pyx_string_tab[191] +#define __pyx_n_u_i __pyx_string_tab[192] +#define __pyx_n_u_id __pyx_string_tab[193] +#define __pyx_n_u_import __pyx_string_tab[194] +#define __pyx_n_u_in_memory_zone __pyx_string_tab[195] +#define __pyx_n_u_index __pyx_string_tab[196] +#define __pyx_n_u_indices __pyx_string_tab[197] +#define __pyx_n_u_intify_attrs __pyx_string_tab[198] +#define __pyx_n_u_is_coroutine __pyx_string_tab[199] +#define __pyx_n_u_is_full __pyx_string_tab[200] +#define __pyx_n_u_is_stop __pyx_string_tab[201] +#define __pyx_n_u_items __pyx_string_tab[202] +#define __pyx_n_u_itemsize __pyx_string_tab[203] +#define __pyx_n_u_iter __pyx_string_tab[204] +#define __pyx_n_u_keep __pyx_string_tab[205] +#define __pyx_n_u_key __pyx_string_tab[206] +#define __pyx_n_u_key2row __pyx_string_tab[207] +#define __pyx_n_u_keys __pyx_string_tab[208] +#define __pyx_n_u_lambda __pyx_string_tab[209] +#define __pyx_n_u_lang __pyx_string_tab[210] +#define __pyx_n_u_lang_lex_attrs __pyx_string_tab[211] +#define __pyx_n_u_lang_norm_exceptions __pyx_string_tab[212] +#define __pyx_n_u_lex __pyx_string_tab[213] +#define __pyx_n_u_lex_attr_getters __pyx_string_tab[214] +#define __pyx_n_u_lex_attrs __pyx_string_tab[215] +#define __pyx_n_u_lexeme_norm __pyx_string_tab[216] +#define __pyx_n_u_lookups __pyx_string_tab[217] +#define __pyx_n_u_main __pyx_string_tab[218] +#define __pyx_n_u_max_length __pyx_string_tab[219] +#define __pyx_n_u_mem __pyx_string_tab[220] +#define __pyx_n_u_memory_zone __pyx_string_tab[221] +#define __pyx_n_u_memview __pyx_string_tab[222] +#define __pyx_n_u_method __pyx_string_tab[223] +#define __pyx_n_u_mkdir __pyx_string_tab[224] +#define __pyx_n_u_mode __pyx_string_tab[225] +#define __pyx_n_u_module __pyx_string_tab[226] +#define __pyx_n_u_morph __pyx_string_tab[227] +#define __pyx_n_u_morphology __pyx_string_tab[228] +#define __pyx_n_u_most_similar __pyx_string_tab[229] +#define __pyx_n_u_name __pyx_string_tab[230] +#define __pyx_n_u_name_2 __pyx_string_tab[231] +#define __pyx_n_u_ndim __pyx_string_tab[232] +#define __pyx_n_u_new __pyx_string_tab[233] +#define __pyx_n_u_new_rows __pyx_string_tab[234] +#define __pyx_n_u_next __pyx_string_tab[235] +#define __pyx_n_u_noun_chunks __pyx_string_tab[236] +#define __pyx_n_u_nr_row __pyx_string_tab[237] +#define __pyx_n_u_numpy __pyx_string_tab[238] +#define __pyx_n_u_obj __pyx_string_tab[239] +#define __pyx_n_u_oov_prob __pyx_string_tab[240] +#define __pyx_n_u_ops __pyx_string_tab[241] +#define __pyx_n_u_orth __pyx_string_tab[242] +#define __pyx_n_u_orth_2 __pyx_string_tab[243] +#define __pyx_n_u_orth_id __pyx_string_tab[244] +#define __pyx_n_u_pack __pyx_string_tab[245] +#define __pyx_n_u_partial __pyx_string_tab[246] +#define __pyx_n_u_path __pyx_string_tab[247] +#define __pyx_n_u_pickle __pyx_string_tab[248] +#define __pyx_n_u_pickle_dumps __pyx_string_tab[249] +#define __pyx_n_u_pickle_loads __pyx_string_tab[250] +#define __pyx_n_u_pickle_vocab __pyx_string_tab[251] +#define __pyx_n_u_pop __pyx_string_tab[252] +#define __pyx_n_u_priority __pyx_string_tab[253] +#define __pyx_n_u_prob __pyx_string_tab[254] +#define __pyx_n_u_prune_vectors __pyx_string_tab[255] +#define __pyx_n_u_pyx_capi __pyx_string_tab[256] +#define __pyx_n_u_pyx_checksum __pyx_string_tab[257] +#define __pyx_n_u_pyx_result __pyx_string_tab[258] +#define __pyx_n_u_pyx_state __pyx_string_tab[259] +#define __pyx_n_u_pyx_type __pyx_string_tab[260] +#define __pyx_n_u_pyx_unpickle_Enum __pyx_string_tab[261] +#define __pyx_n_u_pyx_unpickle_Vocab __pyx_string_tab[262] +#define __pyx_n_u_pyx_vtable __pyx_string_tab[263] +#define __pyx_n_u_qualname __pyx_string_tab[264] +#define __pyx_n_u_rank __pyx_string_tab[265] +#define __pyx_n_u_reduce __pyx_string_tab[266] +#define __pyx_n_u_reduce_cython __pyx_string_tab[267] +#define __pyx_n_u_reduce_ex __pyx_string_tab[268] +#define __pyx_n_u_register __pyx_string_tab[269] +#define __pyx_n_u_remap __pyx_string_tab[270] +#define __pyx_n_u_reset_cache __pyx_string_tab[271] +#define __pyx_n_u_reset_vectors __pyx_string_tab[272] +#define __pyx_n_u_resize __pyx_string_tab[273] +#define __pyx_n_u_return __pyx_string_tab[274] +#define __pyx_n_u_row __pyx_string_tab[275] +#define __pyx_n_u_row_by_bytes __pyx_string_tab[276] +#define __pyx_n_u_score __pyx_string_tab[277] +#define __pyx_n_u_scores __pyx_string_tab[278] +#define __pyx_n_u_self __pyx_string_tab[279] +#define __pyx_n_u_send __pyx_string_tab[280] +#define __pyx_n_u_serialize_vectors __pyx_string_tab[281] +#define __pyx_n_u_set_flag __pyx_string_tab[282] +#define __pyx_n_u_set_name __pyx_string_tab[283] +#define __pyx_n_u_set_vector __pyx_string_tab[284] +#define __pyx_n_u_setdefault __pyx_string_tab[285] +#define __pyx_n_u_setstate __pyx_string_tab[286] +#define __pyx_n_u_setstate_cython __pyx_string_tab[287] +#define __pyx_n_u_setters __pyx_string_tab[288] +#define __pyx_n_u_shape __pyx_string_tab[289] +#define __pyx_n_u_size __pyx_string_tab[290] +#define __pyx_n_u_spacy_vocab __pyx_string_tab[291] +#define __pyx_n_u_srsly __pyx_string_tab[292] +#define __pyx_n_u_sstore __pyx_string_tab[293] +#define __pyx_n_u_stack __pyx_string_tab[294] +#define __pyx_n_u_start __pyx_string_tab[295] +#define __pyx_n_u_state __pyx_string_tab[296] +#define __pyx_n_u_step __pyx_string_tab[297] +#define __pyx_n_u_stop __pyx_string_tab[298] +#define __pyx_n_u_stop_words __pyx_string_tab[299] +#define __pyx_n_u_stops __pyx_string_tab[300] +#define __pyx_n_u_string __pyx_string_tab[301] +#define __pyx_n_u_strings __pyx_string_tab[302] +#define __pyx_n_u_strings_map __pyx_string_tab[303] +#define __pyx_n_u_struct __pyx_string_tab[304] +#define __pyx_n_u_syn_keys __pyx_string_tab[305] +#define __pyx_n_u_syn_rows __pyx_string_tab[306] +#define __pyx_n_u_synonym __pyx_string_tab[307] +#define __pyx_n_u_syntax_iterators __pyx_string_tab[308] +#define __pyx_n_u_test __pyx_string_tab[309] +#define __pyx_n_u_thinc_api __pyx_string_tab[310] +#define __pyx_n_u_throw __pyx_string_tab[311] +#define __pyx_n_u_to_bytes __pyx_string_tab[312] +#define __pyx_n_u_to_bytes_locals_deserialize_vect __pyx_string_tab[313] +#define __pyx_n_u_to_bytes_locals_lambda __pyx_string_tab[314] +#define __pyx_n_u_to_disk __pyx_string_tab[315] +#define __pyx_n_u_to_numpy __pyx_string_tab[316] +#define __pyx_n_u_tobytes __pyx_string_tab[317] +#define __pyx_n_u_toss __pyx_string_tab[318] +#define __pyx_n_u_typing __pyx_string_tab[319] +#define __pyx_n_u_uint64 __pyx_string_tab[320] +#define __pyx_n_u_unique __pyx_string_tab[321] +#define __pyx_n_u_unpack __pyx_string_tab[322] +#define __pyx_n_u_unpickle_vocab __pyx_string_tab[323] +#define __pyx_n_u_unused_object __pyx_string_tab[324] +#define __pyx_n_u_update __pyx_string_tab[325] +#define __pyx_n_u_use_setstate __pyx_string_tab[326] +#define __pyx_n_u_utf8 __pyx_string_tab[327] +#define __pyx_n_u_util __pyx_string_tab[328] +#define __pyx_n_u_value __pyx_string_tab[329] +#define __pyx_n_u_values __pyx_string_tab[330] +#define __pyx_n_u_vector __pyx_string_tab[331] +#define __pyx_n_u_vectors __pyx_string_tab[332] +#define __pyx_n_u_vectors_length __pyx_string_tab[333] +#define __pyx_n_u_vectors_name __pyx_string_tab[334] +#define __pyx_n_u_vectors_type __pyx_string_tab[335] +#define __pyx_n_u_vocab __pyx_string_tab[336] +#define __pyx_n_u_width __pyx_string_tab[337] +#define __pyx_n_u_word __pyx_string_tab[338] +#define __pyx_n_u_writing_system __pyx_string_tab[339] +#define __pyx_n_u_x __pyx_string_tab[340] +#define __pyx_n_u_xp __pyx_string_tab[341] +#define __pyx_n_u_zeros __pyx_string_tab[342] +#define __pyx_kp_b_int_const_MISSING_DEP __pyx_string_tab[343] +#define __pyx_kp_b_iso88591_0_Q_q_q_q_Kq_IQ_D_l_T_hjXYYZ_Ja __pyx_string_tab[344] +#define __pyx_kp_b_iso88591_1F __pyx_string_tab[345] +#define __pyx_kp_b_iso88591_1_84q_uAS_4wd_a_j_q_S_3hb_AV5_q __pyx_string_tab[346] +#define __pyx_kp_b_iso88591_4z_j_AV5_q_7H_UYYZZ___6_T_wa_AV __pyx_string_tab[347] +#define __pyx_kp_b_iso88591_A __pyx_string_tab[348] +#define __pyx_kp_b_iso88591_A_0 __pyx_string_tab[349] +#define __pyx_kp_b_iso88591_A_4z_j_AV5_q_7Nm____dde_4xvS_1_A __pyx_string_tab[350] +#define __pyx_kp_b_iso88591_A_HD_Qd_81_V1 __pyx_string_tab[351] +#define __pyx_kp_b_iso88591_A_QfA_4xt1F_aq_AS_D_4_1_4xq_Qd_F __pyx_string_tab[352] +#define __pyx_kp_b_iso88591_A_QfA_4xt1F_aq_AS_D_4xy_D_t1_5_1 __pyx_string_tab[353] +#define __pyx_kp_b_iso88591_A_QfA_4xt1F_aq_AS_D_t3d __pyx_string_tab[354] +#define __pyx_kp_b_iso88591_A_a __pyx_string_tab[355] +#define __pyx_kp_b_iso88591_Qk_9F_Qhixq_q_Qhd_a_QfIQa_5_xq __pyx_string_tab[356] +#define __pyx_kp_b_iso88591_T_D_4_tCVVZZkkoozz_E_E_I_I __pyx_string_tab[357] +#define __pyx_kp_b_iso88591_U_e1_E_U_uM_q_e1_e1_A_Yg_55GyPQ __pyx_string_tab[358] +#define __pyx_kp_b_iso88591_a_t_q_WA_5_WA_t9G1_HJavXQa_WA_1 __pyx_string_tab[359] +#define __pyx_kp_b_iso88591_q6_4z_j_AV5_q_7H_UYYZZ___4xvS_1 __pyx_string_tab[360] +#define __pyx_kp_b_iso88591_q_0_kQR_5_7_q_a_1 __pyx_string_tab[361] +#define __pyx_kp_b_iso88591_q_q_q_q_t9AYa __pyx_string_tab[362] +#define __pyx_kp_b_iso88591_t9Cq_q_t89AXQa __pyx_string_tab[363] +#define __pyx_kp_b_iso88591_t9Cq_q_t8_as_1 __pyx_string_tab[364] +#define __pyx_kp_b_iso88591_uA_A_A_q_1_U_q_A_A_1 __pyx_string_tab[365] +#define __pyx_kp_b_iso88591_uA_t_q_4t7_a_WA_b_WA_xq_WA __pyx_string_tab[366] +#define __pyx_kp_b_iso88591_xt89A __pyx_string_tab[367] +#define __pyx_kp_b_iso88591_z_2_1 __pyx_string_tab[368] +#define __pyx_kp_b_iso88591_z_X __pyx_string_tab[369] +#define __pyx_kp_b_pyx_t_5spacy_8typedefs_attr_t __pyx_string_tab[370] +#define __pyx_kp_b_struct___pyx_t_5spacy_7structs_L __pyx_string_tab[371] +#define __pyx_kp_b_uint64_t_void_int_uint64_t_hash6 __pyx_string_tab[372] +#define __pyx_kp_b_void_struct___pyx_t_7preshed_4ma __pyx_string_tab[373] +#define __pyx_n_b_O __pyx_string_tab[374] +#define __pyx_float_1_3 __pyx_number_tab[0] +#define __pyx_float_neg_20_ __pyx_number_tab[1] +#define __pyx_int_0 __pyx_number_tab[2] +#define __pyx_int_neg_1 __pyx_number_tab[3] +#define __pyx_int_1 __pyx_number_tab[4] +#define __pyx_int_1024 __pyx_number_tab[5] +#define __pyx_int_39514986 __pyx_number_tab[6] +#define __pyx_int_136983863 __pyx_number_tab[7] +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { + __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #if CYTHON_PEP489_MULTI_PHASE_INIT + __Pyx_State_RemoveModule(NULL); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_CLEAR(clear_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_CLEAR(clear_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_6tokens_5token_Token); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_5vocab_Vocab); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_5vocab___pyx_scope_struct__memory_zone); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_5vocab___pyx_scope_struct_1___iter__); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_5vocab___pyx_scope_struct_2_to_bytes); + Py_CLEAR(clear_module_state->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes); + Py_CLEAR(clear_module_state->__pyx_type_5spacy_5vocab___pyx_scope_struct_3_from_bytes); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + Py_CLEAR(clear_module_state->__pyx_k__6); + Py_CLEAR(clear_module_state->__pyx_k__7); + Py_CLEAR(clear_module_state->__pyx_k__10); + Py_CLEAR(clear_module_state->__pyx_k__11); + Py_CLEAR(clear_module_state->__pyx_k__12); + Py_CLEAR(clear_module_state->__pyx_k__13); + for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); } + for (int i=0; i<6; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } + for (int i=0; i<28; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<375; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } + for (int i=0; i<8; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } +/* #### Code section: module_state_clear_contents ### */ +/* CommonTypesMetaclass.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + +/* Generator.module_state_clear */ +Py_CLEAR(clear_module_state->__pyx_GeneratorType); + +/* #### Code section: module_state_clear_end ### */ +return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); + __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyMalloc); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_PyFree); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Pool); + Py_VISIT(traverse_module_state->__pyx_ptype_5cymem_5cymem_Address); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMap); + Py_VISIT(traverse_module_state->__pyx_ptype_7preshed_4maps_PreshMapArray); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_7strings_StringStore); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_10morphology_Morphology); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6lexeme_Lexeme); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6tokens_3doc_Doc); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_6tokens_5token_Token); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab_Vocab); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_5vocab_Vocab); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_5vocab___pyx_scope_struct__memory_zone); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_5vocab___pyx_scope_struct_1___iter__); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_5vocab___pyx_scope_struct_2_to_bytes); + Py_VISIT(traverse_module_state->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes); + Py_VISIT(traverse_module_state->__pyx_type_5spacy_5vocab___pyx_scope_struct_3_from_bytes); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + Py_VISIT(traverse_module_state->__pyx_k__6); + Py_VISIT(traverse_module_state->__pyx_k__7); + Py_VISIT(traverse_module_state->__pyx_k__10); + Py_VISIT(traverse_module_state->__pyx_k__11); + Py_VISIT(traverse_module_state->__pyx_k__12); + Py_VISIT(traverse_module_state->__pyx_k__13); + for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); } + for (int i=0; i<6; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } + for (int i=0; i<28; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } + for (int i=0; i<375; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } + for (int i=0; i<8; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } +/* #### Code section: module_state_traverse_contents ### */ +/* CommonTypesMetaclass.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); + +/* CythonFunctionShared.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + +/* Generator.module_state_traverse */ +Py_VISIT(traverse_module_state->__pyx_GeneratorType); + +/* #### Code section: module_state_traverse_end ### */ +return 0; +} +#endif +/* #### Code section: module_code ### */ + +/* "vector.to_py":79 + * const Py_ssize_t PY_SSIZE_T_MAX + * + * @cname("__pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t") # <<<<<<<<<<<<<< + * cdef object __pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: +*/ + +static PyObject *__pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t(std::vector<__pyx_t_5spacy_8typedefs_attr_t> const &__pyx_v_v) { + Py_ssize_t __pyx_v_v_size_signed; + PyObject *__pyx_v_o = NULL; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_v_item = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t", 0); + + /* "vector.to_py":81 + * @cname("__pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t") + * cdef object __pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: # <<<<<<<<<<<<<< + * raise MemoryError() + * v_size_signed = v.size() +*/ + __pyx_t_1 = (__pyx_v_v.size() > ((size_t)PY_SSIZE_T_MAX)); + if (unlikely(__pyx_t_1)) { + + /* "vector.to_py":82 + * cdef object __pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: + * raise MemoryError() # <<<<<<<<<<<<<< + * v_size_signed = v.size() + * +*/ + PyErr_NoMemory(); __PYX_ERR(1, 82, __pyx_L1_error) + + /* "vector.to_py":81 + * @cname("__pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t") + * cdef object __pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: # <<<<<<<<<<<<<< + * raise MemoryError() + * v_size_signed = v.size() +*/ + } + + /* "vector.to_py":83 + * if v.size() > PY_SSIZE_T_MAX: + * raise MemoryError() + * v_size_signed = v.size() # <<<<<<<<<<<<<< + * + * o = PyList_New(v_size_signed) +*/ + __pyx_v_v_size_signed = ((Py_ssize_t)__pyx_v_v.size()); + + /* "vector.to_py":85 + * v_size_signed = v.size() + * + * o = PyList_New(v_size_signed) # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t i +*/ + __pyx_t_2 = PyList_New(__pyx_v_v_size_signed); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_o = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "vector.to_py":90 + * cdef object item + * + * for i in range(v_size_signed): # <<<<<<<<<<<<<< + * item = v[i] + * Py_INCREF(item) +*/ + __pyx_t_3 = __pyx_v_v_size_signed; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "vector.to_py":91 + * + * for i in range(v_size_signed): + * item = v[i] # <<<<<<<<<<<<<< + * Py_INCREF(item) + * __Pyx_PyList_SET_ITEM(o, i, item) +*/ + __pyx_t_2 = __Pyx_PyLong_From_uint64_t((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_2); + __pyx_t_2 = 0; + + /* "vector.to_py":92 + * for i in range(v_size_signed): + * item = v[i] + * Py_INCREF(item) # <<<<<<<<<<<<<< + * __Pyx_PyList_SET_ITEM(o, i, item) + * +*/ + Py_INCREF(__pyx_v_item); + + /* "vector.to_py":93 + * item = v[i] + * Py_INCREF(item) + * __Pyx_PyList_SET_ITEM(o, i, item) # <<<<<<<<<<<<<< + * + * return o +*/ + __pyx_t_6 = __Pyx_PyList_SET_ITEM(__pyx_v_o, __pyx_v_i, __pyx_v_item); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 93, __pyx_L1_error) + } + + /* "vector.to_py":95 + * __Pyx_PyList_SET_ITEM(o, i, item) + * + * return o # <<<<<<<<<<<<<< +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_o); + __pyx_r = __pyx_v_o; + goto __pyx_L0; + + /* "vector.to_py":79 + * const Py_ssize_t PY_SSIZE_T_MAX + * + * @cname("__pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t") # <<<<<<<<<<<<<< + * cdef object __pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t(const vector[X]& v): + * if v.size() > PY_SSIZE_T_MAX: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_o); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "vector.from_py":51 + * cdef Py_ssize_t __Pyx_PyObject_LengthHint(object o, Py_ssize_t defaultval) except -1 + * + * @cname("__pyx_convert_vector_from_py___pyx_t_5spacy_8typedefs_attr_t") # <<<<<<<<<<<<<< + * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_5spacy_8typedefs_attr_t(object o) except *: + * +*/ + +static std::vector<__pyx_t_5spacy_8typedefs_attr_t> __pyx_convert_vector_from_py___pyx_t_5spacy_8typedefs_attr_t(PyObject *__pyx_v_o) { + std::vector<__pyx_t_5spacy_8typedefs_attr_t> __pyx_v_v; + Py_ssize_t __pyx_v_s; + PyObject *__pyx_v_item = NULL; + std::vector<__pyx_t_5spacy_8typedefs_attr_t> __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py___pyx_t_5spacy_8typedefs_attr_t", 0); + + /* "vector.from_py":55 + * + * cdef vector[X] v + * cdef Py_ssize_t s = __Pyx_PyObject_LengthHint(o, 0) # <<<<<<<<<<<<<< + * + * if s > 0: +*/ + __pyx_t_1 = __Pyx_PyObject_LengthHint(__pyx_v_o, 0); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1L))) __PYX_ERR(1, 55, __pyx_L1_error) + __pyx_v_s = __pyx_t_1; + + /* "vector.from_py":57 + * cdef Py_ssize_t s = __Pyx_PyObject_LengthHint(o, 0) + * + * if s > 0: # <<<<<<<<<<<<<< + * v.reserve( s) + * +*/ + __pyx_t_2 = (__pyx_v_s > 0); + if (__pyx_t_2) { + + /* "vector.from_py":58 + * + * if s > 0: + * v.reserve( s) # <<<<<<<<<<<<<< + * + * for item in o: +*/ + try { + __pyx_v_v.reserve(((size_t)__pyx_v_s)); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(1, 58, __pyx_L1_error) + } + + /* "vector.from_py":57 + * cdef Py_ssize_t s = __Pyx_PyObject_LengthHint(o, 0) + * + * if s > 0: # <<<<<<<<<<<<<< + * v.reserve( s) + * +*/ + } + + /* "vector.from_py":60 + * v.reserve( s) + * + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * +*/ + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_3 = __pyx_v_o; __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 60, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 60, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_1; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 60, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_1); + #endif + ++__pyx_t_1; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 60, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_3); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 60, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_5); + __pyx_t_5 = 0; + + /* "vector.from_py":61 + * + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * + * return v +*/ + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_v_item); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 61, __pyx_L1_error) + try { + __pyx_v_v.push_back(((__pyx_t_5spacy_8typedefs_attr_t)__pyx_t_6)); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(1, 61, __pyx_L1_error) + } + + /* "vector.from_py":60 + * v.reserve( s) + * + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * +*/ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "vector.from_py":63 + * v.push_back(item) + * + * return v # <<<<<<<<<<<<<< + * +*/ + __pyx_r = __pyx_v_v; + goto __pyx_L0; + + /* "vector.from_py":51 + * cdef Py_ssize_t __Pyx_PyObject_LengthHint(object o, Py_ssize_t defaultval) except -1 + * + * @cname("__pyx_convert_vector_from_py___pyx_t_5spacy_8typedefs_attr_t") # <<<<<<<<<<<<<< + * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_5spacy_8typedefs_attr_t(object o) except *: + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py___pyx_t_5spacy_8typedefs_attr_t", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + +/* Python wrapper */ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_shape,&__pyx_mstate_global->__pyx_n_u_itemsize,&__pyx_mstate_global->__pyx_n_u_format,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_allocate_buffer,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 129, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(1, 129, __pyx_L3_error) + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, i); __PYX_ERR(1, 129, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(1, 129, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 129, __pyx_L3_error) + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 129, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 129, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_c)); + } + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 129, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 130, __pyx_L3_error) + } else { + + /* "View.MemoryView":130 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx +*/ + __pyx_v_allocate_buffer = ((int)1); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 129, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 129, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 129, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11[5]; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); + + /* "View.MemoryView":135 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * +*/ + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 135, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 135, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); + + /* "View.MemoryView":136 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: +*/ + __pyx_v_self->itemsize = __pyx_v_itemsize; + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":139 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 139, __pyx_L1_error) + + /* "View.MemoryView":138 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * +*/ + } + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":142 + * + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 142, __pyx_L1_error) + + /* "View.MemoryView":141 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * +*/ + } + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + + /* "View.MemoryView":145 + * + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format +*/ + __pyx_t_5 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":144 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string +*/ + } + + /* "View.MemoryView":146 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * +*/ + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 146, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":147 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * + * +*/ + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 147, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 147, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_7; + + /* "View.MemoryView":150 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * +*/ + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + + /* "View.MemoryView":151 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: +*/ + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":154 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 154, __pyx_L1_error) + + /* "View.MemoryView":153 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * +*/ + } + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + __pyx_t_8 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 157, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); + #endif + ++__pyx_t_1; + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_8; + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":159 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim + * +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis; + __pyx_t_11[1] = __pyx_t_5; + __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_; + __pyx_t_11[3] = __pyx_t_10; + __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u__2; + __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 5, 22 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127); + if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 159, __pyx_L1_error) + + /* "View.MemoryView":158 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim +*/ + } + + /* "View.MemoryView":160 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order +*/ + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; + + /* "View.MemoryView":157 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 163, __pyx_L1_error) + if (__pyx_t_3) { + + /* "View.MemoryView":164 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': +*/ + __pyx_v_order = 'C'; + + /* "View.MemoryView":165 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_c; + + /* "View.MemoryView":163 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 166, __pyx_L1_error) + if (likely(__pyx_t_3)) { + + /* "View.MemoryView":167 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: +*/ + __pyx_v_order = 'F'; + + /* "View.MemoryView":168 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_mstate_global->__pyx_n_u_fortran; + + /* "View.MemoryView":166 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":170 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) +*/ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_12, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __PYX_ERR(1, 170, __pyx_L1_error) + } + __pyx_L11:; + + /* "View.MemoryView":172 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer +*/ + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); + + /* "View.MemoryView":174 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * +*/ + __pyx_v_self->free_data = __pyx_v_allocate_buffer; + + /* "View.MemoryView":175 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: +*/ + __pyx_t_12 = PyObject_RichCompare(__pyx_v_format, __pyx_mstate_global->__pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 175, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 175, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + if (__pyx_v_allocate_buffer) { + + /* "View.MemoryView":178 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_t_8 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 178, __pyx_L1_error) + + /* "View.MemoryView":177 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * +*/ + } + + /* "View.MemoryView":129 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":182 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": +*/ + __pyx_v_bufmode = -1; + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 184, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":185 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":184 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_mstate_global->__pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":187 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." +*/ + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":186 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): +*/ + } + __pyx_L4:; + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":189 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 189, __pyx_L1_error) + + /* "View.MemoryView":188 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data +*/ + } + + /* "View.MemoryView":183 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS +*/ + } + + /* "View.MemoryView":190 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len + * +*/ + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; + + /* "View.MemoryView":191 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":194 + * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides +*/ + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; + + /* "View.MemoryView":195 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: +*/ + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":196 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 +*/ + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; + + /* "View.MemoryView":193 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":198 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL +*/ + /*else*/ { + __pyx_v_info->ndim = 1; + + /* "View.MemoryView":199 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; + } + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":200 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< + * + * info.suboffsets = NULL +*/ + __pyx_v_info->strides = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":202 + * info.strides = NULL + * + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 +*/ + __pyx_v_info->suboffsets = NULL; + + /* "View.MemoryView":203 + * + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL +*/ + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":204 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self +*/ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":205 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; + } + __pyx_v_info->format = __pyx_t_2; + + /* "View.MemoryView":206 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< + * + * def __dealloc__(array self): +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":180 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + +/* Python wrapper */ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":210 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: +*/ + __pyx_v_self->callback_free_data(__pyx_v_self->data); + + /* "View.MemoryView":209 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":213 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + + /* "View.MemoryView":212 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) +*/ + } + + /* "View.MemoryView":214 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) + * +*/ + free(__pyx_v_self->data); + + /* "View.MemoryView":211 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) +*/ + } + __pyx_L3:; + + /* "View.MemoryView":215 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + * + * @property +*/ + PyObject_Free(__pyx_v_self->_shape); + + /* "View.MemoryView":208 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":219 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< + * + * @cname('get_memview') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":217 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); + + /* "View.MemoryView":223 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) + * +*/ + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + + /* "View.MemoryView":224 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 224, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":221 + * return self.get_memview() + * + * @cname('get_memview') # <<<<<<<<<<<<<< + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + + /* "View.MemoryView":227 + * + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< + * + * def __getattr__(self, attr): +*/ + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":226 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); + + /* "View.MemoryView":230 + * + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, item): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":229 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":233 + * + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< + * + * def __setitem__(self, item, value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "View.MemoryView":236 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 236, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":252 + * cdef PyObject **p + * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: +*/ + __pyx_v_self->free_data = 1; + + /* "View.MemoryView":253 + * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." +*/ + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":255 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_MemoryError))), __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 255, __pyx_L1_error) + + /* "View.MemoryView":254 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * +*/ + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":258 + * + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None +*/ + __pyx_v_p = ((PyObject **)__pyx_v_self->data); + + /* "View.MemoryView":259 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) +*/ + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 259, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize, 0); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":260 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 +*/ + (__pyx_v_p[__pyx_v_i]) = Py_None; + + /* "View.MemoryView":261 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 + * +*/ + Py_INCREF(Py_None); + } + + /* "View.MemoryView":257 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): +*/ + } + + /* "View.MemoryView":262 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":245 + * pass + * + * @cname("__pyx_array_allocate_buffer") # <<<<<<<<<<<<<< + * cdef int _allocate_buffer(array self) except -1: + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char const *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); + + /* "View.MemoryView":268 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< + * + * if buf is NULL: +*/ + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fortran); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_fortran; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_c); + __pyx_t_1 = __pyx_mstate_global->__pyx_n_u_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":271 + * + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) +*/ + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 271, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 271, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":270 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":273 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf + * +*/ + /*else*/ { + __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode) != (0)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_allocate_buffer, Py_False) < (0)) __PYX_ERR(1, 273, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_mstate_global->__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":274 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->data = __pyx_v_buf; + } + __pyx_L3:; + + /* "View.MemoryView":276 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":265 + * + * + * @cname("__pyx_array_new") # <<<<<<<<<<<<<< + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, const char *c_mode, char *buf): + * cdef array result +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + +/* Python wrapper */ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_name,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 302, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 302, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(1, 302, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(1, 302, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 302, __pyx_L3_error) + } + __pyx_v_name = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 302, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "View.MemoryView":303 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name +*/ + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; + + /* "View.MemoryView":302 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): +*/ + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":305 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< + * + * cdef generic = Enum("") +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; + + /* "View.MemoryView":304 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_3 = (__pyx_v__dict != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_2 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('self.name is not None',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[0]); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('self.name is not None',) + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self.name is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_136983863) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 16, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 16, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 16, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error) + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_v___pyx_state; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(1, 17, __pyx_L1_error) + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 17, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + +/* Python wrapper */ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_obj,&__pyx_mstate_global->__pyx_n_u_flags,&__pyx_mstate_global->__pyx_n_u_dtype_is_object,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 348, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(1, 348, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, i); __PYX_ERR(1, 348, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 348, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 348, __pyx_L3_error) + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 348, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 348, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 348, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "View.MemoryView":349 + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: +*/ + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; + + /* "View.MemoryView":350 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) +*/ + __pyx_v_self->flags = __pyx_v_flags; + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_mstate_global->__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":352 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None +*/ + __pyx_t_3 = PyObject_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 352, __pyx_L1_error) + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":354 + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + + /* "View.MemoryView":355 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":353 + * if type(self) is memoryview or obj is not None: + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + } + + /* "View.MemoryView":351 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * PyObject_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + __pyx_t_2 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L9_bool_binop_done; + } + + /* "View.MemoryView":361 + * if (__pyx_memoryview_thread_locks_used < 8 and + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 +*/ + __pyx_t_2 = (!__PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()); + __pyx_t_1 = __pyx_t_2; + __pyx_L9_bool_binop_done:; + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":362 + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: +*/ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + + /* "View.MemoryView":363 + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":359 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and # <<<<<<<<<<<<<< + * + * not __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING()): +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":365 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError +*/ + __pyx_v_self->lock = PyThread_allocate_lock(); + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":367 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 367, __pyx_L1_error) + + /* "View.MemoryView":366 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * +*/ + } + + /* "View.MemoryView":364 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: +*/ + } + + /* "View.MemoryView":357 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if (__pyx_memoryview_thread_locks_used < 8 and +*/ + } + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":370 + * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object +*/ + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L14_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; + + /* "View.MemoryView":369 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":372 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 +*/ + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L13:; + + /* "View.MemoryView":374 + * self.dtype_is_object = dtype_is_object + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL + * +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 374, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 374, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 374, __pyx_L1_error) + #endif + + /* "View.MemoryView":375 + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(memoryview self): +*/ + __pyx_v_self->typeinfo = NULL; + + /* "View.MemoryView":348 + * cdef const __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + +/* Python wrapper */ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":379 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * PyBuffer_Release(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * +*/ + PyBuffer_Release((&__pyx_v_self->view)); + + /* "View.MemoryView":378 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":382 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + + /* "View.MemoryView":383 + * + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i +*/ + Py_DECREF(Py_None); + + /* "View.MemoryView":380 + * if self.obj is not None: + * PyBuffer_Release(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL +*/ + } + __pyx_L3:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":388 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 +*/ + __pyx_t_1 = __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING(); + if (__pyx_t_1) { + __pyx_t_2 = 0; + } else { + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + } + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { + + /* "View.MemoryView":390 + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( +*/ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { + + /* "View.MemoryView":393 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + + /* "View.MemoryView":392 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break +*/ + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; + + /* "View.MemoryView":391 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +*/ + } + + /* "View.MemoryView":394 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":389 + * if self.lock != NULL: + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: +*/ + } + } + /*else*/ { + + /* "View.MemoryView":396 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: +*/ + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; + + /* "View.MemoryView":387 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(0 if __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() else __pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: +*/ + } + + /* "View.MemoryView":377 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * PyBuffer_Release(&self.view) +*/ + + /* function exit code */ +} + +/* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_item_pointer", 0); + + /* "View.MemoryView":400 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + * + * for dim, idx in enumerate(index): +*/ + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 402, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_3, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_3; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 402, __pyx_L1_error) + #endif + if (__pyx_t_3 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); + #endif + ++__pyx_t_3; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 402, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 402, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); + + /* "View.MemoryView":403 + * + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + * + * return itemp +*/ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 403, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; + + /* "View.MemoryView":402 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":405 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + * return itemp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_itemp; + goto __pyx_L0; + + /* "View.MemoryView":398 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_idx); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { + + /* "View.MemoryView":410 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "View.MemoryView":409 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * +*/ + } + + /* "View.MemoryView":412 + * return self + * + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * cdef char *itemp +*/ + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 412, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 412, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 415, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":416 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":415 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: +*/ + } + + /* "View.MemoryView":418 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) + * +*/ + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((void *)NULL))) __PYX_ERR(1, 418, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; + + /* "View.MemoryView":419 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + * + * def __setitem__(memoryview self, object index, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":408 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + if (unlikely(__pyx_v_self->view.readonly)) { + + /* "View.MemoryView":423 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< + * + * have_slices, index = _unellipsify(index, self.view.ndim) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 423, __pyx_L1_error) + + /* "View.MemoryView":422 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * +*/ + } + + /* "View.MemoryView":425 + * raise TypeError, "Cannot assign to read-only memoryview" + * + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * if have_slices: +*/ + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 425, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 425, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 427, __pyx_L1_error) + if (__pyx_t_4) { + + /* "View.MemoryView":428 + * + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + __pyx_t_4 = (__pyx_v_obj != Py_None); + if (__pyx_t_4) { + + /* "View.MemoryView":430 + * obj = self.is_slice(value) + * if obj is not None: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "View.MemoryView":429 + * if have_slices: + * obj = self.is_slice(value) + * if obj is not None: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":432 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) +*/ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 432, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; + + /* "View.MemoryView":427 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj is not None: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":434 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + * + * cdef is_slice(self, obj): +*/ + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; + + /* "View.MemoryView":421 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "View.MemoryView":439 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: +*/ + __pyx_t_7 = NULL; + __pyx_t_8 = __Pyx_PyLong_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + + /* "View.MemoryView":440 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None +*/ + __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 440, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_obj, __pyx_t_8, __pyx_t_9}; + __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_10, (4-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF((PyObject *)__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_obj, ((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":441 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError)))); + if (__pyx_t_11) { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":442 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< + * + * return obj +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + + /* "View.MemoryView":438 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) +*/ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; + } + + /* "View.MemoryView":437 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, +*/ + } + + /* "View.MemoryView":444 + * return None + * + * return obj # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assignment(self, dst, src): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; + + /* "View.MemoryView":436 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * +*/ + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); + + /* "View.MemoryView":450 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) +*/ + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 450, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); + + /* "View.MemoryView":452 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_mstate_global->__pyx_n_u_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 452, __pyx_L1_error) + + /* "View.MemoryView":446 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[128]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + + /* "View.MemoryView":456 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item + * +*/ + __pyx_v_tmp = NULL; + + /* "View.MemoryView":461 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< + * + * if self.view.itemsize > sizeof(array): +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 461, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { + + /* "View.MemoryView":464 + * + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError +*/ + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":466 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: +*/ + PyErr_NoMemory(); __PYX_ERR(1, 466, __pyx_L1_error) + + /* "View.MemoryView":465 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp +*/ + } + + /* "View.MemoryView":467 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array +*/ + __pyx_v_item = __pyx_v_tmp; + + /* "View.MemoryView":463 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":469 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< + * + * try: +*/ + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; + + /* "View.MemoryView":471 + * item = array + * + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value +*/ + /*try:*/ { + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":473 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) +*/ + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + + /* "View.MemoryView":472 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":475 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":480 + * + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) +*/ + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 480, __pyx_L6_error) + + /* "View.MemoryView":479 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, +*/ + } + + /* "View.MemoryView":481 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: +*/ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } + + /* "View.MemoryView":484 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< + * + * cdef setitem_indexed(self, index, value): +*/ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ( unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } + + /* "View.MemoryView":454 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_indexed", 0); + + /* "View.MemoryView":487 + * + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) + * +*/ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 487, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; + + /* "View.MemoryView":488 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":486 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":493 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem + * +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 493, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":496 + * cdef bytes bytesitem + * + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) +*/ + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { + + /* "View.MemoryView":498 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" +*/ + __pyx_t_5 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_unpack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + } + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + /*else:*/ { + __pyx_t_8 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 502, __pyx_L5_except_error) + __pyx_t_9 = (__pyx_t_8 == 1); + if (__pyx_t_9) { + + /* "View.MemoryView":503 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 503, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; + + /* "View.MemoryView":502 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result +*/ + } + + /* "View.MemoryView":504 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "View.MemoryView":499 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: +*/ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_5); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_5); + __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; + if (__pyx_t_11) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 499, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_1); + + /* "View.MemoryView":500 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 500, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "View.MemoryView":497 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; + } + + /* "View.MemoryView":490 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + char *__pyx_t_11; + Py_ssize_t __pyx_t_12; + char *__pyx_t_13; + char *__pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":509 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue +*/ + __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_struct, 0, 0, NULL, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 509, __pyx_L1_error) + __pyx_t_1 = __pyx_t_2; + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + __pyx_t_3 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_3) { + + /* "View.MemoryView":515 + * + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_mstate_global->__pyx_n_u_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4) != (0)) __PYX_ERR(1, 515, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 515, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":514 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":517 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< + * + * for i, c in enumerate(bytesvalue): +*/ + /*else*/ { + __pyx_t_6 = __pyx_v_struct; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_value}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_pack, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(1, 517, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 519, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_9 = __pyx_v_bytesvalue; + __pyx_t_11 = __Pyx_PyBytes_AsWritableString(__pyx_t_9); if (unlikely(__pyx_t_11 == ((char *)NULL))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyBytes_GET_SIZE(__pyx_t_9); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(1, 519, __pyx_L1_error) + __pyx_t_13 = (__pyx_t_11 + __pyx_t_12); + for (__pyx_t_14 = __pyx_t_11; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { + __pyx_t_10 = __pyx_t_14; + __pyx_v_c = (__pyx_t_10[0]); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + __pyx_v_i = __pyx_t_8; + + /* "View.MemoryView":519 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * +*/ + __pyx_t_8 = (__pyx_t_8 + 1); + + /* "View.MemoryView":520 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') +*/ + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":506 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":525 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 525, __pyx_L1_error) + + /* "View.MemoryView":524 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * +*/ + } + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":528 + * + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; + + /* "View.MemoryView":527 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":530 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: +*/ + /*else*/ { + __pyx_v_info->shape = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":533 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; + + /* "View.MemoryView":532 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":535 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_INDIRECT: +*/ + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":538 + * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL +*/ + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; + + /* "View.MemoryView":537 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":540 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: +*/ + /*else*/ { + __pyx_v_info->suboffsets = NULL; + } + __pyx_L8:; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":543 + * + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL +*/ + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; + + /* "View.MemoryView":542 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":545 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< + * + * info.buf = self.view.buf +*/ + /*else*/ { + __pyx_v_info->format = NULL; + } + __pyx_L9:; + + /* "View.MemoryView":547 + * info.format = NULL + * + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize +*/ + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; + + /* "View.MemoryView":548 + * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len +*/ + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; + + /* "View.MemoryView":549 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly +*/ + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; + + /* "View.MemoryView":550 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self +*/ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; + + /* "View.MemoryView":551 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * +*/ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; + + /* "View.MemoryView":552 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":522 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":557 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result +*/ + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 557, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":558 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 558, __pyx_L1_error) + + /* "View.MemoryView":559 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":555 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":563 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":561 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":566 + * + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; + goto __pyx_L0; + + /* "View.MemoryView":565 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":570 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyLong_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "View.MemoryView":568 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":576 + * if self.view.strides == NULL: + * + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 576, __pyx_L1_error) + + /* "View.MemoryView":574 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" +*/ + } + + /* "View.MemoryView":578 + * raise ValueError, "Buffer view does not expose strides" + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":572 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[1], __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":582 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * +*/ + } + + /* "View.MemoryView":585 + * return (-1,) * self.view.ndim + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyLong_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":580 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":589 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":587 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":593 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":591 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":597 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":595 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":602 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< + * + * for length in self.view.shape[:self.view.ndim]: +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1); + __pyx_v_result = __pyx_mstate_global->__pyx_int_1; + + /* "View.MemoryView":604 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length + * +*/ + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyLong_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; + + /* "View.MemoryView":605 + * + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< + * + * self._size = result +*/ + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; + } + + /* "View.MemoryView":607 + * result *= length + * + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size +*/ + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; + + /* "View.MemoryView":601 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * +*/ + } + + /* "View.MemoryView":609 + * self._size = result + * + * return self._size # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; + goto __pyx_L0; + + /* "View.MemoryView":599 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { + + /* "View.MemoryView":613 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":612 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * +*/ + } + + /* "View.MemoryView":615 + * return self.view.shape[0] + * + * return 0 # <<<<<<<<<<<<<< + * + * def __repr__(self): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":611 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[5]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":619 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): +*/ + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_4[1] = __pyx_t_2; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_at_0x; + __pyx_t_4[3] = __pyx_t_3; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__3; + + /* "View.MemoryView":618 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * +*/ + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":617 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3[3]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "View.MemoryView":622 + * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_MemoryView_of; + __pyx_t_3[1] = __pyx_t_2; + __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u_object; + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 8, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":621 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_c_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); + + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":629 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + * + * def is_f_contig(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":625 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_f_contig", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_f_contig", 0); + + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * +*/ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((void *)NULL))) __PYX_ERR(1, 634, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":635 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * + * def copy(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":631 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":639 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &mslice) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + + /* "View.MemoryView":641 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + + /* "View.MemoryView":642 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char const *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 642, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":647 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * + * def copy_fortran(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":637 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("copy_fortran", __pyx_kwds); return NULL;} + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":651 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &src) +*/ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + + /* "View.MemoryView":653 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, +*/ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + + /* "View.MemoryView":654 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, +*/ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char const *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 654, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; + + /* "View.MemoryView":659 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":649 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo const *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + + /* "View.MemoryView":664 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_o, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_memoryview_type, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 664, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":665 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result + * +*/ + __pyx_v_result->typeinfo = __pyx_v_typeinfo; + + /* "View.MemoryView":666 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_check') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":662 + * + * + * @cname('__pyx_memoryview_new') # <<<<<<<<<<<<<< + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, const __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + int __pyx_t_1; + + /* "View.MemoryView":670 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + * + * cdef tuple _unellipsify(object index, int ndim): +*/ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_mstate_global->__pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":668 + * return result + * + * @cname('__pyx_memoryview_check') # <<<<<<<<<<<<<< + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6[3]; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); + + /* "View.MemoryView":678 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< + * + * result = [slice(None)] * ndim +*/ + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index) != (0)) __PYX_ERR(1, 678, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(1, 680, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":681 + * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 +*/ + __pyx_v_have_slices = 0; + + /* "View.MemoryView":682 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: +*/ + __pyx_v_seen_ellipsis = 0; + + /* "View.MemoryView":683 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: +*/ + __pyx_v_idx = 0; + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 684, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 684, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4)); + #else + __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); + #endif + ++__pyx_t_4; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 684, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":687 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True +*/ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 687, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 687, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); + + /* "View.MemoryView":688 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: +*/ + __pyx_v_seen_ellipsis = 1; + + /* "View.MemoryView":686 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True +*/ + } + + /* "View.MemoryView":689 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":685 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { + + /* "View.MemoryView":692 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" +*/ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":691 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":694 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 +*/ + __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type; + __pyx_t_6[1] = __pyx_t_3; + __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u__4; + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); + if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 694, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 694, __pyx_L1_error) + + /* "View.MemoryView":693 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item +*/ + } + __pyx_L7:; + + /* "View.MemoryView":695 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 + * +*/ + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyLong_FromSsize_t, 1, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(1, 695, __pyx_L1_error) + } + __pyx_L5:; + + /* "View.MemoryView":696 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx +*/ + __pyx_v_idx = (__pyx_v_idx + 1); + + /* "View.MemoryView":684 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":698 + * idx += 1 + * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) + * +*/ + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); + + /* "View.MemoryView":699 + * + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: +*/ + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyLong_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7) != (0)) __PYX_ERR(1, 699, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":672 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "View.MemoryView":702 + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" +*/ + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { + + /* "View.MemoryView":704 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_mstate_global->__pyx_kp_u_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 704, __pyx_L1_error) + + /* "View.MemoryView":703 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag +*/ + } + } + + /* "View.MemoryView":705 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":701 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memview_slice", 0); + + /* "View.MemoryView":713 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst +*/ + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; + + /* "View.MemoryView":720 + * + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj +*/ + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + + /* "View.MemoryView":724 + * cdef _memoryviewslice memviewsliceobj + * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(1, 724, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 724, __pyx_L1_error) + #endif + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":727 + * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 727, __pyx_L1_error) + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":728 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) +*/ + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + + /* "View.MemoryView":726 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":730 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + + /* "View.MemoryView":731 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; + + /* "View.MemoryView":737 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data + * +*/ + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; + + /* "View.MemoryView":738 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; + + /* "View.MemoryView":743 + * + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex +*/ + __pyx_v_p_dst = (&__pyx_v_dst); + + /* "View.MemoryView":744 + * + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step +*/ + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 748, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_6; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(1, 748, __pyx_L1_error) + #endif + if (__pyx_t_6 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6)); + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); + #endif + ++__pyx_t_6; + } + if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 748, __pyx_L1_error) + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(1, 748, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":750 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], +*/ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 750, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; + + /* "View.MemoryView":751 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 751, __pyx_L1_error) + + /* "View.MemoryView":749 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":758 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 +*/ + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + + /* "View.MemoryView":759 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 +*/ + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + + /* "View.MemoryView":760 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: +*/ + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + + /* "View.MemoryView":761 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":757 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":763 + * new_ndim += 1 + * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 +*/ + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; + + /* "View.MemoryView":764 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; + + /* "View.MemoryView":765 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< + * + * have_start = index.start is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 765, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 765, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; + + /* "View.MemoryView":767 + * step = index.step or 0 + * + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; + + /* "View.MemoryView":768 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None + * +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; + + /* "View.MemoryView":769 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< + * + * slice_memviewslice( +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_mstate_global->__pyx_n_u_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 769, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; + + /* "View.MemoryView":771 + * have_step = index.step is not None + * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, +*/ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 771, __pyx_L1_error) + + /* "View.MemoryView":777 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): +*/ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; + + /* "View.MemoryView":748 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":781 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":782 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: +*/ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 782, __pyx_L1_error) } + + /* "View.MemoryView":780 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 780, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":779 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, +*/ + } + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":786 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":785 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * +*/ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryview_type))))) __PYX_ERR(1, 785, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":711 + * + * + * @cname('__pyx_memview_slice') # <<<<<<<<<<<<<< + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { + + /* "View.MemoryView":817 + * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":816 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: +*/ + } + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":819 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 819, __pyx_L1_error) + + /* "View.MemoryView":818 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":814 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":823 + * + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) +*/ + __pyx_v_negative_step = (__pyx_v_step < 0); + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":825 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 825, __pyx_L1_error) + + /* "View.MemoryView":824 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: +*/ + } + + /* "View.MemoryView":822 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":827 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 + * +*/ + /*else*/ { + __pyx_v_negative_step = 0; + + /* "View.MemoryView":828 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_step = 1; + } + __pyx_L6:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":833 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":835 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: +*/ + __pyx_v_start = 0; + + /* "View.MemoryView":834 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: +*/ + } + + /* "View.MemoryView":832 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + if (__pyx_v_negative_step) { + + /* "View.MemoryView":838 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":837 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L11; + } + + /* "View.MemoryView":840 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; + + /* "View.MemoryView":836 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 +*/ + } + __pyx_L9:; + + /* "View.MemoryView":831 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape +*/ + goto __pyx_L8; + } + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":843 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 +*/ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":842 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":845 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< + * + * if have_stop: +*/ + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":849 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 +*/ + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":851 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape +*/ + __pyx_v_stop = 0; + + /* "View.MemoryView":850 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: +*/ + } + + /* "View.MemoryView":848 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: +*/ + goto __pyx_L14; + } + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":853 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: +*/ + __pyx_v_stop = __pyx_v_shape; + + /* "View.MemoryView":852 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: +*/ + } + __pyx_L14:; + + /* "View.MemoryView":847 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape +*/ + goto __pyx_L13; + } + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":856 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape +*/ + __pyx_v_stop = -1L; + + /* "View.MemoryView":855 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: +*/ + goto __pyx_L16; + } + + /* "View.MemoryView":858 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; + + /* "View.MemoryView":862 + * + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: +*/ + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":865 + * + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< + * + * if new_shape < 0: +*/ + __pyx_v_new_shape = (__pyx_v_new_shape + 1); + + /* "View.MemoryView":864 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * +*/ + } + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":868 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_new_shape = 0; + + /* "View.MemoryView":867 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * +*/ + } + + /* "View.MemoryView":871 + * + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset +*/ + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); + + /* "View.MemoryView":872 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset + * +*/ + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + + /* "View.MemoryView":873 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + } + __pyx_L3:; + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":877 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride +*/ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + + /* "View.MemoryView":876 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: +*/ + goto __pyx_L19; + } + + /* "View.MemoryView":879 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + * + * if suboffset >= 0: +*/ + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":884 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " +*/ + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":883 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: +*/ + goto __pyx_L22; + } + + /* "View.MemoryView":886 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: +*/ + /*else*/ { + + /* "View.MemoryView":887 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim +*/ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_mstate_global->__pyx_kp_u_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 886, __pyx_L1_error) + } + __pyx_L22:; + + /* "View.MemoryView":882 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset +*/ + goto __pyx_L21; + } + + /* "View.MemoryView":889 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + * + * return 0 +*/ + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; + + /* "View.MemoryView":881 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: +*/ + } + + /* "View.MemoryView":891 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":793 + * + * + * @cname('__pyx_memoryview_slice_memviewslice') # <<<<<<<<<<<<<< + * cdef int slice_memviewslice( + * __Pyx_memviewslice *dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[3]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pybuffer_index", 0); + + /* "View.MemoryView":899 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp +*/ + __pyx_v_suboffset = -1L; + + /* "View.MemoryView":900 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp + * +*/ + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":904 + * + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: +*/ + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 904, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize, 0); + + /* "View.MemoryView":905 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] +*/ + __pyx_v_stride = __pyx_v_itemsize; + + /* "View.MemoryView":903 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":907 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: +*/ + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + + /* "View.MemoryView":908 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] +*/ + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":910 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + * + * if index < 0: +*/ + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + + /* "View.MemoryView":909 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * +*/ + } + } + __pyx_L3:; + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":913 + * + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" +*/ + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":915 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * if index >= shape: +*/ + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_3; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 915, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 915, __pyx_L1_error) + + /* "View.MemoryView":914 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":912 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: +*/ + } + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":918 + * + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride +*/ + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + __pyx_t_4[1] = __pyx_t_5; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1, 127); + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_IndexError))), __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 918, __pyx_L1_error) + + /* "View.MemoryView":917 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * +*/ + } + + /* "View.MemoryView":920 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset +*/ + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":922 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + * + * return resultp +*/ + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":921 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * +*/ + } + + /* "View.MemoryView":924 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; + + /* "View.MemoryView":896 + * + * + * @cname('__pyx_pybuffer_index') # <<<<<<<<<<<<<< + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":931 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t *shape = memslice.shape +*/ + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; + + /* "View.MemoryView":933 + * cdef int ndim = memslice.memview.view.ndim + * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides + * +*/ + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; + + /* "View.MemoryView":934 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; + + /* "View.MemoryView":938 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] +*/ + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2, 1); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":939 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] +*/ + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + + /* "View.MemoryView":940 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] + * +*/ + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + + /* "View.MemoryView":941 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: +*/ + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { + + /* "View.MemoryView":944 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 +*/ + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 944, __pyx_L1_error) + + /* "View.MemoryView":943 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * +*/ + } + } + + /* "View.MemoryView":946 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":929 + * + * + * @cname('__pyx_memslice_transpose') # <<<<<<<<<<<<<< + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + +/* Python wrapper */ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + + /* "View.MemoryView":965 + * + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): +*/ + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); + + /* "View.MemoryView":964 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":969 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 969, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":968 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: +*/ + } + + /* "View.MemoryView":971 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 971, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":967 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":975 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) +*/ + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 975, __pyx_L1_error) + + /* "View.MemoryView":974 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":977 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< + * + * cdef _get_base(self): +*/ + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":973 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":980 + * + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; + goto __pyx_L0; + + /* "View.MemoryView":979 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 3, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TypeInfo const *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":1009 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "View.MemoryView":1008 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * +*/ + } + + /* "View.MemoryView":1014 + * + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice +*/ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_0) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(1, 1014, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_mstate_global->__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1016 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * +*/ + __pyx_v_result->from_slice = __pyx_v_memviewslice; + + /* "View.MemoryView":1017 + * + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() +*/ + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + + /* "View.MemoryView":1019 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo + * +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1019, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; + + /* "View.MemoryView":1020 + * + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * + * result.view = memviewslice.memview.view +*/ + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + + /* "View.MemoryView":1022 + * result.typeinfo = memviewslice.memview.typeinfo + * + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim +*/ + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; + + /* "View.MemoryView":1023 + * + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None +*/ + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); + + /* "View.MemoryView":1024 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) +*/ + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; + + /* "View.MemoryView":1025 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * +*/ + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + + /* "View.MemoryView":1026 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: +*/ + Py_INCREF(Py_None); + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1029 + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO +*/ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + + /* "View.MemoryView":1028 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1031 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape +*/ + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; + + /* "View.MemoryView":1033 + * result.flags = PyBUF_RECORDS_RO + * + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides + * +*/ + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); + + /* "View.MemoryView":1034 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + + /* "View.MemoryView":1037 + * + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: +*/ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; + + /* "View.MemoryView":1038 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets +*/ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1040 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + + /* "View.MemoryView":1041 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< + * + * result.view.len = result.view.itemsize +*/ + goto __pyx_L6_break; + + /* "View.MemoryView":1039 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break +*/ + } + } + __pyx_L6_break:; + + /* "View.MemoryView":1043 + * break + * + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length +*/ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + + /* "View.MemoryView":1044 + * + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * +*/ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyLong_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1045 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< + * + * result.to_object_func = to_object_func +*/ + __pyx_t_2 = PyLong_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1045, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } + + /* "View.MemoryView":1047 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func + * +*/ + __pyx_v_result->to_object_func = __pyx_v_to_object_func; + + /* "View.MemoryView":1048 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * + * return result +*/ + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + + /* "View.MemoryView":1050 + * result.to_dtype_func = to_dtype_func + * + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":999 + * pass # ignore failure, it's a minor issue + * + * @cname('__pyx_memoryview_fromslice') # <<<<<<<<<<<<<< + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, + * int ndim, +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1057 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_memoryviewslice_type))))) __PYX_ERR(1, 1057, __pyx_L1_error) + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1058 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) +*/ + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; + + /* "View.MemoryView":1056 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice +*/ + } + + /* "View.MemoryView":1060 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice + * +*/ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + + /* "View.MemoryView":1061 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_slice_copy') +*/ + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } + + /* "View.MemoryView":1052 + * return result + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, + * __Pyx_memviewslice *mslice) except NULL: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_obj); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + + /* "View.MemoryView":1068 + * cdef (Py_ssize_t*) shape, strides, suboffsets + * + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets +*/ + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; + + /* "View.MemoryView":1069 + * + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets + * +*/ + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; + + /* "View.MemoryView":1070 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< + * + * dst.memview = <__pyx_memoryview *> memview +*/ + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; + + /* "View.MemoryView":1072 + * suboffsets = memview.view.suboffsets + * + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf + * +*/ + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + + /* "View.MemoryView":1073 + * + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< + * + * for dim in range(memview.view.ndim): +*/ + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + + /* "View.MemoryView":1075 + * dst.data = memview.view.buf + * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] +*/ + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; + + /* "View.MemoryView":1076 + * + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 +*/ + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + + /* "View.MemoryView":1077 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * +*/ + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + + /* "View.MemoryView":1078 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object') +*/ + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } + + /* "View.MemoryView":1063 + * return mslice + * + * @cname('__pyx_memoryview_slice_copy') # <<<<<<<<<<<<<< + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: + * cdef int dim +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy", 0); + + /* "View.MemoryView":1084 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * +*/ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1085 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object_from_slice') +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1080 + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + * @cname('__pyx_memoryview_copy_object') # <<<<<<<<<<<<<< + * cdef memoryview_copy(memoryview memview): + * "Create a new memoryview object" +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_mstate_global->__pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1096 + * + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: +*/ + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; + + /* "View.MemoryView":1097 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL +*/ + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; + + /* "View.MemoryView":1095 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1099 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL + * +*/ + /*else*/ { + __pyx_v_to_object_func = NULL; + + /* "View.MemoryView":1100 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, +*/ + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; + + /* "View.MemoryView":1102 + * to_dtype_func = NULL + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) +*/ + __Pyx_XDECREF(__pyx_r); + + /* "View.MemoryView":1104 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1087 + * return memoryview_copy_from_slice(memview, &memviewslice) + * + * @cname('__pyx_memoryview_copy_object_from_slice') # <<<<<<<<<<<<<< + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): + * """ +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1111 + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') +*/ + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":1110 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1119 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 + * +*/ + __pyx_v_c_stride = 0; + + /* "View.MemoryView":1120 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_f_stride = 0; + + /* "View.MemoryView":1122 + * cdef Py_ssize_t f_stride = 0 + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1124 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1125 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + goto __pyx_L4_break; + + /* "View.MemoryView":1123 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L4_break:; + + /* "View.MemoryView":1127 + * break + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] +*/ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1129 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * +*/ + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1130 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): +*/ + goto __pyx_L7_break; + + /* "View.MemoryView":1128 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break +*/ + } + } + __pyx_L7_break:; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { + + /* "View.MemoryView":1133 + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' +*/ + __pyx_r = 'C'; + goto __pyx_L0; + + /* "View.MemoryView":1132 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: +*/ + } + + /* "View.MemoryView":1135 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< + * + * @cython.cdivision(True) +*/ + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } + + /* "View.MemoryView":1113 + * return -arg if arg < 0 else arg + * + * @cname('__pyx_get_best_slice_order') # <<<<<<<<<<<<<< + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: + * """ +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1145 + * + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] +*/ + __pyx_v_src_extent = (__pyx_v_src_shape[0]); + + /* "View.MemoryView":1146 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] +*/ + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + + /* "View.MemoryView":1147 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] + * +*/ + __pyx_v_src_stride = (__pyx_v_src_strides[0]); + + /* "View.MemoryView":1148 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + + /* "View.MemoryView":1152 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: +*/ + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + if (__pyx_t_1) { + + /* "View.MemoryView":1153 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + + /* "View.MemoryView":1151 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) +*/ + goto __pyx_L4; + } + + /* "View.MemoryView":1155 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1156 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride +*/ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + + /* "View.MemoryView":1157 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1158 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L4:; + + /* "View.MemoryView":1150 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1160 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, +*/ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1161 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, +*/ + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + + /* "View.MemoryView":1165 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * +*/ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1166 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, +*/ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1137 + * return 'F' + * + * @cython.cdivision(True) # <<<<<<<<<<<<<< + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, + * char *dst_data, Py_ssize_t *dst_strides, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + + /* "View.MemoryView":1171 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) + * +*/ + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1168 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + + /* "View.MemoryView":1177 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + * + * for shape in src.shape[:ndim]: +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; + + /* "View.MemoryView":1179 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape + * +*/ + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); + + /* "View.MemoryView":1180 + * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< + * + * return size +*/ + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } + + /* "View.MemoryView":1182 + * size *= shape + * + * return size # <<<<<<<<<<<<<< + * + * @cname('__pyx_fill_contig_strides_array') +*/ + __pyx_r = __pyx_v_size; + goto __pyx_L0; + + /* "View.MemoryView":1174 + * src.shape, dst.shape, ndim, itemsize) + * + * @cname('__pyx_memoryview_slice_get_size') # <<<<<<<<<<<<<< + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { + + /* "View.MemoryView":1195 + * + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; + + /* "View.MemoryView":1196 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1197 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + + /* "View.MemoryView":1194 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1199 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] +*/ + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; + + /* "View.MemoryView":1200 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * +*/ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1201 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * + * return stride +*/ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + } + __pyx_L3:; + + /* "View.MemoryView":1203 + * stride *= shape[idx] + * + * return stride # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_data_to_temp') +*/ + __pyx_r = __pyx_v_stride; + goto __pyx_L0; + + /* "View.MemoryView":1184 + * return size + * + * @cname('__pyx_fill_contig_strides_array') # <<<<<<<<<<<<<< + * cdef Py_ssize_t fill_contig_strides_array( + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1217 + * cdef void *result + * + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) + * +*/ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1218 + * + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * + * result = malloc(size) +*/ + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); + + /* "View.MemoryView":1220 + * cdef size_t size = slice_get_size(src, ndim) + * + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() +*/ + __pyx_v_result = malloc(__pyx_v_size); + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { + + /* "View.MemoryView":1222 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1222, __pyx_L1_error) + + /* "View.MemoryView":1221 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * +*/ + } + + /* "View.MemoryView":1225 + * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): +*/ + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + + /* "View.MemoryView":1226 + * + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] +*/ + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; + + /* "View.MemoryView":1227 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1228 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + + /* "View.MemoryView":1229 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) +*/ + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1231 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * + * +*/ + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); + + /* "View.MemoryView":1234 + * + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 +*/ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1236 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * + * if slice_is_contig(src[0], order, ndim): +*/ + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1235 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * +*/ + } + } + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1239 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) +*/ + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + + /* "View.MemoryView":1238 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: +*/ + goto __pyx_L9; + } + + /* "View.MemoryView":1241 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + * + * return result +*/ + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; + + /* "View.MemoryView":1243 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * + * return result # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":1205 + * return stride + * + * @cname('__pyx_memoryview_copy_data_to_temp') # <<<<<<<<<<<<<< + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, + * __Pyx_memviewslice *tmpslice, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4[7]; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_extents", 0); + + /* "View.MemoryView":1250 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_dim') +*/ + __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi; + __pyx_t_4[1] = __pyx_t_1; + __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u_got; + __pyx_t_4[3] = __pyx_t_2; + __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u_and; + __pyx_t_4[5] = __pyx_t_3; + __pyx_t_4[6] = __pyx_mstate_global->__pyx_kp_u__5; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_4, 7, 35 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 6 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127); + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_ValueError))), __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 1250, __pyx_L1_error) + + /* "View.MemoryView":1247 + * + * + * @cname('__pyx_memoryview_err_extents') # <<<<<<<<<<<<<< + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1254 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err') +*/ + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1254, __pyx_L1_error) + + /* "View.MemoryView":1252 + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + * + * @cname('__pyx_memoryview_err_dim') # <<<<<<<<<<<<<< + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1258 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_no_memory') +*/ + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1258, __pyx_L1_error) + + /* "View.MemoryView":1256 + * raise error, msg % dim + * + * @cname('__pyx_memoryview_err') # <<<<<<<<<<<<<< + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1262 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< + * + * +*/ + PyErr_NoMemory(); __PYX_ERR(1, 1262, __pyx_L1_error) + + /* "View.MemoryView":1260 + * raise error, msg + * + * @cname('__pyx_memoryview_err_no_memory') # <<<<<<<<<<<<<< + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + return __pyx_r; +} + +/* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyGILState_STATE __pyx_gilstate_save; + + /* "View.MemoryView":1274 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i +*/ + __pyx_v_tmpdata = NULL; + + /* "View.MemoryView":1275 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) +*/ + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1277 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + + /* "View.MemoryView":1278 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp +*/ + __pyx_v_broadcasting = 0; + + /* "View.MemoryView":1279 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp + * +*/ + __pyx_v_direct_copy = 0; + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1283 + * + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + + /* "View.MemoryView":1282 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1285 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) +*/ + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); + + /* "View.MemoryView":1284 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * +*/ + } + __pyx_L3:; + + /* "View.MemoryView":1287 + * broadcast_leading(&dst, dst_ndim, src_ndim) + * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * + * for i in range(ndim): +*/ + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; + + /* "View.MemoryView":1289 + * cdef int ndim = max(src_ndim, dst_ndim) + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: +*/ + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1292 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: +*/ + __pyx_v_broadcasting = 1; + + /* "View.MemoryView":1293 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) +*/ + (__pyx_v_src.strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1291 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 +*/ + goto __pyx_L7; + } + + /* "View.MemoryView":1295 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< + * + * if src.suboffsets[i] >= 0: +*/ + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1295, __pyx_L1_error) + } + __pyx_L7:; + + /* "View.MemoryView":1290 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True +*/ + } + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":1298 + * + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + * + * if slices_overlap(&src, &dst, ndim, itemsize): +*/ + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_mstate_global->__pyx_kp_u_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1298, __pyx_L1_error) + + /* "View.MemoryView":1297 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * +*/ + } + } + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { + + /* "View.MemoryView":1303 + * + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) +*/ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + + /* "View.MemoryView":1302 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * +*/ + } + + /* "View.MemoryView":1305 + * order = get_best_order(&dst, ndim) + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp + * +*/ + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1305, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; + + /* "View.MemoryView":1306 + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: +*/ + __pyx_v_src = __pyx_v_tmp; + + /* "View.MemoryView":1300 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1312 + * + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + + /* "View.MemoryView":1311 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): +*/ + goto __pyx_L12; + } + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1314 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + * + * if direct_copy: +*/ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + + /* "View.MemoryView":1313 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * +*/ + } + __pyx_L12:; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + if (__pyx_v_direct_copy) { + + /* "View.MemoryView":1318 + * if direct_copy: + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1319 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) +*/ + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + + /* "View.MemoryView":1320 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1321 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1322 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1316 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + } + + /* "View.MemoryView":1308 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + } + if (__pyx_t_2) { + + /* "View.MemoryView":1327 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) + * +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) + + /* "View.MemoryView":1328 + * + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) +*/ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1328, __pyx_L1_error) + + /* "View.MemoryView":1324 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":1330 + * transpose_memslice(&dst) + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1331 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * +*/ + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1332 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * free(tmpdata) +*/ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1334 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * +*/ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1335 + * + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') +*/ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1265 + * + * + * @cname('__pyx_memoryview_copy_contents') # <<<<<<<<<<<<<< + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, + * __Pyx_memviewslice dst, +*/ + + /* function exit code */ + __pyx_L1_error:; + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_PyGILState_Release(__pyx_gilstate_save); + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "View.MemoryView":1342 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): +*/ + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + + /* "View.MemoryView":1344 + * cdef int offset = ndim_other - ndim + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] +*/ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1345 + * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] +*/ + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); + + /* "View.MemoryView":1346 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * +*/ + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1347 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + * + * for i in range(offset): +*/ + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); + } + + /* "View.MemoryView":1349 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] +*/ + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1350 + * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 +*/ + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + + /* "View.MemoryView":1351 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 + * +*/ + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + + /* "View.MemoryView":1352 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * +*/ + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1337 + * return 0 + * + * @cname('__pyx_memoryview_broadcast_leading') # <<<<<<<<<<<<<< + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, + * int ndim, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + if (__pyx_v_dtype_is_object) { + + /* "View.MemoryView":1363 + * + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') +*/ + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1362 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * +*/ + } + + /* "View.MemoryView":1359 + * + * + * @cname('__pyx_memoryview_refcount_copying') # <<<<<<<<<<<<<< + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + + /* "View.MemoryView":1369 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') +*/ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1365 + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ + __Pyx_PyGILState_Release(__pyx_gilstate_save); +} + +/* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1375 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * + * for i in range(shape[0]): +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1377 + * cdef Py_ssize_t stride = strides[0] + * + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: +*/ + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + if (__pyx_v_inc) { + + /* "View.MemoryView":1380 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) +*/ + Py_INCREF((((PyObject **)__pyx_v_data)[0])); + + /* "View.MemoryView":1379 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: +*/ + goto __pyx_L6; + } + + /* "View.MemoryView":1382 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) +*/ + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; + + /* "View.MemoryView":1378 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) +*/ + goto __pyx_L5; + } + + /* "View.MemoryView":1384 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< + * + * data += stride +*/ + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; + + /* "View.MemoryView":1386 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< + * + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1371 + * refcount_objects_in_slice(data, shape, strides, ndim, inc) + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') # <<<<<<<<<<<<<< + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, bint inc) noexcept: +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { + + /* "View.MemoryView":1395 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1396 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1397 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1391 + * + * + * @cname('__pyx_memoryview_slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, + * size_t itemsize, void *item, +*/ + + /* function exit code */ +} + +/* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + + /* "View.MemoryView":1405 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] + * +*/ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1406 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: +*/ + __pyx_v_extent = (__pyx_v_shape[0]); + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1409 + * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride +*/ + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1410 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: +*/ + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); + + /* "View.MemoryView":1411 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1408 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) +*/ + goto __pyx_L3; + } + + /* "View.MemoryView":1413 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride +*/ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1414 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride + * +*/ + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1415 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< + * +*/ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1400 + * + * + * @cname('__pyx_memoryview__slice_assign_scalar') # <<<<<<<<<<<<<< + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, + * Py_ssize_t *strides, int ndim, +*/ + + /* function exit code */ +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 4, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_Enum", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, i); __PYX_ERR(1, 4, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, ((char const *)"name")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_MemviewEnum_type); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): +*/ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "cannot pass None into a C function argument that is declared 'not None'"); + __PYX_ERR(1, 9, __pyx_L1_error) + } + __pyx_t_2 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) # <<<<<<<<<<<<<< +*/ + __pyx_t_2 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 1) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_8itemsize_itemsize(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":244 + * @property + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_ELSIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":242 + * cdef int type_num + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp itemsize(self) noexcept nogil: + * return PyDataType_ELSIZE(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_5dtype_9alignment_alignment(PyArray_Descr *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":248 + * @property + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) # <<<<<<<<<<<<<< + * + * # Use fields/names with care as they may be NULL. You must check +*/ + __pyx_r = PyDataType_ALIGNMENT(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":246 + * return PyDataType_ELSIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp alignment(self) noexcept nogil: + * return PyDataType_ALIGNMENT(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_6fields_fields(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("fields", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":254 + * @property + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_FIELDS(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":252 + * # Use fields/names with care as they may be NULL. You must check + * # for this using PyDataType_HASFIELDS. + * @property # <<<<<<<<<<<<<< + * cdef inline object fields(self): + * return PyDataType_FIELDS(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_5dtype_5names_names(PyArray_Descr *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("names", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":258 + * @property + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) # <<<<<<<<<<<<<< + * + * # Use PyDataType_HASSUBARRAY to test whether this field is +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDataType_NAMES(__pyx_v_self); + __Pyx_INCREF(((PyObject*)__pyx_t_1)); + __pyx_r = ((PyObject*)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":256 + * return PyDataType_FIELDS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline tuple names(self): + * return PyDataType_NAMES(self) +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + +static CYTHON_INLINE PyArray_ArrayDescr *__pyx_f_5numpy_5dtype_8subarray_subarray(PyArray_Descr *__pyx_v_self) { + PyArray_ArrayDescr *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":265 + * @property + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyDataType_SUBARRAY(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":263 + * # valid (the pointer can be NULL). Most users should access + * # this field via the inline helper method PyDataType_SHAPE. + * @property # <<<<<<<<<<<<<< + * cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil: + * return PyDataType_SUBARRAY(self) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + +static CYTHON_INLINE npy_uint64 __pyx_f_5numpy_5dtype_5flags_flags(PyArray_Descr *__pyx_v_self) { + npy_uint64 __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":270 + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" + * return PyDataType_FLAGS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyDataType_FLAGS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":267 + * return PyDataType_SUBARRAY(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_uint64 flags(self) noexcept nogil: + * """The data types flags.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_7numiter_numiter(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":282 + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" + * return PyArray_MultiIter_NUMITER(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NUMITER(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":279 + * ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]: + * + * @property # <<<<<<<<<<<<<< + * cdef inline int numiter(self) noexcept nogil: + * """The number of arrays that need to be broadcast to the same shape.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_4size_size(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":287 + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" + * return PyArray_MultiIter_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":284 + * return PyArray_MultiIter_NUMITER(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """The total broadcasted size.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_9broadcast_5index_index(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":292 + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" + * return PyArray_MultiIter_INDEX(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_INDEX(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":289 + * return PyArray_MultiIter_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp index(self) noexcept nogil: + * """The current (1-d) index into the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_9broadcast_2nd_nd(PyArrayMultiIterObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":297 + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" + * return PyArray_MultiIter_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":294 + * return PyArray_MultiIter_INDEX(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int nd(self) noexcept nogil: + * """The number of dimensions in the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_9broadcast_10dimensions_dimensions(PyArrayMultiIterObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":302 + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" + * return PyArray_MultiIter_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_MultiIter_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":299 + * return PyArray_MultiIter_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp* dimensions(self) noexcept nogil: + * """The shape of the broadcasted result.""" +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + +static CYTHON_INLINE void **__pyx_f_5numpy_9broadcast_5iters_iters(PyArrayMultiIterObject *__pyx_v_self) { + void **__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":308 + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. + * On return, the iterators are adjusted for broadcasting.""" + * return PyArray_MultiIter_ITERS(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_MultiIter_ITERS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":304 + * return PyArray_MultiIter_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline void** iters(self) noexcept nogil: + * """An array of iterator objects that holds the iterators for the arrays to be broadcast together. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":326 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":322 + * # Instead, we use properties that map to the corresponding C-API functions. + * + * @property # <<<<<<<<<<<<<< + * cdef inline PyObject* base(self) noexcept nogil: + * """Returns a borrowed reference to the object owning the data/memory. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":332 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":328 + * return PyArray_BASE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline dtype descr(self): + * """Returns an owned reference to the dtype of the array. +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":338 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":334 + * return PyArray_DESCR(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline int ndim(self) noexcept nogil: + * """Returns the number of dimensions in the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":346 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":340 + * return PyArray_NDIM(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *shape(self) noexcept nogil: + * """Returns a pointer to the dimensions/shape of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":353 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":348 + * return PyArray_DIMS(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp *strides(self) noexcept nogil: + * """Returns a pointer to the strides of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":359 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":355 + * return PyArray_STRIDES(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline npy_intp size(self) noexcept nogil: + * """Returns the total size (in number of elements) of the array. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":368 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":361 + * return PyArray_SIZE(self) + * + * @property # <<<<<<<<<<<<<< + * cdef inline char* data(self) noexcept nogil: + * """The pointer to the data buffer as a char*. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":777 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":776 + * ctypedef long double complex clongdouble_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":780 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":793 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5numpy_5dtype_8subarray_subarray(__pyx_v_d)->shape; + __Pyx_INCREF(((PyObject*)__pyx_t_2)); + __pyx_r = ((PyObject*)__pyx_t_2); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":792 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":795 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple); + __pyx_r = __pyx_mstate_global->__pyx_empty_tuple; + goto __pyx_L0; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":791 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":995 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * +*/ + Py_INCREF(__pyx_v_base); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":996 + * cdef inline void set_array_base(ndarray arr, object base) except *: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): +*/ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 996, __pyx_L1_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":994 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base) except *: # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) +*/ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":999 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None +*/ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1001 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1000 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base +*/ + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1002 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":998 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_array", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1008 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") +*/ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1008, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1009 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.multiarray failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1009, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1010 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy._core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_multiarray_failed_to}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1010, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1010, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1007 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1006 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1014 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1014, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1015 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1015, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1016 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1016, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1016, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1012 + * raise ImportError("numpy._core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1020 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy._core.umath failed to import") +*/ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1020, __pyx_L3_error) + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1021 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy._core.umath failed to import") + * +*/ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1021, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1022 + * _import_umath() + * except Exception: + * raise ImportError("numpy._core.umath failed to import") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_9 = NULL; + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_numpy__core_umath_failed_to_impo}; + __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ImportError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1022, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 1022, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1019 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: +*/ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1018 + * raise ImportError("numpy._core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1037 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1025 + * + * + * cdef inline bint is_timedelta64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1052 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1040 + * + * + * cdef inline bint is_datetime64_object(object obj) noexcept: # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1062 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1055 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1069 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1065 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1076 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + * + * +*/ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "C:/Users/runneradmin/AppData/Local/Temp/build-env-ej_q3m8u/Lib/site-packages/numpy/__init__.cython-30.pxd":1072 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_f_5spacy_6lexeme_6Lexeme_from_ptr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_self = 0; + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_ptr", 0); + + /* "lexeme.pxd":31 + * @staticmethod + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) # <<<<<<<<<<<<<< + * self.c = lex + * self.vocab = vocab +*/ + __pyx_t_1 = __Pyx_PyLong_From_uint64_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_vocab)) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(3, 31, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_tp_new(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme), ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme)))) __PYX_ERR(3, 31, __pyx_L1_error) + __pyx_v_self = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "lexeme.pxd":32 + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex # <<<<<<<<<<<<<< + * self.vocab = vocab + * self.orth = lex.orth +*/ + __pyx_v_self->c = __pyx_v_lex; + + /* "lexeme.pxd":33 + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) + * self.c = lex + * self.vocab = vocab # <<<<<<<<<<<<<< + * self.orth = lex.orth + * return self +*/ + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + __Pyx_GOTREF((PyObject *)__pyx_v_self->vocab); + __Pyx_DECREF((PyObject *)__pyx_v_self->vocab); + __pyx_v_self->vocab = __pyx_v_vocab; + + /* "lexeme.pxd":34 + * self.c = lex + * self.vocab = vocab + * self.orth = lex.orth # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = __pyx_v_lex->orth; + __pyx_v_self->orth = __pyx_t_3; + + /* "lexeme.pxd":35 + * self.vocab = vocab + * self.orth = lex.orth + * return self # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "lexeme.pxd":29 + * cdef readonly attr_t orth + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab): + * cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.lexeme.Lexeme.from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE void __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value) { + int __pyx_t_1; + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + __pyx_t_1 = (__pyx_v_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":40 + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) # <<<<<<<<<<<<<< + * elif name == ID: + * lex.id = value +*/ + (void)(__pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(__pyx_v_lex, __pyx_v_name, __pyx_v_value)); + + /* "lexeme.pxd":39 + * @staticmethod + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":42 + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: + * lex.id = value # <<<<<<<<<<<<<< + * elif name == LOWER: + * lex.lower = value +*/ + __pyx_v_lex->id = __pyx_v_value; + + /* "lexeme.pxd":41 + * if name < (sizeof(flags_t) * 8): + * Lexeme.c_set_flag(lex, name, value) + * elif name == ID: # <<<<<<<<<<<<<< + * lex.id = value + * elif name == LOWER: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":44 + * lex.id = value + * elif name == LOWER: + * lex.lower = value # <<<<<<<<<<<<<< + * elif name == NORM: + * lex.norm = value +*/ + __pyx_v_lex->lower = __pyx_v_value; + + /* "lexeme.pxd":43 + * elif name == ID: + * lex.id = value + * elif name == LOWER: # <<<<<<<<<<<<<< + * lex.lower = value + * elif name == NORM: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":46 + * lex.lower = value + * elif name == NORM: + * lex.norm = value # <<<<<<<<<<<<<< + * elif name == SHAPE: + * lex.shape = value +*/ + __pyx_v_lex->norm = __pyx_v_value; + + /* "lexeme.pxd":45 + * elif name == LOWER: + * lex.lower = value + * elif name == NORM: # <<<<<<<<<<<<<< + * lex.norm = value + * elif name == SHAPE: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":48 + * lex.norm = value + * elif name == SHAPE: + * lex.shape = value # <<<<<<<<<<<<<< + * elif name == PREFIX: + * lex.prefix = value +*/ + __pyx_v_lex->shape = __pyx_v_value; + + /* "lexeme.pxd":47 + * elif name == NORM: + * lex.norm = value + * elif name == SHAPE: # <<<<<<<<<<<<<< + * lex.shape = value + * elif name == PREFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":50 + * lex.shape = value + * elif name == PREFIX: + * lex.prefix = value # <<<<<<<<<<<<<< + * elif name == SUFFIX: + * lex.suffix = value +*/ + __pyx_v_lex->prefix = __pyx_v_value; + + /* "lexeme.pxd":49 + * elif name == SHAPE: + * lex.shape = value + * elif name == PREFIX: # <<<<<<<<<<<<<< + * lex.prefix = value + * elif name == SUFFIX: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":52 + * lex.prefix = value + * elif name == SUFFIX: + * lex.suffix = value # <<<<<<<<<<<<<< + * elif name == LANG: + * lex.lang = value +*/ + __pyx_v_lex->suffix = __pyx_v_value; + + /* "lexeme.pxd":51 + * elif name == PREFIX: + * lex.prefix = value + * elif name == SUFFIX: # <<<<<<<<<<<<<< + * lex.suffix = value + * elif name == LANG: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + __pyx_t_1 = (__pyx_v_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":54 + * lex.suffix = value + * elif name == LANG: + * lex.lang = value # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_lex->lang = __pyx_v_value; + + /* "lexeme.pxd":53 + * elif name == SUFFIX: + * lex.suffix = value + * elif name == LANG: # <<<<<<<<<<<<<< + * lex.lang = value + * +*/ + } + __pyx_L3:; + + /* "lexeme.pxd":37 + * return self + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) noexcept nogil: + * if name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ +} + +/* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + __pyx_t_1 = (__pyx_v_feat_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + __pyx_t_1 = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_lex, __pyx_v_feat_name); + if (__pyx_t_1) { + + /* "lexeme.pxd":60 + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":59 + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * if Lexeme.c_check_flag(lex, feat_name): # <<<<<<<<<<<<<< + * return 1 + * else: +*/ + } + + /* "lexeme.pxd":62 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * elif feat_name == ID: + * return lex.id +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":58 + * @staticmethod + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * if Lexeme.c_check_flag(lex, feat_name): + * return 1 +*/ + } + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ID); + if (__pyx_t_1) { + + /* "lexeme.pxd":64 + * return 0 + * elif feat_name == ID: + * return lex.id # <<<<<<<<<<<<<< + * elif feat_name == ORTH: + * return lex.orth +*/ + __pyx_r = __pyx_v_lex->id; + goto __pyx_L0; + + /* "lexeme.pxd":63 + * else: + * return 0 + * elif feat_name == ID: # <<<<<<<<<<<<<< + * return lex.id + * elif feat_name == ORTH: +*/ + } + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ORTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":66 + * return lex.id + * elif feat_name == ORTH: + * return lex.orth # <<<<<<<<<<<<<< + * elif feat_name == LOWER: + * return lex.lower +*/ + __pyx_r = __pyx_v_lex->orth; + goto __pyx_L0; + + /* "lexeme.pxd":65 + * elif feat_name == ID: + * return lex.id + * elif feat_name == ORTH: # <<<<<<<<<<<<<< + * return lex.orth + * elif feat_name == LOWER: +*/ + } + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LOWER); + if (__pyx_t_1) { + + /* "lexeme.pxd":68 + * return lex.orth + * elif feat_name == LOWER: + * return lex.lower # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * return lex.norm +*/ + __pyx_r = __pyx_v_lex->lower; + goto __pyx_L0; + + /* "lexeme.pxd":67 + * elif feat_name == ORTH: + * return lex.orth + * elif feat_name == LOWER: # <<<<<<<<<<<<<< + * return lex.lower + * elif feat_name == NORM: +*/ + } + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "lexeme.pxd":70 + * return lex.lower + * elif feat_name == NORM: + * return lex.norm # <<<<<<<<<<<<<< + * elif feat_name == SHAPE: + * return lex.shape +*/ + __pyx_r = __pyx_v_lex->norm; + goto __pyx_L0; + + /* "lexeme.pxd":69 + * elif feat_name == LOWER: + * return lex.lower + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * return lex.norm + * elif feat_name == SHAPE: +*/ + } + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SHAPE); + if (__pyx_t_1) { + + /* "lexeme.pxd":72 + * return lex.norm + * elif feat_name == SHAPE: + * return lex.shape # <<<<<<<<<<<<<< + * elif feat_name == PREFIX: + * return lex.prefix +*/ + __pyx_r = __pyx_v_lex->shape; + goto __pyx_L0; + + /* "lexeme.pxd":71 + * elif feat_name == NORM: + * return lex.norm + * elif feat_name == SHAPE: # <<<<<<<<<<<<<< + * return lex.shape + * elif feat_name == PREFIX: +*/ + } + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_PREFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":74 + * return lex.shape + * elif feat_name == PREFIX: + * return lex.prefix # <<<<<<<<<<<<<< + * elif feat_name == SUFFIX: + * return lex.suffix +*/ + __pyx_r = __pyx_v_lex->prefix; + goto __pyx_L0; + + /* "lexeme.pxd":73 + * elif feat_name == SHAPE: + * return lex.shape + * elif feat_name == PREFIX: # <<<<<<<<<<<<<< + * return lex.prefix + * elif feat_name == SUFFIX: +*/ + } + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SUFFIX); + if (__pyx_t_1) { + + /* "lexeme.pxd":76 + * return lex.prefix + * elif feat_name == SUFFIX: + * return lex.suffix # <<<<<<<<<<<<<< + * elif feat_name == LENGTH: + * return lex.length +*/ + __pyx_r = __pyx_v_lex->suffix; + goto __pyx_L0; + + /* "lexeme.pxd":75 + * elif feat_name == PREFIX: + * return lex.prefix + * elif feat_name == SUFFIX: # <<<<<<<<<<<<<< + * return lex.suffix + * elif feat_name == LENGTH: +*/ + } + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LENGTH); + if (__pyx_t_1) { + + /* "lexeme.pxd":78 + * return lex.suffix + * elif feat_name == LENGTH: + * return lex.length # <<<<<<<<<<<<<< + * elif feat_name == LANG: + * return lex.lang +*/ + __pyx_r = __pyx_v_lex->length; + goto __pyx_L0; + + /* "lexeme.pxd":77 + * elif feat_name == SUFFIX: + * return lex.suffix + * elif feat_name == LENGTH: # <<<<<<<<<<<<<< + * return lex.length + * elif feat_name == LANG: +*/ + } + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LANG); + if (__pyx_t_1) { + + /* "lexeme.pxd":80 + * return lex.length + * elif feat_name == LANG: + * return lex.lang # <<<<<<<<<<<<<< + * else: + * return 0 +*/ + __pyx_r = __pyx_v_lex->lang; + goto __pyx_L0; + + /* "lexeme.pxd":79 + * elif feat_name == LENGTH: + * return lex.length + * elif feat_name == LANG: # <<<<<<<<<<<<<< + * return lex.lang + * else: +*/ + } + + /* "lexeme.pxd":82 + * return lex.lang + * else: + * return 0 # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":56 + * lex.lang = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const LexemeC* lex, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lexeme, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + int __pyx_t_1; + + /* "lexeme.pxd":86 + * @staticmethod + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if lexeme.flags & (one << flag_id): + * return True +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + __pyx_t_1 = ((__pyx_v_lexeme->flags & (__pyx_v_one << __pyx_v_flag_id)) != 0); + if (__pyx_t_1) { + + /* "lexeme.pxd":88 + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): + * return True # <<<<<<<<<<<<<< + * else: + * return False +*/ + __pyx_r = 1; + goto __pyx_L0; + + /* "lexeme.pxd":87 + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 + * if lexeme.flags & (one << flag_id): # <<<<<<<<<<<<<< + * return True + * else: +*/ + } + + /* "lexeme.pxd":90 + * return True + * else: + * return False # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = 0; + goto __pyx_L0; + } + + /* "lexeme.pxd":84 + * return 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_check_flag(const LexemeC* lexeme, attr_id_t flag_id) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6lexeme_6Lexeme_c_set_flag(struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_flag_id, int __pyx_v_value) { + __pyx_t_5spacy_8typedefs_flags_t __pyx_v_one; + int __pyx_r; + + /* "lexeme.pxd":94 + * @staticmethod + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 # <<<<<<<<<<<<<< + * if value: + * lex.flags |= one << flag_id +*/ + __pyx_v_one = 1; + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + if (__pyx_v_value) { + + /* "lexeme.pxd":96 + * cdef flags_t one = 1 + * if value: + * lex.flags |= one << flag_id # <<<<<<<<<<<<<< + * else: + * lex.flags &= ~(one << flag_id) +*/ + __pyx_v_lex->flags = (__pyx_v_lex->flags | (__pyx_v_one << __pyx_v_flag_id)); + + /* "lexeme.pxd":95 + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 + * if value: # <<<<<<<<<<<<<< + * lex.flags |= one << flag_id + * else: +*/ + goto __pyx_L3; + } + + /* "lexeme.pxd":98 + * lex.flags |= one << flag_id + * else: + * lex.flags &= ~(one << flag_id) # <<<<<<<<<<<<<< +*/ + /*else*/ { + __pyx_v_lex->flags = (__pyx_v_lex->flags & (~(__pyx_v_one << __pyx_v_flag_id))); + } + __pyx_L3:; + + /* "lexeme.pxd":92 + * return False + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline bint c_set_flag(LexemeC* lex, attr_id_t flag_id, bint value) noexcept nogil: + * cdef flags_t one = 1 +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "tokens/token.pxd":22 + * cdef readonly Doc doc + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc): + * if offset < 0 or offset >= doc.length: +*/ + +static CYTHON_INLINE struct __pyx_obj_5spacy_6tokens_5token_Token *__pyx_f_5spacy_6tokens_5token_5Token_cinit(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab, CYTHON_UNUSED struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token, int __pyx_v_offset, struct __pyx_obj_5spacy_6tokens_3doc_Doc *__pyx_v_doc) { + struct __pyx_obj_5spacy_6tokens_5token_Token *__pyx_v_self = 0; + struct __pyx_obj_5spacy_6tokens_5token_Token *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("cinit", 0); + + /* "tokens/token.pxd":24 + * @staticmethod + * cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc): + * if offset < 0 or offset >= doc.length: # <<<<<<<<<<<<<< + * raise IndexError(Errors.E040.format(i=offset, max_length=doc.length)) + * cdef Token self = Token.__new__(Token, vocab, doc, offset) +*/ + __pyx_t_2 = (__pyx_v_offset < 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_offset >= __pyx_v_doc->length); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "tokens/token.pxd":25 + * cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc): + * if offset < 0 or offset >= doc.length: + * raise IndexError(Errors.E040.format(i=offset, max_length=doc.length)) # <<<<<<<<<<<<<< + * cdef Token self = Token.__new__(Token, vocab, doc, offset) + * return self +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E040); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_offset); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyLong_From_int(__pyx_v_doc->length); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_i, __pyx_t_7, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(4, 25, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_max_length, __pyx_t_9, __pyx_t_11, __pyx_callargs+1, 1) < (0)) __PYX_ERR(4, 25, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_10 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_IndexError)), __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(4, 25, __pyx_L1_error) + + /* "tokens/token.pxd":24 + * @staticmethod + * cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc): + * if offset < 0 or offset >= doc.length: # <<<<<<<<<<<<<< + * raise IndexError(Errors.E040.format(i=offset, max_length=doc.length)) + * cdef Token self = Token.__new__(Token, vocab, doc, offset) +*/ + } + + /* "tokens/token.pxd":26 + * if offset < 0 or offset >= doc.length: + * raise IndexError(Errors.E040.format(i=offset, max_length=doc.length)) + * cdef Token self = Token.__new__(Token, vocab, doc, offset) # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __Pyx_GIVEREF((PyObject *)__pyx_v_vocab); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_vocab)) != (0)) __PYX_ERR(4, 26, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_doc); + __Pyx_GIVEREF((PyObject *)__pyx_v_doc); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_doc)) != (0)) __PYX_ERR(4, 26, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(4, 26, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_tp_new(((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_6tokens_5token_Token), ((PyObject*)__pyx_t_5)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_5spacy_6tokens_5token_Token)))) __PYX_ERR(4, 26, __pyx_L1_error) + __pyx_v_self = ((struct __pyx_obj_5spacy_6tokens_5token_Token *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "tokens/token.pxd":27 + * raise IndexError(Errors.E040.format(i=offset, max_length=doc.length)) + * cdef Token self = Token.__new__(Token, vocab, doc, offset) + * return self # <<<<<<<<<<<<<< + * + * # cdef inline TokenC struct_from_attrs(Vocab vocab, attrs): +*/ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + /* "tokens/token.pxd":22 + * cdef readonly Doc doc + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline Token cinit(Vocab vocab, const TokenC* token, int offset, Doc doc): + * if offset < 0 or offset >= doc.length: +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.tokens.token.Token.cinit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "tokens/token.pxd":35 + * cpdef bint check_flag(self, attr_id_t flag_id) except -1 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const TokenC* token, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6tokens_5token_5Token_get_struct_attr(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + int __pyx_t_1; + + /* "tokens/token.pxd":37 + * @staticmethod + * cdef inline attr_t get_struct_attr(const TokenC* token, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, feat_name) + * elif feat_name == LEMMA: +*/ + __pyx_t_1 = (__pyx_v_feat_name < ((sizeof(__pyx_t_5spacy_8typedefs_flags_t)) * 8)); + if (__pyx_t_1) { + + /* "tokens/token.pxd":38 + * cdef inline attr_t get_struct_attr(const TokenC* token, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): + * return Lexeme.c_check_flag(token.lex, feat_name) # <<<<<<<<<<<<<< + * elif feat_name == LEMMA: + * return token.lemma +*/ + __pyx_r = __pyx_f_5spacy_6lexeme_6Lexeme_c_check_flag(__pyx_v_token->lex, __pyx_v_feat_name); + goto __pyx_L0; + + /* "tokens/token.pxd":37 + * @staticmethod + * cdef inline attr_t get_struct_attr(const TokenC* token, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): # <<<<<<<<<<<<<< + * return Lexeme.c_check_flag(token.lex, feat_name) + * elif feat_name == LEMMA: +*/ + } + + /* "tokens/token.pxd":39 + * if feat_name < (sizeof(flags_t) * 8): + * return Lexeme.c_check_flag(token.lex, feat_name) + * elif feat_name == LEMMA: # <<<<<<<<<<<<<< + * return token.lemma + * elif feat_name == NORM: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_LEMMA); + if (__pyx_t_1) { + + /* "tokens/token.pxd":40 + * return Lexeme.c_check_flag(token.lex, feat_name) + * elif feat_name == LEMMA: + * return token.lemma # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * if token.norm == 0: +*/ + __pyx_r = __pyx_v_token->lemma; + goto __pyx_L0; + + /* "tokens/token.pxd":39 + * if feat_name < (sizeof(flags_t) * 8): + * return Lexeme.c_check_flag(token.lex, feat_name) + * elif feat_name == LEMMA: # <<<<<<<<<<<<<< + * return token.lemma + * elif feat_name == NORM: +*/ + } + + /* "tokens/token.pxd":41 + * elif feat_name == LEMMA: + * return token.lemma + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * if token.norm == 0: + * return token.lex.norm +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_NORM); + if (__pyx_t_1) { + + /* "tokens/token.pxd":42 + * return token.lemma + * elif feat_name == NORM: + * if token.norm == 0: # <<<<<<<<<<<<<< + * return token.lex.norm + * else: +*/ + __pyx_t_1 = (__pyx_v_token->norm == 0); + if (__pyx_t_1) { + + /* "tokens/token.pxd":43 + * elif feat_name == NORM: + * if token.norm == 0: + * return token.lex.norm # <<<<<<<<<<<<<< + * else: + * return token.norm +*/ + __pyx_r = __pyx_v_token->lex->norm; + goto __pyx_L0; + + /* "tokens/token.pxd":42 + * return token.lemma + * elif feat_name == NORM: + * if token.norm == 0: # <<<<<<<<<<<<<< + * return token.lex.norm + * else: +*/ + } + + /* "tokens/token.pxd":45 + * return token.lex.norm + * else: + * return token.norm # <<<<<<<<<<<<<< + * elif feat_name == POS: + * return token.pos +*/ + /*else*/ { + __pyx_r = __pyx_v_token->norm; + goto __pyx_L0; + } + + /* "tokens/token.pxd":41 + * elif feat_name == LEMMA: + * return token.lemma + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * if token.norm == 0: + * return token.lex.norm +*/ + } + + /* "tokens/token.pxd":46 + * else: + * return token.norm + * elif feat_name == POS: # <<<<<<<<<<<<<< + * return token.pos + * elif feat_name == TAG: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_POS); + if (__pyx_t_1) { + + /* "tokens/token.pxd":47 + * return token.norm + * elif feat_name == POS: + * return token.pos # <<<<<<<<<<<<<< + * elif feat_name == TAG: + * return token.tag +*/ + __pyx_r = __pyx_v_token->pos; + goto __pyx_L0; + + /* "tokens/token.pxd":46 + * else: + * return token.norm + * elif feat_name == POS: # <<<<<<<<<<<<<< + * return token.pos + * elif feat_name == TAG: +*/ + } + + /* "tokens/token.pxd":48 + * elif feat_name == POS: + * return token.pos + * elif feat_name == TAG: # <<<<<<<<<<<<<< + * return token.tag + * elif feat_name == MORPH: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_TAG); + if (__pyx_t_1) { + + /* "tokens/token.pxd":49 + * return token.pos + * elif feat_name == TAG: + * return token.tag # <<<<<<<<<<<<<< + * elif feat_name == MORPH: + * return token.morph +*/ + __pyx_r = __pyx_v_token->tag; + goto __pyx_L0; + + /* "tokens/token.pxd":48 + * elif feat_name == POS: + * return token.pos + * elif feat_name == TAG: # <<<<<<<<<<<<<< + * return token.tag + * elif feat_name == MORPH: +*/ + } + + /* "tokens/token.pxd":50 + * elif feat_name == TAG: + * return token.tag + * elif feat_name == MORPH: # <<<<<<<<<<<<<< + * return token.morph + * elif feat_name == DEP: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_MORPH); + if (__pyx_t_1) { + + /* "tokens/token.pxd":51 + * return token.tag + * elif feat_name == MORPH: + * return token.morph # <<<<<<<<<<<<<< + * elif feat_name == DEP: + * return token.dep +*/ + __pyx_r = __pyx_v_token->morph; + goto __pyx_L0; + + /* "tokens/token.pxd":50 + * elif feat_name == TAG: + * return token.tag + * elif feat_name == MORPH: # <<<<<<<<<<<<<< + * return token.morph + * elif feat_name == DEP: +*/ + } + + /* "tokens/token.pxd":52 + * elif feat_name == MORPH: + * return token.morph + * elif feat_name == DEP: # <<<<<<<<<<<<<< + * return token.dep + * elif feat_name == HEAD: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_DEP); + if (__pyx_t_1) { + + /* "tokens/token.pxd":53 + * return token.morph + * elif feat_name == DEP: + * return token.dep # <<<<<<<<<<<<<< + * elif feat_name == HEAD: + * return token.head +*/ + __pyx_r = __pyx_v_token->dep; + goto __pyx_L0; + + /* "tokens/token.pxd":52 + * elif feat_name == MORPH: + * return token.morph + * elif feat_name == DEP: # <<<<<<<<<<<<<< + * return token.dep + * elif feat_name == HEAD: +*/ + } + + /* "tokens/token.pxd":54 + * elif feat_name == DEP: + * return token.dep + * elif feat_name == HEAD: # <<<<<<<<<<<<<< + * return token.head + * elif feat_name == SPACY: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_HEAD); + if (__pyx_t_1) { + + /* "tokens/token.pxd":55 + * return token.dep + * elif feat_name == HEAD: + * return token.head # <<<<<<<<<<<<<< + * elif feat_name == SPACY: + * return token.spacy +*/ + __pyx_r = __pyx_v_token->head; + goto __pyx_L0; + + /* "tokens/token.pxd":54 + * elif feat_name == DEP: + * return token.dep + * elif feat_name == HEAD: # <<<<<<<<<<<<<< + * return token.head + * elif feat_name == SPACY: +*/ + } + + /* "tokens/token.pxd":56 + * elif feat_name == HEAD: + * return token.head + * elif feat_name == SPACY: # <<<<<<<<<<<<<< + * return token.spacy + * elif feat_name == ENT_IOB: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SPACY); + if (__pyx_t_1) { + + /* "tokens/token.pxd":57 + * return token.head + * elif feat_name == SPACY: + * return token.spacy # <<<<<<<<<<<<<< + * elif feat_name == ENT_IOB: + * return token.ent_iob +*/ + __pyx_r = __pyx_v_token->spacy; + goto __pyx_L0; + + /* "tokens/token.pxd":56 + * elif feat_name == HEAD: + * return token.head + * elif feat_name == SPACY: # <<<<<<<<<<<<<< + * return token.spacy + * elif feat_name == ENT_IOB: +*/ + } + + /* "tokens/token.pxd":58 + * elif feat_name == SPACY: + * return token.spacy + * elif feat_name == ENT_IOB: # <<<<<<<<<<<<<< + * return token.ent_iob + * elif feat_name == ENT_TYPE: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ENT_IOB); + if (__pyx_t_1) { + + /* "tokens/token.pxd":59 + * return token.spacy + * elif feat_name == ENT_IOB: + * return token.ent_iob # <<<<<<<<<<<<<< + * elif feat_name == ENT_TYPE: + * return token.ent_type +*/ + __pyx_r = __pyx_v_token->ent_iob; + goto __pyx_L0; + + /* "tokens/token.pxd":58 + * elif feat_name == SPACY: + * return token.spacy + * elif feat_name == ENT_IOB: # <<<<<<<<<<<<<< + * return token.ent_iob + * elif feat_name == ENT_TYPE: +*/ + } + + /* "tokens/token.pxd":60 + * elif feat_name == ENT_IOB: + * return token.ent_iob + * elif feat_name == ENT_TYPE: # <<<<<<<<<<<<<< + * return token.ent_type + * elif feat_name == ENT_ID: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ENT_TYPE); + if (__pyx_t_1) { + + /* "tokens/token.pxd":61 + * return token.ent_iob + * elif feat_name == ENT_TYPE: + * return token.ent_type # <<<<<<<<<<<<<< + * elif feat_name == ENT_ID: + * return token.ent_id +*/ + __pyx_r = __pyx_v_token->ent_type; + goto __pyx_L0; + + /* "tokens/token.pxd":60 + * elif feat_name == ENT_IOB: + * return token.ent_iob + * elif feat_name == ENT_TYPE: # <<<<<<<<<<<<<< + * return token.ent_type + * elif feat_name == ENT_ID: +*/ + } + + /* "tokens/token.pxd":62 + * elif feat_name == ENT_TYPE: + * return token.ent_type + * elif feat_name == ENT_ID: # <<<<<<<<<<<<<< + * return token.ent_id + * elif feat_name == ENT_KB_ID: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ENT_ID); + if (__pyx_t_1) { + + /* "tokens/token.pxd":63 + * return token.ent_type + * elif feat_name == ENT_ID: + * return token.ent_id # <<<<<<<<<<<<<< + * elif feat_name == ENT_KB_ID: + * return token.ent_kb_id +*/ + __pyx_r = __pyx_v_token->ent_id; + goto __pyx_L0; + + /* "tokens/token.pxd":62 + * elif feat_name == ENT_TYPE: + * return token.ent_type + * elif feat_name == ENT_ID: # <<<<<<<<<<<<<< + * return token.ent_id + * elif feat_name == ENT_KB_ID: +*/ + } + + /* "tokens/token.pxd":64 + * elif feat_name == ENT_ID: + * return token.ent_id + * elif feat_name == ENT_KB_ID: # <<<<<<<<<<<<<< + * return token.ent_kb_id + * elif feat_name == SENT_START: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_ENT_KB_ID); + if (__pyx_t_1) { + + /* "tokens/token.pxd":65 + * return token.ent_id + * elif feat_name == ENT_KB_ID: + * return token.ent_kb_id # <<<<<<<<<<<<<< + * elif feat_name == SENT_START: + * return token.sent_start +*/ + __pyx_r = __pyx_v_token->ent_kb_id; + goto __pyx_L0; + + /* "tokens/token.pxd":64 + * elif feat_name == ENT_ID: + * return token.ent_id + * elif feat_name == ENT_KB_ID: # <<<<<<<<<<<<<< + * return token.ent_kb_id + * elif feat_name == SENT_START: +*/ + } + + /* "tokens/token.pxd":66 + * elif feat_name == ENT_KB_ID: + * return token.ent_kb_id + * elif feat_name == SENT_START: # <<<<<<<<<<<<<< + * return token.sent_start + * else: +*/ + __pyx_t_1 = (__pyx_v_feat_name == __pyx_e_5spacy_5attrs_SENT_START); + if (__pyx_t_1) { + + /* "tokens/token.pxd":67 + * return token.ent_kb_id + * elif feat_name == SENT_START: + * return token.sent_start # <<<<<<<<<<<<<< + * else: + * return Lexeme.get_struct_attr(token.lex, feat_name) +*/ + __pyx_r = __pyx_v_token->sent_start; + goto __pyx_L0; + + /* "tokens/token.pxd":66 + * elif feat_name == ENT_KB_ID: + * return token.ent_kb_id + * elif feat_name == SENT_START: # <<<<<<<<<<<<<< + * return token.sent_start + * else: +*/ + } + + /* "tokens/token.pxd":69 + * return token.sent_start + * else: + * return Lexeme.get_struct_attr(token.lex, feat_name) # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + /*else*/ { + __pyx_r = __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(__pyx_v_token->lex, __pyx_v_feat_name); + goto __pyx_L0; + } + + /* "tokens/token.pxd":35 + * cpdef bint check_flag(self, attr_id_t flag_id) except -1 + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t get_struct_attr(const TokenC* token, attr_id_t feat_name) noexcept nogil: + * if feat_name < (sizeof(flags_t) * 8): +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "tokens/token.pxd":71 + * return Lexeme.get_struct_attr(token.lex, feat_name) + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t set_struct_attr(TokenC* token, attr_id_t feat_name, + * attr_t value) noexcept nogil: +*/ + +static CYTHON_INLINE __pyx_t_5spacy_8typedefs_attr_t __pyx_f_5spacy_6tokens_5token_5Token_set_struct_attr(struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_token, enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_v_feat_name, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_r; + + /* "tokens/token.pxd":74 + * cdef inline attr_t set_struct_attr(TokenC* token, attr_id_t feat_name, + * attr_t value) noexcept nogil: + * if feat_name == LEMMA: # <<<<<<<<<<<<<< + * token.lemma = value + * elif feat_name == NORM: +*/ + switch (__pyx_v_feat_name) { + case __pyx_e_5spacy_5attrs_LEMMA: + + /* "tokens/token.pxd":75 + * attr_t value) noexcept nogil: + * if feat_name == LEMMA: + * token.lemma = value # <<<<<<<<<<<<<< + * elif feat_name == NORM: + * token.norm = value +*/ + __pyx_v_token->lemma = __pyx_v_value; + + /* "tokens/token.pxd":74 + * cdef inline attr_t set_struct_attr(TokenC* token, attr_id_t feat_name, + * attr_t value) noexcept nogil: + * if feat_name == LEMMA: # <<<<<<<<<<<<<< + * token.lemma = value + * elif feat_name == NORM: +*/ + break; + case __pyx_e_5spacy_5attrs_NORM: + + /* "tokens/token.pxd":77 + * token.lemma = value + * elif feat_name == NORM: + * token.norm = value # <<<<<<<<<<<<<< + * elif feat_name == POS: + * token.pos = value +*/ + __pyx_v_token->norm = __pyx_v_value; + + /* "tokens/token.pxd":76 + * if feat_name == LEMMA: + * token.lemma = value + * elif feat_name == NORM: # <<<<<<<<<<<<<< + * token.norm = value + * elif feat_name == POS: +*/ + break; + case __pyx_e_5spacy_5attrs_POS: + + /* "tokens/token.pxd":79 + * token.norm = value + * elif feat_name == POS: + * token.pos = value # <<<<<<<<<<<<<< + * elif feat_name == TAG: + * token.tag = value +*/ + __pyx_v_token->pos = ((enum __pyx_t_5spacy_15parts_of_speech_univ_pos_t)__pyx_v_value); + + /* "tokens/token.pxd":78 + * elif feat_name == NORM: + * token.norm = value + * elif feat_name == POS: # <<<<<<<<<<<<<< + * token.pos = value + * elif feat_name == TAG: +*/ + break; + case __pyx_e_5spacy_5attrs_TAG: + + /* "tokens/token.pxd":81 + * token.pos = value + * elif feat_name == TAG: + * token.tag = value # <<<<<<<<<<<<<< + * elif feat_name == MORPH: + * token.morph = value +*/ + __pyx_v_token->tag = __pyx_v_value; + + /* "tokens/token.pxd":80 + * elif feat_name == POS: + * token.pos = value + * elif feat_name == TAG: # <<<<<<<<<<<<<< + * token.tag = value + * elif feat_name == MORPH: +*/ + break; + case __pyx_e_5spacy_5attrs_MORPH: + + /* "tokens/token.pxd":83 + * token.tag = value + * elif feat_name == MORPH: + * token.morph = value # <<<<<<<<<<<<<< + * elif feat_name == DEP: + * token.dep = value +*/ + __pyx_v_token->morph = __pyx_v_value; + + /* "tokens/token.pxd":82 + * elif feat_name == TAG: + * token.tag = value + * elif feat_name == MORPH: # <<<<<<<<<<<<<< + * token.morph = value + * elif feat_name == DEP: +*/ + break; + case __pyx_e_5spacy_5attrs_DEP: + + /* "tokens/token.pxd":85 + * token.morph = value + * elif feat_name == DEP: + * token.dep = value # <<<<<<<<<<<<<< + * elif feat_name == HEAD: + * token.head = value +*/ + __pyx_v_token->dep = __pyx_v_value; + + /* "tokens/token.pxd":84 + * elif feat_name == MORPH: + * token.morph = value + * elif feat_name == DEP: # <<<<<<<<<<<<<< + * token.dep = value + * elif feat_name == HEAD: +*/ + break; + case __pyx_e_5spacy_5attrs_HEAD: + + /* "tokens/token.pxd":87 + * token.dep = value + * elif feat_name == HEAD: + * token.head = value # <<<<<<<<<<<<<< + * elif feat_name == SPACY: + * token.spacy = value +*/ + __pyx_v_token->head = __pyx_v_value; + + /* "tokens/token.pxd":86 + * elif feat_name == DEP: + * token.dep = value + * elif feat_name == HEAD: # <<<<<<<<<<<<<< + * token.head = value + * elif feat_name == SPACY: +*/ + break; + case __pyx_e_5spacy_5attrs_SPACY: + + /* "tokens/token.pxd":89 + * token.head = value + * elif feat_name == SPACY: + * token.spacy = value # <<<<<<<<<<<<<< + * elif feat_name == ENT_IOB: + * token.ent_iob = value +*/ + __pyx_v_token->spacy = __pyx_v_value; + + /* "tokens/token.pxd":88 + * elif feat_name == HEAD: + * token.head = value + * elif feat_name == SPACY: # <<<<<<<<<<<<<< + * token.spacy = value + * elif feat_name == ENT_IOB: +*/ + break; + case __pyx_e_5spacy_5attrs_ENT_IOB: + + /* "tokens/token.pxd":91 + * token.spacy = value + * elif feat_name == ENT_IOB: + * token.ent_iob = value # <<<<<<<<<<<<<< + * elif feat_name == ENT_TYPE: + * token.ent_type = value +*/ + __pyx_v_token->ent_iob = __pyx_v_value; + + /* "tokens/token.pxd":90 + * elif feat_name == SPACY: + * token.spacy = value + * elif feat_name == ENT_IOB: # <<<<<<<<<<<<<< + * token.ent_iob = value + * elif feat_name == ENT_TYPE: +*/ + break; + case __pyx_e_5spacy_5attrs_ENT_TYPE: + + /* "tokens/token.pxd":93 + * token.ent_iob = value + * elif feat_name == ENT_TYPE: + * token.ent_type = value # <<<<<<<<<<<<<< + * elif feat_name == ENT_ID: + * token.ent_id = value +*/ + __pyx_v_token->ent_type = __pyx_v_value; + + /* "tokens/token.pxd":92 + * elif feat_name == ENT_IOB: + * token.ent_iob = value + * elif feat_name == ENT_TYPE: # <<<<<<<<<<<<<< + * token.ent_type = value + * elif feat_name == ENT_ID: +*/ + break; + case __pyx_e_5spacy_5attrs_ENT_ID: + + /* "tokens/token.pxd":95 + * token.ent_type = value + * elif feat_name == ENT_ID: + * token.ent_id = value # <<<<<<<<<<<<<< + * elif feat_name == ENT_KB_ID: + * token.ent_kb_id = value +*/ + __pyx_v_token->ent_id = __pyx_v_value; + + /* "tokens/token.pxd":94 + * elif feat_name == ENT_TYPE: + * token.ent_type = value + * elif feat_name == ENT_ID: # <<<<<<<<<<<<<< + * token.ent_id = value + * elif feat_name == ENT_KB_ID: +*/ + break; + case __pyx_e_5spacy_5attrs_ENT_KB_ID: + + /* "tokens/token.pxd":97 + * token.ent_id = value + * elif feat_name == ENT_KB_ID: + * token.ent_kb_id = value # <<<<<<<<<<<<<< + * elif feat_name == SENT_START: + * token.sent_start = value +*/ + __pyx_v_token->ent_kb_id = __pyx_v_value; + + /* "tokens/token.pxd":96 + * elif feat_name == ENT_ID: + * token.ent_id = value + * elif feat_name == ENT_KB_ID: # <<<<<<<<<<<<<< + * token.ent_kb_id = value + * elif feat_name == SENT_START: +*/ + break; + case __pyx_e_5spacy_5attrs_SENT_START: + + /* "tokens/token.pxd":99 + * token.ent_kb_id = value + * elif feat_name == SENT_START: + * token.sent_start = value # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_v_token->sent_start = __pyx_v_value; + + /* "tokens/token.pxd":98 + * elif feat_name == ENT_KB_ID: + * token.ent_kb_id = value + * elif feat_name == SENT_START: # <<<<<<<<<<<<<< + * token.sent_start = value + * +*/ + break; + default: break; + } + + /* "tokens/token.pxd":71 + * return Lexeme.get_struct_attr(token.lex, feat_name) + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline attr_t set_struct_attr(TokenC* token, attr_id_t feat_name, + * attr_t value) noexcept nogil: +*/ + + /* function exit code */ + __pyx_r = 0; + return __pyx_r; +} + +/* "tokens/token.pxd":101 + * token.sent_start = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline int missing_dep(const TokenC* token) noexcept nogil: + * return token.dep == MISSING_DEP +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6tokens_5token_5Token_missing_dep(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token) { + int __pyx_r; + + /* "tokens/token.pxd":103 + * @staticmethod + * cdef inline int missing_dep(const TokenC* token) noexcept nogil: + * return token.dep == MISSING_DEP # <<<<<<<<<<<<<< + * + * @staticmethod +*/ + __pyx_r = (__pyx_v_token->dep == __pyx_v_5spacy_6tokens_5token_MISSING_DEP); + goto __pyx_L0; + + /* "tokens/token.pxd":101 + * token.sent_start = value + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline int missing_dep(const TokenC* token) noexcept nogil: + * return token.dep == MISSING_DEP +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "tokens/token.pxd":105 + * return token.dep == MISSING_DEP + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline int missing_head(const TokenC* token) noexcept nogil: + * return Token.missing_dep(token) +*/ + +static CYTHON_INLINE int __pyx_f_5spacy_6tokens_5token_5Token_missing_head(struct __pyx_t_5spacy_7structs_TokenC const *__pyx_v_token) { + int __pyx_r; + + /* "tokens/token.pxd":107 + * @staticmethod + * cdef inline int missing_head(const TokenC* token) noexcept nogil: + * return Token.missing_dep(token) # <<<<<<<<<<<<<< +*/ + __pyx_r = __pyx_f_5spacy_6tokens_5token_5Token_missing_dep(__pyx_v_token); + goto __pyx_L0; + + /* "tokens/token.pxd":105 + * return token.dep == MISSING_DEP + * + * @staticmethod # <<<<<<<<<<<<<< + * cdef inline int missing_head(const TokenC* token) noexcept nogil: + * return Token.missing_dep(token) +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "spacy/vocab.pyx":26 + * + * + * def create_vocab(lang, defaults, vectors_name=None): # <<<<<<<<<<<<<< + * # If the spacy-lookups-data package is installed, we pre-populate the lookups + * # with lexeme data, if available +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_1create_vocab(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_create_vocab, "create_vocab(lang, defaults, vectors_name=None)"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_1create_vocab = {"create_vocab", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_1create_vocab, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_create_vocab}; +static PyObject *__pyx_pw_5spacy_5vocab_1create_vocab(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_lang = 0; + PyObject *__pyx_v_defaults = 0; + PyObject *__pyx_v_vectors_name = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("create_vocab (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_lang,&__pyx_mstate_global->__pyx_n_u_defaults,&__pyx_mstate_global->__pyx_n_u_vectors_name,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 26, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 26, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 26, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 26, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "create_vocab", 0) < (0)) __PYX_ERR(0, 26, __pyx_L3_error) + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("create_vocab", 0, 2, 3, i); __PYX_ERR(0, 26, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 26, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 26, __pyx_L3_error) + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 26, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_lang = values[0]; + __pyx_v_defaults = values[1]; + __pyx_v_vectors_name = values[2]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("create_vocab", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 26, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.create_vocab", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_create_vocab(__pyx_self, __pyx_v_lang, __pyx_v_defaults, __pyx_v_vectors_name); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_create_vocab(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lang, PyObject *__pyx_v_defaults, PyObject *__pyx_v_vectors_name) { + PyObject *__pyx_v_lex_attrs = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("create_vocab", 0); + + /* "spacy/vocab.pyx":29 + * # If the spacy-lookups-data package is installed, we pre-populate the lookups + * # with lexeme data, if available + * lex_attrs = {**LEX_ATTRS, **defaults.lex_attr_getters} # <<<<<<<<<<<<<< + * # This is messy, but it's the minimal working fix to Issue #639. + * lex_attrs[IS_STOP] = functools.partial(is_stop, stops=defaults.stop_words) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_LEX_ATTRS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(__pyx_t_2 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(0, 29, __pyx_L1_error) + } + if (likely(PyDict_CheckExact(__pyx_t_2))) { + #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_IS_UNIQUELY_REFERENCED(__pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference)) { + __pyx_t_1 = __pyx_t_2; + __pyx_t_2 = 0; + } else + #endif + { + __pyx_t_1 = PyDict_Copy(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + } else { + __pyx_t_1 = __Pyx_PyObject_CallOneArg((PyObject*)&PyDict_Type, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_defaults, __pyx_mstate_global->__pyx_n_u_lex_attr_getters); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(__pyx_t_2 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(0, 29, __pyx_L1_error) + } + if (unlikely(PyDict_Update(__pyx_t_1, __pyx_t_2) < 0)) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseMappingExpectedError(__pyx_t_2); + __PYX_ERR(0, 29, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_lex_attrs = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":31 + * lex_attrs = {**LEX_ATTRS, **defaults.lex_attr_getters} + * # This is messy, but it's the minimal working fix to Issue #639. + * lex_attrs[IS_STOP] = functools.partial(is_stop, stops=defaults.stop_words) # <<<<<<<<<<<<<< + * # Ensure that getter can be pickled + * lex_attrs[LANG] = functools.partial(get_lang, lang=lang) +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_functools); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_partial); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_is_stop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_defaults, __pyx_mstate_global->__pyx_n_u_stop_words); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_stops, __pyx_t_5, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_IS_STOP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((PyDict_SetItem(__pyx_v_lex_attrs, __pyx_t_4, __pyx_t_1) < 0))) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":33 + * lex_attrs[IS_STOP] = functools.partial(is_stop, stops=defaults.stop_words) + * # Ensure that getter can be pickled + * lex_attrs[LANG] = functools.partial(get_lang, lang=lang) # <<<<<<<<<<<<<< + * lex_attrs[NORM] = util.add_lookups( + * lex_attrs.get(NORM, LEX_ATTRS[NORM]), +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_functools); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_partial); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_get_lang); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_t_7}; + __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_lang, __pyx_v_lang, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_5 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_LANG); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely((PyDict_SetItem(__pyx_v_lex_attrs, __pyx_t_5, __pyx_t_1) < 0))) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":34 + * # Ensure that getter can be pickled + * lex_attrs[LANG] = functools.partial(get_lang, lang=lang) + * lex_attrs[NORM] = util.add_lookups( # <<<<<<<<<<<<<< + * lex_attrs.get(NORM, LEX_ATTRS[NORM]), + * BASE_NORMS, +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_add_lookups); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/vocab.pyx":35 + * lex_attrs[LANG] = functools.partial(get_lang, lang=lang) + * lex_attrs[NORM] = util.add_lookups( + * lex_attrs.get(NORM, LEX_ATTRS[NORM]), # <<<<<<<<<<<<<< + * BASE_NORMS, + * ) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_LEX_ATTRS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_lex_attrs, __pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "spacy/vocab.pyx":36 + * lex_attrs[NORM] = util.add_lookups( + * lex_attrs.get(NORM, LEX_ATTRS[NORM]), + * BASE_NORMS, # <<<<<<<<<<<<<< + * ) + * return Vocab( +*/ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_BASE_NORMS); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_7, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_2, __pyx_t_8}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + + /* "spacy/vocab.pyx":34 + * # Ensure that getter can be pickled + * lex_attrs[LANG] = functools.partial(get_lang, lang=lang) + * lex_attrs[NORM] = util.add_lookups( # <<<<<<<<<<<<<< + * lex_attrs.get(NORM, LEX_ATTRS[NORM]), + * BASE_NORMS, +*/ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (unlikely((PyDict_SetItem(__pyx_v_lex_attrs, __pyx_t_7, __pyx_t_1) < 0))) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":38 + * BASE_NORMS, + * ) + * return Vocab( # <<<<<<<<<<<<<< + * lex_attr_getters=lex_attrs, + * writing_system=defaults.writing_system, +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = NULL; + + /* "spacy/vocab.pyx":40 + * return Vocab( + * lex_attr_getters=lex_attrs, + * writing_system=defaults.writing_system, # <<<<<<<<<<<<<< + * get_noun_chunks=defaults.syntax_iterators.get("noun_chunks"), + * vectors_name=vectors_name, +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_defaults, __pyx_mstate_global->__pyx_n_u_writing_system); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + + /* "spacy/vocab.pyx":41 + * lex_attr_getters=lex_attrs, + * writing_system=defaults.writing_system, + * get_noun_chunks=defaults.syntax_iterators.get("noun_chunks"), # <<<<<<<<<<<<<< + * vectors_name=vectors_name, + * ) +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_defaults, __pyx_mstate_global->__pyx_n_u_syntax_iterators); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_n_u_noun_chunks}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + + /* "spacy/vocab.pyx":42 + * writing_system=defaults.writing_system, + * get_noun_chunks=defaults.syntax_iterators.get("noun_chunks"), + * vectors_name=vectors_name, # <<<<<<<<<<<<<< + * ) + * +*/ + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_7, NULL}; + __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_lex_attr_getters, __pyx_v_lex_attrs, __pyx_t_3, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_writing_system, __pyx_t_8, __pyx_t_3, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_get_noun_chunks, __pyx_t_2, __pyx_t_3, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_vectors_name, __pyx_v_vectors_name, __pyx_t_3, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vocab.pyx":26 + * + * + * def create_vocab(lang, defaults, vectors_name=None): # <<<<<<<<<<<<<< + * # If the spacy-lookups-data package is installed, we pre-populate the lookups + * # with lexeme data, if available +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.vocab.create_vocab", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_lex_attrs); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":53 + * DOCS: https://spacy.io/api/vocab + * """ + * def __init__( # <<<<<<<<<<<<<< + * self, + * lex_attr_getters=None, +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab___init__, "Create the vocabulary.\n\n lex_attr_getters (dict): A dictionary mapping attribute IDs to\n functions to compute them. Defaults to `None`.\n strings (StringStore): StringStore that maps strings to integers, and\n vice versa.\n lookups (Lookups): Container for large lookup tables and dictionaries.\n oov_prob (float): Default OOV probability.\n vectors_name (str): Optional name to identify the vectors table.\n get_noun_chunks (Optional[Callable[[Union[Doc, Span], Iterator[Tuple[int, int, int]]]]]):\n A function that yields base noun phrases used for Doc.noun_chunks.\n "); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_5vocab_5Vocab___init__; +#endif +static int __pyx_pw_5spacy_5vocab_5Vocab_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_lex_attr_getters = 0; + PyObject *__pyx_v_strings = 0; + PyObject *__pyx_v_lookups = 0; + PyObject *__pyx_v_oov_prob = 0; + PyObject *__pyx_v_vectors_name = 0; + PyObject *__pyx_v_writing_system = 0; + PyObject *__pyx_v_get_noun_chunks = 0; + CYTHON_UNUSED PyObject *__pyx_v_deprecated_kwargs = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_lex_attr_getters,&__pyx_mstate_global->__pyx_n_u_strings,&__pyx_mstate_global->__pyx_n_u_lookups,&__pyx_mstate_global->__pyx_n_u_oov_prob,&__pyx_mstate_global->__pyx_n_u_vectors_name,&__pyx_mstate_global->__pyx_n_u_writing_system,&__pyx_mstate_global->__pyx_n_u_get_noun_chunks,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 53, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 7: + values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 6: + values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_deprecated_kwargs, values, kwd_pos_args, __pyx_kwds_len, "__init__", 1) < (0)) __PYX_ERR(0, 53, __pyx_L3_error) + + /* "spacy/vocab.pyx":55 + * def __init__( + * self, + * lex_attr_getters=None, # <<<<<<<<<<<<<< + * strings=tuple(), + * lookups=None, +*/ + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__6); + + /* "spacy/vocab.pyx":57 + * lex_attr_getters=None, + * strings=tuple(), + * lookups=None, # <<<<<<<<<<<<<< + * oov_prob=-20., + * vectors_name=None, +*/ + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_float_neg_20_)); + + /* "spacy/vocab.pyx":59 + * lookups=None, + * oov_prob=-20., + * vectors_name=None, # <<<<<<<<<<<<<< + * writing_system={}, # no-cython-lint + * get_noun_chunks=None, +*/ + if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[5]) values[5] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__7); + + /* "spacy/vocab.pyx":61 + * vectors_name=None, + * writing_system={}, # no-cython-lint + * get_noun_chunks=None, # <<<<<<<<<<<<<< + * **deprecated_kwargs + * ): +*/ + if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None)); + } else { + switch (__pyx_nargs) { + case 7: + values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 6: + values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 5: + values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 53, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + + /* "spacy/vocab.pyx":55 + * def __init__( + * self, + * lex_attr_getters=None, # <<<<<<<<<<<<<< + * strings=tuple(), + * lookups=None, +*/ + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__6); + + /* "spacy/vocab.pyx":57 + * lex_attr_getters=None, + * strings=tuple(), + * lookups=None, # <<<<<<<<<<<<<< + * oov_prob=-20., + * vectors_name=None, +*/ + if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_float_neg_20_)); + + /* "spacy/vocab.pyx":59 + * lookups=None, + * oov_prob=-20., + * vectors_name=None, # <<<<<<<<<<<<<< + * writing_system={}, # no-cython-lint + * get_noun_chunks=None, +*/ + if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[5]) values[5] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__7); + + /* "spacy/vocab.pyx":61 + * vectors_name=None, + * writing_system={}, # no-cython-lint + * get_noun_chunks=None, # <<<<<<<<<<<<<< + * **deprecated_kwargs + * ): +*/ + if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_lex_attr_getters = values[0]; + __pyx_v_strings = values[1]; + __pyx_v_lookups = values[2]; + __pyx_v_oov_prob = values[3]; + __pyx_v_vectors_name = values[4]; + __pyx_v_writing_system = values[5]; + __pyx_v_get_noun_chunks = values[6]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 7, __pyx_nargs); __PYX_ERR(0, 53, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_XDECREF(__pyx_v_deprecated_kwargs); __pyx_v_deprecated_kwargs = 0; + __Pyx_AddTraceback("spacy.vocab.Vocab.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab___init__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_lex_attr_getters, __pyx_v_strings, __pyx_v_lookups, __pyx_v_oov_prob, __pyx_v_vectors_name, __pyx_v_writing_system, __pyx_v_get_noun_chunks, __pyx_v_deprecated_kwargs); + + /* "spacy/vocab.pyx":53 + * DOCS: https://spacy.io/api/vocab + * """ + * def __init__( # <<<<<<<<<<<<<< + * self, + * lex_attr_getters=None, +*/ + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_XDECREF(__pyx_v_deprecated_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab___init__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_lex_attr_getters, PyObject *__pyx_v_strings, PyObject *__pyx_v_lookups, PyObject *__pyx_v_oov_prob, PyObject *__pyx_v_vectors_name, PyObject *__pyx_v_writing_system, PyObject *__pyx_v_get_noun_chunks, CYTHON_UNUSED PyObject *__pyx_v_deprecated_kwargs) { + PyObject *__pyx_v_string = NULL; + CYTHON_UNUSED PyObject *__pyx_v__ = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_INCREF(__pyx_v_lex_attr_getters); + __Pyx_INCREF(__pyx_v_lookups); + + /* "spacy/vocab.pyx":76 + * A function that yields base noun phrases used for Doc.noun_chunks. + * """ + * lex_attr_getters = lex_attr_getters if lex_attr_getters is not None else {} # <<<<<<<<<<<<<< + * if lookups in (None, True, False): + * lookups = Lookups() +*/ + __pyx_t_2 = (__pyx_v_lex_attr_getters != Py_None); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_v_lex_attr_getters); + __pyx_t_1 = __pyx_v_lex_attr_getters; + } else { + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __Pyx_DECREF_SET(__pyx_v_lex_attr_getters, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":77 + * """ + * lex_attr_getters = lex_attr_getters if lex_attr_getters is not None else {} + * if lookups in (None, True, False): # <<<<<<<<<<<<<< + * lookups = Lookups() + * self.cfg = {'oov_prob': oov_prob} +*/ + __Pyx_INCREF(__pyx_v_lookups); + __pyx_t_1 = __pyx_v_lookups; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, Py_False, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __pyx_t_2; + if (__pyx_t_4) { + + /* "spacy/vocab.pyx":78 + * lex_attr_getters = lex_attr_getters if lex_attr_getters is not None else {} + * if lookups in (None, True, False): + * lookups = Lookups() # <<<<<<<<<<<<<< + * self.cfg = {'oov_prob': oov_prob} + * self.mem = Pool() +*/ + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Lookups); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_lookups, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":77 + * """ + * lex_attr_getters = lex_attr_getters if lex_attr_getters is not None else {} + * if lookups in (None, True, False): # <<<<<<<<<<<<<< + * lookups = Lookups() + * self.cfg = {'oov_prob': oov_prob} +*/ + } + + /* "spacy/vocab.pyx":79 + * if lookups in (None, True, False): + * lookups = Lookups() + * self.cfg = {'oov_prob': oov_prob} # <<<<<<<<<<<<<< + * self.mem = Pool() + * self._by_orth = PreshMap() +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_oov_prob, __pyx_v_oov_prob) < (0)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->cfg); + __Pyx_DECREF(__pyx_v_self->cfg); + __pyx_v_self->cfg = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":80 + * lookups = Lookups() + * self.cfg = {'oov_prob': oov_prob} + * self.mem = Pool() # <<<<<<<<<<<<<< + * self._by_orth = PreshMap() + * self.strings = StringStore() +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->mem); + __Pyx_DECREF((PyObject *)__pyx_v_self->mem); + __pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":81 + * self.cfg = {'oov_prob': oov_prob} + * self.mem = Pool() + * self._by_orth = PreshMap() # <<<<<<<<<<<<<< + * self.strings = StringStore() + * self.length = 0 +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_7preshed_4maps_PreshMap, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_by_orth); + __Pyx_DECREF((PyObject *)__pyx_v_self->_by_orth); + __pyx_v_self->_by_orth = ((struct __pyx_obj_7preshed_4maps_PreshMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":82 + * self.mem = Pool() + * self._by_orth = PreshMap() + * self.strings = StringStore() # <<<<<<<<<<<<<< + * self.length = 0 + * if strings: +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->strings); + __Pyx_DECREF((PyObject *)__pyx_v_self->strings); + __pyx_v_self->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":83 + * self._by_orth = PreshMap() + * self.strings = StringStore() + * self.length = 0 # <<<<<<<<<<<<<< + * if strings: + * for string in strings: +*/ + __pyx_v_self->length = 0; + + /* "spacy/vocab.pyx":84 + * self.strings = StringStore() + * self.length = 0 + * if strings: # <<<<<<<<<<<<<< + * for string in strings: + * _ = self[string] +*/ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_strings); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 84, __pyx_L1_error) + if (__pyx_t_4) { + + /* "spacy/vocab.pyx":85 + * self.length = 0 + * if strings: + * for string in strings: # <<<<<<<<<<<<<< + * _ = self[string] + * self.lex_attr_getters = lex_attr_getters +*/ + if (likely(PyList_CheckExact(__pyx_v_strings)) || PyTuple_CheckExact(__pyx_v_strings)) { + __pyx_t_1 = __pyx_v_strings; __Pyx_INCREF(__pyx_t_1); + __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_strings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 85, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 85, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 85, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) + } else { + __pyx_t_5 = __pyx_t_8(__pyx_t_1); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 85, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_string, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":86 + * if strings: + * for string in strings: + * _ = self[string] # <<<<<<<<<<<<<< + * self.lex_attr_getters = lex_attr_getters + * self.morphology = Morphology(self.strings) +*/ + __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_string); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":85 + * self.length = 0 + * if strings: + * for string in strings: # <<<<<<<<<<<<<< + * _ = self[string] + * self.lex_attr_getters = lex_attr_getters +*/ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":84 + * self.strings = StringStore() + * self.length = 0 + * if strings: # <<<<<<<<<<<<<< + * for string in strings: + * _ = self[string] +*/ + } + + /* "spacy/vocab.pyx":87 + * for string in strings: + * _ = self[string] + * self.lex_attr_getters = lex_attr_getters # <<<<<<<<<<<<<< + * self.morphology = Morphology(self.strings) + * self.vectors = Vectors(strings=self.strings, name=vectors_name) +*/ + __Pyx_INCREF(__pyx_v_lex_attr_getters); + __Pyx_GIVEREF(__pyx_v_lex_attr_getters); + __Pyx_GOTREF(__pyx_v_self->lex_attr_getters); + __Pyx_DECREF(__pyx_v_self->lex_attr_getters); + __pyx_v_self->lex_attr_getters = __pyx_v_lex_attr_getters; + + /* "spacy/vocab.pyx":88 + * _ = self[string] + * self.lex_attr_getters = lex_attr_getters + * self.morphology = Morphology(self.strings) # <<<<<<<<<<<<<< + * self.vectors = Vectors(strings=self.strings, name=vectors_name) + * self.lookups = lookups +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_self->strings)}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->morphology); + __Pyx_DECREF((PyObject *)__pyx_v_self->morphology); + __pyx_v_self->morphology = ((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":89 + * self.lex_attr_getters = lex_attr_getters + * self.morphology = Morphology(self.strings) + * self.vectors = Vectors(strings=self.strings, name=vectors_name) # <<<<<<<<<<<<<< + * self.lookups = lookups + * self.writing_system = writing_system +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Vectors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_5, NULL}; + __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_strings, ((PyObject *)__pyx_v_self->strings), __pyx_t_9, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 89, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name, __pyx_v_vectors_name, __pyx_t_9, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors, __pyx_t_1) < (0)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":90 + * self.morphology = Morphology(self.strings) + * self.vectors = Vectors(strings=self.strings, name=vectors_name) + * self.lookups = lookups # <<<<<<<<<<<<<< + * self.writing_system = writing_system + * self.get_noun_chunks = get_noun_chunks +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_lookups, __pyx_v_lookups) < (0)) __PYX_ERR(0, 90, __pyx_L1_error) + + /* "spacy/vocab.pyx":91 + * self.vectors = Vectors(strings=self.strings, name=vectors_name) + * self.lookups = lookups + * self.writing_system = writing_system # <<<<<<<<<<<<<< + * self.get_noun_chunks = get_noun_chunks + * # During a memory_zone we replace our mem object with one +*/ + __Pyx_INCREF(__pyx_v_writing_system); + __Pyx_GIVEREF(__pyx_v_writing_system); + __Pyx_GOTREF(__pyx_v_self->writing_system); + __Pyx_DECREF(__pyx_v_self->writing_system); + __pyx_v_self->writing_system = __pyx_v_writing_system; + + /* "spacy/vocab.pyx":92 + * self.lookups = lookups + * self.writing_system = writing_system + * self.get_noun_chunks = get_noun_chunks # <<<<<<<<<<<<<< + * # During a memory_zone we replace our mem object with one + * # that's passed to us. We keep a reference to our non-temporary +*/ + __Pyx_INCREF(__pyx_v_get_noun_chunks); + __Pyx_GIVEREF(__pyx_v_get_noun_chunks); + __Pyx_GOTREF(__pyx_v_self->get_noun_chunks); + __Pyx_DECREF(__pyx_v_self->get_noun_chunks); + __pyx_v_self->get_noun_chunks = __pyx_v_get_noun_chunks; + + /* "spacy/vocab.pyx":98 + * # guarantee is not temporary. This is also how we check whether + * # we're in a memory zone: we check whether self.mem is self._non_temp_mem + * self._non_temp_mem = self.mem # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_1 = ((PyObject *)__pyx_v_self->mem); + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_non_temp_mem); + __Pyx_DECREF((PyObject *)__pyx_v_self->_non_temp_mem); + __pyx_v_self->_non_temp_mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":53 + * DOCS: https://spacy.io/api/vocab + * """ + * def __init__( # <<<<<<<<<<<<<< + * self, + * lex_attr_getters=None, +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("spacy.vocab.Vocab.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_string); + __Pyx_XDECREF(__pyx_v__); + __Pyx_XDECREF(__pyx_v_lex_attr_getters); + __Pyx_XDECREF(__pyx_v_lookups); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":100 + * self._non_temp_mem = self.mem + * + * @property # <<<<<<<<<<<<<< + * def vectors(self): + * return self._vectors +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_7vectors_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_7vectors_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_7vectors___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_7vectors___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/vocab.pyx":102 + * @property + * def vectors(self): + * return self._vectors # <<<<<<<<<<<<<< + * + * @vectors.setter +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_vectors); + __pyx_r = __pyx_v_self->_vectors; + goto __pyx_L0; + + /* "spacy/vocab.pyx":100 + * self._non_temp_mem = self.mem + * + * @property # <<<<<<<<<<<<<< + * def vectors(self): + * return self._vectors +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":104 + * return self._vectors + * + * @vectors.setter # <<<<<<<<<<<<<< + * def vectors(self, vectors): + * if hasattr(vectors, "strings"): +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_7vectors_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_vectors); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_7vectors_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_vectors) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_7vectors_2__set__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), ((PyObject *)__pyx_v_vectors)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_7vectors_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_vectors) { + PyObject *__pyx_v_s = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/vocab.pyx":106 + * @vectors.setter + * def vectors(self, vectors): + * if hasattr(vectors, "strings"): # <<<<<<<<<<<<<< + * for s in vectors.strings: + * self.strings.add(s, allow_transient=False) +*/ + __pyx_t_1 = __Pyx_HasAttr(__pyx_v_vectors, __pyx_mstate_global->__pyx_n_u_strings); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 106, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":107 + * def vectors(self, vectors): + * if hasattr(vectors, "strings"): + * for s in vectors.strings: # <<<<<<<<<<<<<< + * self.strings.add(s, allow_transient=False) + * self._vectors = vectors +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_vectors, __pyx_mstate_global->__pyx_n_u_strings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 107, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_4; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 107, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); + #endif + ++__pyx_t_4; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 107, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":108 + * if hasattr(vectors, "strings"): + * for s in vectors.strings: + * self.strings.add(s, allow_transient=False) # <<<<<<<<<<<<<< + * self._vectors = vectors + * self._vectors.strings = self.strings +*/ + __pyx_t_6 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, __pyx_v_s}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_False, __pyx_t_8, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":107 + * def vectors(self, vectors): + * if hasattr(vectors, "strings"): + * for s in vectors.strings: # <<<<<<<<<<<<<< + * self.strings.add(s, allow_transient=False) + * self._vectors = vectors +*/ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/vocab.pyx":106 + * @vectors.setter + * def vectors(self, vectors): + * if hasattr(vectors, "strings"): # <<<<<<<<<<<<<< + * for s in vectors.strings: + * self.strings.add(s, allow_transient=False) +*/ + } + + /* "spacy/vocab.pyx":109 + * for s in vectors.strings: + * self.strings.add(s, allow_transient=False) + * self._vectors = vectors # <<<<<<<<<<<<<< + * self._vectors.strings = self.strings + * +*/ + __Pyx_INCREF(__pyx_v_vectors); + __Pyx_GIVEREF(__pyx_v_vectors); + __Pyx_GOTREF(__pyx_v_self->_vectors); + __Pyx_DECREF(__pyx_v_self->_vectors); + __pyx_v_self->_vectors = __pyx_v_vectors; + + /* "spacy/vocab.pyx":110 + * self.strings.add(s, allow_transient=False) + * self._vectors = vectors + * self._vectors.strings = self.strings # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_3); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self->_vectors, __pyx_mstate_global->__pyx_n_u_strings, __pyx_t_3) < (0)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/vocab.pyx":104 + * return self._vectors + * + * @vectors.setter # <<<<<<<<<<<<<< + * def vectors(self, vectors): + * if hasattr(vectors, "strings"): +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.vocab.Vocab.vectors.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_s); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":112 + * self._vectors.strings = self.strings + * + * @property # <<<<<<<<<<<<<< + * def lang(self): + * langfunc = None +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_4lang_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_4lang_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_4lang___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_4lang___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_v_langfunc = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/vocab.pyx":114 + * @property + * def lang(self): + * langfunc = None # <<<<<<<<<<<<<< + * if self.lex_attr_getters: + * langfunc = self.lex_attr_getters.get(LANG, None) +*/ + __Pyx_INCREF(Py_None); + __pyx_v_langfunc = Py_None; + + /* "spacy/vocab.pyx":115 + * def lang(self): + * langfunc = None + * if self.lex_attr_getters: # <<<<<<<<<<<<<< + * langfunc = self.lex_attr_getters.get(LANG, None) + * return langfunc("_") if langfunc else "" +*/ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->lex_attr_getters); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 115, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":116 + * langfunc = None + * if self.lex_attr_getters: + * langfunc = self.lex_attr_getters.get(LANG, None) # <<<<<<<<<<<<<< + * return langfunc("_") if langfunc else "" + * +*/ + __pyx_t_3 = __pyx_v_self->lex_attr_getters; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_LANG); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_4, Py_None}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF_SET(__pyx_v_langfunc, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":115 + * def lang(self): + * langfunc = None + * if self.lex_attr_getters: # <<<<<<<<<<<<<< + * langfunc = self.lex_attr_getters.get(LANG, None) + * return langfunc("_") if langfunc else "" +*/ + } + + /* "spacy/vocab.pyx":117 + * if self.lex_attr_getters: + * langfunc = self.lex_attr_getters.get(LANG, None) + * return langfunc("_") if langfunc else "" # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_langfunc); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 117, __pyx_L1_error) + if (__pyx_t_1) { + __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_langfunc); + __pyx_t_6 = __pyx_v_langfunc; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u__8}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_2 = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__9); + __pyx_t_2 = __pyx_mstate_global->__pyx_kp_u__9; + } + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/vocab.pyx":112 + * self._vectors.strings = self.strings + * + * @property # <<<<<<<<<<<<<< + * def lang(self): + * langfunc = None +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("spacy.vocab.Vocab.lang.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_langfunc); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":119 + * return langfunc("_") if langfunc else "" + * + * @property # <<<<<<<<<<<<<< + * def in_memory_zone(self) -> bool: + * return self.mem is not self._non_temp_mem +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_14in_memory_zone_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_14in_memory_zone_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_14in_memory_zone___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_14in_memory_zone___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/vocab.pyx":121 + * @property + * def in_memory_zone(self) -> bool: + * return self.mem is not self._non_temp_mem # <<<<<<<<<<<<<< + * + * def __len__(self): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = (__pyx_v_self->mem != __pyx_v_self->_non_temp_mem); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/vocab.pyx":119 + * return langfunc("_") if langfunc else "" + * + * @property # <<<<<<<<<<<<<< + * def in_memory_zone(self) -> bool: + * return self.mem is not self._non_temp_mem +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vocab.Vocab.in_memory_zone.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":123 + * return self.mem is not self._non_temp_mem + * + * def __len__(self): # <<<<<<<<<<<<<< + * """The current number of lexemes stored. + * +*/ + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_5spacy_5vocab_5Vocab_3__len__(PyObject *__pyx_v_self); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_2__len__, "Vocab.__len__(self)\n\nThe current number of lexemes stored.\n\nRETURNS (int): The current number of lexemes stored."); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_5vocab_5Vocab_2__len__; +#endif +static Py_ssize_t __pyx_pw_5spacy_5vocab_5Vocab_3__len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_2__len__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_pf_5spacy_5vocab_5Vocab_2__len__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + Py_ssize_t __pyx_r; + + /* "spacy/vocab.pyx":128 + * RETURNS (int): The current number of lexemes stored. + * """ + * return self.length # <<<<<<<<<<<<<< + * + * @contextmanager +*/ + __pyx_r = __pyx_v_self->length; + goto __pyx_L0; + + /* "spacy/vocab.pyx":123 + * return self.mem is not self._non_temp_mem + * + * def __len__(self): # <<<<<<<<<<<<<< + * """The current number of lexemes stored. + * +*/ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_5vocab_5Vocab_6generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/vocab.pyx":130 + * return self.length + * + * @contextmanager # <<<<<<<<<<<<<< + * def memory_zone(self, mem: Optional[Pool] = None) -> Iterator[Pool]: + * """Begin a block where resources allocated during the block will +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_5memory_zone(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_4memory_zone, "Vocab.memory_zone(self, mem: Optional[Pool] = None) -> Iterator[Pool]\n\nBegin a block where resources allocated during the block will\nbe freed at the end of it. If a resources was created within the\nmemory zone block, accessing it outside the block is invalid.\nBehaviour of this invalid access is undefined. Memory zones should\nnot be nested.\n\nThe memory zone is helpful for services that need to process large\nvolumes of text with a defined memory budget."); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_5memory_zone = {"memory_zone", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_5memory_zone, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_4memory_zone}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_5memory_zone(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_mem = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("memory_zone (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_mem,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 130, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 130, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "memory_zone", 0) < (0)) __PYX_ERR(0, 130, __pyx_L3_error) + + /* "spacy/vocab.pyx":131 + * + * @contextmanager + * def memory_zone(self, mem: Optional[Pool] = None) -> Iterator[Pool]: # <<<<<<<<<<<<<< + * """Begin a block where resources allocated during the block will + * be freed at the end of it. If a resources was created within the +*/ + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + } else { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 130, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_mem = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("memory_zone", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 130, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.memory_zone", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_4memory_zone(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_mem); + + /* "spacy/vocab.pyx":130 + * return self.length + * + * @contextmanager # <<<<<<<<<<<<<< + * def memory_zone(self, mem: Optional[Pool] = None) -> Iterator[Pool]: + * """Begin a block where resources allocated during the block will +*/ + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_4memory_zone(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_mem) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memory_zone", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone *)__pyx_tp_new_5spacy_5vocab___pyx_scope_struct__memory_zone(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 130, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_cur_scope->__pyx_v_mem = __pyx_v_mem; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_mem); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_mem); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_5vocab_5Vocab_6generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_memory_zone, __pyx_mstate_global->__pyx_n_u_Vocab_memory_zone, __pyx_mstate_global->__pyx_n_u_spacy_vocab); if (unlikely(!gen)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vocab.Vocab.memory_zone", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_5vocab_5Vocab_6generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone *__pyx_cur_scope = ((struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("memory_zone", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L17_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 130, __pyx_L1_error) + } + + /* "spacy/vocab.pyx":141 + * volumes of text with a defined memory budget. + * """ + * if mem is None: # <<<<<<<<<<<<<< + * mem = Pool() + * # The ExitStack allows programmatic nested context managers. +*/ + __pyx_t_1 = (__pyx_cur_scope->__pyx_v_mem == Py_None); + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":142 + * """ + * if mem is None: + * mem = Pool() # <<<<<<<<<<<<<< + * # The ExitStack allows programmatic nested context managers. + * # We don't know how many we need, so it would be awkward to have +*/ + __pyx_t_3 = NULL; + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + } + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_mem); + __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_mem, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":141 + * volumes of text with a defined memory budget. + * """ + * if mem is None: # <<<<<<<<<<<<<< + * mem = Pool() + * # The ExitStack allows programmatic nested context managers. +*/ + } + + /* "spacy/vocab.pyx":146 + * # We don't know how many we need, so it would be awkward to have + * # them as nested blocks. + * with ExitStack() as stack: # <<<<<<<<<<<<<< + * contexts = [stack.enter_context(self.strings.memory_zone(mem))] + * if hasattr(self.morphology, "memory_zone"): +*/ + /*with:*/ { + __pyx_t_3 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ExitStack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = NULL; + __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_7, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_7 = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /*try:*/ { + { + __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + /*try:*/ { + __Pyx_GIVEREF(__pyx_t_7); + __pyx_cur_scope->__pyx_v_stack = __pyx_t_7; + __pyx_t_7 = 0; + + /* "spacy/vocab.pyx":147 + * # them as nested blocks. + * with ExitStack() as stack: + * contexts = [stack.enter_context(self.strings.memory_zone(mem))] # <<<<<<<<<<<<<< + * if hasattr(self.morphology, "memory_zone"): + * contexts.append(stack.enter_context(self.morphology.memory_zone(mem))) +*/ + __pyx_t_2 = __pyx_cur_scope->__pyx_v_stack; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_mem}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_memory_zone, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_enter_context, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 147, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_7) != (0)) __PYX_ERR(0, 147, __pyx_L9_error); + __pyx_t_7 = 0; + __Pyx_GIVEREF(__pyx_t_5); + __pyx_cur_scope->__pyx_v_contexts = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":148 + * with ExitStack() as stack: + * contexts = [stack.enter_context(self.strings.memory_zone(mem))] + * if hasattr(self.morphology, "memory_zone"): # <<<<<<<<<<<<<< + * contexts.append(stack.enter_context(self.morphology.memory_zone(mem))) + * if hasattr(self._vectors, "memory_zone"): +*/ + __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->morphology); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_1 = __Pyx_HasAttr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_memory_zone); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 148, __pyx_L9_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":149 + * contexts = [stack.enter_context(self.strings.memory_zone(mem))] + * if hasattr(self.morphology, "memory_zone"): + * contexts.append(stack.enter_context(self.morphology.memory_zone(mem))) # <<<<<<<<<<<<<< + * if hasattr(self._vectors, "memory_zone"): + * contexts.append(stack.enter_context(self._vectors.memory_zone(mem))) +*/ + __pyx_t_7 = __pyx_cur_scope->__pyx_v_stack; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_3 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->morphology); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_mem}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_memory_zone, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_enter_context, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 149, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_11 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_contexts, __pyx_t_5); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 149, __pyx_L9_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":148 + * with ExitStack() as stack: + * contexts = [stack.enter_context(self.strings.memory_zone(mem))] + * if hasattr(self.morphology, "memory_zone"): # <<<<<<<<<<<<<< + * contexts.append(stack.enter_context(self.morphology.memory_zone(mem))) + * if hasattr(self._vectors, "memory_zone"): +*/ + } + + /* "spacy/vocab.pyx":150 + * if hasattr(self.morphology, "memory_zone"): + * contexts.append(stack.enter_context(self.morphology.memory_zone(mem))) + * if hasattr(self._vectors, "memory_zone"): # <<<<<<<<<<<<<< + * contexts.append(stack.enter_context(self._vectors.memory_zone(mem))) + * self.mem = mem +*/ + __pyx_t_5 = __pyx_cur_scope->__pyx_v_self->_vectors; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_1 = __Pyx_HasAttr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_memory_zone); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 150, __pyx_L9_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":151 + * contexts.append(stack.enter_context(self.morphology.memory_zone(mem))) + * if hasattr(self._vectors, "memory_zone"): + * contexts.append(stack.enter_context(self._vectors.memory_zone(mem))) # <<<<<<<<<<<<<< + * self.mem = mem + * yield mem +*/ + __pyx_t_2 = __pyx_cur_scope->__pyx_v_stack; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->_vectors; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_mem}; + __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_memory_zone, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 151, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_7}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_enter_context, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 151, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_11 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_contexts, __pyx_t_5); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 151, __pyx_L9_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":150 + * if hasattr(self.morphology, "memory_zone"): + * contexts.append(stack.enter_context(self.morphology.memory_zone(mem))) + * if hasattr(self._vectors, "memory_zone"): # <<<<<<<<<<<<<< + * contexts.append(stack.enter_context(self._vectors.memory_zone(mem))) + * self.mem = mem +*/ + } + + /* "spacy/vocab.pyx":152 + * if hasattr(self._vectors, "memory_zone"): + * contexts.append(stack.enter_context(self._vectors.memory_zone(mem))) + * self.mem = mem # <<<<<<<<<<<<<< + * yield mem + * self._clear_transient_orths() +*/ + __pyx_t_5 = __pyx_cur_scope->__pyx_v_mem; + __Pyx_INCREF(__pyx_t_5); + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool))))) __PYX_ERR(0, 152, __pyx_L9_error) + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GOTREF((PyObject *)__pyx_cur_scope->__pyx_v_self->mem); + __Pyx_DECREF((PyObject *)__pyx_cur_scope->__pyx_v_self->mem); + __pyx_cur_scope->__pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":153 + * contexts.append(stack.enter_context(self._vectors.memory_zone(mem))) + * self.mem = mem + * yield mem # <<<<<<<<<<<<<< + * self._clear_transient_orths() + * self.mem = self._non_temp_mem +*/ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_mem); + __pyx_r = __pyx_cur_scope->__pyx_v_mem; + __Pyx_XGIVEREF(__pyx_t_6); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_6; + __Pyx_XGIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_8; + __Pyx_XGIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_t_2 = __pyx_t_9; + __Pyx_XGIVEREF(__pyx_t_10); + __pyx_cur_scope->__pyx_t_3 = __pyx_t_10; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L17_resume_from_yield:; + __pyx_t_6 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_8 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_8); + __pyx_t_9 = __pyx_cur_scope->__pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = 0; + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_10 = __pyx_cur_scope->__pyx_t_3; + __pyx_cur_scope->__pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_t_10); + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 153, __pyx_L9_error) + + /* "spacy/vocab.pyx":146 + * # We don't know how many we need, so it would be awkward to have + * # them as nested blocks. + * with ExitStack() as stack: # <<<<<<<<<<<<<< + * contexts = [stack.enter_context(self.strings.memory_zone(mem))] + * if hasattr(self.morphology, "memory_zone"): +*/ + } + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L14_try_end; + __pyx_L9_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + /*except:*/ { + __Pyx_AddTraceback("spacy.vocab.Vocab.memory_zone", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(0, 146, __pyx_L11_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 146, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (__pyx_t_1 < (0)) __PYX_ERR(0, 146, __pyx_L11_except_error) + __pyx_t_13 = (!__pyx_t_1); + if (unlikely(__pyx_t_13)) { + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_7, __pyx_t_2); + __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_2 = 0; + __PYX_ERR(0, 146, __pyx_L11_except_error) + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L10_exception_handled; + } + __pyx_L11_except_error:; + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + goto __pyx_L1_error; + __pyx_L10_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + __pyx_L14_try_end:; + } + } + /*finally:*/ { + /*normal exit:*/{ + if (__pyx_t_6) { + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_mstate_global->__pyx_tuple[2], NULL); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + goto __pyx_L8; + } + __pyx_L8:; + } + goto __pyx_L21; + __pyx_L5_error:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L1_error; + __pyx_L21:; + } + + /* "spacy/vocab.pyx":154 + * self.mem = mem + * yield mem + * self._clear_transient_orths() # <<<<<<<<<<<<<< + * self.mem = self._non_temp_mem + * +*/ + __pyx_t_7 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_INCREF(__pyx_t_7); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_clear_transient_orths, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":155 + * yield mem + * self._clear_transient_orths() + * self.mem = self._non_temp_mem # <<<<<<<<<<<<<< + * + * def add_flag(self, flag_getter, int flag_id=-1): +*/ + __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->_non_temp_mem); + __Pyx_INCREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF((PyObject *)__pyx_cur_scope->__pyx_v_self->mem); + __Pyx_DECREF((PyObject *)__pyx_cur_scope->__pyx_v_self->mem); + __pyx_cur_scope->__pyx_v_self->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_2); + __pyx_t_2 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "spacy/vocab.pyx":130 + * return self.length + * + * @contextmanager # <<<<<<<<<<<<<< + * def memory_zone(self, mem: Optional[Pool] = None) -> Iterator[Pool]: + * """Begin a block where resources allocated during the block will +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("memory_zone", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":157 + * self.mem = self._non_temp_mem + * + * def add_flag(self, flag_getter, int flag_id=-1): # <<<<<<<<<<<<<< + * """Set a new boolean flag to words in the vocabulary. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_8add_flag(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_7add_flag, "Vocab.add_flag(self, flag_getter, int flag_id=-1)\n\nSet a new boolean flag to words in the vocabulary.\n\nThe flag_getter function will be called over the words currently in the\nvocab, and then applied to new words as they occur. You'll then be able\nto access the flag value on each token using token.check_flag(flag_id).\nSee also: `Lexeme.set_flag`, `Lexeme.check_flag`, `Token.set_flag`,\n`Token.check_flag`.\n\nflag_getter (callable): A function `f(str) -> bool`, to get the\n flag value.\nflag_id (int): An integer between 1 and 63 (inclusive), specifying\n the bit at which the flag will be stored. If -1, the lowest\n available bit will be chosen.\nRETURNS (int): The integer ID by which the flag value can be checked.\n\nDOCS: https://spacy.io/api/vocab#add_flag"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_8add_flag = {"add_flag", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_8add_flag, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_7add_flag}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_8add_flag(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_flag_getter = 0; + int __pyx_v_flag_id; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_flag (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_flag_getter,&__pyx_mstate_global->__pyx_n_u_flag_id,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 157, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 157, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 157, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "add_flag", 0) < (0)) __PYX_ERR(0, 157, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add_flag", 0, 1, 2, i); __PYX_ERR(0, 157, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 157, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 157, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_flag_getter = values[0]; + if (values[1]) { + __pyx_v_flag_id = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_flag_id == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L3_error) + } else { + __pyx_v_flag_id = ((int)-1); + } + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_flag", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 157, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.add_flag", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_7add_flag(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_flag_getter, __pyx_v_flag_id); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_7add_flag(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_flag_getter, int __pyx_v_flag_id) { + long __pyx_v_bit; + PyObject *__pyx_v_lex = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + long __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + Py_ssize_t __pyx_t_12; + PyObject *(*__pyx_t_13)(PyObject *); + PyObject *__pyx_t_14 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("add_flag", 0); + + /* "spacy/vocab.pyx":175 + * DOCS: https://spacy.io/api/vocab#add_flag + * """ + * if flag_id == -1: # <<<<<<<<<<<<<< + * for bit in range(1, 64): + * if bit not in self.lex_attr_getters: +*/ + __pyx_t_1 = (__pyx_v_flag_id == -1L); + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":176 + * """ + * if flag_id == -1: + * for bit in range(1, 64): # <<<<<<<<<<<<<< + * if bit not in self.lex_attr_getters: + * flag_id = bit +*/ + for (__pyx_t_2 = 1; __pyx_t_2 < 64; __pyx_t_2+=1) { + __pyx_v_bit = __pyx_t_2; + + /* "spacy/vocab.pyx":177 + * if flag_id == -1: + * for bit in range(1, 64): + * if bit not in self.lex_attr_getters: # <<<<<<<<<<<<<< + * flag_id = bit + * break +*/ + __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v_bit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_3, __pyx_v_self->lex_attr_getters, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":178 + * for bit in range(1, 64): + * if bit not in self.lex_attr_getters: + * flag_id = bit # <<<<<<<<<<<<<< + * break + * else: +*/ + __pyx_v_flag_id = __pyx_v_bit; + + /* "spacy/vocab.pyx":179 + * if bit not in self.lex_attr_getters: + * flag_id = bit + * break # <<<<<<<<<<<<<< + * else: + * raise ValueError(Errors.E062) +*/ + goto __pyx_L5_break; + + /* "spacy/vocab.pyx":177 + * if flag_id == -1: + * for bit in range(1, 64): + * if bit not in self.lex_attr_getters: # <<<<<<<<<<<<<< + * flag_id = bit + * break +*/ + } + } + /*else*/ { + + /* "spacy/vocab.pyx":181 + * break + * else: + * raise ValueError(Errors.E062) # <<<<<<<<<<<<<< + * elif flag_id >= 64 or flag_id < 1: + * raise ValueError(Errors.E063.format(value=flag_id)) +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_E062); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 181, __pyx_L1_error) + } + __pyx_L5_break:; + + /* "spacy/vocab.pyx":175 + * DOCS: https://spacy.io/api/vocab#add_flag + * """ + * if flag_id == -1: # <<<<<<<<<<<<<< + * for bit in range(1, 64): + * if bit not in self.lex_attr_getters: +*/ + goto __pyx_L3; + } + + /* "spacy/vocab.pyx":182 + * else: + * raise ValueError(Errors.E062) + * elif flag_id >= 64 or flag_id < 1: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E063.format(value=flag_id)) + * for lex in self: +*/ + __pyx_t_8 = (__pyx_v_flag_id >= 64); + if (!__pyx_t_8) { + } else { + __pyx_t_1 = __pyx_t_8; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_8 = (__pyx_v_flag_id < 1); + __pyx_t_1 = __pyx_t_8; + __pyx_L7_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "spacy/vocab.pyx":183 + * raise ValueError(Errors.E062) + * elif flag_id >= 64 or flag_id < 1: + * raise ValueError(Errors.E063.format(value=flag_id)) # <<<<<<<<<<<<<< + * for lex in self: + * lex.set_flag(flag_id, flag_getter(lex.orth_)) +*/ + __pyx_t_6 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_E063); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_5 = __pyx_t_10; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyLong_From_int(__pyx_v_flag_id); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, NULL}; + __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_value, __pyx_t_9, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_7 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 183, __pyx_L1_error) + + /* "spacy/vocab.pyx":182 + * else: + * raise ValueError(Errors.E062) + * elif flag_id >= 64 or flag_id < 1: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E063.format(value=flag_id)) + * for lex in self: +*/ + } + __pyx_L3:; + + /* "spacy/vocab.pyx":184 + * elif flag_id >= 64 or flag_id < 1: + * raise ValueError(Errors.E063.format(value=flag_id)) + * for lex in self: # <<<<<<<<<<<<<< + * lex.set_flag(flag_id, flag_getter(lex.orth_)) + * self.lex_attr_getters[flag_id] = flag_getter +*/ + if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) { + __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); + __pyx_t_12 = 0; + __pyx_t_13 = NULL; + } else { + __pyx_t_12 = -1; __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 184, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_13)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 184, __pyx_L1_error) + #endif + if (__pyx_t_12 >= __pyx_temp) break; + } + __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_12, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_12; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 184, __pyx_L1_error) + #endif + if (__pyx_t_12 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_12)); + #else + __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_12); + #endif + ++__pyx_t_12; + } + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error) + } else { + __pyx_t_4 = __pyx_t_13(__pyx_t_3); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 184, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_lex, __pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":185 + * raise ValueError(Errors.E063.format(value=flag_id)) + * for lex in self: + * lex.set_flag(flag_id, flag_getter(lex.orth_)) # <<<<<<<<<<<<<< + * self.lex_attr_getters[flag_id] = flag_getter + * return flag_id +*/ + __pyx_t_6 = __pyx_v_lex; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_10 = __Pyx_PyLong_From_int(__pyx_v_flag_id); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = NULL; + __Pyx_INCREF(__pyx_v_flag_getter); + __pyx_t_5 = __pyx_v_flag_getter; + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_lex, __pyx_mstate_global->__pyx_n_u_orth); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_7 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_9); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_14}; + __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_10, __pyx_t_11}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_set_flag, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":184 + * elif flag_id >= 64 or flag_id < 1: + * raise ValueError(Errors.E063.format(value=flag_id)) + * for lex in self: # <<<<<<<<<<<<<< + * lex.set_flag(flag_id, flag_getter(lex.orth_)) + * self.lex_attr_getters[flag_id] = flag_getter +*/ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "spacy/vocab.pyx":186 + * for lex in self: + * lex.set_flag(flag_id, flag_getter(lex.orth_)) + * self.lex_attr_getters[flag_id] = flag_getter # <<<<<<<<<<<<<< + * return flag_id + * +*/ + if (unlikely((__Pyx_SetItemInt(__pyx_v_self->lex_attr_getters, __pyx_v_flag_id, __pyx_v_flag_getter, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1, __Pyx_ReferenceSharing_SharedReference) < 0))) __PYX_ERR(0, 186, __pyx_L1_error) + + /* "spacy/vocab.pyx":187 + * lex.set_flag(flag_id, flag_getter(lex.orth_)) + * self.lex_attr_getters[flag_id] = flag_getter + * return flag_id # <<<<<<<<<<<<<< + * + * cdef const LexemeC* get(self, Pool mem, str string) except NULL: +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_flag_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/vocab.pyx":157 + * self.mem = self._non_temp_mem + * + * def add_flag(self, flag_getter, int flag_id=-1): # <<<<<<<<<<<<<< + * """Set a new boolean flag to words in the vocabulary. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("spacy.vocab.Vocab.add_flag", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_lex); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":189 + * return flag_id + * + * cdef const LexemeC* get(self, Pool mem, str string) except NULL: # <<<<<<<<<<<<<< + * """Get a pointer to a `LexemeC` from the lexicon, creating a new + * `Lexeme` if necessary. +*/ + +static struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_f_5spacy_5vocab_5Vocab_get(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, PyObject *__pyx_v_string) { + struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex; + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key; + struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_3; + void *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + size_t __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get", 0); + + /* "spacy/vocab.pyx":193 + * `Lexeme` if necessary. + * """ + * if string == "": # <<<<<<<<<<<<<< + * return &EMPTY_LEXEME + * cdef LexemeC* lex +*/ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_string, __pyx_mstate_global->__pyx_kp_u__9, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 193, __pyx_L1_error) + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":194 + * """ + * if string == "": + * return &EMPTY_LEXEME # <<<<<<<<<<<<<< + * cdef LexemeC* lex + * cdef hash_t key = self.strings[string] +*/ + __pyx_r = (&__pyx_v_5spacy_6lexeme_EMPTY_LEXEME); + goto __pyx_L0; + + /* "spacy/vocab.pyx":193 + * `Lexeme` if necessary. + * """ + * if string == "": # <<<<<<<<<<<<<< + * return &EMPTY_LEXEME + * cdef LexemeC* lex +*/ + } + + /* "spacy/vocab.pyx":196 + * return &EMPTY_LEXEME + * cdef LexemeC* lex + * cdef hash_t key = self.strings[string] # <<<<<<<<<<<<<< + * lex = self._by_orth.get(key) + * if lex != NULL: +*/ + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_v_string); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_As_uint64_t(__pyx_t_2); if (unlikely((__pyx_t_3 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_key = __pyx_t_3; + + /* "spacy/vocab.pyx":197 + * cdef LexemeC* lex + * cdef hash_t key = self.strings[string] + * lex = self._by_orth.get(key) # <<<<<<<<<<<<<< + * if lex != NULL: + * assert lex.orth in self.strings +*/ + __pyx_t_4 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_by_orth->__pyx_vtab)->get(__pyx_v_self->_by_orth, __pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_v_lex = ((struct __pyx_t_5spacy_7structs_LexemeC *)__pyx_t_4); + + /* "spacy/vocab.pyx":198 + * cdef hash_t key = self.strings[string] + * lex = self._by_orth.get(key) + * if lex != NULL: # <<<<<<<<<<<<<< + * assert lex.orth in self.strings + * if lex.orth != key: +*/ + __pyx_t_1 = (__pyx_v_lex != NULL); + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":199 + * lex = self._by_orth.get(key) + * if lex != NULL: + * assert lex.orth in self.strings # <<<<<<<<<<<<<< + * if lex.orth != key: + * raise KeyError(Errors.E064.format(string=lex.orth, +*/ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, ((PyObject *)__pyx_v_self->strings), Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_AssertionError))), 0, 0, 0); + __PYX_ERR(0, 199, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(0, 199, __pyx_L1_error) + #endif + + /* "spacy/vocab.pyx":200 + * if lex != NULL: + * assert lex.orth in self.strings + * if lex.orth != key: # <<<<<<<<<<<<<< + * raise KeyError(Errors.E064.format(string=lex.orth, + * orth=key, orth_id=string)) +*/ + __pyx_t_1 = (__pyx_v_lex->orth != __pyx_v_key); + if (unlikely(__pyx_t_1)) { + + /* "spacy/vocab.pyx":201 + * assert lex.orth in self.strings + * if lex.orth != key: + * raise KeyError(Errors.E064.format(string=lex.orth, # <<<<<<<<<<<<<< + * orth=key, orth_id=string)) + * return lex +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_E064); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_7 = __pyx_t_9; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyLong_From_uint64_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + + /* "spacy/vocab.pyx":202 + * if lex.orth != key: + * raise KeyError(Errors.E064.format(string=lex.orth, + * orth=key, orth_id=string)) # <<<<<<<<<<<<<< + * return lex + * else: +*/ + __pyx_t_10 = __Pyx_PyLong_From_uint64_t(__pyx_v_key); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_7, NULL}; + __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_string, __pyx_t_8, __pyx_t_12, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 201, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_orth_2, __pyx_t_10, __pyx_t_12, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 201, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_orth_id, __pyx_v_string, __pyx_t_12, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_11 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_KeyError)), __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 201, __pyx_L1_error) + + /* "spacy/vocab.pyx":200 + * if lex != NULL: + * assert lex.orth in self.strings + * if lex.orth != key: # <<<<<<<<<<<<<< + * raise KeyError(Errors.E064.format(string=lex.orth, + * orth=key, orth_id=string)) +*/ + } + + /* "spacy/vocab.pyx":203 + * raise KeyError(Errors.E064.format(string=lex.orth, + * orth=key, orth_id=string)) + * return lex # <<<<<<<<<<<<<< + * else: + * return self._new_lexeme(mem, string) +*/ + __pyx_r = __pyx_v_lex; + goto __pyx_L0; + + /* "spacy/vocab.pyx":198 + * cdef hash_t key = self.strings[string] + * lex = self._by_orth.get(key) + * if lex != NULL: # <<<<<<<<<<<<<< + * assert lex.orth in self.strings + * if lex.orth != key: +*/ + } + + /* "spacy/vocab.pyx":205 + * return lex + * else: + * return self._new_lexeme(mem, string) # <<<<<<<<<<<<<< + * + * cdef const LexemeC* get_by_orth(self, Pool mem, attr_t orth) except NULL: +*/ + /*else*/ { + __pyx_t_13 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->__pyx_vtab)->_new_lexeme(__pyx_v_self, __pyx_v_mem, __pyx_v_string); if (unlikely(__pyx_t_13 == ((void *)NULL))) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_r = __pyx_t_13; + goto __pyx_L0; + } + + /* "spacy/vocab.pyx":189 + * return flag_id + * + * cdef const LexemeC* get(self, Pool mem, str string) except NULL: # <<<<<<<<<<<<<< + * """Get a pointer to a `LexemeC` from the lexicon, creating a new + * `Lexeme` if necessary. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("spacy.vocab.Vocab.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":207 + * return self._new_lexeme(mem, string) + * + * cdef const LexemeC* get_by_orth(self, Pool mem, attr_t orth) except NULL: # <<<<<<<<<<<<<< + * """Get a pointer to a `LexemeC` from the lexicon, creating a new + * `Lexeme` if necessary using memory acquired from the given pool. If the +*/ + +static struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_f_5spacy_5vocab_5Vocab_get_by_orth(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, __pyx_t_5spacy_8typedefs_attr_t __pyx_v_orth) { + struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex; + struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + void *__pyx_t_2; + PyObject *__pyx_t_3 = NULL; + struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_by_orth", 0); + + /* "spacy/vocab.pyx":212 + * pool is the lexicon's own memory, the lexeme is saved in the lexicon. + * """ + * if orth == 0: # <<<<<<<<<<<<<< + * return &EMPTY_LEXEME + * cdef LexemeC* lex +*/ + __pyx_t_1 = (__pyx_v_orth == 0); + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":213 + * """ + * if orth == 0: + * return &EMPTY_LEXEME # <<<<<<<<<<<<<< + * cdef LexemeC* lex + * lex = self._by_orth.get(orth) +*/ + __pyx_r = (&__pyx_v_5spacy_6lexeme_EMPTY_LEXEME); + goto __pyx_L0; + + /* "spacy/vocab.pyx":212 + * pool is the lexicon's own memory, the lexeme is saved in the lexicon. + * """ + * if orth == 0: # <<<<<<<<<<<<<< + * return &EMPTY_LEXEME + * cdef LexemeC* lex +*/ + } + + /* "spacy/vocab.pyx":215 + * return &EMPTY_LEXEME + * cdef LexemeC* lex + * lex = self._by_orth.get(orth) # <<<<<<<<<<<<<< + * if lex != NULL: + * return lex +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_by_orth->__pyx_vtab)->get(__pyx_v_self->_by_orth, __pyx_v_orth); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L1_error) + __pyx_v_lex = ((struct __pyx_t_5spacy_7structs_LexemeC *)__pyx_t_2); + + /* "spacy/vocab.pyx":216 + * cdef LexemeC* lex + * lex = self._by_orth.get(orth) + * if lex != NULL: # <<<<<<<<<<<<<< + * return lex + * else: +*/ + __pyx_t_1 = (__pyx_v_lex != NULL); + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":217 + * lex = self._by_orth.get(orth) + * if lex != NULL: + * return lex # <<<<<<<<<<<<<< + * else: + * return self._new_lexeme(mem, self.strings[orth]) +*/ + __pyx_r = __pyx_v_lex; + goto __pyx_L0; + + /* "spacy/vocab.pyx":216 + * cdef LexemeC* lex + * lex = self._by_orth.get(orth) + * if lex != NULL: # <<<<<<<<<<<<<< + * return lex + * else: +*/ + } + + /* "spacy/vocab.pyx":219 + * return lex + * else: + * return self._new_lexeme(mem, self.strings[orth]) # <<<<<<<<<<<<<< + * + * cdef const LexemeC* _new_lexeme(self, Pool mem, str string) except NULL: +*/ + /*else*/ { + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->strings), __pyx_v_orth, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_3))) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_4 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->__pyx_vtab)->_new_lexeme(__pyx_v_self, __pyx_v_mem, ((PyObject*)__pyx_t_3)); if (unlikely(__pyx_t_4 == ((void *)NULL))) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + goto __pyx_L0; + } + + /* "spacy/vocab.pyx":207 + * return self._new_lexeme(mem, string) + * + * cdef const LexemeC* get_by_orth(self, Pool mem, attr_t orth) except NULL: # <<<<<<<<<<<<<< + * """Get a pointer to a `LexemeC` from the lexicon, creating a new + * `Lexeme` if necessary using memory acquired from the given pool. If the +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.vocab.Vocab.get_by_orth", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":221 + * return self._new_lexeme(mem, self.strings[orth]) + * + * cdef const LexemeC* _new_lexeme(self, Pool mem, str string) except NULL: # <<<<<<<<<<<<<< + * # The mem argument is deprecated, replaced by memory zones. Same with + * # this size heuristic. +*/ + +static struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_f_5spacy_5vocab_5Vocab__new_lexeme(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, struct __pyx_obj_5cymem_5cymem_Pool *__pyx_v_mem, PyObject *__pyx_v_string) { + struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex; + PyObject *__pyx_v_attr = NULL; + PyObject *__pyx_v_func = NULL; + PyObject *__pyx_v_value = NULL; + struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + void *__pyx_t_2; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *(*__pyx_t_13)(PyObject *); + enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_t_14; + int __pyx_t_15; + PyObject *__pyx_t_16 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_new_lexeme", 0); + __Pyx_INCREF((PyObject *)__pyx_v_mem); + + /* "spacy/vocab.pyx":224 + * # The mem argument is deprecated, replaced by memory zones. Same with + * # this size heuristic. + * mem = self.mem # <<<<<<<<<<<<<< + * lex = mem.alloc(1, sizeof(LexemeC)) + * lex.orth = self.strings.add(string, allow_transient=True) +*/ + __pyx_t_1 = ((PyObject *)__pyx_v_self->mem); + __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_mem, ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":225 + * # this size heuristic. + * mem = self.mem + * lex = mem.alloc(1, sizeof(LexemeC)) # <<<<<<<<<<<<<< + * lex.orth = self.strings.add(string, allow_transient=True) + * lex.length = len(string) +*/ + __pyx_t_2 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_mem->__pyx_vtab)->alloc(__pyx_v_mem, 1, (sizeof(struct __pyx_t_5spacy_7structs_LexemeC))); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_v_lex = ((struct __pyx_t_5spacy_7structs_LexemeC *)__pyx_t_2); + + /* "spacy/vocab.pyx":226 + * mem = self.mem + * lex = mem.alloc(1, sizeof(LexemeC)) + * lex.orth = self.strings.add(string, allow_transient=True) # <<<<<<<<<<<<<< + * lex.length = len(string) + * if self.vectors is not None and hasattr(self.vectors, "key2row"): +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_v_string}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_True, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_lex->orth = __pyx_t_6; + + /* "spacy/vocab.pyx":227 + * lex = mem.alloc(1, sizeof(LexemeC)) + * lex.orth = self.strings.add(string, allow_transient=True) + * lex.length = len(string) # <<<<<<<<<<<<<< + * if self.vectors is not None and hasattr(self.vectors, "key2row"): + * lex.id = self.vectors.key2row.get(lex.orth, OOV_RANK) +*/ + if (unlikely(__pyx_v_string == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 227, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyUnicode_GET_LENGTH(__pyx_v_string); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_v_lex->length = __pyx_t_7; + + /* "spacy/vocab.pyx":228 + * lex.orth = self.strings.add(string, allow_transient=True) + * lex.length = len(string) + * if self.vectors is not None and hasattr(self.vectors, "key2row"): # <<<<<<<<<<<<<< + * lex.id = self.vectors.key2row.get(lex.orth, OOV_RANK) + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = (__pyx_t_1 != Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_9) { + } else { + __pyx_t_8 = __pyx_t_9; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_HasAttr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_key2row); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = __pyx_t_9; + __pyx_L4_bool_binop_done:; + if (__pyx_t_8) { + + /* "spacy/vocab.pyx":229 + * lex.length = len(string) + * if self.vectors is not None and hasattr(self.vectors, "key2row"): + * lex.id = self.vectors.key2row.get(lex.orth, OOV_RANK) # <<<<<<<<<<<<<< + * else: + * lex.id = OOV_RANK +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_key2row); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_t_10; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyLong_From_uint64_t(__pyx_v_lex->orth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = __Pyx_PyLong_From_uint64_t(__pyx_v_5spacy_6lexeme_OOV_RANK); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_11}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_lex->id = __pyx_t_6; + + /* "spacy/vocab.pyx":228 + * lex.orth = self.strings.add(string, allow_transient=True) + * lex.length = len(string) + * if self.vectors is not None and hasattr(self.vectors, "key2row"): # <<<<<<<<<<<<<< + * lex.id = self.vectors.key2row.get(lex.orth, OOV_RANK) + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/vocab.pyx":231 + * lex.id = self.vectors.key2row.get(lex.orth, OOV_RANK) + * else: + * lex.id = OOV_RANK # <<<<<<<<<<<<<< + * if self.lex_attr_getters is not None: + * for attr, func in self.lex_attr_getters.items(): +*/ + /*else*/ { + __pyx_v_lex->id = __pyx_v_5spacy_6lexeme_OOV_RANK; + } + __pyx_L3:; + + /* "spacy/vocab.pyx":232 + * else: + * lex.id = OOV_RANK + * if self.lex_attr_getters is not None: # <<<<<<<<<<<<<< + * for attr, func in self.lex_attr_getters.items(): + * value = func(string) +*/ + __pyx_t_8 = (__pyx_v_self->lex_attr_getters != Py_None); + if (__pyx_t_8) { + + /* "spacy/vocab.pyx":233 + * lex.id = OOV_RANK + * if self.lex_attr_getters is not None: + * for attr, func in self.lex_attr_getters.items(): # <<<<<<<<<<<<<< + * value = func(string) + * if isinstance(value, str): +*/ + __pyx_t_10 = __pyx_v_self->lex_attr_getters; + __Pyx_INCREF(__pyx_t_10); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_10 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10); + __pyx_t_7 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 233, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_10))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_10); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 233, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_10, __pyx_t_7, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_7; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_10); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 233, __pyx_L1_error) + #endif + if (__pyx_t_7 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_7)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_7); + #endif + ++__pyx_t_7; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_12(__pyx_t_10); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 233, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 233, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_11); + __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_3); + } + #else + __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); + index = 0; __pyx_t_11 = __pyx_t_13(__pyx_t_5); if (unlikely(!__pyx_t_11)) goto __pyx_L9_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + index = 1; __pyx_t_3 = __pyx_t_13(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L9_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_5), 2) < (0)) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L10_unpacking_done; + __pyx_L9_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_L10_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_attr, __pyx_t_11); + __pyx_t_11 = 0; + __Pyx_XDECREF_SET(__pyx_v_func, __pyx_t_3); + __pyx_t_3 = 0; + + /* "spacy/vocab.pyx":234 + * if self.lex_attr_getters is not None: + * for attr, func in self.lex_attr_getters.items(): + * value = func(string) # <<<<<<<<<<<<<< + * if isinstance(value, str): + * value = self.strings.add(value, allow_transient=True) +*/ + __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_func); + __pyx_t_11 = __pyx_v_func; + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11); + assert(__pyx_t_3); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_11, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_string}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":235 + * for attr, func in self.lex_attr_getters.items(): + * value = func(string) + * if isinstance(value, str): # <<<<<<<<<<<<<< + * value = self.strings.add(value, allow_transient=True) + * if value is not None: +*/ + __pyx_t_8 = PyUnicode_Check(__pyx_v_value); + if (__pyx_t_8) { + + /* "spacy/vocab.pyx":236 + * value = func(string) + * if isinstance(value, str): + * value = self.strings.add(value, allow_transient=True) # <<<<<<<<<<<<<< + * if value is not None: + * Lexeme.set_struct_attr(lex, attr, value) +*/ + __pyx_t_11 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_11, __pyx_v_value}; + __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_True, __pyx_t_3, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 236, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":235 + * for attr, func in self.lex_attr_getters.items(): + * value = func(string) + * if isinstance(value, str): # <<<<<<<<<<<<<< + * value = self.strings.add(value, allow_transient=True) + * if value is not None: +*/ + } + + /* "spacy/vocab.pyx":237 + * if isinstance(value, str): + * value = self.strings.add(value, allow_transient=True) + * if value is not None: # <<<<<<<<<<<<<< + * Lexeme.set_struct_attr(lex, attr, value) + * self._add_lex_to_vocab(lex.orth, lex, self.mem is not self._non_temp_mem) +*/ + __pyx_t_8 = (__pyx_v_value != Py_None); + if (__pyx_t_8) { + + /* "spacy/vocab.pyx":238 + * value = self.strings.add(value, allow_transient=True) + * if value is not None: + * Lexeme.set_struct_attr(lex, attr, value) # <<<<<<<<<<<<<< + * self._add_lex_to_vocab(lex.orth, lex, self.mem is not self._non_temp_mem) + * if lex == NULL: +*/ + __pyx_t_14 = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_v_attr)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_v_value); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(__pyx_v_lex, __pyx_t_14, __pyx_t_6); + + /* "spacy/vocab.pyx":237 + * if isinstance(value, str): + * value = self.strings.add(value, allow_transient=True) + * if value is not None: # <<<<<<<<<<<<<< + * Lexeme.set_struct_attr(lex, attr, value) + * self._add_lex_to_vocab(lex.orth, lex, self.mem is not self._non_temp_mem) +*/ + } + + /* "spacy/vocab.pyx":233 + * lex.id = OOV_RANK + * if self.lex_attr_getters is not None: + * for attr, func in self.lex_attr_getters.items(): # <<<<<<<<<<<<<< + * value = func(string) + * if isinstance(value, str): +*/ + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":232 + * else: + * lex.id = OOV_RANK + * if self.lex_attr_getters is not None: # <<<<<<<<<<<<<< + * for attr, func in self.lex_attr_getters.items(): + * value = func(string) +*/ + } + + /* "spacy/vocab.pyx":239 + * if value is not None: + * Lexeme.set_struct_attr(lex, attr, value) + * self._add_lex_to_vocab(lex.orth, lex, self.mem is not self._non_temp_mem) # <<<<<<<<<<<<<< + * if lex == NULL: + * raise ValueError(Errors.E085.format(string=string)) +*/ + __pyx_t_8 = (__pyx_v_self->mem != __pyx_v_self->_non_temp_mem); + __pyx_t_15 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->__pyx_vtab)->_add_lex_to_vocab(__pyx_v_self, __pyx_v_lex->orth, __pyx_v_lex, __pyx_t_8); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 239, __pyx_L1_error) + + /* "spacy/vocab.pyx":240 + * Lexeme.set_struct_attr(lex, attr, value) + * self._add_lex_to_vocab(lex.orth, lex, self.mem is not self._non_temp_mem) + * if lex == NULL: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E085.format(string=string)) + * return lex +*/ + __pyx_t_8 = (__pyx_v_lex == NULL); + if (unlikely(__pyx_t_8)) { + + /* "spacy/vocab.pyx":241 + * self._add_lex_to_vocab(lex.orth, lex, self.mem is not self._non_temp_mem) + * if lex == NULL: + * raise ValueError(Errors.E085.format(string=string)) # <<<<<<<<<<<<<< + * return lex + * +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_E085); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_11 = __pyx_t_16; + __Pyx_INCREF(__pyx_t_11); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_11, NULL}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_string, __pyx_v_string, __pyx_t_5, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_3}; + __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_Raise(__pyx_t_10, 0, 0, 0); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __PYX_ERR(0, 241, __pyx_L1_error) + + /* "spacy/vocab.pyx":240 + * Lexeme.set_struct_attr(lex, attr, value) + * self._add_lex_to_vocab(lex.orth, lex, self.mem is not self._non_temp_mem) + * if lex == NULL: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E085.format(string=string)) + * return lex +*/ + } + + /* "spacy/vocab.pyx":242 + * if lex == NULL: + * raise ValueError(Errors.E085.format(string=string)) + * return lex # <<<<<<<<<<<<<< + * + * cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex, bint is_transient) except -1: +*/ + __pyx_r = __pyx_v_lex; + goto __pyx_L0; + + /* "spacy/vocab.pyx":221 + * return self._new_lexeme(mem, self.strings[orth]) + * + * cdef const LexemeC* _new_lexeme(self, Pool mem, str string) except NULL: # <<<<<<<<<<<<<< + * # The mem argument is deprecated, replaced by memory zones. Same with + * # this size heuristic. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_AddTraceback("spacy.vocab.Vocab._new_lexeme", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_attr); + __Pyx_XDECREF(__pyx_v_func); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF((PyObject *)__pyx_v_mem); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":244 + * return lex + * + * cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex, bint is_transient) except -1: # <<<<<<<<<<<<<< + * self._by_orth.set(lex.orth, lex) + * self.length += 1 +*/ + +static int __pyx_f_5spacy_5vocab_5Vocab__add_lex_to_vocab(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, CYTHON_UNUSED __pyx_t_5spacy_8typedefs_hash_t __pyx_v_key, struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_v_lex, int __pyx_v_is_transient) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_add_lex_to_vocab", 0); + + /* "spacy/vocab.pyx":245 + * + * cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex, bint is_transient) except -1: + * self._by_orth.set(lex.orth, lex) # <<<<<<<<<<<<<< + * self.length += 1 + * if is_transient and self.in_memory_zone: +*/ + ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_by_orth->__pyx_vtab)->set(__pyx_v_self->_by_orth, __pyx_v_lex->orth, ((void *)__pyx_v_lex)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error) + + /* "spacy/vocab.pyx":246 + * cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex, bint is_transient) except -1: + * self._by_orth.set(lex.orth, lex) + * self.length += 1 # <<<<<<<<<<<<<< + * if is_transient and self.in_memory_zone: + * self._transient_orths.push_back(lex.orth) +*/ + __pyx_v_self->length = (__pyx_v_self->length + 1); + + /* "spacy/vocab.pyx":247 + * self._by_orth.set(lex.orth, lex) + * self.length += 1 + * if is_transient and self.in_memory_zone: # <<<<<<<<<<<<<< + * self._transient_orths.push_back(lex.orth) + * +*/ + if (__pyx_v_is_transient) { + } else { + __pyx_t_1 = __pyx_v_is_transient; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_in_memory_zone); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":248 + * self.length += 1 + * if is_transient and self.in_memory_zone: + * self._transient_orths.push_back(lex.orth) # <<<<<<<<<<<<<< + * + * def _clear_transient_orths(self): +*/ + try { + __pyx_v_self->_transient_orths.push_back(__pyx_v_lex->orth); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 248, __pyx_L1_error) + } + + /* "spacy/vocab.pyx":247 + * self._by_orth.set(lex.orth, lex) + * self.length += 1 + * if is_transient and self.in_memory_zone: # <<<<<<<<<<<<<< + * self._transient_orths.push_back(lex.orth) + * +*/ + } + + /* "spacy/vocab.pyx":244 + * return lex + * + * cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex, bint is_transient) except -1: # <<<<<<<<<<<<<< + * self._by_orth.set(lex.orth, lex) + * self.length += 1 +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vocab.Vocab._add_lex_to_vocab", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":250 + * self._transient_orths.push_back(lex.orth) + * + * def _clear_transient_orths(self): # <<<<<<<<<<<<<< + * """Remove transient lexemes from the index (generally at the end of the memory zone)""" + * for orth in self._transient_orths: +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_10_clear_transient_orths(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_9_clear_transient_orths, "Vocab._clear_transient_orths(self)\n\nRemove transient lexemes from the index (generally at the end of the memory zone)"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_10_clear_transient_orths = {"_clear_transient_orths", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_10_clear_transient_orths, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_9_clear_transient_orths}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_10_clear_transient_orths(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_clear_transient_orths (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("_clear_transient_orths", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("_clear_transient_orths", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_9_clear_transient_orths(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_9_clear_transient_orths(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_orth; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::vector<__pyx_t_5spacy_8typedefs_attr_t> ::iterator __pyx_t_1; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_clear_transient_orths", 0); + + /* "spacy/vocab.pyx":252 + * def _clear_transient_orths(self): + * """Remove transient lexemes from the index (generally at the end of the memory zone)""" + * for orth in self._transient_orths: # <<<<<<<<<<<<<< + * map_clear(self._by_orth.c_map, orth) + * self._transient_orths.clear() +*/ + __pyx_t_1 = __pyx_v_self->_transient_orths.begin(); + for (; __pyx_t_1 != __pyx_v_self->_transient_orths.end(); ++__pyx_t_1) { + __pyx_t_2 = *__pyx_t_1; + __pyx_v_orth = __pyx_t_2; + + /* "spacy/vocab.pyx":253 + * """Remove transient lexemes from the index (generally at the end of the memory zone)""" + * for orth in self._transient_orths: + * map_clear(self._by_orth.c_map, orth) # <<<<<<<<<<<<<< + * self._transient_orths.clear() + * +*/ + __pyx_f_7preshed_4maps_map_clear(__pyx_v_self->_by_orth->c_map, __pyx_v_orth); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 253, __pyx_L1_error) + + /* "spacy/vocab.pyx":252 + * def _clear_transient_orths(self): + * """Remove transient lexemes from the index (generally at the end of the memory zone)""" + * for orth in self._transient_orths: # <<<<<<<<<<<<<< + * map_clear(self._by_orth.c_map, orth) + * self._transient_orths.clear() +*/ + } + + /* "spacy/vocab.pyx":254 + * for orth in self._transient_orths: + * map_clear(self._by_orth.c_map, orth) + * self._transient_orths.clear() # <<<<<<<<<<<<<< + * + * def __contains__(self, key): +*/ + __pyx_v_self->_transient_orths.clear(); + + /* "spacy/vocab.pyx":250 + * self._transient_orths.push_back(lex.orth) + * + * def _clear_transient_orths(self): # <<<<<<<<<<<<<< + * """Remove transient lexemes from the index (generally at the end of the memory zone)""" + * for orth in self._transient_orths: +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vocab.Vocab._clear_transient_orths", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":256 + * self._transient_orths.clear() + * + * def __contains__(self, key): # <<<<<<<<<<<<<< + * """Check whether the string or int key has an entry in the vocabulary. + * +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_11__contains__, "Vocab.__contains__(self, key)\n\nCheck whether the string or int key has an entry in the vocabulary.\n\nstring (str): The ID string.\nRETURNS (bool) Whether the string has an entry in the vocabulary.\n\nDOCS: https://spacy.io/api/vocab#contains"); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_5vocab_5Vocab_11__contains__; +#endif +static int __pyx_pw_5spacy_5vocab_5Vocab_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_11__contains__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), ((PyObject *)__pyx_v_key)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_11__contains__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_key) { + __pyx_t_5spacy_8typedefs_hash_t __pyx_v_int_key; + void *__pyx_v_lex; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + __pyx_t_5spacy_8typedefs_hash_t __pyx_t_5; + void *__pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__contains__", 0); + + /* "spacy/vocab.pyx":265 + * """ + * cdef hash_t int_key + * if isinstance(key, bytes): # <<<<<<<<<<<<<< + * int_key = self.strings[key.decode("utf8")] + * elif isinstance(key, str): +*/ + __pyx_t_1 = PyBytes_Check(__pyx_v_key); + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":266 + * cdef hash_t int_key + * if isinstance(key, bytes): + * int_key = self.strings[key.decode("utf8")] # <<<<<<<<<<<<<< + * elif isinstance(key, str): + * int_key = self.strings[key] +*/ + __pyx_t_3 = __pyx_v_key; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_n_u_utf8}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_decode, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyLong_As_uint64_t(__pyx_t_3); if (unlikely((__pyx_t_5 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 266, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_int_key = __pyx_t_5; + + /* "spacy/vocab.pyx":265 + * """ + * cdef hash_t int_key + * if isinstance(key, bytes): # <<<<<<<<<<<<<< + * int_key = self.strings[key.decode("utf8")] + * elif isinstance(key, str): +*/ + goto __pyx_L3; + } + + /* "spacy/vocab.pyx":267 + * if isinstance(key, bytes): + * int_key = self.strings[key.decode("utf8")] + * elif isinstance(key, str): # <<<<<<<<<<<<<< + * int_key = self.strings[key] + * else: +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_key); + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":268 + * int_key = self.strings[key.decode("utf8")] + * elif isinstance(key, str): + * int_key = self.strings[key] # <<<<<<<<<<<<<< + * else: + * int_key = key +*/ + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyLong_As_uint64_t(__pyx_t_3); if (unlikely((__pyx_t_5 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 268, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_int_key = __pyx_t_5; + + /* "spacy/vocab.pyx":267 + * if isinstance(key, bytes): + * int_key = self.strings[key.decode("utf8")] + * elif isinstance(key, str): # <<<<<<<<<<<<<< + * int_key = self.strings[key] + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/vocab.pyx":270 + * int_key = self.strings[key] + * else: + * int_key = key # <<<<<<<<<<<<<< + * lex = self._by_orth.get(int_key) + * return lex is not NULL +*/ + /*else*/ { + __pyx_t_5 = __Pyx_PyLong_As_uint64_t(__pyx_v_key); if (unlikely((__pyx_t_5 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error) + __pyx_v_int_key = __pyx_t_5; + } + __pyx_L3:; + + /* "spacy/vocab.pyx":271 + * else: + * int_key = key + * lex = self._by_orth.get(int_key) # <<<<<<<<<<<<<< + * return lex is not NULL + * +*/ + __pyx_t_6 = ((struct __pyx_vtabstruct_7preshed_4maps_PreshMap *)__pyx_v_self->_by_orth->__pyx_vtab)->get(__pyx_v_self->_by_orth, __pyx_v_int_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_v_lex = __pyx_t_6; + + /* "spacy/vocab.pyx":272 + * int_key = key + * lex = self._by_orth.get(int_key) + * return lex is not NULL # <<<<<<<<<<<<<< + * + * def __iter__(self): +*/ + __pyx_r = (__pyx_v_lex != NULL); + goto __pyx_L0; + + /* "spacy/vocab.pyx":256 + * self._transient_orths.clear() + * + * def __contains__(self, key): # <<<<<<<<<<<<<< + * """Check whether the string or int key has an entry in the vocabulary. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.vocab.Vocab.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_5spacy_5vocab_5Vocab_15generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ + +/* "spacy/vocab.pyx":274 + * return lex is not NULL + * + * def __iter__(self): # <<<<<<<<<<<<<< + * """Iterate over the lexemes in the vocabulary. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_14__iter__(PyObject *__pyx_v_self); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_13__iter__, "Vocab.__iter__(self)\n\nIterate over the lexemes in the vocabulary.\n\nYIELDS (Lexeme): An entry in the vocabulary.\n\nDOCS: https://spacy.io/api/vocab#iter"); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_5vocab_5Vocab_13__iter__; +#endif +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_14__iter__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_13__iter__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_13__iter__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__ *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__ *)__pyx_tp_new_5spacy_5vocab___pyx_scope_struct_1___iter__(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__ *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 274, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5spacy_5vocab_5Vocab_15generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_Vocab___iter, __pyx_mstate_global->__pyx_n_u_spacy_vocab); if (unlikely(!gen)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vocab.Vocab.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_5spacy_5vocab_5Vocab_15generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__ *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L8_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(__pyx_sent_value != Py_None)) { + if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator"); + __PYX_ERR(0, 274, __pyx_L1_error) + } + + /* "spacy/vocab.pyx":283 + * cdef attr_t key + * cdef size_t addr + * for key, addr in self._by_orth.items(): # <<<<<<<<<<<<<< + * lex = Lexeme(self, key) + * yield lex +*/ + __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->_by_orth); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 283, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 283, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_4, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_4; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 283, __pyx_L1_error) + #endif + if (__pyx_t_4 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_4); + #endif + ++__pyx_t_4; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error) + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 283, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 283, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_7); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); + index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < (0)) __PYX_ERR(0, 283, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 283, __pyx_L1_error) + __pyx_L7_unpacking_done:; + } + __pyx_t_10 = __Pyx_PyLong_As_uint64_t(__pyx_t_6); if (unlikely((__pyx_t_10 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_PyLong_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 283, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_cur_scope->__pyx_v_key = __pyx_t_10; + __pyx_cur_scope->__pyx_v_addr = __pyx_t_3; + + /* "spacy/vocab.pyx":284 + * cdef size_t addr + * for key, addr in self._by_orth.items(): + * lex = Lexeme(self, key) # <<<<<<<<<<<<<< + * yield lex + * +*/ + __pyx_t_7 = NULL; + __pyx_t_6 = __Pyx_PyLong_From_uint64_t(__pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, ((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_t_6}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_XGOTREF((PyObject *)__pyx_cur_scope->__pyx_v_lex); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_lex, ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_1)); + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":285 + * for key, addr in self._by_orth.items(): + * lex = Lexeme(self, key) + * yield lex # <<<<<<<<<<<<<< + * + * def __getitem__(self, id_or_string): +*/ + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_lex); + __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_lex); + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L8_resume_from_yield:; + __pyx_t_2 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 285, __pyx_L1_error) + + /* "spacy/vocab.pyx":283 + * cdef attr_t key + * cdef size_t addr + * for key, addr in self._by_orth.items(): # <<<<<<<<<<<<<< + * lex = Lexeme(self, key) + * yield lex +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + + /* "spacy/vocab.pyx":274 + * return lex is not NULL + * + * def __iter__(self): # <<<<<<<<<<<<<< + * """Iterate over the lexemes in the vocabulary. + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + if (__Pyx_PyErr_Occurred()) { + __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + #if !CYTHON_USE_EXC_INFO_STACK + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + #endif + __pyx_generator->resume_label = -1; + __Pyx_Coroutine_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":287 + * yield lex + * + * def __getitem__(self, id_or_string): # <<<<<<<<<<<<<< + * """Retrieve a lexeme, given an int ID or a unicode string. If a + * previously unseen unicode string is given, a new lexeme is created and +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_17__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_or_string); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_16__getitem__, "Vocab.__getitem__(self, id_or_string)\n\nRetrieve a lexeme, given an int ID or a unicode string. If a\npreviously unseen unicode string is given, a new lexeme is created and\nstored.\n\nid_or_string (int or str): The integer ID of a word, or its unicode\n string. If `int >= Lexicon.size`, `IndexError` is raised. If\n `id_or_string` is neither an int nor a unicode string, `ValueError`\n is raised.\nRETURNS (Lexeme): The lexeme indicated by the given ID.\n\nEXAMPLE:\n >>> apple = nlp.vocab.strings[\"apple\"]\n >>> assert nlp.vocab[apple] == nlp.vocab[u\"apple\"]\n\nDOCS: https://spacy.io/api/vocab#getitem"); +#if CYTHON_UPDATE_DESCRIPTOR_DOC +struct wrapperbase __pyx_wrapperbase_5spacy_5vocab_5Vocab_16__getitem__; +#endif +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_17__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_id_or_string) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_16__getitem__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), ((PyObject *)__pyx_v_id_or_string)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_16__getitem__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_id_or_string) { + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_orth; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "spacy/vocab.pyx":305 + * """ + * cdef attr_t orth + * if isinstance(id_or_string, str): # <<<<<<<<<<<<<< + * orth = self.strings.add(id_or_string, allow_transient=True) + * else: +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_id_or_string); + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":306 + * cdef attr_t orth + * if isinstance(id_or_string, str): + * orth = self.strings.add(id_or_string, allow_transient=True) # <<<<<<<<<<<<<< + * else: + * orth = id_or_string +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_v_id_or_string}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_True, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 306, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_t_2); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_orth = __pyx_t_6; + + /* "spacy/vocab.pyx":305 + * """ + * cdef attr_t orth + * if isinstance(id_or_string, str): # <<<<<<<<<<<<<< + * orth = self.strings.add(id_or_string, allow_transient=True) + * else: +*/ + goto __pyx_L3; + } + + /* "spacy/vocab.pyx":308 + * orth = self.strings.add(id_or_string, allow_transient=True) + * else: + * orth = id_or_string # <<<<<<<<<<<<<< + * return Lexeme(self, orth) + * +*/ + /*else*/ { + __pyx_t_6 = __Pyx_PyLong_As_uint64_t(__pyx_v_id_or_string); if (unlikely((__pyx_t_6 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L1_error) + __pyx_v_orth = __pyx_t_6; + } + __pyx_L3:; + + /* "spacy/vocab.pyx":309 + * else: + * orth = id_or_string + * return Lexeme(self, orth) # <<<<<<<<<<<<<< + * + * cdef const TokenC* make_fused_token(self, substrings) except NULL: +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = NULL; + __pyx_t_3 = __Pyx_PyLong_From_uint64_t(__pyx_v_orth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_t_3}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + } + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/vocab.pyx":287 + * yield lex + * + * def __getitem__(self, id_or_string): # <<<<<<<<<<<<<< + * """Retrieve a lexeme, given an int ID or a unicode string. If a + * previously unseen unicode string is given, a new lexeme is created and +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.vocab.Vocab.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":311 + * return Lexeme(self, orth) + * + * cdef const TokenC* make_fused_token(self, substrings) except NULL: # <<<<<<<<<<<<<< + * cdef int i + * tokens = self.mem.alloc(len(substrings) + 1, sizeof(TokenC)) +*/ + +static struct __pyx_t_5spacy_7structs_TokenC const *__pyx_f_5spacy_5vocab_5Vocab_make_fused_token(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_substrings) { + int __pyx_v_i; + struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_tokens; + PyObject *__pyx_v_props = NULL; + struct __pyx_t_5spacy_7structs_TokenC *__pyx_v_token; + struct __pyx_t_5spacy_7structs_LexemeC *__pyx_v_lex; + PyObject *__pyx_v_attr_id = NULL; + PyObject *__pyx_v_value = NULL; + struct __pyx_t_5spacy_7structs_TokenC const *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + void *__pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + __pyx_t_5spacy_8typedefs_attr_t __pyx_t_11; + struct __pyx_t_5spacy_7structs_LexemeC const *__pyx_t_12; + Py_ssize_t __pyx_t_13; + PyObject *(*__pyx_t_14)(PyObject *); + PyObject *__pyx_t_15 = NULL; + PyObject *(*__pyx_t_16)(PyObject *); + enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_t_17; + int __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_fused_token", 0); + + /* "spacy/vocab.pyx":313 + * cdef const TokenC* make_fused_token(self, substrings) except NULL: + * cdef int i + * tokens = self.mem.alloc(len(substrings) + 1, sizeof(TokenC)) # <<<<<<<<<<<<<< + * for i, props in enumerate(substrings): + * props = intify_attrs(props, strings_map=self.strings, +*/ + __pyx_t_1 = PyObject_Length(__pyx_v_substrings); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 313, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_5cymem_5cymem_Pool *)__pyx_v_self->mem->__pyx_vtab)->alloc(__pyx_v_self->mem, (__pyx_t_1 + 1), (sizeof(struct __pyx_t_5spacy_7structs_TokenC))); if (unlikely(__pyx_t_2 == ((void *)NULL))) __PYX_ERR(0, 313, __pyx_L1_error) + __pyx_v_tokens = ((struct __pyx_t_5spacy_7structs_TokenC *)__pyx_t_2); + + /* "spacy/vocab.pyx":314 + * cdef int i + * tokens = self.mem.alloc(len(substrings) + 1, sizeof(TokenC)) + * for i, props in enumerate(substrings): # <<<<<<<<<<<<<< + * props = intify_attrs(props, strings_map=self.strings, + * _do_deprecated=True) +*/ + __pyx_t_3 = 0; + if (likely(PyList_CheckExact(__pyx_v_substrings)) || PyTuple_CheckExact(__pyx_v_substrings)) { + __pyx_t_4 = __pyx_v_substrings; __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_substrings); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 314, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 314, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_4, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_1; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 314, __pyx_L1_error) + #endif + if (__pyx_t_1 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1)); + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); + #endif + ++__pyx_t_1; + } + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 314, __pyx_L1_error) + } else { + __pyx_t_6 = __pyx_t_5(__pyx_t_4); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 314, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_props, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_v_i = __pyx_t_3; + __pyx_t_3 = (__pyx_t_3 + 1); + + /* "spacy/vocab.pyx":315 + * tokens = self.mem.alloc(len(substrings) + 1, sizeof(TokenC)) + * for i, props in enumerate(substrings): + * props = intify_attrs(props, strings_map=self.strings, # <<<<<<<<<<<<<< + * _do_deprecated=True) + * token = &tokens[i] +*/ + __pyx_t_7 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_intify_attrs); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + + /* "spacy/vocab.pyx":316 + * for i, props in enumerate(substrings): + * props = intify_attrs(props, strings_map=self.strings, + * _do_deprecated=True) # <<<<<<<<<<<<<< + * token = &tokens[i] + * # Set the special tokens up to have arbitrary attributes +*/ + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + assert(__pyx_t_7); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_7, __pyx_v_props}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_strings_map, ((PyObject *)__pyx_v_self->strings), __pyx_t_10, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 315, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_do_deprecated, Py_True, __pyx_t_10, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 315, __pyx_L1_error) + __pyx_t_6 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF_SET(__pyx_v_props, __pyx_t_6); + __pyx_t_6 = 0; + + /* "spacy/vocab.pyx":317 + * props = intify_attrs(props, strings_map=self.strings, + * _do_deprecated=True) + * token = &tokens[i] # <<<<<<<<<<<<<< + * # Set the special tokens up to have arbitrary attributes + * lex = self.get_by_orth(self.mem, props[ORTH]) +*/ + __pyx_v_token = (&(__pyx_v_tokens[__pyx_v_i])); + + /* "spacy/vocab.pyx":319 + * token = &tokens[i] + * # Set the special tokens up to have arbitrary attributes + * lex = self.get_by_orth(self.mem, props[ORTH]) # <<<<<<<<<<<<<< + * token.lex = lex + * for attr_id, value in props.items(): +*/ + __pyx_t_6 = ((PyObject *)__pyx_v_self->mem); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_e_5spacy_5attrs_ORTH); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_props, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_11 = __Pyx_PyLong_As_uint64_t(__pyx_t_10); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_12 = ((struct __pyx_vtabstruct_5spacy_5vocab_Vocab *)__pyx_v_self->__pyx_vtab)->get_by_orth(__pyx_v_self, ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_6), __pyx_t_11); if (unlikely(__pyx_t_12 == ((void *)NULL))) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_lex = ((struct __pyx_t_5spacy_7structs_LexemeC *)__pyx_t_12); + + /* "spacy/vocab.pyx":320 + * # Set the special tokens up to have arbitrary attributes + * lex = self.get_by_orth(self.mem, props[ORTH]) + * token.lex = lex # <<<<<<<<<<<<<< + * for attr_id, value in props.items(): + * Token.set_struct_attr(token, attr_id, value) +*/ + __pyx_v_token->lex = __pyx_v_lex; + + /* "spacy/vocab.pyx":321 + * lex = self.get_by_orth(self.mem, props[ORTH]) + * token.lex = lex + * for attr_id, value in props.items(): # <<<<<<<<<<<<<< + * Token.set_struct_attr(token, attr_id, value) + * # NORM is the only one that overlaps between the two +*/ + __pyx_t_10 = __pyx_v_props; + __Pyx_INCREF(__pyx_t_10); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + } + if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_10 = __pyx_t_6; __Pyx_INCREF(__pyx_t_10); + __pyx_t_13 = 0; + __pyx_t_14 = NULL; + } else { + __pyx_t_13 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_14 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 321, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(!__pyx_t_14)) { + if (likely(PyList_CheckExact(__pyx_t_10))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_10); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 321, __pyx_L1_error) + #endif + if (__pyx_t_13 >= __pyx_temp) break; + } + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_10, __pyx_t_13, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_13; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_10); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 321, __pyx_L1_error) + #endif + if (__pyx_t_13 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_13)); + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_13); + #endif + ++__pyx_t_13; + } + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 321, __pyx_L1_error) + } else { + __pyx_t_6 = __pyx_t_14(__pyx_t_10); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 321, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_6); + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 321, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_8); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_7); + } + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_15 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_16 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_15); + index = 0; __pyx_t_8 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 1; __pyx_t_7 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 2) < (0)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_16 = NULL; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + goto __pyx_L8_unpacking_done; + __pyx_L7_unpacking_failed:; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_16 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_L8_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_attr_id, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/vocab.pyx":322 + * token.lex = lex + * for attr_id, value in props.items(): + * Token.set_struct_attr(token, attr_id, value) # <<<<<<<<<<<<<< + * # NORM is the only one that overlaps between the two + * # (which is maybe not great?) +*/ + __pyx_t_17 = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_v_attr_id)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyLong_As_uint64_t(__pyx_v_value); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L1_error) + (void)(__pyx_f_5spacy_6tokens_5token_5Token_set_struct_attr(__pyx_v_token, __pyx_t_17, __pyx_t_11)); + + /* "spacy/vocab.pyx":325 + * # NORM is the only one that overlaps between the two + * # (which is maybe not great?) + * if attr_id != NORM: # <<<<<<<<<<<<<< + * Lexeme.set_struct_attr(lex, attr_id, value) + * return tokens +*/ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 325, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_RichCompare(__pyx_v_attr_id, __pyx_t_6, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 325, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_18 < 0))) __PYX_ERR(0, 325, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_18) { + + /* "spacy/vocab.pyx":326 + * # (which is maybe not great?) + * if attr_id != NORM: + * Lexeme.set_struct_attr(lex, attr_id, value) # <<<<<<<<<<<<<< + * return tokens + * +*/ + __pyx_t_17 = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_v_attr_id)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyLong_As_uint64_t(__pyx_v_value); if (unlikely((__pyx_t_11 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L1_error) + __pyx_f_5spacy_6lexeme_6Lexeme_set_struct_attr(__pyx_v_lex, __pyx_t_17, __pyx_t_11); + + /* "spacy/vocab.pyx":325 + * # NORM is the only one that overlaps between the two + * # (which is maybe not great?) + * if attr_id != NORM: # <<<<<<<<<<<<<< + * Lexeme.set_struct_attr(lex, attr_id, value) + * return tokens +*/ + } + + /* "spacy/vocab.pyx":321 + * lex = self.get_by_orth(self.mem, props[ORTH]) + * token.lex = lex + * for attr_id, value in props.items(): # <<<<<<<<<<<<<< + * Token.set_struct_attr(token, attr_id, value) + * # NORM is the only one that overlaps between the two +*/ + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":314 + * cdef int i + * tokens = self.mem.alloc(len(substrings) + 1, sizeof(TokenC)) + * for i, props in enumerate(substrings): # <<<<<<<<<<<<<< + * props = intify_attrs(props, strings_map=self.strings, + * _do_deprecated=True) +*/ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":327 + * if attr_id != NORM: + * Lexeme.set_struct_attr(lex, attr_id, value) + * return tokens # <<<<<<<<<<<<<< + * + * @property +*/ + __pyx_r = __pyx_v_tokens; + goto __pyx_L0; + + /* "spacy/vocab.pyx":311 + * return Lexeme(self, orth) + * + * cdef const TokenC* make_fused_token(self, substrings) except NULL: # <<<<<<<<<<<<<< + * cdef int i + * tokens = self.mem.alloc(len(substrings) + 1, sizeof(TokenC)) +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("spacy.vocab.Vocab.make_fused_token", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_props); + __Pyx_XDECREF(__pyx_v_attr_id); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":329 + * return tokens + * + * @property # <<<<<<<<<<<<<< + * def vectors_length(self): + * if hasattr(self.vectors, "shape"): +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_14vectors_length_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_14vectors_length_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_14vectors_length___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_14vectors_length___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/vocab.pyx":331 + * @property + * def vectors_length(self): + * if hasattr(self.vectors, "shape"): # <<<<<<<<<<<<<< + * return self.vectors.shape[1] + * else: +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_HasAttr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/vocab.pyx":332 + * def vectors_length(self): + * if hasattr(self.vectors, "shape"): + * return self.vectors.shape[1] # <<<<<<<<<<<<<< + * else: + * return -1 +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vocab.pyx":331 + * @property + * def vectors_length(self): + * if hasattr(self.vectors, "shape"): # <<<<<<<<<<<<<< + * return self.vectors.shape[1] + * else: +*/ + } + + /* "spacy/vocab.pyx":334 + * return self.vectors.shape[1] + * else: + * return -1 # <<<<<<<<<<<<<< + * + * def reset_vectors(self, *, width=None, shape=None): +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __pyx_r = __pyx_mstate_global->__pyx_int_neg_1; + goto __pyx_L0; + } + + /* "spacy/vocab.pyx":329 + * return tokens + * + * @property # <<<<<<<<<<<<<< + * def vectors_length(self): + * if hasattr(self.vectors, "shape"): +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.vocab.Vocab.vectors_length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":336 + * return -1 + * + * def reset_vectors(self, *, width=None, shape=None): # <<<<<<<<<<<<<< + * """Drop the current vector table. Because all vectors must be the same + * width, you have to call this to change the size of the vectors. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_19reset_vectors(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_18reset_vectors, "Vocab.reset_vectors(self, *, width=None, shape=None)\n\nDrop the current vector table. Because all vectors must be the same\nwidth, you have to call this to change the size of the vectors."); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_19reset_vectors = {"reset_vectors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_19reset_vectors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_18reset_vectors}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_19reset_vectors(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_width = 0; + PyObject *__pyx_v_shape = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset_vectors (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_width,&__pyx_mstate_global->__pyx_n_u_shape,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 336, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "reset_vectors", 0) < (0)) __PYX_ERR(0, 336, __pyx_L3_error) + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + } else if (unlikely(__pyx_nargs != 0)) { + goto __pyx_L5_argtuple_error; + } else { + if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None)); + } + __pyx_v_width = values[0]; + __pyx_v_shape = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("reset_vectors", 1, 0, 0, __pyx_nargs); __PYX_ERR(0, 336, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.reset_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_18reset_vectors(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_width, __pyx_v_shape); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_18reset_vectors(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_width, PyObject *__pyx_v_shape) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("reset_vectors", 0); + __Pyx_INCREF(__pyx_v_width); + + /* "spacy/vocab.pyx":340 + * width, you have to call this to change the size of the vectors. + * """ + * if not isinstance(self.vectors, Vectors): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E849.format(method="reset_vectors", vectors_type=type(self.vectors))) + * if width is not None and shape is not None: +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (unlikely(__pyx_t_4)) { + + /* "spacy/vocab.pyx":341 + * """ + * if not isinstance(self.vectors, Vectors): + * raise ValueError(Errors.E849.format(method="reset_vectors", vectors_type=type(self.vectors))) # <<<<<<<<<<<<<< + * if width is not None and shape is not None: + * raise ValueError(Errors.E065.format(width=width, shape=shape)) +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E849); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_method, __pyx_mstate_global->__pyx_n_u_reset_vectors, __pyx_t_10, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 341, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_vectors_type, ((PyObject *)Py_TYPE(__pyx_t_7)), __pyx_t_10, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 341, __pyx_L1_error) + + /* "spacy/vocab.pyx":340 + * width, you have to call this to change the size of the vectors. + * """ + * if not isinstance(self.vectors, Vectors): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E849.format(method="reset_vectors", vectors_type=type(self.vectors))) + * if width is not None and shape is not None: +*/ + } + + /* "spacy/vocab.pyx":342 + * if not isinstance(self.vectors, Vectors): + * raise ValueError(Errors.E849.format(method="reset_vectors", vectors_type=type(self.vectors))) + * if width is not None and shape is not None: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E065.format(width=width, shape=shape)) + * elif shape is not None: +*/ + __pyx_t_3 = (__pyx_v_width != Py_None); + if (__pyx_t_3) { + } else { + __pyx_t_4 = __pyx_t_3; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_3 = (__pyx_v_shape != Py_None); + __pyx_t_4 = __pyx_t_3; + __pyx_L5_bool_binop_done:; + if (unlikely(__pyx_t_4)) { + + /* "spacy/vocab.pyx":343 + * raise ValueError(Errors.E849.format(method="reset_vectors", vectors_type=type(self.vectors))) + * if width is not None and shape is not None: + * raise ValueError(Errors.E065.format(width=width, shape=shape)) # <<<<<<<<<<<<<< + * elif shape is not None: + * self.vectors = Vectors(strings=self.strings, shape=shape) +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_E065); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_8 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_8, NULL}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_width, __pyx_v_width, __pyx_t_10, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 343, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_shape, __pyx_v_shape, __pyx_t_10, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 343, __pyx_L1_error) + + /* "spacy/vocab.pyx":342 + * if not isinstance(self.vectors, Vectors): + * raise ValueError(Errors.E849.format(method="reset_vectors", vectors_type=type(self.vectors))) + * if width is not None and shape is not None: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E065.format(width=width, shape=shape)) + * elif shape is not None: +*/ + } + + /* "spacy/vocab.pyx":344 + * if width is not None and shape is not None: + * raise ValueError(Errors.E065.format(width=width, shape=shape)) + * elif shape is not None: # <<<<<<<<<<<<<< + * self.vectors = Vectors(strings=self.strings, shape=shape) + * else: +*/ + __pyx_t_4 = (__pyx_v_shape != Py_None); + if (__pyx_t_4) { + + /* "spacy/vocab.pyx":345 + * raise ValueError(Errors.E065.format(width=width, shape=shape)) + * elif shape is not None: + * self.vectors = Vectors(strings=self.strings, shape=shape) # <<<<<<<<<<<<<< + * else: + * width = width if width is not None else self.vectors.shape[1] +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Vectors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_1, NULL}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_strings, ((PyObject *)__pyx_v_self->strings), __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 345, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_shape, __pyx_v_shape, __pyx_t_7, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 345, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors, __pyx_t_2) < (0)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":344 + * if width is not None and shape is not None: + * raise ValueError(Errors.E065.format(width=width, shape=shape)) + * elif shape is not None: # <<<<<<<<<<<<<< + * self.vectors = Vectors(strings=self.strings, shape=shape) + * else: +*/ + goto __pyx_L4; + } + + /* "spacy/vocab.pyx":347 + * self.vectors = Vectors(strings=self.strings, shape=shape) + * else: + * width = width if width is not None else self.vectors.shape[1] # <<<<<<<<<<<<<< + * self.vectors = Vectors(strings=self.strings, shape=(self.vectors.shape[0], width)) + * +*/ + /*else*/ { + __pyx_t_4 = (__pyx_v_width != Py_None); + if (__pyx_t_4) { + __Pyx_INCREF(__pyx_v_width); + __pyx_t_2 = __pyx_v_width; + } else { + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_7, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_2 = __pyx_t_5; + __pyx_t_5 = 0; + } + __Pyx_DECREF_SET(__pyx_v_width, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":348 + * else: + * width = width if width is not None else self.vectors.shape[1] + * self.vectors = Vectors(strings=self.strings, shape=(self.vectors.shape[0], width)) # <<<<<<<<<<<<<< + * + * def deduplicate_vectors(self): +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Vectors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 348, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_width); + __Pyx_GIVEREF(__pyx_v_width); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_width) != (0)) __PYX_ERR(0, 348, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_7, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_5, NULL}; + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_strings, ((PyObject *)__pyx_v_self->strings), __pyx_t_1, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 348, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_shape, __pyx_t_10, __pyx_t_1, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 348, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors, __pyx_t_2) < (0)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L4:; + + /* "spacy/vocab.pyx":336 + * return -1 + * + * def reset_vectors(self, *, width=None, shape=None): # <<<<<<<<<<<<<< + * """Drop the current vector table. Because all vectors must be the same + * width, you have to call this to change the size of the vectors. +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("spacy.vocab.Vocab.reset_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_width); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":350 + * self.vectors = Vectors(strings=self.strings, shape=(self.vectors.shape[0], width)) + * + * def deduplicate_vectors(self): # <<<<<<<<<<<<<< + * if not isinstance(self.vectors, Vectors): + * raise ValueError(Errors.E849.format(method="deduplicate_vectors", vectors_type=type(self.vectors))) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_21deduplicate_vectors(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_20deduplicate_vectors, "Vocab.deduplicate_vectors(self)"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_21deduplicate_vectors = {"deduplicate_vectors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_21deduplicate_vectors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_20deduplicate_vectors}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_21deduplicate_vectors(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("deduplicate_vectors (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("deduplicate_vectors", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("deduplicate_vectors", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_20deduplicate_vectors(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_20deduplicate_vectors(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_v_ops = NULL; + PyObject *__pyx_v_xp = NULL; + PyObject *__pyx_v_filled = NULL; + PyObject *__pyx_v_data = NULL; + PyObject *__pyx_v_row_by_bytes = NULL; + PyObject *__pyx_v_key2row = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_row = NULL; + PyObject *__pyx_7genexpr__pyx_v_row = NULL; + PyObject *__pyx_8genexpr1__pyx_v_i = NULL; + PyObject *__pyx_8genexpr1__pyx_v_row = NULL; + PyObject *__pyx_8genexpr2__pyx_v_key = NULL; + PyObject *__pyx_8genexpr2__pyx_v_row = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *(*__pyx_t_13)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("deduplicate_vectors", 0); + + /* "spacy/vocab.pyx":351 + * + * def deduplicate_vectors(self): + * if not isinstance(self.vectors, Vectors): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E849.format(method="deduplicate_vectors", vectors_type=type(self.vectors))) + * if self.vectors.mode != VectorsMode.default: +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (unlikely(__pyx_t_4)) { + + /* "spacy/vocab.pyx":352 + * def deduplicate_vectors(self): + * if not isinstance(self.vectors, Vectors): + * raise ValueError(Errors.E849.format(method="deduplicate_vectors", vectors_type=type(self.vectors))) # <<<<<<<<<<<<<< + * if self.vectors.mode != VectorsMode.default: + * raise ValueError(Errors.E858.format( +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E849); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_method, __pyx_mstate_global->__pyx_n_u_deduplicate_vectors, __pyx_t_10, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 352, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_vectors_type, ((PyObject *)Py_TYPE(__pyx_t_7)), __pyx_t_10, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 352, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 352, __pyx_L1_error) + + /* "spacy/vocab.pyx":351 + * + * def deduplicate_vectors(self): + * if not isinstance(self.vectors, Vectors): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E849.format(method="deduplicate_vectors", vectors_type=type(self.vectors))) + * if self.vectors.mode != VectorsMode.default: +*/ + } + + /* "spacy/vocab.pyx":353 + * if not isinstance(self.vectors, Vectors): + * raise ValueError(Errors.E849.format(method="deduplicate_vectors", vectors_type=type(self.vectors))) + * if self.vectors.mode != VectorsMode.default: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E858.format( + * mode=self.vectors.mode, +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_VectorsMode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_default); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_t_4)) { + + /* "spacy/vocab.pyx":354 + * raise ValueError(Errors.E849.format(method="deduplicate_vectors", vectors_type=type(self.vectors))) + * if self.vectors.mode != VectorsMode.default: + * raise ValueError(Errors.E858.format( # <<<<<<<<<<<<<< + * mode=self.vectors.mode, + * alternative="" +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_E858); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_8 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_8); + + /* "spacy/vocab.pyx":355 + * if self.vectors.mode != VectorsMode.default: + * raise ValueError(Errors.E858.format( + * mode=self.vectors.mode, # <<<<<<<<<<<<<< + * alternative="" + * )) +*/ + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_8, NULL}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_t_6, __pyx_t_10, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 354, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alternative, __pyx_mstate_global->__pyx_kp_u__9, __pyx_t_10, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 354, __pyx_L1_error) + + /* "spacy/vocab.pyx":353 + * if not isinstance(self.vectors, Vectors): + * raise ValueError(Errors.E849.format(method="deduplicate_vectors", vectors_type=type(self.vectors))) + * if self.vectors.mode != VectorsMode.default: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E858.format( + * mode=self.vectors.mode, +*/ + } + + /* "spacy/vocab.pyx":358 + * alternative="" + * )) + * ops = get_current_ops() # <<<<<<<<<<<<<< + * xp = get_array_module(self.vectors.data) + * filled = xp.asarray( +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_get_current_ops); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 358, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v_ops = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":359 + * )) + * ops = get_current_ops() + * xp = get_array_module(self.vectors.data) # <<<<<<<<<<<<<< + * filled = xp.asarray( + * sorted(list({row for row in self.vectors.key2row.values()})) +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_get_array_module); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_10}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v_xp = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":360 + * ops = get_current_ops() + * xp = get_array_module(self.vectors.data) + * filled = xp.asarray( # <<<<<<<<<<<<<< + * sorted(list({row for row in self.vectors.key2row.values()})) + * ) +*/ + __pyx_t_5 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_5); + + /* "spacy/vocab.pyx":361 + * xp = get_array_module(self.vectors.data) + * filled = xp.asarray( + * sorted(list({row for row in self.vectors.key2row.values()})) # <<<<<<<<<<<<<< + * ) + * # deduplicate data and remap keys +*/ + { /* enter inner scope */ + __pyx_t_10 = PySet_New(NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 361, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 361, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_key2row); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 361, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_values, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_1); + } + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_8 = __pyx_t_1; __Pyx_INCREF(__pyx_t_8); + __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 361, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 361, __pyx_L7_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 361, __pyx_L7_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_8, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 361, __pyx_L7_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_11)); + #else + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L7_error) + } else { + __pyx_t_1 = __pyx_t_12(__pyx_t_8); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 361, __pyx_L7_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_row, __pyx_t_1); + __pyx_t_1 = 0; + if (unlikely(PySet_Add(__pyx_t_10, (PyObject*)__pyx_7genexpr__pyx_v_row))) __PYX_ERR(0, 361, __pyx_L7_error) + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_row); __pyx_7genexpr__pyx_v_row = 0; + goto __pyx_L11_exit_scope; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_row); __pyx_7genexpr__pyx_v_row = 0; + goto __pyx_L1_error; + __pyx_L11_exit_scope:; + } /* exit inner scope */ + __pyx_t_8 = PySequence_List(__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PySequence_List(__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely((PyList_Sort(__pyx_t_10) < 0))) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_10}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v_filled = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":364 + * ) + * # deduplicate data and remap keys + * data = numpy.unique(ops.to_numpy(self.vectors.data[filled]), axis=0) # <<<<<<<<<<<<<< + * data = ops.asarray(data) + * if data.shape == self.vectors.data.shape: +*/ + __pyx_t_10 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_unique); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __pyx_v_ops; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_filled); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_7}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_numpy, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8); + assert(__pyx_t_10); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_10, __pyx_t_5}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_axis, __pyx_mstate_global->__pyx_int_0, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 364, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v_data = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":365 + * # deduplicate data and remap keys + * data = numpy.unique(ops.to_numpy(self.vectors.data[filled]), axis=0) + * data = ops.asarray(data) # <<<<<<<<<<<<<< + * if data.shape == self.vectors.data.shape: + * # nothing to deduplicate +*/ + __pyx_t_8 = __pyx_v_ops; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_data}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":366 + * data = numpy.unique(ops.to_numpy(self.vectors.data[filled]), axis=0) + * data = ops.asarray(data) + * if data.shape == self.vectors.data.shape: # <<<<<<<<<<<<<< + * # nothing to deduplicate + * return +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_4) { + + /* "spacy/vocab.pyx":368 + * if data.shape == self.vectors.data.shape: + * # nothing to deduplicate + * return # <<<<<<<<<<<<<< + * row_by_bytes = {row.tobytes(): i for i, row in enumerate(data)} + * key2row = { +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "spacy/vocab.pyx":366 + * data = numpy.unique(ops.to_numpy(self.vectors.data[filled]), axis=0) + * data = ops.asarray(data) + * if data.shape == self.vectors.data.shape: # <<<<<<<<<<<<<< + * # nothing to deduplicate + * return +*/ + } + + /* "spacy/vocab.pyx":369 + * # nothing to deduplicate + * return + * row_by_bytes = {row.tobytes(): i for i, row in enumerate(data)} # <<<<<<<<<<<<<< + * key2row = { + * key: row_by_bytes[self.vectors.data[row].tobytes()] +*/ + { /* enter inner scope */ + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L15_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_8 = __pyx_mstate_global->__pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_data)) || PyTuple_CheckExact(__pyx_v_data)) { + __pyx_t_2 = __pyx_v_data; __Pyx_INCREF(__pyx_t_2); + __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L15_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 369, __pyx_L15_error) + } + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 369, __pyx_L15_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 369, __pyx_L15_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11)); + #else + __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 369, __pyx_L15_error) + } else { + __pyx_t_5 = __pyx_t_12(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 369, __pyx_L15_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_row, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_i, __pyx_t_8); + __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_t_8, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 369, __pyx_L15_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); + __pyx_t_8 = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_t_10 = __pyx_8genexpr1__pyx_v_row; + __Pyx_INCREF(__pyx_t_10); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_tobytes, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 369, __pyx_L15_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (unlikely(PyDict_SetItem(__pyx_t_7, (PyObject*)__pyx_t_5, (PyObject*)__pyx_8genexpr1__pyx_v_i))) __PYX_ERR(0, 369, __pyx_L15_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_i); __pyx_8genexpr1__pyx_v_i = 0; + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_row); __pyx_8genexpr1__pyx_v_row = 0; + goto __pyx_L19_exit_scope; + __pyx_L15_error:; + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_i); __pyx_8genexpr1__pyx_v_i = 0; + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_row); __pyx_8genexpr1__pyx_v_row = 0; + goto __pyx_L1_error; + __pyx_L19_exit_scope:; + } /* exit inner scope */ + __pyx_v_row_by_bytes = ((PyObject*)__pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/vocab.pyx":370 + * return + * row_by_bytes = {row.tobytes(): i for i, row in enumerate(data)} + * key2row = { # <<<<<<<<<<<<<< + * key: row_by_bytes[self.vectors.data[row].tobytes()] + * for key, row in self.vectors.key2row.items() +*/ + { /* enter inner scope */ + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 370, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_7); + + /* "spacy/vocab.pyx":372 + * key2row = { + * key: row_by_bytes[self.vectors.data[row].tobytes()] + * for key, row in self.vectors.key2row.items() # <<<<<<<<<<<<<< + * } + * # replace vectors with deduplicated version +*/ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_key2row); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 372, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = __pyx_t_10; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_items, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 372, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_8); + } + if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) { + __pyx_t_10 = __pyx_t_8; __Pyx_INCREF(__pyx_t_10); + __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 372, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 372, __pyx_L22_error) + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_10))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_10); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 372, __pyx_L22_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(__pyx_t_10, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_10); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 372, __pyx_L22_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_11)); + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 372, __pyx_L22_error) + } else { + __pyx_t_8 = __pyx_t_12(__pyx_t_10); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 372, __pyx_L22_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_8); + if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) { + PyObject* sequence = __pyx_t_8; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 372, __pyx_L22_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L22_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __pyx_L22_error) + __Pyx_XGOTREF(__pyx_t_5); + } + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_1 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); + index = 0; __pyx_t_2 = __pyx_t_13(__pyx_t_1); if (unlikely(!__pyx_t_2)) goto __pyx_L25_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_5 = __pyx_t_13(__pyx_t_1); if (unlikely(!__pyx_t_5)) goto __pyx_L25_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_1), 2) < (0)) __PYX_ERR(0, 372, __pyx_L22_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L26_unpacking_done; + __pyx_L25_unpacking_failed:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 372, __pyx_L22_error) + __pyx_L26_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_key, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_row, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":371 + * row_by_bytes = {row.tobytes(): i for i, row in enumerate(data)} + * key2row = { + * key: row_by_bytes[self.vectors.data[row].tobytes()] # <<<<<<<<<<<<<< + * for key, row in self.vectors.key2row.items() + * } +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_8genexpr2__pyx_v_row); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_tobytes, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 371, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_8); + } + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_row_by_bytes, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(PyDict_SetItem(__pyx_t_7, (PyObject*)__pyx_8genexpr2__pyx_v_key, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 371, __pyx_L22_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":372 + * key2row = { + * key: row_by_bytes[self.vectors.data[row].tobytes()] + * for key, row in self.vectors.key2row.items() # <<<<<<<<<<<<<< + * } + * # replace vectors with deduplicated version +*/ + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_key); __pyx_8genexpr2__pyx_v_key = 0; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_row); __pyx_8genexpr2__pyx_v_row = 0; + goto __pyx_L28_exit_scope; + __pyx_L22_error:; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_key); __pyx_8genexpr2__pyx_v_key = 0; + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_row); __pyx_8genexpr2__pyx_v_row = 0; + goto __pyx_L1_error; + __pyx_L28_exit_scope:; + } /* exit inner scope */ + __pyx_v_key2row = ((PyObject*)__pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/vocab.pyx":375 + * } + * # replace vectors with deduplicated version + * self.vectors = Vectors(strings=self.strings, data=data, name=self.vectors.name) # <<<<<<<<<<<<<< + * for key, row in key2row.items(): + * self.vectors.add(key, row=row) +*/ + __pyx_t_10 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2); + assert(__pyx_t_10); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_2, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_10, NULL}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_strings, ((PyObject *)__pyx_v_self->strings), __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 375, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data, __pyx_v_data, __pyx_t_8, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 375, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name, __pyx_t_5, __pyx_t_8, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 375, __pyx_L1_error) + __pyx_t_7 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors, __pyx_t_7) < (0)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vocab.pyx":376 + * # replace vectors with deduplicated version + * self.vectors = Vectors(strings=self.strings, data=data, name=self.vectors.name) + * for key, row in key2row.items(): # <<<<<<<<<<<<<< + * self.vectors.add(key, row=row) + * +*/ + __pyx_t_7 = __Pyx_PyDict_Items(__pyx_v_key2row); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_2 = __pyx_t_7; __Pyx_INCREF(__pyx_t_2); + __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 376, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 376, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_7 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 376, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11)); + #else + __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 376, __pyx_L1_error) + } else { + __pyx_t_7 = __pyx_t_12(__pyx_t_2); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 376, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_7); + if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) { + PyObject* sequence = __pyx_t_7; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 376, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_8); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_5); + } + #else + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); + index = 0; __pyx_t_8 = __pyx_t_13(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L31_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 1; __pyx_t_5 = __pyx_t_13(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L31_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 376, __pyx_L1_error) + __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L32_unpacking_done; + __pyx_L31_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 376, __pyx_L1_error) + __pyx_L32_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":377 + * self.vectors = Vectors(strings=self.strings, data=data, name=self.vectors.name) + * for key, row in key2row.items(): + * self.vectors.add(key, row=row) # <<<<<<<<<<<<<< + * + * def prune_vectors(self, nr_row, batch_size=1024): +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_v_key}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_row, __pyx_v_row, __pyx_t_10, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_t_7 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vocab.pyx":376 + * # replace vectors with deduplicated version + * self.vectors = Vectors(strings=self.strings, data=data, name=self.vectors.name) + * for key, row in key2row.items(): # <<<<<<<<<<<<<< + * self.vectors.add(key, row=row) + * +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":350 + * self.vectors = Vectors(strings=self.strings, shape=(self.vectors.shape[0], width)) + * + * def deduplicate_vectors(self): # <<<<<<<<<<<<<< + * if not isinstance(self.vectors, Vectors): + * raise ValueError(Errors.E849.format(method="deduplicate_vectors", vectors_type=type(self.vectors))) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("spacy.vocab.Vocab.deduplicate_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ops); + __Pyx_XDECREF(__pyx_v_xp); + __Pyx_XDECREF(__pyx_v_filled); + __Pyx_XDECREF(__pyx_v_data); + __Pyx_XDECREF(__pyx_v_row_by_bytes); + __Pyx_XDECREF(__pyx_v_key2row); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_row); + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_i); + __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_row); + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_key); + __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_row); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":379 + * self.vectors.add(key, row=row) + * + * def prune_vectors(self, nr_row, batch_size=1024): # <<<<<<<<<<<<<< + * """Reduce the current vector table to `nr_row` unique entries. Words + * mapped to the discarded vectors will be remapped to the closest vector +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_23prune_vectors(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_22prune_vectors, "Vocab.prune_vectors(self, nr_row, batch_size=1024)\n\nReduce the current vector table to `nr_row` unique entries. Words\nmapped to the discarded vectors will be remapped to the closest vector\namong those remaining.\n\nFor example, suppose the original table had vectors for the words:\n['sat', 'cat', 'feline', 'reclined']. If we prune the vector table to\ntwo rows, we would discard the vectors for 'feline' and 'reclined'.\nThese words would then be remapped to the closest remaining vector\n-- so \"feline\" would have the same vector as \"cat\", and \"reclined\"\nwould have the same vector as \"sat\".\n\nThe similarities are judged by cosine. The original vectors may\nbe large, so the cosines are calculated in minibatches, to reduce\nmemory usage.\n\nnr_row (int): The number of rows to keep in the vector table.\nbatch_size (int): Batch of vectors for calculating the similarities.\n Larger batch sizes might be faster, while temporarily requiring\n more memory.\nRETURNS (dict): A dictionary keyed by removed words mapped to\n `(string, score)` tuples, where `string` is the entry the removed\n word was mapped to, and `score` the similarity score between the\n two words.\n\nDOCS: https://spacy.io/api/vocab#prune_vectors"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_23prune_vectors = {"prune_vectors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_23prune_vectors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_22prune_vectors}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_23prune_vectors(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_nr_row = 0; + PyObject *__pyx_v_batch_size = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("prune_vectors (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_nr_row,&__pyx_mstate_global->__pyx_n_u_batch_size,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 379, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 379, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 379, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "prune_vectors", 0) < (0)) __PYX_ERR(0, 379, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1024)); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("prune_vectors", 0, 1, 2, i); __PYX_ERR(0, 379, __pyx_L3_error) } + } + } else { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 379, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 379, __pyx_L3_error) + break; + default: goto __pyx_L5_argtuple_error; + } + if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1024)); + } + __pyx_v_nr_row = values[0]; + __pyx_v_batch_size = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("prune_vectors", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 379, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.prune_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_22prune_vectors(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_nr_row, __pyx_v_batch_size); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_22prune_vectors(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_nr_row, PyObject *__pyx_v_batch_size) { + PyObject *__pyx_v_ops = NULL; + PyObject *__pyx_v_xp = NULL; + PyObject *__pyx_v_orth = NULL; + PyObject *__pyx_v_priority = NULL; + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_lex = 0; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_value; + PyObject *__pyx_v_indices = NULL; + PyObject *__pyx_v_keys = NULL; + PyObject *__pyx_v_keep = NULL; + PyObject *__pyx_v_toss = NULL; + PyObject *__pyx_v_syn_keys = NULL; + PyObject *__pyx_v_syn_rows = NULL; + PyObject *__pyx_v_scores = NULL; + PyObject *__pyx_v_remap = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_word = NULL; + PyObject *__pyx_v_synonym = NULL; + PyObject *__pyx_v_score = NULL; + CYTHON_UNUSED PyObject *__pyx_v_prob = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_t_13; + int __pyx_t_14; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *(*__pyx_t_17)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("prune_vectors", 0); + + /* "spacy/vocab.pyx":406 + * DOCS: https://spacy.io/api/vocab#prune_vectors + * """ + * if not isinstance(self.vectors, Vectors): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E849.format(method="prune_vectors", vectors_type=type(self.vectors))) + * if self.vectors.mode != VectorsMode.default: +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (unlikely(__pyx_t_4)) { + + /* "spacy/vocab.pyx":407 + * """ + * if not isinstance(self.vectors, Vectors): + * raise ValueError(Errors.E849.format(method="prune_vectors", vectors_type=type(self.vectors))) # <<<<<<<<<<<<<< + * if self.vectors.mode != VectorsMode.default: + * raise ValueError(Errors.E858.format( +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_E849); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_6, NULL}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_method, __pyx_mstate_global->__pyx_n_u_prune_vectors, __pyx_t_10, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 407, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_vectors_type, ((PyObject *)Py_TYPE(__pyx_t_7)), __pyx_t_10, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 407, __pyx_L1_error) + + /* "spacy/vocab.pyx":406 + * DOCS: https://spacy.io/api/vocab#prune_vectors + * """ + * if not isinstance(self.vectors, Vectors): # <<<<<<<<<<<<<< + * raise ValueError(Errors.E849.format(method="prune_vectors", vectors_type=type(self.vectors))) + * if self.vectors.mode != VectorsMode.default: +*/ + } + + /* "spacy/vocab.pyx":408 + * if not isinstance(self.vectors, Vectors): + * raise ValueError(Errors.E849.format(method="prune_vectors", vectors_type=type(self.vectors))) + * if self.vectors.mode != VectorsMode.default: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E858.format( + * mode=self.vectors.mode, +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 408, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_VectorsMode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_default); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 408, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_t_4)) { + + /* "spacy/vocab.pyx":409 + * raise ValueError(Errors.E849.format(method="prune_vectors", vectors_type=type(self.vectors))) + * if self.vectors.mode != VectorsMode.default: + * raise ValueError(Errors.E858.format( # <<<<<<<<<<<<<< + * mode=self.vectors.mode, + * alternative="" +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_Errors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_E858); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_8 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_8); + + /* "spacy/vocab.pyx":410 + * if self.vectors.mode != VectorsMode.default: + * raise ValueError(Errors.E858.format( + * mode=self.vectors.mode, # <<<<<<<<<<<<<< + * alternative="" + * )) +*/ + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_8, NULL}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_mode, __pyx_t_6, __pyx_t_10, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 409, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_alternative, __pyx_mstate_global->__pyx_kp_u__9, __pyx_t_10, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 409, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_9 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 409, __pyx_L1_error) + + /* "spacy/vocab.pyx":408 + * if not isinstance(self.vectors, Vectors): + * raise ValueError(Errors.E849.format(method="prune_vectors", vectors_type=type(self.vectors))) + * if self.vectors.mode != VectorsMode.default: # <<<<<<<<<<<<<< + * raise ValueError(Errors.E858.format( + * mode=self.vectors.mode, +*/ + } + + /* "spacy/vocab.pyx":413 + * alternative="" + * )) + * ops = get_current_ops() # <<<<<<<<<<<<<< + * xp = get_array_module(self.vectors.data) + * # Make sure all vectors are in the vocab +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_get_current_ops); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_1, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v_ops = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":414 + * )) + * ops = get_current_ops() + * xp = get_array_module(self.vectors.data) # <<<<<<<<<<<<<< + * # Make sure all vectors are in the vocab + * for orth in self.vectors: +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_get_array_module); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_10}; + __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v_xp = __pyx_t_2; + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":416 + * xp = get_array_module(self.vectors.data) + * # Make sure all vectors are in the vocab + * for orth in self.vectors: # <<<<<<<<<<<<<< + * self[orth] + * # Make prob negative so it sorts by rank ascending +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5); + __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 416, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 416, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 416, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_12(__pyx_t_5); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 416, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_orth, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":417 + * # Make sure all vectors are in the vocab + * for orth in self.vectors: + * self[orth] # <<<<<<<<<<<<<< + * # Make prob negative so it sorts by rank ascending + * # (key2row contains the rank) +*/ + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_orth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":416 + * xp = get_array_module(self.vectors.data) + * # Make sure all vectors are in the vocab + * for orth in self.vectors: # <<<<<<<<<<<<<< + * self[orth] + * # Make prob negative so it sorts by rank ascending +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":420 + * # Make prob negative so it sorts by rank ascending + * # (key2row contains the rank) + * priority = [] # <<<<<<<<<<<<<< + * cdef Lexeme lex + * cdef attr_t value +*/ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 420, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_priority = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":423 + * cdef Lexeme lex + * cdef attr_t value + * for lex in self: # <<<<<<<<<<<<<< + * value = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if value in self.vectors.key2row: +*/ + if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) { + __pyx_t_5 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_5); + __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 423, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 423, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 423, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 423, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11)); + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error) + } else { + __pyx_t_2 = __pyx_t_12(__pyx_t_5); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 423, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme))))) __PYX_ERR(0, 423, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_lex, ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":424 + * cdef attr_t value + * for lex in self: + * value = Lexeme.get_struct_attr(lex.c, self.vectors.attr) # <<<<<<<<<<<<<< + * if value in self.vectors.key2row: + * priority.append((-lex.prob, self.vectors.key2row[value], value)) +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_attr); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_13 = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_t_10)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_value = __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(__pyx_v_lex->c, __pyx_t_13); + + /* "spacy/vocab.pyx":425 + * for lex in self: + * value = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if value in self.vectors.key2row: # <<<<<<<<<<<<<< + * priority.append((-lex.prob, self.vectors.key2row[value], value)) + * priority.sort() +*/ + __pyx_t_10 = __Pyx_PyLong_From_uint64_t(__pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_key2row); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_t_10, __pyx_t_1, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "spacy/vocab.pyx":426 + * value = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if value in self.vectors.key2row: + * priority.append((-lex.prob, self.vectors.key2row[value], value)) # <<<<<<<<<<<<<< + * priority.sort() + * indices = xp.asarray([i for (prob, i, key) in priority], dtype="uint64") +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_lex), __pyx_mstate_global->__pyx_n_u_prob); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_key2row); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_value, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10) != (0)) __PYX_ERR(0, 426, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 426, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 426, __pyx_L1_error); + __pyx_t_10 = 0; + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_priority, __pyx_t_7); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vocab.pyx":425 + * for lex in self: + * value = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if value in self.vectors.key2row: # <<<<<<<<<<<<<< + * priority.append((-lex.prob, self.vectors.key2row[value], value)) + * priority.sort() +*/ + } + + /* "spacy/vocab.pyx":423 + * cdef Lexeme lex + * cdef attr_t value + * for lex in self: # <<<<<<<<<<<<<< + * value = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if value in self.vectors.key2row: +*/ + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":427 + * if value in self.vectors.key2row: + * priority.append((-lex.prob, self.vectors.key2row[value], value)) + * priority.sort() # <<<<<<<<<<<<<< + * indices = xp.asarray([i for (prob, i, key) in priority], dtype="uint64") + * keys = xp.asarray([key for (prob, i, key) in priority], dtype="uint64") +*/ + __pyx_t_14 = PyList_Sort(__pyx_v_priority); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 427, __pyx_L1_error) + + /* "spacy/vocab.pyx":428 + * priority.append((-lex.prob, self.vectors.key2row[value], value)) + * priority.sort() + * indices = xp.asarray([i for (prob, i, key) in priority], dtype="uint64") # <<<<<<<<<<<<<< + * keys = xp.asarray([key for (prob, i, key) in priority], dtype="uint64") + * keep = xp.ascontiguousarray(self.vectors.data[indices[:nr_row]]) +*/ + __pyx_t_7 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __pyx_v_priority; __Pyx_INCREF(__pyx_t_1); + __pyx_t_11 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 428, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_10 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) { + PyObject* sequence = __pyx_t_10; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 428, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_8); + __pyx_t_15 = PyTuple_GET_ITEM(sequence, 2); + __Pyx_INCREF(__pyx_t_15); + } else { + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_8); + __pyx_t_15 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_15); + } + #else + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_15 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + #endif + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_16 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_16); + index = 0; __pyx_t_6 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_6)) goto __pyx_L14_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_8 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_8)) goto __pyx_L14_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 2; __pyx_t_15 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L14_unpacking_failed; + __Pyx_GOTREF(__pyx_t_15); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 3) < (0)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_17 = NULL; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + goto __pyx_L15_unpacking_done; + __pyx_L14_unpacking_failed:; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_L15_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_prob, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_15); + __pyx_t_15 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_v_i))) __PYX_ERR(0, 428, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_7, __pyx_t_2}; + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_uint64, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_v_indices = __pyx_t_5; + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":429 + * priority.sort() + * indices = xp.asarray([i for (prob, i, key) in priority], dtype="uint64") + * keys = xp.asarray([key for (prob, i, key) in priority], dtype="uint64") # <<<<<<<<<<<<<< + * keep = xp.ascontiguousarray(self.vectors.data[indices[:nr_row]]) + * toss = xp.ascontiguousarray(self.vectors.data[indices[nr_row:]]) +*/ + __pyx_t_1 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __pyx_v_priority; __Pyx_INCREF(__pyx_t_7); + __pyx_t_11 = 0; + for (;;) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 429, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_10 = __Pyx_PyList_GetItemRefFast(__pyx_t_7, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) { + PyObject* sequence = __pyx_t_10; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 429, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_15); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_8); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); + __Pyx_INCREF(__pyx_t_6); + } else { + __pyx_t_15 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_15); + __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_8); + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + } + #else + __pyx_t_15 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_16 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_16); + index = 0; __pyx_t_15 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L19_unpacking_failed; + __Pyx_GOTREF(__pyx_t_15); + index = 1; __pyx_t_8 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_8)) goto __pyx_L19_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 2; __pyx_t_6 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_6)) goto __pyx_L19_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 3) < (0)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_17 = NULL; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + goto __pyx_L20_unpacking_done; + __pyx_L19_unpacking_failed:; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_L20_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_prob, __pyx_t_15); + __pyx_t_15 = 0; + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_6); + __pyx_t_6 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_v_key))) __PYX_ERR(0, 429, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_1, __pyx_t_2}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_uint64, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_asarray, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_v_keys = __pyx_t_5; + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":430 + * indices = xp.asarray([i for (prob, i, key) in priority], dtype="uint64") + * keys = xp.asarray([key for (prob, i, key) in priority], dtype="uint64") + * keep = xp.ascontiguousarray(self.vectors.data[indices[:nr_row]]) # <<<<<<<<<<<<<< + * toss = xp.ascontiguousarray(self.vectors.data[indices[nr_row:]]) + * self.vectors = Vectors(strings=self.strings, data=keep, keys=keys[:nr_row], name=self.vectors.name) +*/ + __pyx_t_7 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_indices, 0, 0, NULL, &__pyx_v_nr_row, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_10}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_ascontiguousarray, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_v_keep = __pyx_t_5; + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":431 + * keys = xp.asarray([key for (prob, i, key) in priority], dtype="uint64") + * keep = xp.ascontiguousarray(self.vectors.data[indices[:nr_row]]) + * toss = xp.ascontiguousarray(self.vectors.data[indices[nr_row:]]) # <<<<<<<<<<<<<< + * self.vectors = Vectors(strings=self.strings, data=keep, keys=keys[:nr_row], name=self.vectors.name) + * syn_keys, syn_rows, scores = self.vectors.most_similar(toss, batch_size=batch_size) +*/ + __pyx_t_10 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_10); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_indices, 0, 0, &__pyx_v_nr_row, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_1}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_ascontiguousarray, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_v_toss = __pyx_t_5; + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":432 + * keep = xp.ascontiguousarray(self.vectors.data[indices[:nr_row]]) + * toss = xp.ascontiguousarray(self.vectors.data[indices[nr_row:]]) + * self.vectors = Vectors(strings=self.strings, data=keep, keys=keys[:nr_row], name=self.vectors.name) # <<<<<<<<<<<<<< + * syn_keys, syn_rows, scores = self.vectors.most_similar(toss, batch_size=batch_size) + * syn_keys = ops.to_numpy(syn_keys) +*/ + __pyx_t_1 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_Vectors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_keys, 0, 0, NULL, &__pyx_v_nr_row, NULL, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_10))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10); + assert(__pyx_t_1); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_10, __pyx__function); + __pyx_t_9 = 0; + } + #endif + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 4 : 0)] = {__pyx_t_1, NULL}; + __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_strings, ((PyObject *)__pyx_v_self->strings), __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 432, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data, __pyx_v_keep, __pyx_t_2, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 432, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_keys, __pyx_t_7, __pyx_t_2, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 432, __pyx_L1_error) + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name, __pyx_t_6, __pyx_t_2, __pyx_callargs+1, 3) < (0)) __PYX_ERR(0, 432, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors, __pyx_t_5) < (0)) __PYX_ERR(0, 432, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":433 + * toss = xp.ascontiguousarray(self.vectors.data[indices[nr_row:]]) + * self.vectors = Vectors(strings=self.strings, data=keep, keys=keys[:nr_row], name=self.vectors.name) + * syn_keys, syn_rows, scores = self.vectors.most_similar(toss, batch_size=batch_size) # <<<<<<<<<<<<<< + * syn_keys = ops.to_numpy(syn_keys) + * remap = {} +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_10); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_10, __pyx_v_toss}; + __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_batch_size, __pyx_v_batch_size, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 433, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_most_similar, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 433, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); + __Pyx_INCREF(__pyx_t_10); + } else { + __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_6); + __pyx_t_10 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference); + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_10); + } + #else + __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); + index = 0; __pyx_t_2 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L22_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_6 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L22_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 2; __pyx_t_10 = __pyx_t_17(__pyx_t_7); if (unlikely(!__pyx_t_10)) goto __pyx_L22_unpacking_failed; + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_7), 3) < (0)) __PYX_ERR(0, 433, __pyx_L1_error) + __pyx_t_17 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L23_unpacking_done; + __pyx_L22_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 433, __pyx_L1_error) + __pyx_L23_unpacking_done:; + } + __pyx_v_syn_keys = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_v_syn_rows = __pyx_t_6; + __pyx_t_6 = 0; + __pyx_v_scores = __pyx_t_10; + __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":434 + * self.vectors = Vectors(strings=self.strings, data=keep, keys=keys[:nr_row], name=self.vectors.name) + * syn_keys, syn_rows, scores = self.vectors.most_similar(toss, batch_size=batch_size) + * syn_keys = ops.to_numpy(syn_keys) # <<<<<<<<<<<<<< + * remap = {} + * for i, key in enumerate(ops.to_numpy(keys[nr_row:])): +*/ + __pyx_t_10 = __pyx_v_ops; + __Pyx_INCREF(__pyx_t_10); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_syn_keys}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_numpy, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF_SET(__pyx_v_syn_keys, __pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":435 + * syn_keys, syn_rows, scores = self.vectors.most_similar(toss, batch_size=batch_size) + * syn_keys = ops.to_numpy(syn_keys) + * remap = {} # <<<<<<<<<<<<<< + * for i, key in enumerate(ops.to_numpy(keys[nr_row:])): + * self.vectors.add(key, row=syn_rows[i][0]) +*/ + __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 435, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_remap = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":436 + * syn_keys = ops.to_numpy(syn_keys) + * remap = {} + * for i, key in enumerate(ops.to_numpy(keys[nr_row:])): # <<<<<<<<<<<<<< + * self.vectors.add(key, row=syn_rows[i][0]) + * word = self.strings[key] +*/ + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); + __pyx_t_5 = __pyx_mstate_global->__pyx_int_0; + __pyx_t_6 = __pyx_v_ops; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_keys, 0, 0, &__pyx_v_nr_row, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_2}; + __pyx_t_10 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_numpy, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + } + if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) { + __pyx_t_2 = __pyx_t_10; __Pyx_INCREF(__pyx_t_2); + __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 436, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + { + Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 436, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + __pyx_t_10 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference); + ++__pyx_t_11; + } else { + { + Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 436, __pyx_L1_error) + #endif + if (__pyx_t_11 >= __pyx_temp) break; + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_10 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11)); + #else + __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_11); + #endif + ++__pyx_t_11; + } + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 436, __pyx_L1_error) + } else { + __pyx_t_10 = __pyx_t_12(__pyx_t_2); + if (unlikely(!__pyx_t_10)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 436, __pyx_L1_error) + PyErr_Clear(); + } + break; + } + } + __Pyx_GOTREF(__pyx_t_10); + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_10); + __pyx_t_10 = 0; + __Pyx_INCREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5); + __pyx_t_10 = __Pyx_PyLong_AddObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_5); + __pyx_t_5 = __pyx_t_10; + __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":437 + * remap = {} + * for i, key in enumerate(ops.to_numpy(keys[nr_row:])): + * self.vectors.add(key, row=syn_rows[i][0]) # <<<<<<<<<<<<<< + * word = self.strings[key] + * synonym = self.strings[syn_keys[i][0]] +*/ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_syn_rows, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_6, __pyx_v_key}; + __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_row, __pyx_t_8, __pyx_t_1, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 437, __pyx_L1_error) + __pyx_t_10 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":438 + * for i, key in enumerate(ops.to_numpy(keys[nr_row:])): + * self.vectors.add(key, row=syn_rows[i][0]) + * word = self.strings[key] # <<<<<<<<<<<<<< + * synonym = self.strings[syn_keys[i][0]] + * score = scores[i][0] +*/ + __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_v_key); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_10); + __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":439 + * self.vectors.add(key, row=syn_rows[i][0]) + * word = self.strings[key] + * synonym = self.strings[syn_keys[i][0]] # <<<<<<<<<<<<<< + * score = scores[i][0] + * remap[word] = (synonym, score) +*/ + __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_syn_keys, __pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self->strings), __pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF_SET(__pyx_v_synonym, __pyx_t_10); + __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":440 + * word = self.strings[key] + * synonym = self.strings[syn_keys[i][0]] + * score = scores[i][0] # <<<<<<<<<<<<<< + * remap[word] = (synonym, score) + * return remap +*/ + __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_scores, __pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF_SET(__pyx_v_score, __pyx_t_7); + __pyx_t_7 = 0; + + /* "spacy/vocab.pyx":441 + * synonym = self.strings[syn_keys[i][0]] + * score = scores[i][0] + * remap[word] = (synonym, score) # <<<<<<<<<<<<<< + * return remap + * +*/ + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_synonym); + __Pyx_GIVEREF(__pyx_v_synonym); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_synonym) != (0)) __PYX_ERR(0, 441, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_score); + __Pyx_GIVEREF(__pyx_v_score); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_score) != (0)) __PYX_ERR(0, 441, __pyx_L1_error); + if (unlikely((PyDict_SetItem(__pyx_v_remap, __pyx_v_word, __pyx_t_7) < 0))) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "spacy/vocab.pyx":436 + * syn_keys = ops.to_numpy(syn_keys) + * remap = {} + * for i, key in enumerate(ops.to_numpy(keys[nr_row:])): # <<<<<<<<<<<<<< + * self.vectors.add(key, row=syn_rows[i][0]) + * word = self.strings[key] +*/ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":442 + * score = scores[i][0] + * remap[word] = (synonym, score) + * return remap # <<<<<<<<<<<<<< + * + * def get_vector(self, orth): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_remap); + __pyx_r = __pyx_v_remap; + goto __pyx_L0; + + /* "spacy/vocab.pyx":379 + * self.vectors.add(key, row=row) + * + * def prune_vectors(self, nr_row, batch_size=1024): # <<<<<<<<<<<<<< + * """Reduce the current vector table to `nr_row` unique entries. Words + * mapped to the discarded vectors will be remapped to the closest vector +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_AddTraceback("spacy.vocab.Vocab.prune_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ops); + __Pyx_XDECREF(__pyx_v_xp); + __Pyx_XDECREF(__pyx_v_orth); + __Pyx_XDECREF(__pyx_v_priority); + __Pyx_XDECREF((PyObject *)__pyx_v_lex); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XDECREF(__pyx_v_keys); + __Pyx_XDECREF(__pyx_v_keep); + __Pyx_XDECREF(__pyx_v_toss); + __Pyx_XDECREF(__pyx_v_syn_keys); + __Pyx_XDECREF(__pyx_v_syn_rows); + __Pyx_XDECREF(__pyx_v_scores); + __Pyx_XDECREF(__pyx_v_remap); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_word); + __Pyx_XDECREF(__pyx_v_synonym); + __Pyx_XDECREF(__pyx_v_score); + __Pyx_XDECREF(__pyx_v_prob); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":444 + * return remap + * + * def get_vector(self, orth): # <<<<<<<<<<<<<< + * """Retrieve a vector for a word in the vocabulary. Words can be looked + * up by string or int ID. If the current vectors do not contain an entry +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_25get_vector(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_24get_vector, "Vocab.get_vector(self, orth)\n\nRetrieve a vector for a word in the vocabulary. Words can be looked\nup by string or int ID. If the current vectors do not contain an entry\nfor the word, a 0-vector with the same number of dimensions as the\ncurrent vectors is returned.\n\north (int / unicode): The hash value of a word, or its unicode string.\nRETURNS (numpy.ndarray or cupy.ndarray): A word vector. Size\n and shape determined by the `vocab.vectors` instance. Usually, a\n numpy ndarray of shape (300,) and dtype float32.\n\nDOCS: https://spacy.io/api/vocab#get_vector"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_25get_vector = {"get_vector", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_25get_vector, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_24get_vector}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_25get_vector(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_orth = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_vector (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_orth_2,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 444, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 444, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get_vector", 0) < (0)) __PYX_ERR(0, 444, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_vector", 1, 1, 1, i); __PYX_ERR(0, 444, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 444, __pyx_L3_error) + } + __pyx_v_orth = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_vector", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 444, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.get_vector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_24get_vector(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_orth); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_24get_vector(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_orth) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_lex = 0; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_key; + PyObject *__pyx_v_xp = NULL; + PyObject *__pyx_v_vectors = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_vector", 0); + __Pyx_INCREF(__pyx_v_orth); + + /* "spacy/vocab.pyx":457 + * DOCS: https://spacy.io/api/vocab#get_vector + * """ + * if isinstance(orth, str): # <<<<<<<<<<<<<< + * orth = self.strings.add(orth, allow_transient=True) + * cdef Lexeme lex = self[orth] +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_orth); + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":458 + * """ + * if isinstance(orth, str): + * orth = self.strings.add(orth, allow_transient=True) # <<<<<<<<<<<<<< + * cdef Lexeme lex = self[orth] + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_v_orth}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_True, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF_SET(__pyx_v_orth, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":457 + * DOCS: https://spacy.io/api/vocab#get_vector + * """ + * if isinstance(orth, str): # <<<<<<<<<<<<<< + * orth = self.strings.add(orth, allow_transient=True) + * cdef Lexeme lex = self[orth] +*/ + } + + /* "spacy/vocab.pyx":459 + * if isinstance(orth, str): + * orth = self.strings.add(orth, allow_transient=True) + * cdef Lexeme lex = self[orth] # <<<<<<<<<<<<<< + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if self.has_vector(key): +*/ + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_orth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme))))) __PYX_ERR(0, 459, __pyx_L1_error) + __pyx_v_lex = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":460 + * orth = self.strings.add(orth, allow_transient=True) + * cdef Lexeme lex = self[orth] + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) # <<<<<<<<<<<<<< + * if self.has_vector(key): + * return self.vectors[key] +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_attr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 460, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_t_5)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_key = __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(__pyx_v_lex->c, __pyx_t_6); + + /* "spacy/vocab.pyx":461 + * cdef Lexeme lex = self[orth] + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if self.has_vector(key): # <<<<<<<<<<<<<< + * return self.vectors[key] + * xp = get_array_module(self.vectors.data) +*/ + __pyx_t_2 = ((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyLong_From_uint64_t(__pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_has_vector, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":462 + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if self.has_vector(key): + * return self.vectors[key] # <<<<<<<<<<<<<< + * xp = get_array_module(self.vectors.data) + * vectors = xp.zeros((self.vectors_length,), dtype="f") +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_key, __pyx_t_5spacy_8typedefs_attr_t, 0, __Pyx_PyLong_From_uint64_t, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/vocab.pyx":461 + * cdef Lexeme lex = self[orth] + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if self.has_vector(key): # <<<<<<<<<<<<<< + * return self.vectors[key] + * xp = get_array_module(self.vectors.data) +*/ + } + + /* "spacy/vocab.pyx":463 + * if self.has_vector(key): + * return self.vectors[key] + * xp = get_array_module(self.vectors.data) # <<<<<<<<<<<<<< + * vectors = xp.zeros((self.vectors_length,), dtype="f") + * return vectors +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_get_array_module); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_data); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + assert(__pyx_t_5); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_2, __pyx__function); + __pyx_t_4 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_8}; + __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_xp = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/vocab.pyx":464 + * return self.vectors[key] + * xp = get_array_module(self.vectors.data) + * vectors = xp.zeros((self.vectors_length,), dtype="f") # <<<<<<<<<<<<<< + * return vectors + * +*/ + __pyx_t_2 = __pyx_v_xp; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors_length); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8) != (0)) __PYX_ERR(0, 464, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_t_5}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_f, __pyx_t_8, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 464, __pyx_L1_error) + __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_zeros, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_v_vectors = __pyx_t_3; + __pyx_t_3 = 0; + + /* "spacy/vocab.pyx":465 + * xp = get_array_module(self.vectors.data) + * vectors = xp.zeros((self.vectors_length,), dtype="f") + * return vectors # <<<<<<<<<<<<<< + * + * def set_vector(self, orth, vector): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_vectors); + __pyx_r = __pyx_v_vectors; + goto __pyx_L0; + + /* "spacy/vocab.pyx":444 + * return remap + * + * def get_vector(self, orth): # <<<<<<<<<<<<<< + * """Retrieve a vector for a word in the vocabulary. Words can be looked + * up by string or int ID. If the current vectors do not contain an entry +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.vocab.Vocab.get_vector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_lex); + __Pyx_XDECREF(__pyx_v_xp); + __Pyx_XDECREF(__pyx_v_vectors); + __Pyx_XDECREF(__pyx_v_orth); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":467 + * return vectors + * + * def set_vector(self, orth, vector): # <<<<<<<<<<<<<< + * """Set a vector for a word in the vocabulary. Words can be referenced + * by string or int ID. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_27set_vector(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_26set_vector, "Vocab.set_vector(self, orth, vector)\n\nSet a vector for a word in the vocabulary. Words can be referenced\nby string or int ID.\n\north (int / str): The word.\nvector (numpy.ndarray or cupy.nadarry[ndim=1, dtype='float32']): The vector to set.\n\nDOCS: https://spacy.io/api/vocab#set_vector"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_27set_vector = {"set_vector", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_27set_vector, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_26set_vector}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_27set_vector(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_orth = 0; + PyObject *__pyx_v_vector = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_vector (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_orth_2,&__pyx_mstate_global->__pyx_n_u_vector,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 467, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 467, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 467, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "set_vector", 0) < (0)) __PYX_ERR(0, 467, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("set_vector", 1, 2, 2, i); __PYX_ERR(0, 467, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 467, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 467, __pyx_L3_error) + } + __pyx_v_orth = values[0]; + __pyx_v_vector = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_vector", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 467, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.set_vector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_26set_vector(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_orth, __pyx_v_vector); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_26set_vector(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_orth, PyObject *__pyx_v_vector) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_lex = 0; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_key; + PyObject *__pyx_v_new_rows = NULL; + PyObject *__pyx_v_width = NULL; + PyObject *__pyx_v_row = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_t_6; + int __pyx_t_7; + long __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_vector", 0); + __Pyx_INCREF(__pyx_v_orth); + + /* "spacy/vocab.pyx":476 + * DOCS: https://spacy.io/api/vocab#set_vector + * """ + * if isinstance(orth, str): # <<<<<<<<<<<<<< + * orth = self.strings.add(orth, allow_transient=False) + * cdef Lexeme lex = self[orth] +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_orth); + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":477 + * """ + * if isinstance(orth, str): + * orth = self.strings.add(orth, allow_transient=False) # <<<<<<<<<<<<<< + * cdef Lexeme lex = self[orth] + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_v_orth}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_False, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 477, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF_SET(__pyx_v_orth, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":476 + * DOCS: https://spacy.io/api/vocab#set_vector + * """ + * if isinstance(orth, str): # <<<<<<<<<<<<<< + * orth = self.strings.add(orth, allow_transient=False) + * cdef Lexeme lex = self[orth] +*/ + } + + /* "spacy/vocab.pyx":478 + * if isinstance(orth, str): + * orth = self.strings.add(orth, allow_transient=False) + * cdef Lexeme lex = self[orth] # <<<<<<<<<<<<<< + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if self.vectors.is_full and key not in self.vectors: +*/ + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_orth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme))))) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_v_lex = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":479 + * orth = self.strings.add(orth, allow_transient=False) + * cdef Lexeme lex = self[orth] + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) # <<<<<<<<<<<<<< + * if self.vectors.is_full and key not in self.vectors: + * new_rows = max(100, int(self.vectors.shape[0]*1.3)) +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_attr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_t_5)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_key = __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(__pyx_v_lex->c, __pyx_t_6); + + /* "spacy/vocab.pyx":480 + * cdef Lexeme lex = self[orth] + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if self.vectors.is_full and key not in self.vectors: # <<<<<<<<<<<<<< + * new_rows = max(100, int(self.vectors.shape[0]*1.3)) + * if self.vectors.shape[1] == 0: +*/ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_is_full); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_7) { + } else { + __pyx_t_1 = __pyx_t_7; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_t_5, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 480, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __pyx_t_7; + __pyx_L5_bool_binop_done:; + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":481 + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if self.vectors.is_full and key not in self.vectors: + * new_rows = max(100, int(self.vectors.shape[0]*1.3)) # <<<<<<<<<<<<<< + * if self.vectors.shape[1] == 0: + * width = vector.size +*/ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Multiply(__pyx_t_5, __pyx_mstate_global->__pyx_float_1_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = 0x64; + __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_1) { + __Pyx_INCREF(__pyx_t_5); + __pyx_t_2 = __pyx_t_5; + } else { + __pyx_t_9 = __Pyx_PyLong_From_long(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 481, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_PyInt_FromNumber(&__pyx_t_9, NULL, 0) < (0)) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_2 = __pyx_t_9; + __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_new_rows = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":482 + * if self.vectors.is_full and key not in self.vectors: + * new_rows = max(100, int(self.vectors.shape[0]*1.3)) + * if self.vectors.shape[1] == 0: # <<<<<<<<<<<<<< + * width = vector.size + * else: +*/ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":483 + * new_rows = max(100, int(self.vectors.shape[0]*1.3)) + * if self.vectors.shape[1] == 0: + * width = vector.size # <<<<<<<<<<<<<< + * else: + * width = self.vectors.shape[1] +*/ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_vector, __pyx_mstate_global->__pyx_n_u_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_width = __pyx_t_5; + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":482 + * if self.vectors.is_full and key not in self.vectors: + * new_rows = max(100, int(self.vectors.shape[0]*1.3)) + * if self.vectors.shape[1] == 0: # <<<<<<<<<<<<<< + * width = vector.size + * else: +*/ + goto __pyx_L7; + } + + /* "spacy/vocab.pyx":485 + * width = vector.size + * else: + * width = self.vectors.shape[1] # <<<<<<<<<<<<<< + * self.vectors.resize((new_rows, width)) + * row = self.vectors.add(key, vector=vector) +*/ + /*else*/ { + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 485, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 485, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_width = __pyx_t_5; + __pyx_t_5 = 0; + } + __pyx_L7:; + + /* "spacy/vocab.pyx":486 + * else: + * width = self.vectors.shape[1] + * self.vectors.resize((new_rows, width)) # <<<<<<<<<<<<<< + * row = self.vectors.add(key, vector=vector) + * if row >= 0: +*/ + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = __pyx_t_9; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_new_rows); + __Pyx_GIVEREF(__pyx_v_new_rows); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_new_rows) != (0)) __PYX_ERR(0, 486, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_width); + __Pyx_GIVEREF(__pyx_v_width); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_width) != (0)) __PYX_ERR(0, 486, __pyx_L1_error); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_resize, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":480 + * cdef Lexeme lex = self[orth] + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * if self.vectors.is_full and key not in self.vectors: # <<<<<<<<<<<<<< + * new_rows = max(100, int(self.vectors.shape[0]*1.3)) + * if self.vectors.shape[1] == 0: +*/ + } + + /* "spacy/vocab.pyx":487 + * width = self.vectors.shape[1] + * self.vectors.resize((new_rows, width)) + * row = self.vectors.add(key, vector=vector) # <<<<<<<<<<<<<< + * if row >= 0: + * lex.rank = row +*/ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_9); + __pyx_t_2 = __Pyx_PyLong_From_uint64_t(__pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_9, __pyx_t_2}; + __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_vector, __pyx_v_vector, __pyx_t_10, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_t_5 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_v_row = __pyx_t_5; + __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":488 + * self.vectors.resize((new_rows, width)) + * row = self.vectors.add(key, vector=vector) + * if row >= 0: # <<<<<<<<<<<<<< + * lex.rank = row + * +*/ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_row, __pyx_mstate_global->__pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":489 + * row = self.vectors.add(key, vector=vector) + * if row >= 0: + * lex.rank = row # <<<<<<<<<<<<<< + * + * def has_vector(self, orth): +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_lex), __pyx_mstate_global->__pyx_n_u_rank, __pyx_v_row) < (0)) __PYX_ERR(0, 489, __pyx_L1_error) + + /* "spacy/vocab.pyx":488 + * self.vectors.resize((new_rows, width)) + * row = self.vectors.add(key, vector=vector) + * if row >= 0: # <<<<<<<<<<<<<< + * lex.rank = row + * +*/ + } + + /* "spacy/vocab.pyx":467 + * return vectors + * + * def set_vector(self, orth, vector): # <<<<<<<<<<<<<< + * """Set a vector for a word in the vocabulary. Words can be referenced + * by string or int ID. +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("spacy.vocab.Vocab.set_vector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_lex); + __Pyx_XDECREF(__pyx_v_new_rows); + __Pyx_XDECREF(__pyx_v_width); + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XDECREF(__pyx_v_orth); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":491 + * lex.rank = row + * + * def has_vector(self, orth): # <<<<<<<<<<<<<< + * """Check whether a word has a vector. Returns False if no vectors have + * been loaded. Words can be looked up by string or int ID. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_29has_vector(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_28has_vector, "Vocab.has_vector(self, orth)\n\nCheck whether a word has a vector. Returns False if no vectors have\nbeen loaded. Words can be looked up by string or int ID.\n\north (int / str): The word.\nRETURNS (bool): Whether the word has a vector.\n\nDOCS: https://spacy.io/api/vocab#has_vector"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_29has_vector = {"has_vector", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_29has_vector, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_28has_vector}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_29has_vector(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_orth = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("has_vector (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_orth_2,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 491, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 491, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "has_vector", 0) < (0)) __PYX_ERR(0, 491, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("has_vector", 1, 1, 1, i); __PYX_ERR(0, 491, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 491, __pyx_L3_error) + } + __pyx_v_orth = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("has_vector", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 491, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.has_vector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_28has_vector(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_orth); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_28has_vector(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_orth) { + struct __pyx_obj_5spacy_6lexeme_Lexeme *__pyx_v_lex = 0; + __pyx_t_5spacy_8typedefs_attr_t __pyx_v_key; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + enum __pyx_t_5spacy_5attrs_attr_id_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("has_vector", 0); + __Pyx_INCREF(__pyx_v_orth); + + /* "spacy/vocab.pyx":500 + * DOCS: https://spacy.io/api/vocab#has_vector + * """ + * if isinstance(orth, str): # <<<<<<<<<<<<<< + * orth = self.strings.add(orth, allow_transient=True) + * cdef Lexeme lex = self[orth] +*/ + __pyx_t_1 = PyUnicode_Check(__pyx_v_orth); + if (__pyx_t_1) { + + /* "spacy/vocab.pyx":501 + * """ + * if isinstance(orth, str): + * orth = self.strings.add(orth, allow_transient=True) # <<<<<<<<<<<<<< + * cdef Lexeme lex = self[orth] + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) +*/ + __pyx_t_3 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_v_orth}; + __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_allow_transient, Py_True, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 501, __pyx_L1_error) + __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF_SET(__pyx_v_orth, __pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":500 + * DOCS: https://spacy.io/api/vocab#has_vector + * """ + * if isinstance(orth, str): # <<<<<<<<<<<<<< + * orth = self.strings.add(orth, allow_transient=True) + * cdef Lexeme lex = self[orth] +*/ + } + + /* "spacy/vocab.pyx":502 + * if isinstance(orth, str): + * orth = self.strings.add(orth, allow_transient=True) + * cdef Lexeme lex = self[orth] # <<<<<<<<<<<<<< + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * return key in self.vectors +*/ + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_orth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 502, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5spacy_6lexeme_Lexeme))))) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_v_lex = ((struct __pyx_obj_5spacy_6lexeme_Lexeme *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":503 + * orth = self.strings.add(orth, allow_transient=True) + * cdef Lexeme lex = self[orth] + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) # <<<<<<<<<<<<<< + * return key in self.vectors + * +*/ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_attr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = ((enum __pyx_t_5spacy_5attrs_attr_id_t)__Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(__pyx_t_5)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_key = __pyx_f_5spacy_6lexeme_6Lexeme_get_struct_attr(__pyx_v_lex->c, __pyx_t_6); + + /* "spacy/vocab.pyx":504 + * cdef Lexeme lex = self[orth] + * key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + * return key in self.vectors # <<<<<<<<<<<<<< + * + * @property +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyLong_From_uint64_t(__pyx_v_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 504, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_t_5, __pyx_t_2, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 504, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "spacy/vocab.pyx":491 + * lex.rank = row + * + * def has_vector(self, orth): # <<<<<<<<<<<<<< + * """Check whether a word has a vector. Returns False if no vectors have + * been loaded. Words can be looked up by string or int ID. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.vocab.Vocab.has_vector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_lex); + __Pyx_XDECREF(__pyx_v_orth); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":506 + * return key in self.vectors + * + * @property # <<<<<<<<<<<<<< + * def lookups(self): + * return self._lookups +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_7lookups_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_7lookups_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_7lookups___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_7lookups___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "spacy/vocab.pyx":508 + * @property + * def lookups(self): + * return self._lookups # <<<<<<<<<<<<<< + * + * @lookups.setter +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_lookups); + __pyx_r = __pyx_v_self->_lookups; + goto __pyx_L0; + + /* "spacy/vocab.pyx":506 + * return key in self.vectors + * + * @property # <<<<<<<<<<<<<< + * def lookups(self): + * return self._lookups +*/ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":510 + * return self._lookups + * + * @lookups.setter # <<<<<<<<<<<<<< + * def lookups(self, lookups): + * self._lookups = lookups +*/ + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_7lookups_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_lookups); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_7lookups_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_lookups) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_7lookups_2__set__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), ((PyObject *)__pyx_v_lookups)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_7lookups_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_lookups) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + + /* "spacy/vocab.pyx":512 + * @lookups.setter + * def lookups(self, lookups): + * self._lookups = lookups # <<<<<<<<<<<<<< + * if lookups.has_table("lexeme_norm"): + * self.lex_attr_getters[NORM] = util.add_lookups( +*/ + __Pyx_INCREF(__pyx_v_lookups); + __Pyx_GIVEREF(__pyx_v_lookups); + __Pyx_GOTREF(__pyx_v_self->_lookups); + __Pyx_DECREF(__pyx_v_self->_lookups); + __pyx_v_self->_lookups = __pyx_v_lookups; + + /* "spacy/vocab.pyx":513 + * def lookups(self, lookups): + * self._lookups = lookups + * if lookups.has_table("lexeme_norm"): # <<<<<<<<<<<<<< + * self.lex_attr_getters[NORM] = util.add_lookups( + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), +*/ + __pyx_t_2 = __pyx_v_lookups; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_lexeme_norm}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_has_table, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "spacy/vocab.pyx":514 + * self._lookups = lookups + * if lookups.has_table("lexeme_norm"): + * self.lex_attr_getters[NORM] = util.add_lookups( # <<<<<<<<<<<<<< + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), + * self.lookups.get_table("lexeme_norm"), +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_add_lookups); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":515 + * if lookups.has_table("lexeme_norm"): + * self.lex_attr_getters[NORM] = util.add_lookups( + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), # <<<<<<<<<<<<<< + * self.lookups.get_table("lexeme_norm"), + * ) +*/ + __pyx_t_7 = __pyx_v_self->lex_attr_getters; + __Pyx_INCREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_LEX_ATTRS); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_8, __pyx_t_11}; + __pyx_t_5 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + + /* "spacy/vocab.pyx":516 + * self.lex_attr_getters[NORM] = util.add_lookups( + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), + * self.lookups.get_table("lexeme_norm"), # <<<<<<<<<<<<<< + * ) + * +*/ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_n_u_lexeme_norm}; + __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_table, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_5, __pyx_t_11}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + + /* "spacy/vocab.pyx":514 + * self._lookups = lookups + * if lookups.has_table("lexeme_norm"): + * self.lex_attr_getters[NORM] = util.add_lookups( # <<<<<<<<<<<<<< + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), + * self.lookups.get_table("lexeme_norm"), +*/ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely((PyObject_SetItem(__pyx_v_self->lex_attr_getters, __pyx_t_6, __pyx_t_1) < 0))) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":513 + * def lookups(self, lookups): + * self._lookups = lookups + * if lookups.has_table("lexeme_norm"): # <<<<<<<<<<<<<< + * self.lex_attr_getters[NORM] = util.add_lookups( + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), +*/ + } + + /* "spacy/vocab.pyx":510 + * return self._lookups + * + * @lookups.setter # <<<<<<<<<<<<<< + * def lookups(self, lookups): + * self._lookups = lookups +*/ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.vocab.Vocab.lookups.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":519 + * ) + * + * def to_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_31to_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_30to_disk, "Vocab.to_disk(self, path, *, exclude=tuple())\n\nSave the current state to a directory.\n\npath (str or Path): A path to a directory, which will be created if\n it doesn't exist.\nexclude (Iterable[str]): String names of serialization fields to exclude.\n\nDOCS: https://spacy.io/api/vocab#to_disk"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_31to_disk = {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_31to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_30to_disk}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_31to_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + PyObject *__pyx_v_exclude = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_disk (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_exclude,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 519, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 519, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "to_disk", 0) < (0)) __PYX_ERR(0, 519, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__10); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, i); __PYX_ERR(0, 519, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 519, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__10); + } + __pyx_v_path = values[0]; + __pyx_v_exclude = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 519, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_30to_disk(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_path, __pyx_v_exclude); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_30to_disk(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_exclude) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_disk", 0); + __Pyx_INCREF(__pyx_v_path); + + /* "spacy/vocab.pyx":528 + * DOCS: https://spacy.io/api/vocab#to_disk + * """ + * path = util.ensure_path(path) # <<<<<<<<<<<<<< + * if not path.exists(): + * path.mkdir() +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ensure_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":529 + * """ + * path = util.ensure_path(path) + * if not path.exists(): # <<<<<<<<<<<<<< + * path.mkdir() + * if "strings" not in exclude: +*/ + __pyx_t_4 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_exists, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = (!__pyx_t_6); + if (__pyx_t_7) { + + /* "spacy/vocab.pyx":530 + * path = util.ensure_path(path) + * if not path.exists(): + * path.mkdir() # <<<<<<<<<<<<<< + * if "strings" not in exclude: + * self.strings.to_disk(path / "strings.json") +*/ + __pyx_t_4 = __pyx_v_path; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_mkdir, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":529 + * """ + * path = util.ensure_path(path) + * if not path.exists(): # <<<<<<<<<<<<<< + * path.mkdir() + * if "strings" not in exclude: +*/ + } + + /* "spacy/vocab.pyx":531 + * if not path.exists(): + * path.mkdir() + * if "strings" not in exclude: # <<<<<<<<<<<<<< + * self.strings.to_disk(path / "strings.json") + * if "vectors" not in exclude: +*/ + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_strings, __pyx_v_exclude, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 531, __pyx_L1_error) + if (__pyx_t_7) { + + /* "spacy/vocab.pyx":532 + * path.mkdir() + * if "strings" not in exclude: + * self.strings.to_disk(path / "strings.json") # <<<<<<<<<<<<<< + * if "vectors" not in exclude: + * self.vectors.to_disk(path, exclude=["strings"]) +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_path, __pyx_mstate_global->__pyx_kp_u_strings_json); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_disk, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":531 + * if not path.exists(): + * path.mkdir() + * if "strings" not in exclude: # <<<<<<<<<<<<<< + * self.strings.to_disk(path / "strings.json") + * if "vectors" not in exclude: +*/ + } + + /* "spacy/vocab.pyx":533 + * if "strings" not in exclude: + * self.strings.to_disk(path / "strings.json") + * if "vectors" not in exclude: # <<<<<<<<<<<<<< + * self.vectors.to_disk(path, exclude=["strings"]) + * if "lookups" not in exclude: +*/ + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_vectors, __pyx_v_exclude, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 533, __pyx_L1_error) + if (__pyx_t_7) { + + /* "spacy/vocab.pyx":534 + * self.strings.to_disk(path / "strings.json") + * if "vectors" not in exclude: + * self.vectors.to_disk(path, exclude=["strings"]) # <<<<<<<<<<<<<< + * if "lookups" not in exclude: + * self.lookups.to_disk(path) +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_strings); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_strings); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_mstate_global->__pyx_n_u_strings) != (0)) __PYX_ERR(0, 534, __pyx_L1_error); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_path}; + __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_3, __pyx_t_8, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 534, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_to_disk, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":533 + * if "strings" not in exclude: + * self.strings.to_disk(path / "strings.json") + * if "vectors" not in exclude: # <<<<<<<<<<<<<< + * self.vectors.to_disk(path, exclude=["strings"]) + * if "lookups" not in exclude: +*/ + } + + /* "spacy/vocab.pyx":535 + * if "vectors" not in exclude: + * self.vectors.to_disk(path, exclude=["strings"]) + * if "lookups" not in exclude: # <<<<<<<<<<<<<< + * self.lookups.to_disk(path) + * +*/ + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_lookups, __pyx_v_exclude, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 535, __pyx_L1_error) + if (__pyx_t_7) { + + /* "spacy/vocab.pyx":536 + * self.vectors.to_disk(path, exclude=["strings"]) + * if "lookups" not in exclude: + * self.lookups.to_disk(path) # <<<<<<<<<<<<<< + * + * def from_disk(self, path, *, exclude=tuple()): +*/ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_path}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_disk, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":535 + * if "vectors" not in exclude: + * self.vectors.to_disk(path, exclude=["strings"]) + * if "lookups" not in exclude: # <<<<<<<<<<<<<< + * self.lookups.to_disk(path) + * +*/ + } + + /* "spacy/vocab.pyx":519 + * ) + * + * def to_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("spacy.vocab.Vocab.to_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_path); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":538 + * self.lookups.to_disk(path) + * + * def from_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_33from_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_32from_disk, "Vocab.from_disk(self, path, *, exclude=tuple())\n\nLoads state from a directory. Modifies the object in place and\nreturns it.\n\npath (str or Path): A path to a directory.\nexclude (Iterable[str]): String names of serialization fields to exclude.\nRETURNS (Vocab): The modified `Vocab` object.\n\nDOCS: https://spacy.io/api/vocab#to_disk"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_33from_disk = {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_33from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_32from_disk}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_33from_disk(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_path = 0; + PyObject *__pyx_v_exclude = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_disk (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,&__pyx_mstate_global->__pyx_n_u_exclude,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 538, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 538, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_disk", 0) < (0)) __PYX_ERR(0, 538, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__11); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_disk", 1, 1, 1, i); __PYX_ERR(0, 538, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 538, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__11); + } + __pyx_v_path = values[0]; + __pyx_v_exclude = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_disk", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 538, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_32from_disk(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_path, __pyx_v_exclude); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_32from_disk(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_exclude) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_disk", 0); + __Pyx_INCREF(__pyx_v_path); + + /* "spacy/vocab.pyx":548 + * DOCS: https://spacy.io/api/vocab#to_disk + * """ + * path = util.ensure_path(path) # <<<<<<<<<<<<<< + * if "strings" not in exclude: + * self.strings.from_disk(path / "strings.json") # TODO: add exclude? +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ensure_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":549 + * """ + * path = util.ensure_path(path) + * if "strings" not in exclude: # <<<<<<<<<<<<<< + * self.strings.from_disk(path / "strings.json") # TODO: add exclude? + * if "vectors" not in exclude: +*/ + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_strings, __pyx_v_exclude, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 549, __pyx_L1_error) + if (__pyx_t_6) { + + /* "spacy/vocab.pyx":550 + * path = util.ensure_path(path) + * if "strings" not in exclude: + * self.strings.from_disk(path / "strings.json") # TODO: add exclude? # <<<<<<<<<<<<<< + * if "vectors" not in exclude: + * if self.vectors is not None: +*/ + __pyx_t_4 = ((PyObject *)__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_path, __pyx_mstate_global->__pyx_kp_u_strings_json); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_from_disk, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":549 + * """ + * path = util.ensure_path(path) + * if "strings" not in exclude: # <<<<<<<<<<<<<< + * self.strings.from_disk(path / "strings.json") # TODO: add exclude? + * if "vectors" not in exclude: +*/ + } + + /* "spacy/vocab.pyx":551 + * if "strings" not in exclude: + * self.strings.from_disk(path / "strings.json") # TODO: add exclude? + * if "vectors" not in exclude: # <<<<<<<<<<<<<< + * if self.vectors is not None: + * self.vectors.from_disk(path, exclude=["strings"]) +*/ + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_vectors, __pyx_v_exclude, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 551, __pyx_L1_error) + if (__pyx_t_6) { + + /* "spacy/vocab.pyx":552 + * self.strings.from_disk(path / "strings.json") # TODO: add exclude? + * if "vectors" not in exclude: + * if self.vectors is not None: # <<<<<<<<<<<<<< + * self.vectors.from_disk(path, exclude=["strings"]) + * if "lookups" not in exclude: +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 552, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = (__pyx_t_1 != Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + + /* "spacy/vocab.pyx":553 + * if "vectors" not in exclude: + * if self.vectors is not None: + * self.vectors.from_disk(path, exclude=["strings"]) # <<<<<<<<<<<<<< + * if "lookups" not in exclude: + * self.lookups.from_disk(path) +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 553, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 553, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_strings); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_strings); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_mstate_global->__pyx_n_u_strings) != (0)) __PYX_ERR(0, 553, __pyx_L1_error); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_v_path}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 553, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_3, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 553, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_from_disk, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 553, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":552 + * self.strings.from_disk(path / "strings.json") # TODO: add exclude? + * if "vectors" not in exclude: + * if self.vectors is not None: # <<<<<<<<<<<<<< + * self.vectors.from_disk(path, exclude=["strings"]) + * if "lookups" not in exclude: +*/ + } + + /* "spacy/vocab.pyx":551 + * if "strings" not in exclude: + * self.strings.from_disk(path / "strings.json") # TODO: add exclude? + * if "vectors" not in exclude: # <<<<<<<<<<<<<< + * if self.vectors is not None: + * self.vectors.from_disk(path, exclude=["strings"]) +*/ + } + + /* "spacy/vocab.pyx":554 + * if self.vectors is not None: + * self.vectors.from_disk(path, exclude=["strings"]) + * if "lookups" not in exclude: # <<<<<<<<<<<<<< + * self.lookups.from_disk(path) + * if "lexeme_norm" in self.lookups: +*/ + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_lookups, __pyx_v_exclude, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 554, __pyx_L1_error) + if (__pyx_t_6) { + + /* "spacy/vocab.pyx":555 + * self.vectors.from_disk(path, exclude=["strings"]) + * if "lookups" not in exclude: + * self.lookups.from_disk(path) # <<<<<<<<<<<<<< + * if "lexeme_norm" in self.lookups: + * self.lex_attr_getters[NORM] = util.add_lookups( +*/ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 555, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_path}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_from_disk, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 555, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":554 + * if self.vectors is not None: + * self.vectors.from_disk(path, exclude=["strings"]) + * if "lookups" not in exclude: # <<<<<<<<<<<<<< + * self.lookups.from_disk(path) + * if "lexeme_norm" in self.lookups: +*/ + } + + /* "spacy/vocab.pyx":556 + * if "lookups" not in exclude: + * self.lookups.from_disk(path) + * if "lexeme_norm" in self.lookups: # <<<<<<<<<<<<<< + * self.lex_attr_getters[NORM] = util.add_lookups( + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_lexeme_norm, __pyx_t_1, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + + /* "spacy/vocab.pyx":557 + * self.lookups.from_disk(path) + * if "lexeme_norm" in self.lookups: + * self.lex_attr_getters[NORM] = util.add_lookups( # <<<<<<<<<<<<<< + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") + * ) +*/ + __pyx_t_7 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_add_lookups); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":558 + * if "lexeme_norm" in self.lookups: + * self.lex_attr_getters[NORM] = util.add_lookups( + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") # <<<<<<<<<<<<<< + * ) + * self.length = 0 +*/ + __pyx_t_2 = __pyx_v_self->lex_attr_getters; + __Pyx_INCREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 558, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_LEX_ATTRS); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 558, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 558, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 558, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_8, __pyx_t_11}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 558, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_n_u_lexeme_norm}; + __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_table, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 558, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_7); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_4, __pyx_t_11}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + + /* "spacy/vocab.pyx":557 + * self.lookups.from_disk(path) + * if "lexeme_norm" in self.lookups: + * self.lex_attr_getters[NORM] = util.add_lookups( # <<<<<<<<<<<<<< + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") + * ) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely((PyObject_SetItem(__pyx_v_self->lex_attr_getters, __pyx_t_3, __pyx_t_1) < 0))) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":556 + * if "lookups" not in exclude: + * self.lookups.from_disk(path) + * if "lexeme_norm" in self.lookups: # <<<<<<<<<<<<<< + * self.lex_attr_getters[NORM] = util.add_lookups( + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") +*/ + } + + /* "spacy/vocab.pyx":560 + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") + * ) + * self.length = 0 # <<<<<<<<<<<<<< + * self._by_orth = PreshMap() + * return self +*/ + __pyx_v_self->length = 0; + + /* "spacy/vocab.pyx":561 + * ) + * self.length = 0 + * self._by_orth = PreshMap() # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = NULL; + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_7preshed_4maps_PreshMap, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->_by_orth); + __Pyx_DECREF((PyObject *)__pyx_v_self->_by_orth); + __pyx_v_self->_by_orth = ((struct __pyx_obj_7preshed_4maps_PreshMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":562 + * self.length = 0 + * self._by_orth = PreshMap() + * return self # <<<<<<<<<<<<<< + * + * def to_bytes(self, *, exclude=tuple()): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "spacy/vocab.pyx":538 + * self.lookups.to_disk(path) + * + * def from_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.vocab.Vocab.from_disk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_path); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":564 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_35to_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_34to_bytes, "Vocab.to_bytes(self, *, exclude=tuple())\n\nSerialize the current state to a binary string.\n\nexclude (Iterable[str]): String names of serialization fields to exclude.\nRETURNS (bytes): The serialized form of the `Vocab` object.\n\nDOCS: https://spacy.io/api/vocab#to_bytes"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_35to_bytes = {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_35to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_34to_bytes}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_35to_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_exclude = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_bytes (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_exclude,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 564, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, 0, __pyx_kwds_len, "to_bytes", 0) < (0)) __PYX_ERR(0, 564, __pyx_L3_error) + if (!values[0]) values[0] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__12); + } else if (unlikely(__pyx_nargs != 0)) { + goto __pyx_L5_argtuple_error; + } else { + if (!values[0]) values[0] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__12); + } + __pyx_v_exclude = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_bytes", 1, 0, 0, __pyx_nargs); __PYX_ERR(0, 564, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_34to_bytes(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_exclude); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":572 + * DOCS: https://spacy.io/api/vocab#to_bytes + * """ + * def deserialize_vectors(): # <<<<<<<<<<<<<< + * if self.vectors is None: + * return None +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_8to_bytes_1deserialize_vectors(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_8to_bytes_1deserialize_vectors = {"deserialize_vectors", (PyCFunction)__pyx_pw_5spacy_5vocab_5Vocab_8to_bytes_1deserialize_vectors, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_8to_bytes_1deserialize_vectors(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("deserialize_vectors (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_8to_bytes_deserialize_vectors(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_8to_bytes_deserialize_vectors(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("deserialize_vectors", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spacy/vocab.pyx":573 + * """ + * def deserialize_vectors(): + * if self.vectors is None: # <<<<<<<<<<<<<< + * return None + * else: +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 573, __pyx_L1_error) } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__pyx_t_1 == Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/vocab.pyx":574 + * def deserialize_vectors(): + * if self.vectors is None: + * return None # <<<<<<<<<<<<<< + * else: + * return self.vectors.to_bytes(exclude=["strings"]) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "spacy/vocab.pyx":573 + * """ + * def deserialize_vectors(): + * if self.vectors is None: # <<<<<<<<<<<<<< + * return None + * else: +*/ + } + + /* "spacy/vocab.pyx":576 + * return None + * else: + * return self.vectors.to_bytes(exclude=["strings"]) # <<<<<<<<<<<<<< + * + * getters = { +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 576, __pyx_L1_error) } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_strings); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_strings); + if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_mstate_global->__pyx_n_u_strings) != (0)) __PYX_ERR(0, 576, __pyx_L1_error); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, NULL}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_5, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 576, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + + /* "spacy/vocab.pyx":572 + * DOCS: https://spacy.io/api/vocab#to_bytes + * """ + * def deserialize_vectors(): # <<<<<<<<<<<<<< + * if self.vectors is None: + * return None +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.vocab.Vocab.to_bytes.deserialize_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":579 + * + * getters = { + * "strings": lambda: self.strings.to_bytes(), # <<<<<<<<<<<<<< + * "vectors": deserialize_vectors, + * "lookups": lambda: self.lookups.to_bytes(), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_8to_bytes_2lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_8to_bytes_2lambda = {"lambda", (PyCFunction)__pyx_pw_5spacy_5vocab_5Vocab_8to_bytes_2lambda, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_8to_bytes_2lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 579, __pyx_L1_error) } + __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vocab.Vocab.to_bytes.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":581 + * "strings": lambda: self.strings.to_bytes(), + * "vectors": deserialize_vectors, + * "lookups": lambda: self.lookups.to_bytes(), # <<<<<<<<<<<<<< + * } + * return util.to_bytes(getters, exclude) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_8to_bytes_3lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_8to_bytes_3lambda1 = {"lambda1", (PyCFunction)__pyx_pw_5spacy_5vocab_5Vocab_8to_bytes_3lambda1, METH_NOARGS, 0}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_8to_bytes_3lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda1", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 581, __pyx_L1_error) } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.vocab.Vocab.to_bytes.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":564 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_34to_bytes(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_exclude) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *__pyx_cur_scope; + PyObject *__pyx_v_deserialize_vectors = 0; + PyObject *__pyx_v_getters = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_bytes", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *)__pyx_tp_new_5spacy_5vocab___pyx_scope_struct_2_to_bytes(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 564, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + + /* "spacy/vocab.pyx":572 + * DOCS: https://spacy.io/api/vocab#to_bytes + * """ + * def deserialize_vectors(): # <<<<<<<<<<<<<< + * if self.vectors is None: + * return None +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_8to_bytes_1deserialize_vectors, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_deserialize_vect, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_deserialize_vectors = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":579 + * + * getters = { + * "strings": lambda: self.strings.to_bytes(), # <<<<<<<<<<<<<< + * "vectors": deserialize_vectors, + * "lookups": lambda: self.lookups.to_bytes(), +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_8to_bytes_2lambda, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_strings, __pyx_t_2) < (0)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":580 + * getters = { + * "strings": lambda: self.strings.to_bytes(), + * "vectors": deserialize_vectors, # <<<<<<<<<<<<<< + * "lookups": lambda: self.lookups.to_bytes(), + * } +*/ + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_vectors, __pyx_v_deserialize_vectors) < (0)) __PYX_ERR(0, 579, __pyx_L1_error) + + /* "spacy/vocab.pyx":581 + * "strings": lambda: self.strings.to_bytes(), + * "vectors": deserialize_vectors, + * "lookups": lambda: self.lookups.to_bytes(), # <<<<<<<<<<<<<< + * } + * return util.to_bytes(getters, exclude) +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_8to_bytes_3lambda1, 0, __pyx_mstate_global->__pyx_n_u_to_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_lookups, __pyx_t_2) < (0)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_getters = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":583 + * "lookups": lambda: self.lookups.to_bytes(), + * } + * return util.to_bytes(getters, exclude) # <<<<<<<<<<<<<< + * + * def from_bytes(self, bytes_data, *, exclude=tuple()): +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_to_bytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_getters, __pyx_v_exclude}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "spacy/vocab.pyx":564 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.vocab.Vocab.to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_deserialize_vectors); + __Pyx_XDECREF(__pyx_v_getters); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":585 + * return util.to_bytes(getters, exclude) + * + * def from_bytes(self, bytes_data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_37from_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_36from_bytes, "Vocab.from_bytes(self, bytes_data, *, exclude=tuple())\n\nLoad state from a binary string.\n\nbytes_data (bytes): The data to load from.\nexclude (Iterable[str]): String names of serialization fields to exclude.\nRETURNS (Vocab): The `Vocab` object.\n\nDOCS: https://spacy.io/api/vocab#from_bytes"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_37from_bytes = {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_37from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_36from_bytes}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_37from_bytes(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_bytes_data = 0; + PyObject *__pyx_v_exclude = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("from_bytes (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_bytes_data,&__pyx_mstate_global->__pyx_n_u_exclude,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 585, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 585, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "from_bytes", 0) < (0)) __PYX_ERR(0, 585, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__13); + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_bytes", 1, 1, 1, i); __PYX_ERR(0, 585, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 585, __pyx_L3_error) + if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__13); + } + __pyx_v_bytes_data = values[0]; + __pyx_v_exclude = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_bytes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 585, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_36from_bytes(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_bytes_data, __pyx_v_exclude); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":594 + * DOCS: https://spacy.io/api/vocab#from_bytes + * """ + * def serialize_vectors(b): # <<<<<<<<<<<<<< + * if self.vectors is None: + * return None +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_10from_bytes_1serialize_vectors(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_10from_bytes_1serialize_vectors = {"serialize_vectors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_10from_bytes_1serialize_vectors, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_10from_bytes_1serialize_vectors(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("serialize_vectors (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 594, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 594, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "serialize_vectors", 0) < (0)) __PYX_ERR(0, 594, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("serialize_vectors", 1, 1, 1, i); __PYX_ERR(0, 594, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 594, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("serialize_vectors", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 594, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.from_bytes.serialize_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_10from_bytes_serialize_vectors(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_10from_bytes_serialize_vectors(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("serialize_vectors", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + + /* "spacy/vocab.pyx":595 + * """ + * def serialize_vectors(b): + * if self.vectors is None: # <<<<<<<<<<<<<< + * return None + * else: +*/ + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 595, __pyx_L1_error) } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__pyx_t_1 == Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "spacy/vocab.pyx":596 + * def serialize_vectors(b): + * if self.vectors is None: + * return None # <<<<<<<<<<<<<< + * else: + * return self.vectors.from_bytes(b, exclude=["strings"]) +*/ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "spacy/vocab.pyx":595 + * """ + * def serialize_vectors(b): + * if self.vectors is None: # <<<<<<<<<<<<<< + * return None + * else: +*/ + } + + /* "spacy/vocab.pyx":598 + * return None + * else: + * return self.vectors.from_bytes(b, exclude=["strings"]) # <<<<<<<<<<<<<< + * + * setters = { +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 598, __pyx_L1_error) } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_strings); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_strings); + if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_mstate_global->__pyx_n_u_strings) != (0)) __PYX_ERR(0, 598, __pyx_L1_error); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_v_b}; + __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_5, __pyx_t_7, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 598, __pyx_L1_error) + __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + + /* "spacy/vocab.pyx":594 + * DOCS: https://spacy.io/api/vocab#from_bytes + * """ + * def serialize_vectors(b): # <<<<<<<<<<<<<< + * if self.vectors is None: + * return None +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("spacy.vocab.Vocab.from_bytes.serialize_vectors", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":601 + * + * setters = { + * "strings": lambda b: self.strings.from_bytes(b), # <<<<<<<<<<<<<< + * "vectors": lambda b: serialize_vectors(b), + * "lookups": lambda b: self.lookups.from_bytes(b), +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_10from_bytes_2lambda2(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_10from_bytes_2lambda2 = {"lambda2", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_10from_bytes_2lambda2, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_10from_bytes_2lambda2(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 601, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 601, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda2", 0) < (0)) __PYX_ERR(0, 601, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda2", 1, 1, 1, i); __PYX_ERR(0, 601, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 601, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda2", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 601, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.from_bytes.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda2", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 601, __pyx_L1_error) } + __pyx_t_2 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->strings); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_b}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("spacy.vocab.Vocab.from_bytes.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":602 + * setters = { + * "strings": lambda b: self.strings.from_bytes(b), + * "vectors": lambda b: serialize_vectors(b), # <<<<<<<<<<<<<< + * "lookups": lambda b: self.lookups.from_bytes(b), + * } +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_10from_bytes_3lambda3(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_10from_bytes_3lambda3 = {"lambda3", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_10from_bytes_3lambda3, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_10from_bytes_3lambda3(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 602, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 602, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda3", 0) < (0)) __PYX_ERR(0, 602, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda3", 1, 1, 1, i); __PYX_ERR(0, 602, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 602, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda3", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 602, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.from_bytes.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda3", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_serialize_vectors)) { __Pyx_RaiseClosureNameError("serialize_vectors"); __PYX_ERR(0, 602, __pyx_L1_error) } + __pyx_t_1 = __pyx_pf_5spacy_5vocab_5Vocab_10from_bytes_serialize_vectors(__pyx_cur_scope->__pyx_v_serialize_vectors, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vocab.Vocab.from_bytes.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":603 + * "strings": lambda b: self.strings.from_bytes(b), + * "vectors": lambda b: serialize_vectors(b), + * "lookups": lambda b: self.lookups.from_bytes(b), # <<<<<<<<<<<<<< + * } + * util.from_bytes(bytes_data, setters, exclude) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_10from_bytes_4lambda4(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_10from_bytes_4lambda4 = {"lambda4", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_10from_bytes_4lambda4, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_10from_bytes_4lambda4(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_b = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda4 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_b,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 603, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 603, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda4", 0) < (0)) __PYX_ERR(0, 603, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda4", 1, 1, 1, i); __PYX_ERR(0, 603, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 603, __pyx_L3_error) + } + __pyx_v_b = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda4", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 603, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.from_bytes.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda4(__pyx_self, __pyx_v_b); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda4(PyObject *__pyx_self, PyObject *__pyx_v_b) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *__pyx_cur_scope; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda4", 0); + __pyx_outer_scope = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 603, __pyx_L1_error) } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_b}; + __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.vocab.Vocab.from_bytes.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":585 + * return util.to_bytes(getters, exclude) + * + * def from_bytes(self, bytes_data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_36from_bytes(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_bytes_data, PyObject *__pyx_v_exclude) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *__pyx_cur_scope; + PyObject *__pyx_v_setters = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_bytes", 0); + __pyx_cur_scope = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *)__pyx_tp_new_5spacy_5vocab___pyx_scope_struct_3_from_bytes(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __pyx_cur_scope = ((struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *)Py_None); + __Pyx_INCREF(Py_None); + __PYX_ERR(0, 585, __pyx_L1_error) + } else { + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); + } + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + + /* "spacy/vocab.pyx":594 + * DOCS: https://spacy.io/api/vocab#from_bytes + * """ + * def serialize_vectors(b): # <<<<<<<<<<<<<< + * if self.vectors is None: + * return None +*/ + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_10from_bytes_1serialize_vectors, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_serialize_vect, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_serialize_vectors = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":601 + * + * setters = { + * "strings": lambda b: self.strings.from_bytes(b), # <<<<<<<<<<<<<< + * "vectors": lambda b: serialize_vectors(b), + * "lookups": lambda b: self.lookups.from_bytes(b), +*/ + __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_10from_bytes_2lambda2, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_strings, __pyx_t_2) < (0)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":602 + * setters = { + * "strings": lambda b: self.strings.from_bytes(b), + * "vectors": lambda b: serialize_vectors(b), # <<<<<<<<<<<<<< + * "lookups": lambda b: self.lookups.from_bytes(b), + * } +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_10from_bytes_3lambda3, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_vectors, __pyx_t_2) < (0)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":603 + * "strings": lambda b: self.strings.from_bytes(b), + * "vectors": lambda b: serialize_vectors(b), + * "lookups": lambda b: self.lookups.from_bytes(b), # <<<<<<<<<<<<<< + * } + * util.from_bytes(bytes_data, setters, exclude) +*/ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_10from_bytes_4lambda4, 0, __pyx_mstate_global->__pyx_n_u_from_bytes_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_lookups, __pyx_t_2) < (0)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_setters = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":605 + * "lookups": lambda b: self.lookups.from_bytes(b), + * } + * util.from_bytes(bytes_data, setters, exclude) # <<<<<<<<<<<<<< + * if "lexeme_norm" in self.lookups: + * self.lex_attr_getters[NORM] = util.add_lookups( +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_from_bytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_bytes_data, __pyx_v_setters, __pyx_v_exclude}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":606 + * } + * util.from_bytes(bytes_data, setters, exclude) + * if "lexeme_norm" in self.lookups: # <<<<<<<<<<<<<< + * self.lex_attr_getters[NORM] = util.add_lookups( + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_n_u_lexeme_norm, __pyx_t_1, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 606, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + + /* "spacy/vocab.pyx":607 + * util.from_bytes(bytes_data, setters, exclude) + * if "lexeme_norm" in self.lookups: + * self.lex_attr_getters[NORM] = util.add_lookups( # <<<<<<<<<<<<<< + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") + * ) +*/ + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_util); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_add_lookups); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "spacy/vocab.pyx":608 + * if "lexeme_norm" in self.lookups: + * self.lex_attr_getters[NORM] = util.add_lookups( + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") # <<<<<<<<<<<<<< + * ) + * self.length = 0 +*/ + __pyx_t_7 = __pyx_cur_scope->__pyx_v_self->lex_attr_getters; + __Pyx_INCREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_LEX_ATTRS); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_8, __pyx_t_11}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __pyx_t_7; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_n_u_lexeme_norm}; + __pyx_t_11 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_get_table, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + } + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + assert(__pyx_t_4); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_2, __pyx_t_11}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + + /* "spacy/vocab.pyx":607 + * util.from_bytes(bytes_data, setters, exclude) + * if "lexeme_norm" in self.lookups: + * self.lex_attr_getters[NORM] = util.add_lookups( # <<<<<<<<<<<<<< + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") + * ) +*/ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_NORM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely((PyObject_SetItem(__pyx_cur_scope->__pyx_v_self->lex_attr_getters, __pyx_t_3, __pyx_t_1) < 0))) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":606 + * } + * util.from_bytes(bytes_data, setters, exclude) + * if "lexeme_norm" in self.lookups: # <<<<<<<<<<<<<< + * self.lex_attr_getters[NORM] = util.add_lookups( + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") +*/ + } + + /* "spacy/vocab.pyx":610 + * self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") + * ) + * self.length = 0 # <<<<<<<<<<<<<< + * self._by_orth = PreshMap() + * return self +*/ + __pyx_cur_scope->__pyx_v_self->length = 0; + + /* "spacy/vocab.pyx":611 + * ) + * self.length = 0 + * self._by_orth = PreshMap() # <<<<<<<<<<<<<< + * return self + * +*/ + __pyx_t_3 = NULL; + __pyx_t_5 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_7preshed_4maps_PreshMap, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __Pyx_GIVEREF((PyObject *)__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_cur_scope->__pyx_v_self->_by_orth); + __Pyx_DECREF((PyObject *)__pyx_cur_scope->__pyx_v_self->_by_orth); + __pyx_cur_scope->__pyx_v_self->_by_orth = ((struct __pyx_obj_7preshed_4maps_PreshMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":612 + * self.length = 0 + * self._by_orth = PreshMap() + * return self # <<<<<<<<<<<<<< + * + * def _reset_cache(self, keys, strings): +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_self); + goto __pyx_L0; + + /* "spacy/vocab.pyx":585 + * return util.to_bytes(getters, exclude) + * + * def from_bytes(self, bytes_data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("spacy.vocab.Vocab.from_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_setters); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":614 + * return self + * + * def _reset_cache(self, keys, strings): # <<<<<<<<<<<<<< + * # I'm not sure this made sense. Disable it for now. + * raise NotImplementedError +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_39_reset_cache(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_38_reset_cache, "Vocab._reset_cache(self, keys, strings)"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_39_reset_cache = {"_reset_cache", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_39_reset_cache, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_38_reset_cache}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_39_reset_cache(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v_keys = 0; + CYTHON_UNUSED PyObject *__pyx_v_strings = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_reset_cache (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_keys,&__pyx_mstate_global->__pyx_n_u_strings,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 614, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 614, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 614, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_reset_cache", 0) < (0)) __PYX_ERR(0, 614, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_reset_cache", 1, 2, 2, i); __PYX_ERR(0, 614, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 614, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 614, __pyx_L3_error) + } + __pyx_v_keys = values[0]; + __pyx_v_strings = values[1]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_reset_cache", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 614, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab._reset_cache", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_38_reset_cache(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v_keys, __pyx_v_strings); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_38_reset_cache(CYTHON_UNUSED struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_keys, CYTHON_UNUSED PyObject *__pyx_v_strings) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_reset_cache", 0); + + /* "spacy/vocab.pyx":616 + * def _reset_cache(self, keys, strings): + * # I'm not sure this made sense. Disable it for now. + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_NotImplementedError))), 0, 0, 0); + __PYX_ERR(0, 616, __pyx_L1_error) + + /* "spacy/vocab.pyx":614 + * return self + * + * def _reset_cache(self, keys, strings): # <<<<<<<<<<<<<< + * # I'm not sure this made sense. Disable it for now. + * raise NotImplementedError +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("spacy.vocab.Vocab._reset_cache", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pxd":28 + * cdef class Vocab: + * cdef Pool mem + * cdef readonly StringStore strings # <<<<<<<<<<<<<< + * cdef public Morphology morphology + * cdef public object _vectors +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_7strings_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_7strings_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_7strings___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_7strings___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self->strings); + __pyx_r = ((PyObject *)__pyx_v_self->strings); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pxd":29 + * cdef Pool mem + * cdef readonly StringStore strings + * cdef public Morphology morphology # <<<<<<<<<<<<<< + * cdef public object _vectors + * cdef public object _lookups +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_10morphology_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_10morphology_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_10morphology___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_10morphology___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self->morphology); + __pyx_r = ((PyObject *)__pyx_v_self->morphology); + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_10morphology_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_10morphology_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_10morphology_2__set__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_10morphology_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __pyx_v_value; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology))))) __PYX_ERR(5, 29, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_self->morphology); + __Pyx_DECREF((PyObject *)__pyx_v_self->morphology); + __pyx_v_self->morphology = ((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_t_1); + __pyx_t_1 = 0; + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vocab.Vocab.morphology.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_10morphology_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_10morphology_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_10morphology_4__del__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_10morphology_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF((PyObject *)__pyx_v_self->morphology); + __Pyx_DECREF((PyObject *)__pyx_v_self->morphology); + __pyx_v_self->morphology = ((struct __pyx_obj_5spacy_10morphology_Morphology *)Py_None); + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pxd":30 + * cdef readonly StringStore strings + * cdef public Morphology morphology + * cdef public object _vectors # <<<<<<<<<<<<<< + * cdef public object _lookups + * cdef public object writing_system +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_8_vectors_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_8_vectors_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_8_vectors___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_8_vectors___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_vectors); + __pyx_r = __pyx_v_self->_vectors; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_8_vectors_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_8_vectors_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_8_vectors_2__set__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_8_vectors_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->_vectors); + __Pyx_DECREF(__pyx_v_self->_vectors); + __pyx_v_self->_vectors = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_8_vectors_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_8_vectors_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_8_vectors_4__del__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_8_vectors_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_vectors); + __Pyx_DECREF(__pyx_v_self->_vectors); + __pyx_v_self->_vectors = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pxd":31 + * cdef public Morphology morphology + * cdef public object _vectors + * cdef public object _lookups # <<<<<<<<<<<<<< + * cdef public object writing_system + * cdef public object get_noun_chunks +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_8_lookups_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_8_lookups_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_8_lookups___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_8_lookups___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_lookups); + __pyx_r = __pyx_v_self->_lookups; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_8_lookups_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_8_lookups_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_8_lookups_2__set__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_8_lookups_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->_lookups); + __Pyx_DECREF(__pyx_v_self->_lookups); + __pyx_v_self->_lookups = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_8_lookups_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_8_lookups_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_8_lookups_4__del__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_8_lookups_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_lookups); + __Pyx_DECREF(__pyx_v_self->_lookups); + __pyx_v_self->_lookups = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pxd":32 + * cdef public object _vectors + * cdef public object _lookups + * cdef public object writing_system # <<<<<<<<<<<<<< + * cdef public object get_noun_chunks + * cdef readonly int length +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_14writing_system_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_14writing_system_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_14writing_system___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_14writing_system___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->writing_system); + __pyx_r = __pyx_v_self->writing_system; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_14writing_system_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_14writing_system_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_14writing_system_2__set__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_14writing_system_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->writing_system); + __Pyx_DECREF(__pyx_v_self->writing_system); + __pyx_v_self->writing_system = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_14writing_system_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_14writing_system_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_14writing_system_4__del__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_14writing_system_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->writing_system); + __Pyx_DECREF(__pyx_v_self->writing_system); + __pyx_v_self->writing_system = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pxd":33 + * cdef public object _lookups + * cdef public object writing_system + * cdef public object get_noun_chunks # <<<<<<<<<<<<<< + * cdef readonly int length + * cdef public object _unused_object # TODO remove in v4, see #9150 +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_15get_noun_chunks_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_15get_noun_chunks_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_15get_noun_chunks___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_15get_noun_chunks___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->get_noun_chunks); + __pyx_r = __pyx_v_self->get_noun_chunks; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_15get_noun_chunks_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_15get_noun_chunks_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_15get_noun_chunks_2__set__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_15get_noun_chunks_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->get_noun_chunks); + __Pyx_DECREF(__pyx_v_self->get_noun_chunks); + __pyx_v_self->get_noun_chunks = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_15get_noun_chunks_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_15get_noun_chunks_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_15get_noun_chunks_4__del__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_15get_noun_chunks_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->get_noun_chunks); + __Pyx_DECREF(__pyx_v_self->get_noun_chunks); + __pyx_v_self->get_noun_chunks = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pxd":34 + * cdef public object writing_system + * cdef public object get_noun_chunks + * cdef readonly int length # <<<<<<<<<<<<<< + * cdef public object _unused_object # TODO remove in v4, see #9150 + * cdef public object lex_attr_getters +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_6length_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_6length_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_6length___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_6length___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->length); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vocab.Vocab.length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pxd":35 + * cdef public object get_noun_chunks + * cdef readonly int length + * cdef public object _unused_object # TODO remove in v4, see #9150 # <<<<<<<<<<<<<< + * cdef public object lex_attr_getters + * cdef public object cfg +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_14_unused_object_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_14_unused_object_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_14_unused_object___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_14_unused_object___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_unused_object); + __pyx_r = __pyx_v_self->_unused_object; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_14_unused_object_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_14_unused_object_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_14_unused_object_2__set__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_14_unused_object_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->_unused_object); + __Pyx_DECREF(__pyx_v_self->_unused_object); + __pyx_v_self->_unused_object = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_14_unused_object_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_14_unused_object_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_14_unused_object_4__del__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_14_unused_object_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_unused_object); + __Pyx_DECREF(__pyx_v_self->_unused_object); + __pyx_v_self->_unused_object = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pxd":36 + * cdef readonly int length + * cdef public object _unused_object # TODO remove in v4, see #9150 + * cdef public object lex_attr_getters # <<<<<<<<<<<<<< + * cdef public object cfg + * +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_16lex_attr_getters_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_16lex_attr_getters_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_16lex_attr_getters___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_16lex_attr_getters___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->lex_attr_getters); + __pyx_r = __pyx_v_self->lex_attr_getters; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_16lex_attr_getters_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_16lex_attr_getters_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_16lex_attr_getters_2__set__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_16lex_attr_getters_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->lex_attr_getters); + __Pyx_DECREF(__pyx_v_self->lex_attr_getters); + __pyx_v_self->lex_attr_getters = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_16lex_attr_getters_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_16lex_attr_getters_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_16lex_attr_getters_4__del__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_16lex_attr_getters_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->lex_attr_getters); + __Pyx_DECREF(__pyx_v_self->lex_attr_getters); + __pyx_v_self->lex_attr_getters = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pxd":37 + * cdef public object _unused_object # TODO remove in v4, see #9150 + * cdef public object lex_attr_getters + * cdef public object cfg # <<<<<<<<<<<<<< + * + * cdef const LexemeC* get(self, Pool mem, str string) except NULL +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_3cfg_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_3cfg_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_3cfg___get__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_3cfg___get__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->cfg); + __pyx_r = __pyx_v_self->cfg; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_3cfg_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_3cfg_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_3cfg_2__set__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_3cfg_2__set__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->cfg); + __Pyx_DECREF(__pyx_v_self->cfg); + __pyx_v_self->cfg = __pyx_v_value; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5spacy_5vocab_5Vocab_3cfg_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5spacy_5vocab_5Vocab_3cfg_5__del__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_3cfg_4__del__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5spacy_5vocab_5Vocab_3cfg_4__del__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->cfg); + __Pyx_DECREF(__pyx_v_self->cfg); + __pyx_v_self->cfg = Py_None; + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_41__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_40__reduce_cython__, "Vocab.__reduce_cython__(self)"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_41__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_41__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_40__reduce_cython__}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_41__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } + const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len < 0)) return NULL; + if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_40__reduce_cython__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_40__reduce_cython__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self._by_orth, self._lookups, self._non_temp_mem, self._transient_orths, self._unused_object, self._vectors, self.cfg, self.get_noun_chunks, self.length, self.lex_attr_getters, self.mem, self.morphology, self.strings, self.writing_system) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: +*/ + __pyx_t_1 = __pyx_convert_vector_to_py___pyx_t_5spacy_8typedefs_attr_t(__pyx_v_self->_transient_orths); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_self->length); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(14); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF((PyObject *)__pyx_v_self->_by_orth); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->_by_orth); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->_by_orth)) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->_lookups); + __Pyx_GIVEREF(__pyx_v_self->_lookups); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self->_lookups) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_self->_non_temp_mem); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->_non_temp_mem); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_self->_non_temp_mem)) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_1) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->_unused_object); + __Pyx_GIVEREF(__pyx_v_self->_unused_object); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_self->_unused_object) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->_vectors); + __Pyx_GIVEREF(__pyx_v_self->_vectors); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_v_self->_vectors) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->cfg); + __Pyx_GIVEREF(__pyx_v_self->cfg); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 6, __pyx_v_self->cfg) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->get_noun_chunks); + __Pyx_GIVEREF(__pyx_v_self->get_noun_chunks); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 7, __pyx_v_self->get_noun_chunks) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 8, __pyx_t_2) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->lex_attr_getters); + __Pyx_GIVEREF(__pyx_v_self->lex_attr_getters); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 9, __pyx_v_self->lex_attr_getters) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_self->mem); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->mem); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 10, ((PyObject *)__pyx_v_self->mem)) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_self->morphology); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->morphology); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 11, ((PyObject *)__pyx_v_self->morphology)) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_self->strings); + __Pyx_GIVEREF((PyObject *)__pyx_v_self->strings); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 12, ((PyObject *)__pyx_v_self->strings)) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_self->writing_system); + __Pyx_GIVEREF(__pyx_v_self->writing_system); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 13, __pyx_v_self->writing_system) != (0)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_v_state = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self._by_orth, self._lookups, self._non_temp_mem, self._transient_orths, self._unused_object, self._vectors, self.cfg, self.get_noun_chunks, self.length, self.lex_attr_getters, self.mem, self.morphology, self.strings, self.writing_system) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None and _dict: + * state += (_dict,) +*/ + __pyx_t_3 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_dict, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v__dict = __pyx_t_3; + __pyx_t_3 = 0; + + /* "(tree fragment)":7 + * state = (self._by_orth, self._lookups, self._non_temp_mem, self._transient_orths, self._unused_object, self._vectors, self.cfg, self.get_noun_chunks, self.length, self.lex_attr_getters, self.mem, self.morphology, self.strings, self.writing_system) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + __pyx_t_5 = (__pyx_v__dict != Py_None); + if (__pyx_t_5) { + } else { + __pyx_t_4 = __pyx_t_5; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v__dict); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_4 = __pyx_t_5; + __pyx_L4_bool_binop_done:; + if (__pyx_t_4) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: +*/ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v__dict) != (0)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "(tree fragment)":9 + * if _dict is not None and _dict: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = ('self._by_orth is not None or self._lookups is not None or self._non_temp_mem is not None or self._unused_object is not None or self._vectors is not None or self.cfg is not None or self.get_noun_chunks is not None or self.lex_attr_getters is not None or self.mem is not None or self.morphology is not None or self.strings is not None or self.writing_system is not None',) +*/ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self._by_orth, self._lookups, self._non_temp_mem, self._transient_orths, self._unused_object, self._vectors, self.cfg, self.get_noun_chunks, self.length, self.lex_attr_getters, self.mem, self.morphology, self.strings, self.writing_system) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None and _dict: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True +*/ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self._by_orth is not None or self._lookups is not None or self._non_temp_mem is not None or self._unused_object is not None or self._vectors is not None or self.cfg is not None or self.get_noun_chunks is not None or self.lex_attr_getters is not None or self.mem is not None or self.morphology is not None or self.strings is not None or self.writing_system is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Vocab, (type(self), 0x25af36a, None), state +*/ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_mstate_global->__pyx_tuple[3]); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 11, __pyx_L1_error) + __pyx_v_use_setstate = __pyx_t_4; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self._by_orth is not None or self._lookups is not None or self._non_temp_mem is not None or self._unused_object is not None or self._vectors is not None or self.cfg is not None or self.get_noun_chunks is not None or self.lex_attr_getters is not None or self.mem is not None or self.morphology is not None or self.strings is not None or self.writing_system is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Vocab, (type(self), 0x25af36a, None), state + * else: +*/ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = ('self._by_orth is not None or self._lookups is not None or self._non_temp_mem is not None or self._unused_object is not None or self._vectors is not None or self.cfg is not None or self.get_noun_chunks is not None or self.lex_attr_getters is not None or self.mem is not None or self.morphology is not None or self.strings is not None or self.writing_system is not None',) + * if use_setstate: + * return __pyx_unpickle_Vocab, (type(self), 0x25af36a, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Vocab, (type(self), 0x25af36a, state) +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Vocab); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_39514986); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_39514986); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_39514986) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = ('self._by_orth is not None or self._lookups is not None or self._non_temp_mem is not None or self._unused_object is not None or self._vectors is not None or self.cfg is not None or self.get_noun_chunks is not None or self.lex_attr_getters is not None or self.mem is not None or self.morphology is not None or self.strings is not None or self.writing_system is not None',) + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Vocab, (type(self), 0x25af36a, None), state + * else: +*/ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Vocab, (type(self), 0x25af36a, None), state + * else: + * return __pyx_unpickle_Vocab, (type(self), 0x25af36a, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Vocab__set_state(self, __pyx_state) +*/ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Vocab); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_39514986); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_39514986); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_39514986) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.vocab.Vocab.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Vocab, (type(self), 0x25af36a, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Vocab__set_state(self, __pyx_state) +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_43__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_5Vocab_42__setstate_cython__, "Vocab.__setstate_cython__(self, __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5Vocab_43__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_43__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_42__setstate_cython__}; +static PyObject *__pyx_pw_5spacy_5vocab_5Vocab_43__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 16, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 16, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 16, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 16, __pyx_L3_error) + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.Vocab.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_5Vocab_42__setstate_cython__(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_5Vocab_42__setstate_cython__(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Vocab, (type(self), 0x25af36a, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Vocab__set_state(self, __pyx_state) # <<<<<<<<<<<<<< +*/ + __pyx_t_1 = __pyx_f_5spacy_5vocab___pyx_unpickle_Vocab__set_state(__pyx_v_self, __pyx_v___pyx_state); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Vocab, (type(self), 0x25af36a, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Vocab__set_state(self, __pyx_state) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vocab.Vocab.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":619 + * + * + * def pickle_vocab(vocab): # <<<<<<<<<<<<<< + * sstore = vocab.strings + * vectors = vocab.vectors +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_3pickle_vocab(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_2pickle_vocab, "pickle_vocab(vocab)"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_3pickle_vocab = {"pickle_vocab", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_3pickle_vocab, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_2pickle_vocab}; +static PyObject *__pyx_pw_5spacy_5vocab_3pickle_vocab(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_vocab = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pickle_vocab (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_vocab,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 619, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 619, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "pickle_vocab", 0) < (0)) __PYX_ERR(0, 619, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pickle_vocab", 1, 1, 1, i); __PYX_ERR(0, 619, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 619, __pyx_L3_error) + } + __pyx_v_vocab = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("pickle_vocab", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 619, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.pickle_vocab", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_2pickle_vocab(__pyx_self, __pyx_v_vocab); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_2pickle_vocab(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vocab) { + PyObject *__pyx_v_sstore = NULL; + PyObject *__pyx_v_vectors = NULL; + PyObject *__pyx_v_morph = NULL; + PyObject *__pyx_v__unused_object = NULL; + PyObject *__pyx_v_lex_attr_getters = NULL; + PyObject *__pyx_v_lookups = NULL; + PyObject *__pyx_v_get_noun_chunks = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pickle_vocab", 0); + + /* "spacy/vocab.pyx":620 + * + * def pickle_vocab(vocab): + * sstore = vocab.strings # <<<<<<<<<<<<<< + * vectors = vocab.vectors + * morph = vocab.morphology +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_vocab, __pyx_mstate_global->__pyx_n_u_strings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_sstore = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":621 + * def pickle_vocab(vocab): + * sstore = vocab.strings + * vectors = vocab.vectors # <<<<<<<<<<<<<< + * morph = vocab.morphology + * _unused_object = vocab._unused_object +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_vocab, __pyx_mstate_global->__pyx_n_u_vectors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_vectors = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":622 + * sstore = vocab.strings + * vectors = vocab.vectors + * morph = vocab.morphology # <<<<<<<<<<<<<< + * _unused_object = vocab._unused_object + * lex_attr_getters = srsly.pickle_dumps(vocab.lex_attr_getters) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_vocab, __pyx_mstate_global->__pyx_n_u_morphology); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_morph = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":623 + * vectors = vocab.vectors + * morph = vocab.morphology + * _unused_object = vocab._unused_object # <<<<<<<<<<<<<< + * lex_attr_getters = srsly.pickle_dumps(vocab.lex_attr_getters) + * lookups = vocab.lookups +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_vocab, __pyx_mstate_global->__pyx_n_u_unused_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__unused_object = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":624 + * morph = vocab.morphology + * _unused_object = vocab._unused_object + * lex_attr_getters = srsly.pickle_dumps(vocab.lex_attr_getters) # <<<<<<<<<<<<<< + * lookups = vocab.lookups + * get_noun_chunks = vocab.get_noun_chunks +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pickle_dumps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_vocab, __pyx_mstate_global->__pyx_n_u_lex_attr_getters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); + __pyx_t_5 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_v_lex_attr_getters = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":625 + * _unused_object = vocab._unused_object + * lex_attr_getters = srsly.pickle_dumps(vocab.lex_attr_getters) + * lookups = vocab.lookups # <<<<<<<<<<<<<< + * get_noun_chunks = vocab.get_noun_chunks + * return (unpickle_vocab, +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_vocab, __pyx_mstate_global->__pyx_n_u_lookups); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_lookups = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":626 + * lex_attr_getters = srsly.pickle_dumps(vocab.lex_attr_getters) + * lookups = vocab.lookups + * get_noun_chunks = vocab.get_noun_chunks # <<<<<<<<<<<<<< + * return (unpickle_vocab, + * (sstore, vectors, morph, _unused_object, lex_attr_getters, lookups, get_noun_chunks)) +*/ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_vocab, __pyx_mstate_global->__pyx_n_u_get_noun_chunks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_get_noun_chunks = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":627 + * lookups = vocab.lookups + * get_noun_chunks = vocab.get_noun_chunks + * return (unpickle_vocab, # <<<<<<<<<<<<<< + * (sstore, vectors, morph, _unused_object, lex_attr_getters, lookups, get_noun_chunks)) + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_unpickle_vocab); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "spacy/vocab.pyx":628 + * get_noun_chunks = vocab.get_noun_chunks + * return (unpickle_vocab, + * (sstore, vectors, morph, _unused_object, lex_attr_getters, lookups, get_noun_chunks)) # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_4 = PyTuple_New(7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_sstore); + __Pyx_GIVEREF(__pyx_v_sstore); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_sstore) != (0)) __PYX_ERR(0, 628, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_vectors); + __Pyx_GIVEREF(__pyx_v_vectors); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_vectors) != (0)) __PYX_ERR(0, 628, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_morph); + __Pyx_GIVEREF(__pyx_v_morph); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_morph) != (0)) __PYX_ERR(0, 628, __pyx_L1_error); + __Pyx_INCREF(__pyx_v__unused_object); + __Pyx_GIVEREF(__pyx_v__unused_object); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v__unused_object) != (0)) __PYX_ERR(0, 628, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_lex_attr_getters); + __Pyx_GIVEREF(__pyx_v_lex_attr_getters); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_lex_attr_getters) != (0)) __PYX_ERR(0, 628, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_lookups); + __Pyx_GIVEREF(__pyx_v_lookups); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_lookups) != (0)) __PYX_ERR(0, 628, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_get_noun_chunks); + __Pyx_GIVEREF(__pyx_v_get_noun_chunks); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_v_get_noun_chunks) != (0)) __PYX_ERR(0, 628, __pyx_L1_error); + + /* "spacy/vocab.pyx":627 + * lookups = vocab.lookups + * get_noun_chunks = vocab.get_noun_chunks + * return (unpickle_vocab, # <<<<<<<<<<<<<< + * (sstore, vectors, morph, _unused_object, lex_attr_getters, lookups, get_noun_chunks)) + * +*/ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 627, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 627, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 627, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "spacy/vocab.pyx":619 + * + * + * def pickle_vocab(vocab): # <<<<<<<<<<<<<< + * sstore = vocab.strings + * vectors = vocab.vectors +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("spacy.vocab.pickle_vocab", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_sstore); + __Pyx_XDECREF(__pyx_v_vectors); + __Pyx_XDECREF(__pyx_v_morph); + __Pyx_XDECREF(__pyx_v__unused_object); + __Pyx_XDECREF(__pyx_v_lex_attr_getters); + __Pyx_XDECREF(__pyx_v_lookups); + __Pyx_XDECREF(__pyx_v_get_noun_chunks); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "spacy/vocab.pyx":631 + * + * + * def unpickle_vocab(sstore, vectors, morphology, _unused_object, # <<<<<<<<<<<<<< + * lex_attr_getters, lookups, get_noun_chunks): + * cdef Vocab vocab = Vocab() +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_5unpickle_vocab(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_4unpickle_vocab, "unpickle_vocab(sstore, vectors, morphology, _unused_object, lex_attr_getters, lookups, get_noun_chunks)"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_5unpickle_vocab = {"unpickle_vocab", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5unpickle_vocab, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_4unpickle_vocab}; +static PyObject *__pyx_pw_5spacy_5vocab_5unpickle_vocab(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_sstore = 0; + PyObject *__pyx_v_vectors = 0; + PyObject *__pyx_v_morphology = 0; + PyObject *__pyx_v__unused_object = 0; + PyObject *__pyx_v_lex_attr_getters = 0; + PyObject *__pyx_v_lookups = 0; + PyObject *__pyx_v_get_noun_chunks = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unpickle_vocab (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_sstore,&__pyx_mstate_global->__pyx_n_u_vectors,&__pyx_mstate_global->__pyx_n_u_morphology,&__pyx_mstate_global->__pyx_n_u_unused_object,&__pyx_mstate_global->__pyx_n_u_lex_attr_getters,&__pyx_mstate_global->__pyx_n_u_lookups,&__pyx_mstate_global->__pyx_n_u_get_noun_chunks,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 631, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 7: + values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 631, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 6: + values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 631, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 5: + values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 631, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 4: + values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 631, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 631, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 631, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 631, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "unpickle_vocab", 0) < (0)) __PYX_ERR(0, 631, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 7; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("unpickle_vocab", 1, 7, 7, i); __PYX_ERR(0, 631, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 7)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 631, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 631, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 631, __pyx_L3_error) + values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 631, __pyx_L3_error) + values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 631, __pyx_L3_error) + values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 631, __pyx_L3_error) + values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 631, __pyx_L3_error) + } + __pyx_v_sstore = values[0]; + __pyx_v_vectors = values[1]; + __pyx_v_morphology = values[2]; + __pyx_v__unused_object = values[3]; + __pyx_v_lex_attr_getters = values[4]; + __pyx_v_lookups = values[5]; + __pyx_v_get_noun_chunks = values[6]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unpickle_vocab", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 631, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.unpickle_vocab", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5spacy_5vocab_4unpickle_vocab(__pyx_self, __pyx_v_sstore, __pyx_v_vectors, __pyx_v_morphology, __pyx_v__unused_object, __pyx_v_lex_attr_getters, __pyx_v_lookups, __pyx_v_get_noun_chunks); + + /* function exit code */ + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_4unpickle_vocab(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sstore, PyObject *__pyx_v_vectors, PyObject *__pyx_v_morphology, PyObject *__pyx_v__unused_object, PyObject *__pyx_v_lex_attr_getters, PyObject *__pyx_v_lookups, PyObject *__pyx_v_get_noun_chunks) { + struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v_vocab = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + size_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unpickle_vocab", 0); + + /* "spacy/vocab.pyx":633 + * def unpickle_vocab(sstore, vectors, morphology, _unused_object, + * lex_attr_getters, lookups, get_noun_chunks): + * cdef Vocab vocab = Vocab() # <<<<<<<<<<<<<< + * vocab.vectors = vectors + * vocab.strings = sstore +*/ + __pyx_t_2 = NULL; + __pyx_t_3 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_1); + } + __pyx_v_vocab = ((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":634 + * lex_attr_getters, lookups, get_noun_chunks): + * cdef Vocab vocab = Vocab() + * vocab.vectors = vectors # <<<<<<<<<<<<<< + * vocab.strings = sstore + * vocab.morphology = morphology +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_vocab), __pyx_mstate_global->__pyx_n_u_vectors, __pyx_v_vectors) < (0)) __PYX_ERR(0, 634, __pyx_L1_error) + + /* "spacy/vocab.pyx":635 + * cdef Vocab vocab = Vocab() + * vocab.vectors = vectors + * vocab.strings = sstore # <<<<<<<<<<<<<< + * vocab.morphology = morphology + * vocab._unused_object = _unused_object +*/ + __pyx_t_1 = __pyx_v_sstore; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore))))) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_vocab->strings); + __Pyx_DECREF((PyObject *)__pyx_v_vocab->strings); + __pyx_v_vocab->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":636 + * vocab.vectors = vectors + * vocab.strings = sstore + * vocab.morphology = morphology # <<<<<<<<<<<<<< + * vocab._unused_object = _unused_object + * vocab.lex_attr_getters = srsly.pickle_loads(lex_attr_getters) +*/ + __pyx_t_1 = __pyx_v_morphology; + __Pyx_INCREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology))))) __PYX_ERR(0, 636, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v_vocab->morphology); + __Pyx_DECREF((PyObject *)__pyx_v_vocab->morphology); + __pyx_v_vocab->morphology = ((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":637 + * vocab.strings = sstore + * vocab.morphology = morphology + * vocab._unused_object = _unused_object # <<<<<<<<<<<<<< + * vocab.lex_attr_getters = srsly.pickle_loads(lex_attr_getters) + * vocab.lookups = lookups +*/ + __Pyx_INCREF(__pyx_v__unused_object); + __Pyx_GIVEREF(__pyx_v__unused_object); + __Pyx_GOTREF(__pyx_v_vocab->_unused_object); + __Pyx_DECREF(__pyx_v_vocab->_unused_object); + __pyx_v_vocab->_unused_object = __pyx_v__unused_object; + + /* "spacy/vocab.pyx":638 + * vocab.morphology = morphology + * vocab._unused_object = _unused_object + * vocab.lex_attr_getters = srsly.pickle_loads(lex_attr_getters) # <<<<<<<<<<<<<< + * vocab.lookups = lookups + * vocab.get_noun_chunks = get_noun_chunks +*/ + __pyx_t_2 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_srsly); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pickle_loads); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = 1; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); + assert(__pyx_t_2); + PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx__function); + __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); + __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_lex_attr_getters}; + __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_vocab->lex_attr_getters); + __Pyx_DECREF(__pyx_v_vocab->lex_attr_getters); + __pyx_v_vocab->lex_attr_getters = __pyx_t_1; + __pyx_t_1 = 0; + + /* "spacy/vocab.pyx":639 + * vocab._unused_object = _unused_object + * vocab.lex_attr_getters = srsly.pickle_loads(lex_attr_getters) + * vocab.lookups = lookups # <<<<<<<<<<<<<< + * vocab.get_noun_chunks = get_noun_chunks + * return vocab +*/ + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_vocab), __pyx_mstate_global->__pyx_n_u_lookups, __pyx_v_lookups) < (0)) __PYX_ERR(0, 639, __pyx_L1_error) + + /* "spacy/vocab.pyx":640 + * vocab.lex_attr_getters = srsly.pickle_loads(lex_attr_getters) + * vocab.lookups = lookups + * vocab.get_noun_chunks = get_noun_chunks # <<<<<<<<<<<<<< + * return vocab + * +*/ + __Pyx_INCREF(__pyx_v_get_noun_chunks); + __Pyx_GIVEREF(__pyx_v_get_noun_chunks); + __Pyx_GOTREF(__pyx_v_vocab->get_noun_chunks); + __Pyx_DECREF(__pyx_v_vocab->get_noun_chunks); + __pyx_v_vocab->get_noun_chunks = __pyx_v_get_noun_chunks; + + /* "spacy/vocab.pyx":641 + * vocab.lookups = lookups + * vocab.get_noun_chunks = get_noun_chunks + * return vocab # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_vocab); + __pyx_r = ((PyObject *)__pyx_v_vocab); + goto __pyx_L0; + + /* "spacy/vocab.pyx":631 + * + * + * def unpickle_vocab(sstore, vectors, morphology, _unused_object, # <<<<<<<<<<<<<< + * lex_attr_getters, lookups, get_noun_chunks): + * cdef Vocab vocab = Vocab() +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("spacy.vocab.unpickle_vocab", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_vocab); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Vocab(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x25af36a, 0x339b8d5, 0xd74a244, b'_by_orth, _lookups, _non_temp_mem, _transient_orths, _unused_object, _vectors, cfg, get_noun_chunks, length, lex_attr_getters, mem, morphology, strings, writing_system') +*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_5spacy_5vocab_7__pyx_unpickle_Vocab(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_5spacy_5vocab_6__pyx_unpickle_Vocab, "__pyx_unpickle_Vocab(__pyx_type, long __pyx_checksum, tuple __pyx_state)"); +static PyMethodDef __pyx_mdef_5spacy_5vocab_7__pyx_unpickle_Vocab = {"__pyx_unpickle_Vocab", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_7__pyx_unpickle_Vocab, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_6__pyx_unpickle_Vocab}; +static PyObject *__pyx_pw_5spacy_5vocab_7__pyx_unpickle_Vocab(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_Vocab (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_SIZE + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_type,&__pyx_mstate_global->__pyx_n_u_pyx_checksum,&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; + const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; + if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(1, 4, __pyx_L3_error) + if (__pyx_kwds_len > 0) { + switch (__pyx_nargs) { + case 3: + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 2: + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 1: + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error) + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__pyx_unpickle_Vocab", 0) < (0)) __PYX_ERR(1, 4, __pyx_L3_error) + for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { + if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Vocab", 1, 3, 3, i); __PYX_ERR(1, 4, __pyx_L3_error) } + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 4, __pyx_L3_error) + values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(1, 4, __pyx_L3_error) + values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); + if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(1, 4, __pyx_L3_error) + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyLong_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_v___pyx_state = ((PyObject*)values[2]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Vocab", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 4, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __Pyx_AddTraceback("spacy.vocab.__pyx_unpickle_Vocab", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v___pyx_state), (&PyTuple_Type), 1, "__pyx_state", 1))) __PYX_ERR(1, 4, __pyx_L1_error) + __pyx_r = __pyx_pf_5spacy_5vocab_6__pyx_unpickle_Vocab(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + goto __pyx_L7_cleaned_up; + __pyx_L0:; + for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + Py_XDECREF(values[__pyx_temp]); + } + __pyx_L7_cleaned_up:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5spacy_5vocab_6__pyx_unpickle_Vocab(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Vocab", 0); + + /* "(tree fragment)":6 + * def __pyx_unpickle_Vocab(__pyx_type, long __pyx_checksum, tuple __pyx_state): + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x25af36a, 0x339b8d5, 0xd74a244, b'_by_orth, _lookups, _non_temp_mem, _transient_orths, _unused_object, _vectors, cfg, get_noun_chunks, length, lex_attr_getters, mem, morphology, strings, writing_system') # <<<<<<<<<<<<<< + * __pyx_result = Vocab.__new__(__pyx_type) + * if __pyx_state is not None: +*/ + __pyx_t_1 = __Pyx_CheckUnpickleChecksum(__pyx_v___pyx_checksum, 0x25af36a, 0x339b8d5, 0xd74a244, ((char const *)"_by_orth, _lookups, _non_temp_mem, _transient_orths, _unused_object, _vectors, cfg, get_noun_chunks, length, lex_attr_getters, mem, morphology, strings, writing_system")); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":7 + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x25af36a, 0x339b8d5, 0xd74a244, b'_by_orth, _lookups, _non_temp_mem, _transient_orths, _unused_object, _vectors, cfg, get_noun_chunks, length, lex_attr_getters, mem, morphology, strings, writing_system') + * __pyx_result = Vocab.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Vocab__set_state( __pyx_result, __pyx_state) +*/ + __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type}; + __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_new, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_v___pyx_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x25af36a, 0x339b8d5, 0xd74a244, b'_by_orth, _lookups, _non_temp_mem, _transient_orths, _unused_object, _vectors, cfg, get_noun_chunks, length, lex_attr_getters, mem, morphology, strings, writing_system') + * __pyx_result = Vocab.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Vocab__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + __pyx_t_5 = (__pyx_v___pyx_state != ((PyObject*)Py_None)); + if (__pyx_t_5) { + + /* "(tree fragment)":9 + * __pyx_result = Vocab.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Vocab__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Vocab__set_state(Vocab __pyx_result, __pyx_state: tuple): +*/ + __pyx_t_2 = __pyx_f_5spacy_5vocab___pyx_unpickle_Vocab__set_state(((struct __pyx_obj_5spacy_5vocab_Vocab *)__pyx_v___pyx_result), __pyx_v___pyx_state); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":8 + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x25af36a, 0x339b8d5, 0xd74a244, b'_by_orth, _lookups, _non_temp_mem, _transient_orths, _unused_object, _vectors, cfg, get_noun_chunks, length, lex_attr_getters, mem, morphology, strings, writing_system') + * __pyx_result = Vocab.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Vocab__set_state( __pyx_result, __pyx_state) + * return __pyx_result +*/ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Vocab__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Vocab__set_state(Vocab __pyx_result, __pyx_state: tuple): + * __pyx_result._by_orth = __pyx_state[0]; __pyx_result._lookups = __pyx_state[1]; __pyx_result._non_temp_mem = __pyx_state[2]; __pyx_result._transient_orths = __pyx_state[3]; __pyx_result._unused_object = __pyx_state[4]; __pyx_result._vectors = __pyx_state[5]; __pyx_result.cfg = __pyx_state[6]; __pyx_result.get_noun_chunks = __pyx_state[7]; __pyx_result.length = __pyx_state[8]; __pyx_result.lex_attr_getters = __pyx_state[9]; __pyx_result.mem = __pyx_state[10]; __pyx_result.morphology = __pyx_state[11]; __pyx_result.strings = __pyx_state[12]; __pyx_result.writing_system = __pyx_state[13] +*/ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Vocab(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x25af36a, 0x339b8d5, 0xd74a244, b'_by_orth, _lookups, _non_temp_mem, _transient_orths, _unused_object, _vectors, cfg, get_noun_chunks, length, lex_attr_getters, mem, morphology, strings, writing_system') +*/ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("spacy.vocab.__pyx_unpickle_Vocab", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Vocab__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Vocab__set_state(Vocab __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result._by_orth = __pyx_state[0]; __pyx_result._lookups = __pyx_state[1]; __pyx_result._non_temp_mem = __pyx_state[2]; __pyx_result._transient_orths = __pyx_state[3]; __pyx_result._unused_object = __pyx_state[4]; __pyx_result._vectors = __pyx_state[5]; __pyx_result.cfg = __pyx_state[6]; __pyx_result.get_noun_chunks = __pyx_state[7]; __pyx_result.length = __pyx_state[8]; __pyx_result.lex_attr_getters = __pyx_state[9]; __pyx_result.mem = __pyx_state[10]; __pyx_result.morphology = __pyx_state[11]; __pyx_result.strings = __pyx_state[12]; __pyx_result.writing_system = __pyx_state[13] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 14) +*/ + +static PyObject *__pyx_f_5spacy_5vocab___pyx_unpickle_Vocab__set_state(struct __pyx_obj_5spacy_5vocab_Vocab *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + std::vector<__pyx_t_5spacy_8typedefs_attr_t> __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Vocab__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Vocab__set_state(Vocab __pyx_result, __pyx_state: tuple): + * __pyx_result._by_orth = __pyx_state[0]; __pyx_result._lookups = __pyx_state[1]; __pyx_result._non_temp_mem = __pyx_state[2]; __pyx_result._transient_orths = __pyx_state[3]; __pyx_result._unused_object = __pyx_state[4]; __pyx_result._vectors = __pyx_state[5]; __pyx_result.cfg = __pyx_state[6]; __pyx_result.get_noun_chunks = __pyx_state[7]; __pyx_result.length = __pyx_state[8]; __pyx_result.lex_attr_getters = __pyx_state[9]; __pyx_result.mem = __pyx_state[10]; __pyx_result.morphology = __pyx_state[11]; __pyx_result.strings = __pyx_state[12]; __pyx_result.writing_system = __pyx_state[13] # <<<<<<<<<<<<<< + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 14) +*/ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_7preshed_4maps_PreshMap))))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->_by_orth); + __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->_by_orth); + __pyx_v___pyx_result->_by_orth = ((struct __pyx_obj_7preshed_4maps_PreshMap *)__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->_lookups); + __Pyx_DECREF(__pyx_v___pyx_result->_lookups); + __pyx_v___pyx_result->_lookups = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool))))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->_non_temp_mem); + __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->_non_temp_mem); + __pyx_v___pyx_result->_non_temp_mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_convert_vector_from_py___pyx_t_5spacy_8typedefs_attr_t(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v___pyx_result->_transient_orths = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_2); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->_unused_object); + __Pyx_DECREF(__pyx_v___pyx_result->_unused_object); + __pyx_v___pyx_result->_unused_object = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 5, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->_vectors); + __Pyx_DECREF(__pyx_v___pyx_result->_vectors); + __pyx_v___pyx_result->_vectors = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 6, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->cfg); + __Pyx_DECREF(__pyx_v___pyx_result->cfg); + __pyx_v___pyx_result->cfg = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 7, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->get_noun_chunks); + __Pyx_DECREF(__pyx_v___pyx_result->get_noun_chunks); + __pyx_v___pyx_result->get_noun_chunks = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 8, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v___pyx_result->length = __pyx_t_3; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 9, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->lex_attr_getters); + __Pyx_DECREF(__pyx_v___pyx_result->lex_attr_getters); + __pyx_v___pyx_result->lex_attr_getters = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 10, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5cymem_5cymem_Pool))))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->mem); + __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->mem); + __pyx_v___pyx_result->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 11, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_10morphology_Morphology))))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->morphology); + __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->morphology); + __pyx_v___pyx_result->morphology = ((struct __pyx_obj_5spacy_10morphology_Morphology *)__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 12, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5spacy_7strings_StringStore))))) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->strings); + __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->strings); + __pyx_v___pyx_result->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v___pyx_state, 13, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->writing_system); + __Pyx_DECREF(__pyx_v___pyx_result->writing_system); + __pyx_v___pyx_result->writing_system = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Vocab__set_state(Vocab __pyx_result, __pyx_state: tuple): + * __pyx_result._by_orth = __pyx_state[0]; __pyx_result._lookups = __pyx_state[1]; __pyx_result._non_temp_mem = __pyx_state[2]; __pyx_result._transient_orths = __pyx_state[3]; __pyx_result._unused_object = __pyx_state[4]; __pyx_result._vectors = __pyx_state[5]; __pyx_result.cfg = __pyx_state[6]; __pyx_result.get_noun_chunks = __pyx_state[7]; __pyx_result.length = __pyx_state[8]; __pyx_result.lex_attr_getters = __pyx_state[9]; __pyx_result.mem = __pyx_state[10]; __pyx_result.morphology = __pyx_state[11]; __pyx_result.strings = __pyx_state[12]; __pyx_result.writing_system = __pyx_state[13] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 14) # <<<<<<<<<<<<<< +*/ + __pyx_t_3 = __Pyx_UpdateUnpickledDict(((PyObject *)__pyx_v___pyx_result), __pyx_v___pyx_state, 14); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + + /* "(tree fragment)":11 + * __pyx_unpickle_Vocab__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Vocab__set_state(Vocab __pyx_result, __pyx_state: tuple): # <<<<<<<<<<<<<< + * __pyx_result._by_orth = __pyx_state[0]; __pyx_result._lookups = __pyx_state[1]; __pyx_result._non_temp_mem = __pyx_state[2]; __pyx_result._transient_orths = __pyx_state[3]; __pyx_result._unused_object = __pyx_state[4]; __pyx_result._vectors = __pyx_state[5]; __pyx_result.cfg = __pyx_state[6]; __pyx_result.get_noun_chunks = __pyx_state[7]; __pyx_result.length = __pyx_state[8]; __pyx_result.lex_attr_getters = __pyx_state[9]; __pyx_result.mem = __pyx_state[10]; __pyx_result.morphology = __pyx_state[11]; __pyx_result.strings = __pyx_state[12]; __pyx_result.writing_system = __pyx_state[13] + * __Pyx_UpdateUnpickledDict(__pyx_result, __pyx_state, 14) +*/ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("spacy.vocab.__pyx_unpickle_Vocab__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +/* #### Code section: module_exttypes ### */ +static struct __pyx_vtabstruct_5spacy_5vocab_Vocab __pyx_vtable_5spacy_5vocab_Vocab; + +static PyObject *__pyx_tp_new_5spacy_5vocab_Vocab(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5spacy_5vocab_Vocab *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5spacy_5vocab_Vocab *)o); + p->__pyx_vtab = __pyx_vtabptr_5spacy_5vocab_Vocab; + __Pyx_default_placement_construct(&(p->_transient_orths)); + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + p->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)Py_None); Py_INCREF(Py_None); + p->morphology = ((struct __pyx_obj_5spacy_10morphology_Morphology *)Py_None); Py_INCREF(Py_None); + p->_vectors = Py_None; Py_INCREF(Py_None); + p->_lookups = Py_None; Py_INCREF(Py_None); + p->writing_system = Py_None; Py_INCREF(Py_None); + p->get_noun_chunks = Py_None; Py_INCREF(Py_None); + p->_unused_object = Py_None; Py_INCREF(Py_None); + p->lex_attr_getters = Py_None; Py_INCREF(Py_None); + p->cfg = Py_None; Py_INCREF(Py_None); + p->_by_orth = ((struct __pyx_obj_7preshed_4maps_PreshMap *)Py_None); Py_INCREF(Py_None); + p->_non_temp_mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_5spacy_5vocab_Vocab(PyObject *o) { + struct __pyx_obj_5spacy_5vocab_Vocab *p = (struct __pyx_obj_5spacy_5vocab_Vocab *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_5vocab_Vocab) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + __Pyx_call_destructor(p->_transient_orths); + Py_CLEAR(p->mem); + Py_CLEAR(p->strings); + Py_CLEAR(p->morphology); + Py_CLEAR(p->_vectors); + Py_CLEAR(p->_lookups); + Py_CLEAR(p->writing_system); + Py_CLEAR(p->get_noun_chunks); + Py_CLEAR(p->_unused_object); + Py_CLEAR(p->lex_attr_getters); + Py_CLEAR(p->cfg); + Py_CLEAR(p->_by_orth); + Py_CLEAR(p->_non_temp_mem); + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static int __pyx_tp_traverse_5spacy_5vocab_Vocab(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_5vocab_Vocab *p = (struct __pyx_obj_5spacy_5vocab_Vocab *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->mem) { + e = (*v)(((PyObject *)p->mem), a); if (e) return e; + } + if (p->strings) { + e = (*v)(((PyObject *)p->strings), a); if (e) return e; + } + if (p->morphology) { + e = (*v)(((PyObject *)p->morphology), a); if (e) return e; + } + if (p->_vectors) { + e = (*v)(p->_vectors, a); if (e) return e; + } + if (p->_lookups) { + e = (*v)(p->_lookups, a); if (e) return e; + } + if (p->writing_system) { + e = (*v)(p->writing_system, a); if (e) return e; + } + if (p->get_noun_chunks) { + e = (*v)(p->get_noun_chunks, a); if (e) return e; + } + if (p->_unused_object) { + e = (*v)(p->_unused_object, a); if (e) return e; + } + if (p->lex_attr_getters) { + e = (*v)(p->lex_attr_getters, a); if (e) return e; + } + if (p->cfg) { + e = (*v)(p->cfg, a); if (e) return e; + } + if (p->_by_orth) { + e = (*v)(((PyObject *)p->_by_orth), a); if (e) return e; + } + if (p->_non_temp_mem) { + e = (*v)(((PyObject *)p->_non_temp_mem), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_5vocab_Vocab(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_5vocab_Vocab *p = (struct __pyx_obj_5spacy_5vocab_Vocab *)o; + tmp = ((PyObject*)p->mem); + p->mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->strings); + p->strings = ((struct __pyx_obj_5spacy_7strings_StringStore *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->morphology); + p->morphology = ((struct __pyx_obj_5spacy_10morphology_Morphology *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_vectors); + p->_vectors = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_lookups); + p->_lookups = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->writing_system); + p->writing_system = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->get_noun_chunks); + p->get_noun_chunks = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_unused_object); + p->_unused_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->lex_attr_getters); + p->lex_attr_getters = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->cfg); + p->cfg = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_by_orth); + p->_by_orth = ((struct __pyx_obj_7preshed_4maps_PreshMap *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_non_temp_mem); + p->_non_temp_mem = ((struct __pyx_obj_5cymem_5cymem_Pool *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_sq_item_5spacy_5vocab_Vocab(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab_vectors(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_7vectors_1__get__(o); +} + +static int __pyx_setprop_5spacy_5vocab_5Vocab_vectors(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_5vocab_5Vocab_7vectors_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab_lang(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_4lang_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab_in_memory_zone(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_14in_memory_zone_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab_vectors_length(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_14vectors_length_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab_lookups(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_7lookups_1__get__(o); +} + +static int __pyx_setprop_5spacy_5vocab_5Vocab_lookups(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_5vocab_5Vocab_7lookups_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab_strings(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_7strings_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab_morphology(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_10morphology_1__get__(o); +} + +static int __pyx_setprop_5spacy_5vocab_5Vocab_morphology(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_5vocab_5Vocab_10morphology_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_5vocab_5Vocab_10morphology_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab__vectors(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_8_vectors_1__get__(o); +} + +static int __pyx_setprop_5spacy_5vocab_5Vocab__vectors(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_5vocab_5Vocab_8_vectors_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_5vocab_5Vocab_8_vectors_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab__lookups(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_8_lookups_1__get__(o); +} + +static int __pyx_setprop_5spacy_5vocab_5Vocab__lookups(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_5vocab_5Vocab_8_lookups_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_5vocab_5Vocab_8_lookups_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab_writing_system(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_14writing_system_1__get__(o); +} + +static int __pyx_setprop_5spacy_5vocab_5Vocab_writing_system(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_5vocab_5Vocab_14writing_system_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_5vocab_5Vocab_14writing_system_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab_get_noun_chunks(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_15get_noun_chunks_1__get__(o); +} + +static int __pyx_setprop_5spacy_5vocab_5Vocab_get_noun_chunks(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_5vocab_5Vocab_15get_noun_chunks_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_5vocab_5Vocab_15get_noun_chunks_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab_length(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_6length_1__get__(o); +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab__unused_object(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_14_unused_object_1__get__(o); +} + +static int __pyx_setprop_5spacy_5vocab_5Vocab__unused_object(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_5vocab_5Vocab_14_unused_object_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_5vocab_5Vocab_14_unused_object_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab_lex_attr_getters(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_16lex_attr_getters_1__get__(o); +} + +static int __pyx_setprop_5spacy_5vocab_5Vocab_lex_attr_getters(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_5vocab_5Vocab_16lex_attr_getters_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_5vocab_5Vocab_16lex_attr_getters_5__del__(o); + } +} + +static PyObject *__pyx_getprop_5spacy_5vocab_5Vocab_cfg(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5spacy_5vocab_5Vocab_3cfg_1__get__(o); +} + +static int __pyx_setprop_5spacy_5vocab_5Vocab_cfg(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_5spacy_5vocab_5Vocab_3cfg_3__set__(o, v); + } + else { + return __pyx_pw_5spacy_5vocab_5Vocab_3cfg_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_5spacy_5vocab_Vocab[] = { + {"memory_zone", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_5memory_zone, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_4memory_zone}, + {"add_flag", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_8add_flag, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_7add_flag}, + {"_clear_transient_orths", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_10_clear_transient_orths, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_9_clear_transient_orths}, + {"reset_vectors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_19reset_vectors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_18reset_vectors}, + {"deduplicate_vectors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_21deduplicate_vectors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_20deduplicate_vectors}, + {"prune_vectors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_23prune_vectors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_22prune_vectors}, + {"get_vector", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_25get_vector, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_24get_vector}, + {"set_vector", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_27set_vector, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_26set_vector}, + {"has_vector", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_29has_vector, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_28has_vector}, + {"to_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_31to_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_30to_disk}, + {"from_disk", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_33from_disk, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_32from_disk}, + {"to_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_35to_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_34to_bytes}, + {"from_bytes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_37from_bytes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_36from_bytes}, + {"_reset_cache", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_39_reset_cache, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_38_reset_cache}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_41__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_40__reduce_cython__}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5spacy_5vocab_5Vocab_43__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5spacy_5vocab_5Vocab_42__setstate_cython__}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5spacy_5vocab_Vocab[] = { + {"vectors", __pyx_getprop_5spacy_5vocab_5Vocab_vectors, __pyx_setprop_5spacy_5vocab_5Vocab_vectors, 0, 0}, + {"lang", __pyx_getprop_5spacy_5vocab_5Vocab_lang, 0, 0, 0}, + {"in_memory_zone", __pyx_getprop_5spacy_5vocab_5Vocab_in_memory_zone, 0, PyDoc_STR("Vocab.in_memory_zone: bool"), 0}, + {"vectors_length", __pyx_getprop_5spacy_5vocab_5Vocab_vectors_length, 0, 0, 0}, + {"lookups", __pyx_getprop_5spacy_5vocab_5Vocab_lookups, __pyx_setprop_5spacy_5vocab_5Vocab_lookups, 0, 0}, + {"strings", __pyx_getprop_5spacy_5vocab_5Vocab_strings, 0, 0, 0}, + {"morphology", __pyx_getprop_5spacy_5vocab_5Vocab_morphology, __pyx_setprop_5spacy_5vocab_5Vocab_morphology, PyDoc_STR("morphology: spacy.morphology.Morphology"), 0}, + {"_vectors", __pyx_getprop_5spacy_5vocab_5Vocab__vectors, __pyx_setprop_5spacy_5vocab_5Vocab__vectors, PyDoc_STR("_vectors: object"), 0}, + {"_lookups", __pyx_getprop_5spacy_5vocab_5Vocab__lookups, __pyx_setprop_5spacy_5vocab_5Vocab__lookups, PyDoc_STR("_lookups: object"), 0}, + {"writing_system", __pyx_getprop_5spacy_5vocab_5Vocab_writing_system, __pyx_setprop_5spacy_5vocab_5Vocab_writing_system, PyDoc_STR("writing_system: object"), 0}, + {"get_noun_chunks", __pyx_getprop_5spacy_5vocab_5Vocab_get_noun_chunks, __pyx_setprop_5spacy_5vocab_5Vocab_get_noun_chunks, PyDoc_STR("get_noun_chunks: object"), 0}, + {"length", __pyx_getprop_5spacy_5vocab_5Vocab_length, 0, 0, 0}, + {"_unused_object", __pyx_getprop_5spacy_5vocab_5Vocab__unused_object, __pyx_setprop_5spacy_5vocab_5Vocab__unused_object, PyDoc_STR("_unused_object: object"), 0}, + {"lex_attr_getters", __pyx_getprop_5spacy_5vocab_5Vocab_lex_attr_getters, __pyx_setprop_5spacy_5vocab_5Vocab_lex_attr_getters, PyDoc_STR("lex_attr_getters: object"), 0}, + {"cfg", __pyx_getprop_5spacy_5vocab_5Vocab_cfg, __pyx_setprop_5spacy_5vocab_5Vocab_cfg, PyDoc_STR("cfg: object"), 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_5vocab_Vocab_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_5vocab_Vocab}, + {Py_sq_length, (void *)__pyx_pw_5spacy_5vocab_5Vocab_3__len__}, + {Py_sq_item, (void *)__pyx_sq_item_5spacy_5vocab_Vocab}, + {Py_sq_contains, (void *)__pyx_pw_5spacy_5vocab_5Vocab_12__contains__}, + {Py_mp_length, (void *)__pyx_pw_5spacy_5vocab_5Vocab_3__len__}, + {Py_mp_subscript, (void *)__pyx_pw_5spacy_5vocab_5Vocab_17__getitem__}, + {Py_tp_doc, (void *)PyDoc_STR("Vocab(lex_attr_getters=None, strings=tuple(), lookups=None, oov_prob=-20., vectors_name=None, writing_system={}, get_noun_chunks=None, **deprecated_kwargs)\n\nA look-up table that allows you to access `Lexeme` objects. The `Vocab`\ninstance also provides access to the `StringStore`, and owns underlying\nC-data that is shared between `Doc` objects.\n\nDOCS: https://spacy.io/api/vocab")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_5vocab_Vocab}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_5vocab_Vocab}, + {Py_tp_iter, (void *)__pyx_pw_5spacy_5vocab_5Vocab_14__iter__}, + {Py_tp_methods, (void *)__pyx_methods_5spacy_5vocab_Vocab}, + {Py_tp_getset, (void *)__pyx_getsets_5spacy_5vocab_Vocab}, + {Py_tp_init, (void *)__pyx_pw_5spacy_5vocab_5Vocab_1__init__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_5vocab_Vocab}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_5vocab_Vocab_spec = { + "spacy.vocab.Vocab", + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_5vocab_Vocab_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_Vocab = { + __pyx_pw_5spacy_5vocab_5Vocab_3__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_5spacy_5vocab_Vocab, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + __pyx_pw_5spacy_5vocab_5Vocab_12__contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_Vocab = { + __pyx_pw_5spacy_5vocab_5Vocab_3__len__, /*mp_length*/ + __pyx_pw_5spacy_5vocab_5Vocab_17__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_5spacy_5vocab_Vocab = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vocab.""Vocab", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_5vocab_Vocab), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_5vocab_Vocab, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_Vocab, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Vocab, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + PyDoc_STR("Vocab(lex_attr_getters=None, strings=tuple(), lookups=None, oov_prob=-20., vectors_name=None, writing_system={}, get_noun_chunks=None, **deprecated_kwargs)\n\nA look-up table that allows you to access `Lexeme` objects. The `Vocab`\ninstance also provides access to the `StringStore`, and owns underlying\nC-data that is shared between `Doc` objects.\n\nDOCS: https://spacy.io/api/vocab"), /*tp_doc*/ + __pyx_tp_traverse_5spacy_5vocab_Vocab, /*tp_traverse*/ + __pyx_tp_clear_5spacy_5vocab_Vocab, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_5spacy_5vocab_5Vocab_14__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_5spacy_5vocab_Vocab, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_5spacy_5vocab_Vocab, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_pw_5spacy_5vocab_5Vocab_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_5vocab_Vocab, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_5vocab___pyx_scope_struct__memory_zone(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct__memory_zone > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone, sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_5vocab___pyx_scope_struct__memory_zone[--__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct__memory_zone]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct__memory_zone(PyObject *o) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone *p = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct__memory_zone) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_contexts); + Py_CLEAR(p->__pyx_v_mem); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_stack); + Py_CLEAR(p->__pyx_t_0); + Py_CLEAR(p->__pyx_t_1); + Py_CLEAR(p->__pyx_t_2); + Py_CLEAR(p->__pyx_t_3); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct__memory_zone < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone, sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_5vocab___pyx_scope_struct__memory_zone[__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct__memory_zone++] = ((struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_5vocab___pyx_scope_struct__memory_zone(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone *p = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_contexts) { + e = (*v)(p->__pyx_v_contexts, a); if (e) return e; + } + if (p->__pyx_v_mem) { + e = (*v)(p->__pyx_v_mem, a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + if (p->__pyx_v_stack) { + e = (*v)(p->__pyx_v_stack, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + if (p->__pyx_t_1) { + e = (*v)(p->__pyx_t_1, a); if (e) return e; + } + if (p->__pyx_t_2) { + e = (*v)(p->__pyx_t_2, a); if (e) return e; + } + if (p->__pyx_t_3) { + e = (*v)(p->__pyx_t_3, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_5vocab___pyx_scope_struct__memory_zone_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct__memory_zone}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_5vocab___pyx_scope_struct__memory_zone}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_5vocab___pyx_scope_struct__memory_zone}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_5vocab___pyx_scope_struct__memory_zone_spec = { + "spacy.vocab.__pyx_scope_struct__memory_zone", + sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_5vocab___pyx_scope_struct__memory_zone_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_5vocab___pyx_scope_struct__memory_zone = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vocab.""__pyx_scope_struct__memory_zone", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct__memory_zone), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct__memory_zone, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_5vocab___pyx_scope_struct__memory_zone, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_5vocab___pyx_scope_struct__memory_zone, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_5vocab___pyx_scope_struct_1___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct_1___iter__ > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__, sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_5vocab___pyx_scope_struct_1___iter__[--__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct_1___iter__]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct_1___iter__(PyObject *o) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__ *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct_1___iter__) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_lex); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_t_0); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct_1___iter__ < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__, sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_5vocab___pyx_scope_struct_1___iter__[__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct_1___iter__++] = ((struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__ *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_5vocab___pyx_scope_struct_1___iter__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__ *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_lex) { + e = (*v)(((PyObject *)p->__pyx_v_lex), a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_5vocab___pyx_scope_struct_1___iter___slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct_1___iter__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_5vocab___pyx_scope_struct_1___iter__}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_5vocab___pyx_scope_struct_1___iter__}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_5vocab___pyx_scope_struct_1___iter___spec = { + "spacy.vocab.__pyx_scope_struct_1___iter__", + sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_5vocab___pyx_scope_struct_1___iter___slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_5vocab___pyx_scope_struct_1___iter__ = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vocab.""__pyx_scope_struct_1___iter__", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_1___iter__), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct_1___iter__, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_5vocab___pyx_scope_struct_1___iter__, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_5vocab___pyx_scope_struct_1___iter__, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_5vocab___pyx_scope_struct_2_to_bytes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct_2_to_bytes > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes, sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_5vocab___pyx_scope_struct_2_to_bytes[--__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct_2_to_bytes]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct_2_to_bytes(PyObject *o) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *p = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct_2_to_bytes) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct_2_to_bytes < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes, sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_5vocab___pyx_scope_struct_2_to_bytes[__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct_2_to_bytes++] = ((struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_5vocab___pyx_scope_struct_2_to_bytes(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *p = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_5vocab___pyx_scope_struct_2_to_bytes(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *p = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes *)o; + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_5spacy_5vocab_Vocab *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_5vocab___pyx_scope_struct_2_to_bytes_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct_2_to_bytes}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_5vocab___pyx_scope_struct_2_to_bytes}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_5vocab___pyx_scope_struct_2_to_bytes}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_5vocab___pyx_scope_struct_2_to_bytes}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_5vocab___pyx_scope_struct_2_to_bytes_spec = { + "spacy.vocab.__pyx_scope_struct_2_to_bytes", + sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_5vocab___pyx_scope_struct_2_to_bytes_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_5vocab___pyx_scope_struct_2_to_bytes = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vocab.""__pyx_scope_struct_2_to_bytes", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_2_to_bytes), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct_2_to_bytes, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_5vocab___pyx_scope_struct_2_to_bytes, /*tp_traverse*/ + __pyx_tp_clear_5spacy_5vocab___pyx_scope_struct_2_to_bytes, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_5vocab___pyx_scope_struct_2_to_bytes, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_5spacy_5vocab___pyx_scope_struct_3_from_bytes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct_3_from_bytes > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes, sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes)))) + { + o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5spacy_5vocab___pyx_scope_struct_3_from_bytes[--__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct_3_from_bytes]; + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(Py_TYPE(o)); + #endif + memset(o, 0, sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes)); + #if CYTHON_COMPILING_IN_LIMITED_API + (void) PyObject_Init(o, t); + #else + (void) PyObject_INIT(o, t); + #endif + PyObject_GC_Track(o); + } else + #endif + { + o = __Pyx_AllocateExtensionType(t, 1); + if (unlikely(!o)) return 0; + } + return o; +} + +static void __pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct_3_from_bytes(PyObject *o) { + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *p = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct_3_from_bytes) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_serialize_vectors); + #if CYTHON_USE_FREELISTS + if (likely((int)(__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct_3_from_bytes < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes, sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes)))) + { + __pyx_mstate_global->__pyx_freelist_5spacy_5vocab___pyx_scope_struct_3_from_bytes[__pyx_mstate_global->__pyx_freecount_5spacy_5vocab___pyx_scope_struct_3_from_bytes++] = ((struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *)o); + } else + #endif + { + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif + } +} + +static int __pyx_tp_traverse_5spacy_5vocab___pyx_scope_struct_3_from_bytes(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *p = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; + } + if (p->__pyx_v_serialize_vectors) { + e = (*v)(p->__pyx_v_serialize_vectors, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_5spacy_5vocab___pyx_scope_struct_3_from_bytes(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *p = (struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes *)o; + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_5spacy_5vocab_Vocab *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_serialize_vectors); + p->__pyx_v_serialize_vectors = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_5spacy_5vocab___pyx_scope_struct_3_from_bytes_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct_3_from_bytes}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_5spacy_5vocab___pyx_scope_struct_3_from_bytes}, + {Py_tp_clear, (void *)__pyx_tp_clear_5spacy_5vocab___pyx_scope_struct_3_from_bytes}, + {Py_tp_new, (void *)__pyx_tp_new_5spacy_5vocab___pyx_scope_struct_3_from_bytes}, + {0, 0}, +}; +static PyType_Spec __pyx_type_5spacy_5vocab___pyx_scope_struct_3_from_bytes_spec = { + "spacy.vocab.__pyx_scope_struct_3_from_bytes", + sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, + __pyx_type_5spacy_5vocab___pyx_scope_struct_3_from_bytes_slots, +}; +#else + +static PyTypeObject __pyx_type_5spacy_5vocab___pyx_scope_struct_3_from_bytes = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vocab.""__pyx_scope_struct_3_from_bytes", /*tp_name*/ + sizeof(struct __pyx_obj_5spacy_5vocab___pyx_scope_struct_3_from_bytes), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_5spacy_5vocab___pyx_scope_struct_3_from_bytes, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_5spacy_5vocab___pyx_scope_struct_3_from_bytes, /*tp_traverse*/ + __pyx_tp_clear_5spacy_5vocab___pyx_scope_struct_3_from_bytes, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_5spacy_5vocab___pyx_scope_struct_3_from_bytes, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif +static struct __pyx_vtabstruct_array __pyx_vtable_array; + +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_array___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "spacy.vocab.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_array = { + __pyx_array___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_array = { + __pyx_array___len__, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_array = { + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vocab.""array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_array, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_array, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_array, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_array, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_MemviewEnum_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_MemviewEnum_obj *)o); + p->name = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_Enum(PyObject *o) { + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_Enum(PyObject *o) { + PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_Enum[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "spacy.vocab.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_MemviewEnum_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_MemviewEnum = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vocab.""Enum", /*tp_name*/ + sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_Enum, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_MemviewEnum___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_Enum, /*tp_traverse*/ + __pyx_tp_clear_Enum, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_Enum, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_MemviewEnum___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_Enum, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif +static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; + +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryview_obj *p; + PyObject *o; + o = __Pyx_AllocateExtensionType(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryview_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_memoryview; + p->obj = Py_None; Py_INCREF(Py_None); + p->_size = Py_None; Py_INCREF(Py_None); + p->view.obj = NULL; + if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_memoryview(PyObject *o) { + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_memoryview___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->obj); + Py_CLEAR(p->_size); + PyTypeObject *tp = Py_TYPE(o); + #if CYTHON_USE_TYPE_SLOTS + (*tp->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); + if (tp_free) tp_free(o); + } + #endif + #if CYTHON_USE_TYPE_SPECS + Py_DECREF(tp); + #endif +} + +static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + { + e = __Pyx_call_type_traverse(o, 1, v, a); + if (e) return e; + } + if (p->obj) { + e = (*v)(p->obj, a); if (e) return e; + } + if (p->_size) { + e = (*v)(p->_size, a); if (e) return e; + } + if (p->view.obj) { + e = (*v)(p->view.obj, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_memoryview(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + tmp = ((PyObject*)p->obj); + p->obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_size); + p->_size = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + Py_CLEAR(p->view.obj); + return 0; +} + +static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyLong_FromSsize_t(i); if(!x) return 0; + #if CYTHON_USE_TYPE_SLOTS || (!CYTHON_USE_TYPE_SPECS && __PYX_LIMITED_VERSION_HEX < 0x030A0000) + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + #else + r = ((binaryfunc)PyType_GetSlot(Py_TYPE(o), Py_mp_subscript))(o, x); + #endif + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_memoryview___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); +} + +static PyMethodDef __pyx_methods_memoryview[] = { + {"is_c_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_memoryview[] = { + {"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0}, + {"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0}, + {"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0}, + {"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0}, + {"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0}, + {"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0}, + {"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0}, + {"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0}, + {"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "spacy.vocab.memoryview", + sizeof(struct __pyx_memoryview_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_memoryview_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_memoryview = { + __pyx_memoryview___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_memoryview, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_memoryview = { + __pyx_memoryview___len__, /*mp_length*/ + __pyx_memoryview___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_memoryview = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vocab.""memoryview", /*tp_name*/ + sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + __pyx_memoryview___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_memoryview___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_memoryview, /*tp_traverse*/ + __pyx_tp_clear_memoryview, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_memoryview, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_memoryview, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_memoryview, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif +static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; + +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryviewslice_obj *p; + PyObject *o = __pyx_tp_new_memoryview(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryviewslice_obj *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + __Pyx_default_placement_construct(&(p->from_slice)); + p->from_object = Py_None; Py_INCREF(Py_None); + p->from_slice.memview = NULL; + return o; +} + +static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_memoryviewslice___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->from_slice); + Py_CLEAR(p->from_object); + PyObject_GC_Track(o); + __pyx_tp_dealloc_memoryview(o); +} + +static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; + if (p->from_object) { + e = (*v)(p->from_object, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear__memoryviewslice(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + __pyx_tp_clear_memoryview(o); + tmp = ((PyObject*)p->from_object); + p->from_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); + return 0; +} + +static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "spacy.vocab._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_memoryviewslice = { + PyVarObject_HEAD_INIT(0, 0) + "spacy.vocab.""_memoryviewslice", /*tp_name*/ + sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ + 0, /*tp_vectorcall_offset*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ + __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ + __pyx_tp_clear__memoryviewslice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods__memoryviewslice, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new__memoryviewslice, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if PY_VERSION_HEX >= 0x030d00A4 + 0, /*tp_versions_used*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +/* #### Code section: initfunc_declarations ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ +/* #### Code section: init_module ### */ + +static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); + generic = Py_None; Py_INCREF(Py_None); + strided = Py_None; Py_INCREF(Py_None); + indirect = Py_None; Py_INCREF(Py_None); + contiguous = Py_None; Py_INCREF(Py_None); + indirect_contiguous = Py_None; Py_INCREF(Py_None); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + { + __pyx_t_1 = __Pyx_ApiExport_GetApiDict(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_export_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_struct___pyx_t_5spacy_7structs_L); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_export_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_export_name = __pyx_export_signature + 39; + void *const __pyx_export_pointers[] = {(void *)&__pyx_v_5spacy_5vocab_EMPTY_LEXEME, (void *) NULL}; + void *const *__pyx_export_pointer = __pyx_export_pointers; + const char *__pyx_export_current_signature = __pyx_export_signature; + while (*__pyx_export_pointer) { + if (__Pyx_ExportVoidPtr(__pyx_t_1, __pyx_export_name, *__pyx_export_pointer, __pyx_export_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_export_pointer; + __pyx_export_name = strchr(__pyx_export_name, '\0') + 1; + __pyx_export_signature = strchr(__pyx_export_signature, '\0') + 1; + if (*__pyx_export_signature != '\0') __pyx_export_current_signature = __pyx_export_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_5spacy_5vocab_Vocab = &__pyx_vtable_5spacy_5vocab_Vocab; + __pyx_vtable_5spacy_5vocab_Vocab.get = (struct __pyx_t_5spacy_7structs_LexemeC const *(*)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *))__pyx_f_5spacy_5vocab_5Vocab_get; + __pyx_vtable_5spacy_5vocab_Vocab.get_by_orth = (struct __pyx_t_5spacy_7structs_LexemeC const *(*)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, __pyx_t_5spacy_8typedefs_attr_t))__pyx_f_5spacy_5vocab_5Vocab_get_by_orth; + __pyx_vtable_5spacy_5vocab_Vocab.make_fused_token = (struct __pyx_t_5spacy_7structs_TokenC const *(*)(struct __pyx_obj_5spacy_5vocab_Vocab *, PyObject *))__pyx_f_5spacy_5vocab_5Vocab_make_fused_token; + __pyx_vtable_5spacy_5vocab_Vocab._new_lexeme = (struct __pyx_t_5spacy_7structs_LexemeC const *(*)(struct __pyx_obj_5spacy_5vocab_Vocab *, struct __pyx_obj_5cymem_5cymem_Pool *, PyObject *))__pyx_f_5spacy_5vocab_5Vocab__new_lexeme; + __pyx_vtable_5spacy_5vocab_Vocab._add_lex_to_vocab = (int (*)(struct __pyx_obj_5spacy_5vocab_Vocab *, __pyx_t_5spacy_8typedefs_hash_t, struct __pyx_t_5spacy_7structs_LexemeC const *, int))__pyx_f_5spacy_5vocab_5Vocab__add_lex_to_vocab; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_5vocab_Vocab_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab)) __PYX_ERR(0, 46, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_5vocab_Vocab_spec, __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) < (0)) __PYX_ERR(0, 46, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab = &__pyx_type_5spacy_5vocab_Vocab; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) < (0)) __PYX_ERR(0, 46, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 46, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_5vocab_5Vocab___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_5vocab_5Vocab___init__.doc = __pyx_doc_5spacy_5vocab_5Vocab___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_5vocab_5Vocab___init__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab, "__len__"); if (unlikely(!wrapper)) __PYX_ERR(0, 46, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_5vocab_5Vocab_2__len__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_5vocab_5Vocab_2__len__.doc = __pyx_doc_5spacy_5vocab_5Vocab_2__len__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_5vocab_5Vocab_2__len__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab, "__contains__"); if (unlikely(!wrapper)) __PYX_ERR(0, 46, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_5vocab_5Vocab_11__contains__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_5vocab_5Vocab_11__contains__.doc = __pyx_doc_5spacy_5vocab_5Vocab_11__contains__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_5vocab_5Vocab_11__contains__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(0, 46, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_5vocab_5Vocab_13__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_5vocab_5Vocab_13__iter__.doc = __pyx_doc_5spacy_5vocab_5Vocab_13__iter__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_5vocab_5Vocab_13__iter__; + } + } + #endif + #if CYTHON_UPDATE_DESCRIPTOR_DOC + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 46, __pyx_L1_error) + if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) { + __pyx_wrapperbase_5spacy_5vocab_5Vocab_16__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_5spacy_5vocab_5Vocab_16__getitem__.doc = __pyx_doc_5spacy_5vocab_5Vocab_16__getitem__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5spacy_5vocab_5Vocab_16__getitem__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_vtabptr_5spacy_5vocab_Vocab) < (0)) __PYX_ERR(0, 46, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) < (0)) __PYX_ERR(0, 46, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Vocab, (PyObject *) __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) < (0)) __PYX_ERR(0, 46, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5spacy_5vocab_Vocab) < (0)) __PYX_ERR(0, 46, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_5vocab___pyx_scope_struct__memory_zone_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone)) __PYX_ERR(0, 130, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_5vocab___pyx_scope_struct__memory_zone_spec, __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone) < (0)) __PYX_ERR(0, 130, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone = &__pyx_type_5spacy_5vocab___pyx_scope_struct__memory_zone; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone) < (0)) __PYX_ERR(0, 130, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct__memory_zone->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_5vocab___pyx_scope_struct_1___iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__)) __PYX_ERR(0, 274, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_5vocab___pyx_scope_struct_1___iter___spec, __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__) < (0)) __PYX_ERR(0, 274, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__ = &__pyx_type_5spacy_5vocab___pyx_scope_struct_1___iter__; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__) < (0)) __PYX_ERR(0, 274, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_1___iter__->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_5vocab___pyx_scope_struct_2_to_bytes_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes)) __PYX_ERR(0, 564, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_5vocab___pyx_scope_struct_2_to_bytes_spec, __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes) < (0)) __PYX_ERR(0, 564, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes = &__pyx_type_5spacy_5vocab___pyx_scope_struct_2_to_bytes; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes) < (0)) __PYX_ERR(0, 564, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_2_to_bytes->tp_getattro = PyObject_GenericGetAttr; + } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5spacy_5vocab___pyx_scope_struct_3_from_bytes_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes)) __PYX_ERR(0, 585, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5spacy_5vocab___pyx_scope_struct_3_from_bytes_spec, __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes) < (0)) __PYX_ERR(0, 585, __pyx_L1_error) + #else + __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes = &__pyx_type_5spacy_5vocab___pyx_scope_struct_3_from_bytes; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes) < (0)) __PYX_ERR(0, 585, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes->tp_dictoffset && __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_ptype_5spacy_5vocab___pyx_scope_struct_3_from_bytes->tp_getattro = PyObject_GenericGetAttr; + } + #endif + __pyx_vtabptr_array = &__pyx_vtable_array; + __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_array_type)) __PYX_ERR(1, 110, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #else + __pyx_mstate->__pyx_array_type = &__pyx_type___pyx_array; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_array_type); + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_array_type, __pyx_vtabptr_array) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_array_type) < (0)) __PYX_ERR(1, 110, __pyx_L1_error) + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_MemviewEnum_type)) __PYX_ERR(1, 299, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #else + __pyx_mstate->__pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_MemviewEnum_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_MemviewEnum_type->tp_dictoffset && __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_MemviewEnum_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_MemviewEnum_type) < (0)) __PYX_ERR(1, 299, __pyx_L1_error) + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_mstate->__pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_memoryview_type)) __PYX_ERR(1, 334, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_mstate->__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_mstate->__pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryview_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryview_type->tp_dictoffset && __pyx_mstate->__pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryview_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryview_type, __pyx_vtabptr_memoryview) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryview_type) < (0)) __PYX_ERR(1, 334, __pyx_L1_error) + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_mstate->__pyx_memoryviewslice_type)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #else + __pyx_mstate->__pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_mstate_global->__pyx_memoryviewslice_type->tp_base = __pyx_mstate_global->__pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + #endif + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_memoryviewslice_type); + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_memoryviewslice_type->tp_dictoffset && __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_mstate->__pyx_memoryviewslice_type->tp_getattro = PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_mstate->__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_MergeVtables(__pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_memoryviewslice_type) < (0)) __PYX_ERR(1, 951, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule("cymem.cymem"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyMalloc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyMalloc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyMalloc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc) __PYX_ERR(6, 4, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyMalloc = (struct __pyx_vtabstruct_5cymem_5cymem_PyMalloc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyMalloc); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyMalloc)) __PYX_ERR(6, 4, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "PyFree", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_PyFree), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_PyFree), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree) __PYX_ERR(6, 10, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_PyFree = (struct __pyx_vtabstruct_5cymem_5cymem_PyFree*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_PyFree); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_PyFree)) __PYX_ERR(6, 10, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Pool", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Pool), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Pool), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool) __PYX_ERR(6, 16, __pyx_L1_error) + __pyx_vtabptr_5cymem_5cymem_Pool = (struct __pyx_vtabstruct_5cymem_5cymem_Pool*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5cymem_5cymem_Pool); if (unlikely(!__pyx_vtabptr_5cymem_5cymem_Pool)) __PYX_ERR(6, 16, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5cymem_5cymem_Address = __Pyx_ImportType_3_2_1(__pyx_t_1, "cymem.cymem", "Address", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #else + sizeof(struct __pyx_obj_5cymem_5cymem_Address), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5cymem_5cymem_Address), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5cymem_5cymem_Address) __PYX_ERR(6, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMap", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMap), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMap), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap) __PYX_ERR(7, 45, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMap = (struct __pyx_vtabstruct_7preshed_4maps_PreshMap*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMap); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMap)) __PYX_ERR(7, 45, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray = __Pyx_ImportType_3_2_1(__pyx_t_1, "preshed.maps", "PreshMapArray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #else + sizeof(struct __pyx_obj_7preshed_4maps_PreshMapArray), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_7preshed_4maps_PreshMapArray), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray) __PYX_ERR(7, 53, __pyx_L1_error) + __pyx_vtabptr_7preshed_4maps_PreshMapArray = (struct __pyx_vtabstruct_7preshed_4maps_PreshMapArray*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_7preshed_4maps_PreshMapArray); if (unlikely(!__pyx_vtabptr_7preshed_4maps_PreshMapArray)) __PYX_ERR(7, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_2_1(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + 0, 0, + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(8, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "dtype", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #else + sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArray_Descr), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 228, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flatiter", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #else + sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 273, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "broadcast", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #else + sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayMultiIterObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 277, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ndarray", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #else + sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyArrayObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 316, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_generic = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "generic", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_generic) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_number = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "number", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_number) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_integer = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "integer", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_integer) __PYX_ERR(2, 829, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "signedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 831, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "unsignedinteger", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 833, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "inexact", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 835, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_floating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "floating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_floating) __PYX_ERR(2, 837, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "complexfloating", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 839, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "flexible", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 841, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_character = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "character", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #else + sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_character) __PYX_ERR(2, 843, __pyx_L1_error) + __pyx_mstate->__pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_2_1(__pyx_t_1, "numpy", "ufunc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #else + sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(PyUFuncObject), + #endif + __Pyx_ImportType_CheckSize_Ignore_3_2_1); if (!__pyx_mstate->__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 907, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.strings"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.strings", "StringStore", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #else + sizeof(struct __pyx_obj_5spacy_7strings_StringStore), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_7strings_StringStore), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore) __PYX_ERR(9, 22, __pyx_L1_error) + __pyx_vtabptr_5spacy_7strings_StringStore = (struct __pyx_vtabstruct_5spacy_7strings_StringStore*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_7strings_StringStore); if (unlikely(!__pyx_vtabptr_5spacy_7strings_StringStore)) __PYX_ERR(9, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.morphology"); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.morphology", "Morphology", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #else + sizeof(struct __pyx_obj_5spacy_10morphology_Morphology), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_10morphology_Morphology), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology) __PYX_ERR(10, 11, __pyx_L1_error) + __pyx_vtabptr_5spacy_10morphology_Morphology = (struct __pyx_vtabstruct_5spacy_10morphology_Morphology*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_10morphology_Morphology); if (unlikely(!__pyx_vtabptr_5spacy_10morphology_Morphology)) __PYX_ERR(10, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.lexeme"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.lexeme", "Lexeme", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #else + sizeof(struct __pyx_obj_5spacy_6lexeme_Lexeme), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6lexeme_Lexeme), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme) __PYX_ERR(3, 24, __pyx_L1_error) + __pyx_vtabptr_5spacy_6lexeme_Lexeme = (struct __pyx_vtabstruct_5spacy_6lexeme_Lexeme*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6lexeme_Lexeme); if (unlikely(!__pyx_vtabptr_5spacy_6lexeme_Lexeme)) __PYX_ERR(3, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.tokens.doc"); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.tokens.doc", "Doc", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #else + sizeof(struct __pyx_obj_5spacy_6tokens_3doc_Doc), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_3doc_Doc), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc) __PYX_ERR(11, 37, __pyx_L1_error) + __pyx_vtabptr_5spacy_6tokens_3doc_Doc = (struct __pyx_vtabstruct_5spacy_6tokens_3doc_Doc*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6tokens_3doc_Doc); if (unlikely(!__pyx_vtabptr_5spacy_6tokens_3doc_Doc)) __PYX_ERR(11, 37, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("spacy.tokens.token"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_mstate->__pyx_ptype_5spacy_6tokens_5token_Token = __Pyx_ImportType_3_2_1(__pyx_t_1, "spacy.tokens.token", "Token", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(struct __pyx_obj_5spacy_6tokens_5token_Token), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_5token_Token), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(struct __pyx_obj_5spacy_6tokens_5token_Token), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_5token_Token), + #else + sizeof(struct __pyx_obj_5spacy_6tokens_5token_Token), __PYX_GET_STRUCT_ALIGNMENT_3_2_1(struct __pyx_obj_5spacy_6tokens_5token_Token), + #endif + __Pyx_ImportType_CheckSize_Warn_3_2_1); if (!__pyx_mstate->__pyx_ptype_5spacy_6tokens_5token_Token) __PYX_ERR(4, 16, __pyx_L1_error) + __pyx_vtabptr_5spacy_6tokens_5token_Token = (struct __pyx_vtabstruct_5spacy_6tokens_5token_Token*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5spacy_6tokens_5token_Token); if (unlikely(!__pyx_vtabptr_5spacy_6tokens_5token_Token)) __PYX_ERR(4, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("spacy.lexeme"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_pyx_t_5spacy_8typedefs_attr_t); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 71; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_6lexeme_OOV_RANK, (void **)&__pyx_vp_5spacy_6lexeme_EMPTY_LEXEME, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + { + __pyx_t_1 = PyImport_ImportModule("spacy.tokens.token"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_int_const_MISSING_DEP); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 11; + void **const __pyx_import_pointers[] = {(void **)&__pyx_vp_5spacy_6tokens_5token_MISSING_DEP, (void **) NULL}; + void **const *__pyx_import_pointer = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportVoidPtr_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + { + __pyx_t_1 = PyImport_ImportModule("murmurhash.mrmr"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_uint64_t_void_int_uint64_t_hash6); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 33; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_10murmurhash_4mrmr_hash64, (void (**)(void)) NULL}; + void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportFunction_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + { + __pyx_t_1 = PyImport_ImportModule("preshed.maps"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_void_struct___pyx_t_7preshed_4ma); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + const char * __pyx_import_name = __pyx_import_signature + 87; + void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_7preshed_4maps_map_clear, (void (**)(void)) NULL}; + void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers; + const char *__pyx_import_current_signature = __pyx_import_signature; + while (*__pyx_import_pointer) { + if (__Pyx_ImportFunction_3_2_1(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + ++__pyx_import_pointer; + __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; + __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; + if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_vocab(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_vocab}, + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + {Py_mod_gil, Py_MOD_GIL_USED}, + #endif + #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE + {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, + #endif + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "vocab", + 0, /* m_doc */ + #if CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstatetype), /* m_size */ + #else + (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif + +/* PyModInitFuncType */ +#ifndef CYTHON_NO_PYINIT_EXPORT + #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#else + #ifdef __cplusplus + #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * + #else + #define __Pyx_PyMODINIT_FUNC PyObject * + #endif +#endif + +__Pyx_PyMODINIT_FUNC PyInit_vocab(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_vocab(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +/* ModuleCreationPEP489 */ +#if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) +static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { + { + PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think + if (!module) { + PyErr_Clear(); // just try the 3.8-3.12 version + module = PyImport_ImportModule("_xxsubinterpreters"); + if (!module) goto bad; + } + PyObject *current = PyObject_CallMethod(module, "get_current", NULL); + Py_DECREF(module); + if (!current) goto bad; + if (PyTuple_Check(current)) { + PyObject *new_current = PySequence_GetItem(current, 0); + Py_DECREF(current); + current = new_current; + if (!new_current) goto bad; + } + long long as_c_int = PyLong_AsLongLong(current); + Py_DECREF(current); + return as_c_int; + } + bad: + PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); + return -1; +} +#endif +#if !CYTHON_USE_MODULE_STATE +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + static PY_INT64_T main_interpreter_id = -1; +#if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 + PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_GRAAL + PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); +#elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ + || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) + PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); +#elif CYTHON_COMPILING_IN_LIMITED_API + PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); +#else + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); +#endif + if (unlikely(current_id == -1)) { + return -1; + } + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return 0; + } else if (unlikely(main_interpreter_id != current_id)) { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#endif +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + #if !CYTHON_USE_MODULE_STATE + if (__Pyx_check_single_interpreter()) + return NULL; + #endif + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_vocab(PyObject *__pyx_pyinit_module) +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + __pyx_mstatetype *__pyx_mstate = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + size_t __pyx_t_6; + static PyThread_type_lock __pyx_t_7[8]; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'vocab' has already been imported. Re-initialisation is not supported."); + return -1; + } + #else + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_t_1 = __pyx_pyinit_module; + Py_INCREF(__pyx_t_1); + #else + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #if CYTHON_USE_MODULE_STATE + { + int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "vocab" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = __pyx_t_1; + #endif + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); + #endif + __pyx_mstate = __pyx_mstate_global; + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_mstate->__pyx_d); + __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /* ImportRefnannyAPI */ + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + +__Pyx_RefNannySetupContext("PyInit_vocab", 0); + __Pyx_init_runtime_version(); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Library function declarations ---*/ + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_module_is_main_spacy__vocab) { + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name_2, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "spacy.vocab")) { + if (unlikely((PyDict_SetItemString(modules, "spacy.vocab", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(__pyx_mstate); + if (unlikely((__Pyx_modinit_variable_export_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_function_export_code(__pyx_mstate); + if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_variable_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Execution code ---*/ + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":101 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * except: + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_collections_abc}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin___import__, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":102 + * try: + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + + /* "View.MemoryView":104 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * +*/ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + goto __pyx_L3_exception_handled; + } + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":240 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 240, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":241 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_array_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 241, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":239 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L15_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":242 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L11_exception_handled; + } + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L15_try_end:; + } + + /* "View.MemoryView":307 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct_or_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 307, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":308 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 308, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":309 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_strided_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":312 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_direct}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 312, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":313 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_contiguous_and_indirect}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_MemviewEnum_type, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 313, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_4); + } + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":321 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), +*/ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":322 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), +*/ + __pyx_t_7[0] = PyThread_allocate_lock(); + __pyx_t_7[1] = PyThread_allocate_lock(); + __pyx_t_7[2] = PyThread_allocate_lock(); + __pyx_t_7[3] = PyThread_allocate_lock(); + __pyx_t_7[4] = PyThread_allocate_lock(); + __pyx_t_7[5] = PyThread_allocate_lock(); + __pyx_t_7[6] = PyThread_allocate_lock(); + __pyx_t_7[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_7, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":984 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_count, __pyx_t_4) < (0)) __PYX_ERR(1, 984, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":985 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass +*/ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_memoryviewslice_type, __pyx_mstate_global->__pyx_n_u_index, __pyx_t_4) < (0)) __PYX_ERR(1, 985, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":983 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index +*/ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L23_try_end; + __pyx_L18_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":986 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L19_exception_handled; + } + __pyx_L19_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L23_try_end:; + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(1, 990, __pyx_L26_error) + if (__pyx_t_8) { + + /* "View.MemoryView":994 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_memoryviewslice_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":995 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue +*/ + __pyx_t_5 = __pyx_collections_abc_Sequence; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_array_type)}; + __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_register, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 995, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":990 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * +*/ + } + + /* "View.MemoryView":989 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * +*/ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L31_try_end; + __pyx_L26_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":996 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * +*/ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L27_exception_handled; + } + __pyx_L27_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L31_try_end:; + } + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x82a3537, 0x6ae9995, 0xb068931, b'name') +*/ + __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_mstate_global->__pyx_n_u_View_MemoryView); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Enum, __pyx_t_4) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":1 + * import functools # <<<<<<<<<<<<<< + * from contextlib import ExitStack, contextmanager + * from typing import Iterator, Optional +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_functools, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_functools, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_functools, __pyx_t_4) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":2 + * import functools + * from contextlib import ExitStack, contextmanager # <<<<<<<<<<<<<< + * from typing import Iterator, Optional + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_ExitStack,__pyx_mstate_global->__pyx_n_u_contextmanager}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_contextlib, __pyx_imported_names, 2, __pyx_mstate_global->__pyx_kp_u_spacy_contextlib, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_ExitStack,__pyx_mstate_global->__pyx_n_u_contextmanager}; + for (__pyx_t_9=0; __pyx_t_9 < 2; __pyx_t_9++) { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":3 + * import functools + * from contextlib import ExitStack, contextmanager + * from typing import Iterator, Optional # <<<<<<<<<<<<<< + * + * import numpy +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Iterator,__pyx_mstate_global->__pyx_n_u_Optional}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_typing, __pyx_imported_names, 2, __pyx_mstate_global->__pyx_kp_u_spacy_typing, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Iterator,__pyx_mstate_global->__pyx_n_u_Optional}; + for (__pyx_t_9=0; __pyx_t_9 < 2; __pyx_t_9++) { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":5 + * from typing import Iterator, Optional + * + * import numpy # <<<<<<<<<<<<<< + * import srsly + * from thinc.api import get_array_module, get_current_ops +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numpy, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_numpy, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_numpy, __pyx_t_4) < (0)) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":6 + * + * import numpy + * import srsly # <<<<<<<<<<<<<< + * from thinc.api import get_array_module, get_current_ops + * from preshed.maps cimport map_clear +*/ + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_srsly, 0, 0, __pyx_mstate_global->__pyx_kp_u_spacy_srsly, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_srsly, __pyx_t_4) < (0)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":7 + * import numpy + * import srsly + * from thinc.api import get_array_module, get_current_ops # <<<<<<<<<<<<<< + * from preshed.maps cimport map_clear + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_get_array_module,__pyx_mstate_global->__pyx_n_u_get_current_ops}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_thinc_api, __pyx_imported_names, 2, __pyx_mstate_global->__pyx_kp_u_spacy_thinc_api, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_get_array_module,__pyx_mstate_global->__pyx_n_u_get_current_ops}; + for (__pyx_t_9=0; __pyx_t_9 < 2; __pyx_t_9++) { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":15 + * from .typedefs cimport attr_t + * + * from . import util # <<<<<<<<<<<<<< + * from .attrs import IS_STOP, NORM, intify_attrs + * from .compat import copy_reg +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u__9, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_util}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":16 + * + * from . import util + * from .attrs import IS_STOP, NORM, intify_attrs # <<<<<<<<<<<<<< + * from .compat import copy_reg + * from .errors import Errors +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IS_STOP,__pyx_mstate_global->__pyx_n_u_NORM,__pyx_mstate_global->__pyx_n_u_intify_attrs}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_attrs, __pyx_imported_names, 3, __pyx_mstate_global->__pyx_kp_u_spacy_attrs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_IS_STOP,__pyx_mstate_global->__pyx_n_u_NORM,__pyx_mstate_global->__pyx_n_u_intify_attrs}; + for (__pyx_t_9=0; __pyx_t_9 < 3; __pyx_t_9++) { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":17 + * from . import util + * from .attrs import IS_STOP, NORM, intify_attrs + * from .compat import copy_reg # <<<<<<<<<<<<<< + * from .errors import Errors + * from .lang.lex_attrs import LEX_ATTRS, get_lang, is_stop +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_copy_reg}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_compat, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_compat, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_copy_reg}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":18 + * from .attrs import IS_STOP, NORM, intify_attrs + * from .compat import copy_reg + * from .errors import Errors # <<<<<<<<<<<<<< + * from .lang.lex_attrs import LEX_ATTRS, get_lang, is_stop + * from .lang.norm_exceptions import BASE_NORMS +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_errors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_errors, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Errors}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":19 + * from .compat import copy_reg + * from .errors import Errors + * from .lang.lex_attrs import LEX_ATTRS, get_lang, is_stop # <<<<<<<<<<<<<< + * from .lang.norm_exceptions import BASE_NORMS + * from .lookups import Lookups +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_LEX_ATTRS,__pyx_mstate_global->__pyx_n_u_get_lang,__pyx_mstate_global->__pyx_n_u_is_stop}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_lang_lex_attrs, __pyx_imported_names, 3, __pyx_mstate_global->__pyx_kp_u_spacy_lang_lex_attrs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_LEX_ATTRS,__pyx_mstate_global->__pyx_n_u_get_lang,__pyx_mstate_global->__pyx_n_u_is_stop}; + for (__pyx_t_9=0; __pyx_t_9 < 3; __pyx_t_9++) { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":20 + * from .errors import Errors + * from .lang.lex_attrs import LEX_ATTRS, get_lang, is_stop + * from .lang.norm_exceptions import BASE_NORMS # <<<<<<<<<<<<<< + * from .lookups import Lookups + * from .vectors import Mode as VectorsMode +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_BASE_NORMS}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_lang_norm_exceptions, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_lang_norm_exceptions, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_BASE_NORMS}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":21 + * from .lang.lex_attrs import LEX_ATTRS, get_lang, is_stop + * from .lang.norm_exceptions import BASE_NORMS + * from .lookups import Lookups # <<<<<<<<<<<<<< + * from .vectors import Mode as VectorsMode + * from .vectors import Vectors +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Lookups}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_lookups, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_lookups, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Lookups}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":22 + * from .lang.norm_exceptions import BASE_NORMS + * from .lookups import Lookups + * from .vectors import Mode as VectorsMode # <<<<<<<<<<<<<< + * from .vectors import Vectors + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Mode}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_vectors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_vectors, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Mode}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + switch (__pyx_t_9) { + case 0: + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_VectorsMode, __pyx_t_5) < (0)) __PYX_ERR(0, 22, __pyx_L1_error) + break; + default:; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":23 + * from .lookups import Lookups + * from .vectors import Mode as VectorsMode + * from .vectors import Vectors # <<<<<<<<<<<<<< + * + * +*/ + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Vectors}; + __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_vectors, __pyx_imported_names, 1, __pyx_mstate_global->__pyx_kp_u_spacy_vectors, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error) + } + __pyx_t_4 = __pyx_t_1; + __Pyx_GOTREF(__pyx_t_4); + { + PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Vectors}; + __pyx_t_9 = 0; { + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_imported_names[__pyx_t_9]); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_9], __pyx_t_5) < (0)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":26 + * + * + * def create_vocab(lang, defaults, vectors_name=None): # <<<<<<<<<<<<<< + * # If the spacy-lookups-data package is installed, we pre-populate the lookups + * # with lexeme data, if available +*/ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_1create_vocab, 0, __pyx_mstate_global->__pyx_n_u_create_vocab, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[4]); + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_create_vocab, __pyx_t_4) < (0)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":56 + * self, + * lex_attr_getters=None, + * strings=tuple(), # <<<<<<<<<<<<<< + * lookups=None, + * oov_prob=-20., +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + } + __pyx_mstate_global->__pyx_k__6 = __pyx_t_4; + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":60 + * oov_prob=-20., + * vectors_name=None, + * writing_system={}, # no-cython-lint # <<<<<<<<<<<<<< + * get_noun_chunks=None, + * **deprecated_kwargs +*/ + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_mstate_global->__pyx_k__7 = __pyx_t_4; + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "spacy/vocab.pyx":130 + * return self.length + * + * @contextmanager # <<<<<<<<<<<<<< + * def memory_zone(self, mem: Optional[Pool] = None) -> Iterator[Pool]: + * """Begin a block where resources allocated during the block will +*/ + __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_mem, __pyx_mstate_global->__pyx_kp_u_Optional_Pool) < (0)) __PYX_ERR(0, 130, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Iterator_Pool) < (0)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_5memory_zone, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab_memory_zone, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[4]); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_memory_zone, __pyx_t_5) < (0)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_contextmanager); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetNameInClass(__pyx_t_11, (PyObject*)__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_memory_zone); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_11}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_memory_zone, __pyx_t_5) < (0)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":157 + * self.mem = self._non_temp_mem + * + * def add_flag(self, flag_getter, int flag_id=-1): # <<<<<<<<<<<<<< + * """Set a new boolean flag to words in the vocabulary. + * +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_8add_flag, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab_add_flag, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_mstate_global->__pyx_tuple[1]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_add_flag, __pyx_t_5) < (0)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":250 + * self._transient_orths.push_back(lex.orth) + * + * def _clear_transient_orths(self): # <<<<<<<<<<<<<< + * """Remove transient lexemes from the index (generally at the end of the memory zone)""" + * for orth in self._transient_orths: +*/ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_10_clear_transient_orths, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab__clear_transient_orths, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_clear_transient_orths, __pyx_t_5) < (0)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":336 + * return -1 + * + * def reset_vectors(self, *, width=None, shape=None): # <<<<<<<<<<<<<< + * """Drop the current vector table. Because all vectors must be the same + * width, you have to call this to change the size of the vectors. +*/ + __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 336, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_width, Py_None) < (0)) __PYX_ERR(0, 336, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_shape, Py_None) < (0)) __PYX_ERR(0, 336, __pyx_L1_error) + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_19reset_vectors, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab_reset_vectors, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 336, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_10, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_reset_vectors, __pyx_t_10) < (0)) __PYX_ERR(0, 336, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":350 + * self.vectors = Vectors(strings=self.strings, shape=(self.vectors.shape[0], width)) + * + * def deduplicate_vectors(self): # <<<<<<<<<<<<<< + * if not isinstance(self.vectors, Vectors): + * raise ValueError(Errors.E849.format(method="deduplicate_vectors", vectors_type=type(self.vectors))) +*/ + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_21deduplicate_vectors, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab_deduplicate_vectors, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 350, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_deduplicate_vectors, __pyx_t_10) < (0)) __PYX_ERR(0, 350, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":379 + * self.vectors.add(key, row=row) + * + * def prune_vectors(self, nr_row, batch_size=1024): # <<<<<<<<<<<<<< + * """Reduce the current vector table to `nr_row` unique entries. Words + * mapped to the discarded vectors will be remapped to the closest vector +*/ + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_23prune_vectors, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab_prune_vectors, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_10, __pyx_mstate_global->__pyx_tuple[5]); + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_prune_vectors, __pyx_t_10) < (0)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":444 + * return remap + * + * def get_vector(self, orth): # <<<<<<<<<<<<<< + * """Retrieve a vector for a word in the vocabulary. Words can be looked + * up by string or int ID. If the current vectors do not contain an entry +*/ + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_25get_vector, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab_get_vector, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_get_vector, __pyx_t_10) < (0)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":467 + * return vectors + * + * def set_vector(self, orth, vector): # <<<<<<<<<<<<<< + * """Set a vector for a word in the vocabulary. Words can be referenced + * by string or int ID. +*/ + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_27set_vector, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab_set_vector, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_set_vector, __pyx_t_10) < (0)) __PYX_ERR(0, 467, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":491 + * lex.rank = row + * + * def has_vector(self, orth): # <<<<<<<<<<<<<< + * """Check whether a word has a vector. Returns False if no vectors have + * been loaded. Words can be looked up by string or int ID. +*/ + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_29has_vector, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab_has_vector, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 491, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_has_vector, __pyx_t_10) < (0)) __PYX_ERR(0, 491, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":519 + * ) + * + * def to_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Save the current state to a directory. + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 519, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + } + __pyx_mstate_global->__pyx_k__10 = __pyx_t_10; + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 519, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 519, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (PyDict_SetItem(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_5) < (0)) __PYX_ERR(0, 519, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_31to_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab_to_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 519, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_to_disk, __pyx_t_5) < (0)) __PYX_ERR(0, 519, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":538 + * self.lookups.to_disk(path) + * + * def from_disk(self, path, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Loads state from a directory. Modifies the object in place and + * returns it. +*/ + __pyx_t_10 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_mstate_global->__pyx_k__11 = __pyx_t_5; + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL}; + __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + } + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_10) < (0)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_33from_disk, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab_from_disk, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_10, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_from_disk, __pyx_t_10) < (0)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":564 + * return self + * + * def to_bytes(self, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Serialize the current state to a binary string. + * +*/ + __pyx_t_5 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + } + __pyx_mstate_global->__pyx_k__12 = __pyx_t_10; + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + if (PyDict_SetItem(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_5) < (0)) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_35to_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab_to_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_5); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_5, __pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_to_bytes, __pyx_t_5) < (0)) __PYX_ERR(0, 564, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "spacy/vocab.pyx":585 + * return util.to_bytes(getters, exclude) + * + * def from_bytes(self, bytes_data, *, exclude=tuple()): # <<<<<<<<<<<<<< + * """Load state from a binary string. + * +*/ + __pyx_t_10 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL}; + __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_mstate_global->__pyx_k__13 = __pyx_t_5; + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = NULL; + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL}; + __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(&PyTuple_Type), __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + } + if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_exclude, __pyx_t_10) < (0)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_37from_bytes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab_from_bytes, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + __Pyx_CyFunction_SetDefaultsKwDict(__pyx_t_10, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_from_bytes, __pyx_t_10) < (0)) __PYX_ERR(0, 585, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":614 + * return self + * + * def _reset_cache(self, keys, strings): # <<<<<<<<<<<<<< + * # I'm not sure this made sense. Disable it for now. + * raise NotImplementedError +*/ + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_39_reset_cache, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab__reset_cache, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_reset_cache, __pyx_t_10) < (0)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict +*/ + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_41__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_10) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Vocab, (type(self), 0x25af36a, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Vocab__set_state(self, __pyx_state) +*/ + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5Vocab_43__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Vocab___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_10) < (0)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":619 + * + * + * def pickle_vocab(vocab): # <<<<<<<<<<<<<< + * sstore = vocab.strings + * vectors = vocab.vectors +*/ + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_3pickle_vocab, 0, __pyx_mstate_global->__pyx_n_u_pickle_vocab, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pickle_vocab, __pyx_t_10) < (0)) __PYX_ERR(0, 619, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":631 + * + * + * def unpickle_vocab(sstore, vectors, morphology, _unused_object, # <<<<<<<<<<<<<< + * lex_attr_getters, lookups, get_noun_chunks): + * cdef Vocab vocab = Vocab() +*/ + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_5unpickle_vocab, 0, __pyx_mstate_global->__pyx_n_u_unpickle_vocab, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 631, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_unpickle_vocab, __pyx_t_10) < (0)) __PYX_ERR(0, 631, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":644 + * + * + * copy_reg.pickle(Vocab, pickle_vocab, unpickle_vocab) # <<<<<<<<<<<<<< +*/ + __pyx_t_5 = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_copy_reg); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_pickle); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_pickle_vocab); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_unpickle_vocab); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_6 = 1; + { + PyObject *__pyx_callargs[4] = {__pyx_t_5, ((PyObject *)__pyx_mstate_global->__pyx_ptype_5spacy_5vocab_Vocab), __pyx_t_11, __pyx_t_12}; + __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (4-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "(tree fragment)":4 + * int __Pyx_CheckUnpickleChecksum(long, long, long, long, const char*) except -1 + * int __Pyx_UpdateUnpickledDict(object, object, Py_ssize_t) except -1 + * def __pyx_unpickle_Vocab(__pyx_type, long __pyx_checksum, tuple __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_result + * __Pyx_CheckUnpickleChecksum(__pyx_checksum, 0x25af36a, 0x339b8d5, 0xd74a244, b'_by_orth, _lookups, _non_temp_mem, _transient_orths, _unused_object, _vectors, cfg, get_noun_chunks, length, lex_attr_getters, mem, morphology, strings, writing_system') +*/ + __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_5spacy_5vocab_7__pyx_unpickle_Vocab, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Vocab, NULL, __pyx_mstate_global->__pyx_n_u_spacy_vocab, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 + PyUnstable_Object_EnableDeferredRefcount(__pyx_t_10); + #endif + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_Vocab, __pyx_t_10) < (0)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "spacy/vocab.pyx":1 + * import functools # <<<<<<<<<<<<<< + * from contextlib import ExitStack, contextmanager + * from typing import Iterator, Optional +*/ + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (PyDict_SetItem(__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_Vocab___getitem___line_287, __pyx_mstate_global->__pyx_kp_u_Retrieve_a_lexeme_given_an_int_I) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_10) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + if (__pyx_m) { + if (__pyx_mstate->__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init spacy.vocab", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init spacy.vocab"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #else + return __pyx_m; + #endif +} +/* #### Code section: pystring_table ### */ +/* #### Code section: cached_builtins ### */ + +static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 314, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 101, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 409, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(1, 619, __pyx_L1_error) + + /* Cached unbound methods */ + __pyx_mstate->__pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_get.method_name = &__pyx_mstate->__pyx_n_u_get; + __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; + __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cached_constants ### */ + +static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { + __Pyx_RefNannyDeclarations + CYTHON_UNUSED_VAR(__pyx_mstate); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self.name is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state +*/ + __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_self_name_is_not_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); + + /* "View.MemoryView":583 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) +*/ + __pyx_mstate_global->__pyx_tuple[1] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(1, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); + __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[1], 0, __pyx_mstate_global->__pyx_int_neg_1) != (0)) __PYX_ERR(1, 583, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]); + + /* "View.MemoryView":680 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False +*/ + __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(1, 680, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]); + + /* "spacy/vocab.pyx":146 + * # We don't know how many we need, so it would be awkward to have + * # them as nested blocks. + * with ExitStack() as stack: # <<<<<<<<<<<<<< + * contexts = [stack.enter_context(self.strings.memory_zone(mem))] + * if hasattr(self.morphology, "memory_zone"): +*/ + __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]); + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = ('self._by_orth is not None or self._lookups is not None or self._non_temp_mem is not None or self._unused_object is not None or self._vectors is not None or self.cfg is not None or self.get_noun_chunks is not None or self.lex_attr_getters is not None or self.mem is not None or self.morphology is not None or self.strings is not None or self.writing_system is not None',) # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Vocab, (type(self), 0x25af36a, None), state +*/ + __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_kp_u_self__by_orth_is_not_None_or_sel); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(1, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]); + + /* "spacy/vocab.pyx":26 + * + * + * def create_vocab(lang, defaults, vectors_name=None): # <<<<<<<<<<<<<< + * # If the spacy-lookups-data package is installed, we pre-populate the lookups + * # with lexeme data, if available +*/ + __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]); + + /* "spacy/vocab.pyx":379 + * self.vectors.add(key, row=row) + * + * def prune_vectors(self, nr_row, batch_size=1024): # <<<<<<<<<<<<<< + * """Reduce the current vector table to `nr_row` unique entries. Words + * mapped to the discarded vectors will be remapped to the closest vector +*/ + __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_int_1024); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]); + __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]); + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_tuple; + for (Py_ssize_t i=0; i<6; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_slice; + for (Py_ssize_t i=0; i<1; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { + CYTHON_UNUSED_VAR(__pyx_mstate); + { + const struct { const unsigned int length: 10; } index[] = {{2},{68},{35},{54},{37},{60},{24},{52},{26},{34},{29},{33},{45},{22},{14},{15},{179},{14},{37},{663},{30},{32},{28},{1},{1},{1},{1},{1},{0},{8},{5},{6},{15},{23},{25},{7},{6},{2},{6},{35},{9},{30},{50},{39},{34},{8},{367},{21},{6},{11},{12},{16},{12},{15},{20},{26},{13},{11},{11},{15},{12},{13},{15},{20},{32},{22},{12},{14},{30},{37},{5},{10},{4},{4},{4},{4},{4},{4},{4},{4},{8},{6},{9},{7},{8},{9},{7},{4},{4},{8},{20},{8},{7},{11},{15},{5},{14},{23},{25},{28},{18},{14},{25},{16},{15},{16},{16},{17},{19},{19},{16},{14},{13},{1},{0},{3},{3},{8},{11},{4},{15},{15},{11},{7},{17},{18},{4},{5},{4},{1},{4},{10},{3},{10},{1},{9},{17},{22},{18},{5},{6},{10},{14},{8},{8},{5},{12},{4},{6},{19},{7},{8},{19},{8},{5},{14},{5},{15},{6},{11},{9},{13},{9},{5},{6},{7},{6},{8},{1},{6},{11},{7},{5},{6},{7},{10},{28},{37},{9},{8},{9},{3},{16},{15},{8},{15},{9},{10},{12},{7},{9},{10},{1},{2},{10},{14},{5},{7},{12},{13},{7},{7},{5},{8},{8},{4},{3},{7},{4},{8},{4},{14},{20},{3},{16},{9},{11},{7},{8},{10},{3},{11},{7},{6},{5},{4},{10},{5},{10},{12},{4},{8},{4},{7},{8},{4},{11},{6},{5},{3},{8},{3},{5},{4},{7},{4},{7},{4},{6},{12},{12},{12},{3},{8},{4},{13},{12},{14},{12},{11},{10},{19},{20},{14},{12},{4},{10},{17},{13},{8},{5},{12},{13},{6},{6},{3},{12},{5},{6},{4},{4},{17},{8},{12},{10},{10},{12},{19},{7},{5},{4},{11},{5},{6},{5},{5},{5},{4},{4},{10},{5},{6},{7},{11},{6},{8},{8},{7},{16},{8},{9},{5},{8},{37},{26},{7},{8},{7},{4},{6},{6},{6},{6},{14},{14},{6},{12},{4},{4},{5},{6},{6},{7},{14},{12},{12},{5},{5},{4},{14},{1},{2},{5},{22},{123},{11},{134},{177},{2},{9},{338},{34},{119},{187},{71},{7},{127},{225},{80},{179},{500},{55},{45},{35},{37},{72},{108},{10},{9},{12},{92},{51},{39},{96},{1}}; + #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (4131 bytes) */ +const char* const cstring = "BZh91AY&SY+\250w\032\000\003\027\377\377\377\377\377\377\377\377\377\377\277\377\377\377\377\377\377\375\300@@@@@@@@@@@@\000@\000`\020\r\276\036\324\250K\336\354\010\256\036wv\346\216\306*\235u\247\002W-\t\225\rv\351\356\314\300\002=\360\224A\022b\032\233M\001\246\232\236\200\r1\032y\020\320&!\244\321\344\236\200\232z\233S@\3204i\204\331\rF\320\010\031 \023\020\020\321O\324\323A5?A'\265#\321\006F\215\000\001\210\000\000\003@\000hh\323@\000\320\010\212\217\324@\320i\241\221\24022\032\r4\003@\003\324\3202\001\2102h4\001\2402\r<\240\022\232 \010Hd iM\0311\265\036\240\233(\332@\003 \000\007\2504\000\000\000\000\001\352\002\014\000\023\000\001\030\000\004`\000\215\030\232`\t\200\000&\021\204`&LF `H\220\202d\311\245?H\320\236\251\340!\023d\362P\362& \000h\320\003@\000\014\023M4\332\203@\000\037\362\"[H\267&\335F\374wa,\"\3370\370\312>m\266&;\030\035\345*(\254C\310\323\227\327\314?D3\353\330\rb\270\207\013\013#&4\260$\241\300D\010$Tup\362l\375\271\223\210\2079\317\304\357W\247\362=\366V+\035H\3061\214c\376\200\177\344\001\002\002\210\231\324\200\353\023H4\366\003\177o\001\254\252\252*\035\244R\223\t\236B\234\325\200P*.B/C\001\2661\014b\006\305r+\002\261h,E\201\304N\360\r*\360\242k\243\330\364\016\241\360G\263\372\375*\274^\327\213\023/\000``\003h33Ym6\355\022\006\304l-\025\266\266\332\013\231EEB\2015\377\216\377\202D\306]X\343\023Hdf\343e\t\220L\303R\202fh;\006\"B\333m\201\002\263H\201[V\266W\235\357/x\254\n\244\004\211F\320\256O)\244]\314\230\214E\244][-*\333q\033\266j\212\272A\253\326\276}'I\267'%\3502\230P}\n\326&\311\223\021\242\346\260[d\330d\256\023l\222aV\026\261-u\267]\253l\002\006\300\007GTu\306p\276\277\322\316\262~]^)\210\"{\312\300I\020i^\352J\225U\300\002\252\212\210;\315d\007b\323\340H\241\240\370!d\273\355E\204\221\365#\355\245\216k9\201\372\236\322/\237\014F\202\330\266d\241U\244\nz?\316[\231\016T\356\366 \247\322\220\311XkC\024(\262\241`\241\256E\323\305k\372\025y\2427;\333\026\275\263=\270\177x\242\311s\374\351^\306W\033\311\206\252*\242Y\374pH\3174\245""\277Va\3747\263.L\361\263\031\264ky\274H,Np\236r\220LUz\322\\#5~\"\370[\265\225\372\353\326y\303u\036\217\232\307u\217/\274?\237W\356\242$\322N\363N\360S\275C'G\267\261\1773\373|a\360_\321\2437\240\322$m\251\311\345\005\013\326\243\372!B\321\275\331\352\321 9\222Q>\322c\026\324MS;\216\332\343t\364\216\tJ\230\033\313\000\036.J\353\026j\277\035\202\246\327u\203\250\260\371p\254\304o\346\010\007\316\234\034\025\355\201\274\214\n\n@\327\355\232\223\232<\311\342\034Rq\352\210\310\357%u\"Rj+A8t*t\262\252+\353O\227\371sAF\216\350\226\030\336&c\340b\322\240\324LI\020\353\017!\036\310\0305Q\260\2671\331VXVO\216\260\026\201\036\214\014\244\221p\201\213 B\200\005\025RR\203\324L\2479\314\001\357\362\246x\017r\250?\024\346f\004\313D\352\031s\t|\177-\033\025HH\310\210\254\005\254HiK\343\353\233\231\222\220!3\322\214\225\237\271\235OrJ\240\315\225\2514\3616\333q\\\322\031\001E\036\342\320\332\242\213Zi;;\375\364\313\362\321\267\355\344Q\004\300I\343.\321^\346`\250\027-r4\250\302\025\354\351\266i\322\341\245\211\231\205;P\327\235u\316K\224\274\212)7\244\001x\023B\371\263xf\325\253\375T\254x\3711\t&\326\3264\350\022\336,\273\352Uo\373\242\341\0304\025'\246\n\244^\210\021\370O\313\277x\361\346\035\261\323302\227\277\2151>\313\373\277k\203#\251\237Q\330\2136i{8e\363\022\014#\253\344am2\002\356\357Tf7\235\243$i\347\322&`H\305\206B\334\010\2249\331W\034\263\215\033\232\032\323e=\321\np\027\004\0162p\257\312\021y:\373\273\244;am.[\235\035U\016\266:xn\253\254/\337\321zq\364l\3315w\364\333\320\274e7\201\232S\307V\034a]\343\t\211\211\231\360\211@o\302\0200\316`\374\374\032t\362\0212\364u\213[\322P\325\276\030\260\244\347:\302\005\233\233vc\306K[\237X\270'^\207`\003H\300P\335\"1\331\225!Nc\231GW\235y\303\016\ts\317\347\335q\223\344\022-\355\356Zx\t\342:c\010\316z\024\215\377\2553\031\016w\367\021\315\241F\010\017\262\254Xy\001\240\313\317pb>\\\216\204 \235(\255\333\356\346\267\034\324\224J\272@i\323Y\303\352z\250\241/\025\343\\\360\362\347yi\230\355\331\354K\262\355m\257\257\200BT{\0252\334""\016\355\237\221\315+\240=\350drs\220\2449\276J\220\311q]\323\362\301i\2475Q\255\345\023\323\025\222\326\317\262/7j\332\323%\264QI\025\314\025\360\330\002j\371\323n-\250\027X\315u\261\270^\246\252lV\230\270\252f\252N\r;,\243\034\264\222i\266\321L/^\177\250_\213\257|\337\3721\223J\375\213\204B\306\221=i\274\234\022N\273\244K^P\320\215&\213\260\360Y}\233w#\007\346\234X\224\036O\030\027C\216&\313\017\\\272R\ti$L9Dr\355\332 \310\004W\006\363\003]\301\340yue\021\344\215\227\234\r-\304\375|\301Y\362Th\332\320\266\310I\0025\0304\0279\366\n\354\350C\210\336E\026\342\203\363M\243snP\215\313\262\025\267\2767+X\222B\261\241\030\214\321F\351E\246\366\256\223\306\260{\234\350aQ\254\340\020K\313\325\267i\214O\271IdJ\256\320\246!\314\210\234H\330\341\300\031\265M8\235\316~\023\035\021X\222\260\234\0045r\276\255\352\361D\251O$\215\334Z\252\271\260\266\n\222e\216~\035$,\372\257\260Z\360\371\227\002\332K\033\275\371M\022\250\205M\362,\270\303 \331d$j!\nI\331\250\021Q\001\305\266\262\253\006(G\327\223\202\034\224\214m$\2259B\0102R\272\351r\326*\367\300\213\024e8\306\335Z\335%u\205,\305\036Ut\221Q\\4N\010M3{\352\320)|R\275V,2\235\224h\252\302\311\025r\354\r\310\3342\363\345\177ag\367\275\233R9\026\345\353q\326\201\031\255A!\352\211U\r9\342\310\260E\351\013\206\334\027\234-4\263I,\032\322V%\243\217D\224\236\263\211\3435\245\323\273Q\323\314v\325\302\365\234\031\314\240\360\246\022\026\212\361q\274\3410\0222Y\274W\251\317l\032\317B\007\266\226\242z\261#j\316;v\177M1\342N\323q\325\231\3543Rg \302x%T\327P\305@o#\035Q\2423\244\257+\025.\343[\212\325T\302]\203\314\351\356\343H\030;\370d\251N\031b\025\304\207v=2\ru\3633\206a\250kz\307\"\002L\311\322\227N\224m\247\262\314X\333l\033`\362k\202P\323\0079\320\\\325\226`\312\031\013F\346\346a\030\210>:BO\276r\361\217\200\266\014.\204t\235?2\357Ck\030;\220\254\323p\303\211\033\003^\255\263\202\355\221\026\031\367n\224\274\216\216U\033n\303Km\341:\206\310\016\220L\241\226\217\213v]\341\377\246Y\255-\231\364\203\277 \271\2450\336:\227w\253\342?\215""\220b\327\003\204e\215S\017\216TTH\206\271\233\030,\244\240\343/\353\353\307\336\226\236? ZnG#tK|;\336\214\312\366\225\227\375Z\357B\201\261z\215\2714UTU\2251\352\017\247D\305\311|<\345BD\373u\007\310iT\231\310\3660\314\254\303C7\332\220\305\014~6u\351}\017Rr\2474+S\033AF9\341I\"\240\"H\034\364\242\353R\017~ \365\201v\353L\251\342\256\010\037\nfp0\245\245\216\302\365\026\030\003\017\035^\026\263\\\271\327\3206Vd\343\263\227\232\362\327\024J5\220\212HZHdK\306\306\351\345\346\256m\013\345\222.8\232i>\376b\315\251\2314/I\340\251\240Gj\002k\032\207EFXUoC\271\363\2509D\271\333\322KY\333\307\002A\350\354\313\344k\2422\330\026*\311s\274\256\247\"\260U\226\204;\235RR\242\313\025\345\0342\013[R\344\r\344\032\360\355W\323%:\277>\315A @\243\217\252c\306\370i\3525\274{\307NiW\273c3\030\362W\021v\323\254\230\223N\270\203\271a\365W\205\003\216\361\353a\341H\010Wk\302\207P|\031\224\221\215\266\354!\356^\330N\\c\330\315 \253\270H\233\340\031A\264C\273\241\350u\3550\020&B\002\242\253\n\035\250\325hb\361g}\010v\033\260\222\022\020\355\326\260g\\\004a\264\032\0353\350\300\203I\304\022a\320?\"\3069v\213\033\213\032T6CdA\261\254\255\310f6\024\357u\21166\230\332+Kppy\343\203\206\013\357EEf)WY\005\311H\300\256\221\214\023\337\200\224\327\230\221\347&W\367\t\212\300T\323\332&\370\246\363\334#\311\347\362\240\276\230]B\031\2445\016C\241\252J\034sk\026R7\325*hM\246\325\312\336\306p\245iJ\304H\325d\347\315p\003cb\317YF\321U:\340Yt\306d\251\001\345\362\306\255\266\235\301rCb\312\200\"\023~Z\025]\322(5!RXT$*\232\223\214\342\332\321\331\242\205\006I\205\245\023x\016\204+\351\016lm\247N\0328\235\355\273\366\275R\203\n|\362\n)\265m\336KH\312*\321\300\274\260\362\305\347\035`H\211w\345\337\367\236\n\005%7\0139\"\032\210\224\270\262\204 \004\334\037z\t\r\2227H\211\220G\021\313T\216\303\010C\343Kl\253DVs\207d\330\"\226\255\341\225ZL\221\267E\207\035\nNm\027\2457\014\024\273jrav5`\353;i^)V[\365\256\326\316z+\222\256\356\371\r\223m\006\r6\021\r\342H\224\241\265\003ASNI`I#w\t\267n\351\231\234\027\301""\200\302\350\273?\035w(\314\334\\\026\036\013\342n\206\225/\343y\0019\333\024G*\232\025\256O\023\210s\257j\252Jj\252G+\241\344\373\2539\342x\275)\034\246\267\254\\\203_K\264\301\204I\325\263=\312ir\202\260j\324\225\250k\240V&+\026K\256\221\223\236,+\215\314`1\33459\242\320(/\216%\215\025\362'l\353\277u^\"\001^\002\310-\236a\216k\254\246p\274\240C!#\235R\317mt\227\226\006\037\2537gY\020\005fn\206\313;7=T\210n\2148p\304\246V\355i\274\276\302\374y\207u\261\3026\200\306\261k)\370\216a\0035\223\233\204\317\257\275\240p\267?""\273\362\361\337z\254~\010\346\244\017HG,u\254m\226WEFt\006\306ylG\3409\0218\333\355\324\023\274\214\034fk\017\347j\276I\"L\251_\276w\271.\027\3516\035\260k\265\243\305D\375\232\317pZ5\2656\030\325\017N\304\010\337\340\265\335U\3778\021\273\306\320\300\3509\2600}\244\361.\252(\275\001z\033,\332\373\371`\200]M\375\372\343w\006n4\331U\1771\253\256Z\3266\n\375\027#\205c\274\334\206\252\352\244\315\235\206@\002\353\250\370^d\246\245\235Mtb\351\252/n+3\"NQ\335\3357\351>\342>\2675\205\340\340\367\220\362\351v%i\264u\227\225\353\226\022\275\213\014N\273\021#\007Y=\032'Z(\351\273{v\271a\274LM\026\261#K9\361\257Z=\361l\270kF-\222\301\243\025\204\336_\204Z\021\226\031\025\216=\017\217R+\035B3\323\025\215\324\0266\034\214\031\244UJ\307\235X\253\022\245pv\240\257\253\241\334\371R7{\025\n\373\275\374\362\2359\364\343\\\336\226A\225\321Fq\013\215\300\252\252\242\343\345\343b\342\372\260\302\226\257\203\236\246\376\371kZ\351(\371\206\232\355(\026\260\r/:/s\363\301\277\366|\376\374\037\243\003\253\\f\024\376\242\337\247G\247\271\225\222P\332\3112M\233\271\262g\2326LO\003\260O\366E\233K\206\316L|\324\354\236\024\360\236\022\261\022\033\322qk\350T\317M\276\010\322\325Jt\350\310\334\324\234S\247\327;\210s'/\267\334q\376\371\331z?-\257\003m\203\210\024\356\016\355\321\007\201\236\3518\323\206y\252\036\206\315i4\204\2033\334I(`(gsD\233\004\244D\325M\225\244\252\236s\202{W\206\222\22018Z\031\225\346\216\304\021\234B\242\0319+\223\260\254\020\007#fW\014\002\264\303\312\032\361\350\312:\305\235\222P\276j+\307\352\211\222BK\377>\232M>V\245\266\321\252\247.\"\356H\247\n\022\005u\016\343@"; + PyObject *data = __Pyx_DecompressString(cstring, 4131, 2); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (4029 bytes) */ +const char* const cstring = "x\332\255YKw\323X\266N\210)\034\010T\002\341\321TU\267\302\243\022h\312\020H \320\220^\256\304@\272\t\2208\004\250\\J(\322q,\"K\216\036\211\315\275\353\026C\0175\324PC\r=\364\320C\206\032z\310O\340'\334o\237#?\222\270z\335\325\325,\254\363>g\237\275\367\367\355}\340\201\2245\014I\323K\314tt\313t\244\262\315T\246\351\346V\267S\272\252I%\317q\245M&\351\246\306*L\223\024S\223L\313\225\034C\307\364\237\275B\201\331\322\256\316\366$\315b\016\037b\225\262\3450\311qm]c\316\202bJ\226iT%\325f\212\313$E\332\024\213\334\242\342J\272#\251\226\351\352[\236\34598D*\261\222eW3XE[)\216\243o\231\222kIX\254\375\304\367\0213\350\310dR\262\361\236\255\273\312\246\301\222\tB\250\202m\225\376\325Z~-iOw\213\222[-3i2\351wm\305t\3705\272K\3044\254\320\241*\267Gw\213\275\n\323\205\022\304\244\\\251\354V%\247\250`k\327+C\270\202eKj\325-ZfF\261m\245\272\304\005\260t\351\335\341%pM\333\355\256\330\340\023\337I\217zv\331\360:\313;\353\027_,\344\037HE\327-;\017n\336t\312\212Z\315\350\326M\245\254\337\344k.o1WwY\251\263 \357\262\262TR\252\034\362\240\340\217\314\266\272\334\360\312\344d\007\277\207\311vI\"ZLmk\223\220\267\316o#\313\311\256\262,M\031\272\311\244\333s\367\256\375=3?yM\3214\331$|\023Z%@\374VE\265\014\203\360\004\236\311(\233\352\303\036j\246I\002m\363\007\273\333\2148\257\351\016\311\304\270d[\2524E\254\263\305\311\220@G\216\313*.3]\316\364\3350\003c\363%\032\tJ\316'=|$\335:D\225\246\005\356)(\236\341J\262\014px*\303\2554\217+\301\264\314\237`\271]]10\252\352\246\356\312\262\351\225\312\325\214\254\002J\231\022\326\351|\037\251\240\350\206 \034\275D<\332;\315+) \371\2033\022\235\316;\314(d\344\315*\034\236B\201`\343\347\026\324J`\344\203\206em{e\247\377\240I\334\305Je\031Q\245\377\014\317\364\340\372\2628\257\377\224]\214Xv\377\023\324\302V\337~x\001\016\367LY-z\346v\377\265\300\223\254\270\256M.\003J\357?\351\367\004G\324(\027-\303\332\252\366\035NP\325w\214\0027\006e\247\352\270\373w\347\303\246\"X\262\323\311\221#\276$\256#\252\252U*+n\273\0166\254\270\210S\242\315\210e\222y\005\317\204\372,#i\032\nH\260}\363\336>\260VIf\025\225\361x\322\036\021\306\025\r\3566\21146x_T\335\242n\252\031\240:i\362H%\352\211\341xC`>S\256V\036\212DI\333\007\261\303}\234\313\315~\343\235\336D\311\231\017\216e>L\032\226g\253l\336\353\220\205b\030\226\312\3630\016\005Mq\225L\237Q\221#\320\356I\032\227\311\346\027\226\226~\316\346s\362\363\027\253\313\371\334\255\231[\271[wo\343w\007\277\031\374fs\267\346fss3\367ss\263s9\303\320\313\216\356p\202wr\025\335\315\273\212\272\275\224\227\363k/^\266\223\216g\2717rvmm5\377L(v\031\021\202\266o\007qY~Y\255\340\267\210$C~\016\223\256\262B\236\355x\314T\331\272\320fR\320J\312Z2\335\004\2063`\233\006A-\266,\267[\t{\010v\351v#\325p\220a\034\032P\r\246\3302""\317\tu\320\027G\277\223\214\331\360RWV\025\265\310D\017\361j\301P\266D\013FB\336\307\003T\033\270b\2002S0\211\313z\333`\320m\321$\300\212\371\242]T\234}m\221\226\312\037\001\010\321Q\266=\363\300\021B\264}]\316\201m]\253W\006\264H\002\031\334\217[\264/Be\342\370\250\332m\037\221E*E\315\275\256n\024\003\2126\025\312\311\024\207\373\230\342t\343E\322Q5U\335\002Jm\344\275\210I\016a\217\343\217\202\333\346\246\342\260M\305U\2132\305\202M\335\345\022\312\344\252*\250\235rCYnW:\341\255\277\221T\212y\262nR\277\212]\325m\325@V/\310\242K\023I\255\244\230\n\222\250\244\005\271\313U\330wK\005q\272\"I\2239lI\024\215Q:\323\307\274I\214J\n4\221. *\341*\355\0312\264\014\177N\n\rJg\364\372\242\034F\243\304\230\177d\335I\242\000\234\035'!Vz6\223!vQ\226q?rgQ$\3422\360\021O\3139\333\t\312\003\177\031\036\326B\255.\216E\211c\013\005\035a^#\323&T\317\253:\357q\020u\021\002\223\227C\327I\273\265\314C\262\277\341\314\243\242\224\240\213\371~c\207.\335\361o\010\000\n\026_N\304\220\201\274\235\373\206\214\227\214\207\344\201 \345\3316\267c\231f\310D\312\007\242\0305\371\223\257\013\026\236\357\010\014\267\303\030!\207\317\352BHG\312*\213\310.\223s\364\200\211?\010yJ\311\034$\257z\241*\"\003\231\243\343\260\250\027<\020\234\203\254\327*\213\254%I]\332L\263\315Xy\233U\361\367\266m\355\241p\332\332\242\213\354\217:\375\342\r\006\017\306\343\356|\236\370\312\264\"\301\245,\227\024\334\003\337\212l0s\313-\342J=\267B\225^\260%\006Z\323J\333\210\027\364b\224\023mS\211\350\335\r\341%\313q\001\276\222n(6\205_dR\342\213\234\r_\266'>\270\230c\302\363zLb\332\324\313##\234\327\262v\345\262mm\302\204\204F\016I^\3215\304\300\355\262b#%3\310\245\313\272\272m0\361\2255,w\222\272a)Z\273\316\261W\266\312e[\207\r\001\022l\275\217\366d\031\361\024\\\\\326\211 x\275\310\324m\307+\211\026\010\021\220\024\365\304I\250\312\341\306k\236\231\034\2253\333k:]\234\"E\337.\367':c\307S\014\241\033\240e\273\233\226\036\n1\235\016\030\2218\005\200\004DYI)\367F\220}\214\215\006\034\312f\256g\233P*\376R\346\311q\346P\256*>""\224#!\177\326\016\001\216v\342\300\246\260\226\030\260gw\326f\250\236\260'\367\t\201\216p>\236\020\220\213i\266\247\272\010\0132\001\205Jr-\224\226Y-\241p\341\326z\2222\300\310\264?\276\355D\313-bv;\220\265\313.\023\365!\340\303\223\332\340L\" \n\356\303\256\225l\niy\"\347\201\023\356\316\340-\213\034\004\236\201Kw\374\203\253d\177\376\356\225\021)\030::j\365\334\302\034(\304\330\245\307/\3778B\246D\262\266#\013\020\267[d\274v\235\234\225\037\265\247kn\221t\273?\177\256T\312\364P$\362\242\227\241\343J\003\313K\371\374\322\363'\362b\356e\234\272U?Z_\371zz`\370\370\327\021|Z#\347\375\235\356\347Kz\244\366O\177'\030\t\227\242\225V\372Dm>8\023,\206\203\255\221\321xt\"\034\013\247\242+\221\321\230h\215\216\307\343W\303\265h,\372\261>\334\030kL5\2574\213\237?\304o\336\306o\177\241]\376\341+-\024\317\2024V\247\277\255\355|\032l\245.\207\323\341\343h\"NM\327\307\276^\031\030\036\251\315\3713t\364\250\177\314\367\202l\220\307\344\3213\350\333\013\264p\2425\376\347@i\215\237\3752z\316\377\020\016\206\347\302\235\326\311\263~>\030\n\356\004\305p3\202\\\247\375\353X\267\036\316F\307\242\235\3727u~\352\023\177\2725\362m\255\032\014\006\177\n\377\032\255Dj}\014\375\361\310\017\301J\260\035\215q\201\342\324\325\360\277 G\232\344\230\251}\014\306\202+\301\207\303{\036\213\357=\375|2~E7\213\177\3715\376U&\305\334\365\317\007G\2035\310\264\027)\207\305\330j\2547\247['\317\370\367\202\t\272\336\211\340^8\021\316E3\321\307\306\271\306\316\227\221q\177\t\323\357E\327\353\213\215t\363\233\246\322\33498\357|3\325|\372\371q\274\232\217\363\257\343\327o>e?e[\177\271E\372F\0052\374k\241\237\177.\305\033r,\277\217\337k\261\306\304\202\212\277\013%\237\210\246\017,h\215\236\365\327\202\013\341Xk\364\373 \373%}\252f\005p\200\223\361IR\231\006\273O\264\322c\376i\177.\230n\235&\013\355@\271\343P\300\371(\025=\255?m\365\027\003\350\362\254\277\342k\3015\330a:q\233\365p\372S\366\353Er\225\007\030,\0048\233\264P\t\\\362\351\370\372\003\200\"}\021\306P\202\235V\032\350\270\022f\303\370%u\262\266R\333\006\306\241\276\350~\3751hhBt\026}\035\016\260\023\035\257_\255\357\264\222.-\270\021*\344\306\343\\\240\245p\205\232\303_R'j\263>N\374S0FNX!y.\004\351X\232\256\217\327W\210R\340\020\237\006\301\024GO\325\326\374\357\340o'\242\231\370\346\337\033n\274\260\036\257\203\026\266\343m+\266>\306\037\377\367\353\300\300o\203\271#(rG\226\250X:\262A\305\306\021\231\n\371H\221\212\342\021\203\n\343\310oT\374vda\010\305\302\320\022\025KC\313T,\017\375B\305/C\277R\361\353P\221\212\342\220A\2051T\032j\2458\321\301c\350V\251c\237vk\257\375\034\000\265\"\000\223\346|~\001\376\2141\334\350\333\370\333\037C\r\212\272W\377k\343u\023J\335\327\263B\004}\262\366\n+S\247j\014\014\232\"\264\214\265Rg\375W \261\324y0\3642\010\037\350\353\3148\347\263\200O\314\0221\277\r\266\342\253\263\361\354\223f5~\271\022\247\256Eg#\345\3538\221\202\353?\024\036\177\002\336\360:\310\nG:\016\256\233\215\216\220\357w\372\311\354\367\203'\3414b\214\3774\370G\250\204\273`\021n\206C\213\247\377\2631*N\335\214v\276\336\375\267\002\302\037\342\326\036\356\031\365\007}r\363\341q\177Z\320""\031\217f\027\343\213\327a\251;\221V\277R/6\024R\324.B!A3KP%P\022r_s\374\244A\234\027>\303\235\211 W\004\265<\205H+\301fx4\\\307>\305\372v\363\\\223\374\242f\373\027p\327\211`\0060~\034]\206\2667(\"\361\241x\354r\302\024\310\033\020\326V\033;}\373W\032\\\227\375\250\367\364\347\373\361\032\224\365.~\307bV a\256\003|k\321\205\372\017\r\245\261\333\334\200\267\264\322g\200v]8\311(\241q\244\266\200\010A=C\341\375(\033\255\325\307\352\023\373Y\273\030)\221-\272\273\244:r\016@\237\342Qt:\372\0313\020X\307\201\222\211\3406\256\257P \031\363\257\005\367\2416\221\227|I\375%\330\211\245[\365\023\215\2775\267)N\244\316\370\263\344\0240\031\260\363?<\210\247'A'\351\372)\334\023|1\035\247.\205W\303\235\257\243\277\233I\tG\316\006oC\2456\330\366\353\005p\313(\r\343\343\"\324\321\305\270s\377\376\224\277\341\nN}\nQt\232d%\030f[\251\341\332w~o\361g\234\233\032\216\207\277#<\242\374\001\n\372\t\316:\330\235\023\017\177O+\271\360\223\241\027qv\336\007\315\0314\222\204\345\033\377 \336H\037gy\322u\270\377\\X\341g\035\036\031\343\204?\007v\316\372\037\343\211\333\365\211\372\264\3771\034\017\337D\033\215\301\306X\362\004\223g\371\303B\236\343\377\000\302\n\216x\372\272\003\342m \035\230v/y2\310\342\177\204\026\006^\274X\227W\263\317\3779\220[~\271\366V~\226{\223[\316\375?\327\366.\021\t\276\354JS\273\226\256I\327o\320\177a\335\220\332\335\327\006\212\212S\274;#\006\247\016\034p\257\214\227P\021\351\377\014=j\344e\245\234\027\023\260\315\357\314\301\203Gn'\352\327\006\3509\310\377\035\353\305\377\001\341\272\036)"; + PyObject *data = __Pyx_DecompressString(cstring, 4029, 1); + if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) + const char* const bytes = __Pyx_PyBytes_AsString(data); + #if !CYTHON_ASSUME_SAFE_MACROS + if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } + #endif + #else /* compression: none (8096 bytes) */ +const char* const bytes = ": All dimensions preceding dimension %d must be indexed and not slicedBuffer view does not expose stridesCan only create a buffer that is contiguous in memory.Cannot assign to read-only memoryviewCannot create writable memory view from read-only memoryviewCannot index with type 'Cannot transpose memoryview with indirect dimensionsDimension %d is not directEmpty shape tuple for cython.arrayIndex out of bounds (axis %d)Indirect dimensions not supportedInvalid mode, expected 'c' or 'fortran', got Invalid shape in axis Iterator[Pool]= Lexicon.size`, `IndexError` is raised. If\n `id_or_string` is neither an int nor a unicode string, `ValueError`\n is raised.\n RETURNS (Lexeme): The lexeme indicated by the given ID.\n\n EXAMPLE:\n >>> apple = nlp.vocab.strings[\"apple\"]\n >>> assert nlp.vocab[apple] == nlp.vocab[u\"apple\"]\n\n DOCS: https://spacy.io/api/vocab#getitem\n Step may not be zero (axis %d)Unable to convert item to objectVocab.__getitem__ (line 287)?.>')add_note and at 0xcollections.abcdisableenablegc (got got differing extents in dimension isenableditemsize <= 0 for cython.arrayno default __reduce__ due to non-trivial __cinit__numpy._core.multiarray failed to importnumpy._core.umath failed to import object>self._by_orth is not None or self._lookups is not None or self._non_temp_mem is not None or self._unused_object is not None or self._ve""ctors is not None or self.cfg is not None or self.get_noun_chunks is not None or self.lex_attr_getters is not None or self.mem is not None or self.morphology is not None or self.strings is not None or self.writing_system is not Noneself.name is not Nonespacy.spacy.attrsspacy.compatspacy.contextlibspacy.errorsspacy.functoolsspacy.lang.lex_attrsspacy.lang.norm_exceptionsspacy.lookupsspacy.numpyspacy.srslyspacy.thinc.apispacy.typingspacy.vectorsspacy/vocab.pyxstrings.jsonunable to allocate array data.unable to allocate shape and strides.ASCIIBASE_NORMSE040E062E063E064E065E085E849E858EllipsisErrorsExitStackIS_STOPIteratorLEX_ATTRSLookupsModeNORMOptional__Pyx_PyDict_NextRefSequenceVectorsVectorsModeView.MemoryViewVocabVocab.__iter__Vocab.__reduce_cython__Vocab.__setstate_cython__Vocab._clear_transient_orthsVocab._reset_cacheVocab.add_flagVocab.deduplicate_vectorsVocab.from_bytesVocab.from_diskVocab.get_vectorVocab.has_vectorVocab.memory_zoneVocab.prune_vectorsVocab.reset_vectorsVocab.set_vectorVocab.to_bytesVocab.to_disk_abcaddadd_flagadd_lookupsaddrallocate_bufferallow_transientalternativeasarrayascontiguousarrayasyncio.coroutinesattrattrsaxisbbasebatch_sizebitbytes_datac__class____class_getitem___clear_transient_orthscline_in_tracebackclosecompatcontextlibcontextmanagercontextscopy_regcountcreate_vocabdatadecodededuplicate_vectorsdefaultdefaultsdeserialize_vectors__dict___dict_do_deprecateddtypedtype_is_objectencodeensure_path__enter__enter_contextenumerateerrorerrorsexcludeexists__exit__ffilledflag_getterflag_idflagsformatfortranfrom_bytesfrom_bytes..from_bytes..serialize_vectorsfrom_disk__func__functoolsgetget_array_moduleget_current_opsget_langget_noun_chunksget_tableget_vector__getstate__gettershas_tablehas_vectoriid__import__in_memory_zoneindexindicesintify_attrs_is_coroutineis_fullis_stopitemsitemsize__iter__keepkeykey2rowkeyslanglang.lex_attrsl""ang.norm_exceptionslexlex_attr_getterslex_attrslexeme_normlookups__main__max_lengthmemmemory_zonememviewmethodmkdirmode__module__morphmorphologymost_similarname__name__ndim__new__new_rowsnextnoun_chunksnr_rownumpyobjoov_probopsorth_orthorth_idpackpartialpathpicklepickle_dumpspickle_loadspickle_vocabpoppriorityprobprune_vectors__pyx_capi____pyx_checksum__pyx_result__pyx_state__pyx_type__pyx_unpickle_Enum__pyx_unpickle_Vocab__pyx_vtable____qualname__rank__reduce____reduce_cython____reduce_ex__registerremap_reset_cachereset_vectorsresizereturnrowrow_by_bytesscorescoresselfsendserialize_vectorsset_flag__set_name__set_vectorsetdefault__setstate____setstate_cython__settersshapesizespacy.vocabsrslysstorestackstartstatestepstopstop_wordsstopsstringstringsstrings_mapstructsyn_keyssyn_rowssynonymsyntax_iterators__test__thinc.apithrowto_bytesto_bytes..deserialize_vectorsto_bytes..to_diskto_numpytobytestosstypinguint64uniqueunpackunpickle_vocab_unused_objectupdateuse_setstateutf8utilvaluevaluesvectorvectorsvectors_lengthvectors_namevectors_typevocabwidthwordwriting_systemxxpzerosint const \000MISSING_DEP\320\0040\260\005\260Q\360\022\000\t\n\360\014\000\t\n\330\014\027\220q\330\014\027\220q\330\014\027\220q\340\010\014\210K\220q\230\014\240I\250Q\330\010\013\210>\230\023\230D\240\001\330\014\020\320\020!\240\021\240(\250$\250l\270!\330\020\024\320\024%\240T\250\021\250&\260\t\270\021\270(\300$\300h\310j\320XY\320YZ\340\010\014\210J\220a\330\010\014\210L\230\010\240\001\330\010\017\210q\200\001\330\004#\2401\240F\250!\320\0041\260\021\360$\000\t\014\2108\2204\220q\330\014\020\220\007\220u\230A\230S\240\001\330\020\023\2204\220w\230d\240!\330\024\036\230a\330\024\025\340\020\026\220j\240\001\240\026\240q\330\r\025\220S\230\003\2303\230h\240b\250\001\330\014\022\220*\230A\230V\2405\250\007\250q\260\006\260a\330\010\014\210G\2201\330\014\017\210y\230\001\230\031\240+\250Q\250c\260\021\330\010\014\320\014\035\230Q\230k\250\021\330\010\017\210q\320\004%\240""\\\260\021\360\010\000\t\014\2104\210z\230\021\230$\230j\250\001\330\014\022\220*\230A\230V\2405\250\007\250q\260\007\3207H\310\r\320UY\320YZ\320Z^\320^_\330\010\013\2106\220\027\230\005\230T\240\026\240w\250a\330\014\022\220*\230A\230V\2405\250\007\250q\260\006\260g\270V\3001\330\r\023\2207\230!\330\014\020\220\013\2307\240!\2408\2504\250z\270\026\270q\340\014\024\220I\230V\2407\250*\260D\270\010\300\006\300a\300q\330\014\020\220\013\2307\240!\2408\2504\250z\270\027\300\004\300H\310F\320RS\320SW\320WX\200A\200A\330\0370\260\t\270\021\200A\330\010\013\2104\210z\230\021\230$\230j\250\001\330\014\022\220*\230A\230V\2405\250\007\250q\260\007\3207N\310m\320[_\320_`\320`d\320de\330\010\013\2104\210x\220v\230S\240\013\2501\330\014\022\220*\230A\230V\2405\250\007\250q\330\020\025\220T\230\030\240\021\330\020\034\230A\340\010\016\210o\230Q\330\010\r\320\r\035\230Q\230d\240(\250!\330\010\021\220\022\2208\2301\330\022\023\2204\220q\230\001\230\024\230T\240\027\250\004\250H\260H\270G\3001\360\006\000\t\020\210u\220G\2301\230C\230y\250\001\250\024\250X\260U\270!\270:\300U\310!\330\010\017\210s\220(\230!\2301\330\010\013\2104\210w\220c\230\024\230X\240U\250!\340\014\r\330\010\027\220q\230\003\2308\2404\240r\250\024\250S\260\007\260y\300\001\300\021\330\010\022\220!\330\014\021\220\034\230Q\230d\240(\250%\250q\260\004\260H\270A\330\014\020\220\005\220W\230D\240\010\250\010\260\006\260a\360\006\000\t\r\210K\220w\230a\230x\240t\250:\260U\270&\300\005\300T\310\030\320QR\330\010\014\210E\220\027\230\007\230v\240Q\330\014\020\220\010\230\004\230A\230U\240$\240a\200A\340\010\014\210H\220D\230\001\330\014\025\220Q\220d\230)\2408\2501\330\010\014\320\014\035\230V\2401\200A\360\032\000\t\014\210:\220Q\220f\230A\330\014\023\2204\220x\230t\2401\240F\320*:\270!\330\010\032\230$\230a\230q\330\010\024\320\024$\240A\240S\250\004\250D\260\010\270\001\330\010\013\2104\210{\230!\2301\330\014\023\2204\220x\230q\240\001\330\010\r\320\r\035\230Q\230d\240(\250!\330\010\022\220\"\220F\230\"\230D\320 3""\2606\270\021\330\010\017\210q\200A\360\022\000\t\014\210:\220Q\220f\230A\330\014\023\2204\220x\230t\2401\240F\320*:\270!\330\010\032\230$\230a\230q\330\010\024\320\024$\240A\240S\250\004\250D\260\010\270\001\330\010\013\2104\210x\220y\240\004\240D\250\007\250t\2601\330\014\032\230!\2305\240\003\2401\240D\250\010\260\006\260a\260r\270\021\270!\330\014\017\210t\2208\2306\240\021\240#\240S\250\001\330\020\030\230\006\230a\340\020\030\230\004\230H\240F\250!\2501\330\014\020\220\010\230\007\230r\240\032\2501\330\010\016\210d\220(\230$\230a\230u\240G\2501\330\010\013\2104\210s\220!\330\014\017\210x\220q\200A\360\022\000\t\014\210:\220Q\220f\230A\330\014\023\2204\220x\230t\2401\240F\320*:\270!\330\010\032\230$\230a\230q\330\010\024\320\024$\240A\240S\250\004\250D\260\010\270\001\330\010\017\210t\2203\220d\230!\200A\340\010\016\210a\320\000!\240\021\360\006\000\005\021\220\003\220=\240\010\250\001\340\004\r\210Q\210k\230\031\240(\250!\2509\260F\270(\300!\340\004\r\210Q\210h\220i\230x\240q\250\n\260%\260q\330\004\r\210Q\210h\220d\230,\240a\330\010\021\220\024\220Q\220f\230I\240Q\240a\330\010\t\340\004\013\2105\220\001\330\010\031\230\021\330\010\027\220x\230q\330\010\030\230\010\320 1\260\024\260Q\260a\330\010\025\220Q\200\001\360\010\000\005\016\210T\220\033\230D\240\013\2504\320/?\270t\320CV\320VZ\320Zk\320ko\320oz\320z~\360\000\000\177\001E\002\360\000\000E\002I\002\360\000\000I\002[\002\360\000\000[\002_\002\360\000\000_\002h\002\360\000\000h\002l\002\360\000\000l\002\177\002\360\000\000\177\002C\003\360\000\000C\003I\003\360\000\000I\003M\003\360\000\000M\003Z\003\360\000\000Z\003^\003\360\000\000^\003h\003\360\000\000h\003l\003\360\000\000l\003m\003\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220E\230\024\230Q\330\010\022\220!\330\010\027\220q\340\010\030\230\001\330\004\007\200q\330\010\017\320\017&\240d\250!\2507\260+\270W\300A\340\010\017\320\017&\240d\250!\2507\260+\270Q\200\001\330\004\r\210U\220!\330\004\016\210e\2201\330\004\014\210E\220\021\330""\004\025\220U\230!\330\004\027\220u\230M\250\021\250%\250q\330\004\016\210e\2201\330\004\026\220e\2301\330\004\014\210A\330\r\025\220Y\230g\320%5\3205G\300y\320PQ\320\004)\250\025\250a\360\024\000\t\020\210t\220<\230q\240\001\330\010\013\210:\220W\230A\330\014\020\220\010\230\n\240!\2405\250\002\250!\330\010\013\210:\220W\230A\330\014\017\210t\2209\230G\2401\330\020\024\220H\230J\240a\240v\250X\260Q\260a\330\010\013\210:\220W\230A\330\014\020\220\010\230\n\240!\2401\330\010\013\210>\230\023\230D\240\001\330\014\020\320\020!\240\021\240(\250$\250l\270!\330\020\024\320\024%\240T\250\021\250&\260\t\270\021\270(\300$\300h\310j\320XY\320YZ\340\010\014\210J\220a\330\010\014\210L\230\010\240\001\330\010\017\210q\320\004/\250q\3606\000\t\014\2104\210z\230\021\230$\230j\250\001\330\014\022\220*\230A\230V\2405\250\007\250q\260\007\3207H\310\r\320UY\320YZ\320Z^\320^_\330\010\013\2104\210x\220v\230S\240\013\2501\330\014\022\220*\230A\230V\2405\250\007\250q\330\020\025\220T\230\030\240\021\330\020\034\230A\340\010\016\210o\230Q\330\010\r\320\r\035\230Q\230d\240(\250!\340\010\014\210H\220D\230\001\330\014\020\220\001\220\021\360\006\000\t\024\2201\360\006\000\t\r\210G\2201\330\014\032\320\032*\250!\2503\250d\260$\260h\270a\330\014\017\210v\220S\230\004\230H\240A\330\020\030\230\007\230r\240\021\240#\240W\250D\260\010\270\010\300\001\300\030\310\021\330\010\020\220\005\220Q\330\010\022\220\"\220H\230A\230Q\230b\240\005\240V\2503\250h\260k\300\026\300q\330\010\017\210r\220\030\230\021\230!\2304\230u\240F\250#\250X\260[\300\006\300a\330\010\017\210r\320\021#\2401\240D\250\010\260\005\260Q\260g\270R\270q\330\010\017\210r\320\021#\2401\240D\250\010\260\005\260Q\260g\270Q\270a\330\010\014\210K\220w\230a\230x\240t\250:\260U\270&\300\005\300T\310\022\3109\320TY\320Y]\320]e\320ef\330\010\022\220*\230I\240T\250\030\260\035\270a\270v\300[\320PQ\330\010\023\2203\220i\230q\240\001\330\010\020\220\001\330\010\014\210C\210w\220i\230q\240\003\2409\250A\250T\260\021\260!\330\014\020\220\010\230""\004\230A\230U\240$\240h\250a\250r\260\021\260!\330\014\023\2204\220x\230q\240\001\330\014\026\220d\230(\240!\2408\2501\250B\250a\250q\330\014\024\220F\230!\2302\230Q\230a\330\014\021\220\021\220)\2309\240A\330\010\017\210q\200\001\340\004\037\230q\320 0\260\013\270;\300k\320QR\330\004\023\2205\230\010\240\001\240\021\330\004\007\200|\2207\230!\330\010'\240q\250\010\260\016\270a\330\004\013\2101\320\004\"\240%\240q\360\020\000\t\n\360\014\000\t\n\330\014\027\220q\330\014\027\220q\330\014\027\220q\340\010\017\210t\2209\230A\230Y\240a\210\001\330\014\017\210t\2209\230C\230q\330\020\027\220q\340\020\027\220t\2308\2409\250A\250X\260Q\260a\210\001\330\014\017\210t\2209\230C\230q\330\020\027\220q\340\020\027\220t\2308\240;\250a\250s\260(\270!\2701\200\001\340\004\027\220u\230A\330\004\t\210\033\220A\330\004\t\210\033\220A\330\004\t\210\036\220q\330\004\t\320\t\033\2301\330\004\t\320\t\035\230U\240-\250q\260\001\330\004\t\210\033\220A\330\004\t\320\t\034\230A\330\004\013\2101\320\004'\240u\250A\360\022\000\t\020\210t\220<\230q\240\001\330\010\013\2104\210t\2207\230!\330\014\020\220\006\220a\330\010\013\210:\220W\230A\330\014\020\220\010\230\010\240\001\240\025\240b\250\001\330\010\013\210:\220W\230A\330\014\020\220\010\230\010\240\001\240\026\240x\250q\260\001\330\010\013\210:\220W\230A\330\014\020\220\010\230\010\240\001\240\021\220x\230t\2408\2509\260A\220z\320!2\260!\2601\220z\240\024\240X\250[\270\001\270\021__pyx_t_5spacy_8typedefs_attr_t\000struct __pyx_t_5spacy_7structs_LexemeC\000OOV_RANK\000EMPTY_LEXEMEstruct __pyx_t_5spacy_7structs_LexemeC\000EMPTY_LEXEMEuint64_t (void *, int, uint64_t)\000hash64void *(struct __pyx_t_7preshed_4maps_MapStruct *, __pyx_t_7preshed_4maps_key_t const )\000map_clearO"; + PyObject *data = NULL; + CYTHON_UNUSED_VAR(__Pyx_DecompressString); + #endif + PyObject **stringtab = __pyx_mstate->__pyx_string_tab; + Py_ssize_t pos = 0; + for (int i = 0; i < 343; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); + if (likely(string) && i >= 70) PyUnicode_InternInPlace(&string); + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + stringtab[i] = string; + pos += bytes_length; + } + for (int i = 343; i < 375; i++) { + Py_ssize_t bytes_length = index[i].length; + PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); + stringtab[i] = string; + pos += bytes_length; + if (unlikely(!string)) { + Py_XDECREF(data); + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + Py_XDECREF(data); + for (Py_ssize_t i = 0; i < 375; i++) { + if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { + __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = stringtab + 343; + for (Py_ssize_t i=0; i<32; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + } + { + PyObject **numbertab = __pyx_mstate->__pyx_number_tab; + double const c_constants[] = {1.3,-20.}; + for (int i = 0; i < 2; i++) { + numbertab[i] = PyFloat_FromDouble(c_constants[i]); + if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + { + PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 2; + int8_t const cint_constants_1[] = {0,-1,1}; + int16_t const cint_constants_2[] = {1024}; + int32_t const cint_constants_4[] = {39514986L,136983863L}; + for (int i = 0; i < 6; i++) { + numbertab[i] = PyLong_FromLong((i < 3 ? cint_constants_1[i - 0] : (i < 4 ? cint_constants_2[i - 3] : cint_constants_4[i - 4]))); + if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #if CYTHON_IMMORTAL_CONSTANTS + { + PyObject **table = __pyx_mstate->__pyx_number_tab; + for (Py_ssize_t i=0; i<8; ++i) { + #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL); + #else + Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); + #endif + } + } + #endif + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_codeobjects ### */ +typedef struct { + unsigned int argcount : 3; + unsigned int num_posonly_args : 1; + unsigned int num_kwonly_args : 2; + unsigned int nlocals : 5; + unsigned int flags : 10; + unsigned int first_line : 10; +} __Pyx_PyCode_New_function_description; +/* NewCodeObj.proto */ +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +); + + +static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { + PyObject* tuple_dedup_map = PyDict_New(); + if (unlikely(!tuple_dedup_map)) return -1; + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 130}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_mem, __pyx_mstate->__pyx_n_u_stack, __pyx_mstate->__pyx_n_u_contexts}; + __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_memory_zone, __pyx_mstate->__pyx_kp_b_iso88591_A_0, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 274}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_addr, __pyx_mstate->__pyx_n_u_lex}; + __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 572}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_deserialize_vectors, __pyx_mstate->__pyx_kp_b_iso88591_t9Cq_q_t89AXQa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 579}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_xt89A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 581}; + PyObject* const varnames[] = {0}; + __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_xt89A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 594}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_serialize_vectors, __pyx_mstate->__pyx_kp_b_iso88591_t9Cq_q_t8_as_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 601}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_z_X, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 602}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_z_2_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 603}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_b}; + __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_z_X, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 26}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_lang, __pyx_mstate->__pyx_n_u_defaults, __pyx_mstate->__pyx_n_u_vectors_name, __pyx_mstate->__pyx_n_u_lex_attrs}; + __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_create_vocab, __pyx_mstate->__pyx_kp_b_iso88591_Qk_9F_Qhixq_q_Qhd_a_QfIQa_5_xq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 157}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_flag_getter, __pyx_mstate->__pyx_n_u_flag_id, __pyx_mstate->__pyx_n_u_bit, __pyx_mstate->__pyx_n_u_lex}; + __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_add_flag, __pyx_mstate->__pyx_kp_b_iso88591_1_84q_uAS_4wd_a_j_q_S_3hb_AV5_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 250}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_orth_2}; + __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_clear_transient_orths, __pyx_mstate->__pyx_kp_b_iso88591_A_HD_Qd_81_V1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 2, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 336}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_width, __pyx_mstate->__pyx_n_u_shape}; + __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_reset_vectors, __pyx_mstate->__pyx_kp_b_iso88591_4z_j_AV5_q_7H_UYYZZ___6_T_wa_AV, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 350}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ops, __pyx_mstate->__pyx_n_u_xp, __pyx_mstate->__pyx_n_u_filled, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_row_by_bytes, __pyx_mstate->__pyx_n_u_key2row, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_row, __pyx_mstate->__pyx_n_u_row, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_row, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_row}; + __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_deduplicate_vectors, __pyx_mstate->__pyx_kp_b_iso88591_A_4z_j_AV5_q_7Nm____dde_4xvS_1_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 23, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 379}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_nr_row, __pyx_mstate->__pyx_n_u_batch_size, __pyx_mstate->__pyx_n_u_ops, __pyx_mstate->__pyx_n_u_xp, __pyx_mstate->__pyx_n_u_orth_2, __pyx_mstate->__pyx_n_u_priority, __pyx_mstate->__pyx_n_u_lex, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_indices, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_n_u_keep, __pyx_mstate->__pyx_n_u_toss, __pyx_mstate->__pyx_n_u_syn_keys, __pyx_mstate->__pyx_n_u_syn_rows, __pyx_mstate->__pyx_n_u_scores, __pyx_mstate->__pyx_n_u_remap, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_word, __pyx_mstate->__pyx_n_u_synonym, __pyx_mstate->__pyx_n_u_score, __pyx_mstate->__pyx_n_u_prob}; + __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_prune_vectors, __pyx_mstate->__pyx_kp_b_iso88591_q6_4z_j_AV5_q_7H_UYYZZ___4xvS_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 444}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_orth_2, __pyx_mstate->__pyx_n_u_lex, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_xp, __pyx_mstate->__pyx_n_u_vectors}; + __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_get_vector, __pyx_mstate->__pyx_kp_b_iso88591_A_QfA_4xt1F_aq_AS_D_4_1_4xq_Qd_F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 467}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_orth_2, __pyx_mstate->__pyx_n_u_vector, __pyx_mstate->__pyx_n_u_lex, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_new_rows, __pyx_mstate->__pyx_n_u_width, __pyx_mstate->__pyx_n_u_row}; + __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_set_vector, __pyx_mstate->__pyx_kp_b_iso88591_A_QfA_4xt1F_aq_AS_D_4xy_D_t1_5_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 491}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_orth_2, __pyx_mstate->__pyx_n_u_lex, __pyx_mstate->__pyx_n_u_key}; + __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_has_vector, __pyx_mstate->__pyx_kp_b_iso88591_A_QfA_4xt1F_aq_AS_D_t3d, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 519}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_exclude}; + __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_to_disk, __pyx_mstate->__pyx_kp_b_iso88591_uA_t_q_4t7_a_WA_b_WA_xq_WA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 538}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_exclude}; + __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_from_disk, __pyx_mstate->__pyx_kp_b_iso88591_a_t_q_WA_5_WA_t9G1_HJavXQa_WA_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 1, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 564}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_exclude, __pyx_mstate->__pyx_n_u_deserialize_vectors, __pyx_mstate->__pyx_n_u_deserialize_vectors, __pyx_mstate->__pyx_n_u_getters}; + __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_to_bytes, __pyx_mstate->__pyx_kp_b_iso88591_q_q_q_q_t9AYa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 1, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 585}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_bytes_data, __pyx_mstate->__pyx_n_u_exclude, __pyx_mstate->__pyx_n_u_serialize_vectors, __pyx_mstate->__pyx_n_u_serialize_vectors, __pyx_mstate->__pyx_n_u_setters}; + __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_from_bytes, __pyx_mstate->__pyx_kp_b_iso88591_0_Q_q_q_q_Kq_IQ_D_l_T_hjXYYZ_Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 614}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_keys, __pyx_mstate->__pyx_n_u_strings}; + __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_reset_cache, __pyx_mstate->__pyx_kp_b_iso88591_A_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate}; + __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_T_D_4_tCVVZZkkoozz_E_E_I_I, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; + __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_1F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 619}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_vocab, __pyx_mstate->__pyx_n_u_sstore, __pyx_mstate->__pyx_n_u_vectors, __pyx_mstate->__pyx_n_u_morph, __pyx_mstate->__pyx_n_u_unused_object, __pyx_mstate->__pyx_n_u_lex_attr_getters, __pyx_mstate->__pyx_n_u_lookups, __pyx_mstate->__pyx_n_u_get_noun_chunks}; + __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_pickle_vocab, __pyx_mstate->__pyx_kp_b_iso88591_U_e1_E_U_uM_q_e1_e1_A_Yg_55GyPQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {7, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 631}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_sstore, __pyx_mstate->__pyx_n_u_vectors, __pyx_mstate->__pyx_n_u_morphology, __pyx_mstate->__pyx_n_u_unused_object, __pyx_mstate->__pyx_n_u_lex_attr_getters, __pyx_mstate->__pyx_n_u_lookups, __pyx_mstate->__pyx_n_u_get_noun_chunks, __pyx_mstate->__pyx_n_u_vocab}; + __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_spacy_vocab_pyx, __pyx_mstate->__pyx_n_u_unpickle_vocab, __pyx_mstate->__pyx_kp_b_iso88591_uA_A_A_q_1_U_q_A_A_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad; + } + { + const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4}; + PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_result}; + __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_Vocab, __pyx_mstate->__pyx_kp_b_iso88591_q_0_kQR_5_7_q_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad; + } + Py_DECREF(tuple_dedup_map); + return 0; + bad: + Py_DECREF(tuple_dedup_map); + return -1; +} +/* #### Code section: init_globals ### */ + +static int __Pyx_InitGlobals(void) { + /* PythonCompatibility.init */ + if (likely(__Pyx_init_co_variables() == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CommonTypesMetaclass.init */ + if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CachedMethodType.init */ + #if CYTHON_COMPILING_IN_LIMITED_API + { + PyObject *typesModule=NULL; + typesModule = PyImport_ImportModule("types"); + if (typesModule) { + __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + } + } // error handling follows + #endif + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* CythonFunctionShared.init */ + if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* Generator.init */ + if (likely(__pyx_Generator_init(__pyx_m) == 0)); else + + if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, + "name '%U' is not defined", name); + } + return result; +} + +/* TupleAndListFromArray (used by fastcall) */ +#if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + Py_ssize_t i; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + for (i = 0; i < n; i++) { + if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { + Py_DECREF(res); + return NULL; + } + Py_INCREF(src[i]); + } + return res; +} +#elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals (used by UnicodeEquals) */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\ + !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals (used by fastcall) */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + return PyObject_RichCompareBool(s1, s2, equals); +#else + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length, length2; + int kind; + void *data1, *data2; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + #endif + length = __Pyx_PyUnicode_GET_LENGTH(s1); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length < 0)) return -1; + #endif + length2 = __Pyx_PyUnicode_GET_LENGTH(s2); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(length2 < 0)) return -1; + #endif + if (length != length2) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + return (equals == Py_EQ); +return_ne: + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(n == -1)) return NULL; + #endif + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + if (s == namei) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!namei)) return NULL; + #endif + int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; + return kwvalues[i]; + } + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API +CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { + Py_ssize_t i, nkwargs; + PyObject *dict; +#if !CYTHON_ASSUME_SAFE_SIZE + nkwargs = PyTuple_Size(kwnames); + if (unlikely(nkwargs < 0)) return NULL; +#else + nkwargs = PyTuple_GET_SIZE(kwnames); +#endif + dict = PyDict_New(); + if (unlikely(!dict)) + return NULL; + for (i=0; itp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO (used by PyObjectFastCall) */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall (used by PyObjectCallOneArg) */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +#if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API + #if PY_VERSION_HEX < 0x03090000 + #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) + #elif CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { + PyTypeObject *tp = Py_TYPE(callable); + #if defined(__Pyx_CyFunction_USED) + if (__Pyx_CyFunction_CheckExact(callable)) { + return __Pyx_CyFunction_func_vectorcall(callable); + } + #endif + if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { + return NULL; + } + assert(PyCallable_Check(callable)); + Py_ssize_t offset = tp->tp_vectorcall_offset; + assert(offset > 0); + vectorcallfunc ptr; + memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); + return ptr; +} + #else + #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) + #endif +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if CYTHON_COMPILING_IN_LIMITED_API + return PyObject_Vectorcall(func, args, _nargs, NULL); + #else + vectorcallfunc f = __Pyx_PyVectorcall_Function(func); + if (f) { + return f(func, args, _nargs, NULL); + } + #endif + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* PyObjectCallOneArg (used by CallUnboundCMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* UnpackUnboundCMethod (used by CallUnboundCMethod0) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + PyObject *result; + PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + if (unlikely(!selfless_args)) return NULL; + result = PyObject_Call(method, selfless_args, kwargs); + Py_DECREF(selfless_args); + return result; +} +#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { + return _PyObject_Vectorcall + (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames); +} +#else +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { + return +#if PY_VERSION_HEX < 0x03090000 + _PyObject_Vectorcall +#else + PyObject_Vectorcall +#endif + (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames); +} +#endif +static PyMethodDef __Pyx_UnboundCMethod_Def = { + "CythonUnboundCMethod", + __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 + METH_VARARGS | METH_KEYWORDS, +#else + METH_FASTCALL | METH_KEYWORDS, +#endif + NULL +}; +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method, *result=NULL; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + result = method; +#if CYTHON_COMPILING_IN_CPYTHON + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } else +#endif +#if CYTHON_COMPILING_IN_PYPY +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); +#endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); +#endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + result = unbound_method; + } + } +#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + if (unlikely(target->method)) { + Py_DECREF(result); + } else +#endif + target->method = result; + return 0; +} + +/* CallUnboundCMethod0 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + if (likely(cfunc->flag == METH_NOARGS)) + return __Pyx_CallCFunction(cfunc, self, NULL); + if (likely(cfunc->flag == METH_FASTCALL)) + return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0); + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL); + if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS))) + return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL); + if (cfunc->flag == METH_VARARGS) + return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple); + return __Pyx__CallUnboundCMethod0(cfunc, self); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + PyObject *result; + if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; + result = __Pyx_PyObject_CallOneArg(cfunc->method, self); + return result; +} + +/* py_dict_items (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d); +} + +/* py_dict_values (used by OwnedDictNext) */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { + return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d); +} + +/* OwnedDictNext (used by ParseKeywordsImpl) */ +#if CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) { + PyObject *next = NULL; + if (!*ppos) { + if (pvalue) { + PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p); + if (unlikely(!dictview)) goto bad; + *ppos = PyObject_GetIter(dictview); + Py_DECREF(dictview); + } else { + *ppos = PyObject_GetIter(p); + } + if (unlikely(!*ppos)) goto bad; + } + next = PyIter_Next(*ppos); + if (!next) { + if (PyErr_Occurred()) goto bad; + return 0; + } + if (pkey && pvalue) { + *pkey = __Pyx_PySequence_ITEM(next, 0); + if (unlikely(*pkey)) goto bad; + *pvalue = __Pyx_PySequence_ITEM(next, 1); + if (unlikely(*pvalue)) goto bad; + Py_DECREF(next); + } else if (pkey) { + *pkey = next; + } else { + assert(pvalue); + *pvalue = next; + } + return 1; + bad: + Py_XDECREF(next); +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 + PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef"); +#else + PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef); +#endif + if (pkey) *pkey = NULL; + if (pvalue) *pvalue = NULL; + return 0; +} +#else // !CYTHON_AVOID_BORROWED_REFS +static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) { + int result = PyDict_Next(p, ppos, pkey, pvalue); + if (likely(result == 1)) { + if (pkey) Py_INCREF(*pkey); + if (pvalue) Py_INCREF(*pvalue); + } + return result; +} +#endif + +/* RaiseDoubleKeywords (used by ParseKeywordsImpl) */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); +} + +/* CallUnboundCMethod2 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, args, 2); + } + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL); + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2); + } +#endif + PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *result = NULL; + PyObject *args = PyTuple_New(2); + if (unlikely(!args)) return NULL; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + return result; + } +#endif + { + PyObject *args[4] = {NULL, self, arg1, arg2}; + return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } +} + +/* ParseKeywordsImpl (used by ParseKeywords) */ +static int __Pyx_ValidateDuplicatePosArgs( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char* function_name) +{ + PyObject ** const *name = argnames; + while (name != first_kw_arg) { + PyObject *key = **name; + int found = PyDict_Contains(kwds, key); + if (unlikely(found)) { + if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; + } + name++; + } + return 0; +bad: + return -1; +} +#if CYTHON_USE_UNICODE_INTERNALS +static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) { + int kind; + Py_ssize_t len = PyUnicode_GET_LENGTH(s1); + if (len != PyUnicode_GET_LENGTH(s2)) return 0; + kind = PyUnicode_KIND(s1); + if (kind != PyUnicode_KIND(s2)) return 0; + const void *data1 = PyUnicode_DATA(s1); + const void *data2 = PyUnicode_DATA(s2); + return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0); +} +#endif +static int __Pyx_MatchKeywordArg_str( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + #if CYTHON_USE_UNICODE_INTERNALS + Py_hash_t key_hash = ((PyASCIIObject*)key)->hash; + if (unlikely(key_hash == -1)) { + key_hash = PyObject_Hash(key); + if (unlikely(key_hash == -1)) + goto bad; + } + #endif + name = first_kw_arg; + while (*name) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) { + *index_found = (size_t) (name - argnames); + return 1; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + *index_found = (size_t) (name - argnames); + return 1; + } + } + #endif + name++; + } + name = argnames; + while (name != first_kw_arg) { + PyObject *name_str = **name; + #if CYTHON_USE_UNICODE_INTERNALS + if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) { + if (__Pyx_UnicodeKeywordsEqual(name_str, key)) + goto arg_passed_twice; + } + #else + #if CYTHON_ASSUME_SAFE_SIZE + if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) + #endif + { + if (unlikely(name_str == key)) goto arg_passed_twice; + int cmp = PyUnicode_Compare(name_str, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + } + #endif + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +bad: + return -1; +} +static int __Pyx_MatchKeywordArg_nostr( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + PyObject ** const *name; + if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; + name = first_kw_arg; + while (*name) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (cmp == 1) { + *index_found = (size_t) (name - argnames); + return 1; + } + if (unlikely(cmp == -1)) goto bad; + name++; + } + name = argnames; + while (name != first_kw_arg) { + int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); + if (unlikely(cmp != 0)) { + if (cmp == 1) goto arg_passed_twice; + else goto bad; + } + name++; + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +bad: + return -1; +} +static CYTHON_INLINE int __Pyx_MatchKeywordArg( + PyObject *key, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + size_t *index_found, + const char *function_name) +{ + return likely(PyUnicode_CheckExact(key)) ? + __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) : + __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name); +} +static void __Pyx_RejectUnknownKeyword( + PyObject *kwds, + PyObject ** const argnames[], + PyObject ** const *first_kw_arg, + const char *function_name) +{ + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; + #else + Py_ssize_t pos = 0; + #endif + PyObject *key = NULL; + __Pyx_BEGIN_CRITICAL_SECTION(kwds); + while ( + #if CYTHON_AVOID_BORROWED_REFS + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL) + #else + PyDict_Next(kwds, &pos, &key, NULL) + #endif + ) { + PyObject** const *name = first_kw_arg; + while (*name && (**name != key)) name++; + if (!*name) { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp != 1) { + if (cmp == 0) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + break; + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + #endif + } + __Pyx_END_CRITICAL_SECTION(); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); + #endif + assert(PyErr_Occurred()); +} +static int __Pyx_ParseKeywordDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t extracted = 0; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + name = first_kw_arg; + while (*name && num_kwargs > extracted) { + PyObject * key = **name; + PyObject *value; + int found = 0; + #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + found = PyDict_GetItemRef(kwds, key, &value); + #else + value = PyDict_GetItemWithError(kwds, key); + if (value) { + Py_INCREF(value); + found = 1; + } else { + if (unlikely(PyErr_Occurred())) goto bad; + } + #endif + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + extracted++; + } + name++; + } + if (num_kwargs > extracted) { + if (ignore_unknown_kwargs) { + if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1)) + goto bad; + } else { + __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name); + goto bad; + } + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordDictToDict( + PyObject *kwds, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject** const *name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + Py_ssize_t len; +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; +#endif + if (PyDict_Update(kwds2, kwds) < 0) goto bad; + name = first_kw_arg; + while (*name) { + PyObject *key = **name; + PyObject *value; +#if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)) + int found = PyDict_Pop(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int found = PyDict_GetItemRef(kwds2, key, &value); + if (found) { + if (unlikely(found < 0)) goto bad; + values[name-argnames] = value; + if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad; + } +#else + #if CYTHON_COMPILING_IN_CPYTHON + value = _PyDict_Pop(kwds2, key, kwds2); + #else + value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2); + #endif + if (value == kwds2) { + Py_DECREF(value); + } else { + if (unlikely(!value)) goto bad; + values[name-argnames] = value; + } +#endif + name++; + } + len = PyDict_Size(kwds2); + if (len > 0) { + return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name); + } else if (unlikely(len == -1)) { + goto bad; + } + return 0; +bad: + return -1; +} +static int __Pyx_ParseKeywordsTuple( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + PyObject *key = NULL; + PyObject** const * name; + PyObject** const *first_kw_arg = argnames + num_pos_args; + for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) { +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); +#else + key = __Pyx_PyTuple_GET_ITEM(kwds, pos); +#endif +#if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(!key)) goto bad; +#endif + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + PyObject *value = kwvalues[pos]; + values[name-argnames] = __Pyx_NewRef(value); + } else { + size_t index_found = 0; + int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); + if (cmp == 1) { + PyObject *value = kwvalues[pos]; + values[index_found] = __Pyx_NewRef(value); + } else { + if (unlikely(cmp == -1)) goto bad; + if (kwds2) { + PyObject *value = kwvalues[pos]; + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else if (!ignore_unknown_kwargs) { + goto invalid_keyword; + } + } + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(key); + key = NULL; + #endif + } + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + goto bad; +bad: + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(key); + #endif + return -1; +} + +/* ParseKeywords */ +static int __Pyx_ParseKeywords( + PyObject *kwds, + PyObject * const *kwvalues, + PyObject ** const argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + Py_ssize_t num_kwargs, + const char* function_name, + int ignore_unknown_kwargs) +{ + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) + return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); + else if (kwds2) + return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name); + else + return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); +} + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* ArgTypeTestFunc (used by ArgTypeTest) */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode; + int from_annotation_subclass = 0; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (!exact) { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } else if (exact == 2) { + if (__Pyx_TypeCheck(obj, type)) { + from_annotation_subclass = 1; + extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately; + } + } + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")" +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + "%s%U" +#endif + , name, type_name, obj_type_name +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 + , (from_annotation_subclass ? ". " : ""), extra_info +#endif + ); +#if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + if (exact == 2 && from_annotation_subclass) { + PyObject *res; + PyObject *vargs[2]; + vargs[0] = PyErr_GetRaisedException(); + vargs[1] = extra_info; + res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL); + Py_XDECREF(res); + PyErr_SetRaisedException(vargs[0]); + } +#endif + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* RaiseException */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); +#elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} + +/* PyObjectFastCallMethod */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { + PyObject *result; + PyObject *attr = PyObject_GetAttr(args[0], name); + if (unlikely(!attr)) + return NULL; + result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); + Py_DECREF(attr); + return result; +} +#endif + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* CIntToDigits (used by CIntToPyUnicode) */ +static const char DIGIT_PAIRS_10[2*10*10+1] = { + "00010203040506070809" + "10111213141516171819" + "20212223242526272829" + "30313233343536373839" + "40414243444546474849" + "50515253545556575859" + "60616263646566676869" + "70717273747576777879" + "80818283848586878889" + "90919293949596979899" +}; +static const char DIGIT_PAIRS_8[2*8*8+1] = { + "0001020304050607" + "1011121314151617" + "2021222324252627" + "3031323334353637" + "4041424344454647" + "5051525354555657" + "6061626364656667" + "7071727374757677" +}; +static const char DIGITS_HEX[2*16+1] = { + "0123456789abcdef" + "0123456789ABCDEF" +}; + +/* BuildPyUnicode (used by COrdinalToPyUnicode) */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength, + int prepend_sign, char padding_char) { + PyObject *uval; + Py_ssize_t uoffset = ulength - clength; +#if CYTHON_USE_UNICODE_INTERNALS + Py_ssize_t i; + void *udata; + uval = PyUnicode_New(ulength, 127); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_DATA(uval); + if (uoffset > 0) { + i = 0; + if (prepend_sign) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); + i++; + } + for (; i < uoffset; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); + } + } + for (i=0; i < clength; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); + } +#else + { + PyObject *sign = NULL, *padding = NULL; + uval = NULL; + if (uoffset > 0) { + prepend_sign = !!prepend_sign; + if (uoffset > prepend_sign) { + padding = PyUnicode_FromOrdinal(padding_char); + if (likely(padding) && uoffset > prepend_sign + 1) { + PyObject *tmp = PySequence_Repeat(padding, uoffset - prepend_sign); + Py_DECREF(padding); + padding = tmp; + } + if (unlikely(!padding)) goto done_or_error; + } + if (prepend_sign) { + sign = PyUnicode_FromOrdinal('-'); + if (unlikely(!sign)) goto done_or_error; + } + } + uval = PyUnicode_DecodeASCII(chars, clength, NULL); + if (likely(uval) && padding) { + PyObject *tmp = PyUnicode_Concat(padding, uval); + Py_DECREF(uval); + uval = tmp; + } + if (likely(uval) && sign) { + PyObject *tmp = PyUnicode_Concat(sign, uval); + Py_DECREF(uval); + uval = tmp; + } +done_or_error: + Py_XDECREF(padding); + Py_XDECREF(sign); + } +#endif + return uval; +} + +/* COrdinalToPyUnicode (used by CIntToPyUnicode) */ +static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value) { + return value <= 1114111; +} +static PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t ulength, char padding_char) { + Py_ssize_t padding_length = ulength - 1; + if (likely((padding_length <= 250) && (value < 0xD800 || value > 0xDFFF))) { + char chars[256]; + if (value <= 255) { + memset(chars, padding_char, (size_t) padding_length); + chars[ulength-1] = (char) value; + return PyUnicode_DecodeLatin1(chars, ulength, NULL); + } + char *cpos = chars + sizeof(chars); + if (value < 0x800) { + *--cpos = (char) (0x80 | (value & 0x3f)); + value >>= 6; + *--cpos = (char) (0xc0 | (value & 0x1f)); + } else if (value < 0x10000) { + *--cpos = (char) (0x80 | (value & 0x3f)); + value >>= 6; + *--cpos = (char) (0x80 | (value & 0x3f)); + value >>= 6; + *--cpos = (char) (0xe0 | (value & 0x0f)); + } else { + *--cpos = (char) (0x80 | (value & 0x3f)); + value >>= 6; + *--cpos = (char) (0x80 | (value & 0x3f)); + value >>= 6; + *--cpos = (char) (0x80 | (value & 0x3f)); + value >>= 6; + *--cpos = (char) (0xf0 | (value & 0x07)); + } + cpos -= padding_length; + memset(cpos, padding_char, (size_t) padding_length); + return PyUnicode_DecodeUTF8(cpos, chars + sizeof(chars) - cpos, NULL); + } + if (value <= 127 && CYTHON_USE_UNICODE_INTERNALS) { + const char chars[1] = {(char) value}; + return __Pyx_PyUnicode_BuildFromAscii(ulength, chars, 1, 0, padding_char); + } + { + PyObject *uchar, *padding_uchar, *padding, *result; + padding_uchar = PyUnicode_FromOrdinal(padding_char); + if (unlikely(!padding_uchar)) return NULL; + padding = PySequence_Repeat(padding_uchar, padding_length); + Py_DECREF(padding_uchar); + if (unlikely(!padding)) return NULL; + uchar = PyUnicode_FromOrdinal(value); + if (unlikely(!uchar)) { + Py_DECREF(padding); + return NULL; + } + result = PyUnicode_Concat(padding, uchar); + Py_DECREF(padding); + Py_DECREF(uchar); + return result; + } +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!(is_unsigned || value == 0 || value > 0) || + !(sizeof(value) <= 2 || value & ~ (int) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) { + PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)"); + return NULL; + } + if (width <= 1) { + return PyUnicode_FromOrdinal((int) value); + } + return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char); +} +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(int)*3+2]; + char *dpos, *end = digits + sizeof(int)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + int remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (int) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (int) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (int) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!(is_unsigned || value == 0 || value > 0) || + !(sizeof(value) <= 2 || value & ~ (Py_ssize_t) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) { + PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)"); + return NULL; + } + if (width <= 1) { + return PyUnicode_FromOrdinal((int) value); + } + return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char); +} +static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (Py_ssize_t) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (Py_ssize_t) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (Py_ssize_t) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* JoinPyUnicode */ +static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind, kind_shift; + Py_ssize_t i, char_pos; + void *result_udata; + if (max_char > 1114111) max_char = 1114111; + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; + result_udata = PyUnicode_DATA(result_uval); + assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - result_ulength < 0)) + goto overflow; + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = values[i]; + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_PyUnicode_READY(uval) == (-1)) + goto bad; + #endif + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(ulength < 0)) goto bad; + #endif + if (unlikely(!ulength)) + continue; + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (ukind == result_ukind) { + memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); + } else { + #if PY_VERSION_HEX >= 0x030d0000 + if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; + #elif CYTHON_COMPILING_IN_CPYTHON || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); + } + #endif + } + char_pos += ulength; + } + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; +#else + Py_ssize_t i; + PyObject *result = NULL; + PyObject *value_tuple = PyTuple_New(value_count); + if (unlikely(!value_tuple)) return NULL; + CYTHON_UNUSED_VAR(max_char); + CYTHON_UNUSED_VAR(result_ulength); + for (i=0; i__pyx_empty_unicode, value_tuple); +bad: + Py_DECREF(value_tuple); + return result; +#endif +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) { + return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared); + } else + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i)); + } + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +#else + (void)wraparound; + (void)boundscheck; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) { + return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared); + } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + return __Pyx_NewRef(PyList_GET_ITEM(o, n)); + } + } else + #if !CYTHON_AVOID_BORROWED_REFS + if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + return __Pyx_NewRef(PyTuple_GET_ITEM(o, n)); + } + } else + #endif +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_subscript) { + PyObject *r, *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem); + if (!meth) { + PyErr_Clear(); + } else { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#endif + +/* RejectKeywords */ +static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) { + PyObject *key = NULL; + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) { + key = __Pyx_PySequence_ITEM(kwds, 0); + } else { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *pos = NULL; +#else + Py_ssize_t pos = 0; +#endif +#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) + if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return; +#endif + __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL); +#if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(pos); +#endif + } + if (likely(key)) { + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + Py_DECREF(key); + } +} + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b, int b_is_constant) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + Py_ssize_t adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* GetAttr3 */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + int res = PyObject_GetOptionalAttr(o, n, &r); + return (res != 0) ? r : __Pyx_NewRef(d); +#else + #if CYTHON_USE_TYPE_SLOTS + if (likely(PyUnicode_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } + #endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +#endif +} + +/* PyDictVersioning (used by GetModuleGlobalName) */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + if (!PyErr_Occurred()) + PyErr_SetNone(PyExc_NameError); + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } + PyErr_Clear(); +#elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS + if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return result; + } +#else + result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* GetTopmostException (used by SaveResetException) */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} +#endif + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif +{ + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C0000 + local_value = tstate->current_exception; + tstate->current_exception = 0; + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#elif __PYX_LIMITED_VERSION_HEX > 0x030C0000 + local_value = PyErr_GetRaisedException(); +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif +#if __PYX_LIMITED_VERSION_HEX > 0x030C0000 + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } +#else + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } +#endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000 + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif + } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + PyErr_SetHandledException(local_value); + Py_XDECREF(local_value); + Py_XDECREF(local_type); + Py_XDECREF(local_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +#if __PYX_LIMITED_VERSION_HEX <= 0x030C0000 +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +#endif +} + +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* HasAttr (used by ImportImpl) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!PyUnicode_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (!r) { + return (unlikely(PyErr_Occurred())) ? -1 : 0; + } else { + Py_DECREF(r); + return 1; + } +} +#endif + +/* ImportImpl (used by Import) */ +static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) { + PyObject *imported_module = PyImport_GetModule(qualname); + if (unlikely(!imported_module)) { + *module = NULL; + if (PyErr_Occurred()) { + return -1; + } + return 0; + } + *module = imported_module; + return 1; +} +static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) { + PyObject *imported_module; + PyObject *top_level_package_name; + Py_ssize_t i; + int status, module_found; + Py_ssize_t dot_index; + module_found = __Pyx__Import_GetModule(qualname, &imported_module); + if (unlikely(!module_found || module_found == -1)) { + *module = NULL; + return module_found; + } + if (imported_names) { + for (i = 0; i < len_imported_names; i++) { + PyObject *imported_name = imported_names[i]; +#if __PYX_LIMITED_VERSION_HEX < 0x030d0000 + int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name); +#else + int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name); + if (unlikely(has_imported_attribute == -1)) goto error; +#endif + if (!has_imported_attribute) { + goto not_found; + } + } + *module = imported_module; + return 1; + } + dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1); + if (dot_index == -1) { + *module = imported_module; + return 1; + } + if (unlikely(dot_index == -2)) goto error; + top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index); + if (unlikely(!top_level_package_name)) goto error; + Py_DECREF(imported_module); + status = __Pyx__Import_GetModule(top_level_package_name, module); + Py_DECREF(top_level_package_name); + return status; +error: + Py_DECREF(imported_module); + *module = NULL; + return -1; +not_found: + Py_DECREF(imported_module); + *module = NULL; + return 0; +} +static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *from_list = 0; + int module_found; + if (!qualname) { + qualname = name; + } + module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module); + if (likely(module_found == 1)) { + return module; + } else if (unlikely(module_found == -1)) { + return NULL; + } + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + if (imported_names) { +#if CYTHON_COMPILING_IN_CPYTHON + from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names); + if (unlikely(!from_list)) + goto bad; +#else + from_list = PyList_New(len_imported_names); + if (unlikely(!from_list)) goto bad; + for (Py_ssize_t i=0; i__pyx_d, level); +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); + for (i=0; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } +} + +/* PyObjectFormatAndDecref */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) { + if (unlikely(!s)) return NULL; + if (likely(PyUnicode_CheckExact(s))) return s; + return __Pyx_PyObject_FormatAndDecref(s, f); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) { + PyObject *result; + if (unlikely(!s)) return NULL; + result = PyObject_Format(s, f); + Py_DECREF(s); + return result; +} + +/* PyObjectFormat */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { + int ret; + _PyUnicodeWriter writer; + if (likely(PyFloat_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyFloat_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else if (likely(PyLong_CheckExact(obj))) { + _PyUnicodeWriter_Init(&writer); + ret = _PyLong_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else { + return PyObject_Format(obj, format_spec); + } + if (unlikely(ret == -1)) { + _PyUnicodeWriter_Dealloc(&writer); + return NULL; + } + return _PyUnicodeWriter_Finish(&writer); +} +#endif + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + int wraparound, int boundscheck, int unsafe_shared) { + CYTHON_MAYBE_UNUSED_VAR(unsafe_shared); +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) { + Py_INCREF(v); + return PyList_SetItem(o, n, v); + } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old; + Py_INCREF(v); + old = PyList_GET_ITEM(o, n); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 0; + } + } else +#endif +#if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY + { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (!is_list && mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyLong_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (is_list || likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else + if (is_list || !PyMapping_Check(o)) { + return PySequence_SetItem(o, i, v); + } +#endif + (void)wraparound; + (void)boundscheck; + return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v); +} + +/* RaiseUnboundLocalError */ +static void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b, int b_is_constant) { + long q = a / b; + long r = a - q*b; + long adapt_python = (b_is_constant ? + ((r != 0) & ((r < 0) ^ (b < 0))) : + ((r != 0) & ((r ^ b) < 0)) + ); + return q - adapt_python; +} + +/* tp_new */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __Pyx_tp_new_fallback(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + PyObject *new_func = NULL, *new_args = NULL, *obj; + Py_ssize_t i, nargs = PyTuple_Size(args); + if (unlikely(nargs < 0)) goto bad; + new_args = PyTuple_New(nargs + 1); + if (unlikely(!new_args)) goto bad; + for (i = 0; i < nargs + 1; i++) { + PyObject *item = (i == 0) ? type_obj : PyTuple_GetItem(args, i - 1); + if (unlikely(!item)) goto bad; + Py_INCREF(item); + if (unlikely(PyTuple_SetItem(new_args, i, item)) < 0) goto bad; + } + new_func = PyObject_GetAttrString(type_obj, "__new__"); + if (unlikely(!new_func)) goto bad; + obj = PyObject_Call(new_func, new_args, kwargs); + Py_DECREF(new_func); + Py_DECREF(new_args); + return obj; + bad: + Py_XDECREF(new_func); + Py_XDECREF(new_args); + return NULL; +} +#endif +static PyObject* __Pyx_tp_new_kwargs(PyObject* type_obj, PyObject* args, PyObject* kwargs) { + newfunc tp_new = __Pyx_PyType_TryGetSlot((PyTypeObject*)type_obj, tp_new, newfunc); +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) return __Pyx_tp_new_fallback(type_obj, args, kwargs); +#else + assert(tp_new != NULL); +#endif + return tp_new((PyTypeObject*)type_obj, args, kwargs); +} + +/* PyObjectVectorCallKwBuilder (used by PyObjectVectorCallMethodKwBuilder) */ +#if CYTHON_VECTORCALL +static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_PyObject_FastCallDict; + if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; + Py_INCREF(key); + args[n] = value; + return 0; +} +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + (void)__Pyx_VectorcallBuilder_AddArgStr; + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); +} +static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { + PyObject *pyKey = PyUnicode_FromString(key); + if (!pyKey) return -1; + return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); +} +#else // CYTHON_VECTORCALL +CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { + if (unlikely(!PyUnicode_Check(key))) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + return -1; + } + return PyDict_SetItem(builder, key, value); +} +#endif + +/* PyObjectVectorCallMethodKwBuilder */ +#if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 +static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) { + PyObject *result; + PyObject *obj = PyObject_GetAttr(args[0], name); + if (unlikely(!obj)) + return NULL; + result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames); + Py_DECREF(obj); + return result; +} +#endif + +/* RaiseMappingExpected */ +static void __Pyx_RaiseMappingExpectedError(PyObject* arg) { + __Pyx_TypeName arg_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(arg)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not a mapping", arg_type_name); + __Pyx_DECREF_TypeName(arg_type_name); +} + +/* PyObjectCall2Args (used by CallUnboundCMethod1) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* CallUnboundCMethod1 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { + int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); + if (likely(was_initialized == 2 && cfunc->func)) { + int flag = cfunc->flag; + if (flag == METH_O) { + return __Pyx_CallCFunction(cfunc, self, arg); + } else if (flag == METH_FASTCALL) { + return __Pyx_CallCFunctionFast(cfunc, self, &arg, 1); + } else if (flag == (METH_FASTCALL | METH_KEYWORDS)) { + return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, &arg, 1, NULL); + } + } +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + else if (unlikely(was_initialized == 1)) { + __Pyx_CachedCFunction tmp_cfunc = { +#ifndef __cplusplus + 0 +#endif + }; + tmp_cfunc.type = cfunc->type; + tmp_cfunc.method_name = cfunc->method_name; + return __Pyx__CallUnboundCMethod1(&tmp_cfunc, self, arg); + } +#endif + PyObject* result = __Pyx__CallUnboundCMethod1(cfunc, self, arg); + __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); + return result; +} +#endif +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ + PyObject *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + if (cfunc->flag & METH_KEYWORDS) + result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); + else + result = __Pyx_CallCFunction(cfunc, self, args); + Py_DECREF(args); + } else +#endif + { + result = __Pyx_PyObject_Call2Args(cfunc->method, self, arg); + } + return result; +} + +/* dict_getitem_default */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + PyObject* value; +#if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (unlikely(PyErr_Occurred())) + return NULL; + value = default_value; + } + Py_INCREF(value); + if ((1)); +#else + if (PyBytes_CheckExact(key) || PyUnicode_CheckExact(key) || PyLong_CheckExact(key)) { + value = PyDict_GetItem(d, key); + if (unlikely(!value)) { + value = default_value; + } + Py_INCREF(value); + } +#endif + else { + if (default_value == Py_None) + value = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key); + else + value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_get, d, key, default_value); + } + return value; +} + +/* PyObjectSetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); + return PyObject_SetAttr(obj, attr_name, value); +} +#endif + +/* PyObjectLookupSpecial */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) { + PyObject *res; + PyTypeObject *tp = Py_TYPE(obj); + res = _PyType_Lookup(tp, attr_name); + if (likely(res)) { + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (!f) { + Py_INCREF(res); + } else { + res = f(res, obj, (PyObject *)tp); + } + } else if (with_error) { + PyErr_SetObject(PyExc_AttributeError, attr_name); + } + return res; +} +#endif + +/* IterFinish */ +static CYTHON_INLINE int __Pyx_IterFinish(void) { + PyObject* exc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (unlikely(exc_type)) { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) + return -1; + __Pyx_PyErr_Clear(); + return 0; + } + return 0; +} + +/* UnpackItemEndCheck */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + return __Pyx_IterFinish(); +} + +/* PyLongBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) { + return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); +} +#if CYTHON_USE_PYLONG_INTERNALS +static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + const long b = intval; + long a; + const PY_LONG_LONG llb = intval; + PY_LONG_LONG lla; + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op2); + } + const int is_positive = __Pyx_PyLong_IsPos(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + if (likely(size == 1)) { + a = (long) digits[0]; + if (!is_positive) a *= -1; + } else { + switch (size) { + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) a *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) lla *= -1; + goto calculate_long_long; + } + break; + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) a *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) lla *= -1; + goto calculate_long_long; + } + break; + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (!is_positive) a *= -1; + goto calculate_long; + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + if (!is_positive) lla *= -1; + goto calculate_long_long; + } + break; + } + return PyLong_Type.tp_as_number->nb_add(op1, op2); + } + calculate_long: + { + long x; + x = a + b; + return PyLong_FromLong(x); + } + calculate_long_long: + { + PY_LONG_LONG llx; + llx = lla + llb; + return PyLong_FromLongLong(llx); + } + +} +#endif +static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) { + CYTHON_UNUSED_VAR(zerodivision_check); + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(float_val); + double result; + + result = ((double)a) + (double)b; + return PyFloat_FromDouble(result); +} +static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(zerodivision_check); + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check); + } + #endif + if (PyFloat_CheckExact(op1)) { + return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check); + } + return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace); +} +#endif + +/* DictGetItem */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } + } + return value; +} +#endif + +/* SliceObject */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { + __Pyx_TypeName obj_type_name; +#if CYTHON_USE_TYPE_SLOTS + PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyLong_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyLong_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_USE_TYPE_SLOTS + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); +bad: + return NULL; +} + +/* pybuiltin_invalid (used by pyint_simplify) */ +static void __Pyx_PyBuiltin_Invalid(PyObject *obj, const char *type_name, const char *argname) { + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + if (argname) { + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got " __Pyx_FMT_TYPENAME ")", + argname, type_name, obj_type_name + ); + } else { + PyErr_Format(PyExc_TypeError, + "Expected %.200s, got " __Pyx_FMT_TYPENAME, + type_name, obj_type_name + ); + } + __Pyx_DECREF_TypeName(obj_type_name); +} + +/* pyint_simplify */ +static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none) { + PyObject *number = *number_var; + if (likely((accept_none && number == Py_None) || PyLong_CheckExact(number))) { + return 0; + } + PyObject *int_object; + if (likely(PyNumber_Check(number))) { + int_object = PyNumber_Long(number); + if (unlikely(!int_object)) goto bad; + } else { + __Pyx_PyBuiltin_Invalid(number, "int", argname); + goto bad; + } + *number_var = int_object; + Py_DECREF(number); + return 0; +bad: + *number_var = NULL; + Py_DECREF(number); + return -1; +} + +/* PyLongCompare */ +static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + return 1; + } + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + int unequal; + unsigned long uintval; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + if (intval == 0) { + return (__Pyx_PyLong_IsZero(op1) == 1); + } else if (intval < 0) { + if (__Pyx_PyLong_IsNonNeg(op1)) + return 0; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + return 0; + } + uintval = (unsigned long) intval; +#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 4)) { + unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 3)) { + unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 2)) { + unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 1)) { + unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif + unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); + return (unequal == 0); + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = __Pyx_PyFloat_AS_DOUBLE(op1); + return ((double)a == (double)b); + } + return __Pyx_PyObject_IsTrueAndDecref( + PyObject_RichCompare(op1, op2, Py_EQ)); +} + +/* RaiseClosureNameError */ +static void __Pyx_RaiseClosureNameError(const char *varname) { + PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); +} + +/* dict_setdefault (used by FetchCommonType) */ +static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { + PyObject* value; +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + PyObject *args[] = {d, key, default_value}; + value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#elif CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); +#elif PY_VERSION_HEX >= 0x030d0000 + PyDict_SetDefaultRef(d, key, default_value, &value); +#else + value = PyDict_SetDefault(d, key, default_value); + if (unlikely(!value)) return NULL; + Py_INCREF(value); +#endif + return value; +} + +/* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static Py_ssize_t __Pyx_GetTypeDictOffset(void) { + PyObject *tp_dictoffset_o; + Py_ssize_t tp_dictoffset; + tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__"); + if (unlikely(!tp_dictoffset_o)) return -1; + tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o); + Py_DECREF(tp_dictoffset_o); + if (unlikely(tp_dictoffset == 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' doesn't have a dictoffset"); + return -1; + } else if (unlikely(tp_dictoffset < 0)) { + PyErr_SetString( + PyExc_TypeError, + "'type' has an unexpected negative dictoffset. " + "Please report this as Cython bug"); + return -1; + } + return tp_dictoffset; +} +static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) { + static Py_ssize_t tp_dictoffset = 0; + if (unlikely(tp_dictoffset == 0)) { + tp_dictoffset = __Pyx_GetTypeDictOffset(); + if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) { + tp_dictoffset = 0; // try again next time? + return NULL; + } + } + return *(PyObject**)((char*)tp + tp_dictoffset); +} +#endif + +/* SetItemOnTypeDict (used by FixUpExtensionType) */ +static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) { + int result; + PyObject *tp_dict; +#if CYTHON_COMPILING_IN_LIMITED_API + tp_dict = __Pyx_GetTypeDict(tp); + if (unlikely(!tp_dict)) return -1; +#else + tp_dict = tp->tp_dict; +#endif + result = PyDict_SetItem(tp_dict, k, v); + if (likely(!result)) { + PyType_Modified(tp); + if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) { + PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL); + if (!setNameResult) return -1; + Py_DECREF(setNameResult); + } + } + return result; +} + +/* FixUpExtensionType (used by FetchCommonType) */ +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if __PYX_LIMITED_VERSION_HEX > 0x030900B1 + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#else + const PyType_Slot *slot = spec->slots; + int changed = 0; +#if !CYTHON_COMPILING_IN_LIMITED_API + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { +#if !CYTHON_COMPILING_IN_CPYTHON + const +#endif // !CYTHON_COMPILING_IN_CPYTHON) + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_vectorcall_offset = memb->offset; + changed = 1; + } +#endif // CYTHON_METH_FASTCALL +#if !CYTHON_COMPILING_IN_PYPY + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } +#endif // !CYTHON_COMPILING_IN_PYPY + } + memb++; + } + } +#endif // !CYTHON_COMPILING_IN_LIMITED_API +#if !CYTHON_COMPILING_IN_PYPY + slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_getset) + slot++; + if (slot && slot->slot == Py_tp_getset) { + PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc; + while (getset && getset->name) { + if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) { + PyObject *descr = PyDescr_NewGetSet(type, getset); + if (unlikely(!descr)) + return -1; + #if CYTHON_COMPILING_IN_LIMITED_API + PyObject *pyname = PyUnicode_FromString(getset->name); + if (unlikely(!pyname)) { + Py_DECREF(descr); + return -1; + } + int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr); + Py_DECREF(pyname); + #else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); + int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); + #endif + Py_DECREF(descr); + if (unlikely(set_item_result < 0)) { + return -1; + } + changed = 1; + } + ++getset; + } + } +#else + CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); +#endif // !CYTHON_COMPILING_IN_PYPY + if (changed) + PyType_Modified(type); +#endif // PY_VERSION_HEX > 0x030900B1 + return 0; +} + +/* AddModuleRef (used by FetchSharedCythonModule) */ +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { + PyObject *module_dict = PyImport_GetModuleDict(); + PyObject *m; + if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { + return NULL; + } + if (m != NULL && PyModule_Check(m)) { + return m; + } + Py_XDECREF(m); + m = PyModule_NewObject(name); + if (m == NULL) + return NULL; + if (PyDict_CheckExact(module_dict)) { + PyObject *new_m; + (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); + Py_DECREF(m); + return new_m; + } else { + if (PyObject_SetItem(module_dict, name, m) != 0) { + Py_DECREF(m); + return NULL; + } + return m; + } + } + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *py_name = PyUnicode_FromString(name); + if (!py_name) return NULL; + PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); + Py_DECREF(py_name); + return module; + } +#elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } +#endif + +/* FetchSharedCythonModule (used by FetchCommonType) */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME); +} + +/* FetchCommonType (used by CommonTypesMetaclass) */ +#if __PYX_LIMITED_VERSION_HEX < 0x030C0000 +static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases); + if (result && metaclass) { + PyObject *old_tp = (PyObject*)Py_TYPE(result); + Py_INCREF((PyObject*)metaclass); +#if __PYX_LIMITED_VERSION_HEX >= 0x03090000 + Py_SET_TYPE(result, metaclass); +#else + result->ob_type = metaclass; +#endif + Py_DECREF(old_tp); + } + return result; +} +#else +#define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b) +#endif +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t expected_basicsize) { + Py_ssize_t basicsize; + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (expected_basicsize == 0) { + return 0; // size is inherited, nothing useful to check + } +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) return -1; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = NULL; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; +#else + basicsize = ((PyTypeObject*) cached_type)->tp_basicsize; +#endif + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name; + int get_item_ref_result; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + py_object_name = PyUnicode_FromString(object_name); + if (!py_object_name) return NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) goto done; + abi_module_dict = PyModule_GetDict(abi_module); + if (!abi_module_dict) goto done; + get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type); + if (get_item_ref_result == 1) { + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else if (unlikely(get_item_ref_result == -1)) { + goto bad; + } + cached_type = __Pyx_PyType_FromMetaclass( + metaclass, + CYTHON_USE_MODULE_STATE ? module : abi_module, + spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type); + if (unlikely(new_cached_type != cached_type)) { + if (unlikely(!new_cached_type)) goto bad; + Py_DECREF(cached_type); + cached_type = new_cached_type; + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } else { + Py_DECREF(new_cached_type); + } +done: + Py_XDECREF(abi_module); + Py_DECREF(py_object_name); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +/* CommonTypesMetaclass (used by CythonFunctionShared) */ +static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) { + return PyUnicode_FromString(__PYX_ABI_MODULE_NAME); +} +#if __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) { + PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types"); + return NULL; +} +static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) { + PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable"); + return -1; +} +#endif +static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = { + {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = { + {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset}, + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call}, + {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr}, + #endif + {0, 0} +}; +static PyType_Spec __pyx_CommonTypesMetaclass_spec = { + __PYX_TYPE_MODULE_PREFIX "_common_types_metatype", + 0, + 0, + Py_TPFLAGS_IMMUTABLETYPE | + Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT, + __pyx_CommonTypesMetaclass_slots +}; +static int __pyx_CommonTypesMetaclass_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + PyObject *bases = PyTuple_Pack(1, &PyType_Type); + if (unlikely(!bases)) { + return -1; + } + mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases); + Py_DECREF(bases); + if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) { + return -1; + } + return 0; +} + +/* CallTypeTraverse (used by CythonFunctionShared) */ +#if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) +#else +static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) { + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000 + if (__Pyx_get_runtime_version() < 0x03090000) return 0; + #endif + if (!always_call) { + PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*); + unsigned long flags = PyType_GetFlags(base); + if (flags & Py_TPFLAGS_HEAPTYPE) { + return 0; + } + } + Py_VISIT((PyObject*)Py_TYPE(o)); + return 0; +} +#endif + +/* PyMethodNew (used by CythonFunctionShared) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *result; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 + { + PyObject *args[] = {func, self}; + result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL); + } + #else + result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL); + #endif + return result; +} +#else +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#endif + +/* PyVectorcallFastCallDict (used by CythonFunctionShared) */ +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i; + #if CYTHON_AVOID_BORROWED_REFS + PyObject *pos; + #else + Py_ssize_t pos; + #endif + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + #if !CYTHON_ASSUME_SAFE_SIZE + Py_ssize_t nkw = PyDict_Size(kw); + if (unlikely(nkw == -1)) return NULL; + #else + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + #endif + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = 0; + i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) { + keys_are_strings &= + #if CYTHON_COMPILING_IN_LIMITED_API + PyType_GetFlags(Py_TYPE(key)); + #else + Py_TYPE(key)->tp_flags; + #endif + #if !CYTHON_ASSUME_SAFE_MACROS + if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup; + #else + PyTuple_SET_ITEM(kwnames, i, key); + #endif + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(pos); + #endif + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + Py_ssize_t kw_size = + likely(kw == NULL) ? + 0 : +#if !CYTHON_ASSUME_SAFE_SIZE + PyDict_Size(kw); +#else + PyDict_GET_SIZE(kw); +#endif + if (kw_size == 0) { + return vc(func, args, nargs, NULL); + } +#if !CYTHON_ASSUME_SAFE_SIZE + else if (unlikely(kw_size == -1)) { + return NULL; + } +#endif + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif + +/* CythonFunctionShared (used by CythonFunction) */ +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) { + if (__Pyx_CyFunction_Check(func)) { + return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; + } else if (PyCFunction_Check(func)) { + return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; + } + return 0; +} +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) { + int result; + PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func); + if (unlikely(!newFunc)) { + PyErr_Clear(); // It's only an optimization, so don't throw an error + return 0; + } + result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc); + Py_DECREF(newFunc); + return result; + } + return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc); +} +#else +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { + if (PyMethod_Check(func)) { + func = PyMethod_GET_FUNCTION(func); + } + return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +} +#endif +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + PyObject *result; + CYTHON_UNUSED_VAR(closure); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_doc_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#else + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_name_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_name, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + PyObject *result; + __Pyx_BEGIN_CRITICAL_SECTION(op); + Py_INCREF(op->func_qualname); + result = op->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +#endif +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = NULL; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_defaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_kwdefaults_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + __Pyx_BEGIN_CRITICAL_SECTION(op); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + __Pyx_END_CRITICAL_SECTION(); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + __Pyx_BEGIN_CRITICAL_SECTION(op); + result = __Pyx_CyFunction_get_annotations_locked(op); + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) { + int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; + if (is_coroutine) { + PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(is_coroutine_value)) { + return is_coroutine_value; + } +ignore: + PyErr_Clear(); + } + return __Pyx_PyBool_FromLong(is_coroutine); +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + PyObject *result; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + result = __Pyx_CyFunction_get_is_coroutine_value(op); + if (unlikely(!result)) + return NULL; + __Pyx_BEGIN_CRITICAL_SECTION(op); + if (op->func_is_coroutine) { + Py_DECREF(result); + result = __Pyx_NewRef(op->func_is_coroutine); + } else { + op->func_is_coroutine = __Pyx_NewRef(result); + } + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, message, size); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", + name, message, size); +#endif +} +static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); + if (!py_name) return; + PyErr_Format(PyExc_TypeError, + "%.200S() %s", + py_name, message); + Py_DECREF(py_name); +#else + const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; + PyErr_Format(PyExc_TypeError, + "%.200s() %s", + name, message); +#endif +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, +#else + {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, + {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, +#endif + {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#endif +#if CYTHON_METH_FASTCALL +#if CYTHON_COMPILING_IN_LIMITED_API + {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else + {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + PyObject *result = NULL; + CYTHON_UNUSED_VAR(args); + __Pyx_BEGIN_CRITICAL_SECTION(m); + Py_INCREF(m->func_qualname); + result = m->func_qualname; + __Pyx_END_CRITICAL_SECTION(); + return result; +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + op->func_dict = NULL; +#endif + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func_dict); +#elif PY_VERSION_HEX < 0x030d0000 + _PyObject_ClearManagedDict((PyObject*)m); +#else + PyObject_ClearManagedDict((PyObject*)m); +#endif + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + Py_CLEAR(m->defaults); + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + { + int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg); + if (e) return e; + } + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func_dict); +#else + { + int e = +#if PY_VERSION_HEX < 0x030d0000 + _PyObject_VisitManagedDict +#else + PyObject_VisitManagedDict +#endif + ((PyObject*)m, visit, arg); + if (e != 0) return e; + } +#endif + __Pyx_VISIT_CONST(m->func_name); + __Pyx_VISIT_CONST(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + __Pyx_VISIT_CONST(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + Py_VISIT(m->defaults); + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ + PyObject *repr; + __Pyx_BEGIN_CRITICAL_SECTION(op); + repr = PyUnicode_FromFormat("", + op->func_qualname, (void *)op); + __Pyx_END_CRITICAL_SECTION(); + return repr; +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes no arguments", size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_SIZE + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + __Pyx_CyFunction_raise_argument_count_error( + (__pyx_CyFunctionObject*)func, + "takes exactly one argument", size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } + __Pyx_CyFunction_raise_type_error( + (__pyx_CyFunctionObject*)func, "takes no keyword arguments"); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_SIZE + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(argc < 0)) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "needs an argument"); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) { + __Pyx_CyFunction_raise_type_error( + cyfunc, "takes no keyword arguments"); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes no arguments", nargs); + return NULL; + } + return meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + __Pyx_CyFunction_raise_argument_count_error( + cyfunc, "takes exactly one argument", nargs); + return NULL; + } + return meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); + PyObject *self; +#if CYTHON_COMPILING_IN_LIMITED_API + PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); + if (unlikely(!meth)) return NULL; +#else + PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; +#endif + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)cyfunc)->m_self; +#endif + break; + default: + return NULL; + } + #if PY_VERSION_HEX < 0x030e00A6 + size_t nargs_value = (size_t) nargs; + #else + Py_ssize_t nargs_value = nargs; + #endif + return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames); +} +#endif +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if CYTHON_METH_FASTCALL +#if defined(Py_TPFLAGS_HAVE_VECTORCALL) + Py_TPFLAGS_HAVE_VECTORCALL | +#elif defined(_Py_TPFLAGS_HAVE_VECTORCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif +#endif // CYTHON_METH_FASTCALL +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_DICT | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +static int __pyx_CyFunction_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL); + if (unlikely(mstate->__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type); + if (unlikely(!m->defaults)) + return NULL; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* AllocateExtensionType */ +static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) { + if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc); + return alloc_func(t, 0); + } else { + newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc); + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (!tp_new) { + PyObject *new_str = PyUnicode_FromString("__new__"); + if (likely(new_str)) { + PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL); + Py_DECREF(new_str); + return o; + } else + return NULL; + } else + #endif + return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0); + } +} + +/* VoidPtrExport */ +static int __Pyx_ExportVoidPtr(PyObject *api_dict, const char *name, void *p, const char *sig) { + PyObject *cobj; + cobj = PyCapsule_New(p, sig, 0); + if (!cobj) + goto bad; + if (PyDict_SetItemString(api_dict, name, cobj) < 0) + goto bad; + Py_DECREF(cobj); + return 0; +bad: + Py_XDECREF(cobj); + return -1; +} + +/* GetApiDict */ +static PyObject *__Pyx_ApiExport_GetApiDict(void) { + PyObject *d; + if (__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_capi, &d) == -1) + return NULL; + if (!d) { + d = PyDict_New(); + if (!d) + goto bad; + if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_pyx_capi, d) < 0) + goto bad; + } + return d; +bad: + Py_XDECREF(d); + return NULL; +} + +/* PyObjectCallNoArg (used by PyObjectCallMethod0) */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg[2] = {NULL, NULL}; + return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod (used by PyObjectCallMethod0) */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } +#endif + *method = attr; + return 0; +} +#endif + +/* PyObjectCallMethod0 (used by PyType_Ready) */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[1] = {obj}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_CallNoArg; + return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +#endif +} + +/* ValidateBasesTuple (used by PyType_Ready) */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_SIZE + n = PyTuple_GET_SIZE(bases); +#else + n = PyTuple_Size(bases); + if (unlikely(n < 0)) return -1; +#endif + for (i = 1; i < n; i++) + { + PyTypeObject *b; +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + if (dictoffset == 0) + { + Py_ssize_t b_dictoffset = 0; +#if CYTHON_USE_TYPE_SLOTS + b_dictoffset = b->tp_dictoffset; +#else + PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__"); + if (!py_b_dictoffset) goto dictoffset_return; + b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset); + Py_DECREF(py_b_dictoffset); + if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return; +#endif + if (b_dictoffset) { + { + __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); + } +#if !CYTHON_USE_TYPE_SLOTS + dictoffset_return: +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + } +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + } + return 0; +} +#endif + +/* PyType_Ready */ +CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) { + while (t) { + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases) { + return 1; + } + t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*); + } + return 0; +} +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + if (!__Pyx_PyType_HasMultipleInheritance(t)) { + return PyType_Ready(t); + } + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\ + !CYTHON_COMPILING_IN_GRAAL + gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* GetVTable (used by MergeVTables) */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_mstate_global->__pyx_n_u_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i=0; + Py_ssize_t size; + void** base_vtables; + __Pyx_TypeName tp_base_name = NULL; + __Pyx_TypeName base_name = NULL; + void* unknown = (void*)-1; + PyObject* bases = __Pyx_PyType_GetSlot(type, tp_bases, PyObject*); + int base_depth = 0; + { + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + while (base) { + base_depth += 1; + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + base_vtables = (void**) PyMem_Malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; +#if CYTHON_COMPILING_IN_LIMITED_API + size = PyTuple_Size(bases); + if (size < 0) goto other_failure; +#else + size = PyTuple_GET_SIZE(bases); +#endif + for (i = 1; i < size; i++) { + PyObject *basei; + void* base_vtable; +#if CYTHON_AVOID_BORROWED_REFS + basei = PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto other_failure; +#else + basei = PyTuple_GET_ITEM(bases, i); +#endif + base_vtable = __Pyx_GetVtable((PyTypeObject*)basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + if (base_vtable != NULL) { + int j; + PyTypeObject* base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = __Pyx_PyType_GetSlot(base, tp_base, PyTypeObject*); + } + } + } + PyErr_Clear(); + PyMem_Free(base_vtables); + return 0; +bad: + { + PyTypeObject* basei = NULL; + PyTypeObject* tp_base = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*); + tp_base_name = __Pyx_PyType_GetFullyQualifiedName(tp_base); +#if CYTHON_AVOID_BORROWED_REFS + basei = (PyTypeObject*)PySequence_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#elif !CYTHON_ASSUME_SAFE_MACROS + basei = (PyTypeObject*)PyTuple_GetItem(bases, i); + if (unlikely(!basei)) goto really_bad; +#else + basei = (PyTypeObject*)PyTuple_GET_ITEM(bases, i); +#endif + base_name = __Pyx_PyType_GetFullyQualifiedName(basei); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(basei); +#endif + } + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); +#if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +really_bad: // bad has failed! +#endif + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS +other_failure: +#endif + PyMem_Free(base_vtables); + return -1; +} + +/* DelItemOnTypeDict (used by SetupReduce) */ +static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) { + int result; + PyObject *tp_dict; +#if CYTHON_COMPILING_IN_LIMITED_API + tp_dict = __Pyx_GetTypeDict(tp); + if (unlikely(!tp_dict)) return -1; +#else + tp_dict = tp->tp_dict; +#endif + result = PyDict_DelItem(tp_dict, k); + if (likely(!result)) PyType_Modified(tp); + return result; +} + +/* SetupReduce */ +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_name_2); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate); +#else + getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate); + if (!getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (getstate) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); +#else + object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); + if (!object_getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (object_getstate != getstate) { + goto __PYX_GOOD; + } + } +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); + if (likely(reduce_cython)) { + ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); + if (likely(setstate_cython)) { + ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } + } + PyType_Modified((PyTypeObject*)type_obj); + } + } + goto __PYX_GOOD; +__PYX_BAD: + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); + } + ret = -1; +__PYX_GOOD: +#if !CYTHON_USE_PYTYPE_LOOKUP + Py_XDECREF(object_reduce); + Py_XDECREF(object_reduce_ex); + Py_XDECREF(object_getstate); + Py_XDECREF(getstate); +#endif + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; +} + +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_2_1 +#define __PYX_HAVE_RT_ImportType_3_2_1 +static PyTypeObject *__Pyx_ImportType_3_2_1(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_1 check_size) +{ + PyObject *result = 0; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) + PyObject *py_basicsize; + PyObject *py_itemsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) ) + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; +#else + if (size == 0) { + return (PyTypeObject *)result; + } + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize+itemsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_1 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_1 && (size_t)basicsize > size) { + if (PyErr_WarnFormat(NULL, 0, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize) < 0) { + goto bad; + } + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; +} +#endif + +/* PxdImportShared (used by VoidPtrImport) */ +#ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_1 +#define __PYX_HAVE_RT_ImportFromPxd_3_2_1 +static int __Pyx_ImportFromPxd_3_2_1(PyObject *module, const char *name, void **p, const char *sig, const char *what) { + PyObject *d = 0; + PyObject *cobj = 0; + d = PyObject_GetAttrString(module, "__pyx_capi__"); + if (!d) + goto bad; +#if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000) + PyDict_GetItemStringRef(d, name, &cobj); +#else + cobj = PyDict_GetItemString(d, name); + Py_XINCREF(cobj); +#endif + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%.200s does not export expected C %.8s %.200s", + PyModule_GetName(module), what, name); + goto bad; + } + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C %.8s %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", + what, PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); + goto bad; + } + *p = PyCapsule_GetPointer(cobj, sig); + if (!(*p)) + goto bad; + Py_DECREF(d); + Py_DECREF(cobj); + return 0; +bad: + Py_XDECREF(d); + Py_XDECREF(cobj); + return -1; +} +#endif + +/* VoidPtrImport */ +#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +#define __PYX_HAVE_RT_ImportVoidPtr_3_2_1 +static int __Pyx_ImportVoidPtr_3_2_1(PyObject *module, const char *name, void **p, const char *sig) { + return __Pyx_ImportFromPxd_3_2_1(module, name, p, sig, "variable"); +} +#endif + +/* FunctionImport */ +#ifndef __PYX_HAVE_RT_ImportFunction_3_2_1 +#define __PYX_HAVE_RT_ImportFunction_3_2_1 +static int __Pyx_ImportFunction_3_2_1(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + union { + void (*fp)(void); + void *p; + } tmp; + int result = __Pyx_ImportFromPxd_3_2_1(module, funcname, &tmp.p, sig, "function"); + if (result == 0) { + *f = tmp.fp; + } + return result; +} +#endif + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__2); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\ + CYTHON_COMPILING_IN_GRAAL + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); + } + return value; +} + +/* GetNameInClass */ +static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) { + PyObject *result; + PyObject *dict; + assert(PyType_Check(nmspace)); +#if CYTHON_USE_TYPE_SLOTS + dict = ((PyTypeObject*)nmspace)->tp_dict; + Py_XINCREF(dict); +#else + dict = PyObject_GetAttr(nmspace, __pyx_mstate_global->__pyx_n_u_dict); +#endif + if (likely(dict)) { + result = PyObject_GetItem(dict, name); + Py_DECREF(dict); + if (result) { + return result; + } + } + PyErr_Clear(); + __Pyx_GetModuleGlobalNameUncached(result, name); + return result; +} + +/* CLineInTraceback (used by AddTraceback) */ +#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +#define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) +#elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING +#define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); +#else +PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { + PyObject **dict_ptr = _PyObject_GetDictPtr(o); + return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; +} +#endif +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline = NULL; + PyObject *ptype, *pvalue, *ptraceback; + PyObject *cython_runtime_dict; + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, cython_runtime_dict, + __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) + } + if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + Py_XDECREF(use_cline); + Py_XDECREF(cython_runtime_dict); + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache (used by AddTraceback) */ +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { + __Pyx_CachedCodeObjectType* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!code_cache->entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { + return NULL; + } + code_object = code_cache->entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__find_code_object; + return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); + if (old_count < 0) { + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); + return NULL; + } +#endif + __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); +#endif + return result; +#endif +} +static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) +{ + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + code_cache->entries = entries; + code_cache->max_count = 64; + code_cache->count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); + if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { + __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_INCREF(code_object); + Py_DECREF(tmp); + return; + } + if (code_cache->count == code_cache->max_count) { + int new_max = code_cache->max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + code_cache->entries = entries; + code_cache->max_count = new_max; + } + for (i=code_cache->count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + code_cache->count++; + Py_INCREF(code_object); +} +static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS + (void)__pyx__insert_code_object; + return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. +#else + struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_nonatomic_int_type expected = 0; + if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { + return; + } +#endif + __pyx__insert_code_object(code_cache, code_line, code_object); +#if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING + __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); +#endif +#endif +} + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!code_object) { + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + } else { + py_funcname = PyUnicode_FromString(funcname); + } + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); + } else { + dict = PyDict_New(); + } + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; + if (c_line) { + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + } + py_code = PyCode_NewEmpty(filename, funcname, py_line); + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} +#endif + +/* CIntFromPyVerify */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CheckUnpickleChecksum */ +static void __Pyx_RaiseUnpickleChecksumError(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + PyObject *pickle_module = PyImport_ImportModule("pickle"); + if (unlikely(!pickle_module)) return; + PyObject *pickle_error = PyObject_GetAttrString(pickle_module, "PickleError"); + Py_DECREF(pickle_module); + if (unlikely(!pickle_error)) return; + if (checksum2 == checksum1) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x) = (%s))", + checksum, checksum1, members); + } else if (checksum3 == checksum2) { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, members); + } else { + PyErr_Format(pickle_error, "Incompatible checksums (0x%x vs (0x%x, 0x%x, 0x%x) = (%s))", + checksum, checksum1, checksum2, checksum3, members); + } + Py_DECREF(pickle_error); +} +static int __Pyx_CheckUnpickleChecksum(long checksum, long checksum1, long checksum2, long checksum3, const char *members) { + int found = 0; + found |= checksum1 == checksum; + found |= checksum2 == checksum; + found |= checksum3 == checksum; + if (likely(found)) + return 0; + __Pyx_RaiseUnpickleChecksumError(checksum, checksum1, checksum2, checksum3, members); + return -1; +} + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + if (b.imag == 0) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_float(a, a); + case 3: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); + case 4: + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powf(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2f(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + if (b.imag == 0) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_double(a, a); + case 3: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); + case 4: + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = pow(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +/* Declarations */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return ::std::complex< long double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + __pyx_t_long_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +/* Arithmetic */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) +#else + static CYTHON_INLINE int __Pyx_c_eq_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_sum_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_diff_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_prod_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + #if 1 + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsl(b.real) >= fabsl(b.imag)) { + if (b.real == 0 && b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + } else { + long double r = b.imag / b.real; + long double s = (long double)(1.0) / (b.real + b.imag * r); + return __pyx_t_long_double_complex_from_parts( + (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); + } + } else { + long double r = b.real / b.imag; + long double s = (long double)(1.0) / (b.imag + b.real * r); + return __pyx_t_long_double_complex_from_parts( + (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); + } + } + #else + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_quot_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + if (b.imag == 0) { + return __pyx_t_long_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else { + long double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_long_double_complex_from_parts( + (a.real * b.real + a.imag * b.imag) / denom, + (a.imag * b.real - a.real * b.imag) / denom); + } + } + #endif + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_neg_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero_long__double(__pyx_t_long_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_conj_long__double(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE long double __Pyx_c_abs_long__double(__pyx_t_long_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtl(z.real*z.real + z.imag*z.imag); + #else + return hypotl(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_long_double_complex __Pyx_c_pow_long__double(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + long double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + long double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + return __Pyx_c_prod_long__double(a, a); + case 3: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, a); + case 4: + z = __Pyx_c_prod_long__double(a, a); + return __Pyx_c_prod_long__double(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } else if ((b.imag == 0) && (a.real >= 0)) { + z.real = powl(a.real, b.real); + z.imag = 0; + return z; + } else if (a.real > 0) { + r = a.real; + theta = 0; + } else { + r = -a.real; + theta = atan2l(0.0, -1.0); + } + } else { + r = __Pyx_c_abs_long__double(a); + theta = atan2l(a.imag, a.real); + } + lnr = logl(r); + z_r = expl(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosl(z_theta); + z.imag = z_r * sinl(z_theta); + return z; + } + #endif +#endif + +/* MemviewRefcount */ +#include +#ifndef _Py_NO_RETURN +#define _Py_NO_RETURN +#endif +_Py_NO_RETURN +static void __pyx_fatalerror(const char *fmt, ...) { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + +/* MemviewSliceIsContig */ +static int +__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) +{ + int i, index, step, start; + Py_ssize_t itemsize = mvs.memview->view.itemsize; + if (order == 'F') { + step = 1; + start = 0; + } else { + step = -1; + start = ndim - 1; + } + for (i = 0; i < ndim; i++) { + index = start + step * i; + if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize) + return 0; + itemsize *= mvs.shape[index]; + } + return 1; +} + +/* OverlappingSlices */ +static void +__pyx_get_array_memory_extents(__Pyx_memviewslice *slice, + void **out_start, void **out_end, + int ndim, size_t itemsize) +{ + char *start, *end; + int i; + start = end = slice->data; + for (i = 0; i < ndim; i++) { + Py_ssize_t stride = slice->strides[i]; + Py_ssize_t extent = slice->shape[i]; + if (extent == 0) { + *out_start = *out_end = start; + return; + } else { + if (stride > 0) + end += stride * (extent - 1); + else + start += stride * (extent - 1); + } + } + *out_start = start; + *out_end = end + itemsize; +} +static int +__pyx_slices_overlap(__Pyx_memviewslice *slice1, + __Pyx_memviewslice *slice2, + int ndim, size_t itemsize) +{ + void *start1, *end1, *start2, *end2; + __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize); + __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize); + return (start1 < end2) && (start2 < end1); +} + +/* MemviewSliceInit */ +static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF((PyObject*)memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(uint64_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(uint64_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPy */ +static CYTHON_INLINE uint64_t __Pyx_PyLong_As_uint64_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + uint64_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (uint64_t) -1; + val = __Pyx_PyLong_As_uint64_t(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) { + return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) { + return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) { + return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint64_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(uint64_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(uint64_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x)) + } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + uint64_t val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (uint64_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (uint64_t) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (uint64_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (uint64_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(uint64_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((uint64_t) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint64_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (uint64_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint64_t"); + return (uint64_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint64_t"); + return (uint64_t) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + int val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (int) -1; + val = __Pyx_PyLong_As_int(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(int) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(int) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + int val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (int) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (int) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = v; + } + v = NULL; + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((int) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (int) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + long val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (long) -1; + val = __Pyx_PyLong_As_long(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(long) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(long) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + long val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (long) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (long) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = v; + } + v = NULL; + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((long) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (long) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_enum____pyx_t_5spacy_5attrs_attr_id_t(enum __pyx_t_5spacy_5attrs_attr_id_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum __pyx_t_5spacy_5attrs_attr_id_t neg_one = (enum __pyx_t_5spacy_5attrs_attr_id_t) -1, const_zero = (enum __pyx_t_5spacy_5attrs_attr_id_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#if !CYTHON_COMPILING_IN_PYPY + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyLong_FromLong((long) value); + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 + if (is_unsigned) { + return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); + } else { + return PyLong_FromNativeBytes(bytes, sizeof(value), -1); + } +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + int one = 1; int little = (int)*(unsigned char *)&one; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + int one = 1; int little = (int)*(unsigned char *)&one; + PyObject *from_bytes, *result = NULL, *kwds = NULL; + PyObject *py_bytes = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + { + PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; + if (!is_unsigned) { + kwds = __Pyx_MakeVectorcallBuilderKwds(1); + if (!kwds) goto limited_bad; + if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; + } + result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); + } + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPy */ +static CYTHON_INLINE enum __pyx_t_5spacy_5attrs_attr_id_t __Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum __pyx_t_5spacy_5attrs_attr_id_t neg_one = (enum __pyx_t_5spacy_5attrs_attr_id_t) -1, const_zero = (enum __pyx_t_5spacy_5attrs_attr_id_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + enum __pyx_t_5spacy_5attrs_attr_id_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; + val = __Pyx_PyLong_As_enum____pyx_t_5spacy_5attrs_attr_id_t(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) >= 2 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) >= 3 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) >= 4 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 2 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((enum __pyx_t_5spacy_5attrs_attr_id_t)-1)*(((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 2 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) ((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 3 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((enum __pyx_t_5spacy_5attrs_attr_id_t)-1)*(((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 3 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) ((((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 4 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) (((enum __pyx_t_5spacy_5attrs_attr_id_t)-1)*(((((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum __pyx_t_5spacy_5attrs_attr_id_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) - 1 > 4 * PyLong_SHIFT)) { + return (enum __pyx_t_5spacy_5attrs_attr_id_t) ((((((((((enum __pyx_t_5spacy_5attrs_attr_id_t)digits[3]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[2]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[1]) << PyLong_SHIFT) | (enum __pyx_t_5spacy_5attrs_attr_id_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_5attrs_attr_id_t, long, PyLong_AsLong(x)) + } else if ((sizeof(enum __pyx_t_5spacy_5attrs_attr_id_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(enum __pyx_t_5spacy_5attrs_attr_id_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + enum __pyx_t_5spacy_5attrs_attr_id_t val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() or PyLong_AsNativeBytes() not available, cannot convert large enums"); + val = (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; +#endif + if (unlikely(ret)) + return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to enum __pyx_t_5spacy_5attrs_attr_id_t"); + return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to enum __pyx_t_5spacy_5attrs_attr_id_t"); + return (enum __pyx_t_5spacy_5attrs_attr_id_t) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE size_t __Pyx_PyLong_As_size_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + size_t val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyLong_As_size_t(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 4 * PyLong_SHIFT)) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(size_t) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(size_t) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + size_t val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (size_t) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (size_t) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (size_t) -1; + } else { + stepval = v; + } + v = NULL; + val = (size_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(size_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((size_t) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((size_t) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (size_t) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; +} + +/* MemviewSliceCopy */ +static __Pyx_memviewslice +__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, + const char *mode, int ndim, + size_t sizeof_dtype, int contig_flag, + int dtype_is_object) +{ + __Pyx_RefNannyDeclarations + int i; + __Pyx_memviewslice new_mvs = __Pyx_MEMSLICE_INIT; + struct __pyx_memoryview_obj *from_memview = from_mvs->memview; + Py_buffer *buf = &from_memview->view; + PyObject *shape_tuple = NULL; + PyObject *temp_int = NULL; + struct __pyx_array_obj *array_obj = NULL; + struct __pyx_memoryview_obj *memview_obj = NULL; + __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); + for (i = 0; i < ndim; i++) { + if (unlikely(from_mvs->suboffsets[i] >= 0)) { + PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " + "indirect dimensions (axis %d)", i); + goto fail; + } + } + shape_tuple = PyTuple_New(ndim); + if (unlikely(!shape_tuple)) { + goto fail; + } + __Pyx_GOTREF(shape_tuple); + for(i = 0; i < ndim; i++) { + temp_int = PyLong_FromSsize_t(from_mvs->shape[i]); + if(unlikely(!temp_int)) { + goto fail; + } else { +#if CYTHON_ASSUME_SAFE_MACROS + PyTuple_SET_ITEM(shape_tuple, i, temp_int); +#else + if (PyTuple_SetItem(shape_tuple, i, temp_int) < 0) { + goto fail; + } +#endif + temp_int = NULL; + } + } + array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, mode, NULL); + if (unlikely(!array_obj)) { + goto fail; + } + __Pyx_GOTREF(array_obj); + memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new( + (PyObject *) array_obj, contig_flag, + dtype_is_object, + from_mvs->memview->typeinfo); + if (unlikely(!memview_obj)) + goto fail; + if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0)) + goto fail; + if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim, + dtype_is_object) < 0)) + goto fail; + goto no_fail; +fail: + __Pyx_XDECREF((PyObject *) new_mvs.memview); + new_mvs.memview = NULL; + new_mvs.data = NULL; +no_fail: + __Pyx_XDECREF(shape_tuple); + __Pyx_XDECREF(temp_int); + __Pyx_XDECREF((PyObject *) array_obj); + __Pyx_RefNannyFinishContext(); + return new_mvs; +} + +/* PyObjectCallMethod1 */ +#if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); + return result; +} +#endif +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { +#if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) + PyObject *args[2] = {obj, arg}; + (void) __Pyx_PyObject_CallOneArg; + (void) __Pyx_PyObject_Call2Args; + return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); +#else + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +#endif +} + +/* UpdateUnpickledDict */ +static int __Pyx__UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + PyObject *state_dict = __Pyx_PySequence_ITEM(state, index); + if (unlikely(!state_dict)) { + return -1; + } + int non_empty = PyObject_IsTrue(state_dict); + if (non_empty == 0) { + Py_DECREF(state_dict); + return 0; + } else if (unlikely(non_empty == -1)) { + return -1; + } + PyObject *dict; + #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + dict = PyObject_GetAttrString(obj, "__dict__"); + #else + dict = PyObject_GenericGetDict(obj, NULL); + #endif + if (unlikely(!dict)) { + Py_DECREF(state_dict); + return -1; + } + int result; + if (likely(PyDict_CheckExact(dict))) { + result = PyDict_Update(dict, state_dict); + } else { + PyObject *obj_result = __Pyx_PyObject_CallMethod1(dict, __pyx_mstate_global->__pyx_n_u_update, state_dict); + if (likely(obj_result)) { + Py_DECREF(obj_result); + result = 0; + } else { + result = -1; + } + } + Py_DECREF(state_dict); + Py_DECREF(dict); + return result; +} +static int __Pyx_UpdateUnpickledDict(PyObject *obj, PyObject *state, Py_ssize_t index) { + Py_ssize_t state_size = __Pyx_PyTuple_GET_SIZE(state); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(state_size == -1)) return -1; + #endif + if (state_size <= index) { + return 0; + } + return __Pyx__UpdateUnpickledDict(obj, state, index); +} + +/* CIntFromPy */ +static CYTHON_INLINE char __Pyx_PyLong_As_char(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const char neg_one = (char) -1, const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (unlikely(!PyLong_Check(x))) { + char val; + PyObject *tmp = __Pyx_PyNumber_Long(x); + if (!tmp) return (char) -1; + val = __Pyx_PyLong_As_char(tmp); + Py_DECREF(tmp); + return val; + } + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } + } + break; + } + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (char) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if ((sizeof(char) <= sizeof(unsigned long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } + } + break; + } + } +#endif + if ((sizeof(char) <= sizeof(long))) { + __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { + char val; + int ret = -1; +#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API + Py_ssize_t bytes_copied = PyLong_AsNativeBytes( + x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); + if (unlikely(bytes_copied == -1)) { + } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { + goto raise_overflow; + } else { + ret = 0; + } +#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + ret = _PyLong_AsByteArray((PyLongObject *)x, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *v; + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (likely(PyLong_CheckExact(x))) { + v = __Pyx_NewRef(x); + } else { + v = PyNumber_Long(x); + if (unlikely(!v)) return (char) -1; + assert(PyLong_CheckExact(v)); + } + { + int result = PyObject_RichCompareBool(v, Py_False, Py_LT); + if (unlikely(result < 0)) { + Py_DECREF(v); + return (char) -1; + } + is_negative = result == 1; + } + if (is_unsigned && unlikely(is_negative)) { + Py_DECREF(v); + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + Py_DECREF(v); + if (unlikely(!stepval)) + return (char) -1; + } else { + stepval = v; + } + v = NULL; + val = (char) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + long idigit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + val |= ((char) idigit) << bits; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + } + Py_DECREF(shift); shift = NULL; + Py_DECREF(mask); mask = NULL; + { + long idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + } + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif + if (unlikely(ret)) + return (char) -1; + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to char"); + return (char) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to char"); + return (char) -1; +} + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 +static __Pyx_TypeName +__Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) +{ + PyObject *module = NULL, *name = NULL, *result = NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_qualname); + #else + name = PyType_GetQualName(tp); + #endif + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; + module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_mstate_global->__pyx_n_u_module); + if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; + if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { + result = name; + name = NULL; + goto done; + } + result = PyUnicode_FromFormat("%U.%U", module, name); + if (unlikely(result == NULL)) goto bad; + done: + Py_XDECREF(name); + Py_XDECREF(module); + return result; + bad: + PyErr_Clear(); + if (name) { + result = name; + name = NULL; + } else { + result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__14); + } + goto done; +} +#endif + +/* GetRuntimeVersion */ +#if __PYX_LIMITED_VERSION_HEX < 0x030b0000 +void __Pyx_init_runtime_version(void) { + if (__Pyx_cached_runtime_version == 0) { + const char* rt_version = Py_GetVersion(); + unsigned long version = 0; + unsigned long factor = 0x01000000UL; + unsigned int digit = 0; + int i = 0; + while (factor) { + while ('0' <= rt_version[i] && rt_version[i] <= '9') { + digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); + ++i; + } + version += factor * digit; + if (rt_version[i] != '.') + break; + digit = 0; + factor >>= 8; + ++i; + } + __Pyx_cached_runtime_version = version; + } +} +#endif +static unsigned long __Pyx_get_runtime_version(void) { +#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + return Py_Version & ~0xFFUL; +#else + return __Pyx_cached_runtime_version; +#endif +} + +/* IterNextPlain (used by CoroutineBase) */ +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 +static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) { + if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache)) + __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next); + return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache; +} +#endif +static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) { +#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 + PyObject *result; + PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI(); + if (unlikely(!next)) return NULL; + result = PyObject_CallFunctionObjArgs(next, iterator, NULL); + return result; +#else + (void)__Pyx_GetBuiltinName; // only for early limited API + iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator); + assert(iternext); + return iternext(iterator); +#endif +} + +/* ReturnWithStopIteration (used by CoroutineBase) */ +static void __Pyx__ReturnWithStopIteration(PyObject* value, int async); +static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) { + if (value == Py_None) { + if (async || !iternext) + PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration); + return; + } + __Pyx__ReturnWithStopIteration(value, async); +} +static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) { +#if CYTHON_COMPILING_IN_CPYTHON + __Pyx_PyThreadState_declare +#endif + PyObject *exc; + PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration; +#if CYTHON_COMPILING_IN_CPYTHON + if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) { + if (PY_VERSION_HEX >= (0x030e00A1)) { + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + } else { + PyObject *args_tuple = PyTuple_New(1); + if (unlikely(!args_tuple)) return; + Py_INCREF(value); + PyTuple_SET_ITEM(args_tuple, 0, value); + exc = PyObject_Call(exc_type, args_tuple, NULL); + Py_DECREF(args_tuple); + } + if (unlikely(!exc)) return; + } else { + Py_INCREF(value); + exc = value; + } + #if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + #if CYTHON_USE_EXC_INFO_STACK + if (!__pyx_tstate->exc_info->exc_value) + #else + if (!__pyx_tstate->exc_type) + #endif + { + Py_INCREF(exc_type); + __Pyx_ErrRestore(exc_type, exc, NULL); + return; + } + #endif +#else + exc = __Pyx_PyObject_CallOneArg(exc_type, value); + if (unlikely(!exc)) return; +#endif + PyErr_SetObject(exc_type, exc); + Py_DECREF(exc); +} + +/* CoroutineBase (used by Generator) */ +#if !CYTHON_COMPILING_IN_LIMITED_API +#include +#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#endif // CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void +__Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) { +#if CYTHON_USE_AM_SEND + gen->yieldfrom_am_send = NULL; +#endif + Py_CLEAR(gen->yieldfrom); +} +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + CYTHON_UNUSED_VAR(__pyx_tstate); + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (likely(et == PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + value = Py_None; + } + else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); + if (unlikely(!value)) goto limited_api_failure; + #else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + #endif + Py_DECREF(ev); + } + else if (unlikely(PyTuple_Check(ev))) { + Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(tuple_size < 0)) { + Py_XDECREF(tb); + Py_DECREF(ev); + Py_DECREF(et); + return -1; + } + #endif + if (tuple_size >= 1) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + value = PyTuple_GET_ITEM(ev, 0); + Py_INCREF(value); +#elif CYTHON_ASSUME_SAFE_MACROS + value = PySequence_ITEM(ev, 0); +#else + value = PySequence_GetItem(ev, 0); + if (!value) goto limited_api_failure; +#endif + } else { + Py_INCREF(Py_None); + value = Py_None; + } + Py_DECREF(ev); + } + else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { + value = ev; + } + if (likely(value)) { + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = value; + return 0; + } + } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if CYTHON_COMPILING_IN_LIMITED_API + value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value); +#else + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); +#endif + Py_DECREF(ev); +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!value)) return -1; +#endif + *pvalue = value; + return 0; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS + limited_api_failure: + Py_XDECREF(et); + Py_XDECREF(tb); + Py_XDECREF(ev); + return -1; +#endif +} +static CYTHON_INLINE +__Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) { + if (*retval) { + return PYGEN_NEXT; + } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) { + return PYGEN_RETURN; + } else { + return PYGEN_ERROR; + } +} +static CYTHON_INLINE +void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_CLEAR(exc_state->exc_value); +#else + PyObject *t, *v, *tb; + t = exc_state->exc_type; + v = exc_state->exc_value; + tb = exc_state->exc_traceback; + exc_state->exc_type = NULL; + exc_state->exc_value = NULL; + exc_state->exc_traceback = NULL; + Py_XDECREF(t); + Py_XDECREF(v); + Py_XDECREF(tb); +#endif +} +#define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) +static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) { + const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { + msg = "coroutine already executing"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { + msg = "async generator already executing"; + #endif + } else { + msg = "generator already executing"; + } + PyErr_SetString(PyExc_ValueError, msg); +} +static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) { + CYTHON_MAYBE_UNUSED_VAR(gen); + CYTHON_MAYBE_UNUSED_VAR(closing); + #ifdef __Pyx_Coroutine_USED + if (!closing && __Pyx_Coroutine_Check(gen)) { + PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); + } else + #endif + if (value) { + #ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(gen)) + PyErr_SetNone(PyExc_StopAsyncIteration); + else + #endif + PyErr_SetNone(PyExc_StopIteration); + } +} +static +__Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) { + __Pyx_PyThreadState_declare + PyThreadState *tstate; + __Pyx_ExcInfoStruct *exc_state; + PyObject *retval; + assert(__Pyx_Coroutine_get_is_running(self)); // Callers should ensure is_running + if (unlikely(self->resume_label == -1)) { + __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); + return PYGEN_ERROR; + } +#if CYTHON_FAST_THREAD_STATE + __Pyx_PyThreadState_assign + tstate = __pyx_tstate; +#else + tstate = __Pyx_PyThreadState_Current; +#endif + exc_state = &self->gi_exc_state; + if (exc_state->exc_value) { + #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + #else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #elif PY_VERSION_HEX >= 0x030B00a4 + exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback; + #else + exc_tb = exc_state->exc_traceback; + #endif + if (exc_tb) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + assert(f->f_back == NULL); + #if PY_VERSION_HEX >= 0x030B00A1 + f->f_back = PyThreadState_GetFrame(tstate); + #else + Py_XINCREF(tstate->frame); + f->f_back = tstate->frame; + #endif + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + Py_DECREF(exc_tb); + #endif + } + #endif + } +#if CYTHON_USE_EXC_INFO_STACK + exc_state->previous_item = tstate->exc_info; + tstate->exc_info = exc_state; +#else + if (exc_state->exc_type) { + __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } else { + __Pyx_Coroutine_ExceptionClear(exc_state); + __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); + } +#endif + retval = self->body(self, tstate, value); +#if CYTHON_USE_EXC_INFO_STACK + exc_state = &self->gi_exc_state; + tstate->exc_info = exc_state->previous_item; + exc_state->previous_item = NULL; + __Pyx_Coroutine_ResetFrameBackpointer(exc_state); +#endif + *result = retval; + if (self->resume_label == -1) { + return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR; + } + return PYGEN_NEXT; +} +static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(exc_state); +#else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 + if (!exc_state->exc_value) return; + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #else + exc_tb = exc_state->exc_traceback; + #endif + if (likely(exc_tb)) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + #if PY_VERSION_HEX >= 0x030B00a4 + Py_DECREF(exc_tb); + #endif + } +#endif +} +#define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\ + ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext)) +static PyObject * +__Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) { + CYTHON_MAYBE_UNUSED_VAR(gen); + if (likely(result == PYGEN_RETURN)) { + int is_async = 0; + #ifdef __Pyx_AsyncGen_USED + is_async = __Pyx_AsyncGen_CheckExact(gen); + #endif + __Pyx_ReturnWithStopIteration(retval, is_async, iternext); + Py_XDECREF(retval); + } + return NULL; +} +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE +PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { +#if PY_VERSION_HEX <= 0x030A00A1 + return _PyGen_Send(gen, arg); +#else + PyObject *result; + if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { + if (PyAsyncGen_CheckExact(gen)) { + assert(result == Py_None); + PyErr_SetNone(PyExc_StopAsyncIteration); + } + else if (result == Py_None) { + PyErr_SetNone(PyExc_StopIteration); + } + else { +#if PY_VERSION_HEX < 0x030d00A1 + _PyGen_SetStopIterationValue(result); +#else + if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) { + PyErr_SetObject(PyExc_StopIteration, result); + } else { + PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result); + if (likely(exc != NULL)) { + PyErr_SetObject(PyExc_StopIteration, exc); + Py_DECREF(exc); + } + } +#endif + } + Py_DECREF(result); + result = NULL; + } + return result; +#endif +} +#endif +static CYTHON_INLINE __Pyx_PySendResult +__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) { + __Pyx_PySendResult result; + PyObject *val = NULL; + assert(__Pyx_Coroutine_get_is_running(gen)); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); + result = __Pyx_Coroutine_SendEx(gen, val, retval, 0); + Py_XDECREF(val); + return result; +} +#if CYTHON_USE_AM_SEND +static __Pyx_PySendResult +__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) { + PyObject *ret = NULL; + __Pyx_PySendResult delegate_result, result; + assert(__Pyx_Coroutine_get_is_running(gen)); + delegate_result = gen_am_send(gen->yieldfrom, value, &ret); + if (delegate_result == PYGEN_NEXT) { + assert (ret != NULL); + *retval = ret; + return PYGEN_NEXT; + } + assert (delegate_result != PYGEN_ERROR || ret == NULL); + __Pyx_Coroutine_Undelegate(gen); + result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0); + Py_XDECREF(ret); + return result; +} +#endif +static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); +} +static __Pyx_PySendResult +__Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) { + __Pyx_PySendResult result; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #if !CYTHON_USE_AM_SEND + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + ret = __Pyx_Coroutine_Send(yf, value); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + ret = __Pyx_async_gen_asend_send(yf, value); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + if (PyCoro_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); + } else + #endif + #endif + { + #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000 + if (value == Py_None && PyIter_Check(yf)) + ret = __Pyx_PyIter_Next_Plain(yf); + else + #endif + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value); + } + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + *retval = ret; + return PYGEN_NEXT; + } + result = __Pyx_Coroutine_FinishDelegation(gen, retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, value, retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return result; +} +static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + CYTHON_UNUSED_VAR(gen); + assert(__Pyx_Coroutine_get_is_running(gen)); + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_Check(yf)) { + result = __Pyx_Coroutine_Close(yf, &retval); + } else + if (__Pyx_CoroutineAwait_CheckExact(yf)) { + result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf); + } else + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_PyAsyncGenASend_CheckExact(yf)) { + retval = __Pyx_async_gen_asend_close(yf, NULL); + result = PYGEN_RETURN; + } else + if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { + retval = __Pyx_async_gen_athrow_close(yf, NULL); + result = PYGEN_RETURN; + } else + #endif + { + PyObject *meth; + result = PYGEN_RETURN; + meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close); + if (unlikely(!meth)) { + if (unlikely(PyErr_Occurred())) { + PyErr_WriteUnraisable(yf); + } + } else { + retval = __Pyx_PyObject_CallNoArg(meth); + Py_DECREF(meth); + if (unlikely(!retval)) { + result = PYGEN_ERROR; + } + } + } + Py_XDECREF(retval); + return result == PYGEN_ERROR ? -1 : 0; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __Pyx_PySendResult result; + PyObject *retval = NULL; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + #if CYTHON_USE_AM_SEND + if (gen->yieldfrom_am_send) { + result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval); + } else + #endif + if (gen->yieldfrom) { + PyObject *yf = gen->yieldfrom; + PyObject *ret; + #ifdef __Pyx_Generator_USED + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Next(yf); + } else + #endif + #ifdef __Pyx_Coroutine_USED + if (__Pyx_Coroutine_CheckExact(yf)) { + ret = __Pyx_Coroutine_Send(yf, Py_None); + } else + #endif + #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND) + if (PyGen_CheckExact(yf)) { + ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); + } else + #endif + ret = __Pyx_PyIter_Next_Plain(yf); + if (likely(ret)) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &retval); + } else { + result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + } + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1); +} +static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) { + PyObject *retval = NULL; + __Pyx_PySendResult result; + CYTHON_UNUSED_VAR(arg); + result = __Pyx_Coroutine_Close(self, &retval); + if (unlikely(result == PYGEN_ERROR)) + return NULL; + Py_XDECREF(retval); + Py_RETURN_NONE; +} +static __Pyx_PySendResult +__Pyx_Coroutine_Close(PyObject *self, PyObject **retval) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PySendResult result; + PyObject *yf; + int err = 0; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + *retval = __Pyx_Coroutine_AlreadyRunningError(gen); + return PYGEN_ERROR; + } + yf = gen->yieldfrom; + if (yf) { + Py_INCREF(yf); + err = __Pyx_Coroutine_CloseIter(gen, yf); + __Pyx_Coroutine_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) + PyErr_SetNone(PyExc_GeneratorExit); + result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1); + if (result == PYGEN_ERROR) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_Coroutine_unset_is_running(gen); + if (!__Pyx_PyErr_Occurred()) { + return PYGEN_RETURN; + } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) { + __Pyx_PyErr_Clear(); + return PYGEN_RETURN; + } + return PYGEN_ERROR; + } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) { + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_RETURN; + } else { + const char *msg; + Py_DECREF(*retval); + *retval = NULL; + if ((0)) { + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_Coroutine_Check(self)) { + msg = "coroutine ignored GeneratorExit"; + #endif + #ifdef __Pyx_AsyncGen_USED + } else if (__Pyx_AsyncGen_CheckExact(self)) { + msg = "async generator ignored GeneratorExit"; + #endif + } else { + msg = "generator ignored GeneratorExit"; + } + PyErr_SetString(PyExc_RuntimeError, msg); + __Pyx_Coroutine_unset_is_running(gen); + return PYGEN_ERROR; + } +} +static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, + PyObject *args, int close_on_genexit) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject *yf; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) + return __Pyx_Coroutine_AlreadyRunningError(gen); + yf = gen->yieldfrom; + if (yf) { + __Pyx_PySendResult result; + PyObject *ret; + Py_INCREF(yf); + if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { + int err = __Pyx_Coroutine_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Coroutine_Undelegate(gen); + if (err < 0) + goto propagate_exception; + goto throw_here; + } + if (0 + #ifdef __Pyx_Generator_USED + || __Pyx_Generator_CheckExact(yf) + #endif + #ifdef __Pyx_Coroutine_USED + || __Pyx_Coroutine_Check(yf) + #endif + ) { + ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); + #ifdef __Pyx_Coroutine_USED + } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { + ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); + #endif + } else { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (unlikely(PyErr_Occurred())) { + __Pyx_Coroutine_unset_is_running(gen); + return NULL; + } + __Pyx_Coroutine_Undelegate(gen); + goto throw_here; + } + if (likely(args)) { + ret = __Pyx_PyObject_Call(meth, args, NULL); + } else { + PyObject *cargs[4] = {NULL, typ, val, tb}; + ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); + } + Py_DECREF(meth); + } + Py_DECREF(yf); + if (ret) { + __Pyx_Coroutine_unset_is_running(gen); + return ret; + } + result = __Pyx_Coroutine_FinishDelegation(gen, &ret); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0); + } +throw_here: + __Pyx_Raise(typ, val, tb, NULL); +propagate_exception: + { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0); + } +} +static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { + PyObject *typ; + PyObject *val = NULL; + PyObject *tb = NULL; + if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb))) + return NULL; + return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); +} +static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_VISIT(exc_state->exc_value); +#else + Py_VISIT(exc_state->exc_type); + Py_VISIT(exc_state->exc_value); + Py_VISIT(exc_state->exc_traceback); +#endif + return 0; +} +static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { + { + int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg); + if (e) return e; + } + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); +} +static int __Pyx_Coroutine_clear(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + __Pyx_Coroutine_Undelegate(gen); + __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); + } +#endif + Py_CLEAR(gen->gi_code); + Py_CLEAR(gen->gi_frame); + Py_CLEAR(gen->gi_name); + Py_CLEAR(gen->gi_qualname); + Py_CLEAR(gen->gi_modulename); + return 0; +} +static void __Pyx_Coroutine_dealloc(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + PyObject_GC_UnTrack(gen); + #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + if (gen->gi_weakreflist != NULL) + #endif + PyObject_ClearWeakRefs(self); + if (gen->resume_label >= 0) { + PyObject_GC_Track(self); +#if CYTHON_USE_TP_FINALIZE + if (unlikely(PyObject_CallFinalizerFromDealloc(self))) +#else + { + destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor); + if (del) del(self); + } + if (unlikely(Py_REFCNT(self) > 0)) +#endif + { + return; + } + PyObject_GC_UnTrack(self); + } +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + /* We have to handle this case for asynchronous generators + right here, because this code has to be between UNTRACK + and GC_Del. */ + Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); + } +#endif + __Pyx_Coroutine_clear(self); + __Pyx_PyHeapTypeObject_GC_Del(gen); +} +#if CYTHON_USE_TP_FINALIZE +static void __Pyx_Coroutine_del(PyObject *self) { + PyObject *error_type, *error_value, *error_traceback; + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; + __Pyx_PyThreadState_declare + if (gen->resume_label < 0) { + return; + } + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); +#ifdef __Pyx_AsyncGen_USED + if (__Pyx_AsyncGen_CheckExact(self)) { + __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; + PyObject *finalizer = agen->ag_finalizer; + if (finalizer && !agen->ag_closed) { + PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); + if (unlikely(!res)) { + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); + return; + } + } +#endif + if (unlikely(gen->resume_label == 0 && !error_value)) { +#ifdef __Pyx_Coroutine_USED +#ifdef __Pyx_Generator_USED + if (!__Pyx_Generator_CheckExact(self)) +#endif + { + PyObject_GC_UnTrack(self); + if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) + PyErr_WriteUnraisable(self); + PyObject_GC_Track(self); + } +#endif + } else { + PyObject *retval = NULL; + __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval); + if (result == PYGEN_ERROR) { + PyErr_WriteUnraisable(self); + } else { + Py_XDECREF(retval); + } + } + __Pyx_ErrRestore(error_type, error_value, error_traceback); +} +#endif +static PyObject * +__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_name; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(self->gi_name, value); + return 0; +} +static PyObject * +__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context) +{ + PyObject *name = self->gi_qualname; + CYTHON_UNUSED_VAR(context); + if (unlikely(!name)) name = Py_None; + Py_INCREF(name); + return name; +} +static int +__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL || !PyUnicode_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(self->gi_qualname, value); + return 0; +} +static PyObject * +__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self) +{ +#if !CYTHON_COMPILING_IN_LIMITED_API + PyObject *frame; + #if PY_VERSION_HEX >= 0x030d0000 + Py_BEGIN_CRITICAL_SECTION(self); + #endif + frame = self->gi_frame; + if (!frame) { + if (unlikely(!self->gi_code)) { + Py_RETURN_NONE; + } + PyObject *globals = PyDict_New(); + if (unlikely(!globals)) return NULL; + frame = (PyObject *) PyFrame_New( + PyThreadState_Get(), /*PyThreadState *tstate,*/ + (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ + globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + Py_DECREF(globals); + if (unlikely(!frame)) + return NULL; + if (unlikely(self->gi_frame)) { + Py_DECREF(frame); + frame = self->gi_frame; + } else { + self->gi_frame = frame; + } + } + Py_INCREF(frame); + #if PY_VERSION_HEX >= 0x030d0000 + Py_END_CRITICAL_SECTION(); + #endif + return frame; +#else + CYTHON_UNUSED_VAR(self); + Py_RETURN_NONE; +#endif +} +static PyObject * +__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) { + CYTHON_UNUSED_VAR(context); + PyObject *frame = self->gi_frame; + if (frame) + return __Pyx_NewRef(frame); + return __Pyx__Coroutine_get_frame(self); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_New( + PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); + if (unlikely(!gen)) + return NULL; + return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); +} +static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( + __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, + PyObject *name, PyObject *qualname, PyObject *module_name) { + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->yieldfrom_am_send = NULL; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API + gen->gi_exc_state.exc_value = NULL; + #else + gen->gi_exc_state.exc_type = NULL; + gen->gi_exc_state.exc_value = NULL; + gen->gi_exc_state.exc_traceback = NULL; + #endif +#if CYTHON_USE_EXC_INFO_STACK + gen->gi_exc_state.previous_item = NULL; +#endif +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + gen->gi_weakreflist = NULL; +#endif + Py_XINCREF(qualname); + gen->gi_qualname = qualname; + Py_XINCREF(name); + gen->gi_name = name; + Py_XINCREF(module_name); + gen->gi_modulename = module_name; + Py_XINCREF(code); + gen->gi_code = code; + gen->gi_frame = NULL; + PyObject_GC_Track(gen); + return gen; +} +static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + gen->is_running = 1; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; +} +static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) { + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + assert(gen->is_running); + gen->is_running = 0; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif +} +static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) { + char result; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_BEGIN_CRITICAL_SECTION(gen); + #endif + result = gen->is_running; + #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_END_CRITICAL_SECTION(); + #endif + return result; +} +static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) { + CYTHON_UNUSED_VAR(closure); + char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen); + if (result) Py_RETURN_TRUE; + else Py_RETURN_FALSE; +} +#if __PYX_HAS_PY_AM_SEND == 2 +static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) { + Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type; + if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) { + return; + } + memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async)); + static_amsend_methods->am_send = am_send; + type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods); +} +#endif +static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); + __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self)); + PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object", + self_type_name); + __Pyx_DECREF_TypeName(self_type_name); + return NULL; +} + +/* Generator */ +static PyMethodDef __pyx_Generator_methods[] = { + {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, + PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, + {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, + PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, + {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, + PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, + {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0}, + {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; +static PyMemberDef __pyx_Generator_memberlist[] = { + {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, + PyDoc_STR("object being iterated by 'yield from', or None")}, + {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, + {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0}, +#if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API + {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyGetSetDef __pyx_Generator_getsets[] = { + {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, + PyDoc_STR("name of the generator"), 0}, + {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, + PyDoc_STR("qualified name of the generator"), 0}, + {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL, + PyDoc_STR("Frame of the generator"), 0}, + {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL}, + {0, 0, 0, 0, 0} +}; +static PyType_Slot __pyx_GeneratorType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc}, + {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse}, + {Py_tp_iter, (void *)PyObject_SelfIter}, + {Py_tp_iternext, (void *)__Pyx_Generator_Next}, + {Py_tp_methods, (void *)__pyx_Generator_methods}, + {Py_tp_members, (void *)__pyx_Generator_memberlist}, + {Py_tp_getset, (void *)__pyx_Generator_getsets}, + {Py_tp_getattro, (void *) PyObject_GenericGetAttr}, +#if CYTHON_USE_TP_FINALIZE + {Py_tp_finalize, (void *)__Pyx_Coroutine_del}, +#endif +#if __PYX_HAS_PY_AM_SEND == 1 + {Py_am_send, (void *)__Pyx_Coroutine_AmSend}, +#endif + {0, 0}, +}; +static PyType_Spec __pyx_GeneratorType_spec = { + __PYX_TYPE_MODULE_PREFIX "generator", + sizeof(__pyx_CoroutineObject), + 0, +#if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API + Py_TPFLAGS_MANAGED_WEAKREF | +#endif + Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND, + __pyx_GeneratorType_slots +}; +#if __PYX_HAS_PY_AM_SEND == 2 +static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async; +#endif +static int __pyx_Generator_init(PyObject *module) { + __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); + mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec( + mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL); + if (unlikely(!mstate->__pyx_GeneratorType)) { + return -1; + } +#if __PYX_HAS_PY_AM_SEND == 2 + __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend); +#endif + return 0; +} +static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) { + __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; + PyObject *retval = NULL; + if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) { + return __Pyx_Coroutine_AlreadyRunningError(gen); + } + __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0); + __Pyx_Coroutine_unset_is_running(gen); + (void) result; + assert (result == PYGEN_RETURN || result == PYGEN_ERROR); + assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL)); + return retval; +} + +/* CheckBinaryVersion */ +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { + const unsigned long MAJOR_MINOR = 0xFFFF0000UL; + if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) + return 0; + if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) + return 1; + { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compile time Python version %d.%d " + "of module '%.100s' " + "%s " + "runtime version %d.%d", + (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), + __Pyx_MODULE_NAME, + (allow_newer) ? "was newer than" : "does not match", + (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) + ); + return PyErr_WarnEx(NULL, message, 1); + } +} + +/* NewCodeObj */ +#if CYTHON_COMPILING_IN_LIMITED_API + static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 + PyObject *version_info; + PyObject *py_minor_version = NULL; + #endif + long minor_version = 0; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 + minor_version = 11; + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + Py_DECREF(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + if (type) { + PyErr_Restore(type, value, traceback); + } + return result; + } +#elif PY_VERSION_HEX >= 0x030B0000 + static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes); + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1 + if (likely(result)) + result->_co_firsttraceable = 0; + #endif + return result; + } +#elif !CYTHON_COMPILING_IN_PYPY + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +static PyObject* __Pyx_PyCode_New( + const __Pyx_PyCode_New_function_description descr, + PyObject * const *varnames, + PyObject *filename, + PyObject *funcname, + PyObject *line_table, + PyObject *tuple_dedup_map +) { + PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL; + Py_ssize_t var_count = (Py_ssize_t) descr.nlocals; + PyObject *varnames_tuple = PyTuple_New(var_count); + if (unlikely(!varnames_tuple)) return NULL; + for (Py_ssize_t i=0; i < var_count; i++) { + Py_INCREF(varnames[i]); + if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done; + } + #if CYTHON_COMPILING_IN_LIMITED_API + varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple); + if (!varnames_tuple_dedup) { + if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done; + varnames_tuple_dedup = varnames_tuple; + } + #else + varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple); + if (unlikely(!varnames_tuple_dedup)) goto done; + #endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(varnames_tuple_dedup); + #endif + if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) { + Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table); + #if !CYTHON_ASSUME_SAFE_SIZE + if (unlikely(line_table_length == -1)) goto done; + #endif + Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL; + code_bytes = PyBytes_FromStringAndSize(NULL, code_len); + if (unlikely(!code_bytes)) goto done; + char* c_code_bytes = PyBytes_AsString(code_bytes); + if (unlikely(!c_code_bytes)) goto done; + memset(c_code_bytes, 0, (size_t) code_len); + } + code_obj = (PyObject*) __Pyx__PyCode_New( + (int) descr.argcount, + (int) descr.num_posonly_args, + (int) descr.num_kwonly_args, + (int) descr.nlocals, + 0, + (int) descr.flags, + code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + varnames_tuple_dedup, + __pyx_mstate_global->__pyx_empty_tuple, + __pyx_mstate_global->__pyx_empty_tuple, + filename, + funcname, + (int) descr.first_line, + (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes + ); +done: + Py_XDECREF(code_bytes); + #if CYTHON_AVOID_BORROWED_REFS + Py_XDECREF(varnames_tuple_dedup); + #endif + Py_DECREF(varnames_tuple); + return code_obj; +} + +/* DecompressString */ +static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { + PyObject *module, *decompress, *compressed_bytes, *decompressed; + const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; + PyObject *methodname = PyUnicode_FromString("decompress"); + if (unlikely(!methodname)) return NULL; + #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 + if (algo == 3) { + PyObject *fromlist = Py_BuildValue("[O]", methodname); + if (unlikely(!fromlist)) return NULL; + module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + } else + #endif + module = PyImport_ImportModule(module_name); + if (unlikely(!module)) goto import_failed; + decompress = PyObject_GetAttr(module, methodname); + if (unlikely(!decompress)) goto import_failed; + { + #ifdef __cplusplus + char *memview_bytes = const_cast(s); + #else + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wcast-qual" + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-qual" + #endif + char *memview_bytes = (char*) s; + #if defined(__clang__) + #pragma clang diagnostic pop + #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) + #pragma GCC diagnostic pop + #endif + #endif + #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) + int memview_flags = 0x100; + #else + int memview_flags = PyBUF_READ; + #endif + compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); + } + if (unlikely(!compressed_bytes)) { + Py_DECREF(decompress); + goto bad; + } + decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); + Py_DECREF(compressed_bytes); + Py_DECREF(decompress); + Py_DECREF(module); + Py_DECREF(methodname); + return decompressed; +import_failed: + PyErr_Format(PyExc_ImportError, + "Failed to import '%.20s.decompress' - cannot initialise module strings. " + "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", + module_name, algo); +bad: + Py_XDECREF(module); + Py_DECREF(methodname); + return NULL; +} + +#include +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return __Pyx_PyUnicode_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return PyByteArray_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + { + const char* result; + Py_ssize_t unicode_length; + CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 + if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; + #else + result = PyUnicode_AsUTF8AndSize(o, length); + #endif + #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + unicode_length = PyUnicode_GetLength(o); + if (unlikely(unicode_length < 0)) return NULL; + if (unlikely(unicode_length != *length)) { + PyUnicode_AsASCIIString(o); + return NULL; + } + #endif + return result; + } +#else +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +#endif +} +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 + if (PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif + if (PyByteArray_Check(o)) { +#if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); +#else + *length = PyByteArray_Size(o); + if (*length == -1) return NULL; + return PyByteArray_AsString(o); +#endif + } else + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; + } + __Pyx_DECREF_TypeName(result_type_name); + return result; + } + PyErr_Format(PyExc_TypeError, + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", + result_type_name); + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + PyObject *res = NULL; + if (likely(PyLong_Check(x))) + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + if (likely(m && m->nb_int)) { + res = m->nb_int(x); + } +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Long(x); + } +#endif + if (likely(res)) { + if (unlikely(!PyLong_CheckExact(res))) { + return __Pyx_PyNumber_LongWrongResultType(res); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); + } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyLong_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyLong_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { + CYTHON_UNUSED_VAR(b); + return __Pyx_NewRef(Py_None); +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return __Pyx_NewRef(b ? Py_True: Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { + return PyLong_FromSize_t(ival); +} + + +/* MultiPhaseInitModuleState */ +#if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE +#ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 +#else + #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 +#endif +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS +#error "Module state with PEP489 requires atomics. Currently that's one of\ + C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" +#endif +#if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +#define __Pyx_ModuleStateLookup_Lock() +#define __Pyx_ModuleStateLookup_Unlock() +#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 +static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; +#define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(__cplusplus) && __cplusplus >= 201103L +#include +static std::mutex __Pyx_ModuleStateLookup_mutex; +#define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() +#define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) +#include +static mtx_t __Pyx_ModuleStateLookup_mutex; +static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; +static void __Pyx_ModuleStateLookup_initialize_mutex(void) { + mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); +} +#define __Pyx_ModuleStateLookup_Lock()\ + call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ + mtx_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(HAVE_PTHREAD_H) +#include +static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; +#define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) +#elif defined(_WIN32) +#include // synchapi.h on its own doesn't work +static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; +#define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) +#else +#error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ + Requires C standard >= C11, or C++ standard >= C++11,\ + or pthreads, or the Windows 32 API, or Python >= 3.13." +#endif +typedef struct { + int64_t id; + PyObject *module; +} __Pyx_InterpreterIdAndModule; +typedef struct { + char interpreter_id_as_index; + Py_ssize_t count; + Py_ssize_t allocated; + __Pyx_InterpreterIdAndModule table[1]; +} __Pyx_ModuleStateLookupData; +#define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; +#endif +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; +#else +static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; +#endif +static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( + __Pyx_InterpreterIdAndModule* table, + Py_ssize_t count, + int64_t interpreterId) { + __Pyx_InterpreterIdAndModule* begin = table; + __Pyx_InterpreterIdAndModule* end = begin + count; + if (begin->id == interpreterId) { + return begin; + } + while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; + if (halfway->id == interpreterId) { + return halfway; + } + if (halfway->id < interpreterId) { + begin = halfway; + } else { + end = halfway; + } + } + for (; begin < end; ++begin) { + if (begin->id >= interpreterId) return begin; + } + return begin; +} +static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return NULL; +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + { + __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + if (likely(data)) { + __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); + if (likely(data == new_data)) { + goto read_finished; + } + } + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); + __Pyx_ModuleStateLookup_Lock(); + __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); + data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); + __Pyx_ModuleStateLookup_Unlock(); + } + read_finished:; +#else + __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_InterpreterIdAndModule* found = NULL; + if (unlikely(!data)) goto end; + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + found = data->table+interpreter_id; + } + } else { + found = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + } + end: + { + PyObject *result=NULL; + if (found && found->id == interpreter_id) { + result = found->module; + } +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); +#endif + return result; + } +} +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE +static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { + while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); +} +#else +#define __Pyx_ModuleStateLookup_wait_until_no_readers() +#endif +static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { + Py_ssize_t to_allocate = (*old_data)->allocated; + while (to_allocate <= interpreter_id) { + if (to_allocate == 0) to_allocate = 1; + else to_allocate *= 2; + } + __Pyx_ModuleStateLookupData *new_data = *old_data; + if (to_allocate != (*old_data)->allocated) { + new_data = (__Pyx_ModuleStateLookupData *)realloc( + *old_data, + sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + PyErr_NoMemory(); + return -1; + } + for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { + new_data->table[i].id = i; + new_data->table[i].module = NULL; + } + new_data->allocated = to_allocate; + } + new_data->table[interpreter_id].module = module; + if (new_data->count < interpreter_id+1) { + new_data->count = interpreter_id+1; + } + *old_data = new_data; + return 0; +} +static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { + __Pyx_InterpreterIdAndModule *read = data->table; + __Pyx_InterpreterIdAndModule *write = data->table; + __Pyx_InterpreterIdAndModule *end = read + data->count; + for (; readmodule) { + write->id = read->id; + write->module = read->module; + ++write; + } + } + data->count = write - data->table; + for (; writeid = 0; + write->module = NULL; + } + data->interpreter_id_as_index = 0; +} +static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + int result = 0; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; +#endif + __Pyx_ModuleStateLookupData *new_data = old_data; + if (!new_data) { + new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); + if (!new_data) { + result = -1; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = 1; + new_data->interpreter_id_as_index = 1; + } + __Pyx_ModuleStateLookup_wait_until_no_readers(); + if (new_data->interpreter_id_as_index) { + if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { + result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); + goto end; + } + __Pyx_State_ConvertFromInterpIdAsIndex(new_data); + } + { + Py_ssize_t insert_at = 0; + { + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + new_data->table, new_data->count, interpreter_id); + assert(lower_bound); + insert_at = lower_bound - new_data->table; + if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { + lower_bound->module = module; + goto end; // already in table, nothing more to do + } + } + if (new_data->count+1 >= new_data->allocated) { + Py_ssize_t to_allocate = (new_data->count+1)*2; + new_data = + (__Pyx_ModuleStateLookupData*)realloc( + new_data, + sizeof(__Pyx_ModuleStateLookupData) + + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); + if (!new_data) { + result = -1; + new_data = old_data; + PyErr_NoMemory(); + goto end; + } + new_data->allocated = to_allocate; + } + ++new_data->count; + int64_t last_id = interpreter_id; + PyObject *last_module = module; + for (Py_ssize_t i=insert_at; icount; ++i) { + int64_t current_id = new_data->table[i].id; + new_data->table[i].id = last_id; + last_id = current_id; + PyObject *current_module = new_data->table[i].module; + new_data->table[i].module = last_module; + last_module = current_module; + } + } + end: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); +#else + __Pyx_ModuleStateLookup_data = new_data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return result; +} +static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { + int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); + if (interpreter_id == -1) return -1; + __Pyx_ModuleStateLookup_Lock(); +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); +#else + __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; +#endif + if (data->interpreter_id_as_index) { + if (interpreter_id < data->count) { + data->table[interpreter_id].module = NULL; + } + goto done; + } + { + __Pyx_ModuleStateLookup_wait_until_no_readers(); + __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( + data->table, data->count, interpreter_id); + if (!lower_bound) goto done; + if (lower_bound->id != interpreter_id) goto done; + __Pyx_InterpreterIdAndModule *end = data->table+data->count; + for (;lower_boundid = (lower_bound+1)->id; + lower_bound->module = (lower_bound+1)->module; + } + } + --data->count; + if (data->count == 0) { + free(data); + data = NULL; + } + done: +#if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE + __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); +#else + __Pyx_ModuleStateLookup_data = data; +#endif + __Pyx_ModuleStateLookup_Unlock(); + return 0; +} +#endif + +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ +#endif /* Py_PYTHON_H */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/vocab.pxd b/TTS/Kokoro/.venv/Lib/site-packages/spacy/vocab.pxd new file mode 100644 index 0000000000000000000000000000000000000000..d182f03c041d8870088c076b83e169668e842698 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/vocab.pxd @@ -0,0 +1,49 @@ +from cymem.cymem cimport Pool +from libcpp.vector cimport vector +from murmurhash.mrmr cimport hash64 +from preshed.maps cimport PreshMap + +from .morphology cimport Morphology +from .strings cimport StringStore +from .structs cimport LexemeC, TokenC +from .typedefs cimport attr_t, hash_t + + +cdef LexemeC EMPTY_LEXEME + + +cdef union LexemesOrTokens: + const LexemeC* const* lexemes + const TokenC* tokens + + +cdef struct _Cached: + LexemesOrTokens data + bint is_lex + int length + + +cdef class Vocab: + cdef Pool mem + cdef readonly StringStore strings + cdef public Morphology morphology + cdef public object _vectors + cdef public object _lookups + cdef public object writing_system + cdef public object get_noun_chunks + cdef readonly int length + cdef public object _unused_object # TODO remove in v4, see #9150 + cdef public object lex_attr_getters + cdef public object cfg + + cdef const LexemeC* get(self, Pool mem, str string) except NULL + cdef const LexemeC* get_by_orth(self, Pool mem, attr_t orth) except NULL + cdef const TokenC* make_fused_token(self, substrings) except NULL + + cdef const LexemeC* _new_lexeme(self, Pool mem, str string) except NULL + cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex, bint is_transient) except -1 + cdef const LexemeC* _new_lexeme(self, Pool mem, str string) except NULL + + cdef PreshMap _by_orth + cdef Pool _non_temp_mem + cdef vector[attr_t] _transient_orths diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/vocab.pyi b/TTS/Kokoro/.venv/Lib/site-packages/spacy/vocab.pyi new file mode 100644 index 0000000000000000000000000000000000000000..a64ad6db674ae14f113ad0e8a53fba73d62504fd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/vocab.pyi @@ -0,0 +1,84 @@ +from contextlib import contextmanager +from pathlib import Path +from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Union + +from cymem.cymem import Pool +from thinc.types import Floats1d, FloatsXd + +from . import Language +from .lexeme import Lexeme +from .lookups import Lookups +from .morphology import Morphology +from .strings import StringStore +from .tokens import Doc, Span +from .vectors import Vectors + +def create_vocab( + lang: Optional[str], defaults: Any, vectors_name: Optional[str] = ... +) -> Vocab: ... + +class Vocab: + cfg: Dict[str, Any] + get_noun_chunks: Optional[Callable[[Union[Doc, Span]], Iterator[Span]]] + lookups: Lookups + morphology: Morphology + strings: StringStore + vectors: Vectors + writing_system: Dict[str, Any] + def __init__( + self, + lex_attr_getters: Optional[Dict[str, Callable[[str], Any]]] = ..., + strings: Optional[Union[List[str], StringStore]] = ..., + lookups: Optional[Lookups] = ..., + oov_prob: float = ..., + vectors_name: Optional[str] = ..., + writing_system: Dict[str, Any] = ..., + get_noun_chunks: Optional[Callable[[Union[Doc, Span]], Iterator[Span]]] = ..., + ) -> None: ... + @property + def lang(self) -> str: ... + def __len__(self) -> int: ... + def add_flag( + self, flag_getter: Callable[[str], bool], flag_id: int = ... + ) -> int: ... + def __contains__(self, key: str) -> bool: ... + def __iter__(self) -> Iterator[Lexeme]: ... + def __getitem__(self, id_or_string: Union[str, int]) -> Lexeme: ... + @property + def vectors_length(self) -> int: ... + def reset_vectors( + self, *, width: Optional[int] = ..., shape: Optional[int] = ... + ) -> None: ... + def deduplicate_vectors(self) -> None: ... + def prune_vectors(self, nr_row: int, batch_size: int = ...) -> Dict[str, float]: ... + def get_vector( + self, + orth: Union[int, str], + minn: Optional[int] = ..., + maxn: Optional[int] = ..., + ) -> FloatsXd: ... + def set_vector(self, orth: Union[int, str], vector: Floats1d) -> None: ... + def has_vector(self, orth: Union[int, str]) -> bool: ... + def to_disk( + self, path: Union[str, Path], *, exclude: Iterable[str] = ... + ) -> None: ... + def from_disk( + self, path: Union[str, Path], *, exclude: Iterable[str] = ... + ) -> Vocab: ... + def to_bytes(self, *, exclude: Iterable[str] = ...) -> bytes: ... + def from_bytes( + self, bytes_data: bytes, *, exclude: Iterable[str] = ... + ) -> Vocab: ... + @contextmanager + def memory_zone(self, mem: Optional[Pool] = None) -> Iterator[Pool]: ... + +def pickle_vocab(vocab: Vocab) -> Any: ... +def unpickle_vocab( + sstore: StringStore, + vectors: Any, + morphology: Any, + _unused_object: Any, + lex_attr_getters: Any, + lookups: Any, + get_noun_chunks: Any, +) -> Vocab: ... diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy/vocab.pyx b/TTS/Kokoro/.venv/Lib/site-packages/spacy/vocab.pyx new file mode 100644 index 0000000000000000000000000000000000000000..4dfe5436f12e261b740590e917eaa3563eb91877 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy/vocab.pyx @@ -0,0 +1,644 @@ +import functools +from contextlib import ExitStack, contextmanager +from typing import Iterator, Optional + +import numpy +import srsly +from thinc.api import get_array_module, get_current_ops +from preshed.maps cimport map_clear + +from .attrs cimport LANG, ORTH +from .lexeme cimport EMPTY_LEXEME, OOV_RANK, Lexeme +from .tokens.token cimport Token +from .typedefs cimport attr_t + +from . import util +from .attrs import IS_STOP, NORM, intify_attrs +from .compat import copy_reg +from .errors import Errors +from .lang.lex_attrs import LEX_ATTRS, get_lang, is_stop +from .lang.norm_exceptions import BASE_NORMS +from .lookups import Lookups +from .vectors import Mode as VectorsMode +from .vectors import Vectors + + +def create_vocab(lang, defaults, vectors_name=None): + # If the spacy-lookups-data package is installed, we pre-populate the lookups + # with lexeme data, if available + lex_attrs = {**LEX_ATTRS, **defaults.lex_attr_getters} + # This is messy, but it's the minimal working fix to Issue #639. + lex_attrs[IS_STOP] = functools.partial(is_stop, stops=defaults.stop_words) + # Ensure that getter can be pickled + lex_attrs[LANG] = functools.partial(get_lang, lang=lang) + lex_attrs[NORM] = util.add_lookups( + lex_attrs.get(NORM, LEX_ATTRS[NORM]), + BASE_NORMS, + ) + return Vocab( + lex_attr_getters=lex_attrs, + writing_system=defaults.writing_system, + get_noun_chunks=defaults.syntax_iterators.get("noun_chunks"), + vectors_name=vectors_name, + ) + + +cdef class Vocab: + """A look-up table that allows you to access `Lexeme` objects. The `Vocab` + instance also provides access to the `StringStore`, and owns underlying + C-data that is shared between `Doc` objects. + + DOCS: https://spacy.io/api/vocab + """ + def __init__( + self, + lex_attr_getters=None, + strings=tuple(), + lookups=None, + oov_prob=-20., + vectors_name=None, + writing_system={}, # no-cython-lint + get_noun_chunks=None, + **deprecated_kwargs + ): + """Create the vocabulary. + + lex_attr_getters (dict): A dictionary mapping attribute IDs to + functions to compute them. Defaults to `None`. + strings (StringStore): StringStore that maps strings to integers, and + vice versa. + lookups (Lookups): Container for large lookup tables and dictionaries. + oov_prob (float): Default OOV probability. + vectors_name (str): Optional name to identify the vectors table. + get_noun_chunks (Optional[Callable[[Union[Doc, Span], Iterator[Tuple[int, int, int]]]]]): + A function that yields base noun phrases used for Doc.noun_chunks. + """ + lex_attr_getters = lex_attr_getters if lex_attr_getters is not None else {} + if lookups in (None, True, False): + lookups = Lookups() + self.cfg = {'oov_prob': oov_prob} + self.mem = Pool() + self._by_orth = PreshMap() + self.strings = StringStore() + self.length = 0 + if strings: + for string in strings: + _ = self[string] + self.lex_attr_getters = lex_attr_getters + self.morphology = Morphology(self.strings) + self.vectors = Vectors(strings=self.strings, name=vectors_name) + self.lookups = lookups + self.writing_system = writing_system + self.get_noun_chunks = get_noun_chunks + # During a memory_zone we replace our mem object with one + # that's passed to us. We keep a reference to our non-temporary + # memory here, in case we need to make an allocation we want to + # guarantee is not temporary. This is also how we check whether + # we're in a memory zone: we check whether self.mem is self._non_temp_mem + self._non_temp_mem = self.mem + + @property + def vectors(self): + return self._vectors + + @vectors.setter + def vectors(self, vectors): + if hasattr(vectors, "strings"): + for s in vectors.strings: + self.strings.add(s, allow_transient=False) + self._vectors = vectors + self._vectors.strings = self.strings + + @property + def lang(self): + langfunc = None + if self.lex_attr_getters: + langfunc = self.lex_attr_getters.get(LANG, None) + return langfunc("_") if langfunc else "" + + @property + def in_memory_zone(self) -> bool: + return self.mem is not self._non_temp_mem + + def __len__(self): + """The current number of lexemes stored. + + RETURNS (int): The current number of lexemes stored. + """ + return self.length + + @contextmanager + def memory_zone(self, mem: Optional[Pool] = None) -> Iterator[Pool]: + """Begin a block where resources allocated during the block will + be freed at the end of it. If a resources was created within the + memory zone block, accessing it outside the block is invalid. + Behaviour of this invalid access is undefined. Memory zones should + not be nested. + + The memory zone is helpful for services that need to process large + volumes of text with a defined memory budget. + """ + if mem is None: + mem = Pool() + # The ExitStack allows programmatic nested context managers. + # We don't know how many we need, so it would be awkward to have + # them as nested blocks. + with ExitStack() as stack: + contexts = [stack.enter_context(self.strings.memory_zone(mem))] + if hasattr(self.morphology, "memory_zone"): + contexts.append(stack.enter_context(self.morphology.memory_zone(mem))) + if hasattr(self._vectors, "memory_zone"): + contexts.append(stack.enter_context(self._vectors.memory_zone(mem))) + self.mem = mem + yield mem + self._clear_transient_orths() + self.mem = self._non_temp_mem + + def add_flag(self, flag_getter, int flag_id=-1): + """Set a new boolean flag to words in the vocabulary. + + The flag_getter function will be called over the words currently in the + vocab, and then applied to new words as they occur. You'll then be able + to access the flag value on each token using token.check_flag(flag_id). + See also: `Lexeme.set_flag`, `Lexeme.check_flag`, `Token.set_flag`, + `Token.check_flag`. + + flag_getter (callable): A function `f(str) -> bool`, to get the + flag value. + flag_id (int): An integer between 1 and 63 (inclusive), specifying + the bit at which the flag will be stored. If -1, the lowest + available bit will be chosen. + RETURNS (int): The integer ID by which the flag value can be checked. + + DOCS: https://spacy.io/api/vocab#add_flag + """ + if flag_id == -1: + for bit in range(1, 64): + if bit not in self.lex_attr_getters: + flag_id = bit + break + else: + raise ValueError(Errors.E062) + elif flag_id >= 64 or flag_id < 1: + raise ValueError(Errors.E063.format(value=flag_id)) + for lex in self: + lex.set_flag(flag_id, flag_getter(lex.orth_)) + self.lex_attr_getters[flag_id] = flag_getter + return flag_id + + cdef const LexemeC* get(self, Pool mem, str string) except NULL: + """Get a pointer to a `LexemeC` from the lexicon, creating a new + `Lexeme` if necessary. + """ + if string == "": + return &EMPTY_LEXEME + cdef LexemeC* lex + cdef hash_t key = self.strings[string] + lex = self._by_orth.get(key) + if lex != NULL: + assert lex.orth in self.strings + if lex.orth != key: + raise KeyError(Errors.E064.format(string=lex.orth, + orth=key, orth_id=string)) + return lex + else: + return self._new_lexeme(mem, string) + + cdef const LexemeC* get_by_orth(self, Pool mem, attr_t orth) except NULL: + """Get a pointer to a `LexemeC` from the lexicon, creating a new + `Lexeme` if necessary using memory acquired from the given pool. If the + pool is the lexicon's own memory, the lexeme is saved in the lexicon. + """ + if orth == 0: + return &EMPTY_LEXEME + cdef LexemeC* lex + lex = self._by_orth.get(orth) + if lex != NULL: + return lex + else: + return self._new_lexeme(mem, self.strings[orth]) + + cdef const LexemeC* _new_lexeme(self, Pool mem, str string) except NULL: + # The mem argument is deprecated, replaced by memory zones. Same with + # this size heuristic. + mem = self.mem + lex = mem.alloc(1, sizeof(LexemeC)) + lex.orth = self.strings.add(string, allow_transient=True) + lex.length = len(string) + if self.vectors is not None and hasattr(self.vectors, "key2row"): + lex.id = self.vectors.key2row.get(lex.orth, OOV_RANK) + else: + lex.id = OOV_RANK + if self.lex_attr_getters is not None: + for attr, func in self.lex_attr_getters.items(): + value = func(string) + if isinstance(value, str): + value = self.strings.add(value, allow_transient=True) + if value is not None: + Lexeme.set_struct_attr(lex, attr, value) + self._add_lex_to_vocab(lex.orth, lex, self.mem is not self._non_temp_mem) + if lex == NULL: + raise ValueError(Errors.E085.format(string=string)) + return lex + + cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex, bint is_transient) except -1: + self._by_orth.set(lex.orth, lex) + self.length += 1 + if is_transient and self.in_memory_zone: + self._transient_orths.push_back(lex.orth) + + def _clear_transient_orths(self): + """Remove transient lexemes from the index (generally at the end of the memory zone)""" + for orth in self._transient_orths: + map_clear(self._by_orth.c_map, orth) + self._transient_orths.clear() + + def __contains__(self, key): + """Check whether the string or int key has an entry in the vocabulary. + + string (str): The ID string. + RETURNS (bool) Whether the string has an entry in the vocabulary. + + DOCS: https://spacy.io/api/vocab#contains + """ + cdef hash_t int_key + if isinstance(key, bytes): + int_key = self.strings[key.decode("utf8")] + elif isinstance(key, str): + int_key = self.strings[key] + else: + int_key = key + lex = self._by_orth.get(int_key) + return lex is not NULL + + def __iter__(self): + """Iterate over the lexemes in the vocabulary. + + YIELDS (Lexeme): An entry in the vocabulary. + + DOCS: https://spacy.io/api/vocab#iter + """ + cdef attr_t key + cdef size_t addr + for key, addr in self._by_orth.items(): + lex = Lexeme(self, key) + yield lex + + def __getitem__(self, id_or_string): + """Retrieve a lexeme, given an int ID or a unicode string. If a + previously unseen unicode string is given, a new lexeme is created and + stored. + + id_or_string (int or str): The integer ID of a word, or its unicode + string. If `int >= Lexicon.size`, `IndexError` is raised. If + `id_or_string` is neither an int nor a unicode string, `ValueError` + is raised. + RETURNS (Lexeme): The lexeme indicated by the given ID. + + EXAMPLE: + >>> apple = nlp.vocab.strings["apple"] + >>> assert nlp.vocab[apple] == nlp.vocab[u"apple"] + + DOCS: https://spacy.io/api/vocab#getitem + """ + cdef attr_t orth + if isinstance(id_or_string, str): + orth = self.strings.add(id_or_string, allow_transient=True) + else: + orth = id_or_string + return Lexeme(self, orth) + + cdef const TokenC* make_fused_token(self, substrings) except NULL: + cdef int i + tokens = self.mem.alloc(len(substrings) + 1, sizeof(TokenC)) + for i, props in enumerate(substrings): + props = intify_attrs(props, strings_map=self.strings, + _do_deprecated=True) + token = &tokens[i] + # Set the special tokens up to have arbitrary attributes + lex = self.get_by_orth(self.mem, props[ORTH]) + token.lex = lex + for attr_id, value in props.items(): + Token.set_struct_attr(token, attr_id, value) + # NORM is the only one that overlaps between the two + # (which is maybe not great?) + if attr_id != NORM: + Lexeme.set_struct_attr(lex, attr_id, value) + return tokens + + @property + def vectors_length(self): + if hasattr(self.vectors, "shape"): + return self.vectors.shape[1] + else: + return -1 + + def reset_vectors(self, *, width=None, shape=None): + """Drop the current vector table. Because all vectors must be the same + width, you have to call this to change the size of the vectors. + """ + if not isinstance(self.vectors, Vectors): + raise ValueError(Errors.E849.format(method="reset_vectors", vectors_type=type(self.vectors))) + if width is not None and shape is not None: + raise ValueError(Errors.E065.format(width=width, shape=shape)) + elif shape is not None: + self.vectors = Vectors(strings=self.strings, shape=shape) + else: + width = width if width is not None else self.vectors.shape[1] + self.vectors = Vectors(strings=self.strings, shape=(self.vectors.shape[0], width)) + + def deduplicate_vectors(self): + if not isinstance(self.vectors, Vectors): + raise ValueError(Errors.E849.format(method="deduplicate_vectors", vectors_type=type(self.vectors))) + if self.vectors.mode != VectorsMode.default: + raise ValueError(Errors.E858.format( + mode=self.vectors.mode, + alternative="" + )) + ops = get_current_ops() + xp = get_array_module(self.vectors.data) + filled = xp.asarray( + sorted(list({row for row in self.vectors.key2row.values()})) + ) + # deduplicate data and remap keys + data = numpy.unique(ops.to_numpy(self.vectors.data[filled]), axis=0) + data = ops.asarray(data) + if data.shape == self.vectors.data.shape: + # nothing to deduplicate + return + row_by_bytes = {row.tobytes(): i for i, row in enumerate(data)} + key2row = { + key: row_by_bytes[self.vectors.data[row].tobytes()] + for key, row in self.vectors.key2row.items() + } + # replace vectors with deduplicated version + self.vectors = Vectors(strings=self.strings, data=data, name=self.vectors.name) + for key, row in key2row.items(): + self.vectors.add(key, row=row) + + def prune_vectors(self, nr_row, batch_size=1024): + """Reduce the current vector table to `nr_row` unique entries. Words + mapped to the discarded vectors will be remapped to the closest vector + among those remaining. + + For example, suppose the original table had vectors for the words: + ['sat', 'cat', 'feline', 'reclined']. If we prune the vector table to + two rows, we would discard the vectors for 'feline' and 'reclined'. + These words would then be remapped to the closest remaining vector + -- so "feline" would have the same vector as "cat", and "reclined" + would have the same vector as "sat". + + The similarities are judged by cosine. The original vectors may + be large, so the cosines are calculated in minibatches, to reduce + memory usage. + + nr_row (int): The number of rows to keep in the vector table. + batch_size (int): Batch of vectors for calculating the similarities. + Larger batch sizes might be faster, while temporarily requiring + more memory. + RETURNS (dict): A dictionary keyed by removed words mapped to + `(string, score)` tuples, where `string` is the entry the removed + word was mapped to, and `score` the similarity score between the + two words. + + DOCS: https://spacy.io/api/vocab#prune_vectors + """ + if not isinstance(self.vectors, Vectors): + raise ValueError(Errors.E849.format(method="prune_vectors", vectors_type=type(self.vectors))) + if self.vectors.mode != VectorsMode.default: + raise ValueError(Errors.E858.format( + mode=self.vectors.mode, + alternative="" + )) + ops = get_current_ops() + xp = get_array_module(self.vectors.data) + # Make sure all vectors are in the vocab + for orth in self.vectors: + self[orth] + # Make prob negative so it sorts by rank ascending + # (key2row contains the rank) + priority = [] + cdef Lexeme lex + cdef attr_t value + for lex in self: + value = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + if value in self.vectors.key2row: + priority.append((-lex.prob, self.vectors.key2row[value], value)) + priority.sort() + indices = xp.asarray([i for (prob, i, key) in priority], dtype="uint64") + keys = xp.asarray([key for (prob, i, key) in priority], dtype="uint64") + keep = xp.ascontiguousarray(self.vectors.data[indices[:nr_row]]) + toss = xp.ascontiguousarray(self.vectors.data[indices[nr_row:]]) + self.vectors = Vectors(strings=self.strings, data=keep, keys=keys[:nr_row], name=self.vectors.name) + syn_keys, syn_rows, scores = self.vectors.most_similar(toss, batch_size=batch_size) + syn_keys = ops.to_numpy(syn_keys) + remap = {} + for i, key in enumerate(ops.to_numpy(keys[nr_row:])): + self.vectors.add(key, row=syn_rows[i][0]) + word = self.strings[key] + synonym = self.strings[syn_keys[i][0]] + score = scores[i][0] + remap[word] = (synonym, score) + return remap + + def get_vector(self, orth): + """Retrieve a vector for a word in the vocabulary. Words can be looked + up by string or int ID. If the current vectors do not contain an entry + for the word, a 0-vector with the same number of dimensions as the + current vectors is returned. + + orth (int / unicode): The hash value of a word, or its unicode string. + RETURNS (numpy.ndarray or cupy.ndarray): A word vector. Size + and shape determined by the `vocab.vectors` instance. Usually, a + numpy ndarray of shape (300,) and dtype float32. + + DOCS: https://spacy.io/api/vocab#get_vector + """ + if isinstance(orth, str): + orth = self.strings.add(orth, allow_transient=True) + cdef Lexeme lex = self[orth] + key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + if self.has_vector(key): + return self.vectors[key] + xp = get_array_module(self.vectors.data) + vectors = xp.zeros((self.vectors_length,), dtype="f") + return vectors + + def set_vector(self, orth, vector): + """Set a vector for a word in the vocabulary. Words can be referenced + by string or int ID. + + orth (int / str): The word. + vector (numpy.ndarray or cupy.nadarry[ndim=1, dtype='float32']): The vector to set. + + DOCS: https://spacy.io/api/vocab#set_vector + """ + if isinstance(orth, str): + orth = self.strings.add(orth, allow_transient=False) + cdef Lexeme lex = self[orth] + key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + if self.vectors.is_full and key not in self.vectors: + new_rows = max(100, int(self.vectors.shape[0]*1.3)) + if self.vectors.shape[1] == 0: + width = vector.size + else: + width = self.vectors.shape[1] + self.vectors.resize((new_rows, width)) + row = self.vectors.add(key, vector=vector) + if row >= 0: + lex.rank = row + + def has_vector(self, orth): + """Check whether a word has a vector. Returns False if no vectors have + been loaded. Words can be looked up by string or int ID. + + orth (int / str): The word. + RETURNS (bool): Whether the word has a vector. + + DOCS: https://spacy.io/api/vocab#has_vector + """ + if isinstance(orth, str): + orth = self.strings.add(orth, allow_transient=True) + cdef Lexeme lex = self[orth] + key = Lexeme.get_struct_attr(lex.c, self.vectors.attr) + return key in self.vectors + + @property + def lookups(self): + return self._lookups + + @lookups.setter + def lookups(self, lookups): + self._lookups = lookups + if lookups.has_table("lexeme_norm"): + self.lex_attr_getters[NORM] = util.add_lookups( + self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), + self.lookups.get_table("lexeme_norm"), + ) + + def to_disk(self, path, *, exclude=tuple()): + """Save the current state to a directory. + + path (str or Path): A path to a directory, which will be created if + it doesn't exist. + exclude (Iterable[str]): String names of serialization fields to exclude. + + DOCS: https://spacy.io/api/vocab#to_disk + """ + path = util.ensure_path(path) + if not path.exists(): + path.mkdir() + if "strings" not in exclude: + self.strings.to_disk(path / "strings.json") + if "vectors" not in exclude: + self.vectors.to_disk(path, exclude=["strings"]) + if "lookups" not in exclude: + self.lookups.to_disk(path) + + def from_disk(self, path, *, exclude=tuple()): + """Loads state from a directory. Modifies the object in place and + returns it. + + path (str or Path): A path to a directory. + exclude (Iterable[str]): String names of serialization fields to exclude. + RETURNS (Vocab): The modified `Vocab` object. + + DOCS: https://spacy.io/api/vocab#to_disk + """ + path = util.ensure_path(path) + if "strings" not in exclude: + self.strings.from_disk(path / "strings.json") # TODO: add exclude? + if "vectors" not in exclude: + if self.vectors is not None: + self.vectors.from_disk(path, exclude=["strings"]) + if "lookups" not in exclude: + self.lookups.from_disk(path) + if "lexeme_norm" in self.lookups: + self.lex_attr_getters[NORM] = util.add_lookups( + self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") + ) + self.length = 0 + self._by_orth = PreshMap() + return self + + def to_bytes(self, *, exclude=tuple()): + """Serialize the current state to a binary string. + + exclude (Iterable[str]): String names of serialization fields to exclude. + RETURNS (bytes): The serialized form of the `Vocab` object. + + DOCS: https://spacy.io/api/vocab#to_bytes + """ + def deserialize_vectors(): + if self.vectors is None: + return None + else: + return self.vectors.to_bytes(exclude=["strings"]) + + getters = { + "strings": lambda: self.strings.to_bytes(), + "vectors": deserialize_vectors, + "lookups": lambda: self.lookups.to_bytes(), + } + return util.to_bytes(getters, exclude) + + def from_bytes(self, bytes_data, *, exclude=tuple()): + """Load state from a binary string. + + bytes_data (bytes): The data to load from. + exclude (Iterable[str]): String names of serialization fields to exclude. + RETURNS (Vocab): The `Vocab` object. + + DOCS: https://spacy.io/api/vocab#from_bytes + """ + def serialize_vectors(b): + if self.vectors is None: + return None + else: + return self.vectors.from_bytes(b, exclude=["strings"]) + + setters = { + "strings": lambda b: self.strings.from_bytes(b), + "vectors": lambda b: serialize_vectors(b), + "lookups": lambda b: self.lookups.from_bytes(b), + } + util.from_bytes(bytes_data, setters, exclude) + if "lexeme_norm" in self.lookups: + self.lex_attr_getters[NORM] = util.add_lookups( + self.lex_attr_getters.get(NORM, LEX_ATTRS[NORM]), self.lookups.get_table("lexeme_norm") + ) + self.length = 0 + self._by_orth = PreshMap() + return self + + def _reset_cache(self, keys, strings): + # I'm not sure this made sense. Disable it for now. + raise NotImplementedError + + +def pickle_vocab(vocab): + sstore = vocab.strings + vectors = vocab.vectors + morph = vocab.morphology + _unused_object = vocab._unused_object + lex_attr_getters = srsly.pickle_dumps(vocab.lex_attr_getters) + lookups = vocab.lookups + get_noun_chunks = vocab.get_noun_chunks + return (unpickle_vocab, + (sstore, vectors, morph, _unused_object, lex_attr_getters, lookups, get_noun_chunks)) + + +def unpickle_vocab(sstore, vectors, morphology, _unused_object, + lex_attr_getters, lookups, get_noun_chunks): + cdef Vocab vocab = Vocab() + vocab.vectors = vectors + vocab.strings = sstore + vocab.morphology = morphology + vocab._unused_object = _unused_object + vocab.lex_attr_getters = srsly.pickle_loads(lex_attr_getters) + vocab.lookups = lookups + vocab.get_noun_chunks = get_noun_chunks + return vocab + + +copy_reg.pickle(Vocab, pickle_vocab, unpickle_vocab) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..d356fce60ba1819392ac8253977e0d210e51a681 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/METADATA @@ -0,0 +1,73 @@ +Metadata-Version: 2.4 +Name: spacy-curated-transformers +Version: 0.3.1 +Summary: Curated transformer models for spaCy pipelines +Home-page: https://github.com/explosion/spacy-curated-transformers +Author: Explosion +Author-email: contact@explosion.ai +License: MIT +Requires-Python: <3.14,>=3.9 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: curated-transformers<0.2.0,>=0.1.0 +Requires-Dist: curated-tokenizers<0.1.0,>=0.0.9 +Requires-Dist: torch>=1.12.0 +Dynamic: license-file + + + +# 💫 🤖 spaCy Curated Transformers + +This package provides [spaCy](https://github.com/explosion/spaCy) components and +architectures to use a curated set of transformer models via +[`curated-transformers`](https://github.com/explosion/curated-transformers) in +spaCy. + +[![PyPi](https://img.shields.io/pypi/v/spacy-curated-transformers.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.python.org/pypi/spacy-curated-transformers) +[![GitHub](https://img.shields.io/github/release/explosion/spacy-curated-transformers/all.svg?style=flat-square&logo=github)](https://github.com/explosion/spacy-curated-transformers/releases) + +## Features + +- Use pretrained models based on one of the following architectures to + power your spaCy pipeline: + - ALBERT + - BERT + - CamemBERT + - RoBERTa + - XLM-RoBERTa +- All the nice features supported by [`spacy-transformers`](https://github.com/explosion/spacy-transformers) + such as support for Hugging Face Hub, **multi-task learning**, the extensible config system and + out-of-the-box serialization +- Deep integration into spaCy, which lays the groundwork for deployment-focused features + such as distillation and quantization +- Minimal dependencies + +## ⏳ Installation + +Installing the package from pip will automatically install all dependencies. + +```bash +pip install spacy-curated-transformers +``` + +## 🚀 Quickstart + +An example project is provided in the [`project`](project) directory. + +## 📖 Documentation + +- 📘 + [Layers and Model Architectures](https://spacy.io/usage/layers-architectures): + Power spaCy components with custom neural networks +- 📗 [`CuratedTransformer`](https://spacy.io/api/curatedtransformer): Pipeline component API + reference +- 📗 + [Transformer architectures](https://spacy.io/api/architectures#curated-trf): + Architectures and registered functions + +## Bug reports and other issues + +Please use [spaCy's issue tracker](https://github.com/explosion/spaCy/issues) to +report a bug, or open a new thread on the +[discussion board](https://github.com/explosion/spaCy/discussions) for any other +issue. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..39b6ad51447a7750c73cbe82561b6948b3b124c6 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/RECORD @@ -0,0 +1,114 @@ +spacy_curated_transformers-0.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +spacy_curated_transformers-0.3.1.dist-info/METADATA,sha256=Ys68_LhQDHNCPXPEz9Bmy0maTzP91hLO4ywKa3xL8Vk,2716 +spacy_curated_transformers-0.3.1.dist-info/RECORD,, +spacy_curated_transformers-0.3.1.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109 +spacy_curated_transformers-0.3.1.dist-info/entry_points.txt,sha256=32NuZyuerPun2jasg3RKfS5Saqoa-d1NYKC0YGQ3ask,3518 +spacy_curated_transformers-0.3.1.dist-info/licenses/LICENSE,sha256=5PJDH0A-oNINEIu-HwYVpMo7a3ZeLbr66TkI05htFTo,1088 +spacy_curated_transformers-0.3.1.dist-info/top_level.txt,sha256=paybFz8S0U1ayKNLPgxjvBc5UkL6T7u8wpIVrYjYtD0,27 +spacy_curated_transformers-0.3.1.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 +spacy_curated_transformers/__init__.py,sha256=fyjNliygKeS37Zfw0pyeacqMskgE6TPEuy0iQNjLYys,41 +spacy_curated_transformers/__pycache__/__init__.cpython-312.pyc,, +spacy_curated_transformers/__pycache__/_compat.cpython-312.pyc,, +spacy_curated_transformers/__pycache__/util.cpython-312.pyc,, +spacy_curated_transformers/_compat.py,sha256=hGLQ7aex604CiRcAwyvyXelkdBEFjRwLqvwKorTNDtw,570 +spacy_curated_transformers/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_curated_transformers/cli/__pycache__/__init__.cpython-312.pyc,, +spacy_curated_transformers/cli/__pycache__/debug_pieces.cpython-312.pyc,, +spacy_curated_transformers/cli/__pycache__/fill_config_transformer.cpython-312.pyc,, +spacy_curated_transformers/cli/debug_pieces.py,sha256=N43wYhgeSNDET1C8fiJcZ-KyrfiSqRONK7yV19u8qQM,4113 +spacy_curated_transformers/cli/fill_config_transformer.py,sha256=Q2FhcpsEQWvSyTdXhgFDDkbkvGWj2ebHLL2MFCbTLhU,17845 +spacy_curated_transformers/models/__init__.py,sha256=-OmJ3mh3BOqikrkWFkNscy5FlmWCmfzjy8rfZyMVXKs,438 +spacy_curated_transformers/models/__pycache__/__init__.cpython-312.pyc,, +spacy_curated_transformers/models/__pycache__/architectures.cpython-312.pyc,, +spacy_curated_transformers/models/__pycache__/hf_loader.cpython-312.pyc,, +spacy_curated_transformers/models/__pycache__/listeners.cpython-312.pyc,, +spacy_curated_transformers/models/__pycache__/output.cpython-312.pyc,, +spacy_curated_transformers/models/__pycache__/pooling.cpython-312.pyc,, +spacy_curated_transformers/models/__pycache__/remove_eos_bos.cpython-312.pyc,, +spacy_curated_transformers/models/__pycache__/scalar_weight.cpython-312.pyc,, +spacy_curated_transformers/models/__pycache__/types.cpython-312.pyc,, +spacy_curated_transformers/models/__pycache__/with_non_ws_tokens.cpython-312.pyc,, +spacy_curated_transformers/models/__pycache__/with_strided_spans.cpython-312.pyc,, +spacy_curated_transformers/models/architectures.py,sha256=biAKvjKsOXxMLGm5PuYwnNQw901gq1-1RQkNITvzM6c,27424 +spacy_curated_transformers/models/hf_loader.py,sha256=KcMZPLQWmQ2b8Eg2yUYooAoe4sBVDE8RXHVoZOOvgCc,1233 +spacy_curated_transformers/models/listeners.py,sha256=Clshy4yVkz6MbWcFTVTquMjjbhlV3vctGs0l0skwkyg,25094 +spacy_curated_transformers/models/output.py,sha256=kS9nb1QsM-wg9V_e7hu_9DXVicWopBaoG55MhwzURso,3784 +spacy_curated_transformers/models/pooling.py,sha256=ZXIUgoRztNA_7IuWUR0jV8WMJAhdtohl3xwF9v-TvDw,4016 +spacy_curated_transformers/models/remove_eos_bos.py,sha256=0YUxJJIfTTS_pl2C-xgzxstWGsU7qEByELF3Ew00ZvY,2384 +spacy_curated_transformers/models/scalar_weight.py,sha256=-84Euvsf22nuJ9Iyd5PTemULlpQg90VM2FvEjQX5ohI,4845 +spacy_curated_transformers/models/types.py,sha256=DDsd9cdlxv17tBTPhMmc6f_rZdzP2IvSJiMGAfDyWWM,2665 +spacy_curated_transformers/models/with_non_ws_tokens.py,sha256=Y-0vpRjoLL1ZH-aO4Xf6kVBkgZXH06F0DEoA_iUeoIg,9065 +spacy_curated_transformers/models/with_strided_spans.py,sha256=ifwCh7BDX6oOYEKxoDJEbAjWOWY98EykPn_-BVJvWHY,10513 +spacy_curated_transformers/pipeline/__init__.py,sha256=_xye73lb8_aPanEL5ZMDD5BXtD4YsK6ES8kvONZVOr4,44 +spacy_curated_transformers/pipeline/__pycache__/__init__.cpython-312.pyc,, +spacy_curated_transformers/pipeline/__pycache__/transformer.cpython-312.pyc,, +spacy_curated_transformers/pipeline/transformer.py,sha256=HOdJnppLMyMH7OrgpKJA_o06uWHq7WHmComjep4s1Ac,17826 +spacy_curated_transformers/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_curated_transformers/tests/__pycache__/__init__.cpython-312.pyc,, +spacy_curated_transformers/tests/__pycache__/conftest.cpython-312.pyc,, +spacy_curated_transformers/tests/__pycache__/enable_gpu.cpython-312.pyc,, +spacy_curated_transformers/tests/__pycache__/test_cli_app.cpython-312.pyc,, +spacy_curated_transformers/tests/__pycache__/test_registry.cpython-312.pyc,, +spacy_curated_transformers/tests/__pycache__/test_torchscript_wrapper.cpython-312.pyc,, +spacy_curated_transformers/tests/__pycache__/util.cpython-312.pyc,, +spacy_curated_transformers/tests/conftest.py,sha256=KqhoRTGsyFlOvnyHKoBhxIu-rv_6inGeB1uk9hE3nuU,2315 +spacy_curated_transformers/tests/enable_gpu.py,sha256=LDIdt1gbkbyGpGATvzndS8rjGuzzU8Z6ikRegPLABxk,45 +spacy_curated_transformers/tests/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_curated_transformers/tests/models/__pycache__/__init__.cpython-312.pyc,, +spacy_curated_transformers/tests/models/__pycache__/test_hf_model.cpython-312.pyc,, +spacy_curated_transformers/tests/models/__pycache__/test_listeners.cpython-312.pyc,, +spacy_curated_transformers/tests/models/__pycache__/test_pooling.cpython-312.pyc,, +spacy_curated_transformers/tests/models/__pycache__/test_scalar_weight.cpython-312.pyc,, +spacy_curated_transformers/tests/models/__pycache__/test_transformer_model.cpython-312.pyc,, +spacy_curated_transformers/tests/models/__pycache__/test_with_non_ws_tokens.cpython-312.pyc,, +spacy_curated_transformers/tests/models/__pycache__/test_with_strided_spans.cpython-312.pyc,, +spacy_curated_transformers/tests/models/test_hf_model.py,sha256=0UO3-ixidu2Dq4x3t1YkrXvicPWNwTtOB5aUWJQ7fvE,3394 +spacy_curated_transformers/tests/models/test_listeners.py,sha256=QGcNr67y1y9Uu68hi8yZBSP6XJvgCBKxXtxu86T0Ylk,2653 +spacy_curated_transformers/tests/models/test_pooling.py,sha256=YbBRijcjBn67MW0zv8PLIWgYbGyuU8TYAk1AIKMttsk,4556 +spacy_curated_transformers/tests/models/test_scalar_weight.py,sha256=RegWruYa-cGW-2BZG4J_IUbTT_HZMiQGbh7IQWKTjA0,1425 +spacy_curated_transformers/tests/models/test_transformer_model.py,sha256=KKuXXLfEWOsU_g1Ns5PlK4dZeEI9uNfJN4etph14iOY,6178 +spacy_curated_transformers/tests/models/test_with_non_ws_tokens.py,sha256=HmYbONoXemPBMvw3mTUaqKQUQesUazl3Z_-LzJSPgdg,3269 +spacy_curated_transformers/tests/models/test_with_strided_spans.py,sha256=tHdkYWrI8ZfPS3RFUkbVvNv39qG-UCwq0a99J-Uja1Q,4326 +spacy_curated_transformers/tests/pipeline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_curated_transformers/tests/pipeline/__pycache__/__init__.cpython-312.pyc,, +spacy_curated_transformers/tests/pipeline/__pycache__/test_transformer.cpython-312.pyc,, +spacy_curated_transformers/tests/pipeline/test_transformer.py,sha256=IkHPudvyx9Ep7uVvsy0gmmrlCebyuD4pvSSbWAxkI2E,26112 +spacy_curated_transformers/tests/pipeline/toy-en-corpus.spacy,sha256=tdzpsObKsR4XlTKglCsL4Y7q6n34ZxJGlftlm9u5-dg,2703 +spacy_curated_transformers/tests/test_cli_app.py,sha256=XFE2MzMxq38IzZyJTqA0DHwppDL3AMmCOTuGpC9ibXE,9805 +spacy_curated_transformers/tests/test_registry.py,sha256=OpDDei3v89OLCTvv6CSjBzeoN7ypQ9O2GWN8anf4EG8,2514 +spacy_curated_transformers/tests/test_torchscript_wrapper.py,sha256=TKUQeJ-nkj7TNEe1OvpBMV3WoQJ2ZPaDgV1iDLBc1iY,794 +spacy_curated_transformers/tests/tokenization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_curated_transformers/tests/tokenization/__pycache__/__init__.cpython-312.pyc,, +spacy_curated_transformers/tests/tokenization/__pycache__/test_bbpe_encoder.cpython-312.pyc,, +spacy_curated_transformers/tests/tokenization/__pycache__/test_char_encoder.cpython-312.pyc,, +spacy_curated_transformers/tests/tokenization/__pycache__/test_sentencepiece_encoder.cpython-312.pyc,, +spacy_curated_transformers/tests/tokenization/__pycache__/test_wordpiece_encoder.cpython-312.pyc,, +spacy_curated_transformers/tests/tokenization/__pycache__/test_xlmr_adapter.cpython-312.pyc,, +spacy_curated_transformers/tests/tokenization/test_bbpe_encoder.py,sha256=sv4oGFS5A2SHfSfVSgSFb7g48eV3Cy99aMJNwxkMQdw,4079 +spacy_curated_transformers/tests/tokenization/test_char_encoder.py,sha256=wUtD6LDb2gsObZlL_V2mTchuIthHDJRfZQp4KP2Dy-8,4116 +spacy_curated_transformers/tests/tokenization/test_sentencepiece_encoder.py,sha256=y5EQSzfgViFXIbetdlL3QwTGAw_PtQM2IJIDOp_OlyQ,3382 +spacy_curated_transformers/tests/tokenization/test_wordpiece_encoder.py,sha256=L2ChsDO6Lvi5yiS99pT-gn6dEnl3HYIB_nncmRF5tbk,8835 +spacy_curated_transformers/tests/tokenization/test_xlmr_adapter.py,sha256=bjxKm0IQwsNy2c2kjl3T-geio-NR08qfjJ840U4lO7A,4908 +spacy_curated_transformers/tests/tokenization/toy-chars.txt,sha256=E1hSMi2eE3rtQcjUGZG9RmmJTZngwzD1sc7Qs2b16iw,138 +spacy_curated_transformers/tests/tokenization/toy-merges.txt,sha256=_dS80_1y4Yx_th-9slfsAUzqHh-febRljnkpKRGrJ_M,4690 +spacy_curated_transformers/tests/tokenization/toy-vocab.json,sha256=QHPV_YhuEvAGN4FW-R8WvbwQOL_bzHkBP_45ZqNepi4,14493 +spacy_curated_transformers/tests/tokenization/toy.model,sha256=aOgs9MnD7wvh8lp8riyDb8r6fTyDgh-5hkEeVnea0eI,253270 +spacy_curated_transformers/tests/tokenization/toy.wordpieces,sha256=9NKJcS1jjBrabyREqMLqEpQyd5Gqz1NwwstcHZiYSFA,4968 +spacy_curated_transformers/tests/util.py,sha256=5qoKH7pkwmXt31GiVkkEqW6EWcaAthkc1zVvNRQxJDg,906 +spacy_curated_transformers/tokenization/__init__.py,sha256=SgAtcvlqxOimRynVXj6xb37VAsTxUH7NqcQ4fCl_6AY,568 +spacy_curated_transformers/tokenization/__pycache__/__init__.cpython-312.pyc,, +spacy_curated_transformers/tokenization/__pycache__/bbpe_encoder.cpython-312.pyc,, +spacy_curated_transformers/tokenization/__pycache__/char_encoder.cpython-312.pyc,, +spacy_curated_transformers/tokenization/__pycache__/hf_loader.cpython-312.pyc,, +spacy_curated_transformers/tokenization/__pycache__/sentencepiece_adapters.cpython-312.pyc,, +spacy_curated_transformers/tokenization/__pycache__/sentencepiece_encoder.cpython-312.pyc,, +spacy_curated_transformers/tokenization/__pycache__/types.cpython-312.pyc,, +spacy_curated_transformers/tokenization/__pycache__/wordpiece_encoder.cpython-312.pyc,, +spacy_curated_transformers/tokenization/bbpe_encoder.py,sha256=o1YRPRh9niIMpWTbAh1sy5YyU4jRI73AKSdE7u2fjeQ,3840 +spacy_curated_transformers/tokenization/char_encoder.py,sha256=_pkk0Rhicsic-_nEc46PQLo_lFAaGxpGw5UCUM-3ZbI,4000 +spacy_curated_transformers/tokenization/hf_loader.py,sha256=Qd4NCGe9ZFQFVH5tn3I_kmiKa2mQXu27joq7WySfBQ8,6014 +spacy_curated_transformers/tokenization/sentencepiece_adapters.py,sha256=f42B2iwb0fZESelztBwjxQjqVR2Cc2mZl7Wihyu_bwk,2483 +spacy_curated_transformers/tokenization/sentencepiece_encoder.py,sha256=Ql9SFQieDt9zWvRZC6Ciwz3R_SkecGE1tztu_cso65U,4126 +spacy_curated_transformers/tokenization/types.py,sha256=oa7ZlSidTUV6dy_pxj4LGIu8Boh19OktMZcbx2-wLv8,556 +spacy_curated_transformers/tokenization/wordpiece_encoder.py,sha256=jwV6I9PYVe6jQWAsj70ty7sYpBNLdGqlrXYFM2hZRNI,5992 +spacy_curated_transformers/util.py,sha256=Ah2ibAPz0jsv92nT_rdqNBtD5J1OI64-QPeZsvWqHm8,3036 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..5f133dbb5cfac001f2e84cda817210c03ce6484e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..e798ba84540b84dcf5a3156ccaf9027f65f7e19f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/entry_points.txt @@ -0,0 +1,37 @@ +[spacy_architectures] +spacy-curated-transformers.AlbertTransformer.v1 = spacy_curated_transformers.models:build_albert_transformer_model_v1 +spacy-curated-transformers.BertTransformer.v1 = spacy_curated_transformers.models:build_bert_transformer_model_v1 +spacy-curated-transformers.BertWordpieceEncoder.v1 = spacy_curated_transformers.tokenization:build_bert_wordpiece_encoder_v1 +spacy-curated-transformers.ByteBpeEncoder.v1 = spacy_curated_transformers.tokenization:build_byte_bpe_encoder_v1 +spacy-curated-transformers.CamembertSentencepieceEncoder.v1 = spacy_curated_transformers.tokenization:build_camembert_sentencepiece_encoder_v1 +spacy-curated-transformers.CamembertTransformer.v1 = spacy_curated_transformers.models:build_camembert_transformer_model_v1 +spacy-curated-transformers.CharEncoder.v1 = spacy_curated_transformers.tokenization:build_char_encoder_v1 +spacy-curated-transformers.LastTransformerLayerListener.v1 = spacy_curated_transformers.models.listeners:build_last_transformer_layer_listener_v1 +spacy-curated-transformers.RobertaTransformer.v1 = spacy_curated_transformers.models:build_roberta_transformer_model_v1 +spacy-curated-transformers.ScalarWeight.v1 = spacy_curated_transformers.models:build_scalar_weight_v1 +spacy-curated-transformers.ScalarWeightingListener.v1 = spacy_curated_transformers.models.listeners:build_scalar_weighting_listener_v1 +spacy-curated-transformers.SentencepieceEncoder.v1 = spacy_curated_transformers.tokenization:build_sentencepiece_encoder_v1 +spacy-curated-transformers.TransformerLayersListener.v1 = spacy_curated_transformers.models.listeners:build_transformer_layers_listener_v1 +spacy-curated-transformers.WithStridedSpans.v1 = spacy_curated_transformers.models:build_with_strided_spans_v1 +spacy-curated-transformers.WordpieceEncoder.v1 = spacy_curated_transformers.tokenization:build_wordpiece_encoder_v1 +spacy-curated-transformers.XlmrSentencepieceEncoder.v1 = spacy_curated_transformers.tokenization:build_xlmr_sentencepiece_encoder_v1 +spacy-curated-transformers.XlmrTransformer.v1 = spacy_curated_transformers.models:build_xlmr_transformer_model_v1 + +[spacy_callbacks] +spacy-curated-transformers.gradual_transformer_unfreezing.v1 = spacy_curated_transformers.util:create_gradual_transformer_unfreezing + +[spacy_cli] +spacy-curated-transformers.debug_pieces = spacy_curated_transformers.cli.debug_pieces:debug_pieces_cli +spacy-curated-transformers.fill_curated_transformer = spacy_curated_transformers.cli.fill_config_transformer:init_fill_curated_transformer_cli + +[spacy_factories] +curated_transformer = spacy_curated_transformers.pipeline.transformer:make_transformer + +[thinc_model_loaders] +spacy-curated-transformers.ByteBpeLoader.v1 = spacy_curated_transformers.tokenization:build_byte_bpe_encoder_loader_v1 +spacy-curated-transformers.CharEncoderLoader.v1 = spacy_curated_transformers.tokenization:build_char_encoder_loader_v1 +spacy-curated-transformers.HFPieceEncoderLoader.v1 = spacy_curated_transformers.tokenization:build_hf_piece_encoder_loader_v1 +spacy-curated-transformers.HFTransformerEncoderLoader.v1 = spacy_curated_transformers.models:build_hf_transformer_encoder_loader_v1 +spacy-curated-transformers.PyTorchCheckpointLoader.v1 = spacy_curated_transformers.models:build_pytorch_checkpoint_loader_v1 +spacy-curated-transformers.SentencepieceLoader.v1 = spacy_curated_transformers.tokenization:build_sentencepiece_encoder_loader_v1 +spacy-curated-transformers.WordpieceLoader.v1 = spacy_curated_transformers.tokenization:build_wordpiece_encoder_loader_v1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..4cad4179b16d7b7d7794c97da2319ee0693fc205 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/top_level.txt @@ -0,0 +1 @@ +spacy_curated_transformers diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/zip-safe b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/zip-safe new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers-0.3.1.dist-info/zip-safe @@ -0,0 +1 @@ + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6847a9c0c59130bf4180bdd94e4e27e56c55cfc5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/__init__.py @@ -0,0 +1 @@ +from .util import registry # noqa: F401 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/_compat.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/_compat.py new file mode 100644 index 0000000000000000000000000000000000000000..5a172f98b642ba34d753ea74a595e3e7368b70ac --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/_compat.py @@ -0,0 +1,32 @@ +from spacy.lang.ja import try_sudachi_import + +try: + import transformers + + has_hf_transformers = True +except ImportError: + transformers = None # type: ignore + has_hf_transformers = False + +try: + import huggingface_hub + + has_huggingface_hub = True +except ImportError: + huggingface_hub = None # type: ignore + has_huggingface_hub = False + + +try: + import fugashi + + has_fugashi = True +except ImportError: + fugashi = None + has_fugashi = False + +try: + try_sudachi_import() + has_sudachi = True +except ImportError: + has_sudachi = False diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/util.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/util.py new file mode 100644 index 0000000000000000000000000000000000000000..fd1447c03fa5aad419a1c7bbb8ebb9b1b9acaf36 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_curated_transformers/util.py @@ -0,0 +1,88 @@ +import itertools +from functools import partial +from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable + +import thinc +from spacy.language import Language + +if TYPE_CHECKING: + from .pipeline.transformer import CuratedTransformer + +thinc.registry.create("model_loaders", entry_points=True) +registry = thinc.registry + + +def all_equal(iterable: Iterable[Any]) -> bool: + """Return True if all the elements are equal to each other + (or if the input is an empty sequence), False otherwise.""" + g = itertools.groupby(iterable) + return next(g, True) and not next(g, False) # type: ignore + + +def gradual_transformer_unfreezing_per_pipe( + nlp: Language, + callback_args: Dict[str, Any], + freeze_params: Dict[str, int], +): + current_step = callback_args["step"] + + # Scoped import to avoid import cycles. + from .pipeline.transformer import CuratedTransformer + + for name, pipe in nlp.components: + unfreeze_step = freeze_params.get(name) + if unfreeze_step is None: + continue + elif not isinstance(pipe, CuratedTransformer): + raise TypeError( + "Attempting to perform gradual unfreezing of a non-transformer pipe " + f"('{name}'. Only transformer pipes support this feature" + ) + + pipe.frozen = current_step < unfreeze_step + + +def gradual_transformer_unfreezing_all_pipes( + nlp: Language, callback_args: Dict[str, Any], unfreeze_step: int +): + current_step = callback_args["step"] + + # Scoped import to avoid import cycles. + from .pipeline.transformer import CuratedTransformer + + for _, pipe in nlp.components: + if not isinstance(pipe, CuratedTransformer): + continue + + pipe.frozen = current_step < unfreeze_step + + +def create_gradual_transformer_unfreezing( + target_pipes: Dict[str, int] +) -> Callable[[Language, Dict[str, Any]], None]: + """Construct a callback that can be used to gradually unfreeze the + weights of one or more Transformer components during training. This + can be used to prevent catastrophic forgetting during fine-tuning. + + target_pipes (Dict[str, int]): + A dictionary whose keys and values correspond to the names of Transformer + components and the training step at which they should be unfrozen respectively. + """ + unfreeze_step_all_pipes = target_pipes.get("*") + if unfreeze_step_all_pipes is not None and len(target_pipes) > 1: + raise ValueError( + "The target pipe names for gradual transformer unfreezing contain both the " + "wild-card operator ('*') and individual names. Use either of the two but not both" + ) + + if unfreeze_step_all_pipes is not None: + return partial( + gradual_transformer_unfreezing_all_pipes, + unfreeze_step=unfreeze_step_all_pipes, + ) + else: + return partial( + gradual_transformer_unfreezing_per_pipe, + freeze_params=target_pipes, + last_unfreeze_step=max(target_pipes.values()), + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/LICENSE b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..4350174cf9f66ebf628b484903b6fe34d73ff69b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 ExplosionAI GmbH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..3d190d87ce02d72bf9d11d35010ca231e2dcbbbc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/METADATA @@ -0,0 +1,42 @@ +Metadata-Version: 2.1 +Name: spacy-legacy +Version: 3.0.12 +Summary: Legacy registered functions for spaCy backwards compatibility +Home-page: https://spacy.io +Author: Explosion +Author-email: contact@explosion.ai +License: MIT +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Science/Research +Classifier: Topic :: Scientific/Engineering +Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Requires-Python: >=3.6 +Description-Content-Type: text/markdown +License-File: LICENSE + + + +# spacy-legacy: Legacy functions and architectures for backwards compatibility + +This package includes outdated registered functions for [spaCy](https://spacy.io) v3.x, for example model architectures, pipeline components and utilities. It's **installed automatically** as a dependency of spaCy, and allows us to provide backwards compatibility, while keeping the core library tidy and up to date. All of this happens under the hood, so you typically shouldn't have to care about this package. + +[![Azure Pipelines](https://img.shields.io/azure-devops/build/explosion-ai/public/21/master.svg?logo=azure-pipelines&style=flat-square&label=build)](https://dev.azure.com/explosion-ai/public/_build?definitionId=21) +[![pypi Version](https://img.shields.io/pypi/v/spacy-legacy.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/spacy-legacy/) + + +## How it works + +Whenever a new backwards-incompatible version of a registered function is available, e.g. `spacy.Tok2Vec.v1` → `spacy.Tok2Vec.v2`, the legacy version is moved to `spacy-legacy`, and exposed via [entry points](setup.cfg). This means that it will still be available if your config files use it, even though the core library only includes the latest version. + +Legacy functions are exposed with the prefix `spacy-legacy`, e.g. `spacy-legacy.Tok2Vec.v1`. When spaCy resolves your config and a function is not available in the core library, e.g. `spacy.Tok2Vec.v1`, it will check if there's a legacy function available and fall back to that. You can also explicitly refer to legacy functions in your config, to indicate that a newer version is available. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..3a5efb7005b561d882213f16d56795c9af98067c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/RECORD @@ -0,0 +1,56 @@ +spacy_legacy-3.0.12.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +spacy_legacy-3.0.12.dist-info/LICENSE,sha256=lUN_KcVXfUPlCgxqW250tVmE5BZh0eQ-Msuvo8pVcJk,1073 +spacy_legacy-3.0.12.dist-info/METADATA,sha256=19j9iLTBpwEAGHfFdVdQSaIkSUgTRNfnmLJjeiVV39I,2818 +spacy_legacy-3.0.12.dist-info/RECORD,, +spacy_legacy-3.0.12.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110 +spacy_legacy-3.0.12.dist-info/entry_points.txt,sha256=FwdX6jHo6A_E1_CAO27KE8XT1RxF1ACwXq_mjK5nSns,1557 +spacy_legacy-3.0.12.dist-info/top_level.txt,sha256=4BHhaP0TMPsEB4HTObfGDtqwMReSj-iy1FCW555_i_4,13 +spacy_legacy-3.0.12.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 +spacy_legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_legacy/__pycache__/__init__.cpython-312.pyc,, +spacy_legacy/__pycache__/loggers.cpython-312.pyc,, +spacy_legacy/__pycache__/scorers.cpython-312.pyc,, +spacy_legacy/architectures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_legacy/architectures/__pycache__/__init__.cpython-312.pyc,, +spacy_legacy/architectures/__pycache__/entity_linker.cpython-312.pyc,, +spacy_legacy/architectures/__pycache__/parser.cpython-312.pyc,, +spacy_legacy/architectures/__pycache__/tagger.cpython-312.pyc,, +spacy_legacy/architectures/__pycache__/textcat.cpython-312.pyc,, +spacy_legacy/architectures/__pycache__/tok2vec.cpython-312.pyc,, +spacy_legacy/architectures/entity_linker.py,sha256=tCUPko1UafzeN_MuEytdOFC2pZ2NikjZzMlavsTPIs4,1162 +spacy_legacy/architectures/parser.py,sha256=ftKLV1ElP2ux6GncZEM6ZqEfWZnIgRYeVy_pP8RStas,3165 +spacy_legacy/architectures/tagger.py,sha256=bA7F0k9xVcMZIXOX5a9egr8lRgpgwHN0eXIhO3KTrNQ,1298 +spacy_legacy/architectures/textcat.py,sha256=6dohtFaWNscgDXzUODefPdKlgzmj2L0hQa00PV8Bcr0,6911 +spacy_legacy/architectures/tok2vec.py,sha256=uMmiYYO4LRGEmvjqOCZ9u-J4CMU8FlSpmh-g1qmMxSs,13830 +spacy_legacy/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_legacy/components/__pycache__/__init__.cpython-312.pyc,, +spacy_legacy/components/__pycache__/entity_linker.cpython-312.pyc,, +spacy_legacy/components/entity_linker.py,sha256=w_r0Je_q3cLkmNsbS1WVKRzpxE-Y5qegKWxoTsbha0U,18863 +spacy_legacy/layers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_legacy/layers/__pycache__/__init__.cpython-312.pyc,, +spacy_legacy/layers/__pycache__/staticvectors_v1.cpython-312.pyc,, +spacy_legacy/layers/staticvectors_v1.py,sha256=2H2WY-PvL3QFaqH0OxpBDDuZfqMiHxZlC_iEcbn8zCY,3176 +spacy_legacy/loggers.py,sha256=7HE3nL6vcfJimK-XwzJEX_1U_o81RCGe0ZdHAWP-KOE,6343 +spacy_legacy/scorers.py,sha256=U_73iyBEltZ_I8IIbLOYtxNdj8AO9mVqsBYlrK6gtis,6759 +spacy_legacy/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_legacy/tests/__pycache__/__init__.cpython-312.pyc,, +spacy_legacy/tests/__pycache__/test_layer.cpython-312.pyc,, +spacy_legacy/tests/__pycache__/test_legacy.cpython-312.pyc,, +spacy_legacy/tests/__pycache__/test_logger.cpython-312.pyc,, +spacy_legacy/tests/__pycache__/test_scorers.cpython-312.pyc,, +spacy_legacy/tests/parser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_legacy/tests/parser/__pycache__/__init__.cpython-312.pyc,, +spacy_legacy/tests/parser/__pycache__/test_parser.cpython-312.pyc,, +spacy_legacy/tests/parser/test_parser.py,sha256=HewqRVWlxP-2MZeGoRF8PsDvVKIbtdDMFVWI2VqAKOc,1817 +spacy_legacy/tests/pipeline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_legacy/tests/pipeline/__pycache__/__init__.cpython-312.pyc,, +spacy_legacy/tests/pipeline/__pycache__/test_tagger.cpython-312.pyc,, +spacy_legacy/tests/pipeline/__pycache__/test_textcat.cpython-312.pyc,, +spacy_legacy/tests/pipeline/__pycache__/test_tok2vec.cpython-312.pyc,, +spacy_legacy/tests/pipeline/test_tagger.py,sha256=1hx3_yk0894QF8UDezA6DhPao6zpMOg1jeSJWoAfw1I,1594 +spacy_legacy/tests/pipeline/test_textcat.py,sha256=QIH-FpHOLFa7kdis93VPTAy9d2Y_IZkMf4pk3A7_mM0,2598 +spacy_legacy/tests/pipeline/test_tok2vec.py,sha256=hIB199d72rnMNlynDWDNB2DPYxB5AAvE930Ud2Bth-8,2033 +spacy_legacy/tests/test_layer.py,sha256=Rh3GKZd7vO4fkWFiOEUXawhzYxgyHR4okh62oP8mI84,636 +spacy_legacy/tests/test_legacy.py,sha256=mMp80m8RH_s9BE5gjc5a_slo1oCeGeTGkrAUGsZhzJE,1022 +spacy_legacy/tests/test_logger.py,sha256=HhNmbhBt7umuNH53y2v4hJlmcwuAzkIChrnsz7IvNkU,116 +spacy_legacy/tests/test_scorers.py,sha256=iGyVzr45rJB0zcPwQU7jNueuHKESkNPGPiOqBOP1MWc,1239 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..9d8f872bbf2275e6d1785238e90b0321f4b6f323 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.38.4) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad5ea44a6edc6728cd38db30ae35e5860e7bff95 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/entry_points.txt @@ -0,0 +1,25 @@ +[spacy_architectures] +spacy-legacy.CharacterEmbed.v1 = spacy_legacy.architectures.tok2vec:CharacterEmbed_v1 +spacy-legacy.EntityLinker.v1 = spacy_legacy.architectures.entity_linker:EntityLinker_v1 +spacy-legacy.HashEmbedCNN.v1 = spacy_legacy.architectures.tok2vec:HashEmbedCNN_v1 +spacy-legacy.MaxoutWindowEncoder.v1 = spacy_legacy.architectures.tok2vec:MaxoutWindowEncoder_v1 +spacy-legacy.MishWindowEncoder.v1 = spacy_legacy.architectures.tok2vec:MishWindowEncoder_v1 +spacy-legacy.MultiHashEmbed.v1 = spacy_legacy.architectures.tok2vec:MultiHashEmbed_v1 +spacy-legacy.Tagger.v1 = spacy_legacy.architectures.tagger:Tagger_v1 +spacy-legacy.TextCatBOW.v1 = spacy_legacy.architectures.textcat:TextCatBOW_v1 +spacy-legacy.TextCatCNN.v1 = spacy_legacy.architectures.textcat:TextCatCNN_v1 +spacy-legacy.TextCatEnsemble.v1 = spacy_legacy.architectures.textcat:TextCatEnsemble_v1 +spacy-legacy.Tok2Vec.v1 = spacy_legacy.architectures.tok2vec:Tok2Vec_v1 +spacy-legacy.TransitionBasedParser.v1 = spacy_legacy.architectures.parser:TransitionBasedParser_v1 + +[spacy_loggers] +spacy-legacy.ConsoleLogger.v1 = spacy_legacy.loggers:console_logger_v1 +spacy-legacy.ConsoleLogger.v2 = spacy_legacy.loggers:console_logger_v2 +spacy-legacy.WandbLogger.v1 = spacy_legacy.loggers:wandb_logger_v1 + +[spacy_scorers] +spacy-legacy.textcat_multilabel_scorer.v1 = spacy_legacy.scorers:make_textcat_multilabel_scorer_v1 +spacy-legacy.textcat_scorer.v1 = spacy_legacy.scorers:make_textcat_scorer_v1 + +[thinc_layers] +spacy-legacy.StaticVectors.v1 = spacy_legacy.layers.staticvectors_v1:StaticVectors_v1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1511b88adde85aeee8f3ba29923a81f62582e09 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/top_level.txt @@ -0,0 +1 @@ +spacy_legacy diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/zip-safe b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/zip-safe new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy-3.0.12.dist-info/zip-safe @@ -0,0 +1 @@ + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/loggers.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/loggers.py new file mode 100644 index 0000000000000000000000000000000000000000..60b0cc52c2dc140b0e2f20de27419a4980980e2f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/loggers.py @@ -0,0 +1,167 @@ +from typing import TYPE_CHECKING, Dict, Any, Tuple, Callable, List, Optional, IO, Union +import sys + +from pathlib import Path +from spacy import util +from spacy.errors import Errors +from spacy.util import registry +from wasabi import Printer +import tqdm + +if TYPE_CHECKING: + from spacy.language import Language # noqa: F401 + + +def wandb_logger_v1(project_name: str, remove_config_values: List[str] = []): + try: + import wandb + from wandb import init, log, join # test that these are available + except ImportError: + err_msg = ( + "The 'wandb' library could not be found - did you install " + "it? Alternatively, specify the 'ConsoleLogger' in the " + "'training.logger' config section, instead of the " + "'WandbLogger'." + ) + raise ImportError(err_msg) + + console_logger = registry.get("loggers", "spacy.ConsoleLogger.v1") + console = console_logger(progress_bar=False) + + def setup_logger( + nlp: "Language", stdout: IO = sys.stdout, stderr: IO = sys.stderr + ) -> Tuple[Callable[[Dict[str, Any]], None], Callable[[], None]]: + config = nlp.config.interpolate() + config_dot = util.dict_to_dot(config) + for field in remove_config_values: + del config_dot[field] + config = util.dot_to_dict(config_dot) + wandb.init(project=project_name, config=config, reinit=True) + console_log_step, console_finalize = console(nlp, stdout, stderr) + + def log_step(info: Optional[Dict[str, Any]]): + console_log_step(info) + if info is not None: + score = info["score"] + other_scores = info["other_scores"] + losses = info["losses"] + wandb.log({"score": score}) + if losses: + wandb.log({f"loss_{k}": v for k, v in losses.items()}) + if isinstance(other_scores, dict): + wandb.log(other_scores) + + def finalize() -> None: + console_finalize() + wandb.join() + + return log_step, finalize + + return setup_logger + + +def setup_table( + *, cols: List[str], widths: List[int], max_width: int = 13 +) -> Tuple[List[str], List[int], List[str]]: + final_cols = [] + final_widths = [] + for col, width in zip(cols, widths): + if len(col) > max_width: + col = col[: max_width - 3] + "..." # shorten column if too long + final_cols.append(col.upper()) + final_widths.append(max(len(col), width)) + return final_cols, final_widths, ["r" for _ in final_widths] + + +def console_logger_v2( + progress_bar: bool = False, + console_output: bool = True, + output_file: Optional[Union[str, Path]] = None, +): + """The ConsoleLogger.v2 prints out training logs in the console and/or saves them to a jsonl file. + progress_bar (bool): Whether the logger should print a progress bar tracking the steps till the next evaluation pass. + console_output (bool): Whether the logger should print the logs on the console. + output_file (Optional[Union[str, Path]]): The file to save the training logs to. + """ + console_logger = registry.get("loggers", "spacy.ConsoleLogger.v3") + return console_logger( + progress_bar=None if progress_bar is False else "eval", + console_output=console_output, + output_file=output_file, + ) + + +def console_logger_v1(progress_bar: bool = False): + def setup_printer( + nlp: "Language", stdout: IO = sys.stdout, stderr: IO = sys.stderr + ) -> Tuple[Callable[[Optional[Dict[str, Any]]], None], Callable[[], None]]: + write = lambda text: print(text, file=stdout, flush=True) + msg = Printer(no_print=True) + # ensure that only trainable components are logged + logged_pipes = [ + name + for name, proc in nlp.pipeline + if hasattr(proc, "is_trainable") and proc.is_trainable + ] + eval_frequency = nlp.config["training"]["eval_frequency"] + score_weights = nlp.config["training"]["score_weights"] + score_cols = [col for col, value in score_weights.items() if value is not None] + loss_cols = [f"Loss {pipe}" for pipe in logged_pipes] + spacing = 2 + table_header, table_widths, table_aligns = setup_table( + cols=["E", "#"] + loss_cols + score_cols + ["Score"], + widths=[3, 6] + [8 for _ in loss_cols] + [6 for _ in score_cols] + [6], + ) + write(msg.row(table_header, widths=table_widths, spacing=spacing)) + write(msg.row(["-" * width for width in table_widths], spacing=spacing)) + progress = None + + def log_step(info: Optional[Dict[str, Any]]) -> None: + nonlocal progress + + if info is None: + # If we don't have a new checkpoint, just return. + if progress is not None: + progress.update(1) + return + losses = [ + "{0:.2f}".format(float(info["losses"][pipe_name])) + for pipe_name in logged_pipes + ] + + scores = [] + for col in score_cols: + score = info["other_scores"].get(col, 0.0) + try: + score = float(score) + except TypeError: + err = Errors.E916.format(name=col, score_type=type(score)) + raise ValueError(err) from None + if col != "speed": + score *= 100 + scores.append("{0:.2f}".format(score)) + + data = ( + [info["epoch"], info["step"]] + + losses + + scores + + ["{0:.2f}".format(float(info["score"]))] + ) + if progress is not None: + progress.close() + write( + msg.row(data, widths=table_widths, aligns=table_aligns, spacing=spacing) + ) + if progress_bar: + # Set disable=None, so that it disables on non-TTY + progress = tqdm.tqdm( + total=eval_frequency, disable=None, leave=False, file=stderr + ) + progress.set_description(f"Epoch {info['epoch']+1}") + + def finalize() -> None: + pass + + return log_step, finalize + + return setup_printer diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/scorers.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/scorers.py new file mode 100644 index 0000000000000000000000000000000000000000..d9663da179d2ae8c16f41c0d1742535229dadafe --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_legacy/scorers.py @@ -0,0 +1,169 @@ +from typing import Any, Callable, Dict, Iterable, Optional +from spacy.scorer import PRFScore, ROCAUCScore +from spacy.tokens import Doc +from spacy.training import Example +from spacy.util import SimpleFrozenList + + +def score_cats_v1( + examples: Iterable[Example], + attr: str, + *, + getter: Callable[[Doc, str], Any] = getattr, + labels: Iterable[str] = SimpleFrozenList(), + multi_label: bool = True, + positive_label: Optional[str] = None, + threshold: Optional[float] = None, + **cfg, +) -> Dict[str, Any]: + """Returns PRF and ROC AUC scores for a doc-level attribute with a + dict with scores for each label like Doc.cats. The reported overall + score depends on the scorer settings. + + examples (Iterable[Example]): Examples to score + attr (str): The attribute to score. + getter (Callable[[Doc, str], Any]): Defaults to getattr. If provided, + getter(doc, attr) should return the values for the individual doc. + labels (Iterable[str]): The set of possible labels. Defaults to []. + multi_label (bool): Whether the attribute allows multiple labels. + Defaults to True. When set to False (exclusive labels), missing + gold labels are interpreted as 0.0. + positive_label (str): The positive label for a binary task with + exclusive classes. Defaults to None. + threshold (float): Cutoff to consider a prediction "positive". Defaults + to 0.5 for multi-label, and 0.0 (i.e. whatever's highest scoring) + otherwise. + RETURNS (Dict[str, Any]): A dictionary containing the scores, with + inapplicable scores as None: + for all: + attr_score (one of attr_micro_f / attr_macro_f / attr_macro_auc), + attr_score_desc (text description of the overall score), + attr_micro_p, + attr_micro_r, + attr_micro_f, + attr_macro_p, + attr_macro_r, + attr_macro_f, + attr_macro_auc, + attr_f_per_type, + attr_auc_per_type + """ + if threshold is None: + threshold = 0.5 if multi_label else 0.0 + f_per_type = {label: PRFScore() for label in labels} + auc_per_type = {label: ROCAUCScore() for label in labels} + labels = set(labels) + if labels: + for eg in examples: + labels.update(eg.predicted.cats.keys()) + labels.update(eg.reference.cats.keys()) + for example in examples: + # Through this loop, None in the gold_cats indicates missing label. + pred_cats = getter(example.predicted, attr) + gold_cats = getter(example.reference, attr) + + for label in labels: + pred_score = pred_cats.get(label, 0.0) + gold_score = gold_cats.get(label) + if not gold_score and not multi_label: + gold_score = 0.0 + if gold_score is not None: + auc_per_type[label].score_set(pred_score, gold_score) + if multi_label: + for label in labels: + pred_score = pred_cats.get(label, 0.0) + gold_score = gold_cats.get(label) + if gold_score is not None: + if pred_score >= threshold and gold_score > 0: + f_per_type[label].tp += 1 + elif pred_score >= threshold and gold_score == 0: + f_per_type[label].fp += 1 + elif pred_score < threshold and gold_score > 0: + f_per_type[label].fn += 1 + elif pred_cats and gold_cats: + # Get the highest-scoring for each. + pred_label, pred_score = max(pred_cats.items(), key=lambda it: it[1]) + gold_label, gold_score = max(gold_cats.items(), key=lambda it: it[1]) + if pred_label == gold_label and pred_score >= threshold: + f_per_type[pred_label].tp += 1 + else: + f_per_type[gold_label].fn += 1 + if pred_score >= threshold: + f_per_type[pred_label].fp += 1 + elif gold_cats: + gold_label, gold_score = max(gold_cats, key=lambda it: it[1]) + if gold_score > 0: + f_per_type[gold_label].fn += 1 + elif pred_cats: + pred_label, pred_score = max(pred_cats.items(), key=lambda it: it[1]) + if pred_score >= threshold: + f_per_type[pred_label].fp += 1 + micro_prf = PRFScore() + for label_prf in f_per_type.values(): + micro_prf.tp += label_prf.tp + micro_prf.fn += label_prf.fn + micro_prf.fp += label_prf.fp + n_cats = len(f_per_type) + 1e-100 + macro_p = sum(prf.precision for prf in f_per_type.values()) / n_cats + macro_r = sum(prf.recall for prf in f_per_type.values()) / n_cats + macro_f = sum(prf.fscore for prf in f_per_type.values()) / n_cats + # Limit macro_auc to those labels with gold annotations, + # but still divide by all cats to avoid artificial boosting of datasets with missing labels + macro_auc = ( + sum(auc.score if auc.is_binary() else 0.0 for auc in auc_per_type.values()) + / n_cats + ) + results: Dict[str, Any] = { + f"{attr}_score": None, + f"{attr}_score_desc": None, + f"{attr}_micro_p": micro_prf.precision, + f"{attr}_micro_r": micro_prf.recall, + f"{attr}_micro_f": micro_prf.fscore, + f"{attr}_macro_p": macro_p, + f"{attr}_macro_r": macro_r, + f"{attr}_macro_f": macro_f, + f"{attr}_macro_auc": macro_auc, + f"{attr}_f_per_type": {k: v.to_dict() for k, v in f_per_type.items()}, + f"{attr}_auc_per_type": { + k: v.score if v.is_binary() else None for k, v in auc_per_type.items() + }, + } + if len(labels) == 2 and not multi_label and positive_label: + positive_label_f = results[f"{attr}_f_per_type"][positive_label]["f"] + results[f"{attr}_score"] = positive_label_f + results[f"{attr}_score_desc"] = f"F ({positive_label})" + elif not multi_label: + results[f"{attr}_score"] = results[f"{attr}_macro_f"] + results[f"{attr}_score_desc"] = "macro F" + else: + results[f"{attr}_score"] = results[f"{attr}_macro_auc"] + results[f"{attr}_score_desc"] = "macro AUC" + return results + + +def textcat_score_v1(examples: Iterable[Example], **kwargs) -> Dict[str, Any]: + return score_cats_v1( + examples, + "cats", + multi_label=False, + **kwargs, + ) + + +def make_textcat_scorer_v1(): + return textcat_score_v1 + + +def textcat_multilabel_score_v1( + examples: Iterable[Example], **kwargs +) -> Dict[str, Any]: + return score_cats_v1( + examples, + "cats", + multi_label=True, + **kwargs, + ) + + +def make_textcat_multilabel_scorer_v1(): + return textcat_multilabel_score_v1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/LICENSE b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..4350174cf9f66ebf628b484903b6fe34d73ff69b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 ExplosionAI GmbH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..5e76645a576174411a1c5ec54f10fd40b27fff79 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/METADATA @@ -0,0 +1,379 @@ +Metadata-Version: 2.1 +Name: spacy-loggers +Version: 1.0.5 +Summary: Logging utilities for SpaCy +Home-page: https://github.com/explosion/spacy-loggers +Author: Explosion +Author-email: contact@explosion.ai +License: MIT +Requires-Python: >=3.6 +Description-Content-Type: text/markdown +License-File: LICENSE + + + +# spacy-loggers: Logging utilities for spaCy + +[![PyPi Version](https://img.shields.io/pypi/v/spacy-loggers.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.python.org/pypi/spacy-loggers) + +Starting with spaCy v3.2, alternate loggers are moved into a separate package +so that they can be added and updated independently from the core spaCy +library. + +`spacy-loggers` currently provides loggers for: + +- [Weights & Biases](https://www.wandb.com) +- [MLflow](https://www.mlflow.org/) +- [ClearML](https://www.clear.ml/) +- [PyTorch](https://pytorch.org/) +- [CuPy](https://github.com/cupy/cupy) + +`spacy-loggers` also provides additional utility loggers to facilitate interoperation +between individual loggers. + +If you'd like to add a new logger or logging option, please submit a PR to this +repo! + +## Setup and installation + +`spacy-loggers` should be installed automatically with spaCy v3.2+, so you +usually don't need to install it separately. You can install it with `pip` or +from the conda channel `conda-forge`: + +```bash +pip install spacy-loggers +``` + +```bash +conda install -c conda-forge spacy-loggers +``` + +# Loggers + +## WandbLogger + +### Installation + +This logger requires `wandb` to be installed and configured: + +```bash +pip install wandb +wandb login +``` + +### Usage + +`spacy.WandbLogger.v5` is a logger that sends the results of each training step +to the dashboard of the [Weights & Biases](https://www.wandb.com/) tool. To use +this logger, Weights & Biases should be installed, and you should be logged in. +The logger will send the full config file to W&B, as well as various system +information such as memory utilization, network traffic, disk IO, GPU +statistics, etc. This will also include information such as your hostname and +operating system, as well as the location of your Python executable. + +`spacy.WandbLogger.v4` and below automatically call the [default console logger](https://spacy.io/api/top-level#ConsoleLogger). +However, starting with `spacy.WandbLogger.v5`, console logging must be activated +through the use of the [ChainLogger](#chainlogger). This allows the user to configure +the console logger's parameters according to their preferences. + +**Note** that by default, the full (interpolated) +[training config](https://spacy.io/usage/training#config) is sent over to the +W&B dashboard. If you prefer to **exclude certain information** such as path +names, you can list those fields in "dot notation" in the +`remove_config_values` parameter. These fields will then be removed from the +config before uploading, but will otherwise remain in the config file stored +on your local system. + +### Example config + +```ini +[training.logger] +@loggers = "spacy.WandbLogger.v5" +project_name = "monitor_spacy_training" +remove_config_values = ["paths.train", "paths.dev", "corpora.train.path", "corpora.dev.path"] +log_dataset_dir = "corpus" +model_log_interval = 1000 +``` + +| Name | Type | Description | +| ---------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `project_name` | `str` | The name of the project in the Weights & Biases interface. The project will be created automatically if it doesn't exist yet. | +| `remove_config_values` | `List[str]` | A list of values to exclude from the config before it is uploaded to W&B (default: `[]`). | +| `model_log_interval` | `Optional[int]` | Steps to wait between logging model checkpoints to the W&B dasboard (default: `None`). Added in `spacy.WandbLogger.v2`. | +| `log_dataset_dir` | `Optional[str]` | Directory containing the dataset to be logged and versioned as a W&B artifact (default: `None`). Added in `spacy.WandbLogger.v2`. | +| `entity` | `Optional[str]` | An entity is a username or team name where you're sending runs. If you don't specify an entity, the run will be sent to your default entity, which is usually your username (default: `None`). Added in `spacy.WandbLogger.v3`. | +| `run_name` | `Optional[str]` | The name of the run. If you don't specify a run name, the name will be created by the `wandb` library (default: `None`). Added in `spacy.WandbLogger.v3`. | +| `log_best_dir` | `Optional[str]` | Directory containing the best trained model as saved by spaCy (by default in `training/model-best`), to be logged and versioned as a W&B artifact (default: `None`). Added in `spacy.WandbLogger.v4`. | +| `log_latest_dir` | `Optional[str]` | Directory containing the latest trained model as saved by spaCy (by default in `training/model-latest`), to be logged and versioned as a W&B artifact (default: `None`). Added in `spacy.WandbLogger.v4`. | +| `log_custom_stats` | `Optional[List[str]]` | A list of regular expressions that will be applied to the info dictionary passed to the logger (default: `None`). Statistics and metrics that match these regexps will be automatically logged. Added in `spacy.WandbLogger.v5`. | + +## MLflowLogger + +### Installation + +This logger requires `mlflow` to be installed and configured: + +```bash +pip install mlflow +``` + +### Usage + +`spacy.MLflowLogger.v2` is a logger that tracks the results of each training step +using the [MLflow](https://www.mlflow.org/) tool. To use +this logger, MLflow should be installed. At the beginning of each model training +operation, the logger will initialize a new MLflow run and set it as the active +run under which metrics and parameters wil be logged. The logger will then log +the entire config file as parameters of the active run. After each training step, +the following actions are performed: + +- The final score is logged under the metric `score`. +- Individual component scores are logged under their default names. +- Loss values of different components are logged with the `loss_` prefix. +- If the final score is higher than the previous best score (for the current run), + the model artifact is additionally uploaded to MLflow. This action is only performed + if the `output_path` argument is provided during the training pipeline initialization phase. + +By default, the tracking API writes data into files in a local `./mlruns` directory. + +`spacy.MLflowLogger.v1` and below automatically call the [default console logger](https://spacy.io/api/top-level#ConsoleLogger). +However, starting with `spacy.MLflowLogger.v2`, console logging must be activated +through the use of the [ChainLogger](#chainlogger). This allows the user to configure +the console logger's parameters according to their preferences. + +**Note** that by default, the full (interpolated) +[training config](https://spacy.io/usage/training#config) is sent over to +MLflow. If you prefer to **exclude certain information** such as path +names, you can list those fields in "dot notation" in the +`remove_config_values` parameter. These fields will then be removed from the +config before uploading, but will otherwise remain in the config file stored +on your local system. + +### Example config + +```ini +[training.logger] +@loggers = "spacy.MLflowLogger.v2" +experiment_id = "1" +run_name = "with_fast_alignments" +nested = False +remove_config_values = ["paths.train", "paths.dev", "corpora.train.path", "corpora.dev.path"] +``` + +| Name | Type | Description | +| ---------------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `run_id` | `Optional[str]` | Unique ID of an existing MLflow run to which parameters and metrics are logged. Can be omitted if `experiment_id` and `run_id` are provided (default: `None`). | +| `experiment_id` | `Optional[str]` | ID of an existing experiment under which to create the current run. Only applicable when `run_id` is `None` (default: `None`). | +| `run_name` | `Optional[str]` | Name of new run. Only applicable when `run_id` is `None` (default: `None`). | +| `nested` | `bool` | Controls whether run is nested in parent run. `True` creates a nested run (default: `False`). | +| `tags` | `Optional[Dict[str, Any]]` | A dictionary of string keys and values to set as tags on the run. If a run is being resumed, these tags are set on the resumed run. If a new run is being created, these tags are set on the new run (default: `None`). | +| `remove_config_values` | `List[str]` | A list of values to exclude from the config before it is uploaded to MLflow (default: `[]`). | +| `log_custom_stats` | `Optional[List[str]]` | A list of regular expressions that will be applied to the info dictionary passed to the logger (default: `None`). Statistics and metrics that match these regexps will be automatically logged. Added in `spacy.MLflowLogger.v2`. | + +## ClearMLLogger + +### Installation + +This logger requires `clearml` to be installed and configured: + +```bash +pip install clearml +clearml-init +``` + +### Usage + +`spacy.ClearMLLogger.v2` is a logger that tracks the results of each training step +using the [ClearML](https://www.clear.ml/) tool. To use +this logger, ClearML should be installed and you should have initialized (using the command above). +The logger will send all the gathered information to your ClearML server, either [the hosted free tier](https://app.clear.ml) +or the open source [self-hosted server](https://github.com/allegroai/clearml-server). This logger captures the following information, all of which is visible in the ClearML web UI: + +- The full spaCy config file contents. +- Code information such as git repository, commit ID and uncommitted changes. +- Full console output. +- Miscellaneous info such as time, python version and hardware information. +- Output scalars: + - The final score is logged under the scalar `score`. + - Individual component scores are grouped together on one scalar plot (filterable using the web UI). + - Loss values of different components are logged with the `loss_` prefix. + +In addition to the above, the following artifacts can also be optionally captured: + +- Best model directory (zipped). +- Latest model directory (zipped). +- Dataset used to train. + - Versioned using ClearML Data and linked to under Configuration -> User Properties on the web UI. + +`spacy.ClearMLLogger.v1` and below automatically call the [default console logger](https://spacy.io/api/top-level#ConsoleLogger). +However, starting with `spacy.ClearMLLogger.v2`, console logging must be activated +through the use of the [ChainLogger](#chainlogger). This allows the user to configure +the console logger's parameters according to their preferences. + +**Note** that by default, the full (interpolated) +[training config](https://spacy.io/usage/training#config) is sent over to +ClearML. If you prefer to **exclude certain information** such as path +names, you can list those fields in "dot notation" in the +`remove_config_values` parameter. These fields will then be removed from the +config before uploading, but will otherwise remain in the config file stored +on your local system. + +### Example config + +```ini +[training.logger] +@loggers = "spacy.ClearMLLogger.v2" +project_name = "Hello ClearML!" +task_name = "My spaCy Task" +model_log_interval = 1000 +log_best_dir = training/model-best +log_latest_dir = training/model-last +log_dataset_dir = corpus +remove_config_values = ["paths.train", "paths.dev", "corpora.train.path", "corpora.dev.path"] +``` + +| Name | Type | Description | +| ---------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `project_name` | `str` | The name of the project in the ClearML interface. The project will be created automatically if it doesn't exist yet. | +| `task_name` | `str` | The name of the ClearML task. A task is an experiment that lives inside a project. Can be non-unique. | +| `remove_config_values` | `List[str]` | A list of values to exclude from the config before it is uploaded to ClearML (default: `[]`). | +| `model_log_interval` | `Optional[int]` | Steps to wait between logging model checkpoints to the ClearML dasboard (default: `None`). Will have no effect without also setting `log_best_dir` or `log_latest_dir`. | +| `log_dataset_dir` | `Optional[str]` | Directory containing the dataset to be logged and versioned as a [ClearML Dataset](https://clear.ml/docs/latest/docs/clearml_data/clearml_data/) (default: `None`). | +| `log_best_dir` | `Optional[str]` | Directory containing the best trained model as saved by spaCy (by default in `training/model-best`), to be logged and versioned as a ClearML artifact (default: `None`) | +| `log_latest_dir` | `Optional[str]` | Directory containing the latest trained model as saved by spaCy (by default in `training/model-last`), to be logged and versioned as a ClearML artifact (default: `None`) | +| `log_custom_stats` | `Optional[List[str]]` | A list of regular expressions that will be applied to the info dictionary passed to the logger (default: `None`). Statistics and metrics that match these regexps will be automatically logged. Added in `spacy.ClearMLLogger.v2`. | + +## PyTorchLogger + +### Installation + +This logger requires `torch` to be installed: + +```bash +pip install torch +``` + +### Usage + +`spacy.PyTorchLogger.v1` is different from the other loggers above in that it does not act as a bridge between spaCy and +an external framework. Instead, it is used to query PyTorch-specific metrics and make them available to other loggers. +Therefore, it's primarily intended to be used with [ChainLogger](#chainlogger). + +Whenever a logging checkpoint is reached, it queries statistics from the PyTorch backend and stores them in +the dictionary passed to it. Downstream loggers can thereafter lookup the statistics and log them to their +preferred framework. + +The following PyTorch statistics are currently supported: + +- [CUDA memory statistics](https://pytorch.org/docs/stable/generated/torch.cuda.memory_stats.html#torch.cuda.memory_stats) + +### Example config + +```ini +[training.logger] +@loggers = "spacy.ChainLogger.v1" +logger1 = {"@loggers": "spacy.PyTorchLogger.v1", "prefix": "pytorch", "device": "0", "cuda_mem_metric": "current"} +# Alternatively, you can use any other logger that provides the `log_custom_stats` parameter. +logger2 = {"@loggers": "spacy.LookupLogger.v1", "patterns": ["pytorch"]} +``` + +| Name | Type | Description | +| ----------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `prefix` | `str` | All metric names are prefixed with this string using dot notation, e.g: `.` (default: `pytorch`). | +| `device` | `int` | The identifier of the CUDA device (default: `0`). | +| `cuda_mem_pool` | `str` | One of the memory pool values specified in the PyTorch docs: `all`, `large_pool`, `small_pool` (default: `all`). | +| `cuda_mem_metric` | `str` | One of the memory metric values specified in the PyTorch docs: `current`, `peak`, `allocated`, `freed`. To log all metrics, use `all` instead (default: `all`). | + +## CupyLogger + +### Installation + +This logger requires `cupy` to be installed: + +```bash +pip install cupy +``` + +### Usage + +Similar to `PyTorchLogger`, `spacy.CupyLogger.v1` does not act as a bridge between spaCy and an external framework +but rather is used with the [ChainLogger](#chainlogger) to facilitate the flow of metrics to other loggers. +The `CupyLogger` queries statistics from the CuPy backend and stores them in the info dictionary passed to it. Downstream +loggers can thereafter lookup the statistics and log them to their preferred framework. + +The following CuPy statistics are currently supported: + +- [CUDA memory pool statistics](https://docs.cupy.dev/en/stable/user_guide/memory.html) + +### Example config + +```ini +[training.logger] +@loggers = "spacy.ChainLogger.v1" +logger1 = {"@loggers": "spacy.CupyLogger.v1", "prefix": "cupy"} +# Alternatively, you can use any other logger that provides the `log_custom_stats` parameter. +logger2 = {"@loggers": "spacy.LookupLogger.v1", "patterns": ["cupy"]} +``` + +| Name | Type | Description | +| -------- | ----- | ---------------------------------------------------------------------------------------------------------------- | +| `prefix` | `str` | All metric names are prefixed with this string using dot notation, e.g: `.` (default: `"cupy"`). | + +# Utility Loggers + +## ChainLogger + +### Usage + +This logger can be used to daisy-chain multiple loggers and execute them in-order. Loggers that are executed earlier in the chain +can pass information to those that come later by adding it to the dictionary that is passed to them. + +Currently, up to 10 loggers can be chained together. + +### Example config + +```ini +[training.logger] +@loggers = "spacy.ChainLogger.v1" +logger1 = {"@loggers": "spacy.PyTorchLogger.v1"} +logger2 = {"@loggers": "spacy.ConsoleLogger.v1", "progress_bar": "true"} +``` + +| Name | Type | Description | +| ---------- | -------------------- | -------------------------------------------------- | +| `logger1` | `Optional[Callable]` | The first logger in the chain (default: `None`). | +| `logger2` | `Optional[Callable]` | The second logger in the chain (default: `None`). | +| `logger3` | `Optional[Callable]` | The third logger in the chain (default: `None`). | +| `logger4` | `Optional[Callable]` | The fourth logger in the chain (default: `None`). | +| `logger5` | `Optional[Callable]` | The fifth logger in the chain (default: `None`). | +| `logger6` | `Optional[Callable]` | The sixth logger in the chain (default: `None`). | +| `logger7` | `Optional[Callable]` | The seventh logger in the chain (default: `None`). | +| `logger8` | `Optional[Callable]` | The eighth logger in the chain (default: `None`). | +| `logger9` | `Optional[Callable]` | The ninth logger in the chain (default: `None`). | +| `logger10` | `Optional[Callable]` | The tenth logger in the chain (default: `None`). | + +## LookupLogger + +### Usage + +This logger can be used to lookup statistics in the info dictionary and print them to `stdout`. It is primarily +intended to be used as a tool when developing new loggers. + +### Example config + +```ini +[training.logger] +@loggers = "spacy.ChainLogger.v1" +logger1 = {"@loggers": "spacy.PyTorchLogger.v1", "prefix": "pytorch"} +logger2 = {"@loggers": "spacy.LookupLogger.v1", "patterns": ["^[pP]ytorch"]} +``` + +| Name | Type | Description | +| ---------- | ----------- | ---------------------------------------------------------------------------------------------------- | +| `patterns` | `List[str]` | A list of regular expressions. If a statistic's name matches one of these, it's printed to `stdout`. | + +## Bug reports and other issues + +Please use [spaCy's issue tracker](https://github.com/explosion/spaCy/issues) to report a bug, or open a new thread on the +[discussion board](https://github.com/explosion/spaCy/discussions) +for any other issue. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..7cce7f9cb1609b0a766fc09f9b9f621d85f07cee --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/RECORD @@ -0,0 +1,38 @@ +spacy_loggers-1.0.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +spacy_loggers-1.0.5.dist-info/LICENSE,sha256=lUN_KcVXfUPlCgxqW250tVmE5BZh0eQ-Msuvo8pVcJk,1073 +spacy_loggers-1.0.5.dist-info/METADATA,sha256=GKCRyRhqBLyQMoWf0q0_hTEB6-Wqv_BmOR8OWE5pK3M,23074 +spacy_loggers-1.0.5.dist-info/RECORD,, +spacy_loggers-1.0.5.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92 +spacy_loggers-1.0.5.dist-info/entry_points.txt,sha256=w-yZoxYqVnO7gVVm_md_lf5vq0M2YNWRrbHwiWzAlH0,807 +spacy_loggers-1.0.5.dist-info/top_level.txt,sha256=PpevRlpPD_JIAOOwxodbgv8OmKh68L8kOwjTRC2Yfp0,14 +spacy_loggers-1.0.5.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 +spacy_loggers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_loggers/__pycache__/__init__.cpython-312.pyc,, +spacy_loggers/__pycache__/chain.cpython-312.pyc,, +spacy_loggers/__pycache__/clearml.cpython-312.pyc,, +spacy_loggers/__pycache__/cupy.cpython-312.pyc,, +spacy_loggers/__pycache__/lookup.cpython-312.pyc,, +spacy_loggers/__pycache__/mlflow.cpython-312.pyc,, +spacy_loggers/__pycache__/pytorch.cpython-312.pyc,, +spacy_loggers/__pycache__/util.cpython-312.pyc,, +spacy_loggers/__pycache__/wandb.cpython-312.pyc,, +spacy_loggers/chain.py,sha256=WDDhPK0dcD6J1oDlMymPbSTXqLX-G6dZzPMZAI-e9tA,1499 +spacy_loggers/clearml.py,sha256=oO6nKQgaoX3pBhVXfRcAVESy7MfbHd-7gFlk2EtnTnU,11524 +spacy_loggers/cupy.py,sha256=t67Xo916h6a5wSFQj_beT6Fjahp8MrqTFkF8Re49gCc,2482 +spacy_loggers/lookup.py,sha256=Zqh7xc6s6p6eGL3JVWqD6n4Y_oCSw5KjSnfz3eKfKaM,950 +spacy_loggers/mlflow.py,sha256=KZrguHKE_UmgUssO2FlZ19vCFAGLCq1nkZI_fwdD9e8,7914 +spacy_loggers/pytorch.py,sha256=XGiDVGKLoBvT0GqB67A9-FcIiNEk226KlS1HaPemZC8,2961 +spacy_loggers/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +spacy_loggers/tests/__pycache__/__init__.cpython-312.pyc,, +spacy_loggers/tests/__pycache__/test_chain.cpython-312.pyc,, +spacy_loggers/tests/__pycache__/test_cupy.cpython-312.pyc,, +spacy_loggers/tests/__pycache__/test_lookup.cpython-312.pyc,, +spacy_loggers/tests/__pycache__/test_registry.cpython-312.pyc,, +spacy_loggers/tests/__pycache__/util.cpython-312.pyc,, +spacy_loggers/tests/test_chain.py,sha256=dhGTHzGbGqXwD20VwRImLqDOyw-DLc9PodSw5tMe3pI,873 +spacy_loggers/tests/test_cupy.py,sha256=yMtJ0QIv2egNC4MGP0ob4HozoT4cywIlqzL86anKduE,1235 +spacy_loggers/tests/test_lookup.py,sha256=CiwqsziqHlfUFxHIxMEgiUuEPABrKuEQPMplFIV3WSA,1808 +spacy_loggers/tests/test_registry.py,sha256=kL_gc2i2vy3qxTfVJotIng3NlGSAH73Y8ZfEBkc8Zmk,789 +spacy_loggers/tests/util.py,sha256=s3t25fO1YzJCSH8ZnlrRa10CMHs9e-qtmpsuws0SqlY,548 +spacy_loggers/util.py,sha256=oi1Ub8-TTo9ofv6hpwWNm7KtQxpsgB_1anILbLSkOgA,2714 +spacy_loggers/wandb.py,sha256=Qp8Xc2sunCsy3pIXYycNl2VpF5lLYkpbcNEoh_JLRR8,15879 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..7e688737d490be3643d705bc16b5a77f7bd567b7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.41.2) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3f78fdc84103c8ee5c6d911b80488057ee99731 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/entry_points.txt @@ -0,0 +1,14 @@ +[spacy_loggers] +spacy.ChainLogger.v1 = spacy_loggers.chain:chain_logger_v1 +spacy.ClearMLLogger.v1 = spacy_loggers.clearml:clearml_logger_v1 +spacy.ClearMLLogger.v2 = spacy_loggers.clearml:clearml_logger_v2 +spacy.CupyLogger.v1 = spacy_loggers.cupy:cupy_logger_v1 +spacy.LookupLogger.v1 = spacy_loggers.lookup:lookup_logger_v1 +spacy.MLflowLogger.v1 = spacy_loggers.mlflow:mlflow_logger_v1 +spacy.MLflowLogger.v2 = spacy_loggers.mlflow:mlflow_logger_v2 +spacy.PyTorchLogger.v1 = spacy_loggers.pytorch:pytorch_logger_v1 +spacy.WandbLogger.v1 = spacy_loggers.wandb:wandb_logger_v1 +spacy.WandbLogger.v2 = spacy_loggers.wandb:wandb_logger_v2 +spacy.WandbLogger.v3 = spacy_loggers.wandb:wandb_logger_v3 +spacy.WandbLogger.v4 = spacy_loggers.wandb:wandb_logger_v4 +spacy.WandbLogger.v5 = spacy_loggers.wandb:wandb_logger_v5 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1f3035302caa329d68d4749dd7a6e3821fe697d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/top_level.txt @@ -0,0 +1 @@ +spacy_loggers diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/zip-safe b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/zip-safe new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers-1.0.5.dist-info/zip-safe @@ -0,0 +1 @@ + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/chain.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/chain.py new file mode 100644 index 0000000000000000000000000000000000000000..acdd4f6248c92e77caac9505f3d321724179024a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/chain.py @@ -0,0 +1,54 @@ +""" +A utility logger that allows multiple loggers to be daisy-chained. +""" +from typing import Dict, Any, Optional, IO +import sys + +from spacy import Language +from .util import LoggerT + + +def chain_logger_v1( + logger1: Optional[LoggerT] = None, + logger2: Optional[LoggerT] = None, + logger3: Optional[LoggerT] = None, + logger4: Optional[LoggerT] = None, + logger5: Optional[LoggerT] = None, + logger6: Optional[LoggerT] = None, + logger7: Optional[LoggerT] = None, + logger8: Optional[LoggerT] = None, + logger9: Optional[LoggerT] = None, + logger10: Optional[LoggerT] = None, +) -> LoggerT: + def setup_logger(nlp: Language, stdout: IO = sys.stdout, stderr: IO = sys.stderr): + loggers = [ + logger1, + logger2, + logger3, + logger4, + logger5, + logger6, + logger7, + logger8, + logger9, + logger10, + ] + if not any(loggers): + raise ValueError("No loggers passed to chain logger") + callbacks = [ + setup(nlp, stdout, stderr) for setup in loggers if setup is not None + ] + + def log_step(info: Optional[Dict[str, Any]]): + nonlocal callbacks + for log_stepper, _ in callbacks: + log_stepper(info) + + def finalize(): + nonlocal callbacks + for _, finalizer in callbacks: + finalizer() + + return log_step, finalize + + return setup_logger diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/clearml.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/clearml.py new file mode 100644 index 0000000000000000000000000000000000000000..2f61526cf02236745cc79d8c1535e58b2cb495b5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/clearml.py @@ -0,0 +1,310 @@ +from typing import Dict, Any, Tuple, Callable, List, Optional, IO +from types import ModuleType +import os +import sys + +from spacy import Language +from spacy.util import SimpleFrozenList +from .util import dict_to_dot, dot_to_dict, matcher_for_regex_patterns +from .util import setup_default_console_logger, LoggerT + + +# entry point: spacy.ClearMLLogger.v2 +def clearml_logger_v2( + project_name: str, + task_name: str, + remove_config_values: List[str] = SimpleFrozenList(), + model_log_interval: Optional[int] = None, + log_dataset_dir: Optional[str] = None, + log_best_dir: Optional[str] = None, + log_latest_dir: Optional[str] = None, + log_custom_stats: Optional[List[str]] = None, +) -> LoggerT: + """Creates a logger that interoperates with the ClearML framework. + + Args: + project_name (str): + The name of the project in the ClearML interface. The project will be created automatically if it doesn't exist yet. + task_name (str): + The name of the ClearML task. A task is an experiment that lives inside a project. Can be non-unique. + remove_config_values (List[str]): + A list of values to exclude from the config before it is uploaded to ClearML. Defaults to []. + model_log_interval (Optional[int]): + Steps to wait between logging model checkpoints to the ClearML dasboard (default: `None`). Will have no effect without also setting `log_best_dir` or `log_latest_dir`. Defaults to None. + log_dataset_dir (Optional[str]): + Directory containing the dataset to be logged and versioned as a ClearML Dataset. Defaults to None. + log_best_dir (Optional[str]): + Directory containing the best trained model as saved by spaCy, to be logged and versioned as a ClearML artifact. Defaults to None. + log_latest_dir (Optional[str]): + Directory containing the latest trained model as saved by spaCy, to be logged and versioned as a ClearML artifact. Defaults to None. + log_custom_stats (Optional[List[str]]): + A list of regular expressions that will be applied to the info dictionary passed to the logger. Statistics and metrics that match these regexps will be automatically logged. Defaults to None. + + Returns: + LoggerT: Logger instance. + """ + clearml = _import_clearml() + + def setup_logger( + nlp: Language, stdout: IO = sys.stdout, stderr: IO = sys.stderr + ) -> Tuple[Callable[[Dict[str, Any]], None], Callable[[], None]]: + match_stat = matcher_for_regex_patterns(log_custom_stats) + task, best_model, last_model = _setup_clearml( + clearml, + nlp, + project_name, + task_name, + log_dataset_dir, + log_best_dir, + log_latest_dir, + remove_config_values, + ) + + def log_step(info: Optional[Dict[str, Any]]): + _log_step_clearml( + info, + task, + best_model, + last_model, + model_log_interval, + log_best_dir, + log_latest_dir, + ) + _log_custom_stats(clearml, info, match_stat) + + def finalize(): + _finalize_clearml(task) + + return log_step, finalize + + return setup_logger + + +# entry point: spacy.ClearMLLogger.v1 +def clearml_logger_v1( + project_name: str, + task_name: str, + remove_config_values: List[str] = SimpleFrozenList(), + model_log_interval: Optional[int] = None, + log_dataset_dir: Optional[str] = None, + log_best_dir: Optional[str] = None, + log_latest_dir: Optional[str] = None, +) -> LoggerT: + """Creates a logger that interoperates with the ClearML framework. + + Args: + project_name (str): + The name of the project in the ClearML interface. The project will be created automatically if it doesn't exist yet. + task_name (str): + The name of the ClearML task. A task is an experiment that lives inside a project. Can be non-unique. + remove_config_values (List[str]): + A list of values to exclude from the config before it is uploaded to ClearML. Defaults to []. + model_log_interval (Optional[int]): + Steps to wait between logging model checkpoints to the ClearML dasboard (default: `None`). Will have no effect without also setting `log_best_dir` or `log_latest_dir`. Defaults to None. + log_dataset_dir (Optional[str]): + Directory containing the dataset to be logged and versioned as a ClearML Dataset. Defaults to None. + log_best_dir (Optional[str]): + Directory containing the best trained model as saved by spaCy, to be logged and versioned as a ClearML artifact. Defaults to None. + log_latest_dir (Optional[str]): + Directory containing the latest trained model as saved by spaCy, to be logged and versioned as a ClearML artifact. Defaults to None. + + Returns: + LoggerT: Logger instance. + """ + clearml = _import_clearml() + + def setup_logger( + nlp: Language, stdout: IO = sys.stdout, stderr: IO = sys.stderr + ) -> Tuple[Callable[[Dict[str, Any]], None], Callable[[], None]]: + console_log_step, console_finalize = setup_default_console_logger( + nlp, stdout, stderr + ) + task, best_model, last_model = _setup_clearml( + clearml, + nlp, + project_name, + task_name, + log_dataset_dir, + log_best_dir, + log_latest_dir, + remove_config_values, + ) + + def log_step(info: Optional[Dict[str, Any]]): + console_log_step(info) + _log_step_clearml( + info, + task, + best_model, + last_model, + model_log_interval, + log_best_dir, + log_latest_dir, + ) + + def finalize(): + console_finalize() + _finalize_clearml(task) + + return log_step, finalize + + return setup_logger + + +def _import_clearml() -> ModuleType: + try: + import clearml + + # test that these are available + from clearml import Task, Dataset, OutputModel # noqa: F401 + except ImportError as exc: + raise ImportError( + "The 'clearml' library could not be found - did you install it? " + "Alternatively, specify the 'ConsoleLogger' in the " + "'training.logger' config section, instead of the 'ClearMLLogger'." + ) from exc + return clearml + + +def _setup_clearml( + clearml: ModuleType, + nlp: "Language", + project_name: str, + task_name: str, + log_dataset_dir: Optional[str] = None, + log_best_dir: Optional[str] = None, + log_latest_dir: Optional[str] = None, + remove_config_values: List[str] = SimpleFrozenList(), +) -> Tuple[Any, Any, Any]: + config = nlp.config.interpolate() + config_dot = dict_to_dot(config) + for field in remove_config_values: + del config_dot[field] + config = dot_to_dict(config_dot) + task = clearml.Task.init( + project_name=project_name, + task_name=task_name, + output_uri=True, + ) + for config_section, subconfig_or_value in config.items(): + task.connect(subconfig_or_value, name=config_section) + + if log_dataset_dir: + dataset = clearml.Dataset.create( + dataset_project=project_name, + dataset_name=os.path.basename(log_dataset_dir), + ) + dataset.add_files(log_dataset_dir) + dataset.finalize(auto_upload=True) + task.set_user_properties( + { + "name": "Created Dataset ID", + "value": dataset.id, + } + ) + + # Connect 2 models to the task, we will periodically update their weights later on + if log_best_dir: + best_model = clearml.OutputModel( + task=task, framework="spaCy", name="Best Model" + ) + else: + best_model = None + if log_latest_dir: + last_model = clearml.OutputModel( + task=task, framework="spaCy", name="Last Model" + ) + else: + last_model = None + + return task, best_model, last_model + + +def _log_step_clearml( + info: Optional[Dict[str, Any]], + task: Any, + best_model: Optional[Any] = None, + last_model: Optional[Any] = None, + model_log_interval: Optional[int] = None, + log_best_dir: Optional[str] = None, + log_latest_dir: Optional[str] = None, +): + if info is None: + return + + score = info.get("score") + other_scores = info.get("other_scores") + losses = info.get("losses") + if score: + task.get_logger().report_scalar( + "Score", "Score", iteration=info["step"], value=score + ) + if losses: + for metric, metric_value in losses.items(): + task.get_logger().report_scalar( + title=f"loss_{metric}", + series=f"loss_{metric}", + iteration=info["step"], + value=metric_value, + ) + if isinstance(other_scores, dict): + # other_scores is usually a nested dict, so group they by the first key and flatten the rest + # combine flattened submetrics on the same ClearML graph when they have the same first key + for metric, metric_value in other_scores.items(): + if isinstance(metric_value, dict): + sub_metrics_dict = dict_to_dot(metric_value) + for ( + sub_metric, + sub_metric_value, + ) in sub_metrics_dict.items(): + # Scalars with the same title get plotted on the same graph as multiple traces + # This saves a lot of space in the UI + task.get_logger().report_scalar( + title=metric, + series=sub_metric, + iteration=info["step"], + value=sub_metric_value, + ) + elif isinstance(metric_value, (float, int)): + task.get_logger().report_scalar( + metric, + metric, + iteration=info["step"], + value=metric_value, + ) + + if model_log_interval and info.get("output_path"): + if info["step"] % model_log_interval == 0 and info["step"] != 0: + if log_latest_dir: + assert last_model is not None + last_model.update_weights_package( + weights_path=log_latest_dir, + auto_delete_file=False, + target_filename="last_model", + ) + if log_best_dir and info["score"] == max(info["checkpoints"])[0]: + assert best_model is not None + best_model.update_weights_package( + weights_path=log_best_dir, + auto_delete_file=False, + target_filename="best_model", + ) + + +def _finalize_clearml(task: Any): + task.flush(wait_for_uploads=True) + task.close() + + +def _log_custom_stats( + task: Any, info: Optional[Dict[str, Any]], matcher: Callable[[str], bool] +): + if info is not None: + for k, v in info.items(): + if matcher(k): + task.get_logger().report_scalar( + title=f"loss_{k}", + series=f"loss_{k}", + iteration=info["step"], + value=v, + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/cupy.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/cupy.py new file mode 100644 index 0000000000000000000000000000000000000000..061f94222dbaadbd6d2b837c97e407a6944d5127 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/cupy.py @@ -0,0 +1,71 @@ +""" +A logger that queries CuPy metrics and passes that information to downstream loggers. +""" +from typing import Dict, Any, Optional, IO +import sys + +from spacy import Language +from thinc.backends import context_pools +from thinc.util import has_cupy_gpu +from .util import LoggerT + + +def cupy_logger_v1( + prefix: str = "cupy", +) -> LoggerT: + """Creates a logger that queries CuPy metrics and passes that information to downstream loggers. + + Args: + prefix (str): + All metric names are prefixed with this string using dot notation, e.g: `.`. + + Returns: + LoggerT: Logger instance. + """ + try: + import cupy + except ImportError: + raise ImportError( + "The 'cupy' library could not be found - did you install it? " + "Alternatively, specify the 'ConsoleLogger' in the " + "'training.logger' config section, instead of the 'CuPyLogger'." + ) + + if not has_cupy_gpu: + raise ValueError( + "The 'cupy' library could be loaded but GPU support couldn't be initialized - " + "do you have the necessary CUDA libraries installed?" + ) + + def setup_logger(nlp: Language, stdout: IO = sys.stdout, stderr: IO = sys.stderr): + def to_mib(bytes: int) -> float: + return bytes / (1024.0**2) + + def log_step(info: Optional[Dict[str, Any]]): + if info is None: + return + + # We cannot rely on cupy.cuda.get_default_memory_pool() as thinc can + # use its own allocator/pool for interop with PyTorch/TensorFlow. + cupy_memory_pool = cupy.cuda.get_allocator().__self__ + thinc_pool = context_pools.get() + + if thinc_pool.get("pytorch") == cupy_memory_pool: + pool_source = "pytorch" + elif thinc_pool.get("tensorflow") == cupy_memory_pool: + pool_source = "tensorflow" + else: + pool_source = "default" + + info[f"{prefix}.pool.source"] = pool_source + info[f"{prefix}.pool.acquired_mib"] = to_mib(cupy_memory_pool.total_bytes()) + info[f"{prefix}.pool.used_mib"] = to_mib(cupy_memory_pool.used_bytes()) + info[f"{prefix}.pool.free_mib"] = to_mib(cupy_memory_pool.free_bytes()) + info[f"{prefix}.pool.num_free_blocks"] = cupy_memory_pool.n_free_blocks() + + def finalize(): + pass + + return log_step, finalize + + return setup_logger diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/lookup.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/lookup.py new file mode 100644 index 0000000000000000000000000000000000000000..a49b486bf03abdb573112097dbe3696d4c576327 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/lookup.py @@ -0,0 +1,30 @@ +""" +A utility logger that looks up specific statistics and prints them to stdout. +""" +from typing import Dict, Any, Optional, IO, List +import sys + +from spacy import Language +from .util import dict_to_dot, LoggerT, matcher_for_regex_patterns + + +def lookup_logger_v1(patterns: List[str]) -> LoggerT: + def setup_logger(nlp: Language, stdout: IO = sys.stdout, stderr: IO = sys.stderr): + if len(patterns) == 0: + raise ValueError("Lookup logger should receive at least one pattern") + match_stat = matcher_for_regex_patterns(patterns) + + def log_step(info: Optional[Dict[str, Any]]): + if info is None: + return + config_dot = dict_to_dot(info) + for k, v in config_dot.items(): + if match_stat(k): + stdout.writelines([k, " -> ", str(v), "\n"]) + + def finalize(): + pass + + return log_step, finalize + + return setup_logger diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/mlflow.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/mlflow.py new file mode 100644 index 0000000000000000000000000000000000000000..d85521251ca663f50eecef686746823943b91a57 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/mlflow.py @@ -0,0 +1,229 @@ +""" +A logger that logs training activity to MLflow. +""" + +from typing import Dict, Any, Tuple, Callable, List, Optional, IO +from types import ModuleType +import os +import sys + +from spacy import Language, load +from spacy.util import SimpleFrozenList +from .util import dict_to_dot, dot_to_dict, matcher_for_regex_patterns +from .util import setup_default_console_logger, LoggerT + + +# entry point: spacy.MLflowLogger.v2 +def mlflow_logger_v2( + run_id: Optional[str] = None, + experiment_id: Optional[str] = None, + run_name: Optional[str] = None, + nested: bool = False, + tags: Optional[Dict[str, Any]] = None, + remove_config_values: List[str] = SimpleFrozenList(), + log_custom_stats: Optional[List[str]] = None, +) -> LoggerT: + """Creates a logger that interoperates with the MLflow framework. + + Args: + run_id (Optional[str]): + Unique ID of an existing MLflow run to which parameters and metrics are logged. Can be omitted if `experiment_id` and `run_id` are provided. Defaults to None. + experiment_id (Optional[str]): + ID of an existing experiment under which to create the current run. Only applicable when `run_id` is `None`. Defaults to None. + run_name (Optional[str]): + Name of new run. Only applicable when `run_id` is `None`. Defaults to None. + nested (bool): + Controls whether run is nested in parent run. `True` creates a nested run. Defaults to False. + tags (Optional[Dict[str, Any]]): + A dictionary of string keys and values to set as tags on the run. If a run is being resumed, these tags are set on the resumed run. If a new run is being created, these tags are set on the new run. Defaults to None. + remove_config_values (List[str]): + A list of values to exclude from the config before it is uploaded to MLflow. Defaults to an empty list. + log_custom_stats (Optional[List[str]]): + A list of regular expressions that will be applied to the info dictionary passed to the logger. Statistics and metrics that match these regexps will be automatically logged. Defaults to None. + + Returns: + LoggerT: Logger instance. + """ + mlflow = _import_mlflow() + + def setup_logger( + nlp: Language, stdout: IO = sys.stdout, stderr: IO = sys.stderr + ) -> Tuple[Callable[[Dict[str, Any]], None], Callable[[], None]]: + match_stat = matcher_for_regex_patterns(log_custom_stats) + _setup_mlflow( + mlflow, + nlp, + run_id, + experiment_id, + run_name, + nested, + tags, + remove_config_values, + ) + + def log_step(info: Optional[Dict[str, Any]]): + _log_step_mlflow(mlflow, info) + _log_custom_stats(mlflow, info, match_stat) + + def finalize() -> None: + _finalize_mlflow(mlflow) + + return log_step, finalize + + return setup_logger + + +# entry point: spacy.MLflowLogger.v1 +def mlflow_logger_v1( + run_id: Optional[str] = None, + experiment_id: Optional[str] = None, + run_name: Optional[str] = None, + nested: bool = False, + tags: Optional[Dict[str, Any]] = None, + remove_config_values: List[str] = SimpleFrozenList(), +) -> LoggerT: + """Creates a logger that interoperates with the MLflow framework. + + Args: + run_id (Optional[str]): + Unique ID of an existing MLflow run to which parameters and metrics are logged. Can be omitted if `experiment_id` and `run_id` are provided. Defaults to None. + experiment_id (Optional[str]): + ID of an existing experiment under which to create the current run. Only applicable when `run_id` is `None`. Defaults to None. + run_name (Optional[str]): + Name of new run. Only applicable when `run_id` is `None`. Defaults to None. + nested (bool): + Controls whether run is nested in parent run. `True` creates a nested run. Defaults to False. + tags (Optional[Dict[str, Any]]): + A dictionary of string keys and values to set as tags on the run. If a run is being resumed, these tags are set on the resumed run. If a new run is being created, these tags are set on the new run. Defaults to None. + remove_config_values (List[str]): + A list of values to exclude from the config before it is uploaded to MLflow. Defaults to an empty list. + + Returns: + LoggerT: Logger instance. + """ + mlflow = _import_mlflow() + + def setup_logger( + nlp: Language, stdout: IO = sys.stdout, stderr: IO = sys.stderr + ) -> Tuple[Callable[[Dict[str, Any]], None], Callable[[], None]]: + console_log_step, console_finalize = setup_default_console_logger( + nlp, stdout, stderr + ) + _setup_mlflow( + mlflow, + nlp, + run_id, + experiment_id, + run_name, + nested, + tags, + remove_config_values, + ) + + def log_step(info: Optional[Dict[str, Any]]): + console_log_step(info) + _log_step_mlflow(mlflow, info) + + def finalize() -> None: + console_finalize() + _finalize_mlflow(mlflow) + + return log_step, finalize + + return setup_logger + + +def _import_mlflow() -> ModuleType: + try: + import mlflow + + # test that these are available + from mlflow import ( + start_run, + log_metric, + log_metrics, + log_artifact, + end_run, + ) # noqa: F401 + except ImportError: + raise ImportError( + "The 'mlflow' library could not be found - did you install it? " + "Alternatively, specify the 'ConsoleLogger' in the " + "'training.logger' config section, instead of the 'MLflowLogger'." + ) + return mlflow + + +def _setup_mlflow( + mlflow: ModuleType, + nlp: Language, + run_id: Optional[str] = None, + experiment_id: Optional[str] = None, + run_name: Optional[str] = None, + nested: bool = False, + tags: Optional[Dict[str, Any]] = None, + remove_config_values: List[str] = SimpleFrozenList(), +): + config = nlp.config.interpolate() + config_dot = dict_to_dot(config) + for field in remove_config_values: + del config_dot[field] + config = dot_to_dict(config_dot) + + mlflow.start_run( + run_id=run_id, + experiment_id=experiment_id, + run_name=run_name, + nested=nested, + tags=tags, + ) + + config_dot_items = list(config_dot.items()) + config_dot_batches = [ + config_dot_items[i : i + 100] for i in range(0, len(config_dot_items), 100) + ] + for batch in config_dot_batches: + mlflow.log_params({k.replace("@", ""): v for k, v in batch}) + + +def _log_step_mlflow( + mlflow: ModuleType, + info: Optional[Dict[str, Any]], +): + if info is None: + return + + score = info["score"] + other_scores = info["other_scores"] + losses = info["losses"] + output_path = info.get("output_path", None) + if score is not None: + mlflow.log_metric("score", score) + if losses: + mlflow.log_metrics({f"loss_{k}": v for k, v in losses.items()}) + if isinstance(other_scores, dict): + mlflow.log_metrics( + { + k: v + for k, v in dict_to_dot(other_scores).items() + if isinstance(v, float) or isinstance(v, int) + } + ) + if output_path and score == max(info["checkpoints"])[0]: + nlp = load(output_path) + mlflow.spacy.log_model(nlp, "best") + + +def _finalize_mlflow( + mlflow: ModuleType, +): + mlflow.end_run() + + +def _log_custom_stats( + mlflow: ModuleType, info: Optional[Dict[str, Any]], matcher: Callable[[str], bool] +): + if info is not None: + matched = {k: v for k, v in info.items() if matcher(k)} + if len(matched): + mlflow.log_metrics(matched) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/pytorch.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/pytorch.py new file mode 100644 index 0000000000000000000000000000000000000000..983a7c93292304d4092bffa5869eb21fd835b869 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/pytorch.py @@ -0,0 +1,77 @@ +""" +A logger that queries PyTorch metrics and passes that information to downstream loggers. +""" +from typing import Dict, Any, Optional, Tuple, IO +import re +import sys + +from spacy import Language +from .util import LoggerT + + +def pytorch_logger_v1( + prefix: str = "pytorch", + device: int = 0, + cuda_mem_pool: str = "all", + cuda_mem_metric: str = "all", +) -> LoggerT: + try: + import torch + except ImportError: + raise ImportError( + "The 'torch' library could not be found - did you install it? " + "Alternatively, specify the 'ConsoleLogger' in the " + "'training.logger' config section, instead of the 'PyTorchLogger'." + ) + + def setup_logger(nlp: Language, stdout: IO = sys.stdout, stderr: IO = sys.stderr): + expected_cuda_mem_pool = ("all", "large_pool", "small_pool") + expected_cuda_mem_metric = ("all", "current", "peak", "allocated", "free") + + if cuda_mem_pool not in expected_cuda_mem_pool: + raise ValueError( + f"Got CUDA memory pool '{cuda_mem_pool}', but expected one of: '{expected_cuda_mem_pool}'" + ) + elif cuda_mem_metric not in expected_cuda_mem_metric: + raise ValueError( + f"Got CUDA memory metric '{cuda_mem_metric}', but expected one of: '{expected_cuda_mem_metric}'" + ) + + def normalize_mem_value_to_mb(name: str, value: int) -> Tuple[str, float]: + if "_bytes" in name: + return re.sub("_bytes", "_megabytes", name), value / (1024.0**2) + else: + return name, value + + def log_step(info: Optional[Dict[str, Any]]): + if info is None: + return + + cuda_mem_stats = torch.cuda.memory_stats(device) + for stat, val in cuda_mem_stats.items(): + splits = stat.split(".") + if len(splits) == 3: + name, pool, metric = splits + name, val = normalize_mem_value_to_mb(name, val) + if pool != cuda_mem_pool: + continue + elif cuda_mem_metric != "all" and metric != cuda_mem_metric: + continue + info[f"{prefix}.{name}.{pool}.{metric}"] = val + elif len(splits) == 2: + name, metric = splits + name, val = normalize_mem_value_to_mb(name, val) + if cuda_mem_metric != "all" and metric != cuda_mem_metric: + continue + info[f"{prefix}.{name}.{metric}"] = val + else: + # Either global statistic or something that we haven't accounted for, + # e.g: a newly added statistic. So, we'll just include it to be safe. + info[f"{prefix}.{stat}"] = val + + def finalize(): + pass + + return log_step, finalize + + return setup_logger diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/util.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/util.py new file mode 100644 index 0000000000000000000000000000000000000000..6bc52b04024d8bf765cf54add612713af5290bb5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/util.py @@ -0,0 +1,85 @@ +""" +Configuration utilities copied from spacy.util. +""" +import sys +from typing import Dict, Any, Tuple, Callable, Iterator, List, Optional, IO +import re + +from spacy import Language +from spacy.util import registry + + +LoggerT = Callable[ + [Language, IO, IO], + Tuple[Callable[[Optional[Dict[str, Any]]], None], Callable[[], None]], +] + + +def walk_dict( + node: Dict[str, Any], parent: List[str] = [] +) -> Iterator[Tuple[List[str], Any]]: + """Walk a dict and yield the path and values of the leaves.""" + for key, value in node.items(): + key_parent = [*parent, key] + if isinstance(value, dict): + yield from walk_dict(value, key_parent) + else: + yield (key_parent, value) + + +def dot_to_dict(values: Dict[str, Any]) -> Dict[str, dict]: + """Convert dot notation to a dict. For example: {"token.pos": True, + "token._.xyz": True} becomes {"token": {"pos": True, "_": {"xyz": True }}}. + + values (Dict[str, Any]): The key/value pairs to convert. + RETURNS (Dict[str, dict]): The converted values. + """ + result = {} + for key, value in values.items(): + path = result + parts = key.lower().split(".") + for i, item in enumerate(parts): + is_last = i == len(parts) - 1 + path = path.setdefault(item, value if is_last else {}) + return result + + +def dict_to_dot(obj: Dict[str, dict]) -> Dict[str, Any]: + """Convert dot notation to a dict. For example: {"token": {"pos": True, + "_": {"xyz": True }}} becomes {"token.pos": True, "token._.xyz": True}. + + values (Dict[str, dict]): The dict to convert. + RETURNS (Dict[str, Any]): The key/value pairs. + """ + return {".".join(key): value for key, value in walk_dict(obj)} + + +def matcher_for_regex_patterns( + regexps: Optional[List[str]] = None, +) -> Callable[[str], bool]: + try: + compiled = [] + if regexps is not None: + for regex in regexps: + compiled.append(re.compile(regex, flags=re.MULTILINE)) + except re.error as err: + raise ValueError( + f"Regular expression `{regex}` couldn't be compiled for logger stats matcher" + ) from err + + def is_match(string: str) -> bool: + for regex in compiled: + if regex.search(string): + return True + return False + + return is_match + + +def setup_default_console_logger( + nlp: "Language", stdout: IO = sys.stdout, stderr: IO = sys.stderr +) -> Tuple[Callable, Callable]: + console_logger = registry.get("loggers", "spacy.ConsoleLogger.v1") + console = console_logger(progress_bar=False) + console_log_step, console_finalize = console(nlp, stdout, stderr) + return console_log_step, console_finalize diff --git a/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/wandb.py b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/wandb.py new file mode 100644 index 0000000000000000000000000000000000000000..28bd112a73d4fc82e621318b3eb29361619c073a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/spacy_loggers/wandb.py @@ -0,0 +1,432 @@ +""" +A logger that logs training activity to Weights and Biases. +""" + +from typing import Dict, Any, Tuple, Callable, List, IO, Optional +from types import ModuleType +import sys + +from spacy import Language +from spacy.util import SimpleFrozenList + +from .util import dict_to_dot, dot_to_dict, matcher_for_regex_patterns +from .util import setup_default_console_logger, LoggerT + + +# entry point: spacy.WandbLogger.v5 +def wandb_logger_v5( + project_name: str, + remove_config_values: List[str] = SimpleFrozenList(), + model_log_interval: Optional[int] = None, + log_dataset_dir: Optional[str] = None, + entity: Optional[str] = None, + run_name: Optional[str] = None, + log_best_dir: Optional[str] = None, + log_latest_dir: Optional[str] = None, + log_custom_stats: Optional[List[str]] = None, +) -> LoggerT: + """Creates a logger that interoperates with the Weights & Biases framework. + + Args: + project_name (str): + The name of the project in the Weights & Biases interface. The project will be created automatically if it doesn't exist yet. + remove_config_values (List[str]): + A list of values to exclude from the config before it is uploaded to W&B. Defaults to []. + model_log_interval (Optional[int]): + Steps to wait between logging model checkpoints to the W&B dasboard. Defaults to None. + log_dataset_dir (Optional[str]): + Directory containing the dataset to be logged and versioned as a W&B artifact. Defaults to None. + entity (Optional[str]): + An entity is a username or team name where you're sending runs. If you don't specify an entity, the run will be sent to your default entity, which is usually your username. Defaults to None. + run_name (Optional[str]): + The name of the run. If you don't specify a run name, the name will be created by the `wandb` library. Defaults to None. + log_best_dir (Optional[str]): + Directory containing the best trained model as saved by spaCy, to be logged and versioned as a W&B artifact. Defaults to None. + log_latest_dir (Optional[str]): + Directory containing the latest trained model as saved by spaCy, to be logged and versioned as a W&B artifact. Defaults to None. + log_custom_stats (Optional[List[str]]): + A list of regular expressions that will be applied to the info dictionary passed to the logger. Statistics and metrics that match these regexps will be automatically logged. Defaults to None. + + Returns: + LoggerT: Logger instance. + """ + wandb = _import_wandb() + + def setup_logger( + nlp: "Language", stdout: IO = sys.stdout, stderr: IO = sys.stderr + ) -> Tuple[Callable[[Dict[str, Any]], None], Callable[[], None]]: + match_stat = matcher_for_regex_patterns(log_custom_stats) + run = _setup_wandb( + wandb, + nlp, + project_name, + remove_config_values=remove_config_values, + entity=entity, + ) + if run_name: + wandb.run.name = run_name + + if log_dataset_dir: + _log_dir_artifact( + wandb, path=log_dataset_dir, name="dataset", type="dataset" + ) + + def log_step(info: Optional[Dict[str, Any]]): + _log_scores(wandb, info) + _log_model_artifact(wandb, info, run, model_log_interval) + _log_custom_stats(wandb, info, match_stat) + + def finalize() -> None: + if log_best_dir: + _log_dir_artifact( + wandb, + path=log_best_dir, + name="model_best", + type="model", + ) + + if log_latest_dir: + _log_dir_artifact( + wandb, + path=log_latest_dir, + name="model_last", + type="model", + ) + wandb.join() + + return log_step, finalize + + return setup_logger + + +# entry point: spacy.WandbLogger.v4 +def wandb_logger_v4( + project_name: str, + remove_config_values: List[str] = SimpleFrozenList(), + model_log_interval: Optional[int] = None, + log_dataset_dir: Optional[str] = None, + entity: Optional[str] = None, + run_name: Optional[str] = None, + log_best_dir: Optional[str] = None, + log_latest_dir: Optional[str] = None, +) -> LoggerT: + """Creates a logger that interoperates with the Weights & Biases framework. + + Args: + project_name (str): + The name of the project in the Weights & Biases interface. The project will be created automatically if it doesn't exist yet. + remove_config_values (List[str]): + A list of values to exclude from the config before it is uploaded to W&B. Defaults to []. + model_log_interval (Optional[int]): + Steps to wait between logging model checkpoints to the W&B dasboard. Defaults to None. + log_dataset_dir (Optional[str]): + Directory containing the dataset to be logged and versioned as a W&B artifact. Defaults to None. + entity (Optional[str]): + An entity is a username or team name where you're sending runs. If you don't specify an entity, the run will be sent to your default entity, which is usually your username. Defaults to None. + run_name (Optional[str]): + The name of the run. If you don't specify a run name, the name will be created by the `wandb` library. Defaults to None. + log_best_dir (Optional[str]): + Directory containing the best trained model as saved by spaCy, to be logged and versioned as a W&B artifact. Defaults to None. + log_latest_dir (Optional[str]): + Directory containing the latest trained model as saved by spaCy, to be logged and versioned as a W&B artifact. Defaults to None. + + Returns: + LoggerT: Logger instance. + """ + wandb = _import_wandb() + + def setup_logger( + nlp: "Language", stdout: IO = sys.stdout, stderr: IO = sys.stderr + ) -> Tuple[Callable[[Dict[str, Any]], None], Callable[[], None]]: + console_log_step, console_finalize = setup_default_console_logger( + nlp, stdout, stderr + ) + run = _setup_wandb( + wandb, + nlp, + project_name, + remove_config_values=remove_config_values, + entity=entity, + ) + if run_name: + wandb.run.name = run_name + + if log_dataset_dir: + _log_dir_artifact( + wandb, path=log_dataset_dir, name="dataset", type="dataset" + ) + + def log_step(info: Optional[Dict[str, Any]]): + console_log_step(info) + _log_scores(wandb, info) + _log_model_artifact(wandb, info, run, model_log_interval) + + def finalize() -> None: + if log_best_dir: + _log_dir_artifact( + wandb, + path=log_best_dir, + name="model_best", + type="model", + ) + + if log_latest_dir: + _log_dir_artifact( + wandb, + path=log_latest_dir, + name="model_last", + type="model", + ) + console_finalize() + wandb.join() + + return log_step, finalize + + return setup_logger + + +# entry point: spacy.WandbLogger.v3 +def wandb_logger_v3( + project_name: str, + remove_config_values: List[str] = SimpleFrozenList(), + model_log_interval: Optional[int] = None, + log_dataset_dir: Optional[str] = None, + entity: Optional[str] = None, + run_name: Optional[str] = None, +) -> LoggerT: + """Creates a logger that interoperates with the Weights & Biases framework. + + Args: + project_name (str): + The name of the project in the Weights & Biases interface. The project will be created automatically if it doesn't exist yet. + remove_config_values (List[str]): + A list of values to exclude from the config before it is uploaded to W&B. Defaults to []. + model_log_interval (Optional[int]): + Steps to wait between logging model checkpoints to the W&B dasboard. Defaults to None. + log_dataset_dir (Optional[str]): + Directory containing the dataset to be logged and versioned as a W&B artifact. Defaults to None. + entity (Optional[str]): + An entity is a username or team name where you're sending runs. If you don't specify an entity, the run will be sent to your default entity, which is usually your username. Defaults to None. + run_name (Optional[str]): + The name of the run. If you don't specify a run name, the name will be created by the `wandb` library. Defaults to None. + + Returns: + LoggerT: Logger instance. + """ + wandb = _import_wandb() + + def setup_logger( + nlp: "Language", stdout: IO = sys.stdout, stderr: IO = sys.stderr + ) -> Tuple[Callable[[Dict[str, Any]], None], Callable[[], None]]: + console_log_step, console_finalize = setup_default_console_logger( + nlp, stdout, stderr + ) + run = _setup_wandb( + wandb, + nlp, + project_name, + remove_config_values=remove_config_values, + entity=entity, + ) + if run_name: + wandb.run.name = run_name + + if log_dataset_dir: + _log_dir_artifact( + wandb, path=log_dataset_dir, name="dataset", type="dataset" + ) + + def log_step(info: Optional[Dict[str, Any]]): + console_log_step(info) + _log_scores(wandb, info) + _log_model_artifact(wandb, info, run, model_log_interval) + + def finalize() -> None: + console_finalize() + wandb.join() + + return log_step, finalize + + return setup_logger + + +# entry point: spacy.WandbLogger.v2 +def wandb_logger_v2( + project_name: str, + remove_config_values: List[str] = SimpleFrozenList(), + model_log_interval: Optional[int] = None, + log_dataset_dir: Optional[str] = None, +) -> LoggerT: + """Creates a logger that interoperates with the Weights & Biases framework. + + Args: + project_name (str): + The name of the project in the Weights & Biases interface. The project will be created automatically if it doesn't exist yet. + remove_config_values (List[str]): + A list of values to exclude from the config before it is uploaded to W&B. Defaults to []. + model_log_interval (Optional[int]): + Steps to wait between logging model checkpoints to the W&B dasboard. Defaults to None. + log_dataset_dir (Optional[str]): + Directory containing the dataset to be logged and versioned as a W&B artifact. Defaults to None. + + Returns: + LoggerT: Logger instance. + """ + wandb = _import_wandb() + + def setup_logger( + nlp: "Language", stdout: IO = sys.stdout, stderr: IO = sys.stderr + ) -> Tuple[Callable[[Dict[str, Any]], None], Callable[[], None]]: + console_log_step, console_finalize = setup_default_console_logger( + nlp, stdout, stderr + ) + run = _setup_wandb( + wandb, nlp, project_name, remove_config_values=remove_config_values + ) + + if log_dataset_dir: + _log_dir_artifact( + wandb, path=log_dataset_dir, name="dataset", type="dataset" + ) + + def log_step(info: Optional[Dict[str, Any]]): + console_log_step(info) + _log_scores(wandb, info) + _log_model_artifact(wandb, info, run, model_log_interval) + + def finalize() -> None: + console_finalize() + wandb.join() + + return log_step, finalize + + return setup_logger + + +# entry point: spacy.WandbLogger.v1 +def wandb_logger_v1( + project_name: str, remove_config_values: List[str] = SimpleFrozenList() +) -> LoggerT: + """Creates a logger that interoperates with the Weights & Biases framework. + + Args: + project_name (str): + The name of the project in the Weights & Biases interface. The project will be created automatically if it doesn't exist yet. + remove_config_values (List[str]): + A list of values to exclude from the config before it is uploaded to W&B. Defaults to []. + + Returns: + LoggerT: Logger instance. + """ + wandb = _import_wandb() + + def setup_logger( + nlp: "Language", stdout: IO = sys.stdout, stderr: IO = sys.stderr + ) -> Tuple[Callable[[Dict[str, Any]], None], Callable[[], None]]: + console_log_step, console_finalize = setup_default_console_logger( + nlp, stdout, stderr + ) + _setup_wandb( + wandb, nlp, project_name, remove_config_values=remove_config_values + ) + + def log_step(info: Optional[Dict[str, Any]]): + console_log_step(info) + _log_scores(wandb, info) + + def finalize() -> None: + console_finalize() + wandb.join() + + return log_step, finalize + + return setup_logger + + +def _import_wandb() -> ModuleType: + try: + import wandb + + # test that these are available + from wandb import init, log, join # noqa: F401 + + return wandb + except ImportError: + raise ImportError( + "The 'wandb' library could not be found - did you install it? " + "Alternatively, specify the 'ConsoleLogger' in the " + "'training.logger' config section, instead of the 'WandbLogger'." + ) + + +def _setup_wandb( + wandb: ModuleType, + nlp: "Language", + project: str, + entity: Optional[str] = None, + remove_config_values: List[str] = SimpleFrozenList(), +) -> Any: + config = nlp.config.interpolate() + config_dot = dict_to_dot(config) + for field in remove_config_values: + del config_dot[field] + config = dot_to_dict(config_dot) + run = wandb.init(project=project, config=config, entity=entity, reinit=True) + return run + + +def _log_scores(wandb: ModuleType, info: Optional[Dict[str, Any]]): + if info is not None: + score = info["score"] + other_scores = info["other_scores"] + losses = info["losses"] + wandb.log({"score": score}) + if losses: + wandb.log({f"loss_{k}": v for k, v in losses.items()}) + if isinstance(other_scores, dict): + wandb.log(other_scores) + + +def _log_model_artifact( + wandb: ModuleType, + info: Optional[Dict[str, Any]], + run: Any, + model_log_interval: Optional[int] = None, +): + if info is not None: + if model_log_interval and info.get("output_path"): + if info["step"] % model_log_interval == 0 and info["step"] != 0: + _log_dir_artifact( + wandb, + path=info["output_path"], + name="pipeline_" + run.id, + type="checkpoint", + metadata=info, + aliases=[ + f"epoch {info['epoch']} step {info['step']}", + "latest", + "best" if info["score"] == max(info["checkpoints"])[0] else "", + ], + ) + + +def _log_dir_artifact( + wandb: ModuleType, + path: str, + name: str, + type: str, + metadata: Optional[Dict[str, Any]] = None, + aliases: Optional[List[str]] = None, +): + dataset_artifact = wandb.Artifact(name, type=type, metadata=metadata) + dataset_artifact.add_dir(path, name=name) + wandb.log_artifact(dataset_artifact, aliases=aliases) + + +def _log_custom_stats( + wandb: ModuleType, info: Optional[Dict[str, Any]], matcher: Callable[[str], bool] +): + if info is not None: + for k, v in info.items(): + if matcher(k): + wandb.log({k: v}) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..54d5b85779f5666240b8bef3b416a2d2bf57b74b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/METADATA @@ -0,0 +1,473 @@ +Metadata-Version: 2.4 +Name: srsly +Version: 2.5.2 +Summary: Modern high-performance serialization utilities for Python +Home-page: https://github.com/explosion/srsly +Author: Explosion +Author-email: contact@explosion.ai +License: MIT +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: Cython +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Topic :: Scientific/Engineering +Requires-Python: <3.15,>=3.9 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: catalogue<2.1.0,>=2.0.3 +Dynamic: license-file + + + +# srsly: Modern high-performance serialization utilities for Python + +This package bundles some of the best Python serialization libraries into one +standalone package, with a high-level API that makes it easy to write code +that's correct across platforms and Pythons. This allows us to provide all the +serialization utilities we need in a single binary wheel. Currently supports +**JSON**, **JSONL**, **MessagePack**, **Pickle** and **YAML**. + +[![tests](https://github.com/explosion/srsly/actions/workflows/tests.yml/badge.svg)](https://github.com/explosion/srsly/actions/workflows/tests.yml) +[![PyPi](https://img.shields.io/pypi/v/srsly.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.python.org/pypi/srsly) +[![conda](https://img.shields.io/conda/vn/conda-forge/srsly.svg?style=flat-square&logo=conda-forge&logoColor=white)](https://anaconda.org/conda-forge/srsly) +[![GitHub](https://img.shields.io/github/release/explosion/srsly/all.svg?style=flat-square&logo=github)](https://github.com/explosion/srsly) +[![Python wheels](https://img.shields.io/badge/wheels-%E2%9C%93-4c1.svg?longCache=true&style=flat-square&logo=python&logoColor=white)](https://github.com/explosion/wheelwright/releases) + +## Motivation + +Serialization is hard, especially across Python versions and multiple platforms. +After dealing with many subtle bugs over the years (encodings, locales, large +files) our libraries like [spaCy](https://github.com/explosion/spaCy) and +[Prodigy](https://prodi.gy) had steadily grown a number of utility functions to +wrap the multiple serialization formats we need to support (especially `json`, +`msgpack` and `pickle`). These wrapping functions ended up duplicated across our +codebases, so we wanted to put them in one place. + +At the same time, we noticed that having a lot of small dependencies was making +maintenance harder, and making installation slower. To solve this, we've made +`srsly` standalone, by including the component packages directly within it. This +way we can provide all the serialization utilities we need in a single binary +wheel. + +`srsly` currently includes forks of the following packages: + +- [`ujson`](https://github.com/esnme/ultrajson) +- [`msgpack`](https://github.com/msgpack/msgpack-python) +- [`msgpack-numpy`](https://github.com/lebedov/msgpack-numpy) +- [`cloudpickle`](https://github.com/cloudpipe/cloudpickle) +- [`ruamel.yaml`](https://github.com/pycontribs/ruamel-yaml) (without unsafe + implementations!) + +## Installation + +> ⚠️ Note that `v2.x` is only compatible with **Python 3.6+**. For 2.7+ +> compatibility, use `v1.x`. + +`srsly` can be installed from pip. Before installing, make sure that your `pip`, +`setuptools` and `wheel` are up to date. + +```bash +python -m pip install -U pip setuptools wheel +python -m pip install srsly +``` + +Or from conda via conda-forge: + +```bash +conda install -c conda-forge srsly +``` + +Alternatively, you can also compile the library from source. You'll need to make +sure that you have a development environment with a Python distribution +including header files, a compiler (XCode command-line tools on macOS / OS X or +Visual C++ build tools on Windows), pip and git installed. + +Install from source: + +```bash +# clone the repo +git clone https://github.com/explosion/srsly +cd srsly + +# create a virtual environment +python -m venv .env +source .env/bin/activate + +# update pip +python -m pip install -U pip setuptools wheel + +# compile and install from source +python -m pip install . +``` + +For developers, install requirements separately and then install in editable +mode without build isolation: + +```bash +# install in editable mode +python -m pip install -r requirements.txt +python -m pip install --no-build-isolation --editable . + +# run test suite +python -m pytest --pyargs srsly +``` + +## API + +### JSON + +> 📦 The underlying module is exposed via `srsly.ujson`. However, we normally +> interact with it via the utility functions only. + +#### function `srsly.json_dumps` + +Serialize an object to a JSON string. Falls back to `json` if `sort_keys=True` +is used (until it's fixed in `ujson`). + +```python +data = {"foo": "bar", "baz": 123} +json_string = srsly.json_dumps(data) +``` + +| Argument | Type | Description | +| ----------- | ---- | ------------------------------------------------------ | +| `data` | - | The JSON-serializable data to output. | +| `indent` | int | Number of spaces used to indent JSON. Defaults to `0`. | +| `sort_keys` | bool | Sort dictionary keys. Defaults to `False`. | +| **RETURNS** | str | The serialized string. | + +#### function `srsly.json_loads` + +Deserialize unicode or bytes to a Python object. + +```python +data = '{"foo": "bar", "baz": 123}' +obj = srsly.json_loads(data) +``` + +| Argument | Type | Description | +| ----------- | ----------- | ------------------------------- | +| `data` | str / bytes | The data to deserialize. | +| **RETURNS** | - | The deserialized Python object. | + +#### function `srsly.write_json` + +Create a JSON file and dump contents or write to standard output. + +```python +data = {"foo": "bar", "baz": 123} +srsly.write_json("/path/to/file.json", data) +``` + +| Argument | Type | Description | +| -------- | ------------ | ------------------------------------------------------ | +| `path` | str / `Path` | The file path or `"-"` to write to stdout. | +| `data` | - | The JSON-serializable data to output. | +| `indent` | int | Number of spaces used to indent JSON. Defaults to `2`. | + +#### function `srsly.read_json` + +Load JSON from a file or standard input. + +```python +data = srsly.read_json("/path/to/file.json") +``` + +| Argument | Type | Description | +| ----------- | ------------ | ------------------------------------------ | +| `path` | str / `Path` | The file path or `"-"` to read from stdin. | +| **RETURNS** | dict / list | The loaded JSON content. | + +#### function `srsly.write_gzip_json` + +Create a gzipped JSON file and dump contents. + +```python +data = {"foo": "bar", "baz": 123} +srsly.write_gzip_json("/path/to/file.json.gz", data) +``` + +| Argument | Type | Description | +| -------- | ------------ | ------------------------------------------------------ | +| `path` | str / `Path` | The file path. | +| `data` | - | The JSON-serializable data to output. | +| `indent` | int | Number of spaces used to indent JSON. Defaults to `2`. | + +#### function `srsly.write_gzip_jsonl` + +Create a gzipped JSONL file and dump contents. + +```python +data = [{"foo": "bar"}, {"baz": 123}] +srsly.write_gzip_json("/path/to/file.jsonl.gz", data) +``` + +| Argument | Type | Description | +| ----------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `path` | str / `Path` | The file path. | +| `lines` | - | The JSON-serializable contents of each line. | +| `append` | bool | Whether or not to append to the location. Appending to .gz files is generally not recommended, as it doesn't allow the algorithm to take advantage of all data when compressing - files may hence be poorly compressed. | +| `append_new_line` | bool | Whether or not to write a new line before appending to the file. | + +#### function `srsly.read_gzip_json` + +Load gzipped JSON from a file. + +```python +data = srsly.read_gzip_json("/path/to/file.json.gz") +``` + +| Argument | Type | Description | +| ----------- | ------------ | ------------------------ | +| `path` | str / `Path` | The file path. | +| **RETURNS** | dict / list | The loaded JSON content. | + +#### function `srsly.read_gzip_jsonl` + +Load gzipped JSONL from a file. + +```python +data = srsly.read_gzip_jsonl("/path/to/file.jsonl.gz") +``` + +| Argument | Type | Description | +| ----------- | ------------ | ------------------------- | +| `path` | str / `Path` | The file path. | +| **RETURNS** | dict / list | The loaded JSONL content. | + +#### function `srsly.write_jsonl` + +Create a JSONL file (newline-delimited JSON) and dump contents line by line, or +write to standard output. + +```python +data = [{"foo": "bar"}, {"baz": 123}] +srsly.write_jsonl("/path/to/file.jsonl", data) +``` + +| Argument | Type | Description | +| ----------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------- | +| `path` | str / `Path` | The file path or `"-"` to write to stdout. | +| `lines` | iterable | The JSON-serializable lines. | +| `append` | bool | Append to an existing file. Will open it in `"a"` mode and insert a newline before writing lines. Defaults to `False`. | +| `append_new_line` | bool | Defines whether a new line should first be written when appending to an existing file. Defaults to `True`. | + +#### function `srsly.read_jsonl` + +Read a JSONL file (newline-delimited JSON) or from JSONL data from standard +input and yield contents line by line. Blank lines will always be skipped. + +```python +data = srsly.read_jsonl("/path/to/file.jsonl") +``` + +| Argument | Type | Description | +| ---------- | ---------- | -------------------------------------------------------------------- | +| `path` | str / Path | The file path or `"-"` to read from stdin. | +| `skip` | bool | Skip broken lines and don't raise `ValueError`. Defaults to `False`. | +| **YIELDS** | - | The loaded JSON contents of each line. | + +#### function `srsly.is_json_serializable` + +Check if a Python object is JSON-serializable. + +```python +assert srsly.is_json_serializable({"hello": "world"}) is True +assert srsly.is_json_serializable(lambda x: x) is False +``` + +| Argument | Type | Description | +| ----------- | ---- | ---------------------------------------- | +| `obj` | - | The object to check. | +| **RETURNS** | bool | Whether the object is JSON-serializable. | + +### msgpack + +> 📦 The underlying module is exposed via `srsly.msgpack`. However, we normally +> interact with it via the utility functions only. + +#### function `srsly.msgpack_dumps` + +Serialize an object to a msgpack byte string. + +```python +data = {"foo": "bar", "baz": 123} +msg = srsly.msgpack_dumps(data) +``` + +| Argument | Type | Description | +| ----------- | ----- | ---------------------- | +| `data` | - | The data to serialize. | +| **RETURNS** | bytes | The serialized bytes. | + +#### function `srsly.msgpack_loads` + +Deserialize msgpack bytes to a Python object. + +```python +msg = b"\x82\xa3foo\xa3bar\xa3baz{" +data = srsly.msgpack_loads(msg) +``` + +| Argument | Type | Description | +| ----------- | ----- | --------------------------------------------------------------------------------------- | +| `data` | bytes | The data to deserialize. | +| `use_list` | bool | Don't use tuples instead of lists. Can make deserialization slower. Defaults to `True`. | +| **RETURNS** | - | The deserialized Python object. | + +#### function `srsly.write_msgpack` + +Create a msgpack file and dump contents. + +```python +data = {"foo": "bar", "baz": 123} +srsly.write_msgpack("/path/to/file.msg", data) +``` + +| Argument | Type | Description | +| -------- | ------------ | ---------------------- | +| `path` | str / `Path` | The file path. | +| `data` | - | The data to serialize. | + +#### function `srsly.read_msgpack` + +Load a msgpack file. + +```python +data = srsly.read_msgpack("/path/to/file.msg") +``` + +| Argument | Type | Description | +| ----------- | ------------ | --------------------------------------------------------------------------------------- | +| `path` | str / `Path` | The file path. | +| `use_list` | bool | Don't use tuples instead of lists. Can make deserialization slower. Defaults to `True`. | +| **RETURNS** | - | The loaded and deserialized content. | + +### pickle + +> 📦 The underlying module is exposed via `srsly.cloudpickle`. However, we +> normally interact with it via the utility functions only. + +#### function `srsly.pickle_dumps` + +Serialize a Python object with pickle. + +```python +data = {"foo": "bar", "baz": 123} +pickled_data = srsly.pickle_dumps(data) +``` + +| Argument | Type | Description | +| ----------- | ----- | ------------------------------------------------------ | +| `data` | - | The object to serialize. | +| `protocol` | int | Protocol to use. `-1` for highest. Defaults to `None`. | +| **RETURNS** | bytes | The serialized object. | + +#### function `srsly.pickle_loads` + +Deserialize bytes with pickle. + +```python +pickled_data = b"\x80\x04\x95\x19\x00\x00\x00\x00\x00\x00\x00}\x94(\x8c\x03foo\x94\x8c\x03bar\x94\x8c\x03baz\x94K{u." +data = srsly.pickle_loads(pickled_data) +``` + +| Argument | Type | Description | +| ----------- | ----- | ------------------------------- | +| `data` | bytes | The data to deserialize. | +| **RETURNS** | - | The deserialized Python object. | + +### YAML + +> 📦 The underlying module is exposed via `srsly.ruamel_yaml`. However, we +> normally interact with it via the utility functions only. + +#### function `srsly.yaml_dumps` + +Serialize an object to a YAML string. See the +[`ruamel.yaml` docs](https://yaml.readthedocs.io/en/latest/detail.html?highlight=indentation#indentation-of-block-sequences) +for details on the indentation format. + +```python +data = {"foo": "bar", "baz": 123} +yaml_string = srsly.yaml_dumps(data) +``` + +| Argument | Type | Description | +| ----------------- | ---- | ------------------------------------------ | +| `data` | - | The JSON-serializable data to output. | +| `indent_mapping` | int | Mapping indentation. Defaults to `2`. | +| `indent_sequence` | int | Sequence indentation. Defaults to `4`. | +| `indent_offset` | int | Indentation offset. Defaults to `2`. | +| `sort_keys` | bool | Sort dictionary keys. Defaults to `False`. | +| **RETURNS** | str | The serialized string. | + +#### function `srsly.yaml_loads` + +Deserialize unicode or a file object to a Python object. + +```python +data = 'foo: bar\nbaz: 123' +obj = srsly.yaml_loads(data) +``` + +| Argument | Type | Description | +| ----------- | ---------- | ------------------------------- | +| `data` | str / file | The data to deserialize. | +| **RETURNS** | - | The deserialized Python object. | + +#### function `srsly.write_yaml` + +Create a YAML file and dump contents or write to standard output. + +```python +data = {"foo": "bar", "baz": 123} +srsly.write_yaml("/path/to/file.yml", data) +``` + +| Argument | Type | Description | +| ----------------- | ------------ | ------------------------------------------ | +| `path` | str / `Path` | The file path or `"-"` to write to stdout. | +| `data` | - | The JSON-serializable data to output. | +| `indent_mapping` | int | Mapping indentation. Defaults to `2`. | +| `indent_sequence` | int | Sequence indentation. Defaults to `4`. | +| `indent_offset` | int | Indentation offset. Defaults to `2`. | +| `sort_keys` | bool | Sort dictionary keys. Defaults to `False`. | + +#### function `srsly.read_yaml` + +Load YAML from a file or standard input. + +```python +data = srsly.read_yaml("/path/to/file.yml") +``` + +| Argument | Type | Description | +| ----------- | ------------ | ------------------------------------------ | +| `path` | str / `Path` | The file path or `"-"` to read from stdin. | +| **RETURNS** | dict / list | The loaded YAML content. | + +#### function `srsly.is_yaml_serializable` + +Check if a Python object is YAML-serializable. + +```python +assert srsly.is_yaml_serializable({"hello": "world"}) is True +assert srsly.is_yaml_serializable(lambda x: x) is False +``` + +| Argument | Type | Description | +| ----------- | ---- | ---------------------------------------- | +| `obj` | - | The object to check. | +| **RETURNS** | bool | Whether the object is YAML-serializable. | diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..c2676fcbcc13432cad127584913e7a8aec58e08c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/RECORD @@ -0,0 +1,260 @@ +srsly-2.5.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +srsly-2.5.2.dist-info/METADATA,sha256=dDpexgUjsKS0pt3PQT9OO3p7DbBG3kCGZ4MoUa5usKk,20453 +srsly-2.5.2.dist-info/RECORD,, +srsly-2.5.2.dist-info/WHEEL,sha256=8UP9x9puWI0P1V_d7K2oMTBqfeLNm21CTzZ_Ptr0NXU,101 +srsly-2.5.2.dist-info/entry_points.txt,sha256=egiO6704NBZxNhIz96v_ihXL0C3wRZztCqfc3MN4Vyc,172 +srsly-2.5.2.dist-info/licenses/LICENSE,sha256=ZZcK0dqoBpatmN-xuhFrwuY-dSnSB8JhkY1X5fsQx00,1124 +srsly-2.5.2.dist-info/top_level.txt,sha256=TXhaztKWFjuGKlTFNJcSwDQkYN0ELHqohBa9ArpK0uI,6 +srsly-2.5.2.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2 +srsly/__init__.py,sha256=9JqL2C7UGi-92-gqC3eTw0mMtfuEQTBawRDp3_gxtzw,601 +srsly/__pycache__/__init__.cpython-312.pyc,, +srsly/__pycache__/_json_api.cpython-312.pyc,, +srsly/__pycache__/_msgpack_api.cpython-312.pyc,, +srsly/__pycache__/_pickle_api.cpython-312.pyc,, +srsly/__pycache__/_yaml_api.cpython-312.pyc,, +srsly/__pycache__/about.cpython-312.pyc,, +srsly/__pycache__/util.cpython-312.pyc,, +srsly/_json_api.py,sha256=j4HZcnFVSreC-rJ4wE5qfdo3fEaoT2lcAWLowefS6MM,7277 +srsly/_msgpack_api.py,sha256=h3PEKIPWUx_V9HYqTu6dAGMeTIJTX7BrpkmZiQZcYhA,1912 +srsly/_pickle_api.py,sha256=Yy9jGc_NvWrgTh38AXjN4nW-yBctewSfLsO6wsPscj8,654 +srsly/_yaml_api.py,sha256=iRV-nm87LybFfewsi4EV7vH8EzFrAn3qFrGtGUNCm0w,3895 +srsly/about.py,sha256=ZZFd6MuVtf8Qpl2buyNnE2KsFmZ3kf4DrFuN7l3UcaY,23 +srsly/cloudpickle/__init__.py,sha256=P-xU91HomozKxBWUuK1ICt7z09k-IIyAzJ3S-sgS55s,300 +srsly/cloudpickle/__pycache__/__init__.cpython-312.pyc,, +srsly/cloudpickle/__pycache__/cloudpickle.cpython-312.pyc,, +srsly/cloudpickle/__pycache__/cloudpickle_fast.cpython-312.pyc,, +srsly/cloudpickle/__pycache__/compat.cpython-312.pyc,, +srsly/cloudpickle/cloudpickle.py,sha256=AfAy7dgXBxZPudB-xD4VV_c-1JyB1InE53t6CD4qH6Q,36085 +srsly/cloudpickle/cloudpickle_fast.py,sha256=e1rgxEMqM0V5BCo8aWILWNtnTgP1tLZEJPtiwzWeXYU,34958 +srsly/cloudpickle/compat.py,sha256=ut_Yn6I_JHym5jINfGHbT8F-kyxSPy-yPfjRIuhVRok,526 +srsly/msgpack/__init__.py,sha256=_iort-8c8f7j9wMmB-uC4mKc6uPxHp9UNDXr9f7BJbM,2865 +srsly/msgpack/__pycache__/__init__.cpython-312.pyc,, +srsly/msgpack/__pycache__/_msgpack_numpy.cpython-312.pyc,, +srsly/msgpack/__pycache__/_version.cpython-312.pyc,, +srsly/msgpack/__pycache__/exceptions.cpython-312.pyc,, +srsly/msgpack/__pycache__/ext.cpython-312.pyc,, +srsly/msgpack/__pycache__/fallback.cpython-312.pyc,, +srsly/msgpack/__pycache__/util.cpython-312.pyc,, +srsly/msgpack/_epoch.cp312-win_amd64.pyd,sha256=KO9Sh5erdBokmWk9cCcJB1Nav_i_W45DV__7aO6Xll0,21504 +srsly/msgpack/_epoch.cpp,sha256=dUc1VkViCJg8VGEM8lwCLxp1QZjQwtskrYXyRyAWkS0,285493 +srsly/msgpack/_epoch.pyx,sha256=hzG1rDEYFmnz2ZrT6ZXnqNHNMMcokxdqglgCm8e8Iks,184 +srsly/msgpack/_msgpack_numpy.py,sha256=sNhgQS3d01huq5mFRwxZ3jmXB2jgEUFPg3WREbCU4c0,2811 +srsly/msgpack/_packer.cp312-win_amd64.pyd,sha256=MY3iOOR3s01bZFyA6c_ytMEUAgHToBgGhUijF5aWIjE,82944 +srsly/msgpack/_packer.cpp,sha256=6hWEIjZukCNHlEepx2dLxBpcVRhNetXcgAiwB9DleV4,786624 +srsly/msgpack/_packer.pyx,sha256=-5pTw2uGmNAb0LT_pDftmUo4U_tGXVsI9-XHFNtJ4K0,14445 +srsly/msgpack/_unpacker.cp312-win_amd64.pyd,sha256=k974SWbRtKeEBvFtv0Y9PlriI1ryvtfnd9XBqgZWirI,87040 +srsly/msgpack/_unpacker.cpp,sha256=dvAyqmPLAGMV0j0Xn6Kp-h6HSDunHhkY2dQAgWoWdkg,681076 +srsly/msgpack/_unpacker.pyx,sha256=2xLGSRxZiU6ZGF9XFx0EtE2kxzXB5VTaLperFneH6wc,19874 +srsly/msgpack/_version.py,sha256=lkms9NUM8OlOc1m2y1K9wf8i9uNi-1C8z4F46ECH1Ms,21 +srsly/msgpack/exceptions.py,sha256=2fCtczricqQgdT3NtW6cTqmZn3WA7GQtmlPuT-NhLyM,1129 +srsly/msgpack/ext.py,sha256=9gDKxuEHfYWdPRzcpFwFYyuBx0puprlQflDGOaccRhE,5896 +srsly/msgpack/fallback.py,sha256=EAP6g9N7tTWvTw01RtnXXdYg-zZn21FcGVfdBid8aUg,33319 +srsly/msgpack/pack.h,sha256=Cewhw4Ek9xjpcxYYgIZixxmdxhxLJoIxBoLmZyLqvmE,1722 +srsly/msgpack/pack_template.h,sha256=NPDGJ9tFshXvtBAZejNlBZrOFaBjlkbNPY4J7VYmpxA,17358 +srsly/msgpack/sysdep.h,sha256=PQ3mPo9B62qQ5vz4ZbI_EJE3CyEtZ2JOSVbY1m5lfa0,6646 +srsly/msgpack/unpack.h,sha256=sSFrHWBjjV8LinxQ3r5j3zNJIHzTQjdEnuhZCf-vpxA,11498 +srsly/msgpack/unpack_container_header.h,sha256=S_Gy_qFoSyrmg3YCagKFlsU7Xvq81MXsXhF13ke2cRc,1430 +srsly/msgpack/unpack_define.h,sha256=sGTxg6GGJL21VJt3s6Z6G9zimWoyJxuxklRREuRkmQs,2461 +srsly/msgpack/unpack_template.h,sha256=dMId32NdMsZKD1XLOABTQxGHs8x0oasuC2NpXouJsfg,14145 +srsly/msgpack/util.py,sha256=M73k-er39eMTm4yktv67_de2LPubcT5f8M8DvcJwtXY,315 +srsly/ruamel_yaml/__init__.py,sha256=42urq6YT1s43lm4tDXEWCDvl2A8UhYjrACOuJsq-0CI,110 +srsly/ruamel_yaml/__pycache__/__init__.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/anchor.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/comments.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/compat.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/composer.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/configobjwalker.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/constructor.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/cyaml.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/dumper.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/emitter.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/error.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/events.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/loader.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/main.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/nodes.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/parser.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/reader.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/representer.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/resolver.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/scalarbool.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/scalarfloat.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/scalarint.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/scalarstring.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/scanner.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/serializer.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/timestamp.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/tokens.cpython-312.pyc,, +srsly/ruamel_yaml/__pycache__/util.cpython-312.pyc,, +srsly/ruamel_yaml/anchor.py,sha256=jb4RdDHoMMN0OO7F8qIyfVbrIAgXXgV6oaMZfMXJ2LI,521 +srsly/ruamel_yaml/comments.py,sha256=xN69PnKp3BnGqk3zq8JyBPHrWF00FRxaiOizYZMXoTI,36159 +srsly/ruamel_yaml/compat.py,sha256=PUYjXGX44TXlDlE6pUYr6ycrthMD2pugDtiLGnBrcCc,8922 +srsly/ruamel_yaml/composer.py,sha256=5Ld4ciLm0sYAza3jDfYdZlZrxdAcs7Y8gp5fMb3i1IY,8598 +srsly/ruamel_yaml/configobjwalker.py,sha256=o6nwvfoZE-eJCiP3J6X8LYl6Zsf0cyeRUP-CcCscVW8,367 +srsly/ruamel_yaml/constructor.py,sha256=xpFZFNtt3lm84XOvCDU0_Abyz1Tb6SgfmM_b6lbm-zQ,66508 +srsly/ruamel_yaml/cyaml.py,sha256=T41I8cT6d_58fcloB7mBwIhG4WYBVLoeImtzeIgQ4C8,6759 +srsly/ruamel_yaml/dumper.py,sha256=gVOGS5ir45bcpzb8tRz07tRaMmoGlyyRYCnuT_2mY_s,6791 +srsly/ruamel_yaml/emitter.py,sha256=wQHpS74hYwRgQ_o37C7Pd7RDutpsNSeJx6e2cXDrnag,66403 +srsly/ruamel_yaml/error.py,sha256=y9oyBYFwAO6CRNQbVmKrW701eJpn9JNrH69iaggWg_A,9425 +srsly/ruamel_yaml/events.py,sha256=5iz0imuEq2pYtaNs7GeLpWyyKYJGvmWtlV1yXBPj3us,4059 +srsly/ruamel_yaml/loader.py,sha256=dd64u5k4GnMhuaVZ3LbVxXzgO9qZQJ_c-sxFjyq2ezI,2667 +srsly/ruamel_yaml/main.py,sha256=rE0timJkMTbsJyIdc63eV9lToC6i3yy2nKeRJZQ4BuI,55507 +srsly/ruamel_yaml/nodes.py,sha256=n0-Hb7j5k87Y0gqZLa7_XTrO-Hpz1Ichhjcvqbke4a0,3847 +srsly/ruamel_yaml/parser.py,sha256=_W_Gj2Pa-RTZNRyH6pXPdkdFVPKsvZXsHCXU0aCsQ1A,34662 +srsly/ruamel_yaml/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +srsly/ruamel_yaml/reader.py,sha256=rMBjA93eT4gc2LWO4YPHxOu3seyVEAjqj3Kd4db0wdg,11504 +srsly/ruamel_yaml/representer.py,sha256=JWWpA9czub1CWDpQzCMB1tVPs5htGNUgOlOfgAgRwRA,50523 +srsly/ruamel_yaml/resolver.py,sha256=XqiST4-SAioPfhoJUjj-VAaF0dvJAfd_cMGjDk6IpX4,15866 +srsly/ruamel_yaml/scalarbool.py,sha256=ac-lfrFaCYHgHuWmjNkviEpDjwMkHXpyd4ImAaEISPw,1571 +srsly/ruamel_yaml/scalarfloat.py,sha256=N8T-YmZNZfZ_OMh4QxBA8Uevvyj_qndHrON_ihM-Oj0,4652 +srsly/ruamel_yaml/scalarint.py,sha256=6yf2Y9PkukPIeJeFbu0CIfwOOZJxfcd-HRk1gTy37jc,4831 +srsly/ruamel_yaml/scalarstring.py,sha256=2SgvhpgvOmLc-dbOoQVz3M929g9L-W5syhjAHgS0fiw,4619 +srsly/ruamel_yaml/scanner.py,sha256=1_IDdi1ZtvXqhj2uvoJg3VioEbL95LqxiS5-lamxTNY,74769 +srsly/ruamel_yaml/serializer.py,sha256=laLqBZwMkd8ijB27026y24bZ7y6wY4DR41X6EgXe2Sg,8781 +srsly/ruamel_yaml/timestamp.py,sha256=vIOkoYETSc0EKN0W6o88Cvb8eRrdiPOBxB22-6umyi0,967 +srsly/ruamel_yaml/tokens.py,sha256=4wpSlAtCll8OcRGpupYCun4LNZWwopw-uqDr5IyqGyo,7757 +srsly/ruamel_yaml/util.py,sha256=VF8PtgHYWAXjkGDvPJrtZJlgYvf6nX0Cm-qQo2n4-0g,6288 +srsly/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +srsly/tests/__pycache__/__init__.cpython-312.pyc,, +srsly/tests/__pycache__/test_json_api.cpython-312.pyc,, +srsly/tests/__pycache__/test_msgpack_api.cpython-312.pyc,, +srsly/tests/__pycache__/test_pickle_api.cpython-312.pyc,, +srsly/tests/__pycache__/test_yaml_api.cpython-312.pyc,, +srsly/tests/__pycache__/util.cpython-312.pyc,, +srsly/tests/cloudpickle/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +srsly/tests/cloudpickle/__pycache__/__init__.cpython-312.pyc,, +srsly/tests/cloudpickle/__pycache__/cloudpickle_file_test.cpython-312.pyc,, +srsly/tests/cloudpickle/__pycache__/cloudpickle_test.cpython-312.pyc,, +srsly/tests/cloudpickle/__pycache__/testutils.cpython-312.pyc,, +srsly/tests/cloudpickle/cloudpickle_file_test.py,sha256=hYZI1hlBTWI2pf8ZZxcHXri7levMmWvsoE_osVyfj_Q,3336 +srsly/tests/cloudpickle/cloudpickle_test.py,sha256=2gJ7vJEsMhoq0FitzzF9dDQCKNnAeleYXcDYnlwkC8o,109142 +srsly/tests/cloudpickle/testutils.py,sha256=v6b4N9vuHqVWNlrBZcaSisLoAqjcUk1STtEuEQK3LZ4,7683 +srsly/tests/msgpack/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +srsly/tests/msgpack/__pycache__/__init__.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_buffer.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_case.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_except.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_extension.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_format.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_limits.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_memoryview.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_newspec.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_numpy.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_pack.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_read_size.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_seq.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_sequnpack.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_stricttype.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_subtype.cpython-312.pyc,, +srsly/tests/msgpack/__pycache__/test_unpack.cpython-312.pyc,, +srsly/tests/msgpack/test_buffer.py,sha256=Z1PUe6qSdtU4ANfMHjM3gnLtTLmKtdDmc02mARUlDNw,736 +srsly/tests/msgpack/test_case.py,sha256=EXzVUpe7at-I1oSYPURSbn3rB75HTBeZEfQuSneML1U,2981 +srsly/tests/msgpack/test_except.py,sha256=sAFnkJ1U7-PNSo8uol8VKZMI8IDh15QMHrA4oUen_Ks,1741 +srsly/tests/msgpack/test_extension.py,sha256=digCkCgvWnKYpj8s_4vaz_YRD8JXZQhKYgbKEDlmpTU,2645 +srsly/tests/msgpack/test_format.py,sha256=GxF67uknCC6wQSHcOl2wKsf-2kH3ECI6bbZIB4LUhnU,2134 +srsly/tests/msgpack/test_limits.py,sha256=3xt7IrUUkiOgx82qECikq8sidMIoqexRBLi7kOmta-s,3252 +srsly/tests/msgpack/test_memoryview.py,sha256=C2HALeI7qVi9-1_eywEhQ-0VA9hsdRMICDcRgEPYwE0,2676 +srsly/tests/msgpack/test_newspec.py,sha256=8mRznnP99hOwCQ2lzWEaGeHxc-7162WmWRJH6Pt873c,2692 +srsly/tests/msgpack/test_numpy.py,sha256=2PmTrdUdsY9lCpKgJSKydfzb1MfHpbUpxRhyGaTjobw,8843 +srsly/tests/msgpack/test_pack.py,sha256=bfBEL2IxivpQe8Ckaf1D4nR2vnSFJCBjNraQlsrFq6w,5272 +srsly/tests/msgpack/test_read_size.py,sha256=FqCMLjcpxt3O32cu4UNu-ynPsYbyly1EAlu-NQ3DZ0o,1871 +srsly/tests/msgpack/test_seq.py,sha256=2IBUdneVuf1uZBHSc3futGO-IQX-b0fHv9xZVlRESKc,1164 +srsly/tests/msgpack/test_sequnpack.py,sha256=wfUiMlE3B0muKLWP6pjfD3-Hk-OIWYlV64O-NLO14Aw,3760 +srsly/tests/msgpack/test_stricttype.py,sha256=6I2yEBGGMaNXPN9rI2yn6Mlfn6MGk7snCpguHzBxkdc,1841 +srsly/tests/msgpack/test_subtype.py,sha256=N8KI4H4GkLaXD9RSvgErfxGY94BPdaNrvOhSdYmD7qk,398 +srsly/tests/msgpack/test_unpack.py,sha256=zqQuypxnP3f_umg_IyCRZanJiUIbcbDbexjhtS9wR4Q,1890 +srsly/tests/ruamel_yaml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +srsly/tests/ruamel_yaml/__pycache__/__init__.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/roundtrip.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_a_dedent.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_add_xxx.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_anchor.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_api_change.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_appliance.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_class_register.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_collections.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_comment_manipulation.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_comments.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_contextmanager.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_copy.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_datetime.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_deprecation.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_documents.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_fail.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_float.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_flowsequencekey.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_indentation.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_int.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_issues.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_json_numbers.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_line_col.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_literal.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_none.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_numpy.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_program_config.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_spec_examples.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_string.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_tag.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_version.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_yamlfile.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_yamlobject.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_z_check_debug_leftovers.cpython-312.pyc,, +srsly/tests/ruamel_yaml/__pycache__/test_z_data.cpython-312.pyc,, +srsly/tests/ruamel_yaml/roundtrip.py,sha256=uiY2LiqlWE7TW9UDrjdM9QLMOJJFHWbiaJ9FP2eudRI,9798 +srsly/tests/ruamel_yaml/test_a_dedent.py,sha256=JT_VJGaiqtpncUx3Yz7bqsp3z4zEtJr8gW4KQmsjdds,1180 +srsly/tests/ruamel_yaml/test_add_xxx.py,sha256=onbDR6Y9Q8NFAItZ63z-0u2XyTOSKfe3H5uT0LtlSG0,5531 +srsly/tests/ruamel_yaml/test_anchor.py,sha256=2ZrV4fwWfNuY3N3C1H63g2-nnr6gXCAjnEgisXDmOho,15003 +srsly/tests/ruamel_yaml/test_api_change.py,sha256=4gH2gIvGm32TLQFDrZywwlvOljItjoy0X4S-S5o0Czo,7325 +srsly/tests/ruamel_yaml/test_appliance.py,sha256=_n20VUX0dB_BsKU7a44Kas4bgSVWPcm6OW2QT8VnYqY,7900 +srsly/tests/ruamel_yaml/test_class_register.py,sha256=yxfiqxOeqIPIGia0fIUifJLIFOsk0S-MHIv3t6LFR0I,3481 +srsly/tests/ruamel_yaml/test_collections.py,sha256=drWTPQDkhhEp2rlGVhxP3ioddg9Qyrf9t0ZovwGXCNQ,529 +srsly/tests/ruamel_yaml/test_comment_manipulation.py,sha256=fzhtQ_nIyuucFQ9aJVboKSXh-R_bdJsOyucPmAIFfQM,15482 +srsly/tests/ruamel_yaml/test_comments.py,sha256=wFYYFHpIRZ1HioYoyqPq1tGFiVLwCefo345tRrdfoPg,21521 +srsly/tests/ruamel_yaml/test_contextmanager.py,sha256=HCnt9kiwhQHsP8rMuBPMQSEq8L1ubIqzeRRmwDSi7oY,2922 +srsly/tests/ruamel_yaml/test_copy.py,sha256=q3ApnMn_KKk1m4p0sJ6cGqJj2fQexn1mwaLjLpnPXwo,3786 +srsly/tests/ruamel_yaml/test_datetime.py,sha256=BYb23WYx6YSiPycJYWIiM2YhdPC80CdKH7v8CADI4Kc,3944 +srsly/tests/ruamel_yaml/test_deprecation.py,sha256=CBe2B9CWOo5KVpLNempJWJ5hkiVSvs1VmQ9NicYo3KU,366 +srsly/tests/ruamel_yaml/test_documents.py,sha256=XXnJvw61HZkKv6b4Ie8ReTBHhoM_Whjn-4LZ1QPfMlU,1906 +srsly/tests/ruamel_yaml/test_fail.py,sha256=RfS2Zok9oyzPK2Z7sTcT_zthCp-gWkAY-05MGsOjt9M,6545 +srsly/tests/ruamel_yaml/test_float.py,sha256=UKX3Qr7_H1yKG7O-vumL7Fa2hEj8W4m13l7bYhKLV2w,2222 +srsly/tests/ruamel_yaml/test_flowsequencekey.py,sha256=bd5JENpwXG6l4VAHOvvDBsw07bRHI672UIOegnd43JA,512 +srsly/tests/ruamel_yaml/test_indentation.py,sha256=-CYUvy1GDKh0GmE8BV8lOegGOiHwDHClmFNeM6ajUk4,8877 +srsly/tests/ruamel_yaml/test_int.py,sha256=O5gO3U2yya_FRfOBZMNFMC9OmEDAp593il9WuQh0g94,943 +srsly/tests/ruamel_yaml/test_issues.py,sha256=t6nseya6lqYqxntCR5-X3IoRR0bVUtedeS59Gp86_7A,24684 +srsly/tests/ruamel_yaml/test_json_numbers.py,sha256=cOmVnmG2gPK-5mqXRuRsfJvMcDs3zml6cL9ncfc_rf8,1509 +srsly/tests/ruamel_yaml/test_line_col.py,sha256=pFmnVOS0xiy_kUOJ-hBsXxuvlYTtTFsCYSeKq-xzajM,2210 +srsly/tests/ruamel_yaml/test_literal.py,sha256=nxH7fTxdd4N_HWEOw0maPOj2SPIA9DZlpJKPZpg_brU,8122 +srsly/tests/ruamel_yaml/test_none.py,sha256=YjK-9w7DB2XyMrH7HDfsXqTrawBxzGSMEdkXpRVZEu8,1481 +srsly/tests/ruamel_yaml/test_numpy.py,sha256=zkZybOV1s8Mmp-LDgEWzwV1vdWTZxugzrp-HYWFmWwI,512 +srsly/tests/ruamel_yaml/test_program_config.py,sha256=VcxA_rgWMQzfzeoU5rxujnR2YMpLFDfrNkoZojf36o4,1932 +srsly/tests/ruamel_yaml/test_spec_examples.py,sha256=85PmefhQIV5Q_j91P-ka7iYlqR2ujpKUe3vetO20b7s,6214 +srsly/tests/ruamel_yaml/test_string.py,sha256=uTt5J_Xg_CX2QGj0QacpjRWxHF0p0bdY09gQnYSSIC8,5832 +srsly/tests/ruamel_yaml/test_tag.py,sha256=ZvhNKBBhzpPbMVTR0SzXtZUTfq84WqtNOtzBD3dQ3CA,3790 +srsly/tests/ruamel_yaml/test_version.py,sha256=KP2LwValVp_zQgW8bgwpLZFU4xfocK5pWZVtuAimzZ4,4518 +srsly/tests/ruamel_yaml/test_yamlfile.py,sha256=coQP460A3Nx6CvLSuspCPLD7Vrn_1tyOiUz5DsioL10,6140 +srsly/tests/ruamel_yaml/test_yamlobject.py,sha256=IP6vwZjLQx3ZhZL8LSZnB8BAAbsiteWxAxU0dmyqOfo,2603 +srsly/tests/ruamel_yaml/test_z_check_debug_leftovers.py,sha256=IU09hR77CAlfn2xfGqbnTXWtNtduiE7ilgYhF9v4gvc,930 +srsly/tests/ruamel_yaml/test_z_data.py,sha256=2y4ivOyfhHy5F9V-2A2qMv0gMRKt4mBT3G6zVVama58,7562 +srsly/tests/test_json_api.py,sha256=4ctBK0JEMsKC_qx04wwVz5hK5uIyGjh9VgtQG-et2sw,8555 +srsly/tests/test_msgpack_api.py,sha256=3wrQ7XfZpdjLmN_khMjJxUxVUfiIKpPnQue6fqnNDls,3668 +srsly/tests/test_pickle_api.py,sha256=vwJwGn1fC4bPSA-ObUjTVrsAniF_pg01SrYYq3D79iQ,891 +srsly/tests/test_yaml_api.py,sha256=9R1HP2NBF5YkaoqLDqg7zxVtvIv8NNXBM2iLLJolW-0,3254 +srsly/tests/ujson/334-reproducer.json,sha256=oW5gYvKMGHjRWreBCv_3dShCpX5Ms5wJUF6O2R4yvfk,30202 +srsly/tests/ujson/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +srsly/tests/ujson/__pycache__/__init__.cpython-312.pyc,, +srsly/tests/ujson/__pycache__/test_ujson.cpython-312.pyc,, +srsly/tests/ujson/test_ujson.py,sha256=TjRWYS3qetFvR24HdmI-1izd35LlsLaUPVxbG9h5zYk,34459 +srsly/tests/util.py,sha256=jc86A1Nk5_lBseea1b8F7r91T7H0Tfl4HmjfBdsrKnU,431 +srsly/ujson/JSONtoObj.c,sha256=VYFU60F29WnCvz3jVSfcfGzCB4_0jfPWQKbWTaDtBXE,6622 +srsly/ujson/__init__.py,sha256=DHRiQ1Oo1MvRgYI6ZvhhfVE_88OOXPMxmHc_QCQ-DCU,75 +srsly/ujson/__pycache__/__init__.cpython-312.pyc,, +srsly/ujson/lib/dconv_wrapper.cc,sha256=GiVUOAZvl2tXcG08KS08uz8R31iKmc2_ylpIcRtJbco,2096 +srsly/ujson/lib/ultrajson.h,sha256=9M8Yb1ZabrvZ-fBEZTltWEFLw8XCBa8WcbBlfOJs54U,10116 +srsly/ujson/lib/ultrajsondec.c,sha256=REaMArtCizS94TMa9wG7AyWpcVgFbITPLZSTCRr96AQ,22599 +srsly/ujson/lib/ultrajsonenc.c,sha256=u8lYFpr7tRgMZG8YpeIphsrbQEhHtv91aiQRyWKkAqQ,27400 +srsly/ujson/objToJSON.c,sha256=n0BqLrb_vgHj5wbvtkrbeMdvKIbbEhE4SGtbQpC-kT0,23945 +srsly/ujson/py_defines.h,sha256=dRn3_xMsqCWQzRF6LEWVKHdpGwrvAsmZYzJjDhsI6Jo,2418 +srsly/ujson/ujson.c,sha256=Tn3HbqOCx_TFR6DeQIclJSMVB5wECxMZ-qdSKBkQvYI,4861 +srsly/ujson/ujson.cp312-win_amd64.pyd,sha256=T5igNubb9FqWaF2_PnJ7n2No_dQ-gYHql6fhGkBpjsc,37376 +srsly/ujson/version.h,sha256=7itJOzNDSFU-0KgmFWhKjTH-bZjyjHJQ8pEKnAfJHhQ,2038 +srsly/util.py,sha256=Z9TQ2YPLje_3qVQFVS3ubJJXHeeEkuSV8JZa3HrHCDI,1139 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..10ac2c23843796b65786bc9aba179a906c8bcc88 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: false +Tag: cp312-cp312-win_amd64 + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ddbaa2b8de7dfee21cc72fedcc37adc5ea00d78 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/entry_points.txt @@ -0,0 +1,5 @@ +[spacy_readers] +srsly.read_json.v1 = srsly:read_json +srsly.read_jsonl.v1 = srsly:read_jsonl +srsly.read_msgpack.v1 = srsly:read_msgpack +srsly.read_yaml.v1 = srsly:read_yaml diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2bd860d17ddbfaa456ee2d6a78b62c61f572375 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/top_level.txt @@ -0,0 +1 @@ +srsly diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/zip-safe b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/zip-safe new file mode 100644 index 0000000000000000000000000000000000000000..d3f5a12faa99758192ecc4ed3fc22c9249232e86 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly-2.5.2.dist-info/zip-safe @@ -0,0 +1 @@ + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/srsly/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d07366a14c8adf8f74dac7ec9baa0ffdce33d90a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly/__init__.py @@ -0,0 +1,10 @@ +from ._json_api import read_json, read_gzip_json, write_json, write_gzip_json +from ._json_api import read_gzip_jsonl, write_gzip_jsonl +from ._json_api import read_jsonl, write_jsonl +from ._json_api import json_dumps, json_loads, is_json_serializable +from ._msgpack_api import read_msgpack, write_msgpack, msgpack_dumps, msgpack_loads +from ._msgpack_api import msgpack_encoders, msgpack_decoders +from ._pickle_api import pickle_dumps, pickle_loads +from ._yaml_api import read_yaml, write_yaml, yaml_dumps, yaml_loads +from ._yaml_api import is_yaml_serializable +from .about import __version__ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly/_json_api.py b/TTS/Kokoro/.venv/Lib/site-packages/srsly/_json_api.py new file mode 100644 index 0000000000000000000000000000000000000000..ff55f4853732f7c394eb3b219160b9b3f909454a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly/_json_api.py @@ -0,0 +1,209 @@ +from typing import Union, Iterable, Sequence, Any, Optional, Iterator +import sys +import json as _builtin_json +import gzip + +from . import ujson +from .util import force_path, force_string, FilePath, JSONInput, JSONOutput + + +def json_dumps( + data: JSONInput, indent: Optional[int] = 0, sort_keys: bool = False +) -> str: + """Serialize an object to a JSON string. + + data: The JSON-serializable data. + indent (int): Number of spaces used to indent JSON. + sort_keys (bool): Sort dictionary keys. Falls back to json module for now. + RETURNS (str): The serialized string. + """ + if sort_keys: + indent = None if indent == 0 else indent + result = _builtin_json.dumps( + data, indent=indent, separators=(",", ":"), sort_keys=sort_keys + ) + else: + result = ujson.dumps(data, indent=indent, escape_forward_slashes=False) + return result + + +def json_loads(data: Union[str, bytes]) -> JSONOutput: + """Deserialize unicode or bytes to a Python object. + + data (str / bytes): The data to deserialize. + RETURNS: The deserialized Python object. + """ + # Avoid transforming the string '-' into the int '0' + if data == "-": + raise ValueError("Expected object or value") + return ujson.loads(data) + + +def read_json(path: FilePath) -> JSONOutput: + """Load JSON from file or standard input. + + path (FilePath): The file path. "-" for reading from stdin. + RETURNS (JSONOutput): The loaded JSON content. + """ + if path == "-": # reading from sys.stdin + data = sys.stdin.read() + return ujson.loads(data) + file_path = force_path(path) + with file_path.open("r", encoding="utf8") as f: + return ujson.load(f) + + +def read_gzip_json(path: FilePath) -> JSONOutput: + """Load JSON from a gzipped file. + + location (FilePath): The file path. + RETURNS (JSONOutput): The loaded JSON content. + """ + file_path = force_string(path) + with gzip.open(file_path, "r") as f: + return ujson.load(f) + + +def read_gzip_jsonl(path: FilePath, skip: bool = False) -> Iterator[JSONOutput]: + """Read a gzipped .jsonl file and yield contents line by line. + Blank lines will always be skipped. + + path (FilePath): The file path. + skip (bool): Skip broken lines and don't raise ValueError. + YIELDS (JSONOutput): The unpacked, deserialized Python objects. + """ + with gzip.open(force_path(path), "r") as f: + for line in _yield_json_lines(f, skip=skip): + yield line + + +def write_json(path: FilePath, data: JSONInput, indent: int = 2) -> None: + """Create a .json file and dump contents or write to standard + output. + + location (FilePath): The file path. "-" for writing to stdout. + data (JSONInput): The JSON-serializable data to output. + indent (int): Number of spaces used to indent JSON. + """ + json_data = json_dumps(data, indent=indent) + if path == "-": # writing to stdout + print(json_data) + else: + file_path = force_path(path, require_exists=False) + with file_path.open("w", encoding="utf8") as f: + f.write(json_data) + + +def write_gzip_json(path: FilePath, data: JSONInput, indent: int = 2) -> None: + """Create a .json.gz file and dump contents. + + path (FilePath): The file path. + data (JSONInput): The JSON-serializable data to output. + indent (int): Number of spaces used to indent JSON. + """ + json_data = json_dumps(data, indent=indent) + file_path = force_string(path) + with gzip.open(file_path, "w") as f: + f.write(json_data.encode("utf-8")) + + +def write_gzip_jsonl( + path: FilePath, + lines: Iterable[JSONInput], + append: bool = False, + append_new_line: bool = True, +) -> None: + """Create a .jsonl.gz file and dump contents. + + location (FilePath): The file path. + lines (Sequence[JSONInput]): The JSON-serializable contents of each line. + append (bool): Whether or not to append to the location. Appending to .gz files is generally not recommended, as it + doesn't allow the algorithm to take advantage of all data when compressing - files may hence be poorly + compressed. + append_new_line (bool): Whether or not to write a new line before appending + to the file. + """ + mode = "a" if append else "w" + file_path = force_path(path, require_exists=False) + with gzip.open(file_path, mode=mode) as f: + if append and append_new_line: + f.write("\n".encode("utf-8")) + f.writelines([(json_dumps(line) + "\n").encode("utf-8") for line in lines]) + + +def read_jsonl(path: FilePath, skip: bool = False) -> Iterable[JSONOutput]: + """Read a .jsonl file or standard input and yield contents line by line. + Blank lines will always be skipped. + + path (FilePath): The file path. "-" for reading from stdin. + skip (bool): Skip broken lines and don't raise ValueError. + YIELDS (JSONOutput): The loaded JSON contents of each line. + """ + if path == "-": # reading from sys.stdin + for line in _yield_json_lines(sys.stdin, skip=skip): + yield line + else: + file_path = force_path(path) + with file_path.open("r", encoding="utf8") as f: + for line in _yield_json_lines(f, skip=skip): + yield line + + +def write_jsonl( + path: FilePath, + lines: Iterable[JSONInput], + append: bool = False, + append_new_line: bool = True, +) -> None: + """Create a .jsonl file and dump contents or write to standard output. + + location (FilePath): The file path. "-" for writing to stdout. + lines (Sequence[JSONInput]): The JSON-serializable contents of each line. + append (bool): Whether or not to append to the location. + append_new_line (bool): Whether or not to write a new line before appending + to the file. + """ + if path == "-": # writing to stdout + for line in lines: + print(json_dumps(line)) + else: + mode = "a" if append else "w" + file_path = force_path(path, require_exists=False) + with file_path.open(mode, encoding="utf-8") as f: + if append and append_new_line: + f.write("\n") + for line in lines: + f.write(json_dumps(line) + "\n") + + +def is_json_serializable(obj: Any) -> bool: + """Check if a Python object is JSON-serializable. + + obj: The object to check. + RETURNS (bool): Whether the object is JSON-serializable. + """ + if hasattr(obj, "__call__"): + # Check this separately here to prevent infinite recursions + return False + try: + ujson.dumps(obj) + return True + except (TypeError, OverflowError): + return False + + +def _yield_json_lines( + stream: Iterable[str], skip: bool = False +) -> Iterable[JSONOutput]: + line_no = 1 + for line in stream: + line = line.strip() + if line == "": + continue + try: + yield ujson.loads(line) + except ValueError: + if skip: + continue + raise ValueError(f"Invalid JSON on line {line_no}: {line}") + line_no += 1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly/_msgpack_api.py b/TTS/Kokoro/.venv/Lib/site-packages/srsly/_msgpack_api.py new file mode 100644 index 0000000000000000000000000000000000000000..3501020e355ce55662c1ab4c55c60c29c04e9f0f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly/_msgpack_api.py @@ -0,0 +1,57 @@ +import gc + +from . import msgpack +from .msgpack import msgpack_encoders, msgpack_decoders # noqa: F401 +from .util import force_path, FilePath, JSONInputBin, JSONOutputBin + + +def msgpack_dumps(data: JSONInputBin) -> bytes: + """Serialize an object to a msgpack byte string. + + data: The data to serialize. + RETURNS (bytes): The serialized bytes. + """ + return msgpack.dumps(data, use_bin_type=True) + + +def msgpack_loads(data: bytes, use_list: bool = True) -> JSONOutputBin: + """Deserialize msgpack bytes to a Python object. + + data (bytes): The data to deserialize. + use_list (bool): Don't use tuples instead of lists. Can make + deserialization slower. + RETURNS: The deserialized Python object. + """ + # msgpack-python docs suggest disabling gc before unpacking large messages + gc.disable() + msg = msgpack.loads(data, raw=False, use_list=use_list) + gc.enable() + return msg + + +def write_msgpack(path: FilePath, data: JSONInputBin) -> None: + """Create a msgpack file and dump contents. + + location (FilePath): The file path. + data (JSONInputBin): The data to serialize. + """ + file_path = force_path(path, require_exists=False) + with file_path.open("wb") as f: + msgpack.dump(data, f, use_bin_type=True) + + +def read_msgpack(path: FilePath, use_list: bool = True) -> JSONOutputBin: + """Load a msgpack file. + + location (FilePath): The file path. + use_list (bool): Don't use tuples instead of lists. Can make + deserialization slower. + RETURNS (JSONOutputBin): The loaded and deserialized content. + """ + file_path = force_path(path) + with file_path.open("rb") as f: + # msgpack-python docs suggest disabling gc before unpacking large messages + gc.disable() + msg = msgpack.load(f, raw=False, use_list=use_list) + gc.enable() + return msg diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly/_pickle_api.py b/TTS/Kokoro/.venv/Lib/site-packages/srsly/_pickle_api.py new file mode 100644 index 0000000000000000000000000000000000000000..f991d14dfc2fe30ad7f185ec080c1dd6cf835e4c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly/_pickle_api.py @@ -0,0 +1,23 @@ +from typing import Optional + +from . import cloudpickle +from .util import JSONInput, JSONOutput + + +def pickle_dumps(data: JSONInput, protocol: Optional[int] = None) -> bytes: + """Serialize a Python object with pickle. + + data: The object to serialize. + protocol (int): Protocol to use. -1 for highest. + RETURNS (bytes): The serialized object. + """ + return cloudpickle.dumps(data, protocol=protocol) + + +def pickle_loads(data: bytes) -> JSONOutput: + """Deserialize bytes with pickle. + + data (bytes): The data to deserialize. + RETURNS: The deserialized Python object. + """ + return cloudpickle.loads(data) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly/_yaml_api.py b/TTS/Kokoro/.venv/Lib/site-packages/srsly/_yaml_api.py new file mode 100644 index 0000000000000000000000000000000000000000..6f6b885d5b6ba5edb1341becec79d6fafd0ab861 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly/_yaml_api.py @@ -0,0 +1,122 @@ +from typing import Union, IO, Any +from io import StringIO +import sys + +from .ruamel_yaml import YAML +from .ruamel_yaml.representer import RepresenterError +from .util import force_path, FilePath, YAMLInput, YAMLOutput + + +class CustomYaml(YAML): + def __init__(self, typ="safe", pure=True): + YAML.__init__(self, typ=typ, pure=pure) + self.default_flow_style = False + self.allow_unicode = True + self.encoding = "utf-8" + + # https://yaml.readthedocs.io/en/latest/example.html#output-of-dump-as-a-string + def dump(self, data, stream=None, **kw): + inefficient = False + if stream is None: + inefficient = True + stream = StringIO() + YAML.dump(self, data, stream, **kw) + if inefficient: + return stream.getvalue() + + +def yaml_dumps( + data: YAMLInput, + indent_mapping: int = 2, + indent_sequence: int = 4, + indent_offset: int = 2, + sort_keys: bool = False, +) -> str: + """Serialize an object to a YAML string. See the ruamel.yaml docs on + indentation for more details on the expected format. + https://yaml.readthedocs.io/en/latest/detail.html?highlight=indentation#indentation-of-block-sequences + + data: The YAML-serializable data. + indent_mapping (int): Mapping indentation. + indent_sequence (int): Sequence indentation. + indent_offset (int): Indentation offset. + sort_keys (bool): Sort dictionary keys. + RETURNS (str): The serialized string. + """ + yaml = CustomYaml() + yaml.sort_base_mapping_type_on_output = sort_keys + yaml.indent(mapping=indent_mapping, sequence=indent_sequence, offset=indent_offset) + return yaml.dump(data) + + +def yaml_loads(data: Union[str, IO]) -> YAMLOutput: + """Deserialize unicode or a file object a Python object. + + data (str / file): The data to deserialize. + RETURNS: The deserialized Python object. + """ + yaml = CustomYaml() + try: + return yaml.load(data) + except Exception as e: + raise ValueError(f"Invalid YAML: {e}") + + +def read_yaml(path: FilePath) -> YAMLOutput: + """Load YAML from file or standard input. + + location (FilePath): The file path. "-" for reading from stdin. + RETURNS (YAMLOutput): The loaded content. + """ + if path == "-": # reading from sys.stdin + data = sys.stdin.read() + return yaml_loads(data) + file_path = force_path(path) + with file_path.open("r", encoding="utf8") as f: + return yaml_loads(f) + + +def write_yaml( + path: FilePath, + data: YAMLInput, + indent_mapping: int = 2, + indent_sequence: int = 4, + indent_offset: int = 2, + sort_keys: bool = False, +) -> None: + """Create a .json file and dump contents or write to standard + output. + + location (FilePath): The file path. "-" for writing to stdout. + data (YAMLInput): The JSON-serializable data to output. + indent_mapping (int): Mapping indentation. + indent_sequence (int): Sequence indentation. + indent_offset (int): Indentation offset. + sort_keys (bool): Sort dictionary keys. + """ + yaml_data = yaml_dumps( + data, + indent_mapping=indent_mapping, + indent_sequence=indent_sequence, + indent_offset=indent_offset, + sort_keys=sort_keys, + ) + if path == "-": # writing to stdout + print(yaml_data) + else: + file_path = force_path(path, require_exists=False) + with file_path.open("w", encoding="utf8") as f: + f.write(yaml_data) + + +def is_yaml_serializable(obj: Any) -> bool: + """Check if a Python object is YAML-serializable (strict). + + obj: The object to check. + RETURNS (bool): Whether the object is YAML-serializable. + """ + try: + yaml_dumps(obj) + return True + except RepresenterError: + return False diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly/about.py b/TTS/Kokoro/.venv/Lib/site-packages/srsly/about.py new file mode 100644 index 0000000000000000000000000000000000000000..3fbcba9f07ea71f133d8e3716592b2194cdd5a2d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly/about.py @@ -0,0 +1 @@ +__version__ = "2.5.2" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/srsly/util.py b/TTS/Kokoro/.venv/Lib/site-packages/srsly/util.py new file mode 100644 index 0000000000000000000000000000000000000000..4a8b12afe0aa1daa68e6fd9a703bbc69fb26913b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/srsly/util.py @@ -0,0 +1,31 @@ +from pathlib import Path +from typing import Union, Dict, Any, List, Tuple +from collections import OrderedDict + + +# fmt: off +FilePath = Union[str, Path] +# Superficial JSON input/output types +# https://github.com/python/typing/issues/182#issuecomment-186684288 +JSONOutput = Union[str, int, float, bool, None, Dict[str, Any], List[Any]] +JSONOutputBin = Union[bytes, str, int, float, bool, None, Dict[str, Any], List[Any]] +# For input, we also accept tuples, ordered dicts etc. +JSONInput = Union[str, int, float, bool, None, Dict[str, Any], List[Any], Tuple[Any, ...], OrderedDict] +JSONInputBin = Union[bytes, str, int, float, bool, None, Dict[str, Any], List[Any], Tuple[Any, ...], OrderedDict] +YAMLInput = JSONInput +YAMLOutput = JSONOutput +# fmt: on + + +def force_path(location, require_exists=True): + if not isinstance(location, Path): + location = Path(location) + if require_exists and not location.exists(): + raise ValueError(f"Can't read file: {location}") + return location + + +def force_string(location): + if isinstance(location, str): + return location + return str(location) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette-0.52.1.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/starlette-0.52.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette-0.52.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette-0.52.1.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/starlette-0.52.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..0ddbe28afc2076f1c541924f003d0b60b4fdb47e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette-0.52.1.dist-info/METADATA @@ -0,0 +1,177 @@ +Metadata-Version: 2.4 +Name: starlette +Version: 0.52.1 +Summary: The little ASGI library that shines. +Project-URL: Homepage, https://github.com/Kludex/starlette +Project-URL: Documentation, https://starlette.dev/ +Project-URL: Changelog, https://starlette.dev/release-notes/ +Project-URL: Funding, https://github.com/sponsors/Kludex +Project-URL: Source, https://github.com/Kludex/starlette +Author-email: Tom Christie +Maintainer-email: Marcelo Trylesinski +License-Expression: BSD-3-Clause +License-File: LICENSE.md +Classifier: Development Status :: 3 - Alpha +Classifier: Environment :: Web Environment +Classifier: Framework :: AnyIO +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Topic :: Internet :: WWW/HTTP +Requires-Python: >=3.10 +Requires-Dist: anyio<5,>=3.6.2 +Requires-Dist: typing-extensions>=4.10.0; python_version < '3.13' +Provides-Extra: full +Requires-Dist: httpx<0.29.0,>=0.27.0; extra == 'full' +Requires-Dist: itsdangerous; extra == 'full' +Requires-Dist: jinja2; extra == 'full' +Requires-Dist: python-multipart>=0.0.18; extra == 'full' +Requires-Dist: pyyaml; extra == 'full' +Description-Content-Type: text/markdown + +

+ + + + starlette-logo + +

+ +

+ ✨ The little ASGI framework that shines. ✨ +

+ +--- + +[![Build Status](https://github.com/Kludex/starlette/workflows/Test%20Suite/badge.svg)](https://github.com/Kludex/starlette/actions) +[![Package version](https://badge.fury.io/py/starlette.svg)](https://pypi.python.org/pypi/starlette) +[![Supported Python Version](https://img.shields.io/pypi/pyversions/starlette.svg?color=%2334D058)](https://pypi.org/project/starlette) +[![Discord](https://img.shields.io/discord/1051468649518616576?logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/RxKUF5JuHs) + +--- + +**Documentation**: https://starlette.dev + +**Source Code**: https://github.com/Kludex/starlette + +--- + +# Starlette + +Starlette is a lightweight [ASGI][asgi] framework/toolkit, +which is ideal for building async web services in Python. + +It is production-ready, and gives you the following: + +* A lightweight, low-complexity HTTP web framework. +* WebSocket support. +* In-process background tasks. +* Startup and shutdown events. +* Test client built on `httpx`. +* CORS, GZip, Static Files, Streaming responses. +* Session and Cookie support. +* 100% test coverage. +* 100% type annotated codebase. +* Few hard dependencies. +* Compatible with `asyncio` and `trio` backends. +* Great overall performance [against independent benchmarks][techempower]. + +## Installation + +```shell +$ pip install starlette +``` + +You'll also want to install an ASGI server, such as [uvicorn](https://www.uvicorn.org/), [daphne](https://github.com/django/daphne/), or [hypercorn](https://hypercorn.readthedocs.io/en/latest/). + +```shell +$ pip install uvicorn +``` + +## Example + +```python title="main.py" +from starlette.applications import Starlette +from starlette.responses import JSONResponse +from starlette.routing import Route + + +async def homepage(request): + return JSONResponse({'hello': 'world'}) + +routes = [ + Route("/", endpoint=homepage) +] + +app = Starlette(debug=True, routes=routes) +``` + +Then run the application using Uvicorn: + +```shell +$ uvicorn main:app +``` + +## Dependencies + +Starlette only requires `anyio`, and the following are optional: + +* [`httpx`][httpx] - Required if you want to use the `TestClient`. +* [`jinja2`][jinja2] - Required if you want to use `Jinja2Templates`. +* [`python-multipart`][python-multipart] - Required if you want to support form parsing, with `request.form()`. +* [`itsdangerous`][itsdangerous] - Required for `SessionMiddleware` support. +* [`pyyaml`][pyyaml] - Required for `SchemaGenerator` support. + +You can install all of these with `pip install starlette[full]`. + +## Framework or Toolkit + +Starlette is designed to be used either as a complete framework, or as +an ASGI toolkit. You can use any of its components independently. + +```python +from starlette.responses import PlainTextResponse + + +async def app(scope, receive, send): + assert scope['type'] == 'http' + response = PlainTextResponse('Hello, world!') + await response(scope, receive, send) +``` + +Run the `app` application in `example.py`: + +```shell +$ uvicorn example:app +INFO: Started server process [11509] +INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) +``` + +Run uvicorn with `--reload` to enable auto-reloading on code changes. + +## Modularity + +The modularity that Starlette is designed on promotes building re-usable +components that can be shared between any ASGI framework. This should enable +an ecosystem of shared middleware and mountable applications. + +The clean API separation also means it's easier to understand each component +in isolation. + +--- + +

Starlette is BSD licensed code.
Designed & crafted with care.

— ⭐️ —

+ +[asgi]: https://asgi.readthedocs.io/en/latest/ +[httpx]: https://www.python-httpx.org/ +[jinja2]: https://jinja.palletsprojects.com/ +[python-multipart]: https://multipart.fastapiexpert.com/ +[itsdangerous]: https://itsdangerous.palletsprojects.com/ +[sqlalchemy]: https://www.sqlalchemy.org +[pyyaml]: https://pyyaml.org/wiki/PyYAMLDocumentation +[techempower]: https://www.techempower.com/benchmarks/#hw=ph&test=fortune&l=zijzen-sf diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette-0.52.1.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/starlette-0.52.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..13cdce28e57bb2c194b336a2dbedcf1481750f6c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette-0.52.1.dist-info/RECORD @@ -0,0 +1,74 @@ +starlette-0.52.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +starlette-0.52.1.dist-info/METADATA,sha256=wN3Fg3zKlmoXD97vuSSg29CPHLHzENoQRqOfqu7QxTU,6318 +starlette-0.52.1.dist-info/RECORD,, +starlette-0.52.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87 +starlette-0.52.1.dist-info/licenses/LICENSE.md,sha256=3LlWd6AiQCQxh-lk-UGEfRmxeCHPmeWvrmhPqzKMGb8,1518 +starlette/__init__.py,sha256=qGXLKRE1DujjCoGNaZ5WGUhaOMhlGVcsCjnPHgOXYGQ,23 +starlette/__pycache__/__init__.cpython-312.pyc,, +starlette/__pycache__/_exception_handler.cpython-312.pyc,, +starlette/__pycache__/_utils.cpython-312.pyc,, +starlette/__pycache__/applications.cpython-312.pyc,, +starlette/__pycache__/authentication.cpython-312.pyc,, +starlette/__pycache__/background.cpython-312.pyc,, +starlette/__pycache__/concurrency.cpython-312.pyc,, +starlette/__pycache__/config.cpython-312.pyc,, +starlette/__pycache__/convertors.cpython-312.pyc,, +starlette/__pycache__/datastructures.cpython-312.pyc,, +starlette/__pycache__/endpoints.cpython-312.pyc,, +starlette/__pycache__/exceptions.cpython-312.pyc,, +starlette/__pycache__/formparsers.cpython-312.pyc,, +starlette/__pycache__/requests.cpython-312.pyc,, +starlette/__pycache__/responses.cpython-312.pyc,, +starlette/__pycache__/routing.cpython-312.pyc,, +starlette/__pycache__/schemas.cpython-312.pyc,, +starlette/__pycache__/staticfiles.cpython-312.pyc,, +starlette/__pycache__/status.cpython-312.pyc,, +starlette/__pycache__/templating.cpython-312.pyc,, +starlette/__pycache__/testclient.cpython-312.pyc,, +starlette/__pycache__/types.cpython-312.pyc,, +starlette/__pycache__/websockets.cpython-312.pyc,, +starlette/_exception_handler.py,sha256=izcMiP2VuVbIvwTUQjhMlchcaA5795-Ra1SCn5KWPTM,2205 +starlette/_utils.py,sha256=Ij3aqVw-FTbHbIi4TYHbHS46lpyXkkzFN0PutWXwejo,2833 +starlette/applications.py,sha256=xK28LIP2UZ5Z4aQYIFp33klWibtkAdDOnLNwhASForM,10347 +starlette/authentication.py,sha256=upvOJIPx5_HXohVapYDPknfPAq-PrXzk7gxXkIWZgWg,4750 +starlette/background.py,sha256=D-XpUpFRgUBnZeA1tHgzMOgube6ICVZFlOA4ML0q1T8,1122 +starlette/concurrency.py,sha256=D9o38FXqZtqt9nWIzetHPOpW94ruqLS8hNtnEIEfHv0,1630 +starlette/config.py,sha256=GVwko0pGSusxuQHO35tL_Nt_ApL0fmVYL3IiHHYpLW4,4426 +starlette/convertors.py,sha256=F1rse3AacN9rsfJnTeuDnjbN51r_ouHc3WLyYkjkX_o,2304 +starlette/datastructures.py,sha256=1NcnY4AV96k2xj1RQ4L6gqldmiRB1gQDFFN2_qCBmTA,22829 +starlette/endpoints.py,sha256=XODIK1P9lhmi_PH3mtCPBB4Mcw7yjjUJcTzbk7YBXhA,5099 +starlette/exceptions.py,sha256=tIphlZa8EsQfKw3-xw5J3ZN1GjaR4UcxfJK69Ad2hG8,1066 +starlette/formparsers.py,sha256=Ndl5dGXZtopzJUjM04M5zYhS8sT33e_5JwK2T7Md4zA,11086 +starlette/middleware/__init__.py,sha256=BORnOj0n0mL1OWUUs1PLTu1SASmvT8kEEDA6cbuhuPo,1349 +starlette/middleware/__pycache__/__init__.cpython-312.pyc,, +starlette/middleware/__pycache__/authentication.cpython-312.pyc,, +starlette/middleware/__pycache__/base.cpython-312.pyc,, +starlette/middleware/__pycache__/cors.cpython-312.pyc,, +starlette/middleware/__pycache__/errors.cpython-312.pyc,, +starlette/middleware/__pycache__/exceptions.cpython-312.pyc,, +starlette/middleware/__pycache__/gzip.cpython-312.pyc,, +starlette/middleware/__pycache__/httpsredirect.cpython-312.pyc,, +starlette/middleware/__pycache__/sessions.cpython-312.pyc,, +starlette/middleware/__pycache__/trustedhost.cpython-312.pyc,, +starlette/middleware/__pycache__/wsgi.cpython-312.pyc,, +starlette/middleware/authentication.py,sha256=-RSwwJ0pIkrM0v-2Ip8HXVB24xtSp7ObzR3OfTC8wSA,1800 +starlette/middleware/base.py,sha256=YFqe1rG4gIeK2GpV3bcCYlGtnW_zTLwIotwvKMsGwvs,10333 +starlette/middleware/cors.py,sha256=klY-xw3S-obBaYJ4C1nyo6rXpoR39O9alFo9N-IJNRk,7527 +starlette/middleware/errors.py,sha256=h76TfVDrdYSvpBAEWgZ91VvPZQe3vRpAl6ChoiXG-Tk,8037 +starlette/middleware/exceptions.py,sha256=7OgSUiBgwHS4VMmpaWlw21uDKNDmOMzLVZrWDLDUqWo,2784 +starlette/middleware/gzip.py,sha256=_thpCRctguw0tMM6J2iDlAj5vZlol9T673IHtfvfxQE,5899 +starlette/middleware/httpsredirect.py,sha256=SNTleaYALGoITV7xwbic4gB6VYdM8Ylea_ykciUz31g,848 +starlette/middleware/sessions.py,sha256=IgZkTkgbOhU9tQceQV0KjLAiNp-dKhngcHpu4VYaDXQ,3572 +starlette/middleware/trustedhost.py,sha256=byKCUyPge54Z4MznyunD_2DsMfJc2UsfV4b2Du-WYTc,2219 +starlette/middleware/wsgi.py,sha256=TxpYRHR12iZRIa09MWV2sEbi0c1cTHPAbrVzYP_F7O0,5368 +starlette/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +starlette/requests.py,sha256=GEBlk1m0lOy2TGdJWVYXvnlkLkUgoY_ePStuQTB_-I0,11988 +starlette/responses.py,sha256=CNctyDpXpj7_75QqVP9scpREL_6o_rF52r-PMC1wSwI,21431 +starlette/routing.py,sha256=9PlA8gx4DbzueNmplwPxFOBUb7u5wrfw-ZvzYfq_KBw,34201 +starlette/schemas.py,sha256=fBDlI1YDKF_rkQIalqBVQ0PQ9-3gNGh7T_39OyE7rV0,5168 +starlette/staticfiles.py,sha256=CDUeXRaKsqojKArSTijvsPsRPWZnmZdEy2EqfrGTdw0,8485 +starlette/status.py,sha256=P5SxON3aKW3rwUpJ7cxxD3vvEULMpO-aIzzJRmLwwVs,6359 +starlette/templating.py,sha256=D9MY-mUdG599Yd3QKvFs2KtChN6to3spiZ36IM4tJ0c,8293 +starlette/testclient.py,sha256=0nuYh5aQixE4buQCZtCNZwVqbeHLm1enNmh83bhD4XQ,27850 +starlette/types.py,sha256=87wTuwF1036QxRse3mL5qOuS9i4a9xaIZMqTjY-lvvo,1041 +starlette/websockets.py,sha256=phsWgpXclYreVhg-wAyUWpgBWJTibNF5Pi-tNxbmQFY,8336 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette-0.52.1.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/starlette-0.52.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..ae8ec1bdaa94d726ceb907542d76cbd5d38cafcd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette-0.52.1.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.28.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e2ba2042b71d0b2f749c9c7c4b668ac082edab3a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/__init__.py @@ -0,0 +1 @@ +__version__ = "0.52.1" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/_exception_handler.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/_exception_handler.py new file mode 100644 index 0000000000000000000000000000000000000000..40761b68c98cb40a3d24ff1e6067f3a653800b94 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/_exception_handler.py @@ -0,0 +1,65 @@ +from __future__ import annotations + +from typing import Any + +from starlette._utils import is_async_callable +from starlette.concurrency import run_in_threadpool +from starlette.exceptions import HTTPException +from starlette.requests import Request +from starlette.types import ASGIApp, ExceptionHandler, Message, Receive, Scope, Send +from starlette.websockets import WebSocket + +ExceptionHandlers = dict[Any, ExceptionHandler] +StatusHandlers = dict[int, ExceptionHandler] + + +def _lookup_exception_handler(exc_handlers: ExceptionHandlers, exc: Exception) -> ExceptionHandler | None: + for cls in type(exc).__mro__: + if cls in exc_handlers: + return exc_handlers[cls] + return None + + +def wrap_app_handling_exceptions(app: ASGIApp, conn: Request | WebSocket) -> ASGIApp: + exception_handlers: ExceptionHandlers + status_handlers: StatusHandlers + try: + exception_handlers, status_handlers = conn.scope["starlette.exception_handlers"] + except KeyError: + exception_handlers, status_handlers = {}, {} + + async def wrapped_app(scope: Scope, receive: Receive, send: Send) -> None: + response_started = False + + async def sender(message: Message) -> None: + nonlocal response_started + + if message["type"] == "http.response.start": + response_started = True + await send(message) + + try: + await app(scope, receive, sender) + except Exception as exc: + handler = None + + if isinstance(exc, HTTPException): + handler = status_handlers.get(exc.status_code) + + if handler is None: + handler = _lookup_exception_handler(exception_handlers, exc) + + if handler is None: + raise exc + + if response_started: + raise RuntimeError("Caught handled exception, but response already started.") from exc + + if is_async_callable(handler): + response = await handler(conn, exc) + else: + response = await run_in_threadpool(handler, conn, exc) + if response is not None: + await response(scope, receive, sender) + + return wrapped_app diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..341c530a190db3255bcdc8f4ee75b963cdc804f4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/_utils.py @@ -0,0 +1,105 @@ +from __future__ import annotations + +import functools +import sys +from collections.abc import Awaitable, Callable, Generator +from contextlib import AbstractAsyncContextManager, contextmanager +from typing import Any, Generic, Protocol, TypeVar, overload + +from starlette.types import Scope + +if sys.version_info >= (3, 13): # pragma: no cover + from inspect import iscoroutinefunction + from typing import TypeIs +else: # pragma: no cover + from asyncio import iscoroutinefunction + + from typing_extensions import TypeIs + +has_exceptiongroups = True +if sys.version_info < (3, 11): # pragma: no cover + try: + from exceptiongroup import BaseExceptionGroup # type: ignore[unused-ignore,import-not-found] + except ImportError: + has_exceptiongroups = False + +T = TypeVar("T") +AwaitableCallable = Callable[..., Awaitable[T]] + + +@overload +def is_async_callable(obj: AwaitableCallable[T]) -> TypeIs[AwaitableCallable[T]]: ... + + +@overload +def is_async_callable(obj: Any) -> TypeIs[AwaitableCallable[Any]]: ... + + +def is_async_callable(obj: Any) -> Any: + while isinstance(obj, functools.partial): + obj = obj.func + + return iscoroutinefunction(obj) or (callable(obj) and iscoroutinefunction(obj.__call__)) + + +T_co = TypeVar("T_co", covariant=True) + + +class AwaitableOrContextManager( + Awaitable[T_co], AbstractAsyncContextManager[T_co], Protocol[T_co] +): ... # pragma: no branch + + +class SupportsAsyncClose(Protocol): + async def close(self) -> None: ... # pragma: no cover + + +SupportsAsyncCloseType = TypeVar("SupportsAsyncCloseType", bound=SupportsAsyncClose, covariant=False) + + +class AwaitableOrContextManagerWrapper(Generic[SupportsAsyncCloseType]): + __slots__ = ("aw", "entered") + + def __init__(self, aw: Awaitable[SupportsAsyncCloseType]) -> None: + self.aw = aw + + def __await__(self) -> Generator[Any, None, SupportsAsyncCloseType]: + return self.aw.__await__() + + async def __aenter__(self) -> SupportsAsyncCloseType: + self.entered = await self.aw + return self.entered + + async def __aexit__(self, *args: Any) -> None | bool: + await self.entered.close() + return None + + +@contextmanager +def collapse_excgroups() -> Generator[None, None, None]: + try: + yield + except BaseException as exc: + if has_exceptiongroups: # pragma: no cover + while isinstance(exc, BaseExceptionGroup) and len(exc.exceptions) == 1: + exc = exc.exceptions[0] + + raise exc + + +def get_route_path(scope: Scope) -> str: + path: str = scope["path"] + root_path = scope.get("root_path", "") + if not root_path: + return path + + if not path.startswith(root_path): + return path + + if path == root_path: + return "" + + if path[len(root_path)] == "/": + return path[len(root_path) :] + + return path diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/applications.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/applications.py new file mode 100644 index 0000000000000000000000000000000000000000..721181c0acf5a495ecf17bfdf72d26bdb7463737 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/applications.py @@ -0,0 +1,244 @@ +from __future__ import annotations + +import warnings +from collections.abc import Awaitable, Callable, Mapping, Sequence +from typing import Any, ParamSpec, TypeVar + +from starlette.datastructures import State, URLPath +from starlette.middleware import Middleware, _MiddlewareFactory +from starlette.middleware.base import BaseHTTPMiddleware +from starlette.middleware.errors import ServerErrorMiddleware +from starlette.middleware.exceptions import ExceptionMiddleware +from starlette.requests import Request +from starlette.responses import Response +from starlette.routing import BaseRoute, Router +from starlette.types import ASGIApp, ExceptionHandler, Lifespan, Receive, Scope, Send +from starlette.websockets import WebSocket + +AppType = TypeVar("AppType", bound="Starlette") +P = ParamSpec("P") + + +class Starlette: + """Creates an Starlette application.""" + + def __init__( + self: AppType, + debug: bool = False, + routes: Sequence[BaseRoute] | None = None, + middleware: Sequence[Middleware] | None = None, + exception_handlers: Mapping[Any, ExceptionHandler] | None = None, + on_startup: Sequence[Callable[[], Any]] | None = None, + on_shutdown: Sequence[Callable[[], Any]] | None = None, + lifespan: Lifespan[AppType] | None = None, + ) -> None: + """Initializes the application. + + Parameters: + debug: Boolean indicating if debug tracebacks should be returned on errors. + routes: A list of routes to serve incoming HTTP and WebSocket requests. + middleware: A list of middleware to run for every request. A starlette + application will always automatically include two middleware classes. + `ServerErrorMiddleware` is added as the very outermost middleware, to handle + any uncaught errors occurring anywhere in the entire stack. + `ExceptionMiddleware` is added as the very innermost middleware, to deal + with handled exception cases occurring in the routing or endpoints. + exception_handlers: A mapping of either integer status codes, + or exception class types onto callables which handle the exceptions. + Exception handler callables should be of the form + `handler(request, exc) -> response` and may be either standard functions, or + async functions. + on_startup: A list of callables to run on application startup. + Startup handler callables do not take any arguments, and may be either + standard functions, or async functions. + on_shutdown: A list of callables to run on application shutdown. + Shutdown handler callables do not take any arguments, and may be either + standard functions, or async functions. + lifespan: A lifespan context function, which can be used to perform + startup and shutdown tasks. This is a newer style that replaces the + `on_startup` and `on_shutdown` handlers. Use one or the other, not both. + """ + # The lifespan context function is a newer style that replaces + # on_startup / on_shutdown handlers. Use one or the other, not both. + assert lifespan is None or (on_startup is None and on_shutdown is None), ( + "Use either 'lifespan' or 'on_startup'/'on_shutdown', not both." + ) + + self.debug = debug + self.state = State() + self.router = Router(routes, on_startup=on_startup, on_shutdown=on_shutdown, lifespan=lifespan) + self.exception_handlers = {} if exception_handlers is None else dict(exception_handlers) + self.user_middleware = [] if middleware is None else list(middleware) + self.middleware_stack: ASGIApp | None = None + + def build_middleware_stack(self) -> ASGIApp: + debug = self.debug + error_handler = None + exception_handlers: dict[Any, ExceptionHandler] = {} + + for key, value in self.exception_handlers.items(): + if key in (500, Exception): + error_handler = value + else: + exception_handlers[key] = value + + middleware = ( + [Middleware(ServerErrorMiddleware, handler=error_handler, debug=debug)] + + self.user_middleware + + [Middleware(ExceptionMiddleware, handlers=exception_handlers, debug=debug)] + ) + + app = self.router + for cls, args, kwargs in reversed(middleware): + app = cls(app, *args, **kwargs) + return app + + @property + def routes(self) -> list[BaseRoute]: + return self.router.routes + + def url_path_for(self, name: str, /, **path_params: Any) -> URLPath: + return self.router.url_path_for(name, **path_params) + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + scope["app"] = self + if self.middleware_stack is None: + self.middleware_stack = self.build_middleware_stack() + await self.middleware_stack(scope, receive, send) + + def on_event(self, event_type: str) -> Callable: # type: ignore[type-arg] + return self.router.on_event(event_type) # pragma: no cover + + def mount(self, path: str, app: ASGIApp, name: str | None = None) -> None: + self.router.mount(path, app=app, name=name) # pragma: no cover + + def host(self, host: str, app: ASGIApp, name: str | None = None) -> None: + self.router.host(host, app=app, name=name) # pragma: no cover + + def add_middleware( + self, + middleware_class: _MiddlewareFactory[P], + *args: P.args, + **kwargs: P.kwargs, + ) -> None: + if self.middleware_stack is not None: # pragma: no cover + raise RuntimeError("Cannot add middleware after an application has started") + self.user_middleware.insert(0, Middleware(middleware_class, *args, **kwargs)) + + def add_exception_handler( + self, + exc_class_or_status_code: int | type[Exception], + handler: ExceptionHandler, + ) -> None: # pragma: no cover + self.exception_handlers[exc_class_or_status_code] = handler + + def add_event_handler( + self, + event_type: str, + func: Callable, # type: ignore[type-arg] + ) -> None: # pragma: no cover + self.router.add_event_handler(event_type, func) + + def add_route( + self, + path: str, + route: Callable[[Request], Awaitable[Response] | Response], + methods: list[str] | None = None, + name: str | None = None, + include_in_schema: bool = True, + ) -> None: # pragma: no cover + self.router.add_route(path, route, methods=methods, name=name, include_in_schema=include_in_schema) + + def add_websocket_route( + self, + path: str, + route: Callable[[WebSocket], Awaitable[None]], + name: str | None = None, + ) -> None: # pragma: no cover + self.router.add_websocket_route(path, route, name=name) + + def exception_handler(self, exc_class_or_status_code: int | type[Exception]) -> Callable: # type: ignore[type-arg] + warnings.warn( + "The `exception_handler` decorator is deprecated, and will be removed in version 1.0.0. " + "Refer to https://starlette.dev/exceptions/ for the recommended approach.", + DeprecationWarning, + ) + + def decorator(func: Callable) -> Callable: # type: ignore[type-arg] + self.add_exception_handler(exc_class_or_status_code, func) + return func + + return decorator + + def route( + self, + path: str, + methods: list[str] | None = None, + name: str | None = None, + include_in_schema: bool = True, + ) -> Callable: # type: ignore[type-arg] + """ + We no longer document this decorator style API, and its usage is discouraged. + Instead you should use the following approach: + + >>> routes = [Route(path, endpoint=...), ...] + >>> app = Starlette(routes=routes) + """ + warnings.warn( + "The `route` decorator is deprecated, and will be removed in version 1.0.0. " + "Refer to https://starlette.dev/routing/ for the recommended approach.", + DeprecationWarning, + ) + + def decorator(func: Callable) -> Callable: # type: ignore[type-arg] + self.router.add_route( + path, + func, + methods=methods, + name=name, + include_in_schema=include_in_schema, + ) + return func + + return decorator + + def websocket_route(self, path: str, name: str | None = None) -> Callable: # type: ignore[type-arg] + """ + We no longer document this decorator style API, and its usage is discouraged. + Instead you should use the following approach: + + >>> routes = [WebSocketRoute(path, endpoint=...), ...] + >>> app = Starlette(routes=routes) + """ + warnings.warn( + "The `websocket_route` decorator is deprecated, and will be removed in version 1.0.0. " + "Refer to https://starlette.dev/routing/#websocket-routing for the recommended approach.", + DeprecationWarning, + ) + + def decorator(func: Callable) -> Callable: # type: ignore[type-arg] + self.router.add_websocket_route(path, func, name=name) + return func + + return decorator + + def middleware(self, middleware_type: str) -> Callable: # type: ignore[type-arg] + """ + We no longer document this decorator style API, and its usage is discouraged. + Instead you should use the following approach: + + >>> middleware = [Middleware(...), ...] + >>> app = Starlette(middleware=middleware) + """ + warnings.warn( + "The `middleware` decorator is deprecated, and will be removed in version 1.0.0. " + "Refer to https://starlette.dev/middleware/#using-middleware for recommended approach.", + DeprecationWarning, + ) + assert middleware_type == "http", 'Currently only middleware("http") is supported.' + + def decorator(func: Callable) -> Callable: # type: ignore[type-arg] + self.add_middleware(BaseHTTPMiddleware, dispatch=func) + return func + + return decorator diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/authentication.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/authentication.py new file mode 100644 index 0000000000000000000000000000000000000000..0044ccdf6cd5722e8bf318f5a016206f5e299a89 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/authentication.py @@ -0,0 +1,142 @@ +from __future__ import annotations + +import functools +import inspect +from collections.abc import Callable, Sequence +from typing import Any, ParamSpec +from urllib.parse import urlencode + +from starlette._utils import is_async_callable +from starlette.exceptions import HTTPException +from starlette.requests import HTTPConnection, Request +from starlette.responses import RedirectResponse +from starlette.websockets import WebSocket + +_P = ParamSpec("_P") + + +def has_required_scope(conn: HTTPConnection, scopes: Sequence[str]) -> bool: + for scope in scopes: + if scope not in conn.auth.scopes: + return False + return True + + +def requires( + scopes: str | Sequence[str], + status_code: int = 403, + redirect: str | None = None, +) -> Callable[[Callable[_P, Any]], Callable[_P, Any]]: + scopes_list = [scopes] if isinstance(scopes, str) else list(scopes) + + def decorator( + func: Callable[_P, Any], + ) -> Callable[_P, Any]: + sig = inspect.signature(func) + for idx, parameter in enumerate(sig.parameters.values()): + if parameter.name == "request" or parameter.name == "websocket": + type_ = parameter.name + break + else: + raise Exception(f'No "request" or "websocket" argument on function "{func}"') + + if type_ == "websocket": + # Handle websocket functions. (Always async) + @functools.wraps(func) + async def websocket_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> None: + websocket = kwargs.get("websocket", args[idx] if idx < len(args) else None) + assert isinstance(websocket, WebSocket) + + if not has_required_scope(websocket, scopes_list): + await websocket.close() + else: + await func(*args, **kwargs) + + return websocket_wrapper + + elif is_async_callable(func): + # Handle async request/response functions. + @functools.wraps(func) + async def async_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> Any: + request = kwargs.get("request", args[idx] if idx < len(args) else None) + assert isinstance(request, Request) + + if not has_required_scope(request, scopes_list): + if redirect is not None: + orig_request_qparam = urlencode({"next": str(request.url)}) + next_url = f"{request.url_for(redirect)}?{orig_request_qparam}" + return RedirectResponse(url=next_url, status_code=303) + raise HTTPException(status_code=status_code) + return await func(*args, **kwargs) + + return async_wrapper + + else: + # Handle sync request/response functions. + @functools.wraps(func) + def sync_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> Any: + request = kwargs.get("request", args[idx] if idx < len(args) else None) + assert isinstance(request, Request) + + if not has_required_scope(request, scopes_list): + if redirect is not None: + orig_request_qparam = urlencode({"next": str(request.url)}) + next_url = f"{request.url_for(redirect)}?{orig_request_qparam}" + return RedirectResponse(url=next_url, status_code=303) + raise HTTPException(status_code=status_code) + return func(*args, **kwargs) + + return sync_wrapper + + return decorator + + +class AuthenticationError(Exception): + pass + + +class AuthenticationBackend: + async def authenticate(self, conn: HTTPConnection) -> tuple[AuthCredentials, BaseUser] | None: + raise NotImplementedError() # pragma: no cover + + +class AuthCredentials: + def __init__(self, scopes: Sequence[str] | None = None): + self.scopes = [] if scopes is None else list(scopes) + + +class BaseUser: + @property + def is_authenticated(self) -> bool: + raise NotImplementedError() # pragma: no cover + + @property + def display_name(self) -> str: + raise NotImplementedError() # pragma: no cover + + @property + def identity(self) -> str: + raise NotImplementedError() # pragma: no cover + + +class SimpleUser(BaseUser): + def __init__(self, username: str) -> None: + self.username = username + + @property + def is_authenticated(self) -> bool: + return True + + @property + def display_name(self) -> str: + return self.username + + +class UnauthenticatedUser(BaseUser): + @property + def is_authenticated(self) -> bool: + return False + + @property + def display_name(self) -> str: + return "" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/background.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/background.py new file mode 100644 index 0000000000000000000000000000000000000000..55135eed37a42945480b29271cf87dc5920dcb10 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/background.py @@ -0,0 +1,36 @@ +from __future__ import annotations + +from collections.abc import Callable, Sequence +from typing import Any, ParamSpec + +from starlette._utils import is_async_callable +from starlette.concurrency import run_in_threadpool + +P = ParamSpec("P") + + +class BackgroundTask: + def __init__(self, func: Callable[P, Any], *args: P.args, **kwargs: P.kwargs) -> None: + self.func = func + self.args = args + self.kwargs = kwargs + self.is_async = is_async_callable(func) + + async def __call__(self) -> None: + if self.is_async: + await self.func(*self.args, **self.kwargs) + else: + await run_in_threadpool(self.func, *self.args, **self.kwargs) + + +class BackgroundTasks(BackgroundTask): + def __init__(self, tasks: Sequence[BackgroundTask] | None = None): + self.tasks = list(tasks) if tasks else [] + + def add_task(self, func: Callable[P, Any], *args: P.args, **kwargs: P.kwargs) -> None: + task = BackgroundTask(func, *args, **kwargs) + self.tasks.append(task) + + async def __call__(self) -> None: + for task in self.tasks: + await task() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/concurrency.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/concurrency.py new file mode 100644 index 0000000000000000000000000000000000000000..beb162bbb9303e7f11c421d2c34324344754cd49 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/concurrency.py @@ -0,0 +1,57 @@ +from __future__ import annotations + +import functools +import warnings +from collections.abc import AsyncIterator, Callable, Coroutine, Iterable, Iterator +from typing import ParamSpec, TypeVar + +import anyio.to_thread + +P = ParamSpec("P") +T = TypeVar("T") + + +async def run_until_first_complete(*args: tuple[Callable, dict]) -> None: # type: ignore[type-arg] + warnings.warn( + "run_until_first_complete is deprecated and will be removed in a future version.", + DeprecationWarning, + ) + + async with anyio.create_task_group() as task_group: + + async def run(func: Callable[[], Coroutine]) -> None: # type: ignore[type-arg] + await func() + task_group.cancel_scope.cancel() + + for func, kwargs in args: + task_group.start_soon(run, functools.partial(func, **kwargs)) + + +async def run_in_threadpool(func: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> T: + func = functools.partial(func, *args, **kwargs) + return await anyio.to_thread.run_sync(func) + + +class _StopIteration(Exception): + pass + + +def _next(iterator: Iterator[T]) -> T: + # We can't raise `StopIteration` from within the threadpool iterator + # and catch it outside that context, so we coerce them into a different + # exception type. + try: + return next(iterator) + except StopIteration: + raise _StopIteration + + +async def iterate_in_threadpool( + iterator: Iterable[T], +) -> AsyncIterator[T]: + as_iterator = iter(iterator) + while True: + try: + yield await anyio.to_thread.run_sync(_next, as_iterator) + except _StopIteration: + break diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/config.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/config.py new file mode 100644 index 0000000000000000000000000000000000000000..56c25ca3b9286d20a5ee722cf4ff4ba04267668b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/config.py @@ -0,0 +1,140 @@ +from __future__ import annotations + +import os +import warnings +from collections.abc import Callable, Iterator, Mapping, MutableMapping +from pathlib import Path +from typing import Any, TypeVar, overload + + +class undefined: + pass + + +class EnvironError(Exception): + pass + + +class Environ(MutableMapping[str, str]): + def __init__(self, environ: MutableMapping[str, str] = os.environ): + self._environ = environ + self._has_been_read: set[str] = set() + + def __getitem__(self, key: str) -> str: + self._has_been_read.add(key) + return self._environ.__getitem__(key) + + def __setitem__(self, key: str, value: str) -> None: + if key in self._has_been_read: + raise EnvironError(f"Attempting to set environ['{key}'], but the value has already been read.") + self._environ.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + if key in self._has_been_read: + raise EnvironError(f"Attempting to delete environ['{key}'], but the value has already been read.") + self._environ.__delitem__(key) + + def __iter__(self) -> Iterator[str]: + return iter(self._environ) + + def __len__(self) -> int: + return len(self._environ) + + +environ = Environ() + +T = TypeVar("T") + + +class Config: + def __init__( + self, + env_file: str | Path | None = None, + environ: Mapping[str, str] = environ, + env_prefix: str = "", + encoding: str = "utf-8", + ) -> None: + self.environ = environ + self.env_prefix = env_prefix + self.file_values: dict[str, str] = {} + if env_file is not None: + if not os.path.isfile(env_file): + warnings.warn(f"Config file '{env_file}' not found.") + else: + self.file_values = self._read_file(env_file, encoding) + + @overload + def __call__(self, key: str, *, default: None) -> str | None: ... + + @overload + def __call__(self, key: str, cast: type[T], default: T = ...) -> T: ... + + @overload + def __call__(self, key: str, cast: type[str] = ..., default: str = ...) -> str: ... + + @overload + def __call__( + self, + key: str, + cast: Callable[[Any], T] = ..., + default: Any = ..., + ) -> T: ... + + @overload + def __call__(self, key: str, cast: type[str] = ..., default: T = ...) -> T | str: ... + + def __call__( + self, + key: str, + cast: Callable[[Any], Any] | None = None, + default: Any = undefined, + ) -> Any: + return self.get(key, cast, default) + + def get( + self, + key: str, + cast: Callable[[Any], Any] | None = None, + default: Any = undefined, + ) -> Any: + key = self.env_prefix + key + if key in self.environ: + value = self.environ[key] + return self._perform_cast(key, value, cast) + if key in self.file_values: + value = self.file_values[key] + return self._perform_cast(key, value, cast) + if default is not undefined: + return self._perform_cast(key, default, cast) + raise KeyError(f"Config '{key}' is missing, and has no default.") + + def _read_file(self, file_name: str | Path, encoding: str) -> dict[str, str]: + file_values: dict[str, str] = {} + with open(file_name, encoding=encoding) as input_file: + for line in input_file.readlines(): + line = line.strip() + if "=" in line and not line.startswith("#"): + key, value = line.split("=", 1) + key = key.strip() + value = value.strip().strip("\"'") + file_values[key] = value + return file_values + + def _perform_cast( + self, + key: str, + value: Any, + cast: Callable[[Any], Any] | None = None, + ) -> Any: + if cast is None or value is None: + return value + elif cast is bool and isinstance(value, str): + mapping = {"true": True, "1": True, "false": False, "0": False} + value = value.lower() + if value not in mapping: + raise ValueError(f"Config '{key}' has value '{value}'. Not a valid bool.") + return mapping[value] + try: + return cast(value) + except (TypeError, ValueError): + raise ValueError(f"Config '{key}' has value '{value}'. Not a valid {cast.__name__}.") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/convertors.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/convertors.py new file mode 100644 index 0000000000000000000000000000000000000000..72b1cf9fdfb6d7f5be61f648a9ae016deb45012b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/convertors.py @@ -0,0 +1,89 @@ +from __future__ import annotations + +import math +import uuid +from typing import Any, ClassVar, Generic, TypeVar + +T = TypeVar("T") + + +class Convertor(Generic[T]): + regex: ClassVar[str] = "" + + def convert(self, value: str) -> T: + raise NotImplementedError() # pragma: no cover + + def to_string(self, value: T) -> str: + raise NotImplementedError() # pragma: no cover + + +class StringConvertor(Convertor[str]): + regex = "[^/]+" + + def convert(self, value: str) -> str: + return value + + def to_string(self, value: str) -> str: + value = str(value) + assert "/" not in value, "May not contain path separators" + assert value, "Must not be empty" + return value + + +class PathConvertor(Convertor[str]): + regex = ".*" + + def convert(self, value: str) -> str: + return str(value) + + def to_string(self, value: str) -> str: + return str(value) + + +class IntegerConvertor(Convertor[int]): + regex = "[0-9]+" + + def convert(self, value: str) -> int: + return int(value) + + def to_string(self, value: int) -> str: + value = int(value) + assert value >= 0, "Negative integers are not supported" + return str(value) + + +class FloatConvertor(Convertor[float]): + regex = r"[0-9]+(\.[0-9]+)?" + + def convert(self, value: str) -> float: + return float(value) + + def to_string(self, value: float) -> str: + value = float(value) + assert value >= 0.0, "Negative floats are not supported" + assert not math.isnan(value), "NaN values are not supported" + assert not math.isinf(value), "Infinite values are not supported" + return ("%0.20f" % value).rstrip("0").rstrip(".") + + +class UUIDConvertor(Convertor[uuid.UUID]): + regex = "[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}" + + def convert(self, value: str) -> uuid.UUID: + return uuid.UUID(value) + + def to_string(self, value: uuid.UUID) -> str: + return str(value) + + +CONVERTOR_TYPES: dict[str, Convertor[Any]] = { + "str": StringConvertor(), + "path": PathConvertor(), + "int": IntegerConvertor(), + "float": FloatConvertor(), + "uuid": UUIDConvertor(), +} + + +def register_url_convertor(key: str, convertor: Convertor[Any]) -> None: + CONVERTOR_TYPES[key] = convertor diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/datastructures.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/datastructures.py new file mode 100644 index 0000000000000000000000000000000000000000..615874c9c3b3208d9e3cc8b3e8f5955b193e9d65 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/datastructures.py @@ -0,0 +1,706 @@ +from __future__ import annotations + +from collections.abc import ItemsView, Iterable, Iterator, KeysView, Mapping, MutableMapping, Sequence, ValuesView +from shlex import shlex +from typing import ( + Any, + BinaryIO, + NamedTuple, + TypeVar, + cast, +) +from urllib.parse import SplitResult, parse_qsl, urlencode, urlsplit + +from starlette.concurrency import run_in_threadpool +from starlette.types import Scope + + +class Address(NamedTuple): + host: str + port: int + + +_KeyType = TypeVar("_KeyType") +# Mapping keys are invariant but their values are covariant since +# you can only read them +# that is, you can't do `Mapping[str, Animal]()["fido"] = Dog()` +_CovariantValueType = TypeVar("_CovariantValueType", covariant=True) + + +class URL: + def __init__( + self, + url: str = "", + scope: Scope | None = None, + **components: Any, + ) -> None: + if scope is not None: + assert not url, 'Cannot set both "url" and "scope".' + assert not components, 'Cannot set both "scope" and "**components".' + scheme = scope.get("scheme", "http") + server = scope.get("server", None) + path = scope["path"] + query_string = scope.get("query_string", b"") + + host_header = None + for key, value in scope["headers"]: + if key == b"host": + host_header = value.decode("latin-1") + break + + if host_header is not None: + url = f"{scheme}://{host_header}{path}" + elif server is None: + url = path + else: + host, port = server + default_port = {"http": 80, "https": 443, "ws": 80, "wss": 443}[scheme] + if port == default_port: + url = f"{scheme}://{host}{path}" + else: + url = f"{scheme}://{host}:{port}{path}" + + if query_string: + url += "?" + query_string.decode() + elif components: + assert not url, 'Cannot set both "url" and "**components".' + url = URL("").replace(**components).components.geturl() + + self._url = url + + @property + def components(self) -> SplitResult: + if not hasattr(self, "_components"): + self._components = urlsplit(self._url) + return self._components + + @property + def scheme(self) -> str: + return self.components.scheme + + @property + def netloc(self) -> str: + return self.components.netloc + + @property + def path(self) -> str: + return self.components.path + + @property + def query(self) -> str: + return self.components.query + + @property + def fragment(self) -> str: + return self.components.fragment + + @property + def username(self) -> None | str: + return self.components.username + + @property + def password(self) -> None | str: + return self.components.password + + @property + def hostname(self) -> None | str: + return self.components.hostname + + @property + def port(self) -> int | None: + return self.components.port + + @property + def is_secure(self) -> bool: + return self.scheme in ("https", "wss") + + def replace(self, **kwargs: Any) -> URL: + if "username" in kwargs or "password" in kwargs or "hostname" in kwargs or "port" in kwargs: + hostname = kwargs.pop("hostname", None) + port = kwargs.pop("port", self.port) + username = kwargs.pop("username", self.username) + password = kwargs.pop("password", self.password) + + if hostname is None: + netloc = self.netloc + _, _, hostname = netloc.rpartition("@") + + if hostname[-1] != "]": + hostname = hostname.rsplit(":", 1)[0] + + netloc = hostname + if port is not None: + netloc += f":{port}" + if username is not None: + userpass = username + if password is not None: + userpass += f":{password}" + netloc = f"{userpass}@{netloc}" + + kwargs["netloc"] = netloc + + components = self.components._replace(**kwargs) + return self.__class__(components.geturl()) + + def include_query_params(self, **kwargs: Any) -> URL: + params = MultiDict(parse_qsl(self.query, keep_blank_values=True)) + params.update({str(key): str(value) for key, value in kwargs.items()}) + query = urlencode(params.multi_items()) + return self.replace(query=query) + + def replace_query_params(self, **kwargs: Any) -> URL: + query = urlencode([(str(key), str(value)) for key, value in kwargs.items()]) + return self.replace(query=query) + + def remove_query_params(self, keys: str | Sequence[str]) -> URL: + if isinstance(keys, str): + keys = [keys] + params = MultiDict(parse_qsl(self.query, keep_blank_values=True)) + for key in keys: + params.pop(key, None) + query = urlencode(params.multi_items()) + return self.replace(query=query) + + def __eq__(self, other: Any) -> bool: + return str(self) == str(other) + + def __str__(self) -> str: + return self._url + + def __repr__(self) -> str: + url = str(self) + if self.password: + url = str(self.replace(password="********")) + return f"{self.__class__.__name__}({repr(url)})" + + +class URLPath(str): + """ + A URL path string that may also hold an associated protocol and/or host. + Used by the routing to return `url_path_for` matches. + """ + + def __new__(cls, path: str, protocol: str = "", host: str = "") -> URLPath: + assert protocol in ("http", "websocket", "") + return str.__new__(cls, path) + + def __init__(self, path: str, protocol: str = "", host: str = "") -> None: + self.protocol = protocol + self.host = host + + def make_absolute_url(self, base_url: str | URL) -> URL: + if isinstance(base_url, str): + base_url = URL(base_url) + if self.protocol: + scheme = { + "http": {True: "https", False: "http"}, + "websocket": {True: "wss", False: "ws"}, + }[self.protocol][base_url.is_secure] + else: + scheme = base_url.scheme + + netloc = self.host or base_url.netloc + path = base_url.path.rstrip("/") + str(self) + return URL(scheme=scheme, netloc=netloc, path=path) + + +class Secret: + """ + Holds a string value that should not be revealed in tracebacks etc. + You should cast the value to `str` at the point it is required. + """ + + def __init__(self, value: str): + self._value = value + + def __repr__(self) -> str: + class_name = self.__class__.__name__ + return f"{class_name}('**********')" + + def __str__(self) -> str: + return self._value + + def __bool__(self) -> bool: + return bool(self._value) + + +class CommaSeparatedStrings(Sequence[str]): + def __init__(self, value: str | Sequence[str]): + if isinstance(value, str): + splitter = shlex(value, posix=True) + splitter.whitespace = "," + splitter.whitespace_split = True + self._items = [item.strip() for item in splitter] + else: + self._items = list(value) + + def __len__(self) -> int: + return len(self._items) + + def __getitem__(self, index: int | slice) -> Any: + return self._items[index] + + def __iter__(self) -> Iterator[str]: + return iter(self._items) + + def __repr__(self) -> str: + class_name = self.__class__.__name__ + items = [item for item in self] + return f"{class_name}({items!r})" + + def __str__(self) -> str: + return ", ".join(repr(item) for item in self) + + +class ImmutableMultiDict(Mapping[_KeyType, _CovariantValueType]): + _dict: dict[_KeyType, _CovariantValueType] + + def __init__( + self, + *args: ImmutableMultiDict[_KeyType, _CovariantValueType] + | Mapping[_KeyType, _CovariantValueType] + | Iterable[tuple[_KeyType, _CovariantValueType]], + **kwargs: Any, + ) -> None: + assert len(args) < 2, "Too many arguments." + + value: Any = args[0] if args else [] + if kwargs: + value = ImmutableMultiDict(value).multi_items() + ImmutableMultiDict(kwargs).multi_items() + + if not value: + _items: list[tuple[Any, Any]] = [] + elif hasattr(value, "multi_items"): + value = cast(ImmutableMultiDict[_KeyType, _CovariantValueType], value) + _items = list(value.multi_items()) + elif hasattr(value, "items"): + value = cast(Mapping[_KeyType, _CovariantValueType], value) + _items = list(value.items()) + else: + value = cast("list[tuple[Any, Any]]", value) + _items = list(value) + + self._dict = {k: v for k, v in _items} + self._list = _items + + def getlist(self, key: Any) -> list[_CovariantValueType]: + return [item_value for item_key, item_value in self._list if item_key == key] + + def keys(self) -> KeysView[_KeyType]: + return self._dict.keys() + + def values(self) -> ValuesView[_CovariantValueType]: + return self._dict.values() + + def items(self) -> ItemsView[_KeyType, _CovariantValueType]: + return self._dict.items() + + def multi_items(self) -> list[tuple[_KeyType, _CovariantValueType]]: + return list(self._list) + + def __getitem__(self, key: _KeyType) -> _CovariantValueType: + return self._dict[key] + + def __contains__(self, key: Any) -> bool: + return key in self._dict + + def __iter__(self) -> Iterator[_KeyType]: + return iter(self.keys()) + + def __len__(self) -> int: + return len(self._dict) + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, self.__class__): + return False + return sorted(self._list) == sorted(other._list) + + def __repr__(self) -> str: + class_name = self.__class__.__name__ + items = self.multi_items() + return f"{class_name}({items!r})" + + +class MultiDict(ImmutableMultiDict[Any, Any]): + def __setitem__(self, key: Any, value: Any) -> None: + self.setlist(key, [value]) + + def __delitem__(self, key: Any) -> None: + self._list = [(k, v) for k, v in self._list if k != key] + del self._dict[key] + + def pop(self, key: Any, default: Any = None) -> Any: + self._list = [(k, v) for k, v in self._list if k != key] + return self._dict.pop(key, default) + + def popitem(self) -> tuple[Any, Any]: + key, value = self._dict.popitem() + self._list = [(k, v) for k, v in self._list if k != key] + return key, value + + def poplist(self, key: Any) -> list[Any]: + values = [v for k, v in self._list if k == key] + self.pop(key) + return values + + def clear(self) -> None: + self._dict.clear() + self._list.clear() + + def setdefault(self, key: Any, default: Any = None) -> Any: + if key not in self: + self._dict[key] = default + self._list.append((key, default)) + + return self[key] + + def setlist(self, key: Any, values: list[Any]) -> None: + if not values: + self.pop(key, None) + else: + existing_items = [(k, v) for (k, v) in self._list if k != key] + self._list = existing_items + [(key, value) for value in values] + self._dict[key] = values[-1] + + def append(self, key: Any, value: Any) -> None: + self._list.append((key, value)) + self._dict[key] = value + + def update( + self, + *args: MultiDict | Mapping[Any, Any] | list[tuple[Any, Any]], + **kwargs: Any, + ) -> None: + value = MultiDict(*args, **kwargs) + existing_items = [(k, v) for (k, v) in self._list if k not in value.keys()] + self._list = existing_items + value.multi_items() + self._dict.update(value) + + +class QueryParams(ImmutableMultiDict[str, str]): + """ + An immutable multidict. + """ + + def __init__( + self, + *args: ImmutableMultiDict[Any, Any] | Mapping[Any, Any] | list[tuple[Any, Any]] | str | bytes, + **kwargs: Any, + ) -> None: + assert len(args) < 2, "Too many arguments." + + value = args[0] if args else [] + + if isinstance(value, str): + super().__init__(parse_qsl(value, keep_blank_values=True), **kwargs) + elif isinstance(value, bytes): + super().__init__(parse_qsl(value.decode("latin-1"), keep_blank_values=True), **kwargs) + else: + super().__init__(*args, **kwargs) # type: ignore[arg-type] + self._list = [(str(k), str(v)) for k, v in self._list] + self._dict = {str(k): str(v) for k, v in self._dict.items()} + + def __str__(self) -> str: + return urlencode(self._list) + + def __repr__(self) -> str: + class_name = self.__class__.__name__ + query_string = str(self) + return f"{class_name}({query_string!r})" + + +class UploadFile: + """ + An uploaded file included as part of the request data. + """ + + def __init__( + self, + file: BinaryIO, + *, + size: int | None = None, + filename: str | None = None, + headers: Headers | None = None, + ) -> None: + self.filename = filename + self.file = file + self.size = size + self.headers = headers or Headers() + + # Capture max size from SpooledTemporaryFile if one is provided. This slightly speeds up future checks. + # Note 0 means unlimited mirroring SpooledTemporaryFile's __init__ + self._max_mem_size = getattr(self.file, "_max_size", 0) + + @property + def content_type(self) -> str | None: + return self.headers.get("content-type", None) + + @property + def _in_memory(self) -> bool: + # check for SpooledTemporaryFile._rolled + rolled_to_disk = getattr(self.file, "_rolled", True) + return not rolled_to_disk + + def _will_roll(self, size_to_add: int) -> bool: + # If we're not in_memory then we will always roll + if not self._in_memory: + return True + + # Check for SpooledTemporaryFile._max_size + future_size = self.file.tell() + size_to_add + return bool(future_size > self._max_mem_size) if self._max_mem_size else False + + async def write(self, data: bytes) -> None: + new_data_len = len(data) + if self.size is not None: + self.size += new_data_len + + if self._will_roll(new_data_len): + await run_in_threadpool(self.file.write, data) + else: + self.file.write(data) + + async def read(self, size: int = -1) -> bytes: + if self._in_memory: + return self.file.read(size) + return await run_in_threadpool(self.file.read, size) + + async def seek(self, offset: int) -> None: + if self._in_memory: + self.file.seek(offset) + else: + await run_in_threadpool(self.file.seek, offset) + + async def close(self) -> None: + if self._in_memory: + self.file.close() + else: + await run_in_threadpool(self.file.close) + + def __repr__(self) -> str: + return f"{self.__class__.__name__}(filename={self.filename!r}, size={self.size!r}, headers={self.headers!r})" + + +class FormData(ImmutableMultiDict[str, UploadFile | str]): + """ + An immutable multidict, containing both file uploads and text input. + """ + + def __init__( + self, + *args: FormData | Mapping[str, str | UploadFile] | list[tuple[str, str | UploadFile]], + **kwargs: str | UploadFile, + ) -> None: + super().__init__(*args, **kwargs) + + async def close(self) -> None: + for key, value in self.multi_items(): + if isinstance(value, UploadFile): + await value.close() + + +class Headers(Mapping[str, str]): + """ + An immutable, case-insensitive multidict. + """ + + def __init__( + self, + headers: Mapping[str, str] | None = None, + raw: list[tuple[bytes, bytes]] | None = None, + scope: MutableMapping[str, Any] | None = None, + ) -> None: + self._list: list[tuple[bytes, bytes]] = [] + if headers is not None: + assert raw is None, 'Cannot set both "headers" and "raw".' + assert scope is None, 'Cannot set both "headers" and "scope".' + self._list = [(key.lower().encode("latin-1"), value.encode("latin-1")) for key, value in headers.items()] + elif raw is not None: + assert scope is None, 'Cannot set both "raw" and "scope".' + self._list = raw + elif scope is not None: + # scope["headers"] isn't necessarily a list + # it might be a tuple or other iterable + self._list = scope["headers"] = list(scope["headers"]) + + @property + def raw(self) -> list[tuple[bytes, bytes]]: + return list(self._list) + + def keys(self) -> list[str]: # type: ignore[override] + return [key.decode("latin-1") for key, value in self._list] + + def values(self) -> list[str]: # type: ignore[override] + return [value.decode("latin-1") for key, value in self._list] + + def items(self) -> list[tuple[str, str]]: # type: ignore[override] + return [(key.decode("latin-1"), value.decode("latin-1")) for key, value in self._list] + + def getlist(self, key: str) -> list[str]: + get_header_key = key.lower().encode("latin-1") + return [item_value.decode("latin-1") for item_key, item_value in self._list if item_key == get_header_key] + + def mutablecopy(self) -> MutableHeaders: + return MutableHeaders(raw=self._list[:]) + + def __getitem__(self, key: str) -> str: + get_header_key = key.lower().encode("latin-1") + for header_key, header_value in self._list: + if header_key == get_header_key: + return header_value.decode("latin-1") + raise KeyError(key) + + def __contains__(self, key: Any) -> bool: + get_header_key = key.lower().encode("latin-1") + for header_key, header_value in self._list: + if header_key == get_header_key: + return True + return False + + def __iter__(self) -> Iterator[Any]: + return iter(self.keys()) + + def __len__(self) -> int: + return len(self._list) + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, Headers): + return False + return sorted(self._list) == sorted(other._list) + + def __repr__(self) -> str: + class_name = self.__class__.__name__ + as_dict = dict(self.items()) + if len(as_dict) == len(self): + return f"{class_name}({as_dict!r})" + return f"{class_name}(raw={self.raw!r})" + + +class MutableHeaders(Headers): + def __setitem__(self, key: str, value: str) -> None: + """ + Set the header `key` to `value`, removing any duplicate entries. + Retains insertion order. + """ + set_key = key.lower().encode("latin-1") + set_value = value.encode("latin-1") + + found_indexes: list[int] = [] + for idx, (item_key, item_value) in enumerate(self._list): + if item_key == set_key: + found_indexes.append(idx) + + for idx in reversed(found_indexes[1:]): + del self._list[idx] + + if found_indexes: + idx = found_indexes[0] + self._list[idx] = (set_key, set_value) + else: + self._list.append((set_key, set_value)) + + def __delitem__(self, key: str) -> None: + """ + Remove the header `key`. + """ + del_key = key.lower().encode("latin-1") + + pop_indexes: list[int] = [] + for idx, (item_key, item_value) in enumerate(self._list): + if item_key == del_key: + pop_indexes.append(idx) + + for idx in reversed(pop_indexes): + del self._list[idx] + + def __ior__(self, other: Mapping[str, str]) -> MutableHeaders: + if not isinstance(other, Mapping): + raise TypeError(f"Expected a mapping but got {other.__class__.__name__}") + self.update(other) + return self + + def __or__(self, other: Mapping[str, str]) -> MutableHeaders: + if not isinstance(other, Mapping): + raise TypeError(f"Expected a mapping but got {other.__class__.__name__}") + new = self.mutablecopy() + new.update(other) + return new + + @property + def raw(self) -> list[tuple[bytes, bytes]]: + return self._list + + def setdefault(self, key: str, value: str) -> str: + """ + If the header `key` does not exist, then set it to `value`. + Returns the header value. + """ + set_key = key.lower().encode("latin-1") + set_value = value.encode("latin-1") + + for idx, (item_key, item_value) in enumerate(self._list): + if item_key == set_key: + return item_value.decode("latin-1") + self._list.append((set_key, set_value)) + return value + + def update(self, other: Mapping[str, str]) -> None: + for key, val in other.items(): + self[key] = val + + def append(self, key: str, value: str) -> None: + """ + Append a header, preserving any duplicate entries. + """ + append_key = key.lower().encode("latin-1") + append_value = value.encode("latin-1") + self._list.append((append_key, append_value)) + + def add_vary_header(self, vary: str) -> None: + existing = self.get("vary") + if existing is not None: + vary = ", ".join([existing, vary]) + self["vary"] = vary + + +class State: + """ + An object that can be used to store arbitrary state. + + Used for `request.state` and `app.state`. + """ + + _state: dict[str, Any] + + def __init__(self, state: dict[str, Any] | None = None): + if state is None: + state = {} + super().__setattr__("_state", state) + + def __setattr__(self, key: Any, value: Any) -> None: + self._state[key] = value + + def __getattr__(self, key: Any) -> Any: + try: + return self._state[key] + except KeyError: + message = "'{}' object has no attribute '{}'" + raise AttributeError(message.format(self.__class__.__name__, key)) + + def __delattr__(self, key: Any) -> None: + del self._state[key] + + def __getitem__(self, key: str) -> Any: + return self._state[key] + + def __setitem__(self, key: str, value: Any) -> None: + self._state[key] = value + + def __delitem__(self, key: str) -> None: + del self._state[key] + + def __iter__(self) -> Iterator[str]: + return iter(self._state) + + def __len__(self) -> int: + return len(self._state) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/endpoints.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/endpoints.py new file mode 100644 index 0000000000000000000000000000000000000000..aa067fc4ccdd0a39fb86b8255a1d0932624e9d2e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/endpoints.py @@ -0,0 +1,123 @@ +from __future__ import annotations + +import json +from collections.abc import Callable, Generator +from typing import Any, Literal + +from starlette import status +from starlette._utils import is_async_callable +from starlette.concurrency import run_in_threadpool +from starlette.exceptions import HTTPException +from starlette.requests import Request +from starlette.responses import PlainTextResponse, Response +from starlette.types import Message, Receive, Scope, Send +from starlette.websockets import WebSocket + + +class HTTPEndpoint: + def __init__(self, scope: Scope, receive: Receive, send: Send) -> None: + assert scope["type"] == "http" + self.scope = scope + self.receive = receive + self.send = send + self._allowed_methods = [ + method + for method in ("GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS") + if getattr(self, method.lower(), None) is not None + ] + + def __await__(self) -> Generator[Any, None, None]: + return self.dispatch().__await__() + + async def dispatch(self) -> None: + request = Request(self.scope, receive=self.receive) + handler_name = "get" if request.method == "HEAD" and not hasattr(self, "head") else request.method.lower() + + handler: Callable[[Request], Any] = getattr(self, handler_name, self.method_not_allowed) + is_async = is_async_callable(handler) + if is_async: + response = await handler(request) + else: + response = await run_in_threadpool(handler, request) + await response(self.scope, self.receive, self.send) + + async def method_not_allowed(self, request: Request) -> Response: + # If we're running inside a starlette application then raise an + # exception, so that the configurable exception handler can deal with + # returning the response. For plain ASGI apps, just return the response. + headers = {"Allow": ", ".join(self._allowed_methods)} + if "app" in self.scope: + raise HTTPException(status_code=405, headers=headers) + return PlainTextResponse("Method Not Allowed", status_code=405, headers=headers) + + +class WebSocketEndpoint: + encoding: Literal["text", "bytes", "json"] | None = None + + def __init__(self, scope: Scope, receive: Receive, send: Send) -> None: + assert scope["type"] == "websocket" + self.scope = scope + self.receive = receive + self.send = send + + def __await__(self) -> Generator[Any, None, None]: + return self.dispatch().__await__() + + async def dispatch(self) -> None: + websocket = WebSocket(self.scope, receive=self.receive, send=self.send) + await self.on_connect(websocket) + + close_code = status.WS_1000_NORMAL_CLOSURE + + try: + while True: + message = await websocket.receive() + if message["type"] == "websocket.receive": + data = await self.decode(websocket, message) + await self.on_receive(websocket, data) + elif message["type"] == "websocket.disconnect": # pragma: no branch + close_code = int(message.get("code") or status.WS_1000_NORMAL_CLOSURE) + break + except Exception as exc: + close_code = status.WS_1011_INTERNAL_ERROR + raise exc + finally: + await self.on_disconnect(websocket, close_code) + + async def decode(self, websocket: WebSocket, message: Message) -> Any: + if self.encoding == "text": + if "text" not in message: + await websocket.close(code=status.WS_1003_UNSUPPORTED_DATA) + raise RuntimeError("Expected text websocket messages, but got bytes") + return message["text"] + + elif self.encoding == "bytes": + if "bytes" not in message: + await websocket.close(code=status.WS_1003_UNSUPPORTED_DATA) + raise RuntimeError("Expected bytes websocket messages, but got text") + return message["bytes"] + + elif self.encoding == "json": + if message.get("text") is not None: + text = message["text"] + else: + text = message["bytes"].decode("utf-8") + + try: + return json.loads(text) + except json.decoder.JSONDecodeError: + await websocket.close(code=status.WS_1003_UNSUPPORTED_DATA) + raise RuntimeError("Malformed JSON data received.") + + assert self.encoding is None, f"Unsupported 'encoding' attribute {self.encoding}" + return message["text"] if message.get("text") else message["bytes"] + + async def on_connect(self, websocket: WebSocket) -> None: + """Override to handle an incoming websocket connection""" + await websocket.accept() + + async def on_receive(self, websocket: WebSocket, data: Any) -> None: + """Override to handle an incoming websocket message""" + + async def on_disconnect(self, websocket: WebSocket, close_code: int) -> None: + """Override to handle a disconnecting websocket""" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/exceptions.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..9ad3527b94ce034bb3967b3bf0969403118d4284 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/exceptions.py @@ -0,0 +1,33 @@ +from __future__ import annotations + +import http +from collections.abc import Mapping + + +class HTTPException(Exception): + def __init__(self, status_code: int, detail: str | None = None, headers: Mapping[str, str] | None = None) -> None: + if detail is None: + detail = http.HTTPStatus(status_code).phrase + self.status_code = status_code + self.detail = detail + self.headers = headers + + def __str__(self) -> str: + return f"{self.status_code}: {self.detail}" + + def __repr__(self) -> str: + class_name = self.__class__.__name__ + return f"{class_name}(status_code={self.status_code!r}, detail={self.detail!r})" + + +class WebSocketException(Exception): + def __init__(self, code: int, reason: str | None = None) -> None: + self.code = code + self.reason = reason or "" + + def __str__(self) -> str: + return f"{self.code}: {self.reason}" + + def __repr__(self) -> str: + class_name = self.__class__.__name__ + return f"{class_name}(code={self.code!r}, reason={self.reason!r})" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/formparsers.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/formparsers.py new file mode 100644 index 0000000000000000000000000000000000000000..8e389dec7f380c72fc0d9ee7d986f7b4522160ab --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/formparsers.py @@ -0,0 +1,276 @@ +from __future__ import annotations + +from collections.abc import AsyncGenerator +from dataclasses import dataclass, field +from enum import Enum +from tempfile import SpooledTemporaryFile +from typing import TYPE_CHECKING +from urllib.parse import unquote_plus + +from starlette.datastructures import FormData, Headers, UploadFile + +if TYPE_CHECKING: + import python_multipart as multipart + from python_multipart.multipart import MultipartCallbacks, QuerystringCallbacks, parse_options_header +else: + try: + try: + import python_multipart as multipart + from python_multipart.multipart import parse_options_header + except ModuleNotFoundError: # pragma: no cover + import multipart + from multipart.multipart import parse_options_header + except ModuleNotFoundError: # pragma: no cover + multipart = None + parse_options_header = None + + +class FormMessage(Enum): + FIELD_START = 1 + FIELD_NAME = 2 + FIELD_DATA = 3 + FIELD_END = 4 + END = 5 + + +@dataclass +class MultipartPart: + content_disposition: bytes | None = None + field_name: str = "" + data: bytearray = field(default_factory=bytearray) + file: UploadFile | None = None + item_headers: list[tuple[bytes, bytes]] = field(default_factory=list) + + +def _user_safe_decode(src: bytes | bytearray, codec: str) -> str: + try: + return src.decode(codec) + except (UnicodeDecodeError, LookupError): + return src.decode("latin-1") + + +class MultiPartException(Exception): + def __init__(self, message: str) -> None: + self.message = message + + +class FormParser: + def __init__(self, headers: Headers, stream: AsyncGenerator[bytes, None]) -> None: + assert multipart is not None, "The `python-multipart` library must be installed to use form parsing." + self.headers = headers + self.stream = stream + self.messages: list[tuple[FormMessage, bytes]] = [] + + def on_field_start(self) -> None: + message = (FormMessage.FIELD_START, b"") + self.messages.append(message) + + def on_field_name(self, data: bytes, start: int, end: int) -> None: + message = (FormMessage.FIELD_NAME, data[start:end]) + self.messages.append(message) + + def on_field_data(self, data: bytes, start: int, end: int) -> None: + message = (FormMessage.FIELD_DATA, data[start:end]) + self.messages.append(message) + + def on_field_end(self) -> None: + message = (FormMessage.FIELD_END, b"") + self.messages.append(message) + + def on_end(self) -> None: + message = (FormMessage.END, b"") + self.messages.append(message) + + async def parse(self) -> FormData: + # Callbacks dictionary. + callbacks: QuerystringCallbacks = { + "on_field_start": self.on_field_start, + "on_field_name": self.on_field_name, + "on_field_data": self.on_field_data, + "on_field_end": self.on_field_end, + "on_end": self.on_end, + } + + # Create the parser. + parser = multipart.QuerystringParser(callbacks) + field_name = b"" + field_value = b"" + + items: list[tuple[str, str | UploadFile]] = [] + + # Feed the parser with data from the request. + async for chunk in self.stream: + if chunk: + parser.write(chunk) + else: + parser.finalize() + messages = list(self.messages) + self.messages.clear() + for message_type, message_bytes in messages: + if message_type == FormMessage.FIELD_START: + field_name = b"" + field_value = b"" + elif message_type == FormMessage.FIELD_NAME: + field_name += message_bytes + elif message_type == FormMessage.FIELD_DATA: + field_value += message_bytes + elif message_type == FormMessage.FIELD_END: + name = unquote_plus(field_name.decode("latin-1")) + value = unquote_plus(field_value.decode("latin-1")) + items.append((name, value)) + + return FormData(items) + + +class MultiPartParser: + spool_max_size = 1024 * 1024 # 1MB + """The maximum size of the spooled temporary file used to store file data.""" + max_part_size = 1024 * 1024 # 1MB + """The maximum size of a part in the multipart request.""" + + def __init__( + self, + headers: Headers, + stream: AsyncGenerator[bytes, None], + *, + max_files: int | float = 1000, + max_fields: int | float = 1000, + max_part_size: int = 1024 * 1024, # 1MB + ) -> None: + assert multipart is not None, "The `python-multipart` library must be installed to use form parsing." + self.headers = headers + self.stream = stream + self.max_files = max_files + self.max_fields = max_fields + self.items: list[tuple[str, str | UploadFile]] = [] + self._current_files = 0 + self._current_fields = 0 + self._current_partial_header_name: bytes = b"" + self._current_partial_header_value: bytes = b"" + self._current_part = MultipartPart() + self._charset = "" + self._file_parts_to_write: list[tuple[MultipartPart, bytes]] = [] + self._file_parts_to_finish: list[MultipartPart] = [] + self._files_to_close_on_error: list[SpooledTemporaryFile[bytes]] = [] + self.max_part_size = max_part_size + + def on_part_begin(self) -> None: + self._current_part = MultipartPart() + + def on_part_data(self, data: bytes, start: int, end: int) -> None: + message_bytes = data[start:end] + if self._current_part.file is None: + if len(self._current_part.data) + len(message_bytes) > self.max_part_size: + raise MultiPartException(f"Part exceeded maximum size of {int(self.max_part_size / 1024)}KB.") + self._current_part.data.extend(message_bytes) + else: + self._file_parts_to_write.append((self._current_part, message_bytes)) + + def on_part_end(self) -> None: + if self._current_part.file is None: + self.items.append( + ( + self._current_part.field_name, + _user_safe_decode(self._current_part.data, self._charset), + ) + ) + else: + self._file_parts_to_finish.append(self._current_part) + # The file can be added to the items right now even though it's not + # finished yet, because it will be finished in the `parse()` method, before + # self.items is used in the return value. + self.items.append((self._current_part.field_name, self._current_part.file)) + + def on_header_field(self, data: bytes, start: int, end: int) -> None: + self._current_partial_header_name += data[start:end] + + def on_header_value(self, data: bytes, start: int, end: int) -> None: + self._current_partial_header_value += data[start:end] + + def on_header_end(self) -> None: + field = self._current_partial_header_name.lower() + if field == b"content-disposition": + self._current_part.content_disposition = self._current_partial_header_value + self._current_part.item_headers.append((field, self._current_partial_header_value)) + self._current_partial_header_name = b"" + self._current_partial_header_value = b"" + + def on_headers_finished(self) -> None: + disposition, options = parse_options_header(self._current_part.content_disposition) + try: + self._current_part.field_name = _user_safe_decode(options[b"name"], self._charset) + except KeyError: + raise MultiPartException('The Content-Disposition header field "name" must be provided.') + if b"filename" in options: + self._current_files += 1 + if self._current_files > self.max_files: + raise MultiPartException(f"Too many files. Maximum number of files is {self.max_files}.") + filename = _user_safe_decode(options[b"filename"], self._charset) + tempfile = SpooledTemporaryFile(max_size=self.spool_max_size) + self._files_to_close_on_error.append(tempfile) + self._current_part.file = UploadFile( + file=tempfile, # type: ignore[arg-type] + size=0, + filename=filename, + headers=Headers(raw=self._current_part.item_headers), + ) + else: + self._current_fields += 1 + if self._current_fields > self.max_fields: + raise MultiPartException(f"Too many fields. Maximum number of fields is {self.max_fields}.") + self._current_part.file = None + + def on_end(self) -> None: + pass + + async def parse(self) -> FormData: + # Parse the Content-Type header to get the multipart boundary. + _, params = parse_options_header(self.headers["Content-Type"]) + charset = params.get(b"charset", "utf-8") + if isinstance(charset, bytes): + charset = charset.decode("latin-1") + self._charset = charset + try: + boundary = params[b"boundary"] + except KeyError: + raise MultiPartException("Missing boundary in multipart.") + + # Callbacks dictionary. + callbacks: MultipartCallbacks = { + "on_part_begin": self.on_part_begin, + "on_part_data": self.on_part_data, + "on_part_end": self.on_part_end, + "on_header_field": self.on_header_field, + "on_header_value": self.on_header_value, + "on_header_end": self.on_header_end, + "on_headers_finished": self.on_headers_finished, + "on_end": self.on_end, + } + + # Create the parser. + parser = multipart.MultipartParser(boundary, callbacks) + try: + # Feed the parser with data from the request. + async for chunk in self.stream: + parser.write(chunk) + # Write file data, it needs to use await with the UploadFile methods + # that call the corresponding file methods *in a threadpool*, + # otherwise, if they were called directly in the callback methods above + # (regular, non-async functions), that would block the event loop in + # the main thread. + for part, data in self._file_parts_to_write: + assert part.file # for type checkers + await part.file.write(data) + for part in self._file_parts_to_finish: + assert part.file # for type checkers + await part.file.seek(0) + self._file_parts_to_write.clear() + self._file_parts_to_finish.clear() + except MultiPartException as exc: + # Close all the files if there was an error. + for file in self._files_to_close_on_error: + file.close() + raise exc + + parser.finalize() + return FormData(self.items) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/py.typed b/TTS/Kokoro/.venv/Lib/site-packages/starlette/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/requests.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/requests.py new file mode 100644 index 0000000000000000000000000000000000000000..716f2939628049148978e478ca2119248ff4cc79 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/requests.py @@ -0,0 +1,332 @@ +from __future__ import annotations + +import json +import sys +from collections.abc import AsyncGenerator, Iterator, Mapping +from http import cookies as http_cookies +from typing import TYPE_CHECKING, Any, Generic, NoReturn, cast + +import anyio + +from starlette._utils import AwaitableOrContextManager, AwaitableOrContextManagerWrapper +from starlette.datastructures import URL, Address, FormData, Headers, QueryParams, State +from starlette.exceptions import HTTPException +from starlette.formparsers import FormParser, MultiPartException, MultiPartParser +from starlette.types import Message, Receive, Scope, Send + +if TYPE_CHECKING: + from python_multipart.multipart import parse_options_header + + from starlette.applications import Starlette + from starlette.routing import Router +else: + try: + try: + from python_multipart.multipart import parse_options_header + except ModuleNotFoundError: # pragma: no cover + from multipart.multipart import parse_options_header + except ModuleNotFoundError: # pragma: no cover + parse_options_header = None + +if sys.version_info >= (3, 13): # pragma: no cover + from typing import TypeVar +else: # pragma: no cover + from typing_extensions import TypeVar + +SERVER_PUSH_HEADERS_TO_COPY = { + "accept", + "accept-encoding", + "accept-language", + "cache-control", + "user-agent", +} + + +def cookie_parser(cookie_string: str) -> dict[str, str]: + """ + This function parses a ``Cookie`` HTTP header into a dict of key/value pairs. + + It attempts to mimic browser cookie parsing behavior: browsers and web servers + frequently disregard the spec (RFC 6265) when setting and reading cookies, + so we attempt to suit the common scenarios here. + + This function has been adapted from Django 3.1.0. + Note: we are explicitly _NOT_ using `SimpleCookie.load` because it is based + on an outdated spec and will fail on lots of input we want to support + """ + cookie_dict: dict[str, str] = {} + for chunk in cookie_string.split(";"): + if "=" in chunk: + key, val = chunk.split("=", 1) + else: + # Assume an empty name per + # https://bugzilla.mozilla.org/show_bug.cgi?id=169091 + key, val = "", chunk + key, val = key.strip(), val.strip() + if key or val: + # unquote using Python's algorithm. + cookie_dict[key] = http_cookies._unquote(val) + return cookie_dict + + +class ClientDisconnect(Exception): + pass + + +StateT = TypeVar("StateT", bound=Mapping[str, Any] | State, default=State) + + +class HTTPConnection(Mapping[str, Any], Generic[StateT]): + """ + A base class for incoming HTTP connections, that is used to provide + any functionality that is common to both `Request` and `WebSocket`. + """ + + def __init__(self, scope: Scope, receive: Receive | None = None) -> None: + assert scope["type"] in ("http", "websocket") + self.scope = scope + + def __getitem__(self, key: str) -> Any: + return self.scope[key] + + def __iter__(self) -> Iterator[str]: + return iter(self.scope) + + def __len__(self) -> int: + return len(self.scope) + + # Don't use the `abc.Mapping.__eq__` implementation. + # Connection instances should never be considered equal + # unless `self is other`. + __eq__ = object.__eq__ + __hash__ = object.__hash__ + + @property + def app(self) -> Any: + return self.scope["app"] + + @property + def url(self) -> URL: + if not hasattr(self, "_url"): # pragma: no branch + self._url = URL(scope=self.scope) + return self._url + + @property + def base_url(self) -> URL: + if not hasattr(self, "_base_url"): + base_url_scope = dict(self.scope) + # This is used by request.url_for, it might be used inside a Mount which + # would have its own child scope with its own root_path, but the base URL + # for url_for should still be the top level app root path. + app_root_path = base_url_scope.get("app_root_path", base_url_scope.get("root_path", "")) + path = app_root_path + if not path.endswith("/"): + path += "/" + base_url_scope["path"] = path + base_url_scope["query_string"] = b"" + base_url_scope["root_path"] = app_root_path + self._base_url = URL(scope=base_url_scope) + return self._base_url + + @property + def headers(self) -> Headers: + if not hasattr(self, "_headers"): + self._headers = Headers(scope=self.scope) + return self._headers + + @property + def query_params(self) -> QueryParams: + if not hasattr(self, "_query_params"): # pragma: no branch + self._query_params = QueryParams(self.scope["query_string"]) + return self._query_params + + @property + def path_params(self) -> dict[str, Any]: + return self.scope.get("path_params", {}) + + @property + def cookies(self) -> dict[str, str]: + if not hasattr(self, "_cookies"): + cookies: dict[str, str] = {} + cookie_headers = self.headers.getlist("cookie") + + for header in cookie_headers: + cookies.update(cookie_parser(header)) + + self._cookies = cookies + return self._cookies + + @property + def client(self) -> Address | None: + # client is a 2 item tuple of (host, port), None if missing + host_port = self.scope.get("client") + if host_port is not None: + return Address(*host_port) + return None + + @property + def session(self) -> dict[str, Any]: + assert "session" in self.scope, "SessionMiddleware must be installed to access request.session" + return self.scope["session"] # type: ignore[no-any-return] + + @property + def auth(self) -> Any: + assert "auth" in self.scope, "AuthenticationMiddleware must be installed to access request.auth" + return self.scope["auth"] + + @property + def user(self) -> Any: + assert "user" in self.scope, "AuthenticationMiddleware must be installed to access request.user" + return self.scope["user"] + + @property + def state(self) -> StateT: + if not hasattr(self, "_state"): + # Ensure 'state' has an empty dict if it's not already populated. + self.scope.setdefault("state", {}) + # Create a state instance with a reference to the dict in which it should + # store info + self._state = State(self.scope["state"]) + return cast(StateT, self._state) + + def url_for(self, name: str, /, **path_params: Any) -> URL: + url_path_provider: Router | Starlette | None = self.scope.get("router") or self.scope.get("app") + if url_path_provider is None: + raise RuntimeError("The `url_for` method can only be used inside a Starlette application or with a router.") + url_path = url_path_provider.url_path_for(name, **path_params) + return url_path.make_absolute_url(base_url=self.base_url) + + +async def empty_receive() -> NoReturn: + raise RuntimeError("Receive channel has not been made available") + + +async def empty_send(message: Message) -> NoReturn: + raise RuntimeError("Send channel has not been made available") + + +class Request(HTTPConnection[StateT]): + _form: FormData | None + + def __init__(self, scope: Scope, receive: Receive = empty_receive, send: Send = empty_send): + super().__init__(scope) + assert scope["type"] == "http" + self._receive = receive + self._send = send + self._stream_consumed = False + self._is_disconnected = False + self._form = None + + @property + def method(self) -> str: + return cast(str, self.scope["method"]) + + @property + def receive(self) -> Receive: + return self._receive + + async def stream(self) -> AsyncGenerator[bytes, None]: + if hasattr(self, "_body"): + yield self._body + yield b"" + return + if self._stream_consumed: + raise RuntimeError("Stream consumed") + while not self._stream_consumed: + message = await self._receive() + if message["type"] == "http.request": + body = message.get("body", b"") + if not message.get("more_body", False): + self._stream_consumed = True + if body: + yield body + elif message["type"] == "http.disconnect": # pragma: no branch + self._is_disconnected = True + raise ClientDisconnect() + yield b"" + + async def body(self) -> bytes: + if not hasattr(self, "_body"): + chunks: list[bytes] = [] + async for chunk in self.stream(): + chunks.append(chunk) + self._body = b"".join(chunks) + return self._body + + async def json(self) -> Any: + if not hasattr(self, "_json"): # pragma: no branch + body = await self.body() + self._json = json.loads(body) + return self._json + + async def _get_form( + self, + *, + max_files: int | float = 1000, + max_fields: int | float = 1000, + max_part_size: int = 1024 * 1024, + ) -> FormData: + if self._form is None: # pragma: no branch + assert parse_options_header is not None, ( + "The `python-multipart` library must be installed to use form parsing." + ) + content_type_header = self.headers.get("Content-Type") + content_type: bytes + content_type, _ = parse_options_header(content_type_header) + if content_type == b"multipart/form-data": + try: + multipart_parser = MultiPartParser( + self.headers, + self.stream(), + max_files=max_files, + max_fields=max_fields, + max_part_size=max_part_size, + ) + self._form = await multipart_parser.parse() + except MultiPartException as exc: + if "app" in self.scope: + raise HTTPException(status_code=400, detail=exc.message) + raise exc + elif content_type == b"application/x-www-form-urlencoded": + form_parser = FormParser(self.headers, self.stream()) + self._form = await form_parser.parse() + else: + self._form = FormData() + return self._form + + def form( + self, + *, + max_files: int | float = 1000, + max_fields: int | float = 1000, + max_part_size: int = 1024 * 1024, + ) -> AwaitableOrContextManager[FormData]: + return AwaitableOrContextManagerWrapper( + self._get_form(max_files=max_files, max_fields=max_fields, max_part_size=max_part_size) + ) + + async def close(self) -> None: + if self._form is not None: # pragma: no branch + await self._form.close() + + async def is_disconnected(self) -> bool: + if not self._is_disconnected: + message: Message = {} + + # If message isn't immediately available, move on + with anyio.CancelScope() as cs: + cs.cancel() + message = await self._receive() + + if message.get("type") == "http.disconnect": + self._is_disconnected = True + + return self._is_disconnected + + async def send_push_promise(self, path: str) -> None: + if "http.response.push" in self.scope.get("extensions", {}): + raw_headers: list[tuple[bytes, bytes]] = [] + for name in SERVER_PUSH_HEADERS_TO_COPY: + for value in self.headers.getlist(name): + raw_headers.append((name.encode("latin-1"), value.encode("latin-1"))) + await self._send({"type": "http.response.push", "path": path, "headers": raw_headers}) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/responses.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/responses.py new file mode 100644 index 0000000000000000000000000000000000000000..d0024760e500b3a520d2338fda202f9898240513 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/responses.py @@ -0,0 +1,566 @@ +from __future__ import annotations + +import hashlib +import http.cookies +import json +import os +import stat +import sys +import warnings +from collections.abc import AsyncIterable, Awaitable, Callable, Iterable, Mapping, Sequence +from datetime import datetime +from email.utils import format_datetime, formatdate +from functools import partial +from mimetypes import guess_type +from secrets import token_hex +from typing import Any, Literal +from urllib.parse import quote + +import anyio +import anyio.to_thread + +from starlette._utils import collapse_excgroups +from starlette.background import BackgroundTask +from starlette.concurrency import iterate_in_threadpool +from starlette.datastructures import URL, Headers, MutableHeaders +from starlette.requests import ClientDisconnect +from starlette.types import Receive, Scope, Send + + +class Response: + media_type = None + charset = "utf-8" + + def __init__( + self, + content: Any = None, + status_code: int = 200, + headers: Mapping[str, str] | None = None, + media_type: str | None = None, + background: BackgroundTask | None = None, + ) -> None: + self.status_code = status_code + if media_type is not None: + self.media_type = media_type + self.background = background + self.body = self.render(content) + self.init_headers(headers) + + def render(self, content: Any) -> bytes | memoryview: + if content is None: + return b"" + if isinstance(content, bytes | memoryview): + return content + return content.encode(self.charset) # type: ignore + + def init_headers(self, headers: Mapping[str, str] | None = None) -> None: + if headers is None: + raw_headers: list[tuple[bytes, bytes]] = [] + populate_content_length = True + populate_content_type = True + else: + raw_headers = [(k.lower().encode("latin-1"), v.encode("latin-1")) for k, v in headers.items()] + keys = [h[0] for h in raw_headers] + populate_content_length = b"content-length" not in keys + populate_content_type = b"content-type" not in keys + + body = getattr(self, "body", None) + if ( + body is not None + and populate_content_length + and not (self.status_code < 200 or self.status_code in (204, 304)) + ): + content_length = str(len(body)) + raw_headers.append((b"content-length", content_length.encode("latin-1"))) + + content_type = self.media_type + if content_type is not None and populate_content_type: + if content_type.startswith("text/") and "charset=" not in content_type.lower(): + content_type += "; charset=" + self.charset + raw_headers.append((b"content-type", content_type.encode("latin-1"))) + + self.raw_headers = raw_headers + + @property + def headers(self) -> MutableHeaders: + if not hasattr(self, "_headers"): + self._headers = MutableHeaders(raw=self.raw_headers) + return self._headers + + def set_cookie( + self, + key: str, + value: str = "", + max_age: int | None = None, + expires: datetime | str | int | None = None, + path: str | None = "/", + domain: str | None = None, + secure: bool = False, + httponly: bool = False, + samesite: Literal["lax", "strict", "none"] | None = "lax", + partitioned: bool = False, + ) -> None: + cookie: http.cookies.BaseCookie[str] = http.cookies.SimpleCookie() + cookie[key] = value + if max_age is not None: + cookie[key]["max-age"] = max_age + if expires is not None: + if isinstance(expires, datetime): + cookie[key]["expires"] = format_datetime(expires, usegmt=True) + else: + cookie[key]["expires"] = expires + if path is not None: + cookie[key]["path"] = path + if domain is not None: + cookie[key]["domain"] = domain + if secure: + cookie[key]["secure"] = True + if httponly: + cookie[key]["httponly"] = True + if samesite is not None: + assert samesite.lower() in [ + "strict", + "lax", + "none", + ], "samesite must be either 'strict', 'lax' or 'none'" + cookie[key]["samesite"] = samesite + if partitioned: + if sys.version_info < (3, 14): + raise ValueError("Partitioned cookies are only supported in Python 3.14 and above.") # pragma: no cover + cookie[key]["partitioned"] = True # pragma: no cover + + cookie_val = cookie.output(header="").strip() + self.raw_headers.append((b"set-cookie", cookie_val.encode("latin-1"))) + + def delete_cookie( + self, + key: str, + path: str = "/", + domain: str | None = None, + secure: bool = False, + httponly: bool = False, + samesite: Literal["lax", "strict", "none"] | None = "lax", + ) -> None: + self.set_cookie( + key, + max_age=0, + expires=0, + path=path, + domain=domain, + secure=secure, + httponly=httponly, + samesite=samesite, + ) + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + prefix = "websocket." if scope["type"] == "websocket" else "" + await send( + { + "type": prefix + "http.response.start", + "status": self.status_code, + "headers": self.raw_headers, + } + ) + await send({"type": prefix + "http.response.body", "body": self.body}) + + if self.background is not None: + await self.background() + + +class HTMLResponse(Response): + media_type = "text/html" + + +class PlainTextResponse(Response): + media_type = "text/plain" + + +class JSONResponse(Response): + media_type = "application/json" + + def __init__( + self, + content: Any, + status_code: int = 200, + headers: Mapping[str, str] | None = None, + media_type: str | None = None, + background: BackgroundTask | None = None, + ) -> None: + super().__init__(content, status_code, headers, media_type, background) + + def render(self, content: Any) -> bytes: + return json.dumps( + content, + ensure_ascii=False, + allow_nan=False, + indent=None, + separators=(",", ":"), + ).encode("utf-8") + + +class RedirectResponse(Response): + def __init__( + self, + url: str | URL, + status_code: int = 307, + headers: Mapping[str, str] | None = None, + background: BackgroundTask | None = None, + ) -> None: + super().__init__(content=b"", status_code=status_code, headers=headers, background=background) + self.headers["location"] = quote(str(url), safe=":/%#?=@[]!$&'()*+,;") + + +Content = str | bytes | memoryview +SyncContentStream = Iterable[Content] +AsyncContentStream = AsyncIterable[Content] +ContentStream = AsyncContentStream | SyncContentStream + + +class StreamingResponse(Response): + body_iterator: AsyncContentStream + + def __init__( + self, + content: ContentStream, + status_code: int = 200, + headers: Mapping[str, str] | None = None, + media_type: str | None = None, + background: BackgroundTask | None = None, + ) -> None: + if isinstance(content, AsyncIterable): + self.body_iterator = content + else: + self.body_iterator = iterate_in_threadpool(content) + self.status_code = status_code + self.media_type = self.media_type if media_type is None else media_type + self.background = background + self.init_headers(headers) + + async def listen_for_disconnect(self, receive: Receive) -> None: + while True: + message = await receive() + if message["type"] == "http.disconnect": + break + + async def stream_response(self, send: Send) -> None: + await send( + { + "type": "http.response.start", + "status": self.status_code, + "headers": self.raw_headers, + } + ) + async for chunk in self.body_iterator: + if not isinstance(chunk, bytes | memoryview): + chunk = chunk.encode(self.charset) + await send({"type": "http.response.body", "body": chunk, "more_body": True}) + + await send({"type": "http.response.body", "body": b"", "more_body": False}) + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + spec_version = tuple(map(int, scope.get("asgi", {}).get("spec_version", "2.0").split("."))) + + if spec_version >= (2, 4): + try: + await self.stream_response(send) + except OSError: + raise ClientDisconnect() + else: + with collapse_excgroups(): + async with anyio.create_task_group() as task_group: + + async def wrap(func: Callable[[], Awaitable[None]]) -> None: + await func() + task_group.cancel_scope.cancel() + + task_group.start_soon(wrap, partial(self.stream_response, send)) + await wrap(partial(self.listen_for_disconnect, receive)) + + if self.background is not None: + await self.background() + + +class MalformedRangeHeader(Exception): + def __init__(self, content: str = "Malformed range header.") -> None: + self.content = content + + +class RangeNotSatisfiable(Exception): + def __init__(self, max_size: int) -> None: + self.max_size = max_size + + +class FileResponse(Response): + chunk_size = 64 * 1024 + + def __init__( + self, + path: str | os.PathLike[str], + status_code: int = 200, + headers: Mapping[str, str] | None = None, + media_type: str | None = None, + background: BackgroundTask | None = None, + filename: str | None = None, + stat_result: os.stat_result | None = None, + method: str | None = None, + content_disposition_type: str = "attachment", + ) -> None: + self.path = path + self.status_code = status_code + self.filename = filename + if method is not None: + warnings.warn( + "The 'method' parameter is not used, and it will be removed.", + DeprecationWarning, + ) + if media_type is None: + media_type = guess_type(filename or path)[0] or "text/plain" + self.media_type = media_type + self.background = background + self.init_headers(headers) + self.headers.setdefault("accept-ranges", "bytes") + if self.filename is not None: + content_disposition_filename = quote(self.filename) + if content_disposition_filename != self.filename: + content_disposition = f"{content_disposition_type}; filename*=utf-8''{content_disposition_filename}" + else: + content_disposition = f'{content_disposition_type}; filename="{self.filename}"' + self.headers.setdefault("content-disposition", content_disposition) + self.stat_result = stat_result + if stat_result is not None: + self.set_stat_headers(stat_result) + + def set_stat_headers(self, stat_result: os.stat_result) -> None: + content_length = str(stat_result.st_size) + last_modified = formatdate(stat_result.st_mtime, usegmt=True) + etag_base = str(stat_result.st_mtime) + "-" + str(stat_result.st_size) + etag = f'"{hashlib.md5(etag_base.encode(), usedforsecurity=False).hexdigest()}"' + + self.headers.setdefault("content-length", content_length) + self.headers.setdefault("last-modified", last_modified) + self.headers.setdefault("etag", etag) + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + send_header_only: bool = scope["method"].upper() == "HEAD" + send_pathsend: bool = "http.response.pathsend" in scope.get("extensions", {}) + + if self.stat_result is None: + try: + stat_result = await anyio.to_thread.run_sync(os.stat, self.path) + self.set_stat_headers(stat_result) + except FileNotFoundError: + raise RuntimeError(f"File at path {self.path} does not exist.") + else: + mode = stat_result.st_mode + if not stat.S_ISREG(mode): + raise RuntimeError(f"File at path {self.path} is not a file.") + else: + stat_result = self.stat_result + + headers = Headers(scope=scope) + http_range = headers.get("range") + http_if_range = headers.get("if-range") + + if http_range is None or (http_if_range is not None and not self._should_use_range(http_if_range)): + await self._handle_simple(send, send_header_only, send_pathsend) + else: + try: + ranges = self._parse_range_header(http_range, stat_result.st_size) + except MalformedRangeHeader as exc: + return await PlainTextResponse(exc.content, status_code=400)(scope, receive, send) + except RangeNotSatisfiable as exc: + response = PlainTextResponse(status_code=416, headers={"Content-Range": f"*/{exc.max_size}"}) + return await response(scope, receive, send) + + if len(ranges) == 1: + start, end = ranges[0] + await self._handle_single_range(send, start, end, stat_result.st_size, send_header_only) + else: + await self._handle_multiple_ranges(send, ranges, stat_result.st_size, send_header_only) + + if self.background is not None: + await self.background() + + async def _handle_simple(self, send: Send, send_header_only: bool, send_pathsend: bool) -> None: + await send({"type": "http.response.start", "status": self.status_code, "headers": self.raw_headers}) + if send_header_only: + await send({"type": "http.response.body", "body": b"", "more_body": False}) + elif send_pathsend: + await send({"type": "http.response.pathsend", "path": str(self.path)}) + else: + async with await anyio.open_file(self.path, mode="rb") as file: + more_body = True + while more_body: + chunk = await file.read(self.chunk_size) + more_body = len(chunk) == self.chunk_size + await send({"type": "http.response.body", "body": chunk, "more_body": more_body}) + + async def _handle_single_range( + self, send: Send, start: int, end: int, file_size: int, send_header_only: bool + ) -> None: + self.headers["content-range"] = f"bytes {start}-{end - 1}/{file_size}" + self.headers["content-length"] = str(end - start) + await send({"type": "http.response.start", "status": 206, "headers": self.raw_headers}) + if send_header_only: + await send({"type": "http.response.body", "body": b"", "more_body": False}) + else: + async with await anyio.open_file(self.path, mode="rb") as file: + await file.seek(start) + more_body = True + while more_body: + chunk = await file.read(min(self.chunk_size, end - start)) + start += len(chunk) + more_body = len(chunk) == self.chunk_size and start < end + await send({"type": "http.response.body", "body": chunk, "more_body": more_body}) + + async def _handle_multiple_ranges( + self, + send: Send, + ranges: list[tuple[int, int]], + file_size: int, + send_header_only: bool, + ) -> None: + # In firefox and chrome, they use boundary with 95-96 bits entropy (that's roughly 13 bytes). + boundary = token_hex(13) + content_length, header_generator = self.generate_multipart( + ranges, boundary, file_size, self.headers["content-type"] + ) + self.headers["content-range"] = f"multipart/byteranges; boundary={boundary}" + self.headers["content-length"] = str(content_length) + await send({"type": "http.response.start", "status": 206, "headers": self.raw_headers}) + if send_header_only: + await send({"type": "http.response.body", "body": b"", "more_body": False}) + else: + async with await anyio.open_file(self.path, mode="rb") as file: + for start, end in ranges: + await send({"type": "http.response.body", "body": header_generator(start, end), "more_body": True}) + await file.seek(start) + while start < end: + chunk = await file.read(min(self.chunk_size, end - start)) + start += len(chunk) + await send({"type": "http.response.body", "body": chunk, "more_body": True}) + await send({"type": "http.response.body", "body": b"\n", "more_body": True}) + await send( + { + "type": "http.response.body", + "body": f"\n--{boundary}--\n".encode("latin-1"), + "more_body": False, + } + ) + + def _should_use_range(self, http_if_range: str) -> bool: + return http_if_range == self.headers["last-modified"] or http_if_range == self.headers["etag"] + + @classmethod + def _parse_range_header(cls, http_range: str, file_size: int) -> list[tuple[int, int]]: + ranges: list[tuple[int, int]] = [] + try: + units, range_ = http_range.split("=", 1) + except ValueError: + raise MalformedRangeHeader() + + units = units.strip().lower() + + if units != "bytes": + raise MalformedRangeHeader("Only support bytes range") + + ranges = cls._parse_ranges(range_, file_size) + + if len(ranges) == 0: + raise MalformedRangeHeader("Range header: range must be requested") + + if any(not (0 <= start < file_size) for start, _ in ranges): + raise RangeNotSatisfiable(file_size) + + if any(start > end for start, end in ranges): + raise MalformedRangeHeader("Range header: start must be less than end") + + if len(ranges) == 1: + return ranges + + # Merge ranges + result: list[tuple[int, int]] = [] + for start, end in ranges: + for p in range(len(result)): + p_start, p_end = result[p] + if start > p_end: + continue + elif end < p_start: + result.insert(p, (start, end)) # THIS IS NOT REACHED! + break + else: + result[p] = (min(start, p_start), max(end, p_end)) + break + else: + result.append((start, end)) + + return result + + @classmethod + def _parse_ranges(cls, range_: str, file_size: int) -> list[tuple[int, int]]: + ranges: list[tuple[int, int]] = [] + + for part in range_.split(","): + part = part.strip() + + # If the range is empty or a single dash, we ignore it. + if not part or part == "-": + continue + + # If the range is not in the format "start-end", we ignore it. + if "-" not in part: + continue + + start_str, end_str = part.split("-", 1) + start_str = start_str.strip() + end_str = end_str.strip() + + try: + start = int(start_str) if start_str else file_size - int(end_str) + end = int(end_str) + 1 if start_str and end_str and int(end_str) < file_size else file_size + ranges.append((start, end)) + except ValueError: + # If the range is not numeric, we ignore it. + continue + + return ranges + + def generate_multipart( + self, + ranges: Sequence[tuple[int, int]], + boundary: str, + max_size: int, + content_type: str, + ) -> tuple[int, Callable[[int, int], bytes]]: + r""" + Multipart response headers generator. + + ``` + --{boundary}\n + Content-Type: {content_type}\n + Content-Range: bytes {start}-{end-1}/{max_size}\n + \n + ..........content...........\n + --{boundary}\n + Content-Type: {content_type}\n + Content-Range: bytes {start}-{end-1}/{max_size}\n + \n + ..........content...........\n + --{boundary}--\n + ``` + """ + boundary_len = len(boundary) + static_header_part_len = 44 + boundary_len + len(content_type) + len(str(max_size)) + content_length = sum( + (len(str(start)) + len(str(end - 1)) + static_header_part_len) # Headers + + (end - start) # Content + for start, end in ranges + ) + ( + 5 + boundary_len # --boundary--\n + ) + return ( + content_length, + lambda start, end: ( + f"--{boundary}\nContent-Type: {content_type}\nContent-Range: bytes {start}-{end - 1}/{max_size}\n\n" + ).encode("latin-1"), + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/routing.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/routing.py new file mode 100644 index 0000000000000000000000000000000000000000..d394bce7f94be954c805ff69ceb13e1e87ff0108 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/routing.py @@ -0,0 +1,876 @@ +from __future__ import annotations + +import contextlib +import functools +import inspect +import re +import traceback +import types +import warnings +from collections.abc import Awaitable, Callable, Collection, Generator, Sequence +from contextlib import AbstractAsyncContextManager, AbstractContextManager, asynccontextmanager +from enum import Enum +from re import Pattern +from typing import Any, TypeVar + +from starlette._exception_handler import wrap_app_handling_exceptions +from starlette._utils import get_route_path, is_async_callable +from starlette.concurrency import run_in_threadpool +from starlette.convertors import CONVERTOR_TYPES, Convertor +from starlette.datastructures import URL, Headers, URLPath +from starlette.exceptions import HTTPException +from starlette.middleware import Middleware +from starlette.requests import Request +from starlette.responses import PlainTextResponse, RedirectResponse, Response +from starlette.types import ASGIApp, Lifespan, Receive, Scope, Send +from starlette.websockets import WebSocket, WebSocketClose + + +class NoMatchFound(Exception): + """ + Raised by `.url_for(name, **path_params)` and `.url_path_for(name, **path_params)` + if no matching route exists. + """ + + def __init__(self, name: str, path_params: dict[str, Any]) -> None: + params = ", ".join(list(path_params.keys())) + super().__init__(f'No route exists for name "{name}" and params "{params}".') + + +class Match(Enum): + NONE = 0 + PARTIAL = 1 + FULL = 2 + + +def iscoroutinefunction_or_partial(obj: Any) -> bool: # pragma: no cover + """ + Correctly determines if an object is a coroutine function, + including those wrapped in functools.partial objects. + """ + warnings.warn( + "iscoroutinefunction_or_partial is deprecated, and will be removed in a future release.", + DeprecationWarning, + ) + while isinstance(obj, functools.partial): + obj = obj.func + return inspect.iscoroutinefunction(obj) + + +def request_response( + func: Callable[[Request], Awaitable[Response] | Response], +) -> ASGIApp: + """ + Takes a function or coroutine `func(request) -> response`, + and returns an ASGI application. + """ + f: Callable[[Request], Awaitable[Response]] = ( + func if is_async_callable(func) else functools.partial(run_in_threadpool, func) + ) + + async def app(scope: Scope, receive: Receive, send: Send) -> None: + request = Request(scope, receive, send) + + async def app(scope: Scope, receive: Receive, send: Send) -> None: + response = await f(request) + await response(scope, receive, send) + + await wrap_app_handling_exceptions(app, request)(scope, receive, send) + + return app + + +def websocket_session( + func: Callable[[WebSocket], Awaitable[None]], +) -> ASGIApp: + """ + Takes a coroutine `func(session)`, and returns an ASGI application. + """ + # assert asyncio.iscoroutinefunction(func), "WebSocket endpoints must be async" + + async def app(scope: Scope, receive: Receive, send: Send) -> None: + session = WebSocket(scope, receive=receive, send=send) + + async def app(scope: Scope, receive: Receive, send: Send) -> None: + await func(session) + + await wrap_app_handling_exceptions(app, session)(scope, receive, send) + + return app + + +def get_name(endpoint: Callable[..., Any]) -> str: + return getattr(endpoint, "__name__", endpoint.__class__.__name__) + + +def replace_params( + path: str, + param_convertors: dict[str, Convertor[Any]], + path_params: dict[str, str], +) -> tuple[str, dict[str, str]]: + for key, value in list(path_params.items()): + if "{" + key + "}" in path: + convertor = param_convertors[key] + value = convertor.to_string(value) + path = path.replace("{" + key + "}", value) + path_params.pop(key) + return path, path_params + + +# Match parameters in URL paths, eg. '{param}', and '{param:int}' +PARAM_REGEX = re.compile("{([a-zA-Z_][a-zA-Z0-9_]*)(:[a-zA-Z_][a-zA-Z0-9_]*)?}") + + +def compile_path( + path: str, +) -> tuple[Pattern[str], str, dict[str, Convertor[Any]]]: + """ + Given a path string, like: "/{username:str}", + or a host string, like: "{subdomain}.mydomain.org", return a three-tuple + of (regex, format, {param_name:convertor}). + + regex: "/(?P[^/]+)" + format: "/{username}" + convertors: {"username": StringConvertor()} + """ + is_host = not path.startswith("/") + + path_regex = "^" + path_format = "" + duplicated_params = set() + + idx = 0 + param_convertors = {} + for match in PARAM_REGEX.finditer(path): + param_name, convertor_type = match.groups("str") + convertor_type = convertor_type.lstrip(":") + assert convertor_type in CONVERTOR_TYPES, f"Unknown path convertor '{convertor_type}'" + convertor = CONVERTOR_TYPES[convertor_type] + + path_regex += re.escape(path[idx : match.start()]) + path_regex += f"(?P<{param_name}>{convertor.regex})" + + path_format += path[idx : match.start()] + path_format += "{%s}" % param_name + + if param_name in param_convertors: + duplicated_params.add(param_name) + + param_convertors[param_name] = convertor + + idx = match.end() + + if duplicated_params: + names = ", ".join(sorted(duplicated_params)) + ending = "s" if len(duplicated_params) > 1 else "" + raise ValueError(f"Duplicated param name{ending} {names} at path {path}") + + if is_host: + # Align with `Host.matches()` behavior, which ignores port. + hostname = path[idx:].split(":")[0] + path_regex += re.escape(hostname) + "$" + else: + path_regex += re.escape(path[idx:]) + "$" + + path_format += path[idx:] + + return re.compile(path_regex), path_format, param_convertors + + +class BaseRoute: + def matches(self, scope: Scope) -> tuple[Match, Scope]: + raise NotImplementedError() # pragma: no cover + + def url_path_for(self, name: str, /, **path_params: Any) -> URLPath: + raise NotImplementedError() # pragma: no cover + + async def handle(self, scope: Scope, receive: Receive, send: Send) -> None: + raise NotImplementedError() # pragma: no cover + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + """ + A route may be used in isolation as a stand-alone ASGI app. + This is a somewhat contrived case, as they'll almost always be used + within a Router, but could be useful for some tooling and minimal apps. + """ + match, child_scope = self.matches(scope) + if match == Match.NONE: + if scope["type"] == "http": + response = PlainTextResponse("Not Found", status_code=404) + await response(scope, receive, send) + elif scope["type"] == "websocket": # pragma: no branch + websocket_close = WebSocketClose() + await websocket_close(scope, receive, send) + return + + scope.update(child_scope) + await self.handle(scope, receive, send) + + +class Route(BaseRoute): + def __init__( + self, + path: str, + endpoint: Callable[..., Any], + *, + methods: Collection[str] | None = None, + name: str | None = None, + include_in_schema: bool = True, + middleware: Sequence[Middleware] | None = None, + ) -> None: + assert path.startswith("/"), "Routed paths must start with '/'" + self.path = path + self.endpoint = endpoint + self.name = get_name(endpoint) if name is None else name + self.include_in_schema = include_in_schema + + endpoint_handler = endpoint + while isinstance(endpoint_handler, functools.partial): + endpoint_handler = endpoint_handler.func + if inspect.isfunction(endpoint_handler) or inspect.ismethod(endpoint_handler): + # Endpoint is function or method. Treat it as `func(request) -> response`. + self.app = request_response(endpoint) + if methods is None: + methods = ["GET"] + else: + # Endpoint is a class. Treat it as ASGI. + self.app = endpoint + + if middleware is not None: + for cls, args, kwargs in reversed(middleware): + self.app = cls(self.app, *args, **kwargs) + + if methods is None: + self.methods = None + else: + self.methods = {method.upper() for method in methods} + if "GET" in self.methods: + self.methods.add("HEAD") + + self.path_regex, self.path_format, self.param_convertors = compile_path(path) + + def matches(self, scope: Scope) -> tuple[Match, Scope]: + path_params: dict[str, Any] + if scope["type"] == "http": + route_path = get_route_path(scope) + match = self.path_regex.match(route_path) + if match: + matched_params = match.groupdict() + for key, value in matched_params.items(): + matched_params[key] = self.param_convertors[key].convert(value) + path_params = dict(scope.get("path_params", {})) + path_params.update(matched_params) + child_scope = {"endpoint": self.endpoint, "path_params": path_params} + if self.methods and scope["method"] not in self.methods: + return Match.PARTIAL, child_scope + else: + return Match.FULL, child_scope + return Match.NONE, {} + + def url_path_for(self, name: str, /, **path_params: Any) -> URLPath: + seen_params = set(path_params.keys()) + expected_params = set(self.param_convertors.keys()) + + if name != self.name or seen_params != expected_params: + raise NoMatchFound(name, path_params) + + path, remaining_params = replace_params(self.path_format, self.param_convertors, path_params) + assert not remaining_params + return URLPath(path=path, protocol="http") + + async def handle(self, scope: Scope, receive: Receive, send: Send) -> None: + if self.methods and scope["method"] not in self.methods: + headers = {"Allow": ", ".join(self.methods)} + if "app" in scope: + raise HTTPException(status_code=405, headers=headers) + else: + response = PlainTextResponse("Method Not Allowed", status_code=405, headers=headers) + await response(scope, receive, send) + else: + await self.app(scope, receive, send) + + def __eq__(self, other: Any) -> bool: + return ( + isinstance(other, Route) + and self.path == other.path + and self.endpoint == other.endpoint + and self.methods == other.methods + ) + + def __repr__(self) -> str: + class_name = self.__class__.__name__ + methods = sorted(self.methods or []) + path, name = self.path, self.name + return f"{class_name}(path={path!r}, name={name!r}, methods={methods!r})" + + +class WebSocketRoute(BaseRoute): + def __init__( + self, + path: str, + endpoint: Callable[..., Any], + *, + name: str | None = None, + middleware: Sequence[Middleware] | None = None, + ) -> None: + assert path.startswith("/"), "Routed paths must start with '/'" + self.path = path + self.endpoint = endpoint + self.name = get_name(endpoint) if name is None else name + + endpoint_handler = endpoint + while isinstance(endpoint_handler, functools.partial): + endpoint_handler = endpoint_handler.func + if inspect.isfunction(endpoint_handler) or inspect.ismethod(endpoint_handler): + # Endpoint is function or method. Treat it as `func(websocket)`. + self.app = websocket_session(endpoint) + else: + # Endpoint is a class. Treat it as ASGI. + self.app = endpoint + + if middleware is not None: + for cls, args, kwargs in reversed(middleware): + self.app = cls(self.app, *args, **kwargs) + + self.path_regex, self.path_format, self.param_convertors = compile_path(path) + + def matches(self, scope: Scope) -> tuple[Match, Scope]: + path_params: dict[str, Any] + if scope["type"] == "websocket": + route_path = get_route_path(scope) + match = self.path_regex.match(route_path) + if match: + matched_params = match.groupdict() + for key, value in matched_params.items(): + matched_params[key] = self.param_convertors[key].convert(value) + path_params = dict(scope.get("path_params", {})) + path_params.update(matched_params) + child_scope = {"endpoint": self.endpoint, "path_params": path_params} + return Match.FULL, child_scope + return Match.NONE, {} + + def url_path_for(self, name: str, /, **path_params: Any) -> URLPath: + seen_params = set(path_params.keys()) + expected_params = set(self.param_convertors.keys()) + + if name != self.name or seen_params != expected_params: + raise NoMatchFound(name, path_params) + + path, remaining_params = replace_params(self.path_format, self.param_convertors, path_params) + assert not remaining_params + return URLPath(path=path, protocol="websocket") + + async def handle(self, scope: Scope, receive: Receive, send: Send) -> None: + await self.app(scope, receive, send) + + def __eq__(self, other: Any) -> bool: + return isinstance(other, WebSocketRoute) and self.path == other.path and self.endpoint == other.endpoint + + def __repr__(self) -> str: + return f"{self.__class__.__name__}(path={self.path!r}, name={self.name!r})" + + +class Mount(BaseRoute): + def __init__( + self, + path: str, + app: ASGIApp | None = None, + routes: Sequence[BaseRoute] | None = None, + name: str | None = None, + *, + middleware: Sequence[Middleware] | None = None, + ) -> None: + assert path == "" or path.startswith("/"), "Routed paths must start with '/'" + assert app is not None or routes is not None, "Either 'app=...', or 'routes=' must be specified" + self.path = path.rstrip("/") + if app is not None: + self._base_app: ASGIApp = app + else: + self._base_app = Router(routes=routes) + self.app = self._base_app + if middleware is not None: + for cls, args, kwargs in reversed(middleware): + self.app = cls(self.app, *args, **kwargs) + self.name = name + self.path_regex, self.path_format, self.param_convertors = compile_path(self.path + "/{path:path}") + + @property + def routes(self) -> list[BaseRoute]: + return getattr(self._base_app, "routes", []) + + def matches(self, scope: Scope) -> tuple[Match, Scope]: + path_params: dict[str, Any] + if scope["type"] in ("http", "websocket"): # pragma: no branch + root_path = scope.get("root_path", "") + route_path = get_route_path(scope) + match = self.path_regex.match(route_path) + if match: + matched_params = match.groupdict() + for key, value in matched_params.items(): + matched_params[key] = self.param_convertors[key].convert(value) + remaining_path = "/" + matched_params.pop("path") + matched_path = route_path[: -len(remaining_path)] + path_params = dict(scope.get("path_params", {})) + path_params.update(matched_params) + child_scope = { + "path_params": path_params, + # app_root_path will only be set at the top level scope, + # initialized with the (optional) value of a root_path + # set above/before Starlette. And even though any + # mount will have its own child scope with its own respective + # root_path, the app_root_path will always be available in all + # the child scopes with the same top level value because it's + # set only once here with a default, any other child scope will + # just inherit that app_root_path default value stored in the + # scope. All this is needed to support Request.url_for(), as it + # uses the app_root_path to build the URL path. + "app_root_path": scope.get("app_root_path", root_path), + "root_path": root_path + matched_path, + "endpoint": self.app, + } + return Match.FULL, child_scope + return Match.NONE, {} + + def url_path_for(self, name: str, /, **path_params: Any) -> URLPath: + if self.name is not None and name == self.name and "path" in path_params: + # 'name' matches "". + path_params["path"] = path_params["path"].lstrip("/") + path, remaining_params = replace_params(self.path_format, self.param_convertors, path_params) + if not remaining_params: + return URLPath(path=path) + elif self.name is None or name.startswith(self.name + ":"): + if self.name is None: + # No mount name. + remaining_name = name + else: + # 'name' matches ":". + remaining_name = name[len(self.name) + 1 :] + path_kwarg = path_params.get("path") + path_params["path"] = "" + path_prefix, remaining_params = replace_params(self.path_format, self.param_convertors, path_params) + if path_kwarg is not None: + remaining_params["path"] = path_kwarg + for route in self.routes or []: + try: + url = route.url_path_for(remaining_name, **remaining_params) + return URLPath(path=path_prefix.rstrip("/") + str(url), protocol=url.protocol) + except NoMatchFound: + pass + raise NoMatchFound(name, path_params) + + async def handle(self, scope: Scope, receive: Receive, send: Send) -> None: + await self.app(scope, receive, send) + + def __eq__(self, other: Any) -> bool: + return isinstance(other, Mount) and self.path == other.path and self.app == other.app + + def __repr__(self) -> str: + class_name = self.__class__.__name__ + name = self.name or "" + return f"{class_name}(path={self.path!r}, name={name!r}, app={self.app!r})" + + +class Host(BaseRoute): + def __init__(self, host: str, app: ASGIApp, name: str | None = None) -> None: + assert not host.startswith("/"), "Host must not start with '/'" + self.host = host + self.app = app + self.name = name + self.host_regex, self.host_format, self.param_convertors = compile_path(host) + + @property + def routes(self) -> list[BaseRoute]: + return getattr(self.app, "routes", []) + + def matches(self, scope: Scope) -> tuple[Match, Scope]: + if scope["type"] in ("http", "websocket"): # pragma:no branch + headers = Headers(scope=scope) + host = headers.get("host", "").split(":")[0] + match = self.host_regex.match(host) + if match: + matched_params = match.groupdict() + for key, value in matched_params.items(): + matched_params[key] = self.param_convertors[key].convert(value) + path_params = dict(scope.get("path_params", {})) + path_params.update(matched_params) + child_scope = {"path_params": path_params, "endpoint": self.app} + return Match.FULL, child_scope + return Match.NONE, {} + + def url_path_for(self, name: str, /, **path_params: Any) -> URLPath: + if self.name is not None and name == self.name and "path" in path_params: + # 'name' matches "". + path = path_params.pop("path") + host, remaining_params = replace_params(self.host_format, self.param_convertors, path_params) + if not remaining_params: + return URLPath(path=path, host=host) + elif self.name is None or name.startswith(self.name + ":"): + if self.name is None: + # No mount name. + remaining_name = name + else: + # 'name' matches ":". + remaining_name = name[len(self.name) + 1 :] + host, remaining_params = replace_params(self.host_format, self.param_convertors, path_params) + for route in self.routes or []: + try: + url = route.url_path_for(remaining_name, **remaining_params) + return URLPath(path=str(url), protocol=url.protocol, host=host) + except NoMatchFound: + pass + raise NoMatchFound(name, path_params) + + async def handle(self, scope: Scope, receive: Receive, send: Send) -> None: + await self.app(scope, receive, send) + + def __eq__(self, other: Any) -> bool: + return isinstance(other, Host) and self.host == other.host and self.app == other.app + + def __repr__(self) -> str: + class_name = self.__class__.__name__ + name = self.name or "" + return f"{class_name}(host={self.host!r}, name={name!r}, app={self.app!r})" + + +_T = TypeVar("_T") + + +class _AsyncLiftContextManager(AbstractAsyncContextManager[_T]): + def __init__(self, cm: AbstractContextManager[_T]): + self._cm = cm + + async def __aenter__(self) -> _T: + return self._cm.__enter__() + + async def __aexit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: types.TracebackType | None, + ) -> bool | None: + return self._cm.__exit__(exc_type, exc_value, traceback) + + +def _wrap_gen_lifespan_context( + lifespan_context: Callable[[Any], Generator[Any, Any, Any]], +) -> Callable[[Any], AbstractAsyncContextManager[Any]]: + cmgr = contextlib.contextmanager(lifespan_context) + + @functools.wraps(cmgr) + def wrapper(app: Any) -> _AsyncLiftContextManager[Any]: + return _AsyncLiftContextManager(cmgr(app)) + + return wrapper + + +class _DefaultLifespan: + def __init__(self, router: Router): + self._router = router + + async def __aenter__(self) -> None: + await self._router.startup() + + async def __aexit__(self, *exc_info: object) -> None: + await self._router.shutdown() + + def __call__(self: _T, app: object) -> _T: + return self + + +class Router: + def __init__( + self, + routes: Sequence[BaseRoute] | None = None, + redirect_slashes: bool = True, + default: ASGIApp | None = None, + on_startup: Sequence[Callable[[], Any]] | None = None, + on_shutdown: Sequence[Callable[[], Any]] | None = None, + # the generic to Lifespan[AppType] is the type of the top level application + # which the router cannot know statically, so we use Any + lifespan: Lifespan[Any] | None = None, + *, + middleware: Sequence[Middleware] | None = None, + ) -> None: + self.routes = [] if routes is None else list(routes) + self.redirect_slashes = redirect_slashes + self.default = self.not_found if default is None else default + self.on_startup = [] if on_startup is None else list(on_startup) + self.on_shutdown = [] if on_shutdown is None else list(on_shutdown) + + if on_startup or on_shutdown: + warnings.warn( + "The on_startup and on_shutdown parameters are deprecated, and they " + "will be removed on version 1.0. Use the lifespan parameter instead. " + "See more about it on https://starlette.dev/lifespan/.", + DeprecationWarning, + ) + if lifespan: + warnings.warn( + "The `lifespan` parameter cannot be used with `on_startup` or " + "`on_shutdown`. Both `on_startup` and `on_shutdown` will be " + "ignored." + ) + + if lifespan is None: + self.lifespan_context: Lifespan[Any] = _DefaultLifespan(self) + + elif inspect.isasyncgenfunction(lifespan): + warnings.warn( + "async generator function lifespans are deprecated, " + "use an @contextlib.asynccontextmanager function instead", + DeprecationWarning, + ) + self.lifespan_context = asynccontextmanager( + lifespan, + ) + elif inspect.isgeneratorfunction(lifespan): + warnings.warn( + "generator function lifespans are deprecated, use an @contextlib.asynccontextmanager function instead", + DeprecationWarning, + ) + self.lifespan_context = _wrap_gen_lifespan_context( + lifespan, + ) + else: + self.lifespan_context = lifespan + + self.middleware_stack = self.app + if middleware: + for cls, args, kwargs in reversed(middleware): + self.middleware_stack = cls(self.middleware_stack, *args, **kwargs) + + async def not_found(self, scope: Scope, receive: Receive, send: Send) -> None: + if scope["type"] == "websocket": + websocket_close = WebSocketClose() + await websocket_close(scope, receive, send) + return + + # If we're running inside a starlette application then raise an + # exception, so that the configurable exception handler can deal with + # returning the response. For plain ASGI apps, just return the response. + if "app" in scope: + raise HTTPException(status_code=404) + else: + response = PlainTextResponse("Not Found", status_code=404) + await response(scope, receive, send) + + def url_path_for(self, name: str, /, **path_params: Any) -> URLPath: + for route in self.routes: + try: + return route.url_path_for(name, **path_params) + except NoMatchFound: + pass + raise NoMatchFound(name, path_params) + + async def startup(self) -> None: + """ + Run any `.on_startup` event handlers. + """ + for handler in self.on_startup: + if is_async_callable(handler): + await handler() + else: + handler() + + async def shutdown(self) -> None: + """ + Run any `.on_shutdown` event handlers. + """ + for handler in self.on_shutdown: + if is_async_callable(handler): + await handler() + else: + handler() + + async def lifespan(self, scope: Scope, receive: Receive, send: Send) -> None: + """ + Handle ASGI lifespan messages, which allows us to manage application + startup and shutdown events. + """ + started = False + app: Any = scope.get("app") + await receive() + try: + async with self.lifespan_context(app) as maybe_state: + if maybe_state is not None: + if "state" not in scope: + raise RuntimeError('The server does not support "state" in the lifespan scope.') + scope["state"].update(maybe_state) + await send({"type": "lifespan.startup.complete"}) + started = True + await receive() + except BaseException: + exc_text = traceback.format_exc() + if started: + await send({"type": "lifespan.shutdown.failed", "message": exc_text}) + else: + await send({"type": "lifespan.startup.failed", "message": exc_text}) + raise + else: + await send({"type": "lifespan.shutdown.complete"}) + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + """ + The main entry point to the Router class. + """ + await self.middleware_stack(scope, receive, send) + + async def app(self, scope: Scope, receive: Receive, send: Send) -> None: + assert scope["type"] in ("http", "websocket", "lifespan") + + if "router" not in scope: + scope["router"] = self + + if scope["type"] == "lifespan": + await self.lifespan(scope, receive, send) + return + + partial = None + + for route in self.routes: + # Determine if any route matches the incoming scope, + # and hand over to the matching route if found. + match, child_scope = route.matches(scope) + if match == Match.FULL: + scope.update(child_scope) + await route.handle(scope, receive, send) + return + elif match == Match.PARTIAL and partial is None: + partial = route + partial_scope = child_scope + + if partial is not None: + #  Handle partial matches. These are cases where an endpoint is + # able to handle the request, but is not a preferred option. + # We use this in particular to deal with "405 Method Not Allowed". + scope.update(partial_scope) + await partial.handle(scope, receive, send) + return + + route_path = get_route_path(scope) + if scope["type"] == "http" and self.redirect_slashes and route_path != "/": + redirect_scope = dict(scope) + if route_path.endswith("/"): + redirect_scope["path"] = redirect_scope["path"].rstrip("/") + else: + redirect_scope["path"] = redirect_scope["path"] + "/" + + for route in self.routes: + match, child_scope = route.matches(redirect_scope) + if match != Match.NONE: + redirect_url = URL(scope=redirect_scope) + response = RedirectResponse(url=str(redirect_url)) + await response(scope, receive, send) + return + + await self.default(scope, receive, send) + + def __eq__(self, other: Any) -> bool: + return isinstance(other, Router) and self.routes == other.routes + + def mount(self, path: str, app: ASGIApp, name: str | None = None) -> None: # pragma: no cover + route = Mount(path, app=app, name=name) + self.routes.append(route) + + def host(self, host: str, app: ASGIApp, name: str | None = None) -> None: # pragma: no cover + route = Host(host, app=app, name=name) + self.routes.append(route) + + def add_route( + self, + path: str, + endpoint: Callable[[Request], Awaitable[Response] | Response], + methods: Collection[str] | None = None, + name: str | None = None, + include_in_schema: bool = True, + ) -> None: # pragma: no cover + route = Route( + path, + endpoint=endpoint, + methods=methods, + name=name, + include_in_schema=include_in_schema, + ) + self.routes.append(route) + + def add_websocket_route( + self, + path: str, + endpoint: Callable[[WebSocket], Awaitable[None]], + name: str | None = None, + ) -> None: # pragma: no cover + route = WebSocketRoute(path, endpoint=endpoint, name=name) + self.routes.append(route) + + def route( + self, + path: str, + methods: Collection[str] | None = None, + name: str | None = None, + include_in_schema: bool = True, + ) -> Callable: # type: ignore[type-arg] + """ + We no longer document this decorator style API, and its usage is discouraged. + Instead you should use the following approach: + + >>> routes = [Route(path, endpoint=...), ...] + >>> app = Starlette(routes=routes) + """ + warnings.warn( + "The `route` decorator is deprecated, and will be removed in version 1.0.0." + "Refer to https://starlette.dev/routing/#http-routing for the recommended approach.", + DeprecationWarning, + ) + + def decorator(func: Callable) -> Callable: # type: ignore[type-arg] + self.add_route( + path, + func, + methods=methods, + name=name, + include_in_schema=include_in_schema, + ) + return func + + return decorator + + def websocket_route(self, path: str, name: str | None = None) -> Callable: # type: ignore[type-arg] + """ + We no longer document this decorator style API, and its usage is discouraged. + Instead you should use the following approach: + + >>> routes = [WebSocketRoute(path, endpoint=...), ...] + >>> app = Starlette(routes=routes) + """ + warnings.warn( + "The `websocket_route` decorator is deprecated, and will be removed in version 1.0.0. Refer to " + "https://starlette.dev/routing/#websocket-routing for the recommended approach.", + DeprecationWarning, + ) + + def decorator(func: Callable) -> Callable: # type: ignore[type-arg] + self.add_websocket_route(path, func, name=name) + return func + + return decorator + + def add_event_handler(self, event_type: str, func: Callable[[], Any]) -> None: # pragma: no cover + assert event_type in ("startup", "shutdown") + + if event_type == "startup": + self.on_startup.append(func) + else: + self.on_shutdown.append(func) + + def on_event(self, event_type: str) -> Callable: # type: ignore[type-arg] + warnings.warn( + "The `on_event` decorator is deprecated, and will be removed in version 1.0.0. " + "Refer to https://starlette.dev/lifespan/ for recommended approach.", + DeprecationWarning, + ) + + def decorator(func: Callable) -> Callable: # type: ignore[type-arg] + self.add_event_handler(event_type, func) + return func + + return decorator diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/schemas.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/schemas.py new file mode 100644 index 0000000000000000000000000000000000000000..cf7d439e3ab255663c72aa65e3ac5fb17a8db819 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/schemas.py @@ -0,0 +1,148 @@ +from __future__ import annotations + +import inspect +import re +from collections.abc import Callable +from typing import Any, NamedTuple + +from starlette.requests import Request +from starlette.responses import Response +from starlette.routing import BaseRoute, Host, Mount, Route + +try: + import yaml +except ModuleNotFoundError: # pragma: no cover + yaml = None # type: ignore[assignment] + + +class OpenAPIResponse(Response): + media_type = "application/vnd.oai.openapi" + + def render(self, content: Any) -> bytes: + assert yaml is not None, "`pyyaml` must be installed to use OpenAPIResponse." + assert isinstance(content, dict), "The schema passed to OpenAPIResponse should be a dictionary." + return yaml.dump(content, default_flow_style=False).encode("utf-8") + + +class EndpointInfo(NamedTuple): + path: str + http_method: str + func: Callable[..., Any] + + +_remove_converter_pattern = re.compile(r":\w+}") + + +class BaseSchemaGenerator: + def get_schema(self, routes: list[BaseRoute]) -> dict[str, Any]: + raise NotImplementedError() # pragma: no cover + + def get_endpoints(self, routes: list[BaseRoute]) -> list[EndpointInfo]: + """ + Given the routes, yields the following information: + + - path + eg: /users/ + - http_method + one of 'get', 'post', 'put', 'patch', 'delete', 'options' + - func + method ready to extract the docstring + """ + endpoints_info: list[EndpointInfo] = [] + + for route in routes: + if isinstance(route, Mount | Host): + routes = route.routes or [] + if isinstance(route, Mount): + path = self._remove_converter(route.path) + else: + path = "" + sub_endpoints = [ + EndpointInfo( + path="".join((path, sub_endpoint.path)), + http_method=sub_endpoint.http_method, + func=sub_endpoint.func, + ) + for sub_endpoint in self.get_endpoints(routes) + ] + endpoints_info.extend(sub_endpoints) + + elif not isinstance(route, Route) or not route.include_in_schema: + continue + + elif inspect.isfunction(route.endpoint) or inspect.ismethod(route.endpoint): + path = self._remove_converter(route.path) + for method in route.methods or ["GET"]: + if method == "HEAD": + continue + endpoints_info.append(EndpointInfo(path, method.lower(), route.endpoint)) + else: + path = self._remove_converter(route.path) + for method in ["get", "post", "put", "patch", "delete", "options"]: + if not hasattr(route.endpoint, method): + continue + func = getattr(route.endpoint, method) + endpoints_info.append(EndpointInfo(path, method.lower(), func)) + + return endpoints_info + + def _remove_converter(self, path: str) -> str: + """ + Remove the converter from the path. + For example, a route like this: + Route("/users/{id:int}", endpoint=get_user, methods=["GET"]) + Should be represented as `/users/{id}` in the OpenAPI schema. + """ + return _remove_converter_pattern.sub("}", path) + + def parse_docstring(self, func_or_method: Callable[..., Any]) -> dict[str, Any]: + """ + Given a function, parse the docstring as YAML and return a dictionary of info. + """ + docstring = func_or_method.__doc__ + if not docstring: + return {} + + assert yaml is not None, "`pyyaml` must be installed to use parse_docstring." + + # We support having regular docstrings before the schema + # definition. Here we return just the schema part from + # the docstring. + docstring = docstring.split("---")[-1] + + parsed = yaml.safe_load(docstring) + + if not isinstance(parsed, dict): + # A regular docstring (not yaml formatted) can return + # a simple string here, which wouldn't follow the schema. + return {} + + return parsed + + def OpenAPIResponse(self, request: Request) -> Response: + routes = request.app.routes + schema = self.get_schema(routes=routes) + return OpenAPIResponse(schema) + + +class SchemaGenerator(BaseSchemaGenerator): + def __init__(self, base_schema: dict[str, Any]) -> None: + self.base_schema = base_schema + + def get_schema(self, routes: list[BaseRoute]) -> dict[str, Any]: + schema = dict(self.base_schema) + schema.setdefault("paths", {}) + endpoints_info = self.get_endpoints(routes) + + for endpoint in endpoints_info: + parsed = self.parse_docstring(endpoint.func) + + if not parsed: + continue + + if endpoint.path not in schema["paths"]: + schema["paths"][endpoint.path] = {} + + schema["paths"][endpoint.path][endpoint.http_method] = parsed + + return schema diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/staticfiles.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/staticfiles.py new file mode 100644 index 0000000000000000000000000000000000000000..a458fd7d8aa5d1cd61add58fd4c65588fff220ec --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/staticfiles.py @@ -0,0 +1,217 @@ +from __future__ import annotations + +import errno +import importlib.util +import os +import stat +from email.utils import parsedate +from typing import Union + +import anyio +import anyio.to_thread + +from starlette._utils import get_route_path +from starlette.datastructures import URL, Headers +from starlette.exceptions import HTTPException +from starlette.responses import FileResponse, RedirectResponse, Response +from starlette.types import Receive, Scope, Send + +PathLike = Union[str, "os.PathLike[str]"] + + +class NotModifiedResponse(Response): + NOT_MODIFIED_HEADERS = ( + "cache-control", + "content-location", + "date", + "etag", + "expires", + "vary", + ) + + def __init__(self, headers: Headers): + super().__init__( + status_code=304, + headers={name: value for name, value in headers.items() if name in self.NOT_MODIFIED_HEADERS}, + ) + + +class StaticFiles: + def __init__( + self, + *, + directory: PathLike | None = None, + packages: list[str | tuple[str, str]] | None = None, + html: bool = False, + check_dir: bool = True, + follow_symlink: bool = False, + ) -> None: + self.directory = directory + self.packages = packages + self.all_directories = self.get_directories(directory, packages) + self.html = html + self.config_checked = False + self.follow_symlink = follow_symlink + if check_dir and directory is not None and not os.path.isdir(directory): + raise RuntimeError(f"Directory '{directory}' does not exist") + + def get_directories( + self, + directory: PathLike | None = None, + packages: list[str | tuple[str, str]] | None = None, + ) -> list[PathLike]: + """ + Given `directory` and `packages` arguments, return a list of all the + directories that should be used for serving static files from. + """ + directories = [] + if directory is not None: + directories.append(directory) + + for package in packages or []: + if isinstance(package, tuple): + package, statics_dir = package + else: + statics_dir = "statics" + spec = importlib.util.find_spec(package) + assert spec is not None, f"Package {package!r} could not be found." + assert spec.origin is not None, f"Package {package!r} could not be found." + package_directory = os.path.normpath(os.path.join(spec.origin, "..", statics_dir)) + assert os.path.isdir(package_directory), ( + f"Directory '{statics_dir!r}' in package {package!r} could not be found." + ) + directories.append(package_directory) + + return directories + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + """ + The ASGI entry point. + """ + assert scope["type"] == "http" + + if not self.config_checked: + await self.check_config() + self.config_checked = True + + path = self.get_path(scope) + response = await self.get_response(path, scope) + await response(scope, receive, send) + + def get_path(self, scope: Scope) -> str: + """ + Given the ASGI scope, return the `path` string to serve up, + with OS specific path separators, and any '..', '.' components removed. + """ + route_path = get_route_path(scope) + return os.path.normpath(os.path.join(*route_path.split("/"))) + + async def get_response(self, path: str, scope: Scope) -> Response: + """ + Returns an HTTP response, given the incoming path, method and request headers. + """ + if scope["method"] not in ("GET", "HEAD"): + raise HTTPException(status_code=405) + + try: + full_path, stat_result = await anyio.to_thread.run_sync(self.lookup_path, path) + except PermissionError: + raise HTTPException(status_code=401) + except OSError as exc: + # Filename is too long, so it can't be a valid static file. + if exc.errno == errno.ENAMETOOLONG: + raise HTTPException(status_code=404) + + raise exc + + if stat_result and stat.S_ISREG(stat_result.st_mode): + # We have a static file to serve. + return self.file_response(full_path, stat_result, scope) + + elif stat_result and stat.S_ISDIR(stat_result.st_mode) and self.html: + # We're in HTML mode, and have got a directory URL. + # Check if we have 'index.html' file to serve. + index_path = os.path.join(path, "index.html") + full_path, stat_result = await anyio.to_thread.run_sync(self.lookup_path, index_path) + if stat_result is not None and stat.S_ISREG(stat_result.st_mode): + if not scope["path"].endswith("/"): + # Directory URLs should redirect to always end in "/". + url = URL(scope=scope) + url = url.replace(path=url.path + "/") + return RedirectResponse(url=url) + return self.file_response(full_path, stat_result, scope) + + if self.html: + # Check for '404.html' if we're in HTML mode. + full_path, stat_result = await anyio.to_thread.run_sync(self.lookup_path, "404.html") + if stat_result and stat.S_ISREG(stat_result.st_mode): + return FileResponse(full_path, stat_result=stat_result, status_code=404) + raise HTTPException(status_code=404) + + def lookup_path(self, path: str) -> tuple[str, os.stat_result | None]: + for directory in self.all_directories: + joined_path = os.path.join(directory, path) + if self.follow_symlink: + full_path = os.path.abspath(joined_path) + directory = os.path.abspath(directory) + else: + full_path = os.path.realpath(joined_path) + directory = os.path.realpath(directory) + if os.path.commonpath([full_path, directory]) != str(directory): + # Don't allow misbehaving clients to break out of the static files directory. + continue + try: + return full_path, os.stat(full_path) + except (FileNotFoundError, NotADirectoryError): + continue + return "", None + + def file_response( + self, + full_path: PathLike, + stat_result: os.stat_result, + scope: Scope, + status_code: int = 200, + ) -> Response: + request_headers = Headers(scope=scope) + + response = FileResponse(full_path, status_code=status_code, stat_result=stat_result) + if self.is_not_modified(response.headers, request_headers): + return NotModifiedResponse(response.headers) + return response + + async def check_config(self) -> None: + """ + Perform a one-off configuration check that StaticFiles is actually + pointed at a directory, so that we can raise loud errors rather than + just returning 404 responses. + """ + if self.directory is None: + return + + try: + stat_result = await anyio.to_thread.run_sync(os.stat, self.directory) + except FileNotFoundError: + raise RuntimeError(f"StaticFiles directory '{self.directory}' does not exist.") + if not (stat.S_ISDIR(stat_result.st_mode) or stat.S_ISLNK(stat_result.st_mode)): + raise RuntimeError(f"StaticFiles path '{self.directory}' is not a directory.") + + def is_not_modified(self, response_headers: Headers, request_headers: Headers) -> bool: + """ + Given the request and response headers, return `True` if an HTTP + "Not Modified" response could be returned instead. + """ + if if_none_match := request_headers.get("if-none-match"): + # The "etag" header is added by FileResponse, so it's always present. + etag = response_headers["etag"] + return etag in [tag.strip(" W/") for tag in if_none_match.split(",")] + + try: + if_modified_since = parsedate(request_headers["if-modified-since"]) + last_modified = parsedate(response_headers["last-modified"]) + if if_modified_since is not None and last_modified is not None and if_modified_since >= last_modified: + return True + except KeyError: + pass + + return False diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/status.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/status.py new file mode 100644 index 0000000000000000000000000000000000000000..0160aac354f7fcf2041de3e8dd3244ed5a6ab455 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/status.py @@ -0,0 +1,209 @@ +""" +HTTP codes +See HTTP Status Code Registry: +https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml + +And RFC 9110 - https://www.rfc-editor.org/rfc/rfc9110 +""" + +from __future__ import annotations + +import warnings + +__all__ = [ + "HTTP_100_CONTINUE", + "HTTP_101_SWITCHING_PROTOCOLS", + "HTTP_102_PROCESSING", + "HTTP_103_EARLY_HINTS", + "HTTP_200_OK", + "HTTP_201_CREATED", + "HTTP_202_ACCEPTED", + "HTTP_203_NON_AUTHORITATIVE_INFORMATION", + "HTTP_204_NO_CONTENT", + "HTTP_205_RESET_CONTENT", + "HTTP_206_PARTIAL_CONTENT", + "HTTP_207_MULTI_STATUS", + "HTTP_208_ALREADY_REPORTED", + "HTTP_226_IM_USED", + "HTTP_300_MULTIPLE_CHOICES", + "HTTP_301_MOVED_PERMANENTLY", + "HTTP_302_FOUND", + "HTTP_303_SEE_OTHER", + "HTTP_304_NOT_MODIFIED", + "HTTP_305_USE_PROXY", + "HTTP_306_RESERVED", + "HTTP_307_TEMPORARY_REDIRECT", + "HTTP_308_PERMANENT_REDIRECT", + "HTTP_400_BAD_REQUEST", + "HTTP_401_UNAUTHORIZED", + "HTTP_402_PAYMENT_REQUIRED", + "HTTP_403_FORBIDDEN", + "HTTP_404_NOT_FOUND", + "HTTP_405_METHOD_NOT_ALLOWED", + "HTTP_406_NOT_ACCEPTABLE", + "HTTP_407_PROXY_AUTHENTICATION_REQUIRED", + "HTTP_408_REQUEST_TIMEOUT", + "HTTP_409_CONFLICT", + "HTTP_410_GONE", + "HTTP_411_LENGTH_REQUIRED", + "HTTP_412_PRECONDITION_FAILED", + "HTTP_413_CONTENT_TOO_LARGE", + "HTTP_414_URI_TOO_LONG", + "HTTP_415_UNSUPPORTED_MEDIA_TYPE", + "HTTP_416_RANGE_NOT_SATISFIABLE", + "HTTP_417_EXPECTATION_FAILED", + "HTTP_418_IM_A_TEAPOT", + "HTTP_421_MISDIRECTED_REQUEST", + "HTTP_422_UNPROCESSABLE_CONTENT", + "HTTP_423_LOCKED", + "HTTP_424_FAILED_DEPENDENCY", + "HTTP_425_TOO_EARLY", + "HTTP_426_UPGRADE_REQUIRED", + "HTTP_428_PRECONDITION_REQUIRED", + "HTTP_429_TOO_MANY_REQUESTS", + "HTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE", + "HTTP_451_UNAVAILABLE_FOR_LEGAL_REASONS", + "HTTP_500_INTERNAL_SERVER_ERROR", + "HTTP_501_NOT_IMPLEMENTED", + "HTTP_502_BAD_GATEWAY", + "HTTP_503_SERVICE_UNAVAILABLE", + "HTTP_504_GATEWAY_TIMEOUT", + "HTTP_505_HTTP_VERSION_NOT_SUPPORTED", + "HTTP_506_VARIANT_ALSO_NEGOTIATES", + "HTTP_507_INSUFFICIENT_STORAGE", + "HTTP_508_LOOP_DETECTED", + "HTTP_510_NOT_EXTENDED", + "HTTP_511_NETWORK_AUTHENTICATION_REQUIRED", + "WS_1000_NORMAL_CLOSURE", + "WS_1001_GOING_AWAY", + "WS_1002_PROTOCOL_ERROR", + "WS_1003_UNSUPPORTED_DATA", + "WS_1005_NO_STATUS_RCVD", + "WS_1006_ABNORMAL_CLOSURE", + "WS_1007_INVALID_FRAME_PAYLOAD_DATA", + "WS_1008_POLICY_VIOLATION", + "WS_1009_MESSAGE_TOO_BIG", + "WS_1010_MANDATORY_EXT", + "WS_1011_INTERNAL_ERROR", + "WS_1012_SERVICE_RESTART", + "WS_1013_TRY_AGAIN_LATER", + "WS_1014_BAD_GATEWAY", + "WS_1015_TLS_HANDSHAKE", +] + +HTTP_100_CONTINUE = 100 +HTTP_101_SWITCHING_PROTOCOLS = 101 +HTTP_102_PROCESSING = 102 +HTTP_103_EARLY_HINTS = 103 +HTTP_200_OK = 200 +HTTP_201_CREATED = 201 +HTTP_202_ACCEPTED = 202 +HTTP_203_NON_AUTHORITATIVE_INFORMATION = 203 +HTTP_204_NO_CONTENT = 204 +HTTP_205_RESET_CONTENT = 205 +HTTP_206_PARTIAL_CONTENT = 206 +HTTP_207_MULTI_STATUS = 207 +HTTP_208_ALREADY_REPORTED = 208 +HTTP_226_IM_USED = 226 +HTTP_300_MULTIPLE_CHOICES = 300 +HTTP_301_MOVED_PERMANENTLY = 301 +HTTP_302_FOUND = 302 +HTTP_303_SEE_OTHER = 303 +HTTP_304_NOT_MODIFIED = 304 +HTTP_305_USE_PROXY = 305 +HTTP_306_RESERVED = 306 +HTTP_307_TEMPORARY_REDIRECT = 307 +HTTP_308_PERMANENT_REDIRECT = 308 +HTTP_400_BAD_REQUEST = 400 +HTTP_401_UNAUTHORIZED = 401 +HTTP_402_PAYMENT_REQUIRED = 402 +HTTP_403_FORBIDDEN = 403 +HTTP_404_NOT_FOUND = 404 +HTTP_405_METHOD_NOT_ALLOWED = 405 +HTTP_406_NOT_ACCEPTABLE = 406 +HTTP_407_PROXY_AUTHENTICATION_REQUIRED = 407 +HTTP_408_REQUEST_TIMEOUT = 408 +HTTP_409_CONFLICT = 409 +HTTP_410_GONE = 410 +HTTP_411_LENGTH_REQUIRED = 411 +HTTP_412_PRECONDITION_FAILED = 412 +HTTP_413_CONTENT_TOO_LARGE = 413 +HTTP_414_URI_TOO_LONG = 414 +HTTP_415_UNSUPPORTED_MEDIA_TYPE = 415 +HTTP_416_RANGE_NOT_SATISFIABLE = 416 +HTTP_417_EXPECTATION_FAILED = 417 +HTTP_418_IM_A_TEAPOT = 418 +HTTP_421_MISDIRECTED_REQUEST = 421 +HTTP_422_UNPROCESSABLE_CONTENT = 422 +HTTP_423_LOCKED = 423 +HTTP_424_FAILED_DEPENDENCY = 424 +HTTP_425_TOO_EARLY = 425 +HTTP_426_UPGRADE_REQUIRED = 426 +HTTP_428_PRECONDITION_REQUIRED = 428 +HTTP_429_TOO_MANY_REQUESTS = 429 +HTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE = 431 +HTTP_451_UNAVAILABLE_FOR_LEGAL_REASONS = 451 +HTTP_500_INTERNAL_SERVER_ERROR = 500 +HTTP_501_NOT_IMPLEMENTED = 501 +HTTP_502_BAD_GATEWAY = 502 +HTTP_503_SERVICE_UNAVAILABLE = 503 +HTTP_504_GATEWAY_TIMEOUT = 504 +HTTP_505_HTTP_VERSION_NOT_SUPPORTED = 505 +HTTP_506_VARIANT_ALSO_NEGOTIATES = 506 +HTTP_507_INSUFFICIENT_STORAGE = 507 +HTTP_508_LOOP_DETECTED = 508 +HTTP_510_NOT_EXTENDED = 510 +HTTP_511_NETWORK_AUTHENTICATION_REQUIRED = 511 + + +""" +WebSocket codes +https://www.iana.org/assignments/websocket/websocket.xml#close-code-number +https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent +""" +WS_1000_NORMAL_CLOSURE = 1000 +WS_1001_GOING_AWAY = 1001 +WS_1002_PROTOCOL_ERROR = 1002 +WS_1003_UNSUPPORTED_DATA = 1003 +WS_1005_NO_STATUS_RCVD = 1005 +WS_1006_ABNORMAL_CLOSURE = 1006 +WS_1007_INVALID_FRAME_PAYLOAD_DATA = 1007 +WS_1008_POLICY_VIOLATION = 1008 +WS_1009_MESSAGE_TOO_BIG = 1009 +WS_1010_MANDATORY_EXT = 1010 +WS_1011_INTERNAL_ERROR = 1011 +WS_1012_SERVICE_RESTART = 1012 +WS_1013_TRY_AGAIN_LATER = 1013 +WS_1014_BAD_GATEWAY = 1014 +WS_1015_TLS_HANDSHAKE = 1015 + +__deprecated__ = { + "HTTP_413_REQUEST_ENTITY_TOO_LARGE": 413, + "HTTP_414_REQUEST_URI_TOO_LONG": 414, + "HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE": 416, + "HTTP_422_UNPROCESSABLE_ENTITY": 422, +} + + +def __getattr__(name: str) -> int: + deprecation_changes = { + "HTTP_413_REQUEST_ENTITY_TOO_LARGE": "HTTP_413_CONTENT_TOO_LARGE", + "HTTP_414_REQUEST_URI_TOO_LONG": "HTTP_414_URI_TOO_LONG", + "HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE": "HTTP_416_RANGE_NOT_SATISFIABLE", + "HTTP_422_UNPROCESSABLE_ENTITY": "HTTP_422_UNPROCESSABLE_CONTENT", + } + + deprecated = __deprecated__.get(name) + if deprecated: + warnings.warn( + f"'{name}' is deprecated. Use '{deprecation_changes[name]}' instead.", + category=DeprecationWarning, + stacklevel=3, + ) + return deprecated + + raise AttributeError(f"module 'starlette.status' has no attribute '{name}'") + + +def __dir__() -> list[str]: + return sorted(list(__all__) + list(__deprecated__.keys())) # pragma: no cover diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/templating.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/templating.py new file mode 100644 index 0000000000000000000000000000000000000000..1f753bca4c084f6127af32271294bf47ee88c491 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/templating.py @@ -0,0 +1,217 @@ +from __future__ import annotations + +import warnings +from collections.abc import Callable, Mapping, Sequence +from os import PathLike +from typing import Any, cast, overload + +from starlette.background import BackgroundTask +from starlette.datastructures import URL +from starlette.requests import Request +from starlette.responses import HTMLResponse +from starlette.types import Receive, Scope, Send + +try: + import jinja2 + + # @contextfunction was renamed to @pass_context in Jinja 3.0, and was removed in 3.1 + # hence we try to get pass_context (most installs will be >=3.1) + # and fall back to contextfunction, + # adding a type ignore for mypy to let us access an attribute that may not exist + if hasattr(jinja2, "pass_context"): + pass_context = jinja2.pass_context + else: # pragma: no cover + pass_context = jinja2.contextfunction # type: ignore[attr-defined] +except ModuleNotFoundError: # pragma: no cover + jinja2 = None # type: ignore[assignment] + + +class _TemplateResponse(HTMLResponse): + def __init__( + self, + template: Any, + context: dict[str, Any], + status_code: int = 200, + headers: Mapping[str, str] | None = None, + media_type: str | None = None, + background: BackgroundTask | None = None, + ): + self.template = template + self.context = context + content = template.render(context) + super().__init__(content, status_code, headers, media_type, background) + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + request = self.context.get("request", {}) + extensions = request.get("extensions", {}) + if "http.response.debug" in extensions: # pragma: no branch + await send( + { + "type": "http.response.debug", + "info": { + "template": self.template, + "context": self.context, + }, + } + ) + await super().__call__(scope, receive, send) + + +class Jinja2Templates: + """ + templates = Jinja2Templates("templates") + + return templates.TemplateResponse("index.html", {"request": request}) + """ + + @overload + def __init__( + self, + directory: str | PathLike[str] | Sequence[str | PathLike[str]], + *, + context_processors: list[Callable[[Request], dict[str, Any]]] | None = None, + **env_options: Any, + ) -> None: ... + + @overload + def __init__( + self, + *, + env: jinja2.Environment, + context_processors: list[Callable[[Request], dict[str, Any]]] | None = None, + ) -> None: ... + + def __init__( + self, + directory: str | PathLike[str] | Sequence[str | PathLike[str]] | None = None, + *, + context_processors: list[Callable[[Request], dict[str, Any]]] | None = None, + env: jinja2.Environment | None = None, + **env_options: Any, + ) -> None: + if env_options: + warnings.warn( + "Extra environment options are deprecated. Use a preconfigured jinja2.Environment instead.", + DeprecationWarning, + ) + assert jinja2 is not None, "jinja2 must be installed to use Jinja2Templates" + assert bool(directory) ^ bool(env), "either 'directory' or 'env' arguments must be passed" + self.context_processors = context_processors or [] + if directory is not None: + self.env = self._create_env(directory, **env_options) + elif env is not None: # pragma: no branch + self.env = env + + self._setup_env_defaults(self.env) + + def _create_env( + self, + directory: str | PathLike[str] | Sequence[str | PathLike[str]], + **env_options: Any, + ) -> jinja2.Environment: + loader = jinja2.FileSystemLoader(directory) + env_options.setdefault("loader", loader) + env_options.setdefault("autoescape", True) + + return jinja2.Environment(**env_options) + + def _setup_env_defaults(self, env: jinja2.Environment) -> None: + @pass_context + def url_for( + context: dict[str, Any], + name: str, + /, + **path_params: Any, + ) -> URL: + request: Request = context["request"] + return request.url_for(name, **path_params) + + env.globals.setdefault("url_for", url_for) + + def get_template(self, name: str) -> jinja2.Template: + return self.env.get_template(name) + + @overload + def TemplateResponse( + self, + request: Request, + name: str, + context: dict[str, Any] | None = None, + status_code: int = 200, + headers: Mapping[str, str] | None = None, + media_type: str | None = None, + background: BackgroundTask | None = None, + ) -> _TemplateResponse: ... + + @overload + def TemplateResponse( + self, + name: str, + context: dict[str, Any] | None = None, + status_code: int = 200, + headers: Mapping[str, str] | None = None, + media_type: str | None = None, + background: BackgroundTask | None = None, + ) -> _TemplateResponse: + # Deprecated usage + ... + + def TemplateResponse(self, *args: Any, **kwargs: Any) -> _TemplateResponse: + if args: + if isinstance(args[0], str): # the first argument is template name (old style) + warnings.warn( + "The `name` is not the first parameter anymore. " + "The first parameter should be the `Request` instance.\n" + 'Replace `TemplateResponse(name, {"request": request})` by `TemplateResponse(request, name)`.', + DeprecationWarning, + ) + + name = args[0] + context = args[1] if len(args) > 1 else kwargs.get("context", {}) + status_code = args[2] if len(args) > 2 else kwargs.get("status_code", 200) + headers = args[3] if len(args) > 3 else kwargs.get("headers") + media_type = args[4] if len(args) > 4 else kwargs.get("media_type") + background = args[5] if len(args) > 5 else kwargs.get("background") + + if "request" not in context: + raise ValueError('context must include a "request" key') + request = context["request"] + else: # the first argument is a request instance (new style) + request = args[0] + name = args[1] if len(args) > 1 else kwargs["name"] + context = args[2] if len(args) > 2 else kwargs.get("context", {}) + status_code = args[3] if len(args) > 3 else kwargs.get("status_code", 200) + headers = args[4] if len(args) > 4 else kwargs.get("headers") + media_type = args[5] if len(args) > 5 else kwargs.get("media_type") + background = args[6] if len(args) > 6 else kwargs.get("background") + else: # all arguments are kwargs + if "request" not in kwargs: + warnings.warn( + "The `TemplateResponse` now requires the `request` argument.\n" + 'Replace `TemplateResponse(name, {"context": context})` by `TemplateResponse(request, name)`.', + DeprecationWarning, + ) + if "request" not in kwargs.get("context", {}): + raise ValueError('context must include a "request" key') + + context = kwargs.get("context", {}) + request = kwargs.get("request", context.get("request")) + name = cast(str, kwargs["name"]) + status_code = kwargs.get("status_code", 200) + headers = kwargs.get("headers") + media_type = kwargs.get("media_type") + background = kwargs.get("background") + + context.setdefault("request", request) + for context_processor in self.context_processors: + context.update(context_processor(request)) + + template = self.get_template(name) + return _TemplateResponse( + template, + context, + status_code=status_code, + headers=headers, + media_type=media_type, + background=background, + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/testclient.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/testclient.py new file mode 100644 index 0000000000000000000000000000000000000000..0f530e54fa2955bb1f0ff7615b3e879e3787ef06 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/testclient.py @@ -0,0 +1,739 @@ +from __future__ import annotations + +import contextlib +import inspect +import io +import json +import math +import sys +import warnings +from collections.abc import Awaitable, Callable, Generator, Iterable, Mapping, MutableMapping, Sequence +from concurrent.futures import Future +from contextlib import AbstractContextManager +from types import GeneratorType +from typing import ( + Any, + Literal, + TypedDict, + TypeGuard, + cast, +) +from urllib.parse import unquote, urljoin + +import anyio +import anyio.abc +import anyio.from_thread +from anyio.streams.stapled import StapledObjectStream + +from starlette._utils import is_async_callable +from starlette.types import ASGIApp, Message, Receive, Scope, Send +from starlette.websockets import WebSocketDisconnect + +if sys.version_info >= (3, 11): # pragma: no cover + from typing import Self +else: # pragma: no cover + from typing_extensions import Self + +try: + import httpx +except ModuleNotFoundError: # pragma: no cover + raise RuntimeError( + "The starlette.testclient module requires the httpx package to be installed.\n" + "You can install this with:\n" + " $ pip install httpx\n" + ) +_PortalFactoryType = Callable[[], AbstractContextManager[anyio.abc.BlockingPortal]] + +ASGIInstance = Callable[[Receive, Send], Awaitable[None]] +ASGI2App = Callable[[Scope], ASGIInstance] +ASGI3App = Callable[[Scope, Receive, Send], Awaitable[None]] + + +_RequestData = Mapping[str, str | Iterable[str] | bytes] + + +def _is_asgi3(app: ASGI2App | ASGI3App) -> TypeGuard[ASGI3App]: + if inspect.isclass(app): + return hasattr(app, "__await__") + return is_async_callable(app) + + +class _WrapASGI2: + """ + Provide an ASGI3 interface onto an ASGI2 app. + """ + + def __init__(self, app: ASGI2App) -> None: + self.app = app + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + instance = self.app(scope) + await instance(receive, send) + + +class _AsyncBackend(TypedDict): + backend: str + backend_options: dict[str, Any] + + +class _Upgrade(Exception): + def __init__(self, session: WebSocketTestSession) -> None: + self.session = session + + +class WebSocketDenialResponse( # type: ignore[misc] + httpx.Response, + WebSocketDisconnect, +): + """ + A special case of `WebSocketDisconnect`, raised in the `TestClient` if the + `WebSocket` is closed before being accepted with a `send_denial_response()`. + """ + + +class WebSocketTestSession: + def __init__( + self, + app: ASGI3App, + scope: Scope, + portal_factory: _PortalFactoryType, + ) -> None: + self.app = app + self.scope = scope + self.accepted_subprotocol = None + self.portal_factory = portal_factory + self.extra_headers = None + + def __enter__(self) -> WebSocketTestSession: + with contextlib.ExitStack() as stack: + self.portal = portal = stack.enter_context(self.portal_factory()) + fut, cs = portal.start_task(self._run) + stack.callback(fut.result) + stack.callback(portal.call, cs.cancel) + self.send({"type": "websocket.connect"}) + message = self.receive() + self._raise_on_close(message) + self.accepted_subprotocol = message.get("subprotocol", None) + self.extra_headers = message.get("headers", None) + stack.callback(self.close, 1000) + self.exit_stack = stack.pop_all() + return self + + def __exit__(self, *args: Any) -> bool | None: + return self.exit_stack.__exit__(*args) + + async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: + """ + The sub-thread in which the websocket session runs. + """ + send: anyio.create_memory_object_stream[Message] = anyio.create_memory_object_stream(math.inf) + send_tx, send_rx = send + receive: anyio.create_memory_object_stream[Message] = anyio.create_memory_object_stream(math.inf) + receive_tx, receive_rx = receive + with send_tx, send_rx, receive_tx, receive_rx, anyio.CancelScope() as cs: + self._receive_tx = receive_tx + self._send_rx = send_rx + task_status.started(cs) + await self.app(self.scope, receive_rx.receive, send_tx.send) + + # wait for cs.cancel to be called before closing streams + await anyio.sleep_forever() + + def _raise_on_close(self, message: Message) -> None: + if message["type"] == "websocket.close": + raise WebSocketDisconnect(code=message.get("code", 1000), reason=message.get("reason", "")) + elif message["type"] == "websocket.http.response.start": + status_code: int = message["status"] + headers: list[tuple[bytes, bytes]] = message["headers"] + body: list[bytes] = [] + while True: + message = self.receive() + assert message["type"] == "websocket.http.response.body" + body.append(message["body"]) + if not message.get("more_body", False): + break + raise WebSocketDenialResponse(status_code=status_code, headers=headers, content=b"".join(body)) + + def send(self, message: Message) -> None: + self.portal.call(self._receive_tx.send, message) + + def send_text(self, data: str) -> None: + self.send({"type": "websocket.receive", "text": data}) + + def send_bytes(self, data: bytes) -> None: + self.send({"type": "websocket.receive", "bytes": data}) + + def send_json(self, data: Any, mode: Literal["text", "binary"] = "text") -> None: + text = json.dumps(data, separators=(",", ":"), ensure_ascii=False) + if mode == "text": + self.send({"type": "websocket.receive", "text": text}) + else: + self.send({"type": "websocket.receive", "bytes": text.encode("utf-8")}) + + def close(self, code: int = 1000, reason: str | None = None) -> None: + self.send({"type": "websocket.disconnect", "code": code, "reason": reason}) + + def receive(self) -> Message: + return self.portal.call(self._send_rx.receive) + + def receive_text(self) -> str: + message = self.receive() + self._raise_on_close(message) + return cast(str, message["text"]) + + def receive_bytes(self) -> bytes: + message = self.receive() + self._raise_on_close(message) + return cast(bytes, message["bytes"]) + + def receive_json(self, mode: Literal["text", "binary"] = "text") -> Any: + message = self.receive() + self._raise_on_close(message) + if mode == "text": + text = message["text"] + else: + text = message["bytes"].decode("utf-8") + return json.loads(text) + + +class _TestClientTransport(httpx.BaseTransport): + def __init__( + self, + app: ASGI3App, + portal_factory: _PortalFactoryType, + raise_server_exceptions: bool = True, + root_path: str = "", + *, + client: tuple[str, int], + app_state: dict[str, Any], + ) -> None: + self.app = app + self.raise_server_exceptions = raise_server_exceptions + self.root_path = root_path + self.portal_factory = portal_factory + self.app_state = app_state + self.client = client + + def handle_request(self, request: httpx.Request) -> httpx.Response: + scheme = request.url.scheme + netloc = request.url.netloc.decode(encoding="ascii") + path = request.url.path + raw_path = request.url.raw_path + query = request.url.query.decode(encoding="ascii") + + default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] + + if ":" in netloc: + host, port_string = netloc.split(":", 1) + port = int(port_string) + else: + host = netloc + port = default_port + + # Include the 'host' header. + if "host" in request.headers: + headers: list[tuple[bytes, bytes]] = [] + elif port == default_port: # pragma: no cover + headers = [(b"host", host.encode())] + else: # pragma: no cover + headers = [(b"host", (f"{host}:{port}").encode())] + + # Include other request headers. + headers += [(key.lower().encode(), value.encode()) for key, value in request.headers.multi_items()] + + scope: dict[str, Any] + + if scheme in {"ws", "wss"}: + subprotocol = request.headers.get("sec-websocket-protocol", None) + if subprotocol is None: + subprotocols: Sequence[str] = [] + else: + subprotocols = [value.strip() for value in subprotocol.split(",")] + scope = { + "type": "websocket", + "path": unquote(path), + "raw_path": raw_path.split(b"?", 1)[0], + "root_path": self.root_path, + "scheme": scheme, + "query_string": query.encode(), + "headers": headers, + "client": self.client, + "server": [host, port], + "subprotocols": subprotocols, + "state": self.app_state.copy(), + "extensions": {"websocket.http.response": {}}, + } + session = WebSocketTestSession(self.app, scope, self.portal_factory) + raise _Upgrade(session) + + scope = { + "type": "http", + "http_version": "1.1", + "method": request.method, + "path": unquote(path), + "raw_path": raw_path.split(b"?", 1)[0], + "root_path": self.root_path, + "scheme": scheme, + "query_string": query.encode(), + "headers": headers, + "client": self.client, + "server": [host, port], + "extensions": {"http.response.debug": {}}, + "state": self.app_state.copy(), + } + + request_complete = False + response_started = False + response_complete: anyio.Event + raw_kwargs: dict[str, Any] = {"stream": io.BytesIO()} + template = None + context = None + + async def receive() -> Message: + nonlocal request_complete + + if request_complete: + if not response_complete.is_set(): + await response_complete.wait() + return {"type": "http.disconnect"} + + body = request.read() + if isinstance(body, str): + body_bytes: bytes = body.encode("utf-8") # pragma: no cover + elif body is None: + body_bytes = b"" # pragma: no cover + elif isinstance(body, GeneratorType): + try: # pragma: no cover + chunk = body.send(None) + if isinstance(chunk, str): + chunk = chunk.encode("utf-8") + return {"type": "http.request", "body": chunk, "more_body": True} + except StopIteration: # pragma: no cover + request_complete = True + return {"type": "http.request", "body": b""} + else: + body_bytes = body + + request_complete = True + return {"type": "http.request", "body": body_bytes} + + async def send(message: Message) -> None: + nonlocal raw_kwargs, response_started, template, context + + if message["type"] == "http.response.start": + assert not response_started, 'Received multiple "http.response.start" messages.' + raw_kwargs["status_code"] = message["status"] + raw_kwargs["headers"] = [(key.decode(), value.decode()) for key, value in message.get("headers", [])] + response_started = True + elif message["type"] == "http.response.body": + assert response_started, 'Received "http.response.body" without "http.response.start".' + assert not response_complete.is_set(), 'Received "http.response.body" after response completed.' + body = message.get("body", b"") + more_body = message.get("more_body", False) + if request.method != "HEAD": + raw_kwargs["stream"].write(body) + if not more_body: + raw_kwargs["stream"].seek(0) + response_complete.set() + elif message["type"] == "http.response.debug": + template = message["info"]["template"] + context = message["info"]["context"] + + try: + with self.portal_factory() as portal: + response_complete = portal.call(anyio.Event) + portal.call(self.app, scope, receive, send) + except BaseException as exc: + if self.raise_server_exceptions: + raise exc + + if self.raise_server_exceptions: + assert response_started, "TestClient did not receive any response." + elif not response_started: + raw_kwargs = { + "status_code": 500, + "headers": [], + "stream": io.BytesIO(), + } + + raw_kwargs["stream"] = httpx.ByteStream(raw_kwargs["stream"].read()) + + response = httpx.Response(**raw_kwargs, request=request) + if template is not None: + response.template = template # type: ignore[attr-defined] + response.context = context # type: ignore[attr-defined] + return response + + +class TestClient(httpx.Client): + __test__ = False + task: Future[None] + portal: anyio.abc.BlockingPortal | None = None + + def __init__( + self, + app: ASGIApp, + base_url: str = "http://testserver", + raise_server_exceptions: bool = True, + root_path: str = "", + backend: Literal["asyncio", "trio"] = "asyncio", + backend_options: dict[str, Any] | None = None, + cookies: httpx._types.CookieTypes | None = None, + headers: dict[str, str] | None = None, + follow_redirects: bool = True, + client: tuple[str, int] = ("testclient", 50000), + ) -> None: + self.async_backend = _AsyncBackend(backend=backend, backend_options=backend_options or {}) + if _is_asgi3(app): + asgi_app = app + else: + app = cast(ASGI2App, app) # type: ignore[assignment] + asgi_app = _WrapASGI2(app) # type: ignore[arg-type] + self.app = asgi_app + self.app_state: dict[str, Any] = {} + transport = _TestClientTransport( + self.app, + portal_factory=self._portal_factory, + raise_server_exceptions=raise_server_exceptions, + root_path=root_path, + app_state=self.app_state, + client=client, + ) + if headers is None: + headers = {} + headers.setdefault("user-agent", "testclient") + super().__init__( + base_url=base_url, + headers=headers, + transport=transport, + follow_redirects=follow_redirects, + cookies=cookies, + ) + + @contextlib.contextmanager + def _portal_factory(self) -> Generator[anyio.abc.BlockingPortal, None, None]: + if self.portal is not None: + yield self.portal + else: + with anyio.from_thread.start_blocking_portal(**self.async_backend) as portal: + yield portal + + def request( # type: ignore[override] + self, + method: str, + url: httpx._types.URLTypes, + *, + content: httpx._types.RequestContent | None = None, + data: _RequestData | None = None, + files: httpx._types.RequestFiles | None = None, + json: Any = None, + params: httpx._types.QueryParamTypes | None = None, + headers: httpx._types.HeaderTypes | None = None, + cookies: httpx._types.CookieTypes | None = None, + auth: httpx._types.AuthTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + follow_redirects: bool | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + timeout: httpx._types.TimeoutTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + extensions: dict[str, Any] | None = None, + ) -> httpx.Response: + if timeout is not httpx.USE_CLIENT_DEFAULT: + warnings.warn( + "You should not use the 'timeout' argument with the TestClient. " + "See https://github.com/Kludex/starlette/issues/1108 for more information.", + DeprecationWarning, + ) + url = self._merge_url(url) + return super().request( + method, + url, + content=content, + data=data, + files=files, + json=json, + params=params, + headers=headers, + cookies=cookies, + auth=auth, + follow_redirects=follow_redirects, + timeout=timeout, + extensions=extensions, + ) + + def get( # type: ignore[override] + self, + url: httpx._types.URLTypes, + *, + params: httpx._types.QueryParamTypes | None = None, + headers: httpx._types.HeaderTypes | None = None, + cookies: httpx._types.CookieTypes | None = None, + auth: httpx._types.AuthTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + follow_redirects: bool | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + timeout: httpx._types.TimeoutTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + extensions: dict[str, Any] | None = None, + ) -> httpx.Response: + return super().get( + url, + params=params, + headers=headers, + cookies=cookies, + auth=auth, + follow_redirects=follow_redirects, + timeout=timeout, + extensions=extensions, + ) + + def options( # type: ignore[override] + self, + url: httpx._types.URLTypes, + *, + params: httpx._types.QueryParamTypes | None = None, + headers: httpx._types.HeaderTypes | None = None, + cookies: httpx._types.CookieTypes | None = None, + auth: httpx._types.AuthTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + follow_redirects: bool | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + timeout: httpx._types.TimeoutTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + extensions: dict[str, Any] | None = None, + ) -> httpx.Response: + return super().options( + url, + params=params, + headers=headers, + cookies=cookies, + auth=auth, + follow_redirects=follow_redirects, + timeout=timeout, + extensions=extensions, + ) + + def head( # type: ignore[override] + self, + url: httpx._types.URLTypes, + *, + params: httpx._types.QueryParamTypes | None = None, + headers: httpx._types.HeaderTypes | None = None, + cookies: httpx._types.CookieTypes | None = None, + auth: httpx._types.AuthTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + follow_redirects: bool | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + timeout: httpx._types.TimeoutTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + extensions: dict[str, Any] | None = None, + ) -> httpx.Response: + return super().head( + url, + params=params, + headers=headers, + cookies=cookies, + auth=auth, + follow_redirects=follow_redirects, + timeout=timeout, + extensions=extensions, + ) + + def post( # type: ignore[override] + self, + url: httpx._types.URLTypes, + *, + content: httpx._types.RequestContent | None = None, + data: _RequestData | None = None, + files: httpx._types.RequestFiles | None = None, + json: Any = None, + params: httpx._types.QueryParamTypes | None = None, + headers: httpx._types.HeaderTypes | None = None, + cookies: httpx._types.CookieTypes | None = None, + auth: httpx._types.AuthTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + follow_redirects: bool | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + timeout: httpx._types.TimeoutTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + extensions: dict[str, Any] | None = None, + ) -> httpx.Response: + return super().post( + url, + content=content, + data=data, + files=files, + json=json, + params=params, + headers=headers, + cookies=cookies, + auth=auth, + follow_redirects=follow_redirects, + timeout=timeout, + extensions=extensions, + ) + + def put( # type: ignore[override] + self, + url: httpx._types.URLTypes, + *, + content: httpx._types.RequestContent | None = None, + data: _RequestData | None = None, + files: httpx._types.RequestFiles | None = None, + json: Any = None, + params: httpx._types.QueryParamTypes | None = None, + headers: httpx._types.HeaderTypes | None = None, + cookies: httpx._types.CookieTypes | None = None, + auth: httpx._types.AuthTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + follow_redirects: bool | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + timeout: httpx._types.TimeoutTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + extensions: dict[str, Any] | None = None, + ) -> httpx.Response: + return super().put( + url, + content=content, + data=data, + files=files, + json=json, + params=params, + headers=headers, + cookies=cookies, + auth=auth, + follow_redirects=follow_redirects, + timeout=timeout, + extensions=extensions, + ) + + def patch( # type: ignore[override] + self, + url: httpx._types.URLTypes, + *, + content: httpx._types.RequestContent | None = None, + data: _RequestData | None = None, + files: httpx._types.RequestFiles | None = None, + json: Any = None, + params: httpx._types.QueryParamTypes | None = None, + headers: httpx._types.HeaderTypes | None = None, + cookies: httpx._types.CookieTypes | None = None, + auth: httpx._types.AuthTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + follow_redirects: bool | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + timeout: httpx._types.TimeoutTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + extensions: dict[str, Any] | None = None, + ) -> httpx.Response: + return super().patch( + url, + content=content, + data=data, + files=files, + json=json, + params=params, + headers=headers, + cookies=cookies, + auth=auth, + follow_redirects=follow_redirects, + timeout=timeout, + extensions=extensions, + ) + + def delete( # type: ignore[override] + self, + url: httpx._types.URLTypes, + *, + params: httpx._types.QueryParamTypes | None = None, + headers: httpx._types.HeaderTypes | None = None, + cookies: httpx._types.CookieTypes | None = None, + auth: httpx._types.AuthTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + follow_redirects: bool | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + timeout: httpx._types.TimeoutTypes | httpx._client.UseClientDefault = httpx._client.USE_CLIENT_DEFAULT, + extensions: dict[str, Any] | None = None, + ) -> httpx.Response: + return super().delete( + url, + params=params, + headers=headers, + cookies=cookies, + auth=auth, + follow_redirects=follow_redirects, + timeout=timeout, + extensions=extensions, + ) + + def websocket_connect( + self, + url: str, + subprotocols: Sequence[str] | None = None, + **kwargs: Any, + ) -> WebSocketTestSession: + url = urljoin("ws://testserver", url) + headers = kwargs.get("headers", {}) + headers.setdefault("connection", "upgrade") + headers.setdefault("sec-websocket-key", "testserver==") + headers.setdefault("sec-websocket-version", "13") + if subprotocols is not None: + headers.setdefault("sec-websocket-protocol", ", ".join(subprotocols)) + kwargs["headers"] = headers + try: + super().request("GET", url, **kwargs) + except _Upgrade as exc: + session = exc.session + else: + raise RuntimeError("Expected WebSocket upgrade") # pragma: no cover + + return session + + def __enter__(self) -> Self: + with contextlib.ExitStack() as stack: + self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) + + @stack.callback + def reset_portal() -> None: + self.portal = None + + send: anyio.create_memory_object_stream[MutableMapping[str, Any] | None] = ( + anyio.create_memory_object_stream(math.inf) + ) + receive: anyio.create_memory_object_stream[MutableMapping[str, Any]] = anyio.create_memory_object_stream( + math.inf + ) + for channel in (*send, *receive): + stack.callback(channel.close) + self.stream_send = StapledObjectStream(*send) + self.stream_receive = StapledObjectStream(*receive) + self.task = portal.start_task_soon(self.lifespan) + portal.call(self.wait_startup) + + @stack.callback + def wait_shutdown() -> None: + portal.call(self.wait_shutdown) + + self.exit_stack = stack.pop_all() + + return self + + def __exit__(self, *args: Any) -> None: + self.exit_stack.close() + + async def lifespan(self) -> None: + scope = {"type": "lifespan", "state": self.app_state} + try: + await self.app(scope, self.stream_receive.receive, self.stream_send.send) + finally: + await self.stream_send.send(None) + + async def wait_startup(self) -> None: + await self.stream_receive.send({"type": "lifespan.startup"}) + + async def receive() -> Any: + message = await self.stream_send.receive() + if message is None: + self.task.result() + return message + + message = await receive() + assert message["type"] in ( + "lifespan.startup.complete", + "lifespan.startup.failed", + ) + if message["type"] == "lifespan.startup.failed": + await receive() + + async def wait_shutdown(self) -> None: + async def receive() -> Any: + message = await self.stream_send.receive() + if message is None: + self.task.result() + return message + + await self.stream_receive.send({"type": "lifespan.shutdown"}) + message = await receive() + assert message["type"] in ( + "lifespan.shutdown.complete", + "lifespan.shutdown.failed", + ) + if message["type"] == "lifespan.shutdown.failed": + await receive() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/types.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/types.py new file mode 100644 index 0000000000000000000000000000000000000000..b767ae1599a781d8544e605faaabcfdcca194ac8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/types.py @@ -0,0 +1,26 @@ +from collections.abc import Awaitable, Callable, Mapping, MutableMapping +from contextlib import AbstractAsyncContextManager +from typing import TYPE_CHECKING, Any, TypeVar + +if TYPE_CHECKING: + from starlette.requests import Request + from starlette.responses import Response + from starlette.websockets import WebSocket + +AppType = TypeVar("AppType") + +Scope = MutableMapping[str, Any] +Message = MutableMapping[str, Any] + +Receive = Callable[[], Awaitable[Message]] +Send = Callable[[Message], Awaitable[None]] + +ASGIApp = Callable[[Scope, Receive, Send], Awaitable[None]] + +StatelessLifespan = Callable[[AppType], AbstractAsyncContextManager[None]] +StatefulLifespan = Callable[[AppType], AbstractAsyncContextManager[Mapping[str, Any]]] +Lifespan = StatelessLifespan[AppType] | StatefulLifespan[AppType] + +HTTPExceptionHandler = Callable[["Request", Exception], "Response | Awaitable[Response]"] +WebSocketExceptionHandler = Callable[["WebSocket", Exception], Awaitable[None]] +ExceptionHandler = HTTPExceptionHandler | WebSocketExceptionHandler diff --git a/TTS/Kokoro/.venv/Lib/site-packages/starlette/websockets.py b/TTS/Kokoro/.venv/Lib/site-packages/starlette/websockets.py new file mode 100644 index 0000000000000000000000000000000000000000..fb76361c8a2210dc6c494549b0c8c3b9c2e01a18 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/starlette/websockets.py @@ -0,0 +1,196 @@ +from __future__ import annotations + +import enum +import json +from collections.abc import AsyncIterator, Iterable +from typing import Any, cast + +from starlette.requests import HTTPConnection +from starlette.responses import Response +from starlette.types import Message, Receive, Scope, Send + + +class WebSocketState(enum.Enum): + CONNECTING = 0 + CONNECTED = 1 + DISCONNECTED = 2 + RESPONSE = 3 + + +class WebSocketDisconnect(Exception): + def __init__(self, code: int = 1000, reason: str | None = None) -> None: + self.code = code + self.reason = reason or "" + + +class WebSocket(HTTPConnection): + def __init__(self, scope: Scope, receive: Receive, send: Send) -> None: + super().__init__(scope) + assert scope["type"] == "websocket" + self._receive = receive + self._send = send + self.client_state = WebSocketState.CONNECTING + self.application_state = WebSocketState.CONNECTING + + async def receive(self) -> Message: + """ + Receive ASGI websocket messages, ensuring valid state transitions. + """ + if self.client_state == WebSocketState.CONNECTING: + message = await self._receive() + message_type = message["type"] + if message_type != "websocket.connect": + raise RuntimeError(f'Expected ASGI message "websocket.connect", but got {message_type!r}') + self.client_state = WebSocketState.CONNECTED + return message + elif self.client_state == WebSocketState.CONNECTED: + message = await self._receive() + message_type = message["type"] + if message_type not in {"websocket.receive", "websocket.disconnect"}: + raise RuntimeError( + f'Expected ASGI message "websocket.receive" or "websocket.disconnect", but got {message_type!r}' + ) + if message_type == "websocket.disconnect": + self.client_state = WebSocketState.DISCONNECTED + return message + else: + raise RuntimeError('Cannot call "receive" once a disconnect message has been received.') + + async def send(self, message: Message) -> None: + """ + Send ASGI websocket messages, ensuring valid state transitions. + """ + if self.application_state == WebSocketState.CONNECTING: + message_type = message["type"] + if message_type not in {"websocket.accept", "websocket.close", "websocket.http.response.start"}: + raise RuntimeError( + 'Expected ASGI message "websocket.accept", "websocket.close" or "websocket.http.response.start", ' + f"but got {message_type!r}" + ) + if message_type == "websocket.close": + self.application_state = WebSocketState.DISCONNECTED + elif message_type == "websocket.http.response.start": + self.application_state = WebSocketState.RESPONSE + else: + self.application_state = WebSocketState.CONNECTED + await self._send(message) + elif self.application_state == WebSocketState.CONNECTED: + message_type = message["type"] + if message_type not in {"websocket.send", "websocket.close"}: + raise RuntimeError( + f'Expected ASGI message "websocket.send" or "websocket.close", but got {message_type!r}' + ) + if message_type == "websocket.close": + self.application_state = WebSocketState.DISCONNECTED + try: + await self._send(message) + except OSError: + self.application_state = WebSocketState.DISCONNECTED + raise WebSocketDisconnect(code=1006) + elif self.application_state == WebSocketState.RESPONSE: + message_type = message["type"] + if message_type != "websocket.http.response.body": + raise RuntimeError(f'Expected ASGI message "websocket.http.response.body", but got {message_type!r}') + if not message.get("more_body", False): + self.application_state = WebSocketState.DISCONNECTED + await self._send(message) + else: + raise RuntimeError('Cannot call "send" once a close message has been sent.') + + async def accept( + self, + subprotocol: str | None = None, + headers: Iterable[tuple[bytes, bytes]] | None = None, + ) -> None: + headers = headers or [] + + if self.client_state == WebSocketState.CONNECTING: # pragma: no branch + # If we haven't yet seen the 'connect' message, then wait for it first. + await self.receive() + await self.send({"type": "websocket.accept", "subprotocol": subprotocol, "headers": headers}) + + def _raise_on_disconnect(self, message: Message) -> None: + if message["type"] == "websocket.disconnect": + raise WebSocketDisconnect(message["code"], message.get("reason")) + + async def receive_text(self) -> str: + if self.application_state != WebSocketState.CONNECTED: + raise RuntimeError('WebSocket is not connected. Need to call "accept" first.') + message = await self.receive() + self._raise_on_disconnect(message) + return cast(str, message["text"]) + + async def receive_bytes(self) -> bytes: + if self.application_state != WebSocketState.CONNECTED: + raise RuntimeError('WebSocket is not connected. Need to call "accept" first.') + message = await self.receive() + self._raise_on_disconnect(message) + return cast(bytes, message["bytes"]) + + async def receive_json(self, mode: str = "text") -> Any: + if mode not in {"text", "binary"}: + raise RuntimeError('The "mode" argument should be "text" or "binary".') + if self.application_state != WebSocketState.CONNECTED: + raise RuntimeError('WebSocket is not connected. Need to call "accept" first.') + message = await self.receive() + self._raise_on_disconnect(message) + + if mode == "text": + text = message["text"] + else: + text = message["bytes"].decode("utf-8") + return json.loads(text) + + async def iter_text(self) -> AsyncIterator[str]: + try: + while True: + yield await self.receive_text() + except WebSocketDisconnect: + pass + + async def iter_bytes(self) -> AsyncIterator[bytes]: + try: + while True: + yield await self.receive_bytes() + except WebSocketDisconnect: + pass + + async def iter_json(self) -> AsyncIterator[Any]: + try: + while True: + yield await self.receive_json() + except WebSocketDisconnect: + pass + + async def send_text(self, data: str) -> None: + await self.send({"type": "websocket.send", "text": data}) + + async def send_bytes(self, data: bytes) -> None: + await self.send({"type": "websocket.send", "bytes": data}) + + async def send_json(self, data: Any, mode: str = "text") -> None: + if mode not in {"text", "binary"}: + raise RuntimeError('The "mode" argument should be "text" or "binary".') + text = json.dumps(data, separators=(",", ":"), ensure_ascii=False) + if mode == "text": + await self.send({"type": "websocket.send", "text": text}) + else: + await self.send({"type": "websocket.send", "bytes": text.encode("utf-8")}) + + async def close(self, code: int = 1000, reason: str | None = None) -> None: + await self.send({"type": "websocket.close", "code": code, "reason": reason or ""}) + + async def send_denial_response(self, response: Response) -> None: + if "websocket.http.response" in self.scope.get("extensions", {}): + await response(self.scope, self.receive, self.send) + else: + raise RuntimeError("The server doesn't support the Websocket Denial Response extension.") + + +class WebSocketClose: + def __init__(self, code: int = 1000, reason: str | None = None) -> None: + self.code = code + self.reason = reason or "" + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + await send({"type": "websocket.close", "code": self.code, "reason": self.reason}) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..5883009e816c08a2672bc24096295aa8b3252a51 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/METADATA @@ -0,0 +1,319 @@ +Metadata-Version: 2.4 +Name: sympy +Version: 1.14.0 +Summary: Computer algebra system (CAS) in Python +Home-page: https://sympy.org +Author: SymPy development team +Author-email: sympy@googlegroups.com +License: BSD +Project-URL: Source, https://github.com/sympy/sympy +Keywords: Math CAS +Classifier: License :: OSI Approved :: BSD License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Topic :: Scientific/Engineering +Classifier: Topic :: Scientific/Engineering :: Mathematics +Classifier: Topic :: Scientific/Engineering :: Physics +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Requires-Python: >=3.9 +Description-Content-Type: text/markdown +License-File: LICENSE +License-File: AUTHORS +Requires-Dist: mpmath<1.4,>=1.1.0 +Provides-Extra: dev +Requires-Dist: pytest>=7.1.0; extra == "dev" +Requires-Dist: hypothesis>=6.70.0; extra == "dev" +Dynamic: author +Dynamic: author-email +Dynamic: classifier +Dynamic: description +Dynamic: description-content-type +Dynamic: home-page +Dynamic: keywords +Dynamic: license +Dynamic: license-file +Dynamic: project-url +Dynamic: provides-extra +Dynamic: requires-dist +Dynamic: requires-python +Dynamic: summary + +# SymPy + +[![pypi version](https://img.shields.io/pypi/v/sympy.svg)](https://pypi.python.org/pypi/sympy) +[![Join the chat at https://gitter.im/sympy/sympy](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sympy/sympy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Zenodo Badge](https://zenodo.org/badge/18918/sympy/sympy.svg)](https://zenodo.org/badge/latestdoi/18918/sympy/sympy) +[![Downloads](https://pepy.tech/badge/sympy/month)](https://pepy.tech/project/sympy) +[![GitHub Issues](https://img.shields.io/badge/issue_tracking-github-blue.svg)](https://github.com/sympy/sympy/issues) +[![Git Tutorial](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project) +[![Powered by NumFocus](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org) +[![Commits since last release](https://img.shields.io/github/commits-since/sympy/sympy/latest.svg?longCache=true&style=flat-square&logo=git&logoColor=fff)](https://github.com/sympy/sympy/releases) + +[![SymPy Banner](https://github.com/sympy/sympy/raw/master/banner.svg)](https://sympy.org/) + + +See the [AUTHORS](AUTHORS) file for the list of authors. + +And many more people helped on the SymPy mailing list, reported bugs, +helped organize SymPy's participation in the Google Summer of Code, the +Google Highly Open Participation Contest, Google Code-In, wrote and +blogged about SymPy... + +License: New BSD License (see the [LICENSE](LICENSE) file for details) covers all +files in the sympy repository unless stated otherwise. + +Our mailing list is at +. + +We have a community chat at [Gitter](https://gitter.im/sympy/sympy). Feel +free to ask us anything there. We have a very welcoming and helpful +community. + +## Download + +The recommended installation method is through Anaconda, + + +You can also get the latest version of SymPy from + + +To get the git version do + + $ git clone https://github.com/sympy/sympy.git + +For other options (tarballs, debs, etc.), see +. + +## Documentation and Usage + +For in-depth instructions on installation and building the +documentation, see the [SymPy Documentation Style Guide](https://docs.sympy.org/dev/documentation-style-guide.html). + +Everything is at: + + + +You can generate everything at the above site in your local copy of +SymPy by: + + $ cd doc + $ make html + +Then the docs will be in \_build/html. If +you don't want to read that, here is a short usage: + +From this directory, start Python and: + +``` python +>>> from sympy import Symbol, cos +>>> x = Symbol('x') +>>> e = 1/cos(x) +>>> print(e.series(x, 0, 10)) +1 + x**2/2 + 5*x**4/24 + 61*x**6/720 + 277*x**8/8064 + O(x**10) +``` + +SymPy also comes with a console that is a simple wrapper around the +classic python console (or IPython when available) that loads the SymPy +namespace and executes some common commands for you. + +To start it, issue: + + $ bin/isympy + +from this directory, if SymPy is not installed or simply: + + $ isympy + +if SymPy is installed. + +## Installation + +To install SymPy using PyPI, run the following command: + + $ pip install sympy + +To install SymPy using Anaconda, run the following command: + + $ conda install -c anaconda sympy + +To install SymPy from GitHub source, first clone SymPy using `git`: + + $ git clone https://github.com/sympy/sympy.git + +Then, in the `sympy` repository that you cloned, simply run: + + $ pip install . + +See for more information. + +## Contributing + +We welcome contributions from anyone, even if you are new to open +source. Please read our [Introduction to Contributing](https://docs.sympy.org/dev/contributing/introduction-to-contributing.html) +page and the [SymPy Documentation Style Guide](https://docs.sympy.org/dev/documentation-style-guide.html). If you +are new and looking for some way to contribute, a good place to start is +to look at the issues tagged [Easy to Fix](https://github.com/sympy/sympy/issues?q=is%3Aopen+is%3Aissue+label%3A%22Easy+to+Fix%22). + +Please note that all participants in this project are expected to follow +our Code of Conduct. By participating in this project you agree to abide +by its terms. See [CODE\_OF\_CONDUCT.md](CODE_OF_CONDUCT.md). + +## Tests + +To execute all tests, run: + + $./setup.py test + +in the current directory. + +For the more fine-grained running of tests or doctests, use `bin/test` +or respectively `bin/doctest`. The master branch is automatically tested +by GitHub Actions. + +To test pull requests, use +[sympy-bot](https://github.com/sympy/sympy-bot). + +## Regenerate Experimental LaTeX Parser/Lexer + +The parser and lexer were generated with the [ANTLR4](http://antlr4.org) +toolchain in `sympy/parsing/latex/_antlr` and checked into the repo. +Presently, most users should not need to regenerate these files, but +if you plan to work on this feature, you will need the `antlr4` +command-line tool (and you must ensure that it is in your `PATH`). +One way to get it is: + + $ conda install -c conda-forge antlr=4.11.1 + +Alternatively, follow the instructions on the ANTLR website and download +the `antlr-4.11.1-complete.jar`. Then export the `CLASSPATH` as instructed +and instead of creating `antlr4` as an alias, make it an executable file +with the following contents: +``` bash +#!/bin/bash +java -jar /usr/local/lib/antlr-4.11.1-complete.jar "$@" +``` + +After making changes to `sympy/parsing/latex/LaTeX.g4`, run: + + $ ./setup.py antlr + +## Clean + +To clean everything (thus getting the same tree as in the repository): + + $ git clean -Xdf + +which will clear everything ignored by `.gitignore`, and: + + $ git clean -df + +to clear all untracked files. You can revert the most recent changes in +git with: + + $ git reset --hard + +WARNING: The above commands will all clear changes you may have made, +and you will lose them forever. Be sure to check things with `git +status`, `git diff`, `git clean -Xn`, and `git clean -n` before doing any +of those. + +## Bugs + +Our issue tracker is at . Please +report any bugs that you find. Or, even better, fork the repository on +GitHub and create a pull request. We welcome all changes, big or small, +and we will help you make the pull request if you are new to git (just +ask on our mailing list or Gitter Channel). If you further have any queries, you can find answers +on Stack Overflow using the [sympy](https://stackoverflow.com/questions/tagged/sympy) tag. + +## Brief History + +SymPy was started by Ondřej Čertík in 2005, he wrote some code during +the summer, then he wrote some more code during summer 2006. In February +2007, Fabian Pedregosa joined the project and helped fix many things, +contributed documentation, and made it alive again. 5 students (Mateusz +Paprocki, Brian Jorgensen, Jason Gedge, Robert Schwarz, and Chris Wu) +improved SymPy incredibly during summer 2007 as part of the Google +Summer of Code. Pearu Peterson joined the development during the summer +2007 and he has made SymPy much more competitive by rewriting the core +from scratch, which has made it from 10x to 100x faster. Jurjen N.E. Bos +has contributed pretty-printing and other patches. Fredrik Johansson has +written mpmath and contributed a lot of patches. + +SymPy has participated in every Google Summer of Code since 2007. You +can see for +full details. Each year has improved SymPy by bounds. Most of SymPy's +development has come from Google Summer of Code students. + +In 2011, Ondřej Čertík stepped down as lead developer, with Aaron +Meurer, who also started as a Google Summer of Code student, taking his +place. Ondřej Čertík is still active in the community but is too busy +with work and family to play a lead development role. + +Since then, a lot more people have joined the development and some +people have also left. You can see the full list in doc/src/aboutus.rst, +or online at: + + + +The git history goes back to 2007 when development moved from svn to hg. +To see the history before that point, look at +. + +You can use git to see the biggest developers. The command: + + $ git shortlog -ns + +will show each developer, sorted by commits to the project. The command: + + $ git shortlog -ns --since="1 year" + +will show the top developers from the last year. + +## Citation + +To cite SymPy in publications use + +> Meurer A, Smith CP, Paprocki M, Čertík O, Kirpichev SB, Rocklin M, +> Kumar A, Ivanov S, Moore JK, Singh S, Rathnayake T, Vig S, Granger BE, +> Muller RP, Bonazzi F, Gupta H, Vats S, Johansson F, Pedregosa F, Curry +> MJ, Terrel AR, Roučka Š, Saboo A, Fernando I, Kulal S, Cimrman R, +> Scopatz A. (2017) SymPy: symbolic computing in Python. *PeerJ Computer +> Science* 3:e103 + +A BibTeX entry for LaTeX users is + +``` bibtex +@article{10.7717/peerj-cs.103, + title = {SymPy: symbolic computing in Python}, + author = {Meurer, Aaron and Smith, Christopher P. and Paprocki, Mateusz and \v{C}ert\'{i}k, Ond\v{r}ej and Kirpichev, Sergey B. and Rocklin, Matthew and Kumar, Amit and Ivanov, Sergiu and Moore, Jason K. and Singh, Sartaj and Rathnayake, Thilina and Vig, Sean and Granger, Brian E. and Muller, Richard P. and Bonazzi, Francesco and Gupta, Harsh and Vats, Shivam and Johansson, Fredrik and Pedregosa, Fabian and Curry, Matthew J. and Terrel, Andy R. and Rou\v{c}ka, \v{S}t\v{e}p\'{a}n and Saboo, Ashutosh and Fernando, Isuru and Kulal, Sumith and Cimrman, Robert and Scopatz, Anthony}, + year = 2017, + month = Jan, + keywords = {Python, Computer algebra system, Symbolics}, + abstract = { + SymPy is an open-source computer algebra system written in pure Python. It is built with a focus on extensibility and ease of use, through both interactive and programmatic applications. These characteristics have led SymPy to become a popular symbolic library for the scientific Python ecosystem. This paper presents the architecture of SymPy, a description of its features, and a discussion of select submodules. The supplementary material provides additional examples and further outlines details of the architecture and features of SymPy. + }, + volume = 3, + pages = {e103}, + journal = {PeerJ Computer Science}, + issn = {2376-5992}, + url = {https://doi.org/10.7717/peerj-cs.103}, + doi = {10.7717/peerj-cs.103} +} +``` + +SymPy is BSD licensed, so you are free to use it whatever you like, be +it academic, commercial, creating forks or derivatives, as long as you +copy the BSD statement if you redistribute it (see the LICENSE file for +details). That said, although not required by the SymPy license, if it +is convenient for you, please cite SymPy when using it in your work and +also consider contributing all your changes back, so that we can +incorporate it and all of us will benefit in the end. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..4913159ad37c0d50a9433b81b2f9d38e156ac89c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/RECORD @@ -0,0 +1,3105 @@ +../../Scripts/isympy.exe,sha256=a5iN0zK9vf3XAhRrbQOtDnqQzrhFvj091eEB2FycrtQ,108369 +../../share/man/man1/isympy.1,sha256=9DZdSOIQLikrATHlbkdDZ04LBQigZDUE0_oCXBDvdBs,6659 +__pycache__/isympy.cpython-312.pyc,, +isympy.py,sha256=haEArczb_Ny-LyjOCwx2FNGal_S0Mo4d0deiWL2g_Gc,11220 +sympy-1.14.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +sympy-1.14.0.dist-info/METADATA,sha256=t1bC-_1b4FrFvbDrymH1VhjzD2M-2S2IpWh0KTE6dZU,12816 +sympy-1.14.0.dist-info/RECORD,, +sympy-1.14.0.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91 +sympy-1.14.0.dist-info/entry_points.txt,sha256=Sp-vLJom4PRlhGfY6RpUre7SjYm33JNq9NCwCGeW-fQ,39 +sympy-1.14.0.dist-info/licenses/AUTHORS,sha256=grEDhSGwaWxjyQsx7UoKLJxMFoccZIsVewfKRLbxj40,55779 +sympy-1.14.0.dist-info/licenses/LICENSE,sha256=B6XpgZ9ye0mGrSgpx6KaYyDUJXX3IOsk1xt_71c6AoY,7885 +sympy-1.14.0.dist-info/top_level.txt,sha256=elXb5xfjLdjgSSoQFk4_2Qu3lp2CIaglF9MQtfIoH7o,13 +sympy/__init__.py,sha256=TpR2NIuhBf6rKNgvW89s26Lj6E3m4Fm7_noTcowKSrA,29422 +sympy/__pycache__/__init__.cpython-312.pyc,, +sympy/__pycache__/abc.cpython-312.pyc,, +sympy/__pycache__/conftest.cpython-312.pyc,, +sympy/__pycache__/galgebra.cpython-312.pyc,, +sympy/__pycache__/release.cpython-312.pyc,, +sympy/__pycache__/this.cpython-312.pyc,, +sympy/abc.py,sha256=-RYLRKQ6SZMJGXDIAOP9UWPDAyvYH0zPbp9ZFg0YKBY,3764 +sympy/algebras/__init__.py,sha256=7PRGOW30nlMOTeUPR7iy8l5xGoE2yCBEfRbjqDKWOgU,62 +sympy/algebras/__pycache__/__init__.cpython-312.pyc,, +sympy/algebras/__pycache__/quaternion.cpython-312.pyc,, +sympy/algebras/quaternion.py,sha256=i2Fkvjj14vA6GtXgcSkpDwVmIYc7T5zT1hw49sb__tM,47483 +sympy/algebras/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/algebras/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/algebras/tests/__pycache__/test_quaternion.cpython-312.pyc,, +sympy/algebras/tests/test_quaternion.py,sha256=un4I6IKE2v6YEfUsFBSY5N6qaZ0agn1puX0LElb1k4E,16809 +sympy/assumptions/__init__.py,sha256=PFS8djTqiNbGVMjg7PaPjEfwmjyZVfioXiRVzqqA3E0,550 +sympy/assumptions/__pycache__/__init__.cpython-312.pyc,, +sympy/assumptions/__pycache__/ask.cpython-312.pyc,, +sympy/assumptions/__pycache__/ask_generated.cpython-312.pyc,, +sympy/assumptions/__pycache__/assume.cpython-312.pyc,, +sympy/assumptions/__pycache__/cnf.cpython-312.pyc,, +sympy/assumptions/__pycache__/facts.cpython-312.pyc,, +sympy/assumptions/__pycache__/lra_satask.cpython-312.pyc,, +sympy/assumptions/__pycache__/refine.cpython-312.pyc,, +sympy/assumptions/__pycache__/satask.cpython-312.pyc,, +sympy/assumptions/__pycache__/sathandlers.cpython-312.pyc,, +sympy/assumptions/__pycache__/wrapper.cpython-312.pyc,, +sympy/assumptions/ask.py,sha256=B2W8CW-9ynvYqfBX9_4qCLhCSwE0g_gUGqq7lM50wUk,19376 +sympy/assumptions/ask_generated.py,sha256=whNIU5tj2UkEGHPAfk-_89ahvVERs4npOB0JYVbIQJc,23558 +sympy/assumptions/assume.py,sha256=_gcFc4h_YGs9-tshoD0gmLl_RtPivDQWMWhWWLX9seo,14606 +sympy/assumptions/cnf.py,sha256=mfthFXL8Jhpn7Vgj1IfG5acFzfBgaV02xztQ7KpoLmg,12509 +sympy/assumptions/facts.py,sha256=fimPoHEyusSUr0uI4kiDb4mzxHjEBglvLQW0DGdNFAs,8391 +sympy/assumptions/handlers/__init__.py,sha256=lvjAfPdz0MDjTxjuzbBSGBco2OmpZRiGixSG0oaiZi0,330 +sympy/assumptions/handlers/__pycache__/__init__.cpython-312.pyc,, +sympy/assumptions/handlers/__pycache__/calculus.cpython-312.pyc,, +sympy/assumptions/handlers/__pycache__/common.cpython-312.pyc,, +sympy/assumptions/handlers/__pycache__/matrices.cpython-312.pyc,, +sympy/assumptions/handlers/__pycache__/ntheory.cpython-312.pyc,, +sympy/assumptions/handlers/__pycache__/order.cpython-312.pyc,, +sympy/assumptions/handlers/__pycache__/sets.cpython-312.pyc,, +sympy/assumptions/handlers/calculus.py,sha256=WF3gysxZa2frvd1kHxdDN7xd0PwYemER8dWutfDN-w8,7799 +sympy/assumptions/handlers/common.py,sha256=xgUR3xHPNgGFkLGyMqLV_nUIfMsQJLP8p6boy8Rc6JI,4314 +sympy/assumptions/handlers/matrices.py,sha256=Gdauk2xk1hKPRr4i6RpvOMHtDnyVD34x1OyhL-Oh8Hc,22321 +sympy/assumptions/handlers/ntheory.py,sha256=lRhW2ceJPK0gNqR00NAwkEq1FBjtRrxz1u6WevjRvjc,7660 +sympy/assumptions/handlers/order.py,sha256=-NCLn8ab7Fo_UzZLZi7m3UwtYGN-XiU1qvJDhi5z7ZQ,12280 +sympy/assumptions/handlers/sets.py,sha256=9P8X6ucARJIJA3jG_gj736L71ZQi5hfLCKL--0_ifrw,25841 +sympy/assumptions/lra_satask.py,sha256=FlmiLERsj6J9w6vygwEEEn7pyGPnD0JkPEFEdoE7bfM,9563 +sympy/assumptions/predicates/__init__.py,sha256=q1C7iWpvdDymEUZNyzJvZLsLtgwSkYtCixME-fYyIDw,110 +sympy/assumptions/predicates/__pycache__/__init__.cpython-312.pyc,, +sympy/assumptions/predicates/__pycache__/calculus.cpython-312.pyc,, +sympy/assumptions/predicates/__pycache__/common.cpython-312.pyc,, +sympy/assumptions/predicates/__pycache__/matrices.cpython-312.pyc,, +sympy/assumptions/predicates/__pycache__/ntheory.cpython-312.pyc,, +sympy/assumptions/predicates/__pycache__/order.cpython-312.pyc,, +sympy/assumptions/predicates/__pycache__/sets.cpython-312.pyc,, +sympy/assumptions/predicates/calculus.py,sha256=vFnlYVYZVd6D9OwA7-3bDK_Q0jf2iCZCZiMlWenw0Vg,1889 +sympy/assumptions/predicates/common.py,sha256=zpByACpa_tF0nVNB0J_rJehnXkHtkxhchn1DvkVVS-s,2279 +sympy/assumptions/predicates/matrices.py,sha256=X3vbkEf3zwJLyanEjf6ijYXuRfFfSv-yatl1tJ25wDk,12142 +sympy/assumptions/predicates/ntheory.py,sha256=wvFNFSf0S4egbY7REw0V0ANC03CuiRU9PLmdi16VfHo,2546 +sympy/assumptions/predicates/order.py,sha256=ez1UZ824KDtimLssUASCZHD_KEQmo8Pv-qofVLhZUrk,9511 +sympy/assumptions/predicates/sets.py,sha256=-bTVXa-X1-yfXlIKzMBW_JxIqueS5PdEwEzChzIne38,9238 +sympy/assumptions/refine.py,sha256=FNv5neAYJh-MgvnHDZ8-tjC9RIKcIxarVj5WiE4EnYg,11946 +sympy/assumptions/relation/__init__.py,sha256=t2tZNEIK7w-xXshRQIRL8tIyiNe1W5fMhN7QNRPnQFo,261 +sympy/assumptions/relation/__pycache__/__init__.cpython-312.pyc,, +sympy/assumptions/relation/__pycache__/binrel.cpython-312.pyc,, +sympy/assumptions/relation/__pycache__/equality.cpython-312.pyc,, +sympy/assumptions/relation/binrel.py,sha256=3iwnSEE53-vRsPv-bOnjydgOkCpbB12FTFR_sQ3CwvE,6313 +sympy/assumptions/relation/equality.py,sha256=ZBnSFpctNeroYy1nvam0kzSJCNpsUR3SlBeqFcAMM0U,7148 +sympy/assumptions/satask.py,sha256=P3iprPjuOyhT5Fwr0hX61xTOcD98M_bzXSAV-pXYhN4,11745 +sympy/assumptions/sathandlers.py,sha256=jx8B0u_N73fMoVoLKIfmXMdtSLz7-ZIKhJrxYl84AJk,9418 +sympy/assumptions/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/assumptions/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/assumptions/tests/__pycache__/test_assumptions_2.cpython-312.pyc,, +sympy/assumptions/tests/__pycache__/test_context.cpython-312.pyc,, +sympy/assumptions/tests/__pycache__/test_matrices.cpython-312.pyc,, +sympy/assumptions/tests/__pycache__/test_query.cpython-312.pyc,, +sympy/assumptions/tests/__pycache__/test_refine.cpython-312.pyc,, +sympy/assumptions/tests/__pycache__/test_rel_queries.cpython-312.pyc,, +sympy/assumptions/tests/__pycache__/test_satask.cpython-312.pyc,, +sympy/assumptions/tests/__pycache__/test_sathandlers.cpython-312.pyc,, +sympy/assumptions/tests/__pycache__/test_wrapper.cpython-312.pyc,, +sympy/assumptions/tests/test_assumptions_2.py,sha256=oNgIDOoW-GpBbXxbtw05SWnE8I7sGislYmB3MDogwB4,1070 +sympy/assumptions/tests/test_context.py,sha256=I5gES7AY9_vz1-CEaCchy4MXABtX85ncNkvoRuLskG8,1153 +sympy/assumptions/tests/test_matrices.py,sha256=nzSofuawc18hNe9Nj0dN_lTeDwa2KbPjt4K2rvb3xmw,12258 +sympy/assumptions/tests/test_query.py,sha256=ENB3XoNNi7j0p1_-j9Xd9C5YYpRbu1dcAQe46foV8cU,104495 +sympy/assumptions/tests/test_refine.py,sha256=bHxYUnCOEIzA1yPU3B2xbU9JZfhDv6RkmPm8esetisQ,8834 +sympy/assumptions/tests/test_rel_queries.py,sha256=fRn_IMMb942GfEH8CNk6z50YCyDlA_GMXv2xOVFdSdk,6677 +sympy/assumptions/tests/test_satask.py,sha256=IIqqIxzkLfANpTNBKEsCGCp3Bm8zmDnYd23woqKh9EE,15741 +sympy/assumptions/tests/test_sathandlers.py,sha256=jMCZQb3G6pVQ5MHaSTWV_0eULHaCF8Mowu12Ll72rgs,1842 +sympy/assumptions/tests/test_wrapper.py,sha256=iE32j83rrerCz85HHt2hTolgJkqb44KddfEpI3H1Fb8,1159 +sympy/assumptions/wrapper.py,sha256=7GXR39zPCCfV-pcs8ph9KRRwZF3i_T5Lzv156vKFf_I,5434 +sympy/benchmarks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/benchmarks/__pycache__/__init__.cpython-312.pyc,, +sympy/benchmarks/__pycache__/bench_discrete_log.cpython-312.pyc,, +sympy/benchmarks/__pycache__/bench_meijerint.cpython-312.pyc,, +sympy/benchmarks/__pycache__/bench_symbench.cpython-312.pyc,, +sympy/benchmarks/bench_discrete_log.py,sha256=CNchIJ5HFMPpNlVZh2vOU0GgQ3bse6hqyqDovpDHlKE,2473 +sympy/benchmarks/bench_meijerint.py,sha256=dSNdZhoc8a4h50wRtbOxLwpmgUiuMFpe6ytTLURcplY,11610 +sympy/benchmarks/bench_symbench.py,sha256=UMD3eYf_Poht0qxjdH2_axGwwON6cZo1Sp700Ci1M1M,2997 +sympy/calculus/__init__.py,sha256=IWDc6qPbEcWyTm9QM6V8vSAs-5OtGNijimykoWz3Clc,828 +sympy/calculus/__pycache__/__init__.cpython-312.pyc,, +sympy/calculus/__pycache__/accumulationbounds.cpython-312.pyc,, +sympy/calculus/__pycache__/euler.cpython-312.pyc,, +sympy/calculus/__pycache__/finite_diff.cpython-312.pyc,, +sympy/calculus/__pycache__/singularities.cpython-312.pyc,, +sympy/calculus/__pycache__/util.cpython-312.pyc,, +sympy/calculus/accumulationbounds.py,sha256=4nJD5JzBarlB5l6yPpVADX3iDamnHVwsor_nQJw9CAM,28682 +sympy/calculus/euler.py,sha256=0QrHD9TYKlSZuO8drnU3bUFJrSu8v5SncqtkRSWLjGM,3436 +sympy/calculus/finite_diff.py,sha256=X7qZJ5GmHlHKokUUMFoaQqrqX2jLRq4b7W2G5aWntzM,17053 +sympy/calculus/singularities.py,sha256=wBQ7WiJ1amuZStBJ-iMTiIHJexjzJHHwrc0tU2XVT10,12184 +sympy/calculus/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/calculus/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/calculus/tests/__pycache__/test_accumulationbounds.cpython-312.pyc,, +sympy/calculus/tests/__pycache__/test_euler.cpython-312.pyc,, +sympy/calculus/tests/__pycache__/test_finite_diff.cpython-312.pyc,, +sympy/calculus/tests/__pycache__/test_singularities.cpython-312.pyc,, +sympy/calculus/tests/__pycache__/test_util.cpython-312.pyc,, +sympy/calculus/tests/test_accumulationbounds.py,sha256=a_Ry2nKX5WbhSe1Bk2k0W6-VWOpVTg0FnA9u8rNSIV4,11195 +sympy/calculus/tests/test_euler.py,sha256=YWpts4pWSiYEwRsi5DLQ16JgC9109-9NKZIL_IO6_Aw,2683 +sympy/calculus/tests/test_finite_diff.py,sha256=9mIvXB8DaxJh2gzmhwi5eE3eBRYTFxyqYG5uIUpYg2w,7670 +sympy/calculus/tests/test_singularities.py,sha256=Zj4WPkT-KlXo7TF3Ir3ug3IkS_qhnFBS7VXAMnIuCso,5272 +sympy/calculus/tests/test_util.py,sha256=IJIhgudR9dym1VRAdu33G2tfSDoexNdWdz-Pgf-kh4o,18557 +sympy/calculus/util.py,sha256=qBDTlb5VP-xJPfh2Ndz37zNMVpseXW4d77hxBCLX5AA,28880 +sympy/categories/__init__.py,sha256=XiKBVC6pbDED-OVtNlSH-fGB8dB_jWLqwCEO7wBTAyA,984 +sympy/categories/__pycache__/__init__.cpython-312.pyc,, +sympy/categories/__pycache__/baseclasses.cpython-312.pyc,, +sympy/categories/__pycache__/diagram_drawing.cpython-312.pyc,, +sympy/categories/baseclasses.py,sha256=1Kn7PIegQCbF78s0rhf1Bx1mbxwfQcfQi6v-QqloSoE,31360 +sympy/categories/diagram_drawing.py,sha256=lfR29f6QX-rK-cCAom-2mRJ4xLyhi55ch91CyEPCXAQ,95173 +sympy/categories/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/categories/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/categories/tests/__pycache__/test_baseclasses.cpython-312.pyc,, +sympy/categories/tests/__pycache__/test_drawing.cpython-312.pyc,, +sympy/categories/tests/test_baseclasses.py,sha256=SwD6QsfSlrEdpD2dbkcN62CPVIRP5SadjCplLrMAoa8,5767 +sympy/categories/tests/test_drawing.py,sha256=IELPpadmnQyQ2x5a5qHC8ioq5kfT1UnAl4h1vO3gbqg,27848 +sympy/codegen/__init__.py,sha256=sQcJsyLyoRh9ccOPhv2eZ-wHjQrArByOON9ndj-MYgQ,974 +sympy/codegen/__pycache__/__init__.cpython-312.pyc,, +sympy/codegen/__pycache__/abstract_nodes.cpython-312.pyc,, +sympy/codegen/__pycache__/algorithms.cpython-312.pyc,, +sympy/codegen/__pycache__/approximations.cpython-312.pyc,, +sympy/codegen/__pycache__/ast.cpython-312.pyc,, +sympy/codegen/__pycache__/cfunctions.cpython-312.pyc,, +sympy/codegen/__pycache__/cnodes.cpython-312.pyc,, +sympy/codegen/__pycache__/cutils.cpython-312.pyc,, +sympy/codegen/__pycache__/cxxnodes.cpython-312.pyc,, +sympy/codegen/__pycache__/fnodes.cpython-312.pyc,, +sympy/codegen/__pycache__/futils.cpython-312.pyc,, +sympy/codegen/__pycache__/matrix_nodes.cpython-312.pyc,, +sympy/codegen/__pycache__/numpy_nodes.cpython-312.pyc,, +sympy/codegen/__pycache__/pynodes.cpython-312.pyc,, +sympy/codegen/__pycache__/pyutils.cpython-312.pyc,, +sympy/codegen/__pycache__/rewriting.cpython-312.pyc,, +sympy/codegen/__pycache__/scipy_nodes.cpython-312.pyc,, +sympy/codegen/abstract_nodes.py,sha256=TY4ecftqnym5viYInnb59zGPPFXdeSGQwi--xTz6Pvo,490 +sympy/codegen/algorithms.py,sha256=GEvnadOTZ3afVrbN5WE52OhCP8gzMII_AN4oHQxvEpo,6383 +sympy/codegen/approximations.py,sha256=r7zyShIWp40QngshFQwqKVKWcA5KmHmQcJarXVtOATQ,6448 +sympy/codegen/ast.py,sha256=R_JhC-uryx9NoJ1ISQU6fb3aV4aRL1SModmV_Dc2z2U,56788 +sympy/codegen/cfunctions.py,sha256=jrFWaRjrQnpHzu6-mwFtd6cRspK8Jo7B3RDo1AOoTLo,12331 +sympy/codegen/cnodes.py,sha256=lsqy-JeRvr9WCk2fwDiRqPhAMFk0snInF7WlAlk9-Zg,3409 +sympy/codegen/cutils.py,sha256=vlzMs8OkC5Bu4sIP-AF2mYf_tIo7Uo4r2DAI_LNhZzM,383 +sympy/codegen/cxxnodes.py,sha256=Om-EBfYduFF97tgXOF68rr8zYbngem9kBRm9SJiKLSM,342 +sympy/codegen/fnodes.py,sha256=mdOPkMVmjjNp22XfHscvx8uMtUxbUqTl66Wki7ORMa8,18936 +sympy/codegen/futils.py,sha256=k-mxMJKr_Q_afTy6NrKNl_N2XQLBmSdZAssO5hBonNY,1792 +sympy/codegen/matrix_nodes.py,sha256=0d3qXy2zaq3isyklE48lP7NP5LTF7SkLXMHMbweVGXU,2284 +sympy/codegen/numpy_nodes.py,sha256=H6FoBnarEuO7R1sbX8Qa9hK4jCju90R2qN66_-1N6Ug,4543 +sympy/codegen/pynodes.py,sha256=Neo1gFQ9kC31T-gH8TeeCaDDNaDe5deIP97MRZFgMHk,243 +sympy/codegen/pyutils.py,sha256=HfF6SP710Y7yExZcSesI0usVaDiWdEPEmMtyMD3JtOY,838 +sympy/codegen/rewriting.py,sha256=8JtiMFgv0sA7uGu2MUU7L3uzldGw5xG1ksuk4zh2ZDE,11585 +sympy/codegen/scipy_nodes.py,sha256=hYlxtGyTM0Z64Nazm1TeMZ3Y8dMsiD_HNhNvbU9eiQY,2508 +sympy/codegen/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/codegen/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_abstract_nodes.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_algorithms.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_applications.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_approximations.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_ast.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_cfunctions.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_cnodes.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_cxxnodes.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_fnodes.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_matrix_nodes.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_numpy_nodes.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_pynodes.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_pyutils.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_rewriting.cpython-312.pyc,, +sympy/codegen/tests/__pycache__/test_scipy_nodes.cpython-312.pyc,, +sympy/codegen/tests/test_abstract_nodes.py,sha256=a_GKf3FpeNN8zfMc-V8AaSrQtEI1oiLfJOco2VKiSKI,451 +sympy/codegen/tests/test_algorithms.py,sha256=lgl6w3d7WaT8LJrp716wWicxbgnR4hQk4alzBCdDrIw,6919 +sympy/codegen/tests/test_applications.py,sha256=RFWS7EoE3DytUrr4HzkPaXbOtnaStpzJalVKrY1rVRE,2277 +sympy/codegen/tests/test_approximations.py,sha256=SZpOUzahb_bJOceD0DLdmeiw-jN37OPmf5TRp1dyRgM,2035 +sympy/codegen/tests/test_ast.py,sha256=aAWk-yAVVNAmFMkyUlYBbVA8mPlTFqULOtmXMEi3LO8,21688 +sympy/codegen/tests/test_cfunctions.py,sha256=4jJM7dCLPbfEU3CB1ZUKGC1pRuRvjqZfDkFfYSkrzsY,5119 +sympy/codegen/tests/test_cnodes.py,sha256=FlI5XP39K3kC1QWKQ-QKkzNQw8TROjj5mKXJhK1UU2c,3039 +sympy/codegen/tests/test_cxxnodes.py,sha256=5OwN8D_ZtKN9z5uNeUwbUkyAGzNLrTgIKUlcRWmOSpE,366 +sympy/codegen/tests/test_fnodes.py,sha256=dKSw6w7i4Z8NHVDu_ug4V9Fa49CfnSX1FVahDIdNPgI,6650 +sympy/codegen/tests/test_matrix_nodes.py,sha256=CTMSwQkW0JHaMgHR9Lys8kDk5UgQidTl4VQhWI8gw7s,1896 +sympy/codegen/tests/test_numpy_nodes.py,sha256=tEeyF9vDmw-EyKnHV2dYM6MWGfA2I2fmf3kBsYxqad0,2199 +sympy/codegen/tests/test_pynodes.py,sha256=Gso18KKzSwA-1AHC55SgHPAfH1GrGUCGaN6QR7iuEO0,432 +sympy/codegen/tests/test_pyutils.py,sha256=yvqif7d6EpsnaBjP8XXjVo3wEENBxI6Vm01I1Wow-js,299 +sympy/codegen/tests/test_rewriting.py,sha256=ELPziNI3CsJ4VS7mUbk4QWyG_94FbgZCdBKieMN20Vc,15852 +sympy/codegen/tests/test_scipy_nodes.py,sha256=LBWpjTRfgWN5NLTchLZEp6m7IMtu7HbiKoztLc6KNGY,1495 +sympy/combinatorics/__init__.py,sha256=Dx9xakpHuTIgy4G8zVjAY6pTu8J9_K3d_jKPizRMdVo,1500 +sympy/combinatorics/__pycache__/__init__.cpython-312.pyc,, +sympy/combinatorics/__pycache__/coset_table.cpython-312.pyc,, +sympy/combinatorics/__pycache__/fp_groups.cpython-312.pyc,, +sympy/combinatorics/__pycache__/free_groups.cpython-312.pyc,, +sympy/combinatorics/__pycache__/galois.cpython-312.pyc,, +sympy/combinatorics/__pycache__/generators.cpython-312.pyc,, +sympy/combinatorics/__pycache__/graycode.cpython-312.pyc,, +sympy/combinatorics/__pycache__/group_constructs.cpython-312.pyc,, +sympy/combinatorics/__pycache__/group_numbers.cpython-312.pyc,, +sympy/combinatorics/__pycache__/homomorphisms.cpython-312.pyc,, +sympy/combinatorics/__pycache__/named_groups.cpython-312.pyc,, +sympy/combinatorics/__pycache__/partitions.cpython-312.pyc,, +sympy/combinatorics/__pycache__/pc_groups.cpython-312.pyc,, +sympy/combinatorics/__pycache__/perm_groups.cpython-312.pyc,, +sympy/combinatorics/__pycache__/permutations.cpython-312.pyc,, +sympy/combinatorics/__pycache__/polyhedron.cpython-312.pyc,, +sympy/combinatorics/__pycache__/prufer.cpython-312.pyc,, +sympy/combinatorics/__pycache__/rewritingsystem.cpython-312.pyc,, +sympy/combinatorics/__pycache__/rewritingsystem_fsm.cpython-312.pyc,, +sympy/combinatorics/__pycache__/schur_number.cpython-312.pyc,, +sympy/combinatorics/__pycache__/subsets.cpython-312.pyc,, +sympy/combinatorics/__pycache__/tensor_can.cpython-312.pyc,, +sympy/combinatorics/__pycache__/testutil.cpython-312.pyc,, +sympy/combinatorics/__pycache__/util.cpython-312.pyc,, +sympy/combinatorics/coset_table.py,sha256=soppBd8i6UV-sppdOzykfNE8evMeclU4l1TwfL5UlXI,43296 +sympy/combinatorics/fp_groups.py,sha256=0iLx7mtwxn1kjYFysgAzILAdtlS9e1VWPtWnszubhd8,47779 +sympy/combinatorics/free_groups.py,sha256=gt33RoIByKDZNaf661ay4pQMilPPMPY4hFNGIKi2ho0,39740 +sympy/combinatorics/galois.py,sha256=cpd2iHaSdim5-3-cqvk58YP-AuS6CvJeCdUWpiOdIZI,17867 +sympy/combinatorics/generators.py,sha256=UAdv0bvqtN6i9bfFgB873g-A-zssc0ZoiHckDOEI0M0,7479 +sympy/combinatorics/graycode.py,sha256=xbtr8AaFYb4SMmwUi7mf7913U87jH-XEYF_3pGZfj0o,11207 +sympy/combinatorics/group_constructs.py,sha256=IKx12_yWJqEQ7g-oBuAWd5VRLbCOWyL0LG4PQu43BS8,2021 +sympy/combinatorics/group_numbers.py,sha256=eOiK0RyVHewiGiPXHihfM7MIKlAlg7AhGnBL4f1D54M,9163 +sympy/combinatorics/homomorphisms.py,sha256=dCpmPM3V2ReRuYDdXDfdMTU3pt7zkjKBkYSF6X2MfE8,18844 +sympy/combinatorics/named_groups.py,sha256=zd_C9epKDrMG0drafGUcHuuJJkcMaDt1Nf2ik4NXNq8,8378 +sympy/combinatorics/partitions.py,sha256=ZXqVmVNjmauhMeiTWtCCqOP38b9MJg7UlBdZa-7aICQ,20841 +sympy/combinatorics/pc_groups.py,sha256=5AwEeYQCMdYcybhlEykvJZqEYtJQLgYbRxAnNQeajfE,21414 +sympy/combinatorics/perm_groups.py,sha256=sf0FfxmJ5uWCwlvzRD5m5HHduG5qqHzh3Y0n1Dax5Yo,184825 +sympy/combinatorics/permutations.py,sha256=nQoc4YgTeoT80eHkqetTBUxwAQQW40US2AnR2u4-E_k,87737 +sympy/combinatorics/polyhedron.py,sha256=-1y5GhorUK62_gJpn4tXTLye7BcG0hAup74waDQ8y2I,35928 +sympy/combinatorics/prufer.py,sha256=yN6d4w_ZVXNFhBoevA84gor4Xb5ttG529xbVgHxzKDo,12061 +sympy/combinatorics/rewritingsystem.py,sha256=cT1JrAuKj9rWI3IhaHekYYt0rdG56pwFLg32pcGC9aI,17095 +sympy/combinatorics/rewritingsystem_fsm.py,sha256=CKGhLqyvxY0mlmy8_Hb4WzkSdWYPUaU2yZYhz-0iZ5w,2433 +sympy/combinatorics/schur_number.py,sha256=YdsyA7n_z9tyfRTSRfIjEjtnGo5EuDGBMUS09AQ2MxU,4437 +sympy/combinatorics/subsets.py,sha256=oxuExuGyFnvunkmktl-vBYiLbiN66A2Q2MyzwWfy46A,16047 +sympy/combinatorics/tensor_can.py,sha256=JywytVypkN6aWdCpeEYletMW4vxyUvU29RfKq9-Lu0c,40738 +sympy/combinatorics/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/combinatorics/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_coset_table.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_fp_groups.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_free_groups.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_galois.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_generators.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_graycode.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_group_constructs.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_group_numbers.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_homomorphisms.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_named_groups.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_partitions.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_pc_groups.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_perm_groups.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_permutations.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_polyhedron.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_prufer.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_rewriting.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_schur_number.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_subsets.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_tensor_can.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_testutil.cpython-312.pyc,, +sympy/combinatorics/tests/__pycache__/test_util.cpython-312.pyc,, +sympy/combinatorics/tests/test_coset_table.py,sha256=cEUF0OH6SNhN_kh069wMsq6h4eSVqbDLghrg2r9Ht48,28474 +sympy/combinatorics/tests/test_fp_groups.py,sha256=C4rWnSJyk7L6uZnI-kAYvtbfFXxba0o1XjpOTkWr97s,10203 +sympy/combinatorics/tests/test_free_groups.py,sha256=g47dnRsNXVG9lFcqppJyrGryGIUCw9dRASkcMa4QujA,6411 +sympy/combinatorics/tests/test_galois.py,sha256=w35JRx8lmlXCdzUBNdocgATPYWBOEZ6LH-tAxOPwCQ8,2763 +sympy/combinatorics/tests/test_generators.py,sha256=6YpOp0i5PRGtySPNZseQ8mjSXbwpfGfz0hDB4kfk40Q,3567 +sympy/combinatorics/tests/test_graycode.py,sha256=pI4e7Y615d5Bmmxui6fdEeyca6j6KSD0YmeychV6ORk,2800 +sympy/combinatorics/tests/test_group_constructs.py,sha256=jJLwMdhuUalKv4Aql9SzV2utK8Ex-IYdMecggr95pi8,450 +sympy/combinatorics/tests/test_group_numbers.py,sha256=spHwsvjzEDXsdAFxkrQYOnioTgtWoVF5K7k7FbgMvfg,4149 +sympy/combinatorics/tests/test_homomorphisms.py,sha256=UwBj5loCuZAiuvmqy5VAbwhCQTph8o6BzTaGrH0rzB4,3745 +sympy/combinatorics/tests/test_named_groups.py,sha256=tsuDVGv4iHGEZ0BVR87_ENhyAfZvFIl0M6Dv_HX1VoY,1931 +sympy/combinatorics/tests/test_partitions.py,sha256=oppszKJLLSpcEzHgespIveSmEC3fDZ0qkus1k7MBt4E,4097 +sympy/combinatorics/tests/test_pc_groups.py,sha256=wfkY_ilpG0XWrhaWMVK6r7yWMeXfM8WNTyti5oE9bdk,2728 +sympy/combinatorics/tests/test_perm_groups.py,sha256=70_AedMpr-YxiYDHHjw6fjvmYW7-YoznEGwUeGtJo0E,41195 +sympy/combinatorics/tests/test_permutations.py,sha256=E8J-WLCW2z9hTyTJcm1dsFgFXh8YAesIppYsXRu5pAs,20189 +sympy/combinatorics/tests/test_polyhedron.py,sha256=3SWkFQKeF-p1QWP4Iu9NIA1oTxAFo1BLRrrLerBFAhw,4180 +sympy/combinatorics/tests/test_prufer.py,sha256=OTJp0NxjiVswWkOuCIlnGFU2Gw4noRsrPpUJtp2XhEs,2649 +sympy/combinatorics/tests/test_rewriting.py,sha256=3COHq74k6knt2rqE7hfd4ZP_6whf0Kg14tYxFmTtYrI,1787 +sympy/combinatorics/tests/test_schur_number.py,sha256=wg13uTumFltWIGbVg_PEr6nhXIru19UWitsEZiakoRI,1727 +sympy/combinatorics/tests/test_subsets.py,sha256=6pyhLYV5HuXvx63r-gGVHr8LSrGRXcpDudhFn9fBqX8,2635 +sympy/combinatorics/tests/test_tensor_can.py,sha256=olH5D5wwTBOkZXjtqvLO6RKbvCG9KoMVK4__wDe95N4,24676 +sympy/combinatorics/tests/test_testutil.py,sha256=NYEI8X2qLWf7Gv1O7UthOHUSyWpbNCRrGmG_vdyEgF8,1733 +sympy/combinatorics/tests/test_util.py,sha256=sOYMWHxlbM0mqalqA7jNrYMm8DKcf_GwL5YBjs96_C4,4499 +sympy/combinatorics/testutil.py,sha256=GNnqy0mb6yPMa3zpGEzz2p6uxY7VtobPtwUialhfYEQ,11142 +sympy/combinatorics/util.py,sha256=lkOaITBImqB9yyLvN8DU0G-vraw27cSx2XaPdAPVBhg,16296 +sympy/concrete/__init__.py,sha256=2HDmg3VyLgM_ZPw3XsGpkOClGiQnyTlUNHSwVTtizA0,144 +sympy/concrete/__pycache__/__init__.cpython-312.pyc,, +sympy/concrete/__pycache__/delta.cpython-312.pyc,, +sympy/concrete/__pycache__/expr_with_intlimits.cpython-312.pyc,, +sympy/concrete/__pycache__/expr_with_limits.cpython-312.pyc,, +sympy/concrete/__pycache__/gosper.cpython-312.pyc,, +sympy/concrete/__pycache__/guess.cpython-312.pyc,, +sympy/concrete/__pycache__/products.cpython-312.pyc,, +sympy/concrete/__pycache__/summations.cpython-312.pyc,, +sympy/concrete/delta.py,sha256=38M0E24b6V-dn706WXnylM4DAvvyb6tFy7eRE4oR5Bo,9870 +sympy/concrete/expr_with_intlimits.py,sha256=vj4PjttB9xE5aUYu37R1A4_KtGgxcPa65jzjv8-krsc,11352 +sympy/concrete/expr_with_limits.py,sha256=dL5u-b_CzwghTWIhNsGc4md8jPWfhXOvna5Lig6XVr0,21834 +sympy/concrete/gosper.py,sha256=JUFbnOWSls8Xo0Zj198Xm4adopE-rAJjXv6M2q9x7us,5499 +sympy/concrete/guess.py,sha256=6EejdhNgqjMK7lVTXms8-_xGmmpI3vtliLW7-L2eaDM,17474 +sympy/concrete/products.py,sha256=I_aGMeKtSuFU07PGfZPHHTwS1WxDRNbnjedNC_m1k24,18456 +sympy/concrete/summations.py,sha256=D5n4x-fzqhgRwTIWpdN3Xun4I8u847tB7Dcex7lh7lI,55998 +sympy/concrete/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/concrete/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/concrete/tests/__pycache__/test_delta.cpython-312.pyc,, +sympy/concrete/tests/__pycache__/test_gosper.cpython-312.pyc,, +sympy/concrete/tests/__pycache__/test_guess.cpython-312.pyc,, +sympy/concrete/tests/__pycache__/test_products.cpython-312.pyc,, +sympy/concrete/tests/__pycache__/test_sums_products.cpython-312.pyc,, +sympy/concrete/tests/test_delta.py,sha256=uI7xjMx7JuVb3kkN7cLR6_pGsKS4Ulq22p-Z9oti5Jc,23869 +sympy/concrete/tests/test_gosper.py,sha256=ZHiZfYGCeCS9I-0oqN6sFbiYa-284GeFoGsNbhIWq4I,7987 +sympy/concrete/tests/test_guess.py,sha256=TPW6Hy11Po6VLZG_dx95x3sMBYl5kcQH8wjJ6TOtu-k,3370 +sympy/concrete/tests/test_products.py,sha256=caYc-xlEIrX9I_A-KPQdwp5oDprVJSbfcOaKg_qUnsM,14521 +sympy/concrete/tests/test_sums_products.py,sha256=rg0cSziPNgkvyehA0wCf-3jj8fSmNT7ECOOkiXWN64o,66390 +sympy/conftest.py,sha256=wvibr2FiWTlUcLTYAFEL8tSAKWPnv_Q6Cj4lARBCM0U,2775 +sympy/core/__init__.py,sha256=0L72TGngrIg2JknW3elaPSIDmkpPjWGNVfNk33wKXJ0,3123 +sympy/core/__pycache__/__init__.cpython-312.pyc,, +sympy/core/__pycache__/_print_helpers.cpython-312.pyc,, +sympy/core/__pycache__/add.cpython-312.pyc,, +sympy/core/__pycache__/alphabets.cpython-312.pyc,, +sympy/core/__pycache__/assumptions.cpython-312.pyc,, +sympy/core/__pycache__/assumptions_generated.cpython-312.pyc,, +sympy/core/__pycache__/backend.cpython-312.pyc,, +sympy/core/__pycache__/basic.cpython-312.pyc,, +sympy/core/__pycache__/cache.cpython-312.pyc,, +sympy/core/__pycache__/compatibility.cpython-312.pyc,, +sympy/core/__pycache__/containers.cpython-312.pyc,, +sympy/core/__pycache__/core.cpython-312.pyc,, +sympy/core/__pycache__/coreerrors.cpython-312.pyc,, +sympy/core/__pycache__/decorators.cpython-312.pyc,, +sympy/core/__pycache__/evalf.cpython-312.pyc,, +sympy/core/__pycache__/expr.cpython-312.pyc,, +sympy/core/__pycache__/exprtools.cpython-312.pyc,, +sympy/core/__pycache__/facts.cpython-312.pyc,, +sympy/core/__pycache__/function.cpython-312.pyc,, +sympy/core/__pycache__/intfunc.cpython-312.pyc,, +sympy/core/__pycache__/kind.cpython-312.pyc,, +sympy/core/__pycache__/logic.cpython-312.pyc,, +sympy/core/__pycache__/mod.cpython-312.pyc,, +sympy/core/__pycache__/mul.cpython-312.pyc,, +sympy/core/__pycache__/multidimensional.cpython-312.pyc,, +sympy/core/__pycache__/numbers.cpython-312.pyc,, +sympy/core/__pycache__/operations.cpython-312.pyc,, +sympy/core/__pycache__/parameters.cpython-312.pyc,, +sympy/core/__pycache__/power.cpython-312.pyc,, +sympy/core/__pycache__/random.cpython-312.pyc,, +sympy/core/__pycache__/relational.cpython-312.pyc,, +sympy/core/__pycache__/rules.cpython-312.pyc,, +sympy/core/__pycache__/singleton.cpython-312.pyc,, +sympy/core/__pycache__/sorting.cpython-312.pyc,, +sympy/core/__pycache__/symbol.cpython-312.pyc,, +sympy/core/__pycache__/sympify.cpython-312.pyc,, +sympy/core/__pycache__/trace.cpython-312.pyc,, +sympy/core/__pycache__/traversal.cpython-312.pyc,, +sympy/core/_print_helpers.py,sha256=GQo9dI_BvAJtYHVFFfmroNr0L8d71UeI-tU7SGJgctk,2388 +sympy/core/add.py,sha256=TddwsicZFR4yEtVTkZmkzFtn9ndAlhfad7vJiECr6o4,43407 +sympy/core/alphabets.py,sha256=vWBs2atOvfRK6Xfg6hc5IKiB7s_0sZIiVJpcCUJL0N4,266 +sympy/core/assumptions.py,sha256=8K9rhYtT-kqS7hmc9ltkYC-wujYT3pe0BaUJNrOr8fg,23595 +sympy/core/assumptions_generated.py,sha256=0TJKYIHSIFyQcVHZdIHZ19b7tqst_sY7iZwjKzcvZBM,42817 +sympy/core/backend.py,sha256=hF9cftjzB92QEcwimekj0gQ9CEMXTH-leH3l8QcguGo,5273 +sympy/core/basic.py,sha256=IzZvs7iIcMvV8_athdOBnIvBYJg38khuO2fAJtd7uTE,76789 +sympy/core/benchmarks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/core/benchmarks/__pycache__/__init__.cpython-312.pyc,, +sympy/core/benchmarks/__pycache__/bench_arit.cpython-312.pyc,, +sympy/core/benchmarks/__pycache__/bench_assumptions.cpython-312.pyc,, +sympy/core/benchmarks/__pycache__/bench_basic.cpython-312.pyc,, +sympy/core/benchmarks/__pycache__/bench_expand.cpython-312.pyc,, +sympy/core/benchmarks/__pycache__/bench_numbers.cpython-312.pyc,, +sympy/core/benchmarks/__pycache__/bench_sympify.cpython-312.pyc,, +sympy/core/benchmarks/bench_arit.py,sha256=gfrnvKSXLCaUoFFxMgJhnLUp7rG9Pa_YT7OKgOrPP8E,412 +sympy/core/benchmarks/bench_assumptions.py,sha256=evfZzTgOUUvvvlK0DRdDZQRqxIlGLfJYzKu8QDMxSks,177 +sympy/core/benchmarks/bench_basic.py,sha256=YF0tTJ_AN_Wz11qidzM4bIhlwEhEqVc-IGVGrUx6SaA,210 +sympy/core/benchmarks/bench_expand.py,sha256=xgQYQMwqgXJtKajM4JVhuL-7AW8TLY-vdBpO6uyMDoQ,427 +sympy/core/benchmarks/bench_numbers.py,sha256=_1yHSbYmxriiTTzKtxFh7kJm-rXPL6roGs8MW1E5-sg,1135 +sympy/core/benchmarks/bench_sympify.py,sha256=G5iGInhhbkkxSY2pS08BNG945m9m4eZlNT1aJutGt5M,138 +sympy/core/cache.py,sha256=AyG7kganyV0jVx-aNBEUFogqRLHQqqFn8xU3ZSfJoaM,6172 +sympy/core/compatibility.py,sha256=XQH7ezmRi6l3R23qMHN2wfA-YMRWbh2YYjPY7LRo3lo,1145 +sympy/core/containers.py,sha256=IA8PWQeCl78Pn_1WczoYUzOhBoT9X2hM3_hJ232gyKc,11411 +sympy/core/core.py,sha256=lX3Af31Qyff-gwPiAH-vijjuOzBFSuQtN06nUqIcSTQ,547 +sympy/core/coreerrors.py,sha256=imD9TCL-UEM5hrHcqGQbbfLeyZCSJMx6vB1NBQITQIQ,642 +sympy/core/decorators.py,sha256=NO3oe7yIO4q-6Vvy2vTpIAS8GGI-JHjEOEGeAv97voY,8759 +sympy/core/evalf.py,sha256=X0BinrUYeCKyHPHJQnu3FGASTUB8iz5dweVvqeArBrU,62089 +sympy/core/expr.py,sha256=HR_xzh6273FBmdfNbogGzkWoqaI_k_CeIOnpmyzwCrQ,143770 +sympy/core/exprtools.py,sha256=Ft7C1K2kD4_EdpRrGxii_WDub4pK_rYnLTdeVhlBoeo,51544 +sympy/core/facts.py,sha256=54pFKhJwEzU8LkO7rL25TwGjIb5y5CvZleHEy_TpD68,19546 +sympy/core/function.py,sha256=y0vEdXaUD8thP3XasZVkkogqXOGB0cs2JnfHEa4DNjQ,117102 +sympy/core/intfunc.py,sha256=TigJI9bvsb4aN0aZJgCzxIHlv_eh0rElWeTurier3yI,14219 +sympy/core/kind.py,sha256=9kQvtDxm-SSRGi-155XsBl_rs-oN_7dw7fNNT3mDu2Q,11540 +sympy/core/logic.py,sha256=Qbj2WUh5lS0GjxvtPaNmcQXz7mbWXuWj5ZNFZ-N-YPg,10827 +sympy/core/mod.py,sha256=XDfpth2r4AWc04oLqtDWwFuYRLzI0l0MhLMwGSMu99g,8363 +sympy/core/mul.py,sha256=rjCiyOqxMgUTWR8sAcmilRfQLup9wv8Ij7s7JIfUkVM,79201 +sympy/core/multidimensional.py,sha256=NWX1okybO_nZCl9IhIOE8QYalY1WoC0zlzsvBg_E1eE,4233 +sympy/core/numbers.py,sha256=WEkS1JJ9ov-n4hXvxwrH1NPikNlyBCjLN5v-jOZxvsw,136741 +sympy/core/operations.py,sha256=_wjhMX-MD6cyUNKCc9K_QxyxpeG4WQehdypo0Fp76GM,25828 +sympy/core/parameters.py,sha256=EoT2S3W1dS2-HoV6WN7szBexXvn5_w43e2JFouKuvkU,3854 +sympy/core/power.py,sha256=FJSYRf0S3pk1JGkVy3kdWWQENhmpVme-Pf9SS2Rc6SE,73244 +sympy/core/random.py,sha256=miFdVpNKfutbkpYiIOzG9kVNUm5GTk-_nnmQqUhVDZs,6647 +sympy/core/relational.py,sha256=htbGT0uvzoYD07Q6_hdT0iDDsns0NDI2aml0W8mtAgM,51896 +sympy/core/rules.py,sha256=AJuZztmYKZ_yUITLZB6rhZjDy6ROBCtajcYqPa50sjc,1496 +sympy/core/singleton.py,sha256=2Ueja8GJ-0-cvBzlqPwL9hB9eOtjrJFXV6mkDZO1Bp4,7115 +sympy/core/sorting.py,sha256=PoL2-MtVeuYTu-DISGlbvqW2mt787BmWfzrwV1ibavE,10827 +sympy/core/symbol.py,sha256=0xwgxT7ZfhPjq87glw2CQq5MtIEO-DOrAoXu7bHwWFo,29820 +sympy/core/sympify.py,sha256=1vWheH469HqICHrADMY_k4T4eDQlGORNjEh7Re4WbmE,20546 +sympy/core/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/core/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_args.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_arit.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_assumptions.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_basic.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_cache.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_compatibility.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_complex.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_constructor_postprocessor.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_containers.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_count_ops.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_diff.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_equal.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_eval.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_evalf.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_expand.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_expr.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_exprtools.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_facts.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_function.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_kind.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_logic.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_match.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_multidimensional.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_noncommutative.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_numbers.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_operations.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_parameters.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_power.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_priority.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_random.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_relational.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_rules.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_singleton.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_sorting.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_subs.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_symbol.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_sympify.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_traversal.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_truediv.cpython-312.pyc,, +sympy/core/tests/__pycache__/test_var.cpython-312.pyc,, +sympy/core/tests/test_args.py,sha256=gsvYkFoqSWM0G8sjwBkwwNpT_9jc-io1SyDcchI3fA4,184252 +sympy/core/tests/test_arit.py,sha256=TH4b9Z_sMGWlYqiU5MqpY5LmhzYRJSTHWtTNIrYv7fk,78611 +sympy/core/tests/test_assumptions.py,sha256=MjJdF_ymVL6mtgQx-aSr_rsNNxaTi2pHFLjyaPCBq5Q,41573 +sympy/core/tests/test_basic.py,sha256=skFOWZRNqDujmQ8GAskWH7OYcsrO0miBdM92Gy01k0U,10230 +sympy/core/tests/test_cache.py,sha256=p6Ci75a_T-bBXE_5HVxRKla62uSay_0Vuf57gUuH6sI,2001 +sympy/core/tests/test_compatibility.py,sha256=7pvNUEGIcRrfWl3doqHlm3AdNkGlcChO69gos3Fk09A,240 +sympy/core/tests/test_complex.py,sha256=koNGFMt6UMmzahJADSja_eD24gr-GG5gGCtyDgCRtPI,21906 +sympy/core/tests/test_constructor_postprocessor.py,sha256=0d7vbVuKi3GCm3PKLtiNqv_Au7v6RYt1rzRdHiD08tM,2441 +sympy/core/tests/test_containers.py,sha256=ijteBC6cjqzejfxXZZIELZJfMrgTQa1n6AlxHGCEQJs,7432 +sympy/core/tests/test_count_ops.py,sha256=eIA2WvCuWKXVBJEGfWoJrn6WfUshX_NXttrrfyLbNnI,5665 +sympy/core/tests/test_diff.py,sha256=6j4Vk9UCNRv8Oyx_4iv1ePjocwBg7_-3ftrSJ8u0cPo,5421 +sympy/core/tests/test_equal.py,sha256=RoOJuu4kMe4Rkk7eNyVOJov5S1770YHiVAiziNIKd2o,1678 +sympy/core/tests/test_eval.py,sha256=o0kZn3oaMidVYdNjeZYtx4uUKBoE3A2tWn2NS4hu72Q,2366 +sympy/core/tests/test_evalf.py,sha256=aIf2xMuFomr828s4qv6Q16xLHWNmBnDfC4FUv9g619M,28574 +sympy/core/tests/test_expand.py,sha256=jbIjBEmdsPPArsxJ9206YzMS7mPUVZo7j-7alM795eU,13886 +sympy/core/tests/test_expr.py,sha256=249jMUV5GnkjmVVcgPSkwWvzrT00ppWeygkK_9RO6kc,78428 +sympy/core/tests/test_exprtools.py,sha256=L7fi319z1EeFag6pH8myqDQYQ32H193QLKMdqlxACsY,19021 +sympy/core/tests/test_facts.py,sha256=YEZMZ-116VFnFqJ48h9bQsF2flhiB65trnZvJsRSh_o,11579 +sympy/core/tests/test_function.py,sha256=_YRRGTDthS85Bq4zoLo8bHMHNESPLUZW-4_VQaClCLs,51450 +sympy/core/tests/test_kind.py,sha256=NLJbwCpugzlNbaSyUlbb6NHoT_9dHuoXj023EDQMrNI,2048 +sympy/core/tests/test_logic.py,sha256=_YKSIod6Q0oIz9lDs78UQQrv9LU-uKaztd7w8LWwuwY,5634 +sympy/core/tests/test_match.py,sha256=yjVNccCLutvov8Ru_p38Hl_HDS0ltdsWierSi54m5Ts,22714 +sympy/core/tests/test_multidimensional.py,sha256=Fr-lagme3lwLrBpdaWP7O7oPezhIatn5X8fYYs-8bN8,848 +sympy/core/tests/test_noncommutative.py,sha256=IkGPcvLO4ACVj5LMT2IUgyj68F1RBvMKbm01iqTOK04,4436 +sympy/core/tests/test_numbers.py,sha256=SvTVZUpMWfeGvaqyJUp4e9FYIO8lFJLcbRcmBNWO8m0,78001 +sympy/core/tests/test_operations.py,sha256=mRxftKlrxxrn3zS3UPwqkF6Nr15l5Cv6j3c2RJX46s4,2859 +sympy/core/tests/test_parameters.py,sha256=wO9D-LcMMEyf5u5-EmDwVeQ02YzYbYwtFFR_o-M4ybQ,3560 +sympy/core/tests/test_power.py,sha256=H7SFxpWVnF4vgpF95ad-Fo5xHhIvKhtZJuGBg0J2SAk,24862 +sympy/core/tests/test_priority.py,sha256=6QlWz52qWwOU0CknBb4KErs4R87jp4wH3hVSQNAgdVI,3252 +sympy/core/tests/test_random.py,sha256=H58NfH5BYeQ3RIscbDct6SZkHQVRJjichVUSuSrhvAU,1233 +sympy/core/tests/test_relational.py,sha256=7ne7GIG_i0uVT8FfpCJ4ixnuIyQoVy-PwJm3kYNWbKI,43525 +sympy/core/tests/test_rules.py,sha256=iwmMX7hxC_73CuX9BizeAci-cO4JDq-y1sicKBXEGA4,349 +sympy/core/tests/test_singleton.py,sha256=xLJJgXwmkbKhsot_qTs-o4dniMjHUh3_va0xsA5h-KA,3036 +sympy/core/tests/test_sorting.py,sha256=6BZKYqUedAR-jeHcIgsJelJHFWuougml2c1NNilxGZg,902 +sympy/core/tests/test_subs.py,sha256=7ITJFDplgWBRImkcHfjRdnHqaKgjTxWb4j4WoRysvR8,30106 +sympy/core/tests/test_symbol.py,sha256=zYhPWsdyQp7_NiLVthpoCB1RyP9pmJcNlTdTN2kMdfY,13043 +sympy/core/tests/test_sympify.py,sha256=FEOsRduYX3EqE9EhMILwE9wu6jDj_o2WU9XEZHsXFUo,28195 +sympy/core/tests/test_traversal.py,sha256=cmgvMW8G-LZ20ZXy-wg5Vz5ogI_oq2p2bJSwMy9IMF0,4311 +sympy/core/tests/test_truediv.py,sha256=RYfJX39-mNhekRE3sj5TGFZXKra4ML9vGvObsRYuD3k,854 +sympy/core/tests/test_var.py,sha256=hexP-0q2nN9h_dyhKLCuvqFXgLC9e_Hroni8Ldb16Ko,1594 +sympy/core/trace.py,sha256=9WC8p3OpBL6TdHmZWMDK9jaCG-16f4uZV2VptduVH98,348 +sympy/core/traversal.py,sha256=PP4HUp-2gtsoCtGZwqxpbqZ33vtoRX-yYTbIqOQiaR0,8860 +sympy/crypto/__init__.py,sha256=i8GcbScXhIPbMEe7uuMgXqh_cU2mZm2f6hspIgmW5uM,2158 +sympy/crypto/__pycache__/__init__.cpython-312.pyc,, +sympy/crypto/__pycache__/crypto.cpython-312.pyc,, +sympy/crypto/crypto.py,sha256=iAERU5Qf9GizEUMUyxTgTUBI0U9QpSkbRir2nvKIKUA,89685 +sympy/crypto/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/crypto/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/crypto/tests/__pycache__/test_crypto.cpython-312.pyc,, +sympy/crypto/tests/test_crypto.py,sha256=gPsRBNNHwc4QDBjgT5tvWTCuC5IA5d4aZRTblxXjngk,19758 +sympy/diffgeom/__init__.py,sha256=cWj4N7AfNgrYcGIBexX-UrWxfd1bP9DTNqUmLWUJ9nA,991 +sympy/diffgeom/__pycache__/__init__.cpython-312.pyc,, +sympy/diffgeom/__pycache__/diffgeom.cpython-312.pyc,, +sympy/diffgeom/__pycache__/rn.cpython-312.pyc,, +sympy/diffgeom/diffgeom.py,sha256=DgxgxP9B7NT-M1Hb1-1AwHYHBvXZk_Y6_MqZcGPsmOg,72274 +sympy/diffgeom/rn.py,sha256=kvgth6rNJWt94kzVospZwiH53C-s4VSiorktQNmMobQ,6264 +sympy/diffgeom/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/diffgeom/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/diffgeom/tests/__pycache__/test_class_structure.cpython-312.pyc,, +sympy/diffgeom/tests/__pycache__/test_diffgeom.cpython-312.pyc,, +sympy/diffgeom/tests/__pycache__/test_function_diffgeom_book.cpython-312.pyc,, +sympy/diffgeom/tests/__pycache__/test_hyperbolic_space.cpython-312.pyc,, +sympy/diffgeom/tests/test_class_structure.py,sha256=LbRyxhhp-NnnfJ2gTn1SdlgCBQn2rhyB7xApOgcd_rM,1048 +sympy/diffgeom/tests/test_diffgeom.py,sha256=3BepCr6ned-4C_3me4zScu06HXG9Qx_dBBxIpiXAvy4,14145 +sympy/diffgeom/tests/test_function_diffgeom_book.py,sha256=GwhUAiAPtUv5I9oghdElMhtc6KX184tySgLSpVHhT0Q,5254 +sympy/diffgeom/tests/test_hyperbolic_space.py,sha256=c4xQJ_bBS4xrMj3pfx1Ms3oC2_LwuJuNYXNZxs-cVG8,2598 +sympy/discrete/__init__.py,sha256=A_Seud0IRr2gPYlz6JMQZa3sBhRL3O7gVqhIvMRRvE0,772 +sympy/discrete/__pycache__/__init__.cpython-312.pyc,, +sympy/discrete/__pycache__/convolutions.cpython-312.pyc,, +sympy/discrete/__pycache__/recurrences.cpython-312.pyc,, +sympy/discrete/__pycache__/transforms.cpython-312.pyc,, +sympy/discrete/convolutions.py,sha256=9L2d2Rrn6jqGfV2lBxCV6LmcTNBZUuOIqP_fuMIzPzk,18341 +sympy/discrete/recurrences.py,sha256=FqU5QG4qNNLSVBqcpL7HtKa7rQOlmHMXDQRzHZ_P_s0,5124 +sympy/discrete/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/discrete/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/discrete/tests/__pycache__/test_convolutions.cpython-312.pyc,, +sympy/discrete/tests/__pycache__/test_recurrences.cpython-312.pyc,, +sympy/discrete/tests/__pycache__/test_transforms.cpython-312.pyc,, +sympy/discrete/tests/test_convolutions.py,sha256=K4S9bA1E2tg0VcFQ8SYtlxjL6HB666RxD5rriTuAK4k,17856 +sympy/discrete/tests/test_recurrences.py,sha256=s5ZEZQ262gcnBLpCjJVmeKlTKQByRTQBrc-N9p_4W8c,3019 +sympy/discrete/tests/test_transforms.py,sha256=vEORFaPvxmPSsw0f4Z2hLEN1wD0FdyQOYHDEY9aVm5A,5546 +sympy/discrete/transforms.py,sha256=lf-n6IN881uCfTUAxPNjdUaSguiRbYW0omuR96vKNlE,11681 +sympy/external/__init__.py,sha256=C6s4654Elc_X-D9UgI2cUQWiQyGDt9LG3IKUc8qqzuo,578 +sympy/external/__pycache__/__init__.cpython-312.pyc,, +sympy/external/__pycache__/gmpy.cpython-312.pyc,, +sympy/external/__pycache__/importtools.cpython-312.pyc,, +sympy/external/__pycache__/ntheory.cpython-312.pyc,, +sympy/external/__pycache__/pythonmpq.cpython-312.pyc,, +sympy/external/gmpy.py,sha256=89vXc1KD5TiQCTwlL-98r01KdqsOsJpzc8XN1R7TwM4,9768 +sympy/external/importtools.py,sha256=Q7tS2cdGZ9a4NI_1sgGuoVcSDv_rIk-Av0BpFTa6EzA,7671 +sympy/external/ntheory.py,sha256=jnm13KGII1p6X42T-u2jVoBxiOCXZ8XGxjzhCuWXthE,16555 +sympy/external/pythonmpq.py,sha256=DBQYdZsCUajqIjV5ECYpzpCSbe4RR9qr4D1x_ZTuZaY,11259 +sympy/external/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/external/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/external/tests/__pycache__/test_autowrap.cpython-312.pyc,, +sympy/external/tests/__pycache__/test_codegen.cpython-312.pyc,, +sympy/external/tests/__pycache__/test_gmpy.cpython-312.pyc,, +sympy/external/tests/__pycache__/test_importtools.cpython-312.pyc,, +sympy/external/tests/__pycache__/test_ntheory.cpython-312.pyc,, +sympy/external/tests/__pycache__/test_numpy.cpython-312.pyc,, +sympy/external/tests/__pycache__/test_pythonmpq.cpython-312.pyc,, +sympy/external/tests/__pycache__/test_scipy.cpython-312.pyc,, +sympy/external/tests/test_autowrap.py,sha256=nUWYeQd1QF-Ou4A63iWypsn6pJMi0uMLyba8aRCOhnM,9759 +sympy/external/tests/test_codegen.py,sha256=t991vYFfQC6loodk7Vp1oKTCklBn8SwY7qLshVVou4w,12598 +sympy/external/tests/test_gmpy.py,sha256=8ITpuWYeitCymWwuQLpOOVBmRb3CJsO5sbqiZcVDulE,397 +sympy/external/tests/test_importtools.py,sha256=KrfontKYv11UvpazQ0vS1qyhxIvgZrCOXh1JFeACjeo,1394 +sympy/external/tests/test_ntheory.py,sha256=BJWirDnX7Y7McBoXreMomGQx33YlAjiuBTYQQLhobLU,8881 +sympy/external/tests/test_numpy.py,sha256=tuEji5l6GqbNjv74T6a3e8LDzI2zKUaLzvfluNXOFE0,10291 +sympy/external/tests/test_pythonmpq.py,sha256=L_FdZmmk5N-VEivE_O_qZa98BZhT1WSxRfdmG817bA0,5797 +sympy/external/tests/test_scipy.py,sha256=CVaw7D0-6DORgg78Q6b35SNKn05PlKwWJuqXOuU-qdY,1172 +sympy/functions/__init__.py,sha256=-u5IzcQAPk9emytXfMK22EVXqpXUtSau3pQtevZYmFo,5565 +sympy/functions/__pycache__/__init__.cpython-312.pyc,, +sympy/functions/combinatorial/__init__.py,sha256=WqXI3qU_TTJ7nJA8m3Z-7ZAYKoApT8f9Xs0u2bTwy_c,53 +sympy/functions/combinatorial/__pycache__/__init__.cpython-312.pyc,, +sympy/functions/combinatorial/__pycache__/factorials.cpython-312.pyc,, +sympy/functions/combinatorial/__pycache__/numbers.cpython-312.pyc,, +sympy/functions/combinatorial/factorials.py,sha256=cYMN1Bz76XninzSxzdLYxTN7-Mt1mzfUcSWIU-qpYAw,39184 +sympy/functions/combinatorial/numbers.py,sha256=PcW4rvWQ66POd1FcL8SJav2iUmGv2Ip_Vbbp_3qYIAY,101088 +sympy/functions/combinatorial/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/functions/combinatorial/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/functions/combinatorial/tests/__pycache__/test_comb_factorials.cpython-312.pyc,, +sympy/functions/combinatorial/tests/__pycache__/test_comb_numbers.cpython-312.pyc,, +sympy/functions/combinatorial/tests/test_comb_factorials.py,sha256=B59sfZxTUmKtnG62LW9sPn7HnRxFBP6x_rnbKqbaaZ0,26317 +sympy/functions/combinatorial/tests/test_comb_numbers.py,sha256=GWeIeb9zJo3WJr9NGW7VD-PmCIt13ce-VufICHs1-A8,47593 +sympy/functions/elementary/__init__.py,sha256=Fj8p5qE-Rr1lqAyHI0aSgC3RYX56O-gWwo6wu-eUQYA,50 +sympy/functions/elementary/__pycache__/__init__.cpython-312.pyc,, +sympy/functions/elementary/__pycache__/_trigonometric_special.cpython-312.pyc,, +sympy/functions/elementary/__pycache__/complexes.cpython-312.pyc,, +sympy/functions/elementary/__pycache__/exponential.cpython-312.pyc,, +sympy/functions/elementary/__pycache__/hyperbolic.cpython-312.pyc,, +sympy/functions/elementary/__pycache__/integers.cpython-312.pyc,, +sympy/functions/elementary/__pycache__/miscellaneous.cpython-312.pyc,, +sympy/functions/elementary/__pycache__/piecewise.cpython-312.pyc,, +sympy/functions/elementary/__pycache__/trigonometric.cpython-312.pyc,, +sympy/functions/elementary/_trigonometric_special.py,sha256=FvrgSXisxjXjyBC4-NLLya6q2YyTMNMAUqqYzuYl34g,7271 +sympy/functions/elementary/benchmarks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/functions/elementary/benchmarks/__pycache__/__init__.cpython-312.pyc,, +sympy/functions/elementary/benchmarks/__pycache__/bench_exp.cpython-312.pyc,, +sympy/functions/elementary/benchmarks/bench_exp.py,sha256=PFBYa9eMovH5XOFN5XTxWr1VDj1EBoKwn4mAtj-_DdM,185 +sympy/functions/elementary/complexes.py,sha256=HQm4ViBWN5OkCtJZQPdLdChTnmzbk4Cb2A--MUzTgUs,44168 +sympy/functions/elementary/exponential.py,sha256=GoDlUBPcmpRjYehRZOooF0bISSK_oxpJlkqaE_KNTeQ,42610 +sympy/functions/elementary/hyperbolic.py,sha256=zewRSHNzxyvSFD9sP9XBKX-evG6Rds4k9jAAcfmDbIk,69329 +sympy/functions/elementary/integers.py,sha256=Dc5Bq6ds85NJYWkfHJPJccUeVTxbhzVloTeMo5HGG98,22394 +sympy/functions/elementary/miscellaneous.py,sha256=cPpv71po3HCQGsWIHgcQEql6RNb4Y3RrL24ujgtdTIQ,27944 +sympy/functions/elementary/piecewise.py,sha256=Nv32I9lktMPHF3k0JpifbcgCgIz7CyQ8KwI_t1BaVsI,58285 +sympy/functions/elementary/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/functions/elementary/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/functions/elementary/tests/__pycache__/test_complexes.cpython-312.pyc,, +sympy/functions/elementary/tests/__pycache__/test_exponential.cpython-312.pyc,, +sympy/functions/elementary/tests/__pycache__/test_hyperbolic.cpython-312.pyc,, +sympy/functions/elementary/tests/__pycache__/test_integers.cpython-312.pyc,, +sympy/functions/elementary/tests/__pycache__/test_interface.cpython-312.pyc,, +sympy/functions/elementary/tests/__pycache__/test_miscellaneous.cpython-312.pyc,, +sympy/functions/elementary/tests/__pycache__/test_piecewise.cpython-312.pyc,, +sympy/functions/elementary/tests/__pycache__/test_trigonometric.cpython-312.pyc,, +sympy/functions/elementary/tests/test_complexes.py,sha256=BaPIrUSkoguP74x7uLSt9bA9kxmB58fJ4wgNtx5RnCg,34016 +sympy/functions/elementary/tests/test_exponential.py,sha256=ojjC0aafWaQegZVYV7bgxyvWAES_erpeYTb3R0m9V5I,29733 +sympy/functions/elementary/tests/test_hyperbolic.py,sha256=TBJZbiV-o9c2uVUqnkaRuHr5FdSGBOpqKK5_2bWg92s,56898 +sympy/functions/elementary/tests/test_integers.py,sha256=_QaECu3JQRQa9uPi10jXlu9AohvtLTKB4rSe920g0tY,23266 +sympy/functions/elementary/tests/test_interface.py,sha256=dW0aHvLR5UPyyXzBS-tgKrQIp-H6Vu8sKjlQrBQgtZ4,2513 +sympy/functions/elementary/tests/test_miscellaneous.py,sha256=eCL30UmsusBhjvqICQNmToa1aJTML8fXav1L1J6b7FU,17148 +sympy/functions/elementary/tests/test_piecewise.py,sha256=b1c0IMbXHDLjbi_ESs7fQhJiMaEro30GEu9XYreicYA,62876 +sympy/functions/elementary/tests/test_trigonometric.py,sha256=ebRorj-WThNp56qvZOAGkvgpvWFnIlB6kFZyV1gCii4,90340 +sympy/functions/elementary/trigonometric.py,sha256=b2mE2SpNj0LZM3AcipW0FrjturAi9ozijK3PhqyfCbM,115945 +sympy/functions/special/__init__.py,sha256=5pjIq_RVCMsuCe1b-FlwIty30KxoUowZYKLmpIT9KHQ,59 +sympy/functions/special/__pycache__/__init__.cpython-312.pyc,, +sympy/functions/special/__pycache__/bessel.cpython-312.pyc,, +sympy/functions/special/__pycache__/beta_functions.cpython-312.pyc,, +sympy/functions/special/__pycache__/bsplines.cpython-312.pyc,, +sympy/functions/special/__pycache__/delta_functions.cpython-312.pyc,, +sympy/functions/special/__pycache__/elliptic_integrals.cpython-312.pyc,, +sympy/functions/special/__pycache__/error_functions.cpython-312.pyc,, +sympy/functions/special/__pycache__/gamma_functions.cpython-312.pyc,, +sympy/functions/special/__pycache__/hyper.cpython-312.pyc,, +sympy/functions/special/__pycache__/mathieu_functions.cpython-312.pyc,, +sympy/functions/special/__pycache__/polynomials.cpython-312.pyc,, +sympy/functions/special/__pycache__/singularity_functions.cpython-312.pyc,, +sympy/functions/special/__pycache__/spherical_harmonics.cpython-312.pyc,, +sympy/functions/special/__pycache__/tensor_functions.cpython-312.pyc,, +sympy/functions/special/__pycache__/zeta_functions.cpython-312.pyc,, +sympy/functions/special/benchmarks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/functions/special/benchmarks/__pycache__/__init__.cpython-312.pyc,, +sympy/functions/special/benchmarks/__pycache__/bench_special.cpython-312.pyc,, +sympy/functions/special/benchmarks/bench_special.py,sha256=wzAoKTccuEaG4xrEYTlYfIJuLi3kUTMTEJ9iA113Wog,164 +sympy/functions/special/bessel.py,sha256=r-jJETBLp8a4JOKV9dW5EWr_yvERL0HMn0su328bug8,68656 +sympy/functions/special/beta_functions.py,sha256=de-ypTWZEjvFkq9RgPq3ghGOvFOfPmb9JfUDAPKQoXk,12777 +sympy/functions/special/bsplines.py,sha256=q7iZSeEMlRrx5gpXOzlk4uSTPIollduNZuGwMHB6fRM,10060 +sympy/functions/special/delta_functions.py,sha256=jopb1BX803pZtDAtLmKfFqRVjo3mySekyC80Lu-sJkM,19887 +sympy/functions/special/elliptic_integrals.py,sha256=YpCU-xyTvrmBxdO7Rj2pNYDbS2-bGfCvCaOHon9nSq0,14921 +sympy/functions/special/error_functions.py,sha256=GvKrm5fVMpat0Iierh9UsxsTeQknJyiHgMrWS-e7fhw,79556 +sympy/functions/special/gamma_functions.py,sha256=gkPQdMNR7k5uY1vSUu6zzyoJKMoQZfC90YjLRcyft5c,42943 +sympy/functions/special/hyper.py,sha256=oqeAhFALAN_H6eS0Fs_axdfL9jIYQ-aRFGGgQky2HYk,38829 +sympy/functions/special/mathieu_functions.py,sha256=kFmt0RUA70vhGphI7lhwUsOQ7KIy8Y95DU6gGkVQU5Y,6620 +sympy/functions/special/polynomials.py,sha256=IdxRf8D1iFA-oYfLyTcUmsSCeuWja4h2ExNb8UShwxg,46753 +sympy/functions/special/singularity_functions.py,sha256=ounzMgFQiOW-e1Rb5y_dCSopJGegXMdkj-EpjrP8tzU,8346 +sympy/functions/special/spherical_harmonics.py,sha256=MNAJ4ABTy_EIZe2XSK_MZ1SPnk1OeDnJAtrICAst4yw,11018 +sympy/functions/special/tensor_functions.py,sha256=UNoDpLu1EBR-2tX_dLoRpKhN0Yhm-z_hh8EtW50dNSE,12303 +sympy/functions/special/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/functions/special/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_bessel.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_beta_functions.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_bsplines.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_delta_functions.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_elliptic_integrals.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_error_functions.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_gamma_functions.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_hyper.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_mathieu.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_singularity_functions.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_spec_polynomials.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_spherical_harmonics.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_tensor_functions.cpython-312.pyc,, +sympy/functions/special/tests/__pycache__/test_zeta_functions.cpython-312.pyc,, +sympy/functions/special/tests/test_bessel.py,sha256=c6OKhj4MCjv4kpDG7udueaCOLykblsKHMOyP4CdFToA,37373 +sympy/functions/special/tests/test_beta_functions.py,sha256=yxfgu-wmNEeMfaFABiDHYmuZpZup9FTp0ZYerlc6hhc,3786 +sympy/functions/special/tests/test_bsplines.py,sha256=6UYg7IqXTi8fcSOut8TEzNVkxIA4ff-CyG22qJnbIYA,7145 +sympy/functions/special/tests/test_delta_functions.py,sha256=8xhSWG4SLL86z1QKFfLk_3b--bCrxjvCaxHlODBVToE,7138 +sympy/functions/special/tests/test_elliptic_integrals.py,sha256=scu7KemJ7Q2nsRcZtckQNruuthI-vla9M1sDVkLcbKM,6991 +sympy/functions/special/tests/test_error_functions.py,sha256=TkhkIKiuRZS78-F4ZTt5rvr3hfknp654IEhmHhRXT48,33565 +sympy/functions/special/tests/test_gamma_functions.py,sha256=aveGPdG1X9OdlC6xpdZbSsJ3S4M4DaG2osyOhm1fAYo,29908 +sympy/functions/special/tests/test_hyper.py,sha256=SEnQ9TtyO_dSQRc94AHrbQai6Q7-tmRfDIh40gNE3FE,16694 +sympy/functions/special/tests/test_mathieu.py,sha256=pqoFbnC84NDL6EQkigFtx5OQ1RFYppckTjzsm9XT0PY,1282 +sympy/functions/special/tests/test_singularity_functions.py,sha256=GEXzHHeR5F0swrZzhF7pEGR0tk9Vp3Ve2c-sE4WSpsY,6249 +sympy/functions/special/tests/test_spec_polynomials.py,sha256=wuiZaR_LwaM8SlNuGl3B1p4eOHC_-zZVSXMPNfzKRB4,19561 +sympy/functions/special/tests/test_spherical_harmonics.py,sha256=pUFtFpNPBnJTdnqou0jniSchijyh1rdzKv8H24RT9FU,3850 +sympy/functions/special/tests/test_tensor_functions.py,sha256=bblSDkPABZ6N1j1Rb2Bb5TZIzZoK1D8ks3fHizi69ZI,5546 +sympy/functions/special/tests/test_zeta_functions.py,sha256=2r59_aC0QOXQsBNXqxsHPr2PkJExusI6qvSydZBPbfw,10474 +sympy/functions/special/zeta_functions.py,sha256=QPRYVp0-WKs02CUSQiRIJUWD4N_3PmqrOsk1MGzBUfU,24091 +sympy/galgebra.py,sha256=yEosUPSnhLp9a1NWXvpCLoU20J6TQ58XNIvw07POkVk,123 +sympy/geometry/__init__.py,sha256=BU2MiKm8qJyZJ_hz1qC-3nFJTPEcuvx4hYd02jHjqSM,1240 +sympy/geometry/__pycache__/__init__.cpython-312.pyc,, +sympy/geometry/__pycache__/curve.cpython-312.pyc,, +sympy/geometry/__pycache__/ellipse.cpython-312.pyc,, +sympy/geometry/__pycache__/entity.cpython-312.pyc,, +sympy/geometry/__pycache__/exceptions.cpython-312.pyc,, +sympy/geometry/__pycache__/line.cpython-312.pyc,, +sympy/geometry/__pycache__/parabola.cpython-312.pyc,, +sympy/geometry/__pycache__/plane.cpython-312.pyc,, +sympy/geometry/__pycache__/point.cpython-312.pyc,, +sympy/geometry/__pycache__/polygon.cpython-312.pyc,, +sympy/geometry/__pycache__/util.cpython-312.pyc,, +sympy/geometry/curve.py,sha256=F7b6XrlhUZ0QWLDoZJVojWfC5LeyOU-69OTFnYAREg8,10170 +sympy/geometry/ellipse.py,sha256=So0gH9e-1Oh3HGzrXoLqANyP4lTTBfGHHVo5vCdbfdk,50305 +sympy/geometry/entity.py,sha256=fvHhtSb6RvE6v-8yMyCNvm0ekLPoO7EO9J8TEsGyQGU,20668 +sympy/geometry/exceptions.py,sha256=XtUMA44UTdrBWt771jegFC-TXsobhDiI-10TDH_WNFM,131 +sympy/geometry/line.py,sha256=Yw8ns_w8rn6FEak6MmfsdccgNNjMQHhodDik2UX7jJM,80397 +sympy/geometry/parabola.py,sha256=YhtQ9C5Yco_iSQ6ZYRs0lZBWHmDkcvKUr-Y8RghY3M8,10716 +sympy/geometry/plane.py,sha256=z3hjEf3ibO735DV0Mb4DVjvthYlDyiPfekCeePSCDMM,26770 +sympy/geometry/point.py,sha256=vQB40V1fvhZze3D_D54HlMSS8gXeMIWerd2hBozmPFA,36661 +sympy/geometry/polygon.py,sha256=aooJyJVwf6ZPuxStYgTc-2jNjVaM2YHSvpVY3XRjAuo,82027 +sympy/geometry/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/geometry/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/geometry/tests/__pycache__/test_curve.cpython-312.pyc,, +sympy/geometry/tests/__pycache__/test_ellipse.cpython-312.pyc,, +sympy/geometry/tests/__pycache__/test_entity.cpython-312.pyc,, +sympy/geometry/tests/__pycache__/test_geometrysets.cpython-312.pyc,, +sympy/geometry/tests/__pycache__/test_line.cpython-312.pyc,, +sympy/geometry/tests/__pycache__/test_parabola.cpython-312.pyc,, +sympy/geometry/tests/__pycache__/test_plane.cpython-312.pyc,, +sympy/geometry/tests/__pycache__/test_point.cpython-312.pyc,, +sympy/geometry/tests/__pycache__/test_polygon.cpython-312.pyc,, +sympy/geometry/tests/__pycache__/test_util.cpython-312.pyc,, +sympy/geometry/tests/test_curve.py,sha256=xL4uRWAal4mXZxuQhcs9QOhs6MheCbFNyH1asq_a2IQ,4479 +sympy/geometry/tests/test_ellipse.py,sha256=f-EorUkNl_cg63bDvm4Qrbe1PWrBaCCRg8jAmdIYBuU,26509 +sympy/geometry/tests/test_entity.py,sha256=KSsncs7afLpqUAYTs9b0VH1dt6FhPrX5rrj2rdLpBUo,3896 +sympy/geometry/tests/test_geometrysets.py,sha256=vvOWrFrJuNAFgbrVh1wPY94o-H-85FWlnIyyo2Kst9c,1911 +sympy/geometry/tests/test_line.py,sha256=fLWGfHQNC3YqjxtT7zQbP--Cu0mjcPwSBfji4DA7BP0,38054 +sympy/geometry/tests/test_parabola.py,sha256=kd0RU5sGOcfp6jgwgXMtvT2B6kG1-M3-iGOLnUJfZOw,6150 +sympy/geometry/tests/test_plane.py,sha256=QRcfoDsJtCtcvjFb18hBEHupycLgAT2OohF6GpNShyQ,12525 +sympy/geometry/tests/test_point.py,sha256=YKXQdlBTQWsIVf9l3G6iPMq0OqMTo8nZlibhJDsq_Ic,16410 +sympy/geometry/tests/test_polygon.py,sha256=4D0t98SELQF42dYR-CbFqDU5yJds0LAE2RE8xqEdqag,27602 +sympy/geometry/tests/test_util.py,sha256=sbh1QvkQG1OqvE-kt4fNNIkMWnOFi5EpaBmnZS3pzNc,7044 +sympy/geometry/util.py,sha256=zF6Xx0ciab6Rxm4ekK5RawWXPWAk5oug8eDvgfNKoRc,20671 +sympy/holonomic/__init__.py,sha256=BgHIokaSOo3nwJlGO_caJHz37n6yoA8GeM9Xjn4zMpc,784 +sympy/holonomic/__pycache__/__init__.cpython-312.pyc,, +sympy/holonomic/__pycache__/holonomic.cpython-312.pyc,, +sympy/holonomic/__pycache__/holonomicerrors.cpython-312.pyc,, +sympy/holonomic/__pycache__/numerical.cpython-312.pyc,, +sympy/holonomic/__pycache__/recurrence.cpython-312.pyc,, +sympy/holonomic/holonomic.py,sha256=vP5XabVIezsAURbK65p8P_QfPINQwhol0d62B7Br3s0,91887 +sympy/holonomic/holonomicerrors.py,sha256=qDyUoGbrRjPtVax4SeEEf_o6-264mASEZO_rZETXH5o,1193 +sympy/holonomic/numerical.py,sha256=MlP8xTBqjVQqM1-jwviS_yPICKj6tEVsa9f6wyMCSfo,2625 +sympy/holonomic/recurrence.py,sha256=HWSMokhjcdGTLW_oku0Xi8W8RHxWYS28bv8V7eubC58,10377 +sympy/holonomic/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/holonomic/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/holonomic/tests/__pycache__/test_holonomic.cpython-312.pyc,, +sympy/holonomic/tests/__pycache__/test_recurrence.cpython-312.pyc,, +sympy/holonomic/tests/test_holonomic.py,sha256=NuoJtJi3RlpMYhMU_bGH1tuFuFoOZZrrSdMpgdHGhf0,35333 +sympy/holonomic/tests/test_recurrence.py,sha256=qHv0kn1Q4-aCD7XmbDK2xIdkjF0XkeZUKD2yeLajiq0,1342 +sympy/integrals/__init__.py,sha256=pZ-C3tDP_8woKActNoS7IwyW-9AuB5PMHB5B0ohlpw8,1970 +sympy/integrals/__pycache__/__init__.cpython-312.pyc,, +sympy/integrals/__pycache__/deltafunctions.cpython-312.pyc,, +sympy/integrals/__pycache__/heurisch.cpython-312.pyc,, +sympy/integrals/__pycache__/integrals.cpython-312.pyc,, +sympy/integrals/__pycache__/intpoly.cpython-312.pyc,, +sympy/integrals/__pycache__/laplace.cpython-312.pyc,, +sympy/integrals/__pycache__/manualintegrate.cpython-312.pyc,, +sympy/integrals/__pycache__/meijerint.cpython-312.pyc,, +sympy/integrals/__pycache__/meijerint_doc.cpython-312.pyc,, +sympy/integrals/__pycache__/prde.cpython-312.pyc,, +sympy/integrals/__pycache__/quadrature.cpython-312.pyc,, +sympy/integrals/__pycache__/rationaltools.cpython-312.pyc,, +sympy/integrals/__pycache__/rde.cpython-312.pyc,, +sympy/integrals/__pycache__/risch.cpython-312.pyc,, +sympy/integrals/__pycache__/singularityfunctions.cpython-312.pyc,, +sympy/integrals/__pycache__/transforms.cpython-312.pyc,, +sympy/integrals/__pycache__/trigonometry.cpython-312.pyc,, +sympy/integrals/benchmarks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/integrals/benchmarks/__pycache__/__init__.cpython-312.pyc,, +sympy/integrals/benchmarks/__pycache__/bench_integrate.cpython-312.pyc,, +sympy/integrals/benchmarks/__pycache__/bench_trigintegrate.cpython-312.pyc,, +sympy/integrals/benchmarks/bench_integrate.py,sha256=vk6wAO1bqzFT9oW4qsW7nKGfc_gP0XaB5PMYKx5339Q,396 +sympy/integrals/benchmarks/bench_trigintegrate.py,sha256=8XU3uB3mcavigvzHQZA7H1sHI32zgT-9RkSnLa-Y3Vc,305 +sympy/integrals/deltafunctions.py,sha256=ysIQLdRBcG_YR-bVDoxt-sxEVU8TG77oSgM-J0gI0mE,7435 +sympy/integrals/heurisch.py,sha256=Huq3dBJEXvYGzkBboXnG6xFCGorc5Uftf5ssbiltyIs,26706 +sympy/integrals/integrals.py,sha256=DV_ditazAyVBpUCzsUFNiYvvQRqJfx3UGjnSEB2HKcg,64887 +sympy/integrals/intpoly.py,sha256=SXjd_f295YrYsvoQpzE2EQM5xaQnnj0zvHdYW5KEdn0,43266 +sympy/integrals/laplace.py,sha256=y5NxZ3_nNtc-NETYWw4iha7LTVM9Ok9NWPtmMUXtZwg,87038 +sympy/integrals/manualintegrate.py,sha256=sO_5-9pbeRKhZSuEwXm6okxpvRsbpQZerbLBdRdDtp4,75721 +sympy/integrals/meijerint.py,sha256=yOsrHJA7doo1uDsmsiTqK2Tly4JF30sA5RElT92lfec,80775 +sympy/integrals/meijerint_doc.py,sha256=Sis9bZvwciU2_BZzr3GCvXLkBcXVUhP9ycqGIDu99xU,1204 +sympy/integrals/prde.py,sha256=3VqBQOX7SZv_lETmhoVgb9gRjb1z8hiZAJ6vv5AgNEo,52073 +sympy/integrals/quadrature.py,sha256=6Bg3JmlIjIduIfaGfNVcwNfSrgEiLOszcN8WPzsXNqE,17064 +sympy/integrals/rationaltools.py,sha256=ZAizq9unSt-_wQkCIAhl_FaemzbQcfBcE9A3mDiU788,11694 +sympy/integrals/rde.py,sha256=EKXK6bf4m-2O0NZ-rtHq0Ye2a_o9LmUrkoV8gNxZKVk,27393 +sympy/integrals/risch.py,sha256=4UsTHizZtAMe3VUmRHugdOuPMilw8sKiVOlSUMWj9oE,67352 +sympy/integrals/singularityfunctions.py,sha256=ONI8x-ed-IcqOF4K2l0LVUvEUN2_dHztvL4auRsi67U,2235 +sympy/integrals/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/integrals/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_deltafunctions.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_failing_integrals.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_heurisch.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_integrals.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_intpoly.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_laplace.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_lineintegrals.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_manual.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_meijerint.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_prde.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_quadrature.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_rationaltools.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_rde.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_risch.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_singularityfunctions.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_transforms.cpython-312.pyc,, +sympy/integrals/tests/__pycache__/test_trigonometry.cpython-312.pyc,, +sympy/integrals/tests/test_deltafunctions.py,sha256=ivFjS-WlLQ4aMqjVS7ZzMChP2Mmw_JUPnwI9otiLnvs,3709 +sympy/integrals/tests/test_failing_integrals.py,sha256=HKMA6O26exCIRWQ43KyKugOvJL3gOei3r9JObcKo8p0,7438 +sympy/integrals/tests/test_heurisch.py,sha256=-btpZS_LI9EO-2EmA0eHV6l7xykQjkHIcpDU_GziTlo,14299 +sympy/integrals/tests/test_integrals.py,sha256=8bVIN4ztTwOvpLrlDIk1SURQMtiNXoqu-LLMkZp-Wrk,81192 +sympy/integrals/tests/test_intpoly.py,sha256=NzGhkR2pUMfd8lIU2cFR9bFa0J89RzpHs3zDggAWtXo,37445 +sympy/integrals/tests/test_laplace.py,sha256=pWn5UEm15gJv_hD35lvJh03Uuw4o79rbCQYvbXQS2xk,38186 +sympy/integrals/tests/test_lineintegrals.py,sha256=zcPJ2n7DYt9KsgAe38t0gq3ARApUlb-kBahLThuRcq8,450 +sympy/integrals/tests/test_manual.py,sha256=unQ6Ew81SCHvVMva_aAOndh7hWpLeDwBtXs6W-yC0jE,34551 +sympy/integrals/tests/test_meijerint.py,sha256=G22dppQGMFU3JGexHZs65nce8UAK9wTilZn0D1XvZu0,32594 +sympy/integrals/tests/test_prde.py,sha256=2BZmEDasdx_3l64-9hioArysDj6Nl520GpQN2xnEE_A,16360 +sympy/integrals/tests/test_quadrature.py,sha256=iFMdqck36gkL-yksLflawIOYmw-0PzO2tFj_qdK6Hjg,19919 +sympy/integrals/tests/test_rationaltools.py,sha256=7QiPnpBXl7lo32RmhXo7ED6FYj5I1gjEFOziJYlqPtI,5669 +sympy/integrals/tests/test_rde.py,sha256=4d3vJupa-hRN4yNDISY8IC3rSI_cZW5BbtxoZm14y-Y,9571 +sympy/integrals/tests/test_risch.py,sha256=HaWg0JnErdrNzNmVfyz2Zz4XAgZPVVpZPt6Map3sQ58,38630 +sympy/integrals/tests/test_singularityfunctions.py,sha256=CSrHie59_NjNZ9B2GaHzKPNsMzxm5Kh6GuxlYk8zTuI,1266 +sympy/integrals/tests/test_transforms.py,sha256=mLl5RfuENf11oenV1OXgg6TfWdQTEY23txiGl7grCyo,27152 +sympy/integrals/tests/test_trigonometry.py,sha256=moMYr_Prc7gaYPjBK0McLjRpTEes2veUlN0vGv9UyEA,3869 +sympy/integrals/transforms.py,sha256=_rwRkrOnV4zby27MZJ9dpJrtQFG4gTbL7naLpFLXKDo,51750 +sympy/integrals/trigonometry.py,sha256=iOoBDGFDZx8PNbgL3XeZEd80I8ro0WAizNuC4P-u8x0,11083 +sympy/interactive/__init__.py,sha256=yokwEO2HF3eN2Xu65JSpUUsN4iYmPvvU4m_64f3Q33o,251 +sympy/interactive/__pycache__/__init__.cpython-312.pyc,, +sympy/interactive/__pycache__/printing.cpython-312.pyc,, +sympy/interactive/__pycache__/session.cpython-312.pyc,, +sympy/interactive/__pycache__/traversal.cpython-312.pyc,, +sympy/interactive/printing.py,sha256=EZBO3YCga2dXBI1EfFHVDmUKBkF9UmrLMgwI76B0nyE,21562 +sympy/interactive/session.py,sha256=sG546e0mAtT0OrFkYNVM7QGvkWrDhAQZ5E1hfx03iBQ,15329 +sympy/interactive/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/interactive/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/interactive/tests/__pycache__/test_interactive.cpython-312.pyc,, +sympy/interactive/tests/__pycache__/test_ipython.cpython-312.pyc,, +sympy/interactive/tests/test_interactive.py,sha256=Pbopy9lODrd_P46_xxlWxLwqPfG6_4J3CWWC4IqfDL4,485 +sympy/interactive/tests/test_ipython.py,sha256=QZUvr77TxJHjdgQVNpihAuoglg1ghVHOTDFOVXJ9pcE,11797 +sympy/interactive/traversal.py,sha256=XbccdO6msNAvrG6FFJl2n4XmIiRISnvda4QflfEPg7U,3189 +sympy/liealgebras/__init__.py,sha256=K8tw7JqG33_y6mYl1LTr8ZNtKH5L21BqkjCHfLhP4aA,79 +sympy/liealgebras/__pycache__/__init__.cpython-312.pyc,, +sympy/liealgebras/__pycache__/cartan_matrix.cpython-312.pyc,, +sympy/liealgebras/__pycache__/cartan_type.cpython-312.pyc,, +sympy/liealgebras/__pycache__/dynkin_diagram.cpython-312.pyc,, +sympy/liealgebras/__pycache__/root_system.cpython-312.pyc,, +sympy/liealgebras/__pycache__/type_a.cpython-312.pyc,, +sympy/liealgebras/__pycache__/type_b.cpython-312.pyc,, +sympy/liealgebras/__pycache__/type_c.cpython-312.pyc,, +sympy/liealgebras/__pycache__/type_d.cpython-312.pyc,, +sympy/liealgebras/__pycache__/type_e.cpython-312.pyc,, +sympy/liealgebras/__pycache__/type_f.cpython-312.pyc,, +sympy/liealgebras/__pycache__/type_g.cpython-312.pyc,, +sympy/liealgebras/__pycache__/weyl_group.cpython-312.pyc,, +sympy/liealgebras/cartan_matrix.py,sha256=yr2LoZi_Gxmu-EMKgFuPOPNMYPOsxucLAS6oRpSYi2U,524 +sympy/liealgebras/cartan_type.py,sha256=xLklg8Y5s40je6sXwmLmG9iyYi9YEk9KoxTSFz1GtdI,1790 +sympy/liealgebras/dynkin_diagram.py,sha256=ZzGuBGNOJ3lPDdJDs4n8hvGbz6wLhC5mwb8zFkDmyPw,535 +sympy/liealgebras/root_system.py,sha256=n1TKAZyWDPSlUDmjAga9Sa2Cm9qeRXddYPbl2XKyFq4,6673 +sympy/liealgebras/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/liealgebras/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/liealgebras/tests/__pycache__/test_cartan_matrix.cpython-312.pyc,, +sympy/liealgebras/tests/__pycache__/test_cartan_type.cpython-312.pyc,, +sympy/liealgebras/tests/__pycache__/test_dynkin_diagram.cpython-312.pyc,, +sympy/liealgebras/tests/__pycache__/test_root_system.cpython-312.pyc,, +sympy/liealgebras/tests/__pycache__/test_type_A.cpython-312.pyc,, +sympy/liealgebras/tests/__pycache__/test_type_B.cpython-312.pyc,, +sympy/liealgebras/tests/__pycache__/test_type_C.cpython-312.pyc,, +sympy/liealgebras/tests/__pycache__/test_type_D.cpython-312.pyc,, +sympy/liealgebras/tests/__pycache__/test_type_E.cpython-312.pyc,, +sympy/liealgebras/tests/__pycache__/test_type_F.cpython-312.pyc,, +sympy/liealgebras/tests/__pycache__/test_type_G.cpython-312.pyc,, +sympy/liealgebras/tests/__pycache__/test_weyl_group.cpython-312.pyc,, +sympy/liealgebras/tests/test_cartan_matrix.py,sha256=KCsakn0fHKHRbIUcrUkHBIKkudl3_ISUdHrfJy-UOd4,303 +sympy/liealgebras/tests/test_cartan_type.py,sha256=t5PvYYDXbNIFL3CV59Je7SBIAeLLf-W3mOINPUoHK6E,339 +sympy/liealgebras/tests/test_dynkin_diagram.py,sha256=DSixbnt_yd0zrhKzXW_XqkXWXYe1Dk2MmXN-Rjb1dGg,260 +sympy/liealgebras/tests/test_root_system.py,sha256=YmGBdUeJ4PkLSfAfRgTF7GW62RCEd5nH27FSX9UaG5Q,927 +sympy/liealgebras/tests/test_type_A.py,sha256=x7QmpjxsGmXol-IYVtN1lmIOmM3HLYwpX1tSG5h6FMM,657 +sympy/liealgebras/tests/test_type_B.py,sha256=Gw0GP24wP2rPn38Wwla9W7BwWH4JtCGpaprZb5W6JVY,642 +sympy/liealgebras/tests/test_type_C.py,sha256=ysSy-vzE9lNwzAunrmvnFkLBoJwF7W2On7QpqS6RI1s,927 +sympy/liealgebras/tests/test_type_D.py,sha256=qrO4oCjrjkp1uDvrNtbgANVyaOExqOLNtIpIxD1uH0U,764 +sympy/liealgebras/tests/test_type_E.py,sha256=IQ46Bo75Kivz0O45mNKNvDO8jen7X2NwxVBTwvr5lQo,987 +sympy/liealgebras/tests/test_type_F.py,sha256=yUQJ7LzTemv4Cd1XW_dr3x7KEI07BahsWAyJfXLS1eA,1378 +sympy/liealgebras/tests/test_type_G.py,sha256=wVa6qcAHbdrc9dA63samexHL35cWWJS606pom-6mH2Q,548 +sympy/liealgebras/tests/test_weyl_group.py,sha256=HrzojRECbhNUsdLFQAXYnJEt8LfktOSJZuqVE45aRnc,1501 +sympy/liealgebras/type_a.py,sha256=Etn_aeyE5FdYrUXrGnjNiTL5k4r5-O_CysaO-_UKASA,4294 +sympy/liealgebras/type_b.py,sha256=ERH1aM38eHZUuTJYRsWLKFDm74G4y1MQtweSfkDFQYc,4547 +sympy/liealgebras/type_c.py,sha256=Al1pA5cw5IKjvBzx9LdMORd5-JZXgA0kaMv8aHhnYJ0,4426 +sympy/liealgebras/type_d.py,sha256=Cagn4GXrYuUP32W6jauIPnEv8IcD3H88sbn0fKS7pmU,4681 +sympy/liealgebras/type_e.py,sha256=KR84bp4Ga7d9itKRCsD3AYrarVewGiNNe7AHWNUfTAM,8280 +sympy/liealgebras/type_f.py,sha256=gIyk4zA04uIpwizcYdvKsZ_xkcpPLId6LIHR6tp38dk,4423 +sympy/liealgebras/type_g.py,sha256=Ife98dGPtarGd-ii8hJbXdB0SMsct4okDkSX2wLN8XI,2965 +sympy/liealgebras/weyl_group.py,sha256=5YFA8qC4GWDM0WLNR_6VgpuNFZDfyDA7fBFjBcZaLgA,14557 +sympy/logic/__init__.py,sha256=RfoXrq9MESnXdL7PkwpYEfWeaxH6wBPHiE4zCgLKvk0,456 +sympy/logic/__pycache__/__init__.cpython-312.pyc,, +sympy/logic/__pycache__/boolalg.cpython-312.pyc,, +sympy/logic/__pycache__/inference.cpython-312.pyc,, +sympy/logic/algorithms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/logic/algorithms/__pycache__/__init__.cpython-312.pyc,, +sympy/logic/algorithms/__pycache__/dpll.cpython-312.pyc,, +sympy/logic/algorithms/__pycache__/dpll2.cpython-312.pyc,, +sympy/logic/algorithms/__pycache__/lra_theory.cpython-312.pyc,, +sympy/logic/algorithms/__pycache__/minisat22_wrapper.cpython-312.pyc,, +sympy/logic/algorithms/__pycache__/pycosat_wrapper.cpython-312.pyc,, +sympy/logic/algorithms/__pycache__/z3_wrapper.cpython-312.pyc,, +sympy/logic/algorithms/dpll.py,sha256=zqiZDm1oD5sNxFqm_0Hen6NjfILIDp5uRgEOad1vYXI,9188 +sympy/logic/algorithms/dpll2.py,sha256=PEVvFUrEf-IwTwfnTYtAFLPLPjjqA1nmm39nASgsM1I,21497 +sympy/logic/algorithms/lra_theory.py,sha256=6JZAZMJhhHSbUXZuc0ddYwp_x7efVuthIYV7Dc9eUyc,31769 +sympy/logic/algorithms/minisat22_wrapper.py,sha256=uINcvkIHGWYJb8u-Q0OgnSgaHfVUd9tYYFbBAVNiASo,1317 +sympy/logic/algorithms/pycosat_wrapper.py,sha256=0vNFTbu9-YhSfjwYTsZsP_Z4HM8WpL11-xujLBS1kYg,1207 +sympy/logic/algorithms/z3_wrapper.py,sha256=mFmf7DWDV0Zu7006EdFK4qEDTP7sfmcXrfGZkMK97vo,3747 +sympy/logic/boolalg.py,sha256=GqxLtqUangGoSjsncKDzlLEE7iYVe5qsMtPhztniI9c,114972 +sympy/logic/inference.py,sha256=J2D8t9iHCSdotzS9iq6g3EvLPsI2B10kiNbmHsIz_oY,8983 +sympy/logic/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/logic/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/logic/tests/__pycache__/test_boolalg.cpython-312.pyc,, +sympy/logic/tests/__pycache__/test_dimacs.cpython-312.pyc,, +sympy/logic/tests/__pycache__/test_inference.cpython-312.pyc,, +sympy/logic/tests/__pycache__/test_lra_theory.cpython-312.pyc,, +sympy/logic/tests/test_boolalg.py,sha256=0ZjG56WpIhIwFLedUzg5IC-c0VF_g9qoU9aAbFydPYU,49748 +sympy/logic/tests/test_dimacs.py,sha256=EK_mA_k9zBLcQLTOKTZVrGhnGuQNza5mwXDQD_f-X1c,3886 +sympy/logic/tests/test_inference.py,sha256=9BXfPbJs6sBEgx1nwkmg2HcLl82lcfFXngKJL_ByzUI,16116 +sympy/logic/tests/test_lra_theory.py,sha256=hNCH66hP_32x5ioyqM6ltd0DbEl72kdctCBu-H6egG0,16834 +sympy/logic/utilities/__init__.py,sha256=WTn2vBgHcmhONRWI79PdMYNk8UxYDzsxRlZWuc-wtNI,55 +sympy/logic/utilities/__pycache__/__init__.cpython-312.pyc,, +sympy/logic/utilities/__pycache__/dimacs.cpython-312.pyc,, +sympy/logic/utilities/dimacs.py,sha256=gfrGWQpn4F7gLJH1zHAnLB8-CMGa1XtXl9NCGhwAW9k,1671 +sympy/matrices/__init__.py,sha256=i2a37WlcCj8-AKG_Yy8BBdOHFgAuWois_2IcD_Ih00s,2634 +sympy/matrices/__pycache__/__init__.cpython-312.pyc,, +sympy/matrices/__pycache__/common.cpython-312.pyc,, +sympy/matrices/__pycache__/decompositions.cpython-312.pyc,, +sympy/matrices/__pycache__/dense.cpython-312.pyc,, +sympy/matrices/__pycache__/determinant.cpython-312.pyc,, +sympy/matrices/__pycache__/eigen.cpython-312.pyc,, +sympy/matrices/__pycache__/exceptions.cpython-312.pyc,, +sympy/matrices/__pycache__/graph.cpython-312.pyc,, +sympy/matrices/__pycache__/immutable.cpython-312.pyc,, +sympy/matrices/__pycache__/inverse.cpython-312.pyc,, +sympy/matrices/__pycache__/kind.cpython-312.pyc,, +sympy/matrices/__pycache__/matrices.cpython-312.pyc,, +sympy/matrices/__pycache__/matrixbase.cpython-312.pyc,, +sympy/matrices/__pycache__/normalforms.cpython-312.pyc,, +sympy/matrices/__pycache__/reductions.cpython-312.pyc,, +sympy/matrices/__pycache__/repmatrix.cpython-312.pyc,, +sympy/matrices/__pycache__/solvers.cpython-312.pyc,, +sympy/matrices/__pycache__/sparse.cpython-312.pyc,, +sympy/matrices/__pycache__/sparsetools.cpython-312.pyc,, +sympy/matrices/__pycache__/subspaces.cpython-312.pyc,, +sympy/matrices/__pycache__/utilities.cpython-312.pyc,, +sympy/matrices/benchmarks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/matrices/benchmarks/__pycache__/__init__.cpython-312.pyc,, +sympy/matrices/benchmarks/__pycache__/bench_matrix.cpython-312.pyc,, +sympy/matrices/benchmarks/bench_matrix.py,sha256=vGMlg-2il2cFeAWrf0NJ6pzPX3Yd3ZQMxFgQ4q5ILQE,306 +sympy/matrices/common.py,sha256=v_jMjH9t6mrHl7Z5QluhO-G07QUaJSdiioF2YC1xlhY,95395 +sympy/matrices/decompositions.py,sha256=5OjwFe5Z_eM2XoZPqrNFY9-Esq3cO_8yqFxT9QBPHgQ,47865 +sympy/matrices/dense.py,sha256=HTPNMKbi2M0W0nHImNtHib9JM5VC8si99ldL_FylKwQ,30461 +sympy/matrices/determinant.py,sha256=pDTDYCLBSWJov_j_B-ZZHdqH3-WQ_uwhZawrX3EDE9k,34550 +sympy/matrices/eigen.py,sha256=v09mqb2hZ0HqGbGzYpELOatIHnGTP5XADE-1RGcua-g,39811 +sympy/matrices/exceptions.py,sha256=8diN_ojMGC93XpqvZeS5ow4crlFxSkm6WqtnIK5j81E,503 +sympy/matrices/expressions/__init__.py,sha256=IMqXCSsPh0Vp_MC9HZTudA5DGM4WBq_yB-Bst0azyM8,1692 +sympy/matrices/expressions/__pycache__/__init__.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/_shape.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/adjoint.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/applyfunc.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/blockmatrix.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/companion.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/determinant.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/diagonal.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/dotproduct.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/factorizations.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/fourier.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/funcmatrix.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/hadamard.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/inverse.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/kronecker.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/matadd.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/matexpr.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/matmul.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/matpow.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/permutation.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/sets.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/slice.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/special.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/trace.cpython-312.pyc,, +sympy/matrices/expressions/__pycache__/transpose.cpython-312.pyc,, +sympy/matrices/expressions/_shape.py,sha256=TyQSwGx41aaMyAYs5Q7Er6atKVAdWK7DJ6YIVsiEAZg,3062 +sympy/matrices/expressions/adjoint.py,sha256=HV4OIWgmS2f_1_4PHRhQpgNmKJVCoX0eyHmrM6gfN5g,1515 +sympy/matrices/expressions/applyfunc.py,sha256=8scpWjZp7yzuvUNr0mxN03KgyTzLRa5NkGl9s81YPgY,6751 +sympy/matrices/expressions/blockmatrix.py,sha256=TPR1ZDTSzVGtT-Qo23XNzjnDVl1Js8NCi_2qV3fQA9U,31643 +sympy/matrices/expressions/companion.py,sha256=lXUJRbjQR6e1mdHQdJwNIJXMW80XmKbOVqNvUXjB57U,1705 +sympy/matrices/expressions/determinant.py,sha256=RyQXgUgqJkv_rvUPrn1_rOY45wzp5zYH6ZOf9S8NK8s,3281 +sympy/matrices/expressions/diagonal.py,sha256=XHWoT-Jv5QwJVsGNbfxHnNG2sygPy1CeR_t6zr8oUoM,6328 +sympy/matrices/expressions/dotproduct.py,sha256=sKdUhwVKTB3LEvd8xMwCDexNoQ1Dz43DCYsmm3UwFWw,1911 +sympy/matrices/expressions/factorizations.py,sha256=zFNjMBsJqhsIcDD8Me4W8-Q-TV89WptfG3Dd9yK_tPE,1456 +sympy/matrices/expressions/fourier.py,sha256=dvaftgB9jgkR_8ETyhzyVLtf1ZJu_wQC-ZbpTYMXZGE,2094 +sympy/matrices/expressions/funcmatrix.py,sha256=q6R75wLn0UdV4xJdVJUrNaofV1k1egXLLQdBeZcPtiY,3520 +sympy/matrices/expressions/hadamard.py,sha256=feXSZy0vbqxTzg0JeLmkSegiF4T2v5dOdcv0UQczK38,13920 +sympy/matrices/expressions/inverse.py,sha256=4UwgHWSIHgEoKOniObkClMYN9DrO2xNyvOSVToXSpj8,2963 +sympy/matrices/expressions/kronecker.py,sha256=kzCHqXDtcZGVQPln521lfN5redNwj6IjXJwjbv_Dkhg,13404 +sympy/matrices/expressions/matadd.py,sha256=0MSanal1HKVEuCBEpehKwfUX4fuM9UMy6Fg2H5noA0s,4773 +sympy/matrices/expressions/matexpr.py,sha256=nfV9MhDNBR9HkOP7zoXOtv9wWR4OFxNczprik4S3Uh8,27549 +sympy/matrices/expressions/matmul.py,sha256=n9LcrgYoEhEQuq2htALHuboIWN0p8P_3lZdKNo92Rf0,15509 +sympy/matrices/expressions/matpow.py,sha256=puuYB49wr1WzFxhT9DcTWtF2bGDFWcbJ7oh14ATQARs,5140 +sympy/matrices/expressions/permutation.py,sha256=Xe7yOx-EgeD6JrqWc4L-ApdN-3ZiV8XS_LQPmc1lhGw,8050 +sympy/matrices/expressions/sets.py,sha256=3zase_rDn2QdaXETX78BgkfKiWcRC7FmwVjjIU-WmdY,2033 +sympy/matrices/expressions/slice.py,sha256=aNdY1Ey4VJR-UCvoORX2kh2DmA6QjOp-waENvWg8WVE,3355 +sympy/matrices/expressions/special.py,sha256=hywkygOQjcJEGQn2fG4dF8oUqXL3N42U1TxbdJr4-6E,7499 +sympy/matrices/expressions/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/matrices/expressions/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_adjoint.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_applyfunc.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_blockmatrix.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_companion.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_derivatives.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_determinant.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_diagonal.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_dotproduct.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_factorizations.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_fourier.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_funcmatrix.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_hadamard.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_indexing.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_inverse.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_kronecker.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_matadd.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_matexpr.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_matmul.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_matpow.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_permutation.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_sets.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_slice.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_special.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_trace.cpython-312.pyc,, +sympy/matrices/expressions/tests/__pycache__/test_transpose.cpython-312.pyc,, +sympy/matrices/expressions/tests/test_adjoint.py,sha256=cxOc334yNSI9MazhG9HT8s1OCXjkDWr3Zj2JnyHS3Z4,1065 +sympy/matrices/expressions/tests/test_applyfunc.py,sha256=mxTJaoB4Ze50lk-2TgVopmrrbuQbEqUsZwc3K1H8w-Q,3522 +sympy/matrices/expressions/tests/test_blockmatrix.py,sha256=ANNR7e2eiGIvabMNezxRVzipmA8oUwmDTrBTz5ALMzU,16541 +sympy/matrices/expressions/tests/test_companion.py,sha256=Lam6r-cSOokjhSlJws55Kq-gL5_pHfeV_Xuvmn5PkRU,1657 +sympy/matrices/expressions/tests/test_derivatives.py,sha256=9mBeaAZDX7-JbYs6tMClNuGDygETVN_dCXSlHmyAhwg,15991 +sympy/matrices/expressions/tests/test_determinant.py,sha256=JSgptLz9KNC4_X27qnuFq-rscgHk6144s5TEUQpLxr0,2067 +sympy/matrices/expressions/tests/test_diagonal.py,sha256=3L6Vs_Yr36a8dgIqAeIcNEf0xcVyeyGhANNu0dlIpwI,4516 +sympy/matrices/expressions/tests/test_dotproduct.py,sha256=Zkv2N6oRPm0-sN4PFwsVFrM5Y_qv4x2gWqQQQD86hBY,1171 +sympy/matrices/expressions/tests/test_factorizations.py,sha256=6UPA_UhCL5JPbaQCOatMnxhGnQ-aIHmb3lXqbwrSoIE,786 +sympy/matrices/expressions/tests/test_fourier.py,sha256=0eD69faoHXBcuQ7g2Q31fqs-gyR_Xfe-gv-7DXhJh_c,1638 +sympy/matrices/expressions/tests/test_funcmatrix.py,sha256=uN9r0ECMIBqsIzOezg_n9uDYNs6ebYS8Yf5yexUjmAM,2230 +sympy/matrices/expressions/tests/test_hadamard.py,sha256=rR0l1howrI8SaJOnLb0fsCXS5cIx1rzahwFTfGldp3Y,4614 +sympy/matrices/expressions/tests/test_indexing.py,sha256=wwYQa7LNlzhBA5fU50gPyE8cqaJf0s3O70PUx4eNCEA,12038 +sympy/matrices/expressions/tests/test_inverse.py,sha256=n4gwv-GH0LPXZDVgzEB0lA_fk8MmNFK_BVNJb0FEUfY,2320 +sympy/matrices/expressions/tests/test_kronecker.py,sha256=e5H6av3ioOn8jkjyDBrT3NEmCkyHbN6ZEHOlyB9OYLk,5366 +sympy/matrices/expressions/tests/test_matadd.py,sha256=U1fL5YLP_cYEOsdi2uaGGrzm8qOsKcXn69BC1UV6RMM,1866 +sympy/matrices/expressions/tests/test_matexpr.py,sha256=pQkxhi8okFDbF6Uea-dbeRrjNfmlc6nzJdIXOJxAqUI,18441 +sympy/matrices/expressions/tests/test_matmul.py,sha256=2ofS4YHHIcI9DamZNU-8RhBQTnNogqGknKxqkyKXO8U,6187 +sympy/matrices/expressions/tests/test_matpow.py,sha256=dRbwvZ3vxwnqw09lnRqOu475f46xDPNo7V3oc1d_P2U,7308 +sympy/matrices/expressions/tests/test_permutation.py,sha256=93Cqjj2k3aoR3ayMJLdJUa5h1u87bRRxT3I8B4FQsvU,5607 +sympy/matrices/expressions/tests/test_sets.py,sha256=DfFGe6W1ppUs6bgo3vB3DSJvFemrT68s0F3QbyoIJiE,1408 +sympy/matrices/expressions/tests/test_slice.py,sha256=C7OGAQQTz0YZxZCa7g0m8_0Bqq8jaPRa22JHVSqK7tY,2027 +sympy/matrices/expressions/tests/test_special.py,sha256=Mhg71vnjjb4fm0jZgjDoWW8rAJMBeh8aDCM75gjEpKQ,6496 +sympy/matrices/expressions/tests/test_trace.py,sha256=fRlrw9CfdO3z3SI4TQb1fCUb_zVAndbtyOErEeCTCQ0,3383 +sympy/matrices/expressions/tests/test_transpose.py,sha256=P3wPPRywKnrAppX6gssgD66v0RIcolxqDkCaKGGPVcM,1987 +sympy/matrices/expressions/trace.py,sha256=skr53LvstLV5Yg9hkaRb0yWrTdxC9u95G-YzIc80aTs,5362 +sympy/matrices/expressions/transpose.py,sha256=QGQ1bgqvYmRNs6QiVolhtFlbluPYpwW3UNvkRZUqUHU,2645 +sympy/matrices/graph.py,sha256=4UBv9SI5Z8Xjc5jPJVOoPVGQDtfbyOmS8f0ENrPOuU8,9080 +sympy/matrices/immutable.py,sha256=okpJZ41FnaHp1PpwnPNCnB_o3afAU7DgRsr2NqBKtvg,5530 +sympy/matrices/inverse.py,sha256=aVjDn_SjZUfi-jdM_1uJ6u6lVItuvbnb3CppayHQ-Gs,13166 +sympy/matrices/kind.py,sha256=EJxDdD4gFgvVfC3lRex-bczhcGjwBhglf1hPDk2WzXE,2843 +sympy/matrices/matrices.py,sha256=iqgi7x7cjnLT6OuRp6TYjoObJtUtbcPpeGTOC-Enh9Q,23536 +sympy/matrices/matrixbase.py,sha256=snpv-ZBFi-CRtfMwY9lukSTPpELVXmJF16Gn8xPV3yI,165154 +sympy/matrices/normalforms.py,sha256=mX19wvJqQAirRiPY-WdSfEdljFOhst18LcDX4MvPM8A,4636 +sympy/matrices/reductions.py,sha256=MZ8LtryawSm1jXsWzRPsYBmir867lRUWX4LFNGVIHwI,12500 +sympy/matrices/repmatrix.py,sha256=d2vne9qNn1cu7dQbCdkftMPadA87evGMaoE7LkxaYXE,29914 +sympy/matrices/solvers.py,sha256=kWkUdy0XoWbn7RY4S1N0qNgxKAcUrHiTlicb25rR9z4,25163 +sympy/matrices/sparse.py,sha256=ER4tfnpvAMeockzWi10mKdKZJSYJNPISyoUL_m29UJ8,14673 +sympy/matrices/sparsetools.py,sha256=tzI541P8QW_v1eVJAXgOlo_KK1Xp6u1geawX_tdlBxY,9182 +sympy/matrices/subspaces.py,sha256=uLo4qnP0xvFcFo5hhf6g7pHSHiRbcQ1ATDKwGBxW7CE,3761 +sympy/matrices/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/matrices/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_commonmatrix.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_decompositions.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_determinant.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_domains.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_eigen.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_graph.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_immutable.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_interactions.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_matrices.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_matrixbase.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_normalforms.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_reductions.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_repmatrix.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_solvers.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_sparse.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_sparsetools.cpython-312.pyc,, +sympy/matrices/tests/__pycache__/test_subspaces.cpython-312.pyc,, +sympy/matrices/tests/test_commonmatrix.py,sha256=CEYYa5frGDGPAVz78uYVTBC3IHoQLG18VRnq289XtBQ,40772 +sympy/matrices/tests/test_decompositions.py,sha256=LTm3KjUHh0QkGmR8UA1CwGWzpFu8o-qcl4sv2VKBi8g,14419 +sympy/matrices/tests/test_determinant.py,sha256=FxbLYbiO1wj12YYfsbQPoEOcgWpRGVu1CzVKLx4e8oQ,9560 +sympy/matrices/tests/test_domains.py,sha256=gUnMLr_LeEsN5unFjIwHCZje0URC9uVBN_Q76JbX9f4,3276 +sympy/matrices/tests/test_eigen.py,sha256=Xm-Xe7qGACLpqwOx5W2mDjve2KyJf-q8PyEi40jMgAk,22722 +sympy/matrices/tests/test_graph.py,sha256=ckfGDCg2M6gluv9XFnfURga8gxd2HTL7aX281s6wy6c,3213 +sympy/matrices/tests/test_immutable.py,sha256=JSu6YlGtPP-5iialCeatCKbZ4ScLDUzhQ-TMGhsalp8,4616 +sympy/matrices/tests/test_interactions.py,sha256=6T6wkHyTW5v2fwg0rz2HULoDElfA_NttApU2t-pZFKI,2070 +sympy/matrices/tests/test_matrices.py,sha256=YrwrczVsTuLoPAAkh4dlZYbfUcVEUe88wyM53fmUOtw,163196 +sympy/matrices/tests/test_matrixbase.py,sha256=2EUoz0Dl3hPFNvWU--ls6RPGfllZJbVvZSsDA9D6jPo,168868 +sympy/matrices/tests/test_normalforms.py,sha256=leFZ2rJGrWKv8Zz8aMaHQiNrCEQWOG1RqQ87omvlqIk,3730 +sympy/matrices/tests/test_reductions.py,sha256=tKv_KufpVc6qwH-MDz8XLpgVS4z6snnlNdd1ECAQSXM,13385 +sympy/matrices/tests/test_repmatrix.py,sha256=enu29IYEPzvKvGFeN6Bi9KYKqcXdy0EucifN9fV420Q,2084 +sympy/matrices/tests/test_solvers.py,sha256=55Zmvp2KC6OpdXFHBkXZRBRls_8wHfYNWO2UOQh9AoE,22311 +sympy/matrices/tests/test_sparse.py,sha256=GvXN6kBVldjqoR8WN8I_PjblKhRmyRWvVuLUgZEgugY,23281 +sympy/matrices/tests/test_sparsetools.py,sha256=pjQR6UaEMR92NolB_IGZ9Umk6FPZjvI0vk1Fd4H_C5I,4877 +sympy/matrices/tests/test_subspaces.py,sha256=poY6k6l2LSL7OCixQNGzrauLZIYbrjDul7J-yEE02S8,3465 +sympy/matrices/utilities.py,sha256=mMnNsDTxGKqiG0JATsM4W9b5jglhacy-vmRw2aZojgY,2117 +sympy/multipledispatch/__init__.py,sha256=aV2NC2cO_KmD6QFiwy4oC1D8fm3pFuPbaiTMeWmNWak,259 +sympy/multipledispatch/__pycache__/__init__.cpython-312.pyc,, +sympy/multipledispatch/__pycache__/conflict.cpython-312.pyc,, +sympy/multipledispatch/__pycache__/core.cpython-312.pyc,, +sympy/multipledispatch/__pycache__/dispatcher.cpython-312.pyc,, +sympy/multipledispatch/__pycache__/utils.cpython-312.pyc,, +sympy/multipledispatch/conflict.py,sha256=rR6tKn58MfhMMKZ4ZrhVduylXd9f5PjT2TpzM9LMB6o,2117 +sympy/multipledispatch/core.py,sha256=I4WOnmu1VtlaCnn2oD9R2-xckkYLRZPNFEWtCOTAYfM,2261 +sympy/multipledispatch/dispatcher.py,sha256=A2I4upt4qNollXGpwzrqg7M0oKHJhZx1BUMIBnjRIow,12226 +sympy/multipledispatch/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/multipledispatch/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/multipledispatch/tests/__pycache__/test_conflict.cpython-312.pyc,, +sympy/multipledispatch/tests/__pycache__/test_core.cpython-312.pyc,, +sympy/multipledispatch/tests/__pycache__/test_dispatcher.cpython-312.pyc,, +sympy/multipledispatch/tests/test_conflict.py,sha256=msNVSiikuPOqsEm_MMGmjsNbA2CAR0F1FZaHskzzo04,1786 +sympy/multipledispatch/tests/test_core.py,sha256=UfH_7cyvZ6PHjdH8vmLG49CG7E30W8uxm3FthuMc1Jk,4048 +sympy/multipledispatch/tests/test_dispatcher.py,sha256=saJPpGXLpLOuRfw-ekzZGzY-Rys0NsS5ke0n33i9j0U,6228 +sympy/multipledispatch/utils.py,sha256=39wB9i8jNhlLFZyCTFnioLx5N_CNWv4r5VZwKrxswIE,3097 +sympy/ntheory/__init__.py,sha256=WpYPsusKb9OQ1xmXxZFla7kXacIWv4lNIpFIEVVzTLA,2810 +sympy/ntheory/__pycache__/__init__.cpython-312.pyc,, +sympy/ntheory/__pycache__/bbp_pi.cpython-312.pyc,, +sympy/ntheory/__pycache__/continued_fraction.cpython-312.pyc,, +sympy/ntheory/__pycache__/digits.cpython-312.pyc,, +sympy/ntheory/__pycache__/ecm.cpython-312.pyc,, +sympy/ntheory/__pycache__/egyptian_fraction.cpython-312.pyc,, +sympy/ntheory/__pycache__/elliptic_curve.cpython-312.pyc,, +sympy/ntheory/__pycache__/factor_.cpython-312.pyc,, +sympy/ntheory/__pycache__/generate.cpython-312.pyc,, +sympy/ntheory/__pycache__/modular.cpython-312.pyc,, +sympy/ntheory/__pycache__/multinomial.cpython-312.pyc,, +sympy/ntheory/__pycache__/partitions_.cpython-312.pyc,, +sympy/ntheory/__pycache__/primetest.cpython-312.pyc,, +sympy/ntheory/__pycache__/qs.cpython-312.pyc,, +sympy/ntheory/__pycache__/residue_ntheory.cpython-312.pyc,, +sympy/ntheory/bbp_pi.py,sha256=ILur1c9Ja-1F_blgnInUx-WopQ_WSvK-2OvNLEe2Zx8,5998 +sympy/ntheory/continued_fraction.py,sha256=bQW7PvdgDtWnbpCmkOwyz3mNYPOXh9_ehq3_ZpJO8Rw,10717 +sympy/ntheory/digits.py,sha256=ea3xSLy8RMaMHsekg8nq2gnVTug7SOvaDjw0lmB6NMU,3831 +sympy/ntheory/ecm.py,sha256=zg_GhL0XSyG5ZVSdGv3YceCguPZrFaS-hC-vXqOVOGQ,11793 +sympy/ntheory/egyptian_fraction.py,sha256=hW886hPWJtARqgZIrH1WjZFC0uvf9CHxMIn0X9MWZro,6923 +sympy/ntheory/elliptic_curve.py,sha256=ZT677EHi26BkZdRTLs1Tf4VSyMxDzJrwk1xECoMT7Qg,11544 +sympy/ntheory/factor_.py,sha256=MQQJSnjSpz-B9ex9fqMCnrrNTfqFOlhJV9RAWy3gJTw,83551 +sympy/ntheory/generate.py,sha256=B6LVkK627xWzQ1UE5XoeMxNM7Q1O8EwcP7fwKs5vkZk,33376 +sympy/ntheory/modular.py,sha256=wYNfNr5S8DqipQNBLVMR7cPUNg7twM25xcLhXBD14I4,8474 +sympy/ntheory/multinomial.py,sha256=rbm3STjgfRbNVbcPeH69qtWktthSCk0sC373NuDM6fU,5073 +sympy/ntheory/partitions_.py,sha256=S81zrWeTVHmYAphcP6yUGLz5CrlUwW_JFtkQRoeLlV4,8995 +sympy/ntheory/primetest.py,sha256=9EVL1yeBkOHDfa2phHiDwUnmidSJJrTl6Wzo0y1Sck0,25423 +sympy/ntheory/qs.py,sha256=8ZKxvqc-oGPqZNbEH-XcPsjXLy5-5aygVB5rR1BkSO8,14938 +sympy/ntheory/residue_ntheory.py,sha256=dDBaogSqroJHlyXRqnLmuzNVyXfy4rWB_hlhOCNQHpk,54359 +sympy/ntheory/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/ntheory/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_bbp_pi.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_continued_fraction.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_digits.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_ecm.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_egyptian_fraction.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_elliptic_curve.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_factor_.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_generate.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_hypothesis.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_modular.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_multinomial.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_partitions.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_primetest.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_qs.cpython-312.pyc,, +sympy/ntheory/tests/__pycache__/test_residue.cpython-312.pyc,, +sympy/ntheory/tests/test_bbp_pi.py,sha256=TgNpZOtKAfU-IVzO62Ko7Oy3LLNfdzEo9gWMTTDZL6c,9486 +sympy/ntheory/tests/test_continued_fraction.py,sha256=JJsyEXatgjNxYZTKkKubvymyVs0WDpLfbEiAY5SYk8g,3583 +sympy/ntheory/tests/test_digits.py,sha256=mrTfwboMCQkiOEpMgYg8Nrk12WE5pEtpmbQthRVt4Xc,1968 +sympy/ntheory/tests/test_ecm.py,sha256=yco77gknWe6co4VKTCoRNKHzd3jdqGKQWQFwuziYNWI,2290 +sympy/ntheory/tests/test_egyptian_fraction.py,sha256=tpHcwteuuQAahcPqvgBm4Mwq-efzcHOn8mldijynjlE,2378 +sympy/ntheory/tests/test_elliptic_curve.py,sha256=wc0EOsGo-qGpdevRq1o64htwTOT_YSUzUfyhJC-JVbg,624 +sympy/ntheory/tests/test_factor_.py,sha256=Z4B33C0blhcG9KuQzmJcDw7TtrTYJ6jAsWQd8Oi3YZw,26382 +sympy/ntheory/tests/test_generate.py,sha256=lhnJPjlz1TYrDHJ4Jq0F64P4KV8C7ngKmm3Jxtz7Wsk,9868 +sympy/ntheory/tests/test_hypothesis.py,sha256=Ztg-QoiBxpUp6euPy1RcPbF6yaLK_ij-Jcl637GGhNY,728 +sympy/ntheory/tests/test_modular.py,sha256=g73sUXtYNxzbDcq5UnMWT8NodAU8unwRj_E-PpvJqDs,1425 +sympy/ntheory/tests/test_multinomial.py,sha256=8uuj6XlatNyIILOpjJap13CMZmDwrCyGKn9LiIUiLV0,2344 +sympy/ntheory/tests/test_partitions.py,sha256=qkd-84AO0rpJv-MQW0lnXtIPtGTAfplFbu2ezKSfEQI,1088 +sympy/ntheory/tests/test_primetest.py,sha256=Lp4elAnnBDYSIPfVXENOUjZYuwAynsNQrE_CEiYDErU,9495 +sympy/ntheory/tests/test_qs.py,sha256=zbwQ1k5ywsUVNZzPewWul_yUnoqWxxvsSWOBAU5Albc,3956 +sympy/ntheory/tests/test_residue.py,sha256=7VGXsslZWVd3R7tAtIcLjYyh0TjZpb5BtG2GQehlAUY,16809 +sympy/parsing/__init__.py,sha256=KHuyDeHY1ifpVxT4aTOhomazCBYVIrKWd28jqp6YNJ8,125 +sympy/parsing/__pycache__/__init__.cpython-312.pyc,, +sympy/parsing/__pycache__/ast_parser.cpython-312.pyc,, +sympy/parsing/__pycache__/mathematica.cpython-312.pyc,, +sympy/parsing/__pycache__/maxima.cpython-312.pyc,, +sympy/parsing/__pycache__/sym_expr.cpython-312.pyc,, +sympy/parsing/__pycache__/sympy_parser.cpython-312.pyc,, +sympy/parsing/ast_parser.py,sha256=iJvr6bhm1RjM5rhWzZA4c4LGTH5lAFazN5zu8y8q-aY,2734 +sympy/parsing/autolev/Autolev.g4,sha256=980mo25mLWrQFmhRIg-aqIalUuwktYYaBGTXZ5_XZwA,4195 +sympy/parsing/autolev/__init__.py,sha256=sp5hzv5siVW3xUmhkp0S0iaA0Cz-PVB0HO1zC04pxYs,3611 +sympy/parsing/autolev/__pycache__/__init__.cpython-312.pyc,, +sympy/parsing/autolev/__pycache__/_build_autolev_antlr.cpython-312.pyc,, +sympy/parsing/autolev/__pycache__/_listener_autolev_antlr.cpython-312.pyc,, +sympy/parsing/autolev/__pycache__/_parse_autolev_antlr.cpython-312.pyc,, +sympy/parsing/autolev/_antlr/__init__.py,sha256=MQ4ZacpTuP-NmruFXKdWLQatoeVJQ8SaBQ2DnYvtyE8,203 +sympy/parsing/autolev/_antlr/__pycache__/__init__.cpython-312.pyc,, +sympy/parsing/autolev/_antlr/__pycache__/autolevlexer.cpython-312.pyc,, +sympy/parsing/autolev/_antlr/__pycache__/autolevlistener.cpython-312.pyc,, +sympy/parsing/autolev/_antlr/__pycache__/autolevparser.cpython-312.pyc,, +sympy/parsing/autolev/_antlr/autolevlexer.py,sha256=K7HF_-5dUyAIv1_7GkhTmxqSCanEhCpzJG8fayAEB3Q,13609 +sympy/parsing/autolev/_antlr/autolevlistener.py,sha256=EDb3XkH9Y7CLzxGM-tY-nGqxMGfBHVkqKdVCPxABgRE,12821 +sympy/parsing/autolev/_antlr/autolevparser.py,sha256=BZYJ7IkurRmm44S50pYp_9JHCjT8fr1w5HeksAEPjtg,106291 +sympy/parsing/autolev/_build_autolev_antlr.py,sha256=0oIrC3sWUDe18zydeNyRmQrGGwPtRYQzIul8YcmMpk4,2578 +sympy/parsing/autolev/_listener_autolev_antlr.py,sha256=jv1jYvmrGmom6F3fhYTHG1sqLK6FFCO1-jrvDW-nPEM,104760 +sympy/parsing/autolev/_parse_autolev_antlr.py,sha256=b9hIaluJUd1V2XIAp1erak6U-c-CwKyDLH1UkYQuvKE,1736 +sympy/parsing/autolev/test-examples/README.txt,sha256=0C4m_nLROeV5J8nMfm3RYEfYgQJqmlHZaCpVD24boQY,528 +sympy/parsing/autolev/test-examples/__pycache__/ruletest1.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/__pycache__/ruletest10.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/__pycache__/ruletest11.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/__pycache__/ruletest12.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/__pycache__/ruletest2.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/__pycache__/ruletest3.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/__pycache__/ruletest4.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/__pycache__/ruletest5.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/__pycache__/ruletest6.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/__pycache__/ruletest7.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/__pycache__/ruletest8.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/__pycache__/ruletest9.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/pydy-example-repo/__pycache__/chaos_pendulum.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/pydy-example-repo/__pycache__/double_pendulum.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/pydy-example-repo/__pycache__/mass_spring_damper.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/pydy-example-repo/__pycache__/non_min_pendulum.cpython-312.pyc,, +sympy/parsing/autolev/test-examples/pydy-example-repo/chaos_pendulum.al,sha256=HpTcX2wXzLqmgpp8fcSqNweKjxljk43iYK0wQmBbCDI,690 +sympy/parsing/autolev/test-examples/pydy-example-repo/chaos_pendulum.py,sha256=FSu4TP2BDTQjzYhMkcpRhXbb3kAD27XCyO_EoL55Ack,2274 +sympy/parsing/autolev/test-examples/pydy-example-repo/double_pendulum.al,sha256=wjeeRdCS3Es6ldX9Ug5Du1uaijUTyoXpfTqmhL0uYfk,427 +sympy/parsing/autolev/test-examples/pydy-example-repo/double_pendulum.py,sha256=uU9azTUGrY15BSDtw5T_V-7gmjyhHbXslzkmwBvFjGk,1583 +sympy/parsing/autolev/test-examples/pydy-example-repo/mass_spring_damper.al,sha256=Gf7OhgRlwqUEXq7rkfbf89yWA23u4uIUJ-buXTyOuXM,505 +sympy/parsing/autolev/test-examples/pydy-example-repo/mass_spring_damper.py,sha256=9ReCAqcUH5HYBgHmop9h5Zx54mfScWZN5L5F6rCHk4w,1366 +sympy/parsing/autolev/test-examples/pydy-example-repo/non_min_pendulum.al,sha256=p5v40h1nVFrWNqnB0K7GiNQT0b-MqwayYjZxXOY4M8M,362 +sympy/parsing/autolev/test-examples/pydy-example-repo/non_min_pendulum.py,sha256=DdxcWrm3HMQuyyY3Pk6sKHb4RXhQEM_EKY3HYZCP8ec,1503 +sympy/parsing/autolev/test-examples/ruletest1.al,sha256=mDJ02Q1Qm-ShVmGoyjzSfgDJHUOuDrsUg3YMnkpKdUw,176 +sympy/parsing/autolev/test-examples/ruletest1.py,sha256=eIKEFzEwkCFhPF0GTmf6SLuxXT384GqdCJnhiL2U0BQ,555 +sympy/parsing/autolev/test-examples/ruletest10.al,sha256=jKpV8BgX91iQsQDLFOJyaS396AyE5YQlUMxih5o9RK0,781 +sympy/parsing/autolev/test-examples/ruletest10.py,sha256=I1tsQcSAW6wqIguF-7lwlj9D4YZ8kCZqPqTKPUHR9oI,2726 +sympy/parsing/autolev/test-examples/ruletest11.al,sha256=j_q7giq2KIuXVRLWwNlwIlpbhNO6SqBMnLGLcxIkzwk,188 +sympy/parsing/autolev/test-examples/ruletest11.py,sha256=dYTRtXvMDXHiKzXHD2Sh0fcEukob3wr_GbSeqaZrrO8,475 +sympy/parsing/autolev/test-examples/ruletest12.al,sha256=drr2NLrK1ewn4FjMppXycpAUNbZEQ0IAMsdVx8nxk6I,185 +sympy/parsing/autolev/test-examples/ruletest12.py,sha256=ZG36s3PnkT0aKBM9Nx6H0sdJrtoLwaebU9386YSUql8,472 +sympy/parsing/autolev/test-examples/ruletest2.al,sha256=d-QjPpW0lzugaGBg8F6pDl_5sZHOR_EDJ8EvWLcz4FY,237 +sympy/parsing/autolev/test-examples/ruletest2.py,sha256=jrJfb0Jk2FP4GS5pDa0UB5ph0ijEVd1X8meKeZrTVng,820 +sympy/parsing/autolev/test-examples/ruletest3.al,sha256=1TAaOe8GI8-yBWJddfIxwnvScHNmOjSzSaQn0RS_v5k,308 +sympy/parsing/autolev/test-examples/ruletest3.py,sha256=O3K3IQo-HCjAIOSkfz3bDlst7dVUiRwhOZ0q_3jb5LU,1574 +sympy/parsing/autolev/test-examples/ruletest4.al,sha256=qPGlPbdDRrzTDUBeWydAIa7mbjs2o3uX938QAsWJ7Qk,302 +sympy/parsing/autolev/test-examples/ruletest4.py,sha256=WHod5yzKF4TNbEf4Yfxmx9WnimA7NOXqtTjZXR8FsP0,682 +sympy/parsing/autolev/test-examples/ruletest5.al,sha256=VuiKjiFmLK3uEdho0m3pk-n0qm4SNLoLPMRJqjMJ4GY,516 +sympy/parsing/autolev/test-examples/ruletest5.py,sha256=WvUtno1D3BrmFNPYYIBKR_gOA-PaHoxLlSTNDX67dcQ,1991 +sympy/parsing/autolev/test-examples/ruletest6.al,sha256=-HwgTmh_6X3wHjo3PQi7378t8YdizRJClc5Eb5DmjhE,703 +sympy/parsing/autolev/test-examples/ruletest6.py,sha256=vEO0jMOD-KIevAcVexmpvac0MGjN7O_dNipOBJJNzF0,1473 +sympy/parsing/autolev/test-examples/ruletest7.al,sha256=wR9S9rTzO9fyKL6Ofgwzw8XCFCV_p2hBpYotC8TvADI,773 +sympy/parsing/autolev/test-examples/ruletest7.py,sha256=_XvMrMe5r9RLopTrIqMGLhaYvHL1qjteWz9CKcotCL8,1696 +sympy/parsing/autolev/test-examples/ruletest8.al,sha256=P7Nu3Pq2R1mKcuFRc9dRO5jJ1_e5fwWdtqYG8NHVVds,682 +sympy/parsing/autolev/test-examples/ruletest8.py,sha256=8tgbwJ-ir0wiOCsgIFCAu4uD8SieYRrLoLzEfae5YQY,2690 +sympy/parsing/autolev/test-examples/ruletest9.al,sha256=txtZ5RH2p1FvAe6etwetSCH8rLktnpk5z0W72sCOdAA,755 +sympy/parsing/autolev/test-examples/ruletest9.py,sha256=GtqV-Wq2GGJzfblMscAz-KXCzs0P_4XqvA3FIdlPe04,1965 +sympy/parsing/c/__init__.py,sha256=J9CvkNRY-qy6CA06GZYuwTuxdnqas6oUP2g0qLztGro,65 +sympy/parsing/c/__pycache__/__init__.cpython-312.pyc,, +sympy/parsing/c/__pycache__/c_parser.cpython-312.pyc,, +sympy/parsing/c/c_parser.py,sha256=fM1GGRIbjzrVQ7ErfkWz6Xzfjvym030BOoWlQLx37Oc,38124 +sympy/parsing/fortran/__init__.py,sha256=KraiVw2qxIgYeMRTFjs1vkMi-hqqDkxUBv8Rc2gwkCI,73 +sympy/parsing/fortran/__pycache__/__init__.cpython-312.pyc,, +sympy/parsing/fortran/__pycache__/fortran_parser.cpython-312.pyc,, +sympy/parsing/fortran/fortran_parser.py,sha256=RpNQR3eNx5vgfzdt0nEZDCB56kF__SnYMaqWN3zla00,11483 +sympy/parsing/latex/LICENSE.txt,sha256=AHvDClj6QKmW53IEcSDeTq8x9REOT5w7X5P8374urKE,1075 +sympy/parsing/latex/LaTeX.g4,sha256=fG0ZUQPwYQOIbcyaPDAkGvcfGs3ZwwMB8ZnKW5yHUDY,5821 +sympy/parsing/latex/__init__.py,sha256=CfRRwZZo2qMF2HksyjGer8qSwhx0T4wnXsa2HKxCvUE,8968 +sympy/parsing/latex/__pycache__/__init__.cpython-312.pyc,, +sympy/parsing/latex/__pycache__/_build_latex_antlr.cpython-312.pyc,, +sympy/parsing/latex/__pycache__/_parse_latex_antlr.cpython-312.pyc,, +sympy/parsing/latex/__pycache__/errors.cpython-312.pyc,, +sympy/parsing/latex/_antlr/__init__.py,sha256=TAb79senorEsoYLCLwUa8wg8AUCHzmmZ7tLdi0XGNaE,384 +sympy/parsing/latex/_antlr/__pycache__/__init__.cpython-312.pyc,, +sympy/parsing/latex/_antlr/__pycache__/latexlexer.cpython-312.pyc,, +sympy/parsing/latex/_antlr/__pycache__/latexparser.cpython-312.pyc,, +sympy/parsing/latex/_antlr/latexlexer.py,sha256=Y1hmY1VGL5FTSSlToTRQydPnyaLLNy1mDSWx76HaYwM,30502 +sympy/parsing/latex/_antlr/latexparser.py,sha256=ZvonpvTS3vLSOVpas88M3CfNnUhPUDsCCPPk4wBYUGE,123655 +sympy/parsing/latex/_build_latex_antlr.py,sha256=3Mwip9f_yXUNhiwwUTCG5Nk8l2uzAw8oZHU0HSl5gkE,2765 +sympy/parsing/latex/_parse_latex_antlr.py,sha256=sVaO04oSeHe_TaMeM-6toheCR88G_RmJYpUIx-Sef1g,20712 +sympy/parsing/latex/errors.py,sha256=adSpvQyWjTLsbN_2KHJ4HuXpY7_U9noeWiG0lskYLgE,45 +sympy/parsing/latex/lark/__init__.py,sha256=hhhvfKRGP3ON36wRJwVfxMWw_GA6rl0JKsIzjuaUX38,120 +sympy/parsing/latex/lark/__pycache__/__init__.cpython-312.pyc,, +sympy/parsing/latex/lark/__pycache__/latex_parser.cpython-312.pyc,, +sympy/parsing/latex/lark/__pycache__/transformer.cpython-312.pyc,, +sympy/parsing/latex/lark/grammar/greek_symbols.lark,sha256=-G8JGrBredhWAzCaurr1UmqgRMRrAJfs_pANub8kXyA,937 +sympy/parsing/latex/lark/grammar/latex.lark,sha256=yz3DXIHllvRDGHeBmpz49PzDCU92pKexg2RTKX4KhTE,13221 +sympy/parsing/latex/lark/latex_parser.py,sha256=lGFEo_RxSKXYmjVEb_E3DiZ-aXl5tAZyfHklzEuJ9VA,4430 +sympy/parsing/latex/lark/transformer.py,sha256=RuXe8enUnLrzUFC9ZfKQyQ1_IlgA-qPINNng6UnY1x4,25754 +sympy/parsing/mathematica.py,sha256=P2vWEgx_HXv4I_C-6vPE3RXtbpXNT2iIJQBrA6QfqkU,39614 +sympy/parsing/maxima.py,sha256=DhTnXRSAceijyA1OAm86c6TyW9-aeUVoZEELGu0oZtY,1835 +sympy/parsing/sym_expr.py,sha256=-hxarp961eyLtuwUhbg3D3qzy06HrEPZEYpGVcJzAv0,8895 +sympy/parsing/sympy_parser.py,sha256=PRRhNS_0LKBVcHFmg7LGygzxRyQt6-vyCSMisXkRhVE,43832 +sympy/parsing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/parsing/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_ast_parser.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_autolev.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_c_parser.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_custom_latex.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_fortran_parser.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_implicit_multiplication_application.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_latex.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_latex_deps.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_latex_lark.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_mathematica.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_maxima.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_sym_expr.cpython-312.pyc,, +sympy/parsing/tests/__pycache__/test_sympy_parser.cpython-312.pyc,, +sympy/parsing/tests/test_ast_parser.py,sha256=lcT8w7mn6UEZ8T-xfA4TqG4Mt7JxY00oHhOW7JtHQfY,803 +sympy/parsing/tests/test_autolev.py,sha256=tQuUFa8YqVdsHPOcUhAwlMKB8Uk08HejDhDCda8lXs0,6647 +sympy/parsing/tests/test_c_parser.py,sha256=VYl3K4if_23iIS-Be8MBSG0OKZo-6xgxHiN22laeAyo,155354 +sympy/parsing/tests/test_custom_latex.py,sha256=vX5uVHw9-UgEcRl0XVNOMgrjBbb1sXDlPLL4D8AeOiQ,2060 +sympy/parsing/tests/test_fortran_parser.py,sha256=SGbawrJ4a780TJAFVMONc7Y3Y8VYgVqsIHxVGaicbxE,11828 +sympy/parsing/tests/test_implicit_multiplication_application.py,sha256=xUlc9TKH4HjimhnvWMwCtTabHAJcHCupFdsuiOsZhUs,7389 +sympy/parsing/tests/test_latex.py,sha256=WvKNJ5mtxfzl-rBiE9hc2aEz81b5BmI3SKO7sRZiNbI,11765 +sympy/parsing/tests/test_latex_deps.py,sha256=oe5vm2eIKn05ZiCcXUaO8X6HCcRmN1qCuTsz6tB7Qrk,426 +sympy/parsing/tests/test_latex_lark.py,sha256=kXmZP-gMLwa5XAcNsd-rF_zrPok0RZuJsa6Ny6zfoLw,36059 +sympy/parsing/tests/test_mathematica.py,sha256=vAxwquc8ArTQE9UNbsO21FqSa6J17sCF-A4vhTPXLY0,13395 +sympy/parsing/tests/test_maxima.py,sha256=iIwnFm0lYD0-JcraUIymogqEMN3ji0c-0JeNFFGTEDs,1987 +sympy/parsing/tests/test_sym_expr.py,sha256=-wNR7GwvJHVmPSZxSuAuoX1_FJk83O0tcDi09qYY6Jk,5668 +sympy/parsing/tests/test_sympy_parser.py,sha256=H_dDL89ASex3sI8F92ceXIJy5Qd137rxTa20Rj-9l2A,12946 +sympy/physics/__init__.py,sha256=F_yvUMCuBq3HR-3Ai6W4oktBsXRg8KdutFLwT9FFJlY,220 +sympy/physics/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/__pycache__/hydrogen.cpython-312.pyc,, +sympy/physics/__pycache__/matrices.cpython-312.pyc,, +sympy/physics/__pycache__/paulialgebra.cpython-312.pyc,, +sympy/physics/__pycache__/pring.cpython-312.pyc,, +sympy/physics/__pycache__/qho_1d.cpython-312.pyc,, +sympy/physics/__pycache__/secondquant.cpython-312.pyc,, +sympy/physics/__pycache__/sho.cpython-312.pyc,, +sympy/physics/__pycache__/wigner.cpython-312.pyc,, +sympy/physics/biomechanics/__init__.py,sha256=dG1IoRAnmfXvSyPciqJVrPn5LLnuvbVnBt78hBG0maQ,1520 +sympy/physics/biomechanics/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/biomechanics/__pycache__/_mixin.cpython-312.pyc,, +sympy/physics/biomechanics/__pycache__/activation.cpython-312.pyc,, +sympy/physics/biomechanics/__pycache__/curve.cpython-312.pyc,, +sympy/physics/biomechanics/__pycache__/musculotendon.cpython-312.pyc,, +sympy/physics/biomechanics/_mixin.py,sha256=0D3iBqlCRmR4HXKMxyC2LvYpKGHreOuZY5dXMJioQ4A,1493 +sympy/physics/biomechanics/activation.py,sha256=rUJegXrdO1LPHnzJpVRAYnA6DsvF46ndctkBt1JHDwI,25522 +sympy/physics/biomechanics/curve.py,sha256=PezKOUytiC15oLV11GC4M6u7ndXHpwtbilqdbIiqvgw,63154 +sympy/physics/biomechanics/musculotendon.py,sha256=LrYwFnwkShDWWZQtCgtSUqvc1H5IlTj_BNVKxfFNhE0,58274 +sympy/physics/biomechanics/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/physics/biomechanics/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/biomechanics/tests/__pycache__/test_activation.cpython-312.pyc,, +sympy/physics/biomechanics/tests/__pycache__/test_curve.cpython-312.pyc,, +sympy/physics/biomechanics/tests/__pycache__/test_mixin.cpython-312.pyc,, +sympy/physics/biomechanics/tests/__pycache__/test_musculotendon.cpython-312.pyc,, +sympy/physics/biomechanics/tests/test_activation.py,sha256=hdnMsFBLjloJylu8-cLZ44oamORG3kSsI0q2-eLQ_-I,13395 +sympy/physics/biomechanics/tests/test_curve.py,sha256=3jbWEHr8ieZYCfVlwJ1KTA1WJ9dcTCyQ1p3r8G2jp1I,75800 +sympy/physics/biomechanics/tests/test_mixin.py,sha256=ds-EoUCvfiSjVGnC_mBwjn5mI7z5W5wi2UTZZ4-pIIQ,1322 +sympy/physics/biomechanics/tests/test_musculotendon.py,sha256=Ls59mtJQ83W0fdpDGFGNeTgtxL8yAZ6ODW96N9mvFtM,32906 +sympy/physics/continuum_mechanics/__init__.py,sha256=GzYypKq3so15xfvY4qFerHYCNGFzZthfQ1aOcgu8yCM,191 +sympy/physics/continuum_mechanics/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/continuum_mechanics/__pycache__/arch.cpython-312.pyc,, +sympy/physics/continuum_mechanics/__pycache__/beam.cpython-312.pyc,, +sympy/physics/continuum_mechanics/__pycache__/cable.cpython-312.pyc,, +sympy/physics/continuum_mechanics/__pycache__/truss.cpython-312.pyc,, +sympy/physics/continuum_mechanics/arch.py,sha256=TKaoHk7-ToNP0n6ZGFF_cW6x965C-D3iENiqFo74ZJU,39243 +sympy/physics/continuum_mechanics/beam.py,sha256=Vq1xJHrjatQEUigMsxlAk8qoZSyp_Z_0GiJ5y5AIMIg,159946 +sympy/physics/continuum_mechanics/cable.py,sha256=1IOpa_eLYwdyixNkDhLXJQSg4fQhwOH7Ybm1jWR4aQA,31420 +sympy/physics/continuum_mechanics/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/physics/continuum_mechanics/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/continuum_mechanics/tests/__pycache__/test_arch.cpython-312.pyc,, +sympy/physics/continuum_mechanics/tests/__pycache__/test_beam.cpython-312.pyc,, +sympy/physics/continuum_mechanics/tests/__pycache__/test_cable.cpython-312.pyc,, +sympy/physics/continuum_mechanics/tests/__pycache__/test_truss.cpython-312.pyc,, +sympy/physics/continuum_mechanics/tests/test_arch.py,sha256=t_V-Pt0fxoPqYDZl5LB6ehQ4hBBVlveRWLsEXdyo_3k,2571 +sympy/physics/continuum_mechanics/tests/test_beam.py,sha256=Wmi8BCju21H1RaomKDqFATvCUqsrca_43o5IyA5s4ok,42085 +sympy/physics/continuum_mechanics/tests/test_cable.py,sha256=aANZVJxfihRkjAauCvFPGkXKD_zxMcJFb7vXU443dsQ,3832 +sympy/physics/continuum_mechanics/tests/test_truss.py,sha256=wgtF1GbQX5hzx20UrBg2ZyEvplVpsio3DiU8CS_bAk8,3269 +sympy/physics/continuum_mechanics/truss.py,sha256=hkLLnXA9aRaE2YvA0ods7T40zJQXUc_jLI108NjhtTI,44962 +sympy/physics/control/__init__.py,sha256=U0BeOmFRXOw-cpZ_F-RzNuEh78Tqzx31nuvZMZW2Fo8,1334 +sympy/physics/control/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/control/__pycache__/control_plots.cpython-312.pyc,, +sympy/physics/control/__pycache__/lti.cpython-312.pyc,, +sympy/physics/control/control_plots.py,sha256=lYa42ATTrSXMV44Q3POfEyYQCFSTV1W5Rb4UejYFdT8,37515 +sympy/physics/control/lti.py,sha256=o6n-qFXriBeETr4anCgOuYViUpQXDtBejckIdYdlxx0,177322 +sympy/physics/control/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/physics/control/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/control/tests/__pycache__/test_control_plots.cpython-312.pyc,, +sympy/physics/control/tests/__pycache__/test_lti.cpython-312.pyc,, +sympy/physics/control/tests/test_control_plots.py,sha256=dsXkabVUMzU6b1FmptRz2sGgXfe6y_lu3Mm0KN8is90,16899 +sympy/physics/control/tests/test_lti.py,sha256=YAvwA11zSKRcHmgLPuCJhBJXbFrPfjUNytaQsnEsEr8,104043 +sympy/physics/hep/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/physics/hep/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/hep/__pycache__/gamma_matrices.cpython-312.pyc,, +sympy/physics/hep/gamma_matrices.py,sha256=WlSHLUtMU7NrgLyKEvTntMSYxMZq1r_6o2kqUEAdPaA,24253 +sympy/physics/hep/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/physics/hep/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/hep/tests/__pycache__/test_gamma_matrices.cpython-312.pyc,, +sympy/physics/hep/tests/test_gamma_matrices.py,sha256=iKqICj0bP7EK0sSuYFsPdPkDTbHGa6J_LMPZAzv1j4o,14722 +sympy/physics/hydrogen.py,sha256=R2wnNi1xB-WTQ8Z9aPUhX9Z8mQ8TdhCM1JAZIkyXgjw,7594 +sympy/physics/matrices.py,sha256=jHfbWkzL2myFt-39kodQo5wPubBxNZKXlljuSxZL4bE,3836 +sympy/physics/mechanics/__init__.py,sha256=7rgPJp1YItAMOc29gWqkRp68AKCdZLu4tFQG-CWgjOQ,2874 +sympy/physics/mechanics/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/actuator.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/body.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/body_base.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/functions.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/inertia.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/joint.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/jointsmethod.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/kane.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/lagrange.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/linearize.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/loads.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/method.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/models.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/particle.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/pathway.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/rigidbody.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/system.cpython-312.pyc,, +sympy/physics/mechanics/__pycache__/wrapping_geometry.cpython-312.pyc,, +sympy/physics/mechanics/actuator.py,sha256=d7Ffb9vo1Tmrcfiy71_g0r1btscfvvabE-vznku3Auk,43633 +sympy/physics/mechanics/body.py,sha256=Z9ZOReEab9FHEDsyv2RfIBQM4_ripXhFXmQtu1OmN_Y,24617 +sympy/physics/mechanics/body_base.py,sha256=bwP04lWmD0iY_T0Vsn6NWMbnWyzUMFFqkAoAyKsow_c,2491 +sympy/physics/mechanics/functions.py,sha256=KsX3z33rZdMCifwyVlyKIHVJh0Fve--zs5wd1rkGMl0,25190 +sympy/physics/mechanics/inertia.py,sha256=FKcEbpYPx_26LS9sSp8lcsJ83spqwSYIyxM5q_z1mYA,6172 +sympy/physics/mechanics/joint.py,sha256=o9SWJ9pXDO-sVh0gJ6VTI0LgY019gFB5w5FP1PN--UI,84621 +sympy/physics/mechanics/jointsmethod.py,sha256=nqkXawtuxeyP0D8DEAYURCJlDYS4Eka_vXx6UZP7y74,10415 +sympy/physics/mechanics/kane.py,sha256=XyvEDNF09i5DnHf-YlCecEHDdKK9j486N2P5YD8_XaM,37118 +sympy/physics/mechanics/lagrange.py,sha256=UTmClOP-PkY8S-LcPlcOAUmshndlq6mpmZailbvy4E4,20202 +sympy/physics/mechanics/linearize.py,sha256=YtAap6TzsZJd794cdDCEDJVlMOXd_wFAMaCZZacHwbE,17242 +sympy/physics/mechanics/loads.py,sha256=jnajZOg631Aqtd0-BplehohUL991C3Cji2OZZ3MVHdk,5406 +sympy/physics/mechanics/method.py,sha256=2vFRhA79ra4HR6AzVBHMr3oNncrcqgLLMRqdyif0DrI,660 +sympy/physics/mechanics/models.py,sha256=9q1g3I2xYpuTMi-v9geswEqxJWTP3RjcOquRfzMhHzM,6463 +sympy/physics/mechanics/particle.py,sha256=YKiEBkPLVRI9foXlEe8eu8Ys5W1GyQO1oOBf0T8fHFg,5985 +sympy/physics/mechanics/pathway.py,sha256=2T71x06X8CZ20NUyXkMnP83gKsx2wJJEbPJS-1gMXFA,26555 +sympy/physics/mechanics/rigidbody.py,sha256=s5b7ynsdcMsq9PN2nM1yozNcZd08RA-MgzMjcs7jnBI,10287 +sympy/physics/mechanics/system.py,sha256=VsPPQfJs0gBLKJYNQ2ZLmD98JWLd1IZy0QGRwI21_TM,59457 +sympy/physics/mechanics/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/physics/mechanics/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_actuator.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_body.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_functions.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_inertia.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_joint.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_jointsmethod.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_kane.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_kane2.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_kane3.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_kane4.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_kane5.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_lagrange.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_lagrange2.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_linearity_of_velocity_constraints.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_linearize.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_loads.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_method.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_models.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_particle.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_pathway.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_rigidbody.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_system.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_system_class.cpython-312.pyc,, +sympy/physics/mechanics/tests/__pycache__/test_wrapping_geometry.cpython-312.pyc,, +sympy/physics/mechanics/tests/test_actuator.py,sha256=WoTnD_IGhewVOzcL7ybJXf_mrK0_E71gDcnon-3Mayg,41081 +sympy/physics/mechanics/tests/test_body.py,sha256=ygHfWeL6-3LW9gqXHfzdvqQhJWxg2-U2KQIHKqGNqKQ,12067 +sympy/physics/mechanics/tests/test_functions.py,sha256=Cl1aT3qT-0Ik6vJgS6at6PUaeWRQfpEG88QvEIxz1Bk,10447 +sympy/physics/mechanics/tests/test_inertia.py,sha256=On4K78tmq4tyr_QFs3Uo01efdlVj5R6yfn6CVs7ksnE,2726 +sympy/physics/mechanics/tests/test_joint.py,sha256=ojhQdBsWN6nR7egEhpw-LAyDRdFIPfSEsDoFL1bhzqs,57922 +sympy/physics/mechanics/tests/test_jointsmethod.py,sha256=8IUO7ntLPsydDT4YgA1FPyO5TXNpo4CIWC7O_JdWg9Q,10226 +sympy/physics/mechanics/tests/test_kane.py,sha256=K1HOm7cuPzXeO9ZmW7oAHgu-jxOg1IFqyKB3YheAbus,21545 +sympy/physics/mechanics/tests/test_kane2.py,sha256=qNLkbSV6UYclQzMDoRi_TJrJEz0-MUi7yf1e7XW4ba4,19256 +sympy/physics/mechanics/tests/test_kane3.py,sha256=-9MbXLfYUDhA_9D2o4NrNLgDTOnKDLLsgryQW3AHacs,14959 +sympy/physics/mechanics/tests/test_kane4.py,sha256=qJYUfvnq1F5UN_AQqTu_3BT5XqGceqxnCyP3d2gE04A,4709 +sympy/physics/mechanics/tests/test_kane5.py,sha256=gZvAyxJ8fkkLtH60xHlb_Gxrbt9d7VmJTckXSGmF0j4,5693 +sympy/physics/mechanics/tests/test_lagrange.py,sha256=iuHomulBF8MafLeorKGaLHUEF8CvFhXcxEtN0hk1akM,10119 +sympy/physics/mechanics/tests/test_lagrange2.py,sha256=VBonbWg0uLduE4AwNUWCsGGa_2KmaDbg9jROZL3DTWE,1402 +sympy/physics/mechanics/tests/test_linearity_of_velocity_constraints.py,sha256=Y9JYoaob8yyL7PS-VN7g-DC8YEfCxBGdFSSkQAKlOBI,1341 +sympy/physics/mechanics/tests/test_linearize.py,sha256=6yFFGEhJW60fx9Ny1duc6eyvGDg6rtmJVo_V1mgHgGk,13273 +sympy/physics/mechanics/tests/test_loads.py,sha256=Kw94kP0tfwKsV-jCDHGTQsyc-1dKQl3ABJfqJtR8AJg,2698 +sympy/physics/mechanics/tests/test_method.py,sha256=L7CnsvbQC-U7ijbSZdu7DEr03p88OLj4IPvFJ_3kCDo,154 +sympy/physics/mechanics/tests/test_models.py,sha256=GcsfCm5G4PPYQXsHCiAKI1dEW42RaZOh-x6aEouTYo4,5078 +sympy/physics/mechanics/tests/test_particle.py,sha256=JL6QAA6T3POQkSutUnungrVkR3xt6ZVX-hp75-EufQw,2682 +sympy/physics/mechanics/tests/test_pathway.py,sha256=oGCxlUOviyNc1GBMvhk5sYVZfu8C4o7lJMbqatBie3A,24944 +sympy/physics/mechanics/tests/test_rigidbody.py,sha256=ezMW5BWt9cWdNeY1B9aYcL4NsPcVkaKZuUS1C7S1qPk,6188 +sympy/physics/mechanics/tests/test_system.py,sha256=Dihu77qM5_QkDQg-zavHbVhh_nvaGEVztXgPNl2_enk,8700 +sympy/physics/mechanics/tests/test_system_class.py,sha256=Xe4VLrxWaYL3oRwP2SBaanWf5DY46d2yPlwf9H1XJ4M,38219 +sympy/physics/mechanics/tests/test_wrapping_geometry.py,sha256=aXwuEaprstnSW7BwLr3OKUyxSagRPO58L-tUMaq3I9s,10502 +sympy/physics/mechanics/wrapping_geometry.py,sha256=XkI331oQcBme4jDmH0RqQDWh_pq49o38nbRsXwT9O5E,21599 +sympy/physics/optics/__init__.py,sha256=0UmqIt2-u8WwNkAqsnOVt9VlkB9K0CRIJYiQaltJ73w,1647 +sympy/physics/optics/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/optics/__pycache__/gaussopt.cpython-312.pyc,, +sympy/physics/optics/__pycache__/medium.cpython-312.pyc,, +sympy/physics/optics/__pycache__/polarization.cpython-312.pyc,, +sympy/physics/optics/__pycache__/utils.cpython-312.pyc,, +sympy/physics/optics/__pycache__/waves.cpython-312.pyc,, +sympy/physics/optics/gaussopt.py,sha256=mVQ-JX7xmAp9XbNOYIlwsPAxkUukTw_QjbjIxuKWZW8,20898 +sympy/physics/optics/medium.py,sha256=cys0tWGi1VCPWMTZuKadcN_bToz_bqKsDHSEVzuV3CE,7124 +sympy/physics/optics/polarization.py,sha256=mIrZiOVXetGtKkLxl8Llaf2Z9coWenf6JKrClh4W8yU,21434 +sympy/physics/optics/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/physics/optics/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/optics/tests/__pycache__/test_gaussopt.cpython-312.pyc,, +sympy/physics/optics/tests/__pycache__/test_medium.cpython-312.pyc,, +sympy/physics/optics/tests/__pycache__/test_polarization.cpython-312.pyc,, +sympy/physics/optics/tests/__pycache__/test_utils.cpython-312.pyc,, +sympy/physics/optics/tests/__pycache__/test_waves.cpython-312.pyc,, +sympy/physics/optics/tests/test_gaussopt.py,sha256=QMXJw_6mFCC3918b-pc_4b_zgO8Hsk7_SBvMupbEi5I,4222 +sympy/physics/optics/tests/test_medium.py,sha256=RxG7N3lzmCO_8hIoKyPnDKffmk8QFzA9yamu1_mr_dE,2194 +sympy/physics/optics/tests/test_polarization.py,sha256=81MzyA29HZckg_Ss-88-5o0g9augDqCr_LwcJIiXuA0,2605 +sympy/physics/optics/tests/test_utils.py,sha256=SjicjAptcZGwuX-ib_Lq7PlGONotvo2XJ4p3JA9iNVI,8553 +sympy/physics/optics/tests/test_waves.py,sha256=PeFfrl7MBkWBHdc796sDDYDuhGepat3DQk7PmyTXVnw,3397 +sympy/physics/optics/utils.py,sha256=BqfuvtrjO3PEcDQ1DecNyt2Th9Yps6xued1tEY4ysvk,22172 +sympy/physics/optics/waves.py,sha256=Iw-9gGksvWhPmQ_VepmI90ekKyzHdPlq6U41wdM4ikI,10042 +sympy/physics/paulialgebra.py,sha256=1r_qDBbVyl836qIXlVDdoF89Z9wedGvWIkHAbwQaK-4,6002 +sympy/physics/pring.py,sha256=SCMGGIcEhVoD7dwhY7_NWL1iKwo7OfgKdmm2Ok_9Xl0,2240 +sympy/physics/qho_1d.py,sha256=ZXemUsa_b0rLtPVTUkgAkZQ1Ecu2eIZxaiNSSXW0PDk,2005 +sympy/physics/quantum/__init__.py,sha256=vzWc2d2aXbMdZGJRx4tyS6FDCtjbtl7SqCJE7nSXN9A,1952 +sympy/physics/quantum/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/anticommutator.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/boson.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/cartesian.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/cg.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/circuitplot.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/circuitutils.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/commutator.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/constants.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/dagger.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/density.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/fermion.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/gate.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/grover.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/hilbert.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/identitysearch.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/innerproduct.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/kind.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/matrixcache.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/matrixutils.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/operator.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/operatorordering.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/operatorset.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/pauli.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/piab.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/qapply.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/qasm.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/qexpr.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/qft.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/qubit.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/represent.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/sho1d.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/shor.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/spin.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/state.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/tensorproduct.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/trace.cpython-312.pyc,, +sympy/physics/quantum/__pycache__/transforms.cpython-312.pyc,, +sympy/physics/quantum/anticommutator.py,sha256=kXr7DWZZy0Sqcnxx-QEeA58mUCRXTL_VHDzQBjNV0DI,5072 +sympy/physics/quantum/boson.py,sha256=Nn4TN917TQv4tdFNZddlT1eEGg7O1uybnU9K5NI6AyM,5834 +sympy/physics/quantum/cartesian.py,sha256=9R9VDYLV1Xe-GkA9TQbj8PVlBLaD0fF6KXfHJ1ze5as,9092 +sympy/physics/quantum/cg.py,sha256=WK7HkAIRFejQQLjRsCC7rH0L--0fmXAoeL1JdTHb3GA,23319 +sympy/physics/quantum/circuitplot.py,sha256=SacQMhPyDhizKmGRNEs1vtXph8lR6bMn5bVJI4rJiXg,11799 +sympy/physics/quantum/circuitutils.py,sha256=mrQNUDbwM3LV1NZ1EqVpXyOY2mOXCBVZW7cQTiCxUaM,13882 +sympy/physics/quantum/commutator.py,sha256=MKk8OqwIi8LCzxkD8URmKCFM9OthAAxS8xFNgP_i09U,8139 +sympy/physics/quantum/constants.py,sha256=20VRATCkSprSnGFR5ejvMEYlWwEcv1B-dE3RPqPTQ9k,1420 +sympy/physics/quantum/dagger.py,sha256=P58FL8fLFfMhtu79jGsG69oEMjLjutRDrXsLwBat-9U,2484 +sympy/physics/quantum/density.py,sha256=ie_NJO-YNJ3PydAMp3jlmhC5H8bN3ldhn2SiCKY5N0s,9546 +sympy/physics/quantum/fermion.py,sha256=1ipn3FItUJ_ruLnflpp9MN_6t5w8CgHAJRJCOsukGGI,4983 +sympy/physics/quantum/gate.py,sha256=Iv7-qhSCe_An9qaJcYRDgwr8ClNraP47E75UlS5fCoQ,42588 +sympy/physics/quantum/grover.py,sha256=17KC5MJR3cCavmzqRqi9dB5OFTOpsYjfrTZuv03HiuE,10452 +sympy/physics/quantum/hilbert.py,sha256=qrja92vF7BUeSyHOLKVX8-XKcPGT7QaQMWrqWXjRNus,19632 +sympy/physics/quantum/identitysearch.py,sha256=Zh_ji5J0YeAy2AezsQcHV9W2icWoaa3ZwTbfjCCQmJo,27607 +sympy/physics/quantum/innerproduct.py,sha256=NKlJufh068C3MeKBORJG8k7zdH_vGJeo7jlH67PqU7E,4303 +sympy/physics/quantum/kind.py,sha256=odJyriPZKyievddvlY-kks8iBCSi1yZ7JEsaLANHoe4,2831 +sympy/physics/quantum/matrixcache.py,sha256=S6fPkkYmfX8ELBOc9EST-8XnQ1gtpSOBfd2KwLGKdYo,3587 +sympy/physics/quantum/matrixutils.py,sha256=53VGeUNYNpU1eA1sNcYFaX1_45I9SVabCfpTyHUDFog,8214 +sympy/physics/quantum/operator.py,sha256=Q-uiUjAZgMOXHKoBFe2oW_qJsJSjC8fM246yzxMmZ0A,19657 +sympy/physics/quantum/operatorordering.py,sha256=byAyZCNKTCeFWIFThmNx0NgdI4u32O4ydodYSa6Wrr8,10296 +sympy/physics/quantum/operatorset.py,sha256=h8nkScpQcUzCO3zemqKpgQfJDWiBbfj33IJzcl4J2_4,9563 +sympy/physics/quantum/pauli.py,sha256=lzxWFHXqxKWRiYK99QCo9zuVG9eVXiB8vFya7TvrVxQ,17250 +sympy/physics/quantum/piab.py,sha256=Zjb2cRGniVDV6e35gjP4uEpI4w0C7YGQIEXReaq_z-E,1912 +sympy/physics/quantum/qapply.py,sha256=5vqWe__WRvJuD6sWC2NTDe1qEcToBGTGaye9lzirgf4,9494 +sympy/physics/quantum/qasm.py,sha256=UWpcUIBgkK55SmEBZlpmz-1KGHZvW7dNeSVG8tHr44A,6288 +sympy/physics/quantum/qexpr.py,sha256=N87sU5AqFbGEXgHJof-B7ua46rk4SeysK16abU1GfYI,13940 +sympy/physics/quantum/qft.py,sha256=ua4qBQAm-gi923lRRxOgAebTsTCoR93pz8ZHPXBdcus,6425 +sympy/physics/quantum/qubit.py,sha256=mE0xebz8zqeKEc4xww9-Iv7tZzxHjm9Klsr2WgUQcVM,25997 +sympy/physics/quantum/represent.py,sha256=dBY9RLD21V0WuIBbigagjaLSUCiloDzitv8Wl6fU9dE,18729 +sympy/physics/quantum/sho1d.py,sha256=ZroR_FjxmjOmDcd0Fm04vWKTGCpvLaEu4NiuplKm708,20867 +sympy/physics/quantum/shor.py,sha256=DVwPxLAPSr8t3F3aXJIPe4o5XSuQiE6a6eA6OYmdZFw,5504 +sympy/physics/quantum/spin.py,sha256=l6168fTEZEC4FeaMS8iLqo3b4YMvUlPTZvq9N8iSV08,72986 +sympy/physics/quantum/state.py,sha256=618YaDGAtpUeuWCVYs6lDuO3mD87_f8KIUGUXaN9L4s,29971 +sympy/physics/quantum/tensorproduct.py,sha256=PvpDSuLku1IdIV3T2dK3fVv6AdMNVcc5eR8n34AB3OQ,12599 +sympy/physics/quantum/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/physics/quantum/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_anticommutator.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_boson.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_cartesian.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_cg.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_circuitplot.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_circuitutils.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_commutator.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_constants.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_dagger.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_density.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_fermion.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_gate.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_grover.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_hilbert.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_identitysearch.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_innerproduct.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_kind.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_matrixutils.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_operator.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_operatorordering.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_operatorset.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_pauli.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_piab.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_printing.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_qapply.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_qasm.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_qexpr.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_qft.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_qubit.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_represent.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_sho1d.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_shor.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_spin.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_state.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_tensorproduct.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_trace.cpython-312.pyc,, +sympy/physics/quantum/tests/__pycache__/test_transforms.cpython-312.pyc,, +sympy/physics/quantum/tests/test_anticommutator.py,sha256=ckWHKwQFiAMWcDaYSa_26vi_GIsvs32_0O62I5lGsr8,1304 +sympy/physics/quantum/tests/test_boson.py,sha256=BZjdrZ-F1QhyhDqfK4Zc1VEFBJi1PeiPjMpfBcHekfo,1676 +sympy/physics/quantum/tests/test_cartesian.py,sha256=4szaB4w555oDUkhaRtBF8mOfIxiODNCqOlDHEVcUFOo,4417 +sympy/physics/quantum/tests/test_cg.py,sha256=BF-2ybLhoAYOb0wfWFlgnobMzH20zTYJvW5Z7v46SYI,9159 +sympy/physics/quantum/tests/test_circuitplot.py,sha256=c3v9wUzLHUH-eBVGj6_broVhHkioNwpaaApTDAJEflU,2096 +sympy/physics/quantum/tests/test_circuitutils.py,sha256=GrJAWRQVH_l8EIHrj1ve2jtxske72IriQ3lo94fqrVQ,13187 +sympy/physics/quantum/tests/test_commutator.py,sha256=keBstGDpNITFRr06uVFrka_Lje56g6oFoJQEpZXmnYw,2727 +sympy/physics/quantum/tests/test_constants.py,sha256=KBmYPIF49Sq34lbzbFCZRYWSyIdhnR3AK3q-VbU6grU,338 +sympy/physics/quantum/tests/test_dagger.py,sha256=pi2lhL5EaE8FuIuwM9gOce2NpDCP4S1JptqI-mx8FGM,2632 +sympy/physics/quantum/tests/test_density.py,sha256=EyxiEgyc0nDSweJwI0JUwta7gZ81TVHCl7YDEosTrvI,9718 +sympy/physics/quantum/tests/test_fermion.py,sha256=RK-J3nV1UO_9R5UyrBIp_qfWX-5iZ152aoyEllKWSIc,1636 +sympy/physics/quantum/tests/test_gate.py,sha256=7oBX1HoWnrYtHjABRoqv_wQDB9B829E99fdcJzaqawM,12496 +sympy/physics/quantum/tests/test_grover.py,sha256=uze62AG6H4x2MYJJA-EY3NtkqwvrDIQ2kONuvIRQiZ4,3640 +sympy/physics/quantum/tests/test_hilbert.py,sha256=IGP6rc2-b3we9dRDbpRniFAhQwp_TYtMfFzxusAprx0,2643 +sympy/physics/quantum/tests/test_identitysearch.py,sha256=3YGrXCsFLhLtN5MRyT5ZF8ELrSdkvDKTv6xKM4i2ims,17745 +sympy/physics/quantum/tests/test_innerproduct.py,sha256=37tT8p6MhHjAYeoay1Zyv7gCs-DeZQi4VdwUH2IffDE,1483 +sympy/physics/quantum/tests/test_kind.py,sha256=MCc0jobaf-fZmi99ir2VpZM1Lah5w9ZMxqygVQZfleU,2515 +sympy/physics/quantum/tests/test_matrixutils.py,sha256=wXc2jYLYaR07MgbVBpUU0cEsy2YQhQygbHV6M55u_ss,4115 +sympy/physics/quantum/tests/test_operator.py,sha256=kmNGQzjtdsko6PlUNcTT0kjOYX73LOMzHGuncS2SjSw,8417 +sympy/physics/quantum/tests/test_operatorordering.py,sha256=SFvJfrBxreMgMB3PEpXGcTvO_113Pi1O-Jco-A9_aVI,2003 +sympy/physics/quantum/tests/test_operatorset.py,sha256=DNfBeYBa_58kSG7PM5Ilo6xnzek8lSiAGX01uMFRYqI,2628 +sympy/physics/quantum/tests/test_pauli.py,sha256=Bhsx_gj5cpYv4BhVJRQohxlKk_rcp4jHtSRlTP-m_xs,4940 +sympy/physics/quantum/tests/test_piab.py,sha256=8ndnzyIsjF4AOu_9k6Yqap_1XUDTbiGnv7onJdrZBWA,1086 +sympy/physics/quantum/tests/test_printing.py,sha256=Qg34sHUAgKeh7DhHNp3KQX0_bhfdkMPCKJUvL08ufz8,30332 +sympy/physics/quantum/tests/test_qapply.py,sha256=ol5IJuuPand4r-P2cBv_Wycv2wnkMsW3dlJxDAp_PSs,6086 +sympy/physics/quantum/tests/test_qasm.py,sha256=ZvMjiheWBceSmIM9LHOL5fiFUl6HsUo8puqdzywrhkc,2976 +sympy/physics/quantum/tests/test_qexpr.py,sha256=0a80r2d31yxuJn11CcemrMn855o2ge5CH8j73ZCwuKI,1830 +sympy/physics/quantum/tests/test_qft.py,sha256=v-sGTaW9S-gcGTDAUPvjwd1kINF6rlI_u5Sf-Gso0r8,1931 +sympy/physics/quantum/tests/test_qubit.py,sha256=rj5RNjLWjZ8514fQwEsVp0wuUlI1SKAIomL0wZ-9PqA,9271 +sympy/physics/quantum/tests/test_represent.py,sha256=lEwzpL0fGxDGkojZ4_WoBAtCcA7aq2-S-i0Z0QrnTXg,5177 +sympy/physics/quantum/tests/test_sho1d.py,sha256=1QCoRXwhcK-P1oUrREgAroPHJPzPgWEBSrHomjS3meA,6893 +sympy/physics/quantum/tests/test_shor.py,sha256=3a3GCg6V5_mlJ2bltoXinGMGvlSxpq7GluapD_3SZaQ,666 +sympy/physics/quantum/tests/test_spin.py,sha256=p6F0cfQkPYwXlzE29mTL-dpsEYZmFU0EfAwm2MUA9xE,345698 +sympy/physics/quantum/tests/test_state.py,sha256=pjNwjEQN1zMXzC6NbL60ZLzpqBfZD5RscjuyiFuhTaE,6748 +sympy/physics/quantum/tests/test_tensorproduct.py,sha256=CL8xJyUl7plFU7TYsHHkLDYt9PtS4SM_H-SG4lKM5aE,5314 +sympy/physics/quantum/tests/test_trace.py,sha256=dbpTXcJArWRR_Hh5JTuy2GJIfgjVo6zS20o5mdVEGH4,3057 +sympy/physics/quantum/tests/test_transforms.py,sha256=w1fLTJO07CWPOQp5jFVU83MatsaoNBkxOI_YbM6I1w8,2346 +sympy/physics/quantum/trace.py,sha256=2ZqN9IEsz3LKHTLV8ZDwTK0sM5PfwL0p2sYet0N7Gis,6397 +sympy/physics/quantum/transforms.py,sha256=XLnWmyoWW8oXJ8I7dUIF7cMxFt9xr736HfNstD_tnK0,10929 +sympy/physics/secondquant.py,sha256=1XDsbnUpFC7zmJ4VC9DXEsK_smSqNMaDfsi6slIkws0,90974 +sympy/physics/sho.py,sha256=K8P9FAdZr6UfQKYZO9TlhDUqUd3YsMekXCsKy2HhaY0,2480 +sympy/physics/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/physics/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/tests/__pycache__/test_clebsch_gordan.cpython-312.pyc,, +sympy/physics/tests/__pycache__/test_hydrogen.cpython-312.pyc,, +sympy/physics/tests/__pycache__/test_paulialgebra.cpython-312.pyc,, +sympy/physics/tests/__pycache__/test_physics_matrices.cpython-312.pyc,, +sympy/physics/tests/__pycache__/test_pring.cpython-312.pyc,, +sympy/physics/tests/__pycache__/test_qho_1d.cpython-312.pyc,, +sympy/physics/tests/__pycache__/test_secondquant.cpython-312.pyc,, +sympy/physics/tests/__pycache__/test_sho.cpython-312.pyc,, +sympy/physics/tests/test_clebsch_gordan.py,sha256=gHMZnYkigoVWeDV7bwD4YARplb_L1AOMppzcLxSmWnI,9921 +sympy/physics/tests/test_hydrogen.py,sha256=kohRIR6JojE_GWYnlzLsMMgdhoKd8whazs0mq7cCTQc,4987 +sympy/physics/tests/test_paulialgebra.py,sha256=tyshEMsLNPR4iYzoAbPGZRZ-e_8t7GDP_xyjRyhepeQ,1477 +sympy/physics/tests/test_physics_matrices.py,sha256=Dha8iQRhzxLcl7TKSA6QP0pnEcBoqtj_Ob6tx01SMwI,2948 +sympy/physics/tests/test_pring.py,sha256=XScQQO9RhRrlqSII_ZyyOUpE-zs-7wphSFCZq2OuFnE,1261 +sympy/physics/tests/test_qho_1d.py,sha256=LD9WU-Y5lW7bVM7MyCkSGW9MU2FZhVjMB5Zk848_q1M,1775 +sympy/physics/tests/test_secondquant.py,sha256=vI9EuCMd1PMYNbZH2bHW9xHPYS5DS92QOmAk1kC12cQ,49401 +sympy/physics/tests/test_sho.py,sha256=aIs1f3eo6hb4ErRU8xrr_h_yhTmRx-fQgv9n27SfsLM,693 +sympy/physics/units/__init__.py,sha256=DVvWy9qNRm742NFGcBpybFY20ZK3BU7DWNbLMTXYiFo,12386 +sympy/physics/units/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/units/__pycache__/dimensions.cpython-312.pyc,, +sympy/physics/units/__pycache__/prefixes.cpython-312.pyc,, +sympy/physics/units/__pycache__/quantities.cpython-312.pyc,, +sympy/physics/units/__pycache__/unitsystem.cpython-312.pyc,, +sympy/physics/units/__pycache__/util.cpython-312.pyc,, +sympy/physics/units/definitions/__init__.py,sha256=F3RyZc1AjM2Ch5b27Tt-VYdZ1HAIWvhgtQQQTfMiN6w,7470 +sympy/physics/units/definitions/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/units/definitions/__pycache__/dimension_definitions.cpython-312.pyc,, +sympy/physics/units/definitions/__pycache__/unit_definitions.cpython-312.pyc,, +sympy/physics/units/definitions/dimension_definitions.py,sha256=QmPLCy7GvLx1z_YEZ5KFl8QUXg4rcuu3PuNI5wLpPdY,1633 +sympy/physics/units/definitions/unit_definitions.py,sha256=05wpHmAtyQvuJBeuzWm3cDQ6UYviNtsi4kVc0hv8VHw,14680 +sympy/physics/units/dimensions.py,sha256=GMuoSF1vqKDs_e3JJ7Y0lpFrneXMZLZk_qIC5d6Q5UU,20899 +sympy/physics/units/prefixes.py,sha256=_q2f8gA-kckBG7TutTFQazTf15PCZqNnaTR1gKXRfsk,6260 +sympy/physics/units/quantities.py,sha256=r5E231CULmsSEM7Rh7zfcTPuR85_X0CwRCVU_nDsek0,4671 +sympy/physics/units/systems/__init__.py,sha256=jJuvdc15c83yl11IuvhyjijwOZ9m1JGgZOgKwKv2e2o,244 +sympy/physics/units/systems/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/units/systems/__pycache__/cgs.cpython-312.pyc,, +sympy/physics/units/systems/__pycache__/length_weight_time.cpython-312.pyc,, +sympy/physics/units/systems/__pycache__/mks.cpython-312.pyc,, +sympy/physics/units/systems/__pycache__/mksa.cpython-312.pyc,, +sympy/physics/units/systems/__pycache__/natural.cpython-312.pyc,, +sympy/physics/units/systems/__pycache__/si.cpython-312.pyc,, +sympy/physics/units/systems/cgs.py,sha256=gXbX8uuZo7lcYIENA-CpAnyS9WVQy-vRisxlQm-198A,3702 +sympy/physics/units/systems/length_weight_time.py,sha256=DXIDSWdhjfxGLA0ldOziWhwQjzTAs7-VQTNCHzDvCgY,7004 +sympy/physics/units/systems/mks.py,sha256=Z3eX9yWK9BdvEosCROK2qRKtKFYOjtQ50Jk6vFT7AQY,1546 +sympy/physics/units/systems/mksa.py,sha256=U8cSI-maIuLJRvpKLBuZA8V19LDRYVc2I40Rao-wvjk,2002 +sympy/physics/units/systems/natural.py,sha256=43Odvmtxdpbz8UcW_xoRE9ArJVVdF7dgdAN2ByDAXx4,909 +sympy/physics/units/systems/si.py,sha256=YBPUuovW3-JBDZYuStXXRaC8cfzE3En3K5MjNy5pLJk,14478 +sympy/physics/units/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/physics/units/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/units/tests/__pycache__/test_dimensions.cpython-312.pyc,, +sympy/physics/units/tests/__pycache__/test_dimensionsystem.cpython-312.pyc,, +sympy/physics/units/tests/__pycache__/test_prefixes.cpython-312.pyc,, +sympy/physics/units/tests/__pycache__/test_quantities.cpython-312.pyc,, +sympy/physics/units/tests/__pycache__/test_unit_system_cgs_gauss.cpython-312.pyc,, +sympy/physics/units/tests/__pycache__/test_unitsystem.cpython-312.pyc,, +sympy/physics/units/tests/__pycache__/test_util.cpython-312.pyc,, +sympy/physics/units/tests/test_dimensions.py,sha256=lzkgGfEXMHxB8Izv7nRTN2uOEPh65LXPYaG8Kr5H05o,6122 +sympy/physics/units/tests/test_dimensionsystem.py,sha256=s2_2RAJwOaPOTvyIiAO9SYap374ytZqWbatWkLCnbSU,2717 +sympy/physics/units/tests/test_prefixes.py,sha256=Y3vlIReWGu8bwwZTrNGZSVoWYjhzgUZC33CDeyIvw48,2238 +sympy/physics/units/tests/test_quantities.py,sha256=XPuM6ul7XrUHvQE7F8rvpoCaxT9N6TM2gX99qUM4gTA,19758 +sympy/physics/units/tests/test_unit_system_cgs_gauss.py,sha256=JepTWt8yGdtv5dQ2AKUKb9fxpuYqLWOp0oOmzov9vfY,3173 +sympy/physics/units/tests/test_unitsystem.py,sha256=1Xh78_8hbv-yP4ICWI_dUrOnk3cimlvP_VhO-EXOa7Q,3254 +sympy/physics/units/tests/test_util.py,sha256=76PaLp_Cd9BAiry6VcWUD4Hrr68D6lTOkScWcLyhmL0,9355 +sympy/physics/units/unitsystem.py,sha256=mLuXftt3003OLk3knUGdYb1XfGbQa6vp-pHcenL11-o,7593 +sympy/physics/units/util.py,sha256=GU43MjXBRl5fm0CrU1fhFsZi9Q7wPG0NSJVJb1Oc_Y8,9885 +sympy/physics/vector/__init__.py,sha256=jZmrNB6ZfY7NOP8nx8GWcfI2Ixb2mv7lXuGHn63kyOw,985 +sympy/physics/vector/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/vector/__pycache__/dyadic.cpython-312.pyc,, +sympy/physics/vector/__pycache__/fieldfunctions.cpython-312.pyc,, +sympy/physics/vector/__pycache__/frame.cpython-312.pyc,, +sympy/physics/vector/__pycache__/functions.cpython-312.pyc,, +sympy/physics/vector/__pycache__/point.cpython-312.pyc,, +sympy/physics/vector/__pycache__/printing.cpython-312.pyc,, +sympy/physics/vector/__pycache__/vector.cpython-312.pyc,, +sympy/physics/vector/dyadic.py,sha256=CuAkSBgnatfnZQ2gBazZQC1DBVXbksiFWWqxu2w3C2U,18042 +sympy/physics/vector/fieldfunctions.py,sha256=H3S7oeLHaInZns9ko04BPOcSSOK2M5hBK71jB813ExY,8610 +sympy/physics/vector/frame.py,sha256=J1sY-qaAamcZFKP26x54Q9TWITXBgjmE3v5PiEaFri4,57260 +sympy/physics/vector/functions.py,sha256=b4dHZOxbvS77SMcSlCV2GTaOzWj0TQiUtDaO_dhj3Uw,24810 +sympy/physics/vector/point.py,sha256=W1H6Jd-ZAIHY8yKO3YWj-vdEp7qI2yoglzk5HuT-y2E,20569 +sympy/physics/vector/printing.py,sha256=a1N-wziCnt4gHtY9luqe-CDW9aAtpZ0FcvWwQ0hMEEo,11790 +sympy/physics/vector/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/physics/vector/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/physics/vector/tests/__pycache__/test_dyadic.cpython-312.pyc,, +sympy/physics/vector/tests/__pycache__/test_fieldfunctions.cpython-312.pyc,, +sympy/physics/vector/tests/__pycache__/test_frame.cpython-312.pyc,, +sympy/physics/vector/tests/__pycache__/test_functions.cpython-312.pyc,, +sympy/physics/vector/tests/__pycache__/test_output.cpython-312.pyc,, +sympy/physics/vector/tests/__pycache__/test_point.cpython-312.pyc,, +sympy/physics/vector/tests/__pycache__/test_printing.cpython-312.pyc,, +sympy/physics/vector/tests/__pycache__/test_vector.cpython-312.pyc,, +sympy/physics/vector/tests/test_dyadic.py,sha256=vCSLxo0pynrHrCCo7S4925lgRhoSm_Mr5YhIh_1bYcw,4265 +sympy/physics/vector/tests/test_fieldfunctions.py,sha256=FUjh18QzB6dXSau9iHutb36o28faSa7T9sB0icpja-M,5825 +sympy/physics/vector/tests/test_frame.py,sha256=S5xn5Q9dMj_ACIS9ff7ACTBS7sFFovi9DIov-crUsko,29683 +sympy/physics/vector/tests/test_functions.py,sha256=qHGT0RR-vkAp1oF30TFNgaeuOGvXdZnK2aKZuRgrZHg,21127 +sympy/physics/vector/tests/test_output.py,sha256=hgqlE-_zN_EPE_gIZ_v2uXB1y2auo39hReWpvFUm2QQ,2612 +sympy/physics/vector/tests/test_point.py,sha256=5CTzT3a-igd33auAra4uusm0PYUc_whPtV7KAoZ4g5w,12373 +sympy/physics/vector/tests/test_printing.py,sha256=qVBjz4f3TtDrduUYLNDrvlrzBVMBDqLo27JWsFHdX18,10967 +sympy/physics/vector/tests/test_vector.py,sha256=bqU1ltS6UGbSo74KXMtvP1mOpqKQ6XSV19Wjw2QoNFc,10259 +sympy/physics/vector/vector.py,sha256=R7P63QPZee0lfHHVDU7Uq91ZJs5ewjVK5HVj9HHNeQo,24874 +sympy/physics/wigner.py,sha256=L5QyzD4yH4SyTk7-WCCd07XK0_Pd9nz7sHwo2zOWV7I,39588 +sympy/plotting/__init__.py,sha256=hAdOjai8-laj79rLJ2HZbiW1okXlz0p1ck-CoeNU6m8,526 +sympy/plotting/__pycache__/__init__.cpython-312.pyc,, +sympy/plotting/__pycache__/experimental_lambdify.cpython-312.pyc,, +sympy/plotting/__pycache__/plot.cpython-312.pyc,, +sympy/plotting/__pycache__/plot_implicit.cpython-312.pyc,, +sympy/plotting/__pycache__/plotgrid.cpython-312.pyc,, +sympy/plotting/__pycache__/series.cpython-312.pyc,, +sympy/plotting/__pycache__/textplot.cpython-312.pyc,, +sympy/plotting/__pycache__/utils.cpython-312.pyc,, +sympy/plotting/backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/plotting/backends/__pycache__/__init__.cpython-312.pyc,, +sympy/plotting/backends/__pycache__/base_backend.cpython-312.pyc,, +sympy/plotting/backends/base_backend.py,sha256=aof5cs8mWG6fl87DadR5sZBjY8ssMelOwKFWi27-FO0,14911 +sympy/plotting/backends/matplotlibbackend/__init__.py,sha256=Mzsz43gkanid12G8qnOcwJNbbvqf6eGppn-IZyJCMto,162 +sympy/plotting/backends/matplotlibbackend/__pycache__/__init__.cpython-312.pyc,, +sympy/plotting/backends/matplotlibbackend/__pycache__/matplotlib.cpython-312.pyc,, +sympy/plotting/backends/matplotlibbackend/matplotlib.py,sha256=9efu7ST_D3M-_fepZCPTcy8TdYEIX0PCkyocDGVfbPE,12548 +sympy/plotting/backends/textbackend/__init__.py,sha256=nnV_C7JJ_kwGcQe2C-tpnK635W8vTuIf5Grvvmur0rQ,92 +sympy/plotting/backends/textbackend/__pycache__/__init__.cpython-312.pyc,, +sympy/plotting/backends/textbackend/__pycache__/text.cpython-312.pyc,, +sympy/plotting/backends/textbackend/text.py,sha256=1ukArjwwQWUED9SB-1dmkB6YL5EcJ2rUosUf_NcBpXs,803 +sympy/plotting/experimental_lambdify.py,sha256=xcBhlvZ2h20aI1MpUN6qAEpO075Dv132AWbQJ7l3Wzg,22828 +sympy/plotting/intervalmath/__init__.py,sha256=fQV7sLZ9NHpZO5XGl2ZfqX56x-mdq-sYhtWEKLngHlU,479 +sympy/plotting/intervalmath/__pycache__/__init__.cpython-312.pyc,, +sympy/plotting/intervalmath/__pycache__/interval_arithmetic.cpython-312.pyc,, +sympy/plotting/intervalmath/__pycache__/interval_membership.cpython-312.pyc,, +sympy/plotting/intervalmath/__pycache__/lib_interval.cpython-312.pyc,, +sympy/plotting/intervalmath/interval_arithmetic.py,sha256=jv5YolNs6pOawIhuSsTBVwgkgmdOFwPrGN_1KtjfcIs,15570 +sympy/plotting/intervalmath/interval_membership.py,sha256=1VpO1T7UjvPxcMySC5GhZl8-VM_DxIirSWC3ZGmxIAY,2385 +sympy/plotting/intervalmath/lib_interval.py,sha256=WY1qRtyub4MDJaZizw6cXQI5NMEIXBO9UEWPEI80aW8,14809 +sympy/plotting/intervalmath/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/plotting/intervalmath/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/plotting/intervalmath/tests/__pycache__/test_interval_functions.cpython-312.pyc,, +sympy/plotting/intervalmath/tests/__pycache__/test_interval_membership.cpython-312.pyc,, +sympy/plotting/intervalmath/tests/__pycache__/test_intervalmath.cpython-312.pyc,, +sympy/plotting/intervalmath/tests/test_interval_functions.py,sha256=gdIo5z54tIbG8hDaGd3I8rBDP67oetMZWWdM-uvt1ec,9862 +sympy/plotting/intervalmath/tests/test_interval_membership.py,sha256=D1KjcrLxAwOmDEUqA-8TCqkFWGtmeerR9KwmzS7tyjk,4216 +sympy/plotting/intervalmath/tests/test_intervalmath.py,sha256=ndBMczrs6xYMN5RGnyCL9yq7pNUxrXHTSU1mdUsp5tU,9034 +sympy/plotting/plot.py,sha256=umvG47eIqOdEUo5qki3jDkS6LYKnTWFTZ5qzxZZBgAw,40882 +sympy/plotting/plot_implicit.py,sha256=1xIIr4eV1gIU4SkQ2k54PBZGUgYMCgsPttY-9uZ2eZM,7330 +sympy/plotting/plotgrid.py,sha256=QZmbxY-fcgPuseYLnKVDFsoH6m57Cosvy4W7l4jIqWw,6115 +sympy/plotting/pygletplot/__init__.py,sha256=DM7GURQbdSfcddHz23MxOShatBFc26tP_sd3G8pGCQE,3732 +sympy/plotting/pygletplot/__pycache__/__init__.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/color_scheme.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/managed_window.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot_axes.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot_camera.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot_controller.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot_curve.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot_interval.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot_mode.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot_mode_base.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot_modes.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot_object.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot_rotation.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot_surface.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/plot_window.cpython-312.pyc,, +sympy/plotting/pygletplot/__pycache__/util.cpython-312.pyc,, +sympy/plotting/pygletplot/color_scheme.py,sha256=NgPUamkldygfrIPj0LvC_1AzhscVtg18FSudElvFYB8,12522 +sympy/plotting/pygletplot/managed_window.py,sha256=N7AKtM7ELfIJLie6zvI-J6-OQRBnMZu6AL1USz7hFEk,3072 +sympy/plotting/pygletplot/plot.py,sha256=s-5AJB0KelHs9WGoFIVIdYrOoMXfdpnM5-G2cF8xzDQ,13352 +sympy/plotting/pygletplot/plot_axes.py,sha256=Q9YN8W0Hd1PeflHLvOvSZ-hxeLU4Kq3nUFLYDC0x0E8,8655 +sympy/plotting/pygletplot/plot_camera.py,sha256=myYtKbv1ov_ltgR34hf8BR76t3AwTSu4QFUY5YY-e1E,3928 +sympy/plotting/pygletplot/plot_controller.py,sha256=MroJJSPCbBDT8gGs_GdqpV_KHsllMNJpxx0MU3vKJV8,6941 +sympy/plotting/pygletplot/plot_curve.py,sha256=YwKA2lYC7IwCOQJaOVnww8AAG4P36cArgbC1iLV9OFI,2838 +sympy/plotting/pygletplot/plot_interval.py,sha256=doqr2wxnrED4MJDlkxQ07GFvaagX36HUb77ly_vIuKQ,5431 +sympy/plotting/pygletplot/plot_mode.py,sha256=Djq-ewVms_JoSriDpolDhhtttBJQdJO8BD4E0nyOWcQ,14156 +sympy/plotting/pygletplot/plot_mode_base.py,sha256=3z3WjeN7TTslHJevhr3X_7HRHPgUleYSngu6285lR6k,11502 +sympy/plotting/pygletplot/plot_modes.py,sha256=gKzJShz6OXa6EHKar8SuHWrELVznxg_s2d5IBQkkeYE,5352 +sympy/plotting/pygletplot/plot_object.py,sha256=qGtzcKup4It1CqZ2jxA7FnorCua4S9I-B_7I3SHBjcQ,330 +sympy/plotting/pygletplot/plot_rotation.py,sha256=KGMCTyaSh5_UQD9FKGCIpoI3-CbbOhXxTcjAc1o5-PU,1445 +sympy/plotting/pygletplot/plot_surface.py,sha256=C0q9tzDmxzC1IpWiNKY4llzcopx6dhotGOLpK1N9m3s,3803 +sympy/plotting/pygletplot/plot_window.py,sha256=5boC2Fkmk46-gWGqWzdTkPmTMNHHOpA0CnB9q946Hwc,4643 +sympy/plotting/pygletplot/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/plotting/pygletplot/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/plotting/pygletplot/tests/__pycache__/test_plotting.cpython-312.pyc,, +sympy/plotting/pygletplot/tests/test_plotting.py,sha256=NisjR-yuBRJfQvjcb20skTR3yid2U3MhKHW6sy8RE10,2720 +sympy/plotting/pygletplot/util.py,sha256=mzQQgDDbp04B03KyJrossLp8Yq72RJzjp-3ArfjbMH8,4621 +sympy/plotting/series.py,sha256=hPkMicAi29RjoJkFpMCt1CRn0xdBVYU1wLniigHgCaM,96568 +sympy/plotting/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/plotting/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/plotting/tests/__pycache__/test_experimental_lambdify.cpython-312.pyc,, +sympy/plotting/tests/__pycache__/test_plot.cpython-312.pyc,, +sympy/plotting/tests/__pycache__/test_plot_implicit.cpython-312.pyc,, +sympy/plotting/tests/__pycache__/test_series.cpython-312.pyc,, +sympy/plotting/tests/__pycache__/test_textplot.cpython-312.pyc,, +sympy/plotting/tests/__pycache__/test_utils.cpython-312.pyc,, +sympy/plotting/tests/test_experimental_lambdify.py,sha256=EYshdXA5tAGWolaDX-nHAolp7xIJN4Oqb1Uc1C1IhJI,3127 +sympy/plotting/tests/test_plot.py,sha256=mXiNdG-dHkK1iJ_moNlehZQU3i8mCtUKhVJdTxSxjdA,48217 +sympy/plotting/tests/test_plot_implicit.py,sha256=wurrO7ntsHb4tWYPVs5VogRrtcylevu0EceCSEwiWQg,5799 +sympy/plotting/tests/test_region_and.png,sha256=EV0Lm4HtQPk_6eIWtPY4TPcQk-O7tkpdZIuLmFjGRaA,6864 +sympy/plotting/tests/test_region_not.png,sha256=3O_9_nPW149FMULEcT5RqI2-k2H3nHELbfJADt2cO8k,7939 +sympy/plotting/tests/test_region_or.png,sha256=5Bug09vyog-Cu3mky7pbtFjew5bMvbpe0ZXWsgDKfy4,8809 +sympy/plotting/tests/test_region_xor.png,sha256=kucVWBA9A98OpcR4did5aLXUyoq4z0O4C3PM6dliBSw,10002 +sympy/plotting/tests/test_series.py,sha256=Nwa6__YMoWCiY0mYSlvJPPnlvtfOYLACHR1RbkopMc0,65638 +sympy/plotting/tests/test_textplot.py,sha256=VurTGeMjUfBLpLdoMqzJK9gbcShNb7f1OrAcRNyrtag,12761 +sympy/plotting/tests/test_utils.py,sha256=FkcYZAFT8TnHRIbkknx9NvA3-LgR0ua7WFyzQEPsVIE,3602 +sympy/plotting/textplot.py,sha256=Xc-bWvzVOq8QUn_BxDlJv9bryCpgzsgV73XoQQwVj0Q,5075 +sympy/plotting/utils.py,sha256=Cimno9MQGjcbe4rQ6TN86r4rM2t62CgARqPtgF0mhR8,12259 +sympy/polys/__init__.py,sha256=qXmDNr7noCUAtIs0rJJRHHFbHjy3uHIvXZDajcSePc4,5577 +sympy/polys/__pycache__/__init__.cpython-312.pyc,, +sympy/polys/__pycache__/appellseqs.cpython-312.pyc,, +sympy/polys/__pycache__/compatibility.cpython-312.pyc,, +sympy/polys/__pycache__/constructor.cpython-312.pyc,, +sympy/polys/__pycache__/densearith.cpython-312.pyc,, +sympy/polys/__pycache__/densebasic.cpython-312.pyc,, +sympy/polys/__pycache__/densetools.cpython-312.pyc,, +sympy/polys/__pycache__/dispersion.cpython-312.pyc,, +sympy/polys/__pycache__/distributedmodules.cpython-312.pyc,, +sympy/polys/__pycache__/domainmatrix.cpython-312.pyc,, +sympy/polys/__pycache__/euclidtools.cpython-312.pyc,, +sympy/polys/__pycache__/factortools.cpython-312.pyc,, +sympy/polys/__pycache__/fglmtools.cpython-312.pyc,, +sympy/polys/__pycache__/fields.cpython-312.pyc,, +sympy/polys/__pycache__/galoistools.cpython-312.pyc,, +sympy/polys/__pycache__/groebnertools.cpython-312.pyc,, +sympy/polys/__pycache__/heuristicgcd.cpython-312.pyc,, +sympy/polys/__pycache__/modulargcd.cpython-312.pyc,, +sympy/polys/__pycache__/monomials.cpython-312.pyc,, +sympy/polys/__pycache__/multivariate_resultants.cpython-312.pyc,, +sympy/polys/__pycache__/orderings.cpython-312.pyc,, +sympy/polys/__pycache__/orthopolys.cpython-312.pyc,, +sympy/polys/__pycache__/partfrac.cpython-312.pyc,, +sympy/polys/__pycache__/polyclasses.cpython-312.pyc,, +sympy/polys/__pycache__/polyconfig.cpython-312.pyc,, +sympy/polys/__pycache__/polyerrors.cpython-312.pyc,, +sympy/polys/__pycache__/polyfuncs.cpython-312.pyc,, +sympy/polys/__pycache__/polymatrix.cpython-312.pyc,, +sympy/polys/__pycache__/polyoptions.cpython-312.pyc,, +sympy/polys/__pycache__/polyquinticconst.cpython-312.pyc,, +sympy/polys/__pycache__/polyroots.cpython-312.pyc,, +sympy/polys/__pycache__/polytools.cpython-312.pyc,, +sympy/polys/__pycache__/polyutils.cpython-312.pyc,, +sympy/polys/__pycache__/puiseux.cpython-312.pyc,, +sympy/polys/__pycache__/rationaltools.cpython-312.pyc,, +sympy/polys/__pycache__/ring_series.cpython-312.pyc,, +sympy/polys/__pycache__/rings.cpython-312.pyc,, +sympy/polys/__pycache__/rootisolation.cpython-312.pyc,, +sympy/polys/__pycache__/rootoftools.cpython-312.pyc,, +sympy/polys/__pycache__/solvers.cpython-312.pyc,, +sympy/polys/__pycache__/specialpolys.cpython-312.pyc,, +sympy/polys/__pycache__/sqfreetools.cpython-312.pyc,, +sympy/polys/__pycache__/subresultants_qq_zz.cpython-312.pyc,, +sympy/polys/agca/__init__.py,sha256=fahpWoG_0LgoqOXBnDBJS16Jj1fE1_VKG7edM3qZ2HE,130 +sympy/polys/agca/__pycache__/__init__.cpython-312.pyc,, +sympy/polys/agca/__pycache__/extensions.cpython-312.pyc,, +sympy/polys/agca/__pycache__/homomorphisms.cpython-312.pyc,, +sympy/polys/agca/__pycache__/ideals.cpython-312.pyc,, +sympy/polys/agca/__pycache__/modules.cpython-312.pyc,, +sympy/polys/agca/extensions.py,sha256=YmtFs9C0s-4DNMXFtdX1hYVNlby18mAJzhJ5Aqickrw,9388 +sympy/polys/agca/homomorphisms.py,sha256=gaMNV96pKUuYHZ8Bd7QOs27J1IbbJgkEjyWcTLe8GFI,21937 +sympy/polys/agca/ideals.py,sha256=S6rBl3H-hdeI44ZbELwjjt1rKlrhK11AKb8Aas-OtCE,11073 +sympy/polys/agca/modules.py,sha256=PeA138FHsCfUn8vkdrjPa92xmzq7Qqk0PrdYwVoNqf0,47240 +sympy/polys/agca/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/polys/agca/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/polys/agca/tests/__pycache__/test_extensions.cpython-312.pyc,, +sympy/polys/agca/tests/__pycache__/test_homomorphisms.cpython-312.pyc,, +sympy/polys/agca/tests/__pycache__/test_ideals.cpython-312.pyc,, +sympy/polys/agca/tests/__pycache__/test_modules.cpython-312.pyc,, +sympy/polys/agca/tests/test_extensions.py,sha256=i3IHQNXQByFMCvjjyd_hwwJSCiUj0z1rRwS9WFK2AFc,6455 +sympy/polys/agca/tests/test_homomorphisms.py,sha256=m0hFmcTzvZ8sZbbnWeENwzKyufpE9zWwZR-WCI4kdpU,4224 +sympy/polys/agca/tests/test_ideals.py,sha256=w76qXO-_HN6LQbV7l3h7gJZsM-DZ2io2X-kPWiHYRNw,3788 +sympy/polys/agca/tests/test_modules.py,sha256=HdfmcxdEVucEbtfmzVq8i_1wGojT5b5DE5VIfbTMx3k,13552 +sympy/polys/appellseqs.py,sha256=hWeDKsKnJuAuPN_5IU6m1okurAq9xMt3LQgMehcvBKQ,8305 +sympy/polys/benchmarks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/polys/benchmarks/__pycache__/__init__.cpython-312.pyc,, +sympy/polys/benchmarks/__pycache__/bench_galoispolys.cpython-312.pyc,, +sympy/polys/benchmarks/__pycache__/bench_groebnertools.cpython-312.pyc,, +sympy/polys/benchmarks/__pycache__/bench_solvers.cpython-312.pyc,, +sympy/polys/benchmarks/bench_galoispolys.py,sha256=8RtN9ZQga2oxscVPPkMGB29Dz8UbskMS2szYtqZ69u0,1502 +sympy/polys/benchmarks/bench_groebnertools.py,sha256=YqGDCzewRszCye_GnneDXMRNB38ORSpVu_Jn0ELIySo,803 +sympy/polys/benchmarks/bench_solvers.py,sha256=gLrZguh6pE0E4_vM2GeOS5bHnrcSUQXqD0Qz9tItfmo,446778 +sympy/polys/compatibility.py,sha256=ti_gJSz8zB1sf-oIyfXAw4xkDGkQaZs_34RSC-6HldY,58373 +sympy/polys/constructor.py,sha256=rv8hQgE8-P9QXUtOQmlEiyA4XD-fb1Qzd8bvH3UHQls,11373 +sympy/polys/densearith.py,sha256=6wB6DJWKNB0RA7Tdg7jMgRIERjZdtAp32OQhIQ6wmV4,34114 +sympy/polys/densebasic.py,sha256=Kag6cqlxHhHUMYUXpr9GHLWh4E1Mnw2Esoh6zx9r14E,35954 +sympy/polys/densetools.py,sha256=A0Z1E16eVx577zw84m8KZgT5o6dbDXXonW8TqfISJZY,29746 +sympy/polys/dispersion.py,sha256=s6GIYnGA6U9jhGP7YXQQS8G3byG4-kPbr55BR6p-iz4,5740 +sympy/polys/distributedmodules.py,sha256=t8pLIgDQs_dMecGXwybVYoLavofEy2DXhFS8N5gj5SU,21827 +sympy/polys/domainmatrix.py,sha256=FmNqklNFQR1WrQYtP2r7jypw2IQadNKGP14EaUaxUqI,310 +sympy/polys/domains/__init__.py,sha256=T6qPNkU1EJ6D5BnvyJSXJv4zeJ5MUT5RLsovMkkXS9E,1872 +sympy/polys/domains/__pycache__/__init__.cpython-312.pyc,, +sympy/polys/domains/__pycache__/algebraicfield.cpython-312.pyc,, +sympy/polys/domains/__pycache__/characteristiczero.cpython-312.pyc,, +sympy/polys/domains/__pycache__/complexfield.cpython-312.pyc,, +sympy/polys/domains/__pycache__/compositedomain.cpython-312.pyc,, +sympy/polys/domains/__pycache__/domain.cpython-312.pyc,, +sympy/polys/domains/__pycache__/domainelement.cpython-312.pyc,, +sympy/polys/domains/__pycache__/expressiondomain.cpython-312.pyc,, +sympy/polys/domains/__pycache__/expressionrawdomain.cpython-312.pyc,, +sympy/polys/domains/__pycache__/field.cpython-312.pyc,, +sympy/polys/domains/__pycache__/finitefield.cpython-312.pyc,, +sympy/polys/domains/__pycache__/fractionfield.cpython-312.pyc,, +sympy/polys/domains/__pycache__/gaussiandomains.cpython-312.pyc,, +sympy/polys/domains/__pycache__/gmpyfinitefield.cpython-312.pyc,, +sympy/polys/domains/__pycache__/gmpyintegerring.cpython-312.pyc,, +sympy/polys/domains/__pycache__/gmpyrationalfield.cpython-312.pyc,, +sympy/polys/domains/__pycache__/groundtypes.cpython-312.pyc,, +sympy/polys/domains/__pycache__/integerring.cpython-312.pyc,, +sympy/polys/domains/__pycache__/modularinteger.cpython-312.pyc,, +sympy/polys/domains/__pycache__/mpelements.cpython-312.pyc,, +sympy/polys/domains/__pycache__/old_fractionfield.cpython-312.pyc,, +sympy/polys/domains/__pycache__/old_polynomialring.cpython-312.pyc,, +sympy/polys/domains/__pycache__/polynomialring.cpython-312.pyc,, +sympy/polys/domains/__pycache__/pythonfinitefield.cpython-312.pyc,, +sympy/polys/domains/__pycache__/pythonintegerring.cpython-312.pyc,, +sympy/polys/domains/__pycache__/pythonrational.cpython-312.pyc,, +sympy/polys/domains/__pycache__/pythonrationalfield.cpython-312.pyc,, +sympy/polys/domains/__pycache__/quotientring.cpython-312.pyc,, +sympy/polys/domains/__pycache__/rationalfield.cpython-312.pyc,, +sympy/polys/domains/__pycache__/realfield.cpython-312.pyc,, +sympy/polys/domains/__pycache__/ring.cpython-312.pyc,, +sympy/polys/domains/__pycache__/simpledomain.cpython-312.pyc,, +sympy/polys/domains/algebraicfield.py,sha256=JXK_o6BdQbYT_0gOLALNOLsmqgfV46DRFJb7cANJgAM,23051 +sympy/polys/domains/characteristiczero.py,sha256=vHYRUXPrfJzDF8wrd1KSFqG8WzwfITP_eweA-SHPVYA,382 +sympy/polys/domains/complexfield.py,sha256=VbhX6yigmU2OLhof8qEpPp1XZhzzkfXfcuZevx1LZsk,6159 +sympy/polys/domains/compositedomain.py,sha256=DAo2ISA9XdOnYzFu8azuPIQAT9fyVwSM8Pe425vmvww,1642 +sympy/polys/domains/domain.py,sha256=aj9HOp98G2m25wRzSDj4lWzoRLGyXDsuevzScdHjV6o,40850 +sympy/polys/domains/domainelement.py,sha256=IrG-Mzv_VlCAmE-hmJVH_d77TrsfyaGGfJVmU8FFvlY,860 +sympy/polys/domains/expressiondomain.py,sha256=AB7Mnd6kOLaS_yG4lMXZTpVPUuAHGcrd6RAjjFSVxNc,7593 +sympy/polys/domains/expressionrawdomain.py,sha256=cXarD2jXi97FGNiqNiDqQlX0g764EW2M1PEbrveImnY,1448 +sympy/polys/domains/field.py,sha256=fR0l6wZIv02UMJ5rioEP910jGUViVx38EdwtJuJX5vg,2959 +sympy/polys/domains/finitefield.py,sha256=1DHkfrCz08KXLEz7in4IK71B8udHPZZAWv50-jV5_vQ,10654 +sympy/polys/domains/fractionfield.py,sha256=BoqUCbVggwaoqGCVy_r42MIVHuAV-P3gONFVZIlWojU,5848 +sympy/polys/domains/gaussiandomains.py,sha256=YrcHg4QSPgIRW-Ft8J84q1zwmU-DVJuAscWXnVCQ9CI,19598 +sympy/polys/domains/gmpyfinitefield.py,sha256=WgSLnALNOVVKH931WpVT28ZWDilsrTDG8DyMee2xR94,437 +sympy/polys/domains/gmpyintegerring.py,sha256=qJ7w8K40cfzhztZtOuWlIL2DXa642xJcKIIxoAOlcSs,3037 +sympy/polys/domains/gmpyrationalfield.py,sha256=dZjrfcWaUA-BHUtutzLOWPlOSNLYzBqSFeukER6L_bA,3178 +sympy/polys/domains/groundtypes.py,sha256=hAla27w5ekoJR_8c-1Yo8vrEgIIggPc615tfe1udc9A,2102 +sympy/polys/domains/integerring.py,sha256=4oy49xTi8hV6qh8CWUAoBcgn2aJqgqwyh7bZBsjGfwI,7442 +sympy/polys/domains/modularinteger.py,sha256=k6gskb0eypXdrKJRxR3l_75mVjmICGnaOy7FdRMwG8E,6042 +sympy/polys/domains/mpelements.py,sha256=PREDWq_WA5er2zzftt5Lg0opnWzyFBsIkLKcyGXUVz0,5042 +sympy/polys/domains/old_fractionfield.py,sha256=TUVxyL2fS4QF3kgyW5EGfkl91ir3S1klu08UfZr3GuI,6226 +sympy/polys/domains/old_polynomialring.py,sha256=KQcH58oHnHzOpDdWojZiLlHDqrAiUd4OAaBIZigqpyc,15982 +sympy/polys/domains/polynomialring.py,sha256=OLPcwkyrbkt5pNZ342o3Ziv9TCrlpU3h18s9R-cxqXI,6223 +sympy/polys/domains/pythonfinitefield.py,sha256=lWp266ErnuUPuo7k8ju3z2S5IresFInpJAl4Ihsq0pI,453 +sympy/polys/domains/pythonintegerring.py,sha256=EH5s6nwaxmeaScLER_FfqPdhyuJnbjtBslHmgyOyEPs,2962 +sympy/polys/domains/pythonrational.py,sha256=M3VUGODh3MLElePjYtjt9b02ReMThw-XXpuQTkohgNs,548 +sympy/polys/domains/pythonrationalfield.py,sha256=x8BPkGKj0WPuwJzN2py5l9aAjHaY4djv65c4tzUTr3Y,2295 +sympy/polys/domains/quotientring.py,sha256=2NOUkkbFj4514qkDUszl6hl1EQuPikn3QEoQ1sDobGI,5911 +sympy/polys/domains/rationalfield.py,sha256=D-pA-iHDHbOi6fivqSrJnfmH2JTrheKJQ9ZFXXN5ftM,5982 +sympy/polys/domains/realfield.py,sha256=OdLfE_9OVxvQlnQiT4faJxuB6dZwnXdIt-o-5wGYroA,6456 +sympy/polys/domains/ring.py,sha256=p66U2X58acSHLHxOTU6aJZ0Umdcu1qiGIUDtV8iJCD0,3236 +sympy/polys/domains/simpledomain.py,sha256=_K-Zz8Opf505r3eHSrbPAlnGiGSjY_O4Cwa4OTeOSoY,369 +sympy/polys/domains/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/polys/domains/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/polys/domains/tests/__pycache__/test_domains.cpython-312.pyc,, +sympy/polys/domains/tests/__pycache__/test_polynomialring.cpython-312.pyc,, +sympy/polys/domains/tests/__pycache__/test_quotientring.cpython-312.pyc,, +sympy/polys/domains/tests/test_domains.py,sha256=XJwTGPM-8W4Rn76-cec99rpUIDDjP-7HTFs7AKGNrEw,51028 +sympy/polys/domains/tests/test_polynomialring.py,sha256=8nNFKuQeicwiBk6pnqPLNk0cnI61iK8Dpl-TZifvORc,2895 +sympy/polys/domains/tests/test_quotientring.py,sha256=BYoq1CqI76RDSm0xQdp1v7Dv1n5sdcmes-b_y_AfW-0,1459 +sympy/polys/euclidtools.py,sha256=hAsNupzfR-07fTwFvTF2yDabyKMm_PLgFC8KX9c2CAo,41808 +sympy/polys/factortools.py,sha256=CupycipegP1IGCYPY9eY2T8f_6h4gmr6qId1A4UDJvk,43034 +sympy/polys/fglmtools.py,sha256=Z3VS_IKsZu1o3g22KPTIH1feNL8cTpieaNWvLuILmK4,4298 +sympy/polys/fields.py,sha256=RdSDkOls6n87yvHG1KXFnGng0JS3SAcUAlz4tTb1RZE,21250 +sympy/polys/galoistools.py,sha256=Z3ed_A0Nohj9RzuM3kom7-ay4MnzIHppwgV2QpONuTo,57238 +sympy/polys/groebnertools.py,sha256=NhK-XcFR9e4chDDJJ-diXb7XYuw9zcixFA_riomThPM,23342 +sympy/polys/heuristicgcd.py,sha256=rD3intgKCtAAMH3sqlgqbJL1XSq9QjfeG_MYzwCOek0,3732 +sympy/polys/matrices/__init__.py,sha256=ZaPJMi8l22d3F3rudS4NqzSt0xwxbs3uwnQwlhhR91o,397 +sympy/polys/matrices/__pycache__/__init__.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/_dfm.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/_typing.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/ddm.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/dense.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/dfm.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/domainmatrix.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/domainscalar.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/eigen.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/exceptions.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/linsolve.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/lll.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/normalforms.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/rref.cpython-312.pyc,, +sympy/polys/matrices/__pycache__/sdm.cpython-312.pyc,, +sympy/polys/matrices/_dfm.py,sha256=_3p5Hb9e86uBG_r__Ee6BAZxj4KiRhcf2uN3XnjHxwQ,32971 +sympy/polys/matrices/_typing.py,sha256=Egp2nMOaq-oJCW0bgNDxy1Bx6evTl8eMTpf4mzIw1s4,407 +sympy/polys/matrices/ddm.py,sha256=eMKUy8X1kQTEG1l7Fx_L4LG9Jqs9l0KEwlYQwlcl6Do,32362 +sympy/polys/matrices/dense.py,sha256=RYdogVHeWZoeO94Oal1mf1sJvj-JmyS_baRi8-d9Rms,23217 +sympy/polys/matrices/dfm.py,sha256=Fj_uF4FskrwcBDNuRSV--AozCP2cYkUz-BMitcMlkRE,1241 +sympy/polys/matrices/domainmatrix.py,sha256=MvjWRzQ4lKzX2rCl8mRtpiIXSe641_x6OMrTr8iscPA,115928 +sympy/polys/matrices/domainscalar.py,sha256=sPXC-it46yun2r_tJkun4MIuVQQyQMQTVsTedId8Rj4,3778 +sympy/polys/matrices/eigen.py,sha256=glArxs9_rTrE_ssz2fd2gKCTsguSyEHwoeQP82tmIcM,3015 +sympy/polys/matrices/exceptions.py,sha256=ay3Lv21X3QqszysBN71xdr9KGQuC5kDBl90a2Sjx6pM,1351 +sympy/polys/matrices/linsolve.py,sha256=p86jlJP9h3CxZX92xk2sh1WAvKBkB5_YD55k1oYpmGI,7534 +sympy/polys/matrices/lll.py,sha256=p5q_rb5QvAuHsGRZAzP2Jf_h2vdC_Be4Q62lkaYxW-c,3550 +sympy/polys/matrices/normalforms.py,sha256=6MJfVbiwlZuCk-0fYiyOMuqkPdVpyzTNdDP2s6jkRw0,17122 +sympy/polys/matrices/rref.py,sha256=5YK_phB382K9JFVIydlH2IYpziirEDUnKzyl5BfS2_o,15532 +sympy/polys/matrices/sdm.py,sha256=bb2fIO42KjyJuEuMBkiDFn_qLJVjD4gsRgWZ6GOmTHw,64293 +sympy/polys/matrices/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/polys/matrices/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_ddm.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_dense.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_domainmatrix.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_domainscalar.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_eigen.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_fflu.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_inverse.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_linsolve.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_lll.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_normalforms.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_nullspace.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_rref.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_sdm.cpython-312.pyc,, +sympy/polys/matrices/tests/__pycache__/test_xxm.cpython-312.pyc,, +sympy/polys/matrices/tests/test_ddm.py,sha256=BcnUntz3XR2Xyff02l4Mk2EsxwYlIBzM4lFSRo9oZT8,16699 +sympy/polys/matrices/tests/test_dense.py,sha256=ETC2h5yLKsPJ5GAgx_RUcWyR63iZx81pbtOZiWty1r0,9516 +sympy/polys/matrices/tests/test_domainmatrix.py,sha256=4QttFR5PYJg6Xn37VXdxmv1w9Xkm82fF-M-KRQIe0RU,50006 +sympy/polys/matrices/tests/test_domainscalar.py,sha256=HEFEKX5tP6SZ83_91nvLmFqgHxbVdpqOP4ZwzfFbHnc,3740 +sympy/polys/matrices/tests/test_eigen.py,sha256=T1lYZeW-0NwDxDOG6ZJLr-OICfxY2wa0fVHV2V6EXSk,3200 +sympy/polys/matrices/tests/test_fflu.py,sha256=7En_75QemdtHvR7lUyZrcHiV9Dv2rswBuuKVOPWi1pk,8542 +sympy/polys/matrices/tests/test_inverse.py,sha256=5DT5qvfS3MlrgNgeHnG8GLjgLnmhsxj94yR3cbtmEO8,5247 +sympy/polys/matrices/tests/test_linsolve.py,sha256=ur1BFzlIQyBrO_-aL71lXsLC67nfec9G5o-mzW_TFY4,3373 +sympy/polys/matrices/tests/test_lll.py,sha256=RGYTDGbLfFvAMTESv-S1kqSWzwtOIjmguqXO3yGCjH4,6624 +sympy/polys/matrices/tests/test_normalforms.py,sha256=x1-vkjXq3LGblUSJFz7z73IVmaxqZbVzWoGj9XS-yXw,5106 +sympy/polys/matrices/tests/test_nullspace.py,sha256=eAEDPlnVkKfFM9jn1gztOUQTos1Sm9qwH10C-t9uLUE,5418 +sympy/polys/matrices/tests/test_rref.py,sha256=mWTIfKAUP3vkGKhffCrPHuC_0DdF-iH41cchlSN8Pqc,25982 +sympy/polys/matrices/tests/test_sdm.py,sha256=fSE3bQlDU-atzTFTgp4AgAS3QL-7rvb_61stj3QGBnU,13415 +sympy/polys/matrices/tests/test_xxm.py,sha256=X9sP_VfPi4bUR7V1ZLq6ZHXPOBUA7tE5-gQULang_Ag,29778 +sympy/polys/modulargcd.py,sha256=gOwojISiV8IncaEHZJZMHOC1odN7xRKN5L1Ls4szROI,58729 +sympy/polys/monomials.py,sha256=6cDCTVNNPDeee5bt0RQnGuYnsO_fefioHA5mEDKHSuA,18458 +sympy/polys/multivariate_resultants.py,sha256=6bwdF-lcUqtKoVDrnOKhm_PyPfo8w0Yyy_GtESatQFw,15248 +sympy/polys/numberfields/__init__.py,sha256=ZfhC9MyfGfGUz_DT_rXasB-M_P2zUiZXOJUNh_Gtm8c,538 +sympy/polys/numberfields/__pycache__/__init__.cpython-312.pyc,, +sympy/polys/numberfields/__pycache__/basis.cpython-312.pyc,, +sympy/polys/numberfields/__pycache__/exceptions.cpython-312.pyc,, +sympy/polys/numberfields/__pycache__/galois_resolvents.cpython-312.pyc,, +sympy/polys/numberfields/__pycache__/galoisgroups.cpython-312.pyc,, +sympy/polys/numberfields/__pycache__/minpoly.cpython-312.pyc,, +sympy/polys/numberfields/__pycache__/modules.cpython-312.pyc,, +sympy/polys/numberfields/__pycache__/primes.cpython-312.pyc,, +sympy/polys/numberfields/__pycache__/resolvent_lookup.cpython-312.pyc,, +sympy/polys/numberfields/__pycache__/subfield.cpython-312.pyc,, +sympy/polys/numberfields/__pycache__/utilities.cpython-312.pyc,, +sympy/polys/numberfields/basis.py,sha256=IPA6cSwz-53ClQwo-wkmRzfx9pRX4iBhiggdLMVSgJ0,8261 +sympy/polys/numberfields/exceptions.py,sha256=kHb-aB4eBzG3SsIpYtL5wLExDSb8lIOpNq0tk3guFIA,1594 +sympy/polys/numberfields/galois_resolvents.py,sha256=OL3u-G6sCwvZuBuuYQO0QpL-wWxtjxFaBjVQhtiQ_Z8,25006 +sympy/polys/numberfields/galoisgroups.py,sha256=c4s6z_mEUkoWKezFrfjKiU2tZnEnxR4m1LYaagicVno,20671 +sympy/polys/numberfields/minpoly.py,sha256=0F7QVSOk8WqViD50jKtT-94C6kQyuXPBCyNZPTf0ScA,27791 +sympy/polys/numberfields/modules.py,sha256=4MJykT6gtT_LC033LWsHT_CM7nEydLISAdQ0yA_bhkQ,69243 +sympy/polys/numberfields/primes.py,sha256=UXOkuMdnamVvHPQZxwilCbhdwNNNS7zQ4bwSFc5xGgk,23984 +sympy/polys/numberfields/resolvent_lookup.py,sha256=qfLNKOz_WjtXwpVlfzy8EkD4gw12epx9npE9HsjyIdg,40411 +sympy/polys/numberfields/subfield.py,sha256=Huh9iq2CDQN8p0fs2bSe-yEoB_V1OVr8rH58rJT4crk,16668 +sympy/polys/numberfields/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/polys/numberfields/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/polys/numberfields/tests/__pycache__/test_basis.cpython-312.pyc,, +sympy/polys/numberfields/tests/__pycache__/test_galoisgroups.cpython-312.pyc,, +sympy/polys/numberfields/tests/__pycache__/test_minpoly.cpython-312.pyc,, +sympy/polys/numberfields/tests/__pycache__/test_modules.cpython-312.pyc,, +sympy/polys/numberfields/tests/__pycache__/test_numbers.cpython-312.pyc,, +sympy/polys/numberfields/tests/__pycache__/test_primes.cpython-312.pyc,, +sympy/polys/numberfields/tests/__pycache__/test_subfield.cpython-312.pyc,, +sympy/polys/numberfields/tests/__pycache__/test_utilities.cpython-312.pyc,, +sympy/polys/numberfields/tests/test_basis.py,sha256=96BJ7e4oPDKXyvlRrUkiQxmHyjRGpOkAC7R3ln-jgNE,4580 +sympy/polys/numberfields/tests/test_galoisgroups.py,sha256=3LFuMbV92VBFlqqEqjh37oQvmG8cgZ0pFxDCXUoYRL4,5036 +sympy/polys/numberfields/tests/test_minpoly.py,sha256=HjlmPWX90Cb-XK5G1H0-uirOiHdgTu7R8qpcG5ZI5iw,23115 +sympy/polys/numberfields/tests/test_modules.py,sha256=GU4166j_hMlB22uWxxIjV_ON8RsyvpaN7Ly3eK8_m8Y,22926 +sympy/polys/numberfields/tests/test_numbers.py,sha256=M0vZIBnjPBHV4vFUnPBILaqiR_cgSuU50kFB-v7l1gA,5988 +sympy/polys/numberfields/tests/test_primes.py,sha256=JhcAkaQMgjkOSziQ2jZApJ8b8oviil5cUy0hfFqNmZg,9779 +sympy/polys/numberfields/tests/test_subfield.py,sha256=EpBexToc17YwLB4-n6nE_HaleU8AcFGi5OpDReW7q0k,12776 +sympy/polys/numberfields/tests/test_utilities.py,sha256=rQGEJWctcfzjUtMwRuyCHerSqEsoP5C3z1bnddJA17o,3661 +sympy/polys/numberfields/utilities.py,sha256=IHKmfafE9tMGammfdtkyR4_IHb0mON-OBwitE0Ss1R0,13087 +sympy/polys/orderings.py,sha256=IFieyj4LkFa7NDiGTZD3VwUY7mSN3GEjThKk0z5WJ1s,8500 +sympy/polys/orthopolys.py,sha256=PIJg_Kml8MxmJs5QPCjGmRLjjlE_4QKhsWhU7-an7x0,10181 +sympy/polys/partfrac.py,sha256=ptYpXsp8dYyyeiPnLU-rdQ-uv3-GAvDnN79E81C68y8,14695 +sympy/polys/polyclasses.py,sha256=Zc9sjiwVxsM6wM8h9KCFP2Pjlfl4XA3MjC6NlguQzqM,96529 +sympy/polys/polyconfig.py,sha256=mgfFpp9SU159tA_PM2o04WZyzMoWfOtWZugRcHnP42c,1598 +sympy/polys/polyerrors.py,sha256=xByI-fqIHVYsYRm63NmHXlSSRCwSI9vZUoO-1Mf5Wlk,4744 +sympy/polys/polyfuncs.py,sha256=OEZpdYeHQADBJYqMw8JAyN4sw-jsJ6lzVH6m-CCoK8g,8547 +sympy/polys/polymatrix.py,sha256=iNa-EyIrzv7ZeXMaP_PjojgNd29AnIotZE3NeF2te44,9771 +sympy/polys/polyoptions.py,sha256=yG1k4ZPN2ufwpZ4lI4Sn8DSIHvd7EwDUHUaz64HxlUM,21806 +sympy/polys/polyquinticconst.py,sha256=mYLFWSBq3H3Y0I8cx76Z_xauLx1YeViC4xF6yWsSTPQ,96035 +sympy/polys/polyroots.py,sha256=bJToZlR6WZNl9fNxkIJxiPt3XoDQ_K6Pb3UOCBPfsKM,37025 +sympy/polys/polytools.py,sha256=BUwK8wJApazWeKQ3t27yg-HTMnwiv9ScPiavk2n02Rk,212876 +sympy/polys/polyutils.py,sha256=M8V-D4NkfMlsJe4LeAZzljrM4BKp10Qvuuutd8kmp3E,17248 +sympy/polys/puiseux.py,sha256=wc_5w5RyXHfAwC9Dde-6ecPm9y1z5DAmfthtSZ53CqA,26518 +sympy/polys/rationaltools.py,sha256=8vbkg3nuBxbd4ztR7lOj2jTF9taKUKTPah_fD38Ex6c,2838 +sympy/polys/ring_series.py,sha256=7DijmljyAaQrupWB0JmaNwGm3wNTstnEsBln-o1uX1M,59877 +sympy/polys/rings.py,sha256=KVdA3C04G2H3YN81rM-8ORsUHqmktIrz0S0tfwLwN4g,86080 +sympy/polys/rootisolation.py,sha256=QKCYgD4kMNBtSLYkUim8MXHa7louMtlO0riwKTiXRRI,64341 +sympy/polys/rootoftools.py,sha256=bMcVUcIwqaM643UU1WTCNmPmDFRepZEq9Xfdr9mm63Q,43092 +sympy/polys/solvers.py,sha256=FareKqDVVC6P2I4yjudi_3CS3kx0SbmAz3k7zHkETgE,13520 +sympy/polys/specialpolys.py,sha256=B2vijl75zgUKUTY1HCqjB9BTDFf3FM8ugwkKGTB83XA,11038 +sympy/polys/sqfreetools.py,sha256=oRFlOLhcXz5OKjc9SQtOuEhMvacvkHyTSEqhk6Snh1Y,19876 +sympy/polys/subresultants_qq_zz.py,sha256=VFKTAe3iGMCimLkc9GeuwG5o4SB0x2T5kRwxe4A5BDo,88241 +sympy/polys/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/polys/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_appellseqs.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_constructor.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_densearith.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_densebasic.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_densetools.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_dispersion.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_distributedmodules.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_euclidtools.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_factortools.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_fields.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_galoistools.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_groebnertools.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_heuristicgcd.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_hypothesis.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_injections.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_modulargcd.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_monomials.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_multivariate_resultants.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_orderings.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_orthopolys.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_partfrac.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_polyclasses.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_polyfuncs.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_polymatrix.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_polyoptions.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_polyroots.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_polytools.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_polyutils.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_puiseux.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_pythonrational.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_rationaltools.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_ring_series.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_rings.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_rootisolation.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_rootoftools.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_solvers.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_specialpolys.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_sqfreetools.cpython-312.pyc,, +sympy/polys/tests/__pycache__/test_subresultants_qq_zz.cpython-312.pyc,, +sympy/polys/tests/test_appellseqs.py,sha256=YTERuRr30QtfxYR0erXvJG8D-INe9RaMFAF0ZM-H4Ks,3820 +sympy/polys/tests/test_constructor.py,sha256=t6JpLbIdy2hcHF4_s_Xiav0kVc4OOsH5EFg6IXOiwmI,7220 +sympy/polys/tests/test_densearith.py,sha256=ptFGN7ovPH3dqT5khr6Wm8CR6a1WOR7Fi8dj8SuBvJs,40827 +sympy/polys/tests/test_densebasic.py,sha256=FcjAfZngYRQSWJ__BrBPITAUYjMNkS_pOtGyuJv_Bs0,21590 +sympy/polys/tests/test_densetools.py,sha256=o7HZfOw4Xn71RpCDhk98srNipA3zXfikAP_lV0gShlM,26241 +sympy/polys/tests/test_dispersion.py,sha256=S3diTgz7WKH88ulGNT3ijiQ8Y53Rpul6jATBJMGyQdw,3182 +sympy/polys/tests/test_distributedmodules.py,sha256=dXmjhozX5Yzb7DsrtbdFTqAxi9Z1UZNJvGxj-vHM7cM,7639 +sympy/polys/tests/test_euclidtools.py,sha256=vEyj48eIjm6-KRQtThNfI4ic_VDNB6l7jMouxJAF9HE,19482 +sympy/polys/tests/test_factortools.py,sha256=K5_R-01Muc_45XOtolk_tQswE2l6tGrlOJ9zA_aNVYE,24903 +sympy/polys/tests/test_fields.py,sha256=DUvcax7WGtydkLDXq0aQ9Ksc6PkdV67NPZCvqTYN2w8,9869 +sympy/polys/tests/test_galoistools.py,sha256=0oN3eSWvV99juZSXco6Ek9n6s6BFOmOE4UIEhyZnQQs,28532 +sympy/polys/tests/test_groebnertools.py,sha256=ZWHBcCCOVNwDxuJWg1WPo0krTHx1m1wTPi2cOYPsAT4,18584 +sympy/polys/tests/test_heuristicgcd.py,sha256=87Yc0on955VExFyOgJuxBZhsIMFz1Vq4vclIVkQ--cE,4297 +sympy/polys/tests/test_hypothesis.py,sha256=LdokFa3JrQ59_umY15x21QSScPjJoCl8RxHRfn1NUOc,1109 +sympy/polys/tests/test_injections.py,sha256=EONGggBUNWaVSwi817CzLBYJgkTehFq8-m-Qdqes984,1286 +sympy/polys/tests/test_modulargcd.py,sha256=2SjCEjCPkf1-u-Co5vuVg5sJmfBLSY3gkFLicLl4g6E,9043 +sympy/polys/tests/test_monomials.py,sha256=YcMBU1qe6g7EJojtV89dfJZmdXsXVTSly2J5cF6SD6o,11083 +sympy/polys/tests/test_multivariate_resultants.py,sha256=DJu8CcZ3xwx8njpjDeSOyhyxeqZYmhfb7dkSCU-ll7Y,9501 +sympy/polys/tests/test_orderings.py,sha256=bdsIsqJTFJCVyZNRMAGVDXVk79ldw9rmAGejS_lwKP0,4254 +sympy/polys/tests/test_orthopolys.py,sha256=Ob5Osxd8hwebEjK3dDMarZ2VDXzl3pdsEdz_-kMa80M,6560 +sympy/polys/tests/test_partfrac.py,sha256=VfWOx30fZu_avMbWqxtbLDcLi-9x6iuQmLfyatnFc3Y,7838 +sympy/polys/tests/test_polyclasses.py,sha256=EuoT3b9a9KRTQFe95MjGrQIqAhRgLG5qUo42FtkM-Js,14765 +sympy/polys/tests/test_polyfuncs.py,sha256=VbgCgCRE06dtSY9I9GSdPH9T52ETYYoxk4J3N1WBtd4,4520 +sympy/polys/tests/test_polymatrix.py,sha256=pl2VrN_d2XGOVHvvAnaNQzkdFTdQgjt9ePgo41soBRs,7353 +sympy/polys/tests/test_polyoptions.py,sha256=z9DUdt8K3lYkm4IyLH1Cv-TKe76HP-EyaRkZVsfWb6U,12416 +sympy/polys/tests/test_polyroots.py,sha256=m0rnjXMqX59XdFn9X4rRtZJjI39vBN-MAt9cpQszq-I,26803 +sympy/polys/tests/test_polytools.py,sha256=JfaZlcguRIh6ZVNpkIUc2sSRJX_Hq6aluW7HxjCDWO4,139212 +sympy/polys/tests/test_polyutils.py,sha256=Qs3QQl0WYmTnkYE2ovTxdLeu6DYnWO_OoUmLwNDZzSw,11547 +sympy/polys/tests/test_puiseux.py,sha256=4PnBdJuYDWku8l6Jg2Dsn7umg14ldYBdvHqtVaaELbE,7304 +sympy/polys/tests/test_pythonrational.py,sha256=vYMlOTuYvf-15P0nKTFm-uRrhUc-nCFEkqYFAPLxg08,4143 +sympy/polys/tests/test_rationaltools.py,sha256=wkvjzNP1IH-SdubNk5JJ7OWcY-zNF6z3t32kfp9Ncs0,2397 +sympy/polys/tests/test_ring_series.py,sha256=j88HGfiJ9ZL114UezdJtC5aWtox8RG0I2Qyq9gLnkCE,31697 +sympy/polys/tests/test_rings.py,sha256=q8A_CeerrzGqVf1Ol-O-Jc-R7q-2X119YSNMnds3Ccs,48735 +sympy/polys/tests/test_rootisolation.py,sha256=x-n-T-Con-8phelNa05BPszkC_UCW1C0yAOwz658I60,32724 +sympy/polys/tests/test_rootoftools.py,sha256=1cv7M6EQ3mK7NhcwKqbIvour1l_QYtW_zr6vyZ3rzs0,23414 +sympy/polys/tests/test_solvers.py,sha256=kKyEvmqt91HHuAV42DS26B8fPDFQ2Ghtb_Nf3-1eWyI,13644 +sympy/polys/tests/test_specialpolys.py,sha256=v1i0RMNlixxe2EbwqoE-UlV7a2KY-md4T7thhUhWSx0,5031 +sympy/polys/tests/test_sqfreetools.py,sha256=m8ipJE28YC9eOrsVVAqxduCsw4iOW-s_nw76y0E8wUs,4886 +sympy/polys/tests/test_subresultants_qq_zz.py,sha256=bSFOjbtyIClbJHLDvvzgmOgoZyC_5Vdpe7vtW9VGU_s,13219 +sympy/printing/__init__.py,sha256=Hh-z1idh92pk17XjdXkjYwb8cJ5coEr4ZJQGcpE3d9I,2215 +sympy/printing/__pycache__/__init__.cpython-312.pyc,, +sympy/printing/__pycache__/aesaracode.cpython-312.pyc,, +sympy/printing/__pycache__/c.cpython-312.pyc,, +sympy/printing/__pycache__/codeprinter.cpython-312.pyc,, +sympy/printing/__pycache__/conventions.cpython-312.pyc,, +sympy/printing/__pycache__/cxx.cpython-312.pyc,, +sympy/printing/__pycache__/defaults.cpython-312.pyc,, +sympy/printing/__pycache__/dot.cpython-312.pyc,, +sympy/printing/__pycache__/fortran.cpython-312.pyc,, +sympy/printing/__pycache__/glsl.cpython-312.pyc,, +sympy/printing/__pycache__/gtk.cpython-312.pyc,, +sympy/printing/__pycache__/jscode.cpython-312.pyc,, +sympy/printing/__pycache__/julia.cpython-312.pyc,, +sympy/printing/__pycache__/lambdarepr.cpython-312.pyc,, +sympy/printing/__pycache__/latex.cpython-312.pyc,, +sympy/printing/__pycache__/llvmjitcode.cpython-312.pyc,, +sympy/printing/__pycache__/maple.cpython-312.pyc,, +sympy/printing/__pycache__/mathematica.cpython-312.pyc,, +sympy/printing/__pycache__/mathml.cpython-312.pyc,, +sympy/printing/__pycache__/numpy.cpython-312.pyc,, +sympy/printing/__pycache__/octave.cpython-312.pyc,, +sympy/printing/__pycache__/precedence.cpython-312.pyc,, +sympy/printing/__pycache__/preview.cpython-312.pyc,, +sympy/printing/__pycache__/printer.cpython-312.pyc,, +sympy/printing/__pycache__/pycode.cpython-312.pyc,, +sympy/printing/__pycache__/python.cpython-312.pyc,, +sympy/printing/__pycache__/pytorch.cpython-312.pyc,, +sympy/printing/__pycache__/rcode.cpython-312.pyc,, +sympy/printing/__pycache__/repr.cpython-312.pyc,, +sympy/printing/__pycache__/rust.cpython-312.pyc,, +sympy/printing/__pycache__/smtlib.cpython-312.pyc,, +sympy/printing/__pycache__/str.cpython-312.pyc,, +sympy/printing/__pycache__/tableform.cpython-312.pyc,, +sympy/printing/__pycache__/tensorflow.cpython-312.pyc,, +sympy/printing/__pycache__/theanocode.cpython-312.pyc,, +sympy/printing/__pycache__/tree.cpython-312.pyc,, +sympy/printing/aesaracode.py,sha256=_iHvF9avR9MGiOnxLIwog2M5rUwhLRt-bdsbcJHeO_s,18921 +sympy/printing/c.py,sha256=qX8EkxVT5Z2Hncz8DJh8iar_jBuVcRDEiIt1d6jcerE,27011 +sympy/printing/codeprinter.py,sha256=QUAWM6H45YBkd7fX6jXXO3j-tfVaHhzxbXn7OnSm0Es,42371 +sympy/printing/conventions.py,sha256=hvN1VMZE5krMj8FL4AAuxAO0xCwhAugBFWrFQ0355AY,2586 +sympy/printing/cxx.py,sha256=vCQyzT-1eNLLDJy4NBwCp5X5OCoPOZ9icsx8YifaPsc,6123 +sympy/printing/defaults.py,sha256=YitLfIRfFH8ltNd18Y6YtBgq5H2te0wFKlHuIO4cvo8,135 +sympy/printing/dot.py,sha256=W0J798ZxBdlJercffBGnNDTp7J2tMdIYQkE_KIiyi3s,8274 +sympy/printing/fortran.py,sha256=zHVQMphFeeIGl-1x29Hw5Lekxi5NWou-V3Kn4O0oHQQ,28635 +sympy/printing/glsl.py,sha256=wsjPcpyzk92m4I2_re0cn3JwEjPmRlmlVWX9owhzM5w,20310 +sympy/printing/gtk.py,sha256=ptnwYxJr5ox3LG4TCDbRIgxsCikaVvEzWBaqIpITUXc,466 +sympy/printing/jscode.py,sha256=BORODo9Aio62FKh1HYlluG-IxtJC26_-IWrxAiEtmr8,11981 +sympy/printing/julia.py,sha256=V_Qbld0MOebIkT4VnmyP6VdIbgrPaqllgjkv7eSq8bk,23541 +sympy/printing/lambdarepr.py,sha256=BCx4eSdG8MQ8ZSUV1lWEd3CzbZ4IiMid-TTxPoV6FHU,8305 +sympy/printing/latex.py,sha256=jCqXe1XOWLNUcRNzsHOY3CMvbkPBKjf8tD4ii6PVKxU,123669 +sympy/printing/llvmjitcode.py,sha256=NjjHbgheH4j6SboFIDfrrIogkcrJRkW_kjlzM8DpDmQ,17127 +sympy/printing/maple.py,sha256=aG7t4RUEVojSFBVA14GDBzU702KtTcolTCelXozNiN0,10571 +sympy/printing/mathematica.py,sha256=to8LmNkhiP0ACh-Vun-hfaMnLFSEc0mF2OmZnQmihE8,12720 +sympy/printing/mathml.py,sha256=UT7g45oLTqvnrC1IUZeqywHTV6-LUClfuOF_U4AMlaI,76634 +sympy/printing/numpy.py,sha256=Kpq-ySkQSRKYCxtgQZEi_4lj3EmK7FgvbDJTzvB77Tc,21049 +sympy/printing/octave.py,sha256=1ofeBaIcoJfgzImezfPed9Z4dZ6Tk5gVbEQbr02TcLI,25469 +sympy/printing/precedence.py,sha256=hKIin20F4LJp2l5yhSQ-WAegTRHYQLhccABC1_ciI-U,5522 +sympy/printing/pretty/__init__.py,sha256=pJTe-DO4ctTlnjg1UvqyoeBY50B5znFjcGvivXRhM2U,344 +sympy/printing/pretty/__pycache__/__init__.cpython-312.pyc,, +sympy/printing/pretty/__pycache__/pretty.cpython-312.pyc,, +sympy/printing/pretty/__pycache__/pretty_symbology.cpython-312.pyc,, +sympy/printing/pretty/__pycache__/stringpict.cpython-312.pyc,, +sympy/printing/pretty/pretty.py,sha256=KmEXRb6XEtI5tiQYssueibKKrJVF1F1mwrF1uHGxmpM,105024 +sympy/printing/pretty/pretty_symbology.py,sha256=v4FyDz_03mbSGX7tGni8Zw2L2qKTRGvmCIL85ttXg0s,24112 +sympy/printing/pretty/stringpict.py,sha256=UbG55kC4ve8-Dby_v0cm8AXUdLcu4YDLXVnA8F_iV8Y,19158 +sympy/printing/pretty/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/printing/pretty/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/printing/pretty/tests/__pycache__/test_pretty.cpython-312.pyc,, +sympy/printing/pretty/tests/test_pretty.py,sha256=K2Xt--ptdxWLuUmtYJnuyh81ZrGIDRqNM_iOUADAdjA,187716 +sympy/printing/preview.py,sha256=3KacgHEch3KKJZeKc7kvD-L4pfftI8Gm62fx9-Vipak,14089 +sympy/printing/printer.py,sha256=z1phdIHrrcU2cyD-1GaBXREmhkcVl8bxeIWZrGAlczg,15868 +sympy/printing/pycode.py,sha256=LsDnREZEJVw0zsy_AjRSkYER-acomwQiDicrWBmnoW8,27048 +sympy/printing/python.py,sha256=oxGJhNQUXRKjHSEgqroGAyB-A4ZgJQqA_o7C8uXA1U8,3347 +sympy/printing/pytorch.py,sha256=HXEAoLbgbuE-SYj0hvDHeJ0zgzOVDBkK5qWErLCJhNo,10620 +sympy/printing/rcode.py,sha256=uBazXZwSRd95UUQjNoD6qLlpun7Xwlm8cfLG4qYhy3Y,14101 +sympy/printing/repr.py,sha256=GLO6WFOunZ8k0Om0g1VbGW2Y5uOP0IVEo_pIGO8HoNw,11545 +sympy/printing/rust.py,sha256=5Dh_zFxXZRVzbfHGowRQd9moUjzJZ7G2PXjxqsmBBw0,20831 +sympy/printing/smtlib.py,sha256=u2rVmprPITJdLq79FTYm7Fl-osteadr1JyXeQXlZW68,21752 +sympy/printing/str.py,sha256=dTK_CdT-Mm_zRoOL-Mwb4ocBA__h2wBFAAg6VvAiebQ,33239 +sympy/printing/tableform.py,sha256=pz4hXDLZ1IlqU8eOo0XBX1xaALYMqe4qHPUnEVq0mAE,11797 +sympy/printing/tensorflow.py,sha256=QmWoLUKpefBYJZ-J0Ei0NHHrU7Livp8Td4trWTDFzy8,8161 +sympy/printing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/printing/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_aesaracode.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_c.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_codeprinter.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_conventions.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_cupy.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_cxx.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_dot.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_fortran.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_glsl.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_gtk.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_jax.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_jscode.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_julia.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_lambdarepr.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_latex.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_llvmjit.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_maple.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_mathematica.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_mathml.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_numpy.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_octave.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_precedence.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_preview.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_pycode.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_python.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_rcode.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_repr.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_rust.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_smtlib.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_str.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_tableform.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_tensorflow.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_theanocode.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_torch.cpython-312.pyc,, +sympy/printing/tests/__pycache__/test_tree.cpython-312.pyc,, +sympy/printing/tests/test_aesaracode.py,sha256=dX-SKJHfx9m91NSlt7pQ5Gul0x7fig3XZsHCt2kvtRc,21340 +sympy/printing/tests/test_c.py,sha256=etIEgJwlGWxtH6VRYg3Zkjyw_ktYRYj_-mvEMQehmjI,31227 +sympy/printing/tests/test_codeprinter.py,sha256=rVimgQTdJchy7PsjdZupQmXfqi6FBme2BPwnz7Z5WeQ,2142 +sympy/printing/tests/test_conventions.py,sha256=yqPpU3F0WcbxImPBBAHd3YEZpkFGfcq_TLK4WN_gtP4,5257 +sympy/printing/tests/test_cupy.py,sha256=E2T4a82XITbWAssmRZD4zCQdMCrpaZFCAjGXthUp8cY,1882 +sympy/printing/tests/test_cxx.py,sha256=0XQPQdtDCgEKVfpuelEB-79f7d2fe9QPgEKCCYVAI_w,3183 +sympy/printing/tests/test_dot.py,sha256=TSAtgGIgK_JbY-RMbQgUvnAI87SJqeJOqzcLjAobhKM,4648 +sympy/printing/tests/test_fortran.py,sha256=d5uy1zp0IgaBPupzXpNuk169YZYygnodPWhNRcvUtAQ,35456 +sympy/printing/tests/test_glsl.py,sha256=cfog9fp_EOFm_piJwqUcSvAIJ78bRwkFjecwr3ocCak,28421 +sympy/printing/tests/test_gtk.py,sha256=94gp1xRlPrFiALQGuqHnmh9xKrMxR52RQVkN0MXbUdA,500 +sympy/printing/tests/test_jax.py,sha256=5sOhmFNadFAKT2FumDuk5UqgOc0e0cYkRnJTczClnG8,11062 +sympy/printing/tests/test_jscode.py,sha256=ObahZne9lQbBiXyJZLohjQGdHsG2CnWCFOB8KbFOAqQ,11369 +sympy/printing/tests/test_julia.py,sha256=7KSmbPi_0J2ZSL2fI_xLWqoR9Gy73LfNtzFANHS8EiM,14014 +sympy/printing/tests/test_lambdarepr.py,sha256=DMoIfRNmUkF0KUXoNnJ_skNPU42tJ2xlEvqCT2GxwaA,6947 +sympy/printing/tests/test_latex.py,sha256=xHG_gSlEsD-QkOIiHUyWE4zb0brJxwgwGs1jJBvvOA0,138061 +sympy/printing/tests/test_llvmjit.py,sha256=EGPeRisM60_TIVgnk7PTLSm5F-Aod_88zLjHPZwfyZ8,5344 +sympy/printing/tests/test_maple.py,sha256=dhcz2bqapB_qMyBLMgsgnvVRIcHQ-HmxvAxC_Y0Z3q8,13078 +sympy/printing/tests/test_mathematica.py,sha256=oNNTHZzHviNi_ckua2issBb05IS7GaYyluBJiCjhGoM,10954 +sympy/printing/tests/test_mathml.py,sha256=yVIJYHlFNLbt1qtbKrqjxB2P88dsD6AtS9EVsDi_vEw,99434 +sympy/printing/tests/test_numpy.py,sha256=JZwyiFUS7Vfiwn3j1ogF31PJLJRzH57dtEHq_ujV9wQ,11715 +sympy/printing/tests/test_octave.py,sha256=WOJpsuGhMYLw2ikjwdTV6kVac6-I3xkjZ7qvUVheFbU,18545 +sympy/printing/tests/test_precedence.py,sha256=Za6JCTVvRGZhNY2dqiA8XpUpR5YGck7Op2cXiV78dZA,4067 +sympy/printing/tests/test_preview.py,sha256=dSVxiGqdNR6gbF40V4J2tGhQ-T4RDvSyGypHvYcPDYM,988 +sympy/printing/tests/test_pycode.py,sha256=txwQ1jKkQNZSOXoKw9w2n-_IeIdd-QUjh7WYvOgi1rA,18363 +sympy/printing/tests/test_python.py,sha256=HN7JkzQcKSnB6718i7kaEJZ5pYMqu56z1mSmHQGzY4k,8128 +sympy/printing/tests/test_rcode.py,sha256=TXyl449eCO4J-P3DQb3w9FWvMqOdXmfuiXgyBg_inQQ,13781 +sympy/printing/tests/test_repr.py,sha256=5XmDdIDlQlCWckWq8H95Fw82h-oDxrRpMWZePb6hHa4,12980 +sympy/printing/tests/test_rust.py,sha256=ClZ30PUmZj1ZoBWL2zSt4SsWQS0WB8FrFSQE-w3bxjU,11988 +sympy/printing/tests/test_smtlib.py,sha256=S-42OTOUGkZ-k17qCQ36DYgT-tyOeYqDCvtXzrL2Kzo,22553 +sympy/printing/tests/test_str.py,sha256=QhRuH-hwpXRcPTmKClxqBv8HQdlpNjR4dMXf_XJ3jCs,43523 +sympy/printing/tests/test_tableform.py,sha256=Ff5l1QL2HxN32WS_TdFhUAVqzop8YoWY3Uz1TThvVIM,5692 +sympy/printing/tests/test_tensorflow.py,sha256=-56L5IdYszZy9CGNxS8Ix8UaFStZudFuKQlyyz6Rzzs,17100 +sympy/printing/tests/test_theanocode.py,sha256=E36Fj72HxMK0e1pKTkoTpv9wI4UvwHdVufo-JA6dYq0,21394 +sympy/printing/tests/test_torch.py,sha256=yOtB4yl1DjbTbb8I_t2bdW8fAafVC5G8ubeIJpVLPus,16842 +sympy/printing/tests/test_tree.py,sha256=_8PGAhWMQ_A0f2DQLdDeMrpxY19889P5Ih9H41RZn8s,6080 +sympy/printing/theanocode.py,sha256=d1Aznwfqz6lFR680RGrIf5ht2AH0Ei7pz-7yGZt-CLY,19094 +sympy/printing/tree.py,sha256=tQNjLV3_c3QUUce068AbzAuCiUIJb47l_7F_TYxxFUQ,3868 +sympy/release.py,sha256=oitamisYLp3lrFI3uGv-5ZCJIeYOT9gZLcszUmVNhw8,23 +sympy/sandbox/__init__.py,sha256=IaEVOYHaZ97OHEuto1UGthFuO35c0uvAZFZU23YyEaU,189 +sympy/sandbox/__pycache__/__init__.cpython-312.pyc,, +sympy/sandbox/__pycache__/indexed_integrals.cpython-312.pyc,, +sympy/sandbox/indexed_integrals.py,sha256=svh4xDIa8nGpDeH4TeRb49gG8miMvXpCzEarbor58EE,2141 +sympy/sandbox/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/sandbox/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/sandbox/tests/__pycache__/test_indexed_integrals.cpython-312.pyc,, +sympy/sandbox/tests/test_indexed_integrals.py,sha256=UK2E2wg9EMwda4Vwpzyj3rmXs6ni33HqcbyaqAww6ww,1179 +sympy/series/__init__.py,sha256=DYG9oisjzYeS55dIUpQpbAFcoDz7Q81fZJw36PRGu14,766 +sympy/series/__pycache__/__init__.cpython-312.pyc,, +sympy/series/__pycache__/acceleration.cpython-312.pyc,, +sympy/series/__pycache__/approximants.cpython-312.pyc,, +sympy/series/__pycache__/aseries.cpython-312.pyc,, +sympy/series/__pycache__/formal.cpython-312.pyc,, +sympy/series/__pycache__/fourier.cpython-312.pyc,, +sympy/series/__pycache__/gruntz.cpython-312.pyc,, +sympy/series/__pycache__/kauers.cpython-312.pyc,, +sympy/series/__pycache__/limits.cpython-312.pyc,, +sympy/series/__pycache__/limitseq.cpython-312.pyc,, +sympy/series/__pycache__/order.cpython-312.pyc,, +sympy/series/__pycache__/residues.cpython-312.pyc,, +sympy/series/__pycache__/sequences.cpython-312.pyc,, +sympy/series/__pycache__/series.cpython-312.pyc,, +sympy/series/__pycache__/series_class.cpython-312.pyc,, +sympy/series/acceleration.py,sha256=Phe8jpZ4uiS4vYAzh8PiUoHKVUjyu5K9MoAnZX3pV_w,3365 +sympy/series/approximants.py,sha256=tE-hHuoW62QJHDA3WhRlXaTkokCAODs1vXgjirhOYiQ,3181 +sympy/series/aseries.py,sha256=cHVGRQaza4ayqI6ji6OHNkdQEMV7Bko4f4vug2buEQY,255 +sympy/series/benchmarks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/series/benchmarks/__pycache__/__init__.cpython-312.pyc,, +sympy/series/benchmarks/__pycache__/bench_limit.cpython-312.pyc,, +sympy/series/benchmarks/__pycache__/bench_order.cpython-312.pyc,, +sympy/series/benchmarks/bench_limit.py,sha256=2PtdeeJtD6qyEvt9HFNvyTnMM8phFZRjscgnb4fHndU,173 +sympy/series/benchmarks/bench_order.py,sha256=iC8sQJ0lLlTgiXltAyLzSCQ-3490cf-c6NFiIU44JSk,207 +sympy/series/formal.py,sha256=9HJp9fcNX-MxcIfTtMptdKEyAw6cQQ3LyyzMyEt-9aw,51668 +sympy/series/fourier.py,sha256=H3zDg_S5D0Qeewp-o87_t_30TIg3rad83bzAoz9yp_E,22941 +sympy/series/gruntz.py,sha256=fhHr8w8SeMd-6GKjHmlwajd4FUmzeYo97AA3C_q0lKg,23497 +sympy/series/kauers.py,sha256=PzD0MATMNjLjPi9GW5GQGL6Uqc2UT-uPwnzhi7TkJH8,1720 +sympy/series/limits.py,sha256=hoSFWORWR-DodSf6Po93uK_09JUePhNvI60YsH6V4CI,13307 +sympy/series/limitseq.py,sha256=WM1Lh3RXhSZM1gQaJrhWnUtYEgJunLujIEw1gmtVhYw,7752 +sympy/series/order.py,sha256=1JjdsH2zvP8X1rf75qpfIB-iI70fkcH9CmJsXsRqSxY,19558 +sympy/series/residues.py,sha256=k46s_fFfIHdJZqfst-B_-X1R-SAWs_rR9MQH7a9JLtg,2213 +sympy/series/sequences.py,sha256=WLubAZr5AevpllgI4b6WmIfXRX88QNVCpMGBofGkcqo,35543 +sympy/series/series.py,sha256=PveJ6LibsrDX-mymTbV7teNggnsX0cfaoGMLAP0KAIo,1863 +sympy/series/series_class.py,sha256=033NJ5Re8AS4eq-chmfct3-Lz2vBqdFqXtnrbxswTx0,2918 +sympy/series/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/series/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_approximants.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_aseries.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_demidovich.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_formal.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_fourier.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_gruntz.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_kauers.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_limits.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_limitseq.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_lseries.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_nseries.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_order.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_residues.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_sequences.cpython-312.pyc,, +sympy/series/tests/__pycache__/test_series.cpython-312.pyc,, +sympy/series/tests/test_approximants.py,sha256=KViHMW1dPXn7xaPYhtTQ9L_WtLLkoIic6yfFnwZ8Q70,1012 +sympy/series/tests/test_aseries.py,sha256=5yWntog5ogRZrmjF3ZhY4e-d2mHYC1Ocs7IXRRFQrtI,2377 +sympy/series/tests/test_demidovich.py,sha256=JGYacqJMEqHS6oT2AYs9d7iutIEb32PkJs9EJqOHxcQ,4947 +sympy/series/tests/test_formal.py,sha256=TpMws7tgQHaokLrzEKZdlOcn6f04WIZhUqreaOOJ0kU,22496 +sympy/series/tests/test_fourier.py,sha256=-RnlhZUZJuctdE3pEtVMeGzCfyWzR1TFeojDhpJqyWo,5908 +sympy/series/tests/test_gruntz.py,sha256=3yPq8ksMGM7x4VQIfsFkk3JIgHlj-g1kJJBwIL76uPg,16445 +sympy/series/tests/test_kauers.py,sha256=Z85FhfXOOVki0HNGeK5BEBZOpkuB6SnKK3FqfK1-aLQ,1102 +sympy/series/tests/test_limits.py,sha256=YuwcBy8Atf-UGP8Li2sFU0guV_ZsjHqx-IdPwI6M3EA,48638 +sympy/series/tests/test_limitseq.py,sha256=QjEF99sYEDqfY7ULz1qjQTo6e0lIRUCflEOBgiDYRVA,5691 +sympy/series/tests/test_lseries.py,sha256=GlQvlBlD9wh02PPBP6zU83wmhurvGUFTuCRp44B4uI4,1875 +sympy/series/tests/test_nseries.py,sha256=uzhzYswSOe9Gh_nWKeO69tvGPMLd-9tqk4HBYX8JIm4,18284 +sympy/series/tests/test_order.py,sha256=AUlRkYKCUIs4DyT6g94ZGmjzT2fqHutPXOUGhpz4mb0,17901 +sympy/series/tests/test_residues.py,sha256=pT9xzPqtmfKGSbLLAxgDVZLTSy3TOxyfq3thTJs2VLw,3178 +sympy/series/tests/test_sequences.py,sha256=Oyq32yQZnGNQDS2uJ3by3bZ-y4G9c9BFfdQTcVuW2RM,11161 +sympy/series/tests/test_series.py,sha256=yPqSIfTytdiIYlYR9yvK7uS4IwF1fctpDiiktEnwvec,17006 +sympy/sets/__init__.py,sha256=3vjCm4v2esbpsVPY0ROwTXMETxns_66bG4FCIFZ96oM,1026 +sympy/sets/__pycache__/__init__.cpython-312.pyc,, +sympy/sets/__pycache__/conditionset.cpython-312.pyc,, +sympy/sets/__pycache__/contains.cpython-312.pyc,, +sympy/sets/__pycache__/fancysets.cpython-312.pyc,, +sympy/sets/__pycache__/ordinals.cpython-312.pyc,, +sympy/sets/__pycache__/powerset.cpython-312.pyc,, +sympy/sets/__pycache__/setexpr.cpython-312.pyc,, +sympy/sets/__pycache__/sets.cpython-312.pyc,, +sympy/sets/conditionset.py,sha256=mhodBVrMqJ6W5H8CuaFhO3FO9VdJifOEPjjFmV9lT2I,7792 +sympy/sets/contains.py,sha256=AlsfOc_6V0TH_6G7XTPIXhDywgtg3ECdjCTfSOmPC-E,1829 +sympy/sets/fancysets.py,sha256=tZ4wVasc937Yr0VkQuLVHe75Falcr72Nrkhk89178QQ,48187 +sympy/sets/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/sets/handlers/__pycache__/__init__.cpython-312.pyc,, +sympy/sets/handlers/__pycache__/add.cpython-312.pyc,, +sympy/sets/handlers/__pycache__/comparison.cpython-312.pyc,, +sympy/sets/handlers/__pycache__/functions.cpython-312.pyc,, +sympy/sets/handlers/__pycache__/intersection.cpython-312.pyc,, +sympy/sets/handlers/__pycache__/issubset.cpython-312.pyc,, +sympy/sets/handlers/__pycache__/mul.cpython-312.pyc,, +sympy/sets/handlers/__pycache__/power.cpython-312.pyc,, +sympy/sets/handlers/__pycache__/union.cpython-312.pyc,, +sympy/sets/handlers/add.py,sha256=_ucFvxuDv9wsmKxGkCDUERtYk3I_tQxjZjY3ZkroWs0,1863 +sympy/sets/handlers/comparison.py,sha256=WfT_vLrOkvPqRg2mf7gziVs_6cLg0kOTEFv-Nb1zIvo,1601 +sympy/sets/handlers/functions.py,sha256=jYSFqFNH6mXbKFPgvIAIGY8BhbLPo1dAvcNg4MxmCaI,8381 +sympy/sets/handlers/intersection.py,sha256=oYPmrx3FAkGLVWT3EjSimeMfsGqPsqVnpJm5UxQzuCM,17514 +sympy/sets/handlers/issubset.py,sha256=azka_5eOaUro3r3v72PmET0oY8-aaoJkzVEK7kuqXCA,4739 +sympy/sets/handlers/mul.py,sha256=XFbkOw4PDQumaOEUlHeQLvjhIom0f3iniSYv_Kau-xw,1842 +sympy/sets/handlers/power.py,sha256=84N3dIus7r09XV7PF_RiEpFRw1y5tOGD34WKzSM9F-4,3186 +sympy/sets/handlers/union.py,sha256=lrAdydqExnALUjM0dnoM-7JAZqtbgLb46Y2GGmFtQdw,4225 +sympy/sets/ordinals.py,sha256=GSyaBq7BHJC3pvgoCDoUKZQ0IE2VXyHtx6_g5OS64W4,7641 +sympy/sets/powerset.py,sha256=vIGnSYKngEPEt6V-6beDOXAOY9ugDLJ8fXOx5H9JJck,2913 +sympy/sets/setexpr.py,sha256=jMOQigDscLTrFPXvHqo1ODVRG9BqC4yn38Ej4m6WPa0,3019 +sympy/sets/sets.py,sha256=-iuLnPWLunCa0oOErHELO9EkLZXs6L2AFWQgkCFbJcA,81202 +sympy/sets/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/sets/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/sets/tests/__pycache__/test_conditionset.cpython-312.pyc,, +sympy/sets/tests/__pycache__/test_contains.cpython-312.pyc,, +sympy/sets/tests/__pycache__/test_fancysets.cpython-312.pyc,, +sympy/sets/tests/__pycache__/test_ordinals.cpython-312.pyc,, +sympy/sets/tests/__pycache__/test_powerset.cpython-312.pyc,, +sympy/sets/tests/__pycache__/test_setexpr.cpython-312.pyc,, +sympy/sets/tests/__pycache__/test_sets.cpython-312.pyc,, +sympy/sets/tests/test_conditionset.py,sha256=UeutWuBCT5PZicNkkl9E94pREnU5CvLGWUfmRS29PcU,11370 +sympy/sets/tests/test_contains.py,sha256=ec6WRzriwV9nurz3jS9IXEqtfL1pZedtJFp--fSsBvY,1561 +sympy/sets/tests/test_fancysets.py,sha256=oiuu5PKNrDeDO-NtgsE4CpkwQaS7JNgCYuSyc1ykKKE,51938 +sympy/sets/tests/test_ordinals.py,sha256=L4DYc6ByQMDwJGFzJC3YhfSrVk5auW7pf4QYpJ5xY7w,2637 +sympy/sets/tests/test_powerset.py,sha256=nFvDGlhAf0wG-pZnPkgJjfwDHrTwdro3MYIinwyxn94,4805 +sympy/sets/tests/test_setexpr.py,sha256=E--SjYVzrmau0EbD8g4NTqp6aLD8qHzIuI7sAfuWxpY,14797 +sympy/sets/tests/test_sets.py,sha256=oMtqcr9gr68itfWH4j18POID8tD0hAZUV8HCz7-KKj0,68544 +sympy/simplify/__init__.py,sha256=MH1vkwHq0J5tNm7ss8V6v-mjrDGUXwfOsariIwfi38c,1274 +sympy/simplify/__pycache__/__init__.cpython-312.pyc,, +sympy/simplify/__pycache__/_cse_diff.cpython-312.pyc,, +sympy/simplify/__pycache__/combsimp.cpython-312.pyc,, +sympy/simplify/__pycache__/cse_main.cpython-312.pyc,, +sympy/simplify/__pycache__/cse_opts.cpython-312.pyc,, +sympy/simplify/__pycache__/epathtools.cpython-312.pyc,, +sympy/simplify/__pycache__/fu.cpython-312.pyc,, +sympy/simplify/__pycache__/gammasimp.cpython-312.pyc,, +sympy/simplify/__pycache__/hyperexpand.cpython-312.pyc,, +sympy/simplify/__pycache__/hyperexpand_doc.cpython-312.pyc,, +sympy/simplify/__pycache__/powsimp.cpython-312.pyc,, +sympy/simplify/__pycache__/radsimp.cpython-312.pyc,, +sympy/simplify/__pycache__/ratsimp.cpython-312.pyc,, +sympy/simplify/__pycache__/simplify.cpython-312.pyc,, +sympy/simplify/__pycache__/sqrtdenest.cpython-312.pyc,, +sympy/simplify/__pycache__/traversaltools.cpython-312.pyc,, +sympy/simplify/__pycache__/trigsimp.cpython-312.pyc,, +sympy/simplify/_cse_diff.py,sha256=Nq1gXn27o1v83t__SQUuacnOohhywa39ucPaR2jD518,10479 +sympy/simplify/combsimp.py,sha256=UzgG6eC_eIzieMS3j0oQFJnS5XkZ1gxNqOSzBqJcIFQ,3604 +sympy/simplify/cse_main.py,sha256=tcUmXXFGIZyoX4PvBEmZ-YYm-CBLXoAyGLHverxP23o,31310 +sympy/simplify/cse_opts.py,sha256=ZTCaOdOrgtifWxQmFzyngrLq9uwzByBdiSS5mE-DDoE,1618 +sympy/simplify/epathtools.py,sha256=fV3oeD2J3LJRQ4YoTV6gq3yFT_NSZi-7xxKnrX-2KJA,10122 +sympy/simplify/fu.py,sha256=exevmk1p4YgEAO-MmTgh7cG7cyVMMF8p7vZ1ymwwKiI,62208 +sympy/simplify/gammasimp.py,sha256=yzfkD_q1Zxu1eMCZuprmA3VzZXhecX3K0xdZlUdYlcY,18485 +sympy/simplify/hyperexpand.py,sha256=sTWd1-VeLr0NTr-cm6nftjmO_gVPqa1P9ud_rvSZS54,84420 +sympy/simplify/hyperexpand_doc.py,sha256=E8AD0mj8ULtelDSUkmJKJY7kYm5fVfCL4QH_DX65qEw,521 +sympy/simplify/powsimp.py,sha256=aCkX2zxgOm1S9oWc260KrzhSwcJw8p3JEMZ-vkmUapM,26754 +sympy/simplify/radsimp.py,sha256=VP83Ufl_9DUtmeHCRXSmOHqdg9zDsPoQJ_7eUyCiwpI,41649 +sympy/simplify/ratsimp.py,sha256=vTu0t0k1FDFTofl4mwcK9NuTMNZ20IsL8fIyFJRFNkg,7682 +sympy/simplify/simplify.py,sha256=3rK7cCfkh1svliMVsCuTv9_aQDz3nmZvA_HRAvmNkSo,73330 +sympy/simplify/sqrtdenest.py,sha256=MsTyPUcEhiMf51fpk6e5grlqudU-LMAHOuatPCxo5uA,21600 +sympy/simplify/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/simplify/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_combsimp.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_cse.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_cse_diff.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_epathtools.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_fu.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_function.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_gammasimp.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_hyperexpand.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_powsimp.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_radsimp.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_ratsimp.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_rewrite.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_simplify.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_sqrtdenest.cpython-312.pyc,, +sympy/simplify/tests/__pycache__/test_trigsimp.cpython-312.pyc,, +sympy/simplify/tests/test_combsimp.py,sha256=O95WSxCvo2fDQs-UlarAcSf0_8M3PuTR76lhREDoNA8,2958 +sympy/simplify/tests/test_cse.py,sha256=JOjH5G6GPfeaKpKdeeKL1vvHgbt8TGxTkqmH2e1ovY8,25516 +sympy/simplify/tests/test_cse_diff.py,sha256=Y_zYZpldwjUoWiTTpFMlw4PXkqNp9r9Zwrw46gkmNoY,7275 +sympy/simplify/tests/test_epathtools.py,sha256=ugsQlfuK6POiixdeit63QovsVAlG5JyCaPlPp0j35LE,3525 +sympy/simplify/tests/test_fu.py,sha256=X2NNsynwefg2aH5GhyxQItL80fKPZ9md6nydMEedWbQ,19410 +sympy/simplify/tests/test_function.py,sha256=gzdcSFObuDzVFJDdAgmERtZJvG38WNSmclPAdG8OaPQ,2199 +sympy/simplify/tests/test_gammasimp.py,sha256=32cPRmtG-_Mz9g02lmmn-PWDD3J_Ku6sxLxIUU7WqxE,5320 +sympy/simplify/tests/test_hyperexpand.py,sha256=y3lxd97UZ1BkrrZe0r2l6MM8zNABTE_L4KtxFwmdzeQ,41043 +sympy/simplify/tests/test_powsimp.py,sha256=FWI_K8nozwYzhrhY1Q0CZkf6n88hFR0jjuYRvQnMius,14375 +sympy/simplify/tests/test_radsimp.py,sha256=Gf6Tf7-lb5G8gqF6hJA6kPrZNFES6fCz7_-ls7TFUfY,19128 +sympy/simplify/tests/test_ratsimp.py,sha256=bv-K60A7m2on-U9szzaeYO7Hlp1EK5P0HvBBO59oyas,2198 +sympy/simplify/tests/test_rewrite.py,sha256=LZj4V6a95GJj1o3NlKRoHMk7sWGPASFlw24nsm4z43k,1127 +sympy/simplify/tests/test_simplify.py,sha256=QkiaVVj0nqHXvu1lUUYZfYZ6_Ods6DfiBwFiqAJKSoo,41928 +sympy/simplify/tests/test_sqrtdenest.py,sha256=4zRtDQVGpKRRBYSAnEF5pSM0AR_fAMumONu2Ocb3tqg,7470 +sympy/simplify/tests/test_trigsimp.py,sha256=vG5PDTDNOuFypT7H9DSMjIollPqkKdNhWv5FBj6vFnE,19949 +sympy/simplify/traversaltools.py,sha256=pn_t9Yrk_SL1X0vl-zVR6yZaxkY25D4MwTBv4ywnD1Y,409 +sympy/simplify/trigsimp.py,sha256=t36QKVf_0yqVCNo1hUBlBp5locL0sMH1AlsAwQCzpLQ,46857 +sympy/solvers/__init__.py,sha256=nb1LceF2MwvULXsCN8VUq7X2tVgZOPsmWYHGFszIdW4,2333 +sympy/solvers/__pycache__/__init__.cpython-312.pyc,, +sympy/solvers/__pycache__/bivariate.cpython-312.pyc,, +sympy/solvers/__pycache__/decompogen.cpython-312.pyc,, +sympy/solvers/__pycache__/deutils.cpython-312.pyc,, +sympy/solvers/__pycache__/inequalities.cpython-312.pyc,, +sympy/solvers/__pycache__/pde.cpython-312.pyc,, +sympy/solvers/__pycache__/polysys.cpython-312.pyc,, +sympy/solvers/__pycache__/recurr.cpython-312.pyc,, +sympy/solvers/__pycache__/simplex.cpython-312.pyc,, +sympy/solvers/__pycache__/solvers.cpython-312.pyc,, +sympy/solvers/__pycache__/solveset.cpython-312.pyc,, +sympy/solvers/benchmarks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/solvers/benchmarks/__pycache__/__init__.cpython-312.pyc,, +sympy/solvers/benchmarks/__pycache__/bench_solvers.cpython-312.pyc,, +sympy/solvers/benchmarks/bench_solvers.py,sha256=ZVK2TIW0XjWRDBex054ymmVlSBQw-RIBhEL1wS2ZAmU,288 +sympy/solvers/bivariate.py,sha256=Ku4Ttid3yU3CIc4IPfJ7bedLtXVaGKvFOonEIlZrXXw,17870 +sympy/solvers/decompogen.py,sha256=dWQla7hp7A4RqI2a0qRNQLWNPEuur68lD3dVTyktdBU,3757 +sympy/solvers/deutils.py,sha256=jukqDw6JGZfl36HRFjZIX_A0_iarmTawI0Up7z5tQDc,10315 +sympy/solvers/diophantine/__init__.py,sha256=I1p3uj3kFQv20cbsZ34K5rNCx1_pDS7JwHUCFstpBgs,128 +sympy/solvers/diophantine/__pycache__/__init__.cpython-312.pyc,, +sympy/solvers/diophantine/__pycache__/diophantine.cpython-312.pyc,, +sympy/solvers/diophantine/diophantine.py,sha256=n74XrMIW6ZwrAfaVVks7nwB01GClI0SYdvTe5K90Jnc,122482 +sympy/solvers/diophantine/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/solvers/diophantine/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/solvers/diophantine/tests/__pycache__/test_diophantine.cpython-312.pyc,, +sympy/solvers/diophantine/tests/test_diophantine.py,sha256=N7ZCyNVfSV0JzAKbnc_8YbUFq5ZkiDLnO6MxxMxCG90,43335 +sympy/solvers/inequalities.py,sha256=kz6HzAytg4V2eqSKwGzbJuYyFfgj6bFSUgk1i15zVp0,33189 +sympy/solvers/ode/__init__.py,sha256=I7RKwCcaoerflUm5i3ZDJgBIOnkhBjb83BCHcVcFqfM,468 +sympy/solvers/ode/__pycache__/__init__.cpython-312.pyc,, +sympy/solvers/ode/__pycache__/hypergeometric.cpython-312.pyc,, +sympy/solvers/ode/__pycache__/lie_group.cpython-312.pyc,, +sympy/solvers/ode/__pycache__/nonhomogeneous.cpython-312.pyc,, +sympy/solvers/ode/__pycache__/ode.cpython-312.pyc,, +sympy/solvers/ode/__pycache__/riccati.cpython-312.pyc,, +sympy/solvers/ode/__pycache__/single.cpython-312.pyc,, +sympy/solvers/ode/__pycache__/subscheck.cpython-312.pyc,, +sympy/solvers/ode/__pycache__/systems.cpython-312.pyc,, +sympy/solvers/ode/hypergeometric.py,sha256=t9KN5AdB7yF-rRoatEBzUYBcrwvIrKm83KBDa5BJYqY,10048 +sympy/solvers/ode/lie_group.py,sha256=C2HoOVtDbIT2ryx4TzEvQU46Yqc8LurTBBtjv5m2-BQ,39175 +sympy/solvers/ode/nonhomogeneous.py,sha256=Wi6UxjYNAPcfJsEzKHNvIJ8zhJ7-ZOkqccCR93MpUuM,17875 +sympy/solvers/ode/ode.py,sha256=9UQ0bqcrFOsGuSxGfRJpd2CllIWfiUYZPC2-A7Crefo,145379 +sympy/solvers/ode/riccati.py,sha256=3ZrkCy3ufXCyCx8gJfAuxyCOgbOLEHtvTh2VgJhA7Mk,30736 +sympy/solvers/ode/single.py,sha256=yBpPVFK3LsCf07dDb9_x6tzhp5d4ln_xIpMZpP2Ryrc,109465 +sympy/solvers/ode/subscheck.py,sha256=CIPca_qTxL9z5oaD2e2NrgME0eVQgF9PabZndcVqHZM,16130 +sympy/solvers/ode/systems.py,sha256=Kok2AMO4YEKX38fi2LrxLm5zpTcNXz398b7OBvrUezU,71467 +sympy/solvers/ode/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/solvers/ode/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/solvers/ode/tests/__pycache__/test_lie_group.cpython-312.pyc,, +sympy/solvers/ode/tests/__pycache__/test_ode.cpython-312.pyc,, +sympy/solvers/ode/tests/__pycache__/test_riccati.cpython-312.pyc,, +sympy/solvers/ode/tests/__pycache__/test_single.cpython-312.pyc,, +sympy/solvers/ode/tests/__pycache__/test_subscheck.cpython-312.pyc,, +sympy/solvers/ode/tests/__pycache__/test_systems.cpython-312.pyc,, +sympy/solvers/ode/tests/test_lie_group.py,sha256=vg1yy_-a5x1Xm2IcVkEi5cD2uA5wE5gjqpfBwkV1vZc,5319 +sympy/solvers/ode/tests/test_ode.py,sha256=bEcTi9zA5TooKOE9duFtd6TAVRvLPrO92arX7fF85-Q,48508 +sympy/solvers/ode/tests/test_riccati.py,sha256=a2_pXzCFb9WDtT_kdxYkfLd-PG5xvs4rQn_vpFk-O9s,29348 +sympy/solvers/ode/tests/test_single.py,sha256=sEvhXws920Oe_IuvmBIYM5iPViR6I3njZNgJlc8sMC4,100200 +sympy/solvers/ode/tests/test_subscheck.py,sha256=Gzwc9h9n6zlNOhJ8Qh6fQDeB8ghaRmgv3ktBAfPJx-U,12468 +sympy/solvers/ode/tests/test_systems.py,sha256=PeIEHOx8-eZQNuqOfhjTvGEeFSVriLlHShPmy84mde4,129087 +sympy/solvers/pde.py,sha256=V2jxgmmepng2ofFFDVOsBHWqf-IUQCgIz4lXzhBUeyg,34913 +sympy/solvers/polysys.py,sha256=4CCK3FNhl-K6B4bYF_goSrAq1JOMubl6KsmaB_5R2f4,27168 +sympy/solvers/recurr.py,sha256=DyssZuOyemoC6J1cWq635O7zkg1WLHrR7KGoM-gNy0g,25389 +sympy/solvers/simplex.py,sha256=peRv44aDM30U_0wk8xZv3t6M_cpm_a9hBALiyr7zndY,35276 +sympy/solvers/solvers.py,sha256=xsSlQaj0XaunexmhfQZZI_uiRXHETmaUab9hgZrmmbU,138454 +sympy/solvers/solveset.py,sha256=6VxsiKcn4fwdJGYXA8k1si5zvYs6vNrSTtLcmSKpjMk,151683 +sympy/solvers/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/solvers/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/solvers/tests/__pycache__/test_constantsimp.cpython-312.pyc,, +sympy/solvers/tests/__pycache__/test_decompogen.cpython-312.pyc,, +sympy/solvers/tests/__pycache__/test_inequalities.cpython-312.pyc,, +sympy/solvers/tests/__pycache__/test_numeric.cpython-312.pyc,, +sympy/solvers/tests/__pycache__/test_pde.cpython-312.pyc,, +sympy/solvers/tests/__pycache__/test_polysys.cpython-312.pyc,, +sympy/solvers/tests/__pycache__/test_recurr.cpython-312.pyc,, +sympy/solvers/tests/__pycache__/test_simplex.cpython-312.pyc,, +sympy/solvers/tests/__pycache__/test_solvers.cpython-312.pyc,, +sympy/solvers/tests/__pycache__/test_solveset.cpython-312.pyc,, +sympy/solvers/tests/test_constantsimp.py,sha256=9Feugsg9jD2BwQiG4EFpb9fORyst6JdBmZqq2GaOgH8,8707 +sympy/solvers/tests/test_decompogen.py,sha256=7GUsDQQZtYbZIK0p0UxsOuNEJxEt4IHeOSsem_k-k0U,2943 +sympy/solvers/tests/test_inequalities.py,sha256=whg3vGXEYxeIHNQS4yBeB9VQpoYWnfw5NBS4xLiqDJ8,21025 +sympy/solvers/tests/test_numeric.py,sha256=pKLBJuf4lGCewf5DgBjvH5T9phf6ilkyW1gB2R-5SzA,4734 +sympy/solvers/tests/test_pde.py,sha256=UGP3uWjF8pKQgfPifmdfvS5URVmzSg6m2NkS7LGzmio,9257 +sympy/solvers/tests/test_polysys.py,sha256=bK2ckIhQvbJCc6_qsUOAuAEyTc5CR8J2yiqN4MFOgpM,15266 +sympy/solvers/tests/test_recurr.py,sha256=-OeghSg16GFN70y_RUXC6CF6VU_b7NXaKDbejtRSocg,11418 +sympy/solvers/tests/test_simplex.py,sha256=pG7j7KxXrlK8K_fF04XH_mvMzwEOopSBpJZiagKjyNs,9037 +sympy/solvers/tests/test_solvers.py,sha256=eXM6AT2upxlRC7S2l1YxUSS6jJNM42PxzYCTz4C4vmc,107765 +sympy/solvers/tests/test_solveset.py,sha256=lOQ4hG7Dg6yuDgFriKIlvWdzEumehgL08Srsh4JwDHY,148480 +sympy/stats/__init__.py,sha256=9pY3OMdvAIeJ_Q1ZqynOZ8hHWFFrrxOx0qBHKkGfHCg,8487 +sympy/stats/__pycache__/__init__.cpython-312.pyc,, +sympy/stats/__pycache__/compound_rv.cpython-312.pyc,, +sympy/stats/__pycache__/crv.cpython-312.pyc,, +sympy/stats/__pycache__/crv_types.cpython-312.pyc,, +sympy/stats/__pycache__/drv.cpython-312.pyc,, +sympy/stats/__pycache__/drv_types.cpython-312.pyc,, +sympy/stats/__pycache__/error_prop.cpython-312.pyc,, +sympy/stats/__pycache__/frv.cpython-312.pyc,, +sympy/stats/__pycache__/frv_types.cpython-312.pyc,, +sympy/stats/__pycache__/joint_rv.cpython-312.pyc,, +sympy/stats/__pycache__/joint_rv_types.cpython-312.pyc,, +sympy/stats/__pycache__/matrix_distributions.cpython-312.pyc,, +sympy/stats/__pycache__/random_matrix.cpython-312.pyc,, +sympy/stats/__pycache__/random_matrix_models.cpython-312.pyc,, +sympy/stats/__pycache__/rv.cpython-312.pyc,, +sympy/stats/__pycache__/rv_interface.cpython-312.pyc,, +sympy/stats/__pycache__/stochastic_process.cpython-312.pyc,, +sympy/stats/__pycache__/stochastic_process_types.cpython-312.pyc,, +sympy/stats/__pycache__/symbolic_multivariate_probability.cpython-312.pyc,, +sympy/stats/__pycache__/symbolic_probability.cpython-312.pyc,, +sympy/stats/compound_rv.py,sha256=SO1KXJ0aHGbD5y9QA8o6qOHbio3ua8wyO2Rsh0Hnw48,7965 +sympy/stats/crv.py,sha256=jd8iemE41aW-byXgFDYKaMv2VOOUnyUtiMx_QAXI-n4,21028 +sympy/stats/crv_types.py,sha256=qXYxtvJPg4ORJI7AxIkRhwnJ6lcz3sVBWf4toQy9vvA,122371 +sympy/stats/drv.py,sha256=Zu8IK9yt69XJFKt-ShoJfZbvZ-CGMwvrKNiXvi6q_n4,11994 +sympy/stats/drv_types.py,sha256=2jL6QYa9lAlbvTxvx9BXdfwU6PRt0uzV3CVXRIeZ5k0,19865 +sympy/stats/error_prop.py,sha256=a-H6GZEidsiP_4-iNw7nSD99AMyN6DNHsSl0IUZGIAs,3315 +sympy/stats/frv.py,sha256=vZROeD6DSVGX0kfOL_yOds3pZgjSiXFX-bMZtSUkVMA,16874 +sympy/stats/frv_types.py,sha256=Xkc3MU5dFLajPajIStW_lV4qiuiHg86rBo45zX_oGLk,23348 +sympy/stats/joint_rv.py,sha256=DcixlO2Ml4gnwMmZk2VTegiHVq88DkLdQlOTQ57SQtc,15963 +sympy/stats/joint_rv_types.py,sha256=PUatR4WcPHmAHadt8iRh5xYh5NJigzYh-EoAMR5blDw,30575 +sympy/stats/matrix_distributions.py,sha256=3OricwEMM_NU8b2lJxoiSTml7kvqrNQ6IUIn9Xy_DsY,21953 +sympy/stats/random_matrix.py,sha256=NmzLC5JMDWI2TvH8tY6go8lYyHmqcZ-B7sSIO7z7oAk,1028 +sympy/stats/random_matrix_models.py,sha256=7i5XAUYxt-ekmP5KDMaytUlmCvxglEspoWbswSf82tE,15328 +sympy/stats/rv.py,sha256=rmjdVpsvJrqtMgnreuT_7lU5S_V2nkvlrpUvA7zCWLM,54579 +sympy/stats/rv_interface.py,sha256=0ZSplwmkEtio_UTlh7bqSK_1aILgvk2JTfZ-CkOcfAc,13935 +sympy/stats/sampling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/stats/sampling/__pycache__/__init__.cpython-312.pyc,, +sympy/stats/sampling/__pycache__/sample_numpy.cpython-312.pyc,, +sympy/stats/sampling/__pycache__/sample_pymc.cpython-312.pyc,, +sympy/stats/sampling/__pycache__/sample_scipy.cpython-312.pyc,, +sympy/stats/sampling/sample_numpy.py,sha256=B4ZC7ZBrSD6ICQT468rOy-xrOgQDuecsHa0zJesAeYE,4229 +sympy/stats/sampling/sample_pymc.py,sha256=9g-n04aXSFc6F7FJ5zTYtHHL6W8-26g1nrgtamJc3Hw,2995 +sympy/stats/sampling/sample_scipy.py,sha256=ysqpDy8bp1RMH0g5FFgMmp2SQuXGFkcSH7JDZEpiZ8w,6329 +sympy/stats/sampling/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/stats/sampling/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/stats/sampling/tests/__pycache__/test_sample_continuous_rv.cpython-312.pyc,, +sympy/stats/sampling/tests/__pycache__/test_sample_discrete_rv.cpython-312.pyc,, +sympy/stats/sampling/tests/__pycache__/test_sample_finite_rv.cpython-312.pyc,, +sympy/stats/sampling/tests/test_sample_continuous_rv.py,sha256=Gh8hFN1hFFsthEv9wP2ZdgghQfaEnE8n7HlmyXXhN1E,5708 +sympy/stats/sampling/tests/test_sample_discrete_rv.py,sha256=Z3hqjHEFaIoB0hrhpy7YYL_7Dtqzmy5YMWAYrlqPu38,3360 +sympy/stats/sampling/tests/test_sample_finite_rv.py,sha256=dWwrFePw8eX2rBheAXi1AVxr_gqBD63VZKfW81hNoQc,3061 +sympy/stats/stochastic_process.py,sha256=pDz0rbKXTiaNmMmmz70dP3F_KWL_XhoCKFHYBNt1QeU,2312 +sympy/stats/stochastic_process_types.py,sha256=YEUA-saTh8WF6Pn7GcgrcyclRCb_SC13YnpgOIpu7-Q,88553 +sympy/stats/symbolic_multivariate_probability.py,sha256=R6Co7XCcxLoOtTqC6ZSnGuylZNUBrC5AD0DrJr2jE1A,10450 +sympy/stats/symbolic_probability.py,sha256=HkWUiH9EM_DQ1aM1FxNmBm_8xtqeviIsyUpqFl2RYnI,23266 +sympy/stats/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/stats/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_compound_rv.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_continuous_rv.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_discrete_rv.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_error_prop.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_finite_rv.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_joint_rv.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_matrix_distributions.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_mix.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_random_matrix.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_rv.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_stochastic_process.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_symbolic_multivariate.cpython-312.pyc,, +sympy/stats/tests/__pycache__/test_symbolic_probability.cpython-312.pyc,, +sympy/stats/tests/test_compound_rv.py,sha256=2927chbHTThA34Ki-ji319QT7ajQ1ueC640Mga-18ZA,6263 +sympy/stats/tests/test_continuous_rv.py,sha256=BcBkiyX7e1QiwS6xnD-qLzXnijvqbsebTzXEn3IfGyE,56140 +sympy/stats/tests/test_discrete_rv.py,sha256=bLqMtKpH5fDjuP7uuRAtAjakbahuFz9x3dY-PPKFsGk,11230 +sympy/stats/tests/test_error_prop.py,sha256=xKAkw3F5XJ72xiDREI7PkyReWNVW_89CD_mjOY_diDY,1933 +sympy/stats/tests/test_finite_rv.py,sha256=JHYgY4snFF5t9qcnQfKaN5zaGsO7_SuNR7Tq234W4No,20413 +sympy/stats/tests/test_joint_rv.py,sha256=W28rCRYczv5Jax7k-bj7OveT-y-AP4q-kRR0-LNaWX0,18653 +sympy/stats/tests/test_matrix_distributions.py,sha256=9daJUiSGaLq34TeZfB-xPqC8xz6vECGrm0DdBZaQPyY,8857 +sympy/stats/tests/test_mix.py,sha256=Cplnw06Ki96Y_4fx6Bu7lUXjxoIfX7tNJasm9SOz5wQ,3991 +sympy/stats/tests/test_random_matrix.py,sha256=CiD1hV25MGHwTfHGaoaehGD3iJ4lqNYi-ZiwReO6CVk,5842 +sympy/stats/tests/test_rv.py,sha256=Bp7UwffIMO7oc8UnFV11yYGcXUjSa0NhsuOgQaNRMt8,12959 +sympy/stats/tests/test_stochastic_process.py,sha256=i-VCOZrjpJtvyTBm9xgniTCkk_iUYIuFnkiyxzkn6Ig,39323 +sympy/stats/tests/test_symbolic_multivariate.py,sha256=G3AgbRbt0DQ-p0DYXYDjbx4e4f5FIgd31F34e0NO2n8,5580 +sympy/stats/tests/test_symbolic_probability.py,sha256=k5trScMiwSgl9dzJt30BV-t0KuYcyD-s9HtT2-hVhQ0,9398 +sympy/strategies/__init__.py,sha256=XaTAPqDoi6527juvR8LLN1mv6ZcslDrGloTTBMjJzxA,1402 +sympy/strategies/__pycache__/__init__.cpython-312.pyc,, +sympy/strategies/__pycache__/core.cpython-312.pyc,, +sympy/strategies/__pycache__/rl.cpython-312.pyc,, +sympy/strategies/__pycache__/tools.cpython-312.pyc,, +sympy/strategies/__pycache__/traverse.cpython-312.pyc,, +sympy/strategies/__pycache__/tree.cpython-312.pyc,, +sympy/strategies/__pycache__/util.cpython-312.pyc,, +sympy/strategies/branch/__init__.py,sha256=xxbMwR2LzLcQWsH9ss8ddE99VHFJTY-cYiR6xhO3tj0,356 +sympy/strategies/branch/__pycache__/__init__.cpython-312.pyc,, +sympy/strategies/branch/__pycache__/core.cpython-312.pyc,, +sympy/strategies/branch/__pycache__/tools.cpython-312.pyc,, +sympy/strategies/branch/__pycache__/traverse.cpython-312.pyc,, +sympy/strategies/branch/core.py,sha256=QiXSa7uhvmUBTLyUwBQHrYkWlOceKh5p4kVD90VnCKM,2759 +sympy/strategies/branch/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/strategies/branch/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/strategies/branch/tests/__pycache__/test_core.cpython-312.pyc,, +sympy/strategies/branch/tests/__pycache__/test_tools.cpython-312.pyc,, +sympy/strategies/branch/tests/__pycache__/test_traverse.cpython-312.pyc,, +sympy/strategies/branch/tests/test_core.py,sha256=23KQWJxC_2T1arwMAkt9pY1ZtG59avlxTZcVTn81UPI,2246 +sympy/strategies/branch/tests/test_tools.py,sha256=4BDkqVqrTlsivQ0PldQr6PjVZsAikc39tSxGAQA3ir8,942 +sympy/strategies/branch/tests/test_traverse.py,sha256=6rikMnZdamSzww1sSiM-aQwqa4lQrpM-DpOU9XCbiOQ,1322 +sympy/strategies/branch/tools.py,sha256=tvv3IjmQGNYbo-slCbbDf_rylZd537wvLcpdBtT-bbY,357 +sympy/strategies/branch/traverse.py,sha256=7iBViQdNpKu-AHoFED7_C9KBSyYcQBfLGopEJQbNtvk,799 +sympy/strategies/core.py,sha256=nsH6LZgyc_aslv4Na5XvJMEizC6uSzscRlVW91k1pu4,3956 +sympy/strategies/rl.py,sha256=-M5lfrtcREkvbW4YfoiB19wfYyMLKz6SmL887ymKeoI,4404 +sympy/strategies/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/strategies/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/strategies/tests/__pycache__/test_core.cpython-312.pyc,, +sympy/strategies/tests/__pycache__/test_rl.cpython-312.pyc,, +sympy/strategies/tests/__pycache__/test_tools.cpython-312.pyc,, +sympy/strategies/tests/__pycache__/test_traverse.cpython-312.pyc,, +sympy/strategies/tests/__pycache__/test_tree.cpython-312.pyc,, +sympy/strategies/tests/test_core.py,sha256=42XHlv1hN1S1QPEf2r9pddZ2EQL6o4FEPQvfo-UmXcw,2152 +sympy/strategies/tests/test_rl.py,sha256=wm0L6pdvddBgRcwhpiSk-nCgyzVGickfnOCkmHWS0j4,1949 +sympy/strategies/tests/test_tools.py,sha256=UdMojFIn3f1b2x2iRGv1Wfnwdso-Kl57GTyjCU_DjzQ,875 +sympy/strategies/tests/test_traverse.py,sha256=jWuZhYEt-F18_rxEMhn6OgGQ1GNs-dM_GFZ2F5nHs2I,2082 +sympy/strategies/tests/test_tree.py,sha256=9NL948rt6i9tYU6CQz9VNxE6l1begQs-MxP2euzE3Sc,2400 +sympy/strategies/tools.py,sha256=ERASzEP2SP-EcJ8p-4XyREYB15q3t81x1cyamJ-M880,1368 +sympy/strategies/traverse.py,sha256=DhPnBJ5Rw_xzhGiBtSciTyV-H2zhlxgjYVjrNH-gLyk,1183 +sympy/strategies/tree.py,sha256=ggnP9l3NIpJsssBMVKr4-yM_m8uCkrkm191ZC6MfZjc,3770 +sympy/strategies/util.py,sha256=2fbR813IY4IYco5mBoGJLu5z88OhXmwuIxgOO9IvZO4,361 +sympy/tensor/__init__.py,sha256=VMNXCRSayigQT6a3cvf5M_M-wdV-KSil_JbAmHcuUQc,870 +sympy/tensor/__pycache__/__init__.cpython-312.pyc,, +sympy/tensor/__pycache__/functions.cpython-312.pyc,, +sympy/tensor/__pycache__/index_methods.cpython-312.pyc,, +sympy/tensor/__pycache__/indexed.cpython-312.pyc,, +sympy/tensor/__pycache__/tensor.cpython-312.pyc,, +sympy/tensor/__pycache__/toperators.cpython-312.pyc,, +sympy/tensor/array/__init__.py,sha256=lTT1EwV5tb3WAvmmS_mIjhCSWSLiB0NNPW4n9_3fu0k,8244 +sympy/tensor/array/__pycache__/__init__.cpython-312.pyc,, +sympy/tensor/array/__pycache__/array_comprehension.cpython-312.pyc,, +sympy/tensor/array/__pycache__/array_derivatives.cpython-312.pyc,, +sympy/tensor/array/__pycache__/arrayop.cpython-312.pyc,, +sympy/tensor/array/__pycache__/dense_ndim_array.cpython-312.pyc,, +sympy/tensor/array/__pycache__/mutable_ndim_array.cpython-312.pyc,, +sympy/tensor/array/__pycache__/ndim_array.cpython-312.pyc,, +sympy/tensor/array/__pycache__/sparse_ndim_array.cpython-312.pyc,, +sympy/tensor/array/array_comprehension.py,sha256=01PTIbkAGaq0CDcaI_2KsaMnYm1nxQ8sFAiHHcc__gw,12262 +sympy/tensor/array/array_derivatives.py,sha256=c-gYeA_qpXOY3aexyz7psSqmTVIGVBrcGDvSkW5dZV0,4796 +sympy/tensor/array/arrayop.py,sha256=KvFGYWcYvChWkThtVAotlaSrcfjHogAxvpxWvp6dSgo,18397 +sympy/tensor/array/dense_ndim_array.py,sha256=Ie8qVMJyp2Tsq7aVhmZpPX8X-KTlF9uaxkQfTzCZ9z8,6433 +sympy/tensor/array/expressions/__init__.py,sha256=OUMJjZY7HtWJL0ygqkdWC8LdCqibJZhHCfYeXu-eB4E,7045 +sympy/tensor/array/expressions/__pycache__/__init__.cpython-312.pyc,, +sympy/tensor/array/expressions/__pycache__/array_expressions.cpython-312.pyc,, +sympy/tensor/array/expressions/__pycache__/arrayexpr_derivatives.cpython-312.pyc,, +sympy/tensor/array/expressions/__pycache__/conv_array_to_indexed.cpython-312.pyc,, +sympy/tensor/array/expressions/__pycache__/conv_array_to_matrix.cpython-312.pyc,, +sympy/tensor/array/expressions/__pycache__/conv_indexed_to_array.cpython-312.pyc,, +sympy/tensor/array/expressions/__pycache__/conv_matrix_to_array.cpython-312.pyc,, +sympy/tensor/array/expressions/__pycache__/from_array_to_indexed.cpython-312.pyc,, +sympy/tensor/array/expressions/__pycache__/from_array_to_matrix.cpython-312.pyc,, +sympy/tensor/array/expressions/__pycache__/from_indexed_to_array.cpython-312.pyc,, +sympy/tensor/array/expressions/__pycache__/from_matrix_to_array.cpython-312.pyc,, +sympy/tensor/array/expressions/__pycache__/utils.cpython-312.pyc,, +sympy/tensor/array/expressions/array_expressions.py,sha256=28TI8cwwQ4Q-QCI9X_j6X-lG0kR6amjAe9-h9JKb5EU,76961 +sympy/tensor/array/expressions/arrayexpr_derivatives.py,sha256=W9-bY2LL83lLSNHXItzqjOgvf-HIDbUXPoVw8uOymcg,6249 +sympy/tensor/array/expressions/conv_array_to_indexed.py,sha256=BIwlQr7RKC8bZN3mR8ICC5TYOC9uasYcV0Zc1VNKmiE,445 +sympy/tensor/array/expressions/conv_array_to_matrix.py,sha256=85YZBTZI4o9dJtKDJXXug_lJVLG8dT_22AT7l7DKoyE,416 +sympy/tensor/array/expressions/conv_indexed_to_array.py,sha256=EyW52TplBxIx25mUDvI_5Tzc8LD6Mnp6XNW9wIw9pH4,254 +sympy/tensor/array/expressions/conv_matrix_to_array.py,sha256=XYyqt0NsQSrgNpEkr8xTGeUhR7ZYeNljVFfVEF1K7vA,250 +sympy/tensor/array/expressions/from_array_to_indexed.py,sha256=3YIcsAzWVWQRJYQS90uPvSl2dM7ZqLV_qt7E9-uYU28,3936 +sympy/tensor/array/expressions/from_array_to_matrix.py,sha256=4HUbCfR2BHd54Ijws9DCcSs6aAJ-k8RwT195NTQImis,41435 +sympy/tensor/array/expressions/from_indexed_to_array.py,sha256=RUcKemmrwuK5RFRr19YSPVMCOkZfLAWlbbB56u8Wi0g,11187 +sympy/tensor/array/expressions/from_matrix_to_array.py,sha256=yIY1RupF9-FVV3jZLsqWxZ1ckoE1-HkQyM8cQIm4_Gs,3929 +sympy/tensor/array/expressions/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/tensor/array/expressions/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/tensor/array/expressions/tests/__pycache__/test_array_expressions.cpython-312.pyc,, +sympy/tensor/array/expressions/tests/__pycache__/test_arrayexpr_derivatives.cpython-312.pyc,, +sympy/tensor/array/expressions/tests/__pycache__/test_as_explicit.cpython-312.pyc,, +sympy/tensor/array/expressions/tests/__pycache__/test_convert_array_to_indexed.cpython-312.pyc,, +sympy/tensor/array/expressions/tests/__pycache__/test_convert_array_to_matrix.cpython-312.pyc,, +sympy/tensor/array/expressions/tests/__pycache__/test_convert_indexed_to_array.cpython-312.pyc,, +sympy/tensor/array/expressions/tests/__pycache__/test_convert_matrix_to_array.cpython-312.pyc,, +sympy/tensor/array/expressions/tests/__pycache__/test_deprecated_conv_modules.cpython-312.pyc,, +sympy/tensor/array/expressions/tests/test_array_expressions.py,sha256=QUAdxQ9TvBpDEAZoJpLSWwbqjmuflPe3xBRP30lFZr0,31262 +sympy/tensor/array/expressions/tests/test_arrayexpr_derivatives.py,sha256=lpC4ly6MJLDRBcVt3GcP3H6ke9bI-o3VULw0xyF5QbY,2470 +sympy/tensor/array/expressions/tests/test_as_explicit.py,sha256=nOjFKXCqYNu2O7Szc1TD1x1bsUchPRAG3nGlNGEd1Yg,2568 +sympy/tensor/array/expressions/tests/test_convert_array_to_indexed.py,sha256=6yNxGXH6BX5607FTjMkwR2t9wNVlEhV8JMSh4UIWux8,2500 +sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py,sha256=2vkSep9CPKYrQQS0u8Ayn_sc7yek1zwzjjCWK5cfYe8,29311 +sympy/tensor/array/expressions/tests/test_convert_indexed_to_array.py,sha256=RVEG_qUsXiBH9gHtWp2-9pMC4J2aLc4iUdzBFM0QyTw,8615 +sympy/tensor/array/expressions/tests/test_convert_matrix_to_array.py,sha256=G2g5E0l-FABwYyQowbKKvLcEI8NViJXaYLW3eUEcvjw,4595 +sympy/tensor/array/expressions/tests/test_deprecated_conv_modules.py,sha256=DG8IoUtxCy2acWjUHUUKu4bRsTxXbeFLFjKMLA2GdLY,1216 +sympy/tensor/array/expressions/utils.py,sha256=Rn58boHHUEoBZFtinDpruLWFBkNBwgkVQ4c9m7Nym1o,3939 +sympy/tensor/array/mutable_ndim_array.py,sha256=M0PTt8IOIcVXqQPWe2N50sm4Eq2bodRXV4Vkd08crXk,277 +sympy/tensor/array/ndim_array.py,sha256=bZvA21fSTMc2sQLJN4AovQspddzmnINBWFPr-TeGmm0,19138 +sympy/tensor/array/sparse_ndim_array.py,sha256=4nD_Hg-JdC_1mYQTohmKFfL5M1Ugdq0fpnDUILkTtq8,6387 +sympy/tensor/array/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/tensor/array/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/tensor/array/tests/__pycache__/test_array_comprehension.cpython-312.pyc,, +sympy/tensor/array/tests/__pycache__/test_array_derivatives.cpython-312.pyc,, +sympy/tensor/array/tests/__pycache__/test_arrayop.cpython-312.pyc,, +sympy/tensor/array/tests/__pycache__/test_immutable_ndim_array.cpython-312.pyc,, +sympy/tensor/array/tests/__pycache__/test_mutable_ndim_array.cpython-312.pyc,, +sympy/tensor/array/tests/__pycache__/test_ndim_array.cpython-312.pyc,, +sympy/tensor/array/tests/__pycache__/test_ndim_array_conversions.cpython-312.pyc,, +sympy/tensor/array/tests/test_array_comprehension.py,sha256=e8MsWbvwmr-HxTfaM7i8HoIVofa8InLzF9PTCIVvzjU,4529 +sympy/tensor/array/tests/test_array_derivatives.py,sha256=hS10Bkb3F2kWoFoxk2ucr21p0r5DfwHDYPI8HcmAl0o,1601 +sympy/tensor/array/tests/test_arrayop.py,sha256=WahGcUnArsAo9eaMqGT7_AjKons0WgFzLOWTtNvnSEI,25844 +sympy/tensor/array/tests/test_immutable_ndim_array.py,sha256=9ji_14szn-qoL6DQ5muzIFNaXefT7n55PFigXoFwk50,15823 +sympy/tensor/array/tests/test_mutable_ndim_array.py,sha256=rFFa0o0AJYgPNnpqijl91Vb9EW2kgHGQc6cu9f1fIvY,13070 +sympy/tensor/array/tests/test_ndim_array.py,sha256=KH-9LAME3ldVIu5n7Vd_Xr36dN4frCdiF9qZdBWETu0,2232 +sympy/tensor/array/tests/test_ndim_array_conversions.py,sha256=CUGDCbCcslACy3Ngq-zoig9JnO4yHTw3IPcKy0FnRpw,648 +sympy/tensor/functions.py,sha256=FNZ2M0HGVaASJ_1AkPu1vF5NHNLmBXKLsj0Q5wKMX90,4168 +sympy/tensor/index_methods.py,sha256=dcX9kNKLHi_XXkFHBPS-fcM-PaeYKkX80jmzxC0siiQ,15434 +sympy/tensor/indexed.py,sha256=3qiQehMvXSDbr_RDXg6l_aEu6dHZXEfXrMoXCJj7Cqo,24515 +sympy/tensor/tensor.py,sha256=EQ9qJjtvij4gG101jB1eOuTtaSmvm1Da3IHVCBn1Flo,181094 +sympy/tensor/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/tensor/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/tensor/tests/__pycache__/test_functions.cpython-312.pyc,, +sympy/tensor/tests/__pycache__/test_index_methods.cpython-312.pyc,, +sympy/tensor/tests/__pycache__/test_indexed.cpython-312.pyc,, +sympy/tensor/tests/__pycache__/test_printing.cpython-312.pyc,, +sympy/tensor/tests/__pycache__/test_tensor.cpython-312.pyc,, +sympy/tensor/tests/__pycache__/test_tensor_element.cpython-312.pyc,, +sympy/tensor/tests/__pycache__/test_tensor_operators.cpython-312.pyc,, +sympy/tensor/tests/test_functions.py,sha256=rBBHjJIUA2oR83UgEJ_GIASDWfTZXDzOllmcO90XYDU,1552 +sympy/tensor/tests/test_index_methods.py,sha256=Pu951z4yYYMOXBKcNteH63hTAxmNX8702nSQH_pciFE,7112 +sympy/tensor/tests/test_indexed.py,sha256=EB2-t0gYkaTOvrCkhyW2cEL_MVi4xBUZxbf35NA-puI,16376 +sympy/tensor/tests/test_printing.py,sha256=sUx_rChNTWFKPNwVl296QXO-d4-yemDJnkEHFislsmc,424 +sympy/tensor/tests/test_tensor.py,sha256=XQiLkOtyLLFKX_lWEqpCr2lXxQ6LK_hShj0rz7RrWpk,81236 +sympy/tensor/tests/test_tensor_element.py,sha256=1dF96FtqUGaJzethw23vJIj3H5KdxsU1Xyd4DU54EB4,908 +sympy/tensor/tests/test_tensor_operators.py,sha256=n4md5Dv7QoVSMR4cHbkEKSFDxgTTpEyxMiCAqoqyJyk,17966 +sympy/tensor/toperators.py,sha256=fniTUpdYz0OvtNnFgrHINedX86FxVcxfKj9l_l1p9Rw,8840 +sympy/testing/__init__.py,sha256=IN9aHvoksdZywonAYE0cExFnuPQs9z1E4P742aYZNnE,169 +sympy/testing/__pycache__/__init__.cpython-312.pyc,, +sympy/testing/__pycache__/matrices.cpython-312.pyc,, +sympy/testing/__pycache__/pytest.cpython-312.pyc,, +sympy/testing/__pycache__/quality_unicode.cpython-312.pyc,, +sympy/testing/__pycache__/randtest.cpython-312.pyc,, +sympy/testing/__pycache__/runtests.cpython-312.pyc,, +sympy/testing/__pycache__/runtests_pytest.cpython-312.pyc,, +sympy/testing/__pycache__/tmpfiles.cpython-312.pyc,, +sympy/testing/matrices.py,sha256=VWBPdjIUYNHE7fdbYcmQwQTYcIWpOP9tFn9A0rGCBmE,216 +sympy/testing/pytest.py,sha256=xiKL67rD4sKYVZ1Xqci4arPJQzrm3xWfg-m6I7eWNBM,13363 +sympy/testing/quality_unicode.py,sha256=quKFUpEUPftVGNpsj71WpRoeKZUzc8sgLjODRmHPf-w,3482 +sympy/testing/randtest.py,sha256=IKDFAm8b72Z1OkT7vpgnZjaW5LsSU_wf6g35sCkq9I0,562 +sympy/testing/runtests.py,sha256=dD9_0xtvG0wMgQtdvxDi7ePc2CL2ybNRqHKgHjJomzE,89921 +sympy/testing/runtests_pytest.py,sha256=KSqhzaRis7sx2AwctWsP6VjCbDcg6C5UCApp_LUNRuc,17801 +sympy/testing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/testing/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/testing/tests/__pycache__/diagnose_imports.cpython-312.pyc,, +sympy/testing/tests/__pycache__/test_code_quality.cpython-312.pyc,, +sympy/testing/tests/__pycache__/test_deprecated.cpython-312.pyc,, +sympy/testing/tests/__pycache__/test_module_imports.cpython-312.pyc,, +sympy/testing/tests/__pycache__/test_pytest.cpython-312.pyc,, +sympy/testing/tests/__pycache__/test_runtests_pytest.cpython-312.pyc,, +sympy/testing/tests/diagnose_imports.py,sha256=VQAc0WLHgQgksu6kcQLmEVW4O98v7YgjLMzCLNZ6JfE,9508 +sympy/testing/tests/test_code_quality.py,sha256=Yzb1CAIAGTO29Ay2fsPn0-OqstAoy9FMiAMIed6iVZE,19214 +sympy/testing/tests/test_deprecated.py,sha256=wQZHs4wDNuK4flaKKLsJW6XRMtrVjMv_5rUP3WspgPA,183 +sympy/testing/tests/test_module_imports.py,sha256=5w6F6JW6K7lgpbB4X9Tj0Vw8AcNVlfaSuvbwKXJKD6c,1459 +sympy/testing/tests/test_pytest.py,sha256=iKO10Tvua1Xem6a22IWH4SDrpFfr-bM-rXx039Ua7YA,6778 +sympy/testing/tests/test_runtests_pytest.py,sha256=C4bo-SOx8BsxvT4M_0OPUiwSEXShaMqpYRoedMmbR1g,6083 +sympy/testing/tmpfiles.py,sha256=bF8ktKC9lDhS65gahB9hOewsZ378UkhLgq3QHiqWYXU,1042 +sympy/this.py,sha256=XfOkN5EIM2RuDxSm_q6k_R_WtkIoSy6PXWKp3aAXvoc,550 +sympy/unify/__init__.py,sha256=Upa9h7SSr9W1PXo0WkNESsGsMZ85rcWkeruBtkAi3Fg,293 +sympy/unify/__pycache__/__init__.cpython-312.pyc,, +sympy/unify/__pycache__/core.cpython-312.pyc,, +sympy/unify/__pycache__/rewrite.cpython-312.pyc,, +sympy/unify/__pycache__/usympy.cpython-312.pyc,, +sympy/unify/core.py,sha256=-BCNPPMdfZuhhIWqyn9pYJoO8yFPGDX78Hn2551ABuE,7037 +sympy/unify/rewrite.py,sha256=Emr8Uoum3gxKpMDqFHJIjx3xChArUIN6XIy6NPfCS8I,1798 +sympy/unify/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/unify/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/unify/tests/__pycache__/test_rewrite.cpython-312.pyc,, +sympy/unify/tests/__pycache__/test_sympy.cpython-312.pyc,, +sympy/unify/tests/__pycache__/test_unify.cpython-312.pyc,, +sympy/unify/tests/test_rewrite.py,sha256=BgA8zmdz9Nw-Xbu4-w3UABeWypqLvmy9VzL744EmYtE,2002 +sympy/unify/tests/test_sympy.py,sha256=UCItZJNAx9dG5F7O27pyXUF1-e6aOwkZ-cVdB6SZFZc,5922 +sympy/unify/tests/test_unify.py,sha256=4TlgchV6NWuBekJx9RGlMjx3-UwonzgIYXDytb7sBRU,3029 +sympy/unify/usympy.py,sha256=6Kxx96FXSdqXimLseVK_FkYwy2vqWhNnxMVPMRShvy4,3964 +sympy/utilities/__init__.py,sha256=nbQhzII8dw5zd4hQJ2SUyriK5dOrqf-bbjy10XKQXPw,840 +sympy/utilities/__pycache__/__init__.cpython-312.pyc,, +sympy/utilities/__pycache__/autowrap.cpython-312.pyc,, +sympy/utilities/__pycache__/codegen.cpython-312.pyc,, +sympy/utilities/__pycache__/decorator.cpython-312.pyc,, +sympy/utilities/__pycache__/enumerative.cpython-312.pyc,, +sympy/utilities/__pycache__/exceptions.cpython-312.pyc,, +sympy/utilities/__pycache__/iterables.cpython-312.pyc,, +sympy/utilities/__pycache__/lambdify.cpython-312.pyc,, +sympy/utilities/__pycache__/magic.cpython-312.pyc,, +sympy/utilities/__pycache__/matchpy_connector.cpython-312.pyc,, +sympy/utilities/__pycache__/memoization.cpython-312.pyc,, +sympy/utilities/__pycache__/misc.cpython-312.pyc,, +sympy/utilities/__pycache__/pkgdata.cpython-312.pyc,, +sympy/utilities/__pycache__/pytest.cpython-312.pyc,, +sympy/utilities/__pycache__/randtest.cpython-312.pyc,, +sympy/utilities/__pycache__/runtests.cpython-312.pyc,, +sympy/utilities/__pycache__/source.cpython-312.pyc,, +sympy/utilities/__pycache__/timeutils.cpython-312.pyc,, +sympy/utilities/__pycache__/tmpfiles.cpython-312.pyc,, +sympy/utilities/_compilation/__init__.py,sha256=uYUDPbwrMTbGEMVuago32EN_ix8fsi5M0SvcLOtwMOk,751 +sympy/utilities/_compilation/__pycache__/__init__.cpython-312.pyc,, +sympy/utilities/_compilation/__pycache__/availability.cpython-312.pyc,, +sympy/utilities/_compilation/__pycache__/compilation.cpython-312.pyc,, +sympy/utilities/_compilation/__pycache__/runners.cpython-312.pyc,, +sympy/utilities/_compilation/__pycache__/util.cpython-312.pyc,, +sympy/utilities/_compilation/availability.py,sha256=ybxp3mboH5772JHTWKBN1D-cs6QxATQiaL4zJVV4RE0,2884 +sympy/utilities/_compilation/compilation.py,sha256=qkfDtSgSeRJ-97E5hN1asUqoDXS4nnNgYoHCA8WAmHA,22156 +sympy/utilities/_compilation/runners.py,sha256=KAinYF0m55dRdDFO5pvHBlvTxDY0ldoImqTOwX7VmL4,10237 +sympy/utilities/_compilation/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/utilities/_compilation/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/utilities/_compilation/tests/__pycache__/test_compilation.cpython-312.pyc,, +sympy/utilities/_compilation/tests/test_compilation.py,sha256=DmdxCPlWaqgtNZPWzMVPwqRuqqJcgWBWxXfOEMZ21D0,3189 +sympy/utilities/_compilation/util.py,sha256=otSIKhM5YSYzbUNYycagG2xSj6owlQVrwIVl0rv7Owc,8611 +sympy/utilities/autowrap.py,sha256=l8noWRKmA-B814S92RK3O64YWAkARnMfqY1AQqi2S8g,42561 +sympy/utilities/codegen.py,sha256=1ieFSlxGgd9utMSPzN5NraTfoSSzlUM9V_BnGYMuMc8,81670 +sympy/utilities/decorator.py,sha256=NaZBNCDdMhG4_3esEOLZCbVQcjltvi3lrMIRCqewfR4,11184 +sympy/utilities/enumerative.py,sha256=ah4Td5KhqGdPR7EQHcUDOsYLDH64Sh2z6xm5gDpJSFg,43585 +sympy/utilities/exceptions.py,sha256=RoKY7jDIq6OsZbNSCyneWbVQb1Cw2MtOuioJlCKmBec,10570 +sympy/utilities/iterables.py,sha256=noIMRQmdSPfbg1LorRPHreozS265u4IHUmDkOvMB2po,91103 +sympy/utilities/lambdify.py,sha256=lepieExI19QvZYPrGl_WZaFwta8YZBo6AgxDnwq01ow,57816 +sympy/utilities/magic.py,sha256=ofrwi1-xwMWb4VCQOEIwe4J1QAwxOscigDq26uSn3iY,400 +sympy/utilities/matchpy_connector.py,sha256=7dSDOPbN5Y_XW6bIGVNK3dJ-gVdTB_liJ8O5rIqd28c,11948 +sympy/utilities/mathml/__init__.py,sha256=74VhxNJlvCZTm2Jh3t69N8QZRklTQjqMvqFMLVwCKQk,3388 +sympy/utilities/mathml/__pycache__/__init__.cpython-312.pyc,, +sympy/utilities/mathml/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/utilities/mathml/data/__pycache__/__init__.cpython-312.pyc,, +sympy/utilities/mathml/data/mmlctop.xsl,sha256=fi3CTNyg-mSscOGYBXLJv8veE_ItR_YTFMJ4jmjp6aE,114444 +sympy/utilities/mathml/data/mmltex.xsl,sha256=haX7emZOfD6_nbn5BjK93F-C85mSS8KogAbIBsW1aBA,137304 +sympy/utilities/mathml/data/simple_mmlctop.xsl,sha256=OM-Vge1satH-MAYwWhraeXcorn1KGtuqBK-PDddaOrk,114433 +sympy/utilities/memoization.py,sha256=jD6RjVMZkGpNZYaJ9481vTiqvmwyu1IKDpsF5PYIvf4,1838 +sympy/utilities/misc.py,sha256=C6C3Em9YUjqg4gUhVdu97K0Wt_gRxuhNHS0TW6MlrxQ,16000 +sympy/utilities/pkgdata.py,sha256=BiBonyObCsS6EnLUII_1kDtchDN7Tur0T4GMzoUo06M,935 +sympy/utilities/pytest.py,sha256=ifo5fkOQ94HKXjy_U__mLFSohNRGP2ft8Z4P5gAi4yw,440 +sympy/utilities/randtest.py,sha256=Qlr4MMe0ade6jUH6pIEE0-v4g4qGswJhKpdaQFS_GDw,435 +sympy/utilities/runtests.py,sha256=Js3GGuzxQDZw5Tr5Kge0DCYx9gi3eya4DZxfwib6e3Y,451 +sympy/utilities/source.py,sha256=ShIXRNtplSEfZNi5VDYD3yi6305eRz4TmchEOEvcicw,1127 +sympy/utilities/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/utilities/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_autowrap.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_codegen.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_codegen_julia.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_codegen_octave.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_codegen_rust.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_decorator.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_deprecated.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_enumerative.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_exceptions.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_iterables.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_lambdify.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_matchpy_connector.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_mathml.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_misc.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_pickling.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_source.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_timeutils.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_wester.cpython-312.pyc,, +sympy/utilities/tests/__pycache__/test_xxe.cpython-312.pyc,, +sympy/utilities/tests/test_autowrap.py,sha256=PA6zaRVrIWyQHq6bGKezqNB6YWTfcnnB9VH2vzaEfaQ,14865 +sympy/utilities/tests/test_codegen.py,sha256=pjfhZTa5LI9gdrakDfLtBBrIxgWjWORR_NBDW9J8Cq8,56130 +sympy/utilities/tests/test_codegen_julia.py,sha256=QYqSluVhmxq_BAagEKBb6eJIseFFAweMjpuLgNPMUWI,18540 +sympy/utilities/tests/test_codegen_octave.py,sha256=GUQIj6YjsMsj8ZLmVngWa9ovoyqfwvikWXdeS7m_c7I,17830 +sympy/utilities/tests/test_codegen_rust.py,sha256=seq9o51dsa09MmcqwKRkGiurbWLs1uAIjaz7xGOKNE4,12326 +sympy/utilities/tests/test_decorator.py,sha256=VYUvzUrVI7I7MK0YZxLLEmEu4pV5dqaB1CLEJ8Ocav4,3705 +sympy/utilities/tests/test_deprecated.py,sha256=LRrZ2UxuXnK6Jwxl8vT0EdLT-q-7jLkTC69U9JjuYYU,489 +sympy/utilities/tests/test_enumerative.py,sha256=nw-1r0MgxbzYkScmxv7HUAIAQycg8pUVOH_slDRLg7E,6097 +sympy/utilities/tests/test_exceptions.py,sha256=OKRa2yuHMtnVcnisu-xcaedi2RKsH9QrgU9exgoOK30,716 +sympy/utilities/tests/test_iterables.py,sha256=xYWyoDtVkYfnIOdA-5yUYZsxo4iTsExaNpVmjMuwpTc,35288 +sympy/utilities/tests/test_lambdify.py,sha256=emTSDwHdGprENO3ugK86k1L6m8Y3IamPj1oUNIKaYrQ,73531 +sympy/utilities/tests/test_matchpy_connector.py,sha256=mBrAev2Hxe4jg_1ny3ZaGIfh2xvWbr6BDRVjB9owJFM,4850 +sympy/utilities/tests/test_mathml.py,sha256=-6z1MRYEH4eYQi2_wt8zmdjwtt5Cn483zqsvD-o_r70,836 +sympy/utilities/tests/test_misc.py,sha256=xZh6ux9o2iZpWvfX_ivp4lD3WgJVeP5k6ipppNGHDsw,4643 +sympy/utilities/tests/test_pickling.py,sha256=ZXGzB_gQ9juws_N_n2vf6QPVojdfP4Mbl7uqdtkPb0E,23600 +sympy/utilities/tests/test_source.py,sha256=ObjrJxZFVhLgXjVmFHUy7bti9UPPgOh5Cptw8lHW9mM,289 +sympy/utilities/tests/test_timeutils.py,sha256=sCRC6BCSho1e9n4clke3QXHx4a3qYLru-bddS_sEmFA,337 +sympy/utilities/tests/test_wester.py,sha256=S79UNsGhEW5z6hDriQB8OY_Vhaz1j0Q7yv31HynyDfk,94866 +sympy/utilities/tests/test_xxe.py,sha256=xk1j0Dd96wsGYKRNDzXTW0hTQejGCfiZcEhYcYiqojg,66 +sympy/utilities/timeutils.py,sha256=PNHyvuEM66UEXLF8ye6PMilcEDK75B9wab3ai8a9cyo,1941 +sympy/utilities/tmpfiles.py,sha256=tQP3g7LTrnXTGqUgGNoIZtjug6O6lq6EYLrKPJcUGEU,450 +sympy/vector/__init__.py,sha256=bgKutVqUPWuvHWBpiEm6XWE6iGfAPJw3pt19NRn2n10,1969 +sympy/vector/__pycache__/__init__.cpython-312.pyc,, +sympy/vector/__pycache__/basisdependent.cpython-312.pyc,, +sympy/vector/__pycache__/coordsysrect.cpython-312.pyc,, +sympy/vector/__pycache__/deloperator.cpython-312.pyc,, +sympy/vector/__pycache__/dyadic.cpython-312.pyc,, +sympy/vector/__pycache__/functions.cpython-312.pyc,, +sympy/vector/__pycache__/implicitregion.cpython-312.pyc,, +sympy/vector/__pycache__/integrals.cpython-312.pyc,, +sympy/vector/__pycache__/kind.cpython-312.pyc,, +sympy/vector/__pycache__/operators.cpython-312.pyc,, +sympy/vector/__pycache__/orienters.cpython-312.pyc,, +sympy/vector/__pycache__/parametricregion.cpython-312.pyc,, +sympy/vector/__pycache__/point.cpython-312.pyc,, +sympy/vector/__pycache__/scalar.cpython-312.pyc,, +sympy/vector/__pycache__/vector.cpython-312.pyc,, +sympy/vector/basisdependent.py,sha256=P7LogUck6NWjEzAOH3dYr4A8M5QCOPaCW75lmiQpBqU,11857 +sympy/vector/coordsysrect.py,sha256=0BKdr8AG8BUJnShIIyyCvkU5OVdjtZsKcBuGgdbvdHw,36833 +sympy/vector/deloperator.py,sha256=4BJNjmI342HkVRmeQkqauqvibKsf2HOuzknQTfQMkpg,3191 +sympy/vector/dyadic.py,sha256=IOyrgONyGDHPtG0RINcMgetAVMSOmYI5a99s-OwXBTA,8571 +sympy/vector/functions.py,sha256=rmEBaV0XpZLkCPcJFojHS9CNHirV55v5sDwNqTPwqGM,15454 +sympy/vector/implicitregion.py,sha256=4-M_-shL4EJ9nfjAZ_xg00IXZVQghcCZ3bv8QGbkopI,16158 +sympy/vector/integrals.py,sha256=x8DrvKXPznE05JgnZ7I3IWLWrvFl9SEghGaFmHrBaE4,6837 +sympy/vector/kind.py,sha256=U6qxciZY7-ACzBSpGM0iSTI5tqflpPBvm4_J9ujyxyE,1812 +sympy/vector/operators.py,sha256=dNC7mNXZb3KxX5GyjFNDTLTkzSnYjOohZtBXuQ1keZE,9579 +sympy/vector/orienters.py,sha256=EtWNWfOvAuy_wipam9SA7_muKSrsP-43UPRCCz56sb0,11798 +sympy/vector/parametricregion.py,sha256=gAarunY8q3D8WVvryZEbJQ4g-nlXo4FnO-CbyEpVUXc,5932 +sympy/vector/point.py,sha256=-JFOibsQclOKC2m2qZRiGGB4oK9ieVZRd2ll5g4k3bE,4488 +sympy/vector/scalar.py,sha256=WAb25BC0TEOZ-_bEtL1gdySuM1adJzK47kJYTrC4Y4w,2024 +sympy/vector/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +sympy/vector/tests/__pycache__/__init__.cpython-312.pyc,, +sympy/vector/tests/__pycache__/test_coordsysrect.cpython-312.pyc,, +sympy/vector/tests/__pycache__/test_dyadic.cpython-312.pyc,, +sympy/vector/tests/__pycache__/test_field_functions.cpython-312.pyc,, +sympy/vector/tests/__pycache__/test_functions.cpython-312.pyc,, +sympy/vector/tests/__pycache__/test_implicitregion.cpython-312.pyc,, +sympy/vector/tests/__pycache__/test_integrals.cpython-312.pyc,, +sympy/vector/tests/__pycache__/test_operators.cpython-312.pyc,, +sympy/vector/tests/__pycache__/test_parametricregion.cpython-312.pyc,, +sympy/vector/tests/__pycache__/test_printing.cpython-312.pyc,, +sympy/vector/tests/__pycache__/test_vector.cpython-312.pyc,, +sympy/vector/tests/test_coordsysrect.py,sha256=q9n9OIG_CpD4KQN20dzwRZIXoMv7VSgp8fHmVnkZfr0,19595 +sympy/vector/tests/test_dyadic.py,sha256=f1R-BL_63VBbc0XgEX_LYzV_3OupYd4hp5RzRk6dAbI,4949 +sympy/vector/tests/test_field_functions.py,sha256=v9l8Ex8K2MsPGxqAPhpEgu6WAo6wS6qvdWLKQMxgE4A,14094 +sympy/vector/tests/test_functions.py,sha256=Bs2sekdDJyw_wrUpG7vZQGH0y0S4C4AbxGSpeU_8C2s,8050 +sympy/vector/tests/test_implicitregion.py,sha256=wVilD5H-MhHiW58QT6P5U7uT79JdKHm9D7JgZoi6BE4,4028 +sympy/vector/tests/test_integrals.py,sha256=iDq3Wpr8I8EXAGkXqMpA-P9i1zEnV7lU8WR6xBOhEK0,5087 +sympy/vector/tests/test_operators.py,sha256=KexUWvc_Nwp2HWrEbhxiO7MeaFxYlckrp__Tkwg-wmU,1613 +sympy/vector/tests/test_parametricregion.py,sha256=OfKapF9A_g9X6JxgYc0UfxIhwXzRERzaj-EijQCJONw,4009 +sympy/vector/tests/test_printing.py,sha256=3BeW55iQ4qXdfDTFqptE2ufJPJIBOzdfIYVx84n_EwA,7708 +sympy/vector/tests/test_vector.py,sha256=rJpMlUWiezrY6drHUNdJc8_FDYMwGCG4lBy8zS4XSZk,10238 +sympy/vector/vector.py,sha256=aOSfyfRvkatzWHWuulY6n0_iqElI5mntAUjNPptpBiM,20322 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..8acb95590701b87bf84eec079cf4e3989f63b098 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (79.0.1) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..42a12f960335556fcee728e5754c346447d4e89c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +isympy = isympy:main diff --git a/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..0aa85c253508b68bb075f556be3c3f76dc4467ad --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/sympy-1.14.0.dist-info/top_level.txt @@ -0,0 +1,2 @@ +isympy +sympy diff --git a/TTS/Kokoro/.venv/Lib/site-packages/sympy/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/sympy/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c67ba49409169c49ac5d34f2be365def3c30369b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/sympy/__init__.py @@ -0,0 +1,545 @@ +""" +SymPy is a Python library for symbolic mathematics. It aims to become a +full-featured computer algebra system (CAS) while keeping the code as simple +as possible in order to be comprehensible and easily extensible. SymPy is +written entirely in Python. It depends on mpmath, and other external libraries +may be optionally for things like plotting support. + +See the webpage for more information and documentation: + + https://sympy.org + +""" + + +# Keep this in sync with setup.py/pyproject.toml +import sys +if sys.version_info < (3, 9): + raise ImportError("Python version 3.9 or above is required for SymPy.") +del sys + + +try: + import mpmath +except ImportError: + raise ImportError("SymPy now depends on mpmath as an external library. " + "See https://docs.sympy.org/latest/install.html#mpmath for more information.") + +del mpmath + +from sympy.release import __version__ +from sympy.core.cache import lazy_function + +if 'dev' in __version__: + def enable_warnings(): + import warnings + warnings.filterwarnings('default', '.*', DeprecationWarning, module='sympy.*') + del warnings + enable_warnings() + del enable_warnings + + +def __sympy_debug(): + # helper function so we don't import os globally + import os + debug_str = os.getenv('SYMPY_DEBUG', 'False') + if debug_str in ('True', 'False'): + return eval(debug_str) + else: + raise RuntimeError("unrecognized value for SYMPY_DEBUG: %s" % + debug_str) +# Fails py2 test if using type hinting +SYMPY_DEBUG = __sympy_debug() # type: bool + + +from .core import (sympify, SympifyError, cacheit, Basic, Atom, + preorder_traversal, S, Expr, AtomicExpr, UnevaluatedExpr, Symbol, + Wild, Dummy, symbols, var, Number, Float, Rational, Integer, + NumberSymbol, RealNumber, igcd, ilcm, seterr, E, I, nan, oo, pi, zoo, + AlgebraicNumber, comp, mod_inverse, Pow, integer_nthroot, integer_log, + trailing, Mul, prod, Add, Mod, Rel, Eq, Ne, Lt, Le, Gt, Ge, Equality, + GreaterThan, LessThan, Unequality, StrictGreaterThan, StrictLessThan, + vectorize, Lambda, WildFunction, Derivative, diff, FunctionClass, + Function, Subs, expand, PoleError, count_ops, expand_mul, expand_log, + expand_func, expand_trig, expand_complex, expand_multinomial, nfloat, + expand_power_base, expand_power_exp, arity, PrecisionExhausted, N, + evalf, Tuple, Dict, gcd_terms, factor_terms, factor_nc, evaluate, + Catalan, EulerGamma, GoldenRatio, TribonacciConstant, bottom_up, use, + postorder_traversal, default_sort_key, ordered, num_digits) + +from .logic import (to_cnf, to_dnf, to_nnf, And, Or, Not, Xor, Nand, Nor, + Implies, Equivalent, ITE, POSform, SOPform, simplify_logic, bool_map, + true, false, satisfiable) + +from .assumptions import (AppliedPredicate, Predicate, AssumptionsContext, + assuming, Q, ask, register_handler, remove_handler, refine) + +from .polys import (Poly, PurePoly, poly_from_expr, parallel_poly_from_expr, + degree, total_degree, degree_list, LC, LM, LT, pdiv, prem, pquo, + pexquo, div, rem, quo, exquo, half_gcdex, gcdex, invert, + subresultants, resultant, discriminant, cofactors, gcd_list, gcd, + lcm_list, lcm, terms_gcd, trunc, monic, content, primitive, compose, + decompose, sturm, gff_list, gff, sqf_norm, sqf_part, sqf_list, sqf, + factor_list, factor, intervals, refine_root, count_roots, all_roots, + real_roots, nroots, ground_roots, nth_power_roots_poly, cancel, + reduced, groebner, is_zero_dimensional, GroebnerBasis, poly, + symmetrize, horner, interpolate, rational_interpolate, viete, together, + BasePolynomialError, ExactQuotientFailed, PolynomialDivisionFailed, + OperationNotSupported, HeuristicGCDFailed, HomomorphismFailed, + IsomorphismFailed, ExtraneousFactors, EvaluationFailed, + RefinementFailed, CoercionFailed, NotInvertible, NotReversible, + NotAlgebraic, DomainError, PolynomialError, UnificationFailed, + GeneratorsError, GeneratorsNeeded, ComputationFailed, + UnivariatePolynomialError, MultivariatePolynomialError, + PolificationFailed, OptionError, FlagError, minpoly, + minimal_polynomial, primitive_element, field_isomorphism, + to_number_field, isolate, round_two, prime_decomp, prime_valuation, + galois_group, itermonomials, Monomial, lex, grlex, + grevlex, ilex, igrlex, igrevlex, CRootOf, rootof, RootOf, + ComplexRootOf, RootSum, roots, Domain, FiniteField, IntegerRing, + RationalField, RealField, ComplexField, PythonFiniteField, + GMPYFiniteField, PythonIntegerRing, GMPYIntegerRing, PythonRational, + GMPYRationalField, AlgebraicField, PolynomialRing, FractionField, + ExpressionDomain, FF_python, FF_gmpy, ZZ_python, ZZ_gmpy, QQ_python, + QQ_gmpy, GF, FF, ZZ, QQ, ZZ_I, QQ_I, RR, CC, EX, EXRAW, + construct_domain, swinnerton_dyer_poly, cyclotomic_poly, + symmetric_poly, random_poly, interpolating_poly, jacobi_poly, + chebyshevt_poly, chebyshevu_poly, hermite_poly, hermite_prob_poly, + legendre_poly, laguerre_poly, apart, apart_list, assemble_partfrac_list, + Options, ring, xring, vring, sring, field, xfield, vfield, sfield) + +from .series import (Order, O, limit, Limit, gruntz, series, approximants, + residue, EmptySequence, SeqPer, SeqFormula, sequence, SeqAdd, SeqMul, + fourier_series, fps, difference_delta, limit_seq) + +from .functions import (factorial, factorial2, rf, ff, binomial, + RisingFactorial, FallingFactorial, subfactorial, carmichael, + fibonacci, lucas, motzkin, tribonacci, harmonic, bernoulli, bell, euler, + catalan, genocchi, andre, partition, divisor_sigma, legendre_symbol, + jacobi_symbol, kronecker_symbol, mobius, primenu, primeomega, + totient, reduced_totient, primepi, sqrt, root, Min, Max, Id, + real_root, Rem, cbrt, re, im, sign, Abs, conjugate, arg, polar_lift, + periodic_argument, unbranched_argument, principal_branch, transpose, + adjoint, polarify, unpolarify, sin, cos, tan, sec, csc, cot, sinc, + asin, acos, atan, asec, acsc, acot, atan2, exp_polar, exp, ln, log, + LambertW, sinh, cosh, tanh, coth, sech, csch, asinh, acosh, atanh, + acoth, asech, acsch, floor, ceiling, frac, Piecewise, piecewise_fold, + piecewise_exclusive, erf, erfc, erfi, erf2, erfinv, erfcinv, erf2inv, + Ei, expint, E1, li, Li, Si, Ci, Shi, Chi, fresnels, fresnelc, gamma, + lowergamma, uppergamma, polygamma, loggamma, digamma, trigamma, + multigamma, dirichlet_eta, zeta, lerchphi, polylog, stieltjes, Eijk, + LeviCivita, KroneckerDelta, SingularityFunction, DiracDelta, Heaviside, + bspline_basis, bspline_basis_set, interpolating_spline, besselj, + bessely, besseli, besselk, hankel1, hankel2, jn, yn, jn_zeros, hn1, + hn2, airyai, airybi, airyaiprime, airybiprime, marcumq, hyper, + meijerg, appellf1, legendre, assoc_legendre, hermite, hermite_prob, + chebyshevt, chebyshevu, chebyshevu_root, chebyshevt_root, laguerre, + assoc_laguerre, gegenbauer, jacobi, jacobi_normalized, Ynm, Ynm_c, + Znm, elliptic_k, elliptic_f, elliptic_e, elliptic_pi, beta, mathieus, + mathieuc, mathieusprime, mathieucprime, riemann_xi, betainc, betainc_regularized) + +from .ntheory import (nextprime, prevprime, prime, primerange, + randprime, Sieve, sieve, primorial, cycle_length, composite, + compositepi, isprime, divisors, proper_divisors, factorint, + multiplicity, perfect_power, factor_cache, pollard_pm1, pollard_rho, primefactors, + divisor_count, proper_divisor_count, + factorrat, + mersenne_prime_exponent, is_perfect, is_mersenne_prime, is_abundant, + is_deficient, is_amicable, is_carmichael, abundance, npartitions, is_primitive_root, + is_quad_residue, n_order, sqrt_mod, + quadratic_residues, primitive_root, nthroot_mod, is_nthpow_residue, + sqrt_mod_iter, discrete_log, quadratic_congruence, + binomial_coefficients, binomial_coefficients_list, + multinomial_coefficients, continued_fraction_periodic, + continued_fraction_iterator, continued_fraction_reduce, + continued_fraction_convergents, continued_fraction, egyptian_fraction) + +from .concrete import product, Product, summation, Sum + +from .discrete import (fft, ifft, ntt, intt, fwht, ifwht, mobius_transform, + inverse_mobius_transform, convolution, covering_product, + intersecting_product) + +from .simplify import (simplify, hypersimp, hypersimilar, logcombine, + separatevars, posify, besselsimp, kroneckersimp, signsimp, + nsimplify, FU, fu, sqrtdenest, cse, epath, EPath, hyperexpand, + collect, rcollect, radsimp, collect_const, fraction, numer, denom, + trigsimp, exptrigsimp, powsimp, powdenest, combsimp, gammasimp, + ratsimp, ratsimpmodprime) + +from .sets import (Set, Interval, Union, EmptySet, FiniteSet, ProductSet, + Intersection, DisjointUnion, imageset, Complement, SymmetricDifference, ImageSet, + Range, ComplexRegion, Complexes, Reals, Contains, ConditionSet, Ordinal, + OmegaPower, ord0, PowerSet, Naturals, Naturals0, UniversalSet, + Integers, Rationals) + +from .solvers import (solve, solve_linear_system, solve_linear_system_LU, + solve_undetermined_coeffs, nsolve, solve_linear, checksol, det_quick, + inv_quick, check_assumptions, failing_assumptions, diophantine, + rsolve, rsolve_poly, rsolve_ratio, rsolve_hyper, checkodesol, + classify_ode, dsolve, homogeneous_order, solve_poly_system, factor_system, + solve_triangulated, pde_separate, pde_separate_add, pde_separate_mul, + pdsolve, classify_pde, checkpdesol, ode_order, reduce_inequalities, + reduce_abs_inequality, reduce_abs_inequalities, solve_poly_inequality, + solve_rational_inequalities, solve_univariate_inequality, decompogen, + solveset, linsolve, linear_eq_to_matrix, nonlinsolve, substitution) + +from .matrices import (ShapeError, NonSquareMatrixError, GramSchmidt, + casoratian, diag, eye, hessian, jordan_cell, list2numpy, matrix2numpy, + matrix_multiply_elementwise, ones, randMatrix, rot_axis1, rot_axis2, + rot_axis3, symarray, wronskian, zeros, MutableDenseMatrix, + DeferredVector, MatrixBase, Matrix, MutableMatrix, + MutableSparseMatrix, banded, ImmutableDenseMatrix, + ImmutableSparseMatrix, ImmutableMatrix, SparseMatrix, MatrixSlice, + BlockDiagMatrix, BlockMatrix, FunctionMatrix, Identity, Inverse, + MatAdd, MatMul, MatPow, MatrixExpr, MatrixSymbol, Trace, Transpose, + ZeroMatrix, OneMatrix, blockcut, block_collapse, matrix_symbols, + Adjoint, hadamard_product, HadamardProduct, HadamardPower, + Determinant, det, diagonalize_vector, DiagMatrix, DiagonalMatrix, + DiagonalOf, trace, DotProduct, kronecker_product, KroneckerProduct, + PermutationMatrix, MatrixPermute, Permanent, per, rot_ccw_axis1, + rot_ccw_axis2, rot_ccw_axis3, rot_givens) + +from .geometry import (Point, Point2D, Point3D, Line, Ray, Segment, Line2D, + Segment2D, Ray2D, Line3D, Segment3D, Ray3D, Plane, Ellipse, Circle, + Polygon, RegularPolygon, Triangle, rad, deg, are_similar, centroid, + convex_hull, idiff, intersection, closest_points, farthest_points, + GeometryError, Curve, Parabola) + +from .utilities import (flatten, group, take, subsets, variations, + numbered_symbols, cartes, capture, dict_merge, prefixes, postfixes, + sift, topological_sort, unflatten, has_dups, has_variety, reshape, + rotations, filldedent, lambdify, + threaded, xthreaded, public, memoize_property, timed) + +from .integrals import (integrate, Integral, line_integrate, mellin_transform, + inverse_mellin_transform, MellinTransform, InverseMellinTransform, + laplace_transform, laplace_correspondence, laplace_initial_conds, + inverse_laplace_transform, LaplaceTransform, + InverseLaplaceTransform, fourier_transform, inverse_fourier_transform, + FourierTransform, InverseFourierTransform, sine_transform, + inverse_sine_transform, SineTransform, InverseSineTransform, + cosine_transform, inverse_cosine_transform, CosineTransform, + InverseCosineTransform, hankel_transform, inverse_hankel_transform, + HankelTransform, InverseHankelTransform, singularityintegrate) + +from .tensor import (IndexedBase, Idx, Indexed, get_contraction_structure, + get_indices, shape, MutableDenseNDimArray, ImmutableDenseNDimArray, + MutableSparseNDimArray, ImmutableSparseNDimArray, NDimArray, + tensorproduct, tensorcontraction, tensordiagonal, derive_by_array, + permutedims, Array, DenseNDimArray, SparseNDimArray) + +from .parsing import parse_expr + +from .calculus import (euler_equations, singularities, is_increasing, + is_strictly_increasing, is_decreasing, is_strictly_decreasing, + is_monotonic, finite_diff_weights, apply_finite_diff, + differentiate_finite, periodicity, not_empty_in, AccumBounds, + is_convex, stationary_points, minimum, maximum) + +from .algebras import Quaternion + +from .printing import (pager_print, pretty, pretty_print, pprint, + pprint_use_unicode, pprint_try_use_unicode, latex, print_latex, + multiline_latex, mathml, print_mathml, python, print_python, pycode, + ccode, print_ccode, smtlib_code, glsl_code, print_glsl, cxxcode, fcode, + print_fcode, rcode, print_rcode, jscode, print_jscode, julia_code, + mathematica_code, octave_code, rust_code, print_gtk, preview, srepr, + print_tree, StrPrinter, sstr, sstrrepr, TableForm, dotprint, + maple_code, print_maple_code) + +test = lazy_function('sympy.testing.runtests_pytest', 'test') +doctest = lazy_function('sympy.testing.runtests', 'doctest') + +# This module causes conflicts with other modules: +# from .stats import * +# Adds about .04-.05 seconds of import time +# from combinatorics import * +# This module is slow to import: +#from physics import units +from .plotting import plot, textplot, plot_backends, plot_implicit, plot_parametric +from .interactive import init_session, init_printing, interactive_traversal + +evalf._create_evalf_table() + +__all__ = [ + '__version__', + + # sympy.core + 'sympify', 'SympifyError', 'cacheit', 'Basic', 'Atom', + 'preorder_traversal', 'S', 'Expr', 'AtomicExpr', 'UnevaluatedExpr', + 'Symbol', 'Wild', 'Dummy', 'symbols', 'var', 'Number', 'Float', + 'Rational', 'Integer', 'NumberSymbol', 'RealNumber', 'igcd', 'ilcm', + 'seterr', 'E', 'I', 'nan', 'oo', 'pi', 'zoo', 'AlgebraicNumber', 'comp', + 'mod_inverse', 'Pow', 'integer_nthroot', 'integer_log', 'trailing', 'Mul', 'prod', + 'Add', 'Mod', 'Rel', 'Eq', 'Ne', 'Lt', 'Le', 'Gt', 'Ge', 'Equality', + 'GreaterThan', 'LessThan', 'Unequality', 'StrictGreaterThan', + 'StrictLessThan', 'vectorize', 'Lambda', 'WildFunction', 'Derivative', + 'diff', 'FunctionClass', 'Function', 'Subs', 'expand', 'PoleError', + 'count_ops', 'expand_mul', 'expand_log', 'expand_func', 'expand_trig', + 'expand_complex', 'expand_multinomial', 'nfloat', 'expand_power_base', + 'expand_power_exp', 'arity', 'PrecisionExhausted', 'N', 'evalf', 'Tuple', + 'Dict', 'gcd_terms', 'factor_terms', 'factor_nc', 'evaluate', 'Catalan', + 'EulerGamma', 'GoldenRatio', 'TribonacciConstant', 'bottom_up', 'use', + 'postorder_traversal', 'default_sort_key', 'ordered', 'num_digits', + + # sympy.logic + 'to_cnf', 'to_dnf', 'to_nnf', 'And', 'Or', 'Not', 'Xor', 'Nand', 'Nor', + 'Implies', 'Equivalent', 'ITE', 'POSform', 'SOPform', 'simplify_logic', + 'bool_map', 'true', 'false', 'satisfiable', + + # sympy.assumptions + 'AppliedPredicate', 'Predicate', 'AssumptionsContext', 'assuming', 'Q', + 'ask', 'register_handler', 'remove_handler', 'refine', + + # sympy.polys + 'Poly', 'PurePoly', 'poly_from_expr', 'parallel_poly_from_expr', 'degree', + 'total_degree', 'degree_list', 'LC', 'LM', 'LT', 'pdiv', 'prem', 'pquo', + 'pexquo', 'div', 'rem', 'quo', 'exquo', 'half_gcdex', 'gcdex', 'invert', + 'subresultants', 'resultant', 'discriminant', 'cofactors', 'gcd_list', + 'gcd', 'lcm_list', 'lcm', 'terms_gcd', 'trunc', 'monic', 'content', + 'primitive', 'compose', 'decompose', 'sturm', 'gff_list', 'gff', + 'sqf_norm', 'sqf_part', 'sqf_list', 'sqf', 'factor_list', 'factor', + 'intervals', 'refine_root', 'count_roots', 'all_roots', 'real_roots', + 'nroots', 'ground_roots', 'nth_power_roots_poly', 'cancel', 'reduced', + 'groebner', 'is_zero_dimensional', 'GroebnerBasis', 'poly', 'symmetrize', + 'horner', 'interpolate', 'rational_interpolate', 'viete', 'together', + 'BasePolynomialError', 'ExactQuotientFailed', 'PolynomialDivisionFailed', + 'OperationNotSupported', 'HeuristicGCDFailed', 'HomomorphismFailed', + 'IsomorphismFailed', 'ExtraneousFactors', 'EvaluationFailed', + 'RefinementFailed', 'CoercionFailed', 'NotInvertible', 'NotReversible', + 'NotAlgebraic', 'DomainError', 'PolynomialError', 'UnificationFailed', + 'GeneratorsError', 'GeneratorsNeeded', 'ComputationFailed', + 'UnivariatePolynomialError', 'MultivariatePolynomialError', + 'PolificationFailed', 'OptionError', 'FlagError', 'minpoly', + 'minimal_polynomial', 'primitive_element', 'field_isomorphism', + 'to_number_field', 'isolate', 'round_two', 'prime_decomp', + 'prime_valuation', 'galois_group', 'itermonomials', 'Monomial', 'lex', 'grlex', + 'grevlex', 'ilex', 'igrlex', 'igrevlex', 'CRootOf', 'rootof', 'RootOf', + 'ComplexRootOf', 'RootSum', 'roots', 'Domain', 'FiniteField', + 'IntegerRing', 'RationalField', 'RealField', 'ComplexField', + 'PythonFiniteField', 'GMPYFiniteField', 'PythonIntegerRing', + 'GMPYIntegerRing', 'PythonRational', 'GMPYRationalField', + 'AlgebraicField', 'PolynomialRing', 'FractionField', 'ExpressionDomain', + 'FF_python', 'FF_gmpy', 'ZZ_python', 'ZZ_gmpy', 'QQ_python', 'QQ_gmpy', + 'GF', 'FF', 'ZZ', 'QQ', 'ZZ_I', 'QQ_I', 'RR', 'CC', 'EX', 'EXRAW', + 'construct_domain', 'swinnerton_dyer_poly', 'cyclotomic_poly', + 'symmetric_poly', 'random_poly', 'interpolating_poly', 'jacobi_poly', + 'chebyshevt_poly', 'chebyshevu_poly', 'hermite_poly', 'hermite_prob_poly', + 'legendre_poly', 'laguerre_poly', 'apart', 'apart_list', 'assemble_partfrac_list', + 'Options', 'ring', 'xring', 'vring', 'sring', 'field', 'xfield', 'vfield', + 'sfield', + + # sympy.series + 'Order', 'O', 'limit', 'Limit', 'gruntz', 'series', 'approximants', + 'residue', 'EmptySequence', 'SeqPer', 'SeqFormula', 'sequence', 'SeqAdd', + 'SeqMul', 'fourier_series', 'fps', 'difference_delta', 'limit_seq', + + # sympy.functions + 'factorial', 'factorial2', 'rf', 'ff', 'binomial', 'RisingFactorial', + 'FallingFactorial', 'subfactorial', 'carmichael', 'fibonacci', 'lucas', + 'motzkin', 'tribonacci', 'harmonic', 'bernoulli', 'bell', 'euler', 'catalan', + 'genocchi', 'andre', 'partition', 'divisor_sigma', 'legendre_symbol', 'jacobi_symbol', + 'kronecker_symbol', 'mobius', 'primenu', 'primeomega', 'totient', 'primepi', + 'reduced_totient', 'sqrt', 'root', 'Min', 'Max', 'Id', 'real_root', + 'Rem', 'cbrt', 're', 'im', 'sign', 'Abs', 'conjugate', 'arg', 'polar_lift', + 'periodic_argument', 'unbranched_argument', 'principal_branch', + 'transpose', 'adjoint', 'polarify', 'unpolarify', 'sin', 'cos', 'tan', + 'sec', 'csc', 'cot', 'sinc', 'asin', 'acos', 'atan', 'asec', 'acsc', + 'acot', 'atan2', 'exp_polar', 'exp', 'ln', 'log', 'LambertW', 'sinh', + 'cosh', 'tanh', 'coth', 'sech', 'csch', 'asinh', 'acosh', 'atanh', + 'acoth', 'asech', 'acsch', 'floor', 'ceiling', 'frac', 'Piecewise', + 'piecewise_fold', 'piecewise_exclusive', 'erf', 'erfc', 'erfi', 'erf2', + 'erfinv', 'erfcinv', 'erf2inv', 'Ei', 'expint', 'E1', 'li', 'Li', 'Si', + 'Ci', 'Shi', 'Chi', 'fresnels', 'fresnelc', 'gamma', 'lowergamma', + 'uppergamma', 'polygamma', 'loggamma', 'digamma', 'trigamma', 'multigamma', + 'dirichlet_eta', 'zeta', 'lerchphi', 'polylog', 'stieltjes', 'Eijk', 'LeviCivita', + 'KroneckerDelta', 'SingularityFunction', 'DiracDelta', 'Heaviside', + 'bspline_basis', 'bspline_basis_set', 'interpolating_spline', 'besselj', + 'bessely', 'besseli', 'besselk', 'hankel1', 'hankel2', 'jn', 'yn', + 'jn_zeros', 'hn1', 'hn2', 'airyai', 'airybi', 'airyaiprime', + 'airybiprime', 'marcumq', 'hyper', 'meijerg', 'appellf1', 'legendre', + 'assoc_legendre', 'hermite', 'hermite_prob', 'chebyshevt', 'chebyshevu', + 'chebyshevu_root', 'chebyshevt_root', 'laguerre', 'assoc_laguerre', + 'gegenbauer', 'jacobi', 'jacobi_normalized', 'Ynm', 'Ynm_c', 'Znm', + 'elliptic_k', 'elliptic_f', 'elliptic_e', 'elliptic_pi', 'beta', + 'mathieus', 'mathieuc', 'mathieusprime', 'mathieucprime', 'riemann_xi','betainc', + 'betainc_regularized', + + # sympy.ntheory + 'nextprime', 'prevprime', 'prime', 'primerange', 'randprime', + 'Sieve', 'sieve', 'primorial', 'cycle_length', 'composite', 'compositepi', + 'isprime', 'divisors', 'proper_divisors', 'factorint', 'multiplicity', + 'perfect_power', 'pollard_pm1', 'factor_cache', 'pollard_rho', 'primefactors', + 'divisor_count', 'proper_divisor_count', + 'factorrat', + 'mersenne_prime_exponent', 'is_perfect', 'is_mersenne_prime', + 'is_abundant', 'is_deficient', 'is_amicable', 'is_carmichael', 'abundance', + 'npartitions', + 'is_primitive_root', 'is_quad_residue', + 'n_order', 'sqrt_mod', 'quadratic_residues', + 'primitive_root', 'nthroot_mod', 'is_nthpow_residue', 'sqrt_mod_iter', + 'discrete_log', 'quadratic_congruence', 'binomial_coefficients', + 'binomial_coefficients_list', 'multinomial_coefficients', + 'continued_fraction_periodic', 'continued_fraction_iterator', + 'continued_fraction_reduce', 'continued_fraction_convergents', + 'continued_fraction', 'egyptian_fraction', + + # sympy.concrete + 'product', 'Product', 'summation', 'Sum', + + # sympy.discrete + 'fft', 'ifft', 'ntt', 'intt', 'fwht', 'ifwht', 'mobius_transform', + 'inverse_mobius_transform', 'convolution', 'covering_product', + 'intersecting_product', + + # sympy.simplify + 'simplify', 'hypersimp', 'hypersimilar', 'logcombine', 'separatevars', + 'posify', 'besselsimp', 'kroneckersimp', 'signsimp', + 'nsimplify', 'FU', 'fu', 'sqrtdenest', 'cse', 'epath', 'EPath', + 'hyperexpand', 'collect', 'rcollect', 'radsimp', 'collect_const', + 'fraction', 'numer', 'denom', 'trigsimp', 'exptrigsimp', 'powsimp', + 'powdenest', 'combsimp', 'gammasimp', 'ratsimp', 'ratsimpmodprime', + + # sympy.sets + 'Set', 'Interval', 'Union', 'EmptySet', 'FiniteSet', 'ProductSet', + 'Intersection', 'imageset', 'DisjointUnion', 'Complement', 'SymmetricDifference', + 'ImageSet', 'Range', 'ComplexRegion', 'Reals', 'Contains', 'ConditionSet', + 'Ordinal', 'OmegaPower', 'ord0', 'PowerSet', 'Naturals', + 'Naturals0', 'UniversalSet', 'Integers', 'Rationals', 'Complexes', + + # sympy.solvers + 'solve', 'solve_linear_system', 'solve_linear_system_LU', + 'solve_undetermined_coeffs', 'nsolve', 'solve_linear', 'checksol', + 'det_quick', 'inv_quick', 'check_assumptions', 'failing_assumptions', + 'diophantine', 'rsolve', 'rsolve_poly', 'rsolve_ratio', 'rsolve_hyper', + 'checkodesol', 'classify_ode', 'dsolve', 'homogeneous_order', + 'solve_poly_system', 'factor_system', 'solve_triangulated', 'pde_separate', + 'pde_separate_add', 'pde_separate_mul', 'pdsolve', 'classify_pde', + 'checkpdesol', 'ode_order', 'reduce_inequalities', + 'reduce_abs_inequality', 'reduce_abs_inequalities', + 'solve_poly_inequality', 'solve_rational_inequalities', + 'solve_univariate_inequality', 'decompogen', 'solveset', 'linsolve', + 'linear_eq_to_matrix', 'nonlinsolve', 'substitution', + + # sympy.matrices + 'ShapeError', 'NonSquareMatrixError', 'GramSchmidt', 'casoratian', 'diag', + 'eye', 'hessian', 'jordan_cell', 'list2numpy', 'matrix2numpy', + 'matrix_multiply_elementwise', 'ones', 'randMatrix', 'rot_axis1', + 'rot_axis2', 'rot_axis3', 'symarray', 'wronskian', 'zeros', + 'MutableDenseMatrix', 'DeferredVector', 'MatrixBase', 'Matrix', + 'MutableMatrix', 'MutableSparseMatrix', 'banded', 'ImmutableDenseMatrix', + 'ImmutableSparseMatrix', 'ImmutableMatrix', 'SparseMatrix', 'MatrixSlice', + 'BlockDiagMatrix', 'BlockMatrix', 'FunctionMatrix', 'Identity', 'Inverse', + 'MatAdd', 'MatMul', 'MatPow', 'MatrixExpr', 'MatrixSymbol', 'Trace', + 'Transpose', 'ZeroMatrix', 'OneMatrix', 'blockcut', 'block_collapse', + 'matrix_symbols', 'Adjoint', 'hadamard_product', 'HadamardProduct', + 'HadamardPower', 'Determinant', 'det', 'diagonalize_vector', 'DiagMatrix', + 'DiagonalMatrix', 'DiagonalOf', 'trace', 'DotProduct', + 'kronecker_product', 'KroneckerProduct', 'PermutationMatrix', + 'MatrixPermute', 'Permanent', 'per', 'rot_ccw_axis1', 'rot_ccw_axis2', + 'rot_ccw_axis3', 'rot_givens', + + # sympy.geometry + 'Point', 'Point2D', 'Point3D', 'Line', 'Ray', 'Segment', 'Line2D', + 'Segment2D', 'Ray2D', 'Line3D', 'Segment3D', 'Ray3D', 'Plane', 'Ellipse', + 'Circle', 'Polygon', 'RegularPolygon', 'Triangle', 'rad', 'deg', + 'are_similar', 'centroid', 'convex_hull', 'idiff', 'intersection', + 'closest_points', 'farthest_points', 'GeometryError', 'Curve', 'Parabola', + + # sympy.utilities + 'flatten', 'group', 'take', 'subsets', 'variations', 'numbered_symbols', + 'cartes', 'capture', 'dict_merge', 'prefixes', 'postfixes', 'sift', + 'topological_sort', 'unflatten', 'has_dups', 'has_variety', 'reshape', + 'rotations', 'filldedent', 'lambdify', 'threaded', 'xthreaded', + 'public', 'memoize_property', 'timed', + + # sympy.integrals + 'integrate', 'Integral', 'line_integrate', 'mellin_transform', + 'inverse_mellin_transform', 'MellinTransform', 'InverseMellinTransform', + 'laplace_transform', 'inverse_laplace_transform', 'LaplaceTransform', + 'laplace_correspondence', 'laplace_initial_conds', + 'InverseLaplaceTransform', 'fourier_transform', + 'inverse_fourier_transform', 'FourierTransform', + 'InverseFourierTransform', 'sine_transform', 'inverse_sine_transform', + 'SineTransform', 'InverseSineTransform', 'cosine_transform', + 'inverse_cosine_transform', 'CosineTransform', 'InverseCosineTransform', + 'hankel_transform', 'inverse_hankel_transform', 'HankelTransform', + 'InverseHankelTransform', 'singularityintegrate', + + # sympy.tensor + 'IndexedBase', 'Idx', 'Indexed', 'get_contraction_structure', + 'get_indices', 'shape', 'MutableDenseNDimArray', 'ImmutableDenseNDimArray', + 'MutableSparseNDimArray', 'ImmutableSparseNDimArray', 'NDimArray', + 'tensorproduct', 'tensorcontraction', 'tensordiagonal', 'derive_by_array', + 'permutedims', 'Array', 'DenseNDimArray', 'SparseNDimArray', + + # sympy.parsing + 'parse_expr', + + # sympy.calculus + 'euler_equations', 'singularities', 'is_increasing', + 'is_strictly_increasing', 'is_decreasing', 'is_strictly_decreasing', + 'is_monotonic', 'finite_diff_weights', 'apply_finite_diff', + 'differentiate_finite', 'periodicity', 'not_empty_in', + 'AccumBounds', 'is_convex', 'stationary_points', 'minimum', 'maximum', + + # sympy.algebras + 'Quaternion', + + # sympy.printing + 'pager_print', 'pretty', 'pretty_print', 'pprint', 'pprint_use_unicode', + 'pprint_try_use_unicode', 'latex', 'print_latex', 'multiline_latex', + 'mathml', 'print_mathml', 'python', 'print_python', 'pycode', 'ccode', + 'print_ccode', 'smtlib_code', 'glsl_code', 'print_glsl', 'cxxcode', 'fcode', + 'print_fcode', 'rcode', 'print_rcode', 'jscode', 'print_jscode', + 'julia_code', 'mathematica_code', 'octave_code', 'rust_code', 'print_gtk', + 'preview', 'srepr', 'print_tree', 'StrPrinter', 'sstr', 'sstrrepr', + 'TableForm', 'dotprint', 'maple_code', 'print_maple_code', + + # sympy.plotting + 'plot', 'textplot', 'plot_backends', 'plot_implicit', 'plot_parametric', + + # sympy.interactive + 'init_session', 'init_printing', 'interactive_traversal', + + # sympy.testing + 'test', 'doctest', +] + + +#===========================================================================# +# # +# XXX: The names below were importable before SymPy 1.6 using # +# # +# from sympy import * # +# # +# This happened implicitly because there was no __all__ defined in this # +# __init__.py file. Not every package is imported. The list matches what # +# would have been imported before. It is possible that these packages will # +# not be imported by a star-import from sympy in future. # +# # +#===========================================================================# + + +__all__.extend(( + 'algebras', + 'assumptions', + 'calculus', + 'concrete', + 'discrete', + 'external', + 'functions', + 'geometry', + 'interactive', + 'multipledispatch', + 'ntheory', + 'parsing', + 'plotting', + 'polys', + 'printing', + 'release', + 'strategies', + 'tensor', + 'utilities', +)) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/sympy/abc.py b/TTS/Kokoro/.venv/Lib/site-packages/sympy/abc.py new file mode 100644 index 0000000000000000000000000000000000000000..a6f7a4056e60b0d651becc0b9909bd0ab3c1723f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/sympy/abc.py @@ -0,0 +1,111 @@ +""" +This module exports all latin and greek letters as Symbols, so you can +conveniently do + + >>> from sympy.abc import x, y + +instead of the slightly more clunky-looking + + >>> from sympy import symbols + >>> x, y = symbols('x y') + +Caveats +======= + +1. As of the time of writing this, the names ``O``, ``S``, ``I``, ``N``, +``E``, and ``Q`` are colliding with names defined in SymPy. If you import them +from both ``sympy.abc`` and ``sympy``, the second import will "win". +This is an issue only for * imports, which should only be used for short-lived +code such as interactive sessions and throwaway scripts that do not survive +until the next SymPy upgrade, where ``sympy`` may contain a different set of +names. + +2. This module does not define symbol names on demand, i.e. +``from sympy.abc import foo`` will be reported as an error because +``sympy.abc`` does not contain the name ``foo``. To get a symbol named ``foo``, +you still need to use ``Symbol('foo')`` or ``symbols('foo')``. +You can freely mix usage of ``sympy.abc`` and ``Symbol``/``symbols``, though +sticking with one and only one way to get the symbols does tend to make the code +more readable. + +The module also defines some special names to help detect which names clash +with the default SymPy namespace. + +``_clash1`` defines all the single letter variables that clash with +SymPy objects; ``_clash2`` defines the multi-letter clashing symbols; +and ``_clash`` is the union of both. These can be passed for ``locals`` +during sympification if one desires Symbols rather than the non-Symbol +objects for those names. + +Examples +======== + +>>> from sympy import S +>>> from sympy.abc import _clash1, _clash2, _clash +>>> S("Q & C", locals=_clash1) +C & Q +>>> S('pi(x)', locals=_clash2) +pi(x) +>>> S('pi(C, Q)', locals=_clash) +pi(C, Q) + +""" +from __future__ import annotations +from typing import Any + +import string + +from .core import Symbol, symbols +from .core.alphabets import greeks +from sympy.parsing.sympy_parser import null + +##### Symbol definitions ##### + +# Implementation note: The easiest way to avoid typos in the symbols() +# parameter is to copy it from the left-hand side of the assignment. + +a, b, c, d, e, f, g, h, i, j = symbols('a, b, c, d, e, f, g, h, i, j') +k, l, m, n, o, p, q, r, s, t = symbols('k, l, m, n, o, p, q, r, s, t') +u, v, w, x, y, z = symbols('u, v, w, x, y, z') + +A, B, C, D, E, F, G, H, I, J = symbols('A, B, C, D, E, F, G, H, I, J') +K, L, M, N, O, P, Q, R, S, T = symbols('K, L, M, N, O, P, Q, R, S, T') +U, V, W, X, Y, Z = symbols('U, V, W, X, Y, Z') + +alpha, beta, gamma, delta = symbols('alpha, beta, gamma, delta') +epsilon, zeta, eta, theta = symbols('epsilon, zeta, eta, theta') +iota, kappa, lamda, mu = symbols('iota, kappa, lamda, mu') +nu, xi, omicron, pi = symbols('nu, xi, omicron, pi') +rho, sigma, tau, upsilon = symbols('rho, sigma, tau, upsilon') +phi, chi, psi, omega = symbols('phi, chi, psi, omega') + + +##### Clashing-symbols diagnostics ##### + +# We want to know which names in SymPy collide with those in here. +# This is mostly for diagnosing SymPy's namespace during SymPy development. + +_latin = list(string.ascii_letters) +# QOSINE should not be imported as they clash; gamma, pi and zeta clash, too +_greek = list(greeks) # make a copy, so we can mutate it +# Note: We import lamda since lambda is a reserved keyword in Python +_greek.remove("lambda") +_greek.append("lamda") + +ns: dict[str, Any] = {} +exec('from sympy import *', ns) +_clash1: dict[str, Any] = {} +_clash2: dict[str, Any] = {} +while ns: + _k, _ = ns.popitem() + if _k in _greek: + _clash2[_k] = null + _greek.remove(_k) + elif _k in _latin: + _clash1[_k] = null + _latin.remove(_k) +_clash = {} +_clash.update(_clash1) +_clash.update(_clash2) + +del _latin, _greek, Symbol, _k, null diff --git a/TTS/Kokoro/.venv/Lib/site-packages/sympy/conftest.py b/TTS/Kokoro/.venv/Lib/site-packages/sympy/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..788ec7ed8a38de422b76c4ac19057513670d2d38 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/sympy/conftest.py @@ -0,0 +1,96 @@ +import sys + +sys._running_pytest = True # type: ignore +from sympy.external.importtools import version_tuple + +import pytest +from sympy.core.cache import clear_cache, USE_CACHE +from sympy.external.gmpy import GROUND_TYPES +from sympy.utilities.misc import ARCH +import re + +try: + import hypothesis + + hypothesis.settings.register_profile("sympy_hypothesis_profile", deadline=None) + hypothesis.settings.load_profile("sympy_hypothesis_profile") +except ImportError: + raise ImportError( + "hypothesis is a required dependency to run the SymPy test suite. " + "Install it with 'pip install hypothesis' or 'conda install -c conda-forge hypothesis'" + ) + + +sp = re.compile(r"([0-9]+)/([1-9][0-9]*)") + + +def process_split(config, items): + split = config.getoption("--split") + if not split: + return + m = sp.match(split) + if not m: + raise ValueError( + "split must be a string of the form a/b " "where a and b are ints." + ) + i, t = map(int, m.groups()) + start, end = (i - 1) * len(items) // t, i * len(items) // t + + if i < t: + # remove elements from end of list first + del items[end:] + del items[:start] + + +def pytest_report_header(config): + s = "architecture: %s\n" % ARCH + s += "cache: %s\n" % USE_CACHE + version = "" + if GROUND_TYPES == "gmpy": + import gmpy2 + + version = gmpy2.version() + elif GROUND_TYPES == "flint": + try: + from flint import __version__ + except ImportError: + version = "unknown" + else: + version = f'(python-flint=={__version__})' + s += "ground types: %s %s\n" % (GROUND_TYPES, version) + return s + + +def pytest_terminal_summary(terminalreporter): + if terminalreporter.stats.get("error", None) or terminalreporter.stats.get( + "failed", None + ): + terminalreporter.write_sep(" ", "DO *NOT* COMMIT!", red=True, bold=True) + + +def pytest_addoption(parser): + parser.addoption("--split", action="store", default="", help="split tests") + + +def pytest_collection_modifyitems(config, items): + """pytest hook.""" + # handle splits + process_split(config, items) + + +@pytest.fixture(autouse=True, scope="module") +def file_clear_cache(): + clear_cache() + + +@pytest.fixture(autouse=True, scope="module") +def check_disabled(request): + if getattr(request.module, "disabled", False): + pytest.skip("test requirements not met.") + elif getattr(request.module, "ipython", False): + # need to check version and options for ipython tests + if ( + version_tuple(pytest.__version__) < version_tuple("2.6.3") + and pytest.config.getvalue("-s") != "no" + ): + pytest.skip("run py.test with -s or upgrade to newer version.") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/sympy/galgebra.py b/TTS/Kokoro/.venv/Lib/site-packages/sympy/galgebra.py new file mode 100644 index 0000000000000000000000000000000000000000..be812bfcbcece834c86d7b55eb846286acd0ac08 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/sympy/galgebra.py @@ -0,0 +1 @@ +raise ImportError("""As of SymPy 1.0 the galgebra module is maintained separately at https://github.com/pygae/galgebra""") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/sympy/release.py b/TTS/Kokoro/.venv/Lib/site-packages/sympy/release.py new file mode 100644 index 0000000000000000000000000000000000000000..b9f68edb2f571e7bfaad9472d36a2d357b5574b2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/sympy/release.py @@ -0,0 +1 @@ +__version__ = "1.14.0" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/sympy/this.py b/TTS/Kokoro/.venv/Lib/site-packages/sympy/this.py new file mode 100644 index 0000000000000000000000000000000000000000..c2a5504ac42c7d57790d65524b066a6df86ab539 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/sympy/this.py @@ -0,0 +1,21 @@ +""" +The Zen of SymPy. +""" + +s = """The Zen of SymPy + +Unevaluated is better than evaluated. +The user interface matters. +Printing matters. +Pure Python can be fast enough. +If it's too slow, it's (probably) your fault. +Documentation matters. +Correctness is more important than speed. +Push it in now and improve upon it later. +Coverage by testing matters. +Smart tests are better than random tests. +But random tests sometimes find what your smartest test missed. +The Python way is probably the right way. +Community is more important than code.""" + +print(s) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/termcolor-3.3.0.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/termcolor-3.3.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/termcolor-3.3.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/termcolor-3.3.0.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/termcolor-3.3.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..77c1c7eb63cda1075a4bb359980d331a5c56a46b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/termcolor-3.3.0.dist-info/METADATA @@ -0,0 +1,150 @@ +Metadata-Version: 2.4 +Name: termcolor +Version: 3.3.0 +Summary: ANSI color formatting for output in terminal +Project-URL: Changelog, https://github.com/termcolor/termcolor/releases +Project-URL: Homepage, https://github.com/termcolor/termcolor +Project-URL: Source, https://github.com/termcolor/termcolor +Author-email: Konstantin Lepa +Maintainer: Hugo van Kemenade +License-Expression: MIT +License-File: COPYING.txt +Keywords: ANSI,ANSI color,ANSI colour,color,colour,formatting,termcolor,terminal +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: 3.15 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Terminals +Classifier: Typing :: Typed +Requires-Python: >=3.10 +Provides-Extra: tests +Requires-Dist: pytest; extra == 'tests' +Requires-Dist: pytest-cov; extra == 'tests' +Description-Content-Type: text/markdown + +# termcolor + +[![PyPI version](https://img.shields.io/pypi/v/termcolor.svg?logo=pypi&logoColor=FFE873)](https://pypi.org/project/termcolor) +[![Supported Python versions](https://img.shields.io/pypi/pyversions/termcolor.svg?logo=python&logoColor=FFE873)](https://pypi.org/project/termcolor) +[![PyPI downloads](https://img.shields.io/pypi/dm/termcolor.svg)](https://pypistats.org/packages/termcolor) +[![GitHub Actions status](https://github.com/termcolor/termcolor/workflows/Test/badge.svg)](https://github.com/termcolor/termcolor/actions) +[![Codecov](https://codecov.io/gh/termcolor/termcolor/branch/main/graph/badge.svg)](https://codecov.io/gh/termcolor/termcolor) +[![Licence](https://img.shields.io/github/license/termcolor/termcolor.svg)](COPYING.txt) +[![Code style: Black](https://img.shields.io/badge/code%20style-Black-000000.svg)](https://github.com/psf/black) +[![Tidelift](https://tidelift.com/badges/package/pypi/termcolor)](https://tidelift.com/subscription/pkg/pypi-termcolor?utm_source=pypi-termcolor&utm_medium=referral&utm_campaign=readme) + +## Installation + +### From PyPI + +```bash +python3 -m pip install --upgrade termcolor +``` + +### From source + +```bash +git clone https://github.com/termcolor/termcolor +cd termcolor +python3 -m pip install . +``` + +### Demo + +To see demo output, run: + +```bash +python3 -m termcolor +``` + +## Example + +```python +import sys + +from termcolor import colored, cprint + +text = colored("Hello, World!", "red", attrs=["reverse", "blink"]) +print(text) +cprint("Hello, World!", "green", "on_red") + +print_red_on_cyan = lambda x: cprint(x, "red", "on_cyan") +print_red_on_cyan("Hello, World!") +print_red_on_cyan("Hello, Universe!") + +for i in range(10): + cprint(i, "magenta", end=" ") + +cprint("Attention!", "red", attrs=["bold"], file=sys.stderr) + +# You can also specify 0-255 RGB ints via a tuple +cprint("Both foreground and background can use tuples", (100, 150, 250), (50, 60, 70)) +``` + +## Text properties + +| Text colors | Text highlights | Attributes | +| --------------- | ------------------ | ----------- | +| `black` | `on_black` | `bold` | +| `red` | `on_red` | `dark` | +| `green` | `on_green` | `italic` | +| `yellow` | `on_yellow` | `underline` | +| `blue` | `on_blue` | `blink` | +| `magenta` | `on_magenta` | `reverse` | +| `cyan` | `on_cyan` | `concealed` | +| `white` | `on_white` | `strike` | +| `light_grey` | `on_light_grey` | | +| `dark_grey` | `on_dark_grey` | | +| `light_red` | `on_light_red` | | +| `light_green` | `on_light_green` | | +| `light_yellow` | `on_light_yellow` | | +| `light_blue` | `on_light_blue` | | +| `light_magenta` | `on_light_magenta` | | +| `light_cyan` | `on_light_cyan` | | + +You can also use any arbitrary RGB color specified as a tuple of 0-255 integers, for +example, `(100, 150, 250)`. + +## Terminal properties + +| Terminal | bold | dark | italic | underline | blink | reverse | concealed | +| ------------ | ------- | ---- | ------ | --------- | ---------- | ------- | --------- | +| xterm | yes | no | yes | yes | bold | yes | yes | +| linux | yes | yes | color | bold | yes | yes | no | +| rxvt | yes | no | yes | yes | bold/black | yes | no | +| dtterm | yes | yes | ? | yes | reverse | yes | yes | +| teraterm | reverse | no | ? | yes | rev/red | yes | no | +| aixterm | normal | no | ? | yes | no | yes | yes | +| PuTTY | color | no | no | yes | no | yes | no | +| Windows | no | no | no | no | no | yes | no | +| Cygwin SSH | yes | no | ? | color | color | color | yes | +| Mac Terminal | yes | no | yes | yes | yes | yes | yes | + +## Overrides + +Terminal colour detection can be disabled or enabled in several ways. + +In order of precedence: + +1. Calling `colored` or `cprint` with a truthy `no_color` disables colour. +2. Calling `colored` or `cprint` with a truthy `force_color` forces colour. +3. Setting the `ANSI_COLORS_DISABLED` environment variable to any non-empty value + disables colour. +4. Setting the [`NO_COLOR`](https://no-color.org/) environment variable to any non-empty + value disables colour. +5. Setting the [`FORCE_COLOR`](https://force-color.org/) environment variable to any + non-empty value forces colour. +6. Setting the `TERM` environment variable to `dumb`, or using such a + [dumb terminal](https://en.wikipedia.org/wiki/Computer_terminal#Character-oriented_terminal), + disables colour. +7. Finally, termcolor will attempt to detect whether the terminal supports colour. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/termcolor-3.3.0.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/termcolor-3.3.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..f4a0afe27edda8ef841805c82f613782089d1721 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/termcolor-3.3.0.dist-info/RECORD @@ -0,0 +1,12 @@ +termcolor-3.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +termcolor-3.3.0.dist-info/METADATA,sha256=iArqumMAZ31OzAIvtj-K3NV6dTtv0rXsF4Qfci-RAZY,6490 +termcolor-3.3.0.dist-info/RECORD,, +termcolor-3.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87 +termcolor-3.3.0.dist-info/licenses/COPYING.txt,sha256=55tr2CliwTMMqqfEInhWewhmd3dnP44jcaYk1XFdTA4,1072 +termcolor/__init__.py,sha256=oCqIPpywlruBk5YFDCVd7kSOdtXo0FHXjEXwnt_Pc0E,350 +termcolor/__main__.py,sha256=_-zbpu_lWx_v8uf8MDu-98NOwA0QZ6CUcWysIoHYRzM,3578 +termcolor/__pycache__/__init__.cpython-312.pyc,, +termcolor/__pycache__/__main__.cpython-312.pyc,, +termcolor/__pycache__/termcolor.cpython-312.pyc,, +termcolor/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +termcolor/termcolor.py,sha256=uqGaHvcIVMsXYZoi5CZaOfk4yRSlze-DSxy_fyQ9tI8,6315 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/termcolor-3.3.0.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/termcolor-3.3.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..ae8ec1bdaa94d726ceb907542d76cbd5d38cafcd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/termcolor-3.3.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.28.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/TTS/Kokoro/.venv/Lib/site-packages/termcolor/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/termcolor/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c046c06f6b26aa0bd8c0c8ff320582194d9176e2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/termcolor/__init__.py @@ -0,0 +1,23 @@ +"""ANSI color formatting for output in terminal.""" + +from __future__ import annotations + +from termcolor.termcolor import ( + ATTRIBUTES, + COLORS, + HIGHLIGHTS, + RESET, + can_colorize, + colored, + cprint, +) + +__all__ = [ + "ATTRIBUTES", + "COLORS", + "HIGHLIGHTS", + "RESET", + "can_colorize", + "colored", + "cprint", +] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/termcolor/__main__.py b/TTS/Kokoro/.venv/Lib/site-packages/termcolor/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..a7bf672227323f31f0e556b887eb7f6f46d4dbbf --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/termcolor/__main__.py @@ -0,0 +1,87 @@ +from __future__ import annotations + +import os + +from termcolor import cprint + +if __name__ == "__main__": + print(f"Current terminal type: {os.getenv('TERM')}") + print("Test basic colors:") + cprint("Black color", "black") + cprint("Red color", "red") + cprint("Green color", "green") + cprint("Yellow color", "yellow") + cprint("Blue color", "blue") + cprint("Magenta color", "magenta") + cprint("Cyan color", "cyan") + cprint("White color", "white") + cprint("Light grey color", "light_grey") + cprint("Dark grey color", "dark_grey") + cprint("Light red color", "light_red") + cprint("Light green color", "light_green") + cprint("Light yellow color", "light_yellow") + cprint("Light blue color", "light_blue") + cprint("Light magenta color", "light_magenta") + cprint("Light cyan color", "light_cyan") + print("-" * 78) + + print("Test highlights:") + cprint("On black color", on_color="on_black") + cprint("On red color", on_color="on_red") + cprint("On green color", on_color="on_green") + cprint("On yellow color", on_color="on_yellow") + cprint("On blue color", on_color="on_blue") + cprint("On magenta color", on_color="on_magenta") + cprint("On cyan color", on_color="on_cyan") + cprint("On white color", color="black", on_color="on_white") + cprint("On light grey color", on_color="on_light_grey") + cprint("On dark grey color", on_color="on_dark_grey") + cprint("On light red color", on_color="on_light_red") + cprint("On light green color", on_color="on_light_green") + cprint("On light yellow color", on_color="on_light_yellow") + cprint("On light blue color", on_color="on_light_blue") + cprint("On light magenta color", on_color="on_light_magenta") + cprint("On light cyan color", on_color="on_light_cyan") + print("-" * 78) + + print("Test attributes:") + cprint("Bold black color", "black", attrs=["bold"]) + cprint("Dark red color", "red", attrs=["dark"]) + cprint("Italic blue color", "blue", attrs=["italic"]) + cprint("Underline green color", "green", attrs=["underline"]) + cprint("Blink yellow color", "yellow", attrs=["blink"]) + cprint("Reversed blue color", "blue", attrs=["reverse"]) + cprint("Concealed magenta color", "magenta", attrs=["concealed"]) + cprint("Strike red color", "red", attrs=["strike"]) + cprint( + "Bold underline reverse cyan color", + "cyan", + attrs=["bold", "underline", "reverse"], + ) + cprint( + "Dark blink concealed white color", + "white", + attrs=["dark", "blink", "concealed"], + ) + print("-" * 78) + + print("Test mixing:") + cprint("Underline red on black color", "red", "on_black", ["underline"]) + cprint("Reversed green on red color", "green", "on_red", ["reverse"]) + print("-" * 78) + + print("Test RGB:") + cprint("Pure red text (255, 0, 0)", (255, 0, 0)) + cprint("Default red for comparison", "red") + cprint("Pure green text (0, 0, 0)", (0, 255, 0)) + cprint("Default green for comparison", "green") + cprint("Pure blue text (0, 0, 0)", (0, 0, 255)) + cprint("Default blue for comparison", "blue") + cprint("Pure yellow text (255, 255, 0)", (255, 255, 0)) + cprint("Default yellow for comparison", "yellow") + cprint("Pure cyan text (0, 255, 255)", (0, 255, 255)) + cprint("Default cyan for comparison", "cyan") + cprint("Pure magenta text (255, 0, 255)", (255, 0, 255)) + cprint("Default magenta for comparison", "magenta") + cprint("Light pink (255, 182, 193)", (255, 182, 193)) + cprint("Light pink (255, 105, 180)", (255, 105, 180)) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/termcolor/py.typed b/TTS/Kokoro/.venv/Lib/site-packages/termcolor/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/termcolor/termcolor.py b/TTS/Kokoro/.venv/Lib/site-packages/termcolor/termcolor.py new file mode 100644 index 0000000000000000000000000000000000000000..e288b403b1163e17f81148f9b70fe34b0661b63f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/termcolor/termcolor.py @@ -0,0 +1,215 @@ +# Copyright (c) 2008-2011 Volvox Development Team +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# Author: Konstantin Lepa + +"""ANSI color formatting for output in terminal.""" + +from __future__ import annotations + +import os +import sys +from functools import cache + +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Iterable + from typing import Any + + +ATTRIBUTES: dict[str, int] = { + "bold": 1, + "dark": 2, + "italic": 3, + "underline": 4, + "blink": 5, + "reverse": 7, + "concealed": 8, + "strike": 9, +} + +HIGHLIGHTS: dict[str, int] = { + "on_black": 40, + "on_grey": 40, # Actually black but kept for backwards compatibility + "on_red": 41, + "on_green": 42, + "on_yellow": 43, + "on_blue": 44, + "on_magenta": 45, + "on_cyan": 46, + "on_light_grey": 47, + "on_dark_grey": 100, + "on_light_red": 101, + "on_light_green": 102, + "on_light_yellow": 103, + "on_light_blue": 104, + "on_light_magenta": 105, + "on_light_cyan": 106, + "on_white": 107, +} + +COLORS: dict[str, int] = { + "black": 30, + "grey": 30, # Actually black but kept for backwards compatibility + "red": 31, + "green": 32, + "yellow": 33, + "blue": 34, + "magenta": 35, + "cyan": 36, + "light_grey": 37, + "dark_grey": 90, + "light_red": 91, + "light_green": 92, + "light_yellow": 93, + "light_blue": 94, + "light_magenta": 95, + "light_cyan": 96, + "white": 97, +} + + +RESET = "\033[0m" + + +@cache +def can_colorize( + *, no_color: bool | None = None, force_color: bool | None = None +) -> bool: + """Check env vars and for tty/dumb terminal""" + # First check overrides: + # "User-level configuration files and per-instance command-line arguments should + # override $NO_COLOR. A user should be able to export $NO_COLOR in their shell + # configuration file as a default, but configure a specific program in its + # configuration file to specifically enable color." + # https://no-color.org + if no_color is not None and no_color: + return False + if force_color is not None and force_color: + return True + + # Then check env vars: + if os.environ.get("ANSI_COLORS_DISABLED"): + return False + if os.environ.get("NO_COLOR"): + return False + if os.environ.get("FORCE_COLOR"): + return True + + # Then check system: + if os.environ.get("TERM") == "dumb": + return False + if not hasattr(sys.stdout, "fileno"): + return False + + try: + return os.isatty(sys.stdout.fileno()) + except OSError: + return sys.stdout.isatty() + + +def colored( + text: object, + color: str | tuple[int, int, int] | None = None, + on_color: str | tuple[int, int, int] | None = None, + attrs: Iterable[str] | None = None, + *, + no_color: bool | None = None, + force_color: bool | None = None, +) -> str: + """Colorize text. + + Available text colors: + black, red, green, yellow, blue, magenta, cyan, white, + light_grey, dark_grey, light_red, light_green, light_yellow, light_blue, + light_magenta, light_cyan. + + Available text highlights: + on_black, on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white, + on_light_grey, on_dark_grey, on_light_red, on_light_green, on_light_yellow, + on_light_blue, on_light_magenta, on_light_cyan. + + Alternatively, both text colors (color) and highlights (on_color) may + be specified via a tuple of 0-255 ints (R, G, B). + + Available attributes: + bold, dark, italic, underline, blink, reverse, concealed, strike. + + Example: + colored('Hello, World!', 'red', 'on_black', ['bold', 'blink']) + colored('Hello, World!', 'green') + colored('Hello, World!', (255, 0, 255)) # Purple + """ + result = str(text) + if not can_colorize(no_color=no_color, force_color=force_color): + return result + + fmt_str = "\033[%dm%s" + rgb_fore_fmt_str = "\033[38;2;%d;%d;%dm%s" + rgb_back_fmt_str = "\033[48;2;%d;%d;%dm%s" + if color is not None: + if isinstance(color, str): + result = fmt_str % (COLORS[color], result) + elif isinstance(color, tuple): + result = rgb_fore_fmt_str % (color[0], color[1], color[2], result) + + if on_color is not None: + if isinstance(on_color, str): + result = fmt_str % (HIGHLIGHTS[on_color], result) + elif isinstance(on_color, tuple): + result = rgb_back_fmt_str % (on_color[0], on_color[1], on_color[2], result) + + if attrs is not None: + for attr in attrs: + result = fmt_str % (ATTRIBUTES[attr], result) + + result += RESET + + return result + + +def cprint( + text: object, + color: str | tuple[int, int, int] | None = None, + on_color: str | tuple[int, int, int] | None = None, + attrs: Iterable[str] | None = None, + *, + no_color: bool | None = None, + force_color: bool | None = None, + **kwargs: Any, +) -> None: + """Print colorized text. + + It accepts arguments of print function. + """ + + print( + ( + colored( + text, + color, + on_color, + attrs, + no_color=no_color, + force_color=force_color, + ) + ), + **kwargs, + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..622978f4821f3050c324f142f0967871fadc2534 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/METADATA @@ -0,0 +1,269 @@ +Metadata-Version: 2.4 +Name: thinc +Version: 8.3.10 +Summary: A refreshing functional take on deep learning, compatible with your favorite libraries +Home-page: https://github.com/explosion/thinc +Author: Explosion +Author-email: contact@explosion.ai +License: MIT +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: Cython +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Topic :: Scientific/Engineering +Requires-Python: <3.15,>=3.10 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: blis<1.4.0,>=1.3.0 +Requires-Dist: murmurhash<1.1.0,>=1.0.2 +Requires-Dist: cymem<2.1.0,>=2.0.2 +Requires-Dist: preshed<3.1.0,>=3.0.2 +Requires-Dist: wasabi<1.2.0,>=0.8.1 +Requires-Dist: srsly<3.0.0,>=2.4.0 +Requires-Dist: catalogue<2.1.0,>=2.0.4 +Requires-Dist: confection<1.0.0,>=0.0.1 +Requires-Dist: setuptools +Requires-Dist: numpy<3.0.0,>=1.19.0 +Requires-Dist: pydantic<3.0.0,>=2.0.0 +Requires-Dist: packaging>=20.0 +Requires-Dist: dataclasses<1.0,>=0.6; python_version < "3.7" +Requires-Dist: typing_extensions<5.0.0,>=3.7.4.1; python_version < "3.8" +Requires-Dist: contextvars<3,>=2.4; python_version < "3.7" +Provides-Extra: cuda +Requires-Dist: cupy>=5.0.0b4; extra == "cuda" +Provides-Extra: cuda80 +Requires-Dist: cupy-cuda80>=5.0.0b4; extra == "cuda80" +Provides-Extra: cuda90 +Requires-Dist: cupy-cuda90>=5.0.0b4; extra == "cuda90" +Provides-Extra: cuda91 +Requires-Dist: cupy-cuda91>=5.0.0b4; extra == "cuda91" +Provides-Extra: cuda92 +Requires-Dist: cupy-cuda92>=5.0.0b4; extra == "cuda92" +Provides-Extra: cuda100 +Requires-Dist: cupy-cuda100>=5.0.0b4; extra == "cuda100" +Provides-Extra: cuda101 +Requires-Dist: cupy-cuda101>=5.0.0b4; extra == "cuda101" +Provides-Extra: cuda102 +Requires-Dist: cupy-cuda102>=5.0.0b4; extra == "cuda102" +Provides-Extra: cuda110 +Requires-Dist: cupy-cuda110>=5.0.0b4; extra == "cuda110" +Provides-Extra: cuda111 +Requires-Dist: cupy-cuda111>=5.0.0b4; extra == "cuda111" +Provides-Extra: cuda112 +Requires-Dist: cupy-cuda112>=5.0.0b4; extra == "cuda112" +Provides-Extra: cuda113 +Requires-Dist: cupy-cuda113>=5.0.0b4; extra == "cuda113" +Provides-Extra: cuda114 +Requires-Dist: cupy-cuda114>=5.0.0b4; extra == "cuda114" +Provides-Extra: cuda115 +Requires-Dist: cupy-cuda115>=5.0.0b4; extra == "cuda115" +Provides-Extra: cuda116 +Requires-Dist: cupy-cuda116>=5.0.0b4; extra == "cuda116" +Provides-Extra: cuda117 +Requires-Dist: cupy-cuda117>=5.0.0b4; extra == "cuda117" +Provides-Extra: cuda11x +Requires-Dist: cupy-cuda11x>=11.0.0; extra == "cuda11x" +Provides-Extra: cuda12x +Requires-Dist: cupy-cuda12x>=11.5.0; extra == "cuda12x" +Provides-Extra: cuda-autodetect +Requires-Dist: cupy-wheel>=11.0.0; extra == "cuda-autodetect" +Provides-Extra: datasets +Requires-Dist: ml_datasets<0.3.0,>=0.2.0; extra == "datasets" +Provides-Extra: torch +Requires-Dist: torch>=1.6.0; extra == "torch" +Provides-Extra: tensorflow +Requires-Dist: tensorflow<2.6.0,>=2.0.0; extra == "tensorflow" +Provides-Extra: mxnet +Requires-Dist: mxnet<1.6.0,>=1.5.1; extra == "mxnet" +Provides-Extra: apple +Requires-Dist: thinc-apple-ops<2.0.0,>=1.0.0; extra == "apple" +Dynamic: license-file + + + +# Thinc: A refreshing functional take on deep learning, compatible with your favorite libraries + +### From the makers of [spaCy](https://spacy.io) and [Prodigy](https://prodi.gy) + +[Thinc](https://thinc.ai) is a **lightweight deep learning library** that offers +an elegant, type-checked, functional-programming API for **composing models**, +with support for layers defined in other frameworks such as **PyTorch, +TensorFlow and MXNet**. You can use Thinc as an interface layer, a standalone +toolkit or a flexible way to develop new models. Previous versions of Thinc have +been running quietly in production in thousands of companies, via both +[spaCy](https://spacy.io) and [Prodigy](https://prodi.gy). We wrote the new +version to let users **compose, configure and deploy custom models** built with +their favorite framework. + +[![tests](https://github.com/explosion/thinc/actions/workflows/tests.yml/badge.svg)](https://github.com/explosion/thinc/actions/workflows/tests.yml) +[![Current Release Version](https://img.shields.io/github/v/release/explosion/thinc.svg?include_prereleases&sort=semver&style=flat-square&logo=github)](https://github.com/explosion/thinc/releases) +[![PyPi Version](https://img.shields.io/pypi/v/thinc.svg?include_prereleases&sort=semver&style=flat-square&logo=pypi&logoColor=white)](https://pypi.python.org/pypi/thinc) +[![conda Version](https://img.shields.io/conda/vn/conda-forge/thinc.svg?style=flat-square&logo=conda-forge&logoColor=white)](https://anaconda.org/conda-forge/thinc) +[![Python wheels](https://img.shields.io/badge/wheels-%E2%9C%93-4c1.svg?longCache=true&style=flat-square&logo=python&logoColor=white)](https://github.com/explosion/wheelwright/releases) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/ambv/black) +[![Open demo in Colab][colab]][intro_to_thinc_colab] + +## 🔥 Features + +- **Type-check** your model definitions with custom types and + [`mypy`](https://mypy.readthedocs.io/en/latest/) plugin. +- Wrap **PyTorch**, **TensorFlow** and **MXNet** models for use in your network. +- Concise **functional-programming** approach to model definition, using + composition rather than inheritance. +- Optional custom infix notation via **operator overloading**. +- Integrated **config system** to describe trees of objects and hyperparameters. +- Choice of **extensible backends**. +- **[Read more →](https://thinc.ai/docs)** + +## 🚀 Quickstart + +Thinc is compatible with **Python 3.6+** and runs on **Linux**, **macOS** and +**Windows**. The latest releases with binary wheels are available from +[pip](https://pypi.python.org/pypi/thinc). Before you install Thinc and its +dependencies, make sure that your `pip`, `setuptools` and `wheel` are up to +date. For the most recent releases, pip 19.3 or newer is recommended. + +```bash +pip install -U pip setuptools wheel +pip install thinc +``` + +See the [extended installation docs](https://thinc.ai/docs/install#extended) for +details on optional dependencies for different backends and GPU. You might also +want to +[set up static type checking](https://thinc.ai/docs/install#type-checking) to +take advantage of Thinc's type system. + +> ⚠️ If you have installed PyTorch and you are using Python 3.7+, uninstall the +> package `dataclasses` with `pip uninstall dataclasses`, since it may have been +> installed by PyTorch and is incompatible with Python 3.7+. + +### 📓 Selected examples and notebooks + +Also see the [`/examples`](examples) directory and +[usage documentation](https://thinc.ai/docs) for more examples. Most examples +are Jupyter notebooks – to launch them on +[Google Colab](https://colab.research.google.com) (with GPU support!) click on +the button next to the notebook name. + +| Notebook | Description | +| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [`intro_to_thinc`][intro_to_thinc]
[![Open in Colab][colab]][intro_to_thinc_colab] | Everything you need to know to get started. Composing and training a model on the MNIST data, using config files, registering custom functions and wrapping PyTorch, TensorFlow and MXNet models. | +| [`transformers_tagger_bert`][transformers_tagger_bert]
[![Open in Colab][colab]][transformers_tagger_bert_colab] | How to use Thinc, `transformers` and PyTorch to train a part-of-speech tagger. From model definition and config to the training loop. | +| [`pos_tagger_basic_cnn`][pos_tagger_basic_cnn]
[![Open in Colab][colab]][pos_tagger_basic_cnn_colab] | Implementing and training a basic CNN for part-of-speech tagging model without external dependencies and using different levels of Thinc's config system. | +| [`parallel_training_ray`][parallel_training_ray]
[![Open in Colab][colab]][parallel_training_ray_colab] | How to set up synchronous and asynchronous parameter server training with Thinc and [Ray](https://ray.readthedocs.io/en/latest/). | + +**[View more →](examples)** + +[colab]: + https://gistcdn.githack.com/ines/dcf354aa71a7665ae19871d7fd14a4e0/raw/461fc1f61a7bc5860f943cd4b6bcfabb8c8906e7/colab-badge.svg +[intro_to_thinc]: examples/00_intro_to_thinc.ipynb +[intro_to_thinc_colab]: + https://colab.research.google.com/github/explosion/thinc/blob/master/examples/00_intro_to_thinc.ipynb +[transformers_tagger_bert]: examples/02_transformers_tagger_bert.ipynb +[transformers_tagger_bert_colab]: + https://colab.research.google.com/github/explosion/thinc/blob/master/examples/02_transformers_tagger_bert.ipynb +[pos_tagger_basic_cnn]: examples/03_pos_tagger_basic_cnn.ipynb +[pos_tagger_basic_cnn_colab]: + https://colab.research.google.com/github/explosion/thinc/blob/master/examples/03_pos_tagger_basic_cnn.ipynb +[parallel_training_ray]: examples/04_parallel_training_ray.ipynb +[parallel_training_ray_colab]: + https://colab.research.google.com/github/explosion/thinc/blob/master/examples/04_parallel_training_ray.ipynb + +### 📖 Documentation & usage guides + +| Documentation | Description | +| --------------------------------------------------------------------------------- | ----------------------------------------------------- | +| [Introduction](https://thinc.ai/docs) | Everything you need to know. | +| [Concept & Design](https://thinc.ai/docs/concept) | Thinc's conceptual model and how it works. | +| [Defining and using models](https://thinc.ai/docs/usage-models) | How to compose models and update state. | +| [Configuration system](https://thinc.ai/docs/usage-config) | Thinc's config system and function registry. | +| [Integrating PyTorch, TensorFlow & MXNet](https://thinc.ai/docs/usage-frameworks) | Interoperability with machine learning frameworks | +| [Layers API](https://thinc.ai/docs/api-layers) | Weights layers, transforms, combinators and wrappers. | +| [Type Checking](https://thinc.ai/docs/usage-type-checking) | Type-check your model definitions and more. | + +## 🗺 What's where + +| Module | Description | +| ----------------------------------------- | --------------------------------------------------------------------------------- | +| [`thinc.api`](thinc/api.py) | **User-facing API.** All classes and functions should be imported from here. | +| [`thinc.types`](thinc/types.py) | Custom [types and dataclasses](https://thinc.ai/docs/api-types). | +| [`thinc.model`](thinc/model.py) | The `Model` class. All Thinc models are an instance (not a subclass) of `Model`. | +| [`thinc.layers`](thinc/layers) | The layers. Each layer is implemented in its own module. | +| [`thinc.shims`](thinc/shims) | Interface for external models implemented in PyTorch, TensorFlow etc. | +| [`thinc.loss`](thinc/loss.py) | Functions to calculate losses. | +| [`thinc.optimizers`](thinc/optimizers.py) | Functions to create optimizers. Currently supports "vanilla" SGD, Adam and RAdam. | +| [`thinc.schedules`](thinc/schedules.py) | Generators for different rates, schedules, decays or series. | +| [`thinc.backends`](thinc/backends) | Backends for `numpy` and `cupy`. | +| [`thinc.config`](thinc/config.py) | Config parsing and validation and function registry system. | +| [`thinc.util`](thinc/util.py) | Utilities and helper functions. | + +## 🐍 Development notes + +Thinc uses [`black`](https://github.com/psf/black) for auto-formatting, +[`flake8`](http://flake8.pycqa.org/en/latest/) for linting and +[`mypy`](https://mypy.readthedocs.io/en/latest/) for type checking. All code is +written compatible with **Python 3.6+**, with type hints wherever possible. See +the [type reference](https://thinc.ai/docs/api-types) for more details on +Thinc's custom types. + +### 👷‍♀️ Building Thinc from source + +Building Thinc from source requires the full dependencies listed in +[`requirements.txt`](requirements.txt) to be installed. You'll also need a +compiler to build the C extensions. + +```bash +git clone https://github.com/explosion/thinc +cd thinc +python -m venv .env +source .env/bin/activate +pip install -U pip setuptools wheel +pip install -r requirements.txt +pip install --no-build-isolation . +``` + +Alternatively, install in editable mode: + +```bash +pip install -r requirements.txt +pip install --no-build-isolation --editable . +``` + +Or by setting `PYTHONPATH`: + +```bash +export PYTHONPATH=`pwd` +pip install -r requirements.txt +python setup.py build_ext --inplace +``` + +### 🚦 Running tests + +Thinc comes with an [extensive test suite](thinc/tests). The following should +all pass and not report any warnings or errors: + +```bash +python -m pytest thinc # test suite +python -m mypy thinc # type checks +python -m flake8 thinc # linting +``` + +To view test coverage, you can run `python -m pytest thinc --cov=thinc`. We aim +for a 100% test coverage. This doesn't mean that we meticulously write tests for +every single line – we ignore blocks that are not relevant or difficult to test +and make sure that the tests execute all code paths. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..539942b4786c656954878838617c7185b516f00d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/RECORD @@ -0,0 +1,367 @@ +thinc-8.3.10.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +thinc-8.3.10.dist-info/METADATA,sha256=ILrOsWYuLvKzjk7G0hkEPUbv2fk8RVM6m29Ya5oBxME,15613 +thinc-8.3.10.dist-info/RECORD,, +thinc-8.3.10.dist-info/WHEEL,sha256=8UP9x9puWI0P1V_d7K2oMTBqfeLNm21CTzZ_Ptr0NXU,101 +thinc-8.3.10.dist-info/entry_points.txt,sha256=XKKdq_CSXqo6JQy6KFFwvYfpyR__SkBiRQUYw_Bg9WA,66 +thinc-8.3.10.dist-info/licenses/LICENSE,sha256=yRgWFaN6OZ2fO7xD0j2omgY55O0zB7NLgFmHWt6qFjU,1144 +thinc-8.3.10.dist-info/top_level.txt,sha256=u3-NetjMbYinrdypKSLTjWYAhRmoOzTqbb_xXWaxW8Q,6 +thinc/__init__.pxd,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/__init__.py,sha256=SpDzvQkZysG476pfp2ytV5X5YqvmMX10alepZx10mRM,225 +thinc/__pycache__/__init__.cpython-312.pyc,, +thinc/__pycache__/about.cpython-312.pyc,, +thinc/__pycache__/api.cpython-312.pyc,, +thinc/__pycache__/compat.cpython-312.pyc,, +thinc/__pycache__/config.cpython-312.pyc,, +thinc/__pycache__/initializers.cpython-312.pyc,, +thinc/__pycache__/loss.cpython-312.pyc,, +thinc/__pycache__/model.cpython-312.pyc,, +thinc/__pycache__/mypy.cpython-312.pyc,, +thinc/__pycache__/optimizers.cpython-312.pyc,, +thinc/__pycache__/schedules.cpython-312.pyc,, +thinc/__pycache__/types.cpython-312.pyc,, +thinc/__pycache__/util.cpython-312.pyc,, +thinc/about.py,sha256=x3MQKMVtziFy8dXnbD5aSzMhSuWnFBTBjOkKxA9qVVg,44 +thinc/api.py,sha256=ripkrdcCq4v4ddj7Q2rzitUlyNXAKe1_e2H3ZkeH2VE,6093 +thinc/backends/__init__.pxd,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/backends/__init__.py,sha256=Ijexqmm7W1RzZAGgSzoC4JqHmLBzoTgbdYlXJEnoiZs,5592 +thinc/backends/__pycache__/__init__.cpython-312.pyc,, +thinc/backends/__pycache__/_cupy_allocators.cpython-312.pyc,, +thinc/backends/__pycache__/_custom_kernels.cpython-312.pyc,, +thinc/backends/__pycache__/_param_server.cpython-312.pyc,, +thinc/backends/__pycache__/cupy_ops.cpython-312.pyc,, +thinc/backends/__pycache__/mps_ops.cpython-312.pyc,, +thinc/backends/__pycache__/ops.cpython-312.pyc,, +thinc/backends/_cupy_allocators.py,sha256=NF0c-24aZps8IeiSz0yINTRSsi_1Y9BdA9-qiKBYx3M,2262 +thinc/backends/_custom_kernels.cu,sha256=ExeR0gPsYf42G1MufCsMKUCMMx-wo-a9O1XK41jW3k8,19480 +thinc/backends/_custom_kernels.py,sha256=t4byN4HM2v9H1V7oDwKxlqx4dhfxfdSWq6_PhZ94f4I,26253 +thinc/backends/_murmur3.cu,sha256=rkwVb8Np59rVIzrokrT8pz-tDUKbvDcnQH_aSn7ZqPo,5398 +thinc/backends/_param_server.py,sha256=GrMS_QmjA-XSuozj-uJwZOJ3OsjdQQISjFRxHiCa-30,2819 +thinc/backends/cblas.cp312-win_amd64.pyd,sha256=7s5vs-wGLGICB4NxGqHLjkDTHIOI-z6YAiBjwR-sV9I,122880 +thinc/backends/cblas.cpp,sha256=oVm-wVDAOs0984c1AALia6S1tveK2H-oWeYSSNH8eqk,1043407 +thinc/backends/cblas.pxd,sha256=bc3Y3EkNInQxjXn8lwBnxKolSe2gGlsJkT-vDffoBAU,1475 +thinc/backends/cblas.pyx,sha256=o8UxBN_pk_BLLrK6ZniTT5jSP0BkrZ4kS3T_nUJV4IQ,1183 +thinc/backends/cpu_kernels.hh,sha256=HAsiPua-DxcnkfyHv6Hu9w3GW62xFGpoA8Ha2xkzOn8,15083 +thinc/backends/cupy_ops.py,sha256=0a6SX-Up1ap3lcEKCITsu3Dn97o4LPOA-0X0urNAWdQ,13316 +thinc/backends/linalg.cp312-win_amd64.pyd,sha256=YY_1hNFY6Ff3cXYgqDup0ZlYm8rmWeFlHP8auRiyd6A,39424 +thinc/backends/linalg.cpp,sha256=kJ0a_jwWn_UwU5l8N4v9eBgazK50OVp_6o9MuEld6m4,391214 +thinc/backends/linalg.pxd,sha256=JhK1li7UoKZxQaAVrgTSY_EHgWkZUOLPzUHn1BlMtJU,8902 +thinc/backends/linalg.pyx,sha256=gwyyrPduXLZYUgyOUR3cNksiC9xSOPHVqArqHnAQtrU,82 +thinc/backends/mps_ops.py,sha256=BKGmtdIRGaWv1MeRxNCNhrbR1IHjcLrUBrhn3rZ7pVs,635 +thinc/backends/numpy_ops.cp312-win_amd64.pyd,sha256=5aft_b3gtfnF4umT8jMq9rsbzmiQwUh8Q__r-injrxs,455168 +thinc/backends/numpy_ops.cpp,sha256=9o-N0HBydWD5FTn0sMiPdRFumisJ8afhQqmKDcnl6ok,2999585 +thinc/backends/numpy_ops.pxd,sha256=bgeqd5XI-kKe_0BWDPk1K6gt7WhZlLQkWy1QcoY1Eig,2039 +thinc/backends/numpy_ops.pyx,sha256=haMMl9u892GOVhWPLRi4bWNUq9eVpFekl6H_67-Mqqk,41380 +thinc/backends/ops.py,sha256=FA5gIEDgJtjvij8qtAfdJr9Ejni3vqTME5v8uiR_oac,60410 +thinc/compat.py,sha256=c3EUSp8x2G-L47j5oLAHKdNNlLu2oRZsamZ0xq7O20Q,3160 +thinc/config.py,sha256=b4Z0WJQjKFA30VDHkCy8jIPnd7hEJx0DsHjmeC2C9nY,1311 +thinc/extra/__init__.pxd,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/extra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/extra/__pycache__/__init__.cpython-312.pyc,, +thinc/extra/search.cp312-win_amd64.pyd,sha256=_utmTlPlVrpvGyp2JeRPa_EIJxNFlrWs7gQifmYRqkU,104960 +thinc/extra/search.cpp,sha256=p3lA_VYQci5X4MWs5lu3VK8lT99Prr6Bm3TLH6AA6MQ,818606 +thinc/extra/search.pxd,sha256=fGmd9Zhr3F0m3LcCDwgyIniLJ5Xy7pakHL4P3dMh9ko,2742 +thinc/extra/search.pyx,sha256=RxaU8cAVrY4x42laeVHndn-GG5IQSefrcX2UY78k0k0,12533 +thinc/extra/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/extra/tests/__pycache__/__init__.cpython-312.pyc,, +thinc/extra/tests/c_test_search.pyx,sha256=gvtewaJ9FOOOV4lGCgT2YI1DCwTxKBtPl6GcBj4RLKM,2490 +thinc/initializers.py,sha256=Q0cRFN59B8mrtvmlfeS7FJ8jmRGfmzFy8E482pion_g,3957 +thinc/layers/__init__.py,sha256=DMthDdLZu8znrorDPn-5zCi4Dhz8jcKE34cf5vBT3oo,4566 +thinc/layers/__pycache__/__init__.cpython-312.pyc,, +thinc/layers/__pycache__/add.cpython-312.pyc,, +thinc/layers/__pycache__/array_getitem.cpython-312.pyc,, +thinc/layers/__pycache__/bidirectional.cpython-312.pyc,, +thinc/layers/__pycache__/cauchysimilarity.cpython-312.pyc,, +thinc/layers/__pycache__/chain.cpython-312.pyc,, +thinc/layers/__pycache__/clipped_linear.cpython-312.pyc,, +thinc/layers/__pycache__/clone.cpython-312.pyc,, +thinc/layers/__pycache__/concatenate.cpython-312.pyc,, +thinc/layers/__pycache__/dish.cpython-312.pyc,, +thinc/layers/__pycache__/dropout.cpython-312.pyc,, +thinc/layers/__pycache__/embed.cpython-312.pyc,, +thinc/layers/__pycache__/expand_window.cpython-312.pyc,, +thinc/layers/__pycache__/gelu.cpython-312.pyc,, +thinc/layers/__pycache__/hard_swish.cpython-312.pyc,, +thinc/layers/__pycache__/hard_swish_mobilenet.cpython-312.pyc,, +thinc/layers/__pycache__/hashembed.cpython-312.pyc,, +thinc/layers/__pycache__/layernorm.cpython-312.pyc,, +thinc/layers/__pycache__/linear.cpython-312.pyc,, +thinc/layers/__pycache__/list2array.cpython-312.pyc,, +thinc/layers/__pycache__/list2padded.cpython-312.pyc,, +thinc/layers/__pycache__/list2ragged.cpython-312.pyc,, +thinc/layers/__pycache__/logistic.cpython-312.pyc,, +thinc/layers/__pycache__/lstm.cpython-312.pyc,, +thinc/layers/__pycache__/map_list.cpython-312.pyc,, +thinc/layers/__pycache__/maxout.cpython-312.pyc,, +thinc/layers/__pycache__/mish.cpython-312.pyc,, +thinc/layers/__pycache__/multisoftmax.cpython-312.pyc,, +thinc/layers/__pycache__/mxnetwrapper.cpython-312.pyc,, +thinc/layers/__pycache__/noop.cpython-312.pyc,, +thinc/layers/__pycache__/padded2list.cpython-312.pyc,, +thinc/layers/__pycache__/parametricattention.cpython-312.pyc,, +thinc/layers/__pycache__/parametricattention_v2.cpython-312.pyc,, +thinc/layers/__pycache__/pytorchwrapper.cpython-312.pyc,, +thinc/layers/__pycache__/ragged2list.cpython-312.pyc,, +thinc/layers/__pycache__/reduce_first.cpython-312.pyc,, +thinc/layers/__pycache__/reduce_last.cpython-312.pyc,, +thinc/layers/__pycache__/reduce_max.cpython-312.pyc,, +thinc/layers/__pycache__/reduce_mean.cpython-312.pyc,, +thinc/layers/__pycache__/reduce_sum.cpython-312.pyc,, +thinc/layers/__pycache__/relu.cpython-312.pyc,, +thinc/layers/__pycache__/remap_ids.cpython-312.pyc,, +thinc/layers/__pycache__/residual.cpython-312.pyc,, +thinc/layers/__pycache__/resizable.cpython-312.pyc,, +thinc/layers/__pycache__/siamese.cpython-312.pyc,, +thinc/layers/__pycache__/sigmoid.cpython-312.pyc,, +thinc/layers/__pycache__/sigmoid_activation.cpython-312.pyc,, +thinc/layers/__pycache__/softmax.cpython-312.pyc,, +thinc/layers/__pycache__/softmax_activation.cpython-312.pyc,, +thinc/layers/__pycache__/strings2arrays.cpython-312.pyc,, +thinc/layers/__pycache__/swish.cpython-312.pyc,, +thinc/layers/__pycache__/tensorflowwrapper.cpython-312.pyc,, +thinc/layers/__pycache__/torchscriptwrapper.cpython-312.pyc,, +thinc/layers/__pycache__/tuplify.cpython-312.pyc,, +thinc/layers/__pycache__/uniqued.cpython-312.pyc,, +thinc/layers/__pycache__/with_array.cpython-312.pyc,, +thinc/layers/__pycache__/with_array2d.cpython-312.pyc,, +thinc/layers/__pycache__/with_cpu.cpython-312.pyc,, +thinc/layers/__pycache__/with_debug.cpython-312.pyc,, +thinc/layers/__pycache__/with_flatten.cpython-312.pyc,, +thinc/layers/__pycache__/with_flatten_v2.cpython-312.pyc,, +thinc/layers/__pycache__/with_getitem.cpython-312.pyc,, +thinc/layers/__pycache__/with_list.cpython-312.pyc,, +thinc/layers/__pycache__/with_nvtx_range.cpython-312.pyc,, +thinc/layers/__pycache__/with_padded.cpython-312.pyc,, +thinc/layers/__pycache__/with_ragged.cpython-312.pyc,, +thinc/layers/__pycache__/with_reshape.cpython-312.pyc,, +thinc/layers/__pycache__/with_signpost_interval.cpython-312.pyc,, +thinc/layers/add.py,sha256=VPdmhElJZm-xT4zfzaReyeOCEzZPvj6pSQiUISk8UC0,2313 +thinc/layers/array_getitem.py,sha256=vuhdnHkXyiUKODZVu-ZeGOkhTa36N0IfhaBgDAILRwg,1638 +thinc/layers/bidirectional.py,sha256=gJKGVDXw53tn_UeoU4a7hP83whd6ZrzhV8pwA1zddYc,2262 +thinc/layers/cauchysimilarity.py,sha256=w9lHjm1mgGQ8NFpv2Z-4HgvLiN4Ekf54TP2I2f00Irg,1804 +thinc/layers/chain.py,sha256=5KD68qOnpuA4mVilV2sHOgM-vqgLd4h4pjNP6gmp-lU,3546 +thinc/layers/clipped_linear.py,sha256=n0svqEfytzujXFzK1Ghug1ldWtOPU-SHPt_yGTMxHVI,4612 +thinc/layers/clone.py,sha256=s9UutT2CeQf1RsK2mJF1Bb6UiEfUuzi8beb58t27DIg,672 +thinc/layers/concatenate.py,sha256=8x11-6PBYubMu2sKH5w5zpBZ62OCjvpRjfikYEu5m34,5343 +thinc/layers/dish.py,sha256=oDxtFhTBzT2pofh1JoZLUyuXQBW79Vi9hgUzwfPRn14,2183 +thinc/layers/dropout.py,sha256=kjhqUAFStGJluxiCK93UhpYj5koWlU8nhRO2k1KswOA,3042 +thinc/layers/embed.py,sha256=Bt5pWVaKOlPZt_CvxVx-Mrv98s-y19ZIB2iWwAcAW8g,2841 +thinc/layers/expand_window.py,sha256=Dmh_geLvs6hCHll8SAbO-AGQfW77uBen-v1cQUQaLh4,1697 +thinc/layers/gelu.py,sha256=M7F-yCEPj5NpEKZqFO7psTrbjPzIKf9RtFWLsIDiEwg,2190 +thinc/layers/hard_swish.py,sha256=W_-lHod8Qy_BrLAV0QliQtFzuZ9E4c-BpzhrG-haOrM,2217 +thinc/layers/hard_swish_mobilenet.py,sha256=486HLIgWsfIEGZ2SZvxDS8R1bVIkxaP3f_S8sUd2KLI,2264 +thinc/layers/hashembed.py,sha256=ABZ3QTt_XlHoxIJPW3COyaYLNlev8AcpnRG2ae9cRsY,3716 +thinc/layers/layernorm.py,sha256=IhPHohbrWjtI7NItEZL39OArscRL_UMrtfQN75LsqWA,2621 +thinc/layers/linear.py,sha256=ZCFnQfeIO9SfT552szQBke3103U4vxEHBvtMWUA1PaY,1781 +thinc/layers/list2array.py,sha256=6jWCDtgJ892BlLz0aSXklki2Nu4kG0tzTAN5SsCAHhw,907 +thinc/layers/list2padded.py,sha256=uguepFCFzu7Af1skPEKgdRjtbQU0ZXk8uJjwfkThxOs,645 +thinc/layers/list2ragged.py,sha256=2HLo5B5toUA8q1eDRvANdmWWNOD3uPFVEIxWN2NrrKE,888 +thinc/layers/logistic.py,sha256=KEFCo2JxfJyUFeG9k-KK80AnVZ7QFyn5GtHMOy1kLHw,634 +thinc/layers/lstm.py,sha256=nQtDCu6ML6w0Qp5qwoPHA2N6gAy--h5rDFA2_p9p4RM,6633 +thinc/layers/map_list.py,sha256=uO7hkODEg6vpCTQ5rIQBkX6vlt0tGu-I6mFJugNdiRs,1063 +thinc/layers/maxout.py,sha256=b1Zn84wVruEwvBIKJDnMt9guqp1A8K96i8KXw4fuXCo,2676 +thinc/layers/mish.py,sha256=s4PEICpUfT_sguXt788XRdlvHbiyh25Oxc9MKFbIjaU,2345 +thinc/layers/multisoftmax.py,sha256=5WG6sxGSqHRqhrf-0Naq9qddr9UsJLwzNBS4D29n-IA,1824 +thinc/layers/mxnetwrapper.py,sha256=YI_HGyaC_wMibgR-stjzKt2XI1_kbGU1fgJI52NFSno,4397 +thinc/layers/noop.py,sha256=fpjpH7_v8OOrZ_jOUxp9ssSTT3-hHT1Jd1IAh_kjswA,532 +thinc/layers/padded2list.py,sha256=CJt-5lxYcm2a_5c1UQ1cbR7_wEfhWpLF2NjprrhgAPs,729 +thinc/layers/parametricattention.py,sha256=8kjtg9VXv2Mkxk6yG29bntXo3WfHcZn6w0F2lGsdKY8,2169 +thinc/layers/parametricattention_v2.py,sha256=QWomX-SSlWcFBHlKsXRodFZFQToXc4OY4JNP30mcQDw,3072 +thinc/layers/premap_ids.cp312-win_amd64.pyd,sha256=D9L7St9KF70nIcQp3yOezRlGA5RRDono4dpdYeoi2yU,148992 +thinc/layers/premap_ids.cpp,sha256=buHTJOsYuZCIHguSyoH1y7sEl4UWnqeOijxGXiPJjSg,1162022 +thinc/layers/premap_ids.pyx,sha256=Rx-aLJ-QViWx1-7B-9C9-hwnxv6b0aHziNmoaZeDCCk,2438 +thinc/layers/pytorchwrapper.py,sha256=uHzvu1yuh4idvFs3qw-NvzDPS-aD9cvUgN3XYJW014I,12758 +thinc/layers/ragged2list.py,sha256=U5H1pYticD9xd94PSgb1j91FdnrLOZ--eKrfO6RX298,798 +thinc/layers/reduce_first.py,sha256=OdgfjUJNlSE-hXSPAZT5UMP3IHbtEH1KMjyoainrEXQ,845 +thinc/layers/reduce_last.py,sha256=ur6OxTP-8o6n729XH1FbU36PWtomVKm1MOdZNjSz_KQ,825 +thinc/layers/reduce_max.py,sha256=wnIG3VWwJ53wI4qwJSkeq9vuYGWXRkMRRZrSgZQ3Kq4,746 +thinc/layers/reduce_mean.py,sha256=4SYxnSjscp0PS1cmAI1YxGhi4yg6Zn351OMnitABcms,739 +thinc/layers/reduce_sum.py,sha256=n_wvvUMpECNs4lXyF8a8a9tZvyvPpEsGFnrrA3Nf23M,732 +thinc/layers/relu.py,sha256=pn6oI6jXJWtKsCtCWmLZvKbTnU0KGv1BgRS42x7slEo,2128 +thinc/layers/remap_ids.py,sha256=4bq4WTfw3M2j622frKOY67vtQO38uRQLDmrxXLRAEX4,3169 +thinc/layers/residual.py,sha256=GNUCx84fTNbDx0dqUanRv1rvXhlO6PFpZgmY1bfA7PI,2156 +thinc/layers/resizable.py,sha256=OHZDc1cC17Me5QC096MezyGboZXg1jde1jrBCAGtrrk,2848 +thinc/layers/siamese.py,sha256=3bYwY8PBQ_ZR0MzuL2Ix45tdvFYcKqA-zaup5FzFi5k,1667 +thinc/layers/sigmoid.py,sha256=mnldqthR7XOjEiSbSbfzzza0iCIL5xk-6Pe7N2E0hzY,2010 +thinc/layers/sigmoid_activation.py,sha256=TXIzLlsgVMK2ykv0dB4Y-tx1f10jQ6iVv6ZzsCzy2OA,676 +thinc/layers/softmax.py,sha256=2jB8FjH1sl-jP6hpF6CtLDHHWIjpIuk9YsPt43N9Dqw,3352 +thinc/layers/softmax_activation.py,sha256=e2cae-pjYRj19GTE__2TYlx0wWW7TpzoAOKeX30ADBc,564 +thinc/layers/sparselinear.cp312-win_amd64.pyd,sha256=q8pjI1LaKepg94cfUiUIpm9RQvFWytgrmVZB1_lLKgc,171520 +thinc/layers/sparselinear.cpp,sha256=CbKcwf1oO-roYtzLpyvIIXHnr7YCPr4jZzghc4Iodv0,1405642 +thinc/layers/sparselinear.pyx,sha256=TyuwZUZl7AQm9O9r_r3DRvOr1KdoZbaGTLDGEC8liHI,8418 +thinc/layers/strings2arrays.py,sha256=a-PKPmmqJpYANtDllVCz0gWQItZhmVseshfkolvlZVU,983 +thinc/layers/swish.py,sha256=FsfiwUBwh_DFeCJZXbcv2pxPTc8CzfIywYjWXDDSjkY,2198 +thinc/layers/tensorflowwrapper.py,sha256=cg2h8OywsXeI5khltbaTmEiH_CrAajsg9Wn1GKF9VCo,6732 +thinc/layers/torchscriptwrapper.py,sha256=0SWmVTkkmeGuxJON4-mNEHImB-8ikT9inYzcX8KX-ak,3369 +thinc/layers/tuplify.py,sha256=2T6OT23Kes8N3Lzls19m7P5Zaw_OsuCb7ThdwLOJwt8,2088 +thinc/layers/uniqued.py,sha256=nhOCSQ0hI0M6A0eyqOEVnRuHwhX24UZxCkl5Qp1Sz70,2126 +thinc/layers/with_array.py,sha256=wR594GVwxLRXN25nJlsOGHFywBmS_ZmbqPgCmULmke4,3688 +thinc/layers/with_array2d.py,sha256=1EDVP1H0MzwzW5CtDkI-GQgTfSGx7PbT7wmSWWYsj1M,4261 +thinc/layers/with_cpu.py,sha256=eLhpHSAEKpZ8ut_V66h_djfXKyBtgmiIJNkfKpxlqmg,1485 +thinc/layers/with_debug.py,sha256=np_LDGA2bc2COg5WrTnESw0O2K8TNCW36czm0O4lCAU,1377 +thinc/layers/with_flatten.py,sha256=ZKxaMHMqE4uXKSRuHuzJ_SC5qw9tHrQodTNOmAF-AQU,1727 +thinc/layers/with_flatten_v2.py,sha256=tONPGDg2BJUf8rXksu3brpZZWa5dXeI-u7riOk7gVNY,2019 +thinc/layers/with_getitem.py,sha256=RX6CF0ez6KwnIAeKF4UEo9zwYVAH9QlOlR-hppS7MhM,1210 +thinc/layers/with_list.py,sha256=-porFhjHgt6PxJJitS9moJ6mmFb8ppnjecMcM8dHJNg,2980 +thinc/layers/with_nvtx_range.py,sha256=Y-CJmudzf-jyYQh36W6K7AIdLppUdrY7yV7mQET6hkA,1337 +thinc/layers/with_padded.py,sha256=IoSglfea7ck0DfutiohRq2mP3yS9Nr-cvPGJJ4eW82g,4999 +thinc/layers/with_ragged.py,sha256=-jfA0ZV3KJOM3eOz1dK7YOHr9e9EjePiXfLCiw2a_Zg,4574 +thinc/layers/with_reshape.py,sha256=xRc8OJ845YwlttV2AAsZA7rjGK9wQAkjDdUj94zoHVU,1847 +thinc/layers/with_signpost_interval.py,sha256=wyuBAUoZDeZCwDareW7BZNEqTHSpmPubb5VAQ68tX0o,1560 +thinc/loss.py,sha256=V9c3gbZOA378JFPRb-uFKkjjsQa8cYT7-XtgZWxhmr4,16747 +thinc/model.py,sha256=hxq-TTOf7tk2nB2ZTjQytm728bNTH84QXcDY5T_3aGs,35814 +thinc/mypy.py,sha256=QJSAm_YRfSE-PvZGWND_ISvJpG3nezKwwNRKuM1aqAA,11733 +thinc/optimizers.py,sha256=RaOcE2_6ibpw1MZI7-ptx2KFgqSLUZlGGCcZjPoQMDY,12234 +thinc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/schedules.py,sha256=KUPmQHpzs9E_ybY4IMqcd56AOQ5h7TvOhr1FhTiQs0o,3848 +thinc/shims/__init__.py,sha256=29fKxSl5nhBK_oODrLqIeADSmAqZnM340jT-5Z8Jewc,481 +thinc/shims/__pycache__/__init__.cpython-312.pyc,, +thinc/shims/__pycache__/mxnet.cpython-312.pyc,, +thinc/shims/__pycache__/pytorch.cpython-312.pyc,, +thinc/shims/__pycache__/pytorch_grad_scaler.cpython-312.pyc,, +thinc/shims/__pycache__/shim.cpython-312.pyc,, +thinc/shims/__pycache__/tensorflow.cpython-312.pyc,, +thinc/shims/__pycache__/torchscript.cpython-312.pyc,, +thinc/shims/mxnet.py,sha256=U7R_FOsvdmIk7EQaxycqfTLHmynqhmkQqWFp-6Qxs6M,4438 +thinc/shims/pytorch.py,sha256=KYvv3ib8_h0t2IjDZx2S6_Y0EyGEyUhTTqI-b_vgLEE,10239 +thinc/shims/pytorch_grad_scaler.py,sha256=pHDkOCcxTxn23H-BnAJ78DZrthx_dTtrzufgxxJdXpg,6241 +thinc/shims/shim.py,sha256=vEaL773EFEeH8llhlJjU_xN45v1WFhgekIJGiBiC3Hc,2556 +thinc/shims/tensorflow.py,sha256=XxpehecJDeWJ4qb3qk1s65RkvNotKq1NXu8WisSR6rs,10881 +thinc/shims/torchscript.py,sha256=qh9aP-XPqMl7wWU4Z9m_-F1H_VZCnH5MkzJeSSyO0rQ,2528 +thinc/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/tests/__pycache__/__init__.cpython-312.pyc,, +thinc/tests/__pycache__/conftest.cpython-312.pyc,, +thinc/tests/__pycache__/enable_mxnet.cpython-312.pyc,, +thinc/tests/__pycache__/enable_tensorflow.cpython-312.pyc,, +thinc/tests/__pycache__/strategies.cpython-312.pyc,, +thinc/tests/__pycache__/test_config.cpython-312.pyc,, +thinc/tests/__pycache__/test_examples.cpython-312.pyc,, +thinc/tests/__pycache__/test_import__all__.cpython-312.pyc,, +thinc/tests/__pycache__/test_indexing.cpython-312.pyc,, +thinc/tests/__pycache__/test_initializers.cpython-312.pyc,, +thinc/tests/__pycache__/test_loss.cpython-312.pyc,, +thinc/tests/__pycache__/test_optimizers.cpython-312.pyc,, +thinc/tests/__pycache__/test_schedules.cpython-312.pyc,, +thinc/tests/__pycache__/test_serialize.cpython-312.pyc,, +thinc/tests/__pycache__/test_types.cpython-312.pyc,, +thinc/tests/__pycache__/test_util.cpython-312.pyc,, +thinc/tests/__pycache__/util.cpython-312.pyc,, +thinc/tests/backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/tests/backends/__pycache__/__init__.cpython-312.pyc,, +thinc/tests/backends/__pycache__/test_mem.cpython-312.pyc,, +thinc/tests/backends/__pycache__/test_ops.cpython-312.pyc,, +thinc/tests/backends/test_mem.py,sha256=gD6S4ohD0qbE0mxs3Kgf58GWZtI2LYe6ek0n2M7ZMuU,371 +thinc/tests/backends/test_ops.py,sha256=8mvuhtlJ29owk801q7KMJDFbFfN8VTJwHuPfFeNQvRg,54460 +thinc/tests/conftest.py,sha256=pLOWV0lSH4XMlPoXHujhr_oLfwF3DuxA3piGnrmotfU,2277 +thinc/tests/enable_mxnet.py,sha256=BBLTOuSm2LmRLVj1mGZh1B_w_LOe-cq0NgKjlWCWckk,98 +thinc/tests/enable_tensorflow.py,sha256=6pKd-k0vr1PF_JGRpMRM__qMVFdl_pLkxsEBU_gMq3Y,108 +thinc/tests/extra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/tests/extra/__pycache__/__init__.cpython-312.pyc,, +thinc/tests/extra/__pycache__/test_beam_search.cpython-312.pyc,, +thinc/tests/extra/test_beam_search.py,sha256=5m_rwsKvdzm_6ZtFsgh3kddxoCj6nskCicHwZymParc,93 +thinc/tests/layers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/tests/layers/__pycache__/__init__.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_basic_tagger.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_combinators.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_feed_forward.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_hash_embed.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_layers_api.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_linear.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_lstm.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_mappers.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_mnist.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_mxnet_wrapper.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_parametric_attention_v2.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_pytorch_wrapper.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_reduce.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_resizable.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_shim.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_softmax.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_sparse_linear.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_tensorflow_wrapper.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_torchscriptwrapper.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_transforms.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_uniqued.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_with_debug.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_with_flatten.cpython-312.pyc,, +thinc/tests/layers/__pycache__/test_with_transforms.cpython-312.pyc,, +thinc/tests/layers/test_basic_tagger.py,sha256=mqO1tt40NWM9Pf4mseeJ4AQckPHMn6ia9vBl_TmUG4g,2515 +thinc/tests/layers/test_combinators.py,sha256=_XZHCh_7WBTdMhUiiGGrwWwsmGS5yIygLYQCEWUfgTU,8126 +thinc/tests/layers/test_feed_forward.py,sha256=9qDyMDKJUM2ccntrrNBkheWly50NsUk4a4b38B-M70c,5637 +thinc/tests/layers/test_hash_embed.py,sha256=lHVCsCA9EfELV0c7biTm-3P1V7SA8FWlUnKVKOMYLTg,552 +thinc/tests/layers/test_layers_api.py,sha256=iBnySO4xyt_tPkOLKnPASrLmhTKJ7C3kJ-wY9xV23lw,10210 +thinc/tests/layers/test_linear.py,sha256=v_RKUm0y5jFPI5rl3OoJ0EaDgByZ-w5XO6XMzsK-GNI,7899 +thinc/tests/layers/test_lstm.py,sha256=uU7a8m4xRbODptxNtH5GK5EBIXbg9_zux1b0B4NTLLM,5828 +thinc/tests/layers/test_mappers.py,sha256=8DnMDtkxVL9teUjjn7bN4GgauwlQ4S6N2R1QFdj5RaI,1706 +thinc/tests/layers/test_mnist.py,sha256=zx1OTVe4Y8c3DIObqMgfyFdzjN28EqMm9sAruBdc_iQ,3785 +thinc/tests/layers/test_mxnet_wrapper.py,sha256=CpoKmPjM32NFkLBt0pAhEjMebplvvTHdtgI_C6lPB5E,6508 +thinc/tests/layers/test_parametric_attention_v2.py,sha256=iXLeIWfu1nGjOwAXZaL2U59z-Jwp-1MvrYkr0qeLL90,295 +thinc/tests/layers/test_pytorch_wrapper.py,sha256=QPFBJrG_Rs8Ifv9SVFsUqaflXNbbwz3CGhSHza9J9gU,7166 +thinc/tests/layers/test_reduce.py,sha256=7C0wUzbHoII8QdKcEoERp9v0RwseC-EO9EVFORI-5ig,3817 +thinc/tests/layers/test_resizable.py,sha256=c_K3qF_VpS14YagzOZpWITRlk_i8jm06m-13mf5w6nA,908 +thinc/tests/layers/test_shim.py,sha256=RfEbxemHzxWxB2sPH4oROXFYIWjSEMYU2NlZa2D75iQ,980 +thinc/tests/layers/test_softmax.py,sha256=ECmaj8g-kPzFlnZKwJSEEDn1kXZ8jtt95U1BUP8vDeA,2961 +thinc/tests/layers/test_sparse_linear.py,sha256=UEIAj9EtVYCVjMRiu-zsd2ifMd8_1SQvaOOeTqMPv04,2370 +thinc/tests/layers/test_tensorflow_wrapper.py,sha256=L8nsG20rf88f1m4pLg435qoJnB63RDVnDihSKRvDjLY,13525 +thinc/tests/layers/test_torchscriptwrapper.py,sha256=1P1CgEDS5czFbZZ7hzdTGrcA972gI5LQ40qUnOYiJ9E,834 +thinc/tests/layers/test_transforms.py,sha256=4gdkanhD2cnvB6rXldoZ4ZK6Y56M4GdURMdieqAmLgY,2055 +thinc/tests/layers/test_uniqued.py,sha256=OWoof_geI9abeVTMnuT0SB162Ai4KTC15fBVoLs6BVQ,2318 +thinc/tests/layers/test_with_debug.py,sha256=1FzW2li2orBOmAu7O0pW8w-WVPfAFQpC0LNVrw1m14c,828 +thinc/tests/layers/test_with_flatten.py,sha256=byvCiVvxHVyVix1YpEdJKT6Cv_TaBOtC9gNIR7X8iVU,902 +thinc/tests/layers/test_with_transforms.py,sha256=Cazbpge4wNbTIK3YWYtJiM00rY0m9PXGSrMV9-ERC7g,10468 +thinc/tests/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/tests/model/__pycache__/__init__.cpython-312.pyc,, +thinc/tests/model/__pycache__/test_model.cpython-312.pyc,, +thinc/tests/model/__pycache__/test_validation.cpython-312.pyc,, +thinc/tests/model/test_model.py,sha256=25nhoI0NR7wHjxb0EApS2MjF4ZFOuijGHtiGIsngDmE,20587 +thinc/tests/model/test_validation.py,sha256=7YQOsp1b6BvHWeQ-RY7YOuNu75bLEFtGADc3z5uKIo0,1598 +thinc/tests/mypy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/tests/mypy/__pycache__/__init__.cpython-312.pyc,, +thinc/tests/mypy/__pycache__/test_mypy.cpython-312.pyc,, +thinc/tests/mypy/configs/mypy-default.ini,sha256=PSZ1M9DCNyH2FnzWHd16kfiNGVVs0m4HZMzzm3MaRB4,203 +thinc/tests/mypy/configs/mypy-plugin.ini,sha256=qFlHNcPacAgVtX5Pnwnhe1TvVhlrnnF5IL3L7-u6sGc,227 +thinc/tests/mypy/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/tests/mypy/modules/__pycache__/__init__.cpython-312.pyc,, +thinc/tests/mypy/modules/__pycache__/fail_no_plugin.cpython-312.pyc,, +thinc/tests/mypy/modules/__pycache__/fail_plugin.cpython-312.pyc,, +thinc/tests/mypy/modules/__pycache__/success_no_plugin.cpython-312.pyc,, +thinc/tests/mypy/modules/__pycache__/success_plugin.cpython-312.pyc,, +thinc/tests/mypy/modules/fail_no_plugin.py,sha256=iX24AqhUjkZYYPaFehm8ukaBCf5xcugjrXwZy451rUU,172 +thinc/tests/mypy/modules/fail_plugin.py,sha256=E0GjqcAbfCaT9PB5-OzAYXOIQjVJ6joreT0T4kY3IiY,585 +thinc/tests/mypy/modules/success_no_plugin.py,sha256=J06z-fCZzo9cMDw1GBX902wDJaIh1AfSPOLXEAbZIg8,441 +thinc/tests/mypy/modules/success_plugin.py,sha256=FDG20ngMBWv6l_6ipm8eNCj9comSxXcIPsKAf-FV7kU,865 +thinc/tests/mypy/outputs/fail-no-plugin.txt,sha256=ijNJi9n06boRz1JXWQbB6tMrWBMJCM-w0dDun0HFY-A,114 +thinc/tests/mypy/outputs/fail-plugin.txt,sha256=-Z5qEnQ3RHgz9-n1CRqlTsI_pwFchFtFNUUhThtUA3g,2436 +thinc/tests/mypy/outputs/success-no-plugin.txt,sha256=DOtWznityx8YUd-Vo2Y-24oSRZH9FWa7Uc2dNCCcxmc,583 +thinc/tests/mypy/outputs/success-plugin.txt,sha256=MR_6qVKJgKaKSFIqo6b8o502kQTkjqtLEzmrBop-AOk,499 +thinc/tests/mypy/test_mypy.py,sha256=hHPBuPKBYZ-aW_pLGwpZqHO769lW8NGZ66imv3w1wyU,3163 +thinc/tests/regression/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/tests/regression/__pycache__/__init__.cpython-312.pyc,, +thinc/tests/regression/__pycache__/test_issue208.cpython-312.pyc,, +thinc/tests/regression/__pycache__/test_issue564.cpython-312.pyc,, +thinc/tests/regression/issue519/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/tests/regression/issue519/__pycache__/__init__.cpython-312.pyc,, +thinc/tests/regression/issue519/__pycache__/program.cpython-312.pyc,, +thinc/tests/regression/issue519/__pycache__/test_issue519.cpython-312.pyc,, +thinc/tests/regression/issue519/program.py,sha256=b51mTjBOIIcMC6k3cHtwpAcyQawhDvKF30YF5YJzhH8,496 +thinc/tests/regression/issue519/test_issue519.py,sha256=yUIO_cJjj7xTGyUWqW9LEYRmmIIL_RR9m00Sot50gco,846 +thinc/tests/regression/test_issue208.py,sha256=xaxUToQQq66JzMT4JflwJruAE9zRDG-Lln91oZ2xFwM,338 +thinc/tests/regression/test_issue564.py,sha256=0sPdlk8WDJxRDNUMbUz7IlJDpgKUHzNnOmHR-s2Q-nk,541 +thinc/tests/shims/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +thinc/tests/shims/__pycache__/__init__.cpython-312.pyc,, +thinc/tests/shims/__pycache__/test_pytorch_grad_scaler.cpython-312.pyc,, +thinc/tests/shims/test_pytorch_grad_scaler.py,sha256=aNmWAF1bD4PiO-WjrxtrQYsxSxzCvAv8IrOsOu3jn34,3458 +thinc/tests/strategies.py,sha256=RNLp8PRzIGUoUb3IWFumn_HHPwfn18oNsxj_SfqM7lI,3712 +thinc/tests/test_config.py,sha256=WXleppolJA8w_zuEr_y3iiNVa6iyfuTp49zfJ_xukoo,6039 +thinc/tests/test_examples.py,sha256=K6R6aUUATGJSVy4IEuc4jye2pJuMqnCrsj891Lqzwj0,1864 +thinc/tests/test_import__all__.py,sha256=SVybWbYk7LusfRQnfYVgCdu5wB4JeawXM5XvYoytHWg,1853 +thinc/tests/test_indexing.py,sha256=xjtc1amcbr5sJU9ABcUpw72PRELk7efMP2oHPj5EJp0,1962 +thinc/tests/test_initializers.py,sha256=5zpaIU47iNjcQ_cKT8TynYEsQrNWOLUAipQViUmQ29s,1026 +thinc/tests/test_loss.py,sha256=GXHNfPltcot7OsUUEvJUwj8ueDabWrTEKC2Hh9nG-iI,12415 +thinc/tests/test_optimizers.py,sha256=mEOvG7NBSoe8TX9F7bs0q-FlA48_DgZWl6i3VHqPPvM,3148 +thinc/tests/test_schedules.py,sha256=Zkx4WHXp4Rzdxv_pRrj3KQTxWM9lsa4ascHelmXlTyQ,1773 +thinc/tests/test_serialize.py,sha256=-VGnpB6YPBFR0YcoDIxUi83VOGNb7hZ7Ss5Z3Gjgkrk,6997 +thinc/tests/test_types.py,sha256=W3FpWYbLbm435c5Ogpf3cLX0IHaU_b540CZOQAI-6SA,1597 +thinc/tests/test_util.py,sha256=QoSWWTmbjuYTBgiDk2L1gWY9ec4U8BAYUI_JT5jL_gs,5812 +thinc/tests/util.py,sha256=YEfSIneLivmxDFT4zAJ--P8Oxh9eQNML_DKVZA8DZSE,3721 +thinc/types.py,sha256=sFPpyfNVvphFNY9GVtSKY2Z6VWIzccXBQr4OWG4Up6c,49961 +thinc/util.py,sha256=Rpgzr8P4parsOpaDDXGzqgom9UiIpqH9Qh3P-upKWa8,22078 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..10ac2c23843796b65786bc9aba179a906c8bcc88 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: false +Tag: cp312-cp312-win_amd64 + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..46233c8ba78b78987d584e02897ea9925c711671 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[pytest_randomly.random_seeder] +thinc = thinc.api:fix_random_seed diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f5d8ac53fa942723f36dcef5981ce86147a2bf5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc-8.3.10.dist-info/top_level.txt @@ -0,0 +1 @@ +thinc diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/__init__.pxd b/TTS/Kokoro/.venv/Lib/site-packages/thinc/__init__.pxd new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..47f30d900d9c886ace86b66ffe13e4c88f4961ee --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/__init__.py @@ -0,0 +1,12 @@ +# Necessary for some side-effects in Cython. Not sure I understand. +import numpy + +from .about import __version__ +from .config import registry + +# fmt: off +__all__ = [ + "registry", + "__version__", +] +# fmt: on diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/about.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/about.py new file mode 100644 index 0000000000000000000000000000000000000000..5d9c8ab8584f11710516a8b817d7878f7d37f17b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/about.py @@ -0,0 +1,2 @@ +__version__ = "8.3.10" +__release__ = True diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/api.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/api.py new file mode 100644 index 0000000000000000000000000000000000000000..103294a308afdf57a03cf1bca596c630533e8fde --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/api.py @@ -0,0 +1,228 @@ +from .backends import ( + CupyOps, + MPSOps, + NumpyOps, + Ops, + get_current_ops, + get_ops, + set_current_ops, + set_gpu_allocator, + use_ops, + use_pytorch_for_gpu_memory, + use_tensorflow_for_gpu_memory, +) +from .compat import enable_mxnet, enable_tensorflow, has_cupy +from .config import Config, ConfigValidationError, registry +from .initializers import ( + configure_normal_init, + glorot_uniform_init, + normal_init, + uniform_init, + zero_init, +) +from .layers import ( + LSTM, + CauchySimilarity, + ClippedLinear, + Dish, + Dropout, + Embed, + Gelu, + HardSigmoid, + HardSwish, + HardSwishMobilenet, + HardTanh, + HashEmbed, + LayerNorm, + Linear, + Logistic, + Maxout, + Mish, + MultiSoftmax, + MXNetWrapper, + ParametricAttention, + ParametricAttention_v2, + PyTorchLSTM, + PyTorchRNNWrapper, + PyTorchWrapper, + PyTorchWrapper_v2, + PyTorchWrapper_v3, + Relu, + ReluK, + Sigmoid, + Softmax, + Softmax_v2, + SparseLinear, + SparseLinear_v2, + Swish, + TensorFlowWrapper, + TorchScriptWrapper_v1, + add, + array_getitem, + bidirectional, + chain, + clone, + concatenate, + expand_window, + keras_subclass, + list2array, + list2padded, + list2ragged, + map_list, + noop, + padded2list, + premap_ids, + pytorch_to_torchscript_wrapper, + ragged2list, + reduce_first, + reduce_last, + reduce_max, + reduce_mean, + reduce_sum, + remap_ids, + remap_ids_v2, + residual, + resizable, + siamese, + sigmoid_activation, + softmax_activation, + strings2arrays, + tuplify, + uniqued, + with_array, + with_array2d, + with_cpu, + with_debug, + with_flatten, + with_flatten_v2, + with_getitem, + with_list, + with_nvtx_range, + with_padded, + with_ragged, + with_reshape, + with_signpost_interval, +) +from .loss import ( + CategoricalCrossentropy, + CosineDistance, + L2Distance, + SequenceCategoricalCrossentropy, +) +from .model import ( + Model, + change_attr_values, + deserialize_attr, + serialize_attr, + set_dropout_rate, + wrap_model_recursive, +) +from .optimizers import SGD, Adam, Optimizer, RAdam +from .schedules import ( + compounding, + constant, + constant_then, + cyclic_triangular, + decaying, + slanted_triangular, + warmup_linear, +) +from .shims import ( + MXNetShim, + PyTorchGradScaler, + PyTorchShim, + Shim, + TensorFlowShim, + TorchScriptShim, + keras_model_fns, + maybe_handshake_model, +) +from .types import ArgsKwargs, Padded, Ragged, Unserializable +from .util import ( + DataValidationError, + data_validation, + fix_random_seed, + get_array_module, + get_torch_default_device, + get_width, + is_cupy_array, + mxnet2xp, + prefer_gpu, + require_cpu, + require_gpu, + set_active_gpu, + tensorflow2xp, + to_categorical, + to_numpy, + torch2xp, + xp2mxnet, + xp2tensorflow, + xp2torch, +) + +# fmt: off +__all__ = [ + # .config + "Config", "registry", "ConfigValidationError", + # .initializers + "normal_init", "uniform_init", "glorot_uniform_init", "zero_init", + "configure_normal_init", + # .loss + "CategoricalCrossentropy", "L2Distance", "CosineDistance", + "SequenceCategoricalCrossentropy", + # .model + "Model", "serialize_attr", "deserialize_attr", + "set_dropout_rate", "change_attr_values", "wrap_model_recursive", + # .shims + "Shim", "PyTorchGradScaler", "PyTorchShim", "TensorFlowShim", "keras_model_fns", + "MXNetShim", "TorchScriptShim", "maybe_handshake_model", + # .optimizers + "Adam", "RAdam", "SGD", "Optimizer", + # .schedules + "cyclic_triangular", "warmup_linear", "constant", "constant_then", + "decaying", "slanted_triangular", "compounding", + # .types + "Ragged", "Padded", "ArgsKwargs", "Unserializable", + # .util + "fix_random_seed", "is_cupy_array", "set_active_gpu", + "prefer_gpu", "require_gpu", "require_cpu", + "DataValidationError", "data_validation", + "to_categorical", "get_width", "get_array_module", "to_numpy", + "torch2xp", "xp2torch", "tensorflow2xp", "xp2tensorflow", "mxnet2xp", "xp2mxnet", + "get_torch_default_device", + # .compat + "enable_mxnet", + "enable_tensorflow", + "has_cupy", + # .backends + "get_ops", "set_current_ops", "get_current_ops", "use_ops", + "Ops", "CupyOps", "MPSOps", "NumpyOps", "set_gpu_allocator", + "use_pytorch_for_gpu_memory", "use_tensorflow_for_gpu_memory", + # .layers + "Dropout", "Embed", "expand_window", "HashEmbed", "LayerNorm", "Linear", + "Maxout", "Mish", "MultiSoftmax", "Relu", "softmax_activation", "Softmax", "LSTM", + "CauchySimilarity", "ParametricAttention", "Logistic", + "resizable", "sigmoid_activation", "Sigmoid", "SparseLinear", + "ClippedLinear", "ReluK", "HardTanh", "HardSigmoid", + "Dish", "HardSwish", "HardSwishMobilenet", "Swish", "Gelu", + "PyTorchWrapper", "PyTorchRNNWrapper", "PyTorchLSTM", + "TensorFlowWrapper", "keras_subclass", "MXNetWrapper", + "PyTorchWrapper_v2", "Softmax_v2", "PyTorchWrapper_v3", + "SparseLinear_v2", "TorchScriptWrapper_v1", "ParametricAttention_v2", + + "add", "bidirectional", "chain", "clone", "concatenate", "noop", + "residual", "uniqued", "siamese", "list2ragged", "ragged2list", + "map_list", + "with_array", "with_array2d", + "with_padded", "with_list", "with_ragged", "with_flatten", + "with_reshape", "with_getitem", "strings2arrays", "list2array", + "list2ragged", "ragged2list", "list2padded", "padded2list", + "remap_ids", "remap_ids_v2", "premap_ids", + "array_getitem", "with_cpu", "with_debug", "with_nvtx_range", + "with_signpost_interval", + "tuplify", "with_flatten_v2", + "pytorch_to_torchscript_wrapper", + + "reduce_first", "reduce_last", "reduce_max", "reduce_mean", "reduce_sum", +] +# fmt: on diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/compat.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/compat.py new file mode 100644 index 0000000000000000000000000000000000000000..6dbaeba164d3d2689fc39b746f9d34d0a7711deb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/compat.py @@ -0,0 +1,123 @@ +import warnings + +from packaging.version import Version + +try: # pragma: no cover + import cupy + import cupy.cublas + import cupyx + + has_cupy = True + cublas = cupy.cublas + cupy_version = Version(cupy.__version__) + try: + cupy.cuda.runtime.getDeviceCount() + has_cupy_gpu = True + except cupy.cuda.runtime.CUDARuntimeError: + has_cupy_gpu = False + + if cupy_version.major >= 10: + # fromDlpack was deprecated in v10.0.0. + cupy_from_dlpack = cupy.from_dlpack + else: + cupy_from_dlpack = cupy.fromDlpack +except (ImportError, AttributeError): + cublas = None + cupy = None + cupyx = None + cupy_version = Version("0.0.0") + has_cupy = False + cupy_from_dlpack = None + has_cupy_gpu = False + + +try: # pragma: no cover + import torch + import torch.utils.dlpack + + has_torch = True + has_torch_cuda_gpu = torch.cuda.device_count() != 0 + has_torch_mps = hasattr(torch.backends, "mps") and torch.backends.mps.is_built() + has_torch_mps_gpu = has_torch_mps and torch.backends.mps.is_available() + has_torch_gpu = has_torch_cuda_gpu + torch_version = Version(str(torch.__version__)) + has_torch_amp = ( + torch_version >= Version("1.9.0") + and not torch.cuda.amp.common.amp_definitely_not_available() + ) +except ImportError: # pragma: no cover + torch = None # type: ignore + has_torch = False + has_torch_cuda_gpu = False + has_torch_gpu = False + has_torch_mps = False + has_torch_mps_gpu = False + has_torch_amp = False + torch_version = Version("0.0.0") + + +def enable_tensorflow(): + warn_msg = ( + "Built-in TensorFlow support will be removed in Thinc v9. If you need " + "TensorFlow support in the future, you can transition to using a " + "custom copy of the current TensorFlowWrapper in your package or " + "project." + ) + warnings.warn(warn_msg, DeprecationWarning) + global tensorflow, has_tensorflow, has_tensorflow_gpu + import tensorflow + import tensorflow.experimental.dlpack + + has_tensorflow = True + has_tensorflow_gpu = len(tensorflow.config.get_visible_devices("GPU")) > 0 + + +tensorflow = None +has_tensorflow = False +has_tensorflow_gpu = False + + +def enable_mxnet(): + warn_msg = ( + "Built-in MXNet support will be removed in Thinc v9. If you need " + "MXNet support in the future, you can transition to using a " + "custom copy of the current MXNetWrapper in your package or " + "project." + ) + warnings.warn(warn_msg, DeprecationWarning) + global mxnet, has_mxnet + import mxnet + + has_mxnet = True + + +mxnet = None +has_mxnet = False + + +try: + import h5py +except ImportError: # pragma: no cover + h5py = None + + +try: # pragma: no cover + import os_signpost + + has_os_signpost = True +except ImportError: + os_signpost = None + has_os_signpost = False + + +has_gpu = has_cupy_gpu or has_torch_mps_gpu + +__all__ = [ + "cupy", + "cupyx", + "torch", + "tensorflow", + "mxnet", + "h5py", + "os_signpost", +] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/config.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/config.py new file mode 100644 index 0000000000000000000000000000000000000000..8f84b81ae9a85fcae9bd674e66f0eed0218da494 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/config.py @@ -0,0 +1,30 @@ +import catalogue +import confection +from confection import VARIABLE_RE, Config, ConfigValidationError, Promise + +from .types import Decorator + + +class registry(confection.registry): + # fmt: off + optimizers: Decorator = catalogue.create("thinc", "optimizers", entry_points=True) + schedules: Decorator = catalogue.create("thinc", "schedules", entry_points=True) + layers: Decorator = catalogue.create("thinc", "layers", entry_points=True) + losses: Decorator = catalogue.create("thinc", "losses", entry_points=True) + initializers: Decorator = catalogue.create("thinc", "initializers", entry_points=True) + datasets: Decorator = catalogue.create("thinc", "datasets", entry_points=True) + ops: Decorator = catalogue.create("thinc", "ops", entry_points=True) + # fmt: on + + @classmethod + def create(cls, registry_name: str, entry_points: bool = False) -> None: + """Create a new custom registry.""" + if hasattr(cls, registry_name): + raise ValueError(f"Registry '{registry_name}' already exists") + reg: Decorator = catalogue.create( + "thinc", registry_name, entry_points=entry_points + ) + setattr(cls, registry_name, reg) + + +__all__ = ["Config", "registry", "ConfigValidationError", "Promise", "VARIABLE_RE"] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/initializers.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/initializers.py new file mode 100644 index 0000000000000000000000000000000000000000..56a32046b51f76598aecdae80d87fb5927f6523f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/initializers.py @@ -0,0 +1,123 @@ +from typing import Callable, cast + +import numpy + +from .backends import Ops +from .config import registry +from .types import FloatsXd, Shape +from .util import partial + +# TODO: Harmonize naming with Keras, and fill in missing entries +# https://keras.io/initializers/ We should also have He normal/uniform +# and probably lecun normal/uniform. + +# Initialize via numpy, before copying to ops. This makes it easier to work with +# the different backends, because the backend won't affect the randomization. + + +def lecun_normal_init(ops: Ops, shape: Shape) -> FloatsXd: + scale = numpy.sqrt(1.0 / shape[1]) + return ops.asarray_f(cast(FloatsXd, numpy.random.normal(0, scale, shape))) + + +@registry.initializers("lecun_normal_init.v1") +def configure_lecun_normal_init() -> Callable[[Shape], FloatsXd]: + return partial(lecun_normal_init) + + +def he_normal_init(ops: Ops, shape: Shape) -> FloatsXd: + scale = numpy.sqrt(2.0 / shape[1]) + return ops.asarray_f(cast(FloatsXd, numpy.random.normal(0, scale, shape))) + + +@registry.initializers("he_normal_init.v1") +def configure_he_normal_init() -> Callable[[Shape], FloatsXd]: + return partial(he_normal_init) + + +def glorot_normal_init(ops: Ops, shape: Shape) -> FloatsXd: + scale = numpy.sqrt(2.0 / (shape[1] + shape[0])) + return ops.asarray_f(cast(FloatsXd, numpy.random.normal(0, scale, shape))) + + +@registry.initializers("glorot_normal_init.v1") +def configure_glorot_normal_init() -> Callable[[Shape], FloatsXd]: + return partial(glorot_normal_init) + + +def he_uniform_init(ops: Ops, shape: Shape) -> FloatsXd: + scale = numpy.sqrt(6.0 / shape[1]) + return ops.asarray_f(cast(FloatsXd, numpy.random.uniform(-scale, scale, shape))) + + +@registry.initializers("he_uniform_init.v1") +def configure_he_uniform_init() -> Callable[[Shape], FloatsXd]: + return partial(he_uniform_init) + + +def lecun_uniform_init(ops: Ops, shape: Shape) -> FloatsXd: + scale = numpy.sqrt(3.0 / shape[1]) + return ops.asarray_f(cast(FloatsXd, numpy.random.uniform(-scale, scale, shape))) + + +@registry.initializers("lecun_uniform_init.v1") +def configure_lecun_uniform_init() -> Callable[[Shape], FloatsXd]: + return partial(lecun_uniform_init) + + +def glorot_uniform_init(ops: Ops, shape: Shape) -> FloatsXd: + scale = numpy.sqrt(6.0 / (shape[0] + shape[1])) + return ops.asarray_f(cast(FloatsXd, numpy.random.uniform(-scale, scale, shape))) + + +@registry.initializers("glorot_uniform_init.v1") +def configure_glorot_uniform_init() -> Callable[[Shape], FloatsXd]: + return partial(glorot_uniform_init) + + +def zero_init(ops: Ops, shape: Shape) -> FloatsXd: + return ops.alloc_f(shape) + + +@registry.initializers("zero_init.v1") +def configure_zero_init() -> Callable[[FloatsXd], FloatsXd]: + return partial(zero_init) + + +def uniform_init( + ops: Ops, shape: Shape, *, lo: float = -0.1, hi: float = 0.1 +) -> FloatsXd: + values = numpy.random.uniform(lo, hi, shape) + return ops.asarray_f(cast(FloatsXd, values.astype("float32"))) + + +@registry.initializers("uniform_init.v1") +def configure_uniform_init( + *, lo: float = -0.1, hi: float = 0.1 +) -> Callable[[FloatsXd], FloatsXd]: + return partial(uniform_init, lo=lo, hi=hi) + + +def normal_init(ops: Ops, shape: Shape, *, mean: float = 0) -> FloatsXd: + size = int(ops.xp.prod(ops.xp.asarray(shape))) + inits = cast(FloatsXd, numpy.random.normal(scale=mean, size=size).astype("float32")) + inits = ops.reshape_f(inits, shape) + return ops.asarray_f(inits) + + +@registry.initializers("normal_init.v1") +def configure_normal_init(*, mean: float = 0) -> Callable[[FloatsXd], FloatsXd]: + return partial(normal_init, mean=mean) + + +__all__ = [ + "normal_init", + "uniform_init", + "glorot_uniform_init", + "zero_init", + "lecun_uniform_init", + "he_uniform_init", + "glorot_normal_init", + "he_normal_init", + "lecun_normal_init", +] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/loss.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/loss.py new file mode 100644 index 0000000000000000000000000000000000000000..c58e2347435c9be3f52a0c28d37ffc50e26ab233 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/loss.py @@ -0,0 +1,439 @@ +from abc import abstractmethod +from typing import ( + Any, + Dict, + Generic, + List, + Optional, + Sequence, + Tuple, + TypeVar, + Union, + cast, +) + +from .config import registry +from .types import Floats2d, Ints1d +from .util import get_array_module, to_categorical + +LossT = TypeVar("LossT") +GradT = TypeVar("GradT") +GuessT = TypeVar("GuessT") +TruthT = TypeVar("TruthT") +IntsOrFloats = Union[Ints1d, Floats2d] +IntsOrFloatsOrStrs = Union[Ints1d, Floats2d, Sequence[int], Sequence[str]] + + +class Loss(Generic[GuessT, TruthT, GradT, LossT]): # pragma: no cover + """Base class for classes computing the loss / gradient. The class can + be initialized with settings if needed. It provides get_loss and + get_grad as separate methods to allow calculating them separately. It + also provides a __call__ method that returns a tuple of both. + """ + + def __init__(self, **kwargs: Any) -> None: + ... + + def __call__(self, guesses: GuessT, truths: TruthT) -> Tuple[GradT, LossT]: + return self.get_grad(guesses, truths), self.get_loss(guesses, truths) + + @abstractmethod + def get_grad(self, guesses: GuessT, truths: TruthT) -> GradT: + ... + + @abstractmethod + def get_loss(self, guesses: GuessT, truths: TruthT) -> LossT: + ... + + +class CategoricalCrossentropy(Loss): + names: Optional[Sequence[str]] + missing_value: Optional[Union[str, int]] + _name_to_i: Dict[str, int] + + def __init__( + self, + *, + normalize: bool = True, + names: Optional[Sequence[str]] = None, + missing_value: Optional[Union[str, int]] = None, + neg_prefix: Optional[str] = None, + label_smoothing: float = 0.0, + ): + self.normalize = normalize + self.names = names + self.missing_value = missing_value + self.neg_prefix = neg_prefix + self.label_smoothing = label_smoothing + if names is not None: + self._name_to_i = {name: i for i, name in enumerate(names)} + else: + self._name_to_i = {} + + def convert_truths(self, truths, guesses: Floats2d) -> Tuple[Floats2d, Floats2d]: + xp = get_array_module(guesses) + missing = [] + negatives_mask = None + if self.names: + negatives_mask = xp.ones((len(truths), len(self.names)), dtype="f") + missing_value = self.missing_value + # Convert list of ints or list of strings + if isinstance(truths, list): + truths = list(truths) + if len(truths): + if isinstance(truths[0], int): + for i, value in enumerate(truths): + if value == missing_value: + missing.append(i) + else: + if self.names is None: + msg = ( + "Cannot calculate loss from list of strings without names. " + "You can pass the names as a keyword argument when you " + "create the loss object, " + "e.g. CategoricalCrossentropy(names=['dog', 'cat'])" + ) + raise ValueError(msg) + for i, value in enumerate(truths): + if value == missing_value: + truths[i] = self.names[0] + missing.append(i) + elif ( + value + and self.neg_prefix + and value.startswith(self.neg_prefix) + ): + truths[i] = value[len(self.neg_prefix) :] + neg_index = self._name_to_i[truths[i]] + negatives_mask[i] = 0 # type: ignore + negatives_mask[i][neg_index] = -1 # type: ignore + truths = [self._name_to_i[name] for name in truths] + truths = xp.asarray(truths, dtype="i") + mask = _make_mask(guesses, missing) + else: + mask = _make_mask_by_value(truths, guesses, missing_value) + if truths.ndim != guesses.ndim: + # transform categorical values to one-hot encoding + truths = to_categorical( + cast(Ints1d, truths), + n_classes=guesses.shape[-1], + label_smoothing=self.label_smoothing, + ) + else: + if self.label_smoothing: + raise ValueError( + "Label smoothing is only applied, when truths have type " + "List[str], List[int] or Ints1d, but it seems like Floats2d " + "was provided." + ) + # Transform negative annotations to a 0 for the negated value + # + mask all other values for that row + if negatives_mask is not None: + truths *= negatives_mask + truths[truths == -1] = 0 + negatives_mask[negatives_mask == -1] = 1 + mask *= negatives_mask + return truths, mask + + def __call__( + self, guesses: Floats2d, truths: IntsOrFloatsOrStrs + ) -> Tuple[Floats2d, float]: + d_truth = self.get_grad(guesses, truths) + return (d_truth, self._get_loss_from_grad(d_truth)) + + def get_grad(self, guesses: Floats2d, truths: IntsOrFloatsOrStrs) -> Floats2d: + target, mask = self.convert_truths(truths, guesses) + xp = get_array_module(target) + if guesses.shape != target.shape: # pragma: no cover + err = f"Cannot calculate CategoricalCrossentropy loss: mismatched shapes: {guesses.shape} vs {target.shape}." + raise ValueError(err) + if xp.any(guesses > 1) or xp.any(guesses < 0): # pragma: no cover + err = f"Cannot calculate CategoricalCrossentropy loss with guesses outside the [0,1] interval." + raise ValueError(err) + if xp.any(target > 1) or xp.any(target < 0): # pragma: no cover + err = f"Cannot calculate CategoricalCrossentropy loss with truth values outside the [0,1] interval." + raise ValueError(err) + difference = guesses - target + difference *= mask + if self.normalize: + difference = difference / guesses.shape[0] + return difference + + def get_loss(self, guesses: Floats2d, truths: IntsOrFloatsOrStrs) -> float: + d_truth = self.get_grad(guesses, truths) + return self._get_loss_from_grad(d_truth) + + def _get_loss_from_grad(self, d_truth: Floats2d) -> float: + # TODO: Add overload for axis=None case to sum + return (d_truth**2).sum() # type: ignore + + +@registry.losses("CategoricalCrossentropy.v1") +def configure_CategoricalCrossentropy_v1( + *, + normalize: bool = True, + names: Optional[Sequence[str]] = None, + missing_value: Optional[Union[str, int]] = None, +) -> CategoricalCrossentropy: + return CategoricalCrossentropy( + normalize=normalize, names=names, missing_value=missing_value + ) + + +@registry.losses("CategoricalCrossentropy.v2") +def configure_CategoricalCrossentropy_v2( + *, + normalize: bool = True, + names: Optional[Sequence[str]] = None, + missing_value: Optional[Union[str, int]] = None, + neg_prefix: Optional[str] = None, +) -> CategoricalCrossentropy: + return CategoricalCrossentropy( + normalize=normalize, + names=names, + missing_value=missing_value, + neg_prefix=neg_prefix, + ) + + +@registry.losses("CategoricalCrossentropy.v3") +def configure_CategoricalCrossentropy_v3( + *, + normalize: bool = True, + names: Optional[Sequence[str]] = None, + missing_value: Optional[Union[str, int]] = None, + neg_prefix: Optional[str] = None, + label_smoothing: float = 0.0, +) -> CategoricalCrossentropy: + return CategoricalCrossentropy( + normalize=normalize, + names=names, + missing_value=missing_value, + neg_prefix=neg_prefix, + label_smoothing=label_smoothing, + ) + + +class SequenceCategoricalCrossentropy(Loss): + def __init__( + self, + *, + normalize: bool = True, + names: Optional[Sequence[str]] = None, + missing_value: Optional[Union[str, int]] = None, + neg_prefix: Optional[str] = None, + label_smoothing: float = 0.0, + ): + self.cc = CategoricalCrossentropy( + normalize=False, + names=names, + missing_value=missing_value, + neg_prefix=neg_prefix, + label_smoothing=label_smoothing, + ) + self.normalize = normalize + + def __call__( + self, guesses: Sequence[Floats2d], truths: Sequence[IntsOrFloatsOrStrs] + ) -> Tuple[List[Floats2d], float]: + grads = self.get_grad(guesses, truths) + loss = self._get_loss_from_grad(grads) + return grads, loss + + def get_grad( + self, guesses: Sequence[Floats2d], truths: Sequence[IntsOrFloatsOrStrs] + ) -> List[Floats2d]: + err = "Cannot calculate SequenceCategoricalCrossentropy loss: guesses and truths must be same length" + if len(guesses) != len(truths): # pragma: no cover + raise ValueError(err) + n = len(guesses) + d_scores = [] + for yh, y in zip(guesses, truths): + d_yh = self.cc.get_grad(yh, y) + if self.normalize: + d_yh /= n + d_scores.append(d_yh) + return d_scores + + def get_loss( + self, guesses: Sequence[Floats2d], truths: Sequence[IntsOrFloatsOrStrs] + ) -> float: + return self._get_loss_from_grad(self.get_grad(guesses, truths)) + + def _get_loss_from_grad(self, grads: Sequence[Floats2d]) -> float: + loss = 0.0 + for grad in grads: + loss += self.cc._get_loss_from_grad(grad) + return loss + + +@registry.losses("SequenceCategoricalCrossentropy.v1") +def configure_SequenceCategoricalCrossentropy_v1( + *, normalize: bool = True, names: Optional[Sequence[str]] = None +) -> SequenceCategoricalCrossentropy: + return SequenceCategoricalCrossentropy(normalize=normalize, names=names) + + +@registry.losses("SequenceCategoricalCrossentropy.v2") +def configure_SequenceCategoricalCrossentropy_v2( + *, + normalize: bool = True, + names: Optional[Sequence[str]] = None, + neg_prefix: Optional[str] = None, +) -> SequenceCategoricalCrossentropy: + return SequenceCategoricalCrossentropy( + normalize=normalize, names=names, neg_prefix=neg_prefix + ) + + +@registry.losses("SequenceCategoricalCrossentropy.v3") +def configure_SequenceCategoricalCrossentropy_v3( + *, + normalize: bool = True, + names: Optional[Sequence[str]] = None, + missing_value: Optional[Union[str, int]] = None, + neg_prefix: Optional[str] = None, + label_smoothing: float = 0.0, +) -> SequenceCategoricalCrossentropy: + return SequenceCategoricalCrossentropy( + normalize=normalize, + names=names, + missing_value=missing_value, + neg_prefix=neg_prefix, + label_smoothing=label_smoothing, + ) + + +class L2Distance(Loss): + def __init__(self, *, normalize: bool = True): + self.normalize = normalize + + def __call__(self, guesses: Floats2d, truths: Floats2d) -> Tuple[Floats2d, float]: + return self.get_grad(guesses, truths), self.get_loss(guesses, truths) + + def get_grad(self, guesses: Floats2d, truths: Floats2d) -> Floats2d: + if guesses.shape != truths.shape: # pragma: no cover + err = f"Cannot calculate L2 distance: mismatched shapes: {guesses.shape} vs {truths.shape}." + raise ValueError(err) + difference = guesses - truths + if self.normalize: + difference = difference / guesses.shape[0] + return difference + + def get_loss(self, guesses: Floats2d, truths: Floats2d) -> float: + if guesses.shape != truths.shape: # pragma: no cover + err = f"Cannot calculate L2 distance: mismatched shapes: {guesses.shape} vs {truths.shape}." + raise ValueError(err) + d_truth = self.get_grad(guesses, truths) + # TODO: Add overload for axis=None case to sum + return (d_truth**2).sum() # type: ignore + + +@registry.losses("L2Distance.v1") +def configure_L2Distance(*, normalize: bool = True) -> L2Distance: + return L2Distance(normalize=normalize) + + +class CosineDistance(Loss): + def __init__(self, *, normalize: bool = True, ignore_zeros: bool = False): + self.normalize = normalize + self.ignore_zeros = ignore_zeros + + def __call__(self, guesses: Floats2d, truths: Floats2d) -> Tuple[Floats2d, float]: + return self.get_grad(guesses, truths), self.get_loss(guesses, truths) + + def get_similarity(self, guesses: Floats2d, truths: Floats2d) -> float: + if guesses.shape != truths.shape: # pragma: no cover + err = f"Cannot calculate cosine similarity: mismatched shapes: {guesses.shape} vs {truths.shape}." + raise ValueError(err) + + xp = get_array_module(guesses) + # Add a small constant to avoid 0 vectors + yh = guesses + 1e-8 + y = truths + 1e-8 + norm_yh = xp.linalg.norm(yh, axis=1, keepdims=True) + norm_y = xp.linalg.norm(y, axis=1, keepdims=True) + mul_norms = norm_yh * norm_y + cosine = (yh * y).sum(axis=1, keepdims=True) / mul_norms + return cosine + + def get_grad(self, guesses: Floats2d, truths: Floats2d) -> Floats2d: + if guesses.shape != truths.shape: # pragma: no cover + err = f"Cannot calculate cosine similarity: mismatched shapes: {guesses.shape} vs {truths.shape}." + raise ValueError(err) + + # Note: not using get_distance() here to avoid duplicating certain calculations + xp = get_array_module(guesses) + # Find the zero vectors + if self.ignore_zeros: + zero_indices = xp.abs(truths).sum(axis=1) == 0 + # Add a small constant to avoid 0 vectors + yh = guesses + 1e-8 + y = truths + 1e-8 + # https://math.stackexchange.com/questions/1923613/partial-derivative-of-cosinesimilarity + norm_yh = xp.linalg.norm(yh, axis=1, keepdims=True) + norm_y = xp.linalg.norm(y, axis=1, keepdims=True) + mul_norms = norm_yh * norm_y + cosine = (yh * y).sum(axis=1, keepdims=True) / mul_norms + d_yh = (y / mul_norms) - (cosine * (yh / norm_yh**2)) + if self.ignore_zeros: + # If the target was a zero vector, don't count it in the loss. + d_yh[zero_indices] = 0 + if self.normalize: + d_yh = d_yh / guesses.shape[0] + return -d_yh + + def get_loss(self, guesses: Floats2d, truths: Floats2d) -> float: + if guesses.shape != truths.shape: # pragma: no cover + err = f"Cannot calculate cosine similarity: mismatched shapes: {guesses.shape} vs {truths.shape}." + raise ValueError(err) + + xp = get_array_module(guesses) + cosine = self.get_similarity(guesses, truths) + losses = xp.abs(cosine - 1) + if self.ignore_zeros: + # If the target was a zero vector, don't count it in the loss. + zero_indices = xp.abs(truths).sum(axis=1) == 0 + losses[zero_indices] = 0 + if self.normalize: + losses = losses / guesses.shape[0] + loss = losses.sum() + return loss + + +@registry.losses("CosineDistance.v1") +def configure_CosineDistance( + *, normalize: bool = True, ignore_zeros: bool = False +) -> CosineDistance: + return CosineDistance(normalize=normalize, ignore_zeros=ignore_zeros) + + +def _make_mask(guesses, missing) -> Floats2d: + xp = get_array_module(guesses) + mask = xp.ones(guesses.shape, dtype="f") + mask[missing] = 0 + return mask + + +def _make_mask_by_value(truths, guesses, missing_value) -> Floats2d: + xp = get_array_module(guesses) + mask = xp.ones(guesses.shape, dtype="f") + + if missing_value is not None: + if truths.ndim == 1: + mask[truths == missing_value] = 0.0 + else: + # In 2D truths, labels are encoded as one-hot vectors, so we can get + # the label indices using argmax. + labels = xp.argmax(truths, axis=-1) + mask[labels == missing_value] = 0.0 + + return mask + + +__all__ = [ + "SequenceCategoricalCrossentropy", + "CategoricalCrossentropy", + "L2Distance", + "CosineDistance", +] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/model.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/model.py new file mode 100644 index 0000000000000000000000000000000000000000..1498c3bde5c4b2068d08ba216de7db67390eecb0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/model.py @@ -0,0 +1,895 @@ +import contextlib +import copy +import functools +import threading +from contextvars import ContextVar +from pathlib import Path +from typing import ( + Any, + Callable, + Dict, + Generic, + Iterable, + Iterator, + List, + Optional, + Sequence, + Set, + Tuple, + TypeVar, + Union, + cast, +) + +import srsly + +from .backends import CupyOps, NumpyOps, Ops, ParamServer, get_current_ops +from .optimizers import Optimizer # noqa: F401 +from .shims import Shim +from .types import FloatsXd +from .util import ( + DATA_VALIDATION, + convert_recursive, + is_xp_array, + partial, + validate_fwd_input_output, +) + +InT = TypeVar("InT") +OutT = TypeVar("OutT") +SelfT = TypeVar("SelfT", bound="Model") + +context_operators: ContextVar[dict] = ContextVar("context_operators", default={}) + + +def empty_init(model: "Model", *args, **kwargs) -> "Model": + return model + + +class Model(Generic[InT, OutT]): + """Class for implementing Thinc models and layers.""" + + global_id: int = 0 + global_id_lock: threading.Lock = threading.Lock() + _context_operators = context_operators + + name: str + ops: Ops + id: int + _func: Callable + init: Callable + _params: ParamServer + _dims: Dict[str, Optional[int]] + _layers: List["Model"] + _shims: List[Shim] + _attrs: Dict[str, Any] + _has_params: Dict[str, Optional[bool]] + + # This "locks" the class, so we get an error if you try to assign to + # an unexpected variable. + __slots__ = [ + "name", + "id", + "ops", + "_func", + "init", + "_params", + "_dims", + "_attrs", + "_refs", + "_layers", + "_shims", + "_has_params", + ] + + def __init__( + self, + name: str, + forward: Callable, + *, + init: Optional[Callable] = None, + dims: Dict[str, Optional[int]] = {}, + params: Dict[str, Optional[FloatsXd]] = {}, + layers: Sequence["Model"] = [], + shims: List[Shim] = [], + attrs: Dict[str, Any] = {}, + refs: Dict[str, Optional["Model"]] = {}, + ops: Optional[Union[NumpyOps, CupyOps]] = None, + ): + """Initialize a new model.""" + self.name = name + if init is None: + init = partial(empty_init, self) + # Assign to callable attrs: https://github.com/python/mypy/issues/2427 + setattr(self, "_func", forward) + setattr(self, "init", init) + self.ops = ops if ops is not None else get_current_ops() + self._params = ParamServer() + self._dims = dict(dims) + self._attrs = dict(attrs) + self._refs = dict(refs) + self._layers = list(layers) + self._shims = list(shims) + # Take care to increment the base class here! It needs to be unique + # across all models. + with Model.global_id_lock: + Model.global_id += 1 + self.id = Model.global_id + self._has_params = {} + for name, value in params.items(): + self._has_params[name] = None + if value is not None: + self.set_param(name, value) + + @property + def layers(self) -> List["Model"]: + """A list of child layers of the model. You can append to it to add + layers but not reassign it. + """ + return self._layers + + @property + def shims(self) -> List[Shim]: + return self._shims + + @property + def attrs(self) -> Dict[str, Any]: + """A dict of the model's attrs. You can write to it to update attrs but + not reassign it. + """ + return self._attrs + + @property + def param_names(self) -> Tuple[str, ...]: + """Get the names of registered parameter (including unset).""" + return tuple(self._has_params.keys()) + + @property + def grad_names(self) -> Tuple[str, ...]: + """Get the names of parameters with registered gradients (including unset).""" + return tuple([name for name in self.param_names if self.has_grad(name)]) + + @property + def dim_names(self) -> Tuple[str, ...]: + """Get the names of registered dimensions (including unset).""" + return tuple(self._dims.keys()) + + @property + def ref_names(self) -> Tuple[str, ...]: + """Get the names of registered node references (including unset).""" + return tuple(self._refs.keys()) + + @classmethod + @contextlib.contextmanager + def define_operators(cls, operators: Dict[str, Callable]): + """Bind arbitrary binary functions to Python operators, for use in any + `Model` instance. Can (and should) be used as a contextmanager. + + EXAMPLE: + with Model.define_operators({">>": chain}): + model = Relu(512) >> Relu(512) >> Softmax() + """ + token = cls._context_operators.set(dict(operators)) + yield + cls._context_operators.reset(token) + + def has_dim(self, name: str) -> Optional[bool]: + """Check whether the model has a dimension of a given name. If the + dimension is registered but the value is unset, returns None. + """ + if name not in self._dims: + return False + elif self._dims[name] is not None: + return True + else: + return None + + def get_dim(self, name: str) -> int: + """Retrieve the value of a dimension of the given name.""" + if name not in self._dims: + raise KeyError(f"Cannot get dimension '{name}' for model '{self.name}'") + value = self._dims[name] + if value is None: + err = f"Cannot get dimension '{name}' for model '{self.name}': value unset" + raise ValueError(err) + else: + return value + + def set_dim(self, name: str, value: int, *, force: bool = False) -> None: + """Set a value for a dimension.""" + if name not in self._dims: + raise KeyError( + f"Cannot set unknown dimension '{name}' for model '{self.name}'." + ) + old_value = self._dims[name] + has_params = any(bool(y) for x, y in self._has_params.items()) + invalid_change = (old_value is not None and old_value != value) and ( + not force or force and has_params + ) + if invalid_change: + err = f"Attempt to change dimension '{name}' for model '{self.name}' from {old_value} to {value}" + raise ValueError(err) + self._dims[name] = value + + def maybe_get_dim(self, name: str) -> Optional[int]: + """Retrieve the value of a dimension of the given name, or None.""" + return self.get_dim(name) if self.has_dim(name) else None + + def has_param(self, name: str) -> Optional[bool]: + """Check whether the model has a weights parameter of the given name. + + Returns None if the parameter is registered but currently unset. + """ + if name not in self._has_params: + return False + elif self._has_params[name] is not None: + return True + else: + return None + + def get_param(self, name: str) -> FloatsXd: + """Retrieve a weights parameter by name.""" + if name not in self._has_params: + raise KeyError(f"Unknown param: '{name}' for model '{self.name}'.") + if not self._params.has_param(self.id, name): + raise KeyError( + f"Parameter '{name}' for model '{self.name}' has not been allocated yet." + ) + return self._params.get_param(self.id, name) + + def maybe_get_param(self, name: str) -> Optional[FloatsXd]: + """Retrieve a weights parameter by name, or None.""" + return self.get_param(name) if self.has_param(name) else None + + def set_param(self, name: str, value: Optional[FloatsXd]) -> None: + """Set a weights parameter's value.""" + if value is None: + self._has_params[name] = None + else: + self._params.set_param(self.id, name, value) + self._has_params[name] = True + + def has_grad(self, name: str) -> bool: + """Check whether the model has a non-zero gradient for a parameter.""" + return self._params.has_grad(self.id, name) + + def get_grad(self, name: str) -> FloatsXd: + """Get a gradient from the model.""" + return self._params.get_grad(self.id, name) + + def set_grad(self, name: str, value: FloatsXd) -> None: + """Set a gradient value for the model.""" + self._params.set_grad(self.id, name, value) + + def maybe_get_grad(self, name: str) -> Optional[FloatsXd]: + """Retrieve a gradient by name, or None.""" + return self.get_grad(name) if self.has_grad(name) else None + + def inc_grad(self, name: str, value: FloatsXd) -> None: + """Increment the gradient of a parameter by a value.""" + self._params.inc_grad(self.id, name, value) + + def has_ref(self, name: str) -> Optional[bool]: + """Check whether the model has a reference of a given name. If the + reference is registered but the value is unset, returns None. + """ + if name not in self._refs: + return False + elif self._refs[name] is not None: + return True + else: + return None + + def get_ref(self, name: str) -> "Model": + """Retrieve the value of a reference of the given name.""" + if name not in self._refs: + raise KeyError(f"Cannot get reference '{name}' for model '{self.name}'.") + value = self._refs[name] + if value is None: + err = f"Cannot get reference '{name}' for model '{self.name}': value unset." + raise ValueError(err) + else: + return value + + def maybe_get_ref(self, name: str) -> Optional["Model"]: + """Retrieve the value of a reference if it exists, or None.""" + return self.get_ref(name) if self.has_ref(name) else None + + def set_ref(self, name: str, value: Optional["Model"]) -> None: + """Set a value for a reference.""" + if value is None: + self._refs[name] = value + elif value in self.walk(): + self._refs[name] = value + else: + raise ValueError("Cannot add reference to node not in tree.") + + def __call__(self, X: InT, is_train: bool) -> Tuple[OutT, Callable]: + """Call the model's `forward` function, returning the output and a + callback to compute the gradients via backpropagation.""" + return self._func(self, X, is_train=is_train) + + def initialize(self, X: Optional[InT] = None, Y: Optional[OutT] = None) -> "Model": + """Finish initialization of the model, optionally providing a batch of + example input and output data to perform shape inference.""" + if DATA_VALIDATION.get(): + validate_fwd_input_output(self.name, self._func, X, Y) + if self.init is not None: + self.init(self, X=X, Y=Y) + return self + + def begin_update(self, X: InT) -> Tuple[OutT, Callable[[OutT], InT]]: + """Run the model over a batch of data, returning the output and a + callback to complete the backward pass. A tuple (Y, finish_update), + where Y is a batch of output data, and finish_update is a callback that + takes the gradient with respect to the output and an optimizer function, + and returns the gradient with respect to the input. + """ + return self._func(self, X, is_train=True) + + def predict(self, X: InT) -> OutT: + """Call the model's `forward` function with `is_train=False`, and return + only the output, instead of the `(output, callback)` tuple. + """ + return self._func(self, X, is_train=False)[0] + + def finish_update(self, optimizer: Optimizer) -> None: + """Update parameters with current gradients. The optimizer is called + with each parameter and gradient of the model. + """ + for node in self.walk(): + for shim in node.shims: + shim.finish_update(optimizer) + for node in self.walk(): + for name in node.param_names: + if node.has_grad(name): + param, grad = optimizer( + (node.id, name), node.get_param(name), node.get_grad(name) + ) + node.set_param(name, param) + + @contextlib.contextmanager + def use_params(self, params: Dict[Tuple[int, str], FloatsXd]): + """Context manager to temporarily set the model's parameters to + specified values. The params are a dictionary keyed by model IDs, whose + values are arrays of weight values. + """ + backup = {} + for name in self.param_names: + key = (self.id, name) + if key in params: + backup[name] = self.get_param(name) + self.set_param(name, params[key]) + + with contextlib.ExitStack() as stack: + for layer in self.layers: + stack.enter_context(layer.use_params(params)) + for shim in self.shims: + stack.enter_context(shim.use_params(params)) + yield + if backup: + for name, param in backup.items(): + self.set_param(name, param) + + def walk(self, *, order: str = "bfs") -> Iterable["Model"]: + """Iterate out layers of the model. + + Nodes are returned in breadth-first order by default. Other possible + orders are "dfs_pre" (depth-first search in preorder) and "dfs_post" + (depth-first search in postorder).""" + if order == "bfs": + return self._walk_bfs() + elif order == "dfs_pre": + return self._walk_dfs(post_order=False) + elif order == "dfs_post": + return self._walk_dfs(post_order=True) + else: + raise ValueError("Invalid order, must be one of: bfs, dfs_pre, dfs_post") + + def _walk_bfs(self) -> Iterable["Model"]: + """Iterate out layers of the model, breadth-first.""" + queue = [self] + seen: Set[int] = set() + for node in queue: + if id(node) in seen: + continue + seen.add(id(node)) + yield node + queue.extend(node.layers) + + def _walk_dfs(self, post_order: bool = False) -> Iterable["Model"]: + """Iterate out layers of the model, depth-first.""" + seen: Dict[int, Iterator["Model"]] = dict() + stack = [self] + seen[id(self)] = iter(self.layers) + if not post_order: + yield self + + while stack: + try: + next_child = next(seen[id(stack[-1])]) + if not id(next_child) in seen: + if not post_order: + yield next_child + + stack.append(next_child) + seen[id(next_child)] = iter(next_child.layers) + except StopIteration: + if post_order: + yield stack[-1] + stack.pop() + + def remove_node(self, node: "Model") -> None: + """Remove a node from all layers lists, and then update references. + References that no longer point to a node within the tree will be set + to `None`. For instance, let's say a node has its grandchild as a reference. + If the child is removed, the grandchild reference will be left dangling, + so will be set to None. + """ + for child in list(self.walk()): + while node in child.layers: + child.layers.remove(node) + tree = set(self.walk()) + for node in tree: + for name in node.ref_names: + ref = node.get_ref(name) + if ref is not None and ref not in tree: + node.set_ref(name, None) + + def replace_callbacks( + self, forward: Callable, *, init: Optional[Callable] = None + ) -> None: + setattr(self, "_func", forward) + setattr(self, "init", init) + + def replace_node(self, old: "Model", new: "Model") -> bool: + """Replace a node anywhere it occurs within the model. Returns a boolean + indicating whether the replacement was made.""" + seen = False + + # We need to replace nodes in topological order of the transposed graph + # to ensure that a node's dependencies are processed before the node. + # This is equivalent to a post-order traversal of the original graph. + for node in list(self.walk(order="dfs_post")): + if node is old: + seen = True + else: + node._layers = [ + new if layer is old else layer for layer in node._layers + ] + for name in node.ref_names: + if node.get_ref(name) is old: + node.set_ref(name, new) + + return seen + + def get_gradients(self) -> Dict[Tuple[int, str], Tuple[FloatsXd, FloatsXd]]: + """Get non-zero gradients of the model's parameters, as a dictionary + keyed by the parameter ID. The values are (weights, gradients) tuples. + """ + gradients = {} + for node in self.walk(): + for name in node.grad_names: + param = node.get_param(name) + grad = node.get_grad(name) + gradients[(node.id, name)] = (param, grad) + return gradients + + def copy(self: SelfT) -> SelfT: + """ + Create a copy of the model, its attributes, and its parameters. Any child + layers will also be deep-copied. The copy will receive a distinct `model.id` + value. + """ + return self._copy() + + def _copy( + self: SelfT, seen: Optional[Dict[int, Union["Model", Shim]]] = None + ) -> SelfT: + if seen is None: + seen = {} + params = {} + for name in self.param_names: + params[name] = self.get_param(name) if self.has_param(name) else None + + copied_layers: List[Model] = [] + for layer in self.layers: + if id(layer) in seen: + copied_layers.append(cast(Model, seen[id(layer)])) + else: + copied_layer = layer._copy(seen) + seen[id(layer)] = copied_layer + copied_layers.append(copied_layer) + + copied_shims = [] + for shim in self.shims: + if id(shim) in seen: + copied_shims.append(cast(Shim, seen[id(shim)])) + else: + copied_shim = shim.copy() + seen[id(shim)] = copied_shim + copied_shims.append(copied_shim) + + copied: Model[InT, OutT] = Model( + self.name, + self._func, + init=self.init, + params=copy.deepcopy(params), + dims=copy.deepcopy(self._dims), + attrs=copy.deepcopy(self._attrs), + layers=copied_layers, + shims=copied_shims, + ) + for name in self.grad_names: + copied.set_grad(name, self.get_grad(name).copy()) + return cast(SelfT, copied) + + def to_gpu(self, gpu_id: int) -> None: # pragma: no cover + """Transfer the model to a given GPU device.""" + import cupy.cuda.device + + with cupy.cuda.device.Device(gpu_id): + self._to_ops(CupyOps()) + + def to_cpu(self) -> None: # pragma: no cover + """Transfer the model to CPU.""" + self._to_ops(NumpyOps()) + + def _to_ops(self, ops: Ops) -> None: # pragma: no cover + """Common method for to_cpu/to_gpu.""" + for node in self.walk(): + node.ops = ops + for name in node.param_names: + if node.has_param(name): + node.set_param(name, ops.asarray_f(node.get_param(name))) + if node.has_grad(name): + node.set_grad(name, ops.asarray_f(node.get_grad(name))) + for shim in node.shims: + shim.to_device(ops.device_type, ops.device_id) + + def to_bytes(self) -> bytes: + """Serialize the model to a bytes representation. Models are usually + serialized using msgpack, so you should be able to call msgpack.loads() + on the data and get back a dictionary with the contents. + + Serialization should round-trip identically, i.e. the same bytes should + result from loading and serializing a model. + """ + msg = self.to_dict() + to_numpy_le = partial(self.ops.to_numpy, byte_order="<") + msg = convert_recursive(is_xp_array, to_numpy_le, msg) + return srsly.msgpack_dumps(msg) + + def to_disk(self, path: Union[Path, str]) -> None: + """Serialize the model to disk. Most models will serialize to a single + file, which should just be the bytes contents of model.to_bytes(). + """ + path = Path(path) if isinstance(path, str) else path + with path.open("wb") as file_: + file_.write(self.to_bytes()) + + def to_dict(self) -> Dict: + """Serialize the model to a dict representation. + + Serialization should round-trip identically, i.e. the same dict should + result from loading and serializing a model. + """ + # We separate out like this to make it easier to read the data in chunks. + # The shims might have large weights, while the nodes data will be + # small. The attrs are probably not very large, but could be. + # The lists are aligned, and refer to the order of self.walk(). + msg: Dict[str, List] = {"nodes": [], "attrs": [], "params": [], "shims": []} + nodes = list(self.walk()) + # Serialize references by their index into the flattened tree. + # This is the main reason we can't accept out-of-tree references: + # we'd have no way to serialize/deserialize them. + node_to_i: Dict[int, Optional[int]] + node_to_i = {node.id: i for i, node in enumerate(nodes)} + for i, node in enumerate(nodes): + refs: Dict[str, Optional[int]] = {} + invalid_refs: List[str] = [] + for name in node.ref_names: + if not node.has_ref(name): + refs[name] = None + else: + ref = node.get_ref(name) + if ref.id in node_to_i: + refs[name] = node_to_i[ref.id] + else: + invalid_refs.append(name) + if invalid_refs: + raise ValueError(f"Cannot get references: {invalid_refs}") + dims = {} + for dim in node.dim_names: + dims[dim] = node.get_dim(dim) if node.has_dim(dim) else None + msg["nodes"].append( + {"index": i, "name": node.name, "dims": dims, "refs": refs} + ) + for node in nodes: + attrs = {} + for name, value in node.attrs.items(): + try: + attrs[name] = serialize_attr(value, value, name, node) + except TypeError: + continue + msg["attrs"].append(attrs) + for node in nodes: + msg["shims"].append([shim.to_bytes() for shim in node.shims]) + for node in nodes: + params: Dict[str, Optional[FloatsXd]] = {} + for name in node.param_names: + if node.has_param(name): + params[name] = cast(Optional[FloatsXd], node.get_param(name)) + else: + params[name] = None + msg["params"].append(params) + return msg + + def from_bytes(self, bytes_data: bytes) -> "Model": + """Deserialize the model from a bytes representation. Models are usually + serialized using msgpack, so you should be able to call msgpack.loads() + on the data and get back a dictionary with the contents. + + Serialization should round-trip identically, i.e. the same bytes should + result from loading and serializing a model. + """ + msg = srsly.msgpack_loads(bytes_data) + msg = convert_recursive(is_xp_array, self.ops.asarray, msg) + return self.from_dict(msg) + + def from_disk(self, path: Union[Path, str]) -> "Model": + """Deserialize the model from disk. Most models will serialize to a single + file, which should just be the bytes contents of model.to_bytes(). + """ + path = Path(path) if isinstance(path, str) else path + with path.open("rb") as file_: + bytes_data = file_.read() + return self.from_bytes(bytes_data) + + def from_dict(self, msg: Dict) -> "Model": + if "nodes" not in msg.keys(): # pragma: no cover + err = "Trying to read a Model that was created with an incompatible version of Thinc" + raise ValueError(err) + nodes = list(self.walk()) + if len(msg["nodes"]) != len(nodes): + raise ValueError("Cannot deserialize model: mismatched structure") + for i, node in enumerate(nodes): + info = msg["nodes"][i] + node.name = info["name"] + for dim, value in info["dims"].items(): + if value is not None: + node.set_dim(dim, value) + for ref, ref_index in info["refs"].items(): + if ref_index is None: + node.set_ref(ref, None) + else: + node.set_ref(ref, nodes[ref_index]) + for attr, value in msg["attrs"][i].items(): + default_value = node.attrs.get(attr) + loaded_value = deserialize_attr(default_value, value, attr, node) + node.attrs[attr] = loaded_value + for param_name, value in msg["params"][i].items(): + if value is not None: + value = node.ops.asarray(value).copy() + node.set_param(param_name, value) + for i, shim_bytes in enumerate(msg["shims"][i]): + node.shims[i].from_bytes(shim_bytes) + return self + + def can_from_disk(self, path: Union[Path, str], *, strict: bool = True) -> bool: + """Check whether serialized data on disk is compatible with the model. + If 'strict', the function returns False if the model has an attribute + already loaded that would be changed. + """ + path = Path(path) if isinstance(path, str) else path + if path.is_dir() or not path.exists(): + return False + with path.open("rb") as file_: + bytes_data = file_.read() + return self.can_from_bytes(bytes_data, strict=strict) + + def can_from_bytes(self, bytes_data: bytes, *, strict: bool = True) -> bool: + """Check whether the bytes data is compatible with the model. If 'strict', + the function returns False if the model has an attribute already loaded + that would be changed. + """ + try: + msg = srsly.msgpack_loads(bytes_data) + except ValueError: + return False + return self.can_from_dict(msg, strict=strict) + + def can_from_dict(self, msg: Dict, *, strict: bool = True) -> bool: + """Check whether a dictionary is compatible with the model. + If 'strict', the function returns False if the model has an attribute + already loaded that would be changed. + """ + if "nodes" not in msg.keys(): + return False + nodes = list(self.walk()) + if len(msg["nodes"]) != len(nodes): + return False + + for i, node in enumerate(nodes): + info = msg["nodes"][i] + if strict and info["name"] != node.name: + return False + if len(msg["shims"][i]) != len(node.shims): + # TODO: The shims should have a check for this too, but + # for now we just check if the lengths match. + return False + for dim, value in info["dims"].items(): + has_dim = node.has_dim(dim) + if has_dim is False: + return False + elif has_dim and node.get_dim(dim) != value: + return False + for param_name, value in msg["params"][i].items(): + has_param = node.has_param(param_name) + if has_param is False: + return False + elif has_param and value is not None: + param = node.get_param(param_name) + if param.shape != value.shape: + return False + if strict: + for attr, value in msg["attrs"][i].items(): + if attr in node.attrs: + try: + + serialized = serialize_attr( + node.attrs[attr], node.attrs[attr], attr, node + ) + except TypeError: + continue + if serialized != value: + return False + return True + + def __add__(self, other: Any) -> "Model": + """Apply the function bound to the '+' operator.""" + if "+" not in self._context_operators.get(): + raise TypeError("Undefined operator: +") + return self._context_operators.get()["+"](self, other) + + def __sub__(self, other: Any) -> "Model": + """Apply the function bound to the '-' operator.""" + if "-" not in self._context_operators.get(): + raise TypeError("Undefined operator: -") + return self._context_operators.get()["-"](self, other) + + def __mul__(self, other: Any) -> "Model": + """Apply the function bound to the '*' operator.""" + if "*" not in self._context_operators.get(): + raise TypeError("Undefined operator: *") + return self._context_operators.get()["*"](self, other) + + def __matmul__(self, other: Any) -> "Model": + """Apply the function bound to the '@' operator.""" + if "@" not in self._context_operators.get(): + raise TypeError("Undefined operator: @") + return self._context_operators.get()["@"](self, other) + + def __div__(self, other: Any) -> "Model": # pragma: no cover + """Apply the function bound to the '/' operator.""" + if "/" not in self._context_operators.get(): + raise TypeError("Undefined operator: /") + return self._context_operators.get()["/"](self, other) + + def __truediv__(self, other: Any) -> "Model": + """Apply the function bound to the '/' operator.""" + if "/" not in self._context_operators.get(): + raise TypeError("Undefined operator: /") + return self._context_operators.get()["/"](self, other) + + def __floordiv__(self, other: Any) -> "Model": + """Apply the function bound to the '//' operator.""" + if "//" not in self._context_operators.get(): + raise TypeError("Undefined operator: //") + return self._context_operators.get()["//"](self, other) + + def __mod__(self, other: Any) -> "Model": + """Apply the function bound to the '%' operator.""" + if "%" not in self._context_operators.get(): + raise TypeError("Undefined operator: %") + return self._context_operators.get()["%"](self, other) + + def __pow__(self, other: Any, **kwargs) -> "Model": + """Apply the function bound to the '**' operator.""" + if "**" not in self._context_operators.get(): + raise TypeError("Undefined operator: **") + return self._context_operators.get()["**"](self, other) + + def __lshift__(self, other: Any) -> "Model": + """Apply the function bound to the '<<' operator.""" + if "<<" not in self._context_operators.get(): + raise TypeError("Undefined operator: <<") + return self._context_operators.get()["<<"](self, other) + + def __rshift__(self, other: Any) -> "Model": + """Apply the function bound to the '>>' operator.""" + if ">>" not in self._context_operators.get(): + raise TypeError("Undefined operator: >>") + return self._context_operators.get()[">>"](self, other) + + def __and__(self, other: Any) -> "Model": + """Apply the function bound to the '&' operator.""" + if "&" not in self._context_operators.get(): + raise TypeError("Undefined operator: &") + return self._context_operators.get()["&"](self, other) + + def __xor__(self, other: Any) -> "Model": + """Apply the function bound to the '^' operator.""" + if "^" not in self._context_operators.get(): + raise TypeError("Undefined operator: ^") + return self._context_operators.get()["^"](self, other) + + def __or__(self, other: Any) -> "Model": + """Apply the function bound to the '|' operator.""" + if "|" not in self._context_operators.get(): + raise TypeError("Undefined operator: |") + return self._context_operators.get()["|"](self, other) + + +@functools.singledispatch +def serialize_attr(_: Any, value: Any, name: str, model: Model) -> bytes: + """Serialize an attribute value (defaults to msgpack). You can register + custom serializers using the @serialize_attr.register decorator with the + type to serialize, e.g.: @serialize_attr.register(MyCustomObject). + """ + return srsly.msgpack_dumps(value) + + +@functools.singledispatch +def deserialize_attr(_: Any, value: Any, name: str, model: Model) -> Any: + """Deserialize an attribute value (defaults to msgpack). You can register + custom deserializers using the @deserialize_attr.register decorator with the + type to deserialize, e.g.: @deserialize_attr.register(MyCustomObject). + """ + return srsly.msgpack_loads(value) + + +_ModelT = TypeVar("_ModelT", bound=Model) + + +def change_attr_values(model: _ModelT, mapping: Dict[str, Dict[str, Any]]) -> _ModelT: + """Walk over the model's nodes, changing the value of attributes using the + provided mapping, which maps node names to attr names to attr values. + """ + for node in model.walk(): + if node.name in mapping: + attrs = mapping[node.name] + for attr, value in attrs.items(): + if attr in node.attrs: + node.attrs[attr] = value + return model + + +def set_dropout_rate(model: _ModelT, drop: float, attrs=["dropout_rate"]) -> _ModelT: + """Walk over the model's nodes, setting the dropout rate. You can specify + one or more attribute names, by default it looks for ["dropout_rate"]. + """ + for node in model.walk(): + for attr in attrs: + if attr in node.attrs: + node.attrs[attr] = drop + return model + + +def wrap_model_recursive(model: Model, wrapper: Callable[[Model], _ModelT]) -> _ModelT: + """Recursively wrap a model and its submodules. The model is updated + in-place.""" + for node in list(model.walk()): + model.replace_node(node, wrapper(node)) + + return wrapper(model) + + +__all__ = [ + "Model", + "serialize_attr", + "deserialize_attr", + "change_attr_values", + "set_dropout_rate", + "wrap_model_recursive", +] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/mypy.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/mypy.py new file mode 100644 index 0000000000000000000000000000000000000000..cf0b760f6c40ce2276cde0d0ee197c9b5a8c31fd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/mypy.py @@ -0,0 +1,266 @@ +import itertools +from typing import Dict, List + +from mypy.checker import TypeChecker +from mypy.errorcodes import ErrorCode +from mypy.errors import Errors +from mypy.nodes import CallExpr, Decorator, Expression, FuncDef, MypyFile, NameExpr +from mypy.options import Options +from mypy.plugin import CheckerPluginInterface, FunctionContext, Plugin +from mypy.subtypes import is_subtype +from mypy.types import CallableType, Instance, Type, TypeVarType + +thinc_model_fullname = "thinc.model.Model" +chained_out_fullname = "thinc.types.XY_YZ_OutT" +intoin_outtoout_out_fullname = "thinc.types.XY_XY_OutT" + + +def plugin(version: str): + return ThincPlugin + + +class ThincPlugin(Plugin): + def __init__(self, options: Options) -> None: + super().__init__(options) + + def get_function_hook(self, fullname: str): + return function_hook + + +def function_hook(ctx: FunctionContext) -> Type: + try: + return get_reducers_type(ctx) + except AssertionError: + # Add more function callbacks here + return ctx.default_return_type + + +def get_reducers_type(ctx: FunctionContext) -> Type: + """ + Determine a more specific model type for functions that combine models. + + This function operates on function *calls*. It analyzes each function call + by looking at the function definition and the arguments passed as part of + the function call, then determines a more specific return type for the + function call. + + This method accepts a `FunctionContext` as part of the Mypy plugin + interface. This function context provides easy access to: + * `args`: List of "actual arguments" filling each "formal argument" of the + called function. "Actual arguments" are those passed to the function + as part of the function call. "Formal arguments" are the parameters + defined by the function definition. The same actual argument may serve + to fill multiple formal arguments. In some cases the relationship may + even be ambiguous. For example, calling `range(*args)`, the actual + argument `*args` may fill the `start`, `stop` or `step` formal + arguments, depending on the length of the list. + + The `args` list is of length `num_formals`, with each element + corresponding to a formal argument. Each value in the `args` list is a + list of actual arguments which may fill the formal argument. For + example, in the function call `range(*args, num)`, `num` may fill the + `start`, `end` or `step` formal arguments depending on the length of + `args`, so type-checking needs to consider all of these possibilities. + * `arg_types`: Type annotation (or inferred type) of each argument. Like + `args`, this value is a list of lists with an outer list entry for each + formal argument and an inner list entry for each possible actual + argument for the formal argument. + * `arg_kinds`: "Kind" of argument passed to the function call. Argument + kinds include positional, star (`*args`), named (`x=y`) and star2 + (`**kwargs`) arguments (among others). Like `args`, this value is a list + of lists. + * `context`: AST node representing the function call with all available + type information. Notable attributes include: + * `args` and `arg_kinds`: Simple list of actual arguments, not mapped to + formal arguments. + * `callee`: AST node representing the function being called. Typically + this is a `NameExpr`. To resolve this node to the function definition + it references, accessing `callee.node` will usually return either a + `FuncDef` or `Decorator` node. + * etc. + + This function infers a more specific type for model-combining functions by + making certain assumptions about how the function operates based on the + order of its formal arguments and its return type. + + If the return type is `Model[InT, XY_YZ_OutT]`, the output of each + argument is expected to be used as the input to the next argument. It's + therefore necessary to check that the output type of each model is + compatible with the input type of the following model. The combined model + has the type `Model[InT, OutT]`, where `InT` is the input type of the + first model and `OutT` is the output type of the last model. + + If the return type is `Model[InT, XY_XY_OutT]`, all model arguments + receive input of the same type and are expected to produce output of the + same type. It's therefore necessary to check that all models have the same + input types and the same output types. The combined model has the type + `Model[InT, OutT]`, where `InT` is the input type of all model arguments + and `OutT` is the output type of all model arguments. + + Raises: + AssertionError: Raised if a more specific model type couldn't be + determined, indicating that the default general return type should + be used. + """ + # Verify that we have a type-checking API and a default return type (presumably a + # `thinc.model.Model` instance) + assert isinstance(ctx.api, TypeChecker) + assert isinstance(ctx.default_return_type, Instance) + + # Verify that we're inspecting a function call to a callable defined or decorated function + assert isinstance(ctx.context, CallExpr) + callee = ctx.context.callee + assert isinstance(callee, NameExpr) + callee_node = callee.node + assert isinstance(callee_node, (FuncDef, Decorator)) + callee_node_type = callee_node.type + assert isinstance(callee_node_type, CallableType) + + # Verify that the callable returns a `thinc.model.Model` + # TODO: Use `map_instance_to_supertype` to map subtypes to `Model` instances. + # (figure out how to look up the `TypeInfo` for a class outside of the module being type-checked) + callee_return_type = callee_node_type.ret_type + assert isinstance(callee_return_type, Instance) + assert callee_return_type.type.fullname == thinc_model_fullname + assert callee_return_type.args + assert len(callee_return_type.args) == 2 + + # Obtain the output type parameter of the `thinc.model.Model` return type + # of the called API function + out_type = callee_return_type.args[1] + + # Check if the `Model`'s output type parameter is one of the "special + # type variables" defined to represent model composition (chaining) and + # homogeneous reduction + assert isinstance(out_type, TypeVarType) + assert out_type.fullname + if out_type.fullname not in {intoin_outtoout_out_fullname, chained_out_fullname}: + return ctx.default_return_type + + # Extract type of each argument used to call the API function, making sure that they are also + # `thinc.model.Model` instances + args = list(itertools.chain(*ctx.args)) + arg_types = [] + for arg_type in itertools.chain(*ctx.arg_types): + # TODO: Use `map_instance_to_supertype` to map subtypes to `Model` instances. + assert isinstance(arg_type, Instance) + assert arg_type.type.fullname == thinc_model_fullname + assert len(arg_type.args) == 2 + arg_types.append(arg_type) + + # Collect neighboring pairs of arguments and their types + arg_pairs = list(zip(args[:-1], args[1:])) + arg_types_pairs = list(zip(arg_types[:-1], arg_types[1:])) + + # Determine if passed models will be chained or if they all need to have + # the same input and output type + if out_type.fullname == chained_out_fullname: + # Models will be chained, meaning that the output of each model will + # be passed as the input to the next model + # Verify that model inputs and outputs are compatible + for (arg1, arg2), (type1, type2) in zip(arg_pairs, arg_types_pairs): + assert isinstance(type1, Instance) + assert isinstance(type2, Instance) + assert type1.type.fullname == thinc_model_fullname + assert type2.type.fullname == thinc_model_fullname + check_chained( + l1_arg=arg1, l1_type=type1, l2_arg=arg2, l2_type=type2, api=ctx.api + ) + + # Generated model takes the first model's input and returns the last model's output + return Instance( + ctx.default_return_type.type, [arg_types[0].args[0], arg_types[-1].args[1]] + ) + elif out_type.fullname == intoin_outtoout_out_fullname: + # Models must have the same input and output types + # Verify that model inputs and outputs are compatible + for (arg1, arg2), (type1, type2) in zip(arg_pairs, arg_types_pairs): + assert isinstance(type1, Instance) + assert isinstance(type2, Instance) + assert type1.type.fullname == thinc_model_fullname + assert type2.type.fullname == thinc_model_fullname + check_intoin_outtoout( + l1_arg=arg1, l1_type=type1, l2_arg=arg2, l2_type=type2, api=ctx.api + ) + + # Generated model accepts and returns the same types as all passed models + return Instance( + ctx.default_return_type.type, [arg_types[0].args[0], arg_types[0].args[1]] + ) + + # Make sure the default return type is returned if no branch was selected + assert False, "Thinc mypy plugin error: it should return before this point" + + +def check_chained( + *, + l1_arg: Expression, + l1_type: Instance, + l2_arg: Expression, + l2_type: Instance, + api: CheckerPluginInterface, +): + if not is_subtype(l1_type.args[1], l2_type.args[0]): + api.fail( + f"Layer outputs type ({l1_type.args[1]}) but the next layer expects ({l2_type.args[0]}) as an input", + l1_arg, + code=error_layer_output, + ) + api.fail( + f"Layer input type ({l2_type.args[0]}) is not compatible with output ({l1_type.args[1]}) from previous layer", + l2_arg, + code=error_layer_input, + ) + + +def check_intoin_outtoout( + *, + l1_arg: Expression, + l1_type: Instance, + l2_arg: Expression, + l2_type: Instance, + api: CheckerPluginInterface, +): + if l1_type.args[0] != l2_type.args[0]: + api.fail( + f"Layer input ({l1_type.args[0]}) not compatible with next layer input ({l2_type.args[0]})", + l1_arg, + code=error_layer_input, + ) + api.fail( + f"Layer input ({l2_type.args[0]}) not compatible with previous layer input ({l1_type.args[0]})", + l2_arg, + code=error_layer_input, + ) + if l1_type.args[1] != l2_type.args[1]: + api.fail( + f"Layer output ({l1_type.args[1]}) not compatible with next layer output ({l2_type.args[1]})", + l1_arg, + code=error_layer_output, + ) + api.fail( + f"Layer output ({l2_type.args[1]}) not compatible with previous layer output ({l1_type.args[1]})", + l2_arg, + code=error_layer_output, + ) + + +error_layer_input = ErrorCode("layer-mismatch-input", "Invalid layer input", "Thinc") +error_layer_output = ErrorCode("layer-mismatch-output", "Invalid layer output", "Thinc") + + +class IntrospectChecker(TypeChecker): + def __init__( + self, + errors: Errors, + modules: Dict[str, MypyFile], + options: Options, + tree: MypyFile, + path: str, + plugin: Plugin, + per_line_checking_time_ns: Dict[int, int], + ): + self._error_messages: List[str] = [] + super().__init__( + errors, modules, options, tree, path, plugin, per_line_checking_time_ns + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/optimizers.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/optimizers.py new file mode 100644 index 0000000000000000000000000000000000000000..929e46c37fcfa802c52b2c94832f942e10c273cc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/optimizers.py @@ -0,0 +1,355 @@ +import math +from collections import defaultdict +from typing import Dict, List, Optional, Tuple, Union, cast + +from .backends import get_array_ops +from .config import registry +from .types import FloatsXd, Generator + +KeyT = Tuple[int, str] +FloatOrSeq = Union[float, List[float], Generator] +IntOrSeq = Union[int, List[int], Generator] + +SGD_DEFAULTS: Dict[str, Union[float, bool, int]] = { + "L2": 0.0, + "L2_is_weight_decay": True, + "grad_clip": 1.0, +} + + +ADAM_DEFAULTS: Dict[str, Union[float, bool, int]] = { + "learn_rate": 0.001, + "beta1": 0.9, + "beta2": 0.999, + "eps": 1e-08, + "L2": SGD_DEFAULTS["L2"], + "grad_clip": SGD_DEFAULTS["grad_clip"], + "L2_is_weight_decay": True, +} + + +@registry.optimizers("RAdam.v1") +def RAdam( + learn_rate: FloatOrSeq = ADAM_DEFAULTS["learn_rate"], + *, + beta1: FloatOrSeq = ADAM_DEFAULTS["beta1"], + beta2: FloatOrSeq = ADAM_DEFAULTS["beta2"], + eps: FloatOrSeq = ADAM_DEFAULTS["eps"], + L2: FloatOrSeq = ADAM_DEFAULTS["L2"], + L2_is_weight_decay: bool = cast(bool, ADAM_DEFAULTS["L2_is_weight_decay"]), + grad_clip: FloatOrSeq = ADAM_DEFAULTS["grad_clip"], + use_averages: bool = True, +): + return Optimizer( + learn_rate, + beta1=beta1, + beta2=beta2, + eps=eps, + grad_clip=grad_clip, + L2_is_weight_decay=L2_is_weight_decay, + L2=L2, + use_averages=use_averages, + use_radam=True, + ) + + +@registry.optimizers("Adam.v1") +def Adam( + learn_rate: FloatOrSeq = ADAM_DEFAULTS["learn_rate"], + *, + L2: FloatOrSeq = ADAM_DEFAULTS["L2"], + beta1: FloatOrSeq = ADAM_DEFAULTS["beta1"], + beta2: FloatOrSeq = ADAM_DEFAULTS["beta2"], + eps: FloatOrSeq = ADAM_DEFAULTS["eps"], + grad_clip: FloatOrSeq = ADAM_DEFAULTS["grad_clip"], + L2_is_weight_decay: bool = cast(bool, ADAM_DEFAULTS["L2_is_weight_decay"]), + use_averages: bool = True, +): + return Optimizer( + learn_rate, + L2=L2, + beta1=beta1, + beta2=beta2, + eps=eps, + grad_clip=grad_clip, + L2_is_weight_decay=L2_is_weight_decay, + use_averages=use_averages, + use_radam=False, + ) + + +@registry.optimizers("SGD.v1") +def SGD( + learn_rate: FloatOrSeq, + *, + L2: FloatOrSeq = SGD_DEFAULTS["L2"], + grad_clip: FloatOrSeq = SGD_DEFAULTS["grad_clip"], + L2_is_weight_decay: bool = cast(bool, SGD_DEFAULTS["L2_is_weight_decay"]), + use_averages: bool = True, +): + return Optimizer( + learn_rate, + L2=L2, + grad_clip=grad_clip, + L2_is_weight_decay=L2_is_weight_decay, + beta1=0.0, + beta2=0.0, + use_averages=use_averages, + ) + + +class Optimizer(object): + """Do various flavours of stochastic gradient descent, with first and + second order momentum. Currently support 'vanilla' SGD, Adam, and RAdam. + """ + + mom1: Dict[KeyT, FloatsXd] + mom2: Dict[KeyT, FloatsXd] + averages: Optional[Dict[KeyT, FloatsXd]] + schedules: Dict[str, Generator] + nr_update: Dict[KeyT, int] + last_seen: Dict[KeyT, int] + grad_clip: float + learn_rate: float + b1: float + b2: float + eps: float + L2: float + use_radam: bool + L2_is_weight_decay: bool + _radam_buffer: List[List[Optional[FloatsXd]]] + + # This "locks" the class, so we get an error if you try to assign to + # an unexpected variable. + __slots__ = [ + "mom1", + "mom2", + "averages", + "schedules", + "nr_update", + "last_seen", + "grad_clip", + "learn_rate", + "b1", + "b2", + "eps", + "L2", + "use_radam", + "L2_is_weight_decay", + "_radam_buffer", + ] + + def __init__( + self, + learn_rate: FloatOrSeq, + *, + L2: FloatOrSeq = ADAM_DEFAULTS["L2"], + beta1: FloatOrSeq = ADAM_DEFAULTS["beta1"], + beta2: FloatOrSeq = ADAM_DEFAULTS["beta2"], + eps: FloatOrSeq = ADAM_DEFAULTS["eps"], + grad_clip: FloatOrSeq = ADAM_DEFAULTS["grad_clip"], + use_averages: bool = True, + use_radam: bool = False, + L2_is_weight_decay: bool = True, + ): + """ + Initialize an optimizer. + + learn_rate (float): The initial learning rate. + L2 (float): The L2 regularization term. + beta1 (float): First-order momentum. + beta2 (float): Second-order momentum. + eps (float): Epsilon term for Adam etc. + grad_clip (float): Gradient clipping. + use_averages (bool): Whether to track moving averages of the parameters. + use_radam (bool): Whether to use the RAdam optimizer. + L2_is_weight_decay (bool): Whether to interpret the L2 parameter as a + weight decay term, in the style of the AdamW optimizer. + """ + self.mom1 = {} + self.mom2 = {} + if use_averages: + self.averages = {} + else: + self.averages = None + self.schedules = {} + self.nr_update = defaultdict(int) + self.last_seen = defaultdict(int) + self._set_attr_or_schedule("grad_clip", grad_clip) + self._set_attr_or_schedule("learn_rate", learn_rate) + self._set_attr_or_schedule("b1", beta1) + self._set_attr_or_schedule("b2", beta2) + self._set_attr_or_schedule("eps", eps) + self._set_attr_or_schedule("L2", L2) + self.use_radam = use_radam + self.L2_is_weight_decay = L2_is_weight_decay + self._radam_buffer = [[None, None, None] for _ in range(10)] + + def _set_attr_or_schedule(self, name, value): + if isinstance(value, (float, bool, int)): + setattr(self, name, value) + else: + if isinstance(value, list): + value = iter(value) + self.schedules[name] = value + try: + setattr(self, name, next(value)) + except (StopIteration, TypeError) as e: + err = f"Invalid schedule for '{name}' ({type(value)})\n{e}" + raise ValueError(err) + + def step_schedules(self): + for key, schedule in self.schedules.items(): + try: + value = next(schedule) + except StopIteration: # schedule exhausted, use last value + value = getattr(self, key) + setattr(self, key, value) + + def __call__( + self, + key: Tuple[int, str], + weights: FloatsXd, + gradient: FloatsXd, + *, + lr_scale: float = 1.0, + ): + """Call the optimizer with weights and a gradient. The key is the + identifier for the parameter, usually the node ID and parameter name. + """ + if len(gradient) < 1: + return weights, gradient + ops = get_array_ops(weights) + self.nr_update[key] += 1 + nr_upd = self.nr_update[key] + if self.L2 != 0 and not self.L2_is_weight_decay: + gradient += self.L2 * weights + if self.grad_clip: + gradient = ops.clip_gradient(gradient, self.grad_clip) + if self.use_radam: + weights, gradient = self._radam( + ops, weights, gradient, lr_scale, key, nr_upd + ) + elif self.b1 > 0.0 and self.b2 > 0.0: + weights, gradient = self._adam( + ops, weights, gradient, lr_scale, key, nr_upd + ) + elif self.b2 > 0.0: # pragma: no cover + raise NotImplementedError # TODO: error message + else: + weights -= lr_scale * self.learn_rate * gradient + gradient *= 0 + if self.L2 != 0 and self.L2_is_weight_decay: + weights -= lr_scale * self.learn_rate * self.L2 * weights + if self.averages is not None: + if key not in self.averages: + self.averages[key] = ops.alloc(weights.shape, dtype="float32") + ops.update_averages(self.averages[key], weights, nr_upd) + return weights, gradient + + def _radam(self, ops, weights, grad, lr_scale, key, nr_upd): + if key not in self.mom1: + self.mom1[key] = ops.alloc1f(weights.size) + if key not in self.mom2: + self.mom2[key] = ops.alloc1f(weights.size) + + weights_1D = ops.reshape1f(weights, weights.size) + gradient_1D = ops.reshape1f(grad, grad.size) + + # While we port from the pytorch implementation, keep some of the same + # naming + state = { + "step": self.nr_update[key], + "exp_avg": self.mom1[key], + "exp_avg_sq": self.mom2[key], + } + group = { + "lr": self.learn_rate, + "betas": [self.b1, self.b2], + "eps": self.eps, + "weight_decay": 0.0, + "buffer": self._radam_buffer, + } + degenerated_to_sgd = True + + exp_avg, exp_avg_sq = state["exp_avg"], state["exp_avg_sq"] + beta1, beta2 = group["betas"] + + # exp_avg_sq.mul_(beta2).addcmul_(1 - beta2, grad, grad) + exp_avg_sq *= beta2 + exp_avg_sq += (1 - beta2) * (gradient_1D**2) + # exp_avg.mul_(beta1).add_(1 - beta1, grad) + exp_avg *= beta1 + exp_avg += (1 - beta1) * gradient_1D + + state["step"] += 1 + buffered = group["buffer"][int(state["step"] % 10)] + if state["step"] == buffered[0]: + N_sma, step_size = buffered[1], buffered[2] + else: + buffered[0] = state["step"] + beta2_t = beta2 ** state["step"] + N_sma_max = 2 / (1 - beta2) - 1 + N_sma = N_sma_max - 2 * state["step"] * beta2_t / (1 - beta2_t) + buffered[1] = N_sma + + # more conservative since it's an approximated value + if N_sma >= 5: + step_size = math.sqrt( + (1 - beta2_t) + * (N_sma - 4) + / (N_sma_max - 4) + * (N_sma - 2) + / N_sma + * N_sma_max + / (N_sma_max - 2) + ) / (1 - beta1 ** state["step"]) + elif degenerated_to_sgd: + step_size = 1.0 / (1 - beta1 ** state["step"]) + else: + step_size = -1 + buffered[2] = step_size + + # more conservative since it's an approximated value + if N_sma >= 5: + if group["weight_decay"] != 0: + weights_1D += -group["weight_decay"] * group["lr"] * weights_1D + denom = ops.xp.sqrt(exp_avg_sq) + group["eps"] + weights_1D += -step_size * group["lr"] * (exp_avg / denom) + elif step_size > 0: + if group["weight_decay"] != 0: + weights_1D += -group["weight_decay"] * group["lr"] * weights_1D + weights_1D += -step_size * group["lr"] * exp_avg + return ( + ops.reshape_f(weights_1D, weights.shape), + ops.reshape_f(gradient_1D, grad.shape), + ) + + def _adam(self, ops, weights, gradient, lr_scale, key, nr_upd): + weights_1D = ops.reshape1f(weights, weights.size) + gradient_1D = ops.reshape1f(gradient, gradient.size) + if key not in self.mom1: + self.mom1[key] = ops.alloc1f(weights.size) + if key not in self.mom2: + self.mom2[key] = ops.alloc1f(weights.size) + mom1 = self.mom1[key] + mom2 = self.mom2[key] + b1 = self.b1 + b2 = self.b2 + fix1 = 1.0 - (b1**nr_upd) + fix2 = 1.0 - (b2**nr_upd) + lr = self.learn_rate * fix2**0.5 / fix1 + eps = self.eps + # needs to be 1D going into the adam function + weights_1D, gradient_1D, mom1, mom2 = ops.adam( + weights_1D, gradient_1D, mom1, mom2, b1, b2, eps, lr * lr_scale + ) + self.mom1[key] = mom1 + self.mom2[key] = mom2 + return ( + ops.reshape_f(weights_1D, weights.shape), + ops.reshape_f(gradient_1D, gradient.shape), + ) + + +__all__ = ["Adam", "RAdam", "SGD", "Optimizer", "ADAM_DEFAULTS", "SGD_DEFAULTS"] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/py.typed b/TTS/Kokoro/.venv/Lib/site-packages/thinc/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/schedules.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/schedules.py new file mode 100644 index 0000000000000000000000000000000000000000..dfb066a61abeb1e4b6392d7d1b76ecd9819cc8cf --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/schedules.py @@ -0,0 +1,132 @@ +"""Generators that provide different rates, schedules, decays or series.""" +from typing import Iterable + +import numpy + +from .config import registry + + +@registry.schedules("constant_then.v1") +def constant_then( + rate: float, steps: int, schedule: Iterable[float] +) -> Iterable[float]: + """Yield a constant rate for N steps, before starting a schedule.""" + for i in range(steps): + yield rate + for value in schedule: + yield value + + +@registry.schedules("constant.v1") +def constant(rate: float) -> Iterable[float]: + """Yield a constant rate.""" + while True: + yield rate + + +@registry.schedules("decaying.v1") +def decaying(base_rate: float, decay: float, *, t: int = 0) -> Iterable[float]: + """Yield an infinite series of linearly decaying values, + following the schedule: base_rate * 1 / (1 + decay * t) + + EXAMPLE: + >>> learn_rates = decaying(0.001, 1e-4) + >>> next(learn_rates) + 0.001 + >>> next(learn_rates) + 0.00999 + """ + while True: + yield base_rate * (1.0 / (1.0 + decay * t)) + t += 1 + + +@registry.schedules("compounding.v1") +def compounding( + start: float, stop: float, compound: float, *, t: float = 0.0 +) -> Iterable[float]: + """Yield an infinite series of compounding values. Each time the + generator is called, a value is produced by multiplying the previous + value by the compound rate. + + EXAMPLE: + >>> sizes = compounding(1.0, 10.0, 1.5) + >>> assert next(sizes) == 1. + >>> assert next(sizes) == 1 * 1.5 + >>> assert next(sizes) == 1.5 * 1.5 + """ + curr = float(start) + while True: + yield _clip(curr, start, stop) + curr *= compound + + +def _clip(value: float, start: float, stop: float) -> float: + return max(value, stop) if (start > stop) else min(value, stop) + + +@registry.schedules("slanted_triangular.v1") +def slanted_triangular( + max_rate: float, + num_steps: int, + *, + cut_frac: float = 0.1, + ratio: int = 32, + decay: float = 1.0, + t: float = 0.0, +) -> Iterable[float]: + """Yield an infinite series of values according to Howard and Ruder's + "slanted triangular learning rate" schedule. + """ + cut = int(num_steps * cut_frac) + while True: + t += 1 + if t < cut: + p = t / cut + else: + p = 1 - ((t - cut) / (cut * (1 / cut_frac - 1))) + learn_rate = max_rate * (1 + p * (ratio - 1)) * (1 / ratio) + yield learn_rate + + +@registry.schedules("warmup_linear.v1") +def warmup_linear( + initial_rate: float, warmup_steps: int, total_steps: int +) -> Iterable[float]: + """Generate a series, starting from an initial rate, and then with a warmup + period, and then a linear decline. Used for learning rates. + """ + step = 0 + while True: + if step < warmup_steps: + factor = step / max(1, warmup_steps) + else: + factor = max( + 0.0, (total_steps - step) / max(1.0, total_steps - warmup_steps) + ) + yield factor * initial_rate + step += 1 + + +@registry.schedules("cyclic_triangular.v1") +def cyclic_triangular(min_lr: float, max_lr: float, period: int) -> Iterable[float]: + it = 1 + while True: + # https://towardsdatascience.com/adaptive-and-cyclical-learning-rates-using-pytorch-2bf904d18dee + cycle = numpy.floor(1 + it / (2 * period)) + x = numpy.abs(it / period - 2 * cycle + 1) + relative = max(0, 1 - x) + yield min_lr + (max_lr - min_lr) * relative + it += 1 + + +__all__ = [ + "cyclic_triangular", + "warmup_linear", + "constant", + "constant_then", + "decaying", + "warmup_linear", + "slanted_triangular", + "compounding", +] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/types.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/types.py new file mode 100644 index 0000000000000000000000000000000000000000..68cb70fd07ea22298ab1fd15f85ab233907378d7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/types.py @@ -0,0 +1,1322 @@ +import sys +from abc import abstractmethod +from dataclasses import dataclass +from typing import ( + Any, + Callable, + Container, + Dict, + Generic, + Iterable, + Iterator, + List, + Optional, + Sequence, + Sized, + Tuple, + TypeVar, + Union, + cast, + overload, +) + +import numpy +from pydantic import GetCoreSchemaHandler +from pydantic_core import core_schema + +from .compat import cupy, has_cupy + +if has_cupy: + get_array_module = cupy.get_array_module +else: + get_array_module = lambda obj: numpy + +from typing import Literal, Protocol # noqa: F401 + +# fmt: off +XY_YZ_OutT = TypeVar("XY_YZ_OutT") +XY_XY_OutT = TypeVar("XY_XY_OutT") + +DeviceTypes = Literal["cpu", "gpu", "tpu"] +Batchable = Union["Pairs", "Ragged", "Padded", "ArrayXd", List, Tuple] +Xp = Union["numpy", "cupy"] # type: ignore +Shape = Tuple[int, ...] +DTypes = Literal["f", "i", "float16", "float32", "float64", "int32", "int64", "uint32", "uint64"] +DTypesFloat = Literal["f", "float32", "float16", "float64"] +DTypesInt = Literal["i", "int32", "int64", "uint32", "uint64"] + +Array1d = Union["Floats1d", "Ints1d"] +Array2d = Union["Floats2d", "Ints2d"] +Array3d = Union["Floats3d", "Ints3d"] +Array4d = Union["Floats4d", "Ints4d"] +FloatsXd = Union["Floats1d", "Floats2d", "Floats3d", "Floats4d"] +IntsXd = Union["Ints1d", "Ints2d", "Ints3d", "Ints4d"] +ArrayXd = Union[FloatsXd, IntsXd] +List1d = Union[List["Floats1d"], List["Ints1d"]] +List2d = Union[List["Floats2d"], List["Ints2d"]] +List3d = Union[List["Floats3d"], List["Ints3d"]] +List4d = Union[List["Floats4d"], List["Ints4d"]] +ListXd = Union[List1d, List2d, List3d, List4d] + +ArrayT = TypeVar("ArrayT") +SelfT = TypeVar("SelfT") +Array1dT = TypeVar("Array1dT", bound="Array1d") +FloatsXdT = TypeVar("FloatsXdT", "Floats1d", "Floats2d", "Floats3d", "Floats4d") + +# These all behave the same as far as indexing is concerned +Slicish = Union[slice, List[int], "ArrayXd"] +_1_KeyScalar = int +_1_Key1d = Slicish +_1_AllKeys = Union[_1_KeyScalar, _1_Key1d] +_F1_AllReturns = Union[float, "Floats1d"] +_I1_AllReturns = Union[int, "Ints1d"] + +_2_KeyScalar = Tuple[int, int] +_2_Key1d = Union[int, Tuple[Slicish, int], Tuple[int, Slicish]] +_2_Key2d = Union[Tuple[Slicish, Slicish], Slicish] +_2_AllKeys = Union[_2_KeyScalar, _2_Key1d, _2_Key2d] +_F2_AllReturns = Union[float, "Floats1d", "Floats2d"] +_I2_AllReturns = Union[int, "Ints1d", "Ints2d"] + +_3_KeyScalar = Tuple[int, int, int] +_3_Key1d = Union[Tuple[int, int], Tuple[int, int, Slicish], Tuple[int, Slicish, int], Tuple[Slicish, int, int]] +_3_Key2d = Union[int, Tuple[int, Slicish], Tuple[Slicish, int], Tuple[int, Slicish, Slicish], Tuple[Slicish, int, Slicish], Tuple[Slicish, Slicish, int]] +_3_Key3d = Union[Slicish, Tuple[Slicish, Slicish], Tuple[Slicish, Slicish, Slicish]] +_3_AllKeys = Union[_3_KeyScalar, _3_Key1d, _3_Key2d, _3_Key3d] +_F3_AllReturns = Union[float, "Floats1d", "Floats2d", "Floats3d"] +_I3_AllReturns = Union[int, "Ints1d", "Ints2d", "Ints3d"] + +_4_KeyScalar = Tuple[int, int, int, int] +_4_Key1d = Union[Tuple[int, int, int], Tuple[int, int, int, Slicish], Tuple[int, int, Slicish, int], Tuple[int, Slicish, int, int], Tuple[Slicish, int, int, int]] +_4_Key2d = Union[Tuple[int, int], Tuple[int, int, Slicish], Tuple[int, Slicish, int], Tuple[Slicish, int, int], Tuple[int, int, Slicish, Slicish], Tuple[int, Slicish, int, Slicish], Tuple[int, Slicish, Slicish, int], Tuple[Slicish, int, int, Slicish], Tuple[Slicish, int, Slicish, int], Tuple[Slicish, Slicish, int, int]] +_4_Key3d = Union[int, Tuple[int, Slicish], Tuple[Slicish, int], Tuple[int, Slicish, Slicish], Tuple[Slicish, int, Slicish], Tuple[Slicish, Slicish, int], Tuple[int, Slicish, Slicish, Slicish], Tuple[Slicish, int, Slicish, Slicish], Tuple[Slicish, Slicish, int, Slicish], Tuple[Slicish, Slicish, Slicish, int]] +_4_Key4d = Union[Slicish, Tuple[Slicish, Slicish], Tuple[Slicish, Slicish, Slicish], Tuple[Slicish, Slicish, Slicish, Slicish]] +_4_AllKeys = Union[_4_KeyScalar, _4_Key1d, _4_Key2d, _4_Key3d, _4_Key4d] +_F4_AllReturns = Union[float, "Floats1d", "Floats2d", "Floats3d", "Floats4d"] +_I4_AllReturns = Union[int, "Ints1d", "Ints2d", "Ints3d", "Ints4d"] + + +# Typedefs for the reduction methods. +Tru = Literal[True] +Fal = Literal[False] +OneAx = Union[int, Tuple[int]] +TwoAx = Tuple[int, int] +ThreeAx = Tuple[int, int, int] +FourAx = Tuple[int, int, int, int] +_1_AllAx = Optional[OneAx] +_2_AllAx = Union[Optional[TwoAx], OneAx] +_3_AllAx = Union[Optional[ThreeAx], TwoAx, OneAx] +_4_AllAx = Union[Optional[FourAx], ThreeAx, TwoAx, OneAx] +_1F_ReduceResults = Union[float, "Floats1d"] +_2F_ReduceResults = Union[float, "Floats1d", "Floats2d"] +_3F_ReduceResults = Union[float, "Floats1d", "Floats2d", "Floats3d"] +_4F_ReduceResults = Union[float, "Floats1d", "Floats2d", "Floats3d", "Floats4d"] +_1I_ReduceResults = Union[int, "Ints1d"] +_2I_ReduceResults = Union[int, "Ints1d", "Ints2d"] +_3I_ReduceResults = Union[int, "Ints1d", "Ints2d", "Ints3d"] +_4I_ReduceResults = Union[int, "Ints1d", "Ints2d", "Ints3d", "Ints4d"] + +# TODO: +# We need to get correct overloads in for the following reduction methods. +# The 'sum' reduction is correct --- the others need to be just the same, +# but with a different name. + +# max, min, prod, round, var, mean, ptp, std + +# There's also one *slightly* different function, cumsum. This doesn't +# have a scalar version -- it always makes an array. + + +class _Array(Sized, Container): + @classmethod + def __get_pydantic_core_schema__(cls, source_type: Any, handler: GetCoreSchemaHandler): + """Runtime validation for pydantic.""" + return core_schema.no_info_after_validator_function(validate_array, handler(source_type)) + + @property + @abstractmethod + def dtype(self) -> DTypes: ... + @property + @abstractmethod + def data(self) -> memoryview: ... + @property + @abstractmethod + def flags(self) -> Any: ... + @property + @abstractmethod + def size(self) -> int: ... + @property + @abstractmethod + def itemsize(self) -> int: ... + @property + @abstractmethod + def nbytes(self) -> int: ... + @property + @abstractmethod + def ndim(self) -> int: ... + @property + @abstractmethod + def shape(self) -> Shape: ... + @property + @abstractmethod + def strides(self) -> Tuple[int, ...]: ... + + # TODO: Is ArrayT right? + @abstractmethod + def astype(self: ArrayT, dtype: DTypes, order: str = ..., casting: str = ..., subok: bool = ..., copy: bool = ...) -> ArrayT: ... + @abstractmethod + def copy(self: ArrayT, order: str = ...) -> ArrayT: ... + @abstractmethod + def fill(self, value: Any) -> None: ... + # Shape manipulation + @abstractmethod + def reshape(self: ArrayT, shape: Shape, *, order: str = ...) -> ArrayT: ... + @abstractmethod + def transpose(self: ArrayT, axes: Shape) -> ArrayT: ... + # TODO: is this right? It returns 1d + @abstractmethod + def flatten(self, order: str = ...): ... + # TODO: is this right? It returns 1d + @abstractmethod + def ravel(self, order: str = ...): ... + @abstractmethod + def squeeze(self, axis: Union[int, Shape] = ...): ... + @abstractmethod + def __len__(self) -> int: ... + @abstractmethod + def __setitem__(self, key, value): ... + @abstractmethod + def __iter__(self) -> Iterator[Any]: ... + @abstractmethod + def __contains__(self, key) -> bool: ... + @abstractmethod + def __index__(self) -> int: ... + @abstractmethod + def __int__(self) -> int: ... + @abstractmethod + def __float__(self) -> float: ... + @abstractmethod + def __complex__(self) -> complex: ... + @abstractmethod + def __bool__(self) -> bool: ... + @abstractmethod + def __bytes__(self) -> bytes: ... + @abstractmethod + def __str__(self) -> str: ... + @abstractmethod + def __repr__(self) -> str: ... + @abstractmethod + def __copy__(self, order: str = ...): ... + @abstractmethod + def __deepcopy__(self: SelfT, memo: dict) -> SelfT: ... + @abstractmethod + def __lt__(self, other): ... + @abstractmethod + def __le__(self, other): ... + @abstractmethod + def __eq__(self, other): ... + @abstractmethod + def __ne__(self, other): ... + @abstractmethod + def __gt__(self, other): ... + @abstractmethod + def __ge__(self, other): ... + @abstractmethod + def __add__(self, other): ... + @abstractmethod + def __radd__(self, other): ... + @abstractmethod + def __iadd__(self, other): ... + @abstractmethod + def __sub__(self, other): ... + @abstractmethod + def __rsub__(self, other): ... + @abstractmethod + def __isub__(self, other): ... + @abstractmethod + def __mul__(self, other): ... + @abstractmethod + def __rmul__(self, other): ... + @abstractmethod + def __imul__(self, other): ... + @abstractmethod + def __truediv__(self, other): ... + @abstractmethod + def __rtruediv__(self, other): ... + @abstractmethod + def __itruediv__(self, other): ... + @abstractmethod + def __floordiv__(self, other): ... + @abstractmethod + def __rfloordiv__(self, other): ... + @abstractmethod + def __ifloordiv__(self, other): ... + @abstractmethod + def __mod__(self, other): ... + @abstractmethod + def __rmod__(self, other): ... + @abstractmethod + def __imod__(self, other): ... + @abstractmethod + def __divmod__(self, other): ... + @abstractmethod + def __rdivmod__(self, other): ... + # NumPy's __pow__ doesn't handle a third argument + @abstractmethod + def __pow__(self, other): ... + @abstractmethod + def __rpow__(self, other): ... + @abstractmethod + def __ipow__(self, other): ... + @abstractmethod + def __lshift__(self, other): ... + @abstractmethod + def __rlshift__(self, other): ... + @abstractmethod + def __ilshift__(self, other): ... + @abstractmethod + def __rshift__(self, other): ... + @abstractmethod + def __rrshift__(self, other): ... + @abstractmethod + def __irshift__(self, other): ... + @abstractmethod + def __and__(self, other): ... + @abstractmethod + def __rand__(self, other): ... + @abstractmethod + def __iand__(self, other): ... + @abstractmethod + def __xor__(self, other): ... + @abstractmethod + def __rxor__(self, other): ... + @abstractmethod + def __ixor__(self, other): ... + @abstractmethod + def __or__(self, other): ... + @abstractmethod + def __ror__(self, other): ... + @abstractmethod + def __ior__(self, other): ... + @abstractmethod + def __matmul__(self, other): ... + @abstractmethod + def __rmatmul__(self, other): ... + @abstractmethod + def __neg__(self: ArrayT) -> ArrayT: ... + @abstractmethod + def __pos__(self: ArrayT) -> ArrayT: ... + @abstractmethod + def __abs__(self: ArrayT) -> ArrayT: ... + @abstractmethod + def __invert__(self: ArrayT) -> ArrayT: ... + @abstractmethod + def get(self: ArrayT) -> ArrayT: ... + @abstractmethod + def all(self, axis: int = -1, out: Optional[ArrayT] = None, keepdims: bool = False) -> ArrayT: ... + @abstractmethod + def any(self, axis: int = -1, out: Optional[ArrayT] = None, keepdims: bool = False) -> ArrayT: ... + # def argmax(self, axis: int = -1, out: Optional["Array"] = None, keepdims: Union[Tru, Fal]=False) -> Union[int, "Ints1d"]: ... + @abstractmethod + def argmin(self, axis: int = -1, out: Optional[ArrayT] = None) -> ArrayT: ... + @abstractmethod + def clip(self, a_min: Any, a_max: Any, out: Optional[ArrayT]) -> ArrayT: ... + #def cumsum( self: ArrayT, axis: int = -1, dtype: Optional[DTypes] = None, out: Optional[ArrayT] = None) -> ArrayT: ... + @abstractmethod + def max(self, axis: int = -1, out: Optional[ArrayT] = None) -> ArrayT: ... + # def mean(self, axis: int = -1, dtype: Optional[DTypes] = None, out: Optional[SelfT] = None, keepdims: bool = False) -> "Array": ... + @abstractmethod + def min(self, axis: int = -1, out: Optional[ArrayT] = None) -> ArrayT: ... + @abstractmethod + def nonzero(self: SelfT) -> SelfT: ... + @abstractmethod + def prod(self, axis: int = -1, dtype: Optional[DTypes] = None, out: Optional[ArrayT] = None, keepdims: bool = False) -> ArrayT: ... + @abstractmethod + def round(self, decimals: int = 0, out: Optional[ArrayT] = None) -> ArrayT: ... + # def sum(self, axis: int = -1, dtype: Optional[DTypes] = None, out: Optional[ArrayT] = None, keepdims: bool = False) -> ArrayT: ... + @abstractmethod + def tobytes(self, order: str = "C") -> bytes: ... + @abstractmethod + def tolist(self) -> List[Any]: ... + @abstractmethod + def var(self: SelfT, axis: int = -1, dtype: Optional[DTypes] = None, out: Optional[ArrayT] = None, ddof: int = 0, keepdims: bool = False) -> SelfT: ... + + +class _Floats(_Array): + @property + @abstractmethod + def dtype(self) -> DTypesFloat: ... + + @abstractmethod + def fill(self, value: float) -> None: ... + @abstractmethod + def reshape(self, shape: Shape, *, order: str = ...) -> "_Floats": ... + + +class _Ints(_Array): + @property + @abstractmethod + def dtype(self) -> DTypesInt: ... + + @abstractmethod + def fill(self, value: int) -> None: ... + @abstractmethod + def reshape(self, shape: Shape, *, order: str = ...) -> "_Ints": ... + + +""" +Extensive overloads to represent __getitem__ behaviour. + +In an N+1 dimensional array, there will be N possible return types. For instance, +if you have a 2d array, you could get back a float (array[i, j]), a floats1d +(array[i]) or a floats2d (array[:i, :j]). You'll get the scalar if you have N +ints in the index, a 1d array if you have N-1 ints, etc. + +So the trick here is to make a union with the various combinations that produce +each result type, and then only have one overload per result. If we overloaded +on each *key* type, that would get crazy, because there's tonnes of combinations. + +In each rank, we can use the same key-types for float and int, but we need a +different return-type union. +""" + + +class _Array1d(_Array): + """1-dimensional array.""" + + @classmethod + def __get_pydantic_core_schema__(cls, source_type: Any, handler: GetCoreSchemaHandler): + """Runtime validation for pydantic.""" + return core_schema.no_info_after_validator_function(lambda v: validate_array(v, ndim=1), handler(source_type)) + + @property + @abstractmethod + def ndim(self) -> Literal[1]: ... + @property + @abstractmethod + def shape(self) -> Tuple[int]: ... + + @abstractmethod + def __iter__(self) -> Iterator[Union[float, int]]: ... + @abstractmethod + def astype(self, dtype: DTypes, order: str = ..., casting: str = ..., subok: bool = ..., copy: bool = ...) -> "_Array1d": ... + @abstractmethod + def flatten(self: SelfT, order: str = ...) -> SelfT: ... + @abstractmethod + def ravel(self: SelfT, order: str = ...) -> SelfT: ... + # These is actually a bit too strict: It's legal to say 'array1d + array2d' + # That's kind of bad code though; it's better to write array2d + array1d. + # We could relax this, but let's try the strict version. + @abstractmethod + def __add__(self: SelfT, other: Union[float, int, "Array1d"]) -> SelfT: ... + @abstractmethod + def __sub__(self: SelfT, other: Union[float, int, "Array1d"]) -> SelfT: ... + @abstractmethod + def __mul__(self: SelfT, other: Union[float, int, "Array1d"]) -> SelfT: ... + @abstractmethod + def __pow__(self: SelfT, other: Union[float, int, "Array1d"]) -> SelfT: ... + @abstractmethod + def __matmul__(self: SelfT, other: Union[float, int, "Array1d"]) -> SelfT: ... + # These are not too strict though: you can't do += with higher dimensional. + @abstractmethod + def __iadd__(self, other: Union[float, int, "Array1d"]): ... + @abstractmethod + def __isub__(self, other: Union[float, int, "Array1d"]): ... + @abstractmethod + def __imul__(self, other: Union[float, int, "Array1d"]): ... + @abstractmethod + def __ipow__(self, other: Union[float, int, "Array1d"]): ... + + @overload + @abstractmethod + def argmax(self, keepdims: Fal = False, axis: int = -1, out: Optional[_Array] = None) -> int: ... + @overload + @abstractmethod + def argmax(self, keepdims: Tru, axis: int = -1, out: Optional[_Array] = None) -> "Ints1d": ... + @abstractmethod + def argmax(self, keepdims: bool = False, axis: int = -1, out: Optional[_Array] = None) -> Union[int, "Ints1d"]: ... + + @overload + @abstractmethod + def mean(self, keepdims: Tru, axis: int = -1, dtype: Optional[DTypes] = None, out: Optional["Floats1d"] = None) -> "Floats1d": ... + @overload + @abstractmethod + def mean(self, keepdims: Fal = False, axis: int = -1, dtype: Optional[DTypes] = None, out: Optional["Floats1d"] = None) -> float: ... + @abstractmethod + def mean(self, keepdims: bool = False, axis: int = -1, dtype: Optional[DTypes] = None, out: Optional["Floats1d"] = None) -> Union["Floats1d", float]: ... + + +class Floats1d(_Array1d, _Floats): + """1-dimensional array of floats.""" + + T: "Floats1d" + + @classmethod + def __get_pydantic_core_schema__(cls, source_type: Any, handler: GetCoreSchemaHandler): + """Runtime validation for pydantic.""" + return core_schema.no_info_after_validator_function(lambda v: validate_array(v, ndim=1, dtype="f"), handler(source_type)) + + + @abstractmethod + def __iter__(self) -> Iterator[float]: ... + + @overload + @abstractmethod + def __getitem__(self, key: _1_KeyScalar) -> float: ... + @overload + @abstractmethod + def __getitem__(self, key: _1_Key1d) -> "Floats1d": ... + @abstractmethod + def __getitem__(self, key: _1_AllKeys) -> _F1_AllReturns: ... + + @overload + @abstractmethod + def __setitem__(self, key: _1_KeyScalar, value: float) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _1_Key1d, value: "Floats1d") -> None: ... + @abstractmethod + def __setitem__(self, key: _1_AllKeys, _F1_AllReturns) -> None: ... + + @overload + @abstractmethod + def cumsum(self, *, keepdims: Tru, axis: Optional[OneAx] = None, out: Optional["Floats1d"] = None) -> "Floats1d": ... + @overload # Cumsum is unusual in this + @abstractmethod + def cumsum(self, *, keepdims: Fal, axis: Optional[OneAx] = None, out: Optional["Floats1d"] = None) -> "Floats1d": ... + @abstractmethod + def cumsum(self, *, keepdims: bool = False, axis: _1_AllAx = None, out: Optional["Floats1d"] = None) -> "Floats1d": ... + + @overload + @abstractmethod + def sum(self, *, keepdims: Tru, axis: Optional[OneAx] = None, out: Optional["Floats1d"] = None) -> "Floats1d": ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal, axis: Optional[OneAx] = None, out = None) -> float: ... + @abstractmethod + def sum(self, *, keepdims: bool = False, axis: _1_AllAx = None, out: Optional["Floats1d"] = None) -> _1F_ReduceResults: ... + + +class Ints1d(_Array1d, _Ints): + """1-dimensional array of ints.""" + + T: "Ints1d" + + @classmethod + def __get_pydantic_core_schema__(cls, source_type: Any, handler: GetCoreSchemaHandler): + """Runtime validation for pydantic.""" + return core_schema.no_info_after_validator_function(lambda v: validate_array(v, ndim=1, dtype="i"), handler(source_type)) + + + @abstractmethod + def __iter__(self) -> Iterator[int]: ... + + @overload + @abstractmethod + def __getitem__(self, key: _1_KeyScalar) -> int: ... + @overload + @abstractmethod + def __getitem__(self, key: _1_Key1d) -> "Ints1d": ... + @abstractmethod + def __getitem__(self, key: _1_AllKeys) -> _I1_AllReturns: ... + + @overload + @abstractmethod + def __setitem__(self, key: _1_KeyScalar, value: int) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _1_Key1d, value: Union[int, "Ints1d"]) -> None: ... + @abstractmethod + def __setitem__(self, key: _1_AllKeys, _I1_AllReturns) -> None: ... + + @overload + @abstractmethod + def cumsum(self, *, keepdims: Tru, axis: Optional[OneAx] = None, out: Optional["Ints1d"] = None) -> "Ints1d": ... + @overload + @abstractmethod + def cumsum(self, *, keepdims: Fal = False, axis: Optional[OneAx] = None, out: Optional["Ints1d"] = None) -> "Ints1d": ... + @abstractmethod + def cumsum(self, *, keepdims: bool = False, axis: _1_AllAx = None, out: Optional["Ints1d"] = None) -> "Ints1d": ... + + @overload + @abstractmethod + def sum(self, *, keepdims: Tru, axis: Optional[OneAx] = None, out: Optional["Ints1d"] = None) -> "Ints1d": ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal = False, axis: Optional[OneAx] = None, out = None) -> int: ... + @abstractmethod + def sum(self, *, keepdims: bool = False, axis: _1_AllAx = None, out: Optional["Ints1d"] = None) -> _1I_ReduceResults: ... + + + +class _Array2d(_Array): + @classmethod + def __get_pydantic_core_schema__(cls, source_type: Any, handler: GetCoreSchemaHandler): + """Runtime validation for pydantic.""" + return core_schema.no_info_after_validator_function(lambda v: validate_array(v, ndim=2), handler(source_type)) + + + @property + @abstractmethod + def ndim(self) -> Literal[2]: ... + @property + @abstractmethod + def shape(self) -> Tuple[int, int]: ... + + @abstractmethod + def __iter__(self) -> Iterator[Array1d]: ... + @abstractmethod + def astype(self, dtype: DTypes, order: str = ..., casting: str = ..., subok: bool = ..., copy: bool = ...) -> "Array2d": ... + # These is actually a bit too strict: It's legal to say 'array2d + array3d' + # That's kind of bad code though; it's better to write array3d + array2d. + # We could relax this, but let's try the strict version. + @abstractmethod + def __add__(self: ArrayT, other: Union[float, int, Array1d, "Array2d"]) -> ArrayT: ... + @abstractmethod + def __sub__(self: ArrayT, other: Union[float, int, Array1d, "Array2d"]) -> ArrayT: ... + @abstractmethod + def __mul__(self: ArrayT, other: Union[float, int, Array1d, "Array2d"]) -> ArrayT: ... + @abstractmethod + def __pow__(self: ArrayT, other: Union[float, int, Array1d, "Array2d"]) -> ArrayT: ... + @abstractmethod + def __matmul__(self: ArrayT, other: Union[float, int, Array1d, "Array2d"]) -> ArrayT: ... + # These are not too strict though: you can't do += with higher dimensional. + @abstractmethod + def __iadd__(self, other: Union[float, int, Array1d, "Array2d"]): ... + @abstractmethod + def __isub__(self, other: Union[float, int, Array1d, "Array2d"]): ... + @abstractmethod + def __imul__(self, other: Union[float, int, Array1d, "Array2d"]): ... + @abstractmethod + def __ipow__(self, other: Union[float, int, Array1d, "Array2d"]): ... + + @overload + @abstractmethod + def argmax(self, keepdims: Fal = False, axis: int = -1, out: Optional[_Array] = None) -> Ints1d: ... + @overload + @abstractmethod + def argmax(self, keepdims: Tru, axis: int = -1, out: Optional[_Array] = None) -> "Ints2d": ... + @abstractmethod + def argmax(self, keepdims: bool = False, axis: int = -1, out: Optional[_Array] = None) -> Union[Ints1d, "Ints2d"]: ... + + @overload + @abstractmethod + def mean(self, keepdims: Fal = False, axis: int = -1, dtype: Optional[DTypes] = None, out: Optional["Floats2d"] = None) -> Floats1d: ... + @overload + @abstractmethod + def mean(self, keepdims: Tru, axis: int = -1, dtype: Optional[DTypes] = None, out: Optional["Floats2d"] = None) -> "Floats2d": ... + @abstractmethod + def mean(self, keepdims: bool = False, axis: int = -1, dtype: Optional[DTypes] = None, out: Optional["Floats2d"] = None) -> Union["Floats2d", Floats1d]: ... + + +class Floats2d(_Array2d, _Floats): + """2-dimensional array of floats""" + + T: "Floats2d" + + @classmethod + def __get_pydantic_core_schema__(cls, source_type: Any, handler: GetCoreSchemaHandler): + """Runtime validation for pydantic.""" + return core_schema.no_info_after_validator_function(lambda v: validate_array(v, ndim=2, dtype="f"), handler(source_type)) + + @abstractmethod + def __iter__(self) -> Iterator[Floats1d]: ... + + @overload + @abstractmethod + def __getitem__(self, key: _2_KeyScalar) -> float: ... + @overload + @abstractmethod + def __getitem__(self, key: _2_Key1d) -> Floats1d: ... + @overload + @abstractmethod + def __getitem__(self, key: _2_Key2d) -> "Floats2d": ... + @abstractmethod + def __getitem__(self, key: _2_AllKeys) -> _F2_AllReturns: ... + + @overload + @abstractmethod + def __setitem__(self, key: _2_KeyScalar, value: float) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _2_Key1d, value: Union[float, Floats1d]) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _2_Key2d, value: _F2_AllReturns) -> None: ... + @abstractmethod + def __setitem__(self, key: _2_AllKeys, value: _F2_AllReturns) -> None: ... + + @overload + @abstractmethod + def sum(self, *, keepdims: Tru, axis: _2_AllAx = None, out: Optional["Floats2d"] = None) -> "Floats2d": ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal = False, axis: OneAx, out: Optional[Floats1d] = None) -> Floats1d: ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal = False, axis: TwoAx, out = None) -> float: ... + @abstractmethod + def sum(self, *, keepdims: bool = False, axis: _2_AllAx = None, out: Union[None, "Floats1d", "Floats2d"] = None) -> _2F_ReduceResults: ... + + + +class Ints2d(_Array2d, _Ints): + """2-dimensional array of ints.""" + + T: "Ints2d" + + @classmethod + def __get_pydantic_core_schema__(cls, source_type: Any, handler: GetCoreSchemaHandler): + """Runtime validation for pydantic.""" + return core_schema.no_info_after_validator_function(lambda v: validate_array(v, ndim=2, dtype="i"), handler(source_type)) + + @abstractmethod + def __iter__(self) -> Iterator[Ints1d]: ... + + @overload + @abstractmethod + def __getitem__(self, key: _2_KeyScalar) -> int: ... + @overload + @abstractmethod + def __getitem__(self, key: _2_Key1d) -> Ints1d: ... + @overload + @abstractmethod + def __getitem__(self, key: _2_Key2d) -> "Ints2d": ... + @abstractmethod + def __getitem__(self, key: _2_AllKeys) -> _I2_AllReturns: ... + + @overload + @abstractmethod + def __setitem__(self, key: _2_KeyScalar, value: int) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _2_Key1d, value: Ints1d) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _2_Key2d, value: "Ints2d") -> None: ... + @abstractmethod + def __setitem__(self, key: _2_AllKeys, value: _I2_AllReturns) -> None: ... + + @overload + @abstractmethod + def sum(self, keepdims: Fal = False, axis: int = -1, out: Optional["Ints1d"] = None) -> Ints1d: ... + @overload + @abstractmethod + def sum(self, keepdims: Tru, axis: int = -1, out: Optional["Ints2d"] = None) -> "Ints2d": ... + @abstractmethod + def sum(self, keepdims: bool = False, axis: int = -1, out: Optional[Union["Ints1d", "Ints2d"]] = None) -> Union["Ints2d", Ints1d]: ... + + +class _Array3d(_Array): + """3-dimensional array of floats""" + + @classmethod + def __get_validators__(cls): + """Runtime validation for pydantic.""" + yield lambda v: validate_array(v, ndim=3) + + @property + @abstractmethod + def ndim(self) -> Literal[3]: ... + @property + @abstractmethod + def shape(self) -> Tuple[int, int, int]: ... + + @abstractmethod + def __iter__(self) -> Iterator[Array2d]: ... + @abstractmethod + def astype(self, dtype: DTypes, order: str = ..., casting: str = ..., subok: bool = ..., copy: bool = ...) -> "Array3d": ... + # These is actually a bit too strict: It's legal to say 'array2d + array3d' + # That's kind of bad code though; it's better to write array3d + array2d. + # We could relax this, but let's try the strict version. + @abstractmethod + def __add__(self: SelfT, other: Union[float, int, Array1d, Array2d, "Array3d"]) -> SelfT: ... + @abstractmethod + def __sub__(self: SelfT, other: Union[float, int, Array1d, Array2d, "Array3d"]) -> SelfT: ... + @abstractmethod + def __mul__(self: SelfT, other: Union[float, int, Array1d, Array2d, "Array3d"]) -> SelfT: ... + @abstractmethod + def __pow__(self: SelfT, other: Union[float, int, Array1d, Array2d, "Array3d"]) -> SelfT: ... + @abstractmethod + def __matmul__(self: SelfT, other: Union[float, int, Array1d, Array2d, "Array3d"]) -> SelfT: ... + # These are not too strict though: you can't do += with higher dimensional. + @abstractmethod + def __iadd__(self, other: Union[float, int, Array1d, Array2d, "Array3d"]): ... + @abstractmethod + def __isub__(self, other: Union[float, int, Array1d, Array2d, "Array3d"]): ... + @abstractmethod + def __imul__(self, other: Union[float, int, Array1d, Array2d, "Array3d"]): ... + @abstractmethod + def __ipow__(self, other: Union[float, int, Array1d, Array2d, "Array3d"]): ... + + @overload + @abstractmethod + def argmax(self, keepdims: Fal = False, axis: int = -1, out: Optional[_Array] = None) -> Ints2d: ... + @overload + @abstractmethod + def argmax(self, keepdims: Tru, axis: int = -1, out: Optional[_Array] = None) -> "Ints3d": ... + @abstractmethod + def argmax(self, keepdims: bool = False, axis: int = -1, out: Optional[_Array] = None) -> Union[Ints2d, "Ints3d"]: ... + + +class Floats3d(_Array3d, _Floats): + """3-dimensional array of floats""" + + T: "Floats3d" + + @classmethod + def __get_validators__(cls): + """Runtime validation for pydantic.""" + yield lambda v: validate_array(v, ndim=3, dtype="f") + + @abstractmethod + def __iter__(self) -> Iterator[Floats2d]: ... + + @overload + @abstractmethod + def __getitem__(self, key: _3_KeyScalar) -> float: ... + @overload + @abstractmethod + def __getitem__(self, key: _3_Key1d) -> Floats1d: ... + @overload + @abstractmethod + def __getitem__(self, key: _3_Key2d) -> Floats2d: ... + @overload + @abstractmethod + def __getitem__(self, key: _3_Key3d) -> "Floats3d": ... + @abstractmethod + def __getitem__(self, key: _3_AllKeys) -> _F3_AllReturns: ... + + @overload + @abstractmethod + def __setitem__(self, key: _3_KeyScalar, value: float) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _3_Key1d, value: Floats1d) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _3_Key2d, value: Floats2d) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _3_Key3d, value: "Floats3d") -> None: ... + @abstractmethod + def __setitem__(self, key: _3_AllKeys, value: _F3_AllReturns) -> None: ... + + @overload + @abstractmethod + def sum(self, *, keepdims: Tru, axis: _3_AllAx = None, out: Optional["Floats3d"] = None) -> "Floats3d": ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal, axis: OneAx, out: Optional[Floats2d] = None) -> Floats2d: ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal, axis: TwoAx, out: Optional[Floats1d] = None) -> Floats1d: ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal, axis: Optional[ThreeAx], out = None) -> float: ... + @abstractmethod + def sum(self, *, keepdims: bool = False, axis: _3_AllAx = None, out: Union[None, Floats1d, Floats2d, "Floats3d"] = None) -> _3F_ReduceResults: ... + + +class Ints3d(_Array3d, _Ints): + """3-dimensional array of ints.""" + + T: "Ints3d" + + @classmethod + def __get_validators__(cls): + """Runtime validation for pydantic.""" + yield lambda v: validate_array(v, ndim=3, dtype="i") + + @abstractmethod + def __iter__(self) -> Iterator[Ints2d]: ... + + @overload + @abstractmethod + def __getitem__(self, key: _3_KeyScalar) -> int: ... + @overload + @abstractmethod + def __getitem__(self, key: _3_Key1d) -> Ints1d: ... + @overload + @abstractmethod + def __getitem__(self, key: _3_Key2d) -> Ints2d: ... + @overload + @abstractmethod + def __getitem__(self, key: _3_Key3d) -> "Ints3d": ... + @abstractmethod + def __getitem__(self, key: _3_AllKeys) -> _I3_AllReturns: ... + + @overload + @abstractmethod + def __setitem__(self, key: _3_KeyScalar, value: int) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _3_Key1d, value: Ints1d) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _3_Key2d, value: Ints2d) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _3_Key3d, value: "Ints3d") -> None: ... + @abstractmethod + def __setitem__(self, key: _3_AllKeys, value: _I3_AllReturns) -> None: ... + + @overload + @abstractmethod + def sum(self, *, keepdims: Tru, axis: _3_AllAx = None, out: Optional["Ints3d"] = None) -> "Ints3d": ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal, axis: OneAx, out: Optional[Ints2d] = None) -> Ints2d: ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal, axis: TwoAx, out: Optional[Ints1d] = None) -> Ints1d: ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal, axis: Optional[ThreeAx], out = None) -> int: ... + @abstractmethod + def sum(self, *, keepdims: bool = False, axis: _3_AllAx = None, out: Union[None, Ints1d, Ints2d, "Ints3d"] = None) -> _3I_ReduceResults: ... + + +class _Array4d(_Array): + """4-dimensional array.""" + + @classmethod + def __get_validators__(cls): + """Runtime validation for pydantic.""" + yield lambda v: validate_array(v, ndim=4) + + @property + @abstractmethod + def ndim(self) -> Literal[4]: ... + @property + @abstractmethod + def shape(self) -> Tuple[int, int, int, int]: ... + + @abstractmethod + def __iter__(self) -> Iterator[Array3d]: ... + @abstractmethod + def astype(self, dtype: DTypes, order: str = ..., casting: str = ..., subok: bool = ..., copy: bool = ...) -> "_Array4d": ... + # These is actually a bit too strict: It's legal to say 'array4d + array5d' + # That's kind of bad code though; it's better to write array5d + array4d. + # We could relax this, but let's try the strict version. + @abstractmethod + def __add__(self: SelfT, other: Union[float, int, Array1d, Array2d, Array3d, "Array4d"]) -> SelfT: ... + @abstractmethod + def __sub__(self: SelfT, other: Union[float, int, Array1d, Array2d, Array3d, "Array4d"]) -> SelfT: ... + @abstractmethod + def __mul__(self: SelfT, other: Union[float, int, Array1d, Array2d, Array3d, "Array4d"]) -> SelfT: ... + @abstractmethod + def __pow__(self: SelfT, other: Union[float, int, Array1d, Array2d, Array3d, "Array4d"]) -> SelfT: ... + @abstractmethod + def __matmul__(self: SelfT, other: Union[float, int, Array1d, Array2d, Array3d, "Array4d"]) -> SelfT: ... + @abstractmethod + # These are not too strict though: you can't do += with higher dimensional. + @abstractmethod + def __iadd__(self, other: Union[float, int, Array1d, Array2d, Array3d, "Array4d"]): ... + @abstractmethod + def __isub__(self, other: Union[float, int, Array1d, Array2d, Array3d, "Array4d"]): ... + @abstractmethod + def __imul__(self, other: Union[float, int, Array1d, Array2d, Array3d, "Array4d"]): ... + @abstractmethod + def __ipow__(self, other: Union[float, int, Array1d, Array2d, Array3d, "Array4d"]): ... + + +class Floats4d(_Array4d, _Floats): + """4-dimensional array of floats.""" + + T: "Floats4d" + + @classmethod + def __get_validators__(cls): + """Runtime validation for pydantic.""" + yield lambda v: validate_array(v, ndim=4, dtype="f") + + @abstractmethod + def __iter__(self) -> Iterator[Floats3d]: ... + + @overload + @abstractmethod + def __getitem__(self, key: _4_KeyScalar) -> float: ... + @overload + @abstractmethod + def __getitem__(self, key: _4_Key1d) -> Floats1d: ... + @overload + @abstractmethod + def __getitem__(self, key: _4_Key2d) -> Floats2d: ... + @overload + @abstractmethod + def __getitem__(self, key: _4_Key3d) -> Floats3d: ... + @overload + @abstractmethod + def __getitem__(self, key: _4_Key4d) -> "Floats4d": ... + @abstractmethod + def __getitem__(self, key: _4_AllKeys) -> _F4_AllReturns: ... + + @overload + @abstractmethod + def __setitem__(self, key: _4_KeyScalar, value: float) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _4_Key1d, value: Floats1d) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _4_Key2d, value: Floats2d) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _4_Key3d, value: Floats3d) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _4_Key4d, value: "Floats4d") -> None: ... + + @abstractmethod + def __setitem__(self, key: _4_AllKeys, value: _F4_AllReturns) -> None: ... + + @overload + @abstractmethod + def sum(self, *, keepdims: Tru, axis: _4_AllAx = None, out: Optional["Floats4d"] = None) -> "Floats4d": ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal = False, axis: OneAx, out: Optional[Floats3d] = None) -> Floats3d: ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal = False, axis: TwoAx, out: Optional[Floats2d] = None) -> Floats2d: ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal = False, axis: ThreeAx, out: Optional[Floats1d] = None) -> Floats1d: ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal = False, axis: Optional[FourAx], out = None) -> float: ... + @abstractmethod + def sum(self, *, keepdims: bool = False, axis: _4_AllAx = None, out: Union[None, Floats1d, Floats2d, Floats3d, "Floats4d"] = None) -> _4F_ReduceResults: ... + + + +class Ints4d(_Array4d, _Ints): + """4-dimensional array of ints.""" + + T: "Ints4d" + + @classmethod + def __get_validators__(cls): + """Runtime validation for pydantic.""" + yield lambda v: validate_array(v, ndim=4, dtype="i") + + @abstractmethod + def __iter__(self) -> Iterator[Ints3d]: ... + + @overload + @abstractmethod + def __getitem__(self, key: _4_KeyScalar) -> int: ... + @overload + @abstractmethod + def __getitem__(self, key: _4_Key1d) -> Ints1d: ... + @overload + @abstractmethod + def __getitem__(self, key: _4_Key2d) -> Ints2d: ... + @overload + @abstractmethod + def __getitem__(self, key: _4_Key3d) -> Ints3d: ... + @overload + @abstractmethod + def __getitem__(self, key: _4_Key4d) -> "Ints4d": ... + @abstractmethod + def __getitem__(self, key: _4_AllKeys) -> _I4_AllReturns: ... + + @overload + @abstractmethod + def __setitem__(self, key: _4_KeyScalar, value: int) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _4_Key1d, value: Ints1d) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _4_Key2d, value: Ints2d) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _4_Key3d, value: Ints3d) -> None: ... + @overload + @abstractmethod + def __setitem__(self, key: _4_Key4d, value: "Ints4d") -> None: ... + + @abstractmethod + def __setitem__(self, key: _4_AllKeys, value: _I4_AllReturns) -> None: ... + + @overload + @abstractmethod + def sum(self, *, keepdims: Tru, axis: _4_AllAx = None, out: Optional["Ints4d"] = None) -> "Ints4d": ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal = False, axis: OneAx, out: Optional[Ints3d] = None) -> Ints3d: ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal = False, axis: TwoAx, out: Optional[Ints2d] = None) -> Ints2d: ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal = False, axis: ThreeAx, out: Optional[Ints1d] = None) -> Ints1d: ... + @overload + @abstractmethod + def sum(self, *, keepdims: Fal = False, axis: Optional[FourAx] = None, out = None) -> int: ... + @abstractmethod + def sum(self, *, keepdims: bool = False, axis: _4_AllAx = None, out: Optional[Union[Ints1d, Ints2d, Ints3d, "Ints4d"]] = None) -> _4I_ReduceResults: ... + + + +_DIn = TypeVar("_DIn") + + +class Decorator(Protocol): + """Protocol to mark a function as returning its child with identical signature.""" + + def __call__(self, name: str) -> Callable[[_DIn], _DIn]: ... + + +# fmt: on + + +class Generator(Iterator): + """Custom generator type. Used to annotate function arguments that accept + generators so they can be validated by pydantic (which doesn't support + iterators/iterables otherwise). + """ + + @classmethod + def __get_validators__(cls): + yield cls.validate + + @classmethod + def validate(cls, v): + if not hasattr(v, "__iter__") and not hasattr(v, "__next__"): + raise TypeError("not a valid iterator") + return v + + +@dataclass +class SizedGenerator: + """A generator that has a __len__ and can repeatedly call the generator + function. + """ + + get_items: Callable[[], Generator] + length: int + + def __len__(self): + return self.length + + def __iter__(self): + yield from self.get_items() + + +@dataclass +class Padded: + """A batch of padded sequences, sorted by decreasing length. The data array + is of shape (step, batch, ...). The auxiliary array size_at_t indicates the + length of the batch at each timestep, so you can do data[:, :size_at_t[t]] to + shrink the batch. The lengths array indicates the length of each row b, + and the indices indicates the original ordering. + """ + + data: Array3d + size_at_t: Ints1d + lengths: Ints1d + indices: Ints1d + + def copy(self): + return Padded( + self.data.copy(), + self.size_at_t.copy(), + self.lengths.copy(), + self.indices.copy(), + ) + + def __len__(self) -> int: + return self.lengths.shape[0] + + def __getitem__(self, index: Union[int, slice, Ints1d]) -> "Padded": + if isinstance(index, int): + # Slice to keep the dimensionality + return Padded( + self.data[:, index : index + 1], + self.lengths[index : index + 1], + self.lengths[index : index + 1], + self.indices[index : index + 1], + ) + elif isinstance(index, slice): + return Padded( + self.data[:, index], + self.lengths[index], + self.lengths[index], + self.indices[index], + ) + else: + # If we get a sequence of indices, we need to be careful that + # we maintain the length-sorting, while also keeping the mapping + # back to the original order correct. + sorted_index = list(sorted(index)) + return Padded( + self.data[sorted_index], + self.size_at_t[sorted_index], + self.lengths[sorted_index], + self.indices[index], # Use original, to maintain order. + ) + + +@dataclass +class Ragged: + """A batch of concatenated sequences, that vary in the size of their + first dimension. Ragged allows variable-length sequence data to be contiguous + in memory, without padding. + + Indexing into Ragged is just like indexing into the *lengths* array, except + it returns a Ragged object with the accompanying sequence data. For instance, + you can write ragged[1:4] to get a Ragged object with sequences 1, 2 and 3. + """ + + data: Array2d + lengths: Ints1d + data_shape: Tuple[int, ...] + starts_ends: Optional[Ints1d] = None + + def __init__(self, data: _Array, lengths: Ints1d): + self.lengths = lengths + # Frustratingly, the -1 dimension doesn't work with 0 size... + if data.size: + self.data = cast(Array2d, data.reshape((data.shape[0], -1))) + else: + self.data = cast(Array2d, data.reshape((0, 0))) + self.data_shape = (-1,) + data.shape[1:] + + @property + def dataXd(self) -> ArrayXd: + if self.data.size: + reshaped = self.data.reshape(self.data_shape) + else: + reshaped = self.data.reshape((self.data.shape[0],) + self.data_shape[1:]) + return cast(ArrayXd, reshaped) + + def __len__(self) -> int: + return self.lengths.shape[0] + + def __getitem__(self, index: Union[int, slice, Array1d]) -> "Ragged": + if isinstance(index, tuple): + raise IndexError("Ragged arrays do not support 2d indexing.") + starts = self._get_starts() + ends = self._get_ends() + if isinstance(index, int): + s = starts[index] + e = ends[index] + return Ragged(self.data[s:e], self.lengths[index : index + 1]) + elif isinstance(index, slice): + lengths = self.lengths[index] + if len(lengths) == 0: + return Ragged(self.data[0:0].reshape(self.data_shape), lengths) + start = starts[index][0] if index.start >= 1 else 0 + end = ends[index][-1] + return Ragged(self.data[start:end].reshape(self.data_shape), lengths) + else: + # There must be a way to do this "properly" :(. Sigh, hate numpy. + xp = get_array_module(self.data) + data = xp.vstack([self[int(i)].data for i in index]) + return Ragged(data.reshape(self.data_shape), self.lengths[index]) + + def _get_starts_ends(self) -> Ints1d: + if self.starts_ends is None: + xp = get_array_module(self.lengths) + self.starts_ends = xp.empty(self.lengths.size + 1, dtype="i") + self.starts_ends[0] = 0 + self.lengths.cumsum(out=self.starts_ends[1:]) + return self.starts_ends + + def _get_starts(self) -> Ints1d: + return self._get_starts_ends()[:-1] + + def _get_ends(self) -> Ints1d: + return self._get_starts_ends()[1:] + + +_P = TypeVar("_P", bound=Sequence) + + +@dataclass +class Pairs(Generic[_P]): + """Dataclass for pairs of sequences that allows indexing into the sequences + while keeping them aligned. + """ + + one: _P + two: _P + + def __getitem__(self, index) -> "Pairs[_P]": + return Pairs(self.one[index], self.two[index]) + + def __len__(self) -> int: + return len(self.one) + + +@dataclass +class ArgsKwargs: + """A tuple of (args, kwargs) that can be spread into some function f: + + f(*args, **kwargs) + """ + + args: Tuple[Any, ...] + kwargs: Dict[str, Any] + + @classmethod + def from_items(cls, items: Sequence[Tuple[Union[int, str], Any]]) -> "ArgsKwargs": + """Create an ArgsKwargs object from a sequence of (key, value) tuples, + such as produced by argskwargs.items(). Each key should be either a string + or an integer. Items with int keys are added to the args list, and + items with string keys are added to the kwargs list. The args list is + determined by sequence order, not the value of the integer. + """ + args = [] + kwargs = {} + for key, value in items: + if isinstance(key, int): + args.append(value) + else: + kwargs[key] = value + return cls(args=tuple(args), kwargs=kwargs) + + def keys(self) -> Iterable[Union[int, str]]: + """Yield indices from self.args, followed by keys from self.kwargs.""" + yield from range(len(self.args)) + yield from self.kwargs.keys() + + def values(self) -> Iterable[Any]: + """Yield elements of from self.args, followed by values from self.kwargs.""" + yield from self.args + yield from self.kwargs.values() + + def items(self) -> Iterable[Tuple[Union[int, str], Any]]: + """Yield enumerate(self.args), followed by self.kwargs.items()""" + yield from enumerate(self.args) + yield from self.kwargs.items() + + +@dataclass +class Unserializable: + """Wrap a value to prevent it from being serialized by msgpack.""" + + obj: Any + + +def validate_array(obj, ndim=None, dtype=None): + """Runtime validator for pydantic to validate array types.""" + xp = get_array_module(obj) + if not isinstance(obj, xp.ndarray): + raise TypeError("not a valid numpy or cupy array") + errors = [] + if ndim is not None and obj.ndim != ndim: + errors.append(f"wrong array dimensions (expected {ndim}, got {obj.ndim})") + if dtype is not None: + dtype_mapping = {"f": ["float32"], "i": ["int32", "int64", "uint32", "uint64"]} + expected_types = dtype_mapping.get(dtype, []) + if obj.dtype not in expected_types: + expected = "/".join(expected_types) + err = f"wrong array data type (expected {expected}, got {obj.dtype})" + errors.append(err) + if errors: + raise ValueError(", ".join(errors)) + return obj diff --git a/TTS/Kokoro/.venv/Lib/site-packages/thinc/util.py b/TTS/Kokoro/.venv/Lib/site-packages/thinc/util.py new file mode 100644 index 0000000000000000000000000000000000000000..703048675b1cd79ae08bed75d2f0399945035f56 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/thinc/util.py @@ -0,0 +1,667 @@ +import contextlib +import functools +import inspect +import os +import platform +import random +import tempfile +import threading +from contextvars import ContextVar +from dataclasses import dataclass +from typing import ( + Any, + Callable, + Dict, + List, + Mapping, + Optional, + Sequence, + Tuple, + TypeVar, + Union, + cast, +) + +import numpy +from packaging.version import Version +from pydantic import ConfigDict, ValidationError, create_model +from wasabi import table # type: ignore + +from .compat import ( + cupy, + cupy_from_dlpack, + has_cupy, + has_cupy_gpu, + has_gpu, + has_mxnet, + has_tensorflow, + has_torch, + has_torch_cuda_gpu, + has_torch_mps, +) +from .compat import mxnet as mx +from .compat import tensorflow as tf +from .compat import torch + +DATA_VALIDATION: ContextVar[bool] = ContextVar("DATA_VALIDATION", default=False) + +from typing import TYPE_CHECKING + +from . import types # noqa: E402 +from .types import ArgsKwargs, ArrayXd, FloatsXd, IntsXd, Padded, Ragged # noqa: E402 + +if TYPE_CHECKING: + from .api import Ops + + +def get_torch_default_device() -> "torch.device": + if torch is None: + raise ValueError("Cannot get default Torch device when Torch is not available.") + + from .backends import get_current_ops + from .backends.cupy_ops import CupyOps + from .backends.mps_ops import MPSOps + + ops = get_current_ops() + if isinstance(ops, CupyOps): + device_id = torch.cuda.current_device() + return torch.device(f"cuda:{device_id}") + elif isinstance(ops, MPSOps): + return torch.device("mps") + + return torch.device("cpu") + + +def get_array_module(arr): # pragma: no cover + if is_numpy_array(arr): + return numpy + elif is_cupy_array(arr): + return cupy + else: + raise ValueError( + "Only numpy and cupy arrays are supported" + f", but found {type(arr)} instead. If " + "get_array_module module wasn't called " + "directly, this might indicate a bug in Thinc." + ) + + +def gpu_is_available(): + return has_gpu + + +def fix_random_seed(seed: int = 0) -> None: # pragma: no cover + """Set the random seed across random, numpy.random and cupy.random.""" + random.seed(seed) + numpy.random.seed(seed) + if has_torch: + torch.manual_seed(seed) + if has_cupy_gpu: + cupy.random.seed(seed) + if has_torch and has_torch_cuda_gpu: + torch.cuda.manual_seed_all(seed) + torch.backends.cudnn.deterministic = True + torch.backends.cudnn.benchmark = False + + +def is_xp_array(obj: Any) -> bool: + """Check whether an object is a numpy or cupy array.""" + return is_numpy_array(obj) or is_cupy_array(obj) + + +def is_cupy_array(obj: Any) -> bool: # pragma: no cover + """Check whether an object is a cupy array.""" + if not has_cupy: + return False + elif isinstance(obj, cupy.ndarray): + return True + else: + return False + + +def is_numpy_array(obj: Any) -> bool: + """Check whether an object is a numpy array.""" + if isinstance(obj, numpy.ndarray): + return True + else: + return False + + +def is_torch_array(obj: Any) -> bool: # pragma: no cover + if torch is None: + return False + elif isinstance(obj, torch.Tensor): + return True + else: + return False + + +def is_torch_cuda_array(obj: Any) -> bool: # pragma: no cover + return is_torch_array(obj) and obj.is_cuda + + +def is_torch_gpu_array(obj: Any) -> bool: # pragma: no cover + return is_torch_cuda_array(obj) or is_torch_mps_array(obj) + + +def is_torch_mps_array(obj: Any) -> bool: # pragma: no cover + return is_torch_array(obj) and hasattr(obj, "is_mps") and obj.is_mps + + +def is_tensorflow_array(obj: Any) -> bool: # pragma: no cover + if not has_tensorflow: + return False + elif isinstance(obj, tf.Tensor): # type: ignore + return True + else: + return False + + +def is_tensorflow_gpu_array(obj: Any) -> bool: # pragma: no cover + return is_tensorflow_array(obj) and "GPU:" in obj.device + + +def is_mxnet_array(obj: Any) -> bool: # pragma: no cover + if not has_mxnet: + return False + elif isinstance(obj, mx.nd.NDArray): # type: ignore + return True + else: + return False + + +def is_mxnet_gpu_array(obj: Any) -> bool: # pragma: no cover + return is_mxnet_array(obj) and obj.context.device_type != "cpu" + + +def to_numpy(data): # pragma: no cover + if isinstance(data, numpy.ndarray): + return data + elif has_cupy and isinstance(data, cupy.ndarray): + return data.get() + else: + return numpy.array(data) + + +def set_active_gpu(gpu_id: int) -> "cupy.cuda.Device": # pragma: no cover + """Set the current GPU device for cupy and torch (if available).""" + if not has_cupy_gpu: + raise ValueError("No CUDA GPU devices detected") + + device = cupy.cuda.device.Device(gpu_id) + device.use() + + if has_torch_cuda_gpu: + torch.cuda.set_device(gpu_id) + + return device + + +def require_cpu() -> bool: # pragma: no cover + """Use CPU through best available backend.""" + from .backends import get_ops, set_current_ops + + ops = get_ops("cpu") + set_current_ops(ops) + + return True + + +def prefer_gpu(gpu_id: int = 0) -> bool: # pragma: no cover + """Use GPU if it's available. Returns True if so, False otherwise.""" + if has_gpu: + require_gpu(gpu_id=gpu_id) + return has_gpu + + +def require_gpu(gpu_id: int = 0) -> bool: # pragma: no cover + from .backends import CupyOps, MPSOps, set_current_ops + + if platform.system() == "Darwin" and not has_torch_mps: + if has_torch: + raise ValueError("Cannot use GPU, installed PyTorch does not support MPS") + raise ValueError("Cannot use GPU, PyTorch is not installed") + elif platform.system() != "Darwin" and not has_cupy: + raise ValueError("Cannot use GPU, CuPy is not installed") + elif not has_gpu: + raise ValueError("No GPU devices detected") + + if has_cupy_gpu: + set_current_ops(CupyOps()) + set_active_gpu(gpu_id) + else: + set_current_ops(MPSOps()) + + return True + + +def copy_array(dst: ArrayXd, src: ArrayXd) -> None: # pragma: no cover + if isinstance(dst, numpy.ndarray) and isinstance(src, numpy.ndarray): + dst[:] = src + elif is_cupy_array(dst): + src = cupy.array(src, copy=False) + cupy.copyto(dst, src) + else: + numpy.copyto(dst, src) # type: ignore + + +def to_categorical( + Y: IntsXd, + n_classes: Optional[int] = None, + *, + label_smoothing: float = 0.0, +) -> FloatsXd: + if n_classes is None: + n_classes = int(numpy.max(Y) + 1) # type: ignore + + if label_smoothing < 0.0: + raise ValueError( + "Label-smoothing parameter has to be greater than or equal to 0" + ) + + if label_smoothing == 0.0: + if n_classes == 0: + raise ValueError("n_classes should be at least 1") + nongold_prob = 0.0 + else: + if not n_classes > 1: + raise ValueError( + "n_classes should be greater than 1 when label smoothing is enabled," + f"but {n_classes} was provided." + ) + nongold_prob = label_smoothing / (n_classes - 1) + + max_smooth = (n_classes - 1) / n_classes + if n_classes > 1 and label_smoothing >= max_smooth: + raise ValueError( + f"For {n_classes} classes " + "label_smoothing parameter has to be less than " + f"{max_smooth}, but found {label_smoothing}." + ) + + xp = get_array_module(Y) + label_distr = xp.full((n_classes, n_classes), nongold_prob, dtype="float32") + xp.fill_diagonal(label_distr, 1 - label_smoothing) + return label_distr[Y] + + +def get_width( + X: Union[ArrayXd, Ragged, Padded, Sequence[ArrayXd]], *, dim: int = -1 +) -> int: + """Infer the 'width' of a batch of data, which could be any of: Array, + Ragged, Padded or Sequence of Arrays. + """ + if isinstance(X, Ragged): + return get_width(X.data, dim=dim) + elif isinstance(X, Padded): + return get_width(X.data, dim=dim) + elif hasattr(X, "shape") and hasattr(X, "ndim"): + X = cast(ArrayXd, X) + if len(X.shape) == 0: + return 0 + elif len(X.shape) == 1: + return int(X.max()) + 1 + else: + return X.shape[dim] + elif isinstance(X, (list, tuple)): + if len(X) == 0: + return 0 + else: + return get_width(X[0], dim=dim) + else: + err = "Cannot get width of object: has neither shape nor __getitem__" + raise ValueError(err) + + +def assert_tensorflow_installed() -> None: # pragma: no cover + """Raise an ImportError if TensorFlow is not installed.""" + template = "TensorFlow support requires {pkg}: pip install thinc[tensorflow]\n\nEnable TensorFlow support with thinc.api.enable_tensorflow()" + if not has_tensorflow: + raise ImportError(template.format(pkg="tensorflow>=2.0.0,<2.6.0")) + + +def assert_mxnet_installed() -> None: # pragma: no cover + """Raise an ImportError if MXNet is not installed.""" + if not has_mxnet: + raise ImportError( + "MXNet support requires mxnet: pip install thinc[mxnet]\n\nEnable MXNet support with thinc.api.enable_mxnet()" + ) + + +def assert_pytorch_installed() -> None: # pragma: no cover + """Raise an ImportError if PyTorch is not installed.""" + if not has_torch: + raise ImportError("PyTorch support requires torch: pip install thinc[torch]") + + +def convert_recursive( + is_match: Callable[[Any], bool], convert_item: Callable[[Any], Any], obj: Any +) -> Any: + """Either convert a single value if it matches a given function, or + recursively walk over potentially nested lists, tuples and dicts applying + the conversion, and returns the same type. Also supports the ArgsKwargs + dataclass. + """ + if is_match(obj): + return convert_item(obj) + elif isinstance(obj, ArgsKwargs): + converted = convert_recursive(is_match, convert_item, list(obj.items())) + return ArgsKwargs.from_items(converted) + elif isinstance(obj, dict): + converted = {} + for key, value in obj.items(): + key = convert_recursive(is_match, convert_item, key) + value = convert_recursive(is_match, convert_item, value) + converted[key] = value + return converted + elif isinstance(obj, list): + return [convert_recursive(is_match, convert_item, item) for item in obj] + elif isinstance(obj, tuple): + return tuple(convert_recursive(is_match, convert_item, item) for item in obj) + else: + return obj + + +def iterate_recursive(is_match: Callable[[Any], bool], obj: Any) -> Any: + """Either yield a single value if it matches a given function, or recursively + walk over potentially nested lists, tuples and dicts yielding matching + values. Also supports the ArgsKwargs dataclass. + """ + if is_match(obj): + yield obj + elif isinstance(obj, ArgsKwargs): + yield from iterate_recursive(is_match, list(obj.items())) + elif isinstance(obj, dict): + for key, value in obj.items(): + yield from iterate_recursive(is_match, key) + yield from iterate_recursive(is_match, value) + elif isinstance(obj, list) or isinstance(obj, tuple): + for item in obj: + yield from iterate_recursive(is_match, item) + + +def xp2torch( + xp_tensor: ArrayXd, + requires_grad: bool = False, + device: Optional["torch.device"] = None, +) -> "torch.Tensor": # pragma: no cover + """Convert a numpy or cupy tensor to a PyTorch tensor.""" + assert_pytorch_installed() + + if device is None: + device = get_torch_default_device() + + if hasattr(xp_tensor, "toDlpack"): + dlpack_tensor = xp_tensor.toDlpack() # type: ignore + torch_tensor = torch.utils.dlpack.from_dlpack(dlpack_tensor) + elif hasattr(xp_tensor, "__dlpack__"): + torch_tensor = torch.utils.dlpack.from_dlpack(xp_tensor) + else: + torch_tensor = torch.from_numpy(xp_tensor) + + torch_tensor = torch_tensor.to(device) + + if requires_grad: + torch_tensor.requires_grad_() + + return torch_tensor + + +def torch2xp( + torch_tensor: "torch.Tensor", *, ops: Optional["Ops"] = None +) -> ArrayXd: # pragma: no cover + """Convert a torch tensor to a numpy or cupy tensor depending on the `ops` parameter. + If `ops` is `None`, the type of the resultant tensor will be determined by the source tensor's device. + """ + from .api import NumpyOps + + assert_pytorch_installed() + if is_torch_cuda_array(torch_tensor): + if isinstance(ops, NumpyOps): + return torch_tensor.detach().cpu().numpy() + else: + return cupy_from_dlpack(torch.utils.dlpack.to_dlpack(torch_tensor)) + else: + if isinstance(ops, NumpyOps) or ops is None: + return torch_tensor.detach().cpu().numpy() + else: + return cupy.asarray(torch_tensor) + + +def xp2tensorflow( + xp_tensor: ArrayXd, requires_grad: bool = False, as_variable: bool = False +) -> "tf.Tensor": # type: ignore # pragma: no cover + """Convert a numpy or cupy tensor to a TensorFlow Tensor or Variable""" + assert_tensorflow_installed() + if hasattr(xp_tensor, "toDlpack"): + dlpack_tensor = xp_tensor.toDlpack() # type: ignore + tf_tensor = tf.experimental.dlpack.from_dlpack(dlpack_tensor) # type: ignore + elif hasattr(xp_tensor, "__dlpack__"): + dlpack_tensor = xp_tensor.__dlpack__() # type: ignore + tf_tensor = tf.experimental.dlpack.from_dlpack(dlpack_tensor) # type: ignore + else: + tf_tensor = tf.convert_to_tensor(xp_tensor) # type: ignore + if as_variable: + # tf.Variable() automatically puts in GPU if available. + # So we need to control it using the context manager + with tf.device(tf_tensor.device): # type: ignore + tf_tensor = tf.Variable(tf_tensor, trainable=requires_grad) # type: ignore + if requires_grad is False and as_variable is False: + # tf.stop_gradient() automatically puts in GPU if available. + # So we need to control it using the context manager + with tf.device(tf_tensor.device): # type: ignore + tf_tensor = tf.stop_gradient(tf_tensor) # type: ignore + return tf_tensor + + +def tensorflow2xp( + tf_tensor: "tf.Tensor", *, ops: Optional["Ops"] = None # type: ignore +) -> ArrayXd: # pragma: no cover + """Convert a Tensorflow tensor to numpy or cupy tensor depending on the `ops` parameter. + If `ops` is `None`, the type of the resultant tensor will be determined by the source tensor's device. + """ + from .api import NumpyOps + + assert_tensorflow_installed() + if is_tensorflow_gpu_array(tf_tensor): + if isinstance(ops, NumpyOps): + return tf_tensor.numpy() + else: + dlpack_tensor = tf.experimental.dlpack.to_dlpack(tf_tensor) # type: ignore + return cupy_from_dlpack(dlpack_tensor) + else: + if isinstance(ops, NumpyOps) or ops is None: + return tf_tensor.numpy() + else: + return cupy.asarray(tf_tensor.numpy()) + + +def xp2mxnet( + xp_tensor: ArrayXd, requires_grad: bool = False +) -> "mx.nd.NDArray": # type: ignore # pragma: no cover + """Convert a numpy or cupy tensor to a MXNet tensor.""" + assert_mxnet_installed() + if hasattr(xp_tensor, "toDlpack"): + dlpack_tensor = xp_tensor.toDlpack() # type: ignore + mx_tensor = mx.nd.from_dlpack(dlpack_tensor) # type: ignore + else: + mx_tensor = mx.nd.from_numpy(xp_tensor) # type: ignore + if requires_grad: + mx_tensor.attach_grad() + return mx_tensor + + +def mxnet2xp( + mx_tensor: "mx.nd.NDArray", *, ops: Optional["Ops"] = None # type: ignore +) -> ArrayXd: # pragma: no cover + """Convert a MXNet tensor to a numpy or cupy tensor.""" + from .api import NumpyOps + + assert_mxnet_installed() + if is_mxnet_gpu_array(mx_tensor): + if isinstance(ops, NumpyOps): + return mx_tensor.detach().asnumpy() + else: + return cupy_from_dlpack(mx_tensor.to_dlpack_for_write()) + else: + if isinstance(ops, NumpyOps) or ops is None: + return mx_tensor.detach().asnumpy() + else: + return cupy.asarray(mx_tensor.asnumpy()) + + +# This is how functools.partials seems to do it, too, to retain the return type +PartialT = TypeVar("PartialT") + + +def partial( + func: Callable[..., PartialT], *args: Any, **kwargs: Any +) -> Callable[..., PartialT]: + """Wrapper around functools.partial that retains docstrings and can include + other workarounds if needed. + """ + partial_func = functools.partial(func, *args, **kwargs) + partial_func.__doc__ = func.__doc__ + return partial_func + + +class DataValidationError(ValueError): + def __init__( + self, + name: str, + X: Any, + Y: Any, + errors: Union[Sequence[Mapping[str, Any]], List[Dict[str, Any]]] = [], + ) -> None: + """Custom error for validating inputs / outputs at runtime.""" + message = f"Data validation error in '{name}'" + type_info = f"X: {type(X)} Y: {type(Y)}" + data = [] + for error in errors: + err_loc = " -> ".join([str(p) for p in error.get("loc", [])]) + data.append((err_loc, error.get("msg"))) + result = [message, type_info, table(data)] + ValueError.__init__(self, "\n\n" + "\n".join(result)) + + +def validate_fwd_input_output( + name: str, func: Callable[[Any, Any, bool], Any], X: Any, Y: Any +) -> None: + """Validate the input and output of a forward function against the type + annotations, if available. Used in Model.initialize with the input and + output samples as they pass through the network. + """ + sig = inspect.signature(func) + empty = inspect.Signature.empty + params = list(sig.parameters.values()) + if len(params) != 3: + bad_params = f"{len(params)} ({', '.join([p.name for p in params])})" + err = f"Invalid forward function. Expected 3 arguments (model, X , is_train), got {bad_params}" + raise DataValidationError(name, X, Y, [{"msg": err}]) + # Unfortunately I can't get this to work for Pydantic v2 yet. The Floats2d etc types fail to validate + # against their duck-types numpy.ndarray etc. For now disable this validation while I check with + # the pydantic folks how I should do this. + # TODO: Uncomment when working + # annot_x = params[1].annotation + # annot_y = sig.return_annotation + # sig_args: Dict[str, Any] = {"__config__": {"extra": "forbid", "arbitrary_types_allowed": True}} + # args = {} + # if X is not None and annot_x != empty: + # if isinstance(X, list) and len(X) > 5: + # X = X[:5] + # sig_args["X"] = (annot_x, ...) + # args["X"] = X + # if Y is not None and annot_y != empty: + # if isinstance(Y, list) and len(Y) > 5: + # Y = Y[:5] + # sig_args["Y"] = (annot_y, ...) + # args["Y"] = (Y, lambda x: x) + + # ArgModel = create_model("ArgModel", X=sig_args["X"], Y=sig_args["Y"], __config__=ConfigDict(extra="forbid", arbitrary_types_allowed=True)) + # # Make sure the forward refs are resolved and the types used by them are + # # available in the correct scope. See #494 for details. + # ArgModel.model_rebuild() + # try: + # ArgModel.model_validate(args) + # except ValidationError as e: + # raise DataValidationError(name, X, Y, e.errors()) from None + return None + + +@contextlib.contextmanager +def make_tempfile(mode="r"): + f = tempfile.NamedTemporaryFile(mode=mode, delete=False) + yield f + f.close() + os.remove(f.name) + + +@contextlib.contextmanager +def data_validation(validation): + with threading.Lock(): + prev = DATA_VALIDATION.get() + DATA_VALIDATION.set(validation) + yield + DATA_VALIDATION.set(prev) + + +@contextlib.contextmanager +def use_nvtx_range(message: str, id_color: int = -1): + """Context manager to register the executed code as an NVTX range. The + ranges can be used as markers in CUDA profiling.""" + if has_cupy: + cupy.cuda.nvtx.RangePush(message, id_color) + yield + cupy.cuda.nvtx.RangePop() + else: + yield + + +@dataclass +class ArrayInfo: + """Container for info for checking array compatibility.""" + + shape: types.Shape + dtype: types.DTypes + + @classmethod + def from_array(cls, arr: ArrayXd): + return cls(shape=arr.shape, dtype=arr.dtype) + + def check_consistency(self, arr: ArrayXd): + if arr.shape != self.shape: + raise ValueError( + f"Shape mismatch in backprop. Y: {self.shape}, dY: {arr.shape}" + ) + if arr.dtype != self.dtype: + raise ValueError( + f"Type mismatch in backprop. Y: {self.dtype}, dY: {arr.dtype}" + ) + + +# fmt: off +__all__ = [ + "get_array_module", + "get_torch_default_device", + "fix_random_seed", + "is_cupy_array", + "is_numpy_array", + "set_active_gpu", + "prefer_gpu", + "require_gpu", + "copy_array", + "to_categorical", + "get_width", + "xp2torch", + "torch2xp", + "tensorflow2xp", + "xp2tensorflow", + "validate_fwd_input_output", + "DataValidationError", + "make_tempfile", + "use_nvtx_range", + "ArrayInfo", + "has_cupy", + "has_torch", +] +# fmt: on diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tokenizers-0.22.2.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers-0.22.2.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers-0.22.2.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tokenizers-0.22.2.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers-0.22.2.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..56a37b73cc50fced9cca39f40955ab625c7e99a4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers-0.22.2.dist-info/METADATA @@ -0,0 +1,214 @@ +Metadata-Version: 2.4 +Name: tokenizers +Version: 0.22.2 +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Education +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence +Requires-Dist: huggingface-hub>=0.16.4,<2.0 +Requires-Dist: pytest ; extra == 'testing' +Requires-Dist: pytest-asyncio ; extra == 'testing' +Requires-Dist: requests ; extra == 'testing' +Requires-Dist: numpy ; extra == 'testing' +Requires-Dist: datasets ; extra == 'testing' +Requires-Dist: ruff ; extra == 'testing' +Requires-Dist: ty ; extra == 'testing' +Requires-Dist: sphinx ; extra == 'docs' +Requires-Dist: sphinx-rtd-theme ; extra == 'docs' +Requires-Dist: setuptools-rust ; extra == 'docs' +Requires-Dist: tokenizers[testing] ; extra == 'dev' +Provides-Extra: testing +Provides-Extra: docs +Provides-Extra: dev +Keywords: NLP,tokenizer,BPE,transformer,deep learning +Author-email: Nicolas Patry , Anthony Moi +Requires-Python: >=3.9 +Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM +Project-URL: Homepage, https://github.com/huggingface/tokenizers +Project-URL: Source, https://github.com/huggingface/tokenizers + +

+
+ +
+

+

+ + Build + + + GitHub + +

+
+ +# Tokenizers + +Provides an implementation of today's most used tokenizers, with a focus on performance and +versatility. + +Bindings over the [Rust](https://github.com/huggingface/tokenizers/tree/master/tokenizers) implementation. +If you are interested in the High-level design, you can go check it there. + +Otherwise, let's dive in! + +## Main features: + + - Train new vocabularies and tokenize using 4 pre-made tokenizers (Bert WordPiece and the 3 + most common BPE versions). + - Extremely fast (both training and tokenization), thanks to the Rust implementation. Takes + less than 20 seconds to tokenize a GB of text on a server's CPU. + - Easy to use, but also extremely versatile. + - Designed for research and production. + - Normalization comes with alignments tracking. It's always possible to get the part of the + original sentence that corresponds to a given token. + - Does all the pre-processing: Truncate, Pad, add the special tokens your model needs. + +### Installation + +#### With pip: + +```bash +pip install tokenizers +``` + +#### From sources: + +To use this method, you need to have the Rust installed: + +```bash +# Install with: +curl https://sh.rustup.rs -sSf | sh -s -- -y +export PATH="$HOME/.cargo/bin:$PATH" +``` + +Once Rust is installed, you can compile doing the following + +```bash +git clone https://github.com/huggingface/tokenizers +cd tokenizers/bindings/python + +# Create a virtual env (you can use yours as well) +python -m venv .env +source .env/bin/activate + +# Install `tokenizers` in the current virtual env +pip install -e . +``` + +### Load a pretrained tokenizer from the Hub + +```python +from tokenizers import Tokenizer + +tokenizer = Tokenizer.from_pretrained("bert-base-cased") +``` + +### Using the provided Tokenizers + +We provide some pre-build tokenizers to cover the most common cases. You can easily load one of +these using some `vocab.json` and `merges.txt` files: + +```python +from tokenizers import CharBPETokenizer + +# Initialize a tokenizer +vocab = "./path/to/vocab.json" +merges = "./path/to/merges.txt" +tokenizer = CharBPETokenizer(vocab, merges) + +# And then encode: +encoded = tokenizer.encode("I can feel the magic, can you?") +print(encoded.ids) +print(encoded.tokens) +``` + +And you can train them just as simply: + +```python +from tokenizers import CharBPETokenizer + +# Initialize a tokenizer +tokenizer = CharBPETokenizer() + +# Then train it! +tokenizer.train([ "./path/to/files/1.txt", "./path/to/files/2.txt" ]) + +# Now, let's use it: +encoded = tokenizer.encode("I can feel the magic, can you?") + +# And finally save it somewhere +tokenizer.save("./path/to/directory/my-bpe.tokenizer.json") +``` + +#### Provided Tokenizers + + - `CharBPETokenizer`: The original BPE + - `ByteLevelBPETokenizer`: The byte level version of the BPE + - `SentencePieceBPETokenizer`: A BPE implementation compatible with the one used by SentencePiece + - `BertWordPieceTokenizer`: The famous Bert tokenizer, using WordPiece + +All of these can be used and trained as explained above! + +### Build your own + +Whenever these provided tokenizers don't give you enough freedom, you can build your own tokenizer, +by putting all the different parts you need together. +You can check how we implemented the [provided tokenizers](https://github.com/huggingface/tokenizers/tree/master/bindings/python/py_src/tokenizers/implementations) and adapt them easily to your own needs. + +#### Building a byte-level BPE + +Here is an example showing how to build your own byte-level BPE by putting all the different pieces +together, and then saving it to a single file: + +```python +from tokenizers import Tokenizer, models, pre_tokenizers, decoders, trainers, processors + +# Initialize a tokenizer +tokenizer = Tokenizer(models.BPE()) + +# Customize pre-tokenization and decoding +tokenizer.pre_tokenizer = pre_tokenizers.ByteLevel(add_prefix_space=True) +tokenizer.decoder = decoders.ByteLevel() +tokenizer.post_processor = processors.ByteLevel(trim_offsets=True) + +# And then train +trainer = trainers.BpeTrainer( + vocab_size=20000, + min_frequency=2, + initial_alphabet=pre_tokenizers.ByteLevel.alphabet() +) +tokenizer.train([ + "./path/to/dataset/1.txt", + "./path/to/dataset/2.txt", + "./path/to/dataset/3.txt" +], trainer=trainer) + +# And Save it +tokenizer.save("byte-level-bpe.tokenizer.json", pretty=True) +``` + +Now, when you want to use this tokenizer, this is as simple as: + +```python +from tokenizers import Tokenizer + +tokenizer = Tokenizer.from_file("byte-level-bpe.tokenizer.json") + +encoded = tokenizer.encode("I can feel the magic, can you?") +``` + +### Typing support and `stub.py` + +The compiled PyO3 extension does not expose type annotations, so editors and type checkers would otherwise see most objects as `Any`. The `stub.py` helper walks the loaded extension modules, renders `.pyi` stub files (plus minimal forwarding `__init__.py` shims), and formats them so that tools like mypy/pyright can understand the public API. Run `python stub.py` whenever you change the Python-visible surface to keep the generated stubs in sync. + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tokenizers-0.22.2.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers-0.22.2.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..56a0039056566c0c643407dcede291bc5820825a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers-0.22.2.dist-info/RECORD @@ -0,0 +1,46 @@ +tokenizers-0.22.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +tokenizers-0.22.2.dist-info/METADATA,sha256=Wtm8zyGuU9RfgScDyAx8A-zqMAgjZVopaPnmd4d5vbM,7428 +tokenizers-0.22.2.dist-info/RECORD,, +tokenizers-0.22.2.dist-info/WHEEL,sha256=W8IbRrW6aFuwgkpVWKTtkIq8XwJIIpO5tHf4goK_jm8,95 +tokenizers/__init__.py,sha256=UQ1eI0WGEkM9qfH-QwtQCfuIupBQjuQ0DSOXsywxkIA,2739 +tokenizers/__init__.pyi,sha256=ubhr55w0uERGRitWoIi-HwmFn7dW9Vl6SHVlmC0ZJhc,57691 +tokenizers/__pycache__/__init__.cpython-312.pyc,, +tokenizers/decoders/__init__.py,sha256=Qr1jbA2fvqwjgBBYOEyaDjLBwDwkBftP5jN3tRvT1jg,387 +tokenizers/decoders/__init__.pyi,sha256=UJy1WXyQ7ogrw-Es6IJahSU6i04U7walI7bc_O86zPI,12588 +tokenizers/decoders/__pycache__/__init__.cpython-312.pyc,, +tokenizers/implementations/__init__.py,sha256=9ZI2cJHPCUCZXP37GNmRHtBzIYiKWzyqky1rtcYdrPw,316 +tokenizers/implementations/__pycache__/__init__.cpython-312.pyc,, +tokenizers/implementations/__pycache__/base_tokenizer.cpython-312.pyc,, +tokenizers/implementations/__pycache__/bert_wordpiece.cpython-312.pyc,, +tokenizers/implementations/__pycache__/byte_level_bpe.cpython-312.pyc,, +tokenizers/implementations/__pycache__/char_level_bpe.cpython-312.pyc,, +tokenizers/implementations/__pycache__/sentencepiece_bpe.cpython-312.pyc,, +tokenizers/implementations/__pycache__/sentencepiece_unigram.cpython-312.pyc,, +tokenizers/implementations/base_tokenizer.py,sha256=2RFMlsWFqS8AacXK2dbT9jCSVnOy86ERWwmaWH8vZFQ,16265 +tokenizers/implementations/bert_wordpiece.py,sha256=jRUMSYU1C7nVEDZMKdyG3Vp7-CUongE1kGJhvOP_EHM,5671 +tokenizers/implementations/byte_level_bpe.py,sha256=pWfbSeaew9atWKX8Nf2zIRia6qhAwXMfZgaeINInzo8,4394 +tokenizers/implementations/char_level_bpe.py,sha256=Bt15rEcZRSzJ2RfEeq2YvOXZ8w_UYGq9i6O3y-41Aj4,5599 +tokenizers/implementations/sentencepiece_bpe.py,sha256=4_dJFcNsyvC_F1wBnWDBquWssbUMV4kP-BEXeuHcxtI,3824 +tokenizers/implementations/sentencepiece_unigram.py,sha256=KGjhIzXukwJkpao1QIe5XVrEIAMjKiGaHEzpAHL-1I8,7826 +tokenizers/models/__init__.py,sha256=qE73qycPAKcey_pS8ov1FIz10L2Ybzy1E-1KGee27Qg,184 +tokenizers/models/__init__.pyi,sha256=tO4jy0Qrq0emg7PoqmBXituSpe0dMxyChF4J9SinyDk,20261 +tokenizers/models/__pycache__/__init__.cpython-312.pyc,, +tokenizers/normalizers/__init__.py,sha256=Pgb_wE1QQov3t_SW4vcsXY6lVBDYyGNfYGkJMk3wI7c,870 +tokenizers/normalizers/__init__.pyi,sha256=fjuhSi1yirfLZSUsFGL9Vyx2azpANIjCz-VundvqakQ,26655 +tokenizers/normalizers/__pycache__/__init__.cpython-312.pyc,, +tokenizers/pre_tokenizers/__init__.py,sha256=QvNmMTtV0RGkaKSN9hTwEPimD1OLHRU6PbzVxXwM4zA,614 +tokenizers/pre_tokenizers/__init__.pyi,sha256=VMERim4OPFGQaG8JUOTu5H3C0kgQCxv2hVYDfvPPztE,32581 +tokenizers/pre_tokenizers/__pycache__/__init__.cpython-312.pyc,, +tokenizers/processors/__init__.py,sha256=X1OKKtr3IUeede85mI1cLF0MqmDRlr7LNFMYdEy5KMU,316 +tokenizers/processors/__init__.pyi,sha256=RElgDx8bbbZIq2MpxXy3G67KXSqDtYLj_7Vq0GPkwO0,14867 +tokenizers/processors/__pycache__/__init__.cpython-312.pyc,, +tokenizers/tokenizers.pyd,sha256=esuD9biRNll-DRS3iNgpF78ocN-UV1v3fhJzHE5JxN8,7395328 +tokenizers/tokenizers.pyi,sha256=kTPgANU6E7wyKoBnR-a0YK6pVNiprgxjGhOonFvuRm0,485 +tokenizers/tools/__init__.py,sha256=mJLVrHN1FP23Cf4_EJWoYUdh8yTb5BbJFNfa8Ec5vHM,56 +tokenizers/tools/__pycache__/__init__.cpython-312.pyc,, +tokenizers/tools/__pycache__/visualizer.cpython-312.pyc,, +tokenizers/tools/visualizer-styles.css,sha256=g98RJucUCjYnPLwXycfcV-dAbHMzqJpnZ7NoP_cCUBk,5020 +tokenizers/tools/visualizer.py,sha256=jWcxhFTsyiQr-ZQmDJSjzEcSGZvZZoKDes2Ira1EVg8,15241 +tokenizers/trainers/__init__.py,sha256=v9CdtoVauwD6b1wAA6R5goSLZslBbPE5vZHM2d8sgKM,256 +tokenizers/trainers/__init__.pyi,sha256=WfXHAWSBQNPaqCym4sEREllLvqMoG76x0MFE7qSnTdA,11181 +tokenizers/trainers/__pycache__/__init__.cpython-312.pyc,, diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tokenizers-0.22.2.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers-0.22.2.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..e4aed93531e8ef5dc7fa46e04e61800dd9641292 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers-0.22.2.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: maturin (1.10.2) +Root-Is-Purelib: false +Tag: cp39-abi3-win_amd64 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tokenizers/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..cb6b4f07fd630dbb025334ff9526b1ff03c64357 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers/__init__.py @@ -0,0 +1,100 @@ +from enum import Enum +from typing import List, Tuple, Union + + +Offsets = Tuple[int, int] + +TextInputSequence = str +"""A :obj:`str` that represents an input sequence """ + +PreTokenizedInputSequence = Union[List[str], Tuple[str]] +"""A pre-tokenized input sequence. Can be one of: + + - A :obj:`List` of :obj:`str` + - A :obj:`Tuple` of :obj:`str` +""" + +TextEncodeInput = Union[ + TextInputSequence, + Tuple[TextInputSequence, TextInputSequence], + List[TextInputSequence], +] +"""Represents a textual input for encoding. Can be either: + + - A single sequence: :data:`~tokenizers.TextInputSequence` + - A pair of sequences: + + - A :obj:`Tuple` of :data:`~tokenizers.TextInputSequence` + - Or a :obj:`List` of :data:`~tokenizers.TextInputSequence` of size 2 +""" + +PreTokenizedEncodeInput = Union[ + PreTokenizedInputSequence, + Tuple[PreTokenizedInputSequence, PreTokenizedInputSequence], + List[PreTokenizedInputSequence], +] +"""Represents a pre-tokenized input for encoding. Can be either: + + - A single sequence: :data:`~tokenizers.PreTokenizedInputSequence` + - A pair of sequences: + + - A :obj:`Tuple` of :data:`~tokenizers.PreTokenizedInputSequence` + - Or a :obj:`List` of :data:`~tokenizers.PreTokenizedInputSequence` of size 2 +""" + +InputSequence = Union[TextInputSequence, PreTokenizedInputSequence] +"""Represents all the possible types of input sequences for encoding. Can be: + + - When ``is_pretokenized=False``: :data:`~TextInputSequence` + - When ``is_pretokenized=True``: :data:`~PreTokenizedInputSequence` +""" + +EncodeInput = Union[TextEncodeInput, PreTokenizedEncodeInput] +"""Represents all the possible types of input for encoding. Can be: + + - When ``is_pretokenized=False``: :data:`~TextEncodeInput` + - When ``is_pretokenized=True``: :data:`~PreTokenizedEncodeInput` +""" + + +class OffsetReferential(Enum): + ORIGINAL = "original" + NORMALIZED = "normalized" + + +class OffsetType(Enum): + BYTE = "byte" + CHAR = "char" + + +class SplitDelimiterBehavior(Enum): + REMOVED = "removed" + ISOLATED = "isolated" + MERGED_WITH_PREVIOUS = "merged_with_previous" + MERGED_WITH_NEXT = "merged_with_next" + CONTIGUOUS = "contiguous" + + +from .tokenizers import ( # type: ignore[import] + AddedToken, + Encoding, + NormalizedString, + PreTokenizedString, + Regex, + Token, + Tokenizer, + decoders, + models, + normalizers, + pre_tokenizers, + processors, + trainers, + __version__, +) +from .implementations import ( + BertWordPieceTokenizer, + ByteLevelBPETokenizer, + CharBPETokenizer, + SentencePieceBPETokenizer, + SentencePieceUnigramTokenizer, +) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tokenizers/__init__.pyi b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers/__init__.pyi new file mode 100644 index 0000000000000000000000000000000000000000..da807f2583c052846c189d8db5d11f697f417b30 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers/__init__.pyi @@ -0,0 +1,1800 @@ +# Generated content DO NOT EDIT +class AddedToken: + """ + Represents a token that can be be added to a :class:`~tokenizers.Tokenizer`. + It can have special options that defines the way it should behave. + + Args: + content (:obj:`str`): The content of the token + + single_word (:obj:`bool`, defaults to :obj:`False`): + Defines whether this token should only match single words. If :obj:`True`, this + token will never match inside of a word. For example the token ``ing`` would match + on ``tokenizing`` if this option is :obj:`False`, but not if it is :obj:`True`. + The notion of "`inside of a word`" is defined by the word boundaries pattern in + regular expressions (ie. the token should start and end with word boundaries). + + lstrip (:obj:`bool`, defaults to :obj:`False`): + Defines whether this token should strip all potential whitespaces on its left side. + If :obj:`True`, this token will greedily match any whitespace on its left. For + example if we try to match the token ``[MASK]`` with ``lstrip=True``, in the text + ``"I saw a [MASK]"``, we would match on ``" [MASK]"``. (Note the space on the left). + + rstrip (:obj:`bool`, defaults to :obj:`False`): + Defines whether this token should strip all potential whitespaces on its right + side. If :obj:`True`, this token will greedily match any whitespace on its right. + It works just like :obj:`lstrip` but on the right. + + normalized (:obj:`bool`, defaults to :obj:`True` with :meth:`~tokenizers.Tokenizer.add_tokens` and :obj:`False` with :meth:`~tokenizers.Tokenizer.add_special_tokens`): + Defines whether this token should match against the normalized version of the input + text. For example, with the added token ``"yesterday"``, and a normalizer in charge of + lowercasing the text, the token could be extract from the input ``"I saw a lion + Yesterday"``. + special (:obj:`bool`, defaults to :obj:`False` with :meth:`~tokenizers.Tokenizer.add_tokens` and :obj:`False` with :meth:`~tokenizers.Tokenizer.add_special_tokens`): + Defines whether this token should be skipped when decoding. + + """ + def __init__(self, content=None, single_word=False, lstrip=False, rstrip=False, normalized=True, special=False): + pass + + def __getstate__(self): + """ """ + pass + + def __setstate__(self, state): + """ """ + pass + + @property + def content(self): + """ + Get the content of this :obj:`AddedToken` + """ + pass + + @content.setter + def content(self, value): + """ + Get the content of this :obj:`AddedToken` + """ + pass + + @property + def lstrip(self): + """ + Get the value of the :obj:`lstrip` option + """ + pass + + @lstrip.setter + def lstrip(self, value): + """ + Get the value of the :obj:`lstrip` option + """ + pass + + @property + def normalized(self): + """ + Get the value of the :obj:`normalized` option + """ + pass + + @normalized.setter + def normalized(self, value): + """ + Get the value of the :obj:`normalized` option + """ + pass + + @property + def rstrip(self): + """ + Get the value of the :obj:`rstrip` option + """ + pass + + @rstrip.setter + def rstrip(self, value): + """ + Get the value of the :obj:`rstrip` option + """ + pass + + @property + def single_word(self): + """ + Get the value of the :obj:`single_word` option + """ + pass + + @single_word.setter + def single_word(self, value): + """ + Get the value of the :obj:`single_word` option + """ + pass + + @property + def special(self): + """ + Get the value of the :obj:`special` option + """ + pass + + @special.setter + def special(self, value): + """ + Get the value of the :obj:`special` option + """ + pass + +class Encoding: + """ + The :class:`~tokenizers.Encoding` represents the output of a :class:`~tokenizers.Tokenizer`. + """ + def __init__(self): + pass + + def __getstate__(self): + """ """ + pass + + def __setstate__(self, state): + """ """ + pass + + @property + def attention_mask(self): + """ + The attention mask + + This indicates to the LM which tokens should be attended to, and which should not. + This is especially important when batching sequences, where we need to applying + padding. + + Returns: + :obj:`List[int]`: The attention mask + """ + pass + + @attention_mask.setter + def attention_mask(self, value): + """ + The attention mask + + This indicates to the LM which tokens should be attended to, and which should not. + This is especially important when batching sequences, where we need to applying + padding. + + Returns: + :obj:`List[int]`: The attention mask + """ + pass + + def char_to_token(self, char_pos, sequence_index=0): + """ + Get the token that contains the char at the given position in the input sequence. + + Args: + char_pos (:obj:`int`): + The position of a char in the input string + sequence_index (:obj:`int`, defaults to :obj:`0`): + The index of the sequence that contains the target char + + Returns: + :obj:`int`: The index of the token that contains this char in the encoded sequence + """ + pass + + def char_to_word(self, char_pos, sequence_index=0): + """ + Get the word that contains the char at the given position in the input sequence. + + Args: + char_pos (:obj:`int`): + The position of a char in the input string + sequence_index (:obj:`int`, defaults to :obj:`0`): + The index of the sequence that contains the target char + + Returns: + :obj:`int`: The index of the word that contains this char in the input sequence + """ + pass + + @property + def ids(self): + """ + The generated IDs + + The IDs are the main input to a Language Model. They are the token indices, + the numerical representations that a LM understands. + + Returns: + :obj:`List[int]`: The list of IDs + """ + pass + + @ids.setter + def ids(self, value): + """ + The generated IDs + + The IDs are the main input to a Language Model. They are the token indices, + the numerical representations that a LM understands. + + Returns: + :obj:`List[int]`: The list of IDs + """ + pass + + @staticmethod + def merge(encodings, growing_offsets=True): + """ + Merge the list of encodings into one final :class:`~tokenizers.Encoding` + + Args: + encodings (A :obj:`List` of :class:`~tokenizers.Encoding`): + The list of encodings that should be merged in one + + growing_offsets (:obj:`bool`, defaults to :obj:`True`): + Whether the offsets should accumulate while merging + + Returns: + :class:`~tokenizers.Encoding`: The resulting Encoding + """ + pass + + @property + def n_sequences(self): + """ + The number of sequences represented + + Returns: + :obj:`int`: The number of sequences in this :class:`~tokenizers.Encoding` + """ + pass + + @n_sequences.setter + def n_sequences(self, value): + """ + The number of sequences represented + + Returns: + :obj:`int`: The number of sequences in this :class:`~tokenizers.Encoding` + """ + pass + + @property + def offsets(self): + """ + The offsets associated to each token + + These offsets let's you slice the input string, and thus retrieve the original + part that led to producing the corresponding token. + + Returns: + A :obj:`List` of :obj:`Tuple[int, int]`: The list of offsets + """ + pass + + @offsets.setter + def offsets(self, value): + """ + The offsets associated to each token + + These offsets let's you slice the input string, and thus retrieve the original + part that led to producing the corresponding token. + + Returns: + A :obj:`List` of :obj:`Tuple[int, int]`: The list of offsets + """ + pass + + @property + def overflowing(self): + """ + A :obj:`List` of overflowing :class:`~tokenizers.Encoding` + + When using truncation, the :class:`~tokenizers.Tokenizer` takes care of splitting + the output into as many pieces as required to match the specified maximum length. + This field lets you retrieve all the subsequent pieces. + + When you use pairs of sequences, the overflowing pieces will contain enough + variations to cover all the possible combinations, while respecting the provided + maximum length. + """ + pass + + @overflowing.setter + def overflowing(self, value): + """ + A :obj:`List` of overflowing :class:`~tokenizers.Encoding` + + When using truncation, the :class:`~tokenizers.Tokenizer` takes care of splitting + the output into as many pieces as required to match the specified maximum length. + This field lets you retrieve all the subsequent pieces. + + When you use pairs of sequences, the overflowing pieces will contain enough + variations to cover all the possible combinations, while respecting the provided + maximum length. + """ + pass + + def pad(self, length, direction="right", pad_id=0, pad_type_id=0, pad_token="[PAD]"): + """ + Pad the :class:`~tokenizers.Encoding` at the given length + + Args: + length (:obj:`int`): + The desired length + + direction: (:obj:`str`, defaults to :obj:`right`): + The expected padding direction. Can be either :obj:`right` or :obj:`left` + + pad_id (:obj:`int`, defaults to :obj:`0`): + The ID corresponding to the padding token + + pad_type_id (:obj:`int`, defaults to :obj:`0`): + The type ID corresponding to the padding token + + pad_token (:obj:`str`, defaults to `[PAD]`): + The pad token to use + """ + pass + + @property + def sequence_ids(self): + """ + The generated sequence indices. + + They represent the index of the input sequence associated to each token. + The sequence id can be None if the token is not related to any input sequence, + like for example with special tokens. + + Returns: + A :obj:`List` of :obj:`Optional[int]`: A list of optional sequence index. + """ + pass + + @sequence_ids.setter + def sequence_ids(self, value): + """ + The generated sequence indices. + + They represent the index of the input sequence associated to each token. + The sequence id can be None if the token is not related to any input sequence, + like for example with special tokens. + + Returns: + A :obj:`List` of :obj:`Optional[int]`: A list of optional sequence index. + """ + pass + + def set_sequence_id(self, sequence_id): + """ + Set the given sequence index + + Set the given sequence index for the whole range of tokens contained in this + :class:`~tokenizers.Encoding`. + """ + pass + + @property + def special_tokens_mask(self): + """ + The special token mask + + This indicates which tokens are special tokens, and which are not. + + Returns: + :obj:`List[int]`: The special tokens mask + """ + pass + + @special_tokens_mask.setter + def special_tokens_mask(self, value): + """ + The special token mask + + This indicates which tokens are special tokens, and which are not. + + Returns: + :obj:`List[int]`: The special tokens mask + """ + pass + + def token_to_chars(self, token_index): + """ + Get the offsets of the token at the given index. + + The returned offsets are related to the input sequence that contains the + token. In order to determine in which input sequence it belongs, you + must call :meth:`~tokenizers.Encoding.token_to_sequence()`. + + Args: + token_index (:obj:`int`): + The index of a token in the encoded sequence. + + Returns: + :obj:`Tuple[int, int]`: The token offsets :obj:`(first, last + 1)` + """ + pass + + def token_to_sequence(self, token_index): + """ + Get the index of the sequence represented by the given token. + + In the general use case, this method returns :obj:`0` for a single sequence or + the first sequence of a pair, and :obj:`1` for the second sequence of a pair + + Args: + token_index (:obj:`int`): + The index of a token in the encoded sequence. + + Returns: + :obj:`int`: The sequence id of the given token + """ + pass + + def token_to_word(self, token_index): + """ + Get the index of the word that contains the token in one of the input sequences. + + The returned word index is related to the input sequence that contains + the token. In order to determine in which input sequence it belongs, you + must call :meth:`~tokenizers.Encoding.token_to_sequence()`. + + Args: + token_index (:obj:`int`): + The index of a token in the encoded sequence. + + Returns: + :obj:`int`: The index of the word in the relevant input sequence. + """ + pass + + @property + def tokens(self): + """ + The generated tokens + + They are the string representation of the IDs. + + Returns: + :obj:`List[str]`: The list of tokens + """ + pass + + @tokens.setter + def tokens(self, value): + """ + The generated tokens + + They are the string representation of the IDs. + + Returns: + :obj:`List[str]`: The list of tokens + """ + pass + + def truncate(self, max_length, stride=0, direction="right"): + """ + Truncate the :class:`~tokenizers.Encoding` at the given length + + If this :class:`~tokenizers.Encoding` represents multiple sequences, when truncating + this information is lost. It will be considered as representing a single sequence. + + Args: + max_length (:obj:`int`): + The desired length + + stride (:obj:`int`, defaults to :obj:`0`): + The length of previous content to be included in each overflowing piece + + direction (:obj:`str`, defaults to :obj:`right`): + Truncate direction + """ + pass + + @property + def type_ids(self): + """ + The generated type IDs + + Generally used for tasks like sequence classification or question answering, + these tokens let the LM know which input sequence corresponds to each tokens. + + Returns: + :obj:`List[int]`: The list of type ids + """ + pass + + @type_ids.setter + def type_ids(self, value): + """ + The generated type IDs + + Generally used for tasks like sequence classification or question answering, + these tokens let the LM know which input sequence corresponds to each tokens. + + Returns: + :obj:`List[int]`: The list of type ids + """ + pass + + @property + def word_ids(self): + """ + The generated word indices. + + They represent the index of the word associated to each token. + When the input is pre-tokenized, they correspond to the ID of the given input label, + otherwise they correspond to the words indices as defined by the + :class:`~tokenizers.pre_tokenizers.PreTokenizer` that was used. + + For special tokens and such (any token that was generated from something that was + not part of the input), the output is :obj:`None` + + Returns: + A :obj:`List` of :obj:`Optional[int]`: A list of optional word index. + """ + pass + + @word_ids.setter + def word_ids(self, value): + """ + The generated word indices. + + They represent the index of the word associated to each token. + When the input is pre-tokenized, they correspond to the ID of the given input label, + otherwise they correspond to the words indices as defined by the + :class:`~tokenizers.pre_tokenizers.PreTokenizer` that was used. + + For special tokens and such (any token that was generated from something that was + not part of the input), the output is :obj:`None` + + Returns: + A :obj:`List` of :obj:`Optional[int]`: A list of optional word index. + """ + pass + + def word_to_chars(self, word_index, sequence_index=0): + """ + Get the offsets of the word at the given index in one of the input sequences. + + Args: + word_index (:obj:`int`): + The index of a word in one of the input sequences. + sequence_index (:obj:`int`, defaults to :obj:`0`): + The index of the sequence that contains the target word + + Returns: + :obj:`Tuple[int, int]`: The range of characters (span) :obj:`(first, last + 1)` + """ + pass + + def word_to_tokens(self, word_index, sequence_index=0): + """ + Get the encoded tokens corresponding to the word at the given index + in one of the input sequences. + + Args: + word_index (:obj:`int`): + The index of a word in one of the input sequences. + sequence_index (:obj:`int`, defaults to :obj:`0`): + The index of the sequence that contains the target word + + Returns: + :obj:`Tuple[int, int]`: The range of tokens: :obj:`(first, last + 1)` + """ + pass + + @property + def words(self): + """ + The generated word indices. + + .. warning:: + This is deprecated and will be removed in a future version. + Please use :obj:`~tokenizers.Encoding.word_ids` instead. + + They represent the index of the word associated to each token. + When the input is pre-tokenized, they correspond to the ID of the given input label, + otherwise they correspond to the words indices as defined by the + :class:`~tokenizers.pre_tokenizers.PreTokenizer` that was used. + + For special tokens and such (any token that was generated from something that was + not part of the input), the output is :obj:`None` + + Returns: + A :obj:`List` of :obj:`Optional[int]`: A list of optional word index. + """ + pass + + @words.setter + def words(self, value): + """ + The generated word indices. + + .. warning:: + This is deprecated and will be removed in a future version. + Please use :obj:`~tokenizers.Encoding.word_ids` instead. + + They represent the index of the word associated to each token. + When the input is pre-tokenized, they correspond to the ID of the given input label, + otherwise they correspond to the words indices as defined by the + :class:`~tokenizers.pre_tokenizers.PreTokenizer` that was used. + + For special tokens and such (any token that was generated from something that was + not part of the input), the output is :obj:`None` + + Returns: + A :obj:`List` of :obj:`Optional[int]`: A list of optional word index. + """ + pass + +class NormalizedString: + """ + NormalizedString + + A NormalizedString takes care of modifying an "original" string, to obtain a "normalized" one. + While making all the requested modifications, it keeps track of the alignment information + between the two versions of the string. + + Args: + sequence: str: + The string sequence used to initialize this NormalizedString + """ + def __init__(self, sequence): + pass + + def __getitem__(self, key): + """ + Return self[key]. + """ + pass + + def __getstate__(self, /): + """ + Helper for pickle. + """ + pass + + def append(self, s): + """ + Append the given sequence to the string + """ + pass + + def clear(self): + """ + Clears the string + """ + pass + + def filter(self, func): + """ + Filter each character of the string using the given func + """ + pass + + def for_each(self, func): + """ + Calls the given function for each character of the string + """ + pass + + def lowercase(self): + """ + Lowercase the string + """ + pass + + def lstrip(self): + """ + Strip the left of the string + """ + pass + + def map(self, func): + """ + Calls the given function for each character of the string + + Replaces each character of the string using the returned value. Each + returned value **must** be a str of length 1 (ie a character). + """ + pass + + def nfc(self): + """ + Runs the NFC normalization + """ + pass + + def nfd(self): + """ + Runs the NFD normalization + """ + pass + + def nfkc(self): + """ + Runs the NFKC normalization + """ + pass + + def nfkd(self): + """ + Runs the NFKD normalization + """ + pass + + @property + def normalized(self): + """ + The normalized part of the string + """ + pass + + @normalized.setter + def normalized(self, value): + """ + The normalized part of the string + """ + pass + + @property + def original(self): + """ """ + pass + + @original.setter + def original(self, value): + """ """ + pass + + def prepend(self, s): + """ + Prepend the given sequence to the string + """ + pass + + def replace(self, pattern, content): + """ + Replace the content of the given pattern with the provided content + + Args: + pattern: Pattern: + A pattern used to match the string. Usually a string or a Regex + + content: str: + The content to be used as replacement + """ + pass + + def rstrip(self): + """ + Strip the right of the string + """ + pass + + def slice(self, range): + """ + Slice the string using the given range + """ + pass + + def split(self, pattern, behavior): + """ + Split the NormalizedString using the given pattern and the specified behavior + + Args: + pattern: Pattern: + A pattern used to split the string. Usually a string or a regex built with `tokenizers.Regex` + + behavior: SplitDelimiterBehavior: + The behavior to use when splitting. + Choices: "removed", "isolated", "merged_with_previous", "merged_with_next", + "contiguous" + + Returns: + A list of NormalizedString, representing each split + """ + pass + + def strip(self): + """ + Strip both ends of the string + """ + pass + + def uppercase(self): + """ + Uppercase the string + """ + pass + +class PreTokenizedString: + """ + PreTokenizedString + + Wrapper over a string, that provides a way to normalize, pre-tokenize, tokenize the + underlying string, while keeping track of the alignment information (offsets). + + The PreTokenizedString manages what we call `splits`. Each split represents a substring + which is a subpart of the original string, with the relevant offsets and tokens. + + When calling one of the methods used to modify the PreTokenizedString (namely one of + `split`, `normalize` or `tokenize), only the `splits` that don't have any associated + tokens will get modified. + + Args: + sequence: str: + The string sequence used to initialize this PreTokenizedString + """ + def __init__(self, sequence): + pass + + def __getstate__(self, /): + """ + Helper for pickle. + """ + pass + + def get_splits(self, offset_referential="original", offset_type="char"): + """ + Get the splits currently managed by the PreTokenizedString + + Args: + offset_referential: :obj:`str` + Whether the returned splits should have offsets expressed relative + to the original string, or the normalized one. choices: "original", "normalized". + + offset_type: :obj:`str` + Whether the returned splits should have offsets expressed in bytes or chars. + When slicing an str, we usually want to use chars, which is the default value. + Now in some cases it might be interesting to get these offsets expressed in bytes, + so it is possible to change this here. + choices: "char", "bytes" + + Returns + A list of splits + """ + pass + + def normalize(self, func): + """ + Normalize each split of the `PreTokenizedString` using the given `func` + + Args: + func: Callable[[NormalizedString], None]: + The function used to normalize each underlying split. This function + does not need to return anything, just calling the methods on the provided + NormalizedString allow its modification. + """ + pass + + def split(self, func): + """ + Split the PreTokenizedString using the given `func` + + Args: + func: Callable[[index, NormalizedString], List[NormalizedString]]: + The function used to split each underlying split. + It is expected to return a list of `NormalizedString`, that represent the new + splits. If the given `NormalizedString` does not need any splitting, we can + just return it directly. + In order for the offsets to be tracked accurately, any returned `NormalizedString` + should come from calling either `.split` or `.slice` on the received one. + """ + pass + + def to_encoding(self, type_id=0, word_idx=None): + """ + Return an Encoding generated from this PreTokenizedString + + Args: + type_id: int = 0: + The type_id to be used on the generated Encoding. + + word_idx: Optional[int] = None: + An optional word index to be used for each token of this Encoding. If provided, + all the word indices in the generated Encoding will use this value, instead + of the one automatically tracked during pre-tokenization. + + Returns: + An Encoding + """ + pass + + def tokenize(self, func): + """ + Tokenize each split of the `PreTokenizedString` using the given `func` + + Args: + func: Callable[[str], List[Token]]: + The function used to tokenize each underlying split. This function must return + a list of Token generated from the input str. + """ + pass + +class Regex: + """ + Instantiate a new Regex with the given pattern + """ + def __init__(self, pattern): + pass + + def __getstate__(self, /): + """ + Helper for pickle. + """ + pass + +class Token: + def __init__(self, id, value, offsets): + pass + + def __getstate__(self, /): + """ + Helper for pickle. + """ + pass + + def as_tuple(self): + """ """ + pass + + @property + def id(self): + """ """ + pass + + @id.setter + def id(self, value): + """ """ + pass + + @property + def offsets(self): + """ """ + pass + + @offsets.setter + def offsets(self, value): + """ """ + pass + + @property + def value(self): + """ """ + pass + + @value.setter + def value(self, value): + """ """ + pass + +class Tokenizer: + """ + A :obj:`Tokenizer` works as a pipeline. It processes some raw text as input + and outputs an :class:`~tokenizers.Encoding`. + + Args: + model (:class:`~tokenizers.models.Model`): + The core algorithm that this :obj:`Tokenizer` should be using. + + """ + def __init__(self, model): + pass + + def __getnewargs__(self): + """ """ + pass + + def __getstate__(self): + """ """ + pass + + def __setstate__(self, state): + """ """ + pass + + def add_special_tokens(self, tokens): + """ + Add the given special tokens to the Tokenizer. + + If these tokens are already part of the vocabulary, it just let the Tokenizer know about + them. If they don't exist, the Tokenizer creates them, giving them a new id. + + These special tokens will never be processed by the model (ie won't be split into + multiple tokens), and they can be removed from the output when decoding. + + Args: + tokens (A :obj:`List` of :class:`~tokenizers.AddedToken` or :obj:`str`): + The list of special tokens we want to add to the vocabulary. Each token can either + be a string or an instance of :class:`~tokenizers.AddedToken` for more + customization. + + Returns: + :obj:`int`: The number of tokens that were created in the vocabulary + """ + pass + + def add_tokens(self, tokens): + """ + Add the given tokens to the vocabulary + + The given tokens are added only if they don't already exist in the vocabulary. + Each token then gets a new attributed id. + + Args: + tokens (A :obj:`List` of :class:`~tokenizers.AddedToken` or :obj:`str`): + The list of tokens we want to add to the vocabulary. Each token can be either a + string or an instance of :class:`~tokenizers.AddedToken` for more customization. + + Returns: + :obj:`int`: The number of tokens that were created in the vocabulary + """ + pass + + def async_decode_batch(self, sequences, skip_special_tokens=True): + """ + Decode a batch of ids back to their corresponding string + + Args: + sequences (:obj:`List` of :obj:`List[int]`): + The batch of sequences we want to decode + + skip_special_tokens (:obj:`bool`, defaults to :obj:`True`): + Whether the special tokens should be removed from the decoded strings + + Returns: + :obj:`List[str]`: A list of decoded strings + """ + pass + + def async_encode(self, sequence, pair=None, is_pretokenized=False, add_special_tokens=True): + """ + Asynchronously encode the given input with character offsets. + + This is an async version of encode that can be awaited in async Python code. + + Example: + Here are some examples of the inputs that are accepted:: + + await async_encode("A single sequence") + + Args: + sequence (:obj:`~tokenizers.InputSequence`): + The main input sequence we want to encode. This sequence can be either raw + text or pre-tokenized, according to the ``is_pretokenized`` argument: + + - If ``is_pretokenized=False``: :class:`~tokenizers.TextInputSequence` + - If ``is_pretokenized=True``: :class:`~tokenizers.PreTokenizedInputSequence` + + pair (:obj:`~tokenizers.InputSequence`, `optional`): + An optional input sequence. The expected format is the same that for ``sequence``. + + is_pretokenized (:obj:`bool`, defaults to :obj:`False`): + Whether the input is already pre-tokenized + + add_special_tokens (:obj:`bool`, defaults to :obj:`True`): + Whether to add the special tokens + + Returns: + :class:`~tokenizers.Encoding`: The encoded result + + """ + pass + + def async_encode_batch(self, input, is_pretokenized=False, add_special_tokens=True): + """ + Asynchronously encode the given batch of inputs with character offsets. + + This is an async version of encode_batch that can be awaited in async Python code. + + Example: + Here are some examples of the inputs that are accepted:: + + await async_encode_batch([ + "A single sequence", + ("A tuple with a sequence", "And its pair"), + [ "A", "pre", "tokenized", "sequence" ], + ([ "A", "pre", "tokenized", "sequence" ], "And its pair") + ]) + + Args: + input (A :obj:`List`/:obj:`Tuple` of :obj:`~tokenizers.EncodeInput`): + A list of single sequences or pair sequences to encode. Each sequence + can be either raw text or pre-tokenized, according to the ``is_pretokenized`` + argument: + + - If ``is_pretokenized=False``: :class:`~tokenizers.TextEncodeInput` + - If ``is_pretokenized=True``: :class:`~tokenizers.PreTokenizedEncodeInput` + + is_pretokenized (:obj:`bool`, defaults to :obj:`False`): + Whether the input is already pre-tokenized + + add_special_tokens (:obj:`bool`, defaults to :obj:`True`): + Whether to add the special tokens + + Returns: + A :obj:`List` of :class:`~tokenizers.Encoding`: The encoded batch + + """ + pass + + def async_encode_batch_fast(self, input, is_pretokenized=False, add_special_tokens=True): + """ + Asynchronously encode the given batch of inputs without tracking character offsets. + + This is an async version of encode_batch_fast that can be awaited in async Python code. + + Example: + Here are some examples of the inputs that are accepted:: + + await async_encode_batch_fast([ + "A single sequence", + ("A tuple with a sequence", "And its pair"), + [ "A", "pre", "tokenized", "sequence" ], + ([ "A", "pre", "tokenized", "sequence" ], "And its pair") + ]) + + Args: + input (A :obj:`List`/:obj:`Tuple` of :obj:`~tokenizers.EncodeInput`): + A list of single sequences or pair sequences to encode. Each sequence + can be either raw text or pre-tokenized, according to the ``is_pretokenized`` + argument: + + - If ``is_pretokenized=False``: :class:`~tokenizers.TextEncodeInput` + - If ``is_pretokenized=True``: :class:`~tokenizers.PreTokenizedEncodeInput` + + is_pretokenized (:obj:`bool`, defaults to :obj:`False`): + Whether the input is already pre-tokenized + + add_special_tokens (:obj:`bool`, defaults to :obj:`True`): + Whether to add the special tokens + + Returns: + A :obj:`List` of :class:`~tokenizers.Encoding`: The encoded batch + + """ + pass + + def decode(self, ids, skip_special_tokens=True): + """ + Decode the given list of ids back to a string + + This is used to decode anything coming back from a Language Model + + Args: + ids (A :obj:`List/Tuple` of :obj:`int`): + The list of ids that we want to decode + + skip_special_tokens (:obj:`bool`, defaults to :obj:`True`): + Whether the special tokens should be removed from the decoded string + + Returns: + :obj:`str`: The decoded string + """ + pass + + def decode_batch(self, sequences, skip_special_tokens=True): + """ + Decode a batch of ids back to their corresponding string + + Args: + sequences (:obj:`List` of :obj:`List[int]`): + The batch of sequences we want to decode + + skip_special_tokens (:obj:`bool`, defaults to :obj:`True`): + Whether the special tokens should be removed from the decoded strings + + Returns: + :obj:`List[str]`: A list of decoded strings + """ + pass + + @property + def decoder(self): + """ + The `optional` :class:`~tokenizers.decoders.Decoder` in use by the Tokenizer + """ + pass + + @decoder.setter + def decoder(self, value): + """ + The `optional` :class:`~tokenizers.decoders.Decoder` in use by the Tokenizer + """ + pass + + def enable_padding( + self, direction="right", pad_id=0, pad_type_id=0, pad_token="[PAD]", length=None, pad_to_multiple_of=None + ): + """ + Enable the padding + + Args: + direction (:obj:`str`, `optional`, defaults to :obj:`right`): + The direction in which to pad. Can be either ``right`` or ``left`` + + pad_to_multiple_of (:obj:`int`, `optional`): + If specified, the padding length should always snap to the next multiple of the + given value. For example if we were going to pad witha length of 250 but + ``pad_to_multiple_of=8`` then we will pad to 256. + + pad_id (:obj:`int`, defaults to 0): + The id to be used when padding + + pad_type_id (:obj:`int`, defaults to 0): + The type id to be used when padding + + pad_token (:obj:`str`, defaults to :obj:`[PAD]`): + The pad token to be used when padding + + length (:obj:`int`, `optional`): + If specified, the length at which to pad. If not specified we pad using the size of + the longest sequence in a batch. + """ + pass + + def enable_truncation(self, max_length, stride=0, strategy="longest_first", direction="right"): + """ + Enable truncation + + Args: + max_length (:obj:`int`): + The max length at which to truncate + + stride (:obj:`int`, `optional`): + The length of the previous first sequence to be included in the overflowing + sequence + + strategy (:obj:`str`, `optional`, defaults to :obj:`longest_first`): + The strategy used to truncation. Can be one of ``longest_first``, ``only_first`` or + ``only_second``. + + direction (:obj:`str`, defaults to :obj:`right`): + Truncate direction + """ + pass + + def encode(self, sequence, pair=None, is_pretokenized=False, add_special_tokens=True): + """ + Encode the given sequence and pair. This method can process raw text sequences + as well as already pre-tokenized sequences. + + Example: + Here are some examples of the inputs that are accepted:: + + encode("A single sequence")` + encode("A sequence", "And its pair")` + encode([ "A", "pre", "tokenized", "sequence" ], is_pretokenized=True)` + encode( + [ "A", "pre", "tokenized", "sequence" ], [ "And", "its", "pair" ], + is_pretokenized=True + ) + + Args: + sequence (:obj:`~tokenizers.InputSequence`): + The main input sequence we want to encode. This sequence can be either raw + text or pre-tokenized, according to the ``is_pretokenized`` argument: + + - If ``is_pretokenized=False``: :class:`~tokenizers.TextInputSequence` + - If ``is_pretokenized=True``: :class:`~tokenizers.PreTokenizedInputSequence` + + pair (:obj:`~tokenizers.InputSequence`, `optional`): + An optional input sequence. The expected format is the same that for ``sequence``. + + is_pretokenized (:obj:`bool`, defaults to :obj:`False`): + Whether the input is already pre-tokenized + + add_special_tokens (:obj:`bool`, defaults to :obj:`True`): + Whether to add the special tokens + + Returns: + :class:`~tokenizers.Encoding`: The encoded result + + """ + pass + + def encode_batch(self, input, is_pretokenized=False, add_special_tokens=True): + """ + Encode the given batch of inputs. This method accept both raw text sequences + as well as already pre-tokenized sequences. The reason we use `PySequence` is + because it allows type checking with zero-cost (according to PyO3) as we don't + have to convert to check. + + Example: + Here are some examples of the inputs that are accepted:: + + encode_batch([ + "A single sequence", + ("A tuple with a sequence", "And its pair"), + [ "A", "pre", "tokenized", "sequence" ], + ([ "A", "pre", "tokenized", "sequence" ], "And its pair") + ]) + + Args: + input (A :obj:`List`/:obj:`Tuple` of :obj:`~tokenizers.EncodeInput`): + A list of single sequences or pair sequences to encode. Each sequence + can be either raw text or pre-tokenized, according to the ``is_pretokenized`` + argument: + + - If ``is_pretokenized=False``: :class:`~tokenizers.TextEncodeInput` + - If ``is_pretokenized=True``: :class:`~tokenizers.PreTokenizedEncodeInput` + + is_pretokenized (:obj:`bool`, defaults to :obj:`False`): + Whether the input is already pre-tokenized + + add_special_tokens (:obj:`bool`, defaults to :obj:`True`): + Whether to add the special tokens + + Returns: + A :obj:`List` of :class:`~tokenizers.Encoding`: The encoded batch + + """ + pass + + def encode_batch_fast(self, input, is_pretokenized=False, add_special_tokens=True): + """ + Encode the given batch of inputs. This method is faster than `encode_batch` + because it doesn't keep track of offsets, they will be all zeros. + + Example: + Here are some examples of the inputs that are accepted:: + + encode_batch_fast([ + "A single sequence", + ("A tuple with a sequence", "And its pair"), + [ "A", "pre", "tokenized", "sequence" ], + ([ "A", "pre", "tokenized", "sequence" ], "And its pair") + ]) + + Args: + input (A :obj:`List`/:obj:`Tuple` of :obj:`~tokenizers.EncodeInput`): + A list of single sequences or pair sequences to encode. Each sequence + can be either raw text or pre-tokenized, according to the ``is_pretokenized`` + argument: + + - If ``is_pretokenized=False``: :class:`~tokenizers.TextEncodeInput` + - If ``is_pretokenized=True``: :class:`~tokenizers.PreTokenizedEncodeInput` + + is_pretokenized (:obj:`bool`, defaults to :obj:`False`): + Whether the input is already pre-tokenized + + add_special_tokens (:obj:`bool`, defaults to :obj:`True`): + Whether to add the special tokens + + Returns: + A :obj:`List` of :class:`~tokenizers.Encoding`: The encoded batch + + """ + pass + + @property + def encode_special_tokens(self): + """ + Modifies the tokenizer in order to use or not the special tokens + during encoding. + + Args: + value (:obj:`bool`): + Whether to use the special tokens or not + + """ + pass + + @encode_special_tokens.setter + def encode_special_tokens(self, value): + """ + Modifies the tokenizer in order to use or not the special tokens + during encoding. + + Args: + value (:obj:`bool`): + Whether to use the special tokens or not + + """ + pass + + @staticmethod + def from_buffer(buffer): + """ + Instantiate a new :class:`~tokenizers.Tokenizer` from the given buffer. + + Args: + buffer (:obj:`bytes`): + A buffer containing a previously serialized :class:`~tokenizers.Tokenizer` + + Returns: + :class:`~tokenizers.Tokenizer`: The new tokenizer + """ + pass + + @staticmethod + def from_file(path): + """ + Instantiate a new :class:`~tokenizers.Tokenizer` from the file at the given path. + + Args: + path (:obj:`str`): + A path to a local JSON file representing a previously serialized + :class:`~tokenizers.Tokenizer` + + Returns: + :class:`~tokenizers.Tokenizer`: The new tokenizer + """ + pass + + @staticmethod + def from_pretrained(identifier, revision="main", token=None): + """ + Instantiate a new :class:`~tokenizers.Tokenizer` from an existing file on the + Hugging Face Hub. + + Args: + identifier (:obj:`str`): + The identifier of a Model on the Hugging Face Hub, that contains + a tokenizer.json file + revision (:obj:`str`, defaults to `main`): + A branch or commit id + token (:obj:`str`, `optional`, defaults to `None`): + An optional auth token used to access private repositories on the + Hugging Face Hub + + Returns: + :class:`~tokenizers.Tokenizer`: The new tokenizer + """ + pass + + @staticmethod + def from_str(json): + """ + Instantiate a new :class:`~tokenizers.Tokenizer` from the given JSON string. + + Args: + json (:obj:`str`): + A valid JSON string representing a previously serialized + :class:`~tokenizers.Tokenizer` + + Returns: + :class:`~tokenizers.Tokenizer`: The new tokenizer + """ + pass + + def get_added_tokens_decoder(self): + """ + Get the underlying vocabulary + + Returns: + :obj:`Dict[int, AddedToken]`: The vocabulary + """ + pass + + def get_vocab(self, with_added_tokens=True): + """ + Get the underlying vocabulary + + Args: + with_added_tokens (:obj:`bool`, defaults to :obj:`True`): + Whether to include the added tokens + + Returns: + :obj:`Dict[str, int]`: The vocabulary + """ + pass + + def get_vocab_size(self, with_added_tokens=True): + """ + Get the size of the underlying vocabulary + + Args: + with_added_tokens (:obj:`bool`, defaults to :obj:`True`): + Whether to include the added tokens + + Returns: + :obj:`int`: The size of the vocabulary + """ + pass + + def id_to_token(self, id): + """ + Convert the given id to its corresponding token if it exists + + Args: + id (:obj:`int`): + The id to convert + + Returns: + :obj:`Optional[str]`: An optional token, :obj:`None` if out of vocabulary + """ + pass + + @property + def model(self): + """ + The :class:`~tokenizers.models.Model` in use by the Tokenizer + """ + pass + + @model.setter + def model(self, value): + """ + The :class:`~tokenizers.models.Model` in use by the Tokenizer + """ + pass + + def no_padding(self): + """ + Disable padding + """ + pass + + def no_truncation(self): + """ + Disable truncation + """ + pass + + @property + def normalizer(self): + """ + The `optional` :class:`~tokenizers.normalizers.Normalizer` in use by the Tokenizer + """ + pass + + @normalizer.setter + def normalizer(self, value): + """ + The `optional` :class:`~tokenizers.normalizers.Normalizer` in use by the Tokenizer + """ + pass + + def num_special_tokens_to_add(self, is_pair): + """ + Return the number of special tokens that would be added for single/pair sentences. + :param is_pair: Boolean indicating if the input would be a single sentence or a pair + :return: + """ + pass + + @property + def padding(self): + """ + Get the current padding parameters + + `Cannot be set, use` :meth:`~tokenizers.Tokenizer.enable_padding` `instead` + + Returns: + (:obj:`dict`, `optional`): + A dict with the current padding parameters if padding is enabled + """ + pass + + @padding.setter + def padding(self, value): + """ + Get the current padding parameters + + `Cannot be set, use` :meth:`~tokenizers.Tokenizer.enable_padding` `instead` + + Returns: + (:obj:`dict`, `optional`): + A dict with the current padding parameters if padding is enabled + """ + pass + + def post_process(self, encoding, pair=None, add_special_tokens=True): + """ + Apply all the post-processing steps to the given encodings. + + The various steps are: + + 1. Truncate according to the set truncation params (provided with + :meth:`~tokenizers.Tokenizer.enable_truncation`) + 2. Apply the :class:`~tokenizers.processors.PostProcessor` + 3. Pad according to the set padding params (provided with + :meth:`~tokenizers.Tokenizer.enable_padding`) + + Args: + encoding (:class:`~tokenizers.Encoding`): + The :class:`~tokenizers.Encoding` corresponding to the main sequence. + + pair (:class:`~tokenizers.Encoding`, `optional`): + An optional :class:`~tokenizers.Encoding` corresponding to the pair sequence. + + add_special_tokens (:obj:`bool`): + Whether to add the special tokens + + Returns: + :class:`~tokenizers.Encoding`: The final post-processed encoding + """ + pass + + @property + def post_processor(self): + """ + The `optional` :class:`~tokenizers.processors.PostProcessor` in use by the Tokenizer + """ + pass + + @post_processor.setter + def post_processor(self, value): + """ + The `optional` :class:`~tokenizers.processors.PostProcessor` in use by the Tokenizer + """ + pass + + @property + def pre_tokenizer(self): + """ + The `optional` :class:`~tokenizers.pre_tokenizers.PreTokenizer` in use by the Tokenizer + """ + pass + + @pre_tokenizer.setter + def pre_tokenizer(self, value): + """ + The `optional` :class:`~tokenizers.pre_tokenizers.PreTokenizer` in use by the Tokenizer + """ + pass + + def save(self, path, pretty=True): + """ + Save the :class:`~tokenizers.Tokenizer` to the file at the given path. + + Args: + path (:obj:`str`): + A path to a file in which to save the serialized tokenizer. + + pretty (:obj:`bool`, defaults to :obj:`True`): + Whether the JSON file should be pretty formatted. + """ + pass + + def to_str(self, pretty=False): + """ + Gets a serialized string representing this :class:`~tokenizers.Tokenizer`. + + Args: + pretty (:obj:`bool`, defaults to :obj:`False`): + Whether the JSON string should be pretty formatted. + + Returns: + :obj:`str`: A string representing the serialized Tokenizer + """ + pass + + def token_to_id(self, token): + """ + Convert the given token to its corresponding id if it exists + + Args: + token (:obj:`str`): + The token to convert + + Returns: + :obj:`Optional[int]`: An optional id, :obj:`None` if out of vocabulary + """ + pass + + def train(self, files, trainer=None): + """ + Train the Tokenizer using the given files. + + Reads the files line by line, while keeping all the whitespace, even new lines. + If you want to train from data store in-memory, you can check + :meth:`~tokenizers.Tokenizer.train_from_iterator` + + Args: + files (:obj:`List[str]`): + A list of path to the files that we should use for training + + trainer (:obj:`~tokenizers.trainers.Trainer`, `optional`): + An optional trainer that should be used to train our Model + """ + pass + + def train_from_iterator(self, iterator, trainer=None, length=None): + """ + Train the Tokenizer using the provided iterator. + + You can provide anything that is a Python Iterator + + * A list of sequences :obj:`List[str]` + * A generator that yields :obj:`str` or :obj:`List[str]` + * A Numpy array of strings + * ... + + Args: + iterator (:obj:`Iterator`): + Any iterator over strings or list of strings + + trainer (:obj:`~tokenizers.trainers.Trainer`, `optional`): + An optional trainer that should be used to train our Model + + length (:obj:`int`, `optional`): + The total number of sequences in the iterator. This is used to + provide meaningful progress tracking + """ + pass + + @property + def truncation(self): + """ + Get the currently set truncation parameters + + `Cannot set, use` :meth:`~tokenizers.Tokenizer.enable_truncation` `instead` + + Returns: + (:obj:`dict`, `optional`): + A dict with the current truncation parameters if truncation is enabled + """ + pass + + @truncation.setter + def truncation(self, value): + """ + Get the currently set truncation parameters + + `Cannot set, use` :meth:`~tokenizers.Tokenizer.enable_truncation` `instead` + + Returns: + (:obj:`dict`, `optional`): + A dict with the current truncation parameters if truncation is enabled + """ + pass + +from enum import Enum +from typing import List, Tuple, Union, Any + +Offsets = Tuple[int, int] +TextInputSequence = str +PreTokenizedInputSequence = Union[List[str], Tuple[str, ...]] +TextEncodeInput = Union[ + TextInputSequence, + Tuple[TextInputSequence, TextInputSequence], + List[TextInputSequence], +] +PreTokenizedEncodeInput = Union[ + PreTokenizedInputSequence, + Tuple[PreTokenizedInputSequence, PreTokenizedInputSequence], + List[PreTokenizedInputSequence], +] +InputSequence = Union[TextInputSequence, PreTokenizedInputSequence] +EncodeInput = Union[TextEncodeInput, PreTokenizedEncodeInput] + +class OffsetReferential(Enum): + ORIGINAL = "original" + NORMALIZED = "normalized" + +class OffsetType(Enum): + BYTE = "byte" + CHAR = "char" + +class SplitDelimiterBehavior(Enum): + REMOVED = "removed" + ISOLATED = "isolated" + MERGED_WITH_PREVIOUS = "merged_with_previous" + MERGED_WITH_NEXT = "merged_with_next" + CONTIGUOUS = "contiguous" + +from .implementations import ( + BertWordPieceTokenizer, + ByteLevelBPETokenizer, + CharBPETokenizer, + SentencePieceBPETokenizer, + SentencePieceUnigramTokenizer, +) + +def __getattr__(name: str) -> Any: ... + +BertWordPieceTokenizer: Any +ByteLevelBPETokenizer: Any +CharBPETokenizer: Any +SentencePieceBPETokenizer: Any +SentencePieceUnigramTokenizer: Any diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tokenizers/tokenizers.pyi b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers/tokenizers.pyi new file mode 100644 index 0000000000000000000000000000000000000000..abfb272c8a2ec97892d32c3745769e236887fb2d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tokenizers/tokenizers.pyi @@ -0,0 +1,17 @@ +# Generated content DO NOT EDIT +from . import ( + AddedToken as AddedToken, + Encoding as Encoding, + NormalizedString as NormalizedString, + PreTokenizedString as PreTokenizedString, + Regex as Regex, + Token as Token, + Tokenizer as Tokenizer, + __version__ as __version__, + decoders as decoders, + models as models, + normalizers as normalizers, + pre_tokenizers as pre_tokenizers, + processors as processors, + trainers as trainers, +) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/LICENSE b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e5b48e9108a4b70a0d4d54e24970c83baaaf7c93 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/LICENSE @@ -0,0 +1,9057 @@ +From PyTorch: + +Copyright (c) 2016- Facebook, Inc (Adam Paszke) +Copyright (c) 2014- Facebook, Inc (Soumith Chintala) +Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert) +Copyright (c) 2012-2014 Deepmind Technologies (Koray Kavukcuoglu) +Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu) +Copyright (c) 2011-2013 NYU (Clement Farabet) +Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston) +Copyright (c) 2006 Idiap Research Institute (Samy Bengio) +Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz) + +From Caffe2: + +Copyright (c) 2016-present, Facebook Inc. All rights reserved. + +All contributions by Facebook: +Copyright (c) 2016 Facebook Inc. + +All contributions by Google: +Copyright (c) 2015 Google Inc. +All rights reserved. + +All contributions by Yangqing Jia: +Copyright (c) 2015 Yangqing Jia +All rights reserved. + +All contributions by Kakao Brain: +Copyright 2019-2020 Kakao Brain + +All contributions by Cruise LLC: +Copyright (c) 2022 Cruise LLC. +All rights reserved. + +All contributions by Tri Dao: +Copyright (c) 2024 Tri Dao. +All rights reserved. + +All contributions by Arm: +Copyright (c) 2021, 2023-2025 Arm Limited and/or its affiliates + +All contributions from Caffe: +Copyright(c) 2013, 2014, 2015, the respective contributors +All rights reserved. + +All other contributions: +Copyright(c) 2015, 2016 the respective contributors +All rights reserved. + +Caffe2 uses a copyright model similar to Caffe: each contributor holds +copyright over their contributions to Caffe2. The project versioning records +all such contribution and copyright details. If a contributor wants to further +mark their specific copyright on a particular contribution, they should +indicate their copyright solely in the commit message of the change when it is +committed. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the names of Facebook, Deepmind Technologies, NYU, NEC Laboratories America + and IDIAP Research Institute nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + + +The PyTorch repository and source distributions bundle several libraries that are +compatibly licensed. We list these here. + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\FP16 +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\FP16 + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\FP16\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\FXdiv +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\FXdiv + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\FXdiv\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NNPACK +License: BSD-2-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NNPACK + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NNPACK\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NVTX +License: Apache-2.0 with exception +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NVTX + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NVTX\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NVTX\docs +License: Apache-2.0 with exception +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NVTX\docs + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NVTX\docs\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NVTX\python +License: Apache-2.0 with exception +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NVTX\python + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NVTX\python\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\VulkanMemoryAllocator +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\VulkanMemoryAllocator + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\VulkanMemoryAllocator\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\XNNPACK +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\XNNPACK + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\XNNPACK\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\aiter +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\aiter + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\aiter\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\aiter\3rdparty\composable_kernel +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\aiter\3rdparty\composable_kernel + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\aiter\3rdparty\composable_kernel\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\benchmark +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\benchmark + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\benchmark\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\composable_kernel +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\composable_kernel + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\composable_kernel\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cpp-httplib +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cpp-httplib + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cpp-httplib\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cpuinfo +License: BSD-2-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cpuinfo + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cpuinfo\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cpuinfo\deps\clog +License: BSD-2-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cpuinfo\deps\clog + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cpuinfo\deps\clog\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cudnn_frontend +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cudnn_frontend + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cudnn_frontend\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cutlass +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cutlass + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cutlass\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cutlass\python +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cutlass\python + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cutlass\python\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\composable_kernel +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\composable_kernel + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\composable_kernel\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cpuinfo +License: BSD-2-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cpuinfo + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cpuinfo\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cpuinfo\deps\clog +License: BSD-2-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cpuinfo\deps\clog + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cpuinfo\deps\clog\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cutlass +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cutlass + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cutlass\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cutlass\python +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cutlass\python + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cutlass\python\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\googletest +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\googletest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\googletest\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\hipify_torch +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\hipify_torch + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\hipify_torch\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\fbgemm_gpu\experimental\hstu +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\fbgemm_gpu\experimental\hstu + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\fbgemm_gpu\experimental\hstu\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\fbgemm_gpu\src\quantize_ops\mx +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\fbgemm_gpu\src\quantize_ops\mx + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\fbgemm_gpu\src\quantize_ops\mx\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\fbgemm_gpu\test\quantize\mx +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\fbgemm_gpu\test\quantize\mx + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\fbgemm_gpu\test\quantize\mx\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\csrc\composable_kernel +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\csrc\composable_kernel + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\csrc\composable_kernel\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\csrc\cutlass +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\csrc\cutlass + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\csrc\cutlass\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\csrc\cutlass\python +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\csrc\cutlass\python + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\csrc\cutlass\python\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flatbuffers +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flatbuffers + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flatbuffers\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flatbuffers\dart +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flatbuffers\dart + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flatbuffers\dart\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flatbuffers\swift +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flatbuffers\swift + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flatbuffers\swift\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fmt +License: MIT with exception +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fmt + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fmt\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\gemmlowp\gemmlowp +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\gemmlowp\gemmlowp + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\gemmlowp\gemmlowp\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\gloo +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\gloo + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\gloo\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\googletest +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\googletest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\googletest\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\ideep +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\ideep + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\ideep\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\ideep\mkl-dnn +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\ideep\mkl-dnn + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\ideep\mkl-dnn\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\ideep\mkl-dnn\tests\gtests\gtest +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\ideep\mkl-dnn\tests\gtests\gtest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\ideep\mkl-dnn\tests\gtests\gtest\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\DCGM +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\DCGM + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\DCGM\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\DCGM\testing\python3\libs_3rdparty\colorama +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\DCGM\testing\python3\libs_3rdparty\colorama + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\DCGM\testing\python3\libs_3rdparty\colorama\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\cpr +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\cpr + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\cpr\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\cpr\test +License: MIT with exception +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\cpr\test + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\cpr\test\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\fmt +License: MIT with exception +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\fmt + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\fmt\LICENSE.rst + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\googletest +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\googletest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\googletest\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\json\test\thirdparty\doctest +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\json\test\thirdparty\doctest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\json\test\thirdparty\doctest\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\json\third_party\cpplint +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\json\third_party\cpplint + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\json\third_party\cpplint\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\pfs +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\pfs + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\pfs\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\civetweb\examples\rest\cJSON +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\civetweb\examples\rest\cJSON + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\civetweb\examples\rest\cJSON\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.5.2 +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.5.2 + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.5.2\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.8.0 +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.8.0 + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.8.0\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\googletest +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\googletest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\googletest\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\googletest\googlemock\scripts\generator +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\googletest\googlemock\scripts\generator + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\googletest\googlemock\scripts\generator\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\fmt +License: MIT with exception +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\fmt + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\fmt\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\googletest +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\googletest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\googletest\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\tb_plugin +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\tb_plugin + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\tb_plugin\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\mimalloc +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\mimalloc + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\mimalloc\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\miniz-3.0.2 +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\miniz-3.0.2 + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\miniz-3.0.2\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\onnx +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\onnx + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\onnx\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\onnx\third_party\pybind11 +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\onnx\third_party\pybind11 + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\onnx\third_party\pybind11\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\exporters\etw\include\opentelemetry\exporters\etw +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\exporters\etw\include\opentelemetry\exporters\etw + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\exporters\etw\include\opentelemetry\exporters\etw\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\benchmark +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\benchmark + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\benchmark\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\googletest +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\googletest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\googletest\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\ms-gsl +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\ms-gsl + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\ms-gsl\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentelemetry-proto +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentelemetry-proto + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentelemetry-proto\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\3rd_party\include\opentracing\catch2 +License: BSL-1.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\3rd_party\include\opentracing\catch2 + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\3rd_party\include\opentracing\catch2\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\3rd_party\include\opentracing\expected +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\3rd_party\include\opentracing\expected + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\3rd_party\include\opentracing\expected\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\3rd_party\include\opentracing\variant +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\3rd_party\include\opentracing\variant + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\3rd_party\include\opentracing\variant\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\civetweb\examples\rest\cJSON +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\civetweb\examples\rest\cJSON + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\civetweb\examples\rest\cJSON\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.5.2 +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.5.2 + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.5.2\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.8.0 +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.8.0 + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.8.0\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\googletest +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\googletest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\googletest\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\googletest\googlemock\scripts\generator +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\googletest\googlemock\scripts\generator + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\googletest\googlemock\scripts\generator\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\boost-vcpkg-helpers +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\boost-vcpkg-helpers + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\boost-vcpkg-helpers\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\ffnvcodec +License: MIT with exception +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\ffnvcodec + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\ffnvcodec\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\gettimeofday +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\gettimeofday + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\gettimeofday\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\hungarian +License: Permissive (free to use) +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\hungarian + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\hungarian\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\irrlicht +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\irrlicht + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\irrlicht\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\libstemmer +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\libstemmer + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\libstemmer\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\pdcurses +License: Public Domain for core +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\pdcurses + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\pdcurses\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\physac +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\physac + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\physac\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\pqp +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\pqp + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\pqp\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\sigslot +License: Public Domain +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\sigslot + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\sigslot\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\tensorflow-common +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\tensorflow-common + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\tensorflow-common\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\vulkan +License: Apache-2.0 with exception +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\vulkan + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\vulkan\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\benchmark +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\benchmark + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\benchmark\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\googlemock +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\googlemock + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\googlemock\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\googlemock\scripts\generator +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\googlemock\scripts\generator + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\googlemock\scripts\generator\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\googletest +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\googletest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\googletest\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\psimd +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\psimd + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\psimd\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\pthreadpool +License: BSD-2-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\pthreadpool + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\pthreadpool\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\pybind11 +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\pybind11 + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\pybind11\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\python-peachpy +License: BSD-2-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\python-peachpy + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\python-peachpy\LICENSE.rst + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\sleef +License: BSL-1.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\sleef + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\sleef\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\LICENSE.txt + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\googlemock +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\googlemock + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\googlemock\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\googlemock\scripts\generator +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\googlemock\scripts\generator + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\googlemock\scripts\generator\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\googletest +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\googletest + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\googletest\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\libnop +License: Apache-2.0 +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\libnop + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\libnop\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\libuv +License: MIT +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\libuv + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\libuv\LICENSE + +Name: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\pybind11 +License: BSD-3-Clause +Files: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\pybind11 + For details, see the files concatenated below: C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\pybind11\LICENSE + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\FP16\LICENSE +------------------------------------------------------------------------ +The MIT License (MIT) + +Copyright (c) 2017 Facebook Inc. +Copyright (c) 2017 Georgia Institute of Technology +Copyright 2019 Google LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\FXdiv\LICENSE +------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2017 Facebook Inc. +Copyright (c) 2016-2017 Marat Dukhan + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NNPACK\LICENSE +-------------------------------------------------------------------------- +Copyright (c) 2017 Facebook Inc. +Copyright (c) 2015-2017, Georgia Institute of Technology +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NVTX\LICENSE.txt +---------------------------------------------------------------------------- +============================================================================== +NVTX is under the Apache License v2.0 with LLVM Exceptions: +============================================================================== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +---- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. + + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NVTX\docs\LICENSE.txt +--------------------------------------------------------------------------------- +============================================================================== +NVTX is under the Apache License v2.0 with LLVM Exceptions: +============================================================================== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +---- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. + + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\NVTX\python\LICENSE.txt +----------------------------------------------------------------------------------- +============================================================================== +NVTX is under the Apache License v2.0 with LLVM Exceptions: +============================================================================== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +---- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. + + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\VulkanMemoryAllocator\LICENSE.txt +--------------------------------------------------------------------------------------------- +Copyright (c) 2017-2025 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\XNNPACK\LICENSE +--------------------------------------------------------------------------- +BSD License + +For XNNPACK software + +Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. +Copyright 2019 Google LLC + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name Facebook nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\aiter\LICENSE +------------------------------------------------------------------------- +Copyright © Advanced Micro Devices, Inc. All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\aiter\3rdparty\composable_kernel\LICENSE +---------------------------------------------------------------------------------------------------- +Copyright (c) 2018- , Advanced Micro Devices, Inc. (Chao Liu, Jing Zhang) +Copyright (c) 2019- , Advanced Micro Devices, Inc. (Letao Qin, Qianfeng Zhang, Liang Huang, Shaojie Wang) +Copyright (c) 2022- , Advanced Micro Devices, Inc. (Anthony Chang, Chunyu Lai, Illia Silin, Adam Osewski, Poyen Chen, Jehandad Khan) +Copyright (c) 2019-2021, Advanced Micro Devices, Inc. (Hanwen Chang) +Copyright (c) 2019-2020, Advanced Micro Devices, Inc. (Tejash Shah) +Copyright (c) 2020 , Advanced Micro Devices, Inc. (Xiaoyan Zhou) +Copyright (c) 2021-2022, Advanced Micro Devices, Inc. (Jianfeng Yan) + +SPDX-License-Identifier: MIT +Copyright (c) 2018-2025, Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\benchmark\LICENSE +----------------------------------------------------------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\composable_kernel\LICENSE +------------------------------------------------------------------------------------- +Copyright (c) 2018- , Advanced Micro Devices, Inc. (Chao Liu, Jing Zhang) +Copyright (c) 2019- , Advanced Micro Devices, Inc. (Letao Qin, Qianfeng Zhang, Liang Huang, Shaojie Wang) +Copyright (c) 2022- , Advanced Micro Devices, Inc. (Anthony Chang, Chunyu Lai, Illia Silin, Adam Osewski, Poyen Chen, Jehandad Khan) +Copyright (c) 2019-2021, Advanced Micro Devices, Inc. (Hanwen Chang) +Copyright (c) 2019-2020, Advanced Micro Devices, Inc. (Tejash Shah) +Copyright (c) 2020 , Advanced Micro Devices, Inc. (Xiaoyan Zhou) +Copyright (c) 2021-2022, Advanced Micro Devices, Inc. (Jianfeng Yan) + +SPDX-License-Identifier: MIT +Copyright (c) 2018-2025, Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cpp-httplib\LICENSE +------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2017 yhirose + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cpuinfo\LICENSE +--------------------------------------------------------------------------- +Copyright (c) 2019 Google LLC +Copyright (c) 2017-2018 Facebook Inc. +Copyright (C) 2012-2017 Georgia Institute of Technology +Copyright (C) 2010-2012 Marat Dukhan + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cpuinfo\deps\clog\LICENSE +------------------------------------------------------------------------------------- +Copyright (C) 2018 Marat Dukhan +Copyright (c) 2017-2018 Facebook Inc. +Copyright (c) 2017 Georgia Institute of Technology + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cudnn_frontend\LICENSE.txt +-------------------------------------------------------------------------------------- +/* + * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cutlass\LICENSE.txt +------------------------------------------------------------------------------- +Copyright (c) 2017 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +SPDX-License-Identifier: BSD-3-Clause + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Certain files within this repository are subject to separate licensing terms: + +- The files located in the `python/CuTeDSL` directory are licensed under the + NVIDIA End User License Agreement (EULA). Please refer to + https://docs.nvidia.com/cutlass/media/docs/pythonDSL/license.html + for the full terms. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\cutlass\python\LICENSE.txt +-------------------------------------------------------------------------------------- +Copyright (c) 2017 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +SPDX-License-Identifier: BSD-3-Clause + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\LICENSE +-------------------------------------------------------------------------- +BSD License + +For FBGEMM software + +Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name Facebook nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\composable_kernel\LICENSE +----------------------------------------------------------------------------------------------------- +Copyright (c) 2018- , Advanced Micro Devices, Inc. (Chao Liu, Jing Zhang) +Copyright (c) 2019- , Advanced Micro Devices, Inc. (Letao Qin, Qianfeng Zhang, Liang Huang, Shaojie Wang) +Copyright (c) 2022- , Advanced Micro Devices, Inc. (Anthony Chang, Chunyu Lai, Illia Silin, Adam Osewski, Poyen Chen, Jehandad Khan) +Copyright (c) 2019-2021, Advanced Micro Devices, Inc. (Hanwen Chang) +Copyright (c) 2019-2020, Advanced Micro Devices, Inc. (Tejash Shah) +Copyright (c) 2020 , Advanced Micro Devices, Inc. (Xiaoyan Zhou) +Copyright (c) 2021-2022, Advanced Micro Devices, Inc. (Jianfeng Yan) + +SPDX-License-Identifier: MIT +Copyright (c) 2018-2025, Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cpuinfo\LICENSE +------------------------------------------------------------------------------------------- +Copyright (c) 2019 Google LLC +Copyright (c) 2017-2018 Facebook Inc. +Copyright (C) 2012-2017 Georgia Institute of Technology +Copyright (C) 2010-2012 Marat Dukhan + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cpuinfo\deps\clog\LICENSE +----------------------------------------------------------------------------------------------------- +Copyright (C) 2018 Marat Dukhan +Copyright (c) 2017-2018 Facebook Inc. +Copyright (c) 2017 Georgia Institute of Technology + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cutlass\LICENSE.txt +----------------------------------------------------------------------------------------------- +Copyright (c) 2017 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +SPDX-License-Identifier: BSD-3-Clause + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Certain files within this repository are subject to separate licensing terms: + +- The files located in the `python/CuTeDSL` directory are licensed under the + NVIDIA End User License Agreement (EULA). Please refer to + https://docs.nvidia.com/cutlass/media/docs/pythonDSL/license.html + for the full terms. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\cutlass\python\LICENSE.txt +------------------------------------------------------------------------------------------------------ +Copyright (c) 2017 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +SPDX-License-Identifier: BSD-3-Clause + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\googletest\LICENSE +---------------------------------------------------------------------------------------------- +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\external\hipify_torch\LICENSE.txt +---------------------------------------------------------------------------------------------------- +MIT License + +Copyright (c) 2021-2024, Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\fbgemm_gpu\experimental\hstu\LICENSE +------------------------------------------------------------------------------------------------------- +BSD 3-Clause License + +Copyright (c) 2022, the respective contributors, as shown by the AUTHORS file. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* + * SPDX-FileCopyrightText: Copyright (c) <2024> NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: LicenseRef-NvidiaProprietary + * + * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual + * property and proprietary rights in and to this material, related + * documentation and any modifications thereto. Any use, reproduction, + * disclosure or distribution of this material and related documentation + * without an express license agreement from NVIDIA CORPORATION or + * its affiliates is strictly prohibited. + */ + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\fbgemm_gpu\src\quantize_ops\mx\LICENSE +--------------------------------------------------------------------------------------------------------- + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fbgemm\fbgemm_gpu\test\quantize\mx\LICENSE +------------------------------------------------------------------------------------------------------ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\LICENSE +----------------------------------------------------------------------------------- +BSD 3-Clause License + +Copyright (c) 2022, the respective contributors, as shown by the AUTHORS file. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\csrc\composable_kernel\LICENSE +---------------------------------------------------------------------------------------------------------- +Copyright (c) 2018- , Advanced Micro Devices, Inc. (Chao Liu, Jing Zhang) +Copyright (c) 2019- , Advanced Micro Devices, Inc. (Letao Qin, Qianfeng Zhang, Liang Huang, Shaojie Wang) +Copyright (c) 2022- , Advanced Micro Devices, Inc. (Anthony Chang, Chunyu Lai, Illia Silin, Adam Osewski, Poyen Chen, Jehandad Khan) +Copyright (c) 2019-2021, Advanced Micro Devices, Inc. (Hanwen Chang) +Copyright (c) 2019-2020, Advanced Micro Devices, Inc. (Tejash Shah) +Copyright (c) 2020 , Advanced Micro Devices, Inc. (Xiaoyan Zhou) +Copyright (c) 2021-2022, Advanced Micro Devices, Inc. (Jianfeng Yan) + +SPDX-License-Identifier: MIT +Copyright (c) 2018-2024, Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\csrc\cutlass\LICENSE.txt +---------------------------------------------------------------------------------------------------- +Copyright (c) 2017 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +SPDX-License-Identifier: BSD-3-Clause + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flash-attention\csrc\cutlass\python\LICENSE.txt +----------------------------------------------------------------------------------------------------------- +Copyright (c) 2017 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +SPDX-License-Identifier: BSD-3-Clause + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flatbuffers\LICENSE +------------------------------------------------------------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flatbuffers\dart\LICENSE +------------------------------------------------------------------------------------ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2014 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\flatbuffers\swift\LICENSE +------------------------------------------------------------------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\fmt\LICENSE +----------------------------------------------------------------------- +Copyright (c) 2012 - present, Victor Zverovich and {fmt} contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- Optional exception to the license --- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into a machine-executable object form of such +source code, you may redistribute such embedded portions in such object form +without including the above copyright and permission notices. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\gemmlowp\gemmlowp\LICENSE +------------------------------------------------------------------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\gloo\LICENSE +------------------------------------------------------------------------ +BSD License + +For Gloo software + +Copyright (c) 2017-present, Facebook, Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name Facebook nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\googletest\LICENSE +------------------------------------------------------------------------------ +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\ideep\LICENSE +------------------------------------------------------------------------- +Copyright (c) 2018 Intel Corporation. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\ideep\mkl-dnn\LICENSE +--------------------------------------------------------------------------------- + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + ============================================================================ + + Copyright 2016-2023 Intel Corporation + Copyright 2018 YANDEX LLC + Copyright 2019-2023 FUJITSU LIMITED + Copyright 2020-2023 Arm Ltd. and affiliates + Copyright 2020-2022 Codeplay Software Limited + Copyright 2021 Alanna Tempest + Copyright 2022-2023 IBM Corporation + Copyright 2023 KNS Group LLC (YADRO) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + This distribution includes third party software ("third party programs"). + This third party software, even if included with the distribution of + the Intel software, may be governed by separate license terms, including + without limitation, third party license terms, other Intel software license + terms, and open source software license terms. These separate license terms + govern your use of the third party programs as set forth in the + "THIRD-PARTY-PROGRAMS" file. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\ideep\mkl-dnn\tests\gtests\gtest\LICENSE +---------------------------------------------------------------------------------------------------- +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\LICENSE +-------------------------------------------------------------------------- +BSD License + +For Kineto software + +Copyright (c) Meta Platforms, Inc. and affiliates. + +All contributions by Microsoft: +Copyright (c) Microsoft Corporation. (The Azure AI Platform team) + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name Meta nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\LICENSE +-------------------------------------------------------------------------------------------------------- +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\DCGM\LICENSE +------------------------------------------------------------------------------------------------------------------------- +Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\DCGM\testing\python3\libs_3rdparty\colorama\LICENSE.txt +-------------------------------------------------------------------------------------------------------------------------------------------------------------------- +Copyright (c) 2010 Jonathan Hartley + +Released under the New BSD license (reproduced below), or alternatively you may +use this software under any OSI approved open source license such as those at +http://opensource.org/licenses/alphabetical + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name(s) of the copyright holders, nor those of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\cpr\LICENSE +------------------------------------------------------------------------------------------------------------------------ +This license applies to everything except the contents of the "test" +directory and its subdirectories. + +MIT License + +Copyright (c) 2017-2021 Huu Nguyen +Copyright (c) 2022 libcpr and many other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\cpr\test\LICENSE +----------------------------------------------------------------------------------------------------------------------------- +This license applies to everything inside this directory and all +subdirectories. + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\fmt\LICENSE.rst +---------------------------------------------------------------------------------------------------------------------------- +Copyright (c) 2012 - present, Victor Zverovich + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- Optional exception to the license --- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into a machine-executable object form of such +source code, you may redistribute such embedded portions in such object form +without including the above copyright and permission notices. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\googletest\LICENSE +------------------------------------------------------------------------------------------------------------------------------- +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\json\test\thirdparty\doctest\LICENSE.txt +----------------------------------------------------------------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2016-2021 Viktor Kirilov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\json\third_party\cpplint\LICENSE +--------------------------------------------------------------------------------------------------------------------------------------------- +cpplint.py and its corresponding unit tests are Copyright (C) 2009 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\pfs\LICENSE +------------------------------------------------------------------------------------------------------------------------ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2020-present Daniel Trugman + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\LICENSE +----------------------------------------------------------------------------------------------------------------------------------- +MIT License + +Copyright (c) 2016-2021 Jupp Mueller +Copyright (c) 2017-2022 Gregor Jasny + +And many contributors, see +https://github.com/jupp0r/prometheus-cpp/graphs/contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\civetweb\examples\rest\cJSON\LICENSE +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.5.2\LICENSE.txt +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +=============== +Duktape license +=============== + +(http://opensource.org/licenses/MIT) + +Copyright (c) 2013-2016 by Duktape authors (see AUTHORS.rst) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.8.0\LICENSE.txt +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +=============== +Duktape license +=============== + +(http://opensource.org/licenses/MIT) + +Copyright (c) 2013-2017 by Duktape authors (see AUTHORS.rst) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\googletest\LICENSE +------------------------------------------------------------------------------------------------------------------------------------------------------- +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\dynolog\third_party\prometheus-cpp\3rdparty\googletest\googlemock\scripts\generator\LICENSE +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [2007] Neal Norwitz + Portions Copyright [2007] Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\fmt\LICENSE +---------------------------------------------------------------------------------------------------- +Copyright (c) 2012 - present, Victor Zverovich and {fmt} contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- Optional exception to the license --- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into a machine-executable object form of such +source code, you may redistribute such embedded portions in such object form +without including the above copyright and permission notices. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\libkineto\third_party\googletest\LICENSE +----------------------------------------------------------------------------------------------------------- +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\kineto\tb_plugin\LICENSE +------------------------------------------------------------------------------------ +BSD License + +For Kineto software + +Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. + +All contributions by Microsoft: +Copyright (c) Microsoft Corporation. (The Azure AI Platform team) + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name Facebook nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\mimalloc\LICENSE +---------------------------------------------------------------------------- +MIT License + +Copyright (c) 2018-2025 Microsoft Corporation, Daan Leijen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\miniz-3.0.2\LICENSE +------------------------------------------------------------------------------- +Copyright 2013-2014 RAD Game Tools and Valve Software +Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC + +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\onnx\LICENSE +------------------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\onnx\third_party\pybind11\LICENSE +--------------------------------------------------------------------------------------------- +Copyright (c) 2016 Wenzel Jakob , All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Please also refer to the file .github/CONTRIBUTING.md, which clarifies licensing of +external contributions to this project including patches, pull requests, etc. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\LICENSE +------------------------------------------------------------------------------------- + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\exporters\etw\include\opentelemetry\exporters\etw\LICENSE +--------------------------------------------------------------------------------------------------------------------------------------- +TraceLogging Dynamic for Windows + +Copyright (c) Microsoft Corporation. All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\benchmark\LICENSE +----------------------------------------------------------------------------------------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\googletest\LICENSE +------------------------------------------------------------------------------------------------------------ +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\ms-gsl\LICENSE +-------------------------------------------------------------------------------------------------------- +Copyright (c) 2015 Microsoft Corporation. All rights reserved. + +This code is licensed under the MIT License (MIT). + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentelemetry-proto\LICENSE +--------------------------------------------------------------------------------------------------------------------- + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\LICENSE +----------------------------------------------------------------------------------------------------------------- + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright The OpenTracing Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\3rd_party\include\opentracing\catch2\LICENSE.txt +---------------------------------------------------------------------------------------------------------------------------------------------------------- +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\3rd_party\include\opentracing\expected\LICENSE +-------------------------------------------------------------------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2015 Martin Moene +Copyright (c) 2015 Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\opentracing-cpp\3rd_party\include\opentracing\variant\LICENSE +------------------------------------------------------------------------------------------------------------------------------------------------------- +Copyright (c) MapBox +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. +- Neither the name "MapBox" nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\LICENSE +---------------------------------------------------------------------------------------------------------------- +MIT License + +Copyright (c) 2016-2021 Jupp Mueller +Copyright (c) 2017-2022 Gregor Jasny + +And many contributors, see +https://github.com/jupp0r/prometheus-cpp/graphs/contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\civetweb\examples\rest\cJSON\LICENSE +------------------------------------------------------------------------------------------------------------------------------------------------------ +Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.5.2\LICENSE.txt +-------------------------------------------------------------------------------------------------------------------------------------------------------------------- +=============== +Duktape license +=============== + +(http://opensource.org/licenses/MIT) + +Copyright (c) 2013-2016 by Duktape authors (see AUTHORS.rst) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\civetweb\src\third_party\duktape-1.8.0\LICENSE.txt +-------------------------------------------------------------------------------------------------------------------------------------------------------------------- +=============== +Duktape license +=============== + +(http://opensource.org/licenses/MIT) + +Copyright (c) 2013-2017 by Duktape authors (see AUTHORS.rst) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\googletest\LICENSE +------------------------------------------------------------------------------------------------------------------------------------ +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\third_party\prometheus-cpp\3rdparty\googletest\googlemock\scripts\generator\LICENSE +----------------------------------------------------------------------------------------------------------------------------------------------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [2007] Neal Norwitz + Portions Copyright [2007] Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\LICENSE.txt +----------------------------------------------------------------------------------------------------- +MIT License + +Copyright (c) Microsoft Corporation + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be included in all copies +or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\boost-vcpkg-helpers\LICENSE.txt +------------------------------------------------------------------------------------------------------------------------------- +Copyright (c) Microsoft Corporation + +All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\ffnvcodec\LICENSE.txt +--------------------------------------------------------------------------------------------------------------------- +GNU LESSER GENERAL PUBLIC LICENSE +Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] +Preamble +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. + +This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. + +When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. + +To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. + +For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. + +We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. + +To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. + +Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. + +Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. + +When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. + +We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. + +For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. + +In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. + +Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. + +The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". + +A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + +a) The modified work must itself be a software library. +b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. +c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. +d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. +(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. + +Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the Library into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. + +5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. + +However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. + +When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. + +If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. + +6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: + +a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) +b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. +c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. +d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. +e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. +For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. + +7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: + +a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. +b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. +8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. + +11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS +How to Apply These Terms to Your New Libraries +If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). + +To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + +one line to give the library's name and an idea of what it does. +Copyright (C) year name of author + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in +the library `Frob' (a library for tweaking knobs) written +by James Random Hacker. + +signature of Ty Coon, 1 April 1990 +Ty Coon, President of Vice +That's all there is to it! + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\gettimeofday\LICENSE +-------------------------------------------------------------------------------------------------------------------- +/* + * Copied from PostgreSQL source: + * http://doxygen.postgresql.org/gettimeofday_8c_source.html + * + */ + +/* + * gettimeofday.c + * Win32 gettimeofday() replacement + * + * src/port/gettimeofday.c + * + * Copyright (c) 2003 SRA, Inc. + * Copyright (c) 2003 SKC, Inc. + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose, without fee, and without a + * written agreement is hereby granted, provided that the above + * copyright notice and this paragraph and the following two + * paragraphs appear in all copies. + * + * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, + * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING + * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS + * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS + * IS" BASIS, AND THE AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, + * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\hungarian\LICENSE.txt +--------------------------------------------------------------------------------------------------------------------- +/******************************************************************** + ******************************************************************** + ** + ** libhungarian by Cyrill Stachniss, 2004 + ** + ** + ** Solving the Minimum Assignment Problem using the + ** Hungarian Method. + ** + ** ** This file may be freely copied and distributed! ** + ** + ** Parts of the used code was originally provided by the + ** "Stanford GraphGase", but I made changes to this code. + ** As asked by the copyright node of the "Stanford GraphGase", + ** I hereby proclaim that this file are *NOT* part of the + ** "Stanford GraphGase" distrubition! + ** + ** This file is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied + ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + ** PURPOSE. + ** + ******************************************************************** + ********************************************************************/ + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\irrlicht\LICENSE.txt +-------------------------------------------------------------------------------------------------------------------- +The Irrlicht Engine License +=========================== + +Copyright (C) 2002-2015 Nikolaus Gebhardt + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgement in the product documentation would be + appreciated but is not required. +2. Altered source versions must be clearly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\libstemmer\LICENSE +------------------------------------------------------------------------------------------------------------------ +Snowball - License +Except where explicitly noted, all the software given out on this Snowball site is covered by the 3-clause BSD License: + +Copyright (c) 2001, Dr Martin Porter, +Copyright (c) 2002, Richard Boulton. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Essentially, all this means is that you can do what you like with the code, except claim another Copyright for it, or claim that it is issued under a different license. The software is also issued without warranties, which means that if anyone suffers through its use, they cannot come back and sue you. You also have to alert anyone to whom you give the Snowball software to the fact that it is covered by the BSD license. + +We have not bothered to insert the licensing arrangement into the text of the Snowball software. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\pdcurses\LICENSE +---------------------------------------------------------------------------------------------------------------- +The core package is in the public domain, but small portions of PDCurses are subject to copyright under various licenses. + +The win32 files are released to the public domain. + +If you use PDCurses in an application, an acknowledgement would be appreciated, but is not mandatory. If you make corrections or enhancements to PDCurses, please forward them to the current maintainer for the benefit of other users. + +This software is provided AS IS with NO WARRANTY whatsoever. + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\physac\LICENSE +-------------------------------------------------------------------------------------------------------------- +MIT License + +Copyright (c) 2022 Víctor Fisac + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\pqp\LICENSE +----------------------------------------------------------------------------------------------------------- +Copyright 1999 University of North Carolina at Chapel Hill. +All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for educational, research, and non-profit purposes, without fee, +and without a written agreement is hereby granted, provided that the above +copyright notice and the following three paragraphs appear in all copies. + +IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL BE LIABLE TO +ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, +INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS +DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL SPECIFICALLY DISCLAIMS ANY +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED +HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA AT +CHAPEL HILL HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, +ENHANCEMENTS, OR MODIFICATIONS. + +The authors may be contacted via: + +US Mail: Eric Larsen, Stefan Gottschalk + Department of Computer Science + Sitterson Hall, CB #3175 + University of North Carolina + Chapel Hill, NC 27599-3175 + +Phone: (919) 962-1749 + +Email: geom@cs.unc.edu + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\sigslot\LICENSE +--------------------------------------------------------------------------------------------------------------- +License +The sigslot library has been placed in the public domain. This means that you are free to use it however you like. + +The author takes no responsibility or liability of any kind for any use that you may make of this library. + +If you screw up, it's your fault. + +If the library screws up, you got it for free, so you should have tested it better - it's still your responsibility. + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\tensorflow-common\LICENSE.txt +----------------------------------------------------------------------------------------------------------------------------- +Copyright (c) Microsoft Corporation + +All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\opentelemetry-cpp\tools\vcpkg\ports\vulkan\LICENSE.txt +------------------------------------------------------------------------------------------------------------------ +/* +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and +You must cause any modified files to carry prominent notices stating that You changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +=============================================================================================================================================== + +/Copyright (C) 2012 LunarG, Inc. +//All rights reserved. +// +//Redistribution and use in source and binary forms, with or without +//modification, are permitted provided that the following conditions +//are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of LunarG Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +//POSSIBILITY OF SUCH DAMAGE. + +=============================================================================================================================================== + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# Copyright 2007-2008 Miguel A. Figueroa-Villanueva +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright_cmake.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + + +============================================================================================================================================== + +// +// Copyright (C) 2015-2018 Google, Inc. +// Copyright (C) +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +========================================================================================================================================== + +Note: This license has also been called the "New BSD License" or "Modified BSD License". See also the 2-clause BSD License. +Copyright +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +========================================================================================================================================== + +/* +* xxHash - Fast Hash algorithm +* Copyright (C) 2012-2016, Yann Collet +* +* BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are +* met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the following disclaimer +* in the documentation and/or other materials provided with the +* distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You can contact the author at : +* - xxHash homepage: http://www.xxhash.com +* - xxHash source repository : https://github.com/Cyan4973/xxHash +*/ + + +=========================================================================================================================================== + +# Copyright (C) 2018 Google, Inc. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +========================================================================================================================================== + +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C +Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains +part or all of the Bison parser skeleton and distribute that work +under terms of your choice, so long as that work isn't itself a +parser generator using the skeleton or a modified version thereof +as a parser skeleton. Alternatively, if you modify or redistribute +the parser skeleton itself, you may (at your option) remove this +special exception, which will cause the skeleton and the resulting +Bison output files to be licensed under the GNU General Public +License without this special exception. +This special exception was added by the Free Software Foundation in +version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by +simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid +infringing on user name space. This should be done even for local +variables, as they might otherwise be expanded by user macros. +There are some unavoidable exceptions within include files to +define necessary library symbols; they are noted "INFRINGES ON +USER NAME SPACE" below. */ + +============================================================================================================================================== + +copyright : [ +Copyright (c) 2017 The Khronos Group Inc., +, +Permission is hereby granted, free of charge, to any person obtaining a copy, +of this software and/or associated documentation files (the \Materials\"),", +to deal in the Materials without restriction, including without limitation, +the rights to use, copy, modify, merge, publish, distribute, sublicense,, +and/or sell copies of the Materials, and to permit persons to whom the, +Materials are furnished to do so, subject to the following conditions:, +, +The above copyright notice and this permission notice shall be included in, +all copies or substantial portions of the Materials., +, +MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS, +STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND, +HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ , +, +THE MATERIALS ARE PROVIDED \AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL, +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER, +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING, +FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS, +IN THE MATERIALS. + +============================================================================================================================================= + +CMake - Cross Platform Makefile Generator +Copyright 2000-2009 Kitware, Inc., Insight Software Consortium +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +* Neither the names of Kitware, Inc., the Insight Software Consortium, +nor the names of their contributors may be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ + +The above copyright and license notice applies to distributions of +CMake in source and binary form. Some source files contain additional +notices of original copyright by their contributors; see each source +for details. Third-party software packages supplied with CMake under +compatible licenses provide their own copyright notices documented in +corresponding subdirectories. + +------------------------------------------------------------------------------ + +CMake was initially developed by Kitware with the following sponsorship: + +* National Library of Medicine at the National Institutes of Health +as part of the Insight Segmentation and Registration Toolkit (ITK). + +* US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel +Visualization Initiative. + +* National Alliance for Medical Image Computing (NAMIC) is funded by the +National Institutes of Health through the NIH Roadmap for Medical Research, +Grant U54 EB005149. + +* Kitware, Inc. + +======================================================================================================================================== + +The authors of this software are Rob Pike and Ken Thompson. +* Copyright (c) 2002 by Lucent Technologies. +* Permission to use, copy, modify, and distribute this software for any +* purpose without fee is hereby granted, provided that this entire notice +* is included in all copies of any software which is or includes a copy +* or modification of this software and in all copies of the supporting +* documentation for such software. +* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED +* WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY +* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY +* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + + +======================================================================================================================================== + +Copyright (c) 2015-2018 Baldur Karlsson + +Copyright (c) 2014 Crytek + +Copyright (c) 1998-2018 Third party code and tools + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +========================================================================================================================================= + +/* +Copyright (c) 2009 Dave Gamble +Copyright (c) 2015-2016 The Khronos Group Inc. +Copyright (c) 2015-2016 Valve Corporation +Copyright (c) 2015-2016 LunarG, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +=========================================================================================================================================== + +Copyright (c) 2005 - 2017 G-Truc Creation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + + +========================================================================================================================================== + +/* +The JsonCpp library's source code, including accompanying documentation, +tests and demonstration applications, are licensed under the following +conditions... +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, +this software is released into the Public Domain. +In jurisdictions which do not recognize Public Domain property (e.g. Germany as of +2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is +released under the terms of the MIT License (see below). +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual +Public Domain/MIT License conditions described here, as they choose. +The MIT License is about as close to Public Domain as a license can get, and is +described in clear, concise terms at: +http://en.wikipedia.org/wiki/MIT_License + +The full text of the MIT License follows: + +Copyright (c) 2007-2010 Baptiste Lepilleur +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +========================================================================================================================================== + +/** +* `murmurhash.h' - murmurhash +* +* copyright (c) 2014 joseph werle +* Copyright (c) 2015-2016 The Khronos Group Inc. +* Copyright (c) 2015-2016 Valve Corporation +* Copyright (c) 2015-2016 LunarG, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and/or associated documentation files (the "Materials"), to +* deal in the Materials without restriction, including without limitation the +* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +* sell copies of the Materials, and to permit persons to whom the Materials are +* furnished to do so, subject to the following conditions: +* +* The above copyright notice(s) and this permission notice shall be included in +* all copies or substantial portions of the Materials. +* +* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE +* USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +========================================================================================================================================= + +Licenced as X11: http://www.kryogenix.org/code/browser/licence.html +This basically means: do what you want with it. + +========================================================================================================================================= + +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/common.hpp +/// @date 2013-12-24 / 2013-12-24 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + + +========================================================================================================================================== + +// LICENSE +// +// This software is in the public domain. Where that dedication is not +// recognized, you are granted a perpetual, irrevocable license to copy, +// distribute, and modify this file as you see fit. +// + +========================================================================================================================================== + +Simple DirectMedia Layer +Copyright (C) 1997-2018 Sam Lantinga + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not +claim that you wrote the original software. If you use this software +in a product, an acknowledgment in the product documentation would be +appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be +misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +========================================================================================================================================= + +/****************************************************************************\ +Copyright (c) 2002, NVIDIA Corporation. + +NVIDIA Corporation("NVIDIA") supplies this software to you in +consideration of your agreement to the following terms, and your use, +installation, modification or redistribution of this NVIDIA software +constitutes acceptance of these terms. If you do not agree with these +terms, please do not use, install, modify or redistribute this NVIDIA +software. + +In consideration of your agreement to abide by the following terms, and +subject to these terms, NVIDIA grants you a personal, non-exclusive +license, under NVIDIA's copyrights in this original NVIDIA software (the +NVIDIA Software), to use, reproduce, modify and redistribute the +NVIDIA Software, with or without modifications, in source and/or binary +forms; provided that if you redistribute the NVIDIA Software, you must +retain the copyright notice of NVIDIA, this notice and the following +text and disclaimers in all such redistributions of the NVIDIA Software. +Neither the name, trademarks, service marks nor logos of NVIDIA +Corporation may be used to endorse or promote products derived from the +NVIDIA Software without specific prior written permission from NVIDIA. +Except as expressly stated in this notice, no other rights or licenses +express or implied, are granted by NVIDIA herein, including but not +limited to any patent rights that may be infringed by your derivative +works or by other works in which the NVIDIA Software may be +incorporated. No hardware is licensed hereunder. + +THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, +INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR +ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER +PRODUCTS. + +IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, +INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY +OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE +NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, +TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF +NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +\****************************************************************************/ + +================================================================================================================================================== + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + + +================================================================================================================================================== + +GNU LESSER GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. + +0. Additional Definitions. + +As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. + +"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. + +An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. + +A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". + +The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. + +The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. + +1. Exception to Section 3 of the GNU GPL. + +You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. + +2. Conveying Modified Versions. + +If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: + +a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or +b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. +3. Object Code Incorporating Material from Library Header Files. + +The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: + +a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. +b) Accompany the object code with a copy of the GNU GPL and this license document. +4. Combined Works. + +You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: + +a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. +b) Accompany the Combined Work with a copy of the GNU GPL and this license document. +c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. +d) Do one of the following: +0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. +1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. +e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) +5. Combined Libraries. + +You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: + +a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. +b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. +6. Revised Versions of the GNU Lesser General Public License. + +The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\LICENSE +---------------------------------------------------------------------------- +Copyright 2008 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Code generated by the Protocol Buffer compiler is owned by the owner +of the input file used when generating it. This code is not +standalone and requires a support library to be linked with it. This +support library is itself covered by the above license. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\benchmark\LICENSE +-------------------------------------------------------------------------------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\LICENSE +--------------------------------------------------------------------------------------------------- +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\googlemock\LICENSE +-------------------------------------------------------------------------------------------------------------- +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\googlemock\scripts\generator\LICENSE +-------------------------------------------------------------------------------------------------------------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [2007] Neal Norwitz + Portions Copyright [2007] Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\protobuf\third_party\googletest\googletest\LICENSE +-------------------------------------------------------------------------------------------------------------- +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\psimd\LICENSE +------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2017 Facebook Inc. +Copyright (c) 2014-2017 Georgia Institute of Technology +Copyright 2019 Google LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\pthreadpool\LICENSE +------------------------------------------------------------------------------- +Copyright 2019 Google LLC +Copyright (c) 2017 Facebook Inc. +Copyright (c) 2015-2017 Georgia Institute of Technology +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\pybind11\LICENSE +---------------------------------------------------------------------------- +Copyright (c) 2016 Wenzel Jakob , All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Please also refer to the file .github/CONTRIBUTING.md, which clarifies licensing of +external contributions to this project including patches, pull requests, etc. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\python-peachpy\LICENSE.rst +-------------------------------------------------------------------------------------- +============================== +PeachPy license (2-clause BSD) +============================== + +Copyright (c) 2017, Facebook Inc. +Copyright (c) 2013-2017, Georgia Institute of Technology +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\sleef\LICENSE.txt +----------------------------------------------------------------------------- +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\LICENSE.txt +---------------------------------------------------------------------------------- +BSD License + +For TensorPipe software + +Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name Meta nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\LICENSE +----------------------------------------------------------------------------------------------------- +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\googlemock\LICENSE +---------------------------------------------------------------------------------------------------------------- +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\googlemock\scripts\generator\LICENSE +---------------------------------------------------------------------------------------------------------------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [2007] Neal Norwitz + Portions Copyright [2007] Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\googletest\googletest\LICENSE +---------------------------------------------------------------------------------------------------------------- +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\libnop\LICENSE +------------------------------------------------------------------------------------------------- +Copyright 2017 The Native Object Protocols Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\libuv\LICENSE +------------------------------------------------------------------------------------------------ +Copyright (c) 2015-present libuv project contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + + +C:\actions-runner\_work\pytorch\pytorch\pytorch\third_party\tensorpipe\third_party\pybind11\LICENSE +--------------------------------------------------------------------------------------------------- +Copyright (c) 2016 Wenzel Jakob , All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Please also refer to the file CONTRIBUTING.md, which clarifies licensing of +external contributions to this project including patches, pull requests, etc. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..16eb20d2b0aad4a4e07c412e309c199df014cca7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/METADATA @@ -0,0 +1,638 @@ +Metadata-Version: 2.1 +Name: torch +Version: 2.10.0 +Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration +Author-email: PyTorch Team +License: BSD-3-Clause +Project-URL: Homepage, https://pytorch.org +Project-URL: Repository, https://github.com/pytorch/pytorch +Project-URL: Documentation, https://pytorch.org/docs +Project-URL: Issue Tracker, https://github.com/pytorch/pytorch/issues +Project-URL: Forum, https://discuss.pytorch.org +Keywords: pytorch,machine learning +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Education +Classifier: Intended Audience :: Science/Research +Classifier: Topic :: Scientific/Engineering +Classifier: Topic :: Scientific/Engineering :: Mathematics +Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence +Classifier: Topic :: Software Development +Classifier: Topic :: Software Development :: Libraries +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Programming Language :: C++ +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Requires-Python: >=3.10 +Description-Content-Type: text/markdown +License-File: LICENSE +License-File: NOTICE +Requires-Dist: filelock +Requires-Dist: typing-extensions>=4.10.0 +Requires-Dist: sympy>=1.13.3 +Requires-Dist: networkx>=2.5.1 +Requires-Dist: jinja2 +Requires-Dist: fsspec>=0.8.5 +Requires-Dist: setuptools; python_version >= "3.12" +Requires-Dist: cuda-bindings==12.9.4; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-cuda-nvrtc-cu12==12.8.93; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-cuda-runtime-cu12==12.8.90; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-cuda-cupti-cu12==12.8.90; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-cudnn-cu12==9.10.2.21; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-cublas-cu12==12.8.4.1; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-cufft-cu12==11.3.3.83; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-curand-cu12==10.3.9.90; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-cusolver-cu12==11.7.3.90; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-cusparse-cu12==12.5.8.93; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-cusparselt-cu12==0.7.1; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-nccl-cu12==2.27.5; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-nvshmem-cu12==3.4.5; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-nvtx-cu12==12.8.90; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-nvjitlink-cu12==12.8.93; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: nvidia-cufile-cu12==1.13.1.3; platform_system == "Linux" and platform_machine == "x86_64" +Requires-Dist: triton==3.6.0; platform_system == "Linux" and platform_machine == "x86_64" +Provides-Extra: opt-einsum +Requires-Dist: opt-einsum>=3.3; extra == "opt-einsum" +Provides-Extra: optree +Requires-Dist: optree>=0.13.0; extra == "optree" +Provides-Extra: pyyaml +Requires-Dist: pyyaml; extra == "pyyaml" + +![PyTorch Logo](https://github.com/pytorch/pytorch/raw/main/docs/source/_static/img/pytorch-logo-dark.png) + +-------------------------------------------------------------------------------- + +PyTorch is a Python package that provides two high-level features: +- Tensor computation (like NumPy) with strong GPU acceleration +- Deep neural networks built on a tape-based autograd system + +You can reuse your favorite Python packages such as NumPy, SciPy, and Cython to extend PyTorch when needed. + +Our trunk health (Continuous Integration signals) can be found at [hud.pytorch.org](https://hud.pytorch.org/ci/pytorch/pytorch/main). + + + +- [More About PyTorch](#more-about-pytorch) + - [A GPU-Ready Tensor Library](#a-gpu-ready-tensor-library) + - [Dynamic Neural Networks: Tape-Based Autograd](#dynamic-neural-networks-tape-based-autograd) + - [Python First](#python-first) + - [Imperative Experiences](#imperative-experiences) + - [Fast and Lean](#fast-and-lean) + - [Extensions Without Pain](#extensions-without-pain) +- [Installation](#installation) + - [Binaries](#binaries) + - [NVIDIA Jetson Platforms](#nvidia-jetson-platforms) + - [From Source](#from-source) + - [Prerequisites](#prerequisites) + - [NVIDIA CUDA Support](#nvidia-cuda-support) + - [AMD ROCm Support](#amd-rocm-support) + - [Intel GPU Support](#intel-gpu-support) + - [Get the PyTorch Source](#get-the-pytorch-source) + - [Install Dependencies](#install-dependencies) + - [Install PyTorch](#install-pytorch) + - [Adjust Build Options (Optional)](#adjust-build-options-optional) + - [Docker Image](#docker-image) + - [Using pre-built images](#using-pre-built-images) + - [Building the image yourself](#building-the-image-yourself) + - [Building the Documentation](#building-the-documentation) + - [Building a PDF](#building-a-pdf) + - [Previous Versions](#previous-versions) +- [Getting Started](#getting-started) +- [Resources](#resources) +- [Communication](#communication) +- [Releases and Contributing](#releases-and-contributing) +- [The Team](#the-team) +- [License](#license) + + + +## More About PyTorch + +[Learn the basics of PyTorch](https://pytorch.org/tutorials/beginner/basics/intro.html) + +At a granular level, PyTorch is a library that consists of the following components: + +| Component | Description | +| ---- | --- | +| [**torch**](https://pytorch.org/docs/stable/torch.html) | A Tensor library like NumPy, with strong GPU support | +| [**torch.autograd**](https://pytorch.org/docs/stable/autograd.html) | A tape-based automatic differentiation library that supports all differentiable Tensor operations in torch | +| [**torch.jit**](https://pytorch.org/docs/stable/jit.html) | A compilation stack (TorchScript) to create serializable and optimizable models from PyTorch code | +| [**torch.nn**](https://pytorch.org/docs/stable/nn.html) | A neural networks library deeply integrated with autograd designed for maximum flexibility | +| [**torch.multiprocessing**](https://pytorch.org/docs/stable/multiprocessing.html) | Python multiprocessing, but with magical memory sharing of torch Tensors across processes. Useful for data loading and Hogwild training | +| [**torch.utils**](https://pytorch.org/docs/stable/data.html) | DataLoader and other utility functions for convenience | + +Usually, PyTorch is used either as: + +- A replacement for NumPy to use the power of GPUs. +- A deep learning research platform that provides maximum flexibility and speed. + +Elaborating Further: + +### A GPU-Ready Tensor Library + +If you use NumPy, then you have used Tensors (a.k.a. ndarray). + +![Tensor illustration](https://github.com/pytorch/pytorch/raw/main/docs/source/_static/img/tensor_illustration.png) + +PyTorch provides Tensors that can live either on the CPU or the GPU and accelerates the +computation by a huge amount. + +We provide a wide variety of tensor routines to accelerate and fit your scientific computation needs +such as slicing, indexing, mathematical operations, linear algebra, reductions. +And they are fast! + +### Dynamic Neural Networks: Tape-Based Autograd + +PyTorch has a unique way of building neural networks: using and replaying a tape recorder. + +Most frameworks such as TensorFlow, Theano, Caffe, and CNTK have a static view of the world. +One has to build a neural network and reuse the same structure again and again. +Changing the way the network behaves means that one has to start from scratch. + +With PyTorch, we use a technique called reverse-mode auto-differentiation, which allows you to +change the way your network behaves arbitrarily with zero lag or overhead. Our inspiration comes +from several research papers on this topic, as well as current and past work such as +[torch-autograd](https://github.com/twitter/torch-autograd), +[autograd](https://github.com/HIPS/autograd), +[Chainer](https://chainer.org), etc. + +While this technique is not unique to PyTorch, it's one of the fastest implementations of it to date. +You get the best of speed and flexibility for your crazy research. + +![Dynamic graph](https://github.com/pytorch/pytorch/raw/main/docs/source/_static/img/dynamic_graph.gif) + +### Python First + +PyTorch is not a Python binding into a monolithic C++ framework. +It is built to be deeply integrated into Python. +You can use it naturally like you would use [NumPy](https://www.numpy.org/) / [SciPy](https://www.scipy.org/) / [scikit-learn](https://scikit-learn.org) etc. +You can write your new neural network layers in Python itself, using your favorite libraries +and use packages such as [Cython](https://cython.org/) and [Numba](http://numba.pydata.org/). +Our goal is to not reinvent the wheel where appropriate. + +### Imperative Experiences + +PyTorch is designed to be intuitive, linear in thought, and easy to use. +When you execute a line of code, it gets executed. There isn't an asynchronous view of the world. +When you drop into a debugger or receive error messages and stack traces, understanding them is straightforward. +The stack trace points to exactly where your code was defined. +We hope you never spend hours debugging your code because of bad stack traces or asynchronous and opaque execution engines. + +### Fast and Lean + +PyTorch has minimal framework overhead. We integrate acceleration libraries +such as [Intel MKL](https://software.intel.com/mkl) and NVIDIA ([cuDNN](https://developer.nvidia.com/cudnn), [NCCL](https://developer.nvidia.com/nccl)) to maximize speed. +At the core, its CPU and GPU Tensor and neural network backends +are mature and have been tested for years. + +Hence, PyTorch is quite fast — whether you run small or large neural networks. + +The memory usage in PyTorch is extremely efficient compared to Torch or some of the alternatives. +We've written custom memory allocators for the GPU to make sure that +your deep learning models are maximally memory efficient. +This enables you to train bigger deep learning models than before. + +### Extensions Without Pain + +Writing new neural network modules, or interfacing with PyTorch's Tensor API was designed to be straightforward +and with minimal abstractions. + +You can write new neural network layers in Python using the torch API +[or your favorite NumPy-based libraries such as SciPy](https://pytorch.org/tutorials/advanced/numpy_extensions_tutorial.html). + +If you want to write your layers in C/C++, we provide a convenient extension API that is efficient and with minimal boilerplate. +No wrapper code needs to be written. You can see [a tutorial here](https://pytorch.org/tutorials/advanced/cpp_extension.html) and [an example here](https://github.com/pytorch/extension-cpp). + + +## Installation + +### Binaries +Commands to install binaries via Conda or pip wheels are on our website: [https://pytorch.org/get-started/locally/](https://pytorch.org/get-started/locally/) + + +#### NVIDIA Jetson Platforms + +Python wheels for NVIDIA's Jetson Nano, Jetson TX1/TX2, Jetson Xavier NX/AGX, and Jetson AGX Orin are provided [here](https://forums.developer.nvidia.com/t/pytorch-for-jetson-version-1-10-now-available/72048) and the L4T container is published [here](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-pytorch) + +They require JetPack 4.2 and above, and [@dusty-nv](https://github.com/dusty-nv) and [@ptrblck](https://github.com/ptrblck) are maintaining them. + + +### From Source + +#### Prerequisites +If you are installing from source, you will need: +- Python 3.10 or later +- A compiler that fully supports C++17, such as clang or gcc (gcc 9.4.0 or newer is required, on Linux) +- Visual Studio or Visual Studio Build Tool (Windows only) + +\* PyTorch CI uses Visual C++ BuildTools, which come with Visual Studio Enterprise, +Professional, or Community Editions. You can also install the build tools from +https://visualstudio.microsoft.com/visual-cpp-build-tools/. The build tools *do not* +come with Visual Studio Code by default. + +An example of environment setup is shown below: + +* Linux: + +```bash +$ source /bin/activate +$ conda create -y -n +$ conda activate +``` + +* Windows: + +```bash +$ source \Scripts\activate.bat +$ conda create -y -n +$ conda activate +$ call "C:\Program Files\Microsoft Visual Studio\\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 +``` + +A conda environment is not required. You can also do a PyTorch build in a +standard virtual environment, e.g., created with tools like `uv`, provided +your system has installed all the necessary dependencies unavailable as pip +packages (e.g., CUDA, MKL.) + +##### NVIDIA CUDA Support +If you want to compile with CUDA support, [select a supported version of CUDA from our support matrix](https://pytorch.org/get-started/locally/), then install the following: +- [NVIDIA CUDA](https://developer.nvidia.com/cuda-downloads) +- [NVIDIA cuDNN](https://developer.nvidia.com/cudnn) v8.5 or above +- [Compiler](https://gist.github.com/ax3l/9489132) compatible with CUDA + +Note: You could refer to the [cuDNN Support Matrix](https://docs.nvidia.com/deeplearning/cudnn/backend/latest/reference/support-matrix.html) for cuDNN versions with the various supported CUDA, CUDA driver, and NVIDIA hardware. + +If you want to disable CUDA support, export the environment variable `USE_CUDA=0`. +Other potentially useful environment variables may be found in `setup.py`. If +CUDA is installed in a non-standard location, set PATH so that the nvcc you +want to use can be found (e.g., `export PATH=/usr/local/cuda-12.8/bin:$PATH`). + +If you are building for NVIDIA's Jetson platforms (Jetson Nano, TX1, TX2, AGX Xavier), Instructions to install PyTorch for Jetson Nano are [available here](https://devtalk.nvidia.com/default/topic/1049071/jetson-nano/pytorch-for-jetson-nano/) + +##### AMD ROCm Support +If you want to compile with ROCm support, install +- [AMD ROCm](https://rocm.docs.amd.com/en/latest/deploy/linux/quick_start.html) 4.0 and above installation +- ROCm is currently supported only for Linux systems. + +By default the build system expects ROCm to be installed in `/opt/rocm`. If ROCm is installed in a different directory, the `ROCM_PATH` environment variable must be set to the ROCm installation directory. The build system automatically detects the AMD GPU architecture. Optionally, the AMD GPU architecture can be explicitly set with the `PYTORCH_ROCM_ARCH` environment variable [AMD GPU architecture](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html#supported-gpus) + +If you want to disable ROCm support, export the environment variable `USE_ROCM=0`. +Other potentially useful environment variables may be found in `setup.py`. + +##### Intel GPU Support +If you want to compile with Intel GPU support, follow these +- [PyTorch Prerequisites for Intel GPUs](https://www.intel.com/content/www/us/en/developer/articles/tool/pytorch-prerequisites-for-intel-gpus.html) instructions. +- Intel GPU is supported for Linux and Windows. + +If you want to disable Intel GPU support, export the environment variable `USE_XPU=0`. +Other potentially useful environment variables may be found in `setup.py`. + +#### Get the PyTorch Source + +```bash +git clone https://github.com/pytorch/pytorch +cd pytorch +# if you are updating an existing checkout +git submodule sync +git submodule update --init --recursive +``` + +#### Install Dependencies + +**Common** + +```bash +# Run this command from the PyTorch directory after cloning the source code using the “Get the PyTorch Source“ section above +pip install --group dev +``` + +**On Linux** + +```bash +pip install mkl-static mkl-include +# CUDA only: Add LAPACK support for the GPU if needed +# magma installation: run with active conda environment. specify CUDA version to install +.ci/docker/common/install_magma_conda.sh 12.4 + +# (optional) If using torch.compile with inductor/triton, install the matching version of triton +# Run from the pytorch directory after cloning +# For Intel GPU support, please explicitly `export USE_XPU=1` before running command. +make triton +``` + +**On MacOS** + +```bash +# Add this package on intel x86 processor machines only +pip install mkl-static mkl-include +# Add these packages if torch.distributed is needed +conda install pkg-config libuv +``` + +**On Windows** + +```bash +pip install mkl-static mkl-include +# Add these packages if torch.distributed is needed. +# Distributed package support on Windows is a prototype feature and is subject to changes. +conda install -c conda-forge libuv=1.51 +``` + +#### Install PyTorch + +**On Linux** + +If you're compiling for AMD ROCm then first run this command: + +```bash +# Only run this if you're compiling for ROCm +python tools/amd_build/build_amd.py +``` + +Install PyTorch + +```bash +# the CMake prefix for conda environment +export CMAKE_PREFIX_PATH="${CONDA_PREFIX:-'$(dirname $(which conda))/../'}:${CMAKE_PREFIX_PATH}" +python -m pip install --no-build-isolation -v -e . + +# the CMake prefix for non-conda environment, e.g. Python venv +# call following after activating the venv +export CMAKE_PREFIX_PATH="${VIRTUAL_ENV}:${CMAKE_PREFIX_PATH}" +``` + +**On macOS** + +```bash +python -m pip install --no-build-isolation -v -e . +``` + +**On Windows** + +If you want to build legacy python code, please refer to [Building on legacy code and CUDA](https://github.com/pytorch/pytorch/blob/main/CONTRIBUTING.md#building-on-legacy-code-and-cuda) + +**CPU-only builds** + +In this mode PyTorch computations will run on your CPU, not your GPU. + +```cmd +python -m pip install --no-build-isolation -v -e . +``` + +Note on OpenMP: The desired OpenMP implementation is Intel OpenMP (iomp). In order to link against iomp, you'll need to manually download the library and set up the building environment by tweaking `CMAKE_INCLUDE_PATH` and `LIB`. The instruction [here](https://github.com/pytorch/pytorch/blob/main/docs/source/notes/windows.rst#building-from-source) is an example for setting up both MKL and Intel OpenMP. Without these configurations for CMake, Microsoft Visual C OpenMP runtime (vcomp) will be used. + +**CUDA based build** + +In this mode PyTorch computations will leverage your GPU via CUDA for faster number crunching + +[NVTX](https://docs.nvidia.com/gameworks/content/gameworkslibrary/nvtx/nvidia_tools_extension_library_nvtx.htm) is needed to build Pytorch with CUDA. +NVTX is a part of CUDA distributive, where it is called "Nsight Compute". To install it onto an already installed CUDA run CUDA installation once again and check the corresponding checkbox. +Make sure that CUDA with Nsight Compute is installed after Visual Studio. + +Currently, VS 2017 / 2019, and Ninja are supported as the generator of CMake. If `ninja.exe` is detected in `PATH`, then Ninja will be used as the default generator, otherwise, it will use VS 2017 / 2019. +
If Ninja is selected as the generator, the latest MSVC will get selected as the underlying toolchain. + +Additional libraries such as +[Magma](https://developer.nvidia.com/magma), [oneDNN, a.k.a. MKLDNN or DNNL](https://github.com/oneapi-src/oneDNN), and [Sccache](https://github.com/mozilla/sccache) are often needed. Please refer to the [installation-helper](https://github.com/pytorch/pytorch/tree/main/.ci/pytorch/win-test-helpers/installation-helpers) to install them. + +You can refer to the [build_pytorch.bat](https://github.com/pytorch/pytorch/blob/main/.ci/pytorch/win-test-helpers/build_pytorch.bat) script for some other environment variables configurations + +```cmd +cmd + +:: Set the environment variables after you have downloaded and unzipped the mkl package, +:: else CMake would throw an error as `Could NOT find OpenMP`. +set CMAKE_INCLUDE_PATH={Your directory}\mkl\include +set LIB={Your directory}\mkl\lib;%LIB% + +:: Read the content in the previous section carefully before you proceed. +:: [Optional] If you want to override the underlying toolset used by Ninja and Visual Studio with CUDA, please run the following script block. +:: "Visual Studio 2019 Developer Command Prompt" will be run automatically. +:: Make sure you have CMake >= 3.12 before you do this when you use the Visual Studio generator. +set CMAKE_GENERATOR_TOOLSET_VERSION=14.27 +set DISTUTILS_USE_SDK=1 +for /f "usebackq tokens=*" %i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [15^,17^) -products * -latest -property installationPath`) do call "%i\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=%CMAKE_GENERATOR_TOOLSET_VERSION% + +:: [Optional] If you want to override the CUDA host compiler +set CUDAHOSTCXX=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\cl.exe + +python -m pip install --no-build-isolation -v -e . +``` + +**Intel GPU builds** + +In this mode PyTorch with Intel GPU support will be built. + +Please make sure [the common prerequisites](#prerequisites) as well as [the prerequisites for Intel GPU](#intel-gpu-support) are properly installed and the environment variables are configured prior to starting the build. For build tool support, `Visual Studio 2022` is required. + +Then PyTorch can be built with the command: + +```cmd +:: CMD Commands: +:: Set the CMAKE_PREFIX_PATH to help find corresponding packages +:: %CONDA_PREFIX% only works after `conda activate custom_env` + +if defined CMAKE_PREFIX_PATH ( + set "CMAKE_PREFIX_PATH=%CONDA_PREFIX%\Library;%CMAKE_PREFIX_PATH%" +) else ( + set "CMAKE_PREFIX_PATH=%CONDA_PREFIX%\Library" +) + +python -m pip install --no-build-isolation -v -e . +``` + +##### Adjust Build Options (Optional) + +You can adjust the configuration of cmake variables optionally (without building first), by doing +the following. For example, adjusting the pre-detected directories for CuDNN or BLAS can be done +with such a step. + +On Linux + +```bash +export CMAKE_PREFIX_PATH="${CONDA_PREFIX:-'$(dirname $(which conda))/../'}:${CMAKE_PREFIX_PATH}" +CMAKE_ONLY=1 python setup.py build +ccmake build # or cmake-gui build +``` + +On macOS + +```bash +export CMAKE_PREFIX_PATH="${CONDA_PREFIX:-'$(dirname $(which conda))/../'}:${CMAKE_PREFIX_PATH}" +MACOSX_DEPLOYMENT_TARGET=11.0 CMAKE_ONLY=1 python setup.py build +ccmake build # or cmake-gui build +``` + +### Docker Image + +#### Using pre-built images + +You can also pull a pre-built docker image from Docker Hub and run with docker v19.03+ + +```bash +docker run --gpus all --rm -ti --ipc=host pytorch/pytorch:latest +``` + +Please note that PyTorch uses shared memory to share data between processes, so if torch multiprocessing is used (e.g. +for multithreaded data loaders) the default shared memory segment size that container runs with is not enough, and you +should increase shared memory size either with `--ipc=host` or `--shm-size` command line options to `nvidia-docker run`. + +#### Building the image yourself + +**NOTE:** Must be built with a docker version > 18.06 + +The `Dockerfile` is supplied to build images with CUDA 11.1 support and cuDNN v8. +You can pass `PYTHON_VERSION=x.y` make variable to specify which Python version is to be used by Miniconda, or leave it +unset to use the default. + +```bash +make -f docker.Makefile +# images are tagged as docker.io/${your_docker_username}/pytorch +``` + +You can also pass the `CMAKE_VARS="..."` environment variable to specify additional CMake variables to be passed to CMake during the build. +See [setup.py](./setup.py) for the list of available variables. + +```bash +make -f docker.Makefile +``` + +### Building the Documentation + +To build documentation in various formats, you will need [Sphinx](http://www.sphinx-doc.org) +and the pytorch_sphinx_theme2. + +Before you build the documentation locally, ensure `torch` is +installed in your environment. For small fixes, you can install the +nightly version as described in [Getting Started](https://pytorch.org/get-started/locally/). + +For more complex fixes, such as adding a new module and docstrings for +the new module, you might need to install torch [from source](#from-source). +See [Docstring Guidelines](https://github.com/pytorch/pytorch/wiki/Docstring-Guidelines) +for docstring conventions. + +```bash +cd docs/ +pip install -r requirements.txt +make html +make serve +``` + +Run `make` to get a list of all available output formats. + +If you get a katex error run `npm install katex`. If it persists, try +`npm install -g katex` + +> [!NOTE] +> If you installed `nodejs` with a different package manager (e.g., +> `conda`) then `npm` will probably install a version of `katex` that is not +> compatible with your version of `nodejs` and doc builds will fail. +> A combination of versions that is known to work is `node@6.13.1` and +> `katex@0.13.18`. To install the latter with `npm` you can run +> ```npm install -g katex@0.13.18``` + +> [!NOTE] +> If you see a numpy incompatibility error, run: +> ``` +> pip install 'numpy<2' +> ``` + +When you make changes to the dependencies run by CI, edit the +`.ci/docker/requirements-docs.txt` file. + +#### Building a PDF + +To compile a PDF of all PyTorch documentation, ensure you have +`texlive` and LaTeX installed. On macOS, you can install them using: + +``` +brew install --cask mactex +``` + +To create the PDF: + +1. Run: + + ``` + make latexpdf + ``` + + This will generate the necessary files in the `build/latex` directory. + +2. Navigate to this directory and execute: + + ``` + make LATEXOPTS="-interaction=nonstopmode" + ``` + + This will produce a `pytorch.pdf` with the desired content. Run this + command one more time so that it generates the correct table + of contents and index. + +> [!NOTE] +> To view the Table of Contents, switch to the **Table of Contents** +> view in your PDF viewer. + + +### Previous Versions + +Installation instructions and binaries for previous PyTorch versions may be found +on [our website](https://pytorch.org/get-started/previous-versions). + + +## Getting Started + +Three pointers to get you started: +- [Tutorials: get you started with understanding and using PyTorch](https://pytorch.org/tutorials/) +- [Examples: easy to understand PyTorch code across all domains](https://github.com/pytorch/examples) +- [The API Reference](https://pytorch.org/docs/) +- [Glossary](https://github.com/pytorch/pytorch/blob/main/GLOSSARY.md) + +## Resources + +* [PyTorch.org](https://pytorch.org/) +* [PyTorch Tutorials](https://pytorch.org/tutorials/) +* [PyTorch Examples](https://github.com/pytorch/examples) +* [PyTorch Models](https://pytorch.org/hub/) +* [Intro to Deep Learning with PyTorch from Udacity](https://www.udacity.com/course/deep-learning-pytorch--ud188) +* [Intro to Machine Learning with PyTorch from Udacity](https://www.udacity.com/course/intro-to-machine-learning-nanodegree--nd229) +* [Deep Neural Networks with PyTorch from Coursera](https://www.coursera.org/learn/deep-neural-networks-with-pytorch) +* [PyTorch Twitter](https://twitter.com/PyTorch) +* [PyTorch Blog](https://pytorch.org/blog/) +* [PyTorch YouTube](https://www.youtube.com/channel/UCWXI5YeOsh03QvJ59PMaXFw) + +## Communication +* Forums: Discuss implementations, research, etc. https://discuss.pytorch.org +* GitHub Issues: Bug reports, feature requests, install issues, RFCs, thoughts, etc. +* Slack: The [PyTorch Slack](https://pytorch.slack.com/) hosts a primary audience of moderate to experienced PyTorch users and developers for general chat, online discussions, collaboration, etc. If you are a beginner looking for help, the primary medium is [PyTorch Forums](https://discuss.pytorch.org). If you need a slack invite, please fill this form: https://goo.gl/forms/PP1AGvNHpSaJP8to1 +* Newsletter: No-noise, a one-way email newsletter with important announcements about PyTorch. You can sign-up here: https://eepurl.com/cbG0rv +* Facebook Page: Important announcements about PyTorch. https://www.facebook.com/pytorch +* For brand guidelines, please visit our website at [pytorch.org](https://pytorch.org/) + +## Releases and Contributing + +Typically, PyTorch has three minor releases a year. Please let us know if you encounter a bug by [filing an issue](https://github.com/pytorch/pytorch/issues). + +We appreciate all contributions. If you are planning to contribute back bug-fixes, please do so without any further discussion. + +If you plan to contribute new features, utility functions, or extensions to the core, please first open an issue and discuss the feature with us. +Sending a PR without discussion might end up resulting in a rejected PR because we might be taking the core in a different direction than you might be aware of. + +To learn more about making a contribution to Pytorch, please see our [Contribution page](CONTRIBUTING.md). For more information about PyTorch releases, see [Release page](RELEASE.md). + +## The Team + +PyTorch is a community-driven project with several skillful engineers and researchers contributing to it. + +PyTorch is currently maintained by [Soumith Chintala](http://soumith.ch), [Gregory Chanan](https://github.com/gchanan), [Dmytro Dzhulgakov](https://github.com/dzhulgakov), [Edward Yang](https://github.com/ezyang), [Alban Desmaison](https://github.com/albanD), [Piotr Bialecki](https://github.com/ptrblck) and [Nikita Shulga](https://github.com/malfet) with major contributions coming from hundreds of talented individuals in various forms and means. +A non-exhaustive but growing list needs to mention: [Trevor Killeen](https://github.com/killeent), [Sasank Chilamkurthy](https://github.com/chsasank), [Sergey Zagoruyko](https://github.com/szagoruyko), [Adam Lerer](https://github.com/adamlerer), [Francisco Massa](https://github.com/fmassa), [Alykhan Tejani](https://github.com/alykhantejani), [Luca Antiga](https://github.com/lantiga), [Alban Desmaison](https://github.com/albanD), [Andreas Koepf](https://github.com/andreaskoepf), [James Bradbury](https://github.com/jekbradbury), [Zeming Lin](https://github.com/ebetica), [Yuandong Tian](https://github.com/yuandong-tian), [Guillaume Lample](https://github.com/glample), [Marat Dukhan](https://github.com/Maratyszcza), [Natalia Gimelshein](https://github.com/ngimel), [Christian Sarofeen](https://github.com/csarofeen), [Martin Raison](https://github.com/martinraison), [Edward Yang](https://github.com/ezyang), [Zachary Devito](https://github.com/zdevito). + +Note: This project is unrelated to [hughperkins/pytorch](https://github.com/hughperkins/pytorch) with the same name. Hugh is a valuable contributor to the Torch community and has helped with many things Torch and PyTorch. + +## License + +PyTorch has a BSD-style license, as found in the [LICENSE](LICENSE) file. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/NOTICE b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..c08c04389d281a4bf5ef77fc5426ffac8232dc3a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/NOTICE @@ -0,0 +1,456 @@ +======================================================================= +Software under third_party +======================================================================= +Software libraries under third_party are provided as github submodule +links, and their content is not part of the Caffe2 codebase. Their +licences can be found under the respective software repositories. + +======================================================================= +Earlier BSD License +======================================================================= +Early development of Caffe2 in 2015 and early 2016 is licensed under the +BSD license. The license is attached below: + +All contributions by Facebook: +Copyright (c) 2016 Facebook Inc. + +All contributions by Google: +Copyright (c) 2015 Google Inc. +All rights reserved. + +All contributions by Yangqing Jia: +Copyright (c) 2015 Yangqing Jia +All rights reserved. + +All contributions by Kakao Brain: +Copyright 2019-2020 Kakao Brain + +All other contributions: +Copyright(c) 2015, 2016 the respective contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +======================================================================= +Caffe's BSD License +======================================================================= +Some parts of the caffe2 code is derived from the original Caffe code, which is +created by Yangqing Jia and is now a BSD-licensed open-source project. The Caffe +license is as follows: + +COPYRIGHT + +All contributions by the University of California: +Copyright (c) 2014, The Regents of the University of California (Regents) +All rights reserved. + +All other contributions: +Copyright (c) 2014, the respective contributors +All rights reserved. + +Caffe uses a shared copyright model: each contributor holds copyright over +their contributions to Caffe. The project versioning records all such +contribution and copyright details. If a contributor wants to further mark +their specific copyright on a particular contribution, they should indicate +their copyright solely in the commit message of the change when it is +committed. + +LICENSE + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +CONTRIBUTION AGREEMENT + +By contributing to the BVLC/caffe repository through pull-request, comment, +or otherwise, the contributor releases their content to the +license and copyright terms herein. + +======================================================================= +Caffe2's Apache License +======================================================================= + +This repo contains Caffe2 code, which was previously licensed under +Apache License Version 2.0: + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +======================================================================= +Cephes's 3-Clause BSD License +======================================================================= + +Code derived from implementations in the Cephes Math Library should mention +its derivation and reference the following license: + + 3-Clause BSD License for the Cephes Math Library + Copyright (c) 2018, Steven Moshier + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL Steven Moshier BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +======================================================================= +SciPy's 3-Clause BSD License +======================================================================= + +Code derived from implementations in SciPy should mention its derivation +and reference the following license: + + Copyright (c) 2001-2002 Enthought, Inc. 2003-2019, SciPy Developers. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + 3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +======================================================================= +Boost's 1.0 Software License +======================================================================= + +Code derived from implementations in Boost 1.0 should mention its +derivation and reference the following license: + + Boost Software License - Version 1.0 - August 17th, 2003 + + Permission is hereby granted, free of charge, to any person or organization + obtaining a copy of the software and accompanying documentation covered by + this license (the "Software") to use, reproduce, display, distribute, + execute, and transmit the Software, and to prepare derivative works of the + Software, and to permit third-parties to whom the Software is furnished to + do so, all subject to the following: + + The copyright notices in the Software and this entire statement, including + the above license grant, this restriction and the following disclaimer, + must be included in all copies of the Software, in whole or in part, and + all derivative works of the Software, unless such copies or derivative + works are solely in the form of machine-executable object code generated by + a source language processor. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT + SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE + FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +======================================================================= +PILLOW-SIMD Software License +======================================================================= + +Code derived from implementations in PILLOW-SIMD should mention its derivation +and reference the following license: + + The Python Imaging Library (PIL) is + + Copyright © 1997-2011 by Secret Labs AB + Copyright © 1995-2011 by Fredrik Lundh + + Pillow is the friendly PIL fork. It is + + Copyright © 2010-2022 by Alex Clark and contributors + + Like PIL, Pillow is licensed under the open source HPND License: + + By obtaining, using, and/or copying this software and/or its associated + documentation, you agree that you have read, understood, and will comply + with the following terms and conditions: + + Permission to use, copy, modify, and distribute this software and its + associated documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appears in all copies, and that + both that copyright notice and this permission notice appear in supporting + documentation, and that the name of Secret Labs AB or the author not be + used in advertising or publicity pertaining to distribution of the software + without specific, written prior permission. + + SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. + IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL, + INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..c1b60d75545b7854672d21564c3a19b416aaf76b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/RECORD @@ -0,0 +1,13923 @@ +../../Scripts/torchfrtrace.exe,sha256=PPb_4KkGj2TowHKTdcdkFGEJeemb0YSoc5ZJk2y6Tg4,108405 +../../Scripts/torchrun.exe,sha256=gwM4c3saEjaVwpRJ71KH3rzw0BdDJqSSWpwDPWgjXPE,108384 +functorch/__init__.py,sha256=lkoKmqHGN8LKYTeSPXXXh28z4ehGyK9gTBtzohyNuu0,1076 +functorch/__pycache__/__init__.cpython-312.pyc,, +functorch/_src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +functorch/_src/__pycache__/__init__.cpython-312.pyc,, +functorch/_src/aot_autograd/__init__.py,sha256=9blGZUidbjhxkEKHLqpZTmhU_o6twasOgrZ0li9RcLk,299 +functorch/_src/aot_autograd/__pycache__/__init__.cpython-312.pyc,, +functorch/_src/eager_transforms/__init__.py,sha256=CrfEZefUvrS8WmAmxFskj-Lbkvee502sdf1RpIaLl7U,298 +functorch/_src/eager_transforms/__pycache__/__init__.cpython-312.pyc,, +functorch/_src/make_functional/__init__.py,sha256=vo-yXbmEA9uzHQayl8mhCGArugyZe2vwHaj2fiklD3w,239 +functorch/_src/make_functional/__pycache__/__init__.cpython-312.pyc,, +functorch/_src/vmap/__init__.py,sha256=FrCE1RM1QK04BgLYVsXpZbetiVjtTri_1h7FGhjB2Mw,483 +functorch/_src/vmap/__pycache__/__init__.cpython-312.pyc,, +functorch/compile/__init__.py,sha256=SY48gIkfVpniQqcBqFZjEEAh2ID7e8HfUSzrv_rO9PA,786 +functorch/compile/__pycache__/__init__.cpython-312.pyc,, +functorch/dim/__init__.py,sha256=nYEvNcRka9cdiVzUO9wrf43Ozi1gJ2ErjWRy4QsoVEU,54900 +functorch/dim/__pycache__/__init__.cpython-312.pyc,, +functorch/dim/__pycache__/_dim_entry.cpython-312.pyc,, +functorch/dim/__pycache__/_enable_all_layers.cpython-312.pyc,, +functorch/dim/__pycache__/_getsetitem.cpython-312.pyc,, +functorch/dim/__pycache__/_order.cpython-312.pyc,, +functorch/dim/__pycache__/_py_inst_decoder.cpython-312.pyc,, +functorch/dim/__pycache__/_tensor_info.cpython-312.pyc,, +functorch/dim/__pycache__/_wrap.cpython-312.pyc,, +functorch/dim/__pycache__/magic_trace.cpython-312.pyc,, +functorch/dim/__pycache__/op_properties.cpython-312.pyc,, +functorch/dim/__pycache__/wrap_type.cpython-312.pyc,, +functorch/dim/_dim_entry.py,sha256=ewEvzlkAQTwFW4MOyKY0ia4XtFP086IOdNX7fCQuHlE,3753 +functorch/dim/_enable_all_layers.py,sha256=K-ngNpi1maA_faIDrAqXVrP72t05EnLOgc-HPK7kjnI,5071 +functorch/dim/_getsetitem.py,sha256=FlXLtHC-EouqbzHbmh5dvikWnfqbRrgGP6g8n3i9UDA,19539 +functorch/dim/_order.py,sha256=TAtYCB_aeOyiaxfW-TzAoqWGmhzXSBqakivODRgkAnM,7222 +functorch/dim/_py_inst_decoder.py,sha256=hCrI1oOuawVROWxAaGwqJAuaICfEOqYPbMBAX9ophSc,2174 +functorch/dim/_tensor_info.py,sha256=w_W2vWQZ-I-HdarYAKs1-H3Jbs6dTGUMb2kpfOAUB7Y,2107 +functorch/dim/_wrap.py,sha256=YIZk7RBPLbQp-IvvpWAy9gojhYXAcnQjN9SNfD7UiQE,8553 +functorch/dim/magic_trace.py,sha256=Qu6qNp1NzKTOmTozS6VFsNUPPTDjrKJVZ8DWJAmbWIs,1538 +functorch/dim/op_properties.py,sha256=GzHOa2ulADUvBOatQIxHbhLeUXKrclZxHRq4XPcUgms,6999 +functorch/dim/wrap_type.py,sha256=ZP1LhwnSRqAs5eOpzF6YyTSvzwvIsoj_oXrzhUOtRDs,2161 +functorch/einops/__init__.py,sha256=ho1steDFM9r0hgvRWZWx9k6SkNzOMfH89Q35J79fW9c,63 +functorch/einops/__pycache__/__init__.cpython-312.pyc,, +functorch/einops/__pycache__/_parsing.cpython-312.pyc,, +functorch/einops/__pycache__/rearrange.cpython-312.pyc,, +functorch/einops/_parsing.py,sha256=SyX9AUEU6qPqUtJxpPuEl3G6c3xQWrwEk8lgOezQDiQ,12617 +functorch/einops/rearrange.py,sha256=bmFCYIsyhWy12i3kP3aptlixSRkpdcgrhP7kX4pgoxE,8291 +functorch/experimental/__init__.py,sha256=jtLxAUrqO23_VnjJDsQtQQFGKsmf4pQzpE07wnqs5pA,279 +functorch/experimental/__pycache__/__init__.cpython-312.pyc,, +functorch/experimental/__pycache__/control_flow.cpython-312.pyc,, +functorch/experimental/__pycache__/ops.cpython-312.pyc,, +functorch/experimental/control_flow.py,sha256=2OxWUXzrCW0XaSpQkK85UwUd5gHsHFN2V_qP5gAF4-o,150 +functorch/experimental/ops.py,sha256=g_LXSb0WzSHiOLW4OLkIiuhiHvHPHNtGpBN30Wss6Go,58 +torch-2.10.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +torch-2.10.0.dist-info/LICENSE,sha256=_evxBKpSfrvb83jeFY_7Kx3UYaNxYNFC5PjsrJ6UO44,544783 +torch-2.10.0.dist-info/METADATA,sha256=dTOoVwGsruRoIYr0SXqEMJ02WrAhGPlUfAHyca51pOI,31047 +torch-2.10.0.dist-info/NOTICE,sha256=HD3sbANCx-2eEq9ZspbHux05SvXPiB23QZHMgpnvzlw,24088 +torch-2.10.0.dist-info/RECORD,, +torch-2.10.0.dist-info/WHEEL,sha256=KNRoynpGu-d6mheJI-zfvcGl1iN-y8BewbiCDXsF3cY,101 +torch-2.10.0.dist-info/entry_points.txt,sha256=crpU3BGG2VBGDFewCYdWNeeDFO5dSHLSdhN8H_Ybdi4,211 +torch-2.10.0.dist-info/top_level.txt,sha256=MsBcfJyMU15lW1efu5w7Tzd4MenrYHiuaixbHMfAoco,25 +torch/_C.cp312-win_amd64.pyd,sha256=lJOqckgVFPXXxZpgDNuRaKv1_LJfCZiwCKvMjVsJxMw,10752 +torch/_C/_VariableFunctions.pyi,sha256=9Z0UO2Qa_G3K-zD5__2prdJejJvDVpy03zPZwpD6r0E,1242210 +torch/_C/__init__.pyi,sha256=V8x4yHXKIJILDd2nOrjT1h9sj5xBOnN99WzW8TbpJpc,426309 +torch/_C/_acc/__init__.pyi,sha256=NPWWCOuvXiBAOc27YPirv971cw9OroWjTFWLBnNdQbc,581 +torch/_C/_aoti.pyi,sha256=rohgn8QJCZucauXBUY332ut9NYfYmQDQxd1-MEzMqfw,6179 +torch/_C/_autograd.pyi,sha256=AzxgFlsTm6uej_nHdkDrCdIY7KVojCeRzLNtTHyf0aA,5050 +torch/_C/_cpu.pyi,sha256=AxfveLRRrfQIaKZzyPyOKrBdLqmCJhN1xiA2Ga-hGDw,447 +torch/_C/_cudnn.pyi,sha256=QZJd1Z0nOV5-vdQk0c0dXFADrgQ-D2qYypn4sb64lFE,331 +torch/_C/_cusparselt.pyi,sha256=STZASq5R_xHmWNc23FYTi9xOuN6vX-YagUHiTPASNwY,33 +torch/_C/_distributed.pyi,sha256=27phLPXCLDewhF3dbA7Y174Xn1k7tIhuPbLopsscUlY,619 +torch/_C/_distributed_autograd.pyi,sha256=RkSSkafXavZ08c2YDbRQES2H_RT309QTczd15rH14EU,925 +torch/_C/_distributed_c10d.pyi,sha256=TUAX3h9uNlK0IGenVpVr6w8QWTm28afFfnGh1stmnIg,27437 +torch/_C/_distributed_rpc.pyi,sha256=26VDsJyb4ooKY5tjFJdAxsEblhTyz2p2OivFNHW4Cso,6268 +torch/_C/_distributed_rpc_testing.pyi,sha256=ORYYhzRBVptDNYXzqKk-VWDm4MEauaxB0gBlEmrzebU,1049 +torch/_C/_dynamo/__init__.pyi,sha256=FXgJGha1KPh6dXYj_N_VRqxStKaU49xE8Tjwy-igDzY,170 +torch/_C/_dynamo/compiled_autograd.pyi,sha256=1DUdwcbdaANSWiFrv4mSQJHF5U3p3jbAaRdtT4hZW6w,535 +torch/_C/_dynamo/eval_frame.pyi,sha256=jXnE2mkIhHrHxSzVI1m23HTYizw1tdqv3iaz5VsYg5Y,2846 +torch/_C/_dynamo/guards.pyi,sha256=vlcyyRSQUnHMCkHWrcJKQ7hQJGAwE6Pvn1iLQ7ncDYY,13439 +torch/_C/_export/__init__.pyi,sha256=xmsrWjm6_5M5FsoqReL-K0xUCE31PlysmTwuMXnRzUs,266 +torch/_C/_export/pt2_archive_constants.pyi,sha256=xA0pX7RVQ4srWNgmgZGjUR5nyFh-1BMiB6CP2Vl_Sqs,813 +torch/_C/_functionalization.pyi,sha256=W6ynQ-6t1J_u5mkGFv4yPbN9B1xzU-Q6jyJFBwgkwcg,582 +torch/_C/_functions.pyi,sha256=6IcSjn89EeI0yZePCn5I7JH3-FbdRJinuplSUUEXJOI,627 +torch/_C/_functorch.pyi,sha256=peIeGcnCZRM1avF70cnmlkLXIJ_2pWLUVPBaAwKyREY,3517 +torch/_C/_instruction_counter.pyi,sha256=euVpDw5-_od7VDlZXexNsfpkv0C4cxFKgLK6SIdS7Bk,113 +torch/_C/_itt.pyi,sha256=nrLlzZvGArWL5299sUDM050Or-Id-JWc-qkmFGISri4,174 +torch/_C/_jit_tree_views.pyi,sha256=4wKh0gKR9_knPs0QEMmzp6UqvNfyKwoCsHKu7RHPbcQ,5757 +torch/_C/_lazy.pyi,sha256=KRIpi3f87UcYNhqe1gVvcIzCI2mEkfglmHSv5pH4e2k,1041 +torch/_C/_lazy_ts_backend.pyi,sha256=7te5WIANu3IYJl9hggNBpUX0g1RFrljAXHoXXWNTD0I,338 +torch/_C/_monitor.pyi,sha256=NgPjs6t_FJQ1kOlQxyRuBOSvUnYNHRPAYUCQFG7AxnI,1505 +torch/_C/_nn.pyi,sha256=dGKU902vA_tE-LsruH0p_x6aI8gtwrHsKxdh_wKMPLs,9911 +torch/_C/_nvtx.pyi,sha256=u34pMm7E1ue-HvrnPXrh7ADvFTiriXQJUgkCaDGtFaw,389 +torch/_C/_onnx.pyi,sha256=pKWakDSrFUkLPqHSECJhNZ6cHb0qfdKz6kD_mi05q8U,749 +torch/_C/_profiler.pyi,sha256=WnkdKZ2vTWkJ_TwRS9Zks8ONq_zl30NWFmXW7HpilOY,6519 +torch/_C/_verbose.pyi,sha256=7KJppleT0c1wLkIser5ezi9K4I-f6ecUMvB9a7LmYyA,137 +torch/_C_flatbuffer/__init__.pyi,sha256=mHUoCyZPzfJNZtH-lvh_DNh7P7RMnVQqYmb_jZoBr6o,555 +torch/_VF.py,sha256=hJLG33MTfEPRgdChJxIUR82WMiiqNCfTW5DINBJBnho,695 +torch/_VF.pyi,sha256=9Z0UO2Qa_G3K-zD5__2prdJejJvDVpy03zPZwpD6r0E,1242210 +torch/__config__.py,sha256=JQ9izWG915YpLkJQxG9LAFEmB39cZwsv8SOtD2Ueo_g,596 +torch/__future__.py,sha256=wcFs07Ls3wHda59z5xJrMU7_Cw7s5PabTdCVFwY7K50,3260 +torch/__init__.py,sha256=UfAnU-KeD87dQlC8VMZkNaf5kDsGA3eLWF1LL_p59r4,109848 +torch/__pycache__/_VF.cpython-312.pyc,, +torch/__pycache__/__config__.cpython-312.pyc,, +torch/__pycache__/__future__.cpython-312.pyc,, +torch/__pycache__/__init__.cpython-312.pyc,, +torch/__pycache__/_appdirs.cpython-312.pyc,, +torch/__pycache__/_classes.cpython-312.pyc,, +torch/__pycache__/_compile.cpython-312.pyc,, +torch/__pycache__/_custom_ops.cpython-312.pyc,, +torch/__pycache__/_environment.cpython-312.pyc,, +torch/__pycache__/_guards.cpython-312.pyc,, +torch/__pycache__/_jit_internal.cpython-312.pyc,, +torch/__pycache__/_linalg_utils.cpython-312.pyc,, +torch/__pycache__/_lobpcg.cpython-312.pyc,, +torch/__pycache__/_lowrank.cpython-312.pyc,, +torch/__pycache__/_meta_registrations.cpython-312.pyc,, +torch/__pycache__/_namedtensor_internals.cpython-312.pyc,, +torch/__pycache__/_ops.cpython-312.pyc,, +torch/__pycache__/_python_dispatcher.cpython-312.pyc,, +torch/__pycache__/_size_docs.cpython-312.pyc,, +torch/__pycache__/_sources.cpython-312.pyc,, +torch/__pycache__/_storage_docs.cpython-312.pyc,, +torch/__pycache__/_streambase.cpython-312.pyc,, +torch/__pycache__/_tensor.cpython-312.pyc,, +torch/__pycache__/_tensor_docs.cpython-312.pyc,, +torch/__pycache__/_tensor_str.cpython-312.pyc,, +torch/__pycache__/_thread_safe_fork.cpython-312.pyc,, +torch/__pycache__/_torch_docs.cpython-312.pyc,, +torch/__pycache__/_utils.cpython-312.pyc,, +torch/__pycache__/_utils_internal.cpython-312.pyc,, +torch/__pycache__/_vmap_internals.cpython-312.pyc,, +torch/__pycache__/_weights_only_unpickler.cpython-312.pyc,, +torch/__pycache__/functional.cpython-312.pyc,, +torch/__pycache__/hub.cpython-312.pyc,, +torch/__pycache__/library.cpython-312.pyc,, +torch/__pycache__/overrides.cpython-312.pyc,, +torch/__pycache__/quasirandom.cpython-312.pyc,, +torch/__pycache__/random.cpython-312.pyc,, +torch/__pycache__/return_types.cpython-312.pyc,, +torch/__pycache__/serialization.cpython-312.pyc,, +torch/__pycache__/storage.cpython-312.pyc,, +torch/__pycache__/torch_version.cpython-312.pyc,, +torch/__pycache__/types.cpython-312.pyc,, +torch/__pycache__/version.cpython-312.pyc,, +torch/_appdirs.py,sha256=rLa9Iobnra-c2oXynV9xs7drPiok5QZSoYp-YgThBOs,26864 +torch/_awaits/__init__.py,sha256=zi2RTUcKVCkwUpLXF2KHUVMhiHeRNn-BjOo8fLm8Ay0,1705 +torch/_awaits/__pycache__/__init__.cpython-312.pyc,, +torch/_classes.py,sha256=PqWBkJgLGf3EeLYM8VerdEcsRLIMxNUxZM3OqYZIsyE,1842 +torch/_compile.py,sha256=9EuJARbuOBelpVgfo7OLis8ZZHtYcdhnWp8FnNiMBSc,2054 +torch/_custom_op/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_custom_op/__pycache__/__init__.cpython-312.pyc,, +torch/_custom_op/__pycache__/autograd.cpython-312.pyc,, +torch/_custom_op/__pycache__/impl.cpython-312.pyc,, +torch/_custom_op/autograd.py,sha256=kEZobnJr-mh7KvmVo3yF89JbHFAMMWEuvKVSqcH3HAY,12386 +torch/_custom_op/impl.py,sha256=sI_Wir8rfofT6SUO0GEh8hl-MeTHBKykNaaXwnFgww8,27799 +torch/_custom_ops.py,sha256=yVY9HB2RWS1tjTPf1F00btTJFdVmtsuG7oq5bOAF6IM,13150 +torch/_decomp/__init__.py,sha256=a7qpHOSpwCCnelq1EeayID-HgnrO2Bi3gTgkVq2hJRk,19835 +torch/_decomp/__pycache__/__init__.cpython-312.pyc,, +torch/_decomp/__pycache__/decompositions.cpython-312.pyc,, +torch/_decomp/__pycache__/decompositions_for_jvp.cpython-312.pyc,, +torch/_decomp/__pycache__/decompositions_for_rng.cpython-312.pyc,, +torch/_decomp/decompositions.py,sha256=cizx9u1KdxohjWkP7TfRIc1WyjA9lyJLcTNYByxPs9U,187344 +torch/_decomp/decompositions_for_jvp.py,sha256=g9zplqUabCDHlJ2Jfu4niVvbxr0o6Vsi25cUGJuueM8,12054 +torch/_decomp/decompositions_for_rng.py,sha256=k2NwU6p2bEOjUCgInS8YdxQWP5iW8LnOz9HIxbSWog4,9453 +torch/_dispatch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_dispatch/__pycache__/__init__.cpython-312.pyc,, +torch/_dispatch/__pycache__/python.cpython-312.pyc,, +torch/_dispatch/python.py,sha256=XaG8OqvlpJUZMa8feIl4VtoyC-I2-ef4mZqq7DkA9lE,6942 +torch/_dynamo/__init__.py,sha256=_5m6Q-8rm82wiaYYOWFRwxCQX8IfBbDVMGIFkeX6XuU,7195 +torch/_dynamo/__pycache__/__init__.cpython-312.pyc,, +torch/_dynamo/__pycache__/_trace_wrapped_higher_order_op.cpython-312.pyc,, +torch/_dynamo/__pycache__/aot_compile.cpython-312.pyc,, +torch/_dynamo/__pycache__/aot_compile_types.cpython-312.pyc,, +torch/_dynamo/__pycache__/bytecode_analysis.cpython-312.pyc,, +torch/_dynamo/__pycache__/bytecode_transformation.cpython-312.pyc,, +torch/_dynamo/__pycache__/cache_size.cpython-312.pyc,, +torch/_dynamo/__pycache__/callback.cpython-312.pyc,, +torch/_dynamo/__pycache__/code_context.cpython-312.pyc,, +torch/_dynamo/__pycache__/codegen.cpython-312.pyc,, +torch/_dynamo/__pycache__/compiled_autograd.cpython-312.pyc,, +torch/_dynamo/__pycache__/comptime.cpython-312.pyc,, +torch/_dynamo/__pycache__/config.cpython-312.pyc,, +torch/_dynamo/__pycache__/convert_frame.cpython-312.pyc,, +torch/_dynamo/__pycache__/create_parameter_op.cpython-312.pyc,, +torch/_dynamo/__pycache__/current_scope_id.cpython-312.pyc,, +torch/_dynamo/__pycache__/dce_extra_outputs.cpython-312.pyc,, +torch/_dynamo/__pycache__/debug_utils.cpython-312.pyc,, +torch/_dynamo/__pycache__/decorators.cpython-312.pyc,, +torch/_dynamo/__pycache__/device_interface.cpython-312.pyc,, +torch/_dynamo/__pycache__/distributed.cpython-312.pyc,, +torch/_dynamo/__pycache__/eval_frame.cpython-312.pyc,, +torch/_dynamo/__pycache__/exc.cpython-312.pyc,, +torch/_dynamo/__pycache__/external_utils.cpython-312.pyc,, +torch/_dynamo/__pycache__/funcname_cache.cpython-312.pyc,, +torch/_dynamo/__pycache__/functional_export.cpython-312.pyc,, +torch/_dynamo/__pycache__/graph_break_hints.cpython-312.pyc,, +torch/_dynamo/__pycache__/graph_bytecode_inputs.cpython-312.pyc,, +torch/_dynamo/__pycache__/graph_deduplication.cpython-312.pyc,, +torch/_dynamo/__pycache__/graph_region_tracker.cpython-312.pyc,, +torch/_dynamo/__pycache__/graph_utils.cpython-312.pyc,, +torch/_dynamo/__pycache__/guards.cpython-312.pyc,, +torch/_dynamo/__pycache__/hooks.cpython-312.pyc,, +torch/_dynamo/__pycache__/logging.cpython-312.pyc,, +torch/_dynamo/__pycache__/metrics_context.cpython-312.pyc,, +torch/_dynamo/__pycache__/mutation_guard.cpython-312.pyc,, +torch/_dynamo/__pycache__/output_graph.cpython-312.pyc,, +torch/_dynamo/__pycache__/package.cpython-312.pyc,, +torch/_dynamo/__pycache__/pgo.cpython-312.pyc,, +torch/_dynamo/__pycache__/precompile_context.cpython-312.pyc,, +torch/_dynamo/__pycache__/profiler.cpython-312.pyc,, +torch/_dynamo/__pycache__/replay_record.cpython-312.pyc,, +torch/_dynamo/__pycache__/resume_execution.cpython-312.pyc,, +torch/_dynamo/__pycache__/side_effects.cpython-312.pyc,, +torch/_dynamo/__pycache__/source.cpython-312.pyc,, +torch/_dynamo/__pycache__/symbolic_convert.cpython-312.pyc,, +torch/_dynamo/__pycache__/tensor_version_op.cpython-312.pyc,, +torch/_dynamo/__pycache__/test_case.cpython-312.pyc,, +torch/_dynamo/__pycache__/test_dont_skip_tracing_functions.cpython-312.pyc,, +torch/_dynamo/__pycache__/test_minifier_common.cpython-312.pyc,, +torch/_dynamo/__pycache__/testing.cpython-312.pyc,, +torch/_dynamo/__pycache__/trace_rules.cpython-312.pyc,, +torch/_dynamo/__pycache__/types.cpython-312.pyc,, +torch/_dynamo/__pycache__/utils.cpython-312.pyc,, +torch/_dynamo/_trace_wrapped_higher_order_op.py,sha256=N1zlP9f_GicfxpIkoB0MLT9JKtYo2KYhAaYFAYIXZkg,9484 +torch/_dynamo/aot_compile.py,sha256=jvmE-edUJI9qzg98qZ_cC8527Kcy06vRm-TB8TdjNNM,13731 +torch/_dynamo/aot_compile_types.py,sha256=0O0dQF6qd3A5LKYIgcCK0no_hKu815CnfbZWwzEbLdU,2043 +torch/_dynamo/backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_dynamo/backends/__pycache__/__init__.cpython-312.pyc,, +torch/_dynamo/backends/__pycache__/common.cpython-312.pyc,, +torch/_dynamo/backends/__pycache__/cudagraphs.cpython-312.pyc,, +torch/_dynamo/backends/__pycache__/debugging.cpython-312.pyc,, +torch/_dynamo/backends/__pycache__/distributed.cpython-312.pyc,, +torch/_dynamo/backends/__pycache__/inductor.cpython-312.pyc,, +torch/_dynamo/backends/__pycache__/onnxrt.cpython-312.pyc,, +torch/_dynamo/backends/__pycache__/registry.cpython-312.pyc,, +torch/_dynamo/backends/__pycache__/tensorrt.cpython-312.pyc,, +torch/_dynamo/backends/__pycache__/torchxla.cpython-312.pyc,, +torch/_dynamo/backends/__pycache__/tvm.cpython-312.pyc,, +torch/_dynamo/backends/common.py,sha256=YDFsIP8gs8xrNPJtqEHo0i50HQbN2n-dRrB5aFOo2tc,6565 +torch/_dynamo/backends/cudagraphs.py,sha256=W89RVnNoH1xApZL4xmFQgb6JxXpQ4KBfpX-rc7v-4wo,10545 +torch/_dynamo/backends/debugging.py,sha256=QnUm9AkTsS5OXMiqxN6h8EfRB_uKpmKKIclb4mwkgbA,19273 +torch/_dynamo/backends/distributed.py,sha256=VKGMPk6sutKgqQVqEot0tQbTGKQlqxHgqaEyMHpwuzI,29098 +torch/_dynamo/backends/inductor.py,sha256=vnjAYYTi-NoRgprjliY_EAMf7veNY3-rzwA_KujXHUU,1135 +torch/_dynamo/backends/onnxrt.py,sha256=CfZM1UQuX8PQ82OAB0kDHzBY69WhnnuJu84UcteMdSk,1662 +torch/_dynamo/backends/registry.py,sha256=xRYRImC5ZHLsbOW3aiZ1qJLl8GFkfz5NoUQOKXZ4ooM,5734 +torch/_dynamo/backends/tensorrt.py,sha256=DM99UhX6Kjk5PGK0vIXahoBktwkLrzC6y2J_j5GdGQo,395 +torch/_dynamo/backends/torchxla.py,sha256=JTd4OuXdKLtctu-mQQabIIVyuIGWiAx6ov_cYjODw2g,1606 +torch/_dynamo/backends/tvm.py,sha256=qz8Dihy3Fcy-n33t6HN2TCOTXxcrCYJE2RmeKq98zZU,7409 +torch/_dynamo/bytecode_analysis.py,sha256=iMDIV5pUBR4OX79mYpFEfvO_grWvCL2Du2fNP5T02bA,9483 +torch/_dynamo/bytecode_transformation.py,sha256=qkrZ8nB-HMaBn4hAcYNhzZlWbmt8156Qot-sGFn8xgo,69217 +torch/_dynamo/cache_size.py,sha256=fVs_fYrVBNSgQByI1ZIg5MpzRMoUmBDU4OdEw4vFXJg,8163 +torch/_dynamo/callback.py,sha256=N40U3zJbcHcGVXFxRWghGLeXCmVfsX9TlB76GM2QrSY,5793 +torch/_dynamo/code_context.py,sha256=vrGYv-Uomoc-Nw0Vfb5TSe3MJvMWMy220f_J5UwgLYs,1878 +torch/_dynamo/codegen.py,sha256=8jGfelCMHvGfHrCHB6h3H8ry1p6Mbd1OWa7DyoJ1caY,29715 +torch/_dynamo/compiled_autograd.py,sha256=iRauYfzFhBweTLd3veGHthlvCmXIRVQvva_ON3b6SNk,65908 +torch/_dynamo/comptime.py,sha256=bNQ2x02opPhQ8kbIt8MMac7Ne72fRYba0fxJYXtuJLE,15841 +torch/_dynamo/config.py,sha256=33V_EJVhTHDCw9ToHSivM7_GWws0kIeLTenaHID8RTU,33413 +torch/_dynamo/convert_frame.py,sha256=-wejoxH0un5Hr1aXwWagwNUqNa6H4ViwPVcZT9oCPwI,85009 +torch/_dynamo/create_parameter_op.py,sha256=OAMGGG3A-fpEm8s7X8FrVGsLwU4fgVJDUZ6xFH8TETY,2630 +torch/_dynamo/current_scope_id.py,sha256=lFy-kRPxTBYkhMrdJsk_sBax3qBGSfw0lU0Q2JPDKVA,1475 +torch/_dynamo/dce_extra_outputs.py,sha256=VcFEKCmU6B8e9ZE12F5_ZwkyYYINzk55qaVh7NB8YxI,7236 +torch/_dynamo/debug_utils.py,sha256=8LKK5ihfAytedRrPrNsS5GmQnX8cwGVXt7E6ZejuJLM,33561 +torch/_dynamo/decorators.py,sha256=OrNkZY48jbyHsypp4pasWAEWFSbII2B-cTjkopQabHI,41595 +torch/_dynamo/device_interface.py,sha256=aD4DX0FF2a0QZz9fhsWnu3J9VdHPnJhd5v8GrVQhpCY,22944 +torch/_dynamo/distributed.py,sha256=Z4DNAhzYcDguigwhwfk_c3WTo5AdL_J12mf2pK5lQYQ,1724 +torch/_dynamo/eval_frame.py,sha256=EpCwdLFgGYgo6-aDbvWMISd7L4kZrF6eo8R-IY52UWo,101107 +torch/_dynamo/exc.py,sha256=4kyPhdDAPv6EyYKwlxTeUoM3WRkm1wJjn_na3H8XEFA,27001 +torch/_dynamo/external_utils.py,sha256=bzyp5Pe8fsXIw8pjDF-5On9ha4tDw0eoCs3jHYJrS1M,9061 +torch/_dynamo/funcname_cache.py,sha256=mDVmnyyHKozM7kj-9g5VNUPSXGApc01SQSIz7Hw1MJo,2623 +torch/_dynamo/functional_export.py,sha256=Yr3MPHqzovnIcO_P9KA6b7QIGFQY_Vwkyy31A1VYjqI,34563 +torch/_dynamo/graph_break_hints.py,sha256=u9QZAhv9Q57TnNARiIC-zCgRYHbhEuyj5Id5qzOI6fY,1353 +torch/_dynamo/graph_break_registry.json,sha256=ae9Nvvla2ID5u_z60TrTv30oqQGnYFCMz5XwJfiUiqw,159263 +torch/_dynamo/graph_bytecode_inputs.py,sha256=au8TxATiLEkUO1HVXkB-Id3CLT_uKVUFYXX-XPDmwSU,3223 +torch/_dynamo/graph_deduplication.py,sha256=I8lwDeMvr_Qm1BJQgRLhGXG0dsanNouoi9YHz-JnS90,24233 +torch/_dynamo/graph_region_tracker.py,sha256=E1Y1nHrY328Cc3GVOvrNiazElDGie0Ic-b-lu0qFyB4,19101 +torch/_dynamo/graph_utils.py,sha256=UflcRWZY3W_64qafyJkuu4id57LtTq7oau_UIRKASjI,3674 +torch/_dynamo/guards.py,sha256=3z9Pd9HwU1jG4nT2abPLwas4p3DNqfwXiLgCiVKjPB8,194021 +torch/_dynamo/hooks.py,sha256=LmwYLJ35qtKIIjIRkZ0oVxTVVOFbCXYiUSmN0UZUe7U,919 +torch/_dynamo/logging.py,sha256=lS0J0y80S9sjM6T2cmWdQhHao-I3qm3OPBEr1mfWb3A,2288 +torch/_dynamo/metrics_context.py,sha256=tb4L_-GB6nsZ3pRuoor1ivKe3Cev6aAYphiflVA8aBU,9140 +torch/_dynamo/mutation_guard.py,sha256=UGjX_9eQwO-ahBxknnqF4sb-inkDpOlutah1luzJylQ,5326 +torch/_dynamo/output_graph.py,sha256=GumREwj5qOJQpXNkUg7T5Rk0W_LDns6PHg2L8G7gbMs,171635 +torch/_dynamo/package.py,sha256=MpdMpAGgsp7mE3khS59BIndt8iMNhB3Ju-e1nObRP_8,43336 +torch/_dynamo/pgo.py,sha256=dANreP0g9-ffziohL47mOX2vb56thFbtzCodrIDzf-o,37395 +torch/_dynamo/polyfills/__init__.py,sha256=lZnQiBfVDyvUBfZMFCbWIbokC4yU6ZVuMDedz7ruW3E,12893 +torch/_dynamo/polyfills/__pycache__/__init__.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/_collections.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/builtins.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/functools.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/fx.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/heapq.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/itertools.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/loader.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/operator.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/os.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/pytree.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/struct.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/sys.cpython-312.pyc,, +torch/_dynamo/polyfills/__pycache__/tensor.cpython-312.pyc,, +torch/_dynamo/polyfills/_collections.py,sha256=Gkg4DWB2yr7zNSdTuqOe-1YblomZMkSlPlvQN-eRUY4,695 +torch/_dynamo/polyfills/builtins.py,sha256=o7Bnptw7HKcHVzR-ORl8Dj4luPKkXNUzSunwgZ84S9A,3781 +torch/_dynamo/polyfills/functools.py,sha256=zF1CaQQdatxR18pr-3oKxYC0KajGkHZHlQPZq4EvHlg,1013 +torch/_dynamo/polyfills/fx.py,sha256=jkeFk5bs5TOvNU0FHYO7V9Z0R_4k3x9GxPefHXt8odU,1391 +torch/_dynamo/polyfills/heapq.py,sha256=kcnhoNNePROXkm8LXGlOt1aZm02BlztY9qOXXI1Uggc,3410 +torch/_dynamo/polyfills/itertools.py,sha256=FehtPQCLW76_SsEly032_d1MrQr_grhBdgdUdsCXedg,8336 +torch/_dynamo/polyfills/loader.py,sha256=1fWN6-Frjy4ol4hlP0fMJlItSNJ_WrjAXWlgw09a1CI,1428 +torch/_dynamo/polyfills/operator.py,sha256=n5RFcbAi38Ex00_zyNoowwA9i8JFCaK686N4iFiJQgU,3574 +torch/_dynamo/polyfills/os.py,sha256=VkTisQNaguiSp54BsQbVKs8pJQfO7wFyetMILeqOVb8,1054 +torch/_dynamo/polyfills/pytree.py,sha256=O6ytdD8yRLLY2HEbeu8bwyUUmO2TAGrc_4vD8YRAM1E,25190 +torch/_dynamo/polyfills/struct.py,sha256=6MCbH6SYLKyfOO5rHeXcd_NpOVvWoKVEn9g9iE6LfZo,645 +torch/_dynamo/polyfills/sys.py,sha256=ZNI7BTnW4UuQAXYe4-WoYwx1ykst8H-C3oPZskLBINQ,740 +torch/_dynamo/polyfills/tensor.py,sha256=Xvr3-armSIna8ql7NVTIoL0xw4kPiSEUcWgDsINR7Mw,1444 +torch/_dynamo/precompile_context.py,sha256=NOf9VVoWh2dRfvU7StcFOPPfOX7tNhO3FSOaBrJDDx0,7988 +torch/_dynamo/profiler.py,sha256=jYz7143TuhQ7bKflgGdRKJsynqi2O90qNZwsMSAc5AY,6071 +torch/_dynamo/replay_record.py,sha256=9gwffJ2OXZYFZfw8HCf-b8B3zqaVFB7eh9R83hyGHM4,4519 +torch/_dynamo/repro/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_dynamo/repro/__pycache__/__init__.cpython-312.pyc,, +torch/_dynamo/repro/__pycache__/after_aot.cpython-312.pyc,, +torch/_dynamo/repro/__pycache__/after_dynamo.cpython-312.pyc,, +torch/_dynamo/repro/__pycache__/aoti.cpython-312.pyc,, +torch/_dynamo/repro/after_aot.py,sha256=BQ8Y6ms3i9sFRCVAixiIuLwDOHTBVtostegWPUJMxdc,46275 +torch/_dynamo/repro/after_dynamo.py,sha256=cIFD-J-3M8LyL99UoNg86PpPpCCeBss1qNORnTGSxV4,22864 +torch/_dynamo/repro/aoti.py,sha256=FjBppNeNv7KeZ6yRxsQO-7Pt-nv3Fko-9IkeJycBEIA,23120 +torch/_dynamo/resume_execution.py,sha256=_gIftMrXsPFU3nPZWtJiSuV3QmBfpm9TadCtDPQ8NYI,31644 +torch/_dynamo/side_effects.py,sha256=rJBbNNtLXq4-5VBUnmkX0cCN4JD6xVAQNNVHMwKujv8,54549 +torch/_dynamo/source.py,sha256=ueZ74wDebGMXpdt0yCecJnpMeBzLpcnM19wXqmacGOU,44878 +torch/_dynamo/symbolic_convert.py,sha256=2pJxLV_SqzXFyYnscTzSEg5pZBbhvwy0xba3K5gd3m0,221912 +torch/_dynamo/tensor_version_op.py,sha256=gn1qCrRwEQUxeqi9CWABAjREXC5Eb2Evu8ZiJ3NwS_0,2805 +torch/_dynamo/test_case.py,sha256=K3VLryS0273EZWq7u_jVG5hAKMexxVlToK-KBg4BCRA,8893 +torch/_dynamo/test_dont_skip_tracing_functions.py,sha256=eFed1TvI4WRSq5uyNxHVze9STb36PBBOuACuu4n82vs,857 +torch/_dynamo/test_minifier_common.py,sha256=sEPgrEYOcrC2ozZXGI3HmElHAuYbgiyF4DSt1oQ9qrU,13001 +torch/_dynamo/testing.py,sha256=vVtp--LqCN71k2ZgU5hZSG1gsK_cHqZ7BCQIGquZ9-8,18852 +torch/_dynamo/trace_rules.py,sha256=6WAYmvD-qk8YVU2fCwAHwvh4_hYR0_VMY-qWVbh2p6M,161509 +torch/_dynamo/types.py,sha256=jLudBeuc2UT7oF3N2CF2eyZdEOmVwjgDQ-zmXMs-1Mo,4322 +torch/_dynamo/utils.py,sha256=jTgT3artQgj02cDC34bTYMpeeIpHYNLcvnefILePQV4,180062 +torch/_dynamo/variables/__init__.py,sha256=yfBmhig9a4EmDmACXG7Sql4NsunIsHCkRlkxHCUFsGg,7147 +torch/_dynamo/variables/__pycache__/__init__.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/base.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/builder.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/builtin.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/constant.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/ctx_manager.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/dicts.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/distributed.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/functions.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/higher_order_ops.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/iter.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/lazy.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/lists.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/misc.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/nn_module.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/optimizer.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/script_object.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/sdpa.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/streams.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/tensor.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/torch.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/torch_function.cpython-312.pyc,, +torch/_dynamo/variables/__pycache__/user_defined.cpython-312.pyc,, +torch/_dynamo/variables/base.py,sha256=sd9Nelb5f7Ty3UnVEUTvXHIun1HqeYX3euR1Ge5DFZ4,32224 +torch/_dynamo/variables/builder.py,sha256=04C0OIojFFf2_Hl2awBA8SQpHx7HnPYnncyRk8cTRAM,174647 +torch/_dynamo/variables/builtin.py,sha256=23y4nonidbTv28ZjIiCj8HOthQOCvDeafJYkgSEg4wc,132066 +torch/_dynamo/variables/constant.py,sha256=vsGbqVj-wwfSdFFIoniDZ_Sz6aiqIrShdIxlH5hZghM,16858 +torch/_dynamo/variables/ctx_manager.py,sha256=tzDeM-2XNBfMm8xWuSHxppkgMCWRGp3Gb9LD8eSF4WY,55667 +torch/_dynamo/variables/dicts.py,sha256=69ajpju0MgnD_Gj_B6btvTN08e0mFgE_mOJwgKq-WZ8,61325 +torch/_dynamo/variables/distributed.py,sha256=KG9Cb_FooccT8syyyOx3zwQGxTz4WySFfPshCI8Detk,19873 +torch/_dynamo/variables/functions.py,sha256=9ZucPO8OfFceOMPWKvboBg3S_iYVw5XOOKFkx7uOMdw,118249 +torch/_dynamo/variables/higher_order_ops.py,sha256=nYBg6uCVZdF3Cy4M1jyVxppTkTgDfG2zQxp6WfhzL_g,190742 +torch/_dynamo/variables/iter.py,sha256=G8EqGyBACQAW9NjfMSKibqsMkopUe0al_TDaHBN_qc4,22959 +torch/_dynamo/variables/lazy.py,sha256=qEWK8BY28_XuV0n_rSI4VM4UtRvWXpijZ9CK9qyS-uY,8315 +torch/_dynamo/variables/lists.py,sha256=w7K4Zlzl9TYMMqXmqmWmEMw9SmNj19BM__oqw_AKgJc,68450 +torch/_dynamo/variables/misc.py,sha256=cJoCOPCnho1Igf2LdeHRVaHFmozlyChT0feUXmyUnA4,85748 +torch/_dynamo/variables/nn_module.py,sha256=GV_n_Bwk3f4mS9qGguLbPB891RzHZXI3mhXlIzVp7_k,61335 +torch/_dynamo/variables/optimizer.py,sha256=qbUZQv7rN-c4IBmIY9uhqp-okGiQAXxdtsOqZq8nGRM,18157 +torch/_dynamo/variables/script_object.py,sha256=xkcy154UlgSYPWauic3QF_BxX3WFt7hmAYgEK1_2UZo,9140 +torch/_dynamo/variables/sdpa.py,sha256=d7dGjAGaK_B06L7iTC5ehHQ0t7dLIkmVlg268quI5lw,3082 +torch/_dynamo/variables/streams.py,sha256=8ZOA1U85WtzFGVY2NLUu-0MBjlCrednD7s2Ab9VU0u4,18373 +torch/_dynamo/variables/tensor.py,sha256=FMNL1mSATt-nTU5ZkPAOjfRyYlV8jchlRWstX8RLdvw,74491 +torch/_dynamo/variables/torch.py,sha256=vKo4EywjphJo5YGL8uwz1ss0IE4zM959ywQWzeFrFcI,96004 +torch/_dynamo/variables/torch_function.py,sha256=heUvffsMQTUms0qm9lXECXaH2bqpQBeI0_oVYNKLzaI,28424 +torch/_dynamo/variables/user_defined.py,sha256=Yry226vOHlGqtieLqRCtkcQZ-jAYTZkxmf_raLTVdg0,98459 +torch/_environment.py,sha256=oY4eUdyvzp214s4IxxLW5tcr0N7KkAVyR0qrjXKPqmg,44 +torch/_export/__init__.py,sha256=8uo7ODRneseCn7n8axFFCkQP_2SwHuHCTP2p-Q63CAU,6880 +torch/_export/__pycache__/__init__.cpython-312.pyc,, +torch/_export/__pycache__/config.cpython-312.pyc,, +torch/_export/__pycache__/converter.cpython-312.pyc,, +torch/_export/__pycache__/error.cpython-312.pyc,, +torch/_export/__pycache__/non_strict_utils.cpython-312.pyc,, +torch/_export/__pycache__/pass_base.cpython-312.pyc,, +torch/_export/__pycache__/tools.cpython-312.pyc,, +torch/_export/__pycache__/utils.cpython-312.pyc,, +torch/_export/__pycache__/verifier.cpython-312.pyc,, +torch/_export/__pycache__/wrappers.cpython-312.pyc,, +torch/_export/config.py,sha256=UNhvyXOBo4lBJkzxDrRMgJ1dOK2rGk1ieKxepYxUaPE,1455 +torch/_export/converter.py,sha256=IrDoX2FaEnYCaL7hmhDsyTE82uP9WpaZtCLZcB14b9c,66179 +torch/_export/db/__init__.py,sha256=JQMVLRoFCKo629KQ_1vu4i10Rmkww8EWMyZnDLEGXag,211 +torch/_export/db/__pycache__/__init__.cpython-312.pyc,, +torch/_export/db/__pycache__/case.cpython-312.pyc,, +torch/_export/db/__pycache__/gen_example.cpython-312.pyc,, +torch/_export/db/__pycache__/logging.cpython-312.pyc,, +torch/_export/db/case.py,sha256=YdtJBLjLUa3p5-ZraG5flbB9dgLWVsbvpDoAIKwjqrw,5215 +torch/_export/db/examples/__init__.py,sha256=NpYiPkSVS3WILe8olwFApfL91puPyaicw9oNcGnZq68,1709 +torch/_export/db/examples/__pycache__/__init__.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/assume_constant_result.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/autograd_function.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/class_method.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/cond_branch_class_method.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/cond_branch_nested_function.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/cond_branch_nonlocal_variables.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/cond_closed_over_variable.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/cond_operands.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/cond_predicate.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/constrain_as_size_example.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/constrain_as_value_example.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/decorator.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/dictionary.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/dynamic_shape_assert.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/dynamic_shape_constructor.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/dynamic_shape_if_guard.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/dynamic_shape_map.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/dynamic_shape_round.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/dynamic_shape_slicing.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/dynamic_shape_view.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/fn_with_kwargs.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/list_contains.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/list_unpack.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/model_attr_mutation.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/nested_function.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/null_context_manager.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/optional_input.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/pytree_flatten.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/scalar_output.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/specialized_attribute.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/static_for_loop.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/static_if.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/tensor_setattr.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/type_reflection_method.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/unsupported_operator.cpython-312.pyc,, +torch/_export/db/examples/__pycache__/user_input_mutation.cpython-312.pyc,, +torch/_export/db/examples/assume_constant_result.py,sha256=KpwYNJ7FSfogkz2pR_bdCrpEGaEKoUYcOYZ41tMT52o,530 +torch/_export/db/examples/autograd_function.py,sha256=Co4HJsQVM_GGURe-qzbywwGM9_mzRD1SR9Glcu8RZ7A,677 +torch/_export/db/examples/class_method.py,sha256=7RhhdSXeU2bWbLCk1Ftdmot1r2rdzS2YC3LWC5L-naE,521 +torch/_export/db/examples/cond_branch_class_method.py,sha256=n7r_4c1IomIpdPhhsE63NSdm2JNItSuBh3_83wIh8wo,1371 +torch/_export/db/examples/cond_branch_nested_function.py,sha256=r0A2249Ipudz5ONHPCkiUZ5nA1PQrNPTroVcluJ5a2A,1343 +torch/_export/db/examples/cond_branch_nonlocal_variables.py,sha256=sUe5h7AMWE958RPYXBWHKBRD_AIY8dqhKkrmjyPPJWw,1900 +torch/_export/db/examples/cond_closed_over_variable.py,sha256=9Mn39Q8WcZ9HUu26wq06BDhyNCE2OSw-AeNj7tuZh9U,569 +torch/_export/db/examples/cond_operands.py,sha256=ZtEnfCwl-YFVWTiR_Fz0W3IV0R04PVHrcACrn848K8o,834 +torch/_export/db/examples/cond_predicate.py,sha256=pj3w9TsgmM_UffQTngHb_Yd-lBw9CbBrQdEmrh7ou38,688 +torch/_export/db/examples/constrain_as_size_example.py,sha256=5buSl4CAqPuZ51YOM169MVKduHRsU7FN4CFU-MuyNh4,538 +torch/_export/db/examples/constrain_as_value_example.py,sha256=8t3SGXzbKG18x5lDzsbd2qfS5GMzGlYT8WR3OfX_aBg,597 +torch/_export/db/examples/decorator.py,sha256=oHQ39bHuPeK3EeOV3HsyRs7MY5KxXO1eOR1CNPiZQ_U,503 +torch/_export/db/examples/dictionary.py,sha256=NJ-Klzxl-mE0IhFJGNkW8HN0FAg9HcAU5yccntZvedc,421 +torch/_export/db/examples/dynamic_shape_assert.py,sha256=0rRtnAHLYSYPxtONdmJz_MyCeJdGpCaM-sbLspi10Oo,468 +torch/_export/db/examples/dynamic_shape_constructor.py,sha256=lOjFINCStd4zmu2Vr9zi_rwYaL5A0sobDoVX3qhT6HM,411 +torch/_export/db/examples/dynamic_shape_if_guard.py,sha256=qggdXy2eBJk0kKaHnRPoM5v_ORu7kw4AgLkbd1jW0XA,579 +torch/_export/db/examples/dynamic_shape_map.py,sha256=ROqfFs6mIxZGNf4m_j39kimJ6ZiegndVByWRmGqAp8k,473 +torch/_export/db/examples/dynamic_shape_round.py,sha256=AfXnT8_oeDAcDnpFscD3qGhUuFA3PiyJMdLig-9D1_8,546 +torch/_export/db/examples/dynamic_shape_slicing.py,sha256=jv84W8ewyLl6W7qRP9jj1FEJzTUsKv4rcnT3dU4bPOM,403 +torch/_export/db/examples/dynamic_shape_view.py,sha256=mWYcUNa-btUzG5aF994K0wOOqG5V1y6gxRE2h7Gb-Hk,461 +torch/_export/db/examples/fn_with_kwargs.py,sha256=qUPoxV4BUCkLfEznW5PjHLYg-ggap5QI-IFtzM4FqyE,761 +torch/_export/db/examples/list_contains.py,sha256=EG9tgRlSkbZnz9hmLV5OEHVGonugVkwFPZgVmx-dTgU,494 +torch/_export/db/examples/list_unpack.py,sha256=avXgBV5cMTlHTHoqn01zFYv1oH6rkOTUlpdEneA5Qwk,589 +torch/_export/db/examples/model_attr_mutation.py,sha256=R-KgnL0GrB9K-QaNcRkbTsFfrBs6jGQmF7lddgkmsKA,652 +torch/_export/db/examples/nested_function.py,sha256=6M1YbZo8AXA7pIEwDjNjloeguUPkv2tTC22RgBYSMiU,514 +torch/_export/db/examples/null_context_manager.py,sha256=1fBDJxbRhIAW9td0fsifR8QoBpdGAlXwq4GxMiYNYg4,499 +torch/_export/db/examples/optional_input.py,sha256=nEbuZ4PXWxRPWSqUyg7qdT4Mylix2290YcT11X1B5V4,467 +torch/_export/db/examples/pytree_flatten.py,sha256=igCLbl367lo6N8zZXm5MXpX2tmF22uceQL6aDZP5tsk,392 +torch/_export/db/examples/scalar_output.py,sha256=fpbxy1MySLUTAz57P39pLBPVEfSdIAC0d9JDAa7lB9g,566 +torch/_export/db/examples/specialized_attribute.py,sha256=prbTioycap7pvNkI_3SA688cfTJHvtFYNw42tPns40M,546 +torch/_export/db/examples/static_for_loop.py,sha256=f4dXMQw28-cspeGBVhZ31y_IEXhZ3YUFzoRrPP_Qh7g,401 +torch/_export/db/examples/static_if.py,sha256=CQPwPy1r7gcN7cR2cdziwTnj9aakvW53-ojoc-snBcw,415 +torch/_export/db/examples/tensor_setattr.py,sha256=PCCle6Wexu0ZBwxOSFr35UZwIjlBAe9o1LuLKQIJFwY,352 +torch/_export/db/examples/type_reflection_method.py,sha256=3Z-5GHb5eWKuuLK0-6B_tG_nZNeizr4Y7AuLDZRQ7ig,483 +torch/_export/db/examples/unsupported_operator.py,sha256=jiHwslxhsRjC1Uld3EVVMCme6RG0e1rf0JdUvs7bfc4,429 +torch/_export/db/examples/user_input_mutation.py,sha256=fe-oUXenBLZprn69qn4J6s804qrnJBMcXb0gQZJhVaE,319 +torch/_export/db/gen_example.py,sha256=43Jhg_l7Ke17ml79_eU8T_qT5NmyhjiEisZVK-YjRus,483 +torch/_export/db/logging.py,sha256=0klrl3FUoV6TR5IT_qZlrCjp9ttL170g0fwd2sENUa0,1738 +torch/_export/error.py,sha256=QXyVuJjbdbTcTodQ9tth-jUUpBeg4T8Ar3WLh1wHLXM,1826 +torch/_export/non_strict_utils.py,sha256=TtSiefDHs9bv2D6TBLpwE2BpNKht9XSfdsH0rSpwnhw,43684 +torch/_export/pass_base.py,sha256=IgaIpKvAYyUC3YDHqb9mga46Xdl6g10ZPWbImEalU0E,19004 +torch/_export/pass_infra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_export/pass_infra/__pycache__/__init__.cpython-312.pyc,, +torch/_export/pass_infra/__pycache__/node_metadata.cpython-312.pyc,, +torch/_export/pass_infra/__pycache__/proxy_value.cpython-312.pyc,, +torch/_export/pass_infra/node_metadata.py,sha256=rSit62__D-HKQrSX_8DrvzUsaT9XEuK3XwIB9AtHBqU,803 +torch/_export/pass_infra/proxy_value.py,sha256=McjGBissRThDTqog2Iwt2oE-m1jN_cPsFUYqh2Xv5Qk,1314 +torch/_export/passes/__init__.py,sha256=mUQ0mkji9c_GH4vU9VaS1CXALHLwW0mic3OhC2gXM3M,89 +torch/_export/passes/__pycache__/__init__.cpython-312.pyc,, +torch/_export/passes/__pycache__/_node_metadata_hook.cpython-312.pyc,, +torch/_export/passes/__pycache__/add_runtime_assertions_for_constraints_pass.cpython-312.pyc,, +torch/_export/passes/__pycache__/collect_tracepoints_pass.cpython-312.pyc,, +torch/_export/passes/__pycache__/constant_folding.cpython-312.pyc,, +torch/_export/passes/__pycache__/functionalize_side_effectful_ops_pass.cpython-312.pyc,, +torch/_export/passes/__pycache__/insert_custom_op_guards.cpython-312.pyc,, +torch/_export/passes/__pycache__/lift_constants_pass.cpython-312.pyc,, +torch/_export/passes/__pycache__/remove_runtime_assertions.cpython-312.pyc,, +torch/_export/passes/__pycache__/replace_autocast_with_hop_pass.cpython-312.pyc,, +torch/_export/passes/__pycache__/replace_quantized_ops_with_standard_ops_pass.cpython-312.pyc,, +torch/_export/passes/__pycache__/replace_set_grad_with_hop_pass.cpython-312.pyc,, +torch/_export/passes/__pycache__/replace_view_ops_with_view_copy_ops_pass.cpython-312.pyc,, +torch/_export/passes/__pycache__/replace_with_hop_pass_util.cpython-312.pyc,, +torch/_export/passes/_node_metadata_hook.py,sha256=1xvyAW3kpqSEnXC24Ar7uYUuEZkZNMqfz5UmS0CMrjQ,3490 +torch/_export/passes/add_runtime_assertions_for_constraints_pass.py,sha256=8J3gHJ0jWWm_GKY3MKLwrUsnAzsGVBkiSHv1CfMQzFQ,10480 +torch/_export/passes/collect_tracepoints_pass.py,sha256=iHGXF406Fl0W2NbAW9r_Agx3BXG_mDa5rmGM40DBIUw,6668 +torch/_export/passes/constant_folding.py,sha256=XJYotbvKAs0CY62-TjfaZzcWa2oQpLIlBItidWYnPLI,11607 +torch/_export/passes/functionalize_side_effectful_ops_pass.py,sha256=dLd8XyxsoK70zUyKgURKgbIXf7VcbaIRJ7eFrVPD7gM,3378 +torch/_export/passes/insert_custom_op_guards.py,sha256=wN-I5VmxwoPEqzCk5rilsGs2zE7hoM44OPzdv_FCJ8o,2997 +torch/_export/passes/lift_constants_pass.py,sha256=jvoI3Gx0DAUr7W2H3YmDj-VeCZ67pnbIqiI3JSl_FU8,18039 +torch/_export/passes/remove_runtime_assertions.py,sha256=yokuUkDsU9_AJyeeWLPYR3YjIqdCM_jX9BW7h1eRpAE,1624 +torch/_export/passes/replace_autocast_with_hop_pass.py,sha256=miDppPZC4BAa7cEsMjjWi05lQSyaQAX_6cMWBv397SU,7352 +torch/_export/passes/replace_quantized_ops_with_standard_ops_pass.py,sha256=d1bZDLN0u6kv4eQ3ejuEG1FEoGYHiJiNAwvw2niVNWQ,26736 +torch/_export/passes/replace_set_grad_with_hop_pass.py,sha256=M67REtbDT0j6PsYQCOQNpX7a7nAm7CXLU2Ywy1vNlkU,4405 +torch/_export/passes/replace_view_ops_with_view_copy_ops_pass.py,sha256=MtQ07dRGrLc2Qfr5IyPMuxjcem2pVKEnq21_ci1xs2w,2476 +torch/_export/passes/replace_with_hop_pass_util.py,sha256=lZm7wssnQrGHNW4108i8PPTIFUvhgCYi4TQ8MIC59i0,7791 +torch/_export/serde/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_export/serde/__pycache__/__init__.cpython-312.pyc,, +torch/_export/serde/__pycache__/dynamic_shapes.cpython-312.pyc,, +torch/_export/serde/__pycache__/schema.cpython-312.pyc,, +torch/_export/serde/__pycache__/schema_check.cpython-312.pyc,, +torch/_export/serde/__pycache__/serialize.cpython-312.pyc,, +torch/_export/serde/__pycache__/union.cpython-312.pyc,, +torch/_export/serde/dynamic_shapes.py,sha256=tQzGYM83Z8wcRUGyLUCgS6wCzB2kHKt5BjbpdjMW7uk,11977 +torch/_export/serde/export_schema.thrift,sha256=oEB08fTbcorV5JnMafSNvECJSkQx3pGxmUZa91d2WhM,7695 +torch/_export/serde/schema.py,sha256=4r-mv-LwWAjrhotTGQv6RUdXM67wmzjEnbS_uK7Vxd4,15410 +torch/_export/serde/schema.yaml,sha256=IhexB2FIJHKOw89QHr1mDOTWT-9lYYedLTj8x2ueVC4,10486 +torch/_export/serde/schema_check.py,sha256=C87ToZvw9EjY6eKinW47D-HNn0zjp0er9QYI7TaHfcE,25488 +torch/_export/serde/serialize.py,sha256=fyT-Mq6M03Ku-iElLjT2MBZagMbPNeiU8M8zBqRayM0,163565 +torch/_export/serde/union.py,sha256=hMTGukFaA2bH4QVTDxrKVJb-eOF8xOc1Zluizyrc4Dk,3037 +torch/_export/tools.py,sha256=GAD-rnKBoJdCS8rNjeCnrJP4WCudqDG5puJziZDaPPU,4747 +torch/_export/utils.py,sha256=c3X0ZXUAMpyQSg5FY48BLliBKLC7Od6NRV5-oCXcyFY,60448 +torch/_export/verifier.py,sha256=tte-x0GjdJqh04t0Lo5Z8lhpXVeQ8mFygZJCcRbR6X0,21710 +torch/_export/wrappers.py,sha256=cCquLUwnt52PbMrJINzl_hmcRZL_XVqpml_rS8SM2Jg,12850 +torch/_functorch/__init__.py,sha256=JQMVLRoFCKo629KQ_1vu4i10Rmkww8EWMyZnDLEGXag,211 +torch/_functorch/__pycache__/__init__.cpython-312.pyc,, +torch/_functorch/__pycache__/aot_autograd.cpython-312.pyc,, +torch/_functorch/__pycache__/apis.cpython-312.pyc,, +torch/_functorch/__pycache__/autograd_function.cpython-312.pyc,, +torch/_functorch/__pycache__/batch_norm_replacement.cpython-312.pyc,, +torch/_functorch/__pycache__/benchmark_utils.cpython-312.pyc,, +torch/_functorch/__pycache__/compile_utils.cpython-312.pyc,, +torch/_functorch/__pycache__/compilers.cpython-312.pyc,, +torch/_functorch/__pycache__/config.cpython-312.pyc,, +torch/_functorch/__pycache__/deprecated.cpython-312.pyc,, +torch/_functorch/__pycache__/eager_transforms.cpython-312.pyc,, +torch/_functorch/__pycache__/functional_call.cpython-312.pyc,, +torch/_functorch/__pycache__/fx_minifier.cpython-312.pyc,, +torch/_functorch/__pycache__/make_functional.cpython-312.pyc,, +torch/_functorch/__pycache__/partitioners.cpython-312.pyc,, +torch/_functorch/__pycache__/predispatch.cpython-312.pyc,, +torch/_functorch/__pycache__/pyfunctorch.cpython-312.pyc,, +torch/_functorch/__pycache__/python_key.cpython-312.pyc,, +torch/_functorch/__pycache__/pytree_hacks.cpython-312.pyc,, +torch/_functorch/__pycache__/top_operators_github_usage.cpython-312.pyc,, +torch/_functorch/__pycache__/utils.cpython-312.pyc,, +torch/_functorch/__pycache__/vmap.cpython-312.pyc,, +torch/_functorch/_activation_checkpointing/__init__.py,sha256=JQMVLRoFCKo629KQ_1vu4i10Rmkww8EWMyZnDLEGXag,211 +torch/_functorch/_activation_checkpointing/__pycache__/__init__.cpython-312.pyc,, +torch/_functorch/_activation_checkpointing/__pycache__/ac_logging_utils.cpython-312.pyc,, +torch/_functorch/_activation_checkpointing/__pycache__/graph_info_provider.cpython-312.pyc,, +torch/_functorch/_activation_checkpointing/__pycache__/knapsack.cpython-312.pyc,, +torch/_functorch/_activation_checkpointing/__pycache__/knapsack_evaluator.cpython-312.pyc,, +torch/_functorch/_activation_checkpointing/__pycache__/remat_using_tags_for_fwd_loss_bwd_graph_pass.cpython-312.pyc,, +torch/_functorch/_activation_checkpointing/ac_logging_utils.py,sha256=Dca4UcfRqK2Eg40n9w7uyHK_vG_pHAhIlZiEdlPOFd0,8133 +torch/_functorch/_activation_checkpointing/graph_info_provider.py,sha256=3gNFcgqVvSsloI2wep02BTt-1TG16apy6TdtHzDqjJY,13037 +torch/_functorch/_activation_checkpointing/knapsack.py,sha256=H2hrg3ZZpha9eddwpBgCLVBH6rDYQ-tTwiDos9FERag,9527 +torch/_functorch/_activation_checkpointing/knapsack_evaluator.py,sha256=nw-Pd37w1eoGaShz-cPMQ58p291jLIBsmYFg0PlqoQg,12105 +torch/_functorch/_activation_checkpointing/remat_using_tags_for_fwd_loss_bwd_graph_pass.py,sha256=5xAAF4JauEoZ1WKtDMhEcadbMqtLFDAS3u5H_OAzqE4,5113 +torch/_functorch/_activation_offloading/__init__.py,sha256=JQMVLRoFCKo629KQ_1vu4i10Rmkww8EWMyZnDLEGXag,211 +torch/_functorch/_activation_offloading/__pycache__/__init__.cpython-312.pyc,, +torch/_functorch/_activation_offloading/__pycache__/activation_offloading.cpython-312.pyc,, +torch/_functorch/_activation_offloading/activation_offloading.py,sha256=DZdzeqWZnVsxp1lTF6X7oSLMIB8QDOSbFkODkf-_D2w,32067 +torch/_functorch/_aot_autograd/__init__.py,sha256=JQMVLRoFCKo629KQ_1vu4i10Rmkww8EWMyZnDLEGXag,211 +torch/_functorch/_aot_autograd/__pycache__/__init__.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/aot_autograd_result.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/autograd_cache.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/collect_metadata_analysis.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/descriptors.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/frontend_utils.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/functional_utils.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/fx_utils.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/graph_capture.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/graph_capture_wrappers.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/graph_compile.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/indexed_dict.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/input_output_analysis.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/logging_utils.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/runtime_wrappers.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/schemas.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/streams.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/subclass_parametrization.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/subclass_utils.cpython-312.pyc,, +torch/_functorch/_aot_autograd/__pycache__/utils.cpython-312.pyc,, +torch/_functorch/_aot_autograd/aot_autograd_result.py,sha256=kHbb7MPW0scVqmnKUvG5J0eSxxrMV3_dPP4UaybPpeo,25875 +torch/_functorch/_aot_autograd/autograd_cache.py,sha256=N0hzlUEms3OIM2lSivpgyf9eOSIa5q_ovwd5M_G34fo,44445 +torch/_functorch/_aot_autograd/collect_metadata_analysis.py,sha256=teC44VD__kDmLO-O0HYYbbBw_7kSFkLYMZeWVjI13i0,46241 +torch/_functorch/_aot_autograd/descriptors.py,sha256=HCfYnoITO3MwhrGRVxHKhknBFDgmNU9OZKE0XXbTtWY,27284 +torch/_functorch/_aot_autograd/frontend_utils.py,sha256=VZSm0z0mijjZra4FYA8dhnnAkznYlpqSxotyw2xDfWQ,13740 +torch/_functorch/_aot_autograd/functional_utils.py,sha256=3j-JNl1xWqJItykibuLgat2de5q2I5zdJZYGhniR7ks,24193 +torch/_functorch/_aot_autograd/fx_utils.py,sha256=HBrrPRxWgTCauSAUluw-NE6Jvrj3e50rlE_tJxRZyE0,12807 +torch/_functorch/_aot_autograd/graph_capture.py,sha256=b1k7bk5I4wpeDftwrgn-1rS3w9XAag12Zjhexcrr6Gw,19321 +torch/_functorch/_aot_autograd/graph_capture_wrappers.py,sha256=KK_ttOo2nJ1dCG6SgqECdW5qeFhiI5RpjEtt15VkkEg,63953 +torch/_functorch/_aot_autograd/graph_compile.py,sha256=RPl6mqaisozqxpuuc5Yscl2RlwWcBJ9ZCQjvp0BU8HA,93649 +torch/_functorch/_aot_autograd/indexed_dict.py,sha256=EPDqBu_8qtyutLt5Uav6IP6UchRwfJ23LazAF7f8HxE,1813 +torch/_functorch/_aot_autograd/input_output_analysis.py,sha256=C5Ep7MUhwxVweBdfwrE0FmCOU7EZz0WM2CnZmj7nlGU,19251 +torch/_functorch/_aot_autograd/logging_utils.py,sha256=33Kv5EvC8VfnHcHFvDXVc_Av3AWgVMBbMLEjCcLWP9k,4722 +torch/_functorch/_aot_autograd/runtime_wrappers.py,sha256=WSGP-A5xG-4b73jyWHKcgLLRLSDF8qiG_XN-eJU64TI,114133 +torch/_functorch/_aot_autograd/schemas.py,sha256=kFah6XbqTUqPXAZgHggWCy8u5C8bYqvQb2kxB1CbC7A,55642 +torch/_functorch/_aot_autograd/streams.py,sha256=AIX1p5zGsUkPkusnbKgPTUlQNx8i5zf2GWrCHcM4Qds,10806 +torch/_functorch/_aot_autograd/subclass_parametrization.py,sha256=MVqCLY7-QYaAoStr6qkEWYWq2ORvF31-yDWrtnOFlJg,4228 +torch/_functorch/_aot_autograd/subclass_utils.py,sha256=E5Uca37Ce-FB4eFPp4SLkdZNYxvDq0h1oevv9yLGkTs,20795 +torch/_functorch/_aot_autograd/utils.py,sha256=vG3qdnkyWXLCQWjtAR28kDhc3lo54tZVW1AZqSR49Bk,30492 +torch/_functorch/aot_autograd.py,sha256=1KRDiJ590vTJHvgEwxjFrVjaYTd2OJhmFekjdT45G00,73709 +torch/_functorch/apis.py,sha256=a4VSZXXxnI-kcO6Z2hj4YsHnLeLWH_7UE0NuOMNfWRo,19552 +torch/_functorch/autograd_function.py,sha256=NOYn1AYEaM8epCQvZrvT0elqoFCWMiwP8rjflNvr8qw,30113 +torch/_functorch/batch_norm_replacement.py,sha256=rCCP_aiPj9c0zuKAW2E8fSCuR4u4-R3EdovaOg43VSY,884 +torch/_functorch/benchmark_utils.py,sha256=HckPDk5a0S9vLA3PgwV7rg3o6ZihWbdN_AzVg6n7R5M,6540 +torch/_functorch/compile_utils.py,sha256=392w1G9xie0rn_qSc_ZsMLiz5ipEtXGaOynWReCNlQw,7903 +torch/_functorch/compilers.py,sha256=cl1j4-WQ1amMVZvPXabtier8Ip3tgwWSr3eZ5-FEjwg,14448 +torch/_functorch/config.py,sha256=EaP5y6vimvuK_aICpzkGZaZwPjqmtkMf6HnCaeMHH0M,18341 +torch/_functorch/deprecated.py,sha256=fDkiEUN1JapHbmqPZdJv0VaszrEO52OUaklDgm7VcYE,5408 +torch/_functorch/eager_transforms.py,sha256=KpOtJpKE0Oy-RfWsLbOmJd2_7pim1zCxmw_YJ1ZoDYM,72907 +torch/_functorch/functional_call.py,sha256=xjcBdujdYo-7sdLLjL-kuvSLqKq6nq_U373Rw2v83ro,10888 +torch/_functorch/fx_minifier.py,sha256=kRQH6X6j98mHpBvuV46y_s35--Kxi8gY4YX5D0sfXUI,17873 +torch/_functorch/make_functional.py,sha256=XvRlAC0VmsV1BXqjOA1Xz6or3vKaS3NnyM9MKmVlI0U,23560 +torch/_functorch/partitioners.py,sha256=AztTz5yFfHNL1lk_ABZfi8h9CthRWCEudsU6IinMULU,124826 +torch/_functorch/predispatch.py,sha256=2iocfCWHOx8O_OjEKYv2x3WaLr2GPor7NaU4eV3kb2M,5471 +torch/_functorch/pyfunctorch.py,sha256=anPJF9spc2lcOZza66UTjABB_IBjmohCLqxTITHD2is,11140 +torch/_functorch/python_key.py,sha256=J5m4n931Z1hmTQmIjQWju_OHePMWJGTn58QYvcTvF-c,457 +torch/_functorch/pytree_hacks.py,sha256=usKxP7Ui-WS-Xa3UQnrNP96SH35GM3avonfhZV7c0gU,721 +torch/_functorch/top_operators_github_usage.py,sha256=17rFLA_Pi-jgfrjBnpdX0UUJTJfd6G6hEI6T0-7tn0w,22023 +torch/_functorch/utils.py,sha256=ohM06i44JiV-aHTKTqAx54B2xWa7628nCEGUDCxKkgE,1092 +torch/_functorch/vmap.py,sha256=_l4F6cVNmZnCorzAxCdB2eCGF9GXcAt4uhGRQXZVMq8,17428 +torch/_guards.py,sha256=1cFb1u9AcWPBuFdWjonn-QOotQCaxyH3yGwdGYNq0pk,48418 +torch/_higher_order_ops/__init__.py,sha256=982MvTr2d8Yhzo6GUgebIzQI6LvJWZpSN8Jl-ks8K9E,2659 +torch/_higher_order_ops/__pycache__/__init__.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/_invoke_quant.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/aoti_call_delegate.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/associative_scan.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/auto_functionalize.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/base_hop.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/cond.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/effects.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/executorch_call_delegate.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/flat_apply.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/flex_attention.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/foreach_map.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/hints_wrap.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/invoke_subgraph.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/local_map.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/map.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/out_dtype.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/partitioner.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/print.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/run_const_graph.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/scan.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/schema.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/strict_mode.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/torchbind.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/triton_kernel_wrap.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/utils.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/while_loop.cpython-312.pyc,, +torch/_higher_order_ops/__pycache__/wrap.cpython-312.pyc,, +torch/_higher_order_ops/_invoke_quant.py,sha256=HeO9sV4p31UCYuiPxt_ggXiL3pKyxS8vvNPKkUxCtTs,1832 +torch/_higher_order_ops/aoti_call_delegate.py,sha256=MmWO2m9h6MmW2E29LP3Fdr_h9vpVFums9PQeSeqlQCs,6290 +torch/_higher_order_ops/associative_scan.py,sha256=RU3JnCzHONlJDE3XJOo60QYHzT3AFGmYjM8SZ-Aii5E,37639 +torch/_higher_order_ops/auto_functionalize.py,sha256=yBtIJOVuR5PWgf9OzlOPZS_6Q3tli5ylr-xrDXr8y58,37799 +torch/_higher_order_ops/base_hop.py,sha256=VFllXEp9CmlZMYDy5n8xeTAaZ03FzxR9TMN3pPAV7co,10962 +torch/_higher_order_ops/cond.py,sha256=6uSnEKJWnokgvPviHbdcu3RDys9VzHXZvBo2cmRGPq0,28401 +torch/_higher_order_ops/effects.py,sha256=i26qKtMam9cmO-p4mCqvAL9GkPK8YWXB7aaIJlT128g,10185 +torch/_higher_order_ops/executorch_call_delegate.py,sha256=-VZsNYMAgEzFp13pEl-83kftA2rOpvNm2DVXRoTpCmk,6174 +torch/_higher_order_ops/flat_apply.py,sha256=6WdT_D-tyXzdxqRrmB3GogM4czrqZQbV3l_vGsrrd4c,5860 +torch/_higher_order_ops/flex_attention.py,sha256=Irp6ixwl4OWfV_52eAWRMB60ORpuBYtLJCcwAoc1S3Q,45866 +torch/_higher_order_ops/foreach_map.py,sha256=Jd-qeO1k3RG8ZgJkIqe_GCpViOJvEaW15P3I-yGehgk,714 +torch/_higher_order_ops/hints_wrap.py,sha256=2BWCPTWj5qJC3gbc6S5UdwsL19zzTalF2msBcDfupRg,4916 +torch/_higher_order_ops/invoke_subgraph.py,sha256=MT21yOflBHf1udRE9q-wvJKWrS6kPV5ezkX5Tp2Nwis,31568 +torch/_higher_order_ops/local_map.py,sha256=KhINmnYrJ3Z7PDWiQ79XLIWbmO-qF5K0mdcR-SDwUFc,21781 +torch/_higher_order_ops/map.py,sha256=FGDtm-r2e3zGQQ1A78SV6oc4g1n094u2xQIikHDGPPA,10308 +torch/_higher_order_ops/out_dtype.py,sha256=Z22JCtOQKvi7j7IluJVvnwsMZBcWuBuFUE9wNYN6cZY,5729 +torch/_higher_order_ops/partitioner.py,sha256=ltV2Wh-F7XLxv9-jI0_KrzN7oFdqjjg_-7pH-8N1YTg,13959 +torch/_higher_order_ops/print.py,sha256=XjDt6-nkdYObpnB-CLTAGDPn9cYPkdDSKLmyOwx52IA,3155 +torch/_higher_order_ops/run_const_graph.py,sha256=fi2RtgMTBu-qnY51v-XWFrelnRrOZ_KR356olWHG9fM,2536 +torch/_higher_order_ops/scan.py,sha256=zpBcuUVe-bMCeOW1xo0655M74SRCkiwQhuyLyrTzidk,36939 +torch/_higher_order_ops/schema.py,sha256=-4mAjU9-o9ljH6-HegKDz5GR1_sDGVCL3V0127Uig10,11531 +torch/_higher_order_ops/strict_mode.py,sha256=rFQmFQuSzBUtfdDK8dq6OOIRB8Uuy-cqpae8Il9FVac,3947 +torch/_higher_order_ops/torchbind.py,sha256=QCGna51TM_-mwtKWY9iRbrOus6QyggMfgqlcbuXGgxQ,6416 +torch/_higher_order_ops/triton_kernel_wrap.py,sha256=BzgkRDowK26zOHKd3DjNtWxTVFKksKe5OqmnTMignC4,87919 +torch/_higher_order_ops/utils.py,sha256=OwBumHD06PGUqBIruQIA6ENMefDCE-Jrrspt-W9NDtU,48334 +torch/_higher_order_ops/while_loop.py,sha256=zz-psT7Q5zj6tjcdjr2z5Y2R5G_UQedW0XYx3TDT9RQ,37601 +torch/_higher_order_ops/wrap.py,sha256=S7WVzg3Oj5OxxrEWAmlIPkuAqjxVJYgAWiZEBgcV454,15038 +torch/_inductor/__autotune_main__.py,sha256=eIhLRMgy1BNr_lSUEfXk9aGe6xG95TF_Tt2WJROawts,946 +torch/_inductor/__init__.py,sha256=LALFh4dg4dCwyh8Rrhx3w4H_dM0ScpK-FoP-HHl2sMc,15329 +torch/_inductor/__pycache__/__autotune_main__.cpython-312.pyc,, +torch/_inductor/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/__pycache__/analyze_preserves_zero_mask.cpython-312.pyc,, +torch/_inductor/__pycache__/aoti_eager.cpython-312.pyc,, +torch/_inductor/__pycache__/async_compile.cpython-312.pyc,, +torch/_inductor/__pycache__/augmented_graph_helper.cpython-312.pyc,, +torch/_inductor/__pycache__/autotune_process.cpython-312.pyc,, +torch/_inductor/__pycache__/await_utils.cpython-312.pyc,, +torch/_inductor/__pycache__/bounds.cpython-312.pyc,, +torch/_inductor/__pycache__/cache.cpython-312.pyc,, +torch/_inductor/__pycache__/choices.cpython-312.pyc,, +torch/_inductor/__pycache__/codecache.cpython-312.pyc,, +torch/_inductor/__pycache__/comm_analysis.cpython-312.pyc,, +torch/_inductor/__pycache__/comm_lowering.cpython-312.pyc,, +torch/_inductor/__pycache__/comms.cpython-312.pyc,, +torch/_inductor/__pycache__/comms_debug.cpython-312.pyc,, +torch/_inductor/__pycache__/compile_fx.cpython-312.pyc,, +torch/_inductor/__pycache__/compile_fx_async.cpython-312.pyc,, +torch/_inductor/__pycache__/compile_fx_ext.cpython-312.pyc,, +torch/_inductor/__pycache__/compile_fx_subproc.cpython-312.pyc,, +torch/_inductor/__pycache__/compiler_bisector.cpython-312.pyc,, +torch/_inductor/__pycache__/config.cpython-312.pyc,, +torch/_inductor/__pycache__/config_comms.cpython-312.pyc,, +torch/_inductor/__pycache__/constant_folding.cpython-312.pyc,, +torch/_inductor/__pycache__/cpp_builder.cpython-312.pyc,, +torch/_inductor/__pycache__/cpu_vec_isa.cpython-312.pyc,, +torch/_inductor/__pycache__/cudagraph_trees.cpython-312.pyc,, +torch/_inductor/__pycache__/cudagraph_utils.cpython-312.pyc,, +torch/_inductor/__pycache__/custom_graph_pass.cpython-312.pyc,, +torch/_inductor/__pycache__/debug.cpython-312.pyc,, +torch/_inductor/__pycache__/decomposition.cpython-312.pyc,, +torch/_inductor/__pycache__/dependencies.cpython-312.pyc,, +torch/_inductor/__pycache__/distributed_autotune.cpython-312.pyc,, +torch/_inductor/__pycache__/dtype_propagation.cpython-312.pyc,, +torch/_inductor/__pycache__/exc.cpython-312.pyc,, +torch/_inductor/__pycache__/extern_node_serializer.cpython-312.pyc,, +torch/_inductor/__pycache__/freezing.cpython-312.pyc,, +torch/_inductor/__pycache__/freezing_utils.cpython-312.pyc,, +torch/_inductor/__pycache__/fuzzer.cpython-312.pyc,, +torch/_inductor/__pycache__/fx_utils.cpython-312.pyc,, +torch/_inductor/__pycache__/graph.cpython-312.pyc,, +torch/_inductor/__pycache__/hooks.cpython-312.pyc,, +torch/_inductor/__pycache__/index_propagation.cpython-312.pyc,, +torch/_inductor/__pycache__/inductor_prims.cpython-312.pyc,, +torch/_inductor/__pycache__/invert_expr_analysis.cpython-312.pyc,, +torch/_inductor/__pycache__/ir.cpython-312.pyc,, +torch/_inductor/__pycache__/jagged_lowerings.cpython-312.pyc,, +torch/_inductor/__pycache__/kernel_inputs.cpython-312.pyc,, +torch/_inductor/__pycache__/kernel_template_choice.cpython-312.pyc,, +torch/_inductor/__pycache__/loop_body.cpython-312.pyc,, +torch/_inductor/__pycache__/lowering.cpython-312.pyc,, +torch/_inductor/__pycache__/memory.cpython-312.pyc,, +torch/_inductor/__pycache__/metrics.cpython-312.pyc,, +torch/_inductor/__pycache__/mkldnn_ir.cpython-312.pyc,, +torch/_inductor/__pycache__/mkldnn_lowerings.cpython-312.pyc,, +torch/_inductor/__pycache__/mock_cache.cpython-312.pyc,, +torch/_inductor/__pycache__/ops_handler.cpython-312.pyc,, +torch/_inductor/__pycache__/optimize_indexing.cpython-312.pyc,, +torch/_inductor/__pycache__/output_code.cpython-312.pyc,, +torch/_inductor/__pycache__/pattern_matcher.cpython-312.pyc,, +torch/_inductor/__pycache__/quantized_lowerings.cpython-312.pyc,, +torch/_inductor/__pycache__/remote_cache.cpython-312.pyc,, +torch/_inductor/__pycache__/remote_gemm_autotune_cache.cpython-312.pyc,, +torch/_inductor/__pycache__/rocm_multiarch_utils.cpython-312.pyc,, +torch/_inductor/__pycache__/scheduler.cpython-312.pyc,, +torch/_inductor/__pycache__/select_algorithm.cpython-312.pyc,, +torch/_inductor/__pycache__/shape_propagation.cpython-312.pyc,, +torch/_inductor/__pycache__/sizevars.cpython-312.pyc,, +torch/_inductor/__pycache__/standalone_compile.cpython-312.pyc,, +torch/_inductor/__pycache__/subgraph_lowering.cpython-312.pyc,, +torch/_inductor/__pycache__/test_case.cpython-312.pyc,, +torch/_inductor/__pycache__/test_operators.cpython-312.pyc,, +torch/_inductor/__pycache__/tiling_utils.cpython-312.pyc,, +torch/_inductor/__pycache__/triton_bundler.cpython-312.pyc,, +torch/_inductor/__pycache__/utils.cpython-312.pyc,, +torch/_inductor/__pycache__/virtualized.cpython-312.pyc,, +torch/_inductor/__pycache__/wrapper_benchmark.cpython-312.pyc,, +torch/_inductor/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/analysis/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/analysis/__pycache__/device_info.cpython-312.pyc,, +torch/_inductor/analysis/__pycache__/profile_analysis.cpython-312.pyc,, +torch/_inductor/analysis/device_info.py,sha256=C1sPrZUfsMCCPyurT7r9SsIwvEc7aMjlj51UimosxT4,7685 +torch/_inductor/analysis/profile_analysis.py,sha256=ujaG2wbHhRkKAihCfx3bsPYOESJU5lI3tq1zUr951Cw,28393 +torch/_inductor/analyze_preserves_zero_mask.py,sha256=uNq2STsZZCUFqK3SLP6bo8J_BsJxXKTves4K7wm3Vfg,5656 +torch/_inductor/aoti_eager.py,sha256=H6_GVetHY0VA_gy8wtMbwcHn4odBJmDx4J1SjfdWWMA,11464 +torch/_inductor/async_compile.py,sha256=Oa-wL0aOf3Sup8EhxePFOwBrimrEyb1ukVRgqvVgRzo,26965 +torch/_inductor/augmented_graph_helper.py,sha256=EdqEMNuYNzGHPNCfpGiDAVj71W8dfBZNFY8EPq4EQE0,7238 +torch/_inductor/autoheuristic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/autoheuristic/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/autoheuristic/__pycache__/autoheuristic.cpython-312.pyc,, +torch/_inductor/autoheuristic/__pycache__/autoheuristic_utils.cpython-312.pyc,, +torch/_inductor/autoheuristic/__pycache__/learned_heuristic_controller.cpython-312.pyc,, +torch/_inductor/autoheuristic/__pycache__/learnedheuristic_interface.cpython-312.pyc,, +torch/_inductor/autoheuristic/artifacts/_MMRankingA100.py,sha256=lxb7M7a3Q7HFtglqooHq4UAASa78RhCLhQEapTCEwDY,28340 +torch/_inductor/autoheuristic/artifacts/_MMRankingH100.py,sha256=tl4OyeTAjiJ3Bu4m6Eu_mrmNouRJ0CISDGVqXg6uLLA,30989 +torch/_inductor/autoheuristic/artifacts/_MixedMMA100.py,sha256=-bPJLRsoMgz8a67PdB3bmshK8hXrQF7BhFtDwB6ElXg,8070 +torch/_inductor/autoheuristic/artifacts/_MixedMMH100.py,sha256=S4xEoe1VXmpGLukgXS6wi0ed-UAdlZ69tLaJ-2MNyeE,8018 +torch/_inductor/autoheuristic/artifacts/_PadMMA100.py,sha256=koaNU2XdPdYUbLBN-kqy0kJswOhmfbD3a33GDhwAKaY,5040 +torch/_inductor/autoheuristic/artifacts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/autoheuristic/artifacts/__pycache__/_MMRankingA100.cpython-312.pyc,, +torch/_inductor/autoheuristic/artifacts/__pycache__/_MMRankingH100.cpython-312.pyc,, +torch/_inductor/autoheuristic/artifacts/__pycache__/_MixedMMA100.cpython-312.pyc,, +torch/_inductor/autoheuristic/artifacts/__pycache__/_MixedMMH100.cpython-312.pyc,, +torch/_inductor/autoheuristic/artifacts/__pycache__/_PadMMA100.cpython-312.pyc,, +torch/_inductor/autoheuristic/artifacts/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/autoheuristic/autoheuristic.py,sha256=aUdkRqi03_RLD5vy-ZIO3awXfLuclIipUgS0f3k5aCI,12277 +torch/_inductor/autoheuristic/autoheuristic_utils.py,sha256=uhD731-hi9IqIH9KjMrS80jxsBvIjy8uFHWRX7-vKCA,11648 +torch/_inductor/autoheuristic/learned_heuristic_controller.py,sha256=URCnHE8dztWFTROS2tV41HVd0R6ByfcAGIGURiT8hIg,4436 +torch/_inductor/autoheuristic/learnedheuristic_interface.py,sha256=t24zB5GmerFqZwTMz4y7NPBt8zasgH3YXWdQhIFz6aA,2821 +torch/_inductor/autotune_process.py,sha256=0hFKMZjDS3RzEQgnF8s3tgGdxSl4VythP8gnG1F6o-M,36358 +torch/_inductor/await_utils.py,sha256=g7qRs6T4YX3VeHSa7p3DQhOk9bFZwzmQj0pVJz_OJ-0,6019 +torch/_inductor/bounds.py,sha256=Zk3oW92haF3PW-8w70g33QNJ6x8NymwezVK7Al4VsSg,9977 +torch/_inductor/cache.py,sha256=_aRXyF_n5FUWZAhSZS6iTcvmxfOeCG9O1e910xOT4Eo,15242 +torch/_inductor/choices.py,sha256=QXKJp_q3QGHbNnZ-4hoqYKRgFtrG1Cx5xxAxzcd341w,27433 +torch/_inductor/codecache.py,sha256=TqL2BPIvUVLblUrdKnga00y6WUI_avxb3YxAbPm8xKs,178932 +torch/_inductor/codegen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/codegen/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/aoti_hipify_utils.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/block_analysis.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/common.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp_bmm_template.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp_flex_attention_template.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp_gemm_template.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp_grouped_gemm_template.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp_micro_gemm.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp_template.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp_template_kernel.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp_utils.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp_wrapper_cpu.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp_wrapper_cpu_array_ref.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp_wrapper_gpu.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpp_wrapper_mps.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cpu_device_op_overrides.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/cuda_combined_scheduling.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/debug_utils.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/halide.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/memory_planning.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/mps.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/mps_device_op_overrides.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/multi_kernel.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/pallas.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/python_wrapper_mtia.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/segmented_tree.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/simd.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/simd_kernel_features.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/subgraph.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/triton.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/triton_combo_kernel.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/triton_split_scan.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/triton_utils.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/wrapper.cpython-312.pyc,, +torch/_inductor/codegen/__pycache__/wrapper_fxir.cpython-312.pyc,, +torch/_inductor/codegen/aoti_hipify_utils.py,sha256=s6udpdXDFiU_Ic5nx7vCXiFQ8sQhHBFhAOWXao5NatI,1476 +torch/_inductor/codegen/aoti_runtime/interface.cpp,sha256=iVtC1P-aVWvmVs_WMyS0txM0iYxHYl6b0vyBSoLpg4w,18402 +torch/_inductor/codegen/block_analysis.py,sha256=TMxb_BbywVHoqvm1ppaWB1_9IhpOaW5_m6x8ANmNpM8,7451 +torch/_inductor/codegen/common.py,sha256=WZDhuV5ijoqlBSgxUawkwMunwYD9lbz9K5c1ofyhGJI,107380 +torch/_inductor/codegen/cpp.py,sha256=wr2T13FTbnGmcfzDqDhRoqWJsTp818uhRTv4cZLvzAc,240097 +torch/_inductor/codegen/cpp_bmm_template.py,sha256=9mypIQVEtZu77jSbRo-Lhvghy7QsBx6aH-Rt5Veuxbw,9649 +torch/_inductor/codegen/cpp_flex_attention_template.py,sha256=Ko82eRscReVdmEa1M1nY6OfD6pDbwpUujssM9FOH23M,42501 +torch/_inductor/codegen/cpp_gemm_template.py,sha256=9W4jyv5345XiunRJ2rwVrn0TI0OBNQ12nhk0GRP9Eek,79781 +torch/_inductor/codegen/cpp_grouped_gemm_template.py,sha256=zrcL9DyXVfd61zr6VhDtx2zfEAp_eGJr7OCJtJRE0dc,21421 +torch/_inductor/codegen/cpp_micro_gemm.py,sha256=Nrr4qpRC08sv9DF2nKMSiDgglf2-Ya29m4PpCtM4erY,79829 +torch/_inductor/codegen/cpp_template.py,sha256=9RuZjmxE2hIAel2iTE6hMKTaWU0wKITCgjOXad0eoLE,5161 +torch/_inductor/codegen/cpp_template_kernel.py,sha256=glhNecpARcSP1lIoHianMzLogI4xIBOzELbIL7Li1AE,26780 +torch/_inductor/codegen/cpp_utils.py,sha256=Vscj1PtdPoE2IEN6YlnPJEr9h99nMvWRN03wkYrGpDE,29063 +torch/_inductor/codegen/cpp_wrapper_cpu.py,sha256=7nLtPi33xc5_yhlYw4pGvS1JU5limTnWqruo51R1NT0,133846 +torch/_inductor/codegen/cpp_wrapper_cpu_array_ref.py,sha256=fyoLTs_a8Y5gz0sjL0oXro43hMcN_ghiGOQWmtqXTLE,39892 +torch/_inductor/codegen/cpp_wrapper_gpu.py,sha256=RuRUOd7viupxPLe3GyeFl7ezY4Xdb69AH731wApvCU0,37610 +torch/_inductor/codegen/cpp_wrapper_mps.py,sha256=fTN5djhPMpJ5H5TFwAKboeaPKma84dkFAOCEnAH9a70,12598 +torch/_inductor/codegen/cpu_device_op_overrides.py,sha256=KGXhRACqJoVz1RWCywohMrGBfUR2JGYOytu37SgCylA,724 +torch/_inductor/codegen/cuda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/codegen/cuda/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/codegen/cuda/__pycache__/cuda_cpp_scheduling.cpython-312.pyc,, +torch/_inductor/codegen/cuda/__pycache__/cuda_env.cpython-312.pyc,, +torch/_inductor/codegen/cuda/__pycache__/cuda_kernel.cpython-312.pyc,, +torch/_inductor/codegen/cuda/__pycache__/cuda_template.cpython-312.pyc,, +torch/_inductor/codegen/cuda/__pycache__/cutlass_cache.cpython-312.pyc,, +torch/_inductor/codegen/cuda/__pycache__/cutlass_python_evt.cpython-312.pyc,, +torch/_inductor/codegen/cuda/__pycache__/cutlass_utils.cpython-312.pyc,, +torch/_inductor/codegen/cuda/__pycache__/device_op_overrides.cpython-312.pyc,, +torch/_inductor/codegen/cuda/__pycache__/gemm_template.cpython-312.pyc,, +torch/_inductor/codegen/cuda/__pycache__/serialization.cpython-312.pyc,, +torch/_inductor/codegen/cuda/cuda_cpp_scheduling.py,sha256=AIQaU5Z1H05f9YfMzF032UDa89apzCnrcxOCdMbN7sM,12260 +torch/_inductor/codegen/cuda/cuda_env.py,sha256=6O3hHl3gY-O9aNfAnjO5_WiouSXhZ9GqC3xVLaOB-y4,1446 +torch/_inductor/codegen/cuda/cuda_kernel.py,sha256=ukBzYJ78i6B4hus8TaXfkkXW17O9Idfp4t8qbD3G0o4,25346 +torch/_inductor/codegen/cuda/cuda_template.py,sha256=ulR84XSFpwQXoTABPs8jJl6JgRYp1ZIQUpOSF1_zim4,14355 +torch/_inductor/codegen/cuda/cutlass_cache.py,sha256=zwc33mNV1mRPU_zSzdWzw4shgpYbA1yN18KkOu2aSHI,3770 +torch/_inductor/codegen/cuda/cutlass_lib_extensions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/codegen/cuda/cutlass_lib_extensions/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/codegen/cuda/cutlass_lib_extensions/__pycache__/evt_extensions.cpython-312.pyc,, +torch/_inductor/codegen/cuda/cutlass_lib_extensions/__pycache__/gemm_operation_extensions.cpython-312.pyc,, +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/cuda/__init__.py,sha256=pxXX9KVbnra4jy6J2jd74QM4Vl2PBaT-45QfcBlfElo,89 +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/cuda/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/cuda/__pycache__/cuda.cpython-312.pyc,, +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/cuda/__pycache__/cudart.cpython-312.pyc,, +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/cuda/cuda.py,sha256=sG0J9s7OQi-AIVSIUQmYyXUQ2T4NprUcEvj4XD0n4tU,338 +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/cuda/cudart.py,sha256=1WYg5CyorrdhFhvpcmqQKxMcHvPw7tatWy39SmbLLmA,322 +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/pydot/__init__.py,sha256=jrjn4db_mQkVzaostQSsQ0qvQBrZMlWvhtW_hW2s2Dc,56 +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/pydot/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/scipy/__init__.py,sha256=EuIYMK4vgkOE7WgztNjPG_oay9KDS0ift5Y0uG-QYJM,58 +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/scipy/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/scipy/__pycache__/special.cpython-312.pyc,, +torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/scipy/special.py,sha256=gUlwGmFAYAdaYmHGrP6PzTbImEZN76Z8V0maGK5OJMk,56 +torch/_inductor/codegen/cuda/cutlass_lib_extensions/evt_extensions.py,sha256=BhZk9XRab4u--aE9kKN0pXr-U2WH2NCOQJFk9p6CIlk,11179 +torch/_inductor/codegen/cuda/cutlass_lib_extensions/gemm_operation_extensions.py,sha256=187qmKUCOorxLL4UCGccSeG7MkBiGzPAl-j2Sy2ze1s,19057 +torch/_inductor/codegen/cuda/cutlass_python_evt.py,sha256=0rxOBQcWVI_ZA1QjoUbKWNEi8GjZ-D8KGXZquZJfGHg,12118 +torch/_inductor/codegen/cuda/cutlass_utils.py,sha256=A57hgmIfbA3Dadd9rUHct1dHBGIQ3G2HI4MH02UIeF0,17604 +torch/_inductor/codegen/cuda/device_op_overrides.py,sha256=wUzfOItjYlKAQf0CJDMjJcJgn5nUvcobCpMKmSdAGT8,15083 +torch/_inductor/codegen/cuda/gemm_template.py,sha256=ThVoTE0NXRHb2BdmUMKITrSQPt9N4W35i0iP7Gtrqj0,79154 +torch/_inductor/codegen/cuda/serialization.py,sha256=YWQBfEkIVk8UQ4oCuPiSTYcfgDbHDokZ_r4TlaJCuJQ,18306 +torch/_inductor/codegen/cuda_combined_scheduling.py,sha256=8X07wj8W7uGM9Lj4limynM_VZpswF4tc3iDjN2HA96g,6418 +torch/_inductor/codegen/cutedsl/__init__.py,sha256=e5eMQm81g3lP1Soc4WCqkvZBtYF5cL1tZlzoBSY3GzI,172 +torch/_inductor/codegen/cutedsl/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/codegen/cutedsl/__pycache__/_cutedsl_utils.cpython-312.pyc,, +torch/_inductor/codegen/cutedsl/__pycache__/cutedsl_kernel.cpython-312.pyc,, +torch/_inductor/codegen/cutedsl/__pycache__/cutedsl_op_overrides.cpython-312.pyc,, +torch/_inductor/codegen/cutedsl/__pycache__/cutedsl_scheduling.cpython-312.pyc,, +torch/_inductor/codegen/cutedsl/__pycache__/cutedsl_template.cpython-312.pyc,, +torch/_inductor/codegen/cutedsl/_cutedsl_utils.py,sha256=axVJkw96yHv3S7Y3dtL37E9nlh7UXXjag216M7syj48,955 +torch/_inductor/codegen/cutedsl/cutedsl_kernel.py,sha256=rTQ3SCPPBCIzj21X8N9SkPGlVGi3gNAqy8tH8cU8Kts,23602 +torch/_inductor/codegen/cutedsl/cutedsl_op_overrides.py,sha256=T3uj2uySc2WIEwTu1vBrbxny3rSuZ3z43-F5VM437R0,13297 +torch/_inductor/codegen/cutedsl/cutedsl_scheduling.py,sha256=O6ZGQjFKguT3wdqZEVRXauQ5YOQyA0lTM9bsFh0ecoU,5451 +torch/_inductor/codegen/cutedsl/cutedsl_template.py,sha256=yo664DlKf2PhGn-ts9lxsTedgiIqFNBp6HNfRF-58vU,7268 +torch/_inductor/codegen/debug_utils.py,sha256=OW5G7MSSI_Q86qalIsY7Xnd_c3M0NwS7tjCOm0LFnzk,11689 +torch/_inductor/codegen/halide.py,sha256=GPREBKG55HSgmd0BMAc7P-_1yLEOSjV-OuGL2_2FvrQ,65158 +torch/_inductor/codegen/memory_planning.py,sha256=kYCaV9-ud6PlrmaHuFOfhxPGrJ12OJmA_O8rHhDi1Rg,27420 +torch/_inductor/codegen/mps.py,sha256=oV_vM_tAgUfjP-w4XFoRhGmVXivpgc15qzBbY5WThwk,43124 +torch/_inductor/codegen/mps_device_op_overrides.py,sha256=l7XXqoZQ6IBUfIGhf-WN3sLifUBrraLj2TZXUHtmVMc,695 +torch/_inductor/codegen/mtia/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/codegen/mtia/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/codegen/mtia/__pycache__/device_op_overrides.cpython-312.pyc,, +torch/_inductor/codegen/mtia/device_op_overrides.py,sha256=IQrXePJa5piSfAeuOazVcbD8hOFnH5I2_80e09rC_aU,657 +torch/_inductor/codegen/multi_kernel.py,sha256=HcpoZhWWO85hooNhjfEnDh-9pN2YLiSIq_wD6jhQzU8,24015 +torch/_inductor/codegen/pallas.py,sha256=VVMA0Dz2C1kwOOnL0qpFGJ0o7lCw8etq9TbQtILvmwQ,75803 +torch/_inductor/codegen/python_wrapper_mtia.py,sha256=qmfPxNNP51A6s1Rrj2d0VT9QMriK7ikt9K4yS3bpDJM,1059 +torch/_inductor/codegen/rocm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/codegen/rocm/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/codegen/rocm/__pycache__/ck_conv_template.cpython-312.pyc,, +torch/_inductor/codegen/rocm/__pycache__/ck_template.cpython-312.pyc,, +torch/_inductor/codegen/rocm/__pycache__/ck_tile_template.cpython-312.pyc,, +torch/_inductor/codegen/rocm/__pycache__/ck_tile_universal_gemm_template.cpython-312.pyc,, +torch/_inductor/codegen/rocm/__pycache__/ck_universal_gemm_template.cpython-312.pyc,, +torch/_inductor/codegen/rocm/__pycache__/compile_command.cpython-312.pyc,, +torch/_inductor/codegen/rocm/__pycache__/rocm_benchmark_request.cpython-312.pyc,, +torch/_inductor/codegen/rocm/__pycache__/rocm_cpp_scheduling.cpython-312.pyc,, +torch/_inductor/codegen/rocm/__pycache__/rocm_kernel.cpython-312.pyc,, +torch/_inductor/codegen/rocm/__pycache__/rocm_template.cpython-312.pyc,, +torch/_inductor/codegen/rocm/__pycache__/rocm_template_buffer.cpython-312.pyc,, +torch/_inductor/codegen/rocm/__pycache__/rocm_utils.cpython-312.pyc,, +torch/_inductor/codegen/rocm/ck_conv_template.py,sha256=-0KKWCyKEbjIwh-tqMu3Za-eFQRwg-PvHI0UEikkK_g,25563 +torch/_inductor/codegen/rocm/ck_template.py,sha256=OPxtg1TKLHK4EByF_Y1fM1hXXZC534MISdmByve79u4,3805 +torch/_inductor/codegen/rocm/ck_tile_template.py,sha256=LGQ-jVg_kQBcluNH3hLjQhoRHzdATj_G2qCFDhiL0a8,1649 +torch/_inductor/codegen/rocm/ck_tile_universal_gemm_template.py,sha256=nQZp47q0VmsYOzVUxLBtLDt_IvWjfoqWfV02DGhP_0Y,38012 +torch/_inductor/codegen/rocm/ck_universal_gemm_template.py,sha256=6os1ozqA4vCjHcupUogHGetA6rBFKq9po52DmjIQQdU,40691 +torch/_inductor/codegen/rocm/compile_command.py,sha256=90FCqJJXwstDwlJUkXakmHPz76xoI85IOg7g8a0n2Sk,4815 +torch/_inductor/codegen/rocm/rocm_benchmark_request.py,sha256=NnEXVqLnL4h6IqPBGHEvl0jbBb_edE_NwrBMFZ4hb1Y,5207 +torch/_inductor/codegen/rocm/rocm_cpp_scheduling.py,sha256=wgxpRBK07gAiO_Qp7QuB9ibyKLITdkyAWz_SZH3Rd7s,3978 +torch/_inductor/codegen/rocm/rocm_kernel.py,sha256=Jz_tJsuThHDO2ZqEEhh9qO8RcELDV-O9pwX6sDzII_s,10756 +torch/_inductor/codegen/rocm/rocm_template.py,sha256=YLSofTgVHBXYSurD59AUHlf5KOj_F94bmsXyFVUAGyU,6829 +torch/_inductor/codegen/rocm/rocm_template_buffer.py,sha256=_UCcG-T6x7E_GNH2JiJVwkaiodpfPZuaGOjMPJsZDvU,854 +torch/_inductor/codegen/rocm/rocm_utils.py,sha256=0e9gHeTTxgGt63lE-4HeDGpRFaz4LU4-VrYRm4lvRyo,353 +torch/_inductor/codegen/segmented_tree.py,sha256=S2pHW9tu4SutmVBMI4SvN5pGePH92dgXUWrgIJzA1qA,8435 +torch/_inductor/codegen/simd.py,sha256=thTrZPcol1JG-uWA53f4VxZXBEWjO4HISDVvcYebBpo,125621 +torch/_inductor/codegen/simd_kernel_features.py,sha256=V0FhUNu-PmANzT9gVYKr4ygRYbtxPc_RNhWROl1piCE,24401 +torch/_inductor/codegen/subgraph.py,sha256=GF3VsqKUgyWrfVxdDGdIh6RAnvD87vjuLQIV94GErQo,16657 +torch/_inductor/codegen/triton.py,sha256=e3szC2m07CBLy7ErLsAhd-ji10DAawnV01vW75c-VoE,255111 +torch/_inductor/codegen/triton_combo_kernel.py,sha256=CqLH5gN7m_3d93uiHEs7cXOB6ch6v0dygqut0k6WcX0,44936 +torch/_inductor/codegen/triton_split_scan.py,sha256=_99Jl1ucWWFRLPztv6L4NDSwba3QUBNIlO8Usc3-O9M,7925 +torch/_inductor/codegen/triton_utils.py,sha256=bB1T4GZCz18EGPRIcwNnuhYscY1mR6FW5DvuVb3ykUA,9545 +torch/_inductor/codegen/wrapper.py,sha256=fEf8RruMSCrpozXbiczdUUC4L3dlxEkD6KMDbqpg350,160233 +torch/_inductor/codegen/wrapper_fxir.py,sha256=roNUvfth9j3SiK47kc2MayogmekNerlEpQCdAcBzEEg,45532 +torch/_inductor/codegen/xpu/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/codegen/xpu/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/codegen/xpu/__pycache__/device_op_overrides.cpython-312.pyc,, +torch/_inductor/codegen/xpu/device_op_overrides.py,sha256=2FYAFM7-ZOQCT8w2l8OjY0CN83lS_-vdlvrJ8fPNXkY,1951 +torch/_inductor/comm_analysis.py,sha256=FbAkHx5LHrvTYsfh6L2GcL6qRRxJ_RebfQSiIHNzIBk,17294 +torch/_inductor/comm_lowering.py,sha256=4CoQPPSV_WmXdQh6nqkjusgdePAp1R_66xX1xRA8FW4,14126 +torch/_inductor/comms.py,sha256=5LgjcfYCH2u-AzZMX9GeprtkEPJ5ezPLb__mr9WEyBQ,105181 +torch/_inductor/comms_debug.py,sha256=FfVL8ZrlsBPdToixUZK1DxYEIGDX9zsnJYZGfEVj_Nc,4339 +torch/_inductor/compile_fx.py,sha256=7B-4N5EPnGmEMGU689ezNPbf_ONCEboGkGkYPh7glJA,120458 +torch/_inductor/compile_fx_async.py,sha256=9mfGwxjRjX_w4fksAUtMyM6RvF2fpeWEZG7uX32h4jo,14910 +torch/_inductor/compile_fx_ext.py,sha256=wB5MgJ_V1ddXX40O2Rdx45sP7yJTClHZ9GYy3nZaRag,23872 +torch/_inductor/compile_fx_subproc.py,sha256=Ykhv4m8ZomjkJpW1zmlI7fEcpJ6Jg9q_nsZwGlKp_O4,3264 +torch/_inductor/compile_worker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/compile_worker/__main__.py,sha256=9f6RijCYEp9cypg_1FUbshjLvluj2BMynSQzEf5-9kU,2325 +torch/_inductor/compile_worker/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/compile_worker/__pycache__/__main__.cpython-312.pyc,, +torch/_inductor/compile_worker/__pycache__/subproc_pool.cpython-312.pyc,, +torch/_inductor/compile_worker/__pycache__/timer.cpython-312.pyc,, +torch/_inductor/compile_worker/__pycache__/tracked_process_pool.cpython-312.pyc,, +torch/_inductor/compile_worker/__pycache__/utils.cpython-312.pyc,, +torch/_inductor/compile_worker/subproc_pool.py,sha256=PwQHjq8ceKHonCtATMi2iAUMB4aR7ZkEj3z6ZPqc9hM,17977 +torch/_inductor/compile_worker/timer.py,sha256=-S9DBL3wEI2LpHAPOZfXC1_MhFdkFqJrqTPJF29Zwfs,1920 +torch/_inductor/compile_worker/tracked_process_pool.py,sha256=vSIysmCaf540V7Envdj67akvbcC_Scj144g9TuZE8NM,3806 +torch/_inductor/compile_worker/utils.py,sha256=nbIcP0_xhXKAgbIPj5-GQfL1p4mFPUNojKFlaK6zbiM,1683 +torch/_inductor/compiler_bisector.py,sha256=aTYKG8CRUQQJf6yVrM9zP8lEYKpo3HE3BhDhSK9Y2tg,23634 +torch/_inductor/config.py,sha256=dJI2WP5wE5Ek-PLbqTiSaqYso68ev9zeTJZIg7_4POw,93695 +torch/_inductor/config_comms.py,sha256=mLWM0WsQ4uKm4GVy2HnAOJGiOEYX7JPFHX19ygUTYcg,3149 +torch/_inductor/constant_folding.py,sha256=Wo33PWxYMWz-SIy46cMLoGKaXxcf1JDJbZ_CjsJaFjk,15659 +torch/_inductor/cpp_builder.py,sha256=wJsAr0BOBQz3Syi_lcmYi0wZv119lU8wr3On1D70bWs,88112 +torch/_inductor/cpu_vec_isa.py,sha256=J5lZJ6hKfbm86k4mxD6Mp5WySNEm0f2rOV_gDPuKrZY,18708 +torch/_inductor/cudagraph_trees.py,sha256=I-B2C94hN4FQ-j0ApJ70HMPDzE6s-9M5T_0C52z0quM,107150 +torch/_inductor/cudagraph_utils.py,sha256=6dF7znaE_NDGsvFexMkyGmf5_RuyCrovd1qufIfMybM,14561 +torch/_inductor/custom_graph_pass.py,sha256=rw2LQ5OWTU8KIFgio5LOEqD1BRtyL40D6TDl3WepzyY,6044 +torch/_inductor/debug.py,sha256=xH5lHC6P1TqO5SdUEf_jxjOQLXi-yhRADypSK3z6IaQ,48166 +torch/_inductor/decomposition.py,sha256=gqO0HraQlVFursWINbEEKtD2Vw6ih_zmxKDsaOEjlzs,41991 +torch/_inductor/dependencies.py,sha256=CbIqtShhzqiCufM9X6cqyMH1IQ8C6IBqK_54RRm08v8,32808 +torch/_inductor/distributed_autotune.py,sha256=Jdv90yxjIvV2wNTgxdb9OgRp6r8UkKkdfY6OiVkuexk,12754 +torch/_inductor/dtype_propagation.py,sha256=Ogh48R67nQoiX24vBnWSOTqJqVUCpRTNocHH4xduHyE,12427 +torch/_inductor/exc.py,sha256=zLYE3qfGkgLWYp0_I4exPY3P95A8Lm7tTrHXloiKAkw,5029 +torch/_inductor/extern_node_serializer.py,sha256=9iaLxk6PJxF4UEtpMokFJDrMl32gZPIlkAnkNB-fKtY,854 +torch/_inductor/freezing.py,sha256=GNUqMB7VpTHL2gFeeQkZNiNucVbzIVHhWGhHOQRpV8M,11343 +torch/_inductor/freezing_utils.py,sha256=A1mg2kmNjy-O3YxkKI04onOKCZ-7XhCURmSuN9U45fA,1323 +torch/_inductor/fuzzer.py,sha256=RQzf7RtRgl89wb0KeBFU-LikIk6ckL0Q2M7gFcYVUVs,38532 +torch/_inductor/fx_passes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/fx_passes/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/b2b_gemm.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/binary_folding.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/bucketing.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/control_dependencies.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/ddp_fusion.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/decompose_mem_bound_mm.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/dedupe_symint_uses.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/efficient_conv_bn_eval.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/freezing_patterns.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/fsdp.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/fuse_attention.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/graph_view.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/group_batch_fusion.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/joint_graph.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/memory_estimator.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/micro_pipeline_tp.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/misc_patterns.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/mkldnn_fusion.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/node_runtime_estimation.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/numeric_utils.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/overlap_manual_scheduling.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/overlap_preserving_bucketer.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/overlap_scheduling.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/pad_mm.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/post_grad.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/pre_grad.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/quantization.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/reinplace.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/replace_random.cpython-312.pyc,, +torch/_inductor/fx_passes/__pycache__/split_cat.cpython-312.pyc,, +torch/_inductor/fx_passes/b2b_gemm.py,sha256=EB4aAqquG99M-CL40UP7YdcL8OSWksAk4mY1bwSrO7k,26439 +torch/_inductor/fx_passes/binary_folding.py,sha256=eHzXsx50qEOk9HZCtZyPFMSa_jAf3g1Y05_p6BYXnG4,20333 +torch/_inductor/fx_passes/bucketing.py,sha256=S_ykKGkY__e4fbgPZpuPY9eQq4WAXjdktI8W_LRzavs,40233 +torch/_inductor/fx_passes/control_dependencies.py,sha256=lzOYkITYIi1ATDZFPN5Hc4Exg-SblKeHOy3uHDokBYA,8152 +torch/_inductor/fx_passes/ddp_fusion.py,sha256=0v2S0jjrjbx0i6m4aUcHE3ZWNkWqlWTt2nBZ6zkuQwI,21796 +torch/_inductor/fx_passes/decompose_mem_bound_mm.py,sha256=pxpcg_eP98tecFfUdrHADsiUmTy-PBiOzkAi9qcJAdE,11502 +torch/_inductor/fx_passes/dedupe_symint_uses.py,sha256=Ke_J4VjCO0wMuzj20wKI6vpC4hYaUNzG37Z22hKwRFI,2586 +torch/_inductor/fx_passes/efficient_conv_bn_eval.py,sha256=qrM97e77krhKt-9tK3fyhXn8OD8xBtXrrzSgrDvOjW8,14528 +torch/_inductor/fx_passes/freezing_patterns.py,sha256=_vbYL2gLVErrC2xJqFBiR30S-93P1hCq8yJE5BfsK2Q,9951 +torch/_inductor/fx_passes/fsdp.py,sha256=_WXqe2q2ObHn5fVZe0LP_qyPKsow3qbInegRu3mOgRs,3890 +torch/_inductor/fx_passes/fuse_attention.py,sha256=BP-HVESSm6J10MjtcCQWw_M1pZpBfslDaXh6km_UHsA,38336 +torch/_inductor/fx_passes/graph_view.py,sha256=uWcZDYRNIJqIhx97ImrX9GTl-3rHo6CHNDIVJMWaSO0,9275 +torch/_inductor/fx_passes/group_batch_fusion.py,sha256=2hKvru3EslHJweLgGPoY7VZlPdIffPB6moIObDPky4Q,60772 +torch/_inductor/fx_passes/joint_graph.py,sha256=kuuiA48GctbGWyOxfXsTLypoO59HOHoQrcw1Z6cTLKk,38446 +torch/_inductor/fx_passes/memory_estimator.py,sha256=EpZKLLXrav8K_KTVQEHeZGNjW9MYmNBwpKDl_9Gab-k,17668 +torch/_inductor/fx_passes/micro_pipeline_tp.py,sha256=dR5BWg1qXFYegYIy0QwNQi7htPKzmTGnW7sjRGtLNmA,41460 +torch/_inductor/fx_passes/misc_patterns.py,sha256=ovovNzYYVLLRW0KEq2DyHiL0HhygOUKFjix9sp3QXN0,5287 +torch/_inductor/fx_passes/mkldnn_fusion.py,sha256=vdZ10M5H1EDlvPJa3Tz1CL29h9IsNAfNMTPy3IyiB-o,64011 +torch/_inductor/fx_passes/node_runtime_estimation.py,sha256=DjfD6UwUHgWvU540EEzIGXI7rC1H9aPHIUOPR8s_4N0,10159 +torch/_inductor/fx_passes/numeric_utils.py,sha256=kVHdT0X5g5_0ZmIE3GasVz0vhTy_-c8iwgS_2384594,7498 +torch/_inductor/fx_passes/overlap_manual_scheduling.py,sha256=de2Aty_28pury4I6EaPqYXcgDHIbUUBz7EO8C9OoOWA,14937 +torch/_inductor/fx_passes/overlap_preserving_bucketer.py,sha256=L32YINd0cJWYF6K3oNdhIKFNkQdyLdqWiqN7WBWrRNg,35815 +torch/_inductor/fx_passes/overlap_scheduling.py,sha256=p_lPMWrZJpD-_O3DpfnaeBA1m9hfMBk2w8vcXtpIv3A,52452 +torch/_inductor/fx_passes/pad_mm.py,sha256=Emsy1hvWkEgxMVAPIMZdETkUi_T5_2zUWheSPZ2Xmmc,31273 +torch/_inductor/fx_passes/post_grad.py,sha256=fDB0AxNLdGcJzjLu8DvWRzXo7J6zRRCtRhI98sGKmAU,70875 +torch/_inductor/fx_passes/pre_grad.py,sha256=UG_bKYF_fp1-zDCCDX2Qe3bprY05Tt97LMXMhXTgcv0,31938 +torch/_inductor/fx_passes/quantization.py,sha256=MjunHJM01bobPhkRWbDgJeT8I0x09eLak6zUm56hbb0,147893 +torch/_inductor/fx_passes/reinplace.py,sha256=TWGADWJswMbYPh7uf6wc8Cvg3KznlZjj5KEHZqCl8aM,31791 +torch/_inductor/fx_passes/replace_random.py,sha256=FPoY8ZEHI8ZwAzHFMz1UAdLavSU47ZtDn1WkOKVI-mE,4528 +torch/_inductor/fx_passes/serialized_patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/fx_passes/serialized_patterns/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_1.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_10.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_11.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_12.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_13.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_14.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_15.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_16.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_17.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_18.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_19.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_2.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_20.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_21.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_22.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_23.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_24.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_3.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_4.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_5.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_6.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_7.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_8.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/_sfdp_pattern_9.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/addmm_pattern.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/bmm_pattern.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/__pycache__/mm_pattern.cpython-312.pyc,, +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_1.py,sha256=iM_6rnK6wv_zM-7M3CIb8AAAKhaD0sEQVnXYWZwnqzg,11351 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_10.py,sha256=uRQxBa4zFL7oVqqy6ENGBWQX1JopKbysnWMrStBN3B0,14421 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_11.py,sha256=LlSUr05EKQzSMpg2K8I9pXje5YicNKRGyIWGkSDEsfY,14191 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_12.py,sha256=ipiXNX_AGdA7-rLJMFNdslRKoilIlLStounMBeikUCI,15477 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_13.py,sha256=4oxOhW3xKEgLEl8vvWY8rHHjDggES8izC2fJqjBIKWg,7992 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_14.py,sha256=14IUflF33gBpwLbEM_rDxAUraZe287uVbMZ5EKYBz-o,14533 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_15.py,sha256=5iMVIsb_4OFZZKgePv9qYju0D4i2GLPtyLY0gp8TwcQ,16443 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_16.py,sha256=yp3WyHDz7tUTKHOlyXF-HWExbTD0g9qLMC0VrEN7sM4,44195 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_17.py,sha256=jPYif6T4ov4rLC3ZMc7tN2YP6niIYyXjjTNIRTvGTC4,17687 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_18.py,sha256=cn0rJftxEgbabluDTvZma5BLd7dCOG5_jletm0ID-Ds,33189 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_19.py,sha256=bRr9BwZUA9jBCCiiBWV8zAdR3HZ3FX0ph5uVwTVpwDs,14255 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_2.py,sha256=CR1xIUsLPSLJZMm8IimSmmCfoqkZKiEblTwWa1Rbc_8,11361 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_20.py,sha256=ByUPO43iUjt5RdBU6H4NmqetkIpqNQkf46VjvaQN-UA,17585 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_21.py,sha256=9yGfr6n9ux7Gseb9ei9y925wooeU6NYvxlg9M8WYLwc,28637 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_22.py,sha256=IwBSga-ObscZzpn3hj7vZfRsNjPRfwHSkQRajREna4w,29337 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_23.py,sha256=qxpu0qfayleo9KIQThhufsLslGYfeYvr0v8gNkETJMA,29157 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_24.py,sha256=naOwrrQopaQra8-WpVNqxIpVlokaNc-1BwGX9Cd7o88,9427 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_3.py,sha256=Rf4cfoPb5pp_-aZ5lMMNSuhoxzFmya0SSnu0nL78YQQ,12637 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_4.py,sha256=9RXNFbH4qnZbz8QEKHJ2XaoCrj5fH1ZWk5zXxN7SD2U,12601 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_5.py,sha256=2ET6A50Qc7c4Hihy_gyW_6bU17E3HCRXuW4UMt2tLZQ,11591 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_6.py,sha256=uzXMO9ifbdetAg1DtGeH-IM9_cSJUpfJSRx9HMDHfOQ,12835 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_7.py,sha256=zIE2r3YVlog0iKUyxG09yBLAdZpmzjUecW9aTflDsm0,15657 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_8.py,sha256=CDm_1CudB8wZrfw1EnjMGTlcRnIMOtz2VCM4GdgGGus,14409 +torch/_inductor/fx_passes/serialized_patterns/_sfdp_pattern_9.py,sha256=f_WJ8-i7G9KGrz9KfyPmFtGa3-zFUaCwv6N7zATyMBE,15665 +torch/_inductor/fx_passes/serialized_patterns/addmm_pattern.py,sha256=qvjHnXM6SV8Qc6n_Vf9fJQk9lrQOBZ2qxuBO8jEOqRs,1911 +torch/_inductor/fx_passes/serialized_patterns/bmm_pattern.py,sha256=P0ZNyqXqPsyHKQKpyAybcLNCVORkhJCY4WsN0tUbsyg,1317 +torch/_inductor/fx_passes/serialized_patterns/mm_pattern.py,sha256=_BMNCRyTiU7hFEgosp_AKkAUsizpnO2sh-AX5_4M91I,1305 +torch/_inductor/fx_passes/split_cat.py,sha256=UFnm0Q5X7CuI2l51nVx5SCKTrmrV5PnpeH6vvzymCSI,124493 +torch/_inductor/fx_utils.py,sha256=2fgYKUmFsdQ53rzM-KUhZoBp4Yht6-lMwM97plll5ik,13634 +torch/_inductor/graph.py,sha256=txUTtKco4p9dIHdQSkZLXkg9wTMiDXGXp09j8MgMTII,111501 +torch/_inductor/hooks.py,sha256=_AEU441c8ykOFzXg4n4sqUDUCmY1Z9U3kOS1KEEtymY,697 +torch/_inductor/index_propagation.py,sha256=RFABBtjQ9lwLaGKhGopFsfL9VNyFCtqNC02wtozd65Y,13726 +torch/_inductor/inductor_prims.py,sha256=hGZDj9R3ycvlCqZ4gBo0Ypoa8wRMclT3Wj9j-8GjG2Y,7560 +torch/_inductor/invert_expr_analysis.py,sha256=AernDewPrJGigxKVOcXhoOprXwfPDUR1sIYcCHZEONw,7165 +torch/_inductor/ir.py,sha256=Trnvn-AkwqhzJ0DjJ8dbl9SonDV-o_0jHPqgZpTM0x0,360522 +torch/_inductor/jagged_lowerings.py,sha256=atmdqg11adE95V1xs96NvfZuMggUvUgq5T8qCPHzrq4,9486 +torch/_inductor/kernel/__init__.py,sha256=0rOWM2g1954Sf81AJN16gevOWjZRMDrG7qefmp4bDhg,47 +torch/_inductor/kernel/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/kernel/__pycache__/bmm.cpython-312.pyc,, +torch/_inductor/kernel/__pycache__/conv.cpython-312.pyc,, +torch/_inductor/kernel/__pycache__/custom_op.cpython-312.pyc,, +torch/_inductor/kernel/__pycache__/mm.cpython-312.pyc,, +torch/_inductor/kernel/__pycache__/mm_common.cpython-312.pyc,, +torch/_inductor/kernel/__pycache__/mm_grouped.cpython-312.pyc,, +torch/_inductor/kernel/__pycache__/mm_plus_mm.cpython-312.pyc,, +torch/_inductor/kernel/bmm.py,sha256=gQeQoF-dSHF6gdgAU2VUkv4NPGZPSqRhUK32pKvR4kQ,11888 +torch/_inductor/kernel/conv.py,sha256=gcc5i_M-5ev91Pn-huFUjbY1yAwyAhFAbX0D-hwx6Zc,21972 +torch/_inductor/kernel/custom_op.py,sha256=7sof5qIFDifeEApCD0mA2Ui0Cjsnyqc9hi7VZvQN-oA,20052 +torch/_inductor/kernel/flex/__init__.py,sha256=HgfgC6lEN7eGMJa7lqt-WTpLF3yvQUdNQreDptizsrw,156 +torch/_inductor/kernel/flex/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/kernel/flex/__pycache__/common.cpython-312.pyc,, +torch/_inductor/kernel/flex/__pycache__/flex_attention.cpython-312.pyc,, +torch/_inductor/kernel/flex/__pycache__/flex_cpu.cpython-312.pyc,, +torch/_inductor/kernel/flex/__pycache__/flex_decoding.cpython-312.pyc,, +torch/_inductor/kernel/flex/__pycache__/flex_flash_attention.cpython-312.pyc,, +torch/_inductor/kernel/flex/common.py,sha256=05zQ9PtXONnIrsx6mnIeSi-Jhu6i9923ienWzbxRO2g,11851 +torch/_inductor/kernel/flex/flex_attention.py,sha256=YwrSNX9qjG0oG_fLZqfa2CszClg1q5duEYtFkaLCj1A,34367 +torch/_inductor/kernel/flex/flex_cpu.py,sha256=PjWp2bsQmkAkIe6ys3gUQnxc96rlthbOUaFzM5HeSWQ,12258 +torch/_inductor/kernel/flex/flex_decoding.py,sha256=6WlqO8uW41M_xWHhylhyn3uhMxFHVVqDyi4yYqjGlYo,15446 +torch/_inductor/kernel/flex/flex_flash_attention.py,sha256=2njgWzR_kpFyDQGEWo0a1rIRMGzo6h5nh5uo3RI-_2s,16527 +torch/_inductor/kernel/flex/templates/common.py.jinja,sha256=1LymZi4dQ2qsaHnZoTcKgE7SS-WcRs7YFiitVAxVZf0,7244 +torch/_inductor/kernel/flex/templates/flash_attention.py.jinja,sha256=Eeg-SPVKIjMZWPsUQQdDM7dtYoAieWIb18GoQDY6lW0,2553 +torch/_inductor/kernel/flex/templates/flash_attention_backward.py.jinja,sha256=PkPEFSOt_SqGbUzRe6qA8PHmTLRUps6av2-DrM7HnXk,834 +torch/_inductor/kernel/flex/templates/flex_attention.py.jinja,sha256=3eN4e-_pzF85yY9AUjeOyk1c_bPJE8pf1avvASeItjI,8985 +torch/_inductor/kernel/flex/templates/flex_backwards.py.jinja,sha256=7gjYbpsFf603f7-7IamC7waFt9yKM_Igmak0rPxcmT8,26042 +torch/_inductor/kernel/flex/templates/flex_decode.py.jinja,sha256=C2oEJe0wxhLc8MwnXSvDB6oD075nD6AOu7087SICXUg,10653 +torch/_inductor/kernel/flex/templates/utilities.py.jinja,sha256=3yOrlkgoX5n6erePGmdmQj0b5G2qu7zHw2ZBjKsDfq0,2317 +torch/_inductor/kernel/mm.py,sha256=gqtNyiNDUpCEPkrmOvg2JiIAuwd--_PX8Mfm5rrY_ik,38139 +torch/_inductor/kernel/mm_common.py,sha256=Fa5lb-OdSAQS_O3AEN0Y7zKOqXQCP9kD-U4t9Ac4fck,8341 +torch/_inductor/kernel/mm_grouped.py,sha256=xNfBSjDVhOAkGOvXuEFOeQiQ30Ntq5eN3iombddIEwk,28395 +torch/_inductor/kernel/mm_plus_mm.py,sha256=2n4NJCk4W7_ZzTbPhe9DZiLXkkxXPPVdjsovsjbchhI,6074 +torch/_inductor/kernel/templates/cutedsl_mm_grouped.py.jinja,sha256=69Icmo8e120bYh7h47frZLK4yjZnv6SrDDGrdz6yDy0,11816 +torch/_inductor/kernel/templates/triton_blackwell_ws_persistent_device_tma_mm.py.jinja,sha256=PVkkhT4ybkPLCgey5r1hcLFp3sBWmGISazlzFkTMOvw,3843 +torch/_inductor/kernel/templates/triton_epilogue_scaled_mm.py.jinja,sha256=txvhItDoQc0G3UFw8EeZ51a-ThObX1V-i5NDRL2lNcs,6322 +torch/_inductor/kernel/templates/triton_main_loop_scaled_mm.py.jinja,sha256=TG2iJ7KZNU-vr_ZK_xH8NIVe7xcL60NoCCgbvFSRps8,6683 +torch/_inductor/kernel/templates/triton_mm.py.jinja,sha256=p07UnncRJj8W2lgqy5HuyW_Fd03iMf7OiogrtgmOF1E,2870 +torch/_inductor/kernel/templates/triton_mm_rocm.py.jinja,sha256=D3ikDTCQl6eXrweC5VD4Dt5fYjXBlO3X0WTPL491c9I,2806 +torch/_inductor/kernel/templates/triton_persistent_tma_mm.py.jinja,sha256=Kn7W-BIX6P90741WDgIoHTu_NOcBzYAd-5L-2bTfkHM,4640 +torch/_inductor/kernel/vendored_templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/kernel/vendored_templates/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/kernel/vendored_templates/__pycache__/cutedsl_grouped_gemm.cpython-312.pyc,, +torch/_inductor/kernel/vendored_templates/cutedsl_grouped_gemm.py,sha256=zhCWUwhGdy7S8flR82HQtJGOiwsHZ-l1oXBOYx_6Ofk,97045 +torch/_inductor/kernel_inputs.py,sha256=lqfJ5W-t99HnY-O0IR8vEqS2b_yg2nUK-jtw4d54njc,11159 +torch/_inductor/kernel_template_choice.py,sha256=a8oWsLxrkBH8KoB6aDugkVSIE87JV7ZLiBBUCLtJGqM,3462 +torch/_inductor/lookup_table/__init__.py,sha256=ubcyNCKzhuffmkJpHog6YgC8AgDX4Gbdr3wH2DSItM8,909 +torch/_inductor/lookup_table/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/lookup_table/__pycache__/choices.cpython-312.pyc,, +torch/_inductor/lookup_table/choices.py,sha256=ktLe7dV6ssLrlNSHv_FRHS6NNunDikvUVPp5xGL6TRE,16491 +torch/_inductor/loop_body.py,sha256=byGt6XgxkiOWPgtcnjFYlAmAKH4FxYRBy8wsXmJWvdg,27801 +torch/_inductor/lowering.py,sha256=lXoglHjtU2Td7o6ckY9k0Nh2Yv01fF_hxs6svHuL13E,260212 +torch/_inductor/memory.py,sha256=UlckH_sePyDcmxbd4z_0uAlXH6mjhhjwuDkViTGmlGs,41894 +torch/_inductor/metrics.py,sha256=fldlhznSAc5UlECewBDs-J29YhIGah0_onRshELwOu4,15087 +torch/_inductor/mkldnn_ir.py,sha256=0M1qpxWkbkpD3tv1iww-WcRxjjSphoz8QZurnGsWrGc,44977 +torch/_inductor/mkldnn_lowerings.py,sha256=fCuco9a-pFlMQEzgbYrjJVNnHGjtvLbn1BcLHVhleOo,58463 +torch/_inductor/mock_cache.py,sha256=W5WYZhGub_qia00tljU66TWiyMzUTnCZ9hxWdxEOQgM,8861 +torch/_inductor/ops_handler.py,sha256=y_kOezXyV3H04RWtF0OQL6uT8o0d-OrTBfdslDM-Fuk,37441 +torch/_inductor/optimize_indexing.py,sha256=Bi5Wa5unzm0gDtBuildjKPz5ffyzCnuwW0eOkKxisrA,4261 +torch/_inductor/output_code.py,sha256=d5RNG2Snt8WY1bCU536vTHq90nBKW2qLzwU9KVhegbg,40967 +torch/_inductor/package/__init__.py,sha256=sQTRXIg6O5rZQYURRT-cJ2r30R2AjcIO2ofzbbbfvzc,68 +torch/_inductor/package/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/package/__pycache__/build_package.cpython-312.pyc,, +torch/_inductor/package/__pycache__/package.cpython-312.pyc,, +torch/_inductor/package/build_package.py,sha256=eInHlzpquSyi0W0tjhjUu_bhfEjXTIoGLRpHxJZfI-w,344 +torch/_inductor/package/package.py,sha256=LeyAlBtN9raqVWYOFB2jKySq2lhZ7O7MQnOEJqED238,4565 +torch/_inductor/pattern_matcher.py,sha256=kUW4a9cBotXCuWN8q_efePMPmanea1mnwMI-8GsMCVI,86911 +torch/_inductor/quantized_lowerings.py,sha256=RzswZUeyP-3Q5AWBwx_qE56gLPOF70HGqXumZHW78nQ,5897 +torch/_inductor/remote_cache.py,sha256=5w4muJe5A7LvBzIYC79N7syp1MLKgAFE2yi4xepJl1A,13775 +torch/_inductor/remote_gemm_autotune_cache.py,sha256=3L4mzzHnZVU-dQY26eO2gI-uhnxm2NrGMTcXfmavjiI,571 +torch/_inductor/rocm_multiarch_utils.py,sha256=VoEV3rJlq5q5oT0f5N1xmP34JWTIkGsdMYXZMynA_zA,7773 +torch/_inductor/runtime/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_inductor/runtime/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/autotune_cache.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/benchmarking.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/cache_dir_utils.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/compile_tasks.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/coordinate_descent_tuner.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/debug_utils.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/halide_helpers.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/hints.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/runtime_utils.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/static_cuda_launcher.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/triton_compat.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/triton_helpers.cpython-312.pyc,, +torch/_inductor/runtime/__pycache__/triton_heuristics.cpython-312.pyc,, +torch/_inductor/runtime/autotune_cache.py,sha256=LjlSoxBSzAe8uPXaxYrkgcQHT4yJvAs2Q86NoBXbajQ,23715 +torch/_inductor/runtime/benchmarking.py,sha256=FhfsV96RyO98XK1Gq3wxrYZEpmQjAsVh5lAoXNdNFhs,18007 +torch/_inductor/runtime/cache_dir_utils.py,sha256=o-C1G9qJ6-UtnkOaxQcskpci5UGsHL5M8cqB9QpLgMY,1498 +torch/_inductor/runtime/caching/__init__.py,sha256=7otyItURavSAYuyzcl4zRhvrPnALlELrWk4IXhgpW-8,2472 +torch/_inductor/runtime/caching/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/runtime/caching/__pycache__/config.cpython-312.pyc,, +torch/_inductor/runtime/caching/__pycache__/context.cpython-312.pyc,, +torch/_inductor/runtime/caching/__pycache__/exceptions.cpython-312.pyc,, +torch/_inductor/runtime/caching/__pycache__/implementations.cpython-312.pyc,, +torch/_inductor/runtime/caching/__pycache__/interfaces.cpython-312.pyc,, +torch/_inductor/runtime/caching/__pycache__/locks.cpython-312.pyc,, +torch/_inductor/runtime/caching/__pycache__/utils.cpython-312.pyc,, +torch/_inductor/runtime/caching/config.py,sha256=UYRHkEf2N38847EB2lkWTjGQ22KTpZ9SzsUzHGu9X4w,5582 +torch/_inductor/runtime/caching/context.py,sha256=gX1lZ8G6fvwqvSkkhms6mB56afXW9tk5GhjbgyhV4tA,10607 +torch/_inductor/runtime/caching/exceptions.py,sha256=LfjOBcJDSd2RzIRqLcOuZF0_IkNhene4mVH4mkxhz6w,6156 +torch/_inductor/runtime/caching/implementations.py,sha256=iEH5sT7skP-jk1FGLOQFn7_hAmPERNPlOqAZK9xksGg,14106 +torch/_inductor/runtime/caching/interfaces.py,sha256=cPexNPlTbtpG2NZ-U5FCrNL5CCQzmqN9P0uyPOeFDUM,31650 +torch/_inductor/runtime/caching/locks.py,sha256=9vgxxI8wR4_nv8CANm4iIBo2Q1RgQbQfFPyZ7hWVTrY,7713 +torch/_inductor/runtime/caching/utils.py,sha256=VHw3PyB--q64bgiLX7h6ANneuREYXpkIrtx7kelJOiA,3541 +torch/_inductor/runtime/compile_tasks.py,sha256=RWw5cQZyAfzAv1pnHetAOZUM4tAvZrCwfLGoQJTsiIY,2378 +torch/_inductor/runtime/coordinate_descent_tuner.py,sha256=bOGy5UtNvYHQLNDIzQvPE_e6SgVDWo6GmgKxfkByRTU,14649 +torch/_inductor/runtime/debug_utils.py,sha256=l_DmIdkPfpoiLiDv612EHZwmx4qb1ncFZZeLWfTceKA,4413 +torch/_inductor/runtime/halide_helpers.py,sha256=1aC3s7wXawGzBhbAAmEPERm6zf7wb3qT2qPtQb3gpzg,3660 +torch/_inductor/runtime/hints.py,sha256=ZjohAqmlKB7hi_JOUwR44szftXiv8uzbJWEKKE_Ed8Y,7391 +torch/_inductor/runtime/runtime_utils.py,sha256=AsCtf7YWDBFoLARFsjL3fCtYGl9kEP0JlzZOM9ZUYy4,7214 +torch/_inductor/runtime/static_cuda_launcher.py,sha256=Vc5PNImVgztOoW83EUK3WTJc15XCpCUqKfeighdIJnU,11198 +torch/_inductor/runtime/triton_compat.py,sha256=eV5uX47sZA0htFPouaTUup2bXUFVzykjeMkYZ60WXho,4551 +torch/_inductor/runtime/triton_helpers.py,sha256=x1Ekd44IWXKa0XtzELF40agIBMgXIZIKN5oR6Hkyxyw,24750 +torch/_inductor/runtime/triton_heuristics.py,sha256=s-PSvk_cQiCQjs5HAgZkd7nIZ5hR30t8rf8slK_dqss,148273 +torch/_inductor/scheduler.py,sha256=pKMVUSQpRbW_i4ueIhiAxzw_6B0JejxTSFrS3LkkLIk,263511 +torch/_inductor/script.ld,sha256=gJa5rj-3zNDRd7_t4qAJzFpR8V_v8QhcybAM0-G8hDc,438 +torch/_inductor/select_algorithm.py,sha256=LL4kD4JLmPFLcnlNDnEsRhouRJ6aKZr3gPBQwgcnVe8,174942 +torch/_inductor/shape_propagation.py,sha256=J6NMI2szlp4jkaXF95UIQUExcq3gdTmblE_MGunl5uA,4719 +torch/_inductor/sizevars.py,sha256=7Ca1K_oNutr_GGlbhqr3XhmQSfgWDjTOr-afLzi2-HQ,48490 +torch/_inductor/standalone_compile.py,sha256=bbt1pD1TFjRW8MfPBxMkmLu0fFVpMgktZ6XEVxxVSEI,17104 +torch/_inductor/subgraph_lowering.py,sha256=Ynie5yrVIZ-Gg03UH8Fc1hx6KLrZ8A2K_46atmL6bTQ,7520 +torch/_inductor/template_heuristics/__init__.py,sha256=UZ0R4JOQ--GlgHJ6yOs-DgiEr7fGs0tXYsFJ9bWPH98,325 +torch/_inductor/template_heuristics/__pycache__/__init__.cpython-312.pyc,, +torch/_inductor/template_heuristics/__pycache__/aten.cpython-312.pyc,, +torch/_inductor/template_heuristics/__pycache__/base.cpython-312.pyc,, +torch/_inductor/template_heuristics/__pycache__/contiguous_mm.cpython-312.pyc,, +torch/_inductor/template_heuristics/__pycache__/cutedsl.cpython-312.pyc,, +torch/_inductor/template_heuristics/__pycache__/decompose_k.cpython-312.pyc,, +torch/_inductor/template_heuristics/__pycache__/gemm.cpython-312.pyc,, +torch/_inductor/template_heuristics/__pycache__/params.cpython-312.pyc,, +torch/_inductor/template_heuristics/__pycache__/registry.cpython-312.pyc,, +torch/_inductor/template_heuristics/__pycache__/triton.cpython-312.pyc,, +torch/_inductor/template_heuristics/__pycache__/triton_addmm.cpython-312.pyc,, +torch/_inductor/template_heuristics/aten.py,sha256=umAHESjSwEg78Vj0qWXDLjCJtNTFwkimw_oe14u-6wM,2967 +torch/_inductor/template_heuristics/base.py,sha256=BJRc0G8wjLxIex2nGvzcPPBphd8RlWHHfSw-PGWoZLg,2580 +torch/_inductor/template_heuristics/contiguous_mm.py,sha256=CTaGbkGyQ0fonxFNYjMXWWZ9fVBk39G-QOxW97G2Mj8,2304 +torch/_inductor/template_heuristics/cutedsl.py,sha256=ttwquVbc6B1bhFghN0pPQtxuBgFX6QuJIIUvuhsRk6c,4596 +torch/_inductor/template_heuristics/decompose_k.py,sha256=vg9bx7VLqgQaUcqvtYUEDMxbPl5_xWqQNXMG-Q03Y6I,2453 +torch/_inductor/template_heuristics/gemm.py,sha256=t_wO5pZV8HQecnwRbm43nJ2sJ1S3pJmzeD6SUuQIJdk,558 +torch/_inductor/template_heuristics/params.py,sha256=36s02IRVKF_hM9twDAveaYD3E3Aof69TVJ6RPc_xw24,1299 +torch/_inductor/template_heuristics/registry.py,sha256=q-QY2V6ZTRNeJONQ-uFrrI251hfO9ujOr7rHarfmpio,6216 +torch/_inductor/template_heuristics/triton.py,sha256=y5AW_c_yArpRefNjxhrXPyUPf1UYKtb-ECuK-S6Dq3c,101224 +torch/_inductor/template_heuristics/triton_addmm.py,sha256=Xp5Xj3hajkwgw30huIzNfzy0flJMlxscaTsy8610Qo0,1122 +torch/_inductor/test_case.py,sha256=qg_vvhk9gL-XoCSSOuzSHvqdv54RIx8wfSaT_ysFTTg,1526 +torch/_inductor/test_operators.py,sha256=-7gDSaAsxRPJU3B2f9qL0lZVu9ZeogpUP7NlCsemk_8,890 +torch/_inductor/tiling_utils.py,sha256=GwtBY8f5MhyX_GFXR4h2HRhJYXWup6hJ6VEQ68YZRF8,28439 +torch/_inductor/triton_bundler.py,sha256=ynRy9zmRFv1lyM2XB-8W-317lrihbW9knLCE5KXsQ-I,16391 +torch/_inductor/utils.py,sha256=i7iI-RfpZLCYyEiAWUMgfINI1EwzUh7OLSTCHlHOQW0,142412 +torch/_inductor/virtualized.py,sha256=sa0SuUy531UmK9NBvbJrItp2V5IU2K-23m8ZD1fyneA,15836 +torch/_inductor/wrapper_benchmark.py,sha256=6U3_XaQrsxer-TmPRU7TL4YQc_6usLlorfjcnp7BVAE,16952 +torch/_jit_internal.py,sha256=S0rKZSUCtcl2hm-QMdmGVdwbAuHrYVD_OuWeAGC1Nw4,55082 +torch/_lazy/__init__.py,sha256=GKBTkAfZ9pnbRwoWKT2GBUUBbC1WbSec_ufn7ekDhSY,1848 +torch/_lazy/__pycache__/__init__.cpython-312.pyc,, +torch/_lazy/__pycache__/closure.cpython-312.pyc,, +torch/_lazy/__pycache__/computation.cpython-312.pyc,, +torch/_lazy/__pycache__/config.cpython-312.pyc,, +torch/_lazy/__pycache__/debug.cpython-312.pyc,, +torch/_lazy/__pycache__/device_context.cpython-312.pyc,, +torch/_lazy/__pycache__/extract_compiled_graph.cpython-312.pyc,, +torch/_lazy/__pycache__/ir_cache.cpython-312.pyc,, +torch/_lazy/__pycache__/metrics.cpython-312.pyc,, +torch/_lazy/__pycache__/tensor_factory_functions.cpython-312.pyc,, +torch/_lazy/__pycache__/ts_backend.cpython-312.pyc,, +torch/_lazy/closure.py,sha256=O2f9LUyhZgr_dMCuwMY-uq2x54Fh_i2cHXutXlRUnrw,5814 +torch/_lazy/computation.py,sha256=Jd0b-aVk5Ek29dbMkt0Mov8Ysn1r5nqN8At7p17P6wM,946 +torch/_lazy/config.py,sha256=cSqerqEAgqTx59qy4GHAsrxA7xmBbNG9cg2_Uk1e0_Y,464 +torch/_lazy/debug.py,sha256=Nr-aSxYVQzOAGGIrelenLGc7Pc0xS0Qsl8stUg2XUyY,760 +torch/_lazy/device_context.py,sha256=5MeMBMnfsOnTq0Wx5F9ZhD3TFuiNL_sZ0GjRU9i5ORk,706 +torch/_lazy/extract_compiled_graph.py,sha256=Jl1Xuv3UlQ8bBqVAm0DZFhEXsObq8YSw_KqNWLczS4M,8679 +torch/_lazy/ir_cache.py,sha256=WOWccEwnoJyQnhzy0h78xPMB1ziKKx5wrIwYo4U-fng,362 +torch/_lazy/metrics.py,sha256=wbkWk4xHbGKDbPveN1a7nfFpQNs24gdOcUNWfFVppe8,567 +torch/_lazy/tensor_factory_functions.py,sha256=BotJAvC1li1Dj1YaOyd7tdI1A5ME-JfofMm_BV8oxIc,1417 +torch/_lazy/ts_backend.py,sha256=RR7S12OpeqSkVQrspwOcROc-ukN01WvBi_84YbLucCA,170 +torch/_library/__init__.py,sha256=hKRHdphnfJh6GXSYgjf75aVZ4but1yjVCMPFybY1a2w,275 +torch/_library/__pycache__/__init__.cpython-312.pyc,, +torch/_library/__pycache__/autograd.cpython-312.pyc,, +torch/_library/__pycache__/custom_ops.cpython-312.pyc,, +torch/_library/__pycache__/effects.cpython-312.pyc,, +torch/_library/__pycache__/fake_class_registry.cpython-312.pyc,, +torch/_library/__pycache__/fake_impl.cpython-312.pyc,, +torch/_library/__pycache__/fake_profile.cpython-312.pyc,, +torch/_library/__pycache__/infer_schema.cpython-312.pyc,, +torch/_library/__pycache__/opaque_object.cpython-312.pyc,, +torch/_library/__pycache__/simple_registry.cpython-312.pyc,, +torch/_library/__pycache__/triton.cpython-312.pyc,, +torch/_library/__pycache__/utils.cpython-312.pyc,, +torch/_library/autograd.py,sha256=BaNL4BldqhVEoZEpFb0a1f3WDTokFvvydX2rNNCD9p4,9021 +torch/_library/custom_ops.py,sha256=dEE79sHMLqGZT7f1PdgG7bgZ54Rh2XZ4AQmrDd8b5j4,39400 +torch/_library/effects.py,sha256=sDwHH09G9bRgNkKQV_ru_JO5B94jaY9iKY5CCpl2CBE,2862 +torch/_library/fake_class_registry.py,sha256=_0hqrRLo6JMWIHbC1JEUoNvSFM2ZeyX8UOY0Kyg8hIE,16698 +torch/_library/fake_impl.py,sha256=hgVLvfS2mzk-ZNx3IV0sHheUKIfvCyYHrhORTSGviWc,8999 +torch/_library/fake_profile.py,sha256=XOTnZwcnx9uFSHKA_aBGwhCgHbi20oxjIW7x6df2mVo,11816 +torch/_library/infer_schema.py,sha256=yWv8B20HjN-9oQwBanKuEx3v9siqmoklmKJHSOY5y78,14094 +torch/_library/opaque_object.py,sha256=vaMpxxZM-WD2E0rivmZlQfXV4r1FxH0vJsSrmpdzRkw,7215 +torch/_library/simple_registry.py,sha256=dpkers0cF1ZaEofw-q49ZJAE21Dkll-4j9OIKY70k7E,3040 +torch/_library/triton.py,sha256=vRad-jIt29gw7B8vZSPEIDtYAA4M75TWxvQgZ1AHUc0,15705 +torch/_library/utils.py,sha256=K-Bx-sinubROjwRJbEgd-Bi57GdhWzgtLEW48QbsT58,23024 +torch/_linalg_utils.py,sha256=LU4SoopP5W4SiL4-o3-03dOZlFuyczZt71lLwwOQIWo,5347 +torch/_lobpcg.py,sha256=LJiX7NZCgJI_fWxbw2lThz6kfbAJNaLeUTyL-YrHO8s,44743 +torch/_logging/__init__.py,sha256=2EY-uBPeL9Ggk1P8KTM-sFrTwBJ6tbxFlCdzkE03a5Y,838 +torch/_logging/__pycache__/__init__.cpython-312.pyc,, +torch/_logging/__pycache__/_internal.cpython-312.pyc,, +torch/_logging/__pycache__/_registrations.cpython-312.pyc,, +torch/_logging/__pycache__/scribe.cpython-312.pyc,, +torch/_logging/__pycache__/structured.cpython-312.pyc,, +torch/_logging/_internal.py,sha256=hg_IiMS3BR1QvmY1g2pnj3hGc-zXFsasvTi6K6uCS84,53404 +torch/_logging/_registrations.py,sha256=CBViORNZinMYAQ3bDhDNafh2wjwAWWE-KqK5X9zwwtc,8600 +torch/_logging/scribe.py,sha256=2ThcemHnEMQyUoHnuHqyi6cqO41Ei8lgjR4iRHdLZbY,2639 +torch/_logging/structured.py,sha256=bfbV5Owdjs2P4r5Aw8CtxZO9-cDwSjrAeTRTH-kZ_c0,3031 +torch/_lowrank.py,sha256=kXhdaOtitPp6XsPreEgJ8TCxwsd3ZfTsAtwIBsTGZCI,10790 +torch/_meta_registrations.py,sha256=97zMnDjqM10_mKDZeCEqf2x8Kj3Kn_H8uh-aFhMc9oM,278938 +torch/_namedtensor_internals.py,sha256=vzDQvRRJ7jLQS8P1Zsmw8EQvVKx7staCkiSEuQrWHVI,5435 +torch/_numpy/__init__.py,sha256=L-9546TOCIDJJcbY_N5BCTvvHRq6DSf1QS8dMXce3SE,624 +torch/_numpy/__pycache__/__init__.cpython-312.pyc,, +torch/_numpy/__pycache__/_binary_ufuncs_impl.cpython-312.pyc,, +torch/_numpy/__pycache__/_casting_dicts.cpython-312.pyc,, +torch/_numpy/__pycache__/_dtypes.cpython-312.pyc,, +torch/_numpy/__pycache__/_dtypes_impl.cpython-312.pyc,, +torch/_numpy/__pycache__/_funcs.cpython-312.pyc,, +torch/_numpy/__pycache__/_funcs_impl.cpython-312.pyc,, +torch/_numpy/__pycache__/_getlimits.cpython-312.pyc,, +torch/_numpy/__pycache__/_ndarray.cpython-312.pyc,, +torch/_numpy/__pycache__/_normalizations.cpython-312.pyc,, +torch/_numpy/__pycache__/_reductions_impl.cpython-312.pyc,, +torch/_numpy/__pycache__/_ufuncs.cpython-312.pyc,, +torch/_numpy/__pycache__/_unary_ufuncs_impl.cpython-312.pyc,, +torch/_numpy/__pycache__/_util.cpython-312.pyc,, +torch/_numpy/__pycache__/fft.cpython-312.pyc,, +torch/_numpy/__pycache__/linalg.cpython-312.pyc,, +torch/_numpy/__pycache__/random.cpython-312.pyc,, +torch/_numpy/_binary_ufuncs_impl.py,sha256=m6w0fYCYwaKH8IolQmS_vBIHmSoDjKe5l-YfRIOsU_8,1956 +torch/_numpy/_casting_dicts.py,sha256=pNVF9rNC9TFps2ktvWau9H-GOtUBDx17UQ-AEaRuefQ,43846 +torch/_numpy/_dtypes.py,sha256=HmdjVKUHXY1ES0hxkdS8H1OF4VVTG-dfZ2AzVTvyD5U,10731 +torch/_numpy/_dtypes_impl.py,sha256=NkT8cMxYCGfvich-Yy5X2E3vWRp4xEyz5lY4b241Z-g,6127 +torch/_numpy/_funcs.py,sha256=bjhFuiOr_fYT-tJuwy6U3T_iW_7bNLKIqPznlisWxIw,2173 +torch/_numpy/_funcs_impl.py,sha256=caJkiiYvD4TUN31tJLKzbQgoECb2WWcwy2Ht7yWNPF4,61391 +torch/_numpy/_getlimits.py,sha256=9pCtO5PQvHygMv2keLR0-AlcM3zKwWjYQ5pvLxw9ASE,284 +torch/_numpy/_ndarray.py,sha256=900Zq9x2IXTG3QSWU0yfNh6lXMRJ3HgyfpfHoR4KUMU,22082 +torch/_numpy/_normalizations.py,sha256=bW8d3j5m65p2aOUn-BeBrYSNIinKFd1jUyKBnrBPFPg,8992 +torch/_numpy/_reductions_impl.py,sha256=ZhmpiamReWt3FK0YrY8HxINYRDJiGY8_YYbUPFhKqvw,12260 +torch/_numpy/_ufuncs.py,sha256=4wJeqxLv37PN-ORu7jw0KqBdIOE4GdJKmpvMpfMqelQ,8700 +torch/_numpy/_unary_ufuncs_impl.py,sha256=oTAovTAdhzexww7B4rR9u2ONK7heDWc2Q52vuJ5hSjg,1233 +torch/_numpy/_util.py,sha256=nDs9Ef10UpIJseg_A-5aH1y3B-3Pvnzy4i9Yu6cb5DQ,7991 +torch/_numpy/fft.py,sha256=CQRzqq_1Ys1j1ahExCTp5U8ZBigloBXK1kcoyAL0T9Y,2935 +torch/_numpy/linalg.py,sha256=m2K8GEMQGySc6j9_eATOwx91-nrMnCo4gbvj062xO0s,5891 +torch/_numpy/random.py,sha256=Tw83UKncwgBPlMejo5iWu8RE46oPCDUfpefeV8QRa00,4843 +torch/_numpy/testing/__init__.py,sha256=3F4nlODzdqjjbhBV4Nz9eA44BzLgp-BpbLycggm6GVY,395 +torch/_numpy/testing/__pycache__/__init__.cpython-312.pyc,, +torch/_numpy/testing/__pycache__/utils.cpython-312.pyc,, +torch/_numpy/testing/utils.py,sha256=njwLWIOWwnviqdHgZa1GQ1VpVmeICWrdxyVESYbuEMI,79747 +torch/_ops.py,sha256=F_Ce1tl4klhSI6iAoJ4psXhM9LNiXlby_Q0z8l4jffk,62182 +torch/_prims/__init__.py,sha256=7-lDBm-4SeZc1_30aqwkf46alLCUpEG5bPqIfvryiRU,85621 +torch/_prims/__pycache__/__init__.cpython-312.pyc,, +torch/_prims/__pycache__/context.cpython-312.pyc,, +torch/_prims/__pycache__/debug_prims.cpython-312.pyc,, +torch/_prims/__pycache__/executor.cpython-312.pyc,, +torch/_prims/__pycache__/rng_prims.cpython-312.pyc,, +torch/_prims/context.py,sha256=zDv5RPIKFV6i8DmFuX8NUsYJupUZL7rMqx_E3n7kK_A,6409 +torch/_prims/debug_prims.py,sha256=MB8E26u0EbLkP8bhtwKnUpbpDNMpT20aZC5sufbPTTo,2140 +torch/_prims/executor.py,sha256=3pzxSjHXdikDGLwMuwOxXsWBQBfCgxxFJnUwHS5h0ag,1991 +torch/_prims/rng_prims.py,sha256=2Ag70-94mpWGKtyFa79sQHbhg5PAb3kjDb9KZ4TVc2s,14969 +torch/_prims_common/__init__.py,sha256=ct9IaTGZUf8R-TEORN8uK_pC4w4nXPMBvdrbkft_0u8,74131 +torch/_prims_common/__pycache__/__init__.cpython-312.pyc,, +torch/_prims_common/__pycache__/wrappers.cpython-312.pyc,, +torch/_prims_common/wrappers.py,sha256=UcbpJ6q9dtsVVb75sXt8QQS-y23JbYvEuDsp2OvxXgE,19286 +torch/_python_dispatcher.py,sha256=CBgBKLGX-LaF-fUR99qKJ8Fg_YdePdsdQOtExf_4tE4,7319 +torch/_refs/__init__.py,sha256=MY2hmOgDTo-t5lTnnNMnMojkHSFi9QfWaxR8_d2OKNk,230160 +torch/_refs/__pycache__/__init__.cpython-312.pyc,, +torch/_refs/__pycache__/_conversions.cpython-312.pyc,, +torch/_refs/__pycache__/fft.cpython-312.pyc,, +torch/_refs/_conversions.py,sha256=xZr1y6bvByhAepVg0uqoo_z1S7OisYqt2jI7GwF2dCc,3652 +torch/_refs/fft.py,sha256=DFBYrLZwuYd4VnKaZCJSMIchMvOAeg4CkP0X0FiE4d8,18573 +torch/_refs/linalg/__init__.py,sha256=iS-wwmRfbPdWghqOXeC6XcC6YfHanE9cjFh8vEn1x7U,14882 +torch/_refs/linalg/__pycache__/__init__.cpython-312.pyc,, +torch/_refs/nn/__init__.py,sha256=PFr_V0xYQhWjKk5oc83cYg_JcNZ2FEKTsjXlnxmkyB8,25 +torch/_refs/nn/__pycache__/__init__.cpython-312.pyc,, +torch/_refs/nn/functional/__init__.py,sha256=9zQiWGLkdkdky-wR5KH8xePull0R78gQXt-j7bgOw20,44022 +torch/_refs/nn/functional/__pycache__/__init__.cpython-312.pyc,, +torch/_refs/special/__init__.py,sha256=CQcDFMKX2MMt2mqDfxPFsQv2JXW59y-8JVLo2sXCt0U,7154 +torch/_refs/special/__pycache__/__init__.cpython-312.pyc,, +torch/_size_docs.py,sha256=kcS1-bU8H8PCfDkENNH8YFOgfXkUXfsHt3f1z2JJvC8,939 +torch/_sources.py,sha256=zSbS_HPJhxdlZg4JLGrvdOWJDWfPp4iRMyd5pAWRoSM,4542 +torch/_storage_docs.py,sha256=LQgAJq6wRYycwEY6_POp0HhW7bkOyjZ26Aw3GaGVN4s,1377 +torch/_streambase.py,sha256=DwofDa9lCG6iGzBIQ4Yzam08Jeua98daSS_bidnYedM,455 +torch/_strobelight/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_strobelight/__pycache__/__init__.cpython-312.pyc,, +torch/_strobelight/__pycache__/cli_function_profiler.cpython-312.pyc,, +torch/_strobelight/__pycache__/compile_time_profiler.cpython-312.pyc,, +torch/_strobelight/cli_function_profiler.py,sha256=IDbR5DwOPVHkWLdarpV_m1YvGjJeleCo6MWuF7zDckI,12141 +torch/_strobelight/compile_time_profiler.py,sha256=UmZZDCRIBK48-bGCaTTcMs1qSG78rK35e-w2DtN6M6k,7789 +torch/_subclasses/__init__.py,sha256=nDR4CWhmJQdYQVYeY7KcoJn7nrLG7cAfAehXh3MOcWQ,392 +torch/_subclasses/__pycache__/__init__.cpython-312.pyc,, +torch/_subclasses/__pycache__/_fake_tensor_utils.cpython-312.pyc,, +torch/_subclasses/__pycache__/fake_impls.cpython-312.pyc,, +torch/_subclasses/__pycache__/fake_tensor.cpython-312.pyc,, +torch/_subclasses/__pycache__/fake_utils.cpython-312.pyc,, +torch/_subclasses/__pycache__/functional_tensor.cpython-312.pyc,, +torch/_subclasses/__pycache__/meta_utils.cpython-312.pyc,, +torch/_subclasses/__pycache__/schema_check_mode.cpython-312.pyc,, +torch/_subclasses/_fake_tensor_utils.py,sha256=7hoAb8fyQwPDcFIY0cgk1tNSQwAfBSSmpTMnj3GVSJU,9121 +torch/_subclasses/complex_tensor/__init__.py,sha256=G1Vkaq5G5VJTc8hAagkveZ_rg4Moo72VvF3ayJkM5b4,286 +torch/_subclasses/complex_tensor/__pycache__/__init__.cpython-312.pyc,, +torch/_subclasses/complex_tensor/__pycache__/_core.cpython-312.pyc,, +torch/_subclasses/complex_tensor/_core.py,sha256=gfe5YSvmlppdsRKZuJjyvQ6JsyMSLz7MqBp9mlekIxI,5225 +torch/_subclasses/complex_tensor/_ops/__init__.py,sha256=ee24NvksPUTSCGqoyRCMZtKzQGaJBIqSHaP1tcBJ48c,160 +torch/_subclasses/complex_tensor/_ops/__pycache__/__init__.cpython-312.pyc,, +torch/_subclasses/complex_tensor/_ops/__pycache__/aten.cpython-312.pyc,, +torch/_subclasses/complex_tensor/_ops/__pycache__/common.cpython-312.pyc,, +torch/_subclasses/complex_tensor/_ops/__pycache__/prims.cpython-312.pyc,, +torch/_subclasses/complex_tensor/_ops/aten.py,sha256=jU7NSl7K473WA8wPIdDuJ8IfDMRKNaQXWg5-vB_ETqc,29415 +torch/_subclasses/complex_tensor/_ops/common.py,sha256=fVW9LQTnZfvhIlL_TiFLPRHlfMVh1mIInTc3UNwDwpk,9917 +torch/_subclasses/complex_tensor/_ops/prims.py,sha256=dEDhldop5sGWK7XykInssGM8F7lWrUJiD8pemjtN8TA,898 +torch/_subclasses/fake_impls.py,sha256=ERop6yJIk_UOaN_fSYqjWgljIAh0X74UbkQmLdPje3M,50483 +torch/_subclasses/fake_tensor.py,sha256=wSN7DejaPKKRDgNSTkCHgDzH3kpTngSaScnzTUkx3kM,139588 +torch/_subclasses/fake_utils.py,sha256=hvZaR2tifdzAdKbehrwtVYscdauW2QUvtg6KuTYxdYs,10616 +torch/_subclasses/functional_tensor.py,sha256=nSzt80eyAip8zB5KN-D18gMtu-dGwy8msCBpnVH6b6U,38743 +torch/_subclasses/meta_utils.py,sha256=f7sqd7vszVaN2R0pv5yAzMihxn7DAxY7sa36kjKbcfY,90824 +torch/_subclasses/schema_check_mode.py,sha256=jd0eN2LHgn65tV9kNFulyaDTZuUMlIK0vRQaCO8mhFM,8869 +torch/_tensor.py,sha256=HMFkF93M4kd5nf7OZPjF1UGYcs6Hu9Kp90oRsUgMO50,78174 +torch/_tensor_docs.py,sha256=AIFzTmYUPetJPpPj0QVzudgnyxYQIXeZzpATD9uQdaw,152261 +torch/_tensor_str.py,sha256=54GS7icHl9tw-_jbKiQVAFXQ_FXrcCZKFgHqaD7B2BQ,29111 +torch/_thread_safe_fork.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_torch_docs.py,sha256=qkAhiGme7FxMwm99-7JPMp64wC_DrnqIXXgr0Z7iT4c,450000 +torch/_utils.py,sha256=ipq4XBr7NxDMj7EoTqKIha4EiviQ2rZcxW6oiCeIQQA,41959 +torch/_utils_internal.py,sha256=NEcClUMukYaxV4_61q1PbL1kcYoY2KBzDDkpfD3T2Y0,11932 +torch/_vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/_vendor/__pycache__/__init__.cpython-312.pyc,, +torch/_vendor/packaging/__init__.py,sha256=tBMEyxhq3EEEWx2ildaGANR5SCtuuItz0Lbo217LOrg,511 +torch/_vendor/packaging/__pycache__/__init__.cpython-312.pyc,, +torch/_vendor/packaging/__pycache__/_structures.cpython-312.pyc,, +torch/_vendor/packaging/__pycache__/version.cpython-312.pyc,, +torch/_vendor/packaging/_structures.py,sha256=qrorE2MfdfAdF4JqdKD-aLgIo3sRECalhpljE8Accxs,1492 +torch/_vendor/packaging/version.py,sha256=o2agHbS_rqKFYhH6qABjDxZFyKWASNKtAWZ0KXHsjvU,16799 +torch/_vmap_internals.py,sha256=RCjjFeHo5hRFHCdl9SgOPPSu8X4IuWp0lHVBu9erPFs,9671 +torch/_weights_only_unpickler.py,sha256=FAte6J8s-hMdvR1Rd05vMKgvpCa6nlc0f-0pLfaM1Ac,23472 +torch/accelerator/__init__.py,sha256=Nx_dj9tUp53QUUgzjqxX26sSOC6oIWqKKeK0FJDg8g0,11075 +torch/accelerator/__pycache__/__init__.cpython-312.pyc,, +torch/accelerator/__pycache__/_utils.cpython-312.pyc,, +torch/accelerator/__pycache__/memory.cpython-312.pyc,, +torch/accelerator/_utils.py,sha256=fDa5otGBqOfEX2U8x9aWYRQ2IU5HT4Ohg-NI1Fbkt6k,962 +torch/accelerator/memory.py,sha256=bo52K-siKgjaTioCxnKKVSur9i9384k-ttkFlLi0EwI,10730 +torch/amp/__init__.py,sha256=Uc1hDB3zzt2r2cyu6mgC-cFsV2erFWz5r2QOKU-yj7Q,190 +torch/amp/__pycache__/__init__.cpython-312.pyc,, +torch/amp/__pycache__/autocast_mode.cpython-312.pyc,, +torch/amp/__pycache__/grad_scaler.cpython-312.pyc,, +torch/amp/autocast_mode.py,sha256=tvUfcyNZyJ2JesBI5vSOllYfVHMI-HcLIsXTH6Vvayo,22434 +torch/amp/grad_scaler.py,sha256=VGBKbGNDTMFpvX2TjQs5q4lrGJu8889Jb07TgG5OEUo,31336 +torch/ao/__init__.py,sha256=BbFZLUQMOMzkKhsZ4-FhIGI_H3qyIjk4bflnCywfVxg,709 +torch/ao/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/__init__.py,sha256=g8uojNaWxOlXL20t1NrgkQ47A2YsSAK0RvjMogId2yA,869 +torch/ao/nn/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/intrinsic/__init__.py,sha256=VXw8ou3oEwbDkW1gNIZpayC5krlSwooV8QQkkQ1ATxo,1002 +torch/ao/nn/intrinsic/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/intrinsic/modules/__init__.py,sha256=TNOnhADW9Hj5TJmt_GwRWlkcFyRQT9P0bmRIwcutkag,696 +torch/ao/nn/intrinsic/modules/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/intrinsic/modules/__pycache__/fused.cpython-312.pyc,, +torch/ao/nn/intrinsic/modules/fused.py,sha256=KvZKV321xnBV3h-lfcvYrIwaoHF5MRdMTPypnnQKLMc,10757 +torch/ao/nn/intrinsic/qat/__init__.py,sha256=sE-0qvXnTY5ilDKux2jZukNxzkeR-G2mlBp5ss2b4yk,38 +torch/ao/nn/intrinsic/qat/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/intrinsic/qat/modules/__init__.py,sha256=0ZwViGqdx6f0QYppptRbGOtCkl-E1tGcXJYqvkwjQkM,579 +torch/ao/nn/intrinsic/qat/modules/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/intrinsic/qat/modules/__pycache__/conv_fused.cpython-312.pyc,, +torch/ao/nn/intrinsic/qat/modules/__pycache__/linear_fused.cpython-312.pyc,, +torch/ao/nn/intrinsic/qat/modules/__pycache__/linear_relu.cpython-312.pyc,, +torch/ao/nn/intrinsic/qat/modules/conv_fused.py,sha256=GeE_WT981fXmPRArglBIaxu9FlxATKVf-kfK8E5lf_c,32236 +torch/ao/nn/intrinsic/qat/modules/linear_fused.py,sha256=85r_TTu3CzSeT6wGx154LihfRDYXFNgjJk6Yow5SAWI,6760 +torch/ao/nn/intrinsic/qat/modules/linear_relu.py,sha256=wjPAOI6U0-gAySxYwWLifNPBIw-5BNLFUSWuqDRqZpk,2258 +torch/ao/nn/intrinsic/quantized/__init__.py,sha256=QyW1Bo9d_YpVgKKEz_0XCK_vDpzGzr3cRCr6VFThD_g,251 +torch/ao/nn/intrinsic/quantized/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/intrinsic/quantized/dynamic/__init__.py,sha256=sE-0qvXnTY5ilDKux2jZukNxzkeR-G2mlBp5ss2b4yk,38 +torch/ao/nn/intrinsic/quantized/dynamic/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/intrinsic/quantized/dynamic/modules/__init__.py,sha256=YS0r9fkbJU20FDakDuLmzDJrWZXL-fB2wC3c5AOzDp8,76 +torch/ao/nn/intrinsic/quantized/dynamic/modules/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/intrinsic/quantized/dynamic/modules/__pycache__/linear_relu.cpython-312.pyc,, +torch/ao/nn/intrinsic/quantized/dynamic/modules/linear_relu.py,sha256=e19wx3USBgiXNbRmsm1GQjivTavtR_xvVirLXe426nc,2295 +torch/ao/nn/intrinsic/quantized/modules/__init__.py,sha256=f6fu2CJkehRe7TovtjS-4asgjmz8O4LUhBlNKW5sPAU,427 +torch/ao/nn/intrinsic/quantized/modules/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/intrinsic/quantized/modules/__pycache__/bn_relu.cpython-312.pyc,, +torch/ao/nn/intrinsic/quantized/modules/__pycache__/conv_add.cpython-312.pyc,, +torch/ao/nn/intrinsic/quantized/modules/__pycache__/conv_relu.cpython-312.pyc,, +torch/ao/nn/intrinsic/quantized/modules/__pycache__/linear_relu.cpython-312.pyc,, +torch/ao/nn/intrinsic/quantized/modules/bn_relu.py,sha256=z-s14yqPQikqVmJhy8AxMn9YDLpsLaGYmaD6kZgeWnI,3760 +torch/ao/nn/intrinsic/quantized/modules/conv_add.py,sha256=msOu_7QK4QlOoS8uuHuhad3nwbEMIhks5IKNwYI4vOc,4974 +torch/ao/nn/intrinsic/quantized/modules/conv_relu.py,sha256=IT1txXE-ecUfAxWKGOPRV1PVReHeGQi_FLPQ2R-nMjk,9347 +torch/ao/nn/intrinsic/quantized/modules/linear_relu.py,sha256=oL63RMLmtvLqIfXE8M9e7RcqPtIhz6xMvBzlsTovqY0,7074 +torch/ao/nn/qat/__init__.py,sha256=sE-0qvXnTY5ilDKux2jZukNxzkeR-G2mlBp5ss2b4yk,38 +torch/ao/nn/qat/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/qat/dynamic/__init__.py,sha256=sE-0qvXnTY5ilDKux2jZukNxzkeR-G2mlBp5ss2b4yk,38 +torch/ao/nn/qat/dynamic/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/qat/dynamic/modules/__init__.py,sha256=h_S3dv05DjPYXtDjuRqkzrGoE6aeaPOjE1oKRfO9Bq8,54 +torch/ao/nn/qat/dynamic/modules/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/qat/dynamic/modules/__pycache__/linear.cpython-312.pyc,, +torch/ao/nn/qat/dynamic/modules/linear.py,sha256=0r9nJWK3ceuS3vD25fpVO_RvXPkdQyusA262GgjkDTc,1255 +torch/ao/nn/qat/modules/__init__.py,sha256=kSrrX2n3rqdHWMMphT8j0lxEch9YVFQOM9FTRDJhf7c,241 +torch/ao/nn/qat/modules/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/qat/modules/__pycache__/conv.cpython-312.pyc,, +torch/ao/nn/qat/modules/__pycache__/embedding_ops.cpython-312.pyc,, +torch/ao/nn/qat/modules/__pycache__/linear.cpython-312.pyc,, +torch/ao/nn/qat/modules/conv.py,sha256=q_TStS1316_s8HEfEeW8dhGLyUoXQG9gqQoJ-_8l8k4,10113 +torch/ao/nn/qat/modules/embedding_ops.py,sha256=_ObdW70dQiMnApYT1j9nxXkg3Ci9sLqKG1JwTxNp82M,8118 +torch/ao/nn/qat/modules/linear.py,sha256=hm7Wpx6kyKaQV79xWcXQAeSGVHYJQVRgW_qzA0NGP-I,3148 +torch/ao/nn/quantizable/__init__.py,sha256=sE-0qvXnTY5ilDKux2jZukNxzkeR-G2mlBp5ss2b4yk,38 +torch/ao/nn/quantizable/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/quantizable/modules/__init__.py,sha256=Cn3Ltv6d1JfKe7aV4GeTxQKkLfT2z5xLI-Jk1Sl938g,154 +torch/ao/nn/quantizable/modules/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/quantizable/modules/__pycache__/activation.cpython-312.pyc,, +torch/ao/nn/quantizable/modules/__pycache__/rnn.cpython-312.pyc,, +torch/ao/nn/quantizable/modules/activation.py,sha256=BmoMbcZ7KuqTYJDekyni8oMlNE3_QPVGP_guKhoUVD0,24865 +torch/ao/nn/quantizable/modules/rnn.py,sha256=1zVVWV9kO9qe9sdviG9XZ-t9Sq7EgKW9u-frPcEGfWk,22430 +torch/ao/nn/quantized/__init__.py,sha256=rufZDT8E2pU6Y_RJUA9VnLIJ7-zHTR0wGyzghMKDFPY,725 +torch/ao/nn/quantized/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/quantized/__pycache__/functional.cpython-312.pyc,, +torch/ao/nn/quantized/dynamic/__init__.py,sha256=sE-0qvXnTY5ilDKux2jZukNxzkeR-G2mlBp5ss2b4yk,38 +torch/ao/nn/quantized/dynamic/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/quantized/dynamic/modules/__init__.py,sha256=5gD6fcxxz2UnPlOKoCLOHU3aa5zW60RpXDDeOECBpAc,439 +torch/ao/nn/quantized/dynamic/modules/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/quantized/dynamic/modules/__pycache__/conv.cpython-312.pyc,, +torch/ao/nn/quantized/dynamic/modules/__pycache__/linear.cpython-312.pyc,, +torch/ao/nn/quantized/dynamic/modules/__pycache__/rnn.cpython-312.pyc,, +torch/ao/nn/quantized/dynamic/modules/conv.py,sha256=lUJ2a5tfpAMpvA7QQDTlacQ5GAJ9ty7MIlOIkVMKgM0,18955 +torch/ao/nn/quantized/dynamic/modules/linear.py,sha256=XRC7f_OVGphrBbhouJ21Dba1yzNqdHnMLFosgH9bnIM,6655 +torch/ao/nn/quantized/dynamic/modules/rnn.py,sha256=oUwrjhdXDwNuRHbSksBta6iyIRpBLFtTpVbtV0P5qPI,52819 +torch/ao/nn/quantized/functional.py,sha256=gR9PtqLcI5N86Ho6j7Eg0Rk8wOYFyol-Sub8VSWEM98,30396 +torch/ao/nn/quantized/modules/__init__.py,sha256=d7APn7TPLFlbJLMXxlGnTyqVZq9IGSch04idikjF_08,4683 +torch/ao/nn/quantized/modules/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/quantized/modules/__pycache__/activation.cpython-312.pyc,, +torch/ao/nn/quantized/modules/__pycache__/batchnorm.cpython-312.pyc,, +torch/ao/nn/quantized/modules/__pycache__/conv.cpython-312.pyc,, +torch/ao/nn/quantized/modules/__pycache__/dropout.cpython-312.pyc,, +torch/ao/nn/quantized/modules/__pycache__/embedding_ops.cpython-312.pyc,, +torch/ao/nn/quantized/modules/__pycache__/functional_modules.cpython-312.pyc,, +torch/ao/nn/quantized/modules/__pycache__/linear.cpython-312.pyc,, +torch/ao/nn/quantized/modules/__pycache__/normalization.cpython-312.pyc,, +torch/ao/nn/quantized/modules/__pycache__/rnn.cpython-312.pyc,, +torch/ao/nn/quantized/modules/__pycache__/utils.cpython-312.pyc,, +torch/ao/nn/quantized/modules/activation.py,sha256=Z8dEfKT_uviKEOgclZWCGKwYLrP9yOyZJe1QVC6eSY4,12242 +torch/ao/nn/quantized/modules/batchnorm.py,sha256=S85ho3fjbqjo728hPT5XyZXrUHMfTYXDPUKqxjuC--4,4649 +torch/ao/nn/quantized/modules/conv.py,sha256=g-2g3bVo4MVweKitKS-gvnktkxe8LkDfGUoLR_43nZY,44759 +torch/ao/nn/quantized/modules/dropout.py,sha256=7EWdajteiitQbayVUtYQDAs_xCZCPp_kfh7l2GOvIyg,836 +torch/ao/nn/quantized/modules/embedding_ops.py,sha256=aLe8JwdVCecK0TdfwMktDXNxzK00SZ-ExcW0DJHxjdU,15089 +torch/ao/nn/quantized/modules/functional_modules.py,sha256=mXv2SS6h6ZTzTCXNd5Ri-sa8A0OMROTSFWp8L2jizUI,9520 +torch/ao/nn/quantized/modules/linear.py,sha256=YTf3ol6e78MVXw1o3nDuLx2aEaEFqr6tfqQPi9Vr6NM,13973 +torch/ao/nn/quantized/modules/normalization.py,sha256=jACv52Irv7ZIQ-PxO2wOs2PWN42UIq2lkeXh_oF1ipQ,10407 +torch/ao/nn/quantized/modules/rnn.py,sha256=wUrQEr--NULxcyHWex1Y-9mReLo0ZT4eOwAFgvT-mXw,1957 +torch/ao/nn/quantized/modules/utils.py,sha256=I7M9LPrfLTmYxY99_sK9z6fvbhG7NAIXjNsFcTRSygQ,4837 +torch/ao/nn/quantized/reference/__init__.py,sha256=uy5ftWsvDX4VkLX2C2wbtYF_sokM3UiC3PM5wwMcx4A,303 +torch/ao/nn/quantized/reference/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/quantized/reference/modules/__init__.py,sha256=8RHzSWvt67OBacAuyMPhZmpGHGm8GCe2TClxkq8BttM,523 +torch/ao/nn/quantized/reference/modules/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/quantized/reference/modules/__pycache__/conv.cpython-312.pyc,, +torch/ao/nn/quantized/reference/modules/__pycache__/linear.cpython-312.pyc,, +torch/ao/nn/quantized/reference/modules/__pycache__/rnn.cpython-312.pyc,, +torch/ao/nn/quantized/reference/modules/__pycache__/sparse.cpython-312.pyc,, +torch/ao/nn/quantized/reference/modules/__pycache__/utils.cpython-312.pyc,, +torch/ao/nn/quantized/reference/modules/conv.py,sha256=1Osq7ulb7q4EsqIwpMBqLSM9Ah8FxghVqjrJFpcOtbE,16190 +torch/ao/nn/quantized/reference/modules/linear.py,sha256=7B_Cai_epr6woNqiBQ9_vPpGd4yBtskEG2PMSgUEl1w,2323 +torch/ao/nn/quantized/reference/modules/rnn.py,sha256=mdpG8W2ghAoO16Y-IBUUHdWCiX9OCdWL5flU05JCsAQ,30709 +torch/ao/nn/quantized/reference/modules/sparse.py,sha256=N3yvBioPAAMatvn1GsdsOhJOI9TF1wIh6ZzhUiFB6Zs,4846 +torch/ao/nn/quantized/reference/modules/utils.py,sha256=ZM14EyXdiPmLQGZ39R4xPMVHyJcHEoGrX3t9RSr0z3I,16106 +torch/ao/nn/sparse/__init__.py,sha256=Lfoo4m9ZnVOja2YLfZa9jrz54iMOMhHzCg7RYcP5FLk,25 +torch/ao/nn/sparse/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/sparse/quantized/__init__.py,sha256=SEINwKuRz86NuFHzdWv4BowgnhoNv0qFpluJfm2nncQ,178 +torch/ao/nn/sparse/quantized/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/sparse/quantized/__pycache__/linear.cpython-312.pyc,, +torch/ao/nn/sparse/quantized/__pycache__/utils.cpython-312.pyc,, +torch/ao/nn/sparse/quantized/dynamic/__init__.py,sha256=fDXnm6MNQ02dzp2hv56Tg3fmTjnf2saSRH5ZBvPYafM,63 +torch/ao/nn/sparse/quantized/dynamic/__pycache__/__init__.cpython-312.pyc,, +torch/ao/nn/sparse/quantized/dynamic/__pycache__/linear.cpython-312.pyc,, +torch/ao/nn/sparse/quantized/dynamic/linear.py,sha256=h4qqPgpAhqRATveWaHayfnWF0mn5_9LySZ5Kwr-qm5I,6619 +torch/ao/nn/sparse/quantized/linear.py,sha256=_waG81-fCTDGrhwILqixFtVNQ8Ni1Qx3W6qFrt5Q3YQ,9245 +torch/ao/nn/sparse/quantized/utils.py,sha256=6RygJvjCk-vuxipAeWl6XAamo1YEUtclqewWtqiSO7o,2106 +torch/ao/ns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/ao/ns/__pycache__/__init__.cpython-312.pyc,, +torch/ao/ns/__pycache__/_numeric_suite.cpython-312.pyc,, +torch/ao/ns/__pycache__/_numeric_suite_fx.cpython-312.pyc,, +torch/ao/ns/_numeric_suite.py,sha256=eC-uegxzcGS1pl4yP_REiOTb3Q2drenkoWfWtslh7aM,20633 +torch/ao/ns/_numeric_suite_fx.py,sha256=felWA07npRLEJCAeslTmD041z7kC-K_xo7eWR2Zkei0,42511 +torch/ao/ns/fx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/ao/ns/fx/__pycache__/__init__.cpython-312.pyc,, +torch/ao/ns/fx/__pycache__/graph_matcher.cpython-312.pyc,, +torch/ao/ns/fx/__pycache__/graph_passes.cpython-312.pyc,, +torch/ao/ns/fx/__pycache__/mappings.cpython-312.pyc,, +torch/ao/ns/fx/__pycache__/n_shadows_utils.cpython-312.pyc,, +torch/ao/ns/fx/__pycache__/ns_types.cpython-312.pyc,, +torch/ao/ns/fx/__pycache__/pattern_utils.cpython-312.pyc,, +torch/ao/ns/fx/__pycache__/qconfig_multi_mapping.cpython-312.pyc,, +torch/ao/ns/fx/__pycache__/utils.cpython-312.pyc,, +torch/ao/ns/fx/__pycache__/weight_utils.cpython-312.pyc,, +torch/ao/ns/fx/graph_matcher.py,sha256=Oyib2pMcfdt81Kku-_7bNTgM_z0R71DULO5VnPianLk,20486 +torch/ao/ns/fx/graph_passes.py,sha256=IziJi_DfczGYKTnGxuvR9s5dZIHyTkTBvYntS1uQDbo,46894 +torch/ao/ns/fx/mappings.py,sha256=uDphIxxy90qMPFUIEGFs_XBrOauoD8fobADcv0cRPOg,19209 +torch/ao/ns/fx/n_shadows_utils.py,sha256=ma96EaadQTbjv4imdCqrl5iGkJ7yrAY0Azt1yZqTA9U,54773 +torch/ao/ns/fx/ns_types.py,sha256=R7hMHOVugTpAkEWhed_D2hFkO65aeda0B4BWH7NZD-c,2420 +torch/ao/ns/fx/pattern_utils.py,sha256=52eM88KLjvOcjLaROmet0JDR3syKcw7UMPe1SoWHqf0,8834 +torch/ao/ns/fx/qconfig_multi_mapping.py,sha256=jOa0dnHNMpwC806p6p3NDHhmZULA6PRx-lncsJXW8_k,10448 +torch/ao/ns/fx/utils.py,sha256=q5a46YWghyarYFRhYfBBrTJlRwWo688LlX6SivdF01k,23385 +torch/ao/ns/fx/weight_utils.py,sha256=XLsqeL04flwQLwqIdJRZR9j9BXH0z0ceCkHTDmRBIto,13088 +torch/ao/pruning/__init__.py,sha256=buSUvIIoEdoVoBKVgjMHw6Tz52akY935O7_j9WCa034,663 +torch/ao/pruning/__pycache__/__init__.cpython-312.pyc,, +torch/ao/pruning/__pycache__/_mappings.cpython-312.pyc,, +torch/ao/pruning/_experimental/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/ao/pruning/_experimental/__pycache__/__init__.cpython-312.pyc,, +torch/ao/pruning/_experimental/activation_sparsifier/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/ao/pruning/_experimental/activation_sparsifier/__pycache__/__init__.cpython-312.pyc,, +torch/ao/pruning/_experimental/activation_sparsifier/__pycache__/activation_sparsifier.cpython-312.pyc,, +torch/ao/pruning/_experimental/activation_sparsifier/activation_sparsifier.py,sha256=bOO_yItR10GqqsHlkxtx5EyntQ0exTMnpHF3jRzICaU,19791 +torch/ao/pruning/_experimental/data_scheduler/__init__.py,sha256=JZ8rO6gG9c8OxZ1COfSCl6viLVoj2hKjkrxaHcmIlWA,98 +torch/ao/pruning/_experimental/data_scheduler/__pycache__/__init__.cpython-312.pyc,, +torch/ao/pruning/_experimental/data_scheduler/__pycache__/base_data_scheduler.cpython-312.pyc,, +torch/ao/pruning/_experimental/data_scheduler/base_data_scheduler.py,sha256=tOTlS_EUaxY5OrmBeUxN5PVmFoKOVLO8VITTgMTr-no,7932 +torch/ao/pruning/_experimental/data_sparsifier/__init__.py,sha256=XFtc3q0kNE1_DoO59bcPIm79KMkblr0AkKzrIMw_J3s,182 +torch/ao/pruning/_experimental/data_sparsifier/__pycache__/__init__.cpython-312.pyc,, +torch/ao/pruning/_experimental/data_sparsifier/__pycache__/base_data_sparsifier.cpython-312.pyc,, +torch/ao/pruning/_experimental/data_sparsifier/__pycache__/data_norm_sparsifier.cpython-312.pyc,, +torch/ao/pruning/_experimental/data_sparsifier/__pycache__/quantization_utils.cpython-312.pyc,, +torch/ao/pruning/_experimental/data_sparsifier/base_data_sparsifier.py,sha256=7rmzk60o4Q6grDvwPn-2OGCRkGGUQ8z8XP0dC7tgRV0,13886 +torch/ao/pruning/_experimental/data_sparsifier/data_norm_sparsifier.py,sha256=oDalm0QV_Y7la8LUF_MoKvHbQyK6ojFoRdSwVZOGiKc,7982 +torch/ao/pruning/_experimental/data_sparsifier/lightning/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/ao/pruning/_experimental/data_sparsifier/lightning/__pycache__/__init__.cpython-312.pyc,, +torch/ao/pruning/_experimental/data_sparsifier/lightning/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/ao/pruning/_experimental/data_sparsifier/lightning/callbacks/__pycache__/__init__.cpython-312.pyc,, +torch/ao/pruning/_experimental/data_sparsifier/lightning/callbacks/__pycache__/_data_sparstity_utils.cpython-312.pyc,, +torch/ao/pruning/_experimental/data_sparsifier/lightning/callbacks/__pycache__/data_sparsity.cpython-312.pyc,, +torch/ao/pruning/_experimental/data_sparsifier/lightning/callbacks/_data_sparstity_utils.py,sha256=oDL0SX3pzCs7EkZDklLYWSPwNZFA33Frc19532lQ7IA,1680 +torch/ao/pruning/_experimental/data_sparsifier/lightning/callbacks/data_sparsity.py,sha256=tXXwY61wbh_6_Hpf8B8DvZnHzogoyTHDLdPqVgz8st8,6776 +torch/ao/pruning/_experimental/data_sparsifier/quantization_utils.py,sha256=mfxvkL64_YYDek3Jemkm6JZOxT3gtvrWNbnhNqN05MY,6261 +torch/ao/pruning/_experimental/pruner/FPGM_pruner.py,sha256=ZEJAvP7xfOrl19KRwqvgs6IFBcouO6droRZd7aeSjWE,3567 +torch/ao/pruning/_experimental/pruner/__init__.py,sha256=B5dNGoaxQpyxLwzg-Ej7-UT3PZdJg4V4-58ZLqQCWTQ,265 +torch/ao/pruning/_experimental/pruner/__pycache__/FPGM_pruner.cpython-312.pyc,, +torch/ao/pruning/_experimental/pruner/__pycache__/__init__.cpython-312.pyc,, +torch/ao/pruning/_experimental/pruner/__pycache__/base_structured_sparsifier.cpython-312.pyc,, +torch/ao/pruning/_experimental/pruner/__pycache__/lstm_saliency_pruner.cpython-312.pyc,, +torch/ao/pruning/_experimental/pruner/__pycache__/match_utils.cpython-312.pyc,, +torch/ao/pruning/_experimental/pruner/__pycache__/parametrization.cpython-312.pyc,, +torch/ao/pruning/_experimental/pruner/__pycache__/prune_functions.cpython-312.pyc,, +torch/ao/pruning/_experimental/pruner/__pycache__/saliency_pruner.cpython-312.pyc,, +torch/ao/pruning/_experimental/pruner/base_structured_sparsifier.py,sha256=Xhn4Vi5t2wnXj4ymHlztlYNBeg6g54mi075_YyAAJiw,11285 +torch/ao/pruning/_experimental/pruner/lstm_saliency_pruner.py,sha256=nnBibpUJL6mBE4HvCeWfpkbsHiRFSf5XvAsap6gqLOk,2251 +torch/ao/pruning/_experimental/pruner/match_utils.py,sha256=hu4GQQkRghvBugmU8qczRlk7ql7yM0OSQ_MyDL4oabk,2014 +torch/ao/pruning/_experimental/pruner/parametrization.py,sha256=iiTLjytWYRcuyWjSt56vtENJR_mfKWYjwFJcGd5ienU,2110 +torch/ao/pruning/_experimental/pruner/prune_functions.py,sha256=F3XvtKuRmzNgAMsAC7Ml0vKg0lUUx2kOq7AVr0JUSbA,19770 +torch/ao/pruning/_experimental/pruner/saliency_pruner.py,sha256=gwKPYA4mA5itAMDkiWWIPBKNkDFltZDRS1XzPla_TLw,1571 +torch/ao/pruning/_mappings.py,sha256=QyqsbrIsTq-gkHBuk2Y0iAIaA2UnY4DIvUo4bTW2d0I,620 +torch/ao/pruning/scheduler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/ao/pruning/scheduler/__pycache__/__init__.cpython-312.pyc,, +torch/ao/pruning/scheduler/__pycache__/base_scheduler.cpython-312.pyc,, +torch/ao/pruning/scheduler/__pycache__/cubic_scheduler.cpython-312.pyc,, +torch/ao/pruning/scheduler/__pycache__/lambda_scheduler.cpython-312.pyc,, +torch/ao/pruning/scheduler/base_scheduler.py,sha256=I9o9xyjYsRtIvvcMYdUGANFXUuRpJ03GZw_IqVfFjcc,6798 +torch/ao/pruning/scheduler/cubic_scheduler.py,sha256=UO6XSzCcDuCiqORyohiEM8vn0HhpHGnHwrkGcUGhS7w,3989 +torch/ao/pruning/scheduler/lambda_scheduler.py,sha256=fuOabzTVUuO-_dhgFdapQqVWUXTtzgCUhQYbSFrCZMU,2480 +torch/ao/pruning/sparsifier/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/ao/pruning/sparsifier/__pycache__/__init__.cpython-312.pyc,, +torch/ao/pruning/sparsifier/__pycache__/base_sparsifier.cpython-312.pyc,, +torch/ao/pruning/sparsifier/__pycache__/nearly_diagonal_sparsifier.cpython-312.pyc,, +torch/ao/pruning/sparsifier/__pycache__/utils.cpython-312.pyc,, +torch/ao/pruning/sparsifier/__pycache__/weight_norm_sparsifier.cpython-312.pyc,, +torch/ao/pruning/sparsifier/base_sparsifier.py,sha256=MnfXyzNb36xOPkoc-X5LXAlrgTNFbbRkMgVrMGK5tM0,14361 +torch/ao/pruning/sparsifier/nearly_diagonal_sparsifier.py,sha256=XmLvwDEfjRx2r10mUu2iUtbbRVcfU-yGy0PyZwh57Oc,2323 +torch/ao/pruning/sparsifier/utils.py,sha256=l5eDjfc2dd5wnrUW48agzQXVzECShZU7pYq4R9Y1Qhw,5138 +torch/ao/pruning/sparsifier/weight_norm_sparsifier.py,sha256=6CTEZ1qPuuKBThOTBu6dCQ3JylimIb42EOrGmB3zNoc,9655 +torch/ao/quantization/__init__.py,sha256=rzHpg6RMGUF_OxjWRMIHBcyGYp3Vf9fDr47PvH0Si4E,7860 +torch/ao/quantization/__pycache__/__init__.cpython-312.pyc,, +torch/ao/quantization/__pycache__/_correct_bias.cpython-312.pyc,, +torch/ao/quantization/__pycache__/_equalize.cpython-312.pyc,, +torch/ao/quantization/__pycache__/_learnable_fake_quantize.cpython-312.pyc,, +torch/ao/quantization/__pycache__/fake_quantize.cpython-312.pyc,, +torch/ao/quantization/__pycache__/fuse_modules.cpython-312.pyc,, +torch/ao/quantization/__pycache__/fuser_method_mappings.cpython-312.pyc,, +torch/ao/quantization/__pycache__/observer.cpython-312.pyc,, +torch/ao/quantization/__pycache__/qconfig.cpython-312.pyc,, +torch/ao/quantization/__pycache__/qconfig_mapping.cpython-312.pyc,, +torch/ao/quantization/__pycache__/quant_type.cpython-312.pyc,, +torch/ao/quantization/__pycache__/quantization_mappings.cpython-312.pyc,, +torch/ao/quantization/__pycache__/quantize.cpython-312.pyc,, +torch/ao/quantization/__pycache__/quantize_fx.cpython-312.pyc,, +torch/ao/quantization/__pycache__/quantize_jit.cpython-312.pyc,, +torch/ao/quantization/__pycache__/quantize_pt2e.cpython-312.pyc,, +torch/ao/quantization/__pycache__/stubs.cpython-312.pyc,, +torch/ao/quantization/__pycache__/utils.cpython-312.pyc,, +torch/ao/quantization/_correct_bias.py,sha256=-pWH8oPm5dG-3e99tlvUljPGcOPRCcuQ_F3NuembjMk,5571 +torch/ao/quantization/_equalize.py,sha256=VfDB9D6dEab3D7cbmwUak11k7ptibKxo06aGjSGFy1o,9772 +torch/ao/quantization/_learnable_fake_quantize.py,sha256=uO30okz12yxUmeHawYBg8G-DuFMbNESwnhWCLCPnA04,8158 +torch/ao/quantization/backend_config/__init__.py,sha256=4Y8ISKDtMW_f2GA6qOE-K4fo09GAclfC3RPo3bpxNJk,945 +torch/ao/quantization/backend_config/__pycache__/__init__.cpython-312.pyc,, +torch/ao/quantization/backend_config/__pycache__/_common_operator_config_utils.cpython-312.pyc,, +torch/ao/quantization/backend_config/__pycache__/_qnnpack_pt2e.cpython-312.pyc,, +torch/ao/quantization/backend_config/__pycache__/backend_config.cpython-312.pyc,, +torch/ao/quantization/backend_config/__pycache__/executorch.cpython-312.pyc,, +torch/ao/quantization/backend_config/__pycache__/fbgemm.cpython-312.pyc,, +torch/ao/quantization/backend_config/__pycache__/native.cpython-312.pyc,, +torch/ao/quantization/backend_config/__pycache__/onednn.cpython-312.pyc,, +torch/ao/quantization/backend_config/__pycache__/qnnpack.cpython-312.pyc,, +torch/ao/quantization/backend_config/__pycache__/tensorrt.cpython-312.pyc,, +torch/ao/quantization/backend_config/__pycache__/utils.cpython-312.pyc,, +torch/ao/quantization/backend_config/__pycache__/x86.cpython-312.pyc,, +torch/ao/quantization/backend_config/_common_operator_config_utils.py,sha256=WwNwB3z-Fh12Ft6b2Oh2vr48YtQ9TN2O9tBU89ykXVI,28283 +torch/ao/quantization/backend_config/_qnnpack_pt2e.py,sha256=jQjErEcpgC94Dx07DKacRtLwp-r3NV7_OV0F9pfDheU,6612 +torch/ao/quantization/backend_config/backend_config.py,sha256=cnY-6vFFT5O9_J0cA1lt3PFrW7-mVeAOeVyP4S35UvU,32260 +torch/ao/quantization/backend_config/executorch.py,sha256=erBNAKwOB10_T7tZxG79ELKwndYvwYmLW1SmNExzAAk,17422 +torch/ao/quantization/backend_config/fbgemm.py,sha256=Ol1Pr2cmjzPJnv5-jwz6mtvI1ggq7ZDv7-oOT4A3_Aw,4337 +torch/ao/quantization/backend_config/native.py,sha256=phw5IGaAYB6kIvFknf77xjJkXfeJxjaLWA8l1CWHaKk,8473 +torch/ao/quantization/backend_config/onednn.py,sha256=QBA0Bwws10rB2a7LtG7GZZsAKEy7k7W4RviGS63kFwQ,19755 +torch/ao/quantization/backend_config/qnnpack.py,sha256=9rWj2g2g1BKg4btmxwunj9XqQHRB-k0y9Pxg6_tb3JM,5571 +torch/ao/quantization/backend_config/tensorrt.py,sha256=2EPv3N_J68FgWAJXmsrOr5393o_84xk5LFhU2k5A33A,3119 +torch/ao/quantization/backend_config/utils.py,sha256=XxEaBbf5jwZvEBjnnFBGWRq3O-ZE80HcBCwwjjlI5Qg,12852 +torch/ao/quantization/backend_config/x86.py,sha256=pe-AhPb41P1BoL4ikQQ-UlgfIJ6wIEmRa4vAcfCCRLY,3995 +torch/ao/quantization/fake_quantize.py,sha256=VG5UmrrsylRASmxzxggeX92gxk7Tj9An1J5lArAnT9c,24226 +torch/ao/quantization/fuse_modules.py,sha256=exa8Lzd5phTVruamra09sBHmtN4CX9ow1D3RJ5xGrNE,7009 +torch/ao/quantization/fuser_method_mappings.py,sha256=qJL0SILnQCom6CLX_aXP8YVR_suATTrX3EL4cZ9qqqs,11285 +torch/ao/quantization/fx/__init__.py,sha256=LznkRltyNzEL0Z_KaUUV2lOMPtlTaKXlwWx2Y428B9k,84 +torch/ao/quantization/fx/__pycache__/__init__.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/_decomposed.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/_equalize.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/_lower_to_native_backend.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/convert.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/custom_config.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/fuse.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/fuse_handler.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/graph_module.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/lower_to_fbgemm.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/lower_to_qnnpack.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/lstm_utils.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/match_utils.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/pattern_utils.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/prepare.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/qconfig_mapping_utils.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/quantize_handler.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/tracer.cpython-312.pyc,, +torch/ao/quantization/fx/__pycache__/utils.cpython-312.pyc,, +torch/ao/quantization/fx/_decomposed.py,sha256=nPh5-b00GFtIjf9Jk6hk7d6PfWcTOZti_TOILVjpoKk,45548 +torch/ao/quantization/fx/_equalize.py,sha256=ZWAAzRMhYKI6ZJu_Yyso7HlSldXaU_w8O09ARPhI8G0,41825 +torch/ao/quantization/fx/_lower_to_native_backend.py,sha256=F6kG-U0hJA-QGTEAG07ibEBR72VKFmpVXqWQ5BNG-EA,58570 +torch/ao/quantization/fx/_model_report/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/ao/quantization/fx/_model_report/__pycache__/__init__.cpython-312.pyc,, +torch/ao/quantization/fx/_model_report/__pycache__/detector.cpython-312.pyc,, +torch/ao/quantization/fx/_model_report/__pycache__/model_report.cpython-312.pyc,, +torch/ao/quantization/fx/_model_report/__pycache__/model_report_observer.cpython-312.pyc,, +torch/ao/quantization/fx/_model_report/__pycache__/model_report_visualizer.cpython-312.pyc,, +torch/ao/quantization/fx/_model_report/detector.py,sha256=UlEFbusEpeNTo8dRsOvIg5r_vPCF5sJ8RpYYXx-TyX4,78634 +torch/ao/quantization/fx/_model_report/model_report.py,sha256=Ui1_nu5v_yfDr6OpJDpP1G1MV58UVGwYOjvQXJwowLc,30406 +torch/ao/quantization/fx/_model_report/model_report_observer.py,sha256=bJubiRVwuaPFAcvnFySxNobJ3GRg1l-SXEYyiVu4k1U,12369 +torch/ao/quantization/fx/_model_report/model_report_visualizer.py,sha256=wn0q8gw7cjF_Zb7TC__xSDtkkPH2kQwVPb-Rxk8meuo,33379 +torch/ao/quantization/fx/convert.py,sha256=X3cipdnaigHFlppMUJ884sBcDxnOMEM32dICMSeCAUY,61497 +torch/ao/quantization/fx/custom_config.py,sha256=3JIRtSl5KcTCqJkjX7lLcMgN_JeitxMrxkAC-lx7akE,22336 +torch/ao/quantization/fx/fuse.py,sha256=HOyQBrUBFa1vDTz2s1yV8MsyRxiM73JCVPZLCrPi7L8,7591 +torch/ao/quantization/fx/fuse_handler.py,sha256=Ii4dVwvvqVwXWK1MZFzp9iIKzqMM99amzi4ExSKBN0w,4833 +torch/ao/quantization/fx/graph_module.py,sha256=a9KRTREMnSBzWsZxQGp2bxzJMcWMlxxgt_bUxxnpA1w,6812 +torch/ao/quantization/fx/lower_to_fbgemm.py,sha256=St_PLfQHbvbqlpeD1c1tr--CaI5sDSKPKTTKyQBhk9s,623 +torch/ao/quantization/fx/lower_to_qnnpack.py,sha256=emVN0RZnJOc7JKUjei-lUz98l_2cGxyitgFXNPVAUOk,545 +torch/ao/quantization/fx/lstm_utils.py,sha256=uj54BdJpcQk0cSCMbiAimLJUjMrlQojBVYIlmLKtADc,10772 +torch/ao/quantization/fx/match_utils.py,sha256=RTq0tVdsxg4SZwXyThWr3RtRwJVeVaCmUfStJUX0Q1U,9194 +torch/ao/quantization/fx/pattern_utils.py,sha256=p6f1tfEomnFd16QlPVXWzgrV699kpI3LukSB7Jh9D3k,3780 +torch/ao/quantization/fx/prepare.py,sha256=OO0vVkLRXVen3XuAGuCEKk7JEUiYnc3JIHbE_aSmqAk,92544 +torch/ao/quantization/fx/qconfig_mapping_utils.py,sha256=yLUOkrqpFxCUDGhRjbdybzbMWGKBOhKJmbmSeMSrBj4,15850 +torch/ao/quantization/fx/quantize_handler.py,sha256=cuomcj23rv4rKTcbL8gt4YfSD_A6tW_SLmyNA4YzrTU,7551 +torch/ao/quantization/fx/tracer.py,sha256=Do38qCpjxNnUQmfXuNJ57m0E3hzerndZk71uapgoiR0,1745 +torch/ao/quantization/fx/utils.py,sha256=antKdyW-I9FrLanXPuC-ZtWQhUHHPxbOBbf_xugoYMQ,39781 +torch/ao/quantization/observer.py,sha256=04KkDNoRk1s_4y8UKdTSYsyOwgB8VxJq-qesKtLiZZ4,82466 +torch/ao/quantization/pt2e/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/ao/quantization/pt2e/__pycache__/__init__.cpython-312.pyc,, +torch/ao/quantization/pt2e/__pycache__/_affine_quantization.cpython-312.pyc,, +torch/ao/quantization/pt2e/__pycache__/_numeric_debugger.cpython-312.pyc,, +torch/ao/quantization/pt2e/__pycache__/duplicate_dq_pass.cpython-312.pyc,, +torch/ao/quantization/pt2e/__pycache__/export_utils.cpython-312.pyc,, +torch/ao/quantization/pt2e/__pycache__/graph_utils.cpython-312.pyc,, +torch/ao/quantization/pt2e/__pycache__/lowering.cpython-312.pyc,, +torch/ao/quantization/pt2e/__pycache__/port_metadata_pass.cpython-312.pyc,, +torch/ao/quantization/pt2e/__pycache__/prepare.cpython-312.pyc,, +torch/ao/quantization/pt2e/__pycache__/qat_utils.cpython-312.pyc,, +torch/ao/quantization/pt2e/__pycache__/utils.cpython-312.pyc,, +torch/ao/quantization/pt2e/_affine_quantization.py,sha256=-N0r1Wo_cSaZUUB0tx_fc0vDeLttCE9pCF_dMrAMIBo,36122 +torch/ao/quantization/pt2e/_numeric_debugger.py,sha256=IlqFcaK-iHkfmPHImWAxTVfpUN-ySfok6kwvfveJ9cs,12429 +torch/ao/quantization/pt2e/duplicate_dq_pass.py,sha256=vjo09jpnmzaOIQemw_JghdYNkcoifHJnxxrKjLGO1hk,3210 +torch/ao/quantization/pt2e/export_utils.py,sha256=8SwCTavZTk-PDQ5YqsfpGRl9eXAZsLTcWcdx2iOJs1M,8230 +torch/ao/quantization/pt2e/graph_utils.py,sha256=tmtPhJhy45YjLRtbCkhCBtEH4tb5fnRq5VZYGDrRRg4,6971 +torch/ao/quantization/pt2e/lowering.py,sha256=sr1JxRmt1TkbR_ZFEdSLsM49lUSpfZPIpuhEuGFVQB8,1952 +torch/ao/quantization/pt2e/port_metadata_pass.py,sha256=nJ1dpI7ZODglJ68N2gLm3acyLYSsE1yfgfUKh4Evrw0,9396 +torch/ao/quantization/pt2e/prepare.py,sha256=p_p_d7goWnSD7418CuPkEAPjLqLiExXEFEl-Oed1ZEg,23128 +torch/ao/quantization/pt2e/qat_utils.py,sha256=PRZtnIhVvJ9196Tz6HXiFPU6GBg94lwNe0OwA0txLM0,40624 +torch/ao/quantization/pt2e/representation/__init__.py,sha256=uhKkqgWmX_G43QgqbD4FvLpn6nyf_y_ZRM8A7U9SOMM,116 +torch/ao/quantization/pt2e/representation/__pycache__/__init__.cpython-312.pyc,, +torch/ao/quantization/pt2e/representation/__pycache__/rewrite.cpython-312.pyc,, +torch/ao/quantization/pt2e/representation/rewrite.py,sha256=BlhPbGZc0Y7C1jEGrweQFBQn7ioB4HbtKQTJEetVN0A,29212 +torch/ao/quantization/pt2e/utils.py,sha256=5Q7HrJfiXn6ZT8kMzahkrWRp9mSgJIAsWn7pdwECY6Q,24371 +torch/ao/quantization/qconfig.py,sha256=IpGNFg3lLyucDfrcxFunJdxAF8Q_U4WQJl7sU0ongms,25537 +torch/ao/quantization/qconfig_mapping.py,sha256=oOpt-ceWypSOfzKcEclfGFad3ABgF-2FYxNQp2E8HnE,15230 +torch/ao/quantization/quant_type.py,sha256=2pNr0PUNaewO7-VwLB_k9s02isvSuDSoDBYuiDMvA9k,795 +torch/ao/quantization/quantization_mappings.py,sha256=Jo4PjTgX6TRDLF3cu76x1NcQI01TIul3z8th4eh-ggU,14254 +torch/ao/quantization/quantize.py,sha256=TeScByfMcEKMgxPFE_xY9npDAjIJhKR8aQIBokuUlCk,32225 +torch/ao/quantization/quantize_fx.py,sha256=ig2N-ySR6PiDp_y3fUQi1mR6aPGuoo-NIWuiOHoU9UQ,33223 +torch/ao/quantization/quantize_jit.py,sha256=mW7YRLVkQlLnr7Vped7NyKlaUGjbmT4yFt1RQNv1Jb8,15122 +torch/ao/quantization/quantize_pt2e.py,sha256=0uRnwu9NmhQHuoa8olIXKRoyz5C1MfEKSc5Y89kSmIg,9738 +torch/ao/quantization/quantizer/__init__.py,sha256=kDj8d9proE6S4UYCNwSxFnaldBqsYVktx0gs1RYl1g0,477 +torch/ao/quantization/quantizer/__pycache__/__init__.cpython-312.pyc,, +torch/ao/quantization/quantizer/__pycache__/composable_quantizer.cpython-312.pyc,, +torch/ao/quantization/quantizer/__pycache__/embedding_quantizer.cpython-312.pyc,, +torch/ao/quantization/quantizer/__pycache__/quantizer.cpython-312.pyc,, +torch/ao/quantization/quantizer/__pycache__/utils.cpython-312.pyc,, +torch/ao/quantization/quantizer/__pycache__/x86_inductor_quantizer.cpython-312.pyc,, +torch/ao/quantization/quantizer/__pycache__/xnnpack_quantizer.cpython-312.pyc,, +torch/ao/quantization/quantizer/__pycache__/xnnpack_quantizer_utils.cpython-312.pyc,, +torch/ao/quantization/quantizer/__pycache__/xpu_inductor_quantizer.cpython-312.pyc,, +torch/ao/quantization/quantizer/composable_quantizer.py,sha256=qlJkHul7qH8boHjvTSue78ylpAPmrMtJtaJXk08TLCc,3095 +torch/ao/quantization/quantizer/embedding_quantizer.py,sha256=Ngn8OSfAUVzr3qNnpxwTE9_AJCii12_u69MXoZRdjgM,3491 +torch/ao/quantization/quantizer/quantizer.py,sha256=vZoDAAsCVcbOJOvz3J_I4G8ekMgOcY_gTML8svaGTJg,6799 +torch/ao/quantization/quantizer/utils.py,sha256=efqhwk5tYxrWQB_4tM0jsCW-2KK3VKaID8ijVCpurW4,3512 +torch/ao/quantization/quantizer/x86_inductor_quantizer.py,sha256=P3kNBEI-adaoDZ4FTYm8tGpSDRSTv2AJIE2324ypAmc,68124 +torch/ao/quantization/quantizer/xnnpack_quantizer.py,sha256=Sh4Tz39arR4q9qgGSR9DQrMXS-ZeXjpRSCqRfRNg8IU,16755 +torch/ao/quantization/quantizer/xnnpack_quantizer_utils.py,sha256=2hM4EQQzJm08Gn1OUMWrhq-yMcygCBFC-S6BTnjSeDw,42955 +torch/ao/quantization/quantizer/xpu_inductor_quantizer.py,sha256=7Ez28zO9ctSTNYdbMEG4_jFaG8oAoGt_6f1DbbpOJIQ,3914 +torch/ao/quantization/stubs.py,sha256=KTjSvB5NY6EmWcKCKoMxJq-YefO0nKANteysRFHLep0,2356 +torch/ao/quantization/utils.py,sha256=e-JcGv0mNlAmx79c4_E1vmsEyYaA02dYo5Uf2GwCC7k,30976 +torch/autograd/__init__.py,sha256=ER29meCc0G4arSDaIENCE20FfatQt6kOcbXDokzfzKk,26800 +torch/autograd/__pycache__/__init__.cpython-312.pyc,, +torch/autograd/__pycache__/anomaly_mode.cpython-312.pyc,, +torch/autograd/__pycache__/forward_ad.cpython-312.pyc,, +torch/autograd/__pycache__/function.cpython-312.pyc,, +torch/autograd/__pycache__/functional.cpython-312.pyc,, +torch/autograd/__pycache__/grad_mode.cpython-312.pyc,, +torch/autograd/__pycache__/gradcheck.cpython-312.pyc,, +torch/autograd/__pycache__/graph.cpython-312.pyc,, +torch/autograd/__pycache__/profiler.cpython-312.pyc,, +torch/autograd/__pycache__/profiler_legacy.cpython-312.pyc,, +torch/autograd/__pycache__/profiler_util.cpython-312.pyc,, +torch/autograd/__pycache__/variable.cpython-312.pyc,, +torch/autograd/_functions/__init__.py,sha256=jgHrjtlIe3ka_xUh-D_Ayj7EmRq003Wtyg9TQwQ1QPw,37 +torch/autograd/_functions/__pycache__/__init__.cpython-312.pyc,, +torch/autograd/_functions/__pycache__/tensor.cpython-312.pyc,, +torch/autograd/_functions/__pycache__/utils.cpython-312.pyc,, +torch/autograd/_functions/tensor.py,sha256=rSQaMTpu0GUyH65Q3tdJCtd966lhUOT3pqv4usvgDbM,2568 +torch/autograd/_functions/utils.py,sha256=vHrkyBkvz8mslqWGje78_kdYsD4EYkUk5r9fJYEGIuI,779 +torch/autograd/anomaly_mode.py,sha256=ouSS5GoRhL4ZeL5yqlPapO_SjLaBOkTUWFpU22gh-iE,5087 +torch/autograd/forward_ad.py,sha256=1MnBUf9lEpy0WAOjNhEToWX-3B7vyzt5WE4xd4MhFvw,7868 +torch/autograd/function.py,sha256=EZNIUMGY_HqjVMk5N3DkuKXpbMD9F8fPOsrAYWDeBOg,34392 +torch/autograd/functional.py,sha256=_EBroKIbWdwIaRrHONWRA-6LYQuRGGYCpdL7g0laR7A,54533 +torch/autograd/grad_mode.py,sha256=PHRFHuvASBJWs6wg4ckCdYzZVUXCimwapUgQLG8urTM,14613 +torch/autograd/gradcheck.py,sha256=HFzFJ_BJZuol_czRH24L5sEg75JLcs5wtisp71qvYtI,94303 +torch/autograd/graph.py,sha256=2lqz1I0Jc2RCZev1G-CRqMEzSugcL7C_01I0lPW_kN4,32663 +torch/autograd/profiler.py,sha256=G-jhUrM0uniC4cpwsTxQb-UOshbpts2c08lSMFbvNSw,51385 +torch/autograd/profiler_legacy.py,sha256=i8HGzen_XrEndh-_5QJx35WErWnyKY1sdWnAy_61SlQ,12537 +torch/autograd/profiler_util.py,sha256=hd51OvqUPkxOwj3pG6mNqGOtW8Va42L-hd7K1lC_yio,57060 +torch/autograd/variable.py,sha256=DvFQwaN93efyHpN42uFcUVSHWNwFyfiuC3t45H5vJns,406 +torch/backends/__init__.py,sha256=kj0IKBeUtqe0OdfF8WoGDG65qy1e2M2wrV7OdzR9lAg,3725 +torch/backends/__pycache__/__init__.cpython-312.pyc,, +torch/backends/_coreml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/backends/_coreml/__pycache__/__init__.cpython-312.pyc,, +torch/backends/_coreml/__pycache__/preprocess.cpython-312.pyc,, +torch/backends/_coreml/preprocess.py,sha256=Mw8AQGCMdasD08DauzimYB0KEtwx49N30QJA_4WV324,4451 +torch/backends/_nnapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/backends/_nnapi/__pycache__/__init__.cpython-312.pyc,, +torch/backends/_nnapi/__pycache__/prepare.cpython-312.pyc,, +torch/backends/_nnapi/__pycache__/serializer.cpython-312.pyc,, +torch/backends/_nnapi/prepare.py,sha256=GxtSK75LwZ9-5veE50_kWXDWqGf1eHH0BMM6mh4kfu0,6758 +torch/backends/_nnapi/serializer.py,sha256=k7AjsamjYXGMoMRVottVZb5h6o7-uAvn4-oVjQu6GBg,85305 +torch/backends/cpu/__init__.py,sha256=B9FowRUnLL7Zbxlmzn84Sd8NwK2-o9HbopMdz4L4npo,335 +torch/backends/cpu/__pycache__/__init__.cpython-312.pyc,, +torch/backends/cuda/__init__.py,sha256=_AWz1hng5wHNHn7eMUwz_6RKySxnZjfCiuI42ZBRzjk,22146 +torch/backends/cuda/__pycache__/__init__.cpython-312.pyc,, +torch/backends/cudnn/__init__.py,sha256=N1aQPMqY3mp5hiP6xFXgMWHtqv8cxNVG4chDjMePhC0,8473 +torch/backends/cudnn/__pycache__/__init__.cpython-312.pyc,, +torch/backends/cudnn/__pycache__/rnn.cpython-312.pyc,, +torch/backends/cudnn/rnn.py,sha256=N-SG_zhntC4z9D7JTrUMC2BvBYRtaV4vmcM_e3J9sxw,2373 +torch/backends/cusparselt/__init__.py,sha256=UfK0iyFXMMa5xFWbdC9ukssKH1P979ZpbRY0wimxRvA,1342 +torch/backends/cusparselt/__pycache__/__init__.cpython-312.pyc,, +torch/backends/kleidiai/__init__.py,sha256=Ce5x4LSs2_Ec0uX5sq9a2Q9ZFlPXX0DQxyvoyYueoDY,169 +torch/backends/kleidiai/__pycache__/__init__.cpython-312.pyc,, +torch/backends/mha/__init__.py,sha256=E1q1Uqr78a4_L4EQYTILpDad4LxURpQigNBdHGAi4r8,743 +torch/backends/mha/__pycache__/__init__.cpython-312.pyc,, +torch/backends/miopen/__init__.py,sha256=v8MKoD4ICgZphg_gVCUflfxYpRwZTSnKOaveYWjMdH4,1258 +torch/backends/miopen/__pycache__/__init__.cpython-312.pyc,, +torch/backends/mkl/__init__.py,sha256=LT6K-1k2l2A2MUU6L81k-TMYbHvqejbbwHgJco8txYU,1841 +torch/backends/mkl/__pycache__/__init__.cpython-312.pyc,, +torch/backends/mkldnn/__init__.py,sha256=HMqs6f4sk1qAr0qZPndXHYMH8Vaxx8QAljQHR1NAY2I,4461 +torch/backends/mkldnn/__pycache__/__init__.cpython-312.pyc,, +torch/backends/mps/__init__.py,sha256=Xrr2geraaXKfcYdwXYKm-gtEKv81zWeeZhF7jP51XpM,2209 +torch/backends/mps/__pycache__/__init__.cpython-312.pyc,, +torch/backends/nnpack/__init__.py,sha256=Lza7vXQTuE_baJZL_05OozTyfeg4vu1VTWHCoMfso-I,869 +torch/backends/nnpack/__pycache__/__init__.cpython-312.pyc,, +torch/backends/openmp/__init__.py,sha256=Aee3z5fqS3euk0SSK4X39uZvxSZ-huoS5WY_Fvu54EE,164 +torch/backends/openmp/__pycache__/__init__.cpython-312.pyc,, +torch/backends/opt_einsum/__init__.py,sha256=T57RLTq3ORQel6fKKPBsYFct5Fj4qPUr9LH1XuYjwwA,3953 +torch/backends/opt_einsum/__pycache__/__init__.cpython-312.pyc,, +torch/backends/quantized/__init__.py,sha256=Epc1-SXTMOvyBTVdV87ptvVYGH9DylVHfirzOPO7eio,1926 +torch/backends/quantized/__pycache__/__init__.cpython-312.pyc,, +torch/backends/xeon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/backends/xeon/__pycache__/__init__.cpython-312.pyc,, +torch/backends/xeon/__pycache__/run_cpu.cpython-312.pyc,, +torch/backends/xeon/run_cpu.py,sha256=V_gYOCgqEHM-jL6FcNeImE6OhwcLYkyi3eSd3Zv2uhQ,38663 +torch/backends/xnnpack/__init__.py,sha256=ifIkHb5pGCc3aYwkb6tSQnm30iPBvViD8A8KLvXrc8U,731 +torch/backends/xnnpack/__pycache__/__init__.cpython-312.pyc,, +torch/bin/protoc.exe,sha256=KBqNixMjUHHgIxDw7GEgHMxFFPvEEq77sxUnPgv-C64,2800640 +torch/compiler/__init__.py,sha256=1pdazmDOlJSR72fKHxGIah3pqBVRIslwkzlfEb3U_Lg,25714 +torch/compiler/__pycache__/__init__.cpython-312.pyc,, +torch/compiler/__pycache__/_cache.cpython-312.pyc,, +torch/compiler/__pycache__/config.cpython-312.pyc,, +torch/compiler/_cache.py,sha256=t0wZ8n76pvy1KMDewd-3gmYhi-K2kgP7vP3CCMWA21A,11327 +torch/compiler/config.py,sha256=PfAJLZdvp3QjLaXiadh6sQ93i3jdeAPmKOKtXmsLZYk,11045 +torch/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/contrib/__pycache__/__init__.cpython-312.pyc,, +torch/contrib/__pycache__/_tensorboard_vis.cpython-312.pyc,, +torch/contrib/_tensorboard_vis.py,sha256=PAsRpELdj9ig48p7Es4oWVLIjKL15JOxrHVzalaCl9E,6027 +torch/cpu/__init__.py,sha256=x1NJdKEREHZ_xSug_rCH7netWqkb82dTKyGs6LYtJQc,5032 +torch/cpu/__pycache__/__init__.cpython-312.pyc,, +torch/cpu/amp/__init__.py,sha256=9OW0omr-rf6Se7_c4IMylalUOPur7s6Jh_2YleKhctk,106 +torch/cpu/amp/__pycache__/__init__.cpython-312.pyc,, +torch/cpu/amp/__pycache__/autocast_mode.cpython-312.pyc,, +torch/cpu/amp/__pycache__/grad_scaler.cpython-312.pyc,, +torch/cpu/amp/autocast_mode.py,sha256=udwbMs7Ep9mBcK4tE1rbwBAviNBbCvvmZiOLRHbV9cw,2251 +torch/cpu/amp/grad_scaler.py,sha256=GOq20a01Ba0YFMVEuGlYlgMGtBLo6koIUl9uYgxW8l4,993 +torch/csrc/inductor/aoti_runtime/model.h,sha256=fQc2sfInwHs6UweZ7lfzGY3lrzYLyOIXlW4KtpuLXRY,2319 +torch/cuda/__init__.py,sha256=Z0xpPne4NVRYIAtoUdV3hCfmjuBh2gqRbFgpMxc5eek,67708 +torch/cuda/__pycache__/__init__.cpython-312.pyc,, +torch/cuda/__pycache__/_device_limits.cpython-312.pyc,, +torch/cuda/__pycache__/_gpu_trace.cpython-312.pyc,, +torch/cuda/__pycache__/_memory_viz.cpython-312.pyc,, +torch/cuda/__pycache__/_pin_memory_utils.cpython-312.pyc,, +torch/cuda/__pycache__/_sanitizer.cpython-312.pyc,, +torch/cuda/__pycache__/_utils.cpython-312.pyc,, +torch/cuda/__pycache__/comm.cpython-312.pyc,, +torch/cuda/__pycache__/gds.cpython-312.pyc,, +torch/cuda/__pycache__/graphs.cpython-312.pyc,, +torch/cuda/__pycache__/green_contexts.cpython-312.pyc,, +torch/cuda/__pycache__/jiterator.cpython-312.pyc,, +torch/cuda/__pycache__/memory.cpython-312.pyc,, +torch/cuda/__pycache__/nccl.cpython-312.pyc,, +torch/cuda/__pycache__/nvtx.cpython-312.pyc,, +torch/cuda/__pycache__/profiler.cpython-312.pyc,, +torch/cuda/__pycache__/random.cpython-312.pyc,, +torch/cuda/__pycache__/sparse.cpython-312.pyc,, +torch/cuda/__pycache__/streams.cpython-312.pyc,, +torch/cuda/__pycache__/tunable.cpython-312.pyc,, +torch/cuda/_device_limits.py,sha256=NskfvjoJyWRfG3LXTMAKAVT3RJpHu-Bykg9CJaMLsCo,5640 +torch/cuda/_gpu_trace.py,sha256=eWr3YVweQn44gsdrTOkwwIcrYsWFtiQrQK63cj0qqd8,2459 +torch/cuda/_memory_viz.py,sha256=nIziRPj52Zj6oxHCJqHmPP6M8XuKY54SvK6FRzEewnA,29012 +torch/cuda/_pin_memory_utils.py,sha256=8RdDWW-YxnCaxgLnXWfx5rjJphfrE-Xl06By7lQA7E4,771 +torch/cuda/_sanitizer.py,sha256=dTwI4bwSzS0d-bIgqFMs4xvEdvBOQZVUY8dy6KcedCU,24841 +torch/cuda/_utils.py,sha256=oJOT5SYDMWMzmqBNZ9RgrQsl-Rr4Ac-5UXizGfgwLsc,19652 +torch/cuda/amp/__init__.py,sha256=CA6CB1WzSiYrkfg6ZycDkJw4zeUIq2QL1EynccQhPHQ,311 +torch/cuda/amp/__pycache__/__init__.cpython-312.pyc,, +torch/cuda/amp/__pycache__/autocast_mode.cpython-312.pyc,, +torch/cuda/amp/__pycache__/common.cpython-312.pyc,, +torch/cuda/amp/__pycache__/grad_scaler.cpython-312.pyc,, +torch/cuda/amp/autocast_mode.py,sha256=duG0fJQukUf5kDdg9TtdF6NWqEz_a-WjqXqxAWd5BRw,3587 +torch/cuda/amp/common.py,sha256=3uWhYUr9-qeHDGh4U6n6NQYqeVnI4k1Y_FZnSIDJGgQ,241 +torch/cuda/amp/grad_scaler.py,sha256=Tv9cOcK98Sd2c65ft3gGf6SHBzv9Kb_wqzQMoNaS4MQ,1111 +torch/cuda/comm.py,sha256=mBimRSrUau-nRDQgCcmU4tsplgQBqZErOo1lcPKYGRw,363 +torch/cuda/gds.py,sha256=xFdmNOA2e1SraESl5NVFV-uYr_zuSC9ZaIT9N8TNxug,6000 +torch/cuda/graphs.py,sha256=ZbdBHBSPQ5P31hypxDgJyK4QkKBE3N89dQt5Ct24MhQ,28778 +torch/cuda/green_contexts.py,sha256=fQfaGbw6ZpXjWpxuf3HG_tqrRHWzlH0IpjP3RcOAyaE,1601 +torch/cuda/jiterator.py,sha256=uIj1DNgVsIKmrTef5fvh6Wi1dG0j2_N6EMDcPxW_85g,7050 +torch/cuda/memory.py,sha256=AlqaNF9bA2_T3RX-BHBagFTL7Lvph5MwwMY6DvV_25Y,55798 +torch/cuda/nccl.py,sha256=Ary7vYW6p3QKhE3XADI3ypc4U83n9HGPNy3_8ZcxOWA,4743 +torch/cuda/nvtx.py,sha256=jU64oq6xyjN7IDKIH-VIfeAGPp58NUdOWTBCCFhEFeQ,3834 +torch/cuda/profiler.py,sha256=ulYEZICkOD7hyCW-WjxnXAPHoGMtpDvfRjeW0v5hRzc,2487 +torch/cuda/random.py,sha256=Ge3FywdyAUXAq0YxTFddaPLJFK7o1TDTaoSmluddfXc,5625 +torch/cuda/sparse.py,sha256=Fz_B2EnQ-a1-gPpkiuaOykIin7tXmT-CeLj7YflcloA,68 +torch/cuda/streams.py,sha256=vl5gQDDDkD7L6j-t8-Ze9fZB9mmFvjKOu9ZRTG3l2Iw,10455 +torch/cuda/tunable.py,sha256=nnaOUZBu1j0-0_t9LwbewRrAFSfP3jeuNbgq8gLekLs,31390 +torch/distributed/__init__.py,sha256=VfM70ufSWFPUO3mq17h4xjJ_m-IjPpquBEXLb3xHCa8,5684 +torch/distributed/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/__pycache__/_checkpointable.cpython-312.pyc,, +torch/distributed/__pycache__/_composable_state.cpython-312.pyc,, +torch/distributed/__pycache__/_dist2.cpython-312.pyc,, +torch/distributed/__pycache__/_functional_collectives.cpython-312.pyc,, +torch/distributed/__pycache__/_functional_collectives_impl.cpython-312.pyc,, +torch/distributed/__pycache__/_mesh_layout.cpython-312.pyc,, +torch/distributed/__pycache__/_serialization.cpython-312.pyc,, +torch/distributed/__pycache__/_state_dict_utils.cpython-312.pyc,, +torch/distributed/__pycache__/argparse_util.cpython-312.pyc,, +torch/distributed/__pycache__/c10d_logger.cpython-312.pyc,, +torch/distributed/__pycache__/collective_utils.cpython-312.pyc,, +torch/distributed/__pycache__/constants.cpython-312.pyc,, +torch/distributed/__pycache__/device_mesh.cpython-312.pyc,, +torch/distributed/__pycache__/distributed_c10d.cpython-312.pyc,, +torch/distributed/__pycache__/launch.cpython-312.pyc,, +torch/distributed/__pycache__/logging_handlers.cpython-312.pyc,, +torch/distributed/__pycache__/remote_device.cpython-312.pyc,, +torch/distributed/__pycache__/rendezvous.cpython-312.pyc,, +torch/distributed/__pycache__/run.cpython-312.pyc,, +torch/distributed/__pycache__/utils.cpython-312.pyc,, +torch/distributed/_checkpointable.py,sha256=ZFUbvHl4IBMs3mbMR7ZqFn09_cSekEdB4Gfz2j0cPLI,1342 +torch/distributed/_composable/__init__.py,sha256=thBK3Pd-YbW1Q444eLu9PciaPGsNWw039cR1Q19Q4Gg,128 +torch/distributed/_composable/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_composable/__pycache__/checkpoint_activation.cpython-312.pyc,, +torch/distributed/_composable/__pycache__/contract.cpython-312.pyc,, +torch/distributed/_composable/__pycache__/replicate.cpython-312.pyc,, +torch/distributed/_composable/__pycache__/replicate_with_fsdp.cpython-312.pyc,, +torch/distributed/_composable/checkpoint_activation.py,sha256=NJZPbskRcM4D23KDovek9duJdyn0odwUSDlPd0xAToY,4919 +torch/distributed/_composable/contract.py,sha256=mDqyoFLCcynmpz28TiE1avEheOzJ1wHXMxjjHTi2GUY,11167 +torch/distributed/_composable/fsdp/__init__.py,sha256=9DBnmW1yy-ApaEL75QCo7hsYTUQMzo5Ew8O4-BikHaE,172 +torch/distributed/_composable/fsdp/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_composable/fsdp/__pycache__/fully_shard.cpython-312.pyc,, +torch/distributed/_composable/fsdp/fully_shard.py,sha256=bKBtbDN-wr8z90nXgoGpEOJO1J8Fc6it-HfkNbwRCgQ,248 +torch/distributed/_composable/replicate.py,sha256=H1SYe79k6ZzLkZ-d6JJAwYIDACMhlnV9LuyKu79pWkE,9453 +torch/distributed/_composable/replicate_with_fsdp.py,sha256=yVltJlFqOUMFPzYNtqt-35IVl9ZnrbEWf6hvsOVu8zU,14637 +torch/distributed/_composable_state.py,sha256=nDQo-9Qy9f0XXFqvQOH9w_qfKdmE0pGXsCbW-KVsOqc,1492 +torch/distributed/_dist2.py,sha256=RQKTi0AOcGmV51mzgZkOd33WDdYp5O-D-o0T5OjR22o,5018 +torch/distributed/_functional_collectives.py,sha256=r9feMm_q9garEWfOclBBlG8QtR-cpALf-ICBpUNBEC0,48144 +torch/distributed/_functional_collectives_impl.py,sha256=FxgPvBNcDS5bls2MnRBAIUR7T63ftnWTF2ioDnbQKX4,3352 +torch/distributed/_local_tensor/__init__.py,sha256=oebUSlMCNqW6ybPV4yT8cMgV0kYH0hXNHa6-LBl9uno,77504 +torch/distributed/_local_tensor/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_local_tensor/__pycache__/_c10d.cpython-312.pyc,, +torch/distributed/_local_tensor/_c10d.py,sha256=jydXJXMXrdxoprpFHWADsiDh-PEzI4RnSfpI8hRnmXU,41407 +torch/distributed/_mesh_layout.py,sha256=t6udlcxTL045hgEeQj_DkPBpeTmuEpC4b039olGFvKA,12815 +torch/distributed/_pycute/__init__.py,sha256=hNNaqPa3rv74h8qYrJ5Opful6t-T_yc0CGGCbXXim_o,2530 +torch/distributed/_pycute/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_pycute/__pycache__/int_tuple.cpython-312.pyc,, +torch/distributed/_pycute/__pycache__/layout.cpython-312.pyc,, +torch/distributed/_pycute/__pycache__/typing.cpython-312.pyc,, +torch/distributed/_pycute/int_tuple.py,sha256=FYxpxPaLTCC6_0B7GISKOFErj5i7tmCfd_BiwKDdVQ4,10049 +torch/distributed/_pycute/layout.py,sha256=_S2NHInP0FD-wG4h29f56avdZG3igJEvQWidIPqQzoQ,18393 +torch/distributed/_pycute/typing.py,sha256=OdSD-rVDC76g4iPITrI5YTIneVGCcN0UJwXmhQXAhJA,2104 +torch/distributed/_serialization.py,sha256=uXXpRQUu6GfBjuPiShIzxSisDnz_MUQE9_zgNmMGqDo,4742 +torch/distributed/_shard/__init__.py,sha256=iQH3xAO1oGHbWgMAaP_ITI5ogx8MnQTSjowtvbYP6Tk,88 +torch/distributed/_shard/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_shard/__pycache__/_utils.cpython-312.pyc,, +torch/distributed/_shard/__pycache__/api.cpython-312.pyc,, +torch/distributed/_shard/__pycache__/common_op_utils.cpython-312.pyc,, +torch/distributed/_shard/__pycache__/metadata.cpython-312.pyc,, +torch/distributed/_shard/__pycache__/op_registry_utils.cpython-312.pyc,, +torch/distributed/_shard/__pycache__/sharder.cpython-312.pyc,, +torch/distributed/_shard/_utils.py,sha256=NSZzZUHXID6AkkdQQ_-KT6okhW3sb35993CtI3hVxpE,1102 +torch/distributed/_shard/api.py,sha256=NHednk6NNvPyDkFtSBHntWCsfRCJGJONW7GrMigbRoA,12670 +torch/distributed/_shard/checkpoint/__init__.py,sha256=BLwYCF5RBdVhgcQWIt-okUz4b2j4s8dZJUV5noFajKE,603 +torch/distributed/_shard/checkpoint/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_shard/common_op_utils.py,sha256=Yp0M-ai6-dVefko4f3bf931khnHmL9qJTGxggiWCpvc,2212 +torch/distributed/_shard/metadata.py,sha256=629szwd4CCXDxPcIu5A6e-D7bMANbQADXUHcJtRMfiU,2231 +torch/distributed/_shard/op_registry_utils.py,sha256=CiG2tqa17vB8-byEvREH1xa6n3ok6jeZTw7yMfIJbOU,1072 +torch/distributed/_shard/sharded_optim/__init__.py,sha256=f59j9U_hrxsWJNyyR177An12sJ4d8NX0kKT3zGRya2U,1916 +torch/distributed/_shard/sharded_optim/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_shard/sharded_optim/__pycache__/api.cpython-312.pyc,, +torch/distributed/_shard/sharded_optim/api.py,sha256=jamAoH9Gb0O63rh-M1lPgSbr0JGbmhD4vZSo33v9OnU,4366 +torch/distributed/_shard/sharded_tensor/__init__.py,sha256=IJZPh6GHq0UOUoNd-Cr2gRD5n5dNQT-2o0NaCaLHTpk,19737 +torch/distributed/_shard/sharded_tensor/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/__pycache__/api.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/__pycache__/logger.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/__pycache__/logging_handlers.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/__pycache__/metadata.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/__pycache__/reshard.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/__pycache__/shard.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/__pycache__/utils.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/_ops/__init__.py,sha256=lmxOnYVj19giuuuhimdPOa9_hhfUDLNtb54PRrrn0rc,511 +torch/distributed/_shard/sharded_tensor/_ops/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/_ops/__pycache__/_common.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/_ops/__pycache__/binary_cmp.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/_ops/__pycache__/init.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/_ops/__pycache__/misc_ops.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/_ops/__pycache__/tensor_ops.cpython-312.pyc,, +torch/distributed/_shard/sharded_tensor/_ops/_common.py,sha256=HRXzKKG3rtVfKrfQJux7kJMj8eH3Ir5AolOyKFPCzDA,4395 +torch/distributed/_shard/sharded_tensor/_ops/binary_cmp.py,sha256=5r6jlsQqp-QSnX58cw15qd60IHOqdF1QabbmkCLKTMM,2814 +torch/distributed/_shard/sharded_tensor/_ops/init.py,sha256=ELMVXtIJIOZzuS4ulq_3h7TbbAkL5FdZDnX3t1mZ87o,6236 +torch/distributed/_shard/sharded_tensor/_ops/misc_ops.py,sha256=PyhosH2velC0RYXbcy8M2AfRLBslVuslDIx8CqvSMdU,509 +torch/distributed/_shard/sharded_tensor/_ops/tensor_ops.py,sha256=CT5tn4uqCmZNCF7XPoO2uCthsd8s1isgkEbA_P2weaI,8041 +torch/distributed/_shard/sharded_tensor/api.py,sha256=UCqfUSXgRCTxBCDYbUSqf1rgRycxZdYudnWfxCVH6-I,56407 +torch/distributed/_shard/sharded_tensor/logger.py,sha256=LN2I0OxeVSkfYGDkvdKuicmHwxF05ojsg48juMHNlsM,1119 +torch/distributed/_shard/sharded_tensor/logging_handlers.py,sha256=TlQ6zgFzEXDyRX30awgGptSNGaPvhdBii_AMUtV8Vxw,375 +torch/distributed/_shard/sharded_tensor/metadata.py,sha256=UTEMAm3UuoGip42IrBmIhv6MfINRfXjrbX5LDvA_C_k,3092 +torch/distributed/_shard/sharded_tensor/reshard.py,sha256=SgGVV1SW0M2e_LXW42WdLFLtCx3BhUXplx1ijWQxs5s,10969 +torch/distributed/_shard/sharded_tensor/shard.py,sha256=m9eiukI8VWDG7mKK3HMSeb5Ge_Sa8ttHkp021eFrh4w,2422 +torch/distributed/_shard/sharded_tensor/utils.py,sha256=2R3QkvlvLwsQFVmwN2WpNSJwHrxrwK7W0sQhXsKRi_g,12056 +torch/distributed/_shard/sharder.py,sha256=Hit1lmP4br_NABzhst2jkTINzzO3Oj_9aTiIeI2rjHQ,930 +torch/distributed/_shard/sharding_plan/__init__.py,sha256=bwXPLAUqt1LbEwkmcKf0F2xfLjOZOe3-H7XF9WzSba0,48 +torch/distributed/_shard/sharding_plan/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_shard/sharding_plan/__pycache__/api.cpython-312.pyc,, +torch/distributed/_shard/sharding_plan/api.py,sha256=gHuRVcJ-UYkiOwg3N2dg3SQdqBwv2I4tfUH1YLLDXbY,3688 +torch/distributed/_shard/sharding_spec/__init__.py,sha256=_5g_LTK5iUs19ZKCKThnOF3EfnUICbolGW_nuhep6zs,301 +torch/distributed/_shard/sharding_spec/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_shard/sharding_spec/__pycache__/_internals.cpython-312.pyc,, +torch/distributed/_shard/sharding_spec/__pycache__/api.cpython-312.pyc,, +torch/distributed/_shard/sharding_spec/__pycache__/chunk_sharding_spec.cpython-312.pyc,, +torch/distributed/_shard/sharding_spec/_internals.py,sha256=ezsdIuUV-PUMmVcGb7cF1lCPl719G-ZinVFW8XujzaI,8761 +torch/distributed/_shard/sharding_spec/api.py,sha256=HZPxGiHyYwGdNVihk5JRqZILFXuFKTs4KibmdHX7QsE,10112 +torch/distributed/_shard/sharding_spec/chunk_sharding_spec.py,sha256=VSpRGl57z84RG-T1jkQ_RQdC8lxyhsnH0vDSfZRvv80,9503 +torch/distributed/_shard/sharding_spec/chunk_sharding_spec_ops/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/distributed/_shard/sharding_spec/chunk_sharding_spec_ops/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_shard/sharding_spec/chunk_sharding_spec_ops/__pycache__/_common.cpython-312.pyc,, +torch/distributed/_shard/sharding_spec/chunk_sharding_spec_ops/__pycache__/embedding.cpython-312.pyc,, +torch/distributed/_shard/sharding_spec/chunk_sharding_spec_ops/__pycache__/embedding_bag.cpython-312.pyc,, +torch/distributed/_shard/sharding_spec/chunk_sharding_spec_ops/_common.py,sha256=thphmfHAaaJOHkIU_xVLb3P6GQvsygSNqrd_Fs1a-V8,13473 +torch/distributed/_shard/sharding_spec/chunk_sharding_spec_ops/embedding.py,sha256=ZuCM_9GDQfMp_0iLvmRgPMxdmHj6mG85Acq6dqN6O9o,11503 +torch/distributed/_shard/sharding_spec/chunk_sharding_spec_ops/embedding_bag.py,sha256=Pgv_Y0X7BQF3Jm3sKLan6JgBIJp5D11j7EvTe4Q47f4,18922 +torch/distributed/_sharded_tensor/__init__.py,sha256=F2v-WztwXDCJmCC9j12mYZKP9aR_qKHRCyW8-Fig-RA,638 +torch/distributed/_sharded_tensor/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_sharding_spec/__init__.py,sha256=hpjniVEKyMpjJj_Y8896cZfS0O0DAQczWxKb0EQd6Zg,668 +torch/distributed/_sharding_spec/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_state_dict_utils.py,sha256=K3SY4uSwraY9Oob0uEA1cG390ucgi74i4s4xdxEu5Lc,30644 +torch/distributed/_symmetric_memory/__init__.py,sha256=QNuw3Sh25QBfS0fdS0D4xrQCELkl6wjVa0JWzJKx8bM,76855 +torch/distributed/_symmetric_memory/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_symmetric_memory/__pycache__/_nvshmem_triton.cpython-312.pyc,, +torch/distributed/_symmetric_memory/_nvshmem_triton.py,sha256=2D27od_nx_55ogvFLmH7FY0jAzlWdq3A4tv3jAemx6M,48194 +torch/distributed/_tensor/__init__.py,sha256=7CEueTzVfPhuDOUkv1_or6pLzyuLxGPFUW_h6Y5tjBQ,1014 +torch/distributed/_tensor/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_tensor/__pycache__/api.cpython-312.pyc,, +torch/distributed/_tensor/__pycache__/placement_types.cpython-312.pyc,, +torch/distributed/_tensor/api.py,sha256=66VAvT_Nt3qGd1RfjGp8GAaJ0GbE2tfNO2deCCygDIQ,309 +torch/distributed/_tensor/placement_types.py,sha256=7neBt_m_QwfieD-08DUeKq9y1z-UAhswe2NSznxdw2c,394 +torch/distributed/_tools/__init__.py,sha256=Dsgy-WmACc3x2RvRhcnu-RMJKwmGHk8tpAt2N40fSkU,339 +torch/distributed/_tools/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/_tools/__pycache__/common_utils.cpython-312.pyc,, +torch/distributed/_tools/__pycache__/fake_collectives.cpython-312.pyc,, +torch/distributed/_tools/__pycache__/fsdp2_mem_tracker.cpython-312.pyc,, +torch/distributed/_tools/__pycache__/ilp_utils.cpython-312.pyc,, +torch/distributed/_tools/__pycache__/mem_tracker.cpython-312.pyc,, +torch/distributed/_tools/__pycache__/memory_tracker.cpython-312.pyc,, +torch/distributed/_tools/__pycache__/mod_tracker.cpython-312.pyc,, +torch/distributed/_tools/__pycache__/runtime_estimator.cpython-312.pyc,, +torch/distributed/_tools/__pycache__/sac_estimator.cpython-312.pyc,, +torch/distributed/_tools/__pycache__/sac_ilp.cpython-312.pyc,, +torch/distributed/_tools/common_utils.py,sha256=yW9YHDy08wd0BD1TJ9atKeo7ilxNHDbY5kL2ReT9lNg,1221 +torch/distributed/_tools/fake_collectives.py,sha256=7Z3KyW6EXl-l9XQpbZCiFQdZawdWPkgFPD0b3EDcfvI,12173 +torch/distributed/_tools/fsdp2_mem_tracker.py,sha256=pjtSHRdKz0XhqCWvnwyfPjbF1MCJjEwC-9Yk_hNOKGY,25961 +torch/distributed/_tools/ilp_utils.py,sha256=e3UeoYy3uwAnbqlhVLcDEQvhGR-VkKs7NyJKrVEzT10,10386 +torch/distributed/_tools/mem_tracker.py,sha256=9EN38OwCzy515Tjj8H4Us1kJ9yfxvcFr3k4mAONXyto,43368 +torch/distributed/_tools/memory_tracker.py,sha256=p8odNjFi5lMdgSsLHAqtq_MJdwI6M1HfroJr9TTdGzM,12166 +torch/distributed/_tools/mod_tracker.py,sha256=PxuGmnD5d9sufAcUxfmc56b_AAUPBF-4A5W2JUFUDsU,10526 +torch/distributed/_tools/runtime_estimator.py,sha256=VNHPWRqwysBruZb1Yf0Dyv7w9wb5G2K3fDWXeP7waVk,17127 +torch/distributed/_tools/sac_estimator.py,sha256=k8zr1dcw-Q1GNJ1qVXsI5kBFH2bkE-a-jrOD4Bw095w,43272 +torch/distributed/_tools/sac_ilp.py,sha256=25m5lFdnQ_jJM4iJnfQyc4ZTaRCiBpxwxGKeap7zLCA,11581 +torch/distributed/algorithms/__init__.py,sha256=Pc8JMBAT_SDP0rhlhN4ziK8VIAsxKju29iZsKZwUH9A,44 +torch/distributed/algorithms/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/algorithms/__pycache__/join.cpython-312.pyc,, +torch/distributed/algorithms/_checkpoint/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/distributed/algorithms/_checkpoint/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/algorithms/_checkpoint/__pycache__/checkpoint_wrapper.cpython-312.pyc,, +torch/distributed/algorithms/_checkpoint/checkpoint_wrapper.py,sha256=rfgOiwQkauAqRS2h0BGC3dEj82ajtyObzBmxpLP-3dQ,12547 +torch/distributed/algorithms/_comm_hooks/__init__.py,sha256=EzLHTA765VfQrU0Bb7qJNZlXoJ7tMh44_VWY4QpS5pQ,138 +torch/distributed/algorithms/_comm_hooks/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/algorithms/_comm_hooks/__pycache__/default_hooks.cpython-312.pyc,, +torch/distributed/algorithms/_comm_hooks/default_hooks.py,sha256=Xx3Zw2PHwGMkdzPNNcVVwYY97l2pfishxx4WP-Ldm-c,7807 +torch/distributed/algorithms/_optimizer_overlap/__init__.py,sha256=gfhXcWlZiV9qc3HF3rE0iAqb3i7O7IFvQzpKbnMnddQ,53 +torch/distributed/algorithms/_optimizer_overlap/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/algorithms/_optimizer_overlap/__pycache__/optimizer_overlap.cpython-312.pyc,, +torch/distributed/algorithms/_optimizer_overlap/optimizer_overlap.py,sha256=CJddd_95wQv-AKNkBHW01tJGpxrQmLSjQFIRBpq8RB0,3849 +torch/distributed/algorithms/_quantization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/distributed/algorithms/_quantization/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/algorithms/_quantization/__pycache__/quantization.cpython-312.pyc,, +torch/distributed/algorithms/_quantization/quantization.py,sha256=Aalm_vo1yRoSZSZdI6iH6jtlxqMHxER81HpLmR3Yyy4,5797 +torch/distributed/algorithms/ddp_comm_hooks/__init__.py,sha256=5mkRyVJ61dNmyWN6_VcG3edkHdYJUDBQLYiVXOkHpkI,4307 +torch/distributed/algorithms/ddp_comm_hooks/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/algorithms/ddp_comm_hooks/__pycache__/ddp_zero_hook.cpython-312.pyc,, +torch/distributed/algorithms/ddp_comm_hooks/__pycache__/debugging_hooks.cpython-312.pyc,, +torch/distributed/algorithms/ddp_comm_hooks/__pycache__/default_hooks.cpython-312.pyc,, +torch/distributed/algorithms/ddp_comm_hooks/__pycache__/mixed_precision_hooks.cpython-312.pyc,, +torch/distributed/algorithms/ddp_comm_hooks/__pycache__/optimizer_overlap_hooks.cpython-312.pyc,, +torch/distributed/algorithms/ddp_comm_hooks/__pycache__/post_localSGD_hook.cpython-312.pyc,, +torch/distributed/algorithms/ddp_comm_hooks/__pycache__/powerSGD_hook.cpython-312.pyc,, +torch/distributed/algorithms/ddp_comm_hooks/__pycache__/quantization_hooks.cpython-312.pyc,, +torch/distributed/algorithms/ddp_comm_hooks/ddp_zero_hook.py,sha256=ZA5eYt4tXf9K3pYA7ubp4dMpLJ-8hXahaZ2x7mZmWxg,19947 +torch/distributed/algorithms/ddp_comm_hooks/debugging_hooks.py,sha256=QQCaAKHjMyAvy9aAL5H66XR5sWbYAB5RaiYa_q_Aw20,1144 +torch/distributed/algorithms/ddp_comm_hooks/default_hooks.py,sha256=-leT19-Z0iKRrWSHx9gG4ReLnskUHaHJrRqS_j93S4Y,8173 +torch/distributed/algorithms/ddp_comm_hooks/mixed_precision_hooks.py,sha256=pEPkGe14jATp7q_tGXv-WQ5XkozezzJfP48Kn7hO_SU,3340 +torch/distributed/algorithms/ddp_comm_hooks/optimizer_overlap_hooks.py,sha256=xgJV3CSh-HAo_oOydvRD_ZsDQqhYJA9w75B6cH_B3VI,6315 +torch/distributed/algorithms/ddp_comm_hooks/post_localSGD_hook.py,sha256=tNrXqBtz0ShZDpDsgVLsVEhYdTAgpcc4pEfucfebJVU,5274 +torch/distributed/algorithms/ddp_comm_hooks/powerSGD_hook.py,sha256=f2xlI7B_UD9hHUdnUwAplkBpWp9mIYzzxAtf52msOb4,41360 +torch/distributed/algorithms/ddp_comm_hooks/quantization_hooks.py,sha256=V37LgpHu2bl-Bdl1JUfxxa5O3BlgOMi6Rn9ymBsfYMM,8538 +torch/distributed/algorithms/join.py,sha256=4VAv6r2IoxgdH9DKL690sXoWkPEds0rAvpd9Ooqq_os,13795 +torch/distributed/algorithms/model_averaging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/distributed/algorithms/model_averaging/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/algorithms/model_averaging/__pycache__/averagers.cpython-312.pyc,, +torch/distributed/algorithms/model_averaging/__pycache__/hierarchical_model_averager.cpython-312.pyc,, +torch/distributed/algorithms/model_averaging/__pycache__/utils.cpython-312.pyc,, +torch/distributed/algorithms/model_averaging/averagers.py,sha256=XOWes1owQZ96DR-4aKssy-z482gesoZfWJm9mldgp4E,5545 +torch/distributed/algorithms/model_averaging/hierarchical_model_averager.py,sha256=kKwRl0thqw3FStN2R6JZj75pQ3wf6RyYaeZKLkVuj5k,9951 +torch/distributed/algorithms/model_averaging/utils.py,sha256=f90JPl-J0ms1rv9TPnFFSRaYHw7dlc3Ph2l8BNR3F9I,3173 +torch/distributed/argparse_util.py,sha256=hsAuTVu0mAjfWycxDQwSMzF64PvTIE2s7cOa2kpOCHY,4007 +torch/distributed/autograd/__init__.py,sha256=CpG_HMIdw84fWKtHYvpRWjtdzT3nbuSndMLoCYeQzSA,1997 +torch/distributed/autograd/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/c10d_logger.py,sha256=5WHwyfFxZVitt0JCdgW-lt4qnt6Cwbp3ucUJBETnXCI,3285 +torch/distributed/checkpoint/__init__.py,sha256=mYrqzUUoKBBQemiXMEPdgSfU40Rr2hkhhQk_jDvUY_o,847 +torch/distributed/checkpoint/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_async_executor.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_async_process_executor.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_async_thread_executor.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_checkpointer.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_consolidate_hf_safetensors.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_dedup_save_plans.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_dedup_tensors.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_extension.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_fsspec_filesystem.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_hf_utils.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_nested_dict.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_pg_transport.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_sharded_tensor_utils.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_state_dict_stager.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_storage_utils.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_traverse.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/_version.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/api.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/default_planner.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/filesystem.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/format_utils.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/hf_storage.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/logger.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/logging_handlers.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/metadata.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/optimizer.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/planner.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/planner_helpers.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/quantized_hf_storage.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/resharding.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/staging.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/state_dict.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/state_dict_loader.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/state_dict_saver.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/stateful.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/storage.cpython-312.pyc,, +torch/distributed/checkpoint/__pycache__/utils.cpython-312.pyc,, +torch/distributed/checkpoint/_async_executor.py,sha256=HpumO1bLkNukJ35Wsj-J6st3wl9VRiYVt90WUfKQ3zA,1243 +torch/distributed/checkpoint/_async_process_executor.py,sha256=yG31HkdWI5P8bW_UiuNaHW2rfH_83j5xEpkKpU-NFaI,18617 +torch/distributed/checkpoint/_async_thread_executor.py,sha256=llNm_RuJ1bxpLroNh9qkiylAc4sxTqrTCwrUKtG3EQg,2547 +torch/distributed/checkpoint/_checkpointer.py,sha256=rrnBdikpfwfKT0tSK2VL6j0xezFKPoCVjj9Rx-zaBmA,3905 +torch/distributed/checkpoint/_consolidate_hf_safetensors.py,sha256=K8BBvh5lfwdV8zzsYYKdxkoxKb0y8hk77iSvhiu-9KE,27854 +torch/distributed/checkpoint/_dedup_save_plans.py,sha256=T9RvDRKGZpY-L4NKFrrf7MY7Uy6VbBOjZDJGUDAsk3Y,2819 +torch/distributed/checkpoint/_dedup_tensors.py,sha256=vTfohDLqz1wIJkP4p9xgcsp9DFLHZeb7YJzV5Mv-JVc,2053 +torch/distributed/checkpoint/_experimental/__init__.py,sha256=Mprq0Fs6XN7n1sTLI_HfXNxWKfh98NEKqZr4QNOwNbI,1814 +torch/distributed/checkpoint/_experimental/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/checkpoint/_experimental/__pycache__/barriers.cpython-312.pyc,, +torch/distributed/checkpoint/_experimental/__pycache__/builder.cpython-312.pyc,, +torch/distributed/checkpoint/_experimental/__pycache__/checkpoint_process.cpython-312.pyc,, +torch/distributed/checkpoint/_experimental/__pycache__/checkpoint_reader.cpython-312.pyc,, +torch/distributed/checkpoint/_experimental/__pycache__/checkpoint_writer.cpython-312.pyc,, +torch/distributed/checkpoint/_experimental/__pycache__/checkpointer.cpython-312.pyc,, +torch/distributed/checkpoint/_experimental/__pycache__/config.cpython-312.pyc,, +torch/distributed/checkpoint/_experimental/__pycache__/staging.cpython-312.pyc,, +torch/distributed/checkpoint/_experimental/__pycache__/types.cpython-312.pyc,, +torch/distributed/checkpoint/_experimental/__pycache__/utils.cpython-312.pyc,, +torch/distributed/checkpoint/_experimental/barriers.py,sha256=ABQ74yLw4FHONHCs58_V2aLMYShzhCx4JewqJIVToRE,9404 +torch/distributed/checkpoint/_experimental/builder.py,sha256=S9ETW87Dj0ZizHubRy7SOSFUshgVCc6KdzCwXqFCXkk,6297 +torch/distributed/checkpoint/_experimental/checkpoint_process.py,sha256=69uMROJ2B8LnwtjmAQ1oEY5CUICQ_fMXUrLGLzT3E2g,13457 +torch/distributed/checkpoint/_experimental/checkpoint_reader.py,sha256=84QiW2IX4kckV7aaTD3kP1wL-0e9waCX5A_wzM6NkOI,8918 +torch/distributed/checkpoint/_experimental/checkpoint_writer.py,sha256=2x3nKPS8kODLbWjyWrr7NduA61D6rzDbQ5xD9t0CbZA,5433 +torch/distributed/checkpoint/_experimental/checkpointer.py,sha256=wwoogX6KYJpSNWyiwc54r3xBHZZ6nBKmQ126DaHvS2A,12289 +torch/distributed/checkpoint/_experimental/config.py,sha256=PZLBiVvSF2992S2ifrJl3_-SnwizXC4d-MsKOF-ka8I,1572 +torch/distributed/checkpoint/_experimental/staging.py,sha256=xjY0J7AZDzRJ-5XNW0RKHA1pfNDJShICLskE8k9GhIk,8455 +torch/distributed/checkpoint/_experimental/types.py,sha256=l4Km45l-QSJPglWR1Hx-GzabGc024ezCkUAyCshkwAk,787 +torch/distributed/checkpoint/_experimental/utils.py,sha256=wd1ZbKIzD2senvlrCy9BtUwhWcuKlpYPE1aYRrhTmGI,1347 +torch/distributed/checkpoint/_extension.py,sha256=BmsYwKHyJ8AKqkZMbcroxrNkPJIzjVKyQosa0X6qSag,8013 +torch/distributed/checkpoint/_fsspec_filesystem.py,sha256=ps2hxUWAdCJXVD98nNwwswTxAkH29GisDrlz-cNTPp8,5802 +torch/distributed/checkpoint/_hf_utils.py,sha256=65-qdMVldpv_ReN5zfSh6MY7VkJ9XawT4UraG5acYQI,2941 +torch/distributed/checkpoint/_nested_dict.py,sha256=YlZkWH5Q6XpUJwpLjSfie55l-M9SmXZJEbL7_UI_LE8,2342 +torch/distributed/checkpoint/_pg_transport.py,sha256=hEgVAwHZNhUbWfH2q0IgU7utQKGUh7q5YrXqz5oA8J8,13735 +torch/distributed/checkpoint/_sharded_tensor_utils.py,sha256=vFi5JrynZ9tqGDO1osMg3ZFRcdY7PPOak-VSz4xmE2Q,4251 +torch/distributed/checkpoint/_state_dict_stager.py,sha256=bYSvc4r2Q9nmhgP9AOO0SEHyJlk1vLnRuzZtLJWtDfk,19091 +torch/distributed/checkpoint/_storage_utils.py,sha256=lImEBWA00Wy_pBauprlFHzPi1vhrm1PEkXBZCRHddr8,1457 +torch/distributed/checkpoint/_traverse.py,sha256=KOXwThWhd3Mhd5SgRvFfADMoU3pQyx0SXE48A2D4dfU,7166 +torch/distributed/checkpoint/_version.py,sha256=2jSNOCX7Es6XawPrXxduplCACzbtzIgW_lSkURkP8a4,128 +torch/distributed/checkpoint/api.py,sha256=XulZrinATE9EIc4Ye_1oB5m73odOJlJseGzAO9doyS0,1459 +torch/distributed/checkpoint/default_planner.py,sha256=0Qpz_SIySeJ1nwp6JUKubyYmU4godWYTnO-56zA-wuA,28162 +torch/distributed/checkpoint/filesystem.py,sha256=9gnjEDWwvVrwdBhVKQWDytyXXZEqaWoDurlcZhlZHxk,37988 +torch/distributed/checkpoint/format_utils.py,sha256=YNIczO9M2dyTzX91EMIeoYXXmhVQ3WfSQfI0QA-UvYw,11089 +torch/distributed/checkpoint/hf_storage.py,sha256=DG2_ifoJxXGddlAFqhirmARN8r9CGaBgU_9MERtTggo,15802 +torch/distributed/checkpoint/logger.py,sha256=it0vFamxlRK5hD9whERcuRsJ4w8AxMKrj5WkPKnP2VU,3756 +torch/distributed/checkpoint/logging_handlers.py,sha256=kjBL2bzgKjxZGodJrhZc_aDyabvhG-rzPLpxGIJwmnc,234 +torch/distributed/checkpoint/metadata.py,sha256=HrCev4SeuCSB-tyda8YWGKCUajSOOg3nP3-nk6Azu4s,5816 +torch/distributed/checkpoint/optimizer.py,sha256=wKNDkBMJVFqlezBPO_QVQgCzga_oJCgA05D-i2kAUdI,13740 +torch/distributed/checkpoint/planner.py,sha256=n14VKF0NJXT7sDs6sDIr7vlNBN2HYdyRWA5xOtEk_yI,16713 +torch/distributed/checkpoint/planner_helpers.py,sha256=XivhoN8279q9iVQsutiWHI9sB7Aol_VyWH1IahryeKU,17035 +torch/distributed/checkpoint/quantized_hf_storage.py,sha256=nYKPLR9VMgBtWXF9ogYBW2fBrX46HNw5mwsdoOyNDyw,20630 +torch/distributed/checkpoint/resharding.py,sha256=XLBXWRfcAD7pnM01B0Bmnez3rSMMNpOt59ModVMiS_U,2344 +torch/distributed/checkpoint/staging.py,sha256=qbUi6I8AyuEitbW8EHR6D89p53RBsjA2LNRVB5Ddtss,19773 +torch/distributed/checkpoint/state_dict.py,sha256=Bn84eBOAKZiIPCzwaHI8YJHZw1IwUNg0Gxe5pbbjl6M,64106 +torch/distributed/checkpoint/state_dict_loader.py,sha256=IEzwstpHMD1h33HkiH1UTBjP_5heLx01z7CohQq7760,14749 +torch/distributed/checkpoint/state_dict_saver.py,sha256=ZwF-mqjDTcNE7AAypSqmdh0QtetIN68CofphsUtufco,19092 +torch/distributed/checkpoint/stateful.py,sha256=3aEHPgcexX9gz3AIJaZejsl4OPqtSadvTxGCi3BPGpU,1103 +torch/distributed/checkpoint/storage.py,sha256=KCxZ8cP8vZ9NeFzzW50WnaP4PaPEnhRG0Cpl7CQy--o,10122 +torch/distributed/checkpoint/utils.py,sha256=4znAKWVrwFrSf5WzXXbhrI3nHQQ25HL0ge3cDHusfr4,17048 +torch/distributed/collective_utils.py,sha256=vyPC9eHjCZwJbr1raWZAxfEZ5Ny3RSK3t7Ekl48uNZw,12467 +torch/distributed/constants.py,sha256=c2C2uCtS0cRsCc93O2Z8XweYbFRAU17d5_Qp7atzLYA,1223 +torch/distributed/debug/__init__.py,sha256=bVagnE5aTy0SWflvKhRJyv5H6MQaSOosLxWB8BZatfs,2830 +torch/distributed/debug/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/debug/__pycache__/_frontend.cpython-312.pyc,, +torch/distributed/debug/__pycache__/_handlers.cpython-312.pyc,, +torch/distributed/debug/__pycache__/_store.cpython-312.pyc,, +torch/distributed/debug/_frontend.py,sha256=_u-o-Luyk_fKq1KMT6O4g3KlIlAqZhZ0TiyewvMGMRA,17898 +torch/distributed/debug/_handlers.py,sha256=xsZusDhHDHLFEJnkJbMXZfY3Xpd2SsUxeP0p05j6Tw4,799 +torch/distributed/debug/_store.py,sha256=A7qYvv78Kp_kNURDL1kbCCKf53CXE9JB3iT1WeIuFVk,557 +torch/distributed/device_mesh.py,sha256=N6DHqrbubPpIX7LyMKocs4SDHkV4Q1fmcqfbZ4z8OXo,66359 +torch/distributed/distributed_c10d.py,sha256=GBFN2iZGTC2UWe2sVejV3xLeKB4lGUYPzgcbnmfrkco,253858 +torch/distributed/elastic/__init__.py,sha256=I6xvpW3XNSMV50kNmYbKxwaz1Ihf-QwjazmhwXW1ANA,3731 +torch/distributed/elastic/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/elastic/__pycache__/control_plane.cpython-312.pyc,, +torch/distributed/elastic/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/distributed/elastic/agent/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/elastic/agent/server/__init__.py,sha256=UuEcXkRQTe9-_iwHlKktGEyx8btsOrld-ZHngbhYLB4,1442 +torch/distributed/elastic/agent/server/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/elastic/agent/server/__pycache__/api.cpython-312.pyc,, +torch/distributed/elastic/agent/server/__pycache__/health_check_server.cpython-312.pyc,, +torch/distributed/elastic/agent/server/__pycache__/local_elastic_agent.cpython-312.pyc,, +torch/distributed/elastic/agent/server/api.py,sha256=ceW4maSLhgCPyq2Pz-xDDwYvL2-OQ-VRw9zeZbM2oAo,39922 +torch/distributed/elastic/agent/server/health_check_server.py,sha256=HDiu4JaY88mwIg7QwfkQHxYWo36kKw2_PBUDNQN822I,1753 +torch/distributed/elastic/agent/server/local_elastic_agent.py,sha256=GdOkWxCdIwpzUMv_I_I1rP1dsfqluhampRYJHaFb7Ns,19208 +torch/distributed/elastic/control_plane.py,sha256=6WkVx31eMy0h1yCuQaMoaZCHfVy94Z6v0Blt7icaryk,1234 +torch/distributed/elastic/events/__init__.py,sha256=XNTzQcOSn15XAPSXRGqgujzmy7NVYrZvvrvPk3QnVbc,5540 +torch/distributed/elastic/events/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/elastic/events/__pycache__/api.cpython-312.pyc,, +torch/distributed/elastic/events/__pycache__/handlers.cpython-312.pyc,, +torch/distributed/elastic/events/api.py,sha256=GxXkpz4rqQJmVHmeN9UiHC9W1XwgZPuXzbhDGLlDdDc,3429 +torch/distributed/elastic/events/handlers.py,sha256=1JH4wO7999r9Apa2_F0zXsy1guVH4Pf0Hl-Hj19xElk,577 +torch/distributed/elastic/metrics/__init__.py,sha256=5_B-UXug4b8FLA3IBhQHG1UdzQTdj1vhZuBAW0ZED8A,5067 +torch/distributed/elastic/metrics/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/elastic/metrics/__pycache__/api.cpython-312.pyc,, +torch/distributed/elastic/metrics/api.py,sha256=fABRj7AANetXNYwq9nDXqm90ThRHLOeFLt5TFRqdsBQ,5967 +torch/distributed/elastic/multiprocessing/__init__.py,sha256=YJ1ttWgD4FLjY2bjqV_xGez8xd8-0ls3oIMKaJ7UwcY,8954 +torch/distributed/elastic/multiprocessing/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/elastic/multiprocessing/__pycache__/api.cpython-312.pyc,, +torch/distributed/elastic/multiprocessing/__pycache__/redirects.cpython-312.pyc,, +torch/distributed/elastic/multiprocessing/__pycache__/tail_log.cpython-312.pyc,, +torch/distributed/elastic/multiprocessing/api.py,sha256=ZvK1lT0DhixDiMSVanCqmjzs2B1QFgFspHt19s-Odxw,39575 +torch/distributed/elastic/multiprocessing/errors/__init__.py,sha256=SIifPVwg2QFNYiWf-NWYg48kHztO7ItAfpFNz0B1gxk,15097 +torch/distributed/elastic/multiprocessing/errors/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/elastic/multiprocessing/errors/__pycache__/error_handler.cpython-312.pyc,, +torch/distributed/elastic/multiprocessing/errors/__pycache__/handlers.cpython-312.pyc,, +torch/distributed/elastic/multiprocessing/errors/error_handler.py,sha256=zP6M7OYwz0vDV7Brz_faSQ8uUYE34pd3hVBwD90GjcA,6845 +torch/distributed/elastic/multiprocessing/errors/handlers.py,sha256=n0SzDw51fxKuFsNbNCkonhmzao-fZ_KoUq3ipRZ-nGs,482 +torch/distributed/elastic/multiprocessing/redirects.py,sha256=M6kca0OhxlblpEvq8FSsZfZ6KuqxbM_VrlV65GRrLhA,2868 +torch/distributed/elastic/multiprocessing/subprocess_handler/__init__.py,sha256=ch8Cj7Mamh9UeiXgVwvn-DfiZA7pSZpz42BqNOjBde4,539 +torch/distributed/elastic/multiprocessing/subprocess_handler/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/elastic/multiprocessing/subprocess_handler/__pycache__/handlers.cpython-312.pyc,, +torch/distributed/elastic/multiprocessing/subprocess_handler/__pycache__/subprocess_handler.cpython-312.pyc,, +torch/distributed/elastic/multiprocessing/subprocess_handler/handlers.py,sha256=NcBtfZf1fE-xbn46xiuOJWxsaql0LMqJzCfYAG_Fz_M,882 +torch/distributed/elastic/multiprocessing/subprocess_handler/subprocess_handler.py,sha256=744k2calx3YlnMHkEa3VdyG2iIeJ9aOijmB43Sn2n9E,2818 +torch/distributed/elastic/multiprocessing/tail_log.py,sha256=KGgGykT0CD4d5j796e0xBY97WCRvPqjkM-CsWrzodnk,5488 +torch/distributed/elastic/rendezvous/__init__.py,sha256=cBTBUfhgLe8PhIpBTm61KRWd-fOHwjfELL2qSLinLng,6432 +torch/distributed/elastic/rendezvous/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/elastic/rendezvous/__pycache__/_etcd_stub.cpython-312.pyc,, +torch/distributed/elastic/rendezvous/__pycache__/api.cpython-312.pyc,, +torch/distributed/elastic/rendezvous/__pycache__/c10d_rendezvous_backend.cpython-312.pyc,, +torch/distributed/elastic/rendezvous/__pycache__/dynamic_rendezvous.cpython-312.pyc,, +torch/distributed/elastic/rendezvous/__pycache__/etcd_rendezvous.cpython-312.pyc,, +torch/distributed/elastic/rendezvous/__pycache__/etcd_rendezvous_backend.cpython-312.pyc,, +torch/distributed/elastic/rendezvous/__pycache__/etcd_server.cpython-312.pyc,, +torch/distributed/elastic/rendezvous/__pycache__/etcd_store.cpython-312.pyc,, +torch/distributed/elastic/rendezvous/__pycache__/registry.cpython-312.pyc,, +torch/distributed/elastic/rendezvous/__pycache__/static_tcp_rendezvous.cpython-312.pyc,, +torch/distributed/elastic/rendezvous/__pycache__/utils.cpython-312.pyc,, +torch/distributed/elastic/rendezvous/_etcd_stub.py,sha256=O9B2g2ipg-P7cJH8WvsWrYkaRBQJxbLcm9wKWJUl7ss,2073 +torch/distributed/elastic/rendezvous/api.py,sha256=k_No3CoV2LUjolrnUgGCzWRy0c2oI9bacWET0NFtHrE,13475 +torch/distributed/elastic/rendezvous/c10d_rendezvous_backend.py,sha256=zX4uRhK-MqR0sV1iN00SZz5im_C3C8JCMIeasLUhzK8,11008 +torch/distributed/elastic/rendezvous/dynamic_rendezvous.py,sha256=taAcH_uB1m1I_R_BGSnXt3DSS4_2LDpu5sEo_59YcUs,50829 +torch/distributed/elastic/rendezvous/etcd_rendezvous.py,sha256=lWA_-yQ6Txv5FkUTYuf2Y5xQlvlyfBsN8GCHwtO-HbE,44586 +torch/distributed/elastic/rendezvous/etcd_rendezvous_backend.py,sha256=o7L9Q7zHM0B7Kw3PpKmo_yWw3dXxfrIObOTGSRS7mJA,7562 +torch/distributed/elastic/rendezvous/etcd_server.py,sha256=gogbiJM-KyM0P391MZv1H-29y8nTVVaQ1tteMrnCAn4,8663 +torch/distributed/elastic/rendezvous/etcd_store.py,sha256=iaQZgjT-60lGgYWWv2hKvmZMzSomBbvr57n1pJSF-xg,7436 +torch/distributed/elastic/rendezvous/registry.py,sha256=BjRWEVmQPuUCs_8d4NH_saRTSbDFX8EC5zkiNy4pzq0,3017 +torch/distributed/elastic/rendezvous/static_tcp_rendezvous.py,sha256=XUwaW3lMvzKuwe6aldw1crpOKlXslSou8y-WjMbzFcE,3780 +torch/distributed/elastic/rendezvous/utils.py,sha256=DXF7kbnS0dYyEmnUM-KSdo-L7aIY3F44jrnPWISFRTo,8658 +torch/distributed/elastic/timer/__init__.py,sha256=vh5LGpZfIfvcRSca6cMhWT6m30YPW7YxIR8s7fWpF2w,1804 +torch/distributed/elastic/timer/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/elastic/timer/__pycache__/api.cpython-312.pyc,, +torch/distributed/elastic/timer/__pycache__/debug_info_logging.cpython-312.pyc,, +torch/distributed/elastic/timer/__pycache__/file_based_local_timer.cpython-312.pyc,, +torch/distributed/elastic/timer/__pycache__/local_timer.cpython-312.pyc,, +torch/distributed/elastic/timer/api.py,sha256=wGMwAfYbLYiaRV4oIX4yxu6cqAVoKMRGuPacQIYRVpo,9839 +torch/distributed/elastic/timer/debug_info_logging.py,sha256=Cl88jOhn-HOHoIDmCJ30UfhpNHQnTKCO_QR5ExEuMiA,634 +torch/distributed/elastic/timer/file_based_local_timer.py,sha256=F1UW7ee0lKYW_iaGX3vNOG9B6Z4WijMpvAfMuw0WcS4,16833 +torch/distributed/elastic/timer/local_timer.py,sha256=je10qNexBMCoc7OFokTxVnGCC7jmJvIwEPhS75QNWD0,4410 +torch/distributed/elastic/utils/__init__.py,sha256=tUTWXyJ9Fd67kIGlH9Lv_G0qNPSv2GjzOIts1uZop50,327 +torch/distributed/elastic/utils/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/elastic/utils/__pycache__/api.cpython-312.pyc,, +torch/distributed/elastic/utils/__pycache__/distributed.cpython-312.pyc,, +torch/distributed/elastic/utils/__pycache__/log_level.cpython-312.pyc,, +torch/distributed/elastic/utils/__pycache__/logging.cpython-312.pyc,, +torch/distributed/elastic/utils/__pycache__/store.cpython-312.pyc,, +torch/distributed/elastic/utils/api.py,sha256=GWTQS0CYilyDEK0s8r85MSRZCUDvrzjf0E2KPel4IF8,1767 +torch/distributed/elastic/utils/data/__init__.py,sha256=SAnEMDWeN7az6Keywbq5hzReYUH2CtnatIkMOuiB0Wc,382 +torch/distributed/elastic/utils/data/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/elastic/utils/data/__pycache__/cycling_iterator.cpython-312.pyc,, +torch/distributed/elastic/utils/data/__pycache__/elastic_distributed_sampler.cpython-312.pyc,, +torch/distributed/elastic/utils/data/cycling_iterator.py,sha256=qN94DZgMIjhw2n6TQ7AbPRHmSif8fhLt7AY7ytEBkMI,1700 +torch/distributed/elastic/utils/data/elastic_distributed_sampler.py,sha256=2KdI3q3hZDbXI3820bMZMik8fbkzjMF8rIajC7oLYZo,3149 +torch/distributed/elastic/utils/distributed.py,sha256=0PILmi5_dohW0eulTeFtOVKSLJFvm_T0GLhglnRlSok,6075 +torch/distributed/elastic/utils/log_level.py,sha256=XU53rCS6i_d1O-_Iz4TRBE-Iup_Qe1hvgBHGzzFdXt4,353 +torch/distributed/elastic/utils/logging.py,sha256=2GmNCHOKeUhOkcS0uwFTOFM5lD6dDszo8jpCh738oEs,2329 +torch/distributed/elastic/utils/store.py,sha256=RoXas3seqLJgaPioMMOE24y_ufjLKs2fet8cmWJduz8,7466 +torch/distributed/flight_recorder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/distributed/flight_recorder/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/flight_recorder/__pycache__/fr_trace.cpython-312.pyc,, +torch/distributed/flight_recorder/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/distributed/flight_recorder/components/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/flight_recorder/components/__pycache__/builder.cpython-312.pyc,, +torch/distributed/flight_recorder/components/__pycache__/config_manager.cpython-312.pyc,, +torch/distributed/flight_recorder/components/__pycache__/fr_logger.cpython-312.pyc,, +torch/distributed/flight_recorder/components/__pycache__/loader.cpython-312.pyc,, +torch/distributed/flight_recorder/components/__pycache__/types.cpython-312.pyc,, +torch/distributed/flight_recorder/components/__pycache__/utils.cpython-312.pyc,, +torch/distributed/flight_recorder/components/builder.py,sha256=0MwlCM7oW3T51EjTaq0HjqAlLEBdAOqaKrv_y9ndoV8,18373 +torch/distributed/flight_recorder/components/config_manager.py,sha256=D8mBYgxzHA3-hLqJsY6lkdEIkHEKDwGA9RZneeeo0jA,4016 +torch/distributed/flight_recorder/components/fr_logger.py,sha256=fQWC0RuSmlQ971H92EAUkN6Bl7aaMWaergRu2N1i1EA,1582 +torch/distributed/flight_recorder/components/loader.py,sha256=9JLWUYT-UH8nWy5mHnCWj4xeUgvjXIYYyFAkAdWnwIo,2994 +torch/distributed/flight_recorder/components/types.py,sha256=Yp2EEOCDduJG8wHiLzUxekEek-aWegFV9qQgC0kqTGo,23455 +torch/distributed/flight_recorder/components/utils.py,sha256=fxjnh9PBzB9xXnuJuJRxz5kKOLN0xpEs3IjSAnjTLw8,30219 +torch/distributed/flight_recorder/fr_trace.py,sha256=y6g6-pIGebmafW_BPuSRCcvOktAlVrXI97M2uu0ByFE,3069 +torch/distributed/fsdp/__init__.py,sha256=BjjX48MN7sdia-ybPWMof9BEqZ09vsWNiqRNCakVeOI,1904 +torch/distributed/fsdp/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_common_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_debug_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_dynamo_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_exec_order_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_flat_param.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_fsdp_extensions.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_init_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_limiter_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_optim_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_runtime_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_shard_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_state_dict_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_trace_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_traversal_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_unshard_param_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/_wrap_utils.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/api.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/fully_sharded_data_parallel.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/sharded_grad_scaler.cpython-312.pyc,, +torch/distributed/fsdp/__pycache__/wrap.cpython-312.pyc,, +torch/distributed/fsdp/_common_utils.py,sha256=yWVJVlnYD62GeL8FKoxV43S_zf-YIR9cEIlFtregHLk,23097 +torch/distributed/fsdp/_debug_utils.py,sha256=I0EUlAwbLM1PQ3d_-m7YgL96H3K4i5eZwTtLnxRpw5o,5977 +torch/distributed/fsdp/_dynamo_utils.py,sha256=5wfQqx7RfMgSY7-RsQdLSRGv2pVX4cWPqxZZVEeFbzA,2674 +torch/distributed/fsdp/_exec_order_utils.py,sha256=afOgrnvSvOnw4p2uwknMT3MGX0WpZVI66ukBmVJMsj4,16534 +torch/distributed/fsdp/_flat_param.py,sha256=HtWDNPiPoJD93yUHP8Kco0hQCpfZmuiyjGueW4cozkE,129112 +torch/distributed/fsdp/_fsdp_extensions.py,sha256=HfXwnFATaaMy1Abc8L4BBsGyV3HQ73xU5FfzG1jgJ6Y,5213 +torch/distributed/fsdp/_fully_shard/__init__.py,sha256=qqYlzT2bT9aO0UvpHuiu91OJ6agC7GhVDGtVLrNQpD8,438 +torch/distributed/fsdp/_fully_shard/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/fsdp/_fully_shard/__pycache__/_fsdp_api.cpython-312.pyc,, +torch/distributed/fsdp/_fully_shard/__pycache__/_fsdp_collectives.cpython-312.pyc,, +torch/distributed/fsdp/_fully_shard/__pycache__/_fsdp_common.cpython-312.pyc,, +torch/distributed/fsdp/_fully_shard/__pycache__/_fsdp_init.cpython-312.pyc,, +torch/distributed/fsdp/_fully_shard/__pycache__/_fsdp_param.cpython-312.pyc,, +torch/distributed/fsdp/_fully_shard/__pycache__/_fsdp_param_group.cpython-312.pyc,, +torch/distributed/fsdp/_fully_shard/__pycache__/_fsdp_state.cpython-312.pyc,, +torch/distributed/fsdp/_fully_shard/__pycache__/_fully_shard.cpython-312.pyc,, +torch/distributed/fsdp/_fully_shard/_fsdp_api.py,sha256=U3AdnxGNxS55_nLZA31MjpgY6FtKqaRjEc34NKpNw8M,5597 +torch/distributed/fsdp/_fully_shard/_fsdp_collectives.py,sha256=7Jt4zeSrF22fqRCnnxLZA6q2JZAc0MLap0zRFr8MrHI,30588 +torch/distributed/fsdp/_fully_shard/_fsdp_common.py,sha256=I1s-0sIpU7JznArjjeQQXLNwP5gFg_0p--eCPlzNsfw,5951 +torch/distributed/fsdp/_fully_shard/_fsdp_init.py,sha256=DzHkcPsawgY3a9NoOfQwJzuzN6Se_BUikukHU2MMcsw,9427 +torch/distributed/fsdp/_fully_shard/_fsdp_param.py,sha256=W-P6OdYZKeXcpeiD3gEw-gD_L8k16lXUhxe-p8qEXZw,46055 +torch/distributed/fsdp/_fully_shard/_fsdp_param_group.py,sha256=ZFQni5cKIZN4MLY6XgcmZXoABeeY2p_Vv4hwBaF2pQM,41331 +torch/distributed/fsdp/_fully_shard/_fsdp_state.py,sha256=cAp1XalQOs_KxSAeCOHPAytIBFxg9Fvx8J_24016cYA,18457 +torch/distributed/fsdp/_fully_shard/_fully_shard.py,sha256=7YKmI-RS6NXloTER1KYJisVSPzFPEVtS_VWXLIqvMQ4,33881 +torch/distributed/fsdp/_init_utils.py,sha256=tOIPnNScCF9Qgc-2dzW8wVBNZJNfzri4LGaNNQ8TIdY,48279 +torch/distributed/fsdp/_limiter_utils.py,sha256=2vinVgT6BalDbCTKABgCstpDCGxl94nm47E1G_qxO0s,1119 +torch/distributed/fsdp/_optim_utils.py,sha256=LIoTHzyF-y33U2AXP4lgL_tgEpHLMZG6rP0tQ7wtA0o,92571 +torch/distributed/fsdp/_runtime_utils.py,sha256=Bdu9zEexmp6qJsvUFoQUUPRq3Bvf8_ceWHxvqbwZcQQ,68619 +torch/distributed/fsdp/_shard_utils.py,sha256=eK9daKML7O46glMV8Pk0AZy2vYeLtsTBsu23A5JiJOk,5002 +torch/distributed/fsdp/_state_dict_utils.py,sha256=-SEYyATgCCr8RMV88dP8_9vxcPXoNNdOUG-kW3Atxzs,35669 +torch/distributed/fsdp/_trace_utils.py,sha256=1-L1xlLIkjifpfJWSlIxXvP0TYqQKVXUmgxFvL3HOqo,11063 +torch/distributed/fsdp/_traversal_utils.py,sha256=I7av2W1foK7nHcKYE4ehsiH1EhyP1keNMvhvLuxtSA4,4722 +torch/distributed/fsdp/_unshard_param_utils.py,sha256=9uDuuldHB0MnLmZ2MS4xyq2ruedUW-WwFqEq88uVnG0,12003 +torch/distributed/fsdp/_wrap_utils.py,sha256=Cff-vgRPW22tR_YHgk6fmqT_bA5hIuVNnRN2mYWWKsA,11223 +torch/distributed/fsdp/api.py,sha256=Ze9_vkpMquSeR6JAwjcIQ8QjwJ-bgy01KMEu9dW8wzU,19392 +torch/distributed/fsdp/fully_sharded_data_parallel.py,sha256=wLBdUESiVuq2U9-z_Em3Bsy90AiQw4-KGo8fG_3-qHg,103485 +torch/distributed/fsdp/sharded_grad_scaler.py,sha256=kC5JpDDGVIcuL7mZ39lJOuJ-Vk74szFZgNtP-2p_8N0,17481 +torch/distributed/fsdp/wrap.py,sha256=-okaj1PeOnLzpP67TGPKW1_jkBFdT4-zqtV-r_osGs8,23762 +torch/distributed/launch.py,sha256=wKfJduKs2hFmzU3Ry7b0r5mesOkEdi1lYnUu0PmmQmY,7802 +torch/distributed/launcher/__init__.py,sha256=C63mqEEdfXL6c0fKxb8XMOAA5DQm28pvC-Y6EtiFKnY,363 +torch/distributed/launcher/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/launcher/__pycache__/api.cpython-312.pyc,, +torch/distributed/launcher/api.py,sha256=kYf_PLB2ZnPE9C7phdu5PEk8O1gnrot3iTf3qafbB9o,14123 +torch/distributed/logging_handlers.py,sha256=TlQ6zgFzEXDyRX30awgGptSNGaPvhdBii_AMUtV8Vxw,375 +torch/distributed/nn/__init__.py,sha256=rT2varq7EORrQ1fq7hl6VAaULUlo9wcFS3AvGw-tt2g,152 +torch/distributed/nn/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/nn/__pycache__/functional.cpython-312.pyc,, +torch/distributed/nn/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/distributed/nn/api/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/nn/api/__pycache__/remote_module.cpython-312.pyc,, +torch/distributed/nn/api/remote_module.py,sha256=9Reyda45ANZTumk8NO0VIVDLQQpl-KzUWAgqYgFEdJw,32596 +torch/distributed/nn/functional.py,sha256=Qw7FkvrjE8Uq2S_dvuuxx2VwzH58K56CbH-ApuPGLRc,16313 +torch/distributed/nn/jit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/distributed/nn/jit/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/nn/jit/__pycache__/instantiator.cpython-312.pyc,, +torch/distributed/nn/jit/instantiator.py,sha256=WmfoS9SEOIx4ixvpx1iVJgvk03ogOEbR70gS7m7DLzE,5030 +torch/distributed/nn/jit/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/distributed/nn/jit/templates/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/nn/jit/templates/__pycache__/remote_module_template.cpython-312.pyc,, +torch/distributed/nn/jit/templates/remote_module_template.py,sha256=Kdt3GxUr-0oy4S4x9D43MPn6MmBSMvvR_hJqB2IkPZg,3571 +torch/distributed/optim/__init__.py,sha256=XaERShuW8bi8HE3Hc3IcWRNpWopXEHH0S3fttiLUON0,1484 +torch/distributed/optim/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/optim/__pycache__/_deprecation_warning.cpython-312.pyc,, +torch/distributed/optim/__pycache__/apply_optimizer_in_backward.cpython-312.pyc,, +torch/distributed/optim/__pycache__/functional_adadelta.cpython-312.pyc,, +torch/distributed/optim/__pycache__/functional_adagrad.cpython-312.pyc,, +torch/distributed/optim/__pycache__/functional_adam.cpython-312.pyc,, +torch/distributed/optim/__pycache__/functional_adamax.cpython-312.pyc,, +torch/distributed/optim/__pycache__/functional_adamw.cpython-312.pyc,, +torch/distributed/optim/__pycache__/functional_rmsprop.cpython-312.pyc,, +torch/distributed/optim/__pycache__/functional_rprop.cpython-312.pyc,, +torch/distributed/optim/__pycache__/functional_sgd.cpython-312.pyc,, +torch/distributed/optim/__pycache__/named_optimizer.cpython-312.pyc,, +torch/distributed/optim/__pycache__/optimizer.cpython-312.pyc,, +torch/distributed/optim/__pycache__/post_localSGD_optimizer.cpython-312.pyc,, +torch/distributed/optim/__pycache__/utils.cpython-312.pyc,, +torch/distributed/optim/__pycache__/zero_redundancy_optimizer.cpython-312.pyc,, +torch/distributed/optim/_deprecation_warning.py,sha256=fBIq67Fwa8ctxVsAPCiPF_S52-6oK5zB5fldvXykTOI,563 +torch/distributed/optim/apply_optimizer_in_backward.py,sha256=8uEDlD1xLBt8OVNQGmXD25mIULvoEzq8Hg8azfOLngg,5335 +torch/distributed/optim/functional_adadelta.py,sha256=EhRnJU9lRI_lmE0KP0giZ2uUztnuAJ7AZN38k1FHo40,4033 +torch/distributed/optim/functional_adagrad.py,sha256=EcY4OqCPMUS5uHSqfZTz4j6lmcXfK6OCN3MBVHq0f8M,4387 +torch/distributed/optim/functional_adam.py,sha256=RtcCuHgUap6bVKKXduybEL_EYxTKoHXibb0hNbdoNDU,7592 +torch/distributed/optim/functional_adamax.py,sha256=9szTDmNf9G0FmRmRV352s5vGhOwVYb1ANQ0m1_j6aYU,4742 +torch/distributed/optim/functional_adamw.py,sha256=pAXvXvtLmJKnmn_j5fQobzWF-ZsUAUTrR_rEMxqFEmQ,7713 +torch/distributed/optim/functional_rmsprop.py,sha256=lpr0uN2yfRieRRcwT8wfZ3N0crjmEh74g10poyqXjHI,4782 +torch/distributed/optim/functional_rprop.py,sha256=sGEcaSKLt6Z2UwOy88O4BY9h0VNUg7C-dMUtMWzWmbI,3913 +torch/distributed/optim/functional_sgd.py,sha256=f5ZELjverPbyNMAL6HQQgBpLcZQ62xShmqtdqSxCxxU,6063 +torch/distributed/optim/named_optimizer.py,sha256=NucprljlNSYGmr0Iv_t1D36DTAG4voUKCZ3IeKhbPp0,14302 +torch/distributed/optim/optimizer.py,sha256=I4Iqw5IOGSwveGx7Yfiz1LEBk1MW1lT9wl-S7rVvmBw,10010 +torch/distributed/optim/post_localSGD_optimizer.py,sha256=0wzZjhpcZ_bi8GfgBtQ6h4inGdQmTclq312V2ilELmo,4609 +torch/distributed/optim/utils.py,sha256=rXAeyMs8VONBi6d3TSWlZzaPmUgkLLuQaqNns8QIiEs,2303 +torch/distributed/optim/zero_redundancy_optimizer.py,sha256=bSQt73EZMyvdwcOedmBl9220HDH-fKsQRPSGmCpVzQA,74520 +torch/distributed/optim/zero_redundancy_optimizer.pyi,sha256=BGWHVC6l0eZru1XHgY35IlkxeLc758CWAlD04vXrtnY,2919 +torch/distributed/pipelining/_IR.py,sha256=VmZlWmD9QVZK9_uac09gMGlu2QWdv-ERRa6e5xxuU7I,50776 +torch/distributed/pipelining/__init__.py,sha256=60WBaVHHycQfASbeWl7xcVE8fdDj-5Ik3Sn1_8kHI5c,719 +torch/distributed/pipelining/__pycache__/_IR.cpython-312.pyc,, +torch/distributed/pipelining/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/pipelining/__pycache__/_backward.cpython-312.pyc,, +torch/distributed/pipelining/__pycache__/_debug.cpython-312.pyc,, +torch/distributed/pipelining/__pycache__/_schedule_visualizer.cpython-312.pyc,, +torch/distributed/pipelining/__pycache__/_unflatten.cpython-312.pyc,, +torch/distributed/pipelining/__pycache__/_utils.cpython-312.pyc,, +torch/distributed/pipelining/__pycache__/microbatch.cpython-312.pyc,, +torch/distributed/pipelining/__pycache__/schedules.cpython-312.pyc,, +torch/distributed/pipelining/__pycache__/stage.cpython-312.pyc,, +torch/distributed/pipelining/_backward.py,sha256=NTpeH3OaoE-0he6O1QSwgbGWfcuYSeOJucIkIqZzHcY,17065 +torch/distributed/pipelining/_debug.py,sha256=hreZ3Kq-c7t2OIPBxieVTDNm8ASZpTnCaarnSzW4jC8,630 +torch/distributed/pipelining/_schedule_visualizer.py,sha256=jbbmDRYhFmSRwApJO1m4w6WDSP45n2HqVilTpwrYvTQ,17188 +torch/distributed/pipelining/_unflatten.py,sha256=jJP3X5glRBRzxAB12ijFwJk_sbnVs73XazHVmTgQgPI,982 +torch/distributed/pipelining/_utils.py,sha256=2eDg1cuLwRYMZHs6kneMB605dC3bgNmSneH1Fge4Sws,4826 +torch/distributed/pipelining/microbatch.py,sha256=ll0CjcUmD0Vloto0kelzx5m7wf5S13SYcD994cAn9jw,18555 +torch/distributed/pipelining/schedules.py,sha256=zaen_h7Uczjwr9z9DiMSOneZjU-ePfExFgdQaSCd2UE,145034 +torch/distributed/pipelining/stage.py,sha256=uZdBArKy8vTxSTRn-CVGikeyq_TWAlF8IeJ_JOm6U9s,65975 +torch/distributed/remote_device.py,sha256=DFxBqW1dsFbd7tKm_M5EoDvblIah48hJwF3lZuodY7s,4828 +torch/distributed/rendezvous.py,sha256=zSATl0R1YViU18NsPEYaIoytHbYE2-UbUahbFof3w5s,10608 +torch/distributed/rpc/__init__.py,sha256=SRsUzWZLdYoLuT2fIoT5Q2MwgOZghUm_KFMWbuQbSD4,10202 +torch/distributed/rpc/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/rpc/__pycache__/_utils.cpython-312.pyc,, +torch/distributed/rpc/__pycache__/api.cpython-312.pyc,, +torch/distributed/rpc/__pycache__/backend_registry.cpython-312.pyc,, +torch/distributed/rpc/__pycache__/constants.cpython-312.pyc,, +torch/distributed/rpc/__pycache__/functions.cpython-312.pyc,, +torch/distributed/rpc/__pycache__/internal.cpython-312.pyc,, +torch/distributed/rpc/__pycache__/options.cpython-312.pyc,, +torch/distributed/rpc/__pycache__/rref_proxy.cpython-312.pyc,, +torch/distributed/rpc/__pycache__/server_process_global_profiler.cpython-312.pyc,, +torch/distributed/rpc/_testing/__init__.py,sha256=igpNeyZ8dzHs9oo9YCXtJ2YE4haiH9XK2GPw9L4ocmo,497 +torch/distributed/rpc/_testing/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/rpc/_testing/__pycache__/faulty_agent_backend_registry.cpython-312.pyc,, +torch/distributed/rpc/_testing/faulty_agent_backend_registry.py,sha256=m6TJSTXVA063XVAYeDQ9ZRvWHaDmGeXXzyRIlhv_p1E,1701 +torch/distributed/rpc/_utils.py,sha256=bA-93SM5MU6KLg24KEW_hV-OYKoVIE5keJCK0_wLfRY,1696 +torch/distributed/rpc/api.py,sha256=QGJ0E3QgP9Vjg5hcpi75oY_ECwIP6NF_HCI0PkBMyys,38002 +torch/distributed/rpc/backend_registry.py,sha256=MWs7_yZhq2_BI3Q1jEWiu_JRYziw8KTMe3D2Ygh_A8I,16710 +torch/distributed/rpc/constants.py,sha256=oJTKportdDFWqLpj0BK0LR1VNO_lBINjtKBSdBBGFJw,828 +torch/distributed/rpc/functions.py,sha256=jXJmab8tseRiT-x2DbdMqyGcujL5aFAgGTTWzHnP2l4,7441 +torch/distributed/rpc/internal.py,sha256=IAa3KD_zNs1fkjTTPIzGh7U8DRUCwK6Gqgek1wiGydk,11404 +torch/distributed/rpc/options.py,sha256=5lWDj83DCvjhz4oBIUebHC0ye98zYoYX5snEGSxH-54,7430 +torch/distributed/rpc/rref_proxy.py,sha256=ITAVTjKZ2ZuC85zVs4jXJSU06rH3dkhJMZDkwxZr_5Y,2785 +torch/distributed/rpc/server_process_global_profiler.py,sha256=O4aupGu-HNy_Wf_iM3Y5o72QkzGxW5bsWNe6cYJcF2E,8756 +torch/distributed/run.py,sha256=KIuDkR1YvY07TVMYncZQtAiBxslqbAvEklbFT9_9gcc,36841 +torch/distributed/tensor/__init__.py,sha256=svQyCVeVIchUokmcbjiwkDkXV2yI5LoKwJFCLe_rBLg,2337 +torch/distributed/tensor/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/_api.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/_argmin_argmax.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/_collective_utils.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/_dispatch.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/_dtensor_spec.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/_op_schema.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/_random.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/_redistribute.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/_sharding_prop.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/_shards_wrapper.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/_tp_conv.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/_utils.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/device_mesh.cpython-312.pyc,, +torch/distributed/tensor/__pycache__/placement_types.cpython-312.pyc,, +torch/distributed/tensor/_api.py,sha256=tXWXtkOw67l-kvjEavQWUtXdjp63oeG5P5EcuOcbNAI,61824 +torch/distributed/tensor/_argmin_argmax.py,sha256=HzKgHboZoOo_Df47g5a9VFbgxsP4VoEwDbSUYcbaZBs,4518 +torch/distributed/tensor/_collective_utils.py,sha256=_M5a9-zcKRIc-Yx97IPaMNxwR9cia5RB5XTPMRqEKms,15447 +torch/distributed/tensor/_dispatch.py,sha256=7nogvLWqU4zuJx8KzMBcuUNc0vr2OLYcX7nLDigQ5vY,29464 +torch/distributed/tensor/_dtensor_spec.py,sha256=CLma7Gqy02y_csFDWNHUNJvBE6TQV2mxfVNq77NZPgM,31969 +torch/distributed/tensor/_op_schema.py,sha256=jOrdLiJwgwhm_drUe3X6PF64DkcWqmTubqOXNMix9LM,23661 +torch/distributed/tensor/_ops/__init__.py,sha256=56hg3LS8HtJYvn-hA5LobeEFPjFkfT9MoOim5z5bY9k,389 +torch/distributed/tensor/_ops/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/_common_rules.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/_conv_ops.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/_einsum_strategy.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/_embedding_ops.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/_mask_buffer.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/_math_ops.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/_matrix_ops.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/_pointwise_ops.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/_random_ops.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/_tensor_ops.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/_view_ops.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/registration.cpython-312.pyc,, +torch/distributed/tensor/_ops/__pycache__/utils.cpython-312.pyc,, +torch/distributed/tensor/_ops/_common_rules.py,sha256=LSmNa1Fdc3C7NNz70Fi6KTIcsHFMerfqn8C5AIjCDXY,12234 +torch/distributed/tensor/_ops/_conv_ops.py,sha256=I8VTCA4sbvpwDQeZF_-x397KWT7a5gYSkUmd-wKKmHw,4419 +torch/distributed/tensor/_ops/_einsum_strategy.py,sha256=75QxI1Y__QE0GkFD0aK9e1eTLQo2OQEhZpCXJN70aBY,7361 +torch/distributed/tensor/_ops/_embedding_ops.py,sha256=IwuOKPm8zpGxwy3XvXfoplXRYCOOZdXfL9VNPwM7uno,4438 +torch/distributed/tensor/_ops/_mask_buffer.py,sha256=UAvD7CbhdjvMjiG7I0gdm7Zmwz4WnmfRVG_EmNoH2mQ,1575 +torch/distributed/tensor/_ops/_math_ops.py,sha256=e8WORxfQPA1DkyiCu8gEiHMNLVPBYH-Vk3TYsbJBNTI,55743 +torch/distributed/tensor/_ops/_matrix_ops.py,sha256=ly_-KgL8R046Na9H9orIGzVA0W1Bt68rLN3MpwxvpPI,40686 +torch/distributed/tensor/_ops/_pointwise_ops.py,sha256=d17UnM2cv_rGp8BulzueWcdnhUh_q0b6yheRjM66rmU,26972 +torch/distributed/tensor/_ops/_random_ops.py,sha256=pH06hrd-l5ZRHNORNKJzVLK8y4asi2yhJsoZS_qDfVc,1353 +torch/distributed/tensor/_ops/_tensor_ops.py,sha256=ZWi-UUUQT2YnQ19Kgc9IBHijVxsU-5a-IzG7fx9j2Sg,53273 +torch/distributed/tensor/_ops/_view_ops.py,sha256=a-uAgkI_yBN9OQdu-GyIqHn0zIlLEkrXEHUl960pD1c,30627 +torch/distributed/tensor/_ops/registration.py,sha256=2vQa7qk89A6qwUyMSi_TE64hmAIwoboO1-k7gdwnEVw,3166 +torch/distributed/tensor/_ops/utils.py,sha256=YMiKKFgTuTEZd3nZYjhRLR4zGsHeYnMIEDth2zfOKE8,15513 +torch/distributed/tensor/_random.py,sha256=UdtwG2EXt5-nTyF8v47mDnbVs64DHtLtXqE9PnIku5A,20427 +torch/distributed/tensor/_redistribute.py,sha256=RZmMUirhPaZI4iGE_GUsckqT2vPmr9mr9N2YWvv3iDE,46039 +torch/distributed/tensor/_sharding_prop.py,sha256=gYd6TiNOk7_WPsmd8Q3JHR7S9M7P0Mau8_Zq5aaS-LQ,31731 +torch/distributed/tensor/_shards_wrapper.py,sha256=RG8LoQlGJz1vOuYZTrWKdtFRl_wAog37zncC3SpDcUs,13837 +torch/distributed/tensor/_tp_conv.py,sha256=3UFjExUbo2Rp0PIbVy1wJOrnZv2YPHYfjEf2sQ4KxeI,10994 +torch/distributed/tensor/_utils.py,sha256=DVm5V2aLvaX2RLdHuESqUYqH8p1kYQhKP02g7t2LwJo,18720 +torch/distributed/tensor/debug/__init__.py,sha256=jMrxHt3nkMHbK8E0fqULaLHzaVuHJmpXpwJJ2IpxP6U,1859 +torch/distributed/tensor/debug/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/tensor/debug/__pycache__/_comm_mode.cpython-312.pyc,, +torch/distributed/tensor/debug/__pycache__/_op_coverage.cpython-312.pyc,, +torch/distributed/tensor/debug/__pycache__/_visualize_sharding.cpython-312.pyc,, +torch/distributed/tensor/debug/_comm_mode.py,sha256=f8pq2nUSXEi3dMjIU1wtt5E2iaSYYe_dlBcWOJrc8fU,29715 +torch/distributed/tensor/debug/_op_coverage.py,sha256=5l62h8FANs9whbgbuJtMkAcP9IKNInzMCBJRHvgsglI,3344 +torch/distributed/tensor/debug/_visualize_sharding.py,sha256=mZomw2__cDx5_CYmC2a80EB0qQrLHcTfx8w_Fz4sTvE,7776 +torch/distributed/tensor/device_mesh.py,sha256=WmVZoV1gmNbdpIPJm-7BWJba8WDtfwbQlTjswMiTBrI,199 +torch/distributed/tensor/experimental/__init__.py,sha256=m1nj4z-5TaSBIP-7Uhe_kbdXVnv2zAYD84ph8cC9tb8,1458 +torch/distributed/tensor/experimental/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/tensor/experimental/__pycache__/_attention.cpython-312.pyc,, +torch/distributed/tensor/experimental/__pycache__/_func_map.cpython-312.pyc,, +torch/distributed/tensor/experimental/__pycache__/_register_sharding.cpython-312.pyc,, +torch/distributed/tensor/experimental/__pycache__/_tp_transform.cpython-312.pyc,, +torch/distributed/tensor/experimental/_attention.py,sha256=r-byX4Ym3rA8_ZQl-loOyNcUc0p6L2vP5W08MmJgCgU,1273 +torch/distributed/tensor/experimental/_context_parallel/__init__.py,sha256=XO8jYNVld4QkJbl_L1H8fMf6V_FVwkFAkKluq2nmAi4,1176 +torch/distributed/tensor/experimental/_context_parallel/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/tensor/experimental/_context_parallel/__pycache__/_attention.cpython-312.pyc,, +torch/distributed/tensor/experimental/_context_parallel/__pycache__/_cp_custom_ops.cpython-312.pyc,, +torch/distributed/tensor/experimental/_context_parallel/__pycache__/_load_balancer.cpython-312.pyc,, +torch/distributed/tensor/experimental/_context_parallel/__pycache__/_sharding_rules.cpython-312.pyc,, +torch/distributed/tensor/experimental/_context_parallel/_attention.py,sha256=rxzB1q5DEQqpU7ejgurAqP50mWbXB17RRCB5WieDCno,62208 +torch/distributed/tensor/experimental/_context_parallel/_cp_custom_ops.py,sha256=wXDw4p42h7hP44mMDxnjku4Po4ycPDh6EqS8Ah46ljw,3057 +torch/distributed/tensor/experimental/_context_parallel/_load_balancer.py,sha256=AqNycN9ROrdZGE0OL4lOnmy6MoLh5TTKC9vLyd1ajxQ,23206 +torch/distributed/tensor/experimental/_context_parallel/_sharding_rules.py,sha256=va9TGS9OkQaw82eONi1DrqvczRGu8gnguFD655TUGhs,14187 +torch/distributed/tensor/experimental/_func_map.py,sha256=dOCZCfrou8dRRFKNnxahD5kyakVqZNih7q3E5gtgU0c,12385 +torch/distributed/tensor/experimental/_register_sharding.py,sha256=IMaUtS8LgnptpLXogK8kyckmScnXyWWRfj5rTRPrzXs,5772 +torch/distributed/tensor/experimental/_tp_transform.py,sha256=Hu00IAGsN4x8kg3f5kupEP6asXklNjQN08DFFkgLzxE,20994 +torch/distributed/tensor/parallel/__init__.py,sha256=1jpJR1PUtf58TkmaDCu3A_4LW_Q81q5c82aQCdnV_E8,668 +torch/distributed/tensor/parallel/__pycache__/__init__.cpython-312.pyc,, +torch/distributed/tensor/parallel/__pycache__/_data_parallel_utils.cpython-312.pyc,, +torch/distributed/tensor/parallel/__pycache__/api.cpython-312.pyc,, +torch/distributed/tensor/parallel/__pycache__/ddp.cpython-312.pyc,, +torch/distributed/tensor/parallel/__pycache__/fsdp.cpython-312.pyc,, +torch/distributed/tensor/parallel/__pycache__/input_reshard.cpython-312.pyc,, +torch/distributed/tensor/parallel/__pycache__/loss.cpython-312.pyc,, +torch/distributed/tensor/parallel/__pycache__/style.cpython-312.pyc,, +torch/distributed/tensor/parallel/_data_parallel_utils.py,sha256=CR5s7R5Mj46i83RcrtyynZpJJ0Ja-9HDLUdb_K2dsgY,1549 +torch/distributed/tensor/parallel/api.py,sha256=5tOz9Sw4yQp0wWWcmx-c5QAum0KXQ-Q9r_nrnNxWOcE,6618 +torch/distributed/tensor/parallel/ddp.py,sha256=FOYvH4EmifL6lwymt2nX8hlEk7IRcJ9Y54ytIIHJCu0,3826 +torch/distributed/tensor/parallel/fsdp.py,sha256=1LnrAYKVp7gJy6SKY107qFoOVcPeL5xNn-zoF3tH-so,14099 +torch/distributed/tensor/parallel/input_reshard.py,sha256=ayKdHnNzlByCK0ywNrgHG4A7l2XVmnEoDP35YJYL0D0,3846 +torch/distributed/tensor/parallel/loss.py,sha256=vcTZ_9XaFz4GCPLjrd0sqRom3NV5wQl7xVVEWOFiqsI,18952 +torch/distributed/tensor/parallel/style.py,sha256=Ad-Md9EJYi8QOwGRZdpPUtjzMSjO7LlT0xj05QI1H38,37919 +torch/distributed/tensor/placement_types.py,sha256=ec1xtlhm7GraScCZattRAqoidkwnVh55O_RYGXN81Yg,42898 +torch/distributed/utils.py,sha256=WRqEIDkATvmuizmWJtliBpy2EP1dbQQTbjIDfIOY2sw,14034 +torch/distributions/__init__.py,sha256=C63TUTaGfUf7T4oHRB02nqf81IKkmdJZSftk9KNey9o,6285 +torch/distributions/__pycache__/__init__.cpython-312.pyc,, +torch/distributions/__pycache__/bernoulli.cpython-312.pyc,, +torch/distributions/__pycache__/beta.cpython-312.pyc,, +torch/distributions/__pycache__/binomial.cpython-312.pyc,, +torch/distributions/__pycache__/categorical.cpython-312.pyc,, +torch/distributions/__pycache__/cauchy.cpython-312.pyc,, +torch/distributions/__pycache__/chi2.cpython-312.pyc,, +torch/distributions/__pycache__/constraint_registry.cpython-312.pyc,, +torch/distributions/__pycache__/constraints.cpython-312.pyc,, +torch/distributions/__pycache__/continuous_bernoulli.cpython-312.pyc,, +torch/distributions/__pycache__/dirichlet.cpython-312.pyc,, +torch/distributions/__pycache__/distribution.cpython-312.pyc,, +torch/distributions/__pycache__/exp_family.cpython-312.pyc,, +torch/distributions/__pycache__/exponential.cpython-312.pyc,, +torch/distributions/__pycache__/fishersnedecor.cpython-312.pyc,, +torch/distributions/__pycache__/gamma.cpython-312.pyc,, +torch/distributions/__pycache__/generalized_pareto.cpython-312.pyc,, +torch/distributions/__pycache__/geometric.cpython-312.pyc,, +torch/distributions/__pycache__/gumbel.cpython-312.pyc,, +torch/distributions/__pycache__/half_cauchy.cpython-312.pyc,, +torch/distributions/__pycache__/half_normal.cpython-312.pyc,, +torch/distributions/__pycache__/independent.cpython-312.pyc,, +torch/distributions/__pycache__/inverse_gamma.cpython-312.pyc,, +torch/distributions/__pycache__/kl.cpython-312.pyc,, +torch/distributions/__pycache__/kumaraswamy.cpython-312.pyc,, +torch/distributions/__pycache__/laplace.cpython-312.pyc,, +torch/distributions/__pycache__/lkj_cholesky.cpython-312.pyc,, +torch/distributions/__pycache__/log_normal.cpython-312.pyc,, +torch/distributions/__pycache__/logistic_normal.cpython-312.pyc,, +torch/distributions/__pycache__/lowrank_multivariate_normal.cpython-312.pyc,, +torch/distributions/__pycache__/mixture_same_family.cpython-312.pyc,, +torch/distributions/__pycache__/multinomial.cpython-312.pyc,, +torch/distributions/__pycache__/multivariate_normal.cpython-312.pyc,, +torch/distributions/__pycache__/negative_binomial.cpython-312.pyc,, +torch/distributions/__pycache__/normal.cpython-312.pyc,, +torch/distributions/__pycache__/one_hot_categorical.cpython-312.pyc,, +torch/distributions/__pycache__/pareto.cpython-312.pyc,, +torch/distributions/__pycache__/poisson.cpython-312.pyc,, +torch/distributions/__pycache__/relaxed_bernoulli.cpython-312.pyc,, +torch/distributions/__pycache__/relaxed_categorical.cpython-312.pyc,, +torch/distributions/__pycache__/studentT.cpython-312.pyc,, +torch/distributions/__pycache__/transformed_distribution.cpython-312.pyc,, +torch/distributions/__pycache__/transforms.cpython-312.pyc,, +torch/distributions/__pycache__/uniform.cpython-312.pyc,, +torch/distributions/__pycache__/utils.cpython-312.pyc,, +torch/distributions/__pycache__/von_mises.cpython-312.pyc,, +torch/distributions/__pycache__/weibull.cpython-312.pyc,, +torch/distributions/__pycache__/wishart.cpython-312.pyc,, +torch/distributions/bernoulli.py,sha256=rR-KexxkLnf85f35_8VXIpLCdg826K-d65JkwKf4rs4,4916 +torch/distributions/beta.py,sha256=zZYaaCXnCbwnLnJpEefYqt1XT9oFWZkQ0m7LCzzn8aE,4169 +torch/distributions/binomial.py,sha256=m0AUSj5EmaZ6_tolVVHYi5BRuKo9H_sv6beZldhStAc,6666 +torch/distributions/categorical.py,sha256=O01xUjMcx2HGneoW-qugKrv-N8KsQncUgG6l0wrNjfc,6391 +torch/distributions/cauchy.py,sha256=qDnG_vqNDfb9_tjZhYU1Z9kzP4Wfu40-IjuUXkYTBOQ,3309 +torch/distributions/chi2.py,sha256=SrWjaIB6q8XDmGihZj2-BDQFsNfTF5KT6Qk2NgoFpmk,1196 +torch/distributions/constraint_registry.py,sha256=lXyMFlXxIdpzIDotRZlM86Md5ODi4GCfzZK1-O9FhAY,10597 +torch/distributions/constraints.py,sha256=wSTynmVQGFheoqzcF0lgZM-kydc-X3_l6D6-0CLbqpM,22367 +torch/distributions/continuous_bernoulli.py,sha256=5pG5Xc6al2o6RK9envQtMhdkc6C5kl18VGbKQ7IS10U,9557 +torch/distributions/dirichlet.py,sha256=_jahdKe33M69VxpywoMCFv0hov9V-j11zaHsqHwDTKs,4699 +torch/distributions/distribution.py,sha256=G19FH-dD6ktn4TrcWggN88pPI6y-OOWmyP8kpb0dxU4,13019 +torch/distributions/exp_family.py,sha256=bugc3uvvy2EExDLgkIgujNpa59cJbF-d4hjqVdvX4n0,2552 +torch/distributions/exponential.py,sha256=RNa3dDWZCOjd307P-c4nf4Ex8ojZyO7pSNt7uCmsNA4,2864 +torch/distributions/fishersnedecor.py,sha256=k22z4En90ojX0B-AZi6EbJlIN3Tw_Jm2RrpmDX4Nu98,3823 +torch/distributions/gamma.py,sha256=yhH3I1bT2gHzsJI2XbzTeO3XDq7r6S8YiLqh8y_5D6k,4102 +torch/distributions/generalized_pareto.py,sha256=mAxBs2uRsGMd-nhdL1MO5QFYgCbAhppbncz_InBIB5c,6034 +torch/distributions/geometric.py,sha256=KItoALBtQbgoGGfF4olYKDrBI3FAcRTpsTu_GGVJj2g,5317 +torch/distributions/gumbel.py,sha256=QsN297-iO6Tacaszwx7M_2RmlHs9LWFNtX99kxSCpJc,3144 +torch/distributions/half_cauchy.py,sha256=QZEwJm71Ht6iknYQMSIeR1TK776YNey-u_fVIK9VDLc,2775 +torch/distributions/half_normal.py,sha256=R0UtxhhJa0DKlsfIc648C1ToJf1MIHjNC8q1fD67jcc,2532 +torch/distributions/independent.py,sha256=KLvajJJF3vo50SWwrNKzFbfgaShoISPzq0l0qfsha_E,5157 +torch/distributions/inverse_gamma.py,sha256=1Mnq3WwWluqrn8Yxso7KdxwLXJ90mVBcopXNmVgt4k4,2914 +torch/distributions/kl.py,sha256=W9FuvaktWa06EFauTPIy3wIStWp1SzJedDAW3sYN5Dw,32745 +torch/distributions/kumaraswamy.py,sha256=zWiznbifFd1yTBkRkoJlUwFffE7_v4gJ_1NcEd2vocA,3843 +torch/distributions/laplace.py,sha256=yORIpHOskSTmyTx05k4FtplWN9P4vpe6arYX-k9Otbc,3645 +torch/distributions/lkj_cholesky.py,sha256=b-Z26rEOegeE3wQKFUmjSDLXFYCCopbArBH3rK5tcok,6747 +torch/distributions/log_normal.py,sha256=mUIqlThzb3fbeyOIk7N4EuqozvIzRThhEQp-chTs2tY,2350 +torch/distributions/logistic_normal.py,sha256=g70jxF9QVWefgGnhcy4x_l-Y9kgbIaSKXz-Z_mmG81U,2358 +torch/distributions/lowrank_multivariate_normal.py,sha256=QyCtzHpfU5CXh48gvmCEptdcFSrw6-nsaDC8EHWIuoE,10415 +torch/distributions/mixture_same_family.py,sha256=oK_B9crQocytDD_aauZGgJoQHZmg3VIew_2NwSzRS08,8910 +torch/distributions/multinomial.py,sha256=Mg1IvD8a6wDdabVM7cF_pihU9v-PEL1qaE8mbU6O9dM,5862 +torch/distributions/multivariate_normal.py,sha256=-S6QQssDFS_Lyv0PbIBRF6qrMI9LnHOaGLMLDAzDocI,11529 +torch/distributions/negative_binomial.py,sha256=m_zUt4y1y4Lw004I0rhcBRw3dTXr5iQ5zJFbxBRPko4,5324 +torch/distributions/normal.py,sha256=vLgTZwISGZuZZjiCtnH8s1JFHL4be8Bp3vBk4TufJvQ,4114 +torch/distributions/one_hot_categorical.py,sha256=rxCauu_4zP7i-ZHw4EsBO0m6n_En2iSOv6mSmovip9k,5171 +torch/distributions/pareto.py,sha256=X-JQzNuTEB4_88wWSC-vG5gpBk1he50X98aRntm3fh4,2618 +torch/distributions/poisson.py,sha256=3pVEXkSECiXj41be3NM-MC94tayUa-VVMvoS3twYlsM,2609 +torch/distributions/relaxed_bernoulli.py,sha256=bKaUpb0itUuguKb2dlRi8naclwDpsGia9CrdLMFzE08,6325 +torch/distributions/relaxed_categorical.py,sha256=govyRnNF8wSZqQ9o7eruHc0iGXUMJbRQs9kUIJj3r1M,5915 +torch/distributions/studentT.py,sha256=jkcu_lr_07sXrYrUdgj6v8fKKv-fzaQ2yzlCaBjqFUs,4315 +torch/distributions/transformed_distribution.py,sha256=bpQuJnTEW-ZLyekjxbXUHlHBaPB8H2xX5as6qhMnoOI,9157 +torch/distributions/transforms.py,sha256=F8nwibCZqoWrnci4Pt69chLZwEoFVqo9NGLkWoGG0EA,44289 +torch/distributions/uniform.py,sha256=xLtb2PuwAmaHK5ggUm9xtwFwamot0sgyH4xg45-lVAk,3507 +torch/distributions/utils.py,sha256=xY0TQChb_iNQU3n-kQdh1pZKpfbgnnHhXn42Ff93m3I,8248 +torch/distributions/von_mises.py,sha256=WhP08wAvA7aI3HyZ-XXjr9K4SX8LPad85DH3diUrjrA,6777 +torch/distributions/weibull.py,sha256=ckltqXX-Ph-znckB2Y_B00AKC2FQ8lP_HDrS0aEWVO8,3564 +torch/distributions/wishart.py,sha256=QYFY24g48za05_abb1zy64K3Dtv8_klheK7b93dZ3IA,14266 +torch/export/__init__.py,sha256=fLDCBll993yh_gRpm3FHCkqYoLZvMOqTkWxQazJT6YI,24794 +torch/export/__pycache__/__init__.cpython-312.pyc,, +torch/export/__pycache__/_draft_export.cpython-312.pyc,, +torch/export/__pycache__/_leakage_detection_utils.cpython-312.pyc,, +torch/export/__pycache__/_remove_auto_functionalized_pass.cpython-312.pyc,, +torch/export/__pycache__/_remove_effect_tokens_pass.cpython-312.pyc,, +torch/export/__pycache__/_safeguard.cpython-312.pyc,, +torch/export/__pycache__/_swap.cpython-312.pyc,, +torch/export/__pycache__/_trace.cpython-312.pyc,, +torch/export/__pycache__/_tree_utils.cpython-312.pyc,, +torch/export/__pycache__/_unlift.cpython-312.pyc,, +torch/export/__pycache__/_wrapper_utils.cpython-312.pyc,, +torch/export/__pycache__/custom_obj.cpython-312.pyc,, +torch/export/__pycache__/custom_ops.cpython-312.pyc,, +torch/export/__pycache__/decomp_utils.cpython-312.pyc,, +torch/export/__pycache__/dynamic_shapes.cpython-312.pyc,, +torch/export/__pycache__/exported_program.cpython-312.pyc,, +torch/export/__pycache__/graph_signature.cpython-312.pyc,, +torch/export/__pycache__/unflatten.cpython-312.pyc,, +torch/export/_draft_export.py,sha256=NbKhhl6l8M99VZ8c-6XGV1g8MaamztfyC-x6KH7uMig,21175 +torch/export/_leakage_detection_utils.py,sha256=Bt_6XNbSaUTy0E1r80QpdJvhtd0BlMWkFISDsg2ssIA,3613 +torch/export/_remove_auto_functionalized_pass.py,sha256=K8qx4socEvtrPp_a3WCYpvBPp81P2OU2iONZQf3iK7o,2003 +torch/export/_remove_effect_tokens_pass.py,sha256=0pRjEynj6Hsvn2onTsBOz3lSKD-3EcdH2WpvDpEOe-M,8268 +torch/export/_safeguard.py,sha256=OHb5_QzVfyGuP25IIvKkLE7-fnAyjLHQoaZsMiPZeRo,2000 +torch/export/_swap.py,sha256=vk1cQsHNAUjZNtYIYnBrqpJmK3uuj0qEDOe0n_wqHJc,18130 +torch/export/_trace.py,sha256=5okVw5jC0cqiVTFIIVnS77iprfCBjTjUGtdY0HkqGI0,99163 +torch/export/_tree_utils.py,sha256=HI4U9sAR_5McT6p6dx8kvWFkWlkWqk05TiZdfQBAf34,2307 +torch/export/_unlift.py,sha256=rFPejVl1GhUEbP5H-hkTPUZQNvbmyU9K9ri_nuMSzkE,34155 +torch/export/_wrapper_utils.py,sha256=y7WMqitDwh3NwyuOrXmKCwKzth1QujBffpzYpqvypNM,281 +torch/export/custom_obj.py,sha256=sayHd5SniH20UVLJ4QVUuhtjLa2RRqDR2fbvbMDXXfA,312 +torch/export/custom_ops.py,sha256=dL10qgFgaqlOGMfA4flUu6LXG6jKO8lkMTgXV9kHb-8,1830 +torch/export/decomp_utils.py,sha256=nZkSKxfPxUx0XIVTDtubqC0-PGCAhQw7hT2NRIb6jsQ,5913 +torch/export/dynamic_shapes.py,sha256=mtRKjDejq2zFMc7FeOGNRkJZPV1UxvmCiU4VNBW0KF8,55301 +torch/export/experimental/__init__.py,sha256=4GTmpISeovLS_KeARRWG6G64CC_FOQValvHCJWbH3Vg,17230 +torch/export/experimental/__pycache__/__init__.cpython-312.pyc,, +torch/export/experimental/__pycache__/_utils.cpython-312.pyc,, +torch/export/experimental/_utils.py,sha256=d-hR7ZtVy9-0FwzLfYHF0inMpufQi-rR6pyO0EuyK74,8825 +torch/export/exported_program.py,sha256=3PWSWKIuRDzfyT2rBXyDW4SnxPPB7-ROo90PmOC-VMg,69052 +torch/export/graph_signature.py,sha256=slJPEaHm1aW9CeKq_l_P7dAGv0HdAITEsL0VMd8oAn8,26486 +torch/export/passes/__init__.py,sha256=Hdf1P-YZ5BieJvEBzmU-JzbY00D_zjWjmw2ax0lNeyo,3434 +torch/export/passes/__pycache__/__init__.cpython-312.pyc,, +torch/export/pt2_archive/__init__.py,sha256=Pj7CXPunjeMGhxVtV5HwYjEYOeiRLcsP4sgmABiu1Ks,148 +torch/export/pt2_archive/__pycache__/__init__.cpython-312.pyc,, +torch/export/pt2_archive/__pycache__/_package.cpython-312.pyc,, +torch/export/pt2_archive/__pycache__/_package_weights.cpython-312.pyc,, +torch/export/pt2_archive/__pycache__/constants.cpython-312.pyc,, +torch/export/pt2_archive/_package.py,sha256=jjomtSGoiljMcIk35eO9FSGvLZnazAtiCV0U-EjPleI,43833 +torch/export/pt2_archive/_package_weights.py,sha256=1FEThT-vEdbmxayhSUQAUOt1_5eJZWQ2oQh1Q6Jxddw,4915 +torch/export/pt2_archive/constants.py,sha256=jFNnwcLQMEeBw0QCO_IY3fGQkrDtAFaZ_PIKmG4t-8Q,1800 +torch/export/unflatten.py,sha256=IabWgenhR6Z5nnE5ohvL2N8lc69ITmKAKmD5fdmKbGA,72685 +torch/fft/__init__.py,sha256=Ux2AyoXcfP6z3pLV96O_QxjHxqPteV85pVV1WfsJY2w,56779 +torch/fft/__pycache__/__init__.cpython-312.pyc,, +torch/func/__init__.py,sha256=fEBWU84aI3QYiqjuZf_7Z-FXp8tVgkRqesChzIa2V9M,687 +torch/func/__pycache__/__init__.cpython-312.pyc,, +torch/functional.py,sha256=cLDlIVk51Gpittc6iFdY3qdV19GRwEa-bQn637uda-g,89464 +torch/futures/__init__.py,sha256=-3CzQkUHl2h5_9xWWKgNMe3nFEQpWacg4Gip5eZnzCc,14815 +torch/futures/__pycache__/__init__.cpython-312.pyc,, +torch/fx/__init__.py,sha256=pcfNDfrsjZauKlf4H28WBi1gw0x7p9UAqfswWkV4vMo,4278 +torch/fx/__pycache__/__init__.cpython-312.pyc,, +torch/fx/__pycache__/_compatibility.cpython-312.pyc,, +torch/fx/__pycache__/_graph_pickler.cpython-312.pyc,, +torch/fx/__pycache__/_lazy_graph_module.cpython-312.pyc,, +torch/fx/__pycache__/_pytree.cpython-312.pyc,, +torch/fx/__pycache__/_symbolic_trace.cpython-312.pyc,, +torch/fx/__pycache__/_utils.cpython-312.pyc,, +torch/fx/__pycache__/annotate.cpython-312.pyc,, +torch/fx/__pycache__/config.cpython-312.pyc,, +torch/fx/__pycache__/graph.cpython-312.pyc,, +torch/fx/__pycache__/graph_module.cpython-312.pyc,, +torch/fx/__pycache__/immutable_collections.cpython-312.pyc,, +torch/fx/__pycache__/interpreter.cpython-312.pyc,, +torch/fx/__pycache__/node.cpython-312.pyc,, +torch/fx/__pycache__/operator_schemas.cpython-312.pyc,, +torch/fx/__pycache__/proxy.cpython-312.pyc,, +torch/fx/__pycache__/subgraph_rewriter.cpython-312.pyc,, +torch/fx/__pycache__/tensor_type.cpython-312.pyc,, +torch/fx/__pycache__/traceback.cpython-312.pyc,, +torch/fx/_compatibility.py,sha256=Q6SzLQZ6g3M3HBLYpryI6G5oxN2TIxl-GCTKopKGZaA,1148 +torch/fx/_graph_pickler.py,sha256=t7Z2mD9H6H5-oE-BjFnulpN6UlCMBSdgunxeUmUaLVs,23953 +torch/fx/_lazy_graph_module.py,sha256=jm3T8J3j-GhQOEE28qyawmka7HRy6ZIwRPHURZacrnM,7035 +torch/fx/_pytree.py,sha256=YrD4zn9Svu8lQJQ-fwyP3dYF4On7_SwTVWzX7O9ESVc,3724 +torch/fx/_symbolic_trace.py,sha256=sL0CREY588fhuhqjM0A6SdPM1nEqDWaPvNtERzgGeq8,53421 +torch/fx/_utils.py,sha256=PX2e_hTCbfK--lEpkVSK7lljyDxVNlooSeL02s1Szj0,1803 +torch/fx/annotate.py,sha256=dn7XPNwrztonT4wNge5uEuD-pUa_WIsh5hqWX6DTwys,1292 +torch/fx/config.py,sha256=P2YOA1AxkwY8C8BOGGqaeY3DgQA-1K25VchoxV6bHFY,335 +torch/fx/experimental/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/fx/experimental/__pycache__/__init__.cpython-312.pyc,, +torch/fx/experimental/__pycache__/_backward_state.cpython-312.pyc,, +torch/fx/experimental/__pycache__/_config.cpython-312.pyc,, +torch/fx/experimental/__pycache__/_constant_symnode.cpython-312.pyc,, +torch/fx/experimental/__pycache__/_dynamism.cpython-312.pyc,, +torch/fx/experimental/__pycache__/accelerator_partitioner.cpython-312.pyc,, +torch/fx/experimental/__pycache__/const_fold.cpython-312.pyc,, +torch/fx/experimental/__pycache__/debug.cpython-312.pyc,, +torch/fx/experimental/__pycache__/graph_gradual_typechecker.cpython-312.pyc,, +torch/fx/experimental/__pycache__/merge_matmul.cpython-312.pyc,, +torch/fx/experimental/__pycache__/meta_tracer.cpython-312.pyc,, +torch/fx/experimental/__pycache__/normalize.cpython-312.pyc,, +torch/fx/experimental/__pycache__/optimization.cpython-312.pyc,, +torch/fx/experimental/__pycache__/partitioner_utils.cpython-312.pyc,, +torch/fx/experimental/__pycache__/proxy_tensor.cpython-312.pyc,, +torch/fx/experimental/__pycache__/recording.cpython-312.pyc,, +torch/fx/experimental/__pycache__/refinement_types.cpython-312.pyc,, +torch/fx/experimental/__pycache__/rewriter.cpython-312.pyc,, +torch/fx/experimental/__pycache__/schema_type_annotation.cpython-312.pyc,, +torch/fx/experimental/__pycache__/sym_node.cpython-312.pyc,, +torch/fx/experimental/__pycache__/symbolic_shapes.cpython-312.pyc,, +torch/fx/experimental/__pycache__/unify_refinements.cpython-312.pyc,, +torch/fx/experimental/__pycache__/validator.cpython-312.pyc,, +torch/fx/experimental/_backward_state.py,sha256=sY7kEctuCzdVZJUCrhkCgCCk61-XepGYuRmmNv6NW9o,994 +torch/fx/experimental/_config.py,sha256=wi4kmw6RxVyBWNw7g_a2bXcyKxz184bmuqAbaHrc8x8,5065 +torch/fx/experimental/_constant_symnode.py,sha256=4lqOS-8GIiG_mDww8qS4gHZG2Bqun_J_DCOGYGKuSko,1829 +torch/fx/experimental/_dynamism.py,sha256=9M88CpCzDdNlnMfF39_i56zsY-TLgfhlkFMTLx-eKPk,4647 +torch/fx/experimental/accelerator_partitioner.py,sha256=yYHzuf2D0PJWfkol-Ptkap3I9eYqyNVikkOeeh3SnPw,49060 +torch/fx/experimental/const_fold.py,sha256=4JteKiohWGlWTuYEPat3-nrgJH12ACN14AIiazDGEw8,14654 +torch/fx/experimental/debug.py,sha256=x5BdlNIc_AeXDA72WqGVOprN-WHkhSymqoQIFwEhHQE,844 +torch/fx/experimental/graph_gradual_typechecker.py,sha256=DrEwa7flMGGWGY13DVMEpAM70hi_0nXpXDf1fXfR8Co,34906 +torch/fx/experimental/merge_matmul.py,sha256=AgWDaZ4jIVofs4u8Ut1vdv8M676rhJiVO6h7gpnq18M,6283 +torch/fx/experimental/meta_tracer.py,sha256=pM65ySd3If0uQTpBZ78QfIw5viDqAQA0H6kSskdL0s4,11096 +torch/fx/experimental/migrate_gradual_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/fx/experimental/migrate_gradual_types/__pycache__/__init__.cpython-312.pyc,, +torch/fx/experimental/migrate_gradual_types/__pycache__/constraint.cpython-312.pyc,, +torch/fx/experimental/migrate_gradual_types/__pycache__/constraint_generator.cpython-312.pyc,, +torch/fx/experimental/migrate_gradual_types/__pycache__/constraint_transformation.cpython-312.pyc,, +torch/fx/experimental/migrate_gradual_types/__pycache__/operation.cpython-312.pyc,, +torch/fx/experimental/migrate_gradual_types/__pycache__/transform_to_z3.cpython-312.pyc,, +torch/fx/experimental/migrate_gradual_types/__pycache__/util.cpython-312.pyc,, +torch/fx/experimental/migrate_gradual_types/__pycache__/z3_types.cpython-312.pyc,, +torch/fx/experimental/migrate_gradual_types/constraint.py,sha256=YSB6sBmh6rz1N36H7n2_kvNDzYuQMtPF8hYrdDypqvE,17726 +torch/fx/experimental/migrate_gradual_types/constraint_generator.py,sha256=2GzkDEYoZSxxcBmE9VbMobwpvgIFAwziKH2eK50F4R8,52880 +torch/fx/experimental/migrate_gradual_types/constraint_transformation.py,sha256=3Lqij9tXXilC9jsUfUXZMY9cz7lt-s4t1B6VL3d9vcA,42332 +torch/fx/experimental/migrate_gradual_types/operation.py,sha256=zbUGWchsU6rC48vqKklLLe_z8MW-y076OlSNy7w2w2E,301 +torch/fx/experimental/migrate_gradual_types/transform_to_z3.py,sha256=GL5enOEip4xoTg_Rymw7ISMVH8uKY7D63VeSqSymw4o,16816 +torch/fx/experimental/migrate_gradual_types/util.py,sha256=2xTtBJ10U12xZWdxPNC5_IPTMKNj7TCf-hf4NGb7PPI,1543 +torch/fx/experimental/migrate_gradual_types/z3_types.py,sha256=ipCI1wud5fXjuavpPXK9T61D-sNXsId__Ux849pJcAs,837 +torch/fx/experimental/normalize.py,sha256=RZOHgHsfbZTPzQXBNI9VWLxcsiIF7jEYPoobmcYZT-A,5655 +torch/fx/experimental/optimization.py,sha256=XefVxhu9uGRdlCgF74wxehW0nHTjThxcyU-mF1TmNtk,18299 +torch/fx/experimental/partitioner_utils.py,sha256=AAOnE3goH6RXZok1U-KPASa3moCclGC50d-5xEm9br0,12612 +torch/fx/experimental/proxy_tensor.py,sha256=-BkO8xsdhn3sP4tlbbM5DfKnUfvA9ZpCiTZOWqrXQEQ,108897 +torch/fx/experimental/recording.py,sha256=qr8fwpTRJljJfGvz6jTMZ5WBejmmmUYsq1Xdfa8K1Z0,20480 +torch/fx/experimental/refinement_types.py,sha256=2QiUBXblb8SBDr4n9yhYA5sBX6FkuaymUtny2x7dr8A,467 +torch/fx/experimental/rewriter.py,sha256=JUMe-J8tJlaQq_H_vz1rMvYo53BJpdws49d6Sbq8Ivs,5639 +torch/fx/experimental/schema_type_annotation.py,sha256=GiT8xnwEhVJ4FXcxF1TJMVK1wLL8J_smUjFVN6cvl4Y,5524 +torch/fx/experimental/sym_node.py,sha256=mykWavD0tKkiax5aFeBwszxgd1db8KQDS7iLTebt6Dw,63628 +torch/fx/experimental/symbolic_shapes.py,sha256=0xjamYLRPEZ7r42GX0x3iUldzwNVq9WGDqbwfkEPE3s,343843 +torch/fx/experimental/unification/__init__.py,sha256=gFSoj0KQx-HXb10CoJ-yxySJWTOfzpbfnDE8AFupMLc,200 +torch/fx/experimental/unification/__pycache__/__init__.cpython-312.pyc,, +torch/fx/experimental/unification/__pycache__/core.cpython-312.pyc,, +torch/fx/experimental/unification/__pycache__/dispatch.cpython-312.pyc,, +torch/fx/experimental/unification/__pycache__/match.cpython-312.pyc,, +torch/fx/experimental/unification/__pycache__/more.cpython-312.pyc,, +torch/fx/experimental/unification/__pycache__/unification_tools.cpython-312.pyc,, +torch/fx/experimental/unification/__pycache__/utils.cpython-312.pyc,, +torch/fx/experimental/unification/__pycache__/variable.cpython-312.pyc,, +torch/fx/experimental/unification/core.py,sha256=Ta-Ts5SF_OsezZKchZ0q5T-pJXlR-SRU6a4H2bjjAVY,2921 +torch/fx/experimental/unification/dispatch.py,sha256=QEVOFPrO0P1lQOFo7uUj55XRO1vSm6kva42ZFZa1U7g,215 +torch/fx/experimental/unification/match.py,sha256=04VuNhNb8MVJMbCbSDSYffq5rQzSlWSoGsgbXxypU54,3543 +torch/fx/experimental/unification/more.py,sha256=jm1qrOuaK86Xq_GNwnBr65zPcT64eP0J_uhFHbgamtU,3325 +torch/fx/experimental/unification/multipledispatch/__init__.py,sha256=GFz_pmv1HGMq8u3esbhpKoY3evsaQ7j2fXBWNFbuz6c,146 +torch/fx/experimental/unification/multipledispatch/__pycache__/__init__.cpython-312.pyc,, +torch/fx/experimental/unification/multipledispatch/__pycache__/conflict.cpython-312.pyc,, +torch/fx/experimental/unification/multipledispatch/__pycache__/core.cpython-312.pyc,, +torch/fx/experimental/unification/multipledispatch/__pycache__/dispatcher.cpython-312.pyc,, +torch/fx/experimental/unification/multipledispatch/__pycache__/utils.cpython-312.pyc,, +torch/fx/experimental/unification/multipledispatch/__pycache__/variadic.cpython-312.pyc,, +torch/fx/experimental/unification/multipledispatch/conflict.py,sha256=0vF9Batu36ByqwXuKSzqUyQ11lV_wyYqwLrxN9rlU88,4349 +torch/fx/experimental/unification/multipledispatch/core.py,sha256=QMHAfQ67Mxg178zHID2eGUPYU4aNb2yawUIMbd-TOW8,2951 +torch/fx/experimental/unification/multipledispatch/dispatcher.py,sha256=QPbCdzQIDWzktXXavQTUvOOMIepM7Z-FUEDdYi1EGu8,14427 +torch/fx/experimental/unification/multipledispatch/utils.py,sha256=aSXcBADLePJvs-rXCPuSK7xNpcOphd1tNALN_Iw_1qs,3939 +torch/fx/experimental/unification/multipledispatch/variadic.py,sha256=L3fDMtGGBH6SyV9WcUdzQwgrkGDQfXN_6pQ7RLf4usg,3058 +torch/fx/experimental/unification/unification_tools.py,sha256=sKNne1VECwQ4iNelKzNi8zhbhRftrgGj0lph-HhXmRo,11024 +torch/fx/experimental/unification/utils.py,sha256=4dUKuc6bOb2rs3ZYHsGygYDj7YkJbc-NLU6YtHWIQ5c,3091 +torch/fx/experimental/unification/variable.py,sha256=Lk4FxR1PpSGvj2P9nfGHSkhFNnSrrcIIXvDe6aDYtRE,2147 +torch/fx/experimental/unify_refinements.py,sha256=Xhv4818y5R1iP_s34QSAI0qmseJyqWZykk9nR_4sYzo,3254 +torch/fx/experimental/validator.py,sha256=6RfHWRg_tKWrHcsxyrOLa70agxAO-45M0Ufehmnrhe4,35059 +torch/fx/graph.py,sha256=9Zy2oH5wm2EPU7vTglwri7FZoK3sZ6rF39Xxg--q3I4,91175 +torch/fx/graph_module.py,sha256=rIiVD0D7OpcNBs38u-lG-mMalUf_UbtXhXMyvMp1Ogs,46995 +torch/fx/immutable_collections.py,sha256=NUtdRSD0G-6tzNAU8xg8zXSxV9gcdwuoB1NjqXLNnhM,3391 +torch/fx/interpreter.py,sha256=BjB-6iGpyWgn7M7e1q3rbGgHK7IeMcWRTmJwmhC0RCo,25934 +torch/fx/node.py,sha256=-MJKW8xVG6PN7BhW5kStd32GmNX36oqoKJ5cRZcZp_U,35842 +torch/fx/operator_schemas.py,sha256=hMmBa9L7T6AhUl82eq1C0AmdReQ-P0kpv-yeZBtSwMM,22474 +torch/fx/passes/__init__.py,sha256=WXBqVF2oy9bqGrqek7aSwQofD5KHM0doDWOim3yq6iY,278 +torch/fx/passes/__pycache__/__init__.cpython-312.pyc,, +torch/fx/passes/__pycache__/_tensorify_python_scalars.cpython-312.pyc,, +torch/fx/passes/__pycache__/annotate_getitem_nodes.cpython-312.pyc,, +torch/fx/passes/__pycache__/fake_tensor_prop.cpython-312.pyc,, +torch/fx/passes/__pycache__/graph_drawer.cpython-312.pyc,, +torch/fx/passes/__pycache__/graph_manipulation.cpython-312.pyc,, +torch/fx/passes/__pycache__/graph_transform_observer.cpython-312.pyc,, +torch/fx/passes/__pycache__/net_min_base.cpython-312.pyc,, +torch/fx/passes/__pycache__/operator_support.cpython-312.pyc,, +torch/fx/passes/__pycache__/param_fetch.cpython-312.pyc,, +torch/fx/passes/__pycache__/pass_manager.cpython-312.pyc,, +torch/fx/passes/__pycache__/regional_inductor.cpython-312.pyc,, +torch/fx/passes/__pycache__/reinplace.cpython-312.pyc,, +torch/fx/passes/__pycache__/runtime_assert.cpython-312.pyc,, +torch/fx/passes/__pycache__/shape_prop.cpython-312.pyc,, +torch/fx/passes/__pycache__/split_module.cpython-312.pyc,, +torch/fx/passes/__pycache__/split_utils.cpython-312.pyc,, +torch/fx/passes/__pycache__/splitter_base.cpython-312.pyc,, +torch/fx/passes/__pycache__/tools_common.cpython-312.pyc,, +torch/fx/passes/_tensorify_python_scalars.py,sha256=7NS5Vb9OkmkOITrT_oAUGG7p15jOs5QsGEpqyzmgmFw,17722 +torch/fx/passes/annotate_getitem_nodes.py,sha256=2PDvA8z-6IcBsoD4sVBH_5kArezbCuKp2SZDJk4tk2E,2820 +torch/fx/passes/backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/fx/passes/backends/__pycache__/__init__.cpython-312.pyc,, +torch/fx/passes/backends/__pycache__/cudagraphs.cpython-312.pyc,, +torch/fx/passes/backends/cudagraphs.py,sha256=uNPAMRsaMUGw3wvRlvLhyjt3mXWwec8nZ4q5cBwCoBc,2140 +torch/fx/passes/dialect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/fx/passes/dialect/__pycache__/__init__.cpython-312.pyc,, +torch/fx/passes/dialect/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/fx/passes/dialect/common/__pycache__/__init__.cpython-312.pyc,, +torch/fx/passes/dialect/common/__pycache__/cse_pass.cpython-312.pyc,, +torch/fx/passes/dialect/common/cse_pass.py,sha256=qRTv86JeOKpIqA8BpKKQ3TuY5TyqSpqGuH7iBNshop0,5403 +torch/fx/passes/fake_tensor_prop.py,sha256=8mHq3YFOQb7JuQwv3UyBwZ2naFcCCtZ6WG_od0-YTro,4309 +torch/fx/passes/graph_drawer.py,sha256=yxOMysjo_ZY9MuPy-zdTUmPnSYzToDbH-I56EM6llB0,19757 +torch/fx/passes/graph_manipulation.py,sha256=w7CqkIQlo34WCUvlHB4UaCjERuw-8pnJuYzCSHnH55c,4078 +torch/fx/passes/graph_transform_observer.py,sha256=7h6POVFo2wLM31Q1j_PUiJkHxh7plW5n_apEh5dBeV8,8014 +torch/fx/passes/infra/__init__.py,sha256=XeK4BKH-Vs9snoA5CTrYmG0ZXdkAiCus1btUs3EPjvo,28 +torch/fx/passes/infra/__pycache__/__init__.cpython-312.pyc,, +torch/fx/passes/infra/__pycache__/partitioner.cpython-312.pyc,, +torch/fx/passes/infra/__pycache__/pass_base.cpython-312.pyc,, +torch/fx/passes/infra/__pycache__/pass_manager.cpython-312.pyc,, +torch/fx/passes/infra/partitioner.py,sha256=-skrXjYLf5GkKHTmSBsw2RmlspMNhQYLZ0BaXFUkilg,17872 +torch/fx/passes/infra/pass_base.py,sha256=iRtlY7eZsI12px2Q0B86Q1vtlkOePKeGDtmyEWzZTWM,2620 +torch/fx/passes/infra/pass_manager.py,sha256=zzMtDAmh1W2YfihH59RpS0PHwSXaPlslw4LqEjhBV28,10704 +torch/fx/passes/net_min_base.py,sha256=MioAo8l73Kxdh-ajD6ztfchq2PUZeLHbgJnwD1bocfE,37773 +torch/fx/passes/operator_support.py,sha256=5JNEtAgfP9UkRBveunSvqPNBvyp4k-6Aow5KO9QdhBM,7861 +torch/fx/passes/param_fetch.py,sha256=x-896h4DBw3uAD_MPqQpSHfLP17y2eDlMvTGWESH_Hs,3838 +torch/fx/passes/pass_manager.py,sha256=XdP_nTzNN9epV_QY-yejhTx1YLPRIm_4sLZGADxUiXw,7339 +torch/fx/passes/regional_inductor.py,sha256=Sp4PKiIJQTT6q3uqs8n27nmULlzpnujZGpaybUZCcSE,8648 +torch/fx/passes/reinplace.py,sha256=fqlWNm7n0SfUfSBfEdAQNUjIHyB1lLPN4mMYZZ6b40g,35311 +torch/fx/passes/runtime_assert.py,sha256=xWTsiwQQPzlfeco2Vr7IYry6XOdiLIfquKdUlnYec1I,30754 +torch/fx/passes/shape_prop.py,sha256=uLdUJP1GM8xdEWbnlYxx5RVCFPxKLXDHWLHubXzAZJw,8556 +torch/fx/passes/split_module.py,sha256=pthV69JeiFQtnjRsUl3JmHFTsiVv3wTWojx8eZ1gowk,28236 +torch/fx/passes/split_utils.py,sha256=ALbJPZWCbwN3oD35MHhUcpctGTJV7zU_zqc9BXJc140,11991 +torch/fx/passes/splitter_base.py,sha256=czu8r6RT6844zUrI_LXz1xNadtX6fE6xFHzdrIe9TTQ,42296 +torch/fx/passes/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/fx/passes/tests/__pycache__/__init__.cpython-312.pyc,, +torch/fx/passes/tests/__pycache__/test_pass_manager.cpython-312.pyc,, +torch/fx/passes/tests/test_pass_manager.py,sha256=lL-SQ_BqCcQ7LALERNZzbgM58ClKBwFehjtCzDDv9g4,1929 +torch/fx/passes/tools_common.py,sha256=-BdkkRJqeKhcYJeGfas-uKZu_sbzy1ErGDs-i5eSPQE,14252 +torch/fx/passes/utils/__init__.py,sha256=zsDIGQhthjEgPZr4tzE61sCnPNNwG725qUyZ-yzP-_M,75 +torch/fx/passes/utils/__pycache__/__init__.cpython-312.pyc,, +torch/fx/passes/utils/__pycache__/common.cpython-312.pyc,, +torch/fx/passes/utils/__pycache__/fuser_utils.cpython-312.pyc,, +torch/fx/passes/utils/__pycache__/matcher_utils.cpython-312.pyc,, +torch/fx/passes/utils/__pycache__/matcher_with_name_node_map_utils.cpython-312.pyc,, +torch/fx/passes/utils/__pycache__/source_matcher_utils.cpython-312.pyc,, +torch/fx/passes/utils/common.py,sha256=LA2sTr-oamvdQJCqOCPmmXO-YHjl-kTGZY5hNgfHQkU,3256 +torch/fx/passes/utils/fuser_utils.py,sha256=MMO65BVmwyiR9iDuaS3_pKx0ryUJU_7Q0oesQ2e3IOU,10639 +torch/fx/passes/utils/matcher_utils.py,sha256=VW4_rhLHTQTuXV8lpSq2AYFggEiK8bXJeVxcbxfMThI,17985 +torch/fx/passes/utils/matcher_with_name_node_map_utils.py,sha256=qvQzgn99W4mhB8WKx9B1yAg6Kfn7nkkEQ4cxVrMpnMs,4355 +torch/fx/passes/utils/source_matcher_utils.py,sha256=rgaVWSvL209y_L-MTiN_-FsgIMxl0ZOFprqxIziHmhY,5944 +torch/fx/proxy.py,sha256=6D06W493maQeP2NzKkyotCopjsXKYok2gZ3vSgBP6DE,31462 +torch/fx/subgraph_rewriter.py,sha256=NtR-sxn8fSAJm2GH8seSDTAsauJlaoaYseAo2sjN3MY,16705 +torch/fx/tensor_type.py,sha256=-fPKzS2WSrGQwJH6s-riLEY6jLe5BfMN1h_gbQwCWuY,3120 +torch/fx/traceback.py,sha256=QBOIkcgX-6ePWdz0wzHf93z1vbKGapf5lcuSz8ysh_k,17063 +torch/hub.py,sha256=jUs3r9m4aUKRNXcHFwx9UG0ZfnbRrLuzV_KT-sb6VvA,34803 +torch/include/ATen/ATen.h,sha256=TtxrqkN1hRw6d8GxnYfbOfDBrF6sHmjeJJ-NAfyPfGA,1403 +torch/include/ATen/AccumulateType.h,sha256=KAyq92sEpjlbahBZENHRxsxd198cQ9ynXB6GgYB4Gok,6543 +torch/include/ATen/ArrayRef.h,sha256=r9U9oTZAiGSGBO7lmtc0OX9lbphxlMY6HLf4ukqM5wk,305 +torch/include/ATen/Backend.h,sha256=CYRW-pXloecQE2G0i__Nv0x4AO3BSOA3MIL-fnpGf-E,304 +torch/include/ATen/Backtrace.h,sha256=mTYcBRk6MRUbm7mDb1vJoDxNkO4gitpQMc5-MplJT4U,307 +torch/include/ATen/BlasBackend.h,sha256=STGpLfS4AZMggc2sWYARo3yD0yHuRYF4YuIos_nDkuw,1422 +torch/include/ATen/CPUApplyUtils.h,sha256=oF_vczr8c4kb7ukEkj8sp3YSGXmrOTiGAAEnIEg8Z6M,11228 +torch/include/ATen/CPUFixedAllocator.h,sha256=XKTeu2t1a7iY315SBgoKm765-DLHyo66hKGiOTWZpOM,1174 +torch/include/ATen/CPUFunctions.h,sha256=m4_phLJUwt7rcAvPwbXOGmx4BawZaN4-JR9ErLtfAok,2242 +torch/include/ATen/CPUFunctions_inl.h,sha256=lrCtEoBbnaHRZxXzBj5ZBPIYzU-92CnHnI_wR50XkOg,28141 +torch/include/ATen/CPUGeneratorImpl.h,sha256=J8bUMmFPvuJoChb9SnhmJ6dhDMuWSLJzc3bb68Ta0dI,1835 +torch/include/ATen/CUDAFunctions.h,sha256=qW-RUlnfl4AZ-2xQ9brXPtcqxgztViK64Ad2QVZigUA,2243 +torch/include/ATen/CUDAFunctions_inl.h,sha256=nWm0Q-Otn1QNpP5MND2uETtKPuwetwtQJgfBhb83uzE,33953 +torch/include/ATen/CachedTensorUtils.h,sha256=YYCWhpuVvfl2jScyd1srovnDEihB0EvfBJ00zyNS2jU,1290 +torch/include/ATen/CollapseDims.h,sha256=yhV4aFJ1beWfdmez5fMEq_xw3XU8s7CxWYqF1uqFKrg,2913 +torch/include/ATen/CompositeExplicitAutogradFunctions.h,sha256=KLVI3JQIXnM34BR2-N8xmoHFXx2N9RFs2y1d1B_Bf00,2264 +torch/include/ATen/CompositeExplicitAutogradFunctions_inl.h,sha256=rEmz7LxhpNMp759Ze0vzi_5oiNvcytWs8NHXhtsTGAE,41489 +torch/include/ATen/CompositeExplicitAutogradNonFunctionalFunctions.h,sha256=hUg9TmX3QEfH4uanRcc03PEQJcCLUsp1gyURCCcgNqA,2277 +torch/include/ATen/CompositeExplicitAutogradNonFunctionalFunctions_inl.h,sha256=CjCU3egxlSgp7YWLNRRO1f1tw38oweqwaIcp_nv6l-s,26909 +torch/include/ATen/CompositeImplicitAutogradFunctions.h,sha256=p0TRbFiY-n8I5O7tGuVD6rA04xLy0TV0cABEDQ9YSDg,2264 +torch/include/ATen/CompositeImplicitAutogradFunctions_inl.h,sha256=KDL3D6jz0BNq8mJFw_FlDGjnDG9rSap4gop_s9h399w,35853 +torch/include/ATen/CompositeImplicitAutogradNestedTensorFunctions.h,sha256=7rCXYT67ngV3nOUFYGRXj_RIJAlu-pYd6_bNdL9ttsI,2276 +torch/include/ATen/CompositeImplicitAutogradNestedTensorFunctions_inl.h,sha256=UgXMTR56t7YOv_NZXV09tbf1-DS-obzIE7Hh62Z21eg,1410 +torch/include/ATen/Config.h,sha256=6sptH6PxdKHiHKD7sFEPoMyhWfbz1-gTAY2dZANMuQk,1083 +torch/include/ATen/Context.h,sha256=sHUHHprsOR18muprqJDTrZ6daIyv6IyS5dWyT2Ehtq8,25776 +torch/include/ATen/DLConvertor.h,sha256=pQ62HnPc7Kc2Joy0XTNsTT7CIDfU_rA8QYFLKY84L-o,3249 +torch/include/ATen/DTensorState.h,sha256=B1CSPbV7vLDz67fuCFkAyltl2ibyZ5b9ZLT7y1mrbog,1309 +torch/include/ATen/Device.h,sha256=t71J8pN4YoOv0VxSm35pVcbN9qQoQxp6tWy5Kgk-8Ng,303 +torch/include/ATen/DeviceAccelerator.h,sha256=ET1NEQWR9vfIsaweb1F0BGXSZL0SmlTkJMjR1itVHEA,4688 +torch/include/ATen/DeviceGuard.h,sha256=k1QTheOrJEOANufUrdzjc4aXelUGnqX9iPgkUOJchKI,1465 +torch/include/ATen/DimVector.h,sha256=56jrdzW7Q6QPZHr99T5JHts4c0sGdImoedt0ExmeMhU,307 +torch/include/ATen/Dimname.h,sha256=smupCd-4HjDDSSQ9dLf7FBwQA3GL82XAtRNyiZx5U_w,291 +torch/include/ATen/Dispatch.h,sha256=l3YMtd8vlUx5_aASpJvEDCkhBn1V8HYszSNoPN-YmUw,39801 +torch/include/ATen/Dispatch_v2.h,sha256=kLC97gLeMUzBp0ERtNOGWod6xocQ5zX1YpkwODzZuP4,59058 +torch/include/ATen/DynamicLibrary.h,sha256=5VKrd66YZEOiarnwOOQ-OoW8yUtgkLMhJbY5bZUoiyQ,974 +torch/include/ATen/EmptyTensor.h,sha256=15T0BI_PVs-t5a8kDBHsShLX_a7hyWVj1RZ5JFzCK0c,5117 +torch/include/ATen/ExpandBase.h,sha256=b1UkjW-BGSu6yqcDYuHcqBW0N3-xijCIkVVYLvfXJZo,1203 +torch/include/ATen/ExpandUtils.h,sha256=s3OJxTmJWK1oNz6RDUQ56UGIzBlSYbfTQmBOqaLhkZc,17475 +torch/include/ATen/Formatting.h,sha256=TIY3i5ymqqPY_WnvbYI6RujV6Z5wKDxW1IaoKUU43ZQ,294 +torch/include/ATen/FuncTorchTLS.h,sha256=rtanYYfegOVxvgN3jpM47Huw3nyB1jake0VW9MASN2c,2121 +torch/include/ATen/FunctionalStorageImpl.h,sha256=xYrmoZ3ZbHjUbwckFEgb89liXOPSgGNXgaI_rYGPF2E,10179 +torch/include/ATen/FunctionalTensorWrapper.h,sha256=dm7riA6mjle0TwS19cA74jg6h4KGuBnLQwL4OyKGZyY,19137 +torch/include/ATen/FunctionalizeFallbackKernel.h,sha256=xG_jLarUip8L_gkNfXpAuoZ034twspqxRmv4PV2KnY8,2145 +torch/include/ATen/Functions.h,sha256=YLQprBw1JBLAyLJKqx9J9CzR1DCT0zywb6uxE6f-l8g,57035 +torch/include/ATen/Generator.h,sha256=EKvlbB58INtyi9e82u7Uekf14PVJNNnz5OYWCyyXCv0,307 +torch/include/ATen/InferSize.h,sha256=0M44k7FPpCJ_eKMX_LO9zUubqUKn6LkYKFshnp16vdA,4315 +torch/include/ATen/InitialTensorOptions.h,sha256=kTfS4whayzTacrQtfL9qxPvEMVpPd69k0nKl_4UvszU,713 +torch/include/ATen/Layout.h,sha256=klZ1XMUwir2YLZYP5tFyPozAg9qCXRBMkS_G8tZasX0,303 +torch/include/ATen/LegacyBatchedFallback.h,sha256=CSkDCR_5N4dIWA-qWKfA80kYqiLPVXNqS0ITUZAtFFs,1258 +torch/include/ATen/LegacyBatchedTensorImpl.h,sha256=_Jd7JgGMu9z6kvaFnXIcGa5FFYklyg7TrqgOWcWqYFg,5983 +torch/include/ATen/LegacyVmapMode.h,sha256=K-hZP5M-WbvM19gETJ5Cgd3ouMFPXYXY0Ljw03gVV_c,1212 +torch/include/ATen/LegacyVmapTransforms.h,sha256=1C3rRZDHzHdNPxfukEe9PBTcfkdgmrxi6iedVzq7Vo4,8256 +torch/include/ATen/LinalgBackend.h,sha256=Sj8PqzPuaXRiV5S_53pukOKAgvmulTKwZW1JdHs1IUc,1009 +torch/include/ATen/MapAllocator.h,sha256=_aEjnoUtK6rldfovaj1lzWOGvuEVqNKyAbBTnHmtAyI,4094 +torch/include/ATen/MatrixRef.h,sha256=QzQcJaID0P8F3UDDV89ozp_i_QjFKugC7QAAdzaMK4U,3374 +torch/include/ATen/MemoryOverlap.h,sha256=OeQuhHCtlWTgmiWePtHxkXXBwzN--6Pp2XXsbUY88Ic,1588 +torch/include/ATen/MetaFunctions.h,sha256=B0dnd19xdy1kjn_YqnHA6Q9V8tiLKw8n_XF_OKdLGvo,2243 +torch/include/ATen/MetaFunctions_inl.h,sha256=ie1HpEJEf20iLmF8aSRNusRZRZL3v1mLM2Vi_BGENLk,16542 +torch/include/ATen/MethodOperators.h,sha256=xEtyxnFzPqIB1g0gI0t9b5VyKI0zmgvVrDs9CTMpC4Y,16186 +torch/include/ATen/NamedTensor.h,sha256=3omtlcerevrAjavLGOvj8Uw8KNQxtVh6SPogmkv5uJ4,295 +torch/include/ATen/NamedTensorUtils.h,sha256=tp0RZu14MZl-4tu6Lhhg1v9B1bSxigbfs81eJjb_toE,7226 +torch/include/ATen/NativeFunctions.h,sha256=qSLRIXikWC7ZkcmWFJanl_ncEyuiRkVTzVeprtJCCyU,62734 +torch/include/ATen/NativeMetaFunctions.h,sha256=zefhGCOsO9DzEBN_3bsoN_BAPc1mfR2U5ZMoisxXX6s,59215 +torch/include/ATen/NestedTensorImpl.h,sha256=VW1XJQjMMzgGc9dms7hrOpKfcNle6vkW-3e8awG_HGY,10806 +torch/include/ATen/NumericUtils.h,sha256=218YLBFXcLxUDZd7Yey9DsmF-sOCvFeTrTDOZQhxfjw,5599 +torch/include/ATen/OpMathType.h,sha256=zVXt-AqVCH7NrrakPOJDhS7dJAIPSIXSw-a1FZsCcwE,1913 +torch/include/ATen/OpaqueTensorImpl.h,sha256=2hF12K7wD5IB1dvusENgltmVYpEOQsRgcdD-z4lRuYc,7280 +torch/include/ATen/Operators.h,sha256=G5kyORvbO17q_Oj7yS9yRC9kNI8PzXEibyhzW1KuRNg,60845 +torch/include/ATen/PTThreadPool.h,sha256=6jR0jCG4rzxr6i4jnGXKS6Plwoengf4H90dfvFpQtKk,667 +torch/include/ATen/PadNd.h,sha256=YDzkVwEtuNF2wTZayleO1-PPTwdrfz8y3oXqkjfQmxk,397 +torch/include/ATen/Parallel-inl.h,sha256=4bKpSjG0J4tkoQhrmvwPAA6DRq3IRdgZTy_PxAqXWTc,2645 +torch/include/ATen/Parallel.h,sha256=Qb3aQelIGgrLQQXSdkKiDHqCAKGjkdnf3wLpy8odWy8,5202 +torch/include/ATen/ParallelFuture.h,sha256=N8wfzq-o80SypnhhP9y3scGuXRcne_hzU8Pu343d5C4,571 +torch/include/ATen/ParallelNative.h,sha256=hyTKyVvzFyoWX6RmAcZWx7lewnlaQmg83K_0yiYDRDY,566 +torch/include/ATen/ParallelOpenMP.h,sha256=BuWzx1zkJ0Hj2WOs5uyV1j8CZgZ6oVDeWbAD33huPeY,1596 +torch/include/ATen/PythonTorchFunctionTLS.h,sha256=oHIYgdo4zdnWhYMvGXXOiTBJROIeIKSTDDqrC9OEsB8,1544 +torch/include/ATen/ROCmFABackend.h,sha256=TRJC43stCD3o3xRPLHnvkUMF9TIiPT4gJpgM5qDZ9aA,1013 +torch/include/ATen/RedispatchFunctions.h,sha256=Y6ZixusJsI01ciwiGZDNWF1afnyCijD5RhICvJDX2Ok,2268492 +torch/include/ATen/RegistrationDeclarations.h,sha256=eT-69qDxYEFGQlZ610IWGYsyO38rR4fXufBzoFA-_z0,927352 +torch/include/ATen/SDPBackend.h,sha256=05fPdrJypJwys5y9CpRQb1br0SALyZW92Im372mPFRE,528 +torch/include/ATen/SavedTensorHooks.h,sha256=dJN8GZvsk8v3YEhfsDvVFjqxsmz3lvLajCoZKtKIfwQ,2813 +torch/include/ATen/Scalar.h,sha256=Fj2DptReu6TTfUSBjzG_iLqSGEMTBAuXM_oear3Y33s,306 +torch/include/ATen/ScalarOps.h,sha256=D7QW69HwPWgm2xXiWnRrmlbBG9IeFkHbZt5jnABEbvc,1907 +torch/include/ATen/ScalarType.h,sha256=Y8BDDa-HFaxJq3QjJAI14YY_fBhIahV_dlXezKCTTEk,392 +torch/include/ATen/SequenceNumber.h,sha256=jyAS4bri-Ur65scPQrMeqoSaPaJQ-52A98anBCNhb7U,605 +torch/include/ATen/SmallVector.h,sha256=xZ3aq-5Zg8xBG0IhYFFUQyF2OPzvKVfbkdKN3Zi9SoE,308 +torch/include/ATen/SparseCsrTensorImpl.h,sha256=7DCXOtsMJRMBEeIAbG18U0j11NsEVFxaIw3z2ntWHsI,7633 +torch/include/ATen/SparseCsrTensorUtils.h,sha256=zPM7uWkgNOq_mpUoImHtv6tEvsbgBUfXruZgnRCYrmo,18487 +torch/include/ATen/SparseTensorImpl.h,sha256=jnsc8GZrXg8BJPukHS1Bzn8NWOwPrwe0zGB8vG1Icvc,16101 +torch/include/ATen/Storage.h,sha256=BqRSSg1GQ9W2fDHo9Z7OAUKAwxjS1sfKuNwzllcAoKY,304 +torch/include/ATen/StorageUtils.h,sha256=9O0iwMhzESLhFKOIb56bHbmo6IhIPmFcwlYMwzrXLLM,1616 +torch/include/ATen/Tensor.h,sha256=RfWEb4waBoCPwVN1ZmhPNTMIS-05vjaX_zf1I0LSZt4,306 +torch/include/ATen/TensorAccessor.h,sha256=XywZUX5TAwzQRKt0xlqShxQidVz2e5YniffZvborFKU,312 +torch/include/ATen/TensorGeometry.h,sha256=JRxAAoIP9lVmmiUOz-wbCjwICoe_LpwIsi4BKlpwTEU,4969 +torch/include/ATen/TensorIndexing.h,sha256=_r9V1zGHnlKayhXrsHigW-TASIzHp4uK_02CProoTAw,25949 +torch/include/ATen/TensorIterator.h,sha256=8RiyDmx46uFDBpn4BZ5gB2TK_3wzlkmfiIEqTRsH0HQ,40279 +torch/include/ATen/TensorIteratorInternal.h,sha256=7wBi6fVzWDasB7eVTFSxung0E59Vt5NMpFQROmNXLpM,2253 +torch/include/ATen/TensorMeta.h,sha256=vcWp5pywV9Y64WnMxASNuxDJX2F-JfbyFxrHwy6hPdQ,5430 +torch/include/ATen/TensorNames.h,sha256=KlgJnM_CbTFkFhB0Jmrcx1__DsJgP2Bsv7rUuBRX9p0,2905 +torch/include/ATen/TensorOperators.h,sha256=pcAayfvFiC3V9gICKSvTcw1AK28L7nH6gd1viz1_0wY,2801 +torch/include/ATen/TensorOptions.h,sha256=wvgRFYXfOHB2BL5PyTgXndF1ZuYX6jyy6iMl7HmvtlE,310 +torch/include/ATen/TensorSubclassLikeUtils.h,sha256=Tw87jp4uxXL1amYmnkPBvd1_d2r27i6Ag4JL67FgagE,3577 +torch/include/ATen/TensorUtils.h,sha256=G5HA3PB6zU7b1Xmi70JhLHrXVTW8oBFnq25ssno9DDo,6407 +torch/include/ATen/ThreadLocalPythonObjects.h,sha256=KnbcUEMdzpruTj7NhvyMGKRQZ3Ia2EbEcFIuxFNwgXk,887 +torch/include/ATen/ThreadLocalState.h,sha256=RQwW9vCLcL5JjsUmt8yBoxySpDqlfnoPboL2UQz5YS8,4739 +torch/include/ATen/TracerMode.h,sha256=Pw_uOZQgO0ZFDimrE6wbOCAwpheN8K2goNVFDZFyydc,5900 +torch/include/ATen/TypeDefault.h,sha256=iXvkGMHpTO_3QGI6kspT0zfeJSFTxSntkTSkUAkLN0U,728 +torch/include/ATen/Utils.h,sha256=xuxa_Qt7-V-5XxaFbYD7y4tPMlumlv0FVG_Et_Okyoo,3969 +torch/include/ATen/Version.h,sha256=n7_UZy7KTnWHnD5m7otX2xqQNHoAOqMX3jIcQ9EHjnw,661 +torch/include/ATen/VmapGeneratedPlumbing.h,sha256=-Kj9cQ6mOfwG9hoMszsXFPfILYKUguxJg3FU0j9mRks,1791519 +torch/include/ATen/WrapDimUtils.h,sha256=RCYUpd7Zp9sydo1b40r9ygrSZ8wP82yJNv2WBfM-pNU,5270 +torch/include/ATen/WrapDimUtilsMulti.h,sha256=Ww3Yg1PZUOqdFWWV9-CyK7Tg9MVgjee6_lfzrvU-tBc,1378 +torch/include/ATen/autocast_mode.h,sha256=xtBRQ_yu4WH2Dc3Gt3SuVarviEmnjMg5LxZdtAu4W2U,42431 +torch/include/ATen/ceil_div.h,sha256=Gno1I1DA-jM6LTocD9PXO3SZ8IMbCt6vC1qLAmda8tU,780 +torch/include/ATen/code_template.h,sha256=LkL71xlC67vpdQnn8Sh970t3-RqvgIWghoIqNE34OCw,7455 +torch/include/ATen/core/ATenGeneral.h,sha256=ZLtKjkebiRPQDfYIXk8NyAieonpbmoyWT6S3Mlfciqk,307 +torch/include/ATen/core/ATenOpList.h,sha256=VUvciqS_lasUKQiQWPLbaRAmdlrMCTvoA0kjGbhF5_w,518 +torch/include/ATen/core/ATen_fwd.h,sha256=EUOYEfHzh1A4pWsa592BExcofXBfSiBBCkUd66qz9lQ,1329 +torch/include/ATen/core/ATen_pch.h,sha256=j5bm-3GGFstwJmPR7ktXn8h589LsF0ldFPLuUBHk_Ps,5498 +torch/include/ATen/core/Array.h,sha256=FFN3payldT2Yly_QJAg5TYeOJwDkeF4zAWbOchCIpNU,1441 +torch/include/ATen/core/Backtrace.h,sha256=4j1VHe0-lZ7smyL01vliUCXmVPn6nQZ-20lfCVHE77Y,320 +torch/include/ATen/core/CachingHostAllocator.h,sha256=LmJnquifhAVjzl8RY7XDYyNUQGJo2sgmiIh3OpRHpgo,30639 +torch/include/ATen/core/CheckMemoryFormat.h,sha256=jRlKePZNp4-lgGrot_TZRin2rY7xbPV_cxABcPo2bVI,1073 +torch/include/ATen/core/DeprecatedTypeProperties.h,sha256=O2DlzP5OrFtAo_mMaZCdlignqf1YDbjNXR9O21GIc_A,4277 +torch/include/ATen/core/DeprecatedTypePropertiesRegistry.h,sha256=riGGU0QOdZYzeIdSEsa4jmiqH4SBUPWVgg9hAsXxBj8,1136 +torch/include/ATen/core/Dict.h,sha256=6My3z53OjbylkWer9Yq-epQuNXvuS97qF_SoH3onS1U,13931 +torch/include/ATen/core/Dict_inl.h,sha256=CHngGRZAd-iBjaBaypPIMMLvSPTFPGsgU1XBSxYlWoU,7929 +torch/include/ATen/core/DimVector.h,sha256=UnG9SeGzHBzp1pOBjXHYg-yNz1NRiohahY8lTQWC1gs,550 +torch/include/ATen/core/Dimname.h,sha256=yP2fBQ_w1JBl_Ztpep9rA8Ek1UGxtSlEOUVrCa4hfYM,1474 +torch/include/ATen/core/DistributionsHelper.h,sha256=eT25pGnPv7C9bSr_gD5Dv7ilAuiYqMIvkexgOk71y0Y,13194 +torch/include/ATen/core/Formatting.h,sha256=ZF1kWpx5xsLozczu-amTdtdHe6Z9xQGaX_IxchB5ED8,977 +torch/include/ATen/core/Generator.h,sha256=wPQDfwDaDUi05l2EGBhdjhK3W-wo_oXVgo-qLMErUwM,6812 +torch/include/ATen/core/GeneratorForPrivateuseone.h,sha256=M5tE2pA06kCgkv13tjFgTh8d2E1juOSIIRlCW-abQwY,1379 +torch/include/ATen/core/IListRef.h,sha256=ekDtREom6Dpf0NPs_hz3eiBoyaVPjwGxJlAtiBB1TQU,21922 +torch/include/ATen/core/IListRef_inl.h,sha256=jJBly54RLovRebuTgWzqQWr5kgW3o-gu-B-QBHt2Kus,6668 +torch/include/ATen/core/LegacyTypeDispatch.h,sha256=sQw9WfRSKxZRfurXbWGs0LWoY0efT_AzdLyl74YbFnM,5227 +torch/include/ATen/core/List.h,sha256=6MvmJtc_GF7bOoCWDQzh6ECJZlvTuvockWGKcengd5s,16828 +torch/include/ATen/core/List_inl.h,sha256=XO6r2voplL0naoh-QAKiS2x_y4zmLIbtr754ayrqTZE,11364 +torch/include/ATen/core/MT19937RNGEngine.h,sha256=OYeoLPjI_mZyutvpvYhcPNafnjD-F-T_xClKqSGFYTI,6963 +torch/include/ATen/core/NamedTensor.h,sha256=TA52G9263584EVoyrePD99I2MSt2mj8trrsBqBy6s2A,5678 +torch/include/ATen/core/NestedIntSymNodeImpl.h,sha256=ogcy_XHex74bV1ehQjaOk7WOEaVmJaIGc_hCoP5b_Xk,6406 +torch/include/ATen/core/PhiloxRNGEngine.h,sha256=EhiVX-yGFk9XTiekxIz7lanTJt3qeyLyHiGnPlXCoaE,8229 +torch/include/ATen/core/PythonFallbackKernel.h,sha256=tiItYP5bpcPKfBd1pD-K4fASAxSkOwr2RaAfPktE89E,1388 +torch/include/ATen/core/PythonOpRegistrationTrampoline.h,sha256=yC-nc9NOvUFmLxsLBLluFo2EwhFoquyqT-QXhLhA22w,887 +torch/include/ATen/core/QuantizerBase.h,sha256=yGv9GsDiPpqYFsXE5wmuTFxWqzpsnFd9yvTCT-nOzq0,3030 +torch/include/ATen/core/Range.h,sha256=4R13LYNXTrwp7peMM0W9d8aivO9aNNrn2uEHlK3ILs8,702 +torch/include/ATen/core/Reduction.h,sha256=JwIDJ4OpN04yfDQJO4XejZb0dtyJIKViaDs2jdZT4XA,672 +torch/include/ATen/core/Scalar.h,sha256=bWQswQhqhZUI81cfCaihPICtmMwWrADqKSS7R-WoEcE,289 +torch/include/ATen/core/ScalarType.h,sha256=LxkLZ7gSLQBKFSFVJLa-81tlle9Ya3sMZ3tNP8nwCos,293 +torch/include/ATen/core/Tensor.h,sha256=vply164CQgsm2f-2YBzOl9wHFIUBqc6JFf7oFxSrpUo,2760 +torch/include/ATen/core/TensorAccessor.h,sha256=P6cVtIdK5B43cBT-_0gTcmRlLasTSM2ost9MU9vI0n8,2882 +torch/include/ATen/core/TensorBase.h,sha256=KxK85IzSQg3igF3ehE2kPEc-aWrf25fJJteuux_68Rk,41186 +torch/include/ATen/core/TensorBody.h,sha256=nCRMbaLmCELBt00ZijGIq3L21FQBG14cA5IZlmSzZBA,300333 +torch/include/ATen/core/TorchDispatchUtils.h,sha256=Q8Nj-zj7ByeC1FAKoHW7x25WdiQJR4rf6WphwjwV_88,760 +torch/include/ATen/core/TransformationHelper.h,sha256=zcN5vqsjWGSPP7w8fjdbSyQVRJTMaE1C1npP4G7WTqY,7265 +torch/include/ATen/core/UndefinedTensorImpl.h,sha256=Qyy6Fz0pIkZFO1l1rh0mElE0ROyye29c-HfzHpmQgPg,302 +torch/include/ATen/core/UnsafeFromTH.h,sha256=DYrULVjv4qqmj33cam7EKfrUSOCNxnNYCOKyzQf_tm0,988 +torch/include/ATen/core/VariableHooksInterface.h,sha256=ChsDysep5ZnI5b3yRkJrlVyTQ1jeGkI4Na8MNbWYc1g,4063 +torch/include/ATen/core/Variadic.h,sha256=mla_mosvU8G66fGhGUpmPqyp0FITj7Y_KXhnYh_v4Vo,2732 +torch/include/ATen/core/Vitals.h,sha256=N7IknZzTGkdRrGWBuWZlU6X4U_IFTGHVGXkM5-b-uhs,2786 +torch/include/ATen/core/alias_info.h,sha256=gTQkKXN6Ff6QzoTZfHlO9hKxzLbRNPptdmZ2U_ybdOI,5003 +torch/include/ATen/core/aten_interned_strings.h,sha256=hX58mlY6u6vl6CIsPNag5njsalJQQFxYRgdM5O8lKW0,59328 +torch/include/ATen/core/blob.h,sha256=V6_M3jsFNbkT8gpska03L2muNzWs4sRjAn03mYmeS-c,5707 +torch/include/ATen/core/boxing/BoxedKernel.h,sha256=_6wLPHPaRxIsAUTLXuTdjVeBn3tOOqo6zG2d5yH4eXg,8773 +torch/include/ATen/core/boxing/BoxedKernel_impl.h,sha256=qxrNpzYQUukaG3KXWxIEgkieb0HYW-xIMj-2ZDeAvBs,3641 +torch/include/ATen/core/boxing/KernelFunction.h,sha256=tZePCQhlbYfDJXtgEaKqaatncFypjZm6WyI-0ntJTRQ,10890 +torch/include/ATen/core/boxing/KernelFunction_impl.h,sha256=IR5LFK28XvEgqXIRZOshLap9ulkSCNa2PBqq6hnvjYk,14482 +torch/include/ATen/core/boxing/OperatorKernel.h,sha256=2pzZm0iyr35yiLgLwAcKFIlKH5CQB2xCIjKRvbjNUME,977 +torch/include/ATen/core/boxing/impl/WrapFunctionIntoFunctor.h,sha256=Gm6_z6BlRu8x3g8cw5JzHKYOM78aXq-idCwUOytq4RM,1625 +torch/include/ATen/core/boxing/impl/WrapFunctionIntoRuntimeFunctor.h,sha256=MGo7QDhP5y9hxoyP--C909dJztpvSupZPMprdSsNzJA,1732 +torch/include/ATen/core/boxing/impl/boxing.h,sha256=DgyvUTEVnIl8x8lGRijhUesyMjKodFGdqliPtzM0UmY,14256 +torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h,sha256=broN7f-OLLX9ESHUrgTdWNOiG6REnrm33cuX2cqxreY,32794 +torch/include/ATen/core/boxing/impl/test_helpers.h,sha256=nPQBJppaPenD_rkEa9l8GgfYpo96b7gwEP0wQA0tKfA,4800 +torch/include/ATen/core/builtin_function.h,sha256=MaFH0dzDdSA8EaINFYzswXvrtutina7RZkDLL2o9H4U,2426 +torch/include/ATen/core/class_type.h,sha256=LwvC8SzLZViwUM5qNFzeWj15Rwh5v2cXY-KGHy6hD2U,14797 +torch/include/ATen/core/custom_class.h,sha256=Far783Q9tLNOo0g6B2ZYLWEJgG8yelXcXghJKoD-av0,1031 +torch/include/ATen/core/dispatch/CppSignature.h,sha256=XFJXkG-jvI-41df1pEy2f0Y26t2A5HOnAoAcXMxtX60,2708 +torch/include/ATen/core/dispatch/DispatchKeyExtractor.h,sha256=poOpt8BJSMVuOP2fDg2uT5G6YaT0lUVOxyABSy3EFR8,11496 +torch/include/ATen/core/dispatch/Dispatcher.h,sha256=kxzlWa6RivpG6cHYBTTHwZE0qL00TbDC-z2NPNiUuKk,36001 +torch/include/ATen/core/dispatch/ObservedOperators.h,sha256=IQ4bl1v8Ocn4LV6Bi-Ipnf-Wqd2umBmkHdfTm5veA8Y,605 +torch/include/ATen/core/dispatch/OperatorEntry.h,sha256=7OHzCaDN8BbGAj5eTZ9X4_1ENGnVLstSjqJ5IKBSq_w,13776 +torch/include/ATen/core/dispatch/OperatorOptions.h,sha256=gDIyRSmdvTpZyetwDHC9G6Wp16H8QY8KXz-ItnYcj0Y,1175 +torch/include/ATen/core/dispatch/RegistrationHandleRAII.h,sha256=QUOKCSbc8cp1syjFDrn664J-hez6kyk80Tp7Gz-feHU,1172 +torch/include/ATen/core/dynamic_type.h,sha256=HPmRHHD2OGF5x-E4Y2AJ0EpIDQHjmiaJ2qzi5U7ZFoA,11407 +torch/include/ATen/core/enum_tag.h,sha256=k6bGNpgqkQNaJeT8Pb0muG0Ee7PjjYaUZtwWE0vWhBE,909 +torch/include/ATen/core/enum_type.h,sha256=1eeaVOvKa1lfEWU-woqK4ekgLw15PENFW3u9Wk__rVE,3292 +torch/include/ATen/core/function.h,sha256=iH2MG0IDHiGgShNKnGYQonqCQxX1D7QdNl7Pc82HHaE,3883 +torch/include/ATen/core/function_schema.h,sha256=UAEprLEmbzq2PNrSq8e1p292xwDp6DByBe7h_B3DF-8,25063 +torch/include/ATen/core/function_schema_inl.h,sha256=nWxBkTUUMa9yTbw6NXujBfxkvfSxm9g8pLMWg8ouOyY,2408 +torch/include/ATen/core/functional.h,sha256=hpulAsHS5jAUJ5kZjcqvDjAfan8pxxrbfi3YNKZcwS4,1777 +torch/include/ATen/core/grad_mode.h,sha256=ZdQAWqa-bsUzaukflQSH9mijVBhGYL8lDDIfXz5J_1w,479 +torch/include/ATen/core/interned_strings.h,sha256=LClP5rzvZ8ezX2M_CkVsnG4bGtGq74NdItCxjtvep8U,14022 +torch/include/ATen/core/interned_strings_class.h,sha256=JTurn7S8aBlvgdvL7nRkCVmrEqmXbjWbucbdBCaaxJU,1013 +torch/include/ATen/core/ivalue.h,sha256=FlehFLbHA_sRLhTKkdAcKaTQx4S1QNyVVsQzTVfQwzo,54855 +torch/include/ATen/core/ivalue_inl.h,sha256=GXWZaoVU5K4sS3cjHoVf3GeqZxg8NVdJipP1CGqpYMk,90963 +torch/include/ATen/core/ivalue_to.h,sha256=oXAk0Ifmh3sh-PRTQdzasPqO-ouSbjtB9f25D94FCuE,1051 +torch/include/ATen/core/jit_type.h,sha256=w9re3rdzlfB4gj7ct9rMGTpSbd00dFnmRKhBzT0lHzg,74840 +torch/include/ATen/core/jit_type_base.h,sha256=GGH22c9gg-CyfU3I94LYMxeVGSFNf8LgiwBwHaubPa0,20011 +torch/include/ATen/core/op_registration/adaption.h,sha256=5YqjcjGK4a3YCm3Z9TfUczdM0zwLkhOMDx08V0utJ1I,3556 +torch/include/ATen/core/op_registration/infer_schema.h,sha256=dQkL8TubYQ2zKWYBPFqXkOkQOjvJDj4gLEpv3mNFNGQ,7154 +torch/include/ATen/core/op_registration/op_allowlist.h,sha256=u63NZueWKCdOkwDYFzeE8iWGR-mp5GwcpGg2HKqTyko,6745 +torch/include/ATen/core/op_registration/op_registration.h,sha256=cp8xwx0PWl8M-fcgkytWi3RgSushv-Y3SaSKk0mCN2o,29399 +torch/include/ATen/core/operator_name.h,sha256=2-FgFxkniLqT3qt7PvjfjRoWRHZCwVZ7Vk5EWugd8HA,3409 +torch/include/ATen/core/qualified_name.h,sha256=DCrNbJNirjbw16xQ-w-Ka8Q8d6E0Hb7nGAqA9E6N-VQ,4793 +torch/include/ATen/core/rref_interface.h,sha256=90ng5irYTzjlHHyeHZezbstSJcI-f7ew0BKr4ydGZAw,1508 +torch/include/ATen/core/stack.h,sha256=u6vj5Q9QoRA3exS5gRwf-BQ-ZhSAuN3JbvoEiTjJrQs,6645 +torch/include/ATen/core/symbol.h,sha256=XP-rn5wDlzadoCxUdydDrGpcDpZifPAh8dz_ImDnsjY,6279 +torch/include/ATen/core/type_factory.h,sha256=oaXMiszytrDqSClYJ0b44cfHPGwlBeIGCC0LxIXqoKY,3614 +torch/include/ATen/core/type_ptr.h,sha256=rrbZNpZV7LNisZVYw7ktkBGGkFgvst3B9vsQLe96Dog,1542 +torch/include/ATen/core/typeid.h,sha256=bJPX-4T2XYsK15ScxJ94jkfOk5lbsm-UbU6hn4ytoKg,289 +torch/include/ATen/cpp_custom_type_hack.h,sha256=j2ax0N88kgLjnnH_hREJxgXLcYBEmzwgAgxYPrhoMoY,5799 +torch/include/ATen/cpu/FlushDenormal.h,sha256=6JuBsDCWx0C63gU261WnN8zQqh9fa0ZUsCp5Ny9RMbU,810 +torch/include/ATen/cpu/Utils.h,sha256=m7M4Sesv_xFNurA0k0ErkCXzDoTPfi5NNUhVfArsv4Q,1095 +torch/include/ATen/cpu/vec/functional.h,sha256=7xAg-YdCmTOawhGF1_qu0n0LQomgKs1hOC_3LQZOWa8,365 +torch/include/ATen/cpu/vec/functional_base.h,sha256=vDBUxXvnfmCQXvVKNfYD1WdJdTh7VuZbdNv5eu3EeEM,16213 +torch/include/ATen/cpu/vec/functional_bfloat16.h,sha256=sbxJyi-er4gGqDojCmpVdAccqJ7hk1dIvG2K7pv2JWU,26317 +torch/include/ATen/cpu/vec/intrinsics.h,sha256=FWpwa9MdLbBesC2idkpVNTWxahVjKjLswF8y-qrpJ5U,309 +torch/include/ATen/cpu/vec/sve/sve_helper.h,sha256=PMuYd5UP9RrsYA3aHyzQjFuqRj29w_XSb8xUd5UfvVk,3508 +torch/include/ATen/cpu/vec/sve/vec_bfloat16.h,sha256=KKBkIkV8KEABqiv0iMd-7VbOmxNKaoJHTBRY3oo6K24,21422 +torch/include/ATen/cpu/vec/sve/vec_common_sve.h,sha256=tcfTta0FZTf091_2O-U_qGq0SG-cA11QJz2qZxbDOw8,8919 +torch/include/ATen/cpu/vec/sve/vec_double.h,sha256=PTqUN3XLtYDD62Ve54lJtS9vuQa2lItTxXIvyPHc1N4,20492 +torch/include/ATen/cpu/vec/sve/vec_float.h,sha256=1hAJ-ytq8eGn3UPSN1nZe4tZF5scKRr3F_btWpG5JkU,26473 +torch/include/ATen/cpu/vec/sve/vec_int.h,sha256=AIpzBQ68YJK08lM1oCXz5PMjjT5Fx8cLYKK_cRDTjx4,28728 +torch/include/ATen/cpu/vec/sve/vec_qint.h,sha256=MXmQYj2ZpD15E6YwS535uRtZO1CTSsnvLBXre3s-PWU,20908 +torch/include/ATen/cpu/vec/vec.h,sha256=l4hkjePUxkjRCU84b5QVglHrAd5FbodQ9E9u2S2y754,1665 +torch/include/ATen/cpu/vec/vec128/vec128.h,sha256=wf18amcKTzbwqMHWW8lb1Cp0ls1Y2xYvh9klddIA_3E,798 +torch/include/ATen/cpu/vec/vec128/vec128_bfloat16_neon.h,sha256=yUaeCBcuMABC0qy-PwZJfwxCQppZIdkIHI3m7defC3s,26692 +torch/include/ATen/cpu/vec/vec128/vec128_convert.h,sha256=SgnjtBvxx_ZAEgZmNHRvqfDMfPeJVzQnJX043qLsLJg,13253 +torch/include/ATen/cpu/vec/vec128/vec128_double_neon.h,sha256=AE7_daP2CcyN--VyKJYQ6M-tv6ahiYIBb_i6l9dhao0,18836 +torch/include/ATen/cpu/vec/vec128/vec128_float_neon.h,sha256=qo4AVNjS8rmoiPmWpQjrex0Gfkacnn0q1tw54fjwy2A,22057 +torch/include/ATen/cpu/vec/vec128/vec128_half_neon.h,sha256=H9pYv9bl0sCTdEXm7Z9QlJwfs3ZW_yGjG2QNjnKrX08,21260 +torch/include/ATen/cpu/vec/vec128/vec128_int_aarch64.h,sha256=2HbB04WeE2__Wid6g9wjCUDwXc4k2Nh4zmpRC47FI4M,33188 +torch/include/ATen/cpu/vec/vec128/vec128_reduced_precision_common_neon.h,sha256=_t5bAuidXQNTfsFIp-RiZGWdAKPu_2hnMnrgTi5j1dU,10492 +torch/include/ATen/cpu/vec/vec128/vec128_uint_aarch64.h,sha256=LG2HLRClRv_NDBvRZpnFYeGMJ-HFP5_11RTeIHmiHts,21478 +torch/include/ATen/cpu/vec/vec256/vec256.h,sha256=ruOmRXgdNSf_Z-Mu5Fl9gHSGMWFKNeDH0AzrR2CFuKc,13409 +torch/include/ATen/cpu/vec/vec256/vec256_16bit_float.h,sha256=J7oFHTXBOGQJeuFoEtBk0Wtz4Pd8nP8UKfJZ9aKIZBo,29539 +torch/include/ATen/cpu/vec/vec256/vec256_bfloat16.h,sha256=3-ej42SP2rcW_rYBKbr5NDdi1Kdu8_0OAyCQ6U4ePTY,9346 +torch/include/ATen/cpu/vec/vec256/vec256_complex_double.h,sha256=nCVq9dqRclT38lKcj9Xm6jVmuqT2V2N1o6XhRnBB5fA,20373 +torch/include/ATen/cpu/vec/vec256/vec256_complex_float.h,sha256=VIlFWRfQuQyWVlYP9g1I8LN9IA1wv36AJ-dF3aE_-BY,22492 +torch/include/ATen/cpu/vec/vec256/vec256_convert.h,sha256=b5uybQDE4k1qsyb9-DXXmSk4PzNlcEpre1R_TgMmfeA,11657 +torch/include/ATen/cpu/vec/vec256/vec256_double.h,sha256=qtqAiA38nMRQCQ7bazUpgM3hUNRz0N-UuSNg7n54s4k,16363 +torch/include/ATen/cpu/vec/vec256/vec256_float.h,sha256=DHSuPEWIv47sD92f5edSQpe1NixX-rGz_VfJ2urwykY,28402 +torch/include/ATen/cpu/vec/vec256/vec256_half.h,sha256=YJK-_xVG4z7IeODupYk1bKMF5exYqgFoFGeTedYKSdU,8928 +torch/include/ATen/cpu/vec/vec256/vec256_int.h,sha256=ZOpaGQ2S5rUDOmZppBXgZkzRiLHH0quQJR-58JVW8CE,68072 +torch/include/ATen/cpu/vec/vec256/vec256_mask.h,sha256=MfBsfPnVOKkGCfdwTPdU4R-TWIeme5Zqz-llhNaNV0I,9329 +torch/include/ATen/cpu/vec/vec256/vec256_qint.h,sha256=h_Ya4ur-NPKKvbPIXptPNupID_-dAQolUgUA8P3Qk_Y,50542 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_bfloat16_vsx.h,sha256=KhKLR88zWpuPAMsFZEpP5Wyq_um03-USkfOCLWNCSfg,2471 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_common_vsx.h,sha256=IhXUI-QzVS6CDAe8Bx9fP6Z8R0k5hWR6Fd1_ce_41Zk,8650 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_complex_double_vsx.h,sha256=Bhpsm7OPyyswlJdyQc2eFgOO29rhcJMuLvn5pWaQ6Xc,22620 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_complex_float_vsx.h,sha256=gCCVxkO6oS5q-2MXR2ZSixVllV9fUwikJraw7j0bJfY,25401 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_double_vsx.h,sha256=A_eqR--HgQaUkco9ogaldSRpyZ1zU6Hjvzvbt-7KuB8,17059 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_float_vsx.h,sha256=26Glte_WA3aee-K_xxvfWIXluWeJXwMS2v4qnda2lzg,17642 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_int16_vsx.h,sha256=NxhP9jKUAZJYFZaauiIfFPcNEGnNlOsv6wVn56HdpWg,14296 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_int32_vsx.h,sha256=Ar-adK2QHrYBvnjhO1uJEFTETfKHlf3X9Fa9S43kyew,12041 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_int64_vsx.h,sha256=taba66dqSztWOrglOJm03f1muEj-27DxS2ORoFm-Is8,10264 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_mask_vsx.h,sha256=N2HuEx6KY8AScAkNU4tAAqrdXPhTt8WNerCLAjVk8A8,2054 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_qint32_vsx.h,sha256=WxMM_fM3IHwvRg_EyEjTnyvn3uf4qJR3_I21KnKl8xQ,10625 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_qint8_vsx.h,sha256=1y9dAMMb1eQklFdeqfw6Kxme1kN4mOlKRXImjFs54Oo,18189 +torch/include/ATen/cpu/vec/vec256/vsx/vec256_quint8_vsx.h,sha256=02OrVmElvVQGeltXU4zybSXPf6TCMN2GErw9rLZw40w,18907 +torch/include/ATen/cpu/vec/vec256/vsx/vsx_helpers.h,sha256=k64DikFijo5uySzYEXXws54Jt0v0CN21Eq6oCVN9guo,23337 +torch/include/ATen/cpu/vec/vec256/zarch/vec256_zarch.h,sha256=nny-Ps5d1J1PHN1yLIp7FcSuhXsVYjFcpQNs-zB0IKs,105257 +torch/include/ATen/cpu/vec/vec512/vec512.h,sha256=TVXPbSHlsovMZEttAgnMYNuvFdVzf9_ITec5_wNmVRA,11804 +torch/include/ATen/cpu/vec/vec512/vec512_bfloat16.h,sha256=WE2VW6vJ7FO_1Tx04UiHOePbQCsTruBGKpXXeGVaCeI,68692 +torch/include/ATen/cpu/vec/vec512/vec512_complex_double.h,sha256=Qnt3iFd73yFLozC5Bp0Q2aOUdPDZp0WGryQfuWtg9pE,24968 +torch/include/ATen/cpu/vec/vec512/vec512_complex_float.h,sha256=h5tXDmFvZsuV1borSZm4acupSrydI9eNrgt_tqoc1-g,46029 +torch/include/ATen/cpu/vec/vec512/vec512_convert.h,sha256=rFdEyH2RNQ22FKyTprf23PbdAFiHsBcZka3StncW7Vo,10555 +torch/include/ATen/cpu/vec/vec512/vec512_double.h,sha256=Xgi-M96LBqrwYWBsUv1cbG7o3VbhVPgVZR-kYReGNZw,17933 +torch/include/ATen/cpu/vec/vec512/vec512_float.h,sha256=45nlJD2Bg_hfsyeGOBk9b6T1zAWyBZmDrrYoyV0w_5I,31317 +torch/include/ATen/cpu/vec/vec512/vec512_float8.h,sha256=50lNBaHX8_VhfYwAU4CUPe8dM439Kw3M-pymB60G2-E,24608 +torch/include/ATen/cpu/vec/vec512/vec512_int.h,sha256=Oofln59zL3FbPUOnJiUsnTExdwUfhzUXIXsjpsFCVjo,61334 +torch/include/ATen/cpu/vec/vec512/vec512_mask.h,sha256=sRh1LqXTRXF-3fTR93yA8rO-5M7WWm2pL_GJhV5Aqwk,12947 +torch/include/ATen/cpu/vec/vec512/vec512_qint.h,sha256=pSG22BZuz9CKNPJUEcZzduVCURpFdZjQKEO-k16Tqr0,53256 +torch/include/ATen/cpu/vec/vec_base.h,sha256=-emgW2y-6WSfvN_aHlYQAicpuGOA7dZ48EcVji2IsAY,51005 +torch/include/ATen/cpu/vec/vec_convert.h,sha256=iE56kOYIJbacuo68yTXvjgmbYOuZdAnZKJhNIj6tB4I,2627 +torch/include/ATen/cpu/vec/vec_half.h,sha256=Dq7q3zd-focw338DMzTognHzTB2edtTMDx5jcrYnbfM,3871 +torch/include/ATen/cpu/vec/vec_mask.h,sha256=3pVOvXX_cFvaHbX3l1b75lWZjpiw0lmknQkz6MfOfQA,10902 +torch/include/ATen/cpu/vec/vec_n.h,sha256=9D2zQqkzLiRfz5C2rNewAO43YGWIgeothXub5r0kGos,14222 +torch/include/ATen/cpu/vec/vec_quant.h,sha256=alCYqIiXTk-YgSPQxWZDQxqeNQT93ICyfxWAd4wZhYI,9149 +torch/include/ATen/cpu/vml.h,sha256=nN42SsFrR2qoLb-G-wEKx-jKmHOFzWZKFiU34YnXEMI,6502 +torch/include/ATen/cuda/ATenCUDAGeneral.h,sha256=qhTQ7dnW01I9ylN99vpVTiqBeAIYqyOq5SB2OfmLz0g,458 +torch/include/ATen/cuda/ApplyGridUtils.cuh,sha256=0OJxtCt1u4FXJeZllLq37mypCu2X3BQe_Q4wSNffcy8,1615 +torch/include/ATen/cuda/AsmUtils.cuh,sha256=XDw3pFEH3VhPQhZUMbGwUPY-MpPfTep_fc_g-VR9T4g,3802 +torch/include/ATen/cuda/Atomic.cuh,sha256=jJrMTLI7LHmUV19J09sQErMhLNFxe7iRiHoiNqAhbBA,28055 +torch/include/ATen/cuda/CUDAApplyUtils.cuh,sha256=GQZ_sebUPzG3nWZUJozlBa0SNyUX_d6blNILB_iGXx0,21242 +torch/include/ATen/cuda/CUDABlas.h,sha256=yOupi1C48SkN9PLGKbKaajAj5qQ9cVHVeOZzeLpTVQU,15911 +torch/include/ATen/cuda/CUDAContext.h,sha256=UVkf5taOd9Dn_Bu8I3miI6BPS5-SP0_WBV8ElX1SK4Q,506 +torch/include/ATen/cuda/CUDAContextLight.h,sha256=51-Vx50cdYlGo0gczzCxQUWemjR1tj67Hrdi50_PUQc,3582 +torch/include/ATen/cuda/CUDADataType.h,sha256=lzE6bPFO1JjVKGjZb3sJFUIZXGjX6Ef8sfmGj4TVlkE,3196 +torch/include/ATen/cuda/CUDADevice.h,sha256=ZsC7gpTqPwytWetkLyuXvSVKk1JZErv12EQhd_FpDZo,814 +torch/include/ATen/cuda/CUDAEvent.h,sha256=7XRO0VUF-iYU_u9ERcaSGiH-DkmlZknbOUaPuSFhs7U,12289 +torch/include/ATen/cuda/CUDAGeneratorImpl.h,sha256=FF7Hyw-qJj2ABqRxoV6JW2QcANm06pO08zSXpZNq5js,6515 +torch/include/ATen/cuda/CUDAGraph.h,sha256=U99d5hfNTHlvKUXf_CjEv5gkS8rF0vmUg_PCIgcj7DA,3794 +torch/include/ATen/cuda/CUDAGraphsUtils.cuh,sha256=7hBQssZX3fcWy02JD5dG-CGOx2WKq7SA99DfkHyBP6M,2213 +torch/include/ATen/cuda/CUDAGreenContext.h,sha256=imZrljJi5lhZKYBxVHusFX73VOYzccLMSfoRVj9xDDY,1279 +torch/include/ATen/cuda/CUDAScaledBlas.h,sha256=vYw6TMO3HxIxTg7sR4Tmz3PAPJEB6ovY1uZK_xpcdLk,5799 +torch/include/ATen/cuda/CUDASparse.h,sha256=0_VT9a3WTHEXQywaNgpb6f21D4dLQ5GYLpDw_eJ1LdM,1530 +torch/include/ATen/cuda/CUDASparseBlas.h,sha256=Tt0qxiW0R-aOtFTDBAUrT2Qz9k0Y9rY4QWnngnukbmw,13354 +torch/include/ATen/cuda/CUDASparseDescriptors.h,sha256=kuYOpBsfC6qMB2ZOFhCYimgNQihCJiJzEcQFLyXEW0U,8280 +torch/include/ATen/cuda/CUDATensorMethods.cuh,sha256=TbEMowasqcDjzyXy8U0aI2h70inpVgUMJJfQBKDMvHc,544 +torch/include/ATen/cuda/CUDAUtils.h,sha256=XezCszSqLCdtgjrU_N6hAhG77UFS0L3HUp9pw2c2WdA,695 +torch/include/ATen/cuda/CachingHostAllocator.h,sha256=s7BgpP6Q38oSZhKAd_rwRYQKqg_V3D0F4K6mQvWWmLQ,3359 +torch/include/ATen/cuda/DeviceUtils.cuh,sha256=6MHvvWwoWY6TQ6xpmeWIO94VvGbmBxOrtwGyyDk_Tt0,3660 +torch/include/ATen/cuda/EmptyTensor.h,sha256=C9hOITjtBwb7QMt6c2GxQ3DWi5lifGsdf4HQVs8Xjdk,1509 +torch/include/ATen/cuda/Exceptions.h,sha256=GOZlpBJnOoGLWy5KPg91zJF_6g1pc5PNkgDoPteupxE,13077 +torch/include/ATen/cuda/MemPool.h,sha256=P7TXIGbE0GP640guRhudVbGmqNN-M_a7CUClpk5TSAE,1669 +torch/include/ATen/cuda/NumericLimits.cuh,sha256=AVtRNw6N1E6sqrgii_F5d2doB8kxlJe9eZ01ztMgzVQ,5594 +torch/include/ATen/cuda/PeerToPeerAccess.h,sha256=5gXUfQPo5TsUaQYxcafA6yRgd1V6rN8QLzE-K_vIA6A,634 +torch/include/ATen/cuda/PhiloxCudaState.h,sha256=3U7wedau8a4x0kWYYlY18VVskP39Gcjk2mrX6bMB02Q,349 +torch/include/ATen/cuda/PhiloxUtils.cuh,sha256=j4pSPEiOQyk6hpklv6QtVEaOLGNNYepkYXTJWW8oUIA,358 +torch/include/ATen/cuda/PinnedMemoryAllocator.h,sha256=mZk3LB4ZIDeYoKVjdZRYQvkeng9I7MVdMmGvksAARdQ,492 +torch/include/ATen/cuda/ScanUtils.cuh,sha256=jrQpxI2lOu3xuJ-eu-SnaDZtt9ud5qEr4ZtW0y-tNBg,2364 +torch/include/ATen/cuda/Sleep.h,sha256=JhdzJhl_PBbktlORoHMp6nkQtHcQ8X-Yv_sAF6qAfsk,778 +torch/include/ATen/cuda/ThrustAllocator.h,sha256=pFG1YzYD7KUbki0MAAHvTo5zWZYTiC5GSEunh2OMhoU,787 +torch/include/ATen/cuda/cub-RadixSortPairs.cuh,sha256=RBjWHsZfb6H0d9eXf2ROdmT81oZOyvURPiS5Trkob8A,2538 +torch/include/ATen/cuda/cub.cuh,sha256=VlhSz8q2rZMb9CNy_sL2_hb5v10SfoL9jfUzj98f5o8,22186 +torch/include/ATen/cuda/cub.h,sha256=C0Mp-5b1ag9YHdwfwt4jn38UtMsg1vqabg4sNC9Cgy8,4114 +torch/include/ATen/cuda/cub_definitions.cuh,sha256=E3qZqRzmGBVNDQPIYSg19rFVgHkwVgmVKMtzkSyNdc8,1107 +torch/include/ATen/cuda/detail/BLASConstants.h,sha256=OWcL5WPcCQPh8hXujWp0kCZJWKrs9VPsO7L-ZbM3Tfc,476 +torch/include/ATen/cuda/detail/CUDAHooks.h,sha256=lHaP4-OuI0UNNJqZM70i7t6rcYTq-qpzgLjCc6BIo0w,3219 +torch/include/ATen/cuda/detail/DeviceThreadHandles.h,sha256=8d-ZfR_nyYojkAf2ov8Oqa5Mpr7NDP5VzERk-2dS9Jc,7425 +torch/include/ATen/cuda/detail/IndexUtils.cuh,sha256=KkNJpxExnbwv9z00nR4S2SDCnbFqiWGugWk-f1FHgR0,1162 +torch/include/ATen/cuda/detail/IntegerDivider.cuh,sha256=Q2nVI-dMqEda1nYzKSKSfvBrSTYvXd52LNR_DzBMJuU,4402 +torch/include/ATen/cuda/detail/KernelUtils.h,sha256=b76EqnRtkPHejN22OsebYjjcGbuWoU-6QJ7SiKwcMwY,1831 +torch/include/ATen/cuda/detail/LazyNVRTC.h,sha256=FglkFgLx-QqIwETrQAlLvMTHMpQpMDif2lwxMTtViH4,490 +torch/include/ATen/cuda/detail/OffsetCalculator.cuh,sha256=h6zEE1ms3Vqp2FML1kwjApJKQnIs8WiWk8sXvvz4a-0,5253 +torch/include/ATen/cuda/detail/PhiloxCudaStateRaw.cuh,sha256=pmiUGAPGL2Yh1dMRK0uYDro_70_f9DajJ4Bbqy9wn9E,1660 +torch/include/ATen/cuda/detail/TensorInfo.cuh,sha256=DsduhpBQnzM5NusNXWWhMdwRod0viEK43wrZveLkUQE,3615 +torch/include/ATen/cuda/detail/UnpackRaw.cuh,sha256=uK9trRcJDZcXgi5gpM7Hve1GGW4CggdMZJf4Ngb1o74,2032 +torch/include/ATen/cuda/jiterator.h,sha256=3HmdxRA6K3SqH3x0nTObMZHIsX4DPTrGm19cNZmRSSk,1259 +torch/include/ATen/cuda/jiterator_impl.h,sha256=jwyq7wopQHNlMLt6z1vtqoDyrz-xi7nTVTLeadjwbV8,7610 +torch/include/ATen/cuda/llvm_jit_strings.h,sha256=beIh5d5KoIlR85K8ReGavpC3T9qCfNgZKu-T7ID1_tM,701 +torch/include/ATen/cuda/tunable/GemmCommon.h,sha256=Lbig3XlVbQu4cxTi1RBh7XZtX6elWn-GRNQCLFGeWRU,23221 +torch/include/ATen/cuda/tunable/GemmHipblaslt.h,sha256=p3KQ8TssmNVXAgF_4H4LBPVQxRkA5sg1jEWY9FNsF3M,21979 +torch/include/ATen/cuda/tunable/GemmRocblas.h,sha256=sQzipLe7Qm0AiqP7fIOdlW49dfdBlnNLjDxpDKqaLog,11086 +torch/include/ATen/cuda/tunable/StreamTimer.h,sha256=wplaewZt7_GGOGHohXiMAa-_fJFn97oIQ7ZrHk_COc4,1354 +torch/include/ATen/cuda/tunable/Tunable.h,sha256=ZJ-P6LcHFH_83ErgEjx3WRjgZMUlYIQmivPux3kszQM,8859 +torch/include/ATen/cuda/tunable/TunableGemm.h,sha256=vIJtqlvBtFw5SF4NbGsPm06MQCVG-T7MFoiUBBvqu-k,10220 +torch/include/ATen/cuda/tunable/TunableOp.h,sha256=nHBN8-n7c4vPzCqi3mxt_h50qEwVgFST32e-UAy6CsI,15359 +torch/include/ATen/cudnn/Descriptors.h,sha256=f0-7E7BVNXYR2RgmJJXcM-CsNCCa45pFrHhLinG9RSg,15750 +torch/include/ATen/cudnn/Handle.h,sha256=Q8dSs0Rt1nL6tLmbzaQARWq_dWoo1IEfAsozaj5jE30,461 +torch/include/ATen/cudnn/Handles.h,sha256=6ZZQ32it5mQevMOl_nUTYMx6w9R5JaxlJf9yfcVcN1Q,305 +torch/include/ATen/cudnn/Types.h,sha256=XKAB1nmx29V3d8xjOEoguLbmL0uUgMoft56-eKX6Cjk,583 +torch/include/ATen/cudnn/Utils.h,sha256=WAdSIQwp5345prUdlqezwCzD0K5HjsrdTuV4etHQsp0,876 +torch/include/ATen/cudnn/cudnn-wrapper.h,sha256=18meDD3TB2pDobXdXD7tCfnAyhi3ubuW-BBMxN9dAOA,815 +torch/include/ATen/detail/AcceleratorHooksInterface.h,sha256=Ufx7IIM_wsWuBe3W0kCCc8xrwafEZwOOu8rViiy_Awk,3349 +torch/include/ATen/detail/CUDAHooksInterface.h,sha256=i--EpOcvOL1Ix0jc6kIS7jnN2fOn4hE-OFgdp_885Bw,8573 +torch/include/ATen/detail/FunctionTraits.h,sha256=hit3_FxgScwrwu1tgpWgovH46FlCQ7RxS9aJRuUoPjw,3437 +torch/include/ATen/detail/HIPHooksInterface.h,sha256=q4_lbE7UcsW5ECxN4fNoYAQBRhKsjstHb0VbatvZxOw,2330 +torch/include/ATen/detail/HPUHooksInterface.h,sha256=4lbfDQ2XqUPDH5Lk8nZ482-x8Ji6NJ-uVCuuzHcZMCg,1770 +torch/include/ATen/detail/IPUHooksInterface.h,sha256=4HF-jn14FKBjDuuUWbEHl2Zf6_9xTLsGfhB9h32TrLM,1546 +torch/include/ATen/detail/MAIAHooksInterface.h,sha256=dLuabYC1FjPK1zKOY___O9jRJhW9sCRFBbzVGyvn9T0,1576 +torch/include/ATen/detail/MPSHooksInterface.h,sha256=sJ0bEh6N9l8vIrFHDx6TTJNKLtZz4x-Vil96sf9gROY,4124 +torch/include/ATen/detail/MTIAHooksInterface.h,sha256=mIqRNWKFXHhqb7E-FtUmz3Ln4NzBy_056eqPZ16JNOQ,6178 +torch/include/ATen/detail/PrivateUse1HooksInterface.h,sha256=qa2H8Q2aJv4EEGrehcUyBpjk5rsWHe097ZLSjzjiX_s,2837 +torch/include/ATen/detail/XLAHooksInterface.h,sha256=CdvT2ZDxa0HrdobYP2XFhCB_7Sn6bPqdv8y9f8mY74E,2769 +torch/include/ATen/detail/XPUHooksInterface.h,sha256=llJO3gTyUUI0zy6IM8i-ml7kcz9OdQQdvzX-TVv1h3s,2805 +torch/include/ATen/div_rtn.h,sha256=HKXZtsi4px-SSgTNzIyUzQmFCpV93fSkySAxHNnOMEg,481 +torch/include/ATen/dlpack.h,sha256=pMqPBsEcexfPm_c5SfRLStZSttLNFVBgKJlyyCpF46Y,24162 +torch/include/ATen/functorch/ADInterpreters.h,sha256=FI4o5ciaj4ubx--BNLgJw8q2txOnChiGKvxP_ppGxhY,1857 +torch/include/ATen/functorch/BatchRulesHelper.h,sha256=_s1OXp3q-yaAWQ0lmA3RgtospQT8LzL-j-OM0AVgDb8,19462 +torch/include/ATen/functorch/BatchedFallback.h,sha256=7V9GNFcfKlZQ_wYz7sdOnhzcNFkAG6rpwY1bwZaiYgk,3779 +torch/include/ATen/functorch/BatchedTensorImpl.h,sha256=o7bmOKRUJUrBZRgoy6J-mHsK-oDA-yEAy0txFFALTGM,6964 +torch/include/ATen/functorch/BatchingMetaprogramming.h,sha256=VouSUH4_qf9mHPbyM7c7PKhN6jKfn0mtG-m1N7fMUs4,5375 +torch/include/ATen/functorch/DynamicLayer.h,sha256=YybGEv2E1rBMot-G6wGh59ooWtCSZCx2ECJ25z684Ng,5945 +torch/include/ATen/functorch/FunctionalizeInterpreter.h,sha256=h3XakTIKSljhGf7dXacd-oRPHLkzsu00RQCSPmR_GBE,1188 +torch/include/ATen/functorch/Interpreter.h,sha256=zZiPPXiAp724DLn_bxY7nYkfjRBXTLRtBtiXKndD1Pk,14748 +torch/include/ATen/functorch/LegacyVmapTransforms.h,sha256=Vtx7FwAwEmhKb26s76sCLZIYIvKuKYCukjZ20ogR2aM,8697 +torch/include/ATen/functorch/Macros.h,sha256=2UM2H5BZSqXXlURgDLV_4iCDATAQsx0KsN3BexewerA,312 +torch/include/ATen/functorch/PlumbingHelper.h,sha256=Ve6saVod1zBlpWSdfyPaEczH--DvY-lLlyIcoLdzrLc,3176 +torch/include/ATen/functorch/TensorWrapper.h,sha256=4XhY5hpsMWQHj-fVBNU8FDoyZ6t-EExL7Yw15_lGYf0,4387 +torch/include/ATen/functorch/VmapInterpreter.h,sha256=yHA4cKdgUbNw-m0By_pBou_HpjfV4wp3rWGk5yO5H9w,1241 +torch/include/ATen/hip/impl/HIPAllocatorMasqueradingAsCUDA.h,sha256=tS2cAEC-Oo3KKXrcjd9XJ_pesdgMDyXiaQ6CIng7kGA,7769 +torch/include/ATen/hip/impl/HIPCachingAllocatorMasqueradingAsCUDA.h,sha256=Ewg_zaB3kuOc8qupZXeHrB_Xmy9RLx4Gk-azbY_2eRU,5972 +torch/include/ATen/hip/impl/HIPGuardImplMasqueradingAsCUDA.h,sha256=5Q3RStL4l71vaUTFfoKf_y_Q-xYc0JCSEs97qks9Ayc,15812 +torch/include/ATen/hip/impl/HIPStreamMasqueradingAsCUDA.h,sha256=HofEnmCdf-QWNyF0RLZbmii3RTf7pdjaNbH-2gABLGc,4908 +torch/include/ATen/jit_macros.h,sha256=Xgw1XbHy5VrU0xNlGkPm3GVdScyqwAzosHExEMd4Ihk,496 +torch/include/ATen/jiterator_macros.h,sha256=VoxhILXxDYBqTN0OYi7LObZ4uBgMfWC1dbq1GZsaxNc,1803 +torch/include/ATen/metal/Context.h,sha256=9L0A7r0-T5EroN0CzeRh3oT2PN8haOgIu3hYpUdQQXg,973 +torch/include/ATen/miopen/Descriptors.h,sha256=aLhr4cVu4eKsXLpkiNWYpWpKSGSqB_KnePwUP4UJfjw,8274 +torch/include/ATen/miopen/Exceptions.h,sha256=m75Fz4hLFagqJGNxDyIui_MEW0kCgBQNGbGVGt3B3Zk,1376 +torch/include/ATen/miopen/Handle.h,sha256=ROChgYyvfpiSFcsKE4zMvpddTYa7kxkdG41uj6J47os,456 +torch/include/ATen/miopen/Types.h,sha256=Tj6_SVkkbI7WUnf8kcoH2lKOQyyd3X-pkODV62XXJEE,541 +torch/include/ATen/miopen/Utils.h,sha256=Qbh64xCnt6vM_2O82UkwIhDnKQVixR-qUX_kiY1yuvs,678 +torch/include/ATen/miopen/miopen-wrapper.h,sha256=KxwLH47Lx6ubHdvNeZBOB2Ut_OX7bmxRd8LmOPamxIQ,808 +torch/include/ATen/mps/EmptyTensor.h,sha256=hTQX5wxuJ64o2aUCERrHne8hEstp8SXZDeKHmMHXGv8,1042 +torch/include/ATen/mps/IndexKernels.h,sha256=5nyF71aetABTC3I82NZB9OuiDmZ1DO5ouQUrK8eKP_A,9955 +torch/include/ATen/mps/MPSAllocator.h,sha256=pZpi1I6qQGZjyd05pd3MpvqmHFHKfHT-44HVQIdda-M,19252 +torch/include/ATen/mps/MPSAllocatorInterface.h,sha256=scVwAi3dD8X8SqSJ9gplZJWukltj_Jq5USjVEJmosJA,3045 +torch/include/ATen/mps/MPSDevice.h,sha256=i_a0JPrtfoUeIgUnuLbx2l1sArAich8SY-7mlW1UfrU,2220 +torch/include/ATen/mps/MPSEvent.h,sha256=dQlXCP3JujwpIc5GPPp999F9_yx5qZCQRtEmMqBvwuM,3932 +torch/include/ATen/mps/MPSGeneratorImpl.h,sha256=wdBDOW7A0sIReLAiADnlI-vxDKLx0zPDJohzt7TfLvY,1882 +torch/include/ATen/mps/MPSGuardImpl.h,sha256=PXoigO51qDUUWAwvaBKancu7LUSYZVuh1K_SR58SLvQ,5860 +torch/include/ATen/mps/MPSHooks.h,sha256=th27jWPCD_Cc4bV_aY8_K1aWR_yGUZml7gKSiI1_x5w,2632 +torch/include/ATen/mps/MPSProfiler.h,sha256=7pRdrmTWn9nk2QzyFcHxi9xuQ0ljDtVeiBsoCky2O1k,17316 +torch/include/ATen/mps/MPSStream.h,sha256=JJrDOIjRJMiqVQQNBpPVrzH_KIycY5hXX9aDUnR8TDw,5265 +torch/include/ATen/native/Activation.h,sha256=uQRBG8f65j3rJwGGTwweJixyqZVW6TeH1vL4H-WxwXs,3847 +torch/include/ATen/native/AdaptivePooling.h,sha256=uE4jH_PSs_eZFZt_ST2dCAs1G3FiETyFjfw8xeiJ49Q,2736 +torch/include/ATen/native/AmpKernels.h,sha256=f2Yz2omfF6sxXuTfqEuTRRqcWNrs6UE1JsJA_7VQ_Yk,904 +torch/include/ATen/native/BatchLinearAlgebra.h,sha256=JSKQl7d3hUqa8rc1oSRLDIiW8qrbMwPMl9_dIzFVun4,10846 +torch/include/ATen/native/BinaryOps.h,sha256=I7mF8iMxJLlLXX6QFUG7uzIKBYk2yMwj--6ll7Mjp-o,6310 +torch/include/ATen/native/BucketizationUtils.h,sha256=7Ksm4qv1j0bKQ025FDTx4N4MSvz9nYkQJ0EN-R--SlU,8214 +torch/include/ATen/native/CPUBlas.h,sha256=Iwzr4sAuEfdoMOz74Z5HgrJI-ow9bMJYeRMamOcn1KA,9437 +torch/include/ATen/native/CPUFallback.h,sha256=zCCY4dBt74_kq_oVheAhg5BET_vwcGiATO9jR1QsHkI,2718 +torch/include/ATen/native/CanUse32BitIndexMath.h,sha256=YtbfdNvGe_LHahKbDykOgbHGjP5KN2mmTpGitZjASug,514 +torch/include/ATen/native/ComplexHelper.h,sha256=TyhRvsWMZvQLpTjjj4cOe9xiUU-O6Tx74ejp8ZKGJqI,4404 +torch/include/ATen/native/CompositeRandomAccessor.h,sha256=kjiAPNrbbYe2pcDqPsCTLXlKLs2Mp0Mdz0Rz6khaiEs,1169 +torch/include/ATen/native/CompositeRandomAccessorCommon.h,sha256=VL9ghHyWW2Oa_0NQJiMAbCJ0mDk_UEDpAFmBbppNUYQ,7255 +torch/include/ATen/native/ConvUtils.h,sha256=l8w3hS1m5q5rZy8DLXqbrBf5iZxuFC8XNW_XekgGtYE,21421 +torch/include/ATen/native/ConvolutionMM3d.h,sha256=8wdhSR6JWBw3BXIp9y7v5GbRkzJ6pTRAHpYzHQxA4Rs,613 +torch/include/ATen/native/Copy.h,sha256=OMKVXvzVsbdds2plHCn5Xaz9ZtXkTKeLvOhNKyfOhQ0,651 +torch/include/ATen/native/Cross.h,sha256=dc-LJSeBtQUWDhz4YhZdnlZIzqRfwWHY9QSWyU7XAqM,532 +torch/include/ATen/native/DilatedConvolutionUtils.h,sha256=-yTmIqk554k5e36p6ClDIQTs95XhOXtFuHgZhrvvxuY,6890 +torch/include/ATen/native/DispatchStub.h,sha256=Frz-pJaF82LMphYN4CNxjoyLpLjFHluozq2_UBNHATc,16773 +torch/include/ATen/native/Distance.h,sha256=vGebmALZOr95--gd1gWeJkpuixp9ftKmkDULiNlOsK0,999 +torch/include/ATen/native/DistributionTemplates.h,sha256=5R9rO0bhADaD4qeHHHY_UPtKYiJTPxyI48MuIGFbbSo,19145 +torch/include/ATen/native/Distributions.h,sha256=h3IfmVttDypOWyEeS6-gt3Bxm6JEYngb9eFQ5KvHg2c,22391 +torch/include/ATen/native/EmbeddingBag.h,sha256=GTW3lR3rwqkGwjBbcz3UK61Ty_ULDwWZoiebqZlZEWQ,5641 +torch/include/ATen/native/Fill.h,sha256=yDKQfAmn_ItyhE89JylPrOQPy90zBT5wI7c-_yWw5JI,676 +torch/include/ATen/native/ForeachUtils.h,sha256=wFQsqCuQrf6l2ecZHwVv5TaGorg2RWX6jbycvzVeusc,14741 +torch/include/ATen/native/FractionalMaxPooling.h,sha256=cZXGRW8KJpXcCmOjhE-s2ClCFb-xX8qVFGxY_5Ros70,2500 +torch/include/ATen/native/FunctionOfAMatrixUtils.h,sha256=Bq177iF0cC8qcFIiOsVptjpOoZDGqYu1PuCF0HdQmUA,667 +torch/include/ATen/native/FusedAdagrad.h,sha256=OwTFNkFEc9YvPrJIWDxtCO95GudylsYU_imoosHA3N0,774 +torch/include/ATen/native/FusedAdam.h,sha256=5hHWuQS5n7ByYfFsIepTAVR8i3TYXGTDQLw1Qjq3fZM,969 +torch/include/ATen/native/FusedSGD.h,sha256=uWUP6VjhKKP8aEt41lC1lw8l_5HUQu3E0WH8wVm4W74,796 +torch/include/ATen/native/Gelu.h,sha256=WV_BhFwfrqsPfVRrNoa1iZhvK-x7tppZRetBA5wNW7k,1135 +torch/include/ATen/native/GridSampler.h,sha256=3irMsojOU8z0zehCa3WaGbUMg-xdZuQAH0uYdTkjNac,10964 +torch/include/ATen/native/GridSamplerUtils.h,sha256=2cw2_Q4kA94uA6J7-Y_00UFwOEyhgkwuz7HagjuAkEY,4075 +torch/include/ATen/native/GroupedMMUtils.h,sha256=_OKHsSv5PzGLnIcPH2CFRqXu8fuRUg6bTy7cjl_gD1c,7378 +torch/include/ATen/native/Histogram.h,sha256=teXB2i6RyY1bdEOc4mGhtBKqC40h7lSF1IJBizQGaKI,1020 +torch/include/ATen/native/IndexKernel.h,sha256=yZVY_mlQCHVnEtCmQo3eZi65qnDfutLfdkTvT2Hh0Ek,2003 +torch/include/ATen/native/IndexingUtils.h,sha256=ayL5ldxeEb5gpq6HFmHuM7KHXRy_6egajlFGgu2uPOc,6732 +torch/include/ATen/native/Lerp.h,sha256=upcWmcPBqsmy7DgtEoFE4xXBGHVr63NODvSmrvFd6o4,1766 +torch/include/ATen/native/LinearAlgebra.h,sha256=rihDYdQeQB6o4EyDSO_UFf6oVW5Aqz-MQcsGOQnhNjI,575 +torch/include/ATen/native/LinearAlgebraUtils.h,sha256=NwS-JKpt1SYcG-v95KOqE-nP2pgKgh-ECGLgb3VMzo4,27239 +torch/include/ATen/native/LossMulti.h,sha256=5xy0La7afq_t3pO0ON13-P3unGcz8WohGGuhhuX_Fhc,2442 +torch/include/ATen/native/Math.h,sha256=Kul5kWg-tUFs3K83HlgXfdA3J0XW6uhCTI9klopT6c4,146239 +torch/include/ATen/native/MathBitFallThroughLists.h,sha256=d90V0u5vA64h2LSs0v46xyTUSq_iWQH9LN7p-hzgDJg,4466 +torch/include/ATen/native/MathBitsFallback.h,sha256=rH68UCgUWltu7Oc_Hhdw-xMj6NVoLFh_rdIlZ8qawE8,7734 +torch/include/ATen/native/MaxPooling.h,sha256=pczNXtk4WWKCBvKBtQ4ar3XmMfAIOwhNA1r8Bg5HUyc,3624 +torch/include/ATen/native/NonEmptyUtils.h,sha256=TqxZmMDU-MW_TzufMm0lGcgFK2zsVUrdBtkHHvAog0Q,885 +torch/include/ATen/native/NonSymbolicBC.h,sha256=e6sg6P9gCNVBRMZq3pDMYU7svr8vdNnRCKceS73_b_E,3161 +torch/include/ATen/native/Normalization.h,sha256=GeMIAvejg0XskCqDkoEURSaPDLVztoT5WJunPqfygvo,831 +torch/include/ATen/native/Padding.h,sha256=P7puGp5sxrPKBJ9V5IMcDLhWI8Eeh1InpJpqtqUl5uw,2383 +torch/include/ATen/native/PixelShuffle.h,sha256=JQiAxoGrrhJ3P9v7cwDq41DG2uXGDQcoNgIy_kPmrv0,2264 +torch/include/ATen/native/PointwiseOps.h,sha256=brT_HCt9D13JNkguaXw4s7A6f-WzV8w11nr28iMHQLY,1068 +torch/include/ATen/native/Pool.h,sha256=Qe-bO14NIyz2sBp_5m2Ziu_4vdLij9FKI6O_tC6AVfw,13874 +torch/include/ATen/native/Pow.h,sha256=Btw22r5m57DBudftnQYZh-V9seNh4sShxL8He3qmuZ8,1977 +torch/include/ATen/native/RNN.h,sha256=RRcAQDrkk9RVVuH8f3jo9UPOdOkWm-XsjFP_ethUpPc,2816 +torch/include/ATen/native/RangeFactories.h,sha256=qrskxvSfZ6RXrdILlHLL8Vy6zkp8I01HARsvBeKBWxc,625 +torch/include/ATen/native/RangeUtils.h,sha256=IJ5NeLGBdxVXtvWiJkCZAQ_NSzUST2tuS5xFigO70eA,2421 +torch/include/ATen/native/ReduceAllOps.h,sha256=hTwml4IoCtN5_Xi8nBDF0cCJxFRYhH-U_zvCaii21og,672 +torch/include/ATen/native/ReduceOps.h,sha256=hvxQLjCYQeSnE_zGw-dpATqftg1IBismhfrLO822Lq0,2124 +torch/include/ATen/native/ReduceOpsUtils.h,sha256=_7U1t1HbUJq83E1GUZmlSmUnuSnQdc6T9eqCN_tcRUc,17164 +torch/include/ATen/native/ReductionType.h,sha256=WONCdOAzlnpdHEhvAGYUqMGvhnmh9EW032b4o6YqlxY,1438 +torch/include/ATen/native/Repeat.h,sha256=C54JjbdDZjuadig0MfeYFq6ij_dvOwPtDd7GPnCnFAs,1784 +torch/include/ATen/native/Resize.h,sha256=eMMeEUAq61t5LDfQeLmYF5qcBcbzSaSswNmthCepn2U,8629 +torch/include/ATen/native/ResizeCommon.h,sha256=b-AtTvTBphNCZKMKwOPEUZHNePvwGDXxp1v-Fy5yD3U,2825 +torch/include/ATen/native/ScatterGatherChecks.h,sha256=yIIK1dy7guA42iULOlydS4ycCj9ChI3W37tDNl_EzBY,4123 +torch/include/ATen/native/SegmentReduce.h,sha256=EbcM6P4QJ5kH5-UwzZgMK4TEIeQoDYiiH4JXUw6ejTo,1574 +torch/include/ATen/native/SharedReduceOps.h,sha256=vvOb_PCMIlg3JtdWFBTrmlIOl0vD9TABjQ5ECvA7lmo,16960 +torch/include/ATen/native/SobolEngineOpsUtils.h,sha256=lP-8lUCFpD1jdqkrdi1oqraK4ceTnSDLxaC_nZnFPN0,2149 +torch/include/ATen/native/Sorting.h,sha256=7xl91fUJ82MhMMs2oe7E1qPG6JGNw3p50Wonynk8788,903 +torch/include/ATen/native/SortingUtils.h,sha256=kjOo5GphpQGk4n9G3I9NsQSnmX9ezGm5wTPsPhHHYXI,3019 +torch/include/ATen/native/SparseTensorUtils.h,sha256=4aEwIce87M-Sm1NTf0GawrqHYIhcyPpXoo59neco3yg,6949 +torch/include/ATen/native/SpectralOpsUtils.h,sha256=1OFshlPwKCn_xbyTAYrA0o2OQegfXx0OMV8MuOquxas,3625 +torch/include/ATen/native/StridedRandomAccessor.h,sha256=6y-sghNziedkMN2S9eqrGuxuNaZly7LH1QlhlPFRZpU,7395 +torch/include/ATen/native/TensorAdvancedIndexing.h,sha256=VG6_M87AaBpa1Yzf4POOtK4BaLkHdYikItvglb2zHwQ,3258 +torch/include/ATen/native/TensorAdvancedIndexingUtils.h,sha256=xXmohrNLWfDIYz2y_AdwlgP4kEwjqMlAWd1JxUbmcBU,3477 +torch/include/ATen/native/TensorCompare.h,sha256=kr9oT4mGLU4ZOSGSuMUuCyei_oPhYDv2e-7nWWT7xLY,1833 +torch/include/ATen/native/TensorConversions.h,sha256=PDvyPp4aY9YHQ8eNvKaLc7VAeQylxtv_mpJArgl24fc,1128 +torch/include/ATen/native/TensorDimApply.h,sha256=zMacXIpm9bC0ao5XgVbs5EaWup9KItHAp0VthND_940,2153 +torch/include/ATen/native/TensorFactories.h,sha256=RhCIw4nlOnHMzSkTEOw-SAZ3skK8uqbJbCK4im4hV_4,5826 +torch/include/ATen/native/TensorIterator.h,sha256=8ehRB3dYcisXrWT70lSJq4F8cCYBucr9EwM37qftnso,307 +torch/include/ATen/native/TensorIteratorDynamicCasting.h,sha256=Zs_8RPrLyQKuTwX6vCfer0GsHuRnBbNpNxQs5BZ5ZKU,2121 +torch/include/ATen/native/TensorProperties.h,sha256=TieDtwJQfL9wpDslA7WaMH5Y9TdtWGhCWJAILafX6pE,469 +torch/include/ATen/native/TensorShape.h,sha256=IW9lulJlklRgUHg-KSZLOUqzKi8maqXbnwmhmcSANWE,5001 +torch/include/ATen/native/TensorTransformations.h,sha256=8OrMCPIp3UHbCzIKKvNZfK6KG8M15er3JB2AMEP9fKg,1221 +torch/include/ATen/native/TopKImpl.h,sha256=ZSJ6SM7glc_0UIGxH_-1EJaIX22qQCuSzQq7rgDivFA,3816 +torch/include/ATen/native/TransposeType.h,sha256=ASHLaTZ-AJ52U8VU0Tf-OgjoxXGfehKLbzll7pQNIhs,950 +torch/include/ATen/native/TriangularOpsUtils.h,sha256=5EXbEjlxQFU8n_rOPBSdYaD4rUb8tVgVloYwXh_H-r4,2318 +torch/include/ATen/native/TypeProperties.h,sha256=ymBdtEzRTjKn6b6Yl9vo9MebIxD_3ZgRkb0jSnXra9U,937 +torch/include/ATen/native/UnaryOps.h,sha256=Gu6ihYdA40S--Vh_jCDCFcHiGjymdFgU__qigfEJuVA,5802 +torch/include/ATen/native/Unfold2d.h,sha256=UOAMTqGcdGqZK7d10VNlOy8DLzT__NNGC1mx007nfGI,1286 +torch/include/ATen/native/Unfold3d.h,sha256=ELFEZLFhT37eDCSv0hiTRXUPOOZiFIkLpkjHQsDkPXo,1181 +torch/include/ATen/native/UnfoldBackward.h,sha256=7zYuzI92_BkUpUGOWfOy9EPzUfdxS8QlMin_MRFKzAI,3462 +torch/include/ATen/native/UpSample.h,sha256=NuI5q3urVB6N4M5kpJI17BOvvpOvUsFWA1Rxrie8f5I,19964 +torch/include/ATen/native/ao_sparse/quantized/cpu/fbgemm_utils.h,sha256=tL4JXDfN2dOyJOI9Qna8OUHrtRavdFG3TStXi9108b8,3336 +torch/include/ATen/native/ao_sparse/quantized/cpu/packed_params.h,sha256=2TtHMQCXf6ZPFk1X8dqgbQ_5N4FO_zHAKr1A8l818IA,3073 +torch/include/ATen/native/ao_sparse/quantized/cpu/qnnpack_utils.h,sha256=ZopE29ZjTtjzpaICWlf-XNJLVGP3TRzBlmDAu0ArLWM,3591 +torch/include/ATen/native/batch_norm.h,sha256=xmo2b9IlLgukPODZjb1B7QQWwBgf2HKMFDkVwluPdwg,1722 +torch/include/ATen/native/cpu/AtomicAddFloat.h,sha256=TGFnS4A0r7BYslDtA8aSjMoZvPPLsDBTWsLgm6zpeek,1138 +torch/include/ATen/native/cpu/CatKernel.h,sha256=0EtKe0fI_DIEoxjEkEvx5kfgMP4IgADEqJ7yXczq0Pw,577 +torch/include/ATen/native/cpu/ChannelShuffleKernel.h,sha256=F7gMbpbq5qcM1fTUnxCN4PFdA9-EJivZP5roBGuPLVI,559 +torch/include/ATen/native/cpu/CopyKernel.h,sha256=I_NqNMgwQe2a7OfZXXdMflb6nvWYk3Nkokhyhrhk6E4,585 +torch/include/ATen/native/cpu/DepthwiseConvKernel.h,sha256=GxD6Urv_I_ziVrgvDoCf7UfxzvHs1FjYfPMbt0jF4iM,750 +torch/include/ATen/native/cpu/DistributionTemplates.h,sha256=jR0NvjfLDiVRo5WPJF2yNtsxenmdP9jZFaMcUHwJSwc,17134 +torch/include/ATen/native/cpu/Elu.h,sha256=PUvGCsP2GsSlfXdmirjr6-iIbZgtWH3amqOEnEdk2O8,3199 +torch/include/ATen/native/cpu/Gelu.h,sha256=DC4OsLKuJhRDTObqhVou4g7IOG-rJv4eS_2kraIbdEo,3446 +torch/include/ATen/native/cpu/GridSamplerKernel.h,sha256=Zpe7ZpCTM9eqV-Yqr__STwnouhCTGK7tjWeqsJC8yzI,1116 +torch/include/ATen/native/cpu/IndexKernelUtils.h,sha256=Pu82OQ98fQszfW__aoLCkKLZeUm7oVB-O_wzS1T8NVM,3271 +torch/include/ATen/native/cpu/Intrinsics.h,sha256=iTaeeUCOevEy1Upw7CIQHFzfEzUG3zrCoZ5G6XAx_q4,1504 +torch/include/ATen/native/cpu/IsContiguous.h,sha256=Pf-zF7NuqIfloEQKzlPjS9w8zfLSnQcj1xXDa6LHKp4,2692 +torch/include/ATen/native/cpu/LogAddExp.h,sha256=A6Z7aZGX3wLAfKMqgXV7hXsNWRlqvlTwslBzjHUy4oM,2766 +torch/include/ATen/native/cpu/LogSoftmaxKernelImpl.h,sha256=JhZVgaEq483JpQHFegkWtSOcsZAQdcCmAiW1q81ObVc,13746 +torch/include/ATen/native/cpu/Loops.h,sha256=pe-fagpG1jDPcPYWXefCVTrIjXAiO4A3NK0hJuLzpzQ,15567 +torch/include/ATen/native/cpu/MaxUnpoolKernel.h,sha256=_mkkllrDakqE5uOCraePoGuQe33Ts0oiJ0-GxSgIvK4,579 +torch/include/ATen/native/cpu/PixelShuffleKernel.h,sha256=ItnMzSQniElh67gNGFWvlp6E7Xahjd9mOmWnEcplWxU,593 +torch/include/ATen/native/cpu/Reduce.h,sha256=5d1sTx-esAU6GNWqoNUt0HAlsx1aKys8_1hC65kNBN8,12639 +torch/include/ATen/native/cpu/ReduceUtils.h,sha256=iBga6keWF6hw3CfxLD3nTvRsqcHeoGdQ1PeZO_T61OQ,9205 +torch/include/ATen/native/cpu/ReducedPrecisionFloatGemvFastPathKernel.h,sha256=z0cQ-KeuFdtAOY1LrS6pqUTd0rEY6hrgZHxfaTGOGnc,1406 +torch/include/ATen/native/cpu/SampledAddmmKernel.h,sha256=2sXEpAto2vS7Jymh8GHzVjZGsHiTAiP_CZ_ExoXNDS8,593 +torch/include/ATen/native/cpu/SerialStackImpl.h,sha256=XNliI00qvvb8shE-vthxVidUztmYQ5DfGEcIWLW_riU,5861 +torch/include/ATen/native/cpu/SoftmaxKernel.h,sha256=axF6_MejKBtE6JVhB5ido391lGFS8Y8guY2UDjaLeUI,1222 +torch/include/ATen/native/cpu/SpmmReduceKernel.h,sha256=sdJAcwHXX6QcpyaLqcxWK0a5FkzLVbTnUOQSMkVxnf0,1633 +torch/include/ATen/native/cpu/StackKernel.h,sha256=tmg6DL4SyiM6ZLjdQVt4PWFZAQEjk68cieBXoRu-irQ,579 +torch/include/ATen/native/cpu/UpSampleKernelAVXAntialias.h,sha256=oLBs_D047gRTkAmgS1hL4Msk1p064iXT_Jlb3DXOJe8,59773 +torch/include/ATen/native/cpu/WeightNormKernel.h,sha256=lMaaV48C7vENtVfyRALZmHtX-oJwt0q5-4Lm-55v19s,829 +torch/include/ATen/native/cpu/avx_mathfun.h,sha256=S8as4qTvl6EyjRqRnoHsmx1YqGnXMQIiCmIIMg68BHA,18229 +torch/include/ATen/native/cpu/int_mm_kernel.h,sha256=e_yhLkFza-i1ZbApYK4gFWbPiq1MTtYjAfvQpHBM4i4,1402 +torch/include/ATen/native/cpu/mixed_data_type.h,sha256=QfMS2XRqAypK6QxX7uWYYsDZPRgIRnVChzCqcd3VfcM,1708 +torch/include/ATen/native/cpu/moments_utils.h,sha256=_HWYNEklo8-x5Cr-gfw1DLv-LylzugU8B2X2Af9G77o,7378 +torch/include/ATen/native/cpu/utils.h,sha256=3YuLSNFxH1OReI5rtxpVjp_Xb6S_NZTFJChJmwR5rxk,7995 +torch/include/ATen/native/cpu/zmath.h,sha256=kqwEwrE4T3eFdO8eyH8zTLJh-n_74dVHZovDDlTVjZw,7131 +torch/include/ATen/native/cuda/Activation.h,sha256=9laLJNQPYX047f-ylL7oIhgjNFzA79EAgqSxzFM0ncw,815 +torch/include/ATen/native/cuda/BinaryInternal.h,sha256=7Qx8m6tOM6ZIfRWsDcBi77THpcbdvtDcNlHzgeJS960,1490 +torch/include/ATen/native/cuda/CUDAJitLoops.cuh,sha256=Gsifk6Rzb2S3ueTfM8r09elrCfAMaxgL3HTMCH8Cg6A,12463 +torch/include/ATen/native/cuda/CUDALoops.cuh,sha256=jO6O3akLZFXedAEYq6hy9zrYtJopNriPRupBxvW96Qc,41744 +torch/include/ATen/native/cuda/CompositeRandomAccessor.h,sha256=4XGfKD3MN16NXM3wxLs1DUwO6d9KFoy5CX1tUn7oLWE,1249 +torch/include/ATen/native/cuda/Copy.h,sha256=vl_ra_72F1rxogoK8ZoREpqWc09YFX9Ny0FpacnejT4,424 +torch/include/ATen/native/cuda/CuFFTPlanCache.h,sha256=VEeHLf1Co7AtIkdrfs5FMzakaodUArjOdDhfPzun6jM,18681 +torch/include/ATen/native/cuda/CuFFTUtils.h,sha256=U3kQ-lTWFZCZT1Pf2op_hr90nDmr3uPlwG9q-IVlMVA,2265 +torch/include/ATen/native/cuda/DeviceSqrt.cuh,sha256=YTUAk2Udq8uE6sK7WGT2uSmMqoYvjaxEJqrxfW7kvyw,869 +torch/include/ATen/native/cuda/DistributionTemplates.h,sha256=2kQUMvI48V0G_qsqgDC0EmxFUHa0oF8XknVj0v9SJq0,30204 +torch/include/ATen/native/cuda/Distributions.h,sha256=OevOj8tkADbGS-EQ6ZuU9CVLgQrNPSbmaOtKDhHx9cU,925 +torch/include/ATen/native/cuda/EmbeddingBackwardKernel.cuh,sha256=LZ3s8r4LuYH9axkGpcls6kOX21ukJP7K32hOfw67yuo,835 +torch/include/ATen/native/cuda/ForeachFunctors.cuh,sha256=aMkxr0QhH-roH2gt-WCI6kz-65VD2dXSSJwQs0HaSPQ,25683 +torch/include/ATen/native/cuda/ForeachMinMaxFunctors.cuh,sha256=Kz7XrXZdWEYSnMAsappn8mLvnYOhfINqAtulhTf794o,707 +torch/include/ATen/native/cuda/GridSampler.cuh,sha256=_8yVixHlE8pWEOqgK85DZhpv33cljEr_5KztGmEFbxc,11555 +torch/include/ATen/native/cuda/GridSampler.h,sha256=kG7LxFDDPUd3CnFhpmy08XLErUCMozZVpqytQYA0Q80,1435 +torch/include/ATen/native/cuda/GroupMM.h,sha256=xXIAQ-CItRX9DX1fAHnQIwHD3CwTXPRw-bkTqGd5t2g,598 +torch/include/ATen/native/cuda/GroupMMCommon.cuh,sha256=hM2mklphmXKucy-4O4x001IW1J20pk66omDq52Pwvbs,6867 +torch/include/ATen/native/cuda/IndexKernel.h,sha256=UaCp3TLw0hIplsgwFenmLJdTh5RjWtIjOnsFHo9l7yE,612 +torch/include/ATen/native/cuda/IndexKernelUtils.h,sha256=9T_q_mS0P-19x2gZPOpUZzX82e4M16v-CJIBY_a_New,2200 +torch/include/ATen/native/cuda/JitLoops.cuh,sha256=zXsuddcmA5noMvwUPCO-KCpFHb-RdED8wayAv3FG_s8,7352 +torch/include/ATen/native/cuda/KernelUtils.cuh,sha256=RV_6WbpFkPMogTwpVzQ2BEIj_5Yk-Sgil8HRI-jDdEk,15451 +torch/include/ATen/native/cuda/LaunchUtils.h,sha256=tO_Sk2M6XuG0wkKVRMQBkGDp4DMbOtArB9mb1E2bWW4,557 +torch/include/ATen/native/cuda/Loops.cuh,sha256=f6ATcbMHoiwZGWhhRozO9h_ub1el2NDh8ONVk067M-0,12381 +torch/include/ATen/native/cuda/Math.cuh,sha256=CdauYP8aIT5tUZx_ag9IGUAeCY-rzafqGJrWYodhSmY,126759 +torch/include/ATen/native/cuda/MemoryAccess.cuh,sha256=9bkJgzhQ0w_-2cElJFoanJabT52EoN2I5t5eQSjdSc4,23220 +torch/include/ATen/native/cuda/MiscUtils.h,sha256=uoMUkjydz5TK7ycZfMI8LzLHLgZoT0q4cwfxqn7fE0E,1224 +torch/include/ATen/native/cuda/MultiTensorApply.cuh,sha256=qxFa0MfNt70W33eA2AkS6PtiZR1zGIG4Kkyukx0A9Y0,14576 +torch/include/ATen/native/cuda/Normalization.cuh,sha256=KrhLvb7aGd5nUXlDsPcx1rl9nfdo6Fek4bP-FfhZYAU,77235 +torch/include/ATen/native/cuda/PersistentSoftmax.cuh,sha256=5s0h7CdB-3lQ2Rcx-43s9zoo21TgJMj8cFgKYU-kjVU,18644 +torch/include/ATen/native/cuda/Pow.cuh,sha256=lVCJAXtZIJFsyrcLaBAQvMnC9nXQsQcy7HqzDm1dtgY,2471 +torch/include/ATen/native/cuda/Randperm.cuh,sha256=cBXXz06lZ-LYKDVQA28PzUg0daTRVsnv3yokigkXtpQ,2425 +torch/include/ATen/native/cuda/Reduce.cuh,sha256=pkF39CvT6oRp_Jt1lYO4lThmEdOZ2bPUq7Zo_yQ3-DY,53583 +torch/include/ATen/native/cuda/ReduceOps.h,sha256=fXw4_REp0deIUG3VGrmeMFk1_0y250VApAvZFbs8qZ8,767 +torch/include/ATen/native/cuda/Resize.h,sha256=tfYHzETDI75xdKLHK01J22xo7wJHGQ64uNarHntnOJk,1856 +torch/include/ATen/native/cuda/RowwiseScaledMM.h,sha256=7CFlh7l7iZfF0LJV1De0oIpF51a6HekfahSpnJLCFHI,642 +torch/include/ATen/native/cuda/ScaledGroupMM.h,sha256=9hmv-1bRNk5e3qVOjbJWxJ5ogcEMY9xqKOedb0wqJxs,688 +torch/include/ATen/native/cuda/ScanKernels.h,sha256=Z5e-Sz6SuK1LcjtN20OkS_ZXtAAqxwc-RIAzmlGMdQ4,1056 +torch/include/ATen/native/cuda/ScanUtils.cuh,sha256=ni5Qjfdhu5eDl7_nS6ksOb2LF9g8fa2SSHvyNOKGo7E,22396 +torch/include/ATen/native/cuda/Sort.h,sha256=Gxdo9lxJMyGDs2pXFrpAUIkJ6LFYTGT1od1mssVpryU,677 +torch/include/ATen/native/cuda/SortStable.h,sha256=80YBkTvU_iXpcC7M3Rf63C5EgosFTDZicZhK0QbWACA,715 +torch/include/ATen/native/cuda/SortUtils.cuh,sha256=R0BnqLVuM3pLhk2D37fL0xYOFzWnU8Ao-rB3tb29Ndo,12977 +torch/include/ATen/native/cuda/Sorting.h,sha256=a001YGQmPVt8jOTlY1yRTLfmCs2ujtVbRjzQXen9ObA,672 +torch/include/ATen/native/cuda/SortingCommon.cuh,sha256=4AoP5-D0bXJcauAbKYdXgkEXx59E2nqOX6-4EOlYNPo,5908 +torch/include/ATen/native/cuda/SortingRadixSelect.cuh,sha256=U8Aeq6RdBaJlUrz4q8lV9GjGx44M9wdfqeMKD_T1INc,13000 +torch/include/ATen/native/cuda/TensorModeKernel.cuh,sha256=89y89JUVsc5CE-FfCf2QwNa1DnRe9joENvW6y6kQEQ0,15119 +torch/include/ATen/native/cuda/TensorModeKernel.h,sha256=s4vd1wVRvydimJqbDE2Ew0W7ZukC8sVO_gGBh91UXXU,696 +torch/include/ATen/native/cuda/TensorTopK.h,sha256=24GqKd7fO4XVsTFFxNUSAehF0dWB9derazoLQJaK_ic,526 +torch/include/ATen/native/cuda/UniqueCub.cuh,sha256=_O7OReshY1sl1TmP4g_qYA_D3i1avxbx155kwHOhjI8,573 +torch/include/ATen/native/cuda/UpSample.cuh,sha256=R0sLVzBTn5lD09HZgR1ZXCcBZbECLSq2-d57gQKsCoo,12259 +torch/include/ATen/native/cuda/block_reduce.cuh,sha256=fzoHhLnfLnwWdD9Qhks6JE4Sz71L8jnZP-p4wq9ZgZ0,4885 +torch/include/ATen/native/cuda/cuBlasCommonArgs.h,sha256=n23nzAvEOU2NJ7xC7MeBablqzzJy_BGW41QxGBlu-I0,7295 +torch/include/ATen/native/cuda/cutlass_common.cuh,sha256=maC4jif36oAZCWZ0pGTI-U3KZLFxnTmJHZaqkb9RQi4,1584 +torch/include/ATen/native/cuda/fused_adagrad_impl.cuh,sha256=UzXzDK1eKcPWsTVUWmEaKZblNZRfMYhz_GvOG9VCo8c,1136 +torch/include/ATen/native/cuda/fused_adagrad_utils.cuh,sha256=vtIPlDr2XWtUbuVfVsH21RXq9AtNhFYMSyZzZankgrE,4509 +torch/include/ATen/native/cuda/fused_adam_amsgrad_impl.cuh,sha256=y14YXqgCMVXAdI4BW2Gir5vhEJuYLycv10Zd_vZZQR0,1326 +torch/include/ATen/native/cuda/fused_adam_impl.cuh,sha256=IqTG7RleALVVS-ig7nzi8DI9-loOagHNJemkpfooA9M,1236 +torch/include/ATen/native/cuda/fused_adam_utils.cuh,sha256=PU2d9EwAVR5GezAnkbsIZDUq35nN8DQdrXzTHKwuaiw,7460 +torch/include/ATen/native/cuda/fused_adamw_amsgrad_impl.cuh,sha256=yxoaX8NrY7EHQrXUf8e-4AH1P0ws-dsMGrX5UnQWn2E,1328 +torch/include/ATen/native/cuda/fused_adamw_impl.cuh,sha256=exUE3EuK8cXW-LYyEQSvppmjhPFvS9-sNBtD4nNaSiA,1238 +torch/include/ATen/native/cuda/im2col.cuh,sha256=sLq6Lw3hjBQUcDgwivmQRtEyOYXPnV9iOa5FcAuX6Fo,10295 +torch/include/ATen/native/cuda/jit_utils.h,sha256=fV7haUphWq2FueSwaA6sSD6mwW359DFqT-vSQLAA40M,7619 +torch/include/ATen/native/cuda/reduction_template.cuh,sha256=46QL9N50joZIuA9a1Z6eKr3RCCYM-ZXDaRhMJNzU_yc,22746 +torch/include/ATen/native/cuda/thread_constants.h,sha256=grcr_JfYX6d7pvFtmbsqCQ_F5NQb52oMfDsxqxUaoys,944 +torch/include/ATen/native/cuda/vol2col.cuh,sha256=3XKNLNPe4qx8OKjPz7bokWu2p5nZbAzeplgaeYYkNjU,8614 +torch/include/ATen/native/group_norm.h,sha256=thomCrodRTrcM5nMMsN2DFtowhO9A58ZgyVOePgYW24,1206 +torch/include/ATen/native/hip/bgemm_kernels/bgemm_kernel_collection.h,sha256=YFcgkYfdYGwOSSzIOhLrpd4SbywMuLYZbogQ0rIoGMc,3745 +torch/include/ATen/native/hip/bgemm_kernels/bgemm_kernel_template.h,sha256=zydAZDwV5OA6ijNTLHNjxw1Hlyf5V6RtT57dsZhjRnk,6372 +torch/include/ATen/native/hip/ck_bgemm.h,sha256=-QZ1yyPt5CNI0JWgHE5XtGJ7DzTpp-PzGhtwpCCD1wY,720 +torch/include/ATen/native/hip/ck_gemm.h,sha256=d2347KYZx8f8vwYZ_q-1EXcVEaNSpZ6z23uMXa8yubY,963 +torch/include/ATen/native/hip/ck_gemm_template.h,sha256=cZeSz2KhrgZ7-2Zh4E6bD6CX5s4ruPE1MUwqKFgD_CA,16300 +torch/include/ATen/native/hip/ck_group_gemm.h,sha256=8H_XU8ssrcrFLBSBuMA_NnmST640ftnttkDeGc4aKGg,667 +torch/include/ATen/native/hip/ck_types.h,sha256=nARKy9Cyc2UaCjNmMjLEZqw9uZUQ1fna8tB7uOtYiqI,1976 +torch/include/ATen/native/im2col.h,sha256=MIjpA20a50wTwk8QK-rwt6l5KolJnTbXqzMWfj6sRcs,5645 +torch/include/ATen/native/im2col_shape_check.h,sha256=x4mVW_K4EwDugX-KKMSgQ-YcCt4HDIUcNhUPTIF6H4I,7836 +torch/include/ATen/native/kleidiai/kai_kernels.h,sha256=zM1wBosuas7rRT-hy_HpJJnc1ugXotbl7nlkzsx8Kmk,1394 +torch/include/ATen/native/kleidiai/kai_pack.h,sha256=mGex2awT7zziuOg-vXT98K-84pQjP9GOOXimcIGb2kQ,3123 +torch/include/ATen/native/kleidiai/kai_ukernel_interface.h,sha256=QxcyVl4MJCr8H7vd8zQolVqfILpK8C5hPG8dq9FIoCc,8605 +torch/include/ATen/native/layer_norm.h,sha256=Dj2T0UBwQ8sVEzhKM5dMx2PSL1LRYy6L9EHDZoDVfLo,4994 +torch/include/ATen/native/mkldnn/xpu/Conv.h,sha256=ysGijW4z3ajwN7P0uhV-jD1XHu475z5F95Ywm4BB2UQ,1870 +torch/include/ATen/native/mkldnn/xpu/FusionUtils.h,sha256=E76DhWj-bEOnVxriGlAspexpKwedEG1k1mCG4ustnbM,2057 +torch/include/ATen/native/mkldnn/xpu/detail/Attr.h,sha256=841ZEDUNdeF9E0JJgQ36y-Z4MFC9PCBGrmCMFEhBkYk,18138 +torch/include/ATen/native/mkldnn/xpu/detail/DnnlExt.h,sha256=wxxs_D1aK-nAsHj0bG1LkoTKwSuSW2LbcekAWEZG81U,18895 +torch/include/ATen/native/mkldnn/xpu/detail/LRUCache.h,sha256=u4GRpKamfZ0sxrfLdo_D5BzK3nYDfPd0Na1yddziNQw,2830 +torch/include/ATen/native/mkldnn/xpu/detail/Utils.h,sha256=ijEc5bp2gG1MmecoAdtQ9iwFr_qhXvO7Ablj0t-o9XA,5177 +torch/include/ATen/native/mkldnn/xpu/detail/oneDNN.h,sha256=2emFRbJ0orM7a0cwiyESDZzDTptG51fbDBVMO2bzrpQ,6697 +torch/include/ATen/native/mkldnn/xpu/detail/oneDNNContext.h,sha256=5QC7aw0F8DpHY4i3N7n7DcbwHuE5b_L3yKL_tx-Zk84,3061 +torch/include/ATen/native/mkldnn/xpu/qconv.h,sha256=qkWipX7PxjSYrJgb6mNmV2NzkOQOPWHJwwPOKQ3ezEU,3948 +torch/include/ATen/native/mkldnn/xpu/qlinear.h,sha256=4D69j6YCrvcXKHYgFeDOpAwhYoZR8334SfiORHYSClE,3160 +torch/include/ATen/native/mps/Copy.h,sha256=ikCHe5b9wsTB_SbzpkyUAq68voT88htpV0x0vkL6mZg,568 +torch/include/ATen/native/mps/MPSGraphSequoiaOps.h,sha256=eDew3qy5L6CY8D0kKjtNLHoY1jpz3BI0t_7rU6WSkrU,1819 +torch/include/ATen/native/mps/MetalShaderLibrary.h,sha256=QDmULHcTsCG-4VdzjZORUm35MXETzQRRFOt3p2QCGN8,7008 +torch/include/ATen/native/mps/OperationUtils.h,sha256=TvI5X7xQosIa6ciLWEUJG6gew7hEgIigzh7sRn81ycU,31409 +torch/include/ATen/native/mps/TensorFactory.h,sha256=I-rCnGz22gKLWD6fDMr-I9Hi9ppXgvglpGJiFbA0PUQ,1277 +torch/include/ATen/native/mps/kernels/Activation.h,sha256=qwqkjC7SZLAJYoY666eylMKhK17r_UmwlS2ukbljrS0,482 +torch/include/ATen/native/mps/kernels/EmbeddingBag.h,sha256=-1ttbbZ6SGlApy9OhO-LxH5CvGNx5Do4-LvyMydS1K4,1675 +torch/include/ATen/native/mps/kernels/GridSampler.h,sha256=rn1WbqpHrnJ07XgY_XY7e0T_z7KeHbGXPBO_yTYky8E,1133 +torch/include/ATen/native/mps/kernels/LinearAlgebra.h,sha256=XcbWQ_jWk4PrMMu7J0T6zyXTeeiyrB_Nd45pUAQzQ28,763 +torch/include/ATen/native/mps/kernels/Pooling.h,sha256=rv1Boq-W9PcXluM3JB9LyKBHMJ4-jXqDGhgm6fS45VI,2652 +torch/include/ATen/native/mps/kernels/Shape.h,sha256=X_tcgpkY6w9m3zig39mji41b0H7iqdBXpWeSH2wcy50,834 +torch/include/ATen/native/mps/kernels/TensorCompare.h,sha256=0ZjCBSyMYFEmhnIo6tQvXtZdqeDwNMdwQIWIG7EGJR4,350 +torch/include/ATen/native/mps/kernels/UpSample.h,sha256=qdjVWz4J5YKsBmiTcxRndZuRDS7UUCsb5TXrINBWz30,632 +torch/include/ATen/native/mps/operations/BinaryKernel.h,sha256=L3SCA2WxgsO9u-jOw9sDY5iKHUxmM35N29QjZOaHb7U,529 +torch/include/ATen/native/mps/operations/FusedAdamAmsgradKernelImpl.h,sha256=BgPQBizSYsNaPCIe8ZbYueyZFrxGUNRUfk7L4zOZ8Xs,1278 +torch/include/ATen/native/mps/operations/FusedAdamKernelImpl.h,sha256=XhWvSv1fGpNH5kzvuIl-h9xFYMZJYnJ_H9eNrDT20p4,1182 +torch/include/ATen/native/mps/operations/FusedAdamWAmsgradKernelImpl.h,sha256=oJsHUyx-rC92jX5ewpz22EtBRBUlO6pxyjR9vhyjO6U,1266 +torch/include/ATen/native/mps/operations/FusedAdamWKernelImpl.h,sha256=8I9wy_eE2vHdlNF8VIBBHCIOjQnsYF5GW8G_EctLYss,1186 +torch/include/ATen/native/mps/operations/MultiTensorApply.h,sha256=KHAe4mERQg_OGYmyPt9bpZ9eL4Qs7WcAphnyzMaXCoo,16645 +torch/include/ATen/native/mtia/EmptyTensor.h,sha256=rPrK1OWsjkYIW9maPhZKyYsbTzo8fLvm34zJiGwWum4,1383 +torch/include/ATen/native/nested/NestedTensorBinaryOps.h,sha256=d1qyKjLoRcQCjE_xbJSpws2X17D94byz6sELLydpHvs,690 +torch/include/ATen/native/nested/NestedTensorMath.h,sha256=TqXc5pLX5wuB12tpUtFPvSUziqYjmua70xpwAHUftQg,3056 +torch/include/ATen/native/nested/NestedTensorTransformerFunctions.h,sha256=S39_7p84ZNfyYMqXc2qZKElvjd9BO-d4S_sKthDpnjA,3194 +torch/include/ATen/native/nested/NestedTensorTransformerUtils.h,sha256=muMNpxftq4mCu78ycLdKDLtylmhStg9YLTVl8yYEoF4,1697 +torch/include/ATen/native/nested/NestedTensorUtils.h,sha256=0pIZO1jFwM0UYM9RGBdmaOQt-KVe4-ieVhijEwMwM7g,15956 +torch/include/ATen/native/quantized/AffineQuantizer.h,sha256=JK15Q3Wc6rzMXTBTwdXaABjwsS6OqH66DAgj0mvCNUQ,4102 +torch/include/ATen/native/quantized/AffineQuantizerBase.h,sha256=VE4F06Rg_DW_xnmuRM4pg1Iz7QRexvEfGuSfiwpIf2k,1797 +torch/include/ATen/native/quantized/ConvUtils.h,sha256=GkwHDEgcfw__JrWK39inKYKdivBnh3h_U280KxaOJmo,2561 +torch/include/ATen/native/quantized/Copy.h,sha256=Evv7hQksZblQLfm6Y3S-BKKPQVKoGBXZWhf_cfXQJd8,423 +torch/include/ATen/native/quantized/FakeQuantAffine.h,sha256=RGsUIhHjf5VuoAGpqjmpqlwSCGI09c6gilJOslA3LJk,2113 +torch/include/ATen/native/quantized/IndexKernel.h,sha256=pob6-0e8s7ECFISiJltSLwhENpjryUjD3tWpLeEgWPU,852 +torch/include/ATen/native/quantized/PackedParams.h,sha256=rwMOYdFf3wZkUNVHD_pJkibWb4KP_QaUPDV4HRii9V0,4994 +torch/include/ATen/native/quantized/cpu/ACLUtils.h,sha256=dXcvfcVb7GdhQ7wvPSm22kM9NMkTadlHcgXbrW-UZhY,8403 +torch/include/ATen/native/quantized/cpu/BinaryOps.h,sha256=IwJVIUA1jRetqz-N8pTZUOvaYYRmXqfnoY6qEd332Z4,433 +torch/include/ATen/native/quantized/cpu/EmbeddingPackedParams.h,sha256=zJFmM9JtxFHMEO4G6SMThaj9ixpbdj5MjKnua2IPzVQ,1209 +torch/include/ATen/native/quantized/cpu/OnednnUtils.h,sha256=GEwNKoOXBQ9puzYqMQL9HdDDQyE-JIcG6tbslnRf3PA,15948 +torch/include/ATen/native/quantized/cpu/QnnpackUtils.h,sha256=i_4YR47eaZ4FMTSJf9CKrad2_522AQgmWYFO5Cafpjg,18176 +torch/include/ATen/native/quantized/cpu/QuantUtils.h,sha256=9C8ndSrEaesp_SKfTtMsuDrHDvKrk_gmpDRIUYXjyfA,8746 +torch/include/ATen/native/quantized/cpu/QuantizedOps.h,sha256=KYYegBTR3DVaikrdsYYamgtmj_aeyh5yQyczOmZ2GGg,9151 +torch/include/ATen/native/quantized/cpu/RuyUtils.h,sha256=xX9aPjYelhz52Ocu4AIXkSMJbUp322xAcEAskjV8rf0,614 +torch/include/ATen/native/quantized/cpu/XnnpackUtils.h,sha256=NHIEnV1oTALGBoyvOaYZSLdQyOjZii-W4VDItKS-Pc8,14695 +torch/include/ATen/native/quantized/cpu/conv_serialization.h,sha256=d2UccHTowC2aLTau9NS1PegSLUyuSKF4qXS8ZaMqRaE,13564 +torch/include/ATen/native/quantized/cpu/fbgemm_utils.h,sha256=BEDhoTW4Q8KIYe3KGw6Q-c0KdvM8QnjVWo4jLtfPOH8,12693 +torch/include/ATen/native/quantized/cpu/init_qnnpack.h,sha256=GYFIH5L2cU8AuwM2hsTC3iLkh6Wl18bsVNWEMekxDNo,391 +torch/include/ATen/native/quantized/cpu/qconv.h,sha256=pXB9sz3UhfL0cvVz6Vjr4Q0tU01w9nf6-O7DoqaCfRE,3914 +torch/include/ATen/native/quantized/cpu/qembeddingbag.h,sha256=KV3fjA1AlOaha45J3S8ldNVnPKOqY6zEWE3XKDfMJCc,1306 +torch/include/ATen/native/quantized/cpu/qembeddingbag_prepack.h,sha256=StBK1BuXLfHrbsLmd1bqLrdXjoJRy--Qxd3uUafVY2E,646 +torch/include/ATen/native/quantized/cpu/qlinear.h,sha256=maU4ZphbiSsqNgQXRAbLqVMq2aV57b26E8m-uCjfi74,1988 +torch/include/ATen/native/quantized/cudnn/utils.h,sha256=0cYhGvW3cylAAN6wpXN_yFKfCQi_T5AfOq2kXT-1pKU,11052 +torch/include/ATen/native/quantized/library.h,sha256=WX58Eio_L3WOfHWw8ezgPMT2RYJV-iGHR2kkhE8tvgo,456 +torch/include/ATen/native/transformers/attention.h,sha256=jMH-1XPNW_uDBuJFrhaGXYmLz7r_khiatf3BTj5VMIU,2595 +torch/include/ATen/native/transformers/cuda/flash_attn/flash_api.h,sha256=9xfvfkzOXAEjwF7r0g51dX0FkRbshk30s9-XiDiUtCM,5709 +torch/include/ATen/native/transformers/cuda/flash_attn/static_switch.h,sha256=yF8MNvRvjCNKBBuupAWldqOYUL4joqZ1Q-HH45HvDr8,4133 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/debug_utils.h,sha256=JfpM-3_og3p2i_13S9-shnIuiiECS1BslTbM1Ypi3jE,10723 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/epilogue/epilogue_pipelined.h,sha256=7ReeyJUWo_mAgyOVoe9aKdW3iSO2bH66ZjZ4MQcXhp4,23177 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/epilogue/epilogue_rescale_output.h,sha256=vmX-3u8z0yRUuQwT7nq-J5b4LX-ZqEv0INq8Yj6PNUI,8279 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/epilogue/epilogue_thread_apply_logsumexp.h,sha256=Mprl1jmhxe_YWdyeOto9vu9foeELPCS4-u9qajbUHY0,6557 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/gemm/custom_mma.h,sha256=scj-yVwhBq49htO0eaBceWogeIZEqccIOfJBPZjDQN8,2850 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/gemm/custom_mma_base.h,sha256=VP-7ONeo8HHwgu4VQJNBCEjdUz75uXJnTO_XW3FmHR0,6683 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/gemm/custom_mma_multistage.h,sha256=HM28uguCw95nqnjRO3m-MR0zoqay8za-5sjQMdgj7X8,28308 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/gemm/custom_mma_pipelined.h,sha256=y8-PHhnr2QBFJDIZNHbDpfGK1bT1MeKg8MiMq3S-bto,14806 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/gemm/find_default_mma.h,sha256=6hdzChIT1o4d6tBqzH0JNjET5d6LlWJSWBGTQUD6Bgo,5602 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/gemm/mma_accum_lambda_iterator.h,sha256=1_yc5XeZjf1vojsGOpc_L2Wy43O7nSkOKnooYRwjc_k,12963 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/gemm/mma_from_smem.h,sha256=WQE001K26jL60Th1K_CP5lbCUmeocxajK9VhO2sT4ps,71007 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/gemm_kernel_utils.h,sha256=oewohNJyPAx6fjWBWNLmtfVB87fjdakq8sxOCud3URs,9076 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/iterators/default_warp_iterator_from_smem.h,sha256=EIfJhCg_UpxUDHGAjLP1ZraB_VB4nCF3lYhH3L6tsZM,6229 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/iterators/epilogue_predicated_tile_iterator.h,sha256=sXpFETialbZa8lN8dwUoJjbbX1klzGtTmTHO2hYSPM0,24867 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/iterators/make_residual_last.h,sha256=-g2Tpzu7yxRqERw54p7Y1wkay0HUNRIKFwMDGwxE-CY,1983 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/iterators/predicated_tile_access_iterator_residual_last.h,sha256=7vscFjJCY1FZcDB3uPHdk4zHIkEBlUw8g1z6VFlrRZQ,66840 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/iterators/predicated_tile_iterator_residual_last.h,sha256=thNA4N8LEfUs2oOcIgJXC7InNQYwDS8lwiql1YXF2UA,66878 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/iterators/transpose_warp_iterator.h,sha256=xFK9U4kJb8ZyaHfIB-nRmf4b5OU-inMZ6OK89scDrFE,1251 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/iterators/warp_iterator_from_smem.h,sha256=ZTZSXXEVerGxPxsnwRXsy41MMypXB2jIizQbH-yVXI4,10598 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/kernel_backward.h,sha256=rkEF-5PmPdth2hw8m3To990FIUld-B3cePnwCjhP7Zg,102908 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/kernel_forward.h,sha256=jhG2D8esMH2rJI2_vIag9bkhjBPadx6V9Rb24_4MKBo,55726 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/kernels/cutlassB.h,sha256=VSIAtGu8hEXdYYtoDd-Zu9XJ4lbcY6LwGc44d9jgU9s,97814 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/kernels/cutlassF.h,sha256=y45iETCfqRVbzoAnz7NZDNi1KyFR3yxWnze8T_SNqxA,26522 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/pytorch_utils.h,sha256=3sEakCFjwor2T9ynLGx-1GK7eQLXrYOgGxhgXeCG6EU,1263 +torch/include/ATen/native/transformers/cuda/mem_eff_attention/transform/tile_smem_loader.h,sha256=KdQ7GqV_cJ3UuX0mkZ0I4jsHTiRCB1Ub20nbCqVdhUM,2477 +torch/include/ATen/native/transformers/cuda/sdp_utils.h,sha256=_U3CA6xELPlmoFfnvPVo4-gAc8dOWTEw6DG2pD1eA-8,903 +torch/include/ATen/native/transformers/hip/aotriton_adapter.h,sha256=CWlbCmHyHL5nOk8z0C-OmlqO6l7Z3nn9x6Cq-9mAg8U,5691 +torch/include/ATen/native/transformers/hip/aotriton_versions.h,sha256=vA9GhC8Zzvquhbab1oM9k-CY1TPl_QZhz3W-WZDeI9s,722 +torch/include/ATen/native/transformers/hip/flash_attn/ck/me_ck_api.h,sha256=fQ0e01M63NdFWgrMJWF3iKCyU4VWb1FDXFezjK5QAc4,2093 +torch/include/ATen/native/transformers/hip/flash_attn/flash_api.h,sha256=AOqsZUIqFVp2qw3fFUe8NP4RnXFwioWl3ib2nSb-Z4U,21676 +torch/include/ATen/native/transformers/hip/gemm_kernel_utils.h,sha256=3HnXEq-f874TY2EG71StZgVa7HsPPj_nujlSHqmOOpo,1766 +torch/include/ATen/native/transformers/sdp_utils.h,sha256=10iy_0Sx562RUBcq4A1bKByG4FFAYqq6l8QkJ3MqtO0,3263 +torch/include/ATen/native/transformers/sdp_utils_cpp.h,sha256=20FK-dXJdX3CkpKGur3Sp_MPJiYlksKYW8nhVxGWHiI,18734 +torch/include/ATen/native/transformers/xpu/sdp_utils.h,sha256=I6xFOvRCXRmBGbyC0tN5vn7Q7qBmNLMaO_yE25eaSV8,776 +torch/include/ATen/native/utils/Factory.h,sha256=Y5S_yA3k6R6NpGJKqQoSgSPWV7kLJ4tiraUXgU9jieE,766 +torch/include/ATen/native/utils/ParamUtils.h,sha256=khgtZ15ZjkUAy3XE0f718uKxS5wUoNXFHDPXidAXrEA,1499 +torch/include/ATen/native/utils/ParamsHash.h,sha256=YvhfXFcsaOe9nZtCdC3wr_Wz-kM5yJGtASA0mgRYdmY,3489 +torch/include/ATen/native/verbose_wrapper.h,sha256=ty1ThcDa4sko4hSQNAyxdl65yED_6RgAJdq0uc1kXoA,460 +torch/include/ATen/native/vol2col.h,sha256=mYlqBalgcBbp5Cnz6RUWQ31iX6KyBR4VZc3595_XVuk,3923 +torch/include/ATen/ops/_adaptive_avg_pool2d.h,sha256=XgccwSwIinz6Si91k5vpNTzTtpEvdOucL3OhMu8OJLk,4492 +torch/include/ATen/ops/_adaptive_avg_pool2d_backward.h,sha256=wSbk9tA7hmdUg4lVkKa2eMcdQkBtG14zuYb6Qu7Tlyw,1751 +torch/include/ATen/ops/_adaptive_avg_pool2d_backward_compositeexplicitautograd_dispatch.h,sha256=SZYE79Q8L_WaxkwRGKWZ-hdn4NhFlGClHmGoQ_UvTa8,1260 +torch/include/ATen/ops/_adaptive_avg_pool2d_backward_cpu_dispatch.h,sha256=J500kpwxMuZGlOW7Q8uL1m8EIb8LoGksvjkUVQbrWFQ,1057 +torch/include/ATen/ops/_adaptive_avg_pool2d_backward_cuda_dispatch.h,sha256=SZO71lQ_z-CXyZajSHBhZ8kJoXdb4k-8KFVYcJ4Ctzk,1059 +torch/include/ATen/ops/_adaptive_avg_pool2d_backward_native.h,sha256=ays7-B0cEOBooXb0rxDBAWWNBEM0Q8Uf8ouW_WGuiKA,1062 +torch/include/ATen/ops/_adaptive_avg_pool2d_backward_ops.h,sha256=cCxPvDxjCGN-3RrcQjlgjTRhiJavD8qUugUAXQdf9R4,2192 +torch/include/ATen/ops/_adaptive_avg_pool2d_compositeexplicitautograd_dispatch.h,sha256=QHgEDhUuLRUkrUo1vN0UNuBXmEmlZe8DiVBr_RPdxZU,1503 +torch/include/ATen/ops/_adaptive_avg_pool2d_cpu_dispatch.h,sha256=gw49tkR93HlWOjhnvtUdtRQI88XMi3WhqS2xx-HckcE,1154 +torch/include/ATen/ops/_adaptive_avg_pool2d_cuda_dispatch.h,sha256=OSk-9N0fYjOF9Uup-dnHn9hHOT8M4Osbew665pPXFKQ,1156 +torch/include/ATen/ops/_adaptive_avg_pool2d_native.h,sha256=ZS81_3y9h-O2Z2evgQd3tVWxGOIfO-wjjxYKMWr9KA8,1260 +torch/include/ATen/ops/_adaptive_avg_pool2d_ops.h,sha256=R5EjJsAHgtOGSpZZWgat073kVpzON8lLt0V85ELckDo,2150 +torch/include/ATen/ops/_adaptive_avg_pool3d.h,sha256=oi5hX8FWavP3c-ptICGhaMGkyrKmVz5RDYPDJwQoDw8,4492 +torch/include/ATen/ops/_adaptive_avg_pool3d_backward.h,sha256=KWjQxLM_baYJmyPB9GwUT_0i4Qj2qj0I23hmnQ7sMlk,1751 +torch/include/ATen/ops/_adaptive_avg_pool3d_backward_compositeexplicitautograd_dispatch.h,sha256=iUOnlZqHzbBRygw80D4d6D17jiwGCLMDXyh0TxYwKxc,1260 +torch/include/ATen/ops/_adaptive_avg_pool3d_backward_cpu_dispatch.h,sha256=ybaVPKXWi746Cu8vHef-ZAbiws4-XLOrKfHArVfOBPo,1057 +torch/include/ATen/ops/_adaptive_avg_pool3d_backward_cuda_dispatch.h,sha256=daltqctQa5Tu1Gg1-twUKzxp-92leXmpF1C5Ic-Vv2k,1059 +torch/include/ATen/ops/_adaptive_avg_pool3d_backward_native.h,sha256=DXi09uH8eP0AexZt-IqR10txhb3MoiwCbwPywqaWRYk,1062 +torch/include/ATen/ops/_adaptive_avg_pool3d_backward_ops.h,sha256=UApQTQxFkjVYFxmFk_3KxM83IueTjN9ew_7pCZ2OHeY,2192 +torch/include/ATen/ops/_adaptive_avg_pool3d_compositeexplicitautograd_dispatch.h,sha256=ESSOYVVWQGUp7dWxEOGKanQP7qMpP0WhLt8yWCE12s0,1503 +torch/include/ATen/ops/_adaptive_avg_pool3d_cpu_dispatch.h,sha256=960NzfJjHe5iBb-XllDk1CvOX_2w6fP3YQ2VBpXbnIU,1154 +torch/include/ATen/ops/_adaptive_avg_pool3d_cuda_dispatch.h,sha256=x7Ksn3SKJJQVq3mOewhSp2nZM2BRuWOZwlchitb-LuY,1156 +torch/include/ATen/ops/_adaptive_avg_pool3d_native.h,sha256=DTc2U1Gx5IgCfrkacSQzL_c_WZ05CKbYaskpf9ED110,1148 +torch/include/ATen/ops/_adaptive_avg_pool3d_ops.h,sha256=nK0NeFSKFfSEB53ftMbL11IAqYvzsRno07s6zkfHHh8,2150 +torch/include/ATen/ops/_add_batch_dim.h,sha256=SCUH3bDV3m3aF1xPRUyvHgAhaNNmp_znUiX1B8b_noY,1037 +torch/include/ATen/ops/_add_batch_dim_compositeimplicitautograd_dispatch.h,sha256=heQwGBCPYyfxYs9_NOaQeY8hwpkEt2Nb4ihwF3leAGI,1088 +torch/include/ATen/ops/_add_batch_dim_native.h,sha256=U68XEfpIqv7DJhJqKoxHzV6K4CF5P5cygKYsvwPKmf4,798 +torch/include/ATen/ops/_add_batch_dim_ops.h,sha256=zi5gfDrbegY7GQ0Y0j21cwJ69JSRUrlYylsgk6Fe8s8,1381 +torch/include/ATen/ops/_add_relu.h,sha256=iMJqwmvLeiR8UsZIAOEiJPYexTqv6fQuSMo2Zdn-yng,3104 +torch/include/ATen/ops/_add_relu_compositeexplicitautograd_dispatch.h,sha256=Zovwk_NxC11i7WBcmXOidkf4VCA3bKqNmO1YEcJlmdw,1262 +torch/include/ATen/ops/_add_relu_cpu_dispatch.h,sha256=72vmiRIC4vlEd4n-nS4z_XStTdY0W5YfspOtJTTGN6A,1660 +torch/include/ATen/ops/_add_relu_meta_dispatch.h,sha256=f1hHWHifRkIgGSXEU0MMmT79bgVA3GxR4WgycDp2tuY,1167 +torch/include/ATen/ops/_add_relu_native.h,sha256=oDfiZ9k1tI1yJfpmAZdwDGo8BZNqolM80g-nhUlDGco,1413 +torch/include/ATen/ops/_add_relu_ops.h,sha256=Lw7ATP2OaRGIZpZoYd0p9W-MzsQT0o2c7Tdw3e6i-As,5183 +torch/include/ATen/ops/_addmm_activation.h,sha256=QJR5rPCoLHnQq2vFfhOPYkh7wM8r_Bd018cBSMy7bhI,2146 +torch/include/ATen/ops/_addmm_activation_compositeexplicitautogradnonfunctional_dispatch.h,sha256=roSW73ja-Elnp6SO6c_EKOev3tJ1oI1DLeCx9G2vERk,1209 +torch/include/ATen/ops/_addmm_activation_cpu_dispatch.h,sha256=ORDrRfew1YD59aBtOuGo5oYultafZSWSV3EzPKjF620,1562 +torch/include/ATen/ops/_addmm_activation_cuda_dispatch.h,sha256=R4DVTH2JWomWBq1FN31jxK-vJdh8mKsW1yurUaAg7zc,1564 +torch/include/ATen/ops/_addmm_activation_meta.h,sha256=sHJEb_3RPH6LrGRMIdllyMAEa2xNcM4YEypw6nNjjz8,980 +torch/include/ATen/ops/_addmm_activation_meta_dispatch.h,sha256=vWYvOK5Q_0I7kd_pgt_nu2IeBiCNRpYO36c9osZyibA,1564 +torch/include/ATen/ops/_addmm_activation_native.h,sha256=AI4Q7QTPzBvfwtpKJjgS4FRL7z8WAq5Qru1DskHfUIg,1316 +torch/include/ATen/ops/_addmm_activation_ops.h,sha256=eO1n9S75zUboLytilpKbqV74vh16a3JkWo6pL8FkCIk,2707 +torch/include/ATen/ops/_aminmax.h,sha256=3fFVmvwUjysAw33JpgBIhz88h_r70dQvmsrggjBJDGc,2563 +torch/include/ATen/ops/_aminmax_compositeexplicitautograd_dispatch.h,sha256=funEBN9RC-STRjfdw5jqNA18Em7Xf6wCV5WfsFpjCVM,1565 +torch/include/ATen/ops/_aminmax_cpu_dispatch.h,sha256=czmV21tn_v2q5B41Eus64y1N28aMYUz9g59NxZyOLl0,1144 +torch/include/ATen/ops/_aminmax_cuda_dispatch.h,sha256=JsVcPaMWs0VtzJPCOXeKRDHx0HEw1FZjyrxSq2qFfY8,1146 +torch/include/ATen/ops/_aminmax_native.h,sha256=5wF1M-yDCBb0V3vjnUivwFjlQxMoMIlJxzWT6WQdwjQ,1189 +torch/include/ATen/ops/_aminmax_ops.h,sha256=I71S0kYDYPZbRxZMEvNffIoo_MqDoI-t1YUL8UoQjAM,3705 +torch/include/ATen/ops/_amp_foreach_non_finite_check_and_unscale.h,sha256=1NOQljfMG1XglLREvJyb9DfaoK_ERI1VAoUECQ-ncJk,2427 +torch/include/ATen/ops/_amp_foreach_non_finite_check_and_unscale_compositeexplicitautograd_dispatch.h,sha256=gGHKUGe-g1tkN6uGH--zBKKAd6hPXPvCqzBSdAwliJo,1494 +torch/include/ATen/ops/_amp_foreach_non_finite_check_and_unscale_cpu_dispatch.h,sha256=6q3OVAk-DE-uKL9RpMyfrLywngFiNP6zwcESMS6LVZM,1082 +torch/include/ATen/ops/_amp_foreach_non_finite_check_and_unscale_cuda_dispatch.h,sha256=0jyBugwPSOy6u9CXK84OaVJ9b1ZrDPA5n8g9r8J1HE8,1084 +torch/include/ATen/ops/_amp_foreach_non_finite_check_and_unscale_native.h,sha256=PV0IAq5QK5FgoN99Nh67HqnngbeyAFz7_9wjisQZ_t8,1324 +torch/include/ATen/ops/_amp_foreach_non_finite_check_and_unscale_ops.h,sha256=AH-dcuRkfgD26BoFhAGtyqTfG51OFufrk_dsmf55m7E,3318 +torch/include/ATen/ops/_amp_update_scale.h,sha256=L2bZhr38H9dak5e2f_f0ckPqYQYl-c6_HZey3FHkuQM,3068 +torch/include/ATen/ops/_amp_update_scale_compositeexplicitautograd_dispatch.h,sha256=c1QPhNJgCL_THcq3YYz4-YZwpW8BA8JSejhGj7aXy1c,1692 +torch/include/ATen/ops/_amp_update_scale_cpu_dispatch.h,sha256=DE6LMbq8Xm44eDMRM8PY4lIK7gXKVFSdzpiiOupgLdE,1151 +torch/include/ATen/ops/_amp_update_scale_cuda_dispatch.h,sha256=J3eE-yBLKfQ3pHej5ngn8XOAvAkq1mHWMh9oS03-owo,1153 +torch/include/ATen/ops/_amp_update_scale_meta_dispatch.h,sha256=jjJpu7MSGVdGyHioCu6WAE7A2ozlT7qOkfLjhNvZYC0,1153 +torch/include/ATen/ops/_amp_update_scale_native.h,sha256=iSKtSwQCQ-bpWhqMigAEOZLMv3tctsyVC4E_rdqxDf8,1587 +torch/include/ATen/ops/_amp_update_scale_ops.h,sha256=vRS0cBkv5FH9WcbhV-lQ2Oszg65Bd_Uh8y7ceULsmeI,3959 +torch/include/ATen/ops/_assert_async.h,sha256=EL7UASSSQrPOCQpX9cKID51BA-ylzlH2jqmoJ6291l4,1161 +torch/include/ATen/ops/_assert_async_cpu_dispatch.h,sha256=Nm49og70M-0R0TP2Bly_Z45jSKYzEVWWmvAgzCjqRHk,1088 +torch/include/ATen/ops/_assert_async_cuda_dispatch.h,sha256=ClXPhYblJvq27cnKNQioa1CaRJoo7kX4VJmDHC80IPg,1090 +torch/include/ATen/ops/_assert_async_native.h,sha256=GI37C173G175moUp72MlZp7F6iwlJgy6LOK5jaWq6Sk,1009 +torch/include/ATen/ops/_assert_async_ops.h,sha256=5xuBXOlT53IoYUSGflG2gS9qpvm6MWuV4grGWpuMCo4,1857 +torch/include/ATen/ops/_assert_scalar.h,sha256=T6GDlEPGqWYfUgHlmPe67byspA0LZ72E1opRsLm6Xys,1006 +torch/include/ATen/ops/_assert_scalar_compositeexplicitautograd_dispatch.h,sha256=8FfO2d0rFLWlIrTGlc2SyNG5PRB5WmZA5GHH0adw4_U,1077 +torch/include/ATen/ops/_assert_scalar_native.h,sha256=5WrqFqpuhZPnpUD6qrb4ZrO88asVIhSxFQVNCjBgFfQ,787 +torch/include/ATen/ops/_assert_scalar_ops.h,sha256=RqRYzVbnevivfxno5Ynh1NYW35vV_Ca9EETbO1DP79w,1339 +torch/include/ATen/ops/_assert_tensor_metadata.h,sha256=N06rmdcMfuexMLeCCbxOUQsEspQCsA9yYr9_FUBe4jI,3325 +torch/include/ATen/ops/_assert_tensor_metadata_compositeexplicitautograd_dispatch.h,sha256=10yYuHXR-dtVDh7AgoGnU19P8lyJsLnkAuGpANV7IOc,1626 +torch/include/ATen/ops/_assert_tensor_metadata_meta_dispatch.h,sha256=PFaLchynyFiL9ioyOWXFuvKGJJbImacl_puBPMtwoW8,1584 +torch/include/ATen/ops/_assert_tensor_metadata_native.h,sha256=Kfpc7AKSE7DQQlfGrAbwqzYokmca0LI0ZvIrInmHtLU,1341 +torch/include/ATen/ops/_assert_tensor_metadata_ops.h,sha256=lqR-qRL8rG9LQnXiJXtEKr63SHhuNi-8ejt828zH02k,1883 +torch/include/ATen/ops/_autocast_to_full_precision.h,sha256=hfl1teIslHH2uGYSbrhGw0DkS7m_ObLFWealIlWZunU,810 +torch/include/ATen/ops/_autocast_to_full_precision_compositeimplicitautograd_dispatch.h,sha256=QaRLX32Fkpfh36LdF-BJgXIxuXhR6jPyieSm3-2fUg4,1104 +torch/include/ATen/ops/_autocast_to_full_precision_native.h,sha256=cDVevhIcqL3y_ino_4LmVCnnrMG2PNn73rTWosjSjjI,814 +torch/include/ATen/ops/_autocast_to_full_precision_ops.h,sha256=mJVIVlCUu2yl_ZDQuLze5wajy8-z2TzxYHQfH_Ig9p4,1437 +torch/include/ATen/ops/_autocast_to_reduced_precision.h,sha256=Wv2q0hBGi-RhZFjnE2FlGWr6Req-K1f-dO3NxUHV9nc,813 +torch/include/ATen/ops/_autocast_to_reduced_precision_compositeimplicitautograd_dispatch.h,sha256=2g81M-nKzQJd76R7UsMaI-ah2ItT9WNbv5HGZj80GfE,1160 +torch/include/ATen/ops/_autocast_to_reduced_precision_native.h,sha256=FTlFashCPT2uADqQ0WZdA_TCBzI7dtN6ddKG-q4YhLU,870 +torch/include/ATen/ops/_autocast_to_reduced_precision_ops.h,sha256=lQUTX7Ona6PfD9MYUIH0i0b980y1txPicHYpbQpeMTg,1629 +torch/include/ATen/ops/_backward.h,sha256=d7SjCyo6IqGGw0PGBR4uZ_CX7NNglC1DaGur-Zx65TY,792 +torch/include/ATen/ops/_backward_compositeimplicitautograd_dispatch.h,sha256=fQcoSdCOs_2Kf39bx7rfB-Mk4lGj515atdbdJbd9Nps,1191 +torch/include/ATen/ops/_backward_native.h,sha256=ngx-bUzZvHx-oJo4RAay3_CzJp-aGjP2oDLU48dAFww,901 +torch/include/ATen/ops/_backward_ops.h,sha256=7YCxOPTU3Q1dxAtqqVxHW6-s2Ds3vFWfj6wgMYPIRnI,1652 +torch/include/ATen/ops/_batch_norm_impl_index.h,sha256=iixJWhxyg1c2Um08FFtCJ1KYemNzSnv43x8C6NcxiyQ,1545 +torch/include/ATen/ops/_batch_norm_impl_index_backward.h,sha256=GYgoMpHzQ_cPKXErLzMgzCubILqnjhlz-rdhLEf7Dkc,1813 +torch/include/ATen/ops/_batch_norm_impl_index_backward_compositeimplicitautograd_dispatch.h,sha256=2lxe5GWrPEywccosIx3SUoHfbb9WErwtecbpERyZvSs,1498 +torch/include/ATen/ops/_batch_norm_impl_index_backward_native.h,sha256=UL6scrlKe3MomR2Yx9427mT3hej74S9KYDNHzWMSOJc,1208 +torch/include/ATen/ops/_batch_norm_impl_index_backward_ops.h,sha256=I03wOAQ85mJmF6v7sGz1k4-aAJVY4ywEytJt28k5tyw,2707 +torch/include/ATen/ops/_batch_norm_impl_index_compositeimplicitautograd_dispatch.h,sha256=AA7CBSK076takeQoVOdZiImGfksykg2nMMu2-oCS6Tk,1367 +torch/include/ATen/ops/_batch_norm_impl_index_native.h,sha256=F7OQQrSOFvRnMtQq7RWR5HsrqcIUpYI7EUBm6eSntAg,1077 +torch/include/ATen/ops/_batch_norm_impl_index_ops.h,sha256=LyB3sck-CiuBZ6aUbQAUo8CtV2lQnsaJ4heEUnk4URE,2301 +torch/include/ATen/ops/_batch_norm_no_update.h,sha256=paABDF9cMaCKUNroyZSBSEZX2RyR4ej-aX8oQIxeOmc,3108 +torch/include/ATen/ops/_batch_norm_no_update_compositeexplicitautograd_dispatch.h,sha256=aFriUrpVjWq7mP4vk9goTokCQqBuClGYIOb5NGgiHkg,2164 +torch/include/ATen/ops/_batch_norm_no_update_native.h,sha256=EiL3nF8o8mzyQcCOR1iXbvwKgMQ1Yp_pQ_bdNAIfmJU,1453 +torch/include/ATen/ops/_batch_norm_no_update_ops.h,sha256=7Ov5N8KxOXTV35txWNf6mu-KUQOf5re_qObxbBXntIU,3900 +torch/include/ATen/ops/_batch_norm_with_update.h,sha256=BdVUv1Gr48hd7KqMFtaK6-7EvIMU9tzmM4TbWG5Tu_M,3797 +torch/include/ATen/ops/_batch_norm_with_update_compositeexplicitautograd_dispatch.h,sha256=cBeoS7KbHBaHvXnrtjbk1Sgwjfh6CzfvmTCadL6Shw4,1324 +torch/include/ATen/ops/_batch_norm_with_update_cpu_dispatch.h,sha256=BdZj0H5Gdmu8StKZiAlPXebZLB0rB0hN3wx9noBIcwI,2016 +torch/include/ATen/ops/_batch_norm_with_update_cuda_dispatch.h,sha256=PGKXVw6Kwli7YhqOIKTsRa8hsZRsTAMRP-_9g1P9RDo,2018 +torch/include/ATen/ops/_batch_norm_with_update_native.h,sha256=kovIbh2mhDvFITgKXK9FqAbkHcLsXHA7NscJf8se5Qc,2703 +torch/include/ATen/ops/_batch_norm_with_update_ops.h,sha256=553h2bAUr1qu8TouNcEw0r3Ad6tr1fcl8fN78xjZNr8,5158 +torch/include/ATen/ops/_cast_Byte.h,sha256=2jpeuKqTYor2lkqGONqgl0gu8M6CPFLcBAIeYTcAmd8,1007 +torch/include/ATen/ops/_cast_Byte_compositeimplicitautograd_dispatch.h,sha256=asLZ0CUtI7Xoypfffb73S_FAAqlK6QDR5bo0aCcJKsg,1075 +torch/include/ATen/ops/_cast_Byte_native.h,sha256=oUHpAWJpX-O9kKN6uh_zrYpGvBiZOaJZ5VVO3QBpF6Y,785 +torch/include/ATen/ops/_cast_Byte_ops.h,sha256=p4cbmsee9eUZYmZR0gQJHsuo1Au1MgX1nXzIuIdw-1c,1326 +torch/include/ATen/ops/_cast_Char.h,sha256=wk82eR_hQWDhbQ07bSo5qiA6O-CF-vzJvbEjAl6Ayb4,1007 +torch/include/ATen/ops/_cast_Char_compositeimplicitautograd_dispatch.h,sha256=npZ6R-keRNU91101-1HKOkuUSdbRVmHcjllYSTVZGZ8,1075 +torch/include/ATen/ops/_cast_Char_native.h,sha256=GikKFL1JSwol2HwPru0yy8ryvwC5qPlVjPQ_2-stRug,785 +torch/include/ATen/ops/_cast_Char_ops.h,sha256=tnWxJ01s0w0ed7D3CdJBPAVwkBByq4YOIp55vcHw29g,1326 +torch/include/ATen/ops/_cast_Double.h,sha256=fP7xEIx3cuaY_a94lx_aFLwABPFczBuq22JD79qDWJk,1015 +torch/include/ATen/ops/_cast_Double_compositeimplicitautograd_dispatch.h,sha256=Vorx1r1zfC4w9BjZ_S36zNd1I8WNOGAubKhM_9EZN_o,1077 +torch/include/ATen/ops/_cast_Double_native.h,sha256=2XG3irjlXe5j5Hy3-iM1VqiBIJAbKvkqSr_Euq3BqSA,787 +torch/include/ATen/ops/_cast_Double_ops.h,sha256=gDvsbmP89SXuL1HCyxn0qb3tPRPJW-i0_akr7234JkY,1332 +torch/include/ATen/ops/_cast_Float.h,sha256=Qj0eQvpkgpa81BWbVbzABCdIZeCIcmuYFXCO4bGd7Z8,1011 +torch/include/ATen/ops/_cast_Float_compositeimplicitautograd_dispatch.h,sha256=k4s6vnBdmEvzRUNDqftayZz8dIlN0s2JcVF_zIOsMzk,1076 +torch/include/ATen/ops/_cast_Float_native.h,sha256=TLI0pqDyVs4uvvVAW-1pxSKSw2hY4MgE3LoWRPWKxMY,786 +torch/include/ATen/ops/_cast_Float_ops.h,sha256=LvbmCuMiXQ9AxaKrWx8bLMeQUxZhOVhsLy82DE8sqJ8,1329 +torch/include/ATen/ops/_cast_Half.h,sha256=tHMYxqSDDV1rznWHPE3fgzRcsSPdzz8Odk34Dg0HiUk,1007 +torch/include/ATen/ops/_cast_Half_compositeimplicitautograd_dispatch.h,sha256=nGtXCgYjnU-G1wIzQFxfVogkrtPXm7VJj5B5pGME7pw,1075 +torch/include/ATen/ops/_cast_Half_native.h,sha256=6_jUU4-qvKEHi4p_XrA9y3j7S5JsrOmMTXjsVcQZoBs,785 +torch/include/ATen/ops/_cast_Half_ops.h,sha256=G_cyYNdEanDwMuo_L7FgWo7H4WsYMaQrVz0LyZttfoU,1326 +torch/include/ATen/ops/_cast_Int.h,sha256=RGv9Y_vxtJvOId7-5AWLxQnolDmvrRBvZeXxo3ByHpw,1003 +torch/include/ATen/ops/_cast_Int_compositeimplicitautograd_dispatch.h,sha256=Lb_zwN_i-dtyuWyUvCSHLY9tOm7qdKf-u-c4GD-5M18,1074 +torch/include/ATen/ops/_cast_Int_native.h,sha256=jH6TLr2DhW0rQfoUvje8GTBK2wSzIzlHQIkom3PNkb0,784 +torch/include/ATen/ops/_cast_Int_ops.h,sha256=t0g9g9vvKrhFrSPXcsMQ9Z8hxXOI62BqF8GlkShKt-4,1323 +torch/include/ATen/ops/_cast_Long.h,sha256=qo01f2XaYVvveiOqOqUPEt1_DBBWXNkHMgj5hRgPUCY,1007 +torch/include/ATen/ops/_cast_Long_compositeimplicitautograd_dispatch.h,sha256=E5_2e-utTre7xZt8aCoEAXkOu5xjWQjA8qK7hndqS3s,1075 +torch/include/ATen/ops/_cast_Long_native.h,sha256=IWRGdBe6UglGfhY5ndnGsjPzR1T5rixn52eFQ3YYXHk,785 +torch/include/ATen/ops/_cast_Long_ops.h,sha256=wZZcVT_8JvW3mFj4yfHmh5pM54LcyXv-xDLBhBIuk2E,1326 +torch/include/ATen/ops/_cast_Short.h,sha256=PfmuqAazr7RHQjVaJxdTTgOet5EV3aodgkVdTeMAdm0,1011 +torch/include/ATen/ops/_cast_Short_compositeimplicitautograd_dispatch.h,sha256=_SQK8EQvXdwiobVG7IeF9Z0YU7qC6_aOjOMdwnKscKA,1076 +torch/include/ATen/ops/_cast_Short_native.h,sha256=3Q_TBFHlBZI0tOtBF6li1PLDN4f0VAYovsM4WJ4oCWI,786 +torch/include/ATen/ops/_cast_Short_ops.h,sha256=dvUMR7xQ8Gn-TKD2ownjBYhXPqMUjiaG20ue_-h1iO8,1329 +torch/include/ATen/ops/_cdist_backward.h,sha256=tyV_1FrviMCeXUzzOlxjAYK1FT7ZyL2ioRTteI-t0F0,1851 +torch/include/ATen/ops/_cdist_backward_compositeexplicitautograd_dispatch.h,sha256=LN3KUBxWGNFRI6MoVF3Wox4HUMowOYaNuN4TSu-zfA4,1332 +torch/include/ATen/ops/_cdist_backward_cpu_dispatch.h,sha256=SuzA5DqadDU8P5MWZNl6uf-_xOPYSIPc6VdEqmBL1-I,1093 +torch/include/ATen/ops/_cdist_backward_cuda_dispatch.h,sha256=t4PcrwPgH3leTZERLoYtO-FPZEKphvof4L-OIOdNouw,1095 +torch/include/ATen/ops/_cdist_backward_native.h,sha256=-fv-Fr4Iam64kZcy2YxAgXHojQL0fvSEM-P-CToKJF0,1017 +torch/include/ATen/ops/_cdist_backward_ops.h,sha256=Y-uw4s1JAE0o_TDVCh3BvcvrDS0i1FI6AVY-sow7G6k,2454 +torch/include/ATen/ops/_cdist_forward.h,sha256=ZYu0dBIY5YJPoCcPcf_oF2-vBrF40ojsQS1LPD1KF6Q,1784 +torch/include/ATen/ops/_cdist_forward_compositeexplicitautograd_dispatch.h,sha256=kXISH8Rdm0RRZPuAK18LvZzOH4Z3V2GXnILieN-wTyQ,1306 +torch/include/ATen/ops/_cdist_forward_cpu_dispatch.h,sha256=yyhz11K-F_oXSZXc8pjHKfK2gVxX33pKPOwpPpNue-Q,1080 +torch/include/ATen/ops/_cdist_forward_cuda_dispatch.h,sha256=3Hybq8qB0mv-PskKo4mqmR9a8RFDXBrGDKMT0QKVmJc,1082 +torch/include/ATen/ops/_cdist_forward_native.h,sha256=4rFj0GK2gTm7n5GkO1y6Ce8p2_EChu2iG-_7fFLLc8o,991 +torch/include/ATen/ops/_cdist_forward_ops.h,sha256=3-OM3pPQ3CY2ktHDjm1mkFUoZotgJTHKZvJs_5VMojw,2356 +torch/include/ATen/ops/_cholesky_solve_helper.h,sha256=9jPu5CVxGJ4NwDcp7sxvmGArne-p0HoHmQ4wOU09Pio,1684 +torch/include/ATen/ops/_cholesky_solve_helper_compositeexplicitautograd_dispatch.h,sha256=BS5nmIDhX8E0zSNpl-2zWMU5ceg9dF4OdELRwdTw--w,1250 +torch/include/ATen/ops/_cholesky_solve_helper_cpu_dispatch.h,sha256=oGqvzIYNL-5hQI52N41KqzEvTktX9SvVeBDDBvjCWe8,1052 +torch/include/ATen/ops/_cholesky_solve_helper_cuda_dispatch.h,sha256=oZ3id-NXY7I2a7jBqSr9Wl1uJb1etudVHExQnJ4eYj8,1054 +torch/include/ATen/ops/_cholesky_solve_helper_native.h,sha256=-n0LZJFlIlCY3elMXUoZqHaBa8JSu8NzOXMwZ8mUM-0,1049 +torch/include/ATen/ops/_cholesky_solve_helper_ops.h,sha256=Jn8saQwQv8BeYcGoMO3lmybPW8nbPbuwq8yZSuMkOsE,2174 +torch/include/ATen/ops/_choose_qparams_per_tensor.h,sha256=PFSyFugREn_kzT9ybyRJuocbUypfjfuRun74w1lPjQE,1095 +torch/include/ATen/ops/_choose_qparams_per_tensor_compositeimplicitautograd_dispatch.h,sha256=OMd4yWPu6bnxFWMxHoOYx4viBGHaQv7nuIsTRrcg1J8,1109 +torch/include/ATen/ops/_choose_qparams_per_tensor_native.h,sha256=tkZge96ILc4HPuC5ER-8YqH3LcOHvNsCo-RTEQR34oo,819 +torch/include/ATen/ops/_choose_qparams_per_tensor_ops.h,sha256=izS-MIRPk5fDFJjSAAWf57EEqZ42Bkd2qteYWtrlvfo,1434 +torch/include/ATen/ops/_chunk_cat.h,sha256=Ou-rszN-endl7V5tvZ5WNrRZQUmwYL94XgzipKDy3yM,1612 +torch/include/ATen/ops/_chunk_cat_compositeexplicitautograd_dispatch.h,sha256=trznMjDM4HewJe4WJssarZdIru32JRN_2agwiD40aQU,1313 +torch/include/ATen/ops/_chunk_cat_cuda_dispatch.h,sha256=TLvqzuL-bdrfTCWKnBNqa6-OKzPk6RrQQjNSbi64oiQ,1271 +torch/include/ATen/ops/_chunk_cat_native.h,sha256=_0Vm_e3m-UnyXjdAQmnnvm4f3LQf7Q7gVkkK2QQKnY0,1123 +torch/include/ATen/ops/_chunk_cat_ops.h,sha256=QEOdDcyk_pKSVTserOlWIoAhSx8-_bTPmEGUOlcFQH0,2086 +torch/include/ATen/ops/_coalesce.h,sha256=omU1zLpGbjMuVUpEvWHQMTSj-xPnsAtlaPdbPHabRQY,1356 +torch/include/ATen/ops/_coalesce_compositeexplicitautograd_dispatch.h,sha256=cTS1R6WjC4Zk6VWep29fCKLn5RRrIeLbKSGZQHyaxJo,1156 +torch/include/ATen/ops/_coalesce_native.h,sha256=C5OTLnuA3o8A_AHgPqrIcGAV026Q7bs1q1cq1wwdMjU,922 +torch/include/ATen/ops/_coalesce_ops.h,sha256=x6UgpoL2xBR1qdMAENP3-LzB5w2h6b3WjAp_D6HOHFY,1864 +torch/include/ATen/ops/_coalesced.h,sha256=91lAmzW_phXC26S-0vpSaG4ccL12XMMREZyVPXRepTI,1495 +torch/include/ATen/ops/_coalesced_compositeexplicitautograd_dispatch.h,sha256=dmY58nlHx3MIsOw_LbxcjfOSyKA6UZJv4zFUrwKKZow,1265 +torch/include/ATen/ops/_coalesced_meta_dispatch.h,sha256=Xpec7Zu9RADeglDWR7Nu7wTByv5av2DDm3kKMJGk60k,1021 +torch/include/ATen/ops/_coalesced_native.h,sha256=1Hga9ziubNXvoxxCdYADX3kUkPpEGQmAf7MCz8L-rmE,954 +torch/include/ATen/ops/_coalesced_ops.h,sha256=rul_3biBQUXIcpCOVMFJp_62gVw1_0oWuNDCff7QZy4,2554 +torch/include/ATen/ops/_compute_linear_combination.h,sha256=BnIWff24Tj2jDrQeg4V0GVcb1Sd5ZJr0hKvpaCeXyBA,1749 +torch/include/ATen/ops/_compute_linear_combination_cpu_dispatch.h,sha256=Xz6UWaYIqcnxQ5kDQNUc6j6oiDFFTCSHVmlfKsSeg88,1326 +torch/include/ATen/ops/_compute_linear_combination_cuda_dispatch.h,sha256=fFHzzualmuL6eDkfItpTpOxKJmuKgBk_NFijJAYz3k8,1328 +torch/include/ATen/ops/_compute_linear_combination_native.h,sha256=t-tepSOQfPh3MMQ95S70xcosBjo5q7WRxMzQ4PZyro8,945 +torch/include/ATen/ops/_compute_linear_combination_ops.h,sha256=MYcOZ3-_BwbeRK_wf41fqovkAo9EruMdYt6YkYCHfPE,2192 +torch/include/ATen/ops/_conj.h,sha256=psPI2vFKN8XSV1w92iGjGVfA9FxG2HNnMj-9z7QkhQ0,929 +torch/include/ATen/ops/_conj_compositeexplicitautograd_dispatch.h,sha256=J2Ha0E_lu-dX-G9R1m20XoDtg5_DlVZu69AeaobT8PU,1045 +torch/include/ATen/ops/_conj_copy.h,sha256=waMvVjhxF7LviRIGrbYpAy1XFue6Y-oXVSvk1m78U1Q,1366 +torch/include/ATen/ops/_conj_copy_compositeexplicitautograd_dispatch.h,sha256=Ci8eajo1V_Horplfuj8zLYOu36FMPtqTCZDmiQVf6ns,1158 +torch/include/ATen/ops/_conj_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Y-F4yg4newmazOAgdbw7-pN75IPGkE8Oa4WpsjM6_XI,1076 +torch/include/ATen/ops/_conj_copy_native.h,sha256=xpfAMKWAitUhBmac36NtbbwjTTEpHqQwGunkXBrsZd4,843 +torch/include/ATen/ops/_conj_copy_ops.h,sha256=GVfpGWOIaPzVPYgApiqgzY8sTyGsxmXTYb-jXblMpUU,1870 +torch/include/ATen/ops/_conj_native.h,sha256=7it3r6uWrJ9jzb67HyNe_8zlvAupOG0igcK1l4HfbBc,755 +torch/include/ATen/ops/_conj_ops.h,sha256=12NVjPMhL7eR6UnUt4F3sFwa0F68TIuJYXqNMLYpICw,1248 +torch/include/ATen/ops/_conj_physical.h,sha256=sANvLNMZQLQRBKKFHZ9o9ICuvIGlqIkwYJqQczmhmUo,1406 +torch/include/ATen/ops/_conj_physical_compositeexplicitautograd_dispatch.h,sha256=A3hXj7s5a67XP9B8I-67FIZH9PwCx6RJ0qtfgQdwC20,1229 +torch/include/ATen/ops/_conj_physical_native.h,sha256=m0tMWX08kU4xQu_E-2u2FcJjX_24LUZZEc_pSL6qll8,924 +torch/include/ATen/ops/_conj_physical_ops.h,sha256=AJEbTikcbdLrTwz75vTXJF61pT8AOjpgyY6zdsDovHA,1894 +torch/include/ATen/ops/_conv_depthwise2d.h,sha256=Gl4t5cIl984tlzHZROgSpuYZVKjmlDr6aMYBXfFGmTM,7675 +torch/include/ATen/ops/_conv_depthwise2d_cuda_dispatch.h,sha256=YRZgBE98fC0BaG9ygxEuF0kXFwzt0CrDE1lCbH_uCAA,2550 +torch/include/ATen/ops/_conv_depthwise2d_native.h,sha256=yICUhR17ivsAsArtRZKiDnMTjckOGZo0AMMvuqe5_mY,1211 +torch/include/ATen/ops/_conv_depthwise2d_ops.h,sha256=060wLEFevQoRUbFGnvFO1Gc4Wk0ZZyYO8Dzq5KOHSzA,3168 +torch/include/ATen/ops/_convert_indices_from_coo_to_csr.h,sha256=_2x6UatkqcFAxpiGGYet1NrS4SboqwMRymSfWbnqZOA,1838 +torch/include/ATen/ops/_convert_indices_from_coo_to_csr_compositeexplicitautogradnonfunctional_dispatch.h,sha256=BSzcDT3fKulpBosKNHaBZY_-sONLSGONmCEVnTTvn38,1134 +torch/include/ATen/ops/_convert_indices_from_coo_to_csr_cpu_dispatch.h,sha256=1xF9K4fYIcDRPSF_fn_-ekS_ld3EsEX4Jef5sjaCxI8,1341 +torch/include/ATen/ops/_convert_indices_from_coo_to_csr_cuda_dispatch.h,sha256=uipNxHGfYprxS9KBAYQKm2lJRvQFPwoByTvcWqUEMP0,1343 +torch/include/ATen/ops/_convert_indices_from_coo_to_csr_meta.h,sha256=oYVesYawDNrgTYRHfL-D7hGsuYh3LHlrQJYdW3qUM5I,909 +torch/include/ATen/ops/_convert_indices_from_coo_to_csr_meta_dispatch.h,sha256=Gn5yWPaVVE_KVhNbHzYuaez-O6KynI7CsoqLHo2Pxok,1343 +torch/include/ATen/ops/_convert_indices_from_coo_to_csr_native.h,sha256=LUJhZ-6zy7wZqb6_trDbbiqkIcT-WPKLlGenS-wRuMk,1235 +torch/include/ATen/ops/_convert_indices_from_coo_to_csr_ops.h,sha256=GOOfLjb8e3xghRdgUw2JZTy9Ejnqb39Ry2kHLCEG2M0,2219 +torch/include/ATen/ops/_convert_indices_from_csr_to_coo.h,sha256=pCskYCEGs1B4DW_irYduw00lMerlNtEA1dAwBdnO3lk,2174 +torch/include/ATen/ops/_convert_indices_from_csr_to_coo_compositeexplicitautogradnonfunctional_dispatch.h,sha256=VTHkxmyvtnwZPw-eis8z8jR2ajIq9LhKCMuIueqQ2kE,1182 +torch/include/ATen/ops/_convert_indices_from_csr_to_coo_cpu_dispatch.h,sha256=_pzIocZzh9DtR1C1eBV708sU3eFua-aHo6ckwfdPD0w,1479 +torch/include/ATen/ops/_convert_indices_from_csr_to_coo_cuda_dispatch.h,sha256=D-6Ki3DvvigunXd07j0kOjVJfmhtNXVhXcplaBJQTlw,1481 +torch/include/ATen/ops/_convert_indices_from_csr_to_coo_meta.h,sha256=p_B2uo6tA5Ao9Sdm_F0SgX1TAX7wkIU0mo0O33mg0RY,951 +torch/include/ATen/ops/_convert_indices_from_csr_to_coo_meta_dispatch.h,sha256=olmLdbJbEwyuW6a9WywIUl3B8-g7cZ7U8c8c14IIWIY,1481 +torch/include/ATen/ops/_convert_indices_from_csr_to_coo_native.h,sha256=uccVjc6Vde-Fvjdn-sUj7YNfaDDrVxXHKzedk7ycODs,1319 +torch/include/ATen/ops/_convert_indices_from_csr_to_coo_ops.h,sha256=v2VKrTK6PwBkzp2aSf8eTN81PRkV7SVDgs4sTsBCwoA,2501 +torch/include/ATen/ops/_convert_weight_to_int4pack.h,sha256=L86nwbXRcnesMUnFVVX35oymn_YmFkEJgL7rNY5gZNI,1062 +torch/include/ATen/ops/_convert_weight_to_int4pack_cuda_dispatch.h,sha256=DKtOsQS8jxHHzS1n623K8EH7_fVOAwiccyU5JakueWQ,1046 +torch/include/ATen/ops/_convert_weight_to_int4pack_for_cpu.h,sha256=cfGfaqomwLhMd-8IazvvHlmHEzdbYn4X6jYE2HcKJtQ,1094 +torch/include/ATen/ops/_convert_weight_to_int4pack_for_cpu_cpu_dispatch.h,sha256=t2zrAC0PyhxO3kDR--NEep4I8EouguRCrCtIEuLBtWQ,1052 +torch/include/ATen/ops/_convert_weight_to_int4pack_for_cpu_native.h,sha256=wMuE1kLefDVbfLSo4jTvXblUvq4VGJeHoYTRpInOgjk,802 +torch/include/ATen/ops/_convert_weight_to_int4pack_for_cpu_ops.h,sha256=nLEaXEZ_E9Md3EeAcX26Zq19iFxn4wTfJdlT6xJx5t0,1400 +torch/include/ATen/ops/_convert_weight_to_int4pack_native.h,sha256=Gb1Nd4c5GhuP1Hyw26-mdUyVrY37RYhRkX_pr0iyYLE,803 +torch/include/ATen/ops/_convert_weight_to_int4pack_ops.h,sha256=ma72npjJWaRkT-e2CutJqUU-21rqs5gF1fkS_ug0-90,1376 +torch/include/ATen/ops/_convolution.h,sha256=AR1e1viiBtJkvmFYOLpk1pU4rpHEDJFdelYes6PljXs,13351 +torch/include/ATen/ops/_convolution_compositeexplicitautograd_dispatch.h,sha256=luXXe6DsqDHcw2s5Eji_8O4oSj6QUxMk9oWsxlyinqA,3234 +torch/include/ATen/ops/_convolution_compositeimplicitautograd_dispatch.h,sha256=Z64lUXfUc0iG6-f3NUQj9ctIgVt7OLim8hnqSmdw7D0,1668 +torch/include/ATen/ops/_convolution_double_backward.h,sha256=3z8bWx0g-DtUdmlavi5ZzvG-S60t2CQuTCn--vgGBK4,4342 +torch/include/ATen/ops/_convolution_double_backward_compositeimplicitautograd_dispatch.h,sha256=a5e6ikp6O2IfQdi_Ebwn2n9MbjEf7mWSYwOozkTtglo,1938 +torch/include/ATen/ops/_convolution_double_backward_native.h,sha256=pEN8Fll6TQOxNAwX1hLSIBc65F8-Eq-MnnHsefnfnbc,1161 +torch/include/ATen/ops/_convolution_double_backward_ops.h,sha256=ZCE9ZChDu2VH0iLotMH76Eulvuw3JNLP6KCOlBSMQAw,2644 +torch/include/ATen/ops/_convolution_mode.h,sha256=LfcOCKC9VtZHrD5l8_NBDAWX0cnEmApdrn08KPSrPjg,2763 +torch/include/ATen/ops/_convolution_mode_compositeimplicitautograd_dispatch.h,sha256=T2Y1WfpoZXQmo8H5GUvunAeJTKJPi-0guK1adQjRGdc,1466 +torch/include/ATen/ops/_convolution_mode_native.h,sha256=CX3f79iE6V4NtHWnylqXI5mOlD1zjU4DY48TR31X4do,948 +torch/include/ATen/ops/_convolution_mode_ops.h,sha256=twJ0O-9jsTSQm5aHWVzETZ_eh_WixpF6XkEBwya7mhk,1850 +torch/include/ATen/ops/_convolution_native.h,sha256=lyuyPelhbZcBB0v5W2w5wyxn8uWMudwvAVS27J8dY8U,1767 +torch/include/ATen/ops/_convolution_ops.h,sha256=mvZtm1qF8wvCXWGfDhBaD_VoEPOcSauCJ5iIdBN-wXE,5383 +torch/include/ATen/ops/_copy_from.h,sha256=yigO8G1hITy5jW9PxW4cDTp53rSLbc9XN7KPHiy2aJk,1675 +torch/include/ATen/ops/_copy_from_and_resize.h,sha256=--gpqoEUmBk3lyDK9RUZphqSG-fx87xuLiY5McWhI0c,1599 +torch/include/ATen/ops/_copy_from_and_resize_compositeexplicitautograd_dispatch.h,sha256=MlyJWcIyoHWivkYB4OjDqTuNOY6_fqbZGQMkr_zxzhM,1228 +torch/include/ATen/ops/_copy_from_and_resize_native.h,sha256=7EbdrxRHvJkF9Oom468bCyjYBYMOot9LnqYujPQeKZs,819 +torch/include/ATen/ops/_copy_from_and_resize_ops.h,sha256=c4LxTDr6_JVn9DjYHqXyBpDygKVyuLfSXuLeIayLRIE,2096 +torch/include/ATen/ops/_copy_from_compositeexplicitautograd_dispatch.h,sha256=83i6J5y4YcwDs5Qad5tSPMy-zu22URRU9IaOdjrkpf4,1250 +torch/include/ATen/ops/_copy_from_native.h,sha256=v7wdVgHaRJ3czZ6T5EZpo26LOrsvzZ9NIG_IOC9Hu30,827 +torch/include/ATen/ops/_copy_from_ops.h,sha256=YyHhXeI9Odbaws0xedKCryGFzqOewIWiVxXQo2fFa0U,2168 +torch/include/ATen/ops/_cslt_compress.h,sha256=b07MlGlgceSCcpTMOgNsOv5r5yH-ZfngHaDxBM1dUXk,962 +torch/include/ATen/ops/_cslt_compress_cuda_dispatch.h,sha256=Gl3Abqrh9yERepY_FLIQB21kVuA5qgnokY35UFvwUEw,1013 +torch/include/ATen/ops/_cslt_compress_native.h,sha256=JHhwVRnKa8ZoRx6TmFQhyr9Phtts4dUA4h2x89LOfy4,765 +torch/include/ATen/ops/_cslt_compress_ops.h,sha256=pHbcAtip3EcLx3T-pWWvbI-8uUt2sLJr_mkTOqsDeZw,1272 +torch/include/ATen/ops/_cslt_sparse_mm.h,sha256=J7mqWLGIZK_8NcD6P08mmEqaZe9CGcPCs20m9uk2nxI,1499 +torch/include/ATen/ops/_cslt_sparse_mm_cuda_dispatch.h,sha256=UqyDaWqCBf8b3JFBsL3dmEmpAgPKK5J2hP3ktbYXZSE,1289 +torch/include/ATen/ops/_cslt_sparse_mm_native.h,sha256=X-BObgJS01L8PGHftrOKmJQK0u0ZkzQJcqllRrfANXU,1041 +torch/include/ATen/ops/_cslt_sparse_mm_ops.h,sha256=6tsvoqZ0PNmgqQFx0w7mYLhLIOquHrq8iaV89Hv0NX8,2086 +torch/include/ATen/ops/_cslt_sparse_mm_search.h,sha256=fF7pQLRSCvYtLMkl9ugK4Lk8Cq9mw2HrZwhPLR4K4Hs,1378 +torch/include/ATen/ops/_cslt_sparse_mm_search_cuda_dispatch.h,sha256=jT4efvN1zDXcZTHdfsGa4NSRwx0qTKOngKfOZiEZjTk,1231 +torch/include/ATen/ops/_cslt_sparse_mm_search_native.h,sha256=1g3AynT5cQVkIYkY_zAO21njmyKr1JZZSrJNMyNEmFk,983 +torch/include/ATen/ops/_cslt_sparse_mm_search_ops.h,sha256=m-nl7xkMSRefmHJQtMc6Gw1hr8ebTDQzVkVCq7K9ZHw,1908 +torch/include/ATen/ops/_ctc_loss.h,sha256=AWSyBk7ZIwnz0Ywq40KIfgZvf1PwDdpEzSWrdH1KNxw,4240 +torch/include/ATen/ops/_ctc_loss_backward.h,sha256=mLoRWPTx4DdS3Cl_18B_tHIRaxkb4HR7YSMtHzwCdz4,3614 +torch/include/ATen/ops/_ctc_loss_backward_compositeexplicitautograd_dispatch.h,sha256=UXvokf0FpxWnjCzQaxndWjoW3DDtTf3kkNmB8jinOGs,1630 +torch/include/ATen/ops/_ctc_loss_backward_cpu_dispatch.h,sha256=AEv115X5kFzHpJiJp6IX0Y9axooPA-vj2yuBkh42n1Y,1549 +torch/include/ATen/ops/_ctc_loss_backward_cuda_dispatch.h,sha256=r8zWhamZU-Is8PsXChdBNJFv7HLHWZeuvRYFj1TbkvQ,1551 +torch/include/ATen/ops/_ctc_loss_backward_native.h,sha256=lIbjIw9RZisECDij9KuxQaCpgtr7oEANSwna_ejMpes,1929 +torch/include/ATen/ops/_ctc_loss_backward_ops.h,sha256=C1VX1LpdSrtSRjlvmaN_wa-Id1Z4oXOwIrebjmiSYvc,4719 +torch/include/ATen/ops/_ctc_loss_compositeexplicitautograd_dispatch.h,sha256=tx_vhFhsaDbLR3Ql40FDrGVADzxoXV4y9W6we_qDJCw,2061 +torch/include/ATen/ops/_ctc_loss_cpu_dispatch.h,sha256=3Q0Bw6M4G_3jyF4EaUBCTBiSXRnuTWwILu4z3lGC3SA,1397 +torch/include/ATen/ops/_ctc_loss_cuda_dispatch.h,sha256=rYKRyK52HFPrR8s87PpOcF4pL9AAp9bDJkdiuvhaiZo,1399 +torch/include/ATen/ops/_ctc_loss_meta_dispatch.h,sha256=SAdwUzMS8BpJyzZk3q8i852hhTYjv9IZCjVATWVRKZA,1171 +torch/include/ATen/ops/_ctc_loss_native.h,sha256=theW7PIef2q1JfqdqNoWSMbpKJUMYNH6iZBM77206gM,2144 +torch/include/ATen/ops/_ctc_loss_ops.h,sha256=n_S1j9LWbPsNJJ5My2Xk7bpgrC8LbNKYRC8JdIvWvqE,5315 +torch/include/ATen/ops/_cudnn_attention_backward.h,sha256=CI6zJLpBS2jCMRwCVacdCy287HzeysaeVKrimRUCQqs,4561 +torch/include/ATen/ops/_cudnn_attention_backward_cuda_dispatch.h,sha256=E4nAHRRK7wYWqna_YozNZEiIkZiGWVsPHezHZ8LS1Wc,1984 +torch/include/ATen/ops/_cudnn_attention_backward_native.h,sha256=jyedVB2g3cFkZ95qFByPQ-oJGIGsh3qpMnL5uY_JD_o,1211 +torch/include/ATen/ops/_cudnn_attention_backward_ops.h,sha256=0W2FWmbPf3WQYZaxycSOq9c0nKHqHmYS590wmjSJCCA,2732 +torch/include/ATen/ops/_cudnn_attention_forward.h,sha256=ppgIwqRhjh2q1Birq-TRhDlns3ggIb73anfJqAhzfg0,4866 +torch/include/ATen/ops/_cudnn_attention_forward_cuda_dispatch.h,sha256=-2uIq9OWabphItZ2mCM5833jmeLlQOF1xp_voisS6ks,2052 +torch/include/ATen/ops/_cudnn_attention_forward_native.h,sha256=h4CdC9nYzM0i73ZnwKZ0UGYQx4BVFrvK9qM7hE0vxpI,1245 +torch/include/ATen/ops/_cudnn_attention_forward_ops.h,sha256=Q27hsYHthU21bLlf8oWx7uNR6LmOupP1zXanUC1YgWM,2916 +torch/include/ATen/ops/_cudnn_ctc_loss.h,sha256=gSWaq5Pj-5ttw9lfFfxB0250fAtpcWWYoomjBWI2TYs,3239 +torch/include/ATen/ops/_cudnn_ctc_loss_compositeexplicitautograd_dispatch.h,sha256=f9ZwyAcYtJIZl6BUO7pAA4KhLIkBo3YP4PvvjFuk3HQ,1564 +torch/include/ATen/ops/_cudnn_ctc_loss_cuda_dispatch.h,sha256=5Ksn3o5NA5liv8Vr2YOTWrcly7m6ig9J37I37AOnGQc,1435 +torch/include/ATen/ops/_cudnn_ctc_loss_native.h,sha256=LQsMgEGHfG95Cnzu7shVPPWSmCs72CO0s-s3uRZ0PEs,1480 +torch/include/ATen/ops/_cudnn_ctc_loss_ops.h,sha256=fOj3ACtjzfnZvnZIsknOcvZIdCErl2C8uuHumshrnM8,4291 +torch/include/ATen/ops/_cudnn_init_dropout_state.h,sha256=2hOzQC6tr1GR1A1tiA6jZrA0CqENyo8dfjlPVKwS-yQ,2552 +torch/include/ATen/ops/_cudnn_init_dropout_state_compositeexplicitautograd_dispatch.h,sha256=8oSiH4oEJBn4E3_HX8_85kF3bt_aM283GhT65A3I0tI,1238 +torch/include/ATen/ops/_cudnn_init_dropout_state_cuda_dispatch.h,sha256=90qmlmcQ5PV1l63RwnycJX-1b5ybItxdTT9b5M4LpgI,1319 +torch/include/ATen/ops/_cudnn_init_dropout_state_native.h,sha256=0GYXxz-8iYLqIKfRGvHMA6trsaxaWnL-QpeN6ocI3JA,1080 +torch/include/ATen/ops/_cudnn_init_dropout_state_ops.h,sha256=xlpvshZg0pI0_nNiys6zusgCran5clW463RDRK-kI1c,2627 +torch/include/ATen/ops/_cudnn_rnn.h,sha256=cx5Me1EFRwARrQqAbE2XoSFTZSWZr8ENlg1Xw8UQ77w,13694 +torch/include/ATen/ops/_cudnn_rnn_backward.h,sha256=cSh795ZEG5yKo-WT08w_cHcAqHCpCjPJn7d_RjVyRV4,16809 +torch/include/ATen/ops/_cudnn_rnn_backward_compositeexplicitautograd_dispatch.h,sha256=y9Uoy4gcM6TayzPulRH4Bxjpuo8ZN60VPyKOFhsmV70,3967 +torch/include/ATen/ops/_cudnn_rnn_backward_cuda_dispatch.h,sha256=3nCSt4HlAOzqgaALPW6B1DwK6nHEFNnDP7J_jXT7hzk,2408 +torch/include/ATen/ops/_cudnn_rnn_backward_native.h,sha256=UKW22O4IpVvDREKyHpAM67fmlHcHUtQoA8mAcWW-W-c,2174 +torch/include/ATen/ops/_cudnn_rnn_backward_ops.h,sha256=uNUmT2Mnod97mABlFVShHJsxIe8IW5P2VFptZoIBu-Q,6260 +torch/include/ATen/ops/_cudnn_rnn_compositeexplicitautograd_dispatch.h,sha256=7B9d3NLzo-ZNEbo_JttOThImHHocdKC8I_IUl4XOg-0,3451 +torch/include/ATen/ops/_cudnn_rnn_cuda_dispatch.h,sha256=F2ezP4TyVGZP83BN-K9JQIHnbAhFcfa1NXFaLkSCR3A,1960 +torch/include/ATen/ops/_cudnn_rnn_flatten_weight.h,sha256=fCWmo2ttX0gWjNni0BfNBUV4r9iHNBemkhuG2tFYkDg,7935 +torch/include/ATen/ops/_cudnn_rnn_flatten_weight_compositeexplicitautograd_dispatch.h,sha256=gn7oPaOIWyynnzg-yt9zf8ka-Qcp-8NCHwSw3DNiwBY,2055 +torch/include/ATen/ops/_cudnn_rnn_flatten_weight_cuda_dispatch.h,sha256=OtQIr-NpTdenz7f-C8QKMygY7QZthKE7xh8M3PuZK58,1432 +torch/include/ATen/ops/_cudnn_rnn_flatten_weight_native.h,sha256=wgxnFYLEn78MFgmckP-gtPzqUrWCjHZcFZrrLrAYwk8,1208 +torch/include/ATen/ops/_cudnn_rnn_flatten_weight_ops.h,sha256=Gf-sDTsXFgborafrRTb8i_dkfPwigP-YyieFYxtBuDs,3086 +torch/include/ATen/ops/_cudnn_rnn_native.h,sha256=Sy2NgcDt3Y07bZVvIn1dzewiBxecFX1yAn2VQVSfjQg,1821 +torch/include/ATen/ops/_cudnn_rnn_ops.h,sha256=r2NBdrEuXHphSyiu87OwM8Kwn1KHLQfttl5Gqbtozlc,5173 +torch/include/ATen/ops/_cufft_clear_plan_cache.h,sha256=OCxrvRo2lw_KR2UwQ1qwGYpzghOg7wPgqwljbBgITUg,1011 +torch/include/ATen/ops/_cufft_clear_plan_cache_compositeimplicitautograd_dispatch.h,sha256=fUl4PUQSmOdZ1hO03S88vCJT59sGO8prDYJrt9aXZJY,1062 +torch/include/ATen/ops/_cufft_clear_plan_cache_native.h,sha256=1S91AnstkTzd4sVcmxNvFSDixW6HVkaKzx0zLHbCzys,772 +torch/include/ATen/ops/_cufft_clear_plan_cache_ops.h,sha256=qVjV4TsFYhobXPG5DKCMUgaV4bHOudJ1lwQ14iG7J3I,1294 +torch/include/ATen/ops/_cufft_get_plan_cache_max_size.h,sha256=xKgfMmS68pKbh2gp_8e4nGfBeuiRfeobw3Ua1sj4TUM,1043 +torch/include/ATen/ops/_cufft_get_plan_cache_max_size_compositeimplicitautograd_dispatch.h,sha256=fPJQYqC7zHklDRhd6lpOAf1XELq5axp2YoxkxWVmqQ0,1072 +torch/include/ATen/ops/_cufft_get_plan_cache_max_size_native.h,sha256=JL0HT-vggMGTONcZWosCvGlYfuIBJg6amTPjioJOH6U,782 +torch/include/ATen/ops/_cufft_get_plan_cache_max_size_ops.h,sha256=Mji9DUWGqIU5KYGX-l6HPYgVCFtffe0MN6TH87cPOY8,1325 +torch/include/ATen/ops/_cufft_get_plan_cache_size.h,sha256=fQVcQad5CEidkw80CNrph1Lm6mGcSDx8afqhvYKWqEg,1027 +torch/include/ATen/ops/_cufft_get_plan_cache_size_compositeimplicitautograd_dispatch.h,sha256=QA7WQHl6KIleKEp8OoG-lXsrNwQ5W6vk_LA5Y3G-eB0,1068 +torch/include/ATen/ops/_cufft_get_plan_cache_size_native.h,sha256=bIAPjZdstQ_JWESjBuwuJfVPnJIP3usNk6NXJAW3ZBA,778 +torch/include/ATen/ops/_cufft_get_plan_cache_size_ops.h,sha256=-GkB5rxA9-Mh5SKJtZW5IwL3ytaUFshBAEhghG7JaAc,1313 +torch/include/ATen/ops/_cufft_set_plan_cache_max_size.h,sha256=C31qan3vB-T399Wi8kToaahTjXkNVWZz70LVM6OREVA,1081 +torch/include/ATen/ops/_cufft_set_plan_cache_max_size_compositeimplicitautograd_dispatch.h,sha256=jlEmuQ0Z-ObkihYqMbYSxQ8UByN7LH0EfS-3VLmc6v4,1087 +torch/include/ATen/ops/_cufft_set_plan_cache_max_size_native.h,sha256=eomyneV8XSmROoki6n_A9a0dzw_xw6rYxRzkwOQKy2g,797 +torch/include/ATen/ops/_cufft_set_plan_cache_max_size_ops.h,sha256=iFHLnD1JNhvdnMKT0NlHHLoWYe5egH-gHxRBjsY8EEY,1374 +torch/include/ATen/ops/_cummax_helper.h,sha256=JvljTbbXGqGCV3jO6bJ5o1k1H1tRlnUTAhgIbUqAUnE,1075 +torch/include/ATen/ops/_cummax_helper_cpu_dispatch.h,sha256=J2v1FLFgrcZziyupVqX6hVFMsdnaZXZm-h0sImNcjtc,1060 +torch/include/ATen/ops/_cummax_helper_cuda_dispatch.h,sha256=UKLzmX_ToQ1H0xAsrvSJHXHaAvxBOIyGiU45x3mi7L0,1062 +torch/include/ATen/ops/_cummax_helper_native.h,sha256=xJymGAYFqV4pnKTYF6hcqgoOjt8ykGVhgWHGVkHLV2I,934 +torch/include/ATen/ops/_cummax_helper_ops.h,sha256=S-kZ4qacrYzsUnuKkdrPVOJIJrR3odeky2-vZPn__o4,1444 +torch/include/ATen/ops/_cummin_helper.h,sha256=x6GDPfDXuaJijZkQmFuw89o5PDWJpGBjK1W4OduaEnY,1075 +torch/include/ATen/ops/_cummin_helper_cpu_dispatch.h,sha256=2zv87kao1KkflMCTDpbJzYt4W48EcVsozMTF7K6vrvQ,1060 +torch/include/ATen/ops/_cummin_helper_cuda_dispatch.h,sha256=h8dlbjYMKuLsP6niIlT3fQOQcPo_10SvFKWvd7zDo2Q,1062 +torch/include/ATen/ops/_cummin_helper_native.h,sha256=-ykwqmFWPlmOaMNtuxhPL9DgwP93X0Y5NfKEunIsooY,934 +torch/include/ATen/ops/_cummin_helper_ops.h,sha256=ADl5exS_b9h9SN3HHTBJI542BFcuusQwvebZpID_61k,1444 +torch/include/ATen/ops/_debug_has_internal_overlap.h,sha256=NvLkl0myJe8MSmGaoSr5icNq--njcD4YBDglY7Uu3Y8,1005 +torch/include/ATen/ops/_debug_has_internal_overlap_compositeimplicitautograd_dispatch.h,sha256=3ZoGoKJxwjmkr1yKD5L2nTmguozcPgNBmuLhhoqyv64,1064 +torch/include/ATen/ops/_debug_has_internal_overlap_native.h,sha256=YYtJs-ZxbQn0scKAWbDpFBo8Ax39OxYgrMz1yrATELE,774 +torch/include/ATen/ops/_debug_has_internal_overlap_ops.h,sha256=Cj0FHTj2-soGSL6Q3uJKfPe_F96rb05X9ZTjdVTsTvc,1296 +torch/include/ATen/ops/_dimI.h,sha256=M4fKy3aDXhdjpDRB6QOokeVAaTuDAMOhc93AgfPIvkI,788 +torch/include/ATen/ops/_dimI_native.h,sha256=x64jpsP-B29yOjrYg00YQ9O7H1tzcOMf80pNVnIglMA,764 +torch/include/ATen/ops/_dimI_ops.h,sha256=AO9IBhZUG__ZD5dMpHTrgVN6LBaYW57gSKrsDUY7-_o,1230 +torch/include/ATen/ops/_dimV.h,sha256=UU_kmGlGkWxJxuOVFdQPAh6oCwEKsg_l6spRR0-CKu8,788 +torch/include/ATen/ops/_dimV_native.h,sha256=XHauwB8c8kmbSLJKsb0fjmhs_af6FMIdmDcDrXVHl1M,763 +torch/include/ATen/ops/_dimV_ops.h,sha256=Zpk9uC03Z29mM9tzc-5Idb0ZgsxrdBtb5VzE7Pnc-Vw,1230 +torch/include/ATen/ops/_dim_arange.h,sha256=L8PkgjPq8_AINDPecVx6zWpPrOF-NcR1D66EmgUDR9I,974 +torch/include/ATen/ops/_dim_arange_compositeimplicitautograd_dispatch.h,sha256=cIoNuCA1fWOSYCwe80O2WDO_8GgSsGRmGEBc5pyOKl4,1064 +torch/include/ATen/ops/_dim_arange_native.h,sha256=16mtuyhdq96zaSaMjhXnhKIVep_jqIuhtaRSYoCyx5A,774 +torch/include/ATen/ops/_dim_arange_ops.h,sha256=n6axnsV5STzOTmW0K6vEiDfhUWuzIXQTHfudqPrejcc,1304 +torch/include/ATen/ops/_dirichlet_grad.h,sha256=yZZXuVgFwlnJDqRQyhTTD8h3mBfhCH8bJ9upx47VHXI,1671 +torch/include/ATen/ops/_dirichlet_grad_compositeexplicitautograd_dispatch.h,sha256=Yv-3gq77MIyD3tPpJk_9_Ll_qpF8KEkEerIYxVLWIn8,1266 +torch/include/ATen/ops/_dirichlet_grad_cpu_dispatch.h,sha256=P3YfJo8DAz91PTXQF2NlJjwAn_qqHZIxmq8O6bq1bDE,1060 +torch/include/ATen/ops/_dirichlet_grad_cuda_dispatch.h,sha256=0r8kKLSuMcTGG-lUmuMDW-7bQJbyVh_ZaaO86E1yu7A,1062 +torch/include/ATen/ops/_dirichlet_grad_native.h,sha256=RPcy8ZDVoAf8W4iOiCrVJcEC3xHQEMHAt2Fqrw9YV6E,1073 +torch/include/ATen/ops/_dirichlet_grad_ops.h,sha256=0n0MHF9trubCi7nmHDgWbcA7wc9CJqVgl_vH5mcmut4,2226 +torch/include/ATen/ops/_dyn_quant_matmul_4bit.h,sha256=IVUSNQbDp8gdG8LuL4T4rKWC-mKtYCX1X_ilRf8Szyo,1215 +torch/include/ATen/ops/_dyn_quant_matmul_4bit_cpu_dispatch.h,sha256=JXn73rm1V1P61SEKfTtmG43tYhuCRFHt-QdXKFNTvu8,1115 +torch/include/ATen/ops/_dyn_quant_matmul_4bit_native.h,sha256=cuyUmJptRqYjtE9VfdRATvstK3rtDdsUr5EPlZwn8WY,873 +torch/include/ATen/ops/_dyn_quant_matmul_4bit_ops.h,sha256=WQHmbuQwBhGe3ureoWJZqI9OjuTUp0_7NS0m8Qw3pl8,1607 +torch/include/ATen/ops/_dyn_quant_pack_4bit_weight.h,sha256=X8YLVK0XrSpqNRYA1AJHLPwiKG7vl5qtEYT2GlrNlEk,1303 +torch/include/ATen/ops/_dyn_quant_pack_4bit_weight_cpu_dispatch.h,sha256=EvWDujkvApPlvEa5tXYuElhF6ZtLP5rY3LQWhteRd3c,1164 +torch/include/ATen/ops/_dyn_quant_pack_4bit_weight_native.h,sha256=WoGuvinwQVI3wsezQdLhJRdzMhoOI-saWWxnoGwnCNg,922 +torch/include/ATen/ops/_dyn_quant_pack_4bit_weight_ops.h,sha256=fA0N2u_dTfT3P_EVRLoKmy6lgT5cXlylXjyu6UI8i1Q,1763 +torch/include/ATen/ops/_efficient_attention_backward.h,sha256=BdKXNHJwHYKWUu9oc4Dm500REvVBFTYoN7gDRf0tEEU,6291 +torch/include/ATen/ops/_efficient_attention_backward_cuda_dispatch.h,sha256=l9X7CfwILJasKwn9Ze6bCdeTBx112cAbYBnC_szeFgQ,2504 +torch/include/ATen/ops/_efficient_attention_backward_native.h,sha256=twHCLIenFm0MUMDZtxEcAjqlrmZwM7w0LBZJT6gkuaw,1471 +torch/include/ATen/ops/_efficient_attention_backward_ops.h,sha256=_xpcvg7_gE3kaP-t6PgUv9fTQcUo89CtkBeGxZOb_14,3454 +torch/include/ATen/ops/_efficient_attention_forward.h,sha256=Z9ymiclT0aohz0JY9mimBc6xEIqPK__sGbXCrRjK350,5712 +torch/include/ATen/ops/_efficient_attention_forward_cuda_dispatch.h,sha256=eASdW13fyytB6Um98my5psjRs6HSBHONCvhAycRIU2k,2248 +torch/include/ATen/ops/_efficient_attention_forward_native.h,sha256=IiDma2u1dKttd-LAFVYOLuUNLQCPeUYI_P7OWFCfZmY,1343 +torch/include/ATen/ops/_efficient_attention_forward_ops.h,sha256=wgh2zQjvxMfTDKjpnfa1d9ujXSQ-JGq6PO0HPphRiiI,3162 +torch/include/ATen/ops/_efficientzerotensor.h,sha256=b3lmTJy_dLHDNmJuw3V1IIxx6VBDRoWQvkI9HkwgeJA,6413 +torch/include/ATen/ops/_efficientzerotensor_compositeexplicitautograd_dispatch.h,sha256=vdVYio--KuFXgWCAxzOlWOuHprBVWGxzfZuuNK7I9Yc,1375 +torch/include/ATen/ops/_efficientzerotensor_cpu_dispatch.h,sha256=PhzjHwI1k5CakNPC822hDy7eE3W8VVXGozAZXBhbVyc,1583 +torch/include/ATen/ops/_efficientzerotensor_cuda_dispatch.h,sha256=IvZ0-EyxsnuwMBjOX4wJXXbykeMRexaaRrSN6-2P1hs,1585 +torch/include/ATen/ops/_efficientzerotensor_meta_dispatch.h,sha256=7jyFqpCWt8PaaYrlalXqu9_FWKPVyLn2ofuj9lA9lfQ,1585 +torch/include/ATen/ops/_efficientzerotensor_native.h,sha256=8S8rgL5gukMX7JVRgiJn-htBlE3nSKnRkdTv3isPeoY,1492 +torch/include/ATen/ops/_efficientzerotensor_ops.h,sha256=cynX934biJYPvZSBHMz6mOn3EoPD08uKnHI-ocLXvoM,2436 +torch/include/ATen/ops/_embedding_bag.h,sha256=ETdaGeX8sBZpKjrD_ODunspo-lSXgqZ7AY3YcuCNI24,3477 +torch/include/ATen/ops/_embedding_bag_backward.h,sha256=JRQs25536Fv-O_FZV3L6utkyBCOtWlF7G_cyMjN3fqg,3857 +torch/include/ATen/ops/_embedding_bag_backward_cpu_dispatch.h,sha256=OFBdGpb_jcGiTWndTw430_GJT4-97rl9nZrIx4VGuEw,1712 +torch/include/ATen/ops/_embedding_bag_backward_cuda_dispatch.h,sha256=quyeQjG6tNVjGyLT128TOAzoVK2G4eK6N_tqV3O3N9c,1714 +torch/include/ATen/ops/_embedding_bag_backward_native.h,sha256=6-GZsGZre9wCjr6u7ZmK_zyfEmMao1oOiFmZYj4_HI8,1089 +torch/include/ATen/ops/_embedding_bag_backward_ops.h,sha256=CCiMBJtWWRjWtBOMRMWO5QLZviD14EbyK_KeMSOH3T0,2296 +torch/include/ATen/ops/_embedding_bag_compositeexplicitautograd_dispatch.h,sha256=45jIoUoHbOTjFaqt64dHfRTzgAAKijLb99x1U7jVpvY,1840 +torch/include/ATen/ops/_embedding_bag_cpu_dispatch.h,sha256=2PQx1dCtLIarOMmSRNF_NElDJdzN7QIoVqewovOPEEA,1296 +torch/include/ATen/ops/_embedding_bag_cuda_dispatch.h,sha256=uWlI4yRyvwIkpmPlC5j0KhLY7paSgtWWt5f5FdRWS_8,1298 +torch/include/ATen/ops/_embedding_bag_dense_backward.h,sha256=rsKAKZsi9GmABAgnqZKCVZX1RsqVHVXRDWYtapT7xEs,9643 +torch/include/ATen/ops/_embedding_bag_dense_backward_compositeexplicitautograd_dispatch.h,sha256=SgIOxOR3PyElCjVjRna7F0-5fKxmuCk3dc44ZB8ThIA,2473 +torch/include/ATen/ops/_embedding_bag_dense_backward_cpu_dispatch.h,sha256=txB7gW5gtz7yOTAAeM4WsbuzXbRSd-uvVrS8J-YW3v8,1642 +torch/include/ATen/ops/_embedding_bag_dense_backward_cuda_dispatch.h,sha256=EtsJMzN8W-p7jbyEbT-yTN-30AcVmIFOimYqOr478h8,1644 +torch/include/ATen/ops/_embedding_bag_dense_backward_native.h,sha256=JokK5S8aAKkHuaVhMjQGW9anXGzb0Pk0KFwl3vP-gDc,1768 +torch/include/ATen/ops/_embedding_bag_dense_backward_ops.h,sha256=Rnc52zr8FFTVj1llGhvvZxesGiIybwRofosYJ-oM1aw,3710 +torch/include/ATen/ops/_embedding_bag_forward_only.h,sha256=6ip8ea8jNqhdPQcRDGEUwOsAW9GcGvwH9-ZCIl2e4KA,3607 +torch/include/ATen/ops/_embedding_bag_forward_only_compositeexplicitautograd_dispatch.h,sha256=33BSJc6w73EK0Ycxt2o9fobN6IZ5hZBelIEs6e61m5E,1866 +torch/include/ATen/ops/_embedding_bag_forward_only_cpu_dispatch.h,sha256=4WHCfL9swsO8kN48lfytUo16u2fANZXZmmpduMY0Vuw,1309 +torch/include/ATen/ops/_embedding_bag_forward_only_cuda_dispatch.h,sha256=xlQAY-s3PGMmYt25Z8WazK6JIU3i4gLjUY_ljlCqUjk,1311 +torch/include/ATen/ops/_embedding_bag_forward_only_native.h,sha256=dC20dRAqWiNihCgjvRgyuF2KIU27vMDBhrJjIujphg8,1858 +torch/include/ATen/ops/_embedding_bag_forward_only_ops.h,sha256=BMIswgEexya7fz7U5_NZ7gbwVBEvke9DDBUnS-L6p8s,3986 +torch/include/ATen/ops/_embedding_bag_native.h,sha256=Y7I_qAkw-DqeRBZv7hDhWFmB2mPofokxdd5c_pykFNU,1819 +torch/include/ATen/ops/_embedding_bag_ops.h,sha256=WDdbMNd_yCxYg-6uL4iyCHTP1cJ4LdE4cKdaCL7zHho,3908 +torch/include/ATen/ops/_embedding_bag_per_sample_weights_backward.h,sha256=piA-GC-GdRTKeO_Vm1ZUSE3lMgpK4aJcghym-583nuU,2598 +torch/include/ATen/ops/_embedding_bag_per_sample_weights_backward_compositeexplicitautograd_dispatch.h,sha256=os7snzI0EvITqEl4LAZ7vet-EMHXNFAi8lxHRxFzRSc,1523 +torch/include/ATen/ops/_embedding_bag_per_sample_weights_backward_cpu_dispatch.h,sha256=UT_hFzezivLH-tzT1C6kKxF1dmsGS_fRXZS6PQibeDE,1190 +torch/include/ATen/ops/_embedding_bag_per_sample_weights_backward_cuda_dispatch.h,sha256=f0m4VV3zUKs4XzIki93eDuh-aC_-2GaOI7eCygZTo4A,1192 +torch/include/ATen/ops/_embedding_bag_per_sample_weights_backward_native.h,sha256=O-vHkTykZVyNrGN0pLK9K-8mM2Shy3XWx9nJQQD3tWw,1460 +torch/include/ATen/ops/_embedding_bag_per_sample_weights_backward_ops.h,sha256=rUGYrGP_7oNhC4LSedRjZo9XmTypq4iIZ8E1SYp-XAo,3046 +torch/include/ATen/ops/_embedding_bag_sparse_backward.h,sha256=iUA-PMjzDcuO2ZauX9i8ADGGu0lw9zJWsbTFEiKB30c,3564 +torch/include/ATen/ops/_embedding_bag_sparse_backward_compositeimplicitautograd_dispatch.h,sha256=hEoiIG59SL-ZMVHDsxHZzPKgchRg9WgEGxG7VOkH7nM,1672 +torch/include/ATen/ops/_embedding_bag_sparse_backward_native.h,sha256=MF9_Vbd2r18tKZcMpvBGwlwaiEB0KsXOgo-hnedsbrQ,1047 +torch/include/ATen/ops/_embedding_bag_sparse_backward_ops.h,sha256=B8YKtCcEUhMGrUg4VlQLEuwzqgU7t4jpu8SK76imZLE,2156 +torch/include/ATen/ops/_empty_affine_quantized.h,sha256=pRqtkUWorTJspx3GF4KP0IJUHc8qQdRL_staqrzjnb0,9592 +torch/include/ATen/ops/_empty_affine_quantized_compositeexplicitautograd_dispatch.h,sha256=IQFfqD7m1fEsIdS1sQxm47uYtm9pAfzhZMLk1Up7ewE,1787 +torch/include/ATen/ops/_empty_affine_quantized_cpu_dispatch.h,sha256=I2kvlN5o0I_B2BTdHAR5oU_lx7aw-R2WRA3PlcDOKks,1995 +torch/include/ATen/ops/_empty_affine_quantized_native.h,sha256=DuJ47O27yV-qybLR88Y4SFeiDg_V8fmIrLxgYrfz9yk,1592 +torch/include/ATen/ops/_empty_affine_quantized_ops.h,sha256=OSqxcmNZwQL-1caKd3kwjZlZofwzwnIXPqnCzwXJNzs,3050 +torch/include/ATen/ops/_empty_per_channel_affine_quantized.h,sha256=JaahyNRxLsAp0V8xMDY53yjmVy8MwKOC1zkJxscFJ0E,10900 +torch/include/ATen/ops/_empty_per_channel_affine_quantized_compositeexplicitautograd_dispatch.h,sha256=iLTWIW9WoxMlnSKgDOWu6buEP3zVdVYaF2L1d-PLU7E,1983 +torch/include/ATen/ops/_empty_per_channel_affine_quantized_cpu_dispatch.h,sha256=NVag_fAtrXyWrwXankUZvC9GFYzCAyxn7IwDA9SuPJI,2191 +torch/include/ATen/ops/_empty_per_channel_affine_quantized_native.h,sha256=5KeFFdsTxruBbnD4SuzzmibSqGdsvo-9Zt_Em8w7mG4,1737 +torch/include/ATen/ops/_empty_per_channel_affine_quantized_ops.h,sha256=R3d6taISwGikQMGKsU1AhuB_bZ5i6YHGQAAudM8krfw,3366 +torch/include/ATen/ops/_euclidean_dist.h,sha256=HPY-0s9TduK4Wyo0URBNNsyXFTXfKPyDj3HQmJsHn6U,1512 +torch/include/ATen/ops/_euclidean_dist_compositeexplicitautograd_dispatch.h,sha256=B8d-WgStR0aA_G1-mKkX8zY-0vPtrWQPhJqeU-iezFA,1295 +torch/include/ATen/ops/_euclidean_dist_native.h,sha256=BG321c6f1RCSRFwncZg-49g3OadSONlsMugS_w_7oms,895 +torch/include/ATen/ops/_euclidean_dist_ops.h,sha256=y0PJJg3_bxWso5bHjNTUbk8JJca3s2ctx3OV1psvQIQ,2042 +torch/include/ATen/ops/_fake_quantize_learnable_per_channel_affine.h,sha256=1f35gLlwzdJ03f3qVBw2dbvfixAH67C_548i8z063pA,2559 +torch/include/ATen/ops/_fake_quantize_learnable_per_channel_affine_backward.h,sha256=GBaRucIwLMmB5sBsxD8kWVHMd132lgkHLd2yBc9RLSM,1498 +torch/include/ATen/ops/_fake_quantize_learnable_per_channel_affine_backward_cpu_dispatch.h,sha256=QjurN_0b0ECcWe3vBvmPbs6k6bU_wY9wwJI4JcDD7gw,1242 +torch/include/ATen/ops/_fake_quantize_learnable_per_channel_affine_backward_cuda_dispatch.h,sha256=NSfoBrC1nnpKT27p4rvDCulQOeOw19W2wiyDUaOY4pk,1244 +torch/include/ATen/ops/_fake_quantize_learnable_per_channel_affine_backward_native.h,sha256=RNdBsrk6KCEcBcQsl6WN9eUy9acp4Vtlvqb-eN2PAvY,996 +torch/include/ATen/ops/_fake_quantize_learnable_per_channel_affine_backward_ops.h,sha256=97MhchnInZQK4cm1pNgUtgNGMqCypfTOCdoSBbirp9E,2021 +torch/include/ATen/ops/_fake_quantize_learnable_per_channel_affine_compositeexplicitautograd_dispatch.h,sha256=3wKEf72NTxq2w4ZjxKLs8_iOvFpMdvIVSWUY14yjT3s,1486 +torch/include/ATen/ops/_fake_quantize_learnable_per_channel_affine_cpu_dispatch.h,sha256=nCFhkOnfMK-4y_ukWK6ldJlbBJgUfANv6t14UX1KjVE,1172 +torch/include/ATen/ops/_fake_quantize_learnable_per_channel_affine_cuda_dispatch.h,sha256=fz-aKXfG_DmYlgOnaRO9TozQiDEScZAeK0Ccwawhmcs,1174 +torch/include/ATen/ops/_fake_quantize_learnable_per_channel_affine_native.h,sha256=jAVdsZVCpAKhA21z_wj_1-aZSnY3uz5DwuxpwQFyvvc,1171 +torch/include/ATen/ops/_fake_quantize_learnable_per_channel_affine_ops.h,sha256=Y88-1Fdnvy_CIuAJW-znpPa19iFJu3waPw_F_8jpyKc,2926 +torch/include/ATen/ops/_fake_quantize_learnable_per_tensor_affine.h,sha256=Vigpqn9R5ACbyJxRP3RRIR37FQy9-V0TvgnudUEImdk,2459 +torch/include/ATen/ops/_fake_quantize_learnable_per_tensor_affine_backward.h,sha256=8tY7HAqMp409w4M4LqdrUjAsiWepjh61gbMKFbKJQYw,1464 +torch/include/ATen/ops/_fake_quantize_learnable_per_tensor_affine_backward_cpu_dispatch.h,sha256=fjHbFJZzes_Fc5wxrvFCha8rHSHJNz57mMdaShd3GqE,1227 +torch/include/ATen/ops/_fake_quantize_learnable_per_tensor_affine_backward_cuda_dispatch.h,sha256=WHU9eBKJSlfpPhzaskczRcPHtiXVCCixf8hc4FYkrzY,1229 +torch/include/ATen/ops/_fake_quantize_learnable_per_tensor_affine_backward_native.h,sha256=DgtzJTS_bIDyamzlIHI2XbU2d9HU1NVp8sh1RfVCvs4,981 +torch/include/ATen/ops/_fake_quantize_learnable_per_tensor_affine_backward_ops.h,sha256=0zJS5HH7koEKtT25xjOyeqHiSbVMv_-Kvnl2j98SJyo,1971 +torch/include/ATen/ops/_fake_quantize_learnable_per_tensor_affine_compositeexplicitautograd_dispatch.h,sha256=ORFlt4LILWHyNCNyF2vV5qMTrM0meweHoTUpGks2eMo,1456 +torch/include/ATen/ops/_fake_quantize_learnable_per_tensor_affine_cpu_dispatch.h,sha256=KuQ7zGWasfUXpRxuT3NjQFGSnlpuhtuuktLUmXRDz7Q,1157 +torch/include/ATen/ops/_fake_quantize_learnable_per_tensor_affine_cuda_dispatch.h,sha256=YdDlfMMze5JHJ6mn4jAfFDw704WKU5Ly9YHkU7nZkmo,1159 +torch/include/ATen/ops/_fake_quantize_learnable_per_tensor_affine_native.h,sha256=nqPZqa7qT_LchUlfssKz1pGqZo6x7TqV8buE4Sqhf1o,1141 +torch/include/ATen/ops/_fake_quantize_learnable_per_tensor_affine_ops.h,sha256=JLI8T6QTI74TyqcEWMCLz79Hle7rMXRMlXILfC0CN8s,2826 +torch/include/ATen/ops/_fake_quantize_per_tensor_affine_cachemask_tensor_qparams.h,sha256=SaO6o8ACgDjxuPEY8LjEG9Chz4mxuwXvWRBNGkuBskU,2910 +torch/include/ATen/ops/_fake_quantize_per_tensor_affine_cachemask_tensor_qparams_compositeexplicitautograd_dispatch.h,sha256=yshKo40BgYqMshOwo30ysdoFdly1pRs8YvsQO1e55bo,1614 +torch/include/ATen/ops/_fake_quantize_per_tensor_affine_cachemask_tensor_qparams_cpu_dispatch.h,sha256=JE9zssvIPvBSK9_2YjUfCT-ht5M9eaT4lXKIlIssVTQ,1212 +torch/include/ATen/ops/_fake_quantize_per_tensor_affine_cachemask_tensor_qparams_cuda_dispatch.h,sha256=slZD_eUfZFlZ6_uH4l6XM1ACMJZ8FnMbr8AQwH70QXc,1214 +torch/include/ATen/ops/_fake_quantize_per_tensor_affine_cachemask_tensor_qparams_native.h,sha256=d-wHtBravGIJ5UnO39FIH8hEpzG_v0I4A_0GKvMNQow,1277 +torch/include/ATen/ops/_fake_quantize_per_tensor_affine_cachemask_tensor_qparams_ops.h,sha256=L1Sis-ICDRa8fHL_qNi6jLKxbGybJ5-D1geJw4-LvMk,3288 +torch/include/ATen/ops/_fft_c2c.h,sha256=-c-phdBTsOBVxGn2xZcjKNXgPSmCEZEIyizhjsbXjtI,4804 +torch/include/ATen/ops/_fft_c2c_cpu_dispatch.h,sha256=kSmkQ3zYO1v656Z8mwWhSNUL1rhVsW4vl4YM5BuimV8,1768 +torch/include/ATen/ops/_fft_c2c_cuda_dispatch.h,sha256=iasRyIcQstQs7g8TaoZiwIVt9dkG17PMwsemQQ5_3xU,1770 +torch/include/ATen/ops/_fft_c2c_native.h,sha256=9YcL4xASweue4g90yP7NwFJOhpXFuqMcm5qfkSLentA,1229 +torch/include/ATen/ops/_fft_c2c_ops.h,sha256=-oVc94ew-kqniJCFU7e2pcNZU-Y5MQ0dvNwrq8Ndwdc,2272 +torch/include/ATen/ops/_fft_c2r.h,sha256=6rInqKwhNmoT2Y138ZntLvRyhI8lxKoG-HaIRoc4ivQ,4858 +torch/include/ATen/ops/_fft_c2r_cpu_dispatch.h,sha256=qRRNwB_kFMX8vLATW9KJkoxYK88PS7K4XKzRVCgNNdM,1822 +torch/include/ATen/ops/_fft_c2r_cuda_dispatch.h,sha256=le6kF50ZkE7Fii5d2yNe-8CHwZgQrD_9Eoc0zrIG1ZY,1824 +torch/include/ATen/ops/_fft_c2r_native.h,sha256=ZY36Uc2eTQ_Of0oovcnIQlOkIAQXnM8CLb2KaYLelCI,1265 +torch/include/ATen/ops/_fft_c2r_ops.h,sha256=28hDzzpCTJlI9hl4yRHAqTlh51o5DXzPmGnE7036oLs,2324 +torch/include/ATen/ops/_fft_r2c.h,sha256=AI2RF-M2HVycTP-yHABjwc7m6gfLYdiD1ASefcheujs,1748 +torch/include/ATen/ops/_fft_r2c_cpu_dispatch.h,sha256=w051yyNx1G38bOZeH5yYxjrlc1RKEkfCLaegeQMOKzc,1344 +torch/include/ATen/ops/_fft_r2c_cuda_dispatch.h,sha256=zj83iIKw5c7T6et2a6Yh5cJWLIxjC5xEZF3rmHeCFH8,1346 +torch/include/ATen/ops/_fft_r2c_native.h,sha256=4QVUbYkHlsVLbM2_STT-8APKUnRU0VJ9GLmRKBsvIDI,1233 +torch/include/ATen/ops/_fft_r2c_ops.h,sha256=y1qV0_bhN0uPxXKvtyjrSP8GAzQEETkca5JwLoMKkek,2248 +torch/include/ATen/ops/_fill_mem_eff_dropout_mask.h,sha256=0Y--ukFvzmXgwfPXuOxT4uSiiQhCoLrL8B72jgzN_Sw,1126 +torch/include/ATen/ops/_fill_mem_eff_dropout_mask_cuda_dispatch.h,sha256=s5TCihoBkjjJQ4CAFjoC2xhulbFnCl9DzuIBj50FIsU,1069 +torch/include/ATen/ops/_fill_mem_eff_dropout_mask_meta_dispatch.h,sha256=NIzRdw05uqd055yER5rf950lrJrxE82AUe8CMUL6xLQ,1069 +torch/include/ATen/ops/_fill_mem_eff_dropout_mask_native.h,sha256=9G49WbxZbS2hnbPKj6Gd8oz4DkYAJ1KSP4tfJQcAgEc,821 +torch/include/ATen/ops/_fill_mem_eff_dropout_mask_ops.h,sha256=w2eK3WKtHT8lXiV7bAEHIpd1BluMr4mWl6cg_Rfbpug,1465 +torch/include/ATen/ops/_flash_attention_backward.h,sha256=LYFvqsxYGJK9wv52x1wvDwQd2wEFgqG8TKLZDO_ikA0,5367 +torch/include/ATen/ops/_flash_attention_backward_cuda_dispatch.h,sha256=e3P-RKHil8meAU9yth2QMP5MiVNsB25PQrJCt3kxMDo,2148 +torch/include/ATen/ops/_flash_attention_backward_native.h,sha256=PX8kuGBgnuwwl2m143njJ1lGRrXvAn9MHtvPoKuWtfY,1289 +torch/include/ATen/ops/_flash_attention_backward_ops.h,sha256=mfHQhzmg5ztxRqdRKZEX57mrU_uUrxLML_tEu6YqeV0,2920 +torch/include/ATen/ops/_flash_attention_forward.h,sha256=nYBKb_uT2EHw9ZdK5jhynHOaYzB7AfDSDbRAv09gNJM,5666 +torch/include/ATen/ops/_flash_attention_forward_cuda_dispatch.h,sha256=BFhwlhK7Vg8N1TzZs5b3OuktT7P62KbENETkQv7KD1E,2232 +torch/include/ATen/ops/_flash_attention_forward_native.h,sha256=HI8WMRj_ZiECA8N3nJfYojPe0l7g_nKQigP3y1LU6kw,1331 +torch/include/ATen/ops/_flash_attention_forward_ops.h,sha256=h7NrEYMo_vZkZhR5xi7sKw-hVheyu7xV0XBwdAwbBIQ,3098 +torch/include/ATen/ops/_foobar.h,sha256=14Lx24hLzeQ7uKCYjZ9tA1KFHbRioDcBqtZfVGpMqcE,1666 +torch/include/ATen/ops/_foobar_compositeexplicitautograd_dispatch.h,sha256=C5qRtcmXixJJ2haKZJtpPV6-w-cukerMMqqskOjk7wE,1233 +torch/include/ATen/ops/_foobar_cpu_dispatch.h,sha256=kUKpqJWWGjsujT_6BVfXblffSC2tfLKeVgu0uOdtppg,1051 +torch/include/ATen/ops/_foobar_native.h,sha256=7FOi12Kmk7lmuhlSWOnJsjaegiOl5Gg0kTNHQ4kfLVk,917 +torch/include/ATen/ops/_foobar_ops.h,sha256=62swbI2ZZBUlthPtnSoN8HOh6qzB2JgfSwZH20tabm0,2119 +torch/include/ATen/ops/_foreach_abs.h,sha256=WdXmcIljxwUrbfwKdx9MmpHStHmMbSJDALzkk2v-ELA,1526 +torch/include/ATen/ops/_foreach_abs_compositeexplicitautograd_dispatch.h,sha256=FPWSb3IxXrVl-R20Kmx3B893bmmmpFebqVQTwOJ0cqs,1266 +torch/include/ATen/ops/_foreach_abs_cuda_dispatch.h,sha256=V0fQRR90noIqfBZv-iwqBSnqsfjJbizlhjbsslAUXsU,1073 +torch/include/ATen/ops/_foreach_abs_native.h,sha256=ozUSkomIKQHp_Grwu2LLkt5gnz0YNeyylvXHQ8rgc8s,1068 +torch/include/ATen/ops/_foreach_abs_ops.h,sha256=yOWZ767UCAoGFNaURsE71qFn8MuVNxYd9bgeqraLhwU,2389 +torch/include/ATen/ops/_foreach_acos.h,sha256=6TYM5ZxJMZXrLkKqVqJ_AjalLawu-KGemwFzVVEZ-PY,1539 +torch/include/ATen/ops/_foreach_acos_compositeexplicitautograd_dispatch.h,sha256=MV_V70wo81XLy90k8XBBzjPXqatja-UyneIno1LMY2A,1270 +torch/include/ATen/ops/_foreach_acos_cuda_dispatch.h,sha256=Vw_E82ud-RWrU9mhLyeeY9GpGxWXPOD494aBA0d1LSo,1075 +torch/include/ATen/ops/_foreach_acos_native.h,sha256=DTJcbshuVHH4udyCB_7lIgCU3hYcOWN1B8SETa0cFLI,1073 +torch/include/ATen/ops/_foreach_acos_ops.h,sha256=syQ9IAZZhkK3ndje9r-nl2PjKogT1AitGzoBrp_dTFA,2398 +torch/include/ATen/ops/_foreach_add.h,sha256=8BF8Z7v2V048fw5qSOIKucbLPWexnOUMFeWNj6EGV8c,5193 +torch/include/ATen/ops/_foreach_add_compositeexplicitautograd_dispatch.h,sha256=WuEPfDtr4cXas34C_fJUFx6JKM4qBJGB36b9zCroKhs,2747 +torch/include/ATen/ops/_foreach_add_cuda_dispatch.h,sha256=Zi9ZNl4-N06kRtOPNrzRVe3-wvyY7w4XBbQxn_iGM90,1775 +torch/include/ATen/ops/_foreach_add_native.h,sha256=szfclqtYR4Nd0HkwV8kmVfq727OXtJwBd_X_BNaYLLI,3252 +torch/include/ATen/ops/_foreach_add_ops.h,sha256=YjBb9Hm1_oLphgT2VwSzjRAGIqRpBvZMWe2s0R_HC-Q,9245 +torch/include/ATen/ops/_foreach_addcdiv.h,sha256=YVtshrTbCwGBEPnYBS_QHgnHWOy3DAZ1hDAeY7wn78c,5222 +torch/include/ATen/ops/_foreach_addcdiv_compositeexplicitautograd_dispatch.h,sha256=oUzmE1WAPnoS8qmIV8C6RwomBEQvaoVBF6g_cqPMkyw,2798 +torch/include/ATen/ops/_foreach_addcdiv_cuda_dispatch.h,sha256=LeLpDJF9saKpfhKX-72-CGNxxm7wHd56rOWVcRik0Dw,1813 +torch/include/ATen/ops/_foreach_addcdiv_native.h,sha256=C7DDtZb83-eyh2FJCoZRcyR3pi97_XqzFEFH1DmEfGc,3155 +torch/include/ATen/ops/_foreach_addcdiv_ops.h,sha256=t8fuApxfEb8QMHRs4R9z7kD9rNLiwbyHp9wWBdhJuTk,8378 +torch/include/ATen/ops/_foreach_addcmul.h,sha256=-OASZvVO0YRlR0zc-76fFuuTBoS_6U7Z0yKZQPQaTgY,5222 +torch/include/ATen/ops/_foreach_addcmul_compositeexplicitautograd_dispatch.h,sha256=_qIRGuNvGbg4MX6CDdNp4Vd8rYTY8XiH1kEy8RN4ipI,2798 +torch/include/ATen/ops/_foreach_addcmul_cuda_dispatch.h,sha256=L4F5DnBEj05Q4IZRlZ1oyld2-cg0MbgyMQfjyUSpe9w,1813 +torch/include/ATen/ops/_foreach_addcmul_native.h,sha256=PAf1rD4Od6s-O-q8jewJUkRr7B1HDmOr-dS3x3xSggM,3155 +torch/include/ATen/ops/_foreach_addcmul_ops.h,sha256=r5r2OE75QpZyJQos__wxhJut6JAtkG3kOWP_sjFKbUs,8378 +torch/include/ATen/ops/_foreach_asin.h,sha256=44-snAR60Er4ST9kl17MsML25tUsUsUr1499BDOnD4M,1539 +torch/include/ATen/ops/_foreach_asin_compositeexplicitautograd_dispatch.h,sha256=uwef0FsROYwCToOyQy1c8zb-o8kSoxBWdtJBCe-WKvw,1270 +torch/include/ATen/ops/_foreach_asin_cuda_dispatch.h,sha256=1fq1_XLkHtwjUJlAcjuvK-GlpiZ9MVU_5je_a2bu0kI,1075 +torch/include/ATen/ops/_foreach_asin_native.h,sha256=3T8zhK5pUMttfNXrV7D4BuUfqMXiJuD6a9qynHlmbGg,1073 +torch/include/ATen/ops/_foreach_asin_ops.h,sha256=tAWkkfeo50nt4ElS8ue1UpNfx5LJQOxk1BHO4DEjIQs,2398 +torch/include/ATen/ops/_foreach_atan.h,sha256=ublZDgxAsH66nknSmY86eL3onOCPYIcWFhjZMpS9lIo,1539 +torch/include/ATen/ops/_foreach_atan_compositeexplicitautograd_dispatch.h,sha256=7lWtOZ1859DKcG2-ewNT1DAG6n36Vvwu6l1s6qzOuqc,1270 +torch/include/ATen/ops/_foreach_atan_cuda_dispatch.h,sha256=N13FohAm1N-kob0USP0CYyQo86pak8wt2NrnzFdA0xk,1075 +torch/include/ATen/ops/_foreach_atan_native.h,sha256=eoZl2l6LLCQikQ8CHExcjX6-sdBbxlwf22qd0sN2URI,1073 +torch/include/ATen/ops/_foreach_atan_ops.h,sha256=4NXyC5YwqI7wmCIFWvxGvJH1wqBVBAjoayHxsJ-dFYE,2398 +torch/include/ATen/ops/_foreach_ceil.h,sha256=9Yfo7GOw-DxZNNW4SJY38hdFzaIfgDNvGsmloDy-zpY,1539 +torch/include/ATen/ops/_foreach_ceil_compositeexplicitautograd_dispatch.h,sha256=D2qNQ9o2qgs2l4cURv58H_pFJeONh_UNjp9-h4GhIMc,1270 +torch/include/ATen/ops/_foreach_ceil_cuda_dispatch.h,sha256=XS-peN7PiHkVvIybZdedkUi_hfUFptmvIKq-NousfV0,1075 +torch/include/ATen/ops/_foreach_ceil_native.h,sha256=foDiLYCJoWcMaLWvKOsIbRyddPhn-k3zw9-uAY3P2cc,1073 +torch/include/ATen/ops/_foreach_ceil_ops.h,sha256=6RnT4fOnaMz1MXrLJ0E7kZuiN7C_rS1YgEFWbU8FxlY,2398 +torch/include/ATen/ops/_foreach_clamp_max.h,sha256=fo27SPgmEitddEr0w7ikP_XLggEs9dOiXx6KHienBu4,4022 +torch/include/ATen/ops/_foreach_clamp_max_compositeexplicitautograd_dispatch.h,sha256=-tbtKKsC67f_BURDf3oltXIAzCxKshK-v6htC_yULls,2220 +torch/include/ATen/ops/_foreach_clamp_max_cuda_dispatch.h,sha256=CERYx82qDSWH42D_kkc9oqDeDlv_3icM6dSVE4p1htM,1523 +torch/include/ATen/ops/_foreach_clamp_max_native.h,sha256=mUXvy9K_02e-0ligHJ9nPF0FpqLels3PGTXNr-Nf7ng,2506 +torch/include/ATen/ops/_foreach_clamp_max_ops.h,sha256=PzrQDqpvV9qYHCwlmt7o8I8GSpQfSOJVEVqaXc3rc1w,6893 +torch/include/ATen/ops/_foreach_clamp_min.h,sha256=cwNXvMxyrXeFDvTmg4IY905IAOFCqdGT9DpDrlzy_oo,4022 +torch/include/ATen/ops/_foreach_clamp_min_compositeexplicitautograd_dispatch.h,sha256=1LVkeAdL9CLaW5jYQaiakLbWkAEAS7HIdHfd6E33HHo,2220 +torch/include/ATen/ops/_foreach_clamp_min_cuda_dispatch.h,sha256=n7KmFc5Ko6Nfiat-kdF0QQGojKPs_HpZMX3tKf-SM3Y,1523 +torch/include/ATen/ops/_foreach_clamp_min_native.h,sha256=buVLvRS3vui_Xm0PEzZVUJWsl6owO9tOpnESHvRVdgw,2506 +torch/include/ATen/ops/_foreach_clamp_min_ops.h,sha256=G_gYb_W7ACxhGLCsi8cs4Xy33olRBrMt0B_IqJeefBw,6893 +torch/include/ATen/ops/_foreach_copy.h,sha256=39quAhugYwHueRwVR8P9AzrVLXkoSO_bJOqirNbmQno,1954 +torch/include/ATen/ops/_foreach_copy_compositeexplicitautograd_dispatch.h,sha256=TlryDPQel0BzLiRIssMGh9iMJGasaET99o6z-LLgdpQ,1444 +torch/include/ATen/ops/_foreach_copy_cuda_dispatch.h,sha256=FPFmA1Bqfq7JYqA2dd6h2pIRcghXOrH34wIa9dTxbVE,1047 +torch/include/ATen/ops/_foreach_copy_native.h,sha256=REYC9gkbQ1C1_FMKgJ9Czzty17ZW_XJ9M5xbGcbfW4A,1176 +torch/include/ATen/ops/_foreach_copy_ops.h,sha256=QPPQDRzZK5MvWm-l22tU06k7jf5Vy3gZkoz9BHSL3OU,2824 +torch/include/ATen/ops/_foreach_cos.h,sha256=swSFMUr1ifvLqebjzEWteUWLqRwXWi4yploJWM5IVto,1526 +torch/include/ATen/ops/_foreach_cos_compositeexplicitautograd_dispatch.h,sha256=LOTVBQ1QzYDX4gqUW50Bu2W7Dyc5lFg_LMF63_eKwP4,1266 +torch/include/ATen/ops/_foreach_cos_cuda_dispatch.h,sha256=sU5-oRK22eMzoX4ktw4_dIYVMCPLQjiLP3IdlcuUSe4,1073 +torch/include/ATen/ops/_foreach_cos_native.h,sha256=98HTDt92QHU8tM2z-Bp1OMHGd7LQGT1G09IwNkArLas,1068 +torch/include/ATen/ops/_foreach_cos_ops.h,sha256=4PWPvNU5Azw5UM1nwhLWuedZRhuth8_b1C6xevVR4mA,2389 +torch/include/ATen/ops/_foreach_cosh.h,sha256=XJFRVZqYlviM6STbPbBVWOWkfru8MU4on9uuSTdgb6Y,1539 +torch/include/ATen/ops/_foreach_cosh_compositeexplicitautograd_dispatch.h,sha256=bNlkAgX5osq0SJWFQRhY40mznV8P0YsPnhke5bKe3a8,1270 +torch/include/ATen/ops/_foreach_cosh_cuda_dispatch.h,sha256=pbZuyuFZgImjtfhPsbvwPL4TBmmDehUnyuZ3drtIC04,1075 +torch/include/ATen/ops/_foreach_cosh_native.h,sha256=ZYse1YPkiQTrRl36y89kTA9Bh3M-cUheycO1V5TnLZM,1073 +torch/include/ATen/ops/_foreach_cosh_ops.h,sha256=wmpn8GWhTJpnQcO4ozVj_nGFVLDWScgE4NIWYHNNhK8,2398 +torch/include/ATen/ops/_foreach_div.h,sha256=olrAMZuyS0JIe-lub0_1cllMr5kmIVnCULABDGSQmKw,4777 +torch/include/ATen/ops/_foreach_div_compositeexplicitautograd_dispatch.h,sha256=5qiFJLm6A03VEFvda0EWw3bGGtRCU0emWKr51yKkcIM,2527 +torch/include/ATen/ops/_foreach_div_cuda_dispatch.h,sha256=bIi975zqDZfKf_e08xYxpt6Jc6LQ6rtZJvTjXFkHrkM,1663 +torch/include/ATen/ops/_foreach_div_native.h,sha256=ugsum5rIWnzVBq7_ucWzp9oylb4GC1HbPTGoXzPCwRU,2976 +torch/include/ATen/ops/_foreach_div_ops.h,sha256=-HmGnOl9nqbnnSNh9hbt1bSCx8PvOG0qA-ZK73_ObHY,8705 +torch/include/ATen/ops/_foreach_erf.h,sha256=i2EZ35bxHSP9IaVpCkysnFKXdYWr4Txeay1lQBiRfQc,1526 +torch/include/ATen/ops/_foreach_erf_compositeexplicitautograd_dispatch.h,sha256=kSBQd1gsHiGmMF-zJBBZ_t4p21OWBwmDfN4rpL2_12Q,1266 +torch/include/ATen/ops/_foreach_erf_cuda_dispatch.h,sha256=hUHSJQIy1V2jk_alu1_sAUb5zxhfra0BXEB_q7ojrEU,1073 +torch/include/ATen/ops/_foreach_erf_native.h,sha256=kFWrYvphdfG-KRPW1MJ1o04Ir4LMQX2ys_qZG_DNeXw,1068 +torch/include/ATen/ops/_foreach_erf_ops.h,sha256=Y1ilYkqecCXzkznqVRQOfipr-Mv_MtmzPGwvgIrdQJM,2389 +torch/include/ATen/ops/_foreach_erfc.h,sha256=MpCNzyzt5Ho2yupxdyMdnIZGhOeEbmJzEWmre550hhk,1539 +torch/include/ATen/ops/_foreach_erfc_compositeexplicitautograd_dispatch.h,sha256=ybqPx66CPIHu9ub0Gr3V4aT8HGLI5NfCwTLkPpGiNO0,1270 +torch/include/ATen/ops/_foreach_erfc_cuda_dispatch.h,sha256=GIOouaebBN-0rjWBSYxPNFYHb9FgEcTnrgAObxn9Ibk,1075 +torch/include/ATen/ops/_foreach_erfc_native.h,sha256=kFfWhI3gHdxljWPOUFHE7KuFQ1P4srP00GqcwAu619E,1073 +torch/include/ATen/ops/_foreach_erfc_ops.h,sha256=lvD0tF4jXENrqD1lwpeLXpvYGRQ0NCfmfbGwiPzJXaY,2398 +torch/include/ATen/ops/_foreach_exp.h,sha256=2aX-1HGSG2WrhDiRuzja6o2wjsHqoauBWbTVZwSGJAg,1526 +torch/include/ATen/ops/_foreach_exp_compositeexplicitautograd_dispatch.h,sha256=YPYzrKsegdVG21BB-_2c-Dk1q4IuuZI87rV7FwyX9XA,1266 +torch/include/ATen/ops/_foreach_exp_cuda_dispatch.h,sha256=5_N8SlKt-xD8MWkNiuxVrYsTjzvfFPxLk9btbqehUK4,1073 +torch/include/ATen/ops/_foreach_exp_native.h,sha256=D6VqAaSKz_PlafWJtZpSApryNXSUbCAJrYKZxMghkoI,1068 +torch/include/ATen/ops/_foreach_exp_ops.h,sha256=NBuofRsQp2YG9OUxhFQ33KrXtKfvSKw-Moo8dfBz4_k,2389 +torch/include/ATen/ops/_foreach_expm1.h,sha256=z_rJxU95UP_8WqYXfbBbGBEv3nqb9IE9q0L4jTT3NLs,1552 +torch/include/ATen/ops/_foreach_expm1_compositeexplicitautograd_dispatch.h,sha256=hNCK7-nHBW6AzQ_smwkWWqoDAszQX3bzuAKdxkVG0s0,1274 +torch/include/ATen/ops/_foreach_expm1_cuda_dispatch.h,sha256=gpFiTconKe2JJugBO0lL0LEMG5-9NkLST2KnMWU3R0M,1077 +torch/include/ATen/ops/_foreach_expm1_native.h,sha256=cBl-UCdp6pvk6114bEKAYQixJXOJPXN36hENkF8n1ls,1078 +torch/include/ATen/ops/_foreach_expm1_ops.h,sha256=vFLk2wwoi1tSPyhARIhcSvISfesBXD4tHoK129yLyxg,2407 +torch/include/ATen/ops/_foreach_floor.h,sha256=KE1ROfGmXeW9M13HYxz5C3JzaChJKVrKXPsD0jQBAe8,1552 +torch/include/ATen/ops/_foreach_floor_compositeexplicitautograd_dispatch.h,sha256=7Te7ePn_6HJzcdlYDWqvh2AHmVWN7Cv79qtla1Z9zBI,1274 +torch/include/ATen/ops/_foreach_floor_cuda_dispatch.h,sha256=0wXOj2jhxHBcNns8fV4YT482g16JWNOnw258wLbyWHk,1077 +torch/include/ATen/ops/_foreach_floor_native.h,sha256=lHFAJWuHyVy6jywG2XcYXPORGXi41psV3e4DkPT_YNg,1078 +torch/include/ATen/ops/_foreach_floor_ops.h,sha256=XE1Ckx5y2nWej7vVFxL4VPIorfxLxBa5P2UFdzPGlcs,2407 +torch/include/ATen/ops/_foreach_frac.h,sha256=cebDipZaQhrb_KZ6ZQsTVWdkIlflA8nD0P_6gQhqh0s,1539 +torch/include/ATen/ops/_foreach_frac_compositeexplicitautograd_dispatch.h,sha256=-GBkWw6mrh3PWEPUf26SZoHS20XXlLKjY6ca9IPty0c,1270 +torch/include/ATen/ops/_foreach_frac_cuda_dispatch.h,sha256=eqPRcYZEgQGIQFS0jQ6ARBU8PuDe3yGh5SF3CGTSEPQ,1075 +torch/include/ATen/ops/_foreach_frac_native.h,sha256=_W7HWBLRHGKKNLxLr_8J1TK595MuLSln0O3p-mHiG_g,1073 +torch/include/ATen/ops/_foreach_frac_ops.h,sha256=nuVdR7rhSyZABzxWrcPP2q0GwV6CeUpli_KvTJ06xQ0,2398 +torch/include/ATen/ops/_foreach_lerp.h,sha256=jlGDklampruqhQbKJiGaIZgoGvW_4nX7VRYc7NLchqU,4497 +torch/include/ATen/ops/_foreach_lerp_compositeexplicitautograd_dispatch.h,sha256=VOHkkpZnlI__Tx91ex-nTjtwLJ6SLM5Kn4jFswnNgyw,2464 +torch/include/ATen/ops/_foreach_lerp_cuda_dispatch.h,sha256=JepWJctu9VeSLm-NxsC_1EcoMWAXZO95k-YGeJm0n1s,1645 +torch/include/ATen/ops/_foreach_lerp_native.h,sha256=zdWTATZ2iSuVrO05TkoYnuojlWNbry77NkJVmK5Oqh0,2759 +torch/include/ATen/ops/_foreach_lerp_ops.h,sha256=zyIBcpadrmm6TCXAwl8lF81qjRpiyjmlGsM2l51PY6U,7532 +torch/include/ATen/ops/_foreach_lgamma.h,sha256=4nRVTdrJEfRwJM45k6d9WIzKfcfoeYnVElAwUWUgddk,1565 +torch/include/ATen/ops/_foreach_lgamma_compositeexplicitautograd_dispatch.h,sha256=IQOko0Bhtpi_XT-H2v9ZEiyMNTSimpiRzTXzsWtMpik,1278 +torch/include/ATen/ops/_foreach_lgamma_cuda_dispatch.h,sha256=vqu52cT35ywEgmfi9lZwY-owNDAV1iRtgUQalgNRJUQ,1079 +torch/include/ATen/ops/_foreach_lgamma_native.h,sha256=N8ZOYtBjWyvnnaqulQaKWfQotaUiE-KFNCBBsUAmzC8,1083 +torch/include/ATen/ops/_foreach_lgamma_ops.h,sha256=luVGxAtMGfjKOBBmAz--O1QGGVlGprfLMvtosdlg-hU,2416 +torch/include/ATen/ops/_foreach_log.h,sha256=tphiyEdjJ5r_XDibplbr3DGbaRl_nuvVTCSEWvFjnvk,1526 +torch/include/ATen/ops/_foreach_log10.h,sha256=8d4fMcz34Q6er9zdSC5b2y4iCut-AoWV5Epehxyud9U,1552 +torch/include/ATen/ops/_foreach_log10_compositeexplicitautograd_dispatch.h,sha256=WUPFquXTcDiYlR4cKJCrPlhJ7Gh5TS6XMQU2TfG8fRY,1274 +torch/include/ATen/ops/_foreach_log10_cuda_dispatch.h,sha256=SFzg--VNZz7kVdcBF7c17PDLejJLCNwSpuHELsuKjXo,1077 +torch/include/ATen/ops/_foreach_log10_native.h,sha256=kXQqokuagfsYgZNTcW85i56XA8ngXDJnnYADUPPf7jQ,1078 +torch/include/ATen/ops/_foreach_log10_ops.h,sha256=9fA509l5zAV43THPApeH4hLHmFUqJOP4z80OvXsNuto,2407 +torch/include/ATen/ops/_foreach_log1p.h,sha256=8qnsQvtmyVKXEbU5TzJPKSYiFn7agi7MyhDqOiUC5eY,1552 +torch/include/ATen/ops/_foreach_log1p_compositeexplicitautograd_dispatch.h,sha256=4SPxem-rItO7oVD2X8i7Ss0HxZNOUM-VqOjFsqDZaqU,1274 +torch/include/ATen/ops/_foreach_log1p_cuda_dispatch.h,sha256=wFutjj5yvFFAONeRFhqofBQ-z8DDN0JwNR5NcTUYFvQ,1077 +torch/include/ATen/ops/_foreach_log1p_native.h,sha256=EYdAe30zEmhappjdWCvPL5iw9mBfsIWIhwPT0OfCmb8,1078 +torch/include/ATen/ops/_foreach_log1p_ops.h,sha256=pJSM0iLy8ms5lcSK4Rtiktx4m06fLnV-YRq2L0l1JR4,2407 +torch/include/ATen/ops/_foreach_log2.h,sha256=MBlPDvDFgEN-UHCClEuZoG1RXzSlUysh5tD89OJBTqM,1539 +torch/include/ATen/ops/_foreach_log2_compositeexplicitautograd_dispatch.h,sha256=j8egLIsfCrgzVfo9Y59nCnqbnv2oLqNjmLKxgLLUjMQ,1270 +torch/include/ATen/ops/_foreach_log2_cuda_dispatch.h,sha256=Fn-GgYuLGdzYasJ1N91ktf3s_G3PWsKSu98NsQMfXnA,1075 +torch/include/ATen/ops/_foreach_log2_native.h,sha256=QgKQgOLIZwRZnXHbCC8chS55irMKsVqFcuxnof8eui0,1073 +torch/include/ATen/ops/_foreach_log2_ops.h,sha256=eWCOTLTKZtlZPUwbGOzYI8mfljF2og7yUh19FCz-CVA,2398 +torch/include/ATen/ops/_foreach_log_compositeexplicitautograd_dispatch.h,sha256=9PcsFaLAllP4lyHIAQb_BKohHSoC80jV9bsnriA3eBU,1266 +torch/include/ATen/ops/_foreach_log_cuda_dispatch.h,sha256=8TZ5K-t6m1y6bKa9uqe6l-n8Bb7AAXfOZSxd_VuFm4w,1073 +torch/include/ATen/ops/_foreach_log_native.h,sha256=3X2zNMSa5PFwRi4l2gs_MfFliVCHO0rhuX_LIAXwV-I,1068 +torch/include/ATen/ops/_foreach_log_ops.h,sha256=KFsaPKmm4BlSoTUmM3HF3kkiqaVEKcXsZSCpMEJTM2k,2389 +torch/include/ATen/ops/_foreach_max.h,sha256=MIt3IYdDp6gIMOUsXC5xhd9ArHOSpE9Lhv6g_HSD-W4,1373 +torch/include/ATen/ops/_foreach_max_compositeexplicitautograd_dispatch.h,sha256=TTS7l3Mk_Ct87yKCUUsmwkvUZrjgCrrvdvEEKRRNpFA,1214 +torch/include/ATen/ops/_foreach_max_cuda_dispatch.h,sha256=3u6ICmZFmy95x6_mf3WunZve7XiB2cH2iayZ8fsCbSg,1021 +torch/include/ATen/ops/_foreach_max_native.h,sha256=5Dh1D9sEtUQp5V39ecVIA5snFMfflS3KCwU2C7rybJo,942 +torch/include/ATen/ops/_foreach_max_ops.h,sha256=dB8xzIg4oeTApTcXpR1lSrIbUfTGHlEw-4-zOTphvfQ,1885 +torch/include/ATen/ops/_foreach_maximum.h,sha256=-WP84wMzWj5fXf6KLyD5dJEOQGUfk7klHXI9yudLk74,3948 +torch/include/ATen/ops/_foreach_maximum_compositeexplicitautograd_dispatch.h,sha256=Byy_2d4ii0eXH-q-3kIEPWvxUDO0JKGGmW4H-oN_AAs,2196 +torch/include/ATen/ops/_foreach_maximum_cuda_dispatch.h,sha256=CqHojTu98XXSD5RkMuVkOcjAViIm1pEZn5sT84WV0Co,1511 +torch/include/ATen/ops/_foreach_maximum_native.h,sha256=T-QxO_DJd2umlR79r9I1NfxKpXYISeryxXv1Jr-D0_w,2500 +torch/include/ATen/ops/_foreach_maximum_ops.h,sha256=QPD6yPB26c1Y0tqmckf2s_eltGqLf7IG4NWVwBjofLA,6839 +torch/include/ATen/ops/_foreach_minimum.h,sha256=IG7bE2tAmzHCvLiKXjUPE3HUASO9YNLNRMf_PnvZSGk,3948 +torch/include/ATen/ops/_foreach_minimum_compositeexplicitautograd_dispatch.h,sha256=6bGD_StQ12a6rOiZ5-vrbP-LqdfaGTe7DCidW12G6bU,2196 +torch/include/ATen/ops/_foreach_minimum_cuda_dispatch.h,sha256=21j_EjAt5jvymvTA5dsfIn_Ru2OqBwoERpFN2btNUD4,1511 +torch/include/ATen/ops/_foreach_minimum_native.h,sha256=UrgJRbN8dVHUi3R-etgi-P_ijw1f9ErI77f4bxLbtG0,2500 +torch/include/ATen/ops/_foreach_minimum_ops.h,sha256=3I8mO1c6LwEpWC7Og9aPld4jfGu2xw_e0M9IuUhcpaU,6839 +torch/include/ATen/ops/_foreach_mul.h,sha256=0j4mHdGE0ID6VDWYK6t0mcFP6eCxeLq7tS3b-Qlrw68,4777 +torch/include/ATen/ops/_foreach_mul_compositeexplicitautograd_dispatch.h,sha256=uxpqPrMNJHiIGiou_MPtQInzSFiaXZm1aM3MrBNukpI,2527 +torch/include/ATen/ops/_foreach_mul_cuda_dispatch.h,sha256=gi5vz0TJsmfZVDWdP_o0fhGIq--2PGO5IwUX8cz0HdE,1663 +torch/include/ATen/ops/_foreach_mul_native.h,sha256=QZBARVojloWZw9I51MBkEKQU12pmU65sUb_b1TrWdSc,2976 +torch/include/ATen/ops/_foreach_mul_ops.h,sha256=uOWTnNN7_n3yL1zXVppN3uTLOVNIjK8NJxq_-NxRmxM,8705 +torch/include/ATen/ops/_foreach_neg.h,sha256=yGEq9LdwJbV_xpuW014cIcqeqFAcLITtiGezIhsgmdA,1526 +torch/include/ATen/ops/_foreach_neg_compositeexplicitautograd_dispatch.h,sha256=__cQQdS07ndhHDmdKlDGdAUdJcBeNmptuHXNmMYHEug,1266 +torch/include/ATen/ops/_foreach_neg_cuda_dispatch.h,sha256=YF4AmGAUS6ytNJ9Cb-LqzwEFd85F92poqOCC7kOSm_A,1073 +torch/include/ATen/ops/_foreach_neg_native.h,sha256=D6bY07Zfmr4fYW4TMJ_fr5QypCGbAvKm0_UOytGoJ1E,1068 +torch/include/ATen/ops/_foreach_neg_ops.h,sha256=G3tjq05PT13Hs2SyzgdGiJtDGAY7httvW9WCmBS5H90,2389 +torch/include/ATen/ops/_foreach_norm.h,sha256=K_O0Vqbjx2b8XiDcduTX12xRjMFFr8TW777vRXaSZMY,1798 +torch/include/ATen/ops/_foreach_norm_compositeexplicitautograd_dispatch.h,sha256=QbGxYWP5j9tRXkDCRWzs9m_vFYiMKwgDPkyOXL0eI7I,1440 +torch/include/ATen/ops/_foreach_norm_cuda_dispatch.h,sha256=uDyAIOb76zXZTpP4wVVkxovaapLSJ1MC_-iwKuE1LJY,1102 +torch/include/ATen/ops/_foreach_norm_native.h,sha256=Mfaz21-dG30bf8y0UJvUPxsnsQrHS3_uFo3-H98dn-U,1175 +torch/include/ATen/ops/_foreach_norm_ops.h,sha256=-Sf4oe2yCSF-1AKBWW8Ovirt_NSJDW-IYjKrkHR4oz0,2366 +torch/include/ATen/ops/_foreach_pow.h,sha256=O7kFQBv5i7CE10c8IKXox2pfH57PCiW-Yc4DT0Elcww,4133 +torch/include/ATen/ops/_foreach_pow_compositeexplicitautograd_dispatch.h,sha256=csdx6TtCR08X0zIsh4bGQv51dFg10uPokDw4TmLfrHE,2273 +torch/include/ATen/ops/_foreach_pow_cuda_dispatch.h,sha256=8jlUr5MyZ5GSkBZz3LWNE4gFCs1BbCq3Wm-N9mer8uI,1600 +torch/include/ATen/ops/_foreach_pow_native.h,sha256=N53NGlKsw6pB09FOsG5fWLWji505bf5yPYyt9H9aDng,2694 +torch/include/ATen/ops/_foreach_pow_ops.h,sha256=AAchLCwqa6CYWkH2khs3kZ1RJ84doEJb43LCi9po9WM,7493 +torch/include/ATen/ops/_foreach_reciprocal.h,sha256=p6lW3FXGwL9J3U8lenTI-YXUgQvcaqULd5UdfEIsq4o,1617 +torch/include/ATen/ops/_foreach_reciprocal_compositeexplicitautograd_dispatch.h,sha256=3U8KRc2puq7CeA_5rzLy2saLT1191MMxMms8tdx5ZL0,1294 +torch/include/ATen/ops/_foreach_reciprocal_cuda_dispatch.h,sha256=C2Bi-lM2sHJ6JURroFnebMgpOsJfDMPn7h3a9xGxIfk,1087 +torch/include/ATen/ops/_foreach_reciprocal_native.h,sha256=Tk5k183tPz8g98heAL-RzycqXaNqHKHrsjGBwoXLMFU,1103 +torch/include/ATen/ops/_foreach_reciprocal_ops.h,sha256=gPLfD5UjsopFq-irvrhBuF98a5x2B78ZmQ95zUnzmsI,2452 +torch/include/ATen/ops/_foreach_round.h,sha256=KDGxtXqeZENwmfpphQ2mNt4TrSSif7P_jX6W7PIQiVA,1552 +torch/include/ATen/ops/_foreach_round_compositeexplicitautograd_dispatch.h,sha256=3uKAIuVZvaER00aDVl72XSHbfFaAHevsXZCYfsyf_AA,1274 +torch/include/ATen/ops/_foreach_round_cuda_dispatch.h,sha256=p3xSQSqrUjRyvdtg_OhMHoYj4c5iTudf4VP3TktYT7o,1077 +torch/include/ATen/ops/_foreach_round_native.h,sha256=6wD55Atg0ROCcYkrcgL6G39-0SKywl32yioE2oVDajo,1078 +torch/include/ATen/ops/_foreach_round_ops.h,sha256=t55igQDMh-Gonc6phJTSmYgTyY5nlAXe3XpF5PvBCHE,2407 +torch/include/ATen/ops/_foreach_rsqrt.h,sha256=6Myt0YHAqoc3vxcM6TGb7HfpR7woi4sSRHCh_M38h_I,1552 +torch/include/ATen/ops/_foreach_rsqrt_compositeexplicitautograd_dispatch.h,sha256=iMZoeugpShAJBlUCgXZW00SJJq05pXxN00vHd8onoLI,1274 +torch/include/ATen/ops/_foreach_rsqrt_cuda_dispatch.h,sha256=Qc4M-C_QdSVDjL-t13ewHeLs--ZmLMj6KvBnXeEOtv8,1077 +torch/include/ATen/ops/_foreach_rsqrt_native.h,sha256=pcch82glYsdErJSxHATPF96T45tFuVo4tetO20sJ9Yk,1078 +torch/include/ATen/ops/_foreach_rsqrt_ops.h,sha256=xDlSO-vfK4c6QTTFr6v-bZ2nsew0hPYkbSyXq1IYW1Q,2407 +torch/include/ATen/ops/_foreach_sigmoid.h,sha256=sMYPO_Iw5o08de88LsBkuFD_HxIe87k3btOh9UCdM8Y,1578 +torch/include/ATen/ops/_foreach_sigmoid_compositeexplicitautograd_dispatch.h,sha256=xmTfTiniTiTjnlw0S9wAmLrKh0rbgcBDoYk9I69lq98,1282 +torch/include/ATen/ops/_foreach_sigmoid_cuda_dispatch.h,sha256=gHitRXv1BbEDp3afGcpklCOSIRL8D1UChJwVf-H3MqI,1081 +torch/include/ATen/ops/_foreach_sigmoid_native.h,sha256=cNVHLIG1sc-18DHYGtuqQuD5f4yLbyMjK2o90TjogGg,1088 +torch/include/ATen/ops/_foreach_sigmoid_ops.h,sha256=lAZhOYx1mgr0mp_BGBLbXKO2RSjpW0eKx286fYVNRcI,2425 +torch/include/ATen/ops/_foreach_sign.h,sha256=RFB73Ag_Nw8TIr5h0o1-N2NNsxHGaXULgcn-KSl7NWo,1539 +torch/include/ATen/ops/_foreach_sign_compositeexplicitautograd_dispatch.h,sha256=QH-y3BBnSdKZsuHsQiqL8mtpaKtnN1qlU56ForZpR78,1270 +torch/include/ATen/ops/_foreach_sign_cuda_dispatch.h,sha256=qrH513WSaeqVXWgVWX3KW3SVSdQ60BjDB_UoGSO8TEM,1075 +torch/include/ATen/ops/_foreach_sign_native.h,sha256=9hwy6zCn1FEObwDJLniSpUTQ9ZUzUcV-g8PaMexWUrI,1073 +torch/include/ATen/ops/_foreach_sign_ops.h,sha256=IwPSFaekFPiL47JK6lquVmBE8I5eykxG9C-KWhB9udY,2398 +torch/include/ATen/ops/_foreach_sin.h,sha256=BxoeHyKDmVpfTOKeQ1MpRWSkJqbfzFwCVJktKQwj2-c,1526 +torch/include/ATen/ops/_foreach_sin_compositeexplicitautograd_dispatch.h,sha256=YGeGhRW9bU23geElAT_MP6-YONkRnz1JQHRMAMGEfY0,1266 +torch/include/ATen/ops/_foreach_sin_cuda_dispatch.h,sha256=mNZX3p1lk13WHnAELY_7ptBgE8gpRn-9wQ0pKjpaXsI,1073 +torch/include/ATen/ops/_foreach_sin_native.h,sha256=c2n0kWUVUZOnOKCY8HMhjRbRvbOq82rR-51dUITAgFI,1068 +torch/include/ATen/ops/_foreach_sin_ops.h,sha256=AhTeVdNupBwSDZFwGq7dEfR5pPgNUpFy-MvsyPlMSXs,2389 +torch/include/ATen/ops/_foreach_sinh.h,sha256=6Ip5GaOy6L6KEqfDKZB38ZqFtwFwjYmu1TfUxMHT6_w,1539 +torch/include/ATen/ops/_foreach_sinh_compositeexplicitautograd_dispatch.h,sha256=jMb6SL-RJEHZ6vWQFMpojdhhfudG_oFeT_SQUSTrR_E,1270 +torch/include/ATen/ops/_foreach_sinh_cuda_dispatch.h,sha256=0nRkYcOXN0T6YQcTozAibUdiQGam0L-mbrAo2T_zvSU,1075 +torch/include/ATen/ops/_foreach_sinh_native.h,sha256=fcKHs3lICVda_gSR6QLQ5lklHcCX9tRUuhX_JnRJlZ4,1073 +torch/include/ATen/ops/_foreach_sinh_ops.h,sha256=OV6EhrijYAfaT4XSB9_b_JK00aGl79jq5lMjz6c0xhE,2398 +torch/include/ATen/ops/_foreach_sqrt.h,sha256=Yo0htn_oilK7gud8fjhGdPUKvxrBHpHqQf6AEbrgMSQ,1539 +torch/include/ATen/ops/_foreach_sqrt_compositeexplicitautograd_dispatch.h,sha256=2GpdmyT8IEALCXRppAjv905CYBnvwV_icIqexUZP6Bo,1270 +torch/include/ATen/ops/_foreach_sqrt_cuda_dispatch.h,sha256=nknyn_K_GyAwv1QpYa-4hL5_2tAZqpbPsC4u5smnHOU,1075 +torch/include/ATen/ops/_foreach_sqrt_native.h,sha256=29p2u7KRDGKFuTEj0vHFxCtRFrrroQtf6l2T3XdXf8E,1073 +torch/include/ATen/ops/_foreach_sqrt_ops.h,sha256=ZGefarpskYoWwaPmNmuNJ77-1J1wB-oRQSL5gtcqcFQ,2398 +torch/include/ATen/ops/_foreach_sub.h,sha256=TpGvOWErbEjsqcqu-lUvqUrrv_fEhNjFn_AYrZQQCLo,4008 +torch/include/ATen/ops/_foreach_sub_compositeexplicitautograd_dispatch.h,sha256=6l7E7-ZH7q5c3VHiUErtKNJDThttgUgLuBGZIHixrYo,2258 +torch/include/ATen/ops/_foreach_sub_cuda_dispatch.h,sha256=f3PUgAfaXuc6VDmYV6CZMaqFmQ2XwEugk3oEZkxyUoU,1543 +torch/include/ATen/ops/_foreach_sub_native.h,sha256=a8oUXesCH98oK_qZCzglc7FHMmW_lBNGqLWOod6GfXY,2554 +torch/include/ATen/ops/_foreach_sub_ops.h,sha256=ezjIIZcjJ7jPVM1foiob29pZX0wuMwZaiAffYDgAQ9s,7001 +torch/include/ATen/ops/_foreach_tan.h,sha256=5diymkmsN_AnAfQjBnL_OTlw7WPpDb-rlVAW8blrXPs,1526 +torch/include/ATen/ops/_foreach_tan_compositeexplicitautograd_dispatch.h,sha256=1_Amr8XOUiKd8BmJHtCX9ift6DqW0O_XaVhj1u0aFL0,1266 +torch/include/ATen/ops/_foreach_tan_cuda_dispatch.h,sha256=z0i9rCPkD1h-JXCkyTDDziOSfKGT4zXtCohwjhvlwJs,1073 +torch/include/ATen/ops/_foreach_tan_native.h,sha256=5MibzRhztuvAKLY8x0xlAOC4GSZueYyk-_R2AzKgUV4,1068 +torch/include/ATen/ops/_foreach_tan_ops.h,sha256=dBSrWAEgfCPt0g13t7GnhhyTXbQNFgRqzROkAWDuDZo,2389 +torch/include/ATen/ops/_foreach_tanh.h,sha256=9x3u3YUCDOKiMCXW2zynv5i4dCSQ-aaniOAPlVngctA,1539 +torch/include/ATen/ops/_foreach_tanh_compositeexplicitautograd_dispatch.h,sha256=FE5RhGLPQi5ZRCs72KBQliUUolkzAcd1owcssZA6Xz0,1270 +torch/include/ATen/ops/_foreach_tanh_cuda_dispatch.h,sha256=z-od3w-_jsVzd1NweRM6G19eRalZU37uNbHVPOIvggI,1075 +torch/include/ATen/ops/_foreach_tanh_native.h,sha256=OzrwyzAEVXG5hu1cwrcBJsCGrTnQTiBfgF4IPXV1d20,1073 +torch/include/ATen/ops/_foreach_tanh_ops.h,sha256=cXcAwik8KSU3FbLxmRh0GIWwA6kdad16qx6a8rV4_A0,2398 +torch/include/ATen/ops/_foreach_trunc.h,sha256=QaHqffWIzHr7okhBYLYWwfXxaLMHch2VNqyw-yT2fwE,1552 +torch/include/ATen/ops/_foreach_trunc_compositeexplicitautograd_dispatch.h,sha256=m-GK97awTgAkddXuUsSMMcDB0f6-2TVuUqaYuYDGpdU,1274 +torch/include/ATen/ops/_foreach_trunc_cuda_dispatch.h,sha256=n38pc3AzsLlbFhQGIIpmnQK-7u9eaGzBphue3_kH9TM,1077 +torch/include/ATen/ops/_foreach_trunc_native.h,sha256=WCVJS62Q5bAzL0iBSIOLlpd7xh0aXPhFDPeRlHwrRz4,1078 +torch/include/ATen/ops/_foreach_trunc_ops.h,sha256=4k4sJCqua5HyDUJdYIj6OnL9fur73RZXgSoitin5ZDA,2407 +torch/include/ATen/ops/_foreach_zero.h,sha256=r1ZjianhC-hGN6bHzm_7I4DeOhApIRoiRsal1fYSMOA,1548 +torch/include/ATen/ops/_foreach_zero_compositeexplicitautograd_dispatch.h,sha256=nxpTfTOgcXgHgfCLWMXTSMxDD2uw7V0nW-L-edqpV4k,1270 +torch/include/ATen/ops/_foreach_zero_cuda_dispatch.h,sha256=RbYnD8Gi1iasShi6JRcgPhynMEeEGI7E3_jrZVjgRXc,1002 +torch/include/ATen/ops/_foreach_zero_native.h,sha256=PtXw580zS-TqfqnxL8CSCF7ak4ksEnD_Amp_HpgqivA,978 +torch/include/ATen/ops/_foreach_zero_ops.h,sha256=OWO2i60KJud-WQqFb7aF1e2ZK52zJZ3PIYhkqboqfis,2407 +torch/include/ATen/ops/_functional_assert_async.h,sha256=Ocl_C8CgnkBaTZnbtn2nVF4CXRzs8HimLT9bbkDIMmA,1123 +torch/include/ATen/ops/_functional_assert_async_cpu_dispatch.h,sha256=jvPxTYDymYDrkstHqxWL2lRkQxz8zD4W2hyDl6Nm36o,1079 +torch/include/ATen/ops/_functional_assert_async_native.h,sha256=B-mwlecck1gK5G5dLKewmDyxyMjFRlTI6d4EmtPEzNQ,841 +torch/include/ATen/ops/_functional_assert_async_ops.h,sha256=IUnhaMgVq5_3Sg0cHL3-WVRXpWAO6KUcHdiF61IxqMk,1500 +torch/include/ATen/ops/_functional_assert_scalar.h,sha256=5D3uGqvNh2CCbflC068lmCC_GAAd0HPzYSKg4D1BPpo,1119 +torch/include/ATen/ops/_functional_assert_scalar_compositeexplicitautograd_dispatch.h,sha256=vI_2epl0BqNuAB0A3tIqndGwKLrz2CGq08t5WYoiVfE,1124 +torch/include/ATen/ops/_functional_assert_scalar_native.h,sha256=h5LjICeNWRB43ANol3kUq05Dr3EcaGxC6HC79OylSr0,834 +torch/include/ATen/ops/_functional_assert_scalar_ops.h,sha256=ZVoV7FMryHGNK8yScVJJY0rZj8kUx6_uGPpSDxjPg4E,1492 +torch/include/ATen/ops/_functional_sym_constrain_range.h,sha256=Qw0npKxwTYFlSQTG27H-HF1e97YCYB0XG-kifhzW0Zs,1176 +torch/include/ATen/ops/_functional_sym_constrain_range_compositeexplicitautograd_dispatch.h,sha256=sV4DlUi-pTX0SsySae0-RkmfpRAeiaAK1zE0RWD9zPs,1161 +torch/include/ATen/ops/_functional_sym_constrain_range_for_size.h,sha256=cuvAt_lFCTBbB0699xTtBojBlIjt6iYSseEUslZbw_4,1212 +torch/include/ATen/ops/_functional_sym_constrain_range_for_size_compositeexplicitautograd_dispatch.h,sha256=aKaotl0RIx0LwH0hWsGUiOJSMmgPNBQrmWHIm_ewPnM,1170 +torch/include/ATen/ops/_functional_sym_constrain_range_for_size_native.h,sha256=2yUr7HY50DJgpgPHZCUyK5-eT7nGMfe0ilEGNuew9K8,880 +torch/include/ATen/ops/_functional_sym_constrain_range_for_size_ops.h,sha256=FntiiWA0yRU7_4r3qXtitCbuimOow4kxs6COJzIl8ZI,1637 +torch/include/ATen/ops/_functional_sym_constrain_range_native.h,sha256=oUfrmUVHOlkI9qdLSrLZ-CxdY65KwtF3fX6ZAbNfIq0,871 +torch/include/ATen/ops/_functional_sym_constrain_range_ops.h,sha256=VqbS1AMvMTATksZ70UxdHG9s3ikNajJZedgYO7nf4Tc,1610 +torch/include/ATen/ops/_fused_adagrad.h,sha256=cVDbNyOLGTV4OyRuhQKyfJj3iXvTPHo5w4c6w1BhkZs,7053 +torch/include/ATen/ops/_fused_adagrad_compositeexplicitautograd_dispatch.h,sha256=G95XcolhT1NNvND-FK5vCqu_y9Hx3XTutBxOo09k1G4,3155 +torch/include/ATen/ops/_fused_adagrad_cpu_dispatch.h,sha256=D3A-eaYpADYvnDDzoZeCM-vXGFfk2hJxME5istNzF2M,1575 +torch/include/ATen/ops/_fused_adagrad_cuda_dispatch.h,sha256=T0_ZTh0ovmmJVMHPhKljeItS-OJLcWvtPcdHBC2e3Lk,1577 +torch/include/ATen/ops/_fused_adagrad_native.h,sha256=8WdetuPbRO6vCxk5-X-PLAaUVHRNdlRT4rUvFOMkSg0,3501 +torch/include/ATen/ops/_fused_adagrad_ops.h,sha256=VXs4xBjCmJvvh9lmW0m9Sh8NNTq8MdPArYTaHR4bI6E,9959 +torch/include/ATen/ops/_fused_adam.h,sha256=5ltm_QhqCYe9vcV_Bz9JHqp5fPjiWMlo2R1-3qL0iG8,8726 +torch/include/ATen/ops/_fused_adam_compositeexplicitautograd_dispatch.h,sha256=kMR-oDN3yaOvkInPUU2fL8ttb5nNT-inrC1R4Z3xpME,3713 +torch/include/ATen/ops/_fused_adam_cpu_dispatch.h,sha256=ZU7LfKcknBaWv7_GSvw_TMnHbtrdjUl8peRkbIrkuwk,1735 +torch/include/ATen/ops/_fused_adam_cuda_dispatch.h,sha256=ZYkUom6IVQtfnx4-jOr4woTiagmvh_kRXJYB8_m57ik,1737 +torch/include/ATen/ops/_fused_adam_native.h,sha256=fXmQqaKXN6noByXM-frpFJaLWSkhuxYkKdNrKLjJ-F8,4219 +torch/include/ATen/ops/_fused_adam_ops.h,sha256=INs64EWcwVv7XutpYipO4ulIZnWJ-KgZw-z3G1kM_0g,11937 +torch/include/ATen/ops/_fused_adamw.h,sha256=DVtdr7_uKe75JmYjgdxJvQSbaNJ7Kzfi164yJbVbz-c,8751 +torch/include/ATen/ops/_fused_adamw_compositeexplicitautograd_dispatch.h,sha256=OXjYwZhwyeSZbty6r9N29UEcyVegjkRv0lJrCEapBy8,3719 +torch/include/ATen/ops/_fused_adamw_cpu_dispatch.h,sha256=Fjjni1wes7cctW5lrSZb_h8khQIBSRJ32_6D7bL1h0k,1737 +torch/include/ATen/ops/_fused_adamw_cuda_dispatch.h,sha256=QUXf7CjWgc0aPcpR30GZQ_hxG_JKvx0FBVTvDxFC6eM,1739 +torch/include/ATen/ops/_fused_adamw_native.h,sha256=CSXI0UQCyp3_eN2PguZ9r1YfqqHnYCZ2OnI_o70PWAc,4227 +torch/include/ATen/ops/_fused_adamw_ops.h,sha256=AaYIDoeyACw4-Jlr5rw5_Do2Domczx4etqFfxt7obLc,11955 +torch/include/ATen/ops/_fused_dropout.h,sha256=N072Nm67ABl8GenaJYRkrl9QmfEbxC3i7JU24w0lVPg,1949 +torch/include/ATen/ops/_fused_dropout_compositeexplicitautograd_dispatch.h,sha256=g1zF71sXZAUQ4EBgnt8IhaTh0qJ2Ow_TOYbfWwoFelI,1379 +torch/include/ATen/ops/_fused_dropout_cuda_dispatch.h,sha256=XY0_6ynhJOq-b6Spx5jGwz4xOeIMW_9Q51d_pLstAt4,1104 +torch/include/ATen/ops/_fused_dropout_native.h,sha256=6ARcgOa2rYC4Sy9HjwvlqEi3uEWaFw5V3BmVdfH408Q,1046 +torch/include/ATen/ops/_fused_dropout_ops.h,sha256=XcShZgInZFgiNMUfV5dY3MT007wsLaTfoU5f2m0koKw,2506 +torch/include/ATen/ops/_fused_moving_avg_obs_fq_helper.h,sha256=SbPOE83RD2RzaPHW8Gvc5--S2GMV_uHNzA82_4OyQlM,5079 +torch/include/ATen/ops/_fused_moving_avg_obs_fq_helper_compositeexplicitautograd_dispatch.h,sha256=NS1cNhuTrMX38HYswqnV5i92kRjcNGG9w6c0xgzC0HE,2369 +torch/include/ATen/ops/_fused_moving_avg_obs_fq_helper_cpu_dispatch.h,sha256=iu_VK5RdZDxoxzgrqDc2fmkulrgjaeyrC-HBR2Izyw8,1353 +torch/include/ATen/ops/_fused_moving_avg_obs_fq_helper_cuda_dispatch.h,sha256=e94xdd95sXGg4tXMwrOZ9HpymBqbkJ6sMLrjBCN_v_w,1355 +torch/include/ATen/ops/_fused_moving_avg_obs_fq_helper_native.h,sha256=zXfxjmPInIWZWrqWi-pelnTtPg-9_2NE7WyAfwi2B5w,2447 +torch/include/ATen/ops/_fused_moving_avg_obs_fq_helper_ops.h,sha256=LNZ9X2NsLo4a8dRM8pI4GBBb2Le21u1ctukLSJsAVqg,6184 +torch/include/ATen/ops/_fused_rms_norm.h,sha256=l59px7-Xndgv1DWxVOLa_RUu1G-rYtf2FSZB435k6VE,1191 +torch/include/ATen/ops/_fused_rms_norm_backward.h,sha256=ww_nKfba5xwgDYtjxp3RLZuRL-dZm1uPSl7UAcf8nfI,1349 +torch/include/ATen/ops/_fused_rms_norm_backward_cuda_dispatch.h,sha256=yssKyHlyQkjQfES8k_QY5oBQj_NTK2aMpz5YXn4dIZM,1214 +torch/include/ATen/ops/_fused_rms_norm_backward_native.h,sha256=QMQzwn8_mh4aA5H7tzgo2F4BOuJytpF0ncW5DMYthjE,971 +torch/include/ATen/ops/_fused_rms_norm_backward_ops.h,sha256=WoaB82WuDME0sm5jrCY3LuSDIBVrD3CDLJptGZKfxdg,1926 +torch/include/ATen/ops/_fused_rms_norm_compositeimplicitautograd_dispatch.h,sha256=pfr-FvSKHTRfXtyYXK8g8u-TUhnb0zEcfe4Z0KW2aPg,1188 +torch/include/ATen/ops/_fused_rms_norm_cuda_dispatch.h,sha256=TSsx4Whx8qYzVkr1eCYrS3AYEZ0i8bF1ooVaKwbEVAY,1146 +torch/include/ATen/ops/_fused_rms_norm_native.h,sha256=LbwlCksrwRJ5PBDgfbgzskkEjRzu99FISdZNF5MrGtY,1103 +torch/include/ATen/ops/_fused_rms_norm_ops.h,sha256=_JryspWbmRI_hFMCjkTxiEReV8QoNnzNbYoBi-cJ8Ho,1705 +torch/include/ATen/ops/_fused_sdp_choice.h,sha256=ASHi18TVtCg3wajjQXBeKofLlfLgYoZ7UOw5a_n3k_o,1383 +torch/include/ATen/ops/_fused_sdp_choice_cpu_dispatch.h,sha256=00CmS6nZ37R_WY7a-OoO0_UG_4XOp2QvgoeUc9UjEcs,1224 +torch/include/ATen/ops/_fused_sdp_choice_cuda_dispatch.h,sha256=83Q2bQFEo2oSI6flDaoYwj7u0FSXiBGffZMlbTfXtPE,1226 +torch/include/ATen/ops/_fused_sdp_choice_meta_dispatch.h,sha256=VKaFYsXvst1CQdSX_XO-s60cF57KYMdsh1ldqFd4yso,1226 +torch/include/ATen/ops/_fused_sdp_choice_native.h,sha256=LqegO8G2F9THpCvXzR2nbZUeWphDlmQelSOFnDsP8E4,1546 +torch/include/ATen/ops/_fused_sdp_choice_ops.h,sha256=kLf_PKKDAYiXbbZL6gsHlGBKbbguQUw8ve9-zyFsD_s,1887 +torch/include/ATen/ops/_fused_sgd.h,sha256=CLbFKcTTmEEH09dT_yHEBcAiwSOEyOiCVpgqZQbnAm0,7549 +torch/include/ATen/ops/_fused_sgd_compositeexplicitautograd_dispatch.h,sha256=rKeWtCZjtIYKuKvUDo6Uy3R04B9SjKfz81w-rPzW1qU,3243 +torch/include/ATen/ops/_fused_sgd_cpu_dispatch.h,sha256=zr6uZgJAk-B3-2rD487yru41dRNoW8GRUZcKtw28DYs,1613 +torch/include/ATen/ops/_fused_sgd_cuda_dispatch.h,sha256=GRA1FnvXtdivDWp0ok_LRIUkX1FhqfFuqbbxsROJopg,1615 +torch/include/ATen/ops/_fused_sgd_native.h,sha256=LLpzV_rhJCW60Dhgjj6xSx6NSUQBWcLJuUEhvW2mJTc,3627 +torch/include/ATen/ops/_fused_sgd_ops.h,sha256=i46aCGKlml_tx7vR0r-HhSU-ci5hDB9ok-UGPS7XuQA,10221 +torch/include/ATen/ops/_fw_primal.h,sha256=v1UDX99-FGqv_i6KEn0Dr6vWRMf5Izfw3eLrADTItyk,793 +torch/include/ATen/ops/_fw_primal_compositeexplicitautograd_dispatch.h,sha256=FeiEYh3ocbvasDEJ9rJwnH_QJj5a3f4xWgjad2aix6A,1065 +torch/include/ATen/ops/_fw_primal_copy.h,sha256=hdXstp9dmxr8HLxeo6z9-kFrSGyGrIFoFIBOSa0haYg,1515 +torch/include/ATen/ops/_fw_primal_copy_compositeexplicitautograd_dispatch.h,sha256=xJpTSSScylfVGvvxW-oqwFTKnoAOAVLqc2eIbECeDzQ,1198 +torch/include/ATen/ops/_fw_primal_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=UPijBcxlXkh9tD4b-euu_RXJt5wxQtXRk52PdFNf5MA,1096 +torch/include/ATen/ops/_fw_primal_copy_native.h,sha256=g3sPBpDR24mqV_16ZH4bXZRCLy_8ytGqOLaBdVytYk8,883 +torch/include/ATen/ops/_fw_primal_copy_ops.h,sha256=QemwSkNIppbM8VZaqFOd8ZZies63l6MBK-NLl-39QfI,2000 +torch/include/ATen/ops/_fw_primal_native.h,sha256=Kbs6_jkbwqIeZ66BUzk_0T_spUSKHg8WYbDRhbjAm2I,775 +torch/include/ATen/ops/_fw_primal_ops.h,sha256=m73TdMC4eHqCm2Xnbwk1wkxvesQ28cKmcwCacrNwVIs,1313 +torch/include/ATen/ops/_gather_sparse_backward.h,sha256=kcSLbt98anlRw_x0eXSZNSfX5tGvVN6wKHFdj3oy2is,1113 +torch/include/ATen/ops/_gather_sparse_backward_compositeimplicitautograd_dispatch.h,sha256=zfhuv_rWDCilJLOfGK2fMpRgnJKly93Pfe4PGpfrJfM,1127 +torch/include/ATen/ops/_gather_sparse_backward_native.h,sha256=2WRhSCUHGDmDNef7zGKs4J2thJbwLOP7RNUq5nFq1bE,837 +torch/include/ATen/ops/_gather_sparse_backward_ops.h,sha256=WPyFj2qiqs2TvXOd0Eb8gtyZBNvLb5Vvxq0rd2gT02g,1509 +torch/include/ATen/ops/_grid_sampler_2d_cpu_fallback.h,sha256=KYgKomC-_X_zmvv92EE9XuDZ7mUDv2o---GwofaNjxw,2240 +torch/include/ATen/ops/_grid_sampler_2d_cpu_fallback_backward.h,sha256=L_JBt10SqmZMpZVI5gHZhxQkYjPsoTn9jIr3RfbZ6H4,1383 +torch/include/ATen/ops/_grid_sampler_2d_cpu_fallback_backward_compositeimplicitautograd_dispatch.h,sha256=YoiJHVfhamewc_BPb9V6kaxz0inUemYMUtHULtzF98w,1231 +torch/include/ATen/ops/_grid_sampler_2d_cpu_fallback_backward_native.h,sha256=cUrv5pZrGslLynLpCUYryzKh3Xg35K8DWgzgDG8b6ms,941 +torch/include/ATen/ops/_grid_sampler_2d_cpu_fallback_backward_ops.h,sha256=9WIOHPcuGLHtqVYrUfmZ7uuq1gRNNgaa8KjTFNQ-SLk,1842 +torch/include/ATen/ops/_grid_sampler_2d_cpu_fallback_compositeexplicitautograd_dispatch.h,sha256=oirVrOC5-tEhXG07qdXqpo_SOfvYLMLG0XhgjmeYV8M,1562 +torch/include/ATen/ops/_grid_sampler_2d_cpu_fallback_native.h,sha256=ej_uL1Gx30UnJSlr8EMKWUbCKtiny_sxavlyKxcpxkc,1073 +torch/include/ATen/ops/_grid_sampler_2d_cpu_fallback_ops.h,sha256=BQ9WY8uOHfH3c2geo9-vl-W2NbR2gWjnFq_5QU9I_6c,2608 +torch/include/ATen/ops/_grouped_mm.h,sha256=w4qne1Id6WEh-_zocgNWwy0_zCx-W7yhrr2iB929n8A,1228 +torch/include/ATen/ops/_grouped_mm_compositeexplicitautograd_dispatch.h,sha256=U1ONeORunEMD1K2NbDuo2SiJTmvfLsDghoy8NRcOdKk,1224 +torch/include/ATen/ops/_grouped_mm_cuda_dispatch.h,sha256=zP96juBBMf9zLS-vCOWjL2-XDC1gwX46u0Y0vDfnnt0,1182 +torch/include/ATen/ops/_grouped_mm_native.h,sha256=AhnN5T75O9LcjSFOa2M-rJHXiNbAVuAfBCGx23ZFxfs,1172 +torch/include/ATen/ops/_grouped_mm_ops.h,sha256=UVqGLBToU5qiyH08Up9vR52lwl-95COdVbQ3bq8Xec0,1770 +torch/include/ATen/ops/_has_compatible_shallow_copy_type.h,sha256=jLYoudj7PuefVl5YSanMvCi2hfiBYIHYsJAbf2QjNiE,1071 +torch/include/ATen/ops/_has_compatible_shallow_copy_type_compositeimplicitautograd_dispatch.h,sha256=Y9fuJ3kr0ErstWxOrC6GDAqvo4TFoGxeN2wGwsji1KI,1092 +torch/include/ATen/ops/_has_compatible_shallow_copy_type_native.h,sha256=cO1towm7npUpL-d4tFYcwtpNngHV3eHuoHiz_zVbQuc,802 +torch/include/ATen/ops/_has_compatible_shallow_copy_type_ops.h,sha256=usHGBFqbdTnfU9PGV8P28RTETGeob0Dv4pXfQaE-y8s,1389 +torch/include/ATen/ops/_has_same_storage_numel.h,sha256=8LTlCiBGfFKdSF0-O2b1Rbyjlea4pDbr53nBP0IGoFs,1034 +torch/include/ATen/ops/_has_same_storage_numel_compositeexplicitautograd_dispatch.h,sha256=yS6j2cIwik3dGqKrb0g88vk98sDwZrf8FzH-VT6Wbds,1083 +torch/include/ATen/ops/_has_same_storage_numel_native.h,sha256=G2Hug7fBoTDQvZDN4I56YMGoHbuWmzJn5eiVfyj-pdM,793 +torch/include/ATen/ops/_has_same_storage_numel_ops.h,sha256=gAvvQs5SXUI-gutpW-QXC7aVGQ4Elns9XKrvNdCm8wE,1362 +torch/include/ATen/ops/_histogramdd_bin_edges.h,sha256=9RMOa4NKU07fIMcUjFduSI3kb6uZV_XCcEvtXYBXvdM,2217 +torch/include/ATen/ops/_histogramdd_bin_edges_compositeexplicitautograd_dispatch.h,sha256=HkQkL4UPgHZn8KaYJcRyemioV2Bi6DPTdh0ndLqkZM8,1444 +torch/include/ATen/ops/_histogramdd_bin_edges_cpu_dispatch.h,sha256=NmW8rtaZtqxTfeLtJ4uxjvvHAyLvbaZnxARg7SD6ED8,1182 +torch/include/ATen/ops/_histogramdd_bin_edges_native.h,sha256=1Fep9JjS-yQztCYaJoCTi4BUD_YiUoy_xvbK4ooZz_A,1149 +torch/include/ATen/ops/_histogramdd_bin_edges_ops.h,sha256=n6oBrx6LyrUPPUZAg-oDIg5KLIe1ExMsHyOrnD2vZH8,2814 +torch/include/ATen/ops/_histogramdd_from_bin_cts.h,sha256=BkaWD8Nt9mVSeQJpMmmD4G0FBon5C14Qt_UzQE6va8s,2254 +torch/include/ATen/ops/_histogramdd_from_bin_cts_compositeexplicitautograd_dispatch.h,sha256=sYwQfmCEe1frV_9ayBtECgAH5OMoZJLQ2sDTH53golY,1462 +torch/include/ATen/ops/_histogramdd_from_bin_cts_cpu_dispatch.h,sha256=szTYaUWntWYv9mBWRM4SbS5na5GMAx2zhSiVi6c0oow,1170 +torch/include/ATen/ops/_histogramdd_from_bin_cts_native.h,sha256=CglgMZdKhtnfV3HViinGDkD2UizlxGsjrM2Y6x0m8kw,1134 +torch/include/ATen/ops/_histogramdd_from_bin_cts_ops.h,sha256=HMA7tQV0223OXvb15OtBfbRXiZ7VOPy2VHvwvvIti1A,2809 +torch/include/ATen/ops/_histogramdd_from_bin_tensors.h,sha256=TKuqLcQSLsTUzpaEnUfGZwpg2-69Jc0PH3pCXGSWF_0,2051 +torch/include/ATen/ops/_histogramdd_from_bin_tensors_compositeexplicitautograd_dispatch.h,sha256=gY7BoTT-Cdvu02r2Pq5wG-LpI0I0-ArL4XvcIDNPGQ8,1363 +torch/include/ATen/ops/_histogramdd_from_bin_tensors_cpu_dispatch.h,sha256=g29wapNRFmDyVDTkghIGyaFTiRlpT4KdpC9PPDTRNZs,1113 +torch/include/ATen/ops/_histogramdd_from_bin_tensors_native.h,sha256=Lf3iY8rsU2HdackLKSyL0I3dvCMAqoU13iMhD2-6olQ,1031 +torch/include/ATen/ops/_histogramdd_from_bin_tensors_ops.h,sha256=J8nMuVj609K6pwp1cNxVOOHNPCLk4rhhvcCZ9xhDwTE,2533 +torch/include/ATen/ops/_index_put_impl.h,sha256=CTeFVKaVxlEKQ_e6RChmnEkrJnh9cjY3Fc5NimdZfMQ,2530 +torch/include/ATen/ops/_index_put_impl_compositeexplicitautograd_dispatch.h,sha256=fMN7ZyyaWNZVJrQG4mPOE5xH5e0ou3MVmjjsBtYvfFI,1595 +torch/include/ATen/ops/_index_put_impl_cpu_dispatch.h,sha256=wtJmmpKpFFhNvL8HAylfXx1Dtf_nZVoMP8gv7cuf4js,1133 +torch/include/ATen/ops/_index_put_impl_cuda_dispatch.h,sha256=_yi_4Jo00lXv6gOX0MFvf18p0Q3Hu60DpX-v9Hk7iAA,1135 +torch/include/ATen/ops/_index_put_impl_meta_dispatch.h,sha256=rMqzDEFRQwxVuFtMma0W-wRoazrZ6gwDflQrmIWymy8,1135 +torch/include/ATen/ops/_index_put_impl_native.h,sha256=jTRUEKsS231XYfWTJr3Mz0k-J5maqaCHuopERNhkXvM,1678 +torch/include/ATen/ops/_index_put_impl_ops.h,sha256=2sBLVcGhJ-qiFTSAYsppGYEYPZXQuDGQrawKZDYXhMI,3583 +torch/include/ATen/ops/_indices.h,sha256=Hy4fhfvjh5ctcdIyVEvFLQgIOMkCu2DhBQYxd2v8D5w,791 +torch/include/ATen/ops/_indices_copy.h,sha256=O8pmaGBuUw7yLDB7gb8QnpIO18L8m67nCXZO2o13xjI,1396 +torch/include/ATen/ops/_indices_copy_compositeexplicitautograd_dispatch.h,sha256=qxCruqLSPDJb1wyipoNA4imP6ZefZmLyrcUlEmcnaZQ,1164 +torch/include/ATen/ops/_indices_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=3TpBzkyJz3_wOrmq1mcva-dbYsr8hKnaeBx0PXyf_2w,1079 +torch/include/ATen/ops/_indices_copy_native.h,sha256=cRHQPntce427APnIaRnGQpeT3r8379IHuTQHJeP5gOo,849 +torch/include/ATen/ops/_indices_copy_ops.h,sha256=LXx-XVyPrxlUpjC1UJDlRUFFma82gY_c_OHnUUHzBYQ,1888 +torch/include/ATen/ops/_indices_native.h,sha256=k_8JWDn6jSEFSr6wq6H3TCl3BGjCFusHz2-jsbEcKO0,765 +torch/include/ATen/ops/_indices_ops.h,sha256=ejdUnplBbxfntp4cvZPe9FASBanOo-VH-Ys1lcrHN6E,1257 +torch/include/ATen/ops/_int_mm.h,sha256=sxqAiMkysdvZ7PCyOVL8VzUC8_jPV7gYo1b7vLnJh7Y,1468 +torch/include/ATen/ops/_int_mm_cpu_dispatch.h,sha256=OK748XtMVq4UlnTVTHQbI_Eucav90WTTSnTOKtN9Sb0,1239 +torch/include/ATen/ops/_int_mm_cuda_dispatch.h,sha256=p1J_2gEJ-Zwiy-tDcBItJUj3M5gw9RQetX-9jnC1LpI,1241 +torch/include/ATen/ops/_int_mm_native.h,sha256=69h1jJfi0F_JtkXzzirO4sclp8KZD3no9Mb3KPWfovg,1091 +torch/include/ATen/ops/_int_mm_ops.h,sha256=oJ4EroIsnj7hFk5ooP9WMR738gbmvZgJIUGB-ymvAJE,2018 +torch/include/ATen/ops/_is_all_true.h,sha256=yOq3Fw7u107AEt643iOUTRcYPk8qbVSU3v6C6rukBwA,951 +torch/include/ATen/ops/_is_all_true_compositeexplicitautograd_dispatch.h,sha256=sLB32_Ja6WHKcCcXY89ocKc2_slnu6JeXylXauhuF1s,1052 +torch/include/ATen/ops/_is_all_true_native.h,sha256=JUJ50fqq5fsdzRe0MVPrN9yyPVwfQXABzAa3l6Nfl_Y,762 +torch/include/ATen/ops/_is_all_true_ops.h,sha256=MxVNkvXXPn-o3XkN4gjs9c0s6Z3UZz6z5z2t86XR-EU,1263 +torch/include/ATen/ops/_is_any_true.h,sha256=LDnkUF1HDrSnbs56iUB7UQebG87BQUiof6qLnlC9Fts,951 +torch/include/ATen/ops/_is_any_true_compositeexplicitautograd_dispatch.h,sha256=1yxzf0p6HvAhqWGalTP3FYBhH5v0m5lC6C4Ux2DzViM,1052 +torch/include/ATen/ops/_is_any_true_native.h,sha256=nPBP1DT1Wsd027lowyt9zUPCeNE7LPNKEQ1VT0SW1SY,762 +torch/include/ATen/ops/_is_any_true_ops.h,sha256=jDIbq3u5-YMxYhxjpizkE4HQs8Azb9dQbkTaZvNOR1g,1263 +torch/include/ATen/ops/_is_zerotensor.h,sha256=TrIdrYZaPpHPN2YKTo1VCshJ42lDOjoThpiuvUmZ_M4,962 +torch/include/ATen/ops/_is_zerotensor_compositeimplicitautograd_dispatch.h,sha256=MYo4FJNbb607HEPjnMLnH_ZGlmZD2-L-H9XLjDaxdno,1048 +torch/include/ATen/ops/_is_zerotensor_native.h,sha256=Y3Pb9REbIHYc4mVgo-weGZgOTbCr9Eyj8HdlCnB0x7M,758 +torch/include/ATen/ops/_is_zerotensor_ops.h,sha256=3F-aZH55c4r40IcT1d3jFNfnl-lTv_eO5cpxb3dF7jQ,1249 +torch/include/ATen/ops/_jagged_to_padded_dense_forward.h,sha256=W428kRWMJDgV0qSRvOMaR4TuPs0ENX9EiPMBNJqbQ84,2427 +torch/include/ATen/ops/_jagged_to_padded_dense_forward_cpu_dispatch.h,sha256=urwQzbTYJTGeqHUsAbB_Exf5mXY0ga5FVUR5FtCASK4,1280 +torch/include/ATen/ops/_jagged_to_padded_dense_forward_cuda_dispatch.h,sha256=9Gpi6M7Q20WyATfi2RxfzenVetF01zMEMZOP9AeZK68,1282 +torch/include/ATen/ops/_jagged_to_padded_dense_forward_native.h,sha256=8mQ9eQiY59HhlFC8IPjeuQU3BsG4iHxwyUqUZUjFf40,1034 +torch/include/ATen/ops/_jagged_to_padded_dense_forward_ops.h,sha256=zfOoecz4SNO09j08Cq2CFwk4U-MQVCAmmKwd9DiLwro,1594 +torch/include/ATen/ops/_lazy_clone.h,sha256=kDPsOcVcaotkwpAPmGf_cQD5PCJEzHiChzej67HqCSg,947 +torch/include/ATen/ops/_lazy_clone_compositeexplicitautograd_dispatch.h,sha256=CYCUCxgRR_fISD8upJABknh5_UDlnjAX0pDTeb7UPEs,1051 +torch/include/ATen/ops/_lazy_clone_native.h,sha256=eT1NnztN1m4Z_e19f1T8zLS4FzTXuUdkqrJoKok8Zwk,761 +torch/include/ATen/ops/_lazy_clone_ops.h,sha256=sAykwdN6mt5Ac0ZBR6ajeiewLyTRZ-hwR-WxvuISERg,1260 +torch/include/ATen/ops/_linalg_check_errors.h,sha256=UwjBhkjqS0FpVGC_j7Dfby27UEW2WLOJ7IuQc0hhZnY,1070 +torch/include/ATen/ops/_linalg_check_errors_compositeexplicitautograd_dispatch.h,sha256=yZ2LeNMTaK88eM-mxUMeFUZF0-U1R4VVK8H7mMLAWus,1097 +torch/include/ATen/ops/_linalg_check_errors_native.h,sha256=sJEKVzg7gT_e5Wq-a51iNVvt72hoe4Bex9kDnNSYLec,807 +torch/include/ATen/ops/_linalg_check_errors_ops.h,sha256=r5tcLumMUiiJIl9DuRb59h9x_q1GLeGYUMs6V-ECquI,1408 +torch/include/ATen/ops/_linalg_det.h,sha256=AzIWtEjiJ2weqVzJO7OlCIC_ZqiFmjg1mvbYodNhSr0,1784 +torch/include/ATen/ops/_linalg_det_compositeexplicitautogradnonfunctional_dispatch.h,sha256=-QtShXf9bFGu_eflStLjJd7OF3W_Z3EbBIlcANJwXxs,1110 +torch/include/ATen/ops/_linalg_det_cpu_dispatch.h,sha256=2vUUy5vltmpZ_vEyLxzCwvaLt2f_2bPzs7jN6VyiD44,1365 +torch/include/ATen/ops/_linalg_det_cuda_dispatch.h,sha256=xR8aBtJ8EAKasvRBZPCFUZLcpqpI1orOSfU3OYIEq78,1367 +torch/include/ATen/ops/_linalg_det_meta.h,sha256=pV2HCHYKFAuzfbOohprof_4CwZfdNdIcKI0WbOciSY4,855 +torch/include/ATen/ops/_linalg_det_meta_dispatch.h,sha256=dEpUQJISYiZR3qYJnGNxDO9UYq_0n1FoExGaccGYbp4,1367 +torch/include/ATen/ops/_linalg_det_native.h,sha256=C2jIawCannQPq-b7GP6NFmq8cQzD3weEmIwn3efNwOE,943 +torch/include/ATen/ops/_linalg_det_ops.h,sha256=vWQxqRLTE9HSeLtwkw-Eei5ptwarfwQZ2UJQIJmo4_Q,2320 +torch/include/ATen/ops/_linalg_eigh.h,sha256=st2EOASlEtoY32Lm802x3VDvyFYYtT1Y8IYml-qr6Q4,2054 +torch/include/ATen/ops/_linalg_eigh_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Votlbf1VEV0PSXVw_ZcfgzEJQQqfhQHGMGaKTUY1gk8,1148 +torch/include/ATen/ops/_linalg_eigh_cpu_dispatch.h,sha256=bZhjhurjjpaTuBg86YI4DPZ_4Pdkfj76SA6SlRkWoTc,1454 +torch/include/ATen/ops/_linalg_eigh_cuda_dispatch.h,sha256=yKBgeT4jI0gkJxh5IKKuKzNslynzcqpaLKwCsVjgRBE,1456 +torch/include/ATen/ops/_linalg_eigh_meta.h,sha256=6x1G134l_A6CA-h8zUbshYMjMA5_69LyVdg-9XxEGag,895 +torch/include/ATen/ops/_linalg_eigh_meta_dispatch.h,sha256=RTS7RflI8zh2wRlszGI9gaeQcYjEZnkskggCF4101Qw,1456 +torch/include/ATen/ops/_linalg_eigh_native.h,sha256=m6Yu_Q0JTXfPjMxiZ5oaSWA4WeDTInCgp_lwGA6eXXw,973 +torch/include/ATen/ops/_linalg_eigh_ops.h,sha256=3mmdiyGpE0wtJ4VnMkQMIiHg7wUhZu7vdDNaWrqrU14,2513 +torch/include/ATen/ops/_linalg_eigvals.h,sha256=tCr8fq5N4nyBdGJM8vr7RMySDPemEd3puggunnvkU0s,963 +torch/include/ATen/ops/_linalg_eigvals_cpu_dispatch.h,sha256=VHuCC0fTvC3oeQUj3lXEIzJrytaUu593GZy9Zn-1v-M,1011 +torch/include/ATen/ops/_linalg_eigvals_cuda_dispatch.h,sha256=DGzm7oDRJf6Tveadxm-9MHFGAdR3hdBIjjtdn_0JPB0,1013 +torch/include/ATen/ops/_linalg_eigvals_native.h,sha256=vmKjk31VzlyJXpJbnOYWeALpK6BOmREeLm25uQZL2SE,765 +torch/include/ATen/ops/_linalg_eigvals_ops.h,sha256=fpnIwBKIYLdjIuTgBDfj3VPF7E05G_HqTJckzQ1l1ZU,1272 +torch/include/ATen/ops/_linalg_slogdet.h,sha256=YoC-1EHTS1fltp2Z8nXc0Z_PW6xgTl9Vz0J2UYnRUYg,2011 +torch/include/ATen/ops/_linalg_slogdet_compositeexplicitautogradnonfunctional_dispatch.h,sha256=C3sRHAGp_b2a9g1yf7_oVnC4AEoOvbNrXR_RO-j0Dm0,1125 +torch/include/ATen/ops/_linalg_slogdet_cpu_dispatch.h,sha256=kn1hvuu0lig1Ho8CLKw27uQBUiu8oc9L_nCYPg5ll1w,1458 +torch/include/ATen/ops/_linalg_slogdet_cuda_dispatch.h,sha256=xJSWT9tGxdfL53shjLsfqqG8M2BYRHkz2Oeg2ELowHY,1460 +torch/include/ATen/ops/_linalg_slogdet_meta.h,sha256=XLdqyewhUx4K84wkRO9rCeUFk_UiiprixKsUS5AXhqM,859 +torch/include/ATen/ops/_linalg_slogdet_meta_dispatch.h,sha256=aXuJ2y3bjSFc9ZXMwUp_pBX3sIKhJptSV4uqhQb6mV4,1460 +torch/include/ATen/ops/_linalg_slogdet_native.h,sha256=c1ezdNrqELxgPufkAcZT6b0ejatFh2OxOqq2HPPLAyk,983 +torch/include/ATen/ops/_linalg_slogdet_ops.h,sha256=Wuk2zZWcwYcR4X3zAske7iw7AuqlgR7VTFIk6lQq3_M,2524 +torch/include/ATen/ops/_linalg_solve_ex.h,sha256=7ri6ghgnnhVaEU3A3DdIxEF_6zsQFVwKwST2XsIOASc,2405 +torch/include/ATen/ops/_linalg_solve_ex_compositeexplicitautogradnonfunctional_dispatch.h,sha256=KbXiF1xes1prBBYE9CGiiyN5DVvz3o7l26NbJJiksQA,1189 +torch/include/ATen/ops/_linalg_solve_ex_cpu_dispatch.h,sha256=9YmuHm9pzTywlC5Stytmwwp2p2phb_NaI_bFuZbAbHo,1633 +torch/include/ATen/ops/_linalg_solve_ex_cuda_dispatch.h,sha256=DjS3_iEeKj5vOAMOZGPAStgUG8LaOqULHOxDl7udfGo,1635 +torch/include/ATen/ops/_linalg_solve_ex_meta.h,sha256=ZlWZ26ycWyIA6mEhseVXUS88RF6vQlVHbQopbHisG2U,912 +torch/include/ATen/ops/_linalg_solve_ex_meta_dispatch.h,sha256=Zr-ekEWzagZD1KEZP-SKQfP2aBh2T2KgLNmlP8BwFIU,1635 +torch/include/ATen/ops/_linalg_solve_ex_native.h,sha256=CzLqrk6Y-i7D0LJaNmmp9yjJ_0kLjcFUryLc3izUWwQ,1035 +torch/include/ATen/ops/_linalg_solve_ex_ops.h,sha256=byJAvim8-s1BxVLGDs2RhQklzk4NufyTmODxwjrAus8,2898 +torch/include/ATen/ops/_linalg_svd.h,sha256=BKzvbfdj2hk-gytMMyoSEQQXExs_Od_SRET5ZAf2ot0,2269 +torch/include/ATen/ops/_linalg_svd_compositeexplicitautogradnonfunctional_dispatch.h,sha256=gk3h0kPc9ppGlFUkovcWPAf2h3hnSCv3I-eG0a27PAg,1215 +torch/include/ATen/ops/_linalg_svd_cpu_dispatch.h,sha256=6mS4zoy-WRDNRCjsaH9UV8JvXAe2-GspOWrpSS4nf7w,1634 +torch/include/ATen/ops/_linalg_svd_cuda_dispatch.h,sha256=fXUmpYkBcf9JxNZiIj1KeeHBlnTYacF5SRCKnHlEIZs,1636 +torch/include/ATen/ops/_linalg_svd_meta.h,sha256=AJPj1fiRI0CF4j4dt6xrhwqtt5dLehX7ssauKJdFPVE,934 +torch/include/ATen/ops/_linalg_svd_meta_dispatch.h,sha256=6l37tfospSPQnbjf6emJ0Ve988-vKoKqiqQ7BNC-AGw,1636 +torch/include/ATen/ops/_linalg_svd_native.h,sha256=QmqbSB4qUbpzPWWAFX2dZd9Dn-WuGn5_JdEB7oMQaME,1012 +torch/include/ATen/ops/_linalg_svd_ops.h,sha256=uE30Yi_kT61YXFWm8j__04BnFDtj8OpLhuFwlDfTMTY,2800 +torch/include/ATen/ops/_local_scalar_dense.h,sha256=XB8a8N09ps1pya6H_p_lihhCPuea6GF1a3A8r3LbKjs,979 +torch/include/ATen/ops/_local_scalar_dense_cpu_dispatch.h,sha256=sk4JVgFytt1L2lfOmMDiNxb1WdowKCTjfF9oYuAp_6c,1015 +torch/include/ATen/ops/_local_scalar_dense_cuda_dispatch.h,sha256=9XVommsd69vO6Vx2x65jczFoIUuyO9oQCMbCn2gbY4g,1017 +torch/include/ATen/ops/_local_scalar_dense_native.h,sha256=44O6IyctO_wpULjmd6Y5vH7CrWvyUu8F4atuYdHJ_7w,846 +torch/include/ATen/ops/_local_scalar_dense_ops.h,sha256=aY5bdRdUf3p2Wutyyf-ZBUqG2bC8h2GiIxcKWusp9FA,1284 +torch/include/ATen/ops/_log_softmax.h,sha256=0xtpJN7bNne68CmPJK0fTcT5escmnIC9laZBZ1z7H0o,1632 +torch/include/ATen/ops/_log_softmax_backward_data.h,sha256=myjPPttt04nWdZJJnjBx3VeFAwitpLZu_fYrZItlcG0,2015 +torch/include/ATen/ops/_log_softmax_backward_data_compositeexplicitautogradnonfunctional_dispatch.h,sha256=uja6H8BL3132JTE_dk6rKJ2itVqaKxEjErG1JtsYBYE,1167 +torch/include/ATen/ops/_log_softmax_backward_data_cpu_dispatch.h,sha256=nCK6ZPzDEuuFiK5ceUzsMpnZtRutmqCBy3xvfVp9SdY,1446 +torch/include/ATen/ops/_log_softmax_backward_data_cuda_dispatch.h,sha256=VqTpsaFxXt8WVJUedlt09ixhHyyXzrYHUInlR_7NyIM,1448 +torch/include/ATen/ops/_log_softmax_backward_data_meta.h,sha256=DEIp8CfesqHpAHMJoFWb_Elcxu8mABCDEHFR-bJ7ixw,948 +torch/include/ATen/ops/_log_softmax_backward_data_meta_dispatch.h,sha256=e8DfvKrYIQwQY4ygIu946stZ8qapFSR076BJpOdrvXY,1448 +torch/include/ATen/ops/_log_softmax_backward_data_native.h,sha256=sYuV6ofxTmecQBPzPmb7sa5w0XxYx6vwUO6C16IBQ1g,1269 +torch/include/ATen/ops/_log_softmax_backward_data_ops.h,sha256=_2Eo6u4fTh5ozI8QBPNfMhxl_zir60p3axCu3N0tVac,2466 +torch/include/ATen/ops/_log_softmax_compositeexplicitautogradnonfunctional_dispatch.h,sha256=qwVRePS3RxPAt3KUbYt7cbZnMcbeBEMLJNDpjA_9NJk,1111 +torch/include/ATen/ops/_log_softmax_cpu_dispatch.h,sha256=z9RTACpDmL3Sj-2k0wjWTfP0bq7XXecMb8RBopG9bmY,1278 +torch/include/ATen/ops/_log_softmax_cuda_dispatch.h,sha256=zYd7QtxP1UNqRsJ1F6sSwp2cxHQDfNhj9GMyF4seoCs,1280 +torch/include/ATen/ops/_log_softmax_meta.h,sha256=1bTwhvRo-uvmWvVjUwXT_PB0QvAZa-PWYX94oWkNiOs,892 +torch/include/ATen/ops/_log_softmax_meta_dispatch.h,sha256=1Vhq--Xz6QmGazwyCxjocOe0LhE2Ft4irXXrvHSUyXU,1280 +torch/include/ATen/ops/_log_softmax_native.h,sha256=SaL8-KCvVN14h6bYYPsPS6bILy217qJNiR5DUtWtDe8,1125 +torch/include/ATen/ops/_log_softmax_ops.h,sha256=dbiBwwjY8TghvnnNTp7NM4lECV_OHpWlNR3XMOgOomA,2102 +torch/include/ATen/ops/_logcumsumexp.h,sha256=_ybiiiZHqLeskvF9JfeeCBhnNOLgi8Gtjf8fJZj-Czs,1477 +torch/include/ATen/ops/_logcumsumexp_cpu_dispatch.h,sha256=haIP-t59iY8vb15JpCpb3WzVvHynKz70KXsnJ4JFEQo,1221 +torch/include/ATen/ops/_logcumsumexp_cuda_dispatch.h,sha256=wkhRmzd1dY3POFdbiCOfELH-ai5dfKGHTphTOEZB6WY,1223 +torch/include/ATen/ops/_logcumsumexp_native.h,sha256=qQV1oXgg4F13k4vZ74C_YKL45oSsv_AujBJ1Mlzjxw8,1067 +torch/include/ATen/ops/_logcumsumexp_ops.h,sha256=wPSZxj2QzUEBYPVqFlI3fHhjs4BssXxKr4Cg9qc0QsA,1976 +torch/include/ATen/ops/_lstm_mps.h,sha256=vifaprTrvDv2Pr9WwfzpYqItjf17-88PtzE5aAnxeTQ,3243 +torch/include/ATen/ops/_lstm_mps_compositeexplicitautograd_dispatch.h,sha256=vMOBCUnyTOnb_aMAfjoCV9xMgL2p_lQgAQDBt_lnucQ,1798 +torch/include/ATen/ops/_lstm_mps_native.h,sha256=Oko848xEEromqqBhZe01VKkpVXrWBlmTOq63zPwkbpA,1104 +torch/include/ATen/ops/_lstm_mps_ops.h,sha256=xLsUKKO6Y2p-sl5chKreZYXzTZNjLGKOFwfV7dQ284E,3748 +torch/include/ATen/ops/_lu_with_info.h,sha256=cRMvTax60qEve7Kb8xb-P5A3EM-Suq4qBownu2ty7t8,1127 +torch/include/ATen/ops/_lu_with_info_compositeimplicitautograd_dispatch.h,sha256=DN1rCAZFcZQSfLRR3FLeD0iU-jNp-MJrjfc5l6JVB-k,1130 +torch/include/ATen/ops/_lu_with_info_native.h,sha256=vxxP5QH_c-o7cZ0ZRk36kYXhQTnmWgDzxh_DVzJqPEg,840 +torch/include/ATen/ops/_lu_with_info_ops.h,sha256=ugpjEDekp4butj_hcdZtXIPWxTHaFzDe-xjW0Lf2Z58,1522 +torch/include/ATen/ops/_make_dep_token.h,sha256=rP3WXjINu1Vxd2IDQCPn7atPKOFXahXO7rgM8WAf_3w,1837 +torch/include/ATen/ops/_make_dep_token_cpu_dispatch.h,sha256=y5IzOcgBb3v_MIqiD02AJRm4ciOTZ1wC2THpWlqbrq8,1313 +torch/include/ATen/ops/_make_dep_token_native.h,sha256=Xd74zBfUTMu3FZM9u2P3gUm_sUsCIwlM2JrpgPTOEfo,965 +torch/include/ATen/ops/_make_dep_token_ops.h,sha256=u2qRUAgA84vK6T-DPctob43EZ0zznVrIwLYzE9Bseck,1852 +torch/include/ATen/ops/_make_dual.h,sha256=VEgmLDIhqNyAvn6MebzQYckHddByj0-mdNtqNR9Pue8,1041 +torch/include/ATen/ops/_make_dual_compositeexplicitautograd_dispatch.h,sha256=aMygudz0_vHTaKWpNZsQwrjg_GQbNr9E9j3ltWJnK9w,1095 +torch/include/ATen/ops/_make_dual_copy.h,sha256=W4_7fRvjRAdYxVZqtIk9lj6TTgHLPvlPv6nGhoEWVD0,1692 +torch/include/ATen/ops/_make_dual_copy_compositeexplicitautograd_dispatch.h,sha256=GlXwrjdfzNSssVuVh9XbyVCEGeRMIGhv0qApx3L7c_U,1258 +torch/include/ATen/ops/_make_dual_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=9vq2kT24_Lkm57s1KV99eweQE4UScQv6wKWoL9WaGhA,1126 +torch/include/ATen/ops/_make_dual_copy_native.h,sha256=LYK2wvtSZGS1gBIkX-q2kr7v-J5OZbywlA6CeBitA6I,943 +torch/include/ATen/ops/_make_dual_copy_ops.h,sha256=6XgijxqzxKgyG_fbnMcbIi_ZQah5Oc6qa8KiJmeeSG4,2196 +torch/include/ATen/ops/_make_dual_native.h,sha256=cK7Vjh-EjQFohCR2s4pKR_vYFdtnVTbIY9k9FuL8xG8,805 +torch/include/ATen/ops/_make_dual_ops.h,sha256=TLbp3jCRpkk4hDdx_hESI0rSnvbd15UuhLXO33cGVkU,1411 +torch/include/ATen/ops/_make_per_channel_quantized_tensor.h,sha256=iI4yTmqVv3v7L5efXUZcDWiuvMwlUO4g0mYVvuQaT8A,2023 +torch/include/ATen/ops/_make_per_channel_quantized_tensor_compositeexplicitautograd_dispatch.h,sha256=idmnewFlkGYLHmbBnmMhfNxVr5o4JQPnOxQdrSfhr2Q,1348 +torch/include/ATen/ops/_make_per_channel_quantized_tensor_cpu_dispatch.h,sha256=WsrUqwoIwu90tTGtMvTT72e4cEI5ZlTdUuBWxNq3V0A,1101 +torch/include/ATen/ops/_make_per_channel_quantized_tensor_cuda_dispatch.h,sha256=7ZDKmmFrOPlBeNUlttLP_hBAh-dHazw7aKmFZ8OT2n8,1103 +torch/include/ATen/ops/_make_per_channel_quantized_tensor_native.h,sha256=WfVjNM1cvCYEwnDNVqrdIV2464_zF9F7RvZIvkWodaM,1194 +torch/include/ATen/ops/_make_per_channel_quantized_tensor_ops.h,sha256=T_CY-WeAXCaHRMxZL3GaSVloW2PVtzkj2hZmHxvvyY8,2482 +torch/include/ATen/ops/_make_per_tensor_quantized_tensor.h,sha256=0gHci7n8mUCICg3Tvqu413uRLOCSCiVOcJrk2tnsMO0,1842 +torch/include/ATen/ops/_make_per_tensor_quantized_tensor_compositeexplicitautograd_dispatch.h,sha256=XeGTir9OjfrjLqsJOEFqpa2dnGGWr431wFetwYVFylE,1272 +torch/include/ATen/ops/_make_per_tensor_quantized_tensor_cpu_dispatch.h,sha256=ahtQaOMBZAeBAFPkiwhB_YEQtec-eCMvAcDA99a-MVQ,1063 +torch/include/ATen/ops/_make_per_tensor_quantized_tensor_cuda_dispatch.h,sha256=JesigqTB3NaB4cdrPWwx_c1tTf1_x3kh7dHDGqBzMM0,1065 +torch/include/ATen/ops/_make_per_tensor_quantized_tensor_native.h,sha256=OmnY8eTfGW2LQg0pq9bLguNHbIupWeOfsu2RCMEUqbI,1080 +torch/include/ATen/ops/_make_per_tensor_quantized_tensor_ops.h,sha256=QcC8svMOmvsqFFTU6itKplvJH7sNYPLQM9b665W41k0,2236 +torch/include/ATen/ops/_masked_scale.h,sha256=SxuQldgWAG4t-XLdL5yirJeF7wbQ6xbdcbsjyGxT_gA,1630 +torch/include/ATen/ops/_masked_scale_compositeexplicitautograd_dispatch.h,sha256=Y5J3x4ZxQ_V8f4gPHQMtdq5z6WSGL10iFoc5PNXHVkg,1242 +torch/include/ATen/ops/_masked_scale_cuda_dispatch.h,sha256=nXUJtLtDjL1jJ5PkanghR47XN6MyGZbo9G4Qrs5X-Zw,1050 +torch/include/ATen/ops/_masked_scale_native.h,sha256=QtXSDt0s48T4P7b1WsV45km5-Dys2UfYz25xf4CINR8,931 +torch/include/ATen/ops/_masked_scale_ops.h,sha256=y6kY6Vv0eEp8hgG_w1G6EmSb1G0IN1Db5KRiVHlCtIg,2152 +torch/include/ATen/ops/_masked_softmax.h,sha256=iQy3VbGVshe5mV9wrXwpua1meWpne5RZIOX-sGf2R-4,1962 +torch/include/ATen/ops/_masked_softmax_backward.h,sha256=VOrsCH62_WW8aob42Kw4WFwi2B7wVXX9WGLRPv0uM0c,2031 +torch/include/ATen/ops/_masked_softmax_backward_compositeexplicitautograd_dispatch.h,sha256=vokvv9pfHBeJlzZlV9Hzw0QMTqFqkrNY7QEaTnNJebA,1379 +torch/include/ATen/ops/_masked_softmax_backward_cpu_dispatch.h,sha256=HWCqtmYv5kCYOHLW6NGBvi9GTfx7-z_j-vBgm2hH_Lk,1124 +torch/include/ATen/ops/_masked_softmax_backward_cuda_dispatch.h,sha256=D3PLhHr1Gjra5vdTjVnxsmEX2tqHLDIefnIg66-AmO8,1126 +torch/include/ATen/ops/_masked_softmax_backward_native.h,sha256=RMtTytQsXoS9-aaRgn0-HoVjHmIaCjFvYGyMb87EgEs,1248 +torch/include/ATen/ops/_masked_softmax_backward_ops.h,sha256=uOr5dZsi7AfntI70efAYMKXE7HdRhyoovCdcsGDky4w,2542 +torch/include/ATen/ops/_masked_softmax_compositeexplicitautograd_dispatch.h,sha256=uR3PBcdk6OdIPK9_-t9GNIBllgdcWRFzikTJhgNyeww,1380 +torch/include/ATen/ops/_masked_softmax_cpu_dispatch.h,sha256=GTm13BXUcDnINBZ77r_4sHtLEQjnU7a8zd0bVm6cMow,1132 +torch/include/ATen/ops/_masked_softmax_cuda_dispatch.h,sha256=XX1UBCFCr88p1KvB18h8xq34OYPKCExlr0u57vSRZf4,1134 +torch/include/ATen/ops/_masked_softmax_native.h,sha256=m3Fpmz9FZK0iPeNcOEyBe66qY70m0k--k_r7_8TULBc,1257 +torch/include/ATen/ops/_masked_softmax_ops.h,sha256=9ZE6RJrrKiymZ-1GVdixJLSI_zpRDEUyROFO-rVXm2M,2506 +torch/include/ATen/ops/_mixed_dtypes_linear.h,sha256=9z__GAp00XacyTPUsi2UbsFFzYEgAyOPTuvaufHztg4,1251 +torch/include/ATen/ops/_mixed_dtypes_linear_cuda_dispatch.h,sha256=ys2gt_NslfiGNfemwsVOCHqAsxHPZai29jg0WjOM7lk,1178 +torch/include/ATen/ops/_mixed_dtypes_linear_native.h,sha256=URNsW07mZ43H1F8uxCuPwJWi5DgK5EIuz85syZCqxS4,930 +torch/include/ATen/ops/_mixed_dtypes_linear_ops.h,sha256=FVHiNX8Eo0gFEN3m-cfh_cOYzOEnT7gNwGVzDJQh14I,1757 +torch/include/ATen/ops/_mkldnn_reshape.h,sha256=1VZRYy_9BGd4oEWYJoaTDpean7WowLhH349Y1eyOcUo,1545 +torch/include/ATen/ops/_mkldnn_reshape_compositeexplicitautograd_dispatch.h,sha256=_cFwqi5ZnocMpXdNMKPqiXi8E_yWnjEVVa_3tAlZiME,1214 +torch/include/ATen/ops/_mkldnn_reshape_native.h,sha256=7G1R8PEYVmJCgE19BBLpC1hFOo4TYGYdw7ZxzzgLg50,898 +torch/include/ATen/ops/_mkldnn_reshape_ops.h,sha256=_f6dfNB1abLnE6gZxUpJp04EAPmvENNZTbmNsS2giPs,2052 +torch/include/ATen/ops/_mkldnn_transpose.h,sha256=BWWvOHZarZhu5nwZGgXuQzgk--h-nkiRa04K8xBbO2k,1856 +torch/include/ATen/ops/_mkldnn_transpose_compositeexplicitautograd_dispatch.h,sha256=tt88UMe5Re40b7BKC60TA0VIKfHd9Ze3AaZqAiAWWgU,1228 +torch/include/ATen/ops/_mkldnn_transpose_meta_dispatch.h,sha256=j6q4mgFqro3is7i48Wp0i1RQFjVjX6xfnIsG9ShYxsg,1040 +torch/include/ATen/ops/_mkldnn_transpose_native.h,sha256=tEXi_QLomFo8tagX6yamhuRebmF4rRX0ww4HqJ9Wwjo,1002 +torch/include/ATen/ops/_mkldnn_transpose_ops.h,sha256=hkIwsJnpw1SWOLqVLQeARgEueraiRnlloRSD7_emXa4,2737 +torch/include/ATen/ops/_mps_convolution.h,sha256=ua77XLQsTc-TLdLVhbOahEQjVtfGX2Pw0nGb68OI-Z8,7206 +torch/include/ATen/ops/_mps_convolution_compositeexplicitautograd_dispatch.h,sha256=fJsM7ao665hEAlMh58N28JbSFdLZQCrQbXhBtUNuIVE,2035 +torch/include/ATen/ops/_mps_convolution_native.h,sha256=5ku_w53hUooJbdIQDsAVxZivjdPcC0u2s0IT8ne86fA,973 +torch/include/ATen/ops/_mps_convolution_ops.h,sha256=LJLY_VE5z_-qjkzQsQ9A0q35q6OCGo76plm_ZbQdY4U,3072 +torch/include/ATen/ops/_mps_convolution_transpose.h,sha256=kSq5wRdFCUb2Q8O_XW2f4v66s-Tvm_A_vHrCgKxAw2o,7762 +torch/include/ATen/ops/_mps_convolution_transpose_compositeexplicitautograd_dispatch.h,sha256=wJl-tZK00ip-4Dwx-WLG9cvZQDQz_0GogAVNtKvXmmE,2043 +torch/include/ATen/ops/_mps_convolution_transpose_native.h,sha256=PAvv8NveN6Wp4MmdeUw3mOBW-lh42Id-CVLmgyH3qXE,977 +torch/include/ATen/ops/_mps_convolution_transpose_ops.h,sha256=fuGYdrY5x3KcG5P_yDVKvF1VEGXoCYMFjL4GnmhQnCk,3098 +torch/include/ATen/ops/_native_batch_norm_legit.h,sha256=sthRB-KOG25lokIB7QCge7Fmk3WRhWOYPhC3-672uQk,5693 +torch/include/ATen/ops/_native_batch_norm_legit_compositeexplicitautograd_dispatch.h,sha256=bvyBEU6bH7fOofQDxw5GCZjshWSdvSTsH85f12iDxa0,1329 +torch/include/ATen/ops/_native_batch_norm_legit_cpu_dispatch.h,sha256=I71LOaqP2UZfw-hcYxDymDcTruVpYx5h_zROHwHgHcE,2860 +torch/include/ATen/ops/_native_batch_norm_legit_cuda_dispatch.h,sha256=NZ-ppHJMIb_R4x0hKY7OzHJkgKH-P1heZ92HBWH_9AY,2862 +torch/include/ATen/ops/_native_batch_norm_legit_native.h,sha256=8p9q7uzg7SNp1_3G19t-zC-Xo8FhjEsmwyk8YpKWx5E,4041 +torch/include/ATen/ops/_native_batch_norm_legit_no_training.h,sha256=kCXKiHD4E1SkikXjheLmt0Uc56q0EDILkjinOYtWam8,2997 +torch/include/ATen/ops/_native_batch_norm_legit_no_training_compositeexplicitautograd_dispatch.h,sha256=-RymOiI089vh7UAV4nXKwzwc8moVfBoj-ExEOIs6GlY,2032 +torch/include/ATen/ops/_native_batch_norm_legit_no_training_native.h,sha256=cKuoY4TRqyaAmWix64p__185PWZYxvKNMQQIl-O4YgM,1365 +torch/include/ATen/ops/_native_batch_norm_legit_no_training_ops.h,sha256=yyGthoo0_mM6zPAn66BBlLsZCDfHuCylGd9EtOKUYKQ,3621 +torch/include/ATen/ops/_native_batch_norm_legit_ops.h,sha256=D0Ne4ld-9hRBiz02-2FlQxC5E0FxEVmZyVPcBMZ-K8c,7690 +torch/include/ATen/ops/_native_multi_head_attention.h,sha256=0RVYgSjUmHzdGSVQ68xtq5wqgrOe1Zk5Jv0AFJtTNkk,3888 +torch/include/ATen/ops/_native_multi_head_attention_compositeexplicitautograd_dispatch.h,sha256=Ysza2hBSnDZ8M1F76SxoPu6HWsfQyQ8BUZghTJemWxU,1984 +torch/include/ATen/ops/_native_multi_head_attention_cpu_dispatch.h,sha256=t2CXBlLqaidJ7HUq0_e17XrpoIM177zi2Zcnst_paRE,1411 +torch/include/ATen/ops/_native_multi_head_attention_cuda_dispatch.h,sha256=9r5FOQFWJASD3Az71BV0GcUOAZ2O6n3AY_IHgmlkXlc,1413 +torch/include/ATen/ops/_native_multi_head_attention_native.h,sha256=tFYWC5ReKZQXntGSH5oWfIWFQg_EweUM4rylH1s7evI,2118 +torch/include/ATen/ops/_native_multi_head_attention_ops.h,sha256=eLl9WbpD6KJfR_BvSzg0kXgmjEKVpukydmjrW88zFMg,4444 +torch/include/ATen/ops/_neg_view.h,sha256=Vihc2QipZ5oSW2zTje-5-8_SIvS8I9FCOyhpWIerDpY,945 +torch/include/ATen/ops/_neg_view_compositeexplicitautograd_dispatch.h,sha256=PqdTMv3f_s2OPV1o59Su58FA7dlIITnaXaxg1iEGjxk,1049 +torch/include/ATen/ops/_neg_view_copy.h,sha256=5AGWKTziO_Bt3rRvgFMADZsdrkbdtAoqPnlYVaBF3Cs,1406 +torch/include/ATen/ops/_neg_view_copy_compositeexplicitautograd_dispatch.h,sha256=CPCY-oaQ5DOmxK07OGHAFooUdrOVuL_M6uy9lZAgWZA,1166 +torch/include/ATen/ops/_neg_view_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=WD0zZ5adsXikaoOSty8_WcOfUHN35DzLuUlErfV7AoU,1080 +torch/include/ATen/ops/_neg_view_copy_native.h,sha256=k0U0TxDJrs-iU6nyLk9DAQibuLhhTnKFbmtw_EOgFic,851 +torch/include/ATen/ops/_neg_view_copy_ops.h,sha256=5JmiAzEcNzI7nByiuUKxLXlIRtmQ2tqZvb5a_nAJ6hc,1894 +torch/include/ATen/ops/_neg_view_native.h,sha256=yowDE_dedN8gxwXKwZ6zLi9Af2ROVlBXJZcLKImcv1w,759 +torch/include/ATen/ops/_neg_view_ops.h,sha256=ADpzCrQlaR7iL0MJ6B7wST46hptlWRaVLk6CkP4VboY,1260 +torch/include/ATen/ops/_nested_compute_contiguous_strides_offsets.h,sha256=MSwt5xpKbjZkWdqF37AWiH0K6bqEPXrz8jKQb7LrIeI,1127 +torch/include/ATen/ops/_nested_compute_contiguous_strides_offsets_cpu_dispatch.h,sha256=BE4xrsYZHcaRDKDiSpTbGfNUQeiCw2RFmzSwgaFxciY,1070 +torch/include/ATen/ops/_nested_compute_contiguous_strides_offsets_cuda_dispatch.h,sha256=fxlmgGfj8kGkbjjOJZEHPsZXxtbg5nCR0oyceufwyHY,1072 +torch/include/ATen/ops/_nested_compute_contiguous_strides_offsets_native.h,sha256=_XMeOz4Hw1aZTsg9P7xiWjf2mdh1ocB8HqU1Hehm02M,824 +torch/include/ATen/ops/_nested_compute_contiguous_strides_offsets_ops.h,sha256=AEkbc5k0KGOMX-F7ahEn8goAItn2Y-Y6cjZykWGvYHw,1459 +torch/include/ATen/ops/_nested_from_padded.h,sha256=D1ZCsBf7ViEKrK8xx3SRCuk80AVor55M3g22vWJqpEY,2035 +torch/include/ATen/ops/_nested_from_padded_and_nested_example.h,sha256=JeE85gP9muMoe0xMQTzotf4CDHTyXrzrX8nA67mZCDk,1850 +torch/include/ATen/ops/_nested_from_padded_and_nested_example_compositeexplicitautograd_dispatch.h,sha256=UPpQAQLbvhShxXjh-H1gw_I9Z2ObXqxLnoyyQoEBrDA,1280 +torch/include/ATen/ops/_nested_from_padded_and_nested_example_native.h,sha256=AFdB9BfQt6aZM93aMmMFM7uz_lb3FnnGIfeN94443vk,970 +torch/include/ATen/ops/_nested_from_padded_and_nested_example_ops.h,sha256=cxedRCkD7mJZjzQA7Duy9s3uLEyZPWUnJ3wIli6xKdA,2252 +torch/include/ATen/ops/_nested_from_padded_compositeexplicitautograd_dispatch.h,sha256=oTyLSfTpVKMoaCPbXtOuIQYe207lAV7tQi-YBzJdesI,1328 +torch/include/ATen/ops/_nested_from_padded_cpu_dispatch.h,sha256=X1NsrH2M2Z9i4_KtdNXGD3TiQqvoe4zIwyZ6IpeCvlA,1094 +torch/include/ATen/ops/_nested_from_padded_cuda_dispatch.h,sha256=rPu-s9XCIquxCMl2rUkPx5zUOuOhQWQwzblVONUVfUg,1096 +torch/include/ATen/ops/_nested_from_padded_native.h,sha256=YyEmeOaAq8civr3UXPRhh8KiY6LWLr6s-wo5k0ZmUrM,1171 +torch/include/ATen/ops/_nested_from_padded_ops.h,sha256=tLc6ovYRbAyU3mnzmPGyjLgLe29gvTEj42nn8Zg2lqQ,2402 +torch/include/ATen/ops/_nested_from_padded_tensor.h,sha256=w3k_g0khxHs9u2CWSNc8kCWDgZ5BxlyscYnJ9SRgpTc,3244 +torch/include/ATen/ops/_nested_from_padded_tensor_native.h,sha256=YX7OnfNb_sH0shOehK5IicUsmA-qqQcgPsV5l3mVxmc,701 +torch/include/ATen/ops/_nested_from_padded_tensor_ops.h,sha256=nwNrkcqrAIE3g-oGumBwLPrSQQ6WuwvwnhW4x_y_IJY,1994 +torch/include/ATen/ops/_nested_get_jagged_dummy.h,sha256=Fa5fw5_3dN7lH76uYzy_y-rcHmSwEk7MtIvhWymtzYM,996 +torch/include/ATen/ops/_nested_get_jagged_dummy_native.h,sha256=YX7OnfNb_sH0shOehK5IicUsmA-qqQcgPsV5l3mVxmc,701 +torch/include/ATen/ops/_nested_get_jagged_dummy_ops.h,sha256=qi0eoHbBbURLDmkHKV_ZUhBtYs1TCLGAdjIdwmBbiuI,1296 +torch/include/ATen/ops/_nested_get_lengths.h,sha256=x2k8jMNTjtcNWskrVKWAtBXMSjpmlg9CgPt3CJIdltU,979 +torch/include/ATen/ops/_nested_get_lengths_native.h,sha256=YX7OnfNb_sH0shOehK5IicUsmA-qqQcgPsV5l3mVxmc,701 +torch/include/ATen/ops/_nested_get_lengths_ops.h,sha256=1voGVVpDE4GZLPxnx23-6oS40BBZBRWcSVVpIh63kdY,1284 +torch/include/ATen/ops/_nested_get_max_seqlen.h,sha256=gxaQh2lJUTbsgTRfi2iSU1g4YC-OgebNK_kxCOdVcCg,991 +torch/include/ATen/ops/_nested_get_max_seqlen_native.h,sha256=YX7OnfNb_sH0shOehK5IicUsmA-qqQcgPsV5l3mVxmc,701 +torch/include/ATen/ops/_nested_get_max_seqlen_ops.h,sha256=-70XOK3RUHJylD2kB4gYNM4-YQAMhfk9Esc3lJmrV-Y,1293 +torch/include/ATen/ops/_nested_get_min_seqlen.h,sha256=kPc5AcnJdU9ivzVKtQhcHFcHd2DxZYTqmjDEQt54880,991 +torch/include/ATen/ops/_nested_get_min_seqlen_native.h,sha256=YX7OnfNb_sH0shOehK5IicUsmA-qqQcgPsV5l3mVxmc,701 +torch/include/ATen/ops/_nested_get_min_seqlen_ops.h,sha256=prsQX-eYq72gkGhg-ILeFCJtroMJaqF0brhbMscw_WU,1293 +torch/include/ATen/ops/_nested_get_offsets.h,sha256=FOi3eTeC9rmDOsbP4Ru5I6p4O5iJt5RaM3K_sfqdXFM,979 +torch/include/ATen/ops/_nested_get_offsets_native.h,sha256=YX7OnfNb_sH0shOehK5IicUsmA-qqQcgPsV5l3mVxmc,701 +torch/include/ATen/ops/_nested_get_offsets_ops.h,sha256=U6c8IErooZvnUdpdZ8vAVNt7X1vykfYianh3jOAhPdQ,1284 +torch/include/ATen/ops/_nested_get_ragged_idx.h,sha256=A96j2oBkz3LIuNLiWookcKQnMSAaZg1CS5m9TUrP-dA,985 +torch/include/ATen/ops/_nested_get_ragged_idx_native.h,sha256=YX7OnfNb_sH0shOehK5IicUsmA-qqQcgPsV5l3mVxmc,701 +torch/include/ATen/ops/_nested_get_ragged_idx_ops.h,sha256=GcXJjNHi7tSAYRRb6h-yerdKBnZ_gNuvM9CouzY-utQ,1281 +torch/include/ATen/ops/_nested_get_values.h,sha256=MnxuRo9Q7-HdIKGU_41cIkARtyrlABl_SlVYYUikQsA,981 +torch/include/ATen/ops/_nested_get_values_copy.h,sha256=Q9pRZ6Xy08gUQ6J2MqBj0o6Xw-MYDPYhGTozQSiLNvI,1496 +torch/include/ATen/ops/_nested_get_values_copy_compositeexplicitautograd_dispatch.h,sha256=9TEHJZExFQfNWqi9npJqjlfjtXeRdxsdrNHaAho7x9Y,1184 +torch/include/ATen/ops/_nested_get_values_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=naC_OXUCRbntqFpDs-D0F0Io-RDoC6C7gB0kPlmYzFE,1089 +torch/include/ATen/ops/_nested_get_values_copy_native.h,sha256=PDK2fhoB2j11i2oMxgBtsdqcbj71Vf0oEfMtRk8_4Ks,869 +torch/include/ATen/ops/_nested_get_values_copy_ops.h,sha256=TWpWbCZEIuoZJARNrvYipJrwlV5nNgR8BxKaeH04Jro,1948 +torch/include/ATen/ops/_nested_get_values_native.h,sha256=YX7OnfNb_sH0shOehK5IicUsmA-qqQcgPsV5l3mVxmc,701 +torch/include/ATen/ops/_nested_get_values_ops.h,sha256=nox15PrsoCgSg3R8pJQuc6S-JIyKuienJPHC-tY_KO0,1287 +torch/include/ATen/ops/_nested_select_backward.h,sha256=YnsPdRrSKKI11i9czLXQyyrI8gyQMZg0IWOJ5m97KpE,2099 +torch/include/ATen/ops/_nested_select_backward_native.h,sha256=92sMhD-I6tIMDW0gyig--ezONXVvTarfKzGCtdPNM-I,844 +torch/include/ATen/ops/_nested_select_backward_ops.h,sha256=tVnYJgwrEwHpi_8wDsBN86Hb5kpIbW85pQtIM5wvbdk,1509 +torch/include/ATen/ops/_nested_sum_backward.h,sha256=6SPApYJwmOyBm4nLgUkjtXfWmYOtXMeWd6SsT04kkhc,1123 +torch/include/ATen/ops/_nested_sum_backward_native.h,sha256=ffyyAQ1xgigd1IrjK6-h0IRS6_JwbfQMVX9zN9v2SmU,848 +torch/include/ATen/ops/_nested_sum_backward_ops.h,sha256=cu_uBYH779QmsSSTTMPU1iYVxLqLuBzEQ9p7dsUTAlc,1520 +torch/include/ATen/ops/_nested_tensor_from_mask.h,sha256=4a1QT7rAx7nx-5i42Njr1SFkex9KvGMzUG7BiZaDK3M,1774 +torch/include/ATen/ops/_nested_tensor_from_mask_compositeexplicitautograd_dispatch.h,sha256=LXFYP-UGHkvny5DNbDIqItamNS9lEg9PxIK9qpF1ohU,1269 +torch/include/ATen/ops/_nested_tensor_from_mask_cpu_dispatch.h,sha256=XaLFNeekusQgsXCx5rn9Jt8-uvS1PMUtL4s2PrvAQjM,1064 +torch/include/ATen/ops/_nested_tensor_from_mask_cuda_dispatch.h,sha256=zNsO2Xh9UuLj09n-zqkH3n-YEH5uG0CU0gsyWJ2M40U,1066 +torch/include/ATen/ops/_nested_tensor_from_mask_left_aligned.h,sha256=OnVoMNVKNJeWZqhS6kWg_a-yA28PQ27atPprCzg3nC0,1078 +torch/include/ATen/ops/_nested_tensor_from_mask_left_aligned_cpu_dispatch.h,sha256=kMLHvvUCFatnVCv9lV_SFJ5Vsu6mqUJhLNqx7rLtZIM,1049 +torch/include/ATen/ops/_nested_tensor_from_mask_left_aligned_cuda_dispatch.h,sha256=otCR7ClufIX159yVo444-U68ep7tK2mk4oejN5rbsZ0,1051 +torch/include/ATen/ops/_nested_tensor_from_mask_left_aligned_native.h,sha256=Wcjf4Gt3UoE6QhqTS3iourzJo_2fj8xC47XVMUGOBmY,815 +torch/include/ATen/ops/_nested_tensor_from_mask_left_aligned_ops.h,sha256=W35Ly1WNlwj54T06rks3oV6UVNlNqXonRicjYR-Dnh8,1392 +torch/include/ATen/ops/_nested_tensor_from_mask_native.h,sha256=OYCPe1PH15SSycEjkv0OwvbqhTLydfEv9u9OVp6THy4,966 +torch/include/ATen/ops/_nested_tensor_from_mask_ops.h,sha256=6r5-3SDdR-MdwLaKQbmnrrf0r1qMIgkBVD556gqwm2M,2226 +torch/include/ATen/ops/_nested_tensor_from_tensor_list.h,sha256=WUP2tIdnPcTDUCriayY3rSC7FMdBvj6hIUBLBJuAmAk,2497 +torch/include/ATen/ops/_nested_tensor_from_tensor_list_compositeexplicitautograd_dispatch.h,sha256=wvtbSF_bYssv0oa9jnGKbWh_t5L2IdoXlVkFAyzz5KE,1823 +torch/include/ATen/ops/_nested_tensor_from_tensor_list_native.h,sha256=i_hYk_IFWH3tPv3z1JnZQyFVhnQ7jnZB9WmI5aa1QAw,1227 +torch/include/ATen/ops/_nested_tensor_from_tensor_list_ops.h,sha256=Cd8BO6uxedjVhd8SIt6RALyF5IXosKtt4uinmSgaz3c,2962 +torch/include/ATen/ops/_nested_tensor_size.h,sha256=EsUofd8_5_PdpOItRYaZg8wFxccoars3nyn2Eqn4Noc,1277 +torch/include/ATen/ops/_nested_tensor_size_compositeexplicitautograd_dispatch.h,sha256=0zXbiH36PKCygwsAtWrlOQpbBVSA0RZFGSuoWqeZjPo,1176 +torch/include/ATen/ops/_nested_tensor_size_native.h,sha256=ceoXhJRZBTMUlO0MlnunEmDWwkuW8NBovu65FbZZ7bY,861 +torch/include/ATen/ops/_nested_tensor_size_ops.h,sha256=Gd5-ShqrdQT8yPFEMNhv0ajtsmFcQ4axpr1UKiU-7hg,1924 +torch/include/ATen/ops/_nested_tensor_softmax_with_shape.h,sha256=NWPUARy9ccA40hFNCOqa6dr5BnwjsMQ-LGFupvkglkA,1082 +torch/include/ATen/ops/_nested_tensor_softmax_with_shape_native.h,sha256=_7Id6xEoEgQPkKL7ddBh46X1wnXRaRyl_kTjVAIp0Uc,912 +torch/include/ATen/ops/_nested_tensor_softmax_with_shape_ops.h,sha256=aDbsm7Ow3x5izyJSBV6JzcXu50upkx1LbA850_dgVfc,1412 +torch/include/ATen/ops/_nested_tensor_storage_offsets.h,sha256=y8kSPEM8rpPo1njyMLGm7N4EoIeLYwuIoM88CnaapBM,1354 +torch/include/ATen/ops/_nested_tensor_storage_offsets_compositeexplicitautograd_dispatch.h,sha256=DIuMplI8vYnXFEhXMqHyBLwEVHvTAc7bWX79l-taKtI,1198 +torch/include/ATen/ops/_nested_tensor_storage_offsets_native.h,sha256=zehNs8J-ItDgXyX69k9raLCB0i4YiWGp_BrikJCJP6w,883 +torch/include/ATen/ops/_nested_tensor_storage_offsets_ops.h,sha256=rjaW-Wov3VJTTO2GcQMkDYixBHHIPv447vRf6UKJ9pY,1990 +torch/include/ATen/ops/_nested_tensor_strides.h,sha256=5n9b_Nx1nN0M6I7lz-k3mIvT_LxsHcwUDzekIe23NDA,1298 +torch/include/ATen/ops/_nested_tensor_strides_compositeexplicitautograd_dispatch.h,sha256=V7uDEkq-zLwAGrcXU9zFb7-L09IG8ixjm1v-vr24AhQ,1182 +torch/include/ATen/ops/_nested_tensor_strides_native.h,sha256=r5riwITauJd1M-8IQLzHxxh2U0pgFSs1D_xhqZdVkQo,867 +torch/include/ATen/ops/_nested_tensor_strides_ops.h,sha256=CdTLrMEbsghwYsdMa5Q6eojmIMolNUtV0G7XhxGgDPc,1942 +torch/include/ATen/ops/_nested_view_from_buffer.h,sha256=IwASmxGw6OSlNUtTzvq78h7VUpmYrQcdmlpkCufWtRI,1197 +torch/include/ATen/ops/_nested_view_from_buffer_copy.h,sha256=HWuledpmKNaJfwLmqNaRz_alysRvMAJy8OdaugQ83kQ,2132 +torch/include/ATen/ops/_nested_view_from_buffer_copy_compositeexplicitautograd_dispatch.h,sha256=Y1Z0-D0Cx7KLpwEivw3VM2Nh9e_HzCaBcDj3QbDjFe8,1386 +torch/include/ATen/ops/_nested_view_from_buffer_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=niibZWCxjU1f4-eYy5Is2UzZxoQsFbnkt7RAWldshIg,1190 +torch/include/ATen/ops/_nested_view_from_buffer_copy_native.h,sha256=vUEfEXxAnUCBVSJePP94qINS-Y1EmCyh6R2AnYkrxkw,1071 +torch/include/ATen/ops/_nested_view_from_buffer_copy_ops.h,sha256=6gOVL8uCBXcqdDQEnjx6pbx4_SObQOJynTYUmchtgCM,2602 +torch/include/ATen/ops/_nested_view_from_buffer_cpu_dispatch.h,sha256=e7ceC9-nz81ab_1M94rZ7gQ83lb_4PYaJQrtDUMF8NM,1115 +torch/include/ATen/ops/_nested_view_from_buffer_cuda_dispatch.h,sha256=f2_uDICO-lyeowLlPrMcuDSpcD_7lfw9GiGHVspRAvY,1117 +torch/include/ATen/ops/_nested_view_from_buffer_native.h,sha256=xcVJQ0tlPtCbDWUz19imi44lhiUATFYQqnPl1C9opMM,869 +torch/include/ATen/ops/_nested_view_from_buffer_ops.h,sha256=mllNPlMqcTLqD7VYxqcj2-_n4dQCsi3e2_TyXk_ekeQ,1614 +torch/include/ATen/ops/_nested_view_from_jagged.h,sha256=jGpDjGCyzKX7lZSoR2k9twaErWHKG_UmUelmdC59mY8,1412 +torch/include/ATen/ops/_nested_view_from_jagged_copy.h,sha256=5PKVqxpR0phy0hqTaz6r7NDYU_9wicNpwft955XQOMA,2766 +torch/include/ATen/ops/_nested_view_from_jagged_copy_compositeexplicitautograd_dispatch.h,sha256=nxeGBdLD0eBFPGs47rLbIZsmtB-Ptb9EuPvSBOcCSJs,1637 +torch/include/ATen/ops/_nested_view_from_jagged_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=H66majuS2tZvQ0vDy-u4HHkYYOCPMGuYI9LNBqjxZCQ,1321 +torch/include/ATen/ops/_nested_view_from_jagged_copy_native.h,sha256=EoGyqvr_SKMwNY-7zK1ZOwxz_CRNPJ0I8uUTU0-_kdU,1322 +torch/include/ATen/ops/_nested_view_from_jagged_copy_ops.h,sha256=l7B27SGFQ7hi_YY2PODLTIZnNof3nZhVCz-bj_rApkY,3404 +torch/include/ATen/ops/_nested_view_from_jagged_native.h,sha256=YX7OnfNb_sH0shOehK5IicUsmA-qqQcgPsV5l3mVxmc,701 +torch/include/ATen/ops/_nested_view_from_jagged_ops.h,sha256=7ycrxotUY_Rhl_IlCjJCGGSYECM3XttATzXAQJc09uM,2015 +torch/include/ATen/ops/_new_zeros_with_same_feature_meta.h,sha256=rUuKvtRGtNVF1Pcojnn4wn9SjIc30JwokSlfMnZOutY,1975 +torch/include/ATen/ops/_new_zeros_with_same_feature_meta_compositeexplicitautograd_dispatch.h,sha256=LvYBqDsjXLJfdUPb09UfeGsn3AzR7kSNtTnVF97ukDM,1455 +torch/include/ATen/ops/_new_zeros_with_same_feature_meta_native.h,sha256=i2z-RabMqYxD2n9LDP_kwRDO9QYeEmzuVhjVZ7FwzUU,1001 +torch/include/ATen/ops/_new_zeros_with_same_feature_meta_ops.h,sha256=8ecTKdf89mbrc_RhfjbulDfmUzGSPLCT1ksqdESu57M,2371 +torch/include/ATen/ops/_nnpack_available.h,sha256=xyFgaOoL7T7iYSUK9ZDTiOUkQGONPRbiPxdN5ghoR-w,925 +torch/include/ATen/ops/_nnpack_available_compositeimplicitautograd_dispatch.h,sha256=Tphib4l2bjkdURwD_DQJpIBI-wsuDmbXGgwvpepXAOo,1028 +torch/include/ATen/ops/_nnpack_available_native.h,sha256=AiclBa_2-YDBsNGvL_cot5PGeQBJ1gZSu5cvvC0mZdE,738 +torch/include/ATen/ops/_nnpack_available_ops.h,sha256=jKxk42AqFjk0uIZf4mhqfq8lrVbP20YU46StJWOIc1g,1181 +torch/include/ATen/ops/_nnpack_spatial_convolution.h,sha256=3i06P1w_IEVjis3ddm40luN428gFJdEKVDqr_K0p-Qk,6541 +torch/include/ATen/ops/_nnpack_spatial_convolution_compositeexplicitautograd_dispatch.h,sha256=uiEsBA3A0JlZxqZFnVMWKVUkAGHQSzR-G2l3vV5ML_E,2338 +torch/include/ATen/ops/_nnpack_spatial_convolution_native.h,sha256=YsKwno3vFOfrR4YqzjyUq-yW9vSR2qGuK60vHEA6KVU,1132 +torch/include/ATen/ops/_nnpack_spatial_convolution_ops.h,sha256=tqT05DrYBT7nRfK_pfgsw7awfLjqxC1nBIId-5oyl_g,2816 +torch/include/ATen/ops/_nnz.h,sha256=1nvYehVtzOuS4qoMLQsf1eHav9LQoRgRchgIDc6vzR4,787 +torch/include/ATen/ops/_nnz_native.h,sha256=pfNt03G7Kjwmth04Fqm46wwUU4WjD1BkHj7HBTlKJwY,819 +torch/include/ATen/ops/_nnz_ops.h,sha256=d36aBjwK_aqTBt0GgaooVfpaR-jZ4MI2_OlWe0qsetA,1227 +torch/include/ATen/ops/_pack_padded_sequence.h,sha256=aPFDUeWxxE7l0RtpzHvUQRQhC4sizFE8kkm_kV8PxWY,1998 +torch/include/ATen/ops/_pack_padded_sequence_backward.h,sha256=d1RxKkvYdcPKzrjoYfZc2Es04JkTTHKLiTUCLO2Nji4,2384 +torch/include/ATen/ops/_pack_padded_sequence_backward_compositeimplicitautograd_dispatch.h,sha256=4jTt3mzEXm5w-yiUNB6pYQ-Rbtp7NkUO5DQ6-e9Hm90,1316 +torch/include/ATen/ops/_pack_padded_sequence_backward_native.h,sha256=IS6TCDyygpDoX5k-KB9Abwl9TlSDB0HMZIPe3a2F5OA,869 +torch/include/ATen/ops/_pack_padded_sequence_backward_ops.h,sha256=FafDZ_wk_FlbFAyjrya4g_S8YzopZuU6RmhyE6Uqyw0,1587 +torch/include/ATen/ops/_pack_padded_sequence_compositeexplicitautograd_dispatch.h,sha256=wg7tfDb872scqsvbSTyZq-C0Q4iQ0gzStphZdymNLcc,1510 +torch/include/ATen/ops/_pack_padded_sequence_native.h,sha256=6029NHVrL4RJetw_opYHmBg0g31prheKY4DdY-00RME,1031 +torch/include/ATen/ops/_pack_padded_sequence_ops.h,sha256=DnK130zfO6tSBUtn2PXuqW6PB8FPC56JI6ERpcz15wM,2498 +torch/include/ATen/ops/_pad_circular.h,sha256=TPLPtuGaum4UwFKmWU0cVUoBRCyH0L07jPUDZn2wq6Y,1747 +torch/include/ATen/ops/_pad_circular_compositeimplicitautograd_dispatch.h,sha256=N0mvjFZumShcFaTVhYnFAepzlE9cp_HavtBDSuWXQ6E,1168 +torch/include/ATen/ops/_pad_circular_native.h,sha256=MmAt3vlIvWAG-hr7i5URUELlhP9RWrDbsfiL-1JaUjk,795 +torch/include/ATen/ops/_pad_circular_ops.h,sha256=a3HB85RqF68Q9f1ALHtxxc8OeQZayvWup_ZnY9hhvAc,1351 +torch/include/ATen/ops/_pad_enum.h,sha256=Fg2nC5nVo2iRjRqJb9qWO9daiAq2NhknXV8fOQIg4Xk,2053 +torch/include/ATen/ops/_pad_enum_compositeimplicitautograd_dispatch.h,sha256=tIkKTn4VIr4zeen8M7X8zPpJ_HvWM-ZxtkyLoyXbFLQ,1280 +torch/include/ATen/ops/_pad_enum_native.h,sha256=A03076QZjMRIixUV_5jegPWLG6rLmBa9SjjS1dDuu7I,851 +torch/include/ATen/ops/_pad_enum_ops.h,sha256=wke0-bU5fbyLbngJQc0VzPAa9JousVzkiGfrsBspvF4,1492 +torch/include/ATen/ops/_pad_packed_sequence.h,sha256=ewaUYflKA_YVn71fBZGTVy2GdnRhVUdYKk5wl1nfbDY,1257 +torch/include/ATen/ops/_pad_packed_sequence_compositeimplicitautograd_dispatch.h,sha256=Mxdkb8mixKRG2kzhb57DByUnivCNCJkLHoGTLmqegY8,1191 +torch/include/ATen/ops/_pad_packed_sequence_native.h,sha256=-XFQ6cYWDgkSCnGQ6q2s4ZD2LN9oZM47_bTHaT1j18c,901 +torch/include/ATen/ops/_pad_packed_sequence_ops.h,sha256=_SBAX4kNpszSkBgg01Q9DjqP2erCpvm_V3LX3VxlowI,1717 +torch/include/ATen/ops/_padded_dense_to_jagged_forward.h,sha256=6D3OuYaXWcp1OfMnWCEsMmCU-6PLAwOmEaAR3YnWFUM,2365 +torch/include/ATen/ops/_padded_dense_to_jagged_forward_cpu_dispatch.h,sha256=t6vwgOM1T2PGUSzNAmNcRnKez5rbhjKH25h09dxpzKA,1266 +torch/include/ATen/ops/_padded_dense_to_jagged_forward_cuda_dispatch.h,sha256=mf6hXozN6LSSqMHCkqAXb8BB_TpPOi3ydg_LhdZ77C4,1268 +torch/include/ATen/ops/_padded_dense_to_jagged_forward_native.h,sha256=Q21N2zfnncJ60eY6-VVU4xkkUWk9qaX3Bio5dYxmzlM,1024 +torch/include/ATen/ops/_padded_dense_to_jagged_forward_ops.h,sha256=88WVtzWOglL5msJlfpBMZeH7yWpnybYsqYNG6fii3j8,1533 +torch/include/ATen/ops/_pdist_backward.h,sha256=1g3qni_ebRZLYsOyHBdFG_uNmq4gr9-keJIeF13DCkQ,1755 +torch/include/ATen/ops/_pdist_backward_compositeexplicitautograd_dispatch.h,sha256=BRVJfsUAVvh1j1HJhRpcApsXfXpMWU9WQAaK-Jn1Occ,1290 +torch/include/ATen/ops/_pdist_backward_cpu_dispatch.h,sha256=V7BFrmMkjoB3yfgOZaaWa2q9NyJkW52-3Ofb-QajgJY,1072 +torch/include/ATen/ops/_pdist_backward_cuda_dispatch.h,sha256=lpymzZMtg4FZGqSZgsov4bjRpvl4NM6iog0dDdMZGWI,1074 +torch/include/ATen/ops/_pdist_backward_native.h,sha256=HUETPd4MiwLQMF8YPJcJBT5co4cguSR7ezfDiqaYJEs,975 +torch/include/ATen/ops/_pdist_backward_ops.h,sha256=iX3ucsJzdWDLFT8pR0rE8Iim4Nw2Bw0q1ZdqWz6Gqqw,2312 +torch/include/ATen/ops/_pdist_forward.h,sha256=UGxsAzdAC7XTtSUMUZL0-4v_zYgHQQmBB24_FvUmDNQ,1482 +torch/include/ATen/ops/_pdist_forward_compositeexplicitautograd_dispatch.h,sha256=-Jvw8L3Ey0_G2Lzl6OZE41zJHOMsYPd8FDM-SyuZogw,1188 +torch/include/ATen/ops/_pdist_forward_cpu_dispatch.h,sha256=dE9deKK0sFcwy9JFZ-nQ1O-jWD4y4Aj0xDhMffSAMWU,1022 +torch/include/ATen/ops/_pdist_forward_cuda_dispatch.h,sha256=N0GCtM4Sq_uGyv59uUX8wjUJO3lCwFdQAi7RZMc9I8U,1024 +torch/include/ATen/ops/_pdist_forward_native.h,sha256=mjgLtG46NS31O5-kz0-Y0jjhAgBDQOkPFu4_9NIskjg,873 +torch/include/ATen/ops/_pdist_forward_ops.h,sha256=V97tdUeNx7knzBQrDkg4N8IL6nIizgKVvGr1xbPY2QA,1972 +torch/include/ATen/ops/_pin_memory.h,sha256=tSfQK8JTO2qjLeecRM7XoKWLusHW9lTl2mjSilMgyP4,1601 +torch/include/ATen/ops/_pin_memory_compositeexplicitautograd_dispatch.h,sha256=A0aa4MQTggCXhhPJz6EOErZUeVDbP4EtYMiiKwjPe_g,1358 +torch/include/ATen/ops/_pin_memory_native.h,sha256=FmWjgJroZWmC4k03UUQrNtKauUxsZq1mw6t7M4KwGRg,1301 +torch/include/ATen/ops/_pin_memory_ops.h,sha256=bflhuppt4pWblrdrx3pCgrtMYdjMSZ6TULCNaWyiXY4,2120 +torch/include/ATen/ops/_prelu_kernel.h,sha256=l7_FF_P52-CA14JT-Xrz5mrBydrydXUxpDcfSujKO1c,1005 +torch/include/ATen/ops/_prelu_kernel_backward.h,sha256=FD8ZlEPDD5G3yHI7VHVjmvPHwpbIgfv0uw7YYTlOR1g,1141 +torch/include/ATen/ops/_prelu_kernel_backward_cpu_dispatch.h,sha256=lu4FQMPTZu9Q1otrscUb-gyJhwCxTMyGwk_2NKTuOXg,1102 +torch/include/ATen/ops/_prelu_kernel_backward_cuda_dispatch.h,sha256=fAxUnqC2m-mqH8xFdalu8PtNVYCbM8Jop6zUITvI7J0,1104 +torch/include/ATen/ops/_prelu_kernel_backward_native.h,sha256=hTgA-wplzgNsuVGB8KvEaVvSqC-TsSj1WLca5XCGS24,1010 +torch/include/ATen/ops/_prelu_kernel_backward_ops.h,sha256=L0OstDYJtGER4uwA1PWcY4oznaGU5LIs-kCo9Yi21XI,1571 +torch/include/ATen/ops/_prelu_kernel_cpu_dispatch.h,sha256=04OsQCK4Bjsnh5t6T9RSCWir1VHELNWsMg5xHtuuI8g,1036 +torch/include/ATen/ops/_prelu_kernel_cuda_dispatch.h,sha256=x3zZY-HOArhL3t3_Fis0eR5viciUHEbd8UzBz06tpS0,1038 +torch/include/ATen/ops/_prelu_kernel_native.h,sha256=u6pQY8WDxty93zkQHmcaiN4hmBg4diT2hxwLkJvkviA,981 +torch/include/ATen/ops/_prelu_kernel_ops.h,sha256=OyhQ4iEQ81xAaM021EVkOlY0ItfQgd6D0GSzmHFiWAI,1355 +torch/include/ATen/ops/_print.h,sha256=hAeYBuyQErmX-x_Pb1QiJ9_QAybmkWqztfidPpPO0LA,903 +torch/include/ATen/ops/_print_compositeexplicitautograd_dispatch.h,sha256=vPXYy-0TggCmQJss7zMHg1jwp-kgA1Ugf6RnK_0smD0,1035 +torch/include/ATen/ops/_print_native.h,sha256=eGsUrzXKJR3b4h4Fego4E_kP8N7w7nqgBIFob9FPJJs,745 +torch/include/ATen/ops/_print_ops.h,sha256=8lRZg_5YRAu-WNURT_vl6MB2wrF7RXGBAcpcKCyAONA,1205 +torch/include/ATen/ops/_propagate_xla_data.h,sha256=SprVz8Hr3iuIpiTKVTEFpiMr3wgsZpQQho_zH-LUuHI,1022 +torch/include/ATen/ops/_propagate_xla_data_compositeimplicitautograd_dispatch.h,sha256=4oyRZ5cbv1TDzX8hkMCofYzQF0Yy9oNn3h3QhO-2uXk,1081 +torch/include/ATen/ops/_propagate_xla_data_native.h,sha256=zJaO0-50a5_H0Azl78S9d5vHhdIyPUeEyZWR7B5BYZw,791 +torch/include/ATen/ops/_propagate_xla_data_ops.h,sha256=K_NLy3iZVrb8B8U6OuFQaCwDaYx7uoeUDonp2SV2FxQ,1354 +torch/include/ATen/ops/_remove_batch_dim.h,sha256=dA8KC9JuDTmi_Ssks3CjcF4ow-5-9JZFcOBBJDvUIlw,2013 +torch/include/ATen/ops/_remove_batch_dim_compositeimplicitautograd_dispatch.h,sha256=YBCffZfAbNN7W6HJmOmPTyzlDj4YGJOwX4UUsJn9JWs,1238 +torch/include/ATen/ops/_remove_batch_dim_native.h,sha256=fnok0haI04G2_9YOQk6f7pVFA36Ga1nZEQon9z6ODJs,819 +torch/include/ATen/ops/_remove_batch_dim_ops.h,sha256=DbSa1ZcyYhQq88jwLBy-kaFaGseAEmqiMjzdrt1QDQk,1464 +torch/include/ATen/ops/_reshape_alias.h,sha256=8wCd0o9-x90QWWiJjR4VVDFQcX6emGQGNpxrE5Evz2U,2002 +torch/include/ATen/ops/_reshape_alias_copy.h,sha256=8-Z60cpjY5EAYyKU4fnPkjUy7A_QzKyvLmCxfu8Zb6Y,4911 +torch/include/ATen/ops/_reshape_alias_copy_compositeexplicitautograd_dispatch.h,sha256=Zp-FclQot6OUWYiNQrPjBFJJFajoZSH3hGU84aL8qVw,1575 +torch/include/ATen/ops/_reshape_alias_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=dIRTCAzQuLfv-7Ec9Z7V0ZuwkPKQtvYrU06pDSeT1sc,1260 +torch/include/ATen/ops/_reshape_alias_copy_native.h,sha256=Acm8MXwzjCK1nYWmhZLw4vqZRf7TiT5GbQhU0yiwa6A,983 +torch/include/ATen/ops/_reshape_alias_copy_ops.h,sha256=O0L0tkpiAhtDkd-hH6hbqs7AfbWdzFTdhIOVOuL9g9o,2288 +torch/include/ATen/ops/_reshape_alias_cpu_dispatch.h,sha256=ylsccM2CwJWl6Yj-TFXbr_SBoZgq3gUSByji4Z7iv1M,1180 +torch/include/ATen/ops/_reshape_alias_cuda_dispatch.h,sha256=dkRv-s93K384nxbtOgh2NblNdQsfcCPr-ItpN_-v4yk,1182 +torch/include/ATen/ops/_reshape_alias_meta_dispatch.h,sha256=moTNJlSkUJFsMlVBISyP-xeg7-BRbiJJMzfDJyv1lOo,1182 +torch/include/ATen/ops/_reshape_alias_native.h,sha256=QzzJzA9JZCwBQ1URxDg7eeBRX_YeD53gERFuzem-Wkw,810 +torch/include/ATen/ops/_reshape_alias_ops.h,sha256=BDITHySWTAQFMWFhKyOSt3QOF_qWPulmvPmseUmwhF8,1457 +torch/include/ATen/ops/_reshape_copy.h,sha256=a5hliNUuuDhP7JTBSGbcBEPMlCwnusZMmMR8oSU7hKY,1757 +torch/include/ATen/ops/_reshape_copy_compositeexplicitautograd_dispatch.h,sha256=5i9uYidPctUYsLhg_TQOU6Yhkc_FwRIB0xBmWX0_Yu8,1170 +torch/include/ATen/ops/_reshape_copy_native.h,sha256=yLXUep3zpmxgurbMaGbWydrFpb9TQ2cn1HE_xsrVNGQ,796 +torch/include/ATen/ops/_reshape_copy_ops.h,sha256=KM1wymxWSvfS-bGAWptUEFNaMDy6h5VamzEMvkWU7vs,1354 +torch/include/ATen/ops/_reshape_from_tensor.h,sha256=SCDn7x0PGaR2cMLbPRncIw_pOsP8kzZTV5K5jN3Ursk,1030 +torch/include/ATen/ops/_reshape_from_tensor_compositeimplicitautograd_dispatch.h,sha256=pCWU8-0HFzRLb4ZxGlrTS69Q8eWPcBHRbLZZD-E_mZE,1086 +torch/include/ATen/ops/_reshape_from_tensor_native.h,sha256=a-hK8Bn3QwVuPXb1_3GENjQMEGVPLPRFjPWC4fg9dqE,796 +torch/include/ATen/ops/_reshape_from_tensor_ops.h,sha256=c7Y428XvuUiLVaTQBNNd-qXvtKvxaC8wVNeAnwEcm8A,1373 +torch/include/ATen/ops/_resize_output.h,sha256=0RR5c0lOxwsSCln-Bm2UbrwoSjYWyH6cDqUqAQ-Ek9U,5769 +torch/include/ATen/ops/_resize_output_compositeexplicitautograd_dispatch.h,sha256=OotFHV6GlEImWid_GkXT5wntzuWlGUgCV6FY808LCVU,1794 +torch/include/ATen/ops/_resize_output_meta_dispatch.h,sha256=3BNGZ1CFkmr28-5kmdOW4s8lJBWTCDUlIJsj9TEyuDs,1186 +torch/include/ATen/ops/_resize_output_native.h,sha256=UysGakxd-joevnnWaG8uz3WnKtOofq3DHWEoo_TSD8E,1080 +torch/include/ATen/ops/_resize_output_ops.h,sha256=RLjPB9jJ-C4gkZlpIQvoBNHZcr0bb_5X3ifoNlL8OoA,2959 +torch/include/ATen/ops/_rowwise_prune.h,sha256=yT1nIkBGx07FJ-lWVUFKmGcIVvfFY1QQP8UFxUtDpy4,1148 +torch/include/ATen/ops/_rowwise_prune_compositeimplicitautograd_dispatch.h,sha256=0uJpDPjITcdHWUzmZfqCjT0UXPQ9ZNnC9aehIm6cKI0,1147 +torch/include/ATen/ops/_rowwise_prune_native.h,sha256=0-A1Mz6Wtst9g3nuH5oJNqNJaHvnBxRnAi9NdX8Xu9c,857 +torch/include/ATen/ops/_rowwise_prune_ops.h,sha256=-0JKQhFzGXMJLpIAhNETEF4SMLChbme7BARqJglW9UU,1578 +torch/include/ATen/ops/_safe_softmax.h,sha256=3fOV2LxbdQjW68W-nVcXw48ninJd4i8OOm9aOHr7B7Q,1067 +torch/include/ATen/ops/_safe_softmax_compositeexplicitautograd_dispatch.h,sha256=QgxdhhdQoirzUNukFybNVYQP8svIMGAzQFC0J_7saSo,1120 +torch/include/ATen/ops/_safe_softmax_native.h,sha256=P1q70dU5KNCtWwcboSrAJsHUYn28oZFqz8R7TmTMMqE,830 +torch/include/ATen/ops/_safe_softmax_ops.h,sha256=FaWmxHaqNNoThuKjLVRVzd0H5_T3SlD2Bdr9rWyCVfQ,1445 +torch/include/ATen/ops/_sample_dirichlet.h,sha256=5qnYcOclJKdyFU8gRKymcRAknkfbYBjRibAxQnuxLb0,1706 +torch/include/ATen/ops/_sample_dirichlet_compositeexplicitautograd_dispatch.h,sha256=G9-ougEmJx1_Am2U-M9AXFBe-a1JzFfGA3b7tSYMZuM,1271 +torch/include/ATen/ops/_sample_dirichlet_cpu_dispatch.h,sha256=l5vHaNR41r1Xbb1ANwExC1tXPM9Wbewf8GZZtJSQkbk,1070 +torch/include/ATen/ops/_sample_dirichlet_cuda_dispatch.h,sha256=8GtFcOJHHRN0Y-5l_V9M07-pmYTCWLD5q4c_OOisjdw,1072 +torch/include/ATen/ops/_sample_dirichlet_native.h,sha256=cZlO4na9kC7AhRUyWMVo3OIZi15pjwErSdAaddqyuNQ,1078 +torch/include/ATen/ops/_sample_dirichlet_ops.h,sha256=4w60fyIU6sKUEEQVwjgU56_TZUCfFZiESu4lFgwy1f0,2198 +torch/include/ATen/ops/_saturate_weight_to_fp16.h,sha256=ywUwpaqXGVH0Rv3xf3vRec2-dZCJpgIynFbMF1ZauRk,1005 +torch/include/ATen/ops/_saturate_weight_to_fp16_compositeimplicitautograd_dispatch.h,sha256=KBpWjwLK1MVxTxerRe440eHd_iBgLibnwTXMjpPK84g,1066 +torch/include/ATen/ops/_saturate_weight_to_fp16_native.h,sha256=RzfgLBOBTTqvLnSpaeVIiyRc4LAUJp5JEqGW6epplGk,776 +torch/include/ATen/ops/_saturate_weight_to_fp16_ops.h,sha256=IcomQF3vpA61FGcTtj6GzRIHiB4FsmlBNnh1OAJnVKY,1305 +torch/include/ATen/ops/_scaled_dot_product_attention_math.h,sha256=kYJMrqpjP4z5wEw-1Xpw6pVgT3_nsoWPm1CVW6S519Y,1586 +torch/include/ATen/ops/_scaled_dot_product_attention_math_compositeimplicitautograd_dispatch.h,sha256=CIpv1yHLGhQsQYwE5qyNzuxjZ92WPyzub-r_HFJxj-A,1366 +torch/include/ATen/ops/_scaled_dot_product_attention_math_for_mps.h,sha256=xkKd7t1vxBs4IrJImCsSMv9ivOEb2X1lHzH6KpCWzFg,1560 +torch/include/ATen/ops/_scaled_dot_product_attention_math_for_mps_native.h,sha256=YX7OnfNb_sH0shOehK5IicUsmA-qqQcgPsV5l3mVxmc,701 +torch/include/ATen/ops/_scaled_dot_product_attention_math_for_mps_ops.h,sha256=emWfAUEnY2oXocXv08bVmOumB0U-QSIIRbpO5nfb1Dw,2160 +torch/include/ATen/ops/_scaled_dot_product_attention_math_native.h,sha256=DttSUHhDzEzL0TLKh4SGmdTzSKr9twkDUv_CMKG0j7U,1076 +torch/include/ATen/ops/_scaled_dot_product_attention_math_ops.h,sha256=R-o96shQO-KZVM3KBks6MmHx1Ip0mx_lXYLrNqFxE6Y,2199 +torch/include/ATen/ops/_scaled_dot_product_cudnn_attention.h,sha256=Zls5KgojDwZKUY64QOrmvhpsnhHY1kAaYjk6NZEu5FY,1805 +torch/include/ATen/ops/_scaled_dot_product_cudnn_attention_backward.h,sha256=2fVJ-vjshMwG7uLEBxsXxUX15L68ZSZcaYvVsqQ-Olo,4770 +torch/include/ATen/ops/_scaled_dot_product_cudnn_attention_backward_cuda_dispatch.h,sha256=Adx9gv52eA08fqy6lIDmw5UNVtTpeuINcbBqKUyHrfM,2022 +torch/include/ATen/ops/_scaled_dot_product_cudnn_attention_backward_native.h,sha256=ItPoUSuylhP5XzbbZvy7x2o_lxlKAXiZt6Ci3mOeY7U,1782 +torch/include/ATen/ops/_scaled_dot_product_cudnn_attention_backward_ops.h,sha256=udfhfymiw6lkjkxo38RortNtE_802P63KFzS4FyF32U,2789 +torch/include/ATen/ops/_scaled_dot_product_cudnn_attention_cuda_dispatch.h,sha256=ocZynhrUMs4Zu3FzCYkAaeqMqtnEg4UG09BDNLFyXbc,1380 +torch/include/ATen/ops/_scaled_dot_product_cudnn_attention_native.h,sha256=WRskP4UNT5E9CxTMRqh-Oa7DIObSVVeYeF9RiakZPus,1586 +torch/include/ATen/ops/_scaled_dot_product_cudnn_attention_ops.h,sha256=xQeTTQRuKjbYI2FXSiIE43TcelGOEQpRCZxMibSo-sQ,2519 +torch/include/ATen/ops/_scaled_dot_product_efficient_attention.h,sha256=GAazZhD6lyTdID_2KbvCIg0fzk4xj3Em9fnkJt2OLOM,1598 +torch/include/ATen/ops/_scaled_dot_product_efficient_attention_backward.h,sha256=36OTLI6O9tr83C4YRPhjJzHOyW6kc0mjA13A9puvjqY,1869 +torch/include/ATen/ops/_scaled_dot_product_efficient_attention_backward_cuda_dispatch.h,sha256=hgFTR_SWX_Li3od2nxFfIdNSfm-3P3W4WLgg9LeF0BI,1448 +torch/include/ATen/ops/_scaled_dot_product_efficient_attention_backward_native.h,sha256=VhL6ILLxrZ6xTj-EIsSkOgmqJcE82tNCGTlTYOUjaBU,1205 +torch/include/ATen/ops/_scaled_dot_product_efficient_attention_backward_ops.h,sha256=GM67bCy7sEYOiLF4M22fLOguDEc89JzskYSGJZtvnnY,2648 +torch/include/ATen/ops/_scaled_dot_product_efficient_attention_cuda_dispatch.h,sha256=l50sPAdpHUWUP-3r_LducSDerh0HV0aE8X9xdVF0Rgg,1297 +torch/include/ATen/ops/_scaled_dot_product_efficient_attention_native.h,sha256=Lo5rm9yiPO5TZzz9iDXnRlOYldr6SXh3OvFAzRgh4-c,1420 +torch/include/ATen/ops/_scaled_dot_product_efficient_attention_ops.h,sha256=jKV1uvgAIwlgjEP2HQ3ZAU9nhCvBroSiXk4ae2-hzZk,2189 +torch/include/ATen/ops/_scaled_dot_product_flash_attention.h,sha256=XG4fGey9WbBMv1pgY58C8UMYp_U3j-gEZjo_6jmAGXM,1649 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_backward.h,sha256=eTVn_eLtDajSmerO-TjL1lGv2yrYxrtsxx7iw6K_UZM,4632 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_backward_cuda_dispatch.h,sha256=OD0Xr3XaY9Tkl2NHdjvyJO2jIOSSqO9sLULNPQ-1lsg,1962 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_backward_native.h,sha256=aco_z7S2X8GGEO-sQq93ZXsDuCmkkFEswMT2QF-kh4c,1711 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_backward_ops.h,sha256=DuXiAXAB9d94cUJ4cGOHaQYGvqI-HfGv2PyVn44ny4g,2722 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_cuda_dispatch.h,sha256=HircyNLWNyZeahe9To8r5uaOxWVy_VK7V9924-_kj0o,1308 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_for_cpu.h,sha256=_S8XWGgN6SMwkX0vVdowvX13GalZjP7F4UpNb0t8q9s,1487 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_for_cpu_backward.h,sha256=gybJekzih-7L03W2nhXHgVX3gJaqgQgxFTmnismht-0,1692 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_for_cpu_backward_cpu_dispatch.h,sha256=Q7aTpG1gQrCgF0B3HXsq0zW_8sIvPXRwqNCz5nuf3nM,1348 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_for_cpu_backward_native.h,sha256=aYoxUw7YD_6Uh4fnI9b6yjZ0VRzfwtawi-UsVegudzI,1098 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_for_cpu_backward_ops.h,sha256=YBBBLLvhoMVP07M1vj_FueYZNESOMpUF4qKDPUAhjK8,2361 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_for_cpu_cpu_dispatch.h,sha256=PopjMsWYCEwE4f1pZ2yuwf0olo1Fw3CcZz11_fBwELU,1255 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_for_cpu_native.h,sha256=NCy1UTZhR-1awMPFoXTef3D0eNYtImriIHJR5nIJ63k,1005 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_for_cpu_ops.h,sha256=VI2jSHwVXEcKM1-UQuSu1puehP5pdcQMVEXu2YEdRwU,2016 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_native.h,sha256=m_Ha4GUBePMxPxua_OeJdSYfx4Xe4T-I9xAZN-cvn3A,1442 +torch/include/ATen/ops/_scaled_dot_product_flash_attention_ops.h,sha256=iHpVtq-WENCCB8lTsKyAfJKmGj-Xx0_nV8xKJ7ySLLo,2279 +torch/include/ATen/ops/_scaled_dot_product_fused_attention_overrideable.h,sha256=rTHYpiTGOfaTj5Y9o2OFRdyb1FynOPgGzfSNy8L1cew,1795 +torch/include/ATen/ops/_scaled_dot_product_fused_attention_overrideable_backward.h,sha256=0dSD5FVX5KgcMVUP_G_XJIA_E2xdJwmcbYJslNhZdQQ,5335 +torch/include/ATen/ops/_scaled_dot_product_fused_attention_overrideable_backward_compositeexplicitautograd_dispatch.h,sha256=UtssOV2gEcwFoz65rV-CCZOeRvCbtxZnRYW9g-MimGA,2188 +torch/include/ATen/ops/_scaled_dot_product_fused_attention_overrideable_backward_native.h,sha256=rUtPNDZ0BNw4jjyFLo9SyiTFueVvhsf7DKlhm47T3ek,1292 +torch/include/ATen/ops/_scaled_dot_product_fused_attention_overrideable_backward_ops.h,sha256=vVvJ_Y7XCWvqSol-pd7rozXtWqiAcOYWobOnh3-biKM,3038 +torch/include/ATen/ops/_scaled_dot_product_fused_attention_overrideable_compositeexplicitautograd_dispatch.h,sha256=fskvPXY0vOTfBNdSP4-tbM4V-v4RD5SJsTfVqiCL8tA,1413 +torch/include/ATen/ops/_scaled_dot_product_fused_attention_overrideable_native.h,sha256=wGn06GiLcuQdzePLjXTnaIjMgrH7BwXP9WT5sX9Rn3w,1123 +torch/include/ATen/ops/_scaled_dot_product_fused_attention_overrideable_ops.h,sha256=L2ElSuzbQkMjIxtZM9rRX3Eu9esWhMtW20LPGDSagig,2482 +torch/include/ATen/ops/_scaled_grouped_mm.h,sha256=vPn5fv9PGy_ZCag4gjgXWwToEofKUpSVzS3xJ77Hgao,1526 +torch/include/ATen/ops/_scaled_grouped_mm_cuda_dispatch.h,sha256=LtqV7Owmh-7YNt3MmO1V0_yfQPig-IojRHko-DIzMFI,1325 +torch/include/ATen/ops/_scaled_grouped_mm_native.h,sha256=rvhvPta90Xf8_nBj2z-yJD82FblMWhHNZQ-tGHP4w_g,1082 +torch/include/ATen/ops/_scaled_grouped_mm_ops.h,sha256=Jm4e3_n2SSrfX33nxX9zYI4NGpv1Y_mqGKIUe-hJHBw,2214 +torch/include/ATen/ops/_scaled_grouped_mm_v2.h,sha256=m3xsDB5nInGs0uw5TkM9Skb8_mB0yq7Scf9R_s2TjmQ,1733 +torch/include/ATen/ops/_scaled_grouped_mm_v2_cuda_dispatch.h,sha256=5karN4GoldXgFlRGkJENu7J4RwggttIbqJM2ejML0IA,1409 +torch/include/ATen/ops/_scaled_grouped_mm_v2_native.h,sha256=BIuCH73okiAP6yxMUG2F56imkHecJU0VdXtPsCNTFAg,1166 +torch/include/ATen/ops/_scaled_grouped_mm_v2_ops.h,sha256=ZYwgBA93p0Y3YLvc0A-c-5yWWnGMkaOMkxd-AZAixEo,2494 +torch/include/ATen/ops/_scaled_mm.h,sha256=qQAEkerGYrvYlY1x9xW4dF8M5D2OBaLUiX84BCriGIs,2782 +torch/include/ATen/ops/_scaled_mm_cpu_dispatch.h,sha256=4Jb-gBpWS7TwRZZ55mXncOLyaAl6Fe5IemeDr7LsH44,1938 +torch/include/ATen/ops/_scaled_mm_cuda_dispatch.h,sha256=RDRG5PdaEdk3HBrFQpbccPzlFXJeAK7ftQ6vF0cfbd8,1940 +torch/include/ATen/ops/_scaled_mm_native.h,sha256=-2C-mbvzopfM1HTRbruR_sQYHDhSk-Sq2bcgAzzYiKA,2005 +torch/include/ATen/ops/_scaled_mm_ops.h,sha256=63yiP52bMJSymEJOmWLwulYfPIueTxoAX2D3RSv163Q,3456 +torch/include/ATen/ops/_scaled_mm_v2.h,sha256=H6K7dQ-XQB5m7jwMrXDyfAeokZC0n--e-xh8_79Ehww,3331 +torch/include/ATen/ops/_scaled_mm_v2_cuda_dispatch.h,sha256=F7PaGNVTznlJ7cREUpMDD7muueKwG3RzRLJ4BG1pFDo,2156 +torch/include/ATen/ops/_scaled_mm_v2_native.h,sha256=yLY5T5i9sfiB0K5FaCk031--gEcHIgoZBrCFiMV_dZo,1504 +torch/include/ATen/ops/_scaled_mm_v2_ops.h,sha256=9Jgp3mj20HttDuIPGmvQm9VNFmpRjXdLhDnRCAthD4Q,3996 +torch/include/ATen/ops/_segment_reduce_backward.h,sha256=m0R0jwosLB65YLMkp4tE1Wp0cDPcTdIjJogUAsAnUjk,2752 +torch/include/ATen/ops/_segment_reduce_backward_compositeexplicitautograd_dispatch.h,sha256=dvpj5FkKwE6n5RAZLMRlbvS3gBeo5Q4rZsZBPPNebgs,1661 +torch/include/ATen/ops/_segment_reduce_backward_cpu_dispatch.h,sha256=x3bzDt_kRHEBE_g1OHyaah-PcLoWmxAoHD1AXQBqfNg,1269 +torch/include/ATen/ops/_segment_reduce_backward_cuda_dispatch.h,sha256=n7escoka1YmcsvejKPo7ccmbOCol_DUvxoxXyKjydFg,1271 +torch/include/ATen/ops/_segment_reduce_backward_native.h,sha256=MuN3s5prYlO_1gHjBUfkBPI15xMkctZnvjrI7BIv7Lo,1353 +torch/include/ATen/ops/_segment_reduce_backward_ops.h,sha256=0XM_5ROv9OvxLBoUVCdpZ5fytHHOfKZ1RZH3wIfIB6U,3453 +torch/include/ATen/ops/_shape_as_tensor.h,sha256=kWSRg4_bSmkW6fStv9Z7bHHGb3dGHUS6xw7pFvNeKDg,967 +torch/include/ATen/ops/_shape_as_tensor_compositeimplicitautograd_dispatch.h,sha256=d7j-SDUy00ShwxYH6VpUJp20oNO8-QwwYO7SolCkCLw,1056 +torch/include/ATen/ops/_shape_as_tensor_native.h,sha256=5Ke29_PVSEWBBNY-YKpFs7_E3JzgK0qaFOGESDgBLy0,766 +torch/include/ATen/ops/_shape_as_tensor_ops.h,sha256=3lcvxz37YQWdEw5s-IHr_Cw-jBtOWy_t_0QHHVHJ24s,1275 +torch/include/ATen/ops/_slow_conv2d_backward.h,sha256=25ZAqAW1aHByEckDZifDMYC-X92ztybi0VlH0lY4e4o,14925 +torch/include/ATen/ops/_slow_conv2d_backward_compositeexplicitautograd_dispatch.h,sha256=HzG3zMutYko7GWk_VHilyz1fkq-tOka_FMG2KmSpHdg,2407 +torch/include/ATen/ops/_slow_conv2d_backward_cpu_dispatch.h,sha256=usTdz7mhrTtQ8tUiqxjGAhAVLNJUNya91z-bZ8h4Fr4,2872 +torch/include/ATen/ops/_slow_conv2d_backward_cuda_dispatch.h,sha256=hUU4llKjRUa2j6BjLIiJxuHVJPTY3s6yfRHn51aZ_GU,2874 +torch/include/ATen/ops/_slow_conv2d_backward_native.h,sha256=N2k9rH-3eA_kdYV20C1kWOyK0mPOfVhXwqujojZGXb0,2300 +torch/include/ATen/ops/_slow_conv2d_backward_ops.h,sha256=QN-r0Gz_CUmONf0fNjKVkoMuE1bFX-Q3ckWkEFWsM1E,5171 +torch/include/ATen/ops/_slow_conv2d_forward.h,sha256=dx5eIGXrxjtOhVyUW57lZl0ZRHxeJZUEHQ5_mey_ynA,7132 +torch/include/ATen/ops/_slow_conv2d_forward_cpu_dispatch.h,sha256=Dfc7ah0zkYVnxCTkDQY580HoUAl2DS86TF8BHK4o9R0,2410 +torch/include/ATen/ops/_slow_conv2d_forward_cuda_dispatch.h,sha256=ZvPRm32YjAb1Kg7JSITxcoqhQjEL4Zb9H6gV107ezBw,2412 +torch/include/ATen/ops/_slow_conv2d_forward_native.h,sha256=uan9quymVKhtIV_DL08LRjBFNXoTE9__6tedW76I7Cw,1633 +torch/include/ATen/ops/_slow_conv2d_forward_ops.h,sha256=L0Cxi3kgNjUjYfPMO-vS_zdISofTmXYVi8qmduB9rBg,3002 +torch/include/ATen/ops/_sobol_engine_draw.h,sha256=IYJjeqtkfT-g7JdTI9YJNvbzxW9uCH2I6l9kHdyQdRc,1263 +torch/include/ATen/ops/_sobol_engine_draw_compositeimplicitautograd_dispatch.h,sha256=sxiwslGyR_3ZDCnasW6v2pvvOt74tYS_PNPNmf5LPTw,1207 +torch/include/ATen/ops/_sobol_engine_draw_native.h,sha256=uIqIU9wcUELSlNZZrVK3on0tkWeHNhbLIVwUP6VVQYw,917 +torch/include/ATen/ops/_sobol_engine_draw_ops.h,sha256=VInkvtP3cLknNAvJHDF6ls14ls_4b45SzQCCks2hHBE,1774 +torch/include/ATen/ops/_sobol_engine_ff.h,sha256=F6-ArAyssByiV1COXiH6r6GFURGUtr19SNNVr4SDMgg,1159 +torch/include/ATen/ops/_sobol_engine_ff_compositeimplicitautograd_dispatch.h,sha256=_bo78snmJjFMtuPIvAVMzxYP7ehAR3y6UMz62MQ1OjM,1137 +torch/include/ATen/ops/_sobol_engine_ff_native.h,sha256=aJ5VhSLtdcSx0iU4-ncTM9n-f4MjoTBe1dO7BcDds4U,847 +torch/include/ATen/ops/_sobol_engine_ff_ops.h,sha256=eX5tT8wIAmyQqILvqXeiHnhHd48Ot6JGhJYckAF8rT8,1549 +torch/include/ATen/ops/_sobol_engine_initialize_state.h,sha256=5O4rSeVi3R45V0TCYb1aBPeCmB2MgwgsJB_hpFcitnA,1075 +torch/include/ATen/ops/_sobol_engine_initialize_state_compositeimplicitautograd_dispatch.h,sha256=PvKOEzYFX6ygYzDYPsBWzbJ1372n_XnBW_HZveE2wgY,1086 +torch/include/ATen/ops/_sobol_engine_initialize_state_native.h,sha256=KY46XVlYsAnbWlR72RNIUrZwnl-W2O0uROD7DEBOIIY,796 +torch/include/ATen/ops/_sobol_engine_initialize_state_ops.h,sha256=tE1z53ACWds4UK5j4YhnmCwtkmiPfkZ1WN3DsKngz9o,1378 +torch/include/ATen/ops/_sobol_engine_scramble.h,sha256=b-FGQhi1OaENUUGhvwZCNWrrmYrVLfjKqwjQJ9nPuwc,1084 +torch/include/ATen/ops/_sobol_engine_scramble_compositeimplicitautograd_dispatch.h,sha256=SFHNaPtvWyyM20AM1uiAw9BLFVzzq4NA6GYShDFVaHA,1102 +torch/include/ATen/ops/_sobol_engine_scramble_native.h,sha256=SNwGs2xA2wo0e8KIaA5nIU5nneGCgiq2Kq5VuwESdBI,812 +torch/include/ATen/ops/_sobol_engine_scramble_ops.h,sha256=iEh0ynJDnMyLJC4iGEAY-w7-jV2hTLDJrb7xG_OzoO0,1434 +torch/include/ATen/ops/_softmax.h,sha256=XfHO_yQ-L7FyooXy0LtawpDGLpwPNIx6Hw8L37fG854,1592 +torch/include/ATen/ops/_softmax_backward_data.h,sha256=BlAP1B-7P-CrnDqE7EtGIew8XUcHIefcKkGcdCfZeVw,2017 +torch/include/ATen/ops/_softmax_backward_data_compositeexplicitautogradnonfunctional_dispatch.h,sha256=plN1fyYQ_G8pau2-iWqyCpnpafFaAUA-Wwh6u2jcrzA,1163 +torch/include/ATen/ops/_softmax_backward_data_cpu_dispatch.h,sha256=X47sjlJxNJNEx1joOzy5bl-Ig-AWvU_PS7cHqoddFAI,1448 +torch/include/ATen/ops/_softmax_backward_data_cuda_dispatch.h,sha256=3r6IBNMVoXtT0bQ6ABrO4jylr3D1-Uma3Q4kyz8zxjE,1450 +torch/include/ATen/ops/_softmax_backward_data_meta.h,sha256=asswDVFGnRj52JaPwS8ooNlM9w7jx3BtAGI07eQWTPM,944 +torch/include/ATen/ops/_softmax_backward_data_meta_dispatch.h,sha256=qv7VS92aTrr2BcRHxZVMkAhoxPgpHvoGra8QnLNq4OE,1450 +torch/include/ATen/ops/_softmax_backward_data_native.h,sha256=N5VYMty14thUOJrQIXow3YczyPFRSneCSrtqPZTYt4I,1410 +torch/include/ATen/ops/_softmax_backward_data_ops.h,sha256=JZr-ek4VwdgB-uhJ7m22z0WGITKnzUAute8s5AJlrqc,2463 +torch/include/ATen/ops/_softmax_compositeexplicitautogradnonfunctional_dispatch.h,sha256=JP8610KXynfXdxe93xRl4JHck5Y6WCyUJZqOTmaJer4,1107 +torch/include/ATen/ops/_softmax_cpu_dispatch.h,sha256=tqjdjYg_WW-o2Wv6JSZbdDjpE5cjswAUFuSj712f75c,1266 +torch/include/ATen/ops/_softmax_cuda_dispatch.h,sha256=F23mvjqCZTee-bzxgkS1Vt05BYDhQpZ6r2fAy41pnNA,1268 +torch/include/ATen/ops/_softmax_meta.h,sha256=DnoTlJqRqTzbt9vo0y49fPFoR8KeZF0X_S-BpS1kwFY,888 +torch/include/ATen/ops/_softmax_meta_dispatch.h,sha256=8qMQOHgAibdjZll-r8jqaBEka6AAO5Ppr5xi6j9L5z4,1268 +torch/include/ATen/ops/_softmax_native.h,sha256=s64iUXSxwcdQLnNIUNN_x1nwfr9MA_ziT1ISL8NQPCY,1297 +torch/include/ATen/ops/_softmax_ops.h,sha256=WFUoevvXlkjStOMIs1fVG-A8vLV1omTkW_UlyQpWYpk,2078 +torch/include/ATen/ops/_sparse_addmm.h,sha256=yvVLKR_0tm-Iz9f7IZ5QBRUHaBOd9AUR0X70DrAUXDM,1956 +torch/include/ATen/ops/_sparse_addmm_compositeexplicitautograd_dispatch.h,sha256=SUig2F5I7pmclamRhMoMgSNbU-aC7CdbNaqBr9rcizI,1537 +torch/include/ATen/ops/_sparse_addmm_native.h,sha256=xivAKjcl0Oiuh9qx6gAKL6Tk1sYNL-Ztn1-l9eF_QOg,1055 +torch/include/ATen/ops/_sparse_addmm_ops.h,sha256=3Gc8TkXOY8fDAACZOlG0bxhcFt8_goXzK9TQ7hrkpqw,2569 +torch/include/ATen/ops/_sparse_broadcast_to.h,sha256=vVu8zjowvSEEYDZ0fnIzQGDT07s4u7IfTbpl6aKETFI,1029 +torch/include/ATen/ops/_sparse_broadcast_to_copy.h,sha256=BRM5uJanHtXc8--qJZNShMihawhN1BDDgGvq_vx8-NU,1636 +torch/include/ATen/ops/_sparse_broadcast_to_copy_compositeexplicitautograd_dispatch.h,sha256=BALTQM9uFH6LPPk9SDYvcHL9mQn7JJkOA9qqxqvJa7E,1232 +torch/include/ATen/ops/_sparse_broadcast_to_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=jlp1mNWQlI-INM8eUcUehRnwlfSbWc_H9mG0dyCEsBQ,1113 +torch/include/ATen/ops/_sparse_broadcast_to_copy_native.h,sha256=_nmHAglroD00bs0FLny2KN4sEUjw_4HGFRciohjdOQI,917 +torch/include/ATen/ops/_sparse_broadcast_to_copy_ops.h,sha256=Bi5JxhRj_EJ8nPbWIXR8nzvJaGe0jaAe86KdRjIcuO0,2106 +torch/include/ATen/ops/_sparse_broadcast_to_native.h,sha256=GJuAai-KCMV-cIWjrmKUWpVj9Tt8TFq_CeUiOQAb7pk,791 +torch/include/ATen/ops/_sparse_broadcast_to_ops.h,sha256=B8zMbc6O2G8847sq8mwWFkTwF8fMnWHPCp6cIrLtxrY,1366 +torch/include/ATen/ops/_sparse_bsc_tensor_unsafe.h,sha256=GflskGtqSkhL8GOHzzWRumDJbueA7rOCWpeyUubrJ84,2074 +torch/include/ATen/ops/_sparse_bsc_tensor_unsafe_compositeimplicitautograd_dispatch.h,sha256=hNHyKZf0kWhTvlgwHZCufjgsseIpsGmTp_rHqC5eD4c,1492 +torch/include/ATen/ops/_sparse_bsc_tensor_unsafe_native.h,sha256=L3dNYBBBl2lpxHxlpK0DYilipew6kNJN7YFR6r0EhI8,1021 +torch/include/ATen/ops/_sparse_bsc_tensor_unsafe_ops.h,sha256=5viztqsVAZCJvfCCaaXKCWICkEC6bwfZSmLSh6iO3NQ,2088 +torch/include/ATen/ops/_sparse_bsr_tensor_unsafe.h,sha256=GXSymV9J5HEnEITrMytcumGlf5A4s1LuoYxzQ_2tkq0,2074 +torch/include/ATen/ops/_sparse_bsr_tensor_unsafe_compositeimplicitautograd_dispatch.h,sha256=119wPXClyP8vckFaeAUqdS5NSyaPoh3zKjOzmRt7OMc,1492 +torch/include/ATen/ops/_sparse_bsr_tensor_unsafe_native.h,sha256=v73jWl1feiGtXVezg51FJV96engf1DPzJq2jJQHm2QY,1021 +torch/include/ATen/ops/_sparse_bsr_tensor_unsafe_ops.h,sha256=cSxbY1HLPU9l0ZEINC-r9Poww5nC4WZum08U4AGZlPo,2088 +torch/include/ATen/ops/_sparse_compressed_tensor_unsafe.h,sha256=R-Muj4yu2QWpocxAUkg0Chnl7vgitBrJ6VYUpcllr7o,5923 +torch/include/ATen/ops/_sparse_compressed_tensor_unsafe_compositeimplicitautograd_dispatch.h,sha256=0Ak2V3SEFpJBzdO5NLlGmvoi5eDv5JVpR1HboK7SkQg,2075 +torch/include/ATen/ops/_sparse_compressed_tensor_unsafe_native.h,sha256=Vx4qLatXz3v3QNoYnTiglRKkmFDs9e9z1c0GBxUbaYE,1047 +torch/include/ATen/ops/_sparse_compressed_tensor_unsafe_ops.h,sha256=N4mSVlg0b4ZsMTEvthVc31vHlAa6v3M5xCWlBVW93YQ,2148 +torch/include/ATen/ops/_sparse_compressed_tensor_with_dims.h,sha256=2elS-XpBOtBboB85lbc5MqPKy4g5kg-zyGnz0gw8xx0,2161 +torch/include/ATen/ops/_sparse_compressed_tensor_with_dims_compositeexplicitautograd_dispatch.h,sha256=YbKw9IJ-MKNp9-cNHNITTDZesE9v41sismC1XJzHrJw,1499 +torch/include/ATen/ops/_sparse_compressed_tensor_with_dims_native.h,sha256=h0z1QqK0mDiO71cuy45Cv6NM27WCSXUX9dEcUuRxItk,1025 +torch/include/ATen/ops/_sparse_compressed_tensor_with_dims_ops.h,sha256=de2UyTGyjCK_TLJPr3Po67De4tKmZXNC6gFUUSnSKMQ,2109 +torch/include/ATen/ops/_sparse_coo_tensor_unsafe.h,sha256=pdiSp2mj4399WO7r9Xb3H_iV5UsF6zguGmmnn5tykvM,5636 +torch/include/ATen/ops/_sparse_coo_tensor_unsafe_compositeimplicitautograd_dispatch.h,sha256=ZFtMcYCNZAfQeee_wHqwT_SPmtEZrkjH0MuKLK1MEa8,2041 +torch/include/ATen/ops/_sparse_coo_tensor_unsafe_native.h,sha256=HIGw9llC0vPTMdS2PI-2O2MdkVjPiiT8kmdRFksLXTw,1046 +torch/include/ATen/ops/_sparse_coo_tensor_unsafe_ops.h,sha256=tzEkmAPDpiH0rMNhIpgF3VWyfpf8f1C1dmJ3lcM63FY,2104 +torch/include/ATen/ops/_sparse_coo_tensor_with_dims.h,sha256=he9w4j78VvtR2mm9BCGAOyNaUDBPYqNFu8HfxsJTMoc,2623 +torch/include/ATen/ops/_sparse_coo_tensor_with_dims_and_tensors.h,sha256=kAZg8-UdfAY_VZALBufbpSUQpHyZdclQ065Sp7HJwsU,10985 +torch/include/ATen/ops/_sparse_coo_tensor_with_dims_and_tensors_compositeexplicitautograd_dispatch.h,sha256=ohaZR8xLp8WMqRbvsgeEkjBI0pUjR0iArA2f5dobXT4,2005 +torch/include/ATen/ops/_sparse_coo_tensor_with_dims_and_tensors_meta_dispatch.h,sha256=7xxcivMU1t6WJc-w24cZmyAz1WiaNoherEfCp7EpBcU,2209 +torch/include/ATen/ops/_sparse_coo_tensor_with_dims_and_tensors_native.h,sha256=GZC8YtRzjrbxcpDfQggkQgf3oPFpbki8HNAT5oFexSI,1342 +torch/include/ATen/ops/_sparse_coo_tensor_with_dims_and_tensors_ops.h,sha256=GvumjGh-dmzl7CPBCA1tLGm9DUW_1JDWgySqCoVad40,3413 +torch/include/ATen/ops/_sparse_coo_tensor_with_dims_compositeexplicitautograd_dispatch.h,sha256=QfUV6gdtxRjdXvePVQT5r7Xs2VKRgBb9q9nDkzi1KCU,1266 +torch/include/ATen/ops/_sparse_coo_tensor_with_dims_meta_dispatch.h,sha256=rg68Q2y4F3ikaiHDQWFHYoWbk4KMQ6k4Dyd_JTqffYU,1347 +torch/include/ATen/ops/_sparse_coo_tensor_with_dims_native.h,sha256=SCinn4PMCTLSZIfUaW90IqjmgaENoD4GW-ygZSumYao,1100 +torch/include/ATen/ops/_sparse_coo_tensor_with_dims_ops.h,sha256=CzN3cTrkqLnky2h4W5amXvm8aZx7yMVyMHk2Sp30HPU,2709 +torch/include/ATen/ops/_sparse_csc_tensor_unsafe.h,sha256=itq3imT2jxw5tat2oU1uPW_aRltT7HBGqdGsbWXqCy0,2074 +torch/include/ATen/ops/_sparse_csc_tensor_unsafe_compositeimplicitautograd_dispatch.h,sha256=1EEjjS-hfR6tqKQU9lPBUZUZquEpJ0x12xpiqFFoUI4,1492 +torch/include/ATen/ops/_sparse_csc_tensor_unsafe_native.h,sha256=z_op_eC1BU4QVF5tHRd8oqD6mlM1rDIaIOZaNUTt4Ok,1021 +torch/include/ATen/ops/_sparse_csc_tensor_unsafe_ops.h,sha256=tigQ09MNn30_EfrRFpfPymUyjMpV-0p1TlcWr6GvKmA,2088 +torch/include/ATen/ops/_sparse_csr_prod.h,sha256=5VaIeQ6dE2iim_ps2xcBbXlsqGaYOfpFOIcevifp5zU,1984 +torch/include/ATen/ops/_sparse_csr_prod_compositeexplicitautograd_dispatch.h,sha256=Oq_23rYIQyVqmQ0z8b2kcvPiiSEdkxFuojyq207xw8E,1339 +torch/include/ATen/ops/_sparse_csr_prod_native.h,sha256=0ZKu_vPTKpPEhZCmQMTKS_AVCHdg8bl6h9ZAy8Ro0vI,1203 +torch/include/ATen/ops/_sparse_csr_prod_ops.h,sha256=p-Sf2v7HRUJP8h0kegxK3uIsnMzGEiKSfkvyxNoQ8Nk,2488 +torch/include/ATen/ops/_sparse_csr_sum.h,sha256=akO2ydK4h6Rp6PlXqvkr_wNWzCyZUanCjvDJzdRi-wA,1974 +torch/include/ATen/ops/_sparse_csr_sum_compositeexplicitautograd_dispatch.h,sha256=GmFq2mLXHuI8s1ozjPwfK5jvmLa-nxYl7CD4-cZdO4c,1337 +torch/include/ATen/ops/_sparse_csr_sum_native.h,sha256=3VNJaz0BhbaC-DPbWq9W6p2iP34LfNNNT-jKYqG5oFQ,1200 +torch/include/ATen/ops/_sparse_csr_sum_ops.h,sha256=A4gDfJAUdLAb7CV4iX--j8BC4HoQgQbCoYR6iwN0w1s,2482 +torch/include/ATen/ops/_sparse_csr_tensor_unsafe.h,sha256=DR3RStNrsDE6vCv6egJHzxiVL5Z2A9lZHxXLJmDkGWs,2074 +torch/include/ATen/ops/_sparse_csr_tensor_unsafe_compositeimplicitautograd_dispatch.h,sha256=mJ--ScJMCrvgTYFmIjzOUoiC6NjrPrlt2Fn6ItioY7M,1492 +torch/include/ATen/ops/_sparse_csr_tensor_unsafe_native.h,sha256=lOLblG-dnN6fQOFpdRayM1huAVMQ8BDj4hVAszBgbq0,1021 +torch/include/ATen/ops/_sparse_csr_tensor_unsafe_ops.h,sha256=NzztrK5GUYgwLrpYDNTeUvfXcZW2KWIi7aKGjzzJaRo,2088 +torch/include/ATen/ops/_sparse_log_softmax.h,sha256=1jIztBgVFTjubkJ8cOYZ43MFGpR4TyrQIFKpXpXjrWk,2319 +torch/include/ATen/ops/_sparse_log_softmax_backward_data.h,sha256=Lnltd5PNZLgOmvfk5loSC41MMGbeq6n5OLYcwdh8dSw,2022 +torch/include/ATen/ops/_sparse_log_softmax_backward_data_compositeexplicitautograd_dispatch.h,sha256=b5ANAAZoGIrq9_ugtwNse3dK8o07MbUbmtO5LP1CByA,1348 +torch/include/ATen/ops/_sparse_log_softmax_backward_data_native.h,sha256=57FHr2ZmBxxvOXAxMuYgZmmBJAlYGNgLpEp3B2IAdeg,1184 +torch/include/ATen/ops/_sparse_log_softmax_backward_data_ops.h,sha256=2SnQcOPyjcgiIo5H4u6HAbfiHWEXCagQXO2QWLoNB50,2482 +torch/include/ATen/ops/_sparse_log_softmax_compositeexplicitautograd_dispatch.h,sha256=7rUxEkGO-_cCyW6UVldV-AGGyEJcGpoxnHotuxeys8U,1242 +torch/include/ATen/ops/_sparse_log_softmax_compositeimplicitautograd_dispatch.h,sha256=zjZKe4CdcWECfgIYip7uheBG0zgs95xuFpW0lot_O-Y,1265 +torch/include/ATen/ops/_sparse_log_softmax_native.h,sha256=L00aJsRsAGJph0tKVjYFxBLCg6aLRZHMaOYhCkWxQz0,1309 +torch/include/ATen/ops/_sparse_log_softmax_ops.h,sha256=4um_wZS21De7v8Z0Rf0fNZEdXQ24YIkTSZtfVVZ3oZs,3655 +torch/include/ATen/ops/_sparse_mask_projection.h,sha256=04StALHNkcgwSWaSzmg2Gr3sKSum3q5LYzXLIMj_S9I,1551 +torch/include/ATen/ops/_sparse_mask_projection_compositeexplicitautograd_dispatch.h,sha256=gjiNlq_7qxc-SihvopbsV3CrQXuJcBqUJ6GjyrGX_Fw,1290 +torch/include/ATen/ops/_sparse_mask_projection_native.h,sha256=cEeMN5nmhu4gNa9VAyB7TTcGYS4cE0LH83WdMpoi4n8,974 +torch/include/ATen/ops/_sparse_mask_projection_ops.h,sha256=E2aCVH5zorHN5ktStLwMxlyBBByuQN-qlLN-F90VK5g,2288 +torch/include/ATen/ops/_sparse_mm.h,sha256=aANdBJi8HzhWH1Hvxx9p7eUSQu0BY_kit3dKEg9SXCg,1260 +torch/include/ATen/ops/_sparse_mm_compositeimplicitautograd_dispatch.h,sha256=t2xRWNOodcsHw8bJ-l6IAaXm3OAD4uGYkterYFZqNp4,1190 +torch/include/ATen/ops/_sparse_mm_native.h,sha256=ly7THpuO97GU3szMJxxUmGTsL5ImCsaeGxrRfghbLe0,900 +torch/include/ATen/ops/_sparse_mm_ops.h,sha256=oqTWUSGeQcOZGMD7aY7ecOj_InlQhMpb1bD8WGewJnA,2064 +torch/include/ATen/ops/_sparse_mm_reduce_impl.h,sha256=jeRP9WbW6g9ofOgOG0VuuSxuKmO3jRfWrE0A0TOh4us,1118 +torch/include/ATen/ops/_sparse_mm_reduce_impl_backward.h,sha256=l1V8NAdNDXErQ6FE54rHNt9IvV73J-DrknZIRujwrBQ,1334 +torch/include/ATen/ops/_sparse_mm_reduce_impl_backward_native.h,sha256=oJdzA3Kdj-5l7WTqz6_Qq0orhPCPnblE4DVGOdB6yoc,964 +torch/include/ATen/ops/_sparse_mm_reduce_impl_backward_ops.h,sha256=k3v29nXbFMnKHAJut8bJONc4mBOqL5V3rbBZK2XTBCc,1872 +torch/include/ATen/ops/_sparse_mm_reduce_impl_native.h,sha256=czUz4skzv55zyUzfSb-gLvbEMUO3enB4ZgNcK1cxAHA,863 +torch/include/ATen/ops/_sparse_mm_reduce_impl_ops.h,sha256=QWIU-fsVPcn1GsmVCrRZYmWojrz80i0qAmhN8JGj43g,1544 +torch/include/ATen/ops/_sparse_semi_structured_addmm.h,sha256=DI8opZpNucbbVpPT_A-qTPUC1c_Xnc8uVn1frvv_A4U,1368 +torch/include/ATen/ops/_sparse_semi_structured_addmm_cuda_dispatch.h,sha256=dfZFeHXZkJ_-3rOxWtw0EiiHWfpajLr6g8vAwK6pbHE,1221 +torch/include/ATen/ops/_sparse_semi_structured_addmm_native.h,sha256=vRT6-WCiIWvz9dk-1ETSJtrKChh8DHFy5iTue1eoYfI,973 +torch/include/ATen/ops/_sparse_semi_structured_addmm_ops.h,sha256=OJCwBU56pfI-K1ei4pnNsiLsZgqJbWc6vDkojWH7FIg,1904 +torch/include/ATen/ops/_sparse_semi_structured_apply.h,sha256=0X74SRzVh3rU9_zW4v6sNJix2270rKF-KmQxVMG08Z0,1125 +torch/include/ATen/ops/_sparse_semi_structured_apply_cuda_dispatch.h,sha256=ez8zCFRZmxpg6h0tZGcsM5fJrpgC3fVWwVzDPvCc86w,1086 +torch/include/ATen/ops/_sparse_semi_structured_apply_dense.h,sha256=bh4j32AYj23KEoXahSXOfvTMFbqqcCtJIuVOGyBJXwE,1114 +torch/include/ATen/ops/_sparse_semi_structured_apply_dense_cuda_dispatch.h,sha256=c4xDob--FIJTQSl-1XOb8Z4QlSa0P08C8ZoC9zhqPWY,1067 +torch/include/ATen/ops/_sparse_semi_structured_apply_dense_native.h,sha256=MFFoT84B2vwSheoKEJWu9lOeAWd5Ub4Oj6ShJfvFZBY,819 +torch/include/ATen/ops/_sparse_semi_structured_apply_dense_ops.h,sha256=06Vfo3i5ElzSPbqE5gNq3uxgnHBC0psBd5E_QVnvTd8,1442 +torch/include/ATen/ops/_sparse_semi_structured_apply_native.h,sha256=22yWvKMQlluRuRpB506ykva8y639PnaFLPF4zD8P-eg,838 +torch/include/ATen/ops/_sparse_semi_structured_apply_ops.h,sha256=wJ7blUDuOnnDESbbrf8j-KZEnVhNp4lLpuF66savif0,1509 +torch/include/ATen/ops/_sparse_semi_structured_linear.h,sha256=4E72h4BVnn1rTo5U152jB9iRaxJDbo9TA9UtzS7UMOY,1385 +torch/include/ATen/ops/_sparse_semi_structured_linear_cuda_dispatch.h,sha256=Z-bV2dOZgMLez9u9EwjkT3RcgNcDUq1UoXq35MBkSPE,1245 +torch/include/ATen/ops/_sparse_semi_structured_linear_native.h,sha256=FkdT9_Ka3Y3XGwRVMEPpuO0RZOavB_RfiEYqFGJJNRs,997 +torch/include/ATen/ops/_sparse_semi_structured_linear_ops.h,sha256=GVjKnw7gt2U897vpuijbZx9SZpHkEpjJEijM_VAbj4c,1931 +torch/include/ATen/ops/_sparse_semi_structured_mm.h,sha256=8detAxMxGbqQfZtN10bjw9qltFSRE9bJ_hRN9NRV0Wc,1210 +torch/include/ATen/ops/_sparse_semi_structured_mm_cuda_dispatch.h,sha256=AnUu15ZI-FdGFJjkZICBFzfa8Z9RGoVLWjJFb7FP1To,1137 +torch/include/ATen/ops/_sparse_semi_structured_mm_native.h,sha256=SJ8OWAqHikVoQ2iUExN6UWbP9TXZjXrJgEYvN9Q7G8M,889 +torch/include/ATen/ops/_sparse_semi_structured_mm_ops.h,sha256=sF4pByV_IZE3us9WQpizrHEAFZgIj4iaIfpoimNAANE,1636 +torch/include/ATen/ops/_sparse_semi_structured_tile.h,sha256=wll7eU7PczpeFPYYa-GjMHPQmGUGOMhEPxR_8N1U4LM,1229 +torch/include/ATen/ops/_sparse_semi_structured_tile_cuda_dispatch.h,sha256=yjo3XBAnTkVkpyP3WCZK2jL9f88RZDp-rBS-L5g5mSI,1139 +torch/include/ATen/ops/_sparse_semi_structured_tile_native.h,sha256=Iqo99Ydu5rfF43czcMiJJZDLfxmQhO6KD97kJXZj9gg,891 +torch/include/ATen/ops/_sparse_semi_structured_tile_ops.h,sha256=SgKgWqZpW45d6Xq-wuhERFdutMRN5BVuCCutzXxJYSo,1681 +torch/include/ATen/ops/_sparse_softmax.h,sha256=gsMsfEd0SvgnvhzXiqFsEzou_cab2zWzBHFT7PqAnbM,2255 +torch/include/ATen/ops/_sparse_softmax_backward_data.h,sha256=8t_VURB_Uuo0a6vKF6pBLog5yzsapquO9Dew_bJODo0,1982 +torch/include/ATen/ops/_sparse_softmax_backward_data_compositeexplicitautograd_dispatch.h,sha256=gk5kIBonSDypRnh3gjhFbKpYix8FYkVy9EJX36KL23A,1340 +torch/include/ATen/ops/_sparse_softmax_backward_data_native.h,sha256=IWeTEwbX48BC-saWtghFQewHB2SwAnQFtIgWY2EmSz0,1172 +torch/include/ATen/ops/_sparse_softmax_backward_data_ops.h,sha256=WyjApoAh_BrB2OBpNCGrx1ABZILPb7VvpACu6O710yU,2458 +torch/include/ATen/ops/_sparse_softmax_compositeexplicitautograd_dispatch.h,sha256=hu7KTpXBqwzYAyCYSE0r561f6sxBwSlVX-QNDLLvNDE,1234 +torch/include/ATen/ops/_sparse_softmax_compositeimplicitautograd_dispatch.h,sha256=dqlWRIq4IyM6LVKRyndXV7FLZ7VkZu2e3L7eUMQvFZA,1257 +torch/include/ATen/ops/_sparse_softmax_native.h,sha256=VDlyA3oUeMDnFKmEHeSg7AYtmGIIPBATefCso8IDVO8,1289 +torch/include/ATen/ops/_sparse_softmax_ops.h,sha256=VcVQ6Re4Zbo7wRHgfzDzK-aKyxOi1JZS8NO_TX6DdEU,3607 +torch/include/ATen/ops/_sparse_sparse_matmul.h,sha256=qIOf7NpNBoeHr5JONfD7h-qzVdEnShdZ46-uEugrisk,1617 +torch/include/ATen/ops/_sparse_sparse_matmul_compositeexplicitautograd_dispatch.h,sha256=OyZqJMRLYO3_MVPzj-soMz1BthGOXF5q697nerpBw-8,1232 +torch/include/ATen/ops/_sparse_sparse_matmul_native.h,sha256=2UiXcek2xMq_P72XCcsF2LhACQ1iyVdZAl-7hGtZQXs,1020 +torch/include/ATen/ops/_sparse_sparse_matmul_ops.h,sha256=6y5sT3PWmNzTmKYxXysJPc-eHc5emNlIewcJFN2jl3U,2108 +torch/include/ATen/ops/_sparse_sum.h,sha256=ZlGKpW7lDJH7T187EubV7HGrQcZcvU6BNhvsVlY29B8,2149 +torch/include/ATen/ops/_sparse_sum_backward.h,sha256=uWKBXNeqQY9ty1KPLpDMd3BzbQix06AKSY3aMw2Eo1M,1709 +torch/include/ATen/ops/_sparse_sum_backward_compositeexplicitautograd_dispatch.h,sha256=2BBgK4uplELzhd--3odalPloVkn9RDs8JJPDfG_Lx4E,1270 +torch/include/ATen/ops/_sparse_sum_backward_native.h,sha256=45zId1bqGqk4mRDeaM-PWUjhu-xXVu9jP2GNQDtHQPg,1079 +torch/include/ATen/ops/_sparse_sum_backward_ops.h,sha256=u5X9P1dEBNMjanXiDV-syPjuiJWHc2EcCiBvK1E_G60,2236 +torch/include/ATen/ops/_sparse_sum_compositeexplicitautograd_dispatch.h,sha256=c5daNj5uVi5KRL8fRE7d3mU5JOX7rYcNmMezTM08YuM,1283 +torch/include/ATen/ops/_sparse_sum_compositeimplicitautograd_dispatch.h,sha256=7YBT3Egg6FHqdPqMqNmoGvnBQnbdBF__PJuN74CvJnE,1236 +torch/include/ATen/ops/_sparse_sum_native.h,sha256=4NZMz9SJ5nKJZDdX56KQ79TWfu9DJW86ZRGXln7y00s,1136 +torch/include/ATen/ops/_sparse_sum_ops.h,sha256=yJGn6IbGp3rEe6zMbjSLpeYeL1nMfRvnl93gIT7P73Y,3898 +torch/include/ATen/ops/_spdiags.h,sha256=698SNzuGe-sizHPUC24PZVWO-MhPQwtYjzdDzeqbsbk,1904 +torch/include/ATen/ops/_spdiags_compositeexplicitautograd_dispatch.h,sha256=bevx7tgp6B_JmGRDn5iqhPOWBQAoXXQwsLS-epCe4pQ,1353 +torch/include/ATen/ops/_spdiags_cpu_dispatch.h,sha256=yELqJJTknkEZlKvIy1INFqTvmTDtQvuUAjIbVQP670g,1111 +torch/include/ATen/ops/_spdiags_native.h,sha256=B_LENcUm4Fu6r3KEe1419pX0sffAinVnsWoK0ibkQA4,1037 +torch/include/ATen/ops/_spdiags_ops.h,sha256=pId6IIVmvFlyQsGLZiJbaDSNX2LJpqqzabtqeGAzkKI,2468 +torch/include/ATen/ops/_spsolve.h,sha256=pC0WlkU6-_PV3j3bYztRZQ0QgvqGIAF-DCQpfXLp79Y,1002 +torch/include/ATen/ops/_spsolve_native.h,sha256=U3h3kAxbZvZGXImr3CiXtLB-QYZU1PAnhy4zzNQmfR4,809 +torch/include/ATen/ops/_spsolve_ops.h,sha256=dsDPzBt8Wg-o6B9M817DVQk_8rsdF_hY4gKln4V5Pr0,1363 +torch/include/ATen/ops/_stack.h,sha256=tgs2d-Cu0eeAUYTyJ1riKd1WdkVRhzWjbLl7RRQjdiY,1438 +torch/include/ATen/ops/_stack_compositeexplicitautograd_dispatch.h,sha256=sy2H-Fgw8NI7H9psyJBIiuYOq-20fSTeqh3g6WMOa7U,1245 +torch/include/ATen/ops/_stack_cpu_dispatch.h,sha256=cD7JmkNTPArsnGMWvuT3HUcB3H8JpPbiuR8_ZTY-Vsc,1201 +torch/include/ATen/ops/_stack_native.h,sha256=HO4ASIC2FqwvKogwKVqVE-JENk5TNpaysXuRlxvdhz4,1029 +torch/include/ATen/ops/_stack_ops.h,sha256=ubwyI6yMz6Mq7OeL3a6lR0BwaB1YVp2ecxzB6NQhGj0,1936 +torch/include/ATen/ops/_standard_gamma.h,sha256=K281ICgc5FNXgMnJ1l034IxVkL0656XcaKYDzIBGV3g,1686 +torch/include/ATen/ops/_standard_gamma_compositeexplicitautograd_dispatch.h,sha256=Q8QON4FhlaiYCX80vng7O5OALq28_jP8hYE8YQew3JI,1267 +torch/include/ATen/ops/_standard_gamma_cpu_dispatch.h,sha256=NQ46_6aKO946aDw6tPzmbd1WWMcwVjK7ISO4dnCdfkM,1068 +torch/include/ATen/ops/_standard_gamma_cuda_dispatch.h,sha256=3R1bQcPw_5bC6G77wog9KBmjH1fTJEo1ixzKSyh6ylQ,1070 +torch/include/ATen/ops/_standard_gamma_grad.h,sha256=PjoOhpFmsGHUt2DMY9ymUy067ZwjkCmIBPbGRrG6MsI,1616 +torch/include/ATen/ops/_standard_gamma_grad_compositeexplicitautograd_dispatch.h,sha256=ZzHBNblFMwqQYAB0gGUO558CJg6agzc24GWcZzeZyzI,1232 +torch/include/ATen/ops/_standard_gamma_grad_cpu_dispatch.h,sha256=Utqb5UCKZL1IrUYhhpTLMl2L3UjqXDfel_OrpLuEsK8,1043 +torch/include/ATen/ops/_standard_gamma_grad_cuda_dispatch.h,sha256=d50Uv0bqOztLWltj6r947GWVCKVpHZqO9UGbGYVB5m8,1045 +torch/include/ATen/ops/_standard_gamma_grad_native.h,sha256=9k8sKAzlHVSemUF1W6NIo7voV13J1kpygewdEkvXBOo,1022 +torch/include/ATen/ops/_standard_gamma_grad_ops.h,sha256=MFNbr8xSSgaqNrCjk5Qzc95DIeOI7oKDpLshcl9C2Cc,2108 +torch/include/ATen/ops/_standard_gamma_native.h,sha256=EcuVnT2-ACznApbm0Ji3LLkJ7vgd3G51SpBotUwmwI0,1068 +torch/include/ATen/ops/_standard_gamma_ops.h,sha256=2WHlVg4L-hOsea0gBSajI1jzgtiNxDxisKBZxO5ZggQ,2186 +torch/include/ATen/ops/_test_ambiguous_defaults.h,sha256=bzRsHkVKV2hNC9GjdLE4uwhdP3ln1-wBt1o04jW8Fyc,1314 +torch/include/ATen/ops/_test_ambiguous_defaults_compositeimplicitautograd_dispatch.h,sha256=7-y2DHFT_hnKQOJ96pXS96K4FsEEwtS1Z1VoTitAvi8,1196 +torch/include/ATen/ops/_test_ambiguous_defaults_native.h,sha256=QxQQ3BZ_A6cVQyWpn0gMvUNIph4f9cxk-19nkrhc-zI,912 +torch/include/ATen/ops/_test_ambiguous_defaults_ops.h,sha256=w_fv2zyZz_T6mX4iBBVBfTJOhM-M4AOZyD9Fb0y9k7k,2071 +torch/include/ATen/ops/_test_autograd_multiple_dispatch.h,sha256=ckGwDXuiefe1qCrMa5p6mdjDnmznX2ITAjmyFcweBhQ,1915 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_compositeexplicitautograd_dispatch.h,sha256=GMeEqJUQ2L9WokYwH2mL6k27Y7nxpY7PYtyKWcDM9H0,1283 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_compositeimplicitautograd_dispatch.h,sha256=FyDNmoFFFq8R2FLmNlHPmBCoZMV7IvPOTRqPdfTyjps,1080 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_native.h,sha256=xzdtjYh4DMJzy1zwapb96JzQ-gmqDafU09B9KLmJRcI,1009 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_ops.h,sha256=dCoMUh-S_Cc8COBKRM46arhzgDaYX-atPdJ5A7qQ46w,2718 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_view.h,sha256=v8sC5z-FcyoOlvKP07p44bGgZe6MP7y5yE5YUxlKrN0,1057 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_view_compositeexplicitautograd_dispatch.h,sha256=SBbzDmNTqDZUhV2NHk6COMhn3OLMzVUE8f5_rxfmS4o,1077 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_view_copy.h,sha256=EhnK1EiisNk57htrqj2yAhnuNnb1MHDxSOyne-g-fFc,1686 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_view_copy_compositeexplicitautograd_dispatch.h,sha256=oG1hCzmGYUxGWH9Z7sobWFa0k1WqIVS4zdC3xulusCw,1222 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_view_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=162dWKw95_Kj81dAB_OVGaT5XgCJCbn9ZZpThDvsBEU,1108 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_view_copy_native.h,sha256=PRXzwwZ6uG8VOCkSe0R05uRrOz_OMnBC2NsiP3amxXE,907 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_view_copy_ops.h,sha256=SpOwvweB0hTVJAdFgNHapgwpcXkqih2qarbl2UAjBiY,2062 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_view_native.h,sha256=2m7q0On0DbZz1YtELzh1IkFDqdKoSPxHNeMB3Lf5YEY,787 +torch/include/ATen/ops/_test_autograd_multiple_dispatch_view_ops.h,sha256=D1X5ka7quywnc5RPTiSt8d5v0EmHmbePmrASkGaYJC4,1344 +torch/include/ATen/ops/_test_check_tensor.h,sha256=2qrGDQIu3B7pmt1ZwDo4Y_bfp4dlDZcKfQ5DJAmlOhU,975 +torch/include/ATen/ops/_test_check_tensor_compositeimplicitautograd_dispatch.h,sha256=Ft8GDx250izWP0eQYlWivibmbjl8h2-H8WPxaoVTeH4,1058 +torch/include/ATen/ops/_test_check_tensor_native.h,sha256=QNUqHjYkI9CQQdvhnt8jE1DbOUKCx365ezIhIOBP2XY,768 +torch/include/ATen/ops/_test_check_tensor_ops.h,sha256=AslSblL4Im7bqkChp_AcmEbgWtI67Nlc1z7PN9lppjI,1281 +torch/include/ATen/ops/_test_functorch_fallback.h,sha256=nku5fU5oMWAzwZ8FrpO-CCOqIqL03Mz0TvLi3vEOHJo,1647 +torch/include/ATen/ops/_test_functorch_fallback_compositeexplicitautograd_dispatch.h,sha256=TQYfuAs_E3jjxVh70CIrMTJzYVRtw2wb5xRaNcExP_o,1238 +torch/include/ATen/ops/_test_functorch_fallback_cpu_dispatch.h,sha256=WMQXXDhiTykyGIPzkK82KdEVyVqwjjZiqscMdU46U9E,1046 +torch/include/ATen/ops/_test_functorch_fallback_native.h,sha256=vaVUFt2k4cGLqcxHm6hfe3SYAdtK1GCJ5RvomqXqswk,923 +torch/include/ATen/ops/_test_functorch_fallback_ops.h,sha256=3kCdseQIjxukM7kM6csANwoh5rpfO9iGu1A8Arr6iMk,2126 +torch/include/ATen/ops/_test_optional_filled_intlist.h,sha256=k-sAbIyHjtMt8s2-uTvZEf70zqYJlPGqqDhoSUUXr-0,1751 +torch/include/ATen/ops/_test_optional_filled_intlist_compositeexplicitautograd_dispatch.h,sha256=R-exCUZwfjK3ECsbaDJgBd-ruDpH1qpTCpLtoI3u224,1266 +torch/include/ATen/ops/_test_optional_filled_intlist_cpu_dispatch.h,sha256=Usf74C08AgU4shl2IjduQkyihI1WtT1bIheeAIu2WnE,1060 +torch/include/ATen/ops/_test_optional_filled_intlist_native.h,sha256=XHVV3QIAl-qxWmRz0c8vtvlQmB3gIwf2Vn8g9lx60x0,944 +torch/include/ATen/ops/_test_optional_filled_intlist_ops.h,sha256=01lyVhe_BGRVy763WSSkVx2-IeSyWtODFyGaBEXdUZc,2212 +torch/include/ATen/ops/_test_optional_floatlist.h,sha256=MLrIir3Ny2CufK3WKco6iJ_Wj9v4mLVblSy-hdLSDdE,1746 +torch/include/ATen/ops/_test_optional_floatlist_compositeexplicitautograd_dispatch.h,sha256=YEAPVSgpIGKKWp7CFS3Wu8t-R7LdhNK2CEuK9DiiGdE,1284 +torch/include/ATen/ops/_test_optional_floatlist_cpu_dispatch.h,sha256=2micScFTfrw6fdKWHyPN5bCLkSWnp_TzcDYf-5V-5OA,1069 +torch/include/ATen/ops/_test_optional_floatlist_native.h,sha256=kLk1CNxbrXKkEXkiWeKmBX3CbGZSEvkya-Bz-YuO2Kc,969 +torch/include/ATen/ops/_test_optional_floatlist_ops.h,sha256=DxEw3-LWRHqtStJV8rAzet2LxrTezNCSXlcgvXI-I-E,2268 +torch/include/ATen/ops/_test_optional_intlist.h,sha256=G6tEUG0mrSKCbxN-Ya8oKaWeEgeEhxuTvHJR01NIcCk,1678 +torch/include/ATen/ops/_test_optional_intlist_compositeexplicitautograd_dispatch.h,sha256=ON4aTcJ57ZAODjsrl2CfE9etpfHVXtp4nVgunWtR0eg,1252 +torch/include/ATen/ops/_test_optional_intlist_cpu_dispatch.h,sha256=6xYfQInpdHKWeOW-Yidz6fkS8ZX6N1y4zSTZpzt-NGM,1053 +torch/include/ATen/ops/_test_optional_intlist_native.h,sha256=MrA15N1H3nBWPlToh-n0SR-nZZf05Qkr9Ao1JzCuwDY,937 +torch/include/ATen/ops/_test_optional_intlist_ops.h,sha256=IcjBRwJmpsD9pCfgtScivsvVt3T66ATx4W8GLZm0j_Y,2168 +torch/include/ATen/ops/_test_parallel_materialize.h,sha256=iHwJVtmmX841XeeCcmstROypSVxUbxZPo60qVm_CVMI,1119 +torch/include/ATen/ops/_test_parallel_materialize_compositeexplicitautograd_dispatch.h,sha256=PPvhRfOpfiQ-CydDdyj66EGf9bmVIq3uaOcTKFuwQo4,1111 +torch/include/ATen/ops/_test_parallel_materialize_native.h,sha256=GebjcTysJSR03ZYK9bn1OYgevVQziNhBGpJW8GxWgr0,821 +torch/include/ATen/ops/_test_parallel_materialize_ops.h,sha256=3mcvUrtKTYIflp95KeyO9R03bPgv7jxjOB5jQFkjlw4,1439 +torch/include/ATen/ops/_test_serialization_subcmul.h,sha256=wOCBdhBZfTyHWNgc5Jrjtzc2sd-gE1imyx7uDvtue5g,1109 +torch/include/ATen/ops/_test_serialization_subcmul_compositeimplicitautograd_dispatch.h,sha256=LzUx_L1lvjfzbj3Mg6uyqrbwnmHz7M9kDmawzOq_pK8,1121 +torch/include/ATen/ops/_test_serialization_subcmul_native.h,sha256=F_66v6x2Djej-vw1tDu1B7xjStltCJxU8CE-47DUVf4,831 +torch/include/ATen/ops/_test_serialization_subcmul_ops.h,sha256=19_WihdXohXChjQNOfcIIthocBu8El_m8pIaF8mtxK4,1482 +torch/include/ATen/ops/_test_string_default.h,sha256=-a9pr1TO4tWJ1eBAPZxh3_xwJSHOUov1nUMMZWJVWn0,1078 +torch/include/ATen/ops/_test_string_default_compositeimplicitautograd_dispatch.h,sha256=1zS6SlFi6WeeCMOQpcjplpp1VZvZAcfKp1-5iPd6sLQ,1117 +torch/include/ATen/ops/_test_string_default_native.h,sha256=5TU_VFC9HU2-8nVG3WPLQXEHG6sFfgnIs6H_gwt0POA,827 +torch/include/ATen/ops/_test_string_default_ops.h,sha256=20tZ3z-hFO4ngbLriUOv3KiEciMpG1yeYpHeFAI25bM,1446 +torch/include/ATen/ops/_test_warn_in_autograd.h,sha256=BBMhBxL7bbTIHp_Wh8t32y_Abo02RgDYzbC7LfawGpg,1486 +torch/include/ATen/ops/_test_warn_in_autograd_compositeexplicitautograd_dispatch.h,sha256=8MWV9jQuUHCatRRvh2PEw0V6aOoVsCY3OTFPp4bCk-4,1253 +torch/include/ATen/ops/_test_warn_in_autograd_native.h,sha256=rPAVNbxFeEiCSu0dM2zUHvz1k866rxGEa82nYfb6olI,867 +torch/include/ATen/ops/_test_warn_in_autograd_ops.h,sha256=Ac5p6uRLazbjlCWlm6qUqIUIenBYlxrOHm6NSZ4l_wM,1942 +torch/include/ATen/ops/_thnn_differentiable_gru_cell_backward.h,sha256=nmyBmlrtFYOYY6IZqmKhPFNq9KucWiAwDb394scDwak,1490 +torch/include/ATen/ops/_thnn_differentiable_gru_cell_backward_compositeimplicitautograd_dispatch.h,sha256=koyVS7kkPTeaeqTqG01KrEBWDtM5ZU55bSOGF9_qKWs,1324 +torch/include/ATen/ops/_thnn_differentiable_gru_cell_backward_native.h,sha256=YODWDAockWv-TQhwDgpbuFjl7WHn2mstdQHKGIFRpVw,1034 +torch/include/ATen/ops/_thnn_differentiable_gru_cell_backward_ops.h,sha256=b8y9KOcz0mwHss4b2s-CVzlSQOELaO-4aC8QmWgwYKQ,2155 +torch/include/ATen/ops/_thnn_differentiable_lstm_cell_backward.h,sha256=0NJJcqElWSPN72nwePMMVit4-M3NaWJXywEScbkcdto,1621 +torch/include/ATen/ops/_thnn_differentiable_lstm_cell_backward_compositeimplicitautograd_dispatch.h,sha256=qSGiGn9Ilu1UTK5UQaGbF54PqxL8yJ5jnjN6fNoe244,1410 +torch/include/ATen/ops/_thnn_differentiable_lstm_cell_backward_native.h,sha256=GD0m6duXhbdOigZsFOmHxmLm-L5cbr7Z9ZVwShWGucs,1120 +torch/include/ATen/ops/_thnn_differentiable_lstm_cell_backward_ops.h,sha256=oC09zJQW_Vtf1FZNpz-O8DU1z96035WutE3K9mmORO0,2431 +torch/include/ATen/ops/_thnn_fused_gru_cell.h,sha256=bhuYR-K-nADRDGlNDe5WU2bvAfCkU-UDEGK67-p1ZCs,2585 +torch/include/ATen/ops/_thnn_fused_gru_cell_backward.h,sha256=a8kzIUviTVW-NelOvaJ_N8Uf-lMfk3ZYPEH-BjyL-xA,2546 +torch/include/ATen/ops/_thnn_fused_gru_cell_backward_compositeexplicitautograd_dispatch.h,sha256=QDPTDRrqYV2noHwMik5PKd_KeMF2hCFWHIIhJ9xINZM,1578 +torch/include/ATen/ops/_thnn_fused_gru_cell_backward_cuda_dispatch.h,sha256=EY2cYJQuOFX-vDXPd5OR1Kbt4xLfKHEHoc4cBDZnrpw,1133 +torch/include/ATen/ops/_thnn_fused_gru_cell_backward_native.h,sha256=AGNWctCi2h8P75MH2_CzM8W6wUNudfY6Pwyc3DH-flU,1183 +torch/include/ATen/ops/_thnn_fused_gru_cell_backward_ops.h,sha256=GXv-tMvPEWzZ5LxvSE8EocNrkE3jF4mLK8aSQlwFJEk,3035 +torch/include/ATen/ops/_thnn_fused_gru_cell_compositeexplicitautograd_dispatch.h,sha256=eNCWvgoeLRifxVYkqyvBwf0rA6ztlPOyo79xR57RWqY,1598 +torch/include/ATen/ops/_thnn_fused_gru_cell_cuda_dispatch.h,sha256=4El0W06BW6WV7ZHvsJcRJwEHx_DH3NQfBluIkj7lmoU,1209 +torch/include/ATen/ops/_thnn_fused_gru_cell_native.h,sha256=vpKkk5L90iCeXXLTkaUpAjt6I6w4yOc2zYufYc3gubs,1266 +torch/include/ATen/ops/_thnn_fused_gru_cell_ops.h,sha256=JCQed-5m_LfeQ1H7oLti6ke2GQgiIykfyXbx8lGHhZo,3230 +torch/include/ATen/ops/_thnn_fused_lstm_cell.h,sha256=pdrZh-r-aG7eGrRT2nQ-srLY_aj9vEWqdTZWjSPuxRE,2748 +torch/include/ATen/ops/_thnn_fused_lstm_cell_backward.h,sha256=gpqZytCyCRMpjck_HzWUjOJX6305qroLLT4vJ3R3340,1388 +torch/include/ATen/ops/_thnn_fused_lstm_cell_backward_compositeimplicitautograd_dispatch.h,sha256=PT6M5irl6VSlpN2Gw4dIEf5BpoqKSk3OkG0JpotNPxA,1284 +torch/include/ATen/ops/_thnn_fused_lstm_cell_backward_impl.h,sha256=Ka7qtfiyv5ctDcLhmn1EcEo67sIAQqchlq7XRBuUdc0,2795 +torch/include/ATen/ops/_thnn_fused_lstm_cell_backward_impl_compositeexplicitautograd_dispatch.h,sha256=S2GjBrp5yr4w8pAxk3hpo83R_AQeRCbH1u7jw6KhrLQ,1678 +torch/include/ATen/ops/_thnn_fused_lstm_cell_backward_impl_cuda_dispatch.h,sha256=zYkM6D9s2P3zRk3_N3akoPLJYWxEKAjTmuiKBP74kdo,1225 +torch/include/ATen/ops/_thnn_fused_lstm_cell_backward_impl_native.h,sha256=VS2CZMpM5JBiAI1eM42ABWnHlRiUaUOjbeNxd2NSw2Y,1325 +torch/include/ATen/ops/_thnn_fused_lstm_cell_backward_impl_ops.h,sha256=2nz3UhuHUXLoMXxzgUDyn3W0uR_fRDBCsHn7VEj3xLo,3449 +torch/include/ATen/ops/_thnn_fused_lstm_cell_backward_native.h,sha256=yFHEL0wvRj-eu5mBBy6lS4INGMOd4BjIIm8qgA9I_Rc,994 +torch/include/ATen/ops/_thnn_fused_lstm_cell_backward_ops.h,sha256=8Z7hnxnrI4Poc4HPUnUGROyMLGgBT6ARctfCJ4NYzTI,2033 +torch/include/ATen/ops/_thnn_fused_lstm_cell_compositeexplicitautograd_dispatch.h,sha256=ivUD3XjQq3A_BchyyQ0XDyPEDFNLJQqP4q5s88Vf79I,1664 +torch/include/ATen/ops/_thnn_fused_lstm_cell_cuda_dispatch.h,sha256=j3jhU5L0Tm0DoVirIa3HUV9QTEBrbHooWSLztF7tUYg,1221 +torch/include/ATen/ops/_thnn_fused_lstm_cell_native.h,sha256=uAq3Zr6rCTe2Q0ntqTKPX6tLX955WpVrtei3O7PrSYw,1311 +torch/include/ATen/ops/_thnn_fused_lstm_cell_ops.h,sha256=4fIpSfhHk8yOsi3K6pCEECapYR9NXrZlYHpSGy3z0Ao,3397 +torch/include/ATen/ops/_to_copy.h,sha256=4lOAU1lwOuMqcWS5e8drNhvVBEtGqKPISSBDjwPmZec,2742 +torch/include/ATen/ops/_to_copy_compositeexplicitautograd_dispatch.h,sha256=pgw3iYYcQoVfxV5Dl-66YHSopBi69JKcboptAuIXB7M,1757 +torch/include/ATen/ops/_to_copy_native.h,sha256=wWHcIlEzioTOpv06fuwcVDkbkwBZfgAMybV9NGJCGiI,1463 +torch/include/ATen/ops/_to_copy_ops.h,sha256=E2kEim0buTLXA5jWjVkTcxGAoaTgNKFBD2ucscQN3qw,2826 +torch/include/ATen/ops/_to_cpu.h,sha256=h2JOILFYlpV-PXd40a6nvIJwwlFpMVVBi0EfLUl1038,955 +torch/include/ATen/ops/_to_cpu_compositeimplicitautograd_dispatch.h,sha256=oCZIhk-Lmg4pzO4Lwi1yRahdSu9ME8sqQeSf6hUNGss,1061 +torch/include/ATen/ops/_to_cpu_native.h,sha256=Z5RhDRgvWYQjC27m3QcleHPIsHYZ6hsjqx8SozJRRzg,771 +torch/include/ATen/ops/_to_cpu_ops.h,sha256=MFn4J73cRXGIt3RlZ2osDOw32t6Zv9l_8ITGCbHqCwE,1294 +torch/include/ATen/ops/_to_dense.h,sha256=Xu_ZaQLwqvch2r1e5bs2iLrAtDJ0_qqqsUTJswVbVKc,1521 +torch/include/ATen/ops/_to_dense_compositeexplicitautograd_dispatch.h,sha256=6vOQ6lCWaSHOhBcbSJdy9JhFu5j36UeYZjUK6Q-NXJY,1334 +torch/include/ATen/ops/_to_dense_native.h,sha256=aF62FtekALwqjYGt8hOOpH5FQcQKc7ZNzCcNoFUQK4Q,1372 +torch/include/ATen/ops/_to_dense_ops.h,sha256=GjhC5w4WsoMYqsOTyaKO4sAdWFD3NUqBb71apS5f8jM,2368 +torch/include/ATen/ops/_to_sparse.h,sha256=dp5NYk1qKUqi_QuVfvoRzr1AOEMS3JDQeiHGFYv94L4,2228 +torch/include/ATen/ops/_to_sparse_bsc.h,sha256=0jZFZ7-5HFMnJBn1eSUmNbSrI5kqioVwpQxgXX-Dgqk,1505 +torch/include/ATen/ops/_to_sparse_bsc_compositeexplicitautograd_dispatch.h,sha256=O_CCc-5n3YLDdRKLLHdoTJcMVNwzbC0boM0Gdp_jXhA,1307 +torch/include/ATen/ops/_to_sparse_bsc_cpu_dispatch.h,sha256=pmLnE9wDtC8Ti6zAqanGix3YabuFM_MO649pzM_Iw_s,1088 +torch/include/ATen/ops/_to_sparse_bsc_cuda_dispatch.h,sha256=7I_WTIHlAi1eoelJ4UapFoUn-ZKQ0RKO876lr-CJYD8,1090 +torch/include/ATen/ops/_to_sparse_bsc_native.h,sha256=X-Es4lhcTGnbvnyoP9YG7-v0HZG6U5E_DiZlq-LgaSQ,1299 +torch/include/ATen/ops/_to_sparse_bsc_ops.h,sha256=CmDLrNtRucnUxYvm7Xg5xvYikOgVZjY7inKwsruCqh4,2310 +torch/include/ATen/ops/_to_sparse_bsr.h,sha256=4vd5JKbpHN_UQWcoMSQhoEE4QZ2ogyfsXwGohKXYU60,1505 +torch/include/ATen/ops/_to_sparse_bsr_compositeexplicitautograd_dispatch.h,sha256=qsbGOyupulYonnZwGkJ6dLKFLYE0m5-nwdGLO2tRJSs,1307 +torch/include/ATen/ops/_to_sparse_bsr_cpu_dispatch.h,sha256=3odXvMNIChfAEiZBKwGJMTtgxe7Pu7cXsFywHBG8xF0,1088 +torch/include/ATen/ops/_to_sparse_bsr_cuda_dispatch.h,sha256=n3d83m1dF51rljvrdOyId5_BptnQod4qB3caYUf6P9k,1090 +torch/include/ATen/ops/_to_sparse_bsr_native.h,sha256=cghQaEPlfc_JlHNvIBGQZpm4-fcnpgtUAPXla7284wM,1299 +torch/include/ATen/ops/_to_sparse_bsr_ops.h,sha256=XJmMNuu5mPbuYe90v3HGPrNYuypLPrJfwPQYXPlf0eI,2310 +torch/include/ATen/ops/_to_sparse_compositeexplicitautograd_dispatch.h,sha256=rYESoczMpwjzQ6XPQ_0L3T1sJJOQrDENOgWicUbkLlw,1624 +torch/include/ATen/ops/_to_sparse_cpu_dispatch.h,sha256=POKqY2Vn-DBoiBtUaxa8OUVhdTrOFsSRv7VcaMliwX4,1237 +torch/include/ATen/ops/_to_sparse_csc.h,sha256=0tPI0gn58WMMHzaFkCgEBf0pumHtNXK8Lh8soUdpK9o,1393 +torch/include/ATen/ops/_to_sparse_csc_compositeexplicitautograd_dispatch.h,sha256=TUakQE209YPR1A5C9lL3eIkrtVoiZyY7P0LONyeBBY4,1253 +torch/include/ATen/ops/_to_sparse_csc_cpu_dispatch.h,sha256=2AavDnQcNQC-p39rsRBhJCbtoym7-818ZUnM42Co6-I,1061 +torch/include/ATen/ops/_to_sparse_csc_cuda_dispatch.h,sha256=AmhUGLwdDyIr7yBPjxy-uo9qCeh6cFGmaCtUOBZ_gdE,1063 +torch/include/ATen/ops/_to_sparse_csc_native.h,sha256=7mPblDL2uRPydSmg8Nd_aNnfhfwAdzpladnoWBC3pLE,1191 +torch/include/ATen/ops/_to_sparse_csc_ops.h,sha256=w2FvB_ex-4guPObRL-JSTpFhQlnpXKG5ihSN2na3ZbY,2132 +torch/include/ATen/ops/_to_sparse_csr.h,sha256=Dy_5oJnYvxnZdPEUfqs27c4GzmJ-mG_Dxre7mthBguA,1393 +torch/include/ATen/ops/_to_sparse_csr_compositeexplicitautograd_dispatch.h,sha256=i_9ObDZPwa_5S7fD_fN78oQXhLd44nwlkVEmECauY7c,1253 +torch/include/ATen/ops/_to_sparse_csr_cpu_dispatch.h,sha256=O2kLGw3aqpY1pTFQrR_gmmUxIIHk3nc5vF3PEpbSN9w,1061 +torch/include/ATen/ops/_to_sparse_csr_cuda_dispatch.h,sha256=2zneEVNtNtJsmGqMEtzgKnbIJzMPGkUMtVTgc5-PCpU,1063 +torch/include/ATen/ops/_to_sparse_csr_native.h,sha256=nB1AxODFE5-BePuU2LEtUyRXiK9S1uUtqvruFofuY68,1191 +torch/include/ATen/ops/_to_sparse_csr_ops.h,sha256=Q8xIHK80JByfpCwCX0AcfUi2xUylxzbPUjAgwaD1KyM,2132 +torch/include/ATen/ops/_to_sparse_cuda_dispatch.h,sha256=Vod7kMRzpX64dSI2-Phj8-Z8RYPdJexkQDWv-2Pc8jQ,1239 +torch/include/ATen/ops/_to_sparse_native.h,sha256=nGDqIXARL3Ua7vn3vSf-6uZN1i7Y7cl4R8-gQMcvgXA,1939 +torch/include/ATen/ops/_to_sparse_ops.h,sha256=t_mGUuOtkdKFqFvj_E1LRFbIGAOJkRESvNgfa7qDEIQ,3924 +torch/include/ATen/ops/_to_sparse_semi_structured.h,sha256=6hCW4sMr4fQ24ln0aE-hkD7wERah8DNENI6KN-h-mgY,1045 +torch/include/ATen/ops/_to_sparse_semi_structured_cuda_dispatch.h,sha256=z7YnxrHqEWluwU34A5GvFCOPPUEsyFDAt-AqI2NhB1c,1050 +torch/include/ATen/ops/_to_sparse_semi_structured_native.h,sha256=mvKBrZbFXbkRfNEkIvhHkgjO_NthYWKHXJfl2qpRIAw,802 +torch/include/ATen/ops/_to_sparse_semi_structured_ops.h,sha256=xSS_eTe1ujEZuma0PJacWxMSqUZXRVv5gk6Pp8roxCM,1393 +torch/include/ATen/ops/_transform_bias_rescale_qkv.h,sha256=0DoGGTEIKbkPcIs01TVAMMWWOZAvs7nRizSKe5sceVA,2190 +torch/include/ATen/ops/_transform_bias_rescale_qkv_compositeexplicitautograd_dispatch.h,sha256=5f5uAmkAp3upnWUvYDIJk9M2krzqyr9KdO1rbO_hNtA,1444 +torch/include/ATen/ops/_transform_bias_rescale_qkv_cpu_dispatch.h,sha256=CqBvGFXPsWDqwqQNyidOZqZBiMfbNfV5z7XV_N4LmvQ,1106 +torch/include/ATen/ops/_transform_bias_rescale_qkv_cuda_dispatch.h,sha256=01Zu7EtOp2P-SOpopkDlg3Xo3WVjOZgCyaSIQe6YUEU,1108 +torch/include/ATen/ops/_transform_bias_rescale_qkv_native.h,sha256=SplbxBTP_kfO0Pb1dBLEm0i2a0bE9atUGCxOkf3fbhk,1252 +torch/include/ATen/ops/_transform_bias_rescale_qkv_ops.h,sha256=JlVpcfHw-QefMx7B1mcJL9eS3Eb0VaNZENU4kPTke14,2693 +torch/include/ATen/ops/_transformer_encoder_layer_fwd.h,sha256=cxIbyQSNt7vqO6wLJysHYW0J9ZFoVAQ75ui95sPRDJM,4932 +torch/include/ATen/ops/_transformer_encoder_layer_fwd_compositeexplicitautograd_dispatch.h,sha256=alKGS-dKiPXTutaW-ok5xXcbdbn0thcZg_d14n47oSI,2298 +torch/include/ATen/ops/_transformer_encoder_layer_fwd_cpu_dispatch.h,sha256=3tVXrOsWAHTvQ4VBM3qCDY_M_2P9w9Vn8bqAPKXGPwo,1585 +torch/include/ATen/ops/_transformer_encoder_layer_fwd_cuda_dispatch.h,sha256=LEjLbVO6UUtUCjJIhcJyck0CSXr6smSvclxv5rzz7Lg,1587 +torch/include/ATen/ops/_transformer_encoder_layer_fwd_native.h,sha256=XBgAl-annulZVuU6tH9CbgozrNw4Ric9ZtHDT3LK2y0,1986 +torch/include/ATen/ops/_transformer_encoder_layer_fwd_ops.h,sha256=X_1Swbb6hfglPIxzM-F0WVhWAYQC0KGnbQ0GQmO5Ses,5536 +torch/include/ATen/ops/_trilinear.h,sha256=ntSCN0IFPvdnO6EDWlyJNTJ373pzOXJT-9LFIxJq0f0,2309 +torch/include/ATen/ops/_trilinear_compositeexplicitautograd_dispatch.h,sha256=xwlow_4j1pxnH6k-X2eLn6IMOry0ej3yH_bcOV62jrU,1486 +torch/include/ATen/ops/_trilinear_compositeexplicitautogradnonfunctional_dispatch.h,sha256=4Ceft395LdQW67Oeus1to_qam3Hj3OnYm9mrgd_8too,1241 +torch/include/ATen/ops/_trilinear_native.h,sha256=sLmvO9yyHSYrv8omvGJoeJ15oYlUB2s_rWlG9POyTrM,1171 +torch/include/ATen/ops/_trilinear_ops.h,sha256=h0-3vZniFaBQVoUbhP_DwYqbZ-a6n7dJ9C-J0kZPnFA,2950 +torch/include/ATen/ops/_triton_multi_head_attention.h,sha256=d-hnXneGX-l6FvqQuSkXTHeoxqMb3KlQtDgDCEWaz7U,3013 +torch/include/ATen/ops/_triton_multi_head_attention_compositeexplicitautograd_dispatch.h,sha256=G92KZdEE08lRai2SsiK_S50c4wfskE1BRbW1jXmkpBw,1701 +torch/include/ATen/ops/_triton_multi_head_attention_cuda_dispatch.h,sha256=O2q2cOlQb2ioon29cB_DJIY7PR9o3xBRc-cGHHVxjJM,1281 +torch/include/ATen/ops/_triton_multi_head_attention_native.h,sha256=dXIPUaHcsNBzinOFmyE1Y4sshB1xcCu9iVF_BNFCUVY,1385 +torch/include/ATen/ops/_triton_multi_head_attention_ops.h,sha256=2wqL6Ejmnhrdxwn2dQ0B85OiCP1niq-HsNe56us7_zI,3634 +torch/include/ATen/ops/_triton_scaled_dot_attention.h,sha256=r7HiMMyWkOEkarE9aViiqcDDAASXkyq4mXfEbYlvBbs,1887 +torch/include/ATen/ops/_triton_scaled_dot_attention_compositeexplicitautograd_dispatch.h,sha256=GTyMMIzXPM_-PZD2_b-CBdSGley2zNrJAsYIRCoLrU4,1316 +torch/include/ATen/ops/_triton_scaled_dot_attention_cuda_dispatch.h,sha256=vmdGnchV2UPDcUIJVRaAMA8z8uRfDITx6uJ_Fq9wYvk,1089 +torch/include/ATen/ops/_triton_scaled_dot_attention_native.h,sha256=LuSv-Erqv0E9wDtTQUZiJcOHn1cO0ocGHjc6UDuZLNA,1000 +torch/include/ATen/ops/_triton_scaled_dot_attention_ops.h,sha256=RMvLZMq9bV_5EIEyr-j0Fs4T1Xzlj7ZORQp2WzuNi4Q,2386 +torch/include/ATen/ops/_unique.h,sha256=0s8mXmhdquZWp4PjlopsyH46yqQeW3SLnmRKzyMuLD8,1874 +torch/include/ATen/ops/_unique2.h,sha256=sL28-zLrUM2iE916Zbn0PT5bVQ3Xg0zpqbB9lu2mrOk,2232 +torch/include/ATen/ops/_unique2_compositeexplicitautograd_dispatch.h,sha256=qt_s8dcYIXckXJaef3J3AZyBPd7tvaRRnS1kzUqslj0,1437 +torch/include/ATen/ops/_unique2_cpu_dispatch.h,sha256=Xq5eH2hhNORw7WIJz6mcuDL95N4A6TwiIU4O2QCG4gE,1111 +torch/include/ATen/ops/_unique2_cuda_dispatch.h,sha256=MMeQKpwtNlvKlV-7k9LOSut8vfVfuWyHUShW4WePzEw,1113 +torch/include/ATen/ops/_unique2_native.h,sha256=LSVaSnGrulVOdU_I8-Q6Eh2FlwvOIvLHqdRYc88Fe68,1252 +torch/include/ATen/ops/_unique2_ops.h,sha256=4JpXkRnAMGIlQeelYukZHN0aF9Q5Daih-VnZ8IlYYx4,2665 +torch/include/ATen/ops/_unique_compositeexplicitautograd_dispatch.h,sha256=MSmxflY4eHGCJVc1a-v_cYfLtKD4kdwpM6G8ZzEx9z4,1325 +torch/include/ATen/ops/_unique_cpu_dispatch.h,sha256=tLFc1ObnPnKtkW2_iAgGuJYpHEMgv5TSkrmwADpceWI,1073 +torch/include/ATen/ops/_unique_cuda_dispatch.h,sha256=ISa7hdqdgXZRE43EFn1UXYyUYssKkKDJ60Fgzm8g7rQ,1075 +torch/include/ATen/ops/_unique_native.h,sha256=CAz1UPF6xRX2cp3JbuhXJr48lTyiXRe9LQSY6yNEa3Y,1123 +torch/include/ATen/ops/_unique_ops.h,sha256=anauts6hp7ENr0Zy58opbdw_dIT8mJ_OpaxujztTJiE,2354 +torch/include/ATen/ops/_unpack_dual.h,sha256=AHRvL02jz1EXiY_a-_Hh3_pvsmfy3h-660j2AAnQAiE,1040 +torch/include/ATen/ops/_unpack_dual_compositeimplicitautograd_dispatch.h,sha256=76e8lEvSneKod_y0qkuCn7hV0qJKD3mWdmCLRBv41Nc,1092 +torch/include/ATen/ops/_unpack_dual_native.h,sha256=TtL8EZ9HPU7M7wfBfJsnUVREvd7AexRBzEPdONt8hEE,802 +torch/include/ATen/ops/_unpack_dual_ops.h,sha256=mfQ4QSwpnd0mPgrP2-VQpH9FLIxrP1mI_YKW45XeMSs,1419 +torch/include/ATen/ops/_unsafe_index.h,sha256=AyjtC7LroPaFVJfVBqzuKdAsXb5VvCajKE9FePor1-g,1053 +torch/include/ATen/ops/_unsafe_index_compositeexplicitautograd_dispatch.h,sha256=mmJV4hJWN6slU-J5IQ4P5Rj9SUyvDcXh99pCSABq8oc,1109 +torch/include/ATen/ops/_unsafe_index_native.h,sha256=v7TBMe1eo3-6xuiD4NUrxKAwYX8cTMeMMy6rtibyLWo,819 +torch/include/ATen/ops/_unsafe_index_ops.h,sha256=8LoxyTSyUMLZY04WfpEZwTybOzpTq2kgoBT5BYzXTEs,1465 +torch/include/ATen/ops/_unsafe_index_put.h,sha256=y5vEq8OWX_0OJFJWS9ZNgHIeE_n67k1NyhP5Op0fsAU,1163 +torch/include/ATen/ops/_unsafe_index_put_compositeexplicitautograd_dispatch.h,sha256=CAjBGxXQQ0QzP0buFMCsHkEgxkLkKVlorAf36cYVAqE,1163 +torch/include/ATen/ops/_unsafe_index_put_native.h,sha256=So-V6m98Uwu8NAbVYUvopJmVgVjclR2PHXDgnHstPoc,873 +torch/include/ATen/ops/_unsafe_index_put_ops.h,sha256=EQeYQ0-Z2FUSDQCbz0NmugVZ8XMt2bMCyodlQ6fOZs8,1609 +torch/include/ATen/ops/_unsafe_masked_index.h,sha256=oC5NT9FtPsvJVy2dwqCssr8AqidVl2S0COmaaINd0Ho,1155 +torch/include/ATen/ops/_unsafe_masked_index_compositeexplicitautograd_dispatch.h,sha256=VgZS-mW3a2IMTZVHNansul6DbGLY2WGKszAhBjYcHUs,1166 +torch/include/ATen/ops/_unsafe_masked_index_native.h,sha256=VZXE5HKIMIgIB5MRFEgm0VHynlVCEk9SfG0smluDrEE,876 +torch/include/ATen/ops/_unsafe_masked_index_ops.h,sha256=1prbsR6-7ntLkX6moF9yIyLqsaey_Bi5SN0F2jB7zaM,1632 +torch/include/ATen/ops/_unsafe_masked_index_put_accumulate.h,sha256=4ot7ncGKc-YAl8KnIZsAls0JHHmlxP6HtrhKxFH-9no,1221 +torch/include/ATen/ops/_unsafe_masked_index_put_accumulate_compositeexplicitautograd_dispatch.h,sha256=rgE4KIBIf3RkVnMk6CfRTDl_nNkP0ueS5KHxP3Vdgc4,1183 +torch/include/ATen/ops/_unsafe_masked_index_put_accumulate_native.h,sha256=2rfFIpnAfmJKmzf10f2gRg_XIE6yxLdsPvevL3IO0fQ,893 +torch/include/ATen/ops/_unsafe_masked_index_put_accumulate_ops.h,sha256=xohDJzrPgZN-DSjKEwMbHJSl9I4UiGxsN3IRJV3XYXA,1683 +torch/include/ATen/ops/_unsafe_view.h,sha256=kekx6czVScKX-BvGtfmnuu9INmkepbB2H-vandDguUA,4028 +torch/include/ATen/ops/_unsafe_view_compositeexplicitautograd_dispatch.h,sha256=NE5FUdJcEBJfTTfp6tFFz0Kk1U0lCrC4MT5d4_ERO00,1620 +torch/include/ATen/ops/_unsafe_view_native.h,sha256=hvrbsmYu26haHP6kCtKsn9R93xbfo2cTtz7Co_xlhXw,902 +torch/include/ATen/ops/_unsafe_view_ops.h,sha256=c-ME8kj9pkfUWu5d2XxP7u6a1HheaKCVUCKqfy82ilk,2058 +torch/include/ATen/ops/_upsample_bicubic2d_aa.h,sha256=K4lUny3eaLg4G5LDw_fvroq6nRNqz2tp3AS_dmF1xHU,8475 +torch/include/ATen/ops/_upsample_bicubic2d_aa_backward.h,sha256=Irev6Cq1I9kp5QX4oBrD9MjI5PhsrUaE011MQUc8gQY,8159 +torch/include/ATen/ops/_upsample_bicubic2d_aa_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Yvenj5x74Xc7jmptxCjkKogK_C4yMBtzPyjMfgpM9cA,1556 +torch/include/ATen/ops/_upsample_bicubic2d_aa_backward_cpu_dispatch.h,sha256=P-AvNxFGAku3R_B5UslL3zYMFcqMVJZUMYVGWPMPsjg,2630 +torch/include/ATen/ops/_upsample_bicubic2d_aa_backward_cuda_dispatch.h,sha256=XX4UJg_aNMOi8_cZmqo1eLHbS1gRP8qyjpBpoZwQqSQ,2632 +torch/include/ATen/ops/_upsample_bicubic2d_aa_backward_meta.h,sha256=K-pVcGJ-YkUYBqxPDqqtrdfNpjHJm9oJr6WNGskaqLM,1042 +torch/include/ATen/ops/_upsample_bicubic2d_aa_backward_meta_dispatch.h,sha256=kdxk4d03t-rlorDb5VtGzBn6WdPxJye9RDusbuNNB98,2632 +torch/include/ATen/ops/_upsample_bicubic2d_aa_backward_native.h,sha256=Y6eo9_K4jIrQUijUYG4zkQnRDlHskYQCV8Mnj5KSTQ8,1498 +torch/include/ATen/ops/_upsample_bicubic2d_aa_backward_ops.h,sha256=dIZOYb-7t8nK4F6aI8_eYfw3WN28Yz83G9DY81yrMdw,3106 +torch/include/ATen/ops/_upsample_bicubic2d_aa_compositeexplicitautogradnonfunctional_dispatch.h,sha256=ErGezAaNs-_XLSmfDMQYaT8baXOGrjy5x8cOAEIamKw,1464 +torch/include/ATen/ops/_upsample_bicubic2d_aa_compositeimplicitautograd_dispatch.h,sha256=pfyfy6mV_NoEMuUpQ63HekQlqTy8MfeqyEaxFYAVuR8,1365 +torch/include/ATen/ops/_upsample_bicubic2d_aa_cpu_dispatch.h,sha256=tmozdEUq2UozI1L7x1ZQFVCq_Lcc4l25XmFwsx8mfsA,2326 +torch/include/ATen/ops/_upsample_bicubic2d_aa_cuda_dispatch.h,sha256=F_-wEklUkbG2WEuYrfUwKbvVKlJSWCI-Hm-I937hMZ0,2328 +torch/include/ATen/ops/_upsample_bicubic2d_aa_meta.h,sha256=i0tYyH0ipxEX6XUecCXgPxFq3oXSNcQn_Hc9hhkkGO0,992 +torch/include/ATen/ops/_upsample_bicubic2d_aa_meta_dispatch.h,sha256=qq5epF7GKM-UVzcn1OFPcah0Vt0H3LcazrSZtlJtwUg,2328 +torch/include/ATen/ops/_upsample_bicubic2d_aa_native.h,sha256=HlYlZc0EzxBZMwBSDg8po9Ia1KT1YQX8TQ_CvCXNQ50,1539 +torch/include/ATen/ops/_upsample_bicubic2d_aa_ops.h,sha256=_s2a24obJ5dwtmVteUuq0Iy3qa3iP-KPH7Dhra0EdWE,3693 +torch/include/ATen/ops/_upsample_bilinear2d_aa.h,sha256=W2_MhWdUOUGn_4Ade56nFx3Yps7N2ORZpG8T9DpJMwc,8516 +torch/include/ATen/ops/_upsample_bilinear2d_aa_backward.h,sha256=0fXBfOLNvLrcQ8zu_MYoWDwxkKABR6ckL-tTH2pOLOE,8190 +torch/include/ATen/ops/_upsample_bilinear2d_aa_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=oerbagWZ-LCUtJZmZOM5riCduGa_APOuGCA1jGFdIV8,1558 +torch/include/ATen/ops/_upsample_bilinear2d_aa_backward_cpu_dispatch.h,sha256=eRzmXfuDdIejvE_NCurf_h4A_hgZgwn0szgVq9W7xow,2636 +torch/include/ATen/ops/_upsample_bilinear2d_aa_backward_cuda_dispatch.h,sha256=TOFxQidaqutHfSvdiv_-KIWQrSe013PiwCmGIW5B7ks,2638 +torch/include/ATen/ops/_upsample_bilinear2d_aa_backward_meta.h,sha256=_z7t-0w-Z7KSgtJLupOZApBG3es6gcX-5CMb8BiuVeQ,1043 +torch/include/ATen/ops/_upsample_bilinear2d_aa_backward_meta_dispatch.h,sha256=NLNge5NjcYPWkjz2uSU4HLC1HVmBb5ZyedaM1MaecDI,2638 +torch/include/ATen/ops/_upsample_bilinear2d_aa_backward_native.h,sha256=ekEMin5fh_UuiKM6dPqO3VdwQsm6IoCruYymHiThpPw,1503 +torch/include/ATen/ops/_upsample_bilinear2d_aa_backward_ops.h,sha256=lRzYrrlCo0ssm3Mal0oFkqWIySVB9482meqPylm10ko,3112 +torch/include/ATen/ops/_upsample_bilinear2d_aa_compositeexplicitautogradnonfunctional_dispatch.h,sha256=rF6A7SYcSeaUd_aAH_43HU85reZH_AKIE7W6rzxQ7UI,1466 +torch/include/ATen/ops/_upsample_bilinear2d_aa_compositeimplicitautograd_dispatch.h,sha256=wNOY2TYE_PHJgs1RwDdJB10KaGfpfBc0N_QYFqL0On8,1367 +torch/include/ATen/ops/_upsample_bilinear2d_aa_cpu_dispatch.h,sha256=JxnyKbfmNbFGOy43yyNSch27YKrseFeYm3YjJayPc8A,2332 +torch/include/ATen/ops/_upsample_bilinear2d_aa_cuda_dispatch.h,sha256=tKUgf1-h1iTXiNaGoWrhUrIt23OpAHzDB3-SrLArKtI,2334 +torch/include/ATen/ops/_upsample_bilinear2d_aa_meta.h,sha256=UxLDRl8LdXMNQH30LOLP5yY868fpcAGJHbWxvTXTTLs,993 +torch/include/ATen/ops/_upsample_bilinear2d_aa_meta_dispatch.h,sha256=kTjBFMQF-VdwNIsNHNqvBbWG1hND0uXxyl5agGtxQKI,2334 +torch/include/ATen/ops/_upsample_bilinear2d_aa_native.h,sha256=5L7BBNdzFShVXOmnBtgqNoksIhzkpl77WMzmmCQztDM,1545 +torch/include/ATen/ops/_upsample_bilinear2d_aa_ops.h,sha256=Uq7ZvyOg0sRSG0Gcmb2xqD37u1mpmaJ3UAQQIuIVkR4,3702 +torch/include/ATen/ops/_upsample_nearest_exact1d.h,sha256=ex1n7AXCOSyZP88X1PcLQamGBsCmHQqyWF_g4FcdlOQ,7038 +torch/include/ATen/ops/_upsample_nearest_exact1d_backward.h,sha256=1LeIwtHTDcIYXGzrhrrnUUqmI-OR5sloKF-QZYtAvYI,6872 +torch/include/ATen/ops/_upsample_nearest_exact1d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=99DQ7nZLR5j-Sj2eJXhZRHj3G7sRAaeTGC-JvF3BLEE,1420 +torch/include/ATen/ops/_upsample_nearest_exact1d_backward_cpu_dispatch.h,sha256=YFCso6LDYjXN1gGI7Ix0gsLtrvGdiTizvaMovTfmur4,2252 +torch/include/ATen/ops/_upsample_nearest_exact1d_backward_cuda_dispatch.h,sha256=9qvP9s6J9WEOh8Aslj4ea51_4lTzZM_8Zpy7ChZbXa0,2254 +torch/include/ATen/ops/_upsample_nearest_exact1d_backward_meta.h,sha256=CP6ZbXjaBJ_I1mfyove-MCLD5OThVBNjy7HtQbNO1gc,989 +torch/include/ATen/ops/_upsample_nearest_exact1d_backward_meta_dispatch.h,sha256=P26-ch0orugN43kQqbswWetGWlXg5jzjMg98Cv5gupw,2254 +torch/include/ATen/ops/_upsample_nearest_exact1d_backward_native.h,sha256=Qp4W8GjqFXjYzwHLD_uwD2zn4UXUrst9qaXe_DQ-VTY,1401 +torch/include/ATen/ops/_upsample_nearest_exact1d_backward_ops.h,sha256=I2B4GZoO_Cft9A-rO8Y6StRgxV6DY8YErkIRAYZ809I,2750 +torch/include/ATen/ops/_upsample_nearest_exact1d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=kmlooZDL2bLxjJ3sBWm-_NB0bdan_pyPDwp5_WMISbA,1328 +torch/include/ATen/ops/_upsample_nearest_exact1d_compositeimplicitautograd_dispatch.h,sha256=6bCc7h5FgPSjraC2u8Fi6pxp5k2W8PGiHosq3puaah4,1331 +torch/include/ATen/ops/_upsample_nearest_exact1d_cpu_dispatch.h,sha256=P4Hz34GcEypVqJy5yGagVkf0ciF_UmExR6PWh5Hp0Kw,1948 +torch/include/ATen/ops/_upsample_nearest_exact1d_cuda_dispatch.h,sha256=XLTSTnUmz2-JHvADe23xWEePpE32DEzvuyXcK8uVZTk,1950 +torch/include/ATen/ops/_upsample_nearest_exact1d_meta.h,sha256=ZkYOGevfjk2dIIcD1SCYPjg8inmnLRG805Rmv_7W2NM,939 +torch/include/ATen/ops/_upsample_nearest_exact1d_meta_dispatch.h,sha256=08dxhGpzoqOlisRtbXZZeUwnbEaZ2d33nqUNAEj2hQ8,1950 +torch/include/ATen/ops/_upsample_nearest_exact1d_native.h,sha256=GnurPYvsyz5JokEywvu0i_sAu9vH_fDZnSLRadVrJms,1425 +torch/include/ATen/ops/_upsample_nearest_exact1d_ops.h,sha256=r0RpwPAdX_Ro5q8IkLDD4RhkeLwbQYrlcuZ1gJgnwUY,3280 +torch/include/ATen/ops/_upsample_nearest_exact2d.h,sha256=-xLlhixTfoH_yX_lcG3yTBwfRafHyMbPMmLr6_SGR28,7878 +torch/include/ATen/ops/_upsample_nearest_exact2d_backward.h,sha256=uUt0PJ8fCVcvXHq7W_kDZoOM1zi0hfhQNqCkP7w3FY4,7712 +torch/include/ATen/ops/_upsample_nearest_exact2d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Rbe8wS5Y52kZR_PMNsu92L6QmkKgp_63SpaMhHBGQG4,1522 +torch/include/ATen/ops/_upsample_nearest_exact2d_backward_cpu_dispatch.h,sha256=heOLY2vRBzf0zkZ4M8ZGUz6WW8E0Nm8qUMO2zdHGDZY,2528 +torch/include/ATen/ops/_upsample_nearest_exact2d_backward_cuda_dispatch.h,sha256=uv-w4FKcRipHO6J7KE45AMlD9IDT1j0EiGggjpG59LQ,2530 +torch/include/ATen/ops/_upsample_nearest_exact2d_backward_meta.h,sha256=0r3nT9Y-4hLMm-TvOR8XbldqjsXqraa31iulwLXjfwU,1025 +torch/include/ATen/ops/_upsample_nearest_exact2d_backward_meta_dispatch.h,sha256=sryONjrXt4XALrbgu_ANAERUZSydNzv32j9lDpC_z10,2530 +torch/include/ATen/ops/_upsample_nearest_exact2d_backward_native.h,sha256=JooAMcgzAq8_o0-8v9AQwsJGXLRfYOzDVKFzTLNm8zk,1473 +torch/include/ATen/ops/_upsample_nearest_exact2d_backward_ops.h,sha256=b-6Ekg42hiUJya3M-8u1UJ3OLAUy3bvqYa6S250NgA4,2992 +torch/include/ATen/ops/_upsample_nearest_exact2d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=xkcR4Bug9Lx5xM0BBXV68HbLdLl8Gbgw4ePQGPXolr8,1430 +torch/include/ATen/ops/_upsample_nearest_exact2d_compositeimplicitautograd_dispatch.h,sha256=R43hbNwyLfOSVMOXKawx3nLnU7TpR0mpQ5LQcunvtb4,1331 +torch/include/ATen/ops/_upsample_nearest_exact2d_cpu_dispatch.h,sha256=x_jq3kQijSyVpIpmPpP0_nQIops0lTPfLF4PPV9tVrY,2224 +torch/include/ATen/ops/_upsample_nearest_exact2d_cuda_dispatch.h,sha256=NzqE_DiNRHAU-rzywvdgENCGVo_1pkUjX0gQ6kFgLBs,2226 +torch/include/ATen/ops/_upsample_nearest_exact2d_meta.h,sha256=ZHElLGs61OWlaKKgaBivOZ79PI9DYu0MvP9yLy1HZ6E,975 +torch/include/ATen/ops/_upsample_nearest_exact2d_meta_dispatch.h,sha256=U73F8K_lfNuXZFSF46uoM0S1fZg1yTsBNzcBYrTeGvk,2226 +torch/include/ATen/ops/_upsample_nearest_exact2d_native.h,sha256=HqHUJJAZ2l-IAveAn20vQZmvLWM7LnqQ9Ui_wDq3uTo,1712 +torch/include/ATen/ops/_upsample_nearest_exact2d_ops.h,sha256=uWJJXTAOmiQHk3Kj9N1l8B82whF0YiWowdBHTnX20os,3522 +torch/include/ATen/ops/_upsample_nearest_exact3d.h,sha256=9s28rEMwEgFfBwt0uqFrQ1RpqwPFt9RjLDrxX2DR-Uc,8658 +torch/include/ATen/ops/_upsample_nearest_exact3d_backward.h,sha256=qpKCPiYNvfovuvMR5l3mPRgowcF8y1tcbZ0stQcQ4Ao,8492 +torch/include/ATen/ops/_upsample_nearest_exact3d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=nsennzGYIRUokHHeyZUFDrBZSI9Uaq-l1kJNRebivcU,1620 +torch/include/ATen/ops/_upsample_nearest_exact3d_backward_cpu_dispatch.h,sha256=U82RAHkABpjfka3MkkjCypR7VGS4wwzJYavlX58ZsKw,2792 +torch/include/ATen/ops/_upsample_nearest_exact3d_backward_cuda_dispatch.h,sha256=Q-RIwK3s1LI1Ai_phVwiu8uzX0d_UmOTa9l-NLM-Qo8,2794 +torch/include/ATen/ops/_upsample_nearest_exact3d_backward_meta.h,sha256=R6rVi82fhDErPXsfJwbbm_ZIjbN8Hk6h7C2AHrtDt3Q,1059 +torch/include/ATen/ops/_upsample_nearest_exact3d_backward_meta_dispatch.h,sha256=uXto6I7kWOLODEpm_MJH8E7I97Q-Czc1H6nh6IZ25xU,2794 +torch/include/ATen/ops/_upsample_nearest_exact3d_backward_native.h,sha256=zGE1clTULQ3KYlp6Q1UEGTQnxZu268IiAS-tIPEiMVo,1541 +torch/include/ATen/ops/_upsample_nearest_exact3d_backward_ops.h,sha256=PzNOjEc8eUhb93bXuZxfKcb6-EEAwkOF_5dM0BhndC8,3222 +torch/include/ATen/ops/_upsample_nearest_exact3d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=p_xegiDrniH4ZE3fKISDhrw2kjRcCA_yxitGKawvJbI,1528 +torch/include/ATen/ops/_upsample_nearest_exact3d_compositeimplicitautograd_dispatch.h,sha256=Atx404MiPHbI5jFEcmcseITCwgo74j4FcKsBJGJ6Cts,1331 +torch/include/ATen/ops/_upsample_nearest_exact3d_cpu_dispatch.h,sha256=Ah3JkoUvQmvefiAwN4dH_ju50NEpiJRM51oWchZIadI,2488 +torch/include/ATen/ops/_upsample_nearest_exact3d_cuda_dispatch.h,sha256=-FHvMojkCABBpByI1n-K01F1qnSVMhq5aFtLeXsnUI8,2490 +torch/include/ATen/ops/_upsample_nearest_exact3d_meta.h,sha256=Vim4NHsQXajSNR2rDg3UeqSPmIdhPeatHC6k0AQgaH8,1009 +torch/include/ATen/ops/_upsample_nearest_exact3d_meta_dispatch.h,sha256=qg__M-imbBwKmmR83H-GLd2xdt7GtXkAUD7sSTu44ac,2490 +torch/include/ATen/ops/_upsample_nearest_exact3d_native.h,sha256=Xp0UEgRyQFIM57mnfoanHPPOAOQP1_N0BLfFptFOyBY,1829 +torch/include/ATen/ops/_upsample_nearest_exact3d_ops.h,sha256=7P53thnkVCR7adzZkbKf5iqdDu4QE3Mm0AAqYGZwhyM,3752 +torch/include/ATen/ops/_use_cudnn_ctc_loss.h,sha256=lKyb9jVO9QXTmPB3PHlfHGfJAsMe8tHDyLr1D24NLf0,1640 +torch/include/ATen/ops/_use_cudnn_ctc_loss_cuda_dispatch.h,sha256=yq7K6mEHnt5gp45IejGzlBUvmfMB8O06wyZHaSAafhY,1301 +torch/include/ATen/ops/_use_cudnn_ctc_loss_native.h,sha256=GhCDZsbZLHzRwb-Tkw472PkJ7vGGHJROOSKlsMsyt_w,1060 +torch/include/ATen/ops/_use_cudnn_ctc_loss_ops.h,sha256=lFVmjqDybHq9MFeLVjVCQu7n_YKE0rtw88QXtsw-358,2554 +torch/include/ATen/ops/_use_cudnn_rnn_flatten_weight.h,sha256=nhrpiyKoWXB4bzqttai5quvdZAx7c4XIH26FYO5ZwJE,973 +torch/include/ATen/ops/_use_cudnn_rnn_flatten_weight_compositeimplicitautograd_dispatch.h,sha256=TiaIV2p-JdnmihM3XRBB6qd7_JvwzP3zXhRMXb7Ni5g,1040 +torch/include/ATen/ops/_use_cudnn_rnn_flatten_weight_native.h,sha256=MDH95CLYJADMc6F0rdBV0xxsAy8QSKuNRHvgbK4EW58,750 +torch/include/ATen/ops/_use_cudnn_rnn_flatten_weight_ops.h,sha256=867CYBAAMxg0rRCQrwy9D2cEZGXM1_yaVcXedvb2j2g,1217 +torch/include/ATen/ops/_validate_compressed_sparse_indices.h,sha256=yHYAeVdTWrnnP4POaqwlRpIXhnRJbbfX42gcBO-U6Lg,1243 +torch/include/ATen/ops/_validate_compressed_sparse_indices_cpu_dispatch.h,sha256=uWWffXEc_HCX4Ae4RUVNargdC_cKvuSnTgIGSCwPRTw,1119 +torch/include/ATen/ops/_validate_compressed_sparse_indices_cuda_dispatch.h,sha256=VeEwgw2HlS591eP4pGJDX4ymyu0JBUgRcRfAfK3KHYw,1121 +torch/include/ATen/ops/_validate_compressed_sparse_indices_native.h,sha256=xsi1IXb_zNVSGZlB4BlFqpEJ7WIdcS8tZhhR03JnjUc,1054 +torch/include/ATen/ops/_validate_compressed_sparse_indices_ops.h,sha256=VjKQtucfZ8bfh3B34vAk_GIugXbybuoFnCPiEfCujYM,1621 +torch/include/ATen/ops/_validate_sparse_bsc_tensor_args.h,sha256=aMmXzF9DW5c6CudEs1-GoWHPn4i7qcZAD1XGuRGvAP8,1293 +torch/include/ATen/ops/_validate_sparse_bsc_tensor_args_compositeimplicitautograd_dispatch.h,sha256=XTE-cq3_DKJW40YkhpuZoXreVjVPMv-RTe7wHaXGIfI,1207 +torch/include/ATen/ops/_validate_sparse_bsc_tensor_args_native.h,sha256=gt7Wvp9QxvIj0HDol1QaUKaaU1wQ_ApDyj6E6C-35LA,917 +torch/include/ATen/ops/_validate_sparse_bsc_tensor_args_ops.h,sha256=mUidXIuCIEwIWat9Hbj5AFLnQYxxIT_c6k5hZvBqfJc,1714 +torch/include/ATen/ops/_validate_sparse_bsr_tensor_args.h,sha256=NbjkZejmQBm0fxeta3ZPwzCMBM86ixoV1XQkNgiZiR8,1293 +torch/include/ATen/ops/_validate_sparse_bsr_tensor_args_compositeimplicitautograd_dispatch.h,sha256=-bXSiCUjGgIbVCN9keUBp8XpQ5x0QFM1Q_AE_tG-h-0,1207 +torch/include/ATen/ops/_validate_sparse_bsr_tensor_args_native.h,sha256=rZ2kMjVe_hvJF4S95FXJPAdCVRki2QJFjUoCfDoMUyw,917 +torch/include/ATen/ops/_validate_sparse_bsr_tensor_args_ops.h,sha256=ISplzp8d5i553RcoZqGu_EyNmgO1YgjbpKwmQEf4SW4,1714 +torch/include/ATen/ops/_validate_sparse_compressed_tensor_args.h,sha256=TCf9HeYCZBp3jJNcNX_OHfKJkhCBrUk7yctSKXzSm_8,1387 +torch/include/ATen/ops/_validate_sparse_compressed_tensor_args_compositeimplicitautograd_dispatch.h,sha256=JPDd8eTngzA2T-IE1ONKZAbKgjWh60TBx4AbWmSa3K4,1241 +torch/include/ATen/ops/_validate_sparse_compressed_tensor_args_native.h,sha256=7H7if_DBxh1AMlgR-qFZvh_NiusWBS104_xjD3glp6M,951 +torch/include/ATen/ops/_validate_sparse_compressed_tensor_args_ops.h,sha256=rNIbR3NWstVbQKxqDC18Kv4qOf-7exeMrMJVRCikAqY,1824 +torch/include/ATen/ops/_validate_sparse_coo_tensor_args.h,sha256=jZL4sRNgbYHNcS7_FLzUQLU5nEVYQCwCmuIIGO0ew60,1303 +torch/include/ATen/ops/_validate_sparse_coo_tensor_args_compositeimplicitautograd_dispatch.h,sha256=vaRMbkGRfWB0gebfDc3fVDxKzDV_RhLbYTNLhiY360Y,1221 +torch/include/ATen/ops/_validate_sparse_coo_tensor_args_native.h,sha256=fsyuvvxUjl924nv3sbxCxP6AJ14n6zPMXsuBD9mf_O8,931 +torch/include/ATen/ops/_validate_sparse_coo_tensor_args_ops.h,sha256=stM8GcUhDCJVKbWzc1-8xjzBfU4xzhFExKmjfUDc3RY,1715 +torch/include/ATen/ops/_validate_sparse_csc_tensor_args.h,sha256=VJSjndI5RhTwpW5bYHogKnY85ZXxijRrTz_Mf5j01bk,1293 +torch/include/ATen/ops/_validate_sparse_csc_tensor_args_compositeimplicitautograd_dispatch.h,sha256=67mPNr0_RWVhXH3gNxqqa7ZyeMicT3v5ypkX0xaVTLE,1207 +torch/include/ATen/ops/_validate_sparse_csc_tensor_args_native.h,sha256=oFc2xTnrTXABVosFkD4aqx0sSzrGX4VXGtFqPGus_Kc,917 +torch/include/ATen/ops/_validate_sparse_csc_tensor_args_ops.h,sha256=7ZGZ1UerBARETQWwX5djI-3pyYIU40rCWEb-iex01bg,1714 +torch/include/ATen/ops/_validate_sparse_csr_tensor_args.h,sha256=kmQoNWXpD8tS2j8mWuhRHKEjID8O9zHuWEsvAJBRe6k,1293 +torch/include/ATen/ops/_validate_sparse_csr_tensor_args_compositeimplicitautograd_dispatch.h,sha256=4YBeZtfaBdxrd0D2tw9Ps47in4H4OJ5Bw1XfJZXKtk0,1207 +torch/include/ATen/ops/_validate_sparse_csr_tensor_args_native.h,sha256=uP6B1DDIr3cvTiA7HvGW6_wZMJtT1RZMrjHyAHDOUGg,917 +torch/include/ATen/ops/_validate_sparse_csr_tensor_args_ops.h,sha256=Op7rTxDWAyNUJ_4m_iDb1CpmkE-Z3bq4WIS-pMfnHr8,1714 +torch/include/ATen/ops/_values.h,sha256=z34vKbdWYCqHdX2G_i0oDcsCs0WQUx8uw0qv5dollvA,790 +torch/include/ATen/ops/_values_copy.h,sha256=U-LERmsguRNtX30lJlbpFLzt2b_jucDZMJIsGIJa944,1386 +torch/include/ATen/ops/_values_copy_compositeexplicitautograd_dispatch.h,sha256=ySKT9jJskPPc1CAPYh4bxlRJORkRKBkOje9U6i7KG_k,1162 +torch/include/ATen/ops/_values_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=71X5JOf8Sy7W2CMKHrMvzCaZiVTEBcSx7BUPSjHGK9A,1078 +torch/include/ATen/ops/_values_copy_native.h,sha256=DAUXAKzbWGMFXwKLEQsB2N6q74nEE-AdqUXyo_NG4OQ,847 +torch/include/ATen/ops/_values_copy_ops.h,sha256=oyl8w8M_BYST4kQgEbn8KJlk78V71YaYfYqiTAjAKMk,1882 +torch/include/ATen/ops/_values_native.h,sha256=4gyLtYjFTVMrbyzuN5nmZZm1a1ZGapSI795lFWALwnw,764 +torch/include/ATen/ops/_values_ops.h,sha256=hbecgP9nRCjecWVJROYMhDgj6DbUoNmw-cIRQirRIxw,1254 +torch/include/ATen/ops/_version.h,sha256=oqydbsRIzogqv899J2KqNITAi51J1Itmhr9L3d3dJsY,791 +torch/include/ATen/ops/_version_compositeimplicitautograd_dispatch.h,sha256=Q1hLI2bwICf_l9FlHH6XjeOg1kTR3H8JqS5UlMWHGxM,1045 +torch/include/ATen/ops/_version_native.h,sha256=v4bJTBBFjk4eAk1_3Og0sACCN5R2vMRf0quuSQoX0Dc,755 +torch/include/ATen/ops/_version_ops.h,sha256=N_RHZ7RNfoDkU9K_4tF2wVw41FY7UlEUyjVCO3_oSLE,1239 +torch/include/ATen/ops/_weight_int4pack_mm.h,sha256=spZeGl-UC4CSjbPRRorWHihxdi7LmCqByoEZDzYuptc,1145 +torch/include/ATen/ops/_weight_int4pack_mm_cuda_dispatch.h,sha256=ioNB48xqtbii5dEdUR64Ef4bnWPTDcB0ogSbPWn9Qzs,1097 +torch/include/ATen/ops/_weight_int4pack_mm_for_cpu.h,sha256=KB1AHYtlnBJTq54nJeurvoQgDd0EMoYOs5zNc5GEjUs,1177 +torch/include/ATen/ops/_weight_int4pack_mm_for_cpu_cpu_dispatch.h,sha256=GFfEl-rd9h1gm8AhUlt7tAl4bOGM4QVDK43JIfVKkFQ,1103 +torch/include/ATen/ops/_weight_int4pack_mm_for_cpu_native.h,sha256=44OqP-jKqgsBBA6dTHUap-u4hr1A9yZroY9UQL6XrAg,853 +torch/include/ATen/ops/_weight_int4pack_mm_for_cpu_ops.h,sha256=q3x7XcSWScx3mMTsOuFnlgLWU4wnm3jFwv4uZCuIxZE,1569 +torch/include/ATen/ops/_weight_int4pack_mm_native.h,sha256=EgFgemPo4Ga1lIMoB8XL7jUGoVS6gA3JlPtXOztpnes,854 +torch/include/ATen/ops/_weight_int4pack_mm_ops.h,sha256=VhBo0iHBbwBeLBwCIAwnNMq3l-IE65WDmRb8-_Yaqd4,1545 +torch/include/ATen/ops/_weight_int4pack_mm_with_scales_and_zeros.h,sha256=N5ccPDaWauV2l2PyihDroAMBBHGmvpAG4M_LC-utfCo,1259 +torch/include/ATen/ops/_weight_int4pack_mm_with_scales_and_zeros_native.h,sha256=YX7OnfNb_sH0shOehK5IicUsmA-qqQcgPsV5l3mVxmc,701 +torch/include/ATen/ops/_weight_int4pack_mm_with_scales_and_zeros_ops.h,sha256=hrUerj2wBHdSamq6fb6YVRkZVVGXB8znOifUfyJg3Ms,1676 +torch/include/ATen/ops/_weight_int8pack_mm.h,sha256=gp39ZWu9i4723Ha7eQJ-YRNq73gP0IF0dgDig6cYG4o,1073 +torch/include/ATen/ops/_weight_int8pack_mm_cpu_dispatch.h,sha256=Ezty2wkTIAlJjCInHxYn5qYjPkmBecVOq0n0dx8akHk,1067 +torch/include/ATen/ops/_weight_int8pack_mm_cuda_dispatch.h,sha256=NFRhU3Gs4TmfonAGbBBXqI93MdmUKwjsEbBMMd7X4NI,1069 +torch/include/ATen/ops/_weight_int8pack_mm_native.h,sha256=XnQaUCXcjqVhSuPLjOIhwYilPWIqCn9tu7r8BseFpoM,950 +torch/include/ATen/ops/_weight_int8pack_mm_ops.h,sha256=ASA8wZfRoUS8mEAD6znlZJqL9n_ZOltJlBt_gUIAsGo,1456 +torch/include/ATen/ops/_weight_norm.h,sha256=EKw4tDZ3TsLSeyJl2E3y06A5DC66uvlqCqi84GnJJPM,1008 +torch/include/ATen/ops/_weight_norm_compositeimplicitautograd_dispatch.h,sha256=09qfskrKTOUFjejumkGVtl6QDUT3apn9wYSVxGw4MJI,1086 +torch/include/ATen/ops/_weight_norm_differentiable_backward.h,sha256=FenBgby24K3QR938g7wGbyg2g8DpYHK5tIUpZ0bhOXc,1286 +torch/include/ATen/ops/_weight_norm_differentiable_backward_compositeimplicitautograd_dispatch.h,sha256=jNSdoAuD1SC82Iy0IIzQols4U8FTJaNoMxp49VxBg0I,1204 +torch/include/ATen/ops/_weight_norm_differentiable_backward_native.h,sha256=1-EAQIocF5QOUFFBabfB8-_Y-GM1ft8F6zc6CHTuqk0,914 +torch/include/ATen/ops/_weight_norm_differentiable_backward_ops.h,sha256=ctbhpZ_-7jk7wO9SngleIV6FFe1SCHA75fK3BiVHRtc,1758 +torch/include/ATen/ops/_weight_norm_interface.h,sha256=2JS8gqesgQz-7_gNRF1lYW18IZorOrNuWyBJv-BkhL0,1862 +torch/include/ATen/ops/_weight_norm_interface_backward.h,sha256=Fj26gHEVWwDgWMoRm_Nk67m2uzmoVDCjmAToCpWbn28,2395 +torch/include/ATen/ops/_weight_norm_interface_backward_compositeexplicitautograd_dispatch.h,sha256=cnh0hG-OTCaWFX5Nmelje7mHyKxm8IIwCfO1QC3VrRA,1500 +torch/include/ATen/ops/_weight_norm_interface_backward_cpu_dispatch.h,sha256=-xXgM1x5b-U4kG5RpeM3ZdgSt6XCzl3FIYNinuk_a1Y,1155 +torch/include/ATen/ops/_weight_norm_interface_backward_cuda_dispatch.h,sha256=YHtk_2Mvdb4sroyyo-px8eT84OQaymjkmW_jvdKJ-ds,1157 +torch/include/ATen/ops/_weight_norm_interface_backward_native.h,sha256=XikOnHrh27GV0HJCs8RXhz70bRddNwIrb5cDDXVgFGI,1358 +torch/include/ATen/ops/_weight_norm_interface_backward_ops.h,sha256=WZx1mCzKjmoLsXNCNltli75bDL1u-D_OUsp61oeLgE8,2924 +torch/include/ATen/ops/_weight_norm_interface_compositeexplicitautograd_dispatch.h,sha256=-sb1VuVeZjq0mxZ2IwnSVOZQqmBTroU39hK6Kkh8qSk,1342 +torch/include/ATen/ops/_weight_norm_interface_cpu_dispatch.h,sha256=VYwSQ8lPd0rtoIXNKKaiaadSq76qKAILZXf_tj1oiZw,1077 +torch/include/ATen/ops/_weight_norm_interface_cuda_dispatch.h,sha256=xmKzd8IcXGWIXW5AWHonWKflWx4OaMEWH2iCsoSh6B8,1079 +torch/include/ATen/ops/_weight_norm_interface_native.h,sha256=yrAcN0VENe0pK1L85H4Q7Yt9w71-7MSFhTooG2RekX0,1122 +torch/include/ATen/ops/_weight_norm_interface_ops.h,sha256=QslVj9fdlXaxyxQoYSGexpJM_LTQ7ovMnZZ7IBZiTbk,2416 +torch/include/ATen/ops/_weight_norm_native.h,sha256=QiX3WCalP6iXlbDPeakV9Yba7eiNanLP2PUDypQzvFA,796 +torch/include/ATen/ops/_weight_norm_ops.h,sha256=rIuyYMqvLpgsP8Q_YOAmYIA5Q5opRqmjzhVuj37K-bE,1374 +torch/include/ATen/ops/_wrapped_linear_prepack.h,sha256=U_Z6Xvmu1Tm_eVyVdgOzS0mfBsrS2zta4zEkDNKBgoU,1196 +torch/include/ATen/ops/_wrapped_linear_prepack_compositeimplicitautograd_dispatch.h,sha256=I4LSZVCVMlg89I683qdirC4w6YsWe9zDQ0_6xgxSYTA,1161 +torch/include/ATen/ops/_wrapped_linear_prepack_native.h,sha256=e22ESIWJEs8Cf1E2XpqR5Td3X5KY5oAA2YbrIou7pJ4,871 +torch/include/ATen/ops/_wrapped_linear_prepack_ops.h,sha256=2kqqDgckAap6NsPR3TwJiJvh0UrAYu1gVD_d6EYSZrQ,1614 +torch/include/ATen/ops/_wrapped_quantized_linear_prepacked.h,sha256=FpsyCw_SVRCi5wxC2GEge0D3sfNu2qOy4tdFfKBivv0,1464 +torch/include/ATen/ops/_wrapped_quantized_linear_prepacked_compositeimplicitautograd_dispatch.h,sha256=wDIMADRyp1Ie5RD4ftY6JP173aypowiqgPkfNZcfFQU,1271 +torch/include/ATen/ops/_wrapped_quantized_linear_prepacked_native.h,sha256=oyKb_2utP5qtHdb8fRUIjjgBvfFI_-D8Mj3tIxyDclc,981 +torch/include/ATen/ops/_wrapped_quantized_linear_prepacked_ops.h,sha256=deX-5bHFR-fCxoa9KV7s7MyrKDpReb94tEYmu9XDjJs,1965 +torch/include/ATen/ops/abs.h,sha256=m698RM2gT50Odv1liHTnzZlmV-TtrqusMCHU765xymI,1434 +torch/include/ATen/ops/abs_compositeexplicitautograd_dispatch.h,sha256=y9qrjDbbscD9P0WhvOH4SmiOtHbsCqUFmcjlTnasO0Y,1092 +torch/include/ATen/ops/abs_cpu_dispatch.h,sha256=5rXbEURnFvbsxlLVqv3jshhjJvMUKJNh7Y6cS-ACV4g,1100 +torch/include/ATen/ops/abs_cuda_dispatch.h,sha256=5_Upt9wxCVqv14kXf3Lj2iaeXTxAhzfKFfAgO10VnYk,1102 +torch/include/ATen/ops/abs_native.h,sha256=b9_TOPg2Fx8M9UH8L9PQ6XQjDOCVT6GSLYRQvfzMk94,1413 +torch/include/ATen/ops/abs_ops.h,sha256=Q3WMYMkVl4f-XAJ_lpQyDajbxtZgeZxGoaIlEoXHfVs,2329 +torch/include/ATen/ops/absolute.h,sha256=XJU355kmJILYQF9Be0IVuip7I29CzszS2it4MnppS54,1346 +torch/include/ATen/ops/absolute_compositeimplicitautograd_dispatch.h,sha256=2giLV5uuEuV8drxBMAofXhsvoHk6iXHHmpaSA98SoRY,1265 +torch/include/ATen/ops/absolute_native.h,sha256=N0xXgxD-y97nAy18A93KOaDtO8EBUizZf8ygsNlJFzg,893 +torch/include/ATen/ops/absolute_ops.h,sha256=SMlOSsI3oZpuu6D1jPmUr9gLiINHaY6ITvdvdUhnaeM,2374 +torch/include/ATen/ops/acos.h,sha256=wn4KjvregstxkpDYcH7LmsL7QhE0Dqovf1knQr6hi0Y,1447 +torch/include/ATen/ops/acos_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Mdna8RlsKbHNPk1sPo4tPdvcxixKLVzy-dG6kSi1_Oc,1120 +torch/include/ATen/ops/acos_cpu_dispatch.h,sha256=31Gl4repjsKRsH1-8ZYYusccOJWuHKqHTDLSMLxHB6g,1205 +torch/include/ATen/ops/acos_cuda_dispatch.h,sha256=nPqKFSb9oLP-vEu6qcGOf6mBHCc9MWzAAZ1xm9aZbVk,1207 +torch/include/ATen/ops/acos_meta.h,sha256=kjMsJNA3JW_e9peA9StY8PKnqOZQ0CurvpI5lGpreQE,851 +torch/include/ATen/ops/acos_meta_dispatch.h,sha256=vcCY8mV58jocsqyc6sJMo4E7cOyTtcX7sOJwdoYiyrY,1207 +torch/include/ATen/ops/acos_native.h,sha256=SbPDxavGUfI0jC-bFBw8G9JMN3p9bPVFvjgQgIlOvAw,872 +torch/include/ATen/ops/acos_ops.h,sha256=Nckoq3V9IQdk10invrIyxmgkxhQVYDI83x4c9B7g_38,2338 +torch/include/ATen/ops/acosh.h,sha256=RB_bFMltfl_mjRI2NUHOeG-UF7fQJbawEO1swJJisM8,1460 +torch/include/ATen/ops/acosh_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Jb-4gl9bF4Ch8zK3wB3VnRpnr_B9rRbXGKOudQCUvGw,1122 +torch/include/ATen/ops/acosh_cpu_dispatch.h,sha256=BkuBpNyUQKFhRre-sYg0VdKza5Ig6S33vE1vuosdbh0,1209 +torch/include/ATen/ops/acosh_cuda_dispatch.h,sha256=HDgMtYR10XAA2NkUn69wNbcU69ZWsumih-JXP6dfKNo,1211 +torch/include/ATen/ops/acosh_meta.h,sha256=qrkJ8BD0Hgh7h9AFDH52sS9GJIttypoq1rXjRDFwwJs,852 +torch/include/ATen/ops/acosh_meta_dispatch.h,sha256=__IW9YSX8a_m-CdKhn6iT9EE-PI-Is8BfLwY7dfjk5Q,1211 +torch/include/ATen/ops/acosh_native.h,sha256=82NeksKLFu0lTWH6aBJIwetHMRGJb3sVIkf0sggvZbY,875 +torch/include/ATen/ops/acosh_ops.h,sha256=9V2nKwHedyqBNpY-63dYM6BGJ2rTW_WWmSuv76iFqAw,2347 +torch/include/ATen/ops/adaptive_avg_pool1d.h,sha256=rZ89WOT81a-Y8R-xkuwV9jGKUq8hmRMeXEXWe2NIaIY,1642 +torch/include/ATen/ops/adaptive_avg_pool1d_compositeexplicitautograd_dispatch.h,sha256=S1QivVdwfDGZq5ncmOYtlYRyNUR7crFtVMHP1z6lMKw,1234 +torch/include/ATen/ops/adaptive_avg_pool1d_compositeimplicitautograd_dispatch.h,sha256=JeS6zwuJMRbzWxhq2OQZF2KSkA--q9-02YVgIl2QjYY,1088 +torch/include/ATen/ops/adaptive_avg_pool1d_native.h,sha256=JnO-K0zq85HvStuiSO_DzB5dE8dmSvYDLRxrNBnAviQ,919 +torch/include/ATen/ops/adaptive_avg_pool1d_ops.h,sha256=rZoGFtbZa1jIagLqnrcLK3W9tdQYjQidsnWFegMlaiY,2114 +torch/include/ATen/ops/adaptive_avg_pool2d.h,sha256=XtGXA7niXvlmnLSUkC6LGceeEzOt4MRs3OK7aFPJiXw,4461 +torch/include/ATen/ops/adaptive_avg_pool2d_compositeimplicitautograd_dispatch.h,sha256=Ra3yWBew61bKTTbJFSJt0xQi6Pviz_Lh5pHjCP_jeqQ,1196 +torch/include/ATen/ops/adaptive_avg_pool2d_cpu_dispatch.h,sha256=8vhwnOhTfTBvQ2Oa_XbaO6pU8S7tw6x5FC2NiDW3-L8,1455 +torch/include/ATen/ops/adaptive_avg_pool2d_cuda_dispatch.h,sha256=6IFdbIU_UXr-IajYAPhbft9hn4PAavNe5nKeq7OMaRs,1457 +torch/include/ATen/ops/adaptive_avg_pool2d_native.h,sha256=FxZd3KZznjq5qq5BcnZzkG6mWHaSjSxoAqtN67K-zOQ,1193 +torch/include/ATen/ops/adaptive_avg_pool2d_ops.h,sha256=VoVYL4AOuqcxr-2L6HCLwe6FZ0iD-EruJJf-XHLjnpQ,2144 +torch/include/ATen/ops/adaptive_avg_pool3d.h,sha256=59ko7JpVFLrq5QpGb31_aQRtowkLnHpXnyJQkLfNAxY,4461 +torch/include/ATen/ops/adaptive_avg_pool3d_backward.h,sha256=XlVQZAU_66rKxdRPZP5tXdE-NuUYKb9vIJPNZWUP_1k,1540 +torch/include/ATen/ops/adaptive_avg_pool3d_backward_cpu_dispatch.h,sha256=VdkSaCPPmavhdWlY8cGlCkprBKYoqunGRDlkHvj5z8Y,1228 +torch/include/ATen/ops/adaptive_avg_pool3d_backward_cuda_dispatch.h,sha256=O91He9LXmgK0vEIkXlPRSv_OXNPftqE7MYOnZ0EHZ8E,1230 +torch/include/ATen/ops/adaptive_avg_pool3d_backward_native.h,sha256=FfKIbVSE2YCZpHzBtCqDOLSVZ9Om93QPIydy4wpfGTI,990 +torch/include/ATen/ops/adaptive_avg_pool3d_backward_ops.h,sha256=DHHv1jkPoeUdfK2ix3oSuY-__hWQ9QB6WBvz7WlV1tk,1547 +torch/include/ATen/ops/adaptive_avg_pool3d_compositeimplicitautograd_dispatch.h,sha256=K1KdAj1yqc4eT-BUHg_hC2_lvIXG_Jrldq2W93kyu0c,1196 +torch/include/ATen/ops/adaptive_avg_pool3d_cpu_dispatch.h,sha256=AVPP3MMMh-pxzkuV5TpNouyeOPxO-P-b7fsiYonO-Qo,1455 +torch/include/ATen/ops/adaptive_avg_pool3d_cuda_dispatch.h,sha256=0ZUaUAaNPz160Tilcb3n5fO062AUjYDL74YGDPV0yRg,1457 +torch/include/ATen/ops/adaptive_avg_pool3d_native.h,sha256=bCPSy3WNiI9vGNXXXUNuv0BAAb4izmrdTn_0kJU4DMc,1195 +torch/include/ATen/ops/adaptive_avg_pool3d_ops.h,sha256=zQ82ZG5XslyKZil_YmOjYG0rJhUu_ajCzB9Tf01pv-Q,2144 +torch/include/ATen/ops/adaptive_max_pool1d.h,sha256=cUc2Y4ZtYuUbV-vcXB2lVc8zmFCIAonvkDnzNWjW3Pg,1076 +torch/include/ATen/ops/adaptive_max_pool1d_compositeimplicitautograd_dispatch.h,sha256=qu-uMa4VvB2MRlcGm2wn0xawVgQSPczRygAjKcGQaWs,1113 +torch/include/ATen/ops/adaptive_max_pool1d_native.h,sha256=jOUHzrhrczfC-xRScTx0WLxNIn3MhQElCkVDon4YlM4,823 +torch/include/ATen/ops/adaptive_max_pool1d_ops.h,sha256=bufxTJZStGnSeF3KuFrczj9AEqbRU0oLwI302DjhE6Y,1464 +torch/include/ATen/ops/adaptive_max_pool2d.h,sha256=S7px-3vsD43NGNxjmHv2y6GgOSNGXQnNtuWaxg0JiU0,1861 +torch/include/ATen/ops/adaptive_max_pool2d_backward.h,sha256=lJiE0IEE8PYuRD7DLY-QNQWtGEAIKlh_up5ylRoyk_U,1970 +torch/include/ATen/ops/adaptive_max_pool2d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=qL4djTpM8Iiuzne2z9paRBpC4RwR7ESC4RtDk3sVHSQ,1154 +torch/include/ATen/ops/adaptive_max_pool2d_backward_cpu_dispatch.h,sha256=7ehDWmCUK_Jps1QOrM3uiGwKGcX7R2ahRsox48fSUCg,1421 +torch/include/ATen/ops/adaptive_max_pool2d_backward_cuda_dispatch.h,sha256=WtH6Ewyp8j6KYB6PLl9QdjVzgeE_znLgRYqBw3UCfvU,1423 +torch/include/ATen/ops/adaptive_max_pool2d_backward_meta.h,sha256=sUYMrNKFuabCriJ_YrHzIlbnyo2fdMfqacCw83DfeK0,935 +torch/include/ATen/ops/adaptive_max_pool2d_backward_meta_dispatch.h,sha256=pvMZxP-iF0SoHHOdMMdwathtYlq8jjIe5cBtqC075Rw,1423 +torch/include/ATen/ops/adaptive_max_pool2d_backward_native.h,sha256=vhJZrDnh-NwtrDXqeXyWgXAHrxqG_I7QEzhEcgg32rg,1275 +torch/include/ATen/ops/adaptive_max_pool2d_backward_ops.h,sha256=7XGNUFQu-liYBqi5OYMgdIQtvDsx0EErKEaU_bhchAQ,2412 +torch/include/ATen/ops/adaptive_max_pool2d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=OI59PAyXwVcUycpDMBd9yJy56DiSRpvOYOHzIISxQBg,1139 +torch/include/ATen/ops/adaptive_max_pool2d_cpu_dispatch.h,sha256=DBheaWxo0PpeQY_nGndWUc6uoO1JurjTAl_sR3g72k4,1410 +torch/include/ATen/ops/adaptive_max_pool2d_cuda_dispatch.h,sha256=Tk43lnZccxqByp3NpaZcP-jZ9haVQA5-GIIFjgO0mUw,1412 +torch/include/ATen/ops/adaptive_max_pool2d_meta.h,sha256=K4njJWeI14kLX3mclkey5nFLYqii1CX2ULDPqBXYlBo,895 +torch/include/ATen/ops/adaptive_max_pool2d_meta_dispatch.h,sha256=meIj533YJb7PqwOqHZwdG6XSiDqVCkHtV0LQo_8-ysY,1412 +torch/include/ATen/ops/adaptive_max_pool2d_native.h,sha256=_kUGaoOn8bRFIUWhXUDWIRPzRCkT0KfYGHadkmkrcd8,1210 +torch/include/ATen/ops/adaptive_max_pool2d_ops.h,sha256=Lwn0w1Mo-nvmgplegINhACJvqz-HPsxga1cd_GrywJo,2372 +torch/include/ATen/ops/adaptive_max_pool3d.h,sha256=GLD0EjhMBUrNKDxeZxybxOhBMujlcvEFNZE89YZU9NI,1861 +torch/include/ATen/ops/adaptive_max_pool3d_backward.h,sha256=rNXhqpDsAEkY2oesVRw0aCotQbOcg9GO4kDi_R7htqg,1970 +torch/include/ATen/ops/adaptive_max_pool3d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=lB2yUg_XxF2AjriWEBNL0YzhDjxlVORz5k8FCZdZW04,1154 +torch/include/ATen/ops/adaptive_max_pool3d_backward_cpu_dispatch.h,sha256=0X200Mt25FkOz4OYt7GNpUO6Dzsq9I_qtwFrWxEOzNI,1421 +torch/include/ATen/ops/adaptive_max_pool3d_backward_cuda_dispatch.h,sha256=G7wMpS7_VwgNEiRwcs8n-Ldg1d0p7L06P434EmgBwAw,1423 +torch/include/ATen/ops/adaptive_max_pool3d_backward_meta.h,sha256=dJNNO_-Hah7GEs5BNGKngU8z6F51jd1wMVpGCRdkOGs,935 +torch/include/ATen/ops/adaptive_max_pool3d_backward_meta_dispatch.h,sha256=uytvmzhrsEfrDpZeciYXPvaeOuP0baX-2nBgMWzVcJI,1423 +torch/include/ATen/ops/adaptive_max_pool3d_backward_native.h,sha256=q-JhGJZ-MqEOn8w0uiB8B2Qo4RKHCkJpxfv1UHowBEA,1275 +torch/include/ATen/ops/adaptive_max_pool3d_backward_ops.h,sha256=WYzqfGHX8EgS48xOZh0OIr0CxOUn78uV3KqpC-VkOWQ,2412 +torch/include/ATen/ops/adaptive_max_pool3d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=VGkQXPDhIh66kq_aKgPv95C_EXKiZd9Np2gHYiP1bpI,1139 +torch/include/ATen/ops/adaptive_max_pool3d_cpu_dispatch.h,sha256=5jhdVbSMqCRGtq9s3s1HUxS2NLJ1bPYyGNzJS5snvv8,1410 +torch/include/ATen/ops/adaptive_max_pool3d_cuda_dispatch.h,sha256=UU3Fvx0X_DuBfGcocVDCp_6BLph4z3QV9kS8cDd04BM,1412 +torch/include/ATen/ops/adaptive_max_pool3d_meta.h,sha256=eX5kcDOuvg5k0_WVEP_h7gjzpSbp-Sh8MJBBdzm3r90,895 +torch/include/ATen/ops/adaptive_max_pool3d_meta_dispatch.h,sha256=O6UOCWoTXIQzCa_WujZ4paB2-zrwrCTxaB8pS0zQEPA,1412 +torch/include/ATen/ops/adaptive_max_pool3d_native.h,sha256=YuQTKIzGIiJFf3uUe1YST1CfQTH4GkvvmMC7ilVOf1k,1210 +torch/include/ATen/ops/adaptive_max_pool3d_ops.h,sha256=5gcbwO4BwuorqAVxuc7Uqa-jYtMg90OykG1kbNgXoSI,2372 +torch/include/ATen/ops/add.h,sha256=h-FJn2ah2DFPwjFwA0Xf0L513id7c7OAc0DI8JwUERo,2451 +torch/include/ATen/ops/add_compositeexplicitautograd_dispatch.h,sha256=WSHf9sCtVafhrcaAOZxhZBl6BWwJQ0_3vDuhRdY15Uo,1459 +torch/include/ATen/ops/add_compositeexplicitautogradnonfunctional_dispatch.h,sha256=vlTykbZCV4m5vAvgdAObXJAd1rFv5b5q6yGUHzVZA-o,1226 +torch/include/ATen/ops/add_cpu_dispatch.h,sha256=EV2y3ntpfrI7GHgZ97o11dnQTnoPSX0eglnSytp6S9I,1415 +torch/include/ATen/ops/add_cuda_dispatch.h,sha256=23PEHVwRUe9-5imu8CNnJL15Fs99Jpy_A99UnoZ6-GA,1417 +torch/include/ATen/ops/add_meta.h,sha256=A_6uDiLbVkSDJVcOWlx9tK7JHPXMRBEAzN_ZioYvIPw,909 +torch/include/ATen/ops/add_meta_dispatch.h,sha256=JirRduL7aBNm2ZaNNHjN0Dg_xdTO6-D68t7ljCSBLDk,1417 +torch/include/ATen/ops/add_native.h,sha256=77nowLiw4YE5YhiFj43hOHAhXZvrTYaLg0z7qEb5AtU,3240 +torch/include/ATen/ops/add_ops.h,sha256=BImGKpWYvaInuIAuz2MhjryJTuNVmjDf7g0vrHwB2vQ,5075 +torch/include/ATen/ops/addbmm.h,sha256=IPeLWSxdQfRVNVs2VYzNo3VGgrjH6QluTqlWP0wYn30,1922 +torch/include/ATen/ops/addbmm_cpu_dispatch.h,sha256=2P0CuxUv0edkKlL8zFpoJX3LkTujsLBudSJY2ichLRU,1645 +torch/include/ATen/ops/addbmm_cuda_dispatch.h,sha256=s9-aqrwapHwnGL2xCXSbtmdnoPU0_csUNbWKdRKsUEQ,1647 +torch/include/ATen/ops/addbmm_meta_dispatch.h,sha256=SHjE41GJ6FPKeLcGFj0ahXwzNNgJ6CAfIs2zL_HvY2g,1110 +torch/include/ATen/ops/addbmm_native.h,sha256=fHkGDPh51jyV6uLQGwT-rJcyEuwxZYy4h8yYrg6Eqak,1210 +torch/include/ATen/ops/addbmm_ops.h,sha256=FS2DCPrFv-XWVcW0SZLLAgJntPYu0pmzzgOKmWVU_N4,3415 +torch/include/ATen/ops/addcdiv.h,sha256=HPjCUJ2lI0-q8JTMSJxzWCBjHO2vkvczwl-6Bl7FAuQ,1808 +torch/include/ATen/ops/addcdiv_compositeexplicitautogradnonfunctional_dispatch.h,sha256=YJEbUrzFVzram-Sdigpd_CamyD-wshZFEf0Mm7rdU24,1294 +torch/include/ATen/ops/addcdiv_cpu_dispatch.h,sha256=d5kfrXuWeAAuzVxwDKpr4xrAVA7t7g7tU6QKrJCbvgs,1551 +torch/include/ATen/ops/addcdiv_cuda_dispatch.h,sha256=Gb4BIUeC1za47OlT6fQhUpJAXj0PHBp4oLFYqnNak4w,1553 +torch/include/ATen/ops/addcdiv_meta.h,sha256=a_1xiPMPuntGgV3yswMCVOYJychd3YZnHfB4vXoFBgU,936 +torch/include/ATen/ops/addcdiv_meta_dispatch.h,sha256=JEzNPIJ5WovzTzjPVhyB7nUg9dw3_5DlB8rA9oUCvig,1553 +torch/include/ATen/ops/addcdiv_native.h,sha256=wBSstFY51u1CxK42XCWcDg1dybe7J-3QqCUhsz6M5dI,963 +torch/include/ATen/ops/addcdiv_ops.h,sha256=g6soHXKUhF_vy-vuFA5iwLN8TxRW-e7JnHbpBREjC10,3187 +torch/include/ATen/ops/addcmul.h,sha256=dmA3v1aqpfTOgHjamTZdnjKlrbEeSFBU1L8uNxRmfL8,1808 +torch/include/ATen/ops/addcmul_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Cr9BuVDcr8CrTpJWFRbak7UVmd8iueCc23L6dDHfdXo,1294 +torch/include/ATen/ops/addcmul_cpu_dispatch.h,sha256=4jtWlNhL9A-A_O1n10sRHPLCtSExY9uH6jFMhIIJZp4,1551 +torch/include/ATen/ops/addcmul_cuda_dispatch.h,sha256=0cJAN3nq-l9mzgyXH3a4hJCNEGMbWX1im00daI8nUog,1553 +torch/include/ATen/ops/addcmul_meta.h,sha256=vTS1FRzzlGdhwAan3n3I9g3d4Qtg5pFXBK7zOTgCJfI,936 +torch/include/ATen/ops/addcmul_meta_dispatch.h,sha256=-SI42GwtNJEFA4HneDxvATzwx7rx5Ct8v26_U5quAQ0,1553 +torch/include/ATen/ops/addcmul_native.h,sha256=EPMmKrNRGflvUNFVqN7viWOMrVnhDOzfZ9B2svKHmQI,963 +torch/include/ATen/ops/addcmul_ops.h,sha256=O5G8j9YlNSQtFABRSIAfhDPd7rJDo2bsvRfygytxRkE,3187 +torch/include/ATen/ops/addmm.h,sha256=cd6F-3QBKvpnsUIj9t9cBUVFFFncZuUiJf4y7BjKto4,3179 +torch/include/ATen/ops/addmm_compositeexplicitautogradnonfunctional_dispatch.h,sha256=mqZOqiA9wu9GsDjtAy_e1I5b4iBMbN121n27lA9ESzc,1332 +torch/include/ATen/ops/addmm_cpu_dispatch.h,sha256=S_Srd4lpDDwSCIx9eA2cCWO6tgnCWlODhR6eXQJD3P8,1625 +torch/include/ATen/ops/addmm_cuda_dispatch.h,sha256=i4bKbaep0S52q7vqbF3rn4Lho-uXqa_q3OCtkkwbVMs,2227 +torch/include/ATen/ops/addmm_meta.h,sha256=dsJlXQ6eSlg7_vPHoG_G7UFfv3o99ItkMsGgpBAGtTE,953 +torch/include/ATen/ops/addmm_meta_dispatch.h,sha256=CYb-YJtEF78MMQhfga6uKG2LlCjUAcqHVzEfz9w-EMw,1627 +torch/include/ATen/ops/addmm_native.h,sha256=ZrMvwgr7WKdbkKxs1MrbECKy2P_13u5yIcl20Arafms,3325 +torch/include/ATen/ops/addmm_ops.h,sha256=boCklhLO4NZMoce4ifCi0JRBhFka8RrdVAUnYcAigF4,5372 +torch/include/ATen/ops/addmv.h,sha256=ckvw-rdyctTIMUoXNhfv1SWTEz4P2IU5aRcSyaKchCA,2186 +torch/include/ATen/ops/addmv_compositeexplicitautogradnonfunctional_dispatch.h,sha256=iwD-p2gwpLLYwyNr_STh1diSj-lzueLAS4F_jx8gLdI,1328 +torch/include/ATen/ops/addmv_cpu_dispatch.h,sha256=KzIXnZrlKC_z9c_0FXRDUnNxNcJBAP8uiYZU4oQBdvU,1617 +torch/include/ATen/ops/addmv_cuda_dispatch.h,sha256=G7eFeRauWRpnAu95uKP0NjVEj9CRLXrMK1aowzRMKUs,1619 +torch/include/ATen/ops/addmv_meta.h,sha256=JOrA0BNZceqaj2skdTay-gqybktjHT27mxhKA6X_o-A,951 +torch/include/ATen/ops/addmv_meta_dispatch.h,sha256=QzIYzSq9Mxco5Uas2gnQipC-DzQOMPcSt928RQCnux8,1619 +torch/include/ATen/ops/addmv_native.h,sha256=U5meoqcTU_RPuUoC5NtMiLWyYCwDfN0yXR4F9oU4abI,1619 +torch/include/ATen/ops/addmv_ops.h,sha256=t6fR3JfV7oa9SYHjEMPlCBMVsv2f78cYBg0cNn9MjqA,3352 +torch/include/ATen/ops/addr.h,sha256=2exHgkSdxXAk9h_CqyC7g6mEDIojfd8NOA5Fdgxz22Y,1866 +torch/include/ATen/ops/addr_compositeexplicitautograd_dispatch.h,sha256=8F30TQpuHJomFr_pru8UCaYObykq__WeVXoYU567dGU,1665 +torch/include/ATen/ops/addr_cpu_dispatch.h,sha256=NoBS4h9ORlQ9trA9gwFOmnppOpZuVrLR_Bhk-zkuuT4,1466 +torch/include/ATen/ops/addr_cuda_dispatch.h,sha256=OSUTtdSQFnumqnLmJ61OZTZOulgd0qIAI2HWCn7mjdU,1468 +torch/include/ATen/ops/addr_native.h,sha256=d_rxYrjz0T3CHQJg1qepfv3l3msyDf7e2Je8pN1isQA,1538 +torch/include/ATen/ops/addr_ops.h,sha256=UBfoaXXpOtYCxXOEz-fYBVWTrCOlrEPbIwVNCNX2U1s,3361 +torch/include/ATen/ops/adjoint.h,sha256=3gPxYK1j9lSsqMdnXqFwlHOM504esrWdwzSOqokr-LU,937 +torch/include/ATen/ops/adjoint_compositeimplicitautograd_dispatch.h,sha256=KmwW4OjmajMoKsLZbjgvJ69pKmFsGNdeNISy69nEesU,1047 +torch/include/ATen/ops/adjoint_native.h,sha256=CYBqYYEVsxI-3Q-lakXu3YSd4QM2BjsY6uRtoCgtNYg,757 +torch/include/ATen/ops/adjoint_ops.h,sha256=C2H6xN2EFl5UWdq_PGt-c_uZtbyOZpMHDOEQl5PGdFg,1254 +torch/include/ATen/ops/affine_grid_generator.h,sha256=xytxsXv4t5Orcvjoh3NRw-7DcdOietx9FSFLGUkYucU,4877 +torch/include/ATen/ops/affine_grid_generator_backward.h,sha256=cCsp42E-SsHshzT3H9XIrnpnGc5niYXnGa5VXOPAlPM,2124 +torch/include/ATen/ops/affine_grid_generator_backward_compositeimplicitautograd_dispatch.h,sha256=T-CjcacIXqLlPDhdYQc6xjwdqmPKgqpDLWp_KbZN1ow,1244 +torch/include/ATen/ops/affine_grid_generator_backward_native.h,sha256=oVIG04BCkxn-FChH3gRr1VQJ2suyFbACWHSjGmuYDdQ,822 +torch/include/ATen/ops/affine_grid_generator_backward_ops.h,sha256=82myXLWvnesr3yFu1Ylzm4oY3s-bS2Oa15zKdVOjKf4,1471 +torch/include/ATen/ops/affine_grid_generator_compositeexplicitautograd_dispatch.h,sha256=zGqiZ9Fexz_Gf5ILgweaBM3Bv0zYPh64si604E0pkjA,1800 +torch/include/ATen/ops/affine_grid_generator_native.h,sha256=RqxXnNePMwZ7XmXDAX17U2OFsmE5wtTYGfuJ8eBM_GU,962 +torch/include/ATen/ops/affine_grid_generator_ops.h,sha256=pNF3oiG17aGPU4AdNvxF2Bfq1SOKGirxMc4Zd9jv1BM,2250 +torch/include/ATen/ops/alias.h,sha256=GWV8hKlYrb8fQ1R8rIV02VLVOkSIyovcGx3cefXACYg,929 +torch/include/ATen/ops/alias_compositeexplicitautograd_dispatch.h,sha256=Jvpsvf-sLn03YqM_VtnLSrWLXqMm9zfcWGdj7oalHa4,1045 +torch/include/ATen/ops/alias_copy.h,sha256=zTjCWZupV799y6AV0TJbse-zmov7C-mAFuMNNt1B884,1366 +torch/include/ATen/ops/alias_copy_compositeexplicitautograd_dispatch.h,sha256=jn25rPpww8NzXlUA4ql5_DsLm2aGGr1AvHveG4JYLjQ,1158 +torch/include/ATen/ops/alias_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=1eEm_kKOTN1pBDtoke7dBGLV3AK0CsX7cZQmVk26NiM,1076 +torch/include/ATen/ops/alias_copy_native.h,sha256=GtriOseXKphXojaAAGxtg66DT5OcSooHdmX0bIJlBUk,843 +torch/include/ATen/ops/alias_copy_ops.h,sha256=LyBcFSj5fDbI6vD46xbqRtZE5qYFpIRLwLSZtq8vYAw,1870 +torch/include/ATen/ops/alias_native.h,sha256=bb2p_Tw-LYAYzc3ZuzEMBv8SkPerw3Y9CdPtl39GI8U,816 +torch/include/ATen/ops/alias_ops.h,sha256=LKbgXlmZEGJ0y0bG_YxuECLkjQqLG6QnfMVCUrT5Myw,1248 +torch/include/ATen/ops/align_as.h,sha256=bK9xLQYeBJQX1FfyfVxX87bN2vYvce5DEBreT1LaYGo,791 +torch/include/ATen/ops/align_as_compositeimplicitautograd_dispatch.h,sha256=rbG6lswnJrs5IH-xa4WqHtE5ZJvIjSx2gfuhyGNIrWo,1074 +torch/include/ATen/ops/align_as_native.h,sha256=XtbxiXFy7R1l-SpNDUl1UK4f9cxfA9TN6YRVg8quvVA,784 +torch/include/ATen/ops/align_as_ops.h,sha256=3k4SU7Huq3Ppzo_BGlTbxeZeHFfydLIQezrG0M8Ijs4,1337 +torch/include/ATen/ops/align_tensors.h,sha256=pCqGKoREHept6WYlz2VdQ6Ng0-ORHX50IWKw5DbZFq8,979 +torch/include/ATen/ops/align_tensors_compositeimplicitautograd_dispatch.h,sha256=x0pz_D_9vEWmGeznsZYTG_44xUBommotmtjQsidJPnw,1067 +torch/include/ATen/ops/align_tensors_native.h,sha256=DKP6uOMFLrxmLX1oUQzzjHHai1z08iVAtHMibsZKwhE,777 +torch/include/ATen/ops/align_tensors_ops.h,sha256=fJze2Jqir91wElzk4F7QwsDMpr1FzeJOFAfgY2O5Azs,1312 +torch/include/ATen/ops/align_to.h,sha256=Hqym5Bx7VcpODJdZYu-heGmDnqJTikto0uRm6GOdwV0,791 +torch/include/ATen/ops/align_to_compositeimplicitautograd_dispatch.h,sha256=6Mxp6KiLNknnrV4YxkUmx145YOX28IeO0O0ZlztC3D0,1173 +torch/include/ATen/ops/align_to_native.h,sha256=4X-S7khSDI8CNX1Tmj0ZbyBW8ohyjAXIv5JdcT8H50w,883 +torch/include/ATen/ops/align_to_ops.h,sha256=rNBM6khfroKS_cI36NMBzztXXaNu8TNujwi3fh0gYfQ,2049 +torch/include/ATen/ops/all.h,sha256=NBCHcFm7CTv-7fvSBOryrXWzvg6R_L-B5sQghXth9Ik,3696 +torch/include/ATen/ops/all_compositeexplicitautograd_dispatch.h,sha256=K-OW1lG-fAs2VmuD3L8UCosrGsUo6AZT7CPKfS10-Ak,1337 +torch/include/ATen/ops/all_compositeexplicitautogradnonfunctional_dispatch.h,sha256=4AyFedBdpQ_5uaaqLC1wZ2JeB53QholUr_ER1C9rnJw,1255 +torch/include/ATen/ops/all_compositeimplicitautograd_dispatch.h,sha256=ZojfeT6HyJ_olWfZvF3R1ky0k3Qiuop80ViWpn7HF0c,1301 +torch/include/ATen/ops/all_cpu_dispatch.h,sha256=orRzP2znzBEcJqX55HeSIEPSsmMy10lO1yEzmS8OGl8,1796 +torch/include/ATen/ops/all_cuda_dispatch.h,sha256=LTC7gUS8d4Ama9f9AC10qBOksIX8p9zPcVhSwKADiVM,1798 +torch/include/ATen/ops/all_meta.h,sha256=1VAcANwKEv1C7SrbYTHSm5PmOavrSjJVO7ckbSBeths,1153 +torch/include/ATen/ops/all_meta_dispatch.h,sha256=uP2lZTI9EjHmi9nq_DmEWrPTBY0_oTSLTlDHU4M9Xas,1798 +torch/include/ATen/ops/all_native.h,sha256=Lla9V4cL1OqPbhvBpOl2WcyLiSUSXgUJWiXNc1PKDL4,1788 +torch/include/ATen/ops/all_ops.h,sha256=1DRsuhldBv9UHjVtBs2OY5vUbhPQgFiuD4R2clbEEV0,5941 +torch/include/ATen/ops/allclose.h,sha256=2lTkmvCeVTDbJohEjBdIc-t5LQ6qugeRESWYiMdcCmY,1115 +torch/include/ATen/ops/allclose_compositeexplicitautograd_dispatch.h,sha256=AwT8EvYKsx9LhXQn-AbTMNfis6Ik4Nj8I-RR34j02vE,1128 +torch/include/ATen/ops/allclose_native.h,sha256=qSNRfXlt5nV54OkIuiGraRAP9wkpNhKjPCYqzk30ZWY,838 +torch/include/ATen/ops/allclose_ops.h,sha256=jGUyA1mjNjZbPWEXyrF0lkJpCtkRFqZ4Pv2zQaL_f-A,1481 +torch/include/ATen/ops/alpha_dropout.h,sha256=u1aH2QnT9QrOSA1fiqNJhmph3N9PnBH5tv-xxCkgRlM,1232 +torch/include/ATen/ops/alpha_dropout_compositeimplicitautograd_dispatch.h,sha256=Q-swNFsFdPab-MeJyGDy_9rEDajoZLw2AvZeTXlU4Ho,1157 +torch/include/ATen/ops/alpha_dropout_native.h,sha256=xlaq1sKDd3_WkE_oMbFON72gfnYn4hZlGTWm9bFO7H0,867 +torch/include/ATen/ops/alpha_dropout_ops.h,sha256=vOOgiLzTdFcgv1cUHBTLH5-usEfDcE-shyIPJ8NfmIw,1958 +torch/include/ATen/ops/amax.h,sha256=EuJ9kn3Oc90JHFUMZTk4Lbh7av1CMc96ieIUYQIcMok,1576 +torch/include/ATen/ops/amax_compositeexplicitautogradnonfunctional_dispatch.h,sha256=S1TtJw2D40uOTlM5-K8NPUFi3ircI0bESXEOF3Sx46o,1114 +torch/include/ATen/ops/amax_cpu_dispatch.h,sha256=sQcUdnRPHKWykKZ7BNHR_q78e9yxy4FV6agCiBHECuY,1278 +torch/include/ATen/ops/amax_cuda_dispatch.h,sha256=V1UE49AlkFR3ObjaJL3ppUYdD_Dg7tQr9-znQPf7Wlw,1280 +torch/include/ATen/ops/amax_meta.h,sha256=Ca5NSmt_BDSQZ9gj6FwDP0f6SV_iCWCytqKkWa_qJUk,886 +torch/include/ATen/ops/amax_meta_dispatch.h,sha256=r_IIkNXhH_BE5NoOy20p0UmQEmi7CXVW7YU-942KI8g,1280 +torch/include/ATen/ops/amax_native.h,sha256=6ywd9C3KfCWiAnTCpB-FeiZ_t27pJt1vdnPVZYSZyBw,907 +torch/include/ATen/ops/amax_ops.h,sha256=awGA4m8yF70HfMXUkuzT7elV05A6O4znCTvmQ4kXuQo,2090 +torch/include/ATen/ops/amin.h,sha256=drw68EEkDZcfVdM50zCEaTlJfMYIR4iK2XJLCTUKlsU,1576 +torch/include/ATen/ops/amin_compositeexplicitautogradnonfunctional_dispatch.h,sha256=96Dxit-XY6Ztjv1oMcxRR-umsLuVGFHogiS0HP8_qKs,1114 +torch/include/ATen/ops/amin_cpu_dispatch.h,sha256=449O8W98e_pbudHpvpCCVj189Pf2tKpLlHJHsIHrx6E,1278 +torch/include/ATen/ops/amin_cuda_dispatch.h,sha256=zqtMUUSh_-TDVQ65Yqj0SBziQfehE7bkVbr3JxHoyko,1280 +torch/include/ATen/ops/amin_meta.h,sha256=jig_wu5n-5-w8o25pqX3qbzkBFj0CZdOUNQpZ-dZ2Nc,886 +torch/include/ATen/ops/amin_meta_dispatch.h,sha256=GO3gzevXSpFHu86mzoFGzTdjtM-NwssRVdUHt8zQSr8,1280 +torch/include/ATen/ops/amin_native.h,sha256=SfLt-6BcFe090JrAs4a55X8-t5tILYzuXhdADLdSXak,907 +torch/include/ATen/ops/amin_ops.h,sha256=gpxjPW3H9_B0QAEGA2mDcdipg-q_tj5EtJyn05DISq0,2090 +torch/include/ATen/ops/aminmax.h,sha256=eVOaSZ0ytJh6Gi2sjCboXlCT_FihclYEC8J8bKNooBQ,1879 +torch/include/ATen/ops/aminmax_compositeexplicitautogradnonfunctional_dispatch.h,sha256=lfwqhp1MLJ4ik8374pGYvlXFpJ-x2yugJ8iV5BDEfwM,1163 +torch/include/ATen/ops/aminmax_cpu_dispatch.h,sha256=X5FJww5xymfpMZWGLxweTbR61zkex_-Z2R4__hXpDwQ,1453 +torch/include/ATen/ops/aminmax_cuda_dispatch.h,sha256=KzT0zazS-tYdndqbn_gKl-_WT3ASoHeRF9CZ8c44LKI,1455 +torch/include/ATen/ops/aminmax_meta.h,sha256=4q0lMjEcMqmDcfi0Jdg3eas45Zm1LRKzMdBA-n_6Uk8,898 +torch/include/ATen/ops/aminmax_meta_dispatch.h,sha256=_xIl_Y5QZMbujFUh8-njktPCflP138SizeAxuhqQ1ZQ,1455 +torch/include/ATen/ops/aminmax_native.h,sha256=T8KjGsfYHfdiGrOQK3fwLLpQftgF-sdnqcN_WRttxrI,949 +torch/include/ATen/ops/aminmax_ops.h,sha256=sl05B7w4T98mOdKIWGLEaQKQMAj6m1kZAD3KcwyLWQI,2427 +torch/include/ATen/ops/and.h,sha256=zH-IvUzBivCBuLbpdskTsNwkwUijj1SsSJWVL-LvAVE,1192 +torch/include/ATen/ops/and_compositeimplicitautograd_dispatch.h,sha256=Kqc0Lvac-7RuK6tc6aEan-CUwrzXtzC9y0Aq52QHLQI,1313 +torch/include/ATen/ops/and_native.h,sha256=Rullx6e1b178PcW8taDReiPmgwzExXdxrYjMLDana3U,1023 +torch/include/ATen/ops/and_ops.h,sha256=RWCEIUdwyu8ME1iOKdgmf3ehuDLUXGIuGXCrFINF1Po,3212 +torch/include/ATen/ops/angle.h,sha256=NJdzl1GaZvzq819ldUv0EyaHAvoBDNg_5SF8cdyFmq4,1316 +torch/include/ATen/ops/angle_cpu_dispatch.h,sha256=UkoRDJTDwXbYRy5SdgshbAznsPLVEfMvC1abZB2EQPI,1158 +torch/include/ATen/ops/angle_cuda_dispatch.h,sha256=xETR7zf7-EcMh2mZEcjk7yigXTvjzYAjqd51_PEgkO8,1160 +torch/include/ATen/ops/angle_native.h,sha256=hjjIUYYDD70EVmm1ryubKzNx2CMq6v75pD53tETes94,987 +torch/include/ATen/ops/angle_ops.h,sha256=2auhp2ROGCMSq1fSjZEZ3TrHULUyxaR_p9_gLWCYqEw,1840 +torch/include/ATen/ops/any.h,sha256=gyKGF1jSr3dCRi4hB0FfTT5OAvtjQP-QQ9s1dh5_kNA,3696 +torch/include/ATen/ops/any_compositeexplicitautograd_dispatch.h,sha256=SbYpPe4F4NcDA2E8rPapYyjnBRqHOjA38E88H8x_864,1337 +torch/include/ATen/ops/any_compositeexplicitautogradnonfunctional_dispatch.h,sha256=XUFAniKWBZibjghXp8vBJKQ72k5hZSmbZZeWWeVYM2I,1255 +torch/include/ATen/ops/any_compositeimplicitautograd_dispatch.h,sha256=V8nmEKrK40JsmLfVTZkz4o_PuCxMTp-i84OZ-ZBbi_w,1301 +torch/include/ATen/ops/any_cpu_dispatch.h,sha256=gOGU1faZeLKC_2yBl5PJt-EPJKjfRNXYy2Hf226xJ0c,1796 +torch/include/ATen/ops/any_cuda_dispatch.h,sha256=9maniyLKyp0JZF4HLJvsNzaq8vhIosSUIDQUOi7ppx8,1798 +torch/include/ATen/ops/any_meta.h,sha256=L3ckFizuLI4S-oFoa-Mh0cqeu6zX4-0NQF3ljrlJIeI,1153 +torch/include/ATen/ops/any_meta_dispatch.h,sha256=w3EbQtXM-XrCTAVoeIc6DkqHBKtxZyUjqpqytvZx9lY,1798 +torch/include/ATen/ops/any_native.h,sha256=uvPwaxfYWgw4EJlI-O89gGAsl6PMaCz0Bwa6D7Sq_74,1749 +torch/include/ATen/ops/any_ops.h,sha256=o8b0J0QIay5aaU7xdUoB-Y_55p5jD8DVGVewWx48I2E,5941 +torch/include/ATen/ops/arange.h,sha256=I0bEnXliLq6-9YBnd1WRfzxN0btgxyH5cFujZYzInc0,4501 +torch/include/ATen/ops/arange_compositeexplicitautograd_dispatch.h,sha256=gx8TGlLnqFPJDdlBDx3eR1pPpZcnaJERLKnE3bDV0zo,2151 +torch/include/ATen/ops/arange_cpu_dispatch.h,sha256=gg0u1is5K6-t8zhy1NSRxh9lJr5x3-X8JEXzdh4KfJE,1206 +torch/include/ATen/ops/arange_cuda_dispatch.h,sha256=FHp9byFT7bZ56LQRcI2o_Wi_D3tp9C-EHVawWvh36Mk,1208 +torch/include/ATen/ops/arange_meta_dispatch.h,sha256=xv92RARl2zO9lUCQ5nEO_U2-QG0HhuRLJ8-lS1lAzKQ,1208 +torch/include/ATen/ops/arange_native.h,sha256=XifO7HKBu5qso0pXp8mUUU6g2uSs_MMok5ycHT3tgik,1754 +torch/include/ATen/ops/arange_ops.h,sha256=kmdIuy3_v598dKrpBwEz02mniClk3A_5Xj3R6PW7l-0,5437 +torch/include/ATen/ops/arccos.h,sha256=lKAO2oV6rYz2uiuDddCxgv27D4D5LWFHLuEu3YDpy4E,1473 +torch/include/ATen/ops/arccos_compositeimplicitautograd_dispatch.h,sha256=wsBGAQwjOacpPlC38KRiItK-PLDrn0wNHEhOncr8n1I,1257 +torch/include/ATen/ops/arccos_native.h,sha256=3QNqY1wNzWRsLr9fuOaBdM1a-5Jq6qTkU5JVvBh4Lss,887 +torch/include/ATen/ops/arccos_ops.h,sha256=Z9mvacfQCS4OSgO8Y9Tan9Mc-dgXNKDIU4yCaOGxnyE,2356 +torch/include/ATen/ops/arccosh.h,sha256=c6WLuqv2sXBUz_YC2h1tMOSrJCjTxCiE4w_umWaqDLw,1486 +torch/include/ATen/ops/arccosh_compositeimplicitautograd_dispatch.h,sha256=ORpELfVypen1CHAQZf2BR-dyu6Zxujm2OPjBG7KwnX8,1261 +torch/include/ATen/ops/arccosh_native.h,sha256=qbxTejKnfvcyetx5GvTGbeF625yHxV85ZMACWjdFw5s,890 +torch/include/ATen/ops/arccosh_ops.h,sha256=Iy3RdrQ72Wwj3NPCUfDxyu8lKNOFBMmQ7f9BEeVrP8o,2365 +torch/include/ATen/ops/arcsin.h,sha256=rrwyRwHHnhrlfeMqETT5ZLkQe8FYVmkwePocnbnweX0,1473 +torch/include/ATen/ops/arcsin_compositeimplicitautograd_dispatch.h,sha256=7OHdtqvmxwlPpf85IiTKVrb_LXo7L6rsgI6O9tyXeqY,1257 +torch/include/ATen/ops/arcsin_native.h,sha256=yWnUk3_6KomlLQoc0DP2F5KW23A13nV8MIIsR1oLjEE,887 +torch/include/ATen/ops/arcsin_ops.h,sha256=Kvpzs0hABfATeQMzZvVkkn4BNIjghhud87sxIvcSTck,2356 +torch/include/ATen/ops/arcsinh.h,sha256=Lm8zJyI3ArYvSRqxkOamOeVZKAKcz753nXJSRoo47-s,1486 +torch/include/ATen/ops/arcsinh_compositeimplicitautograd_dispatch.h,sha256=aha3Sluak1n4VUmlBLy5IuIZxYh3yzzIsjeteCNRTZQ,1261 +torch/include/ATen/ops/arcsinh_native.h,sha256=6DaHRc29cbPqhbZ_USTIpm95yfM8rI-2F1kWbNgExWQ,890 +torch/include/ATen/ops/arcsinh_ops.h,sha256=RDKbCqmjycGk-ofN4Jq_xK2UsbOMOHV-GB2Eyl1nHhg,2365 +torch/include/ATen/ops/arctan.h,sha256=9qhF7tmI9gj1UP7kzXUBfU88X4iiI-nyfmCreRA7Qdg,1473 +torch/include/ATen/ops/arctan2.h,sha256=A4m8yLghBrwv_mGuSHhfiXJZhUxLNMYv5VkZL_PNoiY,1477 +torch/include/ATen/ops/arctan2_compositeimplicitautograd_dispatch.h,sha256=7wn2_NX0sQqIFTm1W0f_WdxXIauwr972ZtVYiO5IOAg,1365 +torch/include/ATen/ops/arctan2_native.h,sha256=xSZLNffGiY5R3-uuIADAJ4UAu-gJ5AMG4W2lJ4s9q6s,968 +torch/include/ATen/ops/arctan2_ops.h,sha256=-JoLDTnFSDYQLKB_-2yl8_Rj5tKCiRSpZABYPHqDSes,2623 +torch/include/ATen/ops/arctan_compositeimplicitautograd_dispatch.h,sha256=ATFliSeUJLWgTslDgaecpqZDkzHWfVY9wkt2Z1Mr7b8,1257 +torch/include/ATen/ops/arctan_native.h,sha256=e12pQTVXjNQ4rZXGNK3fXOxJHZjegc5TBy_SUyZ7hVk,887 +torch/include/ATen/ops/arctan_ops.h,sha256=MhG0mb-m9L3-sd8ifp7bqER-e5RzyB1Ny_dSmrZtJ_U,2356 +torch/include/ATen/ops/arctanh.h,sha256=3c5I0x3qJ2UQ9V26tf5dqZnN014XwHZuNyTL813jdeE,1486 +torch/include/ATen/ops/arctanh_compositeimplicitautograd_dispatch.h,sha256=UFlVJjguAvZvqBskDqr3NDV1ackpsTDkyZm6QNpH9q0,1261 +torch/include/ATen/ops/arctanh_native.h,sha256=rBlWxrHGd8tSqoeWTegaYI3rPjcnZ6CvldCQ8-phnkQ,890 +torch/include/ATen/ops/arctanh_ops.h,sha256=ivYzWTsKzT6y92_XhTlBJoOcDRQowXHSN78B5tgiMb8,2365 +torch/include/ATen/ops/argmax.h,sha256=IdAzmKeZtmAS_tsV13PQECzv5Sl1Og0kiIBr-VuWkvs,1647 +torch/include/ATen/ops/argmax_compositeexplicitautogradnonfunctional_dispatch.h,sha256=wwvpDXJdPPszE1L4T_HdrGuoVii9XpS4NDa--x5vHBU,1137 +torch/include/ATen/ops/argmax_cpu_dispatch.h,sha256=FD1D_n4IxQIoy770vDY62w_6OECwMFasz4eO_KGvCMY,1335 +torch/include/ATen/ops/argmax_cuda_dispatch.h,sha256=gHaNTU61fCr25R1wiyfoPkfzEivwZYICP8sHRUcdZCo,1337 +torch/include/ATen/ops/argmax_meta.h,sha256=U7RaTRLBf9QaFpGLXpUIq-q5oP5YdaZEQbI-1gienz0,897 +torch/include/ATen/ops/argmax_meta_dispatch.h,sha256=3JMR-lmlE_TuLuwyHW6x4uY9JjsqQ4B8ZSytX63eJBI,1337 +torch/include/ATen/ops/argmax_native.h,sha256=ioNnUCpZGncOhp0QAva-T63n7gruFp_vUEwCtmLZDf8,922 +torch/include/ATen/ops/argmax_ops.h,sha256=ZFS7s3zv54wOxnENAMICL_aY_mklAM0MWevX8LPAAkg,2156 +torch/include/ATen/ops/argmin.h,sha256=s7mdbY3HEl3XMxKMg9q_gM5lHMPJkW5lQjQu_UVyE88,1647 +torch/include/ATen/ops/argmin_compositeexplicitautogradnonfunctional_dispatch.h,sha256=2uakOJtk3yG-pLZAcR3EbbdSrnsp-dn8hk-t6jAXBjY,1137 +torch/include/ATen/ops/argmin_cpu_dispatch.h,sha256=TalmGAkPjSIfG3LCghezsE_YZCg3vc9c5KnJjK1c9qs,1335 +torch/include/ATen/ops/argmin_cuda_dispatch.h,sha256=-TV7I5tu9MWbWg05KWY9B_48FrJjC5P8eVRs-MmdoSM,1337 +torch/include/ATen/ops/argmin_meta.h,sha256=Sw7Z0joZBrP_D7gtzJgnqKr2aOTwxYQxNem5-nl6dQM,897 +torch/include/ATen/ops/argmin_meta_dispatch.h,sha256=3zKaedBc4H2IAnBfHRfWpeWbCg5SOiFGzR1COx3IhQI,1337 +torch/include/ATen/ops/argmin_native.h,sha256=WqPV11fzltz2dBdlw-wS0vmxtaRl6hZ4lsqZKZhWlkI,922 +torch/include/ATen/ops/argmin_ops.h,sha256=iitjdMntCYtWbPRrqZO6J2vRsejcZdRt7Ir_XNhTauE,2156 +torch/include/ATen/ops/argsort.h,sha256=yjDJ8g11946-wP-1ld-OrO765QQvUUHoj4Tq7MnVRdk,2233 +torch/include/ATen/ops/argsort_compositeimplicitautograd_dispatch.h,sha256=QiGXpWQ6Xt48u8CjaHSu1P2ox21DRjC2Zz1R-Hh7GQE,1546 +torch/include/ATen/ops/argsort_native.h,sha256=NMpZaFWdp4Ewoa-7SzP2OgL6JUpPNMmo79Ykjd5r9gU,1123 +torch/include/ATen/ops/argsort_ops.h,sha256=K6qe6EmU8uYIiwVPFMTB6E8ZGu9ZKHIRRmrMqYmpy5U,3490 +torch/include/ATen/ops/argwhere.h,sha256=1WD9GyZrQoAy53_vocZl5MD7F3NXqGY1DHIix-lbSmY,935 +torch/include/ATen/ops/argwhere_compositeimplicitautograd_dispatch.h,sha256=UjAzA4EFZ_N2bAqeBxXB2JHksqIzAe9xk88i3Z_qrzA,1048 +torch/include/ATen/ops/argwhere_native.h,sha256=WB8CTQBrJoOqW14sGZfNtQnWAwnIHDYHrTyEe_XpN3g,758 +torch/include/ATen/ops/argwhere_ops.h,sha256=WLTK4vj1QXmdPDBRHDm9M4gzR5_RCBKGpzN9L31uJjg,1251 +torch/include/ATen/ops/as_strided.h,sha256=5R1wVmiZ91_Q2YDNg1ZC-EYtukPFM7-L4Y6tZWs996k,4207 +torch/include/ATen/ops/as_strided_compositeexplicitautogradnonfunctional_dispatch.h,sha256=0ROkeDFosBtqxPCSPWu78kpEII93RfLbmB5Uq76OPEE,1376 +torch/include/ATen/ops/as_strided_copy.h,sha256=5-UEhuUBheiPJJqZLomdVZlgjHg3Rmm8l1L4O8O71P4,6281 +torch/include/ATen/ops/as_strided_copy_compositeexplicitautograd_dispatch.h,sha256=mFoaDOJtSE7T-uchw2dQofz56QM6RPv_VashmlksewU,1761 +torch/include/ATen/ops/as_strided_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=EXWuk0PcVnIiFtlbqe6xdcTDAzZLvFc1cwo0CQ4hZtY,1368 +torch/include/ATen/ops/as_strided_copy_native.h,sha256=zX6UcRWwLUnK9CmlRByudpq_HQZebgXKFXgMtWjgztU,1080 +torch/include/ATen/ops/as_strided_copy_ops.h,sha256=Cbi9eYVVA1eabIlpdzfk5_0gTbmtIA-MuIP2V0IGO2Y,2562 +torch/include/ATen/ops/as_strided_cpu_dispatch.h,sha256=S8U32QqW2cvdnAb21VlR6_rg6--dfzRpI6qZF_rpmOE,1288 +torch/include/ATen/ops/as_strided_cuda_dispatch.h,sha256=GBL7vt6FEs94o-BKVx9L-v-A4Mp1p671WLO5kwN67_I,1290 +torch/include/ATen/ops/as_strided_meta_dispatch.h,sha256=jtrBnwtTNleE28GtVpGEKT_1T_6qqo2k_gyNoLLGJj8,1290 +torch/include/ATen/ops/as_strided_native.h,sha256=NV0cRbBbbPjzqVnWkPFuH2M1CyAiHR_FaVqeM_kR2lA,1431 +torch/include/ATen/ops/as_strided_ops.h,sha256=S1VgfaJOiCkZmD5hbrW2RWFhnp5HbsB7wcf-DedSS0o,2483 +torch/include/ATen/ops/as_strided_scatter.h,sha256=w52RWlwZLHSuaFrF2QXSmAmTHhrzPvNqnIb8ckPnVgs,6794 +torch/include/ATen/ops/as_strided_scatter_compositeexplicitautograd_dispatch.h,sha256=8k9cGIQfiYcDlB9i2cUrCGy0EMuB-3WPG8z9Jx3Ya5A,1869 +torch/include/ATen/ops/as_strided_scatter_compositeexplicitautogradnonfunctional_dispatch.h,sha256=giXz-qaIsGomgtqD6w4VxIDNQVzPp6M6AdWw9vvfm6U,1422 +torch/include/ATen/ops/as_strided_scatter_native.h,sha256=6pkYD4A943bsuncG47x8PhTImEbFXvPOrKD6aZ3YFrc,1134 +torch/include/ATen/ops/as_strided_scatter_ops.h,sha256=vG6WwLXXCU5WIIU9gTiCbVUGsbgfT80ap6znPRHb9-Y,2740 +torch/include/ATen/ops/asin.h,sha256=JeMsTc5Y0ZmouOLIL4n1iY3Wru60DeOswQ4gzGIsT58,1447 +torch/include/ATen/ops/asin_compositeexplicitautogradnonfunctional_dispatch.h,sha256=iXw25iUmV_EG3doX7z4B0egeknAtkeGRiFpypAu6Ux4,1120 +torch/include/ATen/ops/asin_cpu_dispatch.h,sha256=zJFdHNMkpEDPufImL7n4tXVCxZPrwxXqi1pRCxFYamc,1205 +torch/include/ATen/ops/asin_cuda_dispatch.h,sha256=RyEFWob2TR38eWF66QXxBaqCQC2cQRdTv2DvCkY2JLw,1207 +torch/include/ATen/ops/asin_meta.h,sha256=YHuN4x0CaR9_qXgYRhuLA-egbjuhByczPdmN0Ea1Z84,851 +torch/include/ATen/ops/asin_meta_dispatch.h,sha256=aifhGztde8sjihHff3OazvS0o1mpLvLlAZsbzRJEY6E,1207 +torch/include/ATen/ops/asin_native.h,sha256=ux1_rqDmYtzDk-JU36b6XasxmWXXzIRSp-LYZBKBBZc,1286 +torch/include/ATen/ops/asin_ops.h,sha256=pgWRFm67H5YlnLII-DdbNEXffbxEH2xISBWzytA5PD4,2338 +torch/include/ATen/ops/asinh.h,sha256=sYFt4bwl_j8mFPNF70ooXRcNAatsknpw0fWD7vt7M-M,1460 +torch/include/ATen/ops/asinh_compositeexplicitautogradnonfunctional_dispatch.h,sha256=utifss69r2UpC1EOyiSdiiPEC-3dB_pl3zZ-IWq5R78,1122 +torch/include/ATen/ops/asinh_cpu_dispatch.h,sha256=fJBw_AU4lc5er4N6h1dl3DtUgba6mRa5uLK8ky3D_Z0,1209 +torch/include/ATen/ops/asinh_cuda_dispatch.h,sha256=d4a17jaTljJ_LrEXwBoCsP9fa6e2zaYeZ7eAWpEVano,1211 +torch/include/ATen/ops/asinh_meta.h,sha256=cALKbVA6yDtOcb0n3h97eRWGRQQiluCgPlqbVbuDynA,852 +torch/include/ATen/ops/asinh_meta_dispatch.h,sha256=Fn4_opd1nJ4I8ivv__hX00-slp7G5IwX6KMfATwWujk,1211 +torch/include/ATen/ops/asinh_native.h,sha256=R87etw8hlc1K8wXDGr-aSpEr0KjMxUg-z4lwNq5D1vo,1295 +torch/include/ATen/ops/asinh_ops.h,sha256=vxoHRwAzTIu9QHXZ5akPYxKSR3d6RzHaZCLFgODn97k,2347 +torch/include/ATen/ops/atan.h,sha256=utbYOdcJzzqpoCEN0udVW4hj1da7GqXBkEOP5J-MS1k,1447 +torch/include/ATen/ops/atan2.h,sha256=ezQpQxPeAouRveLylLTWj-kc0Pa9-HBKK67qDi7KAvk,1457 +torch/include/ATen/ops/atan2_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Vq2KKn49hTU8-_sxa1RzS3ojLAc8uJBH5SQIv0SK_F0,1174 +torch/include/ATen/ops/atan2_cpu_dispatch.h,sha256=vq31aQBvP8o28OHw1q3mvx3qdwSFmtu9Z62HcbvkkhE,1313 +torch/include/ATen/ops/atan2_cuda_dispatch.h,sha256=4R_w50PlrRejjRBPv7MTjfMfqnwT8iREyPTlDSL2Of0,1315 +torch/include/ATen/ops/atan2_meta.h,sha256=l1CZYVP9rqLJ7xHtxKZ_AFYHMqCkfxWuzSVJGMta_II,878 +torch/include/ATen/ops/atan2_meta_dispatch.h,sha256=O-_Vzm5o5zY76qMrGDpWDc73-5RUmkqy1G20OYQ6gZQ,1315 +torch/include/ATen/ops/atan2_native.h,sha256=Vj4kO6Z92-kX1wVN2AfEYhJ21E0ro5TQ8DWBUlQb2K8,901 +torch/include/ATen/ops/atan2_ops.h,sha256=Zl-Xm_qUpaSGYPNkU_Z9hj_zN0eXsePWkpJXF2R9QpQ,2605 +torch/include/ATen/ops/atan_compositeexplicitautogradnonfunctional_dispatch.h,sha256=NKh9xMvSG9iiwEmc6VhF3IPltY7zDkWQPWvfaHmCLqI,1120 +torch/include/ATen/ops/atan_cpu_dispatch.h,sha256=FVNGkRyiedZKZAvviI-PqRmteSeabgLhdz_mnukpI00,1205 +torch/include/ATen/ops/atan_cuda_dispatch.h,sha256=euTitSzbSgFz1hycO0Mmts90jP-4mR_mEQcvGRaxgPE,1207 +torch/include/ATen/ops/atan_meta.h,sha256=2KXiaFiECPqL_5Dfgs84Y9PMHDf42CLvp_yPkl_kHrU,851 +torch/include/ATen/ops/atan_meta_dispatch.h,sha256=ugoexgmjx_9XLh124j-vp29PScB7TwAdbD5fA6xXDpc,1207 +torch/include/ATen/ops/atan_native.h,sha256=IKnAcZodVTK9sdOb6xZc6pN80KBFzvxGwhF0-eDZQGY,1286 +torch/include/ATen/ops/atan_ops.h,sha256=mb7Y_PxUjbN4nKnihs4BejfyjSt3gYi-P5r-3KWeYhI,2338 +torch/include/ATen/ops/atanh.h,sha256=jP4mk1n2zAmISnoJEXWTKa6uWbUmGi-leXKq3fOJP9E,1460 +torch/include/ATen/ops/atanh_compositeexplicitautogradnonfunctional_dispatch.h,sha256=I_stlLRslPlw-7NzyAiz2fEqSgQnVX63kHcXZbaqkp4,1122 +torch/include/ATen/ops/atanh_cpu_dispatch.h,sha256=d80bHEVdyr06hOpm7vOU3r5U3udF1AQVV_JN9UIHWvw,1209 +torch/include/ATen/ops/atanh_cuda_dispatch.h,sha256=Xgs-1mV8LOp27UYjoihHDyhb3ig1mlv8-epvMAf0DJs,1211 +torch/include/ATen/ops/atanh_meta.h,sha256=MfpB9zP7wpB5VXcH94mKVEafEuwqMOR96SBGEeXjevI,852 +torch/include/ATen/ops/atanh_meta_dispatch.h,sha256=UmoA_7rOW7mEQpv98iYb-o7viHkc9neFFDDubMG0NPM,1211 +torch/include/ATen/ops/atanh_native.h,sha256=om75T7xNwoCENkAPQ0nddtS0nabGrMN78Nx53CETsD4,1295 +torch/include/ATen/ops/atanh_ops.h,sha256=VoZJ6t1j1Yoy_WSH0ZM4LYIkX2F-u5rs7IY9_AuO_lQ,2347 +torch/include/ATen/ops/atleast_1d.h,sha256=BO5m7hkLZFptOaQ7d9c-3tykeFCvuC39FNnyaCbLn-M,1137 +torch/include/ATen/ops/atleast_1d_compositeimplicitautograd_dispatch.h,sha256=BypDe3ltQ7rK6pFanKyV_eQaasw50I_sFk-6ZLppYqU,1123 +torch/include/ATen/ops/atleast_1d_native.h,sha256=D1fKvGzsnXP5fniVvgsYA801RBRKmZ0VEhoXxa04KmQ,833 +torch/include/ATen/ops/atleast_1d_ops.h,sha256=mtP7Pzc6qN0EGrlp7TLwqpiyHJz5scYTFrz08Y-lgEM,1852 +torch/include/ATen/ops/atleast_2d.h,sha256=ueb99-Cv_gKJyMMrenXJjCOvEvPDcgPgYWqBI0MjRBk,1137 +torch/include/ATen/ops/atleast_2d_compositeimplicitautograd_dispatch.h,sha256=AHwC52FClg_9vG6TghsJfNNJH_55JphjJd6xV_53m5M,1123 +torch/include/ATen/ops/atleast_2d_native.h,sha256=ISuEdF-y-CERxNmCRGZ8CfYiXt0tK_PC0MfAUAVScl4,833 +torch/include/ATen/ops/atleast_2d_ops.h,sha256=NfQ90ViEywXL5Z8kZ6bSOLiVbs7W1a620quXkNajbwI,1852 +torch/include/ATen/ops/atleast_3d.h,sha256=bCHR2r9LdumdYPThevfcgu7O8kfNqk4JUVq2U2NPklw,1137 +torch/include/ATen/ops/atleast_3d_compositeimplicitautograd_dispatch.h,sha256=nG64SUem1c38BT4nCJN2XFVobDbRNeksUxYFb22TNmw,1123 +torch/include/ATen/ops/atleast_3d_native.h,sha256=jkcszr9EClr0PksmVi_HRcLzRcUVYkZdBegCrGZOSkQ,833 +torch/include/ATen/ops/atleast_3d_ops.h,sha256=BL00zT3gx4gsi9HtKivvp8JcQm1zuD07SV4FV3W61sY,1852 +torch/include/ATen/ops/avg_pool1d.h,sha256=cHVSZdvPFbr68k2GBQ_-qC_LqFGlQYUjGy5zwJ1Rlpw,2253 +torch/include/ATen/ops/avg_pool1d_compositeexplicitautograd_dispatch.h,sha256=k9zMI_Fa8Va15WzUEsGXjEFDbdOwQLBf_Od84gQE8SU,1410 +torch/include/ATen/ops/avg_pool1d_compositeimplicitautograd_dispatch.h,sha256=tpPCU7axL_NPdyT3HtwcLiDDG-rZLNqT19U6UgrEb10,1184 +torch/include/ATen/ops/avg_pool1d_native.h,sha256=5xVbBSW6txWt04GwEcSBD1nxKmRm-1SEm2pkl6Y9-Pw,1095 +torch/include/ATen/ops/avg_pool1d_ops.h,sha256=yUzZaf0RFhVZFDCSi4gyRzzL9mpTsrgbew3-XLTDdKc,2682 +torch/include/ATen/ops/avg_pool2d.h,sha256=G9YrgD6BDPyD29sRU2xxGO7EzkP44WiRDs_ohoLMKEs,2550 +torch/include/ATen/ops/avg_pool2d_backward.h,sha256=fmekOSx6jpJGBB33ZegNkAPIXZz1q2yS31ybHIsoDfY,2780 +torch/include/ATen/ops/avg_pool2d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=9H9lo113vS0NlTolAG_CtLlO2WyScFsrlDIfID0aRdg,1278 +torch/include/ATen/ops/avg_pool2d_backward_cpu_dispatch.h,sha256=-U7Rdy0HOXPdbnZUo6dvAp9QXFB_vCNejJZdfsMnqIQ,1793 +torch/include/ATen/ops/avg_pool2d_backward_cuda_dispatch.h,sha256=Isf_-LaC50Uxni1I1mB_WSI0D3JuAH_EyBtXklD6l1c,1795 +torch/include/ATen/ops/avg_pool2d_backward_meta.h,sha256=YySENZ_UMNJvNASmqlwDMdf6JtMmSxdG1Ts4sKoQUkA,1059 +torch/include/ATen/ops/avg_pool2d_backward_meta_dispatch.h,sha256=6ngjU0GUXJHqq3Vvha2obK_3cLs7FIO8d_bWaegJyJo,1795 +torch/include/ATen/ops/avg_pool2d_backward_native.h,sha256=EigXRs1hNbI9Z88rBDSCRwMHd8n6baBtGXtO9RcjBpM,2063 +torch/include/ATen/ops/avg_pool2d_backward_ops.h,sha256=SoE1L4QJdbN_2zcv9peRLEsdsmU_7OxNnnEfQppjdrE,3224 +torch/include/ATen/ops/avg_pool2d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Oe-YCWWF9cA7JNwXB7j6aM9G3HAJwb0ynlKqwdY9CZI,1268 +torch/include/ATen/ops/avg_pool2d_cpu_dispatch.h,sha256=Hvgr-1pJFZ61uXbJ7JgSPjsOXeRE7gj_hm5SeeEe6OA,1718 +torch/include/ATen/ops/avg_pool2d_cuda_dispatch.h,sha256=gkW1botzbsVPIXdhs1CBkLtDaAMesvpFMbmA3qn9c10,1720 +torch/include/ATen/ops/avg_pool2d_meta.h,sha256=uDligUwIelx5-R9NBbpYy7BMkK_Vdn7cBeKUzXw3BlI,3815 +torch/include/ATen/ops/avg_pool2d_meta_dispatch.h,sha256=qMjCckhPTOcoihPwHllRm48KwoUbkPdKDIETuBDRyCw,1720 +torch/include/ATen/ops/avg_pool2d_native.h,sha256=ygfmSkaF3PNciFs6RxtpmSDDKshSh0DplzrNcOTyDf8,2143 +torch/include/ATen/ops/avg_pool2d_ops.h,sha256=fHI7b_Xue-ECDruas05LFWWBZHDFwZoDB8LyeKpC-G4,2962 +torch/include/ATen/ops/avg_pool3d.h,sha256=O_sKJ6yvQYyPnxDRKi5dsOp5SGvrD3QH0ypCVS4U9eg,2550 +torch/include/ATen/ops/avg_pool3d_backward.h,sha256=g-ehxBLDa6gpdi99aIhUYPNU-ULS4wErwv4y9MgZJ44,2780 +torch/include/ATen/ops/avg_pool3d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=FWxG-HbjvVRD0vZCrg6xIQtXHfqPrOruf4U_lRA8Tso,1278 +torch/include/ATen/ops/avg_pool3d_backward_cpu_dispatch.h,sha256=IKAoMLb_sWHZRxGdKohGDvyieb0_TOBTY46gagPdjas,1793 +torch/include/ATen/ops/avg_pool3d_backward_cuda_dispatch.h,sha256=6geHjUzNzk3aEfec30nCQPGbzzWBz9htON-_Gc41V9E,1795 +torch/include/ATen/ops/avg_pool3d_backward_meta.h,sha256=7c1HaWLp5zATrtBXV2V-DQEkK-b5EcSowfb4IDXi790,1059 +torch/include/ATen/ops/avg_pool3d_backward_meta_dispatch.h,sha256=3LHuUgbGLo1fdJ0nwbJL-41nbBoFNvrteJCIVXMqdKY,1795 +torch/include/ATen/ops/avg_pool3d_backward_native.h,sha256=_fI2IF8XFqeAl4E8R5Chx438RHx_XFLZNnlNlFDiNlE,2063 +torch/include/ATen/ops/avg_pool3d_backward_ops.h,sha256=6V43J-Ua95wAkHnV58qUGsobOC1lNZ-f9dox4vM0H_A,3224 +torch/include/ATen/ops/avg_pool3d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=bX2QJd8gqRfDqSAwXxwBRoAqF8vsBZ-NuFYg2n6gacA,1268 +torch/include/ATen/ops/avg_pool3d_cpu_dispatch.h,sha256=RF6TtL2YKizSWOGOQMBxFwkeoVXJ38uK154E_8XtBlE,1718 +torch/include/ATen/ops/avg_pool3d_cuda_dispatch.h,sha256=6z8uGFr0nYdoX9-T6Pa3XTniNjuiHcgty7xj_u_e-bU,1720 +torch/include/ATen/ops/avg_pool3d_meta.h,sha256=It_u45C1TNklhcK_lEb6hAhm9HbGzyfiey_qJ45xwDs,1018 +torch/include/ATen/ops/avg_pool3d_meta_dispatch.h,sha256=r7Mz_7hwQlgHR1ry4HcfeJh_sGYKJsCeZEbsa4a7Kng,1720 +torch/include/ATen/ops/avg_pool3d_native.h,sha256=SwS-P0bau-gNj1hJd6ScrD7jhyx8FV_ikNLV2QhqjZ4,2147 +torch/include/ATen/ops/avg_pool3d_ops.h,sha256=8f5a5FMjVMn7dEySrElgSlJBlw62_ToThO1NISiJcUk,2962 +torch/include/ATen/ops/baddbmm.h,sha256=nbFivAfxwbC5feIOnCgCnpBNeqQ2LiUcKJKyUAVbxDA,3289 +torch/include/ATen/ops/baddbmm_compositeexplicitautogradnonfunctional_dispatch.h,sha256=4mTNSCJUi9aPo8cfRheCY1RWpkmRbILiEx-VZiLfjTg,1344 +torch/include/ATen/ops/baddbmm_cpu_dispatch.h,sha256=zluDqlcN2fe8V9hDNU8ufE4g_4GzE5evqdt2a-OT7Jw,1649 +torch/include/ATen/ops/baddbmm_cuda_dispatch.h,sha256=hKRgzdWBGwiqfuUmeH-k-motrVsfHpaMXuxCbAGin7Q,2269 +torch/include/ATen/ops/baddbmm_meta.h,sha256=oZyvH6CKvV3Ka5m6G4FZEZh1sMHxDytFLqjrc6C-mNE,959 +torch/include/ATen/ops/baddbmm_meta_dispatch.h,sha256=Jv_JCIo1nah92Z5t8ZgJbFrnLcuKrCJWXoCPRUKbhBY,1651 +torch/include/ATen/ops/baddbmm_native.h,sha256=ZY70a3-41DwQNjlKVtMysSESXvxbH3MZnN3aLzCluu4,1873 +torch/include/ATen/ops/baddbmm_ops.h,sha256=Bfszg8cjpF4iAGiYcE7NIVhyc1d59ApFoOE5YBTUFww,5462 +torch/include/ATen/ops/bartlett_window.h,sha256=9aYvDtW8nIyABj4fVT_TM06b3c7hqn-PoRXezhjn_f8,3738 +torch/include/ATen/ops/bartlett_window_compositeexplicitautograd_dispatch.h,sha256=-aG7g_dPde2sQDIg94gin0DzeZl34ZKTc4mdPkdsjZo,1995 +torch/include/ATen/ops/bartlett_window_native.h,sha256=-UbdjYw4q_6ihGDBzoY4se6i16pqWg1542a5wnXjcRs,1350 +torch/include/ATen/ops/bartlett_window_ops.h,sha256=lyKguEDpo2bBUrqtFfMwlZslS4yniYplc9qnrgYhs_E,4177 +torch/include/ATen/ops/batch_norm.h,sha256=-Lkn8QocYJw55Fy599J7mqy48y1wINLfhfKwPak8M4c,1411 +torch/include/ATen/ops/batch_norm_backward.h,sha256=eHjtUGkRD4QWV1eq_DN8qj-BDmCMcRdS3x8en3l-hdY,1645 +torch/include/ATen/ops/batch_norm_backward_cpu_dispatch.h,sha256=CL_gJNIcxIsj0eKRlgdk2TspeRRtjW6jGt9iLnrAzjM,1387 +torch/include/ATen/ops/batch_norm_backward_cuda_dispatch.h,sha256=C1_IO1LmSOmKREGvLKu1cgAIdv9AjMyZLLA8SVe0v5Y,1389 +torch/include/ATen/ops/batch_norm_backward_elemt.h,sha256=J27Gs5MJm5TLKl80CZ48pnCrwyPmwOROWmRHHhdt9PM,2656 +torch/include/ATen/ops/batch_norm_backward_elemt_compositeexplicitautograd_dispatch.h,sha256=ymOLh5VfDW721Npi8omwWWkwNLuHZ2zuSoSFyL7hT3E,1608 +torch/include/ATen/ops/batch_norm_backward_elemt_cuda_dispatch.h,sha256=kFWpch5YmJJGu_R5okQWvzvSM7crD5nf4v-5EsidV78,1233 +torch/include/ATen/ops/batch_norm_backward_elemt_native.h,sha256=1bxrQJfmT-TqRXD62lPBw4JAN6Uiosr-ss5_vBOR55Q,1298 +torch/include/ATen/ops/batch_norm_backward_elemt_ops.h,sha256=IR4z254cxuBWZHGB0tnHTRBqzoMryqUaxweX_NIPm2Q,3334 +torch/include/ATen/ops/batch_norm_backward_native.h,sha256=NvC4bV1kUUpcVyR7eMzNDTccvJ8Eb3GcdDRwFnsKr9g,2052 +torch/include/ATen/ops/batch_norm_backward_ops.h,sha256=m4BimVfYJ-AQDbIuBajwZfasEwa8I3P0U7_VcE9wqZc,2500 +torch/include/ATen/ops/batch_norm_backward_reduce.h,sha256=s-C2N3bPocoO50QJ30DvEWWALZLRCBzoT2dY2205-kM,3035 +torch/include/ATen/ops/batch_norm_backward_reduce_compositeexplicitautograd_dispatch.h,sha256=cp58OK4P2UqKVqQvtDP1_H9DnLMpkk_eLnHkISvgTNM,1748 +torch/include/ATen/ops/batch_norm_backward_reduce_cuda_dispatch.h,sha256=X_zrlA1u5my2tiAHoPwrKKCk3iFrFZmfeNM0Wpen0I0,1239 +torch/include/ATen/ops/batch_norm_backward_reduce_native.h,sha256=QAzBZSqiEHhlf1sU5NvI4Ji80Z4BspLrs8gyEz1vMj0,1374 +torch/include/ATen/ops/batch_norm_backward_reduce_ops.h,sha256=76Ly3BfWYikuq9WUEe4-m_L_5DQxhlnS-gkUqQhfgI0,3650 +torch/include/ATen/ops/batch_norm_compositeimplicitautograd_dispatch.h,sha256=X3uPL9WnEsvtZvxAHRfDPF4Ckn6lDA0jqwJPQPy9C1I,1300 +torch/include/ATen/ops/batch_norm_elemt.h,sha256=hOFCCaNR8Ndu2Lc71sNML6DNEr8yot9t65cm85mWj4Q,2191 +torch/include/ATen/ops/batch_norm_elemt_cuda_dispatch.h,sha256=Uyk4glZs8OOmStldCpgXg-Xbagb-07P2f4MpWLs2PX8,1646 +torch/include/ATen/ops/batch_norm_elemt_native.h,sha256=PeVTnALZEyAWZR4KOlDqd2OVzCWONj5wK41wzlBs48g,1167 +torch/include/ATen/ops/batch_norm_elemt_ops.h,sha256=wv3VXc20dcRlduhA62uXcDt4XPpMbZU8co-d3XOWdx0,2894 +torch/include/ATen/ops/batch_norm_gather_stats.h,sha256=Y166pEh5XPWQXMIjsIyrSXToDi7Gy74Oahz0Lim_XvI,2813 +torch/include/ATen/ops/batch_norm_gather_stats_compositeexplicitautograd_dispatch.h,sha256=cTvRcmARabBrr1wrs90VXJxckjzeFz0wH2adLLN1KI8,1670 +torch/include/ATen/ops/batch_norm_gather_stats_cuda_dispatch.h,sha256=f821GdCCO4mQuvy-dZAlRS2ogloqGmX_2iCDZbEeBFs,1242 +torch/include/ATen/ops/batch_norm_gather_stats_native.h,sha256=I6J3K-MrM_EQrhre2hv04URUUReWW_X7S7OK3_Hn7e4,1338 +torch/include/ATen/ops/batch_norm_gather_stats_ops.h,sha256=ZOAPEpwtOQabvD-iFR42QSUy700hcz6Am17xGTUtEhk,3482 +torch/include/ATen/ops/batch_norm_gather_stats_with_counts.h,sha256=eDjDp6a8tnv2g44R1Ys4FwXlHIgKHWd8cnOn2Iv0hlQ,2984 +torch/include/ATen/ops/batch_norm_gather_stats_with_counts_compositeexplicitautograd_dispatch.h,sha256=LwhK8_7vdLNisRtjgD1eWw2mfcGlUAEu22AbE9RCQ4Q,1718 +torch/include/ATen/ops/batch_norm_gather_stats_with_counts_cuda_dispatch.h,sha256=sH5IkFnk2lHq4miTGS7sP1A5clHXeoyrMR1zk3WI-Fc,1266 +torch/include/ATen/ops/batch_norm_gather_stats_with_counts_native.h,sha256=kB-sKU_UXx1exlVo5ceO8tc3iHciMYLHufIcd-lC3Oc,1386 +torch/include/ATen/ops/batch_norm_gather_stats_with_counts_ops.h,sha256=fGTGVLRUGf3RdB3Zjj1Kd88MpobtlTorwRbKMyGVSJc,3632 +torch/include/ATen/ops/batch_norm_native.h,sha256=xSfYb2ZXHfFDC_W4U4yGK4fK7bqGhVMYGP44Gzq5mrY,1010 +torch/include/ATen/ops/batch_norm_ops.h,sha256=JuGi_c41wejnhJ5VJ4spvoriy9qda3Gb_cW03E1XgVo,2069 +torch/include/ATen/ops/batch_norm_stats.h,sha256=350tzpSLR0vbLm7SeV34f-ncGMfWPml-nLd0kSehtoY,1726 +torch/include/ATen/ops/batch_norm_stats_compositeexplicitautograd_dispatch.h,sha256=my2vMQRUlB2J-sbiuk12XNCMtM0or_qTS4ouWwDaDDY,1290 +torch/include/ATen/ops/batch_norm_stats_cuda_dispatch.h,sha256=QfVPuDP9QymGBKAEBVhEkTOyUxHHyxBG33tYUriBeI8,1052 +torch/include/ATen/ops/batch_norm_stats_native.h,sha256=5ipqaudivVg0wQUAMpeJAVRMo6Db-kUDE-KOBaTtD4o,958 +torch/include/ATen/ops/batch_norm_stats_ops.h,sha256=E6IRzRynEGMh2GACPrX0Ve9j4ThUoDNBTI_JGJHoh68,2250 +torch/include/ATen/ops/batch_norm_update_stats.h,sha256=5eYZENejfeDBI8INv9BglaH2vdUtRHLCuV7If02kYxU,2348 +torch/include/ATen/ops/batch_norm_update_stats_compositeexplicitautograd_dispatch.h,sha256=5kQlgT5Oa1XQC441J1SjDvIMbKTHl6M73SUsHbMfSoI,1512 +torch/include/ATen/ops/batch_norm_update_stats_cpu_dispatch.h,sha256=zbf_VlsMJlZ2K3Tdh8lti6Uo4scEqxS6Rl8BTHedaMc,1161 +torch/include/ATen/ops/batch_norm_update_stats_cuda_dispatch.h,sha256=4rN_K6bbVx-oIkgN52ODXqbOxOIQQonC9UfKldaWRQQ,1163 +torch/include/ATen/ops/batch_norm_update_stats_native.h,sha256=NziJMdUjNKhlU3ZQ1Gshiykdyr9WXUxGLfSU_Gqjp6g,1398 +torch/include/ATen/ops/batch_norm_update_stats_ops.h,sha256=qoVRkQrdHMeir2lTF6-jMlm1XmFlwcaKbe8hY69-5lQ,2952 +torch/include/ATen/ops/bernoulli.h,sha256=uagP4gzrMSacuPIzTYopRkvXtOJ7inBtXel14bQybIU,3560 +torch/include/ATen/ops/bernoulli_compositeexplicitautograd_dispatch.h,sha256=ap_us5gYaaFL2IC0vEIscHAqbjCzt3PdC56-dXLgaBg,1839 +torch/include/ATen/ops/bernoulli_compositeexplicitautogradnonfunctional_dispatch.h,sha256=YMNNUNR979f4vYGmtK5ys5CEPhUSbeiaNr7wW6alKhc,1142 +torch/include/ATen/ops/bernoulli_cpu_dispatch.h,sha256=7iZ86eA1DvwCLuqHwSu3uw7JbbczIWMFZ6vK8TJVV2w,1471 +torch/include/ATen/ops/bernoulli_cuda_dispatch.h,sha256=IIuC5nUXvQHT7CQKcFSLsQ8EPwk0MkCVhr279SmRjeQ,1473 +torch/include/ATen/ops/bernoulli_meta_dispatch.h,sha256=_xFcpqHAF4OYWRGTCVMjDGfs1qK8kwn3ZgvvMK_dhnE,1209 +torch/include/ATen/ops/bernoulli_native.h,sha256=8iSvPdVIVC2ozNyce0DCugD0QS-zcdhLVPdjlgLjWE0,1755 +torch/include/ATen/ops/bernoulli_ops.h,sha256=r2O_j-Vzkm6BmbAtqAQd9u-uT1ljBUwUroJpHA1yn1E,6763 +torch/include/ATen/ops/bilinear.h,sha256=OlnWxGLKPF8TqnQUhIMfTB3Me3s61Xs_AjnItI_I3f4,1111 +torch/include/ATen/ops/bilinear_compositeimplicitautograd_dispatch.h,sha256=lYhiNRAxGXbb4Kpjh1ncFRFPgiBOXVW2-wQg7nOAYZ0,1149 +torch/include/ATen/ops/bilinear_native.h,sha256=142N0aslQNK4_LmjGf3OYio8QYJ5e1ihGyNMnzjIiPY,859 +torch/include/ATen/ops/bilinear_ops.h,sha256=kDhreqb0_yftSKyAVkDIsQ4eqkb4YNLzlxJcMpvTkww,1575 +torch/include/ATen/ops/binary_cross_entropy.h,sha256=iHZMUhsf4Py44kX91zVWrZdhv9k4-ikBCZF07G-Cybo,2031 +torch/include/ATen/ops/binary_cross_entropy_backward.h,sha256=CTjP-UUEaiVcFpj-mgZTpYHIy14Vm5lpPCI2sxRxPJI,2386 +torch/include/ATen/ops/binary_cross_entropy_backward_cpu_dispatch.h,sha256=RJyI_cDD-ty0Yn0OjdqcFQBH2Wwm1jX0lcQ8UxrgLhw,1656 +torch/include/ATen/ops/binary_cross_entropy_backward_cuda_dispatch.h,sha256=n9yfZgjqcEqYnYKUY1oTpPcUSuQE4-XPTkG07TnCdWs,1658 +torch/include/ATen/ops/binary_cross_entropy_backward_native.h,sha256=8qUdBOXz6Rn9WNCtXwYHQ0cPiskNuZRHc_qmirOTeyM,1627 +torch/include/ATen/ops/binary_cross_entropy_backward_ops.h,sha256=GpWcdbSOso9w4UJYs5srkJWxI_xHEyAwDZPmn-1-mg8,2838 +torch/include/ATen/ops/binary_cross_entropy_cpu_dispatch.h,sha256=LJt26Eus2bxiT3sLfUD5BgPYF0wX2CYUBqHPQW4wfT8,1519 +torch/include/ATen/ops/binary_cross_entropy_cuda_dispatch.h,sha256=FrIQlIzHz6hU-mzWz3nbN3wIf9q5_Yqldy8fgjHfRw4,1521 +torch/include/ATen/ops/binary_cross_entropy_native.h,sha256=EVTvHjBr58sjn-hVf09NoDDQZyEZBWZPFrOxmM8yGN8,1449 +torch/include/ATen/ops/binary_cross_entropy_ops.h,sha256=vsfON5t2yA9Faf_hzZ16C3nGUYxbDW6mRzZDvgkHOvQ,2534 +torch/include/ATen/ops/binary_cross_entropy_with_logits.h,sha256=6jaWYOLuDRW1c7ZXXb7rPpsbO2cOc8c4dtMKhH2__Z8,2412 +torch/include/ATen/ops/binary_cross_entropy_with_logits_compositeexplicitautograd_dispatch.h,sha256=C1rnnNXU9v6tClo4SYZjNEgQ01tXb_PFcFRt8q6d150,1749 +torch/include/ATen/ops/binary_cross_entropy_with_logits_native.h,sha256=_T5UwV0qJQdJAh58SXn6QXGzBg4qQGzTv8u5Vhs6Izs,1189 +torch/include/ATen/ops/binary_cross_entropy_with_logits_ops.h,sha256=r1rOxr2V65vFx2T1X09qLhOhZW0uBq4B4CVROOGTlnc,2922 +torch/include/ATen/ops/bincount.h,sha256=RmVhvbXfPqvSGRrb1kqV2yHpxcGOokhIPrRHdnIjIg4,4622 +torch/include/ATen/ops/bincount_compositeexplicitautograd_dispatch.h,sha256=OZKsp-TSRs0LhQwGXRBkbEh_7lC2xQdgSLYCHf3cTeo,1605 +torch/include/ATen/ops/bincount_cpu_dispatch.h,sha256=3Lm_DRXvJ6Np1DLr1jqxzRBK14A875xd96Y-tm1vgFk,1210 +torch/include/ATen/ops/bincount_cuda_dispatch.h,sha256=MlQRD2MDAF7E4Lj_NYeU96Iin5t65NPwNKYUDGVYbeM,1212 +torch/include/ATen/ops/bincount_native.h,sha256=xLarDJB387U-811OHPxSKUDXfV42H0DIw5pov-TD1H0,1120 +torch/include/ATen/ops/bincount_ops.h,sha256=AVfu0opYVezCPX2zNbI-Mo8F26v8lGOhV0YzIuAP0T0,2314 +torch/include/ATen/ops/binomial.h,sha256=koNzQ0o9PsA5e3YknueIVK3F1Yo_211Ds4utT0B5w1w,1757 +torch/include/ATen/ops/binomial_compositeexplicitautograd_dispatch.h,sha256=0fiyspgYYIPBZYkyuVV842iP7zqV9oDDSHvy52lSzZw,1305 +torch/include/ATen/ops/binomial_cpu_dispatch.h,sha256=V9oD6nCdccbflzBPh5fgaPU9RrNE8EgSG3zRcTotsi8,1087 +torch/include/ATen/ops/binomial_cuda_dispatch.h,sha256=2wY-HQrBlwvNz1OtFVJFRx8LXpEA600pU5kUc2ngmr0,1089 +torch/include/ATen/ops/binomial_native.h,sha256=1VtexlxG_yrwTJ6cchoFrJl9_RrZ8PM6g7R3aTxQtyw,1145 +torch/include/ATen/ops/binomial_ops.h,sha256=8Fdyzl1Eq3um1YIYd4QFdzUa5YnwiMoUBnCa-vL1o9Y,2316 +torch/include/ATen/ops/bitwise_and.h,sha256=ceiwtNKNp6P70xFGQlf1uOouJNFdDzGWkD5huEb8Yn4,3135 +torch/include/ATen/ops/bitwise_and_compositeexplicitautograd_dispatch.h,sha256=zWVHJEFHSpJvPO4Hxk3L5uNhfkEJqCnOFaVQ2ela4tM,1688 +torch/include/ATen/ops/bitwise_and_compositeexplicitautogradnonfunctional_dispatch.h,sha256=PRV1SWAAcQ6K0Vruv-602Y6qVQXdhAchr0PRETSRjrw,1186 +torch/include/ATen/ops/bitwise_and_cpu_dispatch.h,sha256=tEA9hkLxl25kowNtT-l4I0NOuQfWVieo0oOpxBaZLQU,1337 +torch/include/ATen/ops/bitwise_and_cuda_dispatch.h,sha256=RmdZRtdcqijcR9FRpfIK8RtGthHMdqc5qM1j4DB6_p0,1339 +torch/include/ATen/ops/bitwise_and_meta.h,sha256=7MzZESI58z4e7_a1CMzs9SP617_yiC6RMyn6LSJ9FLI,891 +torch/include/ATen/ops/bitwise_and_meta_dispatch.h,sha256=T980T2r5p8R_wHREFMJOOoUoCl5UN0Vo-bpql4nPCRc,1339 +torch/include/ATen/ops/bitwise_and_native.h,sha256=npdjM-P950uz43dwy5Lm55h8AH7UJmNSuEgw3deO7b4,1415 +torch/include/ATen/ops/bitwise_and_ops.h,sha256=8irQ06LQzuV-SlYkvC2hKa7ovsf3P6QHGPfEfjrAMUQ,6103 +torch/include/ATen/ops/bitwise_left_shift.h,sha256=CZotRcQVZJKvpz6nvVPNMxAP9JZaraPQqhNXbocroxg,3373 +torch/include/ATen/ops/bitwise_left_shift_compositeexplicitautograd_dispatch.h,sha256=TomRmpHq9tvBeAxXGzRFdR6SFGALGjmg8w5nep6hkcA,1737 +torch/include/ATen/ops/bitwise_left_shift_compositeexplicitautogradnonfunctional_dispatch.h,sha256=UhyQdNGUSvdDY1Wfe7NUTaOACvhDDLLmDKV3VFNYpgo,1200 +torch/include/ATen/ops/bitwise_left_shift_cpu_dispatch.h,sha256=xu4wZQJMU8fw92898LpuPeYdcBmfW7lV8DLevuyTcQA,1365 +torch/include/ATen/ops/bitwise_left_shift_cuda_dispatch.h,sha256=BMZm9NXvRCAZm9BnqbVm2OL43n3gy_9Rjace2EbxbHs,1367 +torch/include/ATen/ops/bitwise_left_shift_meta.h,sha256=saeprcmGw4JoMamcCWSb6QQKUhB3PO_bQ22dC9WSSBs,898 +torch/include/ATen/ops/bitwise_left_shift_meta_dispatch.h,sha256=URB7fMeCwt5gkY-YGjgTwHJx5cJ-X9x8zqPUY9voqO4,1367 +torch/include/ATen/ops/bitwise_left_shift_native.h,sha256=uLMbi9FfXnT8wXyadCsaDMrlXyJCbKwasc35Xgi5hdw,1471 +torch/include/ATen/ops/bitwise_left_shift_ops.h,sha256=Lg4N79-EwOjarhQc3PSVPXP8eqMGkh2HBPFxEWjMy38,6334 +torch/include/ATen/ops/bitwise_not.h,sha256=YvVant6AMBwgfFJji_OeV_XM7_yVOxln66jnR0Jkr6g,1376 +torch/include/ATen/ops/bitwise_not_compositeexplicitautogradnonfunctional_dispatch.h,sha256=prdE-Gs1_qfLJ26cUbQEbv0ULM5Kwbg51zhZ1tteG3A,1134 +torch/include/ATen/ops/bitwise_not_cpu_dispatch.h,sha256=ryJmSP_cr-3SJg0P2zFeWh32DPyg2ffoqwLI4RDoBvs,1233 +torch/include/ATen/ops/bitwise_not_cuda_dispatch.h,sha256=EdmUBd6HMdYbnsYeh3SJUUH6Fi2K35pdRdQc_Bykli4,1235 +torch/include/ATen/ops/bitwise_not_meta.h,sha256=A-5cnKiyOwK_NdPSytEJcRRMdGOS268-QN6WvSzHo58,858 +torch/include/ATen/ops/bitwise_not_meta_dispatch.h,sha256=el8HVt8V5T83XY3fUC8fI2b9ZGaKH3GvVAG365RiPlk,1235 +torch/include/ATen/ops/bitwise_not_native.h,sha256=uUuce-JudZq7DhfACuwa_UGXlUpOd6iD3CUPQoRrOwk,893 +torch/include/ATen/ops/bitwise_not_ops.h,sha256=2mUosXd9t_-EMoxawYtPWDl4jS7U3ldf3roVjJKVRzA,2401 +torch/include/ATen/ops/bitwise_or.h,sha256=cXlzLACG34-79DJhpObEIaA7p6xxjKsR3uHWyHEIC84,3107 +torch/include/ATen/ops/bitwise_or_compositeexplicitautograd_dispatch.h,sha256=wO9QhP3IbQzFPgIQSiHXSYn2edTX-aF_QZBgZGCO7Vw,1681 +torch/include/ATen/ops/bitwise_or_compositeexplicitautogradnonfunctional_dispatch.h,sha256=iNdyac4jcylQb-pacykWrrdEtjcniSEfD0X67V0JcwY,1184 +torch/include/ATen/ops/bitwise_or_cpu_dispatch.h,sha256=pU1jDkWZyXVTcP9x60YEcx2Hv_pW0cDxXA0sYwC8t-Q,1333 +torch/include/ATen/ops/bitwise_or_cuda_dispatch.h,sha256=M9HpIfWeFxPvdyMJYGRQ6rOLnYx-OdACoC_OoXuMji0,1335 +torch/include/ATen/ops/bitwise_or_meta.h,sha256=kGnSh3KShiX-X_XMyxYjdhU-6huUOUeij34hFeoe7yg,890 +torch/include/ATen/ops/bitwise_or_meta_dispatch.h,sha256=XQl_tfegNSqZA9K73c4fs7hsRkBb2m2UYXnzaeAl4a4,1335 +torch/include/ATen/ops/bitwise_or_native.h,sha256=yvqnbws6njVroiPc3-HkTKA8VZNu6dWa1c1rNGU6SeQ,1407 +torch/include/ATen/ops/bitwise_or_ops.h,sha256=J8BzKXjsWpq7CX7E3ek2mJnltamj-YulHMB4kdAnPBs,6079 +torch/include/ATen/ops/bitwise_right_shift.h,sha256=UQEg2nk3MhBFifmd3nhJr_RTMStd-3bhaIJ1ZqmZpWw,3401 +torch/include/ATen/ops/bitwise_right_shift_compositeexplicitautograd_dispatch.h,sha256=N3df2Uh7uTDYyhBx10WS0AIAZLrj_r74916b0kqbhb8,1744 +torch/include/ATen/ops/bitwise_right_shift_compositeexplicitautogradnonfunctional_dispatch.h,sha256=STpR36Q3OWxt_gOXPJA-E5uU2TKGFfWbI04FEFGYc18,1202 +torch/include/ATen/ops/bitwise_right_shift_cpu_dispatch.h,sha256=7LFxn8Poq8N705LF-W8KBlfaoaGmGFjrDvPyeoMP8qw,1369 +torch/include/ATen/ops/bitwise_right_shift_cuda_dispatch.h,sha256=N4USxvUqcynGkaBluWvrdYCT6rOsBtdLk2W6xqPk0WI,1371 +torch/include/ATen/ops/bitwise_right_shift_meta.h,sha256=dXxVCLHINWOIPFbIha_ogi9z_0FdHLA2tQXSP1n0TCE,899 +torch/include/ATen/ops/bitwise_right_shift_meta_dispatch.h,sha256=6tqn_xz7e4ShN-LeCMFjrLQTeen9hs2FONC0MX3lXJ0,1371 +torch/include/ATen/ops/bitwise_right_shift_native.h,sha256=K7FPIgbUVQfWvAmDRH4zNIDHckdTWOJ8l9ptrolrny8,1479 +torch/include/ATen/ops/bitwise_right_shift_ops.h,sha256=_tBpzmRMBfbogXQv1r5O4XfsVtCjGJSGLHcWQ3K3FqQ,6358 +torch/include/ATen/ops/bitwise_xor.h,sha256=cooZgw0vaWs25Ln6MoDJmLvbLXlmuegYzbHUFuPk4zU,3135 +torch/include/ATen/ops/bitwise_xor_compositeexplicitautograd_dispatch.h,sha256=WNlOb_dqxgN_1Ybzu-zMBsQVeEd6S5Qtf3sj63qaIb4,1688 +torch/include/ATen/ops/bitwise_xor_compositeexplicitautogradnonfunctional_dispatch.h,sha256=CWlriX8hQYJIPfCqVZMOBhKKEPUI3Ica3iTxKkohtzA,1186 +torch/include/ATen/ops/bitwise_xor_cpu_dispatch.h,sha256=zC9G786pTX4q6f4jb5ZccGIBLpKKf5uQ9b6xTPE1XgM,1337 +torch/include/ATen/ops/bitwise_xor_cuda_dispatch.h,sha256=JRipJXSCuh141J5nfYGNzB2CwyT8fkNIwxo5SYS5Lzs,1339 +torch/include/ATen/ops/bitwise_xor_meta.h,sha256=cWVOOoUhEtrxMo0rCiWDG7mJKf2mKWfTaIekjzvlNd8,891 +torch/include/ATen/ops/bitwise_xor_meta_dispatch.h,sha256=jjRqOSavV8_96KyCqtc_p21kKFnO7TjjafSrh8bYJQ0,1339 +torch/include/ATen/ops/bitwise_xor_native.h,sha256=GNireuxUmZ3m_84PtLS8nGt9h6IQ-8VJ4LHB_TtbfHQ,1415 +torch/include/ATen/ops/bitwise_xor_ops.h,sha256=MA8X7E3_8P1FrGVAhMHx2AO8t-YcqDrpiYOkOkNW7hY,6103 +torch/include/ATen/ops/blackman_window.h,sha256=P8IQqCoUstCCCTlcDl8pe5PiMewehMvOML6HR0_l0rw,3738 +torch/include/ATen/ops/blackman_window_compositeexplicitautograd_dispatch.h,sha256=I4n2rJIcx7D1HqcabCNsEyb299a35PjQCHvHnIYzRMI,1995 +torch/include/ATen/ops/blackman_window_native.h,sha256=wCB4TomrP4rJfc3u6ls7-4GgOa0aMoiG5qTItWnWx5Q,1350 +torch/include/ATen/ops/blackman_window_ops.h,sha256=ly_8hlaiSaLOJfndkEb4nVMt5IPuPI3K39hJMDK3li0,4177 +torch/include/ATen/ops/block_diag.h,sha256=Ug3Nu1vH1u9jokPwWdbB_6v6ftKds-udmDGelia_jxk,1387 +torch/include/ATen/ops/block_diag_compositeexplicitautograd_dispatch.h,sha256=9hfjWNgRon0Bbq3tTAEs4pIdYwoKYyZmsMNwVN4mDcA,1214 +torch/include/ATen/ops/block_diag_native.h,sha256=wFM5NSMcYwASX4kMfP6p6XFp7onOGT3u4wU5nQak5OA,841 +torch/include/ATen/ops/block_diag_ops.h,sha256=JwBI3NBB02SiyLGnSH0MTXngFpZ0XYRnWpc19Jeq0qU,1868 +torch/include/ATen/ops/bmm.h,sha256=uU9xrmP25OTJgxdVXHO1RKresWk-qTb5vGZqPDIof4w,2285 +torch/include/ATen/ops/bmm_compositeexplicitautogradnonfunctional_dispatch.h,sha256=2s-isW952LIm_Agxjh3MSId3hdZB49PF74lb1_H5-yE,1094 +torch/include/ATen/ops/bmm_cpu_dispatch.h,sha256=ymIMVTx1fGR0GKpsZZw19guuz04BMmZhftNGBIh3re4,1227 +torch/include/ATen/ops/bmm_cuda_dispatch.h,sha256=U_A1WmCoB4lLBH6MMOSZRtrW3G9trsq6QxE4b45hUis,1587 +torch/include/ATen/ops/bmm_meta.h,sha256=Ij6vpEUUmH-057ON-Ng_emHZdajYLarJNqg8Ud6znY0,875 +torch/include/ATen/ops/bmm_meta_dispatch.h,sha256=Ghl7cp7Do0rN0qjhRuK-asuNiPtG-OGA2YBcKXIfH0Y,1229 +torch/include/ATen/ops/bmm_native.h,sha256=UfTJecwrnbXgYsBRi-9Lo-O96vtxO9hWLUQG2e3bAjs,2012 +torch/include/ATen/ops/bmm_ops.h,sha256=c-mENCd7YLPdRi9ow3ZYJkd_JYebR31Hv0a7hEX3Gik,3469 +torch/include/ATen/ops/broadcast_tensors.h,sha256=ZSwNCIx7vI1prGx6V69ssqVuy9Npoob3YslLuwbe97c,995 +torch/include/ATen/ops/broadcast_tensors_compositeimplicitautograd_dispatch.h,sha256=12grvolU0uWUnlWj5-LSye98PjvMv77a2LZVwIUtbUk,1071 +torch/include/ATen/ops/broadcast_tensors_native.h,sha256=YuLyA7w1CdYdU1HGSluP2WqNxKEeCu_T04vr9LRz960,781 +torch/include/ATen/ops/broadcast_tensors_ops.h,sha256=Z8LVFeGkIBCuCQ7T8TzPfi_su6Zjwpd03TtsUS0aXYA,1324 +torch/include/ATen/ops/broadcast_to.h,sha256=OU7jjB3Bdj-emx_eYC_cT0GL0d1hf1J2D9s3HTxUfeI,1758 +torch/include/ATen/ops/broadcast_to_compositeimplicitautograd_dispatch.h,sha256=JTgcOK2Hi_oCQy5QhjD9LL7-w64BCMhzNyVF8QBpf7k,1168 +torch/include/ATen/ops/broadcast_to_native.h,sha256=HrfEZQcPo8XrrnHhZNZi0FKwqcBvSa5ccXsKnPruywI,795 +torch/include/ATen/ops/broadcast_to_ops.h,sha256=pEbt4LGETBrXfpEoFTzW9Dt89ju5rlWXDZKVCRNGROM,1357 +torch/include/ATen/ops/bucketize.h,sha256=VogAKAqv1cjrCch6rjR_irB4sQ8oVWWenSoeGIyjreo,2948 +torch/include/ATen/ops/bucketize_compositeexplicitautograd_dispatch.h,sha256=QWnyjaP7fdnwCJ-NVXNYUMyN0pJGn-llGsOUwWNeRLI,1286 +torch/include/ATen/ops/bucketize_cpu_dispatch.h,sha256=GQZMdq2tRzi46Jp3KHGfSHlaaG6M44dZwhJf4w9_4b0,1500 +torch/include/ATen/ops/bucketize_cuda_dispatch.h,sha256=e-LD-PcwwSpyqQxS5pWU4akYqECwZsGicsjkRumQSGQ,1502 +torch/include/ATen/ops/bucketize_native.h,sha256=LqGTiYkKoIEj3o8cCPwqPeTGh4TNJUapiSqFvX2N5zQ,1674 +torch/include/ATen/ops/bucketize_ops.h,sha256=tvbxu5xAOBkzo39OuqzlWtixOsiLeJ8Iu3q7XHxFaQY,3918 +torch/include/ATen/ops/can_cast.h,sha256=VNQjdKw_p24M2ZknVgvM-gTls-1y9aIOynjHJMLn4Wc,968 +torch/include/ATen/ops/can_cast_compositeimplicitautograd_dispatch.h,sha256=nawQ6Bl63Rd4af2f0C53Qefr0TTL71gykSLDd67p7ek,1058 +torch/include/ATen/ops/can_cast_native.h,sha256=2evHUGLJYNmZLsoev6ObepaZbJKWEVpi62YHAmHXIBk,768 +torch/include/ATen/ops/can_cast_ops.h,sha256=FU9ondopehVoUG9oGGE94hdOsl-2CDZ5bkP7A1qRLAI,1295 +torch/include/ATen/ops/cartesian_prod.h,sha256=DKyJuolF9LlUtrOH0HqrUQENXZwoMP2ISQtDl3VQpRk,966 +torch/include/ATen/ops/cartesian_prod_compositeimplicitautograd_dispatch.h,sha256=9K73rHe9uNlIXh-FCEgPu55OEyrmT4wEZa2EqpsjGGo,1053 +torch/include/ATen/ops/cartesian_prod_native.h,sha256=F0xrYOseq32fpX7ZzqgFqh0fYCHkNMHoL_26_G8jjoI,763 +torch/include/ATen/ops/cartesian_prod_ops.h,sha256=-7CG8ScJHc9tBb5zkudVasVU7-p__xKZ7LA4nuefMqM,1268 +torch/include/ATen/ops/cat.h,sha256=KlCT4ovaGf4R-8_pEt11wEPYx7BknXTpQ7MfFQIropY,2118 +torch/include/ATen/ops/cat_compositeexplicitautogradnonfunctional_dispatch.h,sha256=KbapcLZuUBRuud3RWTcCl660788aWpAWU5lr-z8lQpk,1095 +torch/include/ATen/ops/cat_compositeimplicitautograd_dispatch.h,sha256=gu4_94gWbsgdnw_KWQWP3zU-e_gnC1ANtjQv4reZyi0,1244 +torch/include/ATen/ops/cat_cpu_dispatch.h,sha256=8VKc1MAVO9OlKqFvRZuOSBoD4wPkTYGx6lhzeTdYcqI,1228 +torch/include/ATen/ops/cat_cuda_dispatch.h,sha256=MBy8CH2NL6YNUyTF52NFRenF6NxZg-GJU-EaZYrvIqk,1230 +torch/include/ATen/ops/cat_meta.h,sha256=eY2QXlGczYTT4ngZUXMgB2hi3Rqhajv5BBXvH7w0rfo,5179 +torch/include/ATen/ops/cat_meta_dispatch.h,sha256=U7ELaNgdDPKguHx7KzQrMj_-q6bNM_t6I-KuUxvdzcY,1230 +torch/include/ATen/ops/cat_native.h,sha256=fgzNSMFH4DmzVItaDhVrIR2AbKbsm5Z7u6zoNVJxXoU,1842 +torch/include/ATen/ops/cat_ops.h,sha256=U5KICCpgLaMjpN-vu_6Yz8KENd4rBCNmuVy7A1pJAhs,3237 +torch/include/ATen/ops/cauchy.h,sha256=JHWxFV7F2LM54y-h0P95VzsYmNUPvYJF8xYOK3wNVVU,1832 +torch/include/ATen/ops/cauchy_compositeexplicitautograd_dispatch.h,sha256=9Imz962wJs0u7nVCSOE-zwf75YGASDeFkcClgYN37Uc,1456 +torch/include/ATen/ops/cauchy_cpu_dispatch.h,sha256=5cZaeMJJaZdEa42eXriEMMdlT-E53_oYAiHFAHGTgk4,1089 +torch/include/ATen/ops/cauchy_cuda_dispatch.h,sha256=jcBNrbqqFRFnoT1sAAg3qq7CWowOgGON2k008MPbzyQ,1091 +torch/include/ATen/ops/cauchy_meta_dispatch.h,sha256=HO_smtZrt01nUa5PgmauHMPwZmD9epW17b3mb7bKHCQ,1091 +torch/include/ATen/ops/cauchy_native.h,sha256=hGL3uygSSUoqnnS85JIR6ib5LWoNlvBOnwe7BwBT-NI,1138 +torch/include/ATen/ops/cauchy_ops.h,sha256=yn2yE8p2byf3SNn4DJ6DwT0F6BdQZY4eeJD6oUk-HFc,3106 +torch/include/ATen/ops/ccol_indices.h,sha256=rvMQqM9X8LnArobV31ap1avRZGHPj0OBhOkpsCTK8dI,795 +torch/include/ATen/ops/ccol_indices_compositeexplicitautograd_dispatch.h,sha256=b_l6AT1fBhWTmQBY2BeElomrESXcWcz9ZnyYNjZ2mig,1052 +torch/include/ATen/ops/ccol_indices_copy.h,sha256=60xjW--GhllYCGYMZXnKqOpQejVUlb_8gxZVs8gA-qU,1436 +torch/include/ATen/ops/ccol_indices_copy_compositeexplicitautograd_dispatch.h,sha256=dIYvRyV8NeiEG5PeT649PPaxIbGhPsQRmhxe3th_PK4,1172 +torch/include/ATen/ops/ccol_indices_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=3eWOc9O_Iy-PgQdkC-HLmSBfyZrI95miNyGe1KM2o_c,1083 +torch/include/ATen/ops/ccol_indices_copy_native.h,sha256=jiTgeAVbVFg4OjOHTI3kKvsQgUS66Sx_1FITGy9VURM,857 +torch/include/ATen/ops/ccol_indices_copy_ops.h,sha256=Myvd7dUKwgINWhTW2P8a-4Vd4xtmRpg0NC9I9GAOyLI,1912 +torch/include/ATen/ops/ccol_indices_native.h,sha256=ulhVPXPnmorcd7e6SIU7xa_2NTv6FUAO7uJ9cScqP9E,842 +torch/include/ATen/ops/ccol_indices_ops.h,sha256=51dxUpsKzR1wM2BQuqMh24ZfreIj_D1SKq-HX-00604,1269 +torch/include/ATen/ops/cdist.h,sha256=tB4WURdkWjfJ4YTP0D8oDNdAKTL-oTNjIXL2G3Xg_JY,1073 +torch/include/ATen/ops/cdist_compositeimplicitautograd_dispatch.h,sha256=OouoxGEl-Tr1ff_aLfN1U2CpnRIZGYxIhT6YV2812vA,1132 +torch/include/ATen/ops/cdist_native.h,sha256=m10p46mZYUBat7nKol4Op0Bl71gKK0el6bftWgv0hQ0,842 +torch/include/ATen/ops/cdist_ops.h,sha256=QE2DYEMAp27lXpWIhR6CTXD6AIOIOT-G5Mva5_cAXmc,1480 +torch/include/ATen/ops/ceil.h,sha256=IPHjTj652RlB4SgvXT4_y0u5qAeP756xk5eQOURhChI,1447 +torch/include/ATen/ops/ceil_compositeexplicitautogradnonfunctional_dispatch.h,sha256=NKJdejLya_bLKTjhDfPFXDuSnu647L1tOOZic7IhpF4,1120 +torch/include/ATen/ops/ceil_cpu_dispatch.h,sha256=bNMKjfD2vKw98GZe38o7ZCw53MtkPueRgFtM4OmbIAc,1205 +torch/include/ATen/ops/ceil_cuda_dispatch.h,sha256=bW4sxZTtLH0XuDrIjPipMotB_fsDkmOzwED-QFp8-iE,1207 +torch/include/ATen/ops/ceil_meta.h,sha256=HcWTpvyFfYsYG1iSddkOIWgqjYKerJt44XAFX5XJ_0A,851 +torch/include/ATen/ops/ceil_meta_dispatch.h,sha256=dcPnef5NCsmUsnCgoDRMiLnTDR8W1s2979ZVRKhhNMQ,1207 +torch/include/ATen/ops/ceil_native.h,sha256=QMdBFZ-1GTYKM18Y6YRDaf_5I00jEH6ctEeor_eL2KE,1286 +torch/include/ATen/ops/ceil_ops.h,sha256=WuoWQIC2FARuGqyzv86Q9x4j1DOn__5EzSoxnlEP9mw,2338 +torch/include/ATen/ops/celu.h,sha256=tvO0jts4HGwhvPc7pQH8xrTQZeutWG6899noYvcdj14,1663 +torch/include/ATen/ops/celu_compositeexplicitautograd_dispatch.h,sha256=REqFohtwX-K5zlQfIWRXP1Ohg-t27fhCp1jDFFt09xc,1365 +torch/include/ATen/ops/celu_native.h,sha256=HxlcAYsoe1Ui5rwQe954GJJ6QuBtaXWPhBsdaL_82vI,967 +torch/include/ATen/ops/celu_ops.h,sha256=voSwqoYMatpr9r3j1DgCYE_DD5T-3ukY_76T6LFlT40,2608 +torch/include/ATen/ops/chain_matmul.h,sha256=aTJj3tM7dMJj2o1Ai9wwEH87AGm_DRQ21_Efqw3BSiY,1416 +torch/include/ATen/ops/chain_matmul_compositeimplicitautograd_dispatch.h,sha256=QakBJcZonyMS26YxwdLycN3Y22FuCEejGw7Ix3hCaGs,1223 +torch/include/ATen/ops/chain_matmul_native.h,sha256=t-nO9YYNEWydjpHw5HIcGPxTpAGtBBw2x_hDzi-83-c,847 +torch/include/ATen/ops/chain_matmul_ops.h,sha256=lWLPS5KC7o5RcQRcK9RXzqHKICZZELLZ8tAIoySFq-o,1886 +torch/include/ATen/ops/chalf.h,sha256=3jVXqbsHYilYxgYvcpfhmSisPdWUCeBYQHZPwe_Z9OU,788 +torch/include/ATen/ops/chalf_compositeimplicitautograd_dispatch.h,sha256=fyn6kJxj3Oucx8OH0FyNivVNLaT0tQ0Pi9HDSTHgcT0,1109 +torch/include/ATen/ops/chalf_native.h,sha256=8T5lRFvTsa4lHNwpRixHy0Q5nPTxrK-olIsuYJFaxrY,819 +torch/include/ATen/ops/chalf_ops.h,sha256=Gi3ZgOEuJBVkzw0F-dDNKlYaSnB0QLYasV87Le9k7mo,1412 +torch/include/ATen/ops/channel_shuffle.h,sha256=yotZr0tN4p1M4tJ7mK3BnPs0ClYO5inEpAtYElMvA4A,3917 +torch/include/ATen/ops/channel_shuffle_compositeexplicitautograd_dispatch.h,sha256=z0zoXYxYcNmC2SvjNRCcPUF-cqCw4RshVxDL0vn1om8,1431 +torch/include/ATen/ops/channel_shuffle_cpu_dispatch.h,sha256=ZlcK5OQ2pVrl3EUJUqFajXrlWmg0vG8E6sRUJZLiUhI,1118 +torch/include/ATen/ops/channel_shuffle_cuda_dispatch.h,sha256=2eXjpl3EPKWoUaWRZcHldDj8_uiM9X8kpgQ-2F85sfI,1120 +torch/include/ATen/ops/channel_shuffle_native.h,sha256=W8igTrmuotElo06KRWCC8DjEiDpNPTPGxyJuPRpB87A,990 +torch/include/ATen/ops/channel_shuffle_ops.h,sha256=Yzva41XL5HLxUfLWrG6v8NFBKUCYshKL0OeNQ3FdTgQ,2036 +torch/include/ATen/ops/cholesky.h,sha256=AuhNh0wC3HDMXvz7PIeu22vI2ubgQVB53wK4Tvhk_l0,1469 +torch/include/ATen/ops/cholesky_cpu_dispatch.h,sha256=2uGC3w7KhmQ2hL6u7ohfjYsakE5-EfBl50TV9YnoK3Y,1215 +torch/include/ATen/ops/cholesky_cuda_dispatch.h,sha256=ASF83BSAcR5BCBfwOvtblSsdldeZASrjypbJH4uENuQ,1217 +torch/include/ATen/ops/cholesky_inverse.h,sha256=CdjONe-j9wB9u3v-Uw3dOvYGqL6iCJFOeh6AKu6a0Bk,1549 +torch/include/ATen/ops/cholesky_inverse_cpu_dispatch.h,sha256=fFkmj-3z5bjkEEeYnyA0pZAbYlmtDAco2YABaU7SpW8,1239 +torch/include/ATen/ops/cholesky_inverse_cuda_dispatch.h,sha256=y08dWzZRhCIDIYXR3lI4vUvCImwYF44mAMF83aHT1as,1241 +torch/include/ATen/ops/cholesky_inverse_native.h,sha256=AtIfkc3kJBNvcaggs4YSn3ndbqCQSGSQky0a50sUxEI,885 +torch/include/ATen/ops/cholesky_inverse_ops.h,sha256=oIY3gfBkw3RMaiC9CwZ9Bb5nENjAj0jKzcscuqeN5aQ,2002 +torch/include/ATen/ops/cholesky_native.h,sha256=59PpAE7DFE1DbhTp2TsPcROki50xrm87wVIXL-R2Zhg,869 +torch/include/ATen/ops/cholesky_ops.h,sha256=6klIzxPifJ8Y0X3l8qOz1zhVLhoTECOmWFGqdWt4sWo,1954 +torch/include/ATen/ops/cholesky_solve.h,sha256=XCzFK8sV0APsjxS1JRhmraVTvShHfnCFoTwzi2OBFo0,1679 +torch/include/ATen/ops/cholesky_solve_compositeexplicitautograd_dispatch.h,sha256=akhVhZCQ-KgdRCbGpwKq4AFDjCFhXJXnLOh9bLSiHrY,1358 +torch/include/ATen/ops/cholesky_solve_native.h,sha256=rysYoTdHBQ4O3jE70ConzOvibZGbfZwMaolr4aw-q88,935 +torch/include/ATen/ops/cholesky_solve_ops.h,sha256=H_YbOnzlqfSnYdj7At1A2xCve6eYta97p_smeWcxD_0,2168 +torch/include/ATen/ops/choose_qparams_optimized.h,sha256=E18vaRMR3T8w6QzOX7VF1LkXNgAtpmXUlzd7jR39iQA,1185 +torch/include/ATen/ops/choose_qparams_optimized_compositeimplicitautograd_dispatch.h,sha256=LThzAAbkM8M0v7cweUCJkw3XIy3QEnLIsrHTV6XLbOY,1154 +torch/include/ATen/ops/choose_qparams_optimized_native.h,sha256=WuJEDHex47_kBrAed_lQXEcBEfzohXfuEGvmUeM4ae0,864 +torch/include/ATen/ops/choose_qparams_optimized_ops.h,sha256=B161RCVXNnF1MqgLBI38iFloVmqCyxLXYLNcGqkyTuY,1601 +torch/include/ATen/ops/chunk.h,sha256=Siga_nyu4Wcy-VnOw5udvZi4z7rLPII2o0VpB_hK7-g,1018 +torch/include/ATen/ops/chunk_compositeimplicitautograd_dispatch.h,sha256=wy6qt1tQEPO8wq9HEeuUchy-EP0A8jgDD4PTJ5Li6hA,1091 +torch/include/ATen/ops/chunk_native.h,sha256=uX8iw_vYs6nXUwfy3qYLiQbEw3wHe31mb3735-AmTmE,915 +torch/include/ATen/ops/chunk_ops.h,sha256=hnBo2lnWg55rFnSeZ-hC41iLwySjKxXhm60OSVnezG0,1399 +torch/include/ATen/ops/clamp.h,sha256=ywI1ja4r7spD48jJ6hCHjLwFeNqpID7Gdc-ERpQHGEU,3277 +torch/include/ATen/ops/clamp_compositeexplicitautogradnonfunctional_dispatch.h,sha256=m73HnPxgFawN3z2oBh2JraSKHNrhKlBy0ChsD-xmxWw,1597 +torch/include/ATen/ops/clamp_cpu_dispatch.h,sha256=cj13imM5w0niEaxfKGwRZ7X0Fr2_CyDAep8v731bKZE,2190 +torch/include/ATen/ops/clamp_cuda_dispatch.h,sha256=1G543lwxX5IEZBulObOnCNmZpdvCvJtnHjHT-SPlxfA,2192 +torch/include/ATen/ops/clamp_max.h,sha256=DLK2gq-yZuSp6M8eyGSa8Rg06wGt8hYJMS-QCMefSyw,2618 +torch/include/ATen/ops/clamp_max_compositeexplicitautogradnonfunctional_dispatch.h,sha256=px0bKWEjeHimuyh9_MhqvXTlGmHUbrOXQuJfrCbJ-50,1339 +torch/include/ATen/ops/clamp_max_cpu_dispatch.h,sha256=K7ymDqUNKQBBy2mFrK0EoZWs-ar9We_l9Dywlakk1RY,1695 +torch/include/ATen/ops/clamp_max_cuda_dispatch.h,sha256=PU6EU9T_nE09d4Z3nt_wwHm6jpmRE5Puoj3h6uTzQbw,1697 +torch/include/ATen/ops/clamp_max_meta.h,sha256=kYdyt_WlBhzovGxCVlVymoQV4EY0X_2LPtqcS-3hi8c,1029 +torch/include/ATen/ops/clamp_max_meta_dispatch.h,sha256=qgs6Upko8agRtYStsTIqFOUXwL-0N0tmET0YE7Ad1aQ,1697 +torch/include/ATen/ops/clamp_max_native.h,sha256=wRQDShgRwxzLoSmCibIFmwn0C8IdjyY7J2g7hIQLlaI,1099 +torch/include/ATen/ops/clamp_max_ops.h,sha256=KFx11fMOLAx4OA-9WGzBMMHHbULomlJduOzV_HPKDaM,4573 +torch/include/ATen/ops/clamp_meta.h,sha256=W_yH605nLNIZRVfpi5jFMMIl99xWTF0t6c547rX65nE,1081 +torch/include/ATen/ops/clamp_meta_dispatch.h,sha256=Fr5V6ByQfYJBeS9J-2qwrdpu0an1wO8vHE6-cOABhjw,2192 +torch/include/ATen/ops/clamp_min.h,sha256=1X4Zg5aRxOUzPRxknMA6Axb--YR9PtXfOlmTzc6KTw0,2618 +torch/include/ATen/ops/clamp_min_compositeexplicitautogradnonfunctional_dispatch.h,sha256=R-8uVP9yLdoWqeklH1MXGPmk1wiZaIiWdPqHlJnHdBc,1339 +torch/include/ATen/ops/clamp_min_cpu_dispatch.h,sha256=0QjNC7x6b5b9DGTyiGGi7PQ9da0Rovnr0ZdMFalvZB0,1695 +torch/include/ATen/ops/clamp_min_cuda_dispatch.h,sha256=nWqRKMt9GtcGawvcXXIsHnPZdS3oPqt3fXq_uD3mSzI,1697 +torch/include/ATen/ops/clamp_min_meta.h,sha256=8wMaMDsdyJqz0geIEtvnDR_HuDCkFHC0UYEEHSdY6bk,1029 +torch/include/ATen/ops/clamp_min_meta_dispatch.h,sha256=8vf8yZUGtYmoWiF85tiOzxtQYiTwZ8EHyveCJP1DFA4,1697 +torch/include/ATen/ops/clamp_min_native.h,sha256=YYIcDOodG1fBXrEWBxv4YyvYScp1lX-IM8MAgLDwGTM,1099 +torch/include/ATen/ops/clamp_min_ops.h,sha256=2NiMjdhM__mXMEWzFEIy-eBHAgfS-OFSUVQTOcXZpig,4573 +torch/include/ATen/ops/clamp_native.h,sha256=3h0hA4t87lwOeFkqaKLY7-No1yMBfXzvQoN2lIpquFo,1319 +torch/include/ATen/ops/clamp_ops.h,sha256=ma9p8ve2sc_6_BBxKP4TOaKSazMTv2zH_SY9Oq_7Vhk,5665 +torch/include/ATen/ops/clip.h,sha256=rhEA2mlhPyux_Sko3xKfQ-7GF1cO49IFiEXkX9Zd9ZQ,3252 +torch/include/ATen/ops/clip_compositeimplicitautograd_dispatch.h,sha256=OgHurhLMIPIenDwkD0whrHLx_9GY4pZubxxD12wqzRE,2226 +torch/include/ATen/ops/clip_native.h,sha256=mtBeZLfx9uqw6ScexNU_At_NzZ4B7AhOo-rTmlzmg-k,1625 +torch/include/ATen/ops/clip_ops.h,sha256=u_OVXOMTKgtauwrk76sMhRdOhqAe9UeQIclx_gz12W0,5647 +torch/include/ATen/ops/clone.h,sha256=d0vOeyyypqeVMm86EDgyfTJCjKEp5dWM99aTFG50yV0,1643 +torch/include/ATen/ops/clone_compositeexplicitautograd_dispatch.h,sha256=if2y0cgwpDAKxSFqpkvJoCQujRCdHxUQp20AUthpAO0,1379 +torch/include/ATen/ops/clone_native.h,sha256=jDenZxaYn-Jwwd5bjGItkngQnfyTcl5Ma2vHMq9xnwc,1585 +torch/include/ATen/ops/clone_ops.h,sha256=l4cjxQpj3zExhKDRlK5jNyov2lJZgn0CGLMzEJ0RgRc,2177 +torch/include/ATen/ops/coalesce.h,sha256=EbpHsZfGMvW_L1rBWPBkWlwGQnFmviAXFyNejonRWUw,791 +torch/include/ATen/ops/coalesce_compositeimplicitautograd_dispatch.h,sha256=crd0bk9t3aTtdKrWJ4pAwTldhIuhGUOY3bXJlGGS0Bw,1048 +torch/include/ATen/ops/coalesce_native.h,sha256=vcCbjefzJjWC0FA2KyrHgIgGusfa0AglvIxtP4O7em4,758 +torch/include/ATen/ops/coalesce_ops.h,sha256=K7Q7Vhp78hu167A0njuzc5hL_pSc4ctuFDVsJR3fLyI,1257 +torch/include/ATen/ops/col2im.h,sha256=PoOI5dwbAbkqFn51s73tKnXierxkaUnGAm_qpU7lwx0,6194 +torch/include/ATen/ops/col2im_cpu_dispatch.h,sha256=JoJSHHhpDX-uQ4zsJL61t6JzrWN8y3wIP_ttwdhTfRI,2206 +torch/include/ATen/ops/col2im_cuda_dispatch.h,sha256=bBwGvKMiJmDkBduFqrskWGTrakZ3vN0w7Tc3ocLFPOk,2208 +torch/include/ATen/ops/col2im_native.h,sha256=2DDpxYrQS8fUa0B4opkKlia5LLA4RKp0_moAo64EnkI,1519 +torch/include/ATen/ops/col2im_ops.h,sha256=kzvEB-L8NodcQeL2GxQM5f4zFrPBAhfvv4tFynoWWA0,2754 +torch/include/ATen/ops/col_indices.h,sha256=d0uI4FUHuVDYBbSSV4ob2K4fsdi1g6YgsfOk4O6PeZc,794 +torch/include/ATen/ops/col_indices_compositeexplicitautograd_dispatch.h,sha256=9lnOLhCp6PAqj_KsVRZ1iJnwsALMTzHBY0q0VXFh_rk,1051 +torch/include/ATen/ops/col_indices_copy.h,sha256=vsZEcTKA2chR40pIwHiBOjmCdpbAo7PY0uM0DudyNSY,1426 +torch/include/ATen/ops/col_indices_copy_compositeexplicitautograd_dispatch.h,sha256=ZkjMDOy0oXVBSu_1uobHtJIZ-W4LWnB-P0vQuwApO98,1170 +torch/include/ATen/ops/col_indices_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=XDXuUT_CjeQRvNDDX9ATxf2RB6GCZej9YhgTLunemXQ,1082 +torch/include/ATen/ops/col_indices_copy_native.h,sha256=XiuDdrlydC6jeQQsGpGTk3gcEZdgA8eIBOEuvnob-Oc,855 +torch/include/ATen/ops/col_indices_copy_ops.h,sha256=36fw2gnP-TolniH54fo7o7WN4TvweZfswDS2y73M2eg,1906 +torch/include/ATen/ops/col_indices_native.h,sha256=WXmItpNk54nOid9FCiG91iCXtm5k5GuUxPHByukLu_Y,840 +torch/include/ATen/ops/col_indices_ops.h,sha256=1KHfphWQMG6UIqtV_DmUjGWseclmkZeSpnRk0x-uO0s,1266 +torch/include/ATen/ops/column_stack.h,sha256=IX7XfMukigLnUuy6q2KGs4R7ehioCUPOJMfOgOdQHWE,1407 +torch/include/ATen/ops/column_stack_compositeimplicitautograd_dispatch.h,sha256=dx6IHJsUZUz2NG2h4G0oJg2oZJp5bTtVlV16mOtwvsw,1220 +torch/include/ATen/ops/column_stack_native.h,sha256=k1dxDZoMMM1PanSf2G97WQ342xwwXG7RGA8NhB_nXA4,845 +torch/include/ATen/ops/column_stack_ops.h,sha256=zSY2Vzkk2wgUaNCfdQqUrBtM7cx3vNEl6PMAzchkR7Q,1880 +torch/include/ATen/ops/combinations.h,sha256=SQeR89U9a9hBMUHeW4Uzo3bWgY2bhsDBH-aE6o9BgOI,1052 +torch/include/ATen/ops/combinations_compositeimplicitautograd_dispatch.h,sha256=U_roYUCmycVsI8l4QqSdadj6mMyeeimKv95sK4b5yqc,1094 +torch/include/ATen/ops/combinations_native.h,sha256=TV4i21hy7LXz1yUffFfy6zLAJhBJAssaFqUfG2SjB7o,804 +torch/include/ATen/ops/combinations_ops.h,sha256=zay2gVsubRQ7xhxQdtzQ2t4vlvQqtzWtZjCDI4da8iM,1384 +torch/include/ATen/ops/complex.h,sha256=QB8fqhkpnPsDbl84gBq_JlH7lsv5Mwn3UE6o8zg1ILY,1468 +torch/include/ATen/ops/complex_compositeexplicitautograd_dispatch.h,sha256=5iCeRnHhu9CIEiRt9UGOlxzNpyvEgG53tu4Y6fSCI1M,1072 +torch/include/ATen/ops/complex_cpu_dispatch.h,sha256=aCwoEDSRzDcLzmxRLqKE6uNP_AxXDKSQLMeHRzkLy2Y,1158 +torch/include/ATen/ops/complex_cuda_dispatch.h,sha256=odUqgq46w7n-LzfScLAZyyhhwU9snMBeg1xY-bYDEYw,1160 +torch/include/ATen/ops/complex_native.h,sha256=TrE-gIEwQfblAWy_ufjtCRloFmmncmDSlrfp5OIQ04E,887 +torch/include/ATen/ops/complex_ops.h,sha256=TbALRe_oBqTdbkbKBj_xUbLNAddaFeUFR-1stE_dkEo,2018 +torch/include/ATen/ops/concat.h,sha256=pfdR50z4kHKw-W4fJl3oN4P1e8T2WctxKqlt7BliMvk,2139 +torch/include/ATen/ops/concat_compositeimplicitautograd_dispatch.h,sha256=BpndFaFA1kZ_3j13nfEWT6MVOSEUlAdPgY3mtWIwM1c,1507 +torch/include/ATen/ops/concat_native.h,sha256=xPMPWag35FAoDWek3E8WCzwBU9hn_Yuyx82EzCWdwsU,1027 +torch/include/ATen/ops/concat_ops.h,sha256=-sZrcU6qki1-Gf9ClxPz1-KJuTP8QVyQriNMiJcsEOU,3201 +torch/include/ATen/ops/concatenate.h,sha256=UBT28jVatB66eyCjJn2LzoiWAmYhTI-ttKMLYbx7oKE,2234 +torch/include/ATen/ops/concatenate_compositeimplicitautograd_dispatch.h,sha256=2fV3T3wF17DESyl2NnXDR7tgg3406FEQS8QnL7b9Fcc,1537 +torch/include/ATen/ops/concatenate_native.h,sha256=XC3SzAKzAU0Mo5IWytZscL5tlkHzxnRwc_DEKBOyf3M,1047 +torch/include/ATen/ops/concatenate_ops.h,sha256=xVg_7fHydK5BrabVMGWv49BbWoBg5nQyIQ1CGQ2Gl-A,3261 +torch/include/ATen/ops/conj.h,sha256=3hP_dl1XSuD3BsLIlKoDOMinX4afArM6MRAtOdHjSc4,936 +torch/include/ATen/ops/conj_compositeimplicitautograd_dispatch.h,sha256=JphWH1GKRCmd_0CD5ig-LHNmngDC_QHLKLbNUxjpQSc,1044 +torch/include/ATen/ops/conj_native.h,sha256=b4w6TVM9ZqHslmV6io6th4AkgTwX6KuDPwhjrmOkDec,754 +torch/include/ATen/ops/conj_ops.h,sha256=78XK9GEuk42nMdMSb6e-0aX9biZoECkwADmNDFxo834,1245 +torch/include/ATen/ops/conj_physical.h,sha256=M3b3Ty5eO2XvEWvQVZlPNzwlaufeK0noknAJrRBFmrk,1564 +torch/include/ATen/ops/conj_physical_compositeexplicitautograd_dispatch.h,sha256=fNLhcd0vcRAV_8pjvA1jPgT6L9d4vcMEuik3HLdym9g,1050 +torch/include/ATen/ops/conj_physical_compositeimplicitautograd_dispatch.h,sha256=rx6wj8hN_n_I_LXpUCpwJh4duOQX9IyxRL_egxu7olI,1053 +torch/include/ATen/ops/conj_physical_cpu_dispatch.h,sha256=QriVl-xaA4ECnuoYnP6D2wHF4SruWR5Jtk3TLPDhYEo,1120 +torch/include/ATen/ops/conj_physical_cuda_dispatch.h,sha256=JbfxkW9mIuwnpkdSHTAsM3zWV8_3uCsNCEQHFbLZ15c,1122 +torch/include/ATen/ops/conj_physical_native.h,sha256=K0OGXf91Ifyb1JNab_Mv6fyCxCu6KiEF-TQnt9JW17M,1168 +torch/include/ATen/ops/conj_physical_ops.h,sha256=APH43ZfONrQgiXJEQoWPwVJcq6al0lbJZE_r0hRfGf4,2419 +torch/include/ATen/ops/constant_pad_nd.h,sha256=jd1OJ_dtbfIk3sar-wEEz7I2VDk12tZdrAwXh9demkA,4599 +torch/include/ATen/ops/constant_pad_nd_compositeexplicitautograd_dispatch.h,sha256=Q3_iVY5K9iAuWdede6iOYf_8H9lsa5THgBjrD9EpsZU,1796 +torch/include/ATen/ops/constant_pad_nd_native.h,sha256=oPwmUJzFfEK8LtGPNxnOVE6JjCgRQ8obPi-NpNdZTEE,960 +torch/include/ATen/ops/constant_pad_nd_ops.h,sha256=8S-CLEnAy8q4Ec-FizURoTNJleXMMNuzBMMTk2EOvkg,2246 +torch/include/ATen/ops/contiguous.h,sha256=3804YaeM7Y81yBqs3H1YokuhukmDYNKBIsQ6cz4haK0,793 +torch/include/ATen/ops/contiguous_compositeimplicitautograd_dispatch.h,sha256=OaDFsXt_UtPHUWHOU7j1d19RCmysjV6CtHA18T2SqcQ,1112 +torch/include/ATen/ops/contiguous_native.h,sha256=4-y0BaahqgjN52iPLk0574STvcB9jH4AQuDHGL63Q0M,822 +torch/include/ATen/ops/contiguous_ops.h,sha256=PSqyG-575x_Gp56tqUVGitlCMagKMkn_wibMKoJyNu0,1394 +torch/include/ATen/ops/conv1d.h,sha256=AsyR0mVVgoHKUE3Wc5ecMR05BWSylgGPnCp7xQhhzxc,4849 +torch/include/ATen/ops/conv1d_compositeimplicitautograd_dispatch.h,sha256=iSeqCw7kcIG9MZdM7s6ZMm7GlzQBcUjUcus7rWXUWqg,1981 +torch/include/ATen/ops/conv1d_native.h,sha256=Y-EwI34OD8cOK4ugrvXVsuk9ZkCjMj_Ei5vxk0jFNRc,1277 +torch/include/ATen/ops/conv1d_ops.h,sha256=bE6bripJYNXEXL81K7cE-5fu0flo_YHs_Wu3-Cm-Wm8,2976 +torch/include/ATen/ops/conv2d.h,sha256=_OYBOy3wdpdiqtY9yBIDm66DV7Uic8BHSLi35SRZWZM,4849 +torch/include/ATen/ops/conv2d_compositeimplicitautograd_dispatch.h,sha256=MwuemC07cmnsToEyw1uwTg4RP4a7KlMyTdn5sPe2hPY,1981 +torch/include/ATen/ops/conv2d_native.h,sha256=pnkx-tnoVhxZ4mzGjDxH_v7_UP5ZFzqbYW_9oF_zkC8,1277 +torch/include/ATen/ops/conv2d_ops.h,sha256=4fs-Wa51ymptCmKHTufZj7gUQIqDz6cgACwRfjICWFo,2976 +torch/include/ATen/ops/conv3d.h,sha256=pxjVEoHGBNzPcLDDKxR7knMLynCuc_D1hfd6AdK6R_g,4849 +torch/include/ATen/ops/conv3d_compositeimplicitautograd_dispatch.h,sha256=22TmybU7GXK3Ubth28kxlokHgfXk3F-PoZB07pdI-s0,1981 +torch/include/ATen/ops/conv3d_native.h,sha256=jgsehPiwRxi4zotx7FGNi1AUd7Qf-4RZmh8R0xAb_Hk,1277 +torch/include/ATen/ops/conv3d_ops.h,sha256=3nj4yAyqs_g4pMhVAsVKFh8RC7VNU8HbSv9K2Zb2MI8,2976 +torch/include/ATen/ops/conv_depthwise3d.h,sha256=D1rv0HhFQoOWpBOqIB14DOZJ5IVPyIte2onqVqBkCm0,7644 +torch/include/ATen/ops/conv_depthwise3d_compositeexplicitautograd_dispatch.h,sha256=rLUDphv0AAVQLnHtT0mbtQvUIwhK3Jh_0m_y7pxVws4,2087 +torch/include/ATen/ops/conv_depthwise3d_cuda_dispatch.h,sha256=TvusCXEJN_1lDwRMMzPDgo_Dm4_ANk0WSHLPYzAYSag,1448 +torch/include/ATen/ops/conv_depthwise3d_native.h,sha256=LCGD6P1L6sA5KxAd122eTX9kfyVgIRanS-w_UHYv4Ks,1229 +torch/include/ATen/ops/conv_depthwise3d_ops.h,sha256=WBa6mzg45jZ7FXenejzdl6Jo1vZgkN5J5MgUj68q23s,3162 +torch/include/ATen/ops/conv_tbc.h,sha256=OAlNe-trKPE5ZX-cg4_N4EkzD47jEqZBkEq6DoKg2IY,1719 +torch/include/ATen/ops/conv_tbc_backward.h,sha256=6PbxQk1232pyn5reKE0CN0LY0shfLTzQs7-FLaIGiN4,1193 +torch/include/ATen/ops/conv_tbc_backward_compositeimplicitautograd_dispatch.h,sha256=hPzNPnVZ2PH2loHNjpUcIijqippCqjbzcuOT_7roYNI,1184 +torch/include/ATen/ops/conv_tbc_backward_native.h,sha256=eJ4Lds9HyuhkprQFhqm5mZIXJbXLYzduJJJxaMlslDY,894 +torch/include/ATen/ops/conv_tbc_backward_ops.h,sha256=kx4DiKY79hhybbKgzetr-f_o72ngKwaAI7Z4a8QGfGw,1706 +torch/include/ATen/ops/conv_tbc_compositeexplicitautograd_dispatch.h,sha256=1Evsa2V30ectz408j8_4DmRnNu4-Bcytdc6jqxHPUss,1410 +torch/include/ATen/ops/conv_tbc_native.h,sha256=YIUkTa8BCE-EiXivrF-pkCo3vvZfvLrf1qUvGeCihfA,971 +torch/include/ATen/ops/conv_tbc_ops.h,sha256=9_ta8UpuNDd4LjmcexTzqGp9bfge8DbS7gIubBiZ9vY,2294 +torch/include/ATen/ops/conv_transpose1d.h,sha256=3W_fdh4fzi6AIDuyqrPoKDIXJtKuGLLU-WFjfzDEiDg,3314 +torch/include/ATen/ops/conv_transpose1d_compositeimplicitautograd_dispatch.h,sha256=X3Sy0xRGLxk3fWAokzH-H2K6GHY5EAVPhoUQXdi5UyY,1612 +torch/include/ATen/ops/conv_transpose1d_native.h,sha256=vOl8-V_UKwOgnafAWAZkkdSa6eCd6dUvBwDB8jZKrx0,1051 +torch/include/ATen/ops/conv_transpose1d_ops.h,sha256=wuoPYAToaLv0DQL0mYkmWAgXSlZBpKzxda1XOqBwd3w,1998 +torch/include/ATen/ops/conv_transpose2d.h,sha256=YJKH8LssCkRl2qQoeQygU7oYZCt6opeir7YB6x55BlQ,3350 +torch/include/ATen/ops/conv_transpose2d_compositeimplicitautograd_dispatch.h,sha256=AoS-IDeuL54tCeRZjiuqxTprctczNfZwfE2uN1_sbIw,1612 +torch/include/ATen/ops/conv_transpose2d_native.h,sha256=-KzMDrZtavDTaXX_inGGg56lBfEzAyBQnVuUJQYotAw,1051 +torch/include/ATen/ops/conv_transpose2d_ops.h,sha256=n-RCzvCNSbuLrUt5HUT6MTzZIXpTKMCrgkZyn_QOesg,2015 +torch/include/ATen/ops/conv_transpose3d.h,sha256=CTFP2WIboWHpljJ_df2nNiiaXn6Ogc2odGqY5z1355U,3350 +torch/include/ATen/ops/conv_transpose3d_compositeimplicitautograd_dispatch.h,sha256=4UC0pCovLcmsdcNt8dgZmm0Kb8-k45mg2T3D-ycdG0E,1612 +torch/include/ATen/ops/conv_transpose3d_native.h,sha256=mVGsH9hJqH8U9gbEZ6mMsdgF78Z0anFoE4A2IbV4tII,1051 +torch/include/ATen/ops/conv_transpose3d_ops.h,sha256=gACRMq_3eSrgDmRNq6KXG78ZK-YTKVMvOmCcpkY9Egg,2015 +torch/include/ATen/ops/convolution.h,sha256=cwYMvJAIUkPIUfJGpeuB8_OAIpSEDy_Um-u1Ww4aqmQ,8437 +torch/include/ATen/ops/convolution_backward.h,sha256=1mpOdVh3mv4UXYJxi4Wye0nzMpElaX9jVXhXAPjHav0,11838 +torch/include/ATen/ops/convolution_backward_compositeexplicitautograd_dispatch.h,sha256=7wl-MrXA4kcwPWa2r2QkxUL82S6o5FT5n6jm3rw6uww,3601 +torch/include/ATen/ops/convolution_backward_cuda_dispatch.h,sha256=hplKIHT4Lc6c16ww-TsNUuBTK9ZolVqw48LiDoBBALw,1729 +torch/include/ATen/ops/convolution_backward_native.h,sha256=29ojyiQrrgouMfmoVCHtRGfx3xM0ehmuQVFooikm7gw,1548 +torch/include/ATen/ops/convolution_backward_ops.h,sha256=GYBXR7RfBZBGmjB8jbtJ3mYdcu0_2wSJ3lAzBSczmAQ,4281 +torch/include/ATen/ops/convolution_backward_overrideable.h,sha256=SJUcWVxXC0Cq3kTxwQ2p_brZKLC_wrwuN_jkv0dWQls,11035 +torch/include/ATen/ops/convolution_backward_overrideable_compositeexplicitautograd_dispatch.h,sha256=-chP4DSYmJFv9AIEWKvcWxx19UJMEJEXn1FULx08rRg,3454 +torch/include/ATen/ops/convolution_backward_overrideable_native.h,sha256=_Y0Ctc84b2eTFK-GD90I5PuBAYNidfw-sW0qyUWsiaQ,1499 +torch/include/ATen/ops/convolution_backward_overrideable_ops.h,sha256=Q05M3kZioU8Tlbo7UG2o1uwK9fU1fVHPNfocexIVGMg,4136 +torch/include/ATen/ops/convolution_compositeexplicitautograd_dispatch.h,sha256=Fu8NGFSwoaQNRbyXxOCq4Oqi3o_TN230dOiCVV-SVTI,2790 +torch/include/ATen/ops/convolution_native.h,sha256=e918voJPoyRsHJwMsiSOG48nPgvvC6VtTgR97Br7DJ8,1292 +torch/include/ATen/ops/convolution_ops.h,sha256=9J4Y6wV1CFesNeZ-xM2NL2nt7Dhi_M3wCp_1L4hGn04,3398 +torch/include/ATen/ops/convolution_overrideable.h,sha256=yaFuyxOj3OdBuHDm723zgYtdYFqZw4bFK69HAy4-teA,8840 +torch/include/ATen/ops/convolution_overrideable_compositeexplicitautograd_dispatch.h,sha256=Gn8kOJhn1aqgGCTfNwVIX-eRN_ywB2vOkQdmyUBdIDE,2868 +torch/include/ATen/ops/convolution_overrideable_native.h,sha256=rgPxrsIBjxUBKKpKvot2gBtgvPy1E_gMdXpmNKKq0Io,1318 +torch/include/ATen/ops/convolution_overrideable_ops.h,sha256=FOIMARjKMnBa1mMIRIBQCgX01X5pWazgmalRX10gF7s,3476 +torch/include/ATen/ops/copy.h,sha256=8l_pUunToAMb74xhDZX5UpjJ-F65JyUviE1bNwN8BLY,1615 +torch/include/ATen/ops/copy_compositeexplicitautograd_dispatch.h,sha256=XTsgIjvufEHGDumpoV-4Z0nGSVzU2mnnVYk_9mpdCXc,1337 +torch/include/ATen/ops/copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=CM7L7Jp3dlDpMXyNGmrasaiKZfwAO5zmNioEfrh35f4,1119 +torch/include/ATen/ops/copy_meta_dispatch.h,sha256=anqS9pnH-EHrdZPTv9ElLGbgwoffrLK94XazBHztrZU,1051 +torch/include/ATen/ops/copy_native.h,sha256=aVW-N7bpBW63Xf_P4F9tMBMqc7Hf5nM3oIZqA6cSUn8,1572 +torch/include/ATen/ops/copy_ops.h,sha256=34m4UA49OdNGEFc8Ee1AXGyB7-PKhM71Tekn7tpykX0,2785 +torch/include/ATen/ops/copy_sparse_to_sparse.h,sha256=VhkiLIFLuLOdbCKkPpSHoluOUb9MxCKS_8uXGtkKvDA,2082 +torch/include/ATen/ops/copy_sparse_to_sparse_compositeexplicitautograd_dispatch.h,sha256=z1iO7idQrM20c63HiDrSAIr0jenQvuU-yopnoopD0zs,1391 +torch/include/ATen/ops/copy_sparse_to_sparse_meta_dispatch.h,sha256=4oKCO3nWp89huAwFTEjM5sviWQ-lKgYwi3UoQUlpswY,1065 +torch/include/ATen/ops/copy_sparse_to_sparse_native.h,sha256=wMo_scv1mSyNindswoSSbVlLpb6_5Kpi0MukUJWctMM,1063 +torch/include/ATen/ops/copy_sparse_to_sparse_ops.h,sha256=Dz0Hhc9cq0nYQuZrGs92vZpZTSkzJuoO_0rJSt4_GtQ,2938 +torch/include/ATen/ops/copysign.h,sha256=9Ixki2J7LzDATuK7WQ8Zjc5lMfVeHI7Y0JOeTVqpElI,2241 +torch/include/ATen/ops/copysign_compositeexplicitautograd_dispatch.h,sha256=eDm1TPTXm-2Qs7reeiE-fdAoqK0bKZFr-AHZVYqSLaw,1369 +torch/include/ATen/ops/copysign_compositeexplicitautogradnonfunctional_dispatch.h,sha256=6vcNK_5ko_IYtDGurwGFR-FGnsXtX2J34ohgcFuuMNc,1180 +torch/include/ATen/ops/copysign_cpu_dispatch.h,sha256=EQP4bGJY1hZzAvDofPY97Vx0OFbwsI-pG1gbOlHCCnY,1325 +torch/include/ATen/ops/copysign_cuda_dispatch.h,sha256=5HRKTntw1ZyjyPWF0HtamPJhLx0Tye1KDbRW4v0mOmQ,1327 +torch/include/ATen/ops/copysign_meta.h,sha256=mZ4Hoiyum6ayQB55v35pVdLqORmlwCdLJExz2QwhQlU,888 +torch/include/ATen/ops/copysign_meta_dispatch.h,sha256=FSmrZ-i0VOPlGkp0j6I3aAVv9fDihEOz3vQLyJP-4y4,1327 +torch/include/ATen/ops/copysign_native.h,sha256=09gmsPJq0409UwZQ9VYviF2uB3IPmrb60wb_bx56k5c,1187 +torch/include/ATen/ops/copysign_ops.h,sha256=ziyxo44dW-DTl1CuFqLkEO8jaypUuM6hfg0N0YDsTZ0,4631 +torch/include/ATen/ops/corrcoef.h,sha256=c6Q_hGDKZ48aDWkAVdtHvj26p8EtaBB8VoWnZeh2SXE,935 +torch/include/ATen/ops/corrcoef_compositeimplicitautograd_dispatch.h,sha256=dTHA2fjnL6NQlBgV7boKhjcEYQU_H3Z7AMhrePEf5xc,1048 +torch/include/ATen/ops/corrcoef_native.h,sha256=1RRTs_bDjrq3w1ePcpMR-mYC_NiV-tYVZpDysU7i5v4,758 +torch/include/ATen/ops/corrcoef_ops.h,sha256=rFMaqlRqtZZ_t7yQ9cUh5OWjrZ14u-3gPhqZl-pA5xQ,1251 +torch/include/ATen/ops/cos.h,sha256=h4H6bQZ13uZ0_EhzPdO-fcLkOCCMOB_5pnk7N2wnOVw,1434 +torch/include/ATen/ops/cos_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Jtkm59pNTbEBIl-Y6FMR4V3voVfJV5k_BZBrLlLAQ0Q,1118 +torch/include/ATen/ops/cos_cpu_dispatch.h,sha256=StuWSsEWyLHGae58phl6jsEEzVB2Ns-N5f84a7b8v2U,1201 +torch/include/ATen/ops/cos_cuda_dispatch.h,sha256=YUpZBxhrEOfXPme9jxicJgiVpXvFmX5doUkl2-lXVPw,1203 +torch/include/ATen/ops/cos_meta.h,sha256=sXTp7v2lyRddLt2ThTlQBwTz2QDv5J-GATL2Ax3XDIY,850 +torch/include/ATen/ops/cos_meta_dispatch.h,sha256=k2JnvgjUb_gewaxbPysuQLTthAjR_5cqBbptdplol_g,1203 +torch/include/ATen/ops/cos_native.h,sha256=jHKUP0NonLV5GANJ6nHuolUVq7mVIHuRtW-ODXQkbiM,934 +torch/include/ATen/ops/cos_ops.h,sha256=cDQcF9nOHSBYqdb4f7Z3y3uugZi4ntcNy2OqX6J7REA,2329 +torch/include/ATen/ops/cosh.h,sha256=F4VXZw89vCX_zNnNaGr0NVswKvtM0KZBRuLrdW5LSd8,1447 +torch/include/ATen/ops/cosh_compositeexplicitautogradnonfunctional_dispatch.h,sha256=IvlbSy5ze6NWIK2mS-vTYi43LqNX5a2nCenU8BU927o,1120 +torch/include/ATen/ops/cosh_cpu_dispatch.h,sha256=q0nYVT-QGyTms4cTmYdwVbXQMVKcz8LDDC2lGFcKd7c,1205 +torch/include/ATen/ops/cosh_cuda_dispatch.h,sha256=RjTSxBn9HOR1xrZzAstHd0caP3OMUkAtCDWUzumc6vQ,1207 +torch/include/ATen/ops/cosh_meta.h,sha256=04lbBPwzmS-XOKFLLXlaJsDHxkVtkaXW6WETPCEgL4c,851 +torch/include/ATen/ops/cosh_meta_dispatch.h,sha256=o6STwIUV1_ALuy6sJrh6CRy7CkcLvC8-sGQBrrXWSsc,1207 +torch/include/ATen/ops/cosh_native.h,sha256=m-QvgQfpaEZpr_n7Yj-gOK2UyuBhOoUpKnFv_jJ7TTY,872 +torch/include/ATen/ops/cosh_ops.h,sha256=F6RPaqU3veMRK5nRg_ox_gbHxS-sRnd85VJuwkTNVyM,2338 +torch/include/ATen/ops/cosine_embedding_loss.h,sha256=PjSd2mAf64OeipwedXsROaUVhuGVWLzggoGaEoFzOCY,1208 +torch/include/ATen/ops/cosine_embedding_loss_compositeimplicitautograd_dispatch.h,sha256=9LvOyF97rDyUvD7Hqk2fdpNDwQ4vineUxKwLgm72o8I,1175 +torch/include/ATen/ops/cosine_embedding_loss_native.h,sha256=KoNfND9FZb0ERiM7wr9P6QCPzB1YkoPe-9PGjPWqqzw,885 +torch/include/ATen/ops/cosine_embedding_loss_ops.h,sha256=STnpR9N7Gt0JW-DzzvGUudL1_g8_zoolX_JYqCaq0Fw,1597 +torch/include/ATen/ops/cosine_similarity.h,sha256=jpBedKXYOeu3jWqkmmxy9K_Lqh27mqh7JbxsPDzo03U,1074 +torch/include/ATen/ops/cosine_similarity_compositeimplicitautograd_dispatch.h,sha256=2GjW3foZTOvsOeIpJRmbQ1o_AqBVLNWVvPE2DvqxhU0,1111 +torch/include/ATen/ops/cosine_similarity_native.h,sha256=xO4w-z2NSAGf24By5AQcL4x32lRzayrIPgtGW17OwOU,821 +torch/include/ATen/ops/cosine_similarity_ops.h,sha256=ogERp4k5UoHK282Gvuc3IO518JCWcddMtK5cUcXfZtM,1444 +torch/include/ATen/ops/count_nonzero.h,sha256=__bS0YM7jYAblJ3N37UaX012L-gHbxQ44TRPDrXCzck,2361 +torch/include/ATen/ops/count_nonzero_compositeexplicitautograd_dispatch.h,sha256=FHEkWxm0uCkagt_y6lpC42MzSPzeb8GBggUCpaouJmg,1561 +torch/include/ATen/ops/count_nonzero_cpu_dispatch.h,sha256=H7HNda_JJSbpMKgZQyacbwAwN-eQXKfmYpX__ZHoRLc,1030 +torch/include/ATen/ops/count_nonzero_cuda_dispatch.h,sha256=wK7UL2spSPYcoqPKKBjAt3z2uDzR7L43Z9mnuW24LS4,1032 +torch/include/ATen/ops/count_nonzero_native.h,sha256=DVOVVUH-j0psiTG9RVjER-o_ChgS4RQFvwESGXu3lLM,1218 +torch/include/ATen/ops/count_nonzero_ops.h,sha256=OZlwv43w3PnN-OqxPvI0enSeVtDvuEO7Z1iKsWfqK2Q,3455 +torch/include/ATen/ops/cov.h,sha256=-Kd8fej0nrZHQmI1Uzi5YLhC8iAmEw6_2kWE72snPbw,1134 +torch/include/ATen/ops/cov_compositeimplicitautograd_dispatch.h,sha256=jPvRc8nfWrXkdtvjibYRBMAK1Kpj3bgzHbk9D7Dh_m4,1163 +torch/include/ATen/ops/cov_native.h,sha256=KeWar69DT31Vcb7FKkvnnFGfd-lLbuX98QxYpwAHdHo,873 +torch/include/ATen/ops/cov_ops.h,sha256=BHvfj-FPYo25qM-e6bjoLlBg29sOEoQaZKFFAq5N2L4,1610 +torch/include/ATen/ops/cross.h,sha256=PxraM8bhEowKYVRfHD6mEKtybppEX8GscKzBwktNROA,1637 +torch/include/ATen/ops/cross_compositeimplicitautograd_dispatch.h,sha256=Ixt1HQjmSUlEcTeROWtGmiTTI_ok6LLuQZp6qHvEIOg,1400 +torch/include/ATen/ops/cross_entropy_loss.h,sha256=tpi-Fypugyp2nwVZMxxnzdhQVCVclzHLMB4PxpBoLHk,2740 +torch/include/ATen/ops/cross_entropy_loss_compositeimplicitautograd_dispatch.h,sha256=wnFTZTMvbbhVQf6NZRikeyHxl2GlN6lhKVlNezubmws,1472 +torch/include/ATen/ops/cross_entropy_loss_native.h,sha256=mV5rjWEERj-MuzeR_cnQCtkIewqHJWzkFYjGznd2Ps8,947 +torch/include/ATen/ops/cross_entropy_loss_ops.h,sha256=6wbthrZ6CIhfO8b2FRIsWP-lzZ3PX3t2PQQ8ulaOoDg,1757 +torch/include/ATen/ops/cross_native.h,sha256=I8UQJ22gj3BE7CElSpUYMMgI0JVJkebwlc4Gyerwcdg,960 +torch/include/ATen/ops/cross_ops.h,sha256=NlpxdyFXgdkTEb7ps9H0Bw_y-uXuHhNCx-r0pnSsbms,2214 +torch/include/ATen/ops/crow_indices.h,sha256=q0rW5oAg0V5yeq5zaeWqgBNceMsbpHfNu_XEt2CI9LE,795 +torch/include/ATen/ops/crow_indices_compositeexplicitautograd_dispatch.h,sha256=45tmCczO4-VRWbVOvc0VNq16g5SJ_W62pnzigN8U3wk,1052 +torch/include/ATen/ops/crow_indices_copy.h,sha256=vwUlzhO3K1hZU37LFFDe36KmKcZG6LP3_del2MY5OFE,1436 +torch/include/ATen/ops/crow_indices_copy_compositeexplicitautograd_dispatch.h,sha256=33R7E7cAMcn7XEWiBe1L9HeOzU8H6YSuI4Mu6x5x3aQ,1172 +torch/include/ATen/ops/crow_indices_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=FEUYHTDCLozuXECtgzXNsS-E3GZ37A7BTvRNv5c2cCU,1083 +torch/include/ATen/ops/crow_indices_copy_native.h,sha256=LDi6kKdkbRRkhLmie0c3sY_kqFLDCkISpXGyAdj5gck,857 +torch/include/ATen/ops/crow_indices_copy_ops.h,sha256=Wt25vJiiu-YsgewMmCaXDMOXQlroU0HBqEApHQoG9TE,1912 +torch/include/ATen/ops/crow_indices_native.h,sha256=CLC2mw1VqI47CNEus2UV7DssiJxiubSsZTvKoz-khyE,842 +torch/include/ATen/ops/crow_indices_ops.h,sha256=6jLgcx-qvmpQzqAy13O7eTp7IvdqKegAZzEFX0md9-Q,1269 +torch/include/ATen/ops/ctc_loss.h,sha256=NZ3aCfOy3JkuaN_Hw2-NVPUbJwCbCVijFK8-PxBC2TU,1877 +torch/include/ATen/ops/ctc_loss_compositeimplicitautograd_dispatch.h,sha256=3bdqv1bFWi5x_R2pAyiD0b3Aua8P26ieS5MKEGpaMdI,1467 +torch/include/ATen/ops/ctc_loss_native.h,sha256=_brRZt6uoVMlHG6uqhe9wvwsvOJPNo4gRRtzsOAl1LQ,1177 +torch/include/ATen/ops/ctc_loss_ops.h,sha256=BA24wOHUM9rQ5s6SDdWNXwRUZZD_Z6qj3CD6a4LZGNU,2833 +torch/include/ATen/ops/cudnn_affine_grid_generator.h,sha256=obR_w9iEhffDC9fYmZ7mEzfqOqtLDc99NKnmlblP9u8,1802 +torch/include/ATen/ops/cudnn_affine_grid_generator_backward.h,sha256=cdiilBlJE43NlcBqADTd0Wi4B-MMhg1cH1ChwHbSO8o,1889 +torch/include/ATen/ops/cudnn_affine_grid_generator_backward_compositeexplicitautograd_dispatch.h,sha256=zM82Q5OfB_8EQVHzALSh0y5GUaaOND3k-nwLBBYxOM4,1298 +torch/include/ATen/ops/cudnn_affine_grid_generator_backward_cuda_dispatch.h,sha256=-aHt5kWR65wGEQsQZrwmIz_K9sZi6cvxyqgXmvEsoJI,1078 +torch/include/ATen/ops/cudnn_affine_grid_generator_backward_native.h,sha256=v8FpyDGxKdIqc2n9OLqC2i0gou6c0DuC9-ikUQIqdGo,983 +torch/include/ATen/ops/cudnn_affine_grid_generator_backward_ops.h,sha256=Engpp9_txiS7G1R0jgOPW5TBrFXY_RZFx-4SP0k-Nec,2341 +torch/include/ATen/ops/cudnn_affine_grid_generator_compositeexplicitautograd_dispatch.h,sha256=JRjOXzVsa4Ey1_5MFfp8T9g7yn4Dcoj2OzDo6w7FbWY,1282 +torch/include/ATen/ops/cudnn_affine_grid_generator_cuda_dispatch.h,sha256=UEd6Pdc8SIOf31b9QW_srXV-RnvKjCAIqzEkLrn1SMA,1070 +torch/include/ATen/ops/cudnn_affine_grid_generator_native.h,sha256=dPbuceYtFK5vTqEj4IsJvF6aWhaOOBj0HfrEktBHV5A,975 +torch/include/ATen/ops/cudnn_affine_grid_generator_ops.h,sha256=xfZd65C9ZF1oRIszkcq7MSz7HF1Qw7e4AXplkl_MFsg,2287 +torch/include/ATen/ops/cudnn_batch_norm.h,sha256=tXd44jFugoXLNYctzEYrX2fsGRn4Pw5sfVZJJLW0QPQ,3322 +torch/include/ATen/ops/cudnn_batch_norm_backward.h,sha256=k88wL7Vq2IfHN3yf6l7T9SEsHF6BJB7FfoaymIsVdbM,3514 +torch/include/ATen/ops/cudnn_batch_norm_backward_compositeexplicitautograd_dispatch.h,sha256=pT1xwQcZoeBnaJxibR-rElWr0Nr_BEQqMhiwJEI7EP8,1948 +torch/include/ATen/ops/cudnn_batch_norm_backward_cuda_dispatch.h,sha256=LqIdUxosh5I0CpD0v0NZOqfeV5JKFGTUGzixfP6sTsg,1360 +torch/include/ATen/ops/cudnn_batch_norm_backward_native.h,sha256=sf_DcZtRVCQdpeSDhHDXN8Avhn3qY9v05d7ia6YMXGc,1590 +torch/include/ATen/ops/cudnn_batch_norm_backward_ops.h,sha256=CSCgxSmk4tTjwDb5E74mnG5Psj_V-JWVPSZiFmoCOtk,4313 +torch/include/ATen/ops/cudnn_batch_norm_cuda_dispatch.h,sha256=E6WBD4Fkb9f8zCRoEpBrjZDLTfm2nkdpzQfv0H8GwIs,2167 +torch/include/ATen/ops/cudnn_batch_norm_native.h,sha256=-QkwWstaYXRcizyKWs9TiqZ7SrJBT2DBiMv8pQCRgRs,1483 +torch/include/ATen/ops/cudnn_batch_norm_ops.h,sha256=VPNF_NaaBl6uVVgabOSyRKOKQrkX1VDvg1PlC1IImpo,4000 +torch/include/ATen/ops/cudnn_convolution.h,sha256=eLWAB3kA_dI6ioPW4BIPOZdDxbwPdJsdbrIlF88LNZk,7987 +torch/include/ATen/ops/cudnn_convolution_add_relu.h,sha256=6i9rUerOQWOI7i8cv2IHJpw8HHjLSGY3un_RlXAlbSQ,8566 +torch/include/ATen/ops/cudnn_convolution_add_relu_compositeexplicitautograd_dispatch.h,sha256=OTT7QYifySUxGSGtEAYWCVaRCun53Hjs7NdGGi_Vj8I,2335 +torch/include/ATen/ops/cudnn_convolution_add_relu_cuda_dispatch.h,sha256=Hpfaeft_sZX8Mlk5gKFQtY48899CFEw1_9zO6WK_WBQ,1572 +torch/include/ATen/ops/cudnn_convolution_add_relu_native.h,sha256=JvgtnPAwE2hUvHwOiCc2RNo-Uj60AhXGForiU-XPEww,1348 +torch/include/ATen/ops/cudnn_convolution_add_relu_ops.h,sha256=JzoVI2OtOX0R533a-HoG_ICk_qhEYCwajclkj6ET-sk,3556 +torch/include/ATen/ops/cudnn_convolution_cuda_dispatch.h,sha256=DLtE6iCMVIuEXkqLArgnauLgPR12gAas75iJ_3ChOBI,2538 +torch/include/ATen/ops/cudnn_convolution_native.h,sha256=3cKFi9IGnjq27gXUjRKoydOV2j1Q3dp2smIH4YGOAhs,1199 +torch/include/ATen/ops/cudnn_convolution_ops.h,sha256=EwNj5afFRSaYLq9atC050WThEs7Qfovhtbk-E7yXN94,3162 +torch/include/ATen/ops/cudnn_convolution_relu.h,sha256=Pf5ggG99tOKqgrBpIwMChjyBrFazQo7__acOxG1dniQ,7392 +torch/include/ATen/ops/cudnn_convolution_relu_compositeexplicitautograd_dispatch.h,sha256=maJ4h5kSyOWC5NUcJDpPD5Jasb8AuaOwrdA7IiKdP7o,2059 +torch/include/ATen/ops/cudnn_convolution_relu_cuda_dispatch.h,sha256=JyeILXA7hPVPyEsRVqoHKX6Iudg9j867te-6HNpsvAM,1434 +torch/include/ATen/ops/cudnn_convolution_relu_native.h,sha256=hP9S_gX50TEhnMru8g4vpxJWOSIEkGuVEWxCfeyV6GU,1210 +torch/include/ATen/ops/cudnn_convolution_relu_ops.h,sha256=8-MMAxyxR_dYgYPzPX603P6yFqxONEB7_hoRkZ3wC8M,3108 +torch/include/ATen/ops/cudnn_convolution_transpose.h,sha256=D5iby0DoYBi4_hO2WpFc6WOx90dlWaIbN6vhRgfhd8Q,9203 +torch/include/ATen/ops/cudnn_convolution_transpose_compositeexplicitautograd_dispatch.h,sha256=ocrjm1He__teNGmuxWCDUp_-Q4-znK7WzXz-2gaVRIE,2259 +torch/include/ATen/ops/cudnn_convolution_transpose_cuda_dispatch.h,sha256=tPeFYwxnElPTu-fyVQ9wivy6_kLOmyDNggJY1VN4-wc,1534 +torch/include/ATen/ops/cudnn_convolution_transpose_native.h,sha256=JsVC91W4xZGEtaPyATlxSnYeLNCPJTsRQYYE4NUsHfk,1310 +torch/include/ATen/ops/cudnn_convolution_transpose_ops.h,sha256=QTnhgd0UmgJDS4Njj0pWHAZVRutOhq4ErmNFwOy2wcQ,3458 +torch/include/ATen/ops/cudnn_grid_sampler.h,sha256=WNGIfFZEUVeR_jpqeuW43xClhIdLicVMqClewEvh1WU,1585 +torch/include/ATen/ops/cudnn_grid_sampler_backward.h,sha256=1IhRqm1fnwyVxK0g04wtHMF4r62Ejx2dkawT9yNJUDo,2090 +torch/include/ATen/ops/cudnn_grid_sampler_backward_compositeexplicitautograd_dispatch.h,sha256=Df_PmMokPtgD5eTkqsqtakGaBRvyrxksmg-y0VO2QsI,1400 +torch/include/ATen/ops/cudnn_grid_sampler_backward_cuda_dispatch.h,sha256=KAevDurOBgYPPv1XV1j0I14GqFqWvi-0YlZEub4Dr9k,1107 +torch/include/ATen/ops/cudnn_grid_sampler_backward_native.h,sha256=ZEV-1bmS44WQFGyE9xckCjK-8ZAbLtCQonHxc9BURJ4,1063 +torch/include/ATen/ops/cudnn_grid_sampler_backward_ops.h,sha256=zSKAkzWzsiInXGLxNBUz7JLwqYLpruq4lDIgDAMg-CA,2618 +torch/include/ATen/ops/cudnn_grid_sampler_compositeexplicitautograd_dispatch.h,sha256=fL3oEl1UHxyMpQYed_AmdaTrdMF1lJNYusTtMPQfEcA,1224 +torch/include/ATen/ops/cudnn_grid_sampler_cuda_dispatch.h,sha256=xQapo3e_17DnlmDoFfXTQVop1NsTsJQ9en_3vx_voSk,1041 +torch/include/ATen/ops/cudnn_grid_sampler_native.h,sha256=CwN9I156McRFoFrz44dk2wRCWLm1IsXWrWods6UKzQE,917 +torch/include/ATen/ops/cudnn_grid_sampler_ops.h,sha256=SbDFFsNR0QDMxa4ulAlbAtFI_3dr7jZTWopi7ToU9Pc,2091 +torch/include/ATen/ops/cudnn_is_acceptable.h,sha256=MGA6XvOXkDpZII6vP_aYH28TygVA76l8mgK6w5GZ2GY,971 +torch/include/ATen/ops/cudnn_is_acceptable_compositeimplicitautograd_dispatch.h,sha256=fGqxgN0iUqhSLcBE3E8pV2ahZa8MKsPk3qahlsB62-c,1053 +torch/include/ATen/ops/cudnn_is_acceptable_native.h,sha256=oyZIjbKQJR2k8Zx54E16bBCnWZ5rQbVV9Mv185o7Ql0,763 +torch/include/ATen/ops/cudnn_is_acceptable_ops.h,sha256=E6uX6nBASw2_fMTRaqhkDm0_d6-3wt3HG9SzfsSoslA,1264 +torch/include/ATen/ops/cummax.h,sha256=efBN5hnN0olny_5mg36cR0JG4YKmQWM3_W1wcfO88lQ,2663 +torch/include/ATen/ops/cummax_compositeexplicitautograd_dispatch.h,sha256=kGFyYfg1rn8VvH6_ZNKSZwM31_SLbuTMr0LDsnkEO10,1373 +torch/include/ATen/ops/cummax_compositeimplicitautograd_dispatch.h,sha256=85OFgP6gPnmOTzPARRsW7QGMGmoFpdUDfoBG37PVifQ,1385 +torch/include/ATen/ops/cummax_native.h,sha256=wi-E2Q-ZAmD56Pzw1HdPf6L4VvchHWdlNIuZIHHrnrU,1183 +torch/include/ATen/ops/cummax_ops.h,sha256=L-CdRTB8Jbuz6a-TnuxlnNllRRIbw7K3iDhz9k6hF48,3807 +torch/include/ATen/ops/cummaxmin_backward.h,sha256=MMfCFa1oMBKVMPR3HjAE1Leekgj1Fxb2rtGukrLY6Vs,1102 +torch/include/ATen/ops/cummaxmin_backward_compositeimplicitautograd_dispatch.h,sha256=mndeoDiE1pPaltqz399vJt-7FSiIPuOkDvPZCkfriLA,1125 +torch/include/ATen/ops/cummaxmin_backward_native.h,sha256=hYHseEE5rnJjAMA3rN6sQQeDkFOROQX13pYRIL_bK1Q,835 +torch/include/ATen/ops/cummaxmin_backward_ops.h,sha256=ry6W14ob2KX12MloyIzRnlVnV2R0d0u8VIdYq5LgSes,1503 +torch/include/ATen/ops/cummin.h,sha256=IMhs1So0L-T07tbDEVncXPR-V2n7UBYxZ6u-HMTS0g8,2663 +torch/include/ATen/ops/cummin_compositeexplicitautograd_dispatch.h,sha256=U1G_nFVO0guzzNt4TZFOpF1HsD4uCroeHcg0ppRziJ0,1373 +torch/include/ATen/ops/cummin_compositeimplicitautograd_dispatch.h,sha256=CEI2S-SJ9wCx1MT9Dhqv0wjk3F-qUoQqb3ZrpmwYJd4,1385 +torch/include/ATen/ops/cummin_native.h,sha256=L8T3PGIUweFbL3jF1nVTKtErzrxsRdHqL3rftljPupg,1183 +torch/include/ATen/ops/cummin_ops.h,sha256=q5dg_qPSyA1jfsrETcFsN5lgV6arfTvCU4k6QhYIujE,3807 +torch/include/ATen/ops/cumprod.h,sha256=1MU7ZPTqG5rqEWYtLidyWuNNoGSnZfRZxCGRr7AkST0,2604 +torch/include/ATen/ops/cumprod_backward.h,sha256=s7l0hky9ya9FGTVgxcIjIOYCAsnSAV2Au1G-AuMt-NM,1091 +torch/include/ATen/ops/cumprod_backward_compositeimplicitautograd_dispatch.h,sha256=HvpGBB11-hhSQSfof1F2ylLnPoPQsapXEpssZBXl_gk,1122 +torch/include/ATen/ops/cumprod_backward_native.h,sha256=kjBD2gWM3xfbrWxd_BAOU_YBLpUmN0qdp8BO_Ak-OnE,832 +torch/include/ATen/ops/cumprod_backward_ops.h,sha256=a2yao6674rBIkEQFXsc3lxYgc2VjntNrnn4vEFz3kh8,1494 +torch/include/ATen/ops/cumprod_compositeexplicitautogradnonfunctional_dispatch.h,sha256=tQnlQgv770l-F7DnzAHmKbHDyMT1zrXONd3fXhcfSPg,1260 +torch/include/ATen/ops/cumprod_compositeimplicitautograd_dispatch.h,sha256=o5ipjGJLH3VDTZ4JUE49xRtGvVYpGAwPZsM2nENydzY,1530 +torch/include/ATen/ops/cumprod_cpu_dispatch.h,sha256=kofjn_5ePREtkCu_pjqxo-q2nZz8viMtblFoNBCVs3M,1470 +torch/include/ATen/ops/cumprod_cuda_dispatch.h,sha256=XFSYirvvygKhF5P2TmfJAF-m61DdfqGb-_2pxaBmXec,1472 +torch/include/ATen/ops/cumprod_meta.h,sha256=4zplHh9vZPFkpc5beGvH4PsyFik1QIZKVMMXL_oUE0U,906 +torch/include/ATen/ops/cumprod_meta_dispatch.h,sha256=S6n3RxH6aEIXyls0dRgdHXF5LIZ2WTMENPclSc9Tb_0,1472 +torch/include/ATen/ops/cumprod_native.h,sha256=8gPnY8Us20iMIwyQ5Lkcj9wqtxQTNQLgVea39TBo3gk,1320 +torch/include/ATen/ops/cumprod_ops.h,sha256=da5HKnfvzkoFmqaXTRLWfnlDIDuUgMzNIOdrQPCfH_8,5200 +torch/include/ATen/ops/cumsum.h,sha256=VpGRATYW5ny2q4M-vvjtpIF__hZrxcWVTwuBO9EAWH8,2585 +torch/include/ATen/ops/cumsum_compositeexplicitautogradnonfunctional_dispatch.h,sha256=ptWWJ4tFq0ZX79jn4o4dvza3rkTdpRDQS0PbDBAVPiA,1258 +torch/include/ATen/ops/cumsum_compositeimplicitautograd_dispatch.h,sha256=3T0yzneJVEV5SyN2pr8jxxOIaU33pnF41HbHRuQU9Sc,1526 +torch/include/ATen/ops/cumsum_cpu_dispatch.h,sha256=B7aoDJNW8328IyuCjgOEZJ24jj97ocL91YcHB5vuVAw,1466 +torch/include/ATen/ops/cumsum_cuda_dispatch.h,sha256=lxcKsOuTzY3niIeApUyQQz6QicItRL5eV3A_23EbKHc,1468 +torch/include/ATen/ops/cumsum_meta.h,sha256=0833MYf6w_epspUvZEMOIqy61s9AyKCyiF-6qdihPY4,905 +torch/include/ATen/ops/cumsum_meta_dispatch.h,sha256=OM6NZ1aFMysRQ7OQM1yvxqjGe7RKq55nmF34STRqjW8,1468 +torch/include/ATen/ops/cumsum_native.h,sha256=7AUiVZQ8xZ4ZikxMeSRkjib19rBO2aI6uiXN3hW2Hn4,1314 +torch/include/ATen/ops/cumsum_ops.h,sha256=SnW0VzjVcwyp3UuzfHnwtcaA_awCh7dHwmVBkJsqEXc,5182 +torch/include/ATen/ops/cumulative_trapezoid.h,sha256=bTjc8rIogbZ7M9FA336CgKfiHZw5J8W4mBdhiNhxd0o,1306 +torch/include/ATen/ops/cumulative_trapezoid_compositeimplicitautograd_dispatch.h,sha256=XicwLKXoHDgJyLbfe4-BFbkL5rpCz2TqvsTMP9J4E5c,1202 +torch/include/ATen/ops/cumulative_trapezoid_native.h,sha256=p_fwAkMR7bOK4CRaKdvLER7vB_eu3ak1hB6H2m3wbZc,912 +torch/include/ATen/ops/cumulative_trapezoid_ops.h,sha256=t4PeBQs3ogn-uhP4AFiDynXsyVPbT3ZiJUlBnGCd9q4,2088 +torch/include/ATen/ops/data.h,sha256=Be7KBA2H474orxEDZNlvJv4lGjrRbzEVv1EUpupUNJ8,787 +torch/include/ATen/ops/data_compositeimplicitautograd_dispatch.h,sha256=oQ20BxVQ-rTQA0gVjTmWPAFeSqNSEILDLXRBD2skY6o,1044 +torch/include/ATen/ops/data_native.h,sha256=jjtn7_CQrfVqGKmlhH9jLa_U3Ffr0wAzp6uHQGCLUX0,754 +torch/include/ATen/ops/data_ops.h,sha256=i3zFOHz9n_mD6YrwDcRKK8GJo888TKo7IeIPr94P9F8,1239 +torch/include/ATen/ops/deg2rad.h,sha256=obJfMzGetLVr0HVVKyAJoBoGxbmlce370b5uDSo9Cpc,1486 +torch/include/ATen/ops/deg2rad_compositeexplicitautograd_dispatch.h,sha256=s7t-KSgTad--4UHlCGCRKQgtQbLlftkEVPbYLiSLBZI,1261 +torch/include/ATen/ops/deg2rad_native.h,sha256=Kiogg-Ea73nsN9s6LO8h0-CyI3JuVyRu6Al-BQ_Wyhk,1322 +torch/include/ATen/ops/deg2rad_ops.h,sha256=qrDvGipG4MPYNu2NZRvxc3KWqo8RSieBrMTYoZWkj0w,2365 +torch/include/ATen/ops/dense_dim.h,sha256=-Xv6gv8fDQ7uGXIIEYGArPXE7LEejcoeQJFukmwKOmM,792 +torch/include/ATen/ops/dense_dim_compositeexplicitautograd_dispatch.h,sha256=VGojUMd3bO-1uoeKySG8dUMfd4KPkkgrgqrT6osQVuQ,1046 +torch/include/ATen/ops/dense_dim_native.h,sha256=N9GOqM0rCrh3knLvSwKJ5rHhopXP4KneaFYbITRqw90,892 +torch/include/ATen/ops/dense_dim_ops.h,sha256=mJLYwURLwLc3FaD9cu0yOm-_PH9nQOYfpdspzsFei8U,1242 +torch/include/ATen/ops/dequantize.h,sha256=5u3OxWKyF78K5ksgYOXW_50NDdVajWkw7DmrlTqPiAc,2033 +torch/include/ATen/ops/dequantize_compositeexplicitautograd_dispatch.h,sha256=zyz5kye1K2-Il7XoJOoSj2Uckwc0Ppil7SrmOZ_QEuw,1311 +torch/include/ATen/ops/dequantize_cpu_dispatch.h,sha256=rnvpsA_K6Oac7XQleHJktjI92kVIiAgVgBccy5VTT5c,1006 +torch/include/ATen/ops/dequantize_cuda_dispatch.h,sha256=1M-bUp7wK7rBmXv7x8RHkPLIznwx-TSeYgaRd7Q-KVY,1008 +torch/include/ATen/ops/dequantize_native.h,sha256=PKnOQG4abvlJQKngkb-4wIiq3M6IFicLi-kJRDxQRL8,1108 +torch/include/ATen/ops/dequantize_ops.h,sha256=CnnpGy1fm2gBUdtiWtcKUMSwwOkSMlLRzwzIbtGsTmw,3103 +torch/include/ATen/ops/det.h,sha256=yp-ufNBm2m1VEVAo_LBr0tEl4L07ZYu34cji-a2XbWg,915 +torch/include/ATen/ops/det_compositeimplicitautograd_dispatch.h,sha256=hml3TdddeL4S1UopxLS3HAP_UViv9FvXJDHLu8kJSyE,1043 +torch/include/ATen/ops/det_native.h,sha256=T8wAqHDYgCwfEjowMLTetJbxhVpb4lgy6GleRzvS-ks,753 +torch/include/ATen/ops/det_ops.h,sha256=RbAdFg2YTsXSDFZ4mkBJmXommcjusco50E-7HgJKtbg,1236 +torch/include/ATen/ops/detach.h,sha256=D2CiJFLkj-XwHIpFXC_7kSSqkDjYE4Kx4lVhG2Az9Lk,1080 +torch/include/ATen/ops/detach_compositeexplicitautograd_dispatch.h,sha256=cnUnIzMRaC69P3zzaGPxpxfc7qbJbVuqon1EHlMSsyA,1098 +torch/include/ATen/ops/detach_copy.h,sha256=5kcIS7DGTDi-SOjGPRzo21_xSg5bTLMOeLOVwnarVPE,1376 +torch/include/ATen/ops/detach_copy_compositeexplicitautograd_dispatch.h,sha256=0FFcwbVyDUvazLX0zXof7M4Ngbgvov4JFByYVFrwqpY,1160 +torch/include/ATen/ops/detach_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=IQ9fWLL4HN3m7RGMqpALy-JoMasKw9YPBkrPWGLOC3E,1077 +torch/include/ATen/ops/detach_copy_native.h,sha256=vPiJLhojRqrXCjpzfXmDwqu5lf-wyPdFSqOrsl_Jh0U,845 +torch/include/ATen/ops/detach_copy_ops.h,sha256=ybT51E8kvvq0NnsKLInw_hsjq340HgphfF3mOaRtqy4,1876 +torch/include/ATen/ops/detach_native.h,sha256=YLfcnaaHTzhpX-kHfjzDl93nkmWjGHSs3zmB2lm-sQQ,808 +torch/include/ATen/ops/detach_ops.h,sha256=meMYXQ055urc2WVg4vq79ASsVEYd8ZHhbBIVYPeQz3A,1761 +torch/include/ATen/ops/diag.h,sha256=uFWPiGJuNmysqkZaoyprq5U3Gnz-kcMlukrCZBTGmSw,1442 +torch/include/ATen/ops/diag_compositeimplicitautograd_dispatch.h,sha256=X0nEts0JwSh65TDlGhdhw_ZE4BMjHfUKgZELt7C8EnA,1257 +torch/include/ATen/ops/diag_embed.h,sha256=PHsUFaDFmUEdDFn8DXsaVvQK4tIgdJ5sbtOXJi-hHbo,1694 +torch/include/ATen/ops/diag_embed_compositeexplicitautograd_dispatch.h,sha256=D3UCpGs71QgcZJ2hQplOsjrwtAYwiQhaR2Lvx6gHUuA,1254 +torch/include/ATen/ops/diag_embed_compositeexplicitautogradnonfunctional_dispatch.h,sha256=B_cIhPbbJh5PVkwu1lwoorxjFkMVZCNvBG3Bn9XGDjE,1128 +torch/include/ATen/ops/diag_embed_native.h,sha256=7bMi7Znvzn0Q2kuOGyc8VD-mbAc-5RpUWGCBjtVksRQ,939 +torch/include/ATen/ops/diag_embed_ops.h,sha256=KYDK4k9hyz0h7uwZyD7-fwt4h1INrfGulS8AbRkCycA,2180 +torch/include/ATen/ops/diag_native.h,sha256=aT6IV0x336YfepCSjNU73U4ndXOsXq0RM2DMVP29fRk,869 +torch/include/ATen/ops/diag_ops.h,sha256=K0TJq_Wt-h-CcoDiEyxUKnrfTuyqajwu_UfZZNLf7DQ,1956 +torch/include/ATen/ops/diagflat.h,sha256=MwhXpj0Fq7fnUinlf3TBm9Lt-YdBX3ClAJDCC51Lozo,975 +torch/include/ATen/ops/diagflat_compositeimplicitautograd_dispatch.h,sha256=yVi98rKf62cymc5CeE2n2V0mL0x85afcR9ACgNWEH7E,1066 +torch/include/ATen/ops/diagflat_native.h,sha256=FPAYPkyG6rUG-OJBBls7w1UbgZtJ_MizV0c0L11ZFko,776 +torch/include/ATen/ops/diagflat_ops.h,sha256=mQ6SZKVFBLrMaoUWANL-RZtOpvnOJEyrbIe4-L9WO2s,1306 +torch/include/ATen/ops/diagonal.h,sha256=yFfXcn7ikVa9cCy6uGvF4qhfF2c7yNRK1fjnFzCkw-Q,1380 +torch/include/ATen/ops/diagonal_backward.h,sha256=C-tQFh_Fl-d4bl_upqc1KqK9LAVVSkg2RR7ZA1GIn7o,5563 +torch/include/ATen/ops/diagonal_backward_compositeexplicitautograd_dispatch.h,sha256=_wHKauG8-_oYo7DLFef1jDW2eGvf715Sjz7PbFU8Wv4,1998 +torch/include/ATen/ops/diagonal_backward_native.h,sha256=Sv8gHKTtbwUg9rXNWuQGbRqZzBhfURUomxoOXrVyf80,1039 +torch/include/ATen/ops/diagonal_backward_ops.h,sha256=pPY2bRcZN1FUqhC1TWEIjlOZloayx1m2by69dmdRqhI,2466 +torch/include/ATen/ops/diagonal_compositeexplicitautograd_dispatch.h,sha256=nQvlFInTj6x2zCk5mYm_pNueyusdxdz5ZfNyNU6qiaI,1098 +torch/include/ATen/ops/diagonal_compositeimplicitautograd_dispatch.h,sha256=hg0TT7YyMsHojdC7p3ziMGL7zNYrv22GOEgGEDewOWc,1122 +torch/include/ATen/ops/diagonal_copy.h,sha256=JULM9YytRSaJ3wyRKVHIt2PjZ03W2YZ0qHhJMV8hkng,1714 +torch/include/ATen/ops/diagonal_copy_compositeexplicitautograd_dispatch.h,sha256=B8Fl2VCcOrGgXgXcZdO_V8rANZEtbZh7pxt3jQ4QHGc,1258 +torch/include/ATen/ops/diagonal_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Fj0MZygZ5OrAWv0xtCbgv7tnrjKdsdR0fbNVQwNddG4,1129 +torch/include/ATen/ops/diagonal_copy_native.h,sha256=CS9oKzvQz2VTeNYACeeWcsmZFBzOgWmmRFLrONxdpGo,943 +torch/include/ATen/ops/diagonal_copy_ops.h,sha256=NVSIxR2dd1NVdQulJjtPqj0EnPLC0KqKez_sAb8NoEA,2194 +torch/include/ATen/ops/diagonal_native.h,sha256=Q_816E-rUTqhOhTI2fQbCXQmgS58hlzO6ZiO1vKmAJU,939 +torch/include/ATen/ops/diagonal_ops.h,sha256=DBlOJop9gNCPXsQW7EKv-HwNyFyWB0K-rHKFK-rv1bA,2209 +torch/include/ATen/ops/diagonal_scatter.h,sha256=JKUkpisKDHakjs6jAIZE1_7XRJJ7TOFZRpdvTMmLZF0,1867 +torch/include/ATen/ops/diagonal_scatter_compositeexplicitautograd_dispatch.h,sha256=X4_flRUa0DKa6aZveEXHnorm6tImfn1r1ixBBvcNd00,1312 +torch/include/ATen/ops/diagonal_scatter_compositeexplicitautogradnonfunctional_dispatch.h,sha256=6A3BbF3SzIG6WUG2254dzYRCAyoqRd4tJlYTxklGsoE,1156 +torch/include/ATen/ops/diagonal_scatter_native.h,sha256=r2UzTuzF74bGNYuIO6X48gsIQ77fjoJPDz0MzjoRYrI,997 +torch/include/ATen/ops/diagonal_scatter_ops.h,sha256=3d_WDhRrvtvgedskX4G-dKc9doZi0Zzwpd-zXFwHFG4,2372 +torch/include/ATen/ops/diff.h,sha256=AirMRwGUYg7SsHfOC9G5E9xGpqIMt90kHM0vDc8778o,1934 +torch/include/ATen/ops/diff_compositeimplicitautograd_dispatch.h,sha256=NX9WKMq3iCg2llBn_m2eD4j7A1F3GnDkplI_YqmQKNE,1560 +torch/include/ATen/ops/diff_native.h,sha256=m6yuD821fgfsr8vdp91yNdftwP9x0e_mWek07Rz64Ec,1068 +torch/include/ATen/ops/diff_ops.h,sha256=XNMtVVGKHW72Wqcw3hPswUKFZ9nsfU2Tjm7-5yNwonI,2598 +torch/include/ATen/ops/digamma.h,sha256=WUlGVLjUhSl2-hhXVSydxpvM1xhUjvXmp9hKYJJWAeo,1336 +torch/include/ATen/ops/digamma_compositeexplicitautogradnonfunctional_dispatch.h,sha256=wXSBqMpgJ2cA-K-BZBpJsSCIL2b5DRgVhzab_F9Cy_Q,1126 +torch/include/ATen/ops/digamma_cpu_dispatch.h,sha256=_TCnMNPUBDMsLWlhIkjZJEaL796GB5qC39AzludVYWM,1217 +torch/include/ATen/ops/digamma_cuda_dispatch.h,sha256=1GbKz3FAURzP2NBT4nspnOGrU1glVMl2w9a9IaJcUpA,1219 +torch/include/ATen/ops/digamma_meta.h,sha256=bWQzn0shzB1BvpXNxZOFmnbz8U9Vzt83Iik1GejstKI,854 +torch/include/ATen/ops/digamma_meta_dispatch.h,sha256=YrIoOzaYhIQyFsNfNmZnQh4I3g0gN_m_3L0Qhfg3yik,1219 +torch/include/ATen/ops/digamma_native.h,sha256=9YoOzX0M6nSWfmH6dyiErK2VTxa4udFkByeIWRqVaJo,881 +torch/include/ATen/ops/digamma_ops.h,sha256=XdBFydtaw4NU4EazAFfj0FtJ20iBAmRGyhLzOjBDdYE,2365 +torch/include/ATen/ops/dist.h,sha256=-kjJF9TSf473Lnvt7OXZiakcKQUGYDqq2R-_Cly4RDw,1562 +torch/include/ATen/ops/dist_compositeexplicitautograd_dispatch.h,sha256=uQ7qDFO7GTrDhuM2nBh07OGegqlxaA8XdyjY2IxQg4s,1347 +torch/include/ATen/ops/dist_native.h,sha256=2xOF-td2O-fURpy2aGI7ZALBojDZh0S0dDJPlRbZFf8,929 +torch/include/ATen/ops/dist_ops.h,sha256=A_ITHZVeBsWIH_9-paEActLaR_p6w0zmfI-A5iVmSfc,2158 +torch/include/ATen/ops/div.h,sha256=daMQYy1hdCxlJkAtL_hCcEX0JxcD-165WBHvPgcDQxg,4078 +torch/include/ATen/ops/div_compositeexplicitautograd_dispatch.h,sha256=JE_tHUKpeZVN9FKx2tQKjHhNsH4HvyLTiNENCHFdNTE,1903 +torch/include/ATen/ops/div_compositeexplicitautogradnonfunctional_dispatch.h,sha256=YBcNXWXxd5iFilk5aeSI45jCwPNAT8Hs1FxHwEwZGsc,1421 +torch/include/ATen/ops/div_cpu_dispatch.h,sha256=EdxfSy5tAgBYZkosjqnmEUI3WcKgZKhfm5U7MSSpOrE,1859 +torch/include/ATen/ops/div_cuda_dispatch.h,sha256=YT4MrzBB6V40leirHxYlHiTjZRmWvIYObCi7nyln_v0,1861 +torch/include/ATen/ops/div_meta.h,sha256=VGMF97QF1A2V4wT6KtXQjsDHcJVun717OOP-8AvnZjQ,1082 +torch/include/ATen/ops/div_meta_dispatch.h,sha256=IvECnSQWy1fM_huIyP8EX5ergBIIb9i_h6phfmOyT7o,1861 +torch/include/ATen/ops/div_native.h,sha256=oqjjZsWeZwM9Kpnqyu9SnsWfqgvinKEkeGqZYZMKzAw,2808 +torch/include/ATen/ops/div_ops.h,sha256=_ir23P3XNoXQAEKN9v9-wo7qCUZhYEBuRXW193RWzeQ,9368 +torch/include/ATen/ops/divide.h,sha256=xOoMPzNpS5dmH7D3iDO-PYL4HLmTtA6qsk_Njha2_lo,2959 +torch/include/ATen/ops/divide_compositeimplicitautograd_dispatch.h,sha256=BuJrtvrDN_YiCi2_z2-uVvYiiB6AOcrC_Wl1UgwOhso,2343 +torch/include/ATen/ops/divide_native.h,sha256=Z5daRAEQg7Sfz18MzWpDOJyUauTBnq8M0pGfQmyA2_M,1792 +torch/include/ATen/ops/divide_ops.h,sha256=VRQUzh2GBCCYQMeUt7L0sMqiUiok_PHvmSPgGji6buQ,7892 +torch/include/ATen/ops/dot.h,sha256=VylnEyh5NuwHJe3ifqMn5qQ69sHK-A5TCCG8I0LcBDc,1446 +torch/include/ATen/ops/dot_compositeexplicitautograd_dispatch.h,sha256=OIbuJfUlFrzMYjJfEA8ScHj4q5ItYxZPfwSAlXX4dQs,1198 +torch/include/ATen/ops/dot_cpu_dispatch.h,sha256=OLbKt3U0GfeTHxsse-Ul5-oLKf8LggoR07Yoaepfi3o,1026 +torch/include/ATen/ops/dot_cuda_dispatch.h,sha256=7E67s7oONqKBEcHqUCtVZAuVAQlZRAtpeGS9zGs1Utg,1028 +torch/include/ATen/ops/dot_native.h,sha256=IASFDZO5IWTX_WapzfiHmMAOn4tXcfvIy15qmlUOeGo,967 +torch/include/ATen/ops/dot_ops.h,sha256=hq88PKsqgteVKPP_DVii91lsTna4Y644nudwfmnbs8c,2006 +torch/include/ATen/ops/dropout.h,sha256=MOUp8pUr_LV1J5FuLw5Hz5hDE5ljxdWMNjCwSuoRBok,1190 +torch/include/ATen/ops/dropout_compositeimplicitautograd_dispatch.h,sha256=Dh-dUwH5Dg6kIV3TKZ8kLunY8r2YiSNDae5lSB5N410,1145 +torch/include/ATen/ops/dropout_native.h,sha256=0hAFRvRAuO4PR4b1xWlMRPDmyS2t6mzoxznsk8tdAi8,855 +torch/include/ATen/ops/dropout_ops.h,sha256=oqRxvPUnMGY539HuW9oQ0_cdm1EgjMUNNc7pkNoryIU,1922 +torch/include/ATen/ops/dsplit.h,sha256=6wjJntwWvfZj-zirisqOF6EcP46j92pe_sbmKjhVT_A,1234 +torch/include/ATen/ops/dsplit_compositeimplicitautograd_dispatch.h,sha256=PlGFRDCcNrcHrzm4S0xwxzCKLjiRHIlAoTTxTK6p16U,1174 +torch/include/ATen/ops/dsplit_native.h,sha256=rUf83KOg3nIgVa9qoOhjd1yUkzgQGuXayekydcf2bbQ,884 +torch/include/ATen/ops/dsplit_ops.h,sha256=Ws_GQSH5l8S-YYPx2hTJyPYuasUExU5pj2VVN2teYmY,2041 +torch/include/ATen/ops/dstack.h,sha256=OuArd4DQTlfp6KmkgumgfNTXnHfodQBYPQPkMM7u-gM,1347 +torch/include/ATen/ops/dstack_compositeimplicitautograd_dispatch.h,sha256=qp278_8vgS9JnMd78YcwNGHIcM9LAr4LKi4jsxCgF0Q,1202 +torch/include/ATen/ops/dstack_native.h,sha256=w5zCD7DowcVCS3MOOUzoVntpr19V9Exnqyu_PGdXA00,833 +torch/include/ATen/ops/dstack_ops.h,sha256=Zud-cnS6PiqEwZcuDsyalnOWOQLzSR0STqroEVE8VbY,1844 +torch/include/ATen/ops/einsum.h,sha256=9NFEJUyKf60edvxeCxDcmhBWyJGSFQEmTb0x3N0xIgU,1057 +torch/include/ATen/ops/einsum_compositeimplicitautograd_dispatch.h,sha256=Q8UecOyHWYTpSUBHOfnY0m_6XoenS1wybJXrIu8DzSc,1117 +torch/include/ATen/ops/einsum_native.h,sha256=MJgRUW9Lb4sddpAX-LCDC3WVHzDGgUTrgFazka2x_84,827 +torch/include/ATen/ops/einsum_ops.h,sha256=-m29oYvKVPQls3RoPuDs6SHOsjuHa4NGUo7kjWRmUBA,1436 +torch/include/ATen/ops/elu.h,sha256=rXw3RnXe5oYvUUREo-Dk_c_h7x4ugMpwIb3vK66Bqoo,2112 +torch/include/ATen/ops/elu_backward.h,sha256=ThMsfxo68EWmulpXAXrdw_UEHapDT_9Z3F_UggFe48o,2347 +torch/include/ATen/ops/elu_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=15VgDLNLrOXoHE-AZ8als2yLUwkFs4zD3TQiRyDyXUk,1220 +torch/include/ATen/ops/elu_backward_cpu_dispatch.h,sha256=dg0e-kcdv2PFer-F7HSq3QdJJVHBJRBVAdVujo2aDkU,1619 +torch/include/ATen/ops/elu_backward_cuda_dispatch.h,sha256=s9GY-c2hZAmgKYgHop06N2EYXW7dne1zjfVwycn9i3E,1621 +torch/include/ATen/ops/elu_backward_meta.h,sha256=arP45l2Syd-YDWKcgWxCDo-fa--cpZ63rJs4cH1sHf0,1001 +torch/include/ATen/ops/elu_backward_meta_dispatch.h,sha256=SvUvMFqeQmv4JdGgf3f1Ey7BBA8jmd-13uFBElSbRPA,1621 +torch/include/ATen/ops/elu_backward_native.h,sha256=BpMGNg-5JLWfvyLVYhedDzVCuDVREopZkU2ij3VWWOI,1045 +torch/include/ATen/ops/elu_backward_ops.h,sha256=EkOfjulXWePwBCETkQFPdo3T6WpklktgQ_Ahag07G2g,2852 +torch/include/ATen/ops/elu_compositeexplicitautogradnonfunctional_dispatch.h,sha256=q_g8WmGEKz24MSnVQPCDXT7EotvV8BOXROA7Bw6ihLY,1298 +torch/include/ATen/ops/elu_cpu_dispatch.h,sha256=3V2scopJQnVMOIvHANT5jVY_ZJPuPwvHiltyGAU6vQY,1555 +torch/include/ATen/ops/elu_cuda_dispatch.h,sha256=lzsCCBZjX38m7eE3TY4kQhDTRta-kKGU4AxW6hOuZuw,1557 +torch/include/ATen/ops/elu_meta.h,sha256=Ztu6eo5p5UQPyK075SHw-k0f3ZLA8XGnd4w1p1RIHMo,934 +torch/include/ATen/ops/elu_meta_dispatch.h,sha256=EibveZ24Rg1pcLvHbup7Q-5z_pwuRE0m5oOMKhH9Ym0,1557 +torch/include/ATen/ops/elu_native.h,sha256=yDdmIBU5ZHY1pDe6MqCcIp9Q1JR3QH-AaY-Hl6XhlVY,953 +torch/include/ATen/ops/elu_ops.h,sha256=vTt0ol2T0GpUP6t3G-5vRkzN80huvh6JHayzrsQg-Vw,3175 +torch/include/ATen/ops/embedding.h,sha256=PvpW-fX6qKSGLhHvGQtAWd4__QglxCg-vgep7tmqxyE,5711 +torch/include/ATen/ops/embedding_backward.h,sha256=Y9DRcAPbag3odcmpZMbhOIeYqyTOfcLp35VczlOWoEk,2498 +torch/include/ATen/ops/embedding_backward_compositeimplicitautograd_dispatch.h,sha256=zuHletFt_Qi2bZc398uDqvEaFtA9zbwV2UDsqsXrueE,1356 +torch/include/ATen/ops/embedding_backward_native.h,sha256=1-djcWG9okJp6ZbnDPyU48wzxnr5WLy-c1RAy4qCP8I,891 +torch/include/ATen/ops/embedding_backward_ops.h,sha256=e_1v4b7EI9NiWgZIkcavcfhggnah4m3AqZgMB9uDKn0,1665 +torch/include/ATen/ops/embedding_bag.h,sha256=fODLQUoMum1tpLVabhI3hkQLuBu6vISq9oB4IdjG6q4,2249 +torch/include/ATen/ops/embedding_bag_compositeimplicitautograd_dispatch.h,sha256=vQQzhpVmrpFGLffiT-zVFHzlha2atb1O08emqoC8VGM,1654 +torch/include/ATen/ops/embedding_bag_native.h,sha256=PGAcA0nN6DDuUXvA_KrfUQgx6NkkRCaWxu8YimJk1nU,1364 +torch/include/ATen/ops/embedding_bag_ops.h,sha256=gcGZpSm7GNu-nFUM_d06HpsJa1XRj0Ls2sEg1KCryNc,3560 +torch/include/ATen/ops/embedding_compositeexplicitautograd_dispatch.h,sha256=6L-KDBvhniLBafKWvMICMWbz2_Aknks5DH0f11sHu28,2064 +torch/include/ATen/ops/embedding_dense_backward.h,sha256=ahOfVVwqrGOx88Zf01oxkSytXaH94GaOi3mQVUlTz6w,6338 +torch/include/ATen/ops/embedding_dense_backward_compositeexplicitautograd_dispatch.h,sha256=insQcEFwJB1f6Y36O8d-I6CSGsAJXhH8D70tUBPF14I,1819 +torch/include/ATen/ops/embedding_dense_backward_cpu_dispatch.h,sha256=rJbrcJu1E6NyC4tk2lG808XFbD7H84CR0kwrT_ETjeg,1312 +torch/include/ATen/ops/embedding_dense_backward_cuda_dispatch.h,sha256=SUkrLzE4_xajtXfHTXdKsPYnCBLnJBl91Nv8PYATXrM,1314 +torch/include/ATen/ops/embedding_dense_backward_native.h,sha256=cB0-S__Bjti2BzL2onusPazAntkUbAj0-QVwIUfMu4Q,1274 +torch/include/ATen/ops/embedding_dense_backward_ops.h,sha256=dn6WkJ7lF1TfG6jrP5Y7-bzvtiw5PJGNt2jPe1G2pCs,2674 +torch/include/ATen/ops/embedding_native.h,sha256=Hn7R37qskbZYwS7k3oEUMOJrc0nyw6GcFCct4tXGagY,1231 +torch/include/ATen/ops/embedding_ops.h,sha256=8duT9bascRLwquqgxOkb2gSJKAa9xSN6vL8JNRJAoY0,2508 +torch/include/ATen/ops/embedding_renorm.h,sha256=HD6UVYgPPmI6vKyN0jT22-4eP92-4fXyTjFUndlFVdE,2171 +torch/include/ATen/ops/embedding_renorm_compositeexplicitautograd_dispatch.h,sha256=x-rC17n_F9U0SbMS8VV0XDC0i0eKe3ySAX-WK5Wkhhs,1424 +torch/include/ATen/ops/embedding_renorm_cpu_dispatch.h,sha256=1bA6pZtRtcFYtsuKpAhmKP-turpHYJVekazJIgwz_-A,1072 +torch/include/ATen/ops/embedding_renorm_cuda_dispatch.h,sha256=L3CVCr02fmDuvgd59z2blUHhJEB1g1wYWV8dF3Q20n8,1074 +torch/include/ATen/ops/embedding_renorm_meta_dispatch.h,sha256=nboZeykWQkEDlKu8BUn2L4yJ5ZUGEowQ4u2_boWwCbw,1074 +torch/include/ATen/ops/embedding_renorm_native.h,sha256=6zetQAfi4Zo7BRjOQgBEnn7x6HgoJyIdlQ3u2ckx_2o,1240 +torch/include/ATen/ops/embedding_renorm_ops.h,sha256=F0FWt8nosh8e5yo_RwRAgUdnhBY8N11nMjh4Pf57ufo,3079 +torch/include/ATen/ops/embedding_sparse_backward.h,sha256=_CSwaEXctuxCb1XAfyYZNRlMgY3P7GITRdedaWPcmWM,1228 +torch/include/ATen/ops/embedding_sparse_backward_compositeimplicitautograd_dispatch.h,sha256=jLVw16vjsoJb1RSjJF3rSFQMcTE6rdmFHSRmS5CBPx8,1160 +torch/include/ATen/ops/embedding_sparse_backward_native.h,sha256=ecDljDVYx9jdvSOIbtPFODina2gfgC5F7luJQ9T01B0,870 +torch/include/ATen/ops/embedding_sparse_backward_ops.h,sha256=MA2ZnPnF_BuLqKk9kDu0gqjix_CVuWCYwF9-i_vrzpQ,1611 +torch/include/ATen/ops/empty.h,sha256=bWKmJQysb9vzMlQ6TdSnhzvzDLIutuT3VvCk28ogfjo,9619 +torch/include/ATen/ops/empty_compositeexplicitautograd_dispatch.h,sha256=NShbq1yCwyvzkSXS4AvP74rVVUYcQAqNt01xllqixic,1805 +torch/include/ATen/ops/empty_compositeimplicitautograd_dispatch.h,sha256=djgOYzUwN5h0wyruhYQEs41-VYJOTlO6h4odgkI8G_8,1541 +torch/include/ATen/ops/empty_cpu_dispatch.h,sha256=kXxjsrcHkEMuZ9_JBBw5rsmlyGBABnDoBqvqNSW2RmA,1749 +torch/include/ATen/ops/empty_cuda_dispatch.h,sha256=bO6bxlUcMi_s9E-GO7W6szN3ekmhxHiYcqBHxp1kHoU,1751 +torch/include/ATen/ops/empty_like.h,sha256=Fzmy8ul3A-h3PXkOPXoK5D4cTAhaVuotIoWCjBAZkQk,2524 +torch/include/ATen/ops/empty_like_compositeexplicitautograd_dispatch.h,sha256=ZqdvZmNhh3YTfI1sS8GOvIzF9THGE0VKLfV-1hVv-Us,1677 +torch/include/ATen/ops/empty_like_native.h,sha256=ckWnKDmDTh1pPzTmFxXHsZtScy81q0juIuPAdF9X5zw,2272 +torch/include/ATen/ops/empty_like_ops.h,sha256=OvwcUo1EtxW4W-uFeACRdasGpKnao9Pm-_3lhYzvd8Q,2700 +torch/include/ATen/ops/empty_meta_dispatch.h,sha256=0B4wqGHdvHRqnRYuJg6D5PrsKLASO-g1fomLwauRsiU,1751 +torch/include/ATen/ops/empty_native.h,sha256=ueHLvwlOMWIQzpNVdMHu915PO6RToJhV9ZPg9qjnWTM,3883 +torch/include/ATen/ops/empty_ops.h,sha256=kDQs3TxmJWoDIFY_FkTYU6F4vSQj1EnQUsUYC9Rle4I,4936 +torch/include/ATen/ops/empty_permuted.h,sha256=OnwnyqCVPRZwliCXQ9Ta1aBGdsg-eW-wenu9w1X7hfM,7151 +torch/include/ATen/ops/empty_permuted_compositeexplicitautograd_dispatch.h,sha256=8TVDjOPkqqwXoS-al2dTyRkpH-0ozORBLURHYceLDt8,2227 +torch/include/ATen/ops/empty_permuted_native.h,sha256=Au5cmHL8mgqxuGd5KkMQJFZ9TVSsuCnDMpTMOfkl9HU,1090 +torch/include/ATen/ops/empty_permuted_ops.h,sha256=oit098KeH-dk5eJDJadomZQ2KcUZt1xxzeMP0MIPK90,2612 +torch/include/ATen/ops/empty_quantized.h,sha256=qsfpSyrVWeG20SWnVbQEyat_6vW27V_DrzHQ9rSWINU,2785 +torch/include/ATen/ops/empty_quantized_compositeexplicitautograd_dispatch.h,sha256=0w03zrIPaNiirgmq7gJgfdPPk0Fw3T5PZI8XBYE2_KI,1331 +torch/include/ATen/ops/empty_quantized_native.h,sha256=xMf1M5pj91bM4xk2zCdyPBa_yq18IiHyeW65k9PRC7Y,1173 +torch/include/ATen/ops/empty_quantized_ops.h,sha256=2kwa8knNQrAxmJmL7UKyTgJSnNKamm-gFUg6cES7G18,2894 +torch/include/ATen/ops/empty_strided.h,sha256=x_sysTbtBw5aXwKeRDbPhFJy7e6w_PBzIgcKIpMXMxk,7014 +torch/include/ATen/ops/empty_strided_compositeexplicitautograd_dispatch.h,sha256=GYgP-9C1O54CtMBI3el9n8kNGHvEX0rgDl_c2omcKlE,1451 +torch/include/ATen/ops/empty_strided_cpu_dispatch.h,sha256=IvKbOLFCyt0eHn4FSdAGcAc1O_CIhFS0gakmDqkcylo,1659 +torch/include/ATen/ops/empty_strided_cuda_dispatch.h,sha256=m6r55qEQ95VlrjF63GYnWBB6bnwBrs3C1bLFWkt4uEI,1661 +torch/include/ATen/ops/empty_strided_meta_dispatch.h,sha256=KDRNmLNLdHu2Tb0GUtAkljtMwAThrsIdcUZSQ8xzYbE,1661 +torch/include/ATen/ops/empty_strided_native.h,sha256=M-zxUSpLYVqxKkG5sXJ73vHxl9BH3wfaXUduZbl57Go,1830 +torch/include/ATen/ops/empty_strided_ops.h,sha256=vMRJVsE21moVaDsfNWm-tBeGd6zi6l7TpaavOEoaR10,2582 +torch/include/ATen/ops/eq.h,sha256=Z5Tc81IVslAv-JJT_FZ8VDoFLjhXdsapMzeXkTDAWFA,2155 +torch/include/ATen/ops/eq_compositeexplicitautogradnonfunctional_dispatch.h,sha256=gZpM_LlGBhDOGJif3ToHrmhCg9b84D9W7kPADQWzpP0,1319 +torch/include/ATen/ops/eq_cpu_dispatch.h,sha256=N20OS5bURFs6ToTYM6PrWpzsiz0hs5CIIvoiHUh5iME,1655 +torch/include/ATen/ops/eq_cuda_dispatch.h,sha256=XRz_UVyZSpAT3vJwU1-eviw8CUDjAhbYjtpZS57cOMU,1657 +torch/include/ATen/ops/eq_meta.h,sha256=Z4g5q6rsr0IYkaIq8yJjFixQK0XXssan3iOWgHM7lWs,1026 +torch/include/ATen/ops/eq_meta_dispatch.h,sha256=EPTnsDXL9TwCm9tXwnurspbcMoDj_j2O5BS8Z0SLmZY,1657 +torch/include/ATen/ops/eq_native.h,sha256=gRf1kcUdhoq2mn-5fq-bQ2Gz0IOw747wpRKHbw8a9l0,1676 +torch/include/ATen/ops/eq_ops.h,sha256=Bv0Mi-odtEAr9Oet1LSeC6JZi4gQYJIjyIfnTHymG_M,4544 +torch/include/ATen/ops/equal.h,sha256=6epCawGaBH3nYJe53ajeLMtwAxCB8OMDEoM-K4VkzQc,962 +torch/include/ATen/ops/equal_cpu_dispatch.h,sha256=lDmwaP2EUdAEh0Pav88HNE-pZI8N4POyTurh_1zr3eU,1021 +torch/include/ATen/ops/equal_cuda_dispatch.h,sha256=Ltgci_YmhSPLfqNW7EF_TzQuH7Jn7HEIv2E29H2gBsg,1023 +torch/include/ATen/ops/equal_native.h,sha256=SLVhVYKYop7_H7bwxLRtijgLxJ__bP-EmbiQFVa2_U0,946 +torch/include/ATen/ops/equal_ops.h,sha256=bEYUYNMSlffSYbkLXE1TmvHetXnbASeQmxtYY0Snhgs,1308 +torch/include/ATen/ops/erf.h,sha256=6CDROXHBD-S4TWJNRCeWhtEPS0V8TZgNq0z33Epk4f0,1434 +torch/include/ATen/ops/erf_compositeexplicitautogradnonfunctional_dispatch.h,sha256=CIN7tN25oZmmCvPfDjsZLOUJoa42wBWORUlJz7CLbv4,1118 +torch/include/ATen/ops/erf_cpu_dispatch.h,sha256=oC8YTeWwhF_XfDLB8wNZE3r4n_yp6sU3H20YksqJt4k,1201 +torch/include/ATen/ops/erf_cuda_dispatch.h,sha256=lDEqVEeQdf7vWLW1n_XEuM251SzxJBaO_OQiGDqeWXI,1203 +torch/include/ATen/ops/erf_meta.h,sha256=BEch8DrxRjuE44xLZbdn0ECuh8ABJe9OEkiDAf3WvKs,850 +torch/include/ATen/ops/erf_meta_dispatch.h,sha256=lqWvDsfUUbaZuqpeEJSUGlW3sA5U3Ixb8ljwDgWkx8Q,1203 +torch/include/ATen/ops/erf_native.h,sha256=WugaSAN97KOjQGpnYh2xj5Eora-1O2y2ID0iSOvn87Y,1277 +torch/include/ATen/ops/erf_ops.h,sha256=GyDTwIGixsN8Vnu8r6GDDKW4d0xyA91drE9RfkLek8c,2329 +torch/include/ATen/ops/erfc.h,sha256=E1toqD8z3Fm5bt1nqs_XR1j7YZHYL-d3gpmafiIK4Ho,1447 +torch/include/ATen/ops/erfc_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Fy_IqZlsqok5aMp-xAHyNEwFm8DpSe4r289VdlurxGY,1120 +torch/include/ATen/ops/erfc_cpu_dispatch.h,sha256=xLdfL1Y6XaSdpZyuS7XEPn70lk82Seghv2gjMB5V04c,1205 +torch/include/ATen/ops/erfc_cuda_dispatch.h,sha256=4p5Nhfha49dlwZFaUbQV_Tim-brl05t7CK_wRPv82z0,1207 +torch/include/ATen/ops/erfc_meta.h,sha256=AN15jq8m0jLFnsCvqBrTm9cRLuYdSsEs6XA2hyHCajs,851 +torch/include/ATen/ops/erfc_meta_dispatch.h,sha256=8qeKvDKmk3s917vOmvmT4mCNr37GDWq00BMgaklInX8,1207 +torch/include/ATen/ops/erfc_native.h,sha256=JNZvBWl9J7fn1Nn3FD1aFnuJP6yxLYM9nCJwQfcCTDY,872 +torch/include/ATen/ops/erfc_ops.h,sha256=KirseO1wN15rVkylnUGNt9G7G6HH2-OJjFjJDs0485U,2338 +torch/include/ATen/ops/erfinv.h,sha256=pgdi8CZ68p0ktm8eOv-bldv3k5Rl1Lsx09M6sX9tqI4,1326 +torch/include/ATen/ops/erfinv_compositeexplicitautogradnonfunctional_dispatch.h,sha256=H0wC-T_TpeZ3ENa8QVjCeJL_SL2gXS3WUigkQO2Svnk,1124 +torch/include/ATen/ops/erfinv_cpu_dispatch.h,sha256=DAPOSbZnXRF1FXsfdJJcOvgYz_HPba-BcfObHMS6kGA,1213 +torch/include/ATen/ops/erfinv_cuda_dispatch.h,sha256=3hMDKwCZTWXzXdE4qbPI2AceaRjlGHLK1zj7BSMzats,1215 +torch/include/ATen/ops/erfinv_meta.h,sha256=Sbzv2U4LbUk5X9UEw1HRlFRa4eeQJUcq9Zt0JbaGQE0,853 +torch/include/ATen/ops/erfinv_meta_dispatch.h,sha256=040M0wH8LczeoWaKeiAttxewHJIPTQ50ySaF4FI4lvo,1215 +torch/include/ATen/ops/erfinv_native.h,sha256=-azKjPgLjA6_y0IXQIYOj7Hr6UyVj23mfMjAnxPGAJc,1304 +torch/include/ATen/ops/erfinv_ops.h,sha256=uvh8zow_Aw5DMwJiNHR-kGWKS3z9SLz7ChhKFxV7SXA,2356 +torch/include/ATen/ops/exp.h,sha256=Pm2QY3bf4yWj0wcMja6VTpIYz_nRfgjHr1tgQcOqsk4,1434 +torch/include/ATen/ops/exp2.h,sha256=3d3-SnQecFssU1Nh_pX0SKsfkkFDXdO3iCS_R7Wu8rA,1447 +torch/include/ATen/ops/exp2_compositeexplicitautogradnonfunctional_dispatch.h,sha256=GL8muTVN6YAJ0t-DU9f3143PaVU_r4PfKyA0pdOOrr4,1120 +torch/include/ATen/ops/exp2_cpu_dispatch.h,sha256=PUFhZGxE5l6rF0Vx1dxkrLntn-qL9r4CdeHjhHE-7cI,1205 +torch/include/ATen/ops/exp2_cuda_dispatch.h,sha256=BlIdNeC7cDhmU85bp-l5hO4QVO5SauWPpOB_V1tRSnk,1207 +torch/include/ATen/ops/exp2_meta.h,sha256=e6ogRvs6p6YDawMQTpoqjtURtTjhw1wTknBdBVNqw-k,851 +torch/include/ATen/ops/exp2_meta_dispatch.h,sha256=_Go_mU_BKYsJ7gAb7UZr5WOjB6BStTy2qW_oqL1z12M,1207 +torch/include/ATen/ops/exp2_native.h,sha256=BH9_vpg4VVNDLfoGwmqVBbnB3BqTrPs3svIsKALNDnM,872 +torch/include/ATen/ops/exp2_ops.h,sha256=E8PnxKXXJZvYtZ51CdyeHlqOKoTZrKfohGk0XpBSDaw,2338 +torch/include/ATen/ops/exp_compositeexplicitautogradnonfunctional_dispatch.h,sha256=56aU_jjJLHnT06m0_W6Y_UZsbKRWe-MyrmGiyxxPzT8,1118 +torch/include/ATen/ops/exp_cpu_dispatch.h,sha256=XMm-iiA3Z7DIyvPUbPOmFs79B-Qn9eMtLBStPO3JLI8,1201 +torch/include/ATen/ops/exp_cuda_dispatch.h,sha256=obXlvoNCQRpqe3PepPMNaN4LuZ_CBYEV70JbJQDoM7o,1203 +torch/include/ATen/ops/exp_meta.h,sha256=LO23o12J3RcuwEfddNsfuDe7WSm1Ej0VmhFbFSJ6i_o,850 +torch/include/ATen/ops/exp_meta_dispatch.h,sha256=ITMXjXR8x36PJ9ejovUBZeWgRaoUiltkGcJM9dzmm_s,1203 +torch/include/ATen/ops/exp_native.h,sha256=fEzuFzhvgsO3mFbpFb2nxbw-tvTar7NR0cLMAWZPyOs,869 +torch/include/ATen/ops/exp_ops.h,sha256=3eEakC55mIKkI0dSmb6DAG8L8XX5J64iq93VZJURFsE,2329 +torch/include/ATen/ops/expand.h,sha256=6WCk7ZjBx4Ik5likn0H2E1UakYCBORdwtXjiudF4mhY,1343 +torch/include/ATen/ops/expand_as.h,sha256=mouSsY2VEswuUaZw2jMkNYBw1iRjwaUIfj13keTNYBM,792 +torch/include/ATen/ops/expand_as_compositeimplicitautograd_dispatch.h,sha256=E1aOQXuKlzFvCj8eGdR0yswIvyEJZyHrYRsFiU2kud8,1075 +torch/include/ATen/ops/expand_as_native.h,sha256=hgtF5dxjCjrejHe4nsTLaM6iCXego4CqfyBOeQ_7rsk,785 +torch/include/ATen/ops/expand_as_ops.h,sha256=zP7LiYIjVlHy8VzgXgDHb0FAONK5SJllsi2O-7GsXTY,1346 +torch/include/ATen/ops/expand_compositeexplicitautograd_dispatch.h,sha256=8EOIlLNG2LguDRvzhSEIvs6KpDi0ufKpGGkNZ2zjSyw,1198 +torch/include/ATen/ops/expand_copy.h,sha256=9prc51xfRAT7AMCRF7Wgu08jAv5ios-dD7FjoS62cnY,4477 +torch/include/ATen/ops/expand_copy_compositeexplicitautograd_dispatch.h,sha256=F6OsPiu2Ym5c7o4y7Ed5TwAmy5CiDP2OuVwmQ2NGkUs,1511 +torch/include/ATen/ops/expand_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=DqBJh1RijDJ_AFUrM2Jvy3fp_RmstWz6YMywpYJY7ac,1234 +torch/include/ATen/ops/expand_copy_native.h,sha256=-x-0hpzdsjOTRSfjw5yDw3fDvyMlHIwNe8B-7NcGytY,947 +torch/include/ATen/ops/expand_copy_ops.h,sha256=jt9GwXZplcB6nFm7jET636ST06VhVPNNk93dT5u0Uzk,2169 +torch/include/ATen/ops/expand_native.h,sha256=et-BoJeiIojHRWadfP-_9BgRZ2DFwx7fs6FoMlnqTHs,799 +torch/include/ATen/ops/expand_ops.h,sha256=iMiEUbtdxEeOrRg2eFjQNfhU1PJSSa1ImF1YzYhFRZk,1399 +torch/include/ATen/ops/expm1.h,sha256=4JxeNZgk-2Tk0faHo4dNDecgPCM2nGsOshNtgnVUmno,1460 +torch/include/ATen/ops/expm1_compositeexplicitautogradnonfunctional_dispatch.h,sha256=joNfg7hx6J0rhgMw5jnCstqdeqH12ZQoit59taicUgc,1122 +torch/include/ATen/ops/expm1_cpu_dispatch.h,sha256=XjqAUelJGM-LmFaBxieGurZFuEarIxTVeZkOg5yQ9ys,1209 +torch/include/ATen/ops/expm1_cuda_dispatch.h,sha256=WkUUtQtTSvIuBj04XVhxWLh66Lrv4Br_jdphEwqwINg,1211 +torch/include/ATen/ops/expm1_meta.h,sha256=6DncyugI9chtAgJzEZ0MrGlD8CJR3sH3Wm3ybO0CkG4,852 +torch/include/ATen/ops/expm1_meta_dispatch.h,sha256=zk6U-7_DI9Ysxc-CJRv_nILfQLQfQZ4F0UC1e5I3OxU,1211 +torch/include/ATen/ops/expm1_native.h,sha256=gYWxJ3zdHHwKN4aP9pYqGiJ8tpKbpGBvrKmnqz-yD1Y,1295 +torch/include/ATen/ops/expm1_ops.h,sha256=Sz7iCWzlGe7xSlvSl09rjvHDOEPFDPhr0j2Loj1z2q4,2347 +torch/include/ATen/ops/exponential.h,sha256=7slWWtM1GyZ8LJtM7O9Ad7Obt2CqrmjrtCPWigqQUII,1761 +torch/include/ATen/ops/exponential_compositeexplicitautograd_dispatch.h,sha256=ipUghdR9VluorzrstyT2ZS7uGRFcdxWxFFfPiEAbtz0,1422 +torch/include/ATen/ops/exponential_cpu_dispatch.h,sha256=CTv3NA45-LApK1gQqQH1CZ29cJzPm54T_O2ETf9sM1I,1077 +torch/include/ATen/ops/exponential_cuda_dispatch.h,sha256=8M4WugvXFAuk-M65mJ8gnBUL6WFCPqSMO8T-O4QdMNM,1079 +torch/include/ATen/ops/exponential_meta_dispatch.h,sha256=Ulpd_etKEctEVO_lBa6kbFRgmgrL9Br9mqOWme_NkCY,1079 +torch/include/ATen/ops/exponential_native.h,sha256=KjTKU9tV93PdiQlYzE3B6LohPMjbLEGOEYR2cM-IGsc,1104 +torch/include/ATen/ops/exponential_ops.h,sha256=XKw8D7cK-ivhlYvh2k4dEC8cFfe6dbLePQ7YMkZLzVY,2989 +torch/include/ATen/ops/eye.h,sha256=Bbcl6ab45FcBwB4ElbsknItd_taZHcy-zEN13jnBp04,10088 +torch/include/ATen/ops/eye_compositeexplicitautograd_dispatch.h,sha256=K741vueiWQFfhRU3C1AK0bX-pyGKbYfRMVqSBeoKtQM,2091 +torch/include/ATen/ops/eye_cpu_dispatch.h,sha256=G64-5KJjyi-mkOgFARmrEYByqLh_pYsBhnYQ80FztQs,1543 +torch/include/ATen/ops/eye_cuda_dispatch.h,sha256=m7LN0_LWA_DNtFzxkc1KebFeiMkqCcHnSOQ_3-HmCF4,1545 +torch/include/ATen/ops/eye_meta_dispatch.h,sha256=23mPySqy7gX_Guqdja9sZg5cisg5swCLqosmKe2ICuE,1545 +torch/include/ATen/ops/eye_native.h,sha256=XSbF1igNGrTB_vyg0kGs0aUUucuAnGsjkB7nLQd28M8,1390 +torch/include/ATen/ops/eye_ops.h,sha256=lKaPqUFlmltHqhtUAOz3xeV9gagbERbhZRmVZEYZjL4,3911 +torch/include/ATen/ops/fake_quantize_per_channel_affine.h,sha256=7u_I3C8pGrEU-fPbTWincl2Yz0EKGdfUoz960IHLfkg,1260 +torch/include/ATen/ops/fake_quantize_per_channel_affine_cachemask.h,sha256=7ajnA17jkZ3IPKVIkLde9z_yKqWZVrPESFDktJTGAsk,2592 +torch/include/ATen/ops/fake_quantize_per_channel_affine_cachemask_backward.h,sha256=3uCQYCOEo7cpavQ8FxczMahqU6aoOdBE5xEHYl88wfE,1151 +torch/include/ATen/ops/fake_quantize_per_channel_affine_cachemask_backward_compositeimplicitautograd_dispatch.h,sha256=h8cgrsSfue956Wqcx0xyjAowAzed17QwyHyKRAvBkGo,1116 +torch/include/ATen/ops/fake_quantize_per_channel_affine_cachemask_backward_native.h,sha256=Wt_0to2Y3hGMSRzlYvS1hgxaR_eGRCXh120VFHF-Wms,826 +torch/include/ATen/ops/fake_quantize_per_channel_affine_cachemask_backward_ops.h,sha256=9rmb86U2UABqNw8PiuEwEqGj8sqa7vzuaV3V9fr6A_k,1463 +torch/include/ATen/ops/fake_quantize_per_channel_affine_cachemask_compositeexplicitautograd_dispatch.h,sha256=LXqrPaAy3nz0v90MzDDviOvb4zyIirpEKIPgmE5i48c,1534 +torch/include/ATen/ops/fake_quantize_per_channel_affine_cachemask_cpu_dispatch.h,sha256=kMZaZuN_01qZ0mFcknfLLklM9KvV7kxZKVfLZjoVWaA,1172 +torch/include/ATen/ops/fake_quantize_per_channel_affine_cachemask_cuda_dispatch.h,sha256=GUpcL8kVx20bJ-Yp4LhXH_tj_QYsORdn4uG5GeJS9No,1174 +torch/include/ATen/ops/fake_quantize_per_channel_affine_cachemask_native.h,sha256=HXqUgMyUKM5fKLJFzOPx1W7OIoIXluL6FVmEEaa6XSU,1197 +torch/include/ATen/ops/fake_quantize_per_channel_affine_cachemask_ops.h,sha256=rHHAU1BjXHky82DxAzRAYg28X8nfFsUvR17mjqzpwBA,3042 +torch/include/ATen/ops/fake_quantize_per_channel_affine_compositeimplicitautograd_dispatch.h,sha256=g9rftYgFmwRiUy6-CEgEyn0r-JaxqIwc0TPukGc8IDc,1181 +torch/include/ATen/ops/fake_quantize_per_channel_affine_native.h,sha256=yxyJpoGM0tccxXur3_jMOBTEwOFwyzY9aJ0rHDo5ihg,891 +torch/include/ATen/ops/fake_quantize_per_channel_affine_ops.h,sha256=grFu6u8yCFw0H9TOSH9-YDt1W8m06-zDg2bIa4Q_1-w,1681 +torch/include/ATen/ops/fake_quantize_per_tensor_affine.h,sha256=we2zczt9KvwqKPUHqH65gfHBRK_JI-y8_fB2iVVhRl0,1643 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_cachemask.h,sha256=H7V7v-eVECrq-5NKXTQpimM4TYLQxuSfByZnDR65rKA,2411 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_cachemask_backward.h,sha256=sdOzUJKueyUv_f2qOLc1gLA5o0-o1QLKOHWIVmD3fGs,1147 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_cachemask_backward_compositeimplicitautograd_dispatch.h,sha256=8xuI1wxjrBXSfsWTRSG3DEaJTvYjAuRc39QOn7Q3puA,1115 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_cachemask_backward_native.h,sha256=EWpI6GMa84nZXSa-pssh9ISjsOKAwsLadgoaqRdaR5s,825 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_cachemask_backward_ops.h,sha256=jfvj8z1N5uN6tvkLtbpHwLxl0kG8BuEhh_OvPI34b-E,1460 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_cachemask_compositeexplicitautograd_dispatch.h,sha256=sDCuiaYVYIvp6BmeTR3LPrLgvkfTvm2ATp0dhQtKrfw,1458 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_cachemask_cpu_dispatch.h,sha256=4avHjSL6fZSb4gmSE636k08px2c8xT9e9AbIIWhTrME,1134 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_cachemask_cuda_dispatch.h,sha256=5Wy6q9svp6lVVzMmp0Cew3DIOxh4FybJv-CreGjiUpk,1136 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_cachemask_native.h,sha256=6AZS8DbslIaZin5AF1l5AXDhtErxr81TbEEV4d0eWw0,1121 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_cachemask_ops.h,sha256=hw7xbbIXckUQiUIRvZHQ1iBoeUHp_sLHmnVT7PqPW2Q,2796 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_compositeimplicitautograd_dispatch.h,sha256=OIBJ0C8SDpMFN-nrQG192eCZt3ttYOvuo_76dCuaqrM,1318 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_native.h,sha256=JDmOE9Z8UUQnkAQ1wiz_O0bTUkU1hnp9KQOMG40YmDk,1028 +torch/include/ATen/ops/fake_quantize_per_tensor_affine_ops.h,sha256=a1RLveW6ojrVA-hAkBoHCp6OfMcVnSdYr6igVqB5QaE,2499 +torch/include/ATen/ops/fbgemm_linear_fp16_weight.h,sha256=ChbyBnzyZwmdj16ooTFYKQL3L8ExlC2wXsY3TPXciC4,1492 +torch/include/ATen/ops/fbgemm_linear_fp16_weight_compositeimplicitautograd_dispatch.h,sha256=-l3zUejKoNw-yJAeRHI-nnk8XKE8tbQYPwZHQFgLFqI,1280 +torch/include/ATen/ops/fbgemm_linear_fp16_weight_fp32_activation.h,sha256=AazhFjPGH4ncAq2hF3qT9P9PHOaWJ5nVKpmJQbQDLMQ,1640 +torch/include/ATen/ops/fbgemm_linear_fp16_weight_fp32_activation_compositeimplicitautograd_dispatch.h,sha256=lWZi4061DPI3vNgI8QH5M3zzGE8S4SsAwGFz0YOECPU,1346 +torch/include/ATen/ops/fbgemm_linear_fp16_weight_fp32_activation_native.h,sha256=IiAgXGbLjBpLn7pZgWPYhYzCIs43Tshn4nzRjps_sgY,1056 +torch/include/ATen/ops/fbgemm_linear_fp16_weight_fp32_activation_ops.h,sha256=zbMOQWAnNm8ZNHddFMP59HaJzA1gdjlv_zN04Quw8ds,2548 +torch/include/ATen/ops/fbgemm_linear_fp16_weight_native.h,sha256=vEEG2Vky0c-xeNhBpSCD6osa1-4OhXVH7OOiSgiUAok,990 +torch/include/ATen/ops/fbgemm_linear_fp16_weight_ops.h,sha256=qcNNAAuA4Y_xSm1xJzVHEfX7xKVDav2i0cw6IDS3WAU,2348 +torch/include/ATen/ops/fbgemm_linear_int8_weight.h,sha256=7gf4xM0a3mSPYthJ1UspUYiwMwVJ6XLxqcAABPcbVJU,1366 +torch/include/ATen/ops/fbgemm_linear_int8_weight_compositeimplicitautograd_dispatch.h,sha256=swjUQ6Yx5U_baaM2bHOaaUdm1wNy2wVqxJo4modbDfc,1248 +torch/include/ATen/ops/fbgemm_linear_int8_weight_fp32_activation.h,sha256=w1cX5zVNmb2gtexw-xWIUmDjN-imGSdWTD5M1iDd_jc,1430 +torch/include/ATen/ops/fbgemm_linear_int8_weight_fp32_activation_compositeimplicitautograd_dispatch.h,sha256=FCptzuStJjLk3sJgPIMX31dM5L4pEJNeFIZ7JKxplyc,1264 +torch/include/ATen/ops/fbgemm_linear_int8_weight_fp32_activation_native.h,sha256=1h5zmP4uc3XQ3UJdCZAtfs3v2y5gQTQcf_H6oS7l1vc,974 +torch/include/ATen/ops/fbgemm_linear_int8_weight_fp32_activation_ops.h,sha256=KqMF39Hocj9vnjIhLle5wjIw15d-amnqQyoceUfpen8,1947 +torch/include/ATen/ops/fbgemm_linear_int8_weight_native.h,sha256=ZmeTakLlbCgeJ7xs8VnM14BW9iLOXx0P3XoecqB1BGY,958 +torch/include/ATen/ops/fbgemm_linear_int8_weight_ops.h,sha256=iANs-hP9ZudPBItqaCppKSyy9YaXofUiYabBPY-17co,1899 +torch/include/ATen/ops/fbgemm_linear_quantize_weight.h,sha256=WHW7VF4-jI07qhKHOoNlAwf83YpwTIhKw-wJn-7QytU,1084 +torch/include/ATen/ops/fbgemm_linear_quantize_weight_compositeimplicitautograd_dispatch.h,sha256=eyjZVXbM5QeqIY0xs9xhE3zgprbAUoHrVXOocmCmUSM,1110 +torch/include/ATen/ops/fbgemm_linear_quantize_weight_native.h,sha256=VLpJK4hQskT3yWEtWjqIFr4_rxzOemLtAev20GzXab0,820 +torch/include/ATen/ops/fbgemm_linear_quantize_weight_ops.h,sha256=NUG0owuOyRx568Ztw3Rx-TjkC8uqNqVZYRLM8E1jp9I,1459 +torch/include/ATen/ops/fbgemm_pack_gemm_matrix_fp16.h,sha256=GDioApzIuKO7Oa2gD6Wi1xjBFYfE_O-c6XBO5G7YZC0,1018 +torch/include/ATen/ops/fbgemm_pack_gemm_matrix_fp16_compositeimplicitautograd_dispatch.h,sha256=uatrR-UgNcQW42jHgf21knkZI5pYMTwirosGVLYdYNM,1069 +torch/include/ATen/ops/fbgemm_pack_gemm_matrix_fp16_native.h,sha256=7l-UJ6JHuujL6x126K2ZNlZWtYb7naEWGoD8RUDEuOQ,779 +torch/include/ATen/ops/fbgemm_pack_gemm_matrix_fp16_ops.h,sha256=9AeetkWcobkILHizUCfbbV0kRqPT5sC_H7LJxuQ89ZE,1314 +torch/include/ATen/ops/fbgemm_pack_quantized_matrix.h,sha256=jT2BSpWU4u8fq5NNqa5HS_vOTyN2s3-nk7CpSw8QGvs,1275 +torch/include/ATen/ops/fbgemm_pack_quantized_matrix_compositeimplicitautograd_dispatch.h,sha256=XuyuPTxDJ008Uf6FVXHEy9ailxyTW8MwIYdxNIMqst8,1169 +torch/include/ATen/ops/fbgemm_pack_quantized_matrix_native.h,sha256=LKNZyxcGH4qeE1NqUtOFQ8SEhmGyzmNFq5g8sEo3PjY,879 +torch/include/ATen/ops/fbgemm_pack_quantized_matrix_ops.h,sha256=ED5nRD6qUDHI1pmw6FpAfp9ojas36GLLP7LX9yHP5dE,1978 +torch/include/ATen/ops/feature_alpha_dropout.h,sha256=pS5-Jk7bF_2MGIjVX_UPrCYPZn-g0mCXZP3YmxTwCck,1288 +torch/include/ATen/ops/feature_alpha_dropout_compositeimplicitautograd_dispatch.h,sha256=XxKJB8eYyIb20soCipXCScY_jW39w4-VE0hn2iTgJZg,1173 +torch/include/ATen/ops/feature_alpha_dropout_native.h,sha256=Y0L76Bp1eFK0QpiaUTjHj2Cuz5QHdPlr8hF-zo-u8Mk,883 +torch/include/ATen/ops/feature_alpha_dropout_ops.h,sha256=PekUfNSRIBit94WoHbibrCpdbvv4Wiw0KbVhCX96uSg,2006 +torch/include/ATen/ops/feature_dropout.h,sha256=LIlYn36q43iPeCON6emTVLymzOrJOevADJyYGWuARlU,1246 +torch/include/ATen/ops/feature_dropout_compositeimplicitautograd_dispatch.h,sha256=o3CRCFV6CsBHiIAGT0D46Spur-Az5orqMvEz5E525Yk,1161 +torch/include/ATen/ops/feature_dropout_native.h,sha256=F7dxTVh-bj8JQyGLxpN_YbyITinnd2fXo8w4cCFefsw,871 +torch/include/ATen/ops/feature_dropout_ops.h,sha256=vy3_zTyWpJqG6xJ6TJcJkmjOApDvigi-mpdrBITQRR4,1970 +torch/include/ATen/ops/fft_fft.h,sha256=GtCbKdbhLyydUkzB_-ETOorlDFZ39sNAW1yTOsXyxb0,5373 +torch/include/ATen/ops/fft_fft2.h,sha256=dFMLXHuSPpDTIOnQkyuX2PbCKvN405jXdIUnOjx5_7g,5666 +torch/include/ATen/ops/fft_fft2_compositeimplicitautograd_dispatch.h,sha256=_9xTprMhewC-Z7QAeZtScIcHfO6iSbi20UZb72Ogs2U,2141 +torch/include/ATen/ops/fft_fft2_native.h,sha256=GxwdvsfX0Y5jApu2EuM32jc8c5WjyF9IPEdhY5TLqao,1073 +torch/include/ATen/ops/fft_fft2_ops.h,sha256=3ncCg-qBs7DeOzCJHRp5NkApsRhQ_PXme45ZBa12bDo,2492 +torch/include/ATen/ops/fft_fft_compositeimplicitautograd_dispatch.h,sha256=ojtepAlwx14qCG2t8Kqf2cnxN4D4uUE12kwbo7wT_GE,2076 +torch/include/ATen/ops/fft_fft_native.h,sha256=nQVRA_7_agXYw4cp9S8es-NQDlOU5ohSSToJ8AkRHJg,1054 +torch/include/ATen/ops/fft_fft_ops.h,sha256=qJDq3assoXagnYHfZRUShfrVa_TbxNpAlBfBp3eCzvg,2428 +torch/include/ATen/ops/fft_fftfreq.h,sha256=y9KOMS__QFg87HO6ebGPqIsGDisF3AxTZxXAT_3KN_0,2067 +torch/include/ATen/ops/fft_fftfreq_compositeexplicitautograd_dispatch.h,sha256=zc5lvvnd0gWY-Hn5a4uA0FZ4tCaIEP6V9z8FSFGhoMA,1447 +torch/include/ATen/ops/fft_fftfreq_native.h,sha256=WWkt4EBKs8pUsdsqnQQ0zgzLgPVKKUwBYWes3YS4nSE,998 +torch/include/ATen/ops/fft_fftfreq_ops.h,sha256=SyrB5cbnajJJ7dvvn4C1uY2ohmwfBaZJ9nZAeTHaxVY,2364 +torch/include/ATen/ops/fft_fftn.h,sha256=DKsqoxrGASKfKv1vryoPt_SUTjAqR8H70rIPRwAtrXo,5806 +torch/include/ATen/ops/fft_fftn_compositeimplicitautograd_dispatch.h,sha256=7Fv_nhNy3_RO410Dzl5V1rod2bM6iYXRZNbLqcqqWZk,2217 +torch/include/ATen/ops/fft_fftn_native.h,sha256=OPB409Rf3oR0OsQo-y9y2UiIyPZeDaKjCDscYlR3fBg,1096 +torch/include/ATen/ops/fft_fftn_ops.h,sha256=WKnLPqdTFRabrKdRO06CsXr2ckgAJUvATr8hNRybdmc,2536 +torch/include/ATen/ops/fft_fftshift.h,sha256=Fj96bmtuwrbQjyIMwMgblb_SeWzX9aVab1E3qkTeNIA,1018 +torch/include/ATen/ops/fft_fftshift_compositeimplicitautograd_dispatch.h,sha256=PvGazLZFTcOXc5fGjXwg8-_TdCttJyKTBvRrFUXk8Lg,1096 +torch/include/ATen/ops/fft_fftshift_native.h,sha256=j0RXWhkQUqKF7sO8w-56TUQZl7JLEq0fBFZYsuNBQmM,806 +torch/include/ATen/ops/fft_fftshift_ops.h,sha256=XCCf9GVmm-PGFaW4McgJhZGVouPzPd48NvYq_UChW9k,1364 +torch/include/ATen/ops/fft_hfft.h,sha256=Jyhgny2n6pRTyElHMFqkcdtstnshC1iGYbzE1_hykSw,5404 +torch/include/ATen/ops/fft_hfft2.h,sha256=0cNs-iFxfodvC_HZP9zWodgD7694hSRxXjdl7fOtHvM,5697 +torch/include/ATen/ops/fft_hfft2_compositeimplicitautograd_dispatch.h,sha256=KZghmg9qBT0ClOxhd4fVJ-8-FcqMiJuljefWuH6tziI,2147 +torch/include/ATen/ops/fft_hfft2_native.h,sha256=xoj0mROxSZmo_OXvHwsMunUZEGZus-8FyRhD9AcgYT4,1075 +torch/include/ATen/ops/fft_hfft2_ops.h,sha256=Yn1s7iRA0nDtHDeGtgHNRRamWjKPXuclIQG04LL79i0,2498 +torch/include/ATen/ops/fft_hfft_compositeimplicitautograd_dispatch.h,sha256=EFLJHdftQHxWstvNVHy_Be2wv8_VxT1ghgZo8MAELtU,2082 +torch/include/ATen/ops/fft_hfft_native.h,sha256=fsIaAr0ooJ1hrdiMruWZj9nrkPl52bF3bw3FmbGR3UE,1056 +torch/include/ATen/ops/fft_hfft_ops.h,sha256=ZEsLQON18MCHaXwxKIaS2Vtq5QQQDlYC3DZjQbsVI_s,2434 +torch/include/ATen/ops/fft_hfftn.h,sha256=pxANDiSxqRJc1YfbnkFAvRyNQHJIOE_CaRTVm-b4nIM,5837 +torch/include/ATen/ops/fft_hfftn_compositeimplicitautograd_dispatch.h,sha256=uDp741oYuOaFOHSu-gfoFOitrABgmJ_De-ZIZzXscH8,2223 +torch/include/ATen/ops/fft_hfftn_native.h,sha256=0umRQsBjZcRj4uiOxnsVSWrmgslCsHLDHMXKfby5rTI,1098 +torch/include/ATen/ops/fft_hfftn_ops.h,sha256=dpTkaDHqHPjEc8vppcleahuowaXTEdekQSKieW8OkUE,2542 +torch/include/ATen/ops/fft_ifft.h,sha256=spzLCUCdQg1iCiu9OdnmO_a0MUCExQ-bMovLyXZuHGc,5404 +torch/include/ATen/ops/fft_ifft2.h,sha256=WNdJ3bxG0S6BO1TvoSqn3cIY578AR_qn8NNTqghhaYQ,5697 +torch/include/ATen/ops/fft_ifft2_compositeimplicitautograd_dispatch.h,sha256=usVoUTeN2WwK4XPOlWrcAy5zgwO3WD5L3c9Xre2yVfc,2147 +torch/include/ATen/ops/fft_ifft2_native.h,sha256=8hUH9I6_zLRSImhD_ANhpns_9565iU8TGB8GwqoAck8,1075 +torch/include/ATen/ops/fft_ifft2_ops.h,sha256=Y9jNWYADnvljwhVEOXQOa4SQQOjgcRmVYvwSMyS-clA,2498 +torch/include/ATen/ops/fft_ifft_compositeimplicitautograd_dispatch.h,sha256=fEQjFHlvKoOH09ftpQOpBqjrTdgpabLy1xv7N-ggQXs,2082 +torch/include/ATen/ops/fft_ifft_native.h,sha256=9aTAzkJU57pFG5mum4tbh1OQ0YNIxtemteLdqg8W9ZY,1056 +torch/include/ATen/ops/fft_ifft_ops.h,sha256=10OFVTVnkTYQqBZ0nwO3lz0kiWwBNR7Ma4tAyDUNrAY,2434 +torch/include/ATen/ops/fft_ifftn.h,sha256=0ciRIPEEKzuRhSfuu6jaU94X6f9_ALSgNGuHL_VoGpo,5837 +torch/include/ATen/ops/fft_ifftn_compositeimplicitautograd_dispatch.h,sha256=DC_qq1LpoXgmEi6z71QcRKD3gYtPEV5JNQ3Q1ZCS6ao,2223 +torch/include/ATen/ops/fft_ifftn_native.h,sha256=Ur2U1_hxQYJcmsA8OI2PR7eUTjSgSfAakBeuq28wt14,1098 +torch/include/ATen/ops/fft_ifftn_ops.h,sha256=cQL4ZEtJCR-jQBm1dHyZOGgm-ogRVtM2nz4A_EJHL0A,2542 +torch/include/ATen/ops/fft_ifftshift.h,sha256=kLchzEUdcLSlk2JIIg99GLtkIbv4gObtQHvV8Q8FDvI,1022 +torch/include/ATen/ops/fft_ifftshift_compositeimplicitautograd_dispatch.h,sha256=8rllwrdF_svbxbwJVoRMIJt6hXN5DGIUVwBH-tpF9B4,1097 +torch/include/ATen/ops/fft_ifftshift_native.h,sha256=QPmixh-jxPLxM4W9uqaaot51Z5_H9U0dtSTSz5Dz5bY,807 +torch/include/ATen/ops/fft_ifftshift_ops.h,sha256=dz6f5n_mHvK14g8ILr5E6NStdAW0mDTSeDMoH_2wl8w,1367 +torch/include/ATen/ops/fft_ihfft.h,sha256=PHEdz5XeVbPJlqHUei6V658aGpPaaJzGjA5z2qCawDk,5435 +torch/include/ATen/ops/fft_ihfft2.h,sha256=VSpzNiOaR2kF0QRXyuOs66jQ-gNpKAU-IKQ8Zb7Cd9k,5728 +torch/include/ATen/ops/fft_ihfft2_compositeimplicitautograd_dispatch.h,sha256=4pFqOMopXDohM7aF7dLoILi-e3tk5ZJCS9a1f5hzgAM,2153 +torch/include/ATen/ops/fft_ihfft2_native.h,sha256=2ZWgNhCRWGxSgXqJak_h55YmO74dZ6ylyH29HfFQTB4,1077 +torch/include/ATen/ops/fft_ihfft2_ops.h,sha256=oYCUINub1o8ujhr0ht5RX9HdVMyZsuW4qzVr0UIFqoM,2504 +torch/include/ATen/ops/fft_ihfft_compositeimplicitautograd_dispatch.h,sha256=komJgJIHZSAq7yYEzxgd7ZiV7KO6P9RIs6-RiEOhk9A,2088 +torch/include/ATen/ops/fft_ihfft_native.h,sha256=FGokXDmn5HbNdp3z418cxQ5ElkzMfvmjd8rDvx1NFbA,1058 +torch/include/ATen/ops/fft_ihfft_ops.h,sha256=k_vsAT0M5uwClaV5EgE-58TNr4ziCtCpdjFyYBcl9-c,2440 +torch/include/ATen/ops/fft_ihfftn.h,sha256=ubZBpSVEbmRxFvw1Ji4ljMeI8t68ln_OUNbDfhWWtLQ,5868 +torch/include/ATen/ops/fft_ihfftn_compositeimplicitautograd_dispatch.h,sha256=mR0FwXJtLaefeMEHstTfBjRVQNWgKSlZ0qBfyA7x2Fc,2229 +torch/include/ATen/ops/fft_ihfftn_native.h,sha256=AHwdv7girP-Gej5BFmpDq8qzzGEZKA5PTtNhAJvlKAg,1100 +torch/include/ATen/ops/fft_ihfftn_ops.h,sha256=VNPZcPP9EkHvtw1hoDvxePHVHt2XqVPE7xfk16UCRdU,2548 +torch/include/ATen/ops/fft_irfft.h,sha256=-vkJyuRHwANV-mFp-Ky7S8J_bpTg9vAFGtve_5DY3wk,5435 +torch/include/ATen/ops/fft_irfft2.h,sha256=hr_1I178dI9nzpJqeSa9YUQg_k5EY3Xgg56bSEVkmYo,5728 +torch/include/ATen/ops/fft_irfft2_compositeimplicitautograd_dispatch.h,sha256=qDTbgcl1S6o26mr7lEIF2fskGbOOhlYwiFjRLxhB9KI,2153 +torch/include/ATen/ops/fft_irfft2_native.h,sha256=lUHbB817fHKOXk0py6eJQapRT5-elQqCtt0kXlP8nv0,1077 +torch/include/ATen/ops/fft_irfft2_ops.h,sha256=X5GMqFeGRJ7KmKzHy3UvG53ENx6Noip3a9i1bAYkYCE,2504 +torch/include/ATen/ops/fft_irfft_compositeimplicitautograd_dispatch.h,sha256=uP2KENtnC_QnLjh3aLKIxMyaSrpLTZgPvjvOsxnp6G8,2088 +torch/include/ATen/ops/fft_irfft_native.h,sha256=I30BWWuh95goSoCeVXqEuIl_W5AThTb2jVfet75TY04,1058 +torch/include/ATen/ops/fft_irfft_ops.h,sha256=MeStqLiuWEMB02OozS95rxwMvp1vKgw4bVBysCnsc_w,2440 +torch/include/ATen/ops/fft_irfftn.h,sha256=9VQx5YBxJ-fBxpIrt4-2PNq9aavokTOQfzkn0JjDRlo,5868 +torch/include/ATen/ops/fft_irfftn_compositeimplicitautograd_dispatch.h,sha256=7gZqnwAedU3JeuTARNyewx07LRKDK00xRqbak-pjkn8,2229 +torch/include/ATen/ops/fft_irfftn_native.h,sha256=AlGQHfxgUNEhIWXAVcoDocdF8m767ZBhOXWVMSsV560,1100 +torch/include/ATen/ops/fft_irfftn_ops.h,sha256=MF7N2WL5tN6Yjrz-rkFIslnVQA5gZTHJzxZmLTHf4eU,2548 +torch/include/ATen/ops/fft_rfft.h,sha256=4jZed1z49v4_EtcjEbhHFO_1UhT6z6YQk33DSGo_y9o,5404 +torch/include/ATen/ops/fft_rfft2.h,sha256=1k45I0OvKMuH6hP3W9aeJb2Or27eK_P5qqeAwImSHEY,5697 +torch/include/ATen/ops/fft_rfft2_compositeimplicitautograd_dispatch.h,sha256=KHOMVlWNwxE6mMXnTjG5sfehYs8Q69-NdWZppWzzrio,2147 +torch/include/ATen/ops/fft_rfft2_native.h,sha256=bHwFj2Oz98cKn9QqYarik3HWBQwvNSbm7XbbmufPS6c,1075 +torch/include/ATen/ops/fft_rfft2_ops.h,sha256=VBzZHh1W-TnryXeHPFb1uSm5VClfu0esb1SMsyoTGm0,2498 +torch/include/ATen/ops/fft_rfft_compositeimplicitautograd_dispatch.h,sha256=RrZpGXaYX4fMk0eA_rjs2ZvxVHfuhBvkoVcRYbrXb3E,2082 +torch/include/ATen/ops/fft_rfft_native.h,sha256=6Qn5me-py87AWMON3orCC0Y3p-CZvG1t3feLoioIumA,1056 +torch/include/ATen/ops/fft_rfft_ops.h,sha256=DBFVwBVLE02t3QZD4RZi-vQ51ACQmQYD9xkXrJ2Wq7o,2434 +torch/include/ATen/ops/fft_rfftfreq.h,sha256=oO7HpVyNHfHOca6i5So6eSr6cX_Qii16vhvs_eDHrjE,2080 +torch/include/ATen/ops/fft_rfftfreq_compositeexplicitautograd_dispatch.h,sha256=T1xRiPs_IA9_SUCe_5gl8FUVdt_adgEUxYWY9YnL48g,1451 +torch/include/ATen/ops/fft_rfftfreq_native.h,sha256=h7FoDRacN7Rk3lvU6iLqHVigRNtI9FxlodoI6w4Nqy0,1000 +torch/include/ATen/ops/fft_rfftfreq_ops.h,sha256=HmlG2aNXyES7_LAkt_r4Mp1yQUTUUlXgRubIdjFYzVE,2370 +torch/include/ATen/ops/fft_rfftn.h,sha256=P-Yl0tB5fOlsXR4fbz74sB6pILOpxQZ234aly7pXtbo,5837 +torch/include/ATen/ops/fft_rfftn_compositeimplicitautograd_dispatch.h,sha256=kzODz8TbvrVFKw4JX9y1Io9rCsMxmqtOFyADNsSiM2A,2223 +torch/include/ATen/ops/fft_rfftn_native.h,sha256=Hy5JzKg8YCiLx_xzqy0gW9r7O-02x0sh0OryyiOleOY,1098 +torch/include/ATen/ops/fft_rfftn_ops.h,sha256=vHcY5UQq2m06FsdS8AX1xHxo9-BCR8ungMzV34R4GCc,2542 +torch/include/ATen/ops/fill.h,sha256=jSJZxGux2iF6YzX5BRJXxwoTuT7g6gUncKKokxeWtx4,2597 +torch/include/ATen/ops/fill_compositeexplicitautograd_dispatch.h,sha256=UFex_EF5mz7QnUSAMjjepbx6SXI7jN_L0n_0Aaq1UUo,1563 +torch/include/ATen/ops/fill_cpu_dispatch.h,sha256=P8hqn_QP5I6fCLDJaLZ6FVg5Jnu6dUoSLiQUG6lV3XM,1099 +torch/include/ATen/ops/fill_cuda_dispatch.h,sha256=ggnwaRV0z0hZfTVZjWz5A2Kr1IqzA0kZY0t_JkwHI0Y,1101 +torch/include/ATen/ops/fill_diagonal.h,sha256=qYQUT9qa17Qa5Z3Dap-cQM1Vd7hxypJTRsFjGZcsYuE,796 +torch/include/ATen/ops/fill_diagonal_compositeimplicitautograd_dispatch.h,sha256=WurMbq0BpRPPxs8QgmgpObiRQdXsFYIIsjBSCBpiZw0,1098 +torch/include/ATen/ops/fill_diagonal_native.h,sha256=_dOCO4Hgetp2Q2QOwPA8WORlPLkR3BdHQ4-jOH5-q7M,808 +torch/include/ATen/ops/fill_diagonal_ops.h,sha256=W1vBBVIc9m3dFbfUW-X_cORDrmuITO9Q_Yti9vQZCAc,1411 +torch/include/ATen/ops/fill_meta_dispatch.h,sha256=PR0iYXMX_xVP6CeWaGHJspiWLtRTVwJXKw0IwMfjgL8,1101 +torch/include/ATen/ops/fill_native.h,sha256=ShXqGV0BeVxHpe8oh-O4Gj1HslPcfMyueygrWKNyEL4,1818 +torch/include/ATen/ops/fill_ops.h,sha256=6OhXpOvRGya8EaKPQk6bTv759-uOs6TdQvVrcllkvL4,4580 +torch/include/ATen/ops/fix.h,sha256=x8lIlXa7Cg45OLwfv1jmLbHFwn8ZRzmpZGtfB_wFxiI,1434 +torch/include/ATen/ops/fix_compositeimplicitautograd_dispatch.h,sha256=8BtP5eAoVux6bF5uxrX9d80G0Q9EkB_5-L8xR3_XWXM,1245 +torch/include/ATen/ops/fix_native.h,sha256=_TBFPgQLLsQrWYo8Cx3AKV5_vjAUjLFI3DvP_zxwITI,878 +torch/include/ATen/ops/fix_ops.h,sha256=BkrxmXnpsAiecW_JHRC6wG4De7nPqRwYqnd9el1Q1kk,2329 +torch/include/ATen/ops/flatten.h,sha256=5nTSUcY2pJrfqv_yztnPGG_Gk0dLB4SJvnR7VVTtUjo,1945 +torch/include/ATen/ops/flatten_compositeimplicitautograd_dispatch.h,sha256=Vn6Y-zjVSe4Mm9Z2tkwtbOiYPa-IiNyASZSjlUJfzp8,1421 +torch/include/ATen/ops/flatten_dense_tensors.h,sha256=l6N8DiKTkYpE4lGog5TLZony2914_GM4954p0kvgxOw,994 +torch/include/ATen/ops/flatten_dense_tensors_compositeimplicitautograd_dispatch.h,sha256=IpV_1vhXYQ-S3AnUiMRs9v9n-EzZ8gclXL6fjKGiyA8,1060 +torch/include/ATen/ops/flatten_dense_tensors_native.h,sha256=7bwIq6pKMA0efLNt0GT4Sb07Dt5ZC-Z0ucLv4OMIsNw,770 +torch/include/ATen/ops/flatten_dense_tensors_ops.h,sha256=Nt_D_F9xEvlNaTKMMvOnnn1C3DGk3HiTo-o3D3T9V84,1289 +torch/include/ATen/ops/flatten_native.h,sha256=00sbx2tkSIVhG6ZsI4cbY4XwZLluiFLdaNTpzOObmLQ,1131 +torch/include/ATen/ops/flatten_ops.h,sha256=CAuFVKDbQFAOAvMkn5Iem4GjzN-yhFGmg5WAG4PUW64,3641 +torch/include/ATen/ops/flip.h,sha256=aNARFz9-582yWPmb_zGMdsFqAg2m6Gc1o2Tjr2SY4dM,1426 +torch/include/ATen/ops/flip_compositeexplicitautograd_dispatch.h,sha256=kuUJNGwtAGJs4KI82V3hyactUZBB8d8rPep69vj6opY,1190 +torch/include/ATen/ops/flip_cpu_dispatch.h,sha256=QBELDgOshMR8u124dJZ-fPZ3QznGhLJWsKbQrP8fWdE,1022 +torch/include/ATen/ops/flip_cuda_dispatch.h,sha256=fIwW9Mo9EnYUnl1qTZKbCwDqDUH8WHQQAmcjaUa1lm0,1024 +torch/include/ATen/ops/flip_native.h,sha256=hpUIWGjVDFyi6iJpbP0Os2xsNimbzCAVyklUvMeybtY,875 +torch/include/ATen/ops/flip_ops.h,sha256=JPUJc5-phnti2DceOnWdpugn89NA4y8CzaVkd3ygzZM,1980 +torch/include/ATen/ops/fliplr.h,sha256=V1TQKByR9kI-Ger5_C9Ox5_K6WsOJcP2JNJYU9ZK0MI,927 +torch/include/ATen/ops/fliplr_compositeimplicitautograd_dispatch.h,sha256=EzQ2IqiD1DYvu00ZdKVQ8KxUr5jo0aDxxzs5uu_vnwE,1046 +torch/include/ATen/ops/fliplr_native.h,sha256=FP-bzq6lkMruNTiqoO3YSS3c_y8blOgQ16eEYA3ro2U,756 +torch/include/ATen/ops/fliplr_ops.h,sha256=_n_PX-ocxQ54q_s2VYIKq-WO_-lP6i2vhRdadH39WmE,1245 +torch/include/ATen/ops/flipud.h,sha256=hF0YZGCSaptRgXTVL-FXXcmbqqwmYQ4cr0pXFnZkgYg,927 +torch/include/ATen/ops/flipud_compositeimplicitautograd_dispatch.h,sha256=oa5jF8X6i7HcvG15E47j_Dy5ulA8zL0b0VGddp1baYc,1046 +torch/include/ATen/ops/flipud_native.h,sha256=fh3A-7rF_seJ50ujb6pDPAsLJSHlqVJN5Dv23RIzyV4,756 +torch/include/ATen/ops/flipud_ops.h,sha256=jLvj17NNN3k6LETDGPSWa5ARzjZB5bpM5L2EaTtdNLg,1245 +torch/include/ATen/ops/float_power.h,sha256=znorWdKYISHRonZW13mXRt-H71oP4pC3Hz0Zzj1sTtA,3258 +torch/include/ATen/ops/float_power_compositeimplicitautograd_dispatch.h,sha256=QBksSWW4tk5Anu50RCODI_crW5JNemLb21e9IJRFTMw,2111 +torch/include/ATen/ops/float_power_native.h,sha256=bhd4ZTkTxUB6uFoYFssRudtiKtPkP7gaNh1ICRtvApM,1479 +torch/include/ATen/ops/float_power_ops.h,sha256=8j2zfnORTMoY9B0rXxNN-Nt5XfDY7hQNZOCn47C1IHk,6217 +torch/include/ATen/ops/floor.h,sha256=OZwdUH-O8kNhkrKmO6j4Bh7SGAAIAnP1YK5ILLLJtS4,1460 +torch/include/ATen/ops/floor_compositeexplicitautogradnonfunctional_dispatch.h,sha256=6LiOb1juW4oPkvpITs2lW3lJU8aFuIa8gr8Imf3_ixk,1122 +torch/include/ATen/ops/floor_cpu_dispatch.h,sha256=cO38JzilYU97l2Sb5fHNUub16U4xUEbqVfOZnf_MGEI,1209 +torch/include/ATen/ops/floor_cuda_dispatch.h,sha256=ChCUXWE18w3tid5XTAocqix0U9G2Tvu-JSuW4GmqLC4,1211 +torch/include/ATen/ops/floor_divide.h,sha256=2YHtNOWFP5pIiagGxXauqM0__qOakfhqP8Gr2Uky7Hg,2303 +torch/include/ATen/ops/floor_divide_compositeexplicitautograd_dispatch.h,sha256=6bK1D613-0K33w79uiv-g0pTv38qJx9VVUoqD-xVM-A,1385 +torch/include/ATen/ops/floor_divide_cpu_dispatch.h,sha256=b6EJN4uLSI1WijITBRWT0uNFcf52i2EAl__8Oue3E1M,1341 +torch/include/ATen/ops/floor_divide_cuda_dispatch.h,sha256=s7uMJrfakbBSfK2khQi-vtKd11_z8pQNMz4I3VJc4g8,1343 +torch/include/ATen/ops/floor_divide_meta_dispatch.h,sha256=1nLIqW7Mp8lBwGlN8LVU4jQg0M5b0fx1qrBa582hmjU,1033 +torch/include/ATen/ops/floor_divide_native.h,sha256=3Hu6krfP55wru_xUhf5l1r1NcbopY3vEK0G1Dsk5A5U,1583 +torch/include/ATen/ops/floor_divide_ops.h,sha256=W2b3olEZuFo08zUwEpphjUGqG4fnWsMEEku7sjD69Vg,4683 +torch/include/ATen/ops/floor_meta.h,sha256=rZ8cnLWKlCilywMajkHcoIn_ui6nuUBz176DzqaBAFI,852 +torch/include/ATen/ops/floor_meta_dispatch.h,sha256=78mywnjh2B_hVAEWhN5OowczVP4CCbhF_hlZ2RhAX9g,1211 +torch/include/ATen/ops/floor_native.h,sha256=8JtuecQctr-FtCwkQDinq6ExP8O-u1peSsZbPU2Yw1Y,1295 +torch/include/ATen/ops/floor_ops.h,sha256=xSgvpjWj5Ls9mHcGfr3MrjqgZDyeOWeAo434ISpa6qw,2347 +torch/include/ATen/ops/fmax.h,sha256=GYokZx2PXEVNYsOofNisgYHpPy2JdHiDBpCOa5ORz_k,1447 +torch/include/ATen/ops/fmax_compositeexplicitautogradnonfunctional_dispatch.h,sha256=QtIopr8bRY1xf2f6wUdIFI5mX08EeYJ1SHPmQ7_uljE,1096 +torch/include/ATen/ops/fmax_cpu_dispatch.h,sha256=a7IB3CwLNq_rWVNtdRN84glpB8MU-TPfTcseGn_ov1Y,1233 +torch/include/ATen/ops/fmax_cuda_dispatch.h,sha256=nNI4cT8F8-HxZyr1W9zmd2JFBO7ALjAj5z_sFm12LOY,1235 +torch/include/ATen/ops/fmax_meta.h,sha256=-TzfolmjJhh3sLVImwvNOiT_8_U7el3a6P0DxwCRA8I,877 +torch/include/ATen/ops/fmax_meta_dispatch.h,sha256=AjBKX1fesRNDDSlrB_gDb4sHfe8s8U-V-s9jEzvG7GU,1235 +torch/include/ATen/ops/fmax_native.h,sha256=WDaPugcCEHR7TYzcTaR4CW1sNHRiq45wo_l4zh2bJLc,898 +torch/include/ATen/ops/fmax_ops.h,sha256=4UfhN4j1rEm3kfD6IaglXeiZlzECznLfF8VAVw-RKWg,2006 +torch/include/ATen/ops/fmin.h,sha256=AxFRWie8MR8F0mcSylqrrqrhxAuQ6erpvcX3GSN4yTs,1447 +torch/include/ATen/ops/fmin_compositeexplicitautogradnonfunctional_dispatch.h,sha256=eL18zUmme5Rk-wQt8Wqjnl_gY_WAwZBjU2x4FAHkynA,1096 +torch/include/ATen/ops/fmin_cpu_dispatch.h,sha256=qyNPkxXA5PCioVJ3DjdochxAkfsDxNTSTcn2eDSgl1A,1233 +torch/include/ATen/ops/fmin_cuda_dispatch.h,sha256=akKm5beltr9P6R5KGXu11S7c9SsjX4pEmB8KG_xIzvU,1235 +torch/include/ATen/ops/fmin_meta.h,sha256=jnXvZTjI8AvCQ3LqGx5IAtmFj3z69ZTnTJWDk-_l0eg,877 +torch/include/ATen/ops/fmin_meta_dispatch.h,sha256=rpsg_mtYhzvyLgTWyLPjbN1wbRbXaVMBzPOChigRV7E,1235 +torch/include/ATen/ops/fmin_native.h,sha256=jrp8gV-3siY24pGD83XboLM3XWe6Z8H-NIVsOzEzftw,898 +torch/include/ATen/ops/fmin_ops.h,sha256=LvGHvm06SVSWGVdLF4B1_qeB-z4s6eN6-MT63WPOdXM,2006 +torch/include/ATen/ops/fmod.h,sha256=ppW9eddvyxh2Fp_mL8tq2O0qiIdarlwsPJiHBdurFyE,2193 +torch/include/ATen/ops/fmod_compositeexplicitautograd_dispatch.h,sha256=haYrqCBDsotwR0ZujzAGnmXSXaDemRF7B0No2UnyW_Q,1353 +torch/include/ATen/ops/fmod_compositeexplicitautogradnonfunctional_dispatch.h,sha256=7NenAUSJHKmju4Xo-rmE051MisVHaq_TBHb3Xnx9ul8,1172 +torch/include/ATen/ops/fmod_cpu_dispatch.h,sha256=XlE0bLLzdZWHbMpvoFBp7wHEfNtn1FySDzqpIzIZi5k,1309 +torch/include/ATen/ops/fmod_cuda_dispatch.h,sha256=jMztlmiF_npVDvZnblHuGBnjHuBI3iKIPngQE8t5L3w,1311 +torch/include/ATen/ops/fmod_meta.h,sha256=620w1ugvj2j48mLYSgT9SLZUG1e0oo1AcLiWedNKymY,884 +torch/include/ATen/ops/fmod_meta_dispatch.h,sha256=NBTyO8fZqSOXNZpsLRqpxbzP0f_aAQma-7w1sRl3Yx8,1311 +torch/include/ATen/ops/fmod_native.h,sha256=qaDZE8Yxu7buhJdwW_ZgFy2a-wbMHDxduF3oclfeLpg,1163 +torch/include/ATen/ops/fmod_ops.h,sha256=9o8LrH5wlTYvJ4s-SWvWpSg2L7ahD3ucoXQpxt5flV0,4580 +torch/include/ATen/ops/frac.h,sha256=J3OJWNzOn1DlZBTOJq3QgSWEttcIIOFgs69Bgk2MWkw,1447 +torch/include/ATen/ops/frac_compositeexplicitautogradnonfunctional_dispatch.h,sha256=wncJerl_9nYcaPGdfzE-vaQIbZlt7r7VbLQNtKXcBSc,1120 +torch/include/ATen/ops/frac_cpu_dispatch.h,sha256=4mK_dw9V0uiC_-pAEwE3Ua4UGA0SSLCHl-4VUUhOq1k,1205 +torch/include/ATen/ops/frac_cuda_dispatch.h,sha256=HzGe8wB4Vs_qxkjIUM0wh2c-lRG9AKVT75-QUsrwI1Y,1207 +torch/include/ATen/ops/frac_meta.h,sha256=o1OEqni0_R1shknfgfNovIC4p2yPQ-0Sr8wErsMCO8s,851 +torch/include/ATen/ops/frac_meta_dispatch.h,sha256=M3v-EmevHwGp8JCWQWVIDCKk-mZ9UGHhgxft4VHkEKg,1207 +torch/include/ATen/ops/frac_native.h,sha256=h6Twqygqp0s8AtpObWUMmW4cY63vMyK-2AvNo-1QZns,1286 +torch/include/ATen/ops/frac_ops.h,sha256=uXhJz9P494wkgpx5H9s07pO4oucWJVSIfNDhPiMtnmo,2338 +torch/include/ATen/ops/fractional_max_pool2d.h,sha256=pjORQbyD3T_4HK_uUuLNCkJT4T5NN8pboOH2RlQ03Zw,2319 +torch/include/ATen/ops/fractional_max_pool2d_backward.h,sha256=b2tZyeEqEufwzxTkUtEqarKrnvL_n94W5HJ_8ssyhAc,2362 +torch/include/ATen/ops/fractional_max_pool2d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=6qMdepslfJZFEe8o_ilMBsWA_r4A1NtdPlRco537hyo,1214 +torch/include/ATen/ops/fractional_max_pool2d_backward_cpu_dispatch.h,sha256=zND5ZCKQTtWd7gMW91i38gs88kRMAh8M64XqgCmp-Lg,1601 +torch/include/ATen/ops/fractional_max_pool2d_backward_cuda_dispatch.h,sha256=b-xEDddL6AtBXbns6aKg-ZqVRUqFIZljbnq88okQ5lc,1603 +torch/include/ATen/ops/fractional_max_pool2d_backward_meta.h,sha256=P3__JhbS91JGMqgcZ5y5iiTYC6P2LsOQPN2f6HTrnfc,995 +torch/include/ATen/ops/fractional_max_pool2d_backward_meta_dispatch.h,sha256=jNHfHVnX9gU8izzEkwAOHcgqN5GXO5zx0ilD76LryAc,1603 +torch/include/ATen/ops/fractional_max_pool2d_backward_native.h,sha256=gyluFXZcJtXNIyVOHPB1M7yA_-IEkPCTRqkhcMvk7Zw,1393 +torch/include/ATen/ops/fractional_max_pool2d_backward_ops.h,sha256=_t_FZTJX_7_53HxdmXAWh5rNVvoAgzceo2XVGs6TxjQ,2804 +torch/include/ATen/ops/fractional_max_pool2d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=KRZgSM7T8CKdSwZx-Qo4Y3fOvnTtPBtahzBPwCEjzN4,1205 +torch/include/ATen/ops/fractional_max_pool2d_cpu_dispatch.h,sha256=RMKyx6TV7CiwEZeK04k3uC6M2UU-zA5FMmMXwMJGWkQ,1614 +torch/include/ATen/ops/fractional_max_pool2d_cuda_dispatch.h,sha256=WthO4NG4ybWVtotPzVu0H6ehsE2r8okXPR7o3Cz37KE,1616 +torch/include/ATen/ops/fractional_max_pool2d_meta.h,sha256=Tdkw-bBlASKioOQ-WLlgnU5CDxaAymJuRAlVfPG9oks,961 +torch/include/ATen/ops/fractional_max_pool2d_meta_dispatch.h,sha256=2F6Q46HHwJN7VWaZaXN1A3ycmCfRrsfzPTiMA2XLRio,1616 +torch/include/ATen/ops/fractional_max_pool2d_native.h,sha256=yfeoTmUCV2oWeEq8LF_idCAPYhB0K1YNSSIvtbJEiJ8,1354 +torch/include/ATen/ops/fractional_max_pool2d_ops.h,sha256=X9WekUFzHhZOnBJUBneTEdVldSA4Ou5JkK6muU4HV4w,2818 +torch/include/ATen/ops/fractional_max_pool3d.h,sha256=hkSdZ54OoCBtVWtjxYcqlAH0SKenDfDnF4-tXC0lW8w,2319 +torch/include/ATen/ops/fractional_max_pool3d_backward.h,sha256=IwZKrXh12qYqughr_RPSAIyWa151q2hStF3DlNXeUJQ,2362 +torch/include/ATen/ops/fractional_max_pool3d_backward_cpu_dispatch.h,sha256=8S3NNndvysN6xa6qwdt9VPHhlcEhw3wBL8sCIWPzqGI,1601 +torch/include/ATen/ops/fractional_max_pool3d_backward_cuda_dispatch.h,sha256=WFC1uM4PU0N2zqFGd4WlabBWkfR6NWCKRPVVJ-9inRY,1603 +torch/include/ATen/ops/fractional_max_pool3d_backward_native.h,sha256=LAOzcH9UikqBpRPcy4H81XU6E9s0pA7T7qzEYVvpF0g,1569 +torch/include/ATen/ops/fractional_max_pool3d_backward_ops.h,sha256=4o4ohIhZgeLeZBK3NQllgkX3BZzmgZ8uTMdbFkiOwfc,2804 +torch/include/ATen/ops/fractional_max_pool3d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Hg8bKtuJKQteqHTctbDPNAw55P6Dl4vAm4o1JsDZWPs,1205 +torch/include/ATen/ops/fractional_max_pool3d_cpu_dispatch.h,sha256=DXCfUlDPxTrxCxsu-v381MQkR1dR1iWOWh8ePqgKPu0,1614 +torch/include/ATen/ops/fractional_max_pool3d_cuda_dispatch.h,sha256=BbuedOUamRTXG0a0m7YK7xZPBpGofb8fTz2lbidXJq8,1616 +torch/include/ATen/ops/fractional_max_pool3d_meta.h,sha256=kZGy4vvDRnE5yAtjlwqWfIvrSuSPxi2OZeyaK9kd2lU,10105 +torch/include/ATen/ops/fractional_max_pool3d_meta_dispatch.h,sha256=6If5KCSXRqQzeTokJLDTgwWJ4fqi8SfcY3l7JROqbUE,1616 +torch/include/ATen/ops/fractional_max_pool3d_native.h,sha256=blGn9xDf7WQnchg-5KNGFnlZWh_KxchJmCUTMubi_j8,1624 +torch/include/ATen/ops/fractional_max_pool3d_ops.h,sha256=LQ85_T2LKx78QzRVd7vGojU_xrAc10RRfCA-Rwr1OmE,2818 +torch/include/ATen/ops/frexp.h,sha256=7QG-AAaDKVqDuxtn7oRQBT624c0PKFOdayJDnEI3F6o,1667 +torch/include/ATen/ops/frexp_compositeexplicitautograd_dispatch.h,sha256=YEZ6aE2spiANM2iiEknVeJ1Yh_PGFXgGJiocpFECqMM,1070 +torch/include/ATen/ops/frexp_cpu_dispatch.h,sha256=so-GkUwKoHZC3P6pi5KC8N3FlsvzJsDUoDhD6LT5dII,1214 +torch/include/ATen/ops/frexp_cuda_dispatch.h,sha256=PYNhQXdoGLHPFH0k_1qWOz0eMj39LH5ijTIdIakogXY,1216 +torch/include/ATen/ops/frexp_native.h,sha256=1LLh64HKyhqJnMYZyB1Da15Tqm83dap6-nCGHAGb-sE,913 +torch/include/ATen/ops/frexp_ops.h,sha256=eiOgYObHD6B3NkqtFj8xIr8_v_ROirDn5UzCIhcn7Kw,2193 +torch/include/ATen/ops/frobenius_norm.h,sha256=DkUSiBwusKgCxfSitmw6tvsVvdGsxJ1YabfVvr8-1js,1669 +torch/include/ATen/ops/frobenius_norm_compositeimplicitautograd_dispatch.h,sha256=J2BoiP4Vvlar5DZx-VcGsdNfZKEfwaggUi1jeRShHIg,1346 +torch/include/ATen/ops/frobenius_norm_native.h,sha256=4lMLFE-WsEluT2Eh_e-KLgXG-TcnuycCiAbg2knGaVQ,927 +torch/include/ATen/ops/frobenius_norm_ops.h,sha256=zC1iPzj8eGDEYeEuqF4M2AhynA7jEB2zpX4DbxmlDx8,2155 +torch/include/ATen/ops/from_blob.h,sha256=sfUsfEmB-Z-KjPlXG00HrOJF_vVQn_PVgr3XHAsTNX0,4580 +torch/include/ATen/ops/from_file.h,sha256=Ox7d6TyeCHeGKLeG2PpnNzhGXjLLOXVQ-Xa3oXxa9ls,2511 +torch/include/ATen/ops/from_file_compositeexplicitautograd_dispatch.h,sha256=F3I9TBBpackxKvkF78SVt1ybqr9002F74TR1PlhnUoY,1299 +torch/include/ATen/ops/from_file_cpu_dispatch.h,sha256=7kAraAFVhqZz5uQ6bHh2LPfaZQlJFETTLzfIwi7z_ck,1381 +torch/include/ATen/ops/from_file_native.h,sha256=MRgzdDApIJll0Vt8Kv1VKm270u2kAgMNpUZG4bKkXl8,1141 +torch/include/ATen/ops/from_file_ops.h,sha256=dTPbpFzyhr5vlpRtctPlLgRwK54yzCYfOSpy-ikypNM,2772 +torch/include/ATen/ops/full.h,sha256=nIYKEtxBIbdkYKwJfnUTQpZRzTJtHoC5AVzvNWc6NSg,8308 +torch/include/ATen/ops/full_compositeexplicitautograd_dispatch.h,sha256=m-eBVcaVjY_jxWlxxZY17GpQ2K7pTR3Xr5O7Zz84V40,2839 +torch/include/ATen/ops/full_like.h,sha256=ri-uuolXcKxWw3LDXnY_AHV7XniFXp3ts4X0AJXaQsE,2759 +torch/include/ATen/ops/full_like_compositeexplicitautograd_dispatch.h,sha256=c9XQ6KZREk1jYwlPIFGOr0IfkDiTUAuFyN5WHZfmah0,1797 +torch/include/ATen/ops/full_like_native.h,sha256=QSh0n-7fe1fec6XuTEPy5_SpAyr3CwyW575tNxS-2jE,1173 +torch/include/ATen/ops/full_like_ops.h,sha256=WlDDo5V0Q-tkeFonun30X4NrkRUFVPJ0E25Gcdpediw,2896 +torch/include/ATen/ops/full_native.h,sha256=em84HnPArrchBBHql875UxG6eGa8uVPYM-EF69NCl0Q,1473 +torch/include/ATen/ops/full_ops.h,sha256=IiIIt9HFh9ZvykuWWBzG4d6qCrHRi3wmkRaaQvquq10,4619 +torch/include/ATen/ops/fused_moving_avg_obs_fake_quant.h,sha256=zpvfBJAxC_PFDhsEy3yWR5ZP8VReeJq1wPJH3c592TM,1742 +torch/include/ATen/ops/fused_moving_avg_obs_fake_quant_compositeimplicitautograd_dispatch.h,sha256=QvsSBPMtLIspCXDtUmzMoTrkmZnZNEBrOLMyYcN9pFE,1372 +torch/include/ATen/ops/fused_moving_avg_obs_fake_quant_native.h,sha256=V_2hmPOUtzAv6eNW5a13avHaTQW5AYOkzv5Nog7URX0,1082 +torch/include/ATen/ops/fused_moving_avg_obs_fake_quant_ops.h,sha256=nxGA8E4nLG4iIjuXCWvi8Ufb9oWa6vhCqFvl85kTNLc,2297 +torch/include/ATen/ops/gather.h,sha256=sbRkx3JE6W01Q4nTBITvQHykxQe2mwC2IjnBRFdM2bc,2741 +torch/include/ATen/ops/gather_backward.h,sha256=0o15jpvxUK0WwbU4vesi4WFLOyHIJPKE8RFMKEsY6MY,1130 +torch/include/ATen/ops/gather_backward_compositeimplicitautograd_dispatch.h,sha256=nQBdHkgS9c_iDn4aDZ4nMuZLAVwtPIOrHBUgu3sXkbU,1137 +torch/include/ATen/ops/gather_backward_native.h,sha256=9b92V2CaNLpCC6rxnv7WVXzY4hijUV40VJQ7zKRy3dM,847 +torch/include/ATen/ops/gather_backward_ops.h,sha256=NkgJJU6If4FSPJm-LitxXz-SO4tNAhszKY4JZzfmXFU,1545 +torch/include/ATen/ops/gather_compositeexplicitautogradnonfunctional_dispatch.h,sha256=MffPQs_DO_uz6sqedMHWnno1PG-aLmOTzaQw92lmgW4,1135 +torch/include/ATen/ops/gather_compositeimplicitautograd_dispatch.h,sha256=mtiA4ZGEn0x21p9AzfCkT94rpk3NgsAdcF2QhhTQ8x8,1400 +torch/include/ATen/ops/gather_cpu_dispatch.h,sha256=kBbU_qlDrrw3vnByHHV7dzYOjHuxEaFq3-mwIo7dHR8,1344 +torch/include/ATen/ops/gather_cuda_dispatch.h,sha256=Fgt18H0SR0mXCe9CQYT9-yjRs8d4IEPG4bVWcREl6xs,1346 +torch/include/ATen/ops/gather_meta.h,sha256=NwDd-ig_QXa-5xIrcDIBYWEqny-PCl5TZ4Z_K3CHo1s,910 +torch/include/ATen/ops/gather_meta_dispatch.h,sha256=myyD4UtiPk3Z8xmI3yJqhFsQkErpsSPpsexWWiVNWrM,1346 +torch/include/ATen/ops/gather_native.h,sha256=3v0D_4k1mlC2Y_d0BuFvrUAxNpMSKJSRJmhsiGx3o3g,1197 +torch/include/ATen/ops/gather_ops.h,sha256=9Wqu_Kd1MZkdYA2cijOcZhD7CthSXgbozG2zlVwpSAo,3827 +torch/include/ATen/ops/gcd.h,sha256=reSLq0C1X-WncH1ROiGiyLLFqfmLfPZc39byH5umvMA,1622 +torch/include/ATen/ops/gcd_compositeexplicitautogradnonfunctional_dispatch.h,sha256=TYx8qInDBsz8PqCDo729xNDAehX3kOtCS9c-Iad2WZ4,1170 +torch/include/ATen/ops/gcd_cpu_dispatch.h,sha256=qiN78qBYa9sndGvZzuki6rCqgAH4KRuQXlwZDDltQfw,1305 +torch/include/ATen/ops/gcd_cuda_dispatch.h,sha256=UBXWnbYlQxbHwGZnT0bMN18vNLcBcSJfdlEw4f3Ka2M,1307 +torch/include/ATen/ops/gcd_meta.h,sha256=x2agfbY5vR6gjLw5SHHlVLJpC4sYZjEAFgOjgw5plBA,876 +torch/include/ATen/ops/gcd_meta_dispatch.h,sha256=2sa0vNya0c1Tqj5pty0dy40DANj6H9Rlq8Nrp-zFYyg,1307 +torch/include/ATen/ops/gcd_native.h,sha256=MccKEqMTdAzgCzYL55XRV-w21kSTenPrfUy79rA4gWI,895 +torch/include/ATen/ops/gcd_ops.h,sha256=pM5Aznb3Y0tB-Uvv3IC-c15Ak_uS7bytpjWygQnbelY,2587 +torch/include/ATen/ops/ge.h,sha256=wv_usm1SjXASiqac4CvLD-fVJA5hmws4eZ0DMTtuIcg,2155 +torch/include/ATen/ops/ge_compositeexplicitautogradnonfunctional_dispatch.h,sha256=gz-QSB0W8gpLZ-zQW857Jejed2Eiwtjo6wbVskRDONA,1319 +torch/include/ATen/ops/ge_cpu_dispatch.h,sha256=sLTSh-7kvQkMjWY5vAQ7igWxja_egKTNgRctfMN8T3M,1655 +torch/include/ATen/ops/ge_cuda_dispatch.h,sha256=1nmcM4nwqnvGyPQUX5wNqzTMm3HYjROcfqzR736G680,1657 +torch/include/ATen/ops/ge_meta.h,sha256=Crs7TLEZrVpuJ-leX5AlON4CWcqh_TPlFWN_YtN8VLY,1026 +torch/include/ATen/ops/ge_meta_dispatch.h,sha256=3bUm2OTVRuYdAjpXRBEJS1iV52N4jtwtH107liiGi9A,1657 +torch/include/ATen/ops/ge_native.h,sha256=VejJ-U6LBg3asdTRTd-k2dCjD_zuJ9rz_qVT10wSa2E,1585 +torch/include/ATen/ops/ge_ops.h,sha256=ruqfDyM5gghod0Zn7MYdAN9rubT0CGJRBUjFOhGekGg,4544 +torch/include/ATen/ops/gelu.h,sha256=hcH1AtH2muMNluNsn59RYbEq6h0zTTPBYOsEaVtxlzQ,1742 +torch/include/ATen/ops/gelu_backward.h,sha256=Sotq963tIVcqSOWsnXVLAHr0DVelaO8UOiluQnW-hAg,1879 +torch/include/ATen/ops/gelu_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=VAvHH9JMrqq7kP6mMuS1Bbp43Ab6Ds3M_tbYKna4Y3c,1148 +torch/include/ATen/ops/gelu_backward_cpu_dispatch.h,sha256=VXIz_TZSp_ZWqBlpBfo4TNNlVOWS3O6DjlydezJIKuA,1396 +torch/include/ATen/ops/gelu_backward_cuda_dispatch.h,sha256=JKE0amEY8pfFE2jnlmDitJsAxgqhgZJepaxzf8gPpZc,1398 +torch/include/ATen/ops/gelu_backward_meta.h,sha256=fzTnASSI8zO0i3Lc69bXR5JJfMCJ8hpbMBzY6_JxAyg,922 +torch/include/ATen/ops/gelu_backward_meta_dispatch.h,sha256=jNHavIptXpcxKAS1nLEPj0KA4qkLlGDN2PPLdpXXrYI,1398 +torch/include/ATen/ops/gelu_backward_native.h,sha256=nhw3N4W0p5iSzk6umFUtpfj987PI7vfFQN7s1CBlrGI,1481 +torch/include/ATen/ops/gelu_backward_ops.h,sha256=P_aURNKv7PZo09pElSwDvWhndSVw10bNBxL7IJB4JCE,2345 +torch/include/ATen/ops/gelu_compositeexplicitautogradnonfunctional_dispatch.h,sha256=tYPS3Qhl1JLq7kEY-2ceK4Z18Q71m3CQ8d4szt5RYus,1194 +torch/include/ATen/ops/gelu_cpu_dispatch.h,sha256=9hHeDyrvWV2G9rMjYLpSDBCnowiqhS_jQp0YxDB38ig,1346 +torch/include/ATen/ops/gelu_cuda_dispatch.h,sha256=nCSmumSeiJ0sFaoIdGzB4HSfTOjjGJvcEdimCkQdGVw,1348 +torch/include/ATen/ops/gelu_meta.h,sha256=TA21RbUXsVzb19WckxZMqlxcc7do22oCA9y7IKgOAAI,881 +torch/include/ATen/ops/gelu_meta_dispatch.h,sha256=GB64SiZO7_BfR21-RGynBOe6rOBkvFCaJOi4L59xqZ0,1348 +torch/include/ATen/ops/gelu_native.h,sha256=XPbrr-sd8BgzU7IalXetQYJLkkdSEMkYc54QzpkNMhE,1691 +torch/include/ATen/ops/gelu_ops.h,sha256=hDCieoE_v-esuQI8pyP1YvStWiKu7AwYRv7EYrcJlt4,2650 +torch/include/ATen/ops/geometric.h,sha256=jC7jIInxkrhXSFKc7pPnBkJFbubsNuL45lojVyKjKec,1695 +torch/include/ATen/ops/geometric_compositeexplicitautograd_dispatch.h,sha256=wCbFJNAqx5jqB8ZC-zbun3rNb3YPBfdf6Ti8n7XJfaU,1400 +torch/include/ATen/ops/geometric_cpu_dispatch.h,sha256=RYFuOzmep3q18lIaV7PVXk5x628BpAiDTeXKeKDBi_w,1069 +torch/include/ATen/ops/geometric_cuda_dispatch.h,sha256=aN0dnjlXh6vmqOBSjbLZG5zYTqwP2W9R21olz8nhGDs,1071 +torch/include/ATen/ops/geometric_meta_dispatch.h,sha256=jZeq-znTyIDHy83OOrh8OmrHk20Znc_VUdpghvmYyFo,1071 +torch/include/ATen/ops/geometric_native.h,sha256=dPspfqqXGAZMxqKtj5ckB-Qjakq2sEaxYa8AeXbJ6U0,1082 +torch/include/ATen/ops/geometric_ops.h,sha256=FteO4g_iRcjLlCwNgzHB2xEjKP8-hI6q4d5sgRbc9dA,2929 +torch/include/ATen/ops/geqrf.h,sha256=hVjkJDZzfrsIwcos6RUNDf6IW36zhI6Ai7SMLVIT2p8,1509 +torch/include/ATen/ops/geqrf_cpu_dispatch.h,sha256=0nAtVhY9KumzpmbKqOQUTsrqFcel4EgDfZyRWALbq2k,1269 +torch/include/ATen/ops/geqrf_cuda_dispatch.h,sha256=mSpWjthHZlj4pC9zZQTJQp8iQ7JjgljgPuJpo9Rhj74,1271 +torch/include/ATen/ops/geqrf_native.h,sha256=OHmFq72hLKvr3jwwmAX3JbyC-vwt3HhRmFzk8SOhNwc,901 +torch/include/ATen/ops/geqrf_ops.h,sha256=5uMKwj2YPx2YJSu63DwL7S-tx8uvTf29RLjr492_zRE,2086 +torch/include/ATen/ops/ger.h,sha256=adKjG8QMJsJp8ur_I_Ty-Z6Z6HoNHZnHYLbNr-diHMc,1428 +torch/include/ATen/ops/ger_compositeimplicitautograd_dispatch.h,sha256=QM_GKp6AGJMapStqHJ0Kh76q3tY0zNDenLiqLc-samY,1271 +torch/include/ATen/ops/ger_native.h,sha256=a4oB7lcLcLWbQ26PHyc6myIbxav3_1jLpjbca5WZEXk,879 +torch/include/ATen/ops/ger_ops.h,sha256=eEr0yJ-7BOx9CaAz4YYlnlhvhHXyYuAKxD26W9_IOlo,1994 +torch/include/ATen/ops/glu.h,sha256=0zM4RSzT6ytL-lpy1Plm1rJVmjBT9CyXTGf424nDzOQ,1392 +torch/include/ATen/ops/glu_backward.h,sha256=pLJ-8zs7cCb3HOeJrXtFF1_cfUei44gBUGUh94IbJCk,1732 +torch/include/ATen/ops/glu_backward_cpu_dispatch.h,sha256=FgCvMsBWo0wlCq8V4YMZU3wIVjC-ec8IQcH6hc9jE-s,1328 +torch/include/ATen/ops/glu_backward_cuda_dispatch.h,sha256=EH1_pKajcop0zNN5Q-8raqF5i0J5pXn3q0B5NLz__tI,1330 +torch/include/ATen/ops/glu_backward_jvp.h,sha256=4NgCCbhkoURwjaLce18VeyJQeai5aq0fmzn-yN9q3Sk,2089 +torch/include/ATen/ops/glu_backward_jvp_compositeexplicitautograd_dispatch.h,sha256=Q3JHnJ-FYxIzoyBjwCR-kzePb0A6MINlG7n_YZGOTfQ,1408 +torch/include/ATen/ops/glu_backward_jvp_cpu_dispatch.h,sha256=AaWUwAor3Jii09Pcd9ddqH5iAvNJkrGriEba_SSgJ0M,1131 +torch/include/ATen/ops/glu_backward_jvp_cuda_dispatch.h,sha256=vV4RIbnHo7I5NbJjsgRiFo41jYrE7gIJ5MVYtq03cx0,1133 +torch/include/ATen/ops/glu_backward_jvp_native.h,sha256=9UqZu0AVApwY-ylAtoV1N9azjT_AA7A0ba52OihDAMU,1093 +torch/include/ATen/ops/glu_backward_jvp_ops.h,sha256=9RSOYW0SIQPUumtUrat16mriv6bIp2GM1f7bNmjHJOk,2694 +torch/include/ATen/ops/glu_backward_native.h,sha256=Rx9oNx0hZ_VNNwfLpbBbzdWG_YqxqKm0--H05Ymb-mE,1205 +torch/include/ATen/ops/glu_backward_ops.h,sha256=ZY5yNtYuO9rbgeT0ITkIGUdJM9AXEozLva_-DaA7pQ4,2220 +torch/include/ATen/ops/glu_compositeexplicitautogradnonfunctional_dispatch.h,sha256=uSmv5fuexmf1yL7SdA6i92jSy4_ze3LAfXOlnJIkiR0,1085 +torch/include/ATen/ops/glu_cpu_dispatch.h,sha256=JP9SsY1B3rtMMzd6FME43WqcGtKCfP77_44i6ZEbgUE,1197 +torch/include/ATen/ops/glu_cuda_dispatch.h,sha256=0Iege-XOaWmwsIAr28FNgeJBj0MHN2C3HTsngSELx90,1199 +torch/include/ATen/ops/glu_jvp.h,sha256=kz9tQ1GK3sEqmQ5CWtybOZ_8BIylyCw4OinyV8d8CZQ,1627 +torch/include/ATen/ops/glu_jvp_compositeexplicitautograd_dispatch.h,sha256=Tzvrhvv3TGZZ-gQga39dNNFdrvBrijVdrfHucsYXELM,1266 +torch/include/ATen/ops/glu_jvp_cpu_dispatch.h,sha256=KFSr57D_P65FBZ55bUvEaudSNYEZR1g_8MZqcUTAHNI,1060 +torch/include/ATen/ops/glu_jvp_cuda_dispatch.h,sha256=_TNHoJ73MOIn4po2n2u8O9dFsqFWaB7gpm7-oXhv5R8,1062 +torch/include/ATen/ops/glu_jvp_native.h,sha256=MylzHYS2Xahw87feEqVujQTF2NTZs0gYHwPdV2v5kGE,951 +torch/include/ATen/ops/glu_jvp_ops.h,sha256=bTHbzRi9tvVsTE8aEnNkB9hWDaX7tEZRArOMAJiJJhY,2236 +torch/include/ATen/ops/glu_meta.h,sha256=t-FcfTV8nJ0ZOKL-OKFLRwFqBbpwtkPW95oARUNM6yM,863 +torch/include/ATen/ops/glu_meta_dispatch.h,sha256=C-4CaFz1m5AJgl2qydYkBThYA3BKiN-dupTmXGEK7WA,1199 +torch/include/ATen/ops/glu_native.h,sha256=475NkQyH4vQj932i6XH5gvt7KdvCOSMtdY_C3H5-nnc,882 +torch/include/ATen/ops/glu_ops.h,sha256=i2iW4Wltnee5j6UX7Qt9GbylnSxqIcj2Mxn_Z2GP6Hw,1922 +torch/include/ATen/ops/gradient.h,sha256=3jsL3if30yt2_0cnQtoyQJn3HkG9-UpIrIA0R-SNywo,3192 +torch/include/ATen/ops/gradient_compositeimplicitautograd_dispatch.h,sha256=rl234VZtPW-4eHpR5zO9SqA4_RrABxmQEJvl68eZ_Jg,2072 +torch/include/ATen/ops/gradient_native.h,sha256=EQT3zEwvRRXmEOol-IPASRM83l8K4qb37KphQZ1mwqE,1782 +torch/include/ATen/ops/gradient_ops.h,sha256=lLK5ZKXDTSBQeHCEx3wJ-23PeFaJK9drOj-m_0dXBq4,6626 +torch/include/ATen/ops/greater.h,sha256=JhHYRBjQttjyEFIhmGMr-rlW6vqcXyfRWjSoFeFmCnI,2250 +torch/include/ATen/ops/greater_compositeimplicitautograd_dispatch.h,sha256=yQJTbWAfjrGeE8xSAtGZjT4ABmCHaNpLH5-fH3nMC0I,1739 +torch/include/ATen/ops/greater_equal.h,sha256=PhMaQSD9La57Fwwzvjwa3W6mp1UtZPTVAMYoJJvAln8,2364 +torch/include/ATen/ops/greater_equal_compositeimplicitautograd_dispatch.h,sha256=9kkfgRDuY_sSIdybAQK7TuIXgo5ZCMpyx6l96LV9HHQ,1787 +torch/include/ATen/ops/greater_equal_native.h,sha256=znlkdNubE-ZuXtCMJyvMHAgtPDqnZaZvlAx2_l4sjQU,1271 +torch/include/ATen/ops/greater_equal_ops.h,sha256=vfh1NzcF17ZsxGhTgmemT7e7MQbvYzuvTsvL84pCdRg,4742 +torch/include/ATen/ops/greater_native.h,sha256=Pa55M_oTkNWXJrBnzV00GK0Q0hR-t6OlJuEILD4TrbY,1235 +torch/include/ATen/ops/greater_ops.h,sha256=4gdZZUgHinQclcPIWveNbVYL-IEW8mtw6llAciwyFI8,4634 +torch/include/ATen/ops/grid_sampler.h,sha256=AMVmZvAkEa5VYdqe2TFHLHqCw3Qs4bt6EhB8QR1muoQ,1179 +torch/include/ATen/ops/grid_sampler_2d.h,sha256=bOqYnGctzzZUx2qZYiDj3bUsLIJ2LlOEvhQFkdfMkik,2100 +torch/include/ATen/ops/grid_sampler_2d_backward.h,sha256=A_JBgP6e3kDU3AZg82UxzcN68Pm1u9T8tTgtPh0Hgxs,2796 +torch/include/ATen/ops/grid_sampler_2d_backward_compositeexplicitautograd_dispatch.h,sha256=eV96wkmbkeH9DFUbPAHJKoKzhj-Qj-YEHhegE-qLNKA,1604 +torch/include/ATen/ops/grid_sampler_2d_backward_cpu_dispatch.h,sha256=wdwgTXRIuj3miVfDmDHLnNavvVj7meBxnEZ0bR_NJyU,1207 +torch/include/ATen/ops/grid_sampler_2d_backward_cuda_dispatch.h,sha256=-WswuEg3u5GyyQA9u6UUMmP6nnitrHkHqdU12WPCJqs,1209 +torch/include/ATen/ops/grid_sampler_2d_backward_native.h,sha256=-MYOvJEepfwbmJmat6ju2ZPLaMaX7A9qCTh95cfCBDg,1536 +torch/include/ATen/ops/grid_sampler_2d_backward_ops.h,sha256=B52n_oaNHjicO7ocWymZdZdKs0mP2yXOFXRCerkbfKE,3260 +torch/include/ATen/ops/grid_sampler_2d_compositeexplicitautograd_dispatch.h,sha256=8JC8hfLr2sC5maGLmaKJojBDIkHup8nb7bb8IZ7f3ho,1360 +torch/include/ATen/ops/grid_sampler_2d_cpu_dispatch.h,sha256=wPFOGn8vPZlSDg3kuadpgCY5hWNQKFYuOX8p8l4WLMQ,1107 +torch/include/ATen/ops/grid_sampler_2d_cuda_dispatch.h,sha256=dGJv9Ixyvro9npCC82ak80XTMKA1CPEj4XN11CjOHN0,1109 +torch/include/ATen/ops/grid_sampler_2d_native.h,sha256=NY1BIHfo0HiiGPaJ3Og9cYQgZKAyw89-kPHbRYWb804,1214 +torch/include/ATen/ops/grid_sampler_2d_ops.h,sha256=vlza94JVdf4pHNWa36PGB6A2rQLcVWytNYAZfnfoEpo,2524 +torch/include/ATen/ops/grid_sampler_3d.h,sha256=i-TaN4r909t9_LgFneQBHlaCXJzhVfsZKsNHwSDrZv8,2100 +torch/include/ATen/ops/grid_sampler_3d_backward.h,sha256=MDDysx59eExdrrk5WR2CQVggVUSH737YT4sx73lcrBw,2796 +torch/include/ATen/ops/grid_sampler_3d_backward_compositeexplicitautograd_dispatch.h,sha256=1LnUIRkXxzDFtPjW-wvC2SsJDmwvTOdxLmAu1sUnfFE,1604 +torch/include/ATen/ops/grid_sampler_3d_backward_cpu_dispatch.h,sha256=k_GPEVxo3V8eeLVWqcLhV-7CPEpA_Y_uld_6v3IXnk8,1207 +torch/include/ATen/ops/grid_sampler_3d_backward_cuda_dispatch.h,sha256=lbIOXupr_7QGHJP8n1S78bgDHPOyZ2BylEr9DoXRmI0,1209 +torch/include/ATen/ops/grid_sampler_3d_backward_native.h,sha256=Y9dMIyztkxxCZCe51gy1_RGWKDA1-LztCt0H0DX6ndk,1536 +torch/include/ATen/ops/grid_sampler_3d_backward_ops.h,sha256=ET1wmo-JzTs299nmggKT5qojmPZaUvxNuibYGAgHlPg,3260 +torch/include/ATen/ops/grid_sampler_3d_compositeexplicitautograd_dispatch.h,sha256=vy43mVZrLQOU5V7UtsHDI7HuesFT4-a6ZlyQLNnO1Kk,1360 +torch/include/ATen/ops/grid_sampler_3d_cpu_dispatch.h,sha256=mZ5VQDLl9gWmchYR1rcyAKO8RgBtNk3RIIMjhiio6eo,1107 +torch/include/ATen/ops/grid_sampler_3d_cuda_dispatch.h,sha256=F6jS33udee5P-x9Yy2x0PvBgLtvomAj17m0btiSwI-8,1109 +torch/include/ATen/ops/grid_sampler_3d_native.h,sha256=tFtXuMApYr4-z8-nTMDIZKc3oK8d6E1tmhjUzb-Dr60,1214 +torch/include/ATen/ops/grid_sampler_3d_ops.h,sha256=70uoRqAxNmyX1LWbgDgqXCfYPz4zXR7HCCNYQU43kCg,2524 +torch/include/ATen/ops/grid_sampler_compositeimplicitautograd_dispatch.h,sha256=sGI7ZKHAdrlMzfCPVELAWYXQatYyeNF5VM_mp-GOsqI,1148 +torch/include/ATen/ops/grid_sampler_native.h,sha256=ITAaJSHFTuMqzeUNj49OErZpm1JwZJ0ROdghOsxaufo,858 +torch/include/ATen/ops/grid_sampler_ops.h,sha256=zQWr4_1iGK0LtPVG_VmPem48pyMpLEb3c8iwSjIDhBE,1575 +torch/include/ATen/ops/group_norm.h,sha256=74o4LhpXI8HOMMrbFTjo_n5Gu0ZF29_GwD64R5iUeNs,1245 +torch/include/ATen/ops/group_norm_compositeimplicitautograd_dispatch.h,sha256=dESFfy5tLz39xme7l93C60MEmYI4mAjVUMSFqqTsDVk,1206 +torch/include/ATen/ops/group_norm_native.h,sha256=pBd65VbFbaXWEOkntPGeXBrzd9-iLV44UoQnDt2gPZI,916 +torch/include/ATen/ops/group_norm_ops.h,sha256=_1gCFCibsKPOAQEg4aluIXgMFTJwQLsZqumw9Bm5utw,1731 +torch/include/ATen/ops/gru.h,sha256=pyUTLdPLuPxpAV2Q6oxb3pkdQfSBVbSP3HZOsC1fEWw,1867 +torch/include/ATen/ops/gru_cell.h,sha256=PsdXIIbZ1AvGB0n4jhzGcVctt3zeIgGSXokZxWShVwg,1204 +torch/include/ATen/ops/gru_cell_compositeimplicitautograd_dispatch.h,sha256=IGB_3pio2tjpS6hjw9dFHQitmo5tmqkKGeBrvxj8f60,1212 +torch/include/ATen/ops/gru_cell_native.h,sha256=MuNQwCy3KFWAZcUzcuH88tGI-awuLS0e5laGcQsnZGE,922 +torch/include/ATen/ops/gru_cell_ops.h,sha256=HaMhrwwidTA5e9oYVNKAZk-0CSG6WcITEgHXKfnIVY0,1777 +torch/include/ATen/ops/gru_compositeimplicitautograd_dispatch.h,sha256=4CsyPvkdpjC1T0Z1_c_Hjlte8pzwLnv54Ejh3zQ8WBA,1458 +torch/include/ATen/ops/gru_native.h,sha256=TNi5s0G1r3trUJhY1MyTeWV4Aj8yoTEtmmBQqjK_hDQ,1168 +torch/include/ATen/ops/gru_ops.h,sha256=cgERwDpWo0tyZMpj4_qrKLnjGo04n3j2HSwGxuvTvFs,2988 +torch/include/ATen/ops/gt.h,sha256=Rl9MH0WfzCvbrDSxWUPmt-ss1ZY_ctTCS7Y6vGkOXQQ,2155 +torch/include/ATen/ops/gt_compositeexplicitautogradnonfunctional_dispatch.h,sha256=jmp2fji2P86NICzFRO1uLJNwmYktbjA5r46mXtk6wZ4,1319 +torch/include/ATen/ops/gt_cpu_dispatch.h,sha256=HZkQHj5ZPThi47nWhk2I9TQtMjIlIhNlcKnra_JddHo,1655 +torch/include/ATen/ops/gt_cuda_dispatch.h,sha256=qgqMZ0XCbzM7xNRsi3I5__72gKdSUMc5Nhz-zc-gH40,1657 +torch/include/ATen/ops/gt_meta.h,sha256=xNiYA6CnBWBjrvN6WGtjbPoHZjQjhjZMR5qcGYxl99M,1026 +torch/include/ATen/ops/gt_meta_dispatch.h,sha256=wW2JiXTqVozLlP-kMiOOFg10BnnTAqYBDcJr5GLd668,1657 +torch/include/ATen/ops/gt_native.h,sha256=DjHXCfT1yV3x8ta5lLtqGPijh9UEPRsMGk2cH5EG8Q0,1585 +torch/include/ATen/ops/gt_ops.h,sha256=hwtTkvAVUqQg9QVpCxr0M9heT4tkzKl9a6Hng9CJENk,4544 +torch/include/ATen/ops/hamming_window.h,sha256=J5gewaxw0YlMllFwa_OKP4uo-G66zzCDy28YqbHqh2o,7395 +torch/include/ATen/ops/hamming_window_compositeexplicitautograd_dispatch.h,sha256=j1mXgA7c8NuBqVUZduEen01PevRQVsEZtvb5luU7GAo,3207 +torch/include/ATen/ops/hamming_window_native.h,sha256=72A9IhE0FEwYj-xwvEhTpeAdG2XzqjKiy7Bt55R5Ee0,2129 +torch/include/ATen/ops/hamming_window_ops.h,sha256=GqtwBJxlEaEUDNZisDfsdHN5Vg_T_aDtEnABi5i_B4Q,8141 +torch/include/ATen/ops/hann_window.h,sha256=zlMie-n3Dc7ALFiIqAMuVhbXxBRonG4ofZlJzLJUmeM,3638 +torch/include/ATen/ops/hann_window_compositeexplicitautograd_dispatch.h,sha256=3liQKUdJB3jRiXy1Oe8AX2v5h_7YCj9n6DUanumNkNk,1963 +torch/include/ATen/ops/hann_window_native.h,sha256=07sNUXfxFiMX6iD-GxiiWpNmk5O_QI-TRqi5r_VQJA0,1334 +torch/include/ATen/ops/hann_window_ops.h,sha256=tTWNJvGZ3742xjNK1YbqqWAjM3HqS22yxSWvdd0fxCk,4129 +torch/include/ATen/ops/hardshrink.h,sha256=gIv8fGxkc927ExmroGkaxNlfqYNfPYrRu4V27rE_yp4,1527 +torch/include/ATen/ops/hardshrink_backward.h,sha256=-DkHEEIdBs1YM5GwHKhQtUFPeJw03a36CfhIRq57nug,1835 +torch/include/ATen/ops/hardshrink_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=X_04EdsJGCACjQYekHHJ7wWfaDGWdzK-N2uaZJDU9KM,1140 +torch/include/ATen/ops/hardshrink_backward_cpu_dispatch.h,sha256=1ELBHcI7XqjfHo3iwQEMgoC1klzRVfTFpPVdgpMGVyI,1379 +torch/include/ATen/ops/hardshrink_backward_cuda_dispatch.h,sha256=UarQ7NDmASJKW4qic-fLLlL9DuTTzlstyakJDIenAkQ,1381 +torch/include/ATen/ops/hardshrink_backward_meta.h,sha256=zDzI6Y7x_bpPJJXSsTTgBkUZPAllFs48wuaneBZe0Tc,921 +torch/include/ATen/ops/hardshrink_backward_meta_dispatch.h,sha256=c2jKFoUaK1vCGBVrDoUE8z65fOuXowGkEBRiTgjI738,1381 +torch/include/ATen/ops/hardshrink_backward_native.h,sha256=wVXy9X3RUeHjQHSO03WNDKPupmI4q2RP7Az0aPkgM3o,979 +torch/include/ATen/ops/hardshrink_backward_ops.h,sha256=b665tXVkYnZruLzepWpH_E1hs-dEUmlPjCJyQ6NKNCY,2328 +torch/include/ATen/ops/hardshrink_compositeexplicitautogradnonfunctional_dispatch.h,sha256=_SmSk-W5_geJt8jd-gDUJRRwjgHLhzEqycD7SpFAk4o,1106 +torch/include/ATen/ops/hardshrink_cpu_dispatch.h,sha256=Gm4mykTzhKEZWpTqCg63c9hoFUzfs0DIyKPFDBayiBk,1259 +torch/include/ATen/ops/hardshrink_cuda_dispatch.h,sha256=yl1QlMZ9G8shaIDOxURao1S7RSU5_VpLb5fDuBgShfU,1261 +torch/include/ATen/ops/hardshrink_meta.h,sha256=647cWPweC850pVdGGnvKNXa0aOHTkm5hcpR8OekL1f4,883 +torch/include/ATen/ops/hardshrink_meta_dispatch.h,sha256=OTaH-L1TcX80x2tWgi4gdjcexRuahkCSu_9j5n-V6rI,1261 +torch/include/ATen/ops/hardshrink_native.h,sha256=DKtk0QLK45hsHO0LQdovlfWxk0__pVr7Pvc9jzSMy_Q,916 +torch/include/ATen/ops/hardshrink_ops.h,sha256=-cs5i0rdJWY4bPmFASZKAMIJiqsGKaooJleKXofto_o,2050 +torch/include/ATen/ops/hardsigmoid.h,sha256=RpQA8FJnYrie3RXhN7NS6cblPnYZZgHGFvHyXu_WujE,1538 +torch/include/ATen/ops/hardsigmoid_backward.h,sha256=7DdQlT7sou1OKk8lhKgwV5uIWpipdy8CvlrR0ZvYsX8,1731 +torch/include/ATen/ops/hardsigmoid_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=F_376sMc4O1XaPGo1BPRblco-DJ7ot7164eZTXP0tH8,1118 +torch/include/ATen/ops/hardsigmoid_backward_cpu_dispatch.h,sha256=2BxmOVxyhDoS_KAJ7bNlU5occxKaVD8nplXxMOzv7Tw,1313 +torch/include/ATen/ops/hardsigmoid_backward_cuda_dispatch.h,sha256=QK2h511fuJAW1sEPbPxZb13IuRMiClm1mqIkXyKAqzI,1315 +torch/include/ATen/ops/hardsigmoid_backward_meta.h,sha256=Ndu_lroHLAsTioGdAJmpkoZCG54vu6WomORCiFd0zXE,899 +torch/include/ATen/ops/hardsigmoid_backward_meta_dispatch.h,sha256=q9Y5egY1mfzSMNVb_1oQCkNaOwS02vMn6FvnCcEjUac,1315 +torch/include/ATen/ops/hardsigmoid_backward_native.h,sha256=s6jqu3RultsS6zB24ia1d1bsdmm11SzM24kM0eKsLBg,959 +torch/include/ATen/ops/hardsigmoid_backward_ops.h,sha256=5SBJj_kQLoLmRkDBFCJU-r6AUrNXHLHcwjvctUAGC_o,2180 +torch/include/ATen/ops/hardsigmoid_compositeexplicitautogradnonfunctional_dispatch.h,sha256=YPw8ALst21hD4IKzm_SRHdn0O6_9LT2QIIH4BsxQk1M,1134 +torch/include/ATen/ops/hardsigmoid_cpu_dispatch.h,sha256=JUleyh2A7IyUqauHrPuskaLxoR4JY3RZC1NRl05uPro,1233 +torch/include/ATen/ops/hardsigmoid_cuda_dispatch.h,sha256=X4bNY5G9WxvzhhakPi0rRkGuE4HcdrQxeC0KxAMXQw0,1235 +torch/include/ATen/ops/hardsigmoid_meta.h,sha256=JqZJdTe7IJ8ha_bNXG0wvi1_NZY2AhW1hgCjGhFuk5A,858 +torch/include/ATen/ops/hardsigmoid_meta_dispatch.h,sha256=QCW5_70L6gFZqYci9M4aLUI_5ONIFkqgo3pk3nLJ7sM,1235 +torch/include/ATen/ops/hardsigmoid_native.h,sha256=Wco4NHNrTyO_TSfl9N6Mf-7NTr0y3rtaAf5Tl6lp9EY,1065 +torch/include/ATen/ops/hardsigmoid_ops.h,sha256=TQ0-oExs-WUnKSQNxWkKGyBakrvwNWi5xUegtpEJrxc,2401 +torch/include/ATen/ops/hardswish.h,sha256=Vmjc4N4GQp7zbpzwm-MTBVY_Kz_RUQt0PAQW4besPLM,1512 +torch/include/ATen/ops/hardswish_backward.h,sha256=mnRdsG1aDIQOsIhfV5uQFx2B-Ok9oztMd-GBj2cQXs0,1641 +torch/include/ATen/ops/hardswish_backward_compositeexplicitautograd_dispatch.h,sha256=0naQpHQ__zl_m2-HbOSU3HxiRDAhJETbLxTKMFEQHmk,1238 +torch/include/ATen/ops/hardswish_backward_cpu_dispatch.h,sha256=IOdFsApXU2MQLaNR6KEfoIEv5Vd95Vm5kf_nzRJIQsA,1046 +torch/include/ATen/ops/hardswish_backward_cuda_dispatch.h,sha256=a0jWjX7zPW7YZO5jCLBP2GAQtFLVCTAjysjbB71pIhU,1048 +torch/include/ATen/ops/hardswish_backward_native.h,sha256=n-Ac3bJ8rnWdtQ_Fet6pOhpYg89mqR_u25gNIy7dBXg,923 +torch/include/ATen/ops/hardswish_backward_ops.h,sha256=68V051-8homxFBg-kNFj9_qsQ_phzxpRB9dCOeTr_Qg,2126 +torch/include/ATen/ops/hardswish_cpu_dispatch.h,sha256=eaXFAQsq_3bZctVLkAjqUXeOpVA8cZJlhZ5TjMw19JU,1225 +torch/include/ATen/ops/hardswish_cuda_dispatch.h,sha256=0wYY91M6PCj7U3ewaTVmJeQmEYPVwN_3YNx0xKtlEbs,1227 +torch/include/ATen/ops/hardswish_meta_dispatch.h,sha256=pw8f912ZARwEbEdgyaokui4fc_8AO7kzceUxoHgs-LE,1004 +torch/include/ATen/ops/hardswish_native.h,sha256=OGYCrM-63nfuTmKwJ9t8_pyirYVwsJQWLwFWa5pAfkA,896 +torch/include/ATen/ops/hardswish_ops.h,sha256=ey0gwQ3eKb_l8WXyi2B5qSPtZ3_Hvbli5DrZ1Fy-IOo,2383 +torch/include/ATen/ops/hardtanh.h,sha256=A0lgkzJnxEmy5qQAabwCExoUi1Rt-WnLcMi6JUCYZsA,1958 +torch/include/ATen/ops/hardtanh_backward.h,sha256=VMzbKy3G7xdVla-KHa3CPqN2qTbyvr-TN00t9pXowAw,2019 +torch/include/ATen/ops/hardtanh_backward_cpu_dispatch.h,sha256=-9HAP2OB_m4hVgPg0pgfnnl5pPuzxTt5w4WmI1zjX0U,1472 +torch/include/ATen/ops/hardtanh_backward_cuda_dispatch.h,sha256=Z1CLbqd5VakANsXJr0CZ52Ahe4Uv4kf0pkrzR6Q-SsI,1474 +torch/include/ATen/ops/hardtanh_backward_native.h,sha256=Rl9Gjk3fxF-Klo8lTT8n6KpBgwE6PE6smN1pmXrrv1I,1040 +torch/include/ATen/ops/hardtanh_backward_ops.h,sha256=_uHo66dM9Eqpk7Hou0L8n1NfMQ7iFWvpFxkNMlsiFkI,2530 +torch/include/ATen/ops/hardtanh_cpu_dispatch.h,sha256=VBZXPzS4le_ADXPp0Zk20Ho4Rppks2Srf5lZd4td6fc,1460 +torch/include/ATen/ops/hardtanh_cuda_dispatch.h,sha256=2bQWygl1MPJXjNa2saoOpn-QzNVukyWQGunVel9XK9k,1462 +torch/include/ATen/ops/hardtanh_meta_dispatch.h,sha256=QNSVeQL4pZS_Z_TqwVEVURPgwDyhfHDsiMOqAwN8ZG4,1064 +torch/include/ATen/ops/hardtanh_native.h,sha256=w2kQtAd6BnqIMk85Kh3UKxIbL-d_OfNP17aXeCwgmFM,1483 +torch/include/ATen/ops/hardtanh_ops.h,sha256=Ynv5tOHv-ekafQ6uGVDHH7KJV3M3ybAyWzxE8r_Wo3U,2941 +torch/include/ATen/ops/hash_tensor.h,sha256=FZDxxkwR1yjy1Nkr-kYMo7M4MIvG1U8kxxjSimEKR6o,1749 +torch/include/ATen/ops/hash_tensor_compositeexplicitautogradnonfunctional_dispatch.h,sha256=dI48aKbSpd_BWx1S1SONA3n1A88P86BG928Gw3UL-mA,1137 +torch/include/ATen/ops/hash_tensor_cpu_dispatch.h,sha256=AG3JTvCdNJapu7gllVYdViuj6cr2b3sKGo6bxQ22cCY,1345 +torch/include/ATen/ops/hash_tensor_cuda_dispatch.h,sha256=2JIlvC6dqbJTW06BIcIvPVRWhHZJpKotgvF00awQgXM,1347 +torch/include/ATen/ops/hash_tensor_meta.h,sha256=XvV9wibs3PzUd1bFl-S0ZUQD2QvGKVg0jASXWBf1-qg,907 +torch/include/ATen/ops/hash_tensor_meta_dispatch.h,sha256=r3vJ-BbqL9GBtQgRq3JZto4TwGgEbTsBlbga-8gd4CA,1347 +torch/include/ATen/ops/hash_tensor_native.h,sha256=BSiw_K5Hl60Rj3Nj9EHpkTS1FemfFUoU5pfKYVQWoXA,942 +torch/include/ATen/ops/hash_tensor_ops.h,sha256=UhORbD_iv8uygIziJJ2osNirA5_SnjaF5HtFqRyzrY0,2233 +torch/include/ATen/ops/heaviside.h,sha256=ifa0nKbz7PUAdEd-Q2bdkqymrLxIAlJ-8TrOvyXF3Ao,1506 +torch/include/ATen/ops/heaviside_compositeexplicitautogradnonfunctional_dispatch.h,sha256=dr0nAmJ3Aw8wqq-Yd-XP8vPiOf46XrLoDs41nAvkToQ,1184 +torch/include/ATen/ops/heaviside_cpu_dispatch.h,sha256=Iuw6hUSd50h6mD0xik49-PJGOtotTlNcmPNBQAOBUS4,1333 +torch/include/ATen/ops/heaviside_cuda_dispatch.h,sha256=8Bm-2p5Q3gZfQLnXKD5SixvYFDwUgX_0VfVU1Q-KK8k,1335 +torch/include/ATen/ops/heaviside_meta.h,sha256=GXYmwcpcprS366sEYGZ3Motbgl3uoadGKC-zXDHy7uc,883 +torch/include/ATen/ops/heaviside_meta_dispatch.h,sha256=YiYD3-EpqbLbQZfv5PoGZ0LU7eGH5J6l1MHQq_IhJTA,1335 +torch/include/ATen/ops/heaviside_native.h,sha256=FP9PdmGzeEAfAHFOJ2WLoHXDfebdjUUFk81GgEoU4LA,914 +torch/include/ATen/ops/heaviside_ops.h,sha256=lEyBNGeDEjYRKfnP9IURdeMf_DnE5FGdTNlFKL0P-ik,2650 +torch/include/ATen/ops/hinge_embedding_loss.h,sha256=wZV1NqQ6mPHl59DpejDOuZfxuu7lHyOkRLqHkmyoqD0,1148 +torch/include/ATen/ops/hinge_embedding_loss_compositeimplicitautograd_dispatch.h,sha256=QFHFbES31Z0u7upxH9qKyJk1shdGqS30niwY53Ig-TI,1145 +torch/include/ATen/ops/hinge_embedding_loss_native.h,sha256=H0WxPN2ujX-qk8qmNGYMv1i4ZX3TrpV2UIrwUCe2mko,855 +torch/include/ATen/ops/hinge_embedding_loss_ops.h,sha256=4yb47ihVkE0yyCUV222K3nzRObEwk-ANcm5dPzG0wCc,1499 +torch/include/ATen/ops/histc.h,sha256=2sJ6SQK-G7EqCIe6fZtNapj5nVMwDjwh-jVX7CcPXgs,1692 +torch/include/ATen/ops/histc_cpu_dispatch.h,sha256=_d-2bvWqcME6ZBui1lL5n0UEzObwm3k2id-Zhgb5UdI,1360 +torch/include/ATen/ops/histc_cuda_dispatch.h,sha256=Zycyh8B9-QLfrtlIs9SPl2rQIk73YhMz06Ifg1rt5Aw,1362 +torch/include/ATen/ops/histc_native.h,sha256=HYGFI_gWnG43G5hsP5rchrwHbGeE_37yY6gFGg0MFxE,1261 +torch/include/ATen/ops/histc_ops.h,sha256=-B8V-NJ4_oN-cRI_VVWrHg7jaAE1VAg6-GnlSfyWICo,2270 +torch/include/ATen/ops/histogram.h,sha256=ZtIMlmXwb9eCi95-gH48v5sWd6qVzv3IodRK2x6PJ5U,3829 +torch/include/ATen/ops/histogram_cpu_dispatch.h,sha256=SB-xBrJdAnxkzFk3GZQoMKDbdAJViS9dFide5tIPgWA,2325 +torch/include/ATen/ops/histogram_native.h,sha256=EvxE1c8GxI8b66nWE-6KY550Z4TfS6J5B2AgDVFQFH4,1572 +torch/include/ATen/ops/histogram_ops.h,sha256=4cWdSCEqQdzeuKf-Uykrg_8oERwiu-u5HAF45bvqxbY,5074 +torch/include/ATen/ops/histogramdd.h,sha256=P4AJvySvyNu9Xj36X61d0YH5We8OVvoxnPJ2--IycuI,2259 +torch/include/ATen/ops/histogramdd_compositeimplicitautograd_dispatch.h,sha256=8UrgKl1e1pIg2RiPQ7Q6A86jbbguvGt0GK8_ncJS_1o,1729 +torch/include/ATen/ops/histogramdd_native.h,sha256=_B0XeLYLwqhGkEkcTN-VM2ioBB2rb9wzfcGb-UsBZ1Y,1439 +torch/include/ATen/ops/histogramdd_ops.h,sha256=hI3aGV_FXF_AXTqGKuoumU1OcE3lVfKP9owRF94z2XE,4069 +torch/include/ATen/ops/hsplit.h,sha256=7_p_y1bp6OnfmmrHBiKPX0KroBcV7gZGdUQoiWdOgbo,1234 +torch/include/ATen/ops/hsplit_compositeimplicitautograd_dispatch.h,sha256=4nRfJAdpvVZkXVjQVsPvuCI5BJsFixG52wmIT1VB1Fo,1174 +torch/include/ATen/ops/hsplit_native.h,sha256=GuRUkKJGT7TtKdHg4aWIR9HkesjcQ5RX5x8K47UmEgM,884 +torch/include/ATen/ops/hsplit_ops.h,sha256=l7mpaaLwR3hSLVZEBwgamTXewNOHSAKG7XnLvT3SJfY,2041 +torch/include/ATen/ops/hspmm.h,sha256=EhGBz6-Ro3UJzBCI1T8ALKkTYunMz0EvK_wEmZ4x5BM,1448 +torch/include/ATen/ops/hspmm_native.h,sha256=Vf1w7GzYiipNUE7Ec_NSyLETWSIwWB7MlEBjp0FSKv4,1111 +torch/include/ATen/ops/hspmm_ops.h,sha256=nKED-QwFDpQP8p2ZPm5mvHrVXJCw2TcyNOJnbSWdjpA,2006 +torch/include/ATen/ops/hstack.h,sha256=FH00LNCY-zKXTBcRbuH6X-HkN-0AZk4L95vEjm1wa0I,1347 +torch/include/ATen/ops/hstack_compositeimplicitautograd_dispatch.h,sha256=a4gfm3i-rF2tlm9Wev62Wo75tXkBCxW3LBGZ6z0bo3c,1202 +torch/include/ATen/ops/hstack_native.h,sha256=AyiTQV0LBELfz4tjj7jiS6X9mL4L9S3WS_n7lWEtZFo,833 +torch/include/ATen/ops/hstack_ops.h,sha256=cv0ftE-aB6Xf723IM94OkEIfU_zQ1ped50j5uMBUME8,1844 +torch/include/ATen/ops/huber_loss.h,sha256=WoPrK-1pKUpsEVsFpAv_gZmgyclPOWuRiX1p9DFPnFU,1828 +torch/include/ATen/ops/huber_loss_backward.h,sha256=VsSEJ03ZPc0TgyBSfNNoOaAEPhr_xLFBjQUD4DitBZg,2080 +torch/include/ATen/ops/huber_loss_backward_compositeexplicitautograd_dispatch.h,sha256=iRZ3jqFSknx-nzlSrjgg0SXfkYYV_4M9i_KMP-gr1o0,1151 +torch/include/ATen/ops/huber_loss_backward_cpu_dispatch.h,sha256=y_y_CUyxHmU5nsqxiYeQOCfxbq88A-sREKWwoOGhwlk,1330 +torch/include/ATen/ops/huber_loss_backward_cuda_dispatch.h,sha256=84MIU_UPbcXWDyS0IwWsvJ9YUuOO9eYQq4gZgLYHdLg,1332 +torch/include/ATen/ops/huber_loss_backward_native.h,sha256=_Gxz5Z2rp4oBE_ajhztL86K8fyzZem9L-Ruum6WjcGg,1052 +torch/include/ATen/ops/huber_loss_backward_ops.h,sha256=9hr6ThU8lmOfCkyKVRpZTNMpcM7yV8-ogIsw8slQYqM,2553 +torch/include/ATen/ops/huber_loss_cpu_dispatch.h,sha256=rH0ssD472RnESWKbeoX-7fhhyYVOLjLSmkttUySciSM,1401 +torch/include/ATen/ops/huber_loss_cuda_dispatch.h,sha256=0SDnkkUwyeqFuxjEZVNrNlWvgmqxlERNQ5MB9V_3GlM,1403 +torch/include/ATen/ops/huber_loss_native.h,sha256=E6JOP7RKNZwKYi3qRUhYrjnEzG-Fbk6Dwlb-63qckWs,987 +torch/include/ATen/ops/huber_loss_ops.h,sha256=I7xWxTFGoiQGPA98fGnXwnHmMjUy9vegJ5cKR28i9DI,2288 +torch/include/ATen/ops/hypot.h,sha256=bvUwgELN0URBuJx4wCMM0r7R-8bbfnUoe34tXn-3Ox4,1457 +torch/include/ATen/ops/hypot_compositeexplicitautogradnonfunctional_dispatch.h,sha256=xgCfEA9lQL83EtL7vJZw3DE-KUuejuplTp6JaTQGtzw,1174 +torch/include/ATen/ops/hypot_cpu_dispatch.h,sha256=vBuiVZRwf-zYuYhT2lyBHF4YN0u5p0JI80I0yf7tjZ4,1313 +torch/include/ATen/ops/hypot_cuda_dispatch.h,sha256=bwQBXfmhTzk6e2jTUvkAlbc5VavoA3_wbxFB9gMXGBA,1315 +torch/include/ATen/ops/hypot_meta.h,sha256=SNkcgKq99_vnAaTWmbVegARP2QGOGNExpKq5BDPR7N8,878 +torch/include/ATen/ops/hypot_meta_dispatch.h,sha256=svoxulzkjFSbGwBuPEh4u6mP_iBhJhxTtkD9ZFK409A,1315 +torch/include/ATen/ops/hypot_native.h,sha256=_nuQWV8DDZYEmhUYXTAn8tdJfEyQdwyxtDTJLp9k8EU,901 +torch/include/ATen/ops/hypot_ops.h,sha256=XkRmRCcB2BcRFxy-Yyr2J2uW69fjzCi1hKfnZkid5Vw,2605 +torch/include/ATen/ops/i0.h,sha256=xeoYGrh6YPlBohddEPwaxKDtF1zTBprni2nnSXz7wlE,1421 +torch/include/ATen/ops/i0_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Ki6c_vlWaFg5qiPsT9utxexQ__jCzRCL9QzniDVfOr0,1116 +torch/include/ATen/ops/i0_cpu_dispatch.h,sha256=chltJPXckI8nngrhD67ZbhULM3BUFfEDbSKuKAj7L_Y,1197 +torch/include/ATen/ops/i0_cuda_dispatch.h,sha256=ZNqN-ARD_WgeSGt5TmfQwSWDbF1u6poxaNDAIU46-gM,1199 +torch/include/ATen/ops/i0_meta.h,sha256=LUnU6TEhk8lVlTksE_TewSB0JmVTGgiX6i323czUiHM,849 +torch/include/ATen/ops/i0_meta_dispatch.h,sha256=H6YsIGVlTnBLbwseu-LvnyeTrNVqvxSRON42qODFgY0,1199 +torch/include/ATen/ops/i0_native.h,sha256=hq_G7PRMqbexERavzflIxbbrBwI9Ow_WyYTVOTLK-YE,866 +torch/include/ATen/ops/i0_ops.h,sha256=F0wP6KSFaxk5zu7qfOFUVZDwZloXQgG5n2d69tnDJ7E,2320 +torch/include/ATen/ops/igamma.h,sha256=TZNfVI6FQunZPiiNsZEdDDsthVGM_d2kcvCgzofFTQI,1467 +torch/include/ATen/ops/igamma_compositeexplicitautogradnonfunctional_dispatch.h,sha256=65ypXJHNXg5kFCOO2Ug3X2IEs_WEoAPayvb6pm3_4eU,1176 +torch/include/ATen/ops/igamma_cpu_dispatch.h,sha256=IVnsPP1O4pmCeDCoITG1znw_2W7zzJJ-b3ctgXtLNgY,1317 +torch/include/ATen/ops/igamma_cuda_dispatch.h,sha256=E26dO_UWB0dR3dVEKuI9n1YmeRlSaKnGzFeOLrCOans,1319 +torch/include/ATen/ops/igamma_meta.h,sha256=mZb0et0T0yNNuwGIsA7RQ4y_1UDNucJqvZnUYCRMmqM,879 +torch/include/ATen/ops/igamma_meta_dispatch.h,sha256=vbtxXcjoC6SGWzm-v-NFuNJYOxc8ZydYPlkq9m_PqzM,1319 +torch/include/ATen/ops/igamma_native.h,sha256=cWggLXxwV2WRlbiKH4ax6ItM0y8RnP9EfBPlUukv4ss,904 +torch/include/ATen/ops/igamma_ops.h,sha256=ouwO2pRY3MkZk3yxMVn5UcJ_bJHDuaYUf86jyTO1OUU,2614 +torch/include/ATen/ops/igammac.h,sha256=J7_-vqidKZPPpvneyR566ZYgwgI7HwZw-u-yRhLHl_Q,1477 +torch/include/ATen/ops/igammac_compositeexplicitautogradnonfunctional_dispatch.h,sha256=u9FGkKFCT8t9XIeMltCuTzFGXurZm18LDhM9aXJgEys,1178 +torch/include/ATen/ops/igammac_cpu_dispatch.h,sha256=gTnC66zdg1lSWNqkSHyuXh6V2sB_cje_0JCRvHdJzbk,1321 +torch/include/ATen/ops/igammac_cuda_dispatch.h,sha256=3AjEGoTxwDCSnaLduIr7dktAQNkiM7zRjptNoHGDBLk,1323 +torch/include/ATen/ops/igammac_meta.h,sha256=vMBMDJYtqqJ9HSYsz1LBCig-dKSQdlrf8wHkQLryAr0,880 +torch/include/ATen/ops/igammac_meta_dispatch.h,sha256=RjiAB_CZkAzvdr087cOiuDZqkHUQhNwbhaqxj5W3_m0,1323 +torch/include/ATen/ops/igammac_native.h,sha256=pbL_x7Keah5EwBzAKxnNO3fDCejPd7lcg5NkDmXWE_E,907 +torch/include/ATen/ops/igammac_ops.h,sha256=1oLUb2-HGw2MC1981GmNKORnB5OwWPfynVEXGHyEd6A,2623 +torch/include/ATen/ops/im2col.h,sha256=awRa_utyY_nQdp36HRGlD68WZrR6kXHPCXCTaJXEcNo,1962 +torch/include/ATen/ops/im2col_cpu_dispatch.h,sha256=IfqZXqaVCuv6M2JvgP8A-RNvXETemuamAjC1eceSpKA,1473 +torch/include/ATen/ops/im2col_cuda_dispatch.h,sha256=Jiyk5v4DVJmRCxlvEYZR-_w2H7aRTfg3k-BcYe8EAzA,1475 +torch/include/ATen/ops/im2col_native.h,sha256=V6KS_p_lvqbttWfZ-OseEs-AjVz9dHvFWL500zI7zeo,1403 +torch/include/ATen/ops/im2col_ops.h,sha256=6-embC34URZvOylyaW9xlGhS7U0mDQysXBypgS7tG0E,2534 +torch/include/ATen/ops/imag.h,sha256=3jx2srRayASePtZNDCRdBxnDGZ9Ey-so438fye1YcKQ,925 +torch/include/ATen/ops/imag_compositeimplicitautograd_dispatch.h,sha256=aoiYaJ5M5_qpDLaZmqq_eAXOX8PfdMC6A8PAgpcTLsk,1044 +torch/include/ATen/ops/imag_native.h,sha256=tAHpwNyCwTYVjmhqFwB3f4aBXRGbaItmIa4RutIPrvE,754 +torch/include/ATen/ops/imag_ops.h,sha256=D2VJccHn0i6b9nIQWHsgZYtEvfiDMgG22vB66KeCXms,1245 +torch/include/ATen/ops/index.h,sha256=AixfRibTX2TdICYwGSG9qb9FE47xeUExS3jYJoW0QHQ,1610 +torch/include/ATen/ops/index_add.h,sha256=HznNU4HLhlaXE4TWLwXuV8ZjltyojE-q2MwPVehjQSA,2233 +torch/include/ATen/ops/index_add_compositeexplicitautogradnonfunctional_dispatch.h,sha256=DwrdMmJHF_yAsOYKp9CvWNhJh5h9g9yGwAF3zjb5Uj0,1318 +torch/include/ATen/ops/index_add_compositeimplicitautograd_dispatch.h,sha256=5jVz0eGq_y5aggiWMG95k1DftpO9PbEW2ONCoPia_ag,1147 +torch/include/ATen/ops/index_add_cpu_dispatch.h,sha256=rmEPBG47GlqeNxMx8SLCpYZhwmRJbxmfubU69kJ4EIo,1599 +torch/include/ATen/ops/index_add_cuda_dispatch.h,sha256=G7DVS8IpyrdPNVDGxkSzeYI3BH2oxHLVYdwICXhd39c,1601 +torch/include/ATen/ops/index_add_meta.h,sha256=vFd7p6nfU_bf61Z6_RZW_TNqJf5_-pdrpL9K2br77JU,1402 +torch/include/ATen/ops/index_add_meta_dispatch.h,sha256=p4DJN2nY9r0_8AuV5Ncd2Qn-vhOEM8vQO8Q6nyaslVc,1601 +torch/include/ATen/ops/index_add_native.h,sha256=ieH-CzrgVs5bJ22e2HRyvKqVJkuPP0CLxY3v5CfRngA,1386 +torch/include/ATen/ops/index_add_ops.h,sha256=azQWOU3MnM_e7C_0lz7pv3RUW-kQ3I5D89I9-LxZZ6I,4179 +torch/include/ATen/ops/index_compositeexplicitautogradnonfunctional_dispatch.h,sha256=QtZxLu_ougQZUrZ3beE3nFthlyK_d-NuNtDDZbSuYYk,1127 +torch/include/ATen/ops/index_copy.h,sha256=36BjOw5Q_Tk3rHDyjg_Sfj4xuRqtNq-zIW9PGvB5kiE,2038 +torch/include/ATen/ops/index_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=SZ3cyjq0DOV0RiqfVz5o9rzc65NYYVqttDlAsZ2M6Ro,1264 +torch/include/ATen/ops/index_copy_compositeimplicitautograd_dispatch.h,sha256=qnfdVqGkUwPNY9RXPwnoOytwMX517hoJ7mhHtAg1Cd0,1246 +torch/include/ATen/ops/index_copy_cpu_dispatch.h,sha256=4gNaHEBElxmPaEdZ48Dr2lRBMgCdkeuR61eUwYj7wwA,1493 +torch/include/ATen/ops/index_copy_cuda_dispatch.h,sha256=OOwlX1XFHfh3LZrrsqDrsWVpXC-jR8fYk99JeWBwAeo,1495 +torch/include/ATen/ops/index_copy_meta.h,sha256=IqjTMQ8uYJh0pCk3twg7GvVYaZcdgznXlbK8Ttg5r_w,1377 +torch/include/ATen/ops/index_copy_meta_dispatch.h,sha256=y0kI335snUjR3qE9cmAE2d1k3DfqBAevlcKUhcLdmfU,1495 +torch/include/ATen/ops/index_copy_native.h,sha256=Rj5WEq_30EGFLRqEVAQFExv3hzJNdOz35fumZoFQbm0,1211 +torch/include/ATen/ops/index_copy_ops.h,sha256=5a6XMCHNVUFZMDuec6Xbb6OwooIzPzF-8ET50ksTGmU,4610 +torch/include/ATen/ops/index_cpu_dispatch.h,sha256=TqJ9jqNrVz3iroW978PYl_BJmPQv5TZz4rJV5sX6nzY,1326 +torch/include/ATen/ops/index_cuda_dispatch.h,sha256=2AxYwOpj009NPC8DmpLeEFVpld6R0SYTzBknKr2w7dc,1328 +torch/include/ATen/ops/index_fill.h,sha256=IbFuuI2XruLMTEtDfF6C9DDl7maf8R43u4_Kq_Kv0Ek,3421 +torch/include/ATen/ops/index_fill_compositeexplicitautograd_dispatch.h,sha256=MpuMhkg7fRdWfxgmq80BeWYa65pyKW8uIEb0l8ZeSE8,1833 +torch/include/ATen/ops/index_fill_compositeimplicitautograd_dispatch.h,sha256=31rLAM_mSHXoHo4p4RMD4oQC7pSkrQLSwFtN79kb2LM,1497 +torch/include/ATen/ops/index_fill_cpu_dispatch.h,sha256=0ds7QXJKDNK0qBWQBRxe8lTESxS8ypzH3uZYt39N90U,1189 +torch/include/ATen/ops/index_fill_cuda_dispatch.h,sha256=tgRT51WBpuWrEkL5kQsaT4WJgqAgp6oHKSyP1cPbteI,1191 +torch/include/ATen/ops/index_fill_meta_dispatch.h,sha256=LptiUZ9Q2Cn4R2iUT0NOQZOF3K0DARV_viCtu8ZaKMQ,1191 +torch/include/ATen/ops/index_fill_native.h,sha256=bROPKmcDCwIqueaEJGWw7SSTokpaRYSh-yXVXgBlEjc,2015 +torch/include/ATen/ops/index_fill_ops.h,sha256=r575PE5yer_opqILyS4V-Qpas6O_jjJ4DXT3HGUn7i4,8734 +torch/include/ATen/ops/index_meta.h,sha256=1RJWki44mShuFLYb1ryEHiRarZ57hxRZcetuPgjnWSU,1779 +torch/include/ATen/ops/index_meta_dispatch.h,sha256=6Iatq79ZbnyEA1kxRwPI266WNDGSf9s642IdATtCEag,1328 +torch/include/ATen/ops/index_native.h,sha256=lbZHyGoclt0k7CHM4yVZ24n4ePeDpf_YBLNiXJy_AQw,1046 +torch/include/ATen/ops/index_ops.h,sha256=NOEXhvmnJmZ39Kvna2DR7lwjSaWM86xV7j2A0R1EDds,2239 +torch/include/ATen/ops/index_put.h,sha256=ehi-t9QsYczrFXl8vzg7a2KOgrS5bf6HkODM-JpXkt8,2274 +torch/include/ATen/ops/index_put_compositeexplicitautograd_dispatch.h,sha256=wlfPEGAjIJ9k3YY8Cr6rNVPtHTNaMhPWUA3Z2Qj1CVE,1687 +torch/include/ATen/ops/index_put_native.h,sha256=tmpHPyxptJVKIu-d0p69_U61DGqXhj7o9GuLv_v9cZw,1208 +torch/include/ATen/ops/index_put_ops.h,sha256=aICx7EIqs9D764M1BQsDPAh4Z5tLTeViDcDJ61s8KUg,3376 +torch/include/ATen/ops/index_reduce.h,sha256=9u9_gfXOcLlvnvVkFmr6irqhL2Ia_yoFb9mGSqhc7go,2077 +torch/include/ATen/ops/index_reduce_compositeexplicitautogradnonfunctional_dispatch.h,sha256=KSEMzy4w98r3TY7nS5S_vw3lN28W8_Fs8OQ1teoMOSU,1366 +torch/include/ATen/ops/index_reduce_cpu_dispatch.h,sha256=qG64Z5f2QJTzXkCj0zKTn0ruKNVRPUQAnmVCw_-HS_s,1692 +torch/include/ATen/ops/index_reduce_cuda_dispatch.h,sha256=FB_0odXuDHnqqwO12gxWKtE5F7uWab27a8u70IicPtA,1694 +torch/include/ATen/ops/index_reduce_meta.h,sha256=kebZRZyRvGlJFxH3dfSqYGiXclWIAgEDLmhEP-q4s88,1423 +torch/include/ATen/ops/index_reduce_meta_dispatch.h,sha256=wzs0gy7pjgP-bFWX1w2jSZERcyexqSQ593MVdPVJvZk,1694 +torch/include/ATen/ops/index_reduce_native.h,sha256=CWr8Nmr9BfKbVjdop_3x7DX3ENOl9HN6X9NoNtvi2mM,1281 +torch/include/ATen/ops/index_reduce_ops.h,sha256=p9lvKdr6gC2NU2b_mrnrWtcPXnfqaTY60X1tIyGhRgM,3517 +torch/include/ATen/ops/index_select.h,sha256=l8t5aADSYR17h-GRoPFcGZh3iHfNuNl53u9ARR7bUDw,2495 +torch/include/ATen/ops/index_select_backward.h,sha256=qcOmXE4tz7kJx4T_giQsoKr2uUpzJLDkk2h9szA8pbc,2155 +torch/include/ATen/ops/index_select_backward_compositeimplicitautograd_dispatch.h,sha256=6QYE6MD70ppIvvGoDF4nLGyQnoypa3abRXyisRJG9is,1276 +torch/include/ATen/ops/index_select_backward_native.h,sha256=lNJ9j9UT87d-eMRVZGg8YRY1C10TCyqxRqxrTSfxg2o,849 +torch/include/ATen/ops/index_select_backward_ops.h,sha256=e4OChxiU9tdfdcOIIQcTGdE4KQVuIbYiIFZtTC8gEyU,1526 +torch/include/ATen/ops/index_select_compositeimplicitautograd_dispatch.h,sha256=LMik-rYFOZo4rnVJi0NeEevoTw9rC1UDyIWDVgrWojI,1352 +torch/include/ATen/ops/index_select_cpu_dispatch.h,sha256=Jaw1XeiBJzra0QudkgyVlXJunwmwEVk0ajP6YS1ctrw,1296 +torch/include/ATen/ops/index_select_cuda_dispatch.h,sha256=NelMda3n0NhL1eEfqonvKnqJFac2CkYeUDOsAGDeNL8,1298 +torch/include/ATen/ops/index_select_native.h,sha256=kUBhYaJxfMgC89vjYQZRAFvH0JBfYtDs86P_LNma3zg,1854 +torch/include/ATen/ops/index_select_ops.h,sha256=UmG5cPUyxjZqb4KJ7Ad6qCV1yQjf6Qq_9j-cyx-vZ64,3629 +torch/include/ATen/ops/indices.h,sha256=QMgC9TYtGEup5vLKSBvM2tavuUOW2XL0MXhIk18zR2A,790 +torch/include/ATen/ops/indices_compositeexplicitautograd_dispatch.h,sha256=Wi89ZV9DM_Pl9r2LDHWzhus2kXMCV8_DKlrVyxyIpwU,1047 +torch/include/ATen/ops/indices_copy.h,sha256=nDONN7GLtzIU6p6eo4FSa5Ny1zUgWp8CLza0c1D1jRM,1386 +torch/include/ATen/ops/indices_copy_compositeexplicitautograd_dispatch.h,sha256=Y5qDYtsf4Y4wNJrnZSgEYEA21e5KX5KDV9vedAB7YZg,1162 +torch/include/ATen/ops/indices_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=s-WxBGGYP0WgAnzjdXarmRZZg3UjNxpFJj3n1BOCXVU,1078 +torch/include/ATen/ops/indices_copy_native.h,sha256=59Pg921qRjeKm9dQ8RulaGwt_j-13rwDvG4FeQx5WIY,847 +torch/include/ATen/ops/indices_copy_ops.h,sha256=iyJ06_JodlcHmgqhpbcxdSAByUkMAG5o79MxjP2_v7I,1882 +torch/include/ATen/ops/indices_native.h,sha256=ervHaKtDehOGLWH5TxdCpKo3JWKJ94s2IAm2ZIxJ0xA,828 +torch/include/ATen/ops/indices_ops.h,sha256=PR9h5836KZHMooJxMCCOOnuYO8ofBMjQKKTvAUB6KIc,1254 +torch/include/ATen/ops/infinitely_differentiable_gelu_backward.h,sha256=D2UZjO3aaaUOlXMnSX520ImO3B_hosf1LSZisWUFdZ4,1103 +torch/include/ATen/ops/infinitely_differentiable_gelu_backward_compositeimplicitautograd_dispatch.h,sha256=sNk0t_HgajG_Ac5lINzAravhkJMeiEUdqxC-ATMIujc,1104 +torch/include/ATen/ops/infinitely_differentiable_gelu_backward_native.h,sha256=_BTcPbq-iqEoMFKVGHVZEpcm1gr1IsDu8GcrH7Turqw,814 +torch/include/ATen/ops/infinitely_differentiable_gelu_backward_ops.h,sha256=m9rOAuaUoWE5yiOZ201UxjM2PLoFidJ8X5sVCfIR80I,1427 +torch/include/ATen/ops/inner.h,sha256=yP_vdCEaLNkFtdTrmVVjtBg6dcaQUFgtrT0iPFm4mgc,1457 +torch/include/ATen/ops/inner_compositeimplicitautograd_dispatch.h,sha256=XklCp-UhMqTX6JUQirU-1g92_8pMOV2mnRJvf-uE0Q0,1280 +torch/include/ATen/ops/inner_native.h,sha256=H_caW_vE0BVmSmQW_FjyoIXiEewmwpmMNbbjJL3AWj0,885 +torch/include/ATen/ops/inner_ops.h,sha256=T17O-fqY3oMvPjEGDQGhBQt_IPlZi4rbXam86wt2AdE,2012 +torch/include/ATen/ops/instance_norm.h,sha256=DAsw7gTNzGH6HrnfyVXQs1tbUhXvxp-7UQ3KtBNLWAs,1444 +torch/include/ATen/ops/instance_norm_compositeimplicitautograd_dispatch.h,sha256=6EQ3TPvQqyLU6Sl5B5-xgFlpG86HBgQiHvuxHdqwiMs,1310 +torch/include/ATen/ops/instance_norm_native.h,sha256=-xo0GP9-A4txe_yqmR2UrkfeXwMeGXUa2QqX8isr1eA,1020 +torch/include/ATen/ops/instance_norm_ops.h,sha256=X2ryiNh9YOrrf52RTZR4sSQ8EK6fwIXMhzBGcCg1Rj8,2099 +torch/include/ATen/ops/int_repr.h,sha256=fVHkEqKXJvj4ZFZ5tzWrR-dWjQhLUvzxvn1zYokAOaU,1346 +torch/include/ATen/ops/int_repr_compositeexplicitautograd_dispatch.h,sha256=ggVziFEoa3oohDMJYy5v8wy42AA_vG8K90LHRCJuWQQ,1154 +torch/include/ATen/ops/int_repr_native.h,sha256=0XRHluZsFgG60IfH57LgzWtjJqTMe_JYtF6TAHqRV68,925 +torch/include/ATen/ops/int_repr_ops.h,sha256=I47dHf9nxY8EuxNWoEOYOmv8qHFaRGH6yty-f3ZjhTM,1858 +torch/include/ATen/ops/inverse.h,sha256=GtQV64M17XLD8Vt1ezhjEMzM3QlBHyld2T92J1afYlo,1336 +torch/include/ATen/ops/inverse_compositeimplicitautograd_dispatch.h,sha256=9qP76f3QzRALxSCVB9XrsGD0SuKnOHbiqVVFt197lqI,1208 +torch/include/ATen/ops/inverse_native.h,sha256=b6zyHGnf9sYBMYbM-tPe3rOD0d-0d1moosJfuu-AFxM,837 +torch/include/ATen/ops/inverse_ops.h,sha256=IFj4eIT4fK5aAg2FIDiwlC1CP7k7xGqQtC9BVx2Xhno,1852 +torch/include/ATen/ops/is_coalesced.h,sha256=YUb4gXHvvIGeOOQ8whf95JwbxQjBqIFTwolw9Hbg5uE,795 +torch/include/ATen/ops/is_coalesced_compositeexplicitautograd_dispatch.h,sha256=9vwPL_-5Lbr7pglubpbPnP_F5MUNWK0p1aXuXz5N35U,1046 +torch/include/ATen/ops/is_coalesced_native.h,sha256=WPYpQ_uZUeTcpRRJ86ljhu-j03pHv3Rd4buJJN3ZZaU,826 +torch/include/ATen/ops/is_coalesced_ops.h,sha256=tChsBhuNZkQjqaLUs8JPtTNq9WTFIBJyFcRUlQYC2d0,1243 +torch/include/ATen/ops/is_complex.h,sha256=kisyI51CG8LBr-HzaZ_ld2wiWophkVZ2XYref8AyGu0,946 +torch/include/ATen/ops/is_complex_compositeimplicitautograd_dispatch.h,sha256=9WvL1daCFkUoj4mozguKeBCki7dY9R1zEHQ1-7Fq0q8,1044 +torch/include/ATen/ops/is_complex_native.h,sha256=vxvdYnQ5Z4rS07q92Yc0RONhPclSNfm-066dYf53KEY,754 +torch/include/ATen/ops/is_complex_ops.h,sha256=GZXzk45L01Y87ae6xj_ioZjTgPioAP1Y8d3kkl3TY50,1237 +torch/include/ATen/ops/is_conj.h,sha256=c4yKI860tGwDzCAvEgye3ftde-Yz95oxRd9IlUeP-E4,934 +torch/include/ATen/ops/is_conj_compositeimplicitautograd_dispatch.h,sha256=qPXi21wE8fb5k07Ljo_WxFsHYxHS5h4qmtpB_t-zT4Y,1041 +torch/include/ATen/ops/is_conj_native.h,sha256=QuIsedkLEgXHwNZnCiUhcn3x1rPJTX7GUXsc37l27j8,751 +torch/include/ATen/ops/is_conj_ops.h,sha256=r9CBHjcL0rcfImYvy17-4TJlVVfXEfF_UaghepLlSPQ,1228 +torch/include/ATen/ops/is_distributed.h,sha256=MkbRusY_2CBJv33xUQvfJfqsSlX_0WquZhfFa9X0PYc,951 +torch/include/ATen/ops/is_distributed_compositeimplicitautograd_dispatch.h,sha256=mMSuBYkDGkNCUmmeCcOATK5uhe444M9Ts6wqu2pDHlo,1048 +torch/include/ATen/ops/is_distributed_native.h,sha256=624DS50kp_aw4EaoBUZPbZSSrp4vClUnCzWJR9_I90k,758 +torch/include/ATen/ops/is_distributed_ops.h,sha256=ZehfSCn-owmdxx_BRrzJoHBl2KNVdclKlEgstssFb4s,1249 +torch/include/ATen/ops/is_floating_point.h,sha256=WcbRv_yNm5uJc8u5ARJBMsyMfU7shg-bMsst_4Zn3Xk,974 +torch/include/ATen/ops/is_floating_point_compositeimplicitautograd_dispatch.h,sha256=gp7l-ovBNI-Qvmw5YtR-RTSESjJKP0lgQT6XYaxuar4,1051 +torch/include/ATen/ops/is_floating_point_native.h,sha256=uRrUTuB3lzrSB3GMXbjw02jgvTzoIv4mFwF9UfcK_V8,761 +torch/include/ATen/ops/is_floating_point_ops.h,sha256=WZGsfquOtlY9fPR8a85Gm1EvjpiK1z_GRp6yo_DsGPQ,1258 +torch/include/ATen/ops/is_inference.h,sha256=mlBcr10kpDueiGdijw3HOq5d5wJIH2pmHb20M1sMOjA,954 +torch/include/ATen/ops/is_inference_compositeimplicitautograd_dispatch.h,sha256=HA0Ni3E-1NuHnY2fWAg2Rggh9UZmuQsYPODqgxmekgY,1046 +torch/include/ATen/ops/is_inference_native.h,sha256=Gsl9RPxxouPRS78DZyB6PvD9pfpL25dTUvcjvPDBulI,756 +torch/include/ATen/ops/is_inference_ops.h,sha256=pxvBMLdg7W969Jzl_qLKKeStX31S2pJLOvlaR-c7Vmc,1243 +torch/include/ATen/ops/is_leaf.h,sha256=atH9iDQnFyMOwkz0hIEYGDol5z1PPeI_9a-iezy7_sM,790 +torch/include/ATen/ops/is_leaf_compositeimplicitautograd_dispatch.h,sha256=wXQmv3jrxP-nxdB8HLnNCbFxD0EHOHN2Y2jtktAcgDU,1041 +torch/include/ATen/ops/is_leaf_native.h,sha256=hbpczZLb5nz6hxbITvSFMgGlqRll8GT5SHKYsJOvNhs,751 +torch/include/ATen/ops/is_leaf_ops.h,sha256=WQe9AXqYgShjE2DsdJ4rucrOuuqY_jYLFF8W3JXY4b4,1228 +torch/include/ATen/ops/is_neg.h,sha256=QpU94x6HjJVMRui5MMvVbeQK6UnwWcQbH4_97ipQqik,930 +torch/include/ATen/ops/is_neg_compositeimplicitautograd_dispatch.h,sha256=0pnXGnlJnaigW1xbRWrx93zVTc9L3zPcN1JUmMRArg0,1040 +torch/include/ATen/ops/is_neg_native.h,sha256=UUe7hkGJSIaJkV2tJ_uvsC62PaQL_Fjhb6SkwCde9aA,750 +torch/include/ATen/ops/is_neg_ops.h,sha256=6zFrMMtwW_zQNS9V9Z05sA1elCFmO-qpYOXZjuPwyHQ,1225 +torch/include/ATen/ops/is_nonzero.h,sha256=O09VoPkbywrQQY3fpehO-7tsfCtWH4AaTjkLQ1DyZGE,935 +torch/include/ATen/ops/is_nonzero_compositeimplicitautograd_dispatch.h,sha256=0tWZeMhbe2zKvYuQBbhwN_NEEDflkWF3nL18QuXY68o,1044 +torch/include/ATen/ops/is_nonzero_native.h,sha256=VPzvrL0bJ0Wq85nCJzPA7tydM1OX-ogG__caE_DhSCE,754 +torch/include/ATen/ops/is_nonzero_ops.h,sha256=q7HrIyQgcf213C-a1rw2c3GOmWwndFhiMzf1PnZ-3c4,1237 +torch/include/ATen/ops/is_pinned.h,sha256=ol9aM_NSkMoaExCAXvvv3lxNNpt4bqvZ2GiGmDzymsc,792 +torch/include/ATen/ops/is_pinned_compositeexplicitautograd_dispatch.h,sha256=bAxxR3rTllAmkOiOCe2w6aM3zSeW5tn3kvcvF-tnqlc,1094 +torch/include/ATen/ops/is_pinned_native.h,sha256=oDCY-J0wO_FI4YXLxmu6aOAKibDKAykL-eTpPpYYqaM,1039 +torch/include/ATen/ops/is_pinned_ops.h,sha256=byeT4gw6NhGiMdWhgcwNwjIkZGT3WZMscXnNK-rMsyc,1356 +torch/include/ATen/ops/is_same_size.h,sha256=btQCY1q0X4kp8YV4FkFg4UaUZqIseXGzuEuMmd7eY88,990 +torch/include/ATen/ops/is_same_size_compositeexplicitautograd_dispatch.h,sha256=bvtWQNvjOCjWXAPwn942l1tN2_cVWrBtDHYOQaYItZo,1072 +torch/include/ATen/ops/is_same_size_native.h,sha256=onv_jdl3go1xBE3ecJgvrTWpYdKxaNxzX1EMlJaXjuw,870 +torch/include/ATen/ops/is_same_size_ops.h,sha256=-U7I1H2Xg0oGUIg7z3r5-4zn8-QbcmTIouk-z9Yfuak,1329 +torch/include/ATen/ops/is_set_to.h,sha256=L7iWn0pt8ogLzqz97nR5RBN6Ew8emwrT1kzXev9BgBU,792 +torch/include/ATen/ops/is_set_to_cpu_dispatch.h,sha256=bQBlxTibUmtOiMzJ11vJK4QjF9w6xH4Z4o4KTCKW3UA,1026 +torch/include/ATen/ops/is_set_to_cuda_dispatch.h,sha256=rR8FffcZrtCGoFLql2o6RqoY7xRTs90pg8B0A31dLyo,1028 +torch/include/ATen/ops/is_set_to_native.h,sha256=LN02GJYFcBzXztvWuCmF_IGhiaCGcZbFlPCmpY0q9-4,780 +torch/include/ATen/ops/is_set_to_ops.h,sha256=4mxDY1f1ZEUZx2HlKJWwb7D5pxnlVbRx04QHBkDOhoA,1323 +torch/include/ATen/ops/is_signed.h,sha256=D1xclFy5nGsih7WPxBLu-g_VloJW4Pj7ahd2wW2O5gM,942 +torch/include/ATen/ops/is_signed_compositeimplicitautograd_dispatch.h,sha256=qT0GVq8SSQ08lrAYB406Qk1XA_ikVCo80oNnqQlPVow,1043 +torch/include/ATen/ops/is_signed_native.h,sha256=trGZzSzEc_LHFCJQT1VUX-a_gCOKVnrmgOaCGD-C0Uc,753 +torch/include/ATen/ops/is_signed_ops.h,sha256=qbfokrbuvQAu3nIYqUw4ESuB7f5EWynwRSaVHW8OBYU,1234 +torch/include/ATen/ops/is_vulkan_available.h,sha256=wxH9LuCFB4ozgJqHMFxWgTrcaeT0d5dX1M2YS2E9XWc,933 +torch/include/ATen/ops/is_vulkan_available_compositeimplicitautograd_dispatch.h,sha256=Qd244vitnoDz3HSls8HALFq-juetyRwY1sBqNSr7IJk,1030 +torch/include/ATen/ops/is_vulkan_available_native.h,sha256=_Znv86lqat2bOvydGZHJvfqGY-LVvc1h7HbWlZiJYSk,740 +torch/include/ATen/ops/is_vulkan_available_ops.h,sha256=WQlhMagavRIVZ2jnqeDvtlLQyhAD3lH3OSFN5Fpp15U,1187 +torch/include/ATen/ops/isclose.h,sha256=cPXPKlQOlOqcb1v5y7QiosuOWQiOnjLv_Jc-QVl-tfs,1119 +torch/include/ATen/ops/isclose_compositeimplicitautograd_dispatch.h,sha256=gyjqqP5QFjzWLmk67xGuST607AA40HpJcfm765Gf3_o,1133 +torch/include/ATen/ops/isclose_native.h,sha256=gdRAeh6_pgbznofkgm3pOyXmi7QulhebUfKwxbK76Kg,843 +torch/include/ATen/ops/isclose_ops.h,sha256=8yWTF8QdaRDr9HqNrnBAPQYPnoJzBU9TRxWs2cMtLSM,1498 +torch/include/ATen/ops/isfinite.h,sha256=Wb8YzsorinspbsTTxyEG_Q-6uKnOW-YD7hYsx7f98fI,935 +torch/include/ATen/ops/isfinite_compositeimplicitautograd_dispatch.h,sha256=-8yOFntE0l12kBcg4k8wPwvolSx29XN9VjIg9kJ3_GE,1048 +torch/include/ATen/ops/isfinite_native.h,sha256=OfvbbVdSJB_i_oDm0zkPdv99RIjY8BalBH8hXy4TyuA,758 +torch/include/ATen/ops/isfinite_ops.h,sha256=t7vXyNB7LOmEk7_PaG-9ZT47QkAyJV2OQs6eaFPeywM,1251 +torch/include/ATen/ops/isin.h,sha256=nGA8i2pyM_IhdO-W09MrljQohdAHCmO6A6Tju6VzgMA,4319 +torch/include/ATen/ops/isin_compositeexplicitautogradnonfunctional_dispatch.h,sha256=wvfWWWAgSSk4QMxKw8Z7H29aBevIclonQjFWECgn20A,1423 +torch/include/ATen/ops/isin_cpu_dispatch.h,sha256=2SP8pOXB2cEitg9fgT0kzJDDhdcMNgCeE0NNC59-qsk,2276 +torch/include/ATen/ops/isin_cuda_dispatch.h,sha256=DO3pEF84HsTPEBSeUP9xY-y5eV3hw2KPMjrBXrs5ycc,2278 +torch/include/ATen/ops/isin_meta.h,sha256=-HssSouz86krnxkAEkSLlht3Mp8305mV46XD3bT44W8,1330 +torch/include/ATen/ops/isin_meta_dispatch.h,sha256=Z3jg-j2-r0MQHK-KfqWj8-0Te1vnWM2pB_MB2LhQl3g,2278 +torch/include/ATen/ops/isin_native.h,sha256=lVI-PAiFvY3fZTgfoWbb-u2orQV1EMaIXnmTNeobu-8,1447 +torch/include/ATen/ops/isin_ops.h,sha256=T5Q7RYIB2GKdDqkEy0IEShWQZuqDoVU_cLiW1r3Qn30,5750 +torch/include/ATen/ops/isinf.h,sha256=M0qzsvDDrTKXUzWsfxcOG9w01tdApZPk3CY_X_oxTS0,1316 +torch/include/ATen/ops/isinf_compositeexplicitautograd_dispatch.h,sha256=wlfThjGWS3UrANEbH_8qj24kwwR0Z6H0nUjScKGrOvI,1202 +torch/include/ATen/ops/isinf_native.h,sha256=N1J1p_7rm4YwHEYEueOX9DzIQj9d6-LNg7-6uOlNN7A,1092 +torch/include/ATen/ops/isinf_ops.h,sha256=F3LQp46KZLQtvPhhhCnV5Jp2gAiByR-sz-ec915mKFA,1840 +torch/include/ATen/ops/isnan.h,sha256=rzWVG7AEWnbjv1Qs52V41e1gvz4V58iowwGL0Hmvoz8,1316 +torch/include/ATen/ops/isnan_compositeexplicitautograd_dispatch.h,sha256=UpJh1yrnhuXpMQuUDToFQ1PcgumKTaAF5UCabMSTAfs,1148 +torch/include/ATen/ops/isnan_cpu_dispatch.h,sha256=aV8-k_qphma5qN53Eq00JfUOAFPQ6kFTEfiuXb2FRu8,1001 +torch/include/ATen/ops/isnan_cuda_dispatch.h,sha256=h1cl6oUkMMyFefRRKmYaN-pNkJw5JHIZguoXarGNkzQ,1003 +torch/include/ATen/ops/isnan_native.h,sha256=RY4fQXY1ng-g4WVTOF-_oq_YhGJWKuKkBskIhofuKn4,1026 +torch/include/ATen/ops/isnan_ops.h,sha256=gGCVhiuZ0XNqJk2Kgz3xwnR7ohT_XeFGEId3jNAsFSI,1840 +torch/include/ATen/ops/isneginf.h,sha256=L_NLPOCrOsu0bmxVTeCKWuEybRtiOSnhDLtEcZK7244,1346 +torch/include/ATen/ops/isneginf_compositeexplicitautogradnonfunctional_dispatch.h,sha256=DoqjddpomHHYIIKNguWUTK3lZK_L9QXxqdf9N42S4rc,1074 +torch/include/ATen/ops/isneginf_cpu_dispatch.h,sha256=iKVfJSQ_aFWo3wQmrHYNzYQcEb0XMIx8-ot_3ubvRXg,1167 +torch/include/ATen/ops/isneginf_cuda_dispatch.h,sha256=YXp_1nfKDSPFDKHXviQ3ANPcua07aY3hU3K9F-X_TvE,1169 +torch/include/ATen/ops/isneginf_meta.h,sha256=-0O7S5NEfMVVl3qsn5QUn0SAmQz_PtVwH7tMUeuTuwc,855 +torch/include/ATen/ops/isneginf_meta_dispatch.h,sha256=cAXr1vGUtQHYGNMkqtw-7-0oUvwMO4_woWoqGqfocdQ,1169 +torch/include/ATen/ops/isneginf_native.h,sha256=w8Bt2YSkayrIpMd3lVYhzY3Hi7Agfm2w5ruDBUel3kA,1266 +torch/include/ATen/ops/isneginf_ops.h,sha256=rPge8p61GUlvuiwd-e7BvtVY6F3ezYdaP_ixSwhl7Wk,1858 +torch/include/ATen/ops/isposinf.h,sha256=lTYY4oQlVBV5GKtMIJbiHo7f4opihdLY4cyIZzGEZX8,1346 +torch/include/ATen/ops/isposinf_compositeexplicitautogradnonfunctional_dispatch.h,sha256=xXPX1wflDv4SrznIgWA01jEzeFv6oQgjm4cFCluoE0Y,1074 +torch/include/ATen/ops/isposinf_cpu_dispatch.h,sha256=SBzDEVOXijdnI2OdPNorX25oXnMMPcJng1V7KZwJCkI,1167 +torch/include/ATen/ops/isposinf_cuda_dispatch.h,sha256=9szU7E4S6KxiPatLJsk-trKzjJE0tUMSAsSlfOiR_3c,1169 +torch/include/ATen/ops/isposinf_meta.h,sha256=58PDEiZqMdQ4xZx-ksQQYyZ6sFA3T7W4VDKXljzQX14,855 +torch/include/ATen/ops/isposinf_meta_dispatch.h,sha256=_VvrrRTvJMJNRGzgri0KmWco5vShyZFhEjXTaT-c06U,1169 +torch/include/ATen/ops/isposinf_native.h,sha256=Yt4PIO6P0yDg-GrESBjN3EnlEERjFPNDEGK9JghXjBA,1266 +torch/include/ATen/ops/isposinf_ops.h,sha256=xnG_BFrl_e4LfzMPSX0F49D5ohSsc4QThzfboa_O2t8,1858 +torch/include/ATen/ops/isreal.h,sha256=HKDdb5VpeJ5J2-iIucZVWBoHPfxFHrPncT6YX5h06Cc,927 +torch/include/ATen/ops/isreal_compositeimplicitautograd_dispatch.h,sha256=_pKGkreEdh091unj90RfbjfB-1vBzem5NDPTrwzgbM4,1046 +torch/include/ATen/ops/isreal_native.h,sha256=inaKZkethdCq-H6TXdKXeUnzb6bC3qgqKXAdP2EMnns,756 +torch/include/ATen/ops/isreal_ops.h,sha256=a_kBLyXKPDf5wNKiV3UONUNJrK_TM-ptD6n41kRYkqk,1245 +torch/include/ATen/ops/istft.h,sha256=Tdk9qU8Ydpu8STSobHnVKJjwNP2GDZZrlSXNMyk2cmc,1528 +torch/include/ATen/ops/istft_compositeimplicitautograd_dispatch.h,sha256=jJ8sKhFFeMy9c8W694SsevB3lw6nEBRDXfo6aoBfBIs,1374 +torch/include/ATen/ops/istft_native.h,sha256=wHqdICa9yiGw3ojkNLUgmTIsFUbOn_2gDAcDYHfu5BE,1084 +torch/include/ATen/ops/istft_ops.h,sha256=w2TwXfPVb9epguvKPZQA4RCX1qAIwjZ5c7czhzYQ9Vs,2088 +torch/include/ATen/ops/item.h,sha256=XOBgswcPe2opJlIPf3uIgSYNKuiVNGSr-oEvesLQzio,787 +torch/include/ATen/ops/item_compositeimplicitautograd_dispatch.h,sha256=WQhQou02udOHCAg4cQsBn9yxwoh4B8uYeGeBvhFC_yk,1044 +torch/include/ATen/ops/item_native.h,sha256=HEx0vIN6R-bvAPjoH5PGhGvRC0Ow1FI9fcDyYaU25ls,754 +torch/include/ATen/ops/item_ops.h,sha256=u6J0GT0R3wRAItzgjFm9CoR3UDqaa0LwUF0tSt8QoxY,1239 +torch/include/ATen/ops/kaiser_window.h,sha256=5WOfpA6mvVZFVEs9SChQL920sg-hnSvyaC50mBBgbXU,5343 +torch/include/ATen/ops/kaiser_window_compositeexplicitautograd_dispatch.h,sha256=oQJaIMCSbQm6pUAXLg2rYoN2BcmOoDBv08tbYAbcrPg,2555 +torch/include/ATen/ops/kaiser_window_native.h,sha256=ENN32h4IHS1I4mbuRtHVDL76_MwJSthCwl2d1LdHs_U,1704 +torch/include/ATen/ops/kaiser_window_ops.h,sha256=55Btk7HyKBlDNXyAJCyeW-tOIyx4KIXpEYSIplNLCRA,6008 +torch/include/ATen/ops/kl_div.h,sha256=TeAk3fY1t6fU6p6inEXq5mJeul5tWBePQ_h2BRAlzLs,1108 +torch/include/ATen/ops/kl_div_compositeimplicitautograd_dispatch.h,sha256=aoTQeVoUiWryjwOm35f0HIG4_KIKyMGObdWBxsI2H84,1135 +torch/include/ATen/ops/kl_div_native.h,sha256=kYuOtW4HhFAMxZZnuysFlP8l6_4sTQr5MPdIObITHQw,845 +torch/include/ATen/ops/kl_div_ops.h,sha256=sz1CksdxVBRNY6fp-4B_OMArl8Dd2DIVDKgljm3oVwc,1467 +torch/include/ATen/ops/kron.h,sha256=8wUXdIOc3_wZM7W-poWTmL6rGs9VNeucC2ss_X6H0Kw,1447 +torch/include/ATen/ops/kron_compositeimplicitautograd_dispatch.h,sha256=kluzq1SuD_Odp-Cp3iivNnnho8nIlMCLG2gN4Qphrjk,1277 +torch/include/ATen/ops/kron_native.h,sha256=vntBrtMYd6mL6WJ20ToeEIcPf9i8CMtQMQcpn2Sty3Y,883 +torch/include/ATen/ops/kron_ops.h,sha256=Q59LXod-464RMsedkbXsecXdYKDyReI4cjmwjPpUjSk,2006 +torch/include/ATen/ops/kthvalue.h,sha256=lKp0ooZ3ir2qrm1cAIF0JdZYtQCfG3BEPy6uauGzB2U,9773 +torch/include/ATen/ops/kthvalue_compositeexplicitautograd_dispatch.h,sha256=Ka16CSMlKocItDVW1NtpfSANu0awI7egAi8lJpopans,1260 +torch/include/ATen/ops/kthvalue_compositeimplicitautograd_dispatch.h,sha256=hfGP-94S1AgWQmqGy0z6wSIEOb8xzm8gxmt8XVuIPKs,1998 +torch/include/ATen/ops/kthvalue_cpu_dispatch.h,sha256=AXJkwwYWyP226WsRsGvfX7xMfdZjM5NYfUzPu_iCq7U,1673 +torch/include/ATen/ops/kthvalue_cuda_dispatch.h,sha256=6-2Xxmm4hk_JSNyhi-LVWDmP7CxtLR-jnWW8tlZyTyo,1675 +torch/include/ATen/ops/kthvalue_native.h,sha256=qIGbnGT5K-rauePABh8EtmJqKUBdYqQ1JaL0c3MqqP8,1486 +torch/include/ATen/ops/kthvalue_ops.h,sha256=ybeGjth1WXxN7jHlpmzZ9Ng-52Ttemgw4g6f9P2P-mU,4274 +torch/include/ATen/ops/l1_loss.h,sha256=hhfc6OUVPtoK4DY0fvr3LG0fej22NtDRd2kwfcpN33g,1051 +torch/include/ATen/ops/l1_loss_compositeimplicitautograd_dispatch.h,sha256=6wZAyLqiPxYPTc1yU16ePfKUwH3kLAtkFDDL44gWM1o,1113 +torch/include/ATen/ops/l1_loss_native.h,sha256=bq9UjMF23z7NsvJTIeVBnRlV5dneowNMqmhZhSf8ZI0,823 +torch/include/ATen/ops/l1_loss_ops.h,sha256=N4-8m-GewZ2ISjkDIK3pEXWdcbne4totv7HFkI-Ao8A,1404 +torch/include/ATen/ops/layer_norm.h,sha256=h_xSwLkrFhl8Sys3cL7C-3icZZtvt3-GatYD9cXztnU,2684 +torch/include/ATen/ops/layer_norm_compositeimplicitautograd_dispatch.h,sha256=pTqj9jpZkcfBolI-2lXFVs2hhsemP-b1kbahB_wRoeQ,1458 +torch/include/ATen/ops/layer_norm_native.h,sha256=YNqW39k2tq3E4kQOrtAOojKefPm_ZidciF61qUNRvG4,940 +torch/include/ATen/ops/layer_norm_ops.h,sha256=2inw0RfErAUFRK7_ywUH-a7QjD08qfi_ogaHXPAPBzE,1787 +torch/include/ATen/ops/lcm.h,sha256=Gnkl0vznyqfQrQC9to61xODlm_hioqOaJnu7cBT5TXc,1622 +torch/include/ATen/ops/lcm_compositeexplicitautogradnonfunctional_dispatch.h,sha256=V8ggo0FwY9-f8Ufbw4KJlGdkylEY1OmEe3ruFNxQIKg,1170 +torch/include/ATen/ops/lcm_cpu_dispatch.h,sha256=7MRnwBI6w1lIBtVwN2DqI2zyqCdjqPXaTYcbm-fXLiY,1305 +torch/include/ATen/ops/lcm_cuda_dispatch.h,sha256=tKJegg5AR3-lLTMZaPPF-DIAzKS9ckS9u-hMxBOdclc,1307 +torch/include/ATen/ops/lcm_meta.h,sha256=D5DdBlScVEVy5f72Y9z4iXELadudlpF4Eoxkukl1_s8,876 +torch/include/ATen/ops/lcm_meta_dispatch.h,sha256=43TasUj1Mp5CVZ7tDvy620m7DgHT3yQDYYYomndo5MA,1307 +torch/include/ATen/ops/lcm_native.h,sha256=EjcXdM8tGhUZEaUuOogT6rY07Z9OlvIejX6dAFWjx1U,895 +torch/include/ATen/ops/lcm_ops.h,sha256=fWX7qBlIZT-JTRPoBNBTDyWy3ymiQb3JnYWmc1eWeWk,2587 +torch/include/ATen/ops/ldexp.h,sha256=CUAia71xjjkOq6JyZ_N-OEHatk9ZSL2KIkj5PQd4GUM,1662 +torch/include/ATen/ops/ldexp_compositeimplicitautograd_dispatch.h,sha256=xQcsaXYy5L1z2eItR6J8Hprn-lIjj92slYkOccrwEO8,1357 +torch/include/ATen/ops/ldexp_native.h,sha256=QvtFyL_2pjJsL2ncbHZ0t7xM_YciM7bmhsEDQfxF_OA,962 +torch/include/ATen/ops/ldexp_ops.h,sha256=ay3llOneocrWuyxKgh_z39CQWnKXfLKUNUFfQnl-igg,2625 +torch/include/ATen/ops/le.h,sha256=wROFr3zPEbRMXv22wAKhfOyqeJk51K2mQH8kayl1TFY,2155 +torch/include/ATen/ops/le_compositeexplicitautogradnonfunctional_dispatch.h,sha256=0y3I_uzoXsuouQT_mP_8PTMi_ZVJM6HuTxVEf8sT25A,1319 +torch/include/ATen/ops/le_cpu_dispatch.h,sha256=5Dz0bPQNRMoqqctkVOTZzf6aryJCptUOK_bBMk__ZDc,1655 +torch/include/ATen/ops/le_cuda_dispatch.h,sha256=OT6_dNu283nltNVKc-YHOC5HiXe28R39geEznAwTh8c,1657 +torch/include/ATen/ops/le_meta.h,sha256=2wyDnuueuxAkoMrjOvgnqqdZ5L3ayF_2FTG-dE9hr6Q,1026 +torch/include/ATen/ops/le_meta_dispatch.h,sha256=GwilZ8O2ceThpxJllg5fH21p1bhn7bfgexbxOtqitRI,1657 +torch/include/ATen/ops/le_native.h,sha256=Itn1AwzXyKpudzMtFFqNRwbnfYu0l1KACbA8OROyK-Q,1494 +torch/include/ATen/ops/le_ops.h,sha256=jwKp4M2zpkToSITTwC3JnUqVA_Y-6hMrTInd8-AeS98,4544 +torch/include/ATen/ops/leaky_relu.h,sha256=eCz-houmL2Xo5c6kpwCEZmRxC1EH2xNg4S3jkGcy_tk,1856 +torch/include/ATen/ops/leaky_relu_backward.h,sha256=Qf7ynFSZVB9lKNrSJEF2Z2zz0GxHtM0qnaq9C6JpKLI,2117 +torch/include/ATen/ops/leaky_relu_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=ao8qvU23H2SMi8ESYloUJU8O0YLKO7F_pvtR7qg0v70,1173 +torch/include/ATen/ops/leaky_relu_backward_cpu_dispatch.h,sha256=qXWxBHz1EpXl1qlnAqzco-GSMqhZqDVw2XiGKa3kGK8,1478 +torch/include/ATen/ops/leaky_relu_backward_cuda_dispatch.h,sha256=-w1OcFxkyOIJ4h5BF6JbnixoJECuX6pYiuKsl_BujcI,1480 +torch/include/ATen/ops/leaky_relu_backward_meta.h,sha256=1wugoU-Hv7a3b6HV6PJKweMsq6tKxFPVanlaA4Qmves,954 +torch/include/ATen/ops/leaky_relu_backward_meta_dispatch.h,sha256=u1Nusk5ybdrsZqknNd7jMsGhkcF86ewD1Y43FJtG604,1480 +torch/include/ATen/ops/leaky_relu_backward_native.h,sha256=46QhnPrcJbYxPH600b-ZJWRvQdm0oMwAlzeYogXLRE8,1012 +torch/include/ATen/ops/leaky_relu_backward_ops.h,sha256=5CGkXg53139qUdzFka75LkHnxr7zFVqFVAEA2GztDq4,2538 +torch/include/ATen/ops/leaky_relu_compositeexplicitautogradnonfunctional_dispatch.h,sha256=7PTZSGxYfTLgCO2iqB6HmNpqNZJyzB6WSJB5l7gQ2OQ,1212 +torch/include/ATen/ops/leaky_relu_cpu_dispatch.h,sha256=U5LGEtuG_hw-SjnVwYG7pxTqY0UkXPmyO67wpvzZ4JE,1384 +torch/include/ATen/ops/leaky_relu_cuda_dispatch.h,sha256=UDsXvVxKYeP_rAJF_MNXc0ANImFGZpsHRBZd96DCURI,1386 +torch/include/ATen/ops/leaky_relu_meta.h,sha256=mTmsPFgmVxMD8FGL84rFBOKCs_c19FrcCp-64uvowAI,892 +torch/include/ATen/ops/leaky_relu_meta_dispatch.h,sha256=PF16frCAyBkmgzDdlOeXmvUUU5Xd8fdm7znRe_ccDWs,1386 +torch/include/ATen/ops/leaky_relu_native.h,sha256=fGVygIVDNyRSkPvSce0p9x6Y5OgmYeAH1bsGdplSMko,1280 +torch/include/ATen/ops/leaky_relu_ops.h,sha256=KXSFu2dB99LVOmF9uWVtpEUYno5rHWyY87hn4MCb8dQ,2746 +torch/include/ATen/ops/lerp.h,sha256=3ebelryGX6Aztxef8Vo23KWfaG47huUwEUTyfUJi5AU,2457 +torch/include/ATen/ops/lerp_compositeexplicitautogradnonfunctional_dispatch.h,sha256=h7BRacSbUERWCWkKfB8JKNBRBRXDPXZVRJ8dmg7AuFM,1427 +torch/include/ATen/ops/lerp_cpu_dispatch.h,sha256=q9Tn8w26Sw7edjmPxNvD2xBvPoqZJlTa2A63gR-KpYM,1871 +torch/include/ATen/ops/lerp_cuda_dispatch.h,sha256=VIj9ufN1sX6LQwCSNSWAq6N_GCVpcZj1Xr0f5mM9G_4,1873 +torch/include/ATen/ops/lerp_meta.h,sha256=jKAZePXQs4HsdYkcbDHMzwr0MhOXatBL4PkbfnaniXw,1080 +torch/include/ATen/ops/lerp_meta_dispatch.h,sha256=7nc1HHJ1-RWfKLjCH6IaBjli413t_pP0BNhz4dJrOrw,1873 +torch/include/ATen/ops/lerp_native.h,sha256=XcS_9CZhPxSEzj1bNORPBKD_y2ha_6nEgEgZzwD4SD4,1134 +torch/include/ATen/ops/lerp_ops.h,sha256=Jxb00ToxrOJBGzPB2yjlQUo2vmGQwzitDjqg7L-rDnw,5078 +torch/include/ATen/ops/less.h,sha256=CcGullakkjg-Muudicpr-saxCC73yCxAG5Mlq3Li2iU,2193 +torch/include/ATen/ops/less_compositeimplicitautograd_dispatch.h,sha256=s1ES-rTi3VjNY5TQEk_pQ_pNn_JbNorqrQYmc9ODg1I,1715 +torch/include/ATen/ops/less_equal.h,sha256=Y4Pn09q2gnnzGkI8sJSHYOET_OwqeAkhAwj8ZYjwyTY,2307 +torch/include/ATen/ops/less_equal_compositeimplicitautograd_dispatch.h,sha256=-MLho2rsobvDyT8LXD9pn1iTBK0W6ZYRd71w3rMvMfw,1763 +torch/include/ATen/ops/less_equal_native.h,sha256=gXCrEucEUsSuneW5SKb-AIECJrAOrQWx3YZRzJkdjnM,1253 +torch/include/ATen/ops/less_equal_ops.h,sha256=Mgf5hU9N-rOAgaOsMOIBzscAZwWov5D491ywJ9RlgGE,4688 +torch/include/ATen/ops/less_native.h,sha256=LCrPTxjNsP4KsWw-4or5lYOCVOvxpbgrrQyoRklewKY,1217 +torch/include/ATen/ops/less_ops.h,sha256=amYSsbYMTNaoqWjqnnnMpMO--cAo1yOJs0y4vGUbqp0,4580 +torch/include/ATen/ops/lgamma.h,sha256=xaZZxMvoqYj3n9iFBr4u_ieLLHn5PaECgxMdRUa2zl8,1326 +torch/include/ATen/ops/lgamma_compositeexplicitautogradnonfunctional_dispatch.h,sha256=bbhhzUIY-Z-m850QGk_Y_V6UdlxwyAJcFjcD1NuLaYA,1124 +torch/include/ATen/ops/lgamma_cpu_dispatch.h,sha256=tTKFLuxcY45ps_1rsgmxnpRiN3A5FtRNTiLphYIPbyY,1213 +torch/include/ATen/ops/lgamma_cuda_dispatch.h,sha256=-dfMHmK9InDOyqgBlIJiOptlT5JxYp__nNTfhyDZ9vw,1215 +torch/include/ATen/ops/lgamma_meta.h,sha256=DWJcVwIMTkT_fTrbFk6dZocIq0BBGdxwyWtWzVlWb0A,853 +torch/include/ATen/ops/lgamma_meta_dispatch.h,sha256=DNSjcmnrTtFAmghni-cVLLjodWgBNTrNPH8eAXBdGYs,1215 +torch/include/ATen/ops/lgamma_native.h,sha256=cyuwjoBurwO4Ys3HgUmwA4Wr_3fVwk0crUlNKuY344Y,878 +torch/include/ATen/ops/lgamma_ops.h,sha256=RKv331xPzGhlaca8imBpALdFBYMlb3kcUbcMKGXRgBs,2356 +torch/include/ATen/ops/lift.h,sha256=ZF5U4FLmTSNxn8nprZHGmilKrTKA0P-bbjDAUICOcvY,1306 +torch/include/ATen/ops/lift_compositeexplicitautograd_dispatch.h,sha256=EMN46YlHDKV2WKn9SxbhNYro5IWY2sSzS9HlgW4AXhM,1199 +torch/include/ATen/ops/lift_fresh.h,sha256=bMX1Y_wWXVLpV8qSLhV3JtDuMEbvMJUi-YW4bLqo9Xk,949 +torch/include/ATen/ops/lift_fresh_compositeexplicitautograd_dispatch.h,sha256=teTdLtqpV2QB4IlhFXCYLF8KSaWW7mPwJFvZKpZVMB8,1050 +torch/include/ATen/ops/lift_fresh_copy.h,sha256=6wNwXf_PDp6xDVTFvyyWWWRRfk-92q_ARUvNd9APJNs,1416 +torch/include/ATen/ops/lift_fresh_copy_compositeexplicitautograd_dispatch.h,sha256=JEu0aa1ou8ZfyLQ5nEmP53eWz9nHCN49t1XzpJpdtFQ,1168 +torch/include/ATen/ops/lift_fresh_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=-sZT_hgDKqaDmlMD5-EwIh6Y6d2IWG4-gcCruS79rwQ,1081 +torch/include/ATen/ops/lift_fresh_copy_native.h,sha256=kU-8eCh3lua_atjThC51hQY1Ix6odDqQWdquvmMuBRI,853 +torch/include/ATen/ops/lift_fresh_copy_ops.h,sha256=GiT2c6zcgRWFww633lzC2OXhO8nY3Daf2igiYSIQILM,1900 +torch/include/ATen/ops/lift_fresh_native.h,sha256=xf152-ScY9MNvgXleCu061P9b_mmPrLP2C3tL32KyRE,760 +torch/include/ATen/ops/lift_fresh_ops.h,sha256=hpEira2QwgfPLZT2yLnW3vLWSt2pZj5XIPeo28IXclY,1263 +torch/include/ATen/ops/lift_native.h,sha256=DFScBJ4M7ZKMYKJiTCPCYL5dCVUcw6DkHkbCUXCVOzg,831 +torch/include/ATen/ops/lift_ops.h,sha256=VfAAjfxulpgQtNzgEyZbIVDrHueM1DZ3x15kk9yGSPw,1834 +torch/include/ATen/ops/linalg_cholesky.h,sha256=TWu2W49bcN4KQG4UnelpyRoLrIFfTfwvHtoKh1BGFZM,1542 +torch/include/ATen/ops/linalg_cholesky_compositeimplicitautograd_dispatch.h,sha256=cZXHRK7dDPOoXBzSFfGQvgmxAyGVhxgFGJgXMjwnnIk,1280 +torch/include/ATen/ops/linalg_cholesky_ex.h,sha256=tRv2MjmMno-Tzrxic-9SWLkTOlWH3lucJTz4ukMXqOA,1960 +torch/include/ATen/ops/linalg_cholesky_ex_compositeexplicitautogradnonfunctional_dispatch.h,sha256=wdzL1wki4TTCHGiXGDyHe7ziZ2sXsEqFG-P3l_EUH0o,1152 +torch/include/ATen/ops/linalg_cholesky_ex_cpu_dispatch.h,sha256=Ngq_r6-Hn4_N0HiZsQy_nvR_XLOc-jARerVXMN8kEJQ,1427 +torch/include/ATen/ops/linalg_cholesky_ex_cuda_dispatch.h,sha256=lODxIy83mbiJnZx3A8rwfMgJPxeG4-LI4KrodzOJZp4,1429 +torch/include/ATen/ops/linalg_cholesky_ex_meta.h,sha256=7I6rUXdGB_cSM7orVSUqIW8SxwIJ_vu2zBzJMnjlKiA,896 +torch/include/ATen/ops/linalg_cholesky_ex_meta_dispatch.h,sha256=9a6snenMW8msohNcycngI4VwIjJbtLkugYEm7iy2_4U,1429 +torch/include/ATen/ops/linalg_cholesky_ex_native.h,sha256=dOu5u24ceDB8XzKmCYy-Ob4gJCxxBRii8npEirAcmaA,968 +torch/include/ATen/ops/linalg_cholesky_ex_ops.h,sha256=Xwx25NKi8_I--fh5gmhIqb_gQcqu1hy4yPvqsx1xqi8,2406 +torch/include/ATen/ops/linalg_cholesky_native.h,sha256=2ABUZbf5xRQl8IDmUDGvcm0ueBkeu094BEhKtOwZmbI,883 +torch/include/ATen/ops/linalg_cholesky_ops.h,sha256=pQ42wTVk91Yn17aFRqjoAbd8QNchUjvOdgsM2UvHOpM,1999 +torch/include/ATen/ops/linalg_cond.h,sha256=XX4R9M3pNRUSdpS2BFSBwQEM6mlR-hKCV81q3beAyr0,2290 +torch/include/ATen/ops/linalg_cond_compositeimplicitautograd_dispatch.h,sha256=Fg-xes-YoGswHPoBj0HxSkAFk0mF7g52ohfdLW9R6cw,1656 +torch/include/ATen/ops/linalg_cond_native.h,sha256=YFDTxd-TtRD9bIYRd2vwpTuXS1-1V9qQ8v3ahAowt1o,1122 +torch/include/ATen/ops/linalg_cond_ops.h,sha256=cjOyoLXGT7JvDzINqdiPuGq0UJzaL9v6hzs5Oq_XZJw,3445 +torch/include/ATen/ops/linalg_cross.h,sha256=x9VSsnnu_RUYXjoxCMTYSLs8YTGv6XtzmdoEsLw6nBE,1626 +torch/include/ATen/ops/linalg_cross_compositeexplicitautogradnonfunctional_dispatch.h,sha256=PS8BCQ46JnK8J9i4dFcTmXaFn1zx6ifPH-wMSqeQDVQ,1120 +torch/include/ATen/ops/linalg_cross_cpu_dispatch.h,sha256=Y5Wj8LWC4ab6Dgp3kyeEw-IbGEaUoRl6qi3yqBCAkFY,1302 +torch/include/ATen/ops/linalg_cross_cuda_dispatch.h,sha256=emUTzTPy0jbQSW_E0R7D6PZWWCa8AY9rRqXRZCVDZTk,1304 +torch/include/ATen/ops/linalg_cross_meta.h,sha256=R3gTSzqgTGwFyG3vUQPT-rIcLwp4t_JpGfPtF4Th118,898 +torch/include/ATen/ops/linalg_cross_meta_dispatch.h,sha256=l4lnevjVsQYnY1SYciYVIWv_la-S7EhFdJ2_LWq4jVE,1304 +torch/include/ATen/ops/linalg_cross_native.h,sha256=L-gYc-0QQ6FSNmforluNUXuxozejF9wzdvWHOwCkbME,1049 +torch/include/ATen/ops/linalg_cross_ops.h,sha256=XYLhGkO-zK9ZA1zo6M6FkWNDtwVcTjFA_PSU8f4a5XY,2151 +torch/include/ATen/ops/linalg_det.h,sha256=8nnv-yx9lMdt_RGaASs2IIg5bqcFDhjmdGrdSYqMWC4,1339 +torch/include/ATen/ops/linalg_det_compositeimplicitautograd_dispatch.h,sha256=iraj_Q-_YZTxX2_Njnh34jwy8PPyQqMRAWoH1al8Zw0,1208 +torch/include/ATen/ops/linalg_det_native.h,sha256=slhze_uzVq_ftL6MQS5825QLgjSy-3ns-yZLfXxFrK8,837 +torch/include/ATen/ops/linalg_det_ops.h,sha256=2aQprS2NLMaTJ4L5Zm39cDZRwSXem2J9IWux1Hbwmzk,1852 +torch/include/ATen/ops/linalg_diagonal.h,sha256=Y6iOThvCFV3ZftjPhWbuL-3OyPyEqG0U151NReoxT9U,1075 +torch/include/ATen/ops/linalg_diagonal_compositeimplicitautograd_dispatch.h,sha256=JLkkcFVUMLe8AG_YCkVqhP2QHSWSlwuoENDC5QgTo1A,1104 +torch/include/ATen/ops/linalg_diagonal_native.h,sha256=avzo3gLes92fgnldenTcXFoKm6-V5wmbZeZoKFzTy3A,814 +torch/include/ATen/ops/linalg_diagonal_ops.h,sha256=QwLth7Jz0kYDfsQds5ZGlr_XNmxAWin33zsPB2Rmr6M,1427 +torch/include/ATen/ops/linalg_eig.h,sha256=UhOnHhn4yd29C3KHliT78Tup2IY8EP49n6R37jHkVwU,1738 +torch/include/ATen/ops/linalg_eig_cpu_dispatch.h,sha256=XK7DX5SSq66Xu6ecUF2C5tOeh48x4nQQHnb5BJsaBEE,1322 +torch/include/ATen/ops/linalg_eig_cuda_dispatch.h,sha256=0Z0hnZKcLAXWOCMhx0Rl8wGUvkj7GoHN8PfIbcgysbI,1324 +torch/include/ATen/ops/linalg_eig_native.h,sha256=N3g9kuJvprEPn_1i0FLmNx7eZdMPgPXG2X_oMbla7q4,930 +torch/include/ATen/ops/linalg_eig_ops.h,sha256=BERJkZcu6D86SdKOzuIOtKPIOjjBxlXtrYMm0d0N2lM,2217 +torch/include/ATen/ops/linalg_eigh.h,sha256=sc62aw05FipgsnqA8fa-3I6M1u337oHyWe1eJH1xudg,1847 +torch/include/ATen/ops/linalg_eigh_compositeimplicitautograd_dispatch.h,sha256=wAH9clGKH3AlFQFr5__BEcAhUo9GvheljxBz_3lilYg,1428 +torch/include/ATen/ops/linalg_eigh_native.h,sha256=_-HYnTYZ0iaDMMM3U_iiKhpI6HF1cw0R8NBpu-k7gRo,973 +torch/include/ATen/ops/linalg_eigh_ops.h,sha256=Hf58Z0Sv6JIWjwHEz8qWaiQTAZ6-EOL0zYl0V1Y9n-s,2368 +torch/include/ATen/ops/linalg_eigvals.h,sha256=mE5Ky61ieO4oyR0zdZgzAIN3I7lSQByAIg0c64Q-pj0,1406 +torch/include/ATen/ops/linalg_eigvals_compositeimplicitautograd_dispatch.h,sha256=nrMgTGQKSlNSp6fJK2hWDfoULlU4H5PYbunUH0Wf7pg,1054 +torch/include/ATen/ops/linalg_eigvals_cpu_dispatch.h,sha256=QuOMDBysxhIpDZtEj38xsQwcyKEZHN4DjX5ugIzmSU0,1122 +torch/include/ATen/ops/linalg_eigvals_cuda_dispatch.h,sha256=GZ1FYbsB_JVa60VzGUdj8dlkhQkOfZVm6m9a5fY410Q,1124 +torch/include/ATen/ops/linalg_eigvals_native.h,sha256=x8Adn7hNicXywH9mX3UjdabxuxvqgbNNO-953KsG5UI,851 +torch/include/ATen/ops/linalg_eigvals_ops.h,sha256=2Ie7eCsHvBJTCBu2BcrM_MajxYdMPWTJtj1e2pC1LRY,1894 +torch/include/ATen/ops/linalg_eigvalsh.h,sha256=crqvyxGjNCPK4yx3KS2LlJ6YjSGA9eUeEeuwW3AYNS4,1553 +torch/include/ATen/ops/linalg_eigvalsh_compositeimplicitautograd_dispatch.h,sha256=R22BeeQC2H-vAlT0_FtPEtf-vt8ZFF1ge_B8wzCfalU,1309 +torch/include/ATen/ops/linalg_eigvalsh_native.h,sha256=gs2ob0tPRLol5aUVY2WTgNpPp_ZjeQ5VDmzdqmoWSU8,903 +torch/include/ATen/ops/linalg_eigvalsh_ops.h,sha256=Urr2AfCx5GCAJS8AR8hlq0HrXmCNQ1ow6Wl-j_YBGsY,2060 +torch/include/ATen/ops/linalg_householder_product.h,sha256=H62gLEzRt0Z6vd-FicKk-QSFGLIX5IaufyranA928rE,1658 +torch/include/ATen/ops/linalg_householder_product_cpu_dispatch.h,sha256=uEeaVeS4iadXIvrbsB52FZmpeBg5HCxZZuGc4nZyyL8,1296 +torch/include/ATen/ops/linalg_householder_product_cuda_dispatch.h,sha256=Gu1kJv-0m2wFrD-Zn8L8XWpiFVNFVikQPe-JoBOWsas,1298 +torch/include/ATen/ops/linalg_householder_product_native.h,sha256=n59poJfwzNTZalWe-SlurHcfNe7vyPEYQI3VQn16urc,925 +torch/include/ATen/ops/linalg_householder_product_ops.h,sha256=4mID40TttgTLXeOCEJvSdv5Ote2_NdD5qW-1fRH3yRA,2132 +torch/include/ATen/ops/linalg_inv.h,sha256=JbyAM1dQXf9I1jrO_fnP6M3FtZ3VAxPFwjzJz3luWjM,1339 +torch/include/ATen/ops/linalg_inv_compositeimplicitautograd_dispatch.h,sha256=Kp8b1ujC8g_5AORqz9tGvBhNvDkujtEdKqdNAQdUY1c,1208 +torch/include/ATen/ops/linalg_inv_ex.h,sha256=HL7cLsTiJ3TTjEDrl_twk4Q1WHJuWjhRTMvsIuPY3Hs,1838 +torch/include/ATen/ops/linalg_inv_ex_compositeexplicitautogradnonfunctional_dispatch.h,sha256=sMt4IoG40-xQhP4rmfNT5YoTBEKt6aCPLhjU_BgK1eA,1126 +torch/include/ATen/ops/linalg_inv_ex_cpu_dispatch.h,sha256=wxfF5bDxp6RLSby4sdSAfVM_tHj8Kh8qOWEMMq9umpo,1367 +torch/include/ATen/ops/linalg_inv_ex_cuda_dispatch.h,sha256=_5JuFpP50iwn6lHO_O1_x38qSt9blU25HZwucYAl6S8,1369 +torch/include/ATen/ops/linalg_inv_ex_meta.h,sha256=qUWNY63bZ9q33DTTHRrCAGWdfFyfhZ9CiayKgw0hnOI,876 +torch/include/ATen/ops/linalg_inv_ex_meta_dispatch.h,sha256=ACdv0ZpND_b1eagnYMekp7GwihhU1SfBdlO7kNUzat8,1369 +torch/include/ATen/ops/linalg_inv_ex_native.h,sha256=LiPGYulJWCSZkRN1EuZldf9cVeUz9ECs795fmamAeig,944 +torch/include/ATen/ops/linalg_inv_ex_ops.h,sha256=lFq6WvJPbe1yRawf3rOFu9Jiyv1eAof9MUKVtvO8Evw,2310 +torch/include/ATen/ops/linalg_inv_native.h,sha256=sWGbf393ZUFL-n5QG6_Ma0VM7nUQB-8qPV-EXnz2tSM,837 +torch/include/ATen/ops/linalg_inv_ops.h,sha256=m2ut24vaFN6x-bVEIaBolZ4MJ2Y0uIy1ECVaIIUhQNs,1852 +torch/include/ATen/ops/linalg_ldl_factor.h,sha256=lApfuwfz5isYaAUgd-32s8pwuKKeR03K8rx44sVMI-c,1835 +torch/include/ATen/ops/linalg_ldl_factor_compositeimplicitautograd_dispatch.h,sha256=gFbIXc9S-qgqnErp5cb6F94BmfAflvY5WiGFCn6LLyw,1417 +torch/include/ATen/ops/linalg_ldl_factor_ex.h,sha256=2sSDoAsifw2V0DO9_5p9eyKlBS3C7oxXk59MvEZLn4I,2219 +torch/include/ATen/ops/linalg_ldl_factor_ex_compositeexplicitautogradnonfunctional_dispatch.h,sha256=3itqNBJa_3ZtlwQ8iGXeihJtr5Vza6SaXWi6NrCg4L8,1169 +torch/include/ATen/ops/linalg_ldl_factor_ex_cpu_dispatch.h,sha256=4q2RPsM-y_585B20ofNVShzXEw0C1o-agnW8wQw7ASY,1526 +torch/include/ATen/ops/linalg_ldl_factor_ex_cuda_dispatch.h,sha256=KJ4unyiS_9HZCTgF1FYvIKV-V8EaRkvNL18pHBrqFZA,1528 +torch/include/ATen/ops/linalg_ldl_factor_ex_meta.h,sha256=qIl7sNZl2UzxC4lPy2hKh1E-WOjveXyIhzzg8AN9WvQ,902 +torch/include/ATen/ops/linalg_ldl_factor_ex_meta_dispatch.h,sha256=H8Yv9Kc-_RcpGx-aW9Gv2aE2UrLDkayAfKl4XkCLxkQ,1528 +torch/include/ATen/ops/linalg_ldl_factor_ex_native.h,sha256=sgXh08ke07M3Amz3YYnntZGLVwG8RqTgh2P_P100O38,1006 +torch/include/ATen/ops/linalg_ldl_factor_ex_ops.h,sha256=lEyRjEQ0KXFgY3HTNxtqoigyoLueXKlb3G5xiKkaG_M,2634 +torch/include/ATen/ops/linalg_ldl_factor_native.h,sha256=3MpMrtF2rKurQaLNll6AiuhbCKcUYfLUt9x_8uQdxUw,967 +torch/include/ATen/ops/linalg_ldl_factor_ops.h,sha256=IEt17tQBOPfzNiTrxwSrZt7DRYqpw7TncjHnzDFjdpo,2307 +torch/include/ATen/ops/linalg_ldl_solve.h,sha256=ON3A1b8zWJOiyQq3vNPHtL5oBPaUL_NK07gUW5019OU,1825 +torch/include/ATen/ops/linalg_ldl_solve_compositeexplicitautogradnonfunctional_dispatch.h,sha256=sn6LQvATxiF7OA1KSopVlcqd3dJP9C2f87xn5d4eHOg,1151 +torch/include/ATen/ops/linalg_ldl_solve_cpu_dispatch.h,sha256=mdfCiwJk05_VqLq_eFbglb-q-uNiZIdyvMhTowVHc80,1392 +torch/include/ATen/ops/linalg_ldl_solve_cuda_dispatch.h,sha256=rRqpzQUeUCQPgK5W26Bw3PPRCInqk2RvrdBeqdTNJ_I,1394 +torch/include/ATen/ops/linalg_ldl_solve_meta.h,sha256=rEjMExs9pryzhes-YNmxHBJqJlnp04dOePveJeGUYRg,926 +torch/include/ATen/ops/linalg_ldl_solve_meta_dispatch.h,sha256=aUV8k4NnJL0ZzN770vSHyW-tjw4r7aGXEjmW3ovg32s,1394 +torch/include/ATen/ops/linalg_ldl_solve_native.h,sha256=CFVJ1Ndjyf20MlmDL2Egr0M6GhvB383YoZZNcXlUREA,971 +torch/include/ATen/ops/linalg_ldl_solve_ops.h,sha256=Nx4qCZjMwcx9GJugPWkRMo-1tyDxOLI_vvybN59aXsE,2343 +torch/include/ATen/ops/linalg_lstsq.h,sha256=VAcbrXQAooacJG7cE9OmnW3kvTUKBCYGkdXcE-G-rb8,2682 +torch/include/ATen/ops/linalg_lstsq_compositeexplicitautograd_dispatch.h,sha256=8M5hTI_jyHVYKYaIOa23DJBRc51zTsbkE-WWHIA34FU,1224 +torch/include/ATen/ops/linalg_lstsq_cpu_dispatch.h,sha256=l1mBMG_J69Yuw8JecKR2Swp1O1yiJq8itHbKhUTY5dU,1600 +torch/include/ATen/ops/linalg_lstsq_cuda_dispatch.h,sha256=FfiGC5JFBG9ryuh6SwCVuPyc0k36YhQmp2GdgGazo4Q,1602 +torch/include/ATen/ops/linalg_lstsq_native.h,sha256=Adcbpt4ejVEDpfL61-gYI2YuHw8qfbFCLUYfWGuUZs8,1245 +torch/include/ATen/ops/linalg_lstsq_ops.h,sha256=_0DmouQrQMryKsdQ8nvjuwsc_VQu8_QxmsQQKAN54Ts,3233 +torch/include/ATen/ops/linalg_lu.h,sha256=IM01es3HH5ouF_1PLzYYkFTuPFPoCoHsfdnl70srAJI,1774 +torch/include/ATen/ops/linalg_lu_compositeexplicitautogradnonfunctional_dispatch.h,sha256=BFNgR9Mq9GcA6-f2C3wiRbDvBF4v-R6hdiAE8GfSevI,1125 +torch/include/ATen/ops/linalg_lu_cpu_dispatch.h,sha256=IdfAp-rkeP70IrbF4cqyw31MevfSBy-O7O-aXGClfR4,1383 +torch/include/ATen/ops/linalg_lu_cuda_dispatch.h,sha256=mwwASyRvokza8V0W0xJBOfqyaQGEqxyKAqKeoCW400Y,1385 +torch/include/ATen/ops/linalg_lu_factor.h,sha256=Sy7N6Tk-jQI8JYWi08qgXq6JkBEhovMSo2xOrkVOZoE,1757 +torch/include/ATen/ops/linalg_lu_factor_compositeimplicitautograd_dispatch.h,sha256=QLDNwz0u-2ynO4nN1BZcRoUDj0GKafYXH9dJxlIg8_g,1391 +torch/include/ATen/ops/linalg_lu_factor_ex.h,sha256=nDkTwcAfgR33yTDP5zJD_JA2h6W04kwK70hPZ7if-7U,2141 +torch/include/ATen/ops/linalg_lu_factor_ex_compositeexplicitautogradnonfunctional_dispatch.h,sha256=MOk7QqfSyh440ZtQYmNeBFD9S2yfiSglyXbWamPYTmE,1160 +torch/include/ATen/ops/linalg_lu_factor_ex_cpu_dispatch.h,sha256=TpEgQ-J3zLKhUy8ujiSUJgz5YgwRxdQYwP8BvF6T-eM,1500 +torch/include/ATen/ops/linalg_lu_factor_ex_cuda_dispatch.h,sha256=khSlZoLgyGmmT6-bbxqwxWaenDt3rrMvCkQvih0Qm4M,1502 +torch/include/ATen/ops/linalg_lu_factor_ex_meta.h,sha256=Zmx8F-hxqjQRogo790frIGXFCb5Yc9NWcpQdaclRStk,894 +torch/include/ATen/ops/linalg_lu_factor_ex_meta_dispatch.h,sha256=7K5n2kt1SSZ1XhdMUweoXSFQAcddPt9XHdS_9XpFZ9k,1502 +torch/include/ATen/ops/linalg_lu_factor_ex_native.h,sha256=kI6UaXmYUMwguUBJNeBViR-jzFGjl0b8OCx4g4NXVRs,996 +torch/include/ATen/ops/linalg_lu_factor_ex_ops.h,sha256=cS_BJeG1tCNH5X4MHr3oGFXziHCC-hSbglWlttdUITQ,2584 +torch/include/ATen/ops/linalg_lu_factor_native.h,sha256=oLgCmhOROAaOB7J0MYTENuH8Fj_5DIkihs0_4F36GyE,950 +torch/include/ATen/ops/linalg_lu_factor_ops.h,sha256=TXo_HryPvujQmBVlBebCX1DIVsY-iBWMrvA9VinbHUo,2257 +torch/include/ATen/ops/linalg_lu_meta.h,sha256=ydMZo0rzYJxiLCCK0g8V_plrsmVsKIw-Q9wdmxIzNgg,865 +torch/include/ATen/ops/linalg_lu_meta_dispatch.h,sha256=NHJH96IoTxkYjmaqZXQVDMYHNGKK87HZfBuwSB2W0Ow,1385 +torch/include/ATen/ops/linalg_lu_native.h,sha256=iJNLbMCuirsiL2C811J-4_3oGdjToG2tPNKTmLV7wik,938 +torch/include/ATen/ops/linalg_lu_ops.h,sha256=78MFgnWFqqlibGciB3ZLPpX5_UFq_xqJw57MBg9Wteo,2341 +torch/include/ATen/ops/linalg_lu_solve.h,sha256=NyTMlJVbIk0MFFRPXQoFcqEvcUgxIicvo9As92RWoB4,1906 +torch/include/ATen/ops/linalg_lu_solve_compositeexplicitautogradnonfunctional_dispatch.h,sha256=aPMF0N72aTvsdY6Bq-OBm0N8zKfQtja9AeAn7lFUxxY,1164 +torch/include/ATen/ops/linalg_lu_solve_cpu_dispatch.h,sha256=MZQsrPxn5jYoiguOtlV2o7dCEsPRVkGqrkmsYpnN260,1426 +torch/include/ATen/ops/linalg_lu_solve_cuda_dispatch.h,sha256=zcWs9jNsYuIJV6Uvw91gUDV4m1FuH7lL-XmT7N-RKGo,1428 +torch/include/ATen/ops/linalg_lu_solve_meta.h,sha256=PDp52epzJBcKlM9RjTK_Gnsv76_z1dMMV7xIyytQ1CM,934 +torch/include/ATen/ops/linalg_lu_solve_meta_dispatch.h,sha256=zbj5Fayyrc76FEAUjzgFSnZ3cwE_R0Yfg4dkmuYbQJc,1428 +torch/include/ATen/ops/linalg_lu_solve_native.h,sha256=xAHD1Dz6nnPY522bWEwWAFkv68Ohpb8FcebUnRRd9Yk,977 +torch/include/ATen/ops/linalg_lu_solve_ops.h,sha256=sQ0Ko2PvqkjwwYxcLKET89R5HQk_RIgs7xCC3c_VqyM,2413 +torch/include/ATen/ops/linalg_matmul.h,sha256=DVdezSBSaBGQLYIk2FGKFKBDop7oMuZ48WrAAYzpLSk,1537 +torch/include/ATen/ops/linalg_matmul_compositeimplicitautograd_dispatch.h,sha256=3JP5JaA0VbTyP2Yoeig5Shixu2y9uWicChrQyQZXXIU,1304 +torch/include/ATen/ops/linalg_matmul_native.h,sha256=4WNtIA3FpsSkiR6xwcjKl0Ylol5BJfkqeqLulF8f8BQ,901 +torch/include/ATen/ops/linalg_matmul_ops.h,sha256=BgXTpHVWrLzGrZwY3nrYA1_jjDQi25gZO80B9HSszH4,2060 +torch/include/ATen/ops/linalg_matrix_exp.h,sha256=xilvkV0fdl5Tw8yJtVm1sx2Zs1Lcqk8Q-JjC-s3n2-s,1436 +torch/include/ATen/ops/linalg_matrix_exp_compositeexplicitautograd_dispatch.h,sha256=Azf364zAVJFxo0LiXZdgQnCfwVJgZK3Fe1QdwKCdQ3A,1172 +torch/include/ATen/ops/linalg_matrix_exp_cpu_dispatch.h,sha256=Y65iadO38MDaJfbU1IEQXSzIK_FxF7yucLvmgc3zgRI,1013 +torch/include/ATen/ops/linalg_matrix_exp_cuda_dispatch.h,sha256=pm1ZCr55JKmgnPQ_qUpjTA0GNuAHJu2_WoX4KvR3zfk,1015 +torch/include/ATen/ops/linalg_matrix_exp_native.h,sha256=lEAx1QDU5zJ4h4mlHZtohvxp2NmoCPS7nDr1Rq2TbW4,857 +torch/include/ATen/ops/linalg_matrix_exp_ops.h,sha256=IjAjzN1Tsxvp8Xrl0FyQMU29nsyT7oH62T3EbgPLKXA,1912 +torch/include/ATen/ops/linalg_matrix_norm.h,sha256=d-Fj4_GZSvT-f1wFjqoGdmeGstQ0wGqy7dvtoYz0bAQ,3472 +torch/include/ATen/ops/linalg_matrix_norm_compositeimplicitautograd_dispatch.h,sha256=ZiKegiCbPtsd07kMloGPGIcB0okBhdvksUnZY7-GJKA,2201 +torch/include/ATen/ops/linalg_matrix_norm_native.h,sha256=WdEw_MNl-6GZlps6LW3CZJqoW9m9DGm0ibj0TjPT0XA,1469 +torch/include/ATen/ops/linalg_matrix_norm_ops.h,sha256=Ga5xbGT8WhBwTp-5OdrSMS1b9hN5wUBtJVDrWZONJGU,4537 +torch/include/ATen/ops/linalg_matrix_power.h,sha256=JXTCIYg6loFfN_ztvRcUHxDvCFKKyCdRnkujPH9CAtg,1519 +torch/include/ATen/ops/linalg_matrix_power_compositeimplicitautograd_dispatch.h,sha256=Qn9s7UYZKaLM-OJ4Vkr_hf2P2CxuF9iXmLYVcxLKna8,1277 +torch/include/ATen/ops/linalg_matrix_power_native.h,sha256=dQnLdKOeiOAbfH1tSF0pFaCnEMD-RSBzA1HwCAgjYk8,883 +torch/include/ATen/ops/linalg_matrix_power_ops.h,sha256=Ue8XxvND4KB-_3rctYRUbBuUNnlJYYEaPCFIUrk7af4,2000 +torch/include/ATen/ops/linalg_matrix_rank.h,sha256=s5sKv2g9FazLVoRjA0XM7wTzYcidHbmOnlUXT8Lmg_g,5256 +torch/include/ATen/ops/linalg_matrix_rank_compositeimplicitautograd_dispatch.h,sha256=IMVL1X7oinQUQQNeq9nceRnz2qG15bK5DgNRia5XqFA,2789 +torch/include/ATen/ops/linalg_matrix_rank_native.h,sha256=idp8O7dTSXL_q37oWmf2dZ6OuwHOspSe6xUjs-oyxbk,1885 +torch/include/ATen/ops/linalg_matrix_rank_ops.h,sha256=glfUktA276J8Xade2ZYJ6Oe6P6LObVlbaiCrzzP7l6g,7447 +torch/include/ATen/ops/linalg_multi_dot.h,sha256=88iRZqvbdQ6CF0PZw-n3-8Oo9T_r7D0N6gusE-CtsaU,1447 +torch/include/ATen/ops/linalg_multi_dot_compositeimplicitautograd_dispatch.h,sha256=JofGtaZY8wPmQpzu7k_40LNcJ6K6EzeKVcpszlEdM_w,1232 +torch/include/ATen/ops/linalg_multi_dot_native.h,sha256=sAmJSkQpCYoEXwzlDg4pamM2c5hiiUcsuKoao4zUKVA,853 +torch/include/ATen/ops/linalg_multi_dot_ops.h,sha256=2TnAsQQ6ZqZYmAXzITcxRNNfCut2Jwq9YkLxnclMRyE,1904 +torch/include/ATen/ops/linalg_norm.h,sha256=z3o-XGjUi3DAQWUeBga_nCiJ6Ocicgp70uBe7dZPcwM,3478 +torch/include/ATen/ops/linalg_norm_compositeimplicitautograd_dispatch.h,sha256=yvkagShdGCdns786exLdqVexLUCdH4fyYghCgsWwCp4,2304 +torch/include/ATen/ops/linalg_norm_native.h,sha256=43Jqmoarvcvgseoh9VCgQFYYoPAXSNEUG9OTwI_J48o,1530 +torch/include/ATen/ops/linalg_norm_ops.h,sha256=GbqZ7KckfdzTtagM1p2UAiWQ13my08XraOhfjVKQxQQ,4647 +torch/include/ATen/ops/linalg_pinv.h,sha256=HzUyi8Glo9G0JjV67XnHlGW1rtqulcRZY4fZ1xJIX28,5027 +torch/include/ATen/ops/linalg_pinv_compositeexplicitautograd_dispatch.h,sha256=Q-iOSnygjCYgZLMaFIL-l0394oToMdalYKmGwfj2XBY,1372 +torch/include/ATen/ops/linalg_pinv_compositeexplicitautogradnonfunctional_dispatch.h,sha256=l0vPCCgiV1QVwHZWybV0kCiA1T0pDcbdd-tGPLupkIQ,1189 +torch/include/ATen/ops/linalg_pinv_compositeimplicitautograd_dispatch.h,sha256=qpp6PwR6bNZxMWRicfEgr1HuL8ogOwzNhsnz5lM9-QI,2158 +torch/include/ATen/ops/linalg_pinv_native.h,sha256=D-ujak-9v6vHbbjN-N0ylmD997mUDDuATeZd-XWjsaQ,1833 +torch/include/ATen/ops/linalg_pinv_ops.h,sha256=_FxI4D7_4CjwpmRgQ5EUjw_YP8fRFIPunr8-Eq3_--U,7303 +torch/include/ATen/ops/linalg_qr.h,sha256=B-LFn5o4LhBCDajS-wxfW5fvPWfDWnsrhdd_lSPBy4g,1679 +torch/include/ATen/ops/linalg_qr_compositeexplicitautogradnonfunctional_dispatch.h,sha256=TA9CU8XaAEVL2d-Tx9mYZQE_MY8JGZAluElUYP3czCk,1130 +torch/include/ATen/ops/linalg_qr_cpu_dispatch.h,sha256=b9fUpq_HivHVczGYRdvPGjRwfbW26OdakcH7sKGTaD0,1357 +torch/include/ATen/ops/linalg_qr_cuda_dispatch.h,sha256=5ZvPpKRocp94su3yH_khL4xDPt1SWi4zjs7dD1aPQKA,1359 +torch/include/ATen/ops/linalg_qr_meta.h,sha256=4enu4Q3xL6sW3_a3xXlc1siVwmnMzm_mztuqjBKtl0c,876 +torch/include/ATen/ops/linalg_qr_meta_dispatch.h,sha256=lvnRIjRtJywk-UuBjeMZ0TRp_V4WQyG-MgAtaF1Fy0U,1359 +torch/include/ATen/ops/linalg_qr_native.h,sha256=ltV3bySIaTYxHv3HPhFXtfND_l-NaJer3kqbwnEH7Rc,927 +torch/include/ATen/ops/linalg_qr_ops.h,sha256=pIpOJ_wEZOgmN5ezq4lIOdCjB76lXBWhcs-O_Db1X7A,2256 +torch/include/ATen/ops/linalg_slogdet.h,sha256=Cip6z1cjbj7J_CfwpNvAWBl2l5-1isPn8fnOwXkotcc,1661 +torch/include/ATen/ops/linalg_slogdet_compositeimplicitautograd_dispatch.h,sha256=yzhXj_WD-4FmJpDaIZI3HjLQrpPePfP91LKCz1SNElc,1349 +torch/include/ATen/ops/linalg_slogdet_native.h,sha256=c0E_xSyXOqqQJ8LSi7YlP8lxWVLkQ4hDbnVErPzOwi4,922 +torch/include/ATen/ops/linalg_slogdet_ops.h,sha256=ojmoYcNqPpaYXdiu7wr2-Vxn-0eBIVDLTCStXZPFpwQ,2173 +torch/include/ATen/ops/linalg_solve.h,sha256=THC5bSJRltS9tLZzNts3E6LpSSIO0xOenMA8YIkXrzM,1576 +torch/include/ATen/ops/linalg_solve_compositeimplicitautograd_dispatch.h,sha256=TBW1-9IoDPpAZu6NzcHaJsHx9n_W2ear6dVJzt32VQQ,1323 +torch/include/ATen/ops/linalg_solve_ex.h,sha256=XqmkXvMMYAboNr_24mKalPljQWkaiiO9CDIitEbSYHc,2047 +torch/include/ATen/ops/linalg_solve_ex_compositeimplicitautograd_dispatch.h,sha256=xrLzo2ZLlbv9XA9XmcTtGKrHiwzlneIHTRwYUXOMeGU,1524 +torch/include/ATen/ops/linalg_solve_ex_native.h,sha256=n0O_DBZS1edZCbSQ6CC74PEQWwwrsOgoLgezbyeeSnA,1036 +torch/include/ATen/ops/linalg_solve_ex_ops.h,sha256=gHdhiD6KL7X1_ViQNwCwUvFCywPIqq-yYsaAbPd2I1k,2541 +torch/include/ATen/ops/linalg_solve_native.h,sha256=rurlPuKkznd8uHSRJaHYvHocbd6Xbt7_3dSgUEuT8Tc,912 +torch/include/ATen/ops/linalg_solve_ops.h,sha256=hS_pqjY5h2dwo5lIlCHtKohFWyogGPPnJG_dGl1cZ6I,2103 +torch/include/ATen/ops/linalg_solve_triangular.h,sha256=xMbKCVojruH1-xFuIu_L8Gnz_hOhXrEoA8oIPoIQjnM,2001 +torch/include/ATen/ops/linalg_solve_triangular_cpu_dispatch.h,sha256=hfXqWgsQWgDF_hI_h9oWbU2Uw3B7ffFn8OA0kk7RTOg,1429 +torch/include/ATen/ops/linalg_solve_triangular_cuda_dispatch.h,sha256=1IWZyKvTymLnAonlmBakBoimhU_qKcIP98tr9g08ysg,1431 +torch/include/ATen/ops/linalg_solve_triangular_native.h,sha256=t-itfs_C0CR4WAOnczpgiw-9daiXORLTu-DJgjIi6uI,1010 +torch/include/ATen/ops/linalg_solve_triangular_ops.h,sha256=3sU7znqGATvdFQJqsem9lz6u3csvJ4E4MKPGkNE11kA,2415 +torch/include/ATen/ops/linalg_svd.h,sha256=mjp0yorZruyNVsxMKusIwiPUFBZc5YadCLLxx_6KdBc,2091 +torch/include/ATen/ops/linalg_svd_compositeimplicitautograd_dispatch.h,sha256=le55BSE2tay5Rl1gmqVjFkTWQYWfoJ9hQqBaiX0_QsM,1612 +torch/include/ATen/ops/linalg_svd_native.h,sha256=QNXAUePMPykBbHjvOr0cmtNGlBIyucHMINfgNJLON60,1088 +torch/include/ATen/ops/linalg_svd_ops.h,sha256=P3kH7vyxTtb5DnADwLTWpaVhfebuXDEpVVCjAUVanvc,2668 +torch/include/ATen/ops/linalg_svdvals.h,sha256=rVgOJ9fiOOQkIslsNZcIr2Ak-Y6JN6rlsAlil5-976I,1616 +torch/include/ATen/ops/linalg_svdvals_compositeimplicitautograd_dispatch.h,sha256=-9xXcOZrg_QJhv-FEUCIeZ3mW6i0HgaNsMPJdnmCE2E,1376 +torch/include/ATen/ops/linalg_svdvals_native.h,sha256=Vk2Epp848PwrdeKV-6HU0qaL6zUEY-DeuhZL8iOBVfQ,944 +torch/include/ATen/ops/linalg_svdvals_ops.h,sha256=0ID6wf6M_UNy8d5xr5XGxlhuK-_eUeL-VfjeVpcu-VE,2153 +torch/include/ATen/ops/linalg_tensorinv.h,sha256=tjUh-QlUEWXG_j-H8kx4zHSR82Hpro59KdYyrgTDO2U,1517 +torch/include/ATen/ops/linalg_tensorinv_compositeimplicitautograd_dispatch.h,sha256=fyKRvp9UmCXAbyKMG6DVZ4JEytV4aUF6fXQ_1nfr9rM,1278 +torch/include/ATen/ops/linalg_tensorinv_native.h,sha256=XRdy9hO3gq66RShL-BPU9AumO1BJ-8hBDYh3HUofNiQ,883 +torch/include/ATen/ops/linalg_tensorinv_ops.h,sha256=DRmgpk7hSPNrPqibbIli0vghfeuXo3_DHYBmXtV0nCU,1998 +torch/include/ATen/ops/linalg_tensorsolve.h,sha256=rGc7XzH6BYDAU9j0LI095pGLnSwAFCa5mWsn7b8zp4Q,1779 +torch/include/ATen/ops/linalg_tensorsolve_compositeimplicitautograd_dispatch.h,sha256=iNP02_-2mYSdnex1jig63dWcVHwRl4hTnurnUBfT1sI,1439 +torch/include/ATen/ops/linalg_tensorsolve_native.h,sha256=V_JV6oqcSI5oN8S4stE7WtQF2HPVRT4ENIVrqICm7qE,986 +torch/include/ATen/ops/linalg_tensorsolve_ops.h,sha256=og9AWAy8GG9Op2hTZ-BH3HwydlZHvqYgEHEn5jduvhA,2296 +torch/include/ATen/ops/linalg_vander.h,sha256=C5doRnXGwh5U0DZatN4GzCXQ2FRn6tKabwRgCVLR10c,1893 +torch/include/ATen/ops/linalg_vander_compositeimplicitautograd_dispatch.h,sha256=gbaTnt8TNYxb6ODvijPQHXdptHc6OHtw54RMGITLy8o,1206 +torch/include/ATen/ops/linalg_vander_native.h,sha256=GXDOsy_gOsJ90panPR541LMcjbCERjQvjoyc8-hT1I4,814 +torch/include/ATen/ops/linalg_vander_ops.h,sha256=zzfokzMqDbwTEZ97voKHm8gjPmDbfhdiLP8Dd3cK84c,1370 +torch/include/ATen/ops/linalg_vecdot.h,sha256=ia21Jf9oMvMS3QgJhbB9JR1XLf3nktMs1LihXtJf1sU,1573 +torch/include/ATen/ops/linalg_vecdot_compositeimplicitautograd_dispatch.h,sha256=LvtFd1dOmpSt6LQubrfnGM9UR3z6P1PRcDVo3B98aEY,1328 +torch/include/ATen/ops/linalg_vecdot_native.h,sha256=ixpJPTHL55k6i0RTAbeJjE940B68lNtKG9GvolnNg_c,916 +torch/include/ATen/ops/linalg_vecdot_ops.h,sha256=ZisiYdGQbe42VncsS1zuaYi2Oc9eBgJ1kz7hr_N3J-8,2115 +torch/include/ATen/ops/linalg_vector_norm.h,sha256=XEi09ZsoOSHKteroUby0bydCtAki6Vg2KqY1_l6ZSMw,2149 +torch/include/ATen/ops/linalg_vector_norm_compositeexplicitautogradnonfunctional_dispatch.h,sha256=68IITWk-PNf9fwq_VcfO9Xjx7fuMAaYxY27p2nulxMc,1228 +torch/include/ATen/ops/linalg_vector_norm_cpu_dispatch.h,sha256=k-n_vmSaIDN07oY-a4ybd71e7p1UC1obIdIcr2OiikQ,1591 +torch/include/ATen/ops/linalg_vector_norm_cuda_dispatch.h,sha256=lbM7RrvRXdx88lZb1ZRjRoWvUPQSM_VBhNk2C_OAM64,1593 +torch/include/ATen/ops/linalg_vector_norm_meta.h,sha256=Y1AKZXG8s1HjSVqve82DC8aCnbvFQKzlLjUQHtrNp3U,971 +torch/include/ATen/ops/linalg_vector_norm_meta_dispatch.h,sha256=f9oHvpqR1cIaGe6pA6VjcIEfHRcwJh_OPNXpPPqemWo,1593 +torch/include/ATen/ops/linalg_vector_norm_native.h,sha256=1V7ZOXsXP55ySX-bMFnEEJmctNlcRmsYE4R_0r1GsPc,1020 +torch/include/ATen/ops/linalg_vector_norm_ops.h,sha256=HuTdLO1IUGYuWea3xN9na--4MFZxLDTp8qrQRODfosw,2665 +torch/include/ATen/ops/linear.h,sha256=EJK4Oz2QWIcBSKYtUZeAMuSrOu4dakJkR2YNsm0CZ7I,1692 +torch/include/ATen/ops/linear_backward.h,sha256=Zr2VH9phefpOHh-NnZPUL14fiEtzZdpJ_X2SYM_LZzs,2325 +torch/include/ATen/ops/linear_backward_compositeexplicitautograd_dispatch.h,sha256=u1cyqAtumiEuTnmbcndSQzg7gqcYebyaVO3BWjwyiT8,1512 +torch/include/ATen/ops/linear_backward_native.h,sha256=7V87dyK42XaohUSWD8IxPkSMzM5kaXYQVJk-BUlMgKY,1161 +torch/include/ATen/ops/linear_backward_ops.h,sha256=2J501QanwUsX-oHJF72o-AIc4_-5I5WPTcTL7UXupx8,2921 +torch/include/ATen/ops/linear_compositeexplicitautograd_dispatch.h,sha256=XSL6RRjqvoPBvXLdzycGxuWwZpMVt2arVHR0S3Mvvz8,1293 +torch/include/ATen/ops/linear_compositeimplicitautograd_dispatch.h,sha256=nbtMihDYZ-6WA071zvq6z2BExb4dg1SgjD4w37NopzM,1119 +torch/include/ATen/ops/linear_native.h,sha256=WGFCTDCATcWp4z7l45-02wcwUeEJ8HqtPaBLAxUaxNY,1113 +torch/include/ATen/ops/linear_ops.h,sha256=WV2RW7P5gnjDseFe9p2SYhLUKCheJEMTjHfz3TSEXJ4,2310 +torch/include/ATen/ops/linspace.h,sha256=UH8FRIxrHJ06h74lQfCPYjXxFj4Bg7dZdgiOrJwOz-M,7233 +torch/include/ATen/ops/linspace_compositeexplicitautograd_dispatch.h,sha256=HxtC18mOlbVz4Yaq1xXH6ewy8DfB7jxvCrMUmdFsnD4,3196 +torch/include/ATen/ops/linspace_cpu_dispatch.h,sha256=ss8Ze3vd5SPEtlxpvq1wjsdwUIsuXFuLkRAl-YruUsE,1190 +torch/include/ATen/ops/linspace_cuda_dispatch.h,sha256=-u9iYrBjtwFfgi5NxX3POWL7_OEHC-aKJSOAHoEwdkU,1192 +torch/include/ATen/ops/linspace_meta_dispatch.h,sha256=bpQ-fwK-raRF5lPpPhYy867oDKGpE6KsimwbZ8WY2qM,1192 +torch/include/ATen/ops/linspace_native.h,sha256=XGkTTFPzFx5V7Je4m5FARBCZ58c7IZ_aqYCB6V3xJoI,2327 +torch/include/ATen/ops/linspace_ops.h,sha256=tjJJ5A5LWfy5loAyYwjZvUgBkodVqjqD2i8zb1tnnv8,8527 +torch/include/ATen/ops/log.h,sha256=toHOyQk9SvZt49bs5tMuoAhWgLx0SegWImRn8QXNyCg,1434 +torch/include/ATen/ops/log10.h,sha256=kUIofPfO9POAmm7hTrqLpXMprNYZ6Wf7KVDlyX8BmTA,1460 +torch/include/ATen/ops/log10_compositeexplicitautogradnonfunctional_dispatch.h,sha256=gMDEf5_g7lmunTrJ3SXCkTtcV3sVJZVETPSCjpwaqk8,1122 +torch/include/ATen/ops/log10_cpu_dispatch.h,sha256=GJ-tA7e122ch4kFajUMB8--vvILEMJBCVeJ1_tKEhfM,1209 +torch/include/ATen/ops/log10_cuda_dispatch.h,sha256=vMDQ-jmYOSE8oLCcQowqC0ala7nTwefC74wUqWhYvKY,1211 +torch/include/ATen/ops/log10_meta.h,sha256=3kidQGwJwZ0pDIcaanLMn0onkmiWp_pX3_mYz9NcvrM,852 +torch/include/ATen/ops/log10_meta_dispatch.h,sha256=uH4pE6TzFTVlcmPDynFnStTJQ9J4pE0R-JwYv8T9U7Y,1211 +torch/include/ATen/ops/log10_native.h,sha256=5ekjVm-S9VwPYwi9kO6C_YqukXYkFqbyAEpdDcugGg4,875 +torch/include/ATen/ops/log10_ops.h,sha256=zP6e-nbyxcsa4yHtnvHX_6euS7mQa5UKJCx10pEkdq0,2347 +torch/include/ATen/ops/log1p.h,sha256=89MNqdT6S3YT7FA9v91dP22qReJdxoZ_MxBb5HcuqbA,1460 +torch/include/ATen/ops/log1p_compositeexplicitautogradnonfunctional_dispatch.h,sha256=P1z0MeX8yRXltrqkPfVvdrbPlrYYXRpjTgnl9POeK34,1122 +torch/include/ATen/ops/log1p_cpu_dispatch.h,sha256=LSHW3NGGUCRCieSCIs1MMo3Y5ZQfqtgjgeky1dBOcw4,1209 +torch/include/ATen/ops/log1p_cuda_dispatch.h,sha256=HXpCYV1pkXRDJdQldUEGEHxHHTz5aP9xZG4L7glpsdU,1211 +torch/include/ATen/ops/log1p_meta.h,sha256=cCVhHshfKuvcZu04FgKxpdOjqO5CLnk4x2DkqYSBpHQ,852 +torch/include/ATen/ops/log1p_meta_dispatch.h,sha256=ytW_BHeII9YWnbHpEIv_HliVAs2czMf6BK1BST1LDRU,1211 +torch/include/ATen/ops/log1p_native.h,sha256=17kkr0BUV4mr0vfO9QNxqDYc3APNKwTLT3e4HuBQabo,1295 +torch/include/ATen/ops/log1p_ops.h,sha256=NoHTD9tAK0HCQ1vwlkUUwo2eTCZYfzjNjOQNC4Fp3Jc,2347 +torch/include/ATen/ops/log2.h,sha256=R2kK5KdZAiF72WCU-OEFmpTHCJ6E39fwh0ifDZy-sPA,1447 +torch/include/ATen/ops/log2_compositeexplicitautogradnonfunctional_dispatch.h,sha256=diWbw4gZelU3lVDA8LrGPVSFJeiQsqWX4Bvtjb8C51Q,1120 +torch/include/ATen/ops/log2_cpu_dispatch.h,sha256=kZXYybpKdFjlZwamKQNKJtgJ0ZqLBP4qR-1I1TLp--0,1205 +torch/include/ATen/ops/log2_cuda_dispatch.h,sha256=pVpSzIJZmxHy2mUQNq7m9gqJponvkg0RpBp4hpoKRaM,1207 +torch/include/ATen/ops/log2_meta.h,sha256=-QluQ-RtMAI8F3fLG1BSIkvTZN3kXhkcf3pFirIKUHY,851 +torch/include/ATen/ops/log2_meta_dispatch.h,sha256=W6fSlZAJ-TLwM5oa5U4ywOZ-7XPOJ9eyI8cX-sjytak,1207 +torch/include/ATen/ops/log2_native.h,sha256=fuu7_m_rpEi798QWpmMKFym0SSemKnO5jmpjNqGHdsU,872 +torch/include/ATen/ops/log2_ops.h,sha256=geyT76vLTYRmpup-hIBp7aas1pRc4aNChuaqjpfyz8I,2338 +torch/include/ATen/ops/log_compositeexplicitautogradnonfunctional_dispatch.h,sha256=m142apvNBd-yVTvKGVlb5FCSVUZE2iPQcrDJHA1aMvs,1118 +torch/include/ATen/ops/log_cpu_dispatch.h,sha256=Z6eEjCf_gBM34RDWc8ojuFwryun4Fy5cvc39f_oswSQ,1201 +torch/include/ATen/ops/log_cuda_dispatch.h,sha256=pmVgwAnJrfA6shqrHKCCXwiQDL_dfR0xOcFOy1UtGzk,1203 +torch/include/ATen/ops/log_meta.h,sha256=4xvVLDtqllN5wUhENV3JnNMkqF6-Yst8MQFn6KZ8xF4,850 +torch/include/ATen/ops/log_meta_dispatch.h,sha256=0nwZXO7vGws7GdE-OgCoBWr1EbJgd_p1lR76OSWEXaE,1203 +torch/include/ATen/ops/log_native.h,sha256=sI8jZJrVfi3UwACEy_eQnpiU90cFFMjxCX7UKTjtE-k,869 +torch/include/ATen/ops/log_normal.h,sha256=nl5FO-G9cQibi5CwAmSFGjOB3xi514DSdlAl8lA4pXI,1836 +torch/include/ATen/ops/log_normal_compositeexplicitautograd_dispatch.h,sha256=NC73hoxCele-r07iDbN3bcieC4kE50DWd0fLA56cPPQ,1456 +torch/include/ATen/ops/log_normal_cpu_dispatch.h,sha256=Q1RmlzaXybPHkD28Q9zUttb3JWo441A8bM0i-7-vXQA,1089 +torch/include/ATen/ops/log_normal_cuda_dispatch.h,sha256=B6n5O2E5bOad4BhVA2dg-RKRGfvgSKkyfAUEbu1eySg,1091 +torch/include/ATen/ops/log_normal_meta_dispatch.h,sha256=k2jZtt_np7kqaGd5EUU0fsYMKGX9-48TU-t09N3v0CI,1091 +torch/include/ATen/ops/log_normal_native.h,sha256=nPTZMk-u0iU3_-2QB6N8Zd5BCaLES2BX6ARKPq_Ytlc,1138 +torch/include/ATen/ops/log_normal_ops.h,sha256=K-iJ1dYsINSrMfn42kACpXjDqoAqXvsSS07Zazd7qww,3106 +torch/include/ATen/ops/log_ops.h,sha256=VSg7OXS-eikxgtr_eaP-Or0tVWONOCMK1_ysfoVKwnY,2329 +torch/include/ATen/ops/log_sigmoid.h,sha256=D0c6zpsIs0LW4q68lymOh8KzRMFXRpoZeuEXHHEii9w,1376 +torch/include/ATen/ops/log_sigmoid_backward.h,sha256=tfzGJNhwiotZlFJHKJfee521WTQOteJIXYMzxkgGLl8,1881 +torch/include/ATen/ops/log_sigmoid_backward_cpu_dispatch.h,sha256=L7PuJvy3CydW5Wm-RTL8ijqYvpc_ncJWN3jPORSEDDc,1394 +torch/include/ATen/ops/log_sigmoid_backward_cuda_dispatch.h,sha256=xdd7powwFsed2jagNmovmYafHS7o4FVbdhbb4SGsfBE,1396 +torch/include/ATen/ops/log_sigmoid_backward_native.h,sha256=QtbjReie8N0V4NUPKVHILz_PLe8lx5QWlKXsz-XkJts,1293 +torch/include/ATen/ops/log_sigmoid_backward_ops.h,sha256=h8qHkF29MHIOEHMfTO_tjDiF3v1TcjEp95tU1RnDs-4,2358 +torch/include/ATen/ops/log_sigmoid_compositeimplicitautograd_dispatch.h,sha256=j_76F48Q5UcFQsCS2SdEJaGFxskllXYQr--yrgLY71Q,1220 +torch/include/ATen/ops/log_sigmoid_forward.h,sha256=denXHy-cXaPHjzYVyiMhEFrGKMwhtZ7GRn-hOpZe5mQ,1713 +torch/include/ATen/ops/log_sigmoid_forward_cpu_dispatch.h,sha256=Gyi7vRtopcJLDBtdwhnu7K-apXwDZ6DSGviOd7JykJw,1327 +torch/include/ATen/ops/log_sigmoid_forward_cuda_dispatch.h,sha256=2tbICGVJRRaMe6B_Rq8UtrxFznYxeX93RQaLzPDQyn8,1329 +torch/include/ATen/ops/log_sigmoid_forward_native.h,sha256=duukXjRTylaCuEfti6cboRbQHgREbKLeMr1ZepkOei4,1191 +torch/include/ATen/ops/log_sigmoid_forward_ops.h,sha256=sp-7-vtkDgqeataHaaNfEw7t4dHvacAuFhZUoChVC5Y,2211 +torch/include/ATen/ops/log_sigmoid_native.h,sha256=Fmy37inWrNerW2SKPM6A2E7USk_LX0zufsJWd4OVa58,845 +torch/include/ATen/ops/log_sigmoid_ops.h,sha256=w1UmGtRKPgG-Wb_Ttwj0DlFATpURkPdles-JitmreS4,1876 +torch/include/ATen/ops/log_softmax.h,sha256=icXLcsepEE_kZD64Ab7FvMqFNITY45ljZnv9lUFZKZ4,2015 +torch/include/ATen/ops/log_softmax_compositeexplicitautograd_dispatch.h,sha256=7H6bjtjZb2yjRlvM2CvpqEW_ZdJH8Fbj2VKsEmZtiEI,1279 +torch/include/ATen/ops/log_softmax_compositeimplicitautograd_dispatch.h,sha256=3mcYuJBrjsmCuGJ7My_JuGl8ujFgAKHrXgvHd5x-DMw,1249 +torch/include/ATen/ops/log_softmax_native.h,sha256=Gm0dkLLk-3HLz-7j7SfaYxttWS55ikBsfIXCG8yNnNA,1095 +torch/include/ATen/ops/log_softmax_ops.h,sha256=eu7IhBjYbsL-o3pA6EL2qlGahICojhnXsVtOmqF12_8,3004 +torch/include/ATen/ops/logaddexp.h,sha256=I8c14Cpf1XLvJf2pRA-vXpEV-Wt8mqxd3GmifJ13GSI,1497 +torch/include/ATen/ops/logaddexp2.h,sha256=96K7CdKz_fCF4wTSG_2Gn8v8kzgR57tdhnevJJZiTuk,1507 +torch/include/ATen/ops/logaddexp2_compositeexplicitautogradnonfunctional_dispatch.h,sha256=DCdt8JiNGxqeuguRDCVgivpyZ3lPbgYeHgDkCwTj9Ho,1102 +torch/include/ATen/ops/logaddexp2_cpu_dispatch.h,sha256=rnVRdfcRxKClpAEYZqSOpmUpExgIvClbOZHTMZa5h3U,1251 +torch/include/ATen/ops/logaddexp2_cuda_dispatch.h,sha256=buLReztpOA4RgTN8hq9GkIRD2GNjs5NzBoYqw_uq7CM,1253 +torch/include/ATen/ops/logaddexp2_meta.h,sha256=utX99F53RfK59XyM2eXjW5CscXX1CQ4K4uO0QUubKUs,883 +torch/include/ATen/ops/logaddexp2_meta_dispatch.h,sha256=CN4xVilD0xMclfCBjORBCN8jRG3dgx5CsuunkNxzWPM,1253 +torch/include/ATen/ops/logaddexp2_native.h,sha256=_O3-XfLZS7BSWNBugVVu1h4GXFtNZl7ARqNW60_PbH8,916 +torch/include/ATen/ops/logaddexp2_ops.h,sha256=SFvzdFxKeqzqv38xjPM3RlNUUjuIAYjNHg_x3GMnztw,2042 +torch/include/ATen/ops/logaddexp_compositeexplicitautogradnonfunctional_dispatch.h,sha256=9WAY2EwxH3X-n7euw5dmyA_X30I1Hrf5ASJ6drsNH1U,1101 +torch/include/ATen/ops/logaddexp_cpu_dispatch.h,sha256=yWUwwlYw4v5l9YgdbnwxqTO7hVQs_3S99ZMWMhzopJw,1248 +torch/include/ATen/ops/logaddexp_cuda_dispatch.h,sha256=FlOqkAvtkwnqYlBHM9_zsduXxk4jBctlwKk9-LRjym4,1250 +torch/include/ATen/ops/logaddexp_meta.h,sha256=S7tJQK0ZDPkvucywAxIzftXdtgSCtnCneCHHz2odS2g,882 +torch/include/ATen/ops/logaddexp_meta_dispatch.h,sha256=kOawzvJWPv2il_eTc6Tw-2UKOyT5-Z5AuGTB-t_6qT4,1250 +torch/include/ATen/ops/logaddexp_native.h,sha256=NVzd8TxZ_G0YUDeBZP2dbO47xoVDWIGTbNb03EoCI2s,913 +torch/include/ATen/ops/logaddexp_ops.h,sha256=jXKsuCPISBjREddUUmtfrHuQ9rfzKeoxcjq2kVUVi9w,2036 +torch/include/ATen/ops/logcumsumexp.h,sha256=mUtKWRqfcyjl6w1CeFT4HQGUGgYA5Co2CzBFVillR-Q,2213 +torch/include/ATen/ops/logcumsumexp_compositeexplicitautograd_dispatch.h,sha256=Fqodkt98_uiPjZUyv453lIQ7tBck7AiY8odz6Hv41rs,1262 +torch/include/ATen/ops/logcumsumexp_compositeimplicitautograd_dispatch.h,sha256=gLJ4UJth7T_APsnXFWK9U_w46l_d_6ddJYn2ZE0_0bs,1274 +torch/include/ATen/ops/logcumsumexp_native.h,sha256=NCNI8QjoIVvdPoNWWvHMTvKGTKpkZGkT5_TYcKUSd4Y,1053 +torch/include/ATen/ops/logcumsumexp_ops.h,sha256=fdSkmMixP-KE1FhGzQ3OPz6skO44ZEnDHa0OmSbXhLw,3285 +torch/include/ATen/ops/logdet.h,sha256=EjvrxFHSoOTjQ68FbAor4lQB3d85LVHgpOh90Nu4hiw,927 +torch/include/ATen/ops/logdet_compositeimplicitautograd_dispatch.h,sha256=R5WS57XXH-WyQ_Vf7of7JFfnEMas4Mm9CHA2BPRIVvI,1046 +torch/include/ATen/ops/logdet_native.h,sha256=yYZfKlCAcph7abYWSUznPL1WULh3yJPH4A2OOCZzH1w,756 +torch/include/ATen/ops/logdet_ops.h,sha256=uhbDp9DTurECBRAq5P1ZPwBSSgmriGfdWr6sKEWQcuU,1245 +torch/include/ATen/ops/logical_and.h,sha256=Fb1gBctFReIJG8lUr7BvyNYISu4Jn5dPNjJzVanccBk,1517 +torch/include/ATen/ops/logical_and_compositeexplicitautograd_dispatch.h,sha256=ug3Ix1uGUwQcjs3Wegdmz-0tXYGS3Hatzf-jCsE6nJo,1160 +torch/include/ATen/ops/logical_and_cpu_dispatch.h,sha256=zP4D2TZVv6NveHFOvxuwNPVo-dKoRSsdTmx9khmPKk4,1168 +torch/include/ATen/ops/logical_and_cuda_dispatch.h,sha256=bZSEGRuUw7NQzxfd7kWcF2xbwQ0qh0ax2a6E49Pb3Vs,1170 +torch/include/ATen/ops/logical_and_native.h,sha256=n83LCDMqX7P-TN-1xt38MOBOmikFWCPJpUpbEaFb5w4,980 +torch/include/ATen/ops/logical_and_ops.h,sha256=8kteYahBPOl9oNFOGHfoWyDK7DmbSDr5alVYP9a2d_8,2659 +torch/include/ATen/ops/logical_not.h,sha256=xcqPEtNl0kTSfIivE0CKDGGR2dLQzrmATiIeyz2p5jk,1376 +torch/include/ATen/ops/logical_not_compositeexplicitautograd_dispatch.h,sha256=zXcCqL4tuOJg2Yjm2Oi39eUBbr9ykw4EUzl0YwJzhTY,1108 +torch/include/ATen/ops/logical_not_cpu_dispatch.h,sha256=mQugtMJMG4OLtgl2WlcidJ-29w9hzaAeRghbpUHuJpA,1116 +torch/include/ATen/ops/logical_not_cuda_dispatch.h,sha256=U7KeeasLDedgZKF6byxPjT9H-g48it86LbtKF6In90w,1118 +torch/include/ATen/ops/logical_not_native.h,sha256=EqmxO-yMTD0Cm5rVd3x6LxnUpLW0geQ5j8aOXOUNQDo,1045 +torch/include/ATen/ops/logical_not_ops.h,sha256=0Y0tBhHXkTFCWq3j11FyyaXZt-h8ICwFQGubc-Ldzqw,2401 +torch/include/ATen/ops/logical_or.h,sha256=cO8KoeZDhgVxYaZRvLig3cqb3rbs85irxpRR55ORMaE,1507 +torch/include/ATen/ops/logical_or_compositeexplicitautograd_dispatch.h,sha256=sR884pq2-Y47Z89HY45ELp0c-BD3YbP7CFQlwmRHmEY,1158 +torch/include/ATen/ops/logical_or_cpu_dispatch.h,sha256=vjNur7q0h28EQgsC0Hv9gLUQulT6McYogwVV-wCPfsQ,1166 +torch/include/ATen/ops/logical_or_cuda_dispatch.h,sha256=Q3DeVd7Y-euxet4NxfAfHpirhzg-nPaNdmoNt3enEpw,1168 +torch/include/ATen/ops/logical_or_native.h,sha256=6rzpu-8JjWrt_3LN0YHGVrZBPVA7O5oTCb12lXiqQF8,977 +torch/include/ATen/ops/logical_or_ops.h,sha256=zQjfoCMUhDg4rSs9icZ1aFvldWIZu1mEdsrwFsQxHsc,2650 +torch/include/ATen/ops/logical_xor.h,sha256=8A7e-uGgR1wvEQR_7vk9PtyrHYobzlHFWTe9j3bnKts,1517 +torch/include/ATen/ops/logical_xor_compositeexplicitautograd_dispatch.h,sha256=2dIJCjEp2UKCLLMcSSNQGwykVxY8iZE4z7Bcco341Vg,1160 +torch/include/ATen/ops/logical_xor_cpu_dispatch.h,sha256=DvEdqC_8H06pHF3-L2zOJXhgAmyL1T-DV8XLYJ9Aj4U,1168 +torch/include/ATen/ops/logical_xor_cuda_dispatch.h,sha256=Ket2RMA4kdlQdd3tLAjdpw4Ky6bN2192tM9EgceS7wE,1170 +torch/include/ATen/ops/logical_xor_native.h,sha256=sYyPbqylb0cRGy9VeSHxDa2K7qLPH_9yaHUFJx3l6tc,980 +torch/include/ATen/ops/logical_xor_ops.h,sha256=XiXsDbyejSLHmjmONJugiglcTrScnbj53oORvUKBuVM,2659 +torch/include/ATen/ops/logit.h,sha256=0T-5JCZgCW1WLunux80QRpywOjCn5wxx76XfL31uID0,1709 +torch/include/ATen/ops/logit_backward.h,sha256=OfHIcl7E5YsKHe0Gir0Wzbc4FOEYivg6y5s0c4Yf5VA,1854 +torch/include/ATen/ops/logit_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Smp_YMq3JbffGmNmhx4yHyw_vSgfM7zL40qKs6sTUR4,1156 +torch/include/ATen/ops/logit_backward_cpu_dispatch.h,sha256=SGO4uzhzU47Pt7eAgaM3eNimsLR8nvs_wTN9jUkxDd4,1412 +torch/include/ATen/ops/logit_backward_cuda_dispatch.h,sha256=lFyey93AJ4tSHDWJuIZs6by741GLvHi_BKgZ9p7wErs,1414 +torch/include/ATen/ops/logit_backward_meta.h,sha256=JBSPPxOCQdq-WgQPbSQQnkMemN6qu3MO_huDAcfnSzE,922 +torch/include/ATen/ops/logit_backward_meta_dispatch.h,sha256=feVhvNgS8m2cIoAqR0RjZyFDbwOHUIAusVS0tnq60gI,1414 +torch/include/ATen/ops/logit_backward_native.h,sha256=fCab-Hp4-r062QCinhWaVJyEtI8x5JWvWgn065ERmXA,970 +torch/include/ATen/ops/logit_backward_ops.h,sha256=6wO-uXWwj2rpEZ15XYYV5cHeGO1Pe2mOD93P5ilLIy4,2344 +torch/include/ATen/ops/logit_cpu_dispatch.h,sha256=4XUvd76uwTa70cj_Z67coXyoCZNTHEXr4M6NWYysRIg,1370 +torch/include/ATen/ops/logit_cuda_dispatch.h,sha256=9YpP_qAPMLGorYUap8E9ISKTt6KbX944AwlsNPQ8tOk,1372 +torch/include/ATen/ops/logit_meta_dispatch.h,sha256=De-tuIWIqEy32yZDFrVwjdhIimxa_nOEnIuPEem5q5E,1044 +torch/include/ATen/ops/logit_native.h,sha256=ckEitZLNgEtGBykoveTzfxF_VKRkrUj4VMra7uV4rTA,1001 +torch/include/ATen/ops/logit_ops.h,sha256=jGJFRvB6rDv-wyXwSdKw1_JqkLv15g9rcRl_5D3FYI8,2647 +torch/include/ATen/ops/logspace.h,sha256=pw7_7mmDcXnkQ24eHjIobzPgvr_FQZ7vZTtGW9Xt4Ls,7849 +torch/include/ATen/ops/logspace_compositeexplicitautograd_dispatch.h,sha256=JcKIUmsdGp-hpM4V2BZibWCjgeNme1Kj8VXxdZT0zEs,3413 +torch/include/ATen/ops/logspace_cpu_dispatch.h,sha256=Wym_0jNeAfwNIr95w6_U83yjuxu-MyTz5D-sjvyjNgo,1221 +torch/include/ATen/ops/logspace_cuda_dispatch.h,sha256=NisMoqVqgfIkL6U2ZDpyi8FX8oprc4YQ2JeU7mmHj1k,1223 +torch/include/ATen/ops/logspace_meta_dispatch.h,sha256=U-JwIinWsjiPLfZyuJHZQbl53otBTverj2j3ggzFitA,1223 +torch/include/ATen/ops/logspace_native.h,sha256=xKF07TkC13hvSD4CwyU6nIhy6xtjQWnt0ZRm1Xb_Brg,2464 +torch/include/ATen/ops/logspace_ops.h,sha256=9Z9rW-bdv_50782YJu-AaTNroOEK37EkZ1689hMASjk,8935 +torch/include/ATen/ops/logsumexp.h,sha256=Vvn_YRaYqJp9OMgYcAe8nPQcPay3arpwTUQFZbgXriA,2480 +torch/include/ATen/ops/logsumexp_compositeexplicitautograd_dispatch.h,sha256=KdgRilYge8Y_BFjeyK5Wjd3nipNQjJQ2qa40vF7YgHM,1090 +torch/include/ATen/ops/logsumexp_compositeexplicitautogradnonfunctional_dispatch.h,sha256=uX_O9r7eLnMdfVIRbzfBCML3EP4wnp8RiuQbS7O9qzQ,1258 +torch/include/ATen/ops/logsumexp_compositeimplicitautograd_dispatch.h,sha256=XoFfENgHzXzJ9aJiiTLJ1j2e02cDthtITkDtdUF1jK4,1331 +torch/include/ATen/ops/logsumexp_native.h,sha256=PIPmVdQN39rvp4tIsx8s64y1oA4cb_xHcJgifawdK1w,1133 +torch/include/ATen/ops/logsumexp_ops.h,sha256=GsUnH3NwYravc9qqr7SVywkQIOfCBxoNZhDhxV_ehMU,3537 +torch/include/ATen/ops/lshift.h,sha256=NZtzTB85d6KQTey8g0i6kHjDWJdQ8OX-JPpe2QSsNFE,2303 +torch/include/ATen/ops/lshift_compositeexplicitautograd_dispatch.h,sha256=-N5KVAuxENH_Zg7hcGUO8DtiuQHvy_4GyFmp33u-Zts,1429 +torch/include/ATen/ops/lshift_cpu_dispatch.h,sha256=erDREo5ltq9KOqvPTX0wk8MCSDiJDreHJWi9M_LmCaY,1281 +torch/include/ATen/ops/lshift_cuda_dispatch.h,sha256=EVvGUlEvh-hS1oPVq1yPGZvqTGozOjAgEF876IsMaik,1283 +torch/include/ATen/ops/lshift_meta_dispatch.h,sha256=8ZAjo2ZgjWZUdaySURd0IrYOafW-3XdgHPGh6zAoupY,1113 +torch/include/ATen/ops/lshift_native.h,sha256=Bb8OmhTruPbjz8E-brs87yoEeGjcdD0B73ZryLcchWw,1267 +torch/include/ATen/ops/lshift_ops.h,sha256=5Rbhk7v52ALrhhJNuwAt02hymTfJDhmff4wVVUOLfDE,4688 +torch/include/ATen/ops/lstm.h,sha256=LN_mwPlIsVJ3fMhpPDAvYmnGMAu_Fy4VIBQoDB-TUVc,1908 +torch/include/ATen/ops/lstm_cell.h,sha256=RjyCz52B6u2Md2nub_sdABIWG2xhwAiXC6pDIUfuhLc,1241 +torch/include/ATen/ops/lstm_cell_compositeimplicitautograd_dispatch.h,sha256=A_OKzBG9gvpQHeSG8zlNtUlGsfek9AkLaVIUyHRm-fM,1234 +torch/include/ATen/ops/lstm_cell_native.h,sha256=TM4_y3bSaQc5eyMAjiBmD1AAMqPqUU2Kke4x4nsTR8o,944 +torch/include/ATen/ops/lstm_cell_ops.h,sha256=h2uIuvhPmjQO1tr2VnNmOaSUBhzYG5Lfbt9SeVAl30I,1855 +torch/include/ATen/ops/lstm_compositeimplicitautograd_dispatch.h,sha256=CCO1GhsePf06Yo8HUaTng9DFVo0coGUnHTsEGN175BQ,1474 +torch/include/ATen/ops/lstm_mps_backward.h,sha256=Fh9XmlFfdMunhmNFumjCYhfj2TjTuw-xfpiuY-R-6xE,3974 +torch/include/ATen/ops/lstm_mps_backward_compositeexplicitautograd_dispatch.h,sha256=F4YzQiIy6rkB1kgcb3Yeg_ZxCsMtW1CyqwdE3brHaPs,1996 +torch/include/ATen/ops/lstm_mps_backward_native.h,sha256=N_AOtuMX_QGj7MZVh2nhU0qTUm9O1nqK-XSNQTLAGSQ,1203 +torch/include/ATen/ops/lstm_mps_backward_ops.h,sha256=aouVMblGeVdrUdCbyY4GunIrCaRW-3FmFdug7sTMvEY,4733 +torch/include/ATen/ops/lstm_native.h,sha256=SUoKvO6KyID5hUusVni5MqpGgEm60cF-B-ydHucbN5A,1184 +torch/include/ATen/ops/lstm_ops.h,sha256=W16n5b2nxWfhfWxMlFRA6ixeBFp2U9ZGIDxZo-zUcqo,3056 +torch/include/ATen/ops/lt.h,sha256=peZS7XPC7895SBIWUSaay6K3yZoriNaKF2-CDCgbRII,2155 +torch/include/ATen/ops/lt_compositeexplicitautogradnonfunctional_dispatch.h,sha256=fK2pq4v6B9TBzyaGwWq3mLwDYXDTQxjDiOUXsmZc518,1319 +torch/include/ATen/ops/lt_cpu_dispatch.h,sha256=-7_V3Ljft5vK2gsy6jpDzCRWtKaRHvOlYHFB8bl9-T8,1655 +torch/include/ATen/ops/lt_cuda_dispatch.h,sha256=GHIiiAOuvtyShSL2k_sfFBds61_iyonKfsyHH_OXDdk,1657 +torch/include/ATen/ops/lt_meta.h,sha256=Lu0ZaMSJ4FQR4fZQ01ERbccwKarUWIqKFrJc9DGpWco,1026 +torch/include/ATen/ops/lt_meta_dispatch.h,sha256=8mi91SORLVV2gR7gTqh192mM-54esPcC-PEzXFCI2mo,1657 +torch/include/ATen/ops/lt_native.h,sha256=gU6d84DGT48ecruQirEV2b4cBuUSA3eC_H93uZv3gUk,1494 +torch/include/ATen/ops/lt_ops.h,sha256=nA-B8Fzy5EpjmMT1crZzRP8vUlENp7GTqsX1nds7gNg,4544 +torch/include/ATen/ops/lu_solve.h,sha256=6zZgnPRfRh2UjY_02zyYCtfXBYSZuqCXnYE0BZI3veU,1682 +torch/include/ATen/ops/lu_solve_compositeimplicitautograd_dispatch.h,sha256=pbtDls-JFFhdmxcIeqI_DYPdqQ0WONVhAZnB8IO0Zlc,1385 +torch/include/ATen/ops/lu_solve_native.h,sha256=l-cexIiMGIkyUVtxa19Pe2-nTdX6c-PjXfQpFBU3TvY,955 +torch/include/ATen/ops/lu_solve_ops.h,sha256=1Prgt_9bSnFj8yz8NNIORN_jOC_iIgkRZysLyG5A3iQ,2238 +torch/include/ATen/ops/lu_unpack.h,sha256=bVQxReshOvD41ejUFlERd-vANfEdy37HN2ACT6fYIgc,2246 +torch/include/ATen/ops/lu_unpack_compositeexplicitautogradnonfunctional_dispatch.h,sha256=kLuCEvt0xdrreeBGNN9m83OmfP9uEpwByn9_3vJ63YI,1192 +torch/include/ATen/ops/lu_unpack_cpu_dispatch.h,sha256=o2opsOfOfN9UtscjVkt5i5i8Lrn7F_HSv9_GSGmdWec,1579 +torch/include/ATen/ops/lu_unpack_cuda_dispatch.h,sha256=WXz_A_Rqu7ULSxmnXhQdoxDl6LHKQKYrb60nzm2NIPk,1581 +torch/include/ATen/ops/lu_unpack_meta.h,sha256=ClK6bKam3wt9I_Jh8E1m6biL5d0DDfi5-bcqy0gGFVc,927 +torch/include/ATen/ops/lu_unpack_meta_dispatch.h,sha256=tYR9y8UsoYcl_zuBYlAkaI02wIuvqods44xhvfGrQCs,1581 +torch/include/ATen/ops/lu_unpack_native.h,sha256=LMw_wbi72Kguv1n4aqS_JXufqPFF8-njyVJNgM8eGmc,1000 +torch/include/ATen/ops/lu_unpack_ops.h,sha256=ClrEsmU_KcJLFoMTLs5C3L6k5NG4xUrc77tnmWdvn0M,2748 +torch/include/ATen/ops/mH.h,sha256=paAGnr95FTp0f6d9olJbwaqMJNWhrVApgbRmDzSBXJU,785 +torch/include/ATen/ops/mH_compositeimplicitautograd_dispatch.h,sha256=QfSD1yjZnmcOP_9svCHtg34vecd9aHmwOT5h1S2jJ2M,1042 +torch/include/ATen/ops/mH_native.h,sha256=rcyYwEAH_M28E726q989LIs7u9tovPhhZBB0GfSIhl8,752 +torch/include/ATen/ops/mH_ops.h,sha256=l7jlnm69s9FqxFlCnyA7jZi3UmDhGqJddOc5G-jjwPg,1239 +torch/include/ATen/ops/mT.h,sha256=tvU9FRC433VyakmY4RRiSyAkH8EaLJ1jFPY4aNW2yJ4,785 +torch/include/ATen/ops/mT_compositeimplicitautograd_dispatch.h,sha256=VuB4SHdKgw9S98TpPV4EZhd3YOtLFOCboV9_na6TBcw,1042 +torch/include/ATen/ops/mT_native.h,sha256=ZCszcVpXfl35vvU6qtcc56d_OPwRZX_cnTHDGfOf5dE,752 +torch/include/ATen/ops/mT_ops.h,sha256=is6E3q_tC3u7L6-lYKTVjIawOEefEHgHFLgY5Dj_xF8,1239 +torch/include/ATen/ops/margin_ranking_loss.h,sha256=p7pnJ4VMapmAvXrqUEVavL-STOsItxFFEzcNuV2fikI,1200 +torch/include/ATen/ops/margin_ranking_loss_compositeimplicitautograd_dispatch.h,sha256=LtT5O3zJ6zEivO_GGC7yNyOAMywHtlpUdbzlKn59PRw,1173 +torch/include/ATen/ops/margin_ranking_loss_native.h,sha256=AAVsUCwY6qwm5oG1mpCr_N-w3g-BarAaxU8agusVhu4,883 +torch/include/ATen/ops/margin_ranking_loss_ops.h,sha256=yrEOYLBR4tSvsvEfg5zNjnvC1xP9BpBYlBTQ678ENFA,1591 +torch/include/ATen/ops/masked_fill.h,sha256=mRvUSxheqxO1B3TPoYw5JgY5_0QS8LBOPfsXnsMIwq4,2590 +torch/include/ATen/ops/masked_fill_compositeexplicitautograd_dispatch.h,sha256=9R07-K_c6n6aMMgENYBsRVlwP_wxdHggp4RzZUZs7Ms,1755 +torch/include/ATen/ops/masked_fill_cpu_dispatch.h,sha256=G8fdwCGCDglcWfRp-Ks_Ey-jNUG0JMjnXAI1UT0Pv64,1163 +torch/include/ATen/ops/masked_fill_cuda_dispatch.h,sha256=sOFA2TGeQTEyNfSu_PPc0pdPiqE-4k3bLJpG8N6SoVE,1165 +torch/include/ATen/ops/masked_fill_meta_dispatch.h,sha256=xt8fIr62xvA2qzUnfUQkJ_LDwt73Pl7dpkOfPhWKJfc,1165 +torch/include/ATen/ops/masked_fill_native.h,sha256=Otv_Sdi8BEfZye-eR9hNwVlznW1urBXfDBoezPK_A2A,2271 +torch/include/ATen/ops/masked_fill_ops.h,sha256=dxw1pnpLCWAkxnNAw4V227nCHuGEUPOVXHbCP5sAuS0,5204 +torch/include/ATen/ops/masked_scatter.h,sha256=vhT61dZW98WurdfEW614XW3ZGtL0DWZzAy6hoC01liI,1688 +torch/include/ATen/ops/masked_scatter_backward.h,sha256=GArfVdc9Zg8qSTYHf5LlSDxa9TWpT8lDOD77SleZ2FY,2097 +torch/include/ATen/ops/masked_scatter_backward_compositeexplicitautograd_dispatch.h,sha256=IEMW1qhfL5lz9j_HLXPUaVQnJ0dmJqQ66H6YIhWbdnQ,1256 +torch/include/ATen/ops/masked_scatter_backward_native.h,sha256=3sOKvG0MQ0nrVfJK5fPmADGhVIsvF-C1nhnRRL2AerI,839 +torch/include/ATen/ops/masked_scatter_backward_ops.h,sha256=kRmb7uJfWE62ntQCIEq7F99yoWDVeBZTqzQ9XNOMfDA,1491 +torch/include/ATen/ops/masked_scatter_compositeexplicitautograd_dispatch.h,sha256=cmSxx14D9NR2-53rzmhJis2c2ALyoiCVT-UsRpKBqjk,1385 +torch/include/ATen/ops/masked_scatter_cpu_dispatch.h,sha256=wLml8tG7F4CzJ8viwyoHBX_HgCK7LoSq_FaKoBO9gLQ,1059 +torch/include/ATen/ops/masked_scatter_cuda_dispatch.h,sha256=xlgWYyuG6ldsxTTxO8ix12a0DjEv8vb96GvE0Vs2CTs,1061 +torch/include/ATen/ops/masked_scatter_meta_dispatch.h,sha256=91FX3wop6VCCzdkUKg0VVqXZwB3JZYdW6AGubA2FO0Q,1061 +torch/include/ATen/ops/masked_scatter_native.h,sha256=7sk1Pf3sK4If_baW9AUDFkWGSER-KUNdf1_85y68Vkw,1188 +torch/include/ATen/ops/masked_scatter_ops.h,sha256=jEFgEUwjRcFeF_Ax8C8FILcJYYMmg9lNpDhsf7U4FZg,2944 +torch/include/ATen/ops/masked_select.h,sha256=ees-7Qi8_ODnSmlwweHyzcYSAs8o1satOatoDyV9x7I,1528 +torch/include/ATen/ops/masked_select_backward.h,sha256=yW61bHM36ghZgMuQIow7tqWYrnOIjXy7-xqbZJ0pRBk,1082 +torch/include/ATen/ops/masked_select_backward_compositeimplicitautograd_dispatch.h,sha256=1aqCRMupGNFwwaUlYjFmZB5QN7laML8DTfVux-KZDkc,1113 +torch/include/ATen/ops/masked_select_backward_native.h,sha256=Q8RO46QW0X-5k9i0vgQy2wvHyr4TIje92SfdLV0FeTk,823 +torch/include/ATen/ops/masked_select_backward_ops.h,sha256=4uOceVnXzEkkn1omYaXxxuCo8O2W0p1V0dut1cFtcLc,1462 +torch/include/ATen/ops/masked_select_cpu_dispatch.h,sha256=vKLQ2WzfXt9aT_jDtph5Y4n6PNl0ZRCwBvotEej-JGY,1257 +torch/include/ATen/ops/masked_select_cuda_dispatch.h,sha256=52MHl-icOy7h8ickinXNh6uF4FF8rwUNHlEWmlcdA18,1259 +torch/include/ATen/ops/masked_select_native.h,sha256=cnOV4Bi0nnaaYGH88KjJR22VDrKVlrx44KIm-1z04H4,1115 +torch/include/ATen/ops/masked_select_ops.h,sha256=ZYsvGxEasnsn7_JMRpcVPv5RiOInhYDJ4Ml3njIZ0q4,2054 +torch/include/ATen/ops/matmul.h,sha256=2RBQ15FtPieQHpVQ1p2lzJ6z6PXLcz3ZCxEGlxyv36A,1467 +torch/include/ATen/ops/matmul_backward.h,sha256=3URDiWGc6SZ0qb180OMu35NkA3KhRYJyj7NpvCrf_Mo,2037 +torch/include/ATen/ops/matmul_backward_compositeexplicitautograd_dispatch.h,sha256=XnpdRy-8yyUApjwUse7fhUitsjx4uiSX47GpTZm4-Co,1418 +torch/include/ATen/ops/matmul_backward_native.h,sha256=D6A_QkqeQQ9tJp2H26qC7IiStuGtaK06qFYDckVh5S8,1088 +torch/include/ATen/ops/matmul_backward_ops.h,sha256=3_HhjlrXneqahhYHpWig-oC6LhXzj6sS-adWIctpE08,2670 +torch/include/ATen/ops/matmul_compositeimplicitautograd_dispatch.h,sha256=fLPaXtHZb1v0OLNOtucinLVas2F9O7Xb967hcjmG4q0,1283 +torch/include/ATen/ops/matmul_native.h,sha256=bM_eD1SdcrXmszQ9Bwqixo47Au4gdDkCNc58Y1uAPDI,1087 +torch/include/ATen/ops/matmul_ops.h,sha256=c0UdwCoN_Op9i4p9BskwY3Y_OMotWFW3EYOSocoFRhU,2018 +torch/include/ATen/ops/matrix_H.h,sha256=BvQorJL9koaLQ5_pSOzFnifGGZabqel6o1EjQe2bgPY,791 +torch/include/ATen/ops/matrix_H_compositeimplicitautograd_dispatch.h,sha256=ydF19uFHOlrt160G3k4W36BxZHMrXht1U00C4TOfNQc,1048 +torch/include/ATen/ops/matrix_H_native.h,sha256=48wuvGm236T_RYNYkB1W_45nIBIBbMVvOILpOOfCmjY,758 +torch/include/ATen/ops/matrix_H_ops.h,sha256=2kXA6DMbgkK9aBWERj85-XCE2_O5TuXMd1qM2elW4ck,1257 +torch/include/ATen/ops/matrix_exp.h,sha256=dKXU5bugMYtgy1G6Bvl1qm22Dr143HUe0Kyz5AnJn4Y,943 +torch/include/ATen/ops/matrix_exp_backward.h,sha256=RCIQun5xtdu8Fwc43g2qtP9hwsIlg28coKeXxdNb_jc,1023 +torch/include/ATen/ops/matrix_exp_backward_compositeimplicitautograd_dispatch.h,sha256=KpU5PZPSFVBF0Ol5131W6i0risET57xePZjliDxuYEM,1084 +torch/include/ATen/ops/matrix_exp_backward_native.h,sha256=6KG3M0QkGGYaAAsDzrU7KJZ1VDn903EzA7SlyU2zkUg,794 +torch/include/ATen/ops/matrix_exp_backward_ops.h,sha256=6Gy8auYsf2xCaS1MYQg5SfZtbAT08c7MZOtCuWfX594,1367 +torch/include/ATen/ops/matrix_exp_compositeimplicitautograd_dispatch.h,sha256=R7urA-PrWCVo8KKdnHtuAG2HR9lXLx-NxznAAdTY6JA,1050 +torch/include/ATen/ops/matrix_exp_native.h,sha256=JXlqXzezY2XAXg2ichIfsyrV43K1kddJ_CXXc3l0Lkw,760 +torch/include/ATen/ops/matrix_exp_ops.h,sha256=2OvmkB81roT4rh9n92--ql_vJ260rWBeuZkSfDnZnqE,1257 +torch/include/ATen/ops/matrix_power.h,sha256=M-uZ1f5s7vpONfrBJpcGhbRA7lfOFdKC04bdbhCnFVY,1449 +torch/include/ATen/ops/matrix_power_compositeimplicitautograd_dispatch.h,sha256=R2WDc1Ik22y-kxX0zV2dto1eBjQB0fRvxFjqmmz_mx0,1256 +torch/include/ATen/ops/matrix_power_native.h,sha256=tfNj3vQZ6me9Jd2u7b68wcqIThGVwJvO1muxHRAgNgw,869 +torch/include/ATen/ops/matrix_power_ops.h,sha256=1RiGlqLN8RDEhE11MFZAwtqn4Egul2GZBDfhuwDsz8U,1958 +torch/include/ATen/ops/max.h,sha256=nXNAzCzR4TJGhfafST1QDQyCQ1P6waMp8GiljfngkcQ,4125 +torch/include/ATen/ops/max_compositeexplicitautogradnonfunctional_dispatch.h,sha256=7LDOj9KmEJF8unephjxYiQ-CsF7v3wJ9bJdgtCwUH2M,1127 +torch/include/ATen/ops/max_compositeimplicitautograd_dispatch.h,sha256=2LRjOuNfVucYMGE7U9zhgp_9GFgA3EecBC1YR58mGEI,1713 +torch/include/ATen/ops/max_cpu_dispatch.h,sha256=K1GuCZrCGiLNXjjYVfWS2rtboTW6bMh4YxT40Jc1ykI,1579 +torch/include/ATen/ops/max_cuda_dispatch.h,sha256=0c543Wd_UrTeUsP969brv2XqhsYljs_BGVZRIU9kdw4,1581 +torch/include/ATen/ops/max_meta.h,sha256=fjgxf90zuMFT3_zzqHu2ReMA_E2kVcRiFeVHUaflhdc,1335 +torch/include/ATen/ops/max_meta_dispatch.h,sha256=JAC08RT4OvY02xHuAmbki1A0NeFnLev6lkS0rqJl3tA,1376 +torch/include/ATen/ops/max_native.h,sha256=_P_wo8R_NRcYoE6OccQtGgAEtG6AKrMMwxFPuzIZS5g,1787 +torch/include/ATen/ops/max_ops.h,sha256=3YUX38DTCK0lDgYQ9I_DJ8CoiU_ts7FTkY99bWfVOFc,6417 +torch/include/ATen/ops/max_pool1d.h,sha256=wEBki-KUzaw5YpYcEd0IINTO_IqVe4zgZ5ATMS3RZr0,1224 +torch/include/ATen/ops/max_pool1d_compositeimplicitautograd_dispatch.h,sha256=pOwohBzruqGFsc-tnGkoWarryx77camMsXNJjG9bnNE,1183 +torch/include/ATen/ops/max_pool1d_native.h,sha256=fOLyX7h9OYdKf4MXvisJYGWdsRBTVBvagQz7M-DgqRI,893 +torch/include/ATen/ops/max_pool1d_ops.h,sha256=hSO2ttzZhu2bWGo83Ckmk2qvwcCG8oyL-WrwneCVmdk,1668 +torch/include/ATen/ops/max_pool1d_with_indices.h,sha256=YqhF8RVsVyeXWbWbMY_l-N1YMuE_7MYIObtE_XrRvFs,1311 +torch/include/ATen/ops/max_pool1d_with_indices_compositeimplicitautograd_dispatch.h,sha256=jQlN7QnFbVTRxxACRPknS3Z9nqW_s21M4ogC7oJ3YWk,1221 +torch/include/ATen/ops/max_pool1d_with_indices_native.h,sha256=ZGG1ssXj_DD4IN7okFMSpW3duqrIsuXCWvJsArQ_ya0,931 +torch/include/ATen/ops/max_pool1d_with_indices_ops.h,sha256=EOxDLI__PmLAKiimO5ePjPpPpgJRpo9RYvLQhDoj6-Q,1792 +torch/include/ATen/ops/max_pool2d.h,sha256=YIe_yG62L9NxiqxElt_nDovoBiYmQ5TncjtADpcu6so,1224 +torch/include/ATen/ops/max_pool2d_backward.h,sha256=exRttGnvKgEbUAg6uCnjoWXmEvoFw7gRm4W8TT3rvZ0,2481 +torch/include/ATen/ops/max_pool2d_backward_compositeexplicitautograd_dispatch.h,sha256=e8_SVRxxonI_EMUmSTsDxinDit2I8bKcK5NC8k-GgEI,1493 +torch/include/ATen/ops/max_pool2d_backward_native.h,sha256=rI_Wu8nSrqlbioEfKSvZSpGRcpyw57JjKhvw8be63E0,945 +torch/include/ATen/ops/max_pool2d_backward_ops.h,sha256=afQLRQ4DFknAhPNTgOMYNFacIVgweEFW7ZrfJOwm1U4,2954 +torch/include/ATen/ops/max_pool2d_compositeimplicitautograd_dispatch.h,sha256=GTn672gnveQsVkCOoT0RCUbTDc59f5QNKZ5nzVvsV7I,1183 +torch/include/ATen/ops/max_pool2d_native.h,sha256=7Ac796xE2y48mFVVlrk0Cf1HQSL8oUXznyJqVWRNSv4,893 +torch/include/ATen/ops/max_pool2d_ops.h,sha256=-IEpSfNlJxDq0YYBUB-xYLQucTnF9a85_D0vpswXK7Y,1668 +torch/include/ATen/ops/max_pool2d_with_indices.h,sha256=erulZkMasWhn7aBJtVnijcm_VXo-iMVMNJlODVwq92s,2545 +torch/include/ATen/ops/max_pool2d_with_indices_backward.h,sha256=M5zbWLNGqUjusnUUxRu-kPZx3AJpgqu21DoFQruik08,2775 +torch/include/ATen/ops/max_pool2d_with_indices_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=fC7PEtHrSp11sGiZzNIRl6_2r1fwgxpq9w4CLtqqLaA,1278 +torch/include/ATen/ops/max_pool2d_with_indices_backward_cpu_dispatch.h,sha256=5d8AMSBdYvN0TrLKmmEfyY0ymwTA5j7lMxwSq3A569Y,1793 +torch/include/ATen/ops/max_pool2d_with_indices_backward_cuda_dispatch.h,sha256=edr9GSAo4JJ17wdnq3dSqopbMD0SrNpg6EpBjazsuqM,1795 +torch/include/ATen/ops/max_pool2d_with_indices_backward_meta.h,sha256=mF4T1bQxg75U4lv5HsQfZI46vbZZCH2d7cXULi6Fix0,1059 +torch/include/ATen/ops/max_pool2d_with_indices_backward_meta_dispatch.h,sha256=3VvSKwoxZsr9JdsM51WijYR57ck8tlP4-9YGkEWO60E,1795 +torch/include/ATen/ops/max_pool2d_with_indices_backward_native.h,sha256=2FfqCmTRmJqKN9MiU-Obt--mT32gcB7-VWd2bRFbbzo,1535 +torch/include/ATen/ops/max_pool2d_with_indices_backward_ops.h,sha256=VpUTTHIqG_JQB-2EbxWBme5HmCESeWm9rres5RNQuIc,3232 +torch/include/ATen/ops/max_pool2d_with_indices_compositeexplicitautogradnonfunctional_dispatch.h,sha256=UADjbPL4_yWKGAxYwedIvlsUPugjjLTR54Ih0FHAEC0,1247 +torch/include/ATen/ops/max_pool2d_with_indices_cpu_dispatch.h,sha256=2BpA0EO__zzyppcKF0ttV62tyh7mK-zbBKzkf3uu-7A,1721 +torch/include/ATen/ops/max_pool2d_with_indices_cuda_dispatch.h,sha256=J3oKDR4FhsDOr-nk8KBphqmxZ39FnO4q7ZK64m4nF2U,1723 +torch/include/ATen/ops/max_pool2d_with_indices_meta.h,sha256=mU0SgElJQ_sMuH4z9nk96rH2V0CWTNQcvI5S0Syqqsw,990 +torch/include/ATen/ops/max_pool2d_with_indices_meta_dispatch.h,sha256=xvTMx1L04bwRQx9OvDTp3TI6UrbycOMjfOCT2g-4j2c,1723 +torch/include/ATen/ops/max_pool2d_with_indices_native.h,sha256=EEJt8Mt8932saqWZ01NyRgavH6NiIhsevFOiMfhSxtk,1412 +torch/include/ATen/ops/max_pool2d_with_indices_ops.h,sha256=uzSrvP1uIRc_RnhjfHksJCu0sFK3m555-oZiMLpikWk,3028 +torch/include/ATen/ops/max_pool3d.h,sha256=HdpbW7XAHzcPbaFIytm-qfc-vz8SZWQlsbX2EiShBl8,1224 +torch/include/ATen/ops/max_pool3d_compositeimplicitautograd_dispatch.h,sha256=Zg66M7fhUaHoDCwTH8qXg03ysYhyO10nETniMfFiFtc,1183 +torch/include/ATen/ops/max_pool3d_native.h,sha256=YAQVLXPIVbWzB-TCeNMBLJ3nlJYSyrpENZTL_qEWW8M,893 +torch/include/ATen/ops/max_pool3d_ops.h,sha256=xLe_Tjd-nXEYlLW_WtLL2cQNBIYG3Ajb5GU9xw4M-Rw,1668 +torch/include/ATen/ops/max_pool3d_with_indices.h,sha256=2klaf6llVTTqSoaiBpU3u5Oikom_3mfoYU0JKLkgJdU,2545 +torch/include/ATen/ops/max_pool3d_with_indices_backward.h,sha256=xY6VFKQqWhnQwJ2rXf0-tRybyAMaMwUPsbKHvZA1J2w,2775 +torch/include/ATen/ops/max_pool3d_with_indices_backward_cpu_dispatch.h,sha256=sh61PHpL05sZLHyRnJQiZhsbULoJl39Tuu5ZqI8HQJs,1793 +torch/include/ATen/ops/max_pool3d_with_indices_backward_cuda_dispatch.h,sha256=B6tJVAQAGbvGSmYAxs37Yn5JTnrBFFCBgzkYgcUA-yE,1795 +torch/include/ATen/ops/max_pool3d_with_indices_backward_native.h,sha256=bfJ9NPzspsvZR-X3SVDkm18ZGuXvTEKCdPCqBVd2KfE,1825 +torch/include/ATen/ops/max_pool3d_with_indices_backward_ops.h,sha256=ohsGqniRk50ay78P6o_J4qTiYRZPhU5lBTc3vkcR9iI,3232 +torch/include/ATen/ops/max_pool3d_with_indices_cpu_dispatch.h,sha256=XIAm9Uz_4_UDv9bXY7cP1rTnqh_jWbwbS4Hll7jGQ9M,1721 +torch/include/ATen/ops/max_pool3d_with_indices_cuda_dispatch.h,sha256=Qwd5LgveORk9sQHIx12xCJIoyWPr_qGXBWJ5l27DPho,1723 +torch/include/ATen/ops/max_pool3d_with_indices_native.h,sha256=N7bVKgIcGlcBuggF1TT8tunqL_-MZGe39wCDbv0ph2I,1709 +torch/include/ATen/ops/max_pool3d_with_indices_ops.h,sha256=dzPdofoSC-3Vu3XKDXnolwKB-n0jZbRNbK6MlJKPzGc,3028 +torch/include/ATen/ops/max_unpool2d.h,sha256=iNVn9zomxyVrQrsUe0LzPFSDiUpRrRnD9Q65bB38eOg,4784 +torch/include/ATen/ops/max_unpool2d_cpu_dispatch.h,sha256=lzRTCx5W2n4lri1fpYb_FmaEIXwskj4E7UoZ31a-58o,1786 +torch/include/ATen/ops/max_unpool2d_cuda_dispatch.h,sha256=l-Dsxhe4pdChWacUwFriSfnEnUT9et4W11--ovQLGBo,1788 +torch/include/ATen/ops/max_unpool2d_native.h,sha256=qLo5Ug4anpgYZ4fewuQd98XFLHlbGpcrpIax6V25q84,1283 +torch/include/ATen/ops/max_unpool2d_ops.h,sha256=GOzsFdKQxj1WFXdzuPUMrgoAtzJv-f9ehfMzjp93AUo,2286 +torch/include/ATen/ops/max_unpool3d.h,sha256=DYcy9qAm4KgC4w_A1vQ13AqR8CamiQl1FE2Z5dLbo78,5762 +torch/include/ATen/ops/max_unpool3d_cpu_dispatch.h,sha256=3qyalDfsK66u7b74XMfwp0mMUVAb07Aab6MjakQg_E8,2080 +torch/include/ATen/ops/max_unpool3d_cuda_dispatch.h,sha256=whlWYTbtQ16oeGVV_UP9E8SYEtSmNzBcBCIEkWC_jTc,2082 +torch/include/ATen/ops/max_unpool3d_native.h,sha256=mSEd08iHieSFDUZ62vHp3LfVqE45Pr41YvDuajcgzWI,1479 +torch/include/ATen/ops/max_unpool3d_ops.h,sha256=EPKpOaMvhpJ8M37d3MxGcShMjBaPzLq8wa6INPCmRTk,2612 +torch/include/ATen/ops/maximum.h,sha256=1EkVWj_IY520JgOQRWY5yqskijtWRTyvH_R46UApSJY,1477 +torch/include/ATen/ops/maximum_compositeexplicitautogradnonfunctional_dispatch.h,sha256=6mlghFSf2QTZA1h2HSgOyeDdlPPVGxrz8SW6JlnksG0,1099 +torch/include/ATen/ops/maximum_cpu_dispatch.h,sha256=nw6CuifIVSMf6XsixDd0lvGaWTVVNCrx5PkzLFX2SfQ,1242 +torch/include/ATen/ops/maximum_cuda_dispatch.h,sha256=8UWPOwgpftxH3j9Re71iFe5pdq6_pUjOFO3EwQwCdmk,1244 +torch/include/ATen/ops/maximum_meta.h,sha256=DJRIGq9rr1h7qLXgWwBllfTLVk1odxmPJXZ3Ztx61K4,880 +torch/include/ATen/ops/maximum_meta_dispatch.h,sha256=aeBtrWwetdNrOCnpSIT5laF-SERYUnNUwgpdiDoEv6w,1244 +torch/include/ATen/ops/maximum_native.h,sha256=7dOvqEG-PvRqJR4ERk2veoEBgMPqb0o62sV6hsk09Xk,907 +torch/include/ATen/ops/maximum_ops.h,sha256=28Y5fbNwJ7WCCJZChA4jJIuKY3W5Sarov4yuffOOIMw,2024 +torch/include/ATen/ops/mean.h,sha256=yx_W3OOGM23nMRZ41-o4GT_Yl_4-luKnqxjrER2PaBQ,3702 +torch/include/ATen/ops/mean_compositeexplicitautograd_dispatch.h,sha256=laM8MZoFuwehuk6v6t01KJhTDpWBRmZYdEN1idsrTII,1346 +torch/include/ATen/ops/mean_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Agq9Cz4LRh14pAVdMDYl7GzSmATkmMERpZbZA6dD6iI,1173 +torch/include/ATen/ops/mean_compositeimplicitautograd_dispatch.h,sha256=Ws_Cp1F2BeT_OIat_VTQ58EKoxDXuI3RgB8PFdBvLOI,1463 +torch/include/ATen/ops/mean_cpu_dispatch.h,sha256=4qC2uNvJsZz9cFh1bwJVn7tnl_pfJo-smCaIH-u9PCI,1443 +torch/include/ATen/ops/mean_cuda_dispatch.h,sha256=IKcLxUfmX7NZJ4yOOa02nwtv8JEs99VxRPz34b0GLeA,1445 +torch/include/ATen/ops/mean_meta.h,sha256=1FR1V6aP1nhf_TwLdYVS4OQFGovV-Aiau_JA2kqflPc,937 +torch/include/ATen/ops/mean_meta_dispatch.h,sha256=mmPoQJXyGIY400OyiRPGw1R30-Nio1nYgTbOLO-d7r8,1445 +torch/include/ATen/ops/mean_native.h,sha256=bgccK5554fkmoztheOHfMWzP_IOkh8_Wl6dJASWWlpA,1829 +torch/include/ATen/ops/mean_ops.h,sha256=FaL-JPyA6-WZICbtI0JvWOIRep6HLY7hk6vkCEsXiaU,5487 +torch/include/ATen/ops/median.h,sha256=fPsH-ssyXBrRM7Ye1JNCtoZIncUbIs2t_EZ1zIHOcBY,3544 +torch/include/ATen/ops/median_compositeexplicitautograd_dispatch.h,sha256=R7m45fHzi9J1CVGfCqUVaC7RbsohvvPP8bexJowjBVg,1263 +torch/include/ATen/ops/median_compositeimplicitautograd_dispatch.h,sha256=uQmW5bTWSb8qJy2SkC5VEBu_KemBH0URosLK4007MDs,1439 +torch/include/ATen/ops/median_cpu_dispatch.h,sha256=yReGN2zzgEqbaWctudcxhB8A7XRxC2n79lBPlZbUTIc,1325 +torch/include/ATen/ops/median_cuda_dispatch.h,sha256=tlJbAfvtaK_iH3e7cLuiKtczjBEYUiszjuM4Z26mqug,1327 +torch/include/ATen/ops/median_native.h,sha256=2wFxilozKOu32BJRK5NJcNbzh6GOzNhUGreq2M-Ibww,1616 +torch/include/ATen/ops/median_ops.h,sha256=dE_emLC9yBV6XKh_M8oJ2XlIewlw0rqULRAqy4Xb2TM,5188 +torch/include/ATen/ops/meshgrid.h,sha256=plBvyfss8jdrtEJYuFhP3I5ILhQ01YtPEAKmIKIdYew,1201 +torch/include/ATen/ops/meshgrid_compositeimplicitautograd_dispatch.h,sha256=9p802nLxdEH5NqP2gArW_COks3LWW38sg-BW6ICrMbA,1160 +torch/include/ATen/ops/meshgrid_native.h,sha256=7gtkTNk1aRVK1ezkrMMR51ZYwYj9W9p_LiJfqAEC8mI,870 +torch/include/ATen/ops/meshgrid_ops.h,sha256=CLaENpoaLkeTYDafY5KD-pvRwBp1UmYLAybH8HqgBhM,1975 +torch/include/ATen/ops/min.h,sha256=Hs3GTvHFL7uAvwtZ9vMISuHQk0BxdTKhmEozPr4MfxY,4137 +torch/include/ATen/ops/min_compositeexplicitautogradnonfunctional_dispatch.h,sha256=nYIG7zvNthiAwpgdrk8sufiXevCI2tRi5FAA8E-pOTc,1127 +torch/include/ATen/ops/min_compositeimplicitautograd_dispatch.h,sha256=PTGpxcpmEf7yLkTT0abLqJT2TPiP430Cv4Q1fmro7Gg,1715 +torch/include/ATen/ops/min_cpu_dispatch.h,sha256=m5uhDx8rUjk5c7xMVRGJs7ndfRk41AJIFQpuTQgRS_c,1581 +torch/include/ATen/ops/min_cuda_dispatch.h,sha256=I2AAx269s8WbHfHxzLdn4nEL3VwaFH1741_v0WgKh2g,1583 +torch/include/ATen/ops/min_meta.h,sha256=Bs_oUs1afz7EuCfkDd-4arFCBGB0bm4Y7jvDf8U_QeQ,1335 +torch/include/ATen/ops/min_meta_dispatch.h,sha256=SpVugcq1ynkE1RaXTZbu1l-hTvWrMmAByiPJPr-usaM,1378 +torch/include/ATen/ops/min_native.h,sha256=x-UV8QLzhuvlgBpyqdlh-3rpLhNboV0vp1Ebtehezz4,1789 +torch/include/ATen/ops/min_ops.h,sha256=ZBDncKc0B5TNQgRfukSE8S3SCdI0Tshpt_Kj8YbwVc8,6423 +torch/include/ATen/ops/minimum.h,sha256=oLy0uzdt8Zvz9-zEIfPDjgIIxzd5Uf9PMbff2l07BME,1477 +torch/include/ATen/ops/minimum_compositeexplicitautogradnonfunctional_dispatch.h,sha256=JhwFx5XjSu0S3LoXBFRcxBSjp-dDCRkbrt2fuJbYVJ8,1099 +torch/include/ATen/ops/minimum_cpu_dispatch.h,sha256=eBlDo54pOMAadMzZEG5iaJOhHw4BxJRzAtplc2WfyAk,1242 +torch/include/ATen/ops/minimum_cuda_dispatch.h,sha256=vD3DTRIsMIOyQEpYy9kZcr-D_r_4wQ0iaKThv4V25sc,1244 +torch/include/ATen/ops/minimum_meta.h,sha256=OIXSVLGKjU2rEjV6rpIoADBff8NPb9Hs6-ybPUq0yG0,880 +torch/include/ATen/ops/minimum_meta_dispatch.h,sha256=jr7apuaeTdzDAqZg1CdzE3kk0_au-dbqHtf6tS11SfQ,1244 +torch/include/ATen/ops/minimum_native.h,sha256=TyZVrBzZSKkmnaA_Yul-jP2uDNio8L6Jlx1HDPZ_EMA,907 +torch/include/ATen/ops/minimum_ops.h,sha256=vpnVHSRZAlQToUEz8Rhk5TCG5D8nb0KIoTrz5sy2hWg,2024 +torch/include/ATen/ops/miopen_batch_norm.h,sha256=nYpn2udSr9UEPcSXThUqRqMXjsuP4fej2HUyFm3LoSg,3179 +torch/include/ATen/ops/miopen_batch_norm_backward.h,sha256=NI_F9geo1ubyDyRky2-EK48O3Y1snPKi5toDZKqSS6w,3320 +torch/include/ATen/ops/miopen_batch_norm_backward_compositeexplicitautograd_dispatch.h,sha256=2zBn5eRJ9mMemSfHsxDwUNfbrefwTbTlgI8bFONPx2c,1884 +torch/include/ATen/ops/miopen_batch_norm_backward_cuda_dispatch.h,sha256=G2f1Ypjv_SsZuM83hIuGNgy3O-BnJyNEAecKeyuvebM,1328 +torch/include/ATen/ops/miopen_batch_norm_backward_native.h,sha256=u5-GcO2c-q_jaNXOUH4mO2ivxeuLLNfVj4_42W6Y96s,1526 +torch/include/ATen/ops/miopen_batch_norm_backward_ops.h,sha256=YEwLUyScHs-biOfi8QrT_HyXeWR68XigV6k3s24zZAA,4105 +torch/include/ATen/ops/miopen_batch_norm_compositeexplicitautograd_dispatch.h,sha256=ShhjkARjpf_oc2zSDpGzfFcvX5Spdtv3K_8o4GyZTYc,1800 +torch/include/ATen/ops/miopen_batch_norm_cuda_dispatch.h,sha256=XSGobWAvl2caActU4AhI--9pagHQYX1CAi3qa-RagVY,1286 +torch/include/ATen/ops/miopen_batch_norm_native.h,sha256=gFVC0dYgXewT_gkXYWgYGk4RwSiOvpxOzDVI5g6ighY,1442 +torch/include/ATen/ops/miopen_batch_norm_ops.h,sha256=gb_txYyjYlBTAwU-amS06Pb2AxCDxkkAopOCnSL9OE4,3845 +torch/include/ATen/ops/miopen_convolution.h,sha256=57FXqbAWl3tkUuhScoz0-Wc8FFBz6RMut35-Bk5uFQs,8228 +torch/include/ATen/ops/miopen_convolution_add_relu.h,sha256=vP5RI2j73M_k1DsD6PNeULtmD7nyXwRbKmo9TaCj2G4,3279 +torch/include/ATen/ops/miopen_convolution_add_relu_cuda_dispatch.h,sha256=CuaDH7s5LmsP6zzq9uGt3bZoXXsLcTW9rYCfMsaXT6U,1574 +torch/include/ATen/ops/miopen_convolution_add_relu_native.h,sha256=Izv200j169KqGl89E8AdswABE3XfuYKZ0h3c_JE5plY,1002 +torch/include/ATen/ops/miopen_convolution_add_relu_ops.h,sha256=gd38iJpUnNiTeGsN4SZPCs7HeEZmBWyVST2vBtlSuDw,2103 +torch/include/ATen/ops/miopen_convolution_compositeexplicitautograd_dispatch.h,sha256=s_FcPFshpcHEBDN2llN0ZRJYfdPpszinJcbSrSgYu5c,2187 +torch/include/ATen/ops/miopen_convolution_cuda_dispatch.h,sha256=Lc7RiMe7k2SqLPc4wHASHTEZwebeoXslWzMYp4YZVBA,1498 +torch/include/ATen/ops/miopen_convolution_native.h,sha256=rZkGRsVxgK7T8kODc8IEgb15EHRTcep6uqvJs0iFYb0,1274 +torch/include/ATen/ops/miopen_convolution_ops.h,sha256=Oyza3ILcqRYwkLicpHmBCj4akQXEHTK4gL_yRUmqMrI,3324 +torch/include/ATen/ops/miopen_convolution_relu.h,sha256=iQB0tXwXW_SmePPTKO-6ePHvSHpNHAgt7PB7HkkDbRE,2885 +torch/include/ATen/ops/miopen_convolution_relu_cuda_dispatch.h,sha256=sALQyiqygz6GK3y4AhEwsCwiL9c98he6wI1Y8cfCMr8,1436 +torch/include/ATen/ops/miopen_convolution_relu_native.h,sha256=nWV5moeWcqDUxlQi3xvHccppPE_PG-dwYIA_2pzUH_g,933 +torch/include/ATen/ops/miopen_convolution_relu_ops.h,sha256=eVEEYyLSHvRIj0U3x4DfMpqq7vrQZzwovXcudL2k4_U,1879 +torch/include/ATen/ops/miopen_convolution_transpose.h,sha256=hZG4Jg_zyelsArHiqiOEzQFRhTsMq2bp3cauj82TLVg,9444 +torch/include/ATen/ops/miopen_convolution_transpose_compositeexplicitautograd_dispatch.h,sha256=MWbJYBv7yahnhay4GRy2lP_iX6KaKCTskb6hSerm-zE,2363 +torch/include/ATen/ops/miopen_convolution_transpose_cuda_dispatch.h,sha256=raZ11YS6GlpQcxMNS3jxhfwUynitFhToE9-k3asrwSo,1586 +torch/include/ATen/ops/miopen_convolution_transpose_native.h,sha256=okC4pMhUJRS3XtEXW7i8n6SBFyKzE-Gvquz--0mlfs8,1362 +torch/include/ATen/ops/miopen_convolution_transpose_ops.h,sha256=4UeAobgqE49sgzay-vfeeaWvthVf-NO8KsfKHKq1_w0,3620 +torch/include/ATen/ops/miopen_depthwise_convolution.h,sha256=1FBEBxsE9-P1cjsS7P-h8yU1BPhzV2phQ-WFHT9q2rc,8538 +torch/include/ATen/ops/miopen_depthwise_convolution_compositeexplicitautograd_dispatch.h,sha256=BE0DsJocKyeCPFTRLwNVKUXmv6B0eVh4uvqQD4tYia8,2227 +torch/include/ATen/ops/miopen_depthwise_convolution_cuda_dispatch.h,sha256=eRcKdTbklYIvf_3TYfZVV16va3ZNDLdijdJLR0xb02w,1518 +torch/include/ATen/ops/miopen_depthwise_convolution_native.h,sha256=pbHRgCjqdHj2r3anxxCZmpsgDWlqfiby6MZ_MUHyCPo,1294 +torch/include/ATen/ops/miopen_depthwise_convolution_ops.h,sha256=ExaKnFqIHKbe7oCTGdP2DdXZJ1keaujg6YP6M__BZGY,3384 +torch/include/ATen/ops/miopen_rnn.h,sha256=gs9b5dievvLVrAeNvCYuEAkzej1AICFFQQnWKoncHG0,4009 +torch/include/ATen/ops/miopen_rnn_backward.h,sha256=D2xbNp4R20KQoKMz79dSRwB84CEgnE8yZ6zO3XIHABY,5131 +torch/include/ATen/ops/miopen_rnn_backward_compositeexplicitautograd_dispatch.h,sha256=0_Em7u2fM7go6cSpSofvIr8HEUUamTP3E3DS8h-pxTc,2422 +torch/include/ATen/ops/miopen_rnn_backward_cuda_dispatch.h,sha256=CkO_GIywmMPAE6o75iBfwWJZuAPgZjA7QNW54JxEXSI,1650 +torch/include/ATen/ops/miopen_rnn_backward_native.h,sha256=GCfGnB3sh2MEF7smkbqqPIduCCk9eRM-ZdXvZQkPaC0,2117 +torch/include/ATen/ops/miopen_rnn_backward_ops.h,sha256=m6qQL0Ibjhu8ZxZ6OSMAUaPaQdhRxJWw1hY9BL5WJ1M,6046 +torch/include/ATen/ops/miopen_rnn_compositeexplicitautograd_dispatch.h,sha256=lBfqXM2s-Xl0HhDbDHj_dp8o3hU5BDJaJ-drRMBCJro,2068 +torch/include/ATen/ops/miopen_rnn_cuda_dispatch.h,sha256=NypJvr_0KoP6HocRqL6DYKvypYH2QLVIa9ItQ0Sh5Yk,1378 +torch/include/ATen/ops/miopen_rnn_native.h,sha256=FmtIFLdok9SpO5TgmbaJMvm1rnOa2WuAENjYi5Ob2XY,1668 +torch/include/ATen/ops/miopen_rnn_ops.h,sha256=3doQcIS8c-sMGaNgUbQZiRkedrde8ygisXp6LkZzFGA,4653 +torch/include/ATen/ops/mish.h,sha256=b4uE4uzdVyObJca2TqOuoXM-bPviqWMeThQlOWgAJt4,1447 +torch/include/ATen/ops/mish_backward.h,sha256=-NHSbHToHFnPw9pGmLCP3Ez78cwpCzOcmfaSc54efik,1020 +torch/include/ATen/ops/mish_backward_compositeimplicitautograd_dispatch.h,sha256=_rCcUxcdW9zP7qaQ7FpCJ0EW23PRXSqMkZO7mPbPPJs,1085 +torch/include/ATen/ops/mish_backward_cpu_dispatch.h,sha256=mNwj3FqCjKdJ_xlkO66pXjm2xBaxGFdjGXuqnxW3gjA,1041 +torch/include/ATen/ops/mish_backward_cuda_dispatch.h,sha256=YXWrx23Si8iLQ0OR721EizOWR9LLGvxyxJcq4Y1ezZg,1043 +torch/include/ATen/ops/mish_backward_native.h,sha256=TPeuBRf_gkNadL4aFOuUAI5CnmVRpJC9j2tRfmKtppo,894 +torch/include/ATen/ops/mish_backward_ops.h,sha256=F01C9AU-7_3iZEwxNZjLSSS-A1pjqq9fA4rQjAJAIRU,1370 +torch/include/ATen/ops/mish_compositeexplicitautogradnonfunctional_dispatch.h,sha256=xlSJsy3rKWPlwpkg6RLt14u1OoAEdxv6HV74J9us5J0,1120 +torch/include/ATen/ops/mish_cpu_dispatch.h,sha256=7j4imh74m6MBbWiMNGTeTry9NOq_UhBbyYzdhfNKfLA,1205 +torch/include/ATen/ops/mish_cuda_dispatch.h,sha256=7WCLuKnBe6g6wnHmkQcfsB86h66pK2d930rsYVC6EQ4,1207 +torch/include/ATen/ops/mish_meta.h,sha256=hzHNerE5-3YCwbKE08-rOsBU9zRvE4I3mkKtS0NEUWE,851 +torch/include/ATen/ops/mish_meta_dispatch.h,sha256=WoKSqR_ZIV7-USfHyJ6gfuekZqlX4dbXAcGfaAfYJtg,1207 +torch/include/ATen/ops/mish_native.h,sha256=V1oLPoq_VjWm3eYIqVaxjg5KwEGlVTjlmI5j10dgKSA,872 +torch/include/ATen/ops/mish_ops.h,sha256=-teRx-fT42JPwdoNyqg4_t6K9h4qeaHNQr7oNKR7nVs,2338 +torch/include/ATen/ops/mkldnn_adaptive_avg_pool2d.h,sha256=rkMdHgwMVwAKrm6wYZFqJvznurnufcQeSkUq99hvHt8,1712 +torch/include/ATen/ops/mkldnn_adaptive_avg_pool2d_backward.h,sha256=XfAeLtmy9u0NeaaArX699Zgd0B_zMnuwenVMBSj_Odk,1811 +torch/include/ATen/ops/mkldnn_adaptive_avg_pool2d_backward_compositeexplicitautograd_dispatch.h,sha256=cErY0GKejK-5VJLc8NCNF8VrlIPbtfYxx3ZveFYAxO8,1272 +torch/include/ATen/ops/mkldnn_adaptive_avg_pool2d_backward_native.h,sha256=s0sHr550nmg5InMzICRpxqmAFi3Bqv8FcFzcZSTyx0o,957 +torch/include/ATen/ops/mkldnn_adaptive_avg_pool2d_backward_ops.h,sha256=cb50ms4FuvqOd9RLvG5LQWiGP3naJcSd8xmDHV_eX88,2228 +torch/include/ATen/ops/mkldnn_adaptive_avg_pool2d_native.h,sha256=xpUBf9CgwXqaY80nlZOIae36YI34pZDhpwwsfy0dEcQ,933 +torch/include/ATen/ops/mkldnn_adaptive_avg_pool2d_ops.h,sha256=Dwlvhvwkr7V_85rwxI_3poeDmkiOdnDKR-41TOeJO0Y,2156 +torch/include/ATen/ops/mkldnn_convolution.h,sha256=MERYGGcHbFHdlYdtW0yz9u1u5rVNqIvOYlq5ahMFGTY,7268 +torch/include/ATen/ops/mkldnn_convolution_compositeexplicitautograd_dispatch.h,sha256=aeHU-reSIEKf8rVNBG64ILGWLeeQKIs74lH5Aagj8J0,2520 +torch/include/ATen/ops/mkldnn_convolution_native.h,sha256=O9WG58AA6wH35UKc-_VUNn1_1YqmWkn3x47Y0x-9Oi8,1202 +torch/include/ATen/ops/mkldnn_convolution_ops.h,sha256=lM-prP7CbvDp5eMzNXyHt8MR_amaRYdbYfp3TXYCHbA,3084 +torch/include/ATen/ops/mkldnn_linear.h,sha256=_ZHcj0i2M26aTd2HrnpoRj65torvglXaI1U33D14BeY,1753 +torch/include/ATen/ops/mkldnn_linear_backward.h,sha256=6PXBwLP4lYv5DAWdZBf0zCRsgX3P7fcHPDejvvZAVvY,2395 +torch/include/ATen/ops/mkldnn_linear_backward_compositeexplicitautograd_dispatch.h,sha256=ueD3oRt0ZdyTBjGSzsLzM_rqeQ2bAA_Jo4Y2jUx7OHs,1526 +torch/include/ATen/ops/mkldnn_linear_backward_input.h,sha256=1a8eEUIHALmHyT2QZRU_Tegu4QySNnPK0-cFFHv49tI,1933 +torch/include/ATen/ops/mkldnn_linear_backward_input_compositeexplicitautograd_dispatch.h,sha256=yF-lNGppKeaVtNqn934sZV-4g6nKhk5en_xHeMxkcXA,1318 +torch/include/ATen/ops/mkldnn_linear_backward_input_native.h,sha256=A9FZCSfDEmtDOGcLVSAW8QF9nlIZe-UJqDAZHsR1KZY,1003 +torch/include/ATen/ops/mkldnn_linear_backward_input_ops.h,sha256=TcC5vN8vrXlqdovPsYaaJFx6f0qagDC24iFplqEibEk,2380 +torch/include/ATen/ops/mkldnn_linear_backward_native.h,sha256=4SkBjYLqkPTK6vILo4DXs6VT5aFFa6k5hbdCnn46uUw,1168 +torch/include/ATen/ops/mkldnn_linear_backward_ops.h,sha256=vxyCF-o_7ET1YW2syviRK968eL4QKkqkDAtAofPee3k,2963 +torch/include/ATen/ops/mkldnn_linear_backward_weights.h,sha256=shF3daZxJzJoDfm9oPHEKtnoGYbLrH1MrSNQ-hk7u6s,2283 +torch/include/ATen/ops/mkldnn_linear_backward_weights_compositeexplicitautograd_dispatch.h,sha256=hC-_4F9ceL_XsIGp33tr29ekZkUtR5k5kOi55_rnml8,1450 +torch/include/ATen/ops/mkldnn_linear_backward_weights_native.h,sha256=uQ6rNfA7QDxXEc5VhfQbjqVH-y2VJpjFHhe3a2wRfac,1113 +torch/include/ATen/ops/mkldnn_linear_backward_weights_ops.h,sha256=95xQOUI40_ARYWlPsAtCE-jR6WuE1Tjt4kmDv1yX8A4,2760 +torch/include/ATen/ops/mkldnn_linear_compositeexplicitautograd_dispatch.h,sha256=wgFTncBA2U9GBrtlweiSFGtrQmLxdeolEeEvPbY8iSw,1305 +torch/include/ATen/ops/mkldnn_linear_native.h,sha256=M8ffWp18gsTUOZ5lsHGM6zm2_PbD2v5IrUgVHILbQ4M,990 +torch/include/ATen/ops/mkldnn_linear_ops.h,sha256=X2CuGdz3zYXUFeN1d4BMNy7Zq5g8LLHO30eX_qiuxLE,2346 +torch/include/ATen/ops/mkldnn_max_pool2d.h,sha256=lWXEZ7-MTJ4-SawESua-AgQjjOA10qBMFIkNNT1rLjA,2266 +torch/include/ATen/ops/mkldnn_max_pool2d_backward.h,sha256=mNcPP9BE-sp4VR4mlSFoJRnUE2gH7j2G07Gj2vKw2eU,2710 +torch/include/ATen/ops/mkldnn_max_pool2d_backward_compositeexplicitautograd_dispatch.h,sha256=O66yxPF0Ozo_ZLB4dk9E7jAmaO-fN8TfAyZRv4Gajmo,1563 +torch/include/ATen/ops/mkldnn_max_pool2d_backward_native.h,sha256=VYxxqhwIO4OP2rEhypapAaa68Ja3FjMyGfA5kJqhSBA,1248 +torch/include/ATen/ops/mkldnn_max_pool2d_backward_ops.h,sha256=5mUvHKV_5ZXdX3EQ2Mq5X-EYgfjPce1JoC_DYyKwT3g,3180 +torch/include/ATen/ops/mkldnn_max_pool2d_compositeexplicitautograd_dispatch.h,sha256=JxnHjsaxQl-M2i4j1aCstoa4aG-gPKkhFpcFlavSgBI,1425 +torch/include/ATen/ops/mkldnn_max_pool2d_native.h,sha256=jdyXfoLdHZM4my0d-ZoTeCQWYLmaIiMPfCpGZxDU19w,1110 +torch/include/ATen/ops/mkldnn_max_pool2d_ops.h,sha256=Bx8hJ1_U8By9himrfTNA4ENL4V5QKO6LEMnv7dhdUek,2734 +torch/include/ATen/ops/mkldnn_max_pool3d.h,sha256=qFTOTeDSzmyrYuKdgycO5eGDNrkANuX9kzUXn9PmTmE,2266 +torch/include/ATen/ops/mkldnn_max_pool3d_backward.h,sha256=svomOssuxigNSOC678H_PTSTVOSz7fWvzLSgBYGmU78,2710 +torch/include/ATen/ops/mkldnn_max_pool3d_backward_compositeexplicitautograd_dispatch.h,sha256=6-cN5eYiIRIX6-p2V-V1gjSHuEEBMYRjCApGz_-jhho,1563 +torch/include/ATen/ops/mkldnn_max_pool3d_backward_native.h,sha256=j6xjFtS0fYMibSNXUV-c6umHQVlY4lUYAaDsaaophL0,1248 +torch/include/ATen/ops/mkldnn_max_pool3d_backward_ops.h,sha256=ha_xKlEensO_uNppLGGVBWZVaLCV7dZtn-xsXpRvvsM,3180 +torch/include/ATen/ops/mkldnn_max_pool3d_compositeexplicitautograd_dispatch.h,sha256=Qn0t01Vh0zFfBa5eC9yX0PvmoORvN0fGYbt-oYBCPwg,1425 +torch/include/ATen/ops/mkldnn_max_pool3d_native.h,sha256=nNJlbzxhoun_t88aFfB4PcEt15b8Q6mgNMswD2SjUwg,1110 +torch/include/ATen/ops/mkldnn_max_pool3d_ops.h,sha256=00kKJ__W2YJl6KJMDiYvZMvaKfPgr8XwfeE-oRsUQ9g,2734 +torch/include/ATen/ops/mkldnn_reorder_conv2d_weight.h,sha256=auJV79F5dhK1ZhMlxpXNIcrf6ioBYfMAhmMisyxiAmA,8116 +torch/include/ATen/ops/mkldnn_reorder_conv2d_weight_compositeexplicitautograd_dispatch.h,sha256=HIMD3RtdBz8pUKcSYtquZgf1ugS_Y2M8rERr7nraitY,2042 +torch/include/ATen/ops/mkldnn_reorder_conv2d_weight_native.h,sha256=u2W_XOh8iAyGNm9N6-FIAnnum3pGcqs7XF-TrE0iiHo,1182 +torch/include/ATen/ops/mkldnn_reorder_conv2d_weight_ops.h,sha256=_hLu7bb8q_9MdSUBibHHVw0WAsITY9RzoVgSP1bJ34I,2984 +torch/include/ATen/ops/mkldnn_reorder_conv3d_weight.h,sha256=SrhZU9TCmvtrr87iBdy27W3K175As0cKJ8z1m5hDkic,8116 +torch/include/ATen/ops/mkldnn_reorder_conv3d_weight_compositeexplicitautograd_dispatch.h,sha256=7hTUbLOXh-IS1TkIK2BlItNLZjNKi3Ds5j7BSlNEFn8,2042 +torch/include/ATen/ops/mkldnn_reorder_conv3d_weight_native.h,sha256=Fr6szhZSrO54k8AHEqRQ0EKWcrKJTohj4E_zV2meOzQ,1182 +torch/include/ATen/ops/mkldnn_reorder_conv3d_weight_ops.h,sha256=i-Y5_PdTqTAwLo3BRKmENkv36UmxJEeNc-ETNmAeiYs,2984 +torch/include/ATen/ops/mkldnn_rnn_layer.h,sha256=o7u-l015u3qxtNCdUGwmDB4Iw94fy7oZ5VpluD7uEP4,4054 +torch/include/ATen/ops/mkldnn_rnn_layer_backward.h,sha256=ozhrssN1MxKZBrRNCLuHoGGLP2mO5LStTCBZCeS_xHk,5878 +torch/include/ATen/ops/mkldnn_rnn_layer_backward_compositeexplicitautograd_dispatch.h,sha256=0xuOF6dZGaIafzMIkzCQqggn5XtlA6IP2QQWpuAyqJw,2748 +torch/include/ATen/ops/mkldnn_rnn_layer_backward_cpu_dispatch.h,sha256=x-ta17w7Y4NEiPstcg8K8EDT9BaThLvgIgmJOORuVpw,1674 +torch/include/ATen/ops/mkldnn_rnn_layer_backward_native.h,sha256=e8pzSUfSgrOgMx-EIPpO0rtYUeTJemb1u2UONae_Z9M,2306 +torch/include/ATen/ops/mkldnn_rnn_layer_backward_ops.h,sha256=L6MTX2GV_zeE---KgVQaH3cokEUk5MYBAUG6jMIy3lc,6773 +torch/include/ATen/ops/mkldnn_rnn_layer_compositeexplicitautograd_dispatch.h,sha256=mEea9DbqOmp07BWl2VFGjoq3ma928VC_YmBYb6lFNqs,2044 +torch/include/ATen/ops/mkldnn_rnn_layer_cpu_dispatch.h,sha256=tnby7Rkza3CcztG8ZVR1_xhdzJ5EQ6Wv68E5-raw4YE,1385 +torch/include/ATen/ops/mkldnn_rnn_layer_native.h,sha256=8b0NSIhCGzKdKU6S0xR2IohSUFXrCss58vTEq5nBtIg,1665 +torch/include/ATen/ops/mkldnn_rnn_layer_ops.h,sha256=FayCYV8LjVyKuM495uuRiIEf1FTO3O-qiTrr32GsnLI,4636 +torch/include/ATen/ops/mm.h,sha256=JHiz0UcWWO6K8rQ7uBiEcxYuAX2xKX6Kvlc1xWNNoGU,2266 +torch/include/ATen/ops/mm_compositeexplicitautogradnonfunctional_dispatch.h,sha256=76hy2Tn72uSmp-d2VQELgcztZExtiGsrILBQbE3jvAw,1093 +torch/include/ATen/ops/mm_cpu_dispatch.h,sha256=-hZ21Db-Ax1hhxGkUuipDLylinxUabZ7lBrsAGOP8aY,1224 +torch/include/ATen/ops/mm_cuda_dispatch.h,sha256=pnPEdedNTESR-1P0W9Jw-jHlUPvOAGowO-vtEpFvrtQ,1581 +torch/include/ATen/ops/mm_meta.h,sha256=RgRBw1O-roUQHBVUfkmvkQBVeclJ_04x4621aASnp14,874 +torch/include/ATen/ops/mm_meta_dispatch.h,sha256=ptyCiL9H1KRvu8g14YgsTvP6bU7QnuoJtBI7TCJPZBM,1226 +torch/include/ATen/ops/mm_native.h,sha256=5naclpQbfC2Ily9GSvG1kbdCxw-4JfvaeK-dIOWs1iU,1705 +torch/include/ATen/ops/mm_ops.h,sha256=r0dbUKK8eJkEZXyVMPIs2yDQ8E3X62Q34d2iT3CKFfY,3457 +torch/include/ATen/ops/mode.h,sha256=cVZRLHMxFxzxAyS0v7dz7RhvgVciBlvlZ1KBO7XLkaA,2934 +torch/include/ATen/ops/mode_compositeexplicitautograd_dispatch.h,sha256=TNHyncEyy8rYAQPaNW3CE9yT4Y6g2jde7Bpb7mEh4XI,1313 +torch/include/ATen/ops/mode_compositeimplicitautograd_dispatch.h,sha256=MqqEScIBaMH1OkbcbgkzCEeAbC5bU6kyRFE_KIGBeNY,1433 +torch/include/ATen/ops/mode_cpu_dispatch.h,sha256=jOJno9d0TFM-3ojjZ6ovINmjtmliVftsyUr8fydBSU4,1061 +torch/include/ATen/ops/mode_cuda_dispatch.h,sha256=lk1SYRfzwhIDiBKdyZ1c4m6FeFf8_QKkSaTmRB5jedg,1063 +torch/include/ATen/ops/mode_native.h,sha256=a844CzGdRXyGT_tBHdi9-ucc-rEqEmYmiTubc7f708s,1246 +torch/include/ATen/ops/mode_ops.h,sha256=3oREOrCBRYnaZ-TKc0uMVbdPfHiBOkb51U07KSKDLGY,4014 +torch/include/ATen/ops/moveaxis.h,sha256=aPM7uRdVwUOXhLN_V_06sUVpe2Sj87aD1tQWTG7nAvI,1311 +torch/include/ATen/ops/moveaxis_compositeimplicitautograd_dispatch.h,sha256=vuT8yHLQwLtJGoxuRH4E27cHOA0ZLAgTHQSFZkfNgAc,1195 +torch/include/ATen/ops/moveaxis_native.h,sha256=LQZkLn4vl7GzODAKcAijlR59G0wczaGMcFp67dLBZBg,905 +torch/include/ATen/ops/moveaxis_ops.h,sha256=FkknFTi5EdoqyaTzVjNuvtXG6jYDZuttbBHtHH1MQnc,2108 +torch/include/ATen/ops/movedim.h,sha256=06KtwZE3ikazpDnsfIrHXvsjApkLjVoWYvzn7zWN_x8,1304 +torch/include/ATen/ops/movedim_compositeimplicitautograd_dispatch.h,sha256=QQm2AsMK6OyCx5shk7IRKWDRCj67xl6_Qb7YGkMPBqg,1193 +torch/include/ATen/ops/movedim_native.h,sha256=JEMISgszVqQ0YY5U41Ryw1Ny9cTB_Y5aRA8tXTbRSF0,903 +torch/include/ATen/ops/movedim_ops.h,sha256=ZYH_Sx-k7SbaEY1lqK0HyK5wZi-Tq5HiggmQOmIoyok,2102 +torch/include/ATen/ops/mps_convolution_backward.h,sha256=5JHEIuHXbkIqK9fp7s6tP_EtRJ_MjQddt4291VCypCk,9304 +torch/include/ATen/ops/mps_convolution_backward_compositeexplicitautograd_dispatch.h,sha256=jWE0L8_Hk8nxG2i0uBfisiMkJtYv1H8xKLfL0n_VtME,2479 +torch/include/ATen/ops/mps_convolution_backward_native.h,sha256=PHkZIwFMOn7krZIWf0msxwlnfexfg3nC6x4xL1PW4D0,1084 +torch/include/ATen/ops/mps_convolution_backward_ops.h,sha256=H59VM0RGPr-Aq28_bjpdkjbK-WYoSzKbYvtpIRhmXIs,3693 +torch/include/ATen/ops/mps_convolution_transpose_backward.h,sha256=fRThyFlyjRCh-bLJuN5fInbWiLKog5UyfWTIswt-BqQ,10040 +torch/include/ATen/ops/mps_convolution_transpose_backward_compositeexplicitautograd_dispatch.h,sha256=DkHZ_ZxQtVoEPw1E6j326mbjtEI6M3dgtsWGUt-ve8w,2527 +torch/include/ATen/ops/mps_convolution_transpose_backward_native.h,sha256=zR1gYTbTVjesRF7mKp4U7Pg3RuEukzGw6zMZBictfhA,1098 +torch/include/ATen/ops/mps_convolution_transpose_backward_ops.h,sha256=K4N_talKgb0djcz23ZTcdf2zDONRMc9rfsksExs6GP4,3828 +torch/include/ATen/ops/mse_loss.h,sha256=aRqT7DimZztc6JbSo9K5-dZWd9hWBWLOcQULsX359po,1686 +torch/include/ATen/ops/mse_loss_backward.h,sha256=majsfTQDXzKC0Rkc_IamF1c_UzQxbF6HatZjFLpihzo,1986 +torch/include/ATen/ops/mse_loss_backward_cpu_dispatch.h,sha256=SndjhEh2JPlZduz0vdYsYG4pnQsAFuO_bgK8ApbYBcc,1442 +torch/include/ATen/ops/mse_loss_backward_cuda_dispatch.h,sha256=CiQHAd1A0221fuXFr9_M3QUe3uXaUxdSCvalZ1boLyE,1444 +torch/include/ATen/ops/mse_loss_backward_native.h,sha256=QYM4fAaxzQq6GNBLKIcvgMQEka5bsobQMMQshLEku0Q,1020 +torch/include/ATen/ops/mse_loss_backward_ops.h,sha256=rhjaVdkODVZg5CSH60U4g--9vVLc9tfG3Pa8NiUiFCE,2464 +torch/include/ATen/ops/mse_loss_compositeexplicitautogradnonfunctional_dispatch.h,sha256=P1Z7OuauI8Gi3eFHgfFu6GPY9tlalY3nh6Fm8jMUw54,1140 +torch/include/ATen/ops/mse_loss_cpu_dispatch.h,sha256=IkJvEUf3NIzwPh-IMLQfmS6c9dtA9YtBRscKmk_JByk,1345 +torch/include/ATen/ops/mse_loss_cuda_dispatch.h,sha256=5pv-4dboEUgNp7r50RDOGVc-9GHCMkO1Ly8yGi5qzgU,1347 +torch/include/ATen/ops/mse_loss_meta.h,sha256=h-Nl-juTfwHZayPf9WljBf1jnk5PfI-Ru2Kr_apkFNc,901 +torch/include/ATen/ops/mse_loss_meta_dispatch.h,sha256=D593Yj7OdIHfHkHnBssD1fPypHwkdkyAOe7TAKThqVU,1347 +torch/include/ATen/ops/mse_loss_native.h,sha256=_qsXdPYoCunHQXDSXgZHNdPD3e-M0_q5mssa_6mLPg0,930 +torch/include/ATen/ops/mse_loss_ops.h,sha256=9e77xBdF-IfdCovytXPvqq_uZ0JCz3ufSll44casRfE,2170 +torch/include/ATen/ops/msort.h,sha256=pkrKB75OvyChw-96hJW0DDAI-DBIQpoNI5YEF5eH1-o,1316 +torch/include/ATen/ops/msort_compositeimplicitautograd_dispatch.h,sha256=82BvQXi36OfMnLZrY6DVcu48LbsN4OEF3LSOhEu_BcI,1202 +torch/include/ATen/ops/msort_native.h,sha256=XkbX2UZKCO41mw0I2bvmEr9L5kFymBHGVHqg8LBbURg,833 +torch/include/ATen/ops/msort_ops.h,sha256=ItL57pgGe9HAdGIL3O9rFzD_HYkUkB1guo6Ev96sZ7s,1840 +torch/include/ATen/ops/mul.h,sha256=qMxVJowLYRvtieYq6yGBF_-lugHMBPe7aBkdqUIEtmI,2146 +torch/include/ATen/ops/mul_compositeexplicitautograd_dispatch.h,sha256=a69JNDIc1hSkAPQNDqH4jdDWqQ5bgAFyNPEeKmCNnbs,1349 +torch/include/ATen/ops/mul_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Xr28UkFJa3yQFOWeHQ_O72reMb54lV9Sq4ikjMvvlM8,1170 +torch/include/ATen/ops/mul_cpu_dispatch.h,sha256=-woFz5eupSi_OySx8XwzFKM6QHBT04ignUeyoJboy7g,1305 +torch/include/ATen/ops/mul_cuda_dispatch.h,sha256=1VbMlejSaPKTzt5zk3qyyt2SVzd0nzBe11R3G77rnlQ,1307 +torch/include/ATen/ops/mul_meta.h,sha256=y2DCYeWOZRonZnGddFyosXmEoZUmO_isGl-8r_AZFCk,883 +torch/include/ATen/ops/mul_meta_dispatch.h,sha256=u6ag0eBAGAE44AsfaTdz0QSfrxgFlXX56jY_lW8poGs,1307 +torch/include/ATen/ops/mul_native.h,sha256=wVaYNUH0GqOJxrQ4cY4yHtbzzpFZ1LQSjuwwOYyX3vA,2786 +torch/include/ATen/ops/mul_ops.h,sha256=YMG_y4vWTPx6kGbeJsPlbourhaGNi7XdNDDEePNYqX0,4541 +torch/include/ATen/ops/multi_margin_loss.h,sha256=K_cxmbMg4U38IAcJwrDh0IXAPkerUfZlxiomKwiSfhE,2276 +torch/include/ATen/ops/multi_margin_loss_backward.h,sha256=zUAFmy_Rm3H7-IJvu4MEM3tex2zicVZZcN0w2BINJJI,2611 +torch/include/ATen/ops/multi_margin_loss_backward_cpu_dispatch.h,sha256=_DCw682hLohy-yuBySyIXU560O-2RXz2dV-RA81JL4c,1794 +torch/include/ATen/ops/multi_margin_loss_backward_cuda_dispatch.h,sha256=yM_qGvUPLn81d1O3eJO9mnvl0Xjxkk2Qt5nzR6Cz-lA,1796 +torch/include/ATen/ops/multi_margin_loss_backward_native.h,sha256=7nnTF8NGY4sA77c5cB4DDjvn9HXOmCsCHN5iVoiFVBw,1811 +torch/include/ATen/ops/multi_margin_loss_backward_ops.h,sha256=JvfbF3VE1qlNRhGjknC5MUVPooaEu2SsImiVfEtX5Og,3146 +torch/include/ATen/ops/multi_margin_loss_cpu_dispatch.h,sha256=ELrr1HIFOLSkAQnNG7TyKBrdBr-2bM-QVNsxiPgwKvM,1665 +torch/include/ATen/ops/multi_margin_loss_cuda_dispatch.h,sha256=9uK53xfmBqdV4Scs51_CqviHzl3KcSy34lBTHEGC4BY,1667 +torch/include/ATen/ops/multi_margin_loss_native.h,sha256=3pmBH211GkPEkB2WJHoBUVkf_NTCsz0JLKQbeXtsDyI,1641 +torch/include/ATen/ops/multi_margin_loss_ops.h,sha256=5hAQPF4bnTJ4U8IEaYoEmrVsONkHzvKH8CIpUEEU4-E,2850 +torch/include/ATen/ops/multilabel_margin_loss.h,sha256=7UrGqhZU1VEkCX30fAKXXFovsBPMbPU_DRtaKwlmOPE,1826 +torch/include/ATen/ops/multilabel_margin_loss_backward.h,sha256=OxYh1exMYfQeL6Ylw8ULDkWIvt9y3dkJv-kMSyvWnrg,2303 +torch/include/ATen/ops/multilabel_margin_loss_backward_cpu_dispatch.h,sha256=qyObU1vStGeYaVN_Y-Eqpt988iF40Ej7Y5jWbmDxzf8,1574 +torch/include/ATen/ops/multilabel_margin_loss_backward_cuda_dispatch.h,sha256=I2YaasYvJU6qm_-IoG0NVhKYe-hahPxUFhXIiXmRPWA,1576 +torch/include/ATen/ops/multilabel_margin_loss_backward_native.h,sha256=w-eZc8lNU5-PNwtkV3QMufh7k-u9bXnqllA4IdLsUW0,1533 +torch/include/ATen/ops/multilabel_margin_loss_backward_ops.h,sha256=p0RJLsHPdgPghbMA9ppQSEdOEC-SZ-lICz4MJ-M8Vdc,2744 +torch/include/ATen/ops/multilabel_margin_loss_compositeimplicitautograd_dispatch.h,sha256=xg4qd5JiJVv9vQdAkoLBiTCTT0nhwSLMvyYTy52Jb3g,1431 +torch/include/ATen/ops/multilabel_margin_loss_forward.h,sha256=H8NEmnYC6jgjkSie4aTGnqh16JItkXhV12_dXe_tkmk,2129 +torch/include/ATen/ops/multilabel_margin_loss_forward_cpu_dispatch.h,sha256=PUhvFj2L-Ad9A1qmpuP8GdeQ2mmeN3gPQDg6B_9sHLQ,1504 +torch/include/ATen/ops/multilabel_margin_loss_forward_cuda_dispatch.h,sha256=-s9_yhhtqhTFvNeobSS30ZSOMNfrib3rGlCCnZkMBkM,1506 +torch/include/ATen/ops/multilabel_margin_loss_forward_native.h,sha256=u_fuLAoWoo6ZRj5VsbOAjLh78ZWp2s3q8k9LGjiitls,1425 +torch/include/ATen/ops/multilabel_margin_loss_forward_ops.h,sha256=78TGGLiBSZUCp7s2xKwfVVh7DgW_dKulmnVvLYh1lMU,2591 +torch/include/ATen/ops/multilabel_margin_loss_native.h,sha256=sHfatxtgFpaipw6lLGvoxsUGIzHx3NTi8sCpNnHpmMY,979 +torch/include/ATen/ops/multilabel_margin_loss_ops.h,sha256=EtMUUT_m6Rnb-J-RHy-bhkh4foiYC7_5GsrW3nDFxM4,2254 +torch/include/ATen/ops/multinomial.h,sha256=5CuoA8DJLN3imCE6unBEfXsLnXZ1QMurG_yncVMPwUY,5431 +torch/include/ATen/ops/multinomial_cpu_dispatch.h,sha256=jbGoHGXgixV35tyaK-8O5tWpdp3uzneVrujSO6z5gak,2008 +torch/include/ATen/ops/multinomial_cuda_dispatch.h,sha256=IXlXHhZexn3r_GjBCEfw_m2en8H81QHW-SLxLG66JLo,2010 +torch/include/ATen/ops/multinomial_native.h,sha256=hYjiab_40EttLM1cgdD43NQKhnsfHZ4osUTNH4ryM4c,1028 +torch/include/ATen/ops/multinomial_ops.h,sha256=QvMx-R969tKBy1x4q9QTNK6tw8r7qsMq-JTTcIu19f8,2463 +torch/include/ATen/ops/multiply.h,sha256=ilzzzzx3SkYT74x0LiKSBaN1X56JaeTlGPl5yL3vP-o,1708 +torch/include/ATen/ops/multiply_compositeimplicitautograd_dispatch.h,sha256=k6fdjl3AHqUdC2VE_TwtTCRGFTqaWlhVWBrsUwg7hXc,1532 +torch/include/ATen/ops/multiply_native.h,sha256=Fr0MtjsK2p8vNX-ejOEX34Y-TDEcKnWAQ6YQaQ2zzNo,1134 +torch/include/ATen/ops/multiply_ops.h,sha256=h6KxHU1q4DsQLbRPjsNbufz1EfwjtrHEYloGKoTKEVs,3917 +torch/include/ATen/ops/mv.h,sha256=3zVfP_ONp3Jb4dsME5N2znQG_Jbo0PIzq6xp9Fdd2vY,1409 +torch/include/ATen/ops/mv_compositeexplicitautograd_dispatch.h,sha256=fiMpptAfezmUcF8wPmkte9NRhDFdrbe6UkLeCq-PuHk,1265 +torch/include/ATen/ops/mv_native.h,sha256=-mDJiXdH6bGqUKrHwmnaqZZ7K0e5DHFEYZPRdL6Cklg,957 +torch/include/ATen/ops/mv_ops.h,sha256=1umTDqxevo_62gw9lu0bcnfWcps38XqqMWp7xaZ2KLE,1982 +torch/include/ATen/ops/mvlgamma.h,sha256=aZMOSe6wr5KGD9d_fzkErrehdKY-cAyF0Mv0qOeKgGY,1409 +torch/include/ATen/ops/mvlgamma_compositeexplicitautograd_dispatch.h,sha256=KNj7wl074xJpKsMpVccgTkZgMF1u12dEStdos5HJAYI,1124 +torch/include/ATen/ops/mvlgamma_cpu_dispatch.h,sha256=X6DEh_qdtEN-xX9cKlYCzlwDgK9NSUum5MJSJ3RQ5m4,1132 +torch/include/ATen/ops/mvlgamma_cuda_dispatch.h,sha256=_DDu0v5VUphve1nentJ8WV6MmOrpNQlz735Q4iTTH3Y,1134 +torch/include/ATen/ops/mvlgamma_native.h,sha256=TU4GZMjBpTJ2lAMivSdp-McQssDyNmP83RTpJs3t7ZQ,926 +torch/include/ATen/ops/mvlgamma_ops.h,sha256=cp0PUt949_TDXEj59ZEH-1rJp6sHWkTHXk-xSlSLKpg,2488 +torch/include/ATen/ops/nan_to_num.h,sha256=IyK_8UMUb8u26UmPMSy6e5_SxN1hJsoUJIOtwS7kduk,2344 +torch/include/ATen/ops/nan_to_num_compositeexplicitautograd_dispatch.h,sha256=KbKl0PQ7lLuklI-Y3kVilllt0U6rdRkbyuWYimu-ORQ,1382 +torch/include/ATen/ops/nan_to_num_cpu_dispatch.h,sha256=NtODt4KsOQ04r-BQ-Rtk2iTItV5v99bBM5MeFYK9ZV4,1345 +torch/include/ATen/ops/nan_to_num_cuda_dispatch.h,sha256=QYoCJhon_dUhcBZdJGSsDBV63q2Pc87yc8GMV8UYg40,1347 +torch/include/ATen/ops/nan_to_num_native.h,sha256=bdyv-umM70Ie0Hh__oM7rnBJF4FObW8cmkfHkSk8yNA,1856 +torch/include/ATen/ops/nan_to_num_ops.h,sha256=UE8KcFVD-7ljbu3Onen8d-ajj_gryx1lJDEmkmzXXmo,3346 +torch/include/ATen/ops/nanmean.h,sha256=ZxcIKIeLR4l2fmS1rvSq06dcH-HdwiO_TkzKmIP7R7I,1906 +torch/include/ATen/ops/nanmean_compositeimplicitautograd_dispatch.h,sha256=ViVWACRU9m03BphT_AYIUw_wIoec9Jv3EEn887PEFHA,1526 +torch/include/ATen/ops/nanmean_native.h,sha256=10cy0UXFfz90dCegQtyofFiJfv14K29VlS2yLyn3vtM,1037 +torch/include/ATen/ops/nanmean_ops.h,sha256=t1t-EBVVDJLT7yZZ74r7L_q8i-uASclyeCTlWz-Pufc,2435 +torch/include/ATen/ops/nanmedian.h,sha256=t4CDRPVc0tU3PP2c_Itmanfyb3Zi1324TIa8qznjA9Q,3628 +torch/include/ATen/ops/nanmedian_compositeexplicitautograd_dispatch.h,sha256=dkrq0HdkuaUg-E698fK8XDl1UOenjdc2QXHce5ZC86U,1272 +torch/include/ATen/ops/nanmedian_compositeimplicitautograd_dispatch.h,sha256=DBNN0oGyo4abMXA0nw_jHSvR5-mA3KV1S2xxFxpBFP0,1448 +torch/include/ATen/ops/nanmedian_cpu_dispatch.h,sha256=odN3bqNd52M9pCwOX3LPYQzHhkxfjJty8LIeQPSRFPo,1334 +torch/include/ATen/ops/nanmedian_cuda_dispatch.h,sha256=6hgeCbXRRMdQutWMj3RZFSkv66m4ZG8tu7TBYvLNZMc,1336 +torch/include/ATen/ops/nanmedian_native.h,sha256=5Mgeb5TpHVbGYfbY1e7-_HZ2DDXFcVEMfRL1Y5VE8fo,1640 +torch/include/ATen/ops/nanmedian_ops.h,sha256=B6XzvK3cDFVoVDjHO9bmTCRgAYFyIZmrTur2N57wDgM,5242 +torch/include/ATen/ops/nanquantile.h,sha256=sOlgAvwt3WUIY5RGGiVmlyZoqsGJ0QcxOFbRdc3DL_o,3307 +torch/include/ATen/ops/nanquantile_compositeimplicitautograd_dispatch.h,sha256=oHLVOne3mooPqGSd7ZH7Jd0z4y7nfWoFPrOvjg5-_e8,2121 +torch/include/ATen/ops/nanquantile_native.h,sha256=CEqqRLA33O7bivNiHu63VUVW1Wjm5Yy5VRJ0y1jNgMM,1417 +torch/include/ATen/ops/nanquantile_ops.h,sha256=Ehh2RM20l_ROeqdwNIWWJ32AvLFHho_zPya05WqoiPg,4347 +torch/include/ATen/ops/nansum.h,sha256=CdmKxrS52RzbXcxF-hEmmYcEY1wW7HcgwBw9H2cjl2g,1896 +torch/include/ATen/ops/nansum_cpu_dispatch.h,sha256=xpGEBqcO8OamD-697HIfPhzJxrTve15b_ZmiwALPgnY,1479 +torch/include/ATen/ops/nansum_cuda_dispatch.h,sha256=Kj-VFd1i07Ary1nfKCX8DfH91zBVqNL5GfBmAnGZTWQ,1481 +torch/include/ATen/ops/nansum_native.h,sha256=OYLvV88SNgMaIGmNNL2_MuQWzrxCCutSBVsESM40iiQ,1035 +torch/include/ATen/ops/nansum_ops.h,sha256=cG_BZv2gyeAsmfRaHKTZ-j1zMPtjHNEBlkHIwOyHfVE,2429 +torch/include/ATen/ops/narrow.h,sha256=HNK-i3zndZl0bb2YOMVuEJdX0tSjq2lwn8SF2uFFyjo,2967 +torch/include/ATen/ops/narrow_compositeimplicitautograd_dispatch.h,sha256=_ce5JLgMmQpChkxnJ1QXzMvtTgzWpkHLFKmLo6akWro,1435 +torch/include/ATen/ops/narrow_copy.h,sha256=JIL9wRjWVpwbYgQ4OvenqYCBuJfYgGDM27e_yIytfho,4435 +torch/include/ATen/ops/narrow_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=df1m1F5jJJRT83CNfqleB5aFn9eNrBx92_vHkqQuABk,1240 +torch/include/ATen/ops/narrow_copy_cpu_dispatch.h,sha256=bla30OprEjDcZuPTQ8A01zXnZQTyt0Pg112DDquar3Y,1714 +torch/include/ATen/ops/narrow_copy_native.h,sha256=2YbF8-E8BdmO8UFOYVu6lYJNM-fZixTqKI8NFNby4f0,1189 +torch/include/ATen/ops/narrow_copy_ops.h,sha256=k4G3YqQIUoJyDPD0grjNwF1J1MAWToO2JW25cJDtL2A,2230 +torch/include/ATen/ops/narrow_native.h,sha256=KdcqK79bJj_ZrMQq7T67srsDa9F716hmEHXux0DiZAU,1064 +torch/include/ATen/ops/narrow_ops.h,sha256=MzvuTJS3m9A-ucYRq9LNYBA3Uj-qzSpJSz0wnzId4dw,2163 +torch/include/ATen/ops/native_batch_norm.h,sha256=XX6yA3Gos2gTqYfefwWxsYb95Vn3eAvVFGE7t-fkVXk,3101 +torch/include/ATen/ops/native_batch_norm_backward.h,sha256=NBL41Xt9UKTdfAsP8snbzEVfdzZgb5g5JRSNvo0-1BA,3635 +torch/include/ATen/ops/native_batch_norm_backward_compositeexplicitautograd_dispatch.h,sha256=EZI3UgOVxHT9yY-h4sGsqq8SLFJEJCZO58anmwtCjB8,2002 +torch/include/ATen/ops/native_batch_norm_backward_cpu_dispatch.h,sha256=CYXtismsiSHakFX-Gesbzac_VqkyaffQKiMbAcibj8w,1385 +torch/include/ATen/ops/native_batch_norm_backward_cuda_dispatch.h,sha256=hgH5698fSNxuWHerM0uxaiEHryQtNSPJVPrfnRHKOeI,1387 +torch/include/ATen/ops/native_batch_norm_backward_native.h,sha256=ka-EZ0B9sWtRzN_yjekMgp_PeFZmZojMMGGCG9XMH2s,2515 +torch/include/ATen/ops/native_batch_norm_backward_ops.h,sha256=8mvYH9rvyGhDO1_mI7MEQBSP2RNYIudfvuIMcisYxSU,4491 +torch/include/ATen/ops/native_batch_norm_cpu_dispatch.h,sha256=bMFEFi8f48CGgnRUdZwdcXHxXIQoW36qDLQA-iW1f5M,2100 +torch/include/ATen/ops/native_batch_norm_cuda_dispatch.h,sha256=wpOjj8Vrg4u8LGTet-5lzYJWtAIUkyJf9obqRQHW7Cs,2102 +torch/include/ATen/ops/native_batch_norm_native.h,sha256=oDTyFauOqpq8fEniMfysa9nJDwQ0CZp5EtQoUAhQJl4,2507 +torch/include/ATen/ops/native_batch_norm_ops.h,sha256=SFw6lqNSEJzDZBQirUmKvbGLHMV8e534TPmJ7LiXTnc,3850 +torch/include/ATen/ops/native_channel_shuffle.h,sha256=KYl8-MWkcji5Um6WhFxcqD4OshfIx7T5qUmR2QBmQPI,1788 +torch/include/ATen/ops/native_channel_shuffle_compositeimplicitautograd_dispatch.h,sha256=qtivOevps64ayWJCCpirj_sYB3r_oKu6EHi9uLT-vCg,1176 +torch/include/ATen/ops/native_channel_shuffle_cpu_dispatch.h,sha256=gRCc8QsVPgoZjvkm32xfHSEF2U-8fx5bjZhtiUqvUvM,1132 +torch/include/ATen/ops/native_channel_shuffle_native.h,sha256=r2BJNDtnXEBrPdbk9YVVnih55oJJ1qO3e0mRjMfAnso,870 +torch/include/ATen/ops/native_channel_shuffle_ops.h,sha256=n-sVX7r0AWdVCcA-3wHS9WMZGuiqHoumXNud8DGQOw8,1361 +torch/include/ATen/ops/native_dropout.h,sha256=TyVq64MYcHlZXGohYxlcyyoFVsTebe9R4lvX5PicHuI,1835 +torch/include/ATen/ops/native_dropout_backward.h,sha256=UEaeKk4MJTU7E32WbVrvs-6y5QJVHaKVTCT4NiPp0qc,1793 +torch/include/ATen/ops/native_dropout_backward_compositeexplicitautograd_dispatch.h,sha256=_twAUsk0zMOZtZwibCbIpwRQNVydGuodCPl8MffKDzA,1276 +torch/include/ATen/ops/native_dropout_backward_cpu_dispatch.h,sha256=3sn9R85IuC9t2STT0HljH54At6dbrp-a-sl106E1dCk,1065 +torch/include/ATen/ops/native_dropout_backward_cuda_dispatch.h,sha256=gpwwy9rG_IJEoRYyAVK911PN9JHWzS-Q_p-gvPC5v5Q,1067 +torch/include/ATen/ops/native_dropout_backward_native.h,sha256=Myz_rxj8yp4tqFFvEkZVocT49hbw3Mh46yNmvbEf1b0,1084 +torch/include/ATen/ops/native_dropout_backward_ops.h,sha256=nTE1uRFunYHVUdj9rJuFOEoUOossLHHBoFgsJZouUWE,2254 +torch/include/ATen/ops/native_dropout_compositeexplicitautograd_dispatch.h,sha256=ldJpO-pEFvP1eE2MbyXB32GEJv_de02MVKVRd07eWKE,1340 +torch/include/ATen/ops/native_dropout_cpu_dispatch.h,sha256=rUz4oD6uOUZy7mK-D_vps4RCrH1DNtRdBzWWkD-USRE,1075 +torch/include/ATen/ops/native_dropout_cuda_dispatch.h,sha256=f9pFy3PwrtrUGj74VHlTRXWZJZUFXRZnIVFXFMK3Vlg,1077 +torch/include/ATen/ops/native_dropout_native.h,sha256=zeKHnYdOcM66h8paGKsrNIV011agY3cpU6dj7B14m8A,1275 +torch/include/ATen/ops/native_dropout_ops.h,sha256=vWigaASXv_DVtkl4A84Tc6V5rODkAodU3BhWxm1XBi0,2414 +torch/include/ATen/ops/native_group_norm.h,sha256=_clBf6wvoK0WQ8Mjmk78cCDm0QVjug2jA6RWVisRzrI,7563 +torch/include/ATen/ops/native_group_norm_backward.h,sha256=rQQt7f17cz22WUVxU4qiq18qIrJcDZ7GAfPNZZXORE4,9072 +torch/include/ATen/ops/native_group_norm_backward_compositeexplicitautograd_dispatch.h,sha256=1XMv_iQoSQyIOZuJsXEe017k57EqFMqbe2fdnv0DMCE,2575 +torch/include/ATen/ops/native_group_norm_backward_cpu_dispatch.h,sha256=UDTHU0vtgsNLxzoM1YKvzlqTs_yIIQhAXAnI9qsZoZE,1604 +torch/include/ATen/ops/native_group_norm_backward_cuda_dispatch.h,sha256=1lX62KbyLrXETwPb-Zx6M45fZ-rYDl-7P0m8VJm8wgI,1606 +torch/include/ATen/ops/native_group_norm_backward_native.h,sha256=TM4N5WmQssPujp2IgB7B7V9g0e1ROFQ_ayTn_Z30hHM,1425 +torch/include/ATen/ops/native_group_norm_backward_ops.h,sha256=Sxn6s0F_L_5466oJQKay7Nn2W6w187EShWlnCZRI3yI,3841 +torch/include/ATen/ops/native_group_norm_compositeexplicitautograd_dispatch.h,sha256=ydpYEy-FsGjxvyhtS9WszHSiXwYsdGc2ZjGkqbqzhP4,2824 +torch/include/ATen/ops/native_group_norm_cpu_dispatch.h,sha256=GrUCRcBYeYwyshX-OIvjsP3ZRc0vF7Ht3C-s6tHLFT0,1468 +torch/include/ATen/ops/native_group_norm_cuda_dispatch.h,sha256=SHTOetFMZZ_sksADNS7tyPEMZ5ykvSU6tOt1neKe-G4,1470 +torch/include/ATen/ops/native_group_norm_native.h,sha256=ZzjvE6tZ4G7TxAaUn0lxv_0gFo1TEDRnHGnHAi5nebk,1538 +torch/include/ATen/ops/native_group_norm_ops.h,sha256=KWEMcfSbYsToq56Ql9DkSkhtq_VS_9ojj26zODgldwA,3399 +torch/include/ATen/ops/native_layer_norm.h,sha256=7isUxVayOLMFWpcHS-AFuseKNTx5dq3KKcI8IGxRMeI,7383 +torch/include/ATen/ops/native_layer_norm_backward.h,sha256=lRIFqKxk55aG2_PcVljzb1jKfXC5sKO2F8GXdd1o0sA,9552 +torch/include/ATen/ops/native_layer_norm_backward_compositeexplicitautograd_dispatch.h,sha256=WtFR40g0gq9QoHAfCs1aSVbreWKFgSKESU2-eOPDWT8,2663 +torch/include/ATen/ops/native_layer_norm_backward_cpu_dispatch.h,sha256=Zy0Ssx0WXRt7vq3u_Fx_oDiAHJdWHpzznPkBTHEiFUo,1648 +torch/include/ATen/ops/native_layer_norm_backward_cuda_dispatch.h,sha256=H5mzpf1p0E_3Hu55D1qUBt1R6eXT1uLSWGE8BK4LDfs,1650 +torch/include/ATen/ops/native_layer_norm_backward_native.h,sha256=wJW_vtNHXkd76k88dqwdbkO2nSPFPmTvIB4GGVq2mmA,2154 +torch/include/ATen/ops/native_layer_norm_backward_ops.h,sha256=DUzut64N0axf_J2UV3GCrzbnGwkvApKw_bGcoevKuUk,3929 +torch/include/ATen/ops/native_layer_norm_compositeexplicitautograd_dispatch.h,sha256=QA3EFDjnea4dKSFcS4Ii4LpEdZfKBlnF6von2VJpvfA,2704 +torch/include/ATen/ops/native_layer_norm_cpu_dispatch.h,sha256=8sKG9YnZFMnappgLg-egl4UOHUKWPnI9hanSokvroGE,1428 +torch/include/ATen/ops/native_layer_norm_cuda_dispatch.h,sha256=eRLALmraMdLhezm1t1GQxfN3QOShlS95aD-bCWj5orc,1430 +torch/include/ATen/ops/native_layer_norm_native.h,sha256=fblKI2lvxuIjmY4LUVB6n3XIG2uLhvkh7bHhuaBAChY,1954 +torch/include/ATen/ops/native_layer_norm_ops.h,sha256=TRjfzWQVtuxOliS-XaKQds8sKE4rAP1QlFGFbKZXd_Q,3217 +torch/include/ATen/ops/native_norm.h,sha256=dB9nG8NjVuxe2Ijs1Zjk46L1zr-cQW6yQFlfmVkYwLk,2774 +torch/include/ATen/ops/native_norm_compositeexplicitautograd_dispatch.h,sha256=6LCMSzd4Q8j3vzcaQjCg4dsZojUt-9ogePsHr6RRVfE,1601 +torch/include/ATen/ops/native_norm_native.h,sha256=_N6Qmcdf61e34gRK-TxoeUyJ168BPoCczYu1wKlBu4w,1281 +torch/include/ATen/ops/native_norm_ops.h,sha256=UnAar9_onpOpgbzHaN-69OwymKUGpZJFhCfsw8MfEwM,4039 +torch/include/ATen/ops/ne.h,sha256=f0dbc7ST4N1gyjrnZh9EWUfazNODSRHjSKphxyImRps,2155 +torch/include/ATen/ops/ne_compositeexplicitautogradnonfunctional_dispatch.h,sha256=KeWM14nu-pzo61eyPQaCEUfuJZpE0RqlkIQj4U1qFLc,1319 +torch/include/ATen/ops/ne_cpu_dispatch.h,sha256=5mVH3e7Rzc64WmuY0bN8OH3Jim7QzcXrYe9hetZLa38,1655 +torch/include/ATen/ops/ne_cuda_dispatch.h,sha256=XAu4RpHrzWPSAplcabYG3xfBTc_GZK_0Q9UPJpludP0,1657 +torch/include/ATen/ops/ne_meta.h,sha256=VZXa1jeO-OqYWiUOPxJm24L6ai7l7YiGjudCog5y3bg,1026 +torch/include/ATen/ops/ne_meta_dispatch.h,sha256=7Shi3J0aEuZA8YbZRRXzhFXQcveeb8R5dsF-pXgOSZQ,1657 +torch/include/ATen/ops/ne_native.h,sha256=VvEz66ubUuVHTXArozmIi6L0XO9qC7W9hzFFYumIVbU,1494 +torch/include/ATen/ops/ne_ops.h,sha256=wLYUnha5BgEf93jG1Zzzo-3y8svJ1GkD-0FC2G0Seo4,4544 +torch/include/ATen/ops/neg.h,sha256=1_5imvckI1_IRh_C7hoAokTXXMAUlBuXPS2oT_pCVdM,1434 +torch/include/ATen/ops/neg_compositeexplicitautogradnonfunctional_dispatch.h,sha256=0Vu_W2_2j__CGcxetF-ouMFezKCQm7PRaGKqNAx_918,1118 +torch/include/ATen/ops/neg_cpu_dispatch.h,sha256=bvsjclOU1UVNqItq0qpp82qHjBSZc3lBTM4Jmr99dg4,1201 +torch/include/ATen/ops/neg_cuda_dispatch.h,sha256=HyEqlVpQzA5C9NpHWg_REExsm9i5IslCj7Yefx2JodI,1203 +torch/include/ATen/ops/neg_meta.h,sha256=H_MYycXfT-Hzshl52zpXWlGXxvAptGBA0pgLRil6cjE,850 +torch/include/ATen/ops/neg_meta_dispatch.h,sha256=WZF-cuzKYqPgT1J0eF-YPDbn2dicS6TIaqpFhVdZcT8,1203 +torch/include/ATen/ops/neg_native.h,sha256=_JrgU_oQkT3BLl7wyckkVBdTOgRouUFpY5K06C1AH1c,1404 +torch/include/ATen/ops/neg_ops.h,sha256=gm-zqx7r-LpXxmzmpZkWFqLnn6OVQaB4DV2G73HvcjY,2329 +torch/include/ATen/ops/negative.h,sha256=4KCgl9Mfti-RvG5RqHa74dYWV4MWe1gWkdsfWdM2MSc,1499 +torch/include/ATen/ops/negative_compositeimplicitautograd_dispatch.h,sha256=cWV15ViWUmiND8rezlkJC-A8hogrt2NUnO2fTf5EJgw,1265 +torch/include/ATen/ops/negative_native.h,sha256=ZzhtP6tlqsBLfFeWBTl5hYcP5l_gWf5SBbmGTOuwheI,893 +torch/include/ATen/ops/negative_ops.h,sha256=rjobl-g9stQGMx00kwX1le4r0DMW4btbdGUpNWCkBrk,2374 +torch/include/ATen/ops/nested_to_padded_tensor.h,sha256=5yLZ2mRpSZlYdBpAVxJDrdizMH1jDcOn7_TJF8Tsu3A,1125 +torch/include/ATen/ops/nested_to_padded_tensor_compositeimplicitautograd_dispatch.h,sha256=y8MAJkjZlEOFDBstkMVVxitByNi-LVFZiucJm5BnH7c,1131 +torch/include/ATen/ops/nested_to_padded_tensor_native.h,sha256=TKnrwmfeuGE5doZ_jcfLXA0HCY1iF3rdXu0It6bQRqA,841 +torch/include/ATen/ops/nested_to_padded_tensor_ops.h,sha256=ObtKfbaAn-LF0_PXDQKA_9GQJQY9fF0I5qaGN8UJwFc,1475 +torch/include/ATen/ops/new_empty.h,sha256=shTO6gkAhUttJXDYgBUSkUC9B3zUB02oIW3_tQPgXik,4692 +torch/include/ATen/ops/new_empty_compositeexplicitautograd_dispatch.h,sha256=biE4ZAJ-iEwMrEH8KaWCO-zr7HjV3euxZ9b0pHPjTH4,2123 +torch/include/ATen/ops/new_empty_native.h,sha256=g-INKgRacQOgtnY0r8y_D9gfOZ_RlMaqdI2n-rOJSNw,1064 +torch/include/ATen/ops/new_empty_ops.h,sha256=u8jYkBD0j8-TQl4_yLS8BFL82w_UAhvpsdz2rb4fFHk,2536 +torch/include/ATen/ops/new_empty_strided.h,sha256=6bNkgABSyl8VKPODHxsJtKD4-E3zWl48x-JxKiUDx2g,5556 +torch/include/ATen/ops/new_empty_strided_compositeexplicitautograd_dispatch.h,sha256=1dLMFjcTKJZRrL6J9XWENfsm1XrVJk6_6Kc3-r6IuLo,1567 +torch/include/ATen/ops/new_empty_strided_compositeexplicitautogradnonfunctional_dispatch.h,sha256=93JYmgYb0BbGXW8kjXepJ_BoqBvqQPbVsMML4ZI1neA,1845 +torch/include/ATen/ops/new_empty_strided_native.h,sha256=HpMPIXMS1TZYt6Ni0AxQiyo2ub_ISv-gbQEFBg3M_to,1136 +torch/include/ATen/ops/new_empty_strided_ops.h,sha256=PlkjOFEoOI4xufaBznojDnoD_cQh-ZIcd5V1G7U4qA8,2772 +torch/include/ATen/ops/new_full.h,sha256=OR6XQwjErvW2msvEuroZtjw-f_gh2y4jqU0Y-tpe8Dw,5255 +torch/include/ATen/ops/new_full_compositeexplicitautograd_dispatch.h,sha256=F3uO08bCqFLmVpPXEZY8hPwOyEpFJUeqe28ILj3LeJA,2363 +torch/include/ATen/ops/new_full_native.h,sha256=shfCWvsVW16j2zgwO2QJC5r8QVIRiBP9k0n44N2fAWI,1113 +torch/include/ATen/ops/new_full_ops.h,sha256=07PKriXrEOKjfMrqJjB7SojbxgvoFwKwaNp_j8WfVBs,2732 +torch/include/ATen/ops/new_ones.h,sha256=LdXHMYt2ORpqGNhPcC-3WfqkZtu8BvPTiLSVsVZ4iU8,4663 +torch/include/ATen/ops/new_ones_compositeexplicitautograd_dispatch.h,sha256=yeO6JTGz_iTCVm0UUsv1R9x7UY1VLXMuNEDwf7dB6fA,2115 +torch/include/ATen/ops/new_ones_native.h,sha256=JuZuR8hBF99lgVFyf5_yzaiHqLiMNyB__gtR8RhTsFs,1051 +torch/include/ATen/ops/new_ones_ops.h,sha256=qrK6wzJSYJ0SO-dZ-Rl-vugGRgIymLXRfPfzSgjw9vQ,2530 +torch/include/ATen/ops/new_zeros.h,sha256=yTwkY2oJlnDCmpttgI0Kz1DQAwV3w0CWxQfgBlEareI,4692 +torch/include/ATen/ops/new_zeros_compositeexplicitautograd_dispatch.h,sha256=7dsWIauxrZnZL3V9ZWS_a95cuXj_mD04F8lrl5x2fUc,2123 +torch/include/ATen/ops/new_zeros_native.h,sha256=Mb-6quQ0zm6PaAotmpQtcgFVnwHchGgnS3nRA0r3eQI,1053 +torch/include/ATen/ops/new_zeros_ops.h,sha256=e9LQbIPTAu7jdcsu19wAJ_qhcIlWbCl5TWmKAF9uUA4,2536 +torch/include/ATen/ops/nextafter.h,sha256=FtO0VKQKrz6HO8bFkh8T7H_3hC8m-3Tc_VSCsoUh37Q,1497 +torch/include/ATen/ops/nextafter_compositeexplicitautogradnonfunctional_dispatch.h,sha256=N_cTEsAQ3kV2dPJJm2sui5mnn8Mp5qiQClcxGPL_xZc,1182 +torch/include/ATen/ops/nextafter_cpu_dispatch.h,sha256=Zv-Q-H7KC-USnMcWGJ8H-Aj3Jp8CNmwpnI0P61d8-wg,1329 +torch/include/ATen/ops/nextafter_cuda_dispatch.h,sha256=K0pR0arbFbaegbOYUHd-K9CiujA3en9Fuz2LOgrt3SI,1331 +torch/include/ATen/ops/nextafter_meta.h,sha256=xA1dFQMJ2B0-O2w3Db-B1cqKREXaAWA-C7U1RBczfyY,882 +torch/include/ATen/ops/nextafter_meta_dispatch.h,sha256=2F4mnc8nN3lJDzUd-AvGf1tvvauIYFhL2byuawYIemI,1331 +torch/include/ATen/ops/nextafter_native.h,sha256=YQ-Wz9BVh9K-XVKwLbDPMML582Waer408ANLVg9F5mg,913 +torch/include/ATen/ops/nextafter_ops.h,sha256=5p0OsTCIlgYKeQP-T__6Sl2CvLdZOLwpuEkafLv5ueE,2641 +torch/include/ATen/ops/nll_loss.h,sha256=R3cy1-y11pcQpIv98vsgZduCccTWzjXa4JcxK-3-CZc,5874 +torch/include/ATen/ops/nll_loss2d.h,sha256=DQ-BGnfClcQxkLUexaSFrlLjUnyZj7GcZfJpIdB5pzQ,5936 +torch/include/ATen/ops/nll_loss2d_backward.h,sha256=HevzAqQNjyKAAZTe9UzmWM63dNcbB6npjIRXolmwCPg,7475 +torch/include/ATen/ops/nll_loss2d_backward_cpu_dispatch.h,sha256=bQWUO2fShJddk1bwBTUg6_EE8rqGD9be3hXXjmAdV5k,2576 +torch/include/ATen/ops/nll_loss2d_backward_cuda_dispatch.h,sha256=2WRljNEemrS6HjGPGZexbDVR8I_d1wfdGcj0SRFzsC0,2578 +torch/include/ATen/ops/nll_loss2d_backward_native.h,sha256=TZSDaMIgIpwrV0QHTXa7hCplF73hl1uof7FsHXq4R9k,1761 +torch/include/ATen/ops/nll_loss2d_backward_ops.h,sha256=ssnnWGaGCZG_Ibf5BsEEpN4r9naXE_6x71L6c9YvMns,3144 +torch/include/ATen/ops/nll_loss2d_compositeimplicitautograd_dispatch.h,sha256=_Qhsje3ciJFVZZUYX5n6l9kYwjrBX5JMnKfSJPSDmzE,2260 +torch/include/ATen/ops/nll_loss2d_forward.h,sha256=UWauhfokrFVQaN72d8zrNRejon-mYP9lIOZbtfqRN2w,6826 +torch/include/ATen/ops/nll_loss2d_forward_cpu_dispatch.h,sha256=XhYx_Jkz9eq55CJnuvVz81U-_THrnvWwEkYQKO5n_pQ,2430 +torch/include/ATen/ops/nll_loss2d_forward_cuda_dispatch.h,sha256=RIclKKhvUsxN0dsbsYp7BJgWVkl-OiwzH8p21Zg7Dcw,2432 +torch/include/ATen/ops/nll_loss2d_forward_native.h,sha256=pN9s4EZK1aOiXQ-Bhd8iGfiN0Nm692sY0m47eOsrgiA,1647 +torch/include/ATen/ops/nll_loss2d_forward_ops.h,sha256=zYgr3R7Omvx3HWOy1VYti3O9XrgNKoCRKa0azMjiqaI,2985 +torch/include/ATen/ops/nll_loss2d_native.h,sha256=-1JuPE9MXupZiWvwrQO3bQ64MjL60UaENwz4vjGiGG4,1106 +torch/include/ATen/ops/nll_loss2d_ops.h,sha256=XByU5Wf_AgR9IW63r4uSDmoWSa-qCe-OSgN0q09nIv8,2656 +torch/include/ATen/ops/nll_loss_backward.h,sha256=NlOJA-iuG1_nsRUZ7uXZ4qJ07TQf4DyF83pJGO8Nif8,7413 +torch/include/ATen/ops/nll_loss_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=_-VoDkZplsSvrb9XO3ycR7szfipmRNi-4z949yJOLHA,1514 +torch/include/ATen/ops/nll_loss_backward_cpu_dispatch.h,sha256=rJhcoR6YnIPt0YG4SN4hMqp1fCtXMdChKsJSLdFcPfU,2564 +torch/include/ATen/ops/nll_loss_backward_cuda_dispatch.h,sha256=KK_kqdt0FqkrSFm5t0HFWKg3pvUPCyrZ5qGt0qSwgCI,2566 +torch/include/ATen/ops/nll_loss_backward_meta.h,sha256=oVZD-xDUZgZuphSk_Tg2-YBcEYeMrnjC-4xH6w22l0M,1027 +torch/include/ATen/ops/nll_loss_backward_meta_dispatch.h,sha256=oUJ5cQJCKBBYP4D_7NrbKmdkh_JpWUlOpcwMzxf6yCM,2566 +torch/include/ATen/ops/nll_loss_backward_native.h,sha256=u9mfKgq32Gc8K0PkbJJlLvfisujkqG2k2N7TpbJ1t10,1426 +torch/include/ATen/ops/nll_loss_backward_ops.h,sha256=CAemCGwLlgXG8u9-b5sK2Chb8IuS59WoN3s9KWOM_4E,3132 +torch/include/ATen/ops/nll_loss_compositeimplicitautograd_dispatch.h,sha256=588pjijNxuhDs6J02eYW05fnUaLJyVoDwfF3443lik4,2248 +torch/include/ATen/ops/nll_loss_forward.h,sha256=rMA_rXmdQEzKFv-k_70eGSp3XsTvggRLUgtZMdksoCI,6764 +torch/include/ATen/ops/nll_loss_forward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=xQsKfpEaRxVhf_kN7mFk8VGfQndRP7ADTFDYKDnW7ic,1432 +torch/include/ATen/ops/nll_loss_forward_cpu_dispatch.h,sha256=ctEYZ7kJxxelckEnIF2K6y9z5FuT05BjWOLceiw-xeY,2418 +torch/include/ATen/ops/nll_loss_forward_cuda_dispatch.h,sha256=7Z6hNfQezrZ9D7QOKPHobRIb9UMM5lbbT3cboflCCqM,2420 +torch/include/ATen/ops/nll_loss_forward_meta.h,sha256=v8k5kHWeNo24UuJOaWrmLEjE82biyapvfGu_tndIxws,961 +torch/include/ATen/ops/nll_loss_forward_meta_dispatch.h,sha256=RY3-Hc3UVQHHW6Mtz9KYCQe00pdk0quJGcOH4qG0lj0,2420 +torch/include/ATen/ops/nll_loss_forward_native.h,sha256=xOo8i1g8nsKFNVoClg4b_r6aeU1L95nxAcX9MVcloFI,1349 +torch/include/ATen/ops/nll_loss_forward_ops.h,sha256=oqy5mJnnZAB8e-XStVbdF7y2hBxt58gNZytdYCkMBkQ,2973 +torch/include/ATen/ops/nll_loss_native.h,sha256=lUKZdNLW1tPqtsDTUCeUd1SLtvHwPE8Op9nM6tghiiU,1102 +torch/include/ATen/ops/nll_loss_nd.h,sha256=AGXETKDXibtMPJuTS_uZkCJBKNrsJRziDY0G6xQoNfs,2429 +torch/include/ATen/ops/nll_loss_nd_compositeimplicitautograd_dispatch.h,sha256=YfQ9HewuqEpQ183en4Y_xz0LzbWSmRHt8j4Q8htQ4ls,1402 +torch/include/ATen/ops/nll_loss_nd_native.h,sha256=yI_jtKaRzHAf_ovRHZHZw4QuUbxCinqV7hHWXV1fm2Q,912 +torch/include/ATen/ops/nll_loss_nd_ops.h,sha256=D5Zy6a8UwfGWbVF83TwnAQLptl15BWT_J7_QZp-_LiY,1653 +torch/include/ATen/ops/nll_loss_ops.h,sha256=o699SaJPMQegz8K1_JskYmJY7J5OLsdjVNo3ZJ1IGkg,2644 +torch/include/ATen/ops/nonzero.h,sha256=EeAAjLmUTo_pOOY1-75wQjywx_CPlBmPzWK6-55m_6w,1336 +torch/include/ATen/ops/nonzero_cpu_dispatch.h,sha256=5HZsKC5JKY4bmBurhcYyG8XvkbY0PPPuTlgAy_nS5uo,1164 +torch/include/ATen/ops/nonzero_cuda_dispatch.h,sha256=ppU-LgC50aJwnjZUkXpkHRFDmZ7CJlurJMmV0coWFpQ,1166 +torch/include/ATen/ops/nonzero_native.h,sha256=JPYNQu_geGeMHstuDI20TYjFkUA0oHlBg8kmliirPkU,991 +torch/include/ATen/ops/nonzero_numpy.h,sha256=UKWFfd6wtT7qndY1PN9cnaPUhats9G6pX6h0oF976LY,972 +torch/include/ATen/ops/nonzero_numpy_compositeimplicitautograd_dispatch.h,sha256=N5GBWh0h8MLse6pqhrHK9RVCiAx6QsaTfY-y34Srwx4,1068 +torch/include/ATen/ops/nonzero_numpy_native.h,sha256=Hh2v31aY55VIBmfvhnGcNOhuOWJTIZmWcXyZTSqgdzc,778 +torch/include/ATen/ops/nonzero_numpy_ops.h,sha256=MQppD8SDzNBKiyxgdzaqKPb099tycKwBu-8M7RTa0qY,1313 +torch/include/ATen/ops/nonzero_ops.h,sha256=w5jiI118auVbFcjj_oJCUmxgMmcYnJ-altjYqcwwWDw,1852 +torch/include/ATen/ops/nonzero_static.h,sha256=8b_iA29IpXcGE6Jo8ySYvk4zbTT5CkdvZwD_egIepS8,4354 +torch/include/ATen/ops/nonzero_static_cpu_dispatch.h,sha256=LK7kvf88IYAA0AOP3heOI1RLkYQSnBR8J3MyLL_l1y4,1672 +torch/include/ATen/ops/nonzero_static_cuda_dispatch.h,sha256=Q3JhywvlWLx81KrDiqWVkWcVJDcvDD8QcRXFb1tptos,1674 +torch/include/ATen/ops/nonzero_static_native.h,sha256=2wvxFXqdimx-ds9En-te8dmkxV_dGruQs8slLb72jLU,1161 +torch/include/ATen/ops/nonzero_static_ops.h,sha256=yhw8s9_jaZ8PsukGK1EjmYcYB7eaV52qNBJabhVEuOg,2157 +torch/include/ATen/ops/norm.h,sha256=hWP8Xkh58ooPK81mnQ1xnKySwE8IcqMvfy8YT08ng6I,6631 +torch/include/ATen/ops/norm_compositeexplicitautograd_dispatch.h,sha256=SBNGcUhq4f0cPKiwLCazGVYzx3nvVYjz_kGrp8ev2u4,1660 +torch/include/ATen/ops/norm_compositeexplicitautogradnonfunctional_dispatch.h,sha256=rXdsDX-lO8Qr7A8q5UXsIxcMz_F_T4r_eK8tTm39Ez4,1299 +torch/include/ATen/ops/norm_compositeimplicitautograd_dispatch.h,sha256=iwEfpRtGiRj6r6ZhMYRMFWYNX1rVCw0MufFj6DMb7PA,1929 +torch/include/ATen/ops/norm_cpu_dispatch.h,sha256=7TxyTiRJ37CnhkSVvDiaM8iO-PjnSE9NBpdkCHqBLNM,1885 +torch/include/ATen/ops/norm_cuda_dispatch.h,sha256=jSkyMFCUQ2i0Nv8h97NHI7PDe5eRmu7g_W-G7xXYG6s,1887 +torch/include/ATen/ops/norm_except_dim.h,sha256=nWyrg2id8bKgJj1qam1QvNNW5-N3IKVfgZPsnbaHxQA,1016 +torch/include/ATen/ops/norm_except_dim_compositeimplicitautograd_dispatch.h,sha256=X0NddCGPNFL4o9aolkbM2psm_kosWX-76EsX2t4lFwc,1082 +torch/include/ATen/ops/norm_except_dim_native.h,sha256=hOb6Oi8x2pkiEYzkfLAlYxAOu1EXAdWAr8D5uWlcZdc,792 +torch/include/ATen/ops/norm_except_dim_ops.h,sha256=jCkALBqW37kwzTzIxb_Bo1UNRLrVVE4vZZig6smW5o8,1355 +torch/include/ATen/ops/norm_meta.h,sha256=xIOrkNadk4Kr5E_4xS81kpNFEFLPOD5mu2nYfcX3c24,1140 +torch/include/ATen/ops/norm_meta_dispatch.h,sha256=g_Z58bz8JQ7Ml57RL8a4kggABArrz0ds5HFgBH7-cl8,1887 +torch/include/ATen/ops/norm_native.h,sha256=cT0QIIo-Xj6-lowU9i46ncTn0TmkHQ80mxN6SZdsOGc,2553 +torch/include/ATen/ops/norm_ops.h,sha256=ZjEqRtwJMGbIPVr0YpXx9j7bwGSN3_6qs0eQatXyz6E,10659 +torch/include/ATen/ops/normal.h,sha256=v85JWsShI0Qjq9d0SFN7EIAZe7bidUMjsCGc-EHDB1c,12090 +torch/include/ATen/ops/normal_compositeexplicitautograd_dispatch.h,sha256=2qKjaC8LkgW4QadfTwej8C5OWMD28KM4JWJ1OxpHxbI,2959 +torch/include/ATen/ops/normal_cpu_dispatch.h,sha256=fHSIxZ9IPzpx4yggMeEisvhYq5chvlMhMnBupUMmuBk,2343 +torch/include/ATen/ops/normal_cuda_dispatch.h,sha256=b7Ya7ogL9OEI0j85RIg2CJcvj66enrJKHegc22gyK2E,2345 +torch/include/ATen/ops/normal_meta_dispatch.h,sha256=m8qkQq79CYdPbFzteAv6UlypPn-Z5rN3W70PmG8rJxo,2345 +torch/include/ATen/ops/normal_native.h,sha256=eN9q9L4LSSgKn5G1qxpYXmWhbDZRgsFXNh8a1bPRNt0,3632 +torch/include/ATen/ops/normal_ops.h,sha256=IqsRTTFNqKW6MS2vtE8FsbLatB7Sclfdnz2RIPXOM74,10032 +torch/include/ATen/ops/not_equal.h,sha256=c5WpFeCn_WZWbBhApNjCshMXGLKVAcufVdYvUKA20a0,2288 +torch/include/ATen/ops/not_equal_compositeimplicitautograd_dispatch.h,sha256=94O8Y13YJJizLOF_wjEYLYjRIQUYX6Vj7FfCNvYsVVE,1755 +torch/include/ATen/ops/not_equal_native.h,sha256=5YRYFTGI4X_s0Q9EVJay_GgWgYfnHrfiOlJ05cSjfPg,1247 +torch/include/ATen/ops/not_equal_ops.h,sha256=PLitFDBDEF15cfrmNUaqI0xjhiQMQ8W9c1v4DFIOhcw,4670 +torch/include/ATen/ops/nuclear_norm.h,sha256=cGkGkf7QJBwVP7OLfrarbzD5jPJ8psTFYGsexf3mlvI,2399 +torch/include/ATen/ops/nuclear_norm_compositeimplicitautograd_dispatch.h,sha256=1QYVjn6FWKvkhB71JiYXw7X1gEjGyUbCjZiLcxKIcKk,1626 +torch/include/ATen/ops/nuclear_norm_native.h,sha256=uNOVDY0pIFuP4-EK9Y2s2AFQS-srxaU60HxIuPWcK4g,1103 +torch/include/ATen/ops/nuclear_norm_ops.h,sha256=0IuQNx3I2HwSzRX21skWpZjFm9WdQX_gkOqbiGYimUQ,3411 +torch/include/ATen/ops/numpy_T.h,sha256=OY1sL_TCe7_cP-VHaLLYqYY4H1umFtJpXNVc7OUAwyY,790 +torch/include/ATen/ops/numpy_T_compositeimplicitautograd_dispatch.h,sha256=NeDT9EQYyiritd7Pi1L8x7S60ZQXcf_2W-U7-0rDANs,1047 +torch/include/ATen/ops/numpy_T_native.h,sha256=BMqAqZBKDwrIcvp7AztGABkLjeb236dWon5K2cxEUhk,757 +torch/include/ATen/ops/numpy_T_ops.h,sha256=vwceUfzvdNvNqBHXgvgHMQCBf56Ye1As-M4lweyHKnI,1254 +torch/include/ATen/ops/one_hot.h,sha256=lKAuRAWE674O7uNjYlEx3mosON2xVTJ1wUF8lwx207w,988 +torch/include/ATen/ops/one_hot_compositeimplicitautograd_dispatch.h,sha256=wGx_NxW-v_fQwFAvKa9VAdzuUbks_PLhehOajJFkWoQ,1071 +torch/include/ATen/ops/one_hot_native.h,sha256=06co9Tn1ApLTQ-glL4B5S2gFKN7hrww8_GtXEjEEpFI,781 +torch/include/ATen/ops/one_hot_ops.h,sha256=MbboYtF3Ch3HP60_Ac0wFYcg1H5W0icEdYdlJFmJXwI,1319 +torch/include/ATen/ops/ones.h,sha256=Etb8oa9oMM73_q7dxielHC5PwP_xLbjGa5R5pOv_7Zo,7220 +torch/include/ATen/ops/ones_compositeexplicitautograd_dispatch.h,sha256=K2zGlrjn1AAHde2LOJPSO2BTd4xHwFMGsAJGTNhAnIY,2467 +torch/include/ATen/ops/ones_like.h,sha256=vy4lSW3d4EH41-OUZu7rbeXivfjdhGUAFtyr7BRXDKQ,2511 +torch/include/ATen/ops/ones_like_compositeexplicitautograd_dispatch.h,sha256=vCP06SsEXdszhT7Br5sAkj7ZnW4BTcrKzZCddFIzdms,1673 +torch/include/ATen/ops/ones_like_native.h,sha256=wW5T7KaNnoHcofzsKgSQ-GX_xzCUL3E1JlpDjdBI41s,1111 +torch/include/ATen/ops/ones_like_ops.h,sha256=gTRrqkuU7venfBHH57uG3UexwhDF0F7n0Sjo-1rpvc8,2694 +torch/include/ATen/ops/ones_native.h,sha256=6b2d7Fjq-8fwWGwZE4NS3gBBZ2mK7EPB7l9riq0FFVI,1349 +torch/include/ATen/ops/ones_ops.h,sha256=KnNCOo0w7J2ZPmo9VSXBx5ynNPVYbvhzGvZ4-kBS8nY,4215 +torch/include/ATen/ops/or.h,sha256=ZqgSrO497EuwpjfqdU-GlltGDljzrCZ0mV76foEH5qo,1185 +torch/include/ATen/ops/or_compositeimplicitautograd_dispatch.h,sha256=Qt9IxYyWPyUoV4w442lhCm4Z-xgEnByJlOIJb9dJZEo,1309 +torch/include/ATen/ops/or_native.h,sha256=_VbYtlU_dT1411pXJOE9Vu_duCjcbe3Np3heUTuLBFI,1019 +torch/include/ATen/ops/or_ops.h,sha256=YEx5H1DS_gFoJovDZT40sj6pU2b6SH0sxnbcLiUfTQY,3200 +torch/include/ATen/ops/orgqr.h,sha256=oadPsVJ80rZGTahO1uf_rdlkOUmKqpm0oRADr_C6zz4,1466 +torch/include/ATen/ops/orgqr_compositeimplicitautograd_dispatch.h,sha256=YoQ954U-trsCrmUM5XvHaKk6l2muCeAzNzv-qk5kfRA,1283 +torch/include/ATen/ops/orgqr_native.h,sha256=t6eZKQ2BWP8bC_eMzhkypmQ2zkvtNQje9xv1LvkECpk,887 +torch/include/ATen/ops/orgqr_ops.h,sha256=2eqiLjqXfdUWzGt9VVF83D4OfGpUcA_LWJCVfRRB-mc,2018 +torch/include/ATen/ops/ormqr.h,sha256=PXGVdLouLoHaBW9nIC6lGx4SqibgkkbPvOK7e71hpWA,1884 +torch/include/ATen/ops/ormqr_cpu_dispatch.h,sha256=-ZksAmeQhliQJw-iAYkX0ZW2htkfcz0tue3w3Ljh3to,1423 +torch/include/ATen/ops/ormqr_cuda_dispatch.h,sha256=Mzf-rCAyylG_Wt5IqoYxuLMr6J904LMMqLkv1PXPwiw,1425 +torch/include/ATen/ops/ormqr_native.h,sha256=ES4wHJdNnruUEN66kMsjxbUDgQLA8-Evgtl5p-1yBsA,1006 +torch/include/ATen/ops/ormqr_ops.h,sha256=Us3_MB0uCzotBNvQDJIdwbK8UAixfiksK5zKxAALBR8,2404 +torch/include/ATen/ops/outer.h,sha256=02ND4WlrknYRljr8HmJALbDZS0lOH8su4DoumccTntU,1448 +torch/include/ATen/ops/outer_compositeimplicitautograd_dispatch.h,sha256=31BYQJ3u3MOpCQmO2Z0QpmB_MocO1yHwmEExabTubws,1277 +torch/include/ATen/ops/outer_native.h,sha256=12Gz1BQj3U28VynbUfdY8EJxsJNEQEFPehd7gT4kRUs,883 +torch/include/ATen/ops/outer_ops.h,sha256=z4n1bp0oFtcSe7fn-yXAPnGSR7uUKJEkzmXTqbuhHn0,2006 +torch/include/ATen/ops/output_nr.h,sha256=p1tGdkVSRrF14SP07T2zb0V0kXmOYuOMJIlSiTGx9jI,792 +torch/include/ATen/ops/output_nr_compositeimplicitautograd_dispatch.h,sha256=NFJ7YFgkepr5frHilYEb1CbaNICM158zMjFocq35Akc,1046 +torch/include/ATen/ops/output_nr_native.h,sha256=9b9ZjrSBuWRZu9BsU-o3mFVq12jCPFaMB9p20IIO0WY,756 +torch/include/ATen/ops/output_nr_ops.h,sha256=8zyrcfFWArGcS8cyE-JHJRAUUh8PnA-Y03elw8wEObc,1242 +torch/include/ATen/ops/pad.h,sha256=mmw1Dmiw6tDJtyD8oCiqy8pjHcfWmaniAZfSdvp7O-c,2089 +torch/include/ATen/ops/pad_compositeimplicitautograd_dispatch.h,sha256=MC3flW5n2xPGGAd8G1N3BnaLtf65N0mmYH9PCcS2y08,1308 +torch/include/ATen/ops/pad_native.h,sha256=FU-bf1ZC4rpdWRlquRSo64jxnFicoT5XBI24LUfWpxE,865 +torch/include/ATen/ops/pad_ops.h,sha256=JzXh2q9EAI1-ChmwPmn8VSsVYskydvCVvm0V3GbdUIM,1514 +torch/include/ATen/ops/pad_sequence.h,sha256=4dYWm_VrqXdX5vFIkwPxX5brmhx3dQxT7q5Vqd2bYSA,1170 +torch/include/ATen/ops/pad_sequence_compositeimplicitautograd_dispatch.h,sha256=Js12iVJDurrQ48NX0lXOQEppQUBD8VxmyEG9SsCUuyA,1142 +torch/include/ATen/ops/pad_sequence_native.h,sha256=ZXSwNb2Jlf2ALyG0NZXFrRZDd4yMZ9CeaROQtTke7fw,852 +torch/include/ATen/ops/pad_sequence_ops.h,sha256=_1EUNKWSHTqu_kM1SRLB_221OCdNVIEZZECgsrZSvL8,1519 +torch/include/ATen/ops/pairwise_distance.h,sha256=Ql6BSbIR6v_NSzWQXczEn7UYlifAnsDkIZVPHh6gkHY,1118 +torch/include/ATen/ops/pairwise_distance_compositeimplicitautograd_dispatch.h,sha256=U8go2zMkIDqBvuC61Rt1i7Ib-ImcU_H1bu9AsM6ho9A,1128 +torch/include/ATen/ops/pairwise_distance_native.h,sha256=aZvriR3kPv2wvmYvp9elUJssMz7XjxE5WXwLbEQGr3Q,838 +torch/include/ATen/ops/pairwise_distance_ops.h,sha256=gQOS_USC9Rvi-yNdGMdKgKTiRa__BuFr2ofZdPlimP8,1491 +torch/include/ATen/ops/pdist.h,sha256=_3xS-w-vXNVzdnY3JvKyiZJZLNNJuJdr4oc2Hq43KpE,949 +torch/include/ATen/ops/pdist_compositeimplicitautograd_dispatch.h,sha256=ilCOXnuB1hJ-IcqSfxVNHKOifZ4_c44CqXCNe1HRHtI,1057 +torch/include/ATen/ops/pdist_native.h,sha256=RlBwiFaWSorL2YCU0NSxH5lM7jkPxjAF0msA_RWB-2Y,767 +torch/include/ATen/ops/pdist_ops.h,sha256=b9I3dkOWZQNts8uj1jZNc6wIJB054bcxy80mN7VmTWA,1281 +torch/include/ATen/ops/permute.h,sha256=jlrwRmlEQ4QI9XcQ0B1FbVFPqJL_jVdK4LANVslkW8U,977 +torch/include/ATen/ops/permute_compositeexplicitautograd_dispatch.h,sha256=G21wJs2HKlOyH3eFjUo7RXPCeBk36gOcNXCUskn44pE,1069 +torch/include/ATen/ops/permute_copy.h,sha256=oW4a-GigPzJXhx7KzxVDRHiNGGNP57hl45zJzV_phFw,1506 +torch/include/ATen/ops/permute_copy_compositeexplicitautograd_dispatch.h,sha256=2pCYWfYqL3lw2mDcGoqgvGG2Xwj1K1L9HHqgzoFW_jI,1206 +torch/include/ATen/ops/permute_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Ec21UKj6X8YNleOySvjwRHQObgmALEoYlno62ZTe7X8,1100 +torch/include/ATen/ops/permute_copy_native.h,sha256=dbPXUf6PSpXlo3HKsYV6OzNwCbLMSfyJoa0-I3gUDz0,891 +torch/include/ATen/ops/permute_copy_ops.h,sha256=pmBjvboeKPWAhEtWsIp4oFJyslYOJejLNMZxcp8ei3E,2028 +torch/include/ATen/ops/permute_native.h,sha256=x6WM2hTgAQjckfF4soPSNV3g_G2XgPjoVMYR1coet9Y,868 +torch/include/ATen/ops/permute_ops.h,sha256=_Tb0-Q8dyLiwxUhMtawLpUY2OIzQVfmPPAUL9N8Xjhg,1327 +torch/include/ATen/ops/pin_memory.h,sha256=TUMRWWdvzKF8V2IFzG7dL6uJgQN6BiOQLEc7WizSKuE,793 +torch/include/ATen/ops/pin_memory_compositeimplicitautograd_dispatch.h,sha256=R0jHHCX23rSIgDSOMQ8xqxWMHy_Uuwa6qdk88We0Jqc,1101 +torch/include/ATen/ops/pin_memory_native.h,sha256=bCRatcsV-K_P2XBOpy_BvOyXKWjAdlXjLlF2EVWQPSU,811 +torch/include/ATen/ops/pin_memory_ops.h,sha256=mC7S3HHhrufUnjL5DrLBGl9CxVMR9worwNMZrMieOFY,1385 +torch/include/ATen/ops/pinverse.h,sha256=L3i_gpYS2o_HW5nZnMH5G0zC4laVeUf5a72jAKXLnDY,981 +torch/include/ATen/ops/pinverse_compositeimplicitautograd_dispatch.h,sha256=uteHp1Rgv4dcknilWSuR3YcyUsHuOOaxuv9UDrM549U,1068 +torch/include/ATen/ops/pinverse_native.h,sha256=ez4JVkB4TuxgGeWzfIK95rdaTywiRzsTP46ds-bfBRo,778 +torch/include/ATen/ops/pinverse_ops.h,sha256=4d2W3ZEzt7NodWlUiOV13IaB3w8AC7Yv5jWv_or6hTk,1306 +torch/include/ATen/ops/pixel_shuffle.h,sha256=e074DBGcnU2Pq1dDQlPpSAsnfvfGN8KrZZVpZKVpXRY,1576 +torch/include/ATen/ops/pixel_shuffle_compositeexplicitautograd_dispatch.h,sha256=7xNLPBsng26__9v1TLVCdgoUoh4_pPXyJVE9_OWw5mI,1212 +torch/include/ATen/ops/pixel_shuffle_compositeexplicitautogradnonfunctional_dispatch.h,sha256=QPchWv5Z4UZ1I52CDcp2obLfpmg2wmw9VQIeOkMligs,1103 +torch/include/ATen/ops/pixel_shuffle_cpu_dispatch.h,sha256=NLIj_LfniC3joH2ksi97uf_rPN8V_Vaj0UXqlSISMMU,1033 +torch/include/ATen/ops/pixel_shuffle_native.h,sha256=Hh6yMKyWNvy-Uda9vZpSqqSznHT1-4OK5ov55iAVeYU,992 +torch/include/ATen/ops/pixel_shuffle_ops.h,sha256=2hR5LJCF2yHoqUriCx3ljR8nR1-9zfI9rCcNYqLErwQ,2042 +torch/include/ATen/ops/pixel_unshuffle.h,sha256=G7OQCYFnzVh7C8-KlP8pChtf0Wbr_R9BPJ4xhHX02_M,1614 +torch/include/ATen/ops/pixel_unshuffle_compositeexplicitautograd_dispatch.h,sha256=oHLokEWvbLWmLFGwPoblyo0Jai1zi_X5JguCqef9sb8,1220 +torch/include/ATen/ops/pixel_unshuffle_compositeexplicitautogradnonfunctional_dispatch.h,sha256=2t4iuTNjTrmIVyZiWIZ5eaGcZkW-sbT2iuA2ms4NaRw,1107 +torch/include/ATen/ops/pixel_unshuffle_cpu_dispatch.h,sha256=tBHKZop4M3BTyJ5Atg0ra39Y8_96KBZchKXUPsyT7NQ,1037 +torch/include/ATen/ops/pixel_unshuffle_native.h,sha256=jJrqbafHtGH19S4P4TkNzfIeB9JN1esmthk__8D8Qkg,1004 +torch/include/ATen/ops/pixel_unshuffle_ops.h,sha256=xsAULJX8JWY3VC_fH_5vOx8dQp0DXsWODJGMKuPmzDo,2066 +torch/include/ATen/ops/poisson.h,sha256=ArXa6MWsz84f0XTEfzEhvBAWh0NtatzocxuiN5emcF0,1606 +torch/include/ATen/ops/poisson_compositeexplicitautograd_dispatch.h,sha256=m_W41n1_auAsA4f7l1Q3dcmulF1KRlNGsPBi6U4vq5o,1251 +torch/include/ATen/ops/poisson_cpu_dispatch.h,sha256=icyj1gkPfhgI7vy3u_z-WhqF6ScV-86J9EB2TROBLv4,1060 +torch/include/ATen/ops/poisson_cuda_dispatch.h,sha256=vUKAwf_IhE1JQnu8FHs2e3yDfQUhytGQ1r0dOzu88fU,1062 +torch/include/ATen/ops/poisson_native.h,sha256=to8I7kPnO1R0eKDDUFiBkdpAhv3LncvotNsTU6aY_Eg,1064 +torch/include/ATen/ops/poisson_nll_loss.h,sha256=uakRI53I_MMlsrE9A7vd8y9ECcioaKUQyDTqGJ2XdNY,1164 +torch/include/ATen/ops/poisson_nll_loss_compositeimplicitautograd_dispatch.h,sha256=WJIA-xprL8I5VixT-GrKYftMaVCRKRzCyykwaztWe6g,1142 +torch/include/ATen/ops/poisson_nll_loss_native.h,sha256=IxJC2N32EFyOmR_Otop5W9XZoGl4XpGvFwM5Z8Nx0Yk,852 +torch/include/ATen/ops/poisson_nll_loss_ops.h,sha256=wqcYqEdI1ibJ0sMlnH5beBObLlnzxmttUQTcQxcEZ20,1565 +torch/include/ATen/ops/poisson_ops.h,sha256=OCx5iT1yWqrPWqtVfpcVtAziIyPQk2FN8_-TUg4CqUo,2138 +torch/include/ATen/ops/polar.h,sha256=uX8h5eyjAEuhnjt-bGCKFAnyPWV6VxVdVc3aVzgfx1M,1448 +torch/include/ATen/ops/polar_compositeexplicitautograd_dispatch.h,sha256=UoegLi1chLcXv1u-9iwwcUfcrPK2F97mnb1oTHl4uUE,1070 +torch/include/ATen/ops/polar_cpu_dispatch.h,sha256=qnKg53cp3uPEQQkgCU8AtorM5hTMY5QxGJNfY4Uezu0,1154 +torch/include/ATen/ops/polar_cuda_dispatch.h,sha256=tOG83hhYBDBYp-1MIIlb4YEREemD4kv0_iStAi2XfdY,1156 +torch/include/ATen/ops/polar_native.h,sha256=urtGijqqjzssdn_370zWwCCDN3xbzzypb9KqvFeLOXc,883 +torch/include/ATen/ops/polar_ops.h,sha256=I0Ma_L9Tbv9rpq7ubvPmccZFVRRkxZuBeulwR_e7WJs,2006 +torch/include/ATen/ops/polygamma.h,sha256=kLTAcwNl6klNOlqzYcuQJ5jVoIk62DICwGmW-fjwtsw,1419 +torch/include/ATen/ops/polygamma_compositeexplicitautograd_dispatch.h,sha256=2pKm-m9-rGqRgQJkD8lxhKQLkEaBiGRvc4H-B7J6aHs,1057 +torch/include/ATen/ops/polygamma_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Xyy4zF3l9Ty9oUw1f8wvRHP9FjlWYhDRf8kGeSHfztk,1086 +torch/include/ATen/ops/polygamma_cpu_dispatch.h,sha256=QOxmVY-MxjVMbDn3y3HxDioPdv_YyQpTz-JSAyKoNUw,1203 +torch/include/ATen/ops/polygamma_cuda_dispatch.h,sha256=AhyKfWiU7l4zUjWeAJq9r6zc6Q-zj_SRtF8rwQiCouQ,1205 +torch/include/ATen/ops/polygamma_meta.h,sha256=eb7CQMOWO94xPV8pPajMbFRGLA1O5z1e4wpN2gr1tRo,867 +torch/include/ATen/ops/polygamma_meta_dispatch.h,sha256=9XYxsjGGAhjVsCTnuyukx-B1TIDxjr1VbtADEX1JHJw,1205 +torch/include/ATen/ops/polygamma_native.h,sha256=MBDb8gTOfO0mZsyrbpeVsySAtjBCek-06nn3mrijCsE,964 +torch/include/ATen/ops/polygamma_ops.h,sha256=xF5M4Ox8Y3NuxHx4_y8vPspc45MD5diQdC9AcX-_3vc,2497 +torch/include/ATen/ops/positive.h,sha256=D3ZohISkLqwuvpCEKkZKj_1nb-g6tlC5-JdImFZl7aU,941 +torch/include/ATen/ops/positive_compositeimplicitautograd_dispatch.h,sha256=q_iztN3ChjFIvn_-TSILQujRwFjLPVW_953HD_13d84,1048 +torch/include/ATen/ops/positive_native.h,sha256=LN1RzwMbjWrTt6i6YPVGXfyBIznnQl7csI27bRJSAUg,758 +torch/include/ATen/ops/positive_ops.h,sha256=qO-YD-7QMq1t8IHT6P3ardHUKcGIWNI5T_anaWUxcdg,1257 +torch/include/ATen/ops/pow.h,sha256=BPS4RxV82pifzx9FZnBAkOt6bL0NNGlqgWVMTiW7JlA,3034 +torch/include/ATen/ops/pow_compositeexplicitautogradnonfunctional_dispatch.h,sha256=JJgKzzIZiJMd1Um_fXqwj5WcXWnCy40E2N8gbsmIY9U,1416 +torch/include/ATen/ops/pow_cpu_dispatch.h,sha256=t3iy5Mimlczi1v6C9JLcEJuQe-XWOwZ1IC_pXo-woDs,1979 +torch/include/ATen/ops/pow_cuda_dispatch.h,sha256=epDzl5erFSZ6ya0byWIT9_oMeUbCvsYDalPYkQT7pJQ,1981 +torch/include/ATen/ops/pow_meta.h,sha256=xxIx8NXIzxvSnXYAV-lkFCrAhFz9Zs7Rq18p0dNncFY,1196 +torch/include/ATen/ops/pow_meta_dispatch.h,sha256=fjXw9k5jwsWcXBDKbsU86OYBpSFoVyv1olvLb_KDjqM,1981 +torch/include/ATen/ops/pow_native.h,sha256=j7Pt5SxaReK7-pwvEeTp9JDG6mPxkPn8HBaAu-5uvdI,1516 +torch/include/ATen/ops/pow_ops.h,sha256=3N7joIViOYjWm5xkeuiNbyNFv_HzAxP8FzS8pxJb-do,6025 +torch/include/ATen/ops/prelu.h,sha256=oRv9ee0B1gnkodTNN4SOxMcpoUbcZxsp5hMBUEtXrjc,973 +torch/include/ATen/ops/prelu_compositeimplicitautograd_dispatch.h,sha256=ior0Qg4R_9trKTT9qPfXFU0JxdI_eIBLF9tvSVYA19U,1072 +torch/include/ATen/ops/prelu_native.h,sha256=N6qsJXbILBmT9-2w_6lxhZsl44eVyjZhF7feRFzx9Eg,782 +torch/include/ATen/ops/prelu_ops.h,sha256=vPnXwbTGLg5sbePEiVgtKoBFBkj_1YxcqT976yh0aOw,1331 +torch/include/ATen/ops/prod.h,sha256=cMw6B9mSuuEl_dweXaPsENVL4FiUTytoGDbpxBPVvnw,3633 +torch/include/ATen/ops/prod_compositeexplicitautograd_dispatch.h,sha256=ddSZsIDYG18EcEMBioFkljEEcvLIRs01PWz_UPHauLY,1239 +torch/include/ATen/ops/prod_compositeexplicitautogradnonfunctional_dispatch.h,sha256=_aDs2oc7dNRy7HM9SrRLbGjxbFpYj-wgpZBL73BkzFI,1157 +torch/include/ATen/ops/prod_compositeimplicitautograd_dispatch.h,sha256=YLIaNUvfL74E2elBsv_4UboybI6Qv-EFr98hNpandwQ,1451 +torch/include/ATen/ops/prod_cpu_dispatch.h,sha256=Bqh3Io3izKfoMm5S4fRlhrZf2rKCHVNTAI_Ze4TJ0-Y,1502 +torch/include/ATen/ops/prod_cuda_dispatch.h,sha256=7GsfYzN6KywhbvUBLHGx7kC7u-AJqrXRXnJjbCHufgA,1504 +torch/include/ATen/ops/prod_meta.h,sha256=1ou4EerQ5rswI_BZiYTbpgNuJjxUj3f-tiAdtoGHLJ8,925 +torch/include/ATen/ops/prod_meta_dispatch.h,sha256=vHiedXFAwSEy_34IatLybHI2IP5OR9C1pD0CFCubTks,1397 +torch/include/ATen/ops/prod_native.h,sha256=Wd3N3TkR_Yjh1Xvrl3AraJY8My0q5BnnDJ-mtyH5R3g,1460 +torch/include/ATen/ops/prod_ops.h,sha256=dIh8Lbq_NseWW6UrM9TSNM7xvbHVBAqryMfbBYVci-4,5371 +torch/include/ATen/ops/promote_types.h,sha256=cXVJ5rOw6L9EXAiKhEEpbucoHwFlpOqu_ZvCcXfLyiw,1013 +torch/include/ATen/ops/promote_types_compositeimplicitautograd_dispatch.h,sha256=2_irhQCZlvqCreWxQM4U4JpdaV0WOu5WHohTQFCZOoc,1076 +torch/include/ATen/ops/promote_types_native.h,sha256=1gY-yq3khsS2KlA1WbNfFBy24Be4KQSNDTrKGDuGykE,786 +torch/include/ATen/ops/promote_types_ops.h,sha256=WFF6dOs3eEMaAloXSFvyr9S16is9B2Bg6miC10fJBiA,1355 +torch/include/ATen/ops/put.h,sha256=iy-OKHZXjjUY5l4jZcGn6VuY22DClYBuaR9rI-fK0XU,1755 +torch/include/ATen/ops/put_compositeexplicitautograd_dispatch.h,sha256=QlUaASDazvdJAiq3MQEfoaZvtXw2CX48Be6EVZw96Sc,1418 +torch/include/ATen/ops/put_cpu_dispatch.h,sha256=mINa5ifktz2wYgevoXTGUY2Uf4QGezwEk_QRfKoXhks,1072 +torch/include/ATen/ops/put_cuda_dispatch.h,sha256=fYJZUMDuPZ1msOTrBLykehPiS-CWZ7guuK0nc5l_7WE,1074 +torch/include/ATen/ops/put_meta_dispatch.h,sha256=9aIhK9H7GRRPyq-ysn6yYKuwrdb1xP-r6j86LEhmHAE,1074 +torch/include/ATen/ops/put_native.h,sha256=y6dwkJ3O9LkTOVNAGWD3jHt6QpuZHuPXOXuCBfFPk4Q,1100 +torch/include/ATen/ops/put_ops.h,sha256=J5t5UchPf-D_eAIPuwJG7-DGDbJyiU9CflhGCbe82Fs,3043 +torch/include/ATen/ops/q_per_channel_axis.h,sha256=2m3sjV5LtN0DGIX03O3LOpMcQEyHia12OLBXd78MBRk,969 +torch/include/ATen/ops/q_per_channel_axis_native.h,sha256=8WF4ZwvpMQLGbOpGm0ueESBIOyslLS0Sw0prK1miIIQ,765 +torch/include/ATen/ops/q_per_channel_axis_ops.h,sha256=Qxh5URPumsAsw_rhq1ZF950I2iY0qyH9ZiZvh2ci1Dg,1269 +torch/include/ATen/ops/q_per_channel_scales.h,sha256=f7K_J6n2yHX5yaJwlR5EizgsBXRRUnUTz9NEdGogO5A,1466 +torch/include/ATen/ops/q_per_channel_scales_compositeexplicitautograd_dispatch.h,sha256=uVSHAZwnR3oyRDWZvvzZAnhT5v8ezUlLJyJy-sgZip4,1178 +torch/include/ATen/ops/q_per_channel_scales_native.h,sha256=SlTPaFd-7P725CDqnIxXuiHwx6zyTHDbKvy0fElQ8m8,863 +torch/include/ATen/ops/q_per_channel_scales_ops.h,sha256=s4qB7sVWiSJMZ_tX5IQlqA0jg0Gf195xnDATClPGKoc,1930 +torch/include/ATen/ops/q_per_channel_zero_points.h,sha256=xABY3lW2J4kUEdACKb5kNQN3jxyip5miS1wBgnXJu1E,1516 +torch/include/ATen/ops/q_per_channel_zero_points_compositeexplicitautograd_dispatch.h,sha256=SuXPTgw9qWO3UaeEAQ9OTLGkA-Xickn3ChsoIkD4nF0,1188 +torch/include/ATen/ops/q_per_channel_zero_points_native.h,sha256=aXHu9rsGbJZSh36Fh8Q3hXlEXmu35tuw53iNluRsfPU,873 +torch/include/ATen/ops/q_per_channel_zero_points_ops.h,sha256=9bTke3DCje-bmushUZJU8zgm4tg0yJ0gkkXg2gJtUTw,1960 +torch/include/ATen/ops/q_scale.h,sha256=ACPV2LctqgehEGYfIB2ArMcGAhmX-2Jz3LHa6i7SCM8,926 +torch/include/ATen/ops/q_scale_native.h,sha256=EaAOjaZgsghSvFNswFjA0URePPTsXqy6P2N_bn186Zw,759 +torch/include/ATen/ops/q_scale_ops.h,sha256=5ckrXjGnbqV7pUehmjJpdUn4sOsGuuGgTsQUdHvaOsQ,1235 +torch/include/ATen/ops/q_zero_point.h,sha256=inq65x2KEt_MAHZX-FU0gZGpAz6ctBbRgqTsucBEWQ0,945 +torch/include/ATen/ops/q_zero_point_native.h,sha256=_Z5I8sP6QOHazF6EBc7t1zfRvvHN9yKor74rrhyBAhw,765 +torch/include/ATen/ops/q_zero_point_ops.h,sha256=S_dfka1LPIusPmxBo09-XsYK9enQerUPvZbXvyt3LK4,1251 +torch/include/ATen/ops/qr.h,sha256=6RVGzZ_dM5ioPTbEiVwsFx40cACWy2FAV7RYYNEQY7M,1570 +torch/include/ATen/ops/qr_compositeimplicitautograd_dispatch.h,sha256=OujR3sbXy5cFenGvP8Q8KHP0kuyqoS-hWzIshZtNJ6Q,1343 +torch/include/ATen/ops/qr_native.h,sha256=qjcx7bbT6rJPl-nkR1n76vM6Oplvk9vP35KzSkAqwXE,920 +torch/include/ATen/ops/qr_ops.h,sha256=ZvZoRIXBc6dzuzkSN3lTFFD_64z95kmiFjAL9QPx5_U,2146 +torch/include/ATen/ops/qscheme.h,sha256=Lgddxz83UEpaA_btJCqNLoJJIOswYBldKOmH1Hu7TRU,790 +torch/include/ATen/ops/qscheme_native.h,sha256=fm_TMZ0il5ExCAfR4OIcjkNvcePGr4UKaZayDcYkXz4,764 +torch/include/ATen/ops/qscheme_ops.h,sha256=hza32aZeKY3KZVUB0DoHjmE7vyEKtrVfcbgYqQkazug,1252 +torch/include/ATen/ops/quantile.h,sha256=N3AIgG13eBb6MKmMlUycO48bk9Lp9Ar_u5RckKCK7KQ,3250 +torch/include/ATen/ops/quantile_compositeimplicitautograd_dispatch.h,sha256=khSJrTwmcrzg9RQXXlBHkm3Yx7bD8uvrFdURhrcllww,2103 +torch/include/ATen/ops/quantile_native.h,sha256=zS3pZipOstUBOqHRkHd1K-n9DC4h_93h7IS91EJDJ8s,1405 +torch/include/ATen/ops/quantile_ops.h,sha256=wbjGqic9weuOPhjzj2heAP5aZQbxT-nVlBNWbPK_Grk,4311 +torch/include/ATen/ops/quantize_per_channel.h,sha256=bSs7oCwR9yqM7pxf9DuvtqX5rj_PhNnyo8xMxKuyGZ4,2042 +torch/include/ATen/ops/quantize_per_channel_compositeexplicitautograd_dispatch.h,sha256=vVr_-3TITQTrQ5oh0Sok0NTBM2DJ93TPLE7eDmu3aow,1368 +torch/include/ATen/ops/quantize_per_channel_cpu_dispatch.h,sha256=KDm8ydqGtAOa0rlshFWLe8dOjcsyEsakkzjDU6G5imY,1111 +torch/include/ATen/ops/quantize_per_channel_cuda_dispatch.h,sha256=Y5dIYswwY5q5M3DM47c0CVPtzdlotU6HErRION6Q73E,1113 +torch/include/ATen/ops/quantize_per_channel_native.h,sha256=LoA_aSNhUCku90mWtqoPBxySVyvVIotMN5ZJlMnF_oQ,1053 +torch/include/ATen/ops/quantize_per_channel_ops.h,sha256=FtBpPwleLgomvCNE5ReRufGrs4s7E161OT8Tn_8wFrU,2566 +torch/include/ATen/ops/quantize_per_tensor.h,sha256=ctzt3NtU5lqZKLUBsqVYwrqXAdxWqi1WzEdJ8P_XHHk,4261 +torch/include/ATen/ops/quantize_per_tensor_compositeexplicitautograd_dispatch.h,sha256=RLqZtwa7nIeNHXW2fplgaIUdA_vUW-owbHE2irpLmlg,1964 +torch/include/ATen/ops/quantize_per_tensor_cpu_dispatch.h,sha256=_FUdnqZPpz81tN4jRRXLQaRCvkKoKWeiPkBCYy2KIkw,1381 +torch/include/ATen/ops/quantize_per_tensor_cuda_dispatch.h,sha256=H2Mb3vJNbs6uS73vn3lRTgUEaDA4unHvZoeYrDBovlA,1220 +torch/include/ATen/ops/quantize_per_tensor_dynamic.h,sha256=0p7r5O859vJYu4a7PbKIBrD08OQcrOyeN02TiwDGS0s,1833 +torch/include/ATen/ops/quantize_per_tensor_dynamic_compositeexplicitautograd_dispatch.h,sha256=CFcx-5wDr1h1OAWoS0VtjcoCe0d7eaRk1AHazwARdfU,1274 +torch/include/ATen/ops/quantize_per_tensor_dynamic_cpu_dispatch.h,sha256=cfsVBB8fmyt_pEGWK_OU8uK08H0zPZ7eNhsvDTAS_DU,1064 +torch/include/ATen/ops/quantize_per_tensor_dynamic_cuda_dispatch.h,sha256=NU46t4KLtScQEPsR3jFoPjWMSVXzpiu7jgNggGObfrE,1066 +torch/include/ATen/ops/quantize_per_tensor_dynamic_native.h,sha256=b07kRs0t9VYpu5LNQ28FxPUr0AMcUT7i_Wo1eczyoZQ,959 +torch/include/ATen/ops/quantize_per_tensor_dynamic_ops.h,sha256=Cl0gI1GPOdeEJpkoUomsDNNNPHsHTgJyO6bSd3D_0TM,2254 +torch/include/ATen/ops/quantize_per_tensor_native.h,sha256=6eGfswAD7qP4Dg8uz2KMAXrjmtGMPnxoQasszNeJI7A,1667 +torch/include/ATen/ops/quantize_per_tensor_ops.h,sha256=UXWHsngHpox5hj8SV2oNK5xHoBjekZDH7K_MAVJk9C0,5917 +torch/include/ATen/ops/quantized_batch_norm.h,sha256=pH9Hq4q1WQfingz84QbniEMM2Qc-z6pzb8Fl8xfZW0g,2576 +torch/include/ATen/ops/quantized_batch_norm_compositeexplicitautograd_dispatch.h,sha256=tDNmSwsNjcl3JOAVvogwlQH41JtBG0IKr_uSRvTucY8,1570 +torch/include/ATen/ops/quantized_batch_norm_native.h,sha256=fAq0TWuOgWmWZFMN65UbdnUGrhNe9FuHBU6_nP-rp8Y,1255 +torch/include/ATen/ops/quantized_batch_norm_ops.h,sha256=pYJF487de2gtO4raBQACLr4yxjF9DzO3VF3IItpSfVg,3212 +torch/include/ATen/ops/quantized_gru_cell.h,sha256=5OGrMu1Ls4jdLe0ah38T6Uc_-iaAXQlt4_TqD6bco9A,1712 +torch/include/ATen/ops/quantized_gru_cell_compositeimplicitautograd_dispatch.h,sha256=LEgsstjAZHVRcRyF3l0N1oRk_1xnL8cb6VaxaEX3_zo,1438 +torch/include/ATen/ops/quantized_gru_cell_native.h,sha256=tgee1wJNyXr_nSUNzqKEi3uM40lGkT6MVmnGYwwA-yk,1148 +torch/include/ATen/ops/quantized_gru_cell_ops.h,sha256=wxj5o4BKwikFpwxWyZ5546oUovC_yk8Ej_78U_3XAzM,2525 +torch/include/ATen/ops/quantized_lstm_cell.h,sha256=ZXPUkmdMF5q4Rr8RNbHzr29DcFi6DPREH-YLAsSo1us,1749 +torch/include/ATen/ops/quantized_lstm_cell_compositeimplicitautograd_dispatch.h,sha256=o1wlxe4N5luxiQlgrSkMiafMiMVGF0s-bmPgbyczFo0,1460 +torch/include/ATen/ops/quantized_lstm_cell_native.h,sha256=BFutG1WE27efwQCs0fCf29FQ8WS7OemsqqhDa28NFP4,1170 +torch/include/ATen/ops/quantized_lstm_cell_ops.h,sha256=dVLQSzRQtclaTtVcpLPO1cMwCfft6Dksqh6OSBc0iVE,2603 +torch/include/ATen/ops/quantized_max_pool1d.h,sha256=3XZYw3LlPJbd2h9yLWk14z-dwdDI7DoJ7pgSsXUWwZA,2296 +torch/include/ATen/ops/quantized_max_pool1d_compositeexplicitautograd_dispatch.h,sha256=5t4C_J5K7Oe5AOm2xa2Yy5qChK9_DdpN3NvHqwD_BJA,1431 +torch/include/ATen/ops/quantized_max_pool1d_native.h,sha256=VyQQSNYd-irXlYBV2cTrMGv6O_jsM3BeaIBotEpztV0,1116 +torch/include/ATen/ops/quantized_max_pool1d_ops.h,sha256=9tIbRd650XRYeh6j2hr4o7yX3QKZBrCo8T-TrdGE8aA,2752 +torch/include/ATen/ops/quantized_max_pool2d.h,sha256=Tbcfwv_0Hu0FucNJdbHwhtQHiXKsB3c1xvxAX1w-wyg,2296 +torch/include/ATen/ops/quantized_max_pool2d_compositeexplicitautograd_dispatch.h,sha256=WGHksxbTmFU3kumGMlzEZkUclg8BwqNleaxTqr_Xo8Q,1431 +torch/include/ATen/ops/quantized_max_pool2d_native.h,sha256=_x5N7c12QHCNg4uiU5MNKnBgRdr1aj4VOZyxa9IU9iM,1324 +torch/include/ATen/ops/quantized_max_pool2d_ops.h,sha256=hS-wxQoa1IOB2bEtsXVlKdcwKkxxWihcyQZQI59lCCQ,2752 +torch/include/ATen/ops/quantized_max_pool3d.h,sha256=l9IMkSE5okp40p9uYxRifZY983qdhOVb2L-x9haTpUU,2296 +torch/include/ATen/ops/quantized_max_pool3d_compositeexplicitautograd_dispatch.h,sha256=W-d_hpilntVYpEOdj1ZxAZNLJx1BDhTghrMCu8CvjtY,1431 +torch/include/ATen/ops/quantized_max_pool3d_native.h,sha256=8TVaVRtAndRDuqjFUCfTPppXsYO2VIXFgRg-IggUBy0,1116 +torch/include/ATen/ops/quantized_max_pool3d_ops.h,sha256=zWbMcuAPNwMOC7qy8Jpm6vmIwS4dSA49ydAUCmjjMnQ,2752 +torch/include/ATen/ops/quantized_rnn_relu_cell.h,sha256=w5uw4pClcv2mer7GFDonTA64BksCNHg_S4hIdwQvtPI,1732 +torch/include/ATen/ops/quantized_rnn_relu_cell_compositeimplicitautograd_dispatch.h,sha256=sF60Snh11_oqmYMorBRP3ID-l8ovv-FA22qDeLHt_2I,1443 +torch/include/ATen/ops/quantized_rnn_relu_cell_native.h,sha256=bJlkAh_3Qd8ocOBOFZcTwxCZtH7REZafxtYGzoQMgb8,1153 +torch/include/ATen/ops/quantized_rnn_relu_cell_ops.h,sha256=8Joah7sThuTENczhqvrSx5n9ua2tra_4eF0WkMB-ucI,2540 +torch/include/ATen/ops/quantized_rnn_tanh_cell.h,sha256=K_voRb3_OJmMhlasDvRkejaroyU4K1h2NuUaJgFpHvc,1732 +torch/include/ATen/ops/quantized_rnn_tanh_cell_compositeimplicitautograd_dispatch.h,sha256=cnzJtjbbe4pw8Dc7FCI4cW6E9Jm1baeM2w5A_n6JHRQ,1443 +torch/include/ATen/ops/quantized_rnn_tanh_cell_native.h,sha256=aZpII1AdOOvDh1IKJQr4--x92xGneNI7VbqnziUZKoA,1153 +torch/include/ATen/ops/quantized_rnn_tanh_cell_ops.h,sha256=ipHGPHYbF5iIHXsjgp9JldTeOpGElP5Xt-fgfD1FSL8,2540 +torch/include/ATen/ops/rad2deg.h,sha256=9rvNkMWS55wNx6ovZeeCjK7ZHrfTUefNahaJ8CAuTuI,1486 +torch/include/ATen/ops/rad2deg_compositeexplicitautograd_dispatch.h,sha256=b4WKXHFX4Btosygb9TB4OKlwTQH3Ov7kPfguYowO8Ck,1261 +torch/include/ATen/ops/rad2deg_native.h,sha256=MMlBQbg3vasoAL3vrAnL_94j_8KA3OuVYVmOunjFV90,1322 +torch/include/ATen/ops/rad2deg_ops.h,sha256=oqG4a0X5EJuP9hCY-VwbysWTuQBypX9gYyCYVpt_cPw,2365 +torch/include/ATen/ops/rand.h,sha256=_GyaIYZGtJnT-pAA6mAwjZF5FcxfbHDLJtlr7HVNcko,25401 +torch/include/ATen/ops/rand_compositeexplicitautograd_dispatch.h,sha256=vvLpr93oYnhCUhVip-Cn7WN22ptMxT-Th5zwvuHyQss,5383 +torch/include/ATen/ops/rand_compositeimplicitautograd_dispatch.h,sha256=4W-YZNSlVVx17ipj5enfkCg69s8sL4rObFERC8tXZww,1479 +torch/include/ATen/ops/rand_like.h,sha256=j4hWLRBsDhDYMWZxh5hqBKZUUB6vIpVxJU-zuIx7n5M,4612 +torch/include/ATen/ops/rand_like_compositeexplicitautograd_dispatch.h,sha256=h6M8D64EK-v4HeWdZNOS8pID8hV3Q22GIxyfpV5zXrw,2523 +torch/include/ATen/ops/rand_like_native.h,sha256=qvrcMASuG35HCiQGWzL2AFcMMBNAIr0bYeyYkTqD12o,1615 +torch/include/ATen/ops/rand_like_ops.h,sha256=rhpvVslICg-azmqkaRkHzcZGnLbENUu2BNduQzMENF4,4989 +torch/include/ATen/ops/rand_native.h,sha256=Gtqvo1DkGnt-DxkWAB_oBLuUw6Zd1G6F59e59_HxhuE,2202 +torch/include/ATen/ops/rand_ops.h,sha256=hQQSXfoNPPTfqzJTROJdM1622as2nN6QdZpH1RcJWfc,8457 +torch/include/ATen/ops/randint.h,sha256=5dtd8ftfi8Y7y6vwwzpuafODRqHz3myqeaS6DnEgcQo,26644 +torch/include/ATen/ops/randint_compositeexplicitautograd_dispatch.h,sha256=4YuCgXMHGSjKfHa2HIBYgescCRMbd5a_BnYsGLZ4leo,6135 +torch/include/ATen/ops/randint_like.h,sha256=0LSZNf1NXyt30E_RKkkvBwLsNdqPg7b1wKw26h2sZVg,37903 +torch/include/ATen/ops/randint_like_compositeexplicitautograd_dispatch.h,sha256=DpwSSOE5AOGvDa-wkpI2Yyn7n0XI3_jXbiZEL49RZhE,9835 +torch/include/ATen/ops/randint_like_native.h,sha256=gaIjzq-vvXNmaIDeHFhnK7MFNTKTHTiwYFKto8qpdK8,3829 +torch/include/ATen/ops/randint_like_ops.h,sha256=rV941AgrojevKzCYnc1mrJu-clv40PIDtB45LXCXY_g,14873 +torch/include/ATen/ops/randint_native.h,sha256=cjcxMVEuzgVskKNTFfkzap7Gpjae69QHJPi21U73hdE,2181 +torch/include/ATen/ops/randint_ops.h,sha256=tvtEMUbSOQeNiTisvKoYGRlG3jCmJ0CIjt_hUnWY7Bk,8679 +torch/include/ATen/ops/randn.h,sha256=dG4pTvQVqPY7R23lV9k14XzO3Vu9Ekopmoy0fmkqMt8,25562 +torch/include/ATen/ops/randn_compositeexplicitautograd_dispatch.h,sha256=DWgIXsNn3tBLCKJV-JBT69ffsl3XI58JjmVLwdR8LMY,5087 +torch/include/ATen/ops/randn_compositeimplicitautograd_dispatch.h,sha256=xTOAW744YQMfNAoA3mBcGeOOdghn6Osy9TUUiDIWG3A,1807 +torch/include/ATen/ops/randn_like.h,sha256=iZpkTM3JlgBT_LaFtMV1jHK_LSN-hRtBkhysZwydq5M,4637 +torch/include/ATen/ops/randn_like_compositeexplicitautograd_dispatch.h,sha256=ff62-CmSZl69ZQdR3-D1_pBE29QYOnv6okNavka3E9U,2531 +torch/include/ATen/ops/randn_like_compositeimplicitautogradnestedtensor_dispatch.h,sha256=vUUY9G6Y2H97D5eN8j-o6tdeAhRs4WY2hqBKk4JobN4,1911 +torch/include/ATen/ops/randn_like_native.h,sha256=kcG1xR7uU7NbH1w8IS3b24yiAPEThKfN9K_Py4kxFOY,1619 +torch/include/ATen/ops/randn_like_ops.h,sha256=DW2CvUb1sorHn2uEpB5lcYU3rRz_b1_seLQAUgeodh8,5001 +torch/include/ATen/ops/randn_native.h,sha256=aN-l9Sm2-kWv3qMRUctB9sLhSP_HlOmBvFlmee8Wtkk,2210 +torch/include/ATen/ops/randn_ops.h,sha256=5O0Fnz_c7CjwIyogtjq3t8wm4EKtO3uGj2D-qplRi7Q,8481 +torch/include/ATen/ops/random.h,sha256=NWFhQMTf_EgqKJd4qGnwCr_cCC6nAEBdv1Fm1RKDmh8,3559 +torch/include/ATen/ops/random_compositeexplicitautograd_dispatch.h,sha256=dq85Y7OjPJ0I-N4G0oonytLJkPc-36IhWIoXstp-s5g,2266 +torch/include/ATen/ops/random_cpu_dispatch.h,sha256=chBlkBS1y1KVOH3v5CEVUIbtaGwsSd4Y0Sxz2KLGEJQ,1329 +torch/include/ATen/ops/random_cuda_dispatch.h,sha256=TUWJAsCfh6EMC0VjAgRelHOsFQyHUobcU0Nd5FsipGY,1331 +torch/include/ATen/ops/random_meta_dispatch.h,sha256=qDY7SX9gQwDj34-F0grs1FOfDvYkHlZg4myjxkrh1XU,1331 +torch/include/ATen/ops/random_native.h,sha256=Xrl73_A0z7ynyvxM9LAIOLnYz-dgWCvklxRzNruNN00,2297 +torch/include/ATen/ops/random_ops.h,sha256=tLu6jGEdEl4KDoYRXKx_Tjtg6Jdx9UQQMu_zrh24C3s,7516 +torch/include/ATen/ops/randperm.h,sha256=3uq8_VcxWi3vIGFlQd6HDf9_J4a9fQTKUvUnWxiw4WQ,11429 +torch/include/ATen/ops/randperm_compositeexplicitautograd_dispatch.h,sha256=ps6eueNRjYxfHa51tOqSz7u_4Is7yNd8-sf71e0rAe8,2567 +torch/include/ATen/ops/randperm_cpu_dispatch.h,sha256=JRt3UUAIC9JWAyyRT4s9NK2sbJZTgdY_GHtX9cHoVBg,1407 +torch/include/ATen/ops/randperm_cuda_dispatch.h,sha256=nh1Ji0B6LUPLSSsb_jPROARxIaQwgqRaEMHxSmOYXKs,1409 +torch/include/ATen/ops/randperm_native.h,sha256=HsQO_01dJnwj0eUtAK1cyhku0ioynDB_lcXQ-BynL08,1437 +torch/include/ATen/ops/randperm_ops.h,sha256=79PUvYqOh8QnRMe2-avHHKZBS_qOrzSot7xOWtkn3VQ,4189 +torch/include/ATen/ops/range.h,sha256=bvUHNy1PqO3jaFnhVi2X_t2O0k9KVKz87bxLvG5XBk8,3714 +torch/include/ATen/ops/range_compositeexplicitautograd_dispatch.h,sha256=c0W_GBXNmVwdeN9fC_bWLWslzGg_-ZnKsKSrPmFqcxQ,1916 +torch/include/ATen/ops/range_cpu_dispatch.h,sha256=22-xWRHBe0xezHs0sRRJybZnlGbgCbpZE49X1tM2KQg,1204 +torch/include/ATen/ops/range_cuda_dispatch.h,sha256=JxZ_Nk9ksMvDIUrRQX7A7NgrmSbnN_A1BUEX0qfxoy0,1206 +torch/include/ATen/ops/range_meta_dispatch.h,sha256=zrpo__vze8ia821IhQrwiTCQmUQyiRuCHJm4Nh7uILA,1206 +torch/include/ATen/ops/range_native.h,sha256=aAX7NYd1KFOOOjN-1R8PtW8WtheJuTawXCsyKP7dBzo,1572 +torch/include/ATen/ops/range_ops.h,sha256=J83ayOglaX3LwjS4j5o6HNnhr1i6WYoLG9-mo43DsJo,4457 +torch/include/ATen/ops/ravel.h,sha256=kyrKxf6QFIJKQ-RHjCz3kSeM2bNOIXy5ZWu8JzgQ5Ik,929 +torch/include/ATen/ops/ravel_compositeimplicitautograd_dispatch.h,sha256=wz4fADJz5J52pajhTqlUGI2IJr_qh0N2AnLUch_GUDI,1045 +torch/include/ATen/ops/ravel_native.h,sha256=hENjmsDOaj7tMYZJxSH06BEvR3kjaPb8iKOriakcuMo,755 +torch/include/ATen/ops/ravel_ops.h,sha256=t2iUWS-9RzSoNwORyaNJjqnW-XkXbs7YvhQi042CTew,1248 +torch/include/ATen/ops/real.h,sha256=hYtsJ4Mw7KcpuHKRpV60h1j_djxTB_f7jbR8FGUnbXU,925 +torch/include/ATen/ops/real_compositeimplicitautograd_dispatch.h,sha256=ABV0HiKsSBNtF1UHEqoEH0u1w62Dze79kKF7wsB_LQE,1044 +torch/include/ATen/ops/real_native.h,sha256=MBEICUZC_cXtXRsHawInFXJvh1jrJ3Vz90ZNX8Or_0o,754 +torch/include/ATen/ops/real_ops.h,sha256=TeA93g5w_kNwoHk_E0E03B6NyG7KuTYEB3TsdyIVEK0,1245 +torch/include/ATen/ops/reciprocal.h,sha256=slPXhkFX5TwLlRBUg8d1tmZG1yYXjQr5tENm15dH5Wg,1525 +torch/include/ATen/ops/reciprocal_compositeexplicitautogradnonfunctional_dispatch.h,sha256=n-FmtnYvfuQfyI5jfg-KAPoiCnNcvl5ZpAz8ttcXsdQ,1132 +torch/include/ATen/ops/reciprocal_cpu_dispatch.h,sha256=hosu-NhSIUMj6Zu47T5ExvnYqo_AE67Z8t12Ns-kGiA,1229 +torch/include/ATen/ops/reciprocal_cuda_dispatch.h,sha256=Yg2h2yqFqPQZsgJAdaMa2PiFVaRwwaOrH3U-lKZ247k,1231 +torch/include/ATen/ops/reciprocal_meta.h,sha256=SzbbNQHiZLlI7MpeUENUUD-NxSVu7ekO11hAWsjd8wc,857 +torch/include/ATen/ops/reciprocal_meta_dispatch.h,sha256=HzHUHJ01X5gnHJ3TQ9EcwkGf9OszENWk-Y3_7y_eACc,1231 +torch/include/ATen/ops/reciprocal_native.h,sha256=0us6OS-oJNlm4qr1qYAeVHJ6ceE4Xd1zi7MJj0GULrk,890 +torch/include/ATen/ops/reciprocal_ops.h,sha256=m-qS-m4L1kGjrjfpvTWoFA-yo7vSlfgO9Yn8yBthfBA,2392 +torch/include/ATen/ops/record_stream.h,sha256=p9IFMfpmWW1TVnbbqkv2mWSz4dBr3mvh7ZFl8xDAtkM,796 +torch/include/ATen/ops/record_stream_cuda_dispatch.h,sha256=7SeexIBE25_kAwElUJ40FT-HSTTPsTFmGY-o32A8drA,1013 +torch/include/ATen/ops/record_stream_native.h,sha256=j2ty3seFy1259dxQbzuqiAL_nnXlOUsCdUBCx0WKpdM,770 +torch/include/ATen/ops/record_stream_ops.h,sha256=T3dgEDRZyJRGLb1tQeh5hxhLQ_kb2Bed_ivvrsTlbII,1280 +torch/include/ATen/ops/refine_names.h,sha256=R34NxfbfwTlV0V4tLl_QQeeitFNPqGoaN9gmnvQ2_pU,795 +torch/include/ATen/ops/refine_names_compositeimplicitautograd_dispatch.h,sha256=bxB_EP3I0mvfpZ703tyKma0UV_GsiyDZ59I83QWxtN8,1075 +torch/include/ATen/ops/refine_names_native.h,sha256=wsYId6CQ0-MPohRpwbhNifGDU3HNhiEzX_nieQatc2U,785 +torch/include/ATen/ops/refine_names_ops.h,sha256=AI_jK18gBllKd6JB0H3wogip1ItjntviKLbbQ03gPbQ,1349 +torch/include/ATen/ops/reflection_pad1d.h,sha256=t5t3FIFMSTJPEGvbQz6gDoJIB8jTPoqtKi3VLauJqfw,4248 +torch/include/ATen/ops/reflection_pad1d_backward.h,sha256=_USz68AQEGk-kJ5KTBcq8VXY7cWKM8w09UrjCaHqvjw,5411 +torch/include/ATen/ops/reflection_pad1d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=_i-8XGgEfyl8mOtx4zTLThgDdge86Ti96bBwv56I-to,1290 +torch/include/ATen/ops/reflection_pad1d_backward_cpu_dispatch.h,sha256=MgTSjKQp6dt770A1qhcPl1zmfYfGvSGHu9dLru_9K2Y,1892 +torch/include/ATen/ops/reflection_pad1d_backward_cuda_dispatch.h,sha256=Bp-nJiYe7G0hiQkVwiAYmRcp9xZS2HUosrSvOU4W7I0,1894 +torch/include/ATen/ops/reflection_pad1d_backward_meta.h,sha256=kTH4heBrbTP5uAFwYmW5Xjnx6HJ3LJsBg1j20imJMEM,935 +torch/include/ATen/ops/reflection_pad1d_backward_meta_dispatch.h,sha256=pAGMgiuUNBQCgyF48Ruxlkm5gJ1J1er9CB6SlgBQ0vw,1894 +torch/include/ATen/ops/reflection_pad1d_backward_native.h,sha256=GGDpuoHx8HLsSgPfWKb4u5MiTfDlbmEKrTknGQsaWiE,1266 +torch/include/ATen/ops/reflection_pad1d_backward_ops.h,sha256=Lcn8zeLh_CiSixwC0_nSsegOpmBWCxmKdGdYuNtapk4,2406 +torch/include/ATen/ops/reflection_pad1d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=lepwpK3gcTPyV7XPxN8OLtah7IfkYIy5ollnniKywgY,1208 +torch/include/ATen/ops/reflection_pad1d_cpu_dispatch.h,sha256=2UlJKN-19HNqcM3Yu3xNlytiss0E-x9QCsgHH5CyPrc,1618 +torch/include/ATen/ops/reflection_pad1d_cuda_dispatch.h,sha256=7E0NbOQ4UsoE_2hU1ajVVeD2uf3UO-81BroSBx9ZkUI,1620 +torch/include/ATen/ops/reflection_pad1d_meta.h,sha256=iMgrAsF1qFQULkG5460gWEYhJW7s4VGyCcDmFP3xX50,894 +torch/include/ATen/ops/reflection_pad1d_meta_dispatch.h,sha256=0d1nzkvr3ippnq3lRjwEQs0R7p-Ndbdr4AfjsFyBR-Y,1620 +torch/include/ATen/ops/reflection_pad1d_native.h,sha256=5I4-Lp82tE1Mw00pufAs5Q_A4K6IOA48Xh1XZPcMbcY,1271 +torch/include/ATen/ops/reflection_pad1d_ops.h,sha256=6cbgsutaLdILVDXZ1QbQKD02NO2JwE2gMlp5T5eAv-o,2102 +torch/include/ATen/ops/reflection_pad2d.h,sha256=eGc3EBvgJZ7oSbhF6SJ8MbYSVj9PpYSiYRpvBYGD-IA,4248 +torch/include/ATen/ops/reflection_pad2d_backward.h,sha256=WcBKU1HFADVeyJGNsYAdG3XafonzHBPu6G2eDk-tXp0,5411 +torch/include/ATen/ops/reflection_pad2d_backward_cpu_dispatch.h,sha256=tMd4cSEX3JSjt5jNvi4MadYQUaEFQ77vx2lnSU3aoh8,1892 +torch/include/ATen/ops/reflection_pad2d_backward_cuda_dispatch.h,sha256=UAfwtvEnGQUwoivA8KL_B-lQ_G-3NufdomuiQ4qpy3Y,1894 +torch/include/ATen/ops/reflection_pad2d_backward_native.h,sha256=78ggr7IcMsoSgUYr4Ky9smsTxPAE0ZnKINsZ94-EhdM,1305 +torch/include/ATen/ops/reflection_pad2d_backward_ops.h,sha256=WNhwpWA_VuhtUZ6NMgwkfeOw876gsxf_doPCdKB49Kw,2406 +torch/include/ATen/ops/reflection_pad2d_cpu_dispatch.h,sha256=HOokRFiLtle0njm0LZvKStWzA295Uyev3GWi4c1KZNA,1618 +torch/include/ATen/ops/reflection_pad2d_cuda_dispatch.h,sha256=4NkiYn8YhqV4GF8uU_UeHs7iFQiaH4P5iil2GuRlrHo,1620 +torch/include/ATen/ops/reflection_pad2d_native.h,sha256=erAx-wtREBH6gSRswY49naQmgNR9ilGBBWw-Xw7e9Qo,1231 +torch/include/ATen/ops/reflection_pad2d_ops.h,sha256=AH_8ZIf9O3jKWlKEIDiCVTM6ERnXFY5hNndCQ20n0DU,2102 +torch/include/ATen/ops/reflection_pad3d.h,sha256=AbuhRN5vXp2HC5g0QLzcolqJ3swU-kD_zQKJu3NRxqE,4248 +torch/include/ATen/ops/reflection_pad3d_backward.h,sha256=gu4wY90UWfdsec_8iPgIErh-ma69MJ29SqpdqFt9wDI,5411 +torch/include/ATen/ops/reflection_pad3d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=EPBNe2cIz0dE_oQsebrk73Ys2zDEuglUCDQHah0A5LA,1290 +torch/include/ATen/ops/reflection_pad3d_backward_cpu_dispatch.h,sha256=4oPMgIbIELpmg6UPDj4zJC_yW1FtADw3mI3Fh1zsMTk,1892 +torch/include/ATen/ops/reflection_pad3d_backward_cuda_dispatch.h,sha256=d7OfjHVKKSiZrOr-_xjTxVe-TeEqc5YJ7SKFf_TMiFI,1894 +torch/include/ATen/ops/reflection_pad3d_backward_meta.h,sha256=E9kxlPT7ee4sFJWQlYPR5i7DQG8CTmEq-oKxzmLPk8o,935 +torch/include/ATen/ops/reflection_pad3d_backward_meta_dispatch.h,sha256=mBmnBw78Hj8dW0NHK5gP3BLaNhBZYF9AjocCuTRler0,1894 +torch/include/ATen/ops/reflection_pad3d_backward_native.h,sha256=uTMIhdcuTKC2Q3Mz2eBwgstM7ETaScWzYQAlO0QyNDs,1266 +torch/include/ATen/ops/reflection_pad3d_backward_ops.h,sha256=5ERrguRieXqYOuEZbLvHZIYiGQ-HgMAoAIgBCi9thgI,2406 +torch/include/ATen/ops/reflection_pad3d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=jKsUbxhwK70LK9FJS76jeL3989sVV-p2TfcUqyF5vo0,1208 +torch/include/ATen/ops/reflection_pad3d_cpu_dispatch.h,sha256=XZJTST41-ob56l5buqCIi4nGXJchr1udAuEO9v6IQ1A,1618 +torch/include/ATen/ops/reflection_pad3d_cuda_dispatch.h,sha256=fE3z0LwKPwuU4Z3LBtj5re7R3iOxHwPRtLAmR-9j99g,1620 +torch/include/ATen/ops/reflection_pad3d_meta.h,sha256=b3gPe5-dAa5af33i5GrO2pA6IKXXmle_90E2VYg6suE,894 +torch/include/ATen/ops/reflection_pad3d_meta_dispatch.h,sha256=-b5MtbeltDbjH980iS9XXwl-ozKuUGIzroL07yGLj08,1620 +torch/include/ATen/ops/reflection_pad3d_native.h,sha256=a5II8S1IuQuKcGWB4jQqXWHCm9liw23kQNjVpfZcb40,1143 +torch/include/ATen/ops/reflection_pad3d_ops.h,sha256=9dEAYMEKrf4VyPJddS_NnDxLEExpioNRJGBRieGDVoM,2102 +torch/include/ATen/ops/relu.h,sha256=-dTm1j6CVGl-o76nZRcaDuZaKqgjwdH84PDOuhYNwaI,1447 +torch/include/ATen/ops/relu6.h,sha256=CGBzm9WVqsHCkjzjr3ka20GnpXLIu7NgwPzlugVsPq8,1067 +torch/include/ATen/ops/relu6_compositeimplicitautograd_dispatch.h,sha256=y0f5p3cCYyE9mRlYBGmLv_eLO-DvNTOPJeqTmd9-L38,1096 +torch/include/ATen/ops/relu6_native.h,sha256=_GRkisOrPV0eNwNYaqkGhzgqmn35mJlX8vcT4YoGvrs,806 +torch/include/ATen/ops/relu6_ops.h,sha256=qwgKyU9ALu0j7cMoX58wfiswOc1hjbGFKAsNeVrOtb8,1749 +torch/include/ATen/ops/relu_compositeexplicitautograd_dispatch.h,sha256=ClpyZPyi-viUJ9Ssx9lNLfdfjn9AbyZpwDMqIbJe5tQ,1146 +torch/include/ATen/ops/relu_cpu_dispatch.h,sha256=ot-EsDi15zHp5zgVQJ-UIwajdBELAFg4iUZOrdT4yrg,1050 +torch/include/ATen/ops/relu_cuda_dispatch.h,sha256=zu85A3U05g71ddqtjR60ab8lnjnxfYrQNbShOOytpfE,1052 +torch/include/ATen/ops/relu_meta_dispatch.h,sha256=LpqsMwRhkiMGCrBSgSuecKkb1CsQqZUa5GclFCXiZpY,999 +torch/include/ATen/ops/relu_native.h,sha256=ttLoOqbvpVZMw2O-TVPB7bn63h3NmLCXCOx2cnKgXPU,1633 +torch/include/ATen/ops/relu_ops.h,sha256=fdb4CzOgCJYXRrDpETD5VEqR4NTWvJJ7MEkE4WAjzao,2338 +torch/include/ATen/ops/remainder.h,sha256=SN6h9juNdSvBXvCYgtZhzdRUwQ6VlM35iJ2i2GT2j_Q,3079 +torch/include/ATen/ops/remainder_compositeexplicitautograd_dispatch.h,sha256=yR5gNNs6ZWG9D5cfYKQlnXRhLPBr1h986Ye6dZn6UAA,1590 +torch/include/ATen/ops/remainder_compositeexplicitautogradnonfunctional_dispatch.h,sha256=uNur6F4dwx1X_Wlc2vQxbEzIDTlvAOq9waIX4dtYrXk,1182 +torch/include/ATen/ops/remainder_cpu_dispatch.h,sha256=ffnfzEWXy_SVxdwSEk0onuUIdRAuzxsbZ1O_mYKwSpQ,1413 +torch/include/ATen/ops/remainder_cuda_dispatch.h,sha256=WR4IuONfixIEA_7ElEFFu8wLahtrFf5zRMGpFfpLi9k,1415 +torch/include/ATen/ops/remainder_meta.h,sha256=GoFKUgD3dt30OwHhYE6A1Mj93xpUbCTlzpGqLW521rU,889 +torch/include/ATen/ops/remainder_meta_dispatch.h,sha256=MGS4Aejf6Hgjhdt7Yn_omz45W7Et6-ibIDUp3DEXe1I,1331 +torch/include/ATen/ops/remainder_native.h,sha256=07Eii3Zg1WmuMc4icDX5RAtLm0_B7rozSB3s6pcVzQs,1399 +torch/include/ATen/ops/remainder_ops.h,sha256=ENPsogR-oD8DnAPeIwqBApRKpOyhrNP6Rhon868LMoc,6055 +torch/include/ATen/ops/rename.h,sha256=73KMsvUOyOFU779QEC20ztszVTDozRIE5pWIKhHXfx4,789 +torch/include/ATen/ops/rename_compositeimplicitautograd_dispatch.h,sha256=IN7oia3WRUrOfA0p9inWO6QkhVWOSmMlpQEWey3vWxU,1178 +torch/include/ATen/ops/rename_native.h,sha256=vNQQ6gqvkFwHyJT00K3jQLpBqZTL0Y8nrYRGCIgguaE,888 +torch/include/ATen/ops/rename_ops.h,sha256=W4xrxCuB_yfZtC7_9nyf43c0HGhFQGYLW7TIn4uZIYU,2025 +torch/include/ATen/ops/renorm.h,sha256=BJq0rzdQAlH3dUKCt21WPooKDXT6a2MPbBtjgLTUGCk,1671 +torch/include/ATen/ops/renorm_compositeexplicitautogradnonfunctional_dispatch.h,sha256=B2vw-P25plCcaLkQUFuL0jXBccSna0MCC0wEZ57uwXE,1250 +torch/include/ATen/ops/renorm_cpu_dispatch.h,sha256=nPyFpiO8LKeJvSYRr4cp_EDhAYM5xBiqvKrkWXUK2LQ,1465 +torch/include/ATen/ops/renorm_cuda_dispatch.h,sha256=6B3tcO8mTmDCWVG6GOP3lowev_ZzTbexmw8_Q2BMcDA,1467 +torch/include/ATen/ops/renorm_meta.h,sha256=oecCd2BV3m7YYBIpu5EN297H2k9Mkor2U8_ofWI-mlc,916 +torch/include/ATen/ops/renorm_meta_dispatch.h,sha256=pwT7jx9qMA7oXJeKbBWqzn4xcRt1N9jHTA5jaaGE0pE,1467 +torch/include/ATen/ops/renorm_native.h,sha256=uJ-eRAWFMRFyPNaWw0gg8GfSExAn6kmUtP7EWz1LtHE,941 +torch/include/ATen/ops/renorm_ops.h,sha256=jF-NuMvkDutpMBz59pyROQURyl_XfvCNdWPD27I6a7s,2986 +torch/include/ATen/ops/repeat.h,sha256=ixMrwESJm4T-mG8bIPEd2mhvq2YTddLvcjZRnJPdPxA,3515 +torch/include/ATen/ops/repeat_compositeexplicitautograd_dispatch.h,sha256=v1vhqWLRUErZnEgmQIWe0E9rg-INF9t6x2gmyecLo2s,1602 +torch/include/ATen/ops/repeat_interleave.h,sha256=oWihzlRsVyqf_X5mkWkOBgV3bTeUAhNboJQxQ4XT4nE,8673 +torch/include/ATen/ops/repeat_interleave_compositeexplicitautograd_dispatch.h,sha256=NKlU5NWaIUb3JiDr1EExiraQa2TWzencPEyGkuliiaI,1569 +torch/include/ATen/ops/repeat_interleave_compositeimplicitautograd_dispatch.h,sha256=-8EP4hGfDSriNiDUZoAjUunv0rHJg5hhGGQ9WJZm8ZQ,1763 +torch/include/ATen/ops/repeat_interleave_cpu_dispatch.h,sha256=8DdA3anVzywb-e62OV0pPt_Ar70K3Bv49zoU_IKPGFw,1202 +torch/include/ATen/ops/repeat_interleave_cuda_dispatch.h,sha256=o27kvUsI_EilRMVdh25LGfWh8jxHCJSi_UQ2DAHtfPI,1204 +torch/include/ATen/ops/repeat_interleave_native.h,sha256=eW4m7QLC3aasJCv_S4gWiqleuMLBRhlR-CxgG-IauCk,1502 +torch/include/ATen/ops/repeat_interleave_ops.h,sha256=JNiHCrGJkEv_a4BaoGHvU7Ic3RsFAh4IobQOs81o9_c,4054 +torch/include/ATen/ops/repeat_native.h,sha256=mtAL37M8_MBCAWj51BxPN1_zIBThCYJ1-ggZqbGeVCg,896 +torch/include/ATen/ops/repeat_ops.h,sha256=X1JJVLxBVDELHvBgwxDWBA3jzqrpvEr_6LI4UNH6epY,2040 +torch/include/ATen/ops/replication_pad1d.h,sha256=OUaadbb9JHrRRD3OFRAzNVOx4uf3WxYLrZTTLdQudtM,4279 +torch/include/ATen/ops/replication_pad1d_backward.h,sha256=U_TVuLw-rvPHJ4B-8ktdAiMo_C9NwbwER5_IDbHwJPs,5442 +torch/include/ATen/ops/replication_pad1d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=DbacowA_TQbqV79OHW-Ka_MpBB_Jx1NZhLXGcprpuj4,1292 +torch/include/ATen/ops/replication_pad1d_backward_cpu_dispatch.h,sha256=5z--crcE-mfXyFCVJQ8gU8edCrh5BfdoAJIeIYtrNYo,1898 +torch/include/ATen/ops/replication_pad1d_backward_cuda_dispatch.h,sha256=2PWxfJWEg9Dq7fDtXHhVrYlsEXqxsbTyc0EZyJG24Zw,1900 +torch/include/ATen/ops/replication_pad1d_backward_meta.h,sha256=RKwTGF2cqWYU0bWJcG3zsVF4J1WZrP6zDlkFT54cS_E,936 +torch/include/ATen/ops/replication_pad1d_backward_meta_dispatch.h,sha256=kxT9IVsk3JUEgri6i_Mi5DKSRHgJy381vLOvgb3PIGk,1900 +torch/include/ATen/ops/replication_pad1d_backward_native.h,sha256=yNsvMdsPjB-X5tu6oo3cEOARX0UWzX_fN2JyHXhd-oY,1271 +torch/include/ATen/ops/replication_pad1d_backward_ops.h,sha256=KdGHdgMiMwLjvn2vuvqrHmBuOglFQnnQFyoyMiuUfpA,2412 +torch/include/ATen/ops/replication_pad1d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=U7EdzYDzYY3o0gf4EaqcLBtd9vKRamD4Wlw-sg5iz3Q,1210 +torch/include/ATen/ops/replication_pad1d_cpu_dispatch.h,sha256=G1JhwUMdRIXmmsRjQnO3-07Wxf7CvEHkjkfAr0wFQm8,1624 +torch/include/ATen/ops/replication_pad1d_cuda_dispatch.h,sha256=8qUh7q-QrhHP2zjXQRHWRWf86UNaS53XkDNbFxcNPfw,1626 +torch/include/ATen/ops/replication_pad1d_meta.h,sha256=zDGQYdlmAuL68IFV5ncN7-Pf6tV87WTXUBFpYgmhkuQ,895 +torch/include/ATen/ops/replication_pad1d_meta_dispatch.h,sha256=WuL-Q3G3bLjcZySoNzhzkNk7G284-6yXLOprtMkIXF4,1626 +torch/include/ATen/ops/replication_pad1d_native.h,sha256=qg94M7QXSCSQrZnnbfdk28VbWzy5-Ykmly-ItNUbCLs,1148 +torch/include/ATen/ops/replication_pad1d_ops.h,sha256=6kzS_JMQTElj1rR93cMhJYg46nz68YeNlHDnnMXwfyU,2108 +torch/include/ATen/ops/replication_pad2d.h,sha256=jgUkgOQCO_OjcjaC6JWgvxlN9yXO_X9SVidwtQSCUWU,4279 +torch/include/ATen/ops/replication_pad2d_backward.h,sha256=LkXmzHgFo2QA-PW57-UMO52RdWHmhJSogmLcV_ePxNg,5442 +torch/include/ATen/ops/replication_pad2d_backward_cpu_dispatch.h,sha256=GGMhHVQW36vavIAicbhFInHYHVgIr8AdSHPvNfUZij8,1898 +torch/include/ATen/ops/replication_pad2d_backward_cuda_dispatch.h,sha256=IRPIDzadQWnivCKoMEOmLnPAKpELJNUY15eMa8uXzvo,1900 +torch/include/ATen/ops/replication_pad2d_backward_native.h,sha256=klPRVQ09TA-vYoXJSAO5t6Lt3BpVOl4QMrOPE3ZsVYQ,1309 +torch/include/ATen/ops/replication_pad2d_backward_ops.h,sha256=jOdbIROheGfDwfI3dvAbWMIjUfQ-S416Y-MJ3tMEdHw,2412 +torch/include/ATen/ops/replication_pad2d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=l9_lHb0zs7hYiFXtNmytCKNF5gGJ27kbVjgxEmUptfA,1210 +torch/include/ATen/ops/replication_pad2d_cpu_dispatch.h,sha256=5aF67waChwqiEe0ZFiWxnNKkA1CYVCLZfR1Cf_8wiJg,1624 +torch/include/ATen/ops/replication_pad2d_cuda_dispatch.h,sha256=tL92IsNBPvhWxj9_NfRCTMUyPOYjWEF9CK8_NGijzLQ,1626 +torch/include/ATen/ops/replication_pad2d_meta.h,sha256=da49wClayvnBgQK-ufYr8xxrdFQzqpnDMvvi_AQDYWU,895 +torch/include/ATen/ops/replication_pad2d_meta_dispatch.h,sha256=lwSpj1v_bnVKE3wDgelc6nAT6DSiX4090SiD56hol2c,1626 +torch/include/ATen/ops/replication_pad2d_native.h,sha256=wmoUeOGnVSWG6yYkZuzVpxmte0GTqMzAEUYVac9fSUs,1148 +torch/include/ATen/ops/replication_pad2d_ops.h,sha256=KCRkW5cNRS3-agy8QkESGTNng2rJN_JSjf8FxctL1g0,2108 +torch/include/ATen/ops/replication_pad3d.h,sha256=65ejoHpW5CSZI57xPYk2x5taUp_eThYhMKewcXutuM4,4279 +torch/include/ATen/ops/replication_pad3d_backward.h,sha256=jayHXcOJNu-CrLrUzOdVSA_kVVXoy20tg0NkryYa2TE,5442 +torch/include/ATen/ops/replication_pad3d_backward_cpu_dispatch.h,sha256=CzETVgZy2h0Fn5kQOLj68KdtoRHL68_NA03S4dOLXYk,1898 +torch/include/ATen/ops/replication_pad3d_backward_cuda_dispatch.h,sha256=Cop927NiGjPxGI1j_B4_aB88iioMduHIX84Il2X-RYs,1900 +torch/include/ATen/ops/replication_pad3d_backward_native.h,sha256=566VaELsGabs-XHGP4KVea77a-cRFlpERgUpY-8ADMk,1309 +torch/include/ATen/ops/replication_pad3d_backward_ops.h,sha256=yQQTSxbOTdRE51riHVi5ym9WbBRg3hxJxqkpXW_OBJM,2412 +torch/include/ATen/ops/replication_pad3d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=D5r8NoPiuwVKD8Vjwp662YhxCN__bubNw7SXw1MCyvU,1210 +torch/include/ATen/ops/replication_pad3d_cpu_dispatch.h,sha256=GB3l6yZEJye8Ovj_egaBsvQtejt3eE4uAS6C8rUpsog,1624 +torch/include/ATen/ops/replication_pad3d_cuda_dispatch.h,sha256=SS5qVf__x4o5IWJXQC26bMtQDm4FlqvM5dkwwEz9Dnk,1626 +torch/include/ATen/ops/replication_pad3d_meta.h,sha256=OHPcZlViTQ9Js8jf26xS7xous4T1jFtFQcWNs0lD8pQ,895 +torch/include/ATen/ops/replication_pad3d_meta_dispatch.h,sha256=PN2taXAjvgxgXNdoC1vYmMPhw-1ouu6Wj85ubXdiWRY,1626 +torch/include/ATen/ops/replication_pad3d_native.h,sha256=8zwpG_oiMnQXv3qfNYer8g7WaEyt5Fmt-frTXizPVco,1148 +torch/include/ATen/ops/replication_pad3d_ops.h,sha256=Zav5dLLsrkFA2AZhQQoY7OFsbuXe9axtoPL_fySOrNs,2108 +torch/include/ATen/ops/requires_grad.h,sha256=LiE757kcXMrMJqqPqiAPA_ZbaTYNLCn2bCfGBbo-USk,796 +torch/include/ATen/ops/requires_grad_compositeimplicitautograd_dispatch.h,sha256=bRMJ8PueVFq6pnXJWR4VjhOTTwY5MJ1fw1YY9ISerFM,1075 +torch/include/ATen/ops/requires_grad_native.h,sha256=i7SWtAeJeAEL88zqlgj_AZsTAsaHg2GVOZibEFmw5_I,785 +torch/include/ATen/ops/requires_grad_ops.h,sha256=DirpdjwebH4Ok0tyuaYc2JsnvmeMMxufKDguvmY7oL4,1336 +torch/include/ATen/ops/reshape.h,sha256=fsN3nClNoMo8ODCwjidtSFV54zw8hrVBjTEm1Wec5jw,1713 +torch/include/ATen/ops/reshape_as.h,sha256=ipENTFQm4-f52MWx0E4kzlOlUL-Rjy5ziPVzBl7Z1Po,793 +torch/include/ATen/ops/reshape_as_compositeimplicitautograd_dispatch.h,sha256=IQ2XcYPwaWmLN2ktF73HziMR8KYFVkMKM-PxKezzfEs,1076 +torch/include/ATen/ops/reshape_as_compositeimplicitautogradnestedtensor_dispatch.h,sha256=_lbI0nPJ52nuJcMmAXfVhQs6FsxvaD1x4r27fKcjYLw,1100 +torch/include/ATen/ops/reshape_as_native.h,sha256=ZA8ULOU5bc3_Jyt73OQJzOVD01TGSD28GqU_BOICGKM,878 +torch/include/ATen/ops/reshape_as_ops.h,sha256=-vtJ0TdDRS-avb8soSu8zv_hL6tNjPR_YD_PeRqco1o,1349 +torch/include/ATen/ops/reshape_compositeimplicitautograd_dispatch.h,sha256=YQJXj1muQ4OD2rWBmEaW4Yt_sVQnGXkVrXuyzM33BOs,1160 +torch/include/ATen/ops/reshape_compositeimplicitautogradnestedtensor_dispatch.h,sha256=oBjXkKFTBTcpniEMQS6nt2wj5EexeRZAAHNwijdNUQQ,1184 +torch/include/ATen/ops/reshape_native.h,sha256=JD8f-6jFObsC78TGOxgj1dJnm6gJcMhohgcES9NAW1g,888 +torch/include/ATen/ops/reshape_ops.h,sha256=iAMPrZDSF3xLgjqR3FaUjPanbkpseRV80RYgGusll7E,1345 +torch/include/ATen/ops/resize.h,sha256=cf7pfZizDmkGbr8FeH9EUYizT1Bh-LZRgteDQEnNKDo,5708 +torch/include/ATen/ops/resize_as.h,sha256=KfXu0BTZNTWJX3QnPjpwFldb6YTiSMccY7b3x050ktM,2263 +torch/include/ATen/ops/resize_as_compositeexplicitautograd_dispatch.h,sha256=1r3RnipTHiIH-n2670kIkHjMdDxoB1Yu53vhxWT_EVg,1678 +torch/include/ATen/ops/resize_as_native.h,sha256=485_aQM32FUqN4rg2tit2x4a7rbK2ypBwL4BFU5bkIs,1196 +torch/include/ATen/ops/resize_as_ops.h,sha256=thqvlBX9cezqtgLM2Tr5N3iXy40Yn02OOcPHg-389Og,3283 +torch/include/ATen/ops/resize_as_sparse.h,sha256=KTVAlEw-2afF60beX0XGGXQLeu75npAa-w-itY7F240,1911 +torch/include/ATen/ops/resize_as_sparse_compositeexplicitautograd_dispatch.h,sha256=TD1k8BCv2r6P84BPGMkLGWDjdx1FuLuNO0Yszua9Ykc,1358 +torch/include/ATen/ops/resize_as_sparse_meta_dispatch.h,sha256=79SkxUpp2JOGZ04EcxR03GqCgiGo2kL2DKWNhPgbbBo,1056 +torch/include/ATen/ops/resize_as_sparse_native.h,sha256=kGuDfx_3t2RIfSZQEfgFVeQWdsURdW0LrEs69-NhPFY,1158 +torch/include/ATen/ops/resize_as_sparse_ops.h,sha256=aWmF5-JygD0EfnN1RsxKBNEykn4T1HkHY6LRtrZNU2I,2839 +torch/include/ATen/ops/resize_compositeexplicitautograd_dispatch.h,sha256=jzxW0z4Cr5871563ZUiJMwDbE0g6frpacpoJuSTr-eo,1986 +torch/include/ATen/ops/resize_cpu_dispatch.h,sha256=BTvo0-L3tunAsqTuKMWHRHLWvKMhbNeij628nvXO2og,1258 +torch/include/ATen/ops/resize_cuda_dispatch.h,sha256=wArD2vGAqvzJFa_Iwm1i4rRpo0ib6XcFvoWdrkoGZos,1260 +torch/include/ATen/ops/resize_meta_dispatch.h,sha256=V2ruN2wX6jVr7rM61UtkfdDXbWTKBk5w8qG88Pyx4K0,1260 +torch/include/ATen/ops/resize_native.h,sha256=H8C_PofhicZ9q3rL1zEvVh43Mx7rXATXVx2nPpgNBUY,1817 +torch/include/ATen/ops/resize_ops.h,sha256=DcUxP_-BwBmS2KTvuGAGd7yIaB6wVPrSR-rP_1A5usQ,3199 +torch/include/ATen/ops/resolve_conj.h,sha256=GifYnX5tVZeYEGyFrH0KKWMvPF4H1jlvNd6Uclxt53A,957 +torch/include/ATen/ops/resolve_conj_compositeimplicitautograd_dispatch.h,sha256=odOhN42NnJta4edMMPK-0QLTR5c_m4IloHkIvuqesww,1052 +torch/include/ATen/ops/resolve_conj_native.h,sha256=XE8NGmLTUj_OjIvu2pnaON55l2yMMxWCD0aHMsiFtYs,762 +torch/include/ATen/ops/resolve_conj_ops.h,sha256=ufkTAF6Buj45KS5L5IykXA-GK6LipDSyAydIe6kQKZc,1269 +torch/include/ATen/ops/resolve_neg.h,sha256=jOWE_qe8NPv3Q9ZIO3LiMET5uv1LjJaD0bOvVMdwYKw,953 +torch/include/ATen/ops/resolve_neg_compositeimplicitautograd_dispatch.h,sha256=lrTN4NfQYEPQmUyE1juzx_ixwrO5qOylMkURZktsKMQ,1051 +torch/include/ATen/ops/resolve_neg_native.h,sha256=8CsCQ3OCqxzbvRWk_kyCi-axCQILUJFDlDqxgMSWKH0,761 +torch/include/ATen/ops/resolve_neg_ops.h,sha256=00D9fBOusl-c-4ufV2zh8f2e8ZCwuw18tXlwmXaSptg,1266 +torch/include/ATen/ops/result_type.h,sha256=tAkgDxFNfWA7njgs5No-kNTdPSqMgSHr_CsZaQQ-byQ,1752 +torch/include/ATen/ops/result_type_compositeimplicitautograd_dispatch.h,sha256=WbdwSp0RIF76Z1jsmMjbta-mTQEglX8bz8XeCivVNPc,1363 +torch/include/ATen/ops/result_type_native.h,sha256=Q1cORg5Xd_XXQeMQY8tLq2MazelTinNpyJ2iwoX-WP8,1073 +torch/include/ATen/ops/result_type_ops.h,sha256=KN8R9AW4B5awyKkM0_AN-6XbJVjuszPvIDM5mIyK4uU,3404 +torch/include/ATen/ops/retain_grad.h,sha256=ahCR6mADRZd3u8w0Tip2aayeZTPrCBaj-zxyncT0SVA,794 +torch/include/ATen/ops/retain_grad_compositeimplicitautograd_dispatch.h,sha256=O_wl1uX-XnPFyMU1zYROkm3tuuTw0iBBfiysljFw0Kg,1039 +torch/include/ATen/ops/retain_grad_native.h,sha256=TkJWVx6VbkPz-WiP7I0VeuKYvLneZV2FUg5nu_Uw7Uc,749 +torch/include/ATen/ops/retain_grad_ops.h,sha256=6ZTgiXDALbWHQ38Wq1gSuqmV4dqADjUBvyQritvniGw,1224 +torch/include/ATen/ops/retains_grad.h,sha256=tswwdqvLo2UtwomHmGoT8nPLjslo9U9vg4xDOMlNoXY,795 +torch/include/ATen/ops/retains_grad_compositeimplicitautograd_dispatch.h,sha256=Mv90J00bx7y8gBRKIVSg-9mNVzXc6r60shHWiYeXkGA,1046 +torch/include/ATen/ops/retains_grad_native.h,sha256=cZVHAM-o-2PO7s6ZfUZWPcvAV2SKS8JZhLZ4r6xlnio,756 +torch/include/ATen/ops/retains_grad_ops.h,sha256=vrK4Gec4QldHsKeXkP-jE-7-7jBzznavDjnbYWnOeVo,1243 +torch/include/ATen/ops/rms_norm.h,sha256=fWumo83OY40MKAPaEc6U1PMJu45w62Pcree6u6n5WOY,2324 +torch/include/ATen/ops/rms_norm_compositeimplicitautograd_dispatch.h,sha256=lDIooFushQdrzNKmjqVjVsWdcLXyL3VfTlOsOpcO0wA,1368 +torch/include/ATen/ops/rms_norm_native.h,sha256=8B_jtWojvaAODU0ZnT7m86RZuoRJl3wNhRE-sZMf2k4,895 +torch/include/ATen/ops/rms_norm_ops.h,sha256=CW3ipVPMLQp8pS-ICW7d3tIyiPgsMK2OIsiH8CVd5wk,1624 +torch/include/ATen/ops/rnn_relu.h,sha256=rYSaRF4h5yTmzvZH3ngt0UsutkNm3nub2KmQ6Gvxbwc,1902 +torch/include/ATen/ops/rnn_relu_cell.h,sha256=Pc6357gArkY0V3ghJ63miBvh_depVVa_v5SC1sjQapI,1224 +torch/include/ATen/ops/rnn_relu_cell_compositeimplicitautograd_dispatch.h,sha256=Tx_iKAJOHftxeZL-ZpkBumzavXInDMWa2icUc2j17qg,1217 +torch/include/ATen/ops/rnn_relu_cell_native.h,sha256=dDMME9IiW023hLuDx83wxmk_fGnkFYRd5O6vThjdXx0,927 +torch/include/ATen/ops/rnn_relu_cell_ops.h,sha256=xMLqnnDL6UrFOXLAYPclLe_Fm-CBf84D6YXvxvnGXkY,1792 +torch/include/ATen/ops/rnn_relu_compositeimplicitautograd_dispatch.h,sha256=kBWKGyb7CORfS-dladRRsG8-V8qJU2zVCycbynwIYWk,1468 +torch/include/ATen/ops/rnn_relu_native.h,sha256=YMdhLpTceAtJlCFKAWEFn-SGdKj0i2FJJFw5ZRmGH5c,1178 +torch/include/ATen/ops/rnn_relu_ops.h,sha256=OeLWeMWmoiWjEW1AVy7siCLvAgF42fc9IsITKvCJpno,3018 +torch/include/ATen/ops/rnn_tanh.h,sha256=jkwp7W2Ocu5sTMCZTFUfeJfGBQpohY3hKHK-j0J02qM,1902 +torch/include/ATen/ops/rnn_tanh_cell.h,sha256=RUq7IJ0LC_0wvHtVxVtf6izKebCZkEMzzr8tKxAaNEc,1224 +torch/include/ATen/ops/rnn_tanh_cell_compositeimplicitautograd_dispatch.h,sha256=fI8b4Cw3M3fzIjsG3G14MjvD0PdCWH0gm9re3toj8vg,1217 +torch/include/ATen/ops/rnn_tanh_cell_native.h,sha256=a7ZPmmuVaVqhK5hphflRTthu1squ-2DRkYxNl1wMSNY,927 +torch/include/ATen/ops/rnn_tanh_cell_ops.h,sha256=RECNO3Tb3VmF5FxghHrXhfJyb5vN2XiA5EWf9K2TC7Y,1792 +torch/include/ATen/ops/rnn_tanh_compositeimplicitautograd_dispatch.h,sha256=gYHXC3TR-ygmhkGIbAPCstUBPBtxpKTazL4ZIM3SiM8,1468 +torch/include/ATen/ops/rnn_tanh_native.h,sha256=hQcWdSr1NyJ3cZd62hSAbWSpzn_dPSais3nh_56jQH0,1178 +torch/include/ATen/ops/rnn_tanh_ops.h,sha256=fCX17-gim98TMkT_gdrCshGTOw0uRf5HWgK5qD1onBo,3018 +torch/include/ATen/ops/roll.h,sha256=gfLEUoOcIYgmlEuniDFZOWI-sy9tPnyeqxvZ3_I6AZ8,4302 +torch/include/ATen/ops/roll_compositeexplicitautograd_dispatch.h,sha256=6awHtEbclymCEgxs10mic2PBDllQBg2334N0YSMkjP0,1513 +torch/include/ATen/ops/roll_cpu_dispatch.h,sha256=8zPeJ18ehOnLdCGJcgIG8a4_uSBSUWQPxC5Y7D6eH9c,1162 +torch/include/ATen/ops/roll_cuda_dispatch.h,sha256=a5VNEhGJlsnEFvY8boxzPkE5SXdhsTKoRFiXhbLHG3Q,1164 +torch/include/ATen/ops/roll_native.h,sha256=Ptv_JfogQKIIzxO021i6jK3BAQUBzARwXtruZKnJGLA,1044 +torch/include/ATen/ops/roll_ops.h,sha256=6Cz6sFF0ox9FhDbK5xg3MIF5YTKJN4L0N3BHSCqG508,2178 +torch/include/ATen/ops/rot90.h,sha256=f9PEVXeza0A_qECtqh3MoADbBYx5em_NRnIoRIb6Gs4,1539 +torch/include/ATen/ops/rot90_compositeexplicitautograd_dispatch.h,sha256=SLl8xevymMgV_qw1fNzMSePFjeHXpHeqMC07VHL4S2I,1317 +torch/include/ATen/ops/rot90_native.h,sha256=YgCFPVLMiduFVRnvuRmJLClrrY8ZlchKbhzSKlxBxwo,907 +torch/include/ATen/ops/rot90_ops.h,sha256=QAUf6PvdSTpRcNWcJv2k2jVEOhpmEfQRtiW2mPlpaiU,2078 +torch/include/ATen/ops/round.h,sha256=CEGci6bjFQ_tWRZLnEppAFg7WYuVoQijDU-tkeiqQgw,2380 +torch/include/ATen/ops/round_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Zc2Rz82u9QlUEAa5xuIpRQjvtepl5wxmDguf_pxbsDU,1263 +torch/include/ATen/ops/round_cpu_dispatch.h,sha256=lBwJUHhJL0J2Sik4fMTg9q4IPHiheQOnGESZ3QjPil8,1543 +torch/include/ATen/ops/round_cuda_dispatch.h,sha256=-bQGtFZZCvIr-sz-9jNnROkShNOf4suW-EaBBS8Ubm4,1545 +torch/include/ATen/ops/round_meta.h,sha256=WqlFUgZ-0idc1smS3MN_VXYudVQmR2tSIi-1QLRuRBE,993 +torch/include/ATen/ops/round_meta_dispatch.h,sha256=zHfnVHXKXXkl0fcgusq8KiVJZQIFFQy0E9hh4AjMFy4,1545 +torch/include/ATen/ops/round_native.h,sha256=GuVp_CurHufOS4xvbCRuzw9EF_1L9nW_dXTD-a7kAQk,1473 +torch/include/ATen/ops/round_ops.h,sha256=FE-qQqYr4jWc_ns2lSfyjP5errqfnBKzd95Y-KjLD68,4222 +torch/include/ATen/ops/row_indices.h,sha256=Z5E65hKpfuj-iQNBZAmxLTEHsKMgxhjfeu2sfwZrKzo,794 +torch/include/ATen/ops/row_indices_compositeexplicitautograd_dispatch.h,sha256=8YFql6ERplGIK7CQxxMH9T0Nj-V2uqPidIEZGHKxJdg,1051 +torch/include/ATen/ops/row_indices_copy.h,sha256=zAjdKivU4JGSulcQzE9SOaMdyrlY46fCod91fEt2LF8,1426 +torch/include/ATen/ops/row_indices_copy_compositeexplicitautograd_dispatch.h,sha256=mIMh7JroU583ch8N_W3YEDmm1SirVuOR5OXrtjxDaaY,1170 +torch/include/ATen/ops/row_indices_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=2co8U3t6_0zTuahGFbEgVFElxL__EeXpIEhhJT2jPKM,1082 +torch/include/ATen/ops/row_indices_copy_native.h,sha256=Cc5_yWc0Vpi31iVXo5vf-4fVoA8a--9KIChhmmQbrL4,855 +torch/include/ATen/ops/row_indices_copy_ops.h,sha256=9lKDjguIV7g5fdPcS__RkxrNwWMRlS2uf0J3D7JzYsg,1906 +torch/include/ATen/ops/row_indices_native.h,sha256=XFFpD9eWlABkF-pD5ORB1mem1vNzbPwNPe-KFpf1_pg,840 +torch/include/ATen/ops/row_indices_ops.h,sha256=2GOw2sY9Al8w0rtvQIfpoFW-NCs8zmTigdVvhOBmNzM,1266 +torch/include/ATen/ops/row_stack.h,sha256=rYA-ma4jZSUwj3ZDpH2-k-nPU52Rqm3Gjsfqe88aFPg,1377 +torch/include/ATen/ops/row_stack_compositeimplicitautograd_dispatch.h,sha256=gUhrS-zdsamDSsvNbE40064TQxDeGSJRVq_b1pnJaqA,1211 +torch/include/ATen/ops/row_stack_native.h,sha256=HYwlF6zdmcixgiklHhsnetMg-bJKWixpyhLN6Cwlp6c,839 +torch/include/ATen/ops/row_stack_ops.h,sha256=0Qfjs9RypZm3nkPCUtNHoZBcOguJ-SryBB5OZApoCJc,1862 +torch/include/ATen/ops/rrelu.h,sha256=AgqvQlvPit9qzTwdBOe-03Ml6H2ow0R7lt3Q5ZGPr04,1649 +torch/include/ATen/ops/rrelu_compositeimplicitautograd_dispatch.h,sha256=KCgqlZelvGSnRbGGqhEfIbNgNTdkGQSToPsmDMHAFOY,1406 +torch/include/ATen/ops/rrelu_native.h,sha256=3DShLTrOFc2UV4Pae6bELNLO2akRbUIwZrjEOk7rHzg,1116 +torch/include/ATen/ops/rrelu_ops.h,sha256=ZlfLb0xvYUEZnIwGfBMU60G3qqWTY-Hip7QzjzhLApk,2543 +torch/include/ATen/ops/rrelu_with_noise.h,sha256=JAWmPYdAJ7jaALRo8aLJ7ZD4vo9Q91bLgSiHP5cG4tg,3487 +torch/include/ATen/ops/rrelu_with_noise_backward.h,sha256=MFF2z_BGtmTuFtmxfajK718sHqF4xnLAeVapiKex6sY,2428 +torch/include/ATen/ops/rrelu_with_noise_backward_compositeexplicitautograd_dispatch.h,sha256=iublT0_zOacqA-q_xPFUYLOpLp5z330oY33v992Pznc,1700 +torch/include/ATen/ops/rrelu_with_noise_backward_native.h,sha256=s1xpMZmPZGarEICj9X_faOssOVUSLk58guGQVuIAZlU,1165 +torch/include/ATen/ops/rrelu_with_noise_backward_ops.h,sha256=jK4Jba0_1DFDwEa4G3douYxv25XAud17EE-g6fP4e0g,2924 +torch/include/ATen/ops/rrelu_with_noise_compositeexplicitautograd_dispatch.h,sha256=E0vLmRhMZANlFolxEG-1lXB8G0pQ4v87FdqT8YoSNag,1273 +torch/include/ATen/ops/rrelu_with_noise_cpu_dispatch.h,sha256=NBs7qWc73DpSE_xdpFLlRcofJBU1jH-H1F3enC0rjJ8,1907 +torch/include/ATen/ops/rrelu_with_noise_cuda_dispatch.h,sha256=6bdetbMczs-eR8a3qFtOKowO0uoNnYD8N7kF_3A7IiI,1909 +torch/include/ATen/ops/rrelu_with_noise_meta_dispatch.h,sha256=rzVsyN-S9k9rs-iUatSErc--kIwNCF-ixGow28I0AU8,1186 +torch/include/ATen/ops/rrelu_with_noise_native.h,sha256=dL06bHSpgjQRZBsWU1xSCqBJ1VQsb4wgeUfHRiBL2go,2400 +torch/include/ATen/ops/rrelu_with_noise_ops.h,sha256=_8a_ut90Gq0Gz68MeGiG0-lf6KWooj0IMCxE1ccOobQ,5005 +torch/include/ATen/ops/rshift.h,sha256=oF6jE6E4Naw-cAd4Fk2QPh7sR1_vTt2XB45gRFOl-0Q,2303 +torch/include/ATen/ops/rshift_compositeexplicitautograd_dispatch.h,sha256=VWwnSmLMqveqDClxFj7qXQ90YkcyNRRKmizhCmHwiBE,1429 +torch/include/ATen/ops/rshift_cpu_dispatch.h,sha256=tpw3eRjVsQRQM3NZODZCNTIoqrR6I3qSbHaiKPHVxRs,1281 +torch/include/ATen/ops/rshift_cuda_dispatch.h,sha256=Ae_EuCXerNQnEW2sVNF8JgLkWHAOpCG3dXjkrQujFps,1283 +torch/include/ATen/ops/rshift_meta_dispatch.h,sha256=XJU9oK65VDUiGFXUi2V23bV7a_2Rt92PLqq_UTmdn3g,1113 +torch/include/ATen/ops/rshift_native.h,sha256=lbuMydHZnONU3OK3Z3uA7dbxMHdOUh1GjTVQv75k7Fs,1267 +torch/include/ATen/ops/rshift_ops.h,sha256=RAYwMa-GrwrjmxuTlB4d_77L8o3Vjo3VTvYPAQ-uK0I,4688 +torch/include/ATen/ops/rsqrt.h,sha256=iwPDqVanJGvKolMS9PzcM1AXfNoNtRVtnb-CT2LfOv4,1460 +torch/include/ATen/ops/rsqrt_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Dzg59EvC8ftAATQJ_ueh8BGS4Fu2zpOEzE_cym_QOgE,1122 +torch/include/ATen/ops/rsqrt_cpu_dispatch.h,sha256=jOMjr03mu6of5mNm22cj7cX0Obr6Oe6SedYMFjwlPPU,1209 +torch/include/ATen/ops/rsqrt_cuda_dispatch.h,sha256=nOjG0PxBUuY5yADk_QXk7oQN86IdbeSAOpg_HueGnBc,1211 +torch/include/ATen/ops/rsqrt_meta.h,sha256=Pj7R8swiOqUQXvmUm2F5My40FQNeCbdueqh61-LcMVM,852 +torch/include/ATen/ops/rsqrt_meta_dispatch.h,sha256=4YPILI5zzx6PcvXVUi_aBDcmOfny2DPIYMCXnjKm72U,1211 +torch/include/ATen/ops/rsqrt_native.h,sha256=6nHPT5IDBEl_NYF_jDb_ImU0S51ud_-c2ftbpJ-b3iA,875 +torch/include/ATen/ops/rsqrt_ops.h,sha256=15BOHfS2UJd_pEMudwMKHjK9oEh6ASq1BTBy9Jl5cbo,2347 +torch/include/ATen/ops/rsub.h,sha256=isHKrru9RfJk0tYOwUPOR7-fMvg5L2NyDG6U3_gZkcM,2498 +torch/include/ATen/ops/rsub_compositeexplicitautograd_dispatch.h,sha256=c_gjuBxswm6Bo7NV_6msnJc-TfpROz4_6RRuu5QdP_A,1620 +torch/include/ATen/ops/rsub_cpu_dispatch.h,sha256=wCN1B7JKipzV6E1zhS-bpr8Y_7FeZhhhFiBa6fjgDm4,1054 +torch/include/ATen/ops/rsub_cuda_dispatch.h,sha256=z6XqJXL1dxPewwZv-RZlNszF1GBg7tKFwWwGKhbt5u4,1056 +torch/include/ATen/ops/rsub_native.h,sha256=ck81XCHBkIHIuIoAu_E4ZEUxreyG1ZlVFBTP73PaLSQ,1187 +torch/include/ATen/ops/rsub_ops.h,sha256=B3VKClb625mdMr92a_1CWQ4ugDMZorCkfAPcPjwEH-c,3715 +torch/include/ATen/ops/scalar_tensor.h,sha256=53_YNph_wB5nrwKnynpN2JvkKfpAsGUduaFt2xlyZqM,2037 +torch/include/ATen/ops/scalar_tensor_compositeexplicitautograd_dispatch.h,sha256=WA0shWD6bDcyAfFBlFQ4Ftcl-ecB7Us6oMBp0DTF9Zo,1451 +torch/include/ATen/ops/scalar_tensor_native.h,sha256=zTr4s3Fg3SOSNGxLi4NTSUcWESGUQye9LTWj7YkywFs,1000 +torch/include/ATen/ops/scalar_tensor_ops.h,sha256=4MJLcqIXnVmWgVFMr3lOetpC2Fo0eZHRVRjzmGRRSMs,2366 +torch/include/ATen/ops/scaled_dot_product_attention.h,sha256=d1cSrlbRg-isu0qwqFT7cZdRIJo9tky5NiYeTOiUAuw,1433 +torch/include/ATen/ops/scaled_dot_product_attention_compositeimplicitautograd_dispatch.h,sha256=y7FC715IAejPKnxbI0nXzn5ENaWmVy4EDriRnlxQB-g,1282 +torch/include/ATen/ops/scaled_dot_product_attention_native.h,sha256=Jh_YNLAaX1lwg0MmQ1QVt7DI9MtM1uMaQE6wyeETDWU,992 +torch/include/ATen/ops/scaled_dot_product_attention_ops.h,sha256=ZEbpQIhwZuy0peVl9UQ0jkWpVYq2jy-1NssWo700i1Y,1932 +torch/include/ATen/ops/scatter.h,sha256=OArX_1Syr-kYh6hkJDCUb4nDLWNn-_CuITPFvRvSLuo,5442 +torch/include/ATen/ops/scatter_add.h,sha256=ZL6SY-hmml_BpJM88OIqn1NsbX5bwSJw_IUQbeXtMRA,2015 +torch/include/ATen/ops/scatter_add_compositeexplicitautogradnonfunctional_dispatch.h,sha256=sKVViSfup-O8qu3tgXX7OgVxsK0Dp13m5D1gEbReyIY,1260 +torch/include/ATen/ops/scatter_add_compositeimplicitautograd_dispatch.h,sha256=1x1iodIxl68C13DQEUGT792lpdyQjz9QYFqfmIPI5UM,1118 +torch/include/ATen/ops/scatter_add_cpu_dispatch.h,sha256=8ASven1KgGRbq4q83SRl_BLGUPGGbauvjm4ayaS2hw0,1485 +torch/include/ATen/ops/scatter_add_cuda_dispatch.h,sha256=x6KV27utJPRP-4PKESx7LctI0ZQdxdD8p-4tu0Zpe-s,1487 +torch/include/ATen/ops/scatter_add_meta.h,sha256=Tt4wIfpl2y6VQI_KLk3T92ziFkDukR7JQ8hJD_6Mxyg,921 +torch/include/ATen/ops/scatter_add_meta_dispatch.h,sha256=k0PIMSqoWNW8f2iokZFbt4iifyoEJzvGguBvx6UDVIg,1487 +torch/include/ATen/ops/scatter_add_native.h,sha256=SQLgrvwvPSNmELiCZ1rUWSVVyo-s7UaJ0GnaI89alLU,1079 +torch/include/ATen/ops/scatter_add_ops.h,sha256=dvi0SdAWXYxaHQAhvfR1FHJ9GqWkWKveHTcD1H8VqvI,3806 +torch/include/ATen/ops/scatter_compositeexplicitautogradnonfunctional_dispatch.h,sha256=oWrlQlIc6DAQS7BJHTZV_wfh8yiAwuTIuqmsOLFFCew,2065 +torch/include/ATen/ops/scatter_compositeimplicitautograd_dispatch.h,sha256=pjYP3wlyRGCm6SAC2UkpuyIYwEM123BOZSft5Be_jEs,1239 +torch/include/ATen/ops/scatter_cpu_dispatch.h,sha256=RtnypcJTUSJcGGxyMuZR75-t8NydNV9iyE4cvuZPY5U,3251 +torch/include/ATen/ops/scatter_cuda_dispatch.h,sha256=5Va5nwgCj32iXVICjF7JQl_I7NbNNnS6BfCUobDJ0vc,3253 +torch/include/ATen/ops/scatter_meta.h,sha256=jnS15g9LNN2ETwf3WGgmEaGqrT2sxvJlWyC6k77Ab2E,1538 +torch/include/ATen/ops/scatter_meta_dispatch.h,sha256=ckoDffVXlsLK-Qpt0rW4a81HgSre7Zl8Qgwj_1UcYb8,3253 +torch/include/ATen/ops/scatter_native.h,sha256=mBPcIvQpHb26QwEVxUXmhcyCrBKlIlet14Rlovk5Gxc,1933 +torch/include/ATen/ops/scatter_ops.h,sha256=hNV7VUiM5_50aNPBFPySF319LeQeNEk4IZOmm6YZ_3E,12130 +torch/include/ATen/ops/scatter_reduce.h,sha256=ezJzN0ZQzqsqDrFdgGnhmW1_2vj3fryATPKc1klojdE,2094 +torch/include/ATen/ops/scatter_reduce_compositeexplicitautogradnonfunctional_dispatch.h,sha256=mkZQD1tea-WTjFIH3y7Wxzn1mowfCzfWEY-D_RC3k7s,1364 +torch/include/ATen/ops/scatter_reduce_cpu_dispatch.h,sha256=uBSuTtEDnRwG2dDaraXJlc0EHjbHlk7ZkRYwg-Er6oI,1688 +torch/include/ATen/ops/scatter_reduce_cuda_dispatch.h,sha256=fB_D9QL-sby898TS7zlrSe4zwZRY6CrkxsktdaveA4E,1690 +torch/include/ATen/ops/scatter_reduce_meta.h,sha256=q7u-NS2Zhx-p2Qg6HUwoWOamd6Dv_kzu235Bh9bVC2c,972 +torch/include/ATen/ops/scatter_reduce_meta_dispatch.h,sha256=wOFdV1LsdXM7GX5KvxdNV70HpO4vIGl7PKRk4UgubIE,1690 +torch/include/ATen/ops/scatter_reduce_native.h,sha256=1CcyuWRlAXOVVKAoMxm71d-R_Wkq9mBTrNufIu1N6y0,1013 +torch/include/ATen/ops/scatter_reduce_ops.h,sha256=9BXQS2xFwbSBKRrGgjIwjohXPAOxSkUi_j9juU9SpsE,3542 +torch/include/ATen/ops/searchsorted.h,sha256=I965AVN9ckmhkJ-hHo0X86_N3V4g__bycixdd2fhq0o,3977 +torch/include/ATen/ops/searchsorted_cpu_dispatch.h,sha256=4ZzTaHb95hPq39eS9vCP1DlyhMGTbmPZE8ToLLEgJ3Q,2419 +torch/include/ATen/ops/searchsorted_cuda_dispatch.h,sha256=pyDnPHMam3Np3Y6WtEZclMHC7MvPVCxeHlTJKr-UB7g,2421 +torch/include/ATen/ops/searchsorted_native.h,sha256=ZsgDrPQKQXVfkoOQLuAmuQBJ8go_KUjdIsgD7GuCFXY,2625 +torch/include/ATen/ops/searchsorted_ops.h,sha256=TYZaIMeUFEKG2Qngk98Lfa9g3ASFWRpNgVBT5GlvErg,5122 +torch/include/ATen/ops/segment_reduce.h,sha256=Ahx545wvd054bfZpfmd7LYImUB0f8ub6wdB1TkOUKbE,2736 +torch/include/ATen/ops/segment_reduce_compositeexplicitautograd_dispatch.h,sha256=Xr64A7JQV1RiiCuwSUn5f0JVgbQLxuhxWMLOfRKjrXg,1662 +torch/include/ATen/ops/segment_reduce_cpu_dispatch.h,sha256=Ai_wPFVnuJW5ACchDu2GC6owPzWKMPlo1KlH8pKC1H0,1274 +torch/include/ATen/ops/segment_reduce_cuda_dispatch.h,sha256=TtU_h2rIOCrtq-PrijrY2YvapR0VztPjLds-Whfsdd0,1276 +torch/include/ATen/ops/segment_reduce_native.h,sha256=uFhpt-8AX82eCDIUxddDwJTAiovcMnx0CQeWDp2J3wE,1354 +torch/include/ATen/ops/segment_reduce_ops.h,sha256=Nl0WP6Bo-AVTY2CUUIfc7VdBkhMcUPS6XWA-jFAkMd0,3449 +torch/include/ATen/ops/select.h,sha256=YUYUMmvlBOIhX5-8GzkaUKGYCjxD-kmZ5zj1ey6tlrw,1958 +torch/include/ATen/ops/select_backward.h,sha256=Rm1L99T5nHmGV44JgI6qjAi6iJ608TZN0ryx7skJel0,5183 +torch/include/ATen/ops/select_backward_compositeexplicitautograd_dispatch.h,sha256=J1tnLuKLRMt3XdhFcLmp3q4c9IgRzgokuqfrNLCTwtk,1631 +torch/include/ATen/ops/select_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=q8BdMhNuGBQjqKFWAjzmSn8sS78rjqj2lwur1hOxXGU,1288 +torch/include/ATen/ops/select_backward_native.h,sha256=_V_2JkFe2GKzerNHMd7aJIGsEuD8qjayCzhkhERm65Q,1011 +torch/include/ATen/ops/select_backward_ops.h,sha256=YKIOTsIWCXkQMv1PfFvp_syoh-NpE86wWMAEend_MXs,2378 +torch/include/ATen/ops/select_compositeexplicitautograd_dispatch.h,sha256=RWI6cmQ9TAFuMBD11iCuWZ1VUFeWIs68A0QggnEAHRE,1168 +torch/include/ATen/ops/select_compositeimplicitautograd_dispatch.h,sha256=ag_gDd24eR4HJekCyVIj_mtNk_MhUM1n4eKabGoLJs0,1078 +torch/include/ATen/ops/select_copy.h,sha256=V8CD8lmuaDh7s2_s3NeLI16aU5jUhoX09suDJQfSh0I,4105 +torch/include/ATen/ops/select_copy_compositeexplicitautograd_dispatch.h,sha256=CDRoFGmIai5VG3K75KVmwdbHQQNQch9SbtzdmPGIsPk,1463 +torch/include/ATen/ops/select_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=JDwGJVGXGm4_Pv1n7Sm3GmPx2mYEmzVfbKr43KIC4kk,1204 +torch/include/ATen/ops/select_copy_native.h,sha256=WefxKnhBokJl8sv1KpQ3HJuKwLc76CR6ny4PZKKIplA,1026 +torch/include/ATen/ops/select_copy_ops.h,sha256=s7yoA7xq6DqswsnPMUGxjSrxc5uiKDoA2CjOpMLz9q4,2117 +torch/include/ATen/ops/select_native.h,sha256=8oppfZJ3AHA5_LrW-_iF75Xa2ocaBWR6gr1NJ2TgyVA,1066 +torch/include/ATen/ops/select_ops.h,sha256=jqkp52naJEAuHrOGI--r9RND21TMt90djczIByGabI4,2021 +torch/include/ATen/ops/select_scatter.h,sha256=xqYhF07n9CQMx0P4sIqwLwd0noO5zU-i_2iP9ZTLo54,4546 +torch/include/ATen/ops/select_scatter_compositeexplicitautograd_dispatch.h,sha256=2CiNQTWrREnI3QeF-mg33LqtrsRLa5b3Ztg5_2XyZpQ,1571 +torch/include/ATen/ops/select_scatter_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Ey5rlgc219Pe-vMMBVG_bH-zBqXeEpyKssxy49zxyp0,1258 +torch/include/ATen/ops/select_scatter_native.h,sha256=kb31m6L1lks2eQMxzBBb_SiRJlo4Z1tGfphT6I6fLLo,977 +torch/include/ATen/ops/select_scatter_ops.h,sha256=dShjSBTtAq-YyPa1RSF2gg_F8_2dKFBqYDK4VNeb6Qc,2272 +torch/include/ATen/ops/selu.h,sha256=q3VRznnL09ABGD8oE4MhuLsItQZ0xZKtsSQwyIBr6NU,1060 +torch/include/ATen/ops/selu_compositeimplicitautograd_dispatch.h,sha256=PkUu9g-2ZJ2IMtM5vN76Bm4ytGUL12RfYcT-stqzfBo,1094 +torch/include/ATen/ops/selu_native.h,sha256=X0C0Gz79TQyScizn56Y-yB_Azqav9zJeHNVgnBGbCTI,804 +torch/include/ATen/ops/selu_ops.h,sha256=kyFh_LOFAVLJGqtwNzS6fqbVMF1bvbk-IXkxOs1vb-A,1743 +torch/include/ATen/ops/set.h,sha256=HLXRh6kYbk2ljB6FnSYeqzgz3aTVwn0_Oxrt_rsFFME,9631 +torch/include/ATen/ops/set_compositeexplicitautograd_dispatch.h,sha256=fkDX0CKPf29sIuQJETT57eEi8hH7dyYK_v9z2iC5nAg,2766 +torch/include/ATen/ops/set_compositeimplicitautograd_dispatch.h,sha256=roIM2O-oyfEFDujK12A9sUl5F4ySwnVK3wz14zY_0RY,1308 +torch/include/ATen/ops/set_cpu_dispatch.h,sha256=p5wyFsIRw0BUS6-eDswHhoVlzRrMUMAcgbbuloOjaB4,1444 +torch/include/ATen/ops/set_cuda_dispatch.h,sha256=5pRY7TJ4R4fYdwD71QfB9UBq9nVP1CB4THrd67uIBZo,1446 +torch/include/ATen/ops/set_data.h,sha256=LxH3dyksaPPX5sGKMw8gLsZp76kWCGRNJqF1d0XdOBU,791 +torch/include/ATen/ops/set_data_compositeimplicitautograd_dispatch.h,sha256=UpFzQu5PAqGxROVnXJAoq4bXvX0FiCDuf66QYrF5pXs,1065 +torch/include/ATen/ops/set_data_native.h,sha256=tzyzyAFW9eK4bkONU31o0LU5JRlHRIZO6cfyudo3Sbc,775 +torch/include/ATen/ops/set_data_ops.h,sha256=2WWk6x5iZ3lPGm7FRoZbLrKtri34RlKExc7U37TApus,1310 +torch/include/ATen/ops/set_meta_dispatch.h,sha256=H4qaO6n5aojzRdJBW3aszHxB8HVt6JFgxDjBSv_WfyQ,1446 +torch/include/ATen/ops/set_native.h,sha256=Tf74vK2gYlFZs8GNxafGUQ6ahGxIr1UvKZEvO8E7pU4,2711 +torch/include/ATen/ops/set_ops.h,sha256=U03dqwsxS8mIzuU9E1qugA0ZYqN_VBDbJWaRhbBIXWI,10104 +torch/include/ATen/ops/sgn.h,sha256=iM6ajxdrEaItiYhS4CzeFR5aqidoCDNbaLBxNB2SaG8,1296 +torch/include/ATen/ops/sgn_compositeexplicitautogradnonfunctional_dispatch.h,sha256=WUPC7fuHMK-lAjCl1IpbHID-glnZbDEH-Pz0a9tnU4E,1118 +torch/include/ATen/ops/sgn_cpu_dispatch.h,sha256=qGi2Cx4A1F4eDtkyK9QSJz90R2ubl1o0nTzhidraNN4,1201 +torch/include/ATen/ops/sgn_cuda_dispatch.h,sha256=sdl_aUizHHKzDa2HX_AL8xYPuZUj_Qc83xRisttZQX0,1203 +torch/include/ATen/ops/sgn_meta.h,sha256=6aI8omW1wzdBhgp3uWvKIA0gJTaGpuP4qWMJdHwey1w,850 +torch/include/ATen/ops/sgn_meta_dispatch.h,sha256=Xm31yCB0yj10gm0q7MLkP2BRWgbtmroSgypGpEHo7NU,1203 +torch/include/ATen/ops/sgn_native.h,sha256=_XHAouwrNRn1JuIH1XgoQZi3lsZG0Kf6sanRfeaBG3U,1404 +torch/include/ATen/ops/sgn_ops.h,sha256=eBP9ddd4F1PxEJpr36QA6AFba7Xb-cPYNKEbsHrB5aM,2329 +torch/include/ATen/ops/sigmoid.h,sha256=7rOuc4j7h13M7fPkGocKc27cTmhmjpGvlDX66uLfkQM,1486 +torch/include/ATen/ops/sigmoid_backward.h,sha256=h-uMrJq3MiGSxYcKxUpX1W52EZAdlhjCX1yeeZvVHKM,1709 +torch/include/ATen/ops/sigmoid_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=cvz2cOO4zt_dKVzB2e4leXAolnm-iGGxKrc_Nrruf5s,1116 +torch/include/ATen/ops/sigmoid_backward_cpu_dispatch.h,sha256=tKfq7MZMXwiFc2ZcCUCsYQjbMatkZWy7Jqvf6nNygGI,1307 +torch/include/ATen/ops/sigmoid_backward_cuda_dispatch.h,sha256=KpjK9OwcxrfqZckynZYDbJ1kINqMRJR74oL7kKG1qIQ,1309 +torch/include/ATen/ops/sigmoid_backward_meta.h,sha256=qLOqA1eehO0rEZTfZrFTnO23v7iSIIVbex11da7ar1A,897 +torch/include/ATen/ops/sigmoid_backward_meta_dispatch.h,sha256=e2I4Iqh7DdER7cAqoODLbX5qamipHFODLOaaKLOjzRc,1309 +torch/include/ATen/ops/sigmoid_backward_native.h,sha256=cjPOE1sFnPW3xYs2yqZInAwRLqNWBBlbNUCrjxf2yDw,949 +torch/include/ATen/ops/sigmoid_backward_ops.h,sha256=Q-4vRxMVP3MQrUzeBD2TID8CjcMObAMTM8B06ZkiPCM,2168 +torch/include/ATen/ops/sigmoid_compositeexplicitautogradnonfunctional_dispatch.h,sha256=7HSUO_GtYz51DWaHXMO0NjHDgz-oCVsHNy_IpjCCu6Y,1126 +torch/include/ATen/ops/sigmoid_cpu_dispatch.h,sha256=WmjLlio7XKWN2w12mwuivdZs5A-0U9vi-pINau04A5k,1217 +torch/include/ATen/ops/sigmoid_cuda_dispatch.h,sha256=i-Z1qrN3VQeImalRDQMfbaN9fx5SBAAEmJuV5s6-SUQ,1219 +torch/include/ATen/ops/sigmoid_meta.h,sha256=MkVMrUuIignq0XM34us6AkHcbu4teDBmAmGgCcnNFY4,854 +torch/include/ATen/ops/sigmoid_meta_dispatch.h,sha256=nw0Ex8Jw20RHjqrLpxEDSLCr_ugs2XV_ctOXoSKWpRg,1219 +torch/include/ATen/ops/sigmoid_native.h,sha256=RYEWf-Hjq8wIEUqUOyJelWJntB14jVXoO9kjc4lWGi0,1074 +torch/include/ATen/ops/sigmoid_ops.h,sha256=g0KMbHs0bKUj3AIO94t2MNZeYFxM6LqdSTOLjBoo81k,2365 +torch/include/ATen/ops/sign.h,sha256=SxBioZTIFJzI7I-GZjWW4qlBPWF9Koqmgovh4lJH-v8,1306 +torch/include/ATen/ops/sign_compositeexplicitautogradnonfunctional_dispatch.h,sha256=PCORfY6Jjx-odkX0fQuyiA9_CCYOSlntxPocijIhXPM,1120 +torch/include/ATen/ops/sign_cpu_dispatch.h,sha256=Xwu3eIdNr46jifH6tt3YkF62Knnt-H2B4Zi1iHeFLh4,1205 +torch/include/ATen/ops/sign_cuda_dispatch.h,sha256=4vcAyQzSrb72Bmv7Ko_mggcOGBYJhUf1OolcHATliLI,1207 +torch/include/ATen/ops/sign_meta.h,sha256=eQauVgOSLzEX5EcAP8w62lWQUUrpAqdh8f7z70mirfA,851 +torch/include/ATen/ops/sign_meta_dispatch.h,sha256=F4g2X6-Vf0erkZ5XW30GO4Xkel3m9Rj1h9tqjCbrs2o,1207 +torch/include/ATen/ops/sign_native.h,sha256=pBiAw3BAIQOWMpfcKoIrbjKrazw_VtMkiipf8attvIo,1286 +torch/include/ATen/ops/sign_ops.h,sha256=opJuAWBCUD3avBjjrUoocPYhOi9WvojNOgAF5bxYL0A,2338 +torch/include/ATen/ops/signbit.h,sha256=HjKcJkQnz10eRKvG5CFlxGR2zPdDCiVQHT5V_UhIfYQ,1336 +torch/include/ATen/ops/signbit_compositeexplicitautogradnonfunctional_dispatch.h,sha256=SPTt1HaNdnMFUYNlrhyFxr6ki-Gn35-SlIR4yOhHRD8,1073 +torch/include/ATen/ops/signbit_cpu_dispatch.h,sha256=gXqXDV8X5--nA1Lv0_SOjOSehq1fACJG23QyIQJrBmk,1164 +torch/include/ATen/ops/signbit_cuda_dispatch.h,sha256=4eEqsxgmHZZfr8L_V6CkFmIcrQtLGDpytQOT08Xvja0,1166 +torch/include/ATen/ops/signbit_meta.h,sha256=6soRXWMCQMIBF1xmvyB6ICMnEBJ7GXCWEqADNcDg3Ys,854 +torch/include/ATen/ops/signbit_meta_dispatch.h,sha256=ASpQ79zoTuFXlMweD-tG3TwvOkJckh1aizhfq0KADUc,1166 +torch/include/ATen/ops/signbit_native.h,sha256=dMPIwDPcacrQiOH5WNf5DX95S1P0vAh0XL02rZDQrOE,1189 +torch/include/ATen/ops/signbit_ops.h,sha256=KX0pLbAap0HRxFv0Ken7d2boliUK8NNi4KELaMUU2iQ,1852 +torch/include/ATen/ops/silu.h,sha256=58H1QYqxfalA_RCvJv8f3zZqciQoEiPN16LqhXMvc9M,1447 +torch/include/ATen/ops/silu_backward.h,sha256=yDoQ_X7_B-jDNOhBbeF6FLrCDQMkPvRdHFPzXxdtRrU,1661 +torch/include/ATen/ops/silu_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=JPHL4IMgtBD9qO4H01b0GNjd53ohvnXrlYNMfK6PjKc,1111 +torch/include/ATen/ops/silu_backward_compositeimplicitautograd_dispatch.h,sha256=kv-8fcn2bQLzy8-9jNuf1ukIMfTowywoo5gJsKgYuXA,1085 +torch/include/ATen/ops/silu_backward_cpu_dispatch.h,sha256=2fA-QT0kVaXJpjjJa_exIDF71dsOks1B-kAzwTCN77w,1292 +torch/include/ATen/ops/silu_backward_cuda_dispatch.h,sha256=n14xrX2HFPFuPw2W-8RYZ3K1q_O3x3zCgYCzo5lwRAY,1294 +torch/include/ATen/ops/silu_backward_meta.h,sha256=bDwUIWJADhw6fcb6vJRxQolc6q5q0IaTFlVlvdHYHoM,892 +torch/include/ATen/ops/silu_backward_meta_dispatch.h,sha256=gtRxXaHLionCE6vp61l97KRB3ITC6s4TQzvzJN68YW8,1294 +torch/include/ATen/ops/silu_backward_native.h,sha256=SKhhOKVtXGG9m4uHZD5sPfIk0yWJTbs7c602WbaXRUs,1138 +torch/include/ATen/ops/silu_backward_ops.h,sha256=bNTNNUNbm1OjcGHceseZttUy7F5PHe5H5ODnndVMf90,2138 +torch/include/ATen/ops/silu_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Y_dYhcLhXGh4l0pBeS1mk9q4WZGfgfA7Mx3fDZdJnmI,1120 +torch/include/ATen/ops/silu_cpu_dispatch.h,sha256=vGJUOVDel99Za2EFhjHlBCbOJbhFOBPZo-lEse0FpVw,1205 +torch/include/ATen/ops/silu_cuda_dispatch.h,sha256=dfisMlGzaYbqM2Tfj8piLnfSNMoig_0S86oBdQUkzE4,1207 +torch/include/ATen/ops/silu_meta.h,sha256=8tkOPJTwFcHVwCf_hn9-198O1DIHqiYWUBEpF4zuuic,851 +torch/include/ATen/ops/silu_meta_dispatch.h,sha256=-_xN_7-3JZ33H54_TUZLuETwKX3ntA6ibHb05dhU2EY,1207 +torch/include/ATen/ops/silu_native.h,sha256=m1c9O3FrHiiZUevGP-HgM8vHHE4Y9NdS5D0HOBck7oE,1001 +torch/include/ATen/ops/silu_ops.h,sha256=ug9GVbfrEpTcniK3DTZzJ2HoGnQq15Uj9Y3kxtvtTKw,2338 +torch/include/ATen/ops/sin.h,sha256=zEA5lEmgABe7Z1FVSavNH9u-cs44JODSBATSnv4y2dI,1434 +torch/include/ATen/ops/sin_compositeexplicitautogradnonfunctional_dispatch.h,sha256=xLliIv5wjpBgvK4_x7jMudjUy-Lmi1mCgwGZYxfd-Zc,1118 +torch/include/ATen/ops/sin_cpu_dispatch.h,sha256=xPuo5FktbJsRMt2Pt1cQqUGahFLLNT9XVyMXxviZWJY,1201 +torch/include/ATen/ops/sin_cuda_dispatch.h,sha256=TGohUlBYAoIgeEhBx-LCaa8ZVhkd537wqGfceY5R0-A,1203 +torch/include/ATen/ops/sin_meta.h,sha256=cdHB8FYjjzuXQAEAhfvEjhiu7OmS1QvRFk-0uy8P3jQ,850 +torch/include/ATen/ops/sin_meta_dispatch.h,sha256=xtGiB01j03EFvr7NER5StUf9JZdNcn1mx24hOuC5iQE,1203 +torch/include/ATen/ops/sin_native.h,sha256=INgKBa2iO6E2W_IJRwr-FukdgEzpr50Fkf8aNg_Vr7E,1342 +torch/include/ATen/ops/sin_ops.h,sha256=mVnvMRuqMGq_dBbkRPRfweiZrtEVmmTUBKYifRfIUBY,2329 +torch/include/ATen/ops/sinc.h,sha256=antUZix7lkE5yFgcHho7NQ3XEOP6s4D4_zC4LjNhkro,1447 +torch/include/ATen/ops/sinc_compositeexplicitautogradnonfunctional_dispatch.h,sha256=QAjb2Y7SkV9rKZhKh3OXb6WLVldX5eWTQpLQ6W2cZrk,1120 +torch/include/ATen/ops/sinc_cpu_dispatch.h,sha256=TZ9HpX5Ebiml5sM35OdU9EV3vyZJJyCo99Ns4xEjubk,1205 +torch/include/ATen/ops/sinc_cuda_dispatch.h,sha256=YvS8kBQkz1ug2_rr18By0p3I3r5hOOHr1zXZOxGz7Mo,1207 +torch/include/ATen/ops/sinc_meta.h,sha256=lCRzZ6MCgTvLYV5N_AW2kKzBpZ2ptk-VsCFq0yeGFzg,851 +torch/include/ATen/ops/sinc_meta_dispatch.h,sha256=eOk4BFshHvbfc5dEtJtNS79G7MqQL7Vq5yoNb5CLvcU,1207 +torch/include/ATen/ops/sinc_native.h,sha256=lP1g-TJSpJtxU1dm3WVpjxfY0hECDPSP9KeUpCQCSeY,872 +torch/include/ATen/ops/sinc_ops.h,sha256=-WYXJAx00KU_rtaqNCF2MhL6vkj3jnqvF0gc_uD9MSY,2338 +torch/include/ATen/ops/sinh.h,sha256=lDYXmzddald0x_Mht8xC79gtNaqTV3yjIP3iM4G_uzA,1447 +torch/include/ATen/ops/sinh_compositeexplicitautogradnonfunctional_dispatch.h,sha256=ICqyMN2LNpJkg3cPN8pGJc2mQbTtlnQc2bUyp473GDk,1120 +torch/include/ATen/ops/sinh_cpu_dispatch.h,sha256=xrfIBjHphwu7IzDAVXWPbIkAw2bx_Vyt2cWk9jVPV3M,1205 +torch/include/ATen/ops/sinh_cuda_dispatch.h,sha256=bdSFbcrZB25zhsXIjC6Vx5EfujcJic-VFwvpc3brd4Q,1207 +torch/include/ATen/ops/sinh_meta.h,sha256=lp2QCvEAUWiklBctkNaXVVpLcu4P1x8OIDsG0-y55dg,851 +torch/include/ATen/ops/sinh_meta_dispatch.h,sha256=M70QDhNu2c3SaZO3YFp9Tt7IWDV5Fc89hvqV8xQsPe0,1207 +torch/include/ATen/ops/sinh_native.h,sha256=I_8ZtEc9iAPqP_VPJnm_hT85QFjPsJZirMEstOZoxIw,1286 +torch/include/ATen/ops/sinh_ops.h,sha256=0BYQthfzqPX1eBv7QodmxcfQIcEuLjoquLOqy30zlQ0,2338 +torch/include/ATen/ops/size.h,sha256=FavmHvHAXU-KFEVhnJzhV8Rhd2qOrk1e-EM8BvBXAqg,1138 +torch/include/ATen/ops/size_compositeimplicitautograd_dispatch.h,sha256=HZP7F3tnsuuwgUfwyEXbcEYDiJL8tCdqTKgJRyOvkIQ,1121 +torch/include/ATen/ops/size_native.h,sha256=3yU6muueal2D_-X7HYZU-0UDVHVEECjB7ZJEpW7pWzI,831 +torch/include/ATen/ops/size_ops.h,sha256=zckpFEmUEHXVldreOXshIivN84kA6KNzDRJ7r7vYWWo,1858 +torch/include/ATen/ops/slice.h,sha256=_Fa0_funU55fvf6G9U0nr8vtGLmVEURId9By5fOlwzo,2545 +torch/include/ATen/ops/slice_backward.h,sha256=J-r2rHwPDxypCgDbUeoHntdXDGAlH8488_3toqgH2YA,5806 +torch/include/ATen/ops/slice_backward_compositeexplicitautograd_dispatch.h,sha256=A8oC-rIqgqqzSIjcuJfdYZpTfpaTdUY_Q_pLhkLVGRk,2082 +torch/include/ATen/ops/slice_backward_native.h,sha256=8FtrKx_ncJMbPEkYzqsn887aivtUOdGbPcR_kCBQ5xY,1056 +torch/include/ATen/ops/slice_backward_ops.h,sha256=dr_r0-MSY1oAL80JpUsEUCBRAlB71U26jSKaQKxb-rA,2614 +torch/include/ATen/ops/slice_compositeexplicitautograd_dispatch.h,sha256=7RFTQocFUU4c-LUPH8f0R_L3SY46SiPvfUNmuWoj6Bc,1364 +torch/include/ATen/ops/slice_copy.h,sha256=qaWPPiyON1AU5BUiqGmXR0_3D9rM7sLYOX_EMz2rU8I,6422 +torch/include/ATen/ops/slice_copy_compositeexplicitautograd_dispatch.h,sha256=7_xUQt9DM4rWgToOWhjwp23qKbjS2cpq-u1MkP4R2rQ,1787 +torch/include/ATen/ops/slice_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=ScUvhUjDjS_hE1Y_rK6g9EODgnPHWDKbgErfPmPHA04,1400 +torch/include/ATen/ops/slice_copy_native.h,sha256=c9ctMvgfhjZofRFAMDX1sq4U-cJ7xfkpWkTNj102NMI,1107 +torch/include/ATen/ops/slice_copy_ops.h,sha256=ZIlDmwd-mpP0EMZolQcYwiU8fObSef2kLfz2_StR7CQ,2607 +torch/include/ATen/ops/slice_inverse.h,sha256=nuHCMx5Ul71UIGiB3xJsK_jMy_sFsZobRfH-fvbnp-Y,2731 +torch/include/ATen/ops/slice_inverse_compositeexplicitautograd_dispatch.h,sha256=C2l7FfcExgZjCm--YbUvhpCpn-GDurZVaFiTyjgHhKo,1428 +torch/include/ATen/ops/slice_inverse_native.h,sha256=FaEIPUTBFduouuRI-sKkq81v9KvJy0GttapzRVtFAs4,929 +torch/include/ATen/ops/slice_inverse_ops.h,sha256=1e1qdo0jZqfG2onvUWV0XthRk2LjlwEkAI6-buyg4bo,1700 +torch/include/ATen/ops/slice_native.h,sha256=0klieSwu0h3KRu9dqxDSw9dXEUBAHyRubYR503Zsctk,878 +torch/include/ATen/ops/slice_ops.h,sha256=WTReeKprybhLVVgWlATqfNMrnKIGXhxLoK0K85BNOZ8,1616 +torch/include/ATen/ops/slice_scatter.h,sha256=H6vqJVoFcBmtpB_S5rqCCaadSWhTMIQbI3rv-CZhgxM,6809 +torch/include/ATen/ops/slice_scatter_compositeexplicitautograd_dispatch.h,sha256=VNUkfG4Fe0QuKLt3gagG2_QDpZZF2ZdL3xiPhCkPxRA,1895 +torch/include/ATen/ops/slice_scatter_compositeexplicitautogradnonfunctional_dispatch.h,sha256=3UbyeuS4OAwpFow5PamZTt8RnChNoQgZfoEHbGilSOA,1454 +torch/include/ATen/ops/slice_scatter_native.h,sha256=-RFIDNoxoxJdVO5iR6e3WzDx2V0VmQZSGZhIN4FA87c,1128 +torch/include/ATen/ops/slice_scatter_ops.h,sha256=BSFIjk5LVRacNh8vSlYeSY7xenQ6MOdr-SzpOSgGIAA,2744 +torch/include/ATen/ops/slogdet.h,sha256=SKXESOipVcWN63NNdHPgX2ky7LeKMxY3bGPsflJTABY,1618 +torch/include/ATen/ops/slogdet_compositeimplicitautograd_dispatch.h,sha256=XQGRu-o6exTQF4ztAt9HbDHOVpIhvl42KyzkJ7CopWY,1337 +torch/include/ATen/ops/slogdet_native.h,sha256=148njEmFxMZRV1QdjmKNUKIJV7Yspy6HLbG5VccRHS8,914 +torch/include/ATen/ops/slogdet_ops.h,sha256=3BatuWRvuSZGotNNkzgg1IJXv5G0yKnAPI2g2Yy3CUU,2149 +torch/include/ATen/ops/slow_conv3d.h,sha256=dUVaaaPbq3txRYc9qmnaqSYJRvACSlMfrteHfHxq0rE,6971 +torch/include/ATen/ops/slow_conv3d_compositeimplicitautograd_dispatch.h,sha256=JdufnbhxPydrgoNSPgZdwcxBbuKwkrXQNNITPo6hkG4,2468 +torch/include/ATen/ops/slow_conv3d_forward.h,sha256=1mchJUeoRoMDlp64nhSwq4-qSQAWQ8xa5JNEdq6SWps,7101 +torch/include/ATen/ops/slow_conv3d_forward_cpu_dispatch.h,sha256=-pCYKuSvXP0XyGXT949DaDz--JdPQYmmEJOmz3k8hfk,2404 +torch/include/ATen/ops/slow_conv3d_forward_native.h,sha256=smP74GwylSolrTyNvacvN4wDoRvoYK_4TvWkxF0tUEs,1166 +torch/include/ATen/ops/slow_conv3d_forward_ops.h,sha256=cwOV-ObXk59uMDW1JXv-bpixigEp2zrtdAL-cEjYNvw,2996 +torch/include/ATen/ops/slow_conv3d_native.h,sha256=pE3vQSQpnxJLc4iDXalSt21m_HQigcwifO2LIfbJDb0,1146 +torch/include/ATen/ops/slow_conv3d_ops.h,sha256=TvvX5dvPoWao2qBLkM-j7B_4BeRzjiBnLFfEl2gVxQA,2948 +torch/include/ATen/ops/slow_conv_dilated2d.h,sha256=A-Ol7I5EytYXbwVW6EP72q77q5Vi2SBPD1_7_MhegPg,8031 +torch/include/ATen/ops/slow_conv_dilated2d_compositeexplicitautograd_dispatch.h,sha256=7p03u4oE4-drEdDHJMeyLgUGXgmYCAWZlBq0TLXbovs,2156 +torch/include/ATen/ops/slow_conv_dilated2d_cpu_dispatch.h,sha256=YgAga2_ejx7XhtWJg9T1MB_5JEhFwCTs6BrmdyfxKzI,1509 +torch/include/ATen/ops/slow_conv_dilated2d_cuda_dispatch.h,sha256=_i1IfVWvsuW6aK5aa_XSnSfbrZCmw0yB-Oz99032mb0,1511 +torch/include/ATen/ops/slow_conv_dilated2d_native.h,sha256=B0YkCswUZLcPmfyKRsvAWcEbcwAVdk59gocPGQraM5U,1498 +torch/include/ATen/ops/slow_conv_dilated2d_ops.h,sha256=cKdXnpeQzInwSj1wb69WzJ15x6haVrvTkZcMD2-VnaQ,3202 +torch/include/ATen/ops/slow_conv_dilated3d.h,sha256=7dIKpOkaUSlq6Rf7q1UINIqyCxzpMysk8DxRuPx92t4,8031 +torch/include/ATen/ops/slow_conv_dilated3d_compositeexplicitautograd_dispatch.h,sha256=ydkXxvWztZsLxIShWutMUKeTExQsztIPcoGJ6Fe7RHg,2156 +torch/include/ATen/ops/slow_conv_dilated3d_cpu_dispatch.h,sha256=GqPPvHDrUQ5ja5kGY6r7myaUm0sk0O9CTZnCbCZRQ-M,1509 +torch/include/ATen/ops/slow_conv_dilated3d_cuda_dispatch.h,sha256=0lWOlrZMVMB1zd8NUMKc-Qw_6qivUZzCPjMo6cU02pA,1511 +torch/include/ATen/ops/slow_conv_dilated3d_native.h,sha256=A51MJ44PyIP9YcJlRY9-7_rlz7wCdh1C7qtilcEPJ5c,1498 +torch/include/ATen/ops/slow_conv_dilated3d_ops.h,sha256=v1RehAVtQt8VrLctxT8smgFWqIiXbKBUEFvshl_-zDQ,3202 +torch/include/ATen/ops/slow_conv_transpose2d.h,sha256=oLJfgMHj6ixfUyHlLfT-8qYjuG5mXiMfSDw8Mf9lR2U,9085 +torch/include/ATen/ops/slow_conv_transpose2d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=8h_rGzXskZ30Nb470NJVC2m2C46GXZjxNDfh4zQEbfk,1668 +torch/include/ATen/ops/slow_conv_transpose2d_cpu_dispatch.h,sha256=GOIVgyxccF7XnmV43iW7yb_cQlZW9a5ChbarB7Y8Z3o,2924 +torch/include/ATen/ops/slow_conv_transpose2d_cuda_dispatch.h,sha256=yZklZ03fHRm2iI_XIdRXdkdJzpj4cL5fW55ndsY37T0,2926 +torch/include/ATen/ops/slow_conv_transpose2d_meta.h,sha256=4fgpx3xcvCi0ETbONixUWLZ94z10ppaXvNJjw0WO5tM,1089 +torch/include/ATen/ops/slow_conv_transpose2d_meta_dispatch.h,sha256=nYoYhI2RvAdUQ1I5Rs1lxvB9yTCynQhdG1RCc93LcP8,2926 +torch/include/ATen/ops/slow_conv_transpose2d_native.h,sha256=0YIsZnlnuFtTQSqnY06KjJWwAD_KcwZcSSgKMVSiOl4,1562 +torch/include/ATen/ops/slow_conv_transpose2d_ops.h,sha256=zI7GhtQACnwKgQeljJT_IaKt1UAcMgH55ZZTNhI3QMM,3456 +torch/include/ATen/ops/slow_conv_transpose3d.h,sha256=nXrifo3ojpc23zdXTHvcgr5TJfrTyoGlo9FENB9KUHA,9085 +torch/include/ATen/ops/slow_conv_transpose3d_cpu_dispatch.h,sha256=ujEqpQRR8kCsmVu3Sn23cZMxxv6CgA_gg5IzzCzChaY,2924 +torch/include/ATen/ops/slow_conv_transpose3d_cuda_dispatch.h,sha256=V3W3PPiy3HROHEncab0RoNB70-gPsUK8AtrT1mjYrjc,2926 +torch/include/ATen/ops/slow_conv_transpose3d_native.h,sha256=UHztgXscEjVplQPaj7dy3y9HjYEfo2naCLxIth9tYao,1889 +torch/include/ATen/ops/slow_conv_transpose3d_ops.h,sha256=vxcM317G6SDPJ2SxmucJHedM0Zu_j0hsqUJhOIxoknA,3456 +torch/include/ATen/ops/smm.h,sha256=8V6FJcEYDQs3k0GHG-sg6DEVfkrHKNGQ4i-zN5pqdlA,959 +torch/include/ATen/ops/smm_compositeimplicitautograd_dispatch.h,sha256=2_zfwBihGbNEuSGcbLiu2iOXO4r4up30A_Mki4yQahk,1068 +torch/include/ATen/ops/smm_native.h,sha256=7V9lU6FTw0chjxZ3G6Ws9FzIiQIK3sL8yH9kvfp4Jq8,778 +torch/include/ATen/ops/smm_ops.h,sha256=joOzCfczqUma4S0KSy89n4TJ32iVUf8jMtd6usfOoa0,1319 +torch/include/ATen/ops/smooth_l1_loss.h,sha256=IhpVyW-UPZh7RNUJF5p6L4rcN4z3Yj17ARekhltOATM,1859 +torch/include/ATen/ops/smooth_l1_loss_backward.h,sha256=vg2nyXQkfcajynhcAl5RPnZbymt9dpBt3WQSs5VeHfM,2139 +torch/include/ATen/ops/smooth_l1_loss_backward_compositeexplicitautograd_dispatch.h,sha256=TI_O9P1bnWDjdDiwTkDGI0qdQ1lIPPTQZTq_zCVP0NU,1154 +torch/include/ATen/ops/smooth_l1_loss_backward_cpu_dispatch.h,sha256=AXLUz4OjwDb7jheZRBgE8rO4y8SJuAolnLAlwcgMfoY,1336 +torch/include/ATen/ops/smooth_l1_loss_backward_cuda_dispatch.h,sha256=9j_Bw6toRkjHRXn7L9qtPnDiQb7WNQru_GnIpaw_q2E,1338 +torch/include/ATen/ops/smooth_l1_loss_backward_native.h,sha256=hQwKytaQlPtcrrUX7cLL_eHSpFCTRTpqtxRCRmjW8RY,1058 +torch/include/ATen/ops/smooth_l1_loss_backward_ops.h,sha256=wsDAvyVaI6FDmhPQWG2YIZPWbkYVY3iPT5GMSCxgQ8E,2592 +torch/include/ATen/ops/smooth_l1_loss_compositeexplicitautogradnonfunctional_dispatch.h,sha256=vSnOlDfNEz727S3etzGcA4oyzF-SFOsNejbbsrk9uUk,1163 +torch/include/ATen/ops/smooth_l1_loss_cpu_dispatch.h,sha256=tgGXqTscDZju2X7gPe62PCoZKLiK8Zj_U3sxU8PCDa8,1410 +torch/include/ATen/ops/smooth_l1_loss_cuda_dispatch.h,sha256=x_deYsUo82_xPhke58Cfw3S74kxpQ2jR72g3QQbIKTo,1412 +torch/include/ATen/ops/smooth_l1_loss_meta.h,sha256=cfAdHTyjpWrAzZF4HOnGBie6aq5slNXiAYXxgan2eEY,920 +torch/include/ATen/ops/smooth_l1_loss_meta_dispatch.h,sha256=x4mMcPreKL8e2zOS3l8kz2vxgM7VjP11q1yTXH_GQPc,1412 +torch/include/ATen/ops/smooth_l1_loss_native.h,sha256=rsm-pxy-BvNRbX1sqQu0G2rtjXXNoiBXf2pFt3wCfuU,961 +torch/include/ATen/ops/smooth_l1_loss_ops.h,sha256=P4m6brBMfHUHMTJlQfEx4mHWWIuTvZ8V3FaauljypT0,2306 +torch/include/ATen/ops/soft_margin_loss.h,sha256=i_UlClSitoW4xcjqdtlyuMoALdaVsxjwpyEmVe-EqCU,1766 +torch/include/ATen/ops/soft_margin_loss_backward.h,sha256=LhFIl5bLHGUkZ7u0SZdZmNMmmD_iK_Hok21dvRyM6k8,2066 +torch/include/ATen/ops/soft_margin_loss_backward_compositeexplicitautograd_dispatch.h,sha256=2RFR9gCd01v-z_Kc8CNcauOcBi-yPBNN_rgw5ya5AzQ,1510 +torch/include/ATen/ops/soft_margin_loss_backward_native.h,sha256=Dqu8vcps-3cbLiP5VjEJV4sK5U67LS_4WbNhqieQP08,1036 +torch/include/ATen/ops/soft_margin_loss_backward_ops.h,sha256=H01wqLUIcq443rF9Pm6JHitCQcOT7MLwpoAm-kK_pRQ,2512 +torch/include/ATen/ops/soft_margin_loss_compositeexplicitautograd_dispatch.h,sha256=Wiq31fyIvrbN4Y9JB0Kt1yozbdxTr82P-EyEBkP8paY,1413 +torch/include/ATen/ops/soft_margin_loss_native.h,sha256=ry_IrY5MqblAjxCEfnF90803W3XoSZpbig-gCmms8m0,967 +torch/include/ATen/ops/soft_margin_loss_ops.h,sha256=ke09j5Zn8Ptphgv8ZtbtzWZ2enxtKeLA5GPUwASoT8M,2218 +torch/include/ATen/ops/softmax.h,sha256=NoSLtcd8jFwcolX1sXQgOlLu4MgMkzMmbQOGSW0FsCg,1963 +torch/include/ATen/ops/softmax_compositeexplicitautograd_dispatch.h,sha256=JHbR6Lm1M1Q_d1T_OwIet7zgtUovudKIFVGWD4lP8nY,1271 +torch/include/ATen/ops/softmax_compositeimplicitautograd_dispatch.h,sha256=8PQi0RGd_hfoLFBAwZGxojdryYOGlLRdsqf1T7Qay3A,1241 +torch/include/ATen/ops/softmax_native.h,sha256=pKYmLBoOWRwmiX5lOMRPklH45ZGI-JBXoETG5TYU_l0,1083 +torch/include/ATen/ops/softmax_ops.h,sha256=4wfmD-148dGnZRjvKtYczXyJf1ZoabpbSlh2h6e9KFU,2968 +torch/include/ATen/ops/softplus.h,sha256=EpYYb66LQq4wTkYaA6TT1sE4rQEQKLlqXv_lm9Js5Zc,1680 +torch/include/ATen/ops/softplus_backward.h,sha256=ZEUG7b7ANsfs2KMnByhjvEQC3BpnVg0cE_K2zKs1cxw,2010 +torch/include/ATen/ops/softplus_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=O7ruQQ0CyJyNIf0S2e4xt3sZzwQoIdDwNCXz4aDd7Ck,1170 +torch/include/ATen/ops/softplus_backward_cpu_dispatch.h,sha256=-GKAAF_I9mIYXLwHoow9vsYTtcD5MaQVuhlk-rXnl3U,1469 +torch/include/ATen/ops/softplus_backward_cuda_dispatch.h,sha256=vA96zMRwNL4M1gPncXyBPYMPV0stJIEc54vvv2U20L4,1471 +torch/include/ATen/ops/softplus_backward_meta.h,sha256=shcqGjmpFIOlnxvaCJZ0WppQjKjIJk_Ebzsw7JYu--M,951 +torch/include/ATen/ops/softplus_backward_meta_dispatch.h,sha256=twUU3IfTYLdLTQZLQwDvoQzq-nq9NZEicOV0MhCmdUU,1471 +torch/include/ATen/ops/softplus_backward_native.h,sha256=vJ9vBa4VXeY7fzFR7tsdhLuOCQjWhgH0BbOXYBi-vS4,1005 +torch/include/ATen/ops/softplus_backward_ops.h,sha256=E4NlqHQcrTLs1zOyn1FeAJX9S4aM54x4NBOtwVry4tk,2524 +torch/include/ATen/ops/softplus_compositeexplicitautogradnonfunctional_dispatch.h,sha256=V8-M_aNNcX4dX78rOpGdXGOB9BQWConKgklpXGyMpQM,1134 +torch/include/ATen/ops/softplus_cpu_dispatch.h,sha256=hUWUMKAWFptue8ymOrDVqLF_C38HBT-PDJLYapr0zdk,1342 +torch/include/ATen/ops/softplus_cuda_dispatch.h,sha256=AXfsrNkbC1s-xW4ReJTlLy68kSYKzGDg-YtowES-Jqg,1344 +torch/include/ATen/ops/softplus_meta.h,sha256=aYDDm6JugWlyK9r18NnRikx1PPZKWz8qPEH-_2bIMaM,910 +torch/include/ATen/ops/softplus_meta_dispatch.h,sha256=nHFlC9es6vuszt8Jyg6sQgMZZOTHzU_u9nNmg2_CnKM,1344 +torch/include/ATen/ops/softplus_native.h,sha256=bcSjqbTaHVpWK5gO4a1bFvhEoDZkfJiBV8vyg04OXu0,939 +torch/include/ATen/ops/softplus_ops.h,sha256=vwBKOU9LhR-mEbTIHF-ds5dpWkQfiwz589iKueHBJI0,2230 +torch/include/ATen/ops/softshrink.h,sha256=FDl2opSMVPoca_jYr2k0x0tZDdgLcQH8kIGx8MQfhM4,1527 +torch/include/ATen/ops/softshrink_backward.h,sha256=5WqM65vdMWp1z0WsJLMXszLuYXbfX0ZdcK4mEQQU-yE,1862 +torch/include/ATen/ops/softshrink_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=5PtRRXneT8TEhW6cAX_hHY-gOUTm3psixjDJ75gYo0Q,1143 +torch/include/ATen/ops/softshrink_backward_cpu_dispatch.h,sha256=i6F9HvQsfKt585XKpINGmvfWrz6ykd7QksrZnXEFI2A,1388 +torch/include/ATen/ops/softshrink_backward_cuda_dispatch.h,sha256=FLLwaw7Re4d5W2rA17WeSS0yZwgrN6g1IfHd1B-G5hY,1390 +torch/include/ATen/ops/softshrink_backward_meta.h,sha256=v03zuPWzoGIUWqDuFdG2o2EupkeBsF8B0QSoqavKX20,924 +torch/include/ATen/ops/softshrink_backward_meta_dispatch.h,sha256=nQtgG5KIvAHiQl-s6k0U-NJ_T-1meAu2Pi_2LsxsWVI,1390 +torch/include/ATen/ops/softshrink_backward_native.h,sha256=Hzlfho3B2zjGiUgXrD-iG5t_IUJkpb-Dd620-rjzloc,982 +torch/include/ATen/ops/softshrink_backward_ops.h,sha256=0ry3ZdcwMnqKNcBstog0vCSJ7V8tQ3CA44yMpt62Ffo,2346 +torch/include/ATen/ops/softshrink_compositeexplicitautogradnonfunctional_dispatch.h,sha256=7D9JQ3p3zNw6I_of9nQitLngJsOwIs6TnLMUb70L3Po,1106 +torch/include/ATen/ops/softshrink_cpu_dispatch.h,sha256=c1oZILRzZaw3l3GmbP9Bqk_BDqgOnaMNKwMaKSIcYkY,1259 +torch/include/ATen/ops/softshrink_cuda_dispatch.h,sha256=W4Bxvbi3AUTqhW6SPiHNST1CqFi_1aJqXH-uGCNnWtg,1261 +torch/include/ATen/ops/softshrink_meta.h,sha256=RyfSlCzdp7CP-0n3DFBiP8exVNPweO0hYveXAJlzYKM,883 +torch/include/ATen/ops/softshrink_meta_dispatch.h,sha256=z6T20Yxd5YixhBF7N3Jfo4iK-C9xK_FjDhFD-im8iVU,1261 +torch/include/ATen/ops/softshrink_native.h,sha256=5B5XqZn1fmxvDmO7P45UembVLT-3WIbrgUBxPvcnInI,916 +torch/include/ATen/ops/softshrink_ops.h,sha256=hzR8tb759Mym6fLxIlc7XGVNwF29qU4iznwj8c4Bz6c,2050 +torch/include/ATen/ops/sort.h,sha256=R6I0UP6V7uWRu7D0YviWG2i1u86d4B6LyGAuOcs0buA,5617 +torch/include/ATen/ops/sort_compositeexplicitautograd_dispatch.h,sha256=FI-2wN7vvv7rqeCldDYx4QpsTUA9mJRoCYYNjP1ZaXM,1436 +torch/include/ATen/ops/sort_compositeexplicitautogradnonfunctional_dispatch.h,sha256=l7QRAuEYTvRDJmOZYNzmEdXWD8I6IiJmSSCP3Thw0Jo,1164 +torch/include/ATen/ops/sort_compositeimplicitautograd_dispatch.h,sha256=RN8z5cSSQffcrr7m4ZHjCdHS4Qan_AarX3ZN04uMVY8,1983 +torch/include/ATen/ops/sort_cpu_dispatch.h,sha256=uYN3YhmejYIODxcMQD6TSzd9rILFeNM1zdD4R6Gxi7g,1482 +torch/include/ATen/ops/sort_cuda_dispatch.h,sha256=cH0Gpp2w7ZWx1J_nhkuMOG42yEZ39AY23sfuX-i0U-g,1484 +torch/include/ATen/ops/sort_meta.h,sha256=-B3uKz2DXtBeMU5dJCRI97z937l69mfTGCAqMKttXns,918 +torch/include/ATen/ops/sort_meta_dispatch.h,sha256=Lki5-WSis2e8p7rMcsgKsZ8IKjlHL85ATsYpIXU05I8,1484 +torch/include/ATen/ops/sort_native.h,sha256=ogVIVMF4UlWUll2D49UGstkmYeJoPPjTs6SEy8kMxxM,2043 +torch/include/ATen/ops/sort_ops.h,sha256=IlrWMP__RxXkCTBAepT31EPBB5jmAF_wuNsoiYIeHQs,7861 +torch/include/ATen/ops/sparse_bsc_tensor.h,sha256=H81pek5bg8P6uiOHopqw-K392u5US_b1iWLx8ohSjNk,3296 +torch/include/ATen/ops/sparse_bsc_tensor_compositeimplicitautograd_dispatch.h,sha256=FuUx-YmBRB-hnL-vlxG7zHjtTWMYG2tRoRF_hoHwgNs,1911 +torch/include/ATen/ops/sparse_bsc_tensor_native.h,sha256=Qv_GCdGFXxeLDb5LH7sIhFLIdRWO3QjJ9WsvOjTw_5g,1303 +torch/include/ATen/ops/sparse_bsc_tensor_ops.h,sha256=51HLtZXKzWsABZscdE6ETntxjJV_so5lwP8EuIBFTvU,3426 +torch/include/ATen/ops/sparse_bsr_tensor.h,sha256=brhefUO1VgRXjYTQXXg0zWgfanYnvXlQOQUVeypsZ_o,3296 +torch/include/ATen/ops/sparse_bsr_tensor_compositeimplicitautograd_dispatch.h,sha256=f1CFmtcjKPgmOkJOQPtLOPs9Kc7VtxdzcRIPpBECtrg,1911 +torch/include/ATen/ops/sparse_bsr_tensor_native.h,sha256=8inOXMlYDF7tX0LJKG4ToIoy3y6QkJgUi7lN2tV9UTA,1303 +torch/include/ATen/ops/sparse_bsr_tensor_ops.h,sha256=gcS77Y2NkuSQyKo79710d7GMjL21XKUzoh0dSFSTtB0,3426 +torch/include/ATen/ops/sparse_compressed_tensor.h,sha256=6sZB59BR0YMn5PRN8ppYM6DqcuFptr1IZu6bsYZYzuM,7308 +torch/include/ATen/ops/sparse_compressed_tensor_compositeexplicitautograd_dispatch.h,sha256=BzgJAtjJ-V8QJlPVh2L2frf6i7LAJvzCe5AivecxHXw,2505 +torch/include/ATen/ops/sparse_compressed_tensor_native.h,sha256=7nCDD2hNVajqU1IvPmCzjo1H1mj0nNPeB1y_aGWP0WU,1333 +torch/include/ATen/ops/sparse_compressed_tensor_ops.h,sha256=NVtw82XsOEFNVvLEOp37JuSBuTW5HnUdrnB894vON1U,3543 +torch/include/ATen/ops/sparse_coo_tensor.h,sha256=2X-fc1Uf95C06or_kLRXXG-KVMGZykM3Yy9c8n7LKeM,4602 +torch/include/ATen/ops/sparse_coo_tensor_compositeexplicitautograd_dispatch.h,sha256=0glFtOjnac8WyoWBzk78gMZzdnTE5cMMqNGf5-o9uHI,1464 +torch/include/ATen/ops/sparse_coo_tensor_compositeimplicitautograd_dispatch.h,sha256=5lO5gvrHi4M6HSdNBDBE-6qpHeFWHlSqGjPSCI6kMMo,1943 +torch/include/ATen/ops/sparse_coo_tensor_native.h,sha256=hxI3sUPsHa0hA3Jv3L_W1mMzc_9DFfa4o8uNgDlsK3A,1643 +torch/include/ATen/ops/sparse_coo_tensor_ops.h,sha256=SG2BaC-6qu5iOUrXnT7sZQF3RlG_33gsFFRfRVf4rTo,5068 +torch/include/ATen/ops/sparse_csc_tensor.h,sha256=iB2Mm8Q-aHfMKfVmMoyB-bIFoMhFmnouANxigvLs86Q,3296 +torch/include/ATen/ops/sparse_csc_tensor_compositeimplicitautograd_dispatch.h,sha256=EgoaHwP9O2XSHTX22WBxu3Qc17szRrcXaHwr1-cYqLY,1911 +torch/include/ATen/ops/sparse_csc_tensor_native.h,sha256=-ZuekLh5YQynTT044UMNwphCvhMTycPLKV32Eanxkhw,1303 +torch/include/ATen/ops/sparse_csc_tensor_ops.h,sha256=AVFIK1uweQqrsvWebCHIx1behTumUjTXeCoXS5Dmsw0,3426 +torch/include/ATen/ops/sparse_csr_tensor.h,sha256=672_jxugq4F_I4UMoNBei8sTfa0N_RyLnzuYbh7roec,3296 +torch/include/ATen/ops/sparse_csr_tensor_compositeimplicitautograd_dispatch.h,sha256=iXi3YQaLI1LUj_VKDKq9s2J3EtEodrayQobBB6rV-Rc,1911 +torch/include/ATen/ops/sparse_csr_tensor_native.h,sha256=kCsnrcVNWQ7l1IDvfvNT-8HjyAEebgDvVh6jpIumkHI,1303 +torch/include/ATen/ops/sparse_csr_tensor_ops.h,sha256=huv1b9txhz8iwZjUlQYu-YHg8oP_8_xcYzyx4M00jFw,3426 +torch/include/ATen/ops/sparse_dim.h,sha256=4LRzq7_CEE2ye3uNYcgCAjk2YMFMS2V42uEJLeLLzG8,793 +torch/include/ATen/ops/sparse_dim_compositeexplicitautograd_dispatch.h,sha256=0ZQEv4SZPQRnQvsaEUdXi8KePS8CQhfYuiPF1rb2wRc,1047 +torch/include/ATen/ops/sparse_dim_native.h,sha256=Y-h-K_2Ax6G88zuCnyCnLR_YKU8jXa3GxL2F71AQjgU,895 +torch/include/ATen/ops/sparse_dim_ops.h,sha256=oKqruXASqzSv2fCfHGBtkHPAvYFNkkIZPbEC5SmeMzg,1245 +torch/include/ATen/ops/sparse_mask.h,sha256=2SCT3TfHMTZIjI7IxgPyjnyig8AC9x5y8-56Il7KWdc,1309 +torch/include/ATen/ops/sparse_mask_compositeexplicitautograd_dispatch.h,sha256=i98g36An0yuy5hE9XS_mBXXFPI851k2nxMY2qf-d5Fs,1210 +torch/include/ATen/ops/sparse_mask_native.h,sha256=54EuQARpwxvV5TNmmPHUTE2vc45lp6esEQvuPRBT9r0,998 +torch/include/ATen/ops/sparse_mask_ops.h,sha256=8qPrgEEE6aD6oW6fXGjB62FdUpbFqbX9ZJGEau17pko,2042 +torch/include/ATen/ops/sparse_resize.h,sha256=i-dgDJTZA6NU7vdFCvAKuLWTS6Owy6GEQm_TG_OJlHQ,1819 +torch/include/ATen/ops/sparse_resize_and_clear.h,sha256=tb2pyrje0IA0MvE2cn9GbVVaSirC_wDtKukSZ8tGEZs,1919 +torch/include/ATen/ops/sparse_resize_and_clear_compositeexplicitautograd_dispatch.h,sha256=iYeeSDDtc4LwT1kI3iabc0E_kZ8xTL6ug5c-vS0pTF4,1463 +torch/include/ATen/ops/sparse_resize_and_clear_meta_dispatch.h,sha256=F04TsUgWNSksj1izytwY8y6sdIu326zgi5FDFBzsc7c,1091 +torch/include/ATen/ops/sparse_resize_and_clear_native.h,sha256=SfbiDcsb-pFJOTdsHfbopj5ChNtXRldP9NYwxI7nhL4,1145 +torch/include/ATen/ops/sparse_resize_and_clear_ops.h,sha256=vdjtP-5WWgdv2GDNR3VWljHeoMkmpsfd_AGUEfphs10,3181 +torch/include/ATen/ops/sparse_resize_compositeexplicitautograd_dispatch.h,sha256=eHDB1sh2AdRdl9lO5EIRQWBxdHJ9H8JseJ96QYpvMWU,1433 +torch/include/ATen/ops/sparse_resize_meta_dispatch.h,sha256=DH5Ofh-yOkxcIgPXJ9OKrHRpIbVgsDo-Qs3PvZ0cy6A,1081 +torch/include/ATen/ops/sparse_resize_native.h,sha256=9nV8dv9Nt_rJ0nJ4nfqW4cHsjQEmYe8Rh8LHyR1sXCo,1115 +torch/include/ATen/ops/sparse_resize_ops.h,sha256=Yoez_IuYKuJgxqsbHMf_KvOmkLbKLYtUwZhZqK_29VM,3091 +torch/include/ATen/ops/sparse_sampled_addmm.h,sha256=b8vKVhb-kdb9jbqZaQVagj8jWFnC9rtYlQggBmztnYY,2026 +torch/include/ATen/ops/sparse_sampled_addmm_native.h,sha256=VgXm37u7lPYDhqcHEpeyUsE3FljRP6L9xKCeurRWOXs,1499 +torch/include/ATen/ops/sparse_sampled_addmm_ops.h,sha256=2WFNXO6PCd4kOBhg9QDLCBzfRSkPBHBAGvDp1irIqSM,2611 +torch/include/ATen/ops/special_airy_ai.h,sha256=hJrF46uAJxJkEbf7_-gYuy7ba-JWiuoqYpaTh40xdhg,1389 +torch/include/ATen/ops/special_airy_ai_compositeexplicitautogradnonfunctional_dispatch.h,sha256=6oAA4J7vNFeIOu6akLSx4-UYoAegoace1wz7SG5R6gI,1078 +torch/include/ATen/ops/special_airy_ai_cpu_dispatch.h,sha256=t0Me0ZgEYdQgS3vcHePQYEIYISFU2sgy8y-dMiOIOHk,1179 +torch/include/ATen/ops/special_airy_ai_cuda_dispatch.h,sha256=lOzEO1rybUaooOF_EFjqPf-rzjX-4ZuDqVMWnXHathc,1181 +torch/include/ATen/ops/special_airy_ai_meta.h,sha256=JVL-daSMX0bCz3uqkWmkiPxQsWSe523AI4wdNU-5qyY,859 +torch/include/ATen/ops/special_airy_ai_meta_dispatch.h,sha256=ef6plpqPz3XHgB2LeXZZY0SAH2m4V60-JxloJ6iqZQo,1181 +torch/include/ATen/ops/special_airy_ai_native.h,sha256=JRCmyKjMF3kXL3ATSYinN2eqTcq3wjn5gYR7hgwHJiQ,902 +torch/include/ATen/ops/special_airy_ai_ops.h,sha256=BQndSjkApGehfoB_t9YU91odwMQovJOKSe1SKL8bXL8,1882 +torch/include/ATen/ops/special_bessel_j0.h,sha256=ZMGQsLW666Zc8CjziVHfm9Y6dvxJ3qEQi23-WVFiGNY,1436 +torch/include/ATen/ops/special_bessel_j0_compositeexplicitautogradnonfunctional_dispatch.h,sha256=yoRAdgkUgwldR6l8GnR2P0c7T8VQagsfZiiyS3DI6M4,1083 +torch/include/ATen/ops/special_bessel_j0_cpu_dispatch.h,sha256=pSgr3RuE6c-5_L-bMLsZAGZqY_9l-mQgLdvwGLOEPJc,1194 +torch/include/ATen/ops/special_bessel_j0_cuda_dispatch.h,sha256=CzRIS5PujwRxfhd0AWeec_kewfXqLv1istA73H4knxQ,1196 +torch/include/ATen/ops/special_bessel_j0_meta.h,sha256=73VVBagsvI2aNHbYOnbjsebtJAtotbr_ovv4IMPKvmU,864 +torch/include/ATen/ops/special_bessel_j0_meta_dispatch.h,sha256=TW39cNqkcn1yiPsuEWSapg1QsOWoKS_cqkYEyMxCY9A,1196 +torch/include/ATen/ops/special_bessel_j0_native.h,sha256=RCkhh3OgetN-RjVyo2Th9Z4EuW2uJLXj5CB3spb6F5c,911 +torch/include/ATen/ops/special_bessel_j0_ops.h,sha256=dRMxE24S6-ud9n3XfmRqzL7bJu73NiKESAIKR-GkUSM,1912 +torch/include/ATen/ops/special_bessel_j1.h,sha256=rZFFv1XfUPIqPEjpiHesZpgre862C8IfULBBskejzWY,1436 +torch/include/ATen/ops/special_bessel_j1_compositeexplicitautogradnonfunctional_dispatch.h,sha256=1LNRZJoU60NQAU5BXtYlTjufeesJKj93cBLyQH10wqw,1083 +torch/include/ATen/ops/special_bessel_j1_cpu_dispatch.h,sha256=DH9MQQcPXZMHukfb68hwBCeMheJ0-O-wwfpNr7LlMCU,1194 +torch/include/ATen/ops/special_bessel_j1_cuda_dispatch.h,sha256=zGuWDJwrrAEPyJs-EYP5i4fDVIcZWPMQPTFWhdlbk4Q,1196 +torch/include/ATen/ops/special_bessel_j1_meta.h,sha256=VU8k5yFllDr_eEcNRfDDE9t670EfT1E0a_XEXNnYfSM,864 +torch/include/ATen/ops/special_bessel_j1_meta_dispatch.h,sha256=YsoGIt69k8_u5qCAS2HaxYrv6QrCA4ACo8X6Wl2tGi0,1196 +torch/include/ATen/ops/special_bessel_j1_native.h,sha256=w2yprdkrBVnUC3or-_IE9gBdn2iyPNQ8sIo15t6z_XM,911 +torch/include/ATen/ops/special_bessel_j1_ops.h,sha256=QYZ7zVBvW4vhbz-sA0TGrDxJfJVd9VNc4nAahn-6C0s,1912 +torch/include/ATen/ops/special_bessel_y0.h,sha256=Vz1k74i8dEXSiVT7-IYou4Ds5WJsL-0_OJ34xU_tagQ,1436 +torch/include/ATen/ops/special_bessel_y0_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Edqug2EIO0Q12i6XqwF4q8Jj6DwTxOKoDda3E5NaBJc,1083 +torch/include/ATen/ops/special_bessel_y0_cpu_dispatch.h,sha256=X0gMbfnYsmKPDqjRyeybKv3tPPlze3FjHSR7rfsG_30,1194 +torch/include/ATen/ops/special_bessel_y0_cuda_dispatch.h,sha256=WgdUkuBrxEASoComtFIsWoyWQCQUB8stiqnID3JXudY,1196 +torch/include/ATen/ops/special_bessel_y0_meta.h,sha256=w_Lt8p4nMpOAvJSafjGEf5su2trYMtpFN-v552YvZpY,864 +torch/include/ATen/ops/special_bessel_y0_meta_dispatch.h,sha256=Ev7bqPGtEhIEs9syWVUwy4qF4bzPn1g37znFDpBI-SM,1196 +torch/include/ATen/ops/special_bessel_y0_native.h,sha256=X__97Wt35JD3utQKuUDta0vFRqabG63IPfiJ7sya5Jc,911 +torch/include/ATen/ops/special_bessel_y0_ops.h,sha256=ICI6fsgWMiB9nSH8KNm9tdxFujCWi_Y53sazFFtJrKY,1912 +torch/include/ATen/ops/special_bessel_y1.h,sha256=VDew6eWIue99Z_aKoh6TLhOk2XrZUR0qcb-bfMc9CHk,1436 +torch/include/ATen/ops/special_bessel_y1_compositeexplicitautogradnonfunctional_dispatch.h,sha256=QTJY8zK2ONwNorLMj5brgBxraFaIZF60pbZKZ0nivL0,1083 +torch/include/ATen/ops/special_bessel_y1_cpu_dispatch.h,sha256=5J-9cUKtkZtMDM0fEyMyv_N14VvJyyXUimQC4_FhOPE,1194 +torch/include/ATen/ops/special_bessel_y1_cuda_dispatch.h,sha256=lSJk9h1zHywKcgOG_EZw5ccmiApLMjDNrFkkeJljzJA,1196 +torch/include/ATen/ops/special_bessel_y1_meta.h,sha256=9WcyitmNFH0U1k4q8zBCr7bCR29ercE7mtPFEO5N0WM,864 +torch/include/ATen/ops/special_bessel_y1_meta_dispatch.h,sha256=HX1heMWJCiUdHSJ7f1uh9EEDSZPMvKFqaZ6TChhlTqU,1196 +torch/include/ATen/ops/special_bessel_y1_native.h,sha256=0Ws-fx-X9rsB68x0rw73Pr3FKucbBaFA396rCHD9zT4,911 +torch/include/ATen/ops/special_bessel_y1_ops.h,sha256=SZjkvb0KFWtjMf7JYQfQIu1am3tALvhL6Au-71b7vd8,1912 +torch/include/ATen/ops/special_chebyshev_polynomial_t.h,sha256=JBwL4nxGLzK0uEX3M3TOtSL0ZsgWM5NWa7YBt95jFJs,3418 +torch/include/ATen/ops/special_chebyshev_polynomial_t_compositeexplicitautograd_dispatch.h,sha256=sO9L_TzDUcCxgjlxBIo75umAid4gE-ky149sC2zP2WU,1677 +torch/include/ATen/ops/special_chebyshev_polynomial_t_compositeexplicitautogradnonfunctional_dispatch.h,sha256=qO8H_Jv-cPkmWYz3fSv2u8yUpA-ChiRcPVbm63tnenY,1115 +torch/include/ATen/ops/special_chebyshev_polynomial_t_cpu_dispatch.h,sha256=M1L40lA0L7QykGqx9nW2HHaAErSuAMxjc26GH0kkATw,1290 +torch/include/ATen/ops/special_chebyshev_polynomial_t_cuda_dispatch.h,sha256=GV85AXdO-SfWlR50LmgBMptHsY7O_5Go8SvcWhwQJ7k,1292 +torch/include/ATen/ops/special_chebyshev_polynomial_t_meta.h,sha256=tEjtS2Jj-Jal9pi8G-5f-tNYxfumYh-f76qkuwMA83Q,896 +torch/include/ATen/ops/special_chebyshev_polynomial_t_meta_dispatch.h,sha256=Pna1GGJuNPQGuFoNNJqosfb9zW8uEFx0p1wyXhofEyI,1292 +torch/include/ATen/ops/special_chebyshev_polynomial_t_native.h,sha256=VucErAwq7q-xV_ru-geZ7Dj1nE3JDkx2P2bphBMKFAE,1409 +torch/include/ATen/ops/special_chebyshev_polynomial_t_ops.h,sha256=lWAuRRWyxwDkm_V6SKns2atftoafdXamIbt-1ydRkpo,4998 +torch/include/ATen/ops/special_chebyshev_polynomial_u.h,sha256=yRcfiSxS9XwZVikaL1JAqxPEoq3Pa90d-z1sp2q1010,3418 +torch/include/ATen/ops/special_chebyshev_polynomial_u_compositeexplicitautograd_dispatch.h,sha256=9OnVj-9oTgX8ojGuGiQzSjVhMxqitUGyW58L0mn4XZM,1677 +torch/include/ATen/ops/special_chebyshev_polynomial_u_compositeexplicitautogradnonfunctional_dispatch.h,sha256=fucSr6nVU3LdhMLKGLbOt5LxjjQmhkkFeilrwmR5BVw,1115 +torch/include/ATen/ops/special_chebyshev_polynomial_u_cpu_dispatch.h,sha256=jepj0gXZrt5oylb9o7UIbpleBHIlEoWJaiyoGVb3K7Q,1290 +torch/include/ATen/ops/special_chebyshev_polynomial_u_cuda_dispatch.h,sha256=twrWCLWBn9Bto-ytriglu27qKhfepud0Ea4LIBOt8-U,1292 +torch/include/ATen/ops/special_chebyshev_polynomial_u_meta.h,sha256=CVzXRskDpZNkcrq8gtIqMX63VWksdWbhlOxk9iWrl0w,896 +torch/include/ATen/ops/special_chebyshev_polynomial_u_meta_dispatch.h,sha256=3eRbTYA6Y9h7JNjXLalbaAFuw4UwMYYisQaAKim35Mc,1292 +torch/include/ATen/ops/special_chebyshev_polynomial_u_native.h,sha256=pJ-IoOzDEGjMfYTNewUazGgke7BngagMIr2teV6wHj8,1409 +torch/include/ATen/ops/special_chebyshev_polynomial_u_ops.h,sha256=0hWj6p7rMdZA3jJJuYO9gKMACwAnHwSr6HGJpApfxNk,4998 +torch/include/ATen/ops/special_chebyshev_polynomial_v.h,sha256=mAxiCx8nUDqrmgU1X3YqxbOO7wWp-Migj1FwoPDIIV4,3418 +torch/include/ATen/ops/special_chebyshev_polynomial_v_compositeexplicitautograd_dispatch.h,sha256=t-L0vcIDXJ0qHv_inoZSgImLwqyYUQEWgzBVFugXWp4,1677 +torch/include/ATen/ops/special_chebyshev_polynomial_v_compositeexplicitautogradnonfunctional_dispatch.h,sha256=HcvaYoNtB3Y7aNGBgdJUkghXaR-xUwZk8asLz361xJU,1115 +torch/include/ATen/ops/special_chebyshev_polynomial_v_cpu_dispatch.h,sha256=jCxlaEZ7Xpp254xgkseOUY98_Z91qEGQJ59_MMIYwe0,1290 +torch/include/ATen/ops/special_chebyshev_polynomial_v_cuda_dispatch.h,sha256=ecyAy7_xZLz6gnLff2HUcTkSl5-dJU6H0_Z7BCCjw2A,1292 +torch/include/ATen/ops/special_chebyshev_polynomial_v_meta.h,sha256=SCfQkWglzwNw3MbjBpBeEpw0IsxAORxl9UtJY-T3kk4,896 +torch/include/ATen/ops/special_chebyshev_polynomial_v_meta_dispatch.h,sha256=rXurA4ho5SQtDyZ2iqLa9OBdWP4Zwsc2cEUrcqX9Flc,1292 +torch/include/ATen/ops/special_chebyshev_polynomial_v_native.h,sha256=WXPaewo2bQsT4Ff49MQN3v6nkIALpDb1kcjymNyIwRc,1409 +torch/include/ATen/ops/special_chebyshev_polynomial_v_ops.h,sha256=lDzoB5g9N6km6z1OT8I6seg69HDbDUt3LTHYeNIXZlQ,4998 +torch/include/ATen/ops/special_chebyshev_polynomial_w.h,sha256=7f7T3j45PMOo-RyJ7HVR7a5Kv2NDluSKMqcep3QC1UY,3418 +torch/include/ATen/ops/special_chebyshev_polynomial_w_compositeexplicitautograd_dispatch.h,sha256=AU1Q9D_dcPFzmYmarCJ3dkMBlrK5npQ78LaYzEJmiSM,1677 +torch/include/ATen/ops/special_chebyshev_polynomial_w_compositeexplicitautogradnonfunctional_dispatch.h,sha256=J7QRGSiOQdufGQqK7a6oo-02eLXHl0E8CLM6scOwtRg,1115 +torch/include/ATen/ops/special_chebyshev_polynomial_w_cpu_dispatch.h,sha256=dWBLxzc-2tYOcCLLj7tEFrpPRyj-baeHStDzTq2CCU4,1290 +torch/include/ATen/ops/special_chebyshev_polynomial_w_cuda_dispatch.h,sha256=LRLY2Jc93KnH6GAvZTgok41qdydvavsCc7JXIblNslM,1292 +torch/include/ATen/ops/special_chebyshev_polynomial_w_meta.h,sha256=XVGNcInTE4gPaGGAgkXikvio-hHT7wmY5tmeEzm7NyY,896 +torch/include/ATen/ops/special_chebyshev_polynomial_w_meta_dispatch.h,sha256=A4YI6DXdaFXWQYzTLGI4bYgb6mVVAloGSord8cTMzPw,1292 +torch/include/ATen/ops/special_chebyshev_polynomial_w_native.h,sha256=1prrfP61mzLzSpVhNH07luL4FTOq0oIHJJaXr5s9C7w,1409 +torch/include/ATen/ops/special_chebyshev_polynomial_w_ops.h,sha256=BEfE_70GQQ_J8vxpzWfJYN-7iCHtJ7gnDrfp5cGNe0s,4998 +torch/include/ATen/ops/special_digamma.h,sha256=eKqzIcx8g119mMCi_U0j3l1HEYNvOfzOp71EXorLsyk,1416 +torch/include/ATen/ops/special_digamma_compositeimplicitautograd_dispatch.h,sha256=bqEmG9d6H_0FoFbwyn5PKKCyJVUqcPf4CguV3iE98xc,1232 +torch/include/ATen/ops/special_digamma_native.h,sha256=vBEEcHsChfEXEOywGPyVJEgx2RYuVLmvgcQzMdxifng,853 +torch/include/ATen/ops/special_digamma_ops.h,sha256=q0qAkTH5pYaQ_aOwTqGKpujRbqvnkdbp4ADN2qWQ54E,1900 +torch/include/ATen/ops/special_entr.h,sha256=vE_zJsWwsxUePtiAMFX8DB0fT1xJTtKKN38GDUpT92A,1386 +torch/include/ATen/ops/special_entr_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Dvn0dSnM2oOy5pTQ38hfBZXsJzSd0FRSEtMgKv4zIl0,1078 +torch/include/ATen/ops/special_entr_cpu_dispatch.h,sha256=dLuONCBdVQDiYtZ8uN0cHUnjqK1Tir9ggP6GGXILGT0,1179 +torch/include/ATen/ops/special_entr_cuda_dispatch.h,sha256=xUq89RWt7GdHyuVKTwRXI9q8WybKfujWZI9E78qbRRg,1181 +torch/include/ATen/ops/special_entr_meta.h,sha256=S5-V5R1-zTtomevroG4EoZ4OND2qCxhMkJwEaP-Eww4,859 +torch/include/ATen/ops/special_entr_meta_dispatch.h,sha256=bJvV8f1aH60UWVdWO8nQ6K9z-K1Fg2Q8UrTU5Yb_xcY,1181 +torch/include/ATen/ops/special_entr_native.h,sha256=lWkFZAzpDAsXLG2Q54nFYLJZNCNgTbroN1tJkc34t88,896 +torch/include/ATen/ops/special_entr_ops.h,sha256=zbgfE-8GElrkmOSqSlgH6aDxi7bKEr4zsmh3pN7P32w,1882 +torch/include/ATen/ops/special_erf.h,sha256=vFqxHfrryfbd7KytT7VfoZrZYUCk4jAUm_yf87SdcnY,1376 +torch/include/ATen/ops/special_erf_compositeimplicitautograd_dispatch.h,sha256=-xBsSRvvBV3QTMcwZuWFXxGtV3VGzbFFdhBiZ9XYH9E,1220 +torch/include/ATen/ops/special_erf_native.h,sha256=FZMXLYRHvGSGmLeKDnlHRc-cuzflDO9TWX-epUsmhDk,845 +torch/include/ATen/ops/special_erf_ops.h,sha256=kNjNHW1Y8pwCk9eiro0djPNAwKsqj5kyfcOo399VWA8,1876 +torch/include/ATen/ops/special_erfc.h,sha256=F70dickmgfWLyRC0PIo4j5MJWi6D36le0-gr6zDfsyA,1386 +torch/include/ATen/ops/special_erfc_compositeimplicitautograd_dispatch.h,sha256=GuSTRDXIbNcMS-XCRf6T3N6Dt4UNPNTYJnJ-sc3rUQo,1223 +torch/include/ATen/ops/special_erfc_native.h,sha256=w_N4JMswM_69N2m0LYwxCdSeqp9kUbTBEsujVnHus6A,847 +torch/include/ATen/ops/special_erfc_ops.h,sha256=VqgSDevSzfLFfmVzV--qFSxmjkLkEVjJ0QGzH38Mf4o,1882 +torch/include/ATen/ops/special_erfcx.h,sha256=ctIUC4T-nBjdEkDrd3OqHg-B8W9Gcjt9ud15t7gUICE,1396 +torch/include/ATen/ops/special_erfcx_compositeexplicitautogradnonfunctional_dispatch.h,sha256=3GKOtzvVI7D3QLR-dc4umTIbNInhb9L1ZQ2bQn4yk7Y,1079 +torch/include/ATen/ops/special_erfcx_cpu_dispatch.h,sha256=-jdGHUsdfku6vf4GoIudk-IxS74UeRcANN7lOsm7xCs,1182 +torch/include/ATen/ops/special_erfcx_cuda_dispatch.h,sha256=-ft00TnItcv_z0NXtop9fgFhJtV-ceX0uYNW5wEj5QI,1184 +torch/include/ATen/ops/special_erfcx_meta.h,sha256=JR9CcL1t3Aw2UpKnMy4lTXfVOZL9DV5ntyfEsYB68sE,860 +torch/include/ATen/ops/special_erfcx_meta_dispatch.h,sha256=9RfN0k0-Peu43aV46mH9_d03jhkxNABbBdhQHqzO9zg,1184 +torch/include/ATen/ops/special_erfcx_native.h,sha256=gRvpBZZL4N2FaZr2b3qtuC1T0nBvqVW5gEmJs9bl1xU,899 +torch/include/ATen/ops/special_erfcx_ops.h,sha256=8h24gZoCyPoLsM97vAGEDZxtK5NKE2V7771fUMaNbaA,1888 +torch/include/ATen/ops/special_erfinv.h,sha256=Ypdh_lb69ziScKjeDAIc5lFVS7Q6pOz5452kodsrHTQ,1406 +torch/include/ATen/ops/special_erfinv_compositeimplicitautograd_dispatch.h,sha256=AmYbXyVUydjcz6D2SFC9T1YdEmTts36EG4MFaEDj0zU,1229 +torch/include/ATen/ops/special_erfinv_native.h,sha256=z42BWjb6qLyI1hp41J-S8j5ar3XMm1bTL9HlFTO700c,851 +torch/include/ATen/ops/special_erfinv_ops.h,sha256=YgveBAv47NT1E1H6b4ufT8O4JWRHiVPq8n3-BG23eu8,1894 +torch/include/ATen/ops/special_exp2.h,sha256=vRDWMbqC6mcGNt9wMyrFMAgqEyvCvFg4JcG9P7Iv5Y8,1386 +torch/include/ATen/ops/special_exp2_compositeimplicitautograd_dispatch.h,sha256=P7fWJFOo2R83A7_NmCCnvjOJ3TFAOZAKVIZAXNDth-A,1223 +torch/include/ATen/ops/special_exp2_native.h,sha256=IAslT6wBTF2nI8NUdl2v5w8d4URwnvqX1Z2KisJ35u8,847 +torch/include/ATen/ops/special_exp2_ops.h,sha256=lik2ja5zziQ_YZ9FD2HmIkj2db0outpNZ3_oOFgyuUc,1882 +torch/include/ATen/ops/special_expit.h,sha256=U32UBM20i-lPFvEynQsak6to-uYDZih2E-MU19-fyTE,1396 +torch/include/ATen/ops/special_expit_compositeimplicitautograd_dispatch.h,sha256=A9OLp8GsXWMxfpWv2ezlU6Grcp0J8BduvWGuIbwVd2s,1226 +torch/include/ATen/ops/special_expit_native.h,sha256=4pqrTY91CWoJzc7cNazasmj8-CsiODf2mEHapPuDD54,849 +torch/include/ATen/ops/special_expit_ops.h,sha256=hnldDvb_W3ScXHEq-QgnU0ayQLPxgBMDj3hPO-V1jHw,1888 +torch/include/ATen/ops/special_expm1.h,sha256=F_WN41IETBG6DemAG8pmVVWUqF2BGhsCPoxad0hHI4E,1396 +torch/include/ATen/ops/special_expm1_compositeimplicitautograd_dispatch.h,sha256=KiOmAw2fhus6p0_E9m_dSBoFmpth6U_nH3UXimHTyCU,1226 +torch/include/ATen/ops/special_expm1_native.h,sha256=ZWv-oastbuW4CirMs6WEDjb7rnjTUkHkIZBh0jRBZlA,849 +torch/include/ATen/ops/special_expm1_ops.h,sha256=JavcfOSz2-vrjX1mcTRAxesO3vYBwS9w79rvwi2x40A,1888 +torch/include/ATen/ops/special_gammainc.h,sha256=LRYATp6uXKNfY7ttPV2Sek1UUcAbAUF01x0D175zStQ,1567 +torch/include/ATen/ops/special_gammainc_compositeimplicitautograd_dispatch.h,sha256=9UhBYNKGgJpoPXGyBsRGmVSODh47kn4l-NDCGPHNE94,1313 +torch/include/ATen/ops/special_gammainc_native.h,sha256=MNimtNZlSstz56meKQWgwPo_ia_pv68n0RTQUh55xLE,907 +torch/include/ATen/ops/special_gammainc_ops.h,sha256=2eITVhm0WKLZ9opR-Q3Xk98nH_CXbFLaSwIKsBwNHPk,2078 +torch/include/ATen/ops/special_gammaincc.h,sha256=qxHRV4Mw6gtlO7Sw3B3XzLnUNL-a2KPvI7Iqye07Uwc,1577 +torch/include/ATen/ops/special_gammaincc_compositeimplicitautograd_dispatch.h,sha256=HiUMM1o8HGZQSTM3D3VqRmsaPHgDPcDmXuyX-zZhzF8,1316 +torch/include/ATen/ops/special_gammaincc_native.h,sha256=Zxfyy2TMzAikp2aEECSKiptbD0DDvEHe4uvWqDSFDFo,909 +torch/include/ATen/ops/special_gammaincc_ops.h,sha256=_bXamlAB-7cyME9jgSQKID5P_aF0gRWj0RgCAWWo4r8,2084 +torch/include/ATen/ops/special_gammaln.h,sha256=kVLBmb-R-UJQslsR_feP63yPHKaRUngysiE2nKIjha4,1416 +torch/include/ATen/ops/special_gammaln_compositeimplicitautograd_dispatch.h,sha256=FAEFKbnqjZERTlmE1A7yMGUasS_s5cri-jVu-XqRLvM,1232 +torch/include/ATen/ops/special_gammaln_native.h,sha256=EppUafD-ItwGgUh_FV5vE7DcFQUBLcjtt3mRtYs4IYA,853 +torch/include/ATen/ops/special_gammaln_ops.h,sha256=duPPU9ZBMfcjx9jIDwrveF8W8f2BfaTw_wOCzENRkH8,1900 +torch/include/ATen/ops/special_hermite_polynomial_h.h,sha256=1sY2xjh4zmRCPnggrx1irad0rE0JBLaVvjS9F-d4iAs,3362 +torch/include/ATen/ops/special_hermite_polynomial_h_compositeexplicitautograd_dispatch.h,sha256=ounzfXd3089SBal2oxEClOjsVaiwW2M1oWL_lHqcCXA,1665 +torch/include/ATen/ops/special_hermite_polynomial_h_compositeexplicitautogradnonfunctional_dispatch.h,sha256=dComvM-znSwgj05brnQZPagIo21pO78jd_NOdOHVoz0,1113 +torch/include/ATen/ops/special_hermite_polynomial_h_cpu_dispatch.h,sha256=sZfhYypx9cQdsl195LBUUEoQ1hGdQUNQLHJ142m-4nw,1284 +torch/include/ATen/ops/special_hermite_polynomial_h_cuda_dispatch.h,sha256=Eu8vkCCgrTeleUNuFHGWSkqpzld-WYoWdGZDu3uQEM0,1286 +torch/include/ATen/ops/special_hermite_polynomial_h_meta.h,sha256=eW4wPnjVv5PGR5vzjn_b-qGHV6LnpTanrD_bgotp6ak,894 +torch/include/ATen/ops/special_hermite_polynomial_h_meta_dispatch.h,sha256=atQGxbTkdsGyGUqg9oB6sY9utVbo0ag3CbGMsAW07NI,1286 +torch/include/ATen/ops/special_hermite_polynomial_h_native.h,sha256=TmM5Y2OvOy1M0ZWWv0hmu6n3k7Pc7vXwj2Uu_Xf5M4o,1395 +torch/include/ATen/ops/special_hermite_polynomial_h_ops.h,sha256=PIgP-XOS7lBzQ77V355wwgIGDYQIYlVfi5b3gOVLA8g,4962 +torch/include/ATen/ops/special_hermite_polynomial_he.h,sha256=j8i3bcbfLVYyFvU5jrLdduw0wJLrwQK7Mn6T-_1PMfI,3390 +torch/include/ATen/ops/special_hermite_polynomial_he_compositeexplicitautograd_dispatch.h,sha256=cz4X0PBrqcvkdQw6YUIZ3WFlaZYqL_2R_VRo0JitNMg,1671 +torch/include/ATen/ops/special_hermite_polynomial_he_compositeexplicitautogradnonfunctional_dispatch.h,sha256=FIy1qJVSc_B4EzvIozxb3bL_tp7fBm_xljrxRF7NIlU,1114 +torch/include/ATen/ops/special_hermite_polynomial_he_cpu_dispatch.h,sha256=aa3pS2eG3Z0NF77QDhOhqwlQ4gnQp9y-kynG1NAnRQs,1287 +torch/include/ATen/ops/special_hermite_polynomial_he_cuda_dispatch.h,sha256=AvkXnwv-52yl_m6uDeYeMOSrPWPAo8FAklW8BoTL-2k,1289 +torch/include/ATen/ops/special_hermite_polynomial_he_meta.h,sha256=RmWPqczBMwk_-EvS-LKIxpXWqWUVt7eBLcLBMBrKbbM,895 +torch/include/ATen/ops/special_hermite_polynomial_he_meta_dispatch.h,sha256=Z9PGP907n2_1LdkcUi5Bt4vUub0kJPIjn-PpE4FZdYc,1289 +torch/include/ATen/ops/special_hermite_polynomial_he_native.h,sha256=XmzP0l83VRex4Ju7DUfyvfebwNtG-eseItP068PpYFg,1402 +torch/include/ATen/ops/special_hermite_polynomial_he_ops.h,sha256=-FxwmPSUWqTg9KE8OVYF_Tt9wEfiPEHbOy_nPxC-2L0,4980 +torch/include/ATen/ops/special_i0.h,sha256=5r7_GnAIL1no_kIiDY203m8wFPrGAmOMBk6bDDxUtDE,1366 +torch/include/ATen/ops/special_i0_compositeimplicitautograd_dispatch.h,sha256=NYIqNREK814F1nzv3vcMaS7rjnozkX6vGDirmXaKass,1217 +torch/include/ATen/ops/special_i0_native.h,sha256=fxCYO2wNYIr5sl79-ahSs11wx7_hFF7SQl9LyFRZ-qY,843 +torch/include/ATen/ops/special_i0_ops.h,sha256=Z7Gv3cbjkbHMQbq1vhurwXncT8gXvPp3Wvh8nv0KzPk,1870 +torch/include/ATen/ops/special_i0e.h,sha256=JT0pO1hqVunYhUZwZ2_LQqnErCtZoOLcDahcjAz6LPM,1376 +torch/include/ATen/ops/special_i0e_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Rum0hnmvA_WB9WdzFYLeVllP78QW3a_wSMGIkP2Ivzs,1077 +torch/include/ATen/ops/special_i0e_cpu_dispatch.h,sha256=DUCYsqLKb8CPsXgMMqcnr1A1mlmU64w8nKVNf8Bwu8w,1176 +torch/include/ATen/ops/special_i0e_cuda_dispatch.h,sha256=Tx9cd-7oHpLv6bM0xg8QU0J1VO7-KxZH7ozM_WHsVYk,1178 +torch/include/ATen/ops/special_i0e_meta.h,sha256=3tjwhzQvemCA5vaRaPhlXvIEEH1hpWdG6yD7CJYWMjQ,858 +torch/include/ATen/ops/special_i0e_meta_dispatch.h,sha256=HXX38_3vuihB4lN4jGQp6cnyW15BbHbF9ZH1ldUOU0Y,1178 +torch/include/ATen/ops/special_i0e_native.h,sha256=w5kJmJOT6D7q-1CqKFuSb3P3Yvaq3LY12PK9R5L2DA4,893 +torch/include/ATen/ops/special_i0e_ops.h,sha256=8uKwp6QFe9H-xsOJmvwSoTK6pqnGBMCSs0FuUotemMI,1876 +torch/include/ATen/ops/special_i1.h,sha256=G_58qnQupaoce_QNE3tpP1B_3fMIxX2wz6AjR047Rbs,1366 +torch/include/ATen/ops/special_i1_compositeexplicitautogradnonfunctional_dispatch.h,sha256=QzzqarmuX-f8OS5aoMdVIFtDCH3899VXCR1S8Qroj8A,1076 +torch/include/ATen/ops/special_i1_cpu_dispatch.h,sha256=4xsoNW3lAgTxlbyubqP-QwsDmpvw9zFHfQH7a7dmCdQ,1173 +torch/include/ATen/ops/special_i1_cuda_dispatch.h,sha256=Hil6APG-4UuEdcKowgzR0AKQJQCYzb_AMf3eh2U_LsM,1175 +torch/include/ATen/ops/special_i1_meta.h,sha256=dQhTRrswMX67f6QtmogtB-6PnE2d7hkC9_wKqNdSrGc,857 +torch/include/ATen/ops/special_i1_meta_dispatch.h,sha256=inPDrBlt2jJTBRzpJYWmAX0H9ZZScVIZ8RZhVx4-yvM,1175 +torch/include/ATen/ops/special_i1_native.h,sha256=Nq0TpHgTmW9eb5AgzYoUb5M7oE3mXpaCMOcIUb_NqPo,890 +torch/include/ATen/ops/special_i1_ops.h,sha256=nOYyIzQO8_rOJj-PnC39XaQtW7IBVmLlRKxhj9iZRaI,1870 +torch/include/ATen/ops/special_i1e.h,sha256=lJ4694eW4Gey9m-WgljlO9lAPWjNtYZHQztH7JQ1T5s,1376 +torch/include/ATen/ops/special_i1e_compositeexplicitautogradnonfunctional_dispatch.h,sha256=YymUEdwpTQ5y6HHmVS7NvO9G-EVOdzxXftSHrghqbFU,1077 +torch/include/ATen/ops/special_i1e_cpu_dispatch.h,sha256=mxtrylsAsx4V7kTUedDfi_wMdS73X-UA1H_3L9OCyVE,1176 +torch/include/ATen/ops/special_i1e_cuda_dispatch.h,sha256=34H94JVXJcWh-RciwskfvGAZONf8BjdL9jCMkONPFH0,1178 +torch/include/ATen/ops/special_i1e_meta.h,sha256=oTsnoO68WHHazeYsVvMoDQhZkdKLa_oo9PIebbfYbC4,858 +torch/include/ATen/ops/special_i1e_meta_dispatch.h,sha256=X2uEEfJoB2gR04_3ECfQaY3ZIi0KDOc0bQrcWAVrmo8,1178 +torch/include/ATen/ops/special_i1e_native.h,sha256=LQtcAcMszPOyjL-K4kQxf83DwKUxy-uzH90wXYWpr4Y,893 +torch/include/ATen/ops/special_i1e_ops.h,sha256=OVx7x1EhSHYumy_lt6RDCxoGPfsOKtIJ2gLxHLrZ0Ew,1876 +torch/include/ATen/ops/special_laguerre_polynomial_l.h,sha256=p3xGUOwJurC0jMZK5lh91fH5hIubBLKOWa-v4vkwdCA,3390 +torch/include/ATen/ops/special_laguerre_polynomial_l_compositeexplicitautograd_dispatch.h,sha256=Dr0E_Wz2Mk-QszwK7Ky1DR0d12cUYcxl8BUzo4m03-M,1671 +torch/include/ATen/ops/special_laguerre_polynomial_l_compositeexplicitautogradnonfunctional_dispatch.h,sha256=8mo3m81M7suRI2LpiEcSyF2l5XysucQV1nACNcGkAb4,1114 +torch/include/ATen/ops/special_laguerre_polynomial_l_cpu_dispatch.h,sha256=2ykrbyjf1wP7_ZWPhdhwEEXy4ZUfSDLbu-P7MY3uPNo,1287 +torch/include/ATen/ops/special_laguerre_polynomial_l_cuda_dispatch.h,sha256=UlbUYYdEiRIz45dcI8_VWwuFTVtm4Nr-YlD6k8MnmG4,1289 +torch/include/ATen/ops/special_laguerre_polynomial_l_meta.h,sha256=klQNKkq2DYRZl6pDLt8idqres0Iz2P12HlLFotn4nmw,895 +torch/include/ATen/ops/special_laguerre_polynomial_l_meta_dispatch.h,sha256=2yYMUBi5w4APgZJioTbRhnI4XqEIten378HJnaQEAUw,1289 +torch/include/ATen/ops/special_laguerre_polynomial_l_native.h,sha256=UFPNZUP2i0Oxv6dzXXDoDJQ_aQ9rqTm8XWT1PNJbiYU,1402 +torch/include/ATen/ops/special_laguerre_polynomial_l_ops.h,sha256=EBbNMl-rQeMhRlc26xDqaj0T_TxdTzvC6-iKGxCrBtA,4980 +torch/include/ATen/ops/special_legendre_polynomial_p.h,sha256=wIsaxpZ5coeSUyW7_Q0MziKyTclBWBBG3DZvy0ASfn4,3390 +torch/include/ATen/ops/special_legendre_polynomial_p_compositeexplicitautograd_dispatch.h,sha256=sDn7JJLwFPGD6FlAscqjUCxwtUMYNf2Sc1imYSuqyhc,1671 +torch/include/ATen/ops/special_legendre_polynomial_p_compositeexplicitautogradnonfunctional_dispatch.h,sha256=E64HLX2SYR0B9UBSEWagfn2Nodh_-tLJiUwhY55x5Y8,1114 +torch/include/ATen/ops/special_legendre_polynomial_p_cpu_dispatch.h,sha256=wlYyqkzhu5iO9bmw7DtFK5mNvjErgekfOaKGMOesFFA,1287 +torch/include/ATen/ops/special_legendre_polynomial_p_cuda_dispatch.h,sha256=YjQj1mc__Vy6I7ndikyz81IhHiCFLfs6rPub--MLPGs,1289 +torch/include/ATen/ops/special_legendre_polynomial_p_meta.h,sha256=7x0nMGqO9ZGJ5r7LK3tDXOrVE9tSep6KRaX6jymx2GE,895 +torch/include/ATen/ops/special_legendre_polynomial_p_meta_dispatch.h,sha256=YVzhsCCGFrxVqyN0EAIJSpLnbndYKkX69BNd_xUpAa8,1289 +torch/include/ATen/ops/special_legendre_polynomial_p_native.h,sha256=rPrRx89ZHhIUtV223g7jQR7dGitlE_LBgaonTVV_FH4,1402 +torch/include/ATen/ops/special_legendre_polynomial_p_ops.h,sha256=RDaYDnNaHS0cGgtLT7Tn4Ta-lGw2K9V5fVGjpnBWVLA,4980 +torch/include/ATen/ops/special_log1p.h,sha256=TjIgjWxEE4qOhcvtBfzCjY829Vt2YtQbgbHvkwpOVUg,1396 +torch/include/ATen/ops/special_log1p_compositeimplicitautograd_dispatch.h,sha256=lZbc-qxAYf_s5yN51VZZOcoliEHrg15PR4pQTyUmGvg,1226 +torch/include/ATen/ops/special_log1p_native.h,sha256=AHRXhnzZ8g2ZQGmCXoumX1ibJQJ54CZo7_ffHs4pjTY,849 +torch/include/ATen/ops/special_log1p_ops.h,sha256=veMz5QslLCBPPxilSh_YMmSDFGYkZo7ZSQh7WXU53HY,1888 +torch/include/ATen/ops/special_log_ndtr.h,sha256=h8KXVhnisGfnsa1wEbrVTEVyJS4oyPd44BNTTJo-dnU,1426 +torch/include/ATen/ops/special_log_ndtr_compositeexplicitautogradnonfunctional_dispatch.h,sha256=YSbLHBTXJ9h-6Yn0Ecz3ap_yMbqhxL4tszvhuieT-KI,1082 +torch/include/ATen/ops/special_log_ndtr_cpu_dispatch.h,sha256=N4mW6hUBIrq_iuAHPVqYIu7ITFrB3h1K9dWSG1aULZ0,1191 +torch/include/ATen/ops/special_log_ndtr_cuda_dispatch.h,sha256=-uuwuA0-g-chqdvBhOPhC9ermFvZdpgYWSLFuuodSqY,1193 +torch/include/ATen/ops/special_log_ndtr_meta.h,sha256=jeXKQH0YzntTY2KStLUv_MSmDazq4-9M4eQUsjadi9k,863 +torch/include/ATen/ops/special_log_ndtr_meta_dispatch.h,sha256=Dx1Tukvlkh9aGNLo6kpO60qqrLNNTN5tQJAD2Ch82vc,1193 +torch/include/ATen/ops/special_log_ndtr_native.h,sha256=pdV6E4In4yuZS10mn15QG7MOsLiWGKzrDOA0yqiwCEA,908 +torch/include/ATen/ops/special_log_ndtr_ops.h,sha256=g8uihgxxE-WnwC2bUcHLLJjxKD8Wwp86czEeF-QYuRY,1906 +torch/include/ATen/ops/special_log_softmax.h,sha256=8kBRz3njxADYGF6bB2EwIv2PCdXkMLj6J9Mo0ewKGLo,1094 +torch/include/ATen/ops/special_log_softmax_compositeimplicitautograd_dispatch.h,sha256=dKk2iNMJ_W5J0J-SHMf7I2h2L_lDZjMpMf4ylu6DVF0,1126 +torch/include/ATen/ops/special_log_softmax_native.h,sha256=KAbJlzJn7saZsZu_4Tao5bNZ4hypZuneB1gbXi0ZSaM,836 +torch/include/ATen/ops/special_log_softmax_ops.h,sha256=GlQaoizBxKo5ly4VprEIvvjdAghMLcfKmGX2-UI3STM,1466 +torch/include/ATen/ops/special_logit.h,sha256=-WZSI3Gpwn98A22nnOQqPrTu0B_wrAUeppkY7fYH6Qg,1579 +torch/include/ATen/ops/special_logit_compositeimplicitautograd_dispatch.h,sha256=pISuCGXOogXxUcCKVr4yKzW50s8vicQCpw5UZwKEJa0,1343 +torch/include/ATen/ops/special_logit_native.h,sha256=9eYxA96KNs2UhgEy7PnES9aQvMrm2En0NZ3qYwYiSlw,922 +torch/include/ATen/ops/special_logit_ops.h,sha256=UCFMCNoij7MwYlu7s07EZOr3Q4ACLqKCMg58USTi8go,2088 +torch/include/ATen/ops/special_logsumexp.h,sha256=psblXGPlmihp77_gY3ZqT5e6d1UAbP8_QI5glc1dZt4,1691 +torch/include/ATen/ops/special_logsumexp_compositeimplicitautograd_dispatch.h,sha256=nu_rKBRfDe3JgQfB1R65emIYsRto9EdIS-wXWMy0Jgk,1355 +torch/include/ATen/ops/special_logsumexp_native.h,sha256=E_sHp-v5lFSeuQ_yhygVHUzbZOBDn50MuLP422R87DI,933 +torch/include/ATen/ops/special_logsumexp_ops.h,sha256=N4mEOQOrf7pngTwZCM5p1fvhoCcrUO6fahV3rKsFZCM,2162 +torch/include/ATen/ops/special_modified_bessel_i0.h,sha256=3nE8l2KJZCAnES7tvpaKfFgVtWjTT_nX1XBIxMtI0O8,1526 +torch/include/ATen/ops/special_modified_bessel_i0_compositeexplicitautogradnonfunctional_dispatch.h,sha256=cKwU15fGQXrbwrHCguhSftLzXWN_1sa1wTPMSvVTFD0,1092 +torch/include/ATen/ops/special_modified_bessel_i0_cpu_dispatch.h,sha256=E1ppn6RYVvxCNXoOcl4HsEAcjP5WKgeOppPEmTPdHjc,1221 +torch/include/ATen/ops/special_modified_bessel_i0_cuda_dispatch.h,sha256=58d9jJ3OSk-dk_XYw-mPuiIYYD4iUMs8ijHdkQ-K_-A,1223 +torch/include/ATen/ops/special_modified_bessel_i0_meta.h,sha256=j8Y28bYwftXGHBG_3BpshHWujQZxciGkufBALJVSGPg,873 +torch/include/ATen/ops/special_modified_bessel_i0_meta_dispatch.h,sha256=Nmy2NJO2z6em8IwZYOHiWGEIKb8V46Pf5UenloCx_Cw,1223 +torch/include/ATen/ops/special_modified_bessel_i0_native.h,sha256=SA12eC7WLdzH844fJUJDnfbvAkXT8aGaOiUfYrAXCDw,938 +torch/include/ATen/ops/special_modified_bessel_i0_ops.h,sha256=8jX1p5Q6vYRY1Oqs6SJtihRjVba1gSjl1QMnsmlGNws,1966 +torch/include/ATen/ops/special_modified_bessel_i1.h,sha256=Hq1LxGNfvrFBWGfJnBOdcwiktC_MA2r6LdXnaV3Q_s4,1526 +torch/include/ATen/ops/special_modified_bessel_i1_compositeexplicitautogradnonfunctional_dispatch.h,sha256=8EnqbZC2yuhwU2jaK8b3er0MDlzhg6fZzVgib5ZXAWI,1092 +torch/include/ATen/ops/special_modified_bessel_i1_cpu_dispatch.h,sha256=k1GGYC_UhHtyfWKGu6AfhVq26KEd7xp4SQXRwKD_3Ek,1221 +torch/include/ATen/ops/special_modified_bessel_i1_cuda_dispatch.h,sha256=Z9-oFLrZOiovYyA1D3ngTbf9AevFPp1G8hJulwC9n94,1223 +torch/include/ATen/ops/special_modified_bessel_i1_meta.h,sha256=uq5cKDUPW8YJbQhiZ3xbmOWLeisZ3MmosEXRykuJYQ0,873 +torch/include/ATen/ops/special_modified_bessel_i1_meta_dispatch.h,sha256=WjEUYGUl93R_olL7FTzuea8i4vl2Pck34r_yIugiobE,1223 +torch/include/ATen/ops/special_modified_bessel_i1_native.h,sha256=EYHa39Ni3anACJ0EONC69hTPHASz-o6PtJXbQg7qAaA,938 +torch/include/ATen/ops/special_modified_bessel_i1_ops.h,sha256=xF79tiIZzneOlWGuOyjfqU3dL884Fk7eK_tBTaROFHA,1966 +torch/include/ATen/ops/special_modified_bessel_k0.h,sha256=qlo8KpcGeqM3z4qilGfSD_MBrKIFEVCs8Ds6ZPBD3PE,1526 +torch/include/ATen/ops/special_modified_bessel_k0_compositeexplicitautogradnonfunctional_dispatch.h,sha256=EabUbqzeLvdfjiZbcNej5eGq4a8hEZITTwKem42Phbk,1092 +torch/include/ATen/ops/special_modified_bessel_k0_cpu_dispatch.h,sha256=Z7pjwujEeitz5SVCtEygm7x0BJTrxa5IYAP_YyDy-jI,1221 +torch/include/ATen/ops/special_modified_bessel_k0_cuda_dispatch.h,sha256=riyj9H90cpMWCBWgOJPfQdYONORK3W9c-JpqtsH-SXk,1223 +torch/include/ATen/ops/special_modified_bessel_k0_meta.h,sha256=3kFGo9GDFXXiZmn4lCFBuoiVmAv8_xJO0LJxD4FrZKo,873 +torch/include/ATen/ops/special_modified_bessel_k0_meta_dispatch.h,sha256=ILalMkqeFxwTtSxtY6_CMWVZd2tyf9ZYn4DsgsrKaFo,1223 +torch/include/ATen/ops/special_modified_bessel_k0_native.h,sha256=DTFik9Z-jguLNqw7FKG0ugF6KJnmCj4H1auGNwtOfHY,938 +torch/include/ATen/ops/special_modified_bessel_k0_ops.h,sha256=0E-5xamVRXWTaHgG_2u7ZfZIHBYNl7zo2dY11iEVFVE,1966 +torch/include/ATen/ops/special_modified_bessel_k1.h,sha256=ObEpw9Wik167UxgDzBsoZn9Bli8BO1TUqvKB_L-PyNw,1526 +torch/include/ATen/ops/special_modified_bessel_k1_compositeexplicitautogradnonfunctional_dispatch.h,sha256=ZiWC1qM4uwm6KcQGsfpDs_-HmQlhWr9N0uG3-yqq3l0,1092 +torch/include/ATen/ops/special_modified_bessel_k1_cpu_dispatch.h,sha256=J4iQRKR5daYYjFf98vr6nK4SPy-X8DUYhibCl9xKvFg,1221 +torch/include/ATen/ops/special_modified_bessel_k1_cuda_dispatch.h,sha256=R44jxuPyJB3GvgFv2QVMLjbMwhWJzUfZlGez7ctwA2E,1223 +torch/include/ATen/ops/special_modified_bessel_k1_meta.h,sha256=EpVa9v162vgR1Y0MBqBi6IxK_kwt0WI7yYivYvbTi_0,873 +torch/include/ATen/ops/special_modified_bessel_k1_meta_dispatch.h,sha256=U6FcICV2T2zkdNwczdlJpbiFdl6cmG_zd9qRAl_SO1s,1223 +torch/include/ATen/ops/special_modified_bessel_k1_native.h,sha256=LlCmI6lwXeWOAclP8rV0VYV4JiXBVyut8VbymBCyisY,938 +torch/include/ATen/ops/special_modified_bessel_k1_ops.h,sha256=d9FrGBqnVx6wGHbN51BN0vI8FBhQ17B4z6U4bvFlmfA,1966 +torch/include/ATen/ops/special_multigammaln.h,sha256=mNdHswoQ_FH7uMUn1pPUY5TbZnsMEr4lSQmPDaZGi-I,1529 +torch/include/ATen/ops/special_multigammaln_compositeimplicitautograd_dispatch.h,sha256=A_beCkXSHlnBK_r0QCOogTL7AWW52bk6AqMmjxuSVS4,1280 +torch/include/ATen/ops/special_multigammaln_native.h,sha256=bhR6vNixwb6SpdGvpDn85QRCDi9lAH1bUcSgPERKJzI,885 +torch/include/ATen/ops/special_multigammaln_ops.h,sha256=qKIORhKczpiN-LqvxXWAwtjqJDvjKhYb1cOTAa1ckQs,2006 +torch/include/ATen/ops/special_ndtr.h,sha256=_A5gaCmcK6Z07jOBkzUXSzz9EJAMNOZSz6NV8y2Wzi4,1386 +torch/include/ATen/ops/special_ndtr_compositeimplicitautograd_dispatch.h,sha256=3NacLVeNiji8cBBh6ucz30fLeiN3dqzkz8cvXBJirdU,1223 +torch/include/ATen/ops/special_ndtr_native.h,sha256=8Wvfiz5Rsg5biQjIsV2xbAp9pWLu9KkE5eTxGE1ls_k,847 +torch/include/ATen/ops/special_ndtr_ops.h,sha256=xn8varFF6Gtj8SrT_kjr5j45Cp54xP1bcx-WuRHIDYg,1882 +torch/include/ATen/ops/special_ndtri.h,sha256=yhTwkGpdjkRAA4MyFhbunbDQmNYIzavMfyTrO432SU0,1396 +torch/include/ATen/ops/special_ndtri_compositeexplicitautogradnonfunctional_dispatch.h,sha256=7nshGytw67QBKHelEVZPNQa5QB3DU6V7dzOuYSbqDJU,1079 +torch/include/ATen/ops/special_ndtri_cpu_dispatch.h,sha256=aC1DO2SyQs322JddQKr9SeZ44oMVrK9RRlKcrrJyFp0,1182 +torch/include/ATen/ops/special_ndtri_cuda_dispatch.h,sha256=DpXwl-PgbMnfuTYbNh1bST9wmYuo6XjvcyFuLf9cIAA,1184 +torch/include/ATen/ops/special_ndtri_meta.h,sha256=QumLII7D-7CMEDjgbkbLXgIX8CgCpkgma64mdlyzFFw,860 +torch/include/ATen/ops/special_ndtri_meta_dispatch.h,sha256=h7kQZtgq4W7xmZXxdSpj6EfrLjZi9tlL5P9L1eyrpJc,1184 +torch/include/ATen/ops/special_ndtri_native.h,sha256=INhTpFeLkrtuPCMofSMH27SIRTB07Y1fPjI-MBoF_f0,899 +torch/include/ATen/ops/special_ndtri_ops.h,sha256=MT2KszcPQl5fRl7wZBa-7QaHZLMI_zjhLOqTBtISxTc,1888 +torch/include/ATen/ops/special_polygamma.h,sha256=rV7I8IjE-7Dz9VzwFJUNQFh78GyyF6x78ZUigd9cUWQ,1499 +torch/include/ATen/ops/special_polygamma_compositeimplicitautograd_dispatch.h,sha256=NfqmvkvR3FUHbRs_fYFs8OzXn3FNyAVGCXCBleF1NRM,1271 +torch/include/ATen/ops/special_polygamma_native.h,sha256=yN3kdGLZZWQwBEzVyepgkAmKHAc-hwPVQozOhqo_6iw,879 +torch/include/ATen/ops/special_polygamma_ops.h,sha256=79VySyevdASbDMh-1EWS7XNpCTDBBAKHzQrXYFCN52k,1988 +torch/include/ATen/ops/special_psi.h,sha256=giJd-39T-gF12Y7awuxTllQTqijpa-yVANXBZQnAef0,1376 +torch/include/ATen/ops/special_psi_compositeimplicitautograd_dispatch.h,sha256=o6tlW_3epOQYcW8XEQjV6pu-cndqSDlt5qMx1FVloT0,1220 +torch/include/ATen/ops/special_psi_native.h,sha256=8vdLa0pXBLLXKcQfi6Vw8ZfZGe2059gjwk-Ia6Ug25M,845 +torch/include/ATen/ops/special_psi_ops.h,sha256=VlJ0RMrjrCOM1q9Qn5WIoAMqHHuvcq0TzfUiBWo3CBk,1876 +torch/include/ATen/ops/special_round.h,sha256=s0QREy1vZk2-z4SqAnnC0iggjuFwi8tQO2fHbQUilCo,1535 +torch/include/ATen/ops/special_round_compositeimplicitautograd_dispatch.h,sha256=W_34NcVvjbpS9MFJ4y2Quas9g-7KquKGaQKUuVJ4qSk,1284 +torch/include/ATen/ops/special_round_native.h,sha256=7iVaOxXL_ruSlC6e73KpdaSavJIZcUJ4ak-cPrX2jSI,887 +torch/include/ATen/ops/special_round_ops.h,sha256=RTroHAdF1ABu2lAo_LAw3jHJu9U6YDZLCEP8Ycwx9rM,2013 +torch/include/ATen/ops/special_scaled_modified_bessel_k0.h,sha256=4EjKXd1Tf_6BCAOVbHrDWTzdwAb7yNqpfh5TzOqRXDk,1569 +torch/include/ATen/ops/special_scaled_modified_bessel_k0_compositeexplicitautogradnonfunctional_dispatch.h,sha256=JJ0-tQtB4nXwrgeTX4to9RbI77Z17btHt4Ir52Z2khI,1096 +torch/include/ATen/ops/special_scaled_modified_bessel_k0_cpu_dispatch.h,sha256=W5BMq4PSPURP8I6P8sn5H095tGvDJH3eaNW8KdIvt3E,1233 +torch/include/ATen/ops/special_scaled_modified_bessel_k0_cuda_dispatch.h,sha256=Xsu_RRw1TH2S2wTKSqVlqecFQICaxyrEoxLmjOEu4E0,1235 +torch/include/ATen/ops/special_scaled_modified_bessel_k0_meta.h,sha256=mf1aUcpMArjoxID5TzeAmutxC9svjrBTTasXkciyeTg,877 +torch/include/ATen/ops/special_scaled_modified_bessel_k0_meta_dispatch.h,sha256=7Bg3nJY7fyzkaNEFw_5ZFOey4TYT03r-Bqq7PJRYJiw,1235 +torch/include/ATen/ops/special_scaled_modified_bessel_k0_native.h,sha256=HlB5XyofsUQaJ-Lp3Lm2BvhEPAheu6pwEAR4W5QQG3k,956 +torch/include/ATen/ops/special_scaled_modified_bessel_k0_ops.h,sha256=_OCdWvT4VIG3180bJVlF4F_epI9osyHN0Upr2Tj60B4,1990 +torch/include/ATen/ops/special_scaled_modified_bessel_k1.h,sha256=fe7LY6NClorgBSSYt26WwFOZzlL4G3ZAx3cspwCYRuk,1569 +torch/include/ATen/ops/special_scaled_modified_bessel_k1_compositeexplicitautogradnonfunctional_dispatch.h,sha256=xRhAVsGYEe5kb0ArqW0qdYZL4B9xpYijp-onSX5HCyM,1096 +torch/include/ATen/ops/special_scaled_modified_bessel_k1_cpu_dispatch.h,sha256=UGWl4ksqIoVz3TiyK7uRihnylvFyLUNo3woy0jlWZZY,1233 +torch/include/ATen/ops/special_scaled_modified_bessel_k1_cuda_dispatch.h,sha256=sA1bk_BVRQMBfHMwrqRhTgTC4VzudF--W2-2Vabo-0Q,1235 +torch/include/ATen/ops/special_scaled_modified_bessel_k1_meta.h,sha256=TZC1739-ofp9br6czk136Jso1ch-CntcDd-QqvrodeM,877 +torch/include/ATen/ops/special_scaled_modified_bessel_k1_meta_dispatch.h,sha256=Cud9PktAJ7LJi8Uy-GmjZbD_lAFMPJTYHOwHmQ-vYmw,1235 +torch/include/ATen/ops/special_scaled_modified_bessel_k1_native.h,sha256=rMcOz0uToCgpfgY6U8zNE_ei5ikgptEFm6qHhF1v3NQ,956 +torch/include/ATen/ops/special_scaled_modified_bessel_k1_ops.h,sha256=KhUH3wtMwIyRcJE1BLIbn5khTfGLspdNC757iJTaAKE,1990 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_t.h,sha256=MVzdfiJNGYWfjwtnmU5FCKHRkvaCYo_W6Jw7SniSqRg,3642 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_t_compositeexplicitautograd_dispatch.h,sha256=wrPdRpc5wGpB_0tpg9rAkNsZUeEBQxWfTygmtJdZGkE,1725 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_t_compositeexplicitautogradnonfunctional_dispatch.h,sha256=BBf7kQtuUBreNe7gUna6GkbtU6mVKt_sXamjUKwKwP0,1123 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_t_cpu_dispatch.h,sha256=TFNUe_zLaNQpqXlIYvgAaJaULZAhKXZ37woMQ2ICkRU,1314 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_t_cuda_dispatch.h,sha256=dj_2hnzSA7HfGGoSx34Kp0KsuBts725rZym0hWYGjB0,1316 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_t_meta.h,sha256=fVnOm3iiJVXNN5e4uhBQFMRlFql0gV7Qer1-uHYAc_E,904 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_t_meta_dispatch.h,sha256=kwR7YzRS_V1t4ykXObJ2Bw3AJcyAS9Dhkx3gdpvtUFE,1316 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_t_native.h,sha256=mO5zPll-wbC0U20ruj97L-HUsYi60fr6dCZnlkvU6qU,1465 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_t_ops.h,sha256=ECGj3fUtBbvhtZPX3svR46NS_LgHHYOOvlWnqa8gD9Y,5142 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_u.h,sha256=fNU1tpN9MkMDm1qPJOfx5717QYv1uYAkRDwX38uLnBo,3642 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_u_compositeexplicitautograd_dispatch.h,sha256=j6k3ocRevbAPdAG6IpANOVWD_HiC5HDJd9ZVIyZzGww,1725 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_u_compositeexplicitautogradnonfunctional_dispatch.h,sha256=0yf6_JUo0lWPZHHxsfkBw6oO6-AxsrC7CPrJg5Adyn0,1123 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_u_cpu_dispatch.h,sha256=Rg9w3z9eoLbhGHigRE8_RhAkoqAWLQ8qgzswgTW5RVw,1314 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_u_cuda_dispatch.h,sha256=WoJMyXy0-ZL6vmljlxTxYIIm9Tv90fTVVHQaaN1Aubs,1316 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_u_meta.h,sha256=p3bjZl_xEMMNJFoY0jprAW_hJbvA6Uk5oWfXKtdRYAw,904 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_u_meta_dispatch.h,sha256=wrCbK-OClupZhsAatgqA3zuLkYEcflpRIe22LFDbQLQ,1316 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_u_native.h,sha256=8_mu3iTVsHfIbMTb4n5s3s9iwnOKu-4DaH7X_K4xt0Y,1465 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_u_ops.h,sha256=6lkpkeUq6BR6nGsVy98PAbHnIIW1fT3bU-tgupsherI,5142 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_v.h,sha256=UWpibMb3zHDl72iozOuNPrO2-g9EOXF494v6E8zrcpE,3642 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_v_compositeexplicitautograd_dispatch.h,sha256=rv-A6chP-HRJyKx8zi8wtIdSUaiPD8qw298K1ACoMH0,1725 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_v_compositeexplicitautogradnonfunctional_dispatch.h,sha256=uoSRWfAF3ThLVW_wqFxgCb9GHKq-xbqQDwuSzeq3t3k,1123 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_v_cpu_dispatch.h,sha256=ax-xySg-8MEsi9eDZ2sVHipvAdu14YaSCz9m0N_9C5I,1314 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_v_cuda_dispatch.h,sha256=c9Lo7ph4WA0ZUxKEI2aA68VMptZynLQXF-YvrMrMb0A,1316 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_v_meta.h,sha256=_gc7yzHCWzJDMeIL1qAekWZByPWYHbZiwPznuzmqi7g,904 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_v_meta_dispatch.h,sha256=zZVsinGRxWMUaFvx5jWIcAA1oyl86daA4WRrxTXqo0c,1316 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_v_native.h,sha256=08SITssZeOT1KkBV9txnUVoWlsRRtXePxNgvgDz_syI,1465 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_v_ops.h,sha256=hFKTejPGeC_vwsOjKXpCX-j_xfRhaOA5icc5VmLKTRQ,5142 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_w.h,sha256=FLrI0CRX4KZLc0_CCZt-FqwSHnv_iB7mMdJmuc8QLp4,3642 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_w_compositeexplicitautograd_dispatch.h,sha256=-jJWyJzdkKBtk9LfiM46kOjWIcps57sbLFbHOXp44e4,1725 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_w_compositeexplicitautogradnonfunctional_dispatch.h,sha256=pkOjKcAThIG4wnK3j7IcI7ro-rXI9bh2h6p5wCj2DbI,1123 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_w_cpu_dispatch.h,sha256=3XK4PCMLAI2huGSOmf5eBf7APCg7RUv02H53EfrOYXs,1314 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_w_cuda_dispatch.h,sha256=lhrQYBYobpP35pjWAxCS141ky8BM47_iZr9FFqeCgBo,1316 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_w_meta.h,sha256=u3VulrhZE14C4b9dhHHpZb4HV3PIiezF2Xr6nDBNx38,904 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_w_meta_dispatch.h,sha256=FrjD37iNglgVest2fRq-Y7J12XnS1i3UuZV77nHxHgM,1316 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_w_native.h,sha256=DsmeiYoWfbgVqCW73_HoTpo857BvOEmIstdLdlTPXn4,1465 +torch/include/ATen/ops/special_shifted_chebyshev_polynomial_w_ops.h,sha256=ZlT2m-4BSOyHhfySOcZ4KR2BtmV2uFZvIv8RmLPsrk0,5142 +torch/include/ATen/ops/special_sinc.h,sha256=7ThvyAqs1eXmE4L9kamkMjAOHC8QhmcfXPKHJerPvXc,1386 +torch/include/ATen/ops/special_sinc_compositeimplicitautograd_dispatch.h,sha256=BaERUDnmiiNnJuz44R1i7YrrF2qD2AW5DRJVucnmzlg,1223 +torch/include/ATen/ops/special_sinc_native.h,sha256=97WjHoKVZuwyhH06LiMUIHC_wOWSDLd9XHTye6koFPw,847 +torch/include/ATen/ops/special_sinc_ops.h,sha256=SRPX8Y4yzJsNxZZrFKTK9sJelQW9TaJzKRaeMS0Mi1A,1882 +torch/include/ATen/ops/special_softmax.h,sha256=FZWQ2h41hptTXr7kwi1upxdPHGAr-yKSyCBUaesV4t8,1075 +torch/include/ATen/ops/special_softmax_compositeimplicitautograd_dispatch.h,sha256=6SOinuiUP6foEb4l-46VjqKhmKjEoxj4FKnhUiEy9Sw,1122 +torch/include/ATen/ops/special_softmax_native.h,sha256=XpLzlu9QK0PA3H3imfrA7QE_wpwukBH6IRde0lDoR9w,832 +torch/include/ATen/ops/special_softmax_ops.h,sha256=0J5f_TbIXaDn22mqfB-4GUyWQw5td93pnuNxF6Q4Ai4,1451 +torch/include/ATen/ops/special_spherical_bessel_j0.h,sha256=snA6zOgN2LNgbvPNKDPeML_G22AgsNvie1UE9U7K5lY,1509 +torch/include/ATen/ops/special_spherical_bessel_j0_compositeexplicitautogradnonfunctional_dispatch.h,sha256=vniGq6leS7014yOkwBI2BdBPXRo66drjR-azA3mvgZY,1090 +torch/include/ATen/ops/special_spherical_bessel_j0_cpu_dispatch.h,sha256=bFWBt32vGv7q8ekkKpL56gkJmJYTI0NTW05JhT0Zpm4,1215 +torch/include/ATen/ops/special_spherical_bessel_j0_cuda_dispatch.h,sha256=ra9b2kMPmYb1xqlzIsTQwHFYcW5KK_MDdmYDGaZqIec,1217 +torch/include/ATen/ops/special_spherical_bessel_j0_meta.h,sha256=ocWLQIXGA1TUYXuQhO1iAjVrfPzDph9DagsGyubMxm0,871 +torch/include/ATen/ops/special_spherical_bessel_j0_meta_dispatch.h,sha256=eR7pC4FyhMWZF2JvUStV2KL1wwmdoRIaeorkqQGj8Xg,1217 +torch/include/ATen/ops/special_spherical_bessel_j0_native.h,sha256=dHv_vsxa3rjolPdfUzu0pX1emwN-8k54vbJpj_09lUg,938 +torch/include/ATen/ops/special_spherical_bessel_j0_ops.h,sha256=aA3MOUFet_Iqv0k1z1lLVa5JscMQUG4FM3nKu_EuQYQ,1954 +torch/include/ATen/ops/special_xlog1py.h,sha256=ggIs7oHdcmRGM42OWwcCrEJ9uFZ6DYtHdmf-JkMyMlY,3229 +torch/include/ATen/ops/special_xlog1py_compositeexplicitautograd_dispatch.h,sha256=sCnJQOQ3evGJBc3c2hvGb6a2bzQzh6AB-T1AaGbxSQ8,1629 +torch/include/ATen/ops/special_xlog1py_compositeexplicitautogradnonfunctional_dispatch.h,sha256=KEfOXxQReNQDE1hyrH_xRsxhgIzboQcpdY44_GwJGDQ,1107 +torch/include/ATen/ops/special_xlog1py_cpu_dispatch.h,sha256=WjF1kBhkid1UYH_nxI6ePt-Wyxn0q4GTxvAZuFwobOE,1266 +torch/include/ATen/ops/special_xlog1py_cuda_dispatch.h,sha256=EG8oDpTbVVQOqVk9hnho1rHL0LMKln0vwiIy0lR_FSA,1268 +torch/include/ATen/ops/special_xlog1py_meta.h,sha256=bGR_z1ro8mjU2vTYkF0IEb5jS4GtZIB-5emOtwSuzyM,888 +torch/include/ATen/ops/special_xlog1py_meta_dispatch.h,sha256=_EZQHUrDLk9nSy2ktiAc45GtON8RXWeiVeGYRj4RhMQ,1268 +torch/include/ATen/ops/special_xlog1py_native.h,sha256=ukUTrOhc_lF-eRJyj6sSMjYmpHykKqrTPBikW0tL72U,1339 +torch/include/ATen/ops/special_xlog1py_ops.h,sha256=SMso4U5z1NQH9jN-aW72l9EUaiTec-LHrFtUFTGmDYU,4896 +torch/include/ATen/ops/special_xlogy.h,sha256=EIAdsHPOOqS-qqw-wdKef0FRCJwXmNor1_hrGjrqqqE,3173 +torch/include/ATen/ops/special_xlogy_compositeimplicitautograd_dispatch.h,sha256=aqfar5JOvxLxIQrvuIoAEssfyxeKQBPN1eOL2EzddwI,1930 +torch/include/ATen/ops/special_xlogy_native.h,sha256=RGzppDupJ-qzw6koHwMSOQqUoA2fcOykAlLFbeS1V40,1301 +torch/include/ATen/ops/special_xlogy_ops.h,sha256=x60yeYwefmm2dQzSTEMw2jngqQV3ncNOBWIWejmrqOc,4860 +torch/include/ATen/ops/special_zeta.h,sha256=Ngh85lTTSgITr5d_Dr1yQAFgokfBM2oH2zhI4Om5fKE,3145 +torch/include/ATen/ops/special_zeta_compositeexplicitautograd_dispatch.h,sha256=FaHfy7ttyGP2S3Rliu52UmWRNBE03nhzcBDtRcSSdfc,1611 +torch/include/ATen/ops/special_zeta_compositeexplicitautogradnonfunctional_dispatch.h,sha256=ilvkrmsCpLCLLLt3Or9gnmoOci9dawkbomsQGWlLI4I,1104 +torch/include/ATen/ops/special_zeta_cpu_dispatch.h,sha256=-YTGCYbzynsRKUcmekGy_CXRHQ4Z7rUC4PkGYDNj7kA,1257 +torch/include/ATen/ops/special_zeta_cuda_dispatch.h,sha256=ZNxTm4wZDm-etjzCsKBjEbMN4fU9sV3bKBDRMHnarU8,1259 +torch/include/ATen/ops/special_zeta_meta.h,sha256=XNSGN_lHxA_eCmuXYHp2FfZBa-xMCEBVjbchgl5SQug,885 +torch/include/ATen/ops/special_zeta_meta_dispatch.h,sha256=tR8UJH3ZZ3EWPwVhIi2N0lpdVbch2KgtbhOgvgbJlko,1259 +torch/include/ATen/ops/special_zeta_native.h,sha256=0sPASr8-1aJDj3OWDzrow2kowrbgPYceb_hByH0jm8I,1318 +torch/include/ATen/ops/special_zeta_ops.h,sha256=5PiIsgYoGPL0PUfMw1ui4jMhoEzgw2fsqcM3i471jAE,4842 +torch/include/ATen/ops/split.h,sha256=LmCGz1UM6HhdKyhH58VnN07va9zZtlZV05A-fVZsyNQ,3038 +torch/include/ATen/ops/split_compositeexplicitautograd_dispatch.h,sha256=Na3qet7OfTleRhH-Rc-I6oN4XxJm3qXCyhrckoEgVsI,1210 +torch/include/ATen/ops/split_compositeimplicitautograd_dispatch.h,sha256=fMeVZ840DdDcOisZ6mfsQWAveNKE8WnssTfc-yO-xlA,1226 +torch/include/ATen/ops/split_copy.h,sha256=u_9MWi245Z3epqfZBk_SBc92o7nqfXs-lcU4BZazA_w,4298 +torch/include/ATen/ops/split_copy_compositeexplicitautograd_dispatch.h,sha256=oH3g4I0DRdKhNdD9CJ9ssY8RmGR5kSQC7k-h0OQzC34,1459 +torch/include/ATen/ops/split_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=WvO9zvbnEJBzng-tBdymUV7vn7T2tFHnYIRp6H9rs-8,1246 +torch/include/ATen/ops/split_copy_native.h,sha256=PGut4w0mAkddQ-XKqsM-gLAvktXpcNtx9jv3kH7lIGE,945 +torch/include/ATen/ops/split_copy_ops.h,sha256=OlktoVoHL6S6-pxu-3DMTsoYUInTcFgXCpLBYfWeJ0U,2186 +torch/include/ATen/ops/split_native.h,sha256=7jg1RrUsqxP7ZbwfDH3-RfJx43IZvgfNTbOYQZ-ve6I,928 +torch/include/ATen/ops/split_ops.h,sha256=JHK3YMPHOSv4EcH6cuMZ4Ga5hMENXhaK1TxMERcbwa0,2181 +torch/include/ATen/ops/split_with_sizes.h,sha256=ZMrJJ4m7T1gLCxtZdjWuqwyu0FKzNwrUcOOZQqdIw6Y,2048 +torch/include/ATen/ops/split_with_sizes_compositeexplicitautograd_dispatch.h,sha256=q9GQZwQOePgi9QALqQtenKmCjbe2FHxKfuV9juj4wLw,1250 +torch/include/ATen/ops/split_with_sizes_copy.h,sha256=uWhIkpk2isGqDgUPP0Q6Y43kFdcQY0SudY5QkYlXhPA,4807 +torch/include/ATen/ops/split_with_sizes_copy_compositeexplicitautograd_dispatch.h,sha256=m3-umwG5BcbWY7Sf-FtkQK6kR3wP89HrTPSIeRqDAXo,1539 +torch/include/ATen/ops/split_with_sizes_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Tq7B_I3rJgWE9N25ZjGsAV-SRjNXlTAwmwhz6qgZmRA,1286 +torch/include/ATen/ops/split_with_sizes_copy_cuda_dispatch.h,sha256=04BCVAy-9w35LfdNS2jnpKUXC8mWPO1IjZOBMf7XEyM,1497 +torch/include/ATen/ops/split_with_sizes_copy_native.h,sha256=2-hRKsvIhlnDnyyg-fPerv-KM1ZvaguKhuUacDue8aY,1106 +torch/include/ATen/ops/split_with_sizes_copy_ops.h,sha256=LwsE-BfqopdF89MNqvWuszY24ivT4dNDCXSod8Ef_KE,2269 +torch/include/ATen/ops/split_with_sizes_native.h,sha256=Lo6FAUT0rM9K4zwyRhQkNlAB9BFkV_s8K4Y5wIzBlKA,956 +torch/include/ATen/ops/split_with_sizes_ops.h,sha256=Et-aX1oKM1jYJIlrqCvf6Br6LN_R-_EttlH1aboJEcQ,1488 +torch/include/ATen/ops/sqrt.h,sha256=3vuGGRFmpxJ7hem3aUQ8rIoYj5HQr1D9YrScWGo77FY,1447 +torch/include/ATen/ops/sqrt_compositeexplicitautogradnonfunctional_dispatch.h,sha256=iFA7Sh0ScdYwjUZc_bAlSnnfQLdBo86eKoH-n1WYbMM,1120 +torch/include/ATen/ops/sqrt_cpu_dispatch.h,sha256=aTunQE2hnym7YR4D8ss3p6dRdSxOo2atd1hliRimtUk,1205 +torch/include/ATen/ops/sqrt_cuda_dispatch.h,sha256=dyr0StYBu3hKfyER9KMKo6xM8UE9ZVeaTqagvgwkQac,1207 +torch/include/ATen/ops/sqrt_meta.h,sha256=y4kdSDKa2k4LRTnJiRbWaLr9GT7rv-OSf0adb1lDfjU,851 +torch/include/ATen/ops/sqrt_meta_dispatch.h,sha256=yn455D7Sw82dsF00DELkJ5TM4-tozq0joxFgPw3pWgc,1207 +torch/include/ATen/ops/sqrt_native.h,sha256=Lm5_XumgmLrEeT3RUCa-X5fpUFt7CvQHIsdrzl3H2TY,1352 +torch/include/ATen/ops/sqrt_ops.h,sha256=_EamnUn7C35asMO-zGM7xHyAlY3P4B-AIihsKcNjRkc,2338 +torch/include/ATen/ops/square.h,sha256=hlx4AjEJzsFNdYoBZF-ab8gDTFWBR3dW3RRsblzJ6T0,1473 +torch/include/ATen/ops/square_compositeimplicitautograd_dispatch.h,sha256=1UaNAWjcctZlrkkOSWGULzj89kz-CNJMtv4VrjD7WoY,1257 +torch/include/ATen/ops/square_native.h,sha256=mhzZCb6cIFe_c5ag9JVqheIQ_H1uXT2HtsR_OtZyuOw,887 +torch/include/ATen/ops/square_ops.h,sha256=8YLp-1qM0AgU_-n6OX6cDOApj6cDJ8boDp2dq3gRlOw,2356 +torch/include/ATen/ops/squeeze.h,sha256=uCTHSJtZzHf_16uo071lio5QuU3NlwBDuGyuK1DxkXI,1517 +torch/include/ATen/ops/squeeze_compositeexplicitautograd_dispatch.h,sha256=gWPKfegwWr74pziRJMv9CdYIUuBrF1U94lsYKwI23oY,1386 +torch/include/ATen/ops/squeeze_compositeimplicitautograd_dispatch.h,sha256=goWPVoGzVcUfUhP5bg_nqExxdoOtbwWBqVcYxe64ye0,1134 +torch/include/ATen/ops/squeeze_copy.h,sha256=g4o8Ok98cJQu0j9yG-qX0E5KcLjGdm6lxW_zqGNyZBg,2818 +torch/include/ATen/ops/squeeze_copy_compositeexplicitautograd_dispatch.h,sha256=8ij7FIwfohmuDBPC_D3A_Ai6DeLjVP5IpzvdOYfRaFc,1572 +torch/include/ATen/ops/squeeze_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=wSanXLTi6YHiUGi9q_8I6ezkLwJF5Wm2P_Yia-er9ys,1234 +torch/include/ATen/ops/squeeze_copy_native.h,sha256=i6hzXP2umxR6wxU3xub_QyO0kIEnf9Y5SOkoNCp21No,1225 +torch/include/ATen/ops/squeeze_copy_ops.h,sha256=7KX_keaI-xF7asMpaRrBjPgxWhPWOps_hFgF9opNuYg,4458 +torch/include/ATen/ops/squeeze_native.h,sha256=AHLmh3OWoXX1Fvd6XVNPStfTcjcFOuXk6OpHOrmDWH4,1702 +torch/include/ATen/ops/squeeze_ops.h,sha256=ZZ5xFxO3xpsEsyY6RWkZ0ioPfnXXODZI4ROLYV0PNI0,5310 +torch/include/ATen/ops/sspaddmm.h,sha256=_TrkUsrWUED4Khqgr-Tqbx0gszAWjGoc0dDioFtH7Bo,1906 +torch/include/ATen/ops/sspaddmm_compositeimplicitautograd_dispatch.h,sha256=egsQx2vDud2CFpkGhXZE-vY9FXbGLnjZyzSKzToYAVQ,1153 +torch/include/ATen/ops/sspaddmm_cpu_dispatch.h,sha256=M_kS94u6ls3H1bnjV1sytxiDmFJkiMD4e_g0jptUq54,1316 +torch/include/ATen/ops/sspaddmm_cuda_dispatch.h,sha256=_IN1PpqkJ04sEmCyPCNZS0ZJhTZmaBurugBc-QlQiz4,1318 +torch/include/ATen/ops/sspaddmm_native.h,sha256=xxBf4MrHxweS7P6UI-XXKnueICEAWLlRptiE7QbBlrU,1633 +torch/include/ATen/ops/sspaddmm_ops.h,sha256=CZDASnbxNGcwniUeRwVpne6r3O_GCW0rVPSJgvaDg_4,2539 +torch/include/ATen/ops/stack.h,sha256=XhM8_9Tqnno2b74g9OznwItMdKfktnyz6b65e3lbV3Q,1428 +torch/include/ATen/ops/stack_compositeexplicitautograd_dispatch.h,sha256=Qu-WqlhV17TFQ3RqrtmGLMubKjwL2TjltnLW7_zLbRw,1242 +torch/include/ATen/ops/stack_native.h,sha256=jxhtz0dPI1mJPylqtbwuSO3YhfYVY6NUFsrwAX0zMRI,859 +torch/include/ATen/ops/stack_ops.h,sha256=SQEO3u4-mWQekbleicbiX6XfTA7LvnlmImtedr2GBBQ,1930 +torch/include/ATen/ops/std.h,sha256=dYQ61XWSH4eY4v2bTQPRgChAmbChbll3SGkTEFe_dp8,5217 +torch/include/ATen/ops/std_compositeimplicitautograd_dispatch.h,sha256=xUbW8v9YWvA4mlyeaii5eDOxsUTInqcs1AYamPm-5io,2312 +torch/include/ATen/ops/std_cpu_dispatch.h,sha256=4UqyA2xEQRc_GbD5xrvdeBAO9CEestA3RI1Q2vR5b8g,1497 +torch/include/ATen/ops/std_cuda_dispatch.h,sha256=ypVfZqvjdWZD3tITTx_EOByzmx8hnU7-Nw-7fX7sBQQ,1499 +torch/include/ATen/ops/std_mean.h,sha256=1ScPMwVTMT3aWGsQjJReYaX3ee5qjMgJ054Ri_UKXuo,3536 +torch/include/ATen/ops/std_mean_compositeexplicitautograd_dispatch.h,sha256=ONTHaDIp73nUGg9JuK3lvdec74g_CONqG2Es31yrXlY,1466 +torch/include/ATen/ops/std_mean_compositeimplicitautograd_dispatch.h,sha256=0rRgk1n4Ep09OMCVj0CqkmuO-xtSTSusve72Z7Q-00A,1558 +torch/include/ATen/ops/std_mean_cpu_dispatch.h,sha256=xfwQttCn6k3xHd0htGnDimeaDISkJr7b-RIGUsVE0z8,1156 +torch/include/ATen/ops/std_mean_cuda_dispatch.h,sha256=WBBl8_2ipN8Z6XjyoYuOk4wJzp8BxXF1kC8TLL7QjA4,1158 +torch/include/ATen/ops/std_mean_native.h,sha256=vqFl9y5es8urAKXpxe3C6KyYSZHIFIhYfDS2g2uRQ3U,1722 +torch/include/ATen/ops/std_mean_ops.h,sha256=saNzKs-y8IGfmeZSstxUYJZeKs-murIOCzNIQ_yC4Ss,6039 +torch/include/ATen/ops/std_native.h,sha256=pZOcI5tMiq3zSGqsuxcKa6rPTD5tX8OGdtMfEXTws2Y,2302 +torch/include/ATen/ops/std_ops.h,sha256=N6jzttuPVPPndEdCtZlcglvr2Yzbkj14f8sFs2YY9PI,7880 +torch/include/ATen/ops/stft.h,sha256=lWCOL1Jxy-kP6cWxKUQI4vbhqKJC-2qWZK5vpG08tO0,2367 +torch/include/ATen/ops/stft_compositeimplicitautograd_dispatch.h,sha256=ToD1dIv7xi-Nf-9YxFwOplNv478g2brY5yiuCyuH4Tc,1799 +torch/include/ATen/ops/stft_native.h,sha256=QO9JkYdC29p-Xdd__2vlqU3qt1w9viFOs2pgkmxThX8,1548 +torch/include/ATen/ops/stft_ops.h,sha256=PT4s1rwWGyRU88IeKyP2xSMIwMOKP3n72lSQr35PBGQ,3644 +torch/include/ATen/ops/stride.h,sha256=nvfpDd4T55fOl25onEU17QovKOGJJHoniwFKEZVNM6Q,1152 +torch/include/ATen/ops/stride_compositeimplicitautograd_dispatch.h,sha256=qldgSzscjzWKDKfOUw-jPNXtsOXGlG47m7ZI_GYF0Qg,1125 +torch/include/ATen/ops/stride_native.h,sha256=GTs3yQW13C5F7AJkLM7sj1pqW7SHPyJDME4oqIZj2wQ,835 +torch/include/ATen/ops/stride_ops.h,sha256=rFc6mVVMKuaizC9shpHbYkmQQM9iwwa8c05xa7MzdwA,1870 +torch/include/ATen/ops/sub.h,sha256=YsMWavVA0JIV-srSCIjqjiPyLmYdl6_DTZSOtamFpAU,2451 +torch/include/ATen/ops/sub_compositeexplicitautograd_dispatch.h,sha256=Fi3JUXdinNPyxVLWwpv9yeMciP6lQP1g7sfPkVPv844,1459 +torch/include/ATen/ops/sub_compositeexplicitautogradnonfunctional_dispatch.h,sha256=xWfZ09A3aFUZnU-I2niGUWrwCyx-hYcC-GviSncjDTE,1226 +torch/include/ATen/ops/sub_cpu_dispatch.h,sha256=58NlT7cqVhKmx9ZYx7oF7sFOKeE34X8Hxe2rM21zY2Y,1415 +torch/include/ATen/ops/sub_cuda_dispatch.h,sha256=wkdCM2w_3bRhVr2eiDC4lR5fKfzj6WSGgDr5JTx7fFM,1417 +torch/include/ATen/ops/sub_meta.h,sha256=kSvLlP-sk7E-6ikFYpNoKMkUflGtYnjWxvCi9HsHnC0,909 +torch/include/ATen/ops/sub_meta_dispatch.h,sha256=kzImheR1ZJqP-LRe1sGeIHMxQipxIcIJhpWCJ-Dyr7w,1417 +torch/include/ATen/ops/sub_native.h,sha256=FgMuvE_CDlKSJLXBw5jZ0EGjoY63yp5FRvIv0taN-QE,1873 +torch/include/ATen/ops/sub_ops.h,sha256=2Bt-nTf98UONilAP3IzZA9RzSnACfcnH4gfJx2d-B3U,5075 +torch/include/ATen/ops/subtract.h,sha256=jfKHfEn1mKqp3XMuO5YctZ6x2kbwCH7VU8gecDnQJPk,1913 +torch/include/ATen/ops/subtract_compositeimplicitautograd_dispatch.h,sha256=odZrGP4_1BltK388bx_uOd2I87-xseVgXjiw_XTbZ_o,1698 +torch/include/ATen/ops/subtract_native.h,sha256=TXEcr4ZpEHKacACVqoarXB4sKL3aI0P1fmssARk7vZk,1272 +torch/include/ATen/ops/subtract_ops.h,sha256=JjHi1rIX5j9qzg334s_y4yuFGduChmd8JaVA8iCfxsI,4363 +torch/include/ATen/ops/sum.h,sha256=DnlE4KW2nVWZiM8Zj9m72nW-BzYWkAc1EbOnIvs19Uk,3734 +torch/include/ATen/ops/sum_compositeexplicitautograd_dispatch.h,sha256=1zVuIgUIBYIp2AdgEzOLsBGDl0n0z2dam8r1sAhgJ7Y,1343 +torch/include/ATen/ops/sum_compositeexplicitautogradnonfunctional_dispatch.h,sha256=_g4k-5VlocOD5waK8UJyCBy_uMKFY3uE1J3_J3gaqqo,1172 +torch/include/ATen/ops/sum_compositeimplicitautograd_dispatch.h,sha256=78j4b7h5nBqjpuPEMFpIom3enReV2UIXaw0KQqpdX6A,1460 +torch/include/ATen/ops/sum_cpu_dispatch.h,sha256=y-EiwME2WmSrkSz6obwX_VRpnXb1U3FHNBkltXNu9Bk,1440 +torch/include/ATen/ops/sum_cuda_dispatch.h,sha256=0tgVSiEtOvVfGoM6peT7UcOb_3plxzLoVGdlgeN1h98,1442 +torch/include/ATen/ops/sum_meta.h,sha256=p2y2jO6M6kKNVlQNpMvKH1q_RMzaALKnxSRUyi1-Lcw,944 +torch/include/ATen/ops/sum_meta_dispatch.h,sha256=ZFNd61I2mb-98VnEHFhsNipf-sZVgg7kmZ2D6nl5l_U,1442 +torch/include/ATen/ops/sum_native.h,sha256=AjF3XICRMdfuzMiPBb8pnfYTMn_NhFtyY0rNsZIjY8U,2216 +torch/include/ATen/ops/sum_ops.h,sha256=efyUa5HclcFTU6aVzQ7Y_aUOjS7Wo-on1cTD8jtVOc0,5535 +torch/include/ATen/ops/sum_to_size.h,sha256=eO0YxMH5mYsj7pPZGXo1-8SMy1l1W1P7i14qf5t17FE,1306 +torch/include/ATen/ops/sum_to_size_compositeimplicitautograd_dispatch.h,sha256=Yi3TN-MWGsMcKQ_HrsibbJl8pdQJFISMWciv7NiB3mA,1166 +torch/include/ATen/ops/sum_to_size_native.h,sha256=A_hlSs4cC7NERLutMeTRpC6GUZ0LxtVDHlLcjRAzeZY,794 +torch/include/ATen/ops/sum_to_size_ops.h,sha256=tAGkFGpp3GKFySEM8jdo1icQe7hps3eHlHuQM0AxjzU,1348 +torch/include/ATen/ops/svd.h,sha256=clL4HrtX2sniKwo5iFMVhVdzxMqRALPgGetYFAlZlyo,1884 +torch/include/ATen/ops/svd_compositeimplicitautograd_dispatch.h,sha256=IzVMr-_G5gF_owqY0WXFhf3rCCrbZkvWdVDydYxNtPE,1476 +torch/include/ATen/ops/svd_native.h,sha256=tIznD7Vq5gJyYglXKWfwXQT7ju2evJsLJz3hPlghGEc,1001 +torch/include/ATen/ops/svd_ops.h,sha256=XMbbSvXNThA4zarQ3IPw0pHPSHrnv_YlvIkepnS84U8,2432 +torch/include/ATen/ops/swapaxes.h,sha256=zQQ3X3o-TkpJeEzU8w1M5qNElTnLnkogw-_sXQi7JhE,1007 +torch/include/ATen/ops/swapaxes_compositeimplicitautograd_dispatch.h,sha256=o7tM8VMt5WwjKljCtzfonCxg09a3b-mfyhgbOVscfJU,1162 +torch/include/ATen/ops/swapaxes_native.h,sha256=0OaABMXZcZe1Mteu_E5wBUi4whe-Ajf-PUzEqj-FoX4,872 +torch/include/ATen/ops/swapaxes_ops.h,sha256=xnW4RwVEkXmvQjhl0Yy3gKcL1F1h2orUQDJwyzXsKEM,1973 +torch/include/ATen/ops/swapdims.h,sha256=QneSsULwq6x1uiKt2L9oRg3LXzxS9IRy1k6suLF3GNc,1001 +torch/include/ATen/ops/swapdims_compositeimplicitautograd_dispatch.h,sha256=a14xnO_VhOY8BNwgLCntcvphMUbrmifuvtSuFnPvzrU,1158 +torch/include/ATen/ops/swapdims_native.h,sha256=pppjg-O8KQm_q7sTLRmRzBpmJavf6jU4WyEnlPkarao,868 +torch/include/ATen/ops/swapdims_ops.h,sha256=2lm6Zppnb0QoX9gWTc7YDv0-U8LiV_juk0hgdwt7aU8,1961 +torch/include/ATen/ops/sym_constrain_range.h,sha256=ia1nJ4SAEBxfFmMFnAr4NhYcc7dz99QwPn6H_AlsftY,1102 +torch/include/ATen/ops/sym_constrain_range_compositeexplicitautograd_dispatch.h,sha256=Y-WHZeSkqdWo5VzjSoIWxECeSIWbSmD79LaDJ2fBn0A,1143 +torch/include/ATen/ops/sym_constrain_range_for_size.h,sha256=s-wZuiUrWhcSjSFgs7P3X9nhAxX9jWSznZinM2s9jFM,1138 +torch/include/ATen/ops/sym_constrain_range_for_size_compositeexplicitautograd_dispatch.h,sha256=Vz8mRGTln7x44sFx-m1VhXjBiOgvbmOY06wm4hbB6hI,1152 +torch/include/ATen/ops/sym_constrain_range_for_size_native.h,sha256=j1e8AKpkcO1c8A0CPASZZ8JzO-JqoX9Vz2pfUJZiCW0,862 +torch/include/ATen/ops/sym_constrain_range_for_size_ops.h,sha256=LCZsYjIt9X_uvjJ_-UG5TN-Kot6dB-y5G2nTihh_giU,1494 +torch/include/ATen/ops/sym_constrain_range_native.h,sha256=3HZ-ZEH4AzqtvJr2GWpEF8-eR_nny_cH1nTeCYUtPGA,853 +torch/include/ATen/ops/sym_constrain_range_ops.h,sha256=4SG1NjdVPWgPxl2c8YdDVOuyh5ax3TymblXdtN_GFpc,1467 +torch/include/ATen/ops/sym_is_contiguous.h,sha256=xkO4X86Co5bUdVUqqFEWPyUWqeSpOi84D3D7KhyBESE,1108 +torch/include/ATen/ops/sym_is_contiguous_compositeimplicitautograd_dispatch.h,sha256=GUrLxf8OhpdhROqpkLNp5A9z7uc1CwmXWu7Mqk0TLYg,1121 +torch/include/ATen/ops/sym_is_contiguous_native.h,sha256=p8y9OEFDkpmJk4kfN4q1aFvJYsQ5DtZ0hDmuhelQ3DM,831 +torch/include/ATen/ops/sym_is_contiguous_ops.h,sha256=ABTI9OLJ5W1Ccae_8v8zTt8vHudN9Dv-uag4007rMmw,1413 +torch/include/ATen/ops/sym_numel.h,sha256=Gjvevb5b93hl_TKd6MgM8Zs1fiX60rp16gvHbZUAG-Q,951 +torch/include/ATen/ops/sym_numel_compositeimplicitautograd_dispatch.h,sha256=Vfwviz0mwxibv_Az0DlVnh6bl58nmKJfUubmeUnODRo,1050 +torch/include/ATen/ops/sym_numel_native.h,sha256=vmqrcm74Dt76jBXYcfEER8WO-Mz62P5rHya0el2kWyE,760 +torch/include/ATen/ops/sym_numel_ops.h,sha256=3qvhCRQ2aK8e4QCk2Qr0WlwvbsYTTgkfiQPrIjqsyyM,1257 +torch/include/ATen/ops/sym_size.h,sha256=wuGmMsPWNqxa-uh_jHyElu48NJohT0MdfdXTZpoFG1s,982 +torch/include/ATen/ops/sym_size_compositeimplicitautograd_dispatch.h,sha256=WNsLWGocI1RB_Lo8eauALo2ZZBIlG_koZxj_g4PiuSc,1062 +torch/include/ATen/ops/sym_size_native.h,sha256=lNqq_FTFiEskVifjtev1klmnlGbTsBMQZUOmgqCw3r8,772 +torch/include/ATen/ops/sym_size_ops.h,sha256=lv-Ofd9HRsWI72GrVl20BpDiYwBTJdqB_oQJxdldc6Q,1309 +torch/include/ATen/ops/sym_storage_offset.h,sha256=-OuB44N5vCRjWG0gNmZ2PN2_TF5XXTf8hxdcS4Ml1Fs,987 +torch/include/ATen/ops/sym_storage_offset_compositeimplicitautograd_dispatch.h,sha256=74awcbi-DVtQaS-whH_L_ioCenjEdjoBC9UW1z9x9k0,1059 +torch/include/ATen/ops/sym_storage_offset_native.h,sha256=9ua9LjBAts_9EV7TFg-CSV-fyUrwS44CjeGJDGawjq4,769 +torch/include/ATen/ops/sym_storage_offset_ops.h,sha256=aIRKE5bCpK6KMle9L8kA_1vmoZNdRsTbRvBijOIxozw,1284 +torch/include/ATen/ops/sym_stride.h,sha256=DMbsfB-MgisgLLgJpWfptRl0BwpzIxh785cFXE1c0xg,990 +torch/include/ATen/ops/sym_stride_compositeimplicitautograd_dispatch.h,sha256=ZD7Erd1ngfkwiHXAsSdhvqu9xjZzaQ0-C2mMMKGvxCE,1064 +torch/include/ATen/ops/sym_stride_native.h,sha256=vInmcnvX940rM_hZJoncbr9NUEubSv2W1Wn9TLSVelw,774 +torch/include/ATen/ops/sym_stride_ops.h,sha256=TbQF438PGe3mtOcneq22EmGuGNuQjGjKeu0UblJ-zZI,1315 +torch/include/ATen/ops/t.h,sha256=fHM6_0q7BrjPFzx9Blu9k4l9ZTt4d2npWvfEIUj3D7U,913 +torch/include/ATen/ops/t_compositeexplicitautograd_dispatch.h,sha256=VUfRNJAdqiv2t_Z6YhqnEbNHsQEnKL7t9l0dIFb4unQ,1088 +torch/include/ATen/ops/t_copy.h,sha256=sIv39SbJYem4m0TaqQPbMfau8mWK3OqQtJ37p1AiX6I,1326 +torch/include/ATen/ops/t_copy_compositeexplicitautograd_dispatch.h,sha256=nwFHdgVy6C1C160W_rRTqK_gRv_syYrB59wQY1AVTBQ,1150 +torch/include/ATen/ops/t_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=dpuyCCTGl_-WCMHyoh2M4ZBPpRwJbjJDqOYQP-5GRWk,1072 +torch/include/ATen/ops/t_copy_native.h,sha256=obibjbpAbMbaJxs0SHeE5VJyZH98A15l1k9e1b67ND4,835 +torch/include/ATen/ops/t_copy_ops.h,sha256=ld7OX6-Gq5bGx3d0ErpX5AuHOA8zdP0Y8rr9eirs-3U,1846 +torch/include/ATen/ops/t_native.h,sha256=2m5BBPB5GkKrQBdUBYI7K48_mieKjaL00umgvJoUKyk,798 +torch/include/ATen/ops/t_ops.h,sha256=b67sC3NVoHoogPTQfr0SzWobVzqJ1nLcTHwdDH-UdgE,1731 +torch/include/ATen/ops/take.h,sha256=nMcWQy4pqksnjRaMoO9eB9f3EYUr36xvt-aC4E3BNvk,1447 +torch/include/ATen/ops/take_along_dim.h,sha256=CBJ-XaVjHG6TE2eLLiPU-5wiP9Yt-HP4QcI61qZPp8E,1745 +torch/include/ATen/ops/take_along_dim_compositeimplicitautograd_dispatch.h,sha256=62soWxC-Xg9IDBlIB9scqj3SRb2ids4fIowNRkrtiUU,1433 +torch/include/ATen/ops/take_along_dim_native.h,sha256=j1GYoZ0ZglOs51D4IAKg2HyOP0_WSNPtrbMuZHoW7bs,982 +torch/include/ATen/ops/take_along_dim_ops.h,sha256=F8tC8LJyCK2gafvImjX9yR7aDroARc5OKMRg7vcgp-M,2280 +torch/include/ATen/ops/take_cpu_dispatch.h,sha256=fLUsblhu2NO0Pnf19BE5G4oZus46-uVMJ5Jo5ZmJS2A,1233 +torch/include/ATen/ops/take_cuda_dispatch.h,sha256=JReqZOg7S4wxKaEka8gUFS5CXjGpTErJg4pVzlmjj5o,1235 +torch/include/ATen/ops/take_native.h,sha256=lI9xosI2fTiwixJ1a-HFeB5cKqwula_a3Vi5ZWLdQBo,883 +torch/include/ATen/ops/take_ops.h,sha256=lcbPKeDYviwnq--LRAL5-i4rascQHcCP9Cne7GkUCKE,2006 +torch/include/ATen/ops/tan.h,sha256=NYHgjvk5CQyJp7r8A0ODbvlGcdzB65HGXWVHJBCY6Y0,1434 +torch/include/ATen/ops/tan_compositeexplicitautogradnonfunctional_dispatch.h,sha256=EWK2ODJOt9SSVKN5w_MqWV-j7tdOwcwXwZktdGC4j_4,1118 +torch/include/ATen/ops/tan_cpu_dispatch.h,sha256=9y7S_7j-GKJWeqY5auGRcyubkH_PRrV8D8zgmOqj6Rw,1201 +torch/include/ATen/ops/tan_cuda_dispatch.h,sha256=05WYbjs7FpDtgnKm9IEZp3UKOCAPclBAN4twLF2IH4s,1203 +torch/include/ATen/ops/tan_meta.h,sha256=30C2NBWqHJDfnzeG8byC8JiuI706nEPPvR0BeE5LXsg,850 +torch/include/ATen/ops/tan_meta_dispatch.h,sha256=izGRW1KW0eEM7rHL_Ab021GvyjuvVYJu4d52D_ndzWw,1203 +torch/include/ATen/ops/tan_native.h,sha256=cWnJIM2hzwwwDdHo7qAowdyMOKRMjwsxk6fuLXSOglc,1277 +torch/include/ATen/ops/tan_ops.h,sha256=v2sTHy1sGXm933vWamh2EHL9iyUUl_ySGucBuEZ1nDU,2329 +torch/include/ATen/ops/tanh.h,sha256=FRabNlnCxJBw8gdMwtebKH1aKQaKZ3ONlzYvNaf4k_Q,1447 +torch/include/ATen/ops/tanh_backward.h,sha256=C2UFSkrfCGAAYxqDMK3Ema__IJaoK5APpOynkLA1oNM,1679 +torch/include/ATen/ops/tanh_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=jXhmKtTwkHky-6i93C28evEx2uPWXNq9Ec_EqguNX-s,1113 +torch/include/ATen/ops/tanh_backward_cpu_dispatch.h,sha256=jaOVNFSECgkW_huirXWBnLTjJfRkB6SJR8fW_uv3IGI,1298 +torch/include/ATen/ops/tanh_backward_cuda_dispatch.h,sha256=fcecac4Yrvxq9eQhMc2Wz6YeYAXfBP7BgD512O9uClg,1300 +torch/include/ATen/ops/tanh_backward_meta.h,sha256=2Pi8gmRDlYzGqbUYHAQYfRWVrrMKHrIvvLZpQo2e5D4,894 +torch/include/ATen/ops/tanh_backward_meta_dispatch.h,sha256=1-5TVsbUS38m6xnrtKRHJlQ7tQEFQktNmj_8zyzaEos,1300 +torch/include/ATen/ops/tanh_backward_native.h,sha256=d-WnW9VNtcIW3SQhH2pU1bJSjJla86Q3vW2eGmcQw0Y,940 +torch/include/ATen/ops/tanh_backward_ops.h,sha256=Bz9J0tGNogwneCQLbUrDl0zlABgQ2gqrZnGgi8JKZ1A,2150 +torch/include/ATen/ops/tanh_compositeexplicitautogradnonfunctional_dispatch.h,sha256=XqhN1mHpRPB_G70CC3Pnnv7IlbghNy9BXheTr2CCOV4,1120 +torch/include/ATen/ops/tanh_cpu_dispatch.h,sha256=zUk04v3_QvskYoSq1dLiKhT14chDUnEmPcoy9dv2f4I,1205 +torch/include/ATen/ops/tanh_cuda_dispatch.h,sha256=ovHbkKY0Hj4tKx-D769xlqu7ldioEV5qwjggdCDrnZA,1207 +torch/include/ATen/ops/tanh_meta.h,sha256=eNegHcWeHEP7POWtohK74_z3KcqS9jwdgrplgbP2tgI,851 +torch/include/ATen/ops/tanh_meta_dispatch.h,sha256=VkKXfjlBGJ85v_e9RDoaK0rZZwuvVSJcogwUE2WXNr4,1207 +torch/include/ATen/ops/tanh_native.h,sha256=yo6hnA63T7B5RDDdKsCEForx1YSqFiHuAEp2TMkGpE4,1599 +torch/include/ATen/ops/tanh_ops.h,sha256=a4HU8JkLHuO2rKIFs3ln65znI-i1_J-eI0twPzx1w_A,2338 +torch/include/ATen/ops/tensor.h,sha256=xNoZ28Eq2sOBtkS0qPZqwNeNjRuzckixkjwuj7vZflk,1920 +torch/include/ATen/ops/tensor_split.h,sha256=Dr_R09-I-NmJcBu2iRto6ty-CRhK98e68s0P_rX5Xqw,3540 +torch/include/ATen/ops/tensor_split_compositeimplicitautograd_dispatch.h,sha256=fDrI8QmNe32AbXp5Z9Y5FvhafmUC-yo837rzuj9l3Tw,1601 +torch/include/ATen/ops/tensor_split_native.h,sha256=itqrJ6RVGOPTX6UjdXzdPcdtJk-w57nGZ2zQQleInzM,1103 +torch/include/ATen/ops/tensor_split_ops.h,sha256=QY-ubOmaDhMkXyEic2puFpGif2HB0NiYOToUiO236uI,3082 +torch/include/ATen/ops/tensordot.h,sha256=sbarVMoUSe6uQknjKni_r6YRK7zyOGEaJRCihFunLU0,1836 +torch/include/ATen/ops/tensordot_compositeimplicitautograd_dispatch.h,sha256=1M0rTKrBO2oRzFo5ceATVKuXXziA3_uqclgKVvFKXjI,1457 +torch/include/ATen/ops/tensordot_native.h,sha256=7r_WC3OnwqlDKVD2GQRz2bVO-JvWh5cvMZUaLOIdD78,1003 +torch/include/ATen/ops/tensordot_ops.h,sha256=OGIZQ-wbGZYHcE08F9eoFctjeXkg-Vja-zJWNWwP5F8,2394 +torch/include/ATen/ops/thnn_conv2d.h,sha256=AcssSU4HWyWw1586l7ngi7IkXHVMB6j47OSaUChe4hc,6971 +torch/include/ATen/ops/thnn_conv2d_compositeimplicitautograd_dispatch.h,sha256=AxkzL8TdYoEppjz3qaD9QsZsfz_9shsAuMYxD09f0e4,2468 +torch/include/ATen/ops/thnn_conv2d_native.h,sha256=hPFhTopbrsPUtYz8FeFTD533ZhjJ-TATnWjZcCVqeHo,1146 +torch/include/ATen/ops/thnn_conv2d_ops.h,sha256=A1XTWleGZK48TM0g7Z1xsJC9V26arzr-x6qSKAq2LOE,2948 +torch/include/ATen/ops/threshold.h,sha256=8ntXM7_6x7yvL7cXJRLYMyoEKDpl3_ebNXgEZyfyTes,1936 +torch/include/ATen/ops/threshold_backward.h,sha256=5xtDaQjNyx3csyzL3HGZyZhNCqhnO0rmLM2eFGtQuaE,1888 +torch/include/ATen/ops/threshold_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=z57wZRj8Qu_XfzwvsyWQg8PrFlx4qrO_I0g4WtZxh2Y,1146 +torch/include/ATen/ops/threshold_backward_cpu_dispatch.h,sha256=eex45RMzldFDN9-h4mh6mzn88X6aUOH3oiDLr6pan7Y,1397 +torch/include/ATen/ops/threshold_backward_cuda_dispatch.h,sha256=BDVXaR4BbXFaH70A-1oOPuQTNIV4u3W7xNgzx9j76qs,1399 +torch/include/ATen/ops/threshold_backward_meta.h,sha256=W4vziP3nmrcSBjkdtidUtc9p9WJEH9oKKULXljOL5NQ,927 +torch/include/ATen/ops/threshold_backward_meta_dispatch.h,sha256=LUGWU54PpScF0Yi_xpv1FLWP4HzIijphSbcw-jMNiho,1399 +torch/include/ATen/ops/threshold_backward_native.h,sha256=mwm53X517jjoT2oBsL73LBK2sSJOrlVqKbtxNMUBGJQ,1879 +torch/include/ATen/ops/threshold_backward_ops.h,sha256=DoRI7PMGfpTI4DCrXDWUNwm49QuqHvJL3pkuoP-OtbM,2364 +torch/include/ATen/ops/threshold_compositeexplicitautogradnonfunctional_dispatch.h,sha256=cvlR9H_b1kMh3-xMtfaszSwo8lwMhhFMrnkf4O-rP8M,1242 +torch/include/ATen/ops/threshold_cpu_dispatch.h,sha256=Uhe5xW9sbZ9gA1lxGjnL88u5SRpeeXXWL3DxlJumaz0,1449 +torch/include/ATen/ops/threshold_cuda_dispatch.h,sha256=D4yebzlJRkCDEbMHBD973e516YKLYyZ-mV5UigvHGYQ,1451 +torch/include/ATen/ops/threshold_meta.h,sha256=XsK_d34dlrkWUaEqCiulZFQlb3wDOHMdwOLkmKYcRsk,912 +torch/include/ATen/ops/threshold_meta_dispatch.h,sha256=E6OYpwpxYllO7CvkXmnqVG1ezS-an2Pn_Muigz1TLGs,1451 +torch/include/ATen/ops/threshold_native.h,sha256=SRE9mYm9u3g4Pjs1b3TeW8um8U4rcKuMxxSCyUT_NR4,1071 +torch/include/ATen/ops/threshold_ops.h,sha256=bnSf80qCHnVDOzVqcMwGfqFLBKk4Gk1MxfbePPU147M,2935 +torch/include/ATen/ops/tile.h,sha256=0HegGUjtVXYobzCv5Aq5G_yozyzC9x2gt5T44QuH4to,1658 +torch/include/ATen/ops/tile_compositeimplicitautograd_dispatch.h,sha256=jojFiceqxz4A3Y0mf2xxbI6w-Ubh3IHfHGTYJDSHTlE,1152 +torch/include/ATen/ops/tile_native.h,sha256=WRPxUsFfEQvPaFbvxGHqXBhP-VX-u7eJ034TVdIClW0,787 +torch/include/ATen/ops/tile_ops.h,sha256=BgtH2nL63CRtBKAQGtGNdgZ7YtRGB50KfjLP-qcnE3g,1327 +torch/include/ATen/ops/to.h,sha256=UaEhpoHVUERdHMVq8x5a7wNY6mYctkZKz6qDkzvvWwA,785 +torch/include/ATen/ops/to_compositeimplicitautograd_dispatch.h,sha256=MFprP1iLOsX0ph6wOUESRVSpqlaIYEI79ArMMzD4FaM,2013 +torch/include/ATen/ops/to_dense.h,sha256=O5APAUj6cjQ_tD42wupS5Qs54zwU-fmYnTzBdqXx9_M,791 +torch/include/ATen/ops/to_dense_backward.h,sha256=EgTYTAC4MG1rabL7AjX9-7ixMp4Fp1hfmSXOPhnNR14,1105 +torch/include/ATen/ops/to_dense_backward_compositeimplicitautograd_dispatch.h,sha256=1CgX0TkT5eOOaJYuYP8DuFzfheem9Ck0oU6GeAops6I,1133 +torch/include/ATen/ops/to_dense_backward_native.h,sha256=NvdrVhDTleqeY3lKIhiUzH1ay8Sv8vWEtEWgYcbxbHc,843 +torch/include/ATen/ops/to_dense_backward_ops.h,sha256=Kb5CBCdFx-gN9F_2d2HklARJUbsd15UghE6dU6cGgQQ,1481 +torch/include/ATen/ops/to_dense_compositeimplicitautograd_dispatch.h,sha256=HQpnGfzy6_254j_co4zhzS52BMHADzHMpcu7YapZEtA,1152 +torch/include/ATen/ops/to_dense_native.h,sha256=gkOoP0aznz3WF4Zc5y8MaaKFvhBandBBmJM4g7WdIyM,862 +torch/include/ATen/ops/to_dense_ops.h,sha256=rcWhKXcTEedYEsgue3kz-T1Og9JswBVKKNWe4n9nUMc,1506 +torch/include/ATen/ops/to_mkldnn.h,sha256=A6NhYppg7V7--iu9agrVVA1izhTOvRsHQCnpOJc4UWo,1362 +torch/include/ATen/ops/to_mkldnn_backward.h,sha256=YIsnI91-7BwG2vFsrL83f8-36QAhU8tKeuUpO8fc-0o,1022 +torch/include/ATen/ops/to_mkldnn_backward_compositeimplicitautograd_dispatch.h,sha256=8Jw8w_rf5AYpLT18iUfhptTHtGtwGoeMx0vfeEGeZlU,1084 +torch/include/ATen/ops/to_mkldnn_backward_native.h,sha256=6jjqmnwOppb8eAjb-zOookGy1XLFI3DP1PinvhxGtcM,794 +torch/include/ATen/ops/to_mkldnn_backward_ops.h,sha256=Yq4jTbWOGFTSLo4YgP_-C3c48unLuxLeZDkuWkDtFh0,1367 +torch/include/ATen/ops/to_mkldnn_compositeexplicitautograd_dispatch.h,sha256=bx3HAw7M5p6xw--G1SA6FwfBn0LZRIuHyyUfERupWOs,1249 +torch/include/ATen/ops/to_mkldnn_cpu_dispatch.h,sha256=Ejmlkisw1vl6nJ91DqJQzDBitTKosW348DjQv3GRyd0,1059 +torch/include/ATen/ops/to_mkldnn_native.h,sha256=U-dkYsgZfZzP2cxJdtES1-DQwdCUTZ8pVFRSQ9kaqZA,940 +torch/include/ATen/ops/to_mkldnn_ops.h,sha256=Uuo-XKkNoW_HVwqt_x9U7jVDwmuvn1zbVhnalwk4WWM,2134 +torch/include/ATen/ops/to_native.h,sha256=Ng2nHmVpA50scMFzvpXz6vLF4KTY2SSrcwfkpAe6F3U,1575 +torch/include/ATen/ops/to_ops.h,sha256=MNORyl_jCWIn0Qpvbaw1gDzObJO5fO0o9NQMdFNNtEc,4773 +torch/include/ATen/ops/to_padded_tensor.h,sha256=fjsmQ5V-FEROFBM9HwvK0BQ4Gw2Yi4mVRhmlyJKnTU4,4690 +torch/include/ATen/ops/to_padded_tensor_compositeexplicitautograd_dispatch.h,sha256=F2eqZhl15ylJUB_-DO9O3mwJdbXiacILfiROrAIzFMs,1611 +torch/include/ATen/ops/to_padded_tensor_native.h,sha256=3nlYzGYyPRAFiX042j1C6vhe0eb2RP2_RdGakRHnWkA,1158 +torch/include/ATen/ops/to_padded_tensor_ops.h,sha256=JGrrpiMvGDlw9sChWnI3-iWlnLuuRH0vsZYBi4POV9w,2288 +torch/include/ATen/ops/to_sparse.h,sha256=fPskPNXr-VNrhIUmSWirKlmahLWQwl_mv2rrn61_Zwk,792 +torch/include/ATen/ops/to_sparse_bsc.h,sha256=VO0FCezLYOHSqKvsskKliDCfyEci582ae243OB8ci-k,796 +torch/include/ATen/ops/to_sparse_bsc_compositeimplicitautograd_dispatch.h,sha256=xUlE73pdrydBDR_WTz5tCx-tTwJcxLr7KfRXk4fnXbI,1131 +torch/include/ATen/ops/to_sparse_bsc_native.h,sha256=41u84xDgl3Z_03X6nGTPgg7QzX-m8C6hwMNV5Ks9RQ0,841 +torch/include/ATen/ops/to_sparse_bsc_ops.h,sha256=IjEDn54gGVrxeuvJigargTRghjsDVI4WuvVhUTSFMVo,1474 +torch/include/ATen/ops/to_sparse_bsr.h,sha256=jEeC9tBSekE7uCjDsWhmLfgxHcgjj64XlXfHSw1uAy8,796 +torch/include/ATen/ops/to_sparse_bsr_compositeimplicitautograd_dispatch.h,sha256=PM9ZHORd1D6wu66w_Bjdwqyutj4s8DPKgcHEQUxcZtg,1131 +torch/include/ATen/ops/to_sparse_bsr_native.h,sha256=5TLK-5FFs4BtEoC6zarkL6Rhfr9I00fAOpvY_bAoCwM,841 +torch/include/ATen/ops/to_sparse_bsr_ops.h,sha256=HEjPRViOiBvbUW5VE_iGJbm-lST6pzc978Ae3OrYriU,1474 +torch/include/ATen/ops/to_sparse_compositeimplicitautograd_dispatch.h,sha256=ceFiguAMTOR32NIaVEfLuMxAcXcKNR1lX1AsMJb8KsU,1279 +torch/include/ATen/ops/to_sparse_csc.h,sha256=iiH79aQz-WfsFT9vFyHb4PJ3kzLX8LnVrSxwMx8O91U,796 +torch/include/ATen/ops/to_sparse_csc_compositeimplicitautograd_dispatch.h,sha256=p8I0uK7aK8XarQWdVOIovAtbZ2xJ_WuYMwUm_2xD75I,1104 +torch/include/ATen/ops/to_sparse_csc_native.h,sha256=_bedbH0-DESjPLx4B6vt1fZzbytwgkK6WOtwonZkriU,814 +torch/include/ATen/ops/to_sparse_csc_ops.h,sha256=gtggE4rCnJmDL68Woy_Amz62EjoKXytnL7QvUoc5LZ4,1385 +torch/include/ATen/ops/to_sparse_csr.h,sha256=TRt-ZnBfFQVdDgW8vrcziv3sxybIE9vJRmlTExSqknc,796 +torch/include/ATen/ops/to_sparse_csr_compositeimplicitautograd_dispatch.h,sha256=oYothDGKLnw4E9dpB1Ejeti9SOCXQJv_gkb0z65viuA,1104 +torch/include/ATen/ops/to_sparse_csr_native.h,sha256=qYAd0PVgNwKqAs2KQR04PgzS4qXxGDNA8VDZ_NTwDpI,814 +torch/include/ATen/ops/to_sparse_csr_ops.h,sha256=2WROxCDs_AUlcKfA7Yhg5eNAGVTyvjrLsiVg1P0kvrw,1385 +torch/include/ATen/ops/to_sparse_native.h,sha256=fP533_y-rSc9u1-Ee93pzAdZmiBYSME0a50V3wuq_4k,989 +torch/include/ATen/ops/to_sparse_ops.h,sha256=0yupesbVhMi_cIQOLevspdE4Uk4k6THCz31WBMIu-go,2234 +torch/include/ATen/ops/topk.h,sha256=YXuiAX8z-Ve4z0WHJnQYlrBRXna8IoSu59K3GFMo0Uc,5474 +torch/include/ATen/ops/topk_compositeexplicitautogradnonfunctional_dispatch.h,sha256=z6ghWVZNHaDlIFZua-Z8ZYsDpAdYrmBGF9SSq3ZrRwk,1312 +torch/include/ATen/ops/topk_cpu_dispatch.h,sha256=FsPDqLezSlRg6yGMgS3YWPjc9Nf7DWkF_RNHNyRBYbs,2012 +torch/include/ATen/ops/topk_cuda_dispatch.h,sha256=5f9lL5JnP2PF39TfV4KFWZBUqObeOAIChmQ1hRQF5XE,2014 +torch/include/ATen/ops/topk_meta.h,sha256=6Wu_BnYaTFhCyEejq5cU-0JaJq4E21-OnAENHiAOE00,902 +torch/include/ATen/ops/topk_meta_dispatch.h,sha256=XRXtV81QojAwAartHF8N-aFIaheogXl7jt8J_1PJFHs,2014 +torch/include/ATen/ops/topk_native.h,sha256=fIYtSQ4CrGfZ74510H6RsNh3LhydjKurjJuDV049t5s,1341 +torch/include/ATen/ops/topk_ops.h,sha256=QoWKTANvqL_HGC_X_pgKwlYK5q_76kTXExRevrAuU4Q,2546 +torch/include/ATen/ops/trace.h,sha256=93FEuW0jQoxNH_wAdb3VAOEzayaJMW7IDJ_nWCuQp4U,1316 +torch/include/ATen/ops/trace_backward.h,sha256=bsnDpX45TutrEZ3DlPZJS0N_99pSDNGAKI9zhMEUph8,1778 +torch/include/ATen/ops/trace_backward_compositeimplicitautograd_dispatch.h,sha256=4o_iDU3wdhHR9F4Cgh92gqQ5Bmpo-Oe9efvkEk61PzU,1174 +torch/include/ATen/ops/trace_backward_native.h,sha256=oHIwNsJD0RigCh_95JwOCHjE9LNJTRSiyFUYfvrvf3c,798 +torch/include/ATen/ops/trace_backward_ops.h,sha256=h7idt92CGDRNixtQ7fp7qvsdgdTJxyoQFGRW3-wvLCQ,1360 +torch/include/ATen/ops/trace_compositeexplicitautograd_dispatch.h,sha256=ltmmSnwR_YcJ7jRNOYUHViFASzCtHMymNgRBZkqg504,1148 +torch/include/ATen/ops/trace_cpu_dispatch.h,sha256=cMJnfb1Kh6jiVoIdLmLOkxOCE-Uw3c2YSxPGNc0Sm2k,1001 +torch/include/ATen/ops/trace_cuda_dispatch.h,sha256=KMZnSjS3jBDfiQBsmCEbMDT0cEtosWEs2i4z1_L4sW4,1003 +torch/include/ATen/ops/trace_native.h,sha256=e1hto8ezGYXoZpLEphSvZ3j-xe7IzQhG0P2pdZ0zpBA,896 +torch/include/ATen/ops/trace_ops.h,sha256=lK-gCitGl3Ef8yDMcGBwsrgxAXOWChn6CEFDPx7Nuls,1840 +torch/include/ATen/ops/transpose.h,sha256=7OWEHFvndDlkDQGKBMFOQNk1AgbdxMy64a6tDbVBeeg,1260 +torch/include/ATen/ops/transpose_compositeexplicitautograd_dispatch.h,sha256=5mkD2UoQvIJ5_4jCgx5Nj2aLYYZwRDstFduRxXBdr2Y,1160 +torch/include/ATen/ops/transpose_compositeimplicitautograd_dispatch.h,sha256=h8ci1QvytISOL6I5hDpqdyIbTrgwObURmHJMvQRzkNU,1085 +torch/include/ATen/ops/transpose_copy.h,sha256=27lvkF938lkYjKisBT_bc70F2k7wvaqcwNLKEwRG_V8,1610 +torch/include/ATen/ops/transpose_copy_compositeexplicitautograd_dispatch.h,sha256=iURp3UsxsHyTdL7WoyjofkVtnjWhZgX0LBO7r6wigjc,1222 +torch/include/ATen/ops/transpose_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=MqUermhYzRY6toXbe3zA3xdeAHKKUQf5XjSCYk8zfdw,1108 +torch/include/ATen/ops/transpose_copy_native.h,sha256=TR9U0PV4orLNss1WCMIT34RS406KMtORGruZh5Ft8nA,915 +torch/include/ATen/ops/transpose_copy_ops.h,sha256=cEG_a24Kopo7VJvqxLH4SJSkLgCmMnV1-AG0Y4stsQs,2105 +torch/include/ATen/ops/transpose_native.h,sha256=XmDlnpOXa45U4FFUXPTKvqntvBC3fmbDAWs7s4Rs1uE,1057 +torch/include/ATen/ops/transpose_ops.h,sha256=QZSRRTEVB4WTE1aFCCvfps0i6lhBTsbEvS-bioGV6nM,2653 +torch/include/ATen/ops/trapezoid.h,sha256=0T7Rle-T6k45FkGtYCzpKb8eBKidI8b2nExcUH_ddjw,1229 +torch/include/ATen/ops/trapezoid_compositeimplicitautograd_dispatch.h,sha256=C8YtgeVKa0T3VDHraLQDi2lWuj8XVN3ZMKw2Ppi1Z8E,1180 +torch/include/ATen/ops/trapezoid_native.h,sha256=dUP6GhBPppRINiGk5vXjffsMEv0cmqb7aqn5jteKh7s,890 +torch/include/ATen/ops/trapezoid_ops.h,sha256=54DY5PSJxyIhLQ0VUDadqP7PwpBnD6SD2AFQHNsDePo,2022 +torch/include/ATen/ops/trapz.h,sha256=Nm1CHnB5GajYtEYEmT2NZG9njE0idfcnVUd79htw730,1188 +torch/include/ATen/ops/trapz_compositeimplicitautograd_dispatch.h,sha256=GJ1_MaUb1BYCGfB6HzP09exD87SA6X4Fa1ObfiUnzgc,1160 +torch/include/ATen/ops/trapz_native.h,sha256=zGuWCzy5DvCS-b7-LCbEW7xvpM9H3FFY3KAZZu9Vpmk,870 +torch/include/ATen/ops/trapz_ops.h,sha256=mVImPWJVfDyZzmC9zOctfbLNQqAqQ1QzNkSqxkxsyTQ,1961 +torch/include/ATen/ops/triangular_solve.h,sha256=VLmeUzilOMo-BrIjZoDOGm3V1X5GXvUZChNPQXAaKFs,2250 +torch/include/ATen/ops/triangular_solve_compositeexplicitautogradnonfunctional_dispatch.h,sha256=Pi32cBPfFngq8vbkmkdCRSHN17tUoO9zRs7epmYAUEo,1194 +torch/include/ATen/ops/triangular_solve_cpu_dispatch.h,sha256=JTWelbsk1R-ZJLXfgx_OJPUOnkD6IVJXAhRrrjCviCo,1542 +torch/include/ATen/ops/triangular_solve_cuda_dispatch.h,sha256=BJxTX7QmKipqi0KVZBIvTfOyVMd9Tbqq-YOpzDsgt2w,1544 +torch/include/ATen/ops/triangular_solve_meta.h,sha256=IapE2wBOVcbnjuXuZZzd6P7M3VA9SesNlTff3BBvw80,933 +torch/include/ATen/ops/triangular_solve_meta_dispatch.h,sha256=mnLHXNoOt_ubLLCIofprv8uyZr8NocOI0MqDEoJo7JA,1544 +torch/include/ATen/ops/triangular_solve_native.h,sha256=-VmpRrqilHkCd0wG4QTAERFg-rSXkiXf3zLQY5Ldfic,1429 +torch/include/ATen/ops/triangular_solve_ops.h,sha256=Nt3g9d3yGzUc0N3vWKvFgooTYbFftzAO-NRwlQzI7CM,2696 +torch/include/ATen/ops/tril.h,sha256=WectRSW8ZEIqZZDQfB1J4gBnnimiwfqEQFpWirHsle4,4124 +torch/include/ATen/ops/tril_compositeexplicitautogradnonfunctional_dispatch.h,sha256=QfNvljLQMWF1CGJDJQYq5eoydKX1_kj4FMHCoZs5r-Q,1325 +torch/include/ATen/ops/tril_cpu_dispatch.h,sha256=VDAjUnPs7RqCzpS3YZAdyo86AOmmrBC-xaOWgKn-1Ow,1663 +torch/include/ATen/ops/tril_cuda_dispatch.h,sha256=12mYMbNeWuvdzAB_Iag1rfdMQxEfT4AAz9iqixFOdNY,1665 +torch/include/ATen/ops/tril_indices.h,sha256=RZjS34MFx8tYYwgDuXRhcx4VqDXvOWC9zo-zy61tj64,2263 +torch/include/ATen/ops/tril_indices_compositeexplicitautograd_dispatch.h,sha256=q0UymP6vfYcG8iXSjUStcwLSRlTL3c8rEuagTc8xYf4,1198 +torch/include/ATen/ops/tril_indices_cpu_dispatch.h,sha256=1FuhhQlWLnEgEGqtZEgMS1wwyf25jPQD8AhMvg0kdSU,1287 +torch/include/ATen/ops/tril_indices_cuda_dispatch.h,sha256=j7bRYR6KMSuAnZg9XFthQOe-fCZLiTcUqqRoZuS3OkI,1289 +torch/include/ATen/ops/tril_indices_native.h,sha256=-UNHXh-oRkRzRXa9YPBRvgwS6aqr7OCBpksuVQceDGU,1286 +torch/include/ATen/ops/tril_indices_ops.h,sha256=LXZ3-LRn7s0-YCCcC0PU6gbQNqPOfYwkt_yzmslcYtY,2498 +torch/include/ATen/ops/tril_meta.h,sha256=OCD5cu1_UcsUfDmDhIagQXqCZ_5T0gkahyBQkdna6vQ,869 +torch/include/ATen/ops/tril_meta_dispatch.h,sha256=bhf8wwZJaW9VVI_nBE9cpPerAOxGHv8ORFKVE2YLwns,1665 +torch/include/ATen/ops/tril_native.h,sha256=vYosj67ZyfiAV1093miE3BoE_JMeet3porVeeGAwwXI,1049 +torch/include/ATen/ops/tril_ops.h,sha256=RzZ0UqOKdwj98d3Ph8YxfJ4xRZLqJAqJ-B0Yr9zDQao,2566 +torch/include/ATen/ops/triplet_margin_loss.h,sha256=XGE7qP2EHqZ1cF9BvSA38NMhwSN-Fp-P_5pCHAjxV1U,1318 +torch/include/ATen/ops/triplet_margin_loss_compositeimplicitautograd_dispatch.h,sha256=wWvofpPRvLkHQjcbcFetW3U07jw4D6GVVHw_ouyAvxA,1224 +torch/include/ATen/ops/triplet_margin_loss_native.h,sha256=_1Mr9XfSA4MI6zBvUF5FDpOtIlSksiI2PuvYPjHa2X4,934 +torch/include/ATen/ops/triplet_margin_loss_ops.h,sha256=AV5WN37S8CcTMrY1xuVQAb1E9hqK4Nm0b9pfEj40WgI,1736 +torch/include/ATen/ops/triu.h,sha256=gln5o7gP0onXLiTWoDMP0j3LlT-_nx7mHZALeh-sjYI,4124 +torch/include/ATen/ops/triu_compositeexplicitautogradnonfunctional_dispatch.h,sha256=45I2SlMNGFf1PFG1Xie0W1jYHO69rXbVEp1pN5fYWMI,1325 +torch/include/ATen/ops/triu_cpu_dispatch.h,sha256=v2lubzpWEQlnJpvHv4ql5U0Bh6pYUVYe8fp5ewKCJQs,1663 +torch/include/ATen/ops/triu_cuda_dispatch.h,sha256=A9-vwaW6br-zii8_7y6bVOrT8GS6bwhp8cE_k2OR-ug,1665 +torch/include/ATen/ops/triu_indices.h,sha256=2JkWNr-lADFVXV9J6yBG7hsK_Ngh5BnvONw2i3Lqjaw,2263 +torch/include/ATen/ops/triu_indices_compositeexplicitautograd_dispatch.h,sha256=HuChglwa98Ye5QSsQcAaCFwKt68F7yvNMICGW_AJeIA,1198 +torch/include/ATen/ops/triu_indices_cpu_dispatch.h,sha256=buS0rsYCpgwbGQ_DkheEL4tipf9I388ar9S6uzsl3_g,1287 +torch/include/ATen/ops/triu_indices_cuda_dispatch.h,sha256=uSbyw4NrfaPDoUCcC1vttb3AeP_o2VNOCg3N0xRw138,1289 +torch/include/ATen/ops/triu_indices_native.h,sha256=iaR_3Aflxsdngqm1FGGlMI6hZk0-PNd1M_WwqSVqAJA,1286 +torch/include/ATen/ops/triu_indices_ops.h,sha256=1dBTRMq4LydliGny7HrXM4_kRDcWRkA-M_Qw9Aih2FQ,2498 +torch/include/ATen/ops/triu_meta.h,sha256=7lBOrJyRT4VPA8JvqI11WbtylN6O9LgbfncwA2raCnw,869 +torch/include/ATen/ops/triu_meta_dispatch.h,sha256=7UIsugU2G0JWZphddrtQQDfJ1B-EawjScxxhkh1UYNM,1665 +torch/include/ATen/ops/triu_native.h,sha256=lDBVAv29ugJNR0nIv14ZoKGSrA6GFj3SGPKWw8fOwZc,1049 +torch/include/ATen/ops/triu_ops.h,sha256=KuU7t-YdpFw1wbSOIp6ebrdj1Cgy7r0MA7Tw8H9U9zc,2566 +torch/include/ATen/ops/true_divide.h,sha256=AExJdhvVzlU0s4014CoWxmbb5DWTOqLftt8tkZcZHRQ,1747 +torch/include/ATen/ops/true_divide_compositeimplicitautograd_dispatch.h,sha256=2Zy2RIm3cxIx1Z817ofrSCrwW841ZWO5Whd1zHPXoy0,1550 +torch/include/ATen/ops/true_divide_native.h,sha256=sERWeNoYBXaZRsP5nbUl2hrzHKn4FtGkNwzTgeWaNBU,1149 +torch/include/ATen/ops/true_divide_ops.h,sha256=gwfSw3e6bbpBLNYlKpSIxcomWClYnQZ1ihUTpP-yJZw,3962 +torch/include/ATen/ops/trunc.h,sha256=FyMuW-PyndalUrtK_09DFnVv8hxBp0ZA4157sHhAs0w,1460 +torch/include/ATen/ops/trunc_compositeexplicitautogradnonfunctional_dispatch.h,sha256=1NMycl9lyiO2PoQRdVeXLeUZs6i-tIXuHegwR-Iqzl8,1122 +torch/include/ATen/ops/trunc_cpu_dispatch.h,sha256=GQ9f2K1Z3FyGNous9xeEe1sky2h2UVbzuSKWhreFU2Y,1209 +torch/include/ATen/ops/trunc_cuda_dispatch.h,sha256=cGy26btXP3wZk1BVSxeMpBjKZp-JynkinmSbY5ANIR4,1211 +torch/include/ATen/ops/trunc_meta.h,sha256=5kkstgoFYVoKHxn0WfjZpHBSBTYet5AGyrtRyrTTKhU,852 +torch/include/ATen/ops/trunc_meta_dispatch.h,sha256=KfusB6IMfAMYMOb3l9xfFnVx4Ay5A6md6UOKeC5X9NA,1211 +torch/include/ATen/ops/trunc_native.h,sha256=c2UDOkBSXbbk3vfk4hpaTnBWOQJ9W5Rkyx5vc5cd4LE,1295 +torch/include/ATen/ops/trunc_ops.h,sha256=1Ov8ucJ5CchnRWC9uZ-ndNoqxLmpablYf1w02UCq9A8,2347 +torch/include/ATen/ops/type_as.h,sha256=eiwnwrytB0k-OSdTtE9ooiMwDVw1OGK4T0MY5DYdq04,790 +torch/include/ATen/ops/type_as_compositeimplicitautograd_dispatch.h,sha256=fq7LJv1q4tzT5_5M_h6YHzYJE8KKp-aa0kjSWjGTJEo,1073 +torch/include/ATen/ops/type_as_native.h,sha256=aahJqufBqRm7JdTZga7etzxFz3bC41C-glgmjTUn0G8,783 +torch/include/ATen/ops/type_as_ops.h,sha256=4XWeeRKYWPCyRsRl7NYBK3HYvxp_ZIU4Aj1ic9g_OYI,1334 +torch/include/ATen/ops/unbind.h,sha256=b2pIivBHZ9ACmvPViNslLWN5QQ1umxDtIvguompXQBU,1213 +torch/include/ATen/ops/unbind_compositeexplicitautograd_dispatch.h,sha256=5KwgCkZnRAC9Ep0QKnhJHLMejd8oQcgqT5u8Rrk-AKk,1076 +torch/include/ATen/ops/unbind_compositeimplicitautograd_dispatch.h,sha256=yXtNMEWr78Wt90lvAiIvcRxQ7bkstPYyeFh4IFN6azw,1078 +torch/include/ATen/ops/unbind_copy.h,sha256=bMqUlS_UNXStlLgsOI6_54JgG-HIjrxeAcYVSqD6tzo,1484 +torch/include/ATen/ops/unbind_copy_compositeexplicitautograd_dispatch.h,sha256=fHjgcw6UwKd0a7b2CBQKtgHAY_GkSHuK6oGL_X8gq4g,1176 +torch/include/ATen/ops/unbind_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=U_Te9wsvPj6itS47TiaqxAkvTQ_XiKxD9zhbxxX7njA,1107 +torch/include/ATen/ops/unbind_copy_native.h,sha256=flI6WF8qUb8nHbFQ8kyXD0rMPhFNwk_R_5IscJ6gEJM,890 +torch/include/ATen/ops/unbind_copy_ops.h,sha256=OmBIYg3oTiFts9Ikscy7w3AyMj4mCOIfH2TmiXfKKnI,2014 +torch/include/ATen/ops/unbind_native.h,sha256=7ibcVnbQBmMh_vwB7baoST_Ko8oOR6xtgD4b8OE7FnA,971 +torch/include/ATen/ops/unbind_ops.h,sha256=pCsJCyTh5_ASkGT5KVDEVRchGkW2SbAqFWx5v-LTz8E,2012 +torch/include/ATen/ops/unflatten.h,sha256=YSnx_iSZzu51UWsCkhG4QpwYkQrajrRO5IC0lt_FqOY,3110 +torch/include/ATen/ops/unflatten_compositeimplicitautograd_dispatch.h,sha256=NVGQKsst1KccoTfYMVD2m0FrVFE_bwO30yqe4cYRa6c,1443 +torch/include/ATen/ops/unflatten_dense_tensors.h,sha256=bcthYlr_4-f2yyFY5qr-8CvH3j3s1D3qlKp_ijsDSTI,1063 +torch/include/ATen/ops/unflatten_dense_tensors_compositeimplicitautograd_dispatch.h,sha256=nncIOAcCGxA8d6CLnkD2s19X1JbyS22kz5HFHV9yRdQ,1102 +torch/include/ATen/ops/unflatten_dense_tensors_native.h,sha256=6e1edZ_tiOPCv0Vv2ii63y_VAabDD4kR9iXRPp3jgTU,812 +torch/include/ATen/ops/unflatten_dense_tensors_ops.h,sha256=RMYjcjrz3MFsqF28VrrAXCTzaM1SFLHH9KLwZ8ia-R4,1425 +torch/include/ATen/ops/unflatten_native.h,sha256=w_kJUmAXEj3v-m0tGHJfp-JAJTNeBZP3IOkPMdRxmFk,946 +torch/include/ATen/ops/unflatten_ops.h,sha256=H8pwtucemhqO3h8HG1HfdlDxFYL4htZLMxTe7GIMNoM,2186 +torch/include/ATen/ops/unfold.h,sha256=UfHnCJNm0fMh5euiWNs0TtdP6iMhSNh4MI7fKxszvDE,789 +torch/include/ATen/ops/unfold_backward.h,sha256=1XIk_kxdeSv-boSumi-gTMItwHBWUXR-EZox2xUz44g,5291 +torch/include/ATen/ops/unfold_backward_compositeexplicitautograd_dispatch.h,sha256=n6BmVDJHutfLRWFiAy_-3uzaYofg59kctoTTj8eFv1Y,1659 +torch/include/ATen/ops/unfold_backward_cpu_dispatch.h,sha256=59iP2hVo7gmCqTpK9wskzPeDN8UPgvY-WPt1A7zoUP8,1232 +torch/include/ATen/ops/unfold_backward_cuda_dispatch.h,sha256=76u69wYdgeYDHYt1cNYDDuW1EeMz7-BNuC4FDHIgHjY,1234 +torch/include/ATen/ops/unfold_backward_native.h,sha256=ky3uuf1u5j2_lVqBnTFIRhuJ7a8fUZoQHxL6L5TLh5c,1010 +torch/include/ATen/ops/unfold_backward_ops.h,sha256=v5ilectCWi7UoNF7eLGz8n2niU4XAcz19TIn8bxiWGc,2412 +torch/include/ATen/ops/unfold_copy.h,sha256=asURY_izRUNpYsShVY1I9Q3tD-sWOld5ICJyL2fMUaQ,1691 +torch/include/ATen/ops/unfold_copy_compositeexplicitautograd_dispatch.h,sha256=WmRmtTKg-kvCLuR2bcKB6UC30XLEplkRgbHKS0k07xk,1254 +torch/include/ATen/ops/unfold_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=VmdsRxRlDUvXLkN9rHeShfvXd16jgBkdmU9-frLzS3o,1124 +torch/include/ATen/ops/unfold_copy_native.h,sha256=1KUtBYKnWsda8B_yHTCrN8mEWZImGrbRS1b6miQhiwE,939 +torch/include/ATen/ops/unfold_copy_ops.h,sha256=hV716QEejswhEQjJuZU1sg2CJk5ORWg7lDEhSH_uLVw,2188 +torch/include/ATen/ops/unfold_cpu_dispatch.h,sha256=UgmXGNuEgiURgdeHHBkeymRNi0orRRnkOWNULwL4Fpw,1049 +torch/include/ATen/ops/unfold_cuda_dispatch.h,sha256=fn5MnssvxqRsLhBapD3_rDBqsD2m1q8ixx4k3gwMblE,1051 +torch/include/ATen/ops/unfold_meta_dispatch.h,sha256=ByE0p_yPJAcLHgNjAMaVTtHELAqQb5BFA8kuXx6I8uE,1051 +torch/include/ATen/ops/unfold_native.h,sha256=NpYBhMQou7ZxYs52yRFAa9HRlBMFeWJN5jTkLxeb2Hc,803 +torch/include/ATen/ops/unfold_ops.h,sha256=c8eFxh5H2gUU6EOTlnfcj0ms1UiGww-0rCyZg1R_9As,1407 +torch/include/ATen/ops/uniform.h,sha256=kfj9Al4E_bzf2t4VLIfCS-uZrmdnsaLz85KrbbJGFIc,1797 +torch/include/ATen/ops/uniform_compositeexplicitautograd_dispatch.h,sha256=akAjeHlkau31D3Y1JpP_G1jqGzY49OPWXLwcV3jDfCw,1444 +torch/include/ATen/ops/uniform_cpu_dispatch.h,sha256=AVRHN5Q6nj4kmFM3g1ztT0dIVKkOsdQ49Fx65gY0syI,1085 +torch/include/ATen/ops/uniform_cuda_dispatch.h,sha256=_Jq5SdTkNwKzdxhEnGec1zC5eJXoXbAxZwep_5L2L94,1087 +torch/include/ATen/ops/uniform_meta_dispatch.h,sha256=wvxXHjqatyElk6pyZw59lULQCL5qtoyrGfVgiN994wQ,1087 +torch/include/ATen/ops/uniform_native.h,sha256=-lGGcUC7Ddf04ITCaiPUgNzTI8SZlcCZNPDM0_FbH30,1269 +torch/include/ATen/ops/uniform_ops.h,sha256=DWkJqFsjFUEaGiI6aNP2I45lp-yLULpBR7c4gmtnUYQ,3070 +torch/include/ATen/ops/unique_consecutive.h,sha256=x86J70MgVnUi2_Z53TKQr94RAYqP_um8615lbz_17uY,2385 +torch/include/ATen/ops/unique_consecutive_compositeexplicitautograd_dispatch.h,sha256=jTfjB8NzmBMaA_WpJo4v-RXQ3zn1q-Nckq5IS8_xTAg,1501 +torch/include/ATen/ops/unique_consecutive_cpu_dispatch.h,sha256=TBR-aWWDaC7uaFcUlwdkq0XoA_FhNuaB2mUZBwgKoEc,1148 +torch/include/ATen/ops/unique_consecutive_cuda_dispatch.h,sha256=EsfEC3Q0st6VmV2zmofhh1TjfsPu9j5tIOUftOy-aTE,1150 +torch/include/ATen/ops/unique_consecutive_native.h,sha256=VNEQDUL2AQkMWfYd559UkLv8GHupzQok5x3slEVjyQM,1353 +torch/include/ATen/ops/unique_consecutive_ops.h,sha256=CPU1WON17VSPzR_NpCOVKAsitnQbM-R35L5R4Ej4REk,2827 +torch/include/ATen/ops/unique_dim.h,sha256=8yG4TGbPgdRjNygZbw4qwc04YitDohWD6FW7fe-X5jw,2333 +torch/include/ATen/ops/unique_dim_compositeexplicitautograd_dispatch.h,sha256=ormWxMy8kASMP8yRaytqUqHczXTcrB23sLlD8NzeGCw,1467 +torch/include/ATen/ops/unique_dim_consecutive.h,sha256=YvmTrdTf03pO2eMh6HPEAPmAHc4LdR4H767lvZCNtNg,2326 +torch/include/ATen/ops/unique_dim_consecutive_compositeexplicitautograd_dispatch.h,sha256=GcP_udCR2ZsXtMBj0sojiPAC6pMP2-9KRN7zTQxFlpI,1460 +torch/include/ATen/ops/unique_dim_consecutive_cpu_dispatch.h,sha256=wclgVBSg-F96bA9pv1p0LKRXGUjPpadKluMH_Gp_HZg,1120 +torch/include/ATen/ops/unique_dim_consecutive_cuda_dispatch.h,sha256=GbnulEKd6F-8_kaU_4kNbDagnd_DcOne1mYKeqAjAVs,1122 +torch/include/ATen/ops/unique_dim_consecutive_native.h,sha256=nsi7wsGdsj-Lif6ILzDr3JFy2r_jzs0h9Ijdh-c165A,1284 +torch/include/ATen/ops/unique_dim_consecutive_ops.h,sha256=s0co1TLFygx90B8ss_09liQT1M-_LBlWQg19Iw-Va4Q,2737 +torch/include/ATen/ops/unique_dim_cpu_dispatch.h,sha256=OfrzM1LyIGwCSfko5_pZFUa2Ip49-fp6YBcZ6NccNbo,1126 +torch/include/ATen/ops/unique_dim_cuda_dispatch.h,sha256=fhbZE8iluS7I_Hi_WundgK2lUJVuN5SJpTAjKB60wCQ,1128 +torch/include/ATen/ops/unique_dim_native.h,sha256=KgZha1CUTi5DT2KegSMIE_PEKIMnz9bFKT3NAORbx3s,1297 +torch/include/ATen/ops/unique_dim_ops.h,sha256=r2CtJSd1fVPtl6MjZ5SrRHmN8Bga4QIBnCET8Nuw_w0,2765 +torch/include/ATen/ops/unsafe_chunk.h,sha256=_mVd1WKfX-Cf17Q-v7ZE6gUyxlOmAIArBW_8ts4HzkY,1035 +torch/include/ATen/ops/unsafe_chunk_compositeimplicitautograd_dispatch.h,sha256=t5iRvKEXL6rtDcSr9oDUcwLHlZ0AJEROqn6lrSlLZig,1098 +torch/include/ATen/ops/unsafe_chunk_native.h,sha256=jNpYNEqaJGKcXcrg79AEk66pEQ7oQTfEeC8VeIQjBys,808 +torch/include/ATen/ops/unsafe_chunk_ops.h,sha256=btr6l_4QdxFGbuaEHfftJ4eaCowE5mswmyF5jyVTkaY,1409 +torch/include/ATen/ops/unsafe_split.h,sha256=7MzjIM8JCl0b8IG-yy7VmkqC0YROrQMLx5NG-mKHOeY,4360 +torch/include/ATen/ops/unsafe_split_compositeexplicitautograd_dispatch.h,sha256=52PwJrDpMXWjR2x75encbgTIPayTsYhVebxE72u4oNY,1700 +torch/include/ATen/ops/unsafe_split_native.h,sha256=8S25cjB-WHhGoEMuoXXX8RCNMNnHRyTUg-QHmtvNLe4,942 +torch/include/ATen/ops/unsafe_split_ops.h,sha256=_WyrpI5Vn86cpP1anMdCbaYN5exl9howog8RqTs9zz4,2198 +torch/include/ATen/ops/unsafe_split_with_sizes.h,sha256=WJlGCVdYa2yN--XurM-fTEEVdUZGqRCKMEc-y7CjrXo,4869 +torch/include/ATen/ops/unsafe_split_with_sizes_compositeexplicitautograd_dispatch.h,sha256=WMlvGSu9bYihUD-t2TpFh6iESrVRhvmVkEO-h5A4_vA,1820 +torch/include/ATen/ops/unsafe_split_with_sizes_native.h,sha256=T3bdm78-aYgtmJskQjIgVyUa5YkTna99vLN8GK6YGYQ,975 +torch/include/ATen/ops/unsafe_split_with_sizes_ops.h,sha256=HM8YrrIycxAL6PnzrMOYI-vmg696Kuik2TKU2ZY-J8Y,2281 +torch/include/ATen/ops/unsqueeze.h,sha256=4NAfHmSNvsa-F1k--MFjYzlahhKguqHDPPTN_YU77SQ,972 +torch/include/ATen/ops/unsqueeze_compositeexplicitautograd_dispatch.h,sha256=5bTgMVKT9pGn3CVdV0keWskh4WRuBDbVNKZzihS4AA0,1130 +torch/include/ATen/ops/unsqueeze_copy.h,sha256=Ag--sGyLReS8f-1ePzlhO5S7h2HBvrCpuwfmqB8lbj0,1487 +torch/include/ATen/ops/unsqueeze_copy_compositeexplicitautograd_dispatch.h,sha256=RIKg_4TkzP8A-nwMYcJzPRsDAQ9vnRQYx3LVP1RkGlo,1192 +torch/include/ATen/ops/unsqueeze_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=rVm2ZQzVk19kfUEoSp5YcM4EVRtdUQe3CogbzDGczuE,1093 +torch/include/ATen/ops/unsqueeze_copy_native.h,sha256=uWXZKWgZWIkw1DGU73jx4w9FS5pUQhC3Sf3CJC2D9H0,877 +torch/include/ATen/ops/unsqueeze_copy_ops.h,sha256=2A8nzkWtsBvH2j3GWqVA6CdC2htmeEgRtvutqlFiznQ,1982 +torch/include/ATen/ops/unsqueeze_native.h,sha256=CVp9UFGulmgOM1Eoo1QPfxRf3kMntIM9Dr7iqtvLXgY,1077 +torch/include/ATen/ops/unsqueeze_ops.h,sha256=EJrnA10UTd2N-J-YWrZlVP7anis0AYZevZyuldoEpsU,1867 +torch/include/ATen/ops/upsample_bicubic2d.h,sha256=qf8t-1JJW0AYTiZvKwWKBnqrwMUHYeL-Z88nN3lJbQU,8311 +torch/include/ATen/ops/upsample_bicubic2d_backward.h,sha256=gQrglQCdDrgDLonky4gMzcBikkGpXUXS-EPNDKLTZNQ,8035 +torch/include/ATen/ops/upsample_bicubic2d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=DLN91bG62VQ5WJ8cxMEQ2M2DpJ4qex0JgjZP1WCbCrk,1548 +torch/include/ATen/ops/upsample_bicubic2d_backward_cpu_dispatch.h,sha256=BoD2Yd88_OEIKuHqnQx8-ntpwHFi9VRQmub8a773gYY,2606 +torch/include/ATen/ops/upsample_bicubic2d_backward_cuda_dispatch.h,sha256=9WuST7Yvm_-PZlr8xhS0RSLGoWqnGkBs95Kh7ATwKbw,2608 +torch/include/ATen/ops/upsample_bicubic2d_backward_meta.h,sha256=0PAzoBSt6bfBeQ7curpWDJx1LkuznF3ut0H1U8vbWqI,1038 +torch/include/ATen/ops/upsample_bicubic2d_backward_meta_dispatch.h,sha256=Cc37JsRdYCuzWOI-7hmyuvbZO0tYN9WvSWq5krsWXRQ,2608 +torch/include/ATen/ops/upsample_bicubic2d_backward_native.h,sha256=3ioV-R7qruGKiivub-UcLMwivD38HbGyUMvO7Q0h40M,1478 +torch/include/ATen/ops/upsample_bicubic2d_backward_ops.h,sha256=X-LkxH71xfUGIfWtugbrTj9l9GTWm4RkfqgCtCiYNi8,3082 +torch/include/ATen/ops/upsample_bicubic2d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=onrYAVH3BTiW7g3SR3HMIiwRWXaqYUiFcTYltNjQDZU,1456 +torch/include/ATen/ops/upsample_bicubic2d_compositeimplicitautograd_dispatch.h,sha256=0Wjsi3t66XSN9mVrcQ6K6Eyg2aDbw0Y6u0KyqZh1Oqk,1357 +torch/include/ATen/ops/upsample_bicubic2d_cpu_dispatch.h,sha256=qQ7EQvZXzitMWh2lZm-iTnJKB_rz0A7wgeOd1ozmhsA,2302 +torch/include/ATen/ops/upsample_bicubic2d_cuda_dispatch.h,sha256=6rbnoxPiAIXjefWX3d30Nd-vpn_N4xApeXna2-9Zdbc,2304 +torch/include/ATen/ops/upsample_bicubic2d_meta.h,sha256=B9hLJ3kYD8ZSu2zrGICRZsX4BVztCij6Waz0AEvIfG8,988 +torch/include/ATen/ops/upsample_bicubic2d_meta_dispatch.h,sha256=p9w5rM3SIfWhI5dwhYwD2bs6rdksmr7ni2RvqriTmzg,2304 +torch/include/ATen/ops/upsample_bicubic2d_native.h,sha256=DxZtAr0YyphSuoWAlMgvq5EMdPxkJHOCBYd7bKQHRgg,1515 +torch/include/ATen/ops/upsample_bicubic2d_ops.h,sha256=8ePLO8djKQvjwYLPsmZlBOHyNbGGN_XBX3UoOoD6gG0,3657 +torch/include/ATen/ops/upsample_bilinear2d.h,sha256=w9z49fSqMf1G6XbPH7rmxLG7LpmcJK9yifVCB_dqIeA,12310 +torch/include/ATen/ops/upsample_bilinear2d_backward.h,sha256=gb_Jy-l1p0_YdiMhoxLXYauC1fHWQx10ntqpOFf29Wo,8066 +torch/include/ATen/ops/upsample_bilinear2d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=2SUUwg3DQDOQE2ff5r5yppJ_CN_icGIbzB_2LoQhEds,1550 +torch/include/ATen/ops/upsample_bilinear2d_backward_cpu_dispatch.h,sha256=TUTc7yHQhfOjRO1Fjf3qAh5vq6_KW9A1dkfJhmPyhPM,2612 +torch/include/ATen/ops/upsample_bilinear2d_backward_cuda_dispatch.h,sha256=qgGzL4mtPjOKUnPOh-k6McfplQ8JyN0feHUaFJ5xq6U,2614 +torch/include/ATen/ops/upsample_bilinear2d_backward_meta.h,sha256=9IhVSGtMOR6pKeGzyweRZA-GycD_M1v1413Vfq5mdmA,1039 +torch/include/ATen/ops/upsample_bilinear2d_backward_meta_dispatch.h,sha256=lJiPtmTfBCOZ4VZ3tZY9JvdBicnt6d0I0hKeRTP4EoM,2614 +torch/include/ATen/ops/upsample_bilinear2d_backward_native.h,sha256=wfvnVTYwddIyfOHr4QjED-S8dT45zt9QoaCWdfIHnOY,1483 +torch/include/ATen/ops/upsample_bilinear2d_backward_ops.h,sha256=U6-j-hRnbfn0_lcOv8sRnM3hXYDMTpLWiBZrQMKN8yM,3088 +torch/include/ATen/ops/upsample_bilinear2d_compositeexplicitautograd_dispatch.h,sha256=_-b5tHU3xZZYvXkJTBUHvznQVfOdW46Wa5kErL3JVhY,1825 +torch/include/ATen/ops/upsample_bilinear2d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=WB6tEve59OFIpB0aevrb9VjR0VvgTSEVoCIxWrXBZAA,1458 +torch/include/ATen/ops/upsample_bilinear2d_compositeimplicitautograd_dispatch.h,sha256=PYGGU3SRtkIxYwPfZIKKrqDAz82arMskkl8l32CzKkY,1359 +torch/include/ATen/ops/upsample_bilinear2d_cpu_dispatch.h,sha256=t6U03LigYJRB2iIeLXVA4Vvl__pTlvCc1LO_EXffomM,2308 +torch/include/ATen/ops/upsample_bilinear2d_cuda_dispatch.h,sha256=_-mLargGr8R6kn4qqW-epexxj-dbuX78wNEetGk7umk,2310 +torch/include/ATen/ops/upsample_bilinear2d_meta.h,sha256=j7IWKgMgnFRptKBtrEjWflmCOxnk9_hBddcAaxPBCQo,989 +torch/include/ATen/ops/upsample_bilinear2d_meta_dispatch.h,sha256=3R5RmdCfdTl4M96ibo9KQXT7Ku0jEwbrga98b7xf4Hc,2310 +torch/include/ATen/ops/upsample_bilinear2d_native.h,sha256=gaOiK1NJ8czAoQZWF75Rk4A82a2IcNsC4TY4oXjpGoc,1967 +torch/include/ATen/ops/upsample_bilinear2d_ops.h,sha256=V4QPCOo30FC7nBK32_rYHmJvx0aexBCUXFX34GJjj6U,4687 +torch/include/ATen/ops/upsample_linear1d.h,sha256=1tbFmGmFK51KNwZTUX0W-FjPcZxTVdWTwyPeqpXTx6g,7430 +torch/include/ATen/ops/upsample_linear1d_backward.h,sha256=_MuOlzUJkqF1a-wADVJ6LIXhBtCsGUpF0i9aEujLAQo,7164 +torch/include/ATen/ops/upsample_linear1d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=GE8nVkhYx0dCxDe3Rb58uOVNt4iEEnmbBX43dz0WCnc,1444 +torch/include/ATen/ops/upsample_linear1d_backward_cpu_dispatch.h,sha256=ma-DCIImjUmRJv1wnBnOemDqQWitjmxsy-47K_dHge4,2324 +torch/include/ATen/ops/upsample_linear1d_backward_cuda_dispatch.h,sha256=jbqLKPzTzSVDYDezqgMXJO8uwCX0-_qAzx9ExdnNQr0,2326 +torch/include/ATen/ops/upsample_linear1d_backward_meta.h,sha256=y4rdg8f54prLB3zvxzWH5y7krNJQ4MFec1ulrm5qYJU,1001 +torch/include/ATen/ops/upsample_linear1d_backward_meta_dispatch.h,sha256=BDiBfb5YX9PxzFACif9mAZMQ6Z12-zYS5_AHeJSe6Bk,2326 +torch/include/ATen/ops/upsample_linear1d_backward_native.h,sha256=y02F8QLC8VpKREdhD8wWnlORAHvYmtqKubuvztQxwN8,1401 +torch/include/ATen/ops/upsample_linear1d_backward_ops.h,sha256=ZLclU19eus74hu13td2N6h3995L4k5AlhfyGqa5Ijc0,2834 +torch/include/ATen/ops/upsample_linear1d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=I1zGIY9LFRaDaNDtJ43JR8B8SDmqNqhOISAnZJVESWA,1352 +torch/include/ATen/ops/upsample_linear1d_compositeimplicitautograd_dispatch.h,sha256=G0IQoxABlD-JC_rFqyuWbn5SlycTFVU8oEdxX9WrqHE,1355 +torch/include/ATen/ops/upsample_linear1d_cpu_dispatch.h,sha256=3jFFb6jvmRFEXMsWtraKXRdC7tWjLRaGY14-1-GO4ig,2020 +torch/include/ATen/ops/upsample_linear1d_cuda_dispatch.h,sha256=l6YZeGSJ523VyChNkpOKLDcJj2Xz3HbalZTp1ViB7y4,2022 +torch/include/ATen/ops/upsample_linear1d_meta.h,sha256=HXM-RCK5Ce3kSwEvtksGAqbLvRsPLSlYzFss0FHC0Fk,951 +torch/include/ATen/ops/upsample_linear1d_meta_dispatch.h,sha256=9axgzczKhwmbzw8doITWLeWY9GQy0hKIIThh5dMUqD0,2022 +torch/include/ATen/ops/upsample_linear1d_native.h,sha256=XGwo9C0spywVYt1ckm5XFZNHyARGbhftRJn0JY0RlQc,1437 +torch/include/ATen/ops/upsample_linear1d_ops.h,sha256=Z_m6EN4kEkzj925FFmTnfjzRyqhOeVEem_kzvyzVvJs,3406 +torch/include/ATen/ops/upsample_nearest1d.h,sha256=Z6Gt4A0kbpsDLXoS2q9thGaW3Fy09ye26uk6N3kkH4Y,6751 +torch/include/ATen/ops/upsample_nearest1d_backward.h,sha256=Fp_JRkYdVol-SAREaQsCt3My_kWdqMnvlI7bjvcxjSw,6655 +torch/include/ATen/ops/upsample_nearest1d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=-HUTmjkA4ysT0T4mxa5aoAzUzFN8dpDSvyGbwfAJR5o,1406 +torch/include/ATen/ops/upsample_nearest1d_backward_cpu_dispatch.h,sha256=zvrGALT3WAxIA6S5Q95rnufVqN4Gt4I4E4zuhEn0PSg,2210 +torch/include/ATen/ops/upsample_nearest1d_backward_cuda_dispatch.h,sha256=FNm-GIoTuacvaYJ2vdJvTR_ht3RBh83Vcc79_v5XCRg,2212 +torch/include/ATen/ops/upsample_nearest1d_backward_meta.h,sha256=GH-_oPg20b_qVc-Xd-kXzxjxJE9V3lVeE0p2YHMtMSE,982 +torch/include/ATen/ops/upsample_nearest1d_backward_meta_dispatch.h,sha256=feOLXo9jl311mFUO4KKEWckZ318mk_z81fFs-XCYW00,2212 +torch/include/ATen/ops/upsample_nearest1d_backward_native.h,sha256=fMyZ9YZTYXxIq-oSstOg6orboyc8WCru4wAeXEa_1_Y,1366 +torch/include/ATen/ops/upsample_nearest1d_backward_ops.h,sha256=3dzg6YUc_g-10yMr2jhaXLtnyy5SOcsQT2E1mlN2Se0,2708 +torch/include/ATen/ops/upsample_nearest1d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=ZZwQDHckyywGV_CdjTfPlDyxG6WYGk5w2lXkYrcv6xc,1314 +torch/include/ATen/ops/upsample_nearest1d_compositeimplicitautograd_dispatch.h,sha256=xzrGF6pvklRlMsXoyn4G2XjQzeY2iwHUdnAP3jcko98,1317 +torch/include/ATen/ops/upsample_nearest1d_cpu_dispatch.h,sha256=td0gAmLu6I-UgSxEtgQwOJU0Dr1JiZEaECEo4HEFW6g,1906 +torch/include/ATen/ops/upsample_nearest1d_cuda_dispatch.h,sha256=jbQsVYI1z83k8wbvEdblxll04QLta5zV4kxI2zYfrt8,1908 +torch/include/ATen/ops/upsample_nearest1d_meta.h,sha256=WwE0fBIeMlMn15kMAbaeOm1sTrjf03qyVRohNyksYLE,932 +torch/include/ATen/ops/upsample_nearest1d_meta_dispatch.h,sha256=TpTHxoyM5YZ9E6lf5BVmgJkpb_y6Vc2rIjFYz9-Vyls,1908 +torch/include/ATen/ops/upsample_nearest1d_native.h,sha256=rTve-PHmcZbCgEjKjWX9gtSdBY5cFh5VDDu7re0SkfU,1383 +torch/include/ATen/ops/upsample_nearest1d_ops.h,sha256=AkSANa60dlhQCHbEvamtEWdn9jnDjVPB6gTvz3kkoyU,3217 +torch/include/ATen/ops/upsample_nearest2d.h,sha256=um353rCZle8vuC2S3U5GHsJFhgiPaW7z_nfpjeT2r8c,11169 +torch/include/ATen/ops/upsample_nearest2d_backward.h,sha256=lq5kfWGDDOvAMgwwrLzLn0Ste85qaJxZ2Bbwd5L3OmI,7495 +torch/include/ATen/ops/upsample_nearest2d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=PVxsEtQnuLifuZI6eP2gTrM3ZcGwqqf2Jz9WTm_4mew,1508 +torch/include/ATen/ops/upsample_nearest2d_backward_cpu_dispatch.h,sha256=6UgAmWrjXUucE1mgGaQuMK1LeBi5fp49iexa_woQHp4,2486 +torch/include/ATen/ops/upsample_nearest2d_backward_cuda_dispatch.h,sha256=Qy_hu8gpNkL2vV48mvL53nPDebncLKGA1ZbIuYEg9Yo,2488 +torch/include/ATen/ops/upsample_nearest2d_backward_meta.h,sha256=ForZTdShLmBJE62V7sA7QSsIheBa3dz3CaFguwkQGQQ,1018 +torch/include/ATen/ops/upsample_nearest2d_backward_meta_dispatch.h,sha256=xiwC5OJPGF8SPMLi7nMaA9kEfeZA4aGqpU7NaAessCc,2488 +torch/include/ATen/ops/upsample_nearest2d_backward_native.h,sha256=BjAAvuNrwOCebjbHcWYxLLbmgWRKqcNs-IJOSfBbk5U,1438 +torch/include/ATen/ops/upsample_nearest2d_backward_ops.h,sha256=EXy9_-aaDPI2rPs8lZFbKh-oSq_NDI6VzMZ96AZEAZY,2950 +torch/include/ATen/ops/upsample_nearest2d_compositeexplicitautograd_dispatch.h,sha256=FbX1h3ZtvL_BMqR5mVI5FZ7peHWrpNRkeruzcwB3QL0,1741 +torch/include/ATen/ops/upsample_nearest2d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=4zEt1JeyzgrvUQZpCYzZ5HYa_TQz2asOafEx3fMDb7A,1416 +torch/include/ATen/ops/upsample_nearest2d_compositeimplicitautograd_dispatch.h,sha256=wROWS-xs1TMZYwp94NSI1vX8uC6Ql04j0rtxEeNZWjY,1317 +torch/include/ATen/ops/upsample_nearest2d_cpu_dispatch.h,sha256=vW4thB6wjU31chH4dA5BwP3QRdtTvJE0IvdaO2eQmxk,2182 +torch/include/ATen/ops/upsample_nearest2d_cuda_dispatch.h,sha256=xfxYo4DkVWwZmdmFgXnlnYukleaXVtyxRrNjDjgy6mk,2184 +torch/include/ATen/ops/upsample_nearest2d_meta.h,sha256=qxf-P6H4UHKIF8hnNZskSohzFAETbCz4o6J2gy8hWxI,968 +torch/include/ATen/ops/upsample_nearest2d_meta_dispatch.h,sha256=oKayelAm51tO8vyHe7lWQg6UoMklbp190mTXgvQis64,2184 +torch/include/ATen/ops/upsample_nearest2d_native.h,sha256=DRADr_nih-RUNA8VuJllnQ31KPozZyUkGCh5o_RQIvk,1859 +torch/include/ATen/ops/upsample_nearest2d_ops.h,sha256=G3yuCkKxus_fWbmrpyNexDJmZObmAx5ZGoIAdxhPSBw,4411 +torch/include/ATen/ops/upsample_nearest3d.h,sha256=nol2oiJT1BDUomla5tySCq8VdzIKsFpqTK1_zS7VLZ0,8371 +torch/include/ATen/ops/upsample_nearest3d_backward.h,sha256=a30viQZ_Ws4b4L0N6lIqRAqxAmDJqW-3GNx2eU3hhWE,8275 +torch/include/ATen/ops/upsample_nearest3d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=6ead-gjoWh1UfHMrr8P3GWBwBGUGvYsydZiw-ReGKeg,1606 +torch/include/ATen/ops/upsample_nearest3d_backward_cpu_dispatch.h,sha256=YyaFwE97l_iky8DLLudwB_nCb5Nl37RWwUteXrErZ2U,2750 +torch/include/ATen/ops/upsample_nearest3d_backward_cuda_dispatch.h,sha256=_iTkHSt8-M0AJGWAofyZNduJjI63YGCXepUObB5AXwQ,2752 +torch/include/ATen/ops/upsample_nearest3d_backward_meta.h,sha256=3-HJHiVy3Zu1d0RGgomaOFqYOFI2XZrSEwve7a7Txq4,1052 +torch/include/ATen/ops/upsample_nearest3d_backward_meta_dispatch.h,sha256=JVNk2QBYEJQKTrncB8W8UogiRxauE36uR8bX-LeTY6s,2752 +torch/include/ATen/ops/upsample_nearest3d_backward_native.h,sha256=S0pocFCG6FRxNJAvvIZ4wAy0VfGlcg7Z4zdMvDI3x9E,1506 +torch/include/ATen/ops/upsample_nearest3d_backward_ops.h,sha256=h6NTJAoTe4c_Pbk9QUDZl12nsCrXlB1iUqxykoAh_iE,3180 +torch/include/ATen/ops/upsample_nearest3d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=q4O-f2e21u88Ff2RKrCJWPS7ma4D5sBx8VxSRQgNpyU,1514 +torch/include/ATen/ops/upsample_nearest3d_compositeimplicitautograd_dispatch.h,sha256=HeCxJbgkehmNHTNQFmqMYN0SiFwkofp3CwbnzfuWr7w,1317 +torch/include/ATen/ops/upsample_nearest3d_cpu_dispatch.h,sha256=Q11uX_o_2SOfbiCUCQ8SNyqBVEOfUYSl9IDWOgxYQKY,2446 +torch/include/ATen/ops/upsample_nearest3d_cuda_dispatch.h,sha256=rbyWI4YeuVHVNG_9gGEU5x-xIQh2eHOe1h-EUsCZPWU,2448 +torch/include/ATen/ops/upsample_nearest3d_meta.h,sha256=G5mA1pI4evlvRoEZzj1yvXUxT7gisNDk7UVZoW7uffo,1002 +torch/include/ATen/ops/upsample_nearest3d_meta_dispatch.h,sha256=U4uute41BOKgFxa4fMwMmueUSS0JuFipp-dIHyHme0c,2448 +torch/include/ATen/ops/upsample_nearest3d_native.h,sha256=4xSV1yvc6XUq70YCjFLA_gxVF5IoMoM7LyRvuTpHzAg,1780 +torch/include/ATen/ops/upsample_nearest3d_ops.h,sha256=K2OMiE24KcwVTa9_fsJeqPqq2SfYfCBJc5xJBc_Qhrk,3689 +torch/include/ATen/ops/upsample_trilinear3d.h,sha256=X0Y6UnwxXJm2EuPbiDn7U9Pk48Ctm_KccRrLAHFQmX4,9173 +torch/include/ATen/ops/upsample_trilinear3d_backward.h,sha256=DBQon5MLJRhsZnV5qs3AqDHii9JYUN6osHdPizeUR5M,8877 +torch/include/ATen/ops/upsample_trilinear3d_backward_compositeexplicitautogradnonfunctional_dispatch.h,sha256=DBpojUDTRE2lyo354s0MZWXa3IJoCN91ZapU2edVzJc,1650 +torch/include/ATen/ops/upsample_trilinear3d_backward_cpu_dispatch.h,sha256=N4d2fMSYi5ygwTTcuLHcQPgo3NOIs-zqRau6oc0rMzg,2882 +torch/include/ATen/ops/upsample_trilinear3d_backward_cuda_dispatch.h,sha256=Qj51E61spAJ7j1sYZ638VypNmkaVfQJbZJZuSMNJzu0,2884 +torch/include/ATen/ops/upsample_trilinear3d_backward_meta.h,sha256=VrcrA7vkLQxHT41ocJ9CljRALgxHAwZ-OWV8ma7w8Vk,1074 +torch/include/ATen/ops/upsample_trilinear3d_backward_meta_dispatch.h,sha256=_FZmaCGdjeTQ9YRhu0FQFdfJN-xYJdtUqDz-ObyG8cg,2884 +torch/include/ATen/ops/upsample_trilinear3d_backward_native.h,sha256=_NhlD99qsC6bSJ4maNiCxB-IlXHO-822EDB1BfUyug4,1556 +torch/include/ATen/ops/upsample_trilinear3d_backward_ops.h,sha256=rBOkG9SuuaynyFXQ4zV63_davlbs6aFOYlGFE-6Tibs,3324 +torch/include/ATen/ops/upsample_trilinear3d_compositeexplicitautogradnonfunctional_dispatch.h,sha256=38UCS7rAycWusutT_fDrxtIqGlJmAS16zklbvUDf0Go,1558 +torch/include/ATen/ops/upsample_trilinear3d_compositeimplicitautograd_dispatch.h,sha256=yL-ThUyH07ZHINCnm6KcWs6RCPBmXzy1LLEcNC8AYC8,1361 +torch/include/ATen/ops/upsample_trilinear3d_cpu_dispatch.h,sha256=Rc2MsPmJRmzECrAe9heswuIZf0bedm8i1OQJXYyKASk,2578 +torch/include/ATen/ops/upsample_trilinear3d_cuda_dispatch.h,sha256=6H2HKfF9XYB7y2rzADZc238fVWsxgL40eWfNPly-fjA,2580 +torch/include/ATen/ops/upsample_trilinear3d_meta.h,sha256=Z7eEA3sGBCJNnvELNRTVP_g8aanLj1bfFeAwN9493AE,1024 +torch/include/ATen/ops/upsample_trilinear3d_meta_dispatch.h,sha256=BRsXyv92_zbXORkzb8gdRP6gE4JxFXCK-O9W6rVsZzg,2580 +torch/include/ATen/ops/upsample_trilinear3d_native.h,sha256=AoXaia7iSWhun5xCaMDu5qWa_82PQUrq7YtZNz39gGw,1595 +torch/include/ATen/ops/upsample_trilinear3d_ops.h,sha256=mDYsw3wiDEHKkiqj3LbI2Z63RDz_EhpZ7AOUctygKYw,3905 +torch/include/ATen/ops/value_selecting_reduction_backward.h,sha256=MT-BGqxzO3hRg2H5x8NbSTK4nSpdvh7_GkhTgBr0nGE,2388 +torch/include/ATen/ops/value_selecting_reduction_backward_compositeimplicitautograd_dispatch.h,sha256=MqYEeiG_82DLfX5_Dy_r42AIHYZ5Q4icUmuKuZijMJw,1324 +torch/include/ATen/ops/value_selecting_reduction_backward_native.h,sha256=hEQpa1JMlwFzn7r5vAJJ0aWHzh19YWRPHtP5abPxh-8,1052 +torch/include/ATen/ops/value_selecting_reduction_backward_ops.h,sha256=wCswdX-gH-0x_5DjqAQ8SzyA_wMFeYfpbsVkNt52is8,1604 +torch/include/ATen/ops/values.h,sha256=PoyCKEwKPDi_yuAJM5DBlv0QUUXKKXzFo1UIS3DtDJc,789 +torch/include/ATen/ops/values_compositeexplicitautograd_dispatch.h,sha256=FY1ft6ERfvpXKvYN1li8YxPJZQeReWu4lauRkBOYH_E,1046 +torch/include/ATen/ops/values_copy.h,sha256=pzhgOkFlruUuscAz29YQ-LDubOCac6YaseWaAmCT7ss,1376 +torch/include/ATen/ops/values_copy_compositeexplicitautograd_dispatch.h,sha256=jRpmaJUGoGA6Oa6NaIbiuqgWC1MKZnkEQSvbyhw1_z8,1160 +torch/include/ATen/ops/values_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=R1cQKi1oU6OdNU18uH2Ew9rh4xahUiBCP2ZjI03TxJs,1077 +torch/include/ATen/ops/values_copy_native.h,sha256=jy4tgvuWZdOLBw6dUQkDqzELyMUqS8Dgao51FSoa3LU,845 +torch/include/ATen/ops/values_copy_ops.h,sha256=-WRBCZnsKago3eEzbc911khOVpQqD-EsKlvEEW6xD5I,1876 +torch/include/ATen/ops/values_native.h,sha256=YyaFOidX7ZxtbwSIvxEzjc_oWw_yC_lndDMLHg7AEI4,954 +torch/include/ATen/ops/values_ops.h,sha256=afQEFG4sbyBD9VBXUqwDrIpIujrBI2M1OZfC50CGveQ,1251 +torch/include/ATen/ops/vander.h,sha256=4UYj4g0gT0rjxB2-X5YrB_i_5XAnpFCnfo5OAGBShEw,1035 +torch/include/ATen/ops/vander_compositeimplicitautograd_dispatch.h,sha256=V48ZZ96hRxfFb_-OgvLNmLRwzwjX-0jgjL8zOasX2eI,1109 +torch/include/ATen/ops/vander_native.h,sha256=MVaD2l_ESln8_0G2AOAvj1YwOSlMqRfPSer2eeaMcG8,819 +torch/include/ATen/ops/vander_ops.h,sha256=bPzCb6tPHaVG-fAYDyXaphREVlSiDTXQ1l-UYVSure0,1394 +torch/include/ATen/ops/var.h,sha256=Bjmt5xrHMDKRmV6qN7kIlVPrPAnTfAIpj0tUwbiKwso,5217 +torch/include/ATen/ops/var_compositeimplicitautograd_dispatch.h,sha256=i67NeoQEKMHeLfnSS0rCblKPBeTLh9bcNXSO3GZV5Ps,2312 +torch/include/ATen/ops/var_cpu_dispatch.h,sha256=foK0FrViujmuXNS5mR3kfd_pn3ZY-odQWMItR8AgpLY,1497 +torch/include/ATen/ops/var_cuda_dispatch.h,sha256=g38sTUTvFRdwPzPBRDQmO7TaSVCoEFSX7U5i7T2qETg,1499 +torch/include/ATen/ops/var_mean.h,sha256=OfzWFuA9db3wUdPidoM6mr3f9V99bSJy0W5JH-n2tys,3536 +torch/include/ATen/ops/var_mean_compositeexplicitautograd_dispatch.h,sha256=pa7pNDI93aDi9E_VvpPduXVWo8hQOeRKuf0Smivh6Mk,1466 +torch/include/ATen/ops/var_mean_compositeimplicitautograd_dispatch.h,sha256=pWPlencSaC1SVOjCgpgT0ritdmwLY9GLPSi8sqwN5T8,1558 +torch/include/ATen/ops/var_mean_cpu_dispatch.h,sha256=KNhYidpOYIjEOv2Lak0UopYX4gizN7pMaP7KlhawGvY,1156 +torch/include/ATen/ops/var_mean_cuda_dispatch.h,sha256=KBTvik4yBkR8RxMyF_fGNVhxPx37hgaTgbjVZU2dFdU,1158 +torch/include/ATen/ops/var_mean_native.h,sha256=RDs32z-KkObsBj5eDEbdPueg0hBfy400E2XNNwKJUhc,1722 +torch/include/ATen/ops/var_mean_ops.h,sha256=dlQlOKTKeITZ4oSuE_IdKCE88CzhLeDai7FIQ33ZvaY,6039 +torch/include/ATen/ops/var_native.h,sha256=XvNd2DRUJoxFQUZIA7JNrfZeQySIUz50DF38Wv9mYj8,1928 +torch/include/ATen/ops/var_ops.h,sha256=32gF4iXj7Ma2CRfYQSss5nFs8iuNZlB98iDBC6w-UX0,7880 +torch/include/ATen/ops/vdot.h,sha256=FB8pC6iiVTajkooZtY21HxmAWLpFUGwQPa-qsOIIyvE,1447 +torch/include/ATen/ops/vdot_compositeexplicitautograd_dispatch.h,sha256=-k0LU9ySKDxGE_nA3EToLPn4kxw_2p_bryxW7lqIFdk,1198 +torch/include/ATen/ops/vdot_cpu_dispatch.h,sha256=t5KVtOF5H5yE1TscenFCtTlDOKdDNrr9aVAjRW9EWMs,1026 +torch/include/ATen/ops/vdot_cuda_dispatch.h,sha256=8txV0RH1iI77_Ug0cz6ThgQW5rf62f1gjd1vQlOvxaQ,1028 +torch/include/ATen/ops/vdot_native.h,sha256=q8csCjw2Qkjzy3I1CNaWoa8yx4PrTDnTO64h-zF8Hik,967 +torch/include/ATen/ops/vdot_ops.h,sha256=Re1hkeryDDsMjrhHwE53wmTV9JUGf-wPVgBHU-KkvKM,2006 +torch/include/ATen/ops/view.h,sha256=zC8XGJMG3nag-G9uqTT6SXEUFdXe1M92PhjR6ikdx04,1271 +torch/include/ATen/ops/view_as.h,sha256=NHcqjqI0-Ew1ndH5UeHDnuj82E5f7LstHDZykrOYfx8,790 +torch/include/ATen/ops/view_as_complex.h,sha256=e-DveiuNnAX4WL7SgkuJKfMTxLyO_mw1VIOAEo9laNU,969 +torch/include/ATen/ops/view_as_complex_copy.h,sha256=LmjvLXqy0E1NZAXRaacfOT5cOXB6VuPxVstWFEa2gtU,1466 +torch/include/ATen/ops/view_as_complex_copy_compositeexplicitautograd_dispatch.h,sha256=UoCUdYUuGMHwXVvZTR8b6TeifCUM57CrEZLKWDR9FDc,1178 +torch/include/ATen/ops/view_as_complex_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=B49kOGfhtZqfo5jyrWyZDxIeQOYgsir7DVLLIAc-8Qg,1086 +torch/include/ATen/ops/view_as_complex_copy_native.h,sha256=i8sqh_R9kmAFuF6eM1-5BRT3laQLLqcm8Cm57xnoBsY,863 +torch/include/ATen/ops/view_as_complex_copy_ops.h,sha256=J590JKA-Go-pvL1wyPcZXNpE9N-4lbyuAxxnbHZXKZs,1930 +torch/include/ATen/ops/view_as_complex_cpu_dispatch.h,sha256=dhCxQw6OL4nkdzYiV4VvUV_NAlGjNWKhau8Ons2QuEs,1011 +torch/include/ATen/ops/view_as_complex_cuda_dispatch.h,sha256=r1Cmh53silQcNSgwc9o-909WtfTVjw5c2lmIaoUsC2g,1013 +torch/include/ATen/ops/view_as_complex_meta_dispatch.h,sha256=jyvdRUv3LIoh0433wjB78x8GwsZudDVmBQwprKs43Bw,1013 +torch/include/ATen/ops/view_as_complex_native.h,sha256=6M4io-1OF3yiLiqI65FbmVsMCFRk0VXmS1VUFj8yW08,765 +torch/include/ATen/ops/view_as_complex_ops.h,sha256=KPFi_cA0KGIxVRWKYRmBV-sOdKx30926ocj6BJBikz4,1278 +torch/include/ATen/ops/view_as_compositeimplicitautograd_dispatch.h,sha256=xtxHtWChP42_x-5S8hCZMGZTJSLKF2Ud4TgcIRLJoVw,1073 +torch/include/ATen/ops/view_as_native.h,sha256=yK85C4YxAHgRof-dddt9DmFtPbJQRWNkyiVPZ9h-5J0,783 +torch/include/ATen/ops/view_as_ops.h,sha256=-VbtrglCVCMQ0u87PICqTgh25AqxoWYD3an8L64B3SI,1340 +torch/include/ATen/ops/view_as_real.h,sha256=-uROHE27ekT1xHMBrdt1dgLzanFtemvM4IfYAtgQ81o,957 +torch/include/ATen/ops/view_as_real_copy.h,sha256=CEQwAco9zZ67mDbL1iTXi1359bAs9dJmCrj1yB49QyY,1436 +torch/include/ATen/ops/view_as_real_copy_compositeexplicitautograd_dispatch.h,sha256=7nyyJyvTzTlsOCwl_dPRqcbgClxnaGeLXi1iq9vPrKE,1172 +torch/include/ATen/ops/view_as_real_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=xToEnWpDl-cHCX2UzP3c5LLnFNjxB5wcYW4bmTSNQlE,1083 +torch/include/ATen/ops/view_as_real_copy_native.h,sha256=oH5xbnSjSE1_CJ515bew2Zl10uKmbQyxauw3d_nlmzE,857 +torch/include/ATen/ops/view_as_real_copy_ops.h,sha256=okEYiMsvECOsS1kpyQXL-yO_CMfmL234-BUdEldCAm8,1912 +torch/include/ATen/ops/view_as_real_cpu_dispatch.h,sha256=iP9cZiVbvrZv4wFbhkHjl3T-i8HtjjSMlEoIID6Y-WI,1008 +torch/include/ATen/ops/view_as_real_cuda_dispatch.h,sha256=s7GELPyaiu7aBpX3cvGPoHSO31_Ooavjd-Sjgni2yJI,1010 +torch/include/ATen/ops/view_as_real_meta_dispatch.h,sha256=GjaHI_-1MZEgdxo933Sf3lEcQ6TNmMUyFk2pBJFx98Q,1010 +torch/include/ATen/ops/view_as_real_native.h,sha256=44CHdc7M3lHlJvpa3bZAJplv49J81jLVvRYaWl63krU,762 +torch/include/ATen/ops/view_as_real_ops.h,sha256=xldnt6apnTUAqyETzWDyaOhQi0LlBwhc_W985fDS7sA,1269 +torch/include/ATen/ops/view_compositeexplicitautograd_dispatch.h,sha256=INlh5SrG8ReMYnsEB50mMQZHPulrGgZke4X43DfL6Qs,1066 +torch/include/ATen/ops/view_copy.h,sha256=r0LU7BtD7x-V23AAq7NQCOvnAdDmV4CWg_7faV4gNQY,4678 +torch/include/ATen/ops/view_copy_compositeexplicitautograd_dispatch.h,sha256=-kOLwZtuJ29kxIktOev8mSrApD6npXWVgrYBBWS4Mfc,1640 +torch/include/ATen/ops/view_copy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=bwRAcc3U9z3sZrhwShBshy91tK_5lj-KmFNCqaocdJI,1268 +torch/include/ATen/ops/view_copy_native.h,sha256=Lv2_TDH1aYcag9dh1vRK6dGe5SvEX_VGpmuzRwYDy9o,1103 +torch/include/ATen/ops/view_copy_ops.h,sha256=mmzs_eMmYUAyGYvGVEV5qontwjYDO6Es5FmpQxefruE,3361 +torch/include/ATen/ops/view_cpu_dispatch.h,sha256=6tZb7gvIzJonq6QjQhIPhMyXQoPW5OgtP408325FHm8,1108 +torch/include/ATen/ops/view_cuda_dispatch.h,sha256=0XNw66oTUy7tLIPGBIMbrhqgW39jJLP9HoQ-ux9yj40,1110 +torch/include/ATen/ops/view_meta_dispatch.h,sha256=xTfb347XjARzQKAuzKywSM-PisuepvjSJntDCZsB4xk,1110 +torch/include/ATen/ops/view_native.h,sha256=qWUkaiWtkInFd97XS-yE7fWrUHglivfLG-IdxxZhT80,1021 +torch/include/ATen/ops/view_ops.h,sha256=1cL-M-ehZRcMIcEm8ViQGLEX8fL83X26xHp_miZ-iNE,1939 +torch/include/ATen/ops/vsplit.h,sha256=E78oyStFE5wElsmAiKllWhqjPKzc2Vu0NxfJ3AjC1k8,1234 +torch/include/ATen/ops/vsplit_compositeimplicitautograd_dispatch.h,sha256=DAlXRGWiNssE28Xj0HA0pmgVlV30uu5iDZlmz8u_Uho,1174 +torch/include/ATen/ops/vsplit_native.h,sha256=2m0-Ifw1i9BuuFXkTHAh0QmReLoXgbSQt9qi9UxtWDg,884 +torch/include/ATen/ops/vsplit_ops.h,sha256=zOnPWKJVOq9ypQTmOvK-rKtkx7oxdD4y80xD6iULFYs,2041 +torch/include/ATen/ops/vstack.h,sha256=jKIaLRp57xL988PSkYh7BpPMZQmcrXr4go5yUtqdHrw,1347 +torch/include/ATen/ops/vstack_compositeimplicitautograd_dispatch.h,sha256=IQDSPY7M_79y0axEa8xw9C8HKr720qLlnSbEHV7VVIo,1202 +torch/include/ATen/ops/vstack_native.h,sha256=EbFmXt6CNkCe6_ZLXjdkGCjUrIkEqFFmrrjOE_aiA9g,833 +torch/include/ATen/ops/vstack_ops.h,sha256=whARfdFYbB-V5TJhbMInG0m6OBmOHZ2iRb6dvUaAP-Q,1844 +torch/include/ATen/ops/where.h,sha256=tC6Dhyfx2H8Wab5K-wZXjZdrHUQdl4v8-lMoP8Ytwws,2622 +torch/include/ATen/ops/where_compositeimplicitautograd_dispatch.h,sha256=yD-mB7O_Fa4fnCwJFS5hGhjwPRTZwKo1ayQIEqCupqE,1395 +torch/include/ATen/ops/where_cpu_dispatch.h,sha256=zjur8vJoCLgG14-vl7DW-JYy83_gzWYU5g9TscDsXHo,1326 +torch/include/ATen/ops/where_cuda_dispatch.h,sha256=hZ2WRelVAE2YSPUzNegf-Zsr1ySyLyNEI6CbL_Piz2U,1328 +torch/include/ATen/ops/where_native.h,sha256=k-81W4La2VHA8NsfxsBlTiDSKbrLFZf5EC48W1vN2G4,1624 +torch/include/ATen/ops/where_ops.h,sha256=GMP8eahk002nhgup4jFs6xYwSSacsvGZC2ZVWbbPyRE,4970 +torch/include/ATen/ops/xlogy.h,sha256=Prkyp1VuqTmHhSrbvmLsMdmZt69n2ANF1IyXDWASoBs,3401 +torch/include/ATen/ops/xlogy_compositeexplicitautograd_dispatch.h,sha256=JghpvVMZREyOKDu1oO_2eIf80jBJn558J39ozxdDNDQ,1646 +torch/include/ATen/ops/xlogy_compositeexplicitautogradnonfunctional_dispatch.h,sha256=GfMMcnJu5w0xZBfy4P0Zx-EzG6WZmiA26Y5q1Qb1QcM,1174 +torch/include/ATen/ops/xlogy_cpu_dispatch.h,sha256=9zsxgoTjgpFFoEMsWZ4NkILaBjrZ5kp7aA_ON6zB9Uo,1313 +torch/include/ATen/ops/xlogy_cuda_dispatch.h,sha256=uGJFmsxG-tLYfR8Kz_xNQnuZ3eGEmBaQl6uklkZpEGo,1315 +torch/include/ATen/ops/xlogy_meta.h,sha256=58z8P7kPRXC2zqoBtm2GVaBXKBBnExc8uJDqJN6ACy4,885 +torch/include/ATen/ops/xlogy_meta_dispatch.h,sha256=1vWkiBgH686TPpl284xMCn2QMJdr0fzjHazEI9fBo9Y,1315 +torch/include/ATen/ops/xlogy_native.h,sha256=bI-6I6O7b8qFtGzlY0rUThwdxxmz7LlWsr09fB_7abw,1353 +torch/include/ATen/ops/xlogy_ops.h,sha256=PrMsthXhXnqwHX5sT6iJrh9wsMd_AbGu58KBJxjtd6g,5992 +torch/include/ATen/ops/xor.h,sha256=vjAXIEGYZ9jHVmDMRmtV_F6DIqbp102kxnZPthP7Uns,1192 +torch/include/ATen/ops/xor_compositeimplicitautograd_dispatch.h,sha256=G4B1kp31E-v7Q9emH4EOtixPkRTjHzF7nO8eHyMEqAU,1313 +torch/include/ATen/ops/xor_native.h,sha256=qiUrnxRVTBQvjwfqEHuwqtLtVWcNC2j0TDg-XNrNU7c,1023 +torch/include/ATen/ops/xor_ops.h,sha256=kLLwHmE1ukV6wM5GgIp8Pptpq8iOyD_sEaM2_xTmG60,3212 +torch/include/ATen/ops/zero.h,sha256=UHMLam0DyhUnYM_40aDWn6xXH6oqdrl0QvZsfNe6wIU,1447 +torch/include/ATen/ops/zero_compositeexplicitautograd_dispatch.h,sha256=vvK4YtXP-cImiTa-y1ZwKoASeJBwAQxo2YThlSEyS_I,1199 +torch/include/ATen/ops/zero_cpu_dispatch.h,sha256=Z4WjDhG0MteDVKKKMDgW_S8AAZEwwhShNxrvJZ9X8Ks,997 +torch/include/ATen/ops/zero_cuda_dispatch.h,sha256=pTbRngYL0y2MmePbzu2F8DcqXpoKDdM40xa8kOabE00,999 +torch/include/ATen/ops/zero_meta_dispatch.h,sha256=DS63mXtDQAIdtT-6aidaALd467Dd1U6AfLYXAuDxXjA,999 +torch/include/ATen/ops/zero_native.h,sha256=3XFAeUc2qj__GDXUeAtobcLxfzp_xf2Z-Iz2wtZ3GyA,1168 +torch/include/ATen/ops/zero_ops.h,sha256=P9hWnYWEKBuI1wv1RlEagJv2vkHDBiTe42mgrfhbUeQ,2338 +torch/include/ATen/ops/zeros.h,sha256=mBdatzptp6QCzvngB-3j7weNMs0rgItPiyPsxl_8UOE,7273 +torch/include/ATen/ops/zeros_compositeexplicitautograd_dispatch.h,sha256=sHcaYHVIBk4gVpDM3Py-E2WHVGDgP7ohsfbsJvziTS4,2479 +torch/include/ATen/ops/zeros_like.h,sha256=qWy0oXlX1GF_0XI_IvJgxpY8P9EBRf3ZoJtYWH74gbQ,2524 +torch/include/ATen/ops/zeros_like_compositeexplicitautograd_dispatch.h,sha256=W9GgBRWbcPcT2tNQFEPqPtkLm6Eab4PvG5HbYkzw7kY,1677 +torch/include/ATen/ops/zeros_like_compositeimplicitautogradnestedtensor_dispatch.h,sha256=uzE4-gymxVhVNRw_RZcnmtfTw1OtmgxtAx5bl3duNcY,1421 +torch/include/ATen/ops/zeros_like_native.h,sha256=HVyHTgtmtOdjs1vpVxl3_paRxxyXafwyHi9ZL-2QfgI,1113 +torch/include/ATen/ops/zeros_like_ops.h,sha256=hQBwY1X_jYPxWhd4ZnqLV8ageAUnkvu20y4RxAyEOPk,2700 +torch/include/ATen/ops/zeros_native.h,sha256=CUSqjxJ__wL0J74rs5igsDqAwAPiAeRtb3Y-dOlCOUQ,1446 +torch/include/ATen/ops/zeros_ops.h,sha256=rReRnL_NQd7dmMX5eTFUjhsvSPFt-7TIKDwE_rkowkM,4227 +torch/include/ATen/quantized/QTensorImpl.h,sha256=IyeB6LYTzLDENwnG1zb-L64DNO1RCnuzx5FU33gwvGU,4405 +torch/include/ATen/quantized/Quantizer.h,sha256=54XTU91Nq_3G_2Re216CaZgprESwktxxi7ZuMzFDmiw,9770 +torch/include/ATen/record_function.h,sha256=WljyFk4D5ltPuMr2jsw95enWw8XWmyT3JQgvH5QRZck,25309 +torch/include/ATen/xpu/CachingHostAllocator.h,sha256=1aVUUOpa-ueahmwx_93ylc4tblZvALRAgynQkctxhhc,1654 +torch/include/ATen/xpu/PeerToPeerAccess.h,sha256=zxCk7auzT3xlHdkP3sZpfrqz5mMC5hkkejarnx49NUE,591 +torch/include/ATen/xpu/PhiloxXpuState.h,sha256=xmi2zuDIvnlx1EkJ3_-QmrcJ0oU3tNOCrdBttpjLV94,1311 +torch/include/ATen/xpu/PinnedMemoryAllocator.h,sha256=8eGPtmihyMrUoHHTj7-hSgrKKf59WHAsgMl9mlp1pAA,516 +torch/include/ATen/xpu/XPUContext.h,sha256=eN1-mfDNWm7eDUD0jrylj18WPAMukcWE8lCZqoQK4lY,818 +torch/include/ATen/xpu/XPUDevice.h,sha256=bnZ8WMj4NmsRtNgw1VuqjFBn11ol63ndRNNeycLq2M0,539 +torch/include/ATen/xpu/XPUEvent.h,sha256=G4GMZoo8EpiDUyKYD8LSkwjszeHHXsHtfNuMR2PxO5s,338 +torch/include/ATen/xpu/XPUGeneratorImpl.h,sha256=YjF7XhGSKWX5H-iyFr9AChzO-RZG4kwd2MdJtzgj4fg,2511 +torch/include/ATen/xpu/XPUGraphsUtils.h,sha256=ZnY9Dg8AQ0b0XhK2UuQLCZOjEFyab6xecn4shKBjrRs,837 +torch/include/ATen/xpu/XPUScaledBlas.h,sha256=85-aoE-4eGDNvN9hM39lxGCgVoaUCvLWqPM5qJPFmzE,2747 +torch/include/ATen/xpu/detail/XPUHooks.h,sha256=QGLfZ7pzCG2ehI6KMGzuUsnb61SxFIS61aA_dLtLm4U,1469 +torch/include/advisor-annotate.h,sha256=9aVYlul0f1LJcaWCHdZouPkbqgefme0LyZXWCNtGGJM,24455 +torch/include/c10/core/Allocator.h,sha256=2oungO6KjwexMesFcVIZ93FY54v86zdrCxCXb-Nim2Y,14914 +torch/include/c10/core/AllocatorConfig.h,sha256=Cp8h7QSKwT3xTELVlDEesdGidBg7NRxF9OXLgyikZb0,15130 +torch/include/c10/core/AutogradState.h,sha256=veq3_G8ltQAPvDMczh-QEYFg_sFLMbMRt3A3vhtOhFU,2358 +torch/include/c10/core/Backend.h,sha256=FnmM0whzIjUxZuxxKzn9X10cMXEwbDa2_0E5gFo7v1s,12601 +torch/include/c10/core/CPUAllocator.h,sha256=d8YRGEScZOzgmb5RzDUYyoh_0Cy8CJRtexkVkUaH5Cs,2017 +torch/include/c10/core/CachingDeviceAllocator.h,sha256=b1z4TDaHQ78AinTOq87jRcmJxqMjW316L7trwUIqGog,4685 +torch/include/c10/core/CompileTimeFunctionPointer.h,sha256=aaoN7yPvueEqOskEBu2LlKzae9DebQQY07bJ6A4twAs,2016 +torch/include/c10/core/ConstantSymNodeImpl.h,sha256=zGlyEXvMB8G1Q_JglPJD03AsDXMwpjQZHvVdE5dYZpk,3359 +torch/include/c10/core/Contiguity.h,sha256=yhxmO5_9aSPzMqrcRUeFPvR5HVH3jAIH99KPhJXgakY,10353 +torch/include/c10/core/CopyBytes.h,sha256=0mZLT-kApWlZvWIB3TO71RZ6bak-HlwZbjzyFJf6jRY,1650 +torch/include/c10/core/DefaultDtype.h,sha256=iEPCw1cW4rp0gQkyJ_ArapH7XvNrfY-UO7zGFl8L_TU,668 +torch/include/c10/core/DefaultTensorOptions.h,sha256=LfftXrTy3qsYyZ5HEJNwhtS8s91r_CHlM7s_7du80tA,1368 +torch/include/c10/core/Device.h,sha256=QwBUnchCiY_akzGxxu8lz-XR-d2oebOkLDUq7T7n2fI,7341 +torch/include/c10/core/DeviceArray.h,sha256=rKEuLFZKZd6oDrMfsXhJCLyXXC_rQ_yUDTS8jVFLdO4,970 +torch/include/c10/core/DeviceCapability.h,sha256=JXmO4mJ83WSSjRDVTZWi-jF08qhEe9WRoSfc3pqZ3Ok,2615 +torch/include/c10/core/DeviceGuard.h,sha256=0i5b50IROEl6IBxQqA--5E5guoTkNStUT6ZM4oN9W5A,8269 +torch/include/c10/core/DeviceType.h,sha256=BZ2rQLIHRa35nJL5fxvSEyXH_guo6pVFAQxwdPAq69U,1090 +torch/include/c10/core/DispatchKey.h,sha256=BO0dUaz41ZxXNsf9OB0kg6guL9nggTNIKv3FhB8-NWw,33431 +torch/include/c10/core/DispatchKeySet.h,sha256=D8tz-L6dRQAru0BAmjC1AEBuC0knvXoWgAj_sIBhFdA,43098 +torch/include/c10/core/DynamicCast.h,sha256=WHakwm7Hq0CiWA_IA699NSrmgNXG5uxcmGRvM6oCff4,5002 +torch/include/c10/core/Event.h,sha256=7o_nupw-eAKiGJUPrvq55UVHSstsAuwv9oNr2tQkTQU,4852 +torch/include/c10/core/GeneratorImpl.h,sha256=dlnelVAR6GQBy9tuvCeH8hSwTyda8ydYQ5lBZjlTwsI,4307 +torch/include/c10/core/GradMode.h,sha256=QTEb4WFiUXMI32OssI8OBOXMIuhnn3J29dO_8X-tMjQ,1972 +torch/include/c10/core/InferenceMode.h,sha256=DOQ3h1O7JzcSYC0WEUdpqEmncS1aY6zlbO0U2ahqaYg,4113 +torch/include/c10/core/Layout.h,sha256=i62RZZJiZJR0cC3jT8f8QyzBlvRlEmGjuNppQXL7A18,1954 +torch/include/c10/core/MemoryFormat.h,sha256=UaopyuPO1EP_IFmCjWbduDlYuIS3A9MymdEdYtijCKw,9111 +torch/include/c10/core/OptionalRef.h,sha256=vrT_EdIv6_iQAHO1L-gzbdYkjUx6CJAQ-SolPbEfrWg,811 +torch/include/c10/core/PyHandleCache.h,sha256=zB5gzwr2M57r3uoOgXm1oTt4ug18Wuaz27cAdj_mI7o,3436 +torch/include/c10/core/QEngine.h,sha256=OV9zkAcaGM1e1aoBsLv7PQw4T93We9vUn5iOYtTywWE,1315 +torch/include/c10/core/QScheme.h,sha256=9EfVI1cDh5UKrgz7aJpzraqs-oVXS9W1PJLF_U_LfJw,1994 +torch/include/c10/core/RefcountedDeleter.h,sha256=4kYaSEq8k1ruVKVdl1DkWHHcD13EV7lWzfgXoOos--g,2562 +torch/include/c10/core/SafePyObject.h,sha256=ys-tkVOwcu6sH8uvyFshUoaDUIFOY4KBikrvOlOKDJw,4100 +torch/include/c10/core/Scalar.h,sha256=Xbfd5Rwzq8wOk9V9X0B-oFaDejuxxXodjT5_kR6v_JA,14882 +torch/include/c10/core/ScalarType.h,sha256=9NS_1mrgCufGghrqOBOdfT2zAPD8HQJ7uXQ-pgNKbMQ,9531 +torch/include/c10/core/ScalarTypeToTypeMeta.h,sha256=Rm5bexei-T8OIhEUYQFijT5uWe2DdkkKh3XI5dMovrc,1673 +torch/include/c10/core/Storage.h,sha256=55FJRwRQsdPqHWzH-0V4rKujbZKfvEWMQbnIIOvShjQ,8184 +torch/include/c10/core/StorageImpl.h,sha256=hGDk4WFJobwsZ_D4KaeDVM_RhHYqaD0MZNzcnirrP9U,12469 +torch/include/c10/core/Stream.h,sha256=l986YQpcRgET3SEOq5XlWWqI6BTSWVLKb9UWLTJ9dbo,6829 +torch/include/c10/core/StreamGuard.h,sha256=m_pxJnKk3035_TfWWFo1j5zVM5qJNSf-BsyAF_9tq_k,7020 +torch/include/c10/core/SymBool.h,sha256=KpFx9lImTED6kaaCLwZB8XoMOJuAC33LN7wmUdWiRPI,5076 +torch/include/c10/core/SymFloat.h,sha256=Mpx4GkRsqtm98EBGWsJ9d9AX9UdlRiVN4mYAA3u_BFs,4014 +torch/include/c10/core/SymInt.h,sha256=7thN4JqmNpNMwuY31L5_8u-sUF_2FarSNQONyDaQAK4,18345 +torch/include/c10/core/SymIntArrayRef.h,sha256=9HI8kyr5ZdTZuQz9Lzh0xR_UoO9fYw_HkQXsCZhkOVA,3643 +torch/include/c10/core/SymNodeImpl.h,sha256=PITWdXwZjfJXzyc_pzHEqCOc-MJED3OUbZ7CFOfl4Is,7859 +torch/include/c10/core/SymbolicShapeMeta.h,sha256=ZyyD65-DJQ81Pcxif1I8sy36Bg1krPqIuBIydnbJqjU,8217 +torch/include/c10/core/TensorImpl.h,sha256=_slDVwgkXlpK2YRrU9WOVulR4gw6AD1VLxEnpfp8St0,119965 +torch/include/c10/core/TensorOptions.h,sha256=5nSa48c-R0FezI1Hz0i-MPQUsa7_VW71nj-g9YIoQvA,28079 +torch/include/c10/core/UndefinedTensorImpl.h,sha256=dZIPzlfkV9I85R_av6C2O5kG9ybnh9CUDZvoHxz5Kz8,1541 +torch/include/c10/core/WrapDimMinimal.h,sha256=ISt2nic11uld_a-5AZMQX-BtqrQV16AO4ZohUfZXeM4,1667 +torch/include/c10/core/alignment.h,sha256=QJl4iZLDteqgAd_RhXGjz4Bd3NMQLBMaovatyjseFdI,1167 +torch/include/c10/core/impl/COW.h,sha256=cajxS1iYIhlRsal7OW8-32TwCDvv2IniRw-xQ1wCa4M,1347 +torch/include/c10/core/impl/COWDeleter.h,sha256=cbM4DRmc0eQboYBX17SFPqJrg3pUGdtN-St7-phOpw0,2423 +torch/include/c10/core/impl/DeviceGuardImplInterface.h,sha256=TgV28mkgt4It3wPU3Z1i1Jhpv7oRFkLl2BGvH24SDTM,15629 +torch/include/c10/core/impl/FakeGuardImpl.h,sha256=QI7mgLx6h0GOKIYcFB1ylmyCMFXVDUoKCtqWae9ta5c,3543 +torch/include/c10/core/impl/GPUTrace.h,sha256=iTvz2s1jmJhIuULIRIWd2RKzm1UsxMohQ43E0Z0dvr0,1161 +torch/include/c10/core/impl/HermeticPyObjectTLS.h,sha256=aXF-YaQeOPHWNyN2SSjbtg5jkuGXLqVeKCaSJqxcVys,2867 +torch/include/c10/core/impl/InlineDeviceGuard.h,sha256=kqCDBjxurJVU4PV38LmOeYSrJ60jpXsz-TTZAPscUR0,16603 +torch/include/c10/core/impl/InlineEvent.h,sha256=P-VXsyVwzfyVWQmNg-bn2vowyDm0YWSGzA6Wl4coauI,4714 +torch/include/c10/core/impl/InlineStreamGuard.h,sha256=SL0ieVkHEQO1txa0pxfTnBfws22rvtoILLhFLSMmZb4,10433 +torch/include/c10/core/impl/LocalDispatchKeySet.h,sha256=VgjUXzp8SaNIBqxNd5GeD-aoVvv_T6qg1Gfxs85VMC8,6985 +torch/include/c10/core/impl/PyInterpreter.h,sha256=xAmX8gRAWY9VV8gsfHM_b8alaiu377rkInrkxhiD1XM,11260 +torch/include/c10/core/impl/PyInterpreterHooks.h,sha256=qcHe3XpKtx9vAARwcLqK4v6qtI--3fcLXkYUH23bazY,1415 +torch/include/c10/core/impl/PyObjectSlot.h,sha256=7wdORU7MZ0CFxVSbt0gbUSgbvT78LnhjFN9NRLLWtKE,2150 +torch/include/c10/core/impl/PythonDispatcherTLS.h,sha256=dINSE7_yKlOoaWFQU5EHb27VmvGhbUT9dVSIjqXW2iw,1128 +torch/include/c10/core/impl/SizesAndStrides.h,sha256=zX-psZ21J7RSpcOSLZe4SYo03oQlkQzGXjDctbvkXM0,9346 +torch/include/c10/core/impl/TorchDispatchModeTLS.h,sha256=AuqMQ0hjHFED7CFsb09mxiPly6yC1dPtPY4xi_Td6GE,2607 +torch/include/c10/core/impl/VirtualGuardImpl.h,sha256=dTtXIVDRFZLaf-F4I9cGybf-RvKBxW8Ha_EZ9HGH9Eg,3772 +torch/include/c10/core/impl/alloc_cpu.h,sha256=jRZ1e2hAEMm1wPA3OJ1hflhhJVnXhNCA-7TeOwmTlw0,958 +torch/include/c10/core/thread_pool.h,sha256=hTnWK9wBSjQVjjDaF3QLcZFTWfPOfrP816uC6nlPz5E,3376 +torch/include/c10/cuda/CUDAAlgorithm.h,sha256=xB888hZW0aTZrgulvAsFVRd-ovHWTWM77RbhVb8SU-E,1331 +torch/include/c10/cuda/CUDAAllocatorConfig.h,sha256=FnOKBNDYbjhCDk9UQkTVwPhNO5Rc99ZWfxIsOPyiRE0,8040 +torch/include/c10/cuda/CUDACachingAllocator.h,sha256=dzNcCSUwHjO3HsaCYOS5yrwVbAHcRk8KyqCjh0iYnfY,19190 +torch/include/c10/cuda/CUDADeviceAssertion.h,sha256=7kvHZaFd0U2pbgXNgjJqkNGzkZGHB3HbBoZgl2ySBYY,4519 +torch/include/c10/cuda/CUDADeviceAssertionHost.h,sha256=48l6gFpUyAgMe85NqYoXxOhHyuheTMsxcyF_99Sn6s8,7054 +torch/include/c10/cuda/CUDAException.h,sha256=4CHIjxvtJtAeABJKTEzUrjRSG1cM-_JMH2o5FvVs5Og,4772 +torch/include/c10/cuda/CUDAFunctions.h,sha256=CHHAH0GxGRrZC_ifOVtXBLkxl-j9dHmyBDbwMyF6pNw,4747 +torch/include/c10/cuda/CUDAGraphsC10Utils.h,sha256=hkHOYo67orqAbCIyvu1OFvCz4S6rxTAs-6zyAqCkRwY,3079 +torch/include/c10/cuda/CUDAGuard.h,sha256=a3gXBl4dfBFCIqYz9g7zSFY5lPVoylFHumisXhoMjHk,11910 +torch/include/c10/cuda/CUDAMacros.h,sha256=Xeu7ibJvlfd7nDgeG77IeUkCnTKQSa-BJFkSi9izH28,1789 +torch/include/c10/cuda/CUDAMathCompat.h,sha256=GoEkruKMkSn4yDZccWnOgWzmtTgGALeK9tinf64h71Q,3957 +torch/include/c10/cuda/CUDAMiscFunctions.h,sha256=5aKhx9VmUowyrklYNfjcVJ1v1GjXaDkUFmPxxgcG1Mk,702 +torch/include/c10/cuda/CUDAStream.h,sha256=DFHxYlMSnyZJ3RTJnKdvK-3JfHj8ADBM78qQ7MExcI4,10166 +torch/include/c10/cuda/driver_api.h,sha256=J5LxJfs_U1WlEUcTYqhCe_V6bEzGBKcMrhhxy7ro5uY,5684 +torch/include/c10/cuda/impl/CUDAGuardImpl.h,sha256=vD25YuzevbhbMMaVkKLemnuThwzncn3w6-CXDLPF1Ao,9821 +torch/include/c10/cuda/impl/CUDATest.h,sha256=iBySMjllgNEkz2fU4BPZ4WWEHio64K2MBIqLeIqpggQ,382 +torch/include/c10/macros/Export.h,sha256=YKPiAS74eg5SnuDkc3fO6nMMWbGb3ivhg94uFJxBCE8,304 +torch/include/c10/macros/Macros.h,sha256=naaiq2bXOuXegaKepG3xhQLsQkaD-Gf7iPHl3I5l9o0,304 +torch/include/c10/macros/cmake_macros.h,sha256=wzzgSeS3rL02cIYUr5J0iUzdUVxYCP71N_UEJ8roGJ0,551 +torch/include/c10/metal/atomic.h,sha256=BolxyGQSXTe087FigVBBvX-qkmaCwBgcA3pVwfe_C74,5808 +torch/include/c10/metal/common.h,sha256=gSEQ7Cgew2-CKqFDTIQgzhN8nFuesuJlwxquS-fh9XE,1503 +torch/include/c10/metal/error.h,sha256=fNFYIMY2vSjB88bDh_tHb0G01LpXmUIMIMuRaWXt9kQ,2778 +torch/include/c10/metal/expm1f.h,sha256=Ctkt3LJn3Vtq0SoIENDstoe0Kz24UMzIKJBWNC3gcUc,3952 +torch/include/c10/metal/igamma.h,sha256=1yqN7M-hA4d5ga4CBhkZtBHzjNZod6S9AxcIWrbiNSA,30097 +torch/include/c10/metal/indexing.h,sha256=HTo7egN9IGgfb9Jul1C-dbjpJaA-B74-AHIe_vhJovU,56093 +torch/include/c10/metal/random.h,sha256=55GOl4HlqZa49ywNPSsp66jAsat1Qsx435RFs1AixGQ,2554 +torch/include/c10/metal/reduction_utils.h,sha256=uPOyeIWM41rZnwrmjyh_1lHl4N2NrFtuKMfKnrwr9aA,11593 +torch/include/c10/metal/special_math.h,sha256=z3mDSp8VkGC-3kSWDvCkzZzp9j4BlUAZWhdOM3F-RQg,58258 +torch/include/c10/metal/utils.h,sha256=7mI9sDoeYjy1VX2QynAmTAVAjh-OUhFL5JUo8c8Ssco,9678 +torch/include/c10/mobile/CPUCachingAllocator.h,sha256=BKiGAXvI4gqY5ouivTKDCmcG3ecJhu9PamiB91h9xFc,4530 +torch/include/c10/mobile/CPUProfilingAllocator.h,sha256=arxQ38c1C8cOuvfxy83R1RC-by-nSXx7Baf90nkEqdM,5147 +torch/include/c10/test/util/Macros.h,sha256=5cU1AoJPuZAaPhK8clK06F2E-TvysrPmSf1IeUB1aSM,444 +torch/include/c10/test/util/complex_math_test_common.h,sha256=vo3keVEBnQ2u0593dceVOONyrdCENhARZVwOV-kpuzY,22890 +torch/include/c10/test/util/complex_test_common.h,sha256=1H_ixpfXzyLTKSLNMr9LwNYFWJHXKElPl7jhAJYylOc,21463 +torch/include/c10/util/AbortHandler.h,sha256=0Vrg5_0P-9tZOWsc4gy2FwoS-by7haSwEm6ABTAllg4,2534 +torch/include/c10/util/AlignOf.h,sha256=E0Ikt_pjnQQyIM6YBTVQzk4LFV6RAfva-WCsH8gfRXg,5341 +torch/include/c10/util/ApproximateClock.h,sha256=3x4X_ori2of1by9NO6ihagvdgDfmy6olIaH-zgFUlDY,3856 +torch/include/c10/util/Array.h,sha256=jncodM2qUYYkR1M7t02ncM9wtjZ2TThNpjL5x7rMcQo,727 +torch/include/c10/util/ArrayRef.h,sha256=v6D8xqW37Vh7JPmLCXvQHWpPqBlnTIfLgKVNM5wNCso,10578 +torch/include/c10/util/BFloat16-inl.h,sha256=-OEZ4xRItPhfJbZ4-_aNLmPgdKRNxvlvLEuMEH-DZTw,304 +torch/include/c10/util/BFloat16-math.h,sha256=u1Ihz-VVgh2gcdnb3lb46bvkuYWdH6oSiXbJmnJi01A,9075 +torch/include/c10/util/BFloat16.h,sha256=-OEZ4xRItPhfJbZ4-_aNLmPgdKRNxvlvLEuMEH-DZTw,304 +torch/include/c10/util/Backtrace.h,sha256=5qq7LoW4s38tZ0ZWeBrwuLrDpG-9inzlhfHNsFZ_2k8,1087 +torch/include/c10/util/Bitset.h,sha256=8Eplot3I75saEjFCWT8nS0s7L9fRsrbQMM3wR3TPvj4,3797 +torch/include/c10/util/C++17.h,sha256=DkE3GoHBeIjhrrWsgppIEITErYpbjcpLN0ly476nhxo,2143 +torch/include/c10/util/CallOnce.h,sha256=wsuxYzp3DFnAO60J812NEd2NKEW28lrMoNG6NJ01C2k,2392 +torch/include/c10/util/ConstexprCrc.h,sha256=-Dk7jk1QW5U7zuJmz7Mi_4D3FSSn2dfxZOw28pd0KqY,6986 +torch/include/c10/util/DeadlockDetection.h,sha256=xLSEXe6YC0F2u4Oo-IBG8trtLltlqe6jMYl6SkjOdEk,2528 +torch/include/c10/util/Deprecated.h,sha256=crWZEtRl3eVDMY84Jbbg7AXkOiMQ3qysNF45lq3SmT4,320 +torch/include/c10/util/DimVector.h,sha256=p5njtcdB_BUquzxHYD3ju7Rv8EHq-NjELjKmcuxYzjo,720 +torch/include/c10/util/DynamicCounter.h,sha256=SsXtb0AbAJQmbOmHDgSC9NguPGmS12qWrWp5e-j26fo,1625 +torch/include/c10/util/Enumerate.h,sha256=hD4VdMAofV4P5zt52dpTa6xvQHUg9GzDBLXsQH-L6uI,4419 +torch/include/c10/util/Exception.h,sha256=cFObqbcYbtAHSN2Fzu7siAHIiNRmokk7Zu1onQrBV-U,34341 +torch/include/c10/util/ExclusivelyOwned.h,sha256=-bko7KrbVAz_zS7IBNh2KOPWINg6Fj93GdbsM5y0z90,4863 +torch/include/c10/util/ExclusivelyOwnedTensorTraits.h,sha256=DzuuKtk5nWWFemEGpDsuExkmjxTwlNaJZaTZpAmRp3I,2554 +torch/include/c10/util/FbcodeMaps.h,sha256=gvcVWDUkwcLOKgfuUZXU-0KC1ZVZ_5zhyUCgYfwjsKM,1016 +torch/include/c10/util/FileSystem.h,sha256=ko1_uC2HyqGjpFYPXYUigqTuxl7wVlerfVt_ShiM65E,918 +torch/include/c10/util/Flags.h,sha256=jvHqgumvkiLAm3XJw8DEIlqi2TZFKliMkHCDRyslabU,11401 +torch/include/c10/util/Float4_e2m1fn_x2.h,sha256=iw97Srq21uFCDu_rl8xqNR8p36Jbkz4etJmhrVS_lTI,312 +torch/include/c10/util/Float8_e4m3fn-inl.h,sha256=G2eJasDjZyQWRojFSiQsUPEf1su0n46JaVpbPhsfB6M,309 +torch/include/c10/util/Float8_e4m3fn.h,sha256=G2eJasDjZyQWRojFSiQsUPEf1su0n46JaVpbPhsfB6M,309 +torch/include/c10/util/Float8_e4m3fnuz-inl.h,sha256=MuaJAzXXPsZ95uUcI5ypEJAyl8-_LmPf5vdfkUXtSKE,311 +torch/include/c10/util/Float8_e4m3fnuz.h,sha256=MuaJAzXXPsZ95uUcI5ypEJAyl8-_LmPf5vdfkUXtSKE,311 +torch/include/c10/util/Float8_e5m2-inl.h,sha256=A1GqA60zROc_64SMwIy4SoBifLZlKPATr6H36AVc5hc,307 +torch/include/c10/util/Float8_e5m2.h,sha256=A1GqA60zROc_64SMwIy4SoBifLZlKPATr6H36AVc5hc,307 +torch/include/c10/util/Float8_e5m2fnuz-inl.h,sha256=v_9QS6xdzkhSLo7kzPBsyxEv11lXIW1-f9Bz2QEnqWc,311 +torch/include/c10/util/Float8_e5m2fnuz.h,sha256=v_9QS6xdzkhSLo7kzPBsyxEv11lXIW1-f9Bz2QEnqWc,311 +torch/include/c10/util/Float8_e8m0fnu-inl.h,sha256=zgbqo0r7ifTzRgWyGfJAgTXyZ2Eh36b_NiG9NqXIQMg,310 +torch/include/c10/util/Float8_e8m0fnu.h,sha256=zgbqo0r7ifTzRgWyGfJAgTXyZ2Eh36b_NiG9NqXIQMg,310 +torch/include/c10/util/FunctionRef.h,sha256=Fm7O8wBXstYFYMczeYIbPQ5YOX0qploQPMB-AASbmzA,2664 +torch/include/c10/util/Gauge.h,sha256=hYTtEbV9EloTGIzXN6izZ1Ux1kg2SOgNMo8oiLy8OqI,1501 +torch/include/c10/util/Half-inl.h,sha256=ZW0NFhWa-sHqmb-xfEDtlIz9n28YAAKjk84mVSctyWA,300 +torch/include/c10/util/Half.h,sha256=6JnXaY1fs5C6YKE2M63oAZRA1GyAB9xTalonaLCmFlk,568 +torch/include/c10/util/IdWrapper.h,sha256=nrWuR2cCj0QMx4oENtdPotI-z5QRoO_XddF1g52na3Q,2672 +torch/include/c10/util/IntrusiveList.h,sha256=IT7cP1SePokXVakivLz0NchIRpr8ROiFq4ST3r8ol7I,4960 +torch/include/c10/util/Lazy.h,sha256=YBfdwTWfBKDDd57BDoTV_FLAUmAdiYDpQz5ggL39OZ8,3202 +torch/include/c10/util/LeftRight.h,sha256=vDx528PuMgas0pQV99vKlyPah0J2hWdRgJlRNhq8JWg,7697 +torch/include/c10/util/Load.h,sha256=_xnXK6TtZ3VNPF71gwSQRHjdKQ4KAPXGjIxJjcRjW8o,1221 +torch/include/c10/util/Logging.h,sha256=nS94MnoUixE0VvWVy5e16jh5YgUf-9yJ_WdIO9fkXoQ,14732 +torch/include/c10/util/MathConstants.h,sha256=WtFbWVZfPfpQkQF05q73UHrW5wOs98b7-EGFPKNV0m8,4091 +torch/include/c10/util/MaybeOwned.h,sha256=RmTVFJHo1zVEhLz41OsmDdsuiWh5Y1XcYvHhvQzH4v8,7673 +torch/include/c10/util/Metaprogramming.h,sha256=lxbbtzoF-i9IXpi4ZOmpCAQ4UfFekTDqQGW9-ZqY994,311 +torch/include/c10/util/NetworkFlow.h,sha256=td9WDlSmhhm790yn5Sy_ajqhBl1rvHdOWfilNSXLJVI,1450 +torch/include/c10/util/Optional.h,sha256=gW4ikzGnHD5YrrPLaAJuG8kpAZe1SnXRCebpVQL3GX4,2314 +torch/include/c10/util/OptionalArrayRef.h,sha256=q49DLiiTVPa1FIueO_F3Kdr1-wSkk4vX-qhvyk8Z1QE,7680 +torch/include/c10/util/ParallelGuard.h,sha256=FdauHuG51B79Z24xhSmAUWBeiy_At05byftJqkVsEFQ,652 +torch/include/c10/util/Registry.h,sha256=7akMGpU0npdCbR6V0-zc-N2pYBjkDHOSJvZZSbYR_Tc,13848 +torch/include/c10/util/ScopeExit.h,sha256=gPSmQnXvBHl8xcXwfVNqQkdSHBtr1bFY-7GaGI274w0,1568 +torch/include/c10/util/Semaphore.h,sha256=TUP4EwVFPZFRbSyqHB_XwBLJfk0Dydl8uzelYzM68CM,1748 +torch/include/c10/util/SmallBuffer.h,sha256=BXmosQ_7d-VRpc1Z6ecs3w6M9Uypb3k7vtbazG0YL4k,2108 +torch/include/c10/util/SmallVector.h,sha256=1K545sGBsX4UZM6lg2LLZORUkAr52re6ImWlBUl4A3A,50800 +torch/include/c10/util/StringUtil.h,sha256=OQbYwBNv4aaan3Q8BvEb1jUJ4naRdgoF-7hxuiBAOwo,7322 +torch/include/c10/util/Synchronized.h,sha256=Ko6k4Qahxz1zm8QxTBE79EZv1P8u4Cmq1pramdZcajw,2246 +torch/include/c10/util/ThreadLocal.h,sha256=nthbBVHMdngQtrA6JQY5vhcFlpcTI8s2E3SrcFEV4aI,4435 +torch/include/c10/util/ThreadLocalDebugInfo.h,sha256=HuPWKPJoMj_cYL3C9p2Vz18bm2MWts3qOtzxJXKnvAQ,3009 +torch/include/c10/util/Type.h,sha256=v_QpKwNDVlP3PzXgXFJgkbrdUR1IiJMFv3MfvVfHTr0,935 +torch/include/c10/util/TypeCast.h,sha256=g2hpl5X-WM7TQ6Js8GWPRDidJ7Lt1YLcf8l41F3OUs0,7131 +torch/include/c10/util/TypeIndex.h,sha256=TUsXQ40T5xxs0_E-Z072o8yi9Lse8zXzgKl1hAGDkNU,5079 +torch/include/c10/util/TypeList.h,sha256=kGqgHwhYaTAm7Dz2WX89TFQvohmfb0wbdee2DKBvY4s,304 +torch/include/c10/util/TypeSafeSignMath.h,sha256=YZhQJ2169vZrlasfEXWgVJWPOcD6YT1TyiPmvRSMVCc,312 +torch/include/c10/util/TypeTraits.h,sha256=pfe3gW1A616XjpQ5giydEBkw4wK6q8U4m094wHmohTk,306 +torch/include/c10/util/Unicode.h,sha256=IqTvWiGDzVZA6bojxynpzrZRy4-dceacEL9sDxc_SL8,568 +torch/include/c10/util/UniqueVoidPtr.h,sha256=jQSZgJLkW2WGKu1V0xlnj7B8yMI4i0V097AzLlCtq8s,4980 +torch/include/c10/util/Unroll.h,sha256=To188ywfWEPMElrM8N8qezpa6AMBRUE4VtJhNJo-Axc,1132 +torch/include/c10/util/WaitCounter.h,sha256=fAp5K5oYD-i9wBA0c1UGvmJU1y71NC9hTfNQng9O7GI,2977 +torch/include/c10/util/WaitCounterDynamicBackend.h,sha256=BVXSjzu0uAmykZjx8R9QSUpR5Hmih3ikcgt29DbrRxE,942 +torch/include/c10/util/accumulate.h,sha256=SZZyeopfvnxVDOiqfs8orcWgQ9kek-UXYYuKkugRSd8,4415 +torch/include/c10/util/bit_cast.h,sha256=dwEN8-2LLSt_v2St6BdBI3tfE0uum3q1GyV44-KIHw8,304 +torch/include/c10/util/bits.h,sha256=fHKZBlTpRK5puvFubhCYsZPiazT10n-ObHHPyNdNRBE,300 +torch/include/c10/util/complex.h,sha256=vcLHaNVyj7uC4vsU3VT4RYyGj1ThRp345WxNRAajZII,2437 +torch/include/c10/util/complex_math.h,sha256=va0KgBp9zs3Wn7Ohdo4THMVSJBJShdP2FiaOP580cts,13198 +torch/include/c10/util/complex_utils.h,sha256=yTtdRKffJsJvEHM6zpE29ny2ZY7kMzkUYQ_kFAJg1kw,1382 +torch/include/c10/util/copysign.h,sha256=6iwQ2JPaNzmyyzEXV1hDkZDxguF9Ud8gxZVSr6CIFdk,1118 +torch/include/c10/util/env.h,sha256=-d97rLnyKIFhj3HxyuzJbzbinf8qDNSfzrnts1M7CEM,1184 +torch/include/c10/util/error.h,sha256=7VIbWinZ7rX2iLkKCO3DiYVFglFMDb0eeKIXpiUFsRM,475 +torch/include/c10/util/flat_hash_map.h,sha256=-ZybRN8vro2PhCWVydBZWSqGFf9yaw7pbb1YI-V2XVw,64369 +torch/include/c10/util/floating_point_utils.h,sha256=kc7tudvRr1yTXYaTEA837cJ0QYdzFWPk5yFLODCa1fI,316 +torch/include/c10/util/generic_math.h,sha256=KxwqyPxKJsPWxaNcan9uD9zBvm4KHnqCO979odoa8QM,3432 +torch/include/c10/util/hash.h,sha256=nL_LK2EVByU0yIDm-M889e3a1sVUd8iqTvW8P_yeQe0,11744 +torch/include/c10/util/int128.h,sha256=PVFBQFbKx8H2BK2AX3X-u7vPwQjDF_GAngRNJyutX6I,12980 +torch/include/c10/util/intrusive_ptr.h,sha256=eIjRSZtTLoT7GdCVrw8BMZ0GePGS2BxRXyuZ2aqKLIc,47822 +torch/include/c10/util/irange.h,sha256=bqXyB0oxrCrZZjcIvmDEBIRy-9Kpbwia9q99tq56G-E,3818 +torch/include/c10/util/llvmMathExtras.h,sha256=VG3__cs7vlq8d3IR0XptBQD5yWE7tl34Mquz87rwFPo,30627 +torch/include/c10/util/logging_common.h,sha256=rYYpF7rwofLt5MPS-pega4tU_lixktsJ_yr6ym-F5wc,2066 +torch/include/c10/util/logging_is_google_glog.h,sha256=ZEd8c5hW4yd--bDIwrm-zA1gX6R5BUAQtOWlmsARswg,3273 +torch/include/c10/util/logging_is_not_google_glog.h,sha256=jxC671h1wmJN3xm4LPcQ880xo51rK3B4NsfshsV8X3Q,5928 +torch/include/c10/util/numa.h,sha256=BzgnS_1S8B86RPzl4pyGnIDhpjceOoWfGZED8pjMXII,1013 +torch/include/c10/util/order_preserving_flat_hash_map.h,sha256=qwMm8OSX_5sRLn11zj0xdUWRkHXjRvDEYTEpjThlUu4,68005 +torch/include/c10/util/overflows.h,sha256=yYBfbapFFJbGgZ66Ljx50nvVSVGHI_Xc1dzCjZvq6W8,3826 +torch/include/c10/util/overloaded.h,sha256=I-a-qx6Hwcfu4uX3G7UqrAiZ5RO4b1eXtHCfUlloXw8,1017 +torch/include/c10/util/python_stub.h,sha256=vc6j4AKPy5KOCbN9438wgL2JRD2fQFhcaawttrnUBic,319 +torch/include/c10/util/qint32.h,sha256=Ep7fsvQcdoKTN_ph39-P6g9z1PlV2n8-mdWm0gG9JnY,302 +torch/include/c10/util/qint8.h,sha256=gQoWkLRHMKq0aHc0RpYhOVVUxduOBabPrBwTr5iAW6o,301 +torch/include/c10/util/quint2x4.h,sha256=o8Etk8pZk3njSNO1zJ_0xy3KtXhMuC0L6qlZAq-s4n8,304 +torch/include/c10/util/quint4x2.h,sha256=Y-TzUnVr1GrxnqqgatctxFvLic-74iVslXozMBWI1BE,304 +torch/include/c10/util/quint8.h,sha256=ViAQ1PIBjDJVCuKfviyCKZBpAIWrRriheKi_ML71nDw,302 +torch/include/c10/util/safe_numerics.h,sha256=Lh0ietUvdAvllmHetiuiJ-4_x_IcCMt0tzhM289gJLc,3466 +torch/include/c10/util/signal_handler.h,sha256=A8cYR9Uff_vFTgLcgKnI26QT0QcWkyVxX4Kl-Q_Dm7M,4145 +torch/include/c10/util/sparse_bitset.h,sha256=oPC8jAzyMPnLyWyvjPeuWIt-MZ5i01QWAgc9NJWImC0,27829 +torch/include/c10/util/ssize.h,sha256=I1KyTJ0bEH5v8xWyWRiBWveY1lMLEqVyTmqArjgq8Xw,1674 +torch/include/c10/util/static_tracepoint.h,sha256=ngcZAfc7ArK16YsaNDfjuCoJx2kwMrY-8-CFdSBQCzk,1369 +torch/include/c10/util/static_tracepoint_elfx86.h,sha256=RzRSCZtq-_5i4Ri56bwx4pwbGxyxBX4kdtww12_bN60,8076 +torch/include/c10/util/strides.h,sha256=C1RZconwWjoKS2uOuEQyUzG_bIILqmX8qPF_628_Y88,913 +torch/include/c10/util/string_utils.h,sha256=W47t3SX0wPNu6WUTiDgajss3lQY28ZSCACrLMW_ioPE,727 +torch/include/c10/util/string_view.h,sha256=KhcwFMOdzvT6rRDgqurdzZG0RuC1ddp1rVUORazQS40,19302 +torch/include/c10/util/strong_type.h,sha256=lYYNQk6eiRQ16wzRp4xegpJmiiUAvtAF8LOiZVDl6tU,37490 +torch/include/c10/util/tempfile.h,sha256=dv_6214LFDDZeZwcVolsdL2y4DmTlvo8eahvZk2tIKk,3108 +torch/include/c10/util/thread_name.h,sha256=fsrznoANVoChRoyduRt5j31ASikfIQVH_7tstGNcUDk,458 +torch/include/c10/util/typeid.h,sha256=x6gupOHEOAJLbDuhETlmZpKDHtxkJxIVG3fnkCPcHgI,24304 +torch/include/c10/util/win32-headers.h,sha256=20-_bF70HjXLh07a0SVujrwZ0pBUHw-Nnp8HiuxdwHg,1177 +torch/include/c10/xpu/XPUCachingAllocator.h,sha256=ueShfKao2kkFIg5rC-_ENq0h3cDhE089S-xSRyK6rto,3307 +torch/include/c10/xpu/XPUDeviceProp.h,sha256=PwbrzOhVoGcO_EjC6Ly_HFz3mI1d5-HZUtcLV1Wod-8,13638 +torch/include/c10/xpu/XPUEvent.h,sha256=xaT4KwCy6k-rwwhnsL6c4YgeEfwXH34QREFt-3PRbNk,5823 +torch/include/c10/xpu/XPUException.h,sha256=S04zirsTTJdKExCM-Ag4AZBEh782C_L5xjgsWsq1zzc,696 +torch/include/c10/xpu/XPUFunctions.h,sha256=f5-nIfw0GdeDiHCJ-ddNQDXBw_KZiyHxPC-f0IEVk5o,1573 +torch/include/c10/xpu/XPUGraphsC10Utils.h,sha256=yD6b4rdEZJyp_qJQDc809QuOLXBIWCrFQ4hOSkJ6Qe4,1397 +torch/include/c10/xpu/XPUMacros.h,sha256=yRzAYS87DnVQ6HZqx0zE-0pTVCC4DSJQ1kd7A7foCnA,1162 +torch/include/c10/xpu/XPUStream.h,sha256=XLvwLFQCFrtVlYueaNRU-qIj4dCbXFCSfUvMQKn-mbc,7194 +torch/include/c10/xpu/impl/XPUGuardImpl.h,sha256=P7c9kPWRpKD5Hr15wp8ZQ_rPsf9eOeryM-XZuWdrtIk,7515 +torch/include/c10/xpu/test/impl/XPUTest.h,sha256=N9uxUJXWnIqw0lZQVyMRNFNaTo0pilRUPcim9nxYnmc,746 +torch/include/caffe2/core/common.h,sha256=fa2gfO2SY0htXeCWavah4qImnJThstgjMsCM8gZ7QdQ,1679 +torch/include/caffe2/core/macros.h,sha256=EMFfRvTW0RF8NKXoArOxidXzDAv9w9QRP0zRsOBDDrs,2744 +torch/include/caffe2/core/timer.h,sha256=xka2g8Cj7M3WTitIVb4nAD9ys61tPq9sxDtHtK-Lxck,1525 +torch/include/caffe2/perfkernels/batch_box_cox_vec.h,sha256=D6SkFp0676REqxXENdAleny8GuYewas6OTQNDS4WLsU,10278 +torch/include/caffe2/perfkernels/common.h,sha256=mPqIXHFOu-s20FhAuwgqaBhkKuNThpa5lfk_QBWXuZo,6548 +torch/include/caffe2/perfkernels/embedding_lookup_idx.h,sha256=13pFQ4iRFnOaiN25KPXlfdj9B0CBUKBV-gjTEEp6VTE,1990 +torch/include/caffe2/serialize/crc_alt.h,sha256=Jl5TgHYOoFqtNtcgUl-0aphpCjMxH628s0OxIzUeFvg,77104 +torch/include/caffe2/serialize/file_adapter.h,sha256=w9bD7CP8KWOTZ5o1hrdfM6m7Wn8A24kLzpD5VdRQDis,1161 +torch/include/caffe2/serialize/in_memory_adapter.h,sha256=GZtU78JyNxgU6Zho3Lw8XdJiCa_NTkWgA_eIZQ4s64M,930 +torch/include/caffe2/serialize/inline_container.h,sha256=JNXt0TEZ3ZelnjGNb_iP5vwRL9dI7VhdbACALiVj0Ek,11100 +torch/include/caffe2/serialize/istream_adapter.h,sha256=Pc6NxTixwu4hUth3NJQNYlQdbF28eK25rtoX2XejE5I,955 +torch/include/caffe2/serialize/read_adapter_interface.h,sha256=HSIVpIL0Bft-PAwCEJKG995deX8I6P2ezTvOOoFQqFY,838 +torch/include/caffe2/serialize/versions.h,sha256=_KyXPq6bKKmd2L2L-NcOO5iN54nyewHCFLMrOV-RFIs,7040 +torch/include/caffe2/utils/fixed_divisor.h,sha256=_4LCoS0m4yQ0ThwYOLjUDbVJazB5BgoeN9csJJbBumY,3923 +torch/include/caffe2/utils/proto_wrap.h,sha256=0vKxSA9F81ogVRNwVl8C22V-_sMfUUrwYHR-oyfJfmw,1556 +torch/include/caffe2/utils/string_utils.h,sha256=nH6kO6XygvLujchhqi5ZI7B9I73ngQww9CNFPwxbGRU,1516 +torch/include/caffe2/utils/threadpool/ThreadPool.h,sha256=UBVfYJbzrRkq8LH6WkMTBbMc0dtMr9qTVj6F_gvOn9Q,2714 +torch/include/caffe2/utils/threadpool/ThreadPoolCommon.h,sha256=YXh4NBmKFYDPthaUR3ExZXTemqZ5tm3Jit0CBEkXKu0,956 +torch/include/caffe2/utils/threadpool/WorkersPool.h,sha256=jRCY0S41JcLLRKf1h41XzXbu7FXHqc7tlVEPZ3tdTpY,12364 +torch/include/caffe2/utils/threadpool/pthreadpool-cpp.h,sha256=4BoyqWTqrVTT-WcnAImZ3YyD0t6ObCHX5hrX4MxL1QI,1778 +torch/include/caffe2/utils/threadpool/pthreadpool.h,sha256=HAKYye-pGBurL6jp6AOZxKZoCnXsiSWk3KSeMxRtREg,6796 +torch/include/caffe2/utils/threadpool/thread_pool_guard.h,sha256=XGuIUTPv_EXfvkWeTZzv3kqQ6XGZ3sO9UlTYXLOMXSg,849 +torch/include/cpuinfo.h,sha256=2OWLbg0L8ne2IkguLm_A0Am2k76_MBZ37KIlfb76zYY,59409 +torch/include/dnnl.h,sha256=eJU2lqphZEcYGnQ_LmphLfr0IeENCQi-0DAwg51F-PM,1107 +torch/include/dnnl.hpp,sha256=lgxGNZnhzYSSuS8EpCYtH_P8GHiLwM_v099KB21SQkY,1115 +torch/include/dnnl_config.h,sha256=BfycbtZ2XY_Wux4CQaYcp-t_OsRB2_rdJfbg4w7n6Qk,1135 +torch/include/dnnl_debug.h,sha256=5nbLvjqgCxmdy80wPtIB238aNAcmsTjHhuhziWbn_AU,1131 +torch/include/dnnl_ocl.h,sha256=uZZKT567toLkzkrO7GhyNPMq_qyRRvmewFNBEHgZ1iQ,1123 +torch/include/dnnl_ocl.hpp,sha256=wsJdaQWP6McE_QpRD-2_JWmdzJqqanta6xNrKoLChDE,1131 +torch/include/dnnl_sycl.h,sha256=uDOahfhZP9lVA4GjloCiAH8W_fYiTmtSWU0zvUec7jA,1127 +torch/include/dnnl_sycl.hpp,sha256=K4iicM03UueacPO6CgG2BBEKvW8WVC60zRKpj1uYKjY,1135 +torch/include/dnnl_sycl_types.h,sha256=WM3a2HSDmCSliUyAUZHmjzhHH0gCm07AMaGs0PCnacw,1151 +torch/include/dnnl_threadpool.h,sha256=daeMjeOQS793dbZuHkQynWslXlsEwkM6KPZe5w3RkXk,1151 +torch/include/dnnl_threadpool.hpp,sha256=q6NlIlNmjBdmMBwNNsnq-vjqphpxigLk2_MrXyZh0Mw,1159 +torch/include/dnnl_threadpool_iface.hpp,sha256=l1FOPcT48bUQWHJPwwT7DqVoACUViR8yx9462EAZm_g,1183 +torch/include/dnnl_types.h,sha256=ElXOXSTB3YkecRHnTYONWWCvWOzrW_sxlgle1VcFGCA,1131 +torch/include/dnnl_version.h,sha256=1OJQeSkiVvLwWBrsBqUC7vXKFtGdRJIyyrC1XLxS11Q,1139 +torch/include/experiments-config.h,sha256=IFJRgXI5iyo7jj5RGt1yQZSA0d4GWyZonkl79m_Im6Q,796 +torch/include/fmt/args.h,sha256=AEdXOalRk8jVbTt320i0JcFs2BuVGyJgwoMfPDZmHto,7678 +torch/include/fmt/base.h,sha256=5V1_xTMX7a0Do9iKwlJ814PPR_nybBcSGKCE8WxftNA,108300 +torch/include/fmt/chrono.h,sha256=Tq_DwQ6vDPYBErC9cOHx0cOQf-HRlU6ALCpWbXi1oIE,79959 +torch/include/fmt/color.h,sha256=6miT6YItmfhH8DM2k31wrOSrBdoqJOPtQMU1Qn3QdZw,25041 +torch/include/fmt/compile.h,sha256=LsI1EWGBnWy7iS_NHbIF2sYu1FswIjA98_ekP6SU7QY,21340 +torch/include/fmt/core.h,sha256=bpBZmXL89WEuLQVtHtVBvwyB-ZUq4FxbiPAcUvLtC6g,451 +torch/include/fmt/format-inl.h,sha256=MrR-ehcxftk_bzhQtSFMqtN2VpX3Rj7e6oppv5JWXNo,83215 +torch/include/fmt/format.h,sha256=5vMgL2wJ8NZlBggXzqouVGY4EmhZi4w6tatXfXcTR7E,167320 +torch/include/fmt/os.h,sha256=MZnOIpAi9G9LTVZpHnOSARiABeC0qs6gCwjFBCw-ozo,13546 +torch/include/fmt/ostream.h,sha256=MMp-D9RRa2_JIIbMTx6-MoYfX0Kim8sgM5x743d43Yw,5453 +torch/include/fmt/printf.h,sha256=ABFtjCCS6eGClewCRANlC96OpciN-JSdn8Y6rMEAbfI,20874 +torch/include/fmt/ranges.h,sha256=wE4VGourEwVR8FXVmWzEPqw2bi_67M9UdiO18yNFs-E,29236 +torch/include/fmt/std.h,sha256=kBTR1q1hrPjnxoFwPLqSc5J74Q9js7rq00FuR0-e16w,24518 +torch/include/fmt/xchar.h,sha256=wHIPLQh3nrr1-g1zxZQJJ9ycjpX4ZZ6mGXelC45GqV0,13713 +torch/include/fp16.h,sha256=ayMl0qDgaBMIVxGAv_3oB2qTLENpmg43GuvhRBH-ZKM,411 +torch/include/fp16/bitcasts.h,sha256=SZmKkxwSsO3Hc1PkoPzsTY9sK9rWi_qHLMNc6FROOes,2504 +torch/include/fp16/fp16.h,sha256=crCeRZAoUxlId3rbI76BN2jtZLczNOvap1E5NtH8rdQ,22712 +torch/include/fp16/psimd.h,sha256=OV7T7OCtY-mwENX2EfvS92rjrGwTYgd2TLiR9q7mcrY,7235 +torch/include/fxdiv.h,sha256=SNhRHZ7J369gW0GFJxirLceAeQFhpd2CAnj0H0hAMOA,13833 +torch/include/google/protobuf/any.h,sha256=AgsRfydCgu5IAA6YvlxrE4ziIcUKF7LVkBfKL8MqLAY,6589 +torch/include/google/protobuf/any.pb.h,sha256=BH1zmNKV3pOX84H4OWyzO3Dv6QNqN2F10nDm9TlgRCw,16115 +torch/include/google/protobuf/api.pb.h,sha256=JoX5lHd5qVDBqPdJh6qTB6YurqHVM_O0f4AmxW-F7Pk,57844 +torch/include/google/protobuf/arena.h,sha256=BNonEqo6lXNgTTUdaRD8pa4A3qKDtXkF7TVQBzJkb7w,32324 +torch/include/google/protobuf/arena_impl.h,sha256=-ZOi5xXdQJe8qcTjWhg_9c43s7pTgN8TZn6NiqULwYE,14944 +torch/include/google/protobuf/arenastring.h,sha256=DrGWv880SwOOmkLUHzMaWAr_l6zJdiLditlqmoapb-k,15338 +torch/include/google/protobuf/compiler/code_generator.h,sha256=THqpFqln8uBEIDvLILiOuFOT2HpSEOuXBuNKaF7YS_E,8304 +torch/include/google/protobuf/compiler/command_line_interface.h,sha256=ElLOZCBgs8aoJlOpd6GHEIW4n4LcuiOIq2i3XneS_mQ,21151 +torch/include/google/protobuf/compiler/cpp/cpp_generator.h,sha256=wYeYBE_8IlVKTWPkAFdzE06eQM30W4Wm2MrcM8Mdlb8,4534 +torch/include/google/protobuf/compiler/csharp/csharp_generator.h,sha256=KT6GNSkkQ316JR5JLyxzq2PB7aa5VcpUODoZ_22woqQ,3131 +torch/include/google/protobuf/compiler/csharp/csharp_names.h,sha256=q2w0sUIvRDJlL9FtQ-OgJRaDkQeP8LAtqRVvweQ35rQ,4456 +torch/include/google/protobuf/compiler/importer.h,sha256=bGiyYv-z-RUgyA6MOL8u-mY268nPM9ylMa6KFQUCzw8,14851 +torch/include/google/protobuf/compiler/java/java_generator.h,sha256=P6xSjhxtzrGcioVZpmj53HQWgnXSeLO-tcae5YsEn4w,3399 +torch/include/google/protobuf/compiler/java/java_names.h,sha256=0xPBQO94sPfz0ZmdjH1KFETO1uMlaCzXOtqf9gBFzFE,3980 +torch/include/google/protobuf/compiler/js/js_generator.h,sha256=LGzwlJyYZyeoX9e_oCJcP_Bm9IK7DNpLmfn7tYVSqgQ,16528 +torch/include/google/protobuf/compiler/js/well_known_types_embed.h,sha256=xBMQSxsQUacZNzBi7tx7VlI7cPp-Cepu-Coz7XeqvWU,2283 +torch/include/google/protobuf/compiler/objectivec/objectivec_generator.h,sha256=YoYrncqsnj2o3RFmrktVTxq2t9jHfGedKXnnGrLsw48,3771 +torch/include/google/protobuf/compiler/objectivec/objectivec_helpers.h,sha256=J-24ZwIV6ES-L_OnivGoOZ1m3fWdbJI1x5FGZewrV0c,12881 +torch/include/google/protobuf/compiler/parser.h,sha256=RyRcGJVyNH5-5GYZeacQk3iDwu8DXhUrH5z8qGyAjTU,28687 +torch/include/google/protobuf/compiler/php/php_generator.h,sha256=SVtSlQmVDenjR6eYN_cGK1SH_NGp32HQhQ8oTsOipKA,3953 +torch/include/google/protobuf/compiler/plugin.h,sha256=8NogmEzbPcUttaBo8b7rCHTVYeLqrIc8GbCoFVO4Amk,4702 +torch/include/google/protobuf/compiler/plugin.pb.h,sha256=dOlEJrN_MklmJCp6pS_hpo5ygu9K_NQlKl4iTaF6oDM,78404 +torch/include/google/protobuf/compiler/python/python_generator.h,sha256=FsTLrlCJS3JjXb_tYNQaAj7B_Jn9sdWTtscmM1eQQbQ,8178 +torch/include/google/protobuf/compiler/ruby/ruby_generator.h,sha256=9lGSV_zYGhACPDg5IdJEPM68pmNPHfRDGOFQWvcey8A,3138 +torch/include/google/protobuf/descriptor.h,sha256=fLWcFBeFfDWBiTFa9uOKYrwOG51Vy0hEMnyN3Vjh3OQ,99076 +torch/include/google/protobuf/descriptor.pb.h,sha256=lFcDnKViUxRBdbx6eNvxrb3KNQ9eFvd8Urdk060YtUc,557910 +torch/include/google/protobuf/descriptor_database.h,sha256=tu7EJ6e05Q-CQuxcaz0pUQXUq4v9w_ey7jOytSsmPR0,19418 +torch/include/google/protobuf/duration.pb.h,sha256=KdMZvNJqrPLLqq39xTZrFWvobuTKeiilBR8zD6XrfUo,10400 +torch/include/google/protobuf/dynamic_message.h,sha256=68KX8THJ4cKYjxYHvn3V8-ZdhuD41My3qkvpVzy3ckc,10484 +torch/include/google/protobuf/empty.pb.h,sha256=SmtM99AIQwlL2B5x_MMtWLca_2rMEHThcG6K3QDBQKw,8154 +torch/include/google/protobuf/extension_set.h,sha256=qcM2gaXgwlo1yli8FSpWLhKe6H6HRbN_JNHrrFe_4UY,80308 +torch/include/google/protobuf/extension_set_inl.h,sha256=AhK9Mnh6Su98TBwpFHzYAaGJQi0zd5YD0pdHANVdswY,12972 +torch/include/google/protobuf/field_mask.pb.h,sha256=kMXfIf_slBenf24oNQIL-NCSfrOGNgXuzQJpmsG5C6U,12398 +torch/include/google/protobuf/generated_enum_reflection.h,sha256=b3lZnUEcw6f_paqkWH-alTnaJKYw3w3FFMDOEJhUzsc,4350 +torch/include/google/protobuf/generated_enum_util.h,sha256=9eJSEbnGCBcU_lUkmXp6VMEbKfxDaCn35vbNthuVeXg,3608 +torch/include/google/protobuf/generated_message_reflection.h,sha256=0FU7EnMeMeGfoGjwVr_aPcVhq-C280Ysyavo5rgB3q4,13634 +torch/include/google/protobuf/generated_message_table_driven.h,sha256=joxD6UoNvmm-RT9jTPY6q81nuuAJcfBn4AD4-_nZ8A0,13208 +torch/include/google/protobuf/generated_message_util.h,sha256=WMZKnH9qF6mVYVmbEklp9-DN20y1fVWnmxJZOwUvn7I,10079 +torch/include/google/protobuf/has_bits.h,sha256=U0qjQbAvW2X3qMiu2O9y3a8Uo8zjAX8S4Gv2LlVSdu0,3903 +torch/include/google/protobuf/implicit_weak_message.h,sha256=_EKVnftFsHjRFySvV5Rb1e44Sg65gcnOVGuNnGKKakc,7463 +torch/include/google/protobuf/inlined_string_field.h,sha256=PyKcUgvkOKRZsmdClY-sRKcPkDC5ciSr0TNpmMfp9kc,9851 +torch/include/google/protobuf/io/coded_stream.h,sha256=VXvxlND1kZCJuRPom3vJfJFgIfooNGuCXMRXKbAu1xI,71349 +torch/include/google/protobuf/io/gzip_stream.h,sha256=Uyxa9wlufODhkulxsBQ_KFOe8-SHJ_sEm3blhTMBRaU,7143 +torch/include/google/protobuf/io/io_win32.h,sha256=pCdYmGXSEkwCIVYH7VnFvulddWYFuobLyWjF9X1s2AI,5782 +torch/include/google/protobuf/io/printer.h,sha256=54Rkpu5vHGCevNBf2_1dxjsp2wS_zLFn_VH8V9U1gfk,16578 +torch/include/google/protobuf/io/strtod.h,sha256=-5XNe6D68WHt-eQigca3vvC315WWrz6bDAR9hXnMwUs,2745 +torch/include/google/protobuf/io/tokenizer.h,sha256=gdxd58iBXQwlBQLb5oKCN1yzBReQWRDYojENDZMpAiI,17429 +torch/include/google/protobuf/io/zero_copy_stream.h,sha256=_3ZrUzjvE5ftN6gYFzJI9OSOIYBBI4n3FyCVIHVyseA,10770 +torch/include/google/protobuf/io/zero_copy_stream_impl.h,sha256=vOe3mD2dmzJDLOaPbeqsxyw-VqhrqF8HQSkH-WwHx0I,13785 +torch/include/google/protobuf/io/zero_copy_stream_impl_lite.h,sha256=d_OBC-LSkMtr-AGy8xWCxJFjeQMqPT4_HEX-DT_by4A,17491 +torch/include/google/protobuf/map.h,sha256=2olJt_2MJsKvmW9qHs-GpGkkPmROM8vQ32NULhJiW2M,46288 +torch/include/google/protobuf/map_entry.h,sha256=oiOuJeJ1Ob-XiKAYZ-0YoJ1txTa04veOUB47MEA2AJc,7702 +torch/include/google/protobuf/map_entry_lite.h,sha256=mGdZtVvT74kzccF2NWQPmTfIL5PI7eKaNcrUMGeG4ew,26808 +torch/include/google/protobuf/map_field.h,sha256=eRjhi1m3gTn43iM2y91-j98nqeOasqGkxNx1CF0AcC0,32528 +torch/include/google/protobuf/map_field_inl.h,sha256=1X1xu_nnqdG-_kqTXGYZjlAW9MWy1YA66nXUvy6FusM,15128 +torch/include/google/protobuf/map_field_lite.h,sha256=9WK8hkQRhnpjeQairYKSIk7eXrUjcRATNOJ3VScFpwA,8008 +torch/include/google/protobuf/map_type_handler.h,sha256=P7G1Yek79IMZbs8yqBQgY_swpZRbViBRUGF4ej8O3c8,40148 +torch/include/google/protobuf/message.h,sha256=psrhBrc87Dy3J6ZH-zi1VjWtQ54J6Q7ZwYLB6_USbZ4,63829 +torch/include/google/protobuf/message_lite.h,sha256=YPFxehhycoV5b7lhuImfHsP7AmyjyRfNdrgfxzlAMh8,27437 +torch/include/google/protobuf/metadata.h,sha256=Hml-32QocGwFF7mfUpVHugxYqPI4sbGOmArA_eig9PA,2152 +torch/include/google/protobuf/metadata_lite.h,sha256=zcS-BoeWOpkoGodm4PL90C42ZjawOFTiRP0HpX5UHDg,8767 +torch/include/google/protobuf/parse_context.h,sha256=wxpr0cmcdjL7ihHzSE-pzA8riLqYmwKwUdeb5E-Ke88,30682 +torch/include/google/protobuf/port.h,sha256=Ii3U_x6sOx2qE9SpFuqdB8R4Bik0ld7-QQYRR2acqbo,2352 +torch/include/google/protobuf/reflection.h,sha256=OCuBq-7YuTtVldxC24SxR-3vVCFJfFxCaEQHvb7fWeY,23539 +torch/include/google/protobuf/reflection_ops.h,sha256=GLuMCe09q11ue_vvWwEt3tMjKW-H4TDX_T8G2k-qTlU,4160 +torch/include/google/protobuf/repeated_field.h,sha256=yM9GwFw2WQCNZK9wK59p5G1ijncrp-Nl8qeWtRsgRLI,104697 +torch/include/google/protobuf/service.h,sha256=6lyhtGrXUU8uRw1xihhiTCoRA4RF_nGvGlOQZMlSM38,13711 +torch/include/google/protobuf/source_context.pb.h,sha256=Qva-Wt9H88rpcy7XdgD-DaeV9jH_ycbS9iK0I4dUCLM,12084 +torch/include/google/protobuf/struct.pb.h,sha256=Pg90DvP1NymPd5vI-LoXovvTI5nhlLMJV49EsLxwpjo,43735 +torch/include/google/protobuf/stubs/bytestream.h,sha256=8xIHR6vmQCmltASHMtImlT3sA4ZOgEGoDAju1wm0K78,12369 +torch/include/google/protobuf/stubs/callback.h,sha256=ePqqHWCmqqMvW0ljlwoc-E0G-kekDAsjDjykrituKDg,17920 +torch/include/google/protobuf/stubs/casts.h,sha256=CwHKV7qWf0C1d6bBHAbVBd18-55za7RtfpF7dnja8fo,6131 +torch/include/google/protobuf/stubs/common.h,sha256=mLkXY1VNMptH8Kn_N_Yi9ovNFG8lH1-DvmtCSZaEs2I,7744 +torch/include/google/protobuf/stubs/fastmem.h,sha256=Gc7-Ro0NCJ9SNJEFUYkdkbup8PIicJMV3TEhRPDmWto,6432 +torch/include/google/protobuf/stubs/hash.h,sha256=jLCeq1Wnwkrdxtpc8OYc5idbGXhJl1FuXGcszRjoSTU,4497 +torch/include/google/protobuf/stubs/logging.h,sha256=07rCZEZ4WfaaMy_y5_CsbWDUP3qKOqN_jVTXbLI5Wlk,9415 +torch/include/google/protobuf/stubs/macros.h,sha256=rXGOqSs4hVa8Ivh3BTvVGwOqgsrfMdHMng8Dz02z8rg,5282 +torch/include/google/protobuf/stubs/map_util.h,sha256=BI1kcfs_0vBiLnCpya25WStLs_ZqTgJXUrIgfT9DrFM,32241 +torch/include/google/protobuf/stubs/mutex.h,sha256=uQox_OPWioTi23FreZdS5UHyR1BPnHNYxU1j8oxv_AE,6602 +torch/include/google/protobuf/stubs/once.h,sha256=CXEJDghHyaHC0yQ44E6isArIZXdsGGecvDZjoTPHvok,2498 +torch/include/google/protobuf/stubs/platform_macros.h,sha256=vRdfGFvSBt036nW8-WxHXC21w231PpgS1ykpI_Q1cMg,5501 +torch/include/google/protobuf/stubs/port.h,sha256=_lAXcdEYDtBq-zZJIQfmewxskykdtcusojHjGquXDmg,13408 +torch/include/google/protobuf/stubs/status.h,sha256=V996Aqv_UECTek8DTN4DzohnZj1EPLbZ_H00XJ_03Gc,4323 +torch/include/google/protobuf/stubs/stl_util.h,sha256=4wSq5M5metYV_Za60eeC88kijCcQ3UDonpFpVSWLPak,3613 +torch/include/google/protobuf/stubs/stringpiece.h,sha256=9KhV8z6x9RSTBI7rZzs8s7U2ZuISl-qOvUzzYfzCNFM,18609 +torch/include/google/protobuf/stubs/strutil.h,sha256=gAulnTWm9iPPjKWe-uTjZq0wzLuEmUhTIRMQ4ZOYLiI,39983 +torch/include/google/protobuf/stubs/template_util.h,sha256=ymHdlQ_Z8qUtHegXSjaF69vBsKPvLs37aJZB0MrBeEc,5231 +torch/include/google/protobuf/text_format.h,sha256=CYiVIfSKWaVPbMiuXrtZKTWHx_hqWIzb1s2fqsZEtGk,29896 +torch/include/google/protobuf/timestamp.pb.h,sha256=_FxhJoYILnGVQhpqlvx0rSpakyl9xWkA8nALHVaGRDw,10463 +torch/include/google/protobuf/type.pb.h,sha256=qmF2LzQzWSfj86_mSchBaLUze7c8tbxpBZPg5mpyLdU,99644 +torch/include/google/protobuf/unknown_field_set.h,sha256=sKf5ywjByjLwzKvHgJ085n2IYob8NnJztbvW95PO6F8,15071 +torch/include/google/protobuf/util/delimited_message_util.h,sha256=SIFXa2vzkwc-cXSHa-ITEa2uRRA6-say0HnfyZxrddQ,5766 +torch/include/google/protobuf/util/field_comparator.h,sha256=4RjQVKxdLIW8YsSY9TWGPJfMGJ0O8yogGm6tmNMk4f0,11021 +torch/include/google/protobuf/util/field_mask_util.h,sha256=Le-G_frN2Hm3hCKChZQkH-uhQfpjCmbyt1QEmMsOI1o,11897 +torch/include/google/protobuf/util/json_util.h,sha256=4-_BpFBtnOZkYhK8RE73VXxnd5ooWklgcVFS8olrjRM,8891 +torch/include/google/protobuf/util/message_differencer.h,sha256=_sCcGalUIE7hBYoEavSWca-kB7gfm0mVCZgz99-7Ftc,46473 +torch/include/google/protobuf/util/time_util.h,sha256=PkwpqsthDH_J3cPblpxOj_YUhMAjXfyOzpd-qvaZzes,12724 +torch/include/google/protobuf/util/type_resolver.h,sha256=u-aX21RrYP0wCeqPC5-EWP2hVO028FWVdPAveahefm8,3187 +torch/include/google/protobuf/util/type_resolver_util.h,sha256=dvOo6D1VtiFupiQbiuzm0RfhHuj8CKhaNJbhGj86EW4,2723 +torch/include/google/protobuf/wire_format.h,sha256=xMJgLyPtws8DXZL4y03TLV_jcGUFaL2s-XzFOcLb-OI,18326 +torch/include/google/protobuf/wire_format_lite.h,sha256=aEBtDD-cH77j5dUBVrtYsbL_s1rX3GXpBErmK_T6nck,85773 +torch/include/google/protobuf/wrappers.pb.h,sha256=W5dRwjLeXJM2JDO2NPcddN5YAgtdHnA4Zch_8kAykWA,61049 +torch/include/ittnotify-zca.h,sha256=LJmLYDo514Ig1FKUhWTcT15mJs0issvZGdzJLisg9Ng,4093 +torch/include/ittnotify.h,sha256=nxb-ncEvSoCkTD1bt-rKAY53sxjLNSfdPVyi-Oc8GuE,201765 +torch/include/jitprofiling.h,sha256=mYevNnKUrgpTSwgfT5D61nXfDYn2T1SkRv6c753LsB8,30519 +torch/include/kineto/AbstractConfig.h,sha256=DfszbZn_-gHT2ta7oZ37BNIJL6x5Ws6hfyJzeO0sp6g,4161 +torch/include/kineto/ActivityProfilerInterface.h,sha256=whLs0fojKt9hCh8FgTxfadm38Mc-JykoEp4e1WYD-8E,3919 +torch/include/kineto/ActivityTraceInterface.h,sha256=ls1FbYT0Tkycg_IJ0iDeuvwTKSY3_HjD7gWBinsIHp4,871 +torch/include/kineto/ActivityType.h,sha256=NuZ2zBKOHOvgnUbpf8M0KHAjR5erS3mtXn3kfJwADnI,2671 +torch/include/kineto/ClientInterface.h,sha256=xz6Jf1K7YtvoSpNSNdRGOJfwnnC4QYYwlHcRxvRUkjE,942 +torch/include/kineto/Config.h,sha256=6__C2hAzUzfs4AuhZiTbdfFN0qZ6uzBZAYWA3BOfmVo,16504 +torch/include/kineto/GenericTraceActivity.h,sha256=wHqYSquvzdWon5Wa_LYH9spqkpKuUdJJVxZ5pUdvrIs,4315 +torch/include/kineto/IActivityProfiler.h,sha256=bRHEJZZu_o8NT0wwcwd5dOfHPn_JzRKuh8P1O2eY1mU,5540 +torch/include/kineto/ILoggerObserver.h,sha256=m5QQEeUUsEM7gytxH3LNpS7KHrS8wbdQ5jy00KMez9Y,2249 +torch/include/kineto/ITraceActivity.h,sha256=fI7SNruqg6tio6iIKXx8rtDu0-Yc5wzTo5o7TuKWHM8,2371 +torch/include/kineto/LoggingAPI.h,sha256=HH2C3WZMtAJMr0QFfQB6xASjYRNJrmkLvKs9YWA6yVM,619 +torch/include/kineto/ThreadUtil.h,sha256=LwShoDfqv3PwUkUFhMjkY9o9OK4oslug8UVak_NhhZI,1220 +torch/include/kineto/TraceSpan.h,sha256=1i8AEt7rt5bw21fuic2gt3sZTq9grjdA_dNcShz2Dqg,1273 +torch/include/kineto/libkineto.h,sha256=R0Ini7PHFIPLxgbOLVDPjlIg9fzLyJYN_SEEbPvCLQ8,4307 +torch/include/kineto/output_base.h,sha256=uRKS3tFzLE6OZdv44cawJ-WkJtDECAiv4BfltkwRP9E,2501 +torch/include/kineto/time_since_epoch.h,sha256=ctlnJTpCbJQWmAD2_IItEtfjTy44i-m1CgXPyZbAACI,796 +torch/include/legacy/ittnotify.h,sha256=iKhYLHF36oDPhzmf7E0vC1BD9cpikQm8ARjHKl_PEPc,38637 +torch/include/libittnotify.h,sha256=ouBr-RwnvHfdv3ayOUlBhf_lz8ih-kGsB4Y_2vkDzuQ,847 +torch/include/libshm.h,sha256=lKzH3xJzIhWA4sPiI1KbI_lFCwN7h6ROGV9vsoSRmK0,1074 +torch/include/mimalloc-2.2/mimalloc-new-delete.h,sha256=tz0nMLVSPRAbx8hBIKZa3gthBQ27c9N3zkd3oHNIXcQ,4369 +torch/include/mimalloc-2.2/mimalloc-override.h,sha256=fJt2CQlyEskk-bpW_V-6NPmeEpPBjiJOti-jn24f2tw,3492 +torch/include/mimalloc-2.2/mimalloc-stats.h,sha256=DabW3mFlWsM8Ng8uwO9lTMmSf-cWO1tkEH5eHXckFHw,4409 +torch/include/mimalloc-2.2/mimalloc.h,sha256=EHpoKX-k8mknB2DQ6jHq0738vP8T5EOagwwaGc_5YBc,40975 +torch/include/oneapi/dnnl/dnnl.h,sha256=6-NMbrFuTFuTeUZrSfVQMxwtUb--QClIriyLa_nidd8,188093 +torch/include/oneapi/dnnl/dnnl.hpp,sha256=4HewrW-J0WElVWzmpPU2296qZ9BfTMFDHM8ZYKLh5hQ,663625 +torch/include/oneapi/dnnl/dnnl_common.h,sha256=SjX4Talvh_a4CGqD8uElCKFoD5cfEQVVnBk2pE-Vm34,6090 +torch/include/oneapi/dnnl/dnnl_common.hpp,sha256=MCno6o5iuSmd602vnAYRTTZUDxzG3-hS4UHaM-9Wl74,16451 +torch/include/oneapi/dnnl/dnnl_common_types.h,sha256=vK_3_kgpBwe3hTKbpVAN8HYH2PoVl_2M_qNKaPTJ2T4,8724 +torch/include/oneapi/dnnl/dnnl_config.h,sha256=WCysEboKaLKJg3zV6xnw5gp7vG8WVh4Oq-ZM23PuLh8,6726 +torch/include/oneapi/dnnl/dnnl_debug.h,sha256=p_DOuK1cTKZYrViISeeLfX82kM_NPl9euWtetFK7-UM,2630 +torch/include/oneapi/dnnl/dnnl_graph.h,sha256=nM6uGBZfMrLcAORdJuaYBDjeWrojfdUy6uOv69vk3wM,33757 +torch/include/oneapi/dnnl/dnnl_graph.hpp,sha256=2zZRT4m7t8tg4Z2BcI_WjzJ2zLsx_CGgWR3B3gAi1oQ,67317 +torch/include/oneapi/dnnl/dnnl_graph_ocl.h,sha256=_vLvhZbg-rzFCKbQD5T2x2l9wLpAXhm69az_Z9uNk1A,6336 +torch/include/oneapi/dnnl/dnnl_graph_ocl.hpp,sha256=9G_wE3jFnnwz9KiERAcM3YiXsf28XVfEyTMyxRmjK64,5848 +torch/include/oneapi/dnnl/dnnl_graph_sycl.h,sha256=H32pSSWk-reSvuKT5sJ2SZmJ0IGQdgP_R07mm2OSSeI,4011 +torch/include/oneapi/dnnl/dnnl_graph_sycl.hpp,sha256=Wf8Rv9Dc-x9BrIlD1N5sj1_aL6aGZLbrMK2mT9jwZ8s,4727 +torch/include/oneapi/dnnl/dnnl_graph_types.h,sha256=1ZHllfP0HHbEhLMSWQ7OQFFFrt5wqo8SOxPMGpFPhv0,17534 +torch/include/oneapi/dnnl/dnnl_ocl.h,sha256=t_XLM4iugv2zmQznZ9P8MNiVdWCDm05minNJhPnR0ug,12394 +torch/include/oneapi/dnnl/dnnl_ocl.hpp,sha256=rok3kFjqJ9DJI4YsldQWP6FRHUdLQuzmKCAPN18aFzI,18483 +torch/include/oneapi/dnnl/dnnl_ocl_types.h,sha256=OuELq1V6ISv1LmugUNgBbRLi4v772kAJSb6M6w9gUEI,1648 +torch/include/oneapi/dnnl/dnnl_sycl.h,sha256=u6jz-Ih2zuIFgW0PxaFXe02lTN59hobKnXPdouYA7QM,8810 +torch/include/oneapi/dnnl/dnnl_sycl.hpp,sha256=H0VcFniD5cHBoYn8NBNw0KaSDGLd9zssvglgBvO0k94,15487 +torch/include/oneapi/dnnl/dnnl_sycl_types.h,sha256=LjNXj7nz6CHQ58zmPXjScKBX8lGEHjtkhZucpZIz5vA,1660 +torch/include/oneapi/dnnl/dnnl_threadpool.h,sha256=scqN9OlIt5Y61E6FHJgPUdCo3M5CGEe0gMKNiTb2fRM,4901 +torch/include/oneapi/dnnl/dnnl_threadpool.hpp,sha256=34OIVbfXZuO0qTGyZf5NT_gfjpOTtN7L3zvrp2NF8qI,4699 +torch/include/oneapi/dnnl/dnnl_threadpool_iface.hpp,sha256=xeTbNwDxuli85sZN6Wq093ByfKyCAwYZ6njPQ5-dn94,2538 +torch/include/oneapi/dnnl/dnnl_types.h,sha256=xJ9eIOMbpTW44rYtSAvd71oMRzAHKDrHbKCc55wmIQ0,101587 +torch/include/oneapi/dnnl/dnnl_ukernel.h,sha256=hpBSVv7aqC2queOCPQzfTI7Dg680m44_khjyct_zFSo,14112 +torch/include/oneapi/dnnl/dnnl_ukernel.hpp,sha256=cEmOE1Pgi5tj1_gHfu7fc_RGHp3B56y2QkgLuQF7U90,18048 +torch/include/oneapi/dnnl/dnnl_ukernel_types.h,sha256=kuwufjbcf35gOOFIUdGTGbqC51FhKkaasVpnerPM8fI,2969 +torch/include/oneapi/dnnl/dnnl_version.h,sha256=jBVtYPVGzEq5BcVTn2RRht5kjuF346zI-6tEFbMne_0,1304 +torch/include/oneapi/dnnl/dnnl_version_hash.h,sha256=V1zEmFjsvZWe92_Y9vAEoG2vFQjoEDgkcRmpV2zGjbA,1536 +torch/include/psimd.h,sha256=DJ_Gpr697395F-WZ4DAHvWggxz2l9MhQXJ2vW48ewQI,47147 +torch/include/pthreadpool.h,sha256=c-pRI_4H3QwUsYVonedqkwa8PhbEo_FUZC1QaHfzFI8,102142 +torch/include/pybind11/attr.h,sha256=jJgLq-Cj7V9JVzw-KTDe2f-IxzGT1-rkeIe-NOBMR48,27204 +torch/include/pybind11/buffer_info.h,sha256=Ci3F0HCG4h9PomCN5ot-DZmsyj1xub6RS2adyeG4dz4,8245 +torch/include/pybind11/cast.h,sha256=0qhlukRhNW1N36-KT7-lKPmAC9Adq03xGRzbEgkqzl4,95859 +torch/include/pybind11/chrono.h,sha256=_aojCni6adQrZaR3qt3EDHs_TW7ZHh27GZweByBcHVA,9100 +torch/include/pybind11/common.h,sha256=wQ0hSFgo-5-PFCSZ8EVF2QSt7HjDDWACXCw0cve9Jh8,381 +torch/include/pybind11/complex.h,sha256=rZwsrTC3JtqidanHyihL69LdKH39xA0xanV0oq0HCzs,2429 +torch/include/pybind11/conduit/pybind11_conduit_v1.h,sha256=prK2pqYCA-zThq0YnW9SnWJLoopXgTw37PoOy7Vohyg,4528 +torch/include/pybind11/conduit/pybind11_platform_abi_id.h,sha256=o8cCg11cSWp2OHh4NWAFYEsohkh5tPvZvLdpdV933xs,4337 +torch/include/pybind11/conduit/wrap_include_python_h.h,sha256=bhDz00ygV7x8rFDCFFlxjkNnmiuDJoHjxu2Mo1oU6yE,2400 +torch/include/pybind11/critical_section.h,sha256=YQetecAHKBhKZbcRox5E7_RMhwQMK3nZtBOMwsnVAK4,1925 +torch/include/pybind11/detail/class.h,sha256=zqjhocxN6p83AIkHp9l--Oe1WgnYnlYd6IUT3T97YNo,32318 +torch/include/pybind11/detail/common.h,sha256=fLVfid6pjBGUTZgncwZHnpfKwGHb9auM1YJeyd7uouI,61523 +torch/include/pybind11/detail/cpp_conduit.h,sha256=DRBbanFWzNZSc4QIlW_KfgwjBFhtcHIxuIL9zUEbCbM,2887 +torch/include/pybind11/detail/descr.h,sha256=KnOSYzmbYsC6QQTgKkFP8KFrSfOFkdb-T83zEQeymL0,8546 +torch/include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h,sha256=W2B4giwBDDMLrNpJiyfnxV0LfSwZcmFSfKEVjhsSRok,1474 +torch/include/pybind11/detail/exception_translation.h,sha256=zjJ1X0WoxUJAu4-KCfkodE5Y1ctxfhMLqMQ5YjXFv-g,2923 +torch/include/pybind11/detail/function_record_pyobject.h,sha256=G3bUGqc5wksoIjiI0JFiuRxvQBGrQjwVUhvmUHwbDF0,8188 +torch/include/pybind11/detail/init.h,sha256=IiKfqAmUvixocfZsOSaKPoAz5MAvmpbAjbKUGM2e5KI,23870 +torch/include/pybind11/detail/internals.h,sha256=6-6ME1dWMPDBmwXFtuvAOYKp_r3-HojGk9ayES8-L6g,33259 +torch/include/pybind11/detail/native_enum_data.h,sha256=8JbVa0Nkr--wU2F98suR2x5JCtDd64VO6nD19hjaMTY,8101 +torch/include/pybind11/detail/pybind11_namespace_macros.h,sha256=elReLUQCm8QuiWoeo80ONdsj3TmrIhHUZW8N3KYAbE4,3842 +torch/include/pybind11/detail/struct_smart_holder.h,sha256=gnwp5qmlUf9AQpR43QZfQLJLCGgvVJSYNvyxX41MliE,15709 +torch/include/pybind11/detail/type_caster_base.h,sha256=UPtpcPWOwh9qVCRlzZxYhFqa9bKjzn1KaY6Fq2lEPN8,68043 +torch/include/pybind11/detail/typeid.h,sha256=bL78f1Htt_pCGz2-N2SAn-CtWVJ4kDrIFa-9bQeAFDs,1949 +torch/include/pybind11/detail/using_smart_holder.h,sha256=3ITR13o3XOqrlxv_VbTJszQKEr-l_DyZCTbllRQaY4Q,821 +torch/include/pybind11/detail/value_and_holder.h,sha256=Zz3EnT9K0Ifpp2dpE2WTfkvn8VejlQhlG6RGGM4Xtfo,4026 +torch/include/pybind11/eigen.h,sha256=lIZ7i8FtIOfoEVzrH0W3XMHZqUWyDM6k-RPrkcW9WAc,587 +torch/include/pybind11/eigen/common.h,sha256=v6X3g6l4JSe8FDsDWRt2stkdomGYsqjRTG-BUpod1hU,646 +torch/include/pybind11/eigen/matrix.h,sha256=wqICvqGF_bfeUi_JEXlMIa9EchQiLeEX-IfNTuReKtU,33572 +torch/include/pybind11/eigen/tensor.h,sha256=VHWBfB0B4edSS8iauX9KfMVcjvGcflyv_onPE7k0LAo,19440 +torch/include/pybind11/embed.h,sha256=c9a-PfSW2wPslxVYMXFlQIs2_TG_x6n_7BG7HYj6ffU,13215 +torch/include/pybind11/eval.h,sha256=q60xP6JS0ucH28rlsQORNzwJ2rDK8N1TCbl67eg909c,5282 +torch/include/pybind11/functional.h,sha256=OcbBbh1NkR1PrppfCKsPsKA2OQ0-lxr5O1HY0l8Ag88,5750 +torch/include/pybind11/gil.h,sha256=srJEMJ2qet977kyTR1pnVYdFbGUtmq6SPSgE5bN3JDY,7201 +torch/include/pybind11/gil_safe_call_once.h,sha256=1CX04-gevmEBHA1a_1MTYYzshVbZExhK5MxKv1DxcPY,4415 +torch/include/pybind11/gil_simple.h,sha256=Mqe3BVtl88O0woRN2CO-khnxvpsLOISluDrjQXTh1xQ,1481 +torch/include/pybind11/iostream.h,sha256=2fpCfc5Z8D5f8xpP-3cSmu5-x3hLvRNG-gH-wt5aqEA,9386 +torch/include/pybind11/native_enum.h,sha256=MdK_pwPsTZgzxz8Om5j0qwUrUgixXnbL5IsQa8hmtyw,2803 +torch/include/pybind11/numpy.h,sha256=nWh2Y7UUuDNjXnpYwelQ9O4e7tGe80PJkL1Gv8FB9Y4,94148 +torch/include/pybind11/operators.h,sha256=yMhZCAtcy_EHEKMotDqg_5KijPmhfdb-hadb6muuHP0,9564 +torch/include/pybind11/options.h,sha256=fAYGf5Ps3qffforUfS2_IVKc3m_6ZeRAyQ803OsCqks,3085 +torch/include/pybind11/pybind11.h,sha256=5Dt8ohy-rPZV9BkAAP-z1NNQovAgNyo_bx_YZabofDk,164583 +torch/include/pybind11/pytypes.h,sha256=C-FP-_2lrZnrPwihjxARsbJC-Ozwxs-VmKSapNaTyV4,105137 +torch/include/pybind11/stl.h,sha256=y9OkONgDbpjIIy5fQv8WNK7gF5FziLUyslonjk18uKA,25667 +torch/include/pybind11/stl/filesystem.h,sha256=oVTATcWXoOZbmDdZtzpzU7wp_2v-FANG8qyWqMQALWE,4446 +torch/include/pybind11/stl_bind.h,sha256=_EKMXG6dIaTihYluV1XziLM-25ZkLqtIqKGbO4B8ok0,30763 +torch/include/pybind11/subinterpreter.h,sha256=9Y9PVQgE8jLn9pUTSvjbdYvDJH4xuGc-iRXmmTZVA6o,12025 +torch/include/pybind11/trampoline_self_life_support.h,sha256=asc2caIQbyR6-NYtxQfqXMoj86DTgZY0HCwF2xX5nzU,2997 +torch/include/pybind11/type_caster_pyobject_ptr.h,sha256=A0SIxliasut2MeFQ4UrIcetKZd5zButA8kPoLBr77-Q,2249 +torch/include/pybind11/typing.h,sha256=NERuo55H0E952Q2DvvzcZJuRTn-DZ09YSl7ZwOGai6s,9448 +torch/include/pybind11/warnings.h,sha256=l2STQC_9D4iLpLJCEo5dFkJPI13TTjjcWCWvVzQCrTw,2702 +torch/include/sleef.h,sha256=arH4TBKBtBXq6qNTc0s27sjllpjhaR88Xx38lLTcVoo,273761 +torch/include/torch/csrc/CudaIPCTypes.h,sha256=_K1I3CliAJvHUO-XbOwqYvsuPpCYxLKghEZycbCCZSM,3799 +torch/include/torch/csrc/DataLoader.h,sha256=nmA4pT0iwYLeXLtBWipeBnss3PP8fINhXEoFQ7kTtqg,487 +torch/include/torch/csrc/Device.h,sha256=V_ZU84gU7E5LuNEiEB9iZ5JAeFCD98c9wo6DmvZfotU,766 +torch/include/torch/csrc/DeviceAccelerator.h,sha256=IgVSBFHgrwf9D_ocpzYo74zV8LrGuj5NONTWFF5K0rU,443 +torch/include/torch/csrc/Dtype.h,sha256=FfuOMEpEGWUyVjRUouVWsrQ4OfbwLjLfl50NRdRZIxc,1127 +torch/include/torch/csrc/DynamicTypes.h,sha256=5W9F3B86LfR0xU-cEQGvzNfzTHtqJ97r6ZNVgUmcrmk,1358 +torch/include/torch/csrc/Event.h,sha256=eHVgAMhGwM2gkC2gslk0e5_pMo4z_EbCARODEYow0NE,868 +torch/include/torch/csrc/Exceptions.h,sha256=LcbdCRvRERjsXMW9rgRhnJi5rjvIYymPiElL2hJRjj8,16662 +torch/include/torch/csrc/Export.h,sha256=vo4FNvmVxguX_b8s7ivE48svP4q6_URf8Y-J4B-r1YU,425 +torch/include/torch/csrc/Generator.h,sha256=0xm2tbkwBCTWlERXunrEBGyic1UAp9eBldvp0R74nik,1346 +torch/include/torch/csrc/Layout.h,sha256=0C6UE722JShY9Pmo6Yz4Y6QCJQTRUnlQWmZr1JJ-3tE,871 +torch/include/torch/csrc/MemoryFormat.h,sha256=asY8XjMQ13oGHCcCNGSjk0h00UyEVjyIucnctwJcDw4,970 +torch/include/torch/csrc/Module.h,sha256=2eG-G3kktoRclc2ltHVRTn1e5TmjGy3Va75WvUgZRlA,366 +torch/include/torch/csrc/PyInterpreter.h,sha256=coUxPIGjVdJ1D0j6CkOoRJ4PHyyG7lMJDzwB-S1NBBs,665 +torch/include/torch/csrc/PyInterpreterHooks.h,sha256=bKjZe2xC2RI_DCWBuWYz49ypgXhIKKsQM10sHF82uD8,669 +torch/include/torch/csrc/QScheme.h,sha256=sbQII7Mk812lrAXUZWmR4SRpxlPl1lhQzUu0ce1-HEg,894 +torch/include/torch/csrc/Size.h,sha256=KoDzNYD4Ycj2Uj45txeXhpOYYCI60hN3s4PiV_rQaE4,751 +torch/include/torch/csrc/Storage.h,sha256=vzLVKF685X_Bd-xo_yE4ndKy9LH74MAjlPZEv8QSeSo,1763 +torch/include/torch/csrc/StorageMethods.h,sha256=3U-xzO5lPVRL3XjJGZDpSdSJd5MHs3aDETPkjNjHLWM,399 +torch/include/torch/csrc/StorageSharing.h,sha256=fhcT2k67ZTzyhbNljo409ZPeMKQhIV_T-x-EMlKx4-s,406 +torch/include/torch/csrc/Stream.h,sha256=10lIctinTo2KWDoDPl1MvTRFYCxQsNPTV0G4PyFCoAU,996 +torch/include/torch/csrc/THConcat.h,sha256=71NrHyryTpfygxVQ5XMlJFNo8wT9cDB6nt8ScVzFAdM,969 +torch/include/torch/csrc/THP.h,sha256=XO3ZYjdEY6oGZMFCRfz_ggKv73jga1BiokCq5K-xSwg,788 +torch/include/torch/csrc/TypeInfo.h,sha256=cPRX3KTxroYybJ_8CTvYNU5HyVQqYxR43R0P1yRf_OQ,852 +torch/include/torch/csrc/Types.h,sha256=VXnXf82P1CslnBKajtEgdGThHGzYJpCkpRqRHeIKiTY,435 +torch/include/torch/csrc/acc/Module.h,sha256=xANqk0SylLVDdpmwNUhpnMH9YzVjc6FEgO3eX5iVp2I,441 +torch/include/torch/csrc/api/include/torch/all.h,sha256=fClpp53x3LzKvuGo4OQuk3RfJFr4SQcckuBUbWXduhs,846 +torch/include/torch/csrc/api/include/torch/arg.h,sha256=4UjZ8G1O1FDJ4PrTUjZE2HJyBuRkd-k04t95q7JQlj0,1709 +torch/include/torch/csrc/api/include/torch/autograd.h,sha256=mspaniT7WZiKCEuElc_SxjH9C3y2V7sWt4vJssre9a8,436 +torch/include/torch/csrc/api/include/torch/cuda.h,sha256=x7CFUQd6y0JOq-rrio1HRd9DZ0fBHZpuHLazBd1Bl7c,1020 +torch/include/torch/csrc/api/include/torch/data.h,sha256=al1dDn9L-RifdP_jVM2HtVUtJ0U_KDGNwSRUKOYk0as,569 +torch/include/torch/csrc/api/include/torch/data/dataloader.h,sha256=MJq2nvSUeb1CsDnTErsjZax-vF-hHmbSPsh6A6MzOPA,2210 +torch/include/torch/csrc/api/include/torch/data/dataloader/base.h,sha256=dnUFwn6BTBp42bfwzlP66oneOImR6UTvBt9Z9h1WDnI,9734 +torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h,sha256=7TE5HExyvXm6GX_dUWwK6_9hlDQsiwkpqiWBq_NdcR8,2655 +torch/include/torch/csrc/api/include/torch/data/dataloader/stateless.h,sha256=YTZzj6ZEPQgHbiks-iF6yrtZgqWrnUXLS4R8TCkOc6o,3085 +torch/include/torch/csrc/api/include/torch/data/dataloader_options.h,sha256=XMDDcQqx4-ZlNJM1mAwQPXdkAGlxtzp3WVBpN2A9HtE,2519 +torch/include/torch/csrc/api/include/torch/data/datasets.h,sha256=imjQyh9IAJqwNR8juDxoMulmwFdR1vN41b7AABIeynU,557 +torch/include/torch/csrc/api/include/torch/data/datasets/base.h,sha256=Oix-SxfPCOB-nRLpUNPwB3Bq7IYHayw7vq6QjyRnPQQ,3531 +torch/include/torch/csrc/api/include/torch/data/datasets/chunk.h,sha256=6T_DXGuoAwnkz0A8JOzUHWCTY-KHfJzwiLvco19IbNM,19962 +torch/include/torch/csrc/api/include/torch/data/datasets/map.h,sha256=WqiKObQJmOrXDZ5Eebs68eBUX7fNxoO6ndhi-7jSnvg,4445 +torch/include/torch/csrc/api/include/torch/data/datasets/mnist.h,sha256=ZHwB_f8MXLnV374t3d8oI9JnfjrNpBup6oOGHWRJnY4,1532 +torch/include/torch/csrc/api/include/torch/data/datasets/shared.h,sha256=9BZ87-ewQx1Or6tbLVQBwtNMPnXcwMVF7q1HtAPRO5Q,2933 +torch/include/torch/csrc/api/include/torch/data/datasets/stateful.h,sha256=E2ybGDgaH8uZBtUo2_zLn00GPOL3JVbK-jIgqrW31eI,2557 +torch/include/torch/csrc/api/include/torch/data/datasets/tensor.h,sha256=6mrbZLsihn0gwjewV7QGIVPXHxo2uGe-5AVv1RTtJBM,1224 +torch/include/torch/csrc/api/include/torch/data/detail/data_shuttle.h,sha256=Lfe57oMdvnUkwRx_TucWyZHrUfPTWub8t3G5ciG3Xzg,2927 +torch/include/torch/csrc/api/include/torch/data/detail/queue.h,sha256=nEmljJJvjQ5Tue5syuGcm89g6VF-y_hvntXwHzbUuew,2794 +torch/include/torch/csrc/api/include/torch/data/detail/sequencers.h,sha256=bBIKyS8W5yPpUyjBGpDhJ3vIDLeZjBLmR7gQCI25gWM,4806 +torch/include/torch/csrc/api/include/torch/data/example.h,sha256=n0L7SmuiOUys4XvSdokQkuG6BEQyxCc7Tl-wuUcMJpQ,1601 +torch/include/torch/csrc/api/include/torch/data/iterator.h,sha256=9ZtNjVmdoNkQWW46kV_5nuCBQe3P3x0fAHXSR73CPZA,5742 +torch/include/torch/csrc/api/include/torch/data/samplers.h,sha256=KiyydgryGEMjZ4gOgELtq42ycXdUehQc3g5cQwgO3_s,586 +torch/include/torch/csrc/api/include/torch/data/samplers/base.h,sha256=o7Q_KUfXKbEKBGYEMKEOgqD3IRUjWtP-qGFLrDzjLg0,1466 +torch/include/torch/csrc/api/include/torch/data/samplers/custom_batch_request.h,sha256=uZAqIZni9kEx8T5H-1gRPgBOa9FlGIgx24Oconh2CWA,782 +torch/include/torch/csrc/api/include/torch/data/samplers/distributed.h,sha256=V56RA2H1faC2d4Xuz6SLBYLdPKRA9elw4_-i3VmjfkA,4452 +torch/include/torch/csrc/api/include/torch/data/samplers/random.h,sha256=ArzGK84DdSwh1jyPle3zLP42HrvyF0SzfJ3Z6ANUy-o,1769 +torch/include/torch/csrc/api/include/torch/data/samplers/sequential.h,sha256=ivIzhZGQlAa2IhZ6R0ayEN6Xyf-uNbFSS0XKEHGVByw,1497 +torch/include/torch/csrc/api/include/torch/data/samplers/serialize.h,sha256=1y6IWWQHufo1LsNT4hzzO12FWgwunqd-2HuhFUu2u9I,940 +torch/include/torch/csrc/api/include/torch/data/samplers/stream.h,sha256=bDIkwKywg6Wi3GvHIg9ZzqZexo7-Vwxmtzs7M173ePM,2289 +torch/include/torch/csrc/api/include/torch/data/transforms.h,sha256=1jJanMchBCJJ38M8p7-ESFxIdgP5iqvK2zFQrUVk6k8,488 +torch/include/torch/csrc/api/include/torch/data/transforms/base.h,sha256=Mg9NnQumoWOjQQZoloiXCrzwSaEFLTjzLtvy9eR7Qec,1887 +torch/include/torch/csrc/api/include/torch/data/transforms/collate.h,sha256=r6SOcRDWw8vhwQs6SLBUlW-fYB00xxV372cdFnkTPz8,1353 +torch/include/torch/csrc/api/include/torch/data/transforms/lambda.h,sha256=z_mpH1pfPi2ZmSXeevPUZTlgCRyERWeqWT4askzvGLs,1970 +torch/include/torch/csrc/api/include/torch/data/transforms/stack.h,sha256=dpEhwqBJqzHwEWrY2w2PvWxAz4uLnXxSUnaw7s0gEHI,1678 +torch/include/torch/csrc/api/include/torch/data/transforms/tensor.h,sha256=wOhCv7ei4OhcY_yxJlX-7EHytSEwdr6I0XvJGgOgg7U,2755 +torch/include/torch/csrc/api/include/torch/data/worker_exception.h,sha256=QnmcAPu5WUpE1Ansx6E588tfohyvbHTBzClRGxDuPK4,1415 +torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h,sha256=yJqG0x7hPBgmpun0ciFAdAXGQmuk9RbTX07DKgOjNno,13560 +torch/include/torch/csrc/api/include/torch/detail/static.h,sha256=87iSdvH1iUwmeQ1zXFzebkw2Xe4-58gxzc8IzN9F0KI,2411 +torch/include/torch/csrc/api/include/torch/enum.h,sha256=2y-DDdchSFRBNBZzjAWguHsnHi7G6Z1yg9u7kVCsVvw,7919 +torch/include/torch/csrc/api/include/torch/expanding_array.h,sha256=VoNHMvxqQD-zE3UzVnTi5ce45evtKR-6AhQc0uE0C84,7114 +torch/include/torch/csrc/api/include/torch/fft.h,sha256=iAkjCfnDaArok2jCxH14mdD_lJLT5iGU6b50lh7gjvo,12753 +torch/include/torch/csrc/api/include/torch/imethod.h,sha256=-wwKVj4x-AgR9LfRDvNNX2Jv3Nzhi3FvIZH5TyRpzS8,2052 +torch/include/torch/csrc/api/include/torch/jit.h,sha256=-iCqZTPeeX_sFvN2aT4FAKpC7yLOW__THHjbxcapdqI,1181 +torch/include/torch/csrc/api/include/torch/mps.h,sha256=HNVf01le8k2N0Bjkq2BQrnBucWji4hPoQ_lDoaFC-Bw,1495 +torch/include/torch/csrc/api/include/torch/nativert/ModelRunnerHandle.h,sha256=ovo0j_YdcXdi_Rb8y6pWuh9qzUKl6vwjXU56E4SI62g,1631 +torch/include/torch/csrc/api/include/torch/nested.h,sha256=K6fbxCnPgXkd8japgBgwO8I6BRSGnpjUOdnQeELVVvw,3125 +torch/include/torch/csrc/api/include/torch/nn.h,sha256=kddrUogefH-5wLsZ8KlCjjGvGQ1CMgmHpmwqySJI-as,520 +torch/include/torch/csrc/api/include/torch/nn/cloneable.h,sha256=LGZHTdgk9BJY5Hdrxqcq32FK0eAWCTHrbGvvzRh-lao,4254 +torch/include/torch/csrc/api/include/torch/nn/functional.h,sha256=sHWq2QMqznuay5A-ALS44VO-zQOOKLp9Bn8boIZIsJ4,918 +torch/include/torch/csrc/api/include/torch/nn/functional/activation.h,sha256=ZvZIcA23iUNCMjs8_IcIFTcfIb_rCKcoPjaQbBk67jI,30994 +torch/include/torch/csrc/api/include/torch/nn/functional/batchnorm.h,sha256=D-BBCFLcMb7xADxpPJT2BQAkbanZMmLZjkxDVEsuqqA,2353 +torch/include/torch/csrc/api/include/torch/nn/functional/conv.h,sha256=CPwhQ3F0v8uzkUG1o7jwCpdSzzhCSjJy7bYLff31Xeo,8675 +torch/include/torch/csrc/api/include/torch/nn/functional/distance.h,sha256=D0wJGe_TWjChsi5QKLV6iGBNooS-wf0eyp5Uu_eZKXI,2842 +torch/include/torch/csrc/api/include/torch/nn/functional/dropout.h,sha256=whcHuT150xN4a1tAJIYPvHEa_z1k8rCQU-GpYoUX3s8,7025 +torch/include/torch/csrc/api/include/torch/nn/functional/embedding.h,sha256=3DdISP5_uAH9hhdQJ-qyznZQLVuhsskr8oHK0QI7y0U,6824 +torch/include/torch/csrc/api/include/torch/nn/functional/fold.h,sha256=22E1INaxJc7w5zXXwCiIvurgSdQbxFU_3Z6V-UAJl1U,3093 +torch/include/torch/csrc/api/include/torch/nn/functional/instancenorm.h,sha256=l2BxUN1KIIMW9uTu_lTk5dzqu6kcNCFjwXeOjDWR6Ew,1873 +torch/include/torch/csrc/api/include/torch/nn/functional/linear.h,sha256=zyU8KbgoNwwOTEyHEayC7m1JsXfLWDKanXnk47H970U,1053 +torch/include/torch/csrc/api/include/torch/nn/functional/loss.h,sha256=WDcF6S7PxZ8A8wX8vf2-VRQX23XoWPwGAEzYnN76CDo,33139 +torch/include/torch/csrc/api/include/torch/nn/functional/normalization.h,sha256=VxPWFEmECUFo01vckVz3l9H1i6TigYTc0Itec2SzqSc,6437 +torch/include/torch/csrc/api/include/torch/nn/functional/padding.h,sha256=g4DvUwiaH_6OOhjnsnxVKzzO14VuoG2VbBOjL4Mlpck,1987 +torch/include/torch/csrc/api/include/torch/nn/functional/pixelshuffle.h,sha256=Kh5k3T7dHqAz0tCe6DQRgVqooJD0Aqd_ZN6nv7XUGGw,1595 +torch/include/torch/csrc/api/include/torch/nn/functional/pooling.h,sha256=tG4FkV6QB-KjJlQMuSDa6piIgH8EsV_HIsG6fibkKSc,36818 +torch/include/torch/csrc/api/include/torch/nn/functional/upsampling.h,sha256=aPncSaUnuz2W9I67pItbQVEj7RlREyJMSka4QR9hTCo,11273 +torch/include/torch/csrc/api/include/torch/nn/functional/vision.h,sha256=EhxZLZD-5EBgik2y1l4y1yzJQRT4BZ7cpQRt8LsIIFQ,3957 +torch/include/torch/csrc/api/include/torch/nn/init.h,sha256=7HjSceygkMs57ln-tJg0VjFkdM-eopQITcr3UpF1GzU,5300 +torch/include/torch/csrc/api/include/torch/nn/module.h,sha256=qCsdpr5gStIS2xgbKI46Pqlgvt1phPg1rdsla3w-Vgs,27772 +torch/include/torch/csrc/api/include/torch/nn/modules.h,sha256=JgnlqIAOoCzdAshYkt8cBZ1iVgif11KjLQU8QonIgKs,1584 +torch/include/torch/csrc/api/include/torch/nn/modules/_functions.h,sha256=e_KUKRCjSFwLnDWmvjQpaK3J63bCqgCvurAPQSkiqGA,937 +torch/include/torch/csrc/api/include/torch/nn/modules/activation.h,sha256=50GD44pN23x6X8KfUW2jzaRF4sFa-KdujQDPplxReA0,31449 +torch/include/torch/csrc/api/include/torch/nn/modules/adaptive.h,sha256=0tFgtn8xuIJybNibMuP1lIV7I3B7hpTvZ6TyqL9XBqY,3885 +torch/include/torch/csrc/api/include/torch/nn/modules/batchnorm.h,sha256=d6h7NYMw-Fp4gH7B6RWb8pIP2IkL2cduUBLaqr_PqnY,8726 +torch/include/torch/csrc/api/include/torch/nn/modules/common.h,sha256=tzm0Y_dEp4LcknY4uzpnluaU712_XDBux92bUCH24jc,4706 +torch/include/torch/csrc/api/include/torch/nn/modules/container/any.h,sha256=vC2k3NfuQSR_2rvDlIB3e9Z6m1pO-Sv_rL14qbebH-8,14080 +torch/include/torch/csrc/api/include/torch/nn/modules/container/any_module_holder.h,sha256=a_9X8s65w1qOEFQha3tJfUvYsPpd4Di4vjVj7w3YrwU,5390 +torch/include/torch/csrc/api/include/torch/nn/modules/container/any_value.h,sha256=R_tpiBAudD2Xu-nOS7xrLmEpI3vplpgfbDl-mh8nxrQ,4521 +torch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h,sha256=PscfAmH-ihQUvv3kI8-Grzkiy-ZTg6c_axxECegqvoA,3703 +torch/include/torch/csrc/api/include/torch/nn/modules/container/moduledict.h,sha256=5gNTUUUOQgTQ-u5SflqwlUc8tpiDv3Xj6hwgCp-YQxo,8941 +torch/include/torch/csrc/api/include/torch/nn/modules/container/modulelist.h,sha256=T1XQXQ73fGq6aNjngGZ1lXHgYfMSPu6VKl5bojmRIpU,9473 +torch/include/torch/csrc/api/include/torch/nn/modules/container/named_any.h,sha256=VBm-U_iUbXW6Ew8YKrpkV1kMNqyT57cBM37WXGD6oKc,2782 +torch/include/torch/csrc/api/include/torch/nn/modules/container/parameterdict.h,sha256=kENODhV3PZKAZ66rXIyxSeD23zJ4ZbcVHGuT_QPKSgI,4862 +torch/include/torch/csrc/api/include/torch/nn/modules/container/parameterlist.h,sha256=5NQh7Z3y_k11jsFsP-qxs8pPrdSx-NNu4F4nKE6kIuU,5984 +torch/include/torch/csrc/api/include/torch/nn/modules/container/sequential.h,sha256=-yXkitSDqR5K6WnKxjoCaJtI8rVSfIx2jB3FDaTUeNY,14380 +torch/include/torch/csrc/api/include/torch/nn/modules/conv.h,sha256=L09RRURCcLq8yyDUpQrYo-t2FxevS5BQsTxoWFYJyHA,16966 +torch/include/torch/csrc/api/include/torch/nn/modules/distance.h,sha256=18Sh85P1RYc7elq44VKKNG2W2TSqxvuOjgS73ZpzS2o,3399 +torch/include/torch/csrc/api/include/torch/nn/modules/dropout.h,sha256=gNgwI7pZoYtAc8u84Qm6Ct32xtX7dSXHpmFRvr_a9-8,6843 +torch/include/torch/csrc/api/include/torch/nn/modules/embedding.h,sha256=cv0pW_UPRBI8B9SMhiOdRoHphVL2ckXyO4IKxvdAOIo,6479 +torch/include/torch/csrc/api/include/torch/nn/modules/fold.h,sha256=xiqwE9_-UppHSaWCUsIhqnoJ6LzmeIyXeFDyei4VBAQ,3166 +torch/include/torch/csrc/api/include/torch/nn/modules/instancenorm.h,sha256=mtUMox_mKrEG9kz0r7ImSqjYKxWKV3ZtiH_YEP-fDvc,5926 +torch/include/torch/csrc/api/include/torch/nn/modules/linear.h,sha256=HjSMh9hcCMafcYMABgwUn7IbP1hFD4jqtCMZJZ3FzYw,7958 +torch/include/torch/csrc/api/include/torch/nn/modules/loss.h,sha256=AfimfxFVx72D5GUTRbzLTornfoy4pkVDRhMTX9LN4EU,32038 +torch/include/torch/csrc/api/include/torch/nn/modules/normalization.h,sha256=K0UtEsMW3gNVK4bE3qgHRcvd8WnziXmjgMt0htkKbuU,7387 +torch/include/torch/csrc/api/include/torch/nn/modules/padding.h,sha256=L0PgDtn6NynGkKBPqhh0nH32CUUAP5lC0W3pYgSuC5w,14981 +torch/include/torch/csrc/api/include/torch/nn/modules/pixelshuffle.h,sha256=qhJy9Y6egEdVyLqGrq1hh0Olq0GdkNDZbx5BZf6ZDbc,3454 +torch/include/torch/csrc/api/include/torch/nn/modules/pooling.h,sha256=5mQkzsg3CNR1x6cC_40Eb_ZTk3Fbp4qDbBNulBWGZs4,30676 +torch/include/torch/csrc/api/include/torch/nn/modules/rnn.h,sha256=ehQGd_9IwI2th3xJzuOCVQ96YiYJxUC6ReyL3wGs-ec,14106 +torch/include/torch/csrc/api/include/torch/nn/modules/transformer.h,sha256=FMV_4ch4HSNqmbA6BuNmMlU3OsoClQsulj5Wp4OkpL8,5722 +torch/include/torch/csrc/api/include/torch/nn/modules/transformercoder.h,sha256=Eh_IGK0bXtDYbVPGuHB0NVkgrbLFPB-xL8AWWKJ8AHw,5614 +torch/include/torch/csrc/api/include/torch/nn/modules/transformerlayer.h,sha256=Sar3eWmxLQ82mT7zaAEfxYT6-XbJHHdPADEf8ACnneI,6859 +torch/include/torch/csrc/api/include/torch/nn/modules/upsampling.h,sha256=Nw89fpbrl7lpJF2ic8L_niAdX2UU9-02-bn6kaLdVL0,1931 +torch/include/torch/csrc/api/include/torch/nn/modules/utils.h,sha256=ed0UFzA8d3a0428SpgV93le2drcI1Um_as7oB48wi2c,1707 +torch/include/torch/csrc/api/include/torch/nn/options.h,sha256=w00-LiQWQqFK4aG6F1Ct8f-vR8omCsPIYAZ0F0E-TJM,922 +torch/include/torch/csrc/api/include/torch/nn/options/activation.h,sha256=ifaCJPsJw9_LXBW_z8anfvE4yYWIFYTTsCMOrflucFg,19955 +torch/include/torch/csrc/api/include/torch/nn/options/adaptive.h,sha256=u0hlHcvH6ZViL_rJhSRXFMTlaFj52ACR6GOOtfW_wwM,1355 +torch/include/torch/csrc/api/include/torch/nn/options/batchnorm.h,sha256=CkEuEcCC8bv6naMyxGIwdi_OgoJqbq1VUbNITE0GZ5o,3089 +torch/include/torch/csrc/api/include/torch/nn/options/conv.h,sha256=yU3ltp6kvhSn7HW0vL8qi71Qymo4Po4BGZvP8q6C_W8,14066 +torch/include/torch/csrc/api/include/torch/nn/options/distance.h,sha256=Sd4loXVhD7WGmtIqJM8IMSZW77TIINhezHPo7XWcn8c,2317 +torch/include/torch/csrc/api/include/torch/nn/options/dropout.h,sha256=DZYelm8BhYNdb0In06vRuch3hp140N_qx8jAeL1AaTQ,3432 +torch/include/torch/csrc/api/include/torch/nn/options/embedding.h,sha256=E9biOLUidbyhb-Q_OBIG3QsLtLP39Pt_u37nIIwGeik,12097 +torch/include/torch/csrc/api/include/torch/nn/options/fold.h,sha256=Cd5IRrB-gp1rhogx5ZUbGo0exQI4xPRx3mpbZFnQyD0,3267 +torch/include/torch/csrc/api/include/torch/nn/options/instancenorm.h,sha256=LPR11fDJCXXqmr-ttAik4HLRX5rylZn0fH9dfUtpApQ,2598 +torch/include/torch/csrc/api/include/torch/nn/options/linear.h,sha256=Y9NbtPp4uSzsVMs3sc7CExFPKR_zaj_o_V9EHmiYjZA,3131 +torch/include/torch/csrc/api/include/torch/nn/options/loss.h,sha256=_xzeYbQ-allIgdy7lytDo8IykPFjJbo0uQr8-cElVm4,27714 +torch/include/torch/csrc/api/include/torch/nn/options/normalization.h,sha256=mo_U-cdTx5hMXGFIMKqh9Wj6xWutzmItDzrsdXkNlYg,5926 +torch/include/torch/csrc/api/include/torch/nn/options/padding.h,sha256=_i4HtzKknvRQXsQp3ZW6jDS16WS4dErm_N2L9m6i3lA,7311 +torch/include/torch/csrc/api/include/torch/nn/options/pixelshuffle.h,sha256=QwXufCCwS_G3iaGYTUW3UCtvVIQ8CdXVDr6_KCGeC-k,1954 +torch/include/torch/csrc/api/include/torch/nn/options/pooling.h,sha256=l6gMt0xIawBlHCP8pawHv1HaC0t2MTIM1eQSYeg2H98,18560 +torch/include/torch/csrc/api/include/torch/nn/options/rnn.h,sha256=hTeEDVaJhq8r-ux8frgE3oE3BjSy7ZbYTXjwNFAiTI0,8688 +torch/include/torch/csrc/api/include/torch/nn/options/transformer.h,sha256=OJq6Ir31yjZtYHAN8hCW6AbvrHKxwl0cBllHGO_N78I,2135 +torch/include/torch/csrc/api/include/torch/nn/options/transformercoder.h,sha256=MVlGoCzZcPiQR0tmUvpKWeh1chtIFN4WYHCca1JOiKE,2652 +torch/include/torch/csrc/api/include/torch/nn/options/transformerlayer.h,sha256=n9bkUuN5FXxb-11EcCTVFOQvEeWbnYkIvoyMqJa35sY,2388 +torch/include/torch/csrc/api/include/torch/nn/options/upsampling.h,sha256=7UQ-h4D_0YRERkyaWoW_hmgkR9JIVYbbggCZfyC4Ahc,4492 +torch/include/torch/csrc/api/include/torch/nn/options/vision.h,sha256=F3OBwBuUCdyak2AkEopbNAvSheIQTwNgEOQ--5yiBGs,1379 +torch/include/torch/csrc/api/include/torch/nn/parallel/data_parallel.h,sha256=jZUhg75Z071KbMWOFBtc5cQ5FkcOuCijybFdyIZn1dM,11752 +torch/include/torch/csrc/api/include/torch/nn/pimpl-inl.h,sha256=_5CQ0FWmPPatEKPk3z98ReqsdpP6-MR8fLoSg3yLg3Q,3559 +torch/include/torch/csrc/api/include/torch/nn/pimpl.h,sha256=y4B111m1suhAQtULNPjgS1zP-wxGS9v9z6no6yORJk4,7074 +torch/include/torch/csrc/api/include/torch/nn/utils.h,sha256=mTBg7sO-BlIufSe5-2NY2fjZNI5L8zZJoVIEwSZ7bhc,395 +torch/include/torch/csrc/api/include/torch/nn/utils/clip_grad.h,sha256=n549wU62D8TCuUmbF6s4MeG8A4rHQiGJXtO4H0gwRRc,5241 +torch/include/torch/csrc/api/include/torch/nn/utils/convert_parameters.h,sha256=7YQzz7k1LhL5cdzab6vliuJUfNbsT7Fgr4KWHcyLbGI,2713 +torch/include/torch/csrc/api/include/torch/nn/utils/rnn.h,sha256=a4_HlJEyPNRPFSRKAuTpo6lBAyYSDTYF-KsuJiUQdI0,13400 +torch/include/torch/csrc/api/include/torch/optim.h,sha256=cJBrknFulgYXiNmjEMlKFBjQ3oSV6yA2u7YJHFwF91o,666 +torch/include/torch/csrc/api/include/torch/optim/adagrad.h,sha256=4F7P91Y_PbTUY8csugKuUOUUZcGseg9oO25h1lyXXyc,3555 +torch/include/torch/csrc/api/include/torch/optim/adam.h,sha256=ZJbu5RYmitdxEUoP2uSdduK3uGYSBln7d1m9prRIBRY,3220 +torch/include/torch/csrc/api/include/torch/optim/adamw.h,sha256=UB3Objns_4uRwhg-BFvP06p3I-lShJAFsiQPiQoUCss,3240 +torch/include/torch/csrc/api/include/torch/optim/lbfgs.h,sha256=9axc5qUqamrPQzr0GJkLhf7E4l8btLsO97zPxJtdgUA,3789 +torch/include/torch/csrc/api/include/torch/optim/optimizer.h,sha256=oh5zzBmVFRO2lMpQEKxg_DhLOdhKouAjgyFjuwQx3Gs,8608 +torch/include/torch/csrc/api/include/torch/optim/rmsprop.h,sha256=m_6JZ0DxH4SMRcOrsHR_64Z69zQhLV-f_l9ROiR9ywM,3238 +torch/include/torch/csrc/api/include/torch/optim/schedulers/lr_scheduler.h,sha256=8YyVCWe4DqxBarHQhT_KUpQmDv1P0c5K6ongWRdECzY,1416 +torch/include/torch/csrc/api/include/torch/optim/schedulers/reduce_on_plateau_scheduler.h,sha256=58P1AGuazK2DyYpooorZgpDFiBwQnOC33YuVmsD3VqM,1698 +torch/include/torch/csrc/api/include/torch/optim/schedulers/step_lr.h,sha256=aO5yYIxv8IbE8sB_Xbe_ydw-EiZEG5rJjIvasSfIDaM,678 +torch/include/torch/csrc/api/include/torch/optim/serialize.h,sha256=O5uemtmjpWEvDM5DmnTQ-aYeLC2VHuHOCY8AgKVSYOk,13247 +torch/include/torch/csrc/api/include/torch/optim/sgd.h,sha256=WtyYcZelDz_t6eeS8PWUpL_fSAkQwryeDH0c5D9LWsw,2966 +torch/include/torch/csrc/api/include/torch/ordered_dict.h,sha256=Us_7xunQV46ujxWNBWQPyRM59HbfJwgnn-VvPP3cIP0,17043 +torch/include/torch/csrc/api/include/torch/python.h,sha256=q0GWXpznQ9Wj669ePHYMmLWNDNbEYvuQ8lYBlFyx1wc,10438 +torch/include/torch/csrc/api/include/torch/python/init.h,sha256=DZ6IWI19CP7BT_Q0paAJKDXbu7e27oijFkMWUaClo8M,471 +torch/include/torch/csrc/api/include/torch/serialize.h,sha256=q0CXf7qh7W4znbxSSj0lPgmIb24vIBqWgw62VNghQPk,5647 +torch/include/torch/csrc/api/include/torch/serialize/archive.h,sha256=UXgX-u3iV8XmMcrFFZXeRCFmX2EDCCnjA2oJHjakkJ8,364 +torch/include/torch/csrc/api/include/torch/serialize/input-archive.h,sha256=z6NupYQlxguNgTY1usJ_DbWx5QGqWGMdaMspZCuhGIE,4329 +torch/include/torch/csrc/api/include/torch/serialize/output-archive.h,sha256=BKE7vmp8iYCcjZhSXpBeNLwFN4EldrRNTtkCTmngiAY,2628 +torch/include/torch/csrc/api/include/torch/serialize/tensor.h,sha256=utVzxaWSJPcVpLCMAkWoSr62LY9fSiQAW-W0EGITS6c,711 +torch/include/torch/csrc/api/include/torch/sparse.h,sha256=tHv7rrCMQY4PPVERVqzX3hnR4lcqbVRzCdtYBoZQIWI,299 +torch/include/torch/csrc/api/include/torch/special.h,sha256=eC0xT5FEYBeXytcETLdjK9TWgl6zSAK29uVz0NLq3j4,39947 +torch/include/torch/csrc/api/include/torch/torch.h,sha256=GrqQ673xoGOmaqC9zySe9JZKJqc9DAizkaRtxBGV-HQ,421 +torch/include/torch/csrc/api/include/torch/types.h,sha256=vcH1th8TA5PQp4FQA3Uk0E8rhTophrdFpZJbWCDWFYA,2717 +torch/include/torch/csrc/api/include/torch/utils.h,sha256=70KCvwmIgvsP8K-mLY3SXbIOrARbmP5p-MkGLY0pP1Y,3961 +torch/include/torch/csrc/api/include/torch/version.h,sha256=LVnX9sOXnh8bdBXwB8oWlqiSljKNxJIEt2UrLSBi3s4,298 +torch/include/torch/csrc/api/include/torch/xpu.h,sha256=6eKIf-8y6a16HfZGGbo8BBHSDhXg8rqE4Y9A1qYmLTE,886 +torch/include/torch/csrc/autograd/FunctionsManual.h,sha256=6VgtGoQDbDiE-9l371B-jo-YpQG3irEFcnBeS-BAlEI,35177 +torch/include/torch/csrc/autograd/InferenceMode.h,sha256=yCCclW4vsRDqSg75kokbqqYM1tzohaFtKokW1FlAEgM,425 +torch/include/torch/csrc/autograd/VariableTypeUtils.h,sha256=_OR6qFjANZ1f3MG0lukNO67epbhDV8wMWHANt83K0bw,15267 +torch/include/torch/csrc/autograd/anomaly_mode.h,sha256=aBOlhRrq3zMhnmjlLl4AvpZfZlxPLkrryMe3wPHGOTo,2055 +torch/include/torch/csrc/autograd/autograd.h,sha256=5H0z-28xbZ117uc64CLKziCLC0bA0VecdxCddU3WxGM,5672 +torch/include/torch/csrc/autograd/autograd_not_implemented_fallback.h,sha256=ziVKHsOs3lk0gAUXgZOeAZ2h35gGFvDTFf3UoWoZ3zA,1433 +torch/include/torch/csrc/autograd/cpp_hook.h,sha256=xJchMJudMPts_tfq_noZzGANe06zotH8vsE9dMmwTqw,1250 +torch/include/torch/csrc/autograd/custom_function.h,sha256=1CC7deqWPRctN-WjV03j8u0hXDxok_q-dDek8GGT5PY,22087 +torch/include/torch/csrc/autograd/edge.h,sha256=ODSLGAZkAm6SDXSa48VmP0IjhUXvLm86qpz2axSiFTI,1930 +torch/include/torch/csrc/autograd/engine.h,sha256=LIbJXzvdY0J8-20wiY9xKKLmqf6bHZe2FoXcdw6vi3s,11353 +torch/include/torch/csrc/autograd/forward_grad.h,sha256=X1E0UqC2xE0uT1O9zq8xr7IONslFrZXcOUNe9POik4M,9406 +torch/include/torch/csrc/autograd/function.h,sha256=NhZsB33TvcQnope5ydrBP1wT2xD8nW1UrIrIGNpRj5c,31766 +torch/include/torch/csrc/autograd/function_hook.h,sha256=aRhNMBdXKcjZlYBsjKhlb0qDz70vId3RUut9CaGbZXM,2583 +torch/include/torch/csrc/autograd/functions/accumulate_grad.h,sha256=3wiSIZxU2PuTKXa4sCp5KlIpw9nmxA0h8lqkPCJ_OB4,15536 +torch/include/torch/csrc/autograd/functions/basic_ops.h,sha256=W_Z2erYEoAf87cnl3yDj1UMsrX8TXbPKsuS_V7XDQ2I,3767 +torch/include/torch/csrc/autograd/functions/comm.h,sha256=oAYkw7BN1tmFNGzUcD98yxLNbpn41WLE_J7oqLnDi40,1501 +torch/include/torch/csrc/autograd/functions/pybind.h,sha256=_TiR29JmVq4r4DGMsTUPoitFrG9KfOp1GTN6yPtBZtM,653 +torch/include/torch/csrc/autograd/functions/tensor.h,sha256=VEXYXtacKr7UOut4JI6Hd2UW2kp0L9w3KmacVO2lo60,7713 +torch/include/torch/csrc/autograd/functions/utils.h,sha256=zQs8OVGjt_9avu3HRy7hi-U3usuAULgbLM563uB17HM,3604 +torch/include/torch/csrc/autograd/generated/Functions.h,sha256=TNaY5v51pIB5XIwXjRGtd40h-EgTayQDebAj1qlSCS4,531927 +torch/include/torch/csrc/autograd/generated/VariableType.h,sha256=9JT6cKz9aJBDxHKRaqYT5tU6hg8xivI_dLh8BxtYoU8,1819 +torch/include/torch/csrc/autograd/generated/ViewFuncs.h,sha256=Pnh0xifnLOZgC3AkBjltC-Ypm9qYO-8gLq9kX_NRa58,38537 +torch/include/torch/csrc/autograd/generated/python_functions.h,sha256=WOJVTf_E7kzaVlV9MMaeTd0LyAv0tP-FS-MKfKknVgA,1175 +torch/include/torch/csrc/autograd/generated/python_return_types.h,sha256=_cV1Jyr3f4K2KS50vIC5zRZNo0TAuUg2OZSOVn8o7O4,4419 +torch/include/torch/csrc/autograd/generated/variable_factories.h,sha256=Oko4BrudmCuwESyq53dgImXIbakPJza4GUoD1phRJ4g,61055 +torch/include/torch/csrc/autograd/grad_mode.h,sha256=vsDJnHxQbdGl9Mf4n2xZAARRi9iNSMsAF6t1IDBYHx8,480 +torch/include/torch/csrc/autograd/graph_task.h,sha256=W5PvE_ezGWH4PP8u2-9pQjk9f0E_Bg7WNDH1PIql0h8,9839 +torch/include/torch/csrc/autograd/input_buffer.h,sha256=aKneBt3YWImIHRvknDqOOmsDg-7Xi1NsNHhFT5PSKm4,2327 +torch/include/torch/csrc/autograd/input_metadata.h,sha256=P5tL_X5euIV0rL2-r8VgRcZq0XbWTijqJla4D3cfPgg,4159 +torch/include/torch/csrc/autograd/jit_decomp_interface.h,sha256=JVO4Vf0-CvJZdwNKtuH73kGhe6nVyr5tSmJw5zJUDCM,2137 +torch/include/torch/csrc/autograd/profiler.h,sha256=bL_pUmnVM3cVBzGXIVxOH6AT5K9QIWeJ_d-QNE2Gx4U,375 +torch/include/torch/csrc/autograd/profiler_kineto.h,sha256=hB9g_CtGbaf4Ow2x9hDLLSJfIlxITWC8znRZE_cg8yU,8753 +torch/include/torch/csrc/autograd/profiler_legacy.h,sha256=e-VCzgEV0QBrQ6jWWwyDJKICc8nPn08wE5uo8kIcY9k,11363 +torch/include/torch/csrc/autograd/profiler_python.h,sha256=tjkQjiFWYd0ErSWGMU2JOYQMXu3ObMD6zH-nMtkP7cc,350 +torch/include/torch/csrc/autograd/python_anomaly_mode.h,sha256=wEfH97pGdnDwWEHfvxvrTmr0mfblEEIy4j6jxbRP1wo,1488 +torch/include/torch/csrc/autograd/python_autograd.h,sha256=evZGGxZMn0GJUMSvtXEmmoQhZKqKu4_fL7XJQfHEbsM,700 +torch/include/torch/csrc/autograd/python_cpp_function.h,sha256=1szCTtICt1CS-JZwgLlT3VklcEtY6omODqxMchZLZAU,5634 +torch/include/torch/csrc/autograd/python_engine.h,sha256=1izifBbRuhr7zO-jWyDa0BXeDgKV77QaFRh1sfKnNh8,1559 +torch/include/torch/csrc/autograd/python_enum_tag.h,sha256=KeLrCD5eKbAmXXZvKZa5-FhSP-__s_vliA_nj2a-DVs,386 +torch/include/torch/csrc/autograd/python_fft_functions.h,sha256=lXLUf5aJvc3wmQDS87FLJ5QaF0-MgGO0f-xkZ2B6WHE,402 +torch/include/torch/csrc/autograd/python_function.h,sha256=bDeLmFlgG5tb9xNgjO93uAn8tIiR5Whhm8Tt21wJO8I,5785 +torch/include/torch/csrc/autograd/python_hook.h,sha256=FqVmTmqtPAZ7vdAGbhhcz5g_oyALRGeEEWpvsQoa7Fw,2385 +torch/include/torch/csrc/autograd/python_legacy_variable.h,sha256=xE2PoYDbc7sxtLLgDLtElUE2VZsexauYfUTyxipbA94,528 +torch/include/torch/csrc/autograd/python_linalg_functions.h,sha256=ETRM71haL5KfbBCtUrRcGKzXZ64Jqhk5mfMsLoIvivw,405 +torch/include/torch/csrc/autograd/python_nested_functions.h,sha256=Ly5KPBnrk1aeloTONsmK_K0-6GcNe8fBmRFNf8NxsZ4,477 +torch/include/torch/csrc/autograd/python_nn_functions.h,sha256=nuDN_LB_bZbX7wf4cVwr1Ci88vsocI8_hGBwtbpsN-E,395 +torch/include/torch/csrc/autograd/python_saved_variable_hooks.h,sha256=AT62LipehFD7oAiVAdjrJEcNcDoBoTIIPACAMww44IM,1374 +torch/include/torch/csrc/autograd/python_sparse_functions.h,sha256=IpqEd8JRH9LFqXrOepTJJg52T68ZU8x1ELi3uV22xs0,405 +torch/include/torch/csrc/autograd/python_special_functions.h,sha256=DGZcbgqUGpLeCDohgjFn7Vm35pNddIMwH4Je84YjSec,404 +torch/include/torch/csrc/autograd/python_torch_functions.h,sha256=JapJz1hNXZdpPh1Q65BhCVfMe0PTyyzwlWMnhZrsJ0E,950 +torch/include/torch/csrc/autograd/python_variable.h,sha256=sV6mXRiG7e6LegsUhHkIkwx99I6pEJD4ZJnmtHlXgAA,4244 +torch/include/torch/csrc/autograd/python_variable_indexing.h,sha256=cFfaVscNLwtFrKgMcFm8m9LEKlvC_9R1knq432QgqjQ,3110 +torch/include/torch/csrc/autograd/record_function_ops.h,sha256=Idlcfv3G_2wFwFg1z45OkKseToTplYkNjRnTwc7hOjk,1221 +torch/include/torch/csrc/autograd/saved_variable.h,sha256=pHFrKfCnjx72HAf7hU5z6G1bYxMXaVxhjBwaKoZJzY4,5563 +torch/include/torch/csrc/autograd/saved_variable_hooks.h,sha256=zXN1dk5_QN-V9gLTwJA5p643JuRMDzZsWs9JeLW_cRw,819 +torch/include/torch/csrc/autograd/symbolic.h,sha256=ubxouSYH9vXm7gXw4gL21Dmc49EJFYHMY_XKlUiBl38,575 +torch/include/torch/csrc/autograd/utils/error_messages.h,sha256=xEZICeiLNLT3fDqdd5q5exQYy1r_a0KOja1-6xIF1FY,772 +torch/include/torch/csrc/autograd/utils/grad_layout_contract.h,sha256=k6Phy6mTaevRPsm9i4dDVTA_mSSgULO1GwYniyir82c,3251 +torch/include/torch/csrc/autograd/utils/lambda_post_hook.h,sha256=r-6X1zrAheo2P0KxZfKAh4fi_v3jnqzqxh7hNPaH1Pc,1705 +torch/include/torch/csrc/autograd/utils/python_arg_parsing.h,sha256=kTlmTyAsi_6SuupzBswRCHTn-q9H37gdA-b72qvGNMU,1683 +torch/include/torch/csrc/autograd/utils/warnings.h,sha256=8KOq22Qjg9bdQne-YBX6ZZD4PnITvj4km-YTRqV77Rs,866 +torch/include/torch/csrc/autograd/utils/wrap_outputs.h,sha256=T237SNmAAS-ngwU5J_fWDiSU1FSOySvs9cqsFbl021I,4249 +torch/include/torch/csrc/autograd/variable.h,sha256=rFRyjqPUt-oRpr-ueBuOh9HxlcsIPsAT3ympL_WQ1cc,43915 +torch/include/torch/csrc/autograd/variable_info.h,sha256=5xnfcHwOB4rN0PMTlXpXTg_-kk9-xMOlG9imj5V3sMo,890 +torch/include/torch/csrc/copy_utils.h,sha256=niuMU1NPsHRSY3EtcylrPgK7yyWvOyX176nERqBzzhs,1731 +torch/include/torch/csrc/cpu/Module.h,sha256=s0NdU8rKCO0EBpBf78cv5eldkNnQ8_MvRAqgodxH5dc,406 +torch/include/torch/csrc/cuda/CUDAPluggableAllocator.h,sha256=U8S9Pc2s7nBl9AmzVVdtNl3VumsZpuhMqEytdx4ncbY,6951 +torch/include/torch/csrc/cuda/Event.h,sha256=-wBCAjX2rjY02u9FM9muqUmfkd6tt5r0Y7001Rem7P0,711 +torch/include/torch/csrc/cuda/GdsFile.h,sha256=kUz9ch6HCXySRnZuDYBILIuMHNrGHb4WqBvonYqDZCY,460 +torch/include/torch/csrc/cuda/Module.h,sha256=2BovnakkErVUy7Bf9Wt4ySD_zr85dHAiuGvWmMmFzrA,755 +torch/include/torch/csrc/cuda/Stream.h,sha256=Gauc206A31HlawtV3GId3PRpMTUYRUiQlNiZdt2InDo,783 +torch/include/torch/csrc/cuda/THCP.h,sha256=K_VjGXUBNXHXfpO5gBDe6MP3rcp7qco5xjI7PvoPeGQ,490 +torch/include/torch/csrc/cuda/comm.h,sha256=JrhHSJcdpwrRpyhe4Iu2IeKvPrICsz3AF34puk_RyC0,1825 +torch/include/torch/csrc/cuda/device_set.h,sha256=TjryLRJX3ysD7L2JnuzbY8fpNuhF_w80f2MFzN5RpZk,455 +torch/include/torch/csrc/cuda/memory_snapshot.h,sha256=-lRVZAU-K-IPuUBup5QfDy-QTaKT-GJ_AFDxYRvZElA,1273 +torch/include/torch/csrc/cuda/nccl.h,sha256=6iSHGBCWh4c8xoF8C-N0A0aR_WRvz5RuGxeXixITIuk,6349 +torch/include/torch/csrc/cuda/python_comm.h,sha256=rXnlQ0ru6WumQfB-CmzoAQg9d97b1sqqvcvOQHMB7N8,438 +torch/include/torch/csrc/cuda/python_nccl.h,sha256=iaFsfaddEKob3y57nbj9Vpanwrh_2EtharVz603Xt8Q,954 +torch/include/torch/csrc/cuda/utils.h,sha256=HDnnd3D3WeY09wzscvr7xSh5XjF3ikvmkJ4zW1kdnGk,483 +torch/include/torch/csrc/distributed/Placement.h,sha256=gXb-83_Jhe2w0tLT7Q4yOdl6xJqbTt1M0mp5j10MGUo,2951 +torch/include/torch/csrc/distributed/autograd/autograd.h,sha256=1ADy6b1dieD2xbdhdPrFWtqHP1hkx-ovXFO39moMHHE,1931 +torch/include/torch/csrc/distributed/autograd/context/container.h,sha256=Z-OZsujGUrFjUPq-RkxP1Q2T9S15j4oTFaR8lGMi12I,6805 +torch/include/torch/csrc/distributed/autograd/context/context.h,sha256=YoXshmAAOt3E8nyMbF0eoanh-_-wvQcqCjMQS5Oh-mQ,7044 +torch/include/torch/csrc/distributed/autograd/engine/dist_engine.h,sha256=kv_w9MzlcyAKaYHnVHmsXnPGuhfeoDOKb5RzpZPW0yo,7849 +torch/include/torch/csrc/distributed/autograd/functions/recvrpc_backward.h,sha256=ks5H54j80FMuu4r1X4gHKdkifYA6BevACV6u4bUNEqM,1966 +torch/include/torch/csrc/distributed/autograd/functions/sendrpc_backward.h,sha256=bRisFw72nMzBqT0sCAslZ6Kcp356pU_suvXpKolXPzI,1615 +torch/include/torch/csrc/distributed/autograd/python_autograd.h,sha256=xAJWJvvnBhun_R5_lAuYwyR2laKNM9wH1T3OG-06w3I,442 +torch/include/torch/csrc/distributed/autograd/rpc_messages/autograd_metadata.h,sha256=qY6rgEZFODlXT3aBhqoYcS3bps3TpCmwhWyppgzgJE8,980 +torch/include/torch/csrc/distributed/autograd/rpc_messages/cleanup_autograd_context_req.h,sha256=rMQudPuqwcuzqm1koqlXZyDxyOC2qRCh9ITEOPXkeQI,1120 +torch/include/torch/csrc/distributed/autograd/rpc_messages/cleanup_autograd_context_resp.h,sha256=rUk74jdFb6bj0OL5NvFBDoqbFC3Iy17oSVqLowAaCXA,939 +torch/include/torch/csrc/distributed/autograd/rpc_messages/propagate_gradients_req.h,sha256=PbDQTh0EvD2mqcS-04hjcX6JoaF_iu28K64ZQL8B1_I,1545 +torch/include/torch/csrc/distributed/autograd/rpc_messages/propagate_gradients_resp.h,sha256=lVvUEgl3RZW0pIf8vu0W3BxKYRQydeV3amDeAwwuvu8,1033 +torch/include/torch/csrc/distributed/autograd/rpc_messages/rpc_with_autograd.h,sha256=7Lfdak3ih4fHXFBKxhFdpQ6dh3U9tqdNtiNnMLw9MtE,3859 +torch/include/torch/csrc/distributed/autograd/rpc_messages/rpc_with_profiling_req.h,sha256=cvqH5BUFUpwalf_rgnhrzKDXBaoL0ZrARWUrvDbYkek,2830 +torch/include/torch/csrc/distributed/autograd/rpc_messages/rpc_with_profiling_resp.h,sha256=lzTPLpw52A_6cSgymj86oTTgRh0voOLLt-zhclYUr34,2787 +torch/include/torch/csrc/distributed/autograd/rpc_messages/rref_backward_req.h,sha256=xVFEc4hubu32gdtyHGm0mtV88PGDhJljNriONMbeRWM,1487 +torch/include/torch/csrc/distributed/autograd/rpc_messages/rref_backward_resp.h,sha256=c6rV_TwF8D3JYJghlTHI9NSTSRVNA9rYV7fKfxEBAk0,784 +torch/include/torch/csrc/distributed/autograd/utils.h,sha256=cVyxs4eE3JX7rxnW5rzwu71AwP3Rx5YP0JXWPfC8FYE,2962 +torch/include/torch/csrc/distributed/c10d/Backend.hpp,sha256=RBFmMrWo5Is45tcztCwtkYyZzMmCdowrpaeR0leExHM,17429 +torch/include/torch/csrc/distributed/c10d/Backoff.hpp,sha256=-AKfm4nCFpiy8MwaBjPxKpFreCXcRv1or6GsZ8_y5_s,1362 +torch/include/torch/csrc/distributed/c10d/FakeProcessGroup.hpp,sha256=IF23mCfISWmSM9U5aQ5bZhaAYzhv7l1U5i4Kj6WU0xo,8749 +torch/include/torch/csrc/distributed/c10d/FileStore.hpp,sha256=hnS1rVxF-hG8h7HnXe5wwAYL51leVQSNyfznbsft_KM,1914 +torch/include/torch/csrc/distributed/c10d/FlightRecorder.hpp,sha256=LAONVt62xfpESlZsNhtZudgz4TrKsO7aStUBYJxvr7A,12529 +torch/include/torch/csrc/distributed/c10d/FlightRecorderDetail.hpp,sha256=h743KyUGHO6lKbypaQ6U2ljF1KwoVUDTZ9HWxeN4ntg,21887 +torch/include/torch/csrc/distributed/c10d/Functional.hpp,sha256=umhuxjLiCisWqE2TYsHW_3kyvQFanAN_WyES34qEfQs,2772 +torch/include/torch/csrc/distributed/c10d/GlooDeviceFactory.hpp,sha256=sER3ks0QP7pn0CwCHyIe5zQGFvtYU1YtapO7JJl3y24,1134 +torch/include/torch/csrc/distributed/c10d/GroupRegistry.hpp,sha256=Kbv5C6_ytpXqvdZm3XiGU80be1mC6y2K5n7Myf4pjBM,850 +torch/include/torch/csrc/distributed/c10d/HashStore.hpp,sha256=01k4EJX6WdvUi9WQY7Yaq0LrJ80za3w11wBkv2izUyg,2573 +torch/include/torch/csrc/distributed/c10d/NCCLUtils.hpp,sha256=jVTaYl1UYYF4IWx9EsFG81l_e9X8I1OhQPyyixhsKkc,17850 +torch/include/torch/csrc/distributed/c10d/NanCheck.hpp,sha256=8lWglT8lr0BmN4sY-_ctgDDi9xxDRTqoCUBa7vBKPis,603 +torch/include/torch/csrc/distributed/c10d/ParamCommsUtils.hpp,sha256=wKlSKmjILoNAyh1pUGZmC6opSb5hLyL-z4pU5urDcU4,9190 +torch/include/torch/csrc/distributed/c10d/PrefixStore.hpp,sha256=kVqAQ36aEx2yom0vD66YsjcLWQo9VUsHHXVsTevx1nc,2607 +torch/include/torch/csrc/distributed/c10d/ProcessGroup.hpp,sha256=Aic_EDtgLfi5RRcoqK_QkMa9oCFALOngJPLlUyXr_58,38609 +torch/include/torch/csrc/distributed/c10d/ProcessGroupGloo.hpp,sha256=vyKkd9Gijts-G1aHsEioUyTla5i28A0vngdkKf0ny-4,17725 +torch/include/torch/csrc/distributed/c10d/ProcessGroupGlooDetail.hpp,sha256=o42ymte7NSQU9uBggBjOuMAVmW7PFOL3hW0Tixisd8s,22892 +torch/include/torch/csrc/distributed/c10d/ProcessGroupMPI.hpp,sha256=xbKvX8VKb_HmEh00wyKJ5PgMI9j209wd3-ZLZ-2diJ0,9306 +torch/include/torch/csrc/distributed/c10d/ProcessGroupNCCL.hpp,sha256=MRe_BNzYWY-knhhUbk5goxIPK2zx8_TcMgVuqc3KbHc,57714 +torch/include/torch/csrc/distributed/c10d/ProcessGroupUCC.hpp,sha256=aLJ2bySVhChpu2e3MX8codnr6x8BhAiRPOECUvfDJJI,11881 +torch/include/torch/csrc/distributed/c10d/ProcessGroupWrapper.hpp,sha256=Q1e9qZEbuYtOX_-x8pTHF0IIKC7Y3R5xaig3puzABuM,5476 +torch/include/torch/csrc/distributed/c10d/PyProcessGroup.hpp,sha256=CLhXbwobx49aaGByDganAeKb7DSoOdlaPje3rifp8Qc,11656 +torch/include/torch/csrc/distributed/c10d/RankLocal.hpp,sha256=owjAvH_GhfGTdUpB7LVAiuPzgOnjTiG8n8ij4l-Gn3E,2619 +torch/include/torch/csrc/distributed/c10d/Store.hpp,sha256=_iYK7ajj0C3YptfAPqPwCChdufiUA8vOFSuo3KPHt-s,4861 +torch/include/torch/csrc/distributed/c10d/TCPStore.hpp,sha256=ADqtmPHdjjJ4eH67JW7wXgDN_DyakTfXDfiL9o4AGKk,5531 +torch/include/torch/csrc/distributed/c10d/TCPStoreBackend.hpp,sha256=9H-1CdsXtvZR69P3MKfttMHAzwgvJMJj2CFTjVrW3xs,1915 +torch/include/torch/csrc/distributed/c10d/TraceUtils.h,sha256=PBysQdKS90W6OrwEh7GQqWbAnfKIPWT02yyjg5_uGyc,9664 +torch/include/torch/csrc/distributed/c10d/Types.hpp,sha256=JT_6SdyXQp3DI5iAc2WNj9mCkgtHQSEoL-STYT69xpc,5530 +torch/include/torch/csrc/distributed/c10d/UCCTracing.hpp,sha256=vNjAvgEBc5q-MFS0wFEPX8a3UVtk8M2JvQZpq1wLu3E,2618 +torch/include/torch/csrc/distributed/c10d/UCCUtils.hpp,sha256=07gthStE6L7_EDTjGvfTG_562NdCGlGorZqMQXxDYD0,6806 +torch/include/torch/csrc/distributed/c10d/UnixSockUtils.hpp,sha256=DFlg0Aqc0EhCX4U2TE185iIr3Idnm9WLh-wZrSZBpJ8,834 +torch/include/torch/csrc/distributed/c10d/Utils.hpp,sha256=2gyktQOpt9giDQhEQmKjKsjnlWWLPja8218e6douugA,24791 +torch/include/torch/csrc/distributed/c10d/WinSockUtils.hpp,sha256=vQX-7f7jyQGZl237wF6pcWI417PGmVC5bZPApCRKH9I,825 +torch/include/torch/csrc/distributed/c10d/Work.hpp,sha256=68rN1Cw5eO7oyx3lfATiERvTlve7NTHWKUfsyBaqj-0,6294 +torch/include/torch/csrc/distributed/c10d/c10d.h,sha256=K_YqFNb5AkcgF_ugrK0GF7EhQgs_b6sqBORk2w-AQak,434 +torch/include/torch/csrc/distributed/c10d/comm.hpp,sha256=_LgGHMUG2pyYt7sTG4adLhAok-4IjfAMVOyGxAXrdlg,4824 +torch/include/torch/csrc/distributed/c10d/control_collectives/ControlCollectives.hpp,sha256=lcBSHr-qxXhE0yzLgvBiyHTuqG7CkxD-WDJ1iqhSSMI,2023 +torch/include/torch/csrc/distributed/c10d/control_collectives/StoreCollectives.hpp,sha256=nvLQLHZFdSSy8oXzUBmTLuQ7zlBeGfBvFi6PLVNZtEE,2268 +torch/include/torch/csrc/distributed/c10d/control_plane/Handlers.hpp,sha256=vGtu44XYZbtv1rlm81v3NSzOWH8WAa6ZAKmJMIAB4T8,2652 +torch/include/torch/csrc/distributed/c10d/control_plane/WaitCounterHandler.hpp,sha256=1UVZ38-jGli5Xtauvju049ZkVWwkpAI-CL4ZExWZuDQ,587 +torch/include/torch/csrc/distributed/c10d/control_plane/WorkerServer.hpp,sha256=l8BWi-2ukKmBZ3GVI82DL5QyuG2TNwCMB4qbnQVdeSQ,939 +torch/include/torch/csrc/distributed/c10d/cuda/CUDAEventCache.hpp,sha256=zsBh7h7LtEoYv7MXuAL6RtoUBW--KWjHAXOOAWtPNfw,1032 +torch/include/torch/csrc/distributed/c10d/cuda/StreamBlock.hpp,sha256=o9uOMOCc9gsfqauQ9aSKHFJL3q9wE2WNKaz7_lthbAA,1160 +torch/include/torch/csrc/distributed/c10d/cuda/utils.hpp,sha256=FjH_T3dEdtoNjcJcrCFGaTMqOAJPYEwh_kP_pEiK8A0,499 +torch/include/torch/csrc/distributed/c10d/debug.h,sha256=lCfpTcvK_QeOPZscvy5TL1Wu7OZTCO_jd70dEsnxnKc,886 +torch/include/torch/csrc/distributed/c10d/default_comm_hooks.hpp,sha256=rZNkMvMqK6wzNmAEEPPs4iWGP44YZhcfm8SQQu_OahU,2056 +torch/include/torch/csrc/distributed/c10d/error.h,sha256=5TYM7FGo5tA1akQ6HjdA5kyw7IezuXxjxNPGZkJMPiE,1602 +torch/include/torch/csrc/distributed/c10d/exception.h,sha256=99ALZT6itk8ihl2Gmw8B7gmBAxsLm0pm8A5xqk7C6H0,1624 +torch/include/torch/csrc/distributed/c10d/logger.hpp,sha256=xfCuzHv3YVrXZ2JBTfvwy0egIc07QNGtkQzWuumGMaA,6862 +torch/include/torch/csrc/distributed/c10d/logging.h,sha256=CqpDCLCqxIx0ILBJo36AFhdCNgi3LgSHRaRbO5xtyGE,2136 +torch/include/torch/csrc/distributed/c10d/python_callback_work.hpp,sha256=cZGkJYVoCudiY3khPMT37SuC1AIWUonDITSXrXXe7NM,1063 +torch/include/torch/csrc/distributed/c10d/python_comm_hook.h,sha256=a7axuxEqocxF676OcvVTH7xZeGbA-7J0jkAJcjiiO7I,1366 +torch/include/torch/csrc/distributed/c10d/quantization/quantization.h,sha256=tOVvPkKoYL_UVaNkkO0Yzws9A2Ejz1uObFEUwP4FWwM,729 +torch/include/torch/csrc/distributed/c10d/quantization/quantization_gpu.h,sha256=zqCfTB1a8zcWAkGEkWhSLtLCteiy6dRmn401vqhr5Ro,731 +torch/include/torch/csrc/distributed/c10d/quantization/quantization_utils.h,sha256=CmpOUY0oZ_zN_qnvM8EE6prnIzUERIQ9vxYv2SaFf1U,1549 +torch/include/torch/csrc/distributed/c10d/reducer.hpp,sha256=uJsb3bfS2SGTNGHdaDfjQDOlE3sX7_B8xv4DBbNstx0,27023 +torch/include/torch/csrc/distributed/c10d/reducer_timer.hpp,sha256=dz0yj7742Ep9wsSnlgcqnL8rg8Mj9xQaeBrsuDN_xA0,2724 +torch/include/torch/csrc/distributed/c10d/sequence_num.hpp,sha256=Fe4Kro_Sgcopzi80p8dX2Pm4SI323Q_cQQ4VubDmMaw,2029 +torch/include/torch/csrc/distributed/c10d/socket.h,sha256=P3WBaU-oAiSP7XWDYvxbfcU_lpkVHknnpdI4-ERP1fs,2824 +torch/include/torch/csrc/distributed/c10d/socket_fmt.h,sha256=NWMbZIgn3DTxxGoh9HgClSezIy_DMf8XdnNVsEENV80,991 +torch/include/torch/csrc/distributed/c10d/symm_mem/CUDASymmetricMemory-inl.h,sha256=o5o_UlhD1Z12Td2F-Bs8hvkqDU765c5FTOfKyJPM88E,13314 +torch/include/torch/csrc/distributed/c10d/symm_mem/CUDASymmetricMemory.hpp,sha256=-cBI_J3cEOxV6UKzUtmKYeU_DcCz1redo8Vl_SbpzGc,5197 +torch/include/torch/csrc/distributed/c10d/symm_mem/CUDASymmetricMemoryTypes.hpp,sha256=w4fgk7dQmFsF9CJeK0Uo5MQ23_BcKYJp18xV2ATXMxY,1176 +torch/include/torch/csrc/distributed/c10d/symm_mem/CUDASymmetricMemoryUtils.hpp,sha256=kw-NPsF1B2h1ixr4rbLLAIKVn9bhK2qciIlxFtGLnjY,3340 +torch/include/torch/csrc/distributed/c10d/symm_mem/DMAConnectivity.hpp,sha256=A5pURhytEUox2HsqIhnRZPOkrl7nLbLYQW33f0pVFgQ,1574 +torch/include/torch/csrc/distributed/c10d/symm_mem/SymmetricMemory.hpp,sha256=5b3ZK3L5YpkrDalMCEt7RUE8Dahz6ekk7oBq9CAcz-k,9243 +torch/include/torch/csrc/distributed/c10d/symm_mem/env.hpp,sha256=1OHqqcFOpMjTk9YP_ubQFmPu5b6vfa-ajxVoLM-MrfY,691 +torch/include/torch/csrc/distributed/c10d/symm_mem/intra_node_comm.hpp,sha256=BX66CmqrEm57LSCB1CMxDzdClyBfujpc1v5ui0-m0Qk,2675 +torch/include/torch/csrc/distributed/c10d/symm_mem/nvshmem_team_manager.hpp,sha256=dPqductQPBQdO0KtCfrOw6_Ohem5d-z_65Mxa-wE4E8,6826 +torch/include/torch/csrc/distributed/python_placement.h,sha256=PdymHZEfOE3m4K38ABx6feZtTAhjlcbNf6tPdfQwWVc,434 +torch/include/torch/csrc/distributed/rpc/agent_utils.h,sha256=TWWMizTwnvHMSv23nYiLZcJpq3w3UYsgOvLvLvfU0cM,1930 +torch/include/torch/csrc/distributed/rpc/message.h,sha256=hPWZKoUXxgJ40jOaZa8lw6Vg8ey_MnJuV1tDsih0gHY,8085 +torch/include/torch/csrc/distributed/rpc/metrics/RpcMetricsHandler.h,sha256=JDE0Piq-1ngfonIy0EmR2JNnpQHjvl8WMXlHdw7uOzU,1867 +torch/include/torch/csrc/distributed/rpc/profiler/remote_profiler_manager.h,sha256=58hIIyiMv8ahbfuEBsl6Oc_EWG6bDE_5lmm-9hgL95A,2540 +torch/include/torch/csrc/distributed/rpc/profiler/server_process_global_profiler.h,sha256=QpjidErUgbOu2_q3q4dq9SVS7b3K47yPYGo3x7jcJXw,4787 +torch/include/torch/csrc/distributed/rpc/py_rref.h,sha256=eKoothfeP_hK53WXU291Mg3qIR2skMe5D3jSYBZr_8I,3305 +torch/include/torch/csrc/distributed/rpc/python_call.h,sha256=1FE7s8-NOEg9I8XDPd5kUl6jQTSnJWa7sjVsSMqHAYI,1099 +torch/include/torch/csrc/distributed/rpc/python_functions.h,sha256=KftlVlamwK-GIIveWuX-7BjCi2NuuCQ85Mdpr3dMk-I,2582 +torch/include/torch/csrc/distributed/rpc/python_remote_call.h,sha256=k0HpwF1Te_abPrXplgcNwQaw2SW-b2AVPNx4RMM5aug,1582 +torch/include/torch/csrc/distributed/rpc/python_resp.h,sha256=oG1deAVXk0qrMHUtuKA_UslUM6_g-6dTQptdiFn_6kI,903 +torch/include/torch/csrc/distributed/rpc/python_rpc_handler.h,sha256=0v0iln334-ej8F9X_1z-oeuvlExQfUNrahrKx2bHbXc,5342 +torch/include/torch/csrc/distributed/rpc/request_callback.h,sha256=2lrM4LVagwsu6FgcFPB3C19NVcoTGtz1z4RjTrTONLo,1517 +torch/include/torch/csrc/distributed/rpc/request_callback_impl.h,sha256=2LZYcnxewQCKWUMoUSIly04-ATQNnxsbhb6nCJ1ulh4,2402 +torch/include/torch/csrc/distributed/rpc/request_callback_no_python.h,sha256=g3eIXzYBJxU0M0lET4s_4hEa16VL3956b_yq_AV0Vw4,4278 +torch/include/torch/csrc/distributed/rpc/rpc.h,sha256=F2MjETta1Z_b9QqTyxk9SCNX4UZLbSdaU9dgtBaLDzU,432 +torch/include/torch/csrc/distributed/rpc/rpc_agent.h,sha256=xfqv3hHZtwObRoiIYAO0T7F7Bb7T17uycgjKS7dsbCc,14243 +torch/include/torch/csrc/distributed/rpc/rpc_command_base.h,sha256=IjKd_dpRmgI6nl7ePa-yHG4vHB6wSjjKX6DCXkHTOTw,960 +torch/include/torch/csrc/distributed/rpc/rref_context.h,sha256=QL1n1IjrIc4SFZHEmEmNT8t9wufd-B6OvU2_gYPPv0U,16373 +torch/include/torch/csrc/distributed/rpc/rref_impl.h,sha256=5cFN0wSoCMllXI1PXNrWRfySkhZsw97CLWBtUSKMTT8,17133 +torch/include/torch/csrc/distributed/rpc/rref_proto.h,sha256=Bv920YhL3MKkDDGdgwTWZ8E4FRkr-AFOcGhBtWN6Lq4,5779 +torch/include/torch/csrc/distributed/rpc/script_call.h,sha256=7j_fE_doe35qXy7ETsOE5oReVDk_gykSfVI8AXTgaRY,2812 +torch/include/torch/csrc/distributed/rpc/script_remote_call.h,sha256=NeTFDqlmLBBmVsNxS33IFHM22GaHrBTD0JGBMkU8cIY,2006 +torch/include/torch/csrc/distributed/rpc/script_resp.h,sha256=7utifefqqf1792WON5-XublM0Lzf4ajc_eLMM0ac_hE,930 +torch/include/torch/csrc/distributed/rpc/tensorpipe_agent.h,sha256=SL23FK8jNPzwlzvlqFcGCsrnxkYdPqvau1SVHWB7ZG4,18392 +torch/include/torch/csrc/distributed/rpc/tensorpipe_utils.h,sha256=Ud0kNqYZ7m0V07BifOuayoW3_WT9MfGo8LbB_xpdMS4,5119 +torch/include/torch/csrc/distributed/rpc/testing/faulty_tensorpipe_agent.h,sha256=xUnxbCTNaHtt9-YkuzPUQQ3C3rKnLA0YbKAuztVYLKE,4149 +torch/include/torch/csrc/distributed/rpc/testing/testing.h,sha256=_jYGhXvxTxseRTfil0afzvTxfcLaCRjPz3QHaXKwJ2s,450 +torch/include/torch/csrc/distributed/rpc/torchscript_functions.h,sha256=pfgrFUy321LY8p6pIfrnpbtZBqrWjR_-qyj_yWU1jDY,1952 +torch/include/torch/csrc/distributed/rpc/types.h,sha256=1TCcDBOHAR1Mb4l06859W1rA5qE44Y4AT-ol41-FJLM,2539 +torch/include/torch/csrc/distributed/rpc/unpickled_python_call.h,sha256=6_Gm5dJE7hdsqUPpkugExGaVlF_qC1jxcucZBJgivLA,1685 +torch/include/torch/csrc/distributed/rpc/unpickled_python_remote_call.h,sha256=G_m5Cz_o0STuo0crHzyiG-GRuNrdtJiajF7O5fHAjpo,1499 +torch/include/torch/csrc/distributed/rpc/utils.h,sha256=35I53ulnRpa4-IZ0GZjbl9O0oPSFrJAjbaGchQZ7f30,4135 +torch/include/torch/csrc/dynamo/cache_entry.h,sha256=ZFfF058ErusBj3G2imnomFVnL_g5Lj6dZZc2duP_KbE,3162 +torch/include/torch/csrc/dynamo/compiled_autograd.h,sha256=HUE2tsHA-ANJ7RAzoVWL81gY7_AAqDd33LP-Wdin-Ek,52506 +torch/include/torch/csrc/dynamo/cpp_shim.h,sha256=zOClNx81hgjJ6rFRrinCiSX8iOErjWfIvwZwKOmtYV4,631 +torch/include/torch/csrc/dynamo/cpython_defs.h,sha256=f3pWl-NJmNcP3ss3T0-098w1Et46Gf-7QX0u4T1UDu8,1219 +torch/include/torch/csrc/dynamo/cpython_includes.h,sha256=avf806jFWL7lED3R4Dik8HjUe3wX3w7VK7en81C06pU,2010 +torch/include/torch/csrc/dynamo/debug_macros.h,sha256=cS_UhWaKyd5NSgKR8w-PwYe2V7C0EAU4L-aYukys9Ds,3889 +torch/include/torch/csrc/dynamo/eval_frame.h,sha256=zjpqZiSVkIqIysBTX-GN-kLeSkqwgGcWETtJqDcQjow,1806 +torch/include/torch/csrc/dynamo/eval_frame_cpp.h,sha256=El8vGUT391VhToJOC3cavptTtLzpYm3q7KkOUxSeHhY,910 +torch/include/torch/csrc/dynamo/extra_state.h,sha256=9IHoN7EIPlbQyOc-Za1eYJrGfvMOl4ucSSGfLBJiycg,6895 +torch/include/torch/csrc/dynamo/framelocals_mapping.h,sha256=xHGAHAkMR8thYUmXV8UypeadifR_gyKt9sICQ7VMD0g,3132 +torch/include/torch/csrc/dynamo/guards.h,sha256=Fu9-dMDt8mVUJ7HDxLuj7ytAuXR0c-ToCHYm7veuXf0,4263 +torch/include/torch/csrc/dynamo/init.h,sha256=odTEhb9Kr4S1q66OMtyBQHxN61gnc_gybnFsGWXk2TQ,457 +torch/include/torch/csrc/dynamo/python_compiled_autograd.h,sha256=bQV7beH1PdrVyF-Rt2vNOzI24J_NtRE02BMMklYt53M,481 +torch/include/torch/csrc/dynamo/stackref_bridge.h,sha256=SxhodIrZRVmV6x5ls-H5X6zFx0WSjXtDVS9ScxSsSOA,641 +torch/include/torch/csrc/dynamo/utils.h,sha256=E66_oVHTieMYnG_qeGjM_R-mcBZvejKD2oY-4pWtOfQ,795 +torch/include/torch/csrc/export/example_upgraders.h,sha256=dCtICfAUTY_IFl5exobwyEOW1w8zGFAYPdLM9dGmUdg,781 +torch/include/torch/csrc/export/pt2_archive_constants.h,sha256=Vcmh7Dxm7DtR-Zycdj9EoL2Uyu0wXbskyHl7Tz0Tfd0,5003 +torch/include/torch/csrc/export/pybind.h,sha256=soSh4yF6amzyl2lcPRZU7n2-SnXh2roFWZVfpKs1E3k,408 +torch/include/torch/csrc/export/upgrader.h,sha256=zL2twWoj_Pxj2weUaKZQi2YQcEo1R-wwgVjn6PdVzpw,5727 +torch/include/torch/csrc/functionalization/Module.h,sha256=BI6u57LkzO4Rcka7Sm_aK3dP6ISLG1STHKMoeXrg3Q0,1349 +torch/include/torch/csrc/functorch/init.h,sha256=0cWS0N8B_CxvgBAPgumtU9OvwoeRVCEFoA5dxbGqi-U,372 +torch/include/torch/csrc/fx/node.h,sha256=fZs35a413E9n9Q9OXcxKcyvaG7CR-GdLZ_S02PmvMTk,395 +torch/include/torch/csrc/inductor/aoti_eager/kernel_holder.h,sha256=QLQZZXMNnCxb04erGCYGCHTLzy3cK6BtDysmXq5V_Ys,4496 +torch/include/torch/csrc/inductor/aoti_eager/kernel_meta_info.h,sha256=aNxXAZgzrVK34NoSTQEyWCAUgAAoTqGYu_kg4YfbUvw,6113 +torch/include/torch/csrc/inductor/aoti_include/array_ref.h,sha256=zgNBye6lCfkvcTenuINpygj-VSl4-5CenPPYk3MZnkE,567 +torch/include/torch/csrc/inductor/aoti_include/common.h,sha256=dgCQtCOQ5mstguoEPAiMmvNNBp0ju_ooJOREm9cdUO0,691 +torch/include/torch/csrc/inductor/aoti_include/cpu.h,sha256=ANICXeiR8iyZxdR76p5aR5HZPg658ST55GI7CiHrcDE,395 +torch/include/torch/csrc/inductor/aoti_include/cuda.h,sha256=YdMhpoH7S1koQuRAqCdDljeei_1zDc-_DUvzzGiQxVM,396 +torch/include/torch/csrc/inductor/aoti_include/mps.h,sha256=U_oqAESKxJPnbxynDWJKustOV50GdhcFycSGN135URE,395 +torch/include/torch/csrc/inductor/aoti_include/xpu.h,sha256=pQowHEAkEOHpRfb-GjujAJplNyS1LrrM-qW0fKEma10,395 +torch/include/torch/csrc/inductor/aoti_package/model_package_loader.h,sha256=j80PISNxezoPNmJEQ448BQU_cp_DpBUuZaCSQwnSx8U,2193 +torch/include/torch/csrc/inductor/aoti_package/pybind.h,sha256=9346zDhKHPloOwcHmrGcgqzvDdH6rMvuqFGfVpKzeUM,415 +torch/include/torch/csrc/inductor/aoti_runner/model_container_runner.h,sha256=hRvFAKjMqYR8sXbLYUH1k17_QnsV_ROm8zShYrJ0LaA,5848 +torch/include/torch/csrc/inductor/aoti_runner/model_container_runner_cpu.h,sha256=7YLDlWNn9wrIHodJJxlArITlkUaSlZ25W4wFMeiaI9g,756 +torch/include/torch/csrc/inductor/aoti_runner/model_container_runner_cuda.h,sha256=bbpsuwgr7vc9xFxq_IYL76a3h7Hs_y3NzWUrgJhaYPE,1425 +torch/include/torch/csrc/inductor/aoti_runner/model_container_runner_mps.h,sha256=vFN_AFkxYxKZheXyhVXhXcNAGA4xfFlmotIauID62mk,733 +torch/include/torch/csrc/inductor/aoti_runner/model_container_runner_xpu.h,sha256=cUFDHjW78lSZNcrSysRL-NK_D_2jtUAFg5aaL65gbT4,1512 +torch/include/torch/csrc/inductor/aoti_runner/pybind.h,sha256=TCJF7aCv6cTa5TbxT0BKExB7etErhM3zWePZYKbcO-Q,414 +torch/include/torch/csrc/inductor/aoti_runtime/arrayref_tensor.h,sha256=U-4QQ0IDlPWmql8BWeHMnkWCZ15mr8UTbeo7Ldkkmvc,6757 +torch/include/torch/csrc/inductor/aoti_runtime/constant_type.h,sha256=opSxf6ZRtFtm297TI0oGBIviVjOtZW8Hazu2xQ6SO54,806 +torch/include/torch/csrc/inductor/aoti_runtime/device_utils.h,sha256=H_E92nUReLyTW4SLOAQ9YxoiK-QmZW_o9g0FsCOFpFE,2646 +torch/include/torch/csrc/inductor/aoti_runtime/interface.h,sha256=UxmmBTthXxMJ2oZ9nN3zq3XwDl2a4Pd43YSFgTM7KbI,11679 +torch/include/torch/csrc/inductor/aoti_runtime/kernel_context_tls.h,sha256=bpzJQnaq9E-6Y86YuND8HwHUZtowW01F0Sb5AhAlYE0,2727 +torch/include/torch/csrc/inductor/aoti_runtime/mini_array_ref.h,sha256=OG1oMJxHp2S1kpl5y1F2rH0G69VuaGF1Ao5sGezgjqs,5145 +torch/include/torch/csrc/inductor/aoti_runtime/model.h,sha256=E1GAcGw8A3xkGlRJZLdaEIju1oT-m5noPVBf--AZBqA,2578 +torch/include/torch/csrc/inductor/aoti_runtime/model_base.h,sha256=3fkb5EjFF0GsIY9YyVqJGwOtVUEMMCaOZBC4Of6pCgY,30672 +torch/include/torch/csrc/inductor/aoti_runtime/model_container.h,sha256=biqhJZ38o5MQcB6q38M5GDn0G6z5gS6J2kV62dcwPRU,29960 +torch/include/torch/csrc/inductor/aoti_runtime/scalar_to_tensor.h,sha256=koTI_Uuy4ucJZxTPoHUcziZrNR_TK1YLg0aXQXUUHfA,1887 +torch/include/torch/csrc/inductor/aoti_runtime/sycl_runtime_wrappers.h,sha256=aMcYN-cONvgsCOmppzzEbJtO8iC_PihI86NjX2J6xe8,6305 +torch/include/torch/csrc/inductor/aoti_runtime/thread_local.h,sha256=bRZDEhsg-WYNMjsjQUqaVYAEnTICv9LHG-nbwA4aNr0,4771 +torch/include/torch/csrc/inductor/aoti_runtime/utils.h,sha256=1pZJVsurr5OhkZQclKOJnzcr-cS024b2XV0na2U-FZA,14841 +torch/include/torch/csrc/inductor/aoti_runtime/utils_cuda.h,sha256=I_42fkCc64S19gAibLMFoD8tlRPzI3ZGInUgabMxhCw,2147 +torch/include/torch/csrc/inductor/aoti_runtime/utils_xpu.h,sha256=cHVpBEMM7B8lwaD_ZIm9Mc6EJYEV1mETxVLWIslFD6o,2030 +torch/include/torch/csrc/inductor/aoti_torch/c/macros.h,sha256=xT9_tfdFS67hvHU3y-AXOT9TkvJcUSOHezqz43YlIfA,2387 +torch/include/torch/csrc/inductor/aoti_torch/c/shim.h,sha256=ljp3O2ElJp2JX_T_ugStYYA74jGXm2WAEv45oKzGviY,26400 +torch/include/torch/csrc/inductor/aoti_torch/c/shim_cpu.h,sha256=AJ7CEeQvyH5tSxEkz6yPcQErIOrnMW8Bx1RWA9kVYeA,7757 +torch/include/torch/csrc/inductor/aoti_torch/c/shim_deprecated.h,sha256=fCccDWZlDPBzyeVTvIeGO4MNIRcDtKxszsf5dm4Xhc8,6750 +torch/include/torch/csrc/inductor/aoti_torch/c/shim_mps.h,sha256=10Bnz-m5fRaiHC3fJRwifE0wLNkmUpJJra_Cb83fQWc,3292 +torch/include/torch/csrc/inductor/aoti_torch/c/shim_xpu.h,sha256=NYdpzn8PmkhhsQN1C-07ovUSsTOzWKx1XiEiAZZrL90,6192 +torch/include/torch/csrc/inductor/aoti_torch/generated/c_shim_aten.h,sha256=Snve9L1xTfJJ6RQwOte1qOqDkOtg66gQvMZTu_HARY4,1916 +torch/include/torch/csrc/inductor/aoti_torch/generated/c_shim_cpu.h,sha256=8mduu1acaSpxK0_WjjYaRl9hjBJinGkChgLcOXfRsEg,30934 +torch/include/torch/csrc/inductor/aoti_torch/generated/c_shim_cuda.h,sha256=rVzb-44OOSnRP1novb5sniQTAqmL10-hrj5lzei2w1U,36038 +torch/include/torch/csrc/inductor/aoti_torch/generated/c_shim_mps.h,sha256=PO7wixusZQVJmMO2ooUJjf_xL-K_VO7E4vfs6vPXmV4,24792 +torch/include/torch/csrc/inductor/aoti_torch/generated/c_shim_xpu.h,sha256=USJ2D1ngJFISGvdRm0_OOzd4leAtwH2cjHSKJHzWhQo,13027 +torch/include/torch/csrc/inductor/aoti_torch/mkldnn_tensor.h,sha256=91it85Ml6In0jeAENxDVVvBylaFBRUvXdNpFTgYpiE0,647 +torch/include/torch/csrc/inductor/aoti_torch/oss_proxy_executor.h,sha256=DSd2MFSthsiZrMXP4DFXMaXrUjKC0hNaqoblmckhpZk,5051 +torch/include/torch/csrc/inductor/aoti_torch/proxy_executor.h,sha256=pmmEWSvtmBVlmjdB-WClSYYvTXoh9ajuXqLM43R9qQk,1153 +torch/include/torch/csrc/inductor/aoti_torch/tensor_converter.h,sha256=7c_G_nAhepI74yEvVBs4JREDFEpxGzKGw2lFF13cLkQ,1238 +torch/include/torch/csrc/inductor/aoti_torch/utils.h,sha256=5r5dK4ZIblL8ZpXDlVUh54hK1g_i4l78LtVbZ56tax8,8065 +torch/include/torch/csrc/inductor/array_ref_impl.h,sha256=T1K0UNbX1ywHE_OhBlfQGArR6wT1SFtCY42xfSkv6gQ,3279 +torch/include/torch/csrc/inductor/cpp_prefix.h,sha256=824tPd6j-d0cG3K1CwgSaOxSDE1Rt_5-CJSEFxWNEd4,41016 +torch/include/torch/csrc/inductor/cpp_wrapper/array_ref.h,sha256=qFxn7VrqE2KekiQEGvUpqAY-G0BvLOw-eV11Tfd4-hI,566 +torch/include/torch/csrc/inductor/cpp_wrapper/common.h,sha256=v41gI6cyDovVaUPUtkbhdceciFoKi6DwlNw1uy9zBYk,2263 +torch/include/torch/csrc/inductor/cpp_wrapper/cpu.h,sha256=W1BZ1J852BRkMzo3FrdUv45p8bVGZjJgHeTw02UvgqI,394 +torch/include/torch/csrc/inductor/cpp_wrapper/cuda.h,sha256=RLbAQwpIIC2Mh3_vk0B3RxOeXoNeh-gmDfb0rdPykds,395 +torch/include/torch/csrc/inductor/cpp_wrapper/device_internal/cpu.h,sha256=s2y5dDLH6zskWtqtOUrXv_fStygEWeRMrJYLC3wMxco,341 +torch/include/torch/csrc/inductor/cpp_wrapper/device_internal/cuda.h,sha256=zaMNA4-Utx0lVBNYw8wpc6C4ys-otmt6gfdlSjzxd90,400 +torch/include/torch/csrc/inductor/cpp_wrapper/device_internal/mps.h,sha256=f_XPGqsoKg9GVRv7VuicTjChzFIFwK5bXnVIdX2xZDA,397 +torch/include/torch/csrc/inductor/cpp_wrapper/device_internal/xpu.h,sha256=QrKTRj07ISmoPJBfwuNohNVXXDRF2nBUTrHnZq7z1o8,467 +torch/include/torch/csrc/inductor/cpp_wrapper/mps.h,sha256=_QkKvg7_sR-X7S7VvvEjhvr_aCNqjhrtQbSsP8prJEM,394 +torch/include/torch/csrc/inductor/cpp_wrapper/xpu.h,sha256=CJT7WKcAKt8U-51cifCuaj_prsWkWLiwidIxbm8Neg8,394 +torch/include/torch/csrc/inductor/inductor_ops.h,sha256=AJaraWcsS8Ga8b3gdn4oz1Bw9rFlYXrD0JiRh7ZH4u0,1393 +torch/include/torch/csrc/inductor/static_cuda_launcher.h,sha256=Rb3A8CWL-WOFr9kwxgs9Jf76QArd38z0X3jPPRQhMLk,484 +torch/include/torch/csrc/instruction_counter/Module.h,sha256=0sWbjxIFI5BNoeXBumdQQYTAh-zdnSaNeKRPIEFmyME,438 +torch/include/torch/csrc/itt.h,sha256=6jUh2WQ8e8QrrHPGoEPuPqygaZBmAxYTMO2B66kGksk,448 +torch/include/torch/csrc/itt_wrapper.h,sha256=wm75LvA0SRiH-pHep7rZ-3GsnJbiE_PU9a4EhE6I7aA,591 +torch/include/torch/csrc/jit/api/compilation_unit.h,sha256=wamMdCic9r--KX6DbBw-ayjiC0pRpMiJtzfyj2791RQ,12306 +torch/include/torch/csrc/jit/api/function_impl.h,sha256=G-mgP6yunU6RaCeXGtAYwZfWc80MHSkyNqvEW7IHX2Q,6180 +torch/include/torch/csrc/jit/api/method.h,sha256=oUw0XfrbQLnONFUSxDI9KozqgSKrU0XHGRgRAsLAA5Y,2767 +torch/include/torch/csrc/jit/api/module.h,sha256=MizQpw0SQ8Y-RFs-s0jjopmYkNZo_ixSJ3GhWTf1-I4,24441 +torch/include/torch/csrc/jit/api/object.h,sha256=HHVqLonaWsJzrQcZ920av1BGODLdU7HkWQjObxo28ZM,6542 +torch/include/torch/csrc/jit/backends/backend.h,sha256=iy9StWneqLLE2OiLsr89Wp13Kmzxu1RkQKHpP7Sa_bs,4205 +torch/include/torch/csrc/jit/backends/backend_debug_handler.h,sha256=lyyQuuEPl8MVCmXYI1FpkFwunNAAEfGMEgAr5_EP8Uw,6729 +torch/include/torch/csrc/jit/backends/backend_debug_info.h,sha256=gOQHrWN0yRxPu0NZKqxBYch8_0O7O3duSpLhKE2N2tc,2635 +torch/include/torch/csrc/jit/backends/backend_detail.h,sha256=aEJ03amVxU6XgIt8z-o5u_y0-7XhPHxT0nOyEHUhZd4,1377 +torch/include/torch/csrc/jit/backends/backend_exception.h,sha256=MpiR89MjIQkuk6l-64-GgQ_jfiSfiyP4TePt9vmekZY,2431 +torch/include/torch/csrc/jit/backends/backend_init.h,sha256=yd9K5jyvUVe-nzXB6go_JyKamKssUh3Dy75EdwQ5l5k,520 +torch/include/torch/csrc/jit/backends/backend_interface.h,sha256=48k6UNQ2vuMS7olek8c584R-kEYidCPi6-vzcmhakH0,1450 +torch/include/torch/csrc/jit/backends/backend_preprocess.h,sha256=g0u6rZ2deMGur6s3WERY7t9eQZXl8m9pIXyogia26_Q,688 +torch/include/torch/csrc/jit/backends/backend_resolver.h,sha256=WHSeN__eIE3JM-HunjT-v7jSBY8xxnr40tbKbj9sp8I,519 +torch/include/torch/csrc/jit/backends/coreml/cpp/context.h,sha256=vT6oFb6TxOAkIpTM1mpqSQ1lI5wflBQ8Dk2mKS-cGW8,719 +torch/include/torch/csrc/jit/backends/coreml/objc/PTMCoreMLCompiler.h,sha256=Tnt3GBQ5Ea5krwfKuni0XMAOvBjtign3tJCJcQYbo9c,814 +torch/include/torch/csrc/jit/backends/coreml/objc/PTMCoreMLExecutor.h,sha256=Ju5oGzt0YoLvmZRMHp0jxxfNvmRh4YaBLSzThQaZX5w,692 +torch/include/torch/csrc/jit/backends/coreml/objc/PTMCoreMLFeatureProvider.h,sha256=0IWiVKnwmlvPBbKrHMgCuwCFqllW6uZ7pJL2V7LWxCE,625 +torch/include/torch/csrc/jit/backends/coreml/objc/PTMCoreMLModelWrapper.h,sha256=7VOCQhhfO9O3d5KgZZtzDMhBbGkjT5l7GNZ42IdSuQg,1222 +torch/include/torch/csrc/jit/backends/coreml/objc/PTMCoreMLTensorSpec.h,sha256=bF01xa8jKi4UQ27cp9guee3fIvlpkbcMglc-23GilEU,933 +torch/include/torch/csrc/jit/backends/xnnpack/compiler/xnn_compiler.h,sha256=ACcbRjfc1PFL_Hjwj0iwL6BKMA9Ezk1MBApXIq6q5g4,1065 +torch/include/torch/csrc/jit/backends/xnnpack/executor/xnn_executor.h,sha256=Jq_tw4C3h3xt3_whXq06IYsVxCA9H-AGMyeLE5nzHWY,1894 +torch/include/torch/csrc/jit/backends/xnnpack/serialization/serializer.h,sha256=o7Td8eMd25L4ahQObr6R-D5YmN4ET-PZrDNj4uvhaoo,3127 +torch/include/torch/csrc/jit/backends/xnnpack/xnnpack_graph_builder.h,sha256=s6jZS7oQXA0LM4p0CE0E5JRL8wnhoU5e7bLEcGs9OHk,3591 +torch/include/torch/csrc/jit/codegen/cuda/interface.h,sha256=_fpO4YYSQ7TPLwgjTKgx6kHTi-vJYq9cFxck5KLtayA,2175 +torch/include/torch/csrc/jit/codegen/fuser/arg_spec.h,sha256=47fk5kTJclvhGUqQhc-m7OttYi9JfnbzUsvjq_1UcBA,1667 +torch/include/torch/csrc/jit/codegen/fuser/codegen.h,sha256=fjDKrpsKgsbWMh1bstxYWeXwNUmXQlGoutKTjBTXW2o,1028 +torch/include/torch/csrc/jit/codegen/fuser/compiler.h,sha256=qKy7o7svaz_qKeU5_XNmbFP0kgP9U7LJWDGseiordn4,2149 +torch/include/torch/csrc/jit/codegen/fuser/cpu/fused_kernel.h,sha256=jJPzhMTvtQcMSkJnT6oGvgUfoHxeLvgCjVSJuMhmDJM,1297 +torch/include/torch/csrc/jit/codegen/fuser/cpu/resource_strings.h,sha256=8B9A0_powknLPEpJvBi9KLJUd1lMEzFs4aplebU1jGo,2638 +torch/include/torch/csrc/jit/codegen/fuser/cpu/temp_file.h,sha256=R1Do8X91bzRDr7oRiJmTe7HyEWVDen0lA3o4YGhOZXI,3285 +torch/include/torch/csrc/jit/codegen/fuser/cuda/fused_kernel.h,sha256=wmau-tyAR7CFq1TVp1zNMXbT6SCreevkgN_A39ImhLE,1829 +torch/include/torch/csrc/jit/codegen/fuser/cuda/resource_strings.h,sha256=MZeMPFDXH9nYEa8_vSGh1uCvprYcXQWKbXzX1V7XwQw,11592 +torch/include/torch/csrc/jit/codegen/fuser/executor.h,sha256=sf_gPmPNBgzyhUO_LiiS4Puq0X88XM-ePcqUrnMslqg,778 +torch/include/torch/csrc/jit/codegen/fuser/fallback.h,sha256=3Qbl7q-UwWDZHtiUNbhJC7QdZU0_23Jz7J6gZvacfBk,444 +torch/include/torch/csrc/jit/codegen/fuser/fused_kernel.h,sha256=yWZxT39lqZaQPuRxI33VY3RTb4DojKRoRJvIC3jOs-0,3662 +torch/include/torch/csrc/jit/codegen/fuser/interface.h,sha256=ueR8L-Ldd2MYhpDBZ5LnVGUphkVjzd8DOQqYOk0Cw0A,2035 +torch/include/torch/csrc/jit/codegen/fuser/kernel_cache.h,sha256=Xd57aJTGFH9lREWAjm7ffxIHZuTbP1-S3h9TvugiQqw,1286 +torch/include/torch/csrc/jit/codegen/fuser/kernel_spec.h,sha256=LMJPceoemM20L6yWDmL23D5KrRaR94UwZBM9GaYGyX0,4804 +torch/include/torch/csrc/jit/codegen/fuser/partition_desc.h,sha256=hOIhRtK1A4XiXOUxlP-zjJTLhFkGOb-ocoC9G7sXhcE,2072 +torch/include/torch/csrc/jit/codegen/fuser/tensor_desc.h,sha256=CtZAHuNYzaRr25oP9RDwuMqs8Zv3gJKMmKjxUFAgNRE,3058 +torch/include/torch/csrc/jit/codegen/fuser/tensor_info.h,sha256=08plxwju6OZTbZ7Vcblv4Y3xr_uNbfA5VXr4cD1VRvM,819 +torch/include/torch/csrc/jit/codegen/onednn/LlgaTensorImpl.h,sha256=W4S8sNN6heQRxXoVLjVHEMEhWuPEVjarHWOjE8Aq7bs,8221 +torch/include/torch/csrc/jit/codegen/onednn/decompose_silu.h,sha256=A-J4u3qTl3RyBdCAXFnDDfVGS4sBZJpqG_R8pw7VQwo,456 +torch/include/torch/csrc/jit/codegen/onednn/defer_size_check.h,sha256=I1V4mer2HJ1Gyqm_NlYD6zs2mKOKT80aeWBdCM4TNNw,450 +torch/include/torch/csrc/jit/codegen/onednn/graph_fuser.h,sha256=WIyKCLReBB-sXrPq0ysnSye1z-CSmRgxRN1UzJN-fVw,1522 +torch/include/torch/csrc/jit/codegen/onednn/graph_helper.h,sha256=cySuz9xtsR0MkBJIaijZCUYdsxNxdIgJlO9ulXfKesU,2821 +torch/include/torch/csrc/jit/codegen/onednn/guard_shape.h,sha256=2ARmiea9xDzxntSK2QHqw1Fjvxz5GbQSJEMgOEdXtAs,452 +torch/include/torch/csrc/jit/codegen/onednn/interface.h,sha256=x9u26hiamU96wfHEvuMXdylcclEitusZ8erfpcvbnpU,1715 +torch/include/torch/csrc/jit/codegen/onednn/kernel.h,sha256=7B2diGD8occKN-R3OhIN3gLlOu1h6_np3s19p1qMmjQ,3042 +torch/include/torch/csrc/jit/codegen/onednn/layout_propagation.h,sha256=qPSksysswM6KT4pwqm13s4L8M9DZZb2ADoWY8n3jK74,457 +torch/include/torch/csrc/jit/codegen/onednn/operator.h,sha256=IB0R8KeF6ixC6qbxb9I5ve9DdTuPkJHMdpcnToU-vgI,4327 +torch/include/torch/csrc/jit/codegen/onednn/prepare_binary.h,sha256=ZBrySYLmqGqZIcebu2J2A4CXlyQM4RyIz_pkHnNcX9I,778 +torch/include/torch/csrc/jit/cuda/cuda.h,sha256=ZEFOtWY-5iQHHiAo6lbYSILhLT5v-V8FjKvVAdy2liQ,5595 +torch/include/torch/csrc/jit/frontend/builtin_functions.h,sha256=5DqAPvydTCyJaZDleYwSBRZpYV0PF8i888TOOjQLAVk,483 +torch/include/torch/csrc/jit/frontend/canonicalize_modified_loop.h,sha256=aHkYPqp3XI6mPx1_8ipC7oX9seQF1sx-bw6KarOu3Qk,560 +torch/include/torch/csrc/jit/frontend/concrete_module_type.h,sha256=yjNyqQMb6pmJzibjUkZeLy7fvxF5d0m3Qf7Foj1BNEk,9535 +torch/include/torch/csrc/jit/frontend/convert_to_ssa.h,sha256=TTB-4oSqqh5jgR8f8T_wWQgb7JAYv-kjerKTqvwMOuY,575 +torch/include/torch/csrc/jit/frontend/edit_distance.h,sha256=UFvo7kwx8X9xqn905HBhQdg-9f-3OWHiFAU09bF2_fg,501 +torch/include/torch/csrc/jit/frontend/error_report.h,sha256=35Rd1rAQUOo2woLT4fkVwcPPgxhAqwTn_7_cTy9etjM,2586 +torch/include/torch/csrc/jit/frontend/exit_transforms.h,sha256=gSajsC6qo1YAR2WJ2f1GobU0XQ8y0CmI0iuEEojQa5o,462 +torch/include/torch/csrc/jit/frontend/function_schema_parser.h,sha256=HgqGWxCZixlqXm79M3oaaEpN2bSb7QtBkWqQeNwX4m0,1086 +torch/include/torch/csrc/jit/frontend/inline_loop_condition.h,sha256=lN76TQY1oqnU--al5IEr8M2x19RMamGxIwh5SQoPZLs,600 +torch/include/torch/csrc/jit/frontend/ir_emitter.h,sha256=WHP_5DVdzNF_2OKooo6bJlbAEh3vg6jecg45gRKc2xY,794 +torch/include/torch/csrc/jit/frontend/lexer.h,sha256=zZZhrkiKYZv3BPnhHHSRCQWr6s29dJJuWQlesq9hnAk,19780 +torch/include/torch/csrc/jit/frontend/mini_environment.h,sha256=BBpxs_av-r3s0YuQLgWYtMV0RSCKg28hadbo9Zpek1U,1689 +torch/include/torch/csrc/jit/frontend/name_mangler.h,sha256=0f--GpRUoFMZaDSkcTBpycr-b6JO10qD8bQW6tj_q6g,914 +torch/include/torch/csrc/jit/frontend/parse_string_literal.h,sha256=A6HrLWuyMocZVjdExTu5cDSXTav3_h6Qd6ZfTo3Ixhw,2640 +torch/include/torch/csrc/jit/frontend/parser.h,sha256=0sfaMH2U2j81qiAqyaOC3ttnOKclfyT81GdYCFzh2II,939 +torch/include/torch/csrc/jit/frontend/parser_constants.h,sha256=DjTAdUi24RmgjVgL2gxjiDKFjgnG5CBBlX34DPsbo4s,416 +torch/include/torch/csrc/jit/frontend/resolver.h,sha256=2rpTL1QgUOGs5WhULQFf8Eijuo9D0fbIaeodMiPLLO4,2282 +torch/include/torch/csrc/jit/frontend/schema_matching.h,sha256=OT9vljrvM5LizNJfdQvSzZzla6flyzcWXE11vWnSawg,2435 +torch/include/torch/csrc/jit/frontend/schema_type_parser.h,sha256=7L96Y2U9ciqHzMT1BqMaNeYqskHrea7juxN9RYrKRAw,1642 +torch/include/torch/csrc/jit/frontend/script_type_parser.h,sha256=GJCrLmgrb14lTiv2g0FMBibfTgWq9gxSOcrZttW2L2w,1892 +torch/include/torch/csrc/jit/frontend/source_range.h,sha256=6REpiBtGKuH84UYUJ9cVIhs55WglnHf1D-G5kv18R1I,17775 +torch/include/torch/csrc/jit/frontend/source_ref.h,sha256=YG20P7bHAdLcuYzRMNadHPjLZ8FgHSSHHQSSOPu-jaU,1592 +torch/include/torch/csrc/jit/frontend/strtod.h,sha256=eetHOpndM8DFA66CjKfyEE-bzSg2Veu0Oza538haMOg,485 +torch/include/torch/csrc/jit/frontend/sugared_value.h,sha256=1VXhwc4X-6-fjHtQlfq75fmYAe2C0pTFD5HPIcMlhhw,29396 +torch/include/torch/csrc/jit/frontend/tracer.h,sha256=EXOANKGbY93tkaKwdCuWlsrN23iUVbRkJZDcvdlTxDo,13473 +torch/include/torch/csrc/jit/frontend/tree.h,sha256=v2bDLWSSJfb6MOafLbmdvgP11CyQuB5Xf294PUHWNa0,7034 +torch/include/torch/csrc/jit/frontend/tree_views.h,sha256=RcTB3nYF0emZk_q6c4pagPh-uFqChPAUngE7ZQkPD8s,38739 +torch/include/torch/csrc/jit/frontend/versioned_symbols.h,sha256=k44T3CyALxh1b2sSHzLN-LhsTZ1NuMfoy_HKoYGFq4k,873 +torch/include/torch/csrc/jit/ir/alias_analysis.h,sha256=TI8buEKfCe84TeWAP2z-1PujIN9wOOiwbUpmtsie_lQ,14913 +torch/include/torch/csrc/jit/ir/attributes.h,sha256=bsNBpW29gQXScUv6FjqdF0eKLb1qNUIi7Qe0CJHwYvI,5233 +torch/include/torch/csrc/jit/ir/constants.h,sha256=OV5vlbJU3Y5T0wTb_-Vuwmq67Fx-1cJdFcHki9DO8jE,2327 +torch/include/torch/csrc/jit/ir/graph_node_list.h,sha256=ZCMIsNxxPB3YIP7YrllalzwJ0G3N-6AiCtSiYKfM11k,6812 +torch/include/torch/csrc/jit/ir/graph_utils.h,sha256=2iaobFmraNGIoi9iIozekg6zvWNdKNZiLQt9paUBieQ,786 +torch/include/torch/csrc/jit/ir/ir.h,sha256=n32D0hPLNY2_4wwpzouCLzqZ9kWWA97ZyNG8Mr9q26k,55951 +torch/include/torch/csrc/jit/ir/ir_views.h,sha256=SqK851YkFzNAM60A1dPc3pzMmwFHEg-4W5HDWPOaC70,5045 +torch/include/torch/csrc/jit/ir/irparser.h,sha256=ePGTINGipcqFlRe-cT-tymOMOpooTq4YU3pGrydmWYE,1396 +torch/include/torch/csrc/jit/ir/named_value.h,sha256=lPbN3cDu1KuLeICxDIwL_A8nNGjX8H94H-sNEmCGMRo,2736 +torch/include/torch/csrc/jit/ir/node_hashing.h,sha256=RB4YPG7Qz2bzolBl6coNwI79vbq2FHX59WB3-KZ6v0M,539 +torch/include/torch/csrc/jit/ir/scope.h,sha256=B0egDlPUbbWhIYDTKB2OU6xvgIxFMczbLUXLEu_3Xjk,7635 +torch/include/torch/csrc/jit/ir/subgraph_matcher.h,sha256=4_OYZXalElxUDuMtkr_hL1MALdHPWXkG4ZHxcoYrW5c,3458 +torch/include/torch/csrc/jit/ir/type_hashing.h,sha256=Muclr7AsvY8_rtAfquUqXIVnYwQCfX6NP8YxUf90FNs,711 +torch/include/torch/csrc/jit/jit_log.h,sha256=WjvX4vCfcWozAQ7UIGkLY8rEH97HU6A70Ni3F76nP2M,5192 +torch/include/torch/csrc/jit/jit_opt_limit.h,sha256=NPY5bIkZklQvxoKQVCPAlCDtBhZA-dDSKQZBLuOoh3Y,1677 +torch/include/torch/csrc/jit/mobile/code.h,sha256=1byzXLkTGD1IeV1B-Ldk-j6p2h5wnqM95VP4tIhIqcA,1371 +torch/include/torch/csrc/jit/mobile/compatibility/backport.h,sha256=b8kmsigP86OYURpNPNKsL0kfajRhaHkoBqrR2W9JAp4,926 +torch/include/torch/csrc/jit/mobile/compatibility/backport_manager.h,sha256=cOzNrN0mnCeYWzqPQn5rGUvX6DKd7Zij7Q9_AvP2C4c,1466 +torch/include/torch/csrc/jit/mobile/compatibility/model_compatibility.h,sha256=WQEEbiWDXNUSl6Q3XJtOKn_VmcsfY7gNX-W6ObE84Yo,3973 +torch/include/torch/csrc/jit/mobile/compatibility/runtime_compatibility.h,sha256=wJaKdgeFHP9Qn3pfRE3LIvHTvldXhVd9gw4ug80JHoY,1498 +torch/include/torch/csrc/jit/mobile/debug_info.h,sha256=7y6gaLxTsDMnL1A2yZ67qJ5sxfP5yjx_Nm6Cj0gIv4I,2520 +torch/include/torch/csrc/jit/mobile/file_format.h,sha256=BwoEk2ffUd3WiaGJjQVUYa5hfE0x2iwjh4jBTeHOPY4,7125 +torch/include/torch/csrc/jit/mobile/flatbuffer_loader.h,sha256=pG9eyYJGTLGxI5xDIHvTKQv8ZJ0GDCxbk_x7Zdt0x5I,5160 +torch/include/torch/csrc/jit/mobile/frame.h,sha256=T6kGgOCBJ41lNszDYh7BxPTFjXxJvrzG1WgF843VgkY,1119 +torch/include/torch/csrc/jit/mobile/function.h,sha256=SN2qHCekjci9Hd2__OwrnevCt0umuXimwAihMyKgeVA,3286 +torch/include/torch/csrc/jit/mobile/import.h,sha256=HEIz5yxSHM_QhFfapbCJkGGIikZ0B_BIDQ-4_LUTb_k,4207 +torch/include/torch/csrc/jit/mobile/import_data.h,sha256=EKJCIVes_uQG3yBFnXa3nADAQixoT9Tly_RfY9DlfPs,1290 +torch/include/torch/csrc/jit/mobile/import_export_common.h,sha256=w_JqjdevEo5c5W47AQ-vDN_MChh6siJjQ_ZdwuM4Rjg,751 +torch/include/torch/csrc/jit/mobile/interpreter.h,sha256=rStvLpBDAjI2EMKfaNKNz0yKsacrNFWqJnLmYhZQyIc,932 +torch/include/torch/csrc/jit/mobile/method.h,sha256=XMs-n-kHz-ws5Co5H-4WBrk5I8DC0yQ_L0nuRTOcox0,1124 +torch/include/torch/csrc/jit/mobile/model_tracer/BuildFeatureTracer.h,sha256=QRseVb0aiy33831ovNycyGYZn9oMhOKV2PpfJotFN90,1257 +torch/include/torch/csrc/jit/mobile/model_tracer/CustomClassTracer.h,sha256=abBFl4Wj3ujmd7Z4G9-4dzE1q7W35pPllmaBI-TLgQU,1255 +torch/include/torch/csrc/jit/mobile/model_tracer/KernelDTypeTracer.h,sha256=TvzAsw1olfUxaus3olVnIggo70szX6BkrDThK4wMf-A,1508 +torch/include/torch/csrc/jit/mobile/model_tracer/MobileModelRunner.h,sha256=AKhWR77FvTNxZJ-cIHWdf3tEPD1QedLrJccaFu3BH4I,5491 +torch/include/torch/csrc/jit/mobile/model_tracer/OperatorCallTracer.h,sha256=RwhbhLSsbOjp7sNb5I9YyyrnFZ48kym1a7r5PnMb7ug,1209 +torch/include/torch/csrc/jit/mobile/model_tracer/TensorUtils.h,sha256=OqL9oBOHC_gzK0Q3bHld0juTogTWuhOk_iCcKEm9m-Q,670 +torch/include/torch/csrc/jit/mobile/model_tracer/TracerRunner.h,sha256=bYPrWO4KxzoucbXRwZItPPznuvmRMD-EGQQrNraDc9A,1405 +torch/include/torch/csrc/jit/mobile/module.h,sha256=9bKCdjcpNfSv7VzSzPptLolZrnsG6xbOleHLXUu50qw,6373 +torch/include/torch/csrc/jit/mobile/nnc/aot_compiler.h,sha256=zE5_jErM_MQ0UIliPYVuFEdojfeGs2aK4AId4vz98Ps,907 +torch/include/torch/csrc/jit/mobile/nnc/context.h,sha256=y373GDrtNyfxGhW12NzW-pcXeMq0kZDueSIejf3-q9U,7098 +torch/include/torch/csrc/jit/mobile/nnc/registry.h,sha256=hMFbKM5vTaD_EeytAUZGrAcwte0QM34jXNk54SCU3H4,1459 +torch/include/torch/csrc/jit/mobile/observer.h,sha256=h_tZ2QboyKB0ktB1HM8kyzkiHRLbr4pieNFOBVCwmas,4197 +torch/include/torch/csrc/jit/mobile/parse_bytecode.h,sha256=8eBg-u_HHOtWOYRjv9IlU8WesXzaqTg0U6eAFnDeLHo,1020 +torch/include/torch/csrc/jit/mobile/parse_operators.h,sha256=i1i5t0IiFpNuvlVt5bRkCBYTV35IPoX0P4WSRCf0X3E,993 +torch/include/torch/csrc/jit/mobile/prim_ops_registery.h,sha256=TNtFDZJFsmSajUBFp4KP9Q2VIwJ22eJ32qLK-VIFy8E,882 +torch/include/torch/csrc/jit/mobile/profiler_edge.h,sha256=vHjMGE3QyR4E4NMJxTr8ZviMt0dDcBiGxprur_Msmfo,4862 +torch/include/torch/csrc/jit/mobile/promoted_prim_ops.h,sha256=L7zQWVgBhN6F4DWbO4-Phn1Pbi-59RySjhhq24DsBjk,1363 +torch/include/torch/csrc/jit/mobile/quantization.h,sha256=F2XE0AbIuqFGhLTu2X3KMExT2w4QON-463031-WWVDE,1531 +torch/include/torch/csrc/jit/mobile/register_ops_common_utils.h,sha256=pGEA3Oye6t_1qubYnJiD6PeAWawEDpQJ1OvPFltylVE,1999 +torch/include/torch/csrc/jit/mobile/train/export_data.h,sha256=smtlX47R8pIz7-A351q0G1-GUytUrZdUQoxQ1cxMbMQ,1904 +torch/include/torch/csrc/jit/mobile/train/optim/sgd.h,sha256=jNjWd81rHLwRg9PIdHB8n8vwUmiMY0tz_HrUJcH2fS8,4715 +torch/include/torch/csrc/jit/mobile/train/random.h,sha256=zm8-hKsUfnA1mZf-kMcXX7xISH-i_QGeV2zdiXrcrcI,1828 +torch/include/torch/csrc/jit/mobile/train/sequential.h,sha256=vk-Pldb1sPyLFqbatmoxWrUVikiZncA-Jm0c2B8C1xM,1528 +torch/include/torch/csrc/jit/mobile/type_parser.h,sha256=kG-dvQlIdqFJkpV4v0X9COLISpcpHdgNlAumjT6V8kg,1756 +torch/include/torch/csrc/jit/mobile/upgrader_mobile.h,sha256=6iAI3A3bcGkl66BTbTsv0Y1fM6rUGuZvWlNG0x0Pou0,1203 +torch/include/torch/csrc/jit/operator_upgraders/upgraders.h,sha256=Dhvb-pyVWf7HeqTcorPcPMmmFiPVutkW7XzI8skNH3U,1689 +torch/include/torch/csrc/jit/operator_upgraders/upgraders_entry.h,sha256=2LE_FT-skpyEsUc7LHXviSdRVP8tSZR8XM4yqmrYGdE,801 +torch/include/torch/csrc/jit/operator_upgraders/utils.h,sha256=FSVMhND9waR4LX0CrKyHP2OAhh8bhlsTj-T3IVTgBjc,2003 +torch/include/torch/csrc/jit/operator_upgraders/version_map.h,sha256=Z2WjaUFWzxDAevxo9-JWZh6foLN-tdo3ZMHCYSJufbI,1179 +torch/include/torch/csrc/jit/passes/add_if_then_else.h,sha256=4f65OndbZJZ-c8kN6M1n5TLiX7Q-COCYgistcaNZdgs,431 +torch/include/torch/csrc/jit/passes/annotate_warns.h,sha256=eqeh7HjA92530OIA0wTzWdGH6LCCoMTTNKgeijmCrJo,435 +torch/include/torch/csrc/jit/passes/autocast.h,sha256=fB-5aV1YzQToxub5wqZdYUkVzg5IK-ACj8VyHPpbhI0,514 +torch/include/torch/csrc/jit/passes/bailout_graph.h,sha256=25EUAMvvhLRT2BU8v8d27zVpo33PuSZFw1gAgAOwato,1381 +torch/include/torch/csrc/jit/passes/batch_mm.h,sha256=FxFjjJX-y7M3urM39rdA5w-uK7IMrxvOH2Bjb7wPhio,399 +torch/include/torch/csrc/jit/passes/canonicalize.h,sha256=n2BH5YQdwAF7Xsf4UOP4Zm9lONlGjEkjXIrcgUofq1o,746 +torch/include/torch/csrc/jit/passes/canonicalize_graph_fuser_ops.h,sha256=SO1JV5YGLvmPeMjmwFAnMSGaCezjfWGzhqq7zAJu8vs,413 +torch/include/torch/csrc/jit/passes/check_strict_fusion.h,sha256=YPocOx7LB6nqelwqdUD-Qs5aizpSSBy86P-aaiFtTKQ,435 +torch/include/torch/csrc/jit/passes/clear_profiling.h,sha256=qBZ0e-iPU_gpAybvw_fHyNQFF9B9qfVLk-8KbiZLtgo,744 +torch/include/torch/csrc/jit/passes/clear_undefinedness.h,sha256=GW5vxQB7EUc0RCpSolbATV2xxEMAThJWUn7e7Pvi9dM,1131 +torch/include/torch/csrc/jit/passes/common_subexpression_elimination.h,sha256=9rGuGf4bHlbIYoalVUfcgO3ZZ4dOpTV9Zj3dE-AEs1Q,430 +torch/include/torch/csrc/jit/passes/concat_opt.h,sha256=5plNeWBUJl9aQwccRFDZsv54axzDIUFai6fi-I3lVHM,801 +torch/include/torch/csrc/jit/passes/constant_pooling.h,sha256=Rrx6qu_ka4xM17nNN3dFnEfiANuWBUBw3qShi-rHk58,413 +torch/include/torch/csrc/jit/passes/constant_propagation.h,sha256=Z0WuHzQzr3nJn2vIs1wzsT649RBdnMqFX6cGDmsBHhI,1578 +torch/include/torch/csrc/jit/passes/create_autodiff_subgraphs.h,sha256=u2CF12ylT-vP432G2y3Rv2Y2qR9rys2sSmSxu9spJ2k,789 +torch/include/torch/csrc/jit/passes/create_functional_graphs.h,sha256=doP03yVScuSFhLZsaTrpqw9_0-cgDS_v-sdp1fqzuqQ,555 +torch/include/torch/csrc/jit/passes/dbr_quantization/remove_redundant_aliases.h,sha256=M3diG1b6h-va1PSSMhP1ug08aIEq6kWtxok0lQvGGaE,618 +torch/include/torch/csrc/jit/passes/dead_code_elimination.h,sha256=tvEouwrp0am2Xb-ZkNz6QuzZz52svhLF8MjP7xg5qvs,1858 +torch/include/torch/csrc/jit/passes/decompose_ops.h,sha256=LntpIagEYX3sZi2MrK4tZAHBpVLSMpxND-jvyBhF_ck,404 +torch/include/torch/csrc/jit/passes/device_type_analysis.h,sha256=9epY1uCcxLwOfc-7O0PjrRaVnqgi5rYdsgUaLfDvOuo,512 +torch/include/torch/csrc/jit/passes/dtype_analysis.h,sha256=A-669wbT-rLblvgS3u52uvvS0pNqUMAqwPWmTGgtdP4,663 +torch/include/torch/csrc/jit/passes/eliminate_no_ops.h,sha256=CMIOyBwj_A0L4_-qX_vBUv5wV7_Vd1aujPSLHTE6Rk4,766 +torch/include/torch/csrc/jit/passes/erase_number_types.h,sha256=4QVpeiKKxl8ztX6KfJl1S3sVqAOjOjx3gqJy09CEpYg,1068 +torch/include/torch/csrc/jit/passes/fixup_trace_scope_blocks.h,sha256=EOxqOpzwbWvdYUh7Uc9-JR6BOcidnRTyFw_w2ur2NSk,1952 +torch/include/torch/csrc/jit/passes/fold_conv_bn.h,sha256=WBWfS5VgcKIMqkAq2wsnJHN7eEPFJKGSLsRFdDslY7Y,1264 +torch/include/torch/csrc/jit/passes/fold_linear_bn.h,sha256=23sPRhgyGZMq_8-6jb8hVmpZXoptG_uKY3pTSdFsXkk,952 +torch/include/torch/csrc/jit/passes/freeze_module.h,sha256=4rTGDeZ98QtmlkL7A1n0NS-Ep5No3kOyMAozRRRQQag,1512 +torch/include/torch/csrc/jit/passes/frozen_concat_linear.h,sha256=Z6uGOg3BILdk1oXRBwZSNmgbaLW4Q2uMP3Yh7f6eQuU,522 +torch/include/torch/csrc/jit/passes/frozen_conv_add_relu_fusion.h,sha256=C_a0GH9Tl0VnTnCZNS4PIwVYQFvxz_55JNxMVyVBQXM,576 +torch/include/torch/csrc/jit/passes/frozen_conv_folding.h,sha256=q8TQa6Whb5-tJ8fp7kc1GTrlBRp7ygHWVMcrA_xJjB0,1128 +torch/include/torch/csrc/jit/passes/frozen_graph_optimizations.h,sha256=J05bMUgifqsbVL_6xW-XBfftqaY5c26LP1YSTP-DQ3s,720 +torch/include/torch/csrc/jit/passes/frozen_linear_folding.h,sha256=pX3h14b3u9huFKwqJ7BO_rcVZ7LBLDMJb-e5x-RkRic,616 +torch/include/torch/csrc/jit/passes/frozen_linear_transpose.h,sha256=T8krNr36J0DE1NwbLOofwvk51IfhUq6qUF1rVDWFoUU,531 +torch/include/torch/csrc/jit/passes/frozen_ops_to_mkldnn.h,sha256=NiX60LjpuEUH649e-7HwcZul-pgi28XEnOtQZqtqsog,661 +torch/include/torch/csrc/jit/passes/fuse_linear.h,sha256=FFNFb-_zs7x8h-VTgIAfrec0f-tT0omSd5Qnsbl-Nm8,1024 +torch/include/torch/csrc/jit/passes/fuse_relu.h,sha256=m5se3tgN3Wrbv_mWBSN7g1T40lbC08LuFs2LhM7ux6o,516 +torch/include/torch/csrc/jit/passes/graph_fuser.h,sha256=TTynQTEfIoqXuDDuCTkQgkaNdFuweI4rK-xtzVV9eno,1520 +torch/include/torch/csrc/jit/passes/graph_rewrite_helper.h,sha256=3zETpmdfhtIXCiCuP38eEhKV7DisDh83B-rIYOtdg3g,2044 +torch/include/torch/csrc/jit/passes/guard_elimination.h,sha256=ZiXsJ4IOAp5zgtsX6jgFwAhvAYP1YZL_YHOCp_U9_7I,627 +torch/include/torch/csrc/jit/passes/hoist_conv_packed_params.h,sha256=Gij-bE4k1Mt17N4HuaTU5w1CeF1kFXeKgA7GHlYC3bE,455 +torch/include/torch/csrc/jit/passes/inline_autodiff_subgraphs.h,sha256=1o2qMxq-b0wh9ceW5TF8VjyBh7m6M_pps1qVJ3MsrXU,522 +torch/include/torch/csrc/jit/passes/inline_fork_wait.h,sha256=bbB78VBY5HorPV6zl_FaPoU8v8rOySnYp1KvL-c1Wxo,795 +torch/include/torch/csrc/jit/passes/inline_forked_closures.h,sha256=r8wp7GxCd87SihGGmTv6qjPZxNc1oR8zTgOLn8Gw7FM,471 +torch/include/torch/csrc/jit/passes/inliner.h,sha256=trXNxbYtPS0s94MK_ex7AtpZxdqhkt1ZP0kXLX5XImY,500 +torch/include/torch/csrc/jit/passes/inplace_check.h,sha256=9QeW9TIxFlFdJa8eq_v72_PwP1KbhaiwOBAI6es-LBk,404 +torch/include/torch/csrc/jit/passes/insert_guards.h,sha256=iICbjdB8hfrgpZv0WzuL0KZnYS_gqdS0-O7nXB_b4Rg,692 +torch/include/torch/csrc/jit/passes/integer_value_refinement.h,sha256=L2W4gBR_nHLZ3eAriOk0Og2DvOLgn5PIt9p-osxV8Jg,478 +torch/include/torch/csrc/jit/passes/lift_closures.h,sha256=N-93Fg24cK7x3uP0CeUoVJ6CS1AQJHIEvqEtt0VVek4,466 +torch/include/torch/csrc/jit/passes/liveness.h,sha256=uZ6rd1QdOJuivNW6Ueo52cMni_r6u4XXK8g-TkTjXzQ,906 +torch/include/torch/csrc/jit/passes/loop_unrolling.h,sha256=GSVpKQvLSDdzrYwIRVgDU5Yl1VOd4Zim5ETHQXgn93w,1274 +torch/include/torch/csrc/jit/passes/lower_grad_of.h,sha256=7xDK_bkUYR3d8yCZ2yazwTab5VENjlK6NEmce3ZaS2Q,597 +torch/include/torch/csrc/jit/passes/lower_graph.h,sha256=P5FB-DZpHxiNiX-JURl0rifVlGTh5H4hZbq09_tEJIU,1004 +torch/include/torch/csrc/jit/passes/lower_tuples.h,sha256=oW0b0gWpdnIy8L97WQu01ffszEJt0P2P0RRXQULd88A,918 +torch/include/torch/csrc/jit/passes/metal_rewrite.h,sha256=tPkqiDfb9PV_d50xBIZpihZJPHpTxvNq6R21iz7EPAQ,855 +torch/include/torch/csrc/jit/passes/mkldnn_rewrite.h,sha256=BQE-iAX56aYeJxmn0wCLY0haAzNpa7GXbffkhH0wcJk,896 +torch/include/torch/csrc/jit/passes/mobile_optimizer_type.h,sha256=Knzyd4hV2LoeCsrCx7cliRU4mvYjO88CLCI-VWgRegc,509 +torch/include/torch/csrc/jit/passes/normalize_ops.h,sha256=pWdAy0CotQV7LJndKqkGmqBz6GH3PPNGiYmZ_YgM77c,786 +torch/include/torch/csrc/jit/passes/onednn_graph_fuser.h,sha256=vt1vHD_x2QmvEaIVERBlQ8AeboH-_KH8Rt0GNDBri-w,1719 +torch/include/torch/csrc/jit/passes/onnx.h,sha256=u4MveMXoeGucrKrmjLWW0CVXTVLqZ_A9Gyiq675R6hU,1119 +torch/include/torch/csrc/jit/passes/onnx/cast_all_constant_to_floating.h,sha256=gYsTQ8pjaArcpFOUzoqwMaDrNjtSgCrlD6Ere0EYuqc,486 +torch/include/torch/csrc/jit/passes/onnx/constant_fold.h,sha256=7HUSFqwtHuCyl0i3y2fMzAl6sr1qJOzi6Hu61gfPOnA,984 +torch/include/torch/csrc/jit/passes/onnx/constant_map.h,sha256=lbfmOg9Xfwf-0xkeVr_ugC8Q13WN1kuXe5r2scdOcUQ,4793 +torch/include/torch/csrc/jit/passes/onnx/deduplicate_initializers.h,sha256=g1Xh9oUite9D3JUZNPhNGw5CYffSz4PzKu1bYeGM4yc,520 +torch/include/torch/csrc/jit/passes/onnx/eliminate_unused_items.h,sha256=r7mONjzYorOc8OGJ_l43Oes8yZ-_uerYKQQCiyuPoCc,616 +torch/include/torch/csrc/jit/passes/onnx/eval_peephole.h,sha256=3XGyJcYGmFEb0lY6rj_A7OhZacwpnyUrO6eySs0pup8,492 +torch/include/torch/csrc/jit/passes/onnx/fixup_onnx_controlflow.h,sha256=OtDp3k0EwfDdM-w_ncF_0DrjXJ0WFJ2k72WtOsKT1i8,490 +torch/include/torch/csrc/jit/passes/onnx/function_extraction.h,sha256=PslcQbHcorRJ1YLhO6tQ3y2nSj0KXNWZIfmP66sOldw,2574 +torch/include/torch/csrc/jit/passes/onnx/function_substitution.h,sha256=cy3b9cJSSH-5hNb9x22CftqYvuzgImyYHYwX5w1080o,403 +torch/include/torch/csrc/jit/passes/onnx/helper.h,sha256=ipKRoMDsjX-30A-wAIHOum7yzyz29GF1oM6zACDtwvs,2336 +torch/include/torch/csrc/jit/passes/onnx/list_model_parameters.h,sha256=epQDrQDyWAIlkfVqol1oi-HKswhoXWu3T9AT6gg92ro,509 +torch/include/torch/csrc/jit/passes/onnx/naming.h,sha256=F8FUA6S63D11pSlS9Gv2_wiBumAgIPaO-cdEF-6tJIE,1045 +torch/include/torch/csrc/jit/passes/onnx/onnx_log.h,sha256=8vHaJZp4h6396HEFcgw44oF-s-OZ7Pa8sWbHldj8zHA,866 +torch/include/torch/csrc/jit/passes/onnx/pattern_conversion/autograd_function_process.h,sha256=a3Wx78r9_eTyF4MrYOTUz81ya1mIAPxzBizFzcgo9KM,443 +torch/include/torch/csrc/jit/passes/onnx/pattern_conversion/common.h,sha256=xwyMxKC3UMg6VidqYzXU42BtFGks1e5XO5mnJm-vGPo,612 +torch/include/torch/csrc/jit/passes/onnx/pattern_conversion/pattern_conversion.h,sha256=S4sJNGVpn-FLqgbK8xcEi6x4xmQxp-KTyKW-ehsYbfo,2398 +torch/include/torch/csrc/jit/passes/onnx/pattern_conversion/pattern_encapsulation.h,sha256=HhihSSodtcC7W5_n7GWre-j0Z3bsY1EJwcjx3cDsQUA,1653 +torch/include/torch/csrc/jit/passes/onnx/peephole.h,sha256=IEX5j_r7_cEANtxNGukAnrq2KGA3JBnjIQXmJxFSW-Y,484 +torch/include/torch/csrc/jit/passes/onnx/prepare_division_for_onnx.h,sha256=SxuyQdvsHDteg3QN4wtpeIOHbJcwLt9RpS20JbcJ9Q8,727 +torch/include/torch/csrc/jit/passes/onnx/preprocess_for_onnx.h,sha256=VXceGWfAGzf5YkfevlRFdidr1nHyLDSZHJOdVEQOcbA,423 +torch/include/torch/csrc/jit/passes/onnx/remove_inplace_ops_for_onnx.h,sha256=5jrqFu6i2JTMoboQVMQQdpAugTjzaAeHUYRDBvG_Mso,471 +torch/include/torch/csrc/jit/passes/onnx/scalar_type_analysis.h,sha256=ZXrzSp4sZuEYr7VUm75Qn96wqlg6usV6Y2EteBY1M5g,552 +torch/include/torch/csrc/jit/passes/onnx/shape_type_inference.h,sha256=Z9GVTpkdUq_7pKBsuwLaCo5oGViuja70W2PNfh09OYw,4312 +torch/include/torch/csrc/jit/passes/onnx/unpack_quantized_weights.h,sha256=OiJQii_sIEhhxISvJB2zi039nsVLCdh5m5e46g-WO9A,703 +torch/include/torch/csrc/jit/passes/pass_manager.h,sha256=Nuk5i7QIAsff6I5w05t6W8kmhFfXMGDd1pAeyNPn8QU,4942 +torch/include/torch/csrc/jit/passes/peephole.h,sha256=VmedDqIGI74O_r2ozDp5wJ7eKTj_rExLvQwo1mVfwVU,759 +torch/include/torch/csrc/jit/passes/peephole_alias_sensitive.h,sha256=nJYx89kJE3EUNgWijxw45sF_W_VTMeOzikNE2z62h28,684 +torch/include/torch/csrc/jit/passes/peephole_dict_idioms.h,sha256=WLwCmnVOOe-Z5jXby3ZZEXxRTqRAqbcmg5Z2Yh0vNzA,1270 +torch/include/torch/csrc/jit/passes/peephole_list_idioms.h,sha256=ACqLg0Db-g94jrYfpg7DVLldKksIPkRm9O1hrWYTOF0,2307 +torch/include/torch/csrc/jit/passes/peephole_non_tensor.h,sha256=aQc2TCov6T1qf7H8bqEaZ_qPBQkYOfyJ2B4nW5E89Kg,588 +torch/include/torch/csrc/jit/passes/prepack_folding.h,sha256=s_VhmozLlBdhMRP0eCqx96ha-PDAFmxRdyg1EXYIJEI,607 +torch/include/torch/csrc/jit/passes/quantization/dedup_module_uses.h,sha256=sr1CcQIF1jen9doqfxFrpX9fj9cQZPEtKYeqdHiPqEM,1086 +torch/include/torch/csrc/jit/passes/quantization/finalize.h,sha256=6XsgCK1CSmadaozgDpw4e9E484DvKNSLFgPvJY1QZ5U,2616 +torch/include/torch/csrc/jit/passes/quantization/fusion_passes.h,sha256=kMDhASAXTFVsYhMs9Ho0HDGN7BsOeWrzi1KAlreU5_A,432 +torch/include/torch/csrc/jit/passes/quantization/helper.h,sha256=6k_t5cfECSpFQIZr9jBDPRCxMSJh4p7XfLWnCHYTL-I,7932 +torch/include/torch/csrc/jit/passes/quantization/insert_observers.h,sha256=aCP1O6szv4NAolhsIfYT9HLF_kq9QWv-xzhFygOMBcs,2651 +torch/include/torch/csrc/jit/passes/quantization/insert_quant_dequant.h,sha256=iactAX5xXxI3AxeCY6wllQAwW4WKrlbkyFFFdayNKOs,1728 +torch/include/torch/csrc/jit/passes/quantization/quantization_patterns.h,sha256=Ka_lpSTsdEAxz45oNBKboGIrekKw8jIDmHb6vIHfq9E,54884 +torch/include/torch/csrc/jit/passes/quantization/quantization_type.h,sha256=NSm6PaigNlf2ONNz9dxuh1KMQl0q1MbbMKLSuTZtKgw,605 +torch/include/torch/csrc/jit/passes/quantization/register_packed_params.h,sha256=59er3BbwL8L_-ExUt0iqBNFExGqQ-Cq3eqMTo9HQE78,766 +torch/include/torch/csrc/jit/passes/refine_tuple_types.h,sha256=Dy02TqYqo9MZ7xfDkMtaxD0xUoXJ-FeyRlSqgvQcIzE,511 +torch/include/torch/csrc/jit/passes/remove_dropout.h,sha256=PWHyA1cu4s05FjwlctZmPbeIwxsZSG2_7ZR3wYesUok,526 +torch/include/torch/csrc/jit/passes/remove_exceptions.h,sha256=DJg_xdypM6Kq2PMlsiRuyA3o8M9aXXFeuyZ8gtfGC4E,1209 +torch/include/torch/csrc/jit/passes/remove_expands.h,sha256=8tDc-Z-Wp9y1xXowxaqD_HtxkyDqC1BP-j4h5HxcRXU,411 +torch/include/torch/csrc/jit/passes/remove_inplace_ops.h,sha256=UoanOmIzFYB-cNSL40efaRD5U3_TN1frWU_U2M4_ijw,542 +torch/include/torch/csrc/jit/passes/remove_mutation.h,sha256=ZI9-5GRNTaAFaaxN15Y80Dspesfkp6_sH_EmDwLAlzE,2977 +torch/include/torch/csrc/jit/passes/remove_redundant_profiles.h,sha256=bKNRYo-7N7_tqxXYrXJ2aJfgxsf2WHMDQhyc19vX2wY,505 +torch/include/torch/csrc/jit/passes/replacement_of_old_operators.h,sha256=H25ddPyoiUjTrKcMVH89olMmHDVPUbloxAFeTGWmQqs,707 +torch/include/torch/csrc/jit/passes/requires_grad_analysis.h,sha256=vgBoH_I4i1rjYE1LCKlrFiyVjnPGkcU231cuNAmUGFw,494 +torch/include/torch/csrc/jit/passes/restore_mutation.h,sha256=zdVgSaUljC5O8RtpcoBhjOCajrE96gyMCFvMfeUYi9c,2121 +torch/include/torch/csrc/jit/passes/shape_analysis.h,sha256=E5IvbQyUrIPer_8iATD8jIvqalT5ODFPyIj1FSIt3-w,1377 +torch/include/torch/csrc/jit/passes/specialize_autogradzero.h,sha256=9xwHdk3PlnyEPxEtor8To4x6etvDROYL_dJe7Ei3xbs,909 +torch/include/torch/csrc/jit/passes/subgraph_rewrite.h,sha256=iyC6JfSSQGSdUbOgVHQq68epNIQHD7cmZo3-ksfxAWQ,4461 +torch/include/torch/csrc/jit/passes/symbolic_shape_analysis.h,sha256=N7LVcSgqifRsoGvlyPVNs7v89anE5RQwCzbBrAVY2AE,2393 +torch/include/torch/csrc/jit/passes/symbolic_shape_cache.h,sha256=0e6GqGt6PGR9tnDCep0UTFkg7Y9JVT5yRop4oOliElQ,1888 +torch/include/torch/csrc/jit/passes/symbolic_shape_runtime_fusion.h,sha256=grpsT9NHlquhMcx993zV6_cSpp9QzUgPO5WESIpMIcM,2649 +torch/include/torch/csrc/jit/passes/tensorexpr_fuser.h,sha256=ApQpJaojDPgiyDYsw5KCDJHuRyyTN25FOmRDkKR7DM0,3035 +torch/include/torch/csrc/jit/passes/update_differentiable_graph_requires_grad.h,sha256=QioYZ87R7hHTlJKEmL-sqL38D-naqBWfDV1ugL9MBMw,992 +torch/include/torch/csrc/jit/passes/utils/check_alias_annotation.h,sha256=yXjawHusf7_i5VbmvHvv0VABwMQrxd3Y00pXeDGVWcU,866 +torch/include/torch/csrc/jit/passes/utils/memory_dag.h,sha256=RFRZ82eCMOhzD7sJ18MybwslKrVIfLuzJRHG1A0XUvA,6824 +torch/include/torch/csrc/jit/passes/utils/op_registry.h,sha256=_vS5RkftY2AiDRwipvp0s-CxF8TW5Fk-asJiEGppOhU,1296 +torch/include/torch/csrc/jit/passes/utils/optimization_utils.h,sha256=bYZ7wAcEYaZzBUVujqrNr1Yp9XiOH75B4kaM3rU4vtQ,490 +torch/include/torch/csrc/jit/passes/utils/subgraph_utils.h,sha256=aPPM4UQxhCUHMjuaLV-gNgY5EltCW8UBKg_NSBHH_Ns,2689 +torch/include/torch/csrc/jit/passes/value_refinement_utils.h,sha256=z9dK55b-eSryWmHX_Soh-o2f-FXii0jqWoZPP6kz2a0,2945 +torch/include/torch/csrc/jit/passes/variadic_ops.h,sha256=1F3ABLjWjQhzcF3ueA77bZ5P-3H2xlCRYuK5VxwViUc,1173 +torch/include/torch/csrc/jit/passes/vulkan_rewrite.h,sha256=U7CPKJy0vOZr53KB4fvk46PA_noLlceinP04-ZroKkE,948 +torch/include/torch/csrc/jit/passes/xnnpack_rewrite.h,sha256=tFewu26okPFa3746x9wbx_zZawc4xrFpL1M8-Y5Ey20,1073 +torch/include/torch/csrc/jit/python/init.h,sha256=gFEMHB3_n8WXk7adpfxUPfhTC3mXKNR6BxMWt_OfX7g,411 +torch/include/torch/csrc/jit/python/module_python.h,sha256=aEU0mrt4sbGucEkxACcyYMv10R2G-QOcFB0TSG12kqI,2196 +torch/include/torch/csrc/jit/python/opaque_obj.h,sha256=CeLPzx8EM4ct1QrUhHM8mKZEY4-zm4ksMW4gdnq-PaI,3219 +torch/include/torch/csrc/jit/python/pybind.h,sha256=h3QDGeR_zGXl91U6Mx6jqMDT_Oigb-LFRdgm_vHoeao,8425 +torch/include/torch/csrc/jit/python/pybind_utils.h,sha256=1qj2qJzmXNQFzQZYGcrPCQqKhvNJgw9bPZJF_9rPcMs,47091 +torch/include/torch/csrc/jit/python/python_arg_flatten.h,sha256=yy0Nw3AuYp4X0msegwjS8JOITMZinPpf3UQ8r0Y0Osk,3905 +torch/include/torch/csrc/jit/python/python_custom_class.h,sha256=vw8tURcLZxXgectDyOLhiG9GwOQipe_cQ_H2p5YRSaU,690 +torch/include/torch/csrc/jit/python/python_dict.h,sha256=eJTXzjOMmPDkLB4fpXHm7DgD1TJFm8o26F21uXX4m_A,3769 +torch/include/torch/csrc/jit/python/python_ir.h,sha256=CtsOyoIpWnyaah7JBEWU9E8WbWBKT25lNDr7r4yaFkE,2002 +torch/include/torch/csrc/jit/python/python_ivalue.h,sha256=ObTQH1WVk9zuKYojnwnlGD_M0CR3EEY6sPJqUy4b0Is,4052 +torch/include/torch/csrc/jit/python/python_list.h,sha256=jAZ5a5NE5LkYXe75WmID9m5nO9R-d_6BkDv6GUDpzjI,5981 +torch/include/torch/csrc/jit/python/python_sugared_value.h,sha256=sElDM5zuM7qQjrh7Rj6Oto5tr9iHR0o3YSCfsfqpDXE,11973 +torch/include/torch/csrc/jit/python/python_tracer.h,sha256=1jJ4jyEACuuXDkHdojlk9abJCowdN9AtErACbDhk7K8,1522 +torch/include/torch/csrc/jit/python/python_tree_views.h,sha256=nT2Rlu1dSQm4w9axo7xDKjEIx3hsGUepXrCMuyrmJxg,418 +torch/include/torch/csrc/jit/python/script_init.h,sha256=qQTsPg7770Wkv4zJFlqOPwFwbWqyAONkYGGMo079P1U,418 +torch/include/torch/csrc/jit/python/update_graph_executor_opt.h,sha256=_9iu0ieXSFu4tseOGYKNAeWOznrW2BcxxvzSIGoKBLg,450 +torch/include/torch/csrc/jit/python/utf8_decoding_ignore.h,sha256=9w8xEbn_5FvOSWBVoztoKtLd2bZ5Yx4rsMQAQjI5v-4,444 +torch/include/torch/csrc/jit/resource_guard.h,sha256=r3V_XFAgXQqbp8w-jfqJ55dYfDvTSjaWpLmuGHJAmt8,724 +torch/include/torch/csrc/jit/runtime/argument_spec.h,sha256=RXfzpv20Kh3ZpxatfU-Qo2CEDdmqy63fH3LfbrwjDAg,17103 +torch/include/torch/csrc/jit/runtime/autodiff.h,sha256=Y4_5jZMBJ8qkTAWHML6dn2g35ib8akRSA10dTJ_esA8,4283 +torch/include/torch/csrc/jit/runtime/calculate_necessary_args.h,sha256=1J3toqk_orspX3pOku8czm4FqbwQFLUJ_S7yzjDMlVs,2609 +torch/include/torch/csrc/jit/runtime/custom_operator.h,sha256=ilHmDkPEAdJk3HYvWdZz0CFkeeTlHKL5an1efO-ku5U,1343 +torch/include/torch/csrc/jit/runtime/decomposition_registry.h,sha256=Wc9AUeiqBp4qJNrbZlaIy134owkWTUrk1OmDZ2EWVBI,1337 +torch/include/torch/csrc/jit/runtime/decomposition_registry_util.h,sha256=tqHAAkBeEp6Uj7nhYrBU0Wd7tmCUBXzWAPJIvz6DjhY,532 +torch/include/torch/csrc/jit/runtime/exception_message.h,sha256=G-TnDE8elX5XjeCqN5-NzwGyBZ2Irm6j-rA8Wu8tz20,902 +torch/include/torch/csrc/jit/runtime/graph_executor.h,sha256=xs8DQt-kjYiMuP0dx_kYu7YLbYVtIWcfMCdVdZ0odk0,5065 +torch/include/torch/csrc/jit/runtime/graph_executor_impl.h,sha256=VHGJpsUmXVQdBsXsTNXmnsTKZ1WnVLdlYzn0Gx6XMIk,4399 +torch/include/torch/csrc/jit/runtime/graph_iterator.h,sha256=N83CFQwHA5EhkeXDHr3LpEuDVYgfZC3kyNnLXCziM1I,5344 +torch/include/torch/csrc/jit/runtime/instruction.h,sha256=J3zbccLJgQ0LeR1bAkGQyptqYWMFApapIL1W1GCKlWM,5916 +torch/include/torch/csrc/jit/runtime/interpreter.h,sha256=kroxaDJHG4EyXK0klRjM2WCCKQoaJxAdpc-lGlElYRE,5410 +torch/include/torch/csrc/jit/runtime/interpreter/can_emit_inline.h,sha256=d-T1RqPIsG2j_paUavArqAM1F22mGBCoZ4GSshcKuMs,4319 +torch/include/torch/csrc/jit/runtime/interpreter/code_impl.h,sha256=HComwifGUwXJDmJoumMoK2dgac0uE9QPCfGX4TMd-74,34619 +torch/include/torch/csrc/jit/runtime/interpreter/frame.h,sha256=URHy32lHpFM0x57Jkf2lFNZ86DOz-3swNvoDvnvWe44,1409 +torch/include/torch/csrc/jit/runtime/interpreter/preprocess_graph.h,sha256=8oeUGB_7ulY5SwI_aoKEIZNpdncHQDAx6neBSheYbfU,679 +torch/include/torch/csrc/jit/runtime/jit_exception.h,sha256=B4M3gW6kOXzTnK-McjIgkMBuBzEVsy05Tl_a8klRc3Q,1466 +torch/include/torch/csrc/jit/runtime/jit_trace.h,sha256=aEot98zAVZgLTjShNFS0-UGfAYp_EYG6FsWt_hapu74,474 +torch/include/torch/csrc/jit/runtime/logging.h,sha256=adHQWrVuikq-HgpTJnHDhTH9uxgfEKBa3ThY7VQXjjs,2962 +torch/include/torch/csrc/jit/runtime/operator.h,sha256=-yTnCwvt8-SCz00micvVIjK4gUkI7iBwLgxYoVKMKrE,12220 +torch/include/torch/csrc/jit/runtime/operator_options.h,sha256=KrcbeFSgpxL1AxLwYl8PTndrRluc7t26sXJQY9_ToJk,432 +torch/include/torch/csrc/jit/runtime/print_handler.h,sha256=T_akpz9sxGpP7Pd8Zg-ytt6lHaGBoJ4j_fpkId4w9tw,582 +torch/include/torch/csrc/jit/runtime/profiling_graph_executor_impl.h,sha256=sBL3Zegvl6h0BT7P0eQyVM_22tvH0hFicQdziarSXrA,3295 +torch/include/torch/csrc/jit/runtime/profiling_record.h,sha256=3DcHoYPVzPIw94qo7ZjC_MPxiE8EqSD5MijKFMiIMBI,9022 +torch/include/torch/csrc/jit/runtime/register_ops_utils.h,sha256=lYw4ZQbq1Oy-OMGqT69_ZnuGl1WcM5XbxzTg8G9YyXo,43766 +torch/include/torch/csrc/jit/runtime/script_profile.h,sha256=CyNmXZHJCmeBqmhnyWjRY6_x0n2S-VA-3C7m5uijpTA,2998 +torch/include/torch/csrc/jit/runtime/serialized_shape_function_registry.h,sha256=bu1AgSe-G3USMcgZFD7TGY6yspS1GqDFT4E_F7vZiBM,630 +torch/include/torch/csrc/jit/runtime/shape_function_registry.h,sha256=tpiJ6Qfe6g3mVo37ACIib-HEg7UPv75SObO3Nk-_lX0,514 +torch/include/torch/csrc/jit/runtime/simple_graph_executor_impl.h,sha256=46wXzXJDB812cQLofQQ9UMLyKZoLK2x_LyZnm_ZJeSQ,925 +torch/include/torch/csrc/jit/runtime/slice_indices_adjust.h,sha256=Mfm21Nt1YsLp-xz3Tc1UZVSl6KJO9TYAo7HZWdj2cNk,1067 +torch/include/torch/csrc/jit/runtime/static/ProcessedNodeInputs.h,sha256=J2lOPPshhCy40aTE3eeS2t1F1TkOCQ-mNGsUXzsNOCU,6903 +torch/include/torch/csrc/jit/runtime/static/fusion.h,sha256=7sJSBSZEDVF2qD9BARfA5DxrPwHa3Bywn2xktEYfZ44,581 +torch/include/torch/csrc/jit/runtime/static/impl.h,sha256=_v5a8yoGtKrVJ-uXHoEzgKOFowdGxcV9logLqyMh8fM,37336 +torch/include/torch/csrc/jit/runtime/static/init.h,sha256=lQgfJEbi0VZwnKhFhEUVunCtyhNs-P_UtcFimJroTGU,415 +torch/include/torch/csrc/jit/runtime/static/memory_planner.h,sha256=iIjpVDZAfKypbUp3Sl6qlGmSJwLHRD3P239Hvqheblo,10468 +torch/include/torch/csrc/jit/runtime/static/ops.h,sha256=bSzzrsZ1t480xwmaUKkVXcfMy_-WeisdUR1aKm1_prA,6016 +torch/include/torch/csrc/jit/runtime/static/passes.h,sha256=TYkAsCRKzdAzeGIDMnTFfdyYTHqrqRRYt0fd6tKJsfo,4034 +torch/include/torch/csrc/jit/runtime/static/processed_node_wrapper.h,sha256=PvWjwbrQBm19_vJ5dLc1-Cpu1iSwNqklFX0JhagMuYQ,7065 +torch/include/torch/csrc/jit/runtime/static/static_method.h,sha256=Z30fGGWBBAAyi8ux5upAeukgwmVO2y5Bd4squzgYu7Q,1631 +torch/include/torch/csrc/jit/runtime/static/te_wrapper.h,sha256=BJMnH1Ht2dVQeOKuVfXjIZ1enPxPZWStsD7qCaZNLLE,1448 +torch/include/torch/csrc/jit/runtime/symbolic_script.h,sha256=Ps_vXkBAgXafdonUBVcc-8T_9u23D6twheQ_QBFlaTA,839 +torch/include/torch/csrc/jit/runtime/symbolic_shape_registry.h,sha256=u0AvMLOaFFgG5rWRFQ2CO4Kps9nnkdgVNkrcjW9-lkE,3130 +torch/include/torch/csrc/jit/runtime/symbolic_shape_registry_util.h,sha256=A_RNMb6AH9WZecAc5Ux0FIDsfy0wCCJmjJzYLz9cyvA,622 +torch/include/torch/csrc/jit/runtime/vararg_functions.h,sha256=VQMhwyd9JG4uQuVZ2ZQ4b6Ku3TSXSBdow9uODuW_7iM,1447 +torch/include/torch/csrc/jit/runtime/variable_tensor_list.h,sha256=Q16GP04EejeqGzvgI3knHItFHu-v20Hy2QDQKUe7oM8,803 +torch/include/torch/csrc/jit/serialization/callstack_debug_info_serialization.h,sha256=2dBD0gCNTmK6uB4Bj6YsfNHeu52YPYsQxfPTaptxwGs,2952 +torch/include/torch/csrc/jit/serialization/export.h,sha256=dUAoJtEEs3IIHCPC6VJMTexMUgR-uiWjX3hgiF7qZDk,12026 +torch/include/torch/csrc/jit/serialization/export_bytecode.h,sha256=-MQ2pmXX7kM8JUM_E3bjed5Ajhw6ZUat34LllWwheyQ,1668 +torch/include/torch/csrc/jit/serialization/flatbuffer_serializer.h,sha256=6eGEqyt4Kh1W-is6IC2EAjU_-c73xemWCJA5sJiU9UM,3394 +torch/include/torch/csrc/jit/serialization/flatbuffer_serializer_jit.h,sha256=jEEQ-o5MAyMpTaV0uTlcCT6CIDPeVOcbWTvAgHNrpLI,440 +torch/include/torch/csrc/jit/serialization/import.h,sha256=oWoDHOH37jDH0nMpz3koF5YQOR9Sat_7yFo5veAu6yc,5237 +torch/include/torch/csrc/jit/serialization/import_export_constants.h,sha256=lpaWaLOxtL8QlfIxwYA1zIjC2IbxExk2lIUvtX8DAC0,923 +torch/include/torch/csrc/jit/serialization/import_export_functions.h,sha256=EvMfGcyYCr0MUHehstuh611kpWm-bFTKA4setJSVpT4,663 +torch/include/torch/csrc/jit/serialization/import_export_helpers.h,sha256=lNjb6oGX1EWw6eQSlA6J_KGqFLLmsdRsLzlmedOLkiM,938 +torch/include/torch/csrc/jit/serialization/import_read.h,sha256=CZVGuVbJ3QpqCmZKxi3VCCKWO_MHPuE2V4NG8MLCzsg,1118 +torch/include/torch/csrc/jit/serialization/import_source.h,sha256=rMkt1NW1CVP8jCLEIMdRafEEEyYF-qRBNtfPKQAFocY,3783 +torch/include/torch/csrc/jit/serialization/mobile_bytecode_generated.h,sha256=VExmwKH5EVHzM2rBnOJrd3MtiuF4vuMxBN13fzNLbUE,101469 +torch/include/torch/csrc/jit/serialization/onnx.h,sha256=Jfs3C1SCn1QhUpdXtbvdHlX_5MEtZJvLp_Xxbrvo0tw,790 +torch/include/torch/csrc/jit/serialization/pickle.h,sha256=sDL9KRMFLRP84lYmqAJa0pFQairGTGB1GrMUUzvB7oc,5089 +torch/include/torch/csrc/jit/serialization/pickler.h,sha256=kCAv1UnKBU4TeqZZu_TTGa1EnIE2QxnS9mH6rHWhX2U,6779 +torch/include/torch/csrc/jit/serialization/pickler_helper.h,sha256=5bCxhhKN3hD3G46MyT1reHG299VRKS-1wPzIAMgSRp0,7443 +torch/include/torch/csrc/jit/serialization/python_print.h,sha256=pIOWdb7AESlY2pF0AMC5mLjerFu3lDznw1wsEQaVBio,1624 +torch/include/torch/csrc/jit/serialization/source_range_serialization.h,sha256=Egq-ATa0xAzShcUTN-OozIwdgNg8TeafpUdhEji9zCE,1991 +torch/include/torch/csrc/jit/serialization/source_range_serialization_impl.h,sha256=Bwo_lkqjD-9Uv_iYmrZIsMQLdv9H4gPqxs7NvLcqgoE,967 +torch/include/torch/csrc/jit/serialization/storage_context.h,sha256=XoUHQHDPWr-Ofl8sggzeRxRupbxr-18M6yO8CnWVEyk,2829 +torch/include/torch/csrc/jit/serialization/type_name_uniquer.h,sha256=UTlzDFnfUeUbxClP6x_IhyFxyWnl-2GKht7eCbTuISU,1044 +torch/include/torch/csrc/jit/serialization/unpickler.h,sha256=S3WLGiWk0S_MFtt7O6hBoxU3XrLUnRY_VnD17fbcyxA,8149 +torch/include/torch/csrc/jit/tensorexpr/analysis.h,sha256=llKT1MAS4lnbUmGMVIN0q5N1UtsnPk1g-JPl2BGbyjQ,9639 +torch/include/torch/csrc/jit/tensorexpr/block_codegen.h,sha256=pIpWdSe8e_Ip3rpQclQFaRCD0x14031-s-rTW2JJXP8,4695 +torch/include/torch/csrc/jit/tensorexpr/bounds_inference.h,sha256=b-vVsfazYS52YPc9NCXFsfdtub-NIlwfR6L216BB5S0,2504 +torch/include/torch/csrc/jit/tensorexpr/bounds_overlap.h,sha256=Bicz3wvRPab402Cqbvlzop9ZxqdCwRpvozjfCdeGetI,4851 +torch/include/torch/csrc/jit/tensorexpr/codegen.h,sha256=Yz1b0EF3CAiUnsIeNXuOBPs7x8v210RWg5oApDCq_Qk,7964 +torch/include/torch/csrc/jit/tensorexpr/cpp_codegen.h,sha256=JNSgE5vd5wfEth_yI9ULvm3Y3bkszkHVk71euhlf33E,2806 +torch/include/torch/csrc/jit/tensorexpr/cpp_intrinsics.h,sha256=iAXEHp07WgCcrmBZb1vFXwVjSK9ZCvCiH-aNVHb3cd8,924 +torch/include/torch/csrc/jit/tensorexpr/cuda_codegen.h,sha256=D4lvRRHyheMevxSLjrQory8PQ0aVry8gd_9VXynfwwA,8779 +torch/include/torch/csrc/jit/tensorexpr/cuda_random.h,sha256=-AYdUp4Jz04PWH8dYzqYxzHZYvQiz0bcy6jCmFNyPYI,2951 +torch/include/torch/csrc/jit/tensorexpr/eval.h,sha256=zgJ5oULO_SriOncY0uEWYAOSPnVcJmVKsv0YlQ_HsZg,10427 +torch/include/torch/csrc/jit/tensorexpr/exceptions.h,sha256=5LB6oIJn3lI_HZPrghq38zvO5N-O5HxyxmqslHdR0h4,3565 +torch/include/torch/csrc/jit/tensorexpr/expr.h,sha256=tvaT92z6O4bvHOiKYn04xtbcv-i2IK5-BSWM937fZ-w,14933 +torch/include/torch/csrc/jit/tensorexpr/external_functions.h,sha256=eVrfIRJyuefwAhCOQP3KWtOAWESrranOdPvR-ITK1PE,3803 +torch/include/torch/csrc/jit/tensorexpr/external_functions_core.h,sha256=EFs8cIWp5zEsXUPx2gX-_u9boY2aaY9SCbktwPvyJxU,737 +torch/include/torch/csrc/jit/tensorexpr/external_functions_registry.h,sha256=J8u7NNm7vr0v0piwaFOlsUOz4KnH4HSylLuC4SzZ2EA,2622 +torch/include/torch/csrc/jit/tensorexpr/fwd_decls.h,sha256=DEU24iGjDtJWzbjSIrqQf3UuZ_r-aE-UI7Pk2oEAq5w,3374 +torch/include/torch/csrc/jit/tensorexpr/graph_opt.h,sha256=PZu--y9v6wbX0_CeA3AMG2BoOmpwL2-oHosQuFD8JeY,4804 +torch/include/torch/csrc/jit/tensorexpr/half_support.h,sha256=e4TZhTX8TvpHCz0cgPN99xsgZNjLP7sfImkGdCxOxrs,6360 +torch/include/torch/csrc/jit/tensorexpr/hash_provider.h,sha256=ZfPsP3jVyI1pJXK6sE4tIxfe9Jc6LpUCoaUomGvlL5Y,8073 +torch/include/torch/csrc/jit/tensorexpr/intrinsic_symbols.h,sha256=JnuX9nTVu2YQ0kOK0swZu0otokATRHseoF8eaC_jY6M,701 +torch/include/torch/csrc/jit/tensorexpr/ir.h,sha256=IX1K0ZwccBcB0XKGnCwGsm7cGuoGA0UpwNb0apHeKNc,24154 +torch/include/torch/csrc/jit/tensorexpr/ir_cloner.h,sha256=tFCT58J_-WnV53wZmwdIoqJaH26UIKBE1xBCfxOEf9s,2664 +torch/include/torch/csrc/jit/tensorexpr/ir_mutator.h,sha256=dekT6LbECCFvtEMJps_ZJTHRzNdk-MP8iVyTX1B_fRg,2690 +torch/include/torch/csrc/jit/tensorexpr/ir_printer.h,sha256=wnJDgPNiyRjd6uCOyui7CXbPIrF2MzsqoSkzEa6cmrU,4652 +torch/include/torch/csrc/jit/tensorexpr/ir_simplifier.h,sha256=96ivxzKXWEqgrD0cUZUmAThVAXUzuhhmsXQ9b19jVVs,16062 +torch/include/torch/csrc/jit/tensorexpr/ir_verifier.h,sha256=ZrhfFoZ-ts6SUrOtlqvZuph0g0MyCuaXMMh7D7s09Ak,1626 +torch/include/torch/csrc/jit/tensorexpr/ir_visitor.h,sha256=Td2LuNL37JGqAzK13OQj3gc-vWuER7X-L_u42CfkxyE,2506 +torch/include/torch/csrc/jit/tensorexpr/kernel.h,sha256=48lV8cKerJkCA103I-gJEWgFdgQVXJVWIk_PEqO0ffM,14029 +torch/include/torch/csrc/jit/tensorexpr/llvm_codegen.h,sha256=gIrDs9Fr31dccsbV8wj80nC9UwMfW11HLlxufLYbHqI,4241 +torch/include/torch/csrc/jit/tensorexpr/llvm_jit.h,sha256=Bc0DCpRnF1j43zS4fT_iIsnccKotPPmIbeEEG6S6PQg,2358 +torch/include/torch/csrc/jit/tensorexpr/loopnest.h,sha256=F7k6IfZBrNaCvUvtxMEmDr8UR0LpWEQ4t2m_0eF8iMo,22654 +torch/include/torch/csrc/jit/tensorexpr/loopnest_randomization.h,sha256=bGecTlKIvK4tubZZjDTgnrdNY36gWDw5cbvdeeiScxs,577 +torch/include/torch/csrc/jit/tensorexpr/lowerings.h,sha256=52UlSRA-l6CCCYadsVI6m87h4cbaRkhFb2sE39Rm-mk,1584 +torch/include/torch/csrc/jit/tensorexpr/mem_dependency_checker.h,sha256=lvzVINCmjvjSZzHk6jhTvYJzns6R3E38fIJPvihYYKs,14130 +torch/include/torch/csrc/jit/tensorexpr/operators/conv2d.h,sha256=a3zk1svPKKvYp6Nb8abVnoUdum5Ezsrt7kUV2fwxmuY,3253 +torch/include/torch/csrc/jit/tensorexpr/operators/matmul.h,sha256=TJrf3W4cc3JcLpDRiXiRcX1yUqssnBv9gcNhm9mckLc,882 +torch/include/torch/csrc/jit/tensorexpr/operators/misc.h,sha256=fOm-P7ibx4t0plWPGgAj7CaCCWr4BHKfObK0S80j3Ho,3641 +torch/include/torch/csrc/jit/tensorexpr/operators/norm.h,sha256=VWdN1o6_mlDIRm6pd5DuleUKOnL1kpR5jHKVt1iI2GM,646 +torch/include/torch/csrc/jit/tensorexpr/operators/operators.h,sha256=Lpyg4Zrfmw31kc4mTlNRRrBgj6UqcwLNYDdBUHjYujw,740 +torch/include/torch/csrc/jit/tensorexpr/operators/pointwise.h,sha256=zH3Gjch7vZiUMePdK0t-y5J-SLCWoUo8_M2CI2eO7-8,3500 +torch/include/torch/csrc/jit/tensorexpr/operators/quantization.h,sha256=bHXEWARxcxTCxkiP62ogvgQLYd8V2eLFQvAaoY8doTo,5697 +torch/include/torch/csrc/jit/tensorexpr/operators/reduction.h,sha256=iTa5R-EXh7eCQ1s0I5K6f5m_Qnsb135Voa8h9KBPmnY,1396 +torch/include/torch/csrc/jit/tensorexpr/operators/softmax.h,sha256=dgbTHXGdKuRymsQMCwgYGySAo7Lh63tH1fN_l2ICVpE,593 +torch/include/torch/csrc/jit/tensorexpr/reduction.h,sha256=-CSLDz5N80DLUrS0yeha1mwta7ZWwSyM2s7F0tLgt4s,9431 +torch/include/torch/csrc/jit/tensorexpr/registerizer.h,sha256=9r8dPBLStn-TM2Ax3I0g0I8JVCQ0KwCgd1qEjtqF1mA,13204 +torch/include/torch/csrc/jit/tensorexpr/stmt.h,sha256=Pruw8h4tTBN2hddkGdr6v5EzGTgOgT2n7Yg_yLQGywI,25091 +torch/include/torch/csrc/jit/tensorexpr/tensor.h,sha256=7p8P1L4RtCWuVlTIVdujmKBdAlHK3t8taqMg9nEDgtc,11079 +torch/include/torch/csrc/jit/tensorexpr/tensorexpr_init.h,sha256=ELHpCXo4lEXs05SkGROdDZJPHKm95p5Hsio9LG6AC3M,511 +torch/include/torch/csrc/jit/tensorexpr/types.h,sha256=2bfhYiwbs59usLVzyW307-9HWmpsf4J3uzLJa6Ql9es,4697 +torch/include/torch/csrc/jit/tensorexpr/unique_name_manager.h,sha256=I-F8baVNZFAZprC2kL_xl0mSbm_P6Dw_uGFYFXRifnY,1117 +torch/include/torch/csrc/jit/tensorexpr/var_substitutor.h,sha256=pXF9ApPU5t6UYhPGkxvYajVO8oNss4ozr0WYDnG_bdY,1980 +torch/include/torch/csrc/jit/testing/catch_utils.hpp,sha256=DXFwyNWnJjWOwkwVhg1ZUowfjkBhBwU6JnZ4WS0w5vI,622 +torch/include/torch/csrc/jit/testing/file_check.h,sha256=8AKqUr1fdKNYJRoEQngbUB-dYATFB0uJpyzMf7eBSQA,2881 +torch/include/torch/csrc/jit/testing/hooks_for_testing.h,sha256=GZRXOszHSZnnrJESkpMq5pg-zn4F5xkxmGrkk7q-UvQ,856 +torch/include/torch/csrc/lazy/backend/backend_data.h,sha256=LpHLOfATb5ZWxIqUbU10uRZLwKS3aMSh_WR4WiasFMM,1498 +torch/include/torch/csrc/lazy/backend/backend_device.h,sha256=88UIm0jbSthXOH0yWyKjJjiLllsM2ZUI1H3q9JWV5e0,3287 +torch/include/torch/csrc/lazy/backend/backend_interface.h,sha256=bYOM_1TUNWZKGwf1uEBYoRBl_wDkdGVCSh3o3jndBLg,5217 +torch/include/torch/csrc/lazy/backend/lowering_context.h,sha256=E7sO6qN-eqOOo6qRTeOPpNcKiVUrGZWYvxxoTv8uS8M,3607 +torch/include/torch/csrc/lazy/core/cache.h,sha256=UwLteEM1txo3DDIhlfDXSjYxzDB-H6A2EZ36_7LhG-w,4127 +torch/include/torch/csrc/lazy/core/config.h,sha256=G9jTi-njapZ6IT6LxHLsD9L7rvuo5WqJHF72Z1DHwoA,1196 +torch/include/torch/csrc/lazy/core/debug_util.h,sha256=GKXez84tlCG1a-O13VnjdIEU7fXK-h8Np342OLbuGA8,1578 +torch/include/torch/csrc/lazy/core/dynamic_ir.h,sha256=cVOS2WB7wcMY6bjejjm4cOvKb5PVdKxVCDuSwITHxuM,1704 +torch/include/torch/csrc/lazy/core/hash.h,sha256=slwnycctocXe7nXkR6CGrl5WdSfJKizdywB4meah6WE,8100 +torch/include/torch/csrc/lazy/core/helpers.h,sha256=vejwEfzx1FbNKFB95pooZXeN7bYJN8dnJN5eQfw8Z1M,2552 +torch/include/torch/csrc/lazy/core/internal_ops/ltc_ops.h,sha256=PqN3YJZusAEzXAa_ySQGyjRgasLhI1HHDRIHTVrWXjY,1758 +torch/include/torch/csrc/lazy/core/ir.h,sha256=S3YvvB_rkFWeNeC6JJNt1qQN8v7rSfPX_BdzG0ei9H8,8353 +torch/include/torch/csrc/lazy/core/ir_builder.h,sha256=NxZWTOgN-F5OeN52vhdaTyXcChEX-TFlrmn4nNlpIfI,5116 +torch/include/torch/csrc/lazy/core/ir_dump_util.h,sha256=9yKthXM2VzlhKZJXo-FqHN7CYrcyFF9EatygRoN4BNU,953 +torch/include/torch/csrc/lazy/core/ir_metadata.h,sha256=6DZUP5OwODf4InnANBuyJub_sYhMDeo0qQeyTN5nYiQ,1633 +torch/include/torch/csrc/lazy/core/ir_util.h,sha256=_lHwfL7sfOoVUFO8SXLa2aP2Fz3tFbx9ydCuEpCM7hE,1670 +torch/include/torch/csrc/lazy/core/lazy_graph_executor.h,sha256=B2-7BR3i07Pq8s5fypzFAk6szgppj0DRQ-wp0pCJdL4,15719 +torch/include/torch/csrc/lazy/core/metrics.h,sha256=TrsX2JhJoUa1anxBrql5fHPkb55LQYX82HpJdAwaF8w,8798 +torch/include/torch/csrc/lazy/core/multi_wait.h,sha256=Kj5Hw9_Yr6CQozM7OAvtoCvzA1uNwtoz4ZhsDl4CGoo,2068 +torch/include/torch/csrc/lazy/core/ops/arithmetic_ir_ops.h,sha256=Cjv4Wdsg4TR0nVoIw_23mLO_d3IWbOxodpiGOdefDNA,652 +torch/include/torch/csrc/lazy/core/ops/utils.h,sha256=ngAEaKhuw9_SR2m09m8GXl4Ty7k2YzSqyg0HbJxDv8Q,1283 +torch/include/torch/csrc/lazy/core/permutation_util.h,sha256=jQxE0WIn--DLrUQrQVHyf8LxI8PfQL9vq36PHiaGBjk,1552 +torch/include/torch/csrc/lazy/core/shape.h,sha256=3birvq_vHt6skeslNlqL5QpcJL6nmHgHelMD_RJwGhw,2352 +torch/include/torch/csrc/lazy/core/shape_inference.h,sha256=9FX1hn9GLKcwfFDGM6Ugbsaxfdc8Bhh_6fu9vK165hk,15783 +torch/include/torch/csrc/lazy/core/tensor.h,sha256=Csai7d1RrYj9HpgMn35m8GbUbh16uUMN2bA-9kweRoQ,10404 +torch/include/torch/csrc/lazy/core/tensor_impl.h,sha256=CvxOVMIeqzM5fWjaFiOiCC58c9WYrn6I5fxGoI-hSA8,2236 +torch/include/torch/csrc/lazy/core/tensor_util.h,sha256=qXaADpLyJtFd5Wi8mFQQDHloR6JdQ4hsa_uD8UodPU0,2871 +torch/include/torch/csrc/lazy/core/thread_pool.h,sha256=t8gjQMDdr-KgBmqeY2e6Og9lM9dLwGu554HVNhXYyxQ,1087 +torch/include/torch/csrc/lazy/core/trie.h,sha256=DFAH3XRAdA_HIUesx2ROs11nOs7kVsj2vDw1lRIXkZc,2528 +torch/include/torch/csrc/lazy/core/unique.h,sha256=Hb5VfrjIuAtx86Mbc_rbetNGpYfpl7pZqZrHWEL_xSk,1486 +torch/include/torch/csrc/lazy/core/util.h,sha256=tupKRceqVksBMOXdwosPqlzESi4iQ6CQchs0M_Rg_MU,3257 +torch/include/torch/csrc/lazy/generated/LazyIr.h,sha256=mm3GoVNhl6uHrwiJPdizpFjjtXBMVRSlpNQGQEz0eTg,306388 +torch/include/torch/csrc/lazy/generated/LazyNativeFunctions.h,sha256=VfiYU2R_TAWoHboctyLL4lFsdnUPNrtJXdibwlxertM,23320 +torch/include/torch/csrc/lazy/generated/LazyNonNativeIr.h,sha256=uv342KJF7nwjSeq8pKMlIe2Fn6LGTcEEXSDKXZkExb4,4357 +torch/include/torch/csrc/lazy/python/init.h,sha256=ZpMKwq7Z8j782JQy4vJsavl8E-JB5pqLGV1TVmycKao,493 +torch/include/torch/csrc/lazy/python/python_util.h,sha256=o2glwf3TEtJlxfqRw5Dt_cOBLmcdqSP-0MrPf3TP_zg,587 +torch/include/torch/csrc/lazy/ts_backend/config.h,sha256=-TVVyRrMqLxS8VBwgdQwIBS__Lcy24RR4nb6a2FlH3M,472 +torch/include/torch/csrc/lazy/ts_backend/dynamic_ir.h,sha256=uZvTl1283T0skptvu57lI6vqM9CaF6O8OZLSwtjYSkk,2692 +torch/include/torch/csrc/lazy/ts_backend/ir_builder.h,sha256=wBM2rGlcFAV6GhPqmrvU6PYKPDlkfZxhZjJl0RiFGCg,2719 +torch/include/torch/csrc/lazy/ts_backend/ops/device_data.h,sha256=MFPqoPcp4D0D1aY95a5yVYdkR-DvcC8OwpO9ENT_yOU,1605 +torch/include/torch/csrc/lazy/ts_backend/ops/generic.h,sha256=VpvLg0l9bwr7xySKAE-gA3_fr_zjTmBN5aPwPS6t2ho,1739 +torch/include/torch/csrc/lazy/ts_backend/ops/to_copy.h,sha256=YnuyCCoMFDaRu19_a1HQCNLlpYt8WDC4H4WMG5Yyw40,4463 +torch/include/torch/csrc/lazy/ts_backend/tensor_aten_ops.h,sha256=EH3vbnUDIJZgUoW7jnlhxrhG3HXwi8_XUNssjvfOXaA,797 +torch/include/torch/csrc/lazy/ts_backend/ts_autograd_functions.h,sha256=4I5GlqJrOMLj0s7MKFL4MLsyXA3JdiH_YVq4Y3FT5XM,907 +torch/include/torch/csrc/lazy/ts_backend/ts_backend_impl.h,sha256=cg9Ur6mbL80CmPHGSeECPxcxv3hvbaDQe8pbyq4uuYc,1551 +torch/include/torch/csrc/lazy/ts_backend/ts_eager_fallback.h,sha256=p5P7t_UtleN7aCV9IQg_FrbIp4p_L7q3jEF5K02ZKNk,976 +torch/include/torch/csrc/lazy/ts_backend/ts_lowering_context.h,sha256=_mUoJhAPWOhYXjfJClXl8XHtBV_kZ95qaI_IqcBJWrI,4922 +torch/include/torch/csrc/lazy/ts_backend/ts_node.h,sha256=usvT2LNUbYG1XEX8J5g0h0a_uhdItBrIxmkVqt2DtWE,3714 +torch/include/torch/csrc/lazy/ts_backend/ts_node_lowering.h,sha256=h3d48eUXunmTOkI_JEqMJL59JT1_odqYXdWvBoZKcJ0,740 +torch/include/torch/csrc/monitor/counters.h,sha256=cAKM4-ULKqKFmNI1u9iHdzJBnBFLAUxNUDGONKa6Ra0,8382 +torch/include/torch/csrc/monitor/events.h,sha256=SB3nVd7-E905-z9NBR_xuAib_2g_GUSe1gipZ-uIC78,3012 +torch/include/torch/csrc/monitor/python_init.h,sha256=AtJ62cJ5mEPkKf8bwa8dsEKuMUfFbN-2o8wAjrRHfXE,395 +torch/include/torch/csrc/mps/Module.h,sha256=LkySu7kXqszqg4XDPb2MAtABAjSQjYgWSONFdSpXJvk,442 +torch/include/torch/csrc/mtia/Module.h,sha256=PLqgLAity-8xyFhtN1zSXBjmVFLmsHa0JiPa0pMBfpU,447 +torch/include/torch/csrc/mtia/profiler/MTIAMemoryProfiler.h,sha256=CS2mElMDBbaXe6KbeJZM5JRHET3hmccw9_FppIpgknQ,826 +torch/include/torch/csrc/multiprocessing/init.h,sha256=gZ73iwgR9HSo6s18rOwqPexbWl-ECF5GVj2f8JlttD0,436 +torch/include/torch/csrc/onnx/back_compat.h,sha256=divVgXB_Eju1u7LZD1eYd-D_EIjjpkxB6k8Ssvmb-S4,1308 +torch/include/torch/csrc/onnx/init.h,sha256=Dn9XBgI0fxH-kn6lsUZdxG3KmSVHCeiQqXkGGJ8u7WE,414 +torch/include/torch/csrc/onnx/onnx.h,sha256=hr37N0YqCO68VCxx8OvUrvS3d9djOaQfiGq_4lK8Fk4,784 +torch/include/torch/csrc/profiler/api.h,sha256=muBCvEHUR422FAfOYpWsCkmW8zowO8HuWwgUxXztIq8,783 +torch/include/torch/csrc/profiler/collection.h,sha256=uTByPZUCtWSWOviwqzGwOhYFBJKB7QE3a8T7i_NbqTE,22309 +torch/include/torch/csrc/profiler/combined_traceback.h,sha256=fnGDK0spPp9ApI8-HO5vDUCJNx5R8rWGHO3AmEZgImg,2792 +torch/include/torch/csrc/profiler/containers.h,sha256=xPflZGvx8ffAGBQaY_7oTw4OVZ2NsmEF-PanEZNUjP4,6456 +torch/include/torch/csrc/profiler/data_flow.h,sha256=HIH0yrgMT4FJFx7WNKeVwU-LbyP9LuX7VWRERFPq8jc,3975 +torch/include/torch/csrc/profiler/events.h,sha256=ZDkAIG2kWfn81_eIBxRQF5SFpohqvbl4JF6U8JgzKq8,1324 +torch/include/torch/csrc/profiler/kineto_client_interface.h,sha256=J3QGDSXysiX-S_tpCw7uInJdBh-RQbHdacVfYoXj9b8,516 +torch/include/torch/csrc/profiler/kineto_shim.h,sha256=up4DZNq6YZ7SqTK9kkwnmR8rbhitbWmIGmGsjiSPEgU,4322 +torch/include/torch/csrc/profiler/orchestration/observer.h,sha256=zIg8Ulm_VMXeo4_mEdkYG6JoYvZZhsFeUV08UquNYJI,7926 +torch/include/torch/csrc/profiler/orchestration/python_tracer.h,sha256=i2O4rKre2C4VHlkZmMjDdHIJHAsSI_7E_tTxTrxmVxs,2640 +torch/include/torch/csrc/profiler/orchestration/vulkan.h,sha256=3kZpdJ9lvpYzYU_R0NevCKu2pnidttLpm__et6LWkqY,1057 +torch/include/torch/csrc/profiler/perf-inl.h,sha256=PN1jdEzzlm02GXJLPWWrsYX6W5VkK2OsbXeqX5yk9Uk,1731 +torch/include/torch/csrc/profiler/perf.h,sha256=s4O9w9gC-y0CddB3YhLWvTXykOQK1xC6Ho3WhJOGTk0,2953 +torch/include/torch/csrc/profiler/python/combined_traceback.h,sha256=NvudjY0ehwvhq0ltCUK4TdTm-9U4dzdIPkGld6oDb-0,1278 +torch/include/torch/csrc/profiler/python/init.h,sha256=docmI2LVz_OrG0Bnhi5NngtQXKh7QGVFgA2y4rrUWFA,1288 +torch/include/torch/csrc/profiler/python/pybind.h,sha256=hKVWypIWf4dzPJsl9_jANgbvGTi-FddPgLv1geHdosQ,1568 +torch/include/torch/csrc/profiler/standalone/execution_trace_observer.h,sha256=voF2faOuM0boq85G6YTs2Eb1OA31akCNLRqvAwRW4-o,908 +torch/include/torch/csrc/profiler/standalone/itt_observer.h,sha256=vnl9E-K9SXmXGHSutUgoCD-j7bKeFVZiN7S2zUTQPg8,492 +torch/include/torch/csrc/profiler/standalone/nvtx_observer.h,sha256=7Nvm_Y1BrhkcT3RJ3WDF5Acnh1UmN6GRHN7s_ijuqp0,493 +torch/include/torch/csrc/profiler/standalone/privateuse1_observer.h,sha256=WSvak3RwokbXk2fx4z5FVzROCCUVFRAWjcNIIGVLp8I,1750 +torch/include/torch/csrc/profiler/stubs/base.h,sha256=kntp0f2oDOsTRKelLp2KMRUJ_ckja3PHeXH5SC8kjuY,1997 +torch/include/torch/csrc/profiler/unwind/action.h,sha256=H7RBg_6uqUkhYcghlwB7X2gP07o85fhuvqVyUU0U244,1742 +torch/include/torch/csrc/profiler/unwind/communicate.h,sha256=bT-VHVKXF8SDgp4DhaHDerKK2efh_oR5fG052tusOMA,2584 +torch/include/torch/csrc/profiler/unwind/debug_info.h,sha256=DtGscf14BDSbLDo-a8UciBm2fxC6qwibwLqK_bCW6nw,9639 +torch/include/torch/csrc/profiler/unwind/dwarf_enums.h,sha256=zTHsthkl36pb5tq69Bwz5NqOiE7WWaSOhCrzawEyAOo,1415 +torch/include/torch/csrc/profiler/unwind/dwarf_symbolize_enums.h,sha256=P4lWNpJUDTxnJow2yNMr30JnLl6w3SmfBtKmebcFQAk,5096 +torch/include/torch/csrc/profiler/unwind/eh_frame_hdr.h,sha256=g4F3D4Qsdil8hvIww55S0xPTVbGI3dFAS-gHwarCQGk,3039 +torch/include/torch/csrc/profiler/unwind/fast_symbolizer.h,sha256=FKCQ9XWmQKIKOqdggaxGK23T3UnCQ_fxfZmuWMqtEVg,3670 +torch/include/torch/csrc/profiler/unwind/fde.h,sha256=sm2x2NbPZL0eV-3zS2E6J9q_LPdJ2Hr6KkAu7rGZSZA,13107 +torch/include/torch/csrc/profiler/unwind/lexer.h,sha256=Nb845SNuKS5_OiXqCWLeSiaECupN0-2198PH3FqvJug,4299 +torch/include/torch/csrc/profiler/unwind/line_number_program.h,sha256=RtlPq4dnRQkHHzvRKqbKFUbyhSqPGqTyhp4oy-qiMpo,11412 +torch/include/torch/csrc/profiler/unwind/mem_file.h,sha256=YhXPt62cW0cGwzyAfG46LxZepcNxMbvr7vECbGm2Fcs,5007 +torch/include/torch/csrc/profiler/unwind/range_table.h,sha256=xkMYUP1fzOef9Flt3GRwuUnU4vh_tMBTIQX4nx0T6Iw,2441 +torch/include/torch/csrc/profiler/unwind/sections.h,sha256=ptP_lbcGKpXpWu8VeMVawgom8ETi_uv7vymLmMz-MnM,4047 +torch/include/torch/csrc/profiler/unwind/unwind.h,sha256=LthobQUrZzAgXpkbTbTZSpt4Y7GerYQKWk8L-1wqY0s,1435 +torch/include/torch/csrc/profiler/unwind/unwind_error.h,sha256=Ox5EjdDu1ZOldOp3J9ddW19VxQc2wtoQ6vAPlG8sis8,1186 +torch/include/torch/csrc/profiler/unwind/unwinder.h,sha256=PlWa6l8u9Jnd-lPWQkFnC_mZm8Aj-jTGm_YJStdvnn8,2633 +torch/include/torch/csrc/profiler/util.h,sha256=aDBrNYS3i8r6VTJ81xyOasjQyST_Ev2aFROdF_D0wNU,7313 +torch/include/torch/csrc/python_dimname.h,sha256=0IKZ6Q9C1DeyZ58ROn5bMANXDqgPg4PJ8TRAdOi6Eq0,480 +torch/include/torch/csrc/python_headers.h,sha256=Hb5sR-cJD3tvVMBHMpDHTd1X4HdIuWk-CMRioqxMGGY,933 +torch/include/torch/csrc/serialization.h,sha256=kf7K6RIpDMHV6JFLcqlM5opshnzt4w71TC9fN8m0iOw,967 +torch/include/torch/csrc/shim_conversion_utils.h,sha256=gOZzmMfkjNzJINPMHiYVbGG8s3GhfrENpfrG7E9SsKs,953 +torch/include/torch/csrc/stable/accelerator.h,sha256=WIjo1K1mqc3jr3g0-DkRHg2Zg79TG16c9m-4tgfZ1ig,2287 +torch/include/torch/csrc/stable/c/shim.h,sha256=SINTxoD6xw6SOnJEjEfq1NPIK0pkgpmv4ty68N7AKvc,5441 +torch/include/torch/csrc/stable/device.h,sha256=_VgKodNzqPTUaLN5JHzEbFlgXAwsurWKD6EMpwEkndI,105 +torch/include/torch/csrc/stable/device_inl.h,sha256=NkxnuzvxglxrU56RarNjF6svzFtK0jal11wy_2Ub-Wk,1390 +torch/include/torch/csrc/stable/device_struct.h,sha256=X_xEWJJvofiCBw_9lmK8JQdC83fpQChythYZJRw63kg,3260 +torch/include/torch/csrc/stable/library.h,sha256=4OkhKcYBqVy2GmvLCpHzEkMqYWzvOqzAW1fJXClnR9E,13385 +torch/include/torch/csrc/stable/macros.h,sha256=OJRM-We_BFq9LHaAygPcHkSxsSEOQs2SZ1ehx_XShaQ,1150 +torch/include/torch/csrc/stable/ops.h,sha256=KUcR7cfa-jRhQgOt6lK1O1ysDR06hpGgzM92hO037ow,29748 +torch/include/torch/csrc/stable/stableivalue_conversions.h,sha256=-lgBqHwXFo_A_dGMX6tFR-wkZ7HGNadcpDb6iNoEmMA,34825 +torch/include/torch/csrc/stable/tensor.h,sha256=3-WOF-IxlqNbF-dWNMB990GSNnRNL9gRZEHB_dAkTJo,105 +torch/include/torch/csrc/stable/tensor_inl.h,sha256=9N5o0Nl2t8Jf_wsq7FigAqEyXieiljg3P8nJac2WPPo,2955 +torch/include/torch/csrc/stable/tensor_struct.h,sha256=8S-trDv1AwZrrnL7y7EtQmgOJq2NVDz8ORUn4rMttGk,8964 +torch/include/torch/csrc/stable/version.h,sha256=oMLZOBhvAnZnSk-zIrzh7XhRRU9R8X6Tde3XU3d8Qh4,1068 +torch/include/torch/csrc/tensor/python_tensor.h,sha256=QKxvG-6RwKnI8XQxjky_iEuFQ12CRs9aPxDohQNea8M,1494 +torch/include/torch/csrc/utils.h,sha256=mCt-MdufYwJN6N99GlzrjXEs6Ih9zYvVVgRKlBT11ME,5014 +torch/include/torch/csrc/utils/byte_order.h,sha256=nPukOcmuevv7DyexBUB1y2Vk6Bb0YTeC6VwngDby9k8,2594 +torch/include/torch/csrc/utils/cpp_stacktraces.h,sha256=WR5erUEEK9JkospOXNtbSxEz9OSwjBSEu4-bBim2YpQ,498 +torch/include/torch/csrc/utils/cuda_enabled.h,sha256=l3RYFzQ9Dn6xu6AwoR7MouW92O7vI3RvUhZiiNkGPyc,442 +torch/include/torch/csrc/utils/device_lazy_init.h,sha256=ceQ1qhmsEwWTj3bLMIfvicT5txDvdlCZzTosSpkMoKs,3160 +torch/include/torch/csrc/utils/disable_torch_function.h,sha256=g4dOR1OW_Lo0q_dky7xahAvRJksjbJ_Mzzz7vlb5jcQ,2216 +torch/include/torch/csrc/utils/generated_serialization_types.h,sha256=AVTqs_Lx-AZyDMWCqcPD0s1kmVcltvWAOVnYAaTsB7c,126466 +torch/include/torch/csrc/utils/init.h,sha256=75zflDqwjzKAf5_6jcMwk6Fd-s9Fd0UWeINzbdrBZAM,461 +torch/include/torch/csrc/utils/invalid_arguments.h,sha256=IvxtbAEUgiwYl6lxBRTmHCCKvq62BpZOkjxTitXNqpA,576 +torch/include/torch/csrc/utils/nested.h,sha256=BS3PbhUYIFXqdH1gnU6AI7Lh4tcYexNxRQi3OkOB7xo,580 +torch/include/torch/csrc/utils/numpy_stub.h,sha256=dyACpvbm9-qqRl43dnD_-3GdiBPxpQxFQ5HFcU_YnEM,679 +torch/include/torch/csrc/utils/object_ptr.h,sha256=Qb1PdLoscuNkqNUSFzc1fGQUwjmtK1oURi76JpiIWzg,2340 +torch/include/torch/csrc/utils/out_types.h,sha256=Sfs51U5CiuzChcW_f-i0bXisHc2k85qQm0-Elv38Kio,594 +torch/include/torch/csrc/utils/pybind.h,sha256=nT006bnZ4wKmQcSWPqlbYSTaZJmo8sGSxAOvr-KYRTY,13854 +torch/include/torch/csrc/utils/pycfunction_helpers.h,sha256=xeVhJ9wbTY_Ie8l9rUkZ6Zuh6FMPDJ6mP-u1ZFDrbG4,1092 +torch/include/torch/csrc/utils/pyobject_preservation.h,sha256=RKyScjDHV_XhSrxdLpzN1TRcxGmYEDymx71qqgRuCyM,1018 +torch/include/torch/csrc/utils/python_arg_parser.h,sha256=JKv0Q39dYlQdbO4yolY2R6WPj04gbgm5_em7TuE6cco,45373 +torch/include/torch/csrc/utils/python_compat.h,sha256=GSqFM63naxQMJmFnQq8DUN3hsfv3yDrzhcUms7bxhmo,1266 +torch/include/torch/csrc/utils/python_dispatch.h,sha256=wiObLlesRgWXeXr8_2yEhrVmsL6xTzMpUaYqTzra-QM,672 +torch/include/torch/csrc/utils/python_numbers.h,sha256=IOyNHsI_eLmzkmoCLl12AvESAH20sGEWCBJJvLNYTqI,6615 +torch/include/torch/csrc/utils/python_raii.h,sha256=INdaK6YlfkyUZe1GHTF2msodiZlk7ytAQdtr9hofKww,3001 +torch/include/torch/csrc/utils/python_scalars.h,sha256=1nh_p3drjZDxeo_27dUBtdRsUE1jcWnnXim7Sb_o__U,6455 +torch/include/torch/csrc/utils/python_strings.h,sha256=ShzPFoQbMuuyA7zrMwRzr3EbI7F_7mgf0UaIYmYzTM4,4997 +torch/include/torch/csrc/utils/python_stub.h,sha256=vc6j4AKPy5KOCbN9438wgL2JRD2fQFhcaawttrnUBic,319 +torch/include/torch/csrc/utils/python_symnode.h,sha256=09dG6Ds7vBshs5xCsKqC9H_S3NXwup_uFQBeA_QJ9WM,10707 +torch/include/torch/csrc/utils/python_torch_function_mode.h,sha256=I8aG197k1d9oT8lSFOA-x5oy1Giyd9KQ44XSeFS8ssg,1128 +torch/include/torch/csrc/utils/python_tuples.h,sha256=kkgQQM-lakaNVvY6xNdbqSawRn1KWpzXMMzzwW-V-xs,1012 +torch/include/torch/csrc/utils/pythoncapi_compat.h,sha256=dqMBpwXYLT4uX6NS70T-e81qqHllxp4jIrTo6jrTzKE,75369 +torch/include/torch/csrc/utils/schema_info.h,sha256=HUv1uo936xMY5zYS4Ged9dM-dgwjA1SDxbtrXdDJtuE,4164 +torch/include/torch/csrc/utils/six.h,sha256=5pnPLq_dYRkyDRa3Nrj6FETpQFO5RJ1VQ9WGzZ26sH8,1800 +torch/include/torch/csrc/utils/structseq.h,sha256=BpGaz0_YxJMM6aCnb6H-DdMc4XAvKaqxFWR592HeK3M,409 +torch/include/torch/csrc/utils/tensor_apply.h,sha256=rqsCght6WPBl315MPSBjeAGWMGD0yUj58JqMWci9bjU,706 +torch/include/torch/csrc/utils/tensor_dtypes.h,sha256=zGbNrUfN9fTjrhGdUBtpxJAXg0KEkhIAhsTfxKJ8ZqU,514 +torch/include/torch/csrc/utils/tensor_flatten.h,sha256=e7zA3MQ1dhmx_9uMc5QnwH3ifpx8EWHiR5RVZzb7v8o,3088 +torch/include/torch/csrc/utils/tensor_layouts.h,sha256=tali2Kuq1laPOvqR7WyCWuLSqhw2EsSc656FY1EVSYg,335 +torch/include/torch/csrc/utils/tensor_list.h,sha256=nPzLnCQw9tBp0x_kq_eOtSEkVnpuqB0v5UYaA4TFwsU,439 +torch/include/torch/csrc/utils/tensor_memoryformats.h,sha256=XdKibuOklE6fdBfwt0VD-GC5auhlMfkF6bfQHoS0Nmw,620 +torch/include/torch/csrc/utils/tensor_new.h,sha256=z6vzD6rY8nq6w_UL_N-bx1Sh84dK4zfbO3x7wpxaHcM,4426 +torch/include/torch/csrc/utils/tensor_numpy.h,sha256=CpFdm5whT1GFYADdHNJSkJUSs-1WR6mDLnYW71jqi2s,1166 +torch/include/torch/csrc/utils/tensor_qschemes.h,sha256=2mmcoD6hbQhOz5y46WB5abzFdxqfuc44fY4y1BkYNXQ,442 +torch/include/torch/csrc/utils/tensor_types.h,sha256=E6iX7JMkTNO-5J3LuXHvUEI79XDJ0gTnU78xqm5HL3s,948 +torch/include/torch/csrc/utils/throughput_benchmark-inl.h,sha256=Wnu70T15UdoUlHl2Me4-cimaDMMBD1MC6dH31AHHdOU,6766 +torch/include/torch/csrc/utils/throughput_benchmark.h,sha256=0R3njslXndX7EWPbx4HY24_Zl8wECTISa4ZdZb57cRE,7395 +torch/include/torch/csrc/utils/torch_dispatch_mode.h,sha256=X4qzn9v-T0Wvhl73PARYCXU4aeyBu2ogs4o5jtbkzPY,2602 +torch/include/torch/csrc/utils/variadic.h,sha256=2-8DLh71lY1914xaUSwTIkIhJot_Oxi0qR_1NX3BW70,3746 +torch/include/torch/csrc/utils/verbose.h,sha256=sY1c0x9sfqWIP3yPMu8rm5rrCznT87Eka5BELyECeck,405 +torch/include/torch/csrc/xpu/Event.h,sha256=Yu0WJeqEIue1CCAc81S9OyQyfjVJf7Y4eCG46S_w9fM,644 +torch/include/torch/csrc/xpu/Module.h,sha256=blHHXhbv8ryqUOJj0tB4TqTUv1K6cCXD9zTY6kCRz50,446 +torch/include/torch/csrc/xpu/Stream.h,sha256=mFAsyjwhbpo5TUiC68w72wp4vC3FG9YACMb1VIf6lEQ,713 +torch/include/torch/csrc/xpu/XPUPluggableAllocator.h,sha256=ESvTO58p9bgb-OK2qeITwsytwH9HJ56OOOir9Y4gFko,3209 +torch/include/torch/custom_class.h,sha256=VJCnyGxPaVfHawornIFd-0pxtyNNhV-vegtWfT3oghg,20628 +torch/include/torch/custom_class_detail.h,sha256=4HeQpjD_eqmJl_osAZMjd0s4vMN4cz9V6BpxhWe0IpM,8333 +torch/include/torch/extension.h,sha256=fXt7GJaaazHt2ixi4Atx7ysMxh8hZr4Bj9Tzch30xy4,481 +torch/include/torch/headeronly/core/DeviceType.h,sha256=cuJAWHy2B-GALDDwOf-RYRO3BTSWJBcZMJWaBJn8pnk,4588 +torch/include/torch/headeronly/core/Dispatch.h,sha256=68YnFQUwvs6fC4meX-YNUXbb_KGxtPD6qcZsS7YT9IA,3898 +torch/include/torch/headeronly/core/Dispatch_v2.h,sha256=LTE59Ssip-hQNSV6UdlPdiPJPmBz9N3TycGwuuVlRYM,33157 +torch/include/torch/headeronly/core/Layout.h,sha256=yqZudd3tYywucr-QTW3djzA1kAk40SJhlHQydTsNLY0,992 +torch/include/torch/headeronly/core/MemoryFormat.h,sha256=g93mTmO2DR9t6u__3O1csmbJciKlE2nY4Oi91bRXrqk,1252 +torch/include/torch/headeronly/core/ScalarType.h,sha256=fRF_KzmXVILpRSEhItAjCoutHzBdb4DXOXSkJzngf30,18165 +torch/include/torch/headeronly/core/TensorAccessor.h,sha256=4JldHAeESZ1jpfOeDDgz7B6xyu47HyAQ8hulTFiXUNs,14369 +torch/include/torch/headeronly/cpu/vec/intrinsics.h,sha256=UQFs3Mg9Ik0zmHboRLevoJIztLG6b0lPofJ0ExaX5iM,1967 +torch/include/torch/headeronly/cpu/vec/vec_half.h,sha256=gBMoXIdBmTa7lZuo2GiqDz3Pn6fYj-yLvI-ywQO5d3c,1799 +torch/include/torch/headeronly/macros/Export.h,sha256=vapSOd3rr8VOfJGiHO918UeLcFjhYrjL6aXHmXnJm4g,5944 +torch/include/torch/headeronly/macros/Macros.h,sha256=tSstGLkGSdSfXQ2MYy3jXUG6ggb1SSvQEsvJVLcE9Go,26057 +torch/include/torch/headeronly/macros/cmake_macros.h,sha256=iRm14TNmpSeAQWhNwnyibRXTRzx_0bc9PHDmRboggY0,464 +torch/include/torch/headeronly/util/BFloat16.h,sha256=LZ1jZ9dcxMsF1a3iyOIGs68jncmNa9fO5MVK7rNDfHs,15519 +torch/include/torch/headeronly/util/Deprecated.h,sha256=QBkJ24TmV6Jjw355jBhQnI1TeSvWcMD7a_uDdC3y_mA,3681 +torch/include/torch/headeronly/util/Exception.h,sha256=NbWiKml951g5c7of8xYqOK1iS2xR7X20D3rj8lYi-hA,3505 +torch/include/torch/headeronly/util/Float4_e2m1fn_x2.h,sha256=7m7O-uGUQeqP-r1xejUXuBPkXtfEbZldKwwRTKSKX-k,1373 +torch/include/torch/headeronly/util/Float8_e4m3fn.h,sha256=XoDzTGCbZpfmacrF2m-hMDiPSa67Q_ub6hFIE2C21zs,18939 +torch/include/torch/headeronly/util/Float8_e4m3fnuz.h,sha256=ZQhfLK-NCxpOmFmgxZQlfaO9YRpbKc07O-ElNk9tCZw,15057 +torch/include/torch/headeronly/util/Float8_e5m2.h,sha256=gD6OOUuPktMXtnc_tKibYe7jNt4S5wWzZ7ymcQhhEHY,15310 +torch/include/torch/headeronly/util/Float8_e5m2fnuz.h,sha256=NzE-iEB19VFInOE8afL0YfFGW-YeozVRp5nk0bnu2Rk,15346 +torch/include/torch/headeronly/util/Float8_e8m0fnu.h,sha256=VgQM2qN3CeXD8RWBPHIM9O58wcO-UUw32QJxYUGdtUI,7164 +torch/include/torch/headeronly/util/Float8_fnuz_cvt.h,sha256=JNNm0tlq6bGScJ5tyOdBjWHTDx5aM-z83aXQcqxyJ4A,1989 +torch/include/torch/headeronly/util/Half.h,sha256=5hRu0-2oAH0LEyIcRS5pvw61hskPmbYG02Ul_dX5VzI,29023 +torch/include/torch/headeronly/util/HeaderOnlyArrayRef.h,sha256=_lTNnen7_T2RETsWQUwZj-CUvmqQgudhwFsx7-7USnc,7960 +torch/include/torch/headeronly/util/Metaprogramming.h,sha256=A-Yjr1T6qjvW3MbhphRQtjgxC4VtYoOUAe82LP0jwYQ,7681 +torch/include/torch/headeronly/util/TypeList.h,sha256=v1WrJqRrn8j8TZ-6bcuZoc_tTJb1kXrHGqFnew9zaao,18352 +torch/include/torch/headeronly/util/TypeSafeSignMath.h,sha256=HkpTGbk_PlbD1C8iBVulu0A1UpWMSbI6rK7zChPS1v4,4733 +torch/include/torch/headeronly/util/TypeTraits.h,sha256=kKngvUXkMcUgtpUWOiN3FbUysbwCK90ZTZK7dGpf4RY,5862 +torch/include/torch/headeronly/util/bit_cast.h,sha256=PndbiM_6_U5w0g1qn6HxH2-ndL02Gu3IptRYA6yW_xk,1476 +torch/include/torch/headeronly/util/bits.h,sha256=1-BLj45ylPQM-JXzxx7fNrFFfnz5MCRgt5HFT70nDOw,1715 +torch/include/torch/headeronly/util/complex.h,sha256=LFtjbiQLbksqVG17T_PktMTYnRCjmnor2AI5yhHh1dU,18712 +torch/include/torch/headeronly/util/floating_point_utils.h,sha256=sIuoG0FyHxiieKBDp9bRHCGtlEm4tBHx4VK1yIgiA-M,1085 +torch/include/torch/headeronly/util/qint32.h,sha256=FHjByUSUFMgWP3ZMa51Jp6OC70eT_e5aZpcT5ivEl3I,456 +torch/include/torch/headeronly/util/qint8.h,sha256=PUxPD5fmlPdEhqfaLUVypyKOuSB89ub-sIlSBOjjOOM,610 +torch/include/torch/headeronly/util/quint2x4.h,sha256=zMkg-4AOkv6yht4AmofbPBcAyCcOo4npnSHHZ7GlkxE,506 +torch/include/torch/headeronly/util/quint4x2.h,sha256=5KbYN0pLAGfIoSQRlwqeHnTAy-aVpSPdkSaR4NDd75I,506 +torch/include/torch/headeronly/util/quint8.h,sha256=XHon4G8-ZoPsxapq3wBhDoRzYW348Iceg4JPNbObdUM,457 +torch/include/torch/headeronly/util/shim_utils.h,sha256=5oQZ3UFXhvlbNOCEf3oeH-if41R2IGKUnkkYubB4dTo,1057 +torch/include/torch/headeronly/version.h,sha256=D8UyrFb3Ts4Hn8MGkW4cvUdKVv5lVXagX9bN-CdYpAA,844 +torch/include/torch/library.h,sha256=EZOZ6Ygh7RNXkoC179RU48Lkvdi78iWdk0g_E3t3j5o,43766 +torch/include/torch/script.h,sha256=HdcOckZkMVMhShmDbdoFZWfEY66EZv1ow5ZcIVEdOMg,741 +torch/include/xnnpack.h,sha256=I7qTmLdgD9tE6rL0_MCWxLl8mHjFYMRugljsSU1aUBQ,206117 +torch/jit/__init__.py,sha256=keghG3j30TDWK-YWimIRU0mewdb2tO-0v6KjZac9ilI,8661 +torch/jit/__pycache__/__init__.cpython-312.pyc,, +torch/jit/__pycache__/_async.cpython-312.pyc,, +torch/jit/__pycache__/_await.cpython-312.pyc,, +torch/jit/__pycache__/_builtins.cpython-312.pyc,, +torch/jit/__pycache__/_check.cpython-312.pyc,, +torch/jit/__pycache__/_dataclass_impls.cpython-312.pyc,, +torch/jit/__pycache__/_decomposition_utils.cpython-312.pyc,, +torch/jit/__pycache__/_decompositions.cpython-312.pyc,, +torch/jit/__pycache__/_freeze.cpython-312.pyc,, +torch/jit/__pycache__/_fuser.cpython-312.pyc,, +torch/jit/__pycache__/_ir_utils.cpython-312.pyc,, +torch/jit/__pycache__/_logging.cpython-312.pyc,, +torch/jit/__pycache__/_monkeytype_config.cpython-312.pyc,, +torch/jit/__pycache__/_pickle.cpython-312.pyc,, +torch/jit/__pycache__/_recursive.cpython-312.pyc,, +torch/jit/__pycache__/_script.cpython-312.pyc,, +torch/jit/__pycache__/_serialization.cpython-312.pyc,, +torch/jit/__pycache__/_shape_functions.cpython-312.pyc,, +torch/jit/__pycache__/_state.cpython-312.pyc,, +torch/jit/__pycache__/_trace.cpython-312.pyc,, +torch/jit/__pycache__/annotations.cpython-312.pyc,, +torch/jit/__pycache__/frontend.cpython-312.pyc,, +torch/jit/__pycache__/generate_bytecode.cpython-312.pyc,, +torch/jit/__pycache__/quantized.cpython-312.pyc,, +torch/jit/__pycache__/supported_ops.cpython-312.pyc,, +torch/jit/__pycache__/unsupported_tensor_ops.cpython-312.pyc,, +torch/jit/_async.py,sha256=kXbyVaJOm080a82emXapZ8_kqW0yrPmQDLZ2fPrla4A,3942 +torch/jit/_await.py,sha256=_p5IAg33hSyJM2NnapAfT0UloKLfePWzRKF2R78zCOI,879 +torch/jit/_builtins.py,sha256=lJLul__gHG6bLwxx00qmL1b1SjEIGko_jn08BU1h8NE,7011 +torch/jit/_check.py,sha256=uH2x_P9rX7mTIa-yBjQKbf2KirqfoITqz7ecPGds7gw,10033 +torch/jit/_dataclass_impls.py,sha256=4CKdHwthl7bGd1KaKs1E8PlIdF9Q6BLQ5ksnrX_5v18,6871 +torch/jit/_decomposition_utils.py,sha256=wVkvBtJjr0VxcFZulL2kiAOQU0-kZjStXF_qPTUprco,424 +torch/jit/_decompositions.py,sha256=rvUlPMOreHbMuokX8CowOyCnxeoqgQc3evzygcf0U5g,4648 +torch/jit/_freeze.py,sha256=sm2HuTWpJcus96DcuW-dn-QS_UnBixIltNimKxX-cc0,9744 +torch/jit/_fuser.py,sha256=BohQdUJg37IE-M-E_NtRswiaReyJq1WtbIWEtHRpsBw,7251 +torch/jit/_ir_utils.py,sha256=oKEmIJcwJOZ0bIUiwnWnPgI1zQB4wsPYq7VVJeorOAg,927 +torch/jit/_logging.py,sha256=08M1dFZ7pNDPG0CK8U3KRGsDjDgGCLEqQlJDQJg8JzY,268 +torch/jit/_monkeytype_config.py,sha256=qJWP8bTGLlCE6HJKL1JpYoukyaMZDq13fXts_jeWHKQ,7551 +torch/jit/_passes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/jit/_passes/__pycache__/__init__.cpython-312.pyc,, +torch/jit/_passes/__pycache__/_property_propagation.cpython-312.pyc,, +torch/jit/_passes/_property_propagation.py,sha256=Y94CvweQZaPce4TrySM4uGEkuvxLKXmxt23MnLPfB1Y,1484 +torch/jit/_pickle.py,sha256=spTmVnJR8c_mLk4sLGyNMEd9nB0XfmdH5eHaNmTPccg,1208 +torch/jit/_recursive.py,sha256=uFrG9isPWX0n3IY5vEZk298Cso1c_AmY7nx8-K7g3yA,43356 +torch/jit/_script.py,sha256=1JRNth2UO9mimQP3X7ulFICDwmQfnpvdahB3pVex9Zo,69111 +torch/jit/_script.pyi,sha256=nIw49O_I4G9aN1JWgkfxGf1IMs9o8CSESVhoJMqhO24,9770 +torch/jit/_serialization.py,sha256=6ztnTkTNi0yA8Hxb2odQ5wFe7U-anAP0toE3ahRTOZs,11063 +torch/jit/_shape_functions.py,sha256=3cYftgtorbSTfaO6jZ7PB2gw_tgMvcuRRdDP5nOYgBc,46752 +torch/jit/_state.py,sha256=vDRL0VFvo77Tej-p0C02Jd03E15MoEWQyBsRXVQ7wyQ,3931 +torch/jit/_trace.py,sha256=DpD1SRaBsLsGykqZDS4GaRCFDc1jHX9L4SRkEmFKk_4,57384 +torch/jit/annotations.py,sha256=obPQaf1jbBe81BwINmeIfieew322zSNaLrxZyrZ9apo,18558 +torch/jit/frontend.py,sha256=59p2gfG1hGIBC8gEmoJ16TFAY_UUFADllXx7E2Y3c18,46504 +torch/jit/generate_bytecode.py,sha256=VW9-Kk1a7DkpbfBc2BjpFUNe0fz-iSAVLxmYcNWmHXo,1075 +torch/jit/mobile/__init__.py,sha256=G6ZuacWLA2nbOJukHg7n8clZT6wBrB28SNWs9eELU7Y,9133 +torch/jit/mobile/__pycache__/__init__.cpython-312.pyc,, +torch/jit/quantized.py,sha256=BzEDKVDO7Ehr-Ngjzx6wBHAvDqzCiqxWv8ztINiuE8Q,3293 +torch/jit/supported_ops.py,sha256=AafwF_rDXLshO8ehwy-dXS1b47qSoJ97Bg32ymzezfI,10610 +torch/jit/unsupported_tensor_ops.py,sha256=u03Dbg-IZp3maQS0g3jv8hauHPS9W8tXug97Rkjlvj4,2073 +torch/lib/XNNPACK.lib,sha256=r0P2fc-AeZVlxVcy4E6IyqG3WZrslDIOBQOv6KZo2QQ,2703490 +torch/lib/_C.lib,sha256=oUH6y30obk39dh09BrHmAHdhkJ01QCWj-gjVo5-ivFw,1924 +torch/lib/c10.dll,sha256=eHHnxA-5B8dauKJuj9JD1YwmZJZbmnaK2tNI3FsJD4Y,1081344 +torch/lib/c10.lib,sha256=9NAzlcyNjcY5Ik5pmZcp-1U-0i9ldnCfEo92AwF_SXQ,822024 +torch/lib/cpuinfo.lib,sha256=wmNrfosws7vNf6sQPFz_3DF7gwG9TVv07cCf0WSfBUE,118108 +torch/lib/fmt.lib,sha256=8Mq3NpVotVLJXGFR3NH9MhODe_6uD-k9zKhRLFhvwx0,1309238 +torch/lib/libiomp5md.dll,sha256=1Bpxw49iepV0hZaCCrOAE13MzEzuzW_n1OJH0BW_VaQ,1614192 +torch/lib/libiompstubs5md.dll,sha256=E33UT2Uqkm61QIYZlMWOok6_v2tFiGrJZKaMV0JUnEc,43888 +torch/lib/libittnotify.lib,sha256=O90IOsH6ha_5Q22GZyKeG9ZP-oMEE-2MhbCefmWGWZU,284300 +torch/lib/libshm/alloc_info.h,sha256=ZFoLb91AQm4_iK-eFNlbI2n2tdjVtW5KCggYCGVnraM,113 +torch/lib/libshm/err.h,sha256=s_jsA6J6KTGy6ESHZPE9_S9NhVfC-kfotSi0m5PXeIw,1283 +torch/lib/libshm/libshm.h,sha256=_5WQ7TJkxrVPT3MYyNXVnS3Cw5Iw-UTZ3-YOjK5c6ao,1251 +torch/lib/libshm/socket.h,sha256=Jk1IdFosrqYMF0Z8nTzvVvU-rAvYRwAbAvWyCTY1Lh0,4486 +torch/lib/libshm_windows/libshm.h,sha256=TNoEjSFY6vmf9pi1lm8F0qLk_SthMxLDGGTrdKeog7E,815 +torch/lib/microkernels-prod.lib,sha256=IDnMEobH1-KvAcNgbhwfIwubhVZ4Tfh2JVqFiI3r4To,2891768 +torch/lib/pthreadpool.lib,sha256=EwH6aVeyomZRrCAe_xscozLt0ogEyhwtqmn4M6N6qmo,185328 +torch/lib/shm.dll,sha256=SALYv6ivgyIu-OARbCJYxhflZmjAQV3TO49UX9LohPo,15360 +torch/lib/shm.lib,sha256=DygRKOh0jc-mOp9vPHBHVabf97s_QLS_en9HZhUNacI,3790 +torch/lib/sleef.lib,sha256=RTlwIrFIFIpUAhcwVrIzwtN9GUqOVAD4WbLmv_oqNjw,8812252 +torch/lib/torch.dll,sha256=eu7hW6wChWkC0_BwnSL7vuZoywXf_T80eTmWLsuT3L0,9728 +torch/lib/torch.lib,sha256=KdE3H_xgTecXDJU2FjvH_rmS2rtJPs0kOMXt8ycSyN0,1832 +torch/lib/torch_cpu.dll,sha256=eFQutTr0UthBsbJGRfkNJQCWeXMcdF5DV645yNMS6rc,264942080 +torch/lib/torch_cpu.lib,sha256=OJ5JiZkhalYL85hDmlTINOy3b_DRLCHSkeKw3g-wny4,29597848 +torch/lib/torch_global_deps.dll,sha256=6yOJWUrKhJqcyaHTr0rLt-otu6yz1Q2IeqLWto3bQI0,9728 +torch/lib/torch_python.dll,sha256=zts3DK6qvSIFCcWhY2RdshTL4_4wP-Upavu8G4aryS8,18705920 +torch/lib/torch_python.lib,sha256=wadbJXbUow0ZnDHBemGeH5VdxE0h6evLjO-YQGg5qZc,289248 +torch/lib/uv.dll,sha256=-laeaC_F-3qOuUxoKa-fMKVpdI27xrzjlzXUi8lgvPg,195072 +torch/library.py,sha256=-zGPdWi2tz-W8zGAt1E_cLg-GPDVzAZtl52lTE-vlfc,69272 +torch/linalg/__init__.py,sha256=80U4VzfMfgURl5LWzdJp_t2RagjwUWzFk1tLDCBheHM,117981 +torch/linalg/__pycache__/__init__.cpython-312.pyc,, +torch/masked/__init__.py,sha256=e18vUUI9fNnG5sZqFPBMrbFlXzoPIdM8Fxc--5FuJqk,985 +torch/masked/__pycache__/__init__.cpython-312.pyc,, +torch/masked/__pycache__/_docs.cpython-312.pyc,, +torch/masked/__pycache__/_ops.cpython-312.pyc,, +torch/masked/_docs.py,sha256=OmczevR9oCzOcHbugawMpdGV8skR2b55-8VrHHYyQuo,50645 +torch/masked/_ops.py,sha256=71WjwByrPlcYFVpbhyN7ohEMYxy6zSVX0Ek7k56sdI0,68497 +torch/masked/maskedtensor/__init__.py,sha256=DxojsToGqewZrb_P__TjYp8ZAcQuuC9kcj-6ZcKsduw,351 +torch/masked/maskedtensor/__pycache__/__init__.cpython-312.pyc,, +torch/masked/maskedtensor/__pycache__/_ops_refs.cpython-312.pyc,, +torch/masked/maskedtensor/__pycache__/binary.cpython-312.pyc,, +torch/masked/maskedtensor/__pycache__/core.cpython-312.pyc,, +torch/masked/maskedtensor/__pycache__/creation.cpython-312.pyc,, +torch/masked/maskedtensor/__pycache__/passthrough.cpython-312.pyc,, +torch/masked/maskedtensor/__pycache__/reductions.cpython-312.pyc,, +torch/masked/maskedtensor/__pycache__/unary.cpython-312.pyc,, +torch/masked/maskedtensor/_ops_refs.py,sha256=lBWFpm5UOBf-38Ml9hiWXMhN7IopK6Jhi3Ddbo3YVrg,18677 +torch/masked/maskedtensor/binary.py,sha256=QYnUB1ot3DIHhXpeXS1weJKaYjHY3P4FqtnyjsQVOJI,5696 +torch/masked/maskedtensor/core.py,sha256=7XqTTvPgl-Mmy9Ck_jb5qfp1Y_mRF-KAVLO82s7nSLY,13423 +torch/masked/maskedtensor/creation.py,sha256=GnNKnASrA2uOjSw4LDrC_dqxnl8HHEqZE12FUQnncGg,629 +torch/masked/maskedtensor/passthrough.py,sha256=jih-ZjwTDgw8rdb3qyFP0hkpvwaLoukfdG459X-RB-w,1497 +torch/masked/maskedtensor/reductions.py,sha256=a606ujB8wPn9FmlFLZ-dLSS1qUid9O3PInHFSddPB6g,5775 +torch/masked/maskedtensor/unary.py,sha256=_TGZ2JZ484PpXADd2in0QK4vemViMUANzcIK_pZKkqc,4391 +torch/monitor/__init__.py,sha256=fG_MJlz599HVJWQWjjMs3rNIV_AKVklcWIU2393NJ7g,1317 +torch/monitor/__pycache__/__init__.cpython-312.pyc,, +torch/mps/__init__.py,sha256=kKjTR8XFDZVS96Fhr5YqpEPcyM-9-xjCz7DMljcPaTk,6475 +torch/mps/__pycache__/__init__.cpython-312.pyc,, +torch/mps/__pycache__/event.cpython-312.pyc,, +torch/mps/__pycache__/profiler.cpython-312.pyc,, +torch/mps/event.py,sha256=oHh5ChjsP_L3WaJOs_KsUEv2-g4B1-midtwXdnpUX6Y,1775 +torch/mps/profiler.py,sha256=lR2iA_Fjxdhe9bnTCK1TdxH491HhvzYppZpBvD0hkE4,3653 +torch/mtia/__init__.py,sha256=riUKCTTHGeFjzKqQkXN03WAakCiJmUzLpXMF9M7rCpM,14766 +torch/mtia/__pycache__/__init__.cpython-312.pyc,, +torch/mtia/__pycache__/_utils.cpython-312.pyc,, +torch/mtia/__pycache__/memory.cpython-312.pyc,, +torch/mtia/__pycache__/mtia_graph.cpython-312.pyc,, +torch/mtia/_utils.py,sha256=GLEJ1vMhlwA4adZskeiHSVOdzy0kGgdDpeoIAg7Qt-k,1635 +torch/mtia/memory.py,sha256=ccpDVVniy2DAu1hOo21b3ZOcYxbNODc343v7MEAqQb4,2369 +torch/mtia/mtia_graph.py,sha256=GeQvc_FQzGKKe_Ij_vwInE2W4HHTBzxhBLqzMs039Es,2732 +torch/multiprocessing/__init__.py,sha256=IR-LR_qNSZH1R8B22NDpJeX0_Z6puIWgIZyRWnZSB3U,3578 +torch/multiprocessing/__pycache__/__init__.cpython-312.pyc,, +torch/multiprocessing/__pycache__/_atfork.cpython-312.pyc,, +torch/multiprocessing/__pycache__/pool.cpython-312.pyc,, +torch/multiprocessing/__pycache__/queue.cpython-312.pyc,, +torch/multiprocessing/__pycache__/reductions.cpython-312.pyc,, +torch/multiprocessing/__pycache__/spawn.cpython-312.pyc,, +torch/multiprocessing/_atfork.py,sha256=HM7eWPbd712wegzQ70K_oD4_tvrcfyJDCZ1cc5lAXnE,825 +torch/multiprocessing/pool.py,sha256=qI_YbMLcImtdz3uIDq7hCRBhAdZkFXrDlA1f6Yp2ivk,1795 +torch/multiprocessing/queue.py,sha256=6wenEUd1uGcL6Afud00FdBNaTZ-8LaL2n_vNdrUEtb8,1520 +torch/multiprocessing/reductions.py,sha256=ahsJiug2HraZABgIXf6rJe0upEGG6z_DXzqNLpBSFx0,23740 +torch/multiprocessing/spawn.py,sha256=qcOtTlvgCxa6rwQXezT-R9czYYRUFcMIaJ-ZFdYE_Dg,13203 +torch/nativert/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/nativert/__pycache__/__init__.cpython-312.pyc,, +torch/nativert/backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/nativert/backends/__pycache__/__init__.cpython-312.pyc,, +torch/nativert/backends/__pycache__/_lower_utils.cpython-312.pyc,, +torch/nativert/backends/__pycache__/_lowered_aoti_module.cpython-312.pyc,, +torch/nativert/backends/_lower_utils.py,sha256=DZkjuvQ4jlxZeG92nV30WJ2T4iReiw8fKGegK5mdu7k,3600 +torch/nativert/backends/_lowered_aoti_module.py,sha256=pF2Trn9BQ-3RmXyrMZGo7Bp1VuaHe9-nQGxcQmjPrps,921 +torch/nested/__init__.py,sha256=_ZGgxWRYEvOBMUJtDjliSksdTtJtDW7V1eQSp7Uo5pY,22557 +torch/nested/__pycache__/__init__.cpython-312.pyc,, +torch/nested/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/nested/_internal/__pycache__/__init__.cpython-312.pyc,, +torch/nested/_internal/__pycache__/nested_int.cpython-312.pyc,, +torch/nested/_internal/__pycache__/nested_tensor.cpython-312.pyc,, +torch/nested/_internal/__pycache__/ops.cpython-312.pyc,, +torch/nested/_internal/__pycache__/sdpa.cpython-312.pyc,, +torch/nested/_internal/nested_int.py,sha256=t90uQxMR7nCg3FvGHvwS5i0jWSADj2uk3y_hYqNEqJw,3314 +torch/nested/_internal/nested_tensor.py,sha256=kDc8RCjTbt8tOvOhtXBw7mTN6Y07tEHKUHZCiNjpgeE,25790 +torch/nested/_internal/ops.py,sha256=xngXKJY9v3W8ht-7aXetgUfS-g7WA3yjxgbx7NDg9x0,99581 +torch/nested/_internal/sdpa.py,sha256=ImSaBajewmgjBlMMyp6mxX4OZdc4eAqTS8pSn9bQMf4,35395 +torch/nn/__init__.py,sha256=QleWrbVGUa1f4u5EE3FGCN7GxWq5Fo65er1doQEbmCU,2487 +torch/nn/__pycache__/__init__.cpython-312.pyc,, +torch/nn/__pycache__/_reduction.cpython-312.pyc,, +torch/nn/__pycache__/common_types.cpython-312.pyc,, +torch/nn/__pycache__/cpp.cpython-312.pyc,, +torch/nn/__pycache__/functional.cpython-312.pyc,, +torch/nn/__pycache__/grad.cpython-312.pyc,, +torch/nn/__pycache__/init.cpython-312.pyc,, +torch/nn/__pycache__/parameter.cpython-312.pyc,, +torch/nn/_reduction.py,sha256=9d4wBXs_GzMi7CDqMyuGJpI7Q4ZpXtX-8UFIvm1GJ7I,1686 +torch/nn/attention/__init__.py,sha256=fvi2NkS0J-RsZCK4SZ9i4680W-iVnvAl6ojChtsZL9Y,6958 +torch/nn/attention/__pycache__/__init__.cpython-312.pyc,, +torch/nn/attention/__pycache__/_fa4.cpython-312.pyc,, +torch/nn/attention/__pycache__/_registry.cpython-312.pyc,, +torch/nn/attention/__pycache__/_utils.cpython-312.pyc,, +torch/nn/attention/__pycache__/bias.cpython-312.pyc,, +torch/nn/attention/__pycache__/flex_attention.cpython-312.pyc,, +torch/nn/attention/__pycache__/varlen.cpython-312.pyc,, +torch/nn/attention/_fa4.py,sha256=fs46-byIpHAJY0DqhBiMMuE0Bc7bFDC-GO99-yX351s,12479 +torch/nn/attention/_registry.py,sha256=TMFI1tnSNs6H1EWIHkD2MUYelHmcjNbij1ufAUleNvk,3995 +torch/nn/attention/_utils.py,sha256=n8Sf2HkRWo-2KOI7ZmAf4Qj834YnR17Xdmx2jjyCsX4,2072 +torch/nn/attention/bias.py,sha256=yiHOoCsnPJ0DVgg5Od7gyJcjit0eqIiEZqh3v-FFiRc,13971 +torch/nn/attention/experimental/__init__.py,sha256=58LbhVZ5cx1XVGcQw4Tew4YokuPWVtAiWDvWoabsbqA,113 +torch/nn/attention/experimental/__pycache__/__init__.cpython-312.pyc,, +torch/nn/attention/experimental/__pycache__/_paged_attention.cpython-312.pyc,, +torch/nn/attention/experimental/_paged_attention.py,sha256=UEgI0lEDdv0sv92mwDdDR2RGVTnJrrggAIjOyc86ljM,13380 +torch/nn/attention/flex_attention.py,sha256=VkufUIBM2rxTiOfiEK84nhzgDl4ydYFHgM8o1US8qok,67875 +torch/nn/attention/varlen.py,sha256=r8yds4L-t1peQE4mhTSLw206TsZJ6poE7ZZu9otUynI,10427 +torch/nn/backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/nn/backends/__pycache__/__init__.cpython-312.pyc,, +torch/nn/backends/__pycache__/thnn.cpython-312.pyc,, +torch/nn/backends/thnn.py,sha256=YlE31KFndUjiVn02hKgzlHWOUSw7KSkMldv7x8HKT08,160 +torch/nn/common_types.py,sha256=POMowFvT26YJESvDHsnVBUAfWnhtbLgWoqBd4w3AtlY,2135 +torch/nn/cpp.py,sha256=-F-CVZNxyQb4xc_gqG_CHRZAfCM6JSQtbp8seCFFmq0,3190 +torch/nn/functional.py,sha256=3qg1I2-7GBEFT7TObGYfwWqrfW9OStTAlrKfkMM6tMo,265209 +torch/nn/functional.pyi,sha256=3RYmJeBwCVVKqFLpgblJcuQxUrVLToBP0cMm6kgizdk,28949 +torch/nn/grad.py,sha256=MG54cZn6HW7CVLhDZHKqmiOj1WQqhtk3Oo5bFxeudDw,10208 +torch/nn/init.py,sha256=5hX0KLtu6JWDqdo2A3O0WW2MtS9XqQhC40-h3BZDBeQ,25588 +torch/nn/intrinsic/__init__.py,sha256=4y35Rm3epwUxcsIUr4kYd3j-T9DPshjMUAvHizLDHqs,733 +torch/nn/intrinsic/__pycache__/__init__.cpython-312.pyc,, +torch/nn/intrinsic/modules/__init__.py,sha256=UBTOY6kdnyOWRjpGh6DSYu10sWxK7G-XvGFvSRQSiik,550 +torch/nn/intrinsic/modules/__pycache__/__init__.cpython-312.pyc,, +torch/nn/intrinsic/modules/__pycache__/fused.cpython-312.pyc,, +torch/nn/intrinsic/modules/fused.py,sha256=340yk-lF--9pZSnoax5nO4lDvMGs4P2ioIhAgchFZF4,596 +torch/nn/intrinsic/qat/__init__.py,sha256=p-5evJa2FgDM8QCPqTuBGITlflcXw7Yg0RCyg937f9w,60 +torch/nn/intrinsic/qat/__pycache__/__init__.cpython-312.pyc,, +torch/nn/intrinsic/qat/modules/__init__.py,sha256=0DDjW4qnb6yRV6vAPx0A8gYwVJMamrLF2RrRNDn2by4,669 +torch/nn/intrinsic/qat/modules/__pycache__/__init__.cpython-312.pyc,, +torch/nn/intrinsic/qat/modules/__pycache__/conv_fused.cpython-312.pyc,, +torch/nn/intrinsic/qat/modules/__pycache__/linear_fused.cpython-312.pyc,, +torch/nn/intrinsic/qat/modules/__pycache__/linear_relu.cpython-312.pyc,, +torch/nn/intrinsic/qat/modules/conv_fused.py,sha256=x3dBXYgf8j9Sk-0ardC80EJ-CQzSb3qlPDLPzXikTcc,872 +torch/nn/intrinsic/qat/modules/linear_fused.py,sha256=j-YRmOnJIDjS4MM_7PPpA6g0knYD8ZyHzQOgAX1JCeM,449 +torch/nn/intrinsic/qat/modules/linear_relu.py,sha256=4nuwARqzjZM6wxA--BGQK-xx0Nk6O5HT-iTOxa4TIxU,449 +torch/nn/intrinsic/quantized/__init__.py,sha256=TzvJoBi6HMEyZWBEcCh6DLsmodGy3-6S2ClPPi4Q3No,350 +torch/nn/intrinsic/quantized/__pycache__/__init__.cpython-312.pyc,, +torch/nn/intrinsic/quantized/dynamic/__init__.py,sha256=9zpAuvn27ttR3rNI37aoR0Ml_bqCA1_WmyZdvlO5RdY,74 +torch/nn/intrinsic/quantized/dynamic/__pycache__/__init__.cpython-312.pyc,, +torch/nn/intrinsic/quantized/dynamic/modules/__init__.py,sha256=f3fbpMxfHM5-gmdXbJT6HTJ1XBN6BgLXm_9jj-csmzI,120 +torch/nn/intrinsic/quantized/dynamic/modules/__pycache__/__init__.cpython-312.pyc,, +torch/nn/intrinsic/quantized/dynamic/modules/__pycache__/linear_relu.cpython-312.pyc,, +torch/nn/intrinsic/quantized/dynamic/modules/linear_relu.py,sha256=tgaDRubiJ9y1u1USs7UUDyQ0l9mB_WzQOPDIxPka7ho,103 +torch/nn/intrinsic/quantized/modules/__init__.py,sha256=7epBP6GiGh24LUh-kuuuKkEZeubs2_mI3s8AkWD5szs,396 +torch/nn/intrinsic/quantized/modules/__pycache__/__init__.cpython-312.pyc,, +torch/nn/intrinsic/quantized/modules/__pycache__/bn_relu.cpython-312.pyc,, +torch/nn/intrinsic/quantized/modules/__pycache__/conv_relu.cpython-312.pyc,, +torch/nn/intrinsic/quantized/modules/__pycache__/linear_relu.cpython-312.pyc,, +torch/nn/intrinsic/quantized/modules/bn_relu.py,sha256=mexLG77ELYLoVfXlSKcigmjc0NiePBNZwClR2mpDFFE,118 +torch/nn/intrinsic/quantized/modules/conv_relu.py,sha256=7isVCn-xK1Gmf8gCoGPC8iwuIRm6PQntHT9s0qufmHw,157 +torch/nn/intrinsic/quantized/modules/linear_relu.py,sha256=bFM-bT1HI7uu3zzCFPo-_KYfxO6Lr3-VPid5_EwHMpo,95 +torch/nn/modules/__init__.py,sha256=8sSanMhe5aUOD61p2kMhLvd7fte-aBIJHI_8ELsbdgQ,6828 +torch/nn/modules/__pycache__/__init__.cpython-312.pyc,, +torch/nn/modules/__pycache__/_functions.cpython-312.pyc,, +torch/nn/modules/__pycache__/activation.cpython-312.pyc,, +torch/nn/modules/__pycache__/adaptive.cpython-312.pyc,, +torch/nn/modules/__pycache__/batchnorm.cpython-312.pyc,, +torch/nn/modules/__pycache__/channelshuffle.cpython-312.pyc,, +torch/nn/modules/__pycache__/container.cpython-312.pyc,, +torch/nn/modules/__pycache__/conv.cpython-312.pyc,, +torch/nn/modules/__pycache__/distance.cpython-312.pyc,, +torch/nn/modules/__pycache__/dropout.cpython-312.pyc,, +torch/nn/modules/__pycache__/flatten.cpython-312.pyc,, +torch/nn/modules/__pycache__/fold.cpython-312.pyc,, +torch/nn/modules/__pycache__/instancenorm.cpython-312.pyc,, +torch/nn/modules/__pycache__/lazy.cpython-312.pyc,, +torch/nn/modules/__pycache__/linear.cpython-312.pyc,, +torch/nn/modules/__pycache__/loss.cpython-312.pyc,, +torch/nn/modules/__pycache__/module.cpython-312.pyc,, +torch/nn/modules/__pycache__/normalization.cpython-312.pyc,, +torch/nn/modules/__pycache__/padding.cpython-312.pyc,, +torch/nn/modules/__pycache__/pixelshuffle.cpython-312.pyc,, +torch/nn/modules/__pycache__/pooling.cpython-312.pyc,, +torch/nn/modules/__pycache__/rnn.cpython-312.pyc,, +torch/nn/modules/__pycache__/sparse.cpython-312.pyc,, +torch/nn/modules/__pycache__/transformer.cpython-312.pyc,, +torch/nn/modules/__pycache__/upsampling.cpython-312.pyc,, +torch/nn/modules/__pycache__/utils.cpython-312.pyc,, +torch/nn/modules/_functions.py,sha256=vqQhl-td455FAG9oJQkU5LM6vkcxJxMUkBgOG9sdtU8,12462 +torch/nn/modules/activation.py,sha256=b6zQu6M5ucp1I9UGY4mrW_pGEpLFoj8aRUrmDOVAbCQ,63595 +torch/nn/modules/adaptive.py,sha256=s7elYhlvqmAqJ3YohhJJaWrAZj7563JgUsz6SA7OsIA,12945 +torch/nn/modules/batchnorm.py,sha256=Xd-TKknnKGN0HLRAVWNtWA1KCPKk6AGPBpkEkAnhgF8,40026 +torch/nn/modules/channelshuffle.py,sha256=w_ToWlXztfpoIVaNN1rDpBDQlRrCTOdmDMyBmMvZH5c,1744 +torch/nn/modules/container.py,sha256=zdT2HEorXQMhgZAsSxJKFkb9gttTee1XntjjTYL-dJs,38687 +torch/nn/modules/conv.py,sha256=Cc3nTzGKOXX9z13Xw8lpGAT3QG6HWLydqOUKtYP6ZYw,80389 +torch/nn/modules/distance.py,sha256=HF_-GL9bveU0Avb1FOjvz7ySdP-yThUtlV8-sCEjJUw,3472 +torch/nn/modules/dropout.py,sha256=Z56KwBmK0kdofR75-a11RocBMMBTtr5Dz7rnq1TLNz0,11840 +torch/nn/modules/flatten.py,sha256=CZTxY7WzKWqOxIw5tUmSER-tJWlGj5W3TphuCPpKwKI,5927 +torch/nn/modules/fold.py,sha256=hVHjvlPjYXQnkygg1kPrc4tW9iCbpLmohFaLuKSfdT8,13562 +torch/nn/modules/instancenorm.py,sha256=bO5Xg-8BXJle7K03XPAqFLxVEZc8agXcg6wA3aDqL0s,20918 +torch/nn/modules/lazy.py,sha256=FHEj-gWM5ka1QG5XUWlIgYtoAhjT-5ah20zMEg4LA5Q,11952 +torch/nn/modules/linear.py,sha256=kXgb1FvymaZ7TuRLXmgHZ7v3iEajPEcjcmBSQ7-r7N4,12663 +torch/nn/modules/loss.py,sha256=Q_7p1LF8NLDTUHGZxaJBgazvJ7KfICWFaeqg9bYxw5Q,98466 +torch/nn/modules/module.py,sha256=wTRJyeCzZE1L5T8gUOPnHU8r8vSxzXFnLm6Dd0k7uaI,130514 +torch/nn/modules/normalization.py,sha256=ukrVPeRFoJKUGsdEgO8UhMAEPEKHOfHhyE8_vxP4r1U,15706 +torch/nn/modules/padding.py,sha256=0L299Q2tAF6khZ4JM86VygksYCcrWr9IsUKmqQTJcng,32502 +torch/nn/modules/pixelshuffle.py,sha256=3KdHa482JK0gRIIq7tlsWq7wyFmufimecWRGgGm9RZk,4075 +torch/nn/modules/pooling.py,sha256=unje8c2e0R-FM8ZLCwmdJCCOXUh_qac3MLRn5FaeIR8,62664 +torch/nn/modules/rnn.py,sha256=YkCPcSooh-_Iua3Hzq-0m3qOPrwnrhoD-1qo8bCpF1s,76741 +torch/nn/modules/sparse.py,sha256=CTvxQWtg3KQ2LbbTH9091F4Xt7ge2R8znhxHqWCCHhM,24757 +torch/nn/modules/transformer.py,sha256=gNgEX4TaYDI6O4dAf_rKn5smapsd9nrz8BJGgMVNaGA,53803 +torch/nn/modules/upsampling.py,sha256=VckTK7mHPiz6RM-aicN-5nvq_3rOvF2JbjyQC8fYdUA,11909 +torch/nn/modules/utils.py,sha256=0fuLgyLYn_eMtXkIxt3K5fW9P_0elS0Umbsp5p9Jw2g,2723 +torch/nn/parallel/__init__.py,sha256=bH4_qdrQvxrqhlyf-9hHEzGdC5qcxL288zpCxlbFUEg,787 +torch/nn/parallel/__pycache__/__init__.cpython-312.pyc,, +torch/nn/parallel/__pycache__/_functions.cpython-312.pyc,, +torch/nn/parallel/__pycache__/comm.cpython-312.pyc,, +torch/nn/parallel/__pycache__/data_parallel.cpython-312.pyc,, +torch/nn/parallel/__pycache__/distributed.cpython-312.pyc,, +torch/nn/parallel/__pycache__/parallel_apply.cpython-312.pyc,, +torch/nn/parallel/__pycache__/replicate.cpython-312.pyc,, +torch/nn/parallel/__pycache__/scatter_gather.cpython-312.pyc,, +torch/nn/parallel/_functions.py,sha256=j0IUqw6QG3QlX2-ECt38H6DwTx2YEDIaLoTVk7F-PUk,5077 +torch/nn/parallel/comm.py,sha256=fDG_L2WoYKOjo3-sdOVLD0rQsT-PmIxC33WzrO8M-cA,11280 +torch/nn/parallel/data_parallel.py,sha256=Ne26ieGR-KRtg0fQ-jYKxyLOTYpy_HW-PEA7xoeV5Q8,12167 +torch/nn/parallel/distributed.py,sha256=iaNMEN9ztStVDe60EKdR5lZgQZGdRpjXvpB9U5axo7M,112293 +torch/nn/parallel/parallel_apply.py,sha256=uhowmqz4UtZeY4GdzpcLyuOIQ_yDuD_uT8EPOq4inEw,4818 +torch/nn/parallel/replicate.py,sha256=pSoCdUZNj-jjQBtsbMU5Y5jhu0Z7lDKmBgkybjXyvE8,7175 +torch/nn/parallel/scatter_gather.py,sha256=1Q0oEHPR_tGB5_f6kJyQnf5qihBj9ZNl-QLkqF-StRw,5856 +torch/nn/parameter.py,sha256=y-BybCzf7kZk0lAx39uHn6dbuNdncoYeWmzx3mzCel0,12524 +torch/nn/parameter.pyi,sha256=DEqN87GmJMZGt65EcNnbrZfYqf_RmkkUIBQKNh02He4,1161 +torch/nn/qat/__init__.py,sha256=pHegh4R0-F97KQg3aD-sS0iMSrzniaH9gpLhLt1HAVA,384 +torch/nn/qat/__pycache__/__init__.cpython-312.pyc,, +torch/nn/qat/dynamic/__init__.py,sha256=IFxcIU-Zi7ju-VXfx5LO6qV1pzWSJGivHrShc3-VRrQ,216 +torch/nn/qat/dynamic/__pycache__/__init__.cpython-312.pyc,, +torch/nn/qat/dynamic/modules/__init__.py,sha256=xhaQBKF6ynIsfGH7lkql1W9yFDyJnVsQ1rhZ1ATMaDo,82 +torch/nn/qat/dynamic/modules/__pycache__/__init__.cpython-312.pyc,, +torch/nn/qat/dynamic/modules/__pycache__/linear.cpython-312.pyc,, +torch/nn/qat/dynamic/modules/linear.py,sha256=Qp_oQPS9HJUi2t0nPiFzUtUMkwUp8XW9lr3t6C7WzCY,427 +torch/nn/qat/modules/__init__.py,sha256=6Sx-ipG60zKKr96Gfu_oCeZ02h1j-WVyPB1tR7DQ_1A,522 +torch/nn/qat/modules/__pycache__/__init__.cpython-312.pyc,, +torch/nn/qat/modules/__pycache__/conv.cpython-312.pyc,, +torch/nn/qat/modules/__pycache__/embedding_ops.cpython-312.pyc,, +torch/nn/qat/modules/__pycache__/linear.cpython-312.pyc,, +torch/nn/qat/modules/conv.py,sha256=4_HHeeAfHpwkekhOyE02Plind4otYDPXvYL_PyfIKaI,417 +torch/nn/qat/modules/embedding_ops.py,sha256=tNse_KPodjxDvvr8d_wkgshCOp3SqL3Zd5mbORnvJ6E,472 +torch/nn/qat/modules/linear.py,sha256=1BvjhZ-tBetm7yk0qFGY7rx2jQDi7Qips2VNCHgoTEY,403 +torch/nn/quantizable/__init__.py,sha256=-0datFuoOimv7Qda2O56u2mPcV2YE2mBLW4ErmOMt8k,58 +torch/nn/quantizable/__pycache__/__init__.cpython-312.pyc,, +torch/nn/quantizable/modules/__init__.py,sha256=2r8p4LEolirX0dhKNAvuJi4ubW11KIaL5leZFJPTYn4,216 +torch/nn/quantizable/modules/__pycache__/__init__.cpython-312.pyc,, +torch/nn/quantizable/modules/__pycache__/activation.cpython-312.pyc,, +torch/nn/quantizable/modules/__pycache__/rnn.cpython-312.pyc,, +torch/nn/quantizable/modules/activation.py,sha256=ZkWt9LBHI95Tp37DGPWL7ywizIai0tVN7guf-jB9y_w,451 +torch/nn/quantizable/modules/rnn.py,sha256=Ft5W_4bwJrjTQZ_dHIrwjF2WG_D3c1OKfZLdFXpgaY8,440 +torch/nn/quantized/__init__.py,sha256=REwHEIXAsudYLljnHsXvh8cIOPXMdIa-VtcJeXgUQxA,810 +torch/nn/quantized/__pycache__/__init__.cpython-312.pyc,, +torch/nn/quantized/__pycache__/functional.cpython-312.pyc,, +torch/nn/quantized/_reference/__init__.py,sha256=WbDZWiGzHm3MlXrSDJTj7v8eCeEzcDuss7lOO2nInYU,67 +torch/nn/quantized/_reference/__pycache__/__init__.cpython-312.pyc,, +torch/nn/quantized/_reference/modules/__init__.py,sha256=8gzog8X5RxwQGehxxyt80qsWpckIe8OQzRLhnP07fk0,1057 +torch/nn/quantized/_reference/modules/__pycache__/__init__.cpython-312.pyc,, +torch/nn/quantized/_reference/modules/__pycache__/conv.cpython-312.pyc,, +torch/nn/quantized/_reference/modules/__pycache__/linear.cpython-312.pyc,, +torch/nn/quantized/_reference/modules/__pycache__/rnn.cpython-312.pyc,, +torch/nn/quantized/_reference/modules/__pycache__/sparse.cpython-312.pyc,, +torch/nn/quantized/_reference/modules/__pycache__/utils.cpython-312.pyc,, +torch/nn/quantized/_reference/modules/conv.py,sha256=pjn9wbE5ASUlOevzsmw8SDxGlOADYqKZMmGliV52nL4,600 +torch/nn/quantized/_reference/modules/linear.py,sha256=pPKp0fswx4aAvvKnNqtxCpcx40DXqygxOrqeEB688qY,462 +torch/nn/quantized/_reference/modules/rnn.py,sha256=1b6FGQwK5dbTBCN0KIwuBhCLfS8nmAsTvQqNok17HZM,543 +torch/nn/quantized/_reference/modules/sparse.py,sha256=hCVj2Gqe5uV_6ptxLpvjKlAO2ddwuyy26yZzjNQ5ikU,479 +torch/nn/quantized/_reference/modules/utils.py,sha256=xgb58XnUhfBnLgeNHrBeCf7BqI7zM_osXVI0EgeY62I,608 +torch/nn/quantized/dynamic/__init__.py,sha256=zUGrFi6mSGoJGYz5xRd8uDIvmz6tIHQwKXhlalyECKg,59 +torch/nn/quantized/dynamic/__pycache__/__init__.cpython-312.pyc,, +torch/nn/quantized/dynamic/modules/__init__.py,sha256=dOUhdslM3ZBE2rYYjF4PJppebHDMcv_SrZpbMxxRzuU,1036 +torch/nn/quantized/dynamic/modules/__pycache__/__init__.cpython-312.pyc,, +torch/nn/quantized/dynamic/modules/__pycache__/conv.cpython-312.pyc,, +torch/nn/quantized/dynamic/modules/__pycache__/linear.cpython-312.pyc,, +torch/nn/quantized/dynamic/modules/__pycache__/rnn.cpython-312.pyc,, +torch/nn/quantized/dynamic/modules/conv.py,sha256=hh6gMpib0xiYrIFcZkV8feUdafY4VExsggB6Mw6RMn4,697 +torch/nn/quantized/dynamic/modules/linear.py,sha256=gRKnDAxvb0dY7DvrVxrt6VUN4_YkS6iGdQr2ZAWxqRg,459 +torch/nn/quantized/dynamic/modules/rnn.py,sha256=mHRaypMPwS3iaj0nFQp4MIseczl1wLZobltW_b5U0iE,774 +torch/nn/quantized/functional.py,sha256=j7MGLQ6xhTh3XPiEJW67BRYBggrOMGdyu7zD-E9Wor4,286 +torch/nn/quantized/modules/__init__.py,sha256=UxxpMDG7z7jPwzAgKdR6wEH5vTOJ9Sgz_u0aJuuMNFQ,2198 +torch/nn/quantized/modules/__pycache__/__init__.cpython-312.pyc,, +torch/nn/quantized/modules/__pycache__/activation.cpython-312.pyc,, +torch/nn/quantized/modules/__pycache__/batchnorm.cpython-312.pyc,, +torch/nn/quantized/modules/__pycache__/conv.cpython-312.pyc,, +torch/nn/quantized/modules/__pycache__/dropout.cpython-312.pyc,, +torch/nn/quantized/modules/__pycache__/embedding_ops.cpython-312.pyc,, +torch/nn/quantized/modules/__pycache__/functional_modules.cpython-312.pyc,, +torch/nn/quantized/modules/__pycache__/linear.cpython-312.pyc,, +torch/nn/quantized/modules/__pycache__/normalization.cpython-312.pyc,, +torch/nn/quantized/modules/__pycache__/rnn.cpython-312.pyc,, +torch/nn/quantized/modules/__pycache__/utils.cpython-312.pyc,, +torch/nn/quantized/modules/activation.py,sha256=xW027WhWB7ZNliQOe-FBGUiidOL9ICVQP0h7Ez-qphY,548 +torch/nn/quantized/modules/batchnorm.py,sha256=NXrd4bZpkNotYxpUMMX6CbkCkK8cGpgDrcfA3TZQBak,448 +torch/nn/quantized/modules/conv.py,sha256=1QiyTXQYOFuLE-p6r1sXk-SWqFZMucTLY_1fBq7vVls,695 +torch/nn/quantized/modules/dropout.py,sha256=e2wkofacz2MkquH4AmVOoZNAcInnRj8ELLd9Y6FkVFc,456 +torch/nn/quantized/modules/embedding_ops.py,sha256=jMga5rGAoWJBb1HlZAnaoDxe4jqa23rfE3eFKtgej1E,565 +torch/nn/quantized/modules/functional_modules.py,sha256=ig156T5ByLXZcE8WHAcI1i-grqMRVXI3gg0oYioJegs,572 +torch/nn/quantized/modules/linear.py,sha256=pb0RdBMmEoA5yy6pbbxMH5bUEyJGj6gblHRtk7djFUk,495 +torch/nn/quantized/modules/normalization.py,sha256=f8sdj5vc5g7Y6JbRfmfBrcAXdkJhE1p1PojMxfHTGjA,652 +torch/nn/quantized/modules/rnn.py,sha256=sWTce57bC436QZ2xtG8xBO-fCQmIxwjfwIwl-0FRUl4,422 +torch/nn/quantized/modules/utils.py,sha256=3RhDoXUIo5ZJuAkqSZJ3PUtfvfFLyIF41e4SSNLgoMo,556 +torch/nn/utils/__init__.py,sha256=QMo2DYbbLUyIoIRdNJG2qoSKD4PVj_T55lGB_kO8MGw,1385 +torch/nn/utils/__pycache__/__init__.cpython-312.pyc,, +torch/nn/utils/__pycache__/_deprecation_utils.cpython-312.pyc,, +torch/nn/utils/__pycache__/_named_member_accessor.cpython-312.pyc,, +torch/nn/utils/__pycache__/_per_sample_grad.cpython-312.pyc,, +torch/nn/utils/__pycache__/clip_grad.cpython-312.pyc,, +torch/nn/utils/__pycache__/convert_parameters.cpython-312.pyc,, +torch/nn/utils/__pycache__/fusion.cpython-312.pyc,, +torch/nn/utils/__pycache__/init.cpython-312.pyc,, +torch/nn/utils/__pycache__/memory_format.cpython-312.pyc,, +torch/nn/utils/__pycache__/parametrizations.cpython-312.pyc,, +torch/nn/utils/__pycache__/parametrize.cpython-312.pyc,, +torch/nn/utils/__pycache__/prune.cpython-312.pyc,, +torch/nn/utils/__pycache__/rnn.cpython-312.pyc,, +torch/nn/utils/__pycache__/spectral_norm.cpython-312.pyc,, +torch/nn/utils/__pycache__/stateless.cpython-312.pyc,, +torch/nn/utils/__pycache__/weight_norm.cpython-312.pyc,, +torch/nn/utils/_deprecation_utils.py,sha256=rBDLtmmd8SS4Z_YnhfY_ocuPHqko0loLZZWLZW3ES9A,1751 +torch/nn/utils/_expanded_weights/__init__.py,sha256=8_VaTgAbp0cjDp-P6-5IHjTP2iKEAI7AOhpj1OdxIZ8,462 +torch/nn/utils/_expanded_weights/__pycache__/__init__.cpython-312.pyc,, +torch/nn/utils/_expanded_weights/__pycache__/conv_expanded_weights.cpython-312.pyc,, +torch/nn/utils/_expanded_weights/__pycache__/conv_utils.cpython-312.pyc,, +torch/nn/utils/_expanded_weights/__pycache__/embedding_expanded_weights.cpython-312.pyc,, +torch/nn/utils/_expanded_weights/__pycache__/expanded_weights_impl.cpython-312.pyc,, +torch/nn/utils/_expanded_weights/__pycache__/expanded_weights_utils.cpython-312.pyc,, +torch/nn/utils/_expanded_weights/__pycache__/group_norm_expanded_weights.cpython-312.pyc,, +torch/nn/utils/_expanded_weights/__pycache__/instance_norm_expanded_weights.cpython-312.pyc,, +torch/nn/utils/_expanded_weights/__pycache__/layer_norm_expanded_weights.cpython-312.pyc,, +torch/nn/utils/_expanded_weights/__pycache__/linear_expanded_weights.cpython-312.pyc,, +torch/nn/utils/_expanded_weights/conv_expanded_weights.py,sha256=LxvcYi0AA8Xnab3rGO6x_Qzs77Jp0Es2n2VZzHPzK64,3007 +torch/nn/utils/_expanded_weights/conv_utils.py,sha256=8ohviTXuweZoCEpi-k1Ueu6JvBZyrmVEKZmFcScvzWo,11110 +torch/nn/utils/_expanded_weights/embedding_expanded_weights.py,sha256=Ry7uGNYnIh6qZ19j2jV7zfX1KDCKWSyHDbcKyGJzLLM,3161 +torch/nn/utils/_expanded_weights/expanded_weights_impl.py,sha256=42TQlWzGR-ktp9pcHgzgfCTFuXpvOL4qFrb44V39S4I,6596 +torch/nn/utils/_expanded_weights/expanded_weights_utils.py,sha256=gH3UTjNM52Ob85D09wkm5hTT1jloCWsT-n1krcUuXBU,7799 +torch/nn/utils/_expanded_weights/group_norm_expanded_weights.py,sha256=qCBigIE0vgZ1ME6xHy3PaLgss6m232h8IILejTKu5Qo,3683 +torch/nn/utils/_expanded_weights/instance_norm_expanded_weights.py,sha256=U2brlPHuiffhW0orB_UykJmtQAYWECS8kwPHI_fPHLE,3873 +torch/nn/utils/_expanded_weights/layer_norm_expanded_weights.py,sha256=wAFyNjvNFi3MA9K37N1rVDzOsXT2VV2LTlYyhghmN9c,3377 +torch/nn/utils/_expanded_weights/linear_expanded_weights.py,sha256=S5rQS-wfrXtU2LNYBHO2BGQeThI5INoiwhwQjrekJdI,2322 +torch/nn/utils/_named_member_accessor.py,sha256=sTs1tIrueBqdh_ykok3oHKyEcvVmLVD7q8jDpPY15VI,14583 +torch/nn/utils/_per_sample_grad.py,sha256=UaXBpMK9m5uTrti9mEsmvi6L_-Xm181NUG8X7KWp808,5901 +torch/nn/utils/clip_grad.py,sha256=MTEl6kfrIFH_W4HT05H4-Boa3fnH0bLBt0ifE2ES6N4,11779 +torch/nn/utils/convert_parameters.py,sha256=ECN-_RAF5lhhslLa56u84YA0jSleDS979wfDA58GdxM,3303 +torch/nn/utils/fusion.py,sha256=-83z21e6AQt274kF-SRgAryTy2mfSTZrq69JimdKsWA,6624 +torch/nn/utils/init.py,sha256=IDz4UrKDFlvKbHJVDVPblAuLZll9uQOaj-_NtZFiLok,2305 +torch/nn/utils/memory_format.py,sha256=5PslPLnexfUmUlXN2BQjl448HjWOeDGhNkoiS7lWwJY,8448 +torch/nn/utils/parametrizations.py,sha256=2R_-NpXSIEERe4FeIdZAV3QU54-WZ1Q4-8g3e_RQ4_M,26406 +torch/nn/utils/parametrize.py,sha256=ImsftxJr_BJEXwq_lrBa_eoGMm6Wgl93xui25Gcbgs8,37694 +torch/nn/utils/prune.py,sha256=KrFjkeI6VT4UboRgEQSYeHrS4oaGZyd1UTO0xshrzso,59782 +torch/nn/utils/rnn.py,sha256=Ip7HWhgk4oIqixITYN8rSeazWRUu2nOplyqBkk6k9i8,24015 +torch/nn/utils/spectral_norm.py,sha256=rIyU0TpP6eIAL1M0u6Fx51tuU_Fw7c0-tb0oPEXxbRI,15304 +torch/nn/utils/stateless.py,sha256=WVajZnvWUTCh101wsl_TXBHaUgRPQrypwOR9kcHqiJ0,11847 +torch/nn/utils/weight_norm.py,sha256=-CqR4Ej1AUeD9Lnz8K-FpvLFEzc-nWqv_7gRNby3baU,6047 +torch/numa/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/numa/__pycache__/__init__.cpython-312.pyc,, +torch/numa/__pycache__/binding.cpython-312.pyc,, +torch/numa/binding.py,sha256=0Gr7A4nuqzAE9zk54a638T2O00LbSDMeTlmlPoGLqhU,22943 +torch/onnx/__init__.py,sha256=2IB94W6NJIAYf7ro616sH00XXXAoKJfZ7ExQAd_7aIM,15860 +torch/onnx/__pycache__/__init__.cpython-312.pyc,, +torch/onnx/__pycache__/_constants.cpython-312.pyc,, +torch/onnx/__pycache__/_flags.cpython-312.pyc,, +torch/onnx/__pycache__/errors.cpython-312.pyc,, +torch/onnx/__pycache__/operators.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_helper.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset10.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset11.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset12.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset13.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset14.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset15.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset16.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset17.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset18.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset19.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset20.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset7.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset8.cpython-312.pyc,, +torch/onnx/__pycache__/symbolic_opset9.cpython-312.pyc,, +torch/onnx/__pycache__/testing.cpython-312.pyc,, +torch/onnx/__pycache__/utils.cpython-312.pyc,, +torch/onnx/__pycache__/verification.cpython-312.pyc,, +torch/onnx/_constants.py,sha256=KpWV-yoI5fV7mRxzkrc4I01BaICLJGOsksq3F8wiFt4,555 +torch/onnx/_flags.py,sha256=RpHdSBeSVnGVV6j52A75h4AHw3wZR01NG1UvUPlCxbw,1609 +torch/onnx/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/onnx/_internal/__pycache__/__init__.cpython-312.pyc,, +torch/onnx/_internal/__pycache__/_lazy_import.cpython-312.pyc,, +torch/onnx/_internal/_lazy_import.py,sha256=PKbUp3BqM_gOqRPQby3FVZLaP8-4HtlfVbF3AEhP8W8,1287 +torch/onnx/_internal/exporter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/onnx/_internal/exporter/__pycache__/__init__.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_analysis.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_building.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_capture_strategies.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_compat.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_constants.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_core.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_decomp.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_dispatching.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_dynamic_shapes.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_errors.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_flags.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_fx_passes.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_ir_passes.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_isolated.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_onnx_program.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_registration.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_reporting.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_schemas.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_tensors.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_testing.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_type_casting.cpython-312.pyc,, +torch/onnx/_internal/exporter/__pycache__/_verification.cpython-312.pyc,, +torch/onnx/_internal/exporter/_analysis.py,sha256=k9oE4NONAoxfhQOGVBND2MRAMRfLFWNPQ429Zl6nZy4,10344 +torch/onnx/_internal/exporter/_building.py,sha256=53aLGZi8QaSGObrxTUTAxhYml0kA3bpkdw0B2g4eDwE,30116 +torch/onnx/_internal/exporter/_capture_strategies.py,sha256=xPRF4Nl3bd0ybrybW7FCLQGffAnp5QBP1dgKkJFx5TE,10882 +torch/onnx/_internal/exporter/_compat.py,sha256=OGX17OdwWlFDkBJFD3_VKfxhYBduWkI0oiLLzIIsPUE,9776 +torch/onnx/_internal/exporter/_constants.py,sha256=I6tb-H1ESOnnkAkPvemWkejHs0NF_CEFz47Cs67Tcso,385 +torch/onnx/_internal/exporter/_core.py,sha256=qQCYLvMv4uIkBKevU79FQLkDeRFNN6Hjr2DHUu22XnQ,70465 +torch/onnx/_internal/exporter/_decomp.py,sha256=3DiKYUn7qhxHY_HeOKwhSKKavV3tygQJjfddkOxO32k,2945 +torch/onnx/_internal/exporter/_dispatching.py,sha256=yzSDFuKW5NqAmFtkdHFLLFmBAhRXqQhK96X59h0xKXw,15137 +torch/onnx/_internal/exporter/_dynamic_shapes.py,sha256=E7E-OFanqv1nEHV-cFnb-dBkr0uf6-L4mBpm51HpsQo,14780 +torch/onnx/_internal/exporter/_errors.py,sha256=tOTcRIR3plnuELRHQYP5jA48Cb7r5IF_Ynp5EZotxJQ,556 +torch/onnx/_internal/exporter/_flags.py,sha256=XUfVM4RZPyPJDtPG5WJuX0G_If0mivuZo2zOs7uok78,826 +torch/onnx/_internal/exporter/_fx_passes.py,sha256=xrZc6Vevwg1nHJPV-sUN3GV44wVNg99BJTid-fHKDig,1885 +torch/onnx/_internal/exporter/_ir_passes.py,sha256=4wI__soHZ3ILaRtrrdqxY9moKx_h16zlCnULsEEEROM,5067 +torch/onnx/_internal/exporter/_isolated.py,sha256=Qi0BZy0A3sb0USIDDUDEeZ-JE2iAHx72e505Tf6YqFg,1994 +torch/onnx/_internal/exporter/_onnx_program.py,sha256=xgyz0RI4aDXplu37pYgrtqs3aOuZd2X9uOkPienuhVc,19060 +torch/onnx/_internal/exporter/_registration.py,sha256=cF-WrjsdOGHXra7RzejsCgmCzwqPC1CmQAs1VnxAJeM,12937 +torch/onnx/_internal/exporter/_reporting.py,sha256=7gDxrH0ZhoV76mnmrjWj_SCIGd88iIFYC-xqhvVC8ys,7591 +torch/onnx/_internal/exporter/_schemas.py,sha256=54kwwb2VzSUo_XjSufR4qyidCykrWqi6sJaIdqAKCq0,21291 +torch/onnx/_internal/exporter/_tensors.py,sha256=ytbesD_9tsUJL0ZJloWnqWyuOZOmZTmgBumqpiL7UFw,2711 +torch/onnx/_internal/exporter/_testing.py,sha256=WsDkpXAfmoUCF_voc8OK5bBbWh-L4hL0GPjS2OSb6HE,4095 +torch/onnx/_internal/exporter/_torchlib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/onnx/_internal/exporter/_torchlib/__pycache__/__init__.cpython-312.pyc,, +torch/onnx/_internal/exporter/_torchlib/__pycache__/_tensor_typing.cpython-312.pyc,, +torch/onnx/_internal/exporter/_torchlib/__pycache__/_torchlib_registry.cpython-312.pyc,, +torch/onnx/_internal/exporter/_torchlib/_tensor_typing.py,sha256=6Z3Xk4ylaPbk84orAKJ6CHY_YTflzsYF_phFUMwyOaM,1866 +torch/onnx/_internal/exporter/_torchlib/_torchlib_registry.py,sha256=JXa2RdDsq5sGcDxBjEYfu0LC0HLHslNHl6EQqCs0yNU,2923 +torch/onnx/_internal/exporter/_torchlib/ops/__init__.py,sha256=vpeNP_4-RXUtQZ8xOUn5d8ULRmK8D1NbtzemMzdZ8_s,186 +torch/onnx/_internal/exporter/_torchlib/ops/__pycache__/__init__.cpython-312.pyc,, +torch/onnx/_internal/exporter/_torchlib/ops/__pycache__/core.cpython-312.pyc,, +torch/onnx/_internal/exporter/_torchlib/ops/__pycache__/hop.cpython-312.pyc,, +torch/onnx/_internal/exporter/_torchlib/ops/__pycache__/nn.cpython-312.pyc,, +torch/onnx/_internal/exporter/_torchlib/ops/__pycache__/symbolic.cpython-312.pyc,, +torch/onnx/_internal/exporter/_torchlib/ops/__pycache__/symops.cpython-312.pyc,, +torch/onnx/_internal/exporter/_torchlib/ops/core.py,sha256=-m54O55HayxcrWCRdifxFEQcMqf_TcVN-RyIJabf5fM,1615 +torch/onnx/_internal/exporter/_torchlib/ops/hop.py,sha256=8kS7MlXLbjS8NcqJ2EKcslwae2Uz0xSAid0nLjqMMio,5466 +torch/onnx/_internal/exporter/_torchlib/ops/nn.py,sha256=jMIJlPvKYEnt6fT5cR-aWh5JLQeB0QMuChLHBwLq0qc,14318 +torch/onnx/_internal/exporter/_torchlib/ops/symbolic.py,sha256=ihJ2Jm7eJ9aQdM3bH0rMDr-5WIPbRNlfLEwvdRh1i_0,4871 +torch/onnx/_internal/exporter/_torchlib/ops/symops.py,sha256=MjtWEgNEvGOr1wu8NN-xU4UiZF4nbJNDbXDKQ-PzKZc,1214 +torch/onnx/_internal/exporter/_type_casting.py,sha256=xGjq4effVt7qIsoxywnPI1LnmLBGTFyEIzYtlINpM-g,1193 +torch/onnx/_internal/exporter/_verification.py,sha256=mtKdaRQxXiuzgaBihLicerxltDuD9viw6DM4CTcoMsQ,12847 +torch/onnx/_internal/fx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/onnx/_internal/fx/__pycache__/__init__.cpython-312.pyc,, +torch/onnx/_internal/fx/__pycache__/_pass.cpython-312.pyc,, +torch/onnx/_internal/fx/__pycache__/type_utils.cpython-312.pyc,, +torch/onnx/_internal/fx/_pass.py,sha256=daXHrO2O60oCq36-fm-QS6QKpnKLHKwD-rdrBJFeZxY,8875 +torch/onnx/_internal/fx/passes/__init__.py,sha256=J2F632xEVBcpDuXwnacOq8H-aEFs4d2TNNbgfA2UKQM,97 +torch/onnx/_internal/fx/passes/__pycache__/__init__.cpython-312.pyc,, +torch/onnx/_internal/fx/passes/__pycache__/type_promotion.cpython-312.pyc,, +torch/onnx/_internal/fx/passes/type_promotion.py,sha256=SPfMIgLrUaCK0cIza2kS9imcBUeDyw_7TRPhPRi_9l0,66398 +torch/onnx/_internal/fx/type_utils.py,sha256=dzCWfZgPe8iEcTyLHBi1q1-fnI9Eznqq_WyqHrFDZpQ,6014 +torch/onnx/_internal/torchscript_exporter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/onnx/_internal/torchscript_exporter/__pycache__/__init__.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/_experimental.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/_globals.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/_type_utils.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/jit_utils.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/onnx_proto_utils.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/registration.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_helper.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset10.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset11.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset12.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset13.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset14.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset15.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset16.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset17.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset18.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset19.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset20.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset7.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset8.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/symbolic_opset9.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/utils.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/__pycache__/verification.cpython-312.pyc,, +torch/onnx/_internal/torchscript_exporter/_experimental.py,sha256=Mz3VWbroPljcVY3On61zd1TRA50-LD8AMj_XKzpfwT8,1061 +torch/onnx/_internal/torchscript_exporter/_globals.py,sha256=YSVCm6ZQ5tEiA3pr-JJJvnIkjd1dn9YscsssS1VdWaY,2882 +torch/onnx/_internal/torchscript_exporter/_type_utils.py,sha256=MmmVNIhiWoqe72rSIupdGiwmH_5fm9V94O5LTU4MR-c,14372 +torch/onnx/_internal/torchscript_exporter/jit_utils.py,sha256=-DiM7-HHZhqhQ95zLRk88qkoSmK_2jgjONiSr9isI_0,14356 +torch/onnx/_internal/torchscript_exporter/onnx_proto_utils.py,sha256=AkXzN6UBd1qP7aKOzzec-B4ZT-dlzTkASjO-9LJmUuQ,9445 +torch/onnx/_internal/torchscript_exporter/registration.py,sha256=q5S-ubfSnWmJPUkU-MSY5pTAfK_8grVN1u21HwzXMRc,11519 +torch/onnx/_internal/torchscript_exporter/symbolic_helper.py,sha256=QZDMVuZZHu5AKGMsP-g_8SwJh9alxk55ym1eQbwGJ_g,88273 +torch/onnx/_internal/torchscript_exporter/symbolic_opset10.py,sha256=q-DfE9h4yzBW-TQoLS-f4Zz3zdvZUil6ykmUiVG8dQ4,38825 +torch/onnx/_internal/torchscript_exporter/symbolic_opset11.py,sha256=WQaGK73K6TkDHWzqO0dm6n-vhxvrAUj_Xject5PRaio,55070 +torch/onnx/_internal/torchscript_exporter/symbolic_opset12.py,sha256=2HP8Acf_ps1a9ycqyg-LSRgiYV3E2jOErHdBoztrWrU,16224 +torch/onnx/_internal/torchscript_exporter/symbolic_opset13.py,sha256=foTDxaMy52wuGGRQsbnv3lopkhfl6q_FSGSybHDnUho,42568 +torch/onnx/_internal/torchscript_exporter/symbolic_opset14.py,sha256=z8v6bpa8Sg2ptngJUgbI5-1rNfuJwkz2htCL9lDoEZA,10687 +torch/onnx/_internal/torchscript_exporter/symbolic_opset15.py,sha256=XkgE3s9qRc6DScwz0kXmCiOsjUbQZS7F6E72E1-tmks,2976 +torch/onnx/_internal/torchscript_exporter/symbolic_opset16.py,sha256=PqXbLVXpk5tNtUGeo5RcN7CHzkHSzbfkXgEc1GIzglw,6647 +torch/onnx/_internal/torchscript_exporter/symbolic_opset17.py,sha256=eN3aBitiI1o1D6SezpEJiQsvB5niHLMuUDXI-ccpQIA,8485 +torch/onnx/_internal/torchscript_exporter/symbolic_opset18.py,sha256=9xmAoYfA8_5EZBBeZBqxkjP9J5sHCwGbFa12VPP3xwc,8478 +torch/onnx/_internal/torchscript_exporter/symbolic_opset19.py,sha256=jb9QOasxZxzfPOfINkOmOZQ-XDp_k4DLZAp6QbMCvPE,567 +torch/onnx/_internal/torchscript_exporter/symbolic_opset20.py,sha256=VbhDwg6URIYC72ugMCBi2nBzIDWKuinHfFs9Si6LvF8,2557 +torch/onnx/_internal/torchscript_exporter/symbolic_opset7.py,sha256=TXodm4kAZJnWroQ_r7j_B2fVoOdAFXr34T2N-mOI4m0,2265 +torch/onnx/_internal/torchscript_exporter/symbolic_opset8.py,sha256=R-C4_QABDQn5DIR9jKpDeD1dXNwrNmm4dxjCx0wk2q8,15551 +torch/onnx/_internal/torchscript_exporter/symbolic_opset9.py,sha256=ZIqMyj6l_D1cLxKfi4_AyBc7QaXhrki5mDWVDDxm4ng,230922 +torch/onnx/_internal/torchscript_exporter/utils.py,sha256=bfSKQmv4kThnyjcRHndOLyRrP73nBXy9qMjlFmMW2uE,78570 +torch/onnx/_internal/torchscript_exporter/verification.py,sha256=IGFbJBX0lSzBdH1zBeG1eXYCLs8Pj1bRlSR9oMcJ1hc,19669 +torch/onnx/errors.py,sha256=BUve1FpwqN3JgwdfcosWdMz2t_IKSjk-4IqUJBBhFPI,3579 +torch/onnx/operators.py,sha256=2tRd6BZ2IT8lhvFX20H5RGyKi-4GWhpnRvbkKwiJQtg,1232 +torch/onnx/ops/__init__.py,sha256=G2WfpP5g3uuB2-MasgffNiLt-k5KbvLD3F9PPgtHBWk,21406 +torch/onnx/ops/__pycache__/__init__.cpython-312.pyc,, +torch/onnx/ops/__pycache__/_dtype_mappings.cpython-312.pyc,, +torch/onnx/ops/__pycache__/_impl.cpython-312.pyc,, +torch/onnx/ops/__pycache__/_symbolic_impl.cpython-312.pyc,, +torch/onnx/ops/_dtype_mappings.py,sha256=-jODxXM2EjOTWemOG6JSmbE1q35Q2ZOhVosxrF1JgxY,863 +torch/onnx/ops/_impl.py,sha256=cFguBN0TdIczDyWNkB3hAKkNPDuaDfObiC9rCCQBqd8,20512 +torch/onnx/ops/_symbolic_impl.py,sha256=E99PxQYbAvovVMvNCQX1tQonWWmlxZFZAo-WA5BJO1Q,12084 +torch/onnx/symbolic_helper.py,sha256=CjxUUT6W9xoFu8uZ6mWh52wNf3f1avCuQc18FOjX_jw,230 +torch/onnx/symbolic_opset10.py,sha256=fGVLgzPdMM8hT-JdtaWk111DjoiBQt-Q3twlPAZCOZk,336 +torch/onnx/symbolic_opset11.py,sha256=ZjaGoMtWFv-ePKPb0mX_aIjlUdgX8OXS-G_qwHziHes,232 +torch/onnx/symbolic_opset12.py,sha256=GuIq5XKhH-btq6T_ojUS1Zh7BGJI0F5p1K3elfd59-s,232 +torch/onnx/symbolic_opset13.py,sha256=sjTWJu7-g-XuTMmnfSNzXuZZFD1VdaPlsYeV6Tg7vv0,232 +torch/onnx/symbolic_opset14.py,sha256=QcfT-W4phe7-xZAAkV6TmLZs8q-09aa4DED8hZgaDc8,232 +torch/onnx/symbolic_opset15.py,sha256=2qpFNxvxg-xxMovji6eRQN_idKehHFnWv39jwnraaVA,232 +torch/onnx/symbolic_opset16.py,sha256=UJDfT5FvMnNg_XtD3P7nftTJfzUbdTJKqIHEF2jf7RI,232 +torch/onnx/symbolic_opset17.py,sha256=qOZo8FjqMPg-XZyFuXhrkznHJZYRt_wRMvFEqbYw0AM,232 +torch/onnx/symbolic_opset18.py,sha256=tSL1xHDKZvzeQJ4kZ3kYzOpEAA6-dJQwfdHg-ImshKY,232 +torch/onnx/symbolic_opset19.py,sha256=Kv1THHMS8EbdtfXobatIhdS2yN-doY65efWGm_NUORU,232 +torch/onnx/symbolic_opset20.py,sha256=sCoAzQq9k_8wSO588Q2jOiJe1fZuVdnOJL_y-48wPt4,232 +torch/onnx/symbolic_opset7.py,sha256=baIzQfpJgxZBQT3xSFjNL0dO9cY6VmKC4rMM7zozE-4,230 +torch/onnx/symbolic_opset8.py,sha256=3lGkzLyBbfhIIICujaFAPqx4aryfA3UjrdvoHFmRZ0g,230 +torch/onnx/symbolic_opset9.py,sha256=6no9XBiilrjoucSjV-kIroxVOrL8BHWWJm8rEc2PQyU,405 +torch/onnx/testing.py,sha256=Rfk7iRsqBRDNg1HlVSJkGaWJzNEAROod-hx49R5LYIk,227 +torch/onnx/utils.py,sha256=i-fUlQn9TQeI7yeCiUF_9X0vPg67kOqVHNokzCCGfkI,242 +torch/onnx/verification.py,sha256=BE5ZEnSZT22vEgDMnAqgLQSlq9vZMBLolW80idfw0zY,355 +torch/optim/__init__.py,sha256=t8c4gCyCnlzEeu6lc-DBMm9fzVxsZy9KKoV7NdP5L6Y,2271 +torch/optim/__pycache__/__init__.cpython-312.pyc,, +torch/optim/__pycache__/_adafactor.cpython-312.pyc,, +torch/optim/__pycache__/_functional.cpython-312.pyc,, +torch/optim/__pycache__/_muon.cpython-312.pyc,, +torch/optim/__pycache__/adadelta.cpython-312.pyc,, +torch/optim/__pycache__/adagrad.cpython-312.pyc,, +torch/optim/__pycache__/adam.cpython-312.pyc,, +torch/optim/__pycache__/adamax.cpython-312.pyc,, +torch/optim/__pycache__/adamw.cpython-312.pyc,, +torch/optim/__pycache__/asgd.cpython-312.pyc,, +torch/optim/__pycache__/lbfgs.cpython-312.pyc,, +torch/optim/__pycache__/lr_scheduler.cpython-312.pyc,, +torch/optim/__pycache__/nadam.cpython-312.pyc,, +torch/optim/__pycache__/optimizer.cpython-312.pyc,, +torch/optim/__pycache__/radam.cpython-312.pyc,, +torch/optim/__pycache__/rmsprop.cpython-312.pyc,, +torch/optim/__pycache__/rprop.cpython-312.pyc,, +torch/optim/__pycache__/sgd.cpython-312.pyc,, +torch/optim/__pycache__/sparse_adam.cpython-312.pyc,, +torch/optim/__pycache__/swa_utils.cpython-312.pyc,, +torch/optim/_adafactor.py,sha256=fES_YpBbgW9KY8cy5Gr2MHJ-fuQ12Z9rdojhq79l4NA,29166 +torch/optim/_functional.py,sha256=rPL-M3Vx-zmKIpvqTDgl9e1vUpLI--7DOkXab0Nm2uw,3334 +torch/optim/_multi_tensor/__init__.py,sha256=6y-n0BgYdlswhRZT21udJceLNtcoR2_gzyc7fDkTCdg,1100 +torch/optim/_multi_tensor/__init__.pyi,sha256=X8HBdb-Ka3ICBb5zpGJPT68rp59dOYJF8KXahMT6TAs,552 +torch/optim/_multi_tensor/__pycache__/__init__.cpython-312.pyc,, +torch/optim/_muon.py,sha256=bOE8B0LtKJXY-KGAvo32xCAa-oxiieuRpEi7-606yxE,13979 +torch/optim/adadelta.py,sha256=iFR_7GJHYNPtGKtaJ_4AsUOm0dMbzIvnOvsjHWgrXOg,17317 +torch/optim/adagrad.py,sha256=Z0UtTAS9M2QVBMUCHElmdLfAg9-XQSU3Iku1hIvl050,21681 +torch/optim/adam.py,sha256=7sOS8bQ3Z_a64gJXDktoylXuD52OfIMAxppjKOvFjYY,41132 +torch/optim/adamax.py,sha256=2CrhVSFqjPLns_g6Gso5QLb9Vefl632Gpw74THEqg8M,17965 +torch/optim/adamw.py,sha256=tUFk2nCCHEfR5HU5B9N16yUnc70DSGO3gEqUP736g3o,7569 +torch/optim/asgd.py,sha256=ruC-I_qDfsf_wPsBc6dWSwdAY0jl53qGdKCEHZ_Nrvc,16974 +torch/optim/lbfgs.py,sha256=vOMvEcwpBzYQ1UIqKdVYZMuxXNKnyEeqX6u_GP-m7q0,20584 +torch/optim/lr_scheduler.py,sha256=zIGwYQfZqV5iPoYxFL_RBlA13U_6XUS2wzJBYAgZ8II,106218 +torch/optim/nadam.py,sha256=QLwfGIpgpG1v_4WUJkB5KetKAoAA4wn1_J0irhnLA7A,27387 +torch/optim/optimizer.py,sha256=IT0Y42ByUKBj533ml-kP_ABM_2SnX44HzSNL_LswVNE,52163 +torch/optim/radam.py,sha256=dMSukd70sXxnoD6StYd8wtm8dSeQ2eP523Itma3Gv3Q,25656 +torch/optim/rmsprop.py,sha256=bPjQveMBnvNfo3DCyJC3aZrh47RAhFDjYChu262kQ88,21125 +torch/optim/rprop.py,sha256=ZAcikw26CbTKZYYgtFgfrMHw7IysyC89YCEVhld2xTA,18160 +torch/optim/sgd.py,sha256=9GyvDMSIiEOMZvIvv3BCzfDEbe8ecXBf-qrrqgbo838,20899 +torch/optim/sparse_adam.py,sha256=yxydw3_kOE7SGHD03o9WjfOqLSFwhK4oEr5bzvqMO4k,8235 +torch/optim/swa_utils.py,sha256=rGpvwBJ-liBQ1tieF3A8IFvKLr6Sg3aTxmZNvruj4pg,22356 +torch/overrides.py,sha256=_mJMH5qYErJ-o1TI7NDONI7O-gwNGXH0g7MK0CxeEjs,107776 +torch/package/__init__.py,sha256=LV4HkPItiQkYGteUQapkAQLVBv5mYC1zTfYdHSXZxbg,400 +torch/package/__pycache__/__init__.cpython-312.pyc,, +torch/package/__pycache__/_digraph.cpython-312.pyc,, +torch/package/__pycache__/_directory_reader.cpython-312.pyc,, +torch/package/__pycache__/_importlib.cpython-312.pyc,, +torch/package/__pycache__/_mangling.cpython-312.pyc,, +torch/package/__pycache__/_mock.cpython-312.pyc,, +torch/package/__pycache__/_package_pickler.cpython-312.pyc,, +torch/package/__pycache__/_package_unpickler.cpython-312.pyc,, +torch/package/__pycache__/_stdlib.cpython-312.pyc,, +torch/package/__pycache__/file_structure_representation.cpython-312.pyc,, +torch/package/__pycache__/find_file_dependencies.cpython-312.pyc,, +torch/package/__pycache__/glob_group.cpython-312.pyc,, +torch/package/__pycache__/importer.cpython-312.pyc,, +torch/package/__pycache__/package_exporter.cpython-312.pyc,, +torch/package/__pycache__/package_importer.cpython-312.pyc,, +torch/package/_digraph.py,sha256=b1g-2YEbIamHIaMRbaLksJNZX-DbYreF8p0_4dsKFsQ,5803 +torch/package/_directory_reader.py,sha256=oqpFQhKRKbgVcfJMLI7P85eE-O07eOg4pTltXh07SrI,1981 +torch/package/_importlib.py,sha256=TFT6uwqOIDOXOYtxn0oKH69rVcvmEIVAw2Nm7SfQQK8,3093 +torch/package/_mangling.py,sha256=p3AxSPUyGphpVae1wryf6fOgBzADiy0oqZDwkXvHXuA,1957 +torch/package/_mock.py,sha256=dLBJ9n8wre0Zbb3olFgZLdRpzDMM9C65kGnybzk_4Ew,2989 +torch/package/_package_pickler.py,sha256=2VL9oL9Ufg3FXdcwWr0xAKW6Gdl_NesJD0yYnYfEy9o,5758 +torch/package/_package_unpickler.py,sha256=v7xjc2QM4L1xInVHrpbc21dvzQmhDs01TJC82l3Q0OU,1019 +torch/package/_stdlib.py,sha256=wMFy7r-1gJNdbRW5EX2xMACkRXNtmNat_dg8lvIHeSk,612 +torch/package/analyze/__init__.py,sha256=MSt9jByAbADeUqxkp02TPZX9Zs0VAECwSv4fx0IvBII,132 +torch/package/analyze/__pycache__/__init__.cpython-312.pyc,, +torch/package/analyze/__pycache__/find_first_use_of_broken_modules.cpython-312.pyc,, +torch/package/analyze/__pycache__/is_from_package.cpython-312.pyc,, +torch/package/analyze/__pycache__/trace_dependencies.cpython-312.pyc,, +torch/package/analyze/find_first_use_of_broken_modules.py,sha256=_hctT_gJgARx28bKpOhBef0DsfPX3Airb2ZFTIkMC6A,1065 +torch/package/analyze/is_from_package.py,sha256=GKtxiwtL71DFTwYimp2l_Ru4AgxvT_OI4F2_x61rv0s,420 +torch/package/analyze/trace_dependencies.py,sha256=aZrPL4JnDcSSwL2DfWOW0ewUmd9ryrJgosGWy9liErg,2300 +torch/package/file_structure_representation.py,sha256=yAnxPh8endVL1V0ZmpfZ_XIzeVhm5xSLJyx8yUIpd5Y,4883 +torch/package/find_file_dependencies.py,sha256=viD4j2tinNsvK_NV0Yp4zSj2puRWaNeu8fwiy_LdT78,4043 +torch/package/glob_group.py,sha256=hkEjc60_fFAoEGg_M2_tUk_wrmqh5tUlYY2u5hjSf2s,3750 +torch/package/importer.py,sha256=C0yiUDnMF5SxXhAKp9mg0lqkW3EawRR_XlBUcwmihdc,10506 +torch/package/package_exporter.py,sha256=7JuHIAquGpUFPDLnZVJuU0IZkn60DN0ZL5eQeV3SmF4,52056 +torch/package/package_importer.py,sha256=ukwVVMS9VNeR3c5S2LkAsCpCq9tI5uIrtIJaQBglJfU,32477 +torch/profiler/__init__.py,sha256=H6wvwaHRKfRLX4Q6Gp2kRWIXm_LYCrk5kXMEenKF57c,1786 +torch/profiler/__pycache__/__init__.cpython-312.pyc,, +torch/profiler/__pycache__/_memory_profiler.cpython-312.pyc,, +torch/profiler/__pycache__/_pattern_matcher.cpython-312.pyc,, +torch/profiler/__pycache__/_utils.cpython-312.pyc,, +torch/profiler/__pycache__/itt.cpython-312.pyc,, +torch/profiler/__pycache__/profiler.cpython-312.pyc,, +torch/profiler/__pycache__/python_tracer.cpython-312.pyc,, +torch/profiler/_memory_profiler.py,sha256=It47B5CQe5AFOvgp6_G_8Lat0nRawDgex954gS7ay0c,49649 +torch/profiler/_pattern_matcher.py,sha256=QSRtMyGzjPKFtbmlwZXfCBYYQDh9LU-Ydzj9bOK10YQ,25648 +torch/profiler/_utils.py,sha256=WzTZGKvcYJHsTv9GcbOWpaavUwyi5vGPeTvUtz3YfhE,22265 +torch/profiler/itt.py,sha256=u6ttBX6m4ym_0F407tZB51Nt_wN1em5Kd9rcdmQqh2M,1911 +torch/profiler/profiler.py,sha256=VDQwsumyTfd3-GQVhl_uJQs140RKgJILzKDoiJuReVY,48923 +torch/profiler/python_tracer.py,sha256=aDA0xiGsxbxr2JQ1m04WgIopUU2qCO1saJR-l18Yrrw,495 +torch/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/quantization/__init__.py,sha256=QfStNsp4EIUCQPnoGEX2-C6F8nkWjGwdZKUiSxwu5Us,2740 +torch/quantization/__pycache__/__init__.cpython-312.pyc,, +torch/quantization/__pycache__/_numeric_suite.cpython-312.pyc,, +torch/quantization/__pycache__/_numeric_suite_fx.cpython-312.pyc,, +torch/quantization/__pycache__/_quantized_conversions.cpython-312.pyc,, +torch/quantization/__pycache__/fake_quantize.cpython-312.pyc,, +torch/quantization/__pycache__/fuse_modules.cpython-312.pyc,, +torch/quantization/__pycache__/fuser_method_mappings.cpython-312.pyc,, +torch/quantization/__pycache__/observer.cpython-312.pyc,, +torch/quantization/__pycache__/qconfig.cpython-312.pyc,, +torch/quantization/__pycache__/quant_type.cpython-312.pyc,, +torch/quantization/__pycache__/quantization_mappings.cpython-312.pyc,, +torch/quantization/__pycache__/quantize.cpython-312.pyc,, +torch/quantization/__pycache__/quantize_fx.cpython-312.pyc,, +torch/quantization/__pycache__/quantize_jit.cpython-312.pyc,, +torch/quantization/__pycache__/stubs.cpython-312.pyc,, +torch/quantization/__pycache__/utils.cpython-312.pyc,, +torch/quantization/_numeric_suite.py,sha256=Apsbav_2_HtzAG7591KPYCABK3u-2ems0f91ckZYvqM,807 +torch/quantization/_numeric_suite_fx.py,sha256=WTMnaKmkQAsB6IgE3Eajh-x8fhXufgjjTa1fFpTZIs0,778 +torch/quantization/_quantized_conversions.py,sha256=w10wiLJKr9WF5W8JkZdLtyZ6E3S_tOaGH4TD5Ae_uQs,4492 +torch/quantization/fake_quantize.py,sha256=Ug5k6GxDURxlTHuKstQdkh-zEVDUmeJ4PNvCkat3-rw,1047 +torch/quantization/fuse_modules.py,sha256=Zc_rz6dKEugZhl8E7JfCM21_BaXcwNzw0RvmqJGw7gU,754 +torch/quantization/fuser_method_mappings.py,sha256=LJ2QGwDwhlDrpvpliVDDuYvShCuSFBQSd6z5sP5xYXA,528 +torch/quantization/fx/__init__.py,sha256=qBBzAdCsV8Jp2yNtquj0C6jkrGaNx3Qc2PsyLdXh330,609 +torch/quantization/fx/__pycache__/__init__.cpython-312.pyc,, +torch/quantization/fx/__pycache__/_equalize.cpython-312.pyc,, +torch/quantization/fx/__pycache__/convert.cpython-312.pyc,, +torch/quantization/fx/__pycache__/fuse.cpython-312.pyc,, +torch/quantization/fx/__pycache__/fusion_patterns.cpython-312.pyc,, +torch/quantization/fx/__pycache__/graph_module.cpython-312.pyc,, +torch/quantization/fx/__pycache__/match_utils.cpython-312.pyc,, +torch/quantization/fx/__pycache__/pattern_utils.cpython-312.pyc,, +torch/quantization/fx/__pycache__/prepare.cpython-312.pyc,, +torch/quantization/fx/__pycache__/quantization_patterns.cpython-312.pyc,, +torch/quantization/fx/__pycache__/quantization_types.cpython-312.pyc,, +torch/quantization/fx/__pycache__/utils.cpython-312.pyc,, +torch/quantization/fx/_equalize.py,sha256=hiGuVhIZgvnZ_qqEQwrPwPjGd5ntclc6wRWN3Z3M5Ls,1290 +torch/quantization/fx/convert.py,sha256=GqP8UVIoM6QDGNDS9GUXYNgJ1DQvSX64tCq5Rm2NvFI,397 +torch/quantization/fx/fuse.py,sha256=u1pov-wN8v78bZRZLnJ0v07gbbagCbF_MkuMC6Aw7_4,391 +torch/quantization/fx/fusion_patterns.py,sha256=mco9-e_PGyJdDrzI9ousYYUdSu6comqTDdybAXKmYPo,426 +torch/quantization/fx/graph_module.py,sha256=inj0SbCXp-6MgWPOsFd8eCmEMTKaymGau0KUK-4CJ0I,592 +torch/quantization/fx/match_utils.py,sha256=3oebRGQIxKdn4h6FrQ0qAN3qZIs-GM9n2yWqnUr4EuM,472 +torch/quantization/fx/pattern_utils.py,sha256=G3LrQi3v7nbKw_XCMrvRl1MZbdF-JCKPGyS0JIi8IXA,1335 +torch/quantization/fx/prepare.py,sha256=jX1lqPmTm9VUchj_pqhKaE0N441r3LQo3OSIRaXyghI,397 +torch/quantization/fx/quantization_patterns.py,sha256=TC9n0oBWbVWWB83poGGrM69xgBTKOdNf37CEZ6yz5C4,2137 +torch/quantization/fx/quantization_types.py,sha256=SCF33bdVJwrN_eiRJF-1O8YT7-Syxxa2mXabFc9q5Tw,406 +torch/quantization/fx/utils.py,sha256=E0e8e4ZVE5zki37Pc8GgFTWedhgzN4OiQaZRpZnU-RE,745 +torch/quantization/observer.py,sha256=gqp99m0qXIFrQKKR_d_kDFrXYmP_7N22Gklu6PMg9iI,1116 +torch/quantization/qconfig.py,sha256=8WVS-vOFoQqFnSGRJnJqMz5QjlWsNf1oIdFSPhau6ag,975 +torch/quantization/quant_type.py,sha256=iAwgxvRTAWOq6UWwWOInYIlfoyqAKrsirv_eefd7dCE,409 +torch/quantization/quantization_mappings.py,sha256=zh87HY3-SlpK698anoG70TVZFvGAktmZ3J1UFYvt-Tw,1178 +torch/quantization/quantize.py,sha256=_2bxz1Nxy2R3jer569e0OWCAvOJDOBRNg_WLkOB4HCs,834 +torch/quantization/quantize_fx.py,sha256=VFgy22MuCnZgzzSEvgo361E6rQXpWAGyb8HxzrjOHt8,762 +torch/quantization/quantize_jit.py,sha256=4-N7zY1HEFSfBbxNiz43hYlZVbWxekcWSLo7Y1y94dA,740 +torch/quantization/stubs.py,sha256=3fCztwAMksJYzQbZlBvS_v3u4-QJ7jKdGIJUkCcHT-0,402 +torch/quantization/utils.py,sha256=TFeb5f6X76T6oNKThjsiS3TpFXRoJgTdiO4MNdaEDTc,862 +torch/quasirandom.py,sha256=CfuHOmNDXiRqA6sPy2hk4mhEdgl0ZIOamYy_pJ89ROM,8121 +torch/random.py,sha256=gnebGBMG-uwDJT8X9uobxgu52RrIAvffw5SP2cayKDk,7506 +torch/return_types.py,sha256=ohmoEziZmcBXQrJr0_LLqaJIGQchUZEsI6miQPwUQBQ,1536 +torch/return_types.pyi,sha256=gJzMkb9SBctMhWoppxGbxeBO50Gj_wD824luxPu-YN8,18442 +torch/serialization.py,sha256=StEbrDrdS_17sPy94zcJmacI5Ap49BwqGjx5knFIvdo,87618 +torch/share/cmake/ATen/ATenConfig.cmake,sha256=CTO_ZzHAwndUCAoqNmZCTxJySMBqqgymTW_dgh8HFp4,311 +torch/share/cmake/Caffe2/Caffe2Config.cmake,sha256=W8adntTMifZ3u6oo6Skid9nLvTN3-cJRTvzuobj1ikA,5484 +torch/share/cmake/Caffe2/Caffe2Targets-release.cmake,sha256=6ZwGfNixo7A_I_Dlveg6ilsnWFqfYRBD0FVPuAecDR4,1815 +torch/share/cmake/Caffe2/Caffe2Targets.cmake,sha256=pq7phd5LsgajD2PbyKYjMMdHc2Xq0-lV8nMaLM-wjmM,7237 +torch/share/cmake/Caffe2/FindCUDAToolkit.cmake,sha256=aHbgBCQAUIPxcf02qlKwhM3Z0mzy47NvofDV_YA74Zg,39849 +torch/share/cmake/Caffe2/FindCUDSS.cmake,sha256=sA21H-knRZmCcnJmM87dUss3KpT-M2ykBfS_ukZz75s,2765 +torch/share/cmake/Caffe2/FindCUSPARSELT.cmake,sha256=_3gRzt3JhJLSoxGANz8olAJc1HYgZriCb5U-VuxAgeY,3135 +torch/share/cmake/Caffe2/FindSYCLToolkit.cmake,sha256=e1pywGagVTjZAGsGufTtJvxwvpbigzFYC-bawpQ5dik,4688 +torch/share/cmake/Caffe2/Modules_CUDA_fix/FindCUDA.cmake,sha256=CEq6QJrLuhwg-5EM59RXgXOr5lV7FHVbvYGCfM5XWIU,469 +torch/share/cmake/Caffe2/Modules_CUDA_fix/FindCUDNN.cmake,sha256=98AV65I9r6hXZ3djts25pWsUGSJij0uwaDLlNvr-OPw,3163 +torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/CMakeInitializeConfigs.cmake,sha256=pSX-UCD4EzIprk563tpH9yFmGH_ziG6NwUQt1GHhhos,1697 +torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA.cmake,sha256=3gzwXiAbjy-QcqRuVjH6bCbUEnqFey_Gj3-7arUQLZY,88607 +torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/make2cmake.cmake,sha256=p7tz2-DwvWVTxW082qsoMSXTwWlKk3AWw32drCNkjFk,4031 +torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/parse_cubin.cmake,sha256=T__r-AaXPXniuqi03AH2Pm4QNH_cQDJYQTHHCwBXHtg,3548 +torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake,sha256=41q0kdvB4N6yKC7Lt80TFblNjVs7i8SwuuN4ncDDQ28,12116 +torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake,sha256=dQIgteDkAMmVCEJNucZ31qJqMoSoY-bjEMkqBvAFTGQ,11881 +torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindPackageMessage.cmake,sha256=aggekwaBIweoGRvyGnWWSLFOfGhinyHgkP-AFdXlIME,1611 +torch/share/cmake/Caffe2/public/LoadHIP.cmake,sha256=ueynWnpAIJpF7XJ9es0nOAEppy5lKDviVLfUj9xrldM,10815 +torch/share/cmake/Caffe2/public/cuda.cmake,sha256=9t5_uvtr0O9XyRKcyw2b1o6161TcX6tjuPW7r8984sY,14687 +torch/share/cmake/Caffe2/public/gflags.cmake,sha256=lqCHXupLZgbofqyIO2MunBGYZB-1EJPUSx6QZoJxDIc,2703 +torch/share/cmake/Caffe2/public/glog.cmake,sha256=4rEgDMK1s552hsGVEjG6BwIETKu4y1wcwhGu_PPgYRo,2390 +torch/share/cmake/Caffe2/public/mkl.cmake,sha256=smEnmDMPnXJI24n7YQfuMgGpancHt8np3Fmwtn-sZAo,1357 +torch/share/cmake/Caffe2/public/mkldnn.cmake,sha256=9it-d7b1GLo7NomimCLT3kP3N0iZErkHhr4pU2pE-to,462 +torch/share/cmake/Caffe2/public/protobuf.cmake,sha256=HaapG099tgG6ti9wx5IxIEdm2nEcwz-cOO53xQ8b6ss,4095 +torch/share/cmake/Caffe2/public/utils.cmake,sha256=3ZAoFbweK5KofGU_8RQf0bMksU5-BZuKTZdvkMpOWyU,23386 +torch/share/cmake/Caffe2/public/xpu.cmake,sha256=oTD_1o7b1p8OiH87Dx7iy873ytHHyzHCWpY20YDJ_8s,1342 +torch/share/cmake/Torch/TorchConfig.cmake,sha256=J1sLMHbhKn0FT7WRVlMADpxiV3tWvNqEvlW7g5y7zyY,5339 +torch/share/cmake/Torch/TorchConfigVersion.cmake,sha256=tPC49870Kdbvd3630sNvsQJH4tkFLQx_3w6Bjfvgsug,378 +torch/signal/__init__.py,sha256=vsiLo7rYe0hiZTWzhpL90GTSQVh1rnENJp-aYdjb7nE,50 +torch/signal/__pycache__/__init__.cpython-312.pyc,, +torch/signal/windows/__init__.py,sha256=Hhn47ZK7d9faPk0ErykkdULI8qMtln9E-7s1leOIyp4,411 +torch/signal/windows/__pycache__/__init__.cpython-312.pyc,, +torch/signal/windows/__pycache__/windows.cpython-312.pyc,, +torch/signal/windows/windows.py,sha256=XsP5ea-Lr3NsdMoxh4qzrSVxnIoESSOhts4hC3cYqOQ,23603 +torch/sparse/__init__.py,sha256=T0UtMkqQWOKNgc2bGd62bB0qesIV4DZ20jxCnru-8rg,26538 +torch/sparse/__pycache__/__init__.cpython-312.pyc,, +torch/sparse/__pycache__/_semi_structured_conversions.cpython-312.pyc,, +torch/sparse/__pycache__/_semi_structured_ops.cpython-312.pyc,, +torch/sparse/__pycache__/_triton_ops.cpython-312.pyc,, +torch/sparse/__pycache__/_triton_ops_meta.cpython-312.pyc,, +torch/sparse/__pycache__/semi_structured.cpython-312.pyc,, +torch/sparse/_semi_structured_conversions.py,sha256=2FVfZ_Ry0T8cO4hXsqAQBCxw6gW2dZ13M8wc-zCXGMQ,14452 +torch/sparse/_semi_structured_ops.py,sha256=6-mmKvzDAha7nGR1NAU0ajLX9At_8EVdcPdhYnew_nU,6631 +torch/sparse/_triton_ops.py,sha256=CmX-Vfa6YSadRrKVS3lsjwLIlnWsrq5A3XwwJAN6tTg,90465 +torch/sparse/_triton_ops_meta.py,sha256=6zb8JRDtNhV-H2AGS_TVfrEiXwcwZTKi3dhcvMgSrVY,508984 +torch/sparse/semi_structured.py,sha256=FwBytQcvXnkS_Ez0-wv93Ex1YIkI66KjQnXTnOT13zk,29409 +torch/special/__init__.py,sha256=6p_ja0T1iGeRIZkUWuZ1GcN_85-imQhMQbJ0BFmHlgA,33494 +torch/special/__pycache__/__init__.cpython-312.pyc,, +torch/storage.py,sha256=ze5wi5kmN8MXLWsV5L0rzh8TYuP_yR5psS0ByysxRlM,53778 +torch/testing/__init__.py,sha256=xB_rYvUCZ8Z8DsCnxa5X8_6AvPCRWVxcZQ_OQzFVWyY,226 +torch/testing/__pycache__/__init__.cpython-312.pyc,, +torch/testing/__pycache__/_comparison.cpython-312.pyc,, +torch/testing/__pycache__/_creation.cpython-312.pyc,, +torch/testing/__pycache__/_utils.cpython-312.pyc,, +torch/testing/_comparison.py,sha256=RKhK9Ep-CL4JVyKhxP2V6iE95yW4a1WDalrLGRgb1uE,68191 +torch/testing/_creation.py,sha256=3nLo7R5k_BgVAC9m7u9k2xkbKxT7HRKnpH0-wZ716t8,12474 +torch/testing/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/testing/_internal/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/__pycache__/autocast_test_lists.cpython-312.pyc,, +torch/testing/_internal/__pycache__/autograd_function_db.cpython-312.pyc,, +torch/testing/_internal/__pycache__/check_kernel_launches.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_cuda.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_device_type.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_dist_composable.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_distributed.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_dtype.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_fsdp.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_jit.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_methods_invocations.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_mkldnn.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_modules.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_mps.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_nn.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_optimizers.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_pruning.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_quantization.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_quantized.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_subclass.cpython-312.pyc,, +torch/testing/_internal/__pycache__/common_utils.cpython-312.pyc,, +torch/testing/_internal/__pycache__/composite_compliance.cpython-312.pyc,, +torch/testing/_internal/__pycache__/custom_op_db.cpython-312.pyc,, +torch/testing/_internal/__pycache__/custom_tensor.cpython-312.pyc,, +torch/testing/_internal/__pycache__/dist_utils.cpython-312.pyc,, +torch/testing/_internal/__pycache__/dynamo_pytree_test_utils.cpython-312.pyc,, +torch/testing/_internal/__pycache__/dynamo_test_failures.cpython-312.pyc,, +torch/testing/_internal/__pycache__/fake_config_module.cpython-312.pyc,, +torch/testing/_internal/__pycache__/fake_config_module2.cpython-312.pyc,, +torch/testing/_internal/__pycache__/fake_config_module3.cpython-312.pyc,, +torch/testing/_internal/__pycache__/hop_db.cpython-312.pyc,, +torch/testing/_internal/__pycache__/hypothesis_utils.cpython-312.pyc,, +torch/testing/_internal/__pycache__/inductor_utils.cpython-312.pyc,, +torch/testing/_internal/__pycache__/jit_metaprogramming_utils.cpython-312.pyc,, +torch/testing/_internal/__pycache__/jit_utils.cpython-312.pyc,, +torch/testing/_internal/__pycache__/logging_tensor.cpython-312.pyc,, +torch/testing/_internal/__pycache__/logging_utils.cpython-312.pyc,, +torch/testing/_internal/__pycache__/quantization_torch_package_models.cpython-312.pyc,, +torch/testing/_internal/__pycache__/static_module.cpython-312.pyc,, +torch/testing/_internal/__pycache__/subclasses.cpython-312.pyc,, +torch/testing/_internal/__pycache__/torchbind_impls.cpython-312.pyc,, +torch/testing/_internal/__pycache__/triton_utils.cpython-312.pyc,, +torch/testing/_internal/__pycache__/two_tensor.cpython-312.pyc,, +torch/testing/_internal/autocast_test_lists.py,sha256=cZFTmOmK2J10BLqA8tqs_flK8HmEESvdCHCsa-i7k8k,28877 +torch/testing/_internal/autograd_function_db.py,sha256=cozNmhOxnJzCZ5Nju7IaPyLDRfzMB_HgEIOMuQdj4Nk,20246 +torch/testing/_internal/check_kernel_launches.py,sha256=xwVlNz0cv7YD6tL_fXZBtqB9uycjStvmSf9ObjBvkqM,6191 +torch/testing/_internal/codegen/__init__.py,sha256=DiaaC4wLY-kzeqPWCEVKCSzOa61Vli38kuG2Hd50x3c,23 +torch/testing/_internal/codegen/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/common_cuda.py,sha256=vbxNkYFGShJ-rOupSZ68oPF5l1v_nzXW-6WgEYc9t6s,17057 +torch/testing/_internal/common_device_type.py,sha256=qBLmgo5gZ-6W_E7hclJkSFUZtG7rnMMMUhikJ9VQzpU,76816 +torch/testing/_internal/common_dist_composable.py,sha256=kvK0gEZLUA1afQm0TBYUmp-xBIvLPcW0PgHo5m0WaoM,3689 +torch/testing/_internal/common_distributed.py,sha256=kTk62q1rI6GvG--RZULiDbJl1fduLnBTM-HkozPxCHU,72616 +torch/testing/_internal/common_dtype.py,sha256=lC47n-NFD-Erdr6PpFm_XJKFcjUxcKhnr5I1dXFwpe8,5333 +torch/testing/_internal/common_fsdp.py,sha256=PoBOYGNbSeN2XT4uMnkAz_U5cmXRHKERpPs8Az0inTY,61076 +torch/testing/_internal/common_jit.py,sha256=QAsshTHpEy0lNiglpxLEZZZKBOqlcyb2-28ViDoj0FY,16183 +torch/testing/_internal/common_methods_invocations.py,sha256=oUv-8fWspgiJThhZ13ivrDvwJM-cPXOUTc7QhOhDmLE,1243879 +torch/testing/_internal/common_mkldnn.py,sha256=5zINkXP_lx7hmfC7ttxt0P09VrbuPGhWElv7WsdgK-8,4012 +torch/testing/_internal/common_modules.py,sha256=s0abd0cYGgodsuHXKXZ7jZRu-BeQrgozb-w438JMAg8,214847 +torch/testing/_internal/common_mps.py,sha256=2YNYcHBFYCe2GZ9mwMhEIlzAUoTZjxNGL0Z9WEDzZl8,31320 +torch/testing/_internal/common_nn.py,sha256=500G7EUj_6BC4kGUUNsgRR7LFCvGJx_Cg3jk5g19rTg,176863 +torch/testing/_internal/common_optimizers.py,sha256=duZbykVS0Q-f0HgFfWSUxQG1fb1L9OVwMGoTtEtwvYQ,87891 +torch/testing/_internal/common_pruning.py,sha256=PE-FAOHFUB-0BUHf5GWU6xZe-X_bZaCsl0hT8phb-hU,14040 +torch/testing/_internal/common_quantization.py,sha256=TED8mfo-kk_H2nYSb73GPFSpR2jxqF6B0nKAYXbxy2w,119227 +torch/testing/_internal/common_quantized.py,sha256=lTl50g9E5Zv3CT47scS5MM8f7VdY7jWMAVC2OOPiYb4,25675 +torch/testing/_internal/common_subclass.py,sha256=b_ElEnaWDlb6GvJlg3uGoYlaL5v6bi57X4saqEdTjak,12429 +torch/testing/_internal/common_utils.py,sha256=PDwUs9GLxtLXuQ7-_5VF0-KMuQeItm2fM_u_LhpQgv4,249216 +torch/testing/_internal/composite_compliance.py,sha256=Ma08sHzF-yg-7x-wUgeBBJ1d1o3pfToEduBDox8xMFI,26707 +torch/testing/_internal/custom_op_db.py,sha256=FeY-PkrUDfjFsiZKZYt5visIK5Qq4QB_0w7Q3m0HRvc,20230 +torch/testing/_internal/custom_tensor.py,sha256=b4_oppw8d37WMAi8f3VuqA_2Q63Td_0ZWhcENmUGP7U,5439 +torch/testing/_internal/data/__init__.py,sha256=DiaaC4wLY-kzeqPWCEVKCSzOa61Vli38kuG2Hd50x3c,23 +torch/testing/_internal/data/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/data/__pycache__/network1.cpython-312.pyc,, +torch/testing/_internal/data/__pycache__/network2.cpython-312.pyc,, +torch/testing/_internal/data/network1.py,sha256=oui4qSVOL39z1DqyRW0Ua-rhpC1weEGhQTpZfy5dAKg,179 +torch/testing/_internal/data/network2.py,sha256=bDrLEHTqoZYGLSt_wXgE_CAW0H6dRB1Pqr3KBQqk1uw,210 +torch/testing/_internal/dist_utils.py,sha256=t40OBrDA79mDmyf_ke_AigsadOrL5e_adwqjf1LJfXw,7454 +torch/testing/_internal/distributed/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/testing/_internal/distributed/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/distributed/__pycache__/checkpoint_utils.cpython-312.pyc,, +torch/testing/_internal/distributed/__pycache__/common_state_dict.cpython-312.pyc,, +torch/testing/_internal/distributed/__pycache__/ddp_under_dist_autograd_test.cpython-312.pyc,, +torch/testing/_internal/distributed/__pycache__/distributed_test.cpython-312.pyc,, +torch/testing/_internal/distributed/__pycache__/distributed_utils.cpython-312.pyc,, +torch/testing/_internal/distributed/__pycache__/fake_pg.cpython-312.pyc,, +torch/testing/_internal/distributed/__pycache__/multi_threaded_pg.cpython-312.pyc,, +torch/testing/_internal/distributed/__pycache__/rpc_utils.cpython-312.pyc,, +torch/testing/_internal/distributed/_shard/__init__.py,sha256=EhTGyPtX-bzRNfqTY2Ql8gEScx4267U_pGa_h69kMZU,28 +torch/testing/_internal/distributed/_shard/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/distributed/_shard/__pycache__/test_common.cpython-312.pyc,, +torch/testing/_internal/distributed/_shard/sharded_tensor/__init__.py,sha256=rx8b8NcqLwjbfe7mZst5L22GKNP648RXOAEZAnYDFvk,3315 +torch/testing/_internal/distributed/_shard/sharded_tensor/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/distributed/_shard/sharded_tensor/__pycache__/_test_ops_common.cpython-312.pyc,, +torch/testing/_internal/distributed/_shard/sharded_tensor/__pycache__/_test_st_common.cpython-312.pyc,, +torch/testing/_internal/distributed/_shard/sharded_tensor/_test_ops_common.py,sha256=7UGyAp6lITtyl5DVz865Nqgvxmb5gONTkMeX4g4asog,4148 +torch/testing/_internal/distributed/_shard/sharded_tensor/_test_st_common.py,sha256=Pms5o2nHLLjYS6ZGAI7n9jqZry6w-AN8-Huh4bwswH0,1674 +torch/testing/_internal/distributed/_shard/test_common.py,sha256=upgmNyYS-cU5DBgh1gPd-HrkiPMqpOJanuyQuSZ_qkY,1260 +torch/testing/_internal/distributed/_tensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/testing/_internal/distributed/_tensor/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/distributed/_tensor/__pycache__/common_dtensor.cpython-312.pyc,, +torch/testing/_internal/distributed/_tensor/common_dtensor.py,sha256=HTQQw3r9OmHyJ064w3FoFKssJfovnDFUGa_9rVPUtDg,35897 +torch/testing/_internal/distributed/checkpoint_utils.py,sha256=KHzc0gU0hUWV9OUbGMwC3p86wIN5rUqPdfMgohtKhVU,6381 +torch/testing/_internal/distributed/common_state_dict.py,sha256=FNXDw62IFwLdIP6YB7ziKHTRjGY2lvzUzNC-7GYFvFo,6895 +torch/testing/_internal/distributed/ddp_under_dist_autograd_test.py,sha256=xuwtc-wfxfBfunqpiF_9hwJBJ_alhcDRSZskSf0W_M0,27746 +torch/testing/_internal/distributed/distributed_test.py,sha256=BpkfkcUfsqpc_vMQ3EWj2edrxIbyKZY7Jp1nMiOW2Jw,448724 +torch/testing/_internal/distributed/distributed_utils.py,sha256=wmj1KPuEyBpdoFAy1npJHyMnc4Npj0NKCcToGs1mUjo,1938 +torch/testing/_internal/distributed/fake_pg.py,sha256=rozHcOPD-KlJ8njLV86Ak9UjlUwMnRFKZxoPNdR_Tbs,1158 +torch/testing/_internal/distributed/multi_threaded_pg.py,sha256=0ZW8KZH2OaeIHfkkxgi_4sbH0U5uF2vx1jDAJ3NSjdI,22021 +torch/testing/_internal/distributed/nn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/testing/_internal/distributed/nn/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/distributed/nn/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/testing/_internal/distributed/nn/api/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/distributed/nn/api/__pycache__/remote_module_test.cpython-312.pyc,, +torch/testing/_internal/distributed/nn/api/remote_module_test.py,sha256=m7Xauzk5RG-uCJ9r9GestjGErOeSK4AYRQt8Xgle1cQ,30505 +torch/testing/_internal/distributed/rpc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/testing/_internal/distributed/rpc/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/__pycache__/dist_autograd_test.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/__pycache__/dist_optimizer_test.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/__pycache__/faulty_agent_rpc_test.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/__pycache__/faulty_rpc_agent_test_fixture.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/__pycache__/rpc_agent_test_fixture.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/__pycache__/rpc_test.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/__pycache__/tensorpipe_rpc_agent_test_fixture.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/dist_autograd_test.py,sha256=vdVywu34dzcDpIVV-B4lW0fQ4EFTwX8B6aV_mc2ycD0,109800 +torch/testing/_internal/distributed/rpc/dist_optimizer_test.py,sha256=Ih4Iuy7rAxfqUVhPHxMNk2p5sDH_Cx9_l3LcpLZ-Rso,10855 +torch/testing/_internal/distributed/rpc/examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/testing/_internal/distributed/rpc/examples/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/examples/__pycache__/parameter_server_test.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/examples/__pycache__/reinforcement_learning_rpc_test.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/examples/parameter_server_test.py,sha256=LjIdMtlB4gffYKuyzLi6TZkEPxr83_GlyZalaLXesTw,4708 +torch/testing/_internal/distributed/rpc/examples/reinforcement_learning_rpc_test.py,sha256=DPnTvu6X2yvtyV8DUenzxMRqAt_i6q9umDt9m4vABIk,9533 +torch/testing/_internal/distributed/rpc/faulty_agent_rpc_test.py,sha256=lpgXkSyctpgP6k2euI7ZBkKr_7hJDt8661To-2VMDTQ,14576 +torch/testing/_internal/distributed/rpc/faulty_rpc_agent_test_fixture.py,sha256=OLnDlz-dvddeG9-FxwyK-INzQCrGPrw5wwA6ik_FREY,2206 +torch/testing/_internal/distributed/rpc/jit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/testing/_internal/distributed/rpc/jit/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/jit/__pycache__/dist_autograd_test.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/jit/__pycache__/rpc_test.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/jit/__pycache__/rpc_test_faulty.cpython-312.pyc,, +torch/testing/_internal/distributed/rpc/jit/dist_autograd_test.py,sha256=6HnwmARmcwdrm5qDXrDtTiDPFnqv-N_MgXlK_Taxgy8,4285 +torch/testing/_internal/distributed/rpc/jit/rpc_test.py,sha256=FLabqWz8XjYi5JWRRCJhd1OT4prvAAu4-HvMtxzlIoQ,48253 +torch/testing/_internal/distributed/rpc/jit/rpc_test_faulty.py,sha256=UbP5mSXW56iDLD5_QqR2HIogfUWGnEEt8sguHJDLQww,8193 +torch/testing/_internal/distributed/rpc/rpc_agent_test_fixture.py,sha256=zhpzVAar7GiEroCkwV4YuWLnGnG1iFQ42zo_V2PLfVA,1937 +torch/testing/_internal/distributed/rpc/rpc_test.py,sha256=59_Njk9TdUf1Oz9_zxOMKnjJcXNW1CA2GRmKT6jZPHQ,232192 +torch/testing/_internal/distributed/rpc/tensorpipe_rpc_agent_test_fixture.py,sha256=hZ4ub4qtB50YYBoB2ckI_WoCFBB_ry4rGEWzJke-77Y,1002 +torch/testing/_internal/distributed/rpc_utils.py,sha256=hbwJG6YwJ-KtCseuXJKCkvPfXOsaticWbN_NVH71-5A,6803 +torch/testing/_internal/dynamo_pytree_test_utils.py,sha256=iScl0aZmcPyC0e0uMPjspA1Ehkd7-11YA28ymvfkwoo,1087 +torch/testing/_internal/dynamo_test_failures.py,sha256=5SAsrzL-h6Yro-HAgvYTGSyfDLpdGSn6xqbj8SzyySM,5616 +torch/testing/_internal/fake_config_module.py,sha256=rbyPoOYaFz9KFL521Lkt5XSU-CEexSHiiKQFLqEmc_4,1297 +torch/testing/_internal/fake_config_module2.py,sha256=-Uog-78Z6WL4MlhJQWg0Hi32H0JQVya5w9LZHpdbkxM,356 +torch/testing/_internal/fake_config_module3.py,sha256=xF8kzfIUu1gjaXPxqIp1t-_PKSxRZdEZOro6pAjEeCI,244 +torch/testing/_internal/generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/testing/_internal/generated/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/generated/__pycache__/annotated_fn_args.cpython-312.pyc,, +torch/testing/_internal/generated/annotated_fn_args.py,sha256=JrKb32qMGFtMU012iuvPupja8Bxd1exWtsW_8S6ZI5E,558606 +torch/testing/_internal/hop_db.py,sha256=SJ9_wfao6nrBJCapuJVVWgUCeaSD18Ss6NRhdgAqrE0,17254 +torch/testing/_internal/hypothesis_utils.py,sha256=AeD-CWYgNTX6N3Xug2jWG5dkWVC2DNZCBx0SdenHGxo,15289 +torch/testing/_internal/inductor_utils.py,sha256=ZtvbVIoP6hhDEcaEya49NF7ud6DI_1BD_Nav9edyX_I,14038 +torch/testing/_internal/jit_metaprogramming_utils.py,sha256=IAnkB10EMJ-UwJZrhGgWyHiOzKSuSMpDlfrG8ECh6Y0,34782 +torch/testing/_internal/jit_utils.py,sha256=R1z0HdhxoavYGUR7aZpo8vrn7h3l5Uz4mBkXIox9nsU,34786 +torch/testing/_internal/logging_tensor.py,sha256=j_vIvb6D0IJB39z6tlMh7zTRe-WaGnGDW5VcvjabC-w,6814 +torch/testing/_internal/logging_utils.py,sha256=9JvSqCd5CeBmecY-bMKGzzzxwcGIkLUpgx4hplurVzc,8483 +torch/testing/_internal/opinfo/__init__.py,sha256=gMzdjsnJzsmJrkvmnXErEc9HTeG-5r_AIznCn0YKhog,120 +torch/testing/_internal/opinfo/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/opinfo/__pycache__/core.cpython-312.pyc,, +torch/testing/_internal/opinfo/__pycache__/refs.cpython-312.pyc,, +torch/testing/_internal/opinfo/__pycache__/utils.cpython-312.pyc,, +torch/testing/_internal/opinfo/core.py,sha256=dbZQ3BlfjnllMzGG0KVpVf2pdCtqejiz0Szd3_v56F4,127379 +torch/testing/_internal/opinfo/definitions/__init__.py,sha256=IThISQWPf5p3Khcfvbbgw_fENb84fTYqJpi3bEZ07ZU,478 +torch/testing/_internal/opinfo/definitions/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/opinfo/definitions/__pycache__/_masked.cpython-312.pyc,, +torch/testing/_internal/opinfo/definitions/__pycache__/fft.cpython-312.pyc,, +torch/testing/_internal/opinfo/definitions/__pycache__/linalg.cpython-312.pyc,, +torch/testing/_internal/opinfo/definitions/__pycache__/nested.cpython-312.pyc,, +torch/testing/_internal/opinfo/definitions/__pycache__/signal.cpython-312.pyc,, +torch/testing/_internal/opinfo/definitions/__pycache__/sparse.cpython-312.pyc,, +torch/testing/_internal/opinfo/definitions/__pycache__/special.cpython-312.pyc,, +torch/testing/_internal/opinfo/definitions/_masked.py,sha256=Q5VpgO4CBBQlNmykUdS-V1rNrhMExuabqsLc-dJDqcU,47761 +torch/testing/_internal/opinfo/definitions/fft.py,sha256=VYe6XSYakDmeShN8ii30dmGU-oFtdJkkIz6DxOeNbdI,30254 +torch/testing/_internal/opinfo/definitions/linalg.py,sha256=RojM1DHxlX_shwGJWhpaEJ52w50pgx9fKmSQmtJCPHo,87142 +torch/testing/_internal/opinfo/definitions/nested.py,sha256=hww-C0y48v2HdH7inQhChJ1D_J4uavMLlnazd_9cRYE,61369 +torch/testing/_internal/opinfo/definitions/signal.py,sha256=M2HJ_sTfaNIOj7Q2jwhK6UAzn9OHjCzJQ61Q43BXfOo,15810 +torch/testing/_internal/opinfo/definitions/sparse.py,sha256=8E-E7Af_iTWXY_2DQBP7EA6b53Gu__1mLDZcuKn-8RI,34753 +torch/testing/_internal/opinfo/definitions/special.py,sha256=DGrK3WlKnYfwXkXGmJkUyCjapfcNFTH7ErTeyUj2vWA,27859 +torch/testing/_internal/opinfo/refs.py,sha256=R9pnC9VvTcBBHQpkhYzlI3y6Xldhln2jV2RNp5vooGM,8246 +torch/testing/_internal/opinfo/utils.py,sha256=u8zWkFaId9Rf0Ic6G97X9sMhHqkCLPBJMYbljJS7PJY,9056 +torch/testing/_internal/optests/__init__.py,sha256=FSuVnX16NUi5lWMkTRnykRD5t79ixmQnP5IzAda1sno,379 +torch/testing/_internal/optests/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/optests/__pycache__/aot_autograd.cpython-312.pyc,, +torch/testing/_internal/optests/__pycache__/autograd_registration.cpython-312.pyc,, +torch/testing/_internal/optests/__pycache__/fake_tensor.cpython-312.pyc,, +torch/testing/_internal/optests/__pycache__/generate_tests.cpython-312.pyc,, +torch/testing/_internal/optests/__pycache__/make_fx.cpython-312.pyc,, +torch/testing/_internal/optests/aot_autograd.py,sha256=aEwG7apecyPIV68X6TVM6ucO1IeOOWM17d0teoExZ4Y,7217 +torch/testing/_internal/optests/autograd_registration.py,sha256=gNPnzOTgu4jBFEgc3UF3Uh0OGtUl-fIH3nVVs_mHOOc,5905 +torch/testing/_internal/optests/fake_tensor.py,sha256=fe_mSRHFQYL6mzF8fybaBrLIOW9N6Retztpl_SNQXMY,269 +torch/testing/_internal/optests/generate_tests.py,sha256=Bnb9Sqtve1hcL1k8CLFPedQQZE1Cuws5OIQ9rYAIJ3g,32614 +torch/testing/_internal/optests/make_fx.py,sha256=S3tpaj8GcyGK_RhcH8EYuVWLRVWiYmLHnIbbVdzJqW4,3354 +torch/testing/_internal/quantization_torch_package_models.py,sha256=ZU4aq2H8SYQMgokcw1oOgalMNSFS5ekcjSeZn_49s-M,984 +torch/testing/_internal/static_module.py,sha256=KijDwJpMQ0RXVubvB5tSBEAmwEQLz_t8ZnJLkki0i3g,920 +torch/testing/_internal/subclasses.py,sha256=SV3bc2uecKFWt74iOOkNLEx9MwnCuYMqZCBrQCGP8U0,2608 +torch/testing/_internal/test_module/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/testing/_internal/test_module/__pycache__/__init__.cpython-312.pyc,, +torch/testing/_internal/test_module/__pycache__/future_div.cpython-312.pyc,, +torch/testing/_internal/test_module/__pycache__/no_future_div.cpython-312.pyc,, +torch/testing/_internal/test_module/future_div.py,sha256=fM41286qBrBQbyt0_B_o-6nP8hL7CLgfhfHs1iWkDv0,124 +torch/testing/_internal/test_module/no_future_div.py,sha256=Xrd0DiR35Q8NNHYXdwr2R_sw2KM6ei-pNRBcMBa-rI8,156 +torch/testing/_internal/torchbind_impls.py,sha256=c94lRNhtEBtdTGC6zSJLfYHkJ9X0noPlisMb2X_Pi6U,5880 +torch/testing/_internal/triton_utils.py,sha256=ORI8Bu14Xw9PYpQ1aQ4fmrEzH5y8BFgaZbirE2zIEfs,33033 +torch/testing/_internal/two_tensor.py,sha256=s4Iw8InJKL4-QyqXqn-mSAQMfBEwQON8NtABA34nnhs,3777 +torch/testing/_utils.py,sha256=rO-KBh1WmjoqfLGkJRpZBX6YNRhX1-5OMpQrvGmSpig,2091 +torch/torch_version.py,sha256=GebXGfR-qq13F_bhl1f68SgD_LH64QDaD9FR4_joYEU,2596 +torch/types.py,sha256=qlaJG74YMQJruk4VolnUxtaN1-r2mAN6Hije7flieio,3685 +torch/utils/__init__.py,sha256=QYLeK69tGFIPfrIu51xr2GG1PNc6ndzZpx6hopEfRe0,3998 +torch/utils/__pycache__/__init__.cpython-312.pyc,, +torch/utils/__pycache__/_appending_byte_serializer.cpython-312.pyc,, +torch/utils/__pycache__/_config_module.cpython-312.pyc,, +torch/utils/__pycache__/_content_store.cpython-312.pyc,, +torch/utils/__pycache__/_contextlib.cpython-312.pyc,, +torch/utils/__pycache__/_cpp_embed_headers.cpython-312.pyc,, +torch/utils/__pycache__/_cpp_extension_versioner.cpython-312.pyc,, +torch/utils/__pycache__/_cxx_pytree.cpython-312.pyc,, +torch/utils/__pycache__/_debug_mode.cpython-312.pyc,, +torch/utils/__pycache__/_device.cpython-312.pyc,, +torch/utils/__pycache__/_dtype_abbrs.cpython-312.pyc,, +torch/utils/__pycache__/_exposed_in.cpython-312.pyc,, +torch/utils/__pycache__/_filelock.cpython-312.pyc,, +torch/utils/__pycache__/_foreach_utils.cpython-312.pyc,, +torch/utils/__pycache__/_functools.cpython-312.pyc,, +torch/utils/__pycache__/_get_clean_triton.cpython-312.pyc,, +torch/utils/__pycache__/_helion.cpython-312.pyc,, +torch/utils/__pycache__/_import_utils.cpython-312.pyc,, +torch/utils/__pycache__/_mode_utils.cpython-312.pyc,, +torch/utils/__pycache__/_ordered_set.cpython-312.pyc,, +torch/utils/__pycache__/_pallas.cpython-312.pyc,, +torch/utils/__pycache__/_python_dispatch.cpython-312.pyc,, +torch/utils/__pycache__/_pytree.cpython-312.pyc,, +torch/utils/__pycache__/_runtime_estimation.cpython-312.pyc,, +torch/utils/__pycache__/_stats.cpython-312.pyc,, +torch/utils/__pycache__/_thunk.cpython-312.pyc,, +torch/utils/__pycache__/_traceback.cpython-312.pyc,, +torch/utils/__pycache__/_triton.cpython-312.pyc,, +torch/utils/__pycache__/_typing_utils.cpython-312.pyc,, +torch/utils/__pycache__/_zip.cpython-312.pyc,, +torch/utils/__pycache__/backend_registration.cpython-312.pyc,, +torch/utils/__pycache__/bundled_inputs.cpython-312.pyc,, +torch/utils/__pycache__/checkpoint.cpython-312.pyc,, +torch/utils/__pycache__/collect_env.cpython-312.pyc,, +torch/utils/__pycache__/cpp_backtrace.cpython-312.pyc,, +torch/utils/__pycache__/cpp_extension.cpython-312.pyc,, +torch/utils/__pycache__/deterministic.cpython-312.pyc,, +torch/utils/__pycache__/dlpack.cpython-312.pyc,, +torch/utils/__pycache__/file_baton.cpython-312.pyc,, +torch/utils/__pycache__/flop_counter.cpython-312.pyc,, +torch/utils/__pycache__/hooks.cpython-312.pyc,, +torch/utils/__pycache__/mkldnn.cpython-312.pyc,, +torch/utils/__pycache__/mobile_optimizer.cpython-312.pyc,, +torch/utils/__pycache__/model_zoo.cpython-312.pyc,, +torch/utils/__pycache__/module_tracker.cpython-312.pyc,, +torch/utils/__pycache__/show_pickle.cpython-312.pyc,, +torch/utils/__pycache__/throughput_benchmark.cpython-312.pyc,, +torch/utils/__pycache__/weak.cpython-312.pyc,, +torch/utils/_appending_byte_serializer.py,sha256=sp6P12AMBEyV-V1zMErdXe399jvFrCN6VK-0MhBsg3U,4199 +torch/utils/_config_module.py,sha256=UdzudXVMiMBi6o0P4TCyWtwKzFUL9RCmgVGaMNbkXY0,31758 +torch/utils/_config_typing.pyi,sha256=9nWOW8weBWbXUWWSJDUNJhrqmz0ZWm3u5Vpxjde6iMs,1369 +torch/utils/_content_store.py,sha256=5Z9MvILvlLqBamKrqlT2X3Eln5jKgAv55DjXkinRgZo,9568 +torch/utils/_contextlib.py,sha256=xLUgda9rI3hDNriNHGCMG6Irzs4kXwPSDo_xK4u3dMk,6572 +torch/utils/_cpp_embed_headers.py,sha256=ASr3X3Kd_ko7HBf9MttjXh2CPIcFCMEUUjoMgrCJvjc,1815 +torch/utils/_cpp_extension_versioner.py,sha256=Hm4EM9ubtrOGRQdOPirYrD0Ufuz_eNxR2eiGylrCNAk,2009 +torch/utils/_cxx_pytree.py,sha256=CNfOShwK-pWfPDk8wu9Dq8ud0DnWGv1OaBSLn3r31Mc,40608 +torch/utils/_debug_mode.py,sha256=pAfnTyEfSn_TuufsOvQruZMMTdDjLiybnpmm7dOkQwU,52546 +torch/utils/_device.py,sha256=niSlnWAJAMHIruXfsN6eHv7G6cw0ZqDuJoPqZd2_BEI,4120 +torch/utils/_dtype_abbrs.py,sha256=EltGnPMGj6vL9wHSfjE7yhw6K7W23ysqn6sTgIdgFA0,785 +torch/utils/_exposed_in.py,sha256=5fIWL96NGIKTBIIFMmzg4su4bAjOpVtn5uDUc9Xgh_w,741 +torch/utils/_filelock.py,sha256=S-7DCa0hBYWn1yGbz4U3cHcA4Xxct3LYBfnPiZIsODE,1571 +torch/utils/_foreach_utils.py,sha256=B-jZ9rnfm2h8Bm470P43wlooJNfvRApU8nXKIN4v268,2469 +torch/utils/_functools.py,sha256=Noe1oW-sGaJvV_cUTBpYparwnFOPTWMxOYsQXC79Q20,1657 +torch/utils/_get_clean_triton.py,sha256=Jym-LWYcaaKmKbyWtO0oDh6uHD5RlsOgOOVTivOOZKA,7185 +torch/utils/_helion.py,sha256=ZOn4JLVBhawXV0B6YDvXUxI6w7h09TYlfBoyDgZVp40,381 +torch/utils/_import_utils.py,sha256=njmyE4HZCbu6heeN7pXRcEIR0k-qYxq_pf_OY9M30qM,1211 +torch/utils/_mode_utils.py,sha256=--_9vhBRDmfUGMC5CX-tyoS-2zjvlGFxCswpAVP8b1g,270 +torch/utils/_ordered_set.py,sha256=v5pFEtDZpTqQV44PWwUZ0ZPWMcj97muPdtUwnqyIalE,5837 +torch/utils/_pallas.py,sha256=gRXaJXXqOogwmSb14l_jfGCvl4U7O-Flr7QMhu-g1Kk,2786 +torch/utils/_python_dispatch.py,sha256=uQhXUdIHpDiyF_YXmOHFP9j0ZDqEGcHcK-XZc3mfEnc,38683 +torch/utils/_pytree.py,sha256=frZoKf6pq44_tGEKTDj0fW7imIwQCpE_as9ikhxmPOY,78850 +torch/utils/_runtime_estimation.py,sha256=YNmbs62l7Ls-2VdUrkDWKHRfU4SOav2-tMmpEBD0edY,4519 +torch/utils/_stats.py,sha256=iA_fnWANW2fiyJlaEDkf8V96vJGmaAqHg9rt1dH7euc,1072 +torch/utils/_strobelight/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/utils/_strobelight/__pycache__/__init__.cpython-312.pyc,, +torch/utils/_strobelight/__pycache__/cli_function_profiler.cpython-312.pyc,, +torch/utils/_strobelight/cli_function_profiler.py,sha256=IW0X8wOPOO7PFyth5jFR9AFAuEgVv28efS8nFxnxC70,11673 +torch/utils/_sympy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/utils/_sympy/__pycache__/__init__.cpython-312.pyc,, +torch/utils/_sympy/__pycache__/functions.cpython-312.pyc,, +torch/utils/_sympy/__pycache__/interp.cpython-312.pyc,, +torch/utils/_sympy/__pycache__/numbers.cpython-312.pyc,, +torch/utils/_sympy/__pycache__/printers.cpython-312.pyc,, +torch/utils/_sympy/__pycache__/reference.cpython-312.pyc,, +torch/utils/_sympy/__pycache__/singleton_int.cpython-312.pyc,, +torch/utils/_sympy/__pycache__/solve.cpython-312.pyc,, +torch/utils/_sympy/__pycache__/symbol.cpython-312.pyc,, +torch/utils/_sympy/__pycache__/value_ranges.cpython-312.pyc,, +torch/utils/_sympy/functions.py,sha256=ZwQLc5yf_FqqtyzYxFgCSsHNARJeDounRrpoRgbSUNc,54717 +torch/utils/_sympy/interp.py,sha256=2TZsCI3CN599tOsCkH8Zp2aHEFAGaBo246_BnLGpkVo,7428 +torch/utils/_sympy/numbers.py,sha256=V06IkRTgVimNIt4YaJEzUtzuzujqN8mM645ZojFAbl4,11894 +torch/utils/_sympy/printers.py,sha256=s4GdS7lCeF0jiV2UoxPo5o_0bxudOdSDwy94qmaJMI0,26098 +torch/utils/_sympy/reference.py,sha256=NljAXXPIvFzzcI2xGwl4ngsTiSMwS-hliUWgvVmPiMM,14714 +torch/utils/_sympy/singleton_int.py,sha256=RxXh6vn2nmyCTJVhEauIEE81Ia_cwEhGeZ6J-SFri30,3071 +torch/utils/_sympy/solve.py,sha256=QBPlXtxabZuJ_LcuebypsBOFVNQWcgvfXTssbNCFN0U,6556 +torch/utils/_sympy/symbol.py,sha256=RZnwAErItUqMZGAdiPNeisVdKSO3mRX6QbTgky3VjVs,3838 +torch/utils/_sympy/value_ranges.py,sha256=-cgj6SvSabs-pvNGwfSvta-5NHNeJCXofgEsJzd3eRg,40490 +torch/utils/_thunk.py,sha256=lQHUa2QaG6de-sOnI5J2Oet7IoWbhB1AZIUyCdo_AE0,673 +torch/utils/_traceback.py,sha256=pfakk0TVJxsvEwXc1kaGf_HjB1scE_v9ro4WdaLdq5A,10534 +torch/utils/_triton.py,sha256=soQ9iX6Qg-5Sh4xKiJySCndcZYQdFxFsFPxlP6ID-Oc,5573 +torch/utils/_typing_utils.py,sha256=O5R55dXwBuNt7DZRx7H5krb0XmEHZtDG1m0QQBPLxB4,379 +torch/utils/_zip.py,sha256=niyVlyqe2vA4fcw7BPS_N7M7kKKGCwJFOIznM3RmcG8,2595 +torch/utils/backcompat/__init__.py,sha256=Ox_e08KPkQfrrIcMxPU3fG9On25MSsax7KeMCedNG9c,705 +torch/utils/backcompat/__pycache__/__init__.cpython-312.pyc,, +torch/utils/backend_registration.py,sha256=nHzndfTtWUYANF_yoH2LoPTFN_-qL3BSbsjBW0Srgu8,22599 +torch/utils/benchmark/__init__.py,sha256=HKYS3h8Ga20QnvZJYgekjWd2Dc82oreraUxoRCfNmjo,417 +torch/utils/benchmark/__pycache__/__init__.cpython-312.pyc,, +torch/utils/benchmark/examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/utils/benchmark/examples/__pycache__/__init__.cpython-312.pyc,, +torch/utils/benchmark/examples/__pycache__/compare.cpython-312.pyc,, +torch/utils/benchmark/examples/__pycache__/fuzzer.cpython-312.pyc,, +torch/utils/benchmark/examples/__pycache__/op_benchmark.cpython-312.pyc,, +torch/utils/benchmark/examples/__pycache__/simple_timeit.cpython-312.pyc,, +torch/utils/benchmark/examples/__pycache__/spectral_ops_fuzz_test.cpython-312.pyc,, +torch/utils/benchmark/examples/compare.py,sha256=xsmDXgFLLj-oFlETs1xkqwmeOauXDw9-JLg2X5zPpcw,3030 +torch/utils/benchmark/examples/fuzzer.py,sha256=8UJJMIawz7wVlsoEzxdT1gKeOrtC92vfTjJaBF_8GWg,2744 +torch/utils/benchmark/examples/op_benchmark.py,sha256=Hbzzx--eKCcuGTX5zFOa23sOOtKeBzIDWB7-zSZ8m2A,4519 +torch/utils/benchmark/examples/simple_timeit.py,sha256=_yV8VfpGOyaPMGfc6c9i2XvTzFXZZWhUYvO3e9isY-0,566 +torch/utils/benchmark/examples/spectral_ops_fuzz_test.py,sha256=MxrvcreimAWXq95geRzgnkfwHCr6j3nDSdwW_0zlofo,4901 +torch/utils/benchmark/op_fuzzers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/utils/benchmark/op_fuzzers/__pycache__/__init__.cpython-312.pyc,, +torch/utils/benchmark/op_fuzzers/__pycache__/binary.cpython-312.pyc,, +torch/utils/benchmark/op_fuzzers/__pycache__/sparse_binary.cpython-312.pyc,, +torch/utils/benchmark/op_fuzzers/__pycache__/sparse_unary.cpython-312.pyc,, +torch/utils/benchmark/op_fuzzers/__pycache__/spectral.cpython-312.pyc,, +torch/utils/benchmark/op_fuzzers/__pycache__/unary.cpython-312.pyc,, +torch/utils/benchmark/op_fuzzers/binary.py,sha256=mN6Pe50yIUsxBMiESeehYt_ITZ7ZSDsU_z_njpzxBl4,4251 +torch/utils/benchmark/op_fuzzers/sparse_binary.py,sha256=kiRJoZyghO7zculuOitZglbsqem6jPVT-aGQffX_y-M,4333 +torch/utils/benchmark/op_fuzzers/sparse_unary.py,sha256=KrxA8y8y1JivNNEVKmqatlgAWjJDmWvguGvGzNxdkk8,3583 +torch/utils/benchmark/op_fuzzers/spectral.py,sha256=cffclNdvnozQSfE0UB-YXlBWSSx2PdcmVbUOQOgkOco,3726 +torch/utils/benchmark/op_fuzzers/unary.py,sha256=QmM2WfgwhQ6jO-sWdYfylmgZM2Dll77TAkUdLOjR11Y,3236 +torch/utils/benchmark/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/utils/benchmark/utils/__pycache__/__init__.cpython-312.pyc,, +torch/utils/benchmark/utils/__pycache__/_stubs.cpython-312.pyc,, +torch/utils/benchmark/utils/__pycache__/common.cpython-312.pyc,, +torch/utils/benchmark/utils/__pycache__/compare.cpython-312.pyc,, +torch/utils/benchmark/utils/__pycache__/compile.cpython-312.pyc,, +torch/utils/benchmark/utils/__pycache__/cpp_jit.cpython-312.pyc,, +torch/utils/benchmark/utils/__pycache__/fuzzer.cpython-312.pyc,, +torch/utils/benchmark/utils/__pycache__/sparse_fuzzer.cpython-312.pyc,, +torch/utils/benchmark/utils/__pycache__/timer.cpython-312.pyc,, +torch/utils/benchmark/utils/_stubs.py,sha256=atv9Qg1ZnA-2vB4nEchcg_-OxgZa32mwMebGWUR-iBA,1068 +torch/utils/benchmark/utils/common.py,sha256=6Q2WcCLXyLoTU0mmFfb1E8YJnySpgcAH6QBDkG9f7Qs,14133 +torch/utils/benchmark/utils/compare.py,sha256=dmKxiNQHhAbiLfu7D_hBLVC7wa7nTU5fsi7HOH_25ZU,13818 +torch/utils/benchmark/utils/compile.py,sha256=SOySv9t3i4ve79djR7qA-4-Taya18jlMvgrZsrYlECs,7870 +torch/utils/benchmark/utils/cpp_jit.py,sha256=8rmCwSQo79CQUoE7lK-M8FiBIFKDK4Sg5Ms1JhYL95U,7151 +torch/utils/benchmark/utils/fuzzer.py,sha256=ZvI0ng1hd8dGZpLSM-G3NIISFiNSNLwkSRR6FtHzj5Y,19247 +torch/utils/benchmark/utils/sparse_fuzzer.py,sha256=NGBvlJwtOxZeq_Xsq90mJBzXc0rL3OO1DN5ViQIrEgA,5527 +torch/utils/benchmark/utils/timeit_template.cpp,sha256=Va3o8cMDuSgEBzW9lRDPnLjLme5AXDjxlbYz7t8oFTU,1052 +torch/utils/benchmark/utils/timer.py,sha256=JJBzxEi0An80eZNPNpZupalbvMFr33aUz_teyZaurNA,21383 +torch/utils/benchmark/utils/valgrind_wrapper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/utils/benchmark/utils/valgrind_wrapper/__pycache__/__init__.cpython-312.pyc,, +torch/utils/benchmark/utils/valgrind_wrapper/__pycache__/timer_interface.cpython-312.pyc,, +torch/utils/benchmark/utils/valgrind_wrapper/callgrind.h,sha256=XCIF1Vdbl-Gx3F6t3FfIxGI5Nxg_fBriBQTvtWVAASQ,5873 +torch/utils/benchmark/utils/valgrind_wrapper/compat_bindings.cpp,sha256=gPk9mKdSUgL8ld02ctjzbpYBCNwmzmejCGcrlzaTErI,848 +torch/utils/benchmark/utils/valgrind_wrapper/timer_callgrind_template.cpp,sha256=Mz8VIs_lJ0-swUxXsp7mX3U-B_IQNocow7BJAZGkmgA,1744 +torch/utils/benchmark/utils/valgrind_wrapper/timer_interface.py,sha256=2K1cSLEdDaXi5Emym1PznAWSE-uAzV_GU3X_OKBK87A,38860 +torch/utils/benchmark/utils/valgrind_wrapper/valgrind.h,sha256=duxM9eWNw9-pJLX9amnu0-5RBYcglE_pF-R0la7YS6s,429810 +torch/utils/bundled_inputs.py,sha256=_F11q4XbVPRUAIXvcVwEhP0UYDeLQ8PqbwfFyMJZ08k,23170 +torch/utils/checkpoint.py,sha256=MlRzos182by8FuEviDHZOFzJ96gCUXO6hL2FWxqCZ9s,73910 +torch/utils/collect_env.py,sha256=g7iwigOLZOn17hAlntW7mjvuQYnS_IqCC-G_KsGZrtE,32051 +torch/utils/cpp_backtrace.py,sha256=2Kqo--zoORQcKGnK2UFIFfhw9QfunH-iE00FuAMtUFY,495 +torch/utils/cpp_extension.py,sha256=somwzSjJEyRKWBNjndvn2R7BMGSFcf5Go4j3PAolpVM,141090 +torch/utils/data/__init__.py,sha256=brmcpR7uEB4ZpUsmSYoBxd9pzaSzsJe7gt4eANCVJ2s,1779 +torch/utils/data/__pycache__/__init__.cpython-312.pyc,, +torch/utils/data/__pycache__/backward_compatibility.cpython-312.pyc,, +torch/utils/data/__pycache__/dataloader.cpython-312.pyc,, +torch/utils/data/__pycache__/dataset.cpython-312.pyc,, +torch/utils/data/__pycache__/distributed.cpython-312.pyc,, +torch/utils/data/__pycache__/graph.cpython-312.pyc,, +torch/utils/data/__pycache__/graph_settings.cpython-312.pyc,, +torch/utils/data/__pycache__/sampler.cpython-312.pyc,, +torch/utils/data/_utils/__init__.py,sha256=g9kpE8Nkeroca0MjqBXJj_pzoqyNMlbvzXhWK3Es-Mk,1659 +torch/utils/data/_utils/__pycache__/__init__.cpython-312.pyc,, +torch/utils/data/_utils/__pycache__/collate.cpython-312.pyc,, +torch/utils/data/_utils/__pycache__/fetch.cpython-312.pyc,, +torch/utils/data/_utils/__pycache__/pin_memory.cpython-312.pyc,, +torch/utils/data/_utils/__pycache__/signal_handling.cpython-312.pyc,, +torch/utils/data/_utils/__pycache__/worker.cpython-312.pyc,, +torch/utils/data/_utils/collate.py,sha256=Srya_G4bWsZJ3cH8VzCxXOQU7H-lZIxXnRFHgpd7XOQ,16379 +torch/utils/data/_utils/fetch.py,sha256=o5cy9G-6015tE4xYd5HqT0UBjuzXkXm4SPCr49-OzYQ,2067 +torch/utils/data/_utils/pin_memory.py,sha256=vYblSjYF83z9kOsJeVeSeXqvcv9gYBfImcN9gCWopN0,4218 +torch/utils/data/_utils/signal_handling.py,sha256=2Q68EQgKz72CAlNQWReT13X40D755AkftzfVSULUV3A,3341 +torch/utils/data/_utils/worker.py,sha256=kR39CujMD0aQZJoVSaM3gLs17CNmEAUWIJYVjh72t3Y,14643 +torch/utils/data/backward_compatibility.py,sha256=Ohm56SQl_cI8gq-fKR8Z90DcWzuJ-B2m6pXW7Fotsew,328 +torch/utils/data/dataloader.py,sha256=nHq99v2R0Qogw7kw_Ewci5xsVT5gIpkTsTSpm1no4kA,82862 +torch/utils/data/datapipes/__init__.py,sha256=LwlHIcce6VnPe17EZHBEkX6e56_OIqO-gHTi8l5bUrU,89 +torch/utils/data/datapipes/__pycache__/__init__.cpython-312.pyc,, +torch/utils/data/datapipes/__pycache__/_decorator.cpython-312.pyc,, +torch/utils/data/datapipes/__pycache__/_hook_iterator.cpython-312.pyc,, +torch/utils/data/datapipes/__pycache__/_typing.cpython-312.pyc,, +torch/utils/data/datapipes/__pycache__/datapipe.cpython-312.pyc,, +torch/utils/data/datapipes/__pycache__/gen_pyi.cpython-312.pyc,, +torch/utils/data/datapipes/_decorator.py,sha256=QJhfGikIyRbCTW22L5OBv2wSeBuu7bpP7a2WoSU4E6w,7970 +torch/utils/data/datapipes/_hook_iterator.py,sha256=NBt1wtDee6Kmwns-jRtg8_QqvbFAXiZiQmFHnj2BMFA,12251 +torch/utils/data/datapipes/_typing.py,sha256=RlvUWD3wNgVXn9SB676xz3_MnMIrZKj0o04nBFmP7sA,16921 +torch/utils/data/datapipes/dataframe/__init__.py,sha256=TENBESv8f0dE80tRSL631smDCcRn4XWxHrcUGqcBRIs,390 +torch/utils/data/datapipes/dataframe/__pycache__/__init__.cpython-312.pyc,, +torch/utils/data/datapipes/dataframe/__pycache__/dataframe_wrapper.cpython-312.pyc,, +torch/utils/data/datapipes/dataframe/__pycache__/dataframes.cpython-312.pyc,, +torch/utils/data/datapipes/dataframe/__pycache__/datapipes.cpython-312.pyc,, +torch/utils/data/datapipes/dataframe/__pycache__/structures.cpython-312.pyc,, +torch/utils/data/datapipes/dataframe/dataframe_wrapper.py,sha256=79ahohcKqiYtuFb0hZWJocUP7nK8btNs1F9fKR2IlVU,3416 +torch/utils/data/datapipes/dataframe/dataframes.py,sha256=IT7QM9G-_Yfgl0iirxpV17OrdfsVmr2GiaVuVRt_pcs,15105 +torch/utils/data/datapipes/dataframe/datapipes.py,sha256=sAzVJswKh4vIPd9DOLpT_uANHPFV5LI3ZLnDbmn531I,4763 +torch/utils/data/datapipes/dataframe/structures.py,sha256=vIuh8h4Gj_mWZy49EsfYLyI1khN2NiZcMMiDTIYDyYo,684 +torch/utils/data/datapipes/datapipe.py,sha256=B2UrNd-aUjkcLCL0p4RASqBmVk7wVjxV-Tp0OX4uRq4,17695 +torch/utils/data/datapipes/datapipe.pyi,sha256=hnaoIwr04IA9crSKCzFfcdbNk4NHtWnxTC9VdQ7jxzw,33476 +torch/utils/data/datapipes/gen_pyi.py,sha256=gT3YdAbtNtywReA9qFeuOjvtMqeN1P8cluUi8HnFaPk,12134 +torch/utils/data/datapipes/iter/__init__.py,sha256=BWcBVqsaTblLIoA4uaHY5pSvzMr_IQqEjxCbbs1R8oo,1928 +torch/utils/data/datapipes/iter/__pycache__/__init__.cpython-312.pyc,, +torch/utils/data/datapipes/iter/__pycache__/callable.cpython-312.pyc,, +torch/utils/data/datapipes/iter/__pycache__/combinatorics.cpython-312.pyc,, +torch/utils/data/datapipes/iter/__pycache__/combining.cpython-312.pyc,, +torch/utils/data/datapipes/iter/__pycache__/filelister.cpython-312.pyc,, +torch/utils/data/datapipes/iter/__pycache__/fileopener.cpython-312.pyc,, +torch/utils/data/datapipes/iter/__pycache__/grouping.cpython-312.pyc,, +torch/utils/data/datapipes/iter/__pycache__/routeddecoder.cpython-312.pyc,, +torch/utils/data/datapipes/iter/__pycache__/selecting.cpython-312.pyc,, +torch/utils/data/datapipes/iter/__pycache__/sharding.cpython-312.pyc,, +torch/utils/data/datapipes/iter/__pycache__/streamreader.cpython-312.pyc,, +torch/utils/data/datapipes/iter/__pycache__/utils.cpython-312.pyc,, +torch/utils/data/datapipes/iter/callable.py,sha256=4bX_JRILSRWTp6w3lY_46LMUT8jdz_Yow2pbs3fsDXw,9373 +torch/utils/data/datapipes/iter/combinatorics.py,sha256=zwRtMQom9dE_LALUsKDrR090Lw3ME6HmnSGf2qau4p8,6706 +torch/utils/data/datapipes/iter/combining.py,sha256=ssv4Cc77zvzd-KA52ZYzzI0sg1uizyAJW7KpmtaKkFg,28800 +torch/utils/data/datapipes/iter/filelister.py,sha256=o0umbi3moQ3XIAlS_pcY5j40N9hT_vv-_x43Zes3JJM,2621 +torch/utils/data/datapipes/iter/fileopener.py,sha256=aX-WeWv-yrabelR_4XEU7RGzv1Ku65VxcRqMfZr-DwI,2968 +torch/utils/data/datapipes/iter/grouping.py,sha256=pLZRFicECjvjzBX4xWm7l6ZQwK-JoHBURE6ZUSDNWj8,12767 +torch/utils/data/datapipes/iter/routeddecoder.py,sha256=CRHc_eAQkue9ij4lMRvURwDjG0JRLninqXoqI1Qcbl8,2801 +torch/utils/data/datapipes/iter/selecting.py,sha256=HxlkDf0FHRQr_hSaldD9r9IbOZWcjhRfntbLyBQrMTg,3410 +torch/utils/data/datapipes/iter/sharding.py,sha256=ZQq5zwrISY4JIq76uZrXlPgKza0BNvXha2Tjeh9lzyE,3691 +torch/utils/data/datapipes/iter/streamreader.py,sha256=uKAFgPD_SWy2F0zD2XHB-464bD4ejWIQxq7krISYKos,1582 +torch/utils/data/datapipes/iter/utils.py,sha256=bWkfof3Ygzv4DW2144CJ0209W_KrfHSMngD8XHtIIJM,2169 +torch/utils/data/datapipes/map/__init__.py,sha256=p4gy96qTcw9I2_egVf8_pbP28TvB3nctbDxLtZVrSCU,734 +torch/utils/data/datapipes/map/__pycache__/__init__.cpython-312.pyc,, +torch/utils/data/datapipes/map/__pycache__/callable.cpython-312.pyc,, +torch/utils/data/datapipes/map/__pycache__/combinatorics.cpython-312.pyc,, +torch/utils/data/datapipes/map/__pycache__/combining.cpython-312.pyc,, +torch/utils/data/datapipes/map/__pycache__/grouping.cpython-312.pyc,, +torch/utils/data/datapipes/map/__pycache__/utils.cpython-312.pyc,, +torch/utils/data/datapipes/map/callable.py,sha256=a0jjG8B6giGgoCVPsE32xzqECovloQ3JS2b4hMKHy58,2000 +torch/utils/data/datapipes/map/combinatorics.py,sha256=l1d8jnFgI_1cQOaOIceR4S1ifMZC5KlMGwcsMaA9UMY,4399 +torch/utils/data/datapipes/map/combining.py,sha256=zHv-GZb4xZF48CoZTw-c6fTzNnSDNpbZ0vldaqKJSPY,4012 +torch/utils/data/datapipes/map/grouping.py,sha256=wqKCyS29ATmioeSgVDnwXl1zBXWqJwzAhborQIZm_gg,2563 +torch/utils/data/datapipes/map/utils.py,sha256=iTperr8r9YpesiEXWLlfEeHO0Ze7ADt03n-Lfvu7gR0,1874 +torch/utils/data/datapipes/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/utils/data/datapipes/utils/__pycache__/__init__.cpython-312.pyc,, +torch/utils/data/datapipes/utils/__pycache__/common.cpython-312.pyc,, +torch/utils/data/datapipes/utils/__pycache__/decoder.cpython-312.pyc,, +torch/utils/data/datapipes/utils/__pycache__/snapshot.cpython-312.pyc,, +torch/utils/data/datapipes/utils/common.py,sha256=3NqmRJYlGEQD0Faj2sDoJapxXtq7FrB2ct0MnGvR-OQ,14308 +torch/utils/data/datapipes/utils/decoder.py,sha256=FmhDP7_XvZgx8mtJBmYPlbl6YQHt95cN4LToJCDW3u4,12512 +torch/utils/data/datapipes/utils/snapshot.py,sha256=j1P20zqvxkcD8mDBeFXK3bk6J58wj-H276T7pZKXvPI,3210 +torch/utils/data/dataset.py,sha256=q1_5oFuvTF2r4xkzgf3GRpb4EgItYJ8HHSPDX4fGeQc,20035 +torch/utils/data/distributed.py,sha256=sj10h1q0Tp_6B_O86VuHm4qsPi6MDDshAnML_00pvx4,6608 +torch/utils/data/graph.py,sha256=JZl4qNtYnPeE5oqr16c7sLB7W-udc0Pvhsoeetz-_CU,5991 +torch/utils/data/graph_settings.py,sha256=j8MVuDyAkv4hKSToPn1rXQp21gnalREKAm5JvOcvijE,5729 +torch/utils/data/sampler.py,sha256=y2N59dPPcz-qIgrEm59NcpVn7DwmOacf2f196Src1CA,13092 +torch/utils/deterministic.py,sha256=B4D1Q9GMAqQWEyFiOknB05rbroRGQ2uh7nfC_5oaV2w,633 +torch/utils/dlpack.py,sha256=Eb1rBUu59BGYfS8s6k1xuN6gACDxU6TP1uePk_Sj0ro,8693 +torch/utils/file_baton.py,sha256=SZgxI8W7gB9Rk-eJ7X73mAiuuCziAePDWaLnXVuP0RQ,2204 +torch/utils/flop_counter.py,sha256=zczulFcPyNwJLGv91Gc2nF8Ok45lH0hQFqUsdkbN3Lg,35280 +torch/utils/hipify/__init__.py,sha256=aF1qTFTEaCr30mm2ii0Wqs4ybLcLlwuiMraorC40TkU,34 +torch/utils/hipify/__pycache__/__init__.cpython-312.pyc,, +torch/utils/hipify/__pycache__/constants.cpython-312.pyc,, +torch/utils/hipify/__pycache__/cuda_to_hip_mappings.cpython-312.pyc,, +torch/utils/hipify/__pycache__/hipify_python.cpython-312.pyc,, +torch/utils/hipify/__pycache__/version.cpython-312.pyc,, +torch/utils/hipify/constants.py,sha256=rw3CEBOON8oXjimIdKy57SkimpFnPbE5nnfdgLAxvuQ,1236 +torch/utils/hipify/cuda_to_hip_mappings.py,sha256=ToH_i2cI71b5hXl7Oi3_MVMlpl7b0XK7KMfMGhqCyjE,408488 +torch/utils/hipify/hipify_python.py,sha256=33Q-AUv4E32TE6xyg1Sl5ajZpcGfxWGBkcx1hh4KsSY,48866 +torch/utils/hipify/version.py,sha256=crlYURA_2Ujkpz7iVPHovvxZRtvt4QBXF5AAFJzRfz0,23 +torch/utils/hooks.py,sha256=0BsY2T7DBzcsl3AHUmWtHe9_XRLJGm-aFyeGCG3kT5I,10470 +torch/utils/jit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/utils/jit/__pycache__/__init__.cpython-312.pyc,, +torch/utils/jit/__pycache__/log_extract.cpython-312.pyc,, +torch/utils/jit/log_extract.py,sha256=1tThjmAnLC1NDnX-LKPmkHF4pUszpCVHOIDeLEGsCvE,4312 +torch/utils/mkldnn.py,sha256=WgPs4IM4ZPehipcBCS9MtqpsbgoEsFCTVPlYPERqfwA,8482 +torch/utils/mobile_optimizer.py,sha256=F9roGI_HXSKKc1FKGEr45l4sMlwP1bToZFvynZLLx0k,6549 +torch/utils/model_dump/__init__.py,sha256=lQB0xOENChf9byzjJO8mTKOsfa7Es7e15g09dZ0H6VY,19761 +torch/utils/model_dump/__main__.py,sha256=svI1TUOVGqYtclCPw-W63BvkPoNLcCr7aDbGLvygZ24,84 +torch/utils/model_dump/__pycache__/__init__.cpython-312.pyc,, +torch/utils/model_dump/__pycache__/__main__.cpython-312.pyc,, +torch/utils/model_dump/code.js,sha256=scnF-tVarNCTh96M1XMkgLtxOW1HhjLDmQuepBT1ygQ,19940 +torch/utils/model_dump/htm.mjs,sha256=JOcbbeVY2ZKboFvrDklqA61fm3gOUUbGIpGurydshqM,1232 +torch/utils/model_dump/preact.mjs,sha256=FCb9XuNKpcEpGfo2Vk-0Xrem_mEjEMuAHa48ViJ8R5w,10080 +torch/utils/model_dump/skeleton.html,sha256=HfQCnjnPz6n9HwVKm-kN9tpxlNU18c9V2TMBCIPzxeU,405 +torch/utils/model_zoo.py,sha256=IYGYw6RMBc0ZkJbCnYnSHMScUIJIstopRVNiByTeS6E,119 +torch/utils/module_tracker.py,sha256=55oMFA9dNxICF57kQchQc5TRLmS82ZWPNgIGoZdp0Jg,5594 +torch/utils/serialization/__init__.py,sha256=BX4TNoGsLpWO3SzTVc7H0MtPy4y6Tondm1oskIcBUEg,22 +torch/utils/serialization/__pycache__/__init__.cpython-312.pyc,, +torch/utils/serialization/__pycache__/config.cpython-312.pyc,, +torch/utils/serialization/config.py,sha256=IohXu1uOLMdL1VFBCBL6XIqKPFcOTwgjR1MI9tMy_4Y,679 +torch/utils/show_pickle.py,sha256=5gHSVyX5HVHz4fEVnTxU1KF2jBVRuCVd77n8B3O4uWI,5610 +torch/utils/tensorboard/__init__.py,sha256=VsJEmAeRYGsyXj7FSGn4UlhQIk8LlNI1KLyznx5TNuk,499 +torch/utils/tensorboard/__pycache__/__init__.cpython-312.pyc,, +torch/utils/tensorboard/__pycache__/_convert_np.cpython-312.pyc,, +torch/utils/tensorboard/__pycache__/_embedding.cpython-312.pyc,, +torch/utils/tensorboard/__pycache__/_onnx_graph.cpython-312.pyc,, +torch/utils/tensorboard/__pycache__/_proto_graph.cpython-312.pyc,, +torch/utils/tensorboard/__pycache__/_pytorch_graph.cpython-312.pyc,, +torch/utils/tensorboard/__pycache__/_utils.cpython-312.pyc,, +torch/utils/tensorboard/__pycache__/summary.cpython-312.pyc,, +torch/utils/tensorboard/__pycache__/writer.cpython-312.pyc,, +torch/utils/tensorboard/_convert_np.py,sha256=hvTIbhqnC-5At0a_glQOrgVXVAGnV6l0NWS8yMoze1Y,919 +torch/utils/tensorboard/_embedding.py,sha256=AtjxraZcQvwxGPcIlqpATvV7wtDvcCMke1hC6mDU-f8,3368 +torch/utils/tensorboard/_onnx_graph.py,sha256=Kc5nS8Fi6hNZT1iZfIGg8Otvy4qYiWhTCrh_ywSqbaE,2003 +torch/utils/tensorboard/_proto_graph.py,sha256=LSC-MkVlBgLN8ffuw2UxGBZsURKlLsEyk0aSqQSiJgs,2205 +torch/utils/tensorboard/_pytorch_graph.py,sha256=wDdU5ZkgJUJONXF001DnG4XEYnKcvtb6gAtZxE3js_w,14286 +torch/utils/tensorboard/_utils.py,sha256=kGSq_QwZ8CZcB_dHcU9zVqxsoYLZuOLIYlK6W_lPzIo,4547 +torch/utils/tensorboard/summary.py,sha256=Dw3BBWmCaQREPKiOG0Mycn4X_0ItRSMEH96HoQ2P9TY,37920 +torch/utils/tensorboard/writer.py,sha256=1oO7HwKHuyUPXT4s4Z7cmFMUn6OXdsX7RGvsaKCpJNo,48752 +torch/utils/throughput_benchmark.py,sha256=T3jsM1bfvKQEXJvmeFExSCWYOeyQNyZ_owZ_WrcdOII,6786 +torch/utils/viz/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torch/utils/viz/__pycache__/__init__.cpython-312.pyc,, +torch/utils/viz/__pycache__/_cycles.cpython-312.pyc,, +torch/utils/viz/_cycles.py,sha256=lBYwpW3ILRLO56L9GYphLEGC9HiL3it5K6Ptzxv1kEw,17532 +torch/utils/weak.py,sha256=gA5WYg6_y4zE2nOx1fx3kdxHju6gXI9FlNpEJQLllW4,12634 +torch/version.py,sha256=XlzASyz33y02vz652Bw0iufu4MnDeEmSOlIhIbUrqjk,323 +torch/xpu/__init__.py,sha256=fkVvpKetJ-DOTn1b9u-yNOk3obweWA1IxN7038fL42o,19955 +torch/xpu/__pycache__/__init__.cpython-312.pyc,, +torch/xpu/__pycache__/_gpu_trace.cpython-312.pyc,, +torch/xpu/__pycache__/_utils.cpython-312.pyc,, +torch/xpu/__pycache__/memory.cpython-312.pyc,, +torch/xpu/__pycache__/random.cpython-312.pyc,, +torch/xpu/__pycache__/streams.cpython-312.pyc,, +torch/xpu/_gpu_trace.py,sha256=DRVxYkXWvZpt-Q_ED3x0tTXUAKC56r-74JrrPPFQ7fY,2433 +torch/xpu/_utils.py,sha256=M0jSr-gb8thX6GBTyCew6Zh2BpH01z2N8H26T5QH1RY,1630 +torch/xpu/memory.py,sha256=d65NVMZ0CvguAmtedk8_BWMuQ-mR5QbIko5uy3xUS8o,13504 +torch/xpu/random.py,sha256=blzVdHUFq8k9OiG9SAnhdTpMiZWayqTyRH4oRCImtEo,5458 +torch/xpu/streams.py,sha256=556dNBkmi0Qn2z9NsDwWG8jKl5IFLwZnGrJBiG1rZso,6129 +torchgen/__init__.py,sha256=H-SsfkUmMfiwvWtfi5h_wA6sZ18TnfDDgB_31K0Yt50,358 +torchgen/__pycache__/__init__.cpython-312.pyc,, +torchgen/__pycache__/code_template.cpython-312.pyc,, +torchgen/__pycache__/context.cpython-312.pyc,, +torchgen/__pycache__/gen.cpython-312.pyc,, +torchgen/__pycache__/gen_aoti_c_shim.cpython-312.pyc,, +torchgen/__pycache__/gen_backend_stubs.cpython-312.pyc,, +torchgen/__pycache__/gen_functionalization_type.cpython-312.pyc,, +torchgen/__pycache__/gen_lazy_tensor.cpython-312.pyc,, +torchgen/__pycache__/gen_schema_utils.cpython-312.pyc,, +torchgen/__pycache__/gen_vmap_plumbing.cpython-312.pyc,, +torchgen/__pycache__/local.cpython-312.pyc,, +torchgen/__pycache__/model.cpython-312.pyc,, +torchgen/__pycache__/native_function_generation.cpython-312.pyc,, +torchgen/__pycache__/utils.cpython-312.pyc,, +torchgen/__pycache__/yaml_utils.cpython-312.pyc,, +torchgen/aoti/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torchgen/aoti/__pycache__/__init__.cpython-312.pyc,, +torchgen/aoti/__pycache__/fallback_ops.cpython-312.pyc,, +torchgen/aoti/fallback_ops.py,sha256=tDGD8LcFgfkS_OP2ovBVwngiJSnW7njdBiVDPxfm8us,8460 +torchgen/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torchgen/api/__pycache__/__init__.cpython-312.pyc,, +torchgen/api/__pycache__/autograd.cpython-312.pyc,, +torchgen/api/__pycache__/cpp.cpython-312.pyc,, +torchgen/api/__pycache__/dispatcher.cpython-312.pyc,, +torchgen/api/__pycache__/functionalization.cpython-312.pyc,, +torchgen/api/__pycache__/lazy.cpython-312.pyc,, +torchgen/api/__pycache__/meta.cpython-312.pyc,, +torchgen/api/__pycache__/native.cpython-312.pyc,, +torchgen/api/__pycache__/python.cpython-312.pyc,, +torchgen/api/__pycache__/structured.cpython-312.pyc,, +torchgen/api/__pycache__/translate.cpython-312.pyc,, +torchgen/api/__pycache__/ufunc.cpython-312.pyc,, +torchgen/api/__pycache__/unboxing.cpython-312.pyc,, +torchgen/api/autograd.py,sha256=wEFa6DS2tEFksooNJs5xxj_O6goFgO1h35zsusSq-SI,39833 +torchgen/api/cpp.py,sha256=ef063uW9vxZL6KfG5GKKfdVA9v5OD-YKbNo0ajUgU_A,16748 +torchgen/api/dispatcher.py,sha256=mync3lYG5xKuaeehEcXdabZVV09a3HRRNxVKvL9lgr8,3604 +torchgen/api/functionalization.py,sha256=eTxHP5dfN-XWAaX9xtz0ed8OksZ7K2I0PYInr6q_2dc,8030 +torchgen/api/lazy.py,sha256=j1A6sqn5QzBgMybI_myQRts1Kyd4MDHP5KkgRywEBlQ,17521 +torchgen/api/meta.py,sha256=jtTIUQQvK4WQwYBPiK7CBfH9ih7sYEPYnWlXcjJ7Nvs,496 +torchgen/api/native.py,sha256=pwJQt14yWscGRsOzXtl9Y7CmY-xlmibmkkx2HNg2rq0,5364 +torchgen/api/python.py,sha256=nkwki5yLfJ1ekCQWLgqr8fhgcHA51WWKk0mruBTeu9A,61235 +torchgen/api/structured.py,sha256=VlNYMT8aCGdZZjV9QmJro3yA0CQ4ytMIuO09a5p_C-U,6273 +torchgen/api/translate.py,sha256=qQjNcsYlvUZdrQ70rqxPpDIsKrMEaYyzXJvcZC0M9Oc,19734 +torchgen/api/types/__init__.py,sha256=C99zr_VE5z5WFZKdk93VW3ZN22NT4Hjxib3Pkk9T2VQ,149 +torchgen/api/types/__pycache__/__init__.cpython-312.pyc,, +torchgen/api/types/__pycache__/signatures.cpython-312.pyc,, +torchgen/api/types/__pycache__/types.cpython-312.pyc,, +torchgen/api/types/__pycache__/types_base.cpython-312.pyc,, +torchgen/api/types/signatures.py,sha256=BlZbuBKtEiXlPezeKucx61gns9FZp9BcFAm1Pv_8iWw,13181 +torchgen/api/types/types.py,sha256=P7NoM7aawW9_cvDrbrRHdfJS_jSSfZQS_dkfqJflSrE,6393 +torchgen/api/types/types_base.py,sha256=nKJ1diqqgQjOz_90qbQmwoh20-MrPy_j_lgXBYEOvKA,7422 +torchgen/api/ufunc.py,sha256=_CZftxat-hnDWlLlOHxtgm51BlusVVlWLzDmphJM3fg,6902 +torchgen/api/unboxing.py,sha256=eOLbJ1diUEiUN_xpw050jY1Nc6hUAEuf1kOSaIOOKbA,9622 +torchgen/code_template.py,sha256=IkcE64dLjeXrEHCzgmxzE-N7z-X7HyTwwinPcbjGRd4,3319 +torchgen/context.py,sha256=QDNgqtl5yA2VviDD3WkpQELaO2l-lLMuiiDKNKgugdg,4158 +torchgen/dest/__init__.py,sha256=FbOiYHLsyT0FCZN7MHvnx0kkgdnee4TmmSueeDyqbQY,824 +torchgen/dest/__pycache__/__init__.cpython-312.pyc,, +torchgen/dest/__pycache__/lazy_ir.cpython-312.pyc,, +torchgen/dest/__pycache__/lazy_ts_lowering.cpython-312.pyc,, +torchgen/dest/__pycache__/native_functions.cpython-312.pyc,, +torchgen/dest/__pycache__/register_dispatch_key.cpython-312.pyc,, +torchgen/dest/__pycache__/ufunc.cpython-312.pyc,, +torchgen/dest/lazy_ir.py,sha256=XUWjQi8YpoEng3rE6tMEU5T9LVUX8-4pmqOQFf7hfVE,29697 +torchgen/dest/lazy_ts_lowering.py,sha256=ToSekeRQ09J9NOutqYAgfSxQQyGElWq18oPU_LYzoig,1879 +torchgen/dest/native_functions.py,sha256=RxIu9Jg92XUsNWp5wng8-tb3cafnzFLJRdl2srx66Dk,3255 +torchgen/dest/register_dispatch_key.py,sha256=UaGMCaAHUxCZhVocwpfIRy0fhfhusYNMLD4aeLRg-Rk,42500 +torchgen/dest/ufunc.py,sha256=aZpi7UMvDbB6lHQlCyS9bG5tg3_CDURAeNsawGw3hyM,18390 +torchgen/gen.py,sha256=CjFl-LF5NwGmetW9tsTVsfEUh_fS1ni5znDa1c4JUQc,117315 +torchgen/gen_aoti_c_shim.py,sha256=Eo54A8PAi4csQTnYs_5ubRmUyZ-VpJfQQQcLUi6ijhA,28910 +torchgen/gen_backend_stubs.py,sha256=cbS-xqBLf13KYQUqoZShqHSA8FjuFKn1sUiToC7LdwQ,22999 +torchgen/gen_functionalization_type.py,sha256=p4GEukRfuk04qflUXYWeVTdxBw1ZK6S50KKUT94W_O0,48379 +torchgen/gen_lazy_tensor.py,sha256=ZMzTSs-HkRMXjlx5fX9RGAR50zeK3yk3S8fjINGuyJ0,23315 +torchgen/gen_schema_utils.py,sha256=IFT3h39ejutsAJyp4XIWgs09hVjUd9fEcWs_01yyw98,3380 +torchgen/gen_vmap_plumbing.py,sha256=YfqTWE3mrENSv4MDmTSRYgyACWoaBkgi05IiNqo3n2M,9666 +torchgen/local.py,sha256=KfqAAZvSz2R1I88q-Q3LthJYh7Fgur346eVpOfM-7ww,2229 +torchgen/model.py,sha256=5hPHG7LQpoJCMzeeb1_df2cqcnsQIXjirXNPitDPUXw,117445 +torchgen/native_function_generation.py,sha256=pJSFCzxD8xgrRQ5V26kEVig3Xkvg_HbrmewzFRa7P34,30416 +torchgen/operator_versions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torchgen/operator_versions/__pycache__/__init__.cpython-312.pyc,, +torchgen/operator_versions/__pycache__/gen_mobile_upgraders.cpython-312.pyc,, +torchgen/operator_versions/__pycache__/gen_mobile_upgraders_constant.cpython-312.pyc,, +torchgen/operator_versions/gen_mobile_upgraders.py,sha256=_wgJ6VwBVPiJd_Q3YAlk3ApBMM_l8a-9T_k1_jEkGgY,12767 +torchgen/operator_versions/gen_mobile_upgraders_constant.py,sha256=W57M1HWkrQzY_Vw259_PPBTRH41YVC2fFg5k2Tt_yCA,250 +torchgen/packaged/ATen/native/native_functions.yaml,sha256=FcfHT-Ffg8rMDPex-wM4rNBYTY4CjPEnDrH9WXoNwjU,634212 +torchgen/packaged/ATen/native/tags.yaml,sha256=aOlVObEB8SeV9GbwyUVT0TJn3jBnBLWQ6L4PSguQkew,5607 +torchgen/packaged/ATen/templates/ATenOpList.cpp,sha256=2-bfZSImHz9rcx9v1LjiY1eT-btNz6A5UIMMi-F1i5k,1095 +torchgen/packaged/ATen/templates/CompositeViewCopyKernels.cpp,sha256=S7KFBelXFjlC6rxDimK2F-b5-WquNjJbxP1b_nhP7kk,2150 +torchgen/packaged/ATen/templates/DispatchKeyFunction.h,sha256=ApTWxDG1RjaC5DTjQpxbrkCaQmfWbdxUatDLM3nBP_E,725 +torchgen/packaged/ATen/templates/DispatchKeyFunctions.h,sha256=bW-d7rkZRIqmVkwOl8UmRLtjboz1XLb4nJUJ6ArRjC4,1966 +torchgen/packaged/ATen/templates/DispatchKeyFunctions_inl.h,sha256=ZAL9FVX2z3e-Dy7rFx7LpJ6B4Rgmb1n1zPFKlXjRJ9g,846 +torchgen/packaged/ATen/templates/DispatchKeyNativeFunctions.cpp,sha256=eKjvIeiCkoiG-imx-bdSaSijsa6YCPddR3eQE1H4eyE,197 +torchgen/packaged/ATen/templates/DispatchKeyNativeFunctions.h,sha256=Dc80YgjeS7IKhlrvDbcFfF9dK1gRHKzAoAlDWHZpvGM,403 +torchgen/packaged/ATen/templates/Function.h,sha256=5BsGAqKe4rPVdAe-3M5Y_aPumTGrMY2K6obXKeZPM0A,546 +torchgen/packaged/ATen/templates/FunctionalInverses.h,sha256=_hudozJAIvLyzmYP3sIw1E816Shma7kV5cN1HMr8qKI,820 +torchgen/packaged/ATen/templates/Functions.cpp,sha256=trvL6zZhAQ-VLro5kovAHLYVruOqJUBQ-WjtQJccPIk,3212 +torchgen/packaged/ATen/templates/Functions.h,sha256=v3jG0LZRZZ2t9lsFmwx79Ls4QunpQS7G2PQagOyZm8w,4780 +torchgen/packaged/ATen/templates/LazyIr.h,sha256=o6jbaNUmVesCtDPi6W9REt8_hRrS6svFAe9xHiLwbJs,604 +torchgen/packaged/ATen/templates/LazyNonNativeIr.h,sha256=PKbQsvyOzry_u7iAtUnzKrF04BAXTIYY3zOMSnoDLBc,189 +torchgen/packaged/ATen/templates/MethodOperators.h,sha256=NClKeE6gjJAQpsZQGwOM6WqR3nmZOdIXMWkBi1ZldWE,854 +torchgen/packaged/ATen/templates/NativeFunction.h,sha256=m6DEzxpD_6O3VM_vBiMIM7iKktWt5-Y0CxaJ3LgDFgI,383 +torchgen/packaged/ATen/templates/NativeFunctions.h,sha256=Sbcv1aMyr_7HDs_ZOrHbdgSW7-Df9DHenZ1e7DhMXYo,1182 +torchgen/packaged/ATen/templates/NativeMetaFunction.h,sha256=cGSreOfBl6AZDUPu55pB8KHQBpZy-b9-kp7SZ1N5xLg,475 +torchgen/packaged/ATen/templates/NativeMetaFunctions.h,sha256=4yheSqOheiuuy2esGccOJ0oAyYzhOwyC3_04nrteL-A,325 +torchgen/packaged/ATen/templates/Operator.h,sha256=YHP7ZPqEV0yeCqz7TctBtp7CgDzWLZfcIkkghb16gOk,467 +torchgen/packaged/ATen/templates/Operators.cpp,sha256=bawk3V-uv13iD-ZDflZzzSpkKiVjN-rx22rvqaluYVo,366 +torchgen/packaged/ATen/templates/Operators.h,sha256=lLjk91v_znrZfyQ4-7vqPd2x4Rch9Qj2WuorJOUWdgc,3274 +torchgen/packaged/ATen/templates/RedispatchFunctions.cpp,sha256=cZTM_p-qgCTl6FnXmv4lEFxAshOZ1AyAPSRTdZq2Iqs,322 +torchgen/packaged/ATen/templates/RedispatchFunctions.h,sha256=j3mkCuYJU4Lk6qIUXzeBlF9_Y3Ey1lZvfbRbP_T1SJQ,914 +torchgen/packaged/ATen/templates/RegisterBackendSelect.cpp,sha256=gqG1UAo7Y7TmIxdeSI0snk4XZKMGg_qRsYibtqzGYaQ,781 +torchgen/packaged/ATen/templates/RegisterCodegenUnboxedKernels.cpp,sha256=V_V0w8dRrA4mXBTX_p2bKzy2xa_NceoH0zz4fJRaClg,1160 +torchgen/packaged/ATen/templates/RegisterDispatchDefinitions.ini,sha256=KfseidcHPRLoKSZJcpYSJiZeaNVoR5UvNpdo2Tz63II,477 +torchgen/packaged/ATen/templates/RegisterDispatchKey.cpp,sha256=lEGLddMVcexERssJHbVejxtkPdnAbS3-w0CYeFi_dEo,1527 +torchgen/packaged/ATen/templates/RegisterFunctionalization.cpp,sha256=DsqfYNQQD1mDMRdNzXWCITeqZQT_md-1VELJfYmiQXs,3577 +torchgen/packaged/ATen/templates/RegisterSchema.cpp,sha256=uvGTom__-QBGFWs6mdwiOuAqULY8PtkSQ-W0AVzIgrY,396 +torchgen/packaged/ATen/templates/RegistrationDeclarations.h,sha256=omjHl6z7mF7KpRdd7PKEbHplEHACz0IQC3_x0nvO4vo,164 +torchgen/packaged/ATen/templates/TensorBody.h,sha256=AZ4zI4X9LHwwwCpFmpTwigjxjVQeyP4Sr6hewS2obuw,30023 +torchgen/packaged/ATen/templates/TensorMethods.cpp,sha256=JKGLG8yhCI4oYWGnepE6UdU62hsdezzND6T7Q7itBA4,2674 +torchgen/packaged/ATen/templates/UfuncCPU.cpp,sha256=sNuukoCbDy034J9FalXIP1B49QqkcRqg0nGrKMhzSFE,464 +torchgen/packaged/ATen/templates/UfuncCPUKernel.cpp,sha256=rtFLOYPfpBLyUAIeI_MSgnNMIxpGFvPd-jCtxwQ5gdU,364 +torchgen/packaged/ATen/templates/UfuncCUDA.cu,sha256=9nuaFvMTZlWn4_FdRL4gB886BG7kqS6MEW62s1AhnKg,515 +torchgen/packaged/ATen/templates/UnboxingFunctions.cpp,sha256=U83PTJxwRjKE2tkNzKmigWYHbFLB0a_MIUdWLj8atPY,744 +torchgen/packaged/ATen/templates/UnboxingFunctions.h,sha256=uOkK0X-nci7gucn7MD1c5pL-Fh52I464rOhzYJWHSyg,1058 +torchgen/packaged/ATen/templates/ViewMetaClasses.cpp,sha256=z7HtdJgLdcQRbtyAfMcXdgu19Yl0dpxArgbjJuMwAY0,365 +torchgen/packaged/ATen/templates/ViewMetaClasses.h,sha256=f4nDuVFLlrIQQ7nHRmOeQ7Qxm8CF3i_Eo1obsKmWsqw,245 +torchgen/packaged/ATen/templates/ViewMetaClassesPythonBinding.cpp,sha256=zgUJuommPaahP-saJjv7Gld0GQ1mg_B_1wIZX5iUNgU,303 +torchgen/packaged/ATen/templates/aten_interned_strings.h,sha256=ySu-vkTTqSEIOpgKhCg_v7tJab1eOWBEqKUGBePJr4g,827 +torchgen/packaged/ATen/templates/enum_tag.h,sha256=noIV15PR8ybSfEW7LdykYBK5da9O_NRM8QW-DV6WKlU,189 +torchgen/packaged/autograd/BUILD.bazel,sha256=5k-uc2W6OMFb0NuoB7VA91YyflbdR0YEmApN3V6r5SI,108 +torchgen/packaged/autograd/README.md,sha256=Z_hBdZ0049gw9XLEVrbmrxuEKF59h8pHnEDP3iZZ_aY,150 +torchgen/packaged/autograd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torchgen/packaged/autograd/__pycache__/__init__.cpython-312.pyc,, +torchgen/packaged/autograd/__pycache__/context.cpython-312.pyc,, +torchgen/packaged/autograd/__pycache__/gen_annotated_fn_args.cpython-312.pyc,, +torchgen/packaged/autograd/__pycache__/gen_autograd.cpython-312.pyc,, +torchgen/packaged/autograd/__pycache__/gen_autograd_functions.cpython-312.pyc,, +torchgen/packaged/autograd/__pycache__/gen_inplace_or_view_type.cpython-312.pyc,, +torchgen/packaged/autograd/__pycache__/gen_python_functions.cpython-312.pyc,, +torchgen/packaged/autograd/__pycache__/gen_trace_type.cpython-312.pyc,, +torchgen/packaged/autograd/__pycache__/gen_variable_factories.cpython-312.pyc,, +torchgen/packaged/autograd/__pycache__/gen_variable_type.cpython-312.pyc,, +torchgen/packaged/autograd/__pycache__/gen_view_funcs.cpython-312.pyc,, +torchgen/packaged/autograd/__pycache__/load_derivatives.cpython-312.pyc,, +torchgen/packaged/autograd/build.bzl,sha256=pVEJmlU7wnB6EmjICT8QgSSH9WwHwJ58j4RznTFxYVE,511 +torchgen/packaged/autograd/context.py,sha256=NeUvkCedOmLYzRcIZS_cma6x1aFfckMq9-rQvYh51G0,985 +torchgen/packaged/autograd/deprecated.yaml,sha256=nqwyinCg7yaWqCSYnt2K3e4cN9UhOn4EHnyjHqPbFAA,6384 +torchgen/packaged/autograd/derivatives.yaml,sha256=dVyuoPcEnKKBiQaTru3IzZu0zuwlyLYQuQmSUiXqwxg,186144 +torchgen/packaged/autograd/gen_annotated_fn_args.py,sha256=3ujwdrI7x5rPZuvegMM-K-AQVdqHcvyoUdu8B6ZTHr8,4610 +torchgen/packaged/autograd/gen_autograd.py,sha256=RdGuCFgSWUBk8zRH7LaHA-wzlmOF2iY5n2jFPGuejSk,4764 +torchgen/packaged/autograd/gen_autograd_functions.py,sha256=0_66wdvv2t_HmTeP3UHwAOP0bxmAxTnh8fj1b7LnQh4,39278 +torchgen/packaged/autograd/gen_inplace_or_view_type.py,sha256=KJNmldj2-P4adwf0wLWveTIzovyisxomFY2vBCXuV2U,23388 +torchgen/packaged/autograd/gen_python_functions.py,sha256=pbCJIm90Gij-OMZ3Df08WrT0BJi-45Fx-N6HiLTdTvY,47789 +torchgen/packaged/autograd/gen_trace_type.py,sha256=uyvcAhGPzNEWK03DhldMA15k-QrgQkjBYc_ZQhGNpQk,19559 +torchgen/packaged/autograd/gen_variable_factories.py,sha256=ohsSThgYeGz1DkDjZmkwDEHroFd3tFn5WNKGvd7n4FQ,4595 +torchgen/packaged/autograd/gen_variable_type.py,sha256=Ubs3NlHmcjCn1XyMf72cuKZRjCoQ7TW3ANbiSjPaGtk,86735 +torchgen/packaged/autograd/gen_view_funcs.py,sha256=_IZ2E1angL25yGRYJDit1smJXRpBbD7UyFurJYi3NC0,11928 +torchgen/packaged/autograd/load_derivatives.py,sha256=CrXG0gmxr-gzxMWpQ2IRj03EAKA944tghNE9TnJnpzA,41646 +torchgen/packaged/autograd/templates/ADInplaceOrViewType.cpp,sha256=Y_aTR4cYflFtyBbWYS4ukPk7YVV39GgZbbsXSJFx-PE,828 +torchgen/packaged/autograd/templates/Functions.cpp,sha256=wbbspcHjtkWMoo65sb-oz-v_9a4oeUMjHz182ByPzLA,1522 +torchgen/packaged/autograd/templates/Functions.h,sha256=6SmhZf2IIxPrVvf5xjaoLeCmkBfLLFqnFUhlSOhGXF0,1628 +torchgen/packaged/autograd/templates/TraceType.cpp,sha256=atz5-v313Iyl9rgCfl47_ejuCZfLey1bBwrzXqXaAZc,735 +torchgen/packaged/autograd/templates/VariableType.cpp,sha256=-jD_nXJC34YItzRPZtu-mPyAErGs4YmKf4lbJGR-VBQ,2336 +torchgen/packaged/autograd/templates/VariableType.h,sha256=YR-TpqKjlrG5RHXJx_-XhQiUuI4bmMrm7OR_OhOlAcs,1522 +torchgen/packaged/autograd/templates/ViewFuncs.cpp,sha256=ZaBU6mFMxrFHUV-mJ5C5G-bnMCUJJIERx6mkv6FlA4s,283 +torchgen/packaged/autograd/templates/ViewFuncs.h,sha256=97-ircmuaEKtzul3qUwdmYAS2QdRwCwPYFanyWQ6Y5c,526 +torchgen/packaged/autograd/templates/annotated_fn_args.py.in,sha256=lRK-e23JYHNU9tOhKCPyvHe0VCkfE0oCTHPY870xcms,210 +torchgen/packaged/autograd/templates/python_enum_tag.cpp,sha256=yJ8tkTuDfywePj1rHVMFUAb1W94bLXzvEvcIHl0JFGc,510 +torchgen/packaged/autograd/templates/python_fft_functions.cpp,sha256=hX3IY0ydw_IKpZtItWPAufuPNEb-VnwIPBh7XNCIhH0,2032 +torchgen/packaged/autograd/templates/python_functions.cpp,sha256=9hWIAuGR4McZ3-3eGByN_-Xrs3MarHG3YZc8FX69Ztw,1158 +torchgen/packaged/autograd/templates/python_functions.h,sha256=sPbeuOK7oLweIhgvOSeaiowQoAy4OGT95GwAxo9uprs,362 +torchgen/packaged/autograd/templates/python_linalg_functions.cpp,sha256=Bn0M_Y087pMuOI-2yKIAc4f6zH2j_STCPLeWnbmZunc,1682 +torchgen/packaged/autograd/templates/python_nested_functions.cpp,sha256=jUWc9gx-WTyO1IU3x705D67icWO8zihMd12Q3d02lLM,2110 +torchgen/packaged/autograd/templates/python_nn_functions.cpp,sha256=gb6nXP7vliFyuZLREsv4d0Gs0WFfHs9-pWj63BaLEYQ,3614 +torchgen/packaged/autograd/templates/python_return_types.cpp,sha256=rF1xv6sEAKkT5Qr4fFUulozpXikWddFyakECVq9Sn_I,1271 +torchgen/packaged/autograd/templates/python_return_types.h,sha256=qezAy6s6ZpEt5CfCINVH2Pnjn1sRMZcFa_kCz_7b3GQ,212 +torchgen/packaged/autograd/templates/python_sparse_functions.cpp,sha256=J2mvrC6J71O3iEbob45odDb7uuY8UvvpQSiJRSn8nYg,1618 +torchgen/packaged/autograd/templates/python_special_functions.cpp,sha256=M8gD-seaEjkXjV0Qq4GEURKH_aGWYjPcun8GoMwD2Ek,2051 +torchgen/packaged/autograd/templates/python_torch_functions.cpp,sha256=GiTOx6SYABBjRDQjYbLE1_wZehaEYj6D2L_KqTTTvQA,2694 +torchgen/packaged/autograd/templates/python_variable_methods.cpp,sha256=Vj2ue5Jsy-tAZdj3iL6Jp8rnpaCsC-tVU1GEDfgGg1s,55315 +torchgen/packaged/autograd/templates/variable_factories.h,sha256=QFuWYylBWC-m7MdtD7y_SJV5hb8tLfPIMC6ZVPLy6AI,5772 +torchgen/selective_build/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torchgen/selective_build/__pycache__/__init__.cpython-312.pyc,, +torchgen/selective_build/__pycache__/operator.cpython-312.pyc,, +torchgen/selective_build/__pycache__/selector.cpython-312.pyc,, +torchgen/selective_build/operator.py,sha256=VPNV1L4QRWI2PPbj7-ZTNffNlBcKo0ejtIhU7ACrbbs,6692 +torchgen/selective_build/selector.py,sha256=PQqSTqfo06ancrqAkGnfUEuG9FFaT6jSg3QrUPO47A0,13018 +torchgen/static_runtime/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +torchgen/static_runtime/__pycache__/__init__.cpython-312.pyc,, +torchgen/static_runtime/__pycache__/config.cpython-312.pyc,, +torchgen/static_runtime/__pycache__/gen_static_runtime_ops.cpython-312.pyc,, +torchgen/static_runtime/__pycache__/generator.cpython-312.pyc,, +torchgen/static_runtime/config.py,sha256=jzyW-CalPLeaX8djIxs1uiJgEuBS7NZC7EzTHPVg9rs,14875 +torchgen/static_runtime/gen_static_runtime_ops.py,sha256=VrC4ukDUj_2e7_fD3zCyZXnS54XikBACre2F0vGXc8A,7626 +torchgen/static_runtime/generator.py,sha256=KQc0SilAICJFjnDco0yoCrbX5JKuhjvOZoPL_dgVp2Y,27930 +torchgen/utils.py,sha256=pNPl7OVCxYxwHvXNoYcD3AiZnKP_G8J7zwVVjFnmOaY,17306 +torchgen/yaml_utils.py,sha256=liGsJa9N5rQ41u4RvEd6-1oYbiS1aPThHAKDynPqHnA,1106 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..917a3efd4517348f8cedb802697c7f16e690ab13 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (72.1.0) +Root-Is-Purelib: false +Tag: cp312-cp312-win_amd64 + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..11efe6037bac3676192b5e5d921a88e0f9e59685 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/entry_points.txt @@ -0,0 +1,6 @@ +[console_scripts] +torchfrtrace = torch.distributed.flight_recorder.fr_trace:main +torchrun = torch.distributed.run:main + +[torchrun.logs_specs] +default = torch.distributed.elastic.multiprocessing:DefaultLogsSpecs diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..90d81bec1d35eb3996334268974885a5398b6c6c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch-2.10.0.dist-info/top_level.txt @@ -0,0 +1,3 @@ +functorch +torch +torchgen diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_C.cp312-win_amd64.pyd b/TTS/Kokoro/.venv/Lib/site-packages/torch/_C.cp312-win_amd64.pyd new file mode 100644 index 0000000000000000000000000000000000000000..980891d29a39dc72d5b8cacb39079daca3712201 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/torch/_C.cp312-win_amd64.pyd differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_VF.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_VF.py new file mode 100644 index 0000000000000000000000000000000000000000..af55aff9a215f2b39f57d2cf48ae471343bda66c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_VF.py @@ -0,0 +1,31 @@ +""" +This makes the functions in torch._C._VariableFunctions available as + torch._VF. +without mypy being able to find them. + +A subset of those functions are mapped to ATen functions in +torch/jit/_builtins.py + +See https://github.com/pytorch/pytorch/issues/21478 for the reason for +introducing torch._VF + +""" + +import sys +import types + +import torch + + +class VFModule(types.ModuleType): + vf: types.ModuleType + + def __init__(self, name: str): + super().__init__(name) + self.vf = torch._C._VariableFunctions + + def __getattr__(self, name: str) -> object: + return getattr(self.vf, name) + + +sys.modules[__name__] = VFModule(__name__) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_VF.pyi b/TTS/Kokoro/.venv/Lib/site-packages/torch/_VF.pyi new file mode 100644 index 0000000000000000000000000000000000000000..78d184cc26cf64ed901ceca3fc4eb45a79fe20c4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_VF.pyi @@ -0,0 +1,33783 @@ +# @generated by tools/pyi/gen_pyi.py from torch/_C/_VariableFunctions.pyi.in +# mypy: disable-error-code="type-arg" +# mypy: allow-untyped-defs +# ruff: noqa: F401,PYI054 + +from collections.abc import Callable, Sequence +from types import EllipsisType +from typing import Any, Literal, overload, TypeVar + +import torch +from torch import ( + contiguous_format, + Generator, + inf, + memory_format, + strided, + SymInt, + Tensor, +) +from torch._prims_common import DeviceLikeType +from torch.types import ( + _bool, + _complex, + _device, + _dtype, + _float, + _int, + _layout, + _qscheme, + _size, + Device, + Number, +) + +__all__ = [ + "__and__", + "__lshift__", + "__or__", + "__rshift__", + "__xor__", + "_adaptive_avg_pool2d", + "_adaptive_avg_pool3d", + "_add_batch_dim", + "_add_relu", + "_add_relu_", + "_addmm_activation", + "_aminmax", + "_amp_foreach_non_finite_check_and_unscale_", + "_amp_update_scale_", + "_assert_async", + "_assert_scalar", + "_assert_tensor_metadata", + "_batch_norm_impl_index", + "_cast_Byte", + "_cast_Char", + "_cast_Double", + "_cast_Float", + "_cast_Half", + "_cast_Int", + "_cast_Long", + "_cast_Short", + "_choose_qparams_per_tensor", + "_chunk_cat", + "_coalesce", + "_compute_linear_combination", + "_conj", + "_conj_copy", + "_conj_physical", + "_convert_indices_from_coo_to_csr", + "_convert_indices_from_csr_to_coo", + "_convert_weight_to_int4pack", + "_convert_weight_to_int4pack_for_cpu", + "_convolution", + "_convolution_mode", + "_copy_from", + "_copy_from_and_resize", + "_cslt_compress", + "_cslt_sparse_mm", + "_cslt_sparse_mm_search", + "_ctc_loss", + "_cudnn_ctc_loss", + "_cudnn_init_dropout_state", + "_cudnn_rnn", + "_cudnn_rnn_flatten_weight", + "_cufft_clear_plan_cache", + "_cufft_get_plan_cache_max_size", + "_cufft_get_plan_cache_size", + "_cufft_set_plan_cache_max_size", + "_cummax_helper", + "_cummin_helper", + "_debug_has_internal_overlap", + "_dim_arange", + "_dirichlet_grad", + "_disable_functionalization", + "_dyn_quant_matmul_4bit", + "_dyn_quant_pack_4bit_weight", + "_efficientzerotensor", + "_embedding_bag", + "_embedding_bag_forward_only", + "_empty_affine_quantized", + "_empty_per_channel_affine_quantized", + "_enable_functionalization", + "_euclidean_dist", + "_fake_quantize_learnable_per_channel_affine", + "_fake_quantize_learnable_per_tensor_affine", + "_fake_quantize_per_tensor_affine_cachemask_tensor_qparams", + "_fft_c2c", + "_fft_c2r", + "_fft_r2c", + "_fill_mem_eff_dropout_mask_", + "_foobar", + "_foreach_abs", + "_foreach_abs_", + "_foreach_acos", + "_foreach_acos_", + "_foreach_add", + "_foreach_add_", + "_foreach_addcdiv", + "_foreach_addcdiv_", + "_foreach_addcmul", + "_foreach_addcmul_", + "_foreach_asin", + "_foreach_asin_", + "_foreach_atan", + "_foreach_atan_", + "_foreach_ceil", + "_foreach_ceil_", + "_foreach_clamp_max", + "_foreach_clamp_max_", + "_foreach_clamp_min", + "_foreach_clamp_min_", + "_foreach_copy_", + "_foreach_cos", + "_foreach_cos_", + "_foreach_cosh", + "_foreach_cosh_", + "_foreach_div", + "_foreach_div_", + "_foreach_erf", + "_foreach_erf_", + "_foreach_erfc", + "_foreach_erfc_", + "_foreach_exp", + "_foreach_exp_", + "_foreach_expm1", + "_foreach_expm1_", + "_foreach_floor", + "_foreach_floor_", + "_foreach_frac", + "_foreach_frac_", + "_foreach_lerp", + "_foreach_lerp_", + "_foreach_lgamma", + "_foreach_lgamma_", + "_foreach_log", + "_foreach_log10", + "_foreach_log10_", + "_foreach_log1p", + "_foreach_log1p_", + "_foreach_log2", + "_foreach_log2_", + "_foreach_log_", + "_foreach_max", + "_foreach_maximum", + "_foreach_maximum_", + "_foreach_minimum", + "_foreach_minimum_", + "_foreach_mul", + "_foreach_mul_", + "_foreach_neg", + "_foreach_neg_", + "_foreach_norm", + "_foreach_pow", + "_foreach_pow_", + "_foreach_reciprocal", + "_foreach_reciprocal_", + "_foreach_round", + "_foreach_round_", + "_foreach_rsqrt", + "_foreach_rsqrt_", + "_foreach_sigmoid", + "_foreach_sigmoid_", + "_foreach_sign", + "_foreach_sign_", + "_foreach_sin", + "_foreach_sin_", + "_foreach_sinh", + "_foreach_sinh_", + "_foreach_sqrt", + "_foreach_sqrt_", + "_foreach_sub", + "_foreach_sub_", + "_foreach_tan", + "_foreach_tan_", + "_foreach_tanh", + "_foreach_tanh_", + "_foreach_trunc", + "_foreach_trunc_", + "_foreach_zero_", + "_from_functional_tensor", + "_functional_assert_async", + "_functional_assert_scalar", + "_functional_sym_constrain_range", + "_functional_sym_constrain_range_for_size", + "_functionalize_apply_view_metas", + "_functionalize_are_all_mutations_hidden_from_autograd", + "_functionalize_are_all_mutations_under_no_grad_or_inference_mode", + "_functionalize_commit_update", + "_functionalize_has_metadata_mutation", + "_functionalize_inductor_storage_resized_counter", + "_functionalize_is_symbolic", + "_functionalize_mark_mutation_hidden_from_autograd", + "_functionalize_mark_storage_changed", + "_functionalize_mutation_counter", + "_functionalize_replace", + "_functionalize_storage_changed_counter", + "_functionalize_sync", + "_functionalize_unsafe_set", + "_functionalize_was_inductor_storage_resized", + "_functionalize_was_storage_changed", + "_fused_adagrad_", + "_fused_adam_", + "_fused_adamw_", + "_fused_dropout", + "_fused_moving_avg_obs_fq_helper", + "_fused_rms_norm", + "_fused_sdp_choice", + "_fused_sgd_", + "_fw_primal_copy", + "_grid_sampler_2d_cpu_fallback", + "_grouped_mm", + "_has_compatible_shallow_copy_type", + "_histogramdd_bin_edges", + "_histogramdd_from_bin_cts", + "_histogramdd_from_bin_tensors", + "_index_put_impl_", + "_indices_copy", + "_int_mm", + "_is_all_true", + "_is_any_true", + "_is_functional_tensor", + "_is_functional_tensor_base", + "_is_zerotensor", + "_lazy_clone", + "_linalg_check_errors", + "_linalg_det", + "_linalg_eigh", + "_linalg_slogdet", + "_linalg_solve_ex", + "_linalg_svd", + "_log_softmax", + "_log_softmax_backward_data", + "_logcumsumexp", + "_lstm_mps", + "_lu_with_info", + "_make_dep_token", + "_make_dual", + "_make_dual_copy", + "_make_per_channel_quantized_tensor", + "_make_per_tensor_quantized_tensor", + "_masked_scale", + "_masked_softmax", + "_mixed_dtypes_linear", + "_mkldnn_reshape", + "_mkldnn_transpose", + "_mkldnn_transpose_", + "_mps_convolution", + "_mps_convolution_transpose", + "_native_batch_norm_legit", + "_native_batch_norm_legit_no_training", + "_native_multi_head_attention", + "_neg_view", + "_neg_view_copy", + "_nested_compute_contiguous_strides_offsets", + "_nested_from_padded", + "_nested_from_padded_and_nested_example", + "_nested_from_padded_tensor", + "_nested_get_jagged_dummy", + "_nested_get_lengths", + "_nested_get_max_seqlen", + "_nested_get_min_seqlen", + "_nested_get_offsets", + "_nested_get_ragged_idx", + "_nested_get_values", + "_nested_get_values_copy", + "_nested_tensor_from_mask", + "_nested_tensor_from_mask_left_aligned", + "_nested_tensor_from_tensor_list", + "_nested_tensor_softmax_with_shape", + "_nested_view_from_buffer", + "_nested_view_from_buffer_copy", + "_nested_view_from_jagged", + "_nested_view_from_jagged_copy", + "_nnpack_available", + "_nnpack_spatial_convolution", + "_pack_padded_sequence", + "_pad_packed_sequence", + "_pin_memory", + "_prelu_kernel", + "_print", + "_propagate_xla_data", + "_remove_batch_dim", + "_reshape_alias_copy", + "_reshape_from_tensor", + "_resize_output_", + "_rowwise_prune", + "_safe_softmax", + "_sample_dirichlet", + "_saturate_weight_to_fp16", + "_scaled_dot_product_attention_math", + "_scaled_dot_product_attention_math_for_mps", + "_scaled_dot_product_cudnn_attention", + "_scaled_dot_product_efficient_attention", + "_scaled_dot_product_flash_attention", + "_scaled_dot_product_flash_attention_for_cpu", + "_scaled_grouped_mm", + "_scaled_grouped_mm_v2", + "_scaled_mm", + "_scaled_mm_v2", + "_shape_as_tensor", + "_sobol_engine_draw", + "_sobol_engine_ff_", + "_sobol_engine_initialize_state_", + "_sobol_engine_scramble_", + "_softmax", + "_softmax_backward_data", + "_sparse_broadcast_to", + "_sparse_broadcast_to_copy", + "_sparse_csr_prod", + "_sparse_csr_sum", + "_sparse_log_softmax_backward_data", + "_sparse_semi_structured_addmm", + "_sparse_semi_structured_apply", + "_sparse_semi_structured_apply_dense", + "_sparse_semi_structured_linear", + "_sparse_semi_structured_mm", + "_sparse_semi_structured_tile", + "_sparse_softmax_backward_data", + "_sparse_sparse_matmul", + "_sparse_sum", + "_stack", + "_standard_gamma", + "_standard_gamma_grad", + "_sync", + "_test_autograd_multiple_dispatch", + "_test_autograd_multiple_dispatch_view", + "_test_autograd_multiple_dispatch_view_copy", + "_test_check_tensor", + "_test_functorch_fallback", + "_test_parallel_materialize", + "_test_serialization_subcmul", + "_to_cpu", + "_to_functional_tensor", + "_to_sparse_semi_structured", + "_transform_bias_rescale_qkv", + "_transformer_encoder_layer_fwd", + "_trilinear", + "_triton_multi_head_attention", + "_triton_scaled_dot_attention", + "_unique", + "_unique2", + "_unpack_dual", + "_unsafe_index", + "_unsafe_index_put", + "_unsafe_masked_index", + "_unsafe_masked_index_put_accumulate", + "_use_cudnn_ctc_loss", + "_use_cudnn_rnn_flatten_weight", + "_validate_compressed_sparse_indices", + "_validate_sparse_bsc_tensor_args", + "_validate_sparse_bsr_tensor_args", + "_validate_sparse_compressed_tensor_args", + "_validate_sparse_coo_tensor_args", + "_validate_sparse_csc_tensor_args", + "_validate_sparse_csr_tensor_args", + "_values_copy", + "_weight_int4pack_mm", + "_weight_int4pack_mm_for_cpu", + "_weight_int4pack_mm_with_scales_and_zeros", + "_weight_int8pack_mm", + "_weight_norm", + "_weight_norm_interface", + "_wrapped_linear_prepack", + "_wrapped_quantized_linear_prepacked", + "abs", + "abs_", + "absolute", + "acos", + "acos_", + "acosh", + "acosh_", + "adaptive_avg_pool1d", + "adaptive_max_pool1d", + "add", + "addbmm", + "addcdiv", + "addcmul", + "addmm", + "addmv", + "addmv_", + "addr", + "adjoint", + "affine_grid_generator", + "alias_copy", + "all", + "allclose", + "alpha_dropout", + "alpha_dropout_", + "amax", + "amin", + "aminmax", + "angle", + "any", + "arange", + "arccos", + "arccos_", + "arccosh", + "arccosh_", + "arcsin", + "arcsin_", + "arcsinh", + "arcsinh_", + "arctan", + "arctan2", + "arctan_", + "arctanh", + "arctanh_", + "argmax", + "argmin", + "argsort", + "argwhere", + "as_strided", + "as_strided_", + "as_strided_copy", + "as_strided_scatter", + "as_tensor", + "asarray", + "asin", + "asin_", + "asinh", + "asinh_", + "atan", + "atan2", + "atan_", + "atanh", + "atanh_", + "avg_pool1d", + "baddbmm", + "bartlett_window", + "batch_norm", + "batch_norm_backward_elemt", + "batch_norm_backward_reduce", + "batch_norm_elemt", + "batch_norm_gather_stats", + "batch_norm_gather_stats_with_counts", + "batch_norm_stats", + "batch_norm_update_stats", + "bernoulli", + "bilinear", + "binary_cross_entropy_with_logits", + "bincount", + "binomial", + "bitwise_and", + "bitwise_left_shift", + "bitwise_not", + "bitwise_or", + "bitwise_right_shift", + "bitwise_xor", + "blackman_window", + "bmm", + "broadcast_to", + "bucketize", + "can_cast", + "cat", + "ccol_indices_copy", + "ceil", + "ceil_", + "celu", + "celu_", + "channel_shuffle", + "cholesky", + "cholesky_inverse", + "cholesky_solve", + "choose_qparams_optimized", + "chunk", + "clamp", + "clamp_", + "clamp_max", + "clamp_max_", + "clamp_min", + "clamp_min_", + "clip", + "clip_", + "clone", + "col_indices_copy", + "column_stack", + "combinations", + "complex", + "concat", + "concatenate", + "conj", + "conj_physical", + "conj_physical_", + "constant_pad_nd", + "conv1d", + "conv2d", + "conv3d", + "conv_tbc", + "conv_transpose1d", + "conv_transpose2d", + "conv_transpose3d", + "convolution", + "copysign", + "corrcoef", + "cos", + "cos_", + "cosh", + "cosh_", + "cosine_embedding_loss", + "cosine_similarity", + "count_nonzero", + "cov", + "cross", + "crow_indices_copy", + "ctc_loss", + "cudnn_affine_grid_generator", + "cudnn_batch_norm", + "cudnn_convolution", + "cudnn_convolution_add_relu", + "cudnn_convolution_relu", + "cudnn_convolution_transpose", + "cudnn_grid_sampler", + "cudnn_is_acceptable", + "cummax", + "cummin", + "cumprod", + "cumsum", + "cumulative_trapezoid", + "deg2rad", + "deg2rad_", + "dequantize", + "det", + "detach", + "detach_", + "detach_copy", + "diag", + "diag_embed", + "diagflat", + "diagonal", + "diagonal_copy", + "diagonal_scatter", + "diff", + "digamma", + "dist", + "div", + "divide", + "dot", + "dropout", + "dropout_", + "dsmm", + "dsplit", + "dstack", + "embedding", + "embedding_bag", + "embedding_renorm_", + "empty", + "empty_like", + "empty_permuted", + "empty_quantized", + "empty_strided", + "eq", + "equal", + "erf", + "erf_", + "erfc", + "erfc_", + "erfinv", + "exp", + "exp2", + "exp2_", + "exp_", + "expand_copy", + "expm1", + "expm1_", + "eye", + "fake_quantize_per_channel_affine", + "fake_quantize_per_tensor_affine", + "fbgemm_linear_fp16_weight", + "fbgemm_linear_fp16_weight_fp32_activation", + "fbgemm_linear_int8_weight", + "fbgemm_linear_int8_weight_fp32_activation", + "fbgemm_linear_quantize_weight", + "fbgemm_pack_gemm_matrix_fp16", + "fbgemm_pack_quantized_matrix", + "feature_alpha_dropout", + "feature_alpha_dropout_", + "feature_dropout", + "feature_dropout_", + "fill", + "fill_", + "fix", + "fix_", + "flatten", + "flip", + "fliplr", + "flipud", + "float_power", + "floor", + "floor_", + "floor_divide", + "fmax", + "fmin", + "fmod", + "frac", + "frac_", + "frexp", + "frobenius_norm", + "from_file", + "from_numpy", + "frombuffer", + "full", + "full_like", + "fused_moving_avg_obs_fake_quant", + "gather", + "gcd", + "gcd_", + "ge", + "geqrf", + "ger", + "get_default_dtype", + "get_num_interop_threads", + "get_num_threads", + "gradient", + "greater", + "greater_equal", + "grid_sampler", + "grid_sampler_2d", + "grid_sampler_3d", + "group_norm", + "gru", + "gru_cell", + "gt", + "hamming_window", + "hann_window", + "hardshrink", + "hash_tensor", + "heaviside", + "hinge_embedding_loss", + "histc", + "histogram", + "histogramdd", + "hsmm", + "hsplit", + "hspmm", + "hstack", + "hypot", + "i0", + "i0_", + "igamma", + "igammac", + "imag", + "index_add", + "index_copy", + "index_fill", + "index_put", + "index_put_", + "index_reduce", + "index_select", + "indices_copy", + "init_num_threads", + "inner", + "instance_norm", + "int_repr", + "inverse", + "is_complex", + "is_conj", + "is_distributed", + "is_floating_point", + "is_grad_enabled", + "is_inference", + "is_inference_mode_enabled", + "is_neg", + "is_nonzero", + "is_same_size", + "is_signed", + "is_vulkan_available", + "isclose", + "isfinite", + "isin", + "isinf", + "isnan", + "isneginf", + "isposinf", + "isreal", + "istft", + "kaiser_window", + "kl_div", + "kron", + "kthvalue", + "layer_norm", + "lcm", + "lcm_", + "ldexp", + "ldexp_", + "le", + "lerp", + "less", + "less_equal", + "lgamma", + "linspace", + "log", + "log10", + "log10_", + "log1p", + "log1p_", + "log2", + "log2_", + "log_", + "log_softmax", + "logaddexp", + "logaddexp2", + "logcumsumexp", + "logdet", + "logical_and", + "logical_not", + "logical_or", + "logical_xor", + "logit", + "logit_", + "logspace", + "logsumexp", + "lstm", + "lstm_cell", + "lt", + "lu_solve", + "lu_unpack", + "margin_ranking_loss", + "masked_fill", + "masked_scatter", + "masked_select", + "matmul", + "matrix_exp", + "matrix_power", + "max", + "max_pool1d", + "max_pool1d_with_indices", + "max_pool2d", + "max_pool3d", + "maximum", + "mean", + "median", + "min", + "minimum", + "miopen_batch_norm", + "miopen_convolution", + "miopen_convolution_add_relu", + "miopen_convolution_relu", + "miopen_convolution_transpose", + "miopen_depthwise_convolution", + "miopen_rnn", + "mkldnn_adaptive_avg_pool2d", + "mkldnn_convolution", + "mkldnn_linear_backward_weights", + "mkldnn_max_pool2d", + "mkldnn_max_pool3d", + "mkldnn_rnn_layer", + "mm", + "mode", + "moveaxis", + "movedim", + "msort", + "mul", + "multinomial", + "multiply", + "mv", + "mvlgamma", + "nan_to_num", + "nan_to_num_", + "nanmean", + "nanmedian", + "nanquantile", + "nansum", + "narrow", + "narrow_copy", + "native_batch_norm", + "native_channel_shuffle", + "native_dropout", + "native_group_norm", + "native_layer_norm", + "native_norm", + "ne", + "neg", + "neg_", + "negative", + "negative_", + "nextafter", + "nonzero", + "nonzero_static", + "norm_except_dim", + "normal", + "not_equal", + "nuclear_norm", + "numel", + "ones", + "ones_like", + "orgqr", + "ormqr", + "outer", + "pairwise_distance", + "pdist", + "permute", + "permute_copy", + "pinverse", + "pixel_shuffle", + "pixel_unshuffle", + "poisson", + "poisson_nll_loss", + "polar", + "polygamma", + "positive", + "pow", + "prelu", + "prod", + "promote_types", + "put", + "q_per_channel_axis", + "q_per_channel_scales", + "q_per_channel_zero_points", + "q_scale", + "q_zero_point", + "qr", + "quantile", + "quantize_per_channel", + "quantize_per_tensor", + "quantize_per_tensor_dynamic", + "quantized_batch_norm", + "quantized_gru_cell", + "quantized_lstm_cell", + "quantized_max_pool1d", + "quantized_max_pool2d", + "quantized_max_pool3d", + "quantized_rnn_relu_cell", + "quantized_rnn_tanh_cell", + "rad2deg", + "rad2deg_", + "rand", + "rand_like", + "randint", + "randint_like", + "randn", + "randn_like", + "randperm", + "range", + "ravel", + "real", + "reciprocal", + "reciprocal_", + "relu", + "relu_", + "remainder", + "renorm", + "repeat_interleave", + "reshape", + "resize_as_", + "resize_as_sparse_", + "resolve_conj", + "resolve_neg", + "result_type", + "rms_norm", + "rnn_relu", + "rnn_relu_cell", + "rnn_tanh", + "rnn_tanh_cell", + "roll", + "rot90", + "round", + "round_", + "row_indices_copy", + "row_stack", + "rrelu", + "rrelu_", + "rsqrt", + "rsqrt_", + "rsub", + "saddmm", + "scalar_tensor", + "scatter", + "scatter_add", + "scatter_reduce", + "searchsorted", + "segment_reduce", + "select", + "select_copy", + "select_scatter", + "selu", + "selu_", + "set_flush_denormal", + "set_num_interop_threads", + "set_num_threads", + "sgn", + "sigmoid", + "sigmoid_", + "sign", + "signbit", + "sin", + "sin_", + "sinc", + "sinc_", + "sinh", + "sinh_", + "slice_copy", + "slice_inverse", + "slice_scatter", + "slogdet", + "smm", + "softmax", + "sort", + "sparse_bsc_tensor", + "sparse_bsr_tensor", + "sparse_compressed_tensor", + "sparse_coo_tensor", + "sparse_csc_tensor", + "sparse_csr_tensor", + "split_copy", + "split_with_sizes", + "split_with_sizes_copy", + "spmm", + "sqrt", + "sqrt_", + "square", + "square_", + "squeeze", + "squeeze_copy", + "sspaddmm", + "stack", + "std", + "std_mean", + "sub", + "subtract", + "sum", + "svd", + "swapaxes", + "swapdims", + "sym_constrain_range", + "sym_constrain_range_for_size", + "t", + "t_copy", + "take", + "take_along_dim", + "tan", + "tan_", + "tanh", + "tanh_", + "tensor", + "tensor_split", + "threshold", + "threshold_", + "tile", + "topk", + "trace", + "transpose", + "transpose_copy", + "trapezoid", + "trapz", + "triangular_solve", + "tril", + "tril_indices", + "triplet_margin_loss", + "triu", + "triu_indices", + "true_divide", + "trunc", + "trunc_", + "unbind", + "unbind_copy", + "unflatten", + "unfold_copy", + "unique_dim", + "unsafe_chunk", + "unsafe_split", + "unsafe_split_with_sizes", + "unsqueeze", + "unsqueeze_copy", + "values_copy", + "vander", + "var", + "var_mean", + "vdot", + "view_as_complex", + "view_as_complex_copy", + "view_as_real", + "view_as_real_copy", + "view_copy", + "vsplit", + "vstack", + "where", + "xlogy", + "xlogy_", + "zero_", + "zeros", + "zeros_like", +] + +@overload +def __and__(input: Tensor, other: Tensor) -> Tensor: ... +@overload +def __and__(input: Tensor, other: Number | _complex) -> Tensor: ... +@overload +def __lshift__(input: Tensor, other: Tensor) -> Tensor: ... +@overload +def __lshift__(input: Tensor, other: Number | _complex) -> Tensor: ... +@overload +def __or__(input: Tensor, other: Tensor) -> Tensor: ... +@overload +def __or__(input: Tensor, other: Number | _complex) -> Tensor: ... +@overload +def __rshift__(input: Tensor, other: Tensor) -> Tensor: ... +@overload +def __rshift__(input: Tensor, other: Number | _complex) -> Tensor: ... +@overload +def __xor__(input: Tensor, other: Tensor) -> Tensor: ... +@overload +def __xor__(input: Tensor, other: Number | _complex) -> Tensor: ... +def _adaptive_avg_pool2d( + input: Tensor, + output_size: _int | SymInt | Sequence[_int | SymInt], +) -> Tensor: ... +def _adaptive_avg_pool3d( + input: Tensor, + output_size: _int | SymInt | Sequence[_int | SymInt], +) -> Tensor: ... +def _add_batch_dim(input: Tensor, batch_dim: _int, level: _int) -> Tensor: ... +@overload +def _add_relu( + input: Tensor, + other: Tensor, + *, + alpha: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: ... +@overload +def _add_relu( + input: Tensor, + other: Number | _complex, + alpha: Number | _complex = 1, +) -> Tensor: ... +@overload +def _add_relu_( + input: Tensor, + other: Tensor, + *, + alpha: Number | _complex = 1, +) -> Tensor: ... +@overload +def _add_relu_( + input: Tensor, + other: Number | _complex, + alpha: Number | _complex = 1, +) -> Tensor: ... +def _addmm_activation( + input: Tensor, + mat1: Tensor, + mat2: Tensor, + *, + beta: Number | _complex = 1, + alpha: Number | _complex = 1, + use_gelu: _bool = False, + out: Tensor | None = None, +) -> Tensor: ... +@overload +def _aminmax(input: Tensor) -> tuple[Tensor, Tensor]: ... +@overload +def _aminmax( + input: Tensor, + dim: _int, + keepdim: _bool = False, +) -> tuple[Tensor, Tensor]: ... +def _amp_foreach_non_finite_check_and_unscale_( + self: tuple[Tensor, ...] | list[Tensor] | None, + found_inf: Tensor, + inv_scale: Tensor, +) -> None: ... +def _amp_update_scale_( + input: Tensor, + growth_tracker: Tensor, + found_inf: Tensor, + scale_growth_factor: _float, + scale_backoff_factor: _float, + growth_interval: _int, +) -> Tensor: ... +@overload +def _assert_async(input: Tensor) -> None: + r""" + _assert_async(tensor) -> void + + Asynchronously assert that the contents of tensor are nonzero. For CPU tensors, + this is equivalent to ``assert tensor`` or ``assert tensor.is_nonzero()``; for + CUDA tensors, we DO NOT synchronize and you may only find out the assertion + failed at a later CUDA kernel launch. Asynchronous assertion can be helpful for + testing invariants in CUDA tensors without giving up performance. This function + is NOT intended to be used for regular error checking, as it will trash your CUDA + context if the assert fails (forcing you to restart your PyTorch process.) + + Args: + tensor (Tensor): a one element tensor to test to see if it is nonzero. Zero + elements (including False for boolean tensors) cause an assertion failure + to be raised. + """ + +@overload +def _assert_async(input: Tensor, assert_msg: str) -> None: + r""" + _assert_async(tensor) -> void + + Asynchronously assert that the contents of tensor are nonzero. For CPU tensors, + this is equivalent to ``assert tensor`` or ``assert tensor.is_nonzero()``; for + CUDA tensors, we DO NOT synchronize and you may only find out the assertion + failed at a later CUDA kernel launch. Asynchronous assertion can be helpful for + testing invariants in CUDA tensors without giving up performance. This function + is NOT intended to be used for regular error checking, as it will trash your CUDA + context if the assert fails (forcing you to restart your PyTorch process.) + + Args: + tensor (Tensor): a one element tensor to test to see if it is nonzero. Zero + elements (including False for boolean tensors) cause an assertion failure + to be raised. + """ + +def _assert_scalar(self: Number | _complex, assert_msg: str) -> None: ... +def _assert_tensor_metadata( + a: Tensor, + size: Sequence[_int | SymInt] | None = None, + stride: Sequence[_int | SymInt] | None = None, + dtype: _dtype | None = None, + *, + device: DeviceLikeType | None = None, + layout: _layout | None = None, +) -> None: ... +def _batch_norm_impl_index( + input: Tensor, + weight: Tensor | None, + bias: Tensor | None, + running_mean: Tensor | None, + running_var: Tensor | None, + training: _bool, + momentum: _float, + eps: _float, + cudnn_enabled: _bool, +) -> tuple[Tensor, Tensor, Tensor, Tensor, _int]: ... +def _cast_Byte(input: Tensor, non_blocking: _bool = False) -> Tensor: ... +def _cast_Char(input: Tensor, non_blocking: _bool = False) -> Tensor: ... +def _cast_Double(input: Tensor, non_blocking: _bool = False) -> Tensor: ... +def _cast_Float(input: Tensor, non_blocking: _bool = False) -> Tensor: ... +def _cast_Half(input: Tensor, non_blocking: _bool = False) -> Tensor: ... +def _cast_Int(input: Tensor, non_blocking: _bool = False) -> Tensor: ... +def _cast_Long(input: Tensor, non_blocking: _bool = False) -> Tensor: ... +def _cast_Short(input: Tensor, non_blocking: _bool = False) -> Tensor: ... +def _choose_qparams_per_tensor( + input: Tensor, + reduce_range: _bool = False, +) -> tuple[_float, _int]: ... +def _chunk_cat( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + dim: _int, + num_chunks: _int, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _coalesce(input: Tensor) -> Tensor: ... +def _compute_linear_combination( + input: Tensor, + coefficients: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _conj(input: Tensor) -> Tensor: ... +def _conj_copy(input: Tensor, *, out: Tensor | None = None) -> Tensor: ... +def _conj_physical(input: Tensor) -> Tensor: ... +def _convert_indices_from_coo_to_csr( + input: Tensor, + size: _int, + *, + out_int32: _bool = False, + out: Tensor | None = None, +) -> Tensor: ... +def _convert_indices_from_csr_to_coo( + crow_indices: Tensor, + col_indices: Tensor, + *, + out_int32: _bool = False, + transpose: _bool = False, + out: Tensor | None = None, +) -> Tensor: ... +def _convert_weight_to_int4pack(input: Tensor, innerKTiles: _int) -> Tensor: ... +def _convert_weight_to_int4pack_for_cpu( + input: Tensor, + innerKTiles: _int, +) -> Tensor: ... +@overload +def _convolution( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + stride: Sequence[_int | SymInt], + padding: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + transposed: _bool, + output_padding: _size, + groups: _int | SymInt, + benchmark: _bool, + deterministic: _bool, + cudnn_enabled: _bool, +) -> Tensor: ... +@overload +def _convolution( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + stride: Sequence[_int | SymInt], + padding: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + transposed: _bool, + output_padding: Sequence[_int | SymInt], + groups: _int | SymInt, + benchmark: _bool, + deterministic: _bool, + cudnn_enabled: _bool, + allow_tf32: _bool, +) -> Tensor: ... +def _convolution_mode( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + stride: Sequence[_int | SymInt], + padding: str, + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, +) -> Tensor: ... +def _copy_from( + input: Tensor, + dst: Tensor, + non_blocking: _bool = False, +) -> Tensor: ... +def _copy_from_and_resize(input: Tensor, dst: Tensor) -> Tensor: ... +def _cslt_compress(input: Tensor) -> Tensor: ... +def _cslt_sparse_mm( + compressed_A: Tensor, + dense_B: Tensor, + bias: Tensor | None = None, + alpha: Tensor | None = None, + out_dtype: _dtype | None = None, + transpose_result: _bool = False, + alg_id: _int = 0, + split_k: _int = 1, + split_k_mode: _int = -1, +) -> Tensor: ... +def _cslt_sparse_mm_search( + compressed_A: Tensor, + dense_B: Tensor, + bias: Tensor | None = None, + alpha: Tensor | None = None, + out_dtype: _dtype | None = None, + transpose_result: _bool = False, +) -> _int: ... +@overload +def _ctc_loss( + log_probs: Tensor, + targets: Tensor, + input_lengths: _size, + target_lengths: _size, + blank: _int = 0, + zero_infinity: _bool = False, +) -> tuple[Tensor, Tensor]: ... +@overload +def _ctc_loss( + log_probs: Tensor, + targets: Tensor, + input_lengths: Tensor, + target_lengths: Tensor, + blank: _int = 0, + zero_infinity: _bool = False, +) -> tuple[Tensor, Tensor]: ... +@overload +def _cudnn_ctc_loss( + log_probs: Tensor, + targets: Tensor, + input_lengths: _size, + target_lengths: _size, + blank: _int, + deterministic: _bool, + zero_infinity: _bool, +) -> tuple[Tensor, Tensor]: ... +@overload +def _cudnn_ctc_loss( + log_probs: Tensor, + targets: Tensor, + input_lengths: Tensor, + target_lengths: Tensor, + blank: _int, + deterministic: _bool, + zero_infinity: _bool, +) -> tuple[Tensor, Tensor]: ... +def _cudnn_init_dropout_state( + dropout: _float, + train: _bool, + dropout_seed: _int, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: ... +def _cudnn_rnn( + input: Tensor, + weight: tuple[Tensor, ...] | list[Tensor] | None, + weight_stride0: _int, + weight_buf: Tensor | None, + hx: Tensor, + cx: Tensor | None, + mode: _int, + hidden_size: _int | SymInt, + proj_size: _int | SymInt, + num_layers: _int, + batch_first: _bool, + dropout: _float, + train: _bool, + bidirectional: _bool, + batch_sizes: Sequence[_int | SymInt], + dropout_state: Tensor | None, +) -> tuple[Tensor, Tensor, Tensor, Tensor, Tensor]: ... +def _cudnn_rnn_flatten_weight( + weight_arr: tuple[Tensor, ...] | list[Tensor] | None, + weight_stride0: _int, + input_size: _int | SymInt, + mode: _int, + hidden_size: _int | SymInt, + proj_size: _int | SymInt, + num_layers: _int, + batch_first: _bool, + bidirectional: _bool, +) -> Tensor: ... +def _cufft_clear_plan_cache(device_index: _int) -> None: ... +def _cufft_get_plan_cache_max_size(device_index: _int) -> _int: ... +def _cufft_get_plan_cache_size(device_index: _int) -> _int: ... +def _cufft_set_plan_cache_max_size( + device_index: _int, + max_size: _int, +) -> None: ... +def _cummax_helper( + input: Tensor, + values: Tensor, + indices: Tensor, + dim: _int, +) -> None: ... +def _cummin_helper( + input: Tensor, + values: Tensor, + indices: Tensor, + dim: _int, +) -> None: ... +def _debug_has_internal_overlap(input: Tensor) -> _int: ... +def _dim_arange(like: Tensor, dim: _int) -> Tensor: ... +def _dirichlet_grad(x: Tensor, alpha: Tensor, total: Tensor) -> Tensor: ... +def _disable_functionalization(): ... +def _dyn_quant_matmul_4bit( + inp: Tensor, + packed_weights: Tensor, + block_size: _int, + in_features: _int, + out_features: _int, +) -> Tensor: ... +def _dyn_quant_pack_4bit_weight( + weights: Tensor, + scales_zeros: Tensor, + bias: Tensor | None, + block_size: _int, + in_features: _int, + out_features: _int, +) -> Tensor: ... +@overload +def _efficientzerotensor( + size: Sequence[_int | SymInt], + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: ... +@overload +def _efficientzerotensor( + *size: _int | SymInt, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: ... +def _embedding_bag( + weight: Tensor, + indices: Tensor, + offsets: Tensor, + scale_grad_by_freq: _bool = False, + mode: _int = 0, + sparse: _bool = False, + per_sample_weights: Tensor | None = None, + include_last_offset: _bool = False, + padding_idx: _int = -1, +) -> tuple[Tensor, Tensor, Tensor, Tensor]: ... +def _embedding_bag_forward_only( + weight: Tensor, + indices: Tensor, + offsets: Tensor, + scale_grad_by_freq: _bool = False, + mode: _int = 0, + sparse: _bool = False, + per_sample_weights: Tensor | None = None, + include_last_offset: _bool = False, + padding_idx: _int = -1, +) -> tuple[Tensor, Tensor, Tensor, Tensor]: ... +@overload +def _empty_affine_quantized( + size: Sequence[_int | SymInt], + *, + scale: _float = 1, + zero_point: _int = 0, + memory_format: memory_format | None = contiguous_format, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: ... +@overload +def _empty_affine_quantized( + *size: _int | SymInt, + scale: _float = 1, + zero_point: _int = 0, + memory_format: memory_format | None = contiguous_format, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: ... +@overload +def _empty_per_channel_affine_quantized( + size: Sequence[_int | SymInt], + *, + scales: Tensor, + zero_points: Tensor, + axis: _int, + memory_format: memory_format | None = contiguous_format, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: ... +@overload +def _empty_per_channel_affine_quantized( + *size: _int | SymInt, + scales: Tensor, + zero_points: Tensor, + axis: _int, + memory_format: memory_format | None = contiguous_format, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: ... +def _enable_functionalization(*, reapply_views: _bool = False) -> None: ... +def _euclidean_dist(x1: Tensor, x2: Tensor) -> Tensor: ... +def _fake_quantize_learnable_per_channel_affine( + input: Tensor, + scale: Tensor, + zero_point: Tensor, + axis: _int, + quant_min: _int, + quant_max: _int, + grad_factor: _float = 1.0, +) -> Tensor: ... +def _fake_quantize_learnable_per_tensor_affine( + input: Tensor, + scale: Tensor, + zero_point: Tensor, + quant_min: _int, + quant_max: _int, + grad_factor: _float = 1.0, +) -> Tensor: ... +def _fake_quantize_per_tensor_affine_cachemask_tensor_qparams( + input: Tensor, + scale: Tensor, + zero_point: Tensor, + fake_quant_enabled: Tensor, + quant_min: _int, + quant_max: _int, +) -> torch.return_types._fake_quantize_per_tensor_affine_cachemask_tensor_qparams: # fmt: skip + ... +def _fft_c2c( + input: Tensor, + dim: Sequence[_int | SymInt], + normalization: _int, + forward: _bool, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _fft_c2r( + input: Tensor, + dim: _size, + normalization: _int, + last_dim_size: _int | SymInt, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _fft_r2c( + input: Tensor, + dim: _size, + normalization: _int, + onesided: _bool, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _fill_mem_eff_dropout_mask_( + input: Tensor, + dropout_p: _float, + seed: _int, + offset: _int, +) -> Tensor: ... +def _foobar( + input: Tensor, + arg1: _bool = True, + arg2: _bool = True, + *, + arg3: _bool = True, +) -> Tensor: ... +def _foreach_abs( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_abs(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.abs` to each Tensor of the input list. + """ + +def _foreach_abs_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_abs_(self: List[Tensor]) -> None + + Apply :func:`torch.abs` to each Tensor of the input list. + """ + +def _foreach_acos( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_acos(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.acos` to each Tensor of the input list. + """ + +def _foreach_acos_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_acos_(self: List[Tensor]) -> None + + Apply :func:`torch.acos` to each Tensor of the input list. + """ + +@overload +def _foreach_add( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_add( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, + *, + alpha: Number | _complex = 1, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_add( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: Tensor, + *, + alpha: Number | _complex = 1, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_add( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_add_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> None: ... +@overload +def _foreach_add_( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, + *, + alpha: Number | _complex = 1, +) -> None: ... +@overload +def _foreach_add_( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: Tensor, + *, + alpha: Number | _complex = 1, +) -> None: ... +@overload +def _foreach_add_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> None: ... +@overload +def _foreach_addcdiv( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensor1: tuple[Tensor, ...] | list[Tensor] | None, + tensor2: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_addcdiv( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensor1: tuple[Tensor, ...] | list[Tensor] | None, + tensor2: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Tensor, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_addcdiv( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensor1: tuple[Tensor, ...] | list[Tensor] | None, + tensor2: tuple[Tensor, ...] | list[Tensor] | None, + value: Number | _complex = 1, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_addcdiv_( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensor1: tuple[Tensor, ...] | list[Tensor] | None, + tensor2: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> None: ... +@overload +def _foreach_addcdiv_( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensor1: tuple[Tensor, ...] | list[Tensor] | None, + tensor2: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Tensor, +) -> None: ... +@overload +def _foreach_addcdiv_( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensor1: tuple[Tensor, ...] | list[Tensor] | None, + tensor2: tuple[Tensor, ...] | list[Tensor] | None, + value: Number | _complex = 1, +) -> None: ... +@overload +def _foreach_addcmul( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensor1: tuple[Tensor, ...] | list[Tensor] | None, + tensor2: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_addcmul( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensor1: tuple[Tensor, ...] | list[Tensor] | None, + tensor2: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Tensor, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_addcmul( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensor1: tuple[Tensor, ...] | list[Tensor] | None, + tensor2: tuple[Tensor, ...] | list[Tensor] | None, + value: Number | _complex = 1, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_addcmul_( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensor1: tuple[Tensor, ...] | list[Tensor] | None, + tensor2: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> None: ... +@overload +def _foreach_addcmul_( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensor1: tuple[Tensor, ...] | list[Tensor] | None, + tensor2: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Tensor, +) -> None: ... +@overload +def _foreach_addcmul_( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensor1: tuple[Tensor, ...] | list[Tensor] | None, + tensor2: tuple[Tensor, ...] | list[Tensor] | None, + value: Number | _complex = 1, +) -> None: ... +def _foreach_asin( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_asin(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.asin` to each Tensor of the input list. + """ + +def _foreach_asin_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_asin_(self: List[Tensor]) -> None + + Apply :func:`torch.asin` to each Tensor of the input list. + """ + +def _foreach_atan( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_atan(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.atan` to each Tensor of the input list. + """ + +def _foreach_atan_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_atan_(self: List[Tensor]) -> None + + Apply :func:`torch.atan` to each Tensor of the input list. + """ + +def _foreach_ceil( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_ceil(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.ceil` to each Tensor of the input list. + """ + +def _foreach_ceil_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_ceil_(self: List[Tensor]) -> None + + Apply :func:`torch.ceil` to each Tensor of the input list. + """ + +@overload +def _foreach_clamp_max( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_clamp_max( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_clamp_max( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_clamp_max_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> None: ... +@overload +def _foreach_clamp_max_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> None: ... +@overload +def _foreach_clamp_max_( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, +) -> None: ... +@overload +def _foreach_clamp_min( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_clamp_min( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_clamp_min( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_clamp_min_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> None: ... +@overload +def _foreach_clamp_min_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> None: ... +@overload +def _foreach_clamp_min_( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, +) -> None: ... +def _foreach_copy_( + self: tuple[Tensor, ...] | list[Tensor] | None, + src: tuple[Tensor, ...] | list[Tensor] | None, + non_blocking: _bool = False, +) -> None: ... +def _foreach_cos( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_cos(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.cos` to each Tensor of the input list. + """ + +def _foreach_cos_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_cos_(self: List[Tensor]) -> None + + Apply :func:`torch.cos` to each Tensor of the input list. + """ + +def _foreach_cosh( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_cosh(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.cosh` to each Tensor of the input list. + """ + +def _foreach_cosh_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_cosh_(self: List[Tensor]) -> None + + Apply :func:`torch.cosh` to each Tensor of the input list. + """ + +@overload +def _foreach_div( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_div( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: Tensor, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_div( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_div( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_div_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> None: ... +@overload +def _foreach_div_( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: Tensor, +) -> None: ... +@overload +def _foreach_div_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> None: ... +@overload +def _foreach_div_( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, +) -> None: ... +def _foreach_erf( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_erf(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.erf` to each Tensor of the input list. + """ + +def _foreach_erf_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_erf_(self: List[Tensor]) -> None + + Apply :func:`torch.erf` to each Tensor of the input list. + """ + +def _foreach_erfc( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_erfc(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.erfc` to each Tensor of the input list. + """ + +def _foreach_erfc_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_erfc_(self: List[Tensor]) -> None + + Apply :func:`torch.erfc` to each Tensor of the input list. + """ + +def _foreach_exp( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_exp(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.exp` to each Tensor of the input list. + """ + +def _foreach_exp_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_exp_(self: List[Tensor]) -> None + + Apply :func:`torch.exp` to each Tensor of the input list. + """ + +def _foreach_expm1( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_expm1(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.expm1` to each Tensor of the input list. + """ + +def _foreach_expm1_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_expm1_(self: List[Tensor]) -> None + + Apply :func:`torch.expm1` to each Tensor of the input list. + """ + +def _foreach_floor( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_floor(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.floor` to each Tensor of the input list. + """ + +def _foreach_floor_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_floor_(self: List[Tensor]) -> None + + Apply :func:`torch.floor` to each Tensor of the input list. + """ + +def _foreach_frac( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_frac(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.frac` to each Tensor of the input list. + """ + +def _foreach_frac_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_frac_(self: List[Tensor]) -> None + + Apply :func:`torch.frac` to each Tensor of the input list. + """ + +@overload +def _foreach_lerp( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensors1: tuple[Tensor, ...] | list[Tensor] | None, + weight: Number | _complex, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_lerp( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensors1: tuple[Tensor, ...] | list[Tensor] | None, + weight: Sequence[Number | _complex], +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_lerp( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensors1: tuple[Tensor, ...] | list[Tensor] | None, + weights: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_lerp_( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensors1: tuple[Tensor, ...] | list[Tensor] | None, + weight: Number | _complex, +) -> None: ... +@overload +def _foreach_lerp_( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensors1: tuple[Tensor, ...] | list[Tensor] | None, + weight: Sequence[Number | _complex], +) -> None: ... +@overload +def _foreach_lerp_( + self: tuple[Tensor, ...] | list[Tensor] | None, + tensors1: tuple[Tensor, ...] | list[Tensor] | None, + weights: tuple[Tensor, ...] | list[Tensor] | None, +) -> None: ... +def _foreach_lgamma( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_lgamma(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.lgamma` to each Tensor of the input list. + """ + +def _foreach_lgamma_( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> None: + r""" + _foreach_lgamma_(self: List[Tensor]) -> None + + Apply :func:`torch.lgamma` to each Tensor of the input list. + """ + +def _foreach_log( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_log(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.log` to each Tensor of the input list. + """ + +def _foreach_log10( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_log10(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.log10` to each Tensor of the input list. + """ + +def _foreach_log10_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_log10_(self: List[Tensor]) -> None + + Apply :func:`torch.log10` to each Tensor of the input list. + """ + +def _foreach_log1p( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_log1p(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.log1p` to each Tensor of the input list. + """ + +def _foreach_log1p_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_log1p_(self: List[Tensor]) -> None + + Apply :func:`torch.log1p` to each Tensor of the input list. + """ + +def _foreach_log2( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_log2(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.log2` to each Tensor of the input list. + """ + +def _foreach_log2_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_log2_(self: List[Tensor]) -> None + + Apply :func:`torch.log2` to each Tensor of the input list. + """ + +def _foreach_log_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_log_(self: List[Tensor]) -> None + + Apply :func:`torch.log` to each Tensor of the input list. + """ + +def _foreach_max( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_maximum( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_maximum( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_maximum( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_maximum_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> None: ... +@overload +def _foreach_maximum_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> None: ... +@overload +def _foreach_maximum_( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, +) -> None: ... +@overload +def _foreach_minimum( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_minimum( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_minimum( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_minimum_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> None: ... +@overload +def _foreach_minimum_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> None: ... +@overload +def _foreach_minimum_( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, +) -> None: ... +@overload +def _foreach_mul( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_mul( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: Tensor, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_mul( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_mul( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_mul_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> None: ... +@overload +def _foreach_mul_( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: Tensor, +) -> None: ... +@overload +def _foreach_mul_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> None: ... +@overload +def _foreach_mul_( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, +) -> None: ... +def _foreach_neg( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_neg(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.neg` to each Tensor of the input list. + """ + +def _foreach_neg_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_neg_(self: List[Tensor]) -> None + + Apply :func:`torch.neg` to each Tensor of the input list. + """ + +def _foreach_norm( + self: tuple[Tensor, ...] | list[Tensor] | None, + ord: Number | _complex = 2, + dtype: _dtype | None = None, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_pow( + self: tuple[Tensor, ...] | list[Tensor] | None, + exponent: Sequence[Number | _complex], +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_pow( + self: tuple[Tensor, ...] | list[Tensor] | None, + exponent: Number | _complex, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_pow( + self: tuple[Tensor, ...] | list[Tensor] | None, + exponent: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_pow( + self: Number | _complex, + exponent: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_pow_( + self: tuple[Tensor, ...] | list[Tensor] | None, + exponent: Sequence[Number | _complex], +) -> None: ... +@overload +def _foreach_pow_( + self: tuple[Tensor, ...] | list[Tensor] | None, + exponent: Number | _complex, +) -> None: ... +@overload +def _foreach_pow_( + self: tuple[Tensor, ...] | list[Tensor] | None, + exponent: tuple[Tensor, ...] | list[Tensor] | None, +) -> None: ... +def _foreach_reciprocal( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_reciprocal(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.reciprocal` to each Tensor of the input list. + """ + +def _foreach_reciprocal_( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> None: + r""" + _foreach_reciprocal_(self: List[Tensor]) -> None + + Apply :func:`torch.reciprocal` to each Tensor of the input list. + """ + +def _foreach_round( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_round(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.round` to each Tensor of the input list. + """ + +def _foreach_round_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_round_(self: List[Tensor]) -> None + + Apply :func:`torch.round` to each Tensor of the input list. + """ + +def _foreach_rsqrt( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +def _foreach_rsqrt_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: ... +def _foreach_sigmoid( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_sigmoid(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.sigmoid` to each Tensor of the input list. + """ + +def _foreach_sigmoid_( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> None: + r""" + _foreach_sigmoid_(self: List[Tensor]) -> None + + Apply :func:`torch.sigmoid` to each Tensor of the input list. + """ + +def _foreach_sign( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +def _foreach_sign_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: ... +def _foreach_sin( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_sin(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.sin` to each Tensor of the input list. + """ + +def _foreach_sin_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_sin_(self: List[Tensor]) -> None + + Apply :func:`torch.sin` to each Tensor of the input list. + """ + +def _foreach_sinh( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_sinh(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.sinh` to each Tensor of the input list. + """ + +def _foreach_sinh_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_sinh_(self: List[Tensor]) -> None + + Apply :func:`torch.sinh` to each Tensor of the input list. + """ + +def _foreach_sqrt( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_sqrt(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.sqrt` to each Tensor of the input list. + """ + +def _foreach_sqrt_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_sqrt_(self: List[Tensor]) -> None + + Apply :func:`torch.sqrt` to each Tensor of the input list. + """ + +@overload +def _foreach_sub( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_sub( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, + *, + alpha: Number | _complex = 1, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_sub( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> tuple[Tensor, ...]: ... +@overload +def _foreach_sub_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalars: Sequence[Number | _complex], +) -> None: ... +@overload +def _foreach_sub_( + self: tuple[Tensor, ...] | list[Tensor] | None, + other: tuple[Tensor, ...] | list[Tensor] | None, + *, + alpha: Number | _complex = 1, +) -> None: ... +@overload +def _foreach_sub_( + self: tuple[Tensor, ...] | list[Tensor] | None, + scalar: Number | _complex, +) -> None: ... +def _foreach_tan( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_tan(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.tan` to each Tensor of the input list. + """ + +def _foreach_tan_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_tan_(self: List[Tensor]) -> None + + Apply :func:`torch.tan` to each Tensor of the input list. + """ + +def _foreach_tanh( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_tanh(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.tanh` to each Tensor of the input list. + """ + +def _foreach_tanh_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_tanh_(self: List[Tensor]) -> None + + Apply :func:`torch.tanh` to each Tensor of the input list. + """ + +def _foreach_trunc( + self: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + _foreach_trunc(self: List[Tensor]) -> List[Tensor] + + Apply :func:`torch.trunc` to each Tensor of the input list. + """ + +def _foreach_trunc_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_trunc_(self: List[Tensor]) -> None + + Apply :func:`torch.trunc` to each Tensor of the input list. + """ + +def _foreach_zero_(self: tuple[Tensor, ...] | list[Tensor] | None) -> None: + r""" + _foreach_zero_(self: List[Tensor]) -> None + + Apply :func:`torch.zero` to each Tensor of the input list. + """ + +def _from_functional_tensor(t: Tensor) -> Tensor: ... +def _functional_assert_async( + input: Tensor, + assert_msg: str, + dep_token: Tensor, +) -> Tensor: ... +def _functional_assert_scalar( + self: Number | _complex, + assert_msg: str, + dep_token: Tensor, +) -> Tensor: ... +def _functional_sym_constrain_range( + size: Number | _complex, + min: _int | None, + max: _int | None, + dep_token: Tensor, +) -> Tensor: ... +def _functional_sym_constrain_range_for_size( + size: Number | _complex, + min: _int | None, + max: _int | None, + dep_token: Tensor, +) -> Tensor: ... +def _functionalize_apply_view_metas(tensor: Tensor, base: Tensor) -> Tensor: ... +def _functionalize_are_all_mutations_hidden_from_autograd( + t: Tensor, +) -> _bool: ... +def _functionalize_are_all_mutations_under_no_grad_or_inference_mode( + t: Tensor, +) -> _bool: ... +def _functionalize_commit_update(t: Tensor) -> None: ... +def _functionalize_has_metadata_mutation(tensor: Tensor) -> _bool: ... +def _functionalize_inductor_storage_resized_counter(t: Tensor) -> _int: ... +def _functionalize_is_symbolic(tensor: Tensor) -> _bool: ... +def _functionalize_mark_mutation_hidden_from_autograd(t: Tensor) -> None: ... +def _functionalize_mark_storage_changed(tensor: Tensor) -> _bool: ... +def _functionalize_mutation_counter(t: Tensor) -> _int: ... +def _functionalize_replace(self_: Tensor, other: Tensor) -> None: ... +def _functionalize_storage_changed_counter(t: Tensor) -> _int: ... +def _functionalize_sync(t: Tensor) -> None: ... +def _functionalize_unsafe_set(dst: Tensor, src: Tensor) -> None: ... +def _functionalize_was_inductor_storage_resized(t: Tensor) -> _bool: ... +def _functionalize_was_storage_changed(tensor: Tensor) -> _bool: ... +@overload +def _fused_adagrad_( + self: tuple[Tensor, ...] | list[Tensor] | None, + grads: tuple[Tensor, ...] | list[Tensor] | None, + state_sums: tuple[Tensor, ...] | list[Tensor] | None, + state_steps: tuple[Tensor, ...] | list[Tensor] | None, + *, + lr: Tensor, + lr_decay: _float, + weight_decay: _float, + eps: _float, + maximize: _bool, + grad_scale: Tensor | None = None, + found_inf: Tensor | None = None, +) -> None: ... +@overload +def _fused_adagrad_( + self: tuple[Tensor, ...] | list[Tensor] | None, + grads: tuple[Tensor, ...] | list[Tensor] | None, + state_sums: tuple[Tensor, ...] | list[Tensor] | None, + state_steps: tuple[Tensor, ...] | list[Tensor] | None, + *, + lr: _float, + lr_decay: _float, + weight_decay: _float, + eps: _float, + maximize: _bool, + grad_scale: Tensor | None = None, + found_inf: Tensor | None = None, +) -> None: ... +@overload +def _fused_adam_( + self: tuple[Tensor, ...] | list[Tensor] | None, + grads: tuple[Tensor, ...] | list[Tensor] | None, + exp_avgs: tuple[Tensor, ...] | list[Tensor] | None, + exp_avg_sqs: tuple[Tensor, ...] | list[Tensor] | None, + max_exp_avg_sqs: tuple[Tensor, ...] | list[Tensor] | None, + state_steps: tuple[Tensor, ...] | list[Tensor] | None, + *, + lr: Tensor, + beta1: _float, + beta2: _float, + weight_decay: _float, + eps: _float, + amsgrad: _bool, + maximize: _bool, + grad_scale: Tensor | None = None, + found_inf: Tensor | None = None, +) -> None: ... +@overload +def _fused_adam_( + self: tuple[Tensor, ...] | list[Tensor] | None, + grads: tuple[Tensor, ...] | list[Tensor] | None, + exp_avgs: tuple[Tensor, ...] | list[Tensor] | None, + exp_avg_sqs: tuple[Tensor, ...] | list[Tensor] | None, + max_exp_avg_sqs: tuple[Tensor, ...] | list[Tensor] | None, + state_steps: tuple[Tensor, ...] | list[Tensor] | None, + *, + lr: _float, + beta1: _float, + beta2: _float, + weight_decay: _float, + eps: _float, + amsgrad: _bool, + maximize: _bool, + grad_scale: Tensor | None = None, + found_inf: Tensor | None = None, +) -> None: ... +@overload +def _fused_adamw_( + self: tuple[Tensor, ...] | list[Tensor] | None, + grads: tuple[Tensor, ...] | list[Tensor] | None, + exp_avgs: tuple[Tensor, ...] | list[Tensor] | None, + exp_avg_sqs: tuple[Tensor, ...] | list[Tensor] | None, + max_exp_avg_sqs: tuple[Tensor, ...] | list[Tensor] | None, + state_steps: tuple[Tensor, ...] | list[Tensor] | None, + *, + lr: Tensor, + beta1: _float, + beta2: _float, + weight_decay: _float, + eps: _float, + amsgrad: _bool, + maximize: _bool, + grad_scale: Tensor | None = None, + found_inf: Tensor | None = None, +) -> None: ... +@overload +def _fused_adamw_( + self: tuple[Tensor, ...] | list[Tensor] | None, + grads: tuple[Tensor, ...] | list[Tensor] | None, + exp_avgs: tuple[Tensor, ...] | list[Tensor] | None, + exp_avg_sqs: tuple[Tensor, ...] | list[Tensor] | None, + max_exp_avg_sqs: tuple[Tensor, ...] | list[Tensor] | None, + state_steps: tuple[Tensor, ...] | list[Tensor] | None, + *, + lr: _float, + beta1: _float, + beta2: _float, + weight_decay: _float, + eps: _float, + amsgrad: _bool, + maximize: _bool, + grad_scale: Tensor | None = None, + found_inf: Tensor | None = None, +) -> None: ... +def _fused_dropout( + input: Tensor, + p: _float, + generator: Generator | None = None, +) -> tuple[Tensor, Tensor]: ... +def _fused_moving_avg_obs_fq_helper( + input: Tensor, + observer_on: Tensor, + fake_quant_on: Tensor, + running_min: Tensor, + running_max: Tensor, + scale: Tensor, + zero_point: Tensor, + averaging_const: _float, + quant_min: _int, + quant_max: _int, + ch_axis: _int, + per_row_fake_quant: _bool = False, + symmetric_quant: _bool = False, +) -> torch.return_types._fused_moving_avg_obs_fq_helper: ... +def _fused_rms_norm( + input: Tensor, + normalized_shape: _size, + weight: Tensor | None, + eps: _float | None, +) -> tuple[Tensor, Tensor]: ... +def _fused_sdp_choice( + query: Tensor, + key: Tensor, + value: Tensor, + attn_mask: Tensor | None = None, + dropout_p: _float = 0.0, + is_causal: _bool = False, + *, + scale: _float | None = None, + enable_gqa: _bool = False, +) -> _int: ... +@overload +def _fused_sgd_( + self: tuple[Tensor, ...] | list[Tensor] | None, + grads: tuple[Tensor, ...] | list[Tensor] | None, + momentum_buffer_list: tuple[Tensor, ...] | list[Tensor] | None, + *, + weight_decay: _float, + momentum: _float, + lr: Tensor, + dampening: _float, + nesterov: _bool, + maximize: _bool, + is_first_step: _bool, + grad_scale: Tensor | None = None, + found_inf: Tensor | None = None, +) -> None: ... +@overload +def _fused_sgd_( + self: tuple[Tensor, ...] | list[Tensor] | None, + grads: tuple[Tensor, ...] | list[Tensor] | None, + momentum_buffer_list: tuple[Tensor, ...] | list[Tensor] | None, + *, + weight_decay: _float, + momentum: _float, + lr: _float, + dampening: _float, + nesterov: _bool, + maximize: _bool, + is_first_step: _bool, + grad_scale: Tensor | None = None, + found_inf: Tensor | None = None, +) -> None: ... +def _fw_primal_copy( + input: Tensor, + level: _int, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _grid_sampler_2d_cpu_fallback( + input: Tensor, + grid: Tensor, + interpolation_mode: _int, + padding_mode: _int, + align_corners: _bool, +) -> Tensor: ... +def _grouped_mm( + input: Tensor, + mat2: Tensor, + offs: Tensor | None = None, + bias: Tensor | None = None, + out_dtype: _dtype | None = None, +) -> Tensor: ... +def _has_compatible_shallow_copy_type( + input: Tensor, + from_: Tensor, +) -> _bool: ... +def _histogramdd_bin_edges( + input: Tensor, + bins: _size, + *, + range: Sequence[_float] | None = None, + weight: Tensor | None = None, + density: _bool = False, +) -> tuple[Tensor, ...]: ... +def _histogramdd_from_bin_cts( + input: Tensor, + bins: _size, + *, + range: Sequence[_float] | None = None, + weight: Tensor | None = None, + density: _bool = False, +) -> Tensor: ... +def _histogramdd_from_bin_tensors( + input: Tensor, + bins: tuple[Tensor, ...] | list[Tensor] | None, + *, + weight: Tensor | None = None, + density: _bool = False, +) -> Tensor: ... +def _index_put_impl_( + input: Tensor, + indices: tuple[Tensor, ...] | list[Tensor] | None, + values: Tensor, + accumulate: _bool = False, + unsafe: _bool = False, +) -> Tensor: ... +def _indices_copy(input: Tensor, *, out: Tensor | None = None) -> Tensor: ... +def _int_mm( + input: Tensor, + mat2: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _is_all_true(input: Tensor) -> Tensor: ... +def _is_any_true(input: Tensor) -> Tensor: ... +def _is_functional_tensor(t: Tensor) -> _bool: ... +def _is_functional_tensor_base(t: Tensor) -> _bool: ... +def _is_zerotensor(input: Tensor) -> _bool: ... +def _lazy_clone(input: Tensor) -> Tensor: ... +def _linalg_check_errors( + info: Tensor, + api_name: str, + *, + is_matrix: _bool, +) -> None: ... +def _linalg_det( + A: Tensor, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types._linalg_det: ... +def _linalg_eigh( + A: Tensor, + UPLO: str = "L", + compute_v: _bool = True, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types._linalg_eigh: ... +def _linalg_slogdet( + A: Tensor, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types._linalg_slogdet: ... +def _linalg_solve_ex( + A: Tensor, + B: Tensor, + *, + left: _bool = True, + check_errors: _bool = False, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types._linalg_solve_ex: ... +def _linalg_svd( + A: Tensor, + full_matrices: _bool = False, + compute_uv: _bool = True, + *, + driver: str | None = None, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types._linalg_svd: ... +def _log_softmax( + input: Tensor, + dim: _int, + half_to_float: _bool, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _log_softmax_backward_data( + grad_output: Tensor, + output: Tensor, + dim: _int, + input_dtype: _dtype, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _logcumsumexp( + input: Tensor, + dim: _int, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _lstm_mps( + input: Tensor, + hx: tuple[Tensor, ...] | list[Tensor] | None, + params: tuple[Tensor, ...] | list[Tensor] | None, + has_biases: _bool, + num_layers: _int, + dropout: _float, + train: _bool, + bidirectional: _bool, + batch_first: _bool, +) -> tuple[Tensor, Tensor, Tensor, Tensor, Tensor, Tensor]: ... +def _lu_with_info( + input: Tensor, + pivot: _bool = True, + check_errors: _bool = True, +) -> torch.return_types._lu_with_info: ... +def _make_dep_token( + *, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: ... +def _make_dual(primal: Tensor, tangent: Tensor, level: _int) -> Tensor: ... +def _make_dual_copy( + primal: Tensor, + tangent: Tensor, + level: _int, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _make_per_channel_quantized_tensor( + input: Tensor, + scale: Tensor, + zero_point: Tensor, + axis: _int, +) -> Tensor: ... +def _make_per_tensor_quantized_tensor( + input: Tensor, + scale: _float, + zero_point: _int, +) -> Tensor: ... +def _masked_scale(input: Tensor, mask: Tensor, scale: _float) -> Tensor: ... +def _masked_softmax( + input: Tensor, + mask: Tensor, + dim: _int | None = None, + mask_type: _int | None = None, +) -> Tensor: ... +def _mixed_dtypes_linear( + input: Tensor, + weight: Tensor, + scale: Tensor, + *, + bias: Tensor | None = None, + activation: str | None = None, +) -> Tensor: ... +def _mkldnn_reshape(input: Tensor, shape: _size) -> Tensor: ... +def _mkldnn_transpose(input: Tensor, dim0: _int, dim1: _int) -> Tensor: ... +def _mkldnn_transpose_(input: Tensor, dim0: _int, dim1: _int) -> Tensor: ... +def _mps_convolution( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + padding: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, +) -> Tensor: ... +def _mps_convolution_transpose( + input: Tensor, + weight: Tensor, + padding: Sequence[_int | SymInt], + output_padding: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, +) -> Tensor: ... +@overload +def _native_batch_norm_legit( + input: Tensor, + weight: Tensor | None, + bias: Tensor | None, + running_mean: Tensor, + running_var: Tensor, + training: _bool, + momentum: _float, + eps: _float, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> tuple[Tensor, Tensor, Tensor]: ... +@overload +def _native_batch_norm_legit( + input: Tensor, + weight: Tensor | None, + bias: Tensor | None, + training: _bool, + momentum: _float, + eps: _float, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> tuple[Tensor, Tensor, Tensor]: ... +def _native_batch_norm_legit_no_training( + input: Tensor, + weight: Tensor | None, + bias: Tensor | None, + running_mean: Tensor, + running_var: Tensor, + momentum: _float, + eps: _float, +) -> tuple[Tensor, Tensor, Tensor]: ... +def _native_multi_head_attention( + query: Tensor, + key: Tensor, + value: Tensor, + embed_dim: _int, + num_head: _int, + qkv_weight: Tensor, + qkv_bias: Tensor, + proj_weight: Tensor, + proj_bias: Tensor, + mask: Tensor | None = None, + need_weights: _bool = True, + average_attn_weights: _bool = True, + mask_type: _int | None = None, +) -> tuple[Tensor, Tensor]: ... +def _neg_view(input: Tensor) -> Tensor: ... +def _neg_view_copy(input: Tensor, *, out: Tensor | None = None) -> Tensor: ... +def _nested_compute_contiguous_strides_offsets( + nested_size: Tensor, +) -> tuple[Tensor, Tensor]: ... +def _nested_from_padded( + padded: Tensor, + cpu_nested_shape_example: Tensor, + fuse_transform_0213: _bool = False, +) -> Tensor: ... +def _nested_from_padded_and_nested_example( + padded: Tensor, + nt_example: Tensor, +) -> Tensor: ... +def _nested_from_padded_tensor( + padded: Tensor, + offsets: Tensor, + dummy: Tensor, + ragged_idx: _int = 1, + min_seqlen: Tensor | None = None, + max_seqlen: Tensor | None = None, + sum_S: _int | SymInt | None = None, +) -> Tensor: ... +def _nested_get_jagged_dummy(any: Tensor) -> Tensor: ... +def _nested_get_lengths(input: Tensor) -> Tensor: ... +def _nested_get_max_seqlen(input: Tensor) -> Tensor: ... +def _nested_get_min_seqlen(input: Tensor) -> Tensor: ... +def _nested_get_offsets(input: Tensor) -> Tensor: ... +def _nested_get_ragged_idx(input: Tensor) -> _int: ... +def _nested_get_values(input: Tensor) -> Tensor: ... +def _nested_get_values_copy( + input: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _nested_tensor_from_mask( + t: Tensor, + mask: Tensor, + mask_check: _bool = True, +) -> Tensor: ... +def _nested_tensor_from_mask_left_aligned(t: Tensor, mask: Tensor) -> _bool: ... +def _nested_tensor_from_tensor_list( + list: tuple[Tensor, ...] | list[Tensor] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = None, +) -> Tensor: ... +def _nested_tensor_softmax_with_shape( + input: Tensor, + query: Tensor, +) -> Tensor: ... +def _nested_view_from_buffer( + input: Tensor, + nested_size: Tensor, + nested_strides: Tensor, + offsets: Tensor, +) -> Tensor: ... +def _nested_view_from_buffer_copy( + input: Tensor, + nested_size: Tensor, + nested_strides: Tensor, + offsets: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _nested_view_from_jagged( + input: Tensor, + offsets: Tensor, + dummy: Tensor, + lengths: Tensor | None = None, + ragged_idx: _int = 1, + min_seqlen: Tensor | None = None, + max_seqlen: Tensor | None = None, +) -> Tensor: ... +def _nested_view_from_jagged_copy( + input: Tensor, + offsets: Tensor, + dummy: Tensor, + lengths: Tensor | None = None, + ragged_idx: _int = 1, + min_seqlen: Tensor | None = None, + max_seqlen: Tensor | None = None, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _nnpack_available() -> _bool: ... +def _nnpack_spatial_convolution( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + padding: _int | SymInt | Sequence[_int | SymInt], + stride: _int | SymInt | Sequence[_int | SymInt] = 1, +) -> Tensor: ... +def _pack_padded_sequence( + input: Tensor, + lengths: Tensor, + batch_first: _bool, +) -> tuple[Tensor, Tensor]: ... +def _pad_packed_sequence( + data: Tensor, + batch_sizes: Tensor, + batch_first: _bool, + padding_value: Number | _complex, + total_length: _int, +) -> tuple[Tensor, Tensor]: ... +def _pin_memory( + input: Tensor, + device: DeviceLikeType | None = None, +) -> Tensor: ... +def _prelu_kernel(input: Tensor, weight: Tensor) -> Tensor: ... +def _print(s: str) -> None: ... +def _propagate_xla_data(input: Tensor, output: Tensor) -> None: ... +def _remove_batch_dim( + input: Tensor, + level: _int, + batch_size: _int | SymInt, + out_dim: _int, +) -> Tensor: ... +def _reshape_alias_copy( + input: Tensor, + size: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + *, + out: Tensor | None = None, +) -> Tensor: ... +def _reshape_from_tensor(input: Tensor, shape: Tensor) -> Tensor: ... +def _resize_output_( + input: Tensor, + size: Sequence[_int | SymInt], + device: DeviceLikeType | None, +) -> Tensor: ... +def _rowwise_prune( + weight: Tensor, + mask: Tensor, + compressed_indices_dtype: _dtype, +) -> tuple[Tensor, Tensor]: ... +def _safe_softmax( + input: Tensor, + dim: _int, + dtype: _dtype | None = None, +) -> Tensor: ... +def _sample_dirichlet( + input: Tensor, + generator: Generator | None = None, +) -> Tensor: ... +def _saturate_weight_to_fp16(weight: Tensor) -> Tensor: ... +def _scaled_dot_product_attention_math( + query: Tensor, + key: Tensor, + value: Tensor, + attn_mask: Tensor | None = None, + dropout_p: _float = 0.0, + is_causal: _bool = False, + dropout_mask: Tensor | None = None, + *, + scale: _float | None = None, + enable_gqa: _bool = False, +) -> tuple[Tensor, Tensor]: ... +def _scaled_dot_product_attention_math_for_mps( + query: Tensor, + key: Tensor, + value: Tensor, + attn_mask: Tensor | None = None, + dropout_p: _float = 0.0, + is_causal: _bool = False, + dropout_mask: Tensor | None = None, + *, + scale: _float | None = None, +) -> tuple[Tensor, Tensor]: ... +def _scaled_dot_product_cudnn_attention( + query: Tensor, + key: Tensor, + value: Tensor, + attn_bias: Tensor | None, + compute_log_sumexp: _bool, + dropout_p: _float = 0.0, + is_causal: _bool = False, + return_debug_mask: _bool = False, + *, + scale: _float | None = None, +) -> torch.return_types._scaled_dot_product_cudnn_attention: ... +def _scaled_dot_product_efficient_attention( + query: Tensor, + key: Tensor, + value: Tensor, + attn_bias: Tensor | None, + compute_log_sumexp: _bool, + dropout_p: _float = 0.0, + is_causal: _bool = False, + *, + scale: _float | None = None, +) -> torch.return_types._scaled_dot_product_efficient_attention: ... +def _scaled_dot_product_flash_attention( + query: Tensor, + key: Tensor, + value: Tensor, + dropout_p: _float = 0.0, + is_causal: _bool = False, + return_debug_mask: _bool = False, + *, + scale: _float | None = None, +) -> torch.return_types._scaled_dot_product_flash_attention: ... +def _scaled_dot_product_flash_attention_for_cpu( + query: Tensor, + key: Tensor, + value: Tensor, + dropout_p: _float = 0.0, + is_causal: _bool = False, + *, + attn_mask: Tensor | None = None, + scale: _float | None = None, +) -> torch.return_types._scaled_dot_product_flash_attention_for_cpu: ... +def _scaled_grouped_mm( + input: Tensor, + mat2: Tensor, + scale_a: Tensor, + scale_b: Tensor, + offs: Tensor | None = None, + bias: Tensor | None = None, + scale_result: Tensor | None = None, + out_dtype: _dtype | None = None, + use_fast_accum: _bool = False, +) -> Tensor: ... +def _scaled_grouped_mm_v2( + input: Tensor, + mat2: Tensor, + scale_a: tuple[Tensor, ...] | list[Tensor] | None, + recipe_a: _size, + swizzle_a: _size, + scale_b: tuple[Tensor, ...] | list[Tensor] | None, + recipe_b: _size, + swizzle_b: _size, + offs: Tensor | None = None, + bias: Tensor | None = None, + out_dtype: _dtype | None = None, + contraction_dim: _size = (), + use_fast_accum: _bool = False, +) -> Tensor: ... +def _scaled_mm( + input: Tensor, + mat2: Tensor, + scale_a: Tensor, + scale_b: Tensor, + bias: Tensor | None = None, + scale_result: Tensor | None = None, + out_dtype: _dtype | None = None, + use_fast_accum: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _scaled_mm_v2( + input: Tensor, + mat2: Tensor, + scale_a: tuple[Tensor, ...] | list[Tensor] | None, + recipe_a: _size, + swizzle_a: _size, + scale_b: tuple[Tensor, ...] | list[Tensor] | None, + recipe_b: _size, + swizzle_b: _size, + bias: Tensor | None, + out_dtype: _dtype | None, + contraction_dim: _size = (), + use_fast_accum: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _shape_as_tensor(input: Tensor) -> Tensor: ... +def _sobol_engine_draw( + quasi: Tensor, + n: _int, + sobolstate: Tensor, + dimension: _int, + num_generated: _int, + dtype: _dtype | None, +) -> tuple[Tensor, Tensor]: ... +def _sobol_engine_ff_( + input: Tensor, + n: _int, + sobolstate: Tensor, + dimension: _int, + num_generated: _int, +) -> Tensor: ... +def _sobol_engine_initialize_state_( + input: Tensor, + dimension: _int, +) -> Tensor: ... +def _sobol_engine_scramble_( + input: Tensor, + ltm: Tensor, + dimension: _int, +) -> Tensor: ... +def _softmax( + input: Tensor, + dim: _int, + half_to_float: _bool, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _softmax_backward_data( + grad_output: Tensor, + output: Tensor, + dim: _int, + input_dtype: _dtype, + *, + grad_input: Tensor | None = None, +) -> Tensor: ... +def _sparse_broadcast_to(input: Tensor, size: _size) -> Tensor: ... +def _sparse_broadcast_to_copy( + input: Tensor, + size: _size, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _sparse_csr_prod( + input: Tensor, + dim: _int | _size, + keepdim: _bool = False, + *, + dtype: _dtype | None = None, +) -> Tensor: ... +def _sparse_csr_sum( + input: Tensor, + dim: _int | _size, + keepdim: _bool = False, + *, + dtype: _dtype | None = None, +) -> Tensor: ... +def _sparse_log_softmax_backward_data( + grad_output: Tensor, + output: Tensor, + dim: _int, + input: Tensor, +) -> Tensor: ... +def _sparse_semi_structured_addmm( + input: Tensor, + mat1: Tensor, + mat1_meta: Tensor, + mat2: Tensor, + *, + alpha: Number | _complex = 1, + beta: Number | _complex = 1, + out_dtype: _dtype | None = None, +) -> Tensor: ... +def _sparse_semi_structured_apply( + input: Tensor, + thread_masks: Tensor, +) -> tuple[Tensor, Tensor]: ... +def _sparse_semi_structured_apply_dense( + input: Tensor, + thread_masks: Tensor, +) -> Tensor: ... +def _sparse_semi_structured_linear( + input: Tensor, + weight: Tensor, + meta: Tensor, + *, + bias: Tensor | None = None, + activation: str | None = None, + out_dtype: _dtype | None = None, +) -> Tensor: ... +def _sparse_semi_structured_mm( + mat1: Tensor, + mat1_meta: Tensor, + mat2: Tensor, + *, + out_dtype: _dtype | None = None, +) -> Tensor: ... +def _sparse_semi_structured_tile( + input: Tensor, + algorithm: str = "", + use_cutlass: _bool = True, +) -> tuple[Tensor, Tensor, Tensor, Tensor, Tensor]: ... +def _sparse_softmax_backward_data( + grad_output: Tensor, + output: Tensor, + dim: _int, + input: Tensor, +) -> Tensor: ... +def _sparse_sparse_matmul(input: Tensor, other: Tensor) -> Tensor: ... +@overload +def _sparse_sum(input: Tensor) -> Tensor: ... +@overload +def _sparse_sum(input: Tensor, *, dtype: _dtype) -> Tensor: ... +@overload +def _sparse_sum(input: Tensor, dim: _int | _size) -> Tensor: ... +@overload +def _sparse_sum( + input: Tensor, + dim: _int | _size, + *, + dtype: _dtype, +) -> Tensor: ... +def _stack( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + dim: _int = 0, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _standard_gamma( + input: Tensor, + generator: Generator | None = None, +) -> Tensor: ... +def _standard_gamma_grad(input: Tensor, output: Tensor) -> Tensor: ... +def _sync(t: Tensor) -> None: ... +@overload +def _test_autograd_multiple_dispatch(input: Tensor) -> Tensor: ... +@overload +def _test_autograd_multiple_dispatch(input: Tensor, b: _bool) -> Tensor: ... +def _test_autograd_multiple_dispatch_view(input: Tensor) -> Tensor: ... +def _test_autograd_multiple_dispatch_view_copy( + input: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: ... +def _test_check_tensor(input: Tensor) -> Tensor: ... +def _test_functorch_fallback(input: Tensor, other: Tensor) -> Tensor: ... +def _test_parallel_materialize( + input: Tensor, + num_parallel: _int, + skip_first: _bool = False, +) -> Tensor: ... +def _test_serialization_subcmul( + input: Tensor, + other: Tensor, + alpha: Number | _complex = 1, +) -> Tensor: ... +def _to_cpu( + tensors: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: ... +def _to_functional_tensor(t: Tensor) -> Tensor: ... +def _to_sparse_semi_structured(dense: Tensor) -> tuple[Tensor, Tensor]: ... +def _transform_bias_rescale_qkv( + qkv: Tensor, + qkv_bias: Tensor, + num_heads: _int, +) -> tuple[Tensor, Tensor, Tensor]: ... +def _transformer_encoder_layer_fwd( + src: Tensor, + embed_dim: _int, + num_heads: _int, + qkv_weight: Tensor, + qkv_bias: Tensor, + proj_weight: Tensor, + proj_bias: Tensor, + use_gelu: _bool, + norm_first: _bool, + eps: _float, + norm_weight_1: Tensor, + norm_bias_1: Tensor, + norm_weight_2: Tensor, + norm_bias_2: Tensor, + ffn_weight_1: Tensor, + ffn_bias_1: Tensor, + ffn_weight_2: Tensor, + ffn_bias_2: Tensor, + mask: Tensor | None = None, + mask_type: _int | None = None, +) -> Tensor: ... +def _trilinear( + i1: Tensor, + i2: Tensor, + i3: Tensor, + expand1: _size, + expand2: _size, + expand3: _size, + sumdim: _size, + unroll_dim: _int = 1, +) -> Tensor: ... +def _triton_multi_head_attention( + query: Tensor, + key: Tensor, + value: Tensor, + embed_dim: _int, + num_head: _int, + qkv_weight: Tensor, + qkv_bias: Tensor, + proj_weight: Tensor, + proj_bias: Tensor, + mask: Tensor | None = None, +) -> Tensor: ... +def _triton_scaled_dot_attention( + q: Tensor, + k: Tensor, + v: Tensor, + dropout_p: _float = 0.0, +) -> Tensor: ... +def _unique( + input: Tensor, + sorted: _bool = True, + return_inverse: _bool = False, +) -> tuple[Tensor, Tensor]: ... +def _unique2( + input: Tensor, + sorted: _bool = True, + return_inverse: _bool = False, + return_counts: _bool = False, +) -> tuple[Tensor, Tensor, Tensor]: ... +def _unpack_dual( + dual: Tensor, + level: _int, +) -> torch.return_types._unpack_dual: ... +def _unsafe_index( + input: Tensor, + indices: tuple[Tensor, ...] | list[Tensor] | None, +) -> Tensor: ... +def _unsafe_index_put( + input: Tensor, + indices: tuple[Tensor, ...] | list[Tensor] | None, + values: Tensor, + accumulate: _bool = False, +) -> Tensor: ... +def _unsafe_masked_index( + input: Tensor, + mask: Tensor, + indices: tuple[Tensor, ...] | list[Tensor] | None, + fill: Number | _complex, +) -> Tensor: ... +def _unsafe_masked_index_put_accumulate( + input: Tensor, + mask: Tensor, + indices: tuple[Tensor, ...] | list[Tensor] | None, + values: Tensor, +) -> Tensor: ... +@overload +def _use_cudnn_ctc_loss( + log_probs: Tensor, + targets: Tensor, + input_lengths: Tensor, + target_lengths: Tensor, + blank: _int, +) -> _bool: ... +@overload +def _use_cudnn_ctc_loss( + log_probs: Tensor, + targets: Tensor, + input_lengths: _size, + target_lengths: _size, + blank: _int, +) -> _bool: ... +def _use_cudnn_rnn_flatten_weight() -> _bool: ... +def _validate_compressed_sparse_indices( + is_crow: _bool, + compressed_idx: Tensor, + plain_idx: Tensor, + cdim: _int, + dim: _int, + nnz: _int, +) -> None: ... +def _validate_sparse_bsc_tensor_args( + ccol_indices: Tensor, + row_indices: Tensor, + values: Tensor, + size: _size, + check_pinning: _bool | None = None, +) -> None: ... +def _validate_sparse_bsr_tensor_args( + crow_indices: Tensor, + col_indices: Tensor, + values: Tensor, + size: _size, + check_pinning: _bool | None = None, +) -> None: ... +def _validate_sparse_compressed_tensor_args( + compressed_indices: Tensor, + plain_indices: Tensor, + values: Tensor, + size: _size, + layout: _layout, + check_pinning: _bool | None = None, +) -> None: ... +def _validate_sparse_coo_tensor_args( + indices: Tensor, + values: Tensor, + size: _size, + is_coalesced: _bool | None = None, + check_pinning: _bool | None = None, +) -> None: ... +def _validate_sparse_csc_tensor_args( + ccol_indices: Tensor, + row_indices: Tensor, + values: Tensor, + size: _size, + check_pinning: _bool | None = None, +) -> None: ... +def _validate_sparse_csr_tensor_args( + crow_indices: Tensor, + col_indices: Tensor, + values: Tensor, + size: _size, + check_pinning: _bool | None = None, +) -> None: ... +def _values_copy(input: Tensor, *, out: Tensor | None = None) -> Tensor: ... +def _weight_int4pack_mm( + input: Tensor, + mat2: Tensor, + qGroupSize: _int, + qScaleAndZeros: Tensor, +) -> Tensor: ... +def _weight_int4pack_mm_for_cpu( + input: Tensor, + mat2: Tensor, + qGroupSize: _int, + qScaleAndZeros: Tensor, +) -> Tensor: ... +def _weight_int4pack_mm_with_scales_and_zeros( + input: Tensor, + mat2: Tensor, + qGroupSize: _int, + qScale: Tensor, + qZeros: Tensor, +) -> Tensor: ... +def _weight_int8pack_mm( + input: Tensor, + mat2: Tensor, + scales: Tensor, +) -> Tensor: ... +def _weight_norm(v: Tensor, g: Tensor, dim: _int = 0) -> Tensor: ... +def _weight_norm_interface( + v: Tensor, + g: Tensor, + dim: _int = 0, +) -> tuple[Tensor, Tensor]: ... +def _wrapped_linear_prepack( + weight: Tensor, + weight_scale: Tensor, + weight_zero_point: Tensor, + bias: Tensor, +) -> Tensor: ... +def _wrapped_quantized_linear_prepacked( + input: Tensor, + input_scale: Tensor, + input_zero_point: Tensor, + packed_weight: Tensor, + output_scale: Tensor, + output_zero_point: Tensor, + out_channel: _int, +) -> Tensor: ... +def abs(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + abs(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Computes the absolute value of each element in :attr:`input`. + + .. math:: + \text{out}_{i} = |\text{input}_{i}| + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.abs(torch.tensor([-1, -2, 3])) + tensor([ 1, 2, 3]) + """ + +def abs_(input: Tensor) -> Tensor: ... +def absolute(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + absolute(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Alias for :func:`torch.abs` + """ + +def acos(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + acos(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Returns a new tensor with the arccosine (in radians) of each element in :attr:`input`. + + .. math:: + \text{out}_{i} = \cos^{-1}(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.3348, -0.5889, 0.2005, -0.1584]) + >>> torch.acos(a) + tensor([ 1.2294, 2.2004, 1.3690, 1.7298]) + """ + +def acos_(input: Tensor) -> Tensor: ... +def acosh(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + acosh(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Returns a new tensor with the inverse hyperbolic cosine of the elements of :attr:`input`. + + .. math:: + \text{out}_{i} = \cosh^{-1}(\text{input}_{i}) + + Note: + The domain of the inverse hyperbolic cosine is `[1, inf)` and values outside this range + will be mapped to ``NaN``, except for `+ INF` for which the output is mapped to `+ INF`. + + Args: + input (Tensor): the input tensor. + + Keyword arguments: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4).uniform_(1, 2) + >>> a + tensor([ 1.3192, 1.9915, 1.9674, 1.7151 ]) + >>> torch.acosh(a) + tensor([ 0.7791, 1.3120, 1.2979, 1.1341 ]) + """ + +def acosh_(input: Tensor) -> Tensor: ... +def adaptive_avg_pool1d(input: Tensor, output_size: _int | _size) -> Tensor: ... +def adaptive_max_pool1d( + input: Tensor, + output_size: _int | _size, +) -> tuple[Tensor, Tensor]: ... +@overload +def add( + input: Tensor | Number | _complex, + other: Tensor | Number | _complex, + *, + alpha: Number | _complex | None = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + add(input, other, *, alpha=1, out=None) -> Tensor + + Adds :attr:`other`, scaled by :attr:`alpha`, to :attr:`input`. + + .. math:: + \text{{out}}_i = \text{{input}}_i + \text{{alpha}} \times \text{{other}}_i + + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer, float, and complex inputs. + + Args: + input (Tensor): the input tensor. + other (Tensor or Number): the tensor or number to add to :attr:`input`. + + Keyword arguments: + alpha (Number): the multiplier for :attr:`other`. + out (Tensor, optional): the output tensor. + + Examples:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.0202, 1.0985, 1.3506, -0.6056]) + >>> torch.add(a, 20) + tensor([ 20.0202, 21.0985, 21.3506, 19.3944]) + + >>> b = torch.randn(4) + >>> b + tensor([-0.9732, -0.3497, 0.6245, 0.4022]) + >>> c = torch.randn(4, 1) + >>> c + tensor([[ 0.3743], + [-1.7724], + [-0.5811], + [-0.8017]]) + >>> torch.add(b, c, alpha=10) + tensor([[ 2.7695, 3.3930, 4.3672, 4.1450], + [-18.6971, -18.0736, -17.0994, -17.3216], + [ -6.7845, -6.1610, -5.1868, -5.4090], + [ -8.9902, -8.3667, -7.3925, -7.6147]]) + """ + +@overload +def add(self: Tensor, alpha: Number | _complex, other: Tensor) -> Tensor: + r""" + add(input, other, *, alpha=1, out=None) -> Tensor + + Adds :attr:`other`, scaled by :attr:`alpha`, to :attr:`input`. + + .. math:: + \text{{out}}_i = \text{{input}}_i + \text{{alpha}} \times \text{{other}}_i + + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer, float, and complex inputs. + + Args: + input (Tensor): the input tensor. + other (Tensor or Number): the tensor or number to add to :attr:`input`. + + Keyword arguments: + alpha (Number): the multiplier for :attr:`other`. + out (Tensor, optional): the output tensor. + + Examples:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.0202, 1.0985, 1.3506, -0.6056]) + >>> torch.add(a, 20) + tensor([ 20.0202, 21.0985, 21.3506, 19.3944]) + + >>> b = torch.randn(4) + >>> b + tensor([-0.9732, -0.3497, 0.6245, 0.4022]) + >>> c = torch.randn(4, 1) + >>> c + tensor([[ 0.3743], + [-1.7724], + [-0.5811], + [-0.8017]]) + >>> torch.add(b, c, alpha=10) + tensor([[ 2.7695, 3.3930, 4.3672, 4.1450], + [-18.6971, -18.0736, -17.0994, -17.3216], + [ -6.7845, -6.1610, -5.1868, -5.4090], + [ -8.9902, -8.3667, -7.3925, -7.6147]]) + """ + +@overload +def add( + self: Tensor, + alpha: Number | _complex, + other: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + add(input, other, *, alpha=1, out=None) -> Tensor + + Adds :attr:`other`, scaled by :attr:`alpha`, to :attr:`input`. + + .. math:: + \text{{out}}_i = \text{{input}}_i + \text{{alpha}} \times \text{{other}}_i + + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer, float, and complex inputs. + + Args: + input (Tensor): the input tensor. + other (Tensor or Number): the tensor or number to add to :attr:`input`. + + Keyword arguments: + alpha (Number): the multiplier for :attr:`other`. + out (Tensor, optional): the output tensor. + + Examples:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.0202, 1.0985, 1.3506, -0.6056]) + >>> torch.add(a, 20) + tensor([ 20.0202, 21.0985, 21.3506, 19.3944]) + + >>> b = torch.randn(4) + >>> b + tensor([-0.9732, -0.3497, 0.6245, 0.4022]) + >>> c = torch.randn(4, 1) + >>> c + tensor([[ 0.3743], + [-1.7724], + [-0.5811], + [-0.8017]]) + >>> torch.add(b, c, alpha=10) + tensor([[ 2.7695, 3.3930, 4.3672, 4.1450], + [-18.6971, -18.0736, -17.0994, -17.3216], + [ -6.7845, -6.1610, -5.1868, -5.4090], + [ -8.9902, -8.3667, -7.3925, -7.6147]]) + """ + +@overload +def addbmm( + beta: Number | _complex, + self: Tensor, + alpha: Number | _complex, + batch1: Tensor, + batch2: Tensor, +) -> Tensor: + r""" + addbmm(input, batch1, batch2, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices stored + in :attr:`batch1` and :attr:`batch2`, + with a reduced add step (all matrix multiplications get accumulated + along the first dimension). + :attr:`input` is added to the final result. + + :attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the + same number of matrices. + + If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a + :math:`(b \times m \times p)` tensor, :attr:`input` must be + :ref:`broadcastable ` with a :math:`(n \times p)` tensor + and :attr:`out` will be a :math:`(n \times p)` tensor. + + .. math:: + out = \beta\ \text{input} + \alpha\ (\sum_{i=0}^{b-1} \text{batch1}_i \mathbin{@} \text{batch2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and :attr:`alpha` + must be real numbers, otherwise they should be integers. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): matrix to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for `batch1 @ batch2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.addbmm(M, batch1, batch2) + tensor([[ 6.6311, 0.0503, 6.9768, -12.0362, -2.1653], + [ -4.8185, -1.4255, -6.6760, 8.9453, 2.5743], + [ -3.8202, 4.3691, 1.0943, -1.1109, 5.4730]]) + """ + +@overload +def addbmm( + beta: Number | _complex, + self: Tensor, + alpha: Number | _complex, + batch1: Tensor, + batch2: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + addbmm(input, batch1, batch2, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices stored + in :attr:`batch1` and :attr:`batch2`, + with a reduced add step (all matrix multiplications get accumulated + along the first dimension). + :attr:`input` is added to the final result. + + :attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the + same number of matrices. + + If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a + :math:`(b \times m \times p)` tensor, :attr:`input` must be + :ref:`broadcastable ` with a :math:`(n \times p)` tensor + and :attr:`out` will be a :math:`(n \times p)` tensor. + + .. math:: + out = \beta\ \text{input} + \alpha\ (\sum_{i=0}^{b-1} \text{batch1}_i \mathbin{@} \text{batch2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and :attr:`alpha` + must be real numbers, otherwise they should be integers. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): matrix to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for `batch1 @ batch2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.addbmm(M, batch1, batch2) + tensor([[ 6.6311, 0.0503, 6.9768, -12.0362, -2.1653], + [ -4.8185, -1.4255, -6.6760, 8.9453, 2.5743], + [ -3.8202, 4.3691, 1.0943, -1.1109, 5.4730]]) + """ + +@overload +def addbmm( + input: Tensor, + batch1: Tensor, + batch2: Tensor, + *, + beta: Number | _complex = 1, + alpha: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + addbmm(input, batch1, batch2, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices stored + in :attr:`batch1` and :attr:`batch2`, + with a reduced add step (all matrix multiplications get accumulated + along the first dimension). + :attr:`input` is added to the final result. + + :attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the + same number of matrices. + + If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a + :math:`(b \times m \times p)` tensor, :attr:`input` must be + :ref:`broadcastable ` with a :math:`(n \times p)` tensor + and :attr:`out` will be a :math:`(n \times p)` tensor. + + .. math:: + out = \beta\ \text{input} + \alpha\ (\sum_{i=0}^{b-1} \text{batch1}_i \mathbin{@} \text{batch2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and :attr:`alpha` + must be real numbers, otherwise they should be integers. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): matrix to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for `batch1 @ batch2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.addbmm(M, batch1, batch2) + tensor([[ 6.6311, 0.0503, 6.9768, -12.0362, -2.1653], + [ -4.8185, -1.4255, -6.6760, 8.9453, 2.5743], + [ -3.8202, 4.3691, 1.0943, -1.1109, 5.4730]]) + """ + +@overload +def addbmm( + beta: Number | _complex, + self: Tensor, + batch1: Tensor, + batch2: Tensor, +) -> Tensor: + r""" + addbmm(input, batch1, batch2, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices stored + in :attr:`batch1` and :attr:`batch2`, + with a reduced add step (all matrix multiplications get accumulated + along the first dimension). + :attr:`input` is added to the final result. + + :attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the + same number of matrices. + + If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a + :math:`(b \times m \times p)` tensor, :attr:`input` must be + :ref:`broadcastable ` with a :math:`(n \times p)` tensor + and :attr:`out` will be a :math:`(n \times p)` tensor. + + .. math:: + out = \beta\ \text{input} + \alpha\ (\sum_{i=0}^{b-1} \text{batch1}_i \mathbin{@} \text{batch2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and :attr:`alpha` + must be real numbers, otherwise they should be integers. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): matrix to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for `batch1 @ batch2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.addbmm(M, batch1, batch2) + tensor([[ 6.6311, 0.0503, 6.9768, -12.0362, -2.1653], + [ -4.8185, -1.4255, -6.6760, 8.9453, 2.5743], + [ -3.8202, 4.3691, 1.0943, -1.1109, 5.4730]]) + """ + +@overload +def addbmm( + beta: Number | _complex, + self: Tensor, + batch1: Tensor, + batch2: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + addbmm(input, batch1, batch2, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices stored + in :attr:`batch1` and :attr:`batch2`, + with a reduced add step (all matrix multiplications get accumulated + along the first dimension). + :attr:`input` is added to the final result. + + :attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the + same number of matrices. + + If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a + :math:`(b \times m \times p)` tensor, :attr:`input` must be + :ref:`broadcastable ` with a :math:`(n \times p)` tensor + and :attr:`out` will be a :math:`(n \times p)` tensor. + + .. math:: + out = \beta\ \text{input} + \alpha\ (\sum_{i=0}^{b-1} \text{batch1}_i \mathbin{@} \text{batch2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and :attr:`alpha` + must be real numbers, otherwise they should be integers. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): matrix to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for `batch1 @ batch2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.addbmm(M, batch1, batch2) + tensor([[ 6.6311, 0.0503, 6.9768, -12.0362, -2.1653], + [ -4.8185, -1.4255, -6.6760, 8.9453, 2.5743], + [ -3.8202, 4.3691, 1.0943, -1.1109, 5.4730]]) + """ + +@overload +def addcdiv( + self: Tensor, + value: Number | _complex, + tensor1: Tensor, + tensor2: Tensor, +) -> Tensor: + r""" + addcdiv(input, tensor1, tensor2, *, value=1, out=None) -> Tensor + + Performs the element-wise division of :attr:`tensor1` by :attr:`tensor2`, + multiplies the result by the scalar :attr:`value` and adds it to :attr:`input`. + + .. warning:: + Integer division with addcdiv is no longer supported, and in a future + release addcdiv will perform a true division of tensor1 and tensor2. + The historic addcdiv behavior can be implemented as + (input + value * torch.trunc(tensor1 / tensor2)).to(input.dtype) + for integer inputs and as (input + value * tensor1 / tensor2) for float inputs. + The future addcdiv behavior is just the latter implementation: + (input + value * tensor1 / tensor2), for all dtypes. + + .. math:: + \text{out}_i = \text{input}_i + \text{value} \times \frac{\text{tensor1}_i}{\text{tensor2}_i} + + + The shapes of :attr:`input`, :attr:`tensor1`, and :attr:`tensor2` must be + :ref:`broadcastable `. + + For inputs of type `FloatTensor` or `DoubleTensor`, :attr:`value` must be + a real number, otherwise an integer. + + Args: + input (Tensor): the tensor to be added + tensor1 (Tensor): the numerator tensor + tensor2 (Tensor): the denominator tensor + + Keyword args: + value (Number, optional): multiplier for :math:`\text{tensor1} / \text{tensor2}` + out (Tensor, optional): the output tensor. + + Example:: + + >>> t = torch.randn(1, 3) + >>> t1 = torch.randn(3, 1) + >>> t2 = torch.randn(1, 3) + >>> torch.addcdiv(t, t1, t2, value=0.1) + tensor([[-0.2312, -3.6496, 0.1312], + [-1.0428, 3.4292, -0.1030], + [-0.5369, -0.9829, 0.0430]]) + """ + +@overload +def addcdiv( + self: Tensor, + value: Number | _complex, + tensor1: Tensor, + tensor2: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + addcdiv(input, tensor1, tensor2, *, value=1, out=None) -> Tensor + + Performs the element-wise division of :attr:`tensor1` by :attr:`tensor2`, + multiplies the result by the scalar :attr:`value` and adds it to :attr:`input`. + + .. warning:: + Integer division with addcdiv is no longer supported, and in a future + release addcdiv will perform a true division of tensor1 and tensor2. + The historic addcdiv behavior can be implemented as + (input + value * torch.trunc(tensor1 / tensor2)).to(input.dtype) + for integer inputs and as (input + value * tensor1 / tensor2) for float inputs. + The future addcdiv behavior is just the latter implementation: + (input + value * tensor1 / tensor2), for all dtypes. + + .. math:: + \text{out}_i = \text{input}_i + \text{value} \times \frac{\text{tensor1}_i}{\text{tensor2}_i} + + + The shapes of :attr:`input`, :attr:`tensor1`, and :attr:`tensor2` must be + :ref:`broadcastable `. + + For inputs of type `FloatTensor` or `DoubleTensor`, :attr:`value` must be + a real number, otherwise an integer. + + Args: + input (Tensor): the tensor to be added + tensor1 (Tensor): the numerator tensor + tensor2 (Tensor): the denominator tensor + + Keyword args: + value (Number, optional): multiplier for :math:`\text{tensor1} / \text{tensor2}` + out (Tensor, optional): the output tensor. + + Example:: + + >>> t = torch.randn(1, 3) + >>> t1 = torch.randn(3, 1) + >>> t2 = torch.randn(1, 3) + >>> torch.addcdiv(t, t1, t2, value=0.1) + tensor([[-0.2312, -3.6496, 0.1312], + [-1.0428, 3.4292, -0.1030], + [-0.5369, -0.9829, 0.0430]]) + """ + +@overload +def addcdiv( + input: Tensor, + tensor1: Tensor, + tensor2: Tensor, + *, + value: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + addcdiv(input, tensor1, tensor2, *, value=1, out=None) -> Tensor + + Performs the element-wise division of :attr:`tensor1` by :attr:`tensor2`, + multiplies the result by the scalar :attr:`value` and adds it to :attr:`input`. + + .. warning:: + Integer division with addcdiv is no longer supported, and in a future + release addcdiv will perform a true division of tensor1 and tensor2. + The historic addcdiv behavior can be implemented as + (input + value * torch.trunc(tensor1 / tensor2)).to(input.dtype) + for integer inputs and as (input + value * tensor1 / tensor2) for float inputs. + The future addcdiv behavior is just the latter implementation: + (input + value * tensor1 / tensor2), for all dtypes. + + .. math:: + \text{out}_i = \text{input}_i + \text{value} \times \frac{\text{tensor1}_i}{\text{tensor2}_i} + + + The shapes of :attr:`input`, :attr:`tensor1`, and :attr:`tensor2` must be + :ref:`broadcastable `. + + For inputs of type `FloatTensor` or `DoubleTensor`, :attr:`value` must be + a real number, otherwise an integer. + + Args: + input (Tensor): the tensor to be added + tensor1 (Tensor): the numerator tensor + tensor2 (Tensor): the denominator tensor + + Keyword args: + value (Number, optional): multiplier for :math:`\text{tensor1} / \text{tensor2}` + out (Tensor, optional): the output tensor. + + Example:: + + >>> t = torch.randn(1, 3) + >>> t1 = torch.randn(3, 1) + >>> t2 = torch.randn(1, 3) + >>> torch.addcdiv(t, t1, t2, value=0.1) + tensor([[-0.2312, -3.6496, 0.1312], + [-1.0428, 3.4292, -0.1030], + [-0.5369, -0.9829, 0.0430]]) + """ + +@overload +def addcmul( + self: Tensor, + value: Number | _complex, + tensor1: Tensor, + tensor2: Tensor, +) -> Tensor: + r""" + addcmul(input, tensor1, tensor2, *, value=1, out=None) -> Tensor + + Performs the element-wise multiplication of :attr:`tensor1` + by :attr:`tensor2`, multiplies the result by the scalar :attr:`value` + and adds it to :attr:`input`. + + .. math:: + \text{out}_i = \text{input}_i + \text{value} \times \text{tensor1}_i \times \text{tensor2}_i + + The shapes of :attr:`tensor`, :attr:`tensor1`, and :attr:`tensor2` must be + :ref:`broadcastable `. + + For inputs of type `FloatTensor` or `DoubleTensor`, :attr:`value` must be + a real number, otherwise an integer. + + Args: + input (Tensor): the tensor to be added + tensor1 (Tensor): the tensor to be multiplied + tensor2 (Tensor): the tensor to be multiplied + + Keyword args: + value (Number, optional): multiplier for :math:`tensor1 .* tensor2` + out (Tensor, optional): the output tensor. + + Example:: + + >>> t = torch.randn(1, 3) + >>> t1 = torch.randn(3, 1) + >>> t2 = torch.randn(1, 3) + >>> torch.addcmul(t, t1, t2, value=0.1) + tensor([[-0.8635, -0.6391, 1.6174], + [-0.7617, -0.5879, 1.7388], + [-0.8353, -0.6249, 1.6511]]) + """ + +@overload +def addcmul( + self: Tensor, + value: Number | _complex, + tensor1: Tensor, + tensor2: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + addcmul(input, tensor1, tensor2, *, value=1, out=None) -> Tensor + + Performs the element-wise multiplication of :attr:`tensor1` + by :attr:`tensor2`, multiplies the result by the scalar :attr:`value` + and adds it to :attr:`input`. + + .. math:: + \text{out}_i = \text{input}_i + \text{value} \times \text{tensor1}_i \times \text{tensor2}_i + + The shapes of :attr:`tensor`, :attr:`tensor1`, and :attr:`tensor2` must be + :ref:`broadcastable `. + + For inputs of type `FloatTensor` or `DoubleTensor`, :attr:`value` must be + a real number, otherwise an integer. + + Args: + input (Tensor): the tensor to be added + tensor1 (Tensor): the tensor to be multiplied + tensor2 (Tensor): the tensor to be multiplied + + Keyword args: + value (Number, optional): multiplier for :math:`tensor1 .* tensor2` + out (Tensor, optional): the output tensor. + + Example:: + + >>> t = torch.randn(1, 3) + >>> t1 = torch.randn(3, 1) + >>> t2 = torch.randn(1, 3) + >>> torch.addcmul(t, t1, t2, value=0.1) + tensor([[-0.8635, -0.6391, 1.6174], + [-0.7617, -0.5879, 1.7388], + [-0.8353, -0.6249, 1.6511]]) + """ + +@overload +def addcmul( + input: Tensor, + tensor1: Tensor, + tensor2: Tensor, + *, + value: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + addcmul(input, tensor1, tensor2, *, value=1, out=None) -> Tensor + + Performs the element-wise multiplication of :attr:`tensor1` + by :attr:`tensor2`, multiplies the result by the scalar :attr:`value` + and adds it to :attr:`input`. + + .. math:: + \text{out}_i = \text{input}_i + \text{value} \times \text{tensor1}_i \times \text{tensor2}_i + + The shapes of :attr:`tensor`, :attr:`tensor1`, and :attr:`tensor2` must be + :ref:`broadcastable `. + + For inputs of type `FloatTensor` or `DoubleTensor`, :attr:`value` must be + a real number, otherwise an integer. + + Args: + input (Tensor): the tensor to be added + tensor1 (Tensor): the tensor to be multiplied + tensor2 (Tensor): the tensor to be multiplied + + Keyword args: + value (Number, optional): multiplier for :math:`tensor1 .* tensor2` + out (Tensor, optional): the output tensor. + + Example:: + + >>> t = torch.randn(1, 3) + >>> t1 = torch.randn(3, 1) + >>> t2 = torch.randn(1, 3) + >>> torch.addcmul(t, t1, t2, value=0.1) + tensor([[-0.8635, -0.6391, 1.6174], + [-0.7617, -0.5879, 1.7388], + [-0.8353, -0.6249, 1.6511]]) + """ + +@overload +def addmm( + beta: Number | _complex, + self: Tensor, + alpha: Number | _complex, + mat1: Tensor, + mat2: Tensor, +) -> Tensor: + r""" + addmm(input, mat1, mat2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a matrix multiplication of the matrices :attr:`mat1` and :attr:`mat2`. + The matrix :attr:`input` is added to the final result. + + If :attr:`mat1` is a :math:`(n \times m)` tensor, :attr:`mat2` is a + :math:`(m \times p)` tensor, then :attr:`input` must be + :ref:`broadcastable ` with a :math:`(n \times p)` tensor + and :attr:`out` will be a :math:`(n \times p)` tensor. + + :attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between + :attr:`mat1` and :attr:`mat2` and the added matrix :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat1}_i \mathbin{@} \text{mat2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + This operation has support for arguments with :ref:`sparse layouts`. If + :attr:`input` is sparse the result will have the same layout and if :attr:`out` + is provided it must have the same layout as :attr:`input`. + + + .. warning:: + Sparse support is a beta feature and some layout(s)/dtype/device combinations may not be supported, + or may not have autograd support. If you notice missing functionality please + open a feature request. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): matrix to be added + mat1 (Tensor): the first matrix to be matrix multiplied + mat2 (Tensor): the second matrix to be matrix multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(2, 3) + >>> mat1 = torch.randn(2, 3) + >>> mat2 = torch.randn(3, 3) + >>> torch.addmm(M, mat1, mat2) + tensor([[-4.8716, 1.4671, -1.3746], + [ 0.7573, -3.9555, -2.8681]]) + """ + +@overload +def addmm( + beta: Number | _complex, + self: Tensor, + alpha: Number | _complex, + mat1: Tensor, + mat2: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + addmm(input, mat1, mat2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a matrix multiplication of the matrices :attr:`mat1` and :attr:`mat2`. + The matrix :attr:`input` is added to the final result. + + If :attr:`mat1` is a :math:`(n \times m)` tensor, :attr:`mat2` is a + :math:`(m \times p)` tensor, then :attr:`input` must be + :ref:`broadcastable ` with a :math:`(n \times p)` tensor + and :attr:`out` will be a :math:`(n \times p)` tensor. + + :attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between + :attr:`mat1` and :attr:`mat2` and the added matrix :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat1}_i \mathbin{@} \text{mat2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + This operation has support for arguments with :ref:`sparse layouts`. If + :attr:`input` is sparse the result will have the same layout and if :attr:`out` + is provided it must have the same layout as :attr:`input`. + + + .. warning:: + Sparse support is a beta feature and some layout(s)/dtype/device combinations may not be supported, + or may not have autograd support. If you notice missing functionality please + open a feature request. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): matrix to be added + mat1 (Tensor): the first matrix to be matrix multiplied + mat2 (Tensor): the second matrix to be matrix multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(2, 3) + >>> mat1 = torch.randn(2, 3) + >>> mat2 = torch.randn(3, 3) + >>> torch.addmm(M, mat1, mat2) + tensor([[-4.8716, 1.4671, -1.3746], + [ 0.7573, -3.9555, -2.8681]]) + """ + +@overload +def addmm( + input: Tensor, + mat1: Tensor, + mat2: Tensor, + *, + beta: Number | _complex = 1, + alpha: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + addmm(input, mat1, mat2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a matrix multiplication of the matrices :attr:`mat1` and :attr:`mat2`. + The matrix :attr:`input` is added to the final result. + + If :attr:`mat1` is a :math:`(n \times m)` tensor, :attr:`mat2` is a + :math:`(m \times p)` tensor, then :attr:`input` must be + :ref:`broadcastable ` with a :math:`(n \times p)` tensor + and :attr:`out` will be a :math:`(n \times p)` tensor. + + :attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between + :attr:`mat1` and :attr:`mat2` and the added matrix :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat1}_i \mathbin{@} \text{mat2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + This operation has support for arguments with :ref:`sparse layouts`. If + :attr:`input` is sparse the result will have the same layout and if :attr:`out` + is provided it must have the same layout as :attr:`input`. + + + .. warning:: + Sparse support is a beta feature and some layout(s)/dtype/device combinations may not be supported, + or may not have autograd support. If you notice missing functionality please + open a feature request. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): matrix to be added + mat1 (Tensor): the first matrix to be matrix multiplied + mat2 (Tensor): the second matrix to be matrix multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(2, 3) + >>> mat1 = torch.randn(2, 3) + >>> mat2 = torch.randn(3, 3) + >>> torch.addmm(M, mat1, mat2) + tensor([[-4.8716, 1.4671, -1.3746], + [ 0.7573, -3.9555, -2.8681]]) + """ + +@overload +def addmm( + input: Tensor, + mat1: Tensor, + mat2: Tensor, + out_dtype: _dtype, + *, + beta: Number | _complex = 1, + alpha: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + addmm(input, mat1, mat2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a matrix multiplication of the matrices :attr:`mat1` and :attr:`mat2`. + The matrix :attr:`input` is added to the final result. + + If :attr:`mat1` is a :math:`(n \times m)` tensor, :attr:`mat2` is a + :math:`(m \times p)` tensor, then :attr:`input` must be + :ref:`broadcastable ` with a :math:`(n \times p)` tensor + and :attr:`out` will be a :math:`(n \times p)` tensor. + + :attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between + :attr:`mat1` and :attr:`mat2` and the added matrix :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat1}_i \mathbin{@} \text{mat2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + This operation has support for arguments with :ref:`sparse layouts`. If + :attr:`input` is sparse the result will have the same layout and if :attr:`out` + is provided it must have the same layout as :attr:`input`. + + + .. warning:: + Sparse support is a beta feature and some layout(s)/dtype/device combinations may not be supported, + or may not have autograd support. If you notice missing functionality please + open a feature request. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): matrix to be added + mat1 (Tensor): the first matrix to be matrix multiplied + mat2 (Tensor): the second matrix to be matrix multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(2, 3) + >>> mat1 = torch.randn(2, 3) + >>> mat2 = torch.randn(3, 3) + >>> torch.addmm(M, mat1, mat2) + tensor([[-4.8716, 1.4671, -1.3746], + [ 0.7573, -3.9555, -2.8681]]) + """ + +@overload +def addmm( + beta: Number | _complex, + self: Tensor, + mat1: Tensor, + mat2: Tensor, +) -> Tensor: + r""" + addmm(input, mat1, mat2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a matrix multiplication of the matrices :attr:`mat1` and :attr:`mat2`. + The matrix :attr:`input` is added to the final result. + + If :attr:`mat1` is a :math:`(n \times m)` tensor, :attr:`mat2` is a + :math:`(m \times p)` tensor, then :attr:`input` must be + :ref:`broadcastable ` with a :math:`(n \times p)` tensor + and :attr:`out` will be a :math:`(n \times p)` tensor. + + :attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between + :attr:`mat1` and :attr:`mat2` and the added matrix :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat1}_i \mathbin{@} \text{mat2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + This operation has support for arguments with :ref:`sparse layouts`. If + :attr:`input` is sparse the result will have the same layout and if :attr:`out` + is provided it must have the same layout as :attr:`input`. + + + .. warning:: + Sparse support is a beta feature and some layout(s)/dtype/device combinations may not be supported, + or may not have autograd support. If you notice missing functionality please + open a feature request. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): matrix to be added + mat1 (Tensor): the first matrix to be matrix multiplied + mat2 (Tensor): the second matrix to be matrix multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(2, 3) + >>> mat1 = torch.randn(2, 3) + >>> mat2 = torch.randn(3, 3) + >>> torch.addmm(M, mat1, mat2) + tensor([[-4.8716, 1.4671, -1.3746], + [ 0.7573, -3.9555, -2.8681]]) + """ + +@overload +def addmm( + beta: Number | _complex, + self: Tensor, + mat1: Tensor, + mat2: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + addmm(input, mat1, mat2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a matrix multiplication of the matrices :attr:`mat1` and :attr:`mat2`. + The matrix :attr:`input` is added to the final result. + + If :attr:`mat1` is a :math:`(n \times m)` tensor, :attr:`mat2` is a + :math:`(m \times p)` tensor, then :attr:`input` must be + :ref:`broadcastable ` with a :math:`(n \times p)` tensor + and :attr:`out` will be a :math:`(n \times p)` tensor. + + :attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between + :attr:`mat1` and :attr:`mat2` and the added matrix :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat1}_i \mathbin{@} \text{mat2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + This operation has support for arguments with :ref:`sparse layouts`. If + :attr:`input` is sparse the result will have the same layout and if :attr:`out` + is provided it must have the same layout as :attr:`input`. + + + .. warning:: + Sparse support is a beta feature and some layout(s)/dtype/device combinations may not be supported, + or may not have autograd support. If you notice missing functionality please + open a feature request. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): matrix to be added + mat1 (Tensor): the first matrix to be matrix multiplied + mat2 (Tensor): the second matrix to be matrix multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(2, 3) + >>> mat1 = torch.randn(2, 3) + >>> mat2 = torch.randn(3, 3) + >>> torch.addmm(M, mat1, mat2) + tensor([[-4.8716, 1.4671, -1.3746], + [ 0.7573, -3.9555, -2.8681]]) + """ + +@overload +def addmv( + beta: Number | _complex, + self: Tensor, + alpha: Number | _complex, + mat: Tensor, + vec: Tensor, +) -> Tensor: + r""" + addmv(input, mat, vec, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a matrix-vector product of the matrix :attr:`mat` and + the vector :attr:`vec`. + The vector :attr:`input` is added to the final result. + + If :attr:`mat` is a :math:`(n \times m)` tensor, :attr:`vec` is a 1-D tensor of + size `m`, then :attr:`input` must be + :ref:`broadcastable ` with a 1-D tensor of size `n` and + :attr:`out` will be 1-D tensor of size `n`. + + :attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between + :attr:`mat` and :attr:`vec` and the added tensor :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat} \mathbin{@} \text{vec}) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + Args: + input (Tensor): vector to be added + mat (Tensor): matrix to be matrix multiplied + vec (Tensor): vector to be matrix multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat @ vec` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(2) + >>> mat = torch.randn(2, 3) + >>> vec = torch.randn(3) + >>> torch.addmv(M, mat, vec) + tensor([-0.3768, -5.5565]) + """ + +@overload +def addmv( + beta: Number | _complex, + self: Tensor, + alpha: Number | _complex, + mat: Tensor, + vec: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + addmv(input, mat, vec, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a matrix-vector product of the matrix :attr:`mat` and + the vector :attr:`vec`. + The vector :attr:`input` is added to the final result. + + If :attr:`mat` is a :math:`(n \times m)` tensor, :attr:`vec` is a 1-D tensor of + size `m`, then :attr:`input` must be + :ref:`broadcastable ` with a 1-D tensor of size `n` and + :attr:`out` will be 1-D tensor of size `n`. + + :attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between + :attr:`mat` and :attr:`vec` and the added tensor :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat} \mathbin{@} \text{vec}) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + Args: + input (Tensor): vector to be added + mat (Tensor): matrix to be matrix multiplied + vec (Tensor): vector to be matrix multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat @ vec` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(2) + >>> mat = torch.randn(2, 3) + >>> vec = torch.randn(3) + >>> torch.addmv(M, mat, vec) + tensor([-0.3768, -5.5565]) + """ + +@overload +def addmv( + input: Tensor, + mat: Tensor, + vec: Tensor, + *, + beta: Number | _complex = 1, + alpha: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + addmv(input, mat, vec, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a matrix-vector product of the matrix :attr:`mat` and + the vector :attr:`vec`. + The vector :attr:`input` is added to the final result. + + If :attr:`mat` is a :math:`(n \times m)` tensor, :attr:`vec` is a 1-D tensor of + size `m`, then :attr:`input` must be + :ref:`broadcastable ` with a 1-D tensor of size `n` and + :attr:`out` will be 1-D tensor of size `n`. + + :attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between + :attr:`mat` and :attr:`vec` and the added tensor :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat} \mathbin{@} \text{vec}) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + Args: + input (Tensor): vector to be added + mat (Tensor): matrix to be matrix multiplied + vec (Tensor): vector to be matrix multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat @ vec` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(2) + >>> mat = torch.randn(2, 3) + >>> vec = torch.randn(3) + >>> torch.addmv(M, mat, vec) + tensor([-0.3768, -5.5565]) + """ + +@overload +def addmv( + beta: Number | _complex, + self: Tensor, + mat: Tensor, + vec: Tensor, +) -> Tensor: + r""" + addmv(input, mat, vec, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a matrix-vector product of the matrix :attr:`mat` and + the vector :attr:`vec`. + The vector :attr:`input` is added to the final result. + + If :attr:`mat` is a :math:`(n \times m)` tensor, :attr:`vec` is a 1-D tensor of + size `m`, then :attr:`input` must be + :ref:`broadcastable ` with a 1-D tensor of size `n` and + :attr:`out` will be 1-D tensor of size `n`. + + :attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between + :attr:`mat` and :attr:`vec` and the added tensor :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat} \mathbin{@} \text{vec}) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + Args: + input (Tensor): vector to be added + mat (Tensor): matrix to be matrix multiplied + vec (Tensor): vector to be matrix multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat @ vec` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(2) + >>> mat = torch.randn(2, 3) + >>> vec = torch.randn(3) + >>> torch.addmv(M, mat, vec) + tensor([-0.3768, -5.5565]) + """ + +@overload +def addmv( + beta: Number | _complex, + self: Tensor, + mat: Tensor, + vec: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + addmv(input, mat, vec, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a matrix-vector product of the matrix :attr:`mat` and + the vector :attr:`vec`. + The vector :attr:`input` is added to the final result. + + If :attr:`mat` is a :math:`(n \times m)` tensor, :attr:`vec` is a 1-D tensor of + size `m`, then :attr:`input` must be + :ref:`broadcastable ` with a 1-D tensor of size `n` and + :attr:`out` will be 1-D tensor of size `n`. + + :attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between + :attr:`mat` and :attr:`vec` and the added tensor :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat} \mathbin{@} \text{vec}) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + Args: + input (Tensor): vector to be added + mat (Tensor): matrix to be matrix multiplied + vec (Tensor): vector to be matrix multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat @ vec` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(2) + >>> mat = torch.randn(2, 3) + >>> vec = torch.randn(3) + >>> torch.addmv(M, mat, vec) + tensor([-0.3768, -5.5565]) + """ + +@overload +def addmv_( + beta: Number | _complex, + self: Tensor, + alpha: Number | _complex, + mat: Tensor, + vec: Tensor, +) -> Tensor: ... +@overload +def addmv_( + input: Tensor, + mat: Tensor, + vec: Tensor, + *, + beta: Number | _complex = 1, + alpha: Number | _complex = 1, +) -> Tensor: ... +@overload +def addmv_( + beta: Number | _complex, + self: Tensor, + mat: Tensor, + vec: Tensor, +) -> Tensor: ... +@overload +def addr( + beta: Number | _complex, + self: Tensor, + alpha: Number | _complex, + vec1: Tensor, + vec2: Tensor, +) -> Tensor: + r""" + addr(input, vec1, vec2, *, beta=1, alpha=1, out=None) -> Tensor + + Performs the outer-product of vectors :attr:`vec1` and :attr:`vec2` + and adds it to the matrix :attr:`input`. + + Optional values :attr:`beta` and :attr:`alpha` are scaling factors on the + outer product between :attr:`vec1` and :attr:`vec2` and the added matrix + :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{vec1} \otimes \text{vec2}) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + If :attr:`vec1` is a vector of size `n` and :attr:`vec2` is a vector + of size `m`, then :attr:`input` must be + :ref:`broadcastable ` with a matrix of size + :math:`(n \times m)` and :attr:`out` will be a matrix of size + :math:`(n \times m)`. + + Args: + input (Tensor): matrix to be added + vec1 (Tensor): the first vector of the outer product + vec2 (Tensor): the second vector of the outer product + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{vec1} \otimes \text{vec2}` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> vec1 = torch.arange(1., 4.) + >>> vec2 = torch.arange(1., 3.) + >>> M = torch.zeros(3, 2) + >>> torch.addr(M, vec1, vec2) + tensor([[ 1., 2.], + [ 2., 4.], + [ 3., 6.]]) + """ + +@overload +def addr( + beta: Number | _complex, + self: Tensor, + alpha: Number | _complex, + vec1: Tensor, + vec2: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + addr(input, vec1, vec2, *, beta=1, alpha=1, out=None) -> Tensor + + Performs the outer-product of vectors :attr:`vec1` and :attr:`vec2` + and adds it to the matrix :attr:`input`. + + Optional values :attr:`beta` and :attr:`alpha` are scaling factors on the + outer product between :attr:`vec1` and :attr:`vec2` and the added matrix + :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{vec1} \otimes \text{vec2}) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + If :attr:`vec1` is a vector of size `n` and :attr:`vec2` is a vector + of size `m`, then :attr:`input` must be + :ref:`broadcastable ` with a matrix of size + :math:`(n \times m)` and :attr:`out` will be a matrix of size + :math:`(n \times m)`. + + Args: + input (Tensor): matrix to be added + vec1 (Tensor): the first vector of the outer product + vec2 (Tensor): the second vector of the outer product + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{vec1} \otimes \text{vec2}` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> vec1 = torch.arange(1., 4.) + >>> vec2 = torch.arange(1., 3.) + >>> M = torch.zeros(3, 2) + >>> torch.addr(M, vec1, vec2) + tensor([[ 1., 2.], + [ 2., 4.], + [ 3., 6.]]) + """ + +@overload +def addr( + input: Tensor, + vec1: Tensor, + vec2: Tensor, + *, + beta: Number | _complex = 1, + alpha: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + addr(input, vec1, vec2, *, beta=1, alpha=1, out=None) -> Tensor + + Performs the outer-product of vectors :attr:`vec1` and :attr:`vec2` + and adds it to the matrix :attr:`input`. + + Optional values :attr:`beta` and :attr:`alpha` are scaling factors on the + outer product between :attr:`vec1` and :attr:`vec2` and the added matrix + :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{vec1} \otimes \text{vec2}) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + If :attr:`vec1` is a vector of size `n` and :attr:`vec2` is a vector + of size `m`, then :attr:`input` must be + :ref:`broadcastable ` with a matrix of size + :math:`(n \times m)` and :attr:`out` will be a matrix of size + :math:`(n \times m)`. + + Args: + input (Tensor): matrix to be added + vec1 (Tensor): the first vector of the outer product + vec2 (Tensor): the second vector of the outer product + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{vec1} \otimes \text{vec2}` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> vec1 = torch.arange(1., 4.) + >>> vec2 = torch.arange(1., 3.) + >>> M = torch.zeros(3, 2) + >>> torch.addr(M, vec1, vec2) + tensor([[ 1., 2.], + [ 2., 4.], + [ 3., 6.]]) + """ + +@overload +def addr( + beta: Number | _complex, + self: Tensor, + vec1: Tensor, + vec2: Tensor, +) -> Tensor: + r""" + addr(input, vec1, vec2, *, beta=1, alpha=1, out=None) -> Tensor + + Performs the outer-product of vectors :attr:`vec1` and :attr:`vec2` + and adds it to the matrix :attr:`input`. + + Optional values :attr:`beta` and :attr:`alpha` are scaling factors on the + outer product between :attr:`vec1` and :attr:`vec2` and the added matrix + :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{vec1} \otimes \text{vec2}) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + If :attr:`vec1` is a vector of size `n` and :attr:`vec2` is a vector + of size `m`, then :attr:`input` must be + :ref:`broadcastable ` with a matrix of size + :math:`(n \times m)` and :attr:`out` will be a matrix of size + :math:`(n \times m)`. + + Args: + input (Tensor): matrix to be added + vec1 (Tensor): the first vector of the outer product + vec2 (Tensor): the second vector of the outer product + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{vec1} \otimes \text{vec2}` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> vec1 = torch.arange(1., 4.) + >>> vec2 = torch.arange(1., 3.) + >>> M = torch.zeros(3, 2) + >>> torch.addr(M, vec1, vec2) + tensor([[ 1., 2.], + [ 2., 4.], + [ 3., 6.]]) + """ + +@overload +def addr( + beta: Number | _complex, + self: Tensor, + vec1: Tensor, + vec2: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + addr(input, vec1, vec2, *, beta=1, alpha=1, out=None) -> Tensor + + Performs the outer-product of vectors :attr:`vec1` and :attr:`vec2` + and adds it to the matrix :attr:`input`. + + Optional values :attr:`beta` and :attr:`alpha` are scaling factors on the + outer product between :attr:`vec1` and :attr:`vec2` and the added matrix + :attr:`input` respectively. + + .. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{vec1} \otimes \text{vec2}) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + If :attr:`vec1` is a vector of size `n` and :attr:`vec2` is a vector + of size `m`, then :attr:`input` must be + :ref:`broadcastable ` with a matrix of size + :math:`(n \times m)` and :attr:`out` will be a matrix of size + :math:`(n \times m)`. + + Args: + input (Tensor): matrix to be added + vec1 (Tensor): the first vector of the outer product + vec2 (Tensor): the second vector of the outer product + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{vec1} \otimes \text{vec2}` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> vec1 = torch.arange(1., 4.) + >>> vec2 = torch.arange(1., 3.) + >>> M = torch.zeros(3, 2) + >>> torch.addr(M, vec1, vec2) + tensor([[ 1., 2.], + [ 2., 4.], + [ 3., 6.]]) + """ + +def adjoint(input: Tensor) -> Tensor: + r""" + adjoint(input: Tensor) -> Tensor + Returns a view of the tensor conjugated and with the last two dimensions transposed. + + ``x.adjoint()`` is equivalent to ``x.transpose(-2, -1).conj()`` for complex tensors and + to ``x.transpose(-2, -1)`` for real tensors. + + Args: + {input} + + Example:: + + >>> x = torch.arange(4, dtype=torch.float) + >>> A = torch.complex(x, x).reshape(2, 2) + >>> A + tensor([[0.+0.j, 1.+1.j], + [2.+2.j, 3.+3.j]]) + >>> A.adjoint() + tensor([[0.-0.j, 2.-2.j], + [1.-1.j, 3.-3.j]]) + >>> (A.adjoint() == A.mH).all() + tensor(True) + """ + +def affine_grid_generator( + theta: Tensor, + size: Sequence[_int | SymInt], + align_corners: _bool, +) -> Tensor: ... +def alias_copy(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + Performs the same operation as :func:`torch.alias`, but all output tensors + are freshly created instead of aliasing the input. + """ + +@overload +def all(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + all(input: Tensor, *, out=None) -> Tensor + + Tests if all elements in :attr:`input` evaluate to `True`. + + .. note:: This function matches the behaviour of NumPy in returning + output of dtype `bool` for all supported dtypes except `uint8`. + For `uint8` the dtype of output is `uint8` itself. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(1, 2).bool() + >>> a + tensor([[False, True]], dtype=torch.bool) + >>> torch.all(a) + tensor(False, dtype=torch.bool) + >>> a = torch.arange(0, 3) + >>> a + tensor([0, 1, 2]) + >>> torch.all(a) + tensor(False) + + .. function:: all(input, dim, keepdim=False, *, out=None) -> Tensor + :noindex: + + For each row of :attr:`input` in the given dimension :attr:`dim`, + returns `True` if all elements in the row evaluate to `True` and `False` otherwise. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(4, 2).bool() + >>> a + tensor([[True, True], + [True, False], + [True, True], + [True, True]], dtype=torch.bool) + >>> torch.all(a, dim=1) + tensor([ True, False, True, True], dtype=torch.bool) + >>> torch.all(a, dim=0) + tensor([ True, False], dtype=torch.bool) + """ + +@overload +def all( + input: Tensor, + dim: _size | None = None, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + all(input: Tensor, *, out=None) -> Tensor + + Tests if all elements in :attr:`input` evaluate to `True`. + + .. note:: This function matches the behaviour of NumPy in returning + output of dtype `bool` for all supported dtypes except `uint8`. + For `uint8` the dtype of output is `uint8` itself. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(1, 2).bool() + >>> a + tensor([[False, True]], dtype=torch.bool) + >>> torch.all(a) + tensor(False, dtype=torch.bool) + >>> a = torch.arange(0, 3) + >>> a + tensor([0, 1, 2]) + >>> torch.all(a) + tensor(False) + + .. function:: all(input, dim, keepdim=False, *, out=None) -> Tensor + :noindex: + + For each row of :attr:`input` in the given dimension :attr:`dim`, + returns `True` if all elements in the row evaluate to `True` and `False` otherwise. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(4, 2).bool() + >>> a + tensor([[True, True], + [True, False], + [True, True], + [True, True]], dtype=torch.bool) + >>> torch.all(a, dim=1) + tensor([ True, False, True, True], dtype=torch.bool) + >>> torch.all(a, dim=0) + tensor([ True, False], dtype=torch.bool) + """ + +@overload +def all( + input: Tensor, + dim: _int, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + all(input: Tensor, *, out=None) -> Tensor + + Tests if all elements in :attr:`input` evaluate to `True`. + + .. note:: This function matches the behaviour of NumPy in returning + output of dtype `bool` for all supported dtypes except `uint8`. + For `uint8` the dtype of output is `uint8` itself. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(1, 2).bool() + >>> a + tensor([[False, True]], dtype=torch.bool) + >>> torch.all(a) + tensor(False, dtype=torch.bool) + >>> a = torch.arange(0, 3) + >>> a + tensor([0, 1, 2]) + >>> torch.all(a) + tensor(False) + + .. function:: all(input, dim, keepdim=False, *, out=None) -> Tensor + :noindex: + + For each row of :attr:`input` in the given dimension :attr:`dim`, + returns `True` if all elements in the row evaluate to `True` and `False` otherwise. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(4, 2).bool() + >>> a + tensor([[True, True], + [True, False], + [True, True], + [True, True]], dtype=torch.bool) + >>> torch.all(a, dim=1) + tensor([ True, False, True, True], dtype=torch.bool) + >>> torch.all(a, dim=0) + tensor([ True, False], dtype=torch.bool) + """ + +@overload +def all( + input: Tensor, + dim: str | EllipsisType | None, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + all(input: Tensor, *, out=None) -> Tensor + + Tests if all elements in :attr:`input` evaluate to `True`. + + .. note:: This function matches the behaviour of NumPy in returning + output of dtype `bool` for all supported dtypes except `uint8`. + For `uint8` the dtype of output is `uint8` itself. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(1, 2).bool() + >>> a + tensor([[False, True]], dtype=torch.bool) + >>> torch.all(a) + tensor(False, dtype=torch.bool) + >>> a = torch.arange(0, 3) + >>> a + tensor([0, 1, 2]) + >>> torch.all(a) + tensor(False) + + .. function:: all(input, dim, keepdim=False, *, out=None) -> Tensor + :noindex: + + For each row of :attr:`input` in the given dimension :attr:`dim`, + returns `True` if all elements in the row evaluate to `True` and `False` otherwise. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(4, 2).bool() + >>> a + tensor([[True, True], + [True, False], + [True, True], + [True, True]], dtype=torch.bool) + >>> torch.all(a, dim=1) + tensor([ True, False, True, True], dtype=torch.bool) + >>> torch.all(a, dim=0) + tensor([ True, False], dtype=torch.bool) + """ + +def allclose( + input: Tensor, + other: Tensor, + rtol: _float = 1e-05, + atol: _float = 1e-08, + equal_nan: _bool = False, +) -> _bool: + r""" + allclose(input: Tensor, other: Tensor, rtol: float = 1e-05, atol: float = 1e-08, equal_nan: bool = False) -> bool + + This function checks if :attr:`input` and :attr:`other` satisfy the condition: + + .. math:: + \lvert \text{input}_i - \text{other}_i \rvert \leq \texttt{atol} + \texttt{rtol} \times \lvert \text{other}_i \rvert + + elementwise, for all elements of :attr:`input` and :attr:`other`. The behaviour of this function is analogous to + `numpy.allclose `_ + + Args: + input (Tensor): first tensor to compare + other (Tensor): second tensor to compare + atol (float, optional): absolute tolerance. Default: 1e-08 + rtol (float, optional): relative tolerance. Default: 1e-05 + equal_nan (bool, optional): if ``True``, then two ``NaN`` s will be considered equal. Default: ``False`` + + Example:: + + >>> torch.allclose(torch.tensor([10000., 1e-07]), torch.tensor([10000.1, 1e-08])) + False + >>> torch.allclose(torch.tensor([10000., 1e-08]), torch.tensor([10000.1, 1e-09])) + True + >>> torch.allclose(torch.tensor([1.0, float('nan')]), torch.tensor([1.0, float('nan')])) + False + >>> torch.allclose(torch.tensor([1.0, float('nan')]), torch.tensor([1.0, float('nan')]), equal_nan=True) + True + """ + +def alpha_dropout(input: Tensor, p: _float, train: _bool) -> Tensor: ... +def alpha_dropout_(input: Tensor, p: _float, train: _bool) -> Tensor: ... +def amax( + input: Tensor, + dim: _int | _size = (), + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + amax(input, dim, keepdim=False, *, out=None) -> Tensor + + Returns the maximum value of each slice of the :attr:`input` tensor in the given + dimension(s) :attr:`dim`. + + .. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.8177, 1.4878, -0.2491, 0.9130], + [-0.7158, 1.1775, 2.0992, 0.4817], + [-0.0053, 0.0164, -1.3738, -0.0507], + [ 1.9700, 1.1106, -1.0318, -1.0816]]) + >>> torch.amax(a, 1) + tensor([1.4878, 2.0992, 0.0164, 1.9700]) + """ + +def amin( + input: Tensor, + dim: _int | _size = (), + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + amin(input, dim, keepdim=False, *, out=None) -> Tensor + + Returns the minimum value of each slice of the :attr:`input` tensor in the given + dimension(s) :attr:`dim`. + + .. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.6451, -0.4866, 0.2987, -1.3312], + [-0.5744, 1.2980, 1.8397, -0.2713], + [ 0.9128, 0.9214, -1.7268, -0.2995], + [ 0.9023, 0.4853, 0.9075, -1.6165]]) + >>> torch.amin(a, 1) + tensor([-1.3312, -0.5744, -1.7268, -1.6165]) + """ + +def aminmax( + input: Tensor, + *, + dim: _int | None = None, + keepdim: _bool = False, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.aminmax: + r""" + aminmax(input, *, dim=None, keepdim=False, out=None) -> (Tensor min, Tensor max) + + Computes the minimum and maximum values of the :attr:`input` tensor. + + Args: + input (Tensor): + The input tensor + + Keyword Args: + dim (Optional[int]): + The dimension along which to compute the values. If `None`, + computes the values over the entire :attr:`input` tensor. + Default is `None`. + keepdim (bool): + If `True`, the reduced dimensions will be kept in the output + tensor as dimensions with size 1 for broadcasting, otherwise + they will be removed, as if calling (:func:`torch.squeeze`). + Default is `False`. + out (Optional[Tuple[Tensor, Tensor]]): + Optional tensors on which to write the result. Must have the same + shape and dtype as the expected output. + Default is `None`. + + Returns: + A named tuple `(min, max)` containing the minimum and maximum values. + + Raises: + RuntimeError + If any of the dimensions to compute the values over has size 0. + + .. note:: + NaN values are propagated to the output if at least one value is NaN. + + .. seealso:: + :func:`torch.amin` computes just the minimum value + :func:`torch.amax` computes just the maximum value + + Example:: + + >>> torch.aminmax(torch.tensor([1, -3, 5])) + torch.return_types.aminmax( + min=tensor(-3), + max=tensor(5)) + + >>> # aminmax propagates NaNs + >>> torch.aminmax(torch.tensor([1, -3, 5, torch.nan])) + torch.return_types.aminmax( + min=tensor(nan), + max=tensor(nan)) + + >>> t = torch.arange(10).view(2, 5) + >>> t + tensor([[0, 1, 2, 3, 4], + [5, 6, 7, 8, 9]]) + >>> t.aminmax(dim=0, keepdim=True) + torch.return_types.aminmax( + min=tensor([[0, 1, 2, 3, 4]]), + max=tensor([[5, 6, 7, 8, 9]])) + """ + +def angle(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + angle(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Computes the element-wise angle (in radians) of the given :attr:`input` tensor. + + .. math:: + \text{out}_{i} = angle(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + .. note:: Starting in PyTorch 1.8, angle returns pi for negative real numbers, + zero for non-negative real numbers, and propagates NaNs. Previously + the function would return zero for all real numbers and not propagate + floating-point NaNs. + + Example:: + + >>> torch.angle(torch.tensor([-1 + 1j, -2 + 2j, 3 - 3j]))*180/3.14159 + tensor([ 135., 135, -45]) + """ + +@overload +def any(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + any(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Tests if any element in :attr:`input` evaluates to `True`. + + .. note:: This function matches the behaviour of NumPy in returning + output of dtype `bool` for all supported dtypes except `uint8`. + For `uint8` the dtype of output is `uint8` itself. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(1, 2).bool() + >>> a + tensor([[False, True]], dtype=torch.bool) + >>> torch.any(a) + tensor(True, dtype=torch.bool) + >>> a = torch.arange(0, 3) + >>> a + tensor([0, 1, 2]) + >>> torch.any(a) + tensor(True) + + .. function:: any(input, dim, keepdim=False, *, out=None) -> Tensor + :noindex: + + For each row of :attr:`input` in the given dimension :attr:`dim`, + returns `True` if any element in the row evaluate to `True` and `False` otherwise. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4, 2) < 0 + >>> a + tensor([[ True, True], + [False, True], + [ True, True], + [False, False]]) + >>> torch.any(a, 1) + tensor([ True, True, True, False]) + >>> torch.any(a, 0) + tensor([True, True]) + """ + +@overload +def any( + input: Tensor, + dim: _size | None = None, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + any(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Tests if any element in :attr:`input` evaluates to `True`. + + .. note:: This function matches the behaviour of NumPy in returning + output of dtype `bool` for all supported dtypes except `uint8`. + For `uint8` the dtype of output is `uint8` itself. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(1, 2).bool() + >>> a + tensor([[False, True]], dtype=torch.bool) + >>> torch.any(a) + tensor(True, dtype=torch.bool) + >>> a = torch.arange(0, 3) + >>> a + tensor([0, 1, 2]) + >>> torch.any(a) + tensor(True) + + .. function:: any(input, dim, keepdim=False, *, out=None) -> Tensor + :noindex: + + For each row of :attr:`input` in the given dimension :attr:`dim`, + returns `True` if any element in the row evaluate to `True` and `False` otherwise. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4, 2) < 0 + >>> a + tensor([[ True, True], + [False, True], + [ True, True], + [False, False]]) + >>> torch.any(a, 1) + tensor([ True, True, True, False]) + >>> torch.any(a, 0) + tensor([True, True]) + """ + +@overload +def any( + input: Tensor, + dim: _int, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + any(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Tests if any element in :attr:`input` evaluates to `True`. + + .. note:: This function matches the behaviour of NumPy in returning + output of dtype `bool` for all supported dtypes except `uint8`. + For `uint8` the dtype of output is `uint8` itself. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(1, 2).bool() + >>> a + tensor([[False, True]], dtype=torch.bool) + >>> torch.any(a) + tensor(True, dtype=torch.bool) + >>> a = torch.arange(0, 3) + >>> a + tensor([0, 1, 2]) + >>> torch.any(a) + tensor(True) + + .. function:: any(input, dim, keepdim=False, *, out=None) -> Tensor + :noindex: + + For each row of :attr:`input` in the given dimension :attr:`dim`, + returns `True` if any element in the row evaluate to `True` and `False` otherwise. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4, 2) < 0 + >>> a + tensor([[ True, True], + [False, True], + [ True, True], + [False, False]]) + >>> torch.any(a, 1) + tensor([ True, True, True, False]) + >>> torch.any(a, 0) + tensor([True, True]) + """ + +@overload +def any( + input: Tensor, + dim: str | EllipsisType | None, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + any(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Tests if any element in :attr:`input` evaluates to `True`. + + .. note:: This function matches the behaviour of NumPy in returning + output of dtype `bool` for all supported dtypes except `uint8`. + For `uint8` the dtype of output is `uint8` itself. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(1, 2).bool() + >>> a + tensor([[False, True]], dtype=torch.bool) + >>> torch.any(a) + tensor(True, dtype=torch.bool) + >>> a = torch.arange(0, 3) + >>> a + tensor([0, 1, 2]) + >>> torch.any(a) + tensor(True) + + .. function:: any(input, dim, keepdim=False, *, out=None) -> Tensor + :noindex: + + For each row of :attr:`input` in the given dimension :attr:`dim`, + returns `True` if any element in the row evaluate to `True` and `False` otherwise. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4, 2) < 0 + >>> a + tensor([[ True, True], + [False, True], + [ True, True], + [False, False]]) + >>> torch.any(a, 1) + tensor([ True, True, True, False]) + >>> torch.any(a, 0) + tensor([True, True]) + """ + +@overload +def arange( + start: Number, + end: Number, + step: Number, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + pin_memory: _bool = False, +) -> Tensor: + r""" + arange(start=0, end, step=1, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a 1-D tensor of size :math:`\left\lceil \frac{\text{end} - \text{start}}{\text{step}} \right\rceil` + with values from the interval ``[start, end)`` taken with common difference + :attr:`step` beginning from `start`. + + Note: When using floating-point dtypes (especially reduced precision types like ``bfloat16``), + the results may be affected by floating-point rounding behavior. Some values in the sequence + might not be exactly representable in certain floating-point formats, which can lead to + repeated values or unexpected rounding. For precise sequences, it is recommended to use + integer dtypes instead of floating-point dtypes. + + Note that non-integer :attr:`step` is subject to floating point rounding errors when + comparing against :attr:`end`; to avoid inconsistency, we advise subtracting a small epsilon from :attr:`end` + in such cases. + + .. math:: + \text{out}_{{i+1}} = \text{out}_{i} + \text{step} + + Args: + start (Number, optional): the starting value for the set of points. Default: ``0``. + end (Number): the ending value for the set of points + step (Number, optional): the gap between each pair of adjacent points. Default: ``1``. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). If `dtype` is not given, infer the data type from the other input + arguments. If any of `start`, `end`, or `stop` are floating-point, the + `dtype` is inferred to be the default dtype, see + :meth:`~torch.get_default_dtype`. Otherwise, the `dtype` is inferred to + be `torch.int64`. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.arange(5) + tensor([ 0, 1, 2, 3, 4]) + >>> torch.arange(1, 4) + tensor([ 1, 2, 3]) + >>> torch.arange(1, 2.5, 0.5) + tensor([ 1.0000, 1.5000, 2.0000]) + """ + +@overload +def arange( + start: Number, + end: Number, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + pin_memory: _bool = False, +) -> Tensor: + r""" + arange(start=0, end, step=1, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a 1-D tensor of size :math:`\left\lceil \frac{\text{end} - \text{start}}{\text{step}} \right\rceil` + with values from the interval ``[start, end)`` taken with common difference + :attr:`step` beginning from `start`. + + Note: When using floating-point dtypes (especially reduced precision types like ``bfloat16``), + the results may be affected by floating-point rounding behavior. Some values in the sequence + might not be exactly representable in certain floating-point formats, which can lead to + repeated values or unexpected rounding. For precise sequences, it is recommended to use + integer dtypes instead of floating-point dtypes. + + Note that non-integer :attr:`step` is subject to floating point rounding errors when + comparing against :attr:`end`; to avoid inconsistency, we advise subtracting a small epsilon from :attr:`end` + in such cases. + + .. math:: + \text{out}_{{i+1}} = \text{out}_{i} + \text{step} + + Args: + start (Number, optional): the starting value for the set of points. Default: ``0``. + end (Number): the ending value for the set of points + step (Number, optional): the gap between each pair of adjacent points. Default: ``1``. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). If `dtype` is not given, infer the data type from the other input + arguments. If any of `start`, `end`, or `stop` are floating-point, the + `dtype` is inferred to be the default dtype, see + :meth:`~torch.get_default_dtype`. Otherwise, the `dtype` is inferred to + be `torch.int64`. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.arange(5) + tensor([ 0, 1, 2, 3, 4]) + >>> torch.arange(1, 4) + tensor([ 1, 2, 3]) + >>> torch.arange(1, 2.5, 0.5) + tensor([ 1.0000, 1.5000, 2.0000]) + """ + +@overload +def arange( + end: Number, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + pin_memory: _bool = False, +) -> Tensor: + r""" + arange(start=0, end, step=1, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a 1-D tensor of size :math:`\left\lceil \frac{\text{end} - \text{start}}{\text{step}} \right\rceil` + with values from the interval ``[start, end)`` taken with common difference + :attr:`step` beginning from `start`. + + Note: When using floating-point dtypes (especially reduced precision types like ``bfloat16``), + the results may be affected by floating-point rounding behavior. Some values in the sequence + might not be exactly representable in certain floating-point formats, which can lead to + repeated values or unexpected rounding. For precise sequences, it is recommended to use + integer dtypes instead of floating-point dtypes. + + Note that non-integer :attr:`step` is subject to floating point rounding errors when + comparing against :attr:`end`; to avoid inconsistency, we advise subtracting a small epsilon from :attr:`end` + in such cases. + + .. math:: + \text{out}_{{i+1}} = \text{out}_{i} + \text{step} + + Args: + start (Number, optional): the starting value for the set of points. Default: ``0``. + end (Number): the ending value for the set of points + step (Number, optional): the gap between each pair of adjacent points. Default: ``1``. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). If `dtype` is not given, infer the data type from the other input + arguments. If any of `start`, `end`, or `stop` are floating-point, the + `dtype` is inferred to be the default dtype, see + :meth:`~torch.get_default_dtype`. Otherwise, the `dtype` is inferred to + be `torch.int64`. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.arange(5) + tensor([ 0, 1, 2, 3, 4]) + >>> torch.arange(1, 4) + tensor([ 1, 2, 3]) + >>> torch.arange(1, 2.5, 0.5) + tensor([ 1.0000, 1.5000, 2.0000]) + """ + +@overload +def arange( + end: Number | _complex, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + arange(start=0, end, step=1, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a 1-D tensor of size :math:`\left\lceil \frac{\text{end} - \text{start}}{\text{step}} \right\rceil` + with values from the interval ``[start, end)`` taken with common difference + :attr:`step` beginning from `start`. + + Note: When using floating-point dtypes (especially reduced precision types like ``bfloat16``), + the results may be affected by floating-point rounding behavior. Some values in the sequence + might not be exactly representable in certain floating-point formats, which can lead to + repeated values or unexpected rounding. For precise sequences, it is recommended to use + integer dtypes instead of floating-point dtypes. + + Note that non-integer :attr:`step` is subject to floating point rounding errors when + comparing against :attr:`end`; to avoid inconsistency, we advise subtracting a small epsilon from :attr:`end` + in such cases. + + .. math:: + \text{out}_{{i+1}} = \text{out}_{i} + \text{step} + + Args: + start (Number, optional): the starting value for the set of points. Default: ``0``. + end (Number): the ending value for the set of points + step (Number, optional): the gap between each pair of adjacent points. Default: ``1``. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). If `dtype` is not given, infer the data type from the other input + arguments. If any of `start`, `end`, or `stop` are floating-point, the + `dtype` is inferred to be the default dtype, see + :meth:`~torch.get_default_dtype`. Otherwise, the `dtype` is inferred to + be `torch.int64`. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.arange(5) + tensor([ 0, 1, 2, 3, 4]) + >>> torch.arange(1, 4) + tensor([ 1, 2, 3]) + >>> torch.arange(1, 2.5, 0.5) + tensor([ 1.0000, 1.5000, 2.0000]) + """ + +@overload +def arange( + start: Number | _complex, + end: Number | _complex, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + arange(start=0, end, step=1, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a 1-D tensor of size :math:`\left\lceil \frac{\text{end} - \text{start}}{\text{step}} \right\rceil` + with values from the interval ``[start, end)`` taken with common difference + :attr:`step` beginning from `start`. + + Note: When using floating-point dtypes (especially reduced precision types like ``bfloat16``), + the results may be affected by floating-point rounding behavior. Some values in the sequence + might not be exactly representable in certain floating-point formats, which can lead to + repeated values or unexpected rounding. For precise sequences, it is recommended to use + integer dtypes instead of floating-point dtypes. + + Note that non-integer :attr:`step` is subject to floating point rounding errors when + comparing against :attr:`end`; to avoid inconsistency, we advise subtracting a small epsilon from :attr:`end` + in such cases. + + .. math:: + \text{out}_{{i+1}} = \text{out}_{i} + \text{step} + + Args: + start (Number, optional): the starting value for the set of points. Default: ``0``. + end (Number): the ending value for the set of points + step (Number, optional): the gap between each pair of adjacent points. Default: ``1``. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). If `dtype` is not given, infer the data type from the other input + arguments. If any of `start`, `end`, or `stop` are floating-point, the + `dtype` is inferred to be the default dtype, see + :meth:`~torch.get_default_dtype`. Otherwise, the `dtype` is inferred to + be `torch.int64`. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.arange(5) + tensor([ 0, 1, 2, 3, 4]) + >>> torch.arange(1, 4) + tensor([ 1, 2, 3]) + >>> torch.arange(1, 2.5, 0.5) + tensor([ 1.0000, 1.5000, 2.0000]) + """ + +@overload +def arange( + start: Number | _complex, + end: Number | _complex, + step: Number | _complex = 1, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + arange(start=0, end, step=1, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a 1-D tensor of size :math:`\left\lceil \frac{\text{end} - \text{start}}{\text{step}} \right\rceil` + with values from the interval ``[start, end)`` taken with common difference + :attr:`step` beginning from `start`. + + Note: When using floating-point dtypes (especially reduced precision types like ``bfloat16``), + the results may be affected by floating-point rounding behavior. Some values in the sequence + might not be exactly representable in certain floating-point formats, which can lead to + repeated values or unexpected rounding. For precise sequences, it is recommended to use + integer dtypes instead of floating-point dtypes. + + Note that non-integer :attr:`step` is subject to floating point rounding errors when + comparing against :attr:`end`; to avoid inconsistency, we advise subtracting a small epsilon from :attr:`end` + in such cases. + + .. math:: + \text{out}_{{i+1}} = \text{out}_{i} + \text{step} + + Args: + start (Number, optional): the starting value for the set of points. Default: ``0``. + end (Number): the ending value for the set of points + step (Number, optional): the gap between each pair of adjacent points. Default: ``1``. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). If `dtype` is not given, infer the data type from the other input + arguments. If any of `start`, `end`, or `stop` are floating-point, the + `dtype` is inferred to be the default dtype, see + :meth:`~torch.get_default_dtype`. Otherwise, the `dtype` is inferred to + be `torch.int64`. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.arange(5) + tensor([ 0, 1, 2, 3, 4]) + >>> torch.arange(1, 4) + tensor([ 1, 2, 3]) + >>> torch.arange(1, 2.5, 0.5) + tensor([ 1.0000, 1.5000, 2.0000]) + """ + +def arccos(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + arccos(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Alias for :func:`torch.acos`. + """ + +def arccos_(input: Tensor) -> Tensor: ... +def arccosh(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + arccosh(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Alias for :func:`torch.acosh`. + """ + +def arccosh_(input: Tensor) -> Tensor: ... +def arcsin(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + arcsin(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Alias for :func:`torch.asin`. + """ + +def arcsin_(input: Tensor) -> Tensor: ... +def arcsinh(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + arcsinh(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Alias for :func:`torch.asinh`. + """ + +def arcsinh_(input: Tensor) -> Tensor: ... +def arctan(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + arctan(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Alias for :func:`torch.atan`. + """ + +def arctan2( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + arctan2(input: Tensor, other: Tensor, *, out: Optional[Tensor]) -> Tensor + Alias for :func:`torch.atan2`. + """ + +def arctan_(input: Tensor) -> Tensor: ... +def arctanh(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + arctanh(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Alias for :func:`torch.atanh`. + """ + +def arctanh_(input: Tensor) -> Tensor: ... +def argmax( + input: Tensor, + dim: _int | None = None, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + argmax(input) -> LongTensor + + Returns the indices of the maximum value of all elements in the :attr:`input` tensor. + + This is the second value returned by :meth:`torch.max`. See its + documentation for the exact semantics of this method. + + .. note:: If there are multiple maximal values then the indices of the first maximal value are returned. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], + [-0.7401, -0.8805, -0.3402, -1.1936], + [ 0.4907, -1.3948, -1.0691, -0.3132], + [-1.6092, 0.5419, -0.2993, 0.3195]]) + >>> torch.argmax(a) + tensor(0) + + .. function:: argmax(input, dim, keepdim=False) -> LongTensor + :noindex: + + Returns the indices of the maximum values of a tensor across a dimension. + + This is the second value returned by :meth:`torch.max`. See its + documentation for the exact semantics of this method. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + If ``None``, the argmax of the flattened input is returned. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], + [-0.7401, -0.8805, -0.3402, -1.1936], + [ 0.4907, -1.3948, -1.0691, -0.3132], + [-1.6092, 0.5419, -0.2993, 0.3195]]) + >>> torch.argmax(a, dim=1) + tensor([ 0, 2, 0, 1]) + """ + +def argmin( + input: Tensor, + dim: _int | None = None, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + argmin(input, dim=None, keepdim=False) -> LongTensor + + Returns the indices of the minimum value(s) of the flattened tensor or along a dimension + + This is the second value returned by :meth:`torch.min`. See its + documentation for the exact semantics of this method. + + .. note:: If there are multiple minimal values then the indices of the first minimal value are returned. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + If ``None``, the argmin of the flattened input is returned. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.1139, 0.2254, -0.1381, 0.3687], + [ 1.0100, -1.1975, -0.0102, -0.4732], + [-0.9240, 0.1207, -0.7506, -1.0213], + [ 1.7809, -1.2960, 0.9384, 0.1438]]) + >>> torch.argmin(a) + tensor(13) + >>> torch.argmin(a, dim=1) + tensor([ 2, 1, 3, 1]) + >>> torch.argmin(a, dim=1, keepdim=True) + tensor([[2], + [1], + [3], + [1]]) + """ + +@overload +def argsort( + input: Tensor, + *, + stable: _bool, + dim: _int = -1, + descending: _bool = False, + out: Tensor | None = None, +) -> Tensor: + r""" + argsort(input, dim=-1, descending=False, *, stable=False) -> Tensor + + Returns the indices that sort a tensor along a given dimension in ascending + order by value. + + This is the second value returned by :meth:`torch.sort`. See its documentation + for the exact semantics of this method. + + If :attr:`stable` is ``True`` then the sorting routine becomes stable, preserving + the order of equivalent elements. If ``False``, the relative order of values + which compare equal is not guaranteed. ``True`` is slower. + + Args: + input (Tensor): the input tensor. + dim (int, optional): the dimension to sort along + descending (bool, optional): controls the sorting order (ascending or descending) + + Keyword args: + stable (bool, optional): controls the relative order of equivalent elements + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.0785, 1.5267, -0.8521, 0.4065], + [ 0.1598, 0.0788, -0.0745, -1.2700], + [ 1.2208, 1.0722, -0.7064, 1.2564], + [ 0.0669, -0.2318, -0.8229, -0.9280]]) + + + >>> torch.argsort(a, dim=1) + tensor([[2, 0, 3, 1], + [3, 2, 1, 0], + [2, 1, 0, 3], + [3, 2, 1, 0]]) + """ + +@overload +def argsort( + input: Tensor, + dim: _int = -1, + descending: _bool = False, +) -> Tensor: + r""" + argsort(input, dim=-1, descending=False, *, stable=False) -> Tensor + + Returns the indices that sort a tensor along a given dimension in ascending + order by value. + + This is the second value returned by :meth:`torch.sort`. See its documentation + for the exact semantics of this method. + + If :attr:`stable` is ``True`` then the sorting routine becomes stable, preserving + the order of equivalent elements. If ``False``, the relative order of values + which compare equal is not guaranteed. ``True`` is slower. + + Args: + input (Tensor): the input tensor. + dim (int, optional): the dimension to sort along + descending (bool, optional): controls the sorting order (ascending or descending) + + Keyword args: + stable (bool, optional): controls the relative order of equivalent elements + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.0785, 1.5267, -0.8521, 0.4065], + [ 0.1598, 0.0788, -0.0745, -1.2700], + [ 1.2208, 1.0722, -0.7064, 1.2564], + [ 0.0669, -0.2318, -0.8229, -0.9280]]) + + + >>> torch.argsort(a, dim=1) + tensor([[2, 0, 3, 1], + [3, 2, 1, 0], + [2, 1, 0, 3], + [3, 2, 1, 0]]) + """ + +@overload +def argsort( + input: Tensor, + dim: str | EllipsisType | None, + descending: _bool = False, +) -> Tensor: + r""" + argsort(input, dim=-1, descending=False, *, stable=False) -> Tensor + + Returns the indices that sort a tensor along a given dimension in ascending + order by value. + + This is the second value returned by :meth:`torch.sort`. See its documentation + for the exact semantics of this method. + + If :attr:`stable` is ``True`` then the sorting routine becomes stable, preserving + the order of equivalent elements. If ``False``, the relative order of values + which compare equal is not guaranteed. ``True`` is slower. + + Args: + input (Tensor): the input tensor. + dim (int, optional): the dimension to sort along + descending (bool, optional): controls the sorting order (ascending or descending) + + Keyword args: + stable (bool, optional): controls the relative order of equivalent elements + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.0785, 1.5267, -0.8521, 0.4065], + [ 0.1598, 0.0788, -0.0745, -1.2700], + [ 1.2208, 1.0722, -0.7064, 1.2564], + [ 0.0669, -0.2318, -0.8229, -0.9280]]) + + + >>> torch.argsort(a, dim=1) + tensor([[2, 0, 3, 1], + [3, 2, 1, 0], + [2, 1, 0, 3], + [3, 2, 1, 0]]) + """ + +def argwhere(input: Tensor) -> Tensor: + r""" + argwhere(input) -> Tensor + + Returns a tensor containing the indices of all non-zero elements of + :attr:`input`. Each row in the result contains the indices of a non-zero + element in :attr:`input`. The result is sorted lexicographically, with + the last index changing the fastest (C-style). + + If :attr:`input` has :math:`n` dimensions, then the resulting indices tensor + :attr:`out` is of size :math:`(z \times n)`, where :math:`z` is the total number of + non-zero elements in the :attr:`input` tensor. + + .. note:: + This function is similar to NumPy's `argwhere`. + + When :attr:`input` is on CUDA, this function causes host-device synchronization. + + Args: + {input} + + Example:: + + >>> t = torch.tensor([1, 0, 1]) + >>> torch.argwhere(t) + tensor([[0], + [2]]) + >>> t = torch.tensor([[1, 0, 1], [0, 1, 1]]) + >>> torch.argwhere(t) + tensor([[0, 0], + [0, 2], + [1, 1], + [1, 2]]) + """ + +def as_strided( + input: Tensor, + size: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + storage_offset: _int | SymInt | None = None, +) -> Tensor: + r""" + as_strided(input, size, stride, storage_offset=None) -> Tensor + + Create a view of an existing `torch.Tensor` :attr:`input` with specified + :attr:`size`, :attr:`stride` and :attr:`storage_offset`. + + .. warning:: + Prefer using other view functions, like :meth:`torch.Tensor.view` or + :meth:`torch.Tensor.expand`, to setting a view's strides manually with + `as_strided`, as this function will throw an error on non-standard Pytorch + backends (that do not have a concept of stride) and the result will depend + on the current layout in memory. The constructed view must only refer to + elements within the Tensor's storage or a runtime error will be thrown. + If the generated view is "overlapped" (with multiple indices referring to + the same element in memory), the behavior of inplace operations on this view + is undefined (and might not throw runtime errors). + + Args: + input (Tensor): the input tensor. + size (tuple or ints): the shape of the output tensor + stride (tuple or ints): the stride of the output tensor + storage_offset (int, optional): the offset in the underlying storage of the output tensor. + If ``None``, the storage_offset of the output tensor will match the input tensor. + + Example:: + + >>> x = torch.randn(3, 3) + >>> x + tensor([[ 0.9039, 0.6291, 1.0795], + [ 0.1586, 2.1939, -0.4900], + [-0.1909, -0.7503, 1.9355]]) + >>> t = torch.as_strided(x, (2, 2), (1, 2)) + >>> t + tensor([[0.9039, 1.0795], + [0.6291, 0.1586]]) + >>> t = torch.as_strided(x, (2, 2), (1, 2), 1) + tensor([[0.6291, 0.1586], + [1.0795, 2.1939]]) + """ + +def as_strided_( + input: Tensor, + size: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + storage_offset: _int | SymInt | None = None, +) -> Tensor: ... +def as_strided_copy( + input: Tensor, + size: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + storage_offset: _int | SymInt | None = None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.as_strided`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def as_strided_scatter( + input: Tensor, + src: Tensor, + size: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + storage_offset: _int | SymInt | None = None, +) -> Tensor: + r""" + as_strided_scatter(input, src, size, stride, storage_offset=None) -> Tensor + + Embeds the values of the :attr:`src` tensor into :attr:`input` along + the elements corresponding to the result of calling + input.as_strided(size, stride, storage_offset). + + This function returns a tensor with fresh storage; it does not + return a view. + + Args: + input (Tensor): the input tensor. + size (tuple or ints): the shape of the output tensor + stride (tuple or ints): the stride of the output tensor + storage_offset (int, optional): the offset in the underlying storage of the output tensor + + .. note:: + + :attr:`src` must be of the proper size in order to be embedded + into :attr:`input`. Specifically, it should have the same shape as + `torch.as_strided(input, size, stride, storage_offset)` + + Example:: + + >>> a = torch.arange(4).reshape(2, 2) + 1 + >>> a + tensor([[1, 2], + [3, 4]]) + >>> b = torch.zeros(3, 3) + >>> b + tensor([[0., 0., 0.], + [0., 0., 0.], + [0., 0., 0.]]) + >>> torch.as_strided_scatter(b, a, (2, 2), (1, 2)) + tensor([[1., 3., 2.], + [4., 0., 0.], + [0., 0., 0.]]) + """ + +def as_tensor( + data: Any, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, +) -> Tensor: + r""" + as_tensor(data: Any, dtype: Optional[dtype] = None, device: Optional[DeviceLikeType]) -> Tensor + + Converts :attr:`data` into a tensor, sharing data and preserving autograd + history if possible. + + If :attr:`data` is already a tensor with the requested dtype and device + then :attr:`data` itself is returned, but if :attr:`data` is a + tensor with a different dtype or device then it's copied as if using + `data.to(dtype=dtype, device=device)`. + + If :attr:`data` is a NumPy array (an ndarray) with the same dtype and device then a + tensor is constructed using :func:`torch.from_numpy`. + + If :attr:`data` is a CuPy array, the returned tensor will be located on the same device as the CuPy array unless + specifically overwritten by :attr:`device` or a default device. The device of the CuPy array is inferred from the + pointer of the array using `cudaPointerGetAttributes` unless :attr:`device` is provided with an explicit device index. + + .. seealso:: + + :func:`torch.tensor` never shares its data and creates a new "leaf tensor" (see :doc:`/notes/autograd`). + + + Args: + data (array_like): Initial data for the tensor. Can be a list, tuple, + NumPy ``ndarray``, scalar, and other types. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, infers data type from :attr:`data`. + device (:class:`torch.device`, optional): the device of the constructed tensor. If None and data is a tensor + then the device of data is used. If None and data is not a tensor then + the result tensor is constructed on the current device. + + + Example:: + + >>> a = numpy.array([1, 2, 3]) + >>> t = torch.as_tensor(a) + >>> t + tensor([ 1, 2, 3]) + >>> t[0] = -1 + >>> a + array([-1, 2, 3]) + + >>> a = numpy.array([1, 2, 3]) + >>> t = torch.as_tensor(a, device=torch.device('cuda')) + >>> t + tensor([ 1, 2, 3]) + >>> t[0] = -1 + >>> a + array([1, 2, 3]) + """ + +def asarray( + obj: Any, + *, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + copy: _bool | None = None, + requires_grad: _bool = False, +) -> Tensor: + r""" + asarray(obj: Any, *, dtype: Optional[dtype], device: Optional[DeviceLikeType], copy: Optional[bool] = None, requires_grad: bool = False) -> Tensor # noqa: B950 + + Converts :attr:`obj` to a tensor. + + :attr:`obj` can be one of: + + 1. a tensor + 2. a NumPy array or a NumPy scalar + 3. a DLPack capsule + 4. an object that implements Python's buffer protocol + 5. a scalar + 6. a sequence of scalars + + When :attr:`obj` is a tensor, NumPy array, or DLPack capsule the returned tensor will, + by default, not require a gradient, have the same datatype as :attr:`obj`, be on the + same device, and share memory with it. These properties can be controlled with the + :attr:`dtype`, :attr:`device`, :attr:`copy`, and :attr:`requires_grad` keyword arguments. + If the returned tensor is of a different datatype, on a different device, or a copy is + requested then it will not share its memory with :attr:`obj`. If :attr:`requires_grad` + is ``True`` then the returned tensor will require a gradient, and if :attr:`obj` is + also a tensor with an autograd history then the returned tensor will have the same history. + + When :attr:`obj` is not a tensor, NumPy array, or DLPack capsule but implements Python's + buffer protocol then the buffer is interpreted as an array of bytes grouped according to + the size of the datatype passed to the :attr:`dtype` keyword argument. (If no datatype is + passed then the default floating point datatype is used, instead.) The returned tensor + will have the specified datatype (or default floating point datatype if none is specified) + and, by default, be on the CPU device and share memory with the buffer. + + When :attr:`obj` is a NumPy scalar, the returned tensor will be a 0-dimensional tensor on + the CPU and that doesn't share its memory (i.e. ``copy=True``). By default datatype will + be the PyTorch datatype corresponding to the NumPy's scalar's datatype. + + When :attr:`obj` is none of the above but a scalar, or a sequence of scalars then the + returned tensor will, by default, infer its datatype from the scalar values, be on the + current default device, and not share its memory. + + .. seealso:: + + :func:`torch.tensor` creates a tensor that always copies the data from the input object. + :func:`torch.from_numpy` creates a tensor that always shares memory from NumPy arrays. + :func:`torch.frombuffer` creates a tensor that always shares memory from objects that + implement the buffer protocol. + :func:`torch.from_dlpack` creates a tensor that always shares memory from + DLPack capsules. + + Args: + obj (object): a tensor, NumPy array, DLPack Capsule, object that implements Python's + buffer protocol, scalar, or sequence of scalars. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the datatype of the returned tensor. + Default: ``None``, which causes the datatype of the returned tensor to be + inferred from :attr:`obj`. + copy (bool, optional): controls whether the returned tensor shares memory with :attr:`obj`. + Default: ``None``, which causes the returned tensor to share memory with :attr:`obj` + whenever possible. If ``True`` then the returned tensor does not share its memory. + If ``False`` then the returned tensor shares its memory with :attr:`obj` and an + error is thrown if it cannot. + device (:class:`torch.device`, optional): the device of the returned tensor. + Default: ``None``, which causes the device of :attr:`obj` to be used. Or, if + :attr:`obj` is a Python sequence, the current default device will be used. + requires_grad (bool, optional): whether the returned tensor requires grad. + Default: ``False``, which causes the returned tensor not to require a gradient. + If ``True``, then the returned tensor will require a gradient, and if :attr:`obj` + is also a tensor with an autograd history then the returned tensor will have + the same history. + + Example:: + + >>> a = torch.tensor([1, 2, 3]) + >>> # Shares memory with tensor 'a' + >>> b = torch.asarray(a) + >>> a.data_ptr() == b.data_ptr() + True + >>> # Forces memory copy + >>> c = torch.asarray(a, copy=True) + >>> a.data_ptr() == c.data_ptr() + False + + >>> a = torch.tensor([1., 2., 3.], requires_grad=True) + >>> b = a + 2 + >>> b + tensor([3., 4., 5.], grad_fn=) + >>> # Shares memory with tensor 'b', with no grad + >>> c = torch.asarray(b) + >>> c + tensor([3., 4., 5.]) + >>> # Shares memory with tensor 'b', retaining autograd history + >>> d = torch.asarray(b, requires_grad=True) + >>> d + tensor([3., 4., 5.], grad_fn=) + + >>> array = numpy.array([1, 2, 3]) + >>> # Shares memory with array 'array' + >>> t1 = torch.asarray(array) + >>> array.__array_interface__['data'][0] == t1.data_ptr() + True + >>> # Copies memory due to dtype mismatch + >>> t2 = torch.asarray(array, dtype=torch.float32) + >>> array.__array_interface__['data'][0] == t2.data_ptr() + False + + >>> scalar = numpy.float64(0.5) + >>> torch.asarray(scalar) + tensor(0.5000, dtype=torch.float64) + """ + +def asin(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + asin(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Returns a new tensor with the arcsine of the elements (in radians) in the :attr:`input` tensor. + + .. math:: + \text{out}_{i} = \sin^{-1}(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-0.5962, 1.4985, -0.4396, 1.4525]) + >>> torch.asin(a) + tensor([-0.6387, nan, -0.4552, nan]) + """ + +def asin_(input: Tensor) -> Tensor: ... +def asinh(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + asinh(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Returns a new tensor with the inverse hyperbolic sine of the elements of :attr:`input`. + + .. math:: + \text{out}_{i} = \sinh^{-1}(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword arguments: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.1606, -1.4267, -1.0899, -1.0250 ]) + >>> torch.asinh(a) + tensor([ 0.1599, -1.1534, -0.9435, -0.8990 ]) + """ + +def asinh_(input: Tensor) -> Tensor: ... +def atan(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + atan(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Returns a new tensor with the arctangent of the elements (in radians) in the :attr:`input` tensor. + + .. math:: + \text{out}_{i} = \tan^{-1}(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.2341, 0.2539, -0.6256, -0.6448]) + >>> torch.atan(a) + tensor([ 0.2299, 0.2487, -0.5591, -0.5727]) + """ + +def atan2( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + atan2(input: Tensor, other: Tensor, *, out: Optional[Tensor]) -> Tensor + + Element-wise arctangent of :math:`\text{input}_{i} / \text{other}_{i}` + with consideration of the quadrant. Returns a new tensor with the signed angles + in radians between vector :math:`(\text{other}_{i}, \text{input}_{i})` + and vector :math:`(1, 0)`. (Note that :math:`\text{other}_{i}`, the second + parameter, is the x-coordinate, while :math:`\text{input}_{i}`, the first + parameter, is the y-coordinate.) + + The shapes of ``input`` and ``other`` must be + :ref:`broadcastable `. + + Args: + input (Tensor): the first input tensor + other (Tensor): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.9041, 0.0196, -0.3108, -2.4423]) + >>> torch.atan2(a, torch.randn(4)) + tensor([ 0.9833, 0.0811, -1.9743, -1.4151]) + """ + +def atan_(input: Tensor) -> Tensor: ... +def atanh(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + atanh(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Returns a new tensor with the inverse hyperbolic tangent of the elements of :attr:`input`. + + Note: + The domain of the inverse hyperbolic tangent is `(-1, 1)` and values outside this range + will be mapped to ``NaN``, except for the values `1` and `-1` for which the output is + mapped to `+/-INF` respectively. + + .. math:: + \text{out}_{i} = \tanh^{-1}(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword arguments: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4).uniform_(-1, 1) + >>> a + tensor([ -0.9385, 0.2968, -0.8591, -0.1871 ]) + >>> torch.atanh(a) + tensor([ -1.7253, 0.3060, -1.2899, -0.1893 ]) + """ + +def atanh_(input: Tensor) -> Tensor: ... +def avg_pool1d( + input: Tensor, + kernel_size: _int | _size, + stride: _int | _size = (), + padding: _int | _size = 0, + ceil_mode: _bool = False, + count_include_pad: _bool = True, +) -> Tensor: ... +@overload +def baddbmm( + beta: Number | _complex, + self: Tensor, + alpha: Number | _complex, + batch1: Tensor, + batch2: Tensor, +) -> Tensor: + r""" + baddbmm(input, batch1, batch2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices in :attr:`batch1` + and :attr:`batch2`. + :attr:`input` is added to the final result. + + :attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the same + number of matrices. + + If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a + :math:`(b \times m \times p)` tensor, then :attr:`input` must be + :ref:`broadcastable ` with a + :math:`(b \times n \times p)` tensor and :attr:`out` will be a + :math:`(b \times n \times p)` tensor. Both :attr:`alpha` and :attr:`beta` mean the + same as the scaling factors used in :meth:`torch.addbmm`. + + .. math:: + \text{out}_i = \beta\ \text{input}_i + \alpha\ (\text{batch1}_i \mathbin{@} \text{batch2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): the tensor to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{batch1} \mathbin{@} \text{batch2}` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(10, 3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.baddbmm(M, batch1, batch2).size() + torch.Size([10, 3, 5]) + """ + +@overload +def baddbmm( + beta: Number | _complex, + self: Tensor, + alpha: Number | _complex, + batch1: Tensor, + batch2: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + baddbmm(input, batch1, batch2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices in :attr:`batch1` + and :attr:`batch2`. + :attr:`input` is added to the final result. + + :attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the same + number of matrices. + + If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a + :math:`(b \times m \times p)` tensor, then :attr:`input` must be + :ref:`broadcastable ` with a + :math:`(b \times n \times p)` tensor and :attr:`out` will be a + :math:`(b \times n \times p)` tensor. Both :attr:`alpha` and :attr:`beta` mean the + same as the scaling factors used in :meth:`torch.addbmm`. + + .. math:: + \text{out}_i = \beta\ \text{input}_i + \alpha\ (\text{batch1}_i \mathbin{@} \text{batch2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): the tensor to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{batch1} \mathbin{@} \text{batch2}` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(10, 3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.baddbmm(M, batch1, batch2).size() + torch.Size([10, 3, 5]) + """ + +@overload +def baddbmm( + input: Tensor, + batch1: Tensor, + batch2: Tensor, + *, + beta: Number | _complex = 1, + alpha: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + baddbmm(input, batch1, batch2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices in :attr:`batch1` + and :attr:`batch2`. + :attr:`input` is added to the final result. + + :attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the same + number of matrices. + + If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a + :math:`(b \times m \times p)` tensor, then :attr:`input` must be + :ref:`broadcastable ` with a + :math:`(b \times n \times p)` tensor and :attr:`out` will be a + :math:`(b \times n \times p)` tensor. Both :attr:`alpha` and :attr:`beta` mean the + same as the scaling factors used in :meth:`torch.addbmm`. + + .. math:: + \text{out}_i = \beta\ \text{input}_i + \alpha\ (\text{batch1}_i \mathbin{@} \text{batch2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): the tensor to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{batch1} \mathbin{@} \text{batch2}` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(10, 3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.baddbmm(M, batch1, batch2).size() + torch.Size([10, 3, 5]) + """ + +@overload +def baddbmm( + input: Tensor, + batch1: Tensor, + batch2: Tensor, + out_dtype: _dtype, + *, + beta: Number | _complex = 1, + alpha: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + baddbmm(input, batch1, batch2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices in :attr:`batch1` + and :attr:`batch2`. + :attr:`input` is added to the final result. + + :attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the same + number of matrices. + + If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a + :math:`(b \times m \times p)` tensor, then :attr:`input` must be + :ref:`broadcastable ` with a + :math:`(b \times n \times p)` tensor and :attr:`out` will be a + :math:`(b \times n \times p)` tensor. Both :attr:`alpha` and :attr:`beta` mean the + same as the scaling factors used in :meth:`torch.addbmm`. + + .. math:: + \text{out}_i = \beta\ \text{input}_i + \alpha\ (\text{batch1}_i \mathbin{@} \text{batch2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): the tensor to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{batch1} \mathbin{@} \text{batch2}` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(10, 3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.baddbmm(M, batch1, batch2).size() + torch.Size([10, 3, 5]) + """ + +@overload +def baddbmm( + beta: Number | _complex, + self: Tensor, + batch1: Tensor, + batch2: Tensor, +) -> Tensor: + r""" + baddbmm(input, batch1, batch2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices in :attr:`batch1` + and :attr:`batch2`. + :attr:`input` is added to the final result. + + :attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the same + number of matrices. + + If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a + :math:`(b \times m \times p)` tensor, then :attr:`input` must be + :ref:`broadcastable ` with a + :math:`(b \times n \times p)` tensor and :attr:`out` will be a + :math:`(b \times n \times p)` tensor. Both :attr:`alpha` and :attr:`beta` mean the + same as the scaling factors used in :meth:`torch.addbmm`. + + .. math:: + \text{out}_i = \beta\ \text{input}_i + \alpha\ (\text{batch1}_i \mathbin{@} \text{batch2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): the tensor to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{batch1} \mathbin{@} \text{batch2}` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(10, 3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.baddbmm(M, batch1, batch2).size() + torch.Size([10, 3, 5]) + """ + +@overload +def baddbmm( + beta: Number | _complex, + self: Tensor, + batch1: Tensor, + batch2: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + baddbmm(input, batch1, batch2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices in :attr:`batch1` + and :attr:`batch2`. + :attr:`input` is added to the final result. + + :attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the same + number of matrices. + + If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a + :math:`(b \times m \times p)` tensor, then :attr:`input` must be + :ref:`broadcastable ` with a + :math:`(b \times n \times p)` tensor and :attr:`out` will be a + :math:`(b \times n \times p)` tensor. Both :attr:`alpha` and :attr:`beta` mean the + same as the scaling factors used in :meth:`torch.addbmm`. + + .. math:: + \text{out}_i = \beta\ \text{input}_i + \alpha\ (\text{batch1}_i \mathbin{@} \text{batch2}_i) + + If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in + it will not be propagated. + + For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and + :attr:`alpha` must be real numbers, otherwise they should be integers. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): the tensor to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{batch1} \mathbin{@} \text{batch2}` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + + Example:: + + >>> M = torch.randn(10, 3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.baddbmm(M, batch1, batch2).size() + torch.Size([10, 3, 5]) + """ + +@overload +def bartlett_window( + window_length: _int, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + bartlett_window(window_length, periodic=True, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Bartlett window function. + + .. math:: + w[n] = 1 - \left| \frac{2n}{N-1} - 1 \right| = \begin{cases} + \frac{2n}{N - 1} & \text{if } 0 \leq n \leq \frac{N - 1}{2} \\ + 2 - \frac{2n}{N - 1} & \text{if } \frac{N - 1}{2} < n < N \\ + \end{cases}, + + where :math:`N` is the full window size. + + The input :attr:`window_length` is a positive integer controlling the + returned window size. :attr:`periodic` flag determines whether the returned + window trims off the last duplicate value from the symmetric window and is + ready to be used as a periodic window with functions like + :meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in + above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have + ``torch.bartlett_window(L, periodic=True)`` equal to + ``torch.bartlett_window(L + 1, periodic=False)[:-1])``. + + .. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. + + Arguments: + window_length (int): the size of returned window + periodic (bool, optional): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window + """ + +@overload +def bartlett_window( + window_length: _int, + periodic: _bool, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + bartlett_window(window_length, periodic=True, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Bartlett window function. + + .. math:: + w[n] = 1 - \left| \frac{2n}{N-1} - 1 \right| = \begin{cases} + \frac{2n}{N - 1} & \text{if } 0 \leq n \leq \frac{N - 1}{2} \\ + 2 - \frac{2n}{N - 1} & \text{if } \frac{N - 1}{2} < n < N \\ + \end{cases}, + + where :math:`N` is the full window size. + + The input :attr:`window_length` is a positive integer controlling the + returned window size. :attr:`periodic` flag determines whether the returned + window trims off the last duplicate value from the symmetric window and is + ready to be used as a periodic window with functions like + :meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in + above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have + ``torch.bartlett_window(L, periodic=True)`` equal to + ``torch.bartlett_window(L + 1, periodic=False)[:-1])``. + + .. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. + + Arguments: + window_length (int): the size of returned window + periodic (bool, optional): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window + """ + +def batch_norm( + input: Tensor, + weight: Tensor | None, + bias: Tensor | None, + running_mean: Tensor | None, + running_var: Tensor | None, + training: _bool, + momentum: _float, + eps: _float, + cudnn_enabled: _bool, +) -> Tensor: ... +def batch_norm_backward_elemt( + grad_out: Tensor, + input: Tensor, + mean: Tensor, + invstd: Tensor, + weight: Tensor | None, + sum_dy: Tensor, + sum_dy_xmu: Tensor, + count: Tensor, +) -> Tensor: ... +def batch_norm_backward_reduce( + grad_out: Tensor, + input: Tensor, + mean: Tensor, + invstd: Tensor, + weight: Tensor | None, + input_g: _bool, + weight_g: _bool, + bias_g: _bool, +) -> tuple[Tensor, Tensor, Tensor, Tensor]: ... +def batch_norm_elemt( + input: Tensor, + weight: Tensor | None, + bias: Tensor | None, + mean: Tensor, + invstd: Tensor, + eps: _float, + *, + out: Tensor | None = None, +) -> Tensor: ... +def batch_norm_gather_stats( + input: Tensor, + mean: Tensor, + invstd: Tensor, + running_mean: Tensor | None, + running_var: Tensor | None, + momentum: _float, + eps: _float, + count: _int, +) -> tuple[Tensor, Tensor]: ... +def batch_norm_gather_stats_with_counts( + input: Tensor, + mean: Tensor, + invstd: Tensor, + running_mean: Tensor | None, + running_var: Tensor | None, + momentum: _float, + eps: _float, + counts: Tensor, +) -> tuple[Tensor, Tensor]: ... +def batch_norm_stats(input: Tensor, eps: _float) -> tuple[Tensor, Tensor]: ... +def batch_norm_update_stats( + input: Tensor, + running_mean: Tensor | None, + running_var: Tensor | None, + momentum: _float, +) -> tuple[Tensor, Tensor]: ... +@overload +def bernoulli( + input: Tensor, + *, + generator: Generator | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + bernoulli(input: Tensor, *, generator: Optional[Generator], out: Optional[Tensor]) -> Tensor + + Draws binary random numbers (0 or 1) from a Bernoulli distribution. + + The :attr:`input` tensor should be a tensor containing probabilities + to be used for drawing the binary random number. + Hence, all values in :attr:`input` have to be in the range: + :math:`0 \leq \text{input}_i \leq 1`. + + The :math:`\text{i}^{th}` element of the output tensor will draw a + value :math:`1` according to the :math:`\text{i}^{th}` probability value given + in :attr:`input`. + + .. math:: + \text{out}_{i} \sim \mathrm{Bernoulli}(p = \text{input}_{i}) + + The returned :attr:`out` tensor only has values 0 or 1 and is of the same + shape as :attr:`input`. + + :attr:`out` can have integral ``dtype``, but :attr:`input` must have floating + point ``dtype``. + + Args: + input (Tensor): the input tensor of probability values for the Bernoulli distribution + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.empty(3, 3).uniform_(0, 1) # generate a uniform random matrix with range [0, 1] + >>> a + tensor([[ 0.1737, 0.0950, 0.3609], + [ 0.7148, 0.0289, 0.2676], + [ 0.9456, 0.8937, 0.7202]]) + >>> torch.bernoulli(a) + tensor([[ 1., 0., 0.], + [ 0., 0., 0.], + [ 1., 1., 1.]]) + + >>> a = torch.ones(3, 3) # probability of drawing "1" is 1 + >>> torch.bernoulli(a) + tensor([[ 1., 1., 1.], + [ 1., 1., 1.], + [ 1., 1., 1.]]) + >>> a = torch.zeros(3, 3) # probability of drawing "1" is 0 + >>> torch.bernoulli(a) + tensor([[ 0., 0., 0.], + [ 0., 0., 0.], + [ 0., 0., 0.]]) + """ + +@overload +def bernoulli( + input: Tensor, + p: _float, + *, + generator: Generator | None = None, +) -> Tensor: + r""" + bernoulli(input: Tensor, *, generator: Optional[Generator], out: Optional[Tensor]) -> Tensor + + Draws binary random numbers (0 or 1) from a Bernoulli distribution. + + The :attr:`input` tensor should be a tensor containing probabilities + to be used for drawing the binary random number. + Hence, all values in :attr:`input` have to be in the range: + :math:`0 \leq \text{input}_i \leq 1`. + + The :math:`\text{i}^{th}` element of the output tensor will draw a + value :math:`1` according to the :math:`\text{i}^{th}` probability value given + in :attr:`input`. + + .. math:: + \text{out}_{i} \sim \mathrm{Bernoulli}(p = \text{input}_{i}) + + The returned :attr:`out` tensor only has values 0 or 1 and is of the same + shape as :attr:`input`. + + :attr:`out` can have integral ``dtype``, but :attr:`input` must have floating + point ``dtype``. + + Args: + input (Tensor): the input tensor of probability values for the Bernoulli distribution + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.empty(3, 3).uniform_(0, 1) # generate a uniform random matrix with range [0, 1] + >>> a + tensor([[ 0.1737, 0.0950, 0.3609], + [ 0.7148, 0.0289, 0.2676], + [ 0.9456, 0.8937, 0.7202]]) + >>> torch.bernoulli(a) + tensor([[ 1., 0., 0.], + [ 0., 0., 0.], + [ 1., 1., 1.]]) + + >>> a = torch.ones(3, 3) # probability of drawing "1" is 1 + >>> torch.bernoulli(a) + tensor([[ 1., 1., 1.], + [ 1., 1., 1.], + [ 1., 1., 1.]]) + >>> a = torch.zeros(3, 3) # probability of drawing "1" is 0 + >>> torch.bernoulli(a) + tensor([[ 0., 0., 0.], + [ 0., 0., 0.], + [ 0., 0., 0.]]) + """ + +def bilinear( + input1: Tensor, + input2: Tensor, + weight: Tensor, + bias: Tensor | None = None, +) -> Tensor: ... +def binary_cross_entropy_with_logits( + input: Tensor, + target: Tensor, + weight: Tensor | None = None, + pos_weight: Tensor | None = None, + reduction: _int = 1, +) -> Tensor: ... +def bincount( + input: Tensor, + weights: Tensor | None = None, + minlength: _int | SymInt = 0, +) -> Tensor: + r""" + bincount(input, weights=None, minlength=0) -> Tensor + + Count the frequency of each value in an array of non-negative ints. + + The number of bins (size 1) is one larger than the largest value in + :attr:`input` unless :attr:`input` is empty, in which case the result is a + tensor of size 0. If :attr:`minlength` is specified, the number of bins is at least + :attr:`minlength` and if :attr:`input` is empty, then the result is tensor of size + :attr:`minlength` filled with zeros. If ``n`` is the value at position ``i``, + ``out[n] += weights[i]`` if :attr:`weights` is specified else + ``out[n] += 1``. + + Note: + This operation may produce nondeterministic gradients when given tensors on a CUDA device. See :doc:`/notes/randomness` for more information. + + Arguments: + input (Tensor): 1-d int tensor + weights (Tensor): optional, weight for each value in the input tensor. + Should be of same size as input tensor. + minlength (int): optional, minimum number of bins. Should be non-negative. + + Returns: + output (Tensor): a tensor of shape ``Size([max(input) + 1])`` if + :attr:`input` is non-empty, else ``Size(0)`` + + Example:: + + >>> input = torch.randint(0, 8, (5,), dtype=torch.int64) + >>> weights = torch.linspace(0, 1, steps=5) + >>> input, weights + (tensor([4, 3, 6, 3, 4]), + tensor([ 0.0000, 0.2500, 0.5000, 0.7500, 1.0000]) + + >>> torch.bincount(input) + tensor([0, 0, 0, 2, 2, 0, 1]) + + >>> input.bincount(weights) + tensor([0.0000, 0.0000, 0.0000, 1.0000, 1.0000, 0.0000, 0.5000]) + """ + +def binomial( + count: Tensor, + prob: Tensor, + generator: Generator | None = None, +) -> Tensor: ... +@overload +def bitwise_and( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + bitwise_and(input, other, *, out=None) -> Tensor + + Computes the bitwise AND of :attr:`input` and :attr:`other`. The input tensor must be of + integral or Boolean types. For bool tensors, it computes the logical AND. + + Args: + input: the first input tensor + other: the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_and(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([1, 0, 3], dtype=torch.int8) + >>> torch.bitwise_and(torch.tensor([True, True, False]), torch.tensor([False, True, False])) + tensor([ False, True, False]) + """ + +@overload +def bitwise_and(self: Number | _complex, other: Tensor) -> Tensor: + r""" + bitwise_and(input, other, *, out=None) -> Tensor + + Computes the bitwise AND of :attr:`input` and :attr:`other`. The input tensor must be of + integral or Boolean types. For bool tensors, it computes the logical AND. + + Args: + input: the first input tensor + other: the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_and(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([1, 0, 3], dtype=torch.int8) + >>> torch.bitwise_and(torch.tensor([True, True, False]), torch.tensor([False, True, False])) + tensor([ False, True, False]) + """ + +@overload +def bitwise_and( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + bitwise_and(input, other, *, out=None) -> Tensor + + Computes the bitwise AND of :attr:`input` and :attr:`other`. The input tensor must be of + integral or Boolean types. For bool tensors, it computes the logical AND. + + Args: + input: the first input tensor + other: the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_and(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([1, 0, 3], dtype=torch.int8) + >>> torch.bitwise_and(torch.tensor([True, True, False]), torch.tensor([False, True, False])) + tensor([ False, True, False]) + """ + +@overload +def bitwise_left_shift( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + bitwise_left_shift(input, other, *, out=None) -> Tensor + + Computes the left arithmetic shift of :attr:`input` by :attr:`other` bits. + The input tensor must be of integral type. This operator supports + :ref:`broadcasting to a common shape ` and + :ref:`type promotion `. + + The operation applied is: + + .. math:: + \text{out}_i = \text{input}_i << \text{other}_i + + Args: + input (Tensor or Scalar): the first input tensor + other (Tensor or Scalar): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_left_shift(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-2, -2, 24], dtype=torch.int8) + """ + +@overload +def bitwise_left_shift(self: Number | _complex, other: Tensor) -> Tensor: + r""" + bitwise_left_shift(input, other, *, out=None) -> Tensor + + Computes the left arithmetic shift of :attr:`input` by :attr:`other` bits. + The input tensor must be of integral type. This operator supports + :ref:`broadcasting to a common shape ` and + :ref:`type promotion `. + + The operation applied is: + + .. math:: + \text{out}_i = \text{input}_i << \text{other}_i + + Args: + input (Tensor or Scalar): the first input tensor + other (Tensor or Scalar): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_left_shift(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-2, -2, 24], dtype=torch.int8) + """ + +@overload +def bitwise_left_shift( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + bitwise_left_shift(input, other, *, out=None) -> Tensor + + Computes the left arithmetic shift of :attr:`input` by :attr:`other` bits. + The input tensor must be of integral type. This operator supports + :ref:`broadcasting to a common shape ` and + :ref:`type promotion `. + + The operation applied is: + + .. math:: + \text{out}_i = \text{input}_i << \text{other}_i + + Args: + input (Tensor or Scalar): the first input tensor + other (Tensor or Scalar): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_left_shift(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-2, -2, 24], dtype=torch.int8) + """ + +def bitwise_not(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + bitwise_not(input, *, out=None) -> Tensor + + Computes the bitwise NOT of the given input tensor. The input tensor must be of + integral or Boolean types. For bool tensors, it computes the logical NOT. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_not(torch.tensor([-1, -2, 3], dtype=torch.int8)) + tensor([ 0, 1, -4], dtype=torch.int8) + """ + +@overload +def bitwise_or( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + bitwise_or(input: Tensor, other: Tensor, *, out: Optional[Tensor]) -> Tensor + + Computes the bitwise OR of :attr:`input` and :attr:`other`. The input tensor must be of + integral or Boolean types. For bool tensors, it computes the logical OR. + + Args: + input: the first input tensor + other: the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_or(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-1, -2, 3], dtype=torch.int8) + >>> torch.bitwise_or(torch.tensor([True, True, False]), torch.tensor([False, True, False])) + tensor([ True, True, False]) + """ + +@overload +def bitwise_or(self: Number | _complex, other: Tensor) -> Tensor: + r""" + bitwise_or(input: Tensor, other: Tensor, *, out: Optional[Tensor]) -> Tensor + + Computes the bitwise OR of :attr:`input` and :attr:`other`. The input tensor must be of + integral or Boolean types. For bool tensors, it computes the logical OR. + + Args: + input: the first input tensor + other: the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_or(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-1, -2, 3], dtype=torch.int8) + >>> torch.bitwise_or(torch.tensor([True, True, False]), torch.tensor([False, True, False])) + tensor([ True, True, False]) + """ + +@overload +def bitwise_or( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + bitwise_or(input: Tensor, other: Tensor, *, out: Optional[Tensor]) -> Tensor + + Computes the bitwise OR of :attr:`input` and :attr:`other`. The input tensor must be of + integral or Boolean types. For bool tensors, it computes the logical OR. + + Args: + input: the first input tensor + other: the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_or(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-1, -2, 3], dtype=torch.int8) + >>> torch.bitwise_or(torch.tensor([True, True, False]), torch.tensor([False, True, False])) + tensor([ True, True, False]) + """ + +@overload +def bitwise_right_shift( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + bitwise_right_shift(input, other, *, out=None) -> Tensor + + Computes the right arithmetic shift of :attr:`input` by :attr:`other` bits. + The input tensor must be of integral type. This operator supports + :ref:`broadcasting to a common shape ` and + :ref:`type promotion `. + In any case, if the value of the right operand is negative or is greater + or equal to the number of bits in the promoted left operand, the behavior is undefined. + + The operation applied is: + + .. math:: + \text{out}_i = \text{input}_i >> \text{other}_i + + Args: + input (Tensor or Scalar): the first input tensor + other (Tensor or Scalar): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_right_shift(torch.tensor([-2, -7, 31], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-1, -7, 3], dtype=torch.int8) + """ + +@overload +def bitwise_right_shift(self: Number | _complex, other: Tensor) -> Tensor: + r""" + bitwise_right_shift(input, other, *, out=None) -> Tensor + + Computes the right arithmetic shift of :attr:`input` by :attr:`other` bits. + The input tensor must be of integral type. This operator supports + :ref:`broadcasting to a common shape ` and + :ref:`type promotion `. + In any case, if the value of the right operand is negative or is greater + or equal to the number of bits in the promoted left operand, the behavior is undefined. + + The operation applied is: + + .. math:: + \text{out}_i = \text{input}_i >> \text{other}_i + + Args: + input (Tensor or Scalar): the first input tensor + other (Tensor or Scalar): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_right_shift(torch.tensor([-2, -7, 31], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-1, -7, 3], dtype=torch.int8) + """ + +@overload +def bitwise_right_shift( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + bitwise_right_shift(input, other, *, out=None) -> Tensor + + Computes the right arithmetic shift of :attr:`input` by :attr:`other` bits. + The input tensor must be of integral type. This operator supports + :ref:`broadcasting to a common shape ` and + :ref:`type promotion `. + In any case, if the value of the right operand is negative or is greater + or equal to the number of bits in the promoted left operand, the behavior is undefined. + + The operation applied is: + + .. math:: + \text{out}_i = \text{input}_i >> \text{other}_i + + Args: + input (Tensor or Scalar): the first input tensor + other (Tensor or Scalar): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_right_shift(torch.tensor([-2, -7, 31], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-1, -7, 3], dtype=torch.int8) + """ + +@overload +def bitwise_xor( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + bitwise_xor(input, other, *, out=None) -> Tensor + + Computes the bitwise XOR of :attr:`input` and :attr:`other`. The input tensor must be of + integral or Boolean types. For bool tensors, it computes the logical XOR. + + Args: + input: the first input tensor + other: the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_xor(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-2, -2, 0], dtype=torch.int8) + >>> torch.bitwise_xor(torch.tensor([True, True, False]), torch.tensor([False, True, False])) + tensor([ True, False, False]) + """ + +@overload +def bitwise_xor(self: Number | _complex, other: Tensor) -> Tensor: + r""" + bitwise_xor(input, other, *, out=None) -> Tensor + + Computes the bitwise XOR of :attr:`input` and :attr:`other`. The input tensor must be of + integral or Boolean types. For bool tensors, it computes the logical XOR. + + Args: + input: the first input tensor + other: the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_xor(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-2, -2, 0], dtype=torch.int8) + >>> torch.bitwise_xor(torch.tensor([True, True, False]), torch.tensor([False, True, False])) + tensor([ True, False, False]) + """ + +@overload +def bitwise_xor( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + bitwise_xor(input, other, *, out=None) -> Tensor + + Computes the bitwise XOR of :attr:`input` and :attr:`other`. The input tensor must be of + integral or Boolean types. For bool tensors, it computes the logical XOR. + + Args: + input: the first input tensor + other: the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.bitwise_xor(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-2, -2, 0], dtype=torch.int8) + >>> torch.bitwise_xor(torch.tensor([True, True, False]), torch.tensor([False, True, False])) + tensor([ True, False, False]) + """ + +@overload +def blackman_window( + window_length: _int, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + blackman_window(window_length, periodic=True, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Blackman window function. + + .. math:: + w[n] = 0.42 - 0.5 \cos \left( \frac{2 \pi n}{N - 1} \right) + 0.08 \cos \left( \frac{4 \pi n}{N - 1} \right) + + where :math:`N` is the full window size. + + The input :attr:`window_length` is a positive integer controlling the + returned window size. :attr:`periodic` flag determines whether the returned + window trims off the last duplicate value from the symmetric window and is + ready to be used as a periodic window with functions like + :meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in + above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have + ``torch.blackman_window(L, periodic=True)`` equal to + ``torch.blackman_window(L + 1, periodic=False)[:-1]``. + + .. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. + + Arguments: + window_length (int): the size of returned window + periodic (bool, optional): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window + """ + +@overload +def blackman_window( + window_length: _int, + periodic: _bool, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + blackman_window(window_length, periodic=True, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Blackman window function. + + .. math:: + w[n] = 0.42 - 0.5 \cos \left( \frac{2 \pi n}{N - 1} \right) + 0.08 \cos \left( \frac{4 \pi n}{N - 1} \right) + + where :math:`N` is the full window size. + + The input :attr:`window_length` is a positive integer controlling the + returned window size. :attr:`periodic` flag determines whether the returned + window trims off the last duplicate value from the symmetric window and is + ready to be used as a periodic window with functions like + :meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in + above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have + ``torch.blackman_window(L, periodic=True)`` equal to + ``torch.blackman_window(L + 1, periodic=False)[:-1]``. + + .. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. + + Arguments: + window_length (int): the size of returned window + periodic (bool, optional): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window + """ + +@overload +def bmm( + input: Tensor, + mat2: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + bmm(input, mat2, out_dtype=None, *, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices stored in :attr:`input` + and :attr:`mat2`. + + :attr:`input` and :attr:`mat2` must be 3-D tensors each containing + the same number of matrices. + + If :attr:`input` is a :math:`(b \times n \times m)` tensor, :attr:`mat2` is a + :math:`(b \times m \times p)` tensor, :attr:`out` will be a + :math:`(b \times n \times p)` tensor. + + .. math:: + \text{out}_i = \text{input}_i \mathbin{@} \text{mat2}_i + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + .. note:: This function does not :ref:`broadcast `. + For broadcasting matrix products, see :func:`torch.matmul`. + + Args: + input (Tensor): the first batch of matrices to be multiplied + mat2 (Tensor): the second batch of matrices to be multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword Args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> input = torch.randn(10, 3, 4) + >>> mat2 = torch.randn(10, 4, 5) + >>> res = torch.bmm(input, mat2) + >>> res.size() + torch.Size([10, 3, 5]) + """ + +@overload +def bmm( + input: Tensor, + mat2: Tensor, + out_dtype: _dtype, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + bmm(input, mat2, out_dtype=None, *, out=None) -> Tensor + + Performs a batch matrix-matrix product of matrices stored in :attr:`input` + and :attr:`mat2`. + + :attr:`input` and :attr:`mat2` must be 3-D tensors each containing + the same number of matrices. + + If :attr:`input` is a :math:`(b \times n \times m)` tensor, :attr:`mat2` is a + :math:`(b \times m \times p)` tensor, :attr:`out` will be a + :math:`(b \times n \times p)` tensor. + + .. math:: + \text{out}_i = \text{input}_i \mathbin{@} \text{mat2}_i + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + .. note:: This function does not :ref:`broadcast `. + For broadcasting matrix products, see :func:`torch.matmul`. + + Args: + input (Tensor): the first batch of matrices to be multiplied + mat2 (Tensor): the second batch of matrices to be multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword Args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> input = torch.randn(10, 3, 4) + >>> mat2 = torch.randn(10, 4, 5) + >>> res = torch.bmm(input, mat2) + >>> res.size() + torch.Size([10, 3, 5]) + """ + +def broadcast_to(input: Tensor, size: Sequence[_int | SymInt]) -> Tensor: + r""" + broadcast_to(input, shape) -> Tensor + + Broadcasts :attr:`input` to the shape :attr:`\shape`. + Equivalent to calling ``input.expand(shape)``. See :meth:`~Tensor.expand` for details. + + Args: + input (Tensor): the input tensor. + shape (list, tuple, or :class:`torch.Size`): the new shape. + + Example:: + + >>> x = torch.tensor([1, 2, 3]) + >>> torch.broadcast_to(x, (3, 3)) + tensor([[1, 2, 3], + [1, 2, 3], + [1, 2, 3]]) + """ + +@overload +def bucketize( + input: Tensor, + boundaries: Tensor, + *, + out_int32: _bool = False, + right: _bool = False, + out: Tensor | None = None, +) -> Tensor: + r""" + bucketize(input, boundaries, *, out_int32=False, right=False, out=None) -> Tensor + + Returns the indices of the buckets to which each value in the :attr:`input` belongs, where the + boundaries of the buckets are set by :attr:`boundaries`. Return a new tensor with the same size + as :attr:`input`. If :attr:`right` is False (default), then the left boundary is open. Note that + this behavior is opposite the behavior of + `numpy.digitize `_. + More formally, the returned index satisfies the following rules: + + .. list-table:: + :widths: 15 85 + :header-rows: 1 + + * - :attr:`right` + - *returned index satisfies* + * - False + - ``boundaries[i-1] < input[m][n]...[l][x] <= boundaries[i]`` + * - True + - ``boundaries[i-1] <= input[m][n]...[l][x] < boundaries[i]`` + + Args: + input (Tensor or Scalar): N-D tensor or a Scalar containing the search value(s). + boundaries (Tensor): 1-D tensor, must contain a strictly increasing sequence, or the return value is undefined. + + Keyword args: + out_int32 (bool, optional): indicate the output data type. torch.int32 if True, torch.int64 otherwise. + Default value is False, i.e. default output data type is torch.int64. + right (bool, optional): determines the behavior for values in :attr:`boundaries`. See the table above. + out (Tensor, optional): the output tensor, must be the same size as :attr:`input` if provided. + + + Example:: + + >>> boundaries = torch.tensor([1, 3, 5, 7, 9]) + >>> boundaries + tensor([1, 3, 5, 7, 9]) + >>> v = torch.tensor([[3, 6, 9], [3, 6, 9]]) + >>> v + tensor([[3, 6, 9], + [3, 6, 9]]) + >>> torch.bucketize(v, boundaries) + tensor([[1, 3, 4], + [1, 3, 4]]) + >>> torch.bucketize(v, boundaries, right=True) + tensor([[2, 3, 5], + [2, 3, 5]]) + """ + +@overload +def bucketize( + self: Number | _complex, + boundaries: Tensor, + *, + out_int32: _bool = False, + right: _bool = False, +) -> Tensor: + r""" + bucketize(input, boundaries, *, out_int32=False, right=False, out=None) -> Tensor + + Returns the indices of the buckets to which each value in the :attr:`input` belongs, where the + boundaries of the buckets are set by :attr:`boundaries`. Return a new tensor with the same size + as :attr:`input`. If :attr:`right` is False (default), then the left boundary is open. Note that + this behavior is opposite the behavior of + `numpy.digitize `_. + More formally, the returned index satisfies the following rules: + + .. list-table:: + :widths: 15 85 + :header-rows: 1 + + * - :attr:`right` + - *returned index satisfies* + * - False + - ``boundaries[i-1] < input[m][n]...[l][x] <= boundaries[i]`` + * - True + - ``boundaries[i-1] <= input[m][n]...[l][x] < boundaries[i]`` + + Args: + input (Tensor or Scalar): N-D tensor or a Scalar containing the search value(s). + boundaries (Tensor): 1-D tensor, must contain a strictly increasing sequence, or the return value is undefined. + + Keyword args: + out_int32 (bool, optional): indicate the output data type. torch.int32 if True, torch.int64 otherwise. + Default value is False, i.e. default output data type is torch.int64. + right (bool, optional): determines the behavior for values in :attr:`boundaries`. See the table above. + out (Tensor, optional): the output tensor, must be the same size as :attr:`input` if provided. + + + Example:: + + >>> boundaries = torch.tensor([1, 3, 5, 7, 9]) + >>> boundaries + tensor([1, 3, 5, 7, 9]) + >>> v = torch.tensor([[3, 6, 9], [3, 6, 9]]) + >>> v + tensor([[3, 6, 9], + [3, 6, 9]]) + >>> torch.bucketize(v, boundaries) + tensor([[1, 3, 4], + [1, 3, 4]]) + >>> torch.bucketize(v, boundaries, right=True) + tensor([[2, 3, 5], + [2, 3, 5]]) + """ + +def can_cast(from_: _dtype, to: _dtype) -> _bool: + r""" + can_cast(from_, to) -> bool + + Determines if a type conversion is allowed under PyTorch casting rules + described in the type promotion :ref:`documentation `. + + Args: + from\_ (dtype): The original :class:`torch.dtype`. + to (dtype): The target :class:`torch.dtype`. + + Example:: + + >>> torch.can_cast(torch.double, torch.float) + True + >>> torch.can_cast(torch.float, torch.int) + False + """ + +@overload +def cat( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + dim: _int = 0, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + cat(tensors, dim=0, *, out=None) -> Tensor + + Concatenates the given sequence of tensors in :attr:`tensors` in the given dimension. + All tensors must either have the same shape (except in the concatenating + dimension) or be a 1-D empty tensor with size ``(0,)``. + + :func:`torch.cat` can be seen as an inverse operation for :func:`torch.split` + and :func:`torch.chunk`. + + :func:`torch.cat` can be best understood via examples. + + .. seealso:: + + :func:`torch.stack` concatenates the given sequence along a new dimension. + + Args: + tensors (sequence of Tensors): Non-empty tensors provided must have the same shape, + except in the cat dimension. + + dim (int, optional): the dimension over which the tensors are concatenated + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> x = torch.randn(2, 3) + >>> x + tensor([[ 0.6580, -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497]]) + >>> torch.cat((x, x, x), 0) + tensor([[ 0.6580, -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497], + [ 0.6580, -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497], + [ 0.6580, -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497]]) + >>> torch.cat((x, x, x), 1) + tensor([[ 0.6580, -1.0969, -0.4614, 0.6580, -1.0969, -0.4614, 0.6580, + -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497, -0.1034, -0.5790, 0.1497, -0.1034, + -0.5790, 0.1497]]) + """ + +@overload +def cat( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + dim: str | EllipsisType | None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + cat(tensors, dim=0, *, out=None) -> Tensor + + Concatenates the given sequence of tensors in :attr:`tensors` in the given dimension. + All tensors must either have the same shape (except in the concatenating + dimension) or be a 1-D empty tensor with size ``(0,)``. + + :func:`torch.cat` can be seen as an inverse operation for :func:`torch.split` + and :func:`torch.chunk`. + + :func:`torch.cat` can be best understood via examples. + + .. seealso:: + + :func:`torch.stack` concatenates the given sequence along a new dimension. + + Args: + tensors (sequence of Tensors): Non-empty tensors provided must have the same shape, + except in the cat dimension. + + dim (int, optional): the dimension over which the tensors are concatenated + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> x = torch.randn(2, 3) + >>> x + tensor([[ 0.6580, -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497]]) + >>> torch.cat((x, x, x), 0) + tensor([[ 0.6580, -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497], + [ 0.6580, -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497], + [ 0.6580, -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497]]) + >>> torch.cat((x, x, x), 1) + tensor([[ 0.6580, -1.0969, -0.4614, 0.6580, -1.0969, -0.4614, 0.6580, + -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497, -0.1034, -0.5790, 0.1497, -0.1034, + -0.5790, 0.1497]]) + """ + +def ccol_indices_copy( + input: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: ... +def ceil(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + ceil(input, *, out=None) -> Tensor + + Returns a new tensor with the ceil of the elements of :attr:`input`, + the smallest integer greater than or equal to each element. + + For integer inputs, follows the array-api convention of returning a + copy of the input tensor. + + .. math:: + \text{out}_{i} = \left\lceil \text{input}_{i} \right\rceil + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-0.6341, -1.4208, -1.0900, 0.5826]) + >>> torch.ceil(a) + tensor([-0., -1., -1., 1.]) + """ + +def ceil_(input: Tensor) -> Tensor: ... +def celu(input: Tensor, alpha: Number | _complex = 1.0) -> Tensor: ... +def celu_(input: Tensor, alpha: Number | _complex = 1.0) -> Tensor: ... +def channel_shuffle(input: Tensor, groups: _int | SymInt) -> Tensor: ... +def cholesky( + input: Tensor, + upper: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + cholesky(input, upper=False, *, out=None) -> Tensor + + Computes the Cholesky decomposition of a symmetric positive-definite + matrix :math:`A` or for batches of symmetric positive-definite matrices. + + If :attr:`upper` is ``True``, the returned matrix ``U`` is upper-triangular, and + the decomposition has the form: + + .. math:: + + A = U^TU + + If :attr:`upper` is ``False``, the returned matrix ``L`` is lower-triangular, and + the decomposition has the form: + + .. math:: + + A = LL^T + + If :attr:`upper` is ``True``, and :math:`A` is a batch of symmetric positive-definite + matrices, then the returned tensor will be composed of upper-triangular Cholesky factors + of each of the individual matrices. Similarly, when :attr:`upper` is ``False``, the returned + tensor will be composed of lower-triangular Cholesky factors of each of the individual + matrices. + + .. warning:: + + :func:`torch.cholesky` is deprecated in favor of :func:`torch.linalg.cholesky` + and will be removed in a future PyTorch release. + + ``L = torch.cholesky(A)`` should be replaced with + + .. code:: python + + L = torch.linalg.cholesky(A) + + ``U = torch.cholesky(A, upper=True)`` should be replaced with + + .. code:: python + + U = torch.linalg.cholesky(A).mH + + This transform will produce equivalent results for all valid (symmetric positive definite) inputs. + + Args: + input (Tensor): the input tensor :math:`A` of size :math:`(*, n, n)` where `*` is zero or more + batch dimensions consisting of symmetric positive-definite matrices. + upper (bool, optional): flag that indicates whether to return a + upper or lower triangular matrix. Default: ``False`` + + Keyword args: + out (Tensor, optional): the output matrix + + Example:: + + >>> a = torch.randn(3, 3) + >>> a = a @ a.mT + 1e-3 # make symmetric positive-definite + >>> l = torch.cholesky(a) + >>> a + tensor([[ 2.4112, -0.7486, 1.4551], + [-0.7486, 1.3544, 0.1294], + [ 1.4551, 0.1294, 1.6724]]) + >>> l + tensor([[ 1.5528, 0.0000, 0.0000], + [-0.4821, 1.0592, 0.0000], + [ 0.9371, 0.5487, 0.7023]]) + >>> l @ l.mT + tensor([[ 2.4112, -0.7486, 1.4551], + [-0.7486, 1.3544, 0.1294], + [ 1.4551, 0.1294, 1.6724]]) + >>> a = torch.randn(3, 2, 2) # Example for batched input + >>> a = a @ a.mT + 1e-03 # make symmetric positive-definite + >>> l = torch.cholesky(a) + >>> z = l @ l.mT + >>> torch.dist(z, a) + tensor(2.3842e-07) + """ + +def cholesky_inverse( + input: Tensor, + upper: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + cholesky_inverse(L, upper=False, *, out=None) -> Tensor + + Computes the inverse of a complex Hermitian or real symmetric + positive-definite matrix given its Cholesky decomposition. + + Let :math:`A` be a complex Hermitian or real symmetric positive-definite matrix, + and :math:`L` its Cholesky decomposition such that: + + .. math:: + + A = LL^{\text{H}} + + where :math:`L^{\text{H}}` is the conjugate transpose when :math:`L` is complex, + and the transpose when :math:`L` is real-valued. + + Computes the inverse matrix :math:`A^{-1}`. + + Supports input of float, double, cfloat and cdouble dtypes. + Also supports batches of matrices, and if :math:`A` is a batch of matrices + then the output has the same batch dimensions. + + Args: + L (Tensor): tensor of shape `(*, n, n)` where `*` is zero or more batch dimensions + consisting of lower or upper triangular Cholesky decompositions of + symmetric or Hermitian positive-definite matrices. + upper (bool, optional): flag that indicates whether :math:`L` is lower triangular + or upper triangular. Default: ``False`` + + Keyword args: + out (Tensor, optional): output tensor. Ignored if `None`. Default: `None`. + + Example:: + + >>> A = torch.randn(3, 3) + >>> A = A @ A.T + torch.eye(3) * 1e-3 # Creates a symmetric positive-definite matrix + >>> L = torch.linalg.cholesky(A) # Extract Cholesky decomposition + >>> torch.cholesky_inverse(L) + tensor([[ 1.9314, 1.2251, -0.0889], + [ 1.2251, 2.4439, 0.2122], + [-0.0889, 0.2122, 0.1412]]) + >>> A.inverse() + tensor([[ 1.9314, 1.2251, -0.0889], + [ 1.2251, 2.4439, 0.2122], + [-0.0889, 0.2122, 0.1412]]) + + >>> A = torch.randn(3, 2, 2, dtype=torch.complex64) + >>> A = A @ A.mH + torch.eye(2) * 1e-3 # Batch of Hermitian positive-definite matrices + >>> L = torch.linalg.cholesky(A) + >>> torch.dist(torch.inverse(A), torch.cholesky_inverse(L)) + tensor(5.6358e-7) + """ + +def cholesky_solve( + input: Tensor, + input2: Tensor, + upper: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + cholesky_solve(B, L, upper=False, *, out=None) -> Tensor + + Computes the solution of a system of linear equations with complex Hermitian + or real symmetric positive-definite lhs given its Cholesky decomposition. + + Let :math:`A` be a complex Hermitian or real symmetric positive-definite matrix, + and :math:`L` its Cholesky decomposition such that: + + .. math:: + + A = LL^{\text{H}} + + where :math:`L^{\text{H}}` is the conjugate transpose when :math:`L` is complex, + and the transpose when :math:`L` is real-valued. + + Returns the solution :math:`X` of the following linear system: + + .. math:: + + AX = B + + Supports inputs of float, double, cfloat and cdouble dtypes. + Also supports batches of matrices, and if :math:`A` or :math:`B` is a batch of matrices + then the output has the same batch dimensions. + + Args: + B (Tensor): right-hand side tensor of shape `(*, n, k)` + where :math:`*` is zero or more batch dimensions + L (Tensor): tensor of shape `(*, n, n)` where `*` is zero or more batch dimensions + consisting of lower or upper triangular Cholesky decompositions of + symmetric or Hermitian positive-definite matrices. + upper (bool, optional): flag that indicates whether :math:`L` is lower triangular + or upper triangular. Default: ``False``. + + Keyword args: + out (Tensor, optional): output tensor. Ignored if `None`. Default: `None`. + + Example:: + + >>> A = torch.randn(3, 3) + >>> A = A @ A.T + torch.eye(3) * 1e-3 # Creates a symmetric positive-definite matrix + >>> L = torch.linalg.cholesky(A) # Extract Cholesky decomposition + >>> B = torch.randn(3, 2) + >>> torch.cholesky_solve(B, L) + tensor([[ -8.1625, 19.6097], + [ -5.8398, 14.2387], + [ -4.3771, 10.4173]]) + >>> A.inverse() @ B + tensor([[ -8.1626, 19.6097], + [ -5.8398, 14.2387], + [ -4.3771, 10.4173]]) + + >>> A = torch.randn(3, 2, 2, dtype=torch.complex64) + >>> A = A @ A.mH + torch.eye(2) * 1e-3 # Batch of Hermitian positive-definite matrices + >>> L = torch.linalg.cholesky(A) + >>> B = torch.randn(2, 1, dtype=torch.complex64) + >>> X = torch.cholesky_solve(B, L) + >>> torch.dist(X, A.inverse() @ B) + tensor(1.6881e-5) + """ + +def choose_qparams_optimized( + input: Tensor, + numel: _int, + n_bins: _int, + ratio: _float, + bit_width: _int, +) -> tuple[Tensor, Tensor]: ... +def chunk(input: Tensor, chunks: _int, dim: _int = 0) -> tuple[Tensor, ...]: + r""" + chunk(input: Tensor, chunks: int, dim: int = 0) -> Tuple[Tensor, ...] + + Attempts to split a tensor into the specified number of chunks. Each chunk is a view of + the input tensor. + + + .. note:: + + This function may return fewer than the specified number of chunks! + + .. seealso:: + + :func:`torch.tensor_split` a function that always returns exactly the specified number of chunks + + If the tensor size along the given dimension :attr:`dim` is divisible by :attr:`chunks`, + all returned chunks will be the same size. + If the tensor size along the given dimension :attr:`dim` is not divisible by :attr:`chunks`, + all returned chunks will be the same size, except the last one. + If such division is not possible, this function may return fewer + than the specified number of chunks. + + Arguments: + input (Tensor): the tensor to split + chunks (int): number of chunks to return + dim (int): dimension along which to split the tensor + + Example: + >>> torch.arange(11).chunk(6) + (tensor([0, 1]), + tensor([2, 3]), + tensor([4, 5]), + tensor([6, 7]), + tensor([8, 9]), + tensor([10])) + >>> torch.arange(12).chunk(6) + (tensor([0, 1]), + tensor([2, 3]), + tensor([4, 5]), + tensor([6, 7]), + tensor([8, 9]), + tensor([10, 11])) + >>> torch.arange(13).chunk(6) + (tensor([0, 1, 2]), + tensor([3, 4, 5]), + tensor([6, 7, 8]), + tensor([ 9, 10, 11]), + tensor([12])) + """ + +@overload +def clamp( + input: Tensor, + min: Tensor | None = None, + max: Tensor | None = None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + clamp(input, min=None, max=None, *, out=None) -> Tensor + + Clamps all elements in :attr:`input` into the range `[` :attr:`min`, :attr:`max` `]`. + Letting min_value and max_value be :attr:`min` and :attr:`max`, respectively, this returns: + + .. math:: + y_i = \min(\max(x_i, \text{min\_value}_i), \text{max\_value}_i) + + If :attr:`min` is ``None``, there is no lower bound. + Or, if :attr:`max` is ``None`` there is no upper bound. + + + .. note:: + If :attr:`min` is greater than :attr:`max` :func:`torch.clamp(..., min, max) ` + sets all elements in :attr:`input` to the value of :attr:`max`. + + Args: + input (Tensor): the input tensor. + min (Number or Tensor, optional): lower-bound of the range to be clamped to + max (Number or Tensor, optional): upper-bound of the range to be clamped to + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-1.7120, 0.1734, -0.0478, -0.0922]) + >>> torch.clamp(a, min=-0.5, max=0.5) + tensor([-0.5000, 0.1734, -0.0478, -0.0922]) + + >>> min = torch.linspace(-1, 1, steps=4) + >>> torch.clamp(a, min=min) + tensor([-1.0000, 0.1734, 0.3333, 1.0000]) + """ + +@overload +def clamp( + input: Tensor, + min: Number | _complex | None = None, + max: Number | _complex | None = None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + clamp(input, min=None, max=None, *, out=None) -> Tensor + + Clamps all elements in :attr:`input` into the range `[` :attr:`min`, :attr:`max` `]`. + Letting min_value and max_value be :attr:`min` and :attr:`max`, respectively, this returns: + + .. math:: + y_i = \min(\max(x_i, \text{min\_value}_i), \text{max\_value}_i) + + If :attr:`min` is ``None``, there is no lower bound. + Or, if :attr:`max` is ``None`` there is no upper bound. + + + .. note:: + If :attr:`min` is greater than :attr:`max` :func:`torch.clamp(..., min, max) ` + sets all elements in :attr:`input` to the value of :attr:`max`. + + Args: + input (Tensor): the input tensor. + min (Number or Tensor, optional): lower-bound of the range to be clamped to + max (Number or Tensor, optional): upper-bound of the range to be clamped to + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-1.7120, 0.1734, -0.0478, -0.0922]) + >>> torch.clamp(a, min=-0.5, max=0.5) + tensor([-0.5000, 0.1734, -0.0478, -0.0922]) + + >>> min = torch.linspace(-1, 1, steps=4) + >>> torch.clamp(a, min=min) + tensor([-1.0000, 0.1734, 0.3333, 1.0000]) + """ + +@overload +def clamp_( + input: Tensor, + min: Tensor | None = None, + max: Tensor | None = None, +) -> Tensor: ... +@overload +def clamp_( + input: Tensor, + min: Number | _complex | None = None, + max: Number | _complex | None = None, +) -> Tensor: ... +@overload +def clamp_max( + input: Tensor, + max: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: ... +@overload +def clamp_max( + input: Tensor, + max: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: ... +@overload +def clamp_max_(input: Tensor, max: Tensor) -> Tensor: ... +@overload +def clamp_max_(input: Tensor, max: Number | _complex) -> Tensor: ... +@overload +def clamp_min( + input: Tensor, + min: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: ... +@overload +def clamp_min( + input: Tensor, + min: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: ... +@overload +def clamp_min_(input: Tensor, min: Tensor) -> Tensor: ... +@overload +def clamp_min_(input: Tensor, min: Number | _complex) -> Tensor: ... +@overload +def clip( + input: Tensor, + min: Tensor | None = None, + max: Tensor | None = None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + clip(input, min=None, max=None, *, out=None) -> Tensor + + Alias for :func:`torch.clamp`. + """ + +@overload +def clip( + input: Tensor, + min: Number | _complex | None = None, + max: Number | _complex | None = None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + clip(input, min=None, max=None, *, out=None) -> Tensor + + Alias for :func:`torch.clamp`. + """ + +@overload +def clip_( + input: Tensor, + min: Tensor | None = None, + max: Tensor | None = None, +) -> Tensor: ... +@overload +def clip_( + input: Tensor, + min: Number | _complex | None = None, + max: Number | _complex | None = None, +) -> Tensor: ... +def clone( + input: Tensor, + *, + memory_format: memory_format | None = None, +) -> Tensor: + r""" + clone(input, *, memory_format=torch.preserve_format) -> Tensor + + Returns a copy of :attr:`input`. + + .. note:: + + This function is differentiable, so gradients will flow back from the + result of this operation to :attr:`input`. To create a tensor without an + autograd relationship to :attr:`input` see :meth:`~Tensor.detach`. + + In addition, when ``torch.preserve_format`` is used: + If the input tensor is dense (i.e., non-overlapping strided), + its memory format (including strides) is retained. + Otherwise (e.g., a non-dense view like a stepped slice), + the output is converted to the dense (contiguous) format. + + Args: + input (Tensor): the input tensor. + + Keyword args: + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned tensor. Default: ``torch.preserve_format``. + """ + +def col_indices_copy(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + Performs the same operation as :func:`torch.col_indices`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def column_stack( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + column_stack(tensors, *, out=None) -> Tensor + + Creates a new tensor by horizontally stacking the tensors in :attr:`tensors`. + + Equivalent to ``torch.hstack(tensors)``, except each zero or one dimensional tensor ``t`` + in :attr:`tensors` is first reshaped into a ``(t.numel(), 1)`` column before being stacked horizontally. + + Args: + tensors (sequence of Tensors): sequence of tensors to concatenate + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([1, 2, 3]) + >>> b = torch.tensor([4, 5, 6]) + >>> torch.column_stack((a, b)) + tensor([[1, 4], + [2, 5], + [3, 6]]) + >>> a = torch.arange(5) + >>> b = torch.arange(10).reshape(5, 2) + >>> torch.column_stack((a, b, b)) + tensor([[0, 0, 1, 0, 1], + [1, 2, 3, 2, 3], + [2, 4, 5, 4, 5], + [3, 6, 7, 6, 7], + [4, 8, 9, 8, 9]]) + """ + +def combinations( + input: Tensor, + r: _int = 2, + with_replacement: _bool = False, +) -> Tensor: + r""" + combinations(input: Tensor, r: int = 2, with_replacement: bool = False) -> seq + + Compute combinations of length :math:`r` of the given tensor. The behavior is similar to + python's `itertools.combinations` when `with_replacement` is set to `False`, and + `itertools.combinations_with_replacement` when `with_replacement` is set to `True`. + + Arguments: + input (Tensor): 1D vector. + r (int, optional): number of elements to combine + with_replacement (bool, optional): whether to allow duplication in combination + + Returns: + Tensor: A tensor equivalent to converting all the input tensors into lists, do + `itertools.combinations` or `itertools.combinations_with_replacement` on these + lists, and finally convert the resulting list into tensor. + + Example:: + + >>> a = [1, 2, 3] + >>> list(itertools.combinations(a, r=2)) + [(1, 2), (1, 3), (2, 3)] + >>> list(itertools.combinations(a, r=3)) + [(1, 2, 3)] + >>> list(itertools.combinations_with_replacement(a, r=2)) + [(1, 1), (1, 2), (1, 3), (2, 2), (2, 3), (3, 3)] + >>> tensor_a = torch.tensor(a) + >>> torch.combinations(tensor_a) + tensor([[1, 2], + [1, 3], + [2, 3]]) + >>> torch.combinations(tensor_a, r=3) + tensor([[1, 2, 3]]) + >>> torch.combinations(tensor_a, with_replacement=True) + tensor([[1, 1], + [1, 2], + [1, 3], + [2, 2], + [2, 3], + [3, 3]]) + """ + +def complex( + real: Tensor, + imag: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + complex(real, imag, *, out=None) -> Tensor + + Constructs a complex tensor with its real part equal to :attr:`real` and its + imaginary part equal to :attr:`imag`. + + Args: + real (Tensor): The real part of the complex tensor. Must be half, float or double. + imag (Tensor): The imaginary part of the complex tensor. Must be same dtype + as :attr:`real`. + + Keyword args: + out (Tensor): If the inputs are ``torch.float32``, must be + ``torch.complex64``. If the inputs are ``torch.float64``, must be + ``torch.complex128``. + + Example:: + + >>> real = torch.tensor([1, 2], dtype=torch.float32) + >>> imag = torch.tensor([3, 4], dtype=torch.float32) + >>> z = torch.complex(real, imag) + >>> z + tensor([(1.+3.j), (2.+4.j)]) + >>> z.dtype + torch.complex64 + """ + +@overload +def concat( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + dim: _int = 0, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + concat(tensors, dim=0, *, out=None) -> Tensor + + Alias of :func:`torch.cat`. + """ + +@overload +def concat( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + dim: str | EllipsisType | None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + concat(tensors, dim=0, *, out=None) -> Tensor + + Alias of :func:`torch.cat`. + """ + +@overload +def concatenate( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + dim: _int = 0, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + concatenate(tensors, axis=0, out=None) -> Tensor + + Alias of :func:`torch.cat`. + """ + +@overload +def concatenate( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + dim: str | EllipsisType | None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + concatenate(tensors, axis=0, out=None) -> Tensor + + Alias of :func:`torch.cat`. + """ + +def conj(input: Tensor) -> Tensor: + r""" + conj(input) -> Tensor + + Returns a view of :attr:`input` with a flipped conjugate bit. If :attr:`input` has a non-complex dtype, + this function just returns :attr:`input`. + + .. note:: + :func:`torch.conj` performs a lazy conjugation, but the actual conjugated tensor can be materialized + at any time using :func:`torch.resolve_conj`. + + .. warning:: In the future, :func:`torch.conj` may return a non-writeable view for an :attr:`input` of + non-complex dtype. It's recommended that programs not modify the tensor returned by :func:`torch.conj_physical` + when :attr:`input` is of non-complex dtype to be compatible with this change. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> x = torch.tensor([-1 + 1j, -2 + 2j, 3 - 3j]) + >>> x.is_conj() + False + >>> y = torch.conj(x) + >>> y.is_conj() + True + """ + +def conj_physical(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + conj_physical(input, *, out=None) -> Tensor + + Computes the element-wise conjugate of the given :attr:`input` tensor. + If :attr:`input` has a non-complex dtype, this function just returns :attr:`input`. + + .. note:: + This performs the conjugate operation regardless of the fact conjugate bit is set or not. + + .. warning:: In the future, :func:`torch.conj_physical` may return a non-writeable view for an :attr:`input` of + non-complex dtype. It's recommended that programs not modify the tensor returned by :func:`torch.conj_physical` + when :attr:`input` is of non-complex dtype to be compatible with this change. + + .. math:: + \text{out}_{i} = conj(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.conj_physical(torch.tensor([-1 + 1j, -2 + 2j, 3 - 3j])) + tensor([-1 - 1j, -2 - 2j, 3 + 3j]) + """ + +def conj_physical_(input: Tensor) -> Tensor: ... +def constant_pad_nd( + input: Tensor, + pad: Sequence[_int | SymInt], + value: Number | _complex = 0, +) -> Tensor: ... +@overload +def conv1d( + input: Tensor, + weight: Tensor, + bias: Tensor | None = None, + stride: _int | SymInt | Sequence[_int | SymInt] = 1, + padding: _int | SymInt | Sequence[_int | SymInt] = 0, + dilation: _int | SymInt | Sequence[_int | SymInt] = 1, + groups: _int | SymInt = 1, +) -> Tensor: ... +@overload +def conv1d( + input: Tensor, + weight: Tensor, + bias: Tensor | None = None, + stride: _int | SymInt | Sequence[_int | SymInt] = 1, + padding: str = "valid", + dilation: _int | SymInt | Sequence[_int | SymInt] = 1, + groups: _int | SymInt = 1, +) -> Tensor: ... +@overload +def conv2d( + input: Tensor, + weight: Tensor, + bias: Tensor | None = None, + stride: _int | SymInt | Sequence[_int | SymInt] = 1, + padding: _int | SymInt | Sequence[_int | SymInt] = 0, + dilation: _int | SymInt | Sequence[_int | SymInt] = 1, + groups: _int | SymInt = 1, +) -> Tensor: ... +@overload +def conv2d( + input: Tensor, + weight: Tensor, + bias: Tensor | None = None, + stride: _int | SymInt | Sequence[_int | SymInt] = 1, + padding: str = "valid", + dilation: _int | SymInt | Sequence[_int | SymInt] = 1, + groups: _int | SymInt = 1, +) -> Tensor: ... +@overload +def conv3d( + input: Tensor, + weight: Tensor, + bias: Tensor | None = None, + stride: _int | SymInt | Sequence[_int | SymInt] = 1, + padding: _int | SymInt | Sequence[_int | SymInt] = 0, + dilation: _int | SymInt | Sequence[_int | SymInt] = 1, + groups: _int | SymInt = 1, +) -> Tensor: ... +@overload +def conv3d( + input: Tensor, + weight: Tensor, + bias: Tensor | None = None, + stride: _int | SymInt | Sequence[_int | SymInt] = 1, + padding: str = "valid", + dilation: _int | SymInt | Sequence[_int | SymInt] = 1, + groups: _int | SymInt = 1, +) -> Tensor: ... +def conv_tbc( + input: Tensor, + weight: Tensor, + bias: Tensor, + pad: _int = 0, +) -> Tensor: ... +def conv_transpose1d( + input: Tensor, + weight: Tensor, + bias: Tensor | None = None, + stride: _int | SymInt | Sequence[_int | SymInt] = 1, + padding: _int | SymInt | Sequence[_int | SymInt] = 0, + output_padding: _int | SymInt | Sequence[_int | SymInt] = 0, + groups: _int | SymInt = 1, + dilation: _int | SymInt | Sequence[_int | SymInt] = 1, +) -> Tensor: ... +def conv_transpose2d( + input: Tensor, + weight: Tensor, + bias: Tensor | None = None, + stride: _int | SymInt | Sequence[_int | SymInt] = 1, + padding: _int | SymInt | Sequence[_int | SymInt] = 0, + output_padding: _int | SymInt | Sequence[_int | SymInt] = 0, + groups: _int | SymInt = 1, + dilation: _int | SymInt | Sequence[_int | SymInt] = 1, +) -> Tensor: ... +def conv_transpose3d( + input: Tensor, + weight: Tensor, + bias: Tensor | None = None, + stride: _int | SymInt | Sequence[_int | SymInt] = 1, + padding: _int | SymInt | Sequence[_int | SymInt] = 0, + output_padding: _int | SymInt | Sequence[_int | SymInt] = 0, + groups: _int | SymInt = 1, + dilation: _int | SymInt | Sequence[_int | SymInt] = 1, +) -> Tensor: ... +def convolution( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + stride: Sequence[_int | SymInt], + padding: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + transposed: _bool, + output_padding: Sequence[_int | SymInt], + groups: _int | SymInt, +) -> Tensor: ... +@overload +def copysign( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + copysign(input, other, *, out=None) -> Tensor + + Create a new floating-point tensor with the magnitude of :attr:`input` and the sign of :attr:`other`, elementwise. + + .. math:: + \text{out}_{i} = \begin{cases} + -|\text{input}_{i}| & \text{if } \text{other}_{i} \leq -0.0 \\ + |\text{input}_{i}| & \text{if } \text{other}_{i} \geq 0.0 \\ + \end{cases} + + + Supports :ref:`broadcasting to a common shape `, + and integer and float inputs. + + Args: + input (Tensor): magnitudes. + other (Tensor or Number): contains value(s) whose signbit(s) are + applied to the magnitudes in :attr:`input`. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(5) + >>> a + tensor([-1.2557, -0.0026, -0.5387, 0.4740, -0.9244]) + >>> torch.copysign(a, 1) + tensor([1.2557, 0.0026, 0.5387, 0.4740, 0.9244]) + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.7079, 0.2778, -1.0249, 0.5719], + [-0.0059, -0.2600, -0.4475, -1.3948], + [ 0.3667, -0.9567, -2.5757, -0.1751], + [ 0.2046, -0.0742, 0.2998, -0.1054]]) + >>> b = torch.randn(4) + tensor([ 0.2373, 0.3120, 0.3190, -1.1128]) + >>> torch.copysign(a, b) + tensor([[ 0.7079, 0.2778, 1.0249, -0.5719], + [ 0.0059, 0.2600, 0.4475, -1.3948], + [ 0.3667, 0.9567, 2.5757, -0.1751], + [ 0.2046, 0.0742, 0.2998, -0.1054]]) + >>> a = torch.tensor([1.]) + >>> b = torch.tensor([-0.]) + >>> torch.copysign(a, b) + tensor([-1.]) + + .. note:: + copysign handles signed zeros. If the other argument has a negative zero (-0), + the corresponding output value will be negative. + """ + +@overload +def copysign( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + copysign(input, other, *, out=None) -> Tensor + + Create a new floating-point tensor with the magnitude of :attr:`input` and the sign of :attr:`other`, elementwise. + + .. math:: + \text{out}_{i} = \begin{cases} + -|\text{input}_{i}| & \text{if } \text{other}_{i} \leq -0.0 \\ + |\text{input}_{i}| & \text{if } \text{other}_{i} \geq 0.0 \\ + \end{cases} + + + Supports :ref:`broadcasting to a common shape `, + and integer and float inputs. + + Args: + input (Tensor): magnitudes. + other (Tensor or Number): contains value(s) whose signbit(s) are + applied to the magnitudes in :attr:`input`. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(5) + >>> a + tensor([-1.2557, -0.0026, -0.5387, 0.4740, -0.9244]) + >>> torch.copysign(a, 1) + tensor([1.2557, 0.0026, 0.5387, 0.4740, 0.9244]) + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.7079, 0.2778, -1.0249, 0.5719], + [-0.0059, -0.2600, -0.4475, -1.3948], + [ 0.3667, -0.9567, -2.5757, -0.1751], + [ 0.2046, -0.0742, 0.2998, -0.1054]]) + >>> b = torch.randn(4) + tensor([ 0.2373, 0.3120, 0.3190, -1.1128]) + >>> torch.copysign(a, b) + tensor([[ 0.7079, 0.2778, 1.0249, -0.5719], + [ 0.0059, 0.2600, 0.4475, -1.3948], + [ 0.3667, 0.9567, 2.5757, -0.1751], + [ 0.2046, 0.0742, 0.2998, -0.1054]]) + >>> a = torch.tensor([1.]) + >>> b = torch.tensor([-0.]) + >>> torch.copysign(a, b) + tensor([-1.]) + + .. note:: + copysign handles signed zeros. If the other argument has a negative zero (-0), + the corresponding output value will be negative. + """ + +def corrcoef(input: Tensor) -> Tensor: + r""" + corrcoef(input) -> Tensor + + Estimates the Pearson product-moment correlation coefficient matrix of the variables given by the :attr:`input` matrix, + where rows are the variables and columns are the observations. + + .. note:: + + The correlation coefficient matrix R is computed using the covariance matrix C as given by + :math:`R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} * C_{jj} } }` + + .. note:: + + Due to floating point rounding, the resulting array may not be Hermitian and its diagonal elements may not be 1. + The real and imaginary values are clipped to the interval [-1, 1] in an attempt to improve this situation. + + Args: + input (Tensor): A 2D matrix containing multiple variables and observations, or a + Scalar or 1D vector representing a single variable. + + Returns: + (Tensor) The correlation coefficient matrix of the variables. + + .. seealso:: + + :func:`torch.cov` covariance matrix. + + Example:: + + >>> x = torch.tensor([[0, 1, 2], [2, 1, 0]]) + >>> torch.corrcoef(x) + tensor([[ 1., -1.], + [-1., 1.]]) + >>> x = torch.randn(2, 4) + >>> x + tensor([[-0.2678, -0.0908, -0.3766, 0.2780], + [-0.5812, 0.1535, 0.2387, 0.2350]]) + >>> torch.corrcoef(x) + tensor([[1.0000, 0.3582], + [0.3582, 1.0000]]) + >>> torch.corrcoef(x[0]) + tensor(1.) + """ + +def cos(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + cos(input, *, out=None) -> Tensor + + Returns a new tensor with the cosine of the elements of :attr:`input` given in radians. + + .. math:: + \text{out}_{i} = \cos(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 1.4309, 1.2706, -0.8562, 0.9796]) + >>> torch.cos(a) + tensor([ 0.1395, 0.2957, 0.6553, 0.5574]) + """ + +def cos_(input: Tensor) -> Tensor: ... +def cosh(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + cosh(input, *, out=None) -> Tensor + + Returns a new tensor with the hyperbolic cosine of the elements of + :attr:`input`. + + .. math:: + \text{out}_{i} = \cosh(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.1632, 1.1835, -0.6979, -0.7325]) + >>> torch.cosh(a) + tensor([ 1.0133, 1.7860, 1.2536, 1.2805]) + + .. note:: + When :attr:`input` is on the CPU, the implementation of torch.cosh may use + the Sleef library, which rounds very large results to infinity or negative + infinity. See `here `_ for details. + """ + +def cosh_(input: Tensor) -> Tensor: ... +def cosine_embedding_loss( + input1: Tensor, + input2: Tensor, + target: Tensor, + margin: _float = 0.0, + reduction: _int = 1, +) -> Tensor: ... +def cosine_similarity( + x1: Tensor, + x2: Tensor, + dim: _int = 1, + eps: _float = 1e-08, +) -> Tensor: ... +@overload +def count_nonzero(input: Tensor, dim: _int | None = None) -> Tensor: + r""" + count_nonzero(input, dim=None) -> Tensor + + Counts the number of non-zero values in the tensor :attr:`input` along the given :attr:`dim`. + If no dim is specified then all non-zeros in the tensor are counted. + + Args: + input (Tensor): the input tensor. + dim (int or tuple of ints, optional): Dim or tuple of dims along which to count non-zeros. + + Example:: + + >>> x = torch.zeros(3,3) + >>> x[torch.randn(3,3) > 0.5] = 1 + >>> x + tensor([[0., 1., 1.], + [0., 0., 0.], + [0., 0., 1.]]) + >>> torch.count_nonzero(x) + tensor(3) + >>> torch.count_nonzero(x, dim=0) + tensor([0, 1, 2]) + """ + +@overload +def count_nonzero(input: Tensor, dim: _size) -> Tensor: + r""" + count_nonzero(input, dim=None) -> Tensor + + Counts the number of non-zero values in the tensor :attr:`input` along the given :attr:`dim`. + If no dim is specified then all non-zeros in the tensor are counted. + + Args: + input (Tensor): the input tensor. + dim (int or tuple of ints, optional): Dim or tuple of dims along which to count non-zeros. + + Example:: + + >>> x = torch.zeros(3,3) + >>> x[torch.randn(3,3) > 0.5] = 1 + >>> x + tensor([[0., 1., 1.], + [0., 0., 0.], + [0., 0., 1.]]) + >>> torch.count_nonzero(x) + tensor(3) + >>> torch.count_nonzero(x, dim=0) + tensor([0, 1, 2]) + """ + +def cov( + input: Tensor, + *, + correction: _int = 1, + fweights: Tensor | None = None, + aweights: Tensor | None = None, +) -> Tensor: + r""" + cov(input, *, correction=1, fweights=None, aweights=None) -> Tensor + + Estimates the covariance matrix of the variables given by the :attr:`input` matrix, where rows are + the variables and columns are the observations. + + A covariance matrix is a square matrix giving the covariance of each pair of variables. The diagonal contains + the variance of each variable (covariance of a variable with itself). By definition, if :attr:`input` represents + a single variable (Scalar or 1D) then its variance is returned. + + The sample covariance of the variables :math:`x` and :math:`y` is given by: + + .. math:: + \text{cov}(x,y) = \frac{\sum^{N}_{i = 1}(x_{i} - \bar{x})(y_{i} - \bar{y})}{\max(0,~N~-~\delta N)} + + where :math:`\bar{x}` and :math:`\bar{y}` are the simple means of the :math:`x` and :math:`y` respectively, and + :math:`\delta N` is the :attr:`correction`. + + If :attr:`fweights` and/or :attr:`aweights` are provided, the weighted covariance + is calculated, which is given by: + + .. math:: + \text{cov}_w(x,y) = \frac{\sum^{N}_{i = 1}w_i(x_{i} - \mu_x^*)(y_{i} - \mu_y^*)} + {\max(0,~\sum^{N}_{i = 1}w_i~-~\frac{\sum^{N}_{i = 1}w_ia_i}{\sum^{N}_{i = 1}w_i}~\delta N)} + + where :math:`w` denotes :attr:`fweights` or :attr:`aweights` (``f`` and ``a`` for brevity) based on whichever is + provided, or :math:`w = f \times a` if both are provided, and + :math:`\mu_x^* = \frac{\sum^{N}_{i = 1}w_ix_{i} }{\sum^{N}_{i = 1}w_i}` is the weighted mean of the variable. If not + provided, ``f`` and/or ``a`` can be seen as a :math:`\mathbb{1}` vector of appropriate size. + + Args: + input (Tensor): A 2D matrix containing multiple variables and observations, or a + Scalar or 1D vector representing a single variable. + + Keyword Args: + correction (int, optional): difference between the sample size and sample degrees of freedom. + Defaults to Bessel's correction, ``correction = 1`` which returns the unbiased estimate, + even if both :attr:`fweights` and :attr:`aweights` are specified. ``correction = 0`` + will return the simple average. Defaults to ``1``. + fweights (tensor, optional): A Scalar or 1D tensor of observation vector frequencies representing the number of + times each observation should be repeated. Its numel must equal the number of columns of :attr:`input`. + Must have integral dtype. Ignored if ``None``. Defaults to ``None``. + aweights (tensor, optional): A Scalar or 1D array of observation vector weights. + These relative weights are typically large for observations considered "important" and smaller for + observations considered less "important". Its numel must equal the number of columns of :attr:`input`. + Must have floating point dtype. Ignored if ``None``. Defaults to ``None``. + + Returns: + (Tensor) The covariance matrix of the variables. + + .. seealso:: + + :func:`torch.corrcoef` normalized covariance matrix. + + Example:: + + >>> x = torch.tensor([[0, 2], [1, 1], [2, 0]]).T + >>> x + tensor([[0, 1, 2], + [2, 1, 0]]) + >>> torch.cov(x) + tensor([[ 1., -1.], + [-1., 1.]]) + >>> torch.cov(x, correction=0) + tensor([[ 0.6667, -0.6667], + [-0.6667, 0.6667]]) + >>> fw = torch.randint(1, 10, (3,)) + >>> fw + tensor([1, 6, 9]) + >>> aw = torch.rand(3) + >>> aw + tensor([0.4282, 0.0255, 0.4144]) + >>> torch.cov(x, fweights=fw, aweights=aw) + tensor([[ 0.4169, -0.4169], + [-0.4169, 0.4169]]) + """ + +def cross( + input: Tensor, + other: Tensor, + dim: _int | None = None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + cross(input, other, dim=None, *, out=None) -> Tensor + + + Returns the cross product of vectors in dimension :attr:`dim` of :attr:`input` + and :attr:`other`. + + Supports input of float, double, cfloat and cdouble dtypes. Also supports batches + of vectors, for which it computes the product along the dimension :attr:`dim`. + In this case, the output has the same batch dimensions as the inputs. + + .. warning:: + If :attr:`dim` is not given, it defaults to the first dimension found + with the size 3. Note that this might be unexpected. + + This behavior is deprecated and will be changed to match that of :func:`torch.linalg.cross` + in a future release. + + .. seealso:: + :func:`torch.linalg.cross` which has dim=-1 as default. + + + Args: + input (Tensor): the input tensor. + other (Tensor): the second input tensor + dim (int, optional): the dimension to take the cross-product in. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4, 3) + >>> a + tensor([[-0.3956, 1.1455, 1.6895], + [-0.5849, 1.3672, 0.3599], + [-1.1626, 0.7180, -0.0521], + [-0.1339, 0.9902, -2.0225]]) + >>> b = torch.randn(4, 3) + >>> b + tensor([[-0.0257, -1.4725, -1.2251], + [-1.1479, -0.7005, -1.9757], + [-1.3904, 0.3726, -1.1836], + [-0.9688, -0.7153, 0.2159]]) + >>> torch.cross(a, b, dim=1) + tensor([[ 1.0844, -0.5281, 0.6120], + [-2.4490, -1.5687, 1.9792], + [-0.8304, -1.3037, 0.5650], + [-1.2329, 1.9883, 1.0551]]) + >>> torch.cross(a, b) + tensor([[ 1.0844, -0.5281, 0.6120], + [-2.4490, -1.5687, 1.9792], + [-0.8304, -1.3037, 0.5650], + [-1.2329, 1.9883, 1.0551]]) + """ + +def crow_indices_copy( + input: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.crow_indices`, but all output tensors + are freshly created instead of aliasing the input. + """ + +@overload +def ctc_loss( + log_probs: Tensor, + targets: Tensor, + input_lengths: _size, + target_lengths: _size, + blank: _int = 0, + reduction: _int = 1, + zero_infinity: _bool = False, +) -> Tensor: ... +@overload +def ctc_loss( + log_probs: Tensor, + targets: Tensor, + input_lengths: Tensor, + target_lengths: Tensor, + blank: _int = 0, + reduction: _int = 1, + zero_infinity: _bool = False, +) -> Tensor: ... +def cudnn_affine_grid_generator( + theta: Tensor, + N: _int, + C: _int, + H: _int, + W: _int, +) -> Tensor: ... +def cudnn_batch_norm( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + running_mean: Tensor | None, + running_var: Tensor | None, + training: _bool, + exponential_average_factor: _float, + epsilon: _float, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> tuple[Tensor, Tensor, Tensor, Tensor]: ... +def cudnn_convolution( + input: Tensor, + weight: Tensor, + padding: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, + benchmark: _bool, + deterministic: _bool, + allow_tf32: _bool, + *, + out: Tensor | None = None, +) -> Tensor: ... +def cudnn_convolution_add_relu( + input: Tensor, + weight: Tensor, + z: Tensor, + alpha: Number | _complex | None, + bias: Tensor | None, + stride: Sequence[_int | SymInt], + padding: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, +) -> Tensor: ... +def cudnn_convolution_relu( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + stride: Sequence[_int | SymInt], + padding: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, +) -> Tensor: ... +def cudnn_convolution_transpose( + input: Tensor, + weight: Tensor, + padding: Sequence[_int | SymInt], + output_padding: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, + benchmark: _bool, + deterministic: _bool, + allow_tf32: _bool, +) -> Tensor: ... +def cudnn_grid_sampler(input: Tensor, grid: Tensor) -> Tensor: ... +def cudnn_is_acceptable(input: Tensor) -> _bool: ... +@overload +def cummax( + input: Tensor, + dim: _int, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.cummax: + r""" + cummax(input, dim, *, out=None) -> (Tensor, LongTensor) + Returns a namedtuple ``(values, indices)`` where ``values`` is the cumulative maximum of + elements of :attr:`input` in the dimension :attr:`dim`. And ``indices`` is the index + location of each maximum value found in the dimension :attr:`dim`. + + .. math:: + y_i = max(x_1, x_2, x_3, \dots, x_i) + + Args: + input (Tensor): the input tensor. + dim (int): the dimension to do the operation over + + Keyword args: + out (tuple, optional): the result tuple of two output tensors (values, indices) + + Example:: + + >>> a = torch.randn(10) + >>> a + tensor([-0.3449, -1.5447, 0.0685, -1.5104, -1.1706, 0.2259, 1.4696, -1.3284, + 1.9946, -0.8209]) + >>> torch.cummax(a, dim=0) + torch.return_types.cummax( + values=tensor([-0.3449, -0.3449, 0.0685, 0.0685, 0.0685, 0.2259, 1.4696, 1.4696, + 1.9946, 1.9946]), + indices=tensor([0, 0, 2, 2, 2, 5, 6, 6, 8, 8])) + """ + +@overload +def cummax( + input: Tensor, + dim: str | EllipsisType | None, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.cummax: + r""" + cummax(input, dim, *, out=None) -> (Tensor, LongTensor) + Returns a namedtuple ``(values, indices)`` where ``values`` is the cumulative maximum of + elements of :attr:`input` in the dimension :attr:`dim`. And ``indices`` is the index + location of each maximum value found in the dimension :attr:`dim`. + + .. math:: + y_i = max(x_1, x_2, x_3, \dots, x_i) + + Args: + input (Tensor): the input tensor. + dim (int): the dimension to do the operation over + + Keyword args: + out (tuple, optional): the result tuple of two output tensors (values, indices) + + Example:: + + >>> a = torch.randn(10) + >>> a + tensor([-0.3449, -1.5447, 0.0685, -1.5104, -1.1706, 0.2259, 1.4696, -1.3284, + 1.9946, -0.8209]) + >>> torch.cummax(a, dim=0) + torch.return_types.cummax( + values=tensor([-0.3449, -0.3449, 0.0685, 0.0685, 0.0685, 0.2259, 1.4696, 1.4696, + 1.9946, 1.9946]), + indices=tensor([0, 0, 2, 2, 2, 5, 6, 6, 8, 8])) + """ + +@overload +def cummin( + input: Tensor, + dim: _int, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.cummin: + r""" + cummin(input, dim, *, out=None) -> (Tensor, LongTensor) + Returns a namedtuple ``(values, indices)`` where ``values`` is the cumulative minimum of + elements of :attr:`input` in the dimension :attr:`dim`. And ``indices`` is the index + location of each maximum value found in the dimension :attr:`dim`. + + .. math:: + y_i = min(x_1, x_2, x_3, \dots, x_i) + + Args: + input (Tensor): the input tensor. + dim (int): the dimension to do the operation over + + Keyword args: + out (tuple, optional): the result tuple of two output tensors (values, indices) + + Example:: + + >>> a = torch.randn(10) + >>> a + tensor([-0.2284, -0.6628, 0.0975, 0.2680, -1.3298, -0.4220, -0.3885, 1.1762, + 0.9165, 1.6684]) + >>> torch.cummin(a, dim=0) + torch.return_types.cummin( + values=tensor([-0.2284, -0.6628, -0.6628, -0.6628, -1.3298, -1.3298, -1.3298, -1.3298, + -1.3298, -1.3298]), + indices=tensor([0, 1, 1, 1, 4, 4, 4, 4, 4, 4])) + """ + +@overload +def cummin( + input: Tensor, + dim: str | EllipsisType | None, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.cummin: + r""" + cummin(input, dim, *, out=None) -> (Tensor, LongTensor) + Returns a namedtuple ``(values, indices)`` where ``values`` is the cumulative minimum of + elements of :attr:`input` in the dimension :attr:`dim`. And ``indices`` is the index + location of each maximum value found in the dimension :attr:`dim`. + + .. math:: + y_i = min(x_1, x_2, x_3, \dots, x_i) + + Args: + input (Tensor): the input tensor. + dim (int): the dimension to do the operation over + + Keyword args: + out (tuple, optional): the result tuple of two output tensors (values, indices) + + Example:: + + >>> a = torch.randn(10) + >>> a + tensor([-0.2284, -0.6628, 0.0975, 0.2680, -1.3298, -0.4220, -0.3885, 1.1762, + 0.9165, 1.6684]) + >>> torch.cummin(a, dim=0) + torch.return_types.cummin( + values=tensor([-0.2284, -0.6628, -0.6628, -0.6628, -1.3298, -1.3298, -1.3298, -1.3298, + -1.3298, -1.3298]), + indices=tensor([0, 1, 1, 1, 4, 4, 4, 4, 4, 4])) + """ + +@overload +def cumprod( + input: Tensor, + dim: _int, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + cumprod(input, dim, *, dtype=None, out=None) -> Tensor + + Returns the cumulative product of elements of :attr:`input` in the dimension + :attr:`dim`. + + For example, if :attr:`input` is a vector of size N, the result will also be + a vector of size N, with elements. + + .. math:: + y_i = x_1 \times x_2\times x_3\times \dots \times x_i + + Args: + input (Tensor): the input tensor. + dim (int): the dimension to do the operation over + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(10) + >>> a + tensor([ 0.6001, 0.2069, -0.1919, 0.9792, 0.6727, 1.0062, 0.4126, + -0.2129, -0.4206, 0.1968]) + >>> torch.cumprod(a, dim=0) + tensor([ 0.6001, 0.1241, -0.0238, -0.0233, -0.0157, -0.0158, -0.0065, + 0.0014, -0.0006, -0.0001]) + + >>> a[5] = 0.0 + >>> torch.cumprod(a, dim=0) + tensor([ 0.6001, 0.1241, -0.0238, -0.0233, -0.0157, -0.0000, -0.0000, + 0.0000, -0.0000, -0.0000]) + """ + +@overload +def cumprod( + input: Tensor, + dim: str | EllipsisType | None, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + cumprod(input, dim, *, dtype=None, out=None) -> Tensor + + Returns the cumulative product of elements of :attr:`input` in the dimension + :attr:`dim`. + + For example, if :attr:`input` is a vector of size N, the result will also be + a vector of size N, with elements. + + .. math:: + y_i = x_1 \times x_2\times x_3\times \dots \times x_i + + Args: + input (Tensor): the input tensor. + dim (int): the dimension to do the operation over + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(10) + >>> a + tensor([ 0.6001, 0.2069, -0.1919, 0.9792, 0.6727, 1.0062, 0.4126, + -0.2129, -0.4206, 0.1968]) + >>> torch.cumprod(a, dim=0) + tensor([ 0.6001, 0.1241, -0.0238, -0.0233, -0.0157, -0.0158, -0.0065, + 0.0014, -0.0006, -0.0001]) + + >>> a[5] = 0.0 + >>> torch.cumprod(a, dim=0) + tensor([ 0.6001, 0.1241, -0.0238, -0.0233, -0.0157, -0.0000, -0.0000, + 0.0000, -0.0000, -0.0000]) + """ + +@overload +def cumsum( + input: Tensor, + dim: _int, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + cumsum(input, dim, *, dtype=None, out=None) -> Tensor + + Returns the cumulative sum of elements of :attr:`input` in the dimension + :attr:`dim`. + + For example, if :attr:`input` is a vector of size N, the result will also be + a vector of size N, with elements. + + .. math:: + y_i = x_1 + x_2 + x_3 + \dots + x_i + + Args: + input (Tensor): the input tensor. + dim (int): the dimension to do the operation over + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randint(1, 20, (10,)) + >>> a + tensor([13, 7, 3, 10, 13, 3, 15, 10, 9, 10]) + >>> torch.cumsum(a, dim=0) + tensor([13, 20, 23, 33, 46, 49, 64, 74, 83, 93]) + """ + +@overload +def cumsum( + input: Tensor, + dim: str | EllipsisType | None, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + cumsum(input, dim, *, dtype=None, out=None) -> Tensor + + Returns the cumulative sum of elements of :attr:`input` in the dimension + :attr:`dim`. + + For example, if :attr:`input` is a vector of size N, the result will also be + a vector of size N, with elements. + + .. math:: + y_i = x_1 + x_2 + x_3 + \dots + x_i + + Args: + input (Tensor): the input tensor. + dim (int): the dimension to do the operation over + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randint(1, 20, (10,)) + >>> a + tensor([13, 7, 3, 10, 13, 3, 15, 10, 9, 10]) + >>> torch.cumsum(a, dim=0) + tensor([13, 20, 23, 33, 46, 49, 64, 74, 83, 93]) + """ + +@overload +def cumulative_trapezoid(y: Tensor, x: Tensor, *, dim: _int = -1) -> Tensor: + r""" + cumulative_trapezoid(y, x=None, *, dx=None, dim=-1) -> Tensor + + Cumulatively computes the `trapezoidal rule `_ + along :attr:`dim`. By default the spacing between elements is assumed to be 1, but + :attr:`dx` can be used to specify a different constant spacing, and :attr:`x` can be + used to specify arbitrary spacing along :attr:`dim`. + + For more details, please read :func:`torch.trapezoid`. The difference between :func:`torch.trapezoid` + and this function is that, :func:`torch.trapezoid` returns a value for each integration, + where as this function returns a cumulative value for every spacing within the integration. This + is analogous to how `.sum` returns a value and `.cumsum` returns a cumulative sum. + + Arguments: + y (Tensor): Values to use when computing the trapezoidal rule. + x (Tensor): If specified, defines spacing between values as specified above. + + Keyword arguments: + dx (float): constant spacing between values. If neither :attr:`x` or :attr:`dx` + are specified then this defaults to 1. Effectively multiplies the result by its value. + dim (int): The dimension along which to compute the trapezoidal rule. + The last (inner-most) dimension by default. + + Examples:: + + >>> # Cumulatively computes the trapezoidal rule in 1D, spacing is implicitly 1. + >>> y = torch.tensor([1, 5, 10]) + >>> torch.cumulative_trapezoid(y) + tensor([3., 10.5]) + + >>> # Computes the same trapezoidal rule directly up to each element to verify + >>> (1 + 5) / 2 + 3.0 + >>> (1 + 10 + 10) / 2 + 10.5 + + >>> # Cumulatively computes the trapezoidal rule in 1D with constant spacing of 2 + >>> # NOTE: the result is the same as before, but multiplied by 2 + >>> torch.cumulative_trapezoid(y, dx=2) + tensor([6., 21.]) + + >>> # Cumulatively computes the trapezoidal rule in 1D with arbitrary spacing + >>> x = torch.tensor([1, 3, 6]) + >>> torch.cumulative_trapezoid(y, x) + tensor([6., 28.5]) + + >>> # Computes the same trapezoidal rule directly up to each element to verify + >>> ((3 - 1) * (1 + 5)) / 2 + 6.0 + >>> ((3 - 1) * (1 + 5) + (6 - 3) * (5 + 10)) / 2 + 28.5 + + >>> # Cumulatively computes the trapezoidal rule for each row of a 3x3 matrix + >>> y = torch.arange(9).reshape(3, 3) + tensor([[0, 1, 2], + [3, 4, 5], + [6, 7, 8]]) + >>> torch.cumulative_trapezoid(y) + tensor([[ 0.5, 2.], + [ 3.5, 8.], + [ 6.5, 14.]]) + + >>> # Cumulatively computes the trapezoidal rule for each column of the matrix + >>> torch.cumulative_trapezoid(y, dim=0) + tensor([[ 1.5, 2.5, 3.5], + [ 6.0, 8.0, 10.0]]) + + >>> # Cumulatively computes the trapezoidal rule for each row of a 3x3 ones matrix + >>> # with the same arbitrary spacing + >>> y = torch.ones(3, 3) + >>> x = torch.tensor([1, 3, 6]) + >>> torch.cumulative_trapezoid(y, x) + tensor([[2., 5.], + [2., 5.], + [2., 5.]]) + + >>> # Cumulatively computes the trapezoidal rule for each row of a 3x3 ones matrix + >>> # with different arbitrary spacing per row + >>> y = torch.ones(3, 3) + >>> x = torch.tensor([[1, 2, 3], [1, 3, 5], [1, 4, 7]]) + >>> torch.cumulative_trapezoid(y, x) + tensor([[1., 2.], + [2., 4.], + [3., 6.]]) + """ + +@overload +def cumulative_trapezoid( + y: Tensor, + *, + dx: Number | _complex = 1, + dim: _int = -1, +) -> Tensor: + r""" + cumulative_trapezoid(y, x=None, *, dx=None, dim=-1) -> Tensor + + Cumulatively computes the `trapezoidal rule `_ + along :attr:`dim`. By default the spacing between elements is assumed to be 1, but + :attr:`dx` can be used to specify a different constant spacing, and :attr:`x` can be + used to specify arbitrary spacing along :attr:`dim`. + + For more details, please read :func:`torch.trapezoid`. The difference between :func:`torch.trapezoid` + and this function is that, :func:`torch.trapezoid` returns a value for each integration, + where as this function returns a cumulative value for every spacing within the integration. This + is analogous to how `.sum` returns a value and `.cumsum` returns a cumulative sum. + + Arguments: + y (Tensor): Values to use when computing the trapezoidal rule. + x (Tensor): If specified, defines spacing between values as specified above. + + Keyword arguments: + dx (float): constant spacing between values. If neither :attr:`x` or :attr:`dx` + are specified then this defaults to 1. Effectively multiplies the result by its value. + dim (int): The dimension along which to compute the trapezoidal rule. + The last (inner-most) dimension by default. + + Examples:: + + >>> # Cumulatively computes the trapezoidal rule in 1D, spacing is implicitly 1. + >>> y = torch.tensor([1, 5, 10]) + >>> torch.cumulative_trapezoid(y) + tensor([3., 10.5]) + + >>> # Computes the same trapezoidal rule directly up to each element to verify + >>> (1 + 5) / 2 + 3.0 + >>> (1 + 10 + 10) / 2 + 10.5 + + >>> # Cumulatively computes the trapezoidal rule in 1D with constant spacing of 2 + >>> # NOTE: the result is the same as before, but multiplied by 2 + >>> torch.cumulative_trapezoid(y, dx=2) + tensor([6., 21.]) + + >>> # Cumulatively computes the trapezoidal rule in 1D with arbitrary spacing + >>> x = torch.tensor([1, 3, 6]) + >>> torch.cumulative_trapezoid(y, x) + tensor([6., 28.5]) + + >>> # Computes the same trapezoidal rule directly up to each element to verify + >>> ((3 - 1) * (1 + 5)) / 2 + 6.0 + >>> ((3 - 1) * (1 + 5) + (6 - 3) * (5 + 10)) / 2 + 28.5 + + >>> # Cumulatively computes the trapezoidal rule for each row of a 3x3 matrix + >>> y = torch.arange(9).reshape(3, 3) + tensor([[0, 1, 2], + [3, 4, 5], + [6, 7, 8]]) + >>> torch.cumulative_trapezoid(y) + tensor([[ 0.5, 2.], + [ 3.5, 8.], + [ 6.5, 14.]]) + + >>> # Cumulatively computes the trapezoidal rule for each column of the matrix + >>> torch.cumulative_trapezoid(y, dim=0) + tensor([[ 1.5, 2.5, 3.5], + [ 6.0, 8.0, 10.0]]) + + >>> # Cumulatively computes the trapezoidal rule for each row of a 3x3 ones matrix + >>> # with the same arbitrary spacing + >>> y = torch.ones(3, 3) + >>> x = torch.tensor([1, 3, 6]) + >>> torch.cumulative_trapezoid(y, x) + tensor([[2., 5.], + [2., 5.], + [2., 5.]]) + + >>> # Cumulatively computes the trapezoidal rule for each row of a 3x3 ones matrix + >>> # with different arbitrary spacing per row + >>> y = torch.ones(3, 3) + >>> x = torch.tensor([[1, 2, 3], [1, 3, 5], [1, 4, 7]]) + >>> torch.cumulative_trapezoid(y, x) + tensor([[1., 2.], + [2., 4.], + [3., 6.]]) + """ + +def deg2rad(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + deg2rad(input, *, out=None) -> Tensor + + Returns a new tensor with each of the elements of :attr:`input` + converted from angles in degrees to radians. + + Args: + input (Tensor): the input tensor. + + Keyword arguments: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([[180.0, -180.0], [360.0, -360.0], [90.0, -90.0]]) + >>> torch.deg2rad(a) + tensor([[ 3.1416, -3.1416], + [ 6.2832, -6.2832], + [ 1.5708, -1.5708]]) + """ + +def deg2rad_(input: Tensor) -> Tensor: ... +@overload +def dequantize(input: Tensor) -> Tensor: + r""" + dequantize(tensor) -> Tensor + + Returns an fp32 Tensor by dequantizing a quantized Tensor + + Args: + tensor (Tensor): A quantized Tensor + + .. function:: dequantize(tensors) -> sequence of Tensors + :noindex: + + Given a list of quantized Tensors, dequantize them and return a list of fp32 Tensors + + Args: + tensors (sequence of Tensors): A list of quantized Tensors + """ + +@overload +def dequantize( + tensors: tuple[Tensor, ...] | list[Tensor] | None, +) -> tuple[Tensor, ...]: + r""" + dequantize(tensor) -> Tensor + + Returns an fp32 Tensor by dequantizing a quantized Tensor + + Args: + tensor (Tensor): A quantized Tensor + + .. function:: dequantize(tensors) -> sequence of Tensors + :noindex: + + Given a list of quantized Tensors, dequantize them and return a list of fp32 Tensors + + Args: + tensors (sequence of Tensors): A list of quantized Tensors + """ + +def det(input: Tensor) -> Tensor: + r""" + det(input) -> Tensor + + Alias for :func:`torch.linalg.det` + """ + +def detach(input: Tensor) -> Tensor: ... +def detach_(input: Tensor) -> Tensor: ... +def detach_copy(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + Performs the same operation as :func:`torch.detach`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def diag( + input: Tensor, + diagonal: _int = 0, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + diag(input, diagonal=0, *, out=None) -> Tensor + + - If :attr:`input` is a vector (1-D tensor), then returns a 2-D square tensor + with the elements of :attr:`input` as the diagonal. + - If :attr:`input` is a matrix (2-D tensor), then returns a 1-D tensor with + the diagonal elements of :attr:`input`. + + The argument :attr:`diagonal` controls which diagonal to consider: + + - If :attr:`diagonal` = 0, it is the main diagonal. + - If :attr:`diagonal` > 0, it is above the main diagonal. + - If :attr:`diagonal` < 0, it is below the main diagonal. + + Args: + input (Tensor): the input tensor. + diagonal (int, optional): the diagonal to consider + + Keyword args: + out (Tensor, optional): the output tensor. + + .. seealso:: + + :func:`torch.diagonal` always returns the diagonal of its input. + + :func:`torch.diagflat` always constructs a tensor with diagonal elements + specified by the input. + + Examples: + + Get the square matrix where the input vector is the diagonal:: + + >>> a = torch.randn(3) + >>> a + tensor([ 0.5950,-0.0872, 2.3298]) + >>> torch.diag(a) + tensor([[ 0.5950, 0.0000, 0.0000], + [ 0.0000,-0.0872, 0.0000], + [ 0.0000, 0.0000, 2.3298]]) + >>> torch.diag(a, 1) + tensor([[ 0.0000, 0.5950, 0.0000, 0.0000], + [ 0.0000, 0.0000,-0.0872, 0.0000], + [ 0.0000, 0.0000, 0.0000, 2.3298], + [ 0.0000, 0.0000, 0.0000, 0.0000]]) + + Get the k-th diagonal of a given matrix:: + + >>> a = torch.randn(3, 3) + >>> a + tensor([[-0.4264, 0.0255,-0.1064], + [ 0.8795,-0.2429, 0.1374], + [ 0.1029,-0.6482,-1.6300]]) + >>> torch.diag(a, 0) + tensor([-0.4264,-0.2429,-1.6300]) + >>> torch.diag(a, 1) + tensor([ 0.0255, 0.1374]) + """ + +def diag_embed( + input: Tensor, + offset: _int = 0, + dim1: _int = -2, + dim2: _int = -1, +) -> Tensor: + r""" + diag_embed(input, offset=0, dim1=-2, dim2=-1) -> Tensor + + Creates a tensor whose diagonals of certain 2D planes (specified by + :attr:`dim1` and :attr:`dim2`) are filled by :attr:`input`. + To facilitate creating batched diagonal matrices, the 2D planes formed by + the last two dimensions of the returned tensor are chosen by default. + + The argument :attr:`offset` controls which diagonal to consider: + + - If :attr:`offset` = 0, it is the main diagonal. + - If :attr:`offset` > 0, it is above the main diagonal. + - If :attr:`offset` < 0, it is below the main diagonal. + + The size of the new matrix will be calculated to make the specified diagonal + of the size of the last input dimension. + Note that for :attr:`offset` other than :math:`0`, the order of :attr:`dim1` + and :attr:`dim2` matters. Exchanging them is equivalent to changing the + sign of :attr:`offset`. + + Applying :meth:`torch.diagonal` to the output of this function with + the same arguments yields a matrix identical to input. However, + :meth:`torch.diagonal` has different default dimensions, so those + need to be explicitly specified. + + Args: + input (Tensor): the input tensor. Must be at least 1-dimensional. + offset (int, optional): which diagonal to consider. Default: 0 + (main diagonal). + dim1 (int, optional): first dimension with respect to which to + take diagonal. Default: -2. + dim2 (int, optional): second dimension with respect to which to + take diagonal. Default: -1. + + Example:: + + >>> a = torch.randn(2, 3) + >>> torch.diag_embed(a) + tensor([[[ 1.5410, 0.0000, 0.0000], + [ 0.0000, -0.2934, 0.0000], + [ 0.0000, 0.0000, -2.1788]], + + [[ 0.5684, 0.0000, 0.0000], + [ 0.0000, -1.0845, 0.0000], + [ 0.0000, 0.0000, -1.3986]]]) + + >>> torch.diag_embed(a, offset=1, dim1=0, dim2=2) + tensor([[[ 0.0000, 1.5410, 0.0000, 0.0000], + [ 0.0000, 0.5684, 0.0000, 0.0000]], + + [[ 0.0000, 0.0000, -0.2934, 0.0000], + [ 0.0000, 0.0000, -1.0845, 0.0000]], + + [[ 0.0000, 0.0000, 0.0000, -2.1788], + [ 0.0000, 0.0000, 0.0000, -1.3986]], + + [[ 0.0000, 0.0000, 0.0000, 0.0000], + [ 0.0000, 0.0000, 0.0000, 0.0000]]]) + """ + +def diagflat(input: Tensor, offset: _int = 0) -> Tensor: + r""" + diagflat(input, offset=0) -> Tensor + + - If :attr:`input` is a vector (1-D tensor), then returns a 2-D square tensor + with the elements of :attr:`input` as the diagonal. + - If :attr:`input` is a tensor with more than one dimension, then returns a + 2-D tensor with diagonal elements equal to a flattened :attr:`input`. + + The argument :attr:`offset` controls which diagonal to consider: + + - If :attr:`offset` = 0, it is the main diagonal. + - If :attr:`offset` > 0, it is above the main diagonal. + - If :attr:`offset` < 0, it is below the main diagonal. + + Args: + input (Tensor): the input tensor. + offset (int, optional): the diagonal to consider. Default: 0 (main + diagonal). + + Examples:: + + >>> a = torch.randn(3) + >>> a + tensor([-0.2956, -0.9068, 0.1695]) + >>> torch.diagflat(a) + tensor([[-0.2956, 0.0000, 0.0000], + [ 0.0000, -0.9068, 0.0000], + [ 0.0000, 0.0000, 0.1695]]) + >>> torch.diagflat(a, 1) + tensor([[ 0.0000, -0.2956, 0.0000, 0.0000], + [ 0.0000, 0.0000, -0.9068, 0.0000], + [ 0.0000, 0.0000, 0.0000, 0.1695], + [ 0.0000, 0.0000, 0.0000, 0.0000]]) + + >>> a = torch.randn(2, 2) + >>> a + tensor([[ 0.2094, -0.3018], + [-0.1516, 1.9342]]) + >>> torch.diagflat(a) + tensor([[ 0.2094, 0.0000, 0.0000, 0.0000], + [ 0.0000, -0.3018, 0.0000, 0.0000], + [ 0.0000, 0.0000, -0.1516, 0.0000], + [ 0.0000, 0.0000, 0.0000, 1.9342]]) + """ + +@overload +def diagonal( + input: Tensor, + offset: _int = 0, + dim1: _int = 0, + dim2: _int = 1, +) -> Tensor: + r""" + diagonal(input, offset=0, dim1=0, dim2=1) -> Tensor + + Returns a partial view of :attr:`input` with the its diagonal elements + with respect to :attr:`dim1` and :attr:`dim2` appended as a dimension + at the end of the shape. + + The argument :attr:`offset` controls which diagonal to consider: + + - If :attr:`offset` = 0, it is the main diagonal. + - If :attr:`offset` > 0, it is above the main diagonal. + - If :attr:`offset` < 0, it is below the main diagonal. + + Applying :meth:`torch.diag_embed` to the output of this function with + the same arguments yields a diagonal matrix with the diagonal entries + of the input. However, :meth:`torch.diag_embed` has different default + dimensions, so those need to be explicitly specified. + + Args: + input (Tensor): the input tensor. Must be at least 2-dimensional. + offset (int, optional): which diagonal to consider. Default: 0 + (main diagonal). + dim1 (int, optional): first dimension with respect to which to + take diagonal. Default: 0. + dim2 (int, optional): second dimension with respect to which to + take diagonal. Default: 1. + + .. note:: To take a batch diagonal, pass in dim1=-2, dim2=-1. + + Examples:: + + >>> a = torch.randn(3, 3) + >>> a + tensor([[-1.0854, 1.1431, -0.1752], + [ 0.8536, -0.0905, 0.0360], + [ 0.6927, -0.3735, -0.4945]]) + + + >>> torch.diagonal(a) + tensor([-1.0854, -0.0905, -0.4945]) + + + >>> torch.diagonal(a, 1) + tensor([ 1.1431, 0.0360]) + + >>> b = torch.randn(2, 5) + >>> b + tensor([[-1.7948, -1.2731, -0.3181, 2.0200, -1.6745], + [ 1.8262, -1.5049, 0.4114, 1.0704, -1.2607]]) + + >>> torch.diagonal(b, 1, 1, 0) + tensor([1.8262]) + + >>> x = torch.randn(2, 5, 4, 2) + >>> torch.diagonal(x, offset=-1, dim1=1, dim2=2) + tensor([[[-1.2631, 0.3755, -1.5977, -1.8172], + [-1.1065, 1.0401, -0.2235, -0.7938]], + + [[-1.7325, -0.3081, 0.6166, 0.2335], + [ 1.0500, 0.7336, -0.3836, -1.1015]]]) + """ + +@overload +def diagonal( + input: Tensor, + *, + outdim: str | EllipsisType | None, + dim1: str | EllipsisType | None, + dim2: str | EllipsisType | None, + offset: _int = 0, +) -> Tensor: + r""" + diagonal(input, offset=0, dim1=0, dim2=1) -> Tensor + + Returns a partial view of :attr:`input` with the its diagonal elements + with respect to :attr:`dim1` and :attr:`dim2` appended as a dimension + at the end of the shape. + + The argument :attr:`offset` controls which diagonal to consider: + + - If :attr:`offset` = 0, it is the main diagonal. + - If :attr:`offset` > 0, it is above the main diagonal. + - If :attr:`offset` < 0, it is below the main diagonal. + + Applying :meth:`torch.diag_embed` to the output of this function with + the same arguments yields a diagonal matrix with the diagonal entries + of the input. However, :meth:`torch.diag_embed` has different default + dimensions, so those need to be explicitly specified. + + Args: + input (Tensor): the input tensor. Must be at least 2-dimensional. + offset (int, optional): which diagonal to consider. Default: 0 + (main diagonal). + dim1 (int, optional): first dimension with respect to which to + take diagonal. Default: 0. + dim2 (int, optional): second dimension with respect to which to + take diagonal. Default: 1. + + .. note:: To take a batch diagonal, pass in dim1=-2, dim2=-1. + + Examples:: + + >>> a = torch.randn(3, 3) + >>> a + tensor([[-1.0854, 1.1431, -0.1752], + [ 0.8536, -0.0905, 0.0360], + [ 0.6927, -0.3735, -0.4945]]) + + + >>> torch.diagonal(a) + tensor([-1.0854, -0.0905, -0.4945]) + + + >>> torch.diagonal(a, 1) + tensor([ 1.1431, 0.0360]) + + >>> b = torch.randn(2, 5) + >>> b + tensor([[-1.7948, -1.2731, -0.3181, 2.0200, -1.6745], + [ 1.8262, -1.5049, 0.4114, 1.0704, -1.2607]]) + + >>> torch.diagonal(b, 1, 1, 0) + tensor([1.8262]) + + >>> x = torch.randn(2, 5, 4, 2) + >>> torch.diagonal(x, offset=-1, dim1=1, dim2=2) + tensor([[[-1.2631, 0.3755, -1.5977, -1.8172], + [-1.1065, 1.0401, -0.2235, -0.7938]], + + [[-1.7325, -0.3081, 0.6166, 0.2335], + [ 1.0500, 0.7336, -0.3836, -1.1015]]]) + """ + +def diagonal_copy( + input: Tensor, + offset: _int = 0, + dim1: _int = 0, + dim2: _int = 1, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.diagonal`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def diagonal_scatter( + input: Tensor, + src: Tensor, + offset: _int = 0, + dim1: _int = 0, + dim2: _int = 1, +) -> Tensor: + r""" + diagonal_scatter(input, src, offset=0, dim1=0, dim2=1) -> Tensor + + Embeds the values of the :attr:`src` tensor into :attr:`input` along + the diagonal elements of :attr:`input`, with respect to :attr:`dim1` + and :attr:`dim2`. + + This function returns a tensor with fresh storage; it does not + return a view. + + The argument :attr:`offset` controls which diagonal to consider: + + - If :attr:`offset` = 0, it is the main diagonal. + - If :attr:`offset` > 0, it is above the main diagonal. + - If :attr:`offset` < 0, it is below the main diagonal. + + Args: + input (Tensor): the input tensor. Must be at least 2-dimensional. + src (Tensor): the tensor to embed into :attr:`input`. + offset (int, optional): which diagonal to consider. Default: 0 + (main diagonal). + dim1 (int, optional): first dimension with respect to which to + take diagonal. Default: 0. + dim2 (int, optional): second dimension with respect to which to + take diagonal. Default: 1. + + .. note:: + + :attr:`src` must be of the proper size in order to be embedded + into :attr:`input`. Specifically, it should have the same shape as + ``torch.diagonal(input, offset, dim1, dim2)`` + + Examples:: + + >>> a = torch.zeros(3, 3) + >>> a + tensor([[0., 0., 0.], + [0., 0., 0.], + [0., 0., 0.]]) + + >>> torch.diagonal_scatter(a, torch.ones(3), 0) + tensor([[1., 0., 0.], + [0., 1., 0.], + [0., 0., 1.]]) + + >>> torch.diagonal_scatter(a, torch.ones(2), 1) + tensor([[0., 1., 0.], + [0., 0., 1.], + [0., 0., 0.]]) + """ + +def diff( + input: Tensor, + n: _int = 1, + dim: _int = -1, + prepend: Tensor | None = None, + append: Tensor | None = None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + diff(input, n=1, dim=-1, prepend=None, append=None) -> Tensor + + Computes the n-th forward difference along the given dimension. + + The first-order differences are given by `out[i] = input[i + 1] - input[i]`. Higher-order + differences are calculated by using :func:`torch.diff` recursively. + + Args: + input (Tensor): the tensor to compute the differences on + n (int, optional): the number of times to recursively compute the difference + dim (int, optional): the dimension to compute the difference along. + Default is the last dimension. + prepend, append (Tensor, optional): values to prepend or append to + :attr:`input` along :attr:`dim` before computing the difference. + Their dimensions must be equivalent to that of input, and their shapes + must match input's shape except on :attr:`dim`. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([1, 3, 2]) + >>> torch.diff(a) + tensor([ 2, -1]) + >>> b = torch.tensor([4, 5]) + >>> torch.diff(a, append=b) + tensor([ 2, -1, 2, 1]) + >>> c = torch.tensor([[1, 2, 3], [3, 4, 5]]) + >>> torch.diff(c, dim=0) + tensor([[2, 2, 2]]) + >>> torch.diff(c, dim=1) + tensor([[1, 1], + [1, 1]]) + """ + +def digamma(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + digamma(input, *, out=None) -> Tensor + + Alias for :func:`torch.special.digamma`. + """ + +def dist(input: Tensor, other: Tensor, p: Number | _complex = 2) -> Tensor: + r""" + dist(input, other, p=2) -> Tensor + + Returns the p-norm of (:attr:`input` - :attr:`other`) + + The shapes of :attr:`input` and :attr:`other` must be + :ref:`broadcastable `. + + Args: + input (Tensor): the input tensor. + other (Tensor): the Right-hand-side input tensor + p (float, optional): the norm to be computed + + Example:: + + >>> x = torch.randn(4) + >>> x + tensor([-1.5393, -0.8675, 0.5916, 1.6321]) + >>> y = torch.randn(4) + >>> y + tensor([ 0.0967, -1.0511, 0.6295, 0.8360]) + >>> torch.dist(x, y, 3.5) + tensor(1.6727) + >>> torch.dist(x, y, 3) + tensor(1.6973) + >>> torch.dist(x, y, 0) + tensor(4.) + >>> torch.dist(x, y, 1) + tensor(2.6537) + """ + +def div( + input: Tensor | Number, + other: Tensor | Number, + *, + rounding_mode: str | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + div(input, other, *, rounding_mode=None, out=None) -> Tensor + + Divides each element of the input ``input`` by the corresponding element of + :attr:`other`. + + .. math:: + \text{out}_i = \frac{\text{input}_i}{\text{other}_i} + + .. note:: + By default, this performs a "true" division like Python 3. + See the :attr:`rounding_mode` argument for floor division. + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer, float, and complex inputs. + Always promotes integer types to the default scalar type. + + Args: + input (Tensor): the dividend + other (Tensor or Number): the divisor + + Keyword args: + rounding_mode (str, optional): Type of rounding applied to the result: + + * None - default behavior. Performs no rounding and, if both :attr:`input` and + :attr:`other` are integer types, promotes the inputs to the default scalar type. + Equivalent to true division in Python (the ``/`` operator) and NumPy's ``np.true_divide``. + * ``"trunc"`` - rounds the results of the division towards zero. + Equivalent to C-style integer division. + * ``"floor"`` - rounds the results of the division down. + Equivalent to floor division in Python (the ``//`` operator) and NumPy's ``np.floor_divide``. + + out (Tensor, optional): the output tensor. + + Examples:: + + >>> x = torch.tensor([ 0.3810, 1.2774, -0.2972, -0.3719, 0.4637]) + >>> torch.div(x, 0.5) + tensor([ 0.7620, 2.5548, -0.5944, -0.7438, 0.9274]) + + >>> a = torch.tensor([[-0.3711, -1.9353, -0.4605, -0.2917], + ... [ 0.1815, -1.0111, 0.9805, -1.5923], + ... [ 0.1062, 1.4581, 0.7759, -1.2344], + ... [-0.1830, -0.0313, 1.1908, -1.4757]]) + >>> b = torch.tensor([ 0.8032, 0.2930, -0.8113, -0.2308]) + >>> torch.div(a, b) + tensor([[-0.4620, -6.6051, 0.5676, 1.2639], + [ 0.2260, -3.4509, -1.2086, 6.8990], + [ 0.1322, 4.9764, -0.9564, 5.3484], + [-0.2278, -0.1068, -1.4678, 6.3938]]) + + >>> torch.div(a, b, rounding_mode='trunc') + tensor([[-0., -6., 0., 1.], + [ 0., -3., -1., 6.], + [ 0., 4., -0., 5.], + [-0., -0., -1., 6.]]) + + >>> torch.div(a, b, rounding_mode='floor') + tensor([[-1., -7., 0., 1.], + [ 0., -4., -2., 6.], + [ 0., 4., -1., 5.], + [-1., -1., -2., 6.]]) + """ + +@overload +def divide( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + divide(input, other, *, rounding_mode=None, out=None) -> Tensor + + Alias for :func:`torch.div`. + """ + +@overload +def divide( + input: Tensor, + other: Tensor, + *, + rounding_mode: str | None, + out: Tensor | None = None, +) -> Tensor: + r""" + divide(input, other, *, rounding_mode=None, out=None) -> Tensor + + Alias for :func:`torch.div`. + """ + +@overload +def divide( + input: Tensor, + other: Number | _complex, + *, + rounding_mode: str | None, +) -> Tensor: + r""" + divide(input, other, *, rounding_mode=None, out=None) -> Tensor + + Alias for :func:`torch.div`. + """ + +@overload +def divide(input: Tensor, other: Number | _complex) -> Tensor: + r""" + divide(input, other, *, rounding_mode=None, out=None) -> Tensor + + Alias for :func:`torch.div`. + """ + +def dot( + input: Tensor, + tensor: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + dot(input, tensor, *, out=None) -> Tensor + + Computes the dot product of two 1D tensors. + + .. note:: + + Unlike NumPy's dot, torch.dot intentionally only supports computing the dot product + of two 1D tensors with the same number of elements. + + Args: + input (Tensor): first tensor in the dot product, must be 1D. + tensor (Tensor): second tensor in the dot product, must be 1D. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.dot(torch.tensor([2, 3]), torch.tensor([2, 1])) + tensor(7) + + >>> t1, t2 = torch.tensor([0, 1]), torch.tensor([2, 3]) + >>> torch.dot(t1, t2) + tensor(3) + """ + +def dropout(input: Tensor, p: _float, train: _bool) -> Tensor: ... +def dropout_(input: Tensor, p: _float, train: _bool) -> Tensor: ... +def dsmm(input: Tensor, mat2: Tensor) -> Tensor: ... +@overload +def dsplit(input: Tensor, sections: _int) -> tuple[Tensor, ...]: + r""" + dsplit(input, indices_or_sections) -> List of Tensors + + Splits :attr:`input`, a tensor with three or more dimensions, into multiple tensors + depthwise according to :attr:`indices_or_sections`. Each split is a view of + :attr:`input`. + + This is equivalent to calling torch.tensor_split(input, indices_or_sections, dim=2) + (the split dimension is 2), except that if :attr:`indices_or_sections` is an integer + it must evenly divide the split dimension or a runtime error will be thrown. + + This function is based on NumPy's :func:`numpy.dsplit`. + + Args: + input (Tensor): tensor to split. + indices_or_sections (int or list or tuple of ints): See argument in :func:`torch.tensor_split`. + + Example:: + + >>> t = torch.arange(16.0).reshape(2, 2, 4) + >>> t + tensor([[[ 0., 1., 2., 3.], + [ 4., 5., 6., 7.]], + [[ 8., 9., 10., 11.], + [12., 13., 14., 15.]]]) + >>> torch.dsplit(t, 2) + (tensor([[[ 0., 1.], + [ 4., 5.]], + [[ 8., 9.], + [12., 13.]]]), + tensor([[[ 2., 3.], + [ 6., 7.]], + [[10., 11.], + [14., 15.]]])) + + >>> torch.dsplit(t, [3, 6]) + (tensor([[[ 0., 1., 2.], + [ 4., 5., 6.]], + [[ 8., 9., 10.], + [12., 13., 14.]]]), + tensor([[[ 3.], + [ 7.]], + [[11.], + [15.]]]), + tensor([], size=(2, 2, 0))) + """ + +@overload +def dsplit(input: Tensor, indices: _size) -> tuple[Tensor, ...]: + r""" + dsplit(input, indices_or_sections) -> List of Tensors + + Splits :attr:`input`, a tensor with three or more dimensions, into multiple tensors + depthwise according to :attr:`indices_or_sections`. Each split is a view of + :attr:`input`. + + This is equivalent to calling torch.tensor_split(input, indices_or_sections, dim=2) + (the split dimension is 2), except that if :attr:`indices_or_sections` is an integer + it must evenly divide the split dimension or a runtime error will be thrown. + + This function is based on NumPy's :func:`numpy.dsplit`. + + Args: + input (Tensor): tensor to split. + indices_or_sections (int or list or tuple of ints): See argument in :func:`torch.tensor_split`. + + Example:: + + >>> t = torch.arange(16.0).reshape(2, 2, 4) + >>> t + tensor([[[ 0., 1., 2., 3.], + [ 4., 5., 6., 7.]], + [[ 8., 9., 10., 11.], + [12., 13., 14., 15.]]]) + >>> torch.dsplit(t, 2) + (tensor([[[ 0., 1.], + [ 4., 5.]], + [[ 8., 9.], + [12., 13.]]]), + tensor([[[ 2., 3.], + [ 6., 7.]], + [[10., 11.], + [14., 15.]]])) + + >>> torch.dsplit(t, [3, 6]) + (tensor([[[ 0., 1., 2.], + [ 4., 5., 6.]], + [[ 8., 9., 10.], + [12., 13., 14.]]]), + tensor([[[ 3.], + [ 7.]], + [[11.], + [15.]]]), + tensor([], size=(2, 2, 0))) + """ + +def dstack( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + dstack(tensors, *, out=None) -> Tensor + + Stack tensors in sequence depthwise (along third axis). + + This is equivalent to concatenation along the third axis after 1-D and 2-D tensors have been reshaped by :func:`torch.atleast_3d`. + + Args: + tensors (sequence of Tensors): sequence of tensors to concatenate + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([1, 2, 3]) + >>> b = torch.tensor([4, 5, 6]) + >>> torch.dstack((a,b)) + tensor([[[1, 4], + [2, 5], + [3, 6]]]) + >>> a = torch.tensor([[1],[2],[3]]) + >>> b = torch.tensor([[4],[5],[6]]) + >>> torch.dstack((a,b)) + tensor([[[1, 4]], + [[2, 5]], + [[3, 6]]]) + """ + +def embedding( + weight: Tensor, + indices: Tensor, + padding_idx: _int | SymInt = -1, + scale_grad_by_freq: _bool = False, + sparse: _bool = False, +) -> Tensor: ... +@overload +def embedding_bag( + weight: Tensor, + indices: Tensor, + offsets: Tensor, + scale_grad_by_freq: _bool, + mode: _int, + sparse: _bool, + per_sample_weights: Tensor | None, + include_last_offset: _bool, + padding_idx: _int | None, +) -> tuple[Tensor, Tensor, Tensor, Tensor]: ... +@overload +def embedding_bag( + weight: Tensor, + indices: Tensor, + offsets: Tensor, + scale_grad_by_freq: _bool = False, + mode: _int = 0, + sparse: _bool = False, + per_sample_weights: Tensor | None = None, + include_last_offset: _bool = False, +) -> tuple[Tensor, Tensor, Tensor, Tensor]: ... +def embedding_renorm_( + input: Tensor, + indices: Tensor, + max_norm: _float, + norm_type: _float, +) -> Tensor: ... +@overload +def empty( + size: Sequence[_int | SymInt], + *, + memory_format: memory_format | None = None, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + empty(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False, memory_format=torch.contiguous_format) -> Tensor + + Returns a tensor filled with uninitialized data. The shape of the tensor is + defined by the variable argument :attr:`size`. + + .. note:: + If :func:`torch.use_deterministic_algorithms()` and + :attr:`torch.utils.deterministic.fill_uninitialized_memory` are both set to + ``True``, the output tensor is initialized to prevent any possible + nondeterministic behavior from using the data as an input to an operation. + Floating point and complex tensors are filled with NaN, and integer tensors + are filled with the maximum value. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.contiguous_format``. + + Example:: + + >>> torch.empty((2,3), dtype=torch.int64) + tensor([[ 9.4064e+13, 2.8000e+01, 9.3493e+13], + [ 7.5751e+18, 7.1428e+18, 7.5955e+18]]) + """ + +@overload +def empty( + *size: _int | SymInt, + memory_format: memory_format | None = None, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + empty(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False, memory_format=torch.contiguous_format) -> Tensor + + Returns a tensor filled with uninitialized data. The shape of the tensor is + defined by the variable argument :attr:`size`. + + .. note:: + If :func:`torch.use_deterministic_algorithms()` and + :attr:`torch.utils.deterministic.fill_uninitialized_memory` are both set to + ``True``, the output tensor is initialized to prevent any possible + nondeterministic behavior from using the data as an input to an operation. + Floating point and complex tensors are filled with NaN, and integer tensors + are filled with the maximum value. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.contiguous_format``. + + Example:: + + >>> torch.empty((2,3), dtype=torch.int64) + tensor([[ 9.4064e+13, 2.8000e+01, 9.3493e+13], + [ 7.5751e+18, 7.1428e+18, 7.5955e+18]]) + """ + +@overload +def empty( + size: _size, + *, + names: Sequence[str | EllipsisType | None] | None, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + empty(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False, memory_format=torch.contiguous_format) -> Tensor + + Returns a tensor filled with uninitialized data. The shape of the tensor is + defined by the variable argument :attr:`size`. + + .. note:: + If :func:`torch.use_deterministic_algorithms()` and + :attr:`torch.utils.deterministic.fill_uninitialized_memory` are both set to + ``True``, the output tensor is initialized to prevent any possible + nondeterministic behavior from using the data as an input to an operation. + Floating point and complex tensors are filled with NaN, and integer tensors + are filled with the maximum value. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.contiguous_format``. + + Example:: + + >>> torch.empty((2,3), dtype=torch.int64) + tensor([[ 9.4064e+13, 2.8000e+01, 9.3493e+13], + [ 7.5751e+18, 7.1428e+18, 7.5955e+18]]) + """ + +@overload +def empty( + *size: _int, + names: Sequence[str | EllipsisType | None] | None, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + empty(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False, memory_format=torch.contiguous_format) -> Tensor + + Returns a tensor filled with uninitialized data. The shape of the tensor is + defined by the variable argument :attr:`size`. + + .. note:: + If :func:`torch.use_deterministic_algorithms()` and + :attr:`torch.utils.deterministic.fill_uninitialized_memory` are both set to + ``True``, the output tensor is initialized to prevent any possible + nondeterministic behavior from using the data as an input to an operation. + Floating point and complex tensors are filled with NaN, and integer tensors + are filled with the maximum value. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.contiguous_format``. + + Example:: + + >>> torch.empty((2,3), dtype=torch.int64) + tensor([[ 9.4064e+13, 2.8000e+01, 9.3493e+13], + [ 7.5751e+18, 7.1428e+18, 7.5955e+18]]) + """ + +def empty_like( + input: Tensor, + *, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + empty_like(input, *, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns an uninitialized tensor with the same size as :attr:`input`. + ``torch.empty_like(input)`` is equivalent to + ``torch.empty(input.size(), dtype=input.dtype, layout=input.layout, device=input.device)``. + + .. note:: + If :func:`torch.use_deterministic_algorithms()` and + :attr:`torch.utils.deterministic.fill_uninitialized_memory` are both set to + ``True``, the output tensor is initialized to prevent any possible + nondeterministic behavior from using the data as an input to an operation. + Floating point and complex tensors are filled with NaN, and integer tensors + are filled with the maximum value. + + When ``torch.preserve_format`` is used: + If the input tensor is dense (i.e., non-overlapping strided), + its memory format (including strides) is retained. + Otherwise (e.g., a non-dense view like a stepped slice), + the output is converted to the dense format. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + + Example:: + + >>> a=torch.empty((2,3), dtype=torch.int32, device = 'cuda') + >>> torch.empty_like(a) + tensor([[0, 0, 0], + [0, 0, 0]], device='cuda:0', dtype=torch.int32) + """ + +def empty_permuted( + size: Sequence[_int | SymInt], + physical_layout: _size, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + empty_permuted(size, physical_layout, *, dtype=None, layout=None, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Creates an uninitialized, non-overlapping and dense tensor with the + specified :attr:`size`, with :attr:`physical_layout` specifying how the + dimensions are physically laid out in memory (each logical dimension is listed + from outermost to innermost). :attr:`physical_layout` is a generalization + of NCHW/NHWC notation: if each dimension is assigned a number according to + what order they occur in size (N=0, C=1, H=2, W=3), then NCHW is ``(0, 1, 2, 3)`` + while NHWC is ``(0, 2, 3, 1)``. Equivalently, the strides of the output + tensor ``t`` are such that ``t.stride(physical_layout[i]) == contiguous_strides[i]`` + (notably, this function is *not* equivalent to ``torch.empty(size).permute(physical_layout)``). + + Unlike :func:`torch.empty_strided`, this is guaranteed to produce a dense + tensor with no overlaps. If possible, prefer using this function over + :func:`torch.empty_strided` or manual use of :func:`torch.as_strided`. + + .. note:: + If :func:`torch.use_deterministic_algorithms()` and + :attr:`torch.utils.deterministic.fill_uninitialized_memory` are both set to + ``True``, the output tensor is initialized to prevent any possible + nondeterministic behavior from using the data as an input to an operation. + Floating point and complex tensors are filled with NaN, and integer tensors + are filled with the maximum value. + + Args: + size (tuple of int): the shape of the output tensor + physical_layout (tuple of int): the ordering of dimensions physically in memory + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Examples: + + >>> torch.empty((2, 3, 5, 7)).stride() + (105, 35, 7, 1) + >>> torch.empty_permuted((2, 3, 5, 7), (0, 1, 2, 3)).stride() + (105, 35, 7, 1) + >>> torch.empty((2, 3, 5, 7), memory_format=torch.channels_last).stride() + (105, 1, 21, 3) + >>> torch.empty_permuted((2, 3, 5, 7), (0, 2, 3, 1)).stride() + (105, 1, 21, 3) + >>> torch.empty_permuted((2, 3, 5, 7), (0, 2, 3, 1)).dim_order() + (0, 2, 3, 1) + """ + +def empty_quantized( + size: _size, + qtensor: Tensor, + *, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: ... +def empty_strided( + size: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + empty_strided(size, stride, *, dtype=None, layout=None, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Creates a tensor with the specified :attr:`size` and :attr:`stride` and filled with undefined data. + + .. warning:: + If the constructed tensor is "overlapped" (with multiple indices referring to the same element + in memory) its behavior is undefined. + + .. note:: + If :func:`torch.use_deterministic_algorithms()` and + :attr:`torch.utils.deterministic.fill_uninitialized_memory` are both set to + ``True``, the output tensor is initialized to prevent any possible + nondeterministic behavior from using the data as an input to an operation. + Floating point and complex tensors are filled with NaN, and integer tensors + are filled with the maximum value. + + Args: + size (tuple of int): the shape of the output tensor + stride (tuple of int): the strides of the output tensor + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> a = torch.empty_strided((2, 3), (1, 2)) + >>> a + tensor([[8.9683e-44, 4.4842e-44, 5.1239e+07], + [0.0000e+00, 0.0000e+00, 3.0705e-41]]) + >>> a.stride() + (1, 2) + >>> a.size() + torch.Size([2, 3]) + """ + +@overload +def eq( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + eq(input, other, *, out=None) -> Tensor + + Computes element-wise equality + + The second argument can be a number or a tensor whose shape is + :ref:`broadcastable ` with the first argument. + + Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is equal to :attr:`other` and False elsewhere + + Example:: + + >>> torch.eq(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[ True, False], + [False, True]]) + """ + +@overload +def eq( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + eq(input, other, *, out=None) -> Tensor + + Computes element-wise equality + + The second argument can be a number or a tensor whose shape is + :ref:`broadcastable ` with the first argument. + + Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is equal to :attr:`other` and False elsewhere + + Example:: + + >>> torch.eq(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[ True, False], + [False, True]]) + """ + +def equal(input: Tensor, other: Tensor) -> _bool: + r""" + equal(input, other) -> bool + + ``True`` if two tensors have the same size and elements, ``False`` otherwise. + + .. note:: + + Tensors containing NaNs are never equal to each other. Additionally, this function does not + differentiate between the data types of the tensors during comparison. For more thorough tensor checks, + use :meth:`torch.testing.assert_close`. + + Example:: + + >>> torch.equal(torch.tensor([1, 2]), torch.tensor([1, 2])) + True + >>> torch.equal(torch.tensor([3, torch.nan]), torch.tensor([3, torch.nan])) + False + >>> torch.equal(torch.tensor([1, 2, 3], dtype=torch.int32), torch.tensor([1, 2, 3], dtype=torch.float32)) + True + """ + +def erf(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + erf(input, *, out=None) -> Tensor + + Alias for :func:`torch.special.erf`. + """ + +def erf_(input: Tensor) -> Tensor: ... +def erfc(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + erfc(input, *, out=None) -> Tensor + + Alias for :func:`torch.special.erfc`. + """ + +def erfc_(input: Tensor) -> Tensor: ... +def erfinv(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + erfinv(input, *, out=None) -> Tensor + + Alias for :func:`torch.special.erfinv`. + """ + +def exp(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + exp(input, *, out=None) -> Tensor + + Returns a new tensor with the exponential of the elements + of the input tensor :attr:`input`. + + .. math:: + y_{i} = e^{x_{i}} + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.exp(torch.tensor([0, math.log(2.)])) + tensor([ 1., 2.]) + """ + +def exp2(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + exp2(input, *, out=None) -> Tensor + + Alias for :func:`torch.special.exp2`. + """ + +def exp2_(input: Tensor) -> Tensor: ... +def exp_(input: Tensor) -> Tensor: ... +def expand_copy( + input: Tensor, + size: Sequence[_int | SymInt], + *, + implicit: _bool = False, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.Tensor.expand`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def expm1(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + expm1(input, *, out=None) -> Tensor + + Alias for :func:`torch.special.expm1`. + """ + +def expm1_(input: Tensor) -> Tensor: ... +@overload +def eye( + n: _int | SymInt, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + eye(n, m=None, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a 2-D tensor with ones on the diagonal and zeros elsewhere. + + Args: + n (int): the number of rows + m (int, optional): the number of columns with default being :attr:`n` + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 2-D tensor with ones on the diagonal and zeros elsewhere + + Example:: + + >>> torch.eye(3) + tensor([[ 1., 0., 0.], + [ 0., 1., 0.], + [ 0., 0., 1.]]) + """ + +@overload +def eye( + n: _int | SymInt, + m: _int | SymInt, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + eye(n, m=None, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a 2-D tensor with ones on the diagonal and zeros elsewhere. + + Args: + n (int): the number of rows + m (int, optional): the number of columns with default being :attr:`n` + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 2-D tensor with ones on the diagonal and zeros elsewhere + + Example:: + + >>> torch.eye(3) + tensor([[ 1., 0., 0.], + [ 0., 1., 0.], + [ 0., 0., 1.]]) + """ + +def fake_quantize_per_channel_affine( + input: Tensor, + scale: Tensor, + zero_point: Tensor, + axis: _int, + quant_min: _int, + quant_max: _int, +) -> Tensor: + r""" + fake_quantize_per_channel_affine(input, scale, zero_point, axis, quant_min, quant_max) -> Tensor + + Returns a new tensor with the data in :attr:`input` fake quantized per channel using :attr:`scale`, + :attr:`zero_point`, :attr:`quant_min` and :attr:`quant_max`, across the channel specified by :attr:`axis`. + + .. math:: + \text{output} = ( + min( + \text{quant\_max}, + max( + \text{quant\_min}, + \text{std::nearby\_int}(\text{input} / \text{scale}) + \text{zero\_point} + ) + ) - \text{zero\_point} + ) \times \text{scale} + + Args: + input (Tensor): the input value(s), in ``torch.float32`` + scale (Tensor): quantization scale, per channel in ``torch.float32`` + zero_point (Tensor): quantization zero_point, per channel in ``torch.int32`` or ``torch.half`` or ``torch.float32`` + axis (int32): channel axis + quant_min (int64): lower bound of the quantized domain + quant_max (int64): upper bound of the quantized domain + + Returns: + Tensor: A newly fake_quantized per channel ``torch.float32`` tensor + + Example:: + + >>> x = torch.randn(2, 2, 2) + >>> x + tensor([[[-0.2525, -0.0466], + [ 0.3491, -0.2168]], + + [[-0.5906, 1.6258], + [ 0.6444, -0.0542]]]) + >>> scales = (torch.randn(2) + 1) * 0.05 + >>> scales + tensor([0.0475, 0.0486]) + >>> zero_points = torch.zeros(2).to(torch.int32) + >>> zero_points + tensor([0, 0]) + >>> torch.fake_quantize_per_channel_affine(x, scales, zero_points, 1, 0, 255) + tensor([[[0.0000, 0.0000], + [0.3405, 0.0000]], + + [[0.0000, 1.6134], + [0.6323, 0.0000]]]) + """ + +@overload +def fake_quantize_per_tensor_affine( + input: Tensor, + scale: _float, + zero_point: _int, + quant_min: _int, + quant_max: _int, +) -> Tensor: + r""" + fake_quantize_per_tensor_affine(input, scale, zero_point, quant_min, quant_max) -> Tensor + + Returns a new tensor with the data in :attr:`input` fake quantized using :attr:`scale`, + :attr:`zero_point`, :attr:`quant_min` and :attr:`quant_max`. + + .. math:: + \text{output} = ( + min( + \text{quant\_max}, + max( + \text{quant\_min}, + \text{std::nearby\_int}(\text{input} / \text{scale}) + \text{zero\_point} + ) + ) - \text{zero\_point} + ) \times \text{scale} + + Args: + input (Tensor): the input value(s), ``torch.float32`` tensor + scale (double scalar or ``float32`` Tensor): quantization scale + zero_point (int64 scalar or ``int32`` Tensor): quantization zero_point + quant_min (int64): lower bound of the quantized domain + quant_max (int64): upper bound of the quantized domain + + Returns: + Tensor: A newly fake_quantized ``torch.float32`` tensor + + Example:: + + >>> x = torch.randn(4) + >>> x + tensor([ 0.0552, 0.9730, 0.3973, -1.0780]) + >>> torch.fake_quantize_per_tensor_affine(x, 0.1, 0, 0, 255) + tensor([0.1000, 1.0000, 0.4000, 0.0000]) + >>> torch.fake_quantize_per_tensor_affine(x, torch.tensor(0.1), torch.tensor(0), 0, 255) + tensor([0.1000, 1.0000, 0.4000, 0.0000]) + """ + +@overload +def fake_quantize_per_tensor_affine( + input: Tensor, + scale: Tensor, + zero_point: Tensor, + quant_min: _int, + quant_max: _int, +) -> Tensor: + r""" + fake_quantize_per_tensor_affine(input, scale, zero_point, quant_min, quant_max) -> Tensor + + Returns a new tensor with the data in :attr:`input` fake quantized using :attr:`scale`, + :attr:`zero_point`, :attr:`quant_min` and :attr:`quant_max`. + + .. math:: + \text{output} = ( + min( + \text{quant\_max}, + max( + \text{quant\_min}, + \text{std::nearby\_int}(\text{input} / \text{scale}) + \text{zero\_point} + ) + ) - \text{zero\_point} + ) \times \text{scale} + + Args: + input (Tensor): the input value(s), ``torch.float32`` tensor + scale (double scalar or ``float32`` Tensor): quantization scale + zero_point (int64 scalar or ``int32`` Tensor): quantization zero_point + quant_min (int64): lower bound of the quantized domain + quant_max (int64): upper bound of the quantized domain + + Returns: + Tensor: A newly fake_quantized ``torch.float32`` tensor + + Example:: + + >>> x = torch.randn(4) + >>> x + tensor([ 0.0552, 0.9730, 0.3973, -1.0780]) + >>> torch.fake_quantize_per_tensor_affine(x, 0.1, 0, 0, 255) + tensor([0.1000, 1.0000, 0.4000, 0.0000]) + >>> torch.fake_quantize_per_tensor_affine(x, torch.tensor(0.1), torch.tensor(0), 0, 255) + tensor([0.1000, 1.0000, 0.4000, 0.0000]) + """ + +@overload +def fbgemm_linear_fp16_weight( + input: Tensor, + packed_weight: Tensor, + bias: Tensor, +) -> Tensor: ... +@overload +def fbgemm_linear_fp16_weight( + input: Tensor, + packed_weight: Tensor, + bias: Tensor, + output: Tensor, +) -> Tensor: ... +@overload +def fbgemm_linear_fp16_weight_fp32_activation( + input: Tensor, + packed_weight: Tensor, + bias: Tensor | None, +) -> Tensor: ... +@overload +def fbgemm_linear_fp16_weight_fp32_activation( + input: Tensor, + packed_weight: Tensor, + bias: Tensor | None, + output: Tensor, +) -> Tensor: ... +def fbgemm_linear_int8_weight( + input: Tensor, + weight: Tensor, + packed: Tensor, + col_offsets: Tensor, + weight_scale: Number | _complex, + weight_zero_point: Number | _complex, + bias: Tensor, +) -> Tensor: ... +def fbgemm_linear_int8_weight_fp32_activation( + input: Tensor, + weight: Tensor, + packed: Tensor, + col_offsets: Tensor, + weight_scale: Number | _complex, + weight_zero_point: Number | _complex, + bias: Tensor, +) -> Tensor: ... +def fbgemm_linear_quantize_weight( + input: Tensor, +) -> tuple[Tensor, Tensor, _float, _int]: ... +def fbgemm_pack_gemm_matrix_fp16(input: Tensor) -> Tensor: ... +@overload +def fbgemm_pack_quantized_matrix(input: Tensor) -> Tensor: ... +@overload +def fbgemm_pack_quantized_matrix(input: Tensor, K: _int, N: _int) -> Tensor: ... +def feature_alpha_dropout(input: Tensor, p: _float, train: _bool) -> Tensor: ... +def feature_alpha_dropout_( + input: Tensor, + p: _float, + train: _bool, +) -> Tensor: ... +def feature_dropout(input: Tensor, p: _float, train: _bool) -> Tensor: ... +def feature_dropout_(input: Tensor, p: _float, train: _bool) -> Tensor: ... +@overload +def fill(input: Tensor, value: Tensor) -> Tensor: ... +@overload +def fill(input: Tensor, value: Number | _complex) -> Tensor: ... +@overload +def fill_(input: Tensor, value: Tensor) -> Tensor: ... +@overload +def fill_(input: Tensor, value: Number | _complex) -> Tensor: ... +def fix(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + fix(input, *, out=None) -> Tensor + + Alias for :func:`torch.trunc` + """ + +def fix_(input: Tensor) -> Tensor: ... +@overload +def flatten( + input: Tensor, + start_dim: _int = 0, + end_dim: _int = -1, +) -> Tensor: + r""" + flatten(input, start_dim=0, end_dim=-1) -> Tensor + + Flattens :attr:`input` by reshaping it into a one-dimensional tensor. If :attr:`start_dim` or :attr:`end_dim` + are passed, only dimensions starting with :attr:`start_dim` and ending with :attr:`end_dim` are flattened. + The order of elements in :attr:`input` is unchanged. + + Unlike NumPy's flatten, which always copies input's data, this function may return the original object, a view, + or copy. If no dimensions are flattened, then the original object :attr:`input` is returned. Otherwise, if input can + be viewed as the flattened shape, then that view is returned. Finally, only if the input cannot be viewed as the + flattened shape is input's data copied. See :meth:`torch.Tensor.view` for details on when a view will be returned. + + .. note:: + Flattening a zero-dimensional tensor will return a one-dimensional view. + + Args: + input (Tensor): the input tensor. + start_dim (int): the first dim to flatten + end_dim (int): the last dim to flatten + + Example:: + + >>> t = torch.tensor([[[1, 2], + ... [3, 4]], + ... [[5, 6], + ... [7, 8]]]) + >>> torch.flatten(t) + tensor([1, 2, 3, 4, 5, 6, 7, 8]) + >>> torch.flatten(t, start_dim=1) + tensor([[1, 2, 3, 4], + [5, 6, 7, 8]]) + """ + +@overload +def flatten( + input: Tensor, + start_dim: _int, + end_dim: _int, + out_dim: str | EllipsisType | None, +) -> Tensor: + r""" + flatten(input, start_dim=0, end_dim=-1) -> Tensor + + Flattens :attr:`input` by reshaping it into a one-dimensional tensor. If :attr:`start_dim` or :attr:`end_dim` + are passed, only dimensions starting with :attr:`start_dim` and ending with :attr:`end_dim` are flattened. + The order of elements in :attr:`input` is unchanged. + + Unlike NumPy's flatten, which always copies input's data, this function may return the original object, a view, + or copy. If no dimensions are flattened, then the original object :attr:`input` is returned. Otherwise, if input can + be viewed as the flattened shape, then that view is returned. Finally, only if the input cannot be viewed as the + flattened shape is input's data copied. See :meth:`torch.Tensor.view` for details on when a view will be returned. + + .. note:: + Flattening a zero-dimensional tensor will return a one-dimensional view. + + Args: + input (Tensor): the input tensor. + start_dim (int): the first dim to flatten + end_dim (int): the last dim to flatten + + Example:: + + >>> t = torch.tensor([[[1, 2], + ... [3, 4]], + ... [[5, 6], + ... [7, 8]]]) + >>> torch.flatten(t) + tensor([1, 2, 3, 4, 5, 6, 7, 8]) + >>> torch.flatten(t, start_dim=1) + tensor([[1, 2, 3, 4], + [5, 6, 7, 8]]) + """ + +@overload +def flatten( + input: Tensor, + start_dim: str | EllipsisType | None, + end_dim: str | EllipsisType | None, + out_dim: str | EllipsisType | None, +) -> Tensor: + r""" + flatten(input, start_dim=0, end_dim=-1) -> Tensor + + Flattens :attr:`input` by reshaping it into a one-dimensional tensor. If :attr:`start_dim` or :attr:`end_dim` + are passed, only dimensions starting with :attr:`start_dim` and ending with :attr:`end_dim` are flattened. + The order of elements in :attr:`input` is unchanged. + + Unlike NumPy's flatten, which always copies input's data, this function may return the original object, a view, + or copy. If no dimensions are flattened, then the original object :attr:`input` is returned. Otherwise, if input can + be viewed as the flattened shape, then that view is returned. Finally, only if the input cannot be viewed as the + flattened shape is input's data copied. See :meth:`torch.Tensor.view` for details on when a view will be returned. + + .. note:: + Flattening a zero-dimensional tensor will return a one-dimensional view. + + Args: + input (Tensor): the input tensor. + start_dim (int): the first dim to flatten + end_dim (int): the last dim to flatten + + Example:: + + >>> t = torch.tensor([[[1, 2], + ... [3, 4]], + ... [[5, 6], + ... [7, 8]]]) + >>> torch.flatten(t) + tensor([1, 2, 3, 4, 5, 6, 7, 8]) + >>> torch.flatten(t, start_dim=1) + tensor([[1, 2, 3, 4], + [5, 6, 7, 8]]) + """ + +@overload +def flatten( + input: Tensor, + dims: Sequence[str | EllipsisType | None], + out_dim: str | EllipsisType | None, +) -> Tensor: + r""" + flatten(input, start_dim=0, end_dim=-1) -> Tensor + + Flattens :attr:`input` by reshaping it into a one-dimensional tensor. If :attr:`start_dim` or :attr:`end_dim` + are passed, only dimensions starting with :attr:`start_dim` and ending with :attr:`end_dim` are flattened. + The order of elements in :attr:`input` is unchanged. + + Unlike NumPy's flatten, which always copies input's data, this function may return the original object, a view, + or copy. If no dimensions are flattened, then the original object :attr:`input` is returned. Otherwise, if input can + be viewed as the flattened shape, then that view is returned. Finally, only if the input cannot be viewed as the + flattened shape is input's data copied. See :meth:`torch.Tensor.view` for details on when a view will be returned. + + .. note:: + Flattening a zero-dimensional tensor will return a one-dimensional view. + + Args: + input (Tensor): the input tensor. + start_dim (int): the first dim to flatten + end_dim (int): the last dim to flatten + + Example:: + + >>> t = torch.tensor([[[1, 2], + ... [3, 4]], + ... [[5, 6], + ... [7, 8]]]) + >>> torch.flatten(t) + tensor([1, 2, 3, 4, 5, 6, 7, 8]) + >>> torch.flatten(t, start_dim=1) + tensor([[1, 2, 3, 4], + [5, 6, 7, 8]]) + """ + +def flip(input: Tensor, dims: _size) -> Tensor: + r""" + flip(input, dims) -> Tensor + + Reverse the order of an n-D tensor along given axis in dims. + + .. note:: + `torch.flip` makes a copy of :attr:`input`'s data. This is different from NumPy's `np.flip`, + which returns a view in constant time. Since copying a tensor's data is more work than viewing that data, + `torch.flip` is expected to be slower than `np.flip`. + + Args: + input (Tensor): the input tensor. + dims (a list or tuple): axis to flip on + + Example:: + + >>> x = torch.arange(8).view(2, 2, 2) + >>> x + tensor([[[ 0, 1], + [ 2, 3]], + + [[ 4, 5], + [ 6, 7]]]) + >>> torch.flip(x, [0, 1]) + tensor([[[ 6, 7], + [ 4, 5]], + + [[ 2, 3], + [ 0, 1]]]) + """ + +def fliplr(input: Tensor) -> Tensor: + r""" + fliplr(input) -> Tensor + + Flip tensor in the left/right direction, returning a new tensor. + + Flip the entries in each row in the left/right direction. + Columns are preserved, but appear in a different order than before. + + Note: + Requires the tensor to be at least 2-D. + + .. note:: + `torch.fliplr` makes a copy of :attr:`input`'s data. This is different from NumPy's `np.fliplr`, + which returns a view in constant time. Since copying a tensor's data is more work than viewing that data, + `torch.fliplr` is expected to be slower than `np.fliplr`. + + Args: + input (Tensor): Must be at least 2-dimensional. + + Example:: + + >>> x = torch.arange(4).view(2, 2) + >>> x + tensor([[0, 1], + [2, 3]]) + >>> torch.fliplr(x) + tensor([[1, 0], + [3, 2]]) + """ + +def flipud(input: Tensor) -> Tensor: + r""" + flipud(input) -> Tensor + + Flip tensor in the up/down direction, returning a new tensor. + + Flip the entries in each column in the up/down direction. + Rows are preserved, but appear in a different order than before. + + Note: + Requires the tensor to be at least 1-D. + + .. note:: + `torch.flipud` makes a copy of :attr:`input`'s data. This is different from NumPy's `np.flipud`, + which returns a view in constant time. Since copying a tensor's data is more work than viewing that data, + `torch.flipud` is expected to be slower than `np.flipud`. + + Args: + input (Tensor): Must be at least 1-dimensional. + + Example:: + + >>> x = torch.arange(4).view(2, 2) + >>> x + tensor([[0, 1], + [2, 3]]) + >>> torch.flipud(x) + tensor([[2, 3], + [0, 1]]) + """ + +@overload +def float_power( + input: Tensor, + exponent: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + float_power(input, exponent, *, out=None) -> Tensor + + Raises :attr:`input` to the power of :attr:`exponent`, elementwise, in double precision. + If neither input is complex returns a ``torch.float64`` tensor, + and if one or more inputs is complex returns a ``torch.complex128`` tensor. + + .. note:: + This function always computes in double precision, unlike :func:`torch.pow`, + which implements more typical :ref:`type promotion `. + This is useful when the computation needs to be performed in a wider or more precise dtype, + or the results of the computation may contain fractional values not representable in the input dtypes, + like when an integer base is raised to a negative integer exponent. + + Args: + input (Tensor or Number): the base value(s) + exponent (Tensor or Number): the exponent value(s) + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randint(10, (4,)) + >>> a + tensor([6, 4, 7, 1]) + >>> torch.float_power(a, 2) + tensor([36., 16., 49., 1.], dtype=torch.float64) + + >>> a = torch.arange(1, 5) + >>> a + tensor([ 1, 2, 3, 4]) + >>> exp = torch.tensor([2, -3, 4, -5]) + >>> exp + tensor([ 2, -3, 4, -5]) + >>> torch.float_power(a, exp) + tensor([1.0000e+00, 1.2500e-01, 8.1000e+01, 9.7656e-04], dtype=torch.float64) + """ + +@overload +def float_power( + self: Number | _complex, + exponent: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + float_power(input, exponent, *, out=None) -> Tensor + + Raises :attr:`input` to the power of :attr:`exponent`, elementwise, in double precision. + If neither input is complex returns a ``torch.float64`` tensor, + and if one or more inputs is complex returns a ``torch.complex128`` tensor. + + .. note:: + This function always computes in double precision, unlike :func:`torch.pow`, + which implements more typical :ref:`type promotion `. + This is useful when the computation needs to be performed in a wider or more precise dtype, + or the results of the computation may contain fractional values not representable in the input dtypes, + like when an integer base is raised to a negative integer exponent. + + Args: + input (Tensor or Number): the base value(s) + exponent (Tensor or Number): the exponent value(s) + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randint(10, (4,)) + >>> a + tensor([6, 4, 7, 1]) + >>> torch.float_power(a, 2) + tensor([36., 16., 49., 1.], dtype=torch.float64) + + >>> a = torch.arange(1, 5) + >>> a + tensor([ 1, 2, 3, 4]) + >>> exp = torch.tensor([2, -3, 4, -5]) + >>> exp + tensor([ 2, -3, 4, -5]) + >>> torch.float_power(a, exp) + tensor([1.0000e+00, 1.2500e-01, 8.1000e+01, 9.7656e-04], dtype=torch.float64) + """ + +@overload +def float_power( + input: Tensor, + exponent: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + float_power(input, exponent, *, out=None) -> Tensor + + Raises :attr:`input` to the power of :attr:`exponent`, elementwise, in double precision. + If neither input is complex returns a ``torch.float64`` tensor, + and if one or more inputs is complex returns a ``torch.complex128`` tensor. + + .. note:: + This function always computes in double precision, unlike :func:`torch.pow`, + which implements more typical :ref:`type promotion `. + This is useful when the computation needs to be performed in a wider or more precise dtype, + or the results of the computation may contain fractional values not representable in the input dtypes, + like when an integer base is raised to a negative integer exponent. + + Args: + input (Tensor or Number): the base value(s) + exponent (Tensor or Number): the exponent value(s) + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randint(10, (4,)) + >>> a + tensor([6, 4, 7, 1]) + >>> torch.float_power(a, 2) + tensor([36., 16., 49., 1.], dtype=torch.float64) + + >>> a = torch.arange(1, 5) + >>> a + tensor([ 1, 2, 3, 4]) + >>> exp = torch.tensor([2, -3, 4, -5]) + >>> exp + tensor([ 2, -3, 4, -5]) + >>> torch.float_power(a, exp) + tensor([1.0000e+00, 1.2500e-01, 8.1000e+01, 9.7656e-04], dtype=torch.float64) + """ + +def floor(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + floor(input, *, out=None) -> Tensor + + Returns a new tensor with the floor of the elements of :attr:`input`, + the largest integer less than or equal to each element. + + For integer inputs, follows the array-api convention of returning a + copy of the input tensor. + + .. math:: + \text{out}_{i} = \left\lfloor \text{input}_{i} \right\rfloor + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-0.8166, 1.5308, -0.2530, -0.2091]) + >>> torch.floor(a) + tensor([-1., 1., -1., -1.]) + """ + +def floor_(input: Tensor) -> Tensor: ... +def floor_divide( + input: Tensor | Number, + other: Tensor | Number, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + floor_divide(input, other, *, out=None) -> Tensor + + .. note:: + + Before PyTorch 1.13 :func:`torch.floor_divide` incorrectly performed + truncation division. To restore the previous behavior use + :func:`torch.div` with ``rounding_mode='trunc'``. + + Computes :attr:`input` divided by :attr:`other`, elementwise, and floors + the result. + + .. math:: + \text{{out}}_i = \text{floor} \left( \frac{{\text{{input}}_i}}{{\text{{other}}_i}} \right) + + + + Supports broadcasting to a common shape, type promotion, and integer and float inputs. + + Args: + input (Tensor or Number): the dividend + other (Tensor or Number): the divisor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([4.0, 3.0]) + >>> b = torch.tensor([2.0, 2.0]) + >>> torch.floor_divide(a, b) + tensor([2.0, 1.0]) + >>> torch.floor_divide(a, 1.4) + tensor([2.0, 2.0]) + """ + +def fmax( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + fmax(input, other, *, out=None) -> Tensor + + Computes the element-wise maximum of :attr:`input` and :attr:`other`. + + This is like :func:`torch.maximum` except it handles NaNs differently: + if exactly one of the two elements being compared is a NaN then the non-NaN element is taken as the maximum. + Only if both elements are NaN is NaN propagated. + + This function is a wrapper around C++'s ``std::fmax`` and is similar to NumPy's ``fmax`` function. + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer and floating-point inputs. + + Args: + input (Tensor): the input tensor. + other (Tensor): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([9.7, float('nan'), 3.1, float('nan')]) + >>> b = torch.tensor([-2.2, 0.5, float('nan'), float('nan')]) + >>> torch.fmax(a, b) + tensor([9.7000, 0.5000, 3.1000, nan]) + """ + +def fmin( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + fmin(input, other, *, out=None) -> Tensor + + Computes the element-wise minimum of :attr:`input` and :attr:`other`. + + This is like :func:`torch.minimum` except it handles NaNs differently: + if exactly one of the two elements being compared is a NaN then the non-NaN element is taken as the minimum. + Only if both elements are NaN is NaN propagated. + + This function is a wrapper around C++'s ``std::fmin`` and is similar to NumPy's ``fmin`` function. + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer and floating-point inputs. + + Args: + input (Tensor): the input tensor. + other (Tensor): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([2.2, float('nan'), 2.1, float('nan')]) + >>> b = torch.tensor([-9.3, 0.1, float('nan'), float('nan')]) + >>> torch.fmin(a, b) + tensor([-9.3000, 0.1000, 2.1000, nan]) + """ + +@overload +def fmod( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + fmod(input, other, *, out=None) -> Tensor + + Applies C++'s `std::fmod `_ entrywise. + The result has the same sign as the dividend :attr:`input` and its absolute value + is less than that of :attr:`other`. + + This function may be defined in terms of :func:`torch.div` as + + .. code:: python + + torch.fmod(a, b) == a - a.div(b, rounding_mode="trunc") * b + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer and float inputs. + + .. note:: + + When the divisor is zero, returns ``NaN`` for floating point dtypes + on both CPU and GPU; raises ``RuntimeError`` for integer division by + zero on CPU; Integer division by zero on GPU may return any value. + + .. note:: + + Complex inputs are not supported. In some cases, it is not mathematically + possible to satisfy the definition of a modulo operation with complex numbers. + + .. seealso:: + + :func:`torch.remainder` which implements Python's modulus operator. + This one is defined using division rounding down the result. + + Args: + input (Tensor): the dividend + other (Tensor or Scalar): the divisor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.fmod(torch.tensor([-3., -2, -1, 1, 2, 3]), 2) + tensor([-1., -0., -1., 1., 0., 1.]) + >>> torch.fmod(torch.tensor([1, 2, 3, 4, 5]), -1.5) + tensor([1.0000, 0.5000, 0.0000, 1.0000, 0.5000]) + """ + +@overload +def fmod( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + fmod(input, other, *, out=None) -> Tensor + + Applies C++'s `std::fmod `_ entrywise. + The result has the same sign as the dividend :attr:`input` and its absolute value + is less than that of :attr:`other`. + + This function may be defined in terms of :func:`torch.div` as + + .. code:: python + + torch.fmod(a, b) == a - a.div(b, rounding_mode="trunc") * b + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer and float inputs. + + .. note:: + + When the divisor is zero, returns ``NaN`` for floating point dtypes + on both CPU and GPU; raises ``RuntimeError`` for integer division by + zero on CPU; Integer division by zero on GPU may return any value. + + .. note:: + + Complex inputs are not supported. In some cases, it is not mathematically + possible to satisfy the definition of a modulo operation with complex numbers. + + .. seealso:: + + :func:`torch.remainder` which implements Python's modulus operator. + This one is defined using division rounding down the result. + + Args: + input (Tensor): the dividend + other (Tensor or Scalar): the divisor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.fmod(torch.tensor([-3., -2, -1, 1, 2, 3]), 2) + tensor([-1., -0., -1., 1., 0., 1.]) + >>> torch.fmod(torch.tensor([1, 2, 3, 4, 5]), -1.5) + tensor([1.0000, 0.5000, 0.0000, 1.0000, 0.5000]) + """ + +def frac(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + frac(input, *, out=None) -> Tensor + + Computes the fractional portion of each element in :attr:`input`. + + .. math:: + \text{out}_{i} = \text{input}_{i} - \left\lfloor |\text{input}_{i}| \right\rfloor * \operatorname{sgn}(\text{input}_{i}) + + Example:: + + >>> torch.frac(torch.tensor([1, 2.5, -3.2])) + tensor([ 0.0000, 0.5000, -0.2000]) + """ + +def frac_(input: Tensor) -> Tensor: ... +def frexp( + input: Tensor, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.frexp: + r""" + frexp(input, *, out=None) -> (Tensor mantissa, Tensor exponent) + + Decomposes :attr:`input` into mantissa and exponent tensors + such that :math:`\text{input} = \text{mantissa} \times 2^{\text{exponent}}`. + + The range of mantissa is the open interval (-1, 1). + + Supports float inputs. + + Args: + input (Tensor): the input tensor + + + Keyword args: + out (tuple, optional): the output tensors + + Example:: + + >>> x = torch.arange(9.) + >>> mantissa, exponent = torch.frexp(x) + >>> mantissa + tensor([0.0000, 0.5000, 0.5000, 0.7500, 0.5000, 0.6250, 0.7500, 0.8750, 0.5000]) + >>> exponent + tensor([0, 1, 2, 2, 3, 3, 3, 3, 4], dtype=torch.int32) + >>> torch.ldexp(mantissa, exponent) + tensor([0., 1., 2., 3., 4., 5., 6., 7., 8.]) + """ + +def frobenius_norm( + input: Tensor, + dim: _int | _size, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: ... +def from_file( + filename: str, + shared: _bool | None = None, + size: _int | None = 0, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + from_file(filename, shared=None, size=0, *, dtype=None, layout=None, device=None, pin_memory=False) + + Creates a CPU tensor with a storage backed by a memory-mapped file. + + If ``shared`` is True, then memory is shared between processes. All changes are written to the file. + If ``shared`` is False, then changes to the tensor do not affect the file. + + ``size`` is the number of elements in the Tensor. If ``shared`` is ``False``, then the file must contain + at least ``size * sizeof(dtype)`` bytes. If ``shared`` is ``True`` the file will be created if needed. + + .. note:: + Only CPU tensors can be mapped to files. + + .. note:: + For now, tensors with storages backed by a memory-mapped file cannot be created in pinned memory. + + + Args: + filename (str): file name to map + shared (bool): whether to share memory (whether ``MAP_SHARED`` or ``MAP_PRIVATE`` is passed to the + underlying `mmap(2) call `_) + size (int): number of elements in the tensor + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> t = torch.randn(2, 5, dtype=torch.float64) + >>> t.numpy().tofile('storage.pt') + >>> t_mapped = torch.from_file('storage.pt', shared=False, size=10, dtype=torch.float64) + """ + +def from_numpy(ndarray) -> Tensor: + r""" + from_numpy(ndarray) -> Tensor + + Creates a :class:`Tensor` from a :class:`numpy.ndarray`. + + The returned tensor and :attr:`ndarray` share the same memory. Modifications to + the tensor will be reflected in the :attr:`ndarray` and vice versa. The returned + tensor is not resizable. + + It currently accepts :attr:`ndarray` with dtypes of ``numpy.float64``, + ``numpy.float32``, ``numpy.float16``, ``numpy.complex64``, ``numpy.complex128``, + ``numpy.int64``, ``numpy.int32``, ``numpy.int16``, ``numpy.int8``, ``numpy.uint8``, + and ``bool``. + + .. warning:: + Writing to a tensor created from a read-only NumPy array is not supported and will result in undefined behavior. + + Example:: + + >>> a = numpy.array([1, 2, 3]) + >>> t = torch.from_numpy(a) + >>> t + tensor([ 1, 2, 3]) + >>> t[0] = -1 + >>> a + array([-1, 2, 3]) + """ + +def frombuffer( + buffer: Any, + *, + dtype: _dtype, + count: int = -1, + offset: int = 0, + requires_grad: _bool = False, +) -> Tensor: + r""" + frombuffer(buffer, *, dtype, count=-1, offset=0, requires_grad=False) -> Tensor + + Creates a 1-dimensional :class:`Tensor` from an object that implements + the Python buffer protocol. + + Skips the first :attr:`offset` bytes in the buffer, and interprets the rest of + the raw bytes as a 1-dimensional tensor of type :attr:`dtype` with :attr:`count` + elements. + + Note that either of the following must be true: + + 1. :attr:`count` is a positive non-zero number, and the total number of bytes + in the buffer is more than :attr:`offset` plus :attr:`count` times the size + (in bytes) of :attr:`dtype`. + + 2. :attr:`count` is negative, and the length (number of bytes) of the buffer + subtracted by the :attr:`offset` is a multiple of the size (in bytes) of + :attr:`dtype`. + + The returned tensor and buffer share the same memory. Modifications to + the tensor will be reflected in the buffer and vice versa. The returned + tensor is not resizable. + + .. note:: + This function increments the reference count for the object that + owns the shared memory. Therefore, such memory will not be deallocated + before the returned tensor goes out of scope. + + .. warning:: + This function's behavior is undefined when passed an object implementing + the buffer protocol whose data is not on the CPU. Doing so is likely to + cause a segmentation fault. + + .. warning:: + This function does not try to infer the :attr:`dtype` (hence, it is not + optional). Passing a different :attr:`dtype` than its source may result + in unexpected behavior. + + Args: + buffer (object): a Python object that exposes the buffer interface. + + Keyword args: + dtype (:class:`torch.dtype`): the desired data type of returned tensor. + count (int, optional): the number of desired elements to be read. + If negative, all the elements (until the end of the buffer) will be + read. Default: -1. + offset (int, optional): the number of bytes to skip at the start of + the buffer. Default: 0. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> import array + >>> a = array.array('i', [1, 2, 3]) + >>> t = torch.frombuffer(a, dtype=torch.int32) + >>> t + tensor([ 1, 2, 3]) + >>> t[0] = -1 + >>> a + array([-1, 2, 3]) + + >>> # Interprets the signed char bytes as 32-bit integers. + >>> # Each 4 signed char elements will be interpreted as + >>> # 1 signed 32-bit integer. + >>> import array + >>> a = array.array('b', [-1, 0, 0, 0]) + >>> torch.frombuffer(a, dtype=torch.int32) + tensor([255], dtype=torch.int32) + """ + +@overload +def full( + size: _size, + fill_value: Number | _complex, + *, + out: Tensor | None = None, + layout: _layout = strided, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + pin_memory: _bool = False, +) -> Tensor: + r""" + full(size, fill_value, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Creates a tensor of size :attr:`size` filled with :attr:`fill_value`. The + tensor's dtype is inferred from :attr:`fill_value`. + + Args: + size (int...): a list, tuple, or :class:`torch.Size` of integers defining the + shape of the output tensor. + fill_value (Scalar): the value to fill the output tensor with. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.full((2, 3), 3.141592) + tensor([[ 3.1416, 3.1416, 3.1416], + [ 3.1416, 3.1416, 3.1416]]) + """ + +@overload +def full( + size: _size, + fill_value: Number | _complex, + *, + names: list[str | None], + layout: _layout = strided, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + pin_memory: _bool = False, +) -> Tensor: + r""" + full(size, fill_value, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Creates a tensor of size :attr:`size` filled with :attr:`fill_value`. The + tensor's dtype is inferred from :attr:`fill_value`. + + Args: + size (int...): a list, tuple, or :class:`torch.Size` of integers defining the + shape of the output tensor. + fill_value (Scalar): the value to fill the output tensor with. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.full((2, 3), 3.141592) + tensor([[ 3.1416, 3.1416, 3.1416], + [ 3.1416, 3.1416, 3.1416]]) + """ + +@overload +def full( + size: Sequence[_int | SymInt], + fill_value: Number | _complex, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + full(size, fill_value, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Creates a tensor of size :attr:`size` filled with :attr:`fill_value`. The + tensor's dtype is inferred from :attr:`fill_value`. + + Args: + size (int...): a list, tuple, or :class:`torch.Size` of integers defining the + shape of the output tensor. + fill_value (Scalar): the value to fill the output tensor with. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.full((2, 3), 3.141592) + tensor([[ 3.1416, 3.1416, 3.1416], + [ 3.1416, 3.1416, 3.1416]]) + """ + +@overload +def full( + size: _size, + fill_value: Number | _complex, + *, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + full(size, fill_value, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Creates a tensor of size :attr:`size` filled with :attr:`fill_value`. The + tensor's dtype is inferred from :attr:`fill_value`. + + Args: + size (int...): a list, tuple, or :class:`torch.Size` of integers defining the + shape of the output tensor. + fill_value (Scalar): the value to fill the output tensor with. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.full((2, 3), 3.141592) + tensor([[ 3.1416, 3.1416, 3.1416], + [ 3.1416, 3.1416, 3.1416]]) + """ + +def full_like( + input: Tensor, + fill_value: Number | _complex, + *, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + full_like(input, fill_value, \*, dtype=None, layout=torch.strided, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor with the same size as :attr:`input` filled with :attr:`fill_value`. + ``torch.full_like(input, fill_value)`` is equivalent to + ``torch.full(input.size(), fill_value, dtype=input.dtype, layout=input.layout, device=input.device)``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + fill_value: the number to fill the output tensor with. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + + Example:: + + >>> x = torch.ones(2, 3) + >>> torch.full_like(x, 3.141592) + tensor([[ 3.1416, 3.1416, 3.1416], + [ 3.1416, 3.1416, 3.1416]]) + >>> torch.full_like(x, 7) + tensor([[7., 7., 7.], + [7., 7., 7.]]) + >>> torch.full_like(x, 0.5, dtype=torch.int32) + tensor([[0, 0, 0], + [0, 0, 0]], dtype=torch.int32) + >>> y = torch.randn(3, 4, dtype=torch.float64) + >>> torch.full_like(y, -1.0) + tensor([[-1., -1., -1., -1.], + [-1., -1., -1., -1.], + [-1., -1., -1., -1.]], dtype=torch.float64) + """ + +def fused_moving_avg_obs_fake_quant( + input: Tensor, + observer_on: Tensor, + fake_quant_on: Tensor, + running_min: Tensor, + running_max: Tensor, + scale: Tensor, + zero_point: Tensor, + averaging_const: _float, + quant_min: _int, + quant_max: _int, + ch_axis: _int, + per_row_fake_quant: _bool = False, + symmetric_quant: _bool = False, +) -> Tensor: ... +@overload +def gather( + input: Tensor, + dim: _int, + index: Tensor, + *, + sparse_grad: _bool = False, + out: Tensor | None = None, +) -> Tensor: + r""" + gather(input, dim, index, *, sparse_grad=False, out=None) -> Tensor + + Gathers values along an axis specified by `dim`. + + For a 3-D tensor the output is specified by:: + + out[i][j][k] = input[index[i][j][k]][j][k] # if dim == 0 + out[i][j][k] = input[i][index[i][j][k]][k] # if dim == 1 + out[i][j][k] = input[i][j][index[i][j][k]] # if dim == 2 + + :attr:`input` and :attr:`index` must have the same number of dimensions. + It is also required that ``index.size(d) <= input.size(d)`` for all + dimensions ``d != dim``. :attr:`out` will have the same shape as :attr:`index`. + Note that ``input`` and ``index`` do not broadcast against each other. + When :attr:`index` is empty, we always return an empty output with the same shape + without further error checking. + + Args: + input (Tensor): the source tensor + dim (int): the axis along which to index + index (LongTensor): the indices of elements to gather + + Keyword arguments: + sparse_grad (bool, optional): If ``True``, gradient w.r.t. :attr:`input` will be a sparse tensor. + out (Tensor, optional): the destination tensor + + Example:: + + >>> t = torch.tensor([[1, 2], [3, 4]]) + >>> torch.gather(t, 1, torch.tensor([[0, 0], [1, 0]])) + tensor([[ 1, 1], + [ 4, 3]]) + """ + +@overload +def gather( + input: Tensor, + dim: str | EllipsisType | None, + index: Tensor, + *, + sparse_grad: _bool = False, + out: Tensor | None = None, +) -> Tensor: + r""" + gather(input, dim, index, *, sparse_grad=False, out=None) -> Tensor + + Gathers values along an axis specified by `dim`. + + For a 3-D tensor the output is specified by:: + + out[i][j][k] = input[index[i][j][k]][j][k] # if dim == 0 + out[i][j][k] = input[i][index[i][j][k]][k] # if dim == 1 + out[i][j][k] = input[i][j][index[i][j][k]] # if dim == 2 + + :attr:`input` and :attr:`index` must have the same number of dimensions. + It is also required that ``index.size(d) <= input.size(d)`` for all + dimensions ``d != dim``. :attr:`out` will have the same shape as :attr:`index`. + Note that ``input`` and ``index`` do not broadcast against each other. + When :attr:`index` is empty, we always return an empty output with the same shape + without further error checking. + + Args: + input (Tensor): the source tensor + dim (int): the axis along which to index + index (LongTensor): the indices of elements to gather + + Keyword arguments: + sparse_grad (bool, optional): If ``True``, gradient w.r.t. :attr:`input` will be a sparse tensor. + out (Tensor, optional): the destination tensor + + Example:: + + >>> t = torch.tensor([[1, 2], [3, 4]]) + >>> torch.gather(t, 1, torch.tensor([[0, 0], [1, 0]])) + tensor([[ 1, 1], + [ 4, 3]]) + """ + +def gcd( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + gcd(input, other, *, out=None) -> Tensor + + Computes the element-wise greatest common divisor (GCD) of :attr:`input` and :attr:`other`. + + Both :attr:`input` and :attr:`other` must have integer types. + + .. note:: + This defines :math:`gcd(0, 0) = 0`. + + Args: + input (Tensor): the input tensor. + other (Tensor): the second input tensor + + Keyword arguments: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([5, 10, 15]) + >>> b = torch.tensor([3, 4, 5]) + >>> torch.gcd(a, b) + tensor([1, 2, 5]) + >>> c = torch.tensor([3]) + >>> torch.gcd(a, c) + tensor([1, 1, 3]) + """ + +def gcd_(input: Tensor, other: Tensor) -> Tensor: ... +@overload +def ge( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + ge(input, other, *, out=None) -> Tensor + + Computes :math:`\text{input} \geq \text{other}` element-wise. + + + The second argument can be a number or a tensor whose shape is + :ref:`broadcastable ` with the first argument. + + Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is greater than or equal to :attr:`other` and False elsewhere + + Example:: + + >>> torch.ge(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[True, True], [False, True]]) + """ + +@overload +def ge( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + ge(input, other, *, out=None) -> Tensor + + Computes :math:`\text{input} \geq \text{other}` element-wise. + + + The second argument can be a number or a tensor whose shape is + :ref:`broadcastable ` with the first argument. + + Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is greater than or equal to :attr:`other` and False elsewhere + + Example:: + + >>> torch.ge(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[True, True], [False, True]]) + """ + +def geqrf( + input: Tensor, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.geqrf: + r""" + geqrf(input, *, out=None) -> (Tensor, Tensor) + + This is a low-level function for calling LAPACK's geqrf directly. This function + returns a namedtuple (a, tau) as defined in `LAPACK documentation for geqrf`_ . + + Computes a QR decomposition of :attr:`input`. + Both `Q` and `R` matrices are stored in the same output tensor `a`. + The elements of `R` are stored on and above the diagonal. + Elementary reflectors (or Householder vectors) implicitly defining matrix `Q` + are stored below the diagonal. + The results of this function can be used together with :func:`torch.linalg.householder_product` + to obtain the `Q` matrix or + with :func:`torch.ormqr`, which uses an implicit representation of the `Q` matrix, + for an efficient matrix-matrix multiplication. + + See `LAPACK documentation for geqrf`_ for further details. + + .. note:: + See also :func:`torch.linalg.qr`, which computes Q and R matrices, and :func:`torch.linalg.lstsq` + with the ``driver="gels"`` option for a function that can solve matrix equations using a QR decomposition. + + Args: + input (Tensor): the input matrix + + Keyword args: + out (tuple, optional): the output tuple of (Tensor, Tensor). Ignored if `None`. Default: `None`. + + .. _LAPACK documentation for geqrf: + http://www.netlib.org/lapack/explore-html/df/dc5/group__variants_g_ecomputational_ga3766ea903391b5cf9008132f7440ec7b.html + """ + +def ger( + input: Tensor, + vec2: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + ger(input, vec2, *, out=None) -> Tensor + + Alias of :func:`torch.outer`. + + .. warning:: + This function is deprecated and will be removed in a future PyTorch release. + Use :func:`torch.outer` instead. + """ + +def get_default_dtype() -> _dtype: + r""" + get_default_dtype() -> torch.dtype + + Get the current default floating point :class:`torch.dtype`. + + Example:: + + >>> torch.get_default_dtype() # initial default for floating point is torch.float32 + torch.float32 + >>> torch.set_default_dtype(torch.float64) + >>> torch.get_default_dtype() # default is now changed to torch.float64 + torch.float64 + """ + +def get_num_interop_threads() -> _int: + r""" + get_num_interop_threads() -> int + + Returns the number of threads used for inter-op parallelism on CPU + (e.g. in JIT interpreter) + """ + +def get_num_threads() -> _int: + r""" + get_num_threads() -> int + + Returns the number of threads used for parallelizing CPU operations + """ + +@overload +def gradient( + input: Tensor, + *, + spacing: Number | _complex | None = None, + dim: _int | None = None, + edge_order: _int = 1, +) -> tuple[Tensor, ...]: + r""" + gradient(input, *, spacing=1, dim=None, edge_order=1) -> List of Tensors + + Estimates the gradient of a function :math:`g : \mathbb{R}^n \rightarrow \mathbb{R}` in + one or more dimensions using the `second-order accurate central differences method + `_ and + either first or second order estimates at the boundaries. + + The gradient of :math:`g` is estimated using samples. By default, when :attr:`spacing` is not + specified, the samples are entirely described by :attr:`input`, and the mapping of input coordinates + to an output is the same as the tensor's mapping of indices to values. For example, for a three-dimensional + :attr:`input` the function described is :math:`g : \mathbb{R}^3 \rightarrow \mathbb{R}`, and + :math:`g(1, 2, 3)\ == input[1, 2, 3]`. + + When :attr:`spacing` is specified, it modifies the relationship between :attr:`input` and input coordinates. + This is detailed in the "Keyword Arguments" section below. + + The gradient is estimated by estimating each partial derivative of :math:`g` independently. This estimation is + accurate if :math:`g` is in :math:`C^3` (it has at least 3 continuous derivatives), and the estimation can be + improved by providing closer samples. Mathematically, the value at each interior point of a partial derivative + is estimated using `Taylor's theorem with remainder `_. + Letting :math:`x` be an interior point with :math:`x-h_l` and :math:`x+h_r` be points neighboring + it to the left and right respectively, :math:`f(x+h_r)` and :math:`f(x-h_l)` can be estimated using: + + .. math:: + \begin{aligned} + f(x+h_r) = f(x) + h_r f'(x) + {h_r}^2 \frac{f''(x)}{2} + {h_r}^3 \frac{f'''(\xi_1)}{6}, \xi_1 \in (x, x+h_r) \\ + f(x-h_l) = f(x) - h_l f'(x) + {h_l}^2 \frac{f''(x)}{2} - {h_l}^3 \frac{f'''(\xi_2)}{6}, \xi_2 \in (x, x-h_l) \\ + \end{aligned} + + Using the fact that :math:`f \in C^3` and solving the linear system, we derive: + + .. math:: + f'(x) \approx \frac{ {h_l}^2 f(x+h_r) - {h_r}^2 f(x-h_l) + + ({h_r}^2-{h_l}^2 ) f(x) }{ {h_r} {h_l}^2 + {h_r}^2 {h_l} } + + .. note:: + We estimate the gradient of functions in complex domain + :math:`g : \mathbb{C}^n \rightarrow \mathbb{C}` in the same way. + + The value of each partial derivative at the boundary points is computed differently. See edge_order below. + + Args: + input (``Tensor``): the tensor that represents the values of the function + + Keyword args: + spacing (``scalar``, ``list of scalar``, ``list of Tensor``, optional): :attr:`spacing` can be used to modify + how the :attr:`input` tensor's indices relate to sample coordinates. If :attr:`spacing` is a scalar then + the indices are multiplied by the scalar to produce the coordinates. For example, if :attr:`spacing=2` the + indices (1, 2, 3) become coordinates (2, 4, 6). If :attr:`spacing` is a list of scalars then the corresponding + indices are multiplied. For example, if :attr:`spacing=(2, -1, 3)` the indices (1, 2, 3) become coordinates (2, -2, 9). + Finally, if :attr:`spacing` is a list of one-dimensional tensors then each tensor specifies the coordinates for + the corresponding dimension. For example, if the indices are (1, 2, 3) and the tensors are (t0, t1, t2), then + the coordinates are (t0[1], t1[2], t2[3]) + + dim (``int``, ``list of int``, optional): the dimension or dimensions to approximate the gradient over. By default + the partial gradient in every dimension is computed. Note that when :attr:`dim` is specified the elements of + the :attr:`spacing` argument must correspond with the specified dims." + + edge_order (``int``, optional): 1 or 2, for `first-order + `_ or + `second-order `_ + estimation of the boundary ("edge") values, respectively. Note that when :attr:`edge_order` is specified, each + dimension size of :attr:`input` should be at least edge_order+1 + + Examples:: + + >>> # Estimates the gradient of f(x)=x^2 at points [-2, -1, 2, 4] + >>> coordinates = (torch.tensor([-2., -1., 1., 4.]),) + >>> values = torch.tensor([4., 1., 1., 16.], ) + >>> torch.gradient(values, spacing = coordinates) + (tensor([-3., -2., 2., 5.]),) + + >>> # Estimates the gradient of the R^2 -> R function whose samples are + >>> # described by the tensor t. Implicit coordinates are [0, 1] for the outermost + >>> # dimension and [0, 1, 2, 3] for the innermost dimension, and function estimates + >>> # partial derivative for both dimensions. + >>> t = torch.tensor([[1, 2, 4, 8], [10, 20, 40, 80]]) + >>> torch.gradient(t) + (tensor([[ 9., 18., 36., 72.], + [ 9., 18., 36., 72.]]), + tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]])) + + >>> # A scalar value for spacing modifies the relationship between tensor indices + >>> # and input coordinates by multiplying the indices to find the + >>> # coordinates. For example, below the indices of the innermost + >>> # 0, 1, 2, 3 translate to coordinates of [0, 2, 4, 6], and the indices of + >>> # the outermost dimension 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = 2.0) # dim = None (implicitly [0, 1]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.5000, 0.7500, 1.5000, 2.0000], + [ 5.0000, 7.5000, 15.0000, 20.0000]])) + >>> # doubling the spacing between samples halves the estimated partial gradients. + + >>> + >>> # Estimates only the partial derivative for dimension 1 + >>> torch.gradient(t, dim = 1) # spacing = None (implicitly 1.) + (tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]]),) + + >>> # When spacing is a list of scalars, the relationship between the tensor + >>> # indices and input coordinates changes based on dimension. + >>> # For example, below, the indices of the innermost dimension 0, 1, 2, 3 translate + >>> # to coordinates of [0, 3, 6, 9], and the indices of the outermost dimension + >>> # 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = [3., 2.]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + + >>> # The following example is a replication of the previous one with explicit + >>> # coordinates. + >>> coords = (torch.tensor([0, 2]), torch.tensor([0, 3, 6, 9])) + >>> torch.gradient(t, spacing = coords) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + """ + +@overload +def gradient( + input: Tensor, + *, + spacing: Sequence[Number | _complex], + dim: _int | None = None, + edge_order: _int = 1, +) -> tuple[Tensor, ...]: + r""" + gradient(input, *, spacing=1, dim=None, edge_order=1) -> List of Tensors + + Estimates the gradient of a function :math:`g : \mathbb{R}^n \rightarrow \mathbb{R}` in + one or more dimensions using the `second-order accurate central differences method + `_ and + either first or second order estimates at the boundaries. + + The gradient of :math:`g` is estimated using samples. By default, when :attr:`spacing` is not + specified, the samples are entirely described by :attr:`input`, and the mapping of input coordinates + to an output is the same as the tensor's mapping of indices to values. For example, for a three-dimensional + :attr:`input` the function described is :math:`g : \mathbb{R}^3 \rightarrow \mathbb{R}`, and + :math:`g(1, 2, 3)\ == input[1, 2, 3]`. + + When :attr:`spacing` is specified, it modifies the relationship between :attr:`input` and input coordinates. + This is detailed in the "Keyword Arguments" section below. + + The gradient is estimated by estimating each partial derivative of :math:`g` independently. This estimation is + accurate if :math:`g` is in :math:`C^3` (it has at least 3 continuous derivatives), and the estimation can be + improved by providing closer samples. Mathematically, the value at each interior point of a partial derivative + is estimated using `Taylor's theorem with remainder `_. + Letting :math:`x` be an interior point with :math:`x-h_l` and :math:`x+h_r` be points neighboring + it to the left and right respectively, :math:`f(x+h_r)` and :math:`f(x-h_l)` can be estimated using: + + .. math:: + \begin{aligned} + f(x+h_r) = f(x) + h_r f'(x) + {h_r}^2 \frac{f''(x)}{2} + {h_r}^3 \frac{f'''(\xi_1)}{6}, \xi_1 \in (x, x+h_r) \\ + f(x-h_l) = f(x) - h_l f'(x) + {h_l}^2 \frac{f''(x)}{2} - {h_l}^3 \frac{f'''(\xi_2)}{6}, \xi_2 \in (x, x-h_l) \\ + \end{aligned} + + Using the fact that :math:`f \in C^3` and solving the linear system, we derive: + + .. math:: + f'(x) \approx \frac{ {h_l}^2 f(x+h_r) - {h_r}^2 f(x-h_l) + + ({h_r}^2-{h_l}^2 ) f(x) }{ {h_r} {h_l}^2 + {h_r}^2 {h_l} } + + .. note:: + We estimate the gradient of functions in complex domain + :math:`g : \mathbb{C}^n \rightarrow \mathbb{C}` in the same way. + + The value of each partial derivative at the boundary points is computed differently. See edge_order below. + + Args: + input (``Tensor``): the tensor that represents the values of the function + + Keyword args: + spacing (``scalar``, ``list of scalar``, ``list of Tensor``, optional): :attr:`spacing` can be used to modify + how the :attr:`input` tensor's indices relate to sample coordinates. If :attr:`spacing` is a scalar then + the indices are multiplied by the scalar to produce the coordinates. For example, if :attr:`spacing=2` the + indices (1, 2, 3) become coordinates (2, 4, 6). If :attr:`spacing` is a list of scalars then the corresponding + indices are multiplied. For example, if :attr:`spacing=(2, -1, 3)` the indices (1, 2, 3) become coordinates (2, -2, 9). + Finally, if :attr:`spacing` is a list of one-dimensional tensors then each tensor specifies the coordinates for + the corresponding dimension. For example, if the indices are (1, 2, 3) and the tensors are (t0, t1, t2), then + the coordinates are (t0[1], t1[2], t2[3]) + + dim (``int``, ``list of int``, optional): the dimension or dimensions to approximate the gradient over. By default + the partial gradient in every dimension is computed. Note that when :attr:`dim` is specified the elements of + the :attr:`spacing` argument must correspond with the specified dims." + + edge_order (``int``, optional): 1 or 2, for `first-order + `_ or + `second-order `_ + estimation of the boundary ("edge") values, respectively. Note that when :attr:`edge_order` is specified, each + dimension size of :attr:`input` should be at least edge_order+1 + + Examples:: + + >>> # Estimates the gradient of f(x)=x^2 at points [-2, -1, 2, 4] + >>> coordinates = (torch.tensor([-2., -1., 1., 4.]),) + >>> values = torch.tensor([4., 1., 1., 16.], ) + >>> torch.gradient(values, spacing = coordinates) + (tensor([-3., -2., 2., 5.]),) + + >>> # Estimates the gradient of the R^2 -> R function whose samples are + >>> # described by the tensor t. Implicit coordinates are [0, 1] for the outermost + >>> # dimension and [0, 1, 2, 3] for the innermost dimension, and function estimates + >>> # partial derivative for both dimensions. + >>> t = torch.tensor([[1, 2, 4, 8], [10, 20, 40, 80]]) + >>> torch.gradient(t) + (tensor([[ 9., 18., 36., 72.], + [ 9., 18., 36., 72.]]), + tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]])) + + >>> # A scalar value for spacing modifies the relationship between tensor indices + >>> # and input coordinates by multiplying the indices to find the + >>> # coordinates. For example, below the indices of the innermost + >>> # 0, 1, 2, 3 translate to coordinates of [0, 2, 4, 6], and the indices of + >>> # the outermost dimension 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = 2.0) # dim = None (implicitly [0, 1]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.5000, 0.7500, 1.5000, 2.0000], + [ 5.0000, 7.5000, 15.0000, 20.0000]])) + >>> # doubling the spacing between samples halves the estimated partial gradients. + + >>> + >>> # Estimates only the partial derivative for dimension 1 + >>> torch.gradient(t, dim = 1) # spacing = None (implicitly 1.) + (tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]]),) + + >>> # When spacing is a list of scalars, the relationship between the tensor + >>> # indices and input coordinates changes based on dimension. + >>> # For example, below, the indices of the innermost dimension 0, 1, 2, 3 translate + >>> # to coordinates of [0, 3, 6, 9], and the indices of the outermost dimension + >>> # 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = [3., 2.]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + + >>> # The following example is a replication of the previous one with explicit + >>> # coordinates. + >>> coords = (torch.tensor([0, 2]), torch.tensor([0, 3, 6, 9])) + >>> torch.gradient(t, spacing = coords) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + """ + +@overload +def gradient( + input: Tensor, + *, + spacing: Sequence[Number | _complex], + dim: _size, + edge_order: _int = 1, +) -> tuple[Tensor, ...]: + r""" + gradient(input, *, spacing=1, dim=None, edge_order=1) -> List of Tensors + + Estimates the gradient of a function :math:`g : \mathbb{R}^n \rightarrow \mathbb{R}` in + one or more dimensions using the `second-order accurate central differences method + `_ and + either first or second order estimates at the boundaries. + + The gradient of :math:`g` is estimated using samples. By default, when :attr:`spacing` is not + specified, the samples are entirely described by :attr:`input`, and the mapping of input coordinates + to an output is the same as the tensor's mapping of indices to values. For example, for a three-dimensional + :attr:`input` the function described is :math:`g : \mathbb{R}^3 \rightarrow \mathbb{R}`, and + :math:`g(1, 2, 3)\ == input[1, 2, 3]`. + + When :attr:`spacing` is specified, it modifies the relationship between :attr:`input` and input coordinates. + This is detailed in the "Keyword Arguments" section below. + + The gradient is estimated by estimating each partial derivative of :math:`g` independently. This estimation is + accurate if :math:`g` is in :math:`C^3` (it has at least 3 continuous derivatives), and the estimation can be + improved by providing closer samples. Mathematically, the value at each interior point of a partial derivative + is estimated using `Taylor's theorem with remainder `_. + Letting :math:`x` be an interior point with :math:`x-h_l` and :math:`x+h_r` be points neighboring + it to the left and right respectively, :math:`f(x+h_r)` and :math:`f(x-h_l)` can be estimated using: + + .. math:: + \begin{aligned} + f(x+h_r) = f(x) + h_r f'(x) + {h_r}^2 \frac{f''(x)}{2} + {h_r}^3 \frac{f'''(\xi_1)}{6}, \xi_1 \in (x, x+h_r) \\ + f(x-h_l) = f(x) - h_l f'(x) + {h_l}^2 \frac{f''(x)}{2} - {h_l}^3 \frac{f'''(\xi_2)}{6}, \xi_2 \in (x, x-h_l) \\ + \end{aligned} + + Using the fact that :math:`f \in C^3` and solving the linear system, we derive: + + .. math:: + f'(x) \approx \frac{ {h_l}^2 f(x+h_r) - {h_r}^2 f(x-h_l) + + ({h_r}^2-{h_l}^2 ) f(x) }{ {h_r} {h_l}^2 + {h_r}^2 {h_l} } + + .. note:: + We estimate the gradient of functions in complex domain + :math:`g : \mathbb{C}^n \rightarrow \mathbb{C}` in the same way. + + The value of each partial derivative at the boundary points is computed differently. See edge_order below. + + Args: + input (``Tensor``): the tensor that represents the values of the function + + Keyword args: + spacing (``scalar``, ``list of scalar``, ``list of Tensor``, optional): :attr:`spacing` can be used to modify + how the :attr:`input` tensor's indices relate to sample coordinates. If :attr:`spacing` is a scalar then + the indices are multiplied by the scalar to produce the coordinates. For example, if :attr:`spacing=2` the + indices (1, 2, 3) become coordinates (2, 4, 6). If :attr:`spacing` is a list of scalars then the corresponding + indices are multiplied. For example, if :attr:`spacing=(2, -1, 3)` the indices (1, 2, 3) become coordinates (2, -2, 9). + Finally, if :attr:`spacing` is a list of one-dimensional tensors then each tensor specifies the coordinates for + the corresponding dimension. For example, if the indices are (1, 2, 3) and the tensors are (t0, t1, t2), then + the coordinates are (t0[1], t1[2], t2[3]) + + dim (``int``, ``list of int``, optional): the dimension or dimensions to approximate the gradient over. By default + the partial gradient in every dimension is computed. Note that when :attr:`dim` is specified the elements of + the :attr:`spacing` argument must correspond with the specified dims." + + edge_order (``int``, optional): 1 or 2, for `first-order + `_ or + `second-order `_ + estimation of the boundary ("edge") values, respectively. Note that when :attr:`edge_order` is specified, each + dimension size of :attr:`input` should be at least edge_order+1 + + Examples:: + + >>> # Estimates the gradient of f(x)=x^2 at points [-2, -1, 2, 4] + >>> coordinates = (torch.tensor([-2., -1., 1., 4.]),) + >>> values = torch.tensor([4., 1., 1., 16.], ) + >>> torch.gradient(values, spacing = coordinates) + (tensor([-3., -2., 2., 5.]),) + + >>> # Estimates the gradient of the R^2 -> R function whose samples are + >>> # described by the tensor t. Implicit coordinates are [0, 1] for the outermost + >>> # dimension and [0, 1, 2, 3] for the innermost dimension, and function estimates + >>> # partial derivative for both dimensions. + >>> t = torch.tensor([[1, 2, 4, 8], [10, 20, 40, 80]]) + >>> torch.gradient(t) + (tensor([[ 9., 18., 36., 72.], + [ 9., 18., 36., 72.]]), + tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]])) + + >>> # A scalar value for spacing modifies the relationship between tensor indices + >>> # and input coordinates by multiplying the indices to find the + >>> # coordinates. For example, below the indices of the innermost + >>> # 0, 1, 2, 3 translate to coordinates of [0, 2, 4, 6], and the indices of + >>> # the outermost dimension 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = 2.0) # dim = None (implicitly [0, 1]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.5000, 0.7500, 1.5000, 2.0000], + [ 5.0000, 7.5000, 15.0000, 20.0000]])) + >>> # doubling the spacing between samples halves the estimated partial gradients. + + >>> + >>> # Estimates only the partial derivative for dimension 1 + >>> torch.gradient(t, dim = 1) # spacing = None (implicitly 1.) + (tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]]),) + + >>> # When spacing is a list of scalars, the relationship between the tensor + >>> # indices and input coordinates changes based on dimension. + >>> # For example, below, the indices of the innermost dimension 0, 1, 2, 3 translate + >>> # to coordinates of [0, 3, 6, 9], and the indices of the outermost dimension + >>> # 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = [3., 2.]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + + >>> # The following example is a replication of the previous one with explicit + >>> # coordinates. + >>> coords = (torch.tensor([0, 2]), torch.tensor([0, 3, 6, 9])) + >>> torch.gradient(t, spacing = coords) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + """ + +@overload +def gradient( + input: Tensor, + *, + spacing: tuple[Tensor, ...] | list[Tensor] | None, + dim: _int | None = None, + edge_order: _int = 1, +) -> tuple[Tensor, ...]: + r""" + gradient(input, *, spacing=1, dim=None, edge_order=1) -> List of Tensors + + Estimates the gradient of a function :math:`g : \mathbb{R}^n \rightarrow \mathbb{R}` in + one or more dimensions using the `second-order accurate central differences method + `_ and + either first or second order estimates at the boundaries. + + The gradient of :math:`g` is estimated using samples. By default, when :attr:`spacing` is not + specified, the samples are entirely described by :attr:`input`, and the mapping of input coordinates + to an output is the same as the tensor's mapping of indices to values. For example, for a three-dimensional + :attr:`input` the function described is :math:`g : \mathbb{R}^3 \rightarrow \mathbb{R}`, and + :math:`g(1, 2, 3)\ == input[1, 2, 3]`. + + When :attr:`spacing` is specified, it modifies the relationship between :attr:`input` and input coordinates. + This is detailed in the "Keyword Arguments" section below. + + The gradient is estimated by estimating each partial derivative of :math:`g` independently. This estimation is + accurate if :math:`g` is in :math:`C^3` (it has at least 3 continuous derivatives), and the estimation can be + improved by providing closer samples. Mathematically, the value at each interior point of a partial derivative + is estimated using `Taylor's theorem with remainder `_. + Letting :math:`x` be an interior point with :math:`x-h_l` and :math:`x+h_r` be points neighboring + it to the left and right respectively, :math:`f(x+h_r)` and :math:`f(x-h_l)` can be estimated using: + + .. math:: + \begin{aligned} + f(x+h_r) = f(x) + h_r f'(x) + {h_r}^2 \frac{f''(x)}{2} + {h_r}^3 \frac{f'''(\xi_1)}{6}, \xi_1 \in (x, x+h_r) \\ + f(x-h_l) = f(x) - h_l f'(x) + {h_l}^2 \frac{f''(x)}{2} - {h_l}^3 \frac{f'''(\xi_2)}{6}, \xi_2 \in (x, x-h_l) \\ + \end{aligned} + + Using the fact that :math:`f \in C^3` and solving the linear system, we derive: + + .. math:: + f'(x) \approx \frac{ {h_l}^2 f(x+h_r) - {h_r}^2 f(x-h_l) + + ({h_r}^2-{h_l}^2 ) f(x) }{ {h_r} {h_l}^2 + {h_r}^2 {h_l} } + + .. note:: + We estimate the gradient of functions in complex domain + :math:`g : \mathbb{C}^n \rightarrow \mathbb{C}` in the same way. + + The value of each partial derivative at the boundary points is computed differently. See edge_order below. + + Args: + input (``Tensor``): the tensor that represents the values of the function + + Keyword args: + spacing (``scalar``, ``list of scalar``, ``list of Tensor``, optional): :attr:`spacing` can be used to modify + how the :attr:`input` tensor's indices relate to sample coordinates. If :attr:`spacing` is a scalar then + the indices are multiplied by the scalar to produce the coordinates. For example, if :attr:`spacing=2` the + indices (1, 2, 3) become coordinates (2, 4, 6). If :attr:`spacing` is a list of scalars then the corresponding + indices are multiplied. For example, if :attr:`spacing=(2, -1, 3)` the indices (1, 2, 3) become coordinates (2, -2, 9). + Finally, if :attr:`spacing` is a list of one-dimensional tensors then each tensor specifies the coordinates for + the corresponding dimension. For example, if the indices are (1, 2, 3) and the tensors are (t0, t1, t2), then + the coordinates are (t0[1], t1[2], t2[3]) + + dim (``int``, ``list of int``, optional): the dimension or dimensions to approximate the gradient over. By default + the partial gradient in every dimension is computed. Note that when :attr:`dim` is specified the elements of + the :attr:`spacing` argument must correspond with the specified dims." + + edge_order (``int``, optional): 1 or 2, for `first-order + `_ or + `second-order `_ + estimation of the boundary ("edge") values, respectively. Note that when :attr:`edge_order` is specified, each + dimension size of :attr:`input` should be at least edge_order+1 + + Examples:: + + >>> # Estimates the gradient of f(x)=x^2 at points [-2, -1, 2, 4] + >>> coordinates = (torch.tensor([-2., -1., 1., 4.]),) + >>> values = torch.tensor([4., 1., 1., 16.], ) + >>> torch.gradient(values, spacing = coordinates) + (tensor([-3., -2., 2., 5.]),) + + >>> # Estimates the gradient of the R^2 -> R function whose samples are + >>> # described by the tensor t. Implicit coordinates are [0, 1] for the outermost + >>> # dimension and [0, 1, 2, 3] for the innermost dimension, and function estimates + >>> # partial derivative for both dimensions. + >>> t = torch.tensor([[1, 2, 4, 8], [10, 20, 40, 80]]) + >>> torch.gradient(t) + (tensor([[ 9., 18., 36., 72.], + [ 9., 18., 36., 72.]]), + tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]])) + + >>> # A scalar value for spacing modifies the relationship between tensor indices + >>> # and input coordinates by multiplying the indices to find the + >>> # coordinates. For example, below the indices of the innermost + >>> # 0, 1, 2, 3 translate to coordinates of [0, 2, 4, 6], and the indices of + >>> # the outermost dimension 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = 2.0) # dim = None (implicitly [0, 1]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.5000, 0.7500, 1.5000, 2.0000], + [ 5.0000, 7.5000, 15.0000, 20.0000]])) + >>> # doubling the spacing between samples halves the estimated partial gradients. + + >>> + >>> # Estimates only the partial derivative for dimension 1 + >>> torch.gradient(t, dim = 1) # spacing = None (implicitly 1.) + (tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]]),) + + >>> # When spacing is a list of scalars, the relationship between the tensor + >>> # indices and input coordinates changes based on dimension. + >>> # For example, below, the indices of the innermost dimension 0, 1, 2, 3 translate + >>> # to coordinates of [0, 3, 6, 9], and the indices of the outermost dimension + >>> # 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = [3., 2.]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + + >>> # The following example is a replication of the previous one with explicit + >>> # coordinates. + >>> coords = (torch.tensor([0, 2]), torch.tensor([0, 3, 6, 9])) + >>> torch.gradient(t, spacing = coords) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + """ + +@overload +def gradient( + input: Tensor, + *, + spacing: Number | _complex, + dim: _size, + edge_order: _int = 1, +) -> tuple[Tensor, ...]: + r""" + gradient(input, *, spacing=1, dim=None, edge_order=1) -> List of Tensors + + Estimates the gradient of a function :math:`g : \mathbb{R}^n \rightarrow \mathbb{R}` in + one or more dimensions using the `second-order accurate central differences method + `_ and + either first or second order estimates at the boundaries. + + The gradient of :math:`g` is estimated using samples. By default, when :attr:`spacing` is not + specified, the samples are entirely described by :attr:`input`, and the mapping of input coordinates + to an output is the same as the tensor's mapping of indices to values. For example, for a three-dimensional + :attr:`input` the function described is :math:`g : \mathbb{R}^3 \rightarrow \mathbb{R}`, and + :math:`g(1, 2, 3)\ == input[1, 2, 3]`. + + When :attr:`spacing` is specified, it modifies the relationship between :attr:`input` and input coordinates. + This is detailed in the "Keyword Arguments" section below. + + The gradient is estimated by estimating each partial derivative of :math:`g` independently. This estimation is + accurate if :math:`g` is in :math:`C^3` (it has at least 3 continuous derivatives), and the estimation can be + improved by providing closer samples. Mathematically, the value at each interior point of a partial derivative + is estimated using `Taylor's theorem with remainder `_. + Letting :math:`x` be an interior point with :math:`x-h_l` and :math:`x+h_r` be points neighboring + it to the left and right respectively, :math:`f(x+h_r)` and :math:`f(x-h_l)` can be estimated using: + + .. math:: + \begin{aligned} + f(x+h_r) = f(x) + h_r f'(x) + {h_r}^2 \frac{f''(x)}{2} + {h_r}^3 \frac{f'''(\xi_1)}{6}, \xi_1 \in (x, x+h_r) \\ + f(x-h_l) = f(x) - h_l f'(x) + {h_l}^2 \frac{f''(x)}{2} - {h_l}^3 \frac{f'''(\xi_2)}{6}, \xi_2 \in (x, x-h_l) \\ + \end{aligned} + + Using the fact that :math:`f \in C^3` and solving the linear system, we derive: + + .. math:: + f'(x) \approx \frac{ {h_l}^2 f(x+h_r) - {h_r}^2 f(x-h_l) + + ({h_r}^2-{h_l}^2 ) f(x) }{ {h_r} {h_l}^2 + {h_r}^2 {h_l} } + + .. note:: + We estimate the gradient of functions in complex domain + :math:`g : \mathbb{C}^n \rightarrow \mathbb{C}` in the same way. + + The value of each partial derivative at the boundary points is computed differently. See edge_order below. + + Args: + input (``Tensor``): the tensor that represents the values of the function + + Keyword args: + spacing (``scalar``, ``list of scalar``, ``list of Tensor``, optional): :attr:`spacing` can be used to modify + how the :attr:`input` tensor's indices relate to sample coordinates. If :attr:`spacing` is a scalar then + the indices are multiplied by the scalar to produce the coordinates. For example, if :attr:`spacing=2` the + indices (1, 2, 3) become coordinates (2, 4, 6). If :attr:`spacing` is a list of scalars then the corresponding + indices are multiplied. For example, if :attr:`spacing=(2, -1, 3)` the indices (1, 2, 3) become coordinates (2, -2, 9). + Finally, if :attr:`spacing` is a list of one-dimensional tensors then each tensor specifies the coordinates for + the corresponding dimension. For example, if the indices are (1, 2, 3) and the tensors are (t0, t1, t2), then + the coordinates are (t0[1], t1[2], t2[3]) + + dim (``int``, ``list of int``, optional): the dimension or dimensions to approximate the gradient over. By default + the partial gradient in every dimension is computed. Note that when :attr:`dim` is specified the elements of + the :attr:`spacing` argument must correspond with the specified dims." + + edge_order (``int``, optional): 1 or 2, for `first-order + `_ or + `second-order `_ + estimation of the boundary ("edge") values, respectively. Note that when :attr:`edge_order` is specified, each + dimension size of :attr:`input` should be at least edge_order+1 + + Examples:: + + >>> # Estimates the gradient of f(x)=x^2 at points [-2, -1, 2, 4] + >>> coordinates = (torch.tensor([-2., -1., 1., 4.]),) + >>> values = torch.tensor([4., 1., 1., 16.], ) + >>> torch.gradient(values, spacing = coordinates) + (tensor([-3., -2., 2., 5.]),) + + >>> # Estimates the gradient of the R^2 -> R function whose samples are + >>> # described by the tensor t. Implicit coordinates are [0, 1] for the outermost + >>> # dimension and [0, 1, 2, 3] for the innermost dimension, and function estimates + >>> # partial derivative for both dimensions. + >>> t = torch.tensor([[1, 2, 4, 8], [10, 20, 40, 80]]) + >>> torch.gradient(t) + (tensor([[ 9., 18., 36., 72.], + [ 9., 18., 36., 72.]]), + tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]])) + + >>> # A scalar value for spacing modifies the relationship between tensor indices + >>> # and input coordinates by multiplying the indices to find the + >>> # coordinates. For example, below the indices of the innermost + >>> # 0, 1, 2, 3 translate to coordinates of [0, 2, 4, 6], and the indices of + >>> # the outermost dimension 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = 2.0) # dim = None (implicitly [0, 1]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.5000, 0.7500, 1.5000, 2.0000], + [ 5.0000, 7.5000, 15.0000, 20.0000]])) + >>> # doubling the spacing between samples halves the estimated partial gradients. + + >>> + >>> # Estimates only the partial derivative for dimension 1 + >>> torch.gradient(t, dim = 1) # spacing = None (implicitly 1.) + (tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]]),) + + >>> # When spacing is a list of scalars, the relationship between the tensor + >>> # indices and input coordinates changes based on dimension. + >>> # For example, below, the indices of the innermost dimension 0, 1, 2, 3 translate + >>> # to coordinates of [0, 3, 6, 9], and the indices of the outermost dimension + >>> # 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = [3., 2.]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + + >>> # The following example is a replication of the previous one with explicit + >>> # coordinates. + >>> coords = (torch.tensor([0, 2]), torch.tensor([0, 3, 6, 9])) + >>> torch.gradient(t, spacing = coords) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + """ + +@overload +def gradient( + input: Tensor, + *, + spacing: tuple[Tensor, ...] | list[Tensor] | None, + dim: _size, + edge_order: _int = 1, +) -> tuple[Tensor, ...]: + r""" + gradient(input, *, spacing=1, dim=None, edge_order=1) -> List of Tensors + + Estimates the gradient of a function :math:`g : \mathbb{R}^n \rightarrow \mathbb{R}` in + one or more dimensions using the `second-order accurate central differences method + `_ and + either first or second order estimates at the boundaries. + + The gradient of :math:`g` is estimated using samples. By default, when :attr:`spacing` is not + specified, the samples are entirely described by :attr:`input`, and the mapping of input coordinates + to an output is the same as the tensor's mapping of indices to values. For example, for a three-dimensional + :attr:`input` the function described is :math:`g : \mathbb{R}^3 \rightarrow \mathbb{R}`, and + :math:`g(1, 2, 3)\ == input[1, 2, 3]`. + + When :attr:`spacing` is specified, it modifies the relationship between :attr:`input` and input coordinates. + This is detailed in the "Keyword Arguments" section below. + + The gradient is estimated by estimating each partial derivative of :math:`g` independently. This estimation is + accurate if :math:`g` is in :math:`C^3` (it has at least 3 continuous derivatives), and the estimation can be + improved by providing closer samples. Mathematically, the value at each interior point of a partial derivative + is estimated using `Taylor's theorem with remainder `_. + Letting :math:`x` be an interior point with :math:`x-h_l` and :math:`x+h_r` be points neighboring + it to the left and right respectively, :math:`f(x+h_r)` and :math:`f(x-h_l)` can be estimated using: + + .. math:: + \begin{aligned} + f(x+h_r) = f(x) + h_r f'(x) + {h_r}^2 \frac{f''(x)}{2} + {h_r}^3 \frac{f'''(\xi_1)}{6}, \xi_1 \in (x, x+h_r) \\ + f(x-h_l) = f(x) - h_l f'(x) + {h_l}^2 \frac{f''(x)}{2} - {h_l}^3 \frac{f'''(\xi_2)}{6}, \xi_2 \in (x, x-h_l) \\ + \end{aligned} + + Using the fact that :math:`f \in C^3` and solving the linear system, we derive: + + .. math:: + f'(x) \approx \frac{ {h_l}^2 f(x+h_r) - {h_r}^2 f(x-h_l) + + ({h_r}^2-{h_l}^2 ) f(x) }{ {h_r} {h_l}^2 + {h_r}^2 {h_l} } + + .. note:: + We estimate the gradient of functions in complex domain + :math:`g : \mathbb{C}^n \rightarrow \mathbb{C}` in the same way. + + The value of each partial derivative at the boundary points is computed differently. See edge_order below. + + Args: + input (``Tensor``): the tensor that represents the values of the function + + Keyword args: + spacing (``scalar``, ``list of scalar``, ``list of Tensor``, optional): :attr:`spacing` can be used to modify + how the :attr:`input` tensor's indices relate to sample coordinates. If :attr:`spacing` is a scalar then + the indices are multiplied by the scalar to produce the coordinates. For example, if :attr:`spacing=2` the + indices (1, 2, 3) become coordinates (2, 4, 6). If :attr:`spacing` is a list of scalars then the corresponding + indices are multiplied. For example, if :attr:`spacing=(2, -1, 3)` the indices (1, 2, 3) become coordinates (2, -2, 9). + Finally, if :attr:`spacing` is a list of one-dimensional tensors then each tensor specifies the coordinates for + the corresponding dimension. For example, if the indices are (1, 2, 3) and the tensors are (t0, t1, t2), then + the coordinates are (t0[1], t1[2], t2[3]) + + dim (``int``, ``list of int``, optional): the dimension or dimensions to approximate the gradient over. By default + the partial gradient in every dimension is computed. Note that when :attr:`dim` is specified the elements of + the :attr:`spacing` argument must correspond with the specified dims." + + edge_order (``int``, optional): 1 or 2, for `first-order + `_ or + `second-order `_ + estimation of the boundary ("edge") values, respectively. Note that when :attr:`edge_order` is specified, each + dimension size of :attr:`input` should be at least edge_order+1 + + Examples:: + + >>> # Estimates the gradient of f(x)=x^2 at points [-2, -1, 2, 4] + >>> coordinates = (torch.tensor([-2., -1., 1., 4.]),) + >>> values = torch.tensor([4., 1., 1., 16.], ) + >>> torch.gradient(values, spacing = coordinates) + (tensor([-3., -2., 2., 5.]),) + + >>> # Estimates the gradient of the R^2 -> R function whose samples are + >>> # described by the tensor t. Implicit coordinates are [0, 1] for the outermost + >>> # dimension and [0, 1, 2, 3] for the innermost dimension, and function estimates + >>> # partial derivative for both dimensions. + >>> t = torch.tensor([[1, 2, 4, 8], [10, 20, 40, 80]]) + >>> torch.gradient(t) + (tensor([[ 9., 18., 36., 72.], + [ 9., 18., 36., 72.]]), + tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]])) + + >>> # A scalar value for spacing modifies the relationship between tensor indices + >>> # and input coordinates by multiplying the indices to find the + >>> # coordinates. For example, below the indices of the innermost + >>> # 0, 1, 2, 3 translate to coordinates of [0, 2, 4, 6], and the indices of + >>> # the outermost dimension 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = 2.0) # dim = None (implicitly [0, 1]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.5000, 0.7500, 1.5000, 2.0000], + [ 5.0000, 7.5000, 15.0000, 20.0000]])) + >>> # doubling the spacing between samples halves the estimated partial gradients. + + >>> + >>> # Estimates only the partial derivative for dimension 1 + >>> torch.gradient(t, dim = 1) # spacing = None (implicitly 1.) + (tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]]),) + + >>> # When spacing is a list of scalars, the relationship between the tensor + >>> # indices and input coordinates changes based on dimension. + >>> # For example, below, the indices of the innermost dimension 0, 1, 2, 3 translate + >>> # to coordinates of [0, 3, 6, 9], and the indices of the outermost dimension + >>> # 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = [3., 2.]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + + >>> # The following example is a replication of the previous one with explicit + >>> # coordinates. + >>> coords = (torch.tensor([0, 2]), torch.tensor([0, 3, 6, 9])) + >>> torch.gradient(t, spacing = coords) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + """ + +@overload +def gradient( + input: Tensor, + *, + dim: _size, + edge_order: _int = 1, +) -> tuple[Tensor, ...]: + r""" + gradient(input, *, spacing=1, dim=None, edge_order=1) -> List of Tensors + + Estimates the gradient of a function :math:`g : \mathbb{R}^n \rightarrow \mathbb{R}` in + one or more dimensions using the `second-order accurate central differences method + `_ and + either first or second order estimates at the boundaries. + + The gradient of :math:`g` is estimated using samples. By default, when :attr:`spacing` is not + specified, the samples are entirely described by :attr:`input`, and the mapping of input coordinates + to an output is the same as the tensor's mapping of indices to values. For example, for a three-dimensional + :attr:`input` the function described is :math:`g : \mathbb{R}^3 \rightarrow \mathbb{R}`, and + :math:`g(1, 2, 3)\ == input[1, 2, 3]`. + + When :attr:`spacing` is specified, it modifies the relationship between :attr:`input` and input coordinates. + This is detailed in the "Keyword Arguments" section below. + + The gradient is estimated by estimating each partial derivative of :math:`g` independently. This estimation is + accurate if :math:`g` is in :math:`C^3` (it has at least 3 continuous derivatives), and the estimation can be + improved by providing closer samples. Mathematically, the value at each interior point of a partial derivative + is estimated using `Taylor's theorem with remainder `_. + Letting :math:`x` be an interior point with :math:`x-h_l` and :math:`x+h_r` be points neighboring + it to the left and right respectively, :math:`f(x+h_r)` and :math:`f(x-h_l)` can be estimated using: + + .. math:: + \begin{aligned} + f(x+h_r) = f(x) + h_r f'(x) + {h_r}^2 \frac{f''(x)}{2} + {h_r}^3 \frac{f'''(\xi_1)}{6}, \xi_1 \in (x, x+h_r) \\ + f(x-h_l) = f(x) - h_l f'(x) + {h_l}^2 \frac{f''(x)}{2} - {h_l}^3 \frac{f'''(\xi_2)}{6}, \xi_2 \in (x, x-h_l) \\ + \end{aligned} + + Using the fact that :math:`f \in C^3` and solving the linear system, we derive: + + .. math:: + f'(x) \approx \frac{ {h_l}^2 f(x+h_r) - {h_r}^2 f(x-h_l) + + ({h_r}^2-{h_l}^2 ) f(x) }{ {h_r} {h_l}^2 + {h_r}^2 {h_l} } + + .. note:: + We estimate the gradient of functions in complex domain + :math:`g : \mathbb{C}^n \rightarrow \mathbb{C}` in the same way. + + The value of each partial derivative at the boundary points is computed differently. See edge_order below. + + Args: + input (``Tensor``): the tensor that represents the values of the function + + Keyword args: + spacing (``scalar``, ``list of scalar``, ``list of Tensor``, optional): :attr:`spacing` can be used to modify + how the :attr:`input` tensor's indices relate to sample coordinates. If :attr:`spacing` is a scalar then + the indices are multiplied by the scalar to produce the coordinates. For example, if :attr:`spacing=2` the + indices (1, 2, 3) become coordinates (2, 4, 6). If :attr:`spacing` is a list of scalars then the corresponding + indices are multiplied. For example, if :attr:`spacing=(2, -1, 3)` the indices (1, 2, 3) become coordinates (2, -2, 9). + Finally, if :attr:`spacing` is a list of one-dimensional tensors then each tensor specifies the coordinates for + the corresponding dimension. For example, if the indices are (1, 2, 3) and the tensors are (t0, t1, t2), then + the coordinates are (t0[1], t1[2], t2[3]) + + dim (``int``, ``list of int``, optional): the dimension or dimensions to approximate the gradient over. By default + the partial gradient in every dimension is computed. Note that when :attr:`dim` is specified the elements of + the :attr:`spacing` argument must correspond with the specified dims." + + edge_order (``int``, optional): 1 or 2, for `first-order + `_ or + `second-order `_ + estimation of the boundary ("edge") values, respectively. Note that when :attr:`edge_order` is specified, each + dimension size of :attr:`input` should be at least edge_order+1 + + Examples:: + + >>> # Estimates the gradient of f(x)=x^2 at points [-2, -1, 2, 4] + >>> coordinates = (torch.tensor([-2., -1., 1., 4.]),) + >>> values = torch.tensor([4., 1., 1., 16.], ) + >>> torch.gradient(values, spacing = coordinates) + (tensor([-3., -2., 2., 5.]),) + + >>> # Estimates the gradient of the R^2 -> R function whose samples are + >>> # described by the tensor t. Implicit coordinates are [0, 1] for the outermost + >>> # dimension and [0, 1, 2, 3] for the innermost dimension, and function estimates + >>> # partial derivative for both dimensions. + >>> t = torch.tensor([[1, 2, 4, 8], [10, 20, 40, 80]]) + >>> torch.gradient(t) + (tensor([[ 9., 18., 36., 72.], + [ 9., 18., 36., 72.]]), + tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]])) + + >>> # A scalar value for spacing modifies the relationship between tensor indices + >>> # and input coordinates by multiplying the indices to find the + >>> # coordinates. For example, below the indices of the innermost + >>> # 0, 1, 2, 3 translate to coordinates of [0, 2, 4, 6], and the indices of + >>> # the outermost dimension 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = 2.0) # dim = None (implicitly [0, 1]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.5000, 0.7500, 1.5000, 2.0000], + [ 5.0000, 7.5000, 15.0000, 20.0000]])) + >>> # doubling the spacing between samples halves the estimated partial gradients. + + >>> + >>> # Estimates only the partial derivative for dimension 1 + >>> torch.gradient(t, dim = 1) # spacing = None (implicitly 1.) + (tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]]),) + + >>> # When spacing is a list of scalars, the relationship between the tensor + >>> # indices and input coordinates changes based on dimension. + >>> # For example, below, the indices of the innermost dimension 0, 1, 2, 3 translate + >>> # to coordinates of [0, 3, 6, 9], and the indices of the outermost dimension + >>> # 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = [3., 2.]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + + >>> # The following example is a replication of the previous one with explicit + >>> # coordinates. + >>> coords = (torch.tensor([0, 2]), torch.tensor([0, 3, 6, 9])) + >>> torch.gradient(t, spacing = coords) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + """ + +@overload +def greater( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + greater(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.gt`. + """ + +@overload +def greater( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + greater(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.gt`. + """ + +@overload +def greater_equal( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + greater_equal(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.ge`. + """ + +@overload +def greater_equal( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + greater_equal(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.ge`. + """ + +def grid_sampler( + input: Tensor, + grid: Tensor, + interpolation_mode: _int, + padding_mode: _int, + align_corners: _bool, +) -> Tensor: ... +def grid_sampler_2d( + input: Tensor, + grid: Tensor, + interpolation_mode: _int, + padding_mode: _int, + align_corners: _bool, +) -> Tensor: ... +def grid_sampler_3d( + input: Tensor, + grid: Tensor, + interpolation_mode: _int, + padding_mode: _int, + align_corners: _bool, +) -> Tensor: ... +def group_norm( + input: Tensor, + num_groups: _int, + weight: Tensor | None = None, + bias: Tensor | None = None, + eps: _float = 1e-05, + cudnn_enabled: _bool = True, +) -> Tensor: ... +@overload +def gru( + data: Tensor, + batch_sizes: Tensor, + hx: Tensor, + params: tuple[Tensor, ...] | list[Tensor] | None, + has_biases: _bool, + num_layers: _int, + dropout: _float, + train: _bool, + bidirectional: _bool, +) -> tuple[Tensor, Tensor]: ... +@overload +def gru( + input: Tensor, + hx: Tensor, + params: tuple[Tensor, ...] | list[Tensor] | None, + has_biases: _bool, + num_layers: _int, + dropout: _float, + train: _bool, + bidirectional: _bool, + batch_first: _bool, +) -> tuple[Tensor, Tensor]: ... +def gru_cell( + input: Tensor, + hx: Tensor, + w_ih: Tensor, + w_hh: Tensor, + b_ih: Tensor | None = None, + b_hh: Tensor | None = None, +) -> Tensor: ... +@overload +def gt( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + gt(input, other, *, out=None) -> Tensor + + Computes :math:`\text{input} > \text{other}` element-wise. + + + The second argument can be a number or a tensor whose shape is + :ref:`broadcastable ` with the first argument. + + Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is greater than :attr:`other` and False elsewhere + + Example:: + + >>> torch.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[False, True], [False, False]]) + """ + +@overload +def gt( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + gt(input, other, *, out=None) -> Tensor + + Computes :math:`\text{input} > \text{other}` element-wise. + + + The second argument can be a number or a tensor whose shape is + :ref:`broadcastable ` with the first argument. + + Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is greater than :attr:`other` and False elsewhere + + Example:: + + >>> torch.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[False, True], [False, False]]) + """ + +@overload +def hamming_window( + window_length: _int, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + hamming_window(window_length, *, dtype=None, layout=None, device=None, pin_memory=False, requires_grad=False) -> Tensor + + Hamming window function. + + .. math:: + w[n] = \alpha - \beta\ \cos \left( \frac{2 \pi n}{N - 1} \right), + + where :math:`N` is the full window size. + + The input :attr:`window_length` is a positive integer controlling the + returned window size. :attr:`periodic` flag determines whether the returned + window trims off the last duplicate value from the symmetric window and is + ready to be used as a periodic window with functions like + :meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in + above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have + ``torch.hamming_window(L, periodic=True)`` equal to + ``torch.hamming_window(L + 1, periodic=False)[:-1])``. + + .. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. + + .. note:: + This is a generalized version of :meth:`torch.hann_window`. + + Arguments: + window_length (int): the size of returned window + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + + .. function:: hamming_window(window_length, periodic, *, dtype=None, layout=None, device=None, \ + pin_memory=False, requires_grad=False) -> Tensor + :noindex: + + Hamming window function with periodic specified. + + Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + + .. function:: hamming_window(window_length, periodic, float alpha, *, dtype=None, layout=None, device=None, \ + pin_memory=False, requires_grad=False) -> Tensor + :noindex: + + Hamming window function with periodic and alpha specified. + + Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + alpha (float): The coefficient :math:`\alpha` in the equation above + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + + .. function:: hamming_window(window_length, periodic, float alpha, float beta, *, dtype=None, layout=None, \ + device=None, pin_memory=False, requires_grad=False) -> Tensor + :noindex: + + Hamming window function with periodic, alpha and beta specified. + + Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + alpha (float): The coefficient :math:`\alpha` in the equation above + beta (float): The coefficient :math:`\beta` in the equation above + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + """ + +@overload +def hamming_window( + window_length: _int, + periodic: _bool, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + hamming_window(window_length, *, dtype=None, layout=None, device=None, pin_memory=False, requires_grad=False) -> Tensor + + Hamming window function. + + .. math:: + w[n] = \alpha - \beta\ \cos \left( \frac{2 \pi n}{N - 1} \right), + + where :math:`N` is the full window size. + + The input :attr:`window_length` is a positive integer controlling the + returned window size. :attr:`periodic` flag determines whether the returned + window trims off the last duplicate value from the symmetric window and is + ready to be used as a periodic window with functions like + :meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in + above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have + ``torch.hamming_window(L, periodic=True)`` equal to + ``torch.hamming_window(L + 1, periodic=False)[:-1])``. + + .. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. + + .. note:: + This is a generalized version of :meth:`torch.hann_window`. + + Arguments: + window_length (int): the size of returned window + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + + .. function:: hamming_window(window_length, periodic, *, dtype=None, layout=None, device=None, \ + pin_memory=False, requires_grad=False) -> Tensor + :noindex: + + Hamming window function with periodic specified. + + Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + + .. function:: hamming_window(window_length, periodic, float alpha, *, dtype=None, layout=None, device=None, \ + pin_memory=False, requires_grad=False) -> Tensor + :noindex: + + Hamming window function with periodic and alpha specified. + + Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + alpha (float): The coefficient :math:`\alpha` in the equation above + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + + .. function:: hamming_window(window_length, periodic, float alpha, float beta, *, dtype=None, layout=None, \ + device=None, pin_memory=False, requires_grad=False) -> Tensor + :noindex: + + Hamming window function with periodic, alpha and beta specified. + + Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + alpha (float): The coefficient :math:`\alpha` in the equation above + beta (float): The coefficient :math:`\beta` in the equation above + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + """ + +@overload +def hamming_window( + window_length: _int, + periodic: _bool, + alpha: _float, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + hamming_window(window_length, *, dtype=None, layout=None, device=None, pin_memory=False, requires_grad=False) -> Tensor + + Hamming window function. + + .. math:: + w[n] = \alpha - \beta\ \cos \left( \frac{2 \pi n}{N - 1} \right), + + where :math:`N` is the full window size. + + The input :attr:`window_length` is a positive integer controlling the + returned window size. :attr:`periodic` flag determines whether the returned + window trims off the last duplicate value from the symmetric window and is + ready to be used as a periodic window with functions like + :meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in + above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have + ``torch.hamming_window(L, periodic=True)`` equal to + ``torch.hamming_window(L + 1, periodic=False)[:-1])``. + + .. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. + + .. note:: + This is a generalized version of :meth:`torch.hann_window`. + + Arguments: + window_length (int): the size of returned window + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + + .. function:: hamming_window(window_length, periodic, *, dtype=None, layout=None, device=None, \ + pin_memory=False, requires_grad=False) -> Tensor + :noindex: + + Hamming window function with periodic specified. + + Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + + .. function:: hamming_window(window_length, periodic, float alpha, *, dtype=None, layout=None, device=None, \ + pin_memory=False, requires_grad=False) -> Tensor + :noindex: + + Hamming window function with periodic and alpha specified. + + Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + alpha (float): The coefficient :math:`\alpha` in the equation above + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + + .. function:: hamming_window(window_length, periodic, float alpha, float beta, *, dtype=None, layout=None, \ + device=None, pin_memory=False, requires_grad=False) -> Tensor + :noindex: + + Hamming window function with periodic, alpha and beta specified. + + Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + alpha (float): The coefficient :math:`\alpha` in the equation above + beta (float): The coefficient :math:`\beta` in the equation above + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + """ + +@overload +def hamming_window( + window_length: _int, + periodic: _bool, + alpha: _float, + beta: _float, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + hamming_window(window_length, *, dtype=None, layout=None, device=None, pin_memory=False, requires_grad=False) -> Tensor + + Hamming window function. + + .. math:: + w[n] = \alpha - \beta\ \cos \left( \frac{2 \pi n}{N - 1} \right), + + where :math:`N` is the full window size. + + The input :attr:`window_length` is a positive integer controlling the + returned window size. :attr:`periodic` flag determines whether the returned + window trims off the last duplicate value from the symmetric window and is + ready to be used as a periodic window with functions like + :meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in + above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have + ``torch.hamming_window(L, periodic=True)`` equal to + ``torch.hamming_window(L + 1, periodic=False)[:-1])``. + + .. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. + + .. note:: + This is a generalized version of :meth:`torch.hann_window`. + + Arguments: + window_length (int): the size of returned window + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + + .. function:: hamming_window(window_length, periodic, *, dtype=None, layout=None, device=None, \ + pin_memory=False, requires_grad=False) -> Tensor + :noindex: + + Hamming window function with periodic specified. + + Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + + .. function:: hamming_window(window_length, periodic, float alpha, *, dtype=None, layout=None, device=None, \ + pin_memory=False, requires_grad=False) -> Tensor + :noindex: + + Hamming window function with periodic and alpha specified. + + Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + alpha (float): The coefficient :math:`\alpha` in the equation above + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + + .. function:: hamming_window(window_length, periodic, float alpha, float beta, *, dtype=None, layout=None, \ + device=None, pin_memory=False, requires_grad=False) -> Tensor + :noindex: + + Hamming window function with periodic, alpha and beta specified. + + Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + alpha (float): The coefficient :math:`\alpha` in the equation above + beta (float): The coefficient :math:`\beta` in the equation above + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window. + """ + +@overload +def hann_window( + window_length: _int, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + hann_window(window_length, periodic=True, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Hann window function. + + .. math:: + w[n] = \frac{1}{2}\ \left[1 - \cos \left( \frac{2 \pi n}{N - 1} \right)\right] = + \sin^2 \left( \frac{\pi n}{N - 1} \right), + + where :math:`N` is the full window size. + + The input :attr:`window_length` is a positive integer controlling the + returned window size. :attr:`periodic` flag determines whether the returned + window trims off the last duplicate value from the symmetric window and is + ready to be used as a periodic window with functions like + :meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in + above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have + ``torch.hann_window(L, periodic=True)`` equal to + ``torch.hann_window(L + 1, periodic=False)[:-1])``. + + .. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. + + Arguments: + window_length (int): the size of returned window + periodic (bool, optional): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window + """ + +@overload +def hann_window( + window_length: _int, + periodic: _bool, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + hann_window(window_length, periodic=True, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Hann window function. + + .. math:: + w[n] = \frac{1}{2}\ \left[1 - \cos \left( \frac{2 \pi n}{N - 1} \right)\right] = + \sin^2 \left( \frac{\pi n}{N - 1} \right), + + where :math:`N` is the full window size. + + The input :attr:`window_length` is a positive integer controlling the + returned window size. :attr:`periodic` flag determines whether the returned + window trims off the last duplicate value from the symmetric window and is + ready to be used as a periodic window with functions like + :meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in + above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have + ``torch.hann_window(L, periodic=True)`` equal to + ``torch.hann_window(L + 1, periodic=False)[:-1])``. + + .. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. + + Arguments: + window_length (int): the size of returned window + periodic (bool, optional): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Returns: + Tensor: A 1-D tensor of size :math:`(\text{window\_length},)` containing the window + """ + +def hardshrink( + input: Tensor, + lambd: Number | _complex = 0.5, + *, + out: Tensor | None = None, +) -> Tensor: ... +def hash_tensor( + input: Tensor, + dim: _int | _size = (), + *, + keepdim: _bool = False, + mode: _int = 0, + out: Tensor | None = None, +) -> Tensor: + r""" + hash_tensor(input, *, mode=0) -> Tensor + + Returns a hash of all elements in the :attr:`input` tensor. + + Currently only mode=0 (reduction via xor) is supported. The output will always + be of type ``torch.uint64``. The elements of ``input`` are upcasted to their + 64 bit float / integer equivalent and bitcasted to ``torch.uint64`` before + reduction via xor. + + Args: + input (Tensor): the input tensor. + + Keyword Args: + mode (int) : The hash to use. Default: 0 (xor_reduction) + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 1.1918, -1.1813, 0.3373]]) + >>> torch.hash_tensor(a) + tensor(13822780554648485888, dtype=torch.uint64) + + .. function:: hash_tensor(input, dim, *, keepdim=False, mode=0) -> Tensor + :noindex: + + Returns the hash of each row of the :attr:`input` tensor in the given + dimension :attr:`dim` given by mode. If :attr:`dim` is a list of dimensions, + reduce over all of them. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword Args: + mode (int) : The hash to use. Default: 0 (xor_reduction) + + Example:: + + >>> a = torch.randn(2, 4) + >>> a + tensor([[ 0.1317, -0.5554, -1.4724, -1.1391], + [ 0.0778, -0.6070, 0.6375, 0.1798]]) + >>> torch.hash_tensor(a, 1) + tensor([9233691267014066176, 9255993250844508160], dtype=torch.uint64) + """ + +def heaviside( + input: Tensor, + values: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + heaviside(input, values, *, out=None) -> Tensor + + Computes the Heaviside step function for each element in :attr:`input`. + The Heaviside step function is defined as: + + .. math:: + \text{{heaviside}}(input, values) = \begin{cases} + 0, & \text{if input < 0}\\ + values, & \text{if input == 0}\\ + 1, & \text{if input > 0} + \end{cases} + + + Args: + input (Tensor): the input tensor. + values (Tensor): The values to use where :attr:`input` is zero. + + Keyword arguments: + out (Tensor, optional): the output tensor. + + Example:: + + >>> input = torch.tensor([-1.5, 0, 2.0]) + >>> values = torch.tensor([0.5]) + >>> torch.heaviside(input, values) + tensor([0.0000, 0.5000, 1.0000]) + >>> values = torch.tensor([1.2, -2.0, 3.5]) + >>> torch.heaviside(input, values) + tensor([0., -2., 1.]) + """ + +def hinge_embedding_loss( + input: Tensor, + target: Tensor, + margin: _float = 1.0, + reduction: _int = 1, +) -> Tensor: ... +def histc( + input: Tensor, + bins: _int = 100, + min: Number | _complex = 0, + max: Number | _complex = 0, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + histc(input, bins=100, min=0, max=0, *, out=None) -> Tensor + + Computes the histogram of a tensor. + + The elements are sorted into equal width bins between :attr:`min` and + :attr:`max`. If :attr:`min` and :attr:`max` are both zero, the minimum and + maximum values of the data are used. + + Elements lower than min and higher than max and ``NaN`` elements are ignored. + + Args: + input (Tensor): the input tensor. + bins (int): number of histogram bins + min (Scalar): lower end of the range (inclusive) + max (Scalar): upper end of the range (inclusive) + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + Tensor: Histogram represented as a tensor + + Example:: + + >>> torch.histc(torch.tensor([1., 2, 1]), bins=4, min=0, max=3) + tensor([ 0., 2., 1., 0.]) + """ + +@overload +def histogram( + input: Tensor, + bins: Tensor, + *, + weight: Tensor | None = None, + density: _bool = False, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.histogram: + r""" + histogram(input, bins, *, range=None, weight=None, density=False, out=None) -> (Tensor, Tensor) + + Computes a histogram of the values in a tensor. + + :attr:`bins` can be an integer or a 1D tensor. + + If :attr:`bins` is an int, it specifies the number of equal-width bins. + By default, the lower and upper range of the bins is determined by the + minimum and maximum elements of the input tensor. The :attr:`range` + argument can be provided to specify a range for the bins. + + If :attr:`bins` is a 1D tensor, it specifies the sequence of bin edges + including the rightmost edge. It should contain at least 2 elements + and its elements should be increasing. + + Args: + input (Tensor): the input tensor. + bins: int or 1D Tensor. If int, defines the number of equal-width bins. If tensor, + defines the sequence of bin edges including the rightmost edge. + + Keyword args: + range (tuple of float): Defines the range of the bins. + weight (Tensor): If provided, weight should have the same shape as input. Each value in + input contributes its associated weight towards its bin's result. + density (bool): If False, the result will contain the count (or total weight) in each bin. + If True, the result is the value of the probability density function over the bins, + normalized such that the integral over the range of the bins is 1. + out (Tensor, optional): the output tensor. (tuple, optional): The result tuple of two output tensors (hist, bin_edges). + + Returns: + hist (Tensor): 1D Tensor containing the values of the histogram. + bin_edges(Tensor): 1D Tensor containing the edges of the histogram bins. + + Example:: + + >>> torch.histogram(torch.tensor([1., 2, 1]), bins=4, range=(0., 3.), weight=torch.tensor([1., 2., 4.])) + (tensor([ 0., 5., 2., 0.]), tensor([0., 0.75, 1.5, 2.25, 3.])) + >>> torch.histogram(torch.tensor([1., 2, 1]), bins=4, range=(0., 3.), weight=torch.tensor([1., 2., 4.]), density=True) + (tensor([ 0., 0.9524, 0.3810, 0.]), tensor([0., 0.75, 1.5, 2.25, 3.])) + """ + +@overload +def histogram( + input: Tensor, + bins: _int = 100, + *, + range: Sequence[_float] | None = None, + weight: Tensor | None = None, + density: _bool = False, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.histogram: + r""" + histogram(input, bins, *, range=None, weight=None, density=False, out=None) -> (Tensor, Tensor) + + Computes a histogram of the values in a tensor. + + :attr:`bins` can be an integer or a 1D tensor. + + If :attr:`bins` is an int, it specifies the number of equal-width bins. + By default, the lower and upper range of the bins is determined by the + minimum and maximum elements of the input tensor. The :attr:`range` + argument can be provided to specify a range for the bins. + + If :attr:`bins` is a 1D tensor, it specifies the sequence of bin edges + including the rightmost edge. It should contain at least 2 elements + and its elements should be increasing. + + Args: + input (Tensor): the input tensor. + bins: int or 1D Tensor. If int, defines the number of equal-width bins. If tensor, + defines the sequence of bin edges including the rightmost edge. + + Keyword args: + range (tuple of float): Defines the range of the bins. + weight (Tensor): If provided, weight should have the same shape as input. Each value in + input contributes its associated weight towards its bin's result. + density (bool): If False, the result will contain the count (or total weight) in each bin. + If True, the result is the value of the probability density function over the bins, + normalized such that the integral over the range of the bins is 1. + out (Tensor, optional): the output tensor. (tuple, optional): The result tuple of two output tensors (hist, bin_edges). + + Returns: + hist (Tensor): 1D Tensor containing the values of the histogram. + bin_edges(Tensor): 1D Tensor containing the edges of the histogram bins. + + Example:: + + >>> torch.histogram(torch.tensor([1., 2, 1]), bins=4, range=(0., 3.), weight=torch.tensor([1., 2., 4.])) + (tensor([ 0., 5., 2., 0.]), tensor([0., 0.75, 1.5, 2.25, 3.])) + >>> torch.histogram(torch.tensor([1., 2, 1]), bins=4, range=(0., 3.), weight=torch.tensor([1., 2., 4.]), density=True) + (tensor([ 0., 0.9524, 0.3810, 0.]), tensor([0., 0.75, 1.5, 2.25, 3.])) + """ + +@overload +def histogramdd( + input: Tensor, + bins: _int, + range: Sequence[_float] | None = None, + weight: Tensor | None = None, + density: _bool = False, +) -> torch.return_types.histogramdd: + r""" + histogramdd(input, bins, *, range=None, weight=None, density=False, out=None) -> (Tensor, Tensor[]) + + Computes a multi-dimensional histogram of the values in a tensor. + + Interprets the elements of an input tensor whose innermost dimension has size N + as a collection of N-dimensional points. Maps each of the points into a set of + N-dimensional bins and returns the number of points (or total weight) in each bin. + + :attr:`input` must be a tensor with at least 2 dimensions. + If input has shape (M, N), each of its M rows defines a point in N-dimensional space. + If input has three or more dimensions, all but the last dimension are flattened. + + Each dimension is independently associated with its own strictly increasing sequence + of bin edges. Bin edges may be specified explicitly by passing a sequence of 1D + tensors. Alternatively, bin edges may be constructed automatically by passing a + sequence of integers specifying the number of equal-width bins in each dimension. + + For each N-dimensional point in input: + - Each of its coordinates is binned independently among the bin edges + corresponding to its dimension + - Binning results are combined to identify the N-dimensional bin (if any) + into which the point falls + - If the point falls into a bin, the bin's count (or total weight) is incremented + - Points which do not fall into any bin do not contribute to the output + + :attr:`bins` can be a sequence of N 1D tensors, a sequence of N ints, or a single int. + + If :attr:`bins` is a sequence of N 1D tensors, it explicitly specifies the N sequences + of bin edges. Each 1D tensor should contain a strictly increasing sequence with at + least one element. A sequence of K bin edges defines K-1 bins, explicitly specifying + the left and right edges of all bins. Every bin is inclusive of its left edge. Only + the rightmost bin is inclusive of its right edge. + + If :attr:`bins` is a sequence of N ints, it specifies the number of equal-width bins + in each dimension. By default, the leftmost and rightmost bin edges in each dimension + are determined by the minimum and maximum elements of the input tensor in the + corresponding dimension. The :attr:`range` argument can be provided to manually + specify the leftmost and rightmost bin edges in each dimension. + + If :attr:`bins` is an int, it specifies the number of equal-width bins for all dimensions. + + .. note:: + See also :func:`torch.histogram`, which specifically computes 1D histograms. + While :func:`torch.histogramdd` infers the dimensionality of its bins and + binned values from the shape of :attr:`input`, :func:`torch.histogram` + accepts and flattens :attr:`input` of any shape. + + Args: + input (Tensor): the input tensor. + bins: Tensor[], int[], or int. + If Tensor[], defines the sequences of bin edges. + If int[], defines the number of equal-width bins in each dimension. + If int, defines the number of equal-width bins for all dimensions. + Keyword args: + range (sequence of float): Defines the leftmost and rightmost bin edges + in each dimension. + weight (Tensor): By default, each value in the input has weight 1. If a weight + tensor is passed, each N-dimensional coordinate in input + contributes its associated weight towards its bin's result. + The weight tensor should have the same shape as the :attr:`input` + tensor excluding its innermost dimension N. + density (bool): If False (default), the result will contain the count (or total weight) + in each bin. If True, each count (weight) is divided by the total count + (total weight), then divided by the volume of its associated bin. + Returns: + hist (Tensor): N-dimensional Tensor containing the values of the histogram. + bin_edges(Tensor[]): sequence of N 1D Tensors containing the bin edges. + + Example:: + + >>> torch.histogramdd(torch.tensor([[0., 1.], [1., 0.], [2., 0.], [2., 2.]]), bins=[3, 3], + ... weight=torch.tensor([1., 2., 4., 8.])) + torch.return_types.histogramdd( + hist=tensor([[0., 1., 0.], + [2., 0., 0.], + [4., 0., 8.]]), + bin_edges=(tensor([0.0000, 0.6667, 1.3333, 2.0000]), + tensor([0.0000, 0.6667, 1.3333, 2.0000]))) + + >>> torch.histogramdd(torch.tensor([[0., 0.], [1., 1.], [2., 2.]]), bins=[2, 2], + ... range=[0., 1., 0., 1.], density=True) + torch.return_types.histogramdd( + hist=tensor([[2., 0.], + [0., 2.]]), + bin_edges=(tensor([0.0000, 0.5000, 1.0000]), + tensor([0.0000, 0.5000, 1.0000]))) + """ + +@overload +def histogramdd( + input: Tensor, + bins: _size, + range: Sequence[_float] | None = None, + weight: Tensor | None = None, + density: _bool = False, +) -> torch.return_types.histogramdd: + r""" + histogramdd(input, bins, *, range=None, weight=None, density=False, out=None) -> (Tensor, Tensor[]) + + Computes a multi-dimensional histogram of the values in a tensor. + + Interprets the elements of an input tensor whose innermost dimension has size N + as a collection of N-dimensional points. Maps each of the points into a set of + N-dimensional bins and returns the number of points (or total weight) in each bin. + + :attr:`input` must be a tensor with at least 2 dimensions. + If input has shape (M, N), each of its M rows defines a point in N-dimensional space. + If input has three or more dimensions, all but the last dimension are flattened. + + Each dimension is independently associated with its own strictly increasing sequence + of bin edges. Bin edges may be specified explicitly by passing a sequence of 1D + tensors. Alternatively, bin edges may be constructed automatically by passing a + sequence of integers specifying the number of equal-width bins in each dimension. + + For each N-dimensional point in input: + - Each of its coordinates is binned independently among the bin edges + corresponding to its dimension + - Binning results are combined to identify the N-dimensional bin (if any) + into which the point falls + - If the point falls into a bin, the bin's count (or total weight) is incremented + - Points which do not fall into any bin do not contribute to the output + + :attr:`bins` can be a sequence of N 1D tensors, a sequence of N ints, or a single int. + + If :attr:`bins` is a sequence of N 1D tensors, it explicitly specifies the N sequences + of bin edges. Each 1D tensor should contain a strictly increasing sequence with at + least one element. A sequence of K bin edges defines K-1 bins, explicitly specifying + the left and right edges of all bins. Every bin is inclusive of its left edge. Only + the rightmost bin is inclusive of its right edge. + + If :attr:`bins` is a sequence of N ints, it specifies the number of equal-width bins + in each dimension. By default, the leftmost and rightmost bin edges in each dimension + are determined by the minimum and maximum elements of the input tensor in the + corresponding dimension. The :attr:`range` argument can be provided to manually + specify the leftmost and rightmost bin edges in each dimension. + + If :attr:`bins` is an int, it specifies the number of equal-width bins for all dimensions. + + .. note:: + See also :func:`torch.histogram`, which specifically computes 1D histograms. + While :func:`torch.histogramdd` infers the dimensionality of its bins and + binned values from the shape of :attr:`input`, :func:`torch.histogram` + accepts and flattens :attr:`input` of any shape. + + Args: + input (Tensor): the input tensor. + bins: Tensor[], int[], or int. + If Tensor[], defines the sequences of bin edges. + If int[], defines the number of equal-width bins in each dimension. + If int, defines the number of equal-width bins for all dimensions. + Keyword args: + range (sequence of float): Defines the leftmost and rightmost bin edges + in each dimension. + weight (Tensor): By default, each value in the input has weight 1. If a weight + tensor is passed, each N-dimensional coordinate in input + contributes its associated weight towards its bin's result. + The weight tensor should have the same shape as the :attr:`input` + tensor excluding its innermost dimension N. + density (bool): If False (default), the result will contain the count (or total weight) + in each bin. If True, each count (weight) is divided by the total count + (total weight), then divided by the volume of its associated bin. + Returns: + hist (Tensor): N-dimensional Tensor containing the values of the histogram. + bin_edges(Tensor[]): sequence of N 1D Tensors containing the bin edges. + + Example:: + + >>> torch.histogramdd(torch.tensor([[0., 1.], [1., 0.], [2., 0.], [2., 2.]]), bins=[3, 3], + ... weight=torch.tensor([1., 2., 4., 8.])) + torch.return_types.histogramdd( + hist=tensor([[0., 1., 0.], + [2., 0., 0.], + [4., 0., 8.]]), + bin_edges=(tensor([0.0000, 0.6667, 1.3333, 2.0000]), + tensor([0.0000, 0.6667, 1.3333, 2.0000]))) + + >>> torch.histogramdd(torch.tensor([[0., 0.], [1., 1.], [2., 2.]]), bins=[2, 2], + ... range=[0., 1., 0., 1.], density=True) + torch.return_types.histogramdd( + hist=tensor([[2., 0.], + [0., 2.]]), + bin_edges=(tensor([0.0000, 0.5000, 1.0000]), + tensor([0.0000, 0.5000, 1.0000]))) + """ + +@overload +def histogramdd( + input: Tensor, + bins: tuple[Tensor, ...] | list[Tensor] | None, + range: Sequence[_float] | None = None, + weight: Tensor | None = None, + density: _bool = False, +) -> torch.return_types.histogramdd: + r""" + histogramdd(input, bins, *, range=None, weight=None, density=False, out=None) -> (Tensor, Tensor[]) + + Computes a multi-dimensional histogram of the values in a tensor. + + Interprets the elements of an input tensor whose innermost dimension has size N + as a collection of N-dimensional points. Maps each of the points into a set of + N-dimensional bins and returns the number of points (or total weight) in each bin. + + :attr:`input` must be a tensor with at least 2 dimensions. + If input has shape (M, N), each of its M rows defines a point in N-dimensional space. + If input has three or more dimensions, all but the last dimension are flattened. + + Each dimension is independently associated with its own strictly increasing sequence + of bin edges. Bin edges may be specified explicitly by passing a sequence of 1D + tensors. Alternatively, bin edges may be constructed automatically by passing a + sequence of integers specifying the number of equal-width bins in each dimension. + + For each N-dimensional point in input: + - Each of its coordinates is binned independently among the bin edges + corresponding to its dimension + - Binning results are combined to identify the N-dimensional bin (if any) + into which the point falls + - If the point falls into a bin, the bin's count (or total weight) is incremented + - Points which do not fall into any bin do not contribute to the output + + :attr:`bins` can be a sequence of N 1D tensors, a sequence of N ints, or a single int. + + If :attr:`bins` is a sequence of N 1D tensors, it explicitly specifies the N sequences + of bin edges. Each 1D tensor should contain a strictly increasing sequence with at + least one element. A sequence of K bin edges defines K-1 bins, explicitly specifying + the left and right edges of all bins. Every bin is inclusive of its left edge. Only + the rightmost bin is inclusive of its right edge. + + If :attr:`bins` is a sequence of N ints, it specifies the number of equal-width bins + in each dimension. By default, the leftmost and rightmost bin edges in each dimension + are determined by the minimum and maximum elements of the input tensor in the + corresponding dimension. The :attr:`range` argument can be provided to manually + specify the leftmost and rightmost bin edges in each dimension. + + If :attr:`bins` is an int, it specifies the number of equal-width bins for all dimensions. + + .. note:: + See also :func:`torch.histogram`, which specifically computes 1D histograms. + While :func:`torch.histogramdd` infers the dimensionality of its bins and + binned values from the shape of :attr:`input`, :func:`torch.histogram` + accepts and flattens :attr:`input` of any shape. + + Args: + input (Tensor): the input tensor. + bins: Tensor[], int[], or int. + If Tensor[], defines the sequences of bin edges. + If int[], defines the number of equal-width bins in each dimension. + If int, defines the number of equal-width bins for all dimensions. + Keyword args: + range (sequence of float): Defines the leftmost and rightmost bin edges + in each dimension. + weight (Tensor): By default, each value in the input has weight 1. If a weight + tensor is passed, each N-dimensional coordinate in input + contributes its associated weight towards its bin's result. + The weight tensor should have the same shape as the :attr:`input` + tensor excluding its innermost dimension N. + density (bool): If False (default), the result will contain the count (or total weight) + in each bin. If True, each count (weight) is divided by the total count + (total weight), then divided by the volume of its associated bin. + Returns: + hist (Tensor): N-dimensional Tensor containing the values of the histogram. + bin_edges(Tensor[]): sequence of N 1D Tensors containing the bin edges. + + Example:: + + >>> torch.histogramdd(torch.tensor([[0., 1.], [1., 0.], [2., 0.], [2., 2.]]), bins=[3, 3], + ... weight=torch.tensor([1., 2., 4., 8.])) + torch.return_types.histogramdd( + hist=tensor([[0., 1., 0.], + [2., 0., 0.], + [4., 0., 8.]]), + bin_edges=(tensor([0.0000, 0.6667, 1.3333, 2.0000]), + tensor([0.0000, 0.6667, 1.3333, 2.0000]))) + + >>> torch.histogramdd(torch.tensor([[0., 0.], [1., 1.], [2., 2.]]), bins=[2, 2], + ... range=[0., 1., 0., 1.], density=True) + torch.return_types.histogramdd( + hist=tensor([[2., 0.], + [0., 2.]]), + bin_edges=(tensor([0.0000, 0.5000, 1.0000]), + tensor([0.0000, 0.5000, 1.0000]))) + """ + +def hsmm(input: Tensor, mat2: Tensor) -> Tensor: ... +@overload +def hsplit(input: Tensor, sections: _int) -> tuple[Tensor, ...]: + r""" + hsplit(input, indices_or_sections) -> List of Tensors + + Splits :attr:`input`, a tensor with one or more dimensions, into multiple tensors + horizontally according to :attr:`indices_or_sections`. Each split is a view of + :attr:`input`. + + If :attr:`input` is one dimensional this is equivalent to calling + torch.tensor_split(input, indices_or_sections, dim=0) (the split dimension is + zero), and if :attr:`input` has two or more dimensions it's equivalent to calling + torch.tensor_split(input, indices_or_sections, dim=1) (the split dimension is 1), + except that if :attr:`indices_or_sections` is an integer it must evenly divide + the split dimension or a runtime error will be thrown. + + This function is based on NumPy's :func:`numpy.hsplit`. + + Args: + input (Tensor): tensor to split. + indices_or_sections (int or list or tuple of ints): See argument in :func:`torch.tensor_split`. + + Example:: + + >>> t = torch.arange(16.0).reshape(4,4) + >>> t + tensor([[ 0., 1., 2., 3.], + [ 4., 5., 6., 7.], + [ 8., 9., 10., 11.], + [12., 13., 14., 15.]]) + >>> torch.hsplit(t, 2) + (tensor([[ 0., 1.], + [ 4., 5.], + [ 8., 9.], + [12., 13.]]), + tensor([[ 2., 3.], + [ 6., 7.], + [10., 11.], + [14., 15.]])) + >>> torch.hsplit(t, [3, 6]) + (tensor([[ 0., 1., 2.], + [ 4., 5., 6.], + [ 8., 9., 10.], + [12., 13., 14.]]), + tensor([[ 3.], + [ 7.], + [11.], + [15.]]), + tensor([], size=(4, 0))) + """ + +@overload +def hsplit(input: Tensor, indices: _size) -> tuple[Tensor, ...]: + r""" + hsplit(input, indices_or_sections) -> List of Tensors + + Splits :attr:`input`, a tensor with one or more dimensions, into multiple tensors + horizontally according to :attr:`indices_or_sections`. Each split is a view of + :attr:`input`. + + If :attr:`input` is one dimensional this is equivalent to calling + torch.tensor_split(input, indices_or_sections, dim=0) (the split dimension is + zero), and if :attr:`input` has two or more dimensions it's equivalent to calling + torch.tensor_split(input, indices_or_sections, dim=1) (the split dimension is 1), + except that if :attr:`indices_or_sections` is an integer it must evenly divide + the split dimension or a runtime error will be thrown. + + This function is based on NumPy's :func:`numpy.hsplit`. + + Args: + input (Tensor): tensor to split. + indices_or_sections (int or list or tuple of ints): See argument in :func:`torch.tensor_split`. + + Example:: + + >>> t = torch.arange(16.0).reshape(4,4) + >>> t + tensor([[ 0., 1., 2., 3.], + [ 4., 5., 6., 7.], + [ 8., 9., 10., 11.], + [12., 13., 14., 15.]]) + >>> torch.hsplit(t, 2) + (tensor([[ 0., 1.], + [ 4., 5.], + [ 8., 9.], + [12., 13.]]), + tensor([[ 2., 3.], + [ 6., 7.], + [10., 11.], + [14., 15.]])) + >>> torch.hsplit(t, [3, 6]) + (tensor([[ 0., 1., 2.], + [ 4., 5., 6.], + [ 8., 9., 10.], + [12., 13., 14.]]), + tensor([[ 3.], + [ 7.], + [11.], + [15.]]), + tensor([], size=(4, 0))) + """ + +def hspmm( + mat1: Tensor, + mat2: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + hspmm(mat1, mat2, *, out=None) -> Tensor + + Performs a matrix multiplication of a :ref:`sparse COO matrix + ` :attr:`mat1` and a strided matrix :attr:`mat2`. The + result is a (1 + 1)-dimensional :ref:`hybrid COO matrix + `. + + Args: + mat1 (Tensor): the first sparse matrix to be matrix multiplied + mat2 (Tensor): the second strided matrix to be matrix multiplied + + Keyword args: + out (Tensor, optional): the output tensor. + """ + +def hstack( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + hstack(tensors, *, out=None) -> Tensor + + Stack tensors in sequence horizontally (column wise). + + This is equivalent to concatenation along the first axis for 1-D tensors, and along the second axis for all other tensors. + + Args: + tensors (sequence of Tensors): sequence of tensors to concatenate + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([1, 2, 3]) + >>> b = torch.tensor([4, 5, 6]) + >>> torch.hstack((a,b)) + tensor([1, 2, 3, 4, 5, 6]) + >>> a = torch.tensor([[1],[2],[3]]) + >>> b = torch.tensor([[4],[5],[6]]) + >>> torch.hstack((a,b)) + tensor([[1, 4], + [2, 5], + [3, 6]]) + """ + +def hypot( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + hypot(input, other, *, out=None) -> Tensor + + Given the legs of a right triangle, return its hypotenuse. + + .. math:: + \text{out}_{i} = \sqrt{\text{input}_{i}^{2} + \text{other}_{i}^{2}} + + The shapes of ``input`` and ``other`` must be + :ref:`broadcastable `. + + Args: + input (Tensor): the first input tensor + other (Tensor): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.hypot(torch.tensor([4.0]), torch.tensor([3.0, 4.0, 5.0])) + tensor([5.0000, 5.6569, 6.4031]) + """ + +def i0(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + i0(input, *, out=None) -> Tensor + + Alias for :func:`torch.special.i0`. + """ + +def i0_(input: Tensor) -> Tensor: ... +def igamma( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + igamma(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.special.gammainc`. + """ + +def igammac( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + igammac(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.special.gammaincc`. + """ + +def imag(input: Tensor) -> Tensor: + r""" + imag(input) -> Tensor + + Returns a new tensor containing imaginary values of the :attr:`self` tensor. + The returned tensor and :attr:`self` share the same underlying storage. + + .. warning:: + :func:`imag` is only supported for tensors with complex dtypes. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> x=torch.randn(4, dtype=torch.cfloat) + >>> x + tensor([(0.3100+0.3553j), (-0.5445-0.7896j), (-1.6492-0.0633j), (-0.0638-0.8119j)]) + >>> x.imag + tensor([ 0.3553, -0.7896, -0.0633, -0.8119]) + """ + +@overload +def index_add( + input: Tensor, + dim: _int, + index: Tensor, + source: Tensor, + *, + alpha: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + index_add(input: Tensor, dim: int, index: Tensor, source: Tensor, *, alpha: Union[Number, _complex] = 1, out: Optional[Tensor]) -> Tensor # noqa: B950 + + See :meth:`~Tensor.index_add_` for function description. + """ + +@overload +def index_add( + input: Tensor, + dim: str | EllipsisType | None, + index: Tensor, + source: Tensor, + *, + alpha: Number | _complex = 1, +) -> Tensor: + r""" + index_add(input: Tensor, dim: int, index: Tensor, source: Tensor, *, alpha: Union[Number, _complex] = 1, out: Optional[Tensor]) -> Tensor # noqa: B950 + + See :meth:`~Tensor.index_add_` for function description. + """ + +@overload +def index_copy( + input: Tensor, + dim: _int, + index: Tensor, + source: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + index_copy(input: Tensor, dim: int, index: Tensor, source: Tensor, *, out: Optional[Tensor]) -> Tensor + + See :meth:`~Tensor.index_add_` for function description. + """ + +@overload +def index_copy( + input: Tensor, + dim: str | EllipsisType | None, + index: Tensor, + source: Tensor, +) -> Tensor: + r""" + index_copy(input: Tensor, dim: int, index: Tensor, source: Tensor, *, out: Optional[Tensor]) -> Tensor + + See :meth:`~Tensor.index_add_` for function description. + """ + +@overload +def index_fill( + input: Tensor, + dim: _int, + index: Tensor, + value: Tensor, +) -> Tensor: ... +@overload +def index_fill( + input: Tensor, + dim: str | EllipsisType | None, + index: Tensor, + value: Tensor, +) -> Tensor: ... +@overload +def index_fill( + input: Tensor, + dim: _int, + index: Tensor, + value: Number | _complex, +) -> Tensor: ... +@overload +def index_fill( + input: Tensor, + dim: str | EllipsisType | None, + index: Tensor, + value: Number | _complex, +) -> Tensor: ... +def index_put( + input: Tensor, + indices: tuple[Tensor, ...] | list[Tensor] | None, + values: Tensor, + accumulate: _bool = False, +) -> Tensor: ... +def index_put_( + input: Tensor, + indices: tuple[Tensor, ...] | list[Tensor] | None, + values: Tensor, + accumulate: _bool = False, +) -> Tensor: ... +def index_reduce( + input: Tensor, + dim: _int, + index: Tensor, + source: Tensor, + reduce: str, + *, + include_self: _bool = True, + out: Tensor | None = None, +) -> Tensor: + r""" + index_reduce(input: Tensor, dim: int, index: Tensor, source: Tensor, reduce: str, *, include_self: bool = True, out: Optional[Tensor]) -> Tensor # noqa: B950 + + See :meth:`~Tensor.index_reduce_` for function description. + """ + +@overload +def index_select( + input: Tensor, + dim: _int, + index: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + index_select(input, dim, index, *, out=None) -> Tensor + + Returns a new tensor which indexes the :attr:`input` tensor along dimension + :attr:`dim` using the entries in :attr:`index`. + + The returned tensor has the same number of dimensions as the original tensor + (:attr:`input`). The :attr:`dim`\ th dimension has the same size as the length + of :attr:`index`; other dimensions have the same size as in the original tensor. + + .. note:: The returned tensor does **not** use the same storage as the original + tensor. If :attr:`out` has a different shape than expected, we + silently change it to the correct shape, reallocating the underlying + storage if necessary. + + Args: + input (Tensor): the input tensor. + dim (int): the dimension in which we index + index (IntTensor or LongTensor): the 1-D tensor containing the indices to index + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> x = torch.randn(3, 4) + >>> x + tensor([[ 0.1427, 0.0231, -0.5414, -1.0009], + [-0.4664, 0.2647, -0.1228, -1.1068], + [-1.1734, -0.6571, 0.7230, -0.6004]]) + >>> indices = torch.tensor([0, 2]) + >>> torch.index_select(x, 0, indices) + tensor([[ 0.1427, 0.0231, -0.5414, -1.0009], + [-1.1734, -0.6571, 0.7230, -0.6004]]) + >>> torch.index_select(x, 1, indices) + tensor([[ 0.1427, -0.5414], + [-0.4664, -0.1228], + [-1.1734, 0.7230]]) + """ + +@overload +def index_select( + input: Tensor, + dim: str | EllipsisType | None, + index: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + index_select(input, dim, index, *, out=None) -> Tensor + + Returns a new tensor which indexes the :attr:`input` tensor along dimension + :attr:`dim` using the entries in :attr:`index`. + + The returned tensor has the same number of dimensions as the original tensor + (:attr:`input`). The :attr:`dim`\ th dimension has the same size as the length + of :attr:`index`; other dimensions have the same size as in the original tensor. + + .. note:: The returned tensor does **not** use the same storage as the original + tensor. If :attr:`out` has a different shape than expected, we + silently change it to the correct shape, reallocating the underlying + storage if necessary. + + Args: + input (Tensor): the input tensor. + dim (int): the dimension in which we index + index (IntTensor or LongTensor): the 1-D tensor containing the indices to index + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> x = torch.randn(3, 4) + >>> x + tensor([[ 0.1427, 0.0231, -0.5414, -1.0009], + [-0.4664, 0.2647, -0.1228, -1.1068], + [-1.1734, -0.6571, 0.7230, -0.6004]]) + >>> indices = torch.tensor([0, 2]) + >>> torch.index_select(x, 0, indices) + tensor([[ 0.1427, 0.0231, -0.5414, -1.0009], + [-1.1734, -0.6571, 0.7230, -0.6004]]) + >>> torch.index_select(x, 1, indices) + tensor([[ 0.1427, -0.5414], + [-0.4664, -0.1228], + [-1.1734, 0.7230]]) + """ + +def indices_copy(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + Performs the same operation as :func:`torch.indices`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def init_num_threads() -> None: ... +def inner( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + inner(input, other, *, out=None) -> Tensor + + Computes the dot product for 1D tensors. For higher dimensions, sums the product + of elements from :attr:`input` and :attr:`other` along their last dimension. + + .. note:: + + If either :attr:`input` or :attr:`other` is a scalar, the result is equivalent + to `torch.mul(input, other)`. + + If both :attr:`input` and :attr:`other` are non-scalars, the size of their last + dimension must match and the result is equivalent to `torch.tensordot(input, + other, dims=([-1], [-1]))` + + Args: + input (Tensor): First input tensor + other (Tensor): Second input tensor + + Keyword args: + out (Tensor, optional): Optional output tensor to write result into. The output + shape is `input.shape[:-1] + other.shape[:-1]`. + + Example:: + + # Dot product + >>> torch.inner(torch.tensor([1, 2, 3]), torch.tensor([0, 2, 1])) + tensor(7) + + # Multidimensional input tensors + >>> a = torch.randn(2, 3) + >>> a + tensor([[0.8173, 1.0874, 1.1784], + [0.3279, 0.1234, 2.7894]]) + >>> b = torch.randn(2, 4, 3) + >>> b + tensor([[[-0.4682, -0.7159, 0.1506], + [ 0.4034, -0.3657, 1.0387], + [ 0.9892, -0.6684, 0.1774], + [ 0.9482, 1.3261, 0.3917]], + + [[ 0.4537, 0.7493, 1.1724], + [ 0.2291, 0.5749, -0.2267], + [-0.7920, 0.3607, -0.3701], + [ 1.3666, -0.5850, -1.7242]]]) + >>> torch.inner(a, b) + tensor([[[-0.9837, 1.1560, 0.2907, 2.6785], + [ 2.5671, 0.5452, -0.6912, -1.5509]], + + [[ 0.1782, 2.9843, 0.7366, 1.5672], + [ 3.5115, -0.4864, -1.2476, -4.4337]]]) + + # Scalar input + >>> torch.inner(a, torch.tensor(2)) + tensor([[1.6347, 2.1748, 2.3567], + [0.6558, 0.2469, 5.5787]]) + """ + +def instance_norm( + input: Tensor, + weight: Tensor | None, + bias: Tensor | None, + running_mean: Tensor | None, + running_var: Tensor | None, + use_input_stats: _bool, + momentum: _float, + eps: _float, + cudnn_enabled: _bool, +) -> Tensor: ... +def int_repr(input: Tensor) -> Tensor: ... +def inverse(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + inverse(input, *, out=None) -> Tensor + + Alias for :func:`torch.linalg.inv` + """ + +def is_complex(input: Tensor) -> _bool: + r""" + is_complex(input: Tensor) -> bool + + Returns True if the data type of :attr:`input` is a complex data type i.e., + one of ``torch.complex64``, and ``torch.complex128``. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> torch.is_complex(torch.tensor([1, 2, 3], dtype=torch.complex64)) + True + >>> torch.is_complex(torch.tensor([1, 2, 3], dtype=torch.complex128)) + True + >>> torch.is_complex(torch.tensor([1, 2, 3], dtype=torch.int32)) + False + >>> torch.is_complex(torch.tensor([1.0, 2.0, 3.0], dtype=torch.float16)) + False + """ + +def is_conj(input: Tensor) -> _bool: + r""" + is_conj(input) -> (bool) + + Returns True if the :attr:`input` is a conjugated tensor, i.e. its conjugate bit is set to `True`. + + Args: + input (Tensor): the input tensor. + """ + +def is_distributed(input: Tensor) -> _bool: ... +def is_floating_point(input: Tensor) -> _bool: + r""" + is_floating_point(input: Tensor) -> bool + + Returns True if the data type of :attr:`input` is a floating point data type i.e., + one of ``torch.float64``, ``torch.float32``, ``torch.float16``, and ``torch.bfloat16``. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> torch.is_floating_point(torch.tensor([1.0, 2.0, 3.0])) + True + >>> torch.is_floating_point(torch.tensor([1, 2, 3], dtype=torch.int32)) + False + >>> torch.is_floating_point(torch.tensor([1.0, 2.0, 3.0], dtype=torch.float16)) + True + >>> torch.is_floating_point(torch.tensor([1, 2, 3], dtype=torch.complex64)) + False + """ + +def is_grad_enabled() -> _bool: + r""" + is_grad_enabled() -> (bool) + + Returns True if grad mode is currently enabled. + """ + +def is_inference(input: Tensor) -> _bool: + r""" + is_inference(input) -> (bool) + + Returns True if :attr:`input` is an inference tensor. + + A non-view tensor is an inference tensor if and only if it was + allocated during inference mode. A view tensor is an inference + tensor if and only if the tensor it is a view of is an inference tensor. + + For details on inference mode please see + `Inference Mode `_. + + Args: + input (Tensor): the input tensor. + """ + +def is_inference_mode_enabled() -> _bool: + r""" + is_inference_mode_enabled() -> (bool) + + Returns True if inference mode is currently enabled. + """ + +def is_neg(input: Tensor) -> _bool: ... +def is_nonzero(input: Tensor) -> _bool: + r""" + is_nonzero(input) -> (bool) + + Returns True if the :attr:`input` is a single element tensor which is not equal to zero + after type conversions. + i.e. not equal to ``torch.tensor([0.])`` or ``torch.tensor([0])`` or + ``torch.tensor([False])``. + Throws a ``RuntimeError`` if ``torch.numel() != 1`` (even in case + of sparse tensors). + + Args: + input (Tensor): the input tensor. + + Examples:: + + >>> torch.is_nonzero(torch.tensor([0.])) + False + >>> torch.is_nonzero(torch.tensor([1.5])) + True + >>> torch.is_nonzero(torch.tensor([False])) + False + >>> torch.is_nonzero(torch.tensor([3])) + True + >>> torch.is_nonzero(torch.tensor([1, 3, 5])) + Traceback (most recent call last): + ... + RuntimeError: Boolean value of Tensor with more than one value is ambiguous + >>> torch.is_nonzero(torch.tensor([])) + Traceback (most recent call last): + ... + RuntimeError: Boolean value of Tensor with no values is ambiguous + """ + +def is_same_size(input: Tensor, other: Tensor) -> _bool: ... +def is_signed(input: Tensor) -> _bool: ... +def is_vulkan_available() -> _bool: ... +def isclose( + input: Tensor, + other: Tensor, + rtol: _float = 1e-05, + atol: _float = 1e-08, + equal_nan: _bool = False, +) -> Tensor: + r""" + isclose(input, other, rtol=1e-05, atol=1e-08, equal_nan=False) -> Tensor + + Returns a new tensor with boolean elements representing if each element of + :attr:`input` is "close" to the corresponding element of :attr:`other`. + Closeness is defined as: + + .. math:: + \lvert \text{input}_i - \text{other}_i \rvert \leq \texttt{rtol} \times \lvert \text{other}_i \rvert + \texttt{atol} + + + where :attr:`input` and :attr:`other` are finite. Where :attr:`input` + and/or :attr:`other` are nonfinite they are close if and only if + they are equal, with NaNs being considered equal to each other when + :attr:`equal_nan` is True. + + Args: + input (Tensor): first tensor to compare + other (Tensor): second tensor to compare + rtol (float, optional): relative tolerance. Default: 1e-05 + atol (float, optional): absolute tolerance. Default: 1e-08 + equal_nan (bool, optional): if ``True``, then two ``NaN`` s will be considered equal. Default: ``False`` + + Examples:: + + >>> torch.isclose(torch.tensor((1., 2, 3)), torch.tensor((1 + 1e-10, 3, 4))) + tensor([ True, False, False]) + >>> torch.isclose(torch.tensor((float('inf'), 4)), torch.tensor((float('inf'), 6)), rtol=.5) + tensor([True, True]) + """ + +def isfinite(input: Tensor) -> Tensor: + r""" + isfinite(input) -> Tensor + + Returns a new tensor with boolean elements representing if each element is `finite` or not. + + Real values are finite when they are not NaN, negative infinity, or infinity. + Complex values are finite when both their real and imaginary parts are finite. + + Args: + input (Tensor): the input tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is finite and False elsewhere + + Example:: + + >>> torch.isfinite(torch.tensor([1, float('inf'), 2, float('-inf'), float('nan')])) + tensor([True, False, True, False, False]) + """ + +@overload +def isin( + elements: Tensor, + test_elements: Tensor, + *, + assume_unique: _bool = False, + invert: _bool = False, + out: Tensor | None = None, +) -> Tensor: + r""" + isin(elements, test_elements, *, assume_unique=False, invert=False) -> Tensor + + Tests if each element of :attr:`elements` is in :attr:`test_elements`. Returns + a boolean tensor of the same shape as :attr:`elements` that is True for elements + in :attr:`test_elements` and False otherwise. + + .. note:: + One of :attr:`elements` or :attr:`test_elements` can be a scalar, but not both. + + Args: + elements (Tensor or Scalar): Input elements + test_elements (Tensor or Scalar): Values against which to test for each input element + assume_unique (bool, optional): If True, assumes both :attr:`elements` and + :attr:`test_elements` contain unique elements, which can speed up the + calculation. Default: False + invert (bool, optional): If True, inverts the boolean return tensor, resulting in True + values for elements *not* in :attr:`test_elements`. Default: False + + Returns: + A boolean tensor of the same shape as :attr:`elements` that is True for elements in + :attr:`test_elements` and False otherwise + + Example: + >>> torch.isin(torch.tensor([[1, 2], [3, 4]]), torch.tensor([2, 3])) + tensor([[False, True], + [ True, False]]) + """ + +@overload +def isin( + element: Number | _complex, + test_elements: Tensor, + *, + assume_unique: _bool = False, + invert: _bool = False, + out: Tensor | None = None, +) -> Tensor: + r""" + isin(elements, test_elements, *, assume_unique=False, invert=False) -> Tensor + + Tests if each element of :attr:`elements` is in :attr:`test_elements`. Returns + a boolean tensor of the same shape as :attr:`elements` that is True for elements + in :attr:`test_elements` and False otherwise. + + .. note:: + One of :attr:`elements` or :attr:`test_elements` can be a scalar, but not both. + + Args: + elements (Tensor or Scalar): Input elements + test_elements (Tensor or Scalar): Values against which to test for each input element + assume_unique (bool, optional): If True, assumes both :attr:`elements` and + :attr:`test_elements` contain unique elements, which can speed up the + calculation. Default: False + invert (bool, optional): If True, inverts the boolean return tensor, resulting in True + values for elements *not* in :attr:`test_elements`. Default: False + + Returns: + A boolean tensor of the same shape as :attr:`elements` that is True for elements in + :attr:`test_elements` and False otherwise + + Example: + >>> torch.isin(torch.tensor([[1, 2], [3, 4]]), torch.tensor([2, 3])) + tensor([[False, True], + [ True, False]]) + """ + +@overload +def isin( + elements: Tensor, + test_element: Number | _complex, + *, + assume_unique: _bool = False, + invert: _bool = False, + out: Tensor | None = None, +) -> Tensor: + r""" + isin(elements, test_elements, *, assume_unique=False, invert=False) -> Tensor + + Tests if each element of :attr:`elements` is in :attr:`test_elements`. Returns + a boolean tensor of the same shape as :attr:`elements` that is True for elements + in :attr:`test_elements` and False otherwise. + + .. note:: + One of :attr:`elements` or :attr:`test_elements` can be a scalar, but not both. + + Args: + elements (Tensor or Scalar): Input elements + test_elements (Tensor or Scalar): Values against which to test for each input element + assume_unique (bool, optional): If True, assumes both :attr:`elements` and + :attr:`test_elements` contain unique elements, which can speed up the + calculation. Default: False + invert (bool, optional): If True, inverts the boolean return tensor, resulting in True + values for elements *not* in :attr:`test_elements`. Default: False + + Returns: + A boolean tensor of the same shape as :attr:`elements` that is True for elements in + :attr:`test_elements` and False otherwise + + Example: + >>> torch.isin(torch.tensor([[1, 2], [3, 4]]), torch.tensor([2, 3])) + tensor([[False, True], + [ True, False]]) + """ + +def isinf(input: Tensor) -> Tensor: + r""" + isinf(input) -> Tensor + + Tests if each element of :attr:`input` is infinite + (positive or negative infinity) or not. + + .. note:: + Complex values are infinite when their real or imaginary part is + infinite. + + Args: + input (Tensor): the input tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is infinite and False elsewhere + + Example:: + + >>> torch.isinf(torch.tensor([1, float('inf'), 2, float('-inf'), float('nan')])) + tensor([False, True, False, True, False]) + """ + +def isnan(input: Tensor) -> Tensor: + r""" + isnan(input) -> Tensor + + Returns a new tensor with boolean elements representing if each element of :attr:`input` + is NaN or not. Complex values are considered NaN when either their real + and/or imaginary part is NaN. + + Arguments: + input (Tensor): the input tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is NaN and False elsewhere + + Example:: + + >>> torch.isnan(torch.tensor([1, float('nan'), 2])) + tensor([False, True, False]) + """ + +def isneginf(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + isneginf(input, *, out=None) -> Tensor + Tests if each element of :attr:`input` is negative infinity or not. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([-float('inf'), float('inf'), 1.2]) + >>> torch.isneginf(a) + tensor([ True, False, False]) + """ + +def isposinf(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + isposinf(input, *, out=None) -> Tensor + Tests if each element of :attr:`input` is positive infinity or not. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([-float('inf'), float('inf'), 1.2]) + >>> torch.isposinf(a) + tensor([False, True, False]) + """ + +def isreal(input: Tensor) -> Tensor: + r""" + isreal(input) -> Tensor + + Returns a new tensor with boolean elements representing if each element of :attr:`input` is real-valued or not. + All real-valued types are considered real. Complex values are considered real when their imaginary part is 0. + + Arguments: + input (Tensor): the input tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is real and False elsewhere + + Example:: + + >>> torch.isreal(torch.tensor([1, 1+1j, 2+0j])) + tensor([True, False, True]) + """ + +def istft( + input: Tensor, + n_fft: _int, + hop_length: _int | None = None, + win_length: _int | None = None, + window: Tensor | None = None, + center: _bool = True, + normalized: _bool = False, + onesided: _bool | None = None, + length: _int | None = None, + return_complex: _bool = False, +) -> Tensor: ... +@overload +def kaiser_window( + window_length: _int, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + kaiser_window(window_length, periodic=True, beta=12.0, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Computes the Kaiser window with window length :attr:`window_length` and shape parameter :attr:`beta`. + + Let I_0 be the zeroth order modified Bessel function of the first kind (see :func:`torch.i0`) and + ``N = L - 1`` if :attr:`periodic` is False and ``L`` if :attr:`periodic` is True, + where ``L`` is the :attr:`window_length`. This function computes: + + .. math:: + out_i = I_0 \left( \beta \sqrt{1 - \left( {\frac{i - N/2}{N/2}} \right) ^2 } \right) / I_0( \beta ) + + Calling ``torch.kaiser_window(L, B, periodic=True)`` is equivalent to calling + ``torch.kaiser_window(L + 1, B, periodic=False)[:-1])``. + The :attr:`periodic` argument is intended as a helpful shorthand + to produce a periodic window as input to functions like :func:`torch.stft`. + + .. note:: + If :attr:`window_length` is one, then the returned window is a single element tensor containing a one. + + + Args: + window_length (int): length of the window. + periodic (bool, optional): If True, returns a periodic window suitable for use in spectral analysis. + If False, returns a symmetric window suitable for use in filter design. + beta (float, optional): shape parameter for the window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + """ + +@overload +def kaiser_window( + window_length: _int, + periodic: _bool, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + kaiser_window(window_length, periodic=True, beta=12.0, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Computes the Kaiser window with window length :attr:`window_length` and shape parameter :attr:`beta`. + + Let I_0 be the zeroth order modified Bessel function of the first kind (see :func:`torch.i0`) and + ``N = L - 1`` if :attr:`periodic` is False and ``L`` if :attr:`periodic` is True, + where ``L`` is the :attr:`window_length`. This function computes: + + .. math:: + out_i = I_0 \left( \beta \sqrt{1 - \left( {\frac{i - N/2}{N/2}} \right) ^2 } \right) / I_0( \beta ) + + Calling ``torch.kaiser_window(L, B, periodic=True)`` is equivalent to calling + ``torch.kaiser_window(L + 1, B, periodic=False)[:-1])``. + The :attr:`periodic` argument is intended as a helpful shorthand + to produce a periodic window as input to functions like :func:`torch.stft`. + + .. note:: + If :attr:`window_length` is one, then the returned window is a single element tensor containing a one. + + + Args: + window_length (int): length of the window. + periodic (bool, optional): If True, returns a periodic window suitable for use in spectral analysis. + If False, returns a symmetric window suitable for use in filter design. + beta (float, optional): shape parameter for the window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + """ + +@overload +def kaiser_window( + window_length: _int, + periodic: _bool, + beta: _float, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + kaiser_window(window_length, periodic=True, beta=12.0, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Computes the Kaiser window with window length :attr:`window_length` and shape parameter :attr:`beta`. + + Let I_0 be the zeroth order modified Bessel function of the first kind (see :func:`torch.i0`) and + ``N = L - 1`` if :attr:`periodic` is False and ``L`` if :attr:`periodic` is True, + where ``L`` is the :attr:`window_length`. This function computes: + + .. math:: + out_i = I_0 \left( \beta \sqrt{1 - \left( {\frac{i - N/2}{N/2}} \right) ^2 } \right) / I_0( \beta ) + + Calling ``torch.kaiser_window(L, B, periodic=True)`` is equivalent to calling + ``torch.kaiser_window(L + 1, B, periodic=False)[:-1])``. + The :attr:`periodic` argument is intended as a helpful shorthand + to produce a periodic window as input to functions like :func:`torch.stft`. + + .. note:: + If :attr:`window_length` is one, then the returned window is a single element tensor containing a one. + + + Args: + window_length (int): length of the window. + periodic (bool, optional): If True, returns a periodic window suitable for use in spectral analysis. + If False, returns a symmetric window suitable for use in filter design. + beta (float, optional): shape parameter for the window. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + """ + +def kl_div( + input: Tensor, + target: Tensor, + reduction: _int = 1, + *, + log_target: _bool = False, +) -> Tensor: ... +def kron( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + kron(input, other, *, out=None) -> Tensor + + Computes the Kronecker product, denoted by :math:`\otimes`, of :attr:`input` and :attr:`other`. + + If :attr:`input` is a :math:`(a_0 \times a_1 \times \dots \times a_n)` tensor and :attr:`other` is a + :math:`(b_0 \times b_1 \times \dots \times b_n)` tensor, the result will be a + :math:`(a_0*b_0 \times a_1*b_1 \times \dots \times a_n*b_n)` tensor with the following entries: + + .. math:: + (\text{input} \otimes \text{other})_{k_0, k_1, \dots, k_n} = + \text{input}_{i_0, i_1, \dots, i_n} * \text{other}_{j_0, j_1, \dots, j_n}, + + where :math:`k_t = i_t * b_t + j_t` for :math:`0 \leq t \leq n`. + If one tensor has fewer dimensions than the other it is unsqueezed until it has the same number of dimensions. + + Supports real-valued and complex-valued inputs. + + .. note:: + This function generalizes the typical definition of the Kronecker product for two matrices to two tensors, + as described above. When :attr:`input` is a :math:`(m \times n)` matrix and :attr:`other` is a + :math:`(p \times q)` matrix, the result will be a :math:`(p*m \times q*n)` block matrix: + + .. math:: + \mathbf{A} \otimes \mathbf{B}=\begin{bmatrix} + a_{11} \mathbf{B} & \cdots & a_{1 n} \mathbf{B} \\ + \vdots & \ddots & \vdots \\ + a_{m 1} \mathbf{B} & \cdots & a_{m n} \mathbf{B} \end{bmatrix} + + where :attr:`input` is :math:`\mathbf{A}` and :attr:`other` is :math:`\mathbf{B}`. + + Arguments: + input (Tensor) + other (Tensor) + + Keyword args: + out (Tensor, optional): The output tensor. Ignored if ``None``. Default: ``None`` + + Examples:: + + >>> mat1 = torch.eye(2) + >>> mat2 = torch.ones(2, 2) + >>> torch.kron(mat1, mat2) + tensor([[1., 1., 0., 0.], + [1., 1., 0., 0.], + [0., 0., 1., 1.], + [0., 0., 1., 1.]]) + + >>> mat1 = torch.eye(2) + >>> mat2 = torch.arange(1, 5).reshape(2, 2) + >>> torch.kron(mat1, mat2) + tensor([[1., 2., 0., 0.], + [3., 4., 0., 0.], + [0., 0., 1., 2.], + [0., 0., 3., 4.]]) + """ + +@overload +def kthvalue( + input: Tensor, + k: _int | SymInt, + dim: _int = -1, + keepdim: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.kthvalue: + r""" + kthvalue(input, k, dim=None, keepdim=False, *, out=None) -> (Tensor, LongTensor) + + Returns a namedtuple ``(values, indices)`` where ``values`` is the :attr:`k` th + smallest element of each row of the :attr:`input` tensor in the given dimension + :attr:`dim`. And ``indices`` is the index location of each element found. + + If :attr:`dim` is not given, the last dimension of the `input` is chosen. + + If :attr:`keepdim` is ``True``, both the :attr:`values` and :attr:`indices` tensors + are the same size as :attr:`input`, except in the dimension :attr:`dim` where + they are of size 1. Otherwise, :attr:`dim` is squeezed + (see :func:`torch.squeeze`), resulting in both the :attr:`values` and + :attr:`indices` tensors having 1 fewer dimension than the :attr:`input` tensor. + + .. note:: + When :attr:`input` is a CUDA tensor and there are multiple valid + :attr:`k` th values, this function may nondeterministically return + :attr:`indices` for any of them. + + Args: + input (Tensor): the input tensor. + k (int): k for the k-th smallest element + dim (int, optional): the dimension to find the kth value along + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (tuple, optional): the output tuple of (Tensor, LongTensor) + can be optionally given to be used as output buffers + + Example:: + + >>> x = torch.arange(1., 6.) + >>> x + tensor([ 1., 2., 3., 4., 5.]) + >>> torch.kthvalue(x, 4) + torch.return_types.kthvalue(values=tensor(4.), indices=tensor(3)) + + >>> x=torch.arange(1.,7.).resize_(2,3) + >>> x + tensor([[ 1., 2., 3.], + [ 4., 5., 6.]]) + >>> torch.kthvalue(x, 2, 0, True) + torch.return_types.kthvalue(values=tensor([[4., 5., 6.]]), indices=tensor([[1, 1, 1]])) + """ + +@overload +def kthvalue( + input: Tensor, + k: _int | SymInt, + dim: str | EllipsisType | None, + keepdim: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.kthvalue: + r""" + kthvalue(input, k, dim=None, keepdim=False, *, out=None) -> (Tensor, LongTensor) + + Returns a namedtuple ``(values, indices)`` where ``values`` is the :attr:`k` th + smallest element of each row of the :attr:`input` tensor in the given dimension + :attr:`dim`. And ``indices`` is the index location of each element found. + + If :attr:`dim` is not given, the last dimension of the `input` is chosen. + + If :attr:`keepdim` is ``True``, both the :attr:`values` and :attr:`indices` tensors + are the same size as :attr:`input`, except in the dimension :attr:`dim` where + they are of size 1. Otherwise, :attr:`dim` is squeezed + (see :func:`torch.squeeze`), resulting in both the :attr:`values` and + :attr:`indices` tensors having 1 fewer dimension than the :attr:`input` tensor. + + .. note:: + When :attr:`input` is a CUDA tensor and there are multiple valid + :attr:`k` th values, this function may nondeterministically return + :attr:`indices` for any of them. + + Args: + input (Tensor): the input tensor. + k (int): k for the k-th smallest element + dim (int, optional): the dimension to find the kth value along + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (tuple, optional): the output tuple of (Tensor, LongTensor) + can be optionally given to be used as output buffers + + Example:: + + >>> x = torch.arange(1., 6.) + >>> x + tensor([ 1., 2., 3., 4., 5.]) + >>> torch.kthvalue(x, 4) + torch.return_types.kthvalue(values=tensor(4.), indices=tensor(3)) + + >>> x=torch.arange(1.,7.).resize_(2,3) + >>> x + tensor([[ 1., 2., 3.], + [ 4., 5., 6.]]) + >>> torch.kthvalue(x, 2, 0, True) + torch.return_types.kthvalue(values=tensor([[4., 5., 6.]]), indices=tensor([[1, 1, 1]])) + """ + +def layer_norm( + input: Tensor, + normalized_shape: Sequence[_int | SymInt], + weight: Tensor | None = None, + bias: Tensor | None = None, + eps: _float = 1e-05, + cudnn_enable: _bool = True, +) -> Tensor: ... +def lcm( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + lcm(input, other, *, out=None) -> Tensor + + Computes the element-wise least common multiple (LCM) of :attr:`input` and :attr:`other`. + + Both :attr:`input` and :attr:`other` must have integer types. + + .. note:: + This defines :math:`lcm(0, 0) = 0` and :math:`lcm(0, a) = 0`. + + Args: + input (Tensor): the input tensor. + other (Tensor): the second input tensor + + Keyword arguments: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([5, 10, 15]) + >>> b = torch.tensor([3, 4, 5]) + >>> torch.lcm(a, b) + tensor([15, 20, 15]) + >>> c = torch.tensor([3]) + >>> torch.lcm(a, c) + tensor([15, 30, 15]) + """ + +def lcm_(input: Tensor, other: Tensor) -> Tensor: ... +def ldexp( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + ldexp(input, other, *, out=None) -> Tensor + + Multiplies :attr:`input` by 2 ** :attr:`other`. + + .. math:: + \text{{out}}_i = \text{{input}}_i * 2^\text{{other}}_i + + + Typically this function is used to construct floating point numbers by multiplying + mantissas in :attr:`input` with integral powers of two created from the exponents + in :attr:`other`. + + Args: + input (Tensor): the input tensor. + other (Tensor): a tensor of exponents, typically integers. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.ldexp(torch.tensor([1.]), torch.tensor([1])) + tensor([2.]) + >>> torch.ldexp(torch.tensor([1.0]), torch.tensor([1, 2, 3, 4])) + tensor([ 2., 4., 8., 16.]) + """ + +def ldexp_(input: Tensor, other: Tensor) -> Tensor: ... +@overload +def le( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + le(input, other, *, out=None) -> Tensor + + Computes :math:`\text{input} \leq \text{other}` element-wise. + + + The second argument can be a number or a tensor whose shape is + :ref:`broadcastable ` with the first argument. + + Args: + input (Tensor): the tensor to compare + other (Tensor or Scalar): the tensor or value to compare + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is less than or equal to + :attr:`other` and False elsewhere + + Example:: + + >>> torch.le(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[True, False], [True, True]]) + """ + +@overload +def le( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + le(input, other, *, out=None) -> Tensor + + Computes :math:`\text{input} \leq \text{other}` element-wise. + + + The second argument can be a number or a tensor whose shape is + :ref:`broadcastable ` with the first argument. + + Args: + input (Tensor): the tensor to compare + other (Tensor or Scalar): the tensor or value to compare + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is less than or equal to + :attr:`other` and False elsewhere + + Example:: + + >>> torch.le(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[True, False], [True, True]]) + """ + +@overload +def lerp( + input: Tensor, + end: Tensor, + weight: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + lerp(input, end, weight, *, out=None) + + Does a linear interpolation of two tensors :attr:`start` (given by :attr:`input`) and :attr:`end` based + on a scalar or tensor :attr:`weight` and returns the resulting :attr:`out` tensor. + + .. math:: + \text{out}_i = \text{start}_i + \text{weight}_i \times (\text{end}_i - \text{start}_i) + + The shapes of :attr:`start` and :attr:`end` must be + :ref:`broadcastable `. If :attr:`weight` is a tensor, then + the shapes of :attr:`weight`, :attr:`start`, and :attr:`end` must be :ref:`broadcastable `. + + Args: + input (Tensor): the tensor with the starting points + end (Tensor): the tensor with the ending points + weight (float or tensor): the weight for the interpolation formula + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> start = torch.arange(1., 5.) + >>> end = torch.empty(4).fill_(10) + >>> start + tensor([ 1., 2., 3., 4.]) + >>> end + tensor([ 10., 10., 10., 10.]) + >>> torch.lerp(start, end, 0.5) + tensor([ 5.5000, 6.0000, 6.5000, 7.0000]) + >>> torch.lerp(start, end, torch.full_like(start, 0.5)) + tensor([ 5.5000, 6.0000, 6.5000, 7.0000]) + """ + +@overload +def lerp( + input: Tensor, + end: Tensor, + weight: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + lerp(input, end, weight, *, out=None) + + Does a linear interpolation of two tensors :attr:`start` (given by :attr:`input`) and :attr:`end` based + on a scalar or tensor :attr:`weight` and returns the resulting :attr:`out` tensor. + + .. math:: + \text{out}_i = \text{start}_i + \text{weight}_i \times (\text{end}_i - \text{start}_i) + + The shapes of :attr:`start` and :attr:`end` must be + :ref:`broadcastable `. If :attr:`weight` is a tensor, then + the shapes of :attr:`weight`, :attr:`start`, and :attr:`end` must be :ref:`broadcastable `. + + Args: + input (Tensor): the tensor with the starting points + end (Tensor): the tensor with the ending points + weight (float or tensor): the weight for the interpolation formula + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> start = torch.arange(1., 5.) + >>> end = torch.empty(4).fill_(10) + >>> start + tensor([ 1., 2., 3., 4.]) + >>> end + tensor([ 10., 10., 10., 10.]) + >>> torch.lerp(start, end, 0.5) + tensor([ 5.5000, 6.0000, 6.5000, 7.0000]) + >>> torch.lerp(start, end, torch.full_like(start, 0.5)) + tensor([ 5.5000, 6.0000, 6.5000, 7.0000]) + """ + +@overload +def less( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + less(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.lt`. + """ + +@overload +def less( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + less(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.lt`. + """ + +@overload +def less_equal( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + less_equal(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.le`. + """ + +@overload +def less_equal( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + less_equal(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.le`. + """ + +def lgamma(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + lgamma(input, *, out=None) -> Tensor + + Computes the natural logarithm of the absolute value of the gamma function on :attr:`input`. + + .. math:: + \text{out}_{i} = \ln |\Gamma(\text{input}_{i})| + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.arange(0.5, 2, 0.5) + >>> torch.lgamma(a) + tensor([ 0.5724, 0.0000, -0.1208]) + """ + +@overload +def linspace( + start: Number, + end: Number, + steps: _int | None = None, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + pin_memory: _bool = False, +) -> Tensor: + r""" + linspace(start, end, steps, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Creates a one-dimensional tensor of size :attr:`steps` whose values are evenly + spaced from :attr:`start` to :attr:`end`, inclusive. That is, the value are: + + .. math:: + (\text{start}, + \text{start} + \frac{\text{end} - \text{start}}{\text{steps} - 1}, + \ldots, + \text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{\text{steps} - 1}, + \text{end}) + + + From PyTorch 1.11 linspace requires the steps argument. Use steps=100 to restore the previous behavior. + + Args: + start (float or Tensor): the starting value for the set of points. If `Tensor`, it must be 0-dimensional + end (float or Tensor): the ending value for the set of points. If `Tensor`, it must be 0-dimensional + steps (int): size of the constructed tensor + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the data type to perform the computation in. + Default: if None, uses the global default dtype (see torch.get_default_dtype()) + when both :attr:`start` and :attr:`end` are real, + and corresponding complex dtype when either is complex. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + + Example:: + + >>> torch.linspace(3, 10, steps=5) + tensor([ 3.0000, 4.7500, 6.5000, 8.2500, 10.0000]) + >>> torch.linspace(-10, 10, steps=5) + tensor([-10., -5., 0., 5., 10.]) + >>> torch.linspace(start=-10, end=10, steps=5) + tensor([-10., -5., 0., 5., 10.]) + >>> torch.linspace(start=-10, end=10, steps=1) + tensor([-10.]) + """ + +@overload +def linspace( + start: Tensor, + end: Tensor, + steps: _int, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + linspace(start, end, steps, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Creates a one-dimensional tensor of size :attr:`steps` whose values are evenly + spaced from :attr:`start` to :attr:`end`, inclusive. That is, the value are: + + .. math:: + (\text{start}, + \text{start} + \frac{\text{end} - \text{start}}{\text{steps} - 1}, + \ldots, + \text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{\text{steps} - 1}, + \text{end}) + + + From PyTorch 1.11 linspace requires the steps argument. Use steps=100 to restore the previous behavior. + + Args: + start (float or Tensor): the starting value for the set of points. If `Tensor`, it must be 0-dimensional + end (float or Tensor): the ending value for the set of points. If `Tensor`, it must be 0-dimensional + steps (int): size of the constructed tensor + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the data type to perform the computation in. + Default: if None, uses the global default dtype (see torch.get_default_dtype()) + when both :attr:`start` and :attr:`end` are real, + and corresponding complex dtype when either is complex. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + + Example:: + + >>> torch.linspace(3, 10, steps=5) + tensor([ 3.0000, 4.7500, 6.5000, 8.2500, 10.0000]) + >>> torch.linspace(-10, 10, steps=5) + tensor([-10., -5., 0., 5., 10.]) + >>> torch.linspace(start=-10, end=10, steps=5) + tensor([-10., -5., 0., 5., 10.]) + >>> torch.linspace(start=-10, end=10, steps=1) + tensor([-10.]) + """ + +@overload +def linspace( + start: Number | _complex, + end: Tensor, + steps: _int, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + linspace(start, end, steps, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Creates a one-dimensional tensor of size :attr:`steps` whose values are evenly + spaced from :attr:`start` to :attr:`end`, inclusive. That is, the value are: + + .. math:: + (\text{start}, + \text{start} + \frac{\text{end} - \text{start}}{\text{steps} - 1}, + \ldots, + \text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{\text{steps} - 1}, + \text{end}) + + + From PyTorch 1.11 linspace requires the steps argument. Use steps=100 to restore the previous behavior. + + Args: + start (float or Tensor): the starting value for the set of points. If `Tensor`, it must be 0-dimensional + end (float or Tensor): the ending value for the set of points. If `Tensor`, it must be 0-dimensional + steps (int): size of the constructed tensor + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the data type to perform the computation in. + Default: if None, uses the global default dtype (see torch.get_default_dtype()) + when both :attr:`start` and :attr:`end` are real, + and corresponding complex dtype when either is complex. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + + Example:: + + >>> torch.linspace(3, 10, steps=5) + tensor([ 3.0000, 4.7500, 6.5000, 8.2500, 10.0000]) + >>> torch.linspace(-10, 10, steps=5) + tensor([-10., -5., 0., 5., 10.]) + >>> torch.linspace(start=-10, end=10, steps=5) + tensor([-10., -5., 0., 5., 10.]) + >>> torch.linspace(start=-10, end=10, steps=1) + tensor([-10.]) + """ + +@overload +def linspace( + start: Tensor, + end: Number | _complex, + steps: _int, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + linspace(start, end, steps, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Creates a one-dimensional tensor of size :attr:`steps` whose values are evenly + spaced from :attr:`start` to :attr:`end`, inclusive. That is, the value are: + + .. math:: + (\text{start}, + \text{start} + \frac{\text{end} - \text{start}}{\text{steps} - 1}, + \ldots, + \text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{\text{steps} - 1}, + \text{end}) + + + From PyTorch 1.11 linspace requires the steps argument. Use steps=100 to restore the previous behavior. + + Args: + start (float or Tensor): the starting value for the set of points. If `Tensor`, it must be 0-dimensional + end (float or Tensor): the ending value for the set of points. If `Tensor`, it must be 0-dimensional + steps (int): size of the constructed tensor + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the data type to perform the computation in. + Default: if None, uses the global default dtype (see torch.get_default_dtype()) + when both :attr:`start` and :attr:`end` are real, + and corresponding complex dtype when either is complex. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + + Example:: + + >>> torch.linspace(3, 10, steps=5) + tensor([ 3.0000, 4.7500, 6.5000, 8.2500, 10.0000]) + >>> torch.linspace(-10, 10, steps=5) + tensor([-10., -5., 0., 5., 10.]) + >>> torch.linspace(start=-10, end=10, steps=5) + tensor([-10., -5., 0., 5., 10.]) + >>> torch.linspace(start=-10, end=10, steps=1) + tensor([-10.]) + """ + +@overload +def linspace( + start: Number | _complex, + end: Number | _complex, + steps: _int, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + linspace(start, end, steps, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Creates a one-dimensional tensor of size :attr:`steps` whose values are evenly + spaced from :attr:`start` to :attr:`end`, inclusive. That is, the value are: + + .. math:: + (\text{start}, + \text{start} + \frac{\text{end} - \text{start}}{\text{steps} - 1}, + \ldots, + \text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{\text{steps} - 1}, + \text{end}) + + + From PyTorch 1.11 linspace requires the steps argument. Use steps=100 to restore the previous behavior. + + Args: + start (float or Tensor): the starting value for the set of points. If `Tensor`, it must be 0-dimensional + end (float or Tensor): the ending value for the set of points. If `Tensor`, it must be 0-dimensional + steps (int): size of the constructed tensor + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the data type to perform the computation in. + Default: if None, uses the global default dtype (see torch.get_default_dtype()) + when both :attr:`start` and :attr:`end` are real, + and corresponding complex dtype when either is complex. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + + Example:: + + >>> torch.linspace(3, 10, steps=5) + tensor([ 3.0000, 4.7500, 6.5000, 8.2500, 10.0000]) + >>> torch.linspace(-10, 10, steps=5) + tensor([-10., -5., 0., 5., 10.]) + >>> torch.linspace(start=-10, end=10, steps=5) + tensor([-10., -5., 0., 5., 10.]) + >>> torch.linspace(start=-10, end=10, steps=1) + tensor([-10.]) + """ + +def log(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + log(input, *, out=None) -> Tensor + + Returns a new tensor with the natural logarithm of the elements + of :attr:`input`. + + .. math:: + y_{i} = \log_{e} (x_{i}) + + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(5) * 5 + >>> a + tensor([4.7767, 4.3234, 1.2156, 0.2411, 4.5739]) + >>> torch.log(a) + tensor([ 1.5637, 1.4640, 0.1952, -1.4226, 1.5204]) + """ + +def log10(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + log10(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Returns a new tensor with the logarithm to the base 10 of the elements + of :attr:`input`. + + .. math:: + y_{i} = \log_{10} (x_{i}) + + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(5) + >>> a + tensor([ 0.5224, 0.9354, 0.7257, 0.1301, 0.2251]) + + + >>> torch.log10(a) + tensor([-0.2820, -0.0290, -0.1392, -0.8857, -0.6476]) + """ + +def log10_(input: Tensor) -> Tensor: ... +def log1p(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + log1p(input, *, out=None) -> Tensor + + Returns a new tensor with the natural logarithm of (1 + :attr:`input`). + + .. math:: + y_i = \log_{e} (x_i + 1) + + .. note:: This function is more accurate than :func:`torch.log` for small + values of :attr:`input` + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(5) + >>> a + tensor([-1.0090, -0.9923, 1.0249, -0.5372, 0.2492]) + >>> torch.log1p(a) + tensor([ nan, -4.8653, 0.7055, -0.7705, 0.2225]) + """ + +def log1p_(input: Tensor) -> Tensor: ... +def log2(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + log2(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Returns a new tensor with the logarithm to the base 2 of the elements + of :attr:`input`. + + .. math:: + y_{i} = \log_{2} (x_{i}) + + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.rand(5) + >>> a + tensor([ 0.8419, 0.8003, 0.9971, 0.5287, 0.0490]) + + + >>> torch.log2(a) + tensor([-0.2483, -0.3213, -0.0042, -0.9196, -4.3504]) + """ + +def log2_(input: Tensor) -> Tensor: ... +def log_(input: Tensor) -> Tensor: ... +@overload +def log_softmax( + input: Tensor, + dim: _int, + dtype: _dtype | None = None, + *, + out: Tensor | None = None, +) -> Tensor: ... +@overload +def log_softmax( + input: Tensor, + dim: str | EllipsisType | None, + *, + dtype: _dtype | None = None, +) -> Tensor: ... +def logaddexp( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + logaddexp(input, other, *, out=None) -> Tensor + + Logarithm of the sum of exponentiations of the inputs. + + Calculates pointwise :math:`\log\left(e^x + e^y\right)`. This function is useful + in statistics where the calculated probabilities of events may be so small as to + exceed the range of normal floating point numbers. In such cases the logarithm + of the calculated probability is stored. This function allows adding + probabilities stored in such a fashion. + + This op should be disambiguated with :func:`torch.logsumexp` which performs a + reduction on a single tensor. + + Args: + input (Tensor): the input tensor. + other (Tensor): the second input tensor + + Keyword arguments: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.logaddexp(torch.tensor([-1.0]), torch.tensor([-1.0, -2, -3])) + tensor([-0.3069, -0.6867, -0.8731]) + >>> torch.logaddexp(torch.tensor([-100.0, -200, -300]), torch.tensor([-1.0, -2, -3])) + tensor([-1., -2., -3.]) + >>> torch.logaddexp(torch.tensor([1.0, 2000, 30000]), torch.tensor([-1.0, -2, -3])) + tensor([1.1269e+00, 2.0000e+03, 3.0000e+04]) + """ + +def logaddexp2( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + logaddexp2(input, other, *, out=None) -> Tensor + + Logarithm of the sum of exponentiations of the inputs in base-2. + + Calculates pointwise :math:`\log_2\left(2^x + 2^y\right)`. See + :func:`torch.logaddexp` for more details. + + Args: + input (Tensor): the input tensor. + other (Tensor): the second input tensor + + Keyword arguments: + out (Tensor, optional): the output tensor. + """ + +@overload +def logcumsumexp( + input: Tensor, + dim: _int, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + logcumsumexp(input, dim, *, out=None) -> Tensor + Returns the logarithm of the cumulative summation of the exponentiation of + elements of :attr:`input` in the dimension :attr:`dim`. + + For summation index :math:`j` given by `dim` and other indices :math:`i`, the result is + + .. math:: + \text{logcumsumexp}(x)_{ij} = \log \sum\limits_{k=0}^{j} \exp(x_{ik}) + + Args: + input (Tensor): the input tensor. + dim (int): the dimension to do the operation over + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(10) + >>> torch.logcumsumexp(a, dim=0) + tensor([-0.42296738, -0.04462666, 0.86278635, 0.94622083, 1.05277811, + 1.39202815, 1.83525007, 1.84492621, 2.06084887, 2.06844475])) + """ + +@overload +def logcumsumexp( + input: Tensor, + dim: str | EllipsisType | None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + logcumsumexp(input, dim, *, out=None) -> Tensor + Returns the logarithm of the cumulative summation of the exponentiation of + elements of :attr:`input` in the dimension :attr:`dim`. + + For summation index :math:`j` given by `dim` and other indices :math:`i`, the result is + + .. math:: + \text{logcumsumexp}(x)_{ij} = \log \sum\limits_{k=0}^{j} \exp(x_{ik}) + + Args: + input (Tensor): the input tensor. + dim (int): the dimension to do the operation over + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(10) + >>> torch.logcumsumexp(a, dim=0) + tensor([-0.42296738, -0.04462666, 0.86278635, 0.94622083, 1.05277811, + 1.39202815, 1.83525007, 1.84492621, 2.06084887, 2.06844475])) + """ + +def logdet(input: Tensor) -> Tensor: + r""" + logdet(input) -> Tensor + + Calculates log determinant of a square matrix or batches of square matrices. + + It returns ``-inf`` if the input has a determinant of zero, and ``NaN`` if it has + a negative determinant. + + .. note:: + Backward through :meth:`logdet` internally uses SVD results when :attr:`input` + is not invertible. In this case, double backward through :meth:`logdet` will + be unstable in when :attr:`input` doesn't have distinct singular values. See + :func:`torch.linalg.svd` for details. + + .. seealso:: + + :func:`torch.linalg.slogdet` computes the sign (resp. angle) and natural logarithm of the + absolute value of the determinant of real-valued (resp. complex) square matrices. + + Arguments: + input (Tensor): the input tensor of size ``(*, n, n)`` where ``*`` is zero or more + batch dimensions. + + Example:: + + >>> A = torch.randn(3, 3) + >>> torch.det(A) + tensor(0.2611) + >>> torch.logdet(A) + tensor(-1.3430) + >>> A + tensor([[[ 0.9254, -0.6213], + [-0.5787, 1.6843]], + + [[ 0.3242, -0.9665], + [ 0.4539, -0.0887]], + + [[ 1.1336, -0.4025], + [-0.7089, 0.9032]]]) + >>> A.det() + tensor([1.1990, 0.4099, 0.7386]) + >>> A.det().log() + tensor([ 0.1815, -0.8917, -0.3031]) + """ + +def logical_and( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + logical_and(input, other, *, out=None) -> Tensor + + Computes the element-wise logical AND of the given input tensors. Zeros are treated as ``False`` and nonzeros are + treated as ``True``. + + Args: + input (Tensor): the input tensor. + other (Tensor): the tensor to compute AND with + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.logical_and(torch.tensor([True, False, True]), torch.tensor([True, False, False])) + tensor([ True, False, False]) + >>> a = torch.tensor([0, 1, 10, 0], dtype=torch.int8) + >>> b = torch.tensor([4, 0, 1, 0], dtype=torch.int8) + >>> torch.logical_and(a, b) + tensor([False, False, True, False]) + >>> torch.logical_and(a.double(), b.double()) + tensor([False, False, True, False]) + >>> torch.logical_and(a.double(), b) + tensor([False, False, True, False]) + >>> torch.logical_and(a, b, out=torch.empty(4, dtype=torch.bool)) + tensor([False, False, True, False]) + """ + +def logical_not(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + logical_not(input, *, out=None) -> Tensor + + Computes the element-wise logical NOT of the given input tensor. If not specified, the output tensor will have the bool + dtype. If the input tensor is not a bool tensor, zeros are treated as ``False`` and non-zeros are treated as ``True``. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.logical_not(torch.tensor([True, False])) + tensor([False, True]) + >>> torch.logical_not(torch.tensor([0, 1, -10], dtype=torch.int8)) + tensor([ True, False, False]) + >>> torch.logical_not(torch.tensor([0., 1.5, -10.], dtype=torch.double)) + tensor([ True, False, False]) + >>> torch.logical_not(torch.tensor([0., 1., -10.], dtype=torch.double), out=torch.empty(3, dtype=torch.int16)) + tensor([1, 0, 0], dtype=torch.int16) + """ + +def logical_or( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + logical_or(input, other, *, out=None) -> Tensor + + Computes the element-wise logical OR of the given input tensors. Zeros are treated as ``False`` and nonzeros are + treated as ``True``. + + Args: + input (Tensor): the input tensor. + other (Tensor): the tensor to compute OR with + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.logical_or(torch.tensor([True, False, True]), torch.tensor([True, False, False])) + tensor([ True, False, True]) + >>> a = torch.tensor([0, 1, 10, 0], dtype=torch.int8) + >>> b = torch.tensor([4, 0, 1, 0], dtype=torch.int8) + >>> torch.logical_or(a, b) + tensor([ True, True, True, False]) + >>> torch.logical_or(a.double(), b.double()) + tensor([ True, True, True, False]) + >>> torch.logical_or(a.double(), b) + tensor([ True, True, True, False]) + >>> torch.logical_or(a, b, out=torch.empty(4, dtype=torch.bool)) + tensor([ True, True, True, False]) + """ + +def logical_xor( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + logical_xor(input: Tensor, other: Tensor, *, out: Optional[Tensor]) -> Tensor + + Computes the element-wise logical XOR of the given input tensors. Zeros are treated as ``False`` and nonzeros are + treated as ``True``. + + Args: + input (Tensor): the input tensor. + other (Tensor): the tensor to compute XOR with + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.logical_xor(torch.tensor([True, False, True]), torch.tensor([True, False, False])) + tensor([False, False, True]) + >>> a = torch.tensor([0, 1, 10, 0], dtype=torch.int8) + >>> b = torch.tensor([4, 0, 1, 0], dtype=torch.int8) + >>> torch.logical_xor(a, b) + tensor([ True, True, False, False]) + >>> torch.logical_xor(a.double(), b.double()) + tensor([ True, True, False, False]) + >>> torch.logical_xor(a.double(), b) + tensor([ True, True, False, False]) + >>> torch.logical_xor(a, b, out=torch.empty(4, dtype=torch.bool)) + tensor([ True, True, False, False]) + """ + +def logit( + input: Tensor, + eps: _float | None = None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + logit(input, eps=None, *, out=None) -> Tensor + + Alias for :func:`torch.special.logit`. + """ + +def logit_(input: Tensor, eps: _float | None = None) -> Tensor: ... +@overload +def logspace( + start: Number, + end: Number, + steps: _int | None = None, + base: _float = 10.0, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + pin_memory: _bool = False, +) -> Tensor: + r""" + logspace(start, end, steps, base=10.0, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + + Creates a one-dimensional tensor of size :attr:`steps` whose values are evenly + spaced from :math:`{{\text{{base}}}}^{{\text{{start}}}}` to + :math:`{{\text{{base}}}}^{{\text{{end}}}}`, inclusive, on a logarithmic scale + with base :attr:`base`. That is, the values are: + + .. math:: + (\text{base}^{\text{start}}, + \text{base}^{(\text{start} + \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, + \ldots, + \text{base}^{(\text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, + \text{base}^{\text{end}}) + + + + From PyTorch 1.11 logspace requires the steps argument. Use steps=100 to restore the previous behavior. + + Args: + start (float or Tensor): the starting value for the set of points. If `Tensor`, it must be 0-dimensional + end (float or Tensor): the ending value for the set of points. If `Tensor`, it must be 0-dimensional + steps (int): size of the constructed tensor + base (float, optional): base of the logarithm function. Default: ``10.0``. + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the data type to perform the computation in. + Default: if None, uses the global default dtype (see torch.get_default_dtype()) + when both :attr:`start` and :attr:`end` are real, + and corresponding complex dtype when either is complex. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.logspace(start=-10, end=10, steps=5) + tensor([ 1.0000e-10, 1.0000e-05, 1.0000e+00, 1.0000e+05, 1.0000e+10]) + >>> torch.logspace(start=0.1, end=1.0, steps=5) + tensor([ 1.2589, 2.1135, 3.5481, 5.9566, 10.0000]) + >>> torch.logspace(start=0.1, end=1.0, steps=1) + tensor([1.2589]) + >>> torch.logspace(start=2, end=2, steps=1, base=2) + tensor([4.0]) + """ + +@overload +def logspace( + start: Tensor, + end: Tensor, + steps: _int, + base: _float = 10.0, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + logspace(start, end, steps, base=10.0, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + + Creates a one-dimensional tensor of size :attr:`steps` whose values are evenly + spaced from :math:`{{\text{{base}}}}^{{\text{{start}}}}` to + :math:`{{\text{{base}}}}^{{\text{{end}}}}`, inclusive, on a logarithmic scale + with base :attr:`base`. That is, the values are: + + .. math:: + (\text{base}^{\text{start}}, + \text{base}^{(\text{start} + \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, + \ldots, + \text{base}^{(\text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, + \text{base}^{\text{end}}) + + + + From PyTorch 1.11 logspace requires the steps argument. Use steps=100 to restore the previous behavior. + + Args: + start (float or Tensor): the starting value for the set of points. If `Tensor`, it must be 0-dimensional + end (float or Tensor): the ending value for the set of points. If `Tensor`, it must be 0-dimensional + steps (int): size of the constructed tensor + base (float, optional): base of the logarithm function. Default: ``10.0``. + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the data type to perform the computation in. + Default: if None, uses the global default dtype (see torch.get_default_dtype()) + when both :attr:`start` and :attr:`end` are real, + and corresponding complex dtype when either is complex. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.logspace(start=-10, end=10, steps=5) + tensor([ 1.0000e-10, 1.0000e-05, 1.0000e+00, 1.0000e+05, 1.0000e+10]) + >>> torch.logspace(start=0.1, end=1.0, steps=5) + tensor([ 1.2589, 2.1135, 3.5481, 5.9566, 10.0000]) + >>> torch.logspace(start=0.1, end=1.0, steps=1) + tensor([1.2589]) + >>> torch.logspace(start=2, end=2, steps=1, base=2) + tensor([4.0]) + """ + +@overload +def logspace( + start: Number | _complex, + end: Tensor, + steps: _int, + base: _float = 10.0, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + logspace(start, end, steps, base=10.0, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + + Creates a one-dimensional tensor of size :attr:`steps` whose values are evenly + spaced from :math:`{{\text{{base}}}}^{{\text{{start}}}}` to + :math:`{{\text{{base}}}}^{{\text{{end}}}}`, inclusive, on a logarithmic scale + with base :attr:`base`. That is, the values are: + + .. math:: + (\text{base}^{\text{start}}, + \text{base}^{(\text{start} + \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, + \ldots, + \text{base}^{(\text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, + \text{base}^{\text{end}}) + + + + From PyTorch 1.11 logspace requires the steps argument. Use steps=100 to restore the previous behavior. + + Args: + start (float or Tensor): the starting value for the set of points. If `Tensor`, it must be 0-dimensional + end (float or Tensor): the ending value for the set of points. If `Tensor`, it must be 0-dimensional + steps (int): size of the constructed tensor + base (float, optional): base of the logarithm function. Default: ``10.0``. + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the data type to perform the computation in. + Default: if None, uses the global default dtype (see torch.get_default_dtype()) + when both :attr:`start` and :attr:`end` are real, + and corresponding complex dtype when either is complex. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.logspace(start=-10, end=10, steps=5) + tensor([ 1.0000e-10, 1.0000e-05, 1.0000e+00, 1.0000e+05, 1.0000e+10]) + >>> torch.logspace(start=0.1, end=1.0, steps=5) + tensor([ 1.2589, 2.1135, 3.5481, 5.9566, 10.0000]) + >>> torch.logspace(start=0.1, end=1.0, steps=1) + tensor([1.2589]) + >>> torch.logspace(start=2, end=2, steps=1, base=2) + tensor([4.0]) + """ + +@overload +def logspace( + start: Tensor, + end: Number | _complex, + steps: _int, + base: _float = 10.0, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + logspace(start, end, steps, base=10.0, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + + Creates a one-dimensional tensor of size :attr:`steps` whose values are evenly + spaced from :math:`{{\text{{base}}}}^{{\text{{start}}}}` to + :math:`{{\text{{base}}}}^{{\text{{end}}}}`, inclusive, on a logarithmic scale + with base :attr:`base`. That is, the values are: + + .. math:: + (\text{base}^{\text{start}}, + \text{base}^{(\text{start} + \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, + \ldots, + \text{base}^{(\text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, + \text{base}^{\text{end}}) + + + + From PyTorch 1.11 logspace requires the steps argument. Use steps=100 to restore the previous behavior. + + Args: + start (float or Tensor): the starting value for the set of points. If `Tensor`, it must be 0-dimensional + end (float or Tensor): the ending value for the set of points. If `Tensor`, it must be 0-dimensional + steps (int): size of the constructed tensor + base (float, optional): base of the logarithm function. Default: ``10.0``. + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the data type to perform the computation in. + Default: if None, uses the global default dtype (see torch.get_default_dtype()) + when both :attr:`start` and :attr:`end` are real, + and corresponding complex dtype when either is complex. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.logspace(start=-10, end=10, steps=5) + tensor([ 1.0000e-10, 1.0000e-05, 1.0000e+00, 1.0000e+05, 1.0000e+10]) + >>> torch.logspace(start=0.1, end=1.0, steps=5) + tensor([ 1.2589, 2.1135, 3.5481, 5.9566, 10.0000]) + >>> torch.logspace(start=0.1, end=1.0, steps=1) + tensor([1.2589]) + >>> torch.logspace(start=2, end=2, steps=1, base=2) + tensor([4.0]) + """ + +@overload +def logspace( + start: Number | _complex, + end: Number | _complex, + steps: _int, + base: _float = 10.0, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + logspace(start, end, steps, base=10.0, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + + Creates a one-dimensional tensor of size :attr:`steps` whose values are evenly + spaced from :math:`{{\text{{base}}}}^{{\text{{start}}}}` to + :math:`{{\text{{base}}}}^{{\text{{end}}}}`, inclusive, on a logarithmic scale + with base :attr:`base`. That is, the values are: + + .. math:: + (\text{base}^{\text{start}}, + \text{base}^{(\text{start} + \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, + \ldots, + \text{base}^{(\text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, + \text{base}^{\text{end}}) + + + + From PyTorch 1.11 logspace requires the steps argument. Use steps=100 to restore the previous behavior. + + Args: + start (float or Tensor): the starting value for the set of points. If `Tensor`, it must be 0-dimensional + end (float or Tensor): the ending value for the set of points. If `Tensor`, it must be 0-dimensional + steps (int): size of the constructed tensor + base (float, optional): base of the logarithm function. Default: ``10.0``. + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the data type to perform the computation in. + Default: if None, uses the global default dtype (see torch.get_default_dtype()) + when both :attr:`start` and :attr:`end` are real, + and corresponding complex dtype when either is complex. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.logspace(start=-10, end=10, steps=5) + tensor([ 1.0000e-10, 1.0000e-05, 1.0000e+00, 1.0000e+05, 1.0000e+10]) + >>> torch.logspace(start=0.1, end=1.0, steps=5) + tensor([ 1.2589, 2.1135, 3.5481, 5.9566, 10.0000]) + >>> torch.logspace(start=0.1, end=1.0, steps=1) + tensor([1.2589]) + >>> torch.logspace(start=2, end=2, steps=1, base=2) + tensor([4.0]) + """ + +@overload +def logsumexp( + input: Tensor, + dim: _int | _size, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + logsumexp(input, dim, keepdim=False, *, out=None) + + Returns the log of summed exponentials of each row of the :attr:`input` + tensor in the given dimension :attr:`dim`. The computation is numerically + stabilized. + + For summation index :math:`j` given by `dim` and other indices :math:`i`, the result is + + .. math:: + \text{logsumexp}(x)_{i} = \log \sum_j \exp(x_{ij}) + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + dim (int or tuple of ints): the dimension or dimensions to reduce. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(3, 3) + >>> torch.logsumexp(a, 1) + tensor([1.4907, 1.0593, 1.5696]) + >>> torch.dist(torch.logsumexp(a, 1), torch.log(torch.sum(torch.exp(a), 1))) + tensor(1.6859e-07) + """ + +@overload +def logsumexp( + input: Tensor, + dim: Sequence[str | EllipsisType | None], + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + logsumexp(input, dim, keepdim=False, *, out=None) + + Returns the log of summed exponentials of each row of the :attr:`input` + tensor in the given dimension :attr:`dim`. The computation is numerically + stabilized. + + For summation index :math:`j` given by `dim` and other indices :math:`i`, the result is + + .. math:: + \text{logsumexp}(x)_{i} = \log \sum_j \exp(x_{ij}) + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + dim (int or tuple of ints): the dimension or dimensions to reduce. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(3, 3) + >>> torch.logsumexp(a, 1) + tensor([1.4907, 1.0593, 1.5696]) + >>> torch.dist(torch.logsumexp(a, 1), torch.log(torch.sum(torch.exp(a), 1))) + tensor(1.6859e-07) + """ + +@overload +def lstm( + data: Tensor, + batch_sizes: Tensor, + hx: tuple[Tensor, ...] | list[Tensor] | None, + params: tuple[Tensor, ...] | list[Tensor] | None, + has_biases: _bool, + num_layers: _int, + dropout: _float, + train: _bool, + bidirectional: _bool, +) -> tuple[Tensor, Tensor, Tensor]: ... +@overload +def lstm( + input: Tensor, + hx: tuple[Tensor, ...] | list[Tensor] | None, + params: tuple[Tensor, ...] | list[Tensor] | None, + has_biases: _bool, + num_layers: _int, + dropout: _float, + train: _bool, + bidirectional: _bool, + batch_first: _bool, +) -> tuple[Tensor, Tensor, Tensor]: ... +def lstm_cell( + input: Tensor, + hx: tuple[Tensor, ...] | list[Tensor] | None, + w_ih: Tensor, + w_hh: Tensor, + b_ih: Tensor | None = None, + b_hh: Tensor | None = None, +) -> tuple[Tensor, Tensor]: ... +@overload +def lt( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + lt(input, other, *, out=None) -> Tensor + + Computes :math:`\text{input} < \text{other}` element-wise. + + + The second argument can be a number or a tensor whose shape is + :ref:`broadcastable ` with the first argument. + + Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is less than :attr:`other` and False elsewhere + + Example:: + + >>> torch.lt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[False, False], [True, False]]) + """ + +@overload +def lt( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + lt(input, other, *, out=None) -> Tensor + + Computes :math:`\text{input} < \text{other}` element-wise. + + + The second argument can be a number or a tensor whose shape is + :ref:`broadcastable ` with the first argument. + + Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is less than :attr:`other` and False elsewhere + + Example:: + + >>> torch.lt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[False, False], [True, False]]) + """ + +def lu_solve( + input: Tensor, + LU_data: Tensor, + LU_pivots: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + lu_solve(b, LU_data, LU_pivots, *, out=None) -> Tensor + + Returns the LU solve of the linear system :math:`Ax = b` using the partially pivoted + LU factorization of A from :func:`~linalg.lu_factor`. + + This function supports ``float``, ``double``, ``cfloat`` and ``cdouble`` dtypes for :attr:`input`. + + .. warning:: + + :func:`torch.lu_solve` is deprecated in favor of :func:`torch.linalg.lu_solve`. + :func:`torch.lu_solve` will be removed in a future PyTorch release. + ``X = torch.lu_solve(B, LU, pivots)`` should be replaced with + + .. code:: python + + X = linalg.lu_solve(LU, pivots, B) + + Arguments: + b (Tensor): the RHS tensor of size :math:`(*, m, k)`, where :math:`*` + is zero or more batch dimensions. + LU_data (Tensor): the pivoted LU factorization of A from :meth:`~linalg.lu_factor` of size :math:`(*, m, m)`, + where :math:`*` is zero or more batch dimensions. + LU_pivots (IntTensor): the pivots of the LU factorization from :meth:`~linalg.lu_factor` of size :math:`(*, m)`, + where :math:`*` is zero or more batch dimensions. + The batch dimensions of :attr:`LU_pivots` must be equal to the batch dimensions of + :attr:`LU_data`. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> A = torch.randn(2, 3, 3) + >>> b = torch.randn(2, 3, 1) + >>> LU, pivots = torch.linalg.lu_factor(A) + >>> x = torch.lu_solve(b, LU, pivots) + >>> torch.dist(A @ x, b) + tensor(1.00000e-07 * + 2.8312) + """ + +def lu_unpack( + LU_data: Tensor, + LU_pivots: Tensor, + unpack_data: _bool = True, + unpack_pivots: _bool = True, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.lu_unpack: + r""" + lu_unpack(LU_data, LU_pivots, unpack_data=True, unpack_pivots=True, *, out=None) -> (Tensor, Tensor, Tensor) + + Unpacks the LU decomposition returned by :func:`~linalg.lu_factor` into the `P, L, U` matrices. + + .. seealso:: + + :func:`~linalg.lu` returns the matrices from the LU decomposition. Its gradient formula is more efficient + than that of doing :func:`~linalg.lu_factor` followed by :func:`~linalg.lu_unpack`. + + Args: + LU_data (Tensor): the packed LU factorization data + LU_pivots (Tensor): the packed LU factorization pivots + unpack_data (bool): flag indicating if the data should be unpacked. + If ``False``, then the returned ``L`` and ``U`` are empty tensors. + Default: ``True`` + unpack_pivots (bool): flag indicating if the pivots should be unpacked into a permutation matrix ``P``. + If ``False``, then the returned ``P`` is an empty tensor. + Default: ``True`` + + Keyword args: + out (tuple, optional): output tuple of three tensors. Ignored if `None`. + + Returns: + A namedtuple ``(P, L, U)`` + + Examples:: + + >>> A = torch.randn(2, 3, 3) + >>> LU, pivots = torch.linalg.lu_factor(A) + >>> P, L, U = torch.lu_unpack(LU, pivots) + >>> # We can recover A from the factorization + >>> A_ = P @ L @ U + >>> torch.allclose(A, A_) + True + + >>> # LU factorization of a rectangular matrix: + >>> A = torch.randn(2, 3, 2) + >>> LU, pivots = torch.linalg.lu_factor(A) + >>> P, L, U = torch.lu_unpack(LU, pivots) + >>> # P, L, U are the same as returned by linalg.lu + >>> P_, L_, U_ = torch.linalg.lu(A) + >>> torch.allclose(P, P_) and torch.allclose(L, L_) and torch.allclose(U, U_) + True + """ + +def margin_ranking_loss( + input1: Tensor, + input2: Tensor, + target: Tensor, + margin: _float = 0.0, + reduction: _int = 1, +) -> Tensor: ... +@overload +def masked_fill(input: Tensor, mask: Tensor, value: Tensor) -> Tensor: ... +@overload +def masked_fill( + input: Tensor, + mask: Tensor, + value: Number | _complex, +) -> Tensor: ... +def masked_scatter(input: Tensor, mask: Tensor, source: Tensor) -> Tensor: ... +def masked_select( + input: Tensor, + mask: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + masked_select(input, mask, *, out=None) -> Tensor + + Returns a new 1-D tensor which indexes the :attr:`input` tensor according to + the boolean mask :attr:`mask` which is a `BoolTensor`. + + The shapes of the :attr:`mask` tensor and the :attr:`input` tensor don't need + to match, but they must be :ref:`broadcastable `. + + .. note:: The returned tensor does **not** use the same storage + as the original tensor + + Args: + input (Tensor): the input tensor. + mask (BoolTensor): the tensor containing the binary mask to index with + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> x = torch.randn(3, 4) + >>> x + tensor([[ 0.3552, -2.3825, -0.8297, 0.3477], + [-1.2035, 1.2252, 0.5002, 0.6248], + [ 0.1307, -2.0608, 0.1244, 2.0139]]) + >>> mask = x.ge(0.5) + >>> mask + tensor([[False, False, False, False], + [False, True, True, True], + [False, False, False, True]]) + >>> torch.masked_select(x, mask) + tensor([ 1.2252, 0.5002, 0.6248, 2.0139]) + """ + +def matmul( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + matmul(input, other, *, out=None) -> Tensor + + Matrix product of two tensors. + + The behavior depends on the dimensionality of the tensors as follows: + + - If both tensors are 1-dimensional, the dot product (scalar) is returned. + - If both arguments are 2-dimensional, the matrix-matrix product is returned. + - If the first argument is 1-dimensional and the second argument is 2-dimensional, + a 1 is prepended to its dimension for the purpose of the matrix multiply. + After the matrix multiply, the prepended dimension is removed. + - If the first argument is 2-dimensional and the second argument is 1-dimensional, + the matrix-vector product is returned. + - If both arguments are at least 1-dimensional and at least one argument is + N-dimensional (where N > 2), then a batched matrix multiply is returned. If the first + argument is 1-dimensional, a 1 is prepended to its dimension for the purpose of the + batched matrix multiply and removed after. If the second argument is 1-dimensional, a + 1 is appended to its dimension for the purpose of the batched matrix multiply and removed after. + + The first N-2 dimensions of each argument, the batch dimensions, are + :ref:`broadcast ` (and thus must be broadcastable). + The last 2, the matrix dimensions, are handled as in the matrix-matrix product. + + For example, if :attr:`input` is a + :math:`(j \times 1 \times n \times m)` tensor and :attr:`other` is a :math:`(k \times m \times p)` + tensor, the batch dimensions are :math:`(j \times 1)` and :math:`(k)`, + and the matrix dimensions are :math:`(n \times m)` and :math:`(m \times p)`. + :attr:`out` will be a :math:`(j \times k \times n \times p)` tensor. + + This operation has support for arguments with :ref:`sparse layouts`. In particular the + matrix-matrix (both arguments 2-dimensional) supports sparse arguments with the same restrictions + as :func:`torch.mm` + + + .. warning:: + Sparse support is a beta feature and some layout(s)/dtype/device combinations may not be supported, + or may not have autograd support. If you notice missing functionality please + open a feature request. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + .. note:: + + The 1-dimensional dot product version of this function does not support an :attr:`out` parameter. + + Arguments: + input (Tensor): the first tensor to be multiplied + other (Tensor): the second tensor to be multiplied + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> # vector x vector + >>> tensor1 = torch.randn(3) + >>> tensor2 = torch.randn(3) + >>> torch.matmul(tensor1, tensor2).size() + torch.Size([]) + >>> # matrix x vector + >>> tensor1 = torch.randn(3, 4) + >>> tensor2 = torch.randn(4) + >>> torch.matmul(tensor1, tensor2).size() + torch.Size([3]) + >>> # batched matrix x broadcasted vector + >>> tensor1 = torch.randn(10, 3, 4) + >>> tensor2 = torch.randn(4) + >>> torch.matmul(tensor1, tensor2).size() + torch.Size([10, 3]) + >>> # batched matrix x batched matrix + >>> tensor1 = torch.randn(10, 3, 4) + >>> tensor2 = torch.randn(10, 4, 5) + >>> torch.matmul(tensor1, tensor2).size() + torch.Size([10, 3, 5]) + >>> # batched matrix x broadcasted matrix + >>> tensor1 = torch.randn(10, 3, 4) + >>> tensor2 = torch.randn(4, 5) + >>> torch.matmul(tensor1, tensor2).size() + torch.Size([10, 3, 5]) + """ + +def matrix_exp(input: Tensor) -> Tensor: + r""" + matrix_exp(A) -> Tensor + + Alias for :func:`torch.linalg.matrix_exp`. + """ + +def matrix_power( + input: Tensor, + n: _int, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + matrix_power(input, n, *, out=None) -> Tensor + + Alias for :func:`torch.linalg.matrix_power` + """ + +@overload +def max(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + max(input, *, out=None) -> Tensor + + Returns the maximum value of all elements in the ``input`` tensor. + + .. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.6763, 0.7445, -2.2369]]) + >>> torch.max(a) + tensor(0.7445) + + .. function:: max(input, dim, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` is the maximum + value of each row of the :attr:`input` tensor in the given dimension + :attr:`dim`. And ``indices`` is the index location of each maximum value found + (argmax). + + If ``keepdim`` is ``True``, the output tensors are of the same size + as ``input`` except in the dimension ``dim`` where they are of size 1. + Otherwise, ``dim`` is squeezed (see :func:`torch.squeeze`), resulting + in the output tensors having 1 fewer dimension than ``input``. + + .. note:: If there are multiple maximal values in a reduced row then + the indices of the first maximal value are returned. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. If omitted, all dimensions are reduced. Explicit ``None`` is not supported. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (tuple, optional): the result tuple of two output tensors (max, max_indices) + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-1.2360, -0.2942, -0.1222, 0.8475], + [ 1.1949, -1.1127, -2.2379, -0.6702], + [ 1.5717, -0.9207, 0.1297, -1.8768], + [-0.6172, 1.0036, -0.6060, -0.2432]]) + >>> torch.max(a, 1) + torch.return_types.max(values=tensor([0.8475, 1.1949, 1.5717, 1.0036]), indices=tensor([3, 0, 0, 1])) + >>> a = torch.tensor([[1.0, 2.0], [3.0, 4.0]]) + >>> a.max(dim=1, keepdim=True) + torch.return_types.max( + values=tensor([[2.], [4.]]), + indices=tensor([[1], [1]])) + >>> a.max(dim=1, keepdim=False) + torch.return_types.max( + values=tensor([2., 4.]), + indices=tensor([1, 1])) + + .. function:: max(input, other, *, out=None) -> Tensor + :noindex: + + See :func:`torch.maximum`. + """ + +@overload +def max( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + max(input, *, out=None) -> Tensor + + Returns the maximum value of all elements in the ``input`` tensor. + + .. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.6763, 0.7445, -2.2369]]) + >>> torch.max(a) + tensor(0.7445) + + .. function:: max(input, dim, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` is the maximum + value of each row of the :attr:`input` tensor in the given dimension + :attr:`dim`. And ``indices`` is the index location of each maximum value found + (argmax). + + If ``keepdim`` is ``True``, the output tensors are of the same size + as ``input`` except in the dimension ``dim`` where they are of size 1. + Otherwise, ``dim`` is squeezed (see :func:`torch.squeeze`), resulting + in the output tensors having 1 fewer dimension than ``input``. + + .. note:: If there are multiple maximal values in a reduced row then + the indices of the first maximal value are returned. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. If omitted, all dimensions are reduced. Explicit ``None`` is not supported. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (tuple, optional): the result tuple of two output tensors (max, max_indices) + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-1.2360, -0.2942, -0.1222, 0.8475], + [ 1.1949, -1.1127, -2.2379, -0.6702], + [ 1.5717, -0.9207, 0.1297, -1.8768], + [-0.6172, 1.0036, -0.6060, -0.2432]]) + >>> torch.max(a, 1) + torch.return_types.max(values=tensor([0.8475, 1.1949, 1.5717, 1.0036]), indices=tensor([3, 0, 0, 1])) + >>> a = torch.tensor([[1.0, 2.0], [3.0, 4.0]]) + >>> a.max(dim=1, keepdim=True) + torch.return_types.max( + values=tensor([[2.], [4.]]), + indices=tensor([[1], [1]])) + >>> a.max(dim=1, keepdim=False) + torch.return_types.max( + values=tensor([2., 4.]), + indices=tensor([1, 1])) + + .. function:: max(input, other, *, out=None) -> Tensor + :noindex: + + See :func:`torch.maximum`. + """ + +@overload +def max( + input: Tensor, + dim: _int, + keepdim: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.max: + r""" + max(input, *, out=None) -> Tensor + + Returns the maximum value of all elements in the ``input`` tensor. + + .. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.6763, 0.7445, -2.2369]]) + >>> torch.max(a) + tensor(0.7445) + + .. function:: max(input, dim, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` is the maximum + value of each row of the :attr:`input` tensor in the given dimension + :attr:`dim`. And ``indices`` is the index location of each maximum value found + (argmax). + + If ``keepdim`` is ``True``, the output tensors are of the same size + as ``input`` except in the dimension ``dim`` where they are of size 1. + Otherwise, ``dim`` is squeezed (see :func:`torch.squeeze`), resulting + in the output tensors having 1 fewer dimension than ``input``. + + .. note:: If there are multiple maximal values in a reduced row then + the indices of the first maximal value are returned. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. If omitted, all dimensions are reduced. Explicit ``None`` is not supported. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (tuple, optional): the result tuple of two output tensors (max, max_indices) + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-1.2360, -0.2942, -0.1222, 0.8475], + [ 1.1949, -1.1127, -2.2379, -0.6702], + [ 1.5717, -0.9207, 0.1297, -1.8768], + [-0.6172, 1.0036, -0.6060, -0.2432]]) + >>> torch.max(a, 1) + torch.return_types.max(values=tensor([0.8475, 1.1949, 1.5717, 1.0036]), indices=tensor([3, 0, 0, 1])) + >>> a = torch.tensor([[1.0, 2.0], [3.0, 4.0]]) + >>> a.max(dim=1, keepdim=True) + torch.return_types.max( + values=tensor([[2.], [4.]]), + indices=tensor([[1], [1]])) + >>> a.max(dim=1, keepdim=False) + torch.return_types.max( + values=tensor([2., 4.]), + indices=tensor([1, 1])) + + .. function:: max(input, other, *, out=None) -> Tensor + :noindex: + + See :func:`torch.maximum`. + """ + +@overload +def max( + input: Tensor, + dim: str | EllipsisType | None, + keepdim: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.max: + r""" + max(input, *, out=None) -> Tensor + + Returns the maximum value of all elements in the ``input`` tensor. + + .. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.6763, 0.7445, -2.2369]]) + >>> torch.max(a) + tensor(0.7445) + + .. function:: max(input, dim, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` is the maximum + value of each row of the :attr:`input` tensor in the given dimension + :attr:`dim`. And ``indices`` is the index location of each maximum value found + (argmax). + + If ``keepdim`` is ``True``, the output tensors are of the same size + as ``input`` except in the dimension ``dim`` where they are of size 1. + Otherwise, ``dim`` is squeezed (see :func:`torch.squeeze`), resulting + in the output tensors having 1 fewer dimension than ``input``. + + .. note:: If there are multiple maximal values in a reduced row then + the indices of the first maximal value are returned. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. If omitted, all dimensions are reduced. Explicit ``None`` is not supported. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (tuple, optional): the result tuple of two output tensors (max, max_indices) + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-1.2360, -0.2942, -0.1222, 0.8475], + [ 1.1949, -1.1127, -2.2379, -0.6702], + [ 1.5717, -0.9207, 0.1297, -1.8768], + [-0.6172, 1.0036, -0.6060, -0.2432]]) + >>> torch.max(a, 1) + torch.return_types.max(values=tensor([0.8475, 1.1949, 1.5717, 1.0036]), indices=tensor([3, 0, 0, 1])) + >>> a = torch.tensor([[1.0, 2.0], [3.0, 4.0]]) + >>> a.max(dim=1, keepdim=True) + torch.return_types.max( + values=tensor([[2.], [4.]]), + indices=tensor([[1], [1]])) + >>> a.max(dim=1, keepdim=False) + torch.return_types.max( + values=tensor([2., 4.]), + indices=tensor([1, 1])) + + .. function:: max(input, other, *, out=None) -> Tensor + :noindex: + + See :func:`torch.maximum`. + """ + +def max_pool1d( + input: Tensor, + kernel_size: _int | _size, + stride: _int | _size = (), + padding: _int | _size = 0, + dilation: _int | _size = 1, + ceil_mode: _bool = False, +) -> Tensor: ... +def max_pool1d_with_indices( + input: Tensor, + kernel_size: _int | _size, + stride: _int | _size = (), + padding: _int | _size = 0, + dilation: _int | _size = 1, + ceil_mode: _bool = False, +) -> tuple[Tensor, Tensor]: ... +def max_pool2d( + input: Tensor, + kernel_size: _int | _size, + stride: _int | _size = (), + padding: _int | _size = 0, + dilation: _int | _size = 1, + ceil_mode: _bool = False, +) -> Tensor: ... +def max_pool3d( + input: Tensor, + kernel_size: _int | _size, + stride: _int | _size = (), + padding: _int | _size = 0, + dilation: _int | _size = 1, + ceil_mode: _bool = False, +) -> Tensor: ... +def maximum( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + maximum(input, other, *, out=None) -> Tensor + + Computes the element-wise maximum of :attr:`input` and :attr:`other`. + + .. note:: + If one of the elements being compared is a NaN, then that element is returned. + :func:`maximum` is not supported for tensors with complex dtypes. + + Args: + input (Tensor): the input tensor. + other (Tensor): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor((1, 2, -1)) + >>> b = torch.tensor((3, 0, 4)) + >>> torch.maximum(a, b) + tensor([3, 2, 4]) + """ + +@overload +def mean( + input: Tensor, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + mean(input, *, dtype=None) -> Tensor + + .. note:: + If the `input` tensor is empty, ``torch.mean()`` returns ``nan``. + This behavior is consistent with NumPy and follows the definition + that the mean over an empty set is undefined. + + + Returns the mean value of all elements in the :attr:`input` tensor. Input must be floating point or complex. + + Args: + input (Tensor): + the input tensor, either of floating point or complex dtype + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.2294, -0.5481, 1.3288]]) + >>> torch.mean(a) + tensor(0.3367) + + .. function:: mean(input, dim, keepdim=False, *, dtype=None, out=None) -> Tensor + :noindex: + + Returns the mean value of each row of the :attr:`input` tensor in the given + dimension :attr:`dim`. If :attr:`dim` is a list of dimensions, + reduce over all of them. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + out (Tensor, optional): the output tensor. + + .. seealso:: + + :func:`torch.nanmean` computes the mean value of `non-NaN` elements. + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-0.3841, 0.6320, 0.4254, -0.7384], + [-0.9644, 1.0131, -0.6549, -1.4279], + [-0.2951, -1.3350, -0.7694, 0.5600], + [ 1.0842, -0.9580, 0.3623, 0.2343]]) + >>> torch.mean(a, 1) + tensor([-0.0163, -0.5085, -0.4599, 0.1807]) + >>> torch.mean(a, 1, True) + tensor([[-0.0163], + [-0.5085], + [-0.4599], + [ 0.1807]]) + """ + +@overload +def mean( + input: Tensor, + dim: _int | _size | None, + keepdim: _bool = False, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + mean(input, *, dtype=None) -> Tensor + + .. note:: + If the `input` tensor is empty, ``torch.mean()`` returns ``nan``. + This behavior is consistent with NumPy and follows the definition + that the mean over an empty set is undefined. + + + Returns the mean value of all elements in the :attr:`input` tensor. Input must be floating point or complex. + + Args: + input (Tensor): + the input tensor, either of floating point or complex dtype + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.2294, -0.5481, 1.3288]]) + >>> torch.mean(a) + tensor(0.3367) + + .. function:: mean(input, dim, keepdim=False, *, dtype=None, out=None) -> Tensor + :noindex: + + Returns the mean value of each row of the :attr:`input` tensor in the given + dimension :attr:`dim`. If :attr:`dim` is a list of dimensions, + reduce over all of them. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + out (Tensor, optional): the output tensor. + + .. seealso:: + + :func:`torch.nanmean` computes the mean value of `non-NaN` elements. + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-0.3841, 0.6320, 0.4254, -0.7384], + [-0.9644, 1.0131, -0.6549, -1.4279], + [-0.2951, -1.3350, -0.7694, 0.5600], + [ 1.0842, -0.9580, 0.3623, 0.2343]]) + >>> torch.mean(a, 1) + tensor([-0.0163, -0.5085, -0.4599, 0.1807]) + >>> torch.mean(a, 1, True) + tensor([[-0.0163], + [-0.5085], + [-0.4599], + [ 0.1807]]) + """ + +@overload +def mean( + input: Tensor, + dim: Sequence[str | EllipsisType | None], + keepdim: _bool = False, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + mean(input, *, dtype=None) -> Tensor + + .. note:: + If the `input` tensor is empty, ``torch.mean()`` returns ``nan``. + This behavior is consistent with NumPy and follows the definition + that the mean over an empty set is undefined. + + + Returns the mean value of all elements in the :attr:`input` tensor. Input must be floating point or complex. + + Args: + input (Tensor): + the input tensor, either of floating point or complex dtype + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.2294, -0.5481, 1.3288]]) + >>> torch.mean(a) + tensor(0.3367) + + .. function:: mean(input, dim, keepdim=False, *, dtype=None, out=None) -> Tensor + :noindex: + + Returns the mean value of each row of the :attr:`input` tensor in the given + dimension :attr:`dim`. If :attr:`dim` is a list of dimensions, + reduce over all of them. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + out (Tensor, optional): the output tensor. + + .. seealso:: + + :func:`torch.nanmean` computes the mean value of `non-NaN` elements. + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-0.3841, 0.6320, 0.4254, -0.7384], + [-0.9644, 1.0131, -0.6549, -1.4279], + [-0.2951, -1.3350, -0.7694, 0.5600], + [ 1.0842, -0.9580, 0.3623, 0.2343]]) + >>> torch.mean(a, 1) + tensor([-0.0163, -0.5085, -0.4599, 0.1807]) + >>> torch.mean(a, 1, True) + tensor([[-0.0163], + [-0.5085], + [-0.4599], + [ 0.1807]]) + """ + +@overload +def median(input: Tensor) -> Tensor: + r""" + median(input) -> Tensor + + Returns the median of the values in :attr:`input`. + + .. note:: + The median is not unique for :attr:`input` tensors with an even number + of elements. In this case the lower of the two medians is returned. To + compute the mean of both medians, use :func:`torch.quantile` with ``q=0.5`` instead. + + .. warning:: + This function produces deterministic (sub)gradients unlike ``median(dim=0)`` + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 1.5219, -1.5212, 0.2202]]) + >>> torch.median(a) + tensor(0.2202) + + .. function:: median(input, dim=-1, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` contains the median of each row of :attr:`input` + in the dimension :attr:`dim`, and ``indices`` contains the index of the median values found in the dimension :attr:`dim`. + + By default, :attr:`dim` is the last dimension of the :attr:`input` tensor. + + If :attr:`keepdim` is ``True``, the output tensors are of the same size + as :attr:`input` except in the dimension :attr:`dim` where they are of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in + the outputs tensor having 1 fewer dimension than :attr:`input`. + + .. note:: + The median is not unique for :attr:`input` tensors with an even number + of elements in the dimension :attr:`dim`. In this case the lower of the + two medians is returned. To compute the mean of both medians in + :attr:`input`, use :func:`torch.quantile` with ``q=0.5`` instead. + + .. warning:: + ``indices`` does not necessarily contain the first occurrence of each + median value found, unless it is unique. + The exact implementation details are device-specific. + Do not expect the same result when run on CPU and GPU in general. + For the same reason do not expect the gradients to be deterministic. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out ((Tensor, Tensor), optional): The first tensor will be populated with the median values and the second + tensor, which must have dtype long, with their indices in the dimension + :attr:`dim` of :attr:`input`. + + Example:: + + >>> a = torch.randn(4, 5) + >>> a + tensor([[ 0.2505, -0.3982, -0.9948, 0.3518, -1.3131], + [ 0.3180, -0.6993, 1.0436, 0.0438, 0.2270], + [-0.2751, 0.7303, 0.2192, 0.3321, 0.2488], + [ 1.0778, -1.9510, 0.7048, 0.4742, -0.7125]]) + >>> torch.median(a, 1) + torch.return_types.median(values=tensor([-0.3982, 0.2270, 0.2488, 0.4742]), indices=tensor([1, 4, 4, 3])) + """ + +@overload +def median( + input: Tensor, + dim: _int, + keepdim: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.median: + r""" + median(input) -> Tensor + + Returns the median of the values in :attr:`input`. + + .. note:: + The median is not unique for :attr:`input` tensors with an even number + of elements. In this case the lower of the two medians is returned. To + compute the mean of both medians, use :func:`torch.quantile` with ``q=0.5`` instead. + + .. warning:: + This function produces deterministic (sub)gradients unlike ``median(dim=0)`` + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 1.5219, -1.5212, 0.2202]]) + >>> torch.median(a) + tensor(0.2202) + + .. function:: median(input, dim=-1, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` contains the median of each row of :attr:`input` + in the dimension :attr:`dim`, and ``indices`` contains the index of the median values found in the dimension :attr:`dim`. + + By default, :attr:`dim` is the last dimension of the :attr:`input` tensor. + + If :attr:`keepdim` is ``True``, the output tensors are of the same size + as :attr:`input` except in the dimension :attr:`dim` where they are of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in + the outputs tensor having 1 fewer dimension than :attr:`input`. + + .. note:: + The median is not unique for :attr:`input` tensors with an even number + of elements in the dimension :attr:`dim`. In this case the lower of the + two medians is returned. To compute the mean of both medians in + :attr:`input`, use :func:`torch.quantile` with ``q=0.5`` instead. + + .. warning:: + ``indices`` does not necessarily contain the first occurrence of each + median value found, unless it is unique. + The exact implementation details are device-specific. + Do not expect the same result when run on CPU and GPU in general. + For the same reason do not expect the gradients to be deterministic. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out ((Tensor, Tensor), optional): The first tensor will be populated with the median values and the second + tensor, which must have dtype long, with their indices in the dimension + :attr:`dim` of :attr:`input`. + + Example:: + + >>> a = torch.randn(4, 5) + >>> a + tensor([[ 0.2505, -0.3982, -0.9948, 0.3518, -1.3131], + [ 0.3180, -0.6993, 1.0436, 0.0438, 0.2270], + [-0.2751, 0.7303, 0.2192, 0.3321, 0.2488], + [ 1.0778, -1.9510, 0.7048, 0.4742, -0.7125]]) + >>> torch.median(a, 1) + torch.return_types.median(values=tensor([-0.3982, 0.2270, 0.2488, 0.4742]), indices=tensor([1, 4, 4, 3])) + """ + +@overload +def median( + input: Tensor, + dim: str | EllipsisType | None, + keepdim: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.median: + r""" + median(input) -> Tensor + + Returns the median of the values in :attr:`input`. + + .. note:: + The median is not unique for :attr:`input` tensors with an even number + of elements. In this case the lower of the two medians is returned. To + compute the mean of both medians, use :func:`torch.quantile` with ``q=0.5`` instead. + + .. warning:: + This function produces deterministic (sub)gradients unlike ``median(dim=0)`` + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 1.5219, -1.5212, 0.2202]]) + >>> torch.median(a) + tensor(0.2202) + + .. function:: median(input, dim=-1, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` contains the median of each row of :attr:`input` + in the dimension :attr:`dim`, and ``indices`` contains the index of the median values found in the dimension :attr:`dim`. + + By default, :attr:`dim` is the last dimension of the :attr:`input` tensor. + + If :attr:`keepdim` is ``True``, the output tensors are of the same size + as :attr:`input` except in the dimension :attr:`dim` where they are of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in + the outputs tensor having 1 fewer dimension than :attr:`input`. + + .. note:: + The median is not unique for :attr:`input` tensors with an even number + of elements in the dimension :attr:`dim`. In this case the lower of the + two medians is returned. To compute the mean of both medians in + :attr:`input`, use :func:`torch.quantile` with ``q=0.5`` instead. + + .. warning:: + ``indices`` does not necessarily contain the first occurrence of each + median value found, unless it is unique. + The exact implementation details are device-specific. + Do not expect the same result when run on CPU and GPU in general. + For the same reason do not expect the gradients to be deterministic. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out ((Tensor, Tensor), optional): The first tensor will be populated with the median values and the second + tensor, which must have dtype long, with their indices in the dimension + :attr:`dim` of :attr:`input`. + + Example:: + + >>> a = torch.randn(4, 5) + >>> a + tensor([[ 0.2505, -0.3982, -0.9948, 0.3518, -1.3131], + [ 0.3180, -0.6993, 1.0436, 0.0438, 0.2270], + [-0.2751, 0.7303, 0.2192, 0.3321, 0.2488], + [ 1.0778, -1.9510, 0.7048, 0.4742, -0.7125]]) + >>> torch.median(a, 1) + torch.return_types.median(values=tensor([-0.3982, 0.2270, 0.2488, 0.4742]), indices=tensor([1, 4, 4, 3])) + """ + +@overload +def min(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + min(input, *, out=None) -> Tensor + + Returns the minimum value of all elements in the :attr:`input` tensor. + + .. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.6750, 1.0857, 1.7197]]) + >>> torch.min(a) + tensor(0.6750) + + .. function:: min(input, dim, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` is the minimum + value of each row of the :attr:`input` tensor in the given dimension + :attr:`dim`. And ``indices`` is the index location of each minimum value found + (argmin). + + If :attr:`keepdim` is ``True``, the output tensors are of the same size as + :attr:`input` except in the dimension :attr:`dim` where they are of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in + the output tensors having 1 fewer dimension than :attr:`input`. + + .. note:: If there are multiple minimal values in a reduced row then + the indices of the first minimal value are returned. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. If omitted, all dimensions are reduced. Explicit ``None`` is not supported. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (tuple, optional): the tuple of two output tensors (min, min_indices) + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-0.6248, 1.1334, -1.1899, -0.2803], + [-1.4644, -0.2635, -0.3651, 0.6134], + [ 0.2457, 0.0384, 1.0128, 0.7015], + [-0.1153, 2.9849, 2.1458, 0.5788]]) + >>> torch.min(a, 1) + torch.return_types.min(values=tensor([-1.1899, -1.4644, 0.0384, -0.1153]), indices=tensor([2, 0, 1, 0])) + + .. function:: min(input, other, *, out=None) -> Tensor + :noindex: + + See :func:`torch.minimum`. + """ + +@overload +def min( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + min(input, *, out=None) -> Tensor + + Returns the minimum value of all elements in the :attr:`input` tensor. + + .. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.6750, 1.0857, 1.7197]]) + >>> torch.min(a) + tensor(0.6750) + + .. function:: min(input, dim, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` is the minimum + value of each row of the :attr:`input` tensor in the given dimension + :attr:`dim`. And ``indices`` is the index location of each minimum value found + (argmin). + + If :attr:`keepdim` is ``True``, the output tensors are of the same size as + :attr:`input` except in the dimension :attr:`dim` where they are of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in + the output tensors having 1 fewer dimension than :attr:`input`. + + .. note:: If there are multiple minimal values in a reduced row then + the indices of the first minimal value are returned. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. If omitted, all dimensions are reduced. Explicit ``None`` is not supported. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (tuple, optional): the tuple of two output tensors (min, min_indices) + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-0.6248, 1.1334, -1.1899, -0.2803], + [-1.4644, -0.2635, -0.3651, 0.6134], + [ 0.2457, 0.0384, 1.0128, 0.7015], + [-0.1153, 2.9849, 2.1458, 0.5788]]) + >>> torch.min(a, 1) + torch.return_types.min(values=tensor([-1.1899, -1.4644, 0.0384, -0.1153]), indices=tensor([2, 0, 1, 0])) + + .. function:: min(input, other, *, out=None) -> Tensor + :noindex: + + See :func:`torch.minimum`. + """ + +@overload +def min( + input: Tensor, + dim: _int, + keepdim: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.min: + r""" + min(input, *, out=None) -> Tensor + + Returns the minimum value of all elements in the :attr:`input` tensor. + + .. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.6750, 1.0857, 1.7197]]) + >>> torch.min(a) + tensor(0.6750) + + .. function:: min(input, dim, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` is the minimum + value of each row of the :attr:`input` tensor in the given dimension + :attr:`dim`. And ``indices`` is the index location of each minimum value found + (argmin). + + If :attr:`keepdim` is ``True``, the output tensors are of the same size as + :attr:`input` except in the dimension :attr:`dim` where they are of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in + the output tensors having 1 fewer dimension than :attr:`input`. + + .. note:: If there are multiple minimal values in a reduced row then + the indices of the first minimal value are returned. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. If omitted, all dimensions are reduced. Explicit ``None`` is not supported. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (tuple, optional): the tuple of two output tensors (min, min_indices) + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-0.6248, 1.1334, -1.1899, -0.2803], + [-1.4644, -0.2635, -0.3651, 0.6134], + [ 0.2457, 0.0384, 1.0128, 0.7015], + [-0.1153, 2.9849, 2.1458, 0.5788]]) + >>> torch.min(a, 1) + torch.return_types.min(values=tensor([-1.1899, -1.4644, 0.0384, -0.1153]), indices=tensor([2, 0, 1, 0])) + + .. function:: min(input, other, *, out=None) -> Tensor + :noindex: + + See :func:`torch.minimum`. + """ + +@overload +def min( + input: Tensor, + dim: str | EllipsisType | None, + keepdim: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.min: + r""" + min(input, *, out=None) -> Tensor + + Returns the minimum value of all elements in the :attr:`input` tensor. + + .. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.6750, 1.0857, 1.7197]]) + >>> torch.min(a) + tensor(0.6750) + + .. function:: min(input, dim, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` is the minimum + value of each row of the :attr:`input` tensor in the given dimension + :attr:`dim`. And ``indices`` is the index location of each minimum value found + (argmin). + + If :attr:`keepdim` is ``True``, the output tensors are of the same size as + :attr:`input` except in the dimension :attr:`dim` where they are of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in + the output tensors having 1 fewer dimension than :attr:`input`. + + .. note:: If there are multiple minimal values in a reduced row then + the indices of the first minimal value are returned. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. If omitted, all dimensions are reduced. Explicit ``None`` is not supported. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (tuple, optional): the tuple of two output tensors (min, min_indices) + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-0.6248, 1.1334, -1.1899, -0.2803], + [-1.4644, -0.2635, -0.3651, 0.6134], + [ 0.2457, 0.0384, 1.0128, 0.7015], + [-0.1153, 2.9849, 2.1458, 0.5788]]) + >>> torch.min(a, 1) + torch.return_types.min(values=tensor([-1.1899, -1.4644, 0.0384, -0.1153]), indices=tensor([2, 0, 1, 0])) + + .. function:: min(input, other, *, out=None) -> Tensor + :noindex: + + See :func:`torch.minimum`. + """ + +def minimum( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + minimum(input, other, *, out=None) -> Tensor + + Computes the element-wise minimum of :attr:`input` and :attr:`other`. + + .. note:: + If one of the elements being compared is a NaN, then that element is returned. + :func:`minimum` is not supported for tensors with complex dtypes. + + Args: + input (Tensor): the input tensor. + other (Tensor): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor((1, 2, -1)) + >>> b = torch.tensor((3, 0, 4)) + >>> torch.minimum(a, b) + tensor([1, 0, -1]) + """ + +def miopen_batch_norm( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + running_mean: Tensor | None, + running_var: Tensor | None, + training: _bool, + exponential_average_factor: _float, + epsilon: _float, +) -> tuple[Tensor, Tensor, Tensor]: ... +def miopen_convolution( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + padding: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, + benchmark: _bool, + deterministic: _bool, +) -> Tensor: ... +def miopen_convolution_add_relu( + input: Tensor, + weight: Tensor, + z: Tensor, + alpha: Number | _complex | None, + bias: Tensor | None, + stride: Sequence[_int | SymInt], + padding: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, +) -> Tensor: ... +def miopen_convolution_relu( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + stride: Sequence[_int | SymInt], + padding: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, +) -> Tensor: ... +def miopen_convolution_transpose( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + padding: Sequence[_int | SymInt], + output_padding: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, + benchmark: _bool, + deterministic: _bool, +) -> Tensor: ... +def miopen_depthwise_convolution( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + padding: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, + benchmark: _bool, + deterministic: _bool, +) -> Tensor: ... +def miopen_rnn( + input: Tensor, + weight: tuple[Tensor, ...] | list[Tensor] | None, + weight_stride0: _int, + hx: Tensor, + cx: Tensor | None, + mode: _int, + hidden_size: _int, + num_layers: _int, + batch_first: _bool, + dropout: _float, + train: _bool, + bidirectional: _bool, + batch_sizes: _size, + dropout_state: Tensor | None, +) -> tuple[Tensor, Tensor, Tensor, Tensor, Tensor]: ... +def mkldnn_adaptive_avg_pool2d( + input: Tensor, + output_size: _int | _size, + *, + out: Tensor | None = None, +) -> Tensor: ... +def mkldnn_convolution( + input: Tensor, + weight: Tensor, + bias: Tensor | None, + padding: Sequence[_int | SymInt], + stride: Sequence[_int | SymInt], + dilation: Sequence[_int | SymInt], + groups: _int | SymInt, +) -> Tensor: ... +def mkldnn_linear_backward_weights( + grad_output: Tensor, + input: Tensor, + weight: Tensor, + bias_defined: _bool, +) -> tuple[Tensor, Tensor]: ... +def mkldnn_max_pool2d( + input: Tensor, + kernel_size: _int | _size, + stride: _int | _size = (), + padding: _int | _size = 0, + dilation: _int | _size = 1, + ceil_mode: _bool = False, +) -> Tensor: ... +def mkldnn_max_pool3d( + input: Tensor, + kernel_size: _int | _size, + stride: _int | _size = (), + padding: _int | _size = 0, + dilation: _int | _size = 1, + ceil_mode: _bool = False, +) -> Tensor: ... +def mkldnn_rnn_layer( + input: Tensor, + weight0: Tensor, + weight1: Tensor, + weight2: Tensor, + weight3: Tensor, + hx_: Tensor, + cx_: Tensor, + reverse: _bool, + batch_sizes: _size, + mode: _int, + hidden_size: _int, + num_layers: _int, + has_biases: _bool, + bidirectional: _bool, + batch_first: _bool, + train: _bool, +) -> tuple[Tensor, Tensor, Tensor, Tensor]: ... +@overload +def mm(input: Tensor, mat2: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + mm(input, mat2, out_dtype=None, *, out=None) -> Tensor + + Performs a matrix multiplication of the matrices :attr:`input` and :attr:`mat2`. + + If :attr:`input` is a :math:`(n \times m)` tensor, :attr:`mat2` is a + :math:`(m \times p)` tensor, :attr:`out` will be a :math:`(n \times p)` tensor. + + .. note:: This function does not :ref:`broadcast `. + For broadcasting matrix products, see :func:`torch.matmul`. + + Supports strided and sparse 2-D tensors as inputs, autograd with + respect to strided inputs. + + This operation has support for arguments with :ref:`sparse layouts`. + If :attr:`out` is provided its layout will be used. Otherwise, the result + layout will be deduced from that of :attr:`input`. + + + .. warning:: + Sparse support is a beta feature and some layout(s)/dtype/device combinations may not be supported, + or may not have autograd support. If you notice missing functionality please + open a feature request. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): the first matrix to be matrix multiplied + mat2 (Tensor): the second matrix to be matrix multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> mat1 = torch.randn(2, 3) + >>> mat2 = torch.randn(3, 3) + >>> torch.mm(mat1, mat2) + tensor([[ 0.4851, 0.5037, -0.3633], + [-0.0760, -3.6705, 2.4784]]) + """ + +@overload +def mm( + input: Tensor, + mat2: Tensor, + out_dtype: _dtype, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + mm(input, mat2, out_dtype=None, *, out=None) -> Tensor + + Performs a matrix multiplication of the matrices :attr:`input` and :attr:`mat2`. + + If :attr:`input` is a :math:`(n \times m)` tensor, :attr:`mat2` is a + :math:`(m \times p)` tensor, :attr:`out` will be a :math:`(n \times p)` tensor. + + .. note:: This function does not :ref:`broadcast `. + For broadcasting matrix products, see :func:`torch.matmul`. + + Supports strided and sparse 2-D tensors as inputs, autograd with + respect to strided inputs. + + This operation has support for arguments with :ref:`sparse layouts`. + If :attr:`out` is provided its layout will be used. Otherwise, the result + layout will be deduced from that of :attr:`input`. + + + .. warning:: + Sparse support is a beta feature and some layout(s)/dtype/device combinations may not be supported, + or may not have autograd support. If you notice missing functionality please + open a feature request. + + This operator supports :ref:`TensorFloat32`. + + On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision` for backward. + + Args: + input (Tensor): the first matrix to be matrix multiplied + mat2 (Tensor): the second matrix to be matrix multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> mat1 = torch.randn(2, 3) + >>> mat2 = torch.randn(3, 3) + >>> torch.mm(mat1, mat2) + tensor([[ 0.4851, 0.5037, -0.3633], + [-0.0760, -3.6705, 2.4784]]) + """ + +@overload +def mode( + input: Tensor, + dim: _int = -1, + keepdim: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.mode: + r""" + mode(input, dim=-1, keepdim=False, *, out=None) -> (Tensor, LongTensor) + + Returns a namedtuple ``(values, indices)`` where ``values`` is the mode + value of each row of the :attr:`input` tensor in the given dimension + :attr:`dim`, i.e. a value which appears most often + in that row, and ``indices`` is the index location of each mode value found. + + By default, :attr:`dim` is the last dimension of the :attr:`input` tensor. + + If :attr:`keepdim` is ``True``, the output tensors are of the same size as + :attr:`input` except in the dimension :attr:`dim` where they are of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting + in the output tensors having 1 fewer dimension than :attr:`input`. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (tuple, optional): the result tuple of two output tensors (values, indices) + + Example:: + + >>> b = torch.tensor([[0, 0, 0, 2, 0, 0, 2], + ... [0, 3, 0, 0, 2, 0, 1], + ... [2, 2, 2, 0, 0, 0, 3], + ... [2, 2, 3, 0, 1, 1, 0], + ... [1, 1, 0, 0, 2, 0, 2]]) + >>> torch.mode(b, 0) + torch.return_types.mode( + values=tensor([0, 2, 0, 0, 0, 0, 2]), + indices=tensor([1, 3, 4, 4, 2, 4, 4])) + """ + +@overload +def mode( + input: Tensor, + dim: str | EllipsisType | None, + keepdim: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.mode: + r""" + mode(input, dim=-1, keepdim=False, *, out=None) -> (Tensor, LongTensor) + + Returns a namedtuple ``(values, indices)`` where ``values`` is the mode + value of each row of the :attr:`input` tensor in the given dimension + :attr:`dim`, i.e. a value which appears most often + in that row, and ``indices`` is the index location of each mode value found. + + By default, :attr:`dim` is the last dimension of the :attr:`input` tensor. + + If :attr:`keepdim` is ``True``, the output tensors are of the same size as + :attr:`input` except in the dimension :attr:`dim` where they are of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting + in the output tensors having 1 fewer dimension than :attr:`input`. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out (tuple, optional): the result tuple of two output tensors (values, indices) + + Example:: + + >>> b = torch.tensor([[0, 0, 0, 2, 0, 0, 2], + ... [0, 3, 0, 0, 2, 0, 1], + ... [2, 2, 2, 0, 0, 0, 3], + ... [2, 2, 3, 0, 1, 1, 0], + ... [1, 1, 0, 0, 2, 0, 2]]) + >>> torch.mode(b, 0) + torch.return_types.mode( + values=tensor([0, 2, 0, 0, 0, 0, 2]), + indices=tensor([1, 3, 4, 4, 2, 4, 4])) + """ + +@overload +def moveaxis(input: Tensor, source: _int, destination: _int) -> Tensor: + r""" + moveaxis(input, source, destination) -> Tensor + + Alias for :func:`torch.movedim`. + + This function is equivalent to NumPy's moveaxis function. + + Examples:: + + >>> t = torch.randn(3,2,1) + >>> t + tensor([[[-0.3362], + [-0.8437]], + + [[-0.9627], + [ 0.1727]], + + [[ 0.5173], + [-0.1398]]]) + >>> torch.moveaxis(t, 1, 0).shape + torch.Size([2, 3, 1]) + >>> torch.moveaxis(t, 1, 0) + tensor([[[-0.3362], + [-0.9627], + [ 0.5173]], + + [[-0.8437], + [ 0.1727], + [-0.1398]]]) + >>> torch.moveaxis(t, (1, 2), (0, 1)).shape + torch.Size([2, 1, 3]) + >>> torch.moveaxis(t, (1, 2), (0, 1)) + tensor([[[-0.3362, -0.9627, 0.5173]], + + [[-0.8437, 0.1727, -0.1398]]]) + """ + +@overload +def moveaxis(input: Tensor, source: _size, destination: _size) -> Tensor: + r""" + moveaxis(input, source, destination) -> Tensor + + Alias for :func:`torch.movedim`. + + This function is equivalent to NumPy's moveaxis function. + + Examples:: + + >>> t = torch.randn(3,2,1) + >>> t + tensor([[[-0.3362], + [-0.8437]], + + [[-0.9627], + [ 0.1727]], + + [[ 0.5173], + [-0.1398]]]) + >>> torch.moveaxis(t, 1, 0).shape + torch.Size([2, 3, 1]) + >>> torch.moveaxis(t, 1, 0) + tensor([[[-0.3362], + [-0.9627], + [ 0.5173]], + + [[-0.8437], + [ 0.1727], + [-0.1398]]]) + >>> torch.moveaxis(t, (1, 2), (0, 1)).shape + torch.Size([2, 1, 3]) + >>> torch.moveaxis(t, (1, 2), (0, 1)) + tensor([[[-0.3362, -0.9627, 0.5173]], + + [[-0.8437, 0.1727, -0.1398]]]) + """ + +@overload +def movedim(input: Tensor, source: _int, destination: _int) -> Tensor: + r""" + movedim(input, source, destination) -> Tensor + + Moves the dimension(s) of :attr:`input` at the position(s) in :attr:`source` + to the position(s) in :attr:`destination`. + + Other dimensions of :attr:`input` that are not explicitly moved remain in + their original order and appear at the positions not specified in :attr:`destination`. + + Args: + input (Tensor): the input tensor. + source (int or tuple of ints): Original positions of the dims to move. These must be unique. + destination (int or tuple of ints): Destination positions for each of the original dims. These must also be unique. + + Examples:: + + >>> t = torch.randn(3,2,1) + >>> t + tensor([[[-0.3362], + [-0.8437]], + + [[-0.9627], + [ 0.1727]], + + [[ 0.5173], + [-0.1398]]]) + >>> torch.movedim(t, 1, 0).shape + torch.Size([2, 3, 1]) + >>> torch.movedim(t, 1, 0) + tensor([[[-0.3362], + [-0.9627], + [ 0.5173]], + + [[-0.8437], + [ 0.1727], + [-0.1398]]]) + >>> torch.movedim(t, (1, 2), (0, 1)).shape + torch.Size([2, 1, 3]) + >>> torch.movedim(t, (1, 2), (0, 1)) + tensor([[[-0.3362, -0.9627, 0.5173]], + + [[-0.8437, 0.1727, -0.1398]]]) + """ + +@overload +def movedim(input: Tensor, source: _size, destination: _size) -> Tensor: + r""" + movedim(input, source, destination) -> Tensor + + Moves the dimension(s) of :attr:`input` at the position(s) in :attr:`source` + to the position(s) in :attr:`destination`. + + Other dimensions of :attr:`input` that are not explicitly moved remain in + their original order and appear at the positions not specified in :attr:`destination`. + + Args: + input (Tensor): the input tensor. + source (int or tuple of ints): Original positions of the dims to move. These must be unique. + destination (int or tuple of ints): Destination positions for each of the original dims. These must also be unique. + + Examples:: + + >>> t = torch.randn(3,2,1) + >>> t + tensor([[[-0.3362], + [-0.8437]], + + [[-0.9627], + [ 0.1727]], + + [[ 0.5173], + [-0.1398]]]) + >>> torch.movedim(t, 1, 0).shape + torch.Size([2, 3, 1]) + >>> torch.movedim(t, 1, 0) + tensor([[[-0.3362], + [-0.9627], + [ 0.5173]], + + [[-0.8437], + [ 0.1727], + [-0.1398]]]) + >>> torch.movedim(t, (1, 2), (0, 1)).shape + torch.Size([2, 1, 3]) + >>> torch.movedim(t, (1, 2), (0, 1)) + tensor([[[-0.3362, -0.9627, 0.5173]], + + [[-0.8437, 0.1727, -0.1398]]]) + """ + +def msort(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + msort(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Sorts the elements of the :attr:`input` tensor along its first dimension + in ascending order by value. + + .. note:: `torch.msort(t)` is equivalent to `torch.sort(t, dim=0)[0]`. + See also :func:`torch.sort`. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> t = torch.randn(3, 4) + >>> t + tensor([[-0.1321, 0.4370, -1.2631, -1.1289], + [-2.0527, -1.1250, 0.2275, 0.3077], + [-0.0881, -0.1259, -0.5495, 1.0284]]) + >>> torch.msort(t) + tensor([[-2.0527, -1.1250, -1.2631, -1.1289], + [-0.1321, -0.1259, -0.5495, 0.3077], + [-0.0881, 0.4370, 0.2275, 1.0284]]) + """ + +def mul( + input: Tensor | Number | _complex, + other: Tensor | Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + mul(input, other, *, out=None) -> Tensor + + Multiplies :attr:`input` by :attr:`other`. + + + .. math:: + \text{out}_i = \text{input}_i \times \text{other}_i + + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer, float, and complex inputs. + + Args: + input (Tensor): the input tensor. + other (Tensor or Number): the tensor or number to multiply input by. + + Keyword args: + out (Tensor, optional): the output tensor. + + Examples:: + + >>> a = torch.randn(3) + >>> a + tensor([ 0.2015, -0.4255, 2.6087]) + >>> torch.mul(a, 100) + tensor([ 20.1494, -42.5491, 260.8663]) + + >>> b = torch.randn(4, 1) + >>> b + tensor([[ 1.1207], + [-0.3137], + [ 0.0700], + [ 0.8378]]) + >>> c = torch.randn(1, 4) + >>> c + tensor([[ 0.5146, 0.1216, -0.5244, 2.2382]]) + >>> torch.mul(b, c) + tensor([[ 0.5767, 0.1363, -0.5877, 2.5083], + [-0.1614, -0.0382, 0.1645, -0.7021], + [ 0.0360, 0.0085, -0.0367, 0.1567], + [ 0.4312, 0.1019, -0.4394, 1.8753]]) + """ + +def multinomial( + input: Tensor, + num_samples: _int | SymInt, + replacement: _bool = False, + *, + generator: Generator | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + multinomial(input, num_samples, replacement=False, *, generator=None, out=None) -> LongTensor + + Returns a tensor where each row contains :attr:`num_samples` indices sampled + from the multinomial (a stricter definition would be multivariate, + refer to :class:`torch.distributions.multinomial.Multinomial` for more details) + probability distribution located in the corresponding row + of tensor :attr:`input`. + + .. note:: + The rows of :attr:`input` do not need to sum to one (in which case we use + the values as weights), but must be non-negative, finite and have + a non-zero sum. + + Indices are ordered from left to right according to when each was sampled + (first samples are placed in first column). + + If :attr:`input` is a vector, :attr:`out` is a vector of size :attr:`num_samples`. + + If :attr:`input` is a matrix with `m` rows, :attr:`out` is an matrix of shape + :math:`(m \times \text{num\_samples})`. + + If replacement is ``True``, samples are drawn with replacement. + + If not, they are drawn without replacement, which means that when a + sample index is drawn for a row, it cannot be drawn again for that row. + + .. note:: + When drawn without replacement, :attr:`num_samples` must be lower than + number of non-zero elements in :attr:`input` (or the min number of non-zero + elements in each row of :attr:`input` if it is a matrix). + + Args: + input (Tensor): the input tensor containing probabilities + num_samples (int): number of samples to draw + replacement (bool, optional): whether to draw with replacement or not + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + + Example:: + + >>> weights = torch.tensor([0, 10, 3, 0], dtype=torch.float) # create a tensor of weights + >>> torch.multinomial(weights, 2) + tensor([1, 2]) + >>> torch.multinomial(weights, 5) # ERROR! + RuntimeError: cannot sample n_sample > prob_dist.size(-1) samples without replacement + >>> torch.multinomial(weights, 4, replacement=True) + tensor([ 2, 1, 1, 1]) + """ + +@overload +def multiply( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + multiply(input, other, *, out=None) + + Alias for :func:`torch.mul`. + """ + +@overload +def multiply(input: Tensor, other: Number | _complex) -> Tensor: + r""" + multiply(input, other, *, out=None) + + Alias for :func:`torch.mul`. + """ + +def mv(input: Tensor, vec: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + mv(input, vec, *, out=None) -> Tensor + + Performs a matrix-vector product of the matrix :attr:`input` and the vector + :attr:`vec`. + + If :attr:`input` is a :math:`(n \times m)` tensor, :attr:`vec` is a 1-D tensor of + size :math:`m`, :attr:`out` will be 1-D of size :math:`n`. + + .. note:: This function does not :ref:`broadcast `. + + Args: + input (Tensor): matrix to be multiplied + vec (Tensor): vector to be multiplied + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> mat = torch.randn(2, 3) + >>> vec = torch.randn(3) + >>> torch.mv(mat, vec) + tensor([ 1.0404, -0.6361]) + """ + +def mvlgamma( + input: Tensor, + p: _int, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + mvlgamma(input, p, *, out=None) -> Tensor + + Alias for :func:`torch.special.multigammaln`. + """ + +def nan_to_num( + input: Tensor, + nan: _float | None = None, + posinf: _float | None = None, + neginf: _float | None = None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + nan_to_num(input, nan=0.0, posinf=None, neginf=None, *, out=None) -> Tensor + + Replaces :literal:`NaN`, positive infinity, and negative infinity values in :attr:`input` + with the values specified by :attr:`nan`, :attr:`posinf`, and :attr:`neginf`, respectively. + By default, :literal:`NaN`\ s are replaced with zero, positive infinity is replaced with the + greatest finite value representable by :attr:`input`'s dtype, and negative infinity + is replaced with the least finite value representable by :attr:`input`'s dtype. + + Args: + input (Tensor): the input tensor. + nan (Number, optional): the value to replace :literal:`NaN`\s with. Default is zero. + posinf (Number, optional): if a Number, the value to replace positive infinity values with. + If None, positive infinity values are replaced with the greatest finite value representable by :attr:`input`'s dtype. + Default is None. + neginf (Number, optional): if a Number, the value to replace negative infinity values with. + If None, negative infinity values are replaced with the lowest finite value representable by :attr:`input`'s dtype. + Default is None. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> x = torch.tensor([float('nan'), float('inf'), -float('inf'), 3.14]) + >>> torch.nan_to_num(x) + tensor([ 0.0000e+00, 3.4028e+38, -3.4028e+38, 3.1400e+00]) + >>> torch.nan_to_num(x, nan=2.0) + tensor([ 2.0000e+00, 3.4028e+38, -3.4028e+38, 3.1400e+00]) + >>> torch.nan_to_num(x, nan=2.0, posinf=1.0) + tensor([ 2.0000e+00, 1.0000e+00, -3.4028e+38, 3.1400e+00]) + """ + +def nan_to_num_( + input: Tensor, + nan: _float | None = None, + posinf: _float | None = None, + neginf: _float | None = None, +) -> Tensor: ... +def nanmean( + input: Tensor, + dim: _int | _size | None = None, + keepdim: _bool = False, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + nanmean(input, dim=None, keepdim=False, *, dtype=None, out=None) -> Tensor + + Computes the mean of all `non-NaN` elements along the specified dimensions. + Input must be floating point or complex. + + This function is identical to :func:`torch.mean` when there are no `NaN` values + in the :attr:`input` tensor. In the presence of `NaN`, :func:`torch.mean` will + propagate the `NaN` to the output whereas :func:`torch.nanmean` will ignore the + `NaN` values (`torch.nanmean(a)` is equivalent to `torch.mean(a[~a.isnan()])`). + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor, either of floating point or complex dtype + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + out (Tensor, optional): the output tensor. + + .. seealso:: + + :func:`torch.mean` computes the mean value, propagating `NaN`. + + Example:: + + >>> x = torch.tensor([[torch.nan, 1, 2], [1, 2, 3]]) + >>> x.mean() + tensor(nan) + >>> x.nanmean() + tensor(1.8000) + >>> x.mean(dim=0) + tensor([ nan, 1.5000, 2.5000]) + >>> x.nanmean(dim=0) + tensor([1.0000, 1.5000, 2.5000]) + + # If all elements in the reduced dimensions are NaN then the result is NaN + >>> torch.tensor([torch.nan]).nanmean() + tensor(nan) + """ + +@overload +def nanmedian(input: Tensor) -> Tensor: + r""" + nanmedian(input) -> Tensor + + Returns the median of the values in :attr:`input`, ignoring ``NaN`` values. + + This function is identical to :func:`torch.median` when there are no ``NaN`` values in :attr:`input`. + When :attr:`input` has one or more ``NaN`` values, :func:`torch.median` will always return ``NaN``, + while this function will return the median of the non-``NaN`` elements in :attr:`input`. + If all the elements in :attr:`input` are ``NaN`` it will also return ``NaN``. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> a = torch.tensor([1, float('nan'), 3, 2]) + >>> a.median() + tensor(nan) + >>> a.nanmedian() + tensor(2.) + + .. function:: nanmedian(input, dim=-1, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` contains the median of each row of :attr:`input` + in the dimension :attr:`dim`, ignoring ``NaN`` values, and ``indices`` contains the index of the median values + found in the dimension :attr:`dim`. + + This function is identical to :func:`torch.median` when there are no ``NaN`` values in a reduced row. When a reduced row has + one or more ``NaN`` values, :func:`torch.median` will always reduce it to ``NaN``, while this function will reduce it to the + median of the non-``NaN`` elements. If all the elements in a reduced row are ``NaN`` then it will be reduced to ``NaN``, too. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out ((Tensor, Tensor), optional): The first tensor will be populated with the median values and the second + tensor, which must have dtype long, with their indices in the dimension + :attr:`dim` of :attr:`input`. + + Example:: + + >>> a = torch.tensor([[2, 3, 1], [float('nan'), 1, float('nan')]]) + >>> a + tensor([[2., 3., 1.], + [nan, 1., nan]]) + >>> a.median(0) + torch.return_types.median(values=tensor([nan, 1., nan]), indices=tensor([1, 1, 1])) + >>> a.nanmedian(0) + torch.return_types.nanmedian(values=tensor([2., 1., 1.]), indices=tensor([0, 1, 0])) + """ + +@overload +def nanmedian( + input: Tensor, + dim: _int, + keepdim: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.nanmedian: + r""" + nanmedian(input) -> Tensor + + Returns the median of the values in :attr:`input`, ignoring ``NaN`` values. + + This function is identical to :func:`torch.median` when there are no ``NaN`` values in :attr:`input`. + When :attr:`input` has one or more ``NaN`` values, :func:`torch.median` will always return ``NaN``, + while this function will return the median of the non-``NaN`` elements in :attr:`input`. + If all the elements in :attr:`input` are ``NaN`` it will also return ``NaN``. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> a = torch.tensor([1, float('nan'), 3, 2]) + >>> a.median() + tensor(nan) + >>> a.nanmedian() + tensor(2.) + + .. function:: nanmedian(input, dim=-1, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` contains the median of each row of :attr:`input` + in the dimension :attr:`dim`, ignoring ``NaN`` values, and ``indices`` contains the index of the median values + found in the dimension :attr:`dim`. + + This function is identical to :func:`torch.median` when there are no ``NaN`` values in a reduced row. When a reduced row has + one or more ``NaN`` values, :func:`torch.median` will always reduce it to ``NaN``, while this function will reduce it to the + median of the non-``NaN`` elements. If all the elements in a reduced row are ``NaN`` then it will be reduced to ``NaN``, too. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out ((Tensor, Tensor), optional): The first tensor will be populated with the median values and the second + tensor, which must have dtype long, with their indices in the dimension + :attr:`dim` of :attr:`input`. + + Example:: + + >>> a = torch.tensor([[2, 3, 1], [float('nan'), 1, float('nan')]]) + >>> a + tensor([[2., 3., 1.], + [nan, 1., nan]]) + >>> a.median(0) + torch.return_types.median(values=tensor([nan, 1., nan]), indices=tensor([1, 1, 1])) + >>> a.nanmedian(0) + torch.return_types.nanmedian(values=tensor([2., 1., 1.]), indices=tensor([0, 1, 0])) + """ + +@overload +def nanmedian( + input: Tensor, + dim: str | EllipsisType | None, + keepdim: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.nanmedian: + r""" + nanmedian(input) -> Tensor + + Returns the median of the values in :attr:`input`, ignoring ``NaN`` values. + + This function is identical to :func:`torch.median` when there are no ``NaN`` values in :attr:`input`. + When :attr:`input` has one or more ``NaN`` values, :func:`torch.median` will always return ``NaN``, + while this function will return the median of the non-``NaN`` elements in :attr:`input`. + If all the elements in :attr:`input` are ``NaN`` it will also return ``NaN``. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> a = torch.tensor([1, float('nan'), 3, 2]) + >>> a.median() + tensor(nan) + >>> a.nanmedian() + tensor(2.) + + .. function:: nanmedian(input, dim=-1, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + + Returns a namedtuple ``(values, indices)`` where ``values`` contains the median of each row of :attr:`input` + in the dimension :attr:`dim`, ignoring ``NaN`` values, and ``indices`` contains the index of the median values + found in the dimension :attr:`dim`. + + This function is identical to :func:`torch.median` when there are no ``NaN`` values in a reduced row. When a reduced row has + one or more ``NaN`` values, :func:`torch.median` will always reduce it to ``NaN``, while this function will reduce it to the + median of the non-``NaN`` elements. If all the elements in a reduced row are ``NaN`` then it will be reduced to ``NaN``, too. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + out ((Tensor, Tensor), optional): The first tensor will be populated with the median values and the second + tensor, which must have dtype long, with their indices in the dimension + :attr:`dim` of :attr:`input`. + + Example:: + + >>> a = torch.tensor([[2, 3, 1], [float('nan'), 1, float('nan')]]) + >>> a + tensor([[2., 3., 1.], + [nan, 1., nan]]) + >>> a.median(0) + torch.return_types.median(values=tensor([nan, 1., nan]), indices=tensor([1, 1, 1])) + >>> a.nanmedian(0) + torch.return_types.nanmedian(values=tensor([2., 1., 1.]), indices=tensor([0, 1, 0])) + """ + +@overload +def nanquantile( + input: Tensor, + q: Tensor, + dim: _int | None = None, + keepdim: _bool = False, + *, + interpolation: str = "linear", + out: Tensor | None = None, +) -> Tensor: + r""" + nanquantile(input, q, dim=None, keepdim=False, *, interpolation='linear', out=None) -> Tensor + + This is a variant of :func:`torch.quantile` that "ignores" ``NaN`` values, + computing the quantiles :attr:`q` as if ``NaN`` values in :attr:`input` did + not exist. If all values in a reduced row are ``NaN`` then the quantiles for + that reduction will be ``NaN``. See the documentation for :func:`torch.quantile`. + + Args: + input (Tensor): the input tensor. + q (float or Tensor): a scalar or 1D tensor of quantile values in the range [0, 1] + + dim (int, optional): the dimension to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword arguments: + interpolation (str): interpolation method to use when the desired quantile lies between two data points. + Can be ``linear``, ``lower``, ``higher``, ``midpoint`` and ``nearest``. + Default is ``linear``. + out (Tensor, optional): the output tensor. + + Example:: + + >>> t = torch.tensor([float('nan'), 1, 2]) + >>> t.quantile(0.5) + tensor(nan) + >>> t.nanquantile(0.5) + tensor(1.5000) + >>> t = torch.tensor([[float('nan'), float('nan')], [1, 2]]) + >>> t + tensor([[nan, nan], + [1., 2.]]) + >>> t.nanquantile(0.5, dim=0) + tensor([1., 2.]) + >>> t.nanquantile(0.5, dim=1) + tensor([ nan, 1.5000]) + """ + +@overload +def nanquantile( + input: Tensor, + q: _float, + dim: _int | None = None, + keepdim: _bool = False, + *, + interpolation: str = "linear", + out: Tensor | None = None, +) -> Tensor: + r""" + nanquantile(input, q, dim=None, keepdim=False, *, interpolation='linear', out=None) -> Tensor + + This is a variant of :func:`torch.quantile` that "ignores" ``NaN`` values, + computing the quantiles :attr:`q` as if ``NaN`` values in :attr:`input` did + not exist. If all values in a reduced row are ``NaN`` then the quantiles for + that reduction will be ``NaN``. See the documentation for :func:`torch.quantile`. + + Args: + input (Tensor): the input tensor. + q (float or Tensor): a scalar or 1D tensor of quantile values in the range [0, 1] + + dim (int, optional): the dimension to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword arguments: + interpolation (str): interpolation method to use when the desired quantile lies between two data points. + Can be ``linear``, ``lower``, ``higher``, ``midpoint`` and ``nearest``. + Default is ``linear``. + out (Tensor, optional): the output tensor. + + Example:: + + >>> t = torch.tensor([float('nan'), 1, 2]) + >>> t.quantile(0.5) + tensor(nan) + >>> t.nanquantile(0.5) + tensor(1.5000) + >>> t = torch.tensor([[float('nan'), float('nan')], [1, 2]]) + >>> t + tensor([[nan, nan], + [1., 2.]]) + >>> t.nanquantile(0.5, dim=0) + tensor([1., 2.]) + >>> t.nanquantile(0.5, dim=1) + tensor([ nan, 1.5000]) + """ + +def nansum( + input: Tensor, + dim: _int | _size | None = None, + keepdim: _bool = False, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + nansum(input, *, dtype=None) -> Tensor + + Returns the sum of all elements, treating Not a Numbers (NaNs) as zero. + + Args: + input (Tensor): the input tensor. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.tensor([1., 2., float('nan'), 4.]) + >>> torch.nansum(a) + tensor(7.) + + .. function:: nansum(input, dim, keepdim=False, *, dtype=None) -> Tensor + :noindex: + + Returns the sum of each row of the :attr:`input` tensor in the given + dimension :attr:`dim`, treating Not a Numbers (NaNs) as zero. + If :attr:`dim` is a list of dimensions, reduce over all of them. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> torch.nansum(torch.tensor([1., float("nan")])) + tensor(1.) + >>> a = torch.tensor([[1, 2], [3., float("nan")]]) + >>> torch.nansum(a) + tensor(6.) + >>> torch.nansum(a, dim=0) + tensor([4., 2.]) + >>> torch.nansum(a, dim=1) + tensor([3., 3.]) + """ + +@overload +def narrow( + input: Tensor, + dim: _int, + start: Tensor, + length: _int | SymInt, +) -> Tensor: + r""" + narrow(input, dim, start, length) -> Tensor + + Returns a new tensor that is a narrowed version of :attr:`input` tensor. The + dimension :attr:`dim` is input from :attr:`start` to ``start + length``. The + returned tensor and :attr:`input` tensor share the same underlying storage. + + Args: + input (Tensor): the tensor to narrow + dim (int): the dimension along which to narrow + start (int or Tensor): index of the element to start the narrowed dimension + from. Can be negative, which means indexing from the end of `dim`. If + `Tensor`, it must be an 0-dim integral `Tensor` (bools not allowed) + length (int): length of the narrowed dimension, must be weakly positive + + Example:: + + >>> x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) + >>> torch.narrow(x, 0, 0, 2) + tensor([[ 1, 2, 3], + [ 4, 5, 6]]) + >>> torch.narrow(x, 1, 1, 2) + tensor([[ 2, 3], + [ 5, 6], + [ 8, 9]]) + >>> torch.narrow(x, -1, torch.tensor(-1), 1) + tensor([[3], + [6], + [9]]) + """ + +@overload +def narrow( + input: Tensor, + dim: _int, + start: _int | SymInt, + length: _int | SymInt, +) -> Tensor: + r""" + narrow(input, dim, start, length) -> Tensor + + Returns a new tensor that is a narrowed version of :attr:`input` tensor. The + dimension :attr:`dim` is input from :attr:`start` to ``start + length``. The + returned tensor and :attr:`input` tensor share the same underlying storage. + + Args: + input (Tensor): the tensor to narrow + dim (int): the dimension along which to narrow + start (int or Tensor): index of the element to start the narrowed dimension + from. Can be negative, which means indexing from the end of `dim`. If + `Tensor`, it must be an 0-dim integral `Tensor` (bools not allowed) + length (int): length of the narrowed dimension, must be weakly positive + + Example:: + + >>> x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) + >>> torch.narrow(x, 0, 0, 2) + tensor([[ 1, 2, 3], + [ 4, 5, 6]]) + >>> torch.narrow(x, 1, 1, 2) + tensor([[ 2, 3], + [ 5, 6], + [ 8, 9]]) + >>> torch.narrow(x, -1, torch.tensor(-1), 1) + tensor([[3], + [6], + [9]]) + """ + +def narrow_copy( + input: Tensor, + dim: _int, + start: _int | SymInt, + length: _int | SymInt, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + narrow_copy(input, dim, start, length, *, out=None) -> Tensor + + Same as :meth:`Tensor.narrow` except this returns a copy rather + than shared storage. This is primarily for sparse tensors, which + do not have a shared-storage narrow method. + + Args: + input (Tensor): the tensor to narrow + dim (int): the dimension along which to narrow + start (int): index of the element to start the narrowed dimension from. Can + be negative, which means indexing from the end of `dim` + length (int): length of the narrowed dimension, must be weakly positive + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) + >>> torch.narrow_copy(x, 0, 0, 2) + tensor([[ 1, 2, 3], + [ 4, 5, 6]]) + >>> torch.narrow_copy(x, 1, 1, 2) + tensor([[ 2, 3], + [ 5, 6], + [ 8, 9]]) + >>> s = torch.arange(16).reshape(2, 2, 2, 2).to_sparse(2) + >>> torch.narrow_copy(s, 0, 0, 1) + tensor(indices=tensor([[0, 0], + [0, 1]]), + values=tensor([[[0, 1], + [2, 3]], + + [[4, 5], + [6, 7]]]), + size=(1, 2, 2, 2), nnz=2, layout=torch.sparse_coo) + + .. seealso:: + + :func:`torch.narrow` for a non copy variant + """ + +def native_batch_norm( + input: Tensor, + weight: Tensor | None, + bias: Tensor | None, + running_mean: Tensor | None, + running_var: Tensor | None, + training: _bool, + momentum: _float, + eps: _float, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> tuple[Tensor, Tensor, Tensor]: ... +def native_channel_shuffle(input: Tensor, groups: _int | SymInt) -> Tensor: ... +def native_dropout( + input: Tensor, + p: _float, + train: _bool | None, +) -> tuple[Tensor, Tensor]: ... +def native_group_norm( + input: Tensor, + weight: Tensor | None, + bias: Tensor | None, + N: _int | SymInt, + C: _int | SymInt, + HxW: _int | SymInt, + group: _int, + eps: _float, +) -> tuple[Tensor, Tensor, Tensor]: ... +def native_layer_norm( + input: Tensor, + normalized_shape: Sequence[_int | SymInt], + weight: Tensor | None, + bias: Tensor | None, + eps: _float, +) -> tuple[Tensor, Tensor, Tensor]: ... +@overload +def native_norm( + input: Tensor, + p: Number | _complex | None, + dim: _int | _size, + keepdim: _bool, + dtype: _dtype | None, +) -> Tensor: ... +@overload +def native_norm(input: Tensor, p: Number | _complex = 2) -> Tensor: ... +@overload +def ne( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + ne(input, other, *, out=None) -> Tensor + + Computes :math:`\text{input} \neq \text{other}` element-wise. + + + The second argument can be a number or a tensor whose shape is + :ref:`broadcastable ` with the first argument. + + Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is not equal to :attr:`other` and False elsewhere + + Example:: + + >>> torch.ne(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[False, True], [True, False]]) + """ + +@overload +def ne( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + ne(input, other, *, out=None) -> Tensor + + Computes :math:`\text{input} \neq \text{other}` element-wise. + + + The second argument can be a number or a tensor whose shape is + :ref:`broadcastable ` with the first argument. + + Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + A boolean tensor that is True where :attr:`input` is not equal to :attr:`other` and False elsewhere + + Example:: + + >>> torch.ne(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[False, True], [True, False]]) + """ + +def neg(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + neg(input, *, out=None) -> Tensor + + Returns a new tensor with the negative of the elements of :attr:`input`. + + .. math:: + \text{out} = -1 \times \text{input} + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(5) + >>> a + tensor([ 0.0090, -0.2262, -0.0682, -0.2866, 0.3940]) + >>> torch.neg(a) + tensor([-0.0090, 0.2262, 0.0682, 0.2866, -0.3940]) + """ + +def neg_(input: Tensor) -> Tensor: ... +def negative(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + negative(input, *, out=None) -> Tensor + + Alias for :func:`torch.neg` + """ + +def negative_(input: Tensor) -> Tensor: ... +def nextafter( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + nextafter(input, other, *, out=None) -> Tensor + + Return the next floating-point value after :attr:`input` towards :attr:`other`, elementwise. + + The shapes of ``input`` and ``other`` must be + :ref:`broadcastable `. + + Args: + input (Tensor): the first input tensor + other (Tensor): the second input tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> eps = torch.finfo(torch.float32).eps + >>> torch.nextafter(torch.tensor([1.0, 2.0]), torch.tensor([2.0, 1.0])) == torch.tensor([eps + 1, 2 - eps]) + tensor([True, True]) + """ + +@overload +def nonzero( + input: Tensor, + *, + as_tuple: Literal[False] = False, + out: Tensor | None = None, +) -> Tensor: + r""" + nonzero(input, *, out=None, as_tuple=False) -> LongTensor or tuple of LongTensors + + .. note:: + :func:`torch.nonzero(..., as_tuple=False) ` (default) returns a + 2-D tensor where each row is the index for a nonzero value. + + :func:`torch.nonzero(..., as_tuple=True) ` returns a tuple of 1-D + index tensors, allowing for advanced indexing, so ``x[x.nonzero(as_tuple=True)]`` + gives all nonzero values of tensor ``x``. Of the returned tuple, each index tensor + contains nonzero indices for a certain dimension. + + See below for more details on the two behaviors. + + When :attr:`input` is on CUDA, :func:`torch.nonzero() ` causes + host-device synchronization. + + **When** :attr:`as_tuple` **is** ``False`` **(default)**: + + Returns a tensor containing the indices of all non-zero elements of + :attr:`input`. Each row in the result contains the indices of a non-zero + element in :attr:`input`. The result is sorted lexicographically, with + the last index changing the fastest (C-style). + + If :attr:`input` has :math:`n` dimensions, then the resulting indices tensor + :attr:`out` is of size :math:`(z \times n)`, where :math:`z` is the total number of + non-zero elements in the :attr:`input` tensor. + + **When** :attr:`as_tuple` **is** ``True``: + + Returns a tuple of 1-D tensors, one for each dimension in :attr:`input`, + each containing the indices (in that dimension) of all non-zero elements of + :attr:`input` . + + If :attr:`input` has :math:`n` dimensions, then the resulting tuple contains :math:`n` + tensors of size :math:`z`, where :math:`z` is the total number of + non-zero elements in the :attr:`input` tensor. + + As a special case, when :attr:`input` has zero dimensions and a nonzero scalar + value, it is treated as a one-dimensional tensor with one element. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (LongTensor, optional): the output tensor containing indices + + Returns: + LongTensor or tuple of LongTensor: If :attr:`as_tuple` is ``False``, the output + tensor containing indices. If :attr:`as_tuple` is ``True``, one 1-D tensor for + each dimension, containing the indices of each nonzero element along that + dimension. + + Example:: + + >>> torch.nonzero(torch.tensor([1, 1, 1, 0, 1])) + tensor([[ 0], + [ 1], + [ 2], + [ 4]]) + >>> torch.nonzero(torch.tensor([[0.6, 0.0, 0.0, 0.0], + ... [0.0, 0.4, 0.0, 0.0], + ... [0.0, 0.0, 1.2, 0.0], + ... [0.0, 0.0, 0.0,-0.4]])) + tensor([[ 0, 0], + [ 1, 1], + [ 2, 2], + [ 3, 3]]) + >>> torch.nonzero(torch.tensor([1, 1, 1, 0, 1]), as_tuple=True) + (tensor([0, 1, 2, 4]),) + >>> torch.nonzero(torch.tensor([[0.6, 0.0, 0.0, 0.0], + ... [0.0, 0.4, 0.0, 0.0], + ... [0.0, 0.0, 1.2, 0.0], + ... [0.0, 0.0, 0.0,-0.4]]), as_tuple=True) + (tensor([0, 1, 2, 3]), tensor([0, 1, 2, 3])) + >>> torch.nonzero(torch.tensor(5), as_tuple=True) + (tensor([0]),) + """ + +@overload +def nonzero( + input: Tensor, + *, + as_tuple: Literal[True], +) -> tuple[Tensor, ...]: + r""" + nonzero(input, *, out=None, as_tuple=False) -> LongTensor or tuple of LongTensors + + .. note:: + :func:`torch.nonzero(..., as_tuple=False) ` (default) returns a + 2-D tensor where each row is the index for a nonzero value. + + :func:`torch.nonzero(..., as_tuple=True) ` returns a tuple of 1-D + index tensors, allowing for advanced indexing, so ``x[x.nonzero(as_tuple=True)]`` + gives all nonzero values of tensor ``x``. Of the returned tuple, each index tensor + contains nonzero indices for a certain dimension. + + See below for more details on the two behaviors. + + When :attr:`input` is on CUDA, :func:`torch.nonzero() ` causes + host-device synchronization. + + **When** :attr:`as_tuple` **is** ``False`` **(default)**: + + Returns a tensor containing the indices of all non-zero elements of + :attr:`input`. Each row in the result contains the indices of a non-zero + element in :attr:`input`. The result is sorted lexicographically, with + the last index changing the fastest (C-style). + + If :attr:`input` has :math:`n` dimensions, then the resulting indices tensor + :attr:`out` is of size :math:`(z \times n)`, where :math:`z` is the total number of + non-zero elements in the :attr:`input` tensor. + + **When** :attr:`as_tuple` **is** ``True``: + + Returns a tuple of 1-D tensors, one for each dimension in :attr:`input`, + each containing the indices (in that dimension) of all non-zero elements of + :attr:`input` . + + If :attr:`input` has :math:`n` dimensions, then the resulting tuple contains :math:`n` + tensors of size :math:`z`, where :math:`z` is the total number of + non-zero elements in the :attr:`input` tensor. + + As a special case, when :attr:`input` has zero dimensions and a nonzero scalar + value, it is treated as a one-dimensional tensor with one element. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (LongTensor, optional): the output tensor containing indices + + Returns: + LongTensor or tuple of LongTensor: If :attr:`as_tuple` is ``False``, the output + tensor containing indices. If :attr:`as_tuple` is ``True``, one 1-D tensor for + each dimension, containing the indices of each nonzero element along that + dimension. + + Example:: + + >>> torch.nonzero(torch.tensor([1, 1, 1, 0, 1])) + tensor([[ 0], + [ 1], + [ 2], + [ 4]]) + >>> torch.nonzero(torch.tensor([[0.6, 0.0, 0.0, 0.0], + ... [0.0, 0.4, 0.0, 0.0], + ... [0.0, 0.0, 1.2, 0.0], + ... [0.0, 0.0, 0.0,-0.4]])) + tensor([[ 0, 0], + [ 1, 1], + [ 2, 2], + [ 3, 3]]) + >>> torch.nonzero(torch.tensor([1, 1, 1, 0, 1]), as_tuple=True) + (tensor([0, 1, 2, 4]),) + >>> torch.nonzero(torch.tensor([[0.6, 0.0, 0.0, 0.0], + ... [0.0, 0.4, 0.0, 0.0], + ... [0.0, 0.0, 1.2, 0.0], + ... [0.0, 0.0, 0.0,-0.4]]), as_tuple=True) + (tensor([0, 1, 2, 3]), tensor([0, 1, 2, 3])) + >>> torch.nonzero(torch.tensor(5), as_tuple=True) + (tensor([0]),) + """ + +def nonzero_static( + input: Tensor, + *, + size: _int | SymInt, + fill_value: _int = -1, + out: Tensor | None = None, +) -> Tensor: ... +def norm_except_dim(v: Tensor, pow: _int = 2, dim: _int = 0) -> Tensor: ... +@overload +def normal( + mean: Tensor, + std: Tensor, + *, + generator: Generator | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + normal(mean, std, *, generator=None, out=None) -> Tensor + + Returns a tensor of random numbers drawn from separate normal distributions + whose mean and standard deviation are given. + + The :attr:`mean` is a tensor with the mean of + each output element's normal distribution + + The :attr:`std` is a tensor with the standard deviation of + each output element's normal distribution + + The shapes of :attr:`mean` and :attr:`std` don't need to match, but the + total number of elements in each tensor need to be the same. + + .. note:: When the shapes do not match, the shape of :attr:`mean` + is used as the shape for the returned output tensor + + .. note:: When :attr:`std` is a CUDA tensor, this function synchronizes + its device with the CPU. + + Args: + mean (Tensor): the tensor of per-element means + std (Tensor): the tensor of per-element standard deviations + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.normal(mean=torch.arange(1., 11.), std=torch.arange(1, 0, -0.1)) + tensor([ 1.0425, 3.5672, 2.7969, 4.2925, 4.7229, 6.2134, + 8.0505, 8.1408, 9.0563, 10.0566]) + + .. function:: normal(mean=0.0, std, *, out=None) -> Tensor + :noindex: + + Similar to the function above, but the means are shared among all drawn + elements. + + Args: + mean (float, optional): the mean for all distributions + std (Tensor): the tensor of per-element standard deviations + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.normal(mean=0.5, std=torch.arange(1., 6.)) + tensor([-1.2793, -1.0732, -2.0687, 5.1177, -1.2303]) + + .. function:: normal(mean, std=1.0, *, out=None) -> Tensor + :noindex: + + Similar to the function above, but the standard deviations are shared among + all drawn elements. + + Args: + mean (Tensor): the tensor of per-element means + std (float, optional): the standard deviation for all distributions + + Keyword args: + out (Tensor, optional): the output tensor + + Example:: + + >>> torch.normal(mean=torch.arange(1., 6.)) + tensor([ 1.1552, 2.6148, 2.6535, 5.8318, 4.2361]) + + .. function:: normal(mean, std, size, *, out=None) -> Tensor + :noindex: + + Similar to the function above, but the means and standard deviations are shared + among all drawn elements. The resulting tensor has size given by :attr:`size`. + + Args: + mean (float): the mean for all distributions + std (float): the standard deviation for all distributions + size (int...): a sequence of integers defining the shape of the output tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.normal(2, 3, size=(1, 4)) + tensor([[-1.3987, -1.9544, 3.6048, 0.7909]]) + """ + +@overload +def normal( + mean: Tensor, + std: _float = 1, + *, + generator: Generator | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + normal(mean, std, *, generator=None, out=None) -> Tensor + + Returns a tensor of random numbers drawn from separate normal distributions + whose mean and standard deviation are given. + + The :attr:`mean` is a tensor with the mean of + each output element's normal distribution + + The :attr:`std` is a tensor with the standard deviation of + each output element's normal distribution + + The shapes of :attr:`mean` and :attr:`std` don't need to match, but the + total number of elements in each tensor need to be the same. + + .. note:: When the shapes do not match, the shape of :attr:`mean` + is used as the shape for the returned output tensor + + .. note:: When :attr:`std` is a CUDA tensor, this function synchronizes + its device with the CPU. + + Args: + mean (Tensor): the tensor of per-element means + std (Tensor): the tensor of per-element standard deviations + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.normal(mean=torch.arange(1., 11.), std=torch.arange(1, 0, -0.1)) + tensor([ 1.0425, 3.5672, 2.7969, 4.2925, 4.7229, 6.2134, + 8.0505, 8.1408, 9.0563, 10.0566]) + + .. function:: normal(mean=0.0, std, *, out=None) -> Tensor + :noindex: + + Similar to the function above, but the means are shared among all drawn + elements. + + Args: + mean (float, optional): the mean for all distributions + std (Tensor): the tensor of per-element standard deviations + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.normal(mean=0.5, std=torch.arange(1., 6.)) + tensor([-1.2793, -1.0732, -2.0687, 5.1177, -1.2303]) + + .. function:: normal(mean, std=1.0, *, out=None) -> Tensor + :noindex: + + Similar to the function above, but the standard deviations are shared among + all drawn elements. + + Args: + mean (Tensor): the tensor of per-element means + std (float, optional): the standard deviation for all distributions + + Keyword args: + out (Tensor, optional): the output tensor + + Example:: + + >>> torch.normal(mean=torch.arange(1., 6.)) + tensor([ 1.1552, 2.6148, 2.6535, 5.8318, 4.2361]) + + .. function:: normal(mean, std, size, *, out=None) -> Tensor + :noindex: + + Similar to the function above, but the means and standard deviations are shared + among all drawn elements. The resulting tensor has size given by :attr:`size`. + + Args: + mean (float): the mean for all distributions + std (float): the standard deviation for all distributions + size (int...): a sequence of integers defining the shape of the output tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.normal(2, 3, size=(1, 4)) + tensor([[-1.3987, -1.9544, 3.6048, 0.7909]]) + """ + +@overload +def normal( + mean: _float, + std: Tensor, + *, + generator: Generator | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + normal(mean, std, *, generator=None, out=None) -> Tensor + + Returns a tensor of random numbers drawn from separate normal distributions + whose mean and standard deviation are given. + + The :attr:`mean` is a tensor with the mean of + each output element's normal distribution + + The :attr:`std` is a tensor with the standard deviation of + each output element's normal distribution + + The shapes of :attr:`mean` and :attr:`std` don't need to match, but the + total number of elements in each tensor need to be the same. + + .. note:: When the shapes do not match, the shape of :attr:`mean` + is used as the shape for the returned output tensor + + .. note:: When :attr:`std` is a CUDA tensor, this function synchronizes + its device with the CPU. + + Args: + mean (Tensor): the tensor of per-element means + std (Tensor): the tensor of per-element standard deviations + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.normal(mean=torch.arange(1., 11.), std=torch.arange(1, 0, -0.1)) + tensor([ 1.0425, 3.5672, 2.7969, 4.2925, 4.7229, 6.2134, + 8.0505, 8.1408, 9.0563, 10.0566]) + + .. function:: normal(mean=0.0, std, *, out=None) -> Tensor + :noindex: + + Similar to the function above, but the means are shared among all drawn + elements. + + Args: + mean (float, optional): the mean for all distributions + std (Tensor): the tensor of per-element standard deviations + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.normal(mean=0.5, std=torch.arange(1., 6.)) + tensor([-1.2793, -1.0732, -2.0687, 5.1177, -1.2303]) + + .. function:: normal(mean, std=1.0, *, out=None) -> Tensor + :noindex: + + Similar to the function above, but the standard deviations are shared among + all drawn elements. + + Args: + mean (Tensor): the tensor of per-element means + std (float, optional): the standard deviation for all distributions + + Keyword args: + out (Tensor, optional): the output tensor + + Example:: + + >>> torch.normal(mean=torch.arange(1., 6.)) + tensor([ 1.1552, 2.6148, 2.6535, 5.8318, 4.2361]) + + .. function:: normal(mean, std, size, *, out=None) -> Tensor + :noindex: + + Similar to the function above, but the means and standard deviations are shared + among all drawn elements. The resulting tensor has size given by :attr:`size`. + + Args: + mean (float): the mean for all distributions + std (float): the standard deviation for all distributions + size (int...): a sequence of integers defining the shape of the output tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.normal(2, 3, size=(1, 4)) + tensor([[-1.3987, -1.9544, 3.6048, 0.7909]]) + """ + +@overload +def normal( + mean: _float, + std: _float, + size: Sequence[_int | SymInt], + *, + generator: Generator | None = None, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + normal(mean, std, *, generator=None, out=None) -> Tensor + + Returns a tensor of random numbers drawn from separate normal distributions + whose mean and standard deviation are given. + + The :attr:`mean` is a tensor with the mean of + each output element's normal distribution + + The :attr:`std` is a tensor with the standard deviation of + each output element's normal distribution + + The shapes of :attr:`mean` and :attr:`std` don't need to match, but the + total number of elements in each tensor need to be the same. + + .. note:: When the shapes do not match, the shape of :attr:`mean` + is used as the shape for the returned output tensor + + .. note:: When :attr:`std` is a CUDA tensor, this function synchronizes + its device with the CPU. + + Args: + mean (Tensor): the tensor of per-element means + std (Tensor): the tensor of per-element standard deviations + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.normal(mean=torch.arange(1., 11.), std=torch.arange(1, 0, -0.1)) + tensor([ 1.0425, 3.5672, 2.7969, 4.2925, 4.7229, 6.2134, + 8.0505, 8.1408, 9.0563, 10.0566]) + + .. function:: normal(mean=0.0, std, *, out=None) -> Tensor + :noindex: + + Similar to the function above, but the means are shared among all drawn + elements. + + Args: + mean (float, optional): the mean for all distributions + std (Tensor): the tensor of per-element standard deviations + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.normal(mean=0.5, std=torch.arange(1., 6.)) + tensor([-1.2793, -1.0732, -2.0687, 5.1177, -1.2303]) + + .. function:: normal(mean, std=1.0, *, out=None) -> Tensor + :noindex: + + Similar to the function above, but the standard deviations are shared among + all drawn elements. + + Args: + mean (Tensor): the tensor of per-element means + std (float, optional): the standard deviation for all distributions + + Keyword args: + out (Tensor, optional): the output tensor + + Example:: + + >>> torch.normal(mean=torch.arange(1., 6.)) + tensor([ 1.1552, 2.6148, 2.6535, 5.8318, 4.2361]) + + .. function:: normal(mean, std, size, *, out=None) -> Tensor + :noindex: + + Similar to the function above, but the means and standard deviations are shared + among all drawn elements. The resulting tensor has size given by :attr:`size`. + + Args: + mean (float): the mean for all distributions + std (float): the standard deviation for all distributions + size (int...): a sequence of integers defining the shape of the output tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.normal(2, 3, size=(1, 4)) + tensor([[-1.3987, -1.9544, 3.6048, 0.7909]]) + """ + +@overload +def not_equal( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + not_equal(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.ne`. + """ + +@overload +def not_equal( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + not_equal(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.ne`. + """ + +@overload +def nuclear_norm( + input: Tensor, + dim: _int | _size, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: ... +@overload +def nuclear_norm( + input: Tensor, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: ... +def numel(self: Tensor) -> _int: + r""" + numel(input: Tensor) -> int + + Returns the total number of elements in the :attr:`input` tensor. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> a = torch.randn(1, 2, 3, 4, 5) + >>> torch.numel(a) + 120 + >>> a = torch.zeros(4,4) + >>> torch.numel(a) + 16 + """ + +@overload +def ones( + size: Sequence[_int | SymInt], + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + ones(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with the scalar value `1`, with the shape defined + by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.ones(2, 3) + tensor([[ 1., 1., 1.], + [ 1., 1., 1.]]) + + >>> torch.ones(5) + tensor([ 1., 1., 1., 1., 1.]) + """ + +@overload +def ones( + *size: _int | SymInt, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + ones(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with the scalar value `1`, with the shape defined + by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.ones(2, 3) + tensor([[ 1., 1., 1.], + [ 1., 1., 1.]]) + + >>> torch.ones(5) + tensor([ 1., 1., 1., 1., 1.]) + """ + +@overload +def ones( + size: _size, + *, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + ones(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with the scalar value `1`, with the shape defined + by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.ones(2, 3) + tensor([[ 1., 1., 1.], + [ 1., 1., 1.]]) + + >>> torch.ones(5) + tensor([ 1., 1., 1., 1., 1.]) + """ + +@overload +def ones( + *size: _int, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + ones(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with the scalar value `1`, with the shape defined + by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword arguments: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.ones(2, 3) + tensor([[ 1., 1., 1.], + [ 1., 1., 1.]]) + + >>> torch.ones(5) + tensor([ 1., 1., 1., 1., 1.]) + """ + +def ones_like( + input: Tensor, + *, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + ones_like(input, *, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor filled with the scalar value `1`, with the same size as + :attr:`input`. ``torch.ones_like(input)`` is equivalent to + ``torch.ones(input.size(), dtype=input.dtype, layout=input.layout, device=input.device)``. + + .. warning:: + As of 0.4, this function does not support an :attr:`out` keyword. As an alternative, + the old ``torch.ones_like(input, out=output)`` is equivalent to + ``torch.ones(input.size(), out=output)``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + + Keyword arguments: + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + + Example:: + + >>> input = torch.empty(2, 3) + >>> torch.ones_like(input) + tensor([[ 1., 1., 1.], + [ 1., 1., 1.]]) + """ + +def orgqr( + input: Tensor, + input2: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + orgqr(input, tau) -> Tensor + + Alias for :func:`torch.linalg.householder_product`. + """ + +def ormqr( + input: Tensor, + input2: Tensor, + input3: Tensor, + left: _bool = True, + transpose: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + ormqr(input, tau, other, left=True, transpose=False, *, out=None) -> Tensor + + Computes the matrix-matrix multiplication of a product of Householder matrices with a general matrix. + + Multiplies a :math:`m \times n` matrix `C` (given by :attr:`other`) with a matrix `Q`, + where `Q` is represented using Householder reflectors `(input, tau)`. + See `Representation of Orthogonal or Unitary Matrices`_ for further details. + + If :attr:`left` is `True` then `op(Q)` times `C` is computed, otherwise the result is `C` times `op(Q)`. + When :attr:`left` is `True`, the implicit matrix `Q` has size :math:`m \times m`. + It has size :math:`n \times n` otherwise. + If :attr:`transpose` is `True` then `op` is the conjugate transpose operation, otherwise it's a no-op. + + Supports inputs of float, double, cfloat and cdouble dtypes. + Also supports batched inputs, and, if the input is batched, the output is batched with the same dimensions. + + .. seealso:: + :func:`torch.geqrf` can be used to form the Householder representation `(input, tau)` of matrix `Q` + from the QR decomposition. + + .. note:: + This function supports backward but it is only fast when ``(input, tau)`` do not require gradients + and/or ``tau.size(-1)`` is very small. + `` + + Args: + input (Tensor): tensor of shape `(*, mn, k)` where `*` is zero or more batch dimensions + and `mn` equals to `m` or `n` depending on the :attr:`left`. + tau (Tensor): tensor of shape `(*, min(mn, k))` where `*` is zero or more batch dimensions. + other (Tensor): tensor of shape `(*, m, n)` where `*` is zero or more batch dimensions. + left (bool): controls the order of multiplication. + transpose (bool): controls whether the matrix `Q` is conjugate transposed or not. + + Keyword args: + out (Tensor, optional): the output Tensor. Ignored if `None`. Default: `None`. + + .. _Representation of Orthogonal or Unitary Matrices: + https://www.netlib.org/lapack/lug/node128.html + """ + +def outer( + input: Tensor, + vec2: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + outer(input, vec2, *, out=None) -> Tensor + + Outer product of :attr:`input` and :attr:`vec2`. + If :attr:`input` is a vector of size :math:`n` and :attr:`vec2` is a vector of + size :math:`m`, then :attr:`out` must be a matrix of size :math:`(n \times m)`. + + .. note:: This function does not :ref:`broadcast `. + + Args: + input (Tensor): 1-D input vector + vec2 (Tensor): 1-D input vector + + Keyword args: + out (Tensor, optional): optional output matrix + + Example:: + + >>> v1 = torch.arange(1., 5.) + >>> v2 = torch.arange(1., 4.) + >>> torch.outer(v1, v2) + tensor([[ 1., 2., 3.], + [ 2., 4., 6.], + [ 3., 6., 9.], + [ 4., 8., 12.]]) + """ + +def pairwise_distance( + x1: Tensor, + x2: Tensor, + p: _float = 2, + eps: _float = 1e-06, + keepdim: _bool = False, +) -> Tensor: ... +def pdist(input: Tensor, p: _float = 2) -> Tensor: ... +def permute(input: Tensor, dims: _size) -> Tensor: + r""" + permute(input, dims) -> Tensor + + Returns a view of the original tensor :attr:`input` with its dimensions permuted. + + Args: + input (Tensor): the input tensor. + dims (tuple of int): The desired ordering of dimensions + + Example: + >>> x = torch.randn(2, 3, 5) + >>> x.size() + torch.Size([2, 3, 5]) + >>> torch.permute(x, (2, 0, 1)).size() + torch.Size([5, 2, 3]) + """ + +def permute_copy( + input: Tensor, + dims: _size, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.permute`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def pinverse(input: Tensor, rcond: _float = 1e-15) -> Tensor: + r""" + pinverse(input, rcond=1e-15) -> Tensor + + Alias for :func:`torch.linalg.pinv` + """ + +def pixel_shuffle(input: Tensor, upscale_factor: _int) -> Tensor: ... +def pixel_unshuffle(input: Tensor, downscale_factor: _int) -> Tensor: ... +def poisson(input: Tensor, generator: Generator | None = None) -> Tensor: + r""" + poisson(input, generator=None) -> Tensor + + Returns a tensor of the same size as :attr:`input` with each element + sampled from a Poisson distribution with rate parameter given by the corresponding + element in :attr:`input` i.e., + + .. math:: + \text{out}_i \sim \text{Poisson}(\text{input}_i) + + :attr:`input` must be non-negative. + + Args: + input (Tensor): the input tensor containing the rates of the Poisson distribution + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + + Example:: + + >>> rates = torch.rand(4, 4) * 5 # rate parameter between 0 and 5 + >>> torch.poisson(rates) + tensor([[9., 1., 3., 5.], + [8., 6., 6., 0.], + [0., 4., 5., 3.], + [2., 1., 4., 2.]]) + """ + +def poisson_nll_loss( + input: Tensor, + target: Tensor, + log_input: _bool, + full: _bool, + eps: _float, + reduction: _int, +) -> Tensor: ... +def polar( + abs: Tensor, + angle: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + polar(abs, angle, *, out=None) -> Tensor + + Constructs a complex tensor whose elements are Cartesian coordinates + corresponding to the polar coordinates with absolute value :attr:`abs` and angle + :attr:`angle`. + + .. math:: + \text{out} = \text{abs} \cdot \cos(\text{angle}) + \text{abs} \cdot \sin(\text{angle}) \cdot j + + .. note:: + `torch.polar` is similar to + `std::polar `_ + and does not compute the polar decomposition + of a complex tensor like Python's `cmath.polar` and SciPy's `linalg.polar` do. + The behavior of this function is undefined if `abs` is negative or NaN, or if `angle` is + infinite. + + + Args: + abs (Tensor): The absolute value the complex tensor. Must be float or double. + angle (Tensor): The angle of the complex tensor. Must be same dtype as + :attr:`abs`. + + Keyword args: + out (Tensor): If the inputs are ``torch.float32``, must be + ``torch.complex64``. If the inputs are ``torch.float64``, must be + ``torch.complex128``. + + Example:: + + >>> import numpy as np + >>> abs = torch.tensor([1, 2], dtype=torch.float64) + >>> angle = torch.tensor([np.pi / 2, 5 * np.pi / 4], dtype=torch.float64) + >>> z = torch.polar(abs, angle) + >>> z + tensor([(0.0000+1.0000j), (-1.4142-1.4142j)], dtype=torch.complex128) + """ + +def polygamma( + n: _int, + input: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + polygamma(n, input, *, out=None) -> Tensor + + Alias for :func:`torch.special.polygamma`. + """ + +def positive(input: Tensor) -> Tensor: + r""" + positive(input) -> Tensor + + Returns :attr:`input`. + Throws a runtime error if :attr:`input` is a bool tensor. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> t = torch.randn(5) + >>> t + tensor([ 0.0090, -0.2262, -0.0682, -0.2866, 0.3940]) + >>> torch.positive(t) + tensor([ 0.0090, -0.2262, -0.0682, -0.2866, 0.3940]) + """ + +@overload +def pow( + input: Tensor, + exponent: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + pow(input, exponent, *, out=None) -> Tensor + + Takes the power of each element in :attr:`input` with :attr:`exponent` and + returns a tensor with the result. + + :attr:`exponent` can be either a single ``float`` number or a `Tensor` + with the same number of elements as :attr:`input`. + + When :attr:`exponent` is a scalar value, the operation applied is: + + .. math:: + \text{out}_i = x_i ^ \text{exponent} + + When :attr:`exponent` is a tensor, the operation applied is: + + .. math:: + \text{out}_i = x_i ^ {\text{exponent}_i} + + When :attr:`exponent` is a tensor, the shapes of :attr:`input` + and :attr:`exponent` must be :ref:`broadcastable `. + + Args: + input (Tensor): the input tensor. + exponent (float or tensor): the exponent value + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.4331, 1.2475, 0.6834, -0.2791]) + >>> torch.pow(a, 2) + tensor([ 0.1875, 1.5561, 0.4670, 0.0779]) + >>> exp = torch.arange(1., 5.) + + >>> a = torch.arange(1., 5.) + >>> a + tensor([ 1., 2., 3., 4.]) + >>> exp + tensor([ 1., 2., 3., 4.]) + >>> torch.pow(a, exp) + tensor([ 1., 4., 27., 256.]) + + .. function:: pow(self, exponent, *, out=None) -> Tensor + :noindex: + + :attr:`self` is a scalar ``float`` value, and :attr:`exponent` is a tensor. + The returned tensor :attr:`out` is of the same shape as :attr:`exponent` + + The operation applied is: + + .. math:: + \text{out}_i = \text{self} ^ {\text{exponent}_i} + + Args: + self (float): the scalar base value for the power operation + exponent (Tensor): the exponent tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> exp = torch.arange(1., 5.) + >>> base = 2 + >>> torch.pow(base, exp) + tensor([ 2., 4., 8., 16.]) + """ + +@overload +def pow( + self: Number | _complex, + exponent: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + pow(input, exponent, *, out=None) -> Tensor + + Takes the power of each element in :attr:`input` with :attr:`exponent` and + returns a tensor with the result. + + :attr:`exponent` can be either a single ``float`` number or a `Tensor` + with the same number of elements as :attr:`input`. + + When :attr:`exponent` is a scalar value, the operation applied is: + + .. math:: + \text{out}_i = x_i ^ \text{exponent} + + When :attr:`exponent` is a tensor, the operation applied is: + + .. math:: + \text{out}_i = x_i ^ {\text{exponent}_i} + + When :attr:`exponent` is a tensor, the shapes of :attr:`input` + and :attr:`exponent` must be :ref:`broadcastable `. + + Args: + input (Tensor): the input tensor. + exponent (float or tensor): the exponent value + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.4331, 1.2475, 0.6834, -0.2791]) + >>> torch.pow(a, 2) + tensor([ 0.1875, 1.5561, 0.4670, 0.0779]) + >>> exp = torch.arange(1., 5.) + + >>> a = torch.arange(1., 5.) + >>> a + tensor([ 1., 2., 3., 4.]) + >>> exp + tensor([ 1., 2., 3., 4.]) + >>> torch.pow(a, exp) + tensor([ 1., 4., 27., 256.]) + + .. function:: pow(self, exponent, *, out=None) -> Tensor + :noindex: + + :attr:`self` is a scalar ``float`` value, and :attr:`exponent` is a tensor. + The returned tensor :attr:`out` is of the same shape as :attr:`exponent` + + The operation applied is: + + .. math:: + \text{out}_i = \text{self} ^ {\text{exponent}_i} + + Args: + self (float): the scalar base value for the power operation + exponent (Tensor): the exponent tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> exp = torch.arange(1., 5.) + >>> base = 2 + >>> torch.pow(base, exp) + tensor([ 2., 4., 8., 16.]) + """ + +@overload +def pow( + input: Tensor, + exponent: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + pow(input, exponent, *, out=None) -> Tensor + + Takes the power of each element in :attr:`input` with :attr:`exponent` and + returns a tensor with the result. + + :attr:`exponent` can be either a single ``float`` number or a `Tensor` + with the same number of elements as :attr:`input`. + + When :attr:`exponent` is a scalar value, the operation applied is: + + .. math:: + \text{out}_i = x_i ^ \text{exponent} + + When :attr:`exponent` is a tensor, the operation applied is: + + .. math:: + \text{out}_i = x_i ^ {\text{exponent}_i} + + When :attr:`exponent` is a tensor, the shapes of :attr:`input` + and :attr:`exponent` must be :ref:`broadcastable `. + + Args: + input (Tensor): the input tensor. + exponent (float or tensor): the exponent value + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.4331, 1.2475, 0.6834, -0.2791]) + >>> torch.pow(a, 2) + tensor([ 0.1875, 1.5561, 0.4670, 0.0779]) + >>> exp = torch.arange(1., 5.) + + >>> a = torch.arange(1., 5.) + >>> a + tensor([ 1., 2., 3., 4.]) + >>> exp + tensor([ 1., 2., 3., 4.]) + >>> torch.pow(a, exp) + tensor([ 1., 4., 27., 256.]) + + .. function:: pow(self, exponent, *, out=None) -> Tensor + :noindex: + + :attr:`self` is a scalar ``float`` value, and :attr:`exponent` is a tensor. + The returned tensor :attr:`out` is of the same shape as :attr:`exponent` + + The operation applied is: + + .. math:: + \text{out}_i = \text{self} ^ {\text{exponent}_i} + + Args: + self (float): the scalar base value for the power operation + exponent (Tensor): the exponent tensor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> exp = torch.arange(1., 5.) + >>> base = 2 + >>> torch.pow(base, exp) + tensor([ 2., 4., 8., 16.]) + """ + +def prelu(input: Tensor, weight: Tensor) -> Tensor: ... +@overload +def prod(input: Tensor, *, dtype: _dtype | None = None) -> Tensor: + r""" + prod(input: Tensor, *, dtype: Optional[_dtype]) -> Tensor + + Returns the product of all elements in the :attr:`input` tensor. + + Args: + input (Tensor): the input tensor. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[-0.8020, 0.5428, -1.5854]]) + >>> torch.prod(a) + tensor(0.6902) + + .. function:: prod(input, dim, keepdim=False, *, dtype=None) -> Tensor + :noindex: + + Returns the product of each row of the :attr:`input` tensor in the given + dimension :attr:`dim`. + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in + the output tensor having 1 fewer dimension than :attr:`input`. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.randn(4, 2) + >>> a + tensor([[ 0.5261, -0.3837], + [ 1.1857, -0.2498], + [-1.1646, 0.0705], + [ 1.1131, -1.0629]]) + >>> torch.prod(a, 1) + tensor([-0.2018, -0.2962, -0.0821, -1.1831]) + """ + +@overload +def prod( + input: Tensor, + dim: _int, + keepdim: _bool = False, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + prod(input: Tensor, *, dtype: Optional[_dtype]) -> Tensor + + Returns the product of all elements in the :attr:`input` tensor. + + Args: + input (Tensor): the input tensor. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[-0.8020, 0.5428, -1.5854]]) + >>> torch.prod(a) + tensor(0.6902) + + .. function:: prod(input, dim, keepdim=False, *, dtype=None) -> Tensor + :noindex: + + Returns the product of each row of the :attr:`input` tensor in the given + dimension :attr:`dim`. + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in + the output tensor having 1 fewer dimension than :attr:`input`. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.randn(4, 2) + >>> a + tensor([[ 0.5261, -0.3837], + [ 1.1857, -0.2498], + [-1.1646, 0.0705], + [ 1.1131, -1.0629]]) + >>> torch.prod(a, 1) + tensor([-0.2018, -0.2962, -0.0821, -1.1831]) + """ + +@overload +def prod( + input: Tensor, + dim: str | EllipsisType | None, + keepdim: _bool = False, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + prod(input: Tensor, *, dtype: Optional[_dtype]) -> Tensor + + Returns the product of all elements in the :attr:`input` tensor. + + Args: + input (Tensor): the input tensor. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[-0.8020, 0.5428, -1.5854]]) + >>> torch.prod(a) + tensor(0.6902) + + .. function:: prod(input, dim, keepdim=False, *, dtype=None) -> Tensor + :noindex: + + Returns the product of each row of the :attr:`input` tensor in the given + dimension :attr:`dim`. + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in + the output tensor having 1 fewer dimension than :attr:`input`. + + Args: + input (Tensor): the input tensor. + + dim (int, optional): the dimension to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.randn(4, 2) + >>> a + tensor([[ 0.5261, -0.3837], + [ 1.1857, -0.2498], + [-1.1646, 0.0705], + [ 1.1131, -1.0629]]) + >>> torch.prod(a, 1) + tensor([-0.2018, -0.2962, -0.0821, -1.1831]) + """ + +def promote_types(type1: _dtype, type2: _dtype) -> _dtype: + r""" + promote_types(type1, type2) -> dtype + + Returns the :class:`torch.dtype` with the smallest size and scalar kind that is + not smaller nor of lower kind than either `type1` or `type2`. See type promotion + :ref:`documentation ` for more information on the type + promotion logic. + + Args: + type1 (:class:`torch.dtype`) + type2 (:class:`torch.dtype`) + + Example:: + + >>> torch.promote_types(torch.int32, torch.float32) + torch.float32 + >>> torch.promote_types(torch.uint8, torch.long) + torch.long + """ + +def put( + input: Tensor, + index: Tensor, + source: Tensor, + accumulate: _bool = False, +) -> Tensor: ... +def q_per_channel_axis(input: Tensor) -> _int: ... +def q_per_channel_scales(input: Tensor) -> Tensor: ... +def q_per_channel_zero_points(input: Tensor) -> Tensor: ... +def q_scale(input: Tensor) -> _float: ... +def q_zero_point(input: Tensor) -> _int: ... +def qr( + input: Tensor, + some: _bool = True, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.qr: + r""" + qr(input: Tensor, some: bool = True, *, out: Union[Tensor, Tuple[Tensor, ...], List[Tensor], None]) -> (Tensor, Tensor) + + Computes the QR decomposition of a matrix or a batch of matrices :attr:`input`, + and returns a namedtuple (Q, R) of tensors such that :math:`\text{input} = Q R` + with :math:`Q` being an orthogonal matrix or batch of orthogonal matrices and + :math:`R` being an upper triangular matrix or batch of upper triangular matrices. + + If :attr:`some` is ``True``, then this function returns the thin (reduced) QR factorization. + Otherwise, if :attr:`some` is ``False``, this function returns the complete QR factorization. + + .. warning:: + + :func:`torch.qr` is deprecated in favor of :func:`torch.linalg.qr` + and will be removed in a future PyTorch release. The boolean parameter :attr:`some` has been + replaced with a string parameter :attr:`mode`. + + ``Q, R = torch.qr(A)`` should be replaced with + + .. code:: python + + Q, R = torch.linalg.qr(A) + + ``Q, R = torch.qr(A, some=False)`` should be replaced with + + .. code:: python + + Q, R = torch.linalg.qr(A, mode="complete") + + .. warning:: + If you plan to backpropagate through QR, note that the current backward implementation + is only well-defined when the first :math:`\min(input.size(-1), input.size(-2))` + columns of :attr:`input` are linearly independent. + This behavior will probably change once QR supports pivoting. + + .. note:: This function uses LAPACK for CPU inputs and MAGMA for CUDA inputs, + and may produce different (valid) decompositions on different device types + or different platforms. + + Args: + input (Tensor): the input tensor of size :math:`(*, m, n)` where `*` is zero or more + batch dimensions consisting of matrices of dimension :math:`m \times n`. + some (bool, optional): Set to ``True`` for reduced QR decomposition and ``False`` for + complete QR decomposition. If `k = min(m, n)` then: + + * ``some=True`` : returns `(Q, R)` with dimensions (m, k), (k, n) (default) + + * ``'some=False'``: returns `(Q, R)` with dimensions (m, m), (m, n) + + Keyword args: + out (tuple, optional): tuple of `Q` and `R` tensors. + The dimensions of `Q` and `R` are detailed in the description of :attr:`some` above. + + Example:: + + >>> a = torch.tensor([[12., -51, 4], [6, 167, -68], [-4, 24, -41]]) + >>> q, r = torch.qr(a) + >>> q + tensor([[-0.8571, 0.3943, 0.3314], + [-0.4286, -0.9029, -0.0343], + [ 0.2857, -0.1714, 0.9429]]) + >>> r + tensor([[ -14.0000, -21.0000, 14.0000], + [ 0.0000, -175.0000, 70.0000], + [ 0.0000, 0.0000, -35.0000]]) + >>> torch.mm(q, r).round() + tensor([[ 12., -51., 4.], + [ 6., 167., -68.], + [ -4., 24., -41.]]) + >>> torch.mm(q.t(), q).round() + tensor([[ 1., 0., 0.], + [ 0., 1., -0.], + [ 0., -0., 1.]]) + >>> a = torch.randn(3, 4, 5) + >>> q, r = torch.qr(a, some=False) + >>> torch.allclose(torch.matmul(q, r), a) + True + >>> torch.allclose(torch.matmul(q.mT, q), torch.eye(5)) + True + """ + +@overload +def quantile( + input: Tensor, + q: Tensor, + dim: _int | None = None, + keepdim: _bool = False, + *, + interpolation: str = "linear", + out: Tensor | None = None, +) -> Tensor: + r""" + quantile(input, q, dim=None, keepdim=False, *, interpolation='linear', out=None) -> Tensor + + Computes the q-th quantiles of each row of the :attr:`input` tensor along the dimension :attr:`dim`. + + To compute the quantile, we map q in [0, 1] to the range of indices [0, n] to find the location + of the quantile in the sorted input. If the quantile lies between two data points ``a < b`` with + indices ``i`` and ``j`` in the sorted order, result is computed according to the given + :attr:`interpolation` method as follows: + + - ``linear``: ``a + (b - a) * fraction``, where ``fraction`` is the fractional part of the computed quantile index. + - ``lower``: ``a``. + - ``higher``: ``b``. + - ``nearest``: ``a`` or ``b``, whichever's index is closer to the computed quantile index (follows :func:`torch.round`). + - ``midpoint``: ``(a + b) / 2``. + + If :attr:`q` is a 1D tensor, the first dimension of the output represents the quantiles and has size + equal to the size of :attr:`q`, the remaining dimensions are what remains from the reduction. + + .. note:: + By default :attr:`dim` is ``None`` resulting in the :attr:`input` tensor being flattened before computation. + + Args: + input (Tensor): the input tensor. + q (float or Tensor): a scalar or 1D tensor of values in the range [0, 1]. + + dim (int, optional): the dimension to reduce. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword arguments: + interpolation (str, optional): interpolation method to use when the desired quantile lies between two data points. + Can be ``linear``, ``lower``, ``higher``, ``midpoint`` and ``nearest``. + Default is ``linear``. + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(2, 3) + >>> a + tensor([[ 0.0795, -1.2117, 0.9765], + [ 1.1707, 0.6706, 0.4884]]) + >>> q = torch.tensor([0.25, 0.5, 0.75]) + >>> torch.quantile(a, q, dim=1, keepdim=True) + tensor([[[-0.5661], + [ 0.5795]], + + [[ 0.0795], + [ 0.6706]], + + [[ 0.5280], + [ 0.9206]]]) + >>> torch.quantile(a, q, dim=1, keepdim=True).shape + torch.Size([3, 2, 1]) + >>> a = torch.arange(4.) + >>> a + tensor([0., 1., 2., 3.]) + >>> torch.quantile(a, 0.6, interpolation='linear') + tensor(1.8000) + >>> torch.quantile(a, 0.6, interpolation='lower') + tensor(1.) + >>> torch.quantile(a, 0.6, interpolation='higher') + tensor(2.) + >>> torch.quantile(a, 0.6, interpolation='midpoint') + tensor(1.5000) + >>> torch.quantile(a, 0.6, interpolation='nearest') + tensor(2.) + >>> torch.quantile(a, 0.4, interpolation='nearest') + tensor(1.) + """ + +@overload +def quantile( + input: Tensor, + q: _float, + dim: _int | None = None, + keepdim: _bool = False, + *, + interpolation: str = "linear", + out: Tensor | None = None, +) -> Tensor: + r""" + quantile(input, q, dim=None, keepdim=False, *, interpolation='linear', out=None) -> Tensor + + Computes the q-th quantiles of each row of the :attr:`input` tensor along the dimension :attr:`dim`. + + To compute the quantile, we map q in [0, 1] to the range of indices [0, n] to find the location + of the quantile in the sorted input. If the quantile lies between two data points ``a < b`` with + indices ``i`` and ``j`` in the sorted order, result is computed according to the given + :attr:`interpolation` method as follows: + + - ``linear``: ``a + (b - a) * fraction``, where ``fraction`` is the fractional part of the computed quantile index. + - ``lower``: ``a``. + - ``higher``: ``b``. + - ``nearest``: ``a`` or ``b``, whichever's index is closer to the computed quantile index (follows :func:`torch.round`). + - ``midpoint``: ``(a + b) / 2``. + + If :attr:`q` is a 1D tensor, the first dimension of the output represents the quantiles and has size + equal to the size of :attr:`q`, the remaining dimensions are what remains from the reduction. + + .. note:: + By default :attr:`dim` is ``None`` resulting in the :attr:`input` tensor being flattened before computation. + + Args: + input (Tensor): the input tensor. + q (float or Tensor): a scalar or 1D tensor of values in the range [0, 1]. + + dim (int, optional): the dimension to reduce. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword arguments: + interpolation (str, optional): interpolation method to use when the desired quantile lies between two data points. + Can be ``linear``, ``lower``, ``higher``, ``midpoint`` and ``nearest``. + Default is ``linear``. + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(2, 3) + >>> a + tensor([[ 0.0795, -1.2117, 0.9765], + [ 1.1707, 0.6706, 0.4884]]) + >>> q = torch.tensor([0.25, 0.5, 0.75]) + >>> torch.quantile(a, q, dim=1, keepdim=True) + tensor([[[-0.5661], + [ 0.5795]], + + [[ 0.0795], + [ 0.6706]], + + [[ 0.5280], + [ 0.9206]]]) + >>> torch.quantile(a, q, dim=1, keepdim=True).shape + torch.Size([3, 2, 1]) + >>> a = torch.arange(4.) + >>> a + tensor([0., 1., 2., 3.]) + >>> torch.quantile(a, 0.6, interpolation='linear') + tensor(1.8000) + >>> torch.quantile(a, 0.6, interpolation='lower') + tensor(1.) + >>> torch.quantile(a, 0.6, interpolation='higher') + tensor(2.) + >>> torch.quantile(a, 0.6, interpolation='midpoint') + tensor(1.5000) + >>> torch.quantile(a, 0.6, interpolation='nearest') + tensor(2.) + >>> torch.quantile(a, 0.4, interpolation='nearest') + tensor(1.) + """ + +def quantize_per_channel( + input: Tensor, + scales: Tensor, + zero_points: Tensor, + axis: _int, + dtype: _dtype, +) -> Tensor: + r""" + quantize_per_channel(input, scales, zero_points, axis, dtype) -> Tensor + + Converts a float tensor to a per-channel quantized tensor with given scales and zero points. + + Arguments: + input (Tensor): float tensor to quantize + scales (Tensor): float 1D tensor of scales to use, size should match ``input.size(axis)`` + zero_points (int): integer 1D tensor of offset to use, size should match ``input.size(axis)`` + axis (int): dimension on which apply per-channel quantization + dtype (:class:`torch.dtype`): the desired data type of returned tensor. + Has to be one of the quantized dtypes: ``torch.quint8``, ``torch.qint8``, ``torch.qint32`` + + Returns: + Tensor: A newly quantized tensor + + Example:: + + >>> x = torch.tensor([[-1.0, 0.0], [1.0, 2.0]]) + >>> torch.quantize_per_channel(x, torch.tensor([0.1, 0.01]), torch.tensor([10, 0]), 0, torch.quint8) + tensor([[-1., 0.], + [ 1., 2.]], size=(2, 2), dtype=torch.quint8, + quantization_scheme=torch.per_channel_affine, + scale=tensor([0.1000, 0.0100], dtype=torch.float64), + zero_point=tensor([10, 0]), axis=0) + >>> torch.quantize_per_channel(x, torch.tensor([0.1, 0.01]), torch.tensor([10, 0]), 0, torch.quint8).int_repr() + tensor([[ 0, 10], + [100, 200]], dtype=torch.uint8) + """ + +@overload +def quantize_per_tensor( + input: Tensor, + scale: Tensor, + zero_point: Tensor, + dtype: _dtype, +) -> Tensor: + r""" + quantize_per_tensor(input, scale, zero_point, dtype) -> Tensor + + Converts a float tensor to a quantized tensor with given scale and zero point. + + Arguments: + input (Tensor): float tensor or list of tensors to quantize + scale (float or Tensor): scale to apply in quantization formula + zero_point (int or Tensor): offset in integer value that maps to float zero + dtype (:class:`torch.dtype`): the desired data type of returned tensor. + Has to be one of the quantized dtypes: ``torch.quint8``, ``torch.qint8``, ``torch.qint32`` + + Returns: + Tensor: A newly quantized tensor or list of quantized tensors. + + Example:: + + >>> torch.quantize_per_tensor(torch.tensor([-1.0, 0.0, 1.0, 2.0]), 0.1, 10, torch.quint8) + tensor([-1., 0., 1., 2.], size=(4,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.1, zero_point=10) + >>> torch.quantize_per_tensor(torch.tensor([-1.0, 0.0, 1.0, 2.0]), 0.1, 10, torch.quint8).int_repr() + tensor([ 0, 10, 20, 30], dtype=torch.uint8) + >>> torch.quantize_per_tensor([torch.tensor([-1.0, 0.0]), torch.tensor([-2.0, 2.0])], + >>> torch.tensor([0.1, 0.2]), torch.tensor([10, 20]), torch.quint8) + (tensor([-1., 0.], size=(2,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.1, zero_point=10), + tensor([-2., 2.], size=(2,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.2, zero_point=20)) + >>> torch.quantize_per_tensor(torch.tensor([-1.0, 0.0, 1.0, 2.0]), torch.tensor(0.1), torch.tensor(10), torch.quint8) + tensor([-1., 0., 1., 2.], size=(4,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.10, zero_point=10) + """ + +@overload +def quantize_per_tensor( + input: Tensor, + scale: _float, + zero_point: _int, + dtype: _dtype, +) -> Tensor: + r""" + quantize_per_tensor(input, scale, zero_point, dtype) -> Tensor + + Converts a float tensor to a quantized tensor with given scale and zero point. + + Arguments: + input (Tensor): float tensor or list of tensors to quantize + scale (float or Tensor): scale to apply in quantization formula + zero_point (int or Tensor): offset in integer value that maps to float zero + dtype (:class:`torch.dtype`): the desired data type of returned tensor. + Has to be one of the quantized dtypes: ``torch.quint8``, ``torch.qint8``, ``torch.qint32`` + + Returns: + Tensor: A newly quantized tensor or list of quantized tensors. + + Example:: + + >>> torch.quantize_per_tensor(torch.tensor([-1.0, 0.0, 1.0, 2.0]), 0.1, 10, torch.quint8) + tensor([-1., 0., 1., 2.], size=(4,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.1, zero_point=10) + >>> torch.quantize_per_tensor(torch.tensor([-1.0, 0.0, 1.0, 2.0]), 0.1, 10, torch.quint8).int_repr() + tensor([ 0, 10, 20, 30], dtype=torch.uint8) + >>> torch.quantize_per_tensor([torch.tensor([-1.0, 0.0]), torch.tensor([-2.0, 2.0])], + >>> torch.tensor([0.1, 0.2]), torch.tensor([10, 20]), torch.quint8) + (tensor([-1., 0.], size=(2,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.1, zero_point=10), + tensor([-2., 2.], size=(2,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.2, zero_point=20)) + >>> torch.quantize_per_tensor(torch.tensor([-1.0, 0.0, 1.0, 2.0]), torch.tensor(0.1), torch.tensor(10), torch.quint8) + tensor([-1., 0., 1., 2.], size=(4,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.10, zero_point=10) + """ + +@overload +def quantize_per_tensor( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + scales: Tensor, + zero_points: Tensor, + dtype: _dtype, +) -> tuple[Tensor, ...]: + r""" + quantize_per_tensor(input, scale, zero_point, dtype) -> Tensor + + Converts a float tensor to a quantized tensor with given scale and zero point. + + Arguments: + input (Tensor): float tensor or list of tensors to quantize + scale (float or Tensor): scale to apply in quantization formula + zero_point (int or Tensor): offset in integer value that maps to float zero + dtype (:class:`torch.dtype`): the desired data type of returned tensor. + Has to be one of the quantized dtypes: ``torch.quint8``, ``torch.qint8``, ``torch.qint32`` + + Returns: + Tensor: A newly quantized tensor or list of quantized tensors. + + Example:: + + >>> torch.quantize_per_tensor(torch.tensor([-1.0, 0.0, 1.0, 2.0]), 0.1, 10, torch.quint8) + tensor([-1., 0., 1., 2.], size=(4,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.1, zero_point=10) + >>> torch.quantize_per_tensor(torch.tensor([-1.0, 0.0, 1.0, 2.0]), 0.1, 10, torch.quint8).int_repr() + tensor([ 0, 10, 20, 30], dtype=torch.uint8) + >>> torch.quantize_per_tensor([torch.tensor([-1.0, 0.0]), torch.tensor([-2.0, 2.0])], + >>> torch.tensor([0.1, 0.2]), torch.tensor([10, 20]), torch.quint8) + (tensor([-1., 0.], size=(2,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.1, zero_point=10), + tensor([-2., 2.], size=(2,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.2, zero_point=20)) + >>> torch.quantize_per_tensor(torch.tensor([-1.0, 0.0, 1.0, 2.0]), torch.tensor(0.1), torch.tensor(10), torch.quint8) + tensor([-1., 0., 1., 2.], size=(4,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.10, zero_point=10) + """ + +def quantize_per_tensor_dynamic( + input: Tensor, + dtype: _dtype, + reduce_range: _bool, +) -> Tensor: + r""" + quantize_per_tensor_dynamic(input, dtype, reduce_range) -> Tensor + + Converts a float tensor to a quantized tensor with scale and zero_point calculated + dynamically based on the input. + + Arguments: + input (Tensor): float tensor or list of tensors to quantize + dtype (:class:`torch.dtype`): the desired data type of returned tensor. + Has to be one of the quantized dtypes: ``torch.quint8``, ``torch.qint8`` + reduce_range (bool): a flag to indicate whether to reduce the range of quantized + data by 1 bit, it's required to avoid instruction overflow for some hardwares + + Returns: + Tensor: A newly (dynamically) quantized tensor + + Example:: + + >>> t = torch.quantize_per_tensor_dynamic(torch.tensor([-1.0, 0.0, 1.0, 2.0]), torch.quint8, False) + >>> print(t) + tensor([-1., 0., 1., 2.], size=(4,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.011764705882352941, + zero_point=85) + >>> t.int_repr() + tensor([ 0, 85, 170, 255], dtype=torch.uint8) + """ + +def quantized_batch_norm( + input: Tensor, + weight: Tensor | None, + bias: Tensor | None, + mean: Tensor, + var: Tensor, + eps: _float, + output_scale: _float, + output_zero_point: _int, +) -> Tensor: + r""" + quantized_batch_norm(input, weight=None, bias=None, mean, var, eps, output_scale, output_zero_point) -> Tensor + + Applies batch normalization on a 4D (NCHW) quantized tensor. + + .. math:: + + y = \frac{x - \mathrm{E}[x]}{\sqrt{\mathrm{Var}[x] + \epsilon}} * \gamma + \beta + + Arguments: + input (Tensor): quantized tensor + weight (Tensor): float tensor that corresponds to the gamma, size C + bias (Tensor): float tensor that corresponds to the beta, size C + mean (Tensor): float mean value in batch normalization, size C + var (Tensor): float tensor for variance, size C + eps (float): a value added to the denominator for numerical stability. + output_scale (float): output quantized tensor scale + output_zero_point (int): output quantized tensor zero_point + + Returns: + Tensor: A quantized tensor with batch normalization applied. + + Example:: + + >>> qx = torch.quantize_per_tensor(torch.rand(2, 2, 2, 2), 1.5, 3, torch.quint8) + >>> torch.quantized_batch_norm(qx, torch.ones(2), torch.zeros(2), torch.rand(2), torch.rand(2), 0.00001, 0.2, 2) + tensor([[[[-0.2000, -0.2000], + [ 1.6000, -0.2000]], + + [[-0.4000, -0.4000], + [-0.4000, 0.6000]]], + + + [[[-0.2000, -0.2000], + [-0.2000, -0.2000]], + + [[ 0.6000, -0.4000], + [ 0.6000, -0.4000]]]], size=(2, 2, 2, 2), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.2, zero_point=2) + """ + +def quantized_gru_cell( + input: Tensor, + hx: Tensor, + w_ih: Tensor, + w_hh: Tensor, + b_ih: Tensor, + b_hh: Tensor, + packed_ih: Tensor, + packed_hh: Tensor, + col_offsets_ih: Tensor, + col_offsets_hh: Tensor, + scale_ih: Number | _complex, + scale_hh: Number | _complex, + zero_point_ih: Number | _complex, + zero_point_hh: Number | _complex, +) -> Tensor: ... +def quantized_lstm_cell( + input: Tensor, + hx: tuple[Tensor, ...] | list[Tensor] | None, + w_ih: Tensor, + w_hh: Tensor, + b_ih: Tensor, + b_hh: Tensor, + packed_ih: Tensor, + packed_hh: Tensor, + col_offsets_ih: Tensor, + col_offsets_hh: Tensor, + scale_ih: Number | _complex, + scale_hh: Number | _complex, + zero_point_ih: Number | _complex, + zero_point_hh: Number | _complex, +) -> tuple[Tensor, Tensor]: ... +def quantized_max_pool1d( + input: Tensor, + kernel_size: _int | _size, + stride: _int | _size = (), + padding: _int | _size = 0, + dilation: _int | _size = 1, + ceil_mode: _bool = False, +) -> Tensor: + r""" + quantized_max_pool1d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False) -> Tensor + + Applies a 1D max pooling over an input quantized tensor composed of several input planes. + + Arguments: + input (Tensor): quantized tensor + kernel_size (list of int): the size of the sliding window + stride (``list of int``, optional): the stride of the sliding window + padding (``list of int``, optional): padding to be added on both sides, must be >= 0 and <= kernel_size / 2 + dilation (``list of int``, optional): The stride between elements within a sliding window, must be > 0. Default 1 + ceil_mode (bool, optional): If True, will use ceil instead of floor to compute the output shape. + Defaults to False. + + + Returns: + Tensor: A quantized tensor with max_pool1d applied. + + Example:: + + >>> qx = torch.quantize_per_tensor(torch.rand(2, 2), 1.5, 3, torch.quint8) + >>> torch.quantized_max_pool1d(qx, [2]) + tensor([[0.0000], + [1.5000]], size=(2, 1), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=1.5, zero_point=3) + """ + +def quantized_max_pool2d( + input: Tensor, + kernel_size: _int | _size, + stride: _int | _size = (), + padding: _int | _size = 0, + dilation: _int | _size = 1, + ceil_mode: _bool = False, +) -> Tensor: + r""" + quantized_max_pool2d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False) -> Tensor + + Applies a 2D max pooling over an input quantized tensor composed of several input planes. + + Arguments: + input (Tensor): quantized tensor + kernel_size (``list of int``): the size of the sliding window + stride (``list of int``, optional): the stride of the sliding window + padding (``list of int``, optional): padding to be added on both sides, must be >= 0 and <= kernel_size / 2 + dilation (``list of int``, optional): The stride between elements within a sliding window, must be > 0. Default 1 + ceil_mode (bool, optional): If True, will use ceil instead of floor to compute the output shape. + Defaults to False. + + + Returns: + Tensor: A quantized tensor with max_pool2d applied. + + Example:: + + >>> qx = torch.quantize_per_tensor(torch.rand(2, 2, 2, 2), 1.5, 3, torch.quint8) + >>> torch.quantized_max_pool2d(qx, [2,2]) + tensor([[[[1.5000]], + + [[1.5000]]], + + + [[[0.0000]], + + [[0.0000]]]], size=(2, 2, 1, 1), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=1.5, zero_point=3) + """ + +def quantized_max_pool3d( + input: Tensor, + kernel_size: _int | _size, + stride: _int | _size = (), + padding: _int | _size = 0, + dilation: _int | _size = 1, + ceil_mode: _bool = False, +) -> Tensor: ... +def quantized_rnn_relu_cell( + input: Tensor, + hx: Tensor, + w_ih: Tensor, + w_hh: Tensor, + b_ih: Tensor, + b_hh: Tensor, + packed_ih: Tensor, + packed_hh: Tensor, + col_offsets_ih: Tensor, + col_offsets_hh: Tensor, + scale_ih: Number | _complex, + scale_hh: Number | _complex, + zero_point_ih: Number | _complex, + zero_point_hh: Number | _complex, +) -> Tensor: ... +def quantized_rnn_tanh_cell( + input: Tensor, + hx: Tensor, + w_ih: Tensor, + w_hh: Tensor, + b_ih: Tensor, + b_hh: Tensor, + packed_ih: Tensor, + packed_hh: Tensor, + col_offsets_ih: Tensor, + col_offsets_hh: Tensor, + scale_ih: Number | _complex, + scale_hh: Number | _complex, + zero_point_ih: Number | _complex, + zero_point_hh: Number | _complex, +) -> Tensor: ... +def rad2deg(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + rad2deg(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Returns a new tensor with each of the elements of :attr:`input` + converted from angles in radians to degrees. + + Args: + input (Tensor): the input tensor. + + Keyword arguments: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([[3.142, -3.142], [6.283, -6.283], [1.570, -1.570]]) + >>> torch.rad2deg(a) + tensor([[ 180.0233, -180.0233], + [ 359.9894, -359.9894], + [ 89.9544, -89.9544]]) + """ + +def rad2deg_(input: Tensor) -> Tensor: ... +@overload +def rand( + size: Sequence[_int | SymInt], + *, + generator: Generator | None, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + rand(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Returns a tensor filled with random numbers from a uniform distribution + on the interval :math:`[0, 1)` + + The shape of the tensor is defined by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.rand(4) + tensor([ 0.5204, 0.2503, 0.3525, 0.5673]) + >>> torch.rand(2, 3) + tensor([[ 0.8237, 0.5781, 0.6879], + [ 0.3816, 0.7249, 0.0998]]) + """ + +@overload +def rand( + *size: _int | SymInt, + generator: Generator | None, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + rand(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Returns a tensor filled with random numbers from a uniform distribution + on the interval :math:`[0, 1)` + + The shape of the tensor is defined by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.rand(4) + tensor([ 0.5204, 0.2503, 0.3525, 0.5673]) + >>> torch.rand(2, 3) + tensor([[ 0.8237, 0.5781, 0.6879], + [ 0.3816, 0.7249, 0.0998]]) + """ + +@overload +def rand( + size: Sequence[_int | SymInt], + *, + generator: Generator | None, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + rand(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Returns a tensor filled with random numbers from a uniform distribution + on the interval :math:`[0, 1)` + + The shape of the tensor is defined by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.rand(4) + tensor([ 0.5204, 0.2503, 0.3525, 0.5673]) + >>> torch.rand(2, 3) + tensor([[ 0.8237, 0.5781, 0.6879], + [ 0.3816, 0.7249, 0.0998]]) + """ + +@overload +def rand( + *size: _int | SymInt, + generator: Generator | None, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + rand(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Returns a tensor filled with random numbers from a uniform distribution + on the interval :math:`[0, 1)` + + The shape of the tensor is defined by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.rand(4) + tensor([ 0.5204, 0.2503, 0.3525, 0.5673]) + >>> torch.rand(2, 3) + tensor([[ 0.8237, 0.5781, 0.6879], + [ 0.3816, 0.7249, 0.0998]]) + """ + +@overload +def rand( + size: Sequence[_int | SymInt], + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + rand(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Returns a tensor filled with random numbers from a uniform distribution + on the interval :math:`[0, 1)` + + The shape of the tensor is defined by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.rand(4) + tensor([ 0.5204, 0.2503, 0.3525, 0.5673]) + >>> torch.rand(2, 3) + tensor([[ 0.8237, 0.5781, 0.6879], + [ 0.3816, 0.7249, 0.0998]]) + """ + +@overload +def rand( + *size: _int | SymInt, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + rand(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Returns a tensor filled with random numbers from a uniform distribution + on the interval :math:`[0, 1)` + + The shape of the tensor is defined by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.rand(4) + tensor([ 0.5204, 0.2503, 0.3525, 0.5673]) + >>> torch.rand(2, 3) + tensor([[ 0.8237, 0.5781, 0.6879], + [ 0.3816, 0.7249, 0.0998]]) + """ + +@overload +def rand( + size: Sequence[_int | SymInt], + *, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + rand(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Returns a tensor filled with random numbers from a uniform distribution + on the interval :math:`[0, 1)` + + The shape of the tensor is defined by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.rand(4) + tensor([ 0.5204, 0.2503, 0.3525, 0.5673]) + >>> torch.rand(2, 3) + tensor([[ 0.8237, 0.5781, 0.6879], + [ 0.3816, 0.7249, 0.0998]]) + """ + +@overload +def rand( + *size: _int | SymInt, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + rand(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Returns a tensor filled with random numbers from a uniform distribution + on the interval :math:`[0, 1)` + + The shape of the tensor is defined by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.rand(4) + tensor([ 0.5204, 0.2503, 0.3525, 0.5673]) + >>> torch.rand(2, 3) + tensor([[ 0.8237, 0.5781, 0.6879], + [ 0.3816, 0.7249, 0.0998]]) + """ + +@overload +def rand_like( + input: Tensor, + *, + generator: Generator | None, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + rand_like(input, *, generator=None, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor with the same size as :attr:`input` that is filled with + random numbers from a uniform distribution on the interval :math:`[0, 1)`. + ``torch.rand_like(input)`` is equivalent to + ``torch.rand(input.size(), dtype=input.dtype, layout=input.layout, device=input.device)``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling. + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + """ + +@overload +def rand_like( + input: Tensor, + *, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + rand_like(input, *, generator=None, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor with the same size as :attr:`input` that is filled with + random numbers from a uniform distribution on the interval :math:`[0, 1)`. + ``torch.rand_like(input)`` is equivalent to + ``torch.rand(input.size(), dtype=input.dtype, layout=input.layout, device=input.device)``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling. + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + """ + +@overload +def randint( + low: _int, + high: _int, + size: _size, + *, + generator: Generator | None = None, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + pin_memory: _bool = False, +) -> Tensor: + r""" + randint(low=0, high, size, \*, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with random integers generated uniformly + between :attr:`low` (inclusive) and :attr:`high` (exclusive). + + The shape of the tensor is defined by the variable argument :attr:`size`. + + .. note:: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + + Args: + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + size (tuple): a tuple defining the shape of the output tensor. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the desired data type of returned tensor. Default: if ``None``, + this function returns a tensor with dtype ``torch.int64``. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.randint(3, 5, (3,)) + tensor([4, 3, 4]) + + + >>> torch.randint(10, (2, 2)) + tensor([[0, 2], + [5, 5]]) + + + >>> torch.randint(3, 10, (2, 2)) + tensor([[4, 5], + [6, 7]]) + """ + +@overload +def randint( + high: _int, + size: _size, + *, + generator: Generator | None = None, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + pin_memory: _bool = False, +) -> Tensor: + r""" + randint(low=0, high, size, \*, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with random integers generated uniformly + between :attr:`low` (inclusive) and :attr:`high` (exclusive). + + The shape of the tensor is defined by the variable argument :attr:`size`. + + .. note:: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + + Args: + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + size (tuple): a tuple defining the shape of the output tensor. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the desired data type of returned tensor. Default: if ``None``, + this function returns a tensor with dtype ``torch.int64``. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.randint(3, 5, (3,)) + tensor([4, 3, 4]) + + + >>> torch.randint(10, (2, 2)) + tensor([[0, 2], + [5, 5]]) + + + >>> torch.randint(3, 10, (2, 2)) + tensor([[4, 5], + [6, 7]]) + """ + +@overload +def randint( + high: _int | SymInt, + size: Sequence[_int | SymInt], + *, + generator: Generator | None, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randint(low=0, high, size, \*, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with random integers generated uniformly + between :attr:`low` (inclusive) and :attr:`high` (exclusive). + + The shape of the tensor is defined by the variable argument :attr:`size`. + + .. note:: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + + Args: + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + size (tuple): a tuple defining the shape of the output tensor. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the desired data type of returned tensor. Default: if ``None``, + this function returns a tensor with dtype ``torch.int64``. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.randint(3, 5, (3,)) + tensor([4, 3, 4]) + + + >>> torch.randint(10, (2, 2)) + tensor([[0, 2], + [5, 5]]) + + + >>> torch.randint(3, 10, (2, 2)) + tensor([[4, 5], + [6, 7]]) + """ + +@overload +def randint( + high: _int | SymInt, + size: Sequence[_int | SymInt], + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randint(low=0, high, size, \*, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with random integers generated uniformly + between :attr:`low` (inclusive) and :attr:`high` (exclusive). + + The shape of the tensor is defined by the variable argument :attr:`size`. + + .. note:: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + + Args: + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + size (tuple): a tuple defining the shape of the output tensor. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the desired data type of returned tensor. Default: if ``None``, + this function returns a tensor with dtype ``torch.int64``. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.randint(3, 5, (3,)) + tensor([4, 3, 4]) + + + >>> torch.randint(10, (2, 2)) + tensor([[0, 2], + [5, 5]]) + + + >>> torch.randint(3, 10, (2, 2)) + tensor([[4, 5], + [6, 7]]) + """ + +@overload +def randint( + low: _int | SymInt, + high: _int | SymInt, + size: Sequence[_int | SymInt], + *, + generator: Generator | None, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randint(low=0, high, size, \*, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with random integers generated uniformly + between :attr:`low` (inclusive) and :attr:`high` (exclusive). + + The shape of the tensor is defined by the variable argument :attr:`size`. + + .. note:: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + + Args: + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + size (tuple): a tuple defining the shape of the output tensor. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the desired data type of returned tensor. Default: if ``None``, + this function returns a tensor with dtype ``torch.int64``. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.randint(3, 5, (3,)) + tensor([4, 3, 4]) + + + >>> torch.randint(10, (2, 2)) + tensor([[0, 2], + [5, 5]]) + + + >>> torch.randint(3, 10, (2, 2)) + tensor([[4, 5], + [6, 7]]) + """ + +@overload +def randint( + low: _int | SymInt, + high: _int | SymInt, + size: Sequence[_int | SymInt], + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randint(low=0, high, size, \*, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with random integers generated uniformly + between :attr:`low` (inclusive) and :attr:`high` (exclusive). + + The shape of the tensor is defined by the variable argument :attr:`size`. + + .. note:: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + + Args: + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + size (tuple): a tuple defining the shape of the output tensor. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (torch.dtype, optional): the desired data type of returned tensor. Default: if ``None``, + this function returns a tensor with dtype ``torch.int64``. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.randint(3, 5, (3,)) + tensor([4, 3, 4]) + + + >>> torch.randint(10, (2, 2)) + tensor([[0, 2], + [5, 5]]) + + + >>> torch.randint(3, 10, (2, 2)) + tensor([[4, 5], + [6, 7]]) + """ + +@overload +def randint_like( + input: Tensor, + low: _int | SymInt, + high: _int | SymInt, + *, + generator: Generator | None, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randint_like(input, low=0, high, \*, generator=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor with the same shape as Tensor :attr:`input` filled with + random integers generated uniformly between :attr:`low` (inclusive) and + :attr:`high` (exclusive). + + .. note: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling. + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + """ + +@overload +def randint_like( + input: Tensor, + low: _int | SymInt, + high: _int | SymInt, + *, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randint_like(input, low=0, high, \*, generator=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor with the same shape as Tensor :attr:`input` filled with + random integers generated uniformly between :attr:`low` (inclusive) and + :attr:`high` (exclusive). + + .. note: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling. + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + """ + +@overload +def randint_like( + input: Tensor, + high: Tensor, + *, + generator: Generator | None, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randint_like(input, low=0, high, \*, generator=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor with the same shape as Tensor :attr:`input` filled with + random integers generated uniformly between :attr:`low` (inclusive) and + :attr:`high` (exclusive). + + .. note: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling. + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + """ + +@overload +def randint_like( + input: Tensor, + high: Tensor, + *, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randint_like(input, low=0, high, \*, generator=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor with the same shape as Tensor :attr:`input` filled with + random integers generated uniformly between :attr:`low` (inclusive) and + :attr:`high` (exclusive). + + .. note: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling. + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + """ + +@overload +def randint_like( + input: Tensor, + high: _int | SymInt, + *, + generator: Generator | None, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randint_like(input, low=0, high, \*, generator=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor with the same shape as Tensor :attr:`input` filled with + random integers generated uniformly between :attr:`low` (inclusive) and + :attr:`high` (exclusive). + + .. note: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling. + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + """ + +@overload +def randint_like( + input: Tensor, + high: _int | SymInt, + *, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randint_like(input, low=0, high, \*, generator=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor with the same shape as Tensor :attr:`input` filled with + random integers generated uniformly between :attr:`low` (inclusive) and + :attr:`high` (exclusive). + + .. note: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling. + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + """ + +@overload +def randn( + size: Sequence[_int | SymInt], + *, + generator: Generator | None, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randn(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + + Returns a tensor filled with random numbers from a normal distribution + with mean `0` and variance `1` (also called the standard normal + distribution). + + .. math:: + \text{out}_{i} \sim \mathcal{N}(0, 1) + + For complex dtypes, the tensor is i.i.d. sampled from a `complex normal distribution`_ with zero mean and + unit variance as + + .. math:: + \text{out}_{i} \sim \mathcal{CN}(0, 1) + + This is equivalent to separately sampling the real :math:`(\operatorname{Re})` and imaginary + :math:`(\operatorname{Im})` part of :math:`\text{out}_i` as + + .. math:: + \operatorname{Re}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}),\quad + \operatorname{Im}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}) + + The shape of the tensor is defined by the variable argument :attr:`size`. + + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.randn(4) + tensor([-2.1436, 0.9966, 2.3426, -0.6366]) + >>> torch.randn(2, 3) + tensor([[ 1.5954, 2.8929, -1.0923], + [ 1.1719, -0.4709, -0.1996]]) + + .. _complex normal distribution: https://en.wikipedia.org/wiki/Complex_normal_distribution + """ + +@overload +def randn( + *size: _int | SymInt, + generator: Generator | None, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randn(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + + Returns a tensor filled with random numbers from a normal distribution + with mean `0` and variance `1` (also called the standard normal + distribution). + + .. math:: + \text{out}_{i} \sim \mathcal{N}(0, 1) + + For complex dtypes, the tensor is i.i.d. sampled from a `complex normal distribution`_ with zero mean and + unit variance as + + .. math:: + \text{out}_{i} \sim \mathcal{CN}(0, 1) + + This is equivalent to separately sampling the real :math:`(\operatorname{Re})` and imaginary + :math:`(\operatorname{Im})` part of :math:`\text{out}_i` as + + .. math:: + \operatorname{Re}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}),\quad + \operatorname{Im}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}) + + The shape of the tensor is defined by the variable argument :attr:`size`. + + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.randn(4) + tensor([-2.1436, 0.9966, 2.3426, -0.6366]) + >>> torch.randn(2, 3) + tensor([[ 1.5954, 2.8929, -1.0923], + [ 1.1719, -0.4709, -0.1996]]) + + .. _complex normal distribution: https://en.wikipedia.org/wiki/Complex_normal_distribution + """ + +@overload +def randn( + size: Sequence[_int | SymInt], + *, + generator: Generator | None, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randn(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + + Returns a tensor filled with random numbers from a normal distribution + with mean `0` and variance `1` (also called the standard normal + distribution). + + .. math:: + \text{out}_{i} \sim \mathcal{N}(0, 1) + + For complex dtypes, the tensor is i.i.d. sampled from a `complex normal distribution`_ with zero mean and + unit variance as + + .. math:: + \text{out}_{i} \sim \mathcal{CN}(0, 1) + + This is equivalent to separately sampling the real :math:`(\operatorname{Re})` and imaginary + :math:`(\operatorname{Im})` part of :math:`\text{out}_i` as + + .. math:: + \operatorname{Re}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}),\quad + \operatorname{Im}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}) + + The shape of the tensor is defined by the variable argument :attr:`size`. + + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.randn(4) + tensor([-2.1436, 0.9966, 2.3426, -0.6366]) + >>> torch.randn(2, 3) + tensor([[ 1.5954, 2.8929, -1.0923], + [ 1.1719, -0.4709, -0.1996]]) + + .. _complex normal distribution: https://en.wikipedia.org/wiki/Complex_normal_distribution + """ + +@overload +def randn( + *size: _int | SymInt, + generator: Generator | None, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randn(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + + Returns a tensor filled with random numbers from a normal distribution + with mean `0` and variance `1` (also called the standard normal + distribution). + + .. math:: + \text{out}_{i} \sim \mathcal{N}(0, 1) + + For complex dtypes, the tensor is i.i.d. sampled from a `complex normal distribution`_ with zero mean and + unit variance as + + .. math:: + \text{out}_{i} \sim \mathcal{CN}(0, 1) + + This is equivalent to separately sampling the real :math:`(\operatorname{Re})` and imaginary + :math:`(\operatorname{Im})` part of :math:`\text{out}_i` as + + .. math:: + \operatorname{Re}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}),\quad + \operatorname{Im}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}) + + The shape of the tensor is defined by the variable argument :attr:`size`. + + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.randn(4) + tensor([-2.1436, 0.9966, 2.3426, -0.6366]) + >>> torch.randn(2, 3) + tensor([[ 1.5954, 2.8929, -1.0923], + [ 1.1719, -0.4709, -0.1996]]) + + .. _complex normal distribution: https://en.wikipedia.org/wiki/Complex_normal_distribution + """ + +@overload +def randn( + size: Sequence[_int | SymInt], + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randn(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + + Returns a tensor filled with random numbers from a normal distribution + with mean `0` and variance `1` (also called the standard normal + distribution). + + .. math:: + \text{out}_{i} \sim \mathcal{N}(0, 1) + + For complex dtypes, the tensor is i.i.d. sampled from a `complex normal distribution`_ with zero mean and + unit variance as + + .. math:: + \text{out}_{i} \sim \mathcal{CN}(0, 1) + + This is equivalent to separately sampling the real :math:`(\operatorname{Re})` and imaginary + :math:`(\operatorname{Im})` part of :math:`\text{out}_i` as + + .. math:: + \operatorname{Re}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}),\quad + \operatorname{Im}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}) + + The shape of the tensor is defined by the variable argument :attr:`size`. + + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.randn(4) + tensor([-2.1436, 0.9966, 2.3426, -0.6366]) + >>> torch.randn(2, 3) + tensor([[ 1.5954, 2.8929, -1.0923], + [ 1.1719, -0.4709, -0.1996]]) + + .. _complex normal distribution: https://en.wikipedia.org/wiki/Complex_normal_distribution + """ + +@overload +def randn( + *size: _int | SymInt, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randn(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + + Returns a tensor filled with random numbers from a normal distribution + with mean `0` and variance `1` (also called the standard normal + distribution). + + .. math:: + \text{out}_{i} \sim \mathcal{N}(0, 1) + + For complex dtypes, the tensor is i.i.d. sampled from a `complex normal distribution`_ with zero mean and + unit variance as + + .. math:: + \text{out}_{i} \sim \mathcal{CN}(0, 1) + + This is equivalent to separately sampling the real :math:`(\operatorname{Re})` and imaginary + :math:`(\operatorname{Im})` part of :math:`\text{out}_i` as + + .. math:: + \operatorname{Re}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}),\quad + \operatorname{Im}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}) + + The shape of the tensor is defined by the variable argument :attr:`size`. + + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.randn(4) + tensor([-2.1436, 0.9966, 2.3426, -0.6366]) + >>> torch.randn(2, 3) + tensor([[ 1.5954, 2.8929, -1.0923], + [ 1.1719, -0.4709, -0.1996]]) + + .. _complex normal distribution: https://en.wikipedia.org/wiki/Complex_normal_distribution + """ + +@overload +def randn( + size: Sequence[_int | SymInt], + *, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randn(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + + Returns a tensor filled with random numbers from a normal distribution + with mean `0` and variance `1` (also called the standard normal + distribution). + + .. math:: + \text{out}_{i} \sim \mathcal{N}(0, 1) + + For complex dtypes, the tensor is i.i.d. sampled from a `complex normal distribution`_ with zero mean and + unit variance as + + .. math:: + \text{out}_{i} \sim \mathcal{CN}(0, 1) + + This is equivalent to separately sampling the real :math:`(\operatorname{Re})` and imaginary + :math:`(\operatorname{Im})` part of :math:`\text{out}_i` as + + .. math:: + \operatorname{Re}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}),\quad + \operatorname{Im}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}) + + The shape of the tensor is defined by the variable argument :attr:`size`. + + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.randn(4) + tensor([-2.1436, 0.9966, 2.3426, -0.6366]) + >>> torch.randn(2, 3) + tensor([[ 1.5954, 2.8929, -1.0923], + [ 1.1719, -0.4709, -0.1996]]) + + .. _complex normal distribution: https://en.wikipedia.org/wiki/Complex_normal_distribution + """ + +@overload +def randn( + *size: _int | SymInt, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randn(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + + Returns a tensor filled with random numbers from a normal distribution + with mean `0` and variance `1` (also called the standard normal + distribution). + + .. math:: + \text{out}_{i} \sim \mathcal{N}(0, 1) + + For complex dtypes, the tensor is i.i.d. sampled from a `complex normal distribution`_ with zero mean and + unit variance as + + .. math:: + \text{out}_{i} \sim \mathcal{CN}(0, 1) + + This is equivalent to separately sampling the real :math:`(\operatorname{Re})` and imaginary + :math:`(\operatorname{Im})` part of :math:`\text{out}_i` as + + .. math:: + \operatorname{Re}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}),\quad + \operatorname{Im}(\text{out}_{i}) \sim \mathcal{N}(0, \frac{1}{2}) + + The shape of the tensor is defined by the variable argument :attr:`size`. + + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.randn(4) + tensor([-2.1436, 0.9966, 2.3426, -0.6366]) + >>> torch.randn(2, 3) + tensor([[ 1.5954, 2.8929, -1.0923], + [ 1.1719, -0.4709, -0.1996]]) + + .. _complex normal distribution: https://en.wikipedia.org/wiki/Complex_normal_distribution + """ + +@overload +def randn_like( + input: Tensor, + *, + generator: Generator | None, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randn_like(input, *, generator=None, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor with the same size as :attr:`input` that is filled with + random numbers from a normal distribution with mean 0 and variance 1. Please refer to :func:`torch.randn` for the + sampling process of complex dtypes. ``torch.randn_like(input)`` is equivalent to + ``torch.randn(input.size(), dtype=input.dtype, layout=input.layout, device=input.device)``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling. + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + """ + +@overload +def randn_like( + input: Tensor, + *, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randn_like(input, *, generator=None, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor with the same size as :attr:`input` that is filled with + random numbers from a normal distribution with mean 0 and variance 1. Please refer to :func:`torch.randn` for the + sampling process of complex dtypes. ``torch.randn_like(input)`` is equivalent to + ``torch.randn(input.size(), dtype=input.dtype, layout=input.layout, device=input.device)``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling. + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + """ + +@overload +def randperm( + n: _int | SymInt, + *, + generator: Generator | None, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randperm(n, *, generator=None, out=None, dtype=torch.int64,layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Returns a random permutation of integers from ``0`` to ``n - 1``. + + Args: + n (int): the upper bound (exclusive) + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: ``torch.int64``. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.randperm(4) + tensor([2, 1, 0, 3]) + """ + +@overload +def randperm( + n: _int | SymInt, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + randperm(n, *, generator=None, out=None, dtype=torch.int64,layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Returns a random permutation of integers from ``0`` to ``n - 1``. + + Args: + n (int): the upper bound (exclusive) + + Keyword args: + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: ``torch.int64``. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + Example:: + + >>> torch.randperm(4) + tensor([2, 1, 0, 3]) + """ + +def range( + start: Number, + end: Number, + step: Number = 1, + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + pin_memory: _bool = False, +) -> Tensor: + r""" + range(start=0, end, step=1, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a 1-D tensor of size :math:`\left\lfloor \frac{\text{end} - \text{start}}{\text{step}} \right\rfloor + 1` + with values from :attr:`start` to :attr:`end` with step :attr:`step`. Step is + the gap between two values in the tensor. + + .. math:: + \text{out}_{i+1} = \text{out}_i + \text{step}. + + .. warning:: + This function is deprecated and will be removed in a future release because its behavior is inconsistent with + Python's range builtin. Instead, use :func:`torch.arange`, which produces values in [start, end). + + Args: + start (float, optional): the starting value for the set of points. Default: ``0``. + end (float): the ending value for the set of points + step (float, optional): the gap between each pair of adjacent points. Default: ``1``. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). If `dtype` is not given, infer the data type from the other input + arguments. If any of `start`, `end`, or `step` are floating-point, the + `dtype` is inferred to be the default dtype, see + :meth:`~torch.get_default_dtype`. Otherwise, the `dtype` is inferred to + be `torch.int64`. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.range(1, 4) + tensor([ 1., 2., 3., 4.]) + >>> torch.range(1, 4, 0.5) + tensor([ 1.0000, 1.5000, 2.0000, 2.5000, 3.0000, 3.5000, 4.0000]) + """ + +def ravel(input: Tensor) -> Tensor: + r""" + ravel(input) -> Tensor + + Return a contiguous flattened tensor. A copy is made only if needed. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> t = torch.tensor([[[1, 2], + ... [3, 4]], + ... [[5, 6], + ... [7, 8]]]) + >>> torch.ravel(t) + tensor([1, 2, 3, 4, 5, 6, 7, 8]) + """ + +def real(input: Tensor) -> Tensor: + r""" + real(input) -> Tensor + + Returns a new tensor containing real values of the :attr:`self` tensor. + The returned tensor and :attr:`self` share the same underlying storage. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> x=torch.randn(4, dtype=torch.cfloat) + >>> x + tensor([(0.3100+0.3553j), (-0.5445-0.7896j), (-1.6492-0.0633j), (-0.0638-0.8119j)]) + >>> x.real + tensor([ 0.3100, -0.5445, -1.6492, -0.0638]) + """ + +def reciprocal(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + reciprocal(input, *, out=None) -> Tensor + + Returns a new tensor with the reciprocal of the elements of :attr:`input` + + .. math:: + \text{out}_{i} = \frac{1}{\text{input}_{i}} + + .. note:: + Unlike NumPy's reciprocal, torch.reciprocal supports integral inputs. Integral + inputs to reciprocal are automatically :ref:`promoted ` to + the default scalar type. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-0.4595, -2.1219, -1.4314, 0.7298]) + >>> torch.reciprocal(a) + tensor([-2.1763, -0.4713, -0.6986, 1.3702]) + """ + +def reciprocal_(input: Tensor) -> Tensor: ... +def relu(input: Tensor) -> Tensor: ... +def relu_(input: Tensor) -> Tensor: ... +@overload +def remainder( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + remainder(input, other, *, out=None) -> Tensor + + Computes + `Python's modulus operation `_ + entrywise. The result has the same sign as the divisor :attr:`other` and its absolute value + is less than that of :attr:`other`. + + It may also be defined in terms of :func:`torch.div` as + + .. code:: python + + torch.remainder(a, b) == a - a.div(b, rounding_mode="floor") * b + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer and float inputs. + + .. note:: + Complex inputs are not supported. In some cases, it is not mathematically + possible to satisfy the definition of a modulo operation with complex numbers. + See :func:`torch.fmod` for how division by zero is handled. + + .. seealso:: + + :func:`torch.fmod` which implements C++'s `std::fmod `_. + This one is defined in terms of division rounding towards zero. + + Args: + input (Tensor or Scalar): the dividend + other (Tensor or Scalar): the divisor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.remainder(torch.tensor([-3., -2, -1, 1, 2, 3]), 2) + tensor([ 1., 0., 1., 1., 0., 1.]) + >>> torch.remainder(torch.tensor([1, 2, 3, 4, 5]), -1.5) + tensor([ -0.5000, -1.0000, 0.0000, -0.5000, -1.0000 ]) + """ + +@overload +def remainder(self: Number | _complex, other: Tensor) -> Tensor: + r""" + remainder(input, other, *, out=None) -> Tensor + + Computes + `Python's modulus operation `_ + entrywise. The result has the same sign as the divisor :attr:`other` and its absolute value + is less than that of :attr:`other`. + + It may also be defined in terms of :func:`torch.div` as + + .. code:: python + + torch.remainder(a, b) == a - a.div(b, rounding_mode="floor") * b + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer and float inputs. + + .. note:: + Complex inputs are not supported. In some cases, it is not mathematically + possible to satisfy the definition of a modulo operation with complex numbers. + See :func:`torch.fmod` for how division by zero is handled. + + .. seealso:: + + :func:`torch.fmod` which implements C++'s `std::fmod `_. + This one is defined in terms of division rounding towards zero. + + Args: + input (Tensor or Scalar): the dividend + other (Tensor or Scalar): the divisor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.remainder(torch.tensor([-3., -2, -1, 1, 2, 3]), 2) + tensor([ 1., 0., 1., 1., 0., 1.]) + >>> torch.remainder(torch.tensor([1, 2, 3, 4, 5]), -1.5) + tensor([ -0.5000, -1.0000, 0.0000, -0.5000, -1.0000 ]) + """ + +@overload +def remainder( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + remainder(input, other, *, out=None) -> Tensor + + Computes + `Python's modulus operation `_ + entrywise. The result has the same sign as the divisor :attr:`other` and its absolute value + is less than that of :attr:`other`. + + It may also be defined in terms of :func:`torch.div` as + + .. code:: python + + torch.remainder(a, b) == a - a.div(b, rounding_mode="floor") * b + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer and float inputs. + + .. note:: + Complex inputs are not supported. In some cases, it is not mathematically + possible to satisfy the definition of a modulo operation with complex numbers. + See :func:`torch.fmod` for how division by zero is handled. + + .. seealso:: + + :func:`torch.fmod` which implements C++'s `std::fmod `_. + This one is defined in terms of division rounding towards zero. + + Args: + input (Tensor or Scalar): the dividend + other (Tensor or Scalar): the divisor + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.remainder(torch.tensor([-3., -2, -1, 1, 2, 3]), 2) + tensor([ 1., 0., 1., 1., 0., 1.]) + >>> torch.remainder(torch.tensor([1, 2, 3, 4, 5]), -1.5) + tensor([ -0.5000, -1.0000, 0.0000, -0.5000, -1.0000 ]) + """ + +def renorm( + input: Tensor, + p: Number | _complex, + dim: _int, + maxnorm: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + renorm(input, p, dim, maxnorm, *, out=None) -> Tensor + + Returns a tensor where each sub-tensor of :attr:`input` along dimension + :attr:`dim` is normalized such that the `p`-norm of the sub-tensor is lower + than the value :attr:`maxnorm` + + .. note:: If the norm of a row is lower than `maxnorm`, the row is unchanged + + Args: + input (Tensor): the input tensor. + p (float): the power for the norm computation + dim (int): the dimension to slice over to get the sub-tensors + maxnorm (float): the maximum norm to keep each sub-tensor under + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> x = torch.ones(3, 3) + >>> x[1].fill_(2) + tensor([ 2., 2., 2.]) + >>> x[2].fill_(3) + tensor([ 3., 3., 3.]) + >>> x + tensor([[ 1., 1., 1.], + [ 2., 2., 2.], + [ 3., 3., 3.]]) + >>> torch.renorm(x, 1, 0, 5) + tensor([[ 1.0000, 1.0000, 1.0000], + [ 1.6667, 1.6667, 1.6667], + [ 1.6667, 1.6667, 1.6667]]) + """ + +@overload +def repeat_interleave( + input: Tensor, + repeats: Tensor, + dim: _int | None = None, + *, + output_size: _int | SymInt | None = None, +) -> Tensor: + r""" + repeat_interleave(input, repeats, dim=None, *, output_size=None) -> Tensor + + Repeat elements of a tensor. + + .. warning:: + + This is different from :meth:`torch.Tensor.repeat` but similar to ``numpy.repeat``. + + Args: + input (Tensor): the input tensor. + repeats (Tensor or int): The number of repetitions for each element. + repeats is broadcasted to fit the shape of the given axis. + dim (int, optional): The dimension along which to repeat values. + By default, use the flattened input array, and return a flat output + array. + + Keyword args: + output_size (int, optional): Total output size for the given axis + ( e.g. sum of repeats). If given, it will avoid stream synchronization + needed to calculate output shape of the tensor. + + Returns: + Tensor: Repeated tensor which has the same shape as input, except along the given axis. + + Example:: + + >>> x = torch.tensor([1, 2, 3]) + >>> x.repeat_interleave(2) + tensor([1, 1, 2, 2, 3, 3]) + >>> y = torch.tensor([[1, 2], [3, 4]]) + >>> torch.repeat_interleave(y, 2) + tensor([1, 1, 2, 2, 3, 3, 4, 4]) + >>> torch.repeat_interleave(y, 3, dim=1) + tensor([[1, 1, 1, 2, 2, 2], + [3, 3, 3, 4, 4, 4]]) + >>> torch.repeat_interleave(y, torch.tensor([1, 2]), dim=0) + tensor([[1, 2], + [3, 4], + [3, 4]]) + >>> torch.repeat_interleave(y, torch.tensor([1, 2]), dim=0, output_size=3) + tensor([[1, 2], + [3, 4], + [3, 4]]) + + If the `repeats` is `tensor([n1, n2, n3, ...])`, then the output will be + `tensor([0, 0, ..., 1, 1, ..., 2, 2, ..., ...])` where `0` appears `n1` times, + `1` appears `n2` times, `2` appears `n3` times, etc. + + .. function:: repeat_interleave(repeats, *) -> Tensor + :noindex: + + Repeats 0 repeats[0] times, 1 repeats[1] times, 2 repeats[2] times, etc. + + Args: + repeats (Tensor): The number of repetitions for each element. + + Returns: + Tensor: Repeated tensor of size `sum(repeats)`. + + Example:: + + >>> torch.repeat_interleave(torch.tensor([1, 2, 3])) + tensor([0, 1, 1, 2, 2, 2]) + """ + +@overload +def repeat_interleave( + repeats: Tensor, + *, + output_size: _int | SymInt | None = None, +) -> Tensor: + r""" + repeat_interleave(input, repeats, dim=None, *, output_size=None) -> Tensor + + Repeat elements of a tensor. + + .. warning:: + + This is different from :meth:`torch.Tensor.repeat` but similar to ``numpy.repeat``. + + Args: + input (Tensor): the input tensor. + repeats (Tensor or int): The number of repetitions for each element. + repeats is broadcasted to fit the shape of the given axis. + dim (int, optional): The dimension along which to repeat values. + By default, use the flattened input array, and return a flat output + array. + + Keyword args: + output_size (int, optional): Total output size for the given axis + ( e.g. sum of repeats). If given, it will avoid stream synchronization + needed to calculate output shape of the tensor. + + Returns: + Tensor: Repeated tensor which has the same shape as input, except along the given axis. + + Example:: + + >>> x = torch.tensor([1, 2, 3]) + >>> x.repeat_interleave(2) + tensor([1, 1, 2, 2, 3, 3]) + >>> y = torch.tensor([[1, 2], [3, 4]]) + >>> torch.repeat_interleave(y, 2) + tensor([1, 1, 2, 2, 3, 3, 4, 4]) + >>> torch.repeat_interleave(y, 3, dim=1) + tensor([[1, 1, 1, 2, 2, 2], + [3, 3, 3, 4, 4, 4]]) + >>> torch.repeat_interleave(y, torch.tensor([1, 2]), dim=0) + tensor([[1, 2], + [3, 4], + [3, 4]]) + >>> torch.repeat_interleave(y, torch.tensor([1, 2]), dim=0, output_size=3) + tensor([[1, 2], + [3, 4], + [3, 4]]) + + If the `repeats` is `tensor([n1, n2, n3, ...])`, then the output will be + `tensor([0, 0, ..., 1, 1, ..., 2, 2, ..., ...])` where `0` appears `n1` times, + `1` appears `n2` times, `2` appears `n3` times, etc. + + .. function:: repeat_interleave(repeats, *) -> Tensor + :noindex: + + Repeats 0 repeats[0] times, 1 repeats[1] times, 2 repeats[2] times, etc. + + Args: + repeats (Tensor): The number of repetitions for each element. + + Returns: + Tensor: Repeated tensor of size `sum(repeats)`. + + Example:: + + >>> torch.repeat_interleave(torch.tensor([1, 2, 3])) + tensor([0, 1, 1, 2, 2, 2]) + """ + +@overload +def repeat_interleave( + input: Tensor, + repeats: _int | SymInt, + dim: _int | None = None, + *, + output_size: _int | SymInt | None = None, +) -> Tensor: + r""" + repeat_interleave(input, repeats, dim=None, *, output_size=None) -> Tensor + + Repeat elements of a tensor. + + .. warning:: + + This is different from :meth:`torch.Tensor.repeat` but similar to ``numpy.repeat``. + + Args: + input (Tensor): the input tensor. + repeats (Tensor or int): The number of repetitions for each element. + repeats is broadcasted to fit the shape of the given axis. + dim (int, optional): The dimension along which to repeat values. + By default, use the flattened input array, and return a flat output + array. + + Keyword args: + output_size (int, optional): Total output size for the given axis + ( e.g. sum of repeats). If given, it will avoid stream synchronization + needed to calculate output shape of the tensor. + + Returns: + Tensor: Repeated tensor which has the same shape as input, except along the given axis. + + Example:: + + >>> x = torch.tensor([1, 2, 3]) + >>> x.repeat_interleave(2) + tensor([1, 1, 2, 2, 3, 3]) + >>> y = torch.tensor([[1, 2], [3, 4]]) + >>> torch.repeat_interleave(y, 2) + tensor([1, 1, 2, 2, 3, 3, 4, 4]) + >>> torch.repeat_interleave(y, 3, dim=1) + tensor([[1, 1, 1, 2, 2, 2], + [3, 3, 3, 4, 4, 4]]) + >>> torch.repeat_interleave(y, torch.tensor([1, 2]), dim=0) + tensor([[1, 2], + [3, 4], + [3, 4]]) + >>> torch.repeat_interleave(y, torch.tensor([1, 2]), dim=0, output_size=3) + tensor([[1, 2], + [3, 4], + [3, 4]]) + + If the `repeats` is `tensor([n1, n2, n3, ...])`, then the output will be + `tensor([0, 0, ..., 1, 1, ..., 2, 2, ..., ...])` where `0` appears `n1` times, + `1` appears `n2` times, `2` appears `n3` times, etc. + + .. function:: repeat_interleave(repeats, *) -> Tensor + :noindex: + + Repeats 0 repeats[0] times, 1 repeats[1] times, 2 repeats[2] times, etc. + + Args: + repeats (Tensor): The number of repetitions for each element. + + Returns: + Tensor: Repeated tensor of size `sum(repeats)`. + + Example:: + + >>> torch.repeat_interleave(torch.tensor([1, 2, 3])) + tensor([0, 1, 1, 2, 2, 2]) + """ + +def reshape(input: Tensor, shape: Sequence[_int | SymInt]) -> Tensor: + r""" + reshape(input, shape) -> Tensor + + Returns a tensor with the same data and number of elements as :attr:`input`, + but with the specified shape. When possible, the returned tensor will be a view + of :attr:`input`. Otherwise, it will be a copy. Contiguous inputs and inputs + with compatible strides can be reshaped without copying, but you should not + depend on the copying vs. viewing behavior. + + See :meth:`torch.Tensor.view` on when it is possible to return a view. + + A single dimension may be -1, in which case it's inferred from the remaining + dimensions and the number of elements in :attr:`input`. + + Args: + input (Tensor): the tensor to be reshaped + shape (tuple of int): the new shape + + Example:: + + >>> a = torch.arange(4.) + >>> torch.reshape(a, (2, 2)) + tensor([[ 0., 1.], + [ 2., 3.]]) + >>> b = torch.tensor([[0, 1], [2, 3]]) + >>> torch.reshape(b, (-1,)) + tensor([ 0, 1, 2, 3]) + """ + +def resize_as_( + input: Tensor, + the_template: Tensor, + *, + memory_format: memory_format | None = None, +) -> Tensor: ... +def resize_as_sparse_(input: Tensor, the_template: Tensor) -> Tensor: ... +def resolve_conj(input: Tensor) -> Tensor: + r""" + resolve_conj(input) -> Tensor + + Returns a new tensor with materialized conjugation if :attr:`input`'s conjugate bit is set to `True`, + else returns :attr:`input`. The output tensor will always have its conjugate bit set to `False`. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> x = torch.tensor([-1 + 1j, -2 + 2j, 3 - 3j]) + >>> y = x.conj() + >>> y.is_conj() + True + >>> z = y.resolve_conj() + >>> z + tensor([-1 - 1j, -2 - 2j, 3 + 3j]) + >>> z.is_conj() + False + """ + +def resolve_neg(input: Tensor) -> Tensor: + r""" + resolve_neg(input) -> Tensor + + Returns a new tensor with materialized negation if :attr:`input`'s negative bit is set to `True`, + else returns :attr:`input`. The output tensor will always have its negative bit set to `False`. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> x = torch.tensor([-1 + 1j, -2 + 2j, 3 - 3j]) + >>> y = x.conj() + >>> z = y.imag + >>> z.is_neg() + True + >>> out = z.resolve_neg() + >>> out + tensor([-1., -2., 3.]) + >>> out.is_neg() + False + """ + +@overload +def result_type(tensor: Tensor, other: Tensor) -> _dtype: + r""" + result_type(tensor1, tensor2) -> dtype + + Returns the :class:`torch.dtype` that would result from performing an arithmetic + operation on the provided input tensors. See type promotion :ref:`documentation ` + for more information on the type promotion logic. + + Args: + tensor1 (Tensor or Number): an input tensor or number + tensor2 (Tensor or Number): an input tensor or number + + Example:: + + >>> torch.result_type(torch.tensor([1, 2], dtype=torch.int), 1.0) + torch.float32 + >>> torch.result_type(torch.tensor([1, 2], dtype=torch.uint8), torch.tensor(1)) + torch.uint8 + """ + +@overload +def result_type(scalar: Number | _complex, tensor: Tensor) -> _dtype: + r""" + result_type(tensor1, tensor2) -> dtype + + Returns the :class:`torch.dtype` that would result from performing an arithmetic + operation on the provided input tensors. See type promotion :ref:`documentation ` + for more information on the type promotion logic. + + Args: + tensor1 (Tensor or Number): an input tensor or number + tensor2 (Tensor or Number): an input tensor or number + + Example:: + + >>> torch.result_type(torch.tensor([1, 2], dtype=torch.int), 1.0) + torch.float32 + >>> torch.result_type(torch.tensor([1, 2], dtype=torch.uint8), torch.tensor(1)) + torch.uint8 + """ + +@overload +def result_type(tensor: Tensor, other: Number | _complex) -> _dtype: + r""" + result_type(tensor1, tensor2) -> dtype + + Returns the :class:`torch.dtype` that would result from performing an arithmetic + operation on the provided input tensors. See type promotion :ref:`documentation ` + for more information on the type promotion logic. + + Args: + tensor1 (Tensor or Number): an input tensor or number + tensor2 (Tensor or Number): an input tensor or number + + Example:: + + >>> torch.result_type(torch.tensor([1, 2], dtype=torch.int), 1.0) + torch.float32 + >>> torch.result_type(torch.tensor([1, 2], dtype=torch.uint8), torch.tensor(1)) + torch.uint8 + """ + +@overload +def result_type( + scalar1: Number | _complex, + scalar2: Number | _complex, +) -> _dtype: + r""" + result_type(tensor1, tensor2) -> dtype + + Returns the :class:`torch.dtype` that would result from performing an arithmetic + operation on the provided input tensors. See type promotion :ref:`documentation ` + for more information on the type promotion logic. + + Args: + tensor1 (Tensor or Number): an input tensor or number + tensor2 (Tensor or Number): an input tensor or number + + Example:: + + >>> torch.result_type(torch.tensor([1, 2], dtype=torch.int), 1.0) + torch.float32 + >>> torch.result_type(torch.tensor([1, 2], dtype=torch.uint8), torch.tensor(1)) + torch.uint8 + """ + +def rms_norm( + input: Tensor, + normalized_shape: Sequence[_int | SymInt], + weight: Tensor | None = None, + eps: _float | None = None, +) -> Tensor: ... +@overload +def rnn_relu( + data: Tensor, + batch_sizes: Tensor, + hx: Tensor, + params: tuple[Tensor, ...] | list[Tensor] | None, + has_biases: _bool, + num_layers: _int, + dropout: _float, + train: _bool, + bidirectional: _bool, +) -> tuple[Tensor, Tensor]: ... +@overload +def rnn_relu( + input: Tensor, + hx: Tensor, + params: tuple[Tensor, ...] | list[Tensor] | None, + has_biases: _bool, + num_layers: _int, + dropout: _float, + train: _bool, + bidirectional: _bool, + batch_first: _bool, +) -> tuple[Tensor, Tensor]: ... +def rnn_relu_cell( + input: Tensor, + hx: Tensor, + w_ih: Tensor, + w_hh: Tensor, + b_ih: Tensor | None = None, + b_hh: Tensor | None = None, +) -> Tensor: ... +@overload +def rnn_tanh( + data: Tensor, + batch_sizes: Tensor, + hx: Tensor, + params: tuple[Tensor, ...] | list[Tensor] | None, + has_biases: _bool, + num_layers: _int, + dropout: _float, + train: _bool, + bidirectional: _bool, +) -> tuple[Tensor, Tensor]: ... +@overload +def rnn_tanh( + input: Tensor, + hx: Tensor, + params: tuple[Tensor, ...] | list[Tensor] | None, + has_biases: _bool, + num_layers: _int, + dropout: _float, + train: _bool, + bidirectional: _bool, + batch_first: _bool, +) -> tuple[Tensor, Tensor]: ... +def rnn_tanh_cell( + input: Tensor, + hx: Tensor, + w_ih: Tensor, + w_hh: Tensor, + b_ih: Tensor | None = None, + b_hh: Tensor | None = None, +) -> Tensor: ... +def roll( + input: Tensor, + shifts: _int | SymInt | Sequence[_int | SymInt], + dims: _int | _size = (), +) -> Tensor: + r""" + roll(input, shifts, dims=None) -> Tensor + + Roll the tensor :attr:`input` along the given dimension(s). Elements that are + shifted beyond the last position are re-introduced at the first position. If + :attr:`dims` is `None`, the tensor will be flattened before rolling and then + restored to the original shape. + + Args: + input (Tensor): the input tensor. + shifts (int or tuple of ints): The number of places by which the elements + of the tensor are shifted. If shifts is a tuple, dims must be a tuple of + the same size, and each dimension will be rolled by the corresponding + value + dims (int or tuple of ints): Axis along which to roll + + Example:: + + >>> x = torch.tensor([1, 2, 3, 4, 5, 6, 7, 8]).view(4, 2) + >>> x + tensor([[1, 2], + [3, 4], + [5, 6], + [7, 8]]) + >>> torch.roll(x, 1) + tensor([[8, 1], + [2, 3], + [4, 5], + [6, 7]]) + >>> torch.roll(x, 1, 0) + tensor([[7, 8], + [1, 2], + [3, 4], + [5, 6]]) + >>> torch.roll(x, -1, 0) + tensor([[3, 4], + [5, 6], + [7, 8], + [1, 2]]) + >>> torch.roll(x, shifts=(2, 1), dims=(0, 1)) + tensor([[6, 5], + [8, 7], + [2, 1], + [4, 3]]) + """ + +def rot90(input: Tensor, k: _int = 1, dims: _size = (0, 1)) -> Tensor: + r""" + rot90(input, k=1, dims=(0, 1)) -> Tensor + + Rotate an n-D tensor by 90 degrees in the plane specified by dims axis. + Rotation direction is from the first towards the second axis if k > 0, and from the second towards the first for k < 0. + + Args: + input (Tensor): the input tensor. + k (int): number of times to rotate. Default value is 1 + dims (a list or tuple): axis to rotate. Default value is [0, 1] + + Example:: + + >>> x = torch.arange(4).view(2, 2) + >>> x + tensor([[0, 1], + [2, 3]]) + >>> torch.rot90(x, 1, [0, 1]) + tensor([[1, 3], + [0, 2]]) + + >>> x = torch.arange(8).view(2, 2, 2) + >>> x + tensor([[[0, 1], + [2, 3]], + + [[4, 5], + [6, 7]]]) + >>> torch.rot90(x, 1, [1, 2]) + tensor([[[1, 3], + [0, 2]], + + [[5, 7], + [4, 6]]]) + """ + +@overload +def round(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + round(input, *, decimals=0, out=None) -> Tensor + + Rounds elements of :attr:`input` to the nearest integer. + + For integer inputs, follows the array-api convention of returning a + copy of the input tensor. + The return type of output is same as that of input's dtype. + + .. note:: + This function implements the "round half to even" to + break ties when a number is equidistant from two + integers (e.g. `round(2.5)` is 2). + + When the :attr:\`decimals\` argument is specified the + algorithm used is similar to NumPy's `around`. This + algorithm is fast but inexact and it can easily + overflow for low precision dtypes. + Eg. `round(tensor([10000], dtype=torch.float16), decimals=3)` is `inf`. + + .. seealso:: + :func:`torch.ceil`, which rounds up. + :func:`torch.floor`, which rounds down. + :func:`torch.trunc`, which rounds towards zero. + + Args: + input (Tensor): the input tensor. + decimals (int): Number of decimal places to round to (default: 0). + If decimals is negative, it specifies the number of positions + to the left of the decimal point. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.round(torch.tensor((4.7, -2.3, 9.1, -7.7))) + tensor([ 5., -2., 9., -8.]) + + >>> # Values equidistant from two integers are rounded towards the + >>> # the nearest even value (zero is treated as even) + >>> torch.round(torch.tensor([-0.5, 0.5, 1.5, 2.5])) + tensor([-0., 0., 2., 2.]) + + >>> # A positive decimals argument rounds to the to that decimal place + >>> torch.round(torch.tensor([0.1234567]), decimals=3) + tensor([0.1230]) + + >>> # A negative decimals argument rounds to the left of the decimal + >>> torch.round(torch.tensor([1200.1234567]), decimals=-3) + tensor([1000.]) + """ + +@overload +def round( + input: Tensor, + *, + decimals: _int, + out: Tensor | None = None, +) -> Tensor: + r""" + round(input, *, decimals=0, out=None) -> Tensor + + Rounds elements of :attr:`input` to the nearest integer. + + For integer inputs, follows the array-api convention of returning a + copy of the input tensor. + The return type of output is same as that of input's dtype. + + .. note:: + This function implements the "round half to even" to + break ties when a number is equidistant from two + integers (e.g. `round(2.5)` is 2). + + When the :attr:\`decimals\` argument is specified the + algorithm used is similar to NumPy's `around`. This + algorithm is fast but inexact and it can easily + overflow for low precision dtypes. + Eg. `round(tensor([10000], dtype=torch.float16), decimals=3)` is `inf`. + + .. seealso:: + :func:`torch.ceil`, which rounds up. + :func:`torch.floor`, which rounds down. + :func:`torch.trunc`, which rounds towards zero. + + Args: + input (Tensor): the input tensor. + decimals (int): Number of decimal places to round to (default: 0). + If decimals is negative, it specifies the number of positions + to the left of the decimal point. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> torch.round(torch.tensor((4.7, -2.3, 9.1, -7.7))) + tensor([ 5., -2., 9., -8.]) + + >>> # Values equidistant from two integers are rounded towards the + >>> # the nearest even value (zero is treated as even) + >>> torch.round(torch.tensor([-0.5, 0.5, 1.5, 2.5])) + tensor([-0., 0., 2., 2.]) + + >>> # A positive decimals argument rounds to the to that decimal place + >>> torch.round(torch.tensor([0.1234567]), decimals=3) + tensor([0.1230]) + + >>> # A negative decimals argument rounds to the left of the decimal + >>> torch.round(torch.tensor([1200.1234567]), decimals=-3) + tensor([1000.]) + """ + +@overload +def round_(input: Tensor) -> Tensor: ... +@overload +def round_(input: Tensor, *, decimals: _int) -> Tensor: ... +def row_indices_copy(input: Tensor, *, out: Tensor | None = None) -> Tensor: ... +def row_stack( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + row_stack(tensors, *, out=None) -> Tensor + + Alias of :func:`torch.vstack`. + """ + +def rrelu( + input: Tensor, + lower: Number | _complex = 0.125, + upper: Number | _complex = 0.3333333333333333, + training: _bool = False, + generator: Generator | None = None, +) -> Tensor: ... +def rrelu_( + input: Tensor, + lower: Number | _complex = 0.125, + upper: Number | _complex = 0.3333333333333333, + training: _bool = False, + generator: Generator | None = None, +) -> Tensor: ... +def rsqrt(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + rsqrt(input, *, out=None) -> Tensor + + Returns a new tensor with the reciprocal of the square-root of each of + the elements of :attr:`input`. + + .. math:: + \text{out}_{i} = \frac{1}{\sqrt{\text{input}_{i}}} + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-0.0370, 0.2970, 1.5420, -0.9105]) + >>> torch.rsqrt(a) + tensor([ nan, 1.8351, 0.8053, nan]) + """ + +def rsqrt_(input: Tensor) -> Tensor: ... +@overload +def rsub( + input: Tensor, + other: Tensor, + *, + alpha: Number | _complex = 1, +) -> Tensor: ... +@overload +def rsub( + input: Tensor, + other: Number | _complex, + alpha: Number | _complex = 1, +) -> Tensor: ... +def saddmm( + input: Tensor, + mat1: Tensor, + mat2: Tensor, + *, + beta: Number = 1, + alpha: Number = 1, + out: Tensor | None = None, +) -> Tensor: ... +def scalar_tensor( + s: Number | _complex, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: ... +@overload +def scatter( + input: Tensor, + dim: _int, + index: Tensor, + src: Tensor, + *, + reduce: str, + out: Tensor | None = None, +) -> Tensor: + r""" + scatter(input, dim, index, src) -> Tensor + + Out-of-place version of :meth:`torch.Tensor.scatter_` + """ + +@overload +def scatter( + input: Tensor, + dim: _int, + index: Tensor, + src: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + scatter(input, dim, index, src) -> Tensor + + Out-of-place version of :meth:`torch.Tensor.scatter_` + """ + +@overload +def scatter( + input: Tensor, + dim: _int, + index: Tensor, + value: Number | _complex, + *, + reduce: str, + out: Tensor | None = None, +) -> Tensor: + r""" + scatter(input, dim, index, src) -> Tensor + + Out-of-place version of :meth:`torch.Tensor.scatter_` + """ + +@overload +def scatter( + input: Tensor, + dim: str | EllipsisType | None, + index: Tensor, + src: Tensor, +) -> Tensor: + r""" + scatter(input, dim, index, src) -> Tensor + + Out-of-place version of :meth:`torch.Tensor.scatter_` + """ + +@overload +def scatter( + input: Tensor, + dim: _int, + index: Tensor, + value: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + scatter(input, dim, index, src) -> Tensor + + Out-of-place version of :meth:`torch.Tensor.scatter_` + """ + +@overload +def scatter( + input: Tensor, + dim: str | EllipsisType | None, + index: Tensor, + value: Number | _complex, +) -> Tensor: + r""" + scatter(input, dim, index, src) -> Tensor + + Out-of-place version of :meth:`torch.Tensor.scatter_` + """ + +@overload +def scatter_add( + input: Tensor, + dim: _int, + index: Tensor, + src: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + scatter_add(input, dim, index, src) -> Tensor + + Out-of-place version of :meth:`torch.Tensor.scatter_add_` + """ + +@overload +def scatter_add( + input: Tensor, + dim: str | EllipsisType | None, + index: Tensor, + src: Tensor, +) -> Tensor: + r""" + scatter_add(input, dim, index, src) -> Tensor + + Out-of-place version of :meth:`torch.Tensor.scatter_add_` + """ + +def scatter_reduce( + input: Tensor, + dim: _int, + index: Tensor, + src: Tensor, + reduce: str, + *, + include_self: _bool = True, + out: Tensor | None = None, +) -> Tensor: + r""" + scatter_reduce(input, dim, index, src, reduce, *, include_self=True) -> Tensor + + Out-of-place version of :meth:`torch.Tensor.scatter_reduce_` + """ + +@overload +def searchsorted( + sorted_sequence: Tensor, + input: Tensor, + *, + out_int32: _bool = False, + right: _bool = False, + side: str | None = None, + sorter: Tensor | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + searchsorted(sorted_sequence, values, *, out_int32=False, right=False, side=None, out=None, sorter=None) -> Tensor + + Find the indices from the *innermost* dimension of :attr:`sorted_sequence` such that, if the + corresponding values in :attr:`values` were inserted before the indices, when sorted, the order + of the corresponding *innermost* dimension within :attr:`sorted_sequence` would be preserved. + Return a new tensor with the same size as :attr:`values`. More formally, + the returned index satisfies the following rules: + + .. list-table:: + :widths: 12 10 78 + :header-rows: 1 + + * - :attr:`sorted_sequence` + - :attr:`right` + - *returned index satisfies* + * - 1-D + - False + - ``sorted_sequence[i-1] < values[m][n]...[l][x] <= sorted_sequence[i]`` + * - 1-D + - True + - ``sorted_sequence[i-1] <= values[m][n]...[l][x] < sorted_sequence[i]`` + * - N-D + - False + - ``sorted_sequence[m][n]...[l][i-1] < values[m][n]...[l][x] <= sorted_sequence[m][n]...[l][i]`` + * - N-D + - True + - ``sorted_sequence[m][n]...[l][i-1] <= values[m][n]...[l][x] < sorted_sequence[m][n]...[l][i]`` + + Args: + sorted_sequence (Tensor): N-D or 1-D tensor, containing monotonically increasing sequence on the *innermost* + dimension unless :attr:`sorter` is provided, in which case the sequence does not + need to be sorted + values (Tensor or Scalar): N-D tensor or a Scalar containing the search value(s). + + Keyword args: + out_int32 (bool, optional): indicate the output data type. torch.int32 if True, torch.int64 otherwise. + Default value is False, i.e. default output data type is torch.int64. + right (bool, optional): if False, return the first suitable location that is found. If True, return the + last such index. If no suitable index found, return 0 for non-numerical value + (eg. nan, inf) or the size of *innermost* dimension within :attr:`sorted_sequence` + (one pass the last index of the *innermost* dimension). In other words, if False, + gets the lower bound index for each value in :attr:`values` on the corresponding + *innermost* dimension of the :attr:`sorted_sequence`. If True, gets the upper + bound index instead. Default value is False. :attr:`side` does the same and is + preferred. It will error if :attr:`side` is set to "left" while this is True. + side (str, optional): the same as :attr:`right` but preferred. "left" corresponds to False for :attr:`right` + and "right" corresponds to True for :attr:`right`. It will error if this is set to + "left" while :attr:`right` is True. Default value is None. + out (Tensor, optional): the output tensor, must be the same size as :attr:`values` if provided. + sorter (LongTensor, optional): if provided, a tensor matching the shape of the unsorted + :attr:`sorted_sequence` containing a sequence of indices that sort it in the + ascending order on the innermost dimension + + + Example:: + + >>> sorted_sequence = torch.tensor([[1, 3, 5, 7, 9], [2, 4, 6, 8, 10]]) + >>> sorted_sequence + tensor([[ 1, 3, 5, 7, 9], + [ 2, 4, 6, 8, 10]]) + >>> values = torch.tensor([[3, 6, 9], [3, 6, 9]]) + >>> values + tensor([[3, 6, 9], + [3, 6, 9]]) + >>> torch.searchsorted(sorted_sequence, values) + tensor([[1, 3, 4], + [1, 2, 4]]) + >>> torch.searchsorted(sorted_sequence, values, side='right') + tensor([[2, 3, 5], + [1, 3, 4]]) + + >>> sorted_sequence_1d = torch.tensor([1, 3, 5, 7, 9]) + >>> sorted_sequence_1d + tensor([1, 3, 5, 7, 9]) + >>> torch.searchsorted(sorted_sequence_1d, values) + tensor([[1, 3, 4], + [1, 3, 4]]) + """ + +@overload +def searchsorted( + sorted_sequence: Tensor, + self: Number | _complex, + *, + out_int32: _bool = False, + right: _bool = False, + side: str | None = None, + sorter: Tensor | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + searchsorted(sorted_sequence, values, *, out_int32=False, right=False, side=None, out=None, sorter=None) -> Tensor + + Find the indices from the *innermost* dimension of :attr:`sorted_sequence` such that, if the + corresponding values in :attr:`values` were inserted before the indices, when sorted, the order + of the corresponding *innermost* dimension within :attr:`sorted_sequence` would be preserved. + Return a new tensor with the same size as :attr:`values`. More formally, + the returned index satisfies the following rules: + + .. list-table:: + :widths: 12 10 78 + :header-rows: 1 + + * - :attr:`sorted_sequence` + - :attr:`right` + - *returned index satisfies* + * - 1-D + - False + - ``sorted_sequence[i-1] < values[m][n]...[l][x] <= sorted_sequence[i]`` + * - 1-D + - True + - ``sorted_sequence[i-1] <= values[m][n]...[l][x] < sorted_sequence[i]`` + * - N-D + - False + - ``sorted_sequence[m][n]...[l][i-1] < values[m][n]...[l][x] <= sorted_sequence[m][n]...[l][i]`` + * - N-D + - True + - ``sorted_sequence[m][n]...[l][i-1] <= values[m][n]...[l][x] < sorted_sequence[m][n]...[l][i]`` + + Args: + sorted_sequence (Tensor): N-D or 1-D tensor, containing monotonically increasing sequence on the *innermost* + dimension unless :attr:`sorter` is provided, in which case the sequence does not + need to be sorted + values (Tensor or Scalar): N-D tensor or a Scalar containing the search value(s). + + Keyword args: + out_int32 (bool, optional): indicate the output data type. torch.int32 if True, torch.int64 otherwise. + Default value is False, i.e. default output data type is torch.int64. + right (bool, optional): if False, return the first suitable location that is found. If True, return the + last such index. If no suitable index found, return 0 for non-numerical value + (eg. nan, inf) or the size of *innermost* dimension within :attr:`sorted_sequence` + (one pass the last index of the *innermost* dimension). In other words, if False, + gets the lower bound index for each value in :attr:`values` on the corresponding + *innermost* dimension of the :attr:`sorted_sequence`. If True, gets the upper + bound index instead. Default value is False. :attr:`side` does the same and is + preferred. It will error if :attr:`side` is set to "left" while this is True. + side (str, optional): the same as :attr:`right` but preferred. "left" corresponds to False for :attr:`right` + and "right" corresponds to True for :attr:`right`. It will error if this is set to + "left" while :attr:`right` is True. Default value is None. + out (Tensor, optional): the output tensor, must be the same size as :attr:`values` if provided. + sorter (LongTensor, optional): if provided, a tensor matching the shape of the unsorted + :attr:`sorted_sequence` containing a sequence of indices that sort it in the + ascending order on the innermost dimension + + + Example:: + + >>> sorted_sequence = torch.tensor([[1, 3, 5, 7, 9], [2, 4, 6, 8, 10]]) + >>> sorted_sequence + tensor([[ 1, 3, 5, 7, 9], + [ 2, 4, 6, 8, 10]]) + >>> values = torch.tensor([[3, 6, 9], [3, 6, 9]]) + >>> values + tensor([[3, 6, 9], + [3, 6, 9]]) + >>> torch.searchsorted(sorted_sequence, values) + tensor([[1, 3, 4], + [1, 2, 4]]) + >>> torch.searchsorted(sorted_sequence, values, side='right') + tensor([[2, 3, 5], + [1, 3, 4]]) + + >>> sorted_sequence_1d = torch.tensor([1, 3, 5, 7, 9]) + >>> sorted_sequence_1d + tensor([1, 3, 5, 7, 9]) + >>> torch.searchsorted(sorted_sequence_1d, values) + tensor([[1, 3, 4], + [1, 3, 4]]) + """ + +def segment_reduce( + data: Tensor, + reduce: str, + *, + lengths: Tensor | None = None, + indices: Tensor | None = None, + offsets: Tensor | None = None, + axis: _int = 0, + unsafe: _bool = False, + initial: Number | _complex | None = None, +) -> Tensor: + r""" + segment_reduce(data: Tensor, reduce: str, *, lengths: Tensor | None = None, indices: Tensor | None = None, offsets: Tensor | None = None, axis: _int = 0, unsafe: _bool = False, initial: Number | _complex | None = None) -> Tensor # noqa: B950 + + Perform a segment reduction operation on the input tensor along the specified axis. + + Args: + data (Tensor): The input tensor on which the segment reduction operation will be performed. + reduce (str): The type of reduction operation. Supported values are ``sum``, ``mean``, ``max``, ``min``, ``prod``. + + Keyword args: + lengths (Tensor, optional): Length of each segment. Default: ``None``. + offsets (Tensor, optional): Offset of each segment. Default: ``None``. + axis (int, optional): The axis perform reduction. Default: ``0``. + unsafe (bool, optional): Skip validation If `True`. Default: ``False``. + initial (Number, optional): The initial value for the reduction operation. Default: ``None``. + + Example:: + + >>> data = torch.tensor([[1, 2, 3, 4],[5, 6, 7, 8],[9, 10, 11, 12]], dtype=torch.float32, device='cuda') + >>> lengths = torch.tensor([2, 1], device='cuda') + >>> torch.segment_reduce(data, 'max', lengths=lengths) + tensor([[ 5., 6., 7., 8.], + [ 9., 10., 11., 12.]], device='cuda:0') + """ + +@overload +def select(input: Tensor, dim: _int, index: _int | SymInt) -> Tensor: + r""" + select(input, dim, index) -> Tensor + + Slices the :attr:`input` tensor along the selected dimension at the given index. + This function returns a view of the original tensor with the given dimension removed. + + .. note:: If :attr:`input` is a sparse tensor and returning a view of + the tensor is not possible, a RuntimeError exception is + raised. In this is the case, consider using + :func:`torch.select_copy` function. + + Args: + input (Tensor): the input tensor. + dim (int): the dimension to slice + index (int): the index to select with + + .. note:: + + :meth:`select` is equivalent to slicing. For example, + ``tensor.select(0, index)`` is equivalent to ``tensor[index]`` and + ``tensor.select(2, index)`` is equivalent to ``tensor[:,:,index]``. + """ + +@overload +def select( + input: Tensor, + dim: str | EllipsisType | None, + index: _int, +) -> Tensor: + r""" + select(input, dim, index) -> Tensor + + Slices the :attr:`input` tensor along the selected dimension at the given index. + This function returns a view of the original tensor with the given dimension removed. + + .. note:: If :attr:`input` is a sparse tensor and returning a view of + the tensor is not possible, a RuntimeError exception is + raised. In this is the case, consider using + :func:`torch.select_copy` function. + + Args: + input (Tensor): the input tensor. + dim (int): the dimension to slice + index (int): the index to select with + + .. note:: + + :meth:`select` is equivalent to slicing. For example, + ``tensor.select(0, index)`` is equivalent to ``tensor[index]`` and + ``tensor.select(2, index)`` is equivalent to ``tensor[:,:,index]``. + """ + +def select_copy( + input: Tensor, + dim: _int, + index: _int | SymInt, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.select`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def select_scatter( + input: Tensor, + src: Tensor, + dim: _int, + index: _int | SymInt, +) -> Tensor: + r""" + select_scatter(input, src, dim, index) -> Tensor + + Embeds the values of the :attr:`src` tensor into :attr:`input` at the given index. + This function returns a tensor with fresh storage; it does not create a view. + + + Args: + input (Tensor): the input tensor. + src (Tensor): The tensor to embed into :attr:`input` + dim (int): the dimension to insert the slice into. + index (int): the index to select with + + .. note:: + + :attr:`src` must be of the proper size in order to be embedded + into :attr:`input`. Specifically, it should have the same shape as + ``torch.select(input, dim, index)`` + + Example:: + + >>> a = torch.zeros(2, 2) + >>> b = torch.ones(2) + >>> a.select_scatter(b, 0, 0) + tensor([[1., 1.], + [0., 0.]]) + """ + +def selu(input: Tensor) -> Tensor: ... +def selu_(input: Tensor) -> Tensor: ... +def set_flush_denormal(mode: _bool) -> _bool: + r""" + set_flush_denormal(mode) -> bool + + Disables denormal floating numbers on CPU. + + Returns ``True`` if your system supports flushing denormal numbers and it + successfully configures flush denormal mode. :meth:`~torch.set_flush_denormal` + is supported on x86 architectures supporting SSE3 and AArch64 architecture. + + Args: + mode (bool): Controls whether to enable flush denormal mode or not + + Example:: + + >>> torch.set_flush_denormal(True) + True + >>> torch.tensor([1e-323], dtype=torch.float64) + tensor([ 0.], dtype=torch.float64) + >>> torch.set_flush_denormal(False) + True + >>> torch.tensor([1e-323], dtype=torch.float64) + tensor(9.88131e-324 * + [ 1.0000], dtype=torch.float64) + """ + +def set_num_interop_threads(num: _int) -> None: + r""" + set_num_interop_threads(int) + + Sets the number of threads used for interop parallelism + (e.g. in JIT interpreter) on CPU. + + .. warning:: + Can only be called once and before any inter-op parallel work + is started (e.g. JIT execution). + """ + +def set_num_threads(num: _int) -> None: + r""" + set_num_threads(int) + + Sets the number of threads used for intraop parallelism on CPU. + + .. warning:: + To ensure that the correct number of threads is used, set_num_threads + must be called before running eager, JIT or autograd code. + """ + +def sgn(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + sgn(input, *, out=None) -> Tensor + + This function is an extension of torch.sign() to complex tensors. + It computes a new tensor whose elements have + the same angles as the corresponding elements of :attr:`input` and + absolute values (i.e. magnitudes) of one for complex tensors and + is equivalent to torch.sign() for non-complex tensors. + + .. math:: + \text{out}_{i} = \begin{cases} + 0 & |\text{{input}}_i| == 0 \\ + \frac{{\text{{input}}_i}}{|{\text{{input}}_i}|} & \text{otherwise} + \end{cases} + + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> t = torch.tensor([3+4j, 7-24j, 0, 1+2j]) + >>> t.sgn() + tensor([0.6000+0.8000j, 0.2800-0.9600j, 0.0000+0.0000j, 0.4472+0.8944j]) + """ + +def sigmoid(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + sigmoid(input, *, out=None) -> Tensor + + Alias for :func:`torch.special.expit`. + """ + +def sigmoid_(input: Tensor) -> Tensor: ... +def sign(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + sign(input, *, out=None) -> Tensor + + Returns a new tensor with the signs of the elements of :attr:`input`. + + .. math:: + \text{out}_{i} = \operatorname{sgn}(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([0.7, -1.2, 0., 2.3]) + >>> a + tensor([ 0.7000, -1.2000, 0.0000, 2.3000]) + >>> torch.sign(a) + tensor([ 1., -1., 0., 1.]) + """ + +def signbit(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + signbit(input, *, out=None) -> Tensor + + Tests if each element of :attr:`input` has its sign bit set or not. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([0.7, -1.2, 0., 2.3]) + >>> torch.signbit(a) + tensor([ False, True, False, False]) + >>> a = torch.tensor([-0.0, 0.0]) + >>> torch.signbit(a) + tensor([ True, False]) + + .. note:: + signbit handles signed zeros, so negative zero (-0) returns True. + """ + +def sin(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + sin(input, *, out=None) -> Tensor + + Returns a new tensor with the sine of the elements in the :attr:`input` tensor, + where each value in this input tensor is in radians. + + .. math:: + \text{out}_{i} = \sin(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-0.5461, 0.1347, -2.7266, -0.2746]) + >>> torch.sin(a) + tensor([-0.5194, 0.1343, -0.4032, -0.2711]) + """ + +def sin_(input: Tensor) -> Tensor: ... +def sinc(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + sinc(input, *, out=None) -> Tensor + + Alias for :func:`torch.special.sinc`. + """ + +def sinc_(input: Tensor) -> Tensor: ... +def sinh(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + sinh(input, *, out=None) -> Tensor + + Returns a new tensor with the hyperbolic sine of the elements of + :attr:`input`. + + .. math:: + \text{out}_{i} = \sinh(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.5380, -0.8632, -0.1265, 0.9399]) + >>> torch.sinh(a) + tensor([ 0.5644, -0.9744, -0.1268, 1.0845]) + + .. note:: + When :attr:`input` is on the CPU, the implementation of torch.sinh may use + the Sleef library, which rounds very large results to infinity or negative + infinity. See `here `_ for details. + """ + +def sinh_(input: Tensor) -> Tensor: ... +def slice_copy( + input: Tensor, + dim: _int = 0, + start: _int | SymInt | None = None, + end: _int | SymInt | None = None, + step: _int | SymInt = 1, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.slice`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def slice_inverse( + input: Tensor, + src: Tensor, + dim: _int = 0, + start: _int | SymInt | None = None, + end: _int | SymInt | None = None, + step: _int | SymInt = 1, +) -> Tensor: ... +def slice_scatter( + input: Tensor, + src: Tensor, + dim: _int = 0, + start: _int | SymInt | None = None, + end: _int | SymInt | None = None, + step: _int | SymInt = 1, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + slice_scatter(input, src, dim=0, start=None, end=None, step=1) -> Tensor + + Embeds the values of the :attr:`src` tensor into :attr:`input` at the given + dimension. + This function returns a tensor with fresh storage; it does not create a view. + + + Args: + input (Tensor): the input tensor. + src (Tensor): The tensor to embed into :attr:`input` + dim (int): the dimension to insert the slice into + start (Optional[int]): the start index of where to insert the slice + end (Optional[int]): the end index of where to insert the slice + step (int): the how many elements to skip in + + Example:: + + >>> a = torch.zeros(8, 8) + >>> b = torch.ones(2, 8) + >>> a.slice_scatter(b, start=6) + tensor([[0., 0., 0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0., 0., 0.], + [1., 1., 1., 1., 1., 1., 1., 1.], + [1., 1., 1., 1., 1., 1., 1., 1.]]) + + >>> b = torch.ones(8, 2) + >>> a.slice_scatter(b, dim=1, start=2, end=6, step=2) + tensor([[0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.]]) + """ + +def slogdet( + input: Tensor, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.slogdet: + r""" + slogdet(input) -> (Tensor, Tensor) + + Alias for :func:`torch.linalg.slogdet` + """ + +def smm(input: Tensor, mat2: Tensor) -> Tensor: + r""" + smm(input, mat) -> Tensor + + Performs a matrix multiplication of the sparse matrix :attr:`input` + with the dense matrix :attr:`mat`. + + Args: + input (Tensor): a sparse matrix to be matrix multiplied + mat (Tensor): a dense matrix to be matrix multiplied + """ + +@overload +def softmax( + input: Tensor, + dim: _int, + dtype: _dtype | None = None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + softmax(input, dim, *, dtype=None) -> Tensor + + Alias for :func:`torch.nn.functional.softmax`. + """ + +@overload +def softmax( + input: Tensor, + dim: str | EllipsisType | None, + *, + dtype: _dtype | None = None, +) -> Tensor: + r""" + softmax(input, dim, *, dtype=None) -> Tensor + + Alias for :func:`torch.nn.functional.softmax`. + """ + +@overload +def sort( + input: Tensor, + *, + stable: _bool | None, + dim: _int = -1, + descending: _bool = False, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.sort: + r""" + sort(input, dim=-1, descending=False, *, stable=False, out=None) -> (Tensor, LongTensor) + + Sorts the elements of the :attr:`input` tensor along a given dimension + in ascending order by value. + + If :attr:`dim` is not given, the last dimension of the `input` is chosen. + + If :attr:`descending` is ``True`` then the elements are sorted in descending + order by value. + + If :attr:`stable` is ``True`` then the sorting routine becomes stable, preserving + the order of equivalent elements. + + A namedtuple of (values, indices) is returned, where the `values` are the + sorted values and `indices` are the indices of the elements in the original + `input` tensor. + + Args: + input (Tensor): the input tensor. + dim (int, optional): the dimension to sort along + descending (bool, optional): controls the sorting order (ascending or descending) + + Keyword args: + stable (bool, optional): makes the sorting routine stable, which guarantees that the order + of equivalent elements is preserved. + out (tuple, optional): the output tuple of (`Tensor`, `LongTensor`) that can + be optionally given to be used as output buffers + + Example:: + + >>> x = torch.randn(3, 4) + >>> sorted, indices = torch.sort(x) + >>> sorted + tensor([[-0.2162, 0.0608, 0.6719, 2.3332], + [-0.5793, 0.0061, 0.6058, 0.9497], + [-0.5071, 0.3343, 0.9553, 1.0960]]) + >>> indices + tensor([[ 1, 0, 2, 3], + [ 3, 1, 0, 2], + [ 0, 3, 1, 2]]) + + >>> sorted, indices = torch.sort(x, 0) + >>> sorted + tensor([[-0.5071, -0.2162, 0.6719, -0.5793], + [ 0.0608, 0.0061, 0.9497, 0.3343], + [ 0.6058, 0.9553, 1.0960, 2.3332]]) + >>> indices + tensor([[ 2, 0, 0, 1], + [ 0, 1, 1, 2], + [ 1, 2, 2, 0]]) + >>> x = torch.tensor([0, 1] * 9) + >>> x.sort() + torch.return_types.sort( + values=tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]), + indices=tensor([ 2, 16, 4, 6, 14, 8, 0, 10, 12, 9, 17, 15, 13, 11, 7, 5, 3, 1])) + >>> x.sort(stable=True) + torch.return_types.sort( + values=tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]), + indices=tensor([ 0, 2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15, 17])) + """ + +@overload +def sort( + input: Tensor, + dim: _int = -1, + descending: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.sort: + r""" + sort(input, dim=-1, descending=False, *, stable=False, out=None) -> (Tensor, LongTensor) + + Sorts the elements of the :attr:`input` tensor along a given dimension + in ascending order by value. + + If :attr:`dim` is not given, the last dimension of the `input` is chosen. + + If :attr:`descending` is ``True`` then the elements are sorted in descending + order by value. + + If :attr:`stable` is ``True`` then the sorting routine becomes stable, preserving + the order of equivalent elements. + + A namedtuple of (values, indices) is returned, where the `values` are the + sorted values and `indices` are the indices of the elements in the original + `input` tensor. + + Args: + input (Tensor): the input tensor. + dim (int, optional): the dimension to sort along + descending (bool, optional): controls the sorting order (ascending or descending) + + Keyword args: + stable (bool, optional): makes the sorting routine stable, which guarantees that the order + of equivalent elements is preserved. + out (tuple, optional): the output tuple of (`Tensor`, `LongTensor`) that can + be optionally given to be used as output buffers + + Example:: + + >>> x = torch.randn(3, 4) + >>> sorted, indices = torch.sort(x) + >>> sorted + tensor([[-0.2162, 0.0608, 0.6719, 2.3332], + [-0.5793, 0.0061, 0.6058, 0.9497], + [-0.5071, 0.3343, 0.9553, 1.0960]]) + >>> indices + tensor([[ 1, 0, 2, 3], + [ 3, 1, 0, 2], + [ 0, 3, 1, 2]]) + + >>> sorted, indices = torch.sort(x, 0) + >>> sorted + tensor([[-0.5071, -0.2162, 0.6719, -0.5793], + [ 0.0608, 0.0061, 0.9497, 0.3343], + [ 0.6058, 0.9553, 1.0960, 2.3332]]) + >>> indices + tensor([[ 2, 0, 0, 1], + [ 0, 1, 1, 2], + [ 1, 2, 2, 0]]) + >>> x = torch.tensor([0, 1] * 9) + >>> x.sort() + torch.return_types.sort( + values=tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]), + indices=tensor([ 2, 16, 4, 6, 14, 8, 0, 10, 12, 9, 17, 15, 13, 11, 7, 5, 3, 1])) + >>> x.sort(stable=True) + torch.return_types.sort( + values=tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]), + indices=tensor([ 0, 2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15, 17])) + """ + +@overload +def sort( + input: Tensor, + *, + stable: _bool | None, + dim: str | EllipsisType | None, + descending: _bool = False, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.sort: + r""" + sort(input, dim=-1, descending=False, *, stable=False, out=None) -> (Tensor, LongTensor) + + Sorts the elements of the :attr:`input` tensor along a given dimension + in ascending order by value. + + If :attr:`dim` is not given, the last dimension of the `input` is chosen. + + If :attr:`descending` is ``True`` then the elements are sorted in descending + order by value. + + If :attr:`stable` is ``True`` then the sorting routine becomes stable, preserving + the order of equivalent elements. + + A namedtuple of (values, indices) is returned, where the `values` are the + sorted values and `indices` are the indices of the elements in the original + `input` tensor. + + Args: + input (Tensor): the input tensor. + dim (int, optional): the dimension to sort along + descending (bool, optional): controls the sorting order (ascending or descending) + + Keyword args: + stable (bool, optional): makes the sorting routine stable, which guarantees that the order + of equivalent elements is preserved. + out (tuple, optional): the output tuple of (`Tensor`, `LongTensor`) that can + be optionally given to be used as output buffers + + Example:: + + >>> x = torch.randn(3, 4) + >>> sorted, indices = torch.sort(x) + >>> sorted + tensor([[-0.2162, 0.0608, 0.6719, 2.3332], + [-0.5793, 0.0061, 0.6058, 0.9497], + [-0.5071, 0.3343, 0.9553, 1.0960]]) + >>> indices + tensor([[ 1, 0, 2, 3], + [ 3, 1, 0, 2], + [ 0, 3, 1, 2]]) + + >>> sorted, indices = torch.sort(x, 0) + >>> sorted + tensor([[-0.5071, -0.2162, 0.6719, -0.5793], + [ 0.0608, 0.0061, 0.9497, 0.3343], + [ 0.6058, 0.9553, 1.0960, 2.3332]]) + >>> indices + tensor([[ 2, 0, 0, 1], + [ 0, 1, 1, 2], + [ 1, 2, 2, 0]]) + >>> x = torch.tensor([0, 1] * 9) + >>> x.sort() + torch.return_types.sort( + values=tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]), + indices=tensor([ 2, 16, 4, 6, 14, 8, 0, 10, 12, 9, 17, 15, 13, 11, 7, 5, 3, 1])) + >>> x.sort(stable=True) + torch.return_types.sort( + values=tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]), + indices=tensor([ 0, 2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15, 17])) + """ + +@overload +def sort( + input: Tensor, + dim: str | EllipsisType | None, + descending: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.sort: + r""" + sort(input, dim=-1, descending=False, *, stable=False, out=None) -> (Tensor, LongTensor) + + Sorts the elements of the :attr:`input` tensor along a given dimension + in ascending order by value. + + If :attr:`dim` is not given, the last dimension of the `input` is chosen. + + If :attr:`descending` is ``True`` then the elements are sorted in descending + order by value. + + If :attr:`stable` is ``True`` then the sorting routine becomes stable, preserving + the order of equivalent elements. + + A namedtuple of (values, indices) is returned, where the `values` are the + sorted values and `indices` are the indices of the elements in the original + `input` tensor. + + Args: + input (Tensor): the input tensor. + dim (int, optional): the dimension to sort along + descending (bool, optional): controls the sorting order (ascending or descending) + + Keyword args: + stable (bool, optional): makes the sorting routine stable, which guarantees that the order + of equivalent elements is preserved. + out (tuple, optional): the output tuple of (`Tensor`, `LongTensor`) that can + be optionally given to be used as output buffers + + Example:: + + >>> x = torch.randn(3, 4) + >>> sorted, indices = torch.sort(x) + >>> sorted + tensor([[-0.2162, 0.0608, 0.6719, 2.3332], + [-0.5793, 0.0061, 0.6058, 0.9497], + [-0.5071, 0.3343, 0.9553, 1.0960]]) + >>> indices + tensor([[ 1, 0, 2, 3], + [ 3, 1, 0, 2], + [ 0, 3, 1, 2]]) + + >>> sorted, indices = torch.sort(x, 0) + >>> sorted + tensor([[-0.5071, -0.2162, 0.6719, -0.5793], + [ 0.0608, 0.0061, 0.9497, 0.3343], + [ 0.6058, 0.9553, 1.0960, 2.3332]]) + >>> indices + tensor([[ 2, 0, 0, 1], + [ 0, 1, 1, 2], + [ 1, 2, 2, 0]]) + >>> x = torch.tensor([0, 1] * 9) + >>> x.sort() + torch.return_types.sort( + values=tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]), + indices=tensor([ 2, 16, 4, 6, 14, 8, 0, 10, 12, 9, 17, 15, 13, 11, 7, 5, 3, 1])) + >>> x.sort(stable=True) + torch.return_types.sort( + values=tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]), + indices=tensor([ 0, 2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15, 17])) + """ + +def sparse_bsc_tensor( + ccol_indices: Tensor | list, + row_indices: Tensor | list, + values: Tensor | list, + size: _size | None = None, + *, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + check_invariants: _bool | None = None, +) -> Tensor: + r""" + sparse_bsc_tensor(ccol_indices, row_indices, values, size=None, *, dtype=None, device=None, pin_memory=False, requires_grad=False, check_invariants=None) -> Tensor + + Constructs a :ref:`sparse tensor in BSC (Block Compressed Sparse + Column)) ` with specified 2-dimensional blocks at the + given :attr:`ccol_indices` and :attr:`row_indices`. Sparse matrix + multiplication operations in BSC format are typically faster than that + for sparse tensors in COO format. Make you have a look at :ref:`the + note on the data type of the indices `. + + .. note:: + + If the ``device`` argument is not specified the device of the given + :attr:`values` and indices tensor(s) must match. If, however, the + argument is specified the input Tensors will be converted to the + given device and in turn determine the device of the constructed + sparse tensor. + + Args: + ccol_indices (array_like): (B+1)-dimensional array of size + ``(*batchsize, ncolblocks + 1)``. The last element of each + batch is the number of non-zeros. This tensor encodes the + index in values and row_indices depending on where the given + column starts. Each successive number in the tensor subtracted + by the number before it denotes the number of elements in a + given column. + row_indices (array_like): Row block coordinates of each block in + values. (B+1)-dimensional tensor with the same length + as values. + values (array_list): Initial blocks for the tensor. Can be a list, + tuple, NumPy ``ndarray``, and other types that + represents a (1 + 2 + K)-dimensional tensor where ``K`` is the + number of dense dimensions. + size (list, tuple, :class:`torch.Size`, optional): Size of the + sparse tensor: ``(*batchsize, nrows * blocksize[0], ncols * + blocksize[1], *densesize)`` If not provided, the size will be + inferred as the minimum size big enough to hold all non-zero + blocks. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of + returned tensor. Default: if None, infers data type from + :attr:`values`. + device (:class:`torch.device`, optional): the desired device of + returned tensor. Default: if None, uses the current device + for the default tensor type (see + :func:`torch.set_default_device`). :attr:`device` will be + the CPU for CPU tensor types and the current CUDA device for + CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + check_invariants (bool, optional): If sparse tensor invariants are checked. + Default: as returned by :func:`torch.sparse.check_sparse_tensor_invariants.is_enabled`, + initially False. + + Example:: + + >>> ccol_indices = [0, 1, 2] + >>> row_indices = [0, 1] + >>> values = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] + >>> torch.sparse_bsc_tensor(torch.tensor(ccol_indices, dtype=torch.int64), + ... torch.tensor(row_indices, dtype=torch.int64), + ... torch.tensor(values), dtype=torch.double) + tensor(ccol_indices=tensor([0, 1, 2]), + row_indices=tensor([0, 1]), + values=tensor([[[1., 2.], + [3., 4.]], + [[5., 6.], + [7., 8.]]]), size=(2, 2), nnz=2, dtype=torch.float64, + layout=torch.sparse_bsc) + """ + +def sparse_bsr_tensor( + crow_indices: Tensor | list, + col_indices: Tensor | list, + values: Tensor | list, + size: _size | None = None, + *, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + check_invariants: _bool | None = None, +) -> Tensor: + r""" + sparse_bsr_tensor(crow_indices, col_indices, values, size=None, *, dtype=None, device=None, pin_memory=False, requires_grad=False, check_invariants=None) -> Tensor + + Constructs a :ref:`sparse tensor in BSR (Block Compressed Sparse Row)) + ` with specified 2-dimensional blocks at the given + :attr:`crow_indices` and :attr:`col_indices`. Sparse matrix + multiplication operations in BSR format are typically faster than that + for sparse tensors in COO format. Make you have a look at :ref:`the + note on the data type of the indices `. + + .. note:: + + If the ``device`` argument is not specified the device of the given + :attr:`values` and indices tensor(s) must match. If, however, the + argument is specified the input Tensors will be converted to the + given device and in turn determine the device of the constructed + sparse tensor. + + Args: + crow_indices (array_like): (B+1)-dimensional array of size + ``(*batchsize, nrowblocks + 1)``. The last element of each + batch is the number of non-zeros. This tensor encodes the + block index in values and col_indices depending on where the + given row block starts. Each successive number in the tensor + subtracted by the number before it denotes the number of + blocks in a given row. + col_indices (array_like): Column block coordinates of each block + in values. (B+1)-dimensional tensor with the same length as + values. + values (array_list): Initial values for the tensor. Can be a list, + tuple, NumPy ``ndarray``, scalar, and other types that + represents a (1 + 2 + K)-dimensional tensor where ``K`` is the + number of dense dimensions. + size (list, tuple, :class:`torch.Size`, optional): Size of the + sparse tensor: ``(*batchsize, nrows * blocksize[0], ncols * + blocksize[1], *densesize)`` where ``blocksize == + values.shape[1:3]``. If not provided, the size will be + inferred as the minimum size big enough to hold all non-zero + blocks. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of + returned tensor. Default: if None, infers data type from + :attr:`values`. + device (:class:`torch.device`, optional): the desired device of + returned tensor. Default: if None, uses the current device + for the default tensor type (see + :func:`torch.set_default_device`). :attr:`device` will be + the CPU for CPU tensor types and the current CUDA device for + CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + check_invariants (bool, optional): If sparse tensor invariants are checked. + Default: as returned by :func:`torch.sparse.check_sparse_tensor_invariants.is_enabled`, + initially False. + + Example:: + + >>> crow_indices = [0, 1, 2] + >>> col_indices = [0, 1] + >>> values = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] + >>> torch.sparse_bsr_tensor(torch.tensor(crow_indices, dtype=torch.int64), + ... torch.tensor(col_indices, dtype=torch.int64), + ... torch.tensor(values), dtype=torch.double) + tensor(crow_indices=tensor([0, 1, 2]), + col_indices=tensor([0, 1]), + values=tensor([[[1., 2.], + [3., 4.]], + [[5., 6.], + [7., 8.]]]), size=(2, 2), nnz=2, dtype=torch.float64, + layout=torch.sparse_bsr) + """ + +def sparse_compressed_tensor( + compressed_indices: Tensor | list, + plain_indices: Tensor | list, + values: Tensor | list, + size: _size | None = None, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + check_invariants: _bool | None = None, +) -> Tensor: + r""" + sparse_compressed_tensor(compressed_indices, plain_indices, values, size=None, *, dtype=None, layout=None, device=None, pin_memory=False, requires_grad=False, check_invariants=None) -> Tensor + + Constructs a :ref:`sparse tensor in Compressed Sparse format - CSR, + CSC, BSR, or BSC - ` with specified values at + the given :attr:`compressed_indices` and :attr:`plain_indices`. Sparse + matrix multiplication operations in Compressed Sparse format are + typically faster than that for sparse tensors in COO format. Make you + have a look at :ref:`the note on the data type of the indices + `. + + .. note:: + + If the ``device`` argument is not specified the device of the given + :attr:`values` and indices tensor(s) must match. If, however, the + argument is specified the input Tensors will be converted to the + given device and in turn determine the device of the constructed + sparse tensor. + + Args: + compressed_indices (array_like): (B+1)-dimensional array of size + ``(*batchsize, compressed_dim_size + 1)``. The last element of + each batch is the number of non-zero elements or blocks. This + tensor encodes the index in ``values`` and ``plain_indices`` + depending on where the given compressed dimension (row or + column) starts. Each successive number in the tensor + subtracted by the number before it denotes the number of + elements or blocks in a given compressed dimension. + plain_indices (array_like): Plain dimension (column or row) + coordinates of each element or block in values. (B+1)-dimensional + tensor with the same length as values. + + values (array_list): Initial values for the tensor. Can be a list, + tuple, NumPy ``ndarray``, scalar, and other types. that + represents a (1+K)-dimensional (for CSR and CSC layouts) or + (1+2+K)-dimensional tensor (for BSR and BSC layouts) where + ``K`` is the number of dense dimensions. + size (list, tuple, :class:`torch.Size`, optional): Size of the + sparse tensor: ``(*batchsize, nrows * blocksize[0], ncols * + blocksize[1], *densesize)`` where ``blocksize[0] == + blocksize[1] == 1`` for CSR and CSC formats. If not provided, + the size will be inferred as the minimum size big enough to + hold all non-zero elements or blocks. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of + returned tensor. Default: if None, infers data type from + :attr:`values`. + layout (:class:`torch.layout`, required): the desired layout of + returned tensor: :attr:`torch.sparse_csr`, + :attr:`torch.sparse_csc`, :attr:`torch.sparse_bsr`, or + :attr:`torch.sparse_bsc`. + device (:class:`torch.device`, optional): the desired device of + returned tensor. Default: if None, uses the current device + for the default tensor type (see + :func:`torch.set_default_device`). :attr:`device` will be + the CPU for CPU tensor types and the current CUDA device for + CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + check_invariants (bool, optional): If sparse tensor invariants are checked. + Default: as returned by :func:`torch.sparse.check_sparse_tensor_invariants.is_enabled`, + initially False. + + Example:: + + >>> compressed_indices = [0, 2, 4] + >>> plain_indices = [0, 1, 0, 1] + >>> values = [1, 2, 3, 4] + >>> torch.sparse_compressed_tensor(torch.tensor(compressed_indices, dtype=torch.int64), + ... torch.tensor(plain_indices, dtype=torch.int64), + ... torch.tensor(values), dtype=torch.double, layout=torch.sparse_csr) + tensor(crow_indices=tensor([0, 2, 4]), + col_indices=tensor([0, 1, 0, 1]), + values=tensor([1., 2., 3., 4.]), size=(2, 2), nnz=4, + dtype=torch.float64, layout=torch.sparse_csr) + """ + +def sparse_coo_tensor( + indices: Tensor, + values: Tensor | list, + size: _size | None = None, + *, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + check_invariants: _bool | None = None, + is_coalesced: _bool | None = None, +) -> Tensor: + r""" + sparse_coo_tensor(indices, values, size=None, *, dtype=None, device=None, pin_memory=False, requires_grad=False, check_invariants=None, is_coalesced=None) -> Tensor + + Constructs a :ref:`sparse tensor in COO(rdinate) format + ` with specified values at the given + :attr:`indices`. + + .. note:: + + This function returns an :ref:`uncoalesced tensor + ` when :attr:`is_coalesced` is + unspecified or ``None``. + + .. note:: + + If the ``device`` argument is not specified the device of the given + :attr:`values` and indices tensor(s) must match. If, however, the + argument is specified the input Tensors will be converted to the + given device and in turn determine the device of the constructed + sparse tensor. + + Args: + indices (array_like): Initial data for the tensor. Can be a list, tuple, + NumPy ``ndarray``, scalar, and other types. Will be cast to a :class:`torch.LongTensor` + internally. The indices are the coordinates of the non-zero values in the matrix, and thus + should be two-dimensional where the first dimension is the number of tensor dimensions and + the second dimension is the number of non-zero values. + values (array_like): Initial values for the tensor. Can be a list, tuple, + NumPy ``ndarray``, scalar, and other types. + size (list, tuple, or :class:`torch.Size`, optional): Size of the sparse tensor. If not + provided the size will be inferred as the minimum size big enough to hold all non-zero + elements. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if None, infers data type from :attr:`values`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if None, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + check_invariants (bool, optional): If sparse tensor invariants are checked. + Default: as returned by :func:`torch.sparse.check_sparse_tensor_invariants.is_enabled`, + initially False. + is_coalesced (bool, optional): When``True``, the caller is + responsible for providing tensor indices that correspond to a + coalesced tensor. If the :attr:`check_invariants` flag is + False, no error will be raised if the prerequisites are not + met and this will lead to silently incorrect results. To force + coalescion please use :meth:`coalesce` on the resulting + Tensor. + Default: None: except for trivial cases (e.g. nnz < 2) the + resulting Tensor has is_coalesced set to ``False```. + + Example:: + + >>> i = torch.tensor([[0, 1, 1], + ... [2, 0, 2]]) + >>> v = torch.tensor([3, 4, 5], dtype=torch.float32) + >>> torch.sparse_coo_tensor(i, v, [2, 4]) + tensor(indices=tensor([[0, 1, 1], + [2, 0, 2]]), + values=tensor([3., 4., 5.]), + size=(2, 4), nnz=3, layout=torch.sparse_coo) + + >>> torch.sparse_coo_tensor(i, v) # Shape inference + tensor(indices=tensor([[0, 1, 1], + [2, 0, 2]]), + values=tensor([3., 4., 5.]), + size=(2, 3), nnz=3, layout=torch.sparse_coo) + + >>> torch.sparse_coo_tensor(i, v, [2, 4], + ... dtype=torch.float64, + ... device=torch.device('cuda:0')) + tensor(indices=tensor([[0, 1, 1], + [2, 0, 2]]), + values=tensor([3., 4., 5.]), + device='cuda:0', size=(2, 4), nnz=3, dtype=torch.float64, + layout=torch.sparse_coo) + + # Create an empty sparse tensor with the following invariants: + # 1. sparse_dim + dense_dim = len(SparseTensor.shape) + # 2. SparseTensor._indices().shape = (sparse_dim, nnz) + # 3. SparseTensor._values().shape = (nnz, SparseTensor.shape[sparse_dim:]) + # + # For instance, to create an empty sparse tensor with nnz = 0, dense_dim = 0 and + # sparse_dim = 1 (hence indices is a 2D tensor of shape = (1, 0)) + >>> S = torch.sparse_coo_tensor(torch.empty([1, 0]), [], [1]) + tensor(indices=tensor([], size=(1, 0)), + values=tensor([], size=(0,)), + size=(1,), nnz=0, layout=torch.sparse_coo) + + # and to create an empty sparse tensor with nnz = 0, dense_dim = 1 and + # sparse_dim = 1 + >>> S = torch.sparse_coo_tensor(torch.empty([1, 0]), torch.empty([0, 2]), [1, 2]) + tensor(indices=tensor([], size=(1, 0)), + values=tensor([], size=(0, 2)), + size=(1, 2), nnz=0, layout=torch.sparse_coo) + + .. _torch.sparse: https://pytorch.org/docs/stable/sparse.html + """ + +def sparse_csc_tensor( + ccol_indices: Tensor | list, + row_indices: Tensor | list, + values: Tensor | list, + size: _size | None = None, + *, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + check_invariants: _bool | None = None, +) -> Tensor: + r""" + sparse_csc_tensor(ccol_indices, row_indices, values, size=None, *, dtype=None, device=None, pin_memory=False, requires_grad=False, check_invariants=None) -> Tensor + + Constructs a :ref:`sparse tensor in CSC (Compressed Sparse Column) + ` with specified values at the given + :attr:`ccol_indices` and :attr:`row_indices`. Sparse matrix + multiplication operations in CSC format are typically faster than that + for sparse tensors in COO format. Make you have a look at :ref:`the + note on the data type of the indices `. + + .. note:: + + If the ``device`` argument is not specified the device of the given + :attr:`values` and indices tensor(s) must match. If, however, the + argument is specified the input Tensors will be converted to the + given device and in turn determine the device of the constructed + sparse tensor. + + Args: + ccol_indices (array_like): (B+1)-dimensional array of size + ``(*batchsize, ncols + 1)``. The last element of each batch + is the number of non-zeros. This tensor encodes the index in + values and row_indices depending on where the given column + starts. Each successive number in the tensor subtracted by the + number before it denotes the number of elements in a given + column. + row_indices (array_like): Row coordinates of each element in + values. (B+1)-dimensional tensor with the same length as + values. + values (array_list): Initial values for the tensor. Can be a list, + tuple, NumPy ``ndarray``, scalar, and other types that + represents a (1+K)-dimensional tensor where ``K`` is the number + of dense dimensions. + size (list, tuple, :class:`torch.Size`, optional): Size of the + sparse tensor: ``(*batchsize, nrows, ncols, *densesize)``. If + not provided, the size will be inferred as the minimum size + big enough to hold all non-zero elements. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of + returned tensor. Default: if None, infers data type from + :attr:`values`. + device (:class:`torch.device`, optional): the desired device of + returned tensor. Default: if None, uses the current device + for the default tensor type (see + :func:`torch.set_default_device`). :attr:`device` will be + the CPU for CPU tensor types and the current CUDA device for + CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + check_invariants (bool, optional): If sparse tensor invariants are checked. + Default: as returned by :func:`torch.sparse.check_sparse_tensor_invariants.is_enabled`, + initially False. + + Example:: + + >>> ccol_indices = [0, 2, 4] + >>> row_indices = [0, 1, 0, 1] + >>> values = [1, 2, 3, 4] + >>> torch.sparse_csc_tensor(torch.tensor(ccol_indices, dtype=torch.int64), + ... torch.tensor(row_indices, dtype=torch.int64), + ... torch.tensor(values), dtype=torch.double) + tensor(ccol_indices=tensor([0, 2, 4]), + row_indices=tensor([0, 1, 0, 1]), + values=tensor([1., 2., 3., 4.]), size=(2, 2), nnz=4, + dtype=torch.float64, layout=torch.sparse_csc) + """ + +def sparse_csr_tensor( + crow_indices: Tensor | list, + col_indices: Tensor | list, + values: Tensor | list, + size: _size | None = None, + *, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + check_invariants: _bool | None = None, +) -> Tensor: + r""" + sparse_csr_tensor(crow_indices, col_indices, values, size=None, *, dtype=None, device=None, pin_memory=False, requires_grad=False, check_invariants=None) -> Tensor + + Constructs a :ref:`sparse tensor in CSR (Compressed Sparse Row) ` with specified + values at the given :attr:`crow_indices` and :attr:`col_indices`. Sparse matrix multiplication operations + in CSR format are typically faster than that for sparse tensors in COO format. Make you have a look + at :ref:`the note on the data type of the indices `. + + .. note:: + + If the ``device`` argument is not specified the device of the given + :attr:`values` and indices tensor(s) must match. If, however, the + argument is specified the input Tensors will be converted to the + given device and in turn determine the device of the constructed + sparse tensor. + + Args: + crow_indices (array_like): (B+1)-dimensional array of size + ``(*batchsize, nrows + 1)``. The last element of each batch + is the number of non-zeros. This tensor encodes the index in + values and col_indices depending on where the given row + starts. Each successive number in the tensor subtracted by the + number before it denotes the number of elements in a given + row. + col_indices (array_like): Column coordinates of each element in + values. (B+1)-dimensional tensor with the same length + as values. + values (array_list): Initial values for the tensor. Can be a list, + tuple, NumPy ``ndarray``, scalar, and other types that + represents a (1+K)-dimensional tensor where ``K`` is the number + of dense dimensions. + size (list, tuple, :class:`torch.Size`, optional): Size of the + sparse tensor: ``(*batchsize, nrows, ncols, *densesize)``. If + not provided, the size will be inferred as the minimum size + big enough to hold all non-zero elements. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of + returned tensor. Default: if None, infers data type from + :attr:`values`. + device (:class:`torch.device`, optional): the desired device of + returned tensor. Default: if None, uses the current device + for the default tensor type (see + :func:`torch.set_default_device`). :attr:`device` will be + the CPU for CPU tensor types and the current CUDA device for + CUDA tensor types. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + check_invariants (bool, optional): If sparse tensor invariants are checked. + Default: as returned by :func:`torch.sparse.check_sparse_tensor_invariants.is_enabled`, + initially False. + + Example:: + + >>> crow_indices = [0, 2, 4] + >>> col_indices = [0, 1, 0, 1] + >>> values = [1, 2, 3, 4] + >>> torch.sparse_csr_tensor(torch.tensor(crow_indices, dtype=torch.int64), + ... torch.tensor(col_indices, dtype=torch.int64), + ... torch.tensor(values), dtype=torch.double) + tensor(crow_indices=tensor([0, 2, 4]), + col_indices=tensor([0, 1, 0, 1]), + values=tensor([1., 2., 3., 4.]), size=(2, 2), nnz=4, + dtype=torch.float64, layout=torch.sparse_csr) + """ + +def split_copy( + input: Tensor, + split_size: _int | SymInt, + dim: _int = 0, + *, + out: tuple[Tensor, ...] | list[Tensor] | None = None, +) -> None: + r""" + Performs the same operation as :func:`torch.split`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def split_with_sizes( + input: Tensor, + split_sizes: Sequence[_int | SymInt], + dim: _int = 0, +) -> tuple[Tensor, ...]: ... +def split_with_sizes_copy( + input: Tensor, + split_sizes: Sequence[_int | SymInt], + dim: _int = 0, + *, + out: tuple[Tensor, ...] | list[Tensor] | None = None, +) -> None: + r""" + Performs the same operation as :func:`torch.split_with_sizes`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def spmm(input: Tensor, mat2: Tensor) -> Tensor: ... +def sqrt(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + sqrt(input, *, out=None) -> Tensor + + Returns a new tensor with the square-root of the elements of :attr:`input`. + + .. math:: + \text{out}_{i} = \sqrt{\text{input}_{i}} + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-2.0755, 1.0226, 0.0831, 0.4806]) + >>> torch.sqrt(a) + tensor([ nan, 1.0112, 0.2883, 0.6933]) + """ + +def sqrt_(input: Tensor) -> Tensor: ... +def square(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + square(input: Tensor, *, out: Optional[Tensor]) -> Tensor + + Returns a new tensor with the square of the elements of :attr:`input`. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-2.0755, 1.0226, 0.0831, 0.4806]) + >>> torch.square(a) + tensor([ 4.3077, 1.0457, 0.0069, 0.2310]) + """ + +def square_(input: Tensor) -> Tensor: ... +@overload +def squeeze(input: Tensor) -> Tensor: + r""" + squeeze(input: Tensor, dim: Optional[Union[int, List[int]]]) -> Tensor + + Returns a tensor with all specified dimensions of :attr:`input` of size `1` removed. + + For example, if `input` is of shape: + :math:`(A \times 1 \times B \times C \times 1 \times D)` then the `input.squeeze()` + will be of shape: :math:`(A \times B \times C \times D)`. + + When :attr:`dim` is given, a squeeze operation is done only in the given + dimension(s). If `input` is of shape: :math:`(A \times 1 \times B)`, + ``squeeze(input, 0)`` leaves the tensor unchanged, but ``squeeze(input, 1)`` + will squeeze the tensor to the shape :math:`(A \times B)`. + + .. note:: The returned tensor shares the storage with the input tensor, + so changing the contents of one will change the contents of the other. + + .. warning:: If the tensor has a batch dimension of size 1, then `squeeze(input)` + will also remove the batch dimension, which can lead to unexpected + errors. Consider specifying only the dims you wish to be squeezed. + + Args: + input (Tensor): the input tensor. + dim (int or tuple of ints, optional): if given, the input will be squeezed + only in the specified dimensions. + + .. versionchanged:: 2.0 + :attr:`dim` now accepts tuples of dimensions. + + Example:: + + >>> x = torch.zeros(2, 1, 2, 1, 2) + >>> x.size() + torch.Size([2, 1, 2, 1, 2]) + >>> y = torch.squeeze(x) + >>> y.size() + torch.Size([2, 2, 2]) + >>> y = torch.squeeze(x, 0) + >>> y.size() + torch.Size([2, 1, 2, 1, 2]) + >>> y = torch.squeeze(x, 1) + >>> y.size() + torch.Size([2, 2, 1, 2]) + >>> y = torch.squeeze(x, (1, 2, 3)) + torch.Size([2, 2, 2]) + """ + +@overload +def squeeze(input: Tensor, dim: _int) -> Tensor: + r""" + squeeze(input: Tensor, dim: Optional[Union[int, List[int]]]) -> Tensor + + Returns a tensor with all specified dimensions of :attr:`input` of size `1` removed. + + For example, if `input` is of shape: + :math:`(A \times 1 \times B \times C \times 1 \times D)` then the `input.squeeze()` + will be of shape: :math:`(A \times B \times C \times D)`. + + When :attr:`dim` is given, a squeeze operation is done only in the given + dimension(s). If `input` is of shape: :math:`(A \times 1 \times B)`, + ``squeeze(input, 0)`` leaves the tensor unchanged, but ``squeeze(input, 1)`` + will squeeze the tensor to the shape :math:`(A \times B)`. + + .. note:: The returned tensor shares the storage with the input tensor, + so changing the contents of one will change the contents of the other. + + .. warning:: If the tensor has a batch dimension of size 1, then `squeeze(input)` + will also remove the batch dimension, which can lead to unexpected + errors. Consider specifying only the dims you wish to be squeezed. + + Args: + input (Tensor): the input tensor. + dim (int or tuple of ints, optional): if given, the input will be squeezed + only in the specified dimensions. + + .. versionchanged:: 2.0 + :attr:`dim` now accepts tuples of dimensions. + + Example:: + + >>> x = torch.zeros(2, 1, 2, 1, 2) + >>> x.size() + torch.Size([2, 1, 2, 1, 2]) + >>> y = torch.squeeze(x) + >>> y.size() + torch.Size([2, 2, 2]) + >>> y = torch.squeeze(x, 0) + >>> y.size() + torch.Size([2, 1, 2, 1, 2]) + >>> y = torch.squeeze(x, 1) + >>> y.size() + torch.Size([2, 2, 1, 2]) + >>> y = torch.squeeze(x, (1, 2, 3)) + torch.Size([2, 2, 2]) + """ + +@overload +def squeeze(input: Tensor, dim: _size) -> Tensor: + r""" + squeeze(input: Tensor, dim: Optional[Union[int, List[int]]]) -> Tensor + + Returns a tensor with all specified dimensions of :attr:`input` of size `1` removed. + + For example, if `input` is of shape: + :math:`(A \times 1 \times B \times C \times 1 \times D)` then the `input.squeeze()` + will be of shape: :math:`(A \times B \times C \times D)`. + + When :attr:`dim` is given, a squeeze operation is done only in the given + dimension(s). If `input` is of shape: :math:`(A \times 1 \times B)`, + ``squeeze(input, 0)`` leaves the tensor unchanged, but ``squeeze(input, 1)`` + will squeeze the tensor to the shape :math:`(A \times B)`. + + .. note:: The returned tensor shares the storage with the input tensor, + so changing the contents of one will change the contents of the other. + + .. warning:: If the tensor has a batch dimension of size 1, then `squeeze(input)` + will also remove the batch dimension, which can lead to unexpected + errors. Consider specifying only the dims you wish to be squeezed. + + Args: + input (Tensor): the input tensor. + dim (int or tuple of ints, optional): if given, the input will be squeezed + only in the specified dimensions. + + .. versionchanged:: 2.0 + :attr:`dim` now accepts tuples of dimensions. + + Example:: + + >>> x = torch.zeros(2, 1, 2, 1, 2) + >>> x.size() + torch.Size([2, 1, 2, 1, 2]) + >>> y = torch.squeeze(x) + >>> y.size() + torch.Size([2, 2, 2]) + >>> y = torch.squeeze(x, 0) + >>> y.size() + torch.Size([2, 1, 2, 1, 2]) + >>> y = torch.squeeze(x, 1) + >>> y.size() + torch.Size([2, 2, 1, 2]) + >>> y = torch.squeeze(x, (1, 2, 3)) + torch.Size([2, 2, 2]) + """ + +@overload +def squeeze(input: Tensor, dim: str | EllipsisType | None) -> Tensor: + r""" + squeeze(input: Tensor, dim: Optional[Union[int, List[int]]]) -> Tensor + + Returns a tensor with all specified dimensions of :attr:`input` of size `1` removed. + + For example, if `input` is of shape: + :math:`(A \times 1 \times B \times C \times 1 \times D)` then the `input.squeeze()` + will be of shape: :math:`(A \times B \times C \times D)`. + + When :attr:`dim` is given, a squeeze operation is done only in the given + dimension(s). If `input` is of shape: :math:`(A \times 1 \times B)`, + ``squeeze(input, 0)`` leaves the tensor unchanged, but ``squeeze(input, 1)`` + will squeeze the tensor to the shape :math:`(A \times B)`. + + .. note:: The returned tensor shares the storage with the input tensor, + so changing the contents of one will change the contents of the other. + + .. warning:: If the tensor has a batch dimension of size 1, then `squeeze(input)` + will also remove the batch dimension, which can lead to unexpected + errors. Consider specifying only the dims you wish to be squeezed. + + Args: + input (Tensor): the input tensor. + dim (int or tuple of ints, optional): if given, the input will be squeezed + only in the specified dimensions. + + .. versionchanged:: 2.0 + :attr:`dim` now accepts tuples of dimensions. + + Example:: + + >>> x = torch.zeros(2, 1, 2, 1, 2) + >>> x.size() + torch.Size([2, 1, 2, 1, 2]) + >>> y = torch.squeeze(x) + >>> y.size() + torch.Size([2, 2, 2]) + >>> y = torch.squeeze(x, 0) + >>> y.size() + torch.Size([2, 1, 2, 1, 2]) + >>> y = torch.squeeze(x, 1) + >>> y.size() + torch.Size([2, 2, 1, 2]) + >>> y = torch.squeeze(x, (1, 2, 3)) + torch.Size([2, 2, 2]) + """ + +@overload +def squeeze_copy(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + Performs the same operation as :func:`torch.squeeze`, but all output tensors + are freshly created instead of aliasing the input. + """ + +@overload +def squeeze_copy( + input: Tensor, + dim: _int, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.squeeze`, but all output tensors + are freshly created instead of aliasing the input. + """ + +@overload +def squeeze_copy( + input: Tensor, + dim: _size, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.squeeze`, but all output tensors + are freshly created instead of aliasing the input. + """ + +@overload +def sspaddmm( + beta: Number | _complex, + self: Tensor, + alpha: Number | _complex, + mat1: Tensor, + mat2: Tensor, +) -> Tensor: + r""" + sspaddmm(input, mat1, mat2, *, beta=1, alpha=1, out=None) -> Tensor + + Matrix multiplies a sparse tensor :attr:`mat1` with a dense tensor + :attr:`mat2`, then adds the sparse tensor :attr:`input` to the result. + + Note: This function is equivalent to :func:`torch.addmm`, except + :attr:`input` and :attr:`mat1` are sparse. + + Args: + input (Tensor): a sparse matrix to be added + mat1 (Tensor): a sparse matrix to be matrix multiplied + mat2 (Tensor): a dense matrix to be matrix multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`mat` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + """ + +@overload +def sspaddmm( + input: Tensor, + mat1: Tensor, + mat2: Tensor, + *, + beta: Number | _complex = 1, + alpha: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + sspaddmm(input, mat1, mat2, *, beta=1, alpha=1, out=None) -> Tensor + + Matrix multiplies a sparse tensor :attr:`mat1` with a dense tensor + :attr:`mat2`, then adds the sparse tensor :attr:`input` to the result. + + Note: This function is equivalent to :func:`torch.addmm`, except + :attr:`input` and :attr:`mat1` are sparse. + + Args: + input (Tensor): a sparse matrix to be added + mat1 (Tensor): a sparse matrix to be matrix multiplied + mat2 (Tensor): a dense matrix to be matrix multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`mat` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + """ + +@overload +def sspaddmm( + beta: Number | _complex, + self: Tensor, + mat1: Tensor, + mat2: Tensor, +) -> Tensor: + r""" + sspaddmm(input, mat1, mat2, *, beta=1, alpha=1, out=None) -> Tensor + + Matrix multiplies a sparse tensor :attr:`mat1` with a dense tensor + :attr:`mat2`, then adds the sparse tensor :attr:`input` to the result. + + Note: This function is equivalent to :func:`torch.addmm`, except + :attr:`input` and :attr:`mat1` are sparse. + + Args: + input (Tensor): a sparse matrix to be added + mat1 (Tensor): a sparse matrix to be matrix multiplied + mat2 (Tensor): a dense matrix to be matrix multiplied + + Keyword args: + beta (Number, optional): multiplier for :attr:`mat` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\alpha`) + out (Tensor, optional): the output tensor. + """ + +def stack( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + dim: _int = 0, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + stack(tensors, dim=0, *, out=None) -> Tensor + + Concatenates a sequence of tensors along a new dimension. + + All tensors need to be of the same size. + + .. seealso:: + + :func:`torch.cat` concatenates the given sequence along an existing dimension. + + Arguments: + tensors (sequence of Tensors): sequence of tensors to concatenate + dim (int, optional): dimension to insert. Has to be between 0 and the number + of dimensions of concatenated tensors (inclusive). Default: 0 + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> x = torch.randn(2, 3) + >>> x + tensor([[ 0.3367, 0.1288, 0.2345], + [ 0.2303, -1.1229, -0.1863]]) + >>> torch.stack((x, x)) # same as torch.stack((x, x), dim=0) + tensor([[[ 0.3367, 0.1288, 0.2345], + [ 0.2303, -1.1229, -0.1863]], + + [[ 0.3367, 0.1288, 0.2345], + [ 0.2303, -1.1229, -0.1863]]]) + >>> torch.stack((x, x)).size() + torch.Size([2, 2, 3]) + >>> torch.stack((x, x), dim=1) + tensor([[[ 0.3367, 0.1288, 0.2345], + [ 0.3367, 0.1288, 0.2345]], + + [[ 0.2303, -1.1229, -0.1863], + [ 0.2303, -1.1229, -0.1863]]]) + >>> torch.stack((x, x), dim=2) + tensor([[[ 0.3367, 0.3367], + [ 0.1288, 0.1288], + [ 0.2345, 0.2345]], + + [[ 0.2303, 0.2303], + [-1.1229, -1.1229], + [-0.1863, -0.1863]]]) + >>> torch.stack((x, x), dim=-1) + tensor([[[ 0.3367, 0.3367], + [ 0.1288, 0.1288], + [ 0.2345, 0.2345]], + + [[ 0.2303, 0.2303], + [-1.1229, -1.1229], + [-0.1863, -0.1863]]]) + """ + +@overload +def std( + input: Tensor, + dim: _int | _size | None, + unbiased: _bool = True, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + std(input, dim=None, *, correction=1, keepdim=False, out=None) -> Tensor + + Calculates the standard deviation over the dimensions specified by :attr:`dim`. + :attr:`dim` can be a single dimension, list of dimensions, or ``None`` to + reduce over all dimensions. + + The standard deviation (:math:`\sigma`) is calculated as + + .. math:: \sigma = \sqrt{\frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2} + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.std(a, dim=1, keepdim=True) + tensor([[1.0311], + [0.7477], + [1.2204], + [0.9087]]) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def std( + input: Tensor, + dim: _int | _size | None = None, + *, + correction: Number | _complex | None = None, + keepdim: _bool = False, + out: Tensor | None = None, +) -> Tensor: + r""" + std(input, dim=None, *, correction=1, keepdim=False, out=None) -> Tensor + + Calculates the standard deviation over the dimensions specified by :attr:`dim`. + :attr:`dim` can be a single dimension, list of dimensions, or ``None`` to + reduce over all dimensions. + + The standard deviation (:math:`\sigma`) is calculated as + + .. math:: \sigma = \sqrt{\frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2} + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.std(a, dim=1, keepdim=True) + tensor([[1.0311], + [0.7477], + [1.2204], + [0.9087]]) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def std(input: Tensor, unbiased: _bool = True) -> Tensor: + r""" + std(input, dim=None, *, correction=1, keepdim=False, out=None) -> Tensor + + Calculates the standard deviation over the dimensions specified by :attr:`dim`. + :attr:`dim` can be a single dimension, list of dimensions, or ``None`` to + reduce over all dimensions. + + The standard deviation (:math:`\sigma`) is calculated as + + .. math:: \sigma = \sqrt{\frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2} + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.std(a, dim=1, keepdim=True) + tensor([[1.0311], + [0.7477], + [1.2204], + [0.9087]]) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def std( + input: Tensor, + dim: Sequence[str | EllipsisType | None], + *, + correction: Number | _complex | None = None, + keepdim: _bool = False, + out: Tensor | None = None, +) -> Tensor: + r""" + std(input, dim=None, *, correction=1, keepdim=False, out=None) -> Tensor + + Calculates the standard deviation over the dimensions specified by :attr:`dim`. + :attr:`dim` can be a single dimension, list of dimensions, or ``None`` to + reduce over all dimensions. + + The standard deviation (:math:`\sigma`) is calculated as + + .. math:: \sigma = \sqrt{\frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2} + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.std(a, dim=1, keepdim=True) + tensor([[1.0311], + [0.7477], + [1.2204], + [0.9087]]) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def std( + input: Tensor, + dim: Sequence[str | EllipsisType | None], + unbiased: _bool = True, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + std(input, dim=None, *, correction=1, keepdim=False, out=None) -> Tensor + + Calculates the standard deviation over the dimensions specified by :attr:`dim`. + :attr:`dim` can be a single dimension, list of dimensions, or ``None`` to + reduce over all dimensions. + + The standard deviation (:math:`\sigma`) is calculated as + + .. math:: \sigma = \sqrt{\frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2} + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.std(a, dim=1, keepdim=True) + tensor([[1.0311], + [0.7477], + [1.2204], + [0.9087]]) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def std_mean( + input: Tensor, + dim: _int | _size | None, + unbiased: _bool = True, + keepdim: _bool = False, +) -> tuple[Tensor, Tensor]: + r""" + std_mean(input, dim=None, *, correction=1, keepdim=False, out=None) -> (Tensor, Tensor) + + Calculates the standard deviation and mean over the dimensions specified by + :attr:`dim`. :attr:`dim` can be a single dimension, list of dimensions, or + ``None`` to reduce over all dimensions. + + The standard deviation (:math:`\sigma`) is calculated as + + .. math:: \sigma = \sqrt{\frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2} + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Returns: + A tuple (std, mean) containing the standard deviation and mean. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.std_mean(a, dim=0, keepdim=True) + (tensor([[1.2620, 1.0028, 1.0957, 0.6038]]), + tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]])) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def std_mean( + input: Tensor, + dim: _int | _size | None = None, + *, + correction: Number | _complex | None = None, + keepdim: _bool = False, +) -> tuple[Tensor, Tensor]: + r""" + std_mean(input, dim=None, *, correction=1, keepdim=False, out=None) -> (Tensor, Tensor) + + Calculates the standard deviation and mean over the dimensions specified by + :attr:`dim`. :attr:`dim` can be a single dimension, list of dimensions, or + ``None`` to reduce over all dimensions. + + The standard deviation (:math:`\sigma`) is calculated as + + .. math:: \sigma = \sqrt{\frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2} + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Returns: + A tuple (std, mean) containing the standard deviation and mean. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.std_mean(a, dim=0, keepdim=True) + (tensor([[1.2620, 1.0028, 1.0957, 0.6038]]), + tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]])) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def std_mean( + input: Tensor, + unbiased: _bool = True, +) -> tuple[Tensor, Tensor]: + r""" + std_mean(input, dim=None, *, correction=1, keepdim=False, out=None) -> (Tensor, Tensor) + + Calculates the standard deviation and mean over the dimensions specified by + :attr:`dim`. :attr:`dim` can be a single dimension, list of dimensions, or + ``None`` to reduce over all dimensions. + + The standard deviation (:math:`\sigma`) is calculated as + + .. math:: \sigma = \sqrt{\frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2} + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Returns: + A tuple (std, mean) containing the standard deviation and mean. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.std_mean(a, dim=0, keepdim=True) + (tensor([[1.2620, 1.0028, 1.0957, 0.6038]]), + tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]])) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def std_mean( + input: Tensor, + dim: Sequence[str | EllipsisType | None], + *, + correction: Number | _complex | None = None, + keepdim: _bool = False, +) -> tuple[Tensor, Tensor]: + r""" + std_mean(input, dim=None, *, correction=1, keepdim=False, out=None) -> (Tensor, Tensor) + + Calculates the standard deviation and mean over the dimensions specified by + :attr:`dim`. :attr:`dim` can be a single dimension, list of dimensions, or + ``None`` to reduce over all dimensions. + + The standard deviation (:math:`\sigma`) is calculated as + + .. math:: \sigma = \sqrt{\frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2} + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Returns: + A tuple (std, mean) containing the standard deviation and mean. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.std_mean(a, dim=0, keepdim=True) + (tensor([[1.2620, 1.0028, 1.0957, 0.6038]]), + tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]])) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def std_mean( + input: Tensor, + dim: Sequence[str | EllipsisType | None], + unbiased: _bool = True, + keepdim: _bool = False, +) -> tuple[Tensor, Tensor]: + r""" + std_mean(input, dim=None, *, correction=1, keepdim=False, out=None) -> (Tensor, Tensor) + + Calculates the standard deviation and mean over the dimensions specified by + :attr:`dim`. :attr:`dim` can be a single dimension, list of dimensions, or + ``None`` to reduce over all dimensions. + + The standard deviation (:math:`\sigma`) is calculated as + + .. math:: \sigma = \sqrt{\frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2} + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Returns: + A tuple (std, mean) containing the standard deviation and mean. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.std_mean(a, dim=0, keepdim=True) + (tensor([[1.2620, 1.0028, 1.0957, 0.6038]]), + tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]])) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def sub( + input: Tensor | Number | _complex, + other: Tensor | Number | _complex, + *, + alpha: Number | _complex | None = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + sub(input, other, *, alpha=1, out=None) -> Tensor + + Subtracts :attr:`other`, scaled by :attr:`alpha`, from :attr:`input`. + + .. math:: + \text{{out}}_i = \text{{input}}_i - \text{{alpha}} \times \text{{other}}_i + + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer, float, and complex inputs. + + Args: + input (Tensor): the input tensor. + other (Tensor or Number): the tensor or number to subtract from :attr:`input`. + + Keyword args: + alpha (Number): the multiplier for :attr:`other`. + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor((1, 2)) + >>> b = torch.tensor((0, 1)) + >>> torch.sub(a, b, alpha=2) + tensor([1, 0]) + """ + +@overload +def sub(self: Tensor, alpha: Number | _complex, other: Tensor) -> Tensor: + r""" + sub(input, other, *, alpha=1, out=None) -> Tensor + + Subtracts :attr:`other`, scaled by :attr:`alpha`, from :attr:`input`. + + .. math:: + \text{{out}}_i = \text{{input}}_i - \text{{alpha}} \times \text{{other}}_i + + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer, float, and complex inputs. + + Args: + input (Tensor): the input tensor. + other (Tensor or Number): the tensor or number to subtract from :attr:`input`. + + Keyword args: + alpha (Number): the multiplier for :attr:`other`. + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor((1, 2)) + >>> b = torch.tensor((0, 1)) + >>> torch.sub(a, b, alpha=2) + tensor([1, 0]) + """ + +@overload +def sub( + self: Tensor, + alpha: Number | _complex, + other: Tensor, + *, + out: Tensor, +) -> Tensor: + r""" + sub(input, other, *, alpha=1, out=None) -> Tensor + + Subtracts :attr:`other`, scaled by :attr:`alpha`, from :attr:`input`. + + .. math:: + \text{{out}}_i = \text{{input}}_i - \text{{alpha}} \times \text{{other}}_i + + + Supports :ref:`broadcasting to a common shape `, + :ref:`type promotion `, and integer, float, and complex inputs. + + Args: + input (Tensor): the input tensor. + other (Tensor or Number): the tensor or number to subtract from :attr:`input`. + + Keyword args: + alpha (Number): the multiplier for :attr:`other`. + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor((1, 2)) + >>> b = torch.tensor((0, 1)) + >>> torch.sub(a, b, alpha=2) + tensor([1, 0]) + """ + +@overload +def subtract( + input: Tensor, + other: Tensor, + *, + alpha: Number | _complex = 1, + out: Tensor | None = None, +) -> Tensor: + r""" + subtract(input, other, *, alpha=1, out=None) -> Tensor + + Alias for :func:`torch.sub`. + """ + +@overload +def subtract( + input: Tensor, + other: Number | _complex, + alpha: Number | _complex = 1, +) -> Tensor: + r""" + subtract(input, other, *, alpha=1, out=None) -> Tensor + + Alias for :func:`torch.sub`. + """ + +@overload +def sum(input: Tensor, *, dtype: _dtype | None = None) -> Tensor: + r""" + sum(input, *, dtype=None) -> Tensor + + Returns the sum of all elements in the :attr:`input` tensor. + + Args: + input (Tensor): the input tensor. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + .. note:: Use the `dtype` argument if you need the result in a specific tensor type. + Otherwise, the result type may be automatically promoted (e.g., from `torch.int32` to `torch.int64`). + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.1133, -0.9567, 0.2958]]) + >>> torch.sum(a) + tensor(-0.5475) + + .. function:: sum(input, dim, keepdim=False, *, dtype=None) -> Tensor + :noindex: + + Returns the sum of each row of the :attr:`input` tensor in the given + dimension :attr:`dim`. If :attr:`dim` is a list of dimensions, + reduce over all of them. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.0569, -0.2475, 0.0737, -0.3429], + [-0.2993, 0.9138, 0.9337, -1.6864], + [ 0.1132, 0.7892, -0.1003, 0.5688], + [ 0.3637, -0.9906, -0.4752, -1.5197]]) + >>> torch.sum(a, 1) + tensor([-0.4598, -0.1381, 1.3708, -2.6217]) + >>> b = torch.arange(4 * 5 * 6).view(4, 5, 6) + >>> torch.sum(b, (2, 1)) + tensor([ 435., 1335., 2235., 3135.]) + """ + +@overload +def sum( + input: Tensor, + dim: _int | _size | None, + keepdim: _bool = False, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + sum(input, *, dtype=None) -> Tensor + + Returns the sum of all elements in the :attr:`input` tensor. + + Args: + input (Tensor): the input tensor. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + .. note:: Use the `dtype` argument if you need the result in a specific tensor type. + Otherwise, the result type may be automatically promoted (e.g., from `torch.int32` to `torch.int64`). + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.1133, -0.9567, 0.2958]]) + >>> torch.sum(a) + tensor(-0.5475) + + .. function:: sum(input, dim, keepdim=False, *, dtype=None) -> Tensor + :noindex: + + Returns the sum of each row of the :attr:`input` tensor in the given + dimension :attr:`dim`. If :attr:`dim` is a list of dimensions, + reduce over all of them. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.0569, -0.2475, 0.0737, -0.3429], + [-0.2993, 0.9138, 0.9337, -1.6864], + [ 0.1132, 0.7892, -0.1003, 0.5688], + [ 0.3637, -0.9906, -0.4752, -1.5197]]) + >>> torch.sum(a, 1) + tensor([-0.4598, -0.1381, 1.3708, -2.6217]) + >>> b = torch.arange(4 * 5 * 6).view(4, 5, 6) + >>> torch.sum(b, (2, 1)) + tensor([ 435., 1335., 2235., 3135.]) + """ + +@overload +def sum( + input: Tensor, + dim: Sequence[str | EllipsisType | None], + keepdim: _bool = False, + *, + dtype: _dtype | None = None, + out: Tensor | None = None, +) -> Tensor: + r""" + sum(input, *, dtype=None) -> Tensor + + Returns the sum of all elements in the :attr:`input` tensor. + + Args: + input (Tensor): the input tensor. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + .. note:: Use the `dtype` argument if you need the result in a specific tensor type. + Otherwise, the result type may be automatically promoted (e.g., from `torch.int32` to `torch.int64`). + + Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.1133, -0.9567, 0.2958]]) + >>> torch.sum(a) + tensor(-0.5475) + + .. function:: sum(input, dim, keepdim=False, *, dtype=None) -> Tensor + :noindex: + + Returns the sum of each row of the :attr:`input` tensor in the given + dimension :attr:`dim`. If :attr:`dim` is a list of dimensions, + reduce over all of them. + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + + Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.0569, -0.2475, 0.0737, -0.3429], + [-0.2993, 0.9138, 0.9337, -1.6864], + [ 0.1132, 0.7892, -0.1003, 0.5688], + [ 0.3637, -0.9906, -0.4752, -1.5197]]) + >>> torch.sum(a, 1) + tensor([-0.4598, -0.1381, 1.3708, -2.6217]) + >>> b = torch.arange(4 * 5 * 6).view(4, 5, 6) + >>> torch.sum(b, (2, 1)) + tensor([ 435., 1335., 2235., 3135.]) + """ + +def svd( + input: Tensor, + some: _bool = True, + compute_uv: _bool = True, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.svd: + r""" + svd(input, some=True, compute_uv=True, *, out=None) -> (Tensor, Tensor, Tensor) + + Computes the singular value decomposition of either a matrix or batch of + matrices :attr:`input`. The singular value decomposition is represented as a + namedtuple `(U, S, V)`, such that :attr:`input` :math:`= U \text{diag}(S) V^{\text{H}}`. + where :math:`V^{\text{H}}` is the transpose of `V` for real inputs, + and the conjugate transpose of `V` for complex inputs. + If :attr:`input` is a batch of matrices, then `U`, `S`, and `V` are also + batched with the same batch dimensions as :attr:`input`. + + If :attr:`some` is `True` (default), the method returns the reduced singular + value decomposition. In this case, if the last two dimensions of :attr:`input` are + `m` and `n`, then the returned `U` and `V` matrices will contain only + `min(n, m)` orthonormal columns. + + If :attr:`compute_uv` is `False`, the returned `U` and `V` will be + zero-filled matrices of shape `(m, m)` and `(n, n)` + respectively, and the same device as :attr:`input`. The argument :attr:`some` + has no effect when :attr:`compute_uv` is `False`. + + Supports :attr:`input` of float, double, cfloat and cdouble data types. + The dtypes of `U` and `V` are the same as :attr:`input`'s. `S` will + always be real-valued, even if :attr:`input` is complex. + + .. warning:: + + :func:`torch.svd` is deprecated in favor of :func:`torch.linalg.svd` + and will be removed in a future PyTorch release. + + ``U, S, V = torch.svd(A, some=some, compute_uv=True)`` (default) should be replaced with + + .. code:: python + + U, S, Vh = torch.linalg.svd(A, full_matrices=not some) + V = Vh.mH + + ``_, S, _ = torch.svd(A, some=some, compute_uv=False)`` should be replaced with + + .. code:: python + + S = torch.linalg.svdvals(A) + + .. note:: Differences with :func:`torch.linalg.svd`: + + * :attr:`some` is the opposite of + :func:`torch.linalg.svd`'s :attr:`full_matrices`. Note that + default value for both is `True`, so the default behavior is + effectively the opposite. + * :func:`torch.svd` returns `V`, whereas :func:`torch.linalg.svd` returns + `Vh`, that is, :math:`V^{\text{H}}`. + * If :attr:`compute_uv` is `False`, :func:`torch.svd` returns zero-filled + tensors for `U` and `Vh`, whereas :func:`torch.linalg.svd` returns + empty tensors. + + .. note:: The singular values are returned in descending order. If :attr:`input` is a batch of matrices, + then the singular values of each matrix in the batch are returned in descending order. + + .. note:: The `S` tensor can only be used to compute gradients if :attr:`compute_uv` is `True`. + + .. note:: When :attr:`some` is `False`, the gradients on `U[..., :, min(m, n):]` + and `V[..., :, min(m, n):]` will be ignored in the backward pass, as those vectors + can be arbitrary bases of the corresponding subspaces. + + .. note:: The implementation of :func:`torch.linalg.svd` on CPU uses LAPACK's routine `?gesdd` + (a divide-and-conquer algorithm) instead of `?gesvd` for speed. Analogously, + on GPU, it uses cuSOLVER's routines `gesvdj` and `gesvdjBatched` on CUDA 10.1.243 + and later, and MAGMA's routine `gesdd` on earlier versions of CUDA. + + .. note:: The returned `U` will not be contiguous. The matrix (or batch of matrices) will + be represented as a column-major matrix (i.e. Fortran-contiguous). + + .. warning:: The gradients with respect to `U` and `V` will only be finite when the input does not + have zero nor repeated singular values. + + .. warning:: If the distance between any two singular values is close to zero, the gradients with respect to + `U` and `V` will be numerically unstable, as they depends on + :math:`\frac{1}{\min_{i \neq j} \sigma_i^2 - \sigma_j^2}`. The same happens when the matrix + has small singular values, as these gradients also depend on `S^{-1}`. + + .. warning:: For complex-valued :attr:`input` the singular value decomposition is not unique, + as `U` and `V` may be multiplied by an arbitrary phase factor :math:`e^{i \phi}` on every column. + The same happens when :attr:`input` has repeated singular values, where one may multiply + the columns of the spanning subspace in `U` and `V` by a rotation matrix + and `the resulting vectors will span the same subspace`_. + Different platforms, like NumPy, or inputs on different device types, + may produce different `U` and `V` tensors. + + Args: + input (Tensor): the input tensor of size `(*, m, n)` where `*` is zero or more + batch dimensions consisting of `(m, n)` matrices. + some (bool, optional): controls whether to compute the reduced or full decomposition, and + consequently, the shape of returned `U` and `V`. Default: `True`. + compute_uv (bool, optional): controls whether to compute `U` and `V`. Default: `True`. + + Keyword args: + out (tuple, optional): the output tuple of tensors + + Example:: + + >>> a = torch.randn(5, 3) + >>> a + tensor([[ 0.2364, -0.7752, 0.6372], + [ 1.7201, 0.7394, -0.0504], + [-0.3371, -1.0584, 0.5296], + [ 0.3550, -0.4022, 1.5569], + [ 0.2445, -0.0158, 1.1414]]) + >>> u, s, v = torch.svd(a) + >>> u + tensor([[ 0.4027, 0.0287, 0.5434], + [-0.1946, 0.8833, 0.3679], + [ 0.4296, -0.2890, 0.5261], + [ 0.6604, 0.2717, -0.2618], + [ 0.4234, 0.2481, -0.4733]]) + >>> s + tensor([2.3289, 2.0315, 0.7806]) + >>> v + tensor([[-0.0199, 0.8766, 0.4809], + [-0.5080, 0.4054, -0.7600], + [ 0.8611, 0.2594, -0.4373]]) + >>> torch.dist(a, torch.mm(torch.mm(u, torch.diag(s)), v.t())) + tensor(8.6531e-07) + >>> a_big = torch.randn(7, 5, 3) + >>> u, s, v = torch.svd(a_big) + >>> torch.dist(a_big, torch.matmul(torch.matmul(u, torch.diag_embed(s)), v.mT)) + tensor(2.6503e-06) + + .. _the resulting vectors will span the same subspace: + (https://en.wikipedia.org/wiki/Singular_value_decomposition#Singular_values,_singular_vectors,_and_their_relation_to_the_SVD) + """ + +def swapaxes(input: Tensor, axis0: _int, axis1: _int) -> Tensor: + r""" + swapaxes(input, axis0, axis1) -> Tensor + + Alias for :func:`torch.transpose`. + + This function is equivalent to NumPy's swapaxes function. + + Examples:: + + >>> x = torch.tensor([[[0,1],[2,3]],[[4,5],[6,7]]]) + >>> x + tensor([[[0, 1], + [2, 3]], + + [[4, 5], + [6, 7]]]) + >>> torch.swapaxes(x, 0, 1) + tensor([[[0, 1], + [4, 5]], + + [[2, 3], + [6, 7]]]) + >>> torch.swapaxes(x, 0, 2) + tensor([[[0, 4], + [2, 6]], + + [[1, 5], + [3, 7]]]) + """ + +def swapdims(input: Tensor, dim0: _int, dim1: _int) -> Tensor: + r""" + swapdims(input, dim0, dim1) -> Tensor + + Alias for :func:`torch.transpose`. + + This function is equivalent to NumPy's swapaxes function. + + Examples:: + + >>> x = torch.tensor([[[0,1],[2,3]],[[4,5],[6,7]]]) + >>> x + tensor([[[0, 1], + [2, 3]], + + [[4, 5], + [6, 7]]]) + >>> torch.swapdims(x, 0, 1) + tensor([[[0, 1], + [4, 5]], + + [[2, 3], + [6, 7]]]) + >>> torch.swapdims(x, 0, 2) + tensor([[[0, 4], + [2, 6]], + + [[1, 5], + [3, 7]]]) + """ + +def sym_constrain_range( + size: Number | _complex, + *, + min: _int | None = None, + max: _int | None = None, +) -> None: ... +def sym_constrain_range_for_size( + size: Number | _complex, + *, + min: _int | None = None, + max: _int | None = None, +) -> None: ... +def t(input: Tensor) -> Tensor: + r""" + t(input) -> Tensor + + Expects :attr:`input` to be <= 2-D tensor and transposes dimensions 0 + and 1. + + 0-D and 1-D tensors are returned as is. When input is a 2-D tensor this + is equivalent to ``transpose(input, 0, 1)``. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> x = torch.randn(()) + >>> x + tensor(0.1995) + >>> torch.t(x) + tensor(0.1995) + >>> x = torch.randn(3) + >>> x + tensor([ 2.4320, -0.4608, 0.7702]) + >>> torch.t(x) + tensor([ 2.4320, -0.4608, 0.7702]) + >>> x = torch.randn(2, 3) + >>> x + tensor([[ 0.4875, 0.9158, -0.5872], + [ 0.3938, -0.6929, 0.6932]]) + >>> torch.t(x) + tensor([[ 0.4875, 0.3938], + [ 0.9158, -0.6929], + [-0.5872, 0.6932]]) + + See also :func:`torch.transpose`. + """ + +def t_copy(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + Performs the same operation as :func:`torch.t`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def take( + input: Tensor, + index: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + take(input, index) -> Tensor + + Returns a new tensor with the elements of :attr:`input` at the given indices. + The input tensor is treated as if it were viewed as a 1-D tensor. The result + takes the same shape as the indices. + + Args: + input (Tensor): the input tensor. + index (LongTensor): the indices into tensor + + Example:: + + >>> src = torch.tensor([[4, 3, 5], + ... [6, 7, 8]]) + >>> torch.take(src, torch.tensor([0, 2, 5])) + tensor([ 4, 5, 8]) + """ + +def take_along_dim( + input: Tensor, + indices: Tensor, + dim: _int | None = None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + take_along_dim(input, indices, dim=None, *, out=None) -> Tensor + + Selects values from :attr:`input` at the 1-dimensional indices from :attr:`indices` along the given :attr:`dim`. + + If :attr:`dim` is None, the input array is treated as if it has been flattened to 1d. + + Functions that return indices along a dimension, like :func:`torch.argmax` and :func:`torch.argsort`, + are designed to work with this function. See the examples below. + + .. note:: + This function is similar to NumPy's `take_along_axis`. + See also :func:`torch.gather`. + + Args: + input (Tensor): the input tensor. + indices (LongTensor): the indices into :attr:`input`. Must have long dtype. + dim (int, optional): dimension to select along. Default: 0 + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> t = torch.tensor([[10, 30, 20], [60, 40, 50]]) + >>> max_idx = torch.argmax(t) + >>> torch.take_along_dim(t, max_idx) + tensor([60]) + >>> sorted_idx = torch.argsort(t, dim=1) + >>> torch.take_along_dim(t, sorted_idx, dim=1) + tensor([[10, 20, 30], + [40, 50, 60]]) + """ + +def tan(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + tan(input, *, out=None) -> Tensor + + Returns a new tensor with the tangent of the elements in the :attr:`input` tensor, + where each value in this input tensor is in radians. + + .. math:: + \text{out}_{i} = \tan(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-1.2027, -1.7687, 0.4412, -1.3856]) + >>> torch.tan(a) + tensor([-2.5930, 4.9859, 0.4722, -5.3366]) + """ + +def tan_(input: Tensor) -> Tensor: ... +def tanh(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + tanh(input, *, out=None) -> Tensor + + Returns a new tensor with the hyperbolic tangent of the elements + of :attr:`input`. + + .. math:: + \text{out}_{i} = \tanh(\text{input}_{i}) + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.8986, -0.7279, 1.1745, 0.2611]) + >>> torch.tanh(a) + tensor([ 0.7156, -0.6218, 0.8257, 0.2553]) + """ + +def tanh_(input: Tensor) -> Tensor: ... +def tensor( + data: Any, + dtype: _dtype | None = None, + device: DeviceLikeType | None = None, + requires_grad: _bool = False, + pin_memory: _bool = False, +) -> Tensor: + r""" + tensor(data, *, dtype=None, device=None, requires_grad=False, pin_memory=False) -> Tensor + + Constructs a tensor with no autograd history (also known as a "leaf tensor", see :doc:`/notes/autograd`) by copying :attr:`data`. + + .. warning:: + + When working with tensors prefer using :func:`torch.Tensor.clone`, + :func:`torch.Tensor.detach`, and :func:`torch.Tensor.requires_grad_` for + readability. Letting `t` be a tensor, ``torch.tensor(t)`` is equivalent to + ``t.detach().clone()``, and ``torch.tensor(t, requires_grad=True)`` + is equivalent to ``t.detach().clone().requires_grad_(True)``. + + .. seealso:: + + :func:`torch.as_tensor` preserves autograd history and avoids copies where possible. + :func:`torch.from_numpy` creates a tensor that shares storage with a NumPy array. + + Args: + data (array_like): Initial data for the tensor. Can be a list, tuple, + NumPy ``ndarray``, scalar, and other types. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, infers data type from :attr:`data`. + device (:class:`torch.device`, optional): the device of the constructed tensor. If None and data is a tensor + then the device of data is used. If None and data is not a tensor then + the result tensor is constructed on the current device. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + + + Example:: + + >>> torch.tensor([[0.1, 1.2], [2.2, 3.1], [4.9, 5.2]]) + tensor([[ 0.1000, 1.2000], + [ 2.2000, 3.1000], + [ 4.9000, 5.2000]]) + + >>> torch.tensor([0, 1]) # Type inference on data + tensor([ 0, 1]) + + >>> torch.tensor([[0.11111, 0.222222, 0.3333333]], + ... dtype=torch.float64, + ... device=torch.device('cuda:0')) # creates a double tensor on a CUDA device + tensor([[ 0.1111, 0.2222, 0.3333]], dtype=torch.float64, device='cuda:0') + + >>> torch.tensor(3.14159) # Create a zero-dimensional (scalar) tensor + tensor(3.1416) + + >>> torch.tensor([]) # Create an empty tensor (of size (0,)) + tensor([]) + """ + +@overload +def tensor_split( + input: Tensor, + tensor_indices_or_sections: Tensor, + dim: _int = 0, +) -> tuple[Tensor, ...]: + r""" + tensor_split(input, indices_or_sections, dim=0) -> List of Tensors + + Splits a tensor into multiple sub-tensors, all of which are views of :attr:`input`, + along dimension :attr:`dim` according to the indices or number of sections specified + by :attr:`indices_or_sections`. This function is based on NumPy's + :func:`numpy.array_split`. + + Args: + input (Tensor): the tensor to split + indices_or_sections (Tensor, int or list or tuple of ints): + If :attr:`indices_or_sections` is an integer ``n`` or a zero dimensional long tensor + with value ``n``, :attr:`input` is split into ``n`` sections along dimension :attr:`dim`. + If :attr:`input` is divisible by ``n`` along dimension :attr:`dim`, each + section will be of equal size, :code:`input.size(dim) / n`. If :attr:`input` + is not divisible by ``n``, the sizes of the first :code:`int(input.size(dim) % n)` + sections will have size :code:`int(input.size(dim) / n) + 1`, and the rest will + have size :code:`int(input.size(dim) / n)`. + + If :attr:`indices_or_sections` is a list or tuple of ints, or a one-dimensional long + tensor, then :attr:`input` is split along dimension :attr:`dim` at each of the indices + in the list, tuple or tensor. For instance, :code:`indices_or_sections=[2, 3]` and :code:`dim=0` + would result in the tensors :code:`input[:2]`, :code:`input[2:3]`, and :code:`input[3:]`. + + If :attr:`indices_or_sections` is a tensor, it must be a zero-dimensional or one-dimensional + long tensor on the CPU. + + dim (int, optional): dimension along which to split the tensor. Default: ``0`` + + Example:: + + >>> x = torch.arange(8) + >>> torch.tensor_split(x, 3) + (tensor([0, 1, 2]), tensor([3, 4, 5]), tensor([6, 7])) + + >>> x = torch.arange(7) + >>> torch.tensor_split(x, 3) + (tensor([0, 1, 2]), tensor([3, 4]), tensor([5, 6])) + >>> torch.tensor_split(x, (1, 6)) + (tensor([0]), tensor([1, 2, 3, 4, 5]), tensor([6])) + + >>> x = torch.arange(14).reshape(2, 7) + >>> x + tensor([[ 0, 1, 2, 3, 4, 5, 6], + [ 7, 8, 9, 10, 11, 12, 13]]) + >>> torch.tensor_split(x, 3, dim=1) + (tensor([[0, 1, 2], + [7, 8, 9]]), + tensor([[ 3, 4], + [10, 11]]), + tensor([[ 5, 6], + [12, 13]])) + >>> torch.tensor_split(x, (1, 6), dim=1) + (tensor([[0], + [7]]), + tensor([[ 1, 2, 3, 4, 5], + [ 8, 9, 10, 11, 12]]), + tensor([[ 6], + [13]])) + """ + +@overload +def tensor_split( + input: Tensor, + sections: _int | SymInt, + dim: _int = 0, +) -> tuple[Tensor, ...]: + r""" + tensor_split(input, indices_or_sections, dim=0) -> List of Tensors + + Splits a tensor into multiple sub-tensors, all of which are views of :attr:`input`, + along dimension :attr:`dim` according to the indices or number of sections specified + by :attr:`indices_or_sections`. This function is based on NumPy's + :func:`numpy.array_split`. + + Args: + input (Tensor): the tensor to split + indices_or_sections (Tensor, int or list or tuple of ints): + If :attr:`indices_or_sections` is an integer ``n`` or a zero dimensional long tensor + with value ``n``, :attr:`input` is split into ``n`` sections along dimension :attr:`dim`. + If :attr:`input` is divisible by ``n`` along dimension :attr:`dim`, each + section will be of equal size, :code:`input.size(dim) / n`. If :attr:`input` + is not divisible by ``n``, the sizes of the first :code:`int(input.size(dim) % n)` + sections will have size :code:`int(input.size(dim) / n) + 1`, and the rest will + have size :code:`int(input.size(dim) / n)`. + + If :attr:`indices_or_sections` is a list or tuple of ints, or a one-dimensional long + tensor, then :attr:`input` is split along dimension :attr:`dim` at each of the indices + in the list, tuple or tensor. For instance, :code:`indices_or_sections=[2, 3]` and :code:`dim=0` + would result in the tensors :code:`input[:2]`, :code:`input[2:3]`, and :code:`input[3:]`. + + If :attr:`indices_or_sections` is a tensor, it must be a zero-dimensional or one-dimensional + long tensor on the CPU. + + dim (int, optional): dimension along which to split the tensor. Default: ``0`` + + Example:: + + >>> x = torch.arange(8) + >>> torch.tensor_split(x, 3) + (tensor([0, 1, 2]), tensor([3, 4, 5]), tensor([6, 7])) + + >>> x = torch.arange(7) + >>> torch.tensor_split(x, 3) + (tensor([0, 1, 2]), tensor([3, 4]), tensor([5, 6])) + >>> torch.tensor_split(x, (1, 6)) + (tensor([0]), tensor([1, 2, 3, 4, 5]), tensor([6])) + + >>> x = torch.arange(14).reshape(2, 7) + >>> x + tensor([[ 0, 1, 2, 3, 4, 5, 6], + [ 7, 8, 9, 10, 11, 12, 13]]) + >>> torch.tensor_split(x, 3, dim=1) + (tensor([[0, 1, 2], + [7, 8, 9]]), + tensor([[ 3, 4], + [10, 11]]), + tensor([[ 5, 6], + [12, 13]])) + >>> torch.tensor_split(x, (1, 6), dim=1) + (tensor([[0], + [7]]), + tensor([[ 1, 2, 3, 4, 5], + [ 8, 9, 10, 11, 12]]), + tensor([[ 6], + [13]])) + """ + +@overload +def tensor_split( + input: Tensor, + indices: Sequence[_int | SymInt], + dim: _int = 0, +) -> tuple[Tensor, ...]: + r""" + tensor_split(input, indices_or_sections, dim=0) -> List of Tensors + + Splits a tensor into multiple sub-tensors, all of which are views of :attr:`input`, + along dimension :attr:`dim` according to the indices or number of sections specified + by :attr:`indices_or_sections`. This function is based on NumPy's + :func:`numpy.array_split`. + + Args: + input (Tensor): the tensor to split + indices_or_sections (Tensor, int or list or tuple of ints): + If :attr:`indices_or_sections` is an integer ``n`` or a zero dimensional long tensor + with value ``n``, :attr:`input` is split into ``n`` sections along dimension :attr:`dim`. + If :attr:`input` is divisible by ``n`` along dimension :attr:`dim`, each + section will be of equal size, :code:`input.size(dim) / n`. If :attr:`input` + is not divisible by ``n``, the sizes of the first :code:`int(input.size(dim) % n)` + sections will have size :code:`int(input.size(dim) / n) + 1`, and the rest will + have size :code:`int(input.size(dim) / n)`. + + If :attr:`indices_or_sections` is a list or tuple of ints, or a one-dimensional long + tensor, then :attr:`input` is split along dimension :attr:`dim` at each of the indices + in the list, tuple or tensor. For instance, :code:`indices_or_sections=[2, 3]` and :code:`dim=0` + would result in the tensors :code:`input[:2]`, :code:`input[2:3]`, and :code:`input[3:]`. + + If :attr:`indices_or_sections` is a tensor, it must be a zero-dimensional or one-dimensional + long tensor on the CPU. + + dim (int, optional): dimension along which to split the tensor. Default: ``0`` + + Example:: + + >>> x = torch.arange(8) + >>> torch.tensor_split(x, 3) + (tensor([0, 1, 2]), tensor([3, 4, 5]), tensor([6, 7])) + + >>> x = torch.arange(7) + >>> torch.tensor_split(x, 3) + (tensor([0, 1, 2]), tensor([3, 4]), tensor([5, 6])) + >>> torch.tensor_split(x, (1, 6)) + (tensor([0]), tensor([1, 2, 3, 4, 5]), tensor([6])) + + >>> x = torch.arange(14).reshape(2, 7) + >>> x + tensor([[ 0, 1, 2, 3, 4, 5, 6], + [ 7, 8, 9, 10, 11, 12, 13]]) + >>> torch.tensor_split(x, 3, dim=1) + (tensor([[0, 1, 2], + [7, 8, 9]]), + tensor([[ 3, 4], + [10, 11]]), + tensor([[ 5, 6], + [12, 13]])) + >>> torch.tensor_split(x, (1, 6), dim=1) + (tensor([[0], + [7]]), + tensor([[ 1, 2, 3, 4, 5], + [ 8, 9, 10, 11, 12]]), + tensor([[ 6], + [13]])) + """ + +def threshold( + input: Tensor, + threshold: Number | _complex, + value: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: ... +def threshold_( + input: Tensor, + threshold: Number | _complex, + value: Number | _complex, +) -> Tensor: ... +def tile(input: Tensor, dims: Sequence[_int | SymInt]) -> Tensor: + r""" + tile(input, dims) -> Tensor + + Constructs a tensor by repeating the elements of :attr:`input`. + The :attr:`dims` argument specifies the number of repetitions + in each dimension. + + If :attr:`dims` specifies fewer dimensions than :attr:`input` has, then + ones are prepended to :attr:`dims` until all dimensions are specified. + For example, if :attr:`input` has shape (8, 6, 4, 2) and :attr:`dims` + is (2, 2), then :attr:`dims` is treated as (1, 1, 2, 2). + + Analogously, if :attr:`input` has fewer dimensions than :attr:`dims` + specifies, then :attr:`input` is treated as if it were unsqueezed at + dimension zero until it has as many dimensions as :attr:`dims` specifies. + For example, if :attr:`input` has shape (4, 2) and :attr:`dims` + is (3, 3, 2, 2), then :attr:`input` is treated as if it had the + shape (1, 1, 4, 2). + + .. note:: + + This function is similar to NumPy's tile function. + + Args: + input (Tensor): the tensor whose elements to repeat. + dims (tuple): the number of repetitions per dimension. + + Example:: + + >>> x = torch.tensor([1, 2, 3]) + >>> x.tile((2,)) + tensor([1, 2, 3, 1, 2, 3]) + >>> y = torch.tensor([[1, 2], [3, 4]]) + >>> torch.tile(y, (2, 2)) + tensor([[1, 2, 1, 2], + [3, 4, 3, 4], + [1, 2, 1, 2], + [3, 4, 3, 4]]) + """ + +def topk( + input: Tensor, + k: _int | SymInt, + dim: _int = -1, + largest: _bool = True, + sorted: _bool = True, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.topk: + r""" + topk(input, k, dim=None, largest=True, sorted=True, *, out=None) -> (Tensor, LongTensor) + + Returns the :attr:`k` largest elements of the given :attr:`input` tensor along + a given dimension. + + If :attr:`dim` is not given, the last dimension of the `input` is chosen. + + If :attr:`largest` is ``False`` then the `k` smallest elements are returned. + + A namedtuple of `(values, indices)` is returned with the `values` and + `indices` of the largest `k` elements of each row of the `input` tensor in the + given dimension `dim`. + + The boolean option :attr:`sorted` if ``True``, will make sure that the returned + `k` elements are themselves sorted + + .. note:: + When using `torch.topk`, the indices of tied elements are not guaranteed to be stable + and may vary across different invocations. + + Args: + input (Tensor): the input tensor. + k (int): the k in "top-k" + dim (int, optional): the dimension to sort along + largest (bool, optional): controls whether to return largest or + smallest elements + sorted (bool, optional): controls whether to return the elements + in sorted order + + Keyword args: + out (tuple, optional): the output tuple of (Tensor, LongTensor) that can be + optionally given to be used as output buffers + + Example:: + + >>> x = torch.arange(1., 6.) + >>> x + tensor([ 1., 2., 3., 4., 5.]) + >>> torch.topk(x, 3) + torch.return_types.topk(values=tensor([5., 4., 3.]), indices=tensor([4, 3, 2])) + """ + +def trace(input: Tensor) -> Tensor: + r""" + trace(input) -> Tensor + + Returns the sum of the elements of the diagonal of the input 2-D matrix. + + Example:: + + >>> x = torch.arange(1., 10.).view(3, 3) + >>> x + tensor([[ 1., 2., 3.], + [ 4., 5., 6.], + [ 7., 8., 9.]]) + >>> torch.trace(x) + tensor(15.) + """ + +@overload +def transpose(input: Tensor, dim0: _int, dim1: _int) -> Tensor: + r""" + transpose(input, dim0, dim1) -> Tensor + + Returns a tensor that is a transposed version of :attr:`input`. + The given dimensions :attr:`dim0` and :attr:`dim1` are swapped. + + If :attr:`input` is a strided tensor then the resulting :attr:`out` + tensor shares its underlying storage with the :attr:`input` tensor, so + changing the content of one would change the content of the other. + + If :attr:`input` is a :ref:`sparse tensor ` then the + resulting :attr:`out` tensor *does not* share the underlying storage + with the :attr:`input` tensor. + + If :attr:`input` is a :ref:`sparse tensor ` with compressed + layout (SparseCSR, SparseBSR, SparseCSC or SparseBSC) the arguments + :attr:`dim0` and :attr:`dim1` must be both batch dimensions, or must + both be sparse dimensions. The batch dimensions of a sparse tensor are the + dimensions preceding the sparse dimensions. + + .. note:: + Transpositions which interchange the sparse dimensions of a `SparseCSR` + or `SparseCSC` layout tensor will result in the layout changing between + the two options. Transposition of the sparse dimensions of a ` SparseBSR` + or `SparseBSC` layout tensor will likewise generate a result with the + opposite layout. + + + Args: + input (Tensor): the input tensor. + dim0 (int): the first dimension to be transposed + dim1 (int): the second dimension to be transposed + + Example:: + + >>> x = torch.randn(2, 3) + >>> x + tensor([[ 1.0028, -0.9893, 0.5809], + [-0.1669, 0.7299, 0.4942]]) + >>> torch.transpose(x, 0, 1) + tensor([[ 1.0028, -0.1669], + [-0.9893, 0.7299], + [ 0.5809, 0.4942]]) + + See also :func:`torch.t`. + """ + +@overload +def transpose( + input: Tensor, + dim0: str | EllipsisType | None, + dim1: str | EllipsisType | None, +) -> Tensor: + r""" + transpose(input, dim0, dim1) -> Tensor + + Returns a tensor that is a transposed version of :attr:`input`. + The given dimensions :attr:`dim0` and :attr:`dim1` are swapped. + + If :attr:`input` is a strided tensor then the resulting :attr:`out` + tensor shares its underlying storage with the :attr:`input` tensor, so + changing the content of one would change the content of the other. + + If :attr:`input` is a :ref:`sparse tensor ` then the + resulting :attr:`out` tensor *does not* share the underlying storage + with the :attr:`input` tensor. + + If :attr:`input` is a :ref:`sparse tensor ` with compressed + layout (SparseCSR, SparseBSR, SparseCSC or SparseBSC) the arguments + :attr:`dim0` and :attr:`dim1` must be both batch dimensions, or must + both be sparse dimensions. The batch dimensions of a sparse tensor are the + dimensions preceding the sparse dimensions. + + .. note:: + Transpositions which interchange the sparse dimensions of a `SparseCSR` + or `SparseCSC` layout tensor will result in the layout changing between + the two options. Transposition of the sparse dimensions of a ` SparseBSR` + or `SparseBSC` layout tensor will likewise generate a result with the + opposite layout. + + + Args: + input (Tensor): the input tensor. + dim0 (int): the first dimension to be transposed + dim1 (int): the second dimension to be transposed + + Example:: + + >>> x = torch.randn(2, 3) + >>> x + tensor([[ 1.0028, -0.9893, 0.5809], + [-0.1669, 0.7299, 0.4942]]) + >>> torch.transpose(x, 0, 1) + tensor([[ 1.0028, -0.1669], + [-0.9893, 0.7299], + [ 0.5809, 0.4942]]) + + See also :func:`torch.t`. + """ + +def transpose_copy( + input: Tensor, + dim0: _int, + dim1: _int, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.transpose`, but all output tensors + are freshly created instead of aliasing the input. + """ + +@overload +def trapezoid(y: Tensor, x: Tensor, *, dim: _int = -1) -> Tensor: + r""" + trapezoid(y, x=None, *, dx=None, dim=-1) -> Tensor + + Computes the `trapezoidal rule `_ along + :attr:`dim`. By default the spacing between elements is assumed to be 1, but + :attr:`dx` can be used to specify a different constant spacing, and :attr:`x` can be + used to specify arbitrary spacing along :attr:`dim`. Only one of :attr:`x` or :attr:`dx` should be specified. + + + Assuming :attr:`y` is a one-dimensional tensor with elements :math:`{y_0, y_1, ..., y_n}`, + the default computation is + + .. math:: + \begin{aligned} + \sum_{i = 1}^{n} \frac{1}{2} (y_i + y_{i-1}) + \end{aligned} + + When :attr:`dx` is specified the computation becomes + + .. math:: + \begin{aligned} + \sum_{i = 1}^{n} \frac{\Delta x}{2} (y_i + y_{i-1}) + \end{aligned} + + effectively multiplying the result by :attr:`dx`. When :attr:`x` is specified, + assuming :attr:`x` is also a one-dimensional tensor with + elements :math:`{x_0, x_1, ..., x_n}`, the computation becomes + + .. math:: + \begin{aligned} + \sum_{i = 1}^{n} \frac{(x_i - x_{i-1})}{2} (y_i + y_{i-1}) + \end{aligned} + + When :attr:`x` and :attr:`y` have the same size, the computation is as described above and no broadcasting is needed. + The broadcasting behavior of this function is as follows when their sizes are different. For both :attr:`x` + and :attr:`y`, the function computes the difference between consecutive elements along + dimension :attr:`dim`. This effectively creates two tensors, `x_diff` and `y_diff`, that have + the same shape as the original tensors except their lengths along the dimension :attr:`dim` is reduced by 1. + After that, those two tensors are broadcast together to compute final output as part of the trapezoidal rule. + See the examples below for details. + + .. note:: + The trapezoidal rule is a technique for approximating the definite integral of a function + by averaging its left and right Riemann sums. The approximation becomes more accurate as + the resolution of the partition increases. + + Arguments: + y (Tensor): Values to use when computing the trapezoidal rule. + x (Tensor): If specified, defines spacing between values as specified above. + + Keyword arguments: + dx (float): constant spacing between values. If neither :attr:`x` or :attr:`dx` + are specified then this defaults to 1. Effectively multiplies the result by its value. + dim (int): The dimension along which to compute the trapezoidal rule. + The last (inner-most) dimension by default. + + Examples:: + + >>> # Computes the trapezoidal rule in 1D, spacing is implicitly 1 + >>> y = torch.tensor([1, 5, 10]) + >>> torch.trapezoid(y) + tensor(10.5) + + >>> # Computes the same trapezoidal rule directly to verify + >>> (1 + 10 + 10) / 2 + 10.5 + + >>> # Computes the trapezoidal rule in 1D with constant spacing of 2 + >>> # NOTE: the result is the same as before, but multiplied by 2 + >>> torch.trapezoid(y, dx=2) + 21.0 + + >>> # Computes the trapezoidal rule in 1D with arbitrary spacing + >>> x = torch.tensor([1, 3, 6]) + >>> torch.trapezoid(y, x) + 28.5 + + >>> # Computes the same trapezoidal rule directly to verify + >>> ((3 - 1) * (1 + 5) + (6 - 3) * (5 + 10)) / 2 + 28.5 + + >>> # Computes the trapezoidal rule for each row of a 3x3 matrix + >>> y = torch.arange(9).reshape(3, 3) + tensor([[0, 1, 2], + [3, 4, 5], + [6, 7, 8]]) + >>> torch.trapezoid(y) + tensor([ 2., 8., 14.]) + + >>> # Computes the trapezoidal rule for each column of the matrix + >>> torch.trapezoid(y, dim=0) + tensor([ 6., 8., 10.]) + + >>> # Computes the trapezoidal rule for each row of a 3x3 ones matrix + >>> # with the same arbitrary spacing + >>> y = torch.ones(3, 3) + >>> x = torch.tensor([1, 3, 6]) + >>> torch.trapezoid(y, x) + array([5., 5., 5.]) + + >>> # Computes the trapezoidal rule for each row of a 3x3 ones matrix + >>> # with different arbitrary spacing per row + >>> y = torch.ones(3, 3) + >>> x = torch.tensor([[1, 2, 3], [1, 3, 5], [1, 4, 7]]) + >>> torch.trapezoid(y, x) + array([2., 4., 6.]) + """ + +@overload +def trapezoid( + y: Tensor, + *, + dx: Number | _complex = 1, + dim: _int = -1, +) -> Tensor: + r""" + trapezoid(y, x=None, *, dx=None, dim=-1) -> Tensor + + Computes the `trapezoidal rule `_ along + :attr:`dim`. By default the spacing between elements is assumed to be 1, but + :attr:`dx` can be used to specify a different constant spacing, and :attr:`x` can be + used to specify arbitrary spacing along :attr:`dim`. Only one of :attr:`x` or :attr:`dx` should be specified. + + + Assuming :attr:`y` is a one-dimensional tensor with elements :math:`{y_0, y_1, ..., y_n}`, + the default computation is + + .. math:: + \begin{aligned} + \sum_{i = 1}^{n} \frac{1}{2} (y_i + y_{i-1}) + \end{aligned} + + When :attr:`dx` is specified the computation becomes + + .. math:: + \begin{aligned} + \sum_{i = 1}^{n} \frac{\Delta x}{2} (y_i + y_{i-1}) + \end{aligned} + + effectively multiplying the result by :attr:`dx`. When :attr:`x` is specified, + assuming :attr:`x` is also a one-dimensional tensor with + elements :math:`{x_0, x_1, ..., x_n}`, the computation becomes + + .. math:: + \begin{aligned} + \sum_{i = 1}^{n} \frac{(x_i - x_{i-1})}{2} (y_i + y_{i-1}) + \end{aligned} + + When :attr:`x` and :attr:`y` have the same size, the computation is as described above and no broadcasting is needed. + The broadcasting behavior of this function is as follows when their sizes are different. For both :attr:`x` + and :attr:`y`, the function computes the difference between consecutive elements along + dimension :attr:`dim`. This effectively creates two tensors, `x_diff` and `y_diff`, that have + the same shape as the original tensors except their lengths along the dimension :attr:`dim` is reduced by 1. + After that, those two tensors are broadcast together to compute final output as part of the trapezoidal rule. + See the examples below for details. + + .. note:: + The trapezoidal rule is a technique for approximating the definite integral of a function + by averaging its left and right Riemann sums. The approximation becomes more accurate as + the resolution of the partition increases. + + Arguments: + y (Tensor): Values to use when computing the trapezoidal rule. + x (Tensor): If specified, defines spacing between values as specified above. + + Keyword arguments: + dx (float): constant spacing between values. If neither :attr:`x` or :attr:`dx` + are specified then this defaults to 1. Effectively multiplies the result by its value. + dim (int): The dimension along which to compute the trapezoidal rule. + The last (inner-most) dimension by default. + + Examples:: + + >>> # Computes the trapezoidal rule in 1D, spacing is implicitly 1 + >>> y = torch.tensor([1, 5, 10]) + >>> torch.trapezoid(y) + tensor(10.5) + + >>> # Computes the same trapezoidal rule directly to verify + >>> (1 + 10 + 10) / 2 + 10.5 + + >>> # Computes the trapezoidal rule in 1D with constant spacing of 2 + >>> # NOTE: the result is the same as before, but multiplied by 2 + >>> torch.trapezoid(y, dx=2) + 21.0 + + >>> # Computes the trapezoidal rule in 1D with arbitrary spacing + >>> x = torch.tensor([1, 3, 6]) + >>> torch.trapezoid(y, x) + 28.5 + + >>> # Computes the same trapezoidal rule directly to verify + >>> ((3 - 1) * (1 + 5) + (6 - 3) * (5 + 10)) / 2 + 28.5 + + >>> # Computes the trapezoidal rule for each row of a 3x3 matrix + >>> y = torch.arange(9).reshape(3, 3) + tensor([[0, 1, 2], + [3, 4, 5], + [6, 7, 8]]) + >>> torch.trapezoid(y) + tensor([ 2., 8., 14.]) + + >>> # Computes the trapezoidal rule for each column of the matrix + >>> torch.trapezoid(y, dim=0) + tensor([ 6., 8., 10.]) + + >>> # Computes the trapezoidal rule for each row of a 3x3 ones matrix + >>> # with the same arbitrary spacing + >>> y = torch.ones(3, 3) + >>> x = torch.tensor([1, 3, 6]) + >>> torch.trapezoid(y, x) + array([5., 5., 5.]) + + >>> # Computes the trapezoidal rule for each row of a 3x3 ones matrix + >>> # with different arbitrary spacing per row + >>> y = torch.ones(3, 3) + >>> x = torch.tensor([[1, 2, 3], [1, 3, 5], [1, 4, 7]]) + >>> torch.trapezoid(y, x) + array([2., 4., 6.]) + """ + +@overload +def trapz(y: Tensor, *, dx: _float = 1, dim: _int = -1) -> Tensor: + r""" + trapz(y, x, *, dim=-1) -> Tensor + + Alias for :func:`torch.trapezoid`. + """ + +@overload +def trapz(y: Tensor, x: Tensor, *, dim: _int = -1) -> Tensor: + r""" + trapz(y, x, *, dim=-1) -> Tensor + + Alias for :func:`torch.trapezoid`. + """ + +def triangular_solve( + input: Tensor, + A: Tensor, + upper: _bool = True, + transpose: _bool = False, + unitriangular: _bool = False, + *, + out: Tensor | tuple[Tensor, ...] | list[Tensor] | None = None, +) -> torch.return_types.triangular_solve: + r""" + triangular_solve(b, A, upper=True, transpose=False, unitriangular=False, *, out=None) -> (Tensor, Tensor) + + Solves a system of equations with a square upper or lower triangular invertible matrix :math:`A` + and multiple right-hand sides :math:`b`. + + In symbols, it solves :math:`AX = b` and assumes :math:`A` is square upper-triangular + (or lower-triangular if :attr:`upper`\ `= False`) and does not have zeros on the diagonal. + + `torch.triangular_solve(b, A)` can take in 2D inputs `b, A` or inputs that are + batches of 2D matrices. If the inputs are batches, then returns + batched outputs `X` + + If the diagonal of :attr:`A` contains zeros or elements that are very close to zero and + :attr:`unitriangular`\ `= False` (default) or if the input matrix is badly conditioned, + the result may contain `NaN` s. + + Supports input of float, double, cfloat and cdouble data types. + + .. warning:: + + :func:`torch.triangular_solve` is deprecated in favor of :func:`torch.linalg.solve_triangular` + and will be removed in a future PyTorch release. + :func:`torch.linalg.solve_triangular` has its arguments reversed and does not return a + copy of one of the inputs. + + ``X = torch.triangular_solve(B, A).solution`` should be replaced with + + .. code:: python + + X = torch.linalg.solve_triangular(A, B) + + Args: + b (Tensor): multiple right-hand sides of size :math:`(*, m, k)` where + :math:`*` is zero of more batch dimensions + A (Tensor): the input triangular coefficient matrix of size :math:`(*, m, m)` + where :math:`*` is zero or more batch dimensions + upper (bool, optional): whether :math:`A` is upper or lower triangular. Default: ``True``. + transpose (bool, optional): solves `op(A)X = b` where `op(A) = A^T` if this flag is ``True``, + and `op(A) = A` if it is ``False``. Default: ``False``. + unitriangular (bool, optional): whether :math:`A` is unit triangular. + If True, the diagonal elements of :math:`A` are assumed to be + 1 and not referenced from :math:`A`. Default: ``False``. + + Keyword args: + out ((Tensor, Tensor), optional): tuple of two tensors to write + the output to. Ignored if `None`. Default: `None`. + + Returns: + A namedtuple `(solution, cloned_coefficient)` where `cloned_coefficient` + is a clone of :math:`A` and `solution` is the solution :math:`X` to :math:`AX = b` + (or whatever variant of the system of equations, depending on the keyword arguments.) + + Examples:: + + >>> A = torch.randn(2, 2).triu() + >>> A + tensor([[ 1.1527, -1.0753], + [ 0.0000, 0.7986]]) + >>> b = torch.randn(2, 3) + >>> b + tensor([[-0.0210, 2.3513, -1.5492], + [ 1.5429, 0.7403, -1.0243]]) + >>> torch.triangular_solve(b, A) + torch.return_types.triangular_solve( + solution=tensor([[ 1.7841, 2.9046, -2.5405], + [ 1.9320, 0.9270, -1.2826]]), + cloned_coefficient=tensor([[ 1.1527, -1.0753], + [ 0.0000, 0.7986]])) + """ + +def tril( + input: Tensor, + diagonal: _int | SymInt = 0, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + tril(input, diagonal=0, *, out=None) -> Tensor + + Returns the lower triangular part of the matrix (2-D tensor) or batch of matrices + :attr:`input`, the other elements of the result tensor :attr:`out` are set to 0. + + The lower triangular part of the matrix is defined as the elements on and + below the diagonal. + + The argument :attr:`diagonal` controls which diagonal to consider. If + :attr:`diagonal` = 0, all elements on and below the main diagonal are + retained. A positive value includes just as many diagonals above the main + diagonal, and similarly a negative value excludes just as many diagonals below + the main diagonal. The main diagonal are the set of indices + :math:`\lbrace (i, i) \rbrace` for :math:`i \in [0, \min\{d_{1}, d_{2}\} - 1]` where + :math:`d_{1}, d_{2}` are the dimensions of the matrix. + + Args: + input (Tensor): the input tensor. + diagonal (int, optional): the diagonal to consider + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(3, 3) + >>> a + tensor([[-1.0813, -0.8619, 0.7105], + [ 0.0935, 0.1380, 2.2112], + [-0.3409, -0.9828, 0.0289]]) + >>> torch.tril(a) + tensor([[-1.0813, 0.0000, 0.0000], + [ 0.0935, 0.1380, 0.0000], + [-0.3409, -0.9828, 0.0289]]) + + >>> b = torch.randn(4, 6) + >>> b + tensor([[ 1.2219, 0.5653, -0.2521, -0.2345, 1.2544, 0.3461], + [ 0.4785, -0.4477, 0.6049, 0.6368, 0.8775, 0.7145], + [ 1.1502, 3.2716, -1.1243, -0.5413, 0.3615, 0.6864], + [-0.0614, -0.7344, -1.3164, -0.7648, -1.4024, 0.0978]]) + >>> torch.tril(b, diagonal=1) + tensor([[ 1.2219, 0.5653, 0.0000, 0.0000, 0.0000, 0.0000], + [ 0.4785, -0.4477, 0.6049, 0.0000, 0.0000, 0.0000], + [ 1.1502, 3.2716, -1.1243, -0.5413, 0.0000, 0.0000], + [-0.0614, -0.7344, -1.3164, -0.7648, -1.4024, 0.0000]]) + >>> torch.tril(b, diagonal=-1) + tensor([[ 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000], + [ 0.4785, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000], + [ 1.1502, 3.2716, 0.0000, 0.0000, 0.0000, 0.0000], + [-0.0614, -0.7344, -1.3164, 0.0000, 0.0000, 0.0000]]) + """ + +def tril_indices( + row: _int, + col: _int, + offset: _int = 0, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + tril_indices(row, col, offset=0, *, dtype=torch.long, device='cpu', layout=torch.strided) -> Tensor + + Returns the indices of the lower triangular part of a :attr:`row`-by- + :attr:`col` matrix in a 2-by-N Tensor, where the first row contains row + coordinates of all indices and the second row contains column coordinates. + Indices are ordered based on rows and then columns. + + The lower triangular part of the matrix is defined as the elements on and + below the diagonal. + + The argument :attr:`offset` controls which diagonal to consider. If + :attr:`offset` = 0, all elements on and below the main diagonal are + retained. A positive value includes just as many diagonals above the main + diagonal, and similarly a negative value excludes just as many diagonals below + the main diagonal. The main diagonal are the set of indices + :math:`\lbrace (i, i) \rbrace` for :math:`i \in [0, \min\{d_{1}, d_{2}\} - 1]` + where :math:`d_{1}, d_{2}` are the dimensions of the matrix. + + .. note:: + When running on CUDA, ``row * col`` must be less than :math:`2^{59}` to + prevent overflow during calculation. + + Args: + row (``int``): number of rows in the 2-D matrix. + col (``int``): number of columns in the 2-D matrix. + offset (``int``): diagonal offset from the main diagonal. + Default: if not provided, 0. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor, + only support ``torch.int``, ``torch.long``. Default: if ``None``, ``torch.long``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + layout (:class:`torch.layout`, optional): currently only support ``torch.strided``. + + Example:: + + >>> a = torch.tril_indices(3, 3) + >>> a + tensor([[0, 1, 1, 2, 2, 2], + [0, 0, 1, 0, 1, 2]]) + + >>> a = torch.tril_indices(4, 3, -1) + >>> a + tensor([[1, 2, 2, 3, 3, 3], + [0, 0, 1, 0, 1, 2]]) + + >>> a = torch.tril_indices(4, 3, 1) + >>> a + tensor([[0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3], + [0, 1, 0, 1, 2, 0, 1, 2, 0, 1, 2]]) + """ + +def triplet_margin_loss( + anchor: Tensor, + positive: Tensor, + negative: Tensor, + margin: _float = 1.0, + p: _float = 2, + eps: _float = 1e-06, + swap: _bool = False, + reduction: _int = 1, +) -> Tensor: ... +def triu( + input: Tensor, + diagonal: _int | SymInt = 0, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + triu(input, diagonal=0, *, out=None) -> Tensor + + Returns the upper triangular part of a matrix (2-D tensor) or batch of matrices + :attr:`input`, the other elements of the result tensor :attr:`out` are set to 0. + + The upper triangular part of the matrix is defined as the elements on and + above the diagonal. + + The argument :attr:`diagonal` controls which diagonal to consider. If + :attr:`diagonal` = 0, all elements on and above the main diagonal are + retained. A positive value excludes just as many diagonals above the main + diagonal, and similarly a negative value includes just as many diagonals below + the main diagonal. The main diagonal are the set of indices + :math:`\lbrace (i, i) \rbrace` for :math:`i \in [0, \min\{d_{1}, d_{2}\} - 1]` where + :math:`d_{1}, d_{2}` are the dimensions of the matrix. + + Args: + input (Tensor): the input tensor. + diagonal (int, optional): the diagonal to consider + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(3, 3) + >>> a + tensor([[ 0.2309, 0.5207, 2.0049], + [ 0.2072, -1.0680, 0.6602], + [ 0.3480, -0.5211, -0.4573]]) + >>> torch.triu(a) + tensor([[ 0.2309, 0.5207, 2.0049], + [ 0.0000, -1.0680, 0.6602], + [ 0.0000, 0.0000, -0.4573]]) + >>> torch.triu(a, diagonal=1) + tensor([[ 0.0000, 0.5207, 2.0049], + [ 0.0000, 0.0000, 0.6602], + [ 0.0000, 0.0000, 0.0000]]) + >>> torch.triu(a, diagonal=-1) + tensor([[ 0.2309, 0.5207, 2.0049], + [ 0.2072, -1.0680, 0.6602], + [ 0.0000, -0.5211, -0.4573]]) + + >>> b = torch.randn(4, 6) + >>> b + tensor([[ 0.5876, -0.0794, -1.8373, 0.6654, 0.2604, 1.5235], + [-0.2447, 0.9556, -1.2919, 1.3378, -0.1768, -1.0857], + [ 0.4333, 0.3146, 0.6576, -1.0432, 0.9348, -0.4410], + [-0.9888, 1.0679, -1.3337, -1.6556, 0.4798, 0.2830]]) + >>> torch.triu(b, diagonal=1) + tensor([[ 0.0000, -0.0794, -1.8373, 0.6654, 0.2604, 1.5235], + [ 0.0000, 0.0000, -1.2919, 1.3378, -0.1768, -1.0857], + [ 0.0000, 0.0000, 0.0000, -1.0432, 0.9348, -0.4410], + [ 0.0000, 0.0000, 0.0000, 0.0000, 0.4798, 0.2830]]) + >>> torch.triu(b, diagonal=-1) + tensor([[ 0.5876, -0.0794, -1.8373, 0.6654, 0.2604, 1.5235], + [-0.2447, 0.9556, -1.2919, 1.3378, -0.1768, -1.0857], + [ 0.0000, 0.3146, 0.6576, -1.0432, 0.9348, -0.4410], + [ 0.0000, 0.0000, -1.3337, -1.6556, 0.4798, 0.2830]]) + """ + +def triu_indices( + row: _int, + col: _int, + offset: _int = 0, + *, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + triu_indices(row, col, offset=0, *, dtype=torch.long, device='cpu', layout=torch.strided) -> Tensor + + Returns the indices of the upper triangular part of a :attr:`row` by + :attr:`col` matrix in a 2-by-N Tensor, where the first row contains row + coordinates of all indices and the second row contains column coordinates. + Indices are ordered based on rows and then columns. + + The upper triangular part of the matrix is defined as the elements on and + above the diagonal. + + The argument :attr:`offset` controls which diagonal to consider. If + :attr:`offset` = 0, all elements on and above the main diagonal are + retained. A positive value excludes just as many diagonals above the main + diagonal, and similarly a negative value includes just as many diagonals below + the main diagonal. The main diagonal are the set of indices + :math:`\lbrace (i, i) \rbrace` for :math:`i \in [0, \min\{d_{1}, d_{2}\} - 1]` + where :math:`d_{1}, d_{2}` are the dimensions of the matrix. + + .. note:: + When running on CUDA, ``row * col`` must be less than :math:`2^{59}` to + prevent overflow during calculation. + + Args: + row (``int``): number of rows in the 2-D matrix. + col (``int``): number of columns in the 2-D matrix. + offset (``int``): diagonal offset from the main diagonal. + Default: if not provided, 0. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor, + only support ``torch.int``, ``torch.long``. Default: if ``None``, ``torch.long``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + layout (:class:`torch.layout`, optional): currently only support ``torch.strided``. + + Example:: + + >>> a = torch.triu_indices(3, 3) + >>> a + tensor([[0, 0, 0, 1, 1, 2], + [0, 1, 2, 1, 2, 2]]) + + >>> a = torch.triu_indices(4, 3, -1) + >>> a + tensor([[0, 0, 0, 1, 1, 1, 2, 2, 3], + [0, 1, 2, 0, 1, 2, 1, 2, 2]]) + + >>> a = torch.triu_indices(4, 3, 1) + >>> a + tensor([[0, 0, 1], + [1, 2, 2]]) + """ + +def true_divide( + input: Tensor | Number, + other: Tensor | Number, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + true_divide(dividend, divisor, *, out) -> Tensor + + Alias for :func:`torch.div` with ``rounding_mode=None``. + """ + +def trunc(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + trunc(input, *, out=None) -> Tensor + + Returns a new tensor with the truncated integer values of + the elements of :attr:`input`. + + For integer inputs, follows the array-api convention of returning a + copy of the input tensor. + + Args: + input (Tensor): the input tensor. + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 3.4742, 0.5466, -0.8008, -0.9079]) + >>> torch.trunc(a) + tensor([ 3., 0., -0., -0.]) + """ + +def trunc_(input: Tensor) -> Tensor: ... +@overload +def unbind(input: Tensor, dim: _int = 0) -> tuple[Tensor, ...]: + r""" + unbind(input, dim=0) -> seq + + Removes a tensor dimension. + + Returns a tuple of all slices along a given dimension, already without it. + + Arguments: + input (Tensor): the tensor to unbind + dim (int): dimension to remove + + Example:: + + >>> torch.unbind(torch.tensor([[1, 2, 3], + >>> [4, 5, 6], + >>> [7, 8, 9]])) + (tensor([1, 2, 3]), tensor([4, 5, 6]), tensor([7, 8, 9])) + """ + +@overload +def unbind( + input: Tensor, + dim: str | EllipsisType | None, +) -> tuple[Tensor, ...]: + r""" + unbind(input, dim=0) -> seq + + Removes a tensor dimension. + + Returns a tuple of all slices along a given dimension, already without it. + + Arguments: + input (Tensor): the tensor to unbind + dim (int): dimension to remove + + Example:: + + >>> torch.unbind(torch.tensor([[1, 2, 3], + >>> [4, 5, 6], + >>> [7, 8, 9]])) + (tensor([1, 2, 3]), tensor([4, 5, 6]), tensor([7, 8, 9])) + """ + +def unbind_copy( + input: Tensor, + dim: _int = 0, + *, + out: tuple[Tensor, ...] | list[Tensor] | None = None, +) -> None: + r""" + Performs the same operation as :func:`torch.unbind`, but all output tensors + are freshly created instead of aliasing the input. + """ + +@overload +def unflatten( + input: Tensor, + dim: str | EllipsisType | None, + sizes: Sequence[_int | SymInt], + names: Sequence[str | EllipsisType | None], +) -> Tensor: + r""" + unflatten(input, dim, sizes) -> Tensor + + Expands a dimension of the input tensor over multiple dimensions. + + .. seealso:: + + :func:`torch.flatten` the inverse of this function. It coalesces several dimensions into one. + + Args: + input (Tensor): the input tensor. + dim (int): Dimension to be unflattened, specified as an index into + ``input.shape``. + sizes (Tuple[int]): New shape of the unflattened dimension. + One of its elements can be `-1` in which case the corresponding output + dimension is inferred. Otherwise, the product of ``sizes`` *must* + equal ``input.shape[dim]``. + + Returns: + A View of input with the specified dimension unflattened. + + Examples:: + >>> torch.unflatten(torch.randn(3, 4, 1), 1, (2, 2)).shape + torch.Size([3, 2, 2, 1]) + >>> torch.unflatten(torch.randn(3, 4, 1), 1, (-1, 2)).shape + torch.Size([3, 2, 2, 1]) + >>> torch.unflatten(torch.randn(5, 12, 3), -2, (2, 2, 3, 1, 1)).shape + torch.Size([5, 2, 2, 3, 1, 1, 3]) + """ + +@overload +def unflatten( + input: Tensor, + dim: _int, + sizes: Sequence[_int | SymInt], +) -> Tensor: + r""" + unflatten(input, dim, sizes) -> Tensor + + Expands a dimension of the input tensor over multiple dimensions. + + .. seealso:: + + :func:`torch.flatten` the inverse of this function. It coalesces several dimensions into one. + + Args: + input (Tensor): the input tensor. + dim (int): Dimension to be unflattened, specified as an index into + ``input.shape``. + sizes (Tuple[int]): New shape of the unflattened dimension. + One of its elements can be `-1` in which case the corresponding output + dimension is inferred. Otherwise, the product of ``sizes`` *must* + equal ``input.shape[dim]``. + + Returns: + A View of input with the specified dimension unflattened. + + Examples:: + >>> torch.unflatten(torch.randn(3, 4, 1), 1, (2, 2)).shape + torch.Size([3, 2, 2, 1]) + >>> torch.unflatten(torch.randn(3, 4, 1), 1, (-1, 2)).shape + torch.Size([3, 2, 2, 1]) + >>> torch.unflatten(torch.randn(5, 12, 3), -2, (2, 2, 3, 1, 1)).shape + torch.Size([5, 2, 2, 3, 1, 1, 3]) + """ + +def unfold_copy( + input: Tensor, + dimension: _int, + size: _int, + step: _int, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.unfold`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def unique_dim( + input: Tensor, + dim: _int, + sorted: _bool = True, + return_inverse: _bool = False, + return_counts: _bool = False, +) -> tuple[Tensor, Tensor, Tensor]: ... +def unsafe_chunk( + input: Tensor, + chunks: _int, + dim: _int = 0, +) -> tuple[Tensor, ...]: + r""" + unsafe_chunk(input, chunks, dim=0) -> List of Tensors + + Works like :func:`torch.chunk` but without enforcing the autograd restrictions + on inplace modification of the outputs. + + .. warning:: + This function is safe to use as long as only the input, or only the outputs + are modified inplace after calling this function. It is user's + responsibility to ensure that is the case. If both the input and one or more + of the outputs are modified inplace, gradients computed by autograd will be + silently incorrect. + """ + +def unsafe_split( + input: Tensor, + split_size: _int | SymInt, + dim: _int = 0, +) -> tuple[Tensor, ...]: + r""" + unsafe_split(tensor, split_size_or_sections, dim=0) -> List of Tensors + + Works like :func:`torch.split` but without enforcing the autograd restrictions + on inplace modification of the outputs. + + .. warning:: + This function is safe to use as long as only the input, or only the outputs + are modified inplace after calling this function. It is user's + responsibility to ensure that is the case. If both the input and one or more + of the outputs are modified inplace, gradients computed by autograd will be + silently incorrect. + """ + +def unsafe_split_with_sizes( + input: Tensor, + split_sizes: Sequence[_int | SymInt], + dim: _int = 0, +) -> tuple[Tensor, ...]: ... +def unsqueeze(input: Tensor, dim: _int) -> Tensor: + r""" + unsqueeze(input, dim) -> Tensor + + Returns a new tensor with a dimension of size one inserted at the + specified position. + + The returned tensor shares the same underlying data with this tensor. + + A :attr:`dim` value within the range ``[-input.dim() - 1, input.dim() + 1)`` + can be used. Negative :attr:`dim` will correspond to :meth:`unsqueeze` + applied at :attr:`dim` = ``dim + input.dim() + 1``. + + Args: + input (Tensor): the input tensor. + dim (int): the index at which to insert the singleton dimension + + Example:: + + >>> x = torch.tensor([1, 2, 3, 4]) + >>> torch.unsqueeze(x, 0) + tensor([[ 1, 2, 3, 4]]) + >>> torch.unsqueeze(x, 1) + tensor([[ 1], + [ 2], + [ 3], + [ 4]]) + """ + +def unsqueeze_copy( + input: Tensor, + dim: _int, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.unsqueeze`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def values_copy(input: Tensor, *, out: Tensor | None = None) -> Tensor: + r""" + Performs the same operation as :func:`torch.values`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def vander( + x: Tensor, + N: _int | None = None, + increasing: _bool = False, +) -> Tensor: + r""" + vander(x, N=None, increasing=False) -> Tensor + + Generates a Vandermonde matrix. + + The columns of the output matrix are elementwise powers of the input vector :math:`x^{(N-1)}, x^{(N-2)}, ..., x^0`. + If increasing is True, the order of the columns is reversed :math:`x^0, x^1, ..., x^{(N-1)}`. Such a + matrix with a geometric progression in each row is named for Alexandre-Theophile Vandermonde. + + Arguments: + x (Tensor): 1-D input tensor. + N (int, optional): Number of columns in the output. If N is not specified, + a square array is returned :math:`(N = len(x))`. + increasing (bool, optional): Order of the powers of the columns. If True, + the powers increase from left to right, if False (the default) they are reversed. + + Returns: + Tensor: Vandermonde matrix. If increasing is False, the first column is :math:`x^{(N-1)}`, + the second :math:`x^{(N-2)}` and so forth. If increasing is True, the columns + are :math:`x^0, x^1, ..., x^{(N-1)}`. + + Example:: + + >>> x = torch.tensor([1, 2, 3, 5]) + >>> torch.vander(x) + tensor([[ 1, 1, 1, 1], + [ 8, 4, 2, 1], + [ 27, 9, 3, 1], + [125, 25, 5, 1]]) + >>> torch.vander(x, N=3) + tensor([[ 1, 1, 1], + [ 4, 2, 1], + [ 9, 3, 1], + [25, 5, 1]]) + >>> torch.vander(x, N=3, increasing=True) + tensor([[ 1, 1, 1], + [ 1, 2, 4], + [ 1, 3, 9], + [ 1, 5, 25]]) + """ + +@overload +def var( + input: Tensor, + dim: _int | _size | None, + unbiased: _bool = True, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + var(input, dim=None, *, correction=1, keepdim=False, out=None) -> Tensor + + Calculates the variance over the dimensions specified by :attr:`dim`. :attr:`dim` + can be a single dimension, list of dimensions, or ``None`` to reduce over all + dimensions. + + The variance (:math:`\sigma^2`) is calculated as + + .. math:: \sigma^2 = \frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2 + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.var(a, dim=1, keepdim=True) + tensor([[1.0631], + [0.5590], + [1.4893], + [0.8258]]) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def var( + input: Tensor, + dim: _int | _size | None = None, + *, + correction: Number | _complex | None = None, + keepdim: _bool = False, + out: Tensor | None = None, +) -> Tensor: + r""" + var(input, dim=None, *, correction=1, keepdim=False, out=None) -> Tensor + + Calculates the variance over the dimensions specified by :attr:`dim`. :attr:`dim` + can be a single dimension, list of dimensions, or ``None`` to reduce over all + dimensions. + + The variance (:math:`\sigma^2`) is calculated as + + .. math:: \sigma^2 = \frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2 + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.var(a, dim=1, keepdim=True) + tensor([[1.0631], + [0.5590], + [1.4893], + [0.8258]]) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def var(input: Tensor, unbiased: _bool = True) -> Tensor: + r""" + var(input, dim=None, *, correction=1, keepdim=False, out=None) -> Tensor + + Calculates the variance over the dimensions specified by :attr:`dim`. :attr:`dim` + can be a single dimension, list of dimensions, or ``None`` to reduce over all + dimensions. + + The variance (:math:`\sigma^2`) is calculated as + + .. math:: \sigma^2 = \frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2 + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.var(a, dim=1, keepdim=True) + tensor([[1.0631], + [0.5590], + [1.4893], + [0.8258]]) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def var( + input: Tensor, + dim: Sequence[str | EllipsisType | None], + *, + correction: Number | _complex | None = None, + keepdim: _bool = False, + out: Tensor | None = None, +) -> Tensor: + r""" + var(input, dim=None, *, correction=1, keepdim=False, out=None) -> Tensor + + Calculates the variance over the dimensions specified by :attr:`dim`. :attr:`dim` + can be a single dimension, list of dimensions, or ``None`` to reduce over all + dimensions. + + The variance (:math:`\sigma^2`) is calculated as + + .. math:: \sigma^2 = \frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2 + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.var(a, dim=1, keepdim=True) + tensor([[1.0631], + [0.5590], + [1.4893], + [0.8258]]) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def var( + input: Tensor, + dim: Sequence[str | EllipsisType | None], + unbiased: _bool = True, + keepdim: _bool = False, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + var(input, dim=None, *, correction=1, keepdim=False, out=None) -> Tensor + + Calculates the variance over the dimensions specified by :attr:`dim`. :attr:`dim` + can be a single dimension, list of dimensions, or ``None`` to reduce over all + dimensions. + + The variance (:math:`\sigma^2`) is calculated as + + .. math:: \sigma^2 = \frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2 + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.var(a, dim=1, keepdim=True) + tensor([[1.0631], + [0.5590], + [1.4893], + [0.8258]]) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def var_mean( + input: Tensor, + dim: _int | _size | None, + unbiased: _bool = True, + keepdim: _bool = False, +) -> tuple[Tensor, Tensor]: + r""" + var_mean(input, dim=None, *, correction=1, keepdim=False, out=None) -> (Tensor, Tensor) + + Calculates the variance and mean over the dimensions specified by :attr:`dim`. + :attr:`dim` can be a single dimension, list of dimensions, or ``None`` to + reduce over all dimensions. + + The variance (:math:`\sigma^2`) is calculated as + + .. math:: \sigma^2 = \frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2 + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Returns: + A tuple (var, mean) containing the variance and mean. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.var_mean(a, dim=0, keepdim=True) + (tensor([[1.5926, 1.0056, 1.2005, 0.3646]]), + tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]])) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def var_mean( + input: Tensor, + dim: _int | _size | None = None, + *, + correction: Number | _complex | None = None, + keepdim: _bool = False, +) -> tuple[Tensor, Tensor]: + r""" + var_mean(input, dim=None, *, correction=1, keepdim=False, out=None) -> (Tensor, Tensor) + + Calculates the variance and mean over the dimensions specified by :attr:`dim`. + :attr:`dim` can be a single dimension, list of dimensions, or ``None`` to + reduce over all dimensions. + + The variance (:math:`\sigma^2`) is calculated as + + .. math:: \sigma^2 = \frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2 + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Returns: + A tuple (var, mean) containing the variance and mean. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.var_mean(a, dim=0, keepdim=True) + (tensor([[1.5926, 1.0056, 1.2005, 0.3646]]), + tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]])) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def var_mean( + input: Tensor, + unbiased: _bool = True, +) -> tuple[Tensor, Tensor]: + r""" + var_mean(input, dim=None, *, correction=1, keepdim=False, out=None) -> (Tensor, Tensor) + + Calculates the variance and mean over the dimensions specified by :attr:`dim`. + :attr:`dim` can be a single dimension, list of dimensions, or ``None`` to + reduce over all dimensions. + + The variance (:math:`\sigma^2`) is calculated as + + .. math:: \sigma^2 = \frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2 + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Returns: + A tuple (var, mean) containing the variance and mean. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.var_mean(a, dim=0, keepdim=True) + (tensor([[1.5926, 1.0056, 1.2005, 0.3646]]), + tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]])) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def var_mean( + input: Tensor, + dim: Sequence[str | EllipsisType | None], + *, + correction: Number | _complex | None = None, + keepdim: _bool = False, +) -> tuple[Tensor, Tensor]: + r""" + var_mean(input, dim=None, *, correction=1, keepdim=False, out=None) -> (Tensor, Tensor) + + Calculates the variance and mean over the dimensions specified by :attr:`dim`. + :attr:`dim` can be a single dimension, list of dimensions, or ``None`` to + reduce over all dimensions. + + The variance (:math:`\sigma^2`) is calculated as + + .. math:: \sigma^2 = \frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2 + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Returns: + A tuple (var, mean) containing the variance and mean. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.var_mean(a, dim=0, keepdim=True) + (tensor([[1.5926, 1.0056, 1.2005, 0.3646]]), + tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]])) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +@overload +def var_mean( + input: Tensor, + dim: Sequence[str | EllipsisType | None], + unbiased: _bool = True, + keepdim: _bool = False, +) -> tuple[Tensor, Tensor]: + r""" + var_mean(input, dim=None, *, correction=1, keepdim=False, out=None) -> (Tensor, Tensor) + + Calculates the variance and mean over the dimensions specified by :attr:`dim`. + :attr:`dim` can be a single dimension, list of dimensions, or ``None`` to + reduce over all dimensions. + + The variance (:math:`\sigma^2`) is calculated as + + .. math:: \sigma^2 = \frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2 + + where :math:`x` is the sample set of elements, :math:`\bar{x}` is the + sample mean, :math:`N` is the number of samples and :math:`\delta N` is + the :attr:`correction`. + + + + If :attr:`keepdim` is ``True``, the output tensor is of the same size + as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. + Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the + output tensor having 1 (or ``len(dim)``) fewer dimension(s). + + + Args: + input (Tensor): the input tensor. + + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. + + + Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. + + out (Tensor, optional): the output tensor. + + Returns: + A tuple (var, mean) containing the variance and mean. + + Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.var_mean(a, dim=0, keepdim=True) + (tensor([[1.5926, 1.0056, 1.2005, 0.3646]]), + tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]])) + + .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + """ + +def vdot( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + vdot(input, other, *, out=None) -> Tensor + + Computes the dot product of two 1D vectors along a dimension. + + In symbols, this function computes + + .. math:: + + \sum_{i=1}^n \overline{x_i}y_i. + + where :math:`\overline{x_i}` denotes the conjugate for complex + vectors, and it is the identity for real vectors. + + .. note:: + + Unlike NumPy's vdot, torch.vdot intentionally only supports computing the dot product + of two 1D tensors with the same number of elements. + + .. seealso:: + + :func:`torch.linalg.vecdot` computes the dot product of two batches of vectors along a dimension. + + Args: + input (Tensor): first tensor in the dot product, must be 1D. Its conjugate is used if it's complex. + other (Tensor): second tensor in the dot product, must be 1D. + + Keyword args: + + .. note:: out (Tensor, optional): the output tensor. + + + Example:: + + >>> torch.vdot(torch.tensor([2, 3]), torch.tensor([2, 1])) + tensor(7) + >>> a = torch.tensor((1 +2j, 3 - 1j)) + >>> b = torch.tensor((2 +1j, 4 - 0j)) + >>> torch.vdot(a, b) + tensor([16.+1.j]) + >>> torch.vdot(b, a) + tensor([16.-1.j]) + """ + +def view_as_complex(input: Tensor) -> Tensor: + r""" + view_as_complex(input) -> Tensor + + Returns a view of :attr:`input` as a complex tensor. For an input complex + tensor of :attr:`size` :math:`m1, m2, \dots, mi, 2`, this function returns a + new complex tensor of :attr:`size` :math:`m1, m2, \dots, mi` where the last + dimension of the input tensor is expected to represent the real and imaginary + components of complex numbers. + + .. warning:: + :func:`view_as_complex` is only supported for tensors with + :class:`torch.dtype` ``torch.float64`` and ``torch.float32``. The input is + expected to have the last dimension of :attr:`size` 2. In addition, the + tensor must have a `stride` of 1 for its last dimension. The strides of all + other dimensions must be even numbers. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> x=torch.randn(4, 2) + >>> x + tensor([[ 1.6116, -0.5772], + [-1.4606, -0.9120], + [ 0.0786, -1.7497], + [-0.6561, -1.6623]]) + >>> torch.view_as_complex(x) + tensor([(1.6116-0.5772j), (-1.4606-0.9120j), (0.0786-1.7497j), (-0.6561-1.6623j)]) + """ + +def view_as_complex_copy( + input: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.view_as_complex`, but all output tensors + are freshly created instead of aliasing the input. + """ + +def view_as_real(input: Tensor) -> Tensor: + r""" + view_as_real(input) -> Tensor + + Returns a view of :attr:`input` as a real tensor. For an input complex tensor of + :attr:`size` :math:`m1, m2, \dots, mi`, this function returns a new + real tensor of size :math:`m1, m2, \dots, mi, 2`, where the last dimension of size 2 + represents the real and imaginary components of complex numbers. + + .. warning:: + :func:`view_as_real` is only supported for tensors with ``complex dtypes``. + + Args: + input (Tensor): the input tensor. + + Example:: + + >>> x=torch.randn(4, dtype=torch.cfloat) + >>> x + tensor([(0.4737-0.3839j), (-0.2098-0.6699j), (0.3470-0.9451j), (-0.5174-1.3136j)]) + >>> torch.view_as_real(x) + tensor([[ 0.4737, -0.3839], + [-0.2098, -0.6699], + [ 0.3470, -0.9451], + [-0.5174, -1.3136]]) + """ + +def view_as_real_copy( + input: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.view_as_real`, but all output tensors + are freshly created instead of aliasing the input. + """ + +@overload +def view_copy( + input: Tensor, + dtype: _dtype, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.view`, but all output tensors + are freshly created instead of aliasing the input. + """ + +@overload +def view_copy( + input: Tensor, + size: Sequence[_int | SymInt], + *, + out: Tensor | None = None, +) -> Tensor: + r""" + Performs the same operation as :func:`torch.view`, but all output tensors + are freshly created instead of aliasing the input. + """ + +@overload +def vsplit(input: Tensor, sections: _int) -> tuple[Tensor, ...]: + r""" + vsplit(input, indices_or_sections) -> List of Tensors + + Splits :attr:`input`, a tensor with two or more dimensions, into multiple tensors + vertically according to :attr:`indices_or_sections`. Each split is a view of + :attr:`input`. + + This is equivalent to calling torch.tensor_split(input, indices_or_sections, dim=0) + (the split dimension is 0), except that if :attr:`indices_or_sections` is an integer + it must evenly divide the split dimension or a runtime error will be thrown. + + This function is based on NumPy's :func:`numpy.vsplit`. + + Args: + input (Tensor): tensor to split. + indices_or_sections (int or list or tuple of ints): See argument in :func:`torch.tensor_split`. + + Example:: + + >>> t = torch.arange(16.0).reshape(4,4) + >>> t + tensor([[ 0., 1., 2., 3.], + [ 4., 5., 6., 7.], + [ 8., 9., 10., 11.], + [12., 13., 14., 15.]]) + >>> torch.vsplit(t, 2) + (tensor([[0., 1., 2., 3.], + [4., 5., 6., 7.]]), + tensor([[ 8., 9., 10., 11.], + [12., 13., 14., 15.]])) + >>> torch.vsplit(t, [3, 6]) + (tensor([[ 0., 1., 2., 3.], + [ 4., 5., 6., 7.], + [ 8., 9., 10., 11.]]), + tensor([[12., 13., 14., 15.]]), + tensor([], size=(0, 4))) + """ + +@overload +def vsplit(input: Tensor, indices: _size) -> tuple[Tensor, ...]: + r""" + vsplit(input, indices_or_sections) -> List of Tensors + + Splits :attr:`input`, a tensor with two or more dimensions, into multiple tensors + vertically according to :attr:`indices_or_sections`. Each split is a view of + :attr:`input`. + + This is equivalent to calling torch.tensor_split(input, indices_or_sections, dim=0) + (the split dimension is 0), except that if :attr:`indices_or_sections` is an integer + it must evenly divide the split dimension or a runtime error will be thrown. + + This function is based on NumPy's :func:`numpy.vsplit`. + + Args: + input (Tensor): tensor to split. + indices_or_sections (int or list or tuple of ints): See argument in :func:`torch.tensor_split`. + + Example:: + + >>> t = torch.arange(16.0).reshape(4,4) + >>> t + tensor([[ 0., 1., 2., 3.], + [ 4., 5., 6., 7.], + [ 8., 9., 10., 11.], + [12., 13., 14., 15.]]) + >>> torch.vsplit(t, 2) + (tensor([[0., 1., 2., 3.], + [4., 5., 6., 7.]]), + tensor([[ 8., 9., 10., 11.], + [12., 13., 14., 15.]])) + >>> torch.vsplit(t, [3, 6]) + (tensor([[ 0., 1., 2., 3.], + [ 4., 5., 6., 7.], + [ 8., 9., 10., 11.]]), + tensor([[12., 13., 14., 15.]]), + tensor([], size=(0, 4))) + """ + +def vstack( + tensors: tuple[Tensor, ...] | list[Tensor] | None, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + vstack(tensors, *, out=None) -> Tensor + + Stack tensors in sequence vertically (row wise). + + This is equivalent to concatenation along the first axis after all 1-D tensors have been reshaped by :func:`torch.atleast_2d`. + + Args: + tensors (sequence of Tensors): sequence of tensors to concatenate + + Keyword args: + out (Tensor, optional): the output tensor. + + Example:: + + >>> a = torch.tensor([1, 2, 3]) + >>> b = torch.tensor([4, 5, 6]) + >>> torch.vstack((a,b)) + tensor([[1, 2, 3], + [4, 5, 6]]) + >>> a = torch.tensor([[1],[2],[3]]) + >>> b = torch.tensor([[4],[5],[6]]) + >>> torch.vstack((a,b)) + tensor([[1], + [2], + [3], + [4], + [5], + [6]]) + """ + +@overload +def where(condition: Tensor) -> tuple[Tensor, ...]: + r""" + where(condition, input, other, *, out=None) -> Tensor + + Return a tensor of elements selected from either :attr:`input` or :attr:`other`, depending on :attr:`condition`. + + The operation is defined as: + + .. math:: + \text{out}_i = \begin{cases} + \text{input}_i & \text{if } \text{condition}_i \\ + \text{other}_i & \text{otherwise} \\ + \end{cases} + + .. note:: + The tensors :attr:`condition`, :attr:`input`, :attr:`other` must be :ref:`broadcastable `. + + Arguments: + condition (BoolTensor): When True (nonzero), yield input, otherwise yield other + input (Tensor or Scalar): value (if :attr:`input` is a scalar) or values selected at indices + where :attr:`condition` is ``True`` + other (Tensor or Scalar): value (if :attr:`other` is a scalar) or values selected at indices + where :attr:`condition` is ``False`` + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + Tensor: A tensor of shape equal to the broadcasted shape of :attr:`condition`, :attr:`input`, :attr:`other` + + Example:: + + >>> x = torch.randn(3, 2) + >>> y = torch.ones(3, 2) + >>> x + tensor([[-0.4620, 0.3139], + [ 0.3898, -0.7197], + [ 0.0478, -0.1657]]) + >>> torch.where(x > 0, 1.0, 0.0) + tensor([[0., 1.], + [1., 0.], + [1., 0.]]) + >>> torch.where(x > 0, x, y) + tensor([[ 1.0000, 0.3139], + [ 0.3898, 1.0000], + [ 0.0478, 1.0000]]) + >>> x = torch.randn(2, 2, dtype=torch.double) + >>> x + tensor([[ 1.0779, 0.0383], + [-0.8785, -1.1089]], dtype=torch.float64) + >>> torch.where(x > 0, x, 0.) + tensor([[1.0779, 0.0383], + [0.0000, 0.0000]], dtype=torch.float64) + + .. function:: where(condition) -> tuple of LongTensor + :noindex: + + ``torch.where(condition)`` is identical to + ``torch.nonzero(condition, as_tuple=True)``. + + .. note:: + See also :func:`torch.nonzero`. + """ + +@overload +def where( + condition: Tensor, + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + where(condition, input, other, *, out=None) -> Tensor + + Return a tensor of elements selected from either :attr:`input` or :attr:`other`, depending on :attr:`condition`. + + The operation is defined as: + + .. math:: + \text{out}_i = \begin{cases} + \text{input}_i & \text{if } \text{condition}_i \\ + \text{other}_i & \text{otherwise} \\ + \end{cases} + + .. note:: + The tensors :attr:`condition`, :attr:`input`, :attr:`other` must be :ref:`broadcastable `. + + Arguments: + condition (BoolTensor): When True (nonzero), yield input, otherwise yield other + input (Tensor or Scalar): value (if :attr:`input` is a scalar) or values selected at indices + where :attr:`condition` is ``True`` + other (Tensor or Scalar): value (if :attr:`other` is a scalar) or values selected at indices + where :attr:`condition` is ``False`` + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + Tensor: A tensor of shape equal to the broadcasted shape of :attr:`condition`, :attr:`input`, :attr:`other` + + Example:: + + >>> x = torch.randn(3, 2) + >>> y = torch.ones(3, 2) + >>> x + tensor([[-0.4620, 0.3139], + [ 0.3898, -0.7197], + [ 0.0478, -0.1657]]) + >>> torch.where(x > 0, 1.0, 0.0) + tensor([[0., 1.], + [1., 0.], + [1., 0.]]) + >>> torch.where(x > 0, x, y) + tensor([[ 1.0000, 0.3139], + [ 0.3898, 1.0000], + [ 0.0478, 1.0000]]) + >>> x = torch.randn(2, 2, dtype=torch.double) + >>> x + tensor([[ 1.0779, 0.0383], + [-0.8785, -1.1089]], dtype=torch.float64) + >>> torch.where(x > 0, x, 0.) + tensor([[1.0779, 0.0383], + [0.0000, 0.0000]], dtype=torch.float64) + + .. function:: where(condition) -> tuple of LongTensor + :noindex: + + ``torch.where(condition)`` is identical to + ``torch.nonzero(condition, as_tuple=True)``. + + .. note:: + See also :func:`torch.nonzero`. + """ + +@overload +def where( + condition: Tensor, + self: Number | _complex, + other: Tensor, +) -> Tensor: + r""" + where(condition, input, other, *, out=None) -> Tensor + + Return a tensor of elements selected from either :attr:`input` or :attr:`other`, depending on :attr:`condition`. + + The operation is defined as: + + .. math:: + \text{out}_i = \begin{cases} + \text{input}_i & \text{if } \text{condition}_i \\ + \text{other}_i & \text{otherwise} \\ + \end{cases} + + .. note:: + The tensors :attr:`condition`, :attr:`input`, :attr:`other` must be :ref:`broadcastable `. + + Arguments: + condition (BoolTensor): When True (nonzero), yield input, otherwise yield other + input (Tensor or Scalar): value (if :attr:`input` is a scalar) or values selected at indices + where :attr:`condition` is ``True`` + other (Tensor or Scalar): value (if :attr:`other` is a scalar) or values selected at indices + where :attr:`condition` is ``False`` + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + Tensor: A tensor of shape equal to the broadcasted shape of :attr:`condition`, :attr:`input`, :attr:`other` + + Example:: + + >>> x = torch.randn(3, 2) + >>> y = torch.ones(3, 2) + >>> x + tensor([[-0.4620, 0.3139], + [ 0.3898, -0.7197], + [ 0.0478, -0.1657]]) + >>> torch.where(x > 0, 1.0, 0.0) + tensor([[0., 1.], + [1., 0.], + [1., 0.]]) + >>> torch.where(x > 0, x, y) + tensor([[ 1.0000, 0.3139], + [ 0.3898, 1.0000], + [ 0.0478, 1.0000]]) + >>> x = torch.randn(2, 2, dtype=torch.double) + >>> x + tensor([[ 1.0779, 0.0383], + [-0.8785, -1.1089]], dtype=torch.float64) + >>> torch.where(x > 0, x, 0.) + tensor([[1.0779, 0.0383], + [0.0000, 0.0000]], dtype=torch.float64) + + .. function:: where(condition) -> tuple of LongTensor + :noindex: + + ``torch.where(condition)`` is identical to + ``torch.nonzero(condition, as_tuple=True)``. + + .. note:: + See also :func:`torch.nonzero`. + """ + +@overload +def where( + condition: Tensor, + input: Tensor, + other: Number | _complex, +) -> Tensor: + r""" + where(condition, input, other, *, out=None) -> Tensor + + Return a tensor of elements selected from either :attr:`input` or :attr:`other`, depending on :attr:`condition`. + + The operation is defined as: + + .. math:: + \text{out}_i = \begin{cases} + \text{input}_i & \text{if } \text{condition}_i \\ + \text{other}_i & \text{otherwise} \\ + \end{cases} + + .. note:: + The tensors :attr:`condition`, :attr:`input`, :attr:`other` must be :ref:`broadcastable `. + + Arguments: + condition (BoolTensor): When True (nonzero), yield input, otherwise yield other + input (Tensor or Scalar): value (if :attr:`input` is a scalar) or values selected at indices + where :attr:`condition` is ``True`` + other (Tensor or Scalar): value (if :attr:`other` is a scalar) or values selected at indices + where :attr:`condition` is ``False`` + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + Tensor: A tensor of shape equal to the broadcasted shape of :attr:`condition`, :attr:`input`, :attr:`other` + + Example:: + + >>> x = torch.randn(3, 2) + >>> y = torch.ones(3, 2) + >>> x + tensor([[-0.4620, 0.3139], + [ 0.3898, -0.7197], + [ 0.0478, -0.1657]]) + >>> torch.where(x > 0, 1.0, 0.0) + tensor([[0., 1.], + [1., 0.], + [1., 0.]]) + >>> torch.where(x > 0, x, y) + tensor([[ 1.0000, 0.3139], + [ 0.3898, 1.0000], + [ 0.0478, 1.0000]]) + >>> x = torch.randn(2, 2, dtype=torch.double) + >>> x + tensor([[ 1.0779, 0.0383], + [-0.8785, -1.1089]], dtype=torch.float64) + >>> torch.where(x > 0, x, 0.) + tensor([[1.0779, 0.0383], + [0.0000, 0.0000]], dtype=torch.float64) + + .. function:: where(condition) -> tuple of LongTensor + :noindex: + + ``torch.where(condition)`` is identical to + ``torch.nonzero(condition, as_tuple=True)``. + + .. note:: + See also :func:`torch.nonzero`. + """ + +@overload +def where( + condition: Tensor, + self: Number | _complex, + other: Number | _complex, +) -> Tensor: + r""" + where(condition, input, other, *, out=None) -> Tensor + + Return a tensor of elements selected from either :attr:`input` or :attr:`other`, depending on :attr:`condition`. + + The operation is defined as: + + .. math:: + \text{out}_i = \begin{cases} + \text{input}_i & \text{if } \text{condition}_i \\ + \text{other}_i & \text{otherwise} \\ + \end{cases} + + .. note:: + The tensors :attr:`condition`, :attr:`input`, :attr:`other` must be :ref:`broadcastable `. + + Arguments: + condition (BoolTensor): When True (nonzero), yield input, otherwise yield other + input (Tensor or Scalar): value (if :attr:`input` is a scalar) or values selected at indices + where :attr:`condition` is ``True`` + other (Tensor or Scalar): value (if :attr:`other` is a scalar) or values selected at indices + where :attr:`condition` is ``False`` + + Keyword args: + out (Tensor, optional): the output tensor. + + Returns: + Tensor: A tensor of shape equal to the broadcasted shape of :attr:`condition`, :attr:`input`, :attr:`other` + + Example:: + + >>> x = torch.randn(3, 2) + >>> y = torch.ones(3, 2) + >>> x + tensor([[-0.4620, 0.3139], + [ 0.3898, -0.7197], + [ 0.0478, -0.1657]]) + >>> torch.where(x > 0, 1.0, 0.0) + tensor([[0., 1.], + [1., 0.], + [1., 0.]]) + >>> torch.where(x > 0, x, y) + tensor([[ 1.0000, 0.3139], + [ 0.3898, 1.0000], + [ 0.0478, 1.0000]]) + >>> x = torch.randn(2, 2, dtype=torch.double) + >>> x + tensor([[ 1.0779, 0.0383], + [-0.8785, -1.1089]], dtype=torch.float64) + >>> torch.where(x > 0, x, 0.) + tensor([[1.0779, 0.0383], + [0.0000, 0.0000]], dtype=torch.float64) + + .. function:: where(condition) -> tuple of LongTensor + :noindex: + + ``torch.where(condition)`` is identical to + ``torch.nonzero(condition, as_tuple=True)``. + + .. note:: + See also :func:`torch.nonzero`. + """ + +@overload +def xlogy( + input: Tensor, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + xlogy(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.special.xlogy`. + """ + +@overload +def xlogy( + self: Number | _complex, + other: Tensor, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + xlogy(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.special.xlogy`. + """ + +@overload +def xlogy( + input: Tensor, + other: Number | _complex, + *, + out: Tensor | None = None, +) -> Tensor: + r""" + xlogy(input, other, *, out=None) -> Tensor + + Alias for :func:`torch.special.xlogy`. + """ + +@overload +def xlogy_(input: Tensor, other: Tensor) -> Tensor: ... +@overload +def xlogy_(input: Tensor, other: Number | _complex) -> Tensor: ... +def zero_(input: Tensor) -> Tensor: ... +@overload +def zeros( + size: Sequence[_int | SymInt], + *, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + zeros(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with the scalar value `0`, with the shape defined + by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.zeros(2, 3) + tensor([[ 0., 0., 0.], + [ 0., 0., 0.]]) + + >>> torch.zeros(5) + tensor([ 0., 0., 0., 0., 0.]) + """ + +@overload +def zeros( + *size: _int | SymInt, + out: Tensor | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + zeros(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with the scalar value `0`, with the shape defined + by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.zeros(2, 3) + tensor([[ 0., 0., 0.], + [ 0., 0., 0.]]) + + >>> torch.zeros(5) + tensor([ 0., 0., 0., 0., 0.]) + """ + +@overload +def zeros( + size: _size, + *, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + zeros(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with the scalar value `0`, with the shape defined + by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.zeros(2, 3) + tensor([[ 0., 0., 0.], + [ 0., 0., 0.]]) + + >>> torch.zeros(5) + tensor([ 0., 0., 0., 0., 0.]) + """ + +@overload +def zeros( + *size: _int, + names: Sequence[str | EllipsisType | None] | None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + zeros(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + + Returns a tensor filled with the scalar value `0`, with the shape defined + by the variable argument :attr:`size`. + + Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + + Keyword args: + out (Tensor, optional): the output tensor. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + + Example:: + + >>> torch.zeros(2, 3) + tensor([[ 0., 0., 0.], + [ 0., 0., 0.]]) + + >>> torch.zeros(5) + tensor([ 0., 0., 0., 0., 0.]) + """ + +def zeros_like( + input: Tensor, + *, + memory_format: memory_format | None = None, + dtype: _dtype | None = None, + layout: _layout | None = None, + device: DeviceLikeType | None = None, + pin_memory: _bool | None = False, + requires_grad: _bool | None = False, +) -> Tensor: + r""" + zeros_like(input, *, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + + Returns a tensor filled with the scalar value `0`, with the same size as + :attr:`input`. ``torch.zeros_like(input)`` is equivalent to + ``torch.zeros(input.size(), dtype=input.dtype, layout=input.layout, device=input.device)``. + + .. warning:: + As of 0.4, this function does not support an :attr:`out` keyword. As an alternative, + the old ``torch.zeros_like(input, out=output)`` is equivalent to + ``torch.zeros(input.size(), out=output)``. + + Args: + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + + Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. + + Example:: + + >>> input = torch.empty(2, 3) + >>> torch.zeros_like(input) + tensor([[ 0., 0., 0.], + [ 0., 0., 0.]]) + """ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/__config__.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/__config__.py new file mode 100644 index 0000000000000000000000000000000000000000..9027c86a57fb7f25ebf33918509d5ffbb60b68c8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/__config__.py @@ -0,0 +1,22 @@ +import torch + + +def show() -> str: + """ + Return a human-readable string with descriptions of the + configuration of PyTorch. + """ + return torch._C._show_config() + + +# TODO: In principle, we could provide more structured version/config +# information here. For now only CXX_FLAGS is exposed, as Timer +# uses them. +def _cxx_flags() -> str: + """Returns the CXX_FLAGS used when building PyTorch.""" + return torch._C._cxx_flags() + + +def parallel_info() -> str: + r"""Returns detailed string with parallelization settings""" + return torch._C._parallel_info() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/__future__.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/__future__.py new file mode 100644 index 0000000000000000000000000000000000000000..950bdaaff336117b80390aa776d93e5ae72f7c24 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/__future__.py @@ -0,0 +1,75 @@ +_overwrite_module_params_on_conversion: bool = False +_swap_module_params_on_conversion: bool = False + + +def set_overwrite_module_params_on_conversion(value: bool) -> None: + """ + Sets whether to assign new tensors to the parameters instead of changing the + existing parameters in-place when converting an ``nn.Module``. + + When enabled, the following methods will assign new parameters to the module: + + #. ``module.{device}()`` (e.g. :meth:`nn.Module.cuda()`) for moving a module between devices + #. ``module.{dtype}()`` (e.g. :meth:`nn.Module.float()`) for converting a module to a different dtype + #. :meth:`nn.Module.to` + #. :meth:`nn.Module.to_empty` + + Args: + value (bool): Whether to assign new tensors or not. + + """ + global _overwrite_module_params_on_conversion + _overwrite_module_params_on_conversion = value + + +def get_overwrite_module_params_on_conversion() -> bool: + """ + Returns whether to assign new tensors to the parameters instead of changing the + existing parameters in-place when converting an :class:`torch.nn.Module`. Defaults to ``False``. + + See :func:`~torch.__future__.set_overwrite_module_params_on_conversion` for more information. + """ + return _overwrite_module_params_on_conversion + + +def set_swap_module_params_on_conversion(value: bool) -> None: + """ + Sets whether to use :func:`~torch.utils.swap_tensors` instead of setting ``.data`` to + change the existing parameters in-place when converting an ``nn.Module`` and instead + of ``param.copy_(state_dict[key])`` when loading a state dict into an ``nn.Module``. + + .. note:: + This function takes precedence over :func:`~torch.__future__.get_overwrite_module_params_on_conversion` + + When enabled, the following methods will swap the existing parameters in-place: + + #. ``module.{device}()`` (e.g. :meth:`nn.Module.cuda()`) for moving a module between devices + #. ``module.{dtype}()`` (e.g. :meth:`nn.Module.float()`) for converting a module to a different dtype + #. :meth:`nn.Module.to` + #. :meth:`nn.Module.to_empty` + #. :meth:`nn.Module.load_state_dict` + + The semantics for :meth:`~nn.Module.load_state_dict` when this is set are as follows: + + #. For each parameter/buffer, its corresponding ``state_dict['key']`` is transformed via + :meth:`~torch.Tensor.module_load` (i.e. ``res = param.module_load(state_dict['key'])``) + #. If necessary, ``res`` will be wrapped in an :class:`~nn.Parameter` + #. The parameter/buffer in the module will be swapped via :func:`~torch.utils.swap_tensors` + with ``res`` + + Args: + value (bool): Whether to use :func:`~torch.utils.swap_tensors` or not. + + """ + global _swap_module_params_on_conversion + _swap_module_params_on_conversion = value + + +def get_swap_module_params_on_conversion() -> bool: + """ + Returns whether to use :func:`~torch.utils.swap_tensors` instead of setting .data to + change the existing parameters in-place when converting an ``nn.Module``. Defaults to ``False``. + + See :func:`~torch.__future__.set_swap_module_params_on_conversion` for more information. + """ + return _swap_module_params_on_conversion diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..644e8e4366e1b56bb735e5f639b10abcf48e523a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/__init__.py @@ -0,0 +1,2980 @@ +""" +The torch package contains data structures for multi-dimensional +tensors and defines mathematical operations over these tensors. +Additionally, it provides many utilities for efficient serialization of +Tensors and arbitrary types, and other useful utilities. + +It has a CUDA counterpart, that enables you to run your tensor computations +on an NVIDIA GPU with compute capability >= 3.0. +""" + +# mypy: allow-untyped-defs + +import builtins +import ctypes +import functools +import glob +import importlib +import inspect +import math +import os +import platform +import sys +import textwrap +import threading +import warnings +from collections.abc import Callable as _Callable +from typing import ( + Any as _Any, + get_origin as _get_origin, + overload as _overload, + TYPE_CHECKING, + TypeVar as _TypeVar, +) +from typing_extensions import ParamSpec as _ParamSpec, TypeIs as _TypeIs + + +# As a bunch of torch.packages internally still have this check +# we need to keep this. @todo: Remove tests that rely on this check as +# they are likely stale. +def _running_with_deploy() -> builtins.bool: + return False + + +from torch._utils import ( + _functionalize_sync as _sync, + _import_dotted_name, + classproperty, +) +from torch._utils_internal import ( + get_file_path, + prepare_multiprocessing_environment, + profiler_allow_cudagraph_cupti_lazy_reinit_cuda12, + USE_GLOBAL_DEPS, + USE_RTLD_GLOBAL_WITH_LIBTORCH, +) +from torch.torch_version import __version__ as __version__ + + +if TYPE_CHECKING: + from torch.types import Device, IntLikeType + + +__all__ = [ + "BoolStorage", + "BoolTensor", + "ByteStorage", + "ByteTensor", + "CharStorage", + "CharTensor", + "DoubleStorage", + "DoubleTensor", + "FloatStorage", + "FloatTensor", + "GradScaler", + "IntStorage", + "IntTensor", + "LongStorage", + "LongTensor", + "ShortStorage", + "ShortTensor", + "SymBool", + "SymFloat", + "SymInt", + "Tensor", + "TypedStorage", + "UntypedStorage", + "are_deterministic_algorithms_enabled", + "autocast", + "chunk", + "compile", + "cond", + "enable_grad", + "export", + "get_default_device", + "get_deterministic_debug_mode", + "get_device_module", + "get_float32_matmul_precision", + "get_rng_state", + "inference_mode", + "initial_seed", + "is_deterministic_algorithms_warn_only_enabled", + "is_storage", + "is_tensor", + "is_warn_always_enabled", + "load", + "lobpcg", + "manual_seed", + "matmul", + "no_grad", + "rand", + "randn", + "save", + "seed", + "set_default_device", + "set_default_tensor_type", + "set_deterministic_debug_mode", + "set_float32_matmul_precision", + "set_printoptions", + "set_rng_state", + "set_warn_always", + "split", + "stack", + "sym_float", + "sym_fresh_size", + "sym_int", + "sym_ite", + "sym_max", + "sym_min", + "sym_not", + "sym_sum", + "typename", + "unravel_index", + "use_deterministic_algorithms", + "vmap", +] + +# Please keep this list sorted +assert __all__ == sorted(__all__) + +################################################################################ +# Load the extension module +################################################################################ + +# If PyTorch was built against the ROCm runtime wheels, then there will be +# a _rocm_init module and it will define an initialize() function which can +# prepare ROCm for use. See general documentation on ROCm runtime wheels: +# https://github.com/ROCm/TheRock/blob/main/docs/packaging/python_packaging.md +# Since this module is only ever added to the wheel if built for such a +# deployment, it is always safe to attempt. +try: + from . import _rocm_init # type: ignore[attr-defined] +except ImportError: + pass +else: + _rocm_init.initialize() + del _rocm_init + + +if sys.platform == "win32": + + def _load_dll_libraries() -> None: + import sysconfig + + from torch.version import cuda as cuda_version + + pfiles_path = os.getenv("ProgramFiles", r"C:\Program Files") + py_dll_path = os.path.join(sys.exec_prefix, "Library", "bin") + th_dll_path = os.path.join(os.path.dirname(__file__), "lib") + usebase_path = os.path.join( + sysconfig.get_config_var("userbase"), "Library", "bin" + ) + py_root_bin_path = os.path.join(sys.exec_prefix, "bin") + + # When users create a virtualenv that inherits the base environment, + # we will need to add the corresponding library directory into + # DLL search directories. Otherwise, it will rely on `PATH` which + # is dependent on user settings. + if sys.exec_prefix != sys.base_exec_prefix: + base_py_dll_path = os.path.join(sys.base_exec_prefix, "Library", "bin") + else: + base_py_dll_path = "" + + dll_paths = [ + p + for p in ( + th_dll_path, + py_dll_path, + base_py_dll_path, + usebase_path, + py_root_bin_path, + ) + if os.path.exists(p) + ] + + if not builtins.any( + os.path.exists(os.path.join(p, "nvToolsExt64_1.dll")) for p in dll_paths + ): + nvtoolsext_dll_path = os.path.join( + os.getenv( + "NVTOOLSEXT_PATH", + os.path.join(pfiles_path, "NVIDIA Corporation", "NvToolsExt"), + ), + "bin", + "x64", + ) + else: + nvtoolsext_dll_path = "" + + if cuda_version and builtins.all( + not glob.glob(os.path.join(p, "cudart64*.dll")) for p in dll_paths + ): + cuda_version_1 = cuda_version.replace(".", "_") + cuda_path_var = "CUDA_PATH_V" + cuda_version_1 + default_path = os.path.join( + pfiles_path, "NVIDIA GPU Computing Toolkit", "CUDA", f"v{cuda_version}" + ) + cuda_path = os.path.join(os.getenv(cuda_path_var, default_path), "bin") + else: + cuda_path = "" + + dll_paths.extend( + p for p in (nvtoolsext_dll_path, cuda_path) if os.path.exists(p) + ) + + kernel32 = ctypes.WinDLL("kernel32.dll", use_last_error=True) + with_load_library_flags = hasattr(kernel32, "AddDllDirectory") + prev_error_mode = kernel32.SetErrorMode(0x0001) + + kernel32.LoadLibraryW.restype = ctypes.c_void_p + if with_load_library_flags: + kernel32.LoadLibraryExW.restype = ctypes.c_void_p + + for dll_path in dll_paths: + os.add_dll_directory(dll_path) + + try: + ctypes.CDLL("vcruntime140.dll") + ctypes.CDLL("msvcp140.dll") + if platform.machine() != "ARM64": + ctypes.CDLL("vcruntime140_1.dll") + except OSError: + print( + textwrap.dedent( + """ + Microsoft Visual C++ Redistributable is not installed, this may lead to the DLL load failure. + It can be downloaded at https://aka.ms/vs/17/release/vc_redist.x64.exe + """ + ).strip() + ) + + dlls = glob.glob(os.path.join(th_dll_path, "*.dll")) + path_patched = False + for dll in dlls: + is_loaded = False + if with_load_library_flags: + res = kernel32.LoadLibraryExW(dll, None, 0x00001100) + last_error = ctypes.get_last_error() + if res is None and last_error != 126: + err = ctypes.WinError(last_error) + err.strerror += ( + f' Error loading "{dll}" or one of its dependencies.' + ) + raise err + elif res is not None: + is_loaded = True + if not is_loaded: + if not path_patched: + os.environ["PATH"] = ";".join(dll_paths + [os.environ["PATH"]]) + path_patched = True + res = kernel32.LoadLibraryW(dll) + if res is None: + err = ctypes.WinError(ctypes.get_last_error()) + err.strerror += ( + f' Error loading "{dll}" or one of its dependencies.' + ) + raise err + + kernel32.SetErrorMode(prev_error_mode) + + _load_dll_libraries() + del _load_dll_libraries + + +def _get_cuda_dep_paths(path: str, lib_folder: str, lib_name: str) -> list[str]: + # Libraries can either be in + # path/nvidia/lib_folder/lib or + # path/nvidia/cuXX/lib (since CUDA 13.0) or + # path/lib_folder/lib + from torch.version import cuda as cuda_version + + nvidia_lib_paths = glob.glob( + os.path.join(path, "nvidia", lib_folder, "lib", lib_name) + ) + if cuda_version is not None: + maj_cuda_version = cuda_version.split(".")[0] + nvidia_lib_paths += glob.glob( + os.path.join(path, "nvidia", f"cu{maj_cuda_version}", "lib", lib_name) + ) + lib_paths = glob.glob(os.path.join(path, lib_folder, "lib", lib_name)) + + return nvidia_lib_paths + lib_paths + + +def _preload_cuda_lib(lib_folder: str, lib_name: str, required: bool = True) -> None: # type: ignore[valid-type] + """Preloads cuda library if it could not be found otherwise.""" + # Should only be called on Linux if default path resolution have failed + assert platform.system() == "Linux", "Should only be called on Linux" + + lib_path = None + for path in sys.path: + candidate_lib_paths = _get_cuda_dep_paths(path, lib_folder, lib_name) + if candidate_lib_paths: + lib_path = candidate_lib_paths[0] + break + if not lib_path and required: + raise ValueError(f"{lib_name} not found in the system path {sys.path}") + if lib_path: + ctypes.CDLL(lib_path) + + +def _preload_cuda_deps(err: OSError | None = None) -> None: + cuda_libs: list[tuple[str, str]] = [ + ("cublas", "libcublas.so.*[0-9]"), + ("cudnn", "libcudnn.so.*[0-9]"), + ("cuda_nvrtc", "libnvrtc.so.*[0-9]"), + ("cuda_nvrtc", "libnvrtc-builtins.so.*[0-9]"), + ("cuda_runtime", "libcudart.so.*[0-9]"), + ("cuda_cupti", "libcupti.so.*[0-9]"), + ("cufft", "libcufft.so.*[0-9]"), + ("curand", "libcurand.so.*[0-9]"), + ("nvjitlink", "libnvJitLink.so.*[0-9]"), + ("cusparse", "libcusparse.so.*[0-9]"), + ("cusparselt", "libcusparseLt.so.*[0-9]"), + ("cusolver", "libcusolver.so.*[0-9]"), + ("nccl", "libnccl.so.*[0-9]"), + ("nvshmem", "libnvshmem_host.so.*[0-9]"), + ("cufile", "libcufile.so.*[0-9]"), + ] + # If error is passed, re-raise it if it's not about one of the abovementioned + # libraries + if err is not None and not [ + lib for _, lib in cuda_libs if lib.split(".", 1)[0] in err.args[0] + ]: + raise err + + # Otherwise, try to preload dependencies from site-packages + for lib_folder, lib_name in cuda_libs: + _preload_cuda_lib(lib_folder, lib_name) + + # libnvToolsExt is Optional Dependency + _preload_cuda_lib("nvtx", "libnvToolsExt.so.*[0-9]", required=False) + + +# See Note [Global dependencies] +def _load_global_deps() -> None: + if platform.system() == "Windows": + return + + # Determine the file extension based on the platform + lib_ext = ".dylib" if platform.system() == "Darwin" else ".so" + lib_name = f"libtorch_global_deps{lib_ext}" + here = os.path.abspath(__file__) + global_deps_lib_path = os.path.join(os.path.dirname(here), "lib", lib_name) + + try: + ctypes.CDLL(global_deps_lib_path, mode=ctypes.RTLD_GLOBAL) + # Workaround slim-wheel CUDA dependency bugs in cusparse and cudnn by preloading nvjitlink + # and nvrtc. In CUDA-12.4+ cusparse depends on nvjitlink, but does not have rpath when + # shipped as wheel, which results in OS picking wrong/older version of nvjitlink library + # if `LD_LIBRARY_PATH` is defined, see https://github.com/pytorch/pytorch/issues/138460 + # Similar issue exist in cudnn that dynamically loads nvrtc, unaware of its relative path. + # See https://github.com/pytorch/pytorch/issues/145580 + try: + with open("/proc/self/maps") as f: + _maps = f.read() + + # libtorch_global_deps.so always depends in cudart, check if its installed and loaded + if "libcudart.so" not in _maps: + return + # If all above-mentioned conditions are met, preload CUDA dependencies + _preload_cuda_deps() + except Exception: + pass + + except OSError as err: + # Can happen for wheel with cuda libs as PYPI deps + # As PyTorch is not purelib, but nvidia-*-cu12 is + _preload_cuda_deps(err) + ctypes.CDLL(global_deps_lib_path, mode=ctypes.RTLD_GLOBAL) + + +if (USE_RTLD_GLOBAL_WITH_LIBTORCH or os.getenv("TORCH_USE_RTLD_GLOBAL")) and ( + platform.system() != "Windows" +): + # Do it the hard way. You might want to load libtorch with RTLD_GLOBAL in a + # few circumstances: + # + # 1. You're in a build environment (e.g., fbcode) where + # libtorch_global_deps is not available, but you still need + # to get mkl to link in with RTLD_GLOBAL or it will just + # not work. + # + # 2. You're trying to run PyTorch under UBSAN and you need + # to ensure that only one copy of libtorch is loaded, so + # vptr checks work properly + # + # If you're using this setting, you must verify that all the libraries + # you load consistently use the same libstdc++, or you may have + # mysterious segfaults. + # + old_flags = sys.getdlopenflags() + sys.setdlopenflags(os.RTLD_GLOBAL | os.RTLD_LAZY) + + from torch._C import * # noqa: F403 + + sys.setdlopenflags(old_flags) + del old_flags + +else: + # Easy way. You want this most of the time, because it will prevent + # C++ symbols from libtorch clobbering C++ symbols from other + # libraries, leading to mysterious segfaults. + # + # If building in an environment where libtorch_global_deps isn't available + # like parts of fbsource, but where RTLD_GLOBAL causes segfaults, you will + # want USE_RTLD_GLOBAL_WITH_LIBTORCH = False and USE_GLOBAL_DEPS = False + # + # See Note [Global dependencies] + if USE_GLOBAL_DEPS: + _load_global_deps() + from torch._C import * # noqa: F403 + + +class SymInt: + """ + Like an int (including magic methods), but redirects all operations on the + wrapped node. This is used in particular to symbolically record operations + in the symbolic shape workflow. + """ + + def __init__(self, node): + # This field MUST be named node; C++ binding code assumes that this + # class has a field named node that stores SymNode + self.node = node + + def __bool__(self): + return builtins.bool(self != 0) + + def __int__(self): + return self.node.int_() + + def __index__(self): + return self.node.int_() + + # Magic methods installed by torch.fx.experimental.sym_node + + def __round__(self, ndigits=None): + return self + + def __truediv__(self, other): + if isinstance(other, (builtins.float, SymFloat)): + return sym_float(self).__float_truediv__(other) + if not isinstance(other, (builtins.int, SymInt)): + return NotImplemented + return self.__int_truediv__(other) + + def __rtruediv__(self, other): + if isinstance(other, (builtins.float, SymFloat)): + return sym_float(self).__rfloat_truediv__(other) + if not isinstance(other, (builtins.int, SymInt)): + return NotImplemented + return self.__rint_truediv__(other) + + def __floordiv__(self, other): + if isinstance(other, (builtins.float, SymFloat)): + return sym_float(math.floor(sym_float(self) / other)) + if not isinstance(other, (builtins.int, SymInt)): + return NotImplemented + return self.__int_floordiv__(other) + + def __rfloordiv__(self, other): + if isinstance(other, (builtins.float, SymFloat)): + return sym_float(math.floor(other / sym_float(self))) + if not isinstance(other, (builtins.int, SymInt)): + return NotImplemented + return self.__rint_floordiv__(other) + + # nb: complex is impossible to handle correctly lol, with + # negative base and integral float need to diverge semantics and + # just always return complex. Neener neener pretend this problem + # doesn't exist + def __pow__(self, other): + if isinstance(other, (builtins.float, SymFloat)): + return sym_float(self).__pow__(other) + if not isinstance(other, (builtins.int, SymInt)): + return NotImplemented + # Guards! This guard is necessary because we need to know it to + # determine the output type of this operation + if other >= 0: + return self.__pow_by_natural__(other) + else: + # Mercifully, when the exponent is negative, Python just promotes + # to doubles and does a float pow: + # + # if (Py_SIZE(b) < 0 && c == NULL) { + # /* if exponent is negative and there's no modulus: + # return a float. This works because we know + # that this calls float_pow() which converts its + # arguments to double. */ + # Py_DECREF(a); + # Py_DECREF(b); + # return PyFloat_Type.tp_as_number->nb_power(v, w, x); + # } + return sym_float(self).__pow__(sym_float(other)) + + def __rpow__(self, other): + if isinstance(other, (builtins.float, SymFloat)): + return sym_float(self).__rpow__(other) + if not isinstance(other, (builtins.int, SymInt)): + return NotImplemented + if self >= 0: # self is exponent + return self.__rpow_by_natural__(other) + else: + return sym_float(self).__rpow__(sym_float(other)) + + def __eq__(self, other: object) -> builtins.bool: + raise TypeError("type stub not overridden") + + def __lt__(self, other) -> builtins.bool: + raise TypeError("type stub not overridden") + + def __gt__(self, other) -> builtins.bool: + raise TypeError("type stub not overridden") + + def __le__(self, other) -> builtins.bool: + raise TypeError("type stub not overridden") + + def __ge__(self, other) -> builtins.bool: + raise TypeError("type stub not overridden") + + def __add__(self, other) -> "SymInt": + raise TypeError("type stub not overridden") + + def __radd__(self, other) -> "SymInt": + raise TypeError("type stub not overridden") + + def __rmul__(self, other) -> "SymInt": + raise TypeError("type stub not overridden") + + def __mod__(self, other: "IntLikeType") -> "SymInt": + raise TypeError("type stub not overridden") + + def __mul__(self, other) -> "SymInt": + raise TypeError("type stub not overridden") + + def __pow_by_natural__(self, other) -> "SymInt": + raise TypeError("type stub not overridden") + + def __rpow_by_natural__(self, other) -> "SymInt": + raise TypeError("type stub not overridden") + + def __int_truediv__(self, other) -> "SymFloat": + raise TypeError("type stub not overridden") + + def __rint_truediv__(self, other) -> "SymFloat": + raise TypeError("type stub not overridden") + + def __int_floordiv__(self, other) -> "SymFloat": + raise TypeError("type stub not overridden") + + def __rint_floordiv__(self, other) -> "SymFloat": + raise TypeError("type stub not overridden") + + def __sym_max__(self, other): + raise TypeError("type stub not overridden") + + def __sym_min__(self, other): + raise TypeError("type stub not overridden") + + def __sym_float__(self): + raise TypeError("type stub not overridden") + + def __neg__(self): + raise TypeError("type stub not overridden") + + def __sub__(self, other: "IntLikeType") -> "SymInt": + raise TypeError("type stub not overridden") + + def __rsub__(self, other: "IntLikeType") -> "SymInt": + raise TypeError("type stub not overridden") + + def __and__(self, other) -> "SymInt": + raise TypeError("type stub not overridden") + + def __or__(self, other) -> "SymInt": + raise TypeError("type stub not overridden") + + def __repr__(self): + return self.node._graph_repr() + + def _sympy_(self): + return self.node.expr + + def __hash__(self) -> builtins.int: + if self.node.is_nested_int(): + return hash(self.node.nested_int()) + else: + # We could support constant SymInts as well, but not doing it for now + raise TypeError("unhashable type: non-nested SymInt") + # TODO: Force specialization + # This can't be done because the TypeError here is load bearing + # for einops + # https://github.com/arogozhnikov/einops/blob/6181e1e95dc58c00a3143c1726da1c6ee0463164/einops/einops.py#L237 + # return hash(builtins.int(self)) + + def as_integer_ratio(self) -> tuple["SymInt", builtins.int]: + """Represent this int as an exact integer ratio""" + return self, 1 + + def bit_length(self) -> builtins.int: + # TODO: A more relaxed guard is possible here, where you guard to + # allow all integer quantities which would result in the same bit + # length. We can also just make a dedicated Sympy function for + # computing this quantity and represent it symbolically. + return builtins.int(self).bit_length() + + def conjugate(self) -> "SymInt": + return self + + +class SymFloat: + """ + Like a float (including magic methods), but redirects all operations on the + wrapped node. This is used in particular to symbolically record operations + in the symbolic shape workflow. + """ + + def __init__(self, node): + # This field MUST be named node; C++ binding code assumes that this + # class has a field named node that stores SymNode + self.node = node + + def __truediv__(self, other): + if not isinstance(other, (builtins.int, builtins.float, SymInt, SymFloat)): + return NotImplemented + return self.__float_truediv__(sym_float(other)) + + def __rtruediv__(self, other): + if not isinstance(other, (builtins.int, builtins.float, SymInt, SymFloat)): + return NotImplemented + return self.__rfloat_truediv__(sym_float(other)) + + def __floordiv__(self, other): + if not isinstance(other, (builtins.int, builtins.float, SymInt, SymFloat)): + return NotImplemented + return sym_float(math.floor(self / sym_float(other))) + + def __rfloordiv__(self, other): + if not isinstance(other, (builtins.int, builtins.float, SymInt, SymFloat)): + return NotImplemented + return sym_float(math.floor(sym_float(other) / self)) + + def __bool__(self): + return self.node.bool_() + + def __float__(self): + return self.node.guard_float("", 0) + + def __int__(self): + return self.__trunc__().__int__() + + # Symbolic power does NOT work with negative base, this is to avoid + # potential complex outputs + def __pow__(self, other): + if not isinstance(other, (builtins.int, builtins.float, SymInt, SymFloat)): + return NotImplemented + torch._check(self >= 0) + return self.__float_pow__(other) + + def __rpow__(self, other): + if not isinstance(other, (builtins.int, builtins.float, SymInt, SymFloat)): + return NotImplemented + torch._check(other >= 0) + return self.__rfloat_pow__(other) + + # Magic methods installed by torch.fx.experimental.sym_node + + def __eq__(self, other: object) -> builtins.bool: + raise TypeError("type stub not overridden") + + def __lt__(self, other) -> builtins.bool: + raise TypeError("type stub not overridden") + + def __gt__(self, other) -> builtins.bool: + raise TypeError("type stub not overridden") + + def __le__(self, other) -> builtins.bool: + raise TypeError("type stub not overridden") + + def __ge__(self, other) -> builtins.bool: + raise TypeError("type stub not overridden") + + def __float_pow__(self, other) -> "SymFloat": + raise TypeError("type stub not overridden") + + def __rfloat_pow__(self, other) -> "SymFloat": + raise TypeError("type stub not overridden") + + def __float_truediv__(self, other) -> "SymFloat": + raise TypeError("type stub not overridden") + + def __rfloat_truediv__(self, other) -> "SymFloat": + raise TypeError("type stub not overridden") + + def __trunc__(self): + raise TypeError("type stub not overridden") + + def __sym_max__(self, other): + raise TypeError("type stub not overridden") + + def __sym_min__(self, other): + raise TypeError("type stub not overridden") + + def __sym_int__(self): + raise TypeError("type stub not overridden") + + def is_integer(self): + """Return True if the float is an integer.""" + raise TypeError("type stub not overridden") + + def as_integer_ratio(self) -> tuple[builtins.int, builtins.int]: + """Represent this float as an exact integer ratio""" + return builtins.float(self).as_integer_ratio() + + def __repr__(self): + return self.node._graph_repr() + + def _sympy_(self): + return self.node.expr + + def __hash__(self): + return hash(builtins.float(self)) + + def conjugate(self) -> "SymFloat": + """Returns the complex conjugate of the float.""" + return self + + def hex(self) -> str: + """Returns the hexadecimal representation of the float.""" + return self.node.guard_float("", 0).hex() + + +class SymBool: + """ + Like a bool (including magic methods), but redirects all operations on the + wrapped node. This is used in particular to symbolically record operations + in the symbolic shape workflow. + + Unlike regular bools, regular boolean operators will force extra guards instead + of symbolically evaluate. Use the bitwise operators instead to handle this. + """ + + def __init__(self, node): + # This field MUST be named node; C++ binding code assumes that this + # class has a field named node that stores SymNode + self.node = node + + def __bool__(self): + return self.node.bool_() + + def __int__(self): + return builtins.int(self.node.bool_()) + + # Magic methods installed by torch.fx.experimental.sym_node + def __and__(self, other) -> "SymBool": + raise TypeError("type stub not overridden") + + def __or__(self, other) -> "SymBool": + raise TypeError("type stub not overridden") + + # We very carefully define __sym_not__, and not a number of other + # plausible alternatives: + # + # - We do not override __not__ because this is not a real magic + # method; you cannot override the meaning of the not builtin in + # Python. We use the name 'sym_not' to clarify that in user code you + # cannot use the builtin not or operator.not_ or operator.__not__ and + # hit this magic method; you must use our custom sym_not operator. + # + # - We do not override the __invert__ method because SymBool is + # meant to be usable in situations where bool is expected. However, + # bitwise negation ~a does the wrong thing with booleans (because + # bool is a subclass of int, so ~1 = -2 which is not falseish.) + # This would be a giant footgun, so we get around it by defining + # our own operator. Note that bitwise and/or do the right thing, + # so we reuse the conventional operators there for readability. + # + def __sym_not__(self) -> "SymBool": + raise TypeError("type stub not overridden") + + def __sym_ite__(self, then_val, else_val): + raise TypeError("type stub not overridden") + + def __eq__(self, other) -> builtins.bool: + raise TypeError("type stub not overridden") + + def __repr__(self): + return self.node._graph_repr() + + def _sympy_(self): + return self.node.expr + + def __hash__(self): + if self.node.is_constant(): + return hash(self.node.bool_()) + else: + # Force specialization + return hash(builtins.bool(self)) + + def __sym_float__(self): + """ + Provides a SymFloat representation (0.0 or 1.0) for this SymBool. + Called by torch.sym_float() when casting SymBool to float. + """ + from torch.fx.experimental.sym_node import wrap_node + + return wrap_node(self.node.sym_float()) + + +def sym_not(a): + r"""SymInt-aware utility for logical negation. + + Args: + a (SymBool or bool): Object to negate + """ + import sympy + + if overrides.has_torch_function_unary(a): + return overrides.handle_torch_function(sym_not, (a,), a) + if hasattr(a, "__sym_not__"): + return a.__sym_not__() + if isinstance(a, sympy.Basic): + return ~a # type: ignore[operator] + return not a + + +def sym_float(a): + r"""SymInt-aware utility for float casting. + + Args: + a (SymInt, SymFloat, or object): Object to cast + """ + if overrides.has_torch_function_unary(a): + return overrides.handle_torch_function(sym_float, (a,), a) + if isinstance(a, SymFloat): + return a + elif hasattr(a, "__sym_float__"): + return a.__sym_float__() + return builtins.float(a) # type: ignore[operator] + + +def sym_int(a): + r"""SymInt-aware utility for int casting. + + Args: + a (SymInt, SymFloat, or object): Object to cast + """ + if overrides.has_torch_function_unary(a): + return overrides.handle_torch_function(sym_int, (a,), a) + if isinstance(a, SymInt): + return a + elif isinstance(a, SymFloat): + return math.trunc(a) + return builtins.int(a) # type: ignore[operator] + + +def sym_max(a, b): + """ + SymInt-aware utility for max which avoids branching on a < b. + Unlike builtins.max(), this only works for int/float, and it always + promotes to float if any argument is float (unlike builtins.max, which + will faithfully preserve the type of the input argument). + """ + if overrides.has_torch_function((a, b)): + return overrides.handle_torch_function(sym_max, (a, b), a, b) + if isinstance(a, (SymInt, SymFloat)): + return a.__sym_max__(b) + elif isinstance(b, (SymInt, SymFloat)): + # Due to promotion semantics, this is operator is commutative: + # max(1, 1.0) === max(1.0, 1) === 1.0 + return b.__sym_max__(a) + # TODO: Probably can make bool work too, just lazy + + all_types, float_types = __all_and_float_types() + + assert isinstance(a, all_types), type(a) + assert isinstance(b, all_types), type(b) + if isinstance(a, float_types) or isinstance(b, float_types): + return builtins.float(builtins.max(a, b)) # type: ignore[call-overload] + else: + return builtins.max(a, b) # type: ignore[call-overload] + + +def __all_and_float_types() -> tuple[tuple[type, ...], tuple[type, ...]]: + try: + import numpy as np + + all_types: tuple[type, ...] = ( + np.integer, + np.floating, + builtins.int, + builtins.float, + ) + float_types: tuple[type, ...] = (np.floating, builtins.float) + except ModuleNotFoundError: + all_types = (builtins.int, builtins.float) + float_types = (builtins.float,) + + return all_types, float_types + + +def sym_min(a, b): + """SymInt-aware utility for min().""" + if overrides.has_torch_function((a, b)): + return overrides.handle_torch_function(sym_min, (a, b), a, b) + if isinstance(a, (SymInt, SymFloat)): + return a.__sym_min__(b) + elif isinstance(b, (SymInt, SymFloat)): + return b.__sym_min__(a) + + all_types, float_types = __all_and_float_types() + + assert isinstance(a, all_types), type(a) + assert isinstance(b, all_types), type(b) + if isinstance(a, float_types) or isinstance(b, float_types): + return builtins.float(builtins.min(a, b)) # type: ignore[call-overload] + else: + return builtins.min(a, b) # type: ignore[call-overload] + + +def sym_sum(args): + """ + N-ary add which is faster to compute for long lists than iterated binary + addition. Only does something special for integers. + """ + if overrides.has_torch_function(args): + return overrides.handle_torch_function(sym_sum, args, args) + + found = None + for a in args: + if not isinstance(a, (SymInt, builtins.int)): + return builtins.sum(args) + if isinstance(a, SymInt): + found = a.node + if found is None: + return builtins.sum(args) + + from torch.fx.experimental.sym_node import to_node, wrap_node + + return wrap_node(found.sym_sum(tuple(to_node(found, a) for a in args))) + + +# Drop in replacement for math.sqrt, math.sin, math.cos etc +def _get_sym_math_fn(name): + def fn(a): + if overrides.has_torch_function_unary(a): + return overrides.handle_torch_function(fn, (a,), a) + if isinstance(a, SymInt): + a = torch.sym_float(a) + if hasattr(a, f"__sym_{name}__"): + return getattr(a, f"__sym_{name}__")() + return getattr(math, name)(a) + + return fn + + +__fn, __name, __sym_name = None, "", "" +for __name in ( + "sqrt", + "cos", + "cosh", + "sin", + "sinh", + "tan", + "tanh", + "asin", + "acos", + "atan", + "log2", +): + __sym_name = f"_sym_{__name}" + __fn = _get_sym_math_fn(__name) + __fn.__qualname__ = __fn.__name__ = __sym_name + globals()[__sym_name] = __fn + + +del __fn, __name, __sym_name, _get_sym_math_fn + +# Adding temporary shortcut +sym_sqrt = globals()["_sym_sqrt"] +__all__.append("sym_sqrt") + + +def sym_ite(b, t, f): + """SymInt-aware utility for ternary operator (``t if b else f``.)""" + if overrides.has_torch_function((b, t, f)): + return overrides.handle_torch_function(sym_ite, (b, t, f), b, t, f) + assert isinstance(b, (SymBool, builtins.bool)) and type(t) is type(f) + if isinstance(b, SymBool): + return b.__sym_ite__(t, f) + return t if b else f + + +# Create a fresh unbacked int, from an (possibly unbacked int) expression. +def sym_fresh_size(expr): + return torch.tensor(expr).item() + + +# Check to see if we can load C extensions, and if not provide some guidance +# on what the problem might be. +try: + # _initExtension is chosen (arbitrarily) as a sentinel. + from torch._C import _initExtension +except ImportError: + import torch._C as _C_for_compiled_check + + if _C_for_compiled_check.__file__ is None: + raise ImportError( + textwrap.dedent( + """ + Failed to load PyTorch C extensions: + It appears that PyTorch has loaded the `torch/_C` folder + of the PyTorch repository rather than the C extensions which + are expected in the `torch._C` namespace. This can occur when + using the `install` workflow. e.g. + $ python -m pip install --no-build-isolation -v . && python -c "import torch" + + This error can generally be solved using the `develop` workflow + $ python -m pip install --no-build-isolation -v -e . && python -c "import torch" # This should succeed + or by running Python from a different directory. + """ + ).strip() + ) from None + raise # If __file__ is not None the cause is unknown, so just re-raise. + +# The torch._C submodule is already loaded via `from torch._C import *` above +# Make an explicit reference to the _C submodule to appease linters +from torch import _C as _C + + +__name, __obj = "", None +for __name in dir(_C): + if __name[0] != "_" and not __name.endswith("Base"): + __all__.append(__name) + __obj = getattr(_C, __name) + if callable(__obj) or inspect.isclass(__obj): + if __obj.__module__ != __name__: # "torch" + # TODO: fix their module from C++ side + if __name not in { + "DisableTorchFunctionSubclass", + "DisableTorchFunction", + "Generator", + }: + __obj.__module__ = __name__ # "torch" + elif __name == "TensorBase": + # issue 109438 / pr 109940. Prevent TensorBase from being copied into torch. + delattr(sys.modules[__name__], __name) + +del __name, __obj + +if not TYPE_CHECKING: + # issue 38137 and python issue 43367. Submodules of a C extension are + # non-standard, and attributes of those submodules cannot be pickled since + # pickle expect to be able to import them as "from _C.sub import attr" + # which fails with "_C is not a package + def _import_extension_to_sys_modules(module, memo=None): + if memo is None: + memo = set() + if module in memo: + return + memo.add(module) + module_name = module.__name__ + for name in dir(module): + member = getattr(module, name) + member_name = getattr(member, "__name__", "") + if inspect.ismodule(member) and member_name.startswith(module_name): + sys.modules.setdefault(member_name, member) + # Recurse for submodules (e.g., `_C._dynamo.eval_frame`) + _import_extension_to_sys_modules(member, memo) + + _import_extension_to_sys_modules(_C) + del _import_extension_to_sys_modules + +################################################################################ +# Define basic utilities +################################################################################ + + +def typename(obj: _Any, /) -> str: + """ + String representation of the type of an object. + + This function returns a fully qualified string representation of an object's type. + Args: + obj (object): The object whose type to represent + Returns: + str: the type of the object `o` + Example: + >>> x = torch.tensor([1, 2, 3]) + >>> torch.typename(x) + 'torch.LongTensor' + >>> torch.typename(torch.nn.Parameter) + 'torch.nn.parameter.Parameter' + """ + if isinstance(obj, torch.Tensor): + return obj.type() + + module = getattr(obj, "__module__", "") or "" + qualname = "" + + if hasattr(obj, "__qualname__"): + qualname = obj.__qualname__ + elif hasattr(obj, "__name__"): + qualname = obj.__name__ + else: + module = obj.__class__.__module__ or "" + qualname = obj.__class__.__qualname__ + + if module in {"", "builtins"}: + return qualname + return f"{module}.{qualname}" + + +def is_tensor(obj: _Any, /) -> _TypeIs["torch.Tensor"]: + r"""Returns True if `obj` is a PyTorch tensor. + + Args: + obj (object): Object to test + Example:: + + >>> x = torch.tensor([1, 2, 3]) + >>> torch.is_tensor(x) + True + + """ + return isinstance(obj, torch.Tensor) + + +def is_storage(obj: _Any, /) -> builtins.bool: + r"""Returns True if `obj` is a PyTorch storage object. + + Args: + obj (Object): Object to test + Example:: + + >>> import torch + >>> # UntypedStorage (recommended) + >>> tensor = torch.tensor([1, 2, 3]) + >>> storage = tensor.untyped_storage() + >>> torch.is_storage(storage) + True + >>> + >>> # TypedStorage (legacy) + >>> typed_storage = torch.TypedStorage(5, dtype=torch.float32) + >>> torch.is_storage(typed_storage) + True + >>> + >>> # regular tensor (should return False) + >>> torch.is_storage(tensor) + False + >>> + >>> # non-storage object + >>> torch.is_storage([1, 2, 3]) + False + """ + return type(obj) in _storage_classes + + +_GLOBAL_DEVICE_CONTEXT = threading.local() + + +def get_default_device() -> "torch.device": + r"""Gets the default ``torch.Tensor`` to be allocated on ``device``""" + global _GLOBAL_DEVICE_CONTEXT + + from torch.overrides import _get_current_function_mode_stack + from torch.utils._device import DeviceContext + + def _get_device_with_index(device): + if device.index is not None: + return device + else: + # TODO: Call like get_device_index() method corresponding to + # each device type + return torch.tensor([]).device + + # Get device from any active DeviceContext. + device_mode = next( + filter( + lambda mode: isinstance(mode, DeviceContext), + reversed(_get_current_function_mode_stack()), + ), + None, + ) + if device_mode: + device = device_mode.device + return _get_device_with_index(device) + + device_context = getattr(_GLOBAL_DEVICE_CONTEXT, "device_context", None) + if device_context is not None: + return _get_device_with_index(device_context.device) + return torch.device("cpu") + + +def set_default_device(device: "Device") -> None: + """Sets the default ``torch.Tensor`` to be allocated on ``device``. This + does not affect factory function calls which are called with an explicit + ``device`` argument. Factory calls will be performed as if they + were passed ``device`` as an argument. + + To only temporarily change the default device instead of setting it + globally, use ``with torch.device(device):`` instead. + + The default device is initially ``cpu``. If you set the default tensor + device to another device (e.g., ``cuda``) without a device index, tensors + will be allocated on whatever the current device for the device type, + even after :func:`torch.cuda.set_device` is called. + + .. warning:: + + This function imposes a slight performance cost on every Python + call to the torch API (not just factory functions). If this + is causing problems for you, please comment on + https://github.com/pytorch/pytorch/issues/92701 + + .. note:: + + This doesn't affect functions that create tensors that share the same memory as the input, like: + :func:`torch.from_numpy` and :func:`torch.frombuffer` + + Args: + device (device or string): the device to set as default + + Example:: + + >>> # xdoctest: +SKIP("requires cuda, changes global state") + >>> torch.get_default_device() + device(type='cpu') + >>> torch.set_default_device('cuda') # current device is 0 + >>> torch.get_default_device() + device(type='cuda', index=0) + >>> torch.set_default_device('cuda') + >>> torch.cuda.set_device('cuda:1') # current device is 1 + >>> torch.get_default_device() + device(type='cuda', index=1) + >>> torch.set_default_device('cuda:1') + >>> torch.get_default_device() + device(type='cuda', index=1) + + """ + global _GLOBAL_DEVICE_CONTEXT + if hasattr(_GLOBAL_DEVICE_CONTEXT, "device_context"): + device_context = _GLOBAL_DEVICE_CONTEXT.device_context + if device_context is not None: + device_context.__exit__(None, None, None) + + if device is None: + device_context = None + else: + from torch.utils._device import DeviceContext + + device_context = DeviceContext(device) + device_context.__enter__() + _GLOBAL_DEVICE_CONTEXT.device_context = device_context + + +def set_default_tensor_type(t: type["torch.Tensor"] | str, /) -> None: + r""" + .. warning:: + + This function is deprecated as of PyTorch 2.1, please use :func:`torch.set_default_dtype()` and + :func:`torch.set_default_device()` as alternatives. + + Sets the default ``torch.Tensor`` type to floating point tensor type + ``t``. This type will also be used as default floating point type for + type inference in :func:`torch.tensor`. + + The default floating point tensor type is initially ``torch.FloatTensor``. + + Args: + t (type or string): the floating point tensor type or its name + + Example:: + + >>> # xdoctest: +SKIP("Other tests may have changed the default type. Can we reset it?") + >>> torch.tensor([1.2, 3]).dtype # initial default for floating point is torch.float32 + torch.float32 + >>> torch.set_default_tensor_type(torch.DoubleTensor) + >>> torch.tensor([1.2, 3]).dtype # a new floating point tensor + torch.float64 + + """ + if isinstance(t, str): + t = _import_dotted_name(t) + _C._set_default_tensor_type(t) + + +def set_default_dtype(d: "torch.dtype", /) -> None: + r""" + + Sets the default floating point dtype to :attr:`d`. Supports floating point dtype + as inputs. Other dtypes will cause torch to raise an exception. + + When PyTorch is initialized its default floating point dtype is torch.float32, + and the intent of set_default_dtype(torch.float64) is to facilitate NumPy-like + type inference. The default floating point dtype is used to: + + 1. Implicitly determine the default complex dtype. When the default floating type is float16, + the default complex dtype is complex32. For float32, the default complex dtype is complex64. + For float64, it is complex128. For bfloat16, an exception will be raised because + there is no corresponding complex type for bfloat16. + 2. Infer the dtype for tensors constructed using Python floats or complex Python + numbers. See examples below. + 3. Determine the result of type promotion between bool and integer tensors and + Python floats and complex Python numbers. + + Args: + d (:class:`torch.dtype`): the floating point dtype to make the default. + + Example: + >>> # xdoctest: +SKIP("Other tests may have changed the default type. Can we reset it?") + >>> # initial default for floating point is torch.float32 + >>> # Python floats are interpreted as float32 + >>> torch.tensor([1.2, 3]).dtype + torch.float32 + >>> # initial default for floating point is torch.complex64 + >>> # Complex Python numbers are interpreted as complex64 + >>> torch.tensor([1.2, 3j]).dtype + torch.complex64 + + >>> torch.set_default_dtype(torch.float64) + >>> # Python floats are now interpreted as float64 + >>> torch.tensor([1.2, 3]).dtype # a new floating point tensor + torch.float64 + >>> # Complex Python numbers are now interpreted as complex128 + >>> torch.tensor([1.2, 3j]).dtype # a new complex tensor + torch.complex128 + + >>> torch.set_default_dtype(torch.float16) + >>> # Python floats are now interpreted as float16 + >>> torch.tensor([1.2, 3]).dtype # a new floating point tensor + torch.float16 + >>> # Complex Python numbers are now interpreted as complex128 + >>> torch.tensor([1.2, 3j]).dtype # a new complex tensor + torch.complex32 + + """ + _C._set_default_dtype(d) + + +def use_deterministic_algorithms( + mode: builtins.bool, + *, + warn_only: builtins.bool = False, +) -> None: + r"""Sets whether PyTorch operations must use "deterministic" + algorithms. That is, algorithms which, given the same input, and when + run on the same software and hardware, always produce the same output. + When enabled, operations will use deterministic algorithms when available, + and if only nondeterministic algorithms are available they will throw a + :class:`RuntimeError` when called. + + .. note:: This setting alone is not always enough to make an application + reproducible. Refer to :ref:`reproducibility` for more information. + + .. note:: :func:`torch.set_deterministic_debug_mode` offers an alternative + interface for this feature. + + The following normally-nondeterministic operations will act + deterministically when ``mode=True``: + + * :class:`torch.nn.Conv1d` when called on CUDA tensor + * :class:`torch.nn.Conv2d` when called on CUDA tensor + * :class:`torch.nn.Conv3d` when called on CUDA tensor + * :class:`torch.nn.ConvTranspose1d` when called on CUDA tensor + * :class:`torch.nn.ConvTranspose2d` when called on CUDA tensor + * :class:`torch.nn.ConvTranspose3d` when called on CUDA tensor + * :class:`torch.nn.ReplicationPad1d` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.ReplicationPad2d` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.ReplicationPad3d` when attempting to differentiate a CUDA tensor + * :func:`torch.bmm` when called on sparse-dense CUDA tensors + * :func:`torch.Tensor.__getitem__` when attempting to differentiate a CPU tensor + and the index is a list of tensors + * :func:`torch.Tensor.index_put` with ``accumulate=False`` + * :func:`torch.Tensor.index_put` with ``accumulate=True`` when called on a CPU + tensor + * :func:`torch.Tensor.put_` with ``accumulate=True`` when called on a CPU + tensor + * :func:`torch.Tensor.scatter_add_` when called on a CUDA tensor + * :func:`torch.gather` when called on a CUDA tensor that requires grad + * :func:`torch.index_add` when called on CUDA tensor + * :func:`torch.index_select` when attempting to differentiate a CUDA tensor + * :func:`torch.repeat_interleave` when attempting to differentiate a CUDA tensor + * :func:`torch.Tensor.index_copy` when called on a CPU or CUDA tensor + * :func:`torch.Tensor.scatter` when `src` type is Tensor and called on CUDA tensor + * :func:`torch.Tensor.scatter_reduce` when ``reduce='sum'`` or ``reduce='mean'`` and called on CUDA tensor + + The following normally-nondeterministic operations will throw a + :class:`RuntimeError` when ``mode=True``: + + * :class:`torch.nn.AvgPool3d` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.AdaptiveAvgPool2d` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.AdaptiveAvgPool3d` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.MaxPool3d` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.AdaptiveMaxPool2d` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.FractionalMaxPool2d` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.FractionalMaxPool3d` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.MaxUnpool1d` + * :class:`torch.nn.MaxUnpool2d` + * :class:`torch.nn.MaxUnpool3d` + * :func:`torch.nn.functional.interpolate` when attempting to differentiate a CUDA tensor + and one of the following modes is used: + + - ``linear`` + - ``bilinear`` + - ``bicubic`` + - ``trilinear`` + + * :class:`torch.nn.ReflectionPad1d` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.ReflectionPad2d` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.ReflectionPad3d` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.NLLLoss` when called on a CUDA tensor + * :class:`torch.nn.CTCLoss` when attempting to differentiate a CUDA tensor + * :class:`torch.nn.EmbeddingBag` when attempting to differentiate a CUDA tensor when + ``mode='max'`` + * :func:`torch.Tensor.put_` when ``accumulate=False`` + * :func:`torch.Tensor.put_` when ``accumulate=True`` and called on a CUDA tensor + * :func:`torch.histc` when called on a CUDA tensor + * :func:`torch.bincount` when called on a CUDA tensor and ``weights`` + tensor is given + * :func:`torch.median` with indices output when called on a CUDA tensor + * :func:`torch.nn.functional.grid_sample` when attempting to differentiate a CUDA tensor + * :func:`torch.cumsum` when called on a CUDA tensor when dtype is floating point or complex + * :func:`torch.Tensor.scatter_reduce` when ``reduce='prod'`` and called on CUDA tensor + * :func:`torch.Tensor.resize_` when called with a quantized tensor + + In addition, several operations fill uninitialized memory when this setting + is turned on and when + :attr:`torch.utils.deterministic.fill_uninitialized_memory` is turned on. + See the documentation for that attribute for more information. + + Note that deterministic operations tend to have worse performance than + nondeterministic operations. + + + When this setting is turned on, the Inductor deterministic mode is also tuned on + automatically. In deterministic mode, Inductor would avoid doing on device benchmarking + that affect numerics. This includes: + + - don't pad matmul input shapes. Without enabling deterministic mode, Inductor would do + benchmarking to check if padding matmul shape is beneficial. + - don't autotune templates. Inductor has templates for kernels like matmul/conv/attention. + Without enabling deterministic mode, Inductor would do autotuning to + pick the best configs for those templates and adopt it if it's faster + than the kernel in eager mode. In deterministic mode, we pick the eager kernel. + - don't autotune triton configs for reduction. Reduction numerics are + very sensitive to triton configs. In deterministic mode, Inductor + will use some heuristics to pick the most promising configs rather + than do autotuning. + - Skip autotuning for reduction in coordinate descent tuning. + - Don't benchmarking for the computation/communication reordering pass + - Disable the feature that dynamically scale down RBLOCK triton config for higher + occupancy. + + + .. note:: + + This flag does not detect or prevent nondeterministic behavior caused + by calling an inplace operation on a tensor with an internal memory + overlap or by giving such a tensor as the :attr:`out` argument for an + operation. In these cases, multiple writes of different data may target + a single memory location, and the order of writes is not guaranteed. + + Args: + mode (:class:`bool`): If True, makes potentially nondeterministic + operations switch to a deterministic algorithm or throw a runtime + error. If False, allows nondeterministic operations. + + Keyword args: + warn_only (:class:`bool`, optional): If True, operations that do not + have a deterministic implementation will throw a warning instead of + an error. Default: ``False`` + + Example:: + + >>> # xdoctest: +SKIP + >>> torch.use_deterministic_algorithms(True) + + # Backward mode nondeterministic error + >>> torch.nn.AvgPool3d(1)(torch.randn(3, 4, 5, 6, requires_grad=True).cuda()).sum().backward() + ... + RuntimeError: avg_pool3d_backward_cuda does not have a deterministic implementation... + """ + import torch._inductor.config as inductor_config + + inductor_config.deterministic = mode + _C._set_deterministic_algorithms(mode, warn_only=warn_only) + + +def are_deterministic_algorithms_enabled() -> builtins.bool: + r"""Returns True if the global deterministic flag is turned on. Refer to + :func:`torch.use_deterministic_algorithms` documentation for more details. + """ + return _C._get_deterministic_algorithms() + + +def is_deterministic_algorithms_warn_only_enabled() -> builtins.bool: + r"""Returns True if the global deterministic flag is set to warn only. + Refer to :func:`torch.use_deterministic_algorithms` documentation for more + details. + """ + return _C._get_deterministic_algorithms_warn_only() + + +def set_deterministic_debug_mode(debug_mode: builtins.int | str) -> None: + r"""Sets the debug mode for deterministic operations. + + .. note:: This is an alternative interface for + :func:`torch.use_deterministic_algorithms`. Refer to that function's + documentation for details about affected operations. + + Args: + debug_mode(str or int): If "default" or 0, don't error or warn on + nondeterministic operations. If "warn" or 1, warn on + nondeterministic operations. If "error" or 2, error on + nondeterministic operations. + """ + + # NOTE: builtins.int is used here because int in this scope resolves + # to torch.int + if not isinstance(debug_mode, (builtins.int, str)): + raise TypeError(f"debug_mode must be str or int, but got {type(debug_mode)}") + + if isinstance(debug_mode, str): + if debug_mode == "default": + debug_mode = 0 + elif debug_mode == "warn": + debug_mode = 1 + elif debug_mode == "error": + debug_mode = 2 + else: + raise RuntimeError( + "invalid value of debug_mode, expected one of `default`, " + f"`warn`, `error`, but got {debug_mode}" + ) + + if debug_mode == 0: + _C._set_deterministic_algorithms(False) + elif debug_mode == 1: + _C._set_deterministic_algorithms(True, warn_only=True) + elif debug_mode == 2: + _C._set_deterministic_algorithms(True) + else: + raise RuntimeError( + f"invalid value of debug_mode, expected 0, 1, or 2, but got {debug_mode}" + ) + + +def get_deterministic_debug_mode() -> builtins.int: + r"""Returns the current value of the debug mode for deterministic + operations. Refer to :func:`torch.set_deterministic_debug_mode` + documentation for more details. + """ + + if _C._get_deterministic_algorithms(): + if _C._get_deterministic_algorithms_warn_only(): + return 1 + else: + return 2 + else: + return 0 + + +def get_float32_matmul_precision() -> str: + r"""Returns the current value of float32 matrix multiplication precision. Refer to + :func:`torch.set_float32_matmul_precision` documentation for more details. + """ + return _C._get_float32_matmul_precision() + + +def set_float32_matmul_precision(precision: str) -> None: + r"""Sets the internal precision of float32 matrix multiplications. + + Running float32 matrix multiplications in lower precision may significantly increase + performance, and in some programs the loss of precision has a negligible impact. + + Supports three settings: + + * "highest", float32 matrix multiplications use the float32 datatype (24 mantissa + bits with 23 bits explicitly stored) for internal computations. + * "high", float32 matrix multiplications either use the TensorFloat32 datatype (10 + mantissa bits explicitly stored) or treat each float32 number as the sum of two bfloat16 numbers + (approximately 16 mantissa bits with 14 bits explicitly stored), if the appropriate fast matrix multiplication + algorithms are available. Otherwise float32 matrix multiplications are computed + as if the precision is "highest". See below for more information on the bfloat16 + approach. + * "medium", float32 matrix multiplications use the bfloat16 datatype (8 mantissa + bits with 7 bits explicitly stored) for internal computations, if a fast matrix multiplication algorithm + using that datatype internally is available. Otherwise float32 + matrix multiplications are computed as if the precision is "high". + + When using "high" precision, float32 multiplications may use a bfloat16-based algorithm + that is more complicated than simply truncating to some smaller number mantissa bits + (e.g. 10 for TensorFloat32, 7 for bfloat16 explicitly stored). Refer to [Henry2019]_ for a complete + description of this algorithm. To briefly explain here, the first step is to realize + that we can perfectly encode a single float32 number as the sum of three bfloat16 + numbers (because float32 has 23 mantissa bits while bfloat16 has 7 explicitly stored, and both have the + same number of exponent bits). This means that the product of two float32 numbers can + be exactly given by the sum of nine products of bfloat16 numbers. We can then trade + accuracy for speed by dropping some of these products. The "high" precision algorithm + specifically keeps only the three most significant products, which conveniently excludes + all of the products involving the last 8 mantissa bits of either input. This means that + we can represent our inputs as the sum of two bfloat16 numbers rather than three. + Because bfloat16 fused-multiply-add (FMA) instructions are typically >10x faster than + float32 ones, it's faster to do three multiplications and 2 additions with bfloat16 + precision than it is to do a single multiplication with float32 precision. + + .. [Henry2019] http://arxiv.org/abs/1904.06376 + + .. note:: + + This does not change the output dtype of float32 matrix multiplications, + it controls how the internal computation of the matrix multiplication is performed. + + .. note:: + + This does not change the precision of convolution operations. Other flags, + like `torch.backends.cudnn.allow_tf32`, may control the precision of convolution + operations. + + .. note:: + + This flag currently only affects one native device type: CUDA. + If "high" or "medium" are set then the TensorFloat32 datatype will be used + when computing float32 matrix multiplications, equivalent to setting + `torch.backends.cuda.matmul.allow_tf32 = True`. When "highest" (the default) + is set then the float32 datatype is used for internal computations, equivalent + to setting `torch.backends.cuda.matmul.allow_tf32 = False`. + + Args: + precision(str): can be set to "highest" (default), "high", or "medium" (see above). + + """ + _C._set_float32_matmul_precision(precision) + + +def set_warn_always(b: builtins.bool, /) -> None: + r"""When this flag is False (default) then some PyTorch warnings may only + appear once per process. This helps avoid excessive warning information. + Setting it to True causes these warnings to always appear, which may be + helpful when debugging. + + Args: + b (:class:`bool`): If True, force warnings to always be emitted + If False, set to the default behaviour + """ + _C._set_warnAlways(b) + + +def is_warn_always_enabled() -> builtins.bool: + r"""Returns True if the global warn_always flag is turned on. Refer to + :func:`torch.set_warn_always` documentation for more details. + """ + return _C._get_warnAlways() + + +################################################################################ +# Define error checking functions +################################################################################ + +# These error checking functions must be kept consistent with their C++ +# equivalents. Their C++ equivalents are mentioned where applicable. + + +def _check_with( + error_type, + cond: builtins.bool | SymBool, + message: _Callable[[], str], +): # noqa: F811 + if not isinstance(cond, (builtins.bool, SymBool)): + raise TypeError(f"cond must be a bool, but got {type(cond)}") + + from torch.fx.experimental.symbolic_shapes import expect_true + + if expect_true(cond): + return + + # error_type must be a subclass of Exception and not subclass of Warning + assert issubclass(error_type, Exception) and not issubclass(error_type, Warning) + + if message is None: + message_evaluated = ( + "Expected cond to be True, but got False. (Could this error " + "message be improved? If so, please report an enhancement request " + "to PyTorch.)" + ) + + else: + if not callable(message): + raise TypeError("message must be a callable") + + message_evaluated = str(message()) + + raise error_type(message_evaluated) + + +def _check(cond, message=None): # noqa: F811 + r"""Throws error containing an optional message if the specified condition + is False. + + Error type: ``RuntimeError`` + + C++ equivalent: ``TORCH_CHECK`` + + Args: + cond (:class:`bool`): If False, throw error + + message (Callable, optional): Callable that returns either a string or + an object that has a ``__str__()`` method to be used as the error + message. Default: ``None`` + """ + _check_with(RuntimeError, cond, message) # pyrefly: ignore [bad-argument-type] + + +# TODO add deprecation annotation +def _check_is_size(i, message=None, *, max=None): + """Checks that a given integer is a valid size (i.e., is non-negative). + You should use this over ``_check(i >= 0)`` because it can prevent + ``GuardOnDataDependentSymNode`` exceptions by opting yourself into alternate + semantics for ``guard_size_oblivious`` tests that treat values 0 and 1 + equivalently to all other values. + + When max is not None, this specifies an upper bound equivalent to + ``_check(i <= max)``. This bound is also subject to alternate semantics: + in ``guard_size_oblivious`` tests, we assume that a constant max bound is + treated equivalently to all other values. Symbolic max bounds are not yet + supported. + + NB: Do NOT use this in contexts where a -1 size would be valid (indicating + to infer the size from context, or if you should wrap-around or truncate). + Only use this if the only valid value is an honest to goodness size. + """ + # This is responsible for the expect_true + _check(i >= 0, message) + from torch.fx.experimental.symbolic_shapes import _advise_is_size + + _advise_is_size(i) + + if max is not None: + _check(i <= max, message) + + from torch.fx.experimental.symbolic_shapes import _advise_is_bounded + + _advise_is_bounded(i, max) + + +def _check_index(cond, message=None): # noqa: F811 + r"""Throws error containing an optional message if the specified condition + is False. + + Error type: ``IndexError`` + + C++ equivalent: ``TORCH_CHECK_INDEX`` + + Args: + cond (:class:`bool`): If False, throw error + + message (Callable, optional): Callable that returns either a string or + an object that has a ``__str__()`` method to be used as the error + message. Default: ``None`` + """ + _check_with(IndexError, cond, message) # pyrefly: ignore [bad-argument-type] + + +def _check_value(cond, message=None): # noqa: F811 + r"""Throws error containing an optional message if the specified condition + is False. + + Error type: ``ValueError`` + + C++ equivalent: ``TORCH_CHECK_VALUE`` + + Args: + cond (:class:`bool`): If False, throw error + + message (Callable, optional): Callable that returns either a string or + an object that has a ``__str__()`` method to be used as the error + message. Default: ``None`` + """ + _check_with(ValueError, cond, message) # pyrefly: ignore [bad-argument-type] + + +def _check_type(cond, message=None): # noqa: F811 + r"""Throws error containing an optional message if the specified condition + is False. + + Error type: ``TypeError`` + + C++ equivalent: ``TORCH_CHECK_TYPE`` + + Args: + cond (:class:`bool`): If False, throw error + + message (Callable, optional): Callable that returns either a string or + an object that has a ``__str__()`` method to be used as the error + message. Default: ``None`` + """ + _check_with(TypeError, cond, message) # pyrefly: ignore [bad-argument-type] + + +def _check_not_implemented(cond, message=None): # noqa: F811 + r"""Throws error containing an optional message if the specified condition + is False. + + Error type: ``NotImplementedError`` + + C++ equivalent: ``TORCH_CHECK_NOT_IMPLEMENTED`` + + Args: + cond (:class:`bool`): If False, throw error + + message (Callable, optional): Callable that returns either a string or + an object that has a ``__str__()`` method to be used as the error + message. Default: ``None`` + """ + _check_with( + NotImplementedError, + cond, + # pyrefly: ignore [bad-argument-type] + message, + ) + + +def _check_tensor_all_with(error_type, cond, message=None): # noqa: F811 + if not is_tensor(cond): + raise TypeError(f"cond must be a tensor, but got {type(cond)}") + + if not cond.dtype == torch.bool: + raise TypeError(f"cond tensor must have dtype torch.bool, but got {cond.dtype}") + + _check_with(error_type, cond._is_all_true().item(), message) # type: ignore[arg-type] + + +# C++ equivalent: `TORCH_CHECK_TENSOR_ALL` +def _check_tensor_all(cond, message=None): # noqa: F811 + r"""Throws error containing an optional message if the specified condition + is False. + + Error type: ``RuntimeError`` + + C++ equivalent: ``TORCH_CHECK_TENSOR_ALL`` + + Args: + cond (:class:`torch.Tensor`): Tensor of dtype ``torch.bool``. If any + element is ``False``, throw error + + message (Callable, optional): Callable that returns either a string or + an object that has a ``__str__()`` method to be used as the error + message. Default: ``None`` + """ + _check_tensor_all_with(RuntimeError, cond, message) + + +################################################################################ +# Define numeric constants +################################################################################ + +# For Python Array API (https://data-apis.org/array-api/latest/API_specification/constants.html) and +# NumPy consistency (https://numpy.org/devdocs/reference/constants.html) +from math import e, inf, nan, pi + + +newaxis: None = None + +__all__.extend(["e", "pi", "nan", "inf", "newaxis"]) + +################################################################################ +# Define Storage and Tensor classes +################################################################################ + +from torch._tensor import Tensor # usort: skip + +# needs to be after torch.Tensor is defined to avoid circular dependencies +from torch import storage as storage # usort: skip +from torch.storage import ( + _LegacyStorage, + _StorageBase, + _warn_typed_storage_removal, + TypedStorage, + UntypedStorage, +) + + +# NOTE: New Storage classes should never be added. When adding a new +# dtype, use torch.storage.TypedStorage directly. +class ByteStorage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.uint8 + + +class DoubleStorage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.double + + +class FloatStorage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.float + + +class HalfStorage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.half + + +class LongStorage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.long + + +class IntStorage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.int + + +class ShortStorage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.short + + +class CharStorage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.int8 + + +class BoolStorage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.bool + + +class BFloat16Storage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.bfloat16 + + +class ComplexDoubleStorage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.cdouble + + +class ComplexFloatStorage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.cfloat + + +class QUInt8Storage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.quint8 + + +class QInt8Storage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.qint8 + + +class QInt32Storage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.qint32 + + +class QUInt4x2Storage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.quint4x2 + + +class QUInt2x4Storage(_LegacyStorage): + @classproperty + def dtype(self): + _warn_typed_storage_removal(stacklevel=3) + return self._dtype + + @classproperty + def _dtype(self): + return torch.quint2x4 + + +_storage_classes: set[type[TypedStorage | UntypedStorage]] = { + UntypedStorage, + DoubleStorage, + FloatStorage, + LongStorage, + IntStorage, + ShortStorage, + CharStorage, + ByteStorage, + HalfStorage, + BoolStorage, + QUInt8Storage, + QInt8Storage, + QInt32Storage, + BFloat16Storage, + ComplexFloatStorage, + ComplexDoubleStorage, + QUInt4x2Storage, + QUInt2x4Storage, + TypedStorage, +} + +# The _tensor_classes set is initialized by the call to initialize_python_bindings. +_tensor_classes: set[type["torch.Tensor"]] = set() + +# If you edit these imports, please update torch/__init__.py.in as well +from torch import amp as amp, random as random, serialization as serialization +from torch._tensor_str import set_printoptions +from torch.amp import autocast, GradScaler +from torch.random import get_rng_state, initial_seed, manual_seed, seed, set_rng_state +from torch.serialization import load, save + + +################################################################################ +# Initialize extension +################################################################################ + + +# Shared memory manager needs to know the exact location of manager executable +def _manager_path(): + if platform.system() == "Windows": + return b"" + path = get_file_path("torch", "bin", "torch_shm_manager") + prepare_multiprocessing_environment(get_file_path("torch")) + if not os.path.exists(path): + raise RuntimeError("Unable to find torch_shm_manager at " + path) + return path.encode("utf-8") + + +_C._initExtension(_manager_path()) + +del _manager_path + +# Appease the type checker: it can't deal with direct setting of globals(). +# Note that we will see "too many" functions when reexporting this way; there +# is not a good way to fix this problem. Perhaps, try to redesign VariableFunctions +# so that this import is good enough +if TYPE_CHECKING: + # Some type signatures pulled in from _VariableFunctions here clash with + # signatures already imported. For now these clashes are ignored; see + # PR #43339 for details. + from torch._C._VariableFunctions import * # type: ignore[assignment, misc] # noqa: F403 + + # Fixup segment_reduce visibility + _segment_reduce = segment_reduce + del segment_reduce # noqa: F821 + +# Ops not to be exposed in `torch` namespace, +# mostly helper ops. +PRIVATE_OPS = ("unique_dim",) + +__name, __obj = "", None +for __name in dir(_C._VariableFunctions): + if __name.startswith("__") or __name in PRIVATE_OPS: + continue + __obj = getattr(_C._VariableFunctions, __name) + __obj.__module__ = __name__ # "torch" + # Hide some APIs that should not be public + if __name == "segment_reduce": + # TODO: Once the undocumented FC window is passed, remove the line below + globals()[__name] = __obj + __name = "_" + __name + globals()[__name] = __obj + if not __name.startswith("_"): + __all__.append(__name) + +del __name, __obj + +################################################################################ +# Add torch.dtype instances to the public API +################################################################################ + +import torch + + +__all__.extend( + name for name in dir(torch) if isinstance(getattr(torch, name), torch.dtype) +) + +################################################################################ +# Import TorchDynamo's lazy APIs to avoid circular dependencies +################################################################################ + +# needs to be before from torch.functional import * to avoid circular dependencies +from torch._compile import _disable_dynamo # usort: skip + +################################################################################ +# Import interface functions defined in Python +################################################################################ + +# needs to be after the above ATen bindings so we can overwrite from Python side +from torch import _VF as _VF, functional as functional # usort: skip +from torch.functional import * # usort: skip # noqa: F403 + +################################################################################ +# Remove unnecessary members +################################################################################ + +del _StorageBase +del _LegacyStorage + +################################################################################ +# Define _assert +################################################################################ + + +# needs to be before the submodule imports to avoid circular dependencies +def _assert(condition, message): + r"""A wrapper around Python's assert which is symbolically traceable.""" + if type(condition) is not torch.Tensor and overrides.has_torch_function( + (condition,) + ): + return overrides.handle_torch_function( + _assert, (condition,), condition, message + ) + assert condition, message + + +################################################################################ +# Import most common subpackages +################################################################################ + +# Use the redundant form so that type checkers know that these are a part of +# the public API. The "regular" import lines are there solely for the runtime +# side effect of adding to the imported module's members for other users. + +# needs to be before import torch.nn as nn to avoid circular dependencies +from torch.autograd import ( # usort: skip + enable_grad as enable_grad, + inference_mode as inference_mode, + no_grad as no_grad, + set_grad_enabled as set_grad_enabled, +) + +from torch import ( + __config__ as __config__, + __future__ as __future__, + _awaits as _awaits, + accelerator as accelerator, + autograd as autograd, + backends as backends, + cpu as cpu, + cuda as cuda, + distributed as distributed, + distributions as distributions, + fft as fft, + futures as futures, + hub as hub, + jit as jit, + linalg as linalg, + mps as mps, + mtia as mtia, + multiprocessing as multiprocessing, + nested as nested, + nn as nn, + optim as optim, + overrides as overrides, + profiler as profiler, + sparse as sparse, + special as special, + testing as testing, + types as types, + utils as utils, + version as version, + xpu as xpu, +) +from torch.signal import windows as windows + + +# Quantized, sparse, AO, etc. should be last to get imported, as nothing +# is expected to depend on them. +from torch import ao as ao # usort: skip + +# nn.quant* depends on ao -- so should be after those. +import torch.nn.intrinsic +import torch.nn.qat +import torch.nn.quantizable +import torch.nn.quantized + + +_C._init_names(list(_storage_classes)) + +# attach docstrings to torch and tensor functions +from torch import _size_docs, _storage_docs, _tensor_docs, _torch_docs + + +del _torch_docs, _tensor_docs, _storage_docs, _size_docs + + +def compiled_with_cxx11_abi() -> builtins.bool: + r"""Returns whether PyTorch was built with _GLIBCXX_USE_CXX11_ABI=1""" + return True + + +from torch import _library as _library, _ops as _ops + + +# Import the ops and classes "namespace" +from torch._ops import ops as ops # usort: skip +from torch._classes import classes as classes # usort: skip + +sys.modules.setdefault(f"{__name__}.ops", ops) +sys.modules.setdefault(f"{__name__}.classes", classes) + +# quantization depends on torch.fx and torch.ops +# Import quantization +from torch import quantization as quantization # usort: skip + +# Import the quasi random sampler +from torch import quasirandom as quasirandom # usort: skip + +# If you are seeing this, it means that this call site was not checked if +# the memory format could be preserved, and it was switched to old default +# behaviour of contiguous +legacy_contiguous_format = contiguous_format # defined by _C._initExtension() + +# Register fork handler to initialize OpenMP in child processes (see gh-28389) +from torch.multiprocessing._atfork import register_after_fork + + +register_after_fork(torch.get_num_threads) +del register_after_fork + +# Import tools that require fully imported torch (for applying +# torch.jit.script as a decorator, for instance): +from torch._lobpcg import lobpcg as lobpcg + + +# These were previously defined in native_functions.yaml and appeared on the +# `torch` namespace, but we moved them to c10 dispatch to facilitate custom +# class usage. We add these lines here to preserve backward compatibility. +quantized_lstm = ops.aten.quantized_lstm +quantized_gru = ops.aten.quantized_gru + +# Import experimental masked operations support. See +# [RFC-0016](https://github.com/pytorch/rfcs/pull/27) for more +# information. +from torch import masked as masked + +# Import removed ops with error message about removal +from torch._linalg_utils import ( # type: ignore[misc] + _symeig as symeig, + eig, + lstsq, + matrix_rank, + solve, +) +from torch.utils.dlpack import from_dlpack, to_dlpack + + +class _TorchCompileInductorWrapper: + compiler_name = "inductor" + + def __init__(self, mode, options, dynamic): + from torch._inductor.compiler_bisector import CompilerBisector + + self.config: dict[str, _Any] = {} + self.dynamic = dynamic + self.apply_mode(mode) + self.apply_options(options) + self.apply_options(CompilerBisector.get_config_change("inductor")) + + cuda_version = None + if hasattr(torch, "version"): + from torch.torch_version import TorchVersion + + cuda_version = TorchVersion(getattr(torch.version, "cuda", "0.0")) + + if self.config.get("triton.cudagraphs", False) and ( + (cuda_version and cuda_version < "12.6") + or not profiler_allow_cudagraph_cupti_lazy_reinit_cuda12() + ): + os.environ["DISABLE_CUPTI_LAZY_REINIT"] = "1" + # FIXME: CUDA Graph does not work well with CUPTI teardown. + # 1) crashes on 1st lazy CUPTI re-init after teardown (CUDA 11) + # 2) crashes on 2nd non-lazy CUPTI re-init after teardown (CUDA 12) + # Workaround: turn off CUPTI teardown when using CUDA Graphs. + os.environ["TEARDOWN_CUPTI"] = "0" + + def __eq__(self, other): + return ( + isinstance(other, _TorchCompileInductorWrapper) + and self.config == other.config + and self.dynamic == other.dynamic + ) + + def apply_mode(self, mode: str | None): + if mode and mode != "default": + from torch._inductor import list_mode_options + + self.apply_options(list_mode_options(mode, self.dynamic)) + + def apply_options(self, options: dict[str, _Any] | None): + if not options: + return + + from torch._inductor import config + + current_config: dict[str, _Any] = config.get_config_copy() + + for key, val in options.items(): + attr_name = key.replace("-", "_") + if attr_name not in current_config: + raise RuntimeError( + f"Unexpected optimization option {key}, known options are {list(current_config.keys())}" + ) + attr_type = config.get_type(attr_name) # type: ignore[attr-defined] + # Subscriptable generic types don't support isinstance so skip the type + # check. There doesn't seem to be a good way of checking membership without + # 3rd party libraries. + if _get_origin(attr_type) is None: + if not isinstance(val, attr_type): + val_type_str = type(val).__name__ + expected_type_str = type(current_config[attr_name]).__name__ + raise RuntimeError( + f"Unexpected type of attr {key}, got {val_type_str} should be {expected_type_str}" + ) + self.config[attr_name] = val + + def __call__(self, model_, inputs_): + from torch._inductor.compile_fx import compile_fx + + return compile_fx(model_, inputs_, config_patches=self.config) + + def get_compiler_config(self): + from torch._inductor.compile_fx import get_patched_config_dict + + return get_patched_config_dict(config_patches=self.config) + + def reset(self): + from torch._inductor import config + + if "triton.cudagraphs" in self.config or config.triton.cudagraphs: + if self.config.get("triton.cudagraphs", True): + from torch._inductor.cudagraph_trees import reset_cudagraph_trees + + reset_cudagraph_trees() + + +class _TorchCompileAOTInductorWrapper(_TorchCompileInductorWrapper): + compiler_name = "aotinductor" + + def __init__(self, mode, options, dynamic): + super().__init__(mode, options, dynamic) + self.apply_options({"cpp_wrapper": True}) + self.apply_options({"aot_inductor.package": True}) + + def __call__(self, model_, inputs_): + from contextlib import nullcontext + from unittest import mock + + from torch._guards import detect_fake_mode + from torch._inductor.virtualized import V + + fake_mode = detect_fake_mode(inputs_) + ctx = ( + mock.patch.object(fake_mode, "allow_non_fake_inputs", True) + if fake_mode + else nullcontext() + ) + with ( + V.set_aot_compilation(True), + ctx, + torch._inductor.config.patch("enable_autograd_for_aot", True), + ): + return super().__call__(model_, inputs_) + + +class _TorchCompileWrapper: + def __init__(self, backend, mode, options, dynamic): + from torch._dynamo.backends.registry import lookup_backend + + if isinstance(backend, str): + self.compiler_name = backend + elif hasattr(backend, "__name__"): + self.compiler_name = backend.__name__ + else: + self.compiler_name = str(backend) + self.dynamic = dynamic + self.compiler_fn = lookup_backend(backend) + self.kwargs = {} + # only pass the args if they non-empty + if mode and mode != "default": + self.kwargs["mode"] = mode + if options: + self.kwargs["options"] = options + + def __eq__(self, other): + return ( + isinstance(other, _TorchCompileWrapper) + and self.compiler_fn == other.compiler_fn + and self.kwargs == other.kwargs + and self.dynamic == other.dynamic + ) + + def __call__(self, model_, inputs_): + return self.compiler_fn(model_, inputs_, **self.kwargs) + + def reset(self): + if hasattr(self.compiler_fn, "reset"): + self.compiler_fn.reset() + + +_InputT = _ParamSpec("_InputT") +_RetT = _TypeVar("_RetT") + + +@_overload +def compile( + model: _Callable[_InputT, _RetT], + *, + fullgraph: builtins.bool = False, + dynamic: builtins.bool | None = None, + backend: str | _Callable = "inductor", + mode: str | None = None, + options: dict[str, str | builtins.int | builtins.bool | _Callable] | None = None, + disable: builtins.bool = False, +) -> _Callable[_InputT, _RetT]: ... + + +@_overload +def compile( + model: None = None, + *, + fullgraph: builtins.bool = False, + dynamic: builtins.bool | None = None, + backend: str | _Callable = "inductor", + mode: str | None = None, + options: dict[str, str | builtins.int | builtins.bool | _Callable] | None = None, + disable: builtins.bool = False, +) -> _Callable[[_Callable[_InputT, _RetT]], _Callable[_InputT, _RetT]]: ... + + +def compile( + model: _Callable[_InputT, _RetT] | None = None, + *, + fullgraph: builtins.bool = False, + dynamic: builtins.bool | None = None, + backend: str | _Callable = "inductor", + mode: str | None = None, + options: dict[str, str | builtins.int | builtins.bool | _Callable] | None = None, + disable: builtins.bool = False, +) -> ( + _Callable[[_Callable[_InputT, _RetT]], _Callable[_InputT, _RetT]] + | _Callable[_InputT, _RetT] +): + """ + Optimizes given model/function using TorchDynamo and specified backend. + If you are compiling an :class:`torch.nn.Module`, you can also use :meth:`torch.nn.Module.compile` + to compile the module inplace without changing its structure. + + Concretely, for every frame executed within the compiled region, we will attempt + to compile it and cache the compiled result on the code object for future + use. A single frame may be compiled multiple times if previous compiled + results are not applicable for subsequent calls (this is called a "guard + failure"), you can use TORCH_LOGS=guards to debug these situations. + Multiple compiled results can be associated with a frame up to + ``torch._dynamo.config.recompile_limit``, which defaults to 8; at which + point we will fall back to eager. Note that compile caches are per + *code object*, not frame; if you dynamically create multiple copies of a + function, they will all share the same code cache. + + Args: + model (Callable or None): Module/function to optimize + fullgraph (bool): If False (default), torch.compile attempts to discover compilable regions + in the function that it will optimize. If True, then we require that the entire function be + capturable into a single graph. If this is not possible (that is, if there are graph breaks), + then this will raise an error. This also opts into unbacked semantics, notably it will turn on + capture_scalar_outputs and capture_dynamic_output_shape_ops on by default. + dynamic (bool or None): Use dynamic shape tracing. When this is True, we will up-front attempt + to generate a kernel that is as dynamic as possible to avoid recompilations when + sizes change. This may not always work as some operations/optimizations will + force specialization; use TORCH_LOGS=dynamic to debug overspecialization. + When this is False, we will NEVER generate dynamic kernels, we will always specialize. + By default (None), we automatically detect if dynamism has occurred and compile a more + dynamic kernel upon recompile. + backend (str or Callable): backend to be used + + - "inductor" is the default backend, which is a good balance between performance and overhead + + - Non experimental in-tree backends can be seen with `torch._dynamo.list_backends()` + + - Experimental or debug in-tree backends can be seen with `torch._dynamo.list_backends(None)` + + - To register an out-of-tree custom backend: + https://pytorch.org/docs/main/torch.compiler_custom_backends.html#registering-custom-backends + mode (str): Can be either "default", "reduce-overhead", "max-autotune" or "max-autotune-no-cudagraphs" + + - "default" is the default mode, which is a good balance between performance and overhead + + - "reduce-overhead" is a mode that reduces the overhead of python with CUDA graphs, + useful for small batches. Reduction of overhead can come at the cost of more memory + usage, as we will cache the workspace memory required for the invocation so that we + do not have to reallocate it on subsequent runs. Reduction of overhead is not guaranteed + to work; today, we only reduce overhead for CUDA only graphs which do not mutate inputs. + There are other circumstances where CUDA graphs are not applicable; use TORCH_LOG=perf_hints + to debug. + + - "max-autotune" is a mode that leverages Triton or template based matrix multiplications + on supported devices and Triton based convolutions on GPU. + It enables CUDA graphs by default on GPU. + + - "max-autotune-no-cudagraphs" is a mode similar to "max-autotune" but without CUDA graphs + + - To see the exact configs that each mode sets you can call `torch._inductor.list_mode_options()` + + options (dict): A dictionary of options to pass to the backend. Some notable ones to try out are + + - `epilogue_fusion` which fuses pointwise ops into templates. Requires `max_autotune` to also be set + + - `max_autotune` which will profile to pick the best matmul configuration + + - `fallback_random` which is useful when debugging accuracy issues + + - `shape_padding` which pads matrix shapes to better align loads on GPUs especially for tensor cores + + - `triton.cudagraphs` which will reduce the overhead of python with CUDA graphs + + - `trace.enabled` which is the most useful debugging flag to turn on + + - `trace.graph_diagram` which will show you a picture of your graph after fusion + + - `guard_filter_fn` that controls which dynamo guards are saved with compilations. + This is an unsafe feature and there is no backward compatibility guarantee provided + for dynamo guards as data types. + For stable helper functions to use, see the documentations in `torch.compiler`, for example: + - `torch.compiler.skip_guard_on_inbuilt_nn_modules_unsafe` + - `torch.compiler.skip_guard_on_all_nn_modules_unsafe` + - `torch.compiler.keep_tensor_guards_unsafe` + + - For inductor you can see the full list of configs that it supports by calling `torch._inductor.list_options()` + disable (bool): Turn torch.compile() into a no-op for testing + + Example:: + + @torch.compile(options={"triton.cudagraphs": True}, fullgraph=True) + def foo(x): + return torch.sin(x) + torch.cos(x) + + """ + import sysconfig + + _C._log_api_usage_once("torch.compile") + if sys.version_info >= (3, 15): + raise RuntimeError("torch.compile is not supported on Python 3.15+") + elif sysconfig.get_config_var("Py_GIL_DISABLED") == 1 and sys.version_info < ( + 3, + 13, + 3, + ): + raise RuntimeError( + "torch.compile is not supported on Python < 3.13.3 built with GIL disabled. " + "Please use Python 3.13.3+." + ) + + # Decorator mode + if model is None: + + def fn(model: _Callable[_InputT, _RetT]) -> _Callable[_InputT, _RetT]: + if model is None: + raise RuntimeError("Model can't be None") + return compile( # pyrefly: ignore # no-matching-overload + model, + fullgraph=fullgraph, + dynamic=dynamic, + backend=backend, + mode=mode, + options=options, + disable=disable, + ) + + return fn + + if mode is not None and options is not None: + raise RuntimeError( + "Either mode or options can be specified, but both can't be specified at the same time." + ) + if mode is None and options is None: + mode = "default" + + from torch._inductor.compiler_bisector import CompilerBisector + + if bisect_backend := CompilerBisector.get_backend(): + import torch._inductor.config as inductor_config + + # don't override the backend for use cases like vllm + # which leverages their custom backend. + if not ( + inductor_config.test_configs.bisect_keep_custom_backend_for_inductor + and bisect_backend == "inductor" + and not isinstance(backend, str) + ): + backend = bisect_backend + + guard_filter_fn = None + use_aoti = False + if options and isinstance(options, dict): + guard_filter_fn = options.pop("guard_filter_fn", None) + use_aoti = options.pop("use_aoti", False) + + if torch.compiler.is_exporting(): + warnings.warn( + "You are calling torch.compile inside torch.export region. " + "To capture an useful graph, we will implicitly switch to torch.compile(backend=eager)", + stacklevel=2, + ) + from torch._higher_order_ops.utils import setup_compilation_env + + # Create wrapper that always uses eager backend during export + def export_wrapped_fn(*args, **kwargs): + with setup_compilation_env() as backend: # type: ignore[attr-defined] + # Force eager backend regardless of original backend + backend_wrapper = _TorchCompileWrapper(backend, mode, options, dynamic) + return torch._dynamo.optimize( + backend=backend_wrapper, + nopython=fullgraph, + dynamic=dynamic, + disable=disable, + guard_filter_fn=guard_filter_fn, + # pyrefly: ignore [bad-argument-type] + )(model)(*args, **kwargs) + + return export_wrapped_fn + + if backend == "inductor": + if use_aoti: + backend = _TorchCompileAOTInductorWrapper(mode, options, dynamic) + else: + backend = _TorchCompileInductorWrapper(mode, options, dynamic) + else: + backend = _TorchCompileWrapper(backend, mode, options, dynamic) + + return torch._dynamo.optimize( + backend=backend, + nopython=fullgraph, + dynamic=dynamic, + disable=disable, + guard_filter_fn=guard_filter_fn, + )(model) # type: ignore[return-value] + + +def _register_device_module(device_type, module): + r"""Register an external runtime module of the specific :attr:`device_type` + supported by torch. + + After the :attr:`module` is registered correctly, the user can refer + the external runtime module as part of torch with attribute torch.xxx. + """ + # Make sure the device_type represent a supported device type for torch. + device_type = torch.device(device_type).type + m = sys.modules[__name__] + if hasattr(m, device_type): + raise RuntimeError( + f"The runtime module of '{device_type}' has already " + f"been registered with '{getattr(m, device_type)}'" + ) + setattr(m, device_type, module) + torch_module_name = ".".join([__name__, device_type]) + sys.modules[torch_module_name] = module + + +from torch import ( + export as export, + func as func, + library as library, + return_types as return_types, +) +from torch._higher_order_ops import cond as cond, while_loop as while_loop +from torch.func import vmap as vmap + + +if not TYPE_CHECKING: + from torch import _meta_registrations + +# Enable CUDA Sanitizer +if "TORCH_CUDA_SANITIZER" in os.environ: + import torch.cuda._sanitizer as csan + + csan.enable_cuda_sanitizer() + +# Populate magic methods on SymInt and SymFloat +import torch.fx.experimental.sym_node +from torch import fx as fx + + +# Register MPS specific decomps +torch.backends.mps._init() + +from torch import compiler as compiler + + +class _TritonLibrary: + lib = torch.library.Library("triton", "DEF") + ops_table: dict[tuple[str, str], _Callable] = {} + + @classmethod + def registerOp(cls, op_key, full_schema, op_impl, dispatch_key): + if (op_key, dispatch_key) not in cls.ops_table: + cls.lib.define(full_schema) + cls.lib.impl("triton::" + op_key, op_impl, dispatch_key) + cls.ops_table[(op_key, dispatch_key)] = op_impl + + return cls.ops_table[(op_key, dispatch_key)] + + +# Deprecated attributes +_deprecated_attrs = { + "has_mps": torch.backends.mps.is_built, + "has_cuda": torch.backends.cuda.is_built, + "has_cudnn": torch.backends.cudnn.is_available, + "has_mkldnn": torch.backends.mkldnn.is_available, +} + +if TYPE_CHECKING: + # Import the following modules during type checking to enable code intelligence features, + # such as auto-completion in tools like pylance, even when these modules are not explicitly + # imported in user code. + from torch import ( + _dynamo as _dynamo, + _inductor as _inductor, + _subclasses as _subclasses, + onnx as onnx, + ) + +else: + _lazy_modules = { + "_dynamo", + "_inductor", + "_export", + # ONNX must be imported after _dynamo, _ops, _subclasses, fx, func and jit + "onnx", + } + + def __getattr__(name): + # Deprecated attrs + replacement = _deprecated_attrs.get(name) + if replacement is not None: + import warnings + + warnings.warn( + f"'{name}' is deprecated, please use '{replacement.__module__}.{replacement.__name__}()'", + stacklevel=2, + ) + return replacement() + + # Lazy modules + if name in _lazy_modules: + return importlib.import_module(f".{name}", __name__) + + raise AttributeError(f"module '{__name__}' has no attribute '{name}'") + + +@functools.cache +def get_device_module(device: torch.device | str | None = None): + """ + Returns the module associated with a given device(e.g., torch.device('cuda'), "mtia:0", "xpu", ...). + If no device is given, return the module for the current accelerator or CPU if none is present. + """ + if isinstance(device, torch.device): + device_module_name = device.type + elif isinstance(device, str): + device_module_name = torch.device(device).type + elif device is None: + # Using default accelerator type. If no accelerator is available, it automatically returns CPU device. + device_module_name = torch._C._get_accelerator().type + else: + raise RuntimeError( + f"Invalid value of device '{device}', expect torch.device, str, or None" + ) + device_module = getattr(torch, device_module_name, None) + if device_module is None: + raise RuntimeError( + f"Device '{device_module_name}' does not have a corresponding module registered as 'torch.{device_module_name}'." + ) + return device_module + + +def _constrain_as_size( + symbol, + min: builtins.int | None = None, + max: builtins.int | None = None, +): + """ + This indicates that a given int is size-like, and can be used in any context where a size is expected. + You will typically use this when reading out integers from Tensors, e.g., max.item() or lengths.tolist() + which then need to be used as tensor constructors. Providing these assertions to PyTorch can help resolve + GuardOnDataDependentSymNode errors upon export, since we cannot guard on unbacked SymInts. + + This function has unusual semantics in some circumstances in framework + code, we will treat this int as >= 2 (when we do a size-oblivious guard). + This makes it easier to use the unbacked int in size contexts, + as we will often attempt to guard on a size being zero/one + (e.g., when computing the contiguity of a tensor, or testing if + broadcasting can occur), which will not work on unbacked SymInts. + However, if we conservatively assume that the size is not zero/one, we will + end up with a graph that will still work even if the size is zero/one. + + For more details, see https://docs.google.com/document/d/1HSuTTVvYH1pTew89Rtpeu84Ht3nQEFTYhAX3Ypa_xJs/edit + ``` + """ + torch.sym_constrain_range_for_size(symbol, min=min, max=max) + + +from torch import _logging + + +_logging._init_logs() + + +def _import_device_backends(): + """ + Leverage the Python plugin mechanism to load out-of-the-tree device extensions. + See this RFC: https://github.com/pytorch/pytorch/issues/122468 + """ + from importlib.metadata import entry_points + + group_name = "torch.backends" + backend_extensions = entry_points(group=group_name) + + for backend_extension in backend_extensions: + try: + # Load the extension + entrypoint = backend_extension.load() + # Call the entrypoint + entrypoint() + except Exception as err: + raise RuntimeError( + f"Failed to load the backend extension: {backend_extension.name}. " + f"You can disable extension auto-loading with TORCH_DEVICE_BACKEND_AUTOLOAD=0." + ) from err + + +def _is_device_backend_autoload_enabled() -> builtins.bool: + """ + Whether autoloading out-of-the-tree device extensions is enabled. + The switch depends on the value of the environment variable + `TORCH_DEVICE_BACKEND_AUTOLOAD`. + + Returns: + bool: Whether to enable autoloading the extensions. Enabled by default. + + Examples: + >>> torch._is_device_backend_autoload_enabled() + True + """ + # enabled by default + return os.getenv("TORCH_DEVICE_BACKEND_AUTOLOAD", "1") == "1" + + +def _as_tensor_fullprec(t): + """ + Like torch.as_tensor, but when given Python data types it will keep + them in full precision. Used for calling convention for Dynamo. + """ + ty = type(t) + if ty is builtins.float: + return torch.as_tensor(t, dtype=torch.float64) + elif ty is builtins.int: + return torch.as_tensor(t, dtype=torch.int64) + else: + return torch.as_tensor(t) + + +# `_import_device_backends` should be kept at the end to ensure +# all the other functions in this module that may be accessed by +# an autoloaded backend are defined +if _is_device_backend_autoload_enabled(): + _import_device_backends() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_appdirs.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_appdirs.py new file mode 100644 index 0000000000000000000000000000000000000000..6456eb41b803caefc3405b4b7b12ed99973666a3 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_appdirs.py @@ -0,0 +1,666 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright (c) 2005-2010 ActiveState Software Inc. +# Copyright (c) 2013 Eddy Petrișor + +# flake8: noqa + +""" +This file is directly from +https://github.com/ActiveState/appdirs/blob/3fe6a83776843a46f20c2e5587afcffe05e03b39/appdirs.py + +The license of https://github.com/ActiveState/appdirs copied below: + + +# This is the MIT license + +Copyright (c) 2010 ActiveState Software Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +""" + +"""Utilities for determining application-specific dirs. + +See for details and usage. +""" +# Dev Notes: +# - Windows "Known Folders": https://learn.microsoft.com/en-us/windows/win32/shell/csidl +# - macOS File System Programming Guide: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/Introduction/Introduction.html +# - XDG spec for Un*x: https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html + +__version__ = "1.4.4" +__version_info__ = tuple(int(segment) for segment in __version__.split(".")) + + +import os +import sys + + +unicode = str + +if sys.platform.startswith("java"): + import platform + + os_name = platform.java_ver()[3][0] + if os_name.startswith("Windows"): # "Windows XP", "Windows 7", etc. + system = "win32" + elif os_name.startswith("Mac"): # "Mac OS X", etc. + system = "darwin" + else: # "Linux", "SunOS", "FreeBSD", etc. + # Setting this to "linux2" is not ideal, but only Windows or Mac + # are actually checked for and the rest of the module expects + # *sys.platform* style strings. + system = "linux2" +else: + system = sys.platform + + +def user_data_dir(appname=None, appauthor=None, version=None, roaming=False): + r"""Return full path to the user-specific data dir for this application. + + "appname" is the name of application. + If None, just the system directory is returned. + "appauthor" (only used on Windows) is the name of the + appauthor or distributing body for this application. Typically + it is the owning company name. This falls back to appname. You may + pass False to disable it. + "version" is an optional version path element to append to the + path. You might want to use this if you want multiple versions + of your app to be able to run independently. If used, this + would typically be ".". + Only applied when appname is present. + "roaming" (boolean, default False) can be set True to use the Windows + roaming appdata directory. That means that for users on a Windows + network setup for roaming profiles, this user data will be + sync'd on login. See + + for a discussion of issues. + + Typical user data directories are: + Mac OS X: ~/Library/Application Support/ + Unix: ~/.local/share/ # or in $XDG_DATA_HOME, if defined + Win XP (not roaming): C:\Documents and Settings\\Application Data\\ + Win XP (roaming): C:\Documents and Settings\\Local Settings\Application Data\\ + Win 7 (not roaming): C:\Users\\AppData\Local\\ + Win 7 (roaming): C:\Users\\AppData\Roaming\\ + + For Unix, we follow the XDG spec and support $XDG_DATA_HOME. + That means, by default "~/.local/share/". + """ + if system == "win32": + if appauthor is None: + appauthor = appname + const = roaming and "CSIDL_APPDATA" or "CSIDL_LOCAL_APPDATA" + path = os.path.normpath(_get_win_folder(const)) + if appname: + if appauthor is not False: + path = os.path.join(path, appauthor, appname) + else: + path = os.path.join(path, appname) + elif system == "darwin": + path = os.path.expanduser("~/Library/Application Support/") + if appname: + path = os.path.join(path, appname) + else: + path = os.getenv("XDG_DATA_HOME", os.path.expanduser("~/.local/share")) + if appname: + path = os.path.join(path, appname) + if appname and version: + path = os.path.join(path, version) + return path + + +def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): + r"""Return full path to the user-shared data dir for this application. + + "appname" is the name of application. + If None, just the system directory is returned. + "appauthor" (only used on Windows) is the name of the + appauthor or distributing body for this application. Typically + it is the owning company name. This falls back to appname. You may + pass False to disable it. + "version" is an optional version path element to append to the + path. You might want to use this if you want multiple versions + of your app to be able to run independently. If used, this + would typically be ".". + Only applied when appname is present. + "multipath" is an optional parameter only applicable to *nix + which indicates that the entire list of data dirs should be + returned. By default, the first item from XDG_DATA_DIRS is + returned, or '/usr/local/share/', + if XDG_DATA_DIRS is not set + + Typical site data directories are: + Mac OS X: /Library/Application Support/ + Unix: /usr/local/share/ or /usr/share/ + Win XP: C:\Documents and Settings\All Users\Application Data\\ + Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) + Win 7: C:\ProgramData\\ # Hidden, but writeable on Win 7. + + For Unix, this is using the $XDG_DATA_DIRS[0] default. + + WARNING: Do not use this on Windows. See the Vista-Fail note above for why. + """ + if system == "win32": + if appauthor is None: + appauthor = appname + path = os.path.normpath(_get_win_folder("CSIDL_COMMON_APPDATA")) + if appname: + if appauthor is not False: + path = os.path.join(path, appauthor, appname) + else: + path = os.path.join(path, appname) + elif system == "darwin": + path = os.path.expanduser("/Library/Application Support") + if appname: + path = os.path.join(path, appname) + else: + # XDG default for $XDG_DATA_DIRS + # only first, if multipath is False + path = os.getenv( + "XDG_DATA_DIRS", os.pathsep.join(["/usr/local/share", "/usr/share"]) + ) + pathlist = [ + os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep) + ] + if appname: + if version: + appname = os.path.join(appname, version) + pathlist = [os.sep.join([x, appname]) for x in pathlist] + + if multipath: + path = os.pathsep.join(pathlist) + else: + path = pathlist[0] + return path + + if appname and version: + path = os.path.join(path, version) + return path + + +def user_config_dir(appname=None, appauthor=None, version=None, roaming=False): + r"""Return full path to the user-specific config dir for this application. + + "appname" is the name of application. + If None, just the system directory is returned. + "appauthor" (only used on Windows) is the name of the + appauthor or distributing body for this application. Typically + it is the owning company name. This falls back to appname. You may + pass False to disable it. + "version" is an optional version path element to append to the + path. You might want to use this if you want multiple versions + of your app to be able to run independently. If used, this + would typically be ".". + Only applied when appname is present. + "roaming" (boolean, default False) can be set True to use the Windows + roaming appdata directory. That means that for users on a Windows + network setup for roaming profiles, this user data will be + sync'd on login. See + + for a discussion of issues. + + Typical user config directories are: + Mac OS X: ~/Library/Preferences/ + Unix: ~/.config/ # or in $XDG_CONFIG_HOME, if defined + Win *: same as user_data_dir + + For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME. + That means, by default "~/.config/". + """ + if system == "win32": + path = user_data_dir(appname, appauthor, None, roaming) + elif system == "darwin": + path = os.path.expanduser("~/Library/Preferences/") + if appname: + path = os.path.join(path, appname) + else: + path = os.getenv("XDG_CONFIG_HOME", os.path.expanduser("~/.config")) + if appname: + path = os.path.join(path, appname) + if appname and version: + path = os.path.join(path, version) + return path + + +def site_config_dir(appname=None, appauthor=None, version=None, multipath=False): + r"""Return full path to the user-shared data dir for this application. + + "appname" is the name of application. + If None, just the system directory is returned. + "appauthor" (only used on Windows) is the name of the + appauthor or distributing body for this application. Typically + it is the owning company name. This falls back to appname. You may + pass False to disable it. + "version" is an optional version path element to append to the + path. You might want to use this if you want multiple versions + of your app to be able to run independently. If used, this + would typically be ".". + Only applied when appname is present. + "multipath" is an optional parameter only applicable to *nix + which indicates that the entire list of config dirs should be + returned. By default, the first item from XDG_CONFIG_DIRS is + returned, or '/etc/xdg/', if XDG_CONFIG_DIRS is not set + + Typical site config directories are: + Mac OS X: same as site_data_dir + Unix: /etc/xdg/ or $XDG_CONFIG_DIRS[i]/ for each value in + $XDG_CONFIG_DIRS + Win *: same as site_data_dir + Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) + + For Unix, this is using the $XDG_CONFIG_DIRS[0] default, if multipath=False + + WARNING: Do not use this on Windows. See the Vista-Fail note above for why. + """ + if system == "win32": + path = site_data_dir(appname, appauthor) + if appname and version: + path = os.path.join(path, version) + elif system == "darwin": + path = os.path.expanduser("/Library/Preferences") + if appname: + path = os.path.join(path, appname) + else: + # XDG default for $XDG_CONFIG_DIRS + # only first, if multipath is False + path = os.getenv("XDG_CONFIG_DIRS", "/etc/xdg") + pathlist = [ + os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep) + ] + if appname: + if version: + appname = os.path.join(appname, version) + pathlist = [os.sep.join([x, appname]) for x in pathlist] + + if multipath: + path = os.pathsep.join(pathlist) + else: + path = pathlist[0] + return path + + +def user_cache_dir(appname=None, appauthor=None, version=None, opinion=True): + r"""Return full path to the user-specific cache dir for this application. + + "appname" is the name of application. + If None, just the system directory is returned. + "appauthor" (only used on Windows) is the name of the + appauthor or distributing body for this application. Typically + it is the owning company name. This falls back to appname. You may + pass False to disable it. + "version" is an optional version path element to append to the + path. You might want to use this if you want multiple versions + of your app to be able to run independently. If used, this + would typically be ".". + Only applied when appname is present. + "opinion" (boolean) can be False to disable the appending of + "Cache" to the base app data dir for Windows. See + discussion below. + + Typical user cache directories are: + Mac OS X: ~/Library/Caches/ + Unix: ~/.cache/ (XDG default) + Win XP: C:\Documents and Settings\\Local Settings\Application Data\\\Cache + Vista: C:\Users\\AppData\Local\\\Cache + + On Windows the only suggestion in the MSDN docs is that local settings go in + the `CSIDL_LOCAL_APPDATA` directory. This is identical to the non-roaming + app data dir (the default returned by `user_data_dir` above). Apps typically + put cache data somewhere *under* the given dir here. Some examples: + ...\Mozilla\Firefox\Profiles\\Cache + ...\Acme\SuperApp\Cache\1.0 + OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value. + This can be disabled with the `opinion=False` option. + """ + if system == "win32": + if appauthor is None: + appauthor = appname + path = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA")) + if appname: + if appauthor is not False: + path = os.path.join(path, appauthor, appname) + else: + path = os.path.join(path, appname) + if opinion: + path = os.path.join(path, "Cache") + elif system == "darwin": + path = os.path.expanduser("~/Library/Caches") + if appname: + path = os.path.join(path, appname) + else: + path = os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache")) + if appname: + path = os.path.join(path, appname) + if appname and version: + path = os.path.join(path, version) + return path + + +def user_state_dir(appname=None, appauthor=None, version=None, roaming=False): + r"""Return full path to the user-specific state dir for this application. + + "appname" is the name of application. + If None, just the system directory is returned. + "appauthor" (only used on Windows) is the name of the + appauthor or distributing body for this application. Typically + it is the owning company name. This falls back to appname. You may + pass False to disable it. + "version" is an optional version path element to append to the + path. You might want to use this if you want multiple versions + of your app to be able to run independently. If used, this + would typically be ".". + Only applied when appname is present. + "roaming" (boolean, default False) can be set True to use the Windows + roaming appdata directory. That means that for users on a Windows + network setup for roaming profiles, this user data will be + sync'd on login. See + + for a discussion of issues. + + Typical user state directories are: + Mac OS X: same as user_data_dir + Unix: ~/.local/state/ # or in $XDG_STATE_HOME, if defined + Win *: same as user_data_dir + + For Unix, we follow this Debian proposal + to extend the XDG spec and support $XDG_STATE_HOME. + + That means, by default "~/.local/state/". + """ + if system in ["win32", "darwin"]: + path = user_data_dir(appname, appauthor, None, roaming) + else: + path = os.getenv("XDG_STATE_HOME", os.path.expanduser("~/.local/state")) + if appname: + path = os.path.join(path, appname) + if appname and version: + path = os.path.join(path, version) + return path + + +def user_log_dir(appname=None, appauthor=None, version=None, opinion=True): + r"""Return full path to the user-specific log dir for this application. + + "appname" is the name of application. + If None, just the system directory is returned. + "appauthor" (only used on Windows) is the name of the + appauthor or distributing body for this application. Typically + it is the owning company name. This falls back to appname. You may + pass False to disable it. + "version" is an optional version path element to append to the + path. You might want to use this if you want multiple versions + of your app to be able to run independently. If used, this + would typically be ".". + Only applied when appname is present. + "opinion" (boolean) can be False to disable the appending of + "Logs" to the base app data dir for Windows, and "log" to the + base cache dir for Unix. See discussion below. + + Typical user log directories are: + Mac OS X: ~/Library/Logs/ + Unix: ~/.cache//log # or under $XDG_CACHE_HOME if defined + Win XP: C:\Documents and Settings\\Local Settings\Application Data\\\Logs + Vista: C:\Users\\AppData\Local\\\Logs + + On Windows the only suggestion in the MSDN docs is that local settings + go in the `CSIDL_LOCAL_APPDATA` directory. (Note: I'm interested in + examples of what some windows apps use for a logs dir.) + + OPINION: This function appends "Logs" to the `CSIDL_LOCAL_APPDATA` + value for Windows and appends "log" to the user cache dir for Unix. + This can be disabled with the `opinion=False` option. + """ + if system == "darwin": + path = os.path.join(os.path.expanduser("~/Library/Logs"), appname) + elif system == "win32": + path = user_data_dir(appname, appauthor, version) + version = False + if opinion: + path = os.path.join(path, "Logs") + else: + path = user_cache_dir(appname, appauthor, version) + version = False + if opinion: + path = os.path.join(path, "log") + if appname and version: + path = os.path.join(path, version) + return path + + +class AppDirs: + """Convenience wrapper for getting application dirs.""" + + def __init__( + self, appname=None, appauthor=None, version=None, roaming=False, multipath=False + ): + self.appname = appname + self.appauthor = appauthor + self.version = version + self.roaming = roaming + self.multipath = multipath + + @property + def user_data_dir(self): + return user_data_dir( + self.appname, self.appauthor, version=self.version, roaming=self.roaming + ) + + @property + def site_data_dir(self): + return site_data_dir( + self.appname, self.appauthor, version=self.version, multipath=self.multipath + ) + + @property + def user_config_dir(self): + return user_config_dir( + self.appname, self.appauthor, version=self.version, roaming=self.roaming + ) + + @property + def site_config_dir(self): + return site_config_dir( + self.appname, self.appauthor, version=self.version, multipath=self.multipath + ) + + @property + def user_cache_dir(self): + return user_cache_dir(self.appname, self.appauthor, version=self.version) + + @property + def user_state_dir(self): + return user_state_dir(self.appname, self.appauthor, version=self.version) + + @property + def user_log_dir(self): + return user_log_dir(self.appname, self.appauthor, version=self.version) + + +# ---- internal support stuff + + +def _get_win_folder_from_registry(csidl_name): + """This is a fallback technique at best. I'm not sure if using the + registry for this guarantees us the correct answer for all CSIDL_* + names. + """ + import winreg as _winreg + + shell_folder_name = { + "CSIDL_APPDATA": "AppData", + "CSIDL_COMMON_APPDATA": "Common AppData", + "CSIDL_LOCAL_APPDATA": "Local AppData", + }[csidl_name] + + key = _winreg.OpenKey( + _winreg.HKEY_CURRENT_USER, + r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", + ) + dir, _type = _winreg.QueryValueEx(key, shell_folder_name) + return dir + + +def _get_win_folder_with_pywin32(csidl_name): + from win32com.shell import shell, shellcon + + dir = shell.SHGetFolderPath(0, getattr(shellcon, csidl_name), 0, 0) + # Try to make this a unicode path because SHGetFolderPath does + # not return unicode strings when there is unicode data in the + # path. + try: + dir = unicode(dir) + + # Downgrade to short path name if have highbit chars. See + # . + has_high_char = False + for c in dir: + if ord(c) > 255: + has_high_char = True + break + if has_high_char: + try: + import win32api + + dir = win32api.GetShortPathName(dir) + except ImportError: + pass + except UnicodeError: + pass + return dir + + +def _get_win_folder_with_ctypes(csidl_name): + import ctypes + + csidl_const = { + "CSIDL_APPDATA": 26, + "CSIDL_COMMON_APPDATA": 35, + "CSIDL_LOCAL_APPDATA": 28, + }[csidl_name] + + buf = ctypes.create_unicode_buffer(1024) + ctypes.windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf) + + # Downgrade to short path name if have highbit chars. See + # . + has_high_char = False + for c in buf: + if ord(c) > 255: + has_high_char = True + break + if has_high_char: + buf2 = ctypes.create_unicode_buffer(1024) + if ctypes.windll.kernel32.GetShortPathNameW(buf.value, buf2, 1024): + buf = buf2 + + return buf.value + + +def _get_win_folder_with_jna(csidl_name): + import array + + from com.sun import jna + from com.sun.jna.platform import win32 + + buf_size = win32.WinDef.MAX_PATH * 2 + buf = array.zeros("c", buf_size) + shell = win32.Shell32.INSTANCE + shell.SHGetFolderPath( + None, + getattr(win32.ShlObj, csidl_name), + None, + win32.ShlObj.SHGFP_TYPE_CURRENT, + buf, + ) + dir = jna.Native.toString(buf.tostring()).rstrip("\0") + + # Downgrade to short path name if have highbit chars. See + # . + has_high_char = False + for c in dir: + if ord(c) > 255: + has_high_char = True + break + if has_high_char: + buf = array.zeros("c", buf_size) + kernel = win32.Kernel32.INSTANCE + if kernel.GetShortPathName(dir, buf, buf_size): + dir = jna.Native.toString(buf.tostring()).rstrip("\0") + + return dir + + +if system == "win32": + try: + import win32com.shell + + _get_win_folder = _get_win_folder_with_pywin32 + except ImportError: + try: + from ctypes import windll + + _get_win_folder = _get_win_folder_with_ctypes + except ImportError: + try: + import com.sun.jna + + _get_win_folder = _get_win_folder_with_jna + except ImportError: + _get_win_folder = _get_win_folder_from_registry + + +# ---- self test code + +if __name__ == "__main__": + appname = "MyApp" + appauthor = "MyCompany" + + props = ( + "user_data_dir", + "user_config_dir", + "user_cache_dir", + "user_state_dir", + "user_log_dir", + "site_data_dir", + "site_config_dir", + ) + + print(f"-- app dirs {__version__} --") + + print("-- app dirs (with optional 'version')") + dirs = AppDirs(appname, appauthor, version="1.0") + for prop in props: + print(f"{prop}: {getattr(dirs, prop)}") + + print("\n-- app dirs (without optional 'version')") + dirs = AppDirs(appname, appauthor) + for prop in props: + print(f"{prop}: {getattr(dirs, prop)}") + + print("\n-- app dirs (without optional 'appauthor')") + dirs = AppDirs(appname) + for prop in props: + print(f"{prop}: {getattr(dirs, prop)}") + + print("\n-- app dirs (with disabled 'appauthor')") + dirs = AppDirs(appname, appauthor=False) + for prop in props: + print(f"{prop}: {getattr(dirs, prop)}") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_classes.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_classes.py new file mode 100644 index 0000000000000000000000000000000000000000..100a52253a86974b335aede0c3f33681e21c9e09 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_classes.py @@ -0,0 +1,56 @@ +import types +from typing import Any + +import torch._C + + +class _ClassNamespace(types.ModuleType): + def __init__(self, name: str) -> None: + super().__init__("torch.classes" + name) + self.name = name + + def __getattr__(self, attr: str) -> Any: + proxy = torch._C._get_custom_class_python_wrapper(self.name, attr) + if proxy is None: + raise RuntimeError(f"Class {self.name}.{attr} not registered!") + return proxy + + +class _Classes(types.ModuleType): + __file__ = "_classes.py" + + def __init__(self) -> None: + super().__init__("torch.classes") + + def __getattr__(self, name: str) -> _ClassNamespace: + namespace = _ClassNamespace(name) + setattr(self, name, namespace) + return namespace + + @property + def loaded_libraries(self) -> Any: + return torch.ops.loaded_libraries + + def load_library(self, path: str) -> None: + """ + Loads a shared library from the given path into the current process. + + The library being loaded may run global initialization code to register + custom classes with the PyTorch JIT runtime. This allows dynamically + loading custom classes. For this, you should compile your class + and the static registration code into a shared library object, and then + call ``torch.classes.load_library('path/to/libcustom.so')`` to load the + shared object. + + After the library is loaded, it is added to the + ``torch.classes.loaded_libraries`` attribute, a set that may be inspected + for the paths of all libraries loaded using this function. + + Args: + path (str): A path to a shared library to load. + """ + torch.ops.load_library(path) + + +# The classes "namespace" +classes = _Classes() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_compile.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_compile.py new file mode 100644 index 0000000000000000000000000000000000000000..60884b628d95ca28d31a45d57e091e8943cf4370 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_compile.py @@ -0,0 +1,60 @@ +""" +APIs related to torch.compile which lazily import torch._dynamo to avoid +circular dependencies. +""" + +import functools +from collections.abc import Callable +from typing import overload, TypeVar +from typing_extensions import ParamSpec + + +_T = TypeVar("_T") +_P = ParamSpec("_P") + + +@overload +def _disable_dynamo( + fn: Callable[_P, _T], recursive: bool = True +) -> Callable[_P, _T]: ... + + +@overload +def _disable_dynamo( + fn: None = None, recursive: bool = True +) -> Callable[[Callable[_P, _T]], Callable[_P, _T]]: ... + + +def _disable_dynamo( + fn: Callable[_P, _T] | None = None, recursive: bool = True +) -> Callable[_P, _T] | Callable[[Callable[_P, _T]], Callable[_P, _T]]: + """ + This API should be only used inside torch, external users should still use + torch._dynamo.disable. The main goal of this API is to avoid circular + imports issues that is common while using _dynamo.disable inside torch + itself. + + This API avoids it by lazily importing torch._dynamo from the import time to + the invocation of the decorated function. + """ + if fn is not None: + + @functools.wraps(fn) + def inner(*args: _P.args, **kwargs: _P.kwargs) -> _T: + # cache this on the first invocation to avoid adding too much overhead. + disable_fn = getattr(fn, "__dynamo_disable", None) + if disable_fn is None: + import torch._dynamo + + # We can safely turn off functools.wraps here because the inner + # already wraps fn in the outer scope. + disable_fn = torch._dynamo.disable(fn, recursive, wrapping=False) + fn.__dynamo_disable = disable_fn # type: ignore[attr-defined] + + return disable_fn(*args, **kwargs) + + return inner + else: + # decorator usage like @_disable_dynamo(recursive=False). The resulting + # object expects the original decorated function as the arg. + return functools.partial(_disable_dynamo, recursive=recursive) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_custom_ops.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_custom_ops.py new file mode 100644 index 0000000000000000000000000000000000000000..86f506e5a21c4b8ce8dff3595775822296cf5b0e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_custom_ops.py @@ -0,0 +1,326 @@ +# mypy: allow-untyped-defs +import inspect + +from torch._custom_op.impl import ( + _custom_op_with_schema, + _find_custom_op, + infer_schema, + parse_qualname, + validate_namespace, +) +from torch.library import get_ctx + + +__all__ = [ + "custom_op", + "impl", + "impl_abstract", + "get_ctx", + "impl_save_for_backward", + "impl_backward", +] + + +def custom_op(qualname, func_or_schema=None): + r"""Register a new custom operator + + In PyTorch, defining an op (short for "operator") is a two step-process: + - we need to define the op (by providing an operator name and schema) + - we need to implement behavior for how the operator interacts with + various PyTorch subsystems, like CPU/CUDA Tensors, Autograd, etc. + + This entrypoint defines the custom operator (the first step) + you must then perform the second step by calling various + ``impl_*`` APIs. + + This API may be used as a decorator (see examples). + + For a detailed guide on custom ops, please see + https://docs.google.com/document/d/1aGWtgxV3HppuxQAdddyPrs74_aEntpkYt9MalnCKnhk + + Arguments: + qualname (str): Should be a string that looks like + "namespace::operator_name". Operators in PyTorch need a namespace to + avoid name collisions; a given operator may only be created once. + If you are writing a Python library, we recommend the namespace to + be the name of your top-level module. + func_or_schema (Union[Callable, str]): Each PyTorch operator needs a + schema that tells PyTorch the types of the inputs/outputs. + If this is a Callable, we will automatically infer the schema from + the type annotations on the function (see examples). Otherwise, + if you don't want to use type annotations, you may provide us the + schema string. + + Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> import torch + >>> import numpy as np + >>> from torch import Tensor + >>> + >>> # Step 1: define the custom op. + >>> # We need to provide the API a "prototype function" + >>> # (a function that returns NotImplementedError), from which + >>> # we will infer the types of the inputs and outputs. + >>> @torch._custom_ops.custom_op("mylibrary::numpy_sin") + >>> def numpy_sin(x: Tensor) -> Tensor: + >>> raise NotImplementedError + >>> + >>> # The custom op is now accessible via the torch.ops module: + >>> torch.ops.mylibrary.numpy_sin + >>> + >>> # Step 2: Register an implementation for various PyTorch subsystems + >>> + >>> # Register an implementation for CPU tensors + >>> @torch._custom_ops.impl("mylibrary::numpy_sin", device_types="cpu") + >>> def numpy_sin_impl_cpu(x): + >>> return torch.from_numpy(np.sin(x.numpy())) + >>> + >>> # Register an implementation for CUDA tensors + >>> @torch._custom_ops.impl("mylibrary::numpy_sin", device_types="cuda") + >>> def numpy_sin_impl_cuda(x): + >>> return torch.from_numpy(np.sin(x.cpu().numpy())).to(x.device) + >>> + >>> x = torch.randn(3) + >>> torch.ops.mylibrary.numpy_sin(x) # calls numpy_sin_impl_cpu + >>> + >>> x_cuda = x.cuda() + >>> torch.ops.mylibrary.numpy_sin(x) # calls numpy_sin_impl_cuda + + """ + ns, name = parse_qualname(qualname) + validate_namespace(ns) + + def inner(func): + if not inspect.isfunction(func): + raise ValueError( + f"custom_op(...)(func): Expected `func` to be a Python " + f"function, got: {type(func)}" + ) + + if func.__name__ != name: + raise ValueError( + f"custom_op(qualname='{qualname}', ...)(func): expected `func` " + f"to have name '{name}' but got '{func.__name__}'. " + f"Please either change the name of `func` or the qualname that " + f"is passed to `custom_op`" + ) + + schema = infer_schema(func, mutates_args=()) + _custom_op_with_schema(qualname, schema) + return func + + if func_or_schema is None: + return inner + if isinstance(func_or_schema, str): + _custom_op_with_schema(qualname, func_or_schema) + else: + return inner(func_or_schema) + + +def impl(qualname, *, device_types=("cpu", "cuda"), func=None): + r"""Register an implementation for a device type for this custom op. + + If the op is passed multiple Tensor inputs with different device + types, it will dispatch to the registered implementation for the highest + priority device type among those present. + The supported device types, in order of priority, are {'cuda', 'cpu'}. + + This API may be used as a decorator (see examples). + + For a detailed guide on custom ops, please see + https://docs.google.com/document/d/1aGWtgxV3HppuxQAdddyPrs74_aEntpkYt9MalnCKnhk + + Arguments: + device_types (str or Iterable[str]): the device type(s) to register the function for. + + Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> import torch + >>> import numpy as np + >>> from torch import Tensor + >>> + >>> # Step 1: define the custom op. + >>> # We need to provide the API a "prototype function" + >>> # (a function that returns NotImplementedError), from which + >>> # we will infer the types of the inputs and outputs. + >>> @torch._custom_ops.custom_op("mylibrary::numpy_cos") + >>> def numpy_cos(x: Tensor) -> Tensor: + >>> raise NotImplementedError + >>> + >>> # The custom op is now accessible via the torch.ops module: + >>> torch.ops.mylibrary.numpy_cos + >>> + >>> # Step 2: Register an implementation for various PyTorch subsystems + >>> + >>> # Register an implementation for CPU tensors + >>> @torch._custom_ops.impl("mylibrary::numpy_cos", device_types="cpu") + >>> def numpy_cos_impl_cpu(x): + >>> return torch.from_numpy(np.cos(x.numpy())) + >>> + >>> # Register an implementation for CUDA tensors + >>> @torch._custom_ops.impl("mylibrary::numpy_cos", device_types="cuda") + >>> def numpy_cos_impl_cuda(x): + >>> return torch.from_numpy(np.cos(x.cpu().numpy())).to(x.device) + >>> + >>> x = torch.randn(3) + >>> torch.ops.mylibrary.numpy_cos(x) # calls numpy_cos_impl_cpu + >>> + >>> x_cuda = x.cuda() + >>> torch.ops.mylibrary.numpy_cos(x) # calls numpy_cos_impl_cuda + + """ + + def inner(func): + custom_op = _find_custom_op(qualname, also_check_torch_library=True) + custom_op.impl(device_types, _stacklevel=3)(func) + return func + + if func is None: + return inner + return inner(func) + + +def impl_abstract(qualname, *, func=None): + r"""Register an abstract implementation for this operator. + + An "abstract implementation" specifies the behavior of this operator on + Tensors that carry no data. Given some input Tensors with certain properties + (sizes/strides/storage_offset/device), it specifies what the properties of + the output Tensors are. + + The abstract implementation has the same signature as the operator. + It is run for both FakeTensors and meta tensors. To write an abstract + implementation, assume that all Tensor inputs to the operator are + regular CPU/CUDA/Meta tensors, but they do not have storage, and + you are trying to return regular CPU/CUDA/Meta tensor(s) as output. + The abstract implementation must consist of only PyTorch operations + (and may not directly access the storage or data of any input or + intermediate Tensors). + + This API may be used as a decorator (see examples). + + For a detailed guide on custom ops, please see + https://docs.google.com/document/d/1aGWtgxV3HppuxQAdddyPrs74_aEntpkYt9MalnCKnhk + + Examples:: + >>> import numpy as np + >>> from torch import Tensor + >>> + >>> # Example 1: an operator without data-dependent output shape + >>> @torch._custom_ops.custom_op("mylibrary::custom_linear") + >>> def custom_linear(x: Tensor, weight: Tensor, bias: Tensor) -> Tensor: + >>> raise NotImplementedError + >>> + >>> @torch._custom_ops.impl_abstract("mylibrary::custom_linear") + >>> def custom_linear_abstract(x, weight): + >>> assert x.dim() == 2 + >>> assert weight.dim() == 2 + >>> assert bias.dim() == 1 + >>> assert x.shape[1] == weight.shape[1] + >>> assert weight.shape[0] == bias.shape[0] + >>> assert x.device == weight.device + >>> + >>> return (x @ weight.t()) + bias + >>> + >>> # Example 2: an operator with data-dependent output shape + >>> @torch._custom_ops.custom_op('mylibrary::custom_nonzero') + >>> def custom_nonzero(x: Tensor) -> Tensor: + >>> ... + >>> + >>> @torch._custom_ops.impl_abstract("mylibrary::custom_nonzero") + >>> def custom_nonzero_abstract(x): + >>> # Number of nonzero-elements is data-dependent. + >>> # Since we cannot peek at the data in an abstract impl, + >>> # we use the ctx object to construct a new symint that + >>> # represents the data-dependent size. + >>> ctx = torch._custom_ops.get_ctx() + >>> nnz = ctx.create_unbacked_symint() + >>> shape = [x.dim(), nnz] + >>> result = x.new_empty(shape, dtype=torch.long) + >>> return result + >>> + >>> @torch._custom_ops.impl("mylibrary::custom_nonzero") + >>> def custom_nonzero_impl(x): + >>> x_np = to_numpy(x) + >>> res = np.stack(np.nonzero(x_np), axis=1) + >>> # unbacked symbolic ints in PyTorch must be >= 2, so we + >>> # constrain the range to at least 2 + >>> if res.shape[0] <= 1: + >>> raise RuntimeError("not supported") + >>> return torch.tensor(res, device=x.device) + + """ + import torch.library + + return torch.library.register_fake(qualname, func, _stacklevel=2) + + +def impl_save_for_backward(qualname, *, func=None): + r"""Register a function that tells us what to save for backward. + + Please see :func:`impl_backward` for more details. + """ + + def inner(func): + custom_op = _find_custom_op(qualname, also_check_torch_library=True) + custom_op.impl_save_for_backward(_stacklevel=3)(func) + return func + + if func is None: + return inner + return inner(func) + + +def impl_backward(qualname, output_differentiability=None, *, func=None): + r"""Registers a backward formula for an operator. + + In order for an operator to work with autograd, you need to register + a backward formula. There are two pieces to this: + 1. You must give us a function to specify what to save for backward. + Call this the "save for backward" function. + 2. You must give us a function that computes gradients. Call this the + "backward" function. + + Use `impl_save_for_backward` to define a "save for backward" function + that specifies what gets saved for backward. The function should accept + two arguments ``(inputs, output)`` and return the quantities to be saved + for backward. + + During runtime, when you call the operator in a forwards pass, PyTorch + will invoke the "save for backward" function with the inputs and output + of the operator. + + Use `impl_backward` to define the "backward" function. The backward + function must accept ``(ctx, saved, *grads)``: + - ``ctx`` is a context object where we may provide information + - ``saved`` is exactly what gets returned from the "save for backward" + function + - ``grads`` is one or more gradients. The number of gradients matches + the number of outputs of the operator. + + The backward function must return a dict that maps the name of + an input to the operator to its corresponding gradient. All inputs that + were declared to be Tensors in the operator definition must be accounted + for in the dict. The gradient may be a Tensor or None. + + For a detailed guide on custom ops, please see + https://docs.google.com/document/d/1aGWtgxV3HppuxQAdddyPrs74_aEntpkYt9MalnCKnhk + + """ + + def inner(func): + custom_op = _find_custom_op(qualname, also_check_torch_library=True) + custom_op.impl_backward(output_differentiability, _stacklevel=3)(func) + return func + + if func is None: + return inner + return inner(func) + + +def _destroy(qualname): + """De-registers a custom op. For testing purposes only""" + custom_op = _find_custom_op(qualname) + custom_op._destroy() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_environment.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_environment.py new file mode 100644 index 0000000000000000000000000000000000000000..78e2ff3177db024114a9340663c1273a15c39c9d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_environment.py @@ -0,0 +1,2 @@ +def is_fbcode() -> bool: + return False diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_guards.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_guards.py new file mode 100644 index 0000000000000000000000000000000000000000..89c275d0b353bc9170e97e01c7ed7f54c0db9791 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_guards.py @@ -0,0 +1,1319 @@ +from __future__ import annotations + +import contextlib +import dataclasses +import enum +import functools +import logging +import re +import sys +import threading +import traceback +import unittest.mock +import weakref +from abc import abstractmethod +from collections import defaultdict +from contextlib import contextmanager +from dataclasses import dataclass +from typing import Any, Generic, NamedTuple, Optional, overload, TYPE_CHECKING, TypeVar + + +if sys.version_info >= (3, 11): + from typing import dataclass_transform +else: + + def dataclass_transform(): + def decorator(fn): + return fn + + return decorator + + +import torch +from torch.utils import _pytree as pytree +from torch.utils._ordered_set import OrderedSet +from torch.utils._python_dispatch import is_traceable_wrapper_subclass +from torch.utils._traceback import CapturedTraceback, format_frame +from torch.utils.weak import WeakTensorKeyDictionary + + +log = logging.getLogger(__name__) + + +if TYPE_CHECKING: + from collections.abc import Callable, Generator, Iterator + from types import CodeType + + import sympy + + from torch._dynamo.backends.distributed import DDPOptimizerContext + from torch._dynamo.codegen import PyCodegen + from torch._functorch._aot_autograd.schemas import ViewAndMutationMeta + from torch._subclasses.fake_tensor import FakeTensorMode + + +""" +torch._guards is the definitional source of truth for general purpose guard structures. + +An important thing to keep in mind here is the preservation of layering. There should be no dynamo notions, +and no guard installation notions here. +""" + +COMPILE_ID_PATTERN = re.compile(r"^(?P\d+)/(?P\d+)$") +CA_COMPILE_ID_PATTERN = re.compile( + r"^!(?P\d+)(?:/(?P\d+)/(?P\d+))?$" +) + +# [Note: Updating CompiledId] +# +# CompiledId represents a unique program-level identifier, and we want to keep that +# property as the codebase evolves. This property is relied on even outside of the pytorch +# repo, e.g. tlparse or other internal tooling. The in-memory format can be freely changed, +# as those dependencies only consume the string serialization. +# +# The string form should be: +# 1. Program-level uid: CompileId can uniquely identify a compiled graph. +# 2. Storage efficient: This object is logged in nearly every entry. We should elide symbols when possible. +# 3. Compact: The string form is directly displayed by some tools. Special symbols are okay. + + +@dataclass(frozen=True, kw_only=True, slots=True) +class CompileId: + frame_id: int | None + # This id is per-frame, and counts how many times we've compiled this + # frame. This could have been a global id but having this be per-frame + # gives you a better intuitive sense for how many recompiles have occurred + # so far. + frame_compile_id: int | None + + # torch.compiling a compiled autograd graph + compiled_autograd_id: int | None = None + + # TODO: consider also tracking the recompilation count + # See Note: Updating CompileId + + def __str__(self) -> str: + # NOTE: Keep this in sync with both from_string and the tlparse repo + if self.compiled_autograd_id is not None: + assert (self.frame_id is None) == (self.frame_compile_id is None) + frame_str = "" + if self.frame_id is not None: + frame_str = f"/{self.frame_id}/{self.frame_compile_id}" + + return f"!{self.compiled_autograd_id}{frame_str}" + else: + assert self.frame_id is not None and self.frame_compile_id is not None + return f"{self.frame_id}/{self.frame_compile_id}" + + @classmethod + def from_string(cls, compile_id: str | None) -> CompileId | None: + """ + Factory method that creates a CompileId from its string representation. + Keep this in sync with the __str__ method. + """ + if compile_id is None: + return None + try: + for pattern in (COMPILE_ID_PATTERN, CA_COMPILE_ID_PATTERN): + if match := pattern.match(compile_id): + groups = match.groupdict() + for k, v in groups.items(): + if v is not None: + groups[k] = int(v) + return cls(**groups) # type: ignore[arg-type] + else: + raise ValueError + + except Exception as e: + raise ValueError(f"Invalid compile_id '{compile_id}'") from e + + +class TraceId(NamedTuple): + compile_id: CompileId + # This starts off as 0, and every time we restart analysis it goes + # up by one + attempt: int + + def __str__(self) -> str: + # Keep this in sync with tlparse repo + if self.attempt == 0: + return str(self.compile_id) + else: + return f"{self.compile_id}_{self.attempt}" + + +class GuardSource(enum.Enum): + LOCAL = 0 + GLOBAL = 1 + LOCAL_SPECIALIZED_NN_MODULE = 2 + GLOBAL_SPECIALIZED_NN_MODULE = 3 + CONSTANT = 4 + RANDOM_VALUE = 5 + SHAPE_ENV = 6 + LOCAL_FSDP_MODULE = 7 + GLOBAL_FSDP_MODULE = 8 + BACKWARD_STATE = 9 + EPHEMERAL = 10 + SYNTHETIC_LOCAL = 11 + LOCAL_UNSPECIALIZED_NN_MODULE = 12 + GLOBAL_UNSPECIALIZED_NN_MODULE = 13 + LOCAL_UNSPECIALIZED_BUILTIN_NN_MODULE = 14 + GLOBAL_UNSPECIALIZED_BUILTIN_NN_MODULE = 15 + TEMP_LOCAL = 16 + + def is_fsdp_module(self) -> bool: + return self in (GuardSource.GLOBAL_FSDP_MODULE, GuardSource.LOCAL_FSDP_MODULE) + + def is_specialized_nn_module(self) -> bool: + import torch._dynamo.config as config + + if config._unsafe_skip_fsdp_module_guards: + return ( + self + in ( + GuardSource.GLOBAL_SPECIALIZED_NN_MODULE, + GuardSource.LOCAL_SPECIALIZED_NN_MODULE, + ) + or self.is_fsdp_module() + ) + return self in ( + GuardSource.GLOBAL_SPECIALIZED_NN_MODULE, + GuardSource.LOCAL_SPECIALIZED_NN_MODULE, + ) + + def is_unspecialized_nn_module(self) -> bool: + return self in ( + GuardSource.GLOBAL_UNSPECIALIZED_NN_MODULE, + GuardSource.LOCAL_UNSPECIALIZED_NN_MODULE, + GuardSource.GLOBAL_UNSPECIALIZED_BUILTIN_NN_MODULE, + GuardSource.LOCAL_UNSPECIALIZED_BUILTIN_NN_MODULE, + ) + + def is_unspecialized_builtin_nn_module(self) -> bool: + return self in ( + GuardSource.GLOBAL_UNSPECIALIZED_BUILTIN_NN_MODULE, + GuardSource.LOCAL_UNSPECIALIZED_BUILTIN_NN_MODULE, + ) + + def is_local(self) -> bool: + return self in ( + GuardSource.LOCAL, + GuardSource.LOCAL_SPECIALIZED_NN_MODULE, + GuardSource.LOCAL_FSDP_MODULE, + GuardSource.LOCAL_UNSPECIALIZED_NN_MODULE, + GuardSource.LOCAL_UNSPECIALIZED_BUILTIN_NN_MODULE, + ) + + +""" +Base class for a "GuardBuilder" role. + +The GuardBuilderBase role is to represent a scope within which to build a guard. The name is a little +confusing, as its not a builder, but for the sake of avoiding a lot of renames and keeping the original reference +to torchdynamo's GuardBuilder. + +Note: create_fn is invoked with a GuardBuilderBase and a Guard. A GuardBuilder is chosen based +on GuardSource's select function. + +There is value in keeping this GuardBuilderBase empty to keep layering clean. +""" + + +class GuardBuilderBase: + pass + + +@dataclasses.dataclass(frozen=True) +class SLoc: + framework_loc: traceback.FrameSummary | str | None + maybe_user_loc: str | None + + def __str__(self) -> str: + floc = ( + self.framework_loc + if isinstance(self.framework_loc, str) + else format_frame(self.framework_loc) + ) + if self.maybe_user_loc is not None: + return f"{self.maybe_user_loc} ({floc})" + else: + return f"({floc})" + + +class ShapeGuard(NamedTuple): + expr: sympy.logic.boolalg.Boolean + sloc: SLoc + size_oblivious: bool + + +@dataclasses.dataclass(slots=True) +class Guard: + # originating_source is the source that called the make_guard method to + # construct this guard object. The property name specifies what exactly it + # is the guard is guarding on. The meaning of the name is dependent on the + # create_fn; you must look at the use-site inside create_fn to know what + # name means. + # + # That being said, although you might think this is just a "name", name is + # usually an arbitrary Python expression that will be evaluated with all + # globals (and locals, if you create a LOCAL guard) to extract the Python + # object that we want to perform guard tests on. This evaluation + # typically happens in GuardBuilder.eval. In these cases, name is + # typically produced by originating_source.name (not to be confused with + # GuardSource - the property source). + # + # Occasionally, name is not a valid Python expression; sometimes + # it is meaningless. Example create_fns that are like this include + # GRAD_MODE and SHAPE_ENV. + originating_source: Source + create_fn: Callable[[GuardBuilderBase, Guard], None] + + # Export only. These values are written to at time of guard check_fn creation. + guard_types: list[str] | None = None + code_list: list[str] | None = None + obj_weakref: object | None = None + guarded_class_weakref: weakref.ReferenceType[Any] | None = None + + stack: CapturedTraceback | None = None + user_stack: traceback.StackSummary | None = None + _hash: int | None = None + _unserializable: bool = False + + def __hash__(self) -> int: + if self._hash is None: + self._hash = hash((self.name, self.source, id(self.create_fn))) + return self._hash + + def sort_key(self) -> tuple[bool, int, int, str, int]: + # Put the duplicate input guards at the end. The duplicate guards have + # two sources while guard.name only considers one source. + + is_duplicate_input = ( + isinstance(self.create_fn, functools.partial) + and self.create_fn.func is torch._dynamo.guards.GuardBuilder.DUPLICATE_INPUT + ) + return ( + is_duplicate_input, + self.source.value if self.source else -1, + len(self.name), + self.name, + self.inner_create_fn().__code__.co_firstlineno, + ) + + def __lt__(self, other: Guard) -> bool: + return self.sort_key() < other.sort_key() + + def inner_create_fn(self) -> Callable[[GuardBuilderBase, Guard], Any]: + if isinstance(self.create_fn, functools.partial): + return self.create_fn.func + else: + return self.create_fn + + @property + def name(self) -> str: + return self.originating_source.name + + @property + def source(self) -> GuardSource: + return self.originating_source.guard_source + + @staticmethod + def weakref_to_str(obj_weakref: object) -> str: + """ + This is a workaround of a Python weakref bug. + + `obj_weakref` is instance returned by `weakref.ref`, + `str(obj_weakref)` is buggy if the original obj overrides __getattr__, e.g: + + class MyConfig(dict): + def __getattr__(self, x): + return self[x] + + obj = MyConfig(offset=5) + obj_weakref = weakref.ref(obj) + str(obj_weakref) # raise error: KeyError: '__name__' + """ + if isinstance(obj_weakref, weakref.ReferenceType): + obj = obj_weakref() + if obj is not None: + return f"" + else: + return f"" + else: + return str(obj_weakref) + + def __repr__(self) -> str: + s = f""" + {self.source.name.lower() if self.source else ""} {repr(self.name)} {self.inner_create_fn().__name__} + {{ + 'guard_types': {self.guard_types}, + 'code': {self.code_list}, + 'obj_weakref': {self.weakref_to_str(self.obj_weakref)} + 'guarded_class': {self.guarded_class_weakref} + }} + """ + return s + + def __str__(self) -> str: + output = f"Name: {repr(self.name)}\n" + source = self.source.name.lower() if self.source else "" + output += f" Source: {source}\n" + output += f" Create Function: {self.inner_create_fn().__name__}\n" + output += f" Guard Types: {self.guard_types}\n" + output += f" Code List: {self.code_list}\n" + output += f" Object Weakref: {self.weakref_to_str(self.obj_weakref)}\n" + output += f" Guarded Class Weakref: {self.guarded_class_weakref}\n" + return output + + def create(self, builder: GuardBuilderBase) -> Any: + try: + return self.create_fn(builder, self) + except Exception: + log.exception("Error while creating guard:\n%s", str(self).rstrip()) + if self.stack: + log.error("Created at:\n%s", "".join(self.stack.format()[-4:]).rstrip()) + raise + + def is_specialized_nn_module(self) -> bool: + return self.source.is_specialized_nn_module() + + def is_fsdp_module(self) -> bool: + return self.source.is_fsdp_module() + + def is_local(self) -> bool: + return self.source.is_local() + + def create_fn_name(self) -> str: + if isinstance(self.create_fn, functools.partial): + create_fn = self.create_fn.func # type: ignore[attr-defined] + else: + create_fn = self.create_fn + return create_fn.__name__ + + def set_export_info( + self, + guard_type: str, + guarded_class: weakref.ReferenceType[Any] | None, + code_list: list[str], + obj_weakref: object, + ) -> None: + if not self.guard_types: + self.guard_types = [] + + self.guard_types.append(guard_type) + + assert self.guarded_class_weakref in ( + guarded_class, + None, + ), "Guarded class id must be identical, or None" + self.guarded_class_weakref = guarded_class + + if not self.code_list: + self.code_list = code_list + else: + self.code_list.extend(code_list) + + # Some objects are ephemeral, e.g., list[slice(1, 2)]. If we have + # multiple guards on the same object, the weakref can die between the + # invocation of set_export_info calls. So a dead weakref is also + # acceptable. + assert ( + self.obj_weakref in (obj_weakref, None) + or callable(self.obj_weakref) + and self.obj_weakref() is None + ), "Guarded object must be identical, None or ephemeral (dead weakref)" + self.obj_weakref = obj_weakref + + +T = TypeVar("T") + +""" +Parent structure for guard env expressions. +A GuardEnvExpr can have any subtype. +Note: All subtypes must be handled exhaustively in +torch._dynamo.guards._parse_guard_env_guards to avoid a RuntimeError. +""" + + +@dataclasses.dataclass(frozen=True) +class GuardEnvExpr: + pass + + +""" +A class representing a pair of duplicate inputs. +input_pos_a and input_pos_b are input positions we have deduped. +""" + + +@dataclasses.dataclass(frozen=True) +class DuplicateInputs(GuardEnvExpr): + input_source_a: Source + input_source_b: Source + + def __post_init__(self) -> None: + assert self.input_source_a != self.input_source_b + + +""" +A class representing storage overlap relations among inputs that aliases the same storage. + +Given that a set of tensors alias the same storage, this guard checks whether they actually +have overlapping storages. + +While non_overlapping_sources represent input tensors that definitely don't have any storage +overlapping with any other input, overlapping_sources represent tensors that either: + +1. Do overlap some other input tensor +2. Might not overlap some other input tensor, but we are not sure +""" + + +@dataclasses.dataclass(frozen=True) +class StorageOverlap(GuardEnvExpr): + overlapping_sources: list[Source] + non_overlapping_sources: list[Source] + + +""" +Checkpointable is an interface for driving state snapshotting, left purposely vague for now. + +copy_graphstate() -> T, a somewhat legacy name, is expected to emit a snapshot of any type that +can also be taken in at restore_graphstate(T) calls. + +When to snapshot, is, at the moment, an implementation detail of upstream callers. Checkpointable +does not provide any guarantees around consistency, idempotency, or safety of calling its APIs, yet. + +In the future, it will have a closer coupling to a generic Checkpoint management system. +""" + + +class Checkpointable(Generic[T]): + @abstractmethod + def copy_graphstate(self) -> T: ... + + @abstractmethod + def restore_graphstate(self, state: T) -> None: ... + + +class GuardsCheckpointState: + """ + The GuardCheckpointState - it is the T of Checkpointable[T] for GuardsContext + """ + + dynamo_guards: OrderedSet[Guard] + + def __init__(self, dynamo_guards: OrderedSet[Guard]) -> None: + self.dynamo_guards = dynamo_guards + + def diff(self, other: GuardsCheckpointState) -> Optional[OrderedSet[Guard]]: + """ + Produces a delta against another GuardsCheckpointState. + + Returns None if no delta is found, otherwise, return an OrderedSet() of mismatched + Guard type objects. + """ + r = self.dynamo_guards.difference(other.dynamo_guards) + if len(r) == 0: + return None + return r + + def __eq__(self, other: object) -> bool: + if not isinstance(other, GuardsCheckpointState): + return False + return self.diff(other) is None + + +class ModuleContextCheckpointState: + nn_modules: dict[str, torch.nn.Module] = {} + + def __init__(self, nn_modules: dict[str, torch.nn.Module]) -> None: + self.nn_modules = nn_modules + + def diff(self, other: ModuleContextCheckpointState) -> set[str] | None: + """ + Produces a delta against another ModuleContextCheckpointState. + + Returns None if no delta is found, otherwise, return a set() of mismatched + module key names. + """ + r = set(self.nn_modules.keys()).difference(set(other.nn_modules.keys())) + if len(r) == 0: + return None + return r + + def __eq__(self, other: object) -> bool: + if not isinstance(other, ModuleContextCheckpointState): + return False + return self.diff(other) is None + + +class ModuleContext(Checkpointable[ModuleContextCheckpointState]): + def __init__(self) -> None: + self.nn_modules: dict[str, Any] = {} + + def copy_graphstate(self) -> ModuleContextCheckpointState: + return ModuleContextCheckpointState(dict(self.nn_modules)) + + def restore_graphstate(self, state: ModuleContextCheckpointState) -> None: + assert isinstance(state, ModuleContextCheckpointState) + self.nn_modules = state.nn_modules + + +class GlobalContextCheckpointState: + global_state: dict[str, tuple[Callable, Any]] = {} + + def __init__(self, global_states: dict[str, tuple[Callable, Any]]) -> None: + self.global_state = global_states + + def diff(self, other: GlobalContextCheckpointState) -> set[str] | None: + """ + Produces a delta against another GlobalContextCheckpointState. + + Returns None if no delta is found, otherwise, return a set() of mismatched + global key names. + """ + r = set(self.global_state.keys()).difference(set(other.global_state.keys())) + if len(r) == 0: + return None + return r + + def __eq__(self, other: object) -> bool: + if not isinstance(other, GlobalContextCheckpointState): + return False + return self.diff(other) is None + + +class GlobalContext(Checkpointable[GlobalContextCheckpointState]): + """ + This keeps track of the global torch state during tracing of a function. + For example, torch.is_grad_enabled. + """ + + _supported_global_states = { + "grad_enabled", + "autocast_enabled", + "autocast_cpu_enabled", + "autocast_gpu_dtype", + "autocast_cpu_dtype", + "autocast_cache_enabled", + } + + def __init__(self) -> None: + self.global_state: dict[str, tuple[Callable, Any]] = {} + + def copy_graphstate(self) -> GlobalContextCheckpointState: + return GlobalContextCheckpointState(self.global_state) + + def restore_graphstate(self, state: GlobalContextCheckpointState) -> None: + assert isinstance(state, GlobalContextCheckpointState) + self.global_state = state.global_state + assert ( + len(self.global_state) == len(self._supported_global_states) + and set(self.global_state.keys()) == self._supported_global_states + ), "Global state mismatch" + for func, args in self.global_state.values(): + func(args) + + +# Like a Set[Guard] but will record the user stack on all guards at the +# time they were installed at their destination +class GuardsSet: + def __init__(self, inner: Optional[OrderedSet[Guard]] = None) -> None: + if inner is None: + self.inner: OrderedSet[Guard] = OrderedSet() + else: + self.inner = inner + + def __iter__(self) -> Iterator[Guard]: + return iter(self.inner) + + def __len__(self) -> int: + return len(self.inner) + + # Subtraction along with bool is typically used to determine the delta of + # added guards between checkpoints for higher order ops + def __sub__(self, other: GuardsSet) -> GuardsSet: + return GuardsSet(self.inner - other.inner) + + def __bool__(self) -> bool: + return bool(self.inner) + + def add( + self, guard: Guard, *, collect_debug_stack: bool = True, skip: int = 0 + ) -> None: + if guard in self.inner: + return + if collect_debug_stack: + if guard.stack is None: + guard.stack = CapturedTraceback.extract(skip=1 + skip) + if guard.user_stack is None: + guard.user_stack = TracingContext.extract_stack() + self.inner.add(guard) + + def update(self, *others: set[Guard]) -> None: + for o in others: + for g in o: + self.add(g, skip=1) + + def remove_guards_with_source(self, source: Source) -> None: + """Delete all guards that contains a given source""" + from ._dynamo.source import is_from_source + + self.inner = OrderedSet( + g for g in self.inner if not is_from_source(g.originating_source, source) + ) + + +""" +A GuardsContext is a checkpointable representation of all the guards in the current tracing +context. It's lifecycle is bound 1:1 to the tracing context, and it should never be instantiated +directly outside of it. For passing around internal state representations of this object, +prefer to extract them with copy_graphstate to produce a GuardsCheckpointState. +""" + + +class GuardsContext(Checkpointable[GuardsCheckpointState]): + def __init__(self) -> None: + self.dynamo_guards: GuardsSet = GuardsSet() + self.aotautograd_guards: list[GuardEnvExpr] = [] + + def copy_graphstate(self) -> GuardsCheckpointState: + return GuardsCheckpointState(OrderedSet(self.dynamo_guards.inner)) + + def restore_graphstate(self, state: GuardsCheckpointState) -> None: + # NB: "steals" the passed in state + assert isinstance(state, GuardsCheckpointState) + self.dynamo_guards = GuardsSet(state.dynamo_guards) + + +class HopSubgraphCache: + @abstractmethod + def add_dynamo_installed_submodule(self, fn_id: int, identifier: str) -> None: ... + + @abstractmethod + def get_dynamo_installed_submodules(self, fn_id: int) -> list[str]: ... + + @abstractmethod + def add_autograd_key_entry(self, identifier: str, key: Callable) -> None: ... + + @abstractmethod + def get_autograd_key_entry(self, identifier: str) -> Callable | None: ... + + @abstractmethod + def add_proxy_dispatch_entry(self, identifier: str, key: Callable) -> None: ... + + @abstractmethod + def get_proxy_dispatch_entry(self, identifier: str) -> Callable | None: ... + + @abstractmethod + def add_lazy_bwd_entry( + self, + identifier: str, + tangent_metadata: tuple[object], + gmod: torch.fx.GraphModule, + ) -> int: ... + + @abstractmethod + def get_lazy_bwd_entry( + self, identifier: str, tangent_metadata: tuple[object] + ) -> tuple[torch.fx.GraphModule | None, int | None]: ... + + +class InvokeSubgraphCache(HopSubgraphCache): + def __init__(self) -> None: + self.autograd_cache: dict[str, Callable] = {} + self.proxy_dispatch_cache: dict[str, Callable] = {} + self.dynamo_installed_submodules: dict[int, list[str]] = defaultdict(list) + self.lazy_bwd_cache: dict[ + str, dict[tuple[object], tuple[torch.fx.GraphModule, int]] + ] = defaultdict(dict) + self.effects_cache: dict[ + str, set + ] = {} # Maps identifier -> set of effect types + + def add_dynamo_installed_submodule(self, fn_id: int, identifier: str) -> None: + self.dynamo_installed_submodules[fn_id].append(identifier) + + def get_dynamo_installed_submodules(self, fn_id: int) -> list[str]: + return self.dynamo_installed_submodules.get(fn_id, []) + + def add_autograd_key_entry(self, identifier: str, key: Callable) -> None: + self.autograd_cache[identifier] = key + + def get_autograd_key_entry(self, identifier: str) -> Callable | None: + return self.autograd_cache.get(identifier, None) + + def add_proxy_dispatch_entry(self, identifier: str, key: Callable) -> None: + self.proxy_dispatch_cache[identifier] = key + + def get_proxy_dispatch_entry(self, identifier: str) -> Callable | None: + return self.proxy_dispatch_cache.get(identifier, None) + + def add_lazy_bwd_entry( + self, + identifier: str, + tangent_metadata: tuple[object], + gmod: torch.fx.GraphModule, + ) -> int: + # Save the number of existing graph modules in the dictionary to get the suffix + num_gmods = len(self.lazy_bwd_cache[identifier]) + self.lazy_bwd_cache[identifier][tangent_metadata] = (gmod, num_gmods) + return num_gmods + + def get_lazy_bwd_entry( + self, identifier: str, tangent_metadata: tuple[object] + ) -> tuple[torch.fx.GraphModule | None, int | None]: + if identifier not in self.lazy_bwd_cache: + return (None, None) + + return self.lazy_bwd_cache[identifier].get(tangent_metadata, (None, None)) + + def add_effects(self, identifier: str, effects: set) -> None: + """Store the effect types for a given invoke_subgraph identifier.""" + if prev_effects := self.effects_cache.get(identifier, None): + assert effects == prev_effects, ( + "Different number of effects were found for invoke_subgraph " + f"call with identifier {identifier}. \n" + f"Previously we had the following effects: {prev_effects}.\n" + f"But now we have: {effects}." + ) + self.effects_cache[identifier] = effects + + def get_effects(self, identifier: str) -> set | None: + """Retrieve the effect types for a given invoke_subgraph identifier.""" + return self.effects_cache.get(identifier, None) + + +class HopDispatchSetCache: + def __init__(self) -> None: + # Delayed import to avoid circular dependency + from torch._higher_order_ops.invoke_subgraph import invoke_subgraph + + self.hop_cache_map = {invoke_subgraph: InvokeSubgraphCache()} + + def get_cache(self, op: torch._ops.HigherOrderOperator) -> HopSubgraphCache | None: + if op not in self.hop_cache_map: + return None + return self.hop_cache_map[op] # type: ignore[index] + + +_TLS = threading.local() + +""" +TracingContext is the source of truth for all currently accumulated information +needed to trace. Its lifecycle is kept 1:1 when using TorchDynamo, but other systems +are open to managing their own TracingContext with that in mind. + +The purpose of TracingContext is not to be a dumping ground, or god object, but rather to avoid +having to plumb complex subsystems across multiple verticals. + +Ex: A common example is guard accumulation between dynamo, shape_env, aot_autograd, and inductor. +Accessing the current tracing context via +TracingContext.get() allows users to accumulate their own guards for processing, without needing to know how +to plumb objects back up to where frame interpretation happened. + +Note that you can end up with multiple TracingContext for a single compilation +of a frame, as we reset the TracingContext whenever we restart analysis. +CompileContext is a more overarching context that encompasses multiple restarts. +""" + + +class CompileContext: + @staticmethod + def get() -> CompileContext: + assert _TLS.compile_context is not None + return _TLS.compile_context + + @staticmethod + def try_get() -> CompileContext | None: + return getattr(_TLS, "compile_context", None) + + def __init__(self, compile_id: CompileId | None) -> None: + assert compile_id is None or isinstance(compile_id, CompileId) + self.compile_id: CompileId | None = compile_id + self.attempt = 0 + # Verbose ShapeEnv guards produced. + self.shape_env_guards: list[str] = [] + + @staticmethod + def current_compile_id() -> CompileId | None: + self = CompileContext.try_get() + if self is None: + return None + return self.compile_id + + @staticmethod + def current_trace_id() -> TraceId | None: + self = CompileContext.try_get() + if self is None: + return None + if self.compile_id is None: + return None + return TraceId(self.compile_id, self.attempt) + + +class TracingContext: + """ + Provides the currently installed TracingContext, or None. + + Note that it is a staticmethod, and invocations outside of `with tracing()` (see below), are valid but + will return None. + """ + + @staticmethod + def try_get() -> TracingContext | None: + return getattr(_TLS, "tracing_context", None) + + @staticmethod + def get() -> TracingContext: + if ctx := TracingContext.try_get(): + return ctx + raise RuntimeError( + "TracingContext.get() must be called within an ongoing trace." + ) + + def __init__(self, fake_mode: FakeTensorMode | None) -> None: + self.guards_context = GuardsContext() + self.module_context = ModuleContext() + self.global_context = GlobalContext() + self.previously_inlined_functions: dict[Any, Any] = dict() + self.previously_cleaned_instructions: dict[Any, Any] = dict() + self.fake_mode: FakeTensorMode | None = fake_mode + self.frame_summary_stack: list[traceback.FrameSummary] = [] + # This is morally part of frame_summary_stack, but it is kept separate + # for clarity. As we process a frame, this variable gets updated + # to keep track of what line we are in the function. We make a + # function call, this gets cleared and the frame location is pushed + # to frame_summary_stack (prepping this variable for the inner frame's + # progress) + self.loc_in_frame: tuple[str, int, str] | None = None + # this is only set after aot_autograd + self.fw_metadata: ViewAndMutationMeta | None = None + # this is only set when the DDPOptimizer is used + self.ddp_optimizer_ctx: DDPOptimizerContext | None = None + # this is only set after aot_autograd + self.aot_graph_name: list[str] | None = None + self.params_flat: list[Any] | None = None + self.params_flat_unwrap_subclasses: list[Any] | None = None + self.params_unwrapped_to_flat_index: list[Any] | None = None + # this is for extended return calling convention from backend + # compiler to aot_autograd + # Per output, what the compiler specified stride of the output is, + # or None if no stride is known. This is always the HINT, it + # is never a SymInt (it would be better if it was a SymInt, but + # I can't conveniently get this from Inductor atm. Also, be + # careful not to accidentally induce guards on the SymInt if + # you ever do change this in aot_autograd.py; you should check + # on permutations preferentially.) + self.output_strides: list[tuple[int, ...] | None] | None = None + # When this is True, whenever we encounter an int in Dynamo tracing, + # we will (1) force unspec it and (2) force it as a size-like unbacked + # integer. This is currently used when processing certain lists of + # ints that are known to be size-like and may have 0/1 entries that we + # must not specialize on. + self.force_unspec_int_unbacked_size_like = False + # See note [Tensor Fakification and Symbol Caching] + self.tensor_to_context = WeakTensorKeyDictionary() + + # If this true, Aot Autograd will return output Fake Tensors with appropriate + # meta on the first invocation + # see note: [Returning Fake Tensors on First AOT Autograd Call] + self.fakify_first_call = False + self.hop_dispatch_set_cache = HopDispatchSetCache() + # list of code objects for inlined functions + self.traced_code: list[CodeType] = [] + + def clear(self) -> None: + # Look at the note in output_graph.py in function `save_global_state` + # for the context on clearing global context. + self.global_context.global_state = {} + self.previously_inlined_functions.clear() + self.previously_cleaned_instructions.clear() + + @staticmethod + @contextmanager + def patch(**kwargs: Any) -> Generator[None, None, None]: + prior = {} + ctx = TracingContext.get() + + for key in kwargs: + # KeyError on invalid entry + prior[key] = getattr(ctx, key) + for key, val in kwargs.items(): + setattr(ctx, key, val) + try: + yield + finally: + for key, val in prior.items(): + setattr(ctx, key, val) + + @staticmethod + def extract_stack() -> traceback.StackSummary: + self = TracingContext.try_get() + if self is None: + return traceback.StackSummary() + stack = self.frame_summary_stack + if self.loc_in_frame is not None: + stack = stack + [self._populate_loc_in_frame_summary()] + return traceback.StackSummary.from_list(stack) + + def _populate_loc_in_frame_summary(self) -> traceback.FrameSummary: + assert self.loc_in_frame is not None + filename, lineno, frame_name = self.loc_in_frame + return traceback.FrameSummary(filename, lineno, frame_name, lookup_line=False) + + # Call this when you want to call into some code that isn't necessarily + # associated with the current frame state + @staticmethod + @contextlib.contextmanager + def clear_frame() -> Generator[None, None, None]: + tc = TracingContext.get() + with ( + unittest.mock.patch.object(tc, "frame_summary_stack", []), + unittest.mock.patch.object(tc, "loc_in_frame", None), + ): + try: + yield + except Exception as e: + # Prevent real_stack from getting attached + # + # The invariant is that if an Exception as real_stack, we've + # appropriately attached a user stack and we no longer need to + # attach anything. Because we cannot conveniently interpose + # when an exception is thrown, we instead interpose everywhere + # we set what the user stack is set (using the context + # manager). However, our compiler stack does "tail calls" + # (when it calls into user compiler), at which point the + # parent exception frames would incorrectly attach an + # incorrect frame. + # + # However, if, somehow, someone raised an exception with this + # scope that had a stack (for example, because they are + # restoring the user stack state appropriately as they process + # node by node), we should respect it. Thus, we cannot + # unconditionally set None. + if not hasattr(e, "real_stack"): + e.real_stack = None # type: ignore[attr-defined] + raise + + @staticmethod + @contextlib.contextmanager + def current_frame( + frame_summary: traceback.FrameSummary | None, + ) -> Generator[None, None, None]: + # frame_summary can be None to solely take advantage of real_stack + # attachment to thrown exceptions + tc = TracingContext.get() + if frame_summary is not None: + tc.frame_summary_stack.append(frame_summary) + old = tc.loc_in_frame + tc.loc_in_frame = None + try: + yield + except Exception as e: + if not hasattr(e, "real_stack"): + e.real_stack = tc.extract_stack() # type: ignore[attr-defined] + raise + finally: + if frame_summary is not None: + tc.frame_summary_stack.pop() + tc.loc_in_frame = old + + @staticmethod + @contextlib.contextmanager + def report_output_strides() -> Generator[ + list[tuple[int, ...] | None] | None, None, None + ]: + tc = TracingContext.try_get() + if tc is None: + yield None + return + old_output_strides = tc.output_strides + tc.output_strides = [] + try: + yield tc.output_strides + finally: + tc.output_strides = old_output_strides + + @staticmethod + def set_current_loc(filename: str, lineno: int, frame_name: str) -> None: + # Save the current location in the frame. Lazily generate the + # framesummary. + TracingContext.get().loc_in_frame = (filename, lineno, frame_name) + + @staticmethod + def get_traced_code() -> list[CodeType] | None: + tc = TracingContext.try_get() + if tc is None: + return None + return tc.traced_code + + +@contextmanager +def compile_context( + context: CompileContext | None, +) -> Generator[CompileContext | None, None, None]: + old_context = getattr(_TLS, "compile_context", None) + _TLS.compile_context = context + try: + yield context + finally: + _TLS.compile_context = old_context + + +@contextmanager +def tracing( + context: TracingContext | None, +) -> Generator[TracingContext | None, None, None]: + """ + This function installs the passed in tracing context as a dynamic scoped + global variable. + + Calls to TracingContext.get() while not under a `with tracing()` context + will return None. + """ + old_context = getattr(_TLS, "tracing_context", None) + _TLS.tracing_context = context + try: + yield context + except Exception as e: + if not hasattr(e, "real_stack") and context is not None: + e.real_stack = context.extract_stack() # type: ignore[attr-defined] + raise + finally: + if ( + context is not None + and context.fake_mode is not None + and context.fake_mode.shape_env is not None + ): + context.fake_mode.shape_env.cleanup() + _TLS.tracing_context = old_context + + +@overload +def dataclass_with_cached_hash(cls: type[T], **kwargs: Any) -> type[T]: ... + + +@overload +def dataclass_with_cached_hash( + cls: None = None, **kwargs: Any +) -> Callable[[type[T]], type[T]]: ... + + +@dataclass_transform() +def dataclass_with_cached_hash( + cls: type[T] | None = None, **kwargs: Any +) -> type[T] | Callable[[type[T]], type[T]]: + def wrap(cls_inner: type[T]) -> type[T]: + new_cls = dataclasses.dataclass(cls_inner, **kwargs) + old_hash = cls_inner.__hash__ + + def __hash__(self) -> int: + if not hasattr(self, "_hash"): + object.__setattr__(self, "_hash", old_hash(self)) + return self._hash + + def __reduce__(self): + # Exclude _hash from pickling to ensure deterministic cache keys. + # The _hash is a cached value that can be nondeterministically computed + # (e.g., based on id() of objects), so it should not affect pickling. + fields = dataclasses.fields(self) + field_values = tuple(getattr(self, f.name) for f in fields) + return (self.__class__, field_values) + + new_cls.__hash__ = __hash__ + new_cls.__reduce__ = __reduce__ + return new_cls # type: ignore[return-value] + + if cls is None: + return wrap + + return wrap(cls) + + +# Subclasses can be found in torch/_dynamo/source.py +# TODO(voz): Consider a toplevel torch/_source.py +@dataclass_with_cached_hash(frozen=True) +class Source: + def is_dict_key(self) -> bool: + return False + + def is_ephemeral(self) -> bool: + return False + + def reconstruct(self, codegen: PyCodegen) -> None: + raise NotImplementedError + + @functools.cached_property + def guard_source(self) -> GuardSource: + raise NotImplementedError + + @property + def _name_template(self) -> str: + """ + A template for the name of the source. Used to prevent code duplication between + `name` and `get_value`. + + For non-ChainedSources, `name` and `get_value` use the returned string directly. + + For ChainedSources, `name` and `get_value` expect the return to be a format string + with `{0}` present - `name` and `get_value` will apply different values to this function's + returned format string. + """ + raise NotImplementedError + + @functools.cached_property + def name(self) -> str: + return self._name_template + + def get_value( + self, + globals: dict[str, Any], + locals: dict[str, Any], + cache: weakref.WeakKeyDictionary[Source, Any], + ) -> Any: + if self in cache: + return cache[self] + value = eval(self._name_template, globals, locals) + cache[self] = value + return value + + def make_guard(self, fn: Callable[..., Any]) -> Guard: + if self.guard_source is GuardSource.CONSTANT: + raise NotImplementedError + return Guard(self, fn) + + def is_specialized_nn_module(self) -> bool: + return self.guard_source.is_specialized_nn_module() + + def subguards_allowed(self) -> bool: + """True if you can guard on attributes of this""" + return self.guard_source != GuardSource.SYNTHETIC_LOCAL + + +# Subclasses can be found in torch/_dynamo/source.py +@dataclass_with_cached_hash(frozen=True) +class ChainedSource(Source): + base: Source + + def is_dict_key(self) -> bool: + # Recurse until you either hit a ConstDictKey or a Source + return self.base.is_dict_key() + + def is_ephemeral(self) -> bool: + return self.base.is_ephemeral() + + @functools.cached_property + def guard_source(self) -> GuardSource: + return self.base.guard_source + + def get_base(self) -> Source: + current: Source = self + while isinstance(current, ChainedSource): + current = current.base + return current + + @functools.cached_property + def name(self) -> str: + return self._name_template.format(self.base.name) + + def get_value( + self, + globals: dict[str, Any], + locals: dict[str, Any], + cache: weakref.WeakKeyDictionary[Source, Any], + ) -> Any: + if self in cache: + return cache[self] + tmpvar = "tmp" + counter = 0 + while tmpvar in locals: + tmpvar = f"tmp{counter}" + counter += 1 + locals[tmpvar] = self.base.get_value(globals, locals, cache) + value = eval(self._name_template.format(tmpvar), globals, locals) + del locals[tmpvar] + cache[self] = value + return value + + +def detect_fake_mode(inputs: Any = None) -> FakeTensorMode | None: + """ + Attempts to "detect" what the current fake mode is. If there is one ambiently + available from TracingContext, we preferentially use that. Otherwise, we + heuristically detect the fake mode via the following sources, in order of + priority: + + - Currently active fake mode on stack + - Fake mode associated with passed in tensors (inputs does not + have to be flattened) + """ + from torch._subclasses.fake_tensor import ( + FakeTensor, + FakeTensorMode, + get_plain_tensors, + ) + + fake_modes = [] + + if context := TracingContext.try_get(): + fake_mode = context.fake_mode + if fake_mode is not None: + fake_modes.append((fake_mode, "tracing context", 0)) + + from torch.utils._python_dispatch import _get_current_dispatch_mode_stack + + for i, m in enumerate(reversed(_get_current_dispatch_mode_stack())): + if isinstance(m, FakeTensorMode): + # pyrefly: ignore [bad-argument-type] + fake_modes.append((m, "active fake mode", i)) + + flat_inputs = pytree.tree_leaves(inputs) + for i, flat_input in enumerate(flat_inputs): + if isinstance(flat_input, FakeTensor): + # pyrefly: ignore [bad-argument-type] + fake_modes.append((flat_input.fake_mode, "fake tensor input", i)) + if is_traceable_wrapper_subclass(flat_input): + out: list[torch.Tensor | int | torch.SymInt] = [] + get_plain_tensors(flat_input, out=out) # type: ignore[arg-type] + fake_tensors: list[FakeTensor] = [ + x for x in out if isinstance(x, FakeTensor) + ] + fake_modes.extend( + # pyrefly: ignore [bad-argument-type] + [ + (tensor.fake_mode, f"subclass input {i}", ix) + for ix, tensor in enumerate(fake_tensors) + ] + ) + + if fake_modes: + fake_mode, desc1, i1 = fake_modes[0] + for m, desc2, i2 in fake_modes[1:]: + assert fake_mode is m, ( + f"fake mode ({fake_mode}) from {desc1} {i1} doesn't match mode ({m}) from {desc2} {i2}\n\n" + # pyrefly: ignore [missing-attribute] + f"fake mode from {desc1} {i1} allocated at:\n{fake_mode.stack}\n" + # pyrefly: ignore [missing-attribute] + f"fake mode from {desc2} {i2} allocated at:\n{m.stack}" + ) + # pyrefly: ignore [bad-return] + return fake_mode + else: + return None + + +def active_fake_mode() -> FakeTensorMode | None: + """ + Inspects the dispatch mode stack for an active fake mode and returns it. + Returns None if no fake mode is active. + """ + from torch._subclasses.fake_tensor import FakeTensorMode + from torch.utils._python_dispatch import _get_current_dispatch_mode_stack + + for _, m in enumerate(reversed(_get_current_dispatch_mode_stack())): + if isinstance(m, FakeTensorMode): + return m + + return None diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_jit_internal.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_jit_internal.py new file mode 100644 index 0000000000000000000000000000000000000000..d62b9181eddc0d6be2c81624f3faead508259c59 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_jit_internal.py @@ -0,0 +1,1550 @@ +# mypy: allow-untyped-defs +""" +The weak_script annotation needs to be here instead of inside torch/jit/ so it +can be used in other places in torch/ (namely torch.nn) without running into +circular dependency problems +""" + +import ast +import builtins +import collections +import contextlib +import enum +import inspect +import io +import pickle +import sys +import textwrap +import threading +import types +import typing +import warnings +import weakref +from typing import ( # noqa: UP035, F401 # (Dict, List, Tuple) imported by torch.jit.annotations + Any, + Callable, + Dict, + Final, + ForwardRef, + get_args, + get_origin, + List, + Optional, + Tuple, + TypeVar, + Union, +) +from typing_extensions import ParamSpec + +import torch + +# This is needed. `torch._jit_internal` is imported before `torch.distributed.__init__`. +# Explicitly ask to import `torch.distributed.__init__` first. +# Otherwise, "AttributeError: module 'torch' has no attribute 'distributed'" is raised. +import torch.distributed.rpc +import torch.package._mangling as package_mangling +from torch._awaits import _Await +from torch._C import _Await as CAwait, Future as CFuture +from torch._sources import fake_range, get_source_lines_and_file, parse_def +from torch.futures import Future + + +_P = ParamSpec("_P") +_R = TypeVar("_R") + +BuiltinUnionType: type | tuple[type, ...] = types.UnionType + +LockType: type +try: + import _thread + + LockType = _thread.LockType +except ImportError: + import _dummy_thread # type: ignore[import-not-found] + + LockType = _dummy_thread.LockType + +# Wrapper functions that can call either of 2 functions depending on a boolean +# argument +boolean_dispatched: "weakref.WeakKeyDictionary[Callable, dict[str, Callable]]" = ( + weakref.WeakKeyDictionary() +) # noqa: T484 + + +FAKE_FILENAME_PREFIX = "__torch_jit_dataclass" + + +def is_final(ann) -> bool: + return ( + hasattr(ann, "__module__") + and ann.__module__ in {"typing", "typing_extensions"} + and (get_origin(ann) is Final or isinstance(ann, type(Final))) + ) + + +# allows BroadcastingList instance to be subscriptable +class BroadcastingListCls: + def __getitem__(self, types): + return + + +# mypy doesn't support parameters on types, so we have to explicitly type each +# list size +BroadcastingList1 = BroadcastingListCls() +for i in range(2, 7): + globals()[f"BroadcastingList{i}"] = BroadcastingList1 + + +def is_scripting() -> bool: + r""" + Function that returns True when in compilation and False otherwise. This + is useful especially with the @unused decorator to leave code in your + model that is not yet TorchScript compatible. + .. testcode:: + + import torch + + @torch.jit.unused + def unsupported_linear_op(x): + return x + + def linear(x): + if torch.jit.is_scripting(): + return torch.linear(x) + else: + return unsupported_linear_op(x) + """ + return False + + +# Retrieves a fully-qualified name (module hierarchy + classname) for a given obj. +def _qualified_name(obj, mangle_name=True) -> str: + # This special case allows us to override the qualified name on a type. + # It's currently used in conjunction with tracing, where we create a + # fake module to filter only supported attributes. However, since this + # new type is defined as a local class, we need a mechanism to override + # its qualname so it appears correctly in the TorchScript system. This, + # we set '_jit_override_qualname' with the original traced module's + # qualified name, which is picked up here + if hasattr(obj, "_jit_override_qualname"): + return obj._jit_override_qualname + # short-circuit in cases where the object already has a known qualified name + if isinstance(obj, torch._C.ScriptFunction): + return obj.qualified_name + + if getattr(obj, "__name__", None): + name = obj.__name__ + # Enum classes do not have `__name__` attr, instead they have `name`. + elif isinstance(obj, enum.Enum): + name = obj.name + else: + raise RuntimeError("Could not get name of python class object") + + if name == "": + name = "_lambda" # make name a valid identifier + + module_name = obj.__module__ + + # If the module is actually a torchbind module, then we should short circuit + if module_name == "torch._classes": + return obj.qualified_name # pyrefly: ignore [missing-attribute] + + # The Python docs are very clear that `__module__` can be None, but I can't + # figure out when it actually would be. + if module_name is None: + raise RuntimeError( + f"Could not get qualified name for class '{name}': " + "__module__ can't be None." + ) + + # if getattr(sys.modules[module_name], name) is not obj: + # raise RuntimeError(f"Could not get qualified name for class '{name}': " + # f"the attr {name} on module {module_name} is not the class") + + # torch.package and TorchScript have separate mangling schemes to avoid + # name collisions from multiple packages. To avoid them interfering with + # each other, normalize the package managing here. + if package_mangling.is_mangled(module_name): + module_name = module_name.replace("<", "_") + module_name = module_name.replace(">", "_") + + # The PythonExceptionValue C++ class in torch/csrc/jit/python/python_sugared_value.h + # does not need mangle the python class name. + if mangle_name: + # __main__ is a builtin module, so rewrite it to "__torch__". + if module_name == "__main__": + module_name = "__torch__" + else: + # Everything else gets a "__torch__" prefix to avoid name collisions + # with the names of user values. + module_name = "__torch__." + module_name + + if "." in name: + raise RuntimeError( + f"Could not get qualified name for class '{name}': " + f"'{name}' is not a valid identifier" + ) + + return module_name + "." + name + + +class SourceLoader: + def __init__(self): + self.content = {} + + def cache(self, fn, source): + self.content[fn] = source + + def get_source(self, fn): + return self.content.get(fn) + + +loader = SourceLoader() + + +def createResolutionCallbackFromEnv(lookup_base): + """ + Creates a resolution callback that will look up qualified names in an + environment, starting with `lookup_base` for the base of any qualified + names, then proceeding down the lookup chain with the resolved object. + + You should not use this directly, it should only be used from the other + createResolutionCallbackFrom* functions. + """ + + def lookupInModule(qualified_name, module): + if "." in qualified_name: + base, remaining_pieces = qualified_name.split(".", maxsplit=1) + module_value = getattr(module, base) + return lookupInModule(remaining_pieces, module_value) + else: + return getattr(module, qualified_name) + + def parseNestedExpr(expr, module) -> tuple[Any, int]: + i = 0 + while i < len(expr) and expr[i] not in (",", "[", "]"): + i += 1 + + # Special case logic for the empty Tuple as a subscript (used + # in the type annotation `Tuple[()]`) + if expr[:i] == "()": + return (), i + + base = lookupInModule(expr[:i].strip(), module) + assert base is not None, f"Unresolvable type {expr[:i]}" + if i == len(expr) or expr[i] != "[": + return base, i + + assert expr[i] == "[" + parts = [] + while expr[i] != "]": + part_len = 0 + i += 1 + part, part_len = parseNestedExpr(expr[i:], module) + parts.append(part) + i += part_len + if len(parts) > 1: + return base[tuple(parts)], i + 1 + else: + return base[parts[0]], i + 1 + + def parseExpr(expr, module): + try: + value, len_parsed = parseNestedExpr(expr, module) + assert len_parsed == len(expr), ( + "whole expression was not parsed, falling back to c++ parser" + ) + return value + except Exception: + """ + The python resolver fails in several cases in known unit tests, and is intended + to fall back gracefully to the c++ resolver in general. For example, python 2 style + annotations which are frequent in our unit tests often fail with types e.g. int not + resolvable from the calling frame. + """ + return None + + return lambda expr: parseExpr(expr, lookup_base) + + +def createResolutionCallbackFromFrame(frames_up: int = 0): + """ + Creates a function which, given a string variable name, + returns the value of the variable in the scope of the caller of + the function which called createResolutionCallbackFromFrame (by default). + + This is used to enable access in-scope Python variables inside + TorchScript fragments. + + frames_up is number of additional frames to go up on the stack. + The default value is 0, which correspond to the frame of the caller + of createResolutionCallbackFromFrame. Also for example, if frames_up is set + to 1, then the frame of the caller's caller of createResolutionCallbackFromFrame + will be taken. + + For example, the following program prints 2:: + + def bar(): + cb = createResolutionCallbackFromFrame(1) + print(cb("foo")) + + + def baz(): + foo = 2 + bar() + + + baz() + """ + frame = inspect.currentframe() + i = 0 + while i < frames_up + 1: + assert frame is not None + frame = frame.f_back + i += 1 + + assert frame is not None + f_locals = frame.f_locals + f_globals = frame.f_globals + + class env: + def __getattr__(self, key): + if key in f_locals: + return f_locals[key] + elif key in f_globals: + return f_globals[key] + elif key in dir(builtins): + return getattr(builtins, key) + + return createResolutionCallbackFromEnv(env()) + + +def get_closure(fn): + """ + Get a dictionary of closed over variables from a function + """ + captures = {} + captures.update(fn.__globals__) + + for index, captured_name in enumerate(fn.__code__.co_freevars): + captures[captured_name] = fn.__closure__[index].cell_contents + + return captures + + +# [local resolution in python] +# Depending on where a variable is defined, and where it is used, we may +# or may not be able to recover its value when recursively compiling a +# script function. Remember in the general case, a module or function is +# first defined and then later scripted. This means we do not have a +# chance to capture the active frames when the function is defined. Hence any +# name resolution has to happen later on the created closure. The way +# python captures type annotations restricts what we can recover. The +# follow example illustrates the different cases: +# +# class MyGlobalClass: +# ... +# def my_local_scope(): +# @torch.jit.script +# class MyClass: +# ... +# @torch.jit.script +# class MyClassUsedAsVar: +# ... +# def eg(x: MyClass, y: MyGlobalClass): +# a_local_capture : Foo +# return MyClassUsedAsVar(x) +# +# MyGlobalClass is defined in the __globals__ dictionary of function +# 'eg', so it is always recoverable. my_local_scope introduces a new local +# variable scope in the function. Classes defined here are only visible as +# local variables. For the case of MyClassUsedAsVar, it is captured +# because it is used as a variable inside the body of the function, and we +# can resolve it using the captures returned from `get_closure`. However, +# the type annotations are not captured by the closure. In Python +# 3.0--3.9, the _value_ of MyClass and MyGlobalClass will be available as +# annotations on `eg``, but starting in Python 4.0, they will represented as +# strings and no longer present. Furthermore, since the body of `eg` does +# not reference those names, they do not appear in the list of closed over +# variables. In Python 2.x, type annotations are in comments, leading to a +# similar situation where their definitions are not available. We anticipate +# that most users will not run into this issue because their modules and +# functions will be defined at a global scope like MyGlobalClass. In cases +# where they are not, it is possible to work around issues by declaring the +# values global in the function. +# In Python 3.9 declaring class as global will make it invisible to +# `inspect.getsource`, see https://bugs.python.org/issue42666 . +# This could be worked around by manually adding it to `global()` dictionary. + + +def createResolutionCallbackFromClosure(fn): + """ + Create a resolutionCallback by introspecting the function instead of + looking up the stack for the enclosing scope + """ + closure = get_closure(fn) + + class closure_lookup: + # This is a class since `closure` is a dict and it's easier in + # `env_helper` if everything just works with `getattr` calls + def __getattr__(self, key): + if key in closure: + return closure[key] + elif hasattr(typing, key): + return getattr(typing, key) + elif hasattr(builtins, key): + return getattr(builtins, key) + return None + + return createResolutionCallbackFromEnv(closure_lookup()) + + +def can_compile_class(cls) -> bool: + # If any of the functions on a type don't have a code object, this type can't + # be compiled and is probably a builtin / bound from C + if is_ignored_fn(cls): + return False + + # Ignore the following list of built-in classes. + ignored_builtin_classes = (torch.nn.Module, tuple, list, Exception) + if issubclass(cls, ignored_builtin_classes): + return False + + names = cls.__dict__ + fns = [ + getattr(cls, name) + for name in names + if inspect.isroutine(getattr(cls, name, None)) + ] + has_code = [hasattr(fn, "__code__") for fn in fns] + return all(has_code) + + +def get_callable_argument_names(fn) -> list[str]: + """ + Gets names of all POSITIONAL_OR_KEYWORD arguments for callable `fn`. + Returns an empty list when other types of arguments are present. + + This is used by `torch.jit.trace` to assign meaningful argument names to + traced functions and modules. + + Args: + fn: A callable. + Returns: + Argument names: List[str] + """ + # inspect.signature may fail, give up in that case. + try: + callable_signature = inspect.signature(fn) + except Exception: + return [] + + argument_names = [] + for name, param in callable_signature.parameters.items(): + # All four other types of arguments do not map to individual values + # with a keyword as name. + if param.kind != param.POSITIONAL_OR_KEYWORD: + continue + + argument_names.append(name) + + return argument_names + + +def get_annotation_str(annotation): + """ + Convert an AST node containing a type annotation to the string present in the source + that represents the same annotation. + """ + if isinstance(annotation, ast.Name): + return annotation.id + elif isinstance(annotation, ast.Attribute): + return ".".join([get_annotation_str(annotation.value), annotation.attr]) + elif isinstance(annotation, ast.Subscript): + # In Python3.9+ subscript indices are not wrapped in ast.Index + subscript_slice = annotation.slice + return f"{get_annotation_str(annotation.value)}[{get_annotation_str(subscript_slice)}]" + elif isinstance(annotation, ast.Tuple): + return ",".join([get_annotation_str(elt) for elt in annotation.elts]) + elif isinstance(annotation, ast.Constant): + return f"{annotation.value}" + + # If an AST node is not handled here, it's probably handled in ScriptTypeParser. + return None + + +def get_type_hint_captures(fn): + """ + Get a dictionary containing type resolution mappings necessary to resolve types + for the literal annotations on 'fn'. These are not considered to be closed-over by fn + and must be obtained separately (e.g. using this function). + + Args: + fn: A callable. + Returns: + A Dict[str, Any] containing a mapping from the literal annotations used on + fn to the Python objects they refer to. + """ + # First, try to get the source of the function. We'll need to parse it to find the actual string names + # that were used to annotate the types, since inspect.signature() will only return the class object that + # the annotation refers to, not the string name. If we can't get the source, simply return an empty dict. + # This may happen in cases where the function is synthesized dynamically at runtime. + src = loader.get_source(fn) + if src is None: + try: + src = inspect.getsource(fn) + except OSError as e: + raise OSError( + f"Failed to get source for {fn} using inspect.getsource" + ) from e + + # Gather a dictionary of parameter name -> type, skipping any parameters whose annotated + # types are strings. These are only understood by TorchScript in the context of a type annotation + # that refers to a class in its own definition, but trying to include a mapping for this in the result + # function would cause infinite recursion because the class is currently being compiled. + # In addition, there is logic in ScriptTypeParser to handle this. + signature = inspect.signature(fn) + name_to_type = { + name: parameter.annotation + for name, parameter in signature.parameters.items() + if parameter.annotation is not inspect.Parameter.empty + and not isinstance(parameter.annotation, str) + } + + # Then, get the literal type annotations from the function declaration + # by source inspection. This accounts for the case in which aliases are used + # to annotate the arguments (e.g device_t = torch.device, and then d: device_t). + # frontend.py cannot be used here because it includes _jit_internal, so use ast instead. + a = ast.parse(textwrap.dedent(src)) + if len(a.body) != 1 or not isinstance(a.body[0], ast.FunctionDef): + raise RuntimeError(f"Expected {fn} to be a function") + f = a.body[0] + + # Prepare a dictionary of source annotation -> type, which will be the final result of this function, + # by using the parsed AST (f) to reconstruct source annotations as strings for each parameter and mapping + # them to the type object corresponding to the annotation via name_to_type using the parameter name. + annotation_to_type = {} + + for arg in f.args.args: + # Get the source type annotation string for this argument if possible. + arg_annotation_str = ( + get_annotation_str(arg.annotation) if arg.annotation else None + ) + + # If the argument has no annotation or get_annotation_str cannot convert it to a string, + # arg_annotation_str will be None. Skip this arg; ScriptTypeParser will probably handle + # this in the latter case. + if arg_annotation_str is None: + continue + + # Insert {arg_annotation_str: type} into annotation_to_type if possible. One reason arg_name may not + # be present in name_to_type is that the annotation itself is a string and not a type object + # (common for self-refential annotations in classes). Once again, let ScriptTypeParser handle this. + arg_name = arg.arg + if arg_name in name_to_type: + annotation_to_type[arg_annotation_str] = name_to_type[arg_name] + + # If there is a valid return annotation, include it in annotation_to_type. As with argument annotations, + # the literal annotation has to be convertible to a string by get_annotation_str, and the actual type + # of the annotation cannot be a string. + literal_return_annotation = get_annotation_str(f.returns) + valid_literal_annotation = literal_return_annotation is not None + return_annotation = signature.return_annotation + valid_return_annotation_type = ( + return_annotation is not inspect.Parameter.empty + and not isinstance(return_annotation, str) + ) + if valid_literal_annotation and valid_return_annotation_type: + annotation_to_type[literal_return_annotation] = return_annotation + + return annotation_to_type + + +def createResolutionCallbackForClassMethods(cls): + """ + This looks at all the methods defined in a class and pulls their closed-over + variables into a dictionary and uses that to resolve variables. + """ + # cls is a type here, so `ismethod` is false since the methods on the type + # aren't bound to anything, so Python treats them as regular functions + fns = [ + getattr(cls, name) + for name in cls.__dict__ + if inspect.isroutine(getattr(cls, name)) + ] + # Skip built-ins, as they do not have global scope nor type hints + # Needed to support `enum.Enum` derived classes in Python-3.11 + # That adds `_new_member_` property which is an alias to `__new__` + fns = [fn for fn in fns if not inspect.isbuiltin(fn) and hasattr(fn, "__globals__")] + captures = {} + + for fn in fns: + captures.update(get_closure(fn)) + captures.update(get_type_hint_captures(fn)) + + def lookup_in_class(key): + if key in captures: + return captures[key] + else: + return getattr(builtins, key, None) + + return lookup_in_class + + +def boolean_dispatch( + arg_name, + arg_index, + default, + if_true, + if_false, + module_name, + func_name, +): + """ + Dispatches to either of 2 script functions based on a boolean argument. + In TorchScript, the boolean argument must be constant so that the correct + function to use can be determined at compile time. + """ + + def fn(*args, **kwargs): + dispatch_flag = default + if arg_name in kwargs: + dispatch_flag = kwargs[arg_name] + elif arg_index < len(args): + dispatch_flag = args[arg_index] + + if dispatch_flag: + return if_true(*args, **kwargs) + else: + return if_false(*args, **kwargs) + + if if_true.__doc__ is None and if_false.__doc__ is not None: + doc = if_false.__doc__ + if_true.__doc__ = doc + elif if_false.__doc__ is None and if_true.__doc__ is not None: + doc = if_true.__doc__ + if_false.__doc__ = doc + elif if_false.__doc__ is None and if_true.__doc__ is None: + # neither function has a docstring + doc = None + else: + raise RuntimeError("only one function can have a docstring") + fn.__doc__ = doc + + if module_name is not None: + fn.__module__ = module_name + if func_name is not None: + fn.__name__ = func_name + + boolean_dispatched[fn] = { + "if_true": if_true, + "if_false": if_false, + "index": arg_index, + "default": default, + "arg_name": arg_name, + } + return fn + + +class FunctionModifiers: + """ + Used to denote the behavior of a function in TorchScript. See export() and + ignore() for details. + """ + + UNUSED = "unused (ignored and replaced with raising of an exception)" + IGNORE = "ignore (leave as a call to Python, cannot be torch.jit.save'd)" + EXPORT = "export (compile this function even if nothing calls it)" + DEFAULT = "default (compile if called from a exported function / forward)" + COPY_TO_SCRIPT_WRAPPER = ( + "if this method is not scripted, copy the python method onto the scripted model" + ) + _DROP = "_drop (function is fully ignored, declaration can be unscriptable)" + + +def export(fn: Callable[_P, _R]) -> Callable[_P, _R]: + """ + This decorator indicates that a method on an ``nn.Module`` is used as an entry point into a + :class:`ScriptModule` and should be compiled. + + ``forward`` implicitly is assumed to be an entry point, so it does not need this decorator. + Functions and methods called from ``forward`` are compiled as they are seen + by the compiler, so they do not need this decorator either. + + Example (using ``@torch.jit.export`` on a method): + + .. testcode:: + + import torch + import torch.nn as nn + + class MyModule(nn.Module): + def implicitly_compiled_method(self, x): + return x + 99 + + # `forward` is implicitly decorated with `@torch.jit.export`, + # so adding it here would have no effect + def forward(self, x): + return x + 10 + + @torch.jit.export + def another_forward(self, x): + # When the compiler sees this call, it will compile + # `implicitly_compiled_method` + return self.implicitly_compiled_method(x) + + def unused_method(self, x): + return x - 20 + + # `m` will contain compiled methods: + # `forward` + # `another_forward` + # `implicitly_compiled_method` + # `unused_method` will not be compiled since it was not called from + # any compiled methods and wasn't decorated with `@torch.jit.export` + m = torch.jit.script(MyModule()) + """ + fn._torchscript_modifier = FunctionModifiers.EXPORT # type:ignore[attr-defined] + return fn + + +def unused(fn: Callable[_P, _R]) -> Callable[_P, _R]: + """ + This decorator indicates to the compiler that a function or method should + be ignored and replaced with the raising of an exception. This allows you + to leave code in your model that is not yet TorchScript compatible and still + export your model. + + Example (using ``@torch.jit.unused`` on a method):: + + import torch + import torch.nn as nn + + + class MyModule(nn.Module): + def __init__(self, use_memory_efficient): + super().__init__() + self.use_memory_efficient = use_memory_efficient + + @torch.jit.unused + def memory_efficient(self, x): + import pdb + + pdb.set_trace() + return x + 10 + + def forward(self, x): + # Use not-yet-scriptable memory efficient mode + if self.use_memory_efficient: + return self.memory_efficient(x) + else: + return x + 10 + + + m = torch.jit.script(MyModule(use_memory_efficient=False)) + m.save("m.pt") + + m = torch.jit.script(MyModule(use_memory_efficient=True)) + # exception raised + m(torch.rand(100)) + """ + if isinstance(fn, property): + prop = fn + setattr( # noqa: B010 + prop.fget, "_torchscript_modifier", FunctionModifiers.UNUSED + ) + + if prop.fset: + setattr( # noqa: B010 + prop.fset, "_torchscript_modifier", FunctionModifiers.UNUSED + ) + + return prop # pyrefly: ignore [bad-return] + + fn._torchscript_modifier = FunctionModifiers.UNUSED # type: ignore[attr-defined] + return fn + + +# No op context manager from python side +class _IgnoreContextManager(contextlib.AbstractContextManager): + def __init__(self, **kwargs): + pass + + def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: + pass + + +def ignore(drop=False, **kwargs): + """ + This decorator indicates to the compiler that a function or method should + be ignored and left as a Python function. This allows you to leave code in + your model that is not yet TorchScript compatible. If called from TorchScript, + ignored functions will dispatch the call to the Python interpreter. Models with ignored + functions cannot be exported; use :func:`@torch.jit.unused ` instead. + + Example (using ``@torch.jit.ignore`` on a method):: + + import torch + import torch.nn as nn + + + class MyModule(nn.Module): + @torch.jit.ignore + def debugger(self, x): + import pdb + + pdb.set_trace() + + def forward(self, x): + x += 10 + # The compiler would normally try to compile `debugger`, + # but since it is `@ignore`d, it will be left as a call + # to Python + self.debugger(x) + return x + + + m = torch.jit.script(MyModule()) + + # Error! The call `debugger` cannot be saved since it calls into Python + m.save("m.pt") + + Example (using ``@torch.jit.ignore(drop=True)`` on a method): + + .. testcode:: + + import torch + import torch.nn as nn + + class MyModule(nn.Module): + @torch.jit.ignore(drop=True) + def training_method(self, x): + import pdb + pdb.set_trace() + + def forward(self, x): + if self.training: + self.training_method(x) + return x + + m = torch.jit.script(MyModule()) + + # This is OK since `training_method` is not saved, the call is replaced + # with a `raise`. + m.save("m.pt") + + .. testcleanup:: + + import os + os.remove('m.pt') + """ + + if callable(drop): + # used without any args, so drop is actually a function + # @torch.jit.ignore + # def fn(...): + fn = drop + # pyrefly: ignore [missing-attribute] + fn._torchscript_modifier = FunctionModifiers.IGNORE + return fn + + if not isinstance(drop, bool): + raise RuntimeError( + f"Argument to @torch.jit.ignore must be a bool or a function but got {drop}" + ) + + # for backwards compat + drop_on_export = kwargs.pop("drop_on_export", None) + if drop_on_export: + warnings.warn( + "ignore(drop_on_export=True) has been deprecated. TorchScript will now drop the function " + "call on compilation. Use torch.jit.unused now. {}", + stacklevel=2, + category=FutureWarning, + ) + + drop = drop_on_export + elif drop: + warnings.warn( + "ignore(True) has been deprecated. TorchScript will now drop the function " + "call on compilation. Use torch.jit.unused now. {}", + stacklevel=2, + category=FutureWarning, + ) + + def decorator(fn): + if drop: + fn._torchscript_modifier = FunctionModifiers.UNUSED + else: + fn._torchscript_modifier = FunctionModifiers.IGNORE + return fn + + return decorator + + +def _drop(fn: Callable[_P, _R]) -> Callable[_P, _R]: + fn._torchscript_modifier = FunctionModifiers._DROP # type: ignore[attr-defined] + return fn + + +def _copy_to_script_wrapper(fn: Callable[_P, _R]) -> Callable[_P, _R]: + fn._torchscript_modifier = FunctionModifiers.COPY_TO_SCRIPT_WRAPPER # type: ignore[attr-defined] + return fn + + +def module_has_exports(mod): + for name in dir(mod): + if hasattr(mod, name): + item = getattr(mod, name) + if callable(item): + if get_torchscript_modifier(item) is FunctionModifiers.EXPORT: + return True + return False + + +# WARNING: should_drop is currently being used by our JIT code coverage plug-in to mark JIT'd code as covered. If you +# rename this function, please update references in tools/coverage_plugins_package/src/coverage_plugins/jit_plugin.py to +# allow JIT'd code to still be covered. +def should_drop(fn) -> bool: + attr = get_torchscript_modifier(fn) + if attr is None: + return False + return attr is FunctionModifiers.UNUSED or attr is FunctionModifiers._DROP + + +def is_ignored_fn(fn) -> bool: + mod = get_torchscript_modifier(fn) + return ( + mod is FunctionModifiers.UNUSED + or mod is FunctionModifiers.IGNORE + or mod is FunctionModifiers._DROP + ) + + +def _is_drop_fn(fn) -> bool: + mod = get_torchscript_modifier(fn) + return mod is FunctionModifiers._DROP + + +def is_static_fn(cls, fn) -> bool: + return isinstance(inspect.getattr_static(cls, fn, default=None), staticmethod) + + +def get_static_fn(cls, fn): + return inspect.getattr_static(cls, fn).__func__ + + +def get_torchscript_modifier(fn): + if not callable(fn): + return None + if hasattr(fn, "__func__"): + fn = fn.__func__ + return getattr(fn, "_torchscript_modifier", FunctionModifiers.DEFAULT) + + +def copy_torchscript_modifier(orig, new) -> None: + attr = get_torchscript_modifier(orig) + if attr is None: + return + new._torchscript_modifier = attr + + +# overloading registration +# overloads get registered in this file, and compiled in torch/jit/__init__.py +# so that they can be imported in nn/functional.py without an import cycle + +# qualified_name => list[overload_functions] +_overloaded_fns: dict[str, list[Callable]] = {} # noqa: T484 + + +_OVERLOAD_EXAMPLE = """ +Example usage of overload function: +@torch.jit._overload +def my_function(x: type0) -> type0: # decl 1 + pass + +@torch.jit._overload +def my_function(x: type1) -> type1: # decl 2 + pass + +def my_function(x): # implementation + if isinstance(x, type0): + return x + elif isinstance(x, type1): + return x +""" + + +def get_overload_no_implementation_error_message(kind, obj): + sourcelines, file_lineno, filename = get_source_lines_and_file(obj) + return ( + f'Implementation for the {kind} "{_qualified_name(obj)}" is missing. Please make ' + f"sure a definition is provided and defined after all overload declarations.\n" + f'File "{filename}", line {file_lineno}:\n' + + "".join(sourcelines) + + "\n" + + _OVERLOAD_EXAMPLE + ) + + +def _check_overload_body(func): + try: + parsed_def = parse_def(func) + except OSError: + # Parsing the function definition can raise an OSError if source is unavailable. + # Since this is just an initial check, just raise a warning if this is the case. + warnings.warn( + f"Unable to retrieve source for @torch.jit._overload function: {func}.", + stacklevel=2, + ) + return + + body = parsed_def.ast.body[0].body + + def is_pass(x): + return isinstance(x, ast.Pass) + + def is_ellipsis(x): + return ( + isinstance(x, ast.Expr) + and isinstance(x.value, ast.Constant) + and x.value.value is Ellipsis + ) + + if len(body) != 1 or not (is_pass(body[0]) or is_ellipsis(body[0])): + msg = ( + "Only `pass` statement or `...` can be the body of overload declaration:\n" + ) + msg += "\n".join(parsed_def.source.split("\n")[:3]) + msg += " <- Expecting `pass` or `...` here!\n" + _OVERLOAD_EXAMPLE + raise RuntimeError(msg) + + +def _overload(func): + _check_overload_body(func) + qual_name = _qualified_name(func) + global _overloaded_fns + fn_overload_list = _overloaded_fns.get(qual_name) + if fn_overload_list is None: + fn_overload_list = [] + _overloaded_fns[qual_name] = fn_overload_list + fn_overload_list.append(func) + return func + + +def _get_fn_overloads(qual_name): + return _overloaded_fns.get(qual_name) + + +def _clear_fn_overloads(qual_name) -> None: + del _overloaded_fns[qual_name] + + +def get_class_name_lineno(method) -> tuple[str, int]: + current_frame = inspect.currentframe() + + # one for the get_class_name call, one for _overload_method call + for _ in range(2): + assert ( + current_frame is not None + ) # assert current frame is not an Optional[FrameType] + current_frame = current_frame.f_back + + assert current_frame is not None # same here + class_name = current_frame.f_code.co_name + line_no = current_frame.f_code.co_firstlineno + return class_name, line_no + + +# At the point the decorator is applied to class methods the method +# has no reference to its owning class. _qualified_name would not include +# the class it is defined in, so any methods with the same name in the same file +# would have the same _qualified_name, even if they were defined in different +# classes. This problem only exists in python 2. +# We get around this problem by looking at the stack frame and identifying +# the class name, and throwing an error whenever overloads are used +# when modules of the same name are in the same file + +# qualified_name => class name => list[overload_functions] +_overloaded_methods: dict[str, dict[str, list[Callable]]] = {} # noqa: T484 + + +# (qualified_name, class name) => class_fileno +_overloaded_method_class_fileno: dict[tuple[str, str], int] = {} + + +def _overload_method(func): + _check_overload_body(func) + qual_name = _qualified_name(func) + global _overloaded_methods + class_name_map = _overloaded_methods.get(qual_name) + if class_name_map is None: + class_name_map = {} + _overloaded_methods[qual_name] = class_name_map + + class_name, line_no = get_class_name_lineno(func) + method_overloads = class_name_map.get(class_name) + if method_overloads is None: + method_overloads = [] + class_name_map[class_name] = method_overloads + _overloaded_method_class_fileno[(qual_name, class_name)] = line_no + else: + existing_lineno = _overloaded_method_class_fileno[(qual_name, class_name)] + if existing_lineno != line_no: + raise RuntimeError( + "Cannot currently overload the same method name in two different" + " classes with the same name in the same module" + ) + + method_overloads.append(func) + return func + + +def _get_overloaded_methods(method, mod_class): + # TODO: __name__ not set for submodules in recursive script + if not hasattr(method, "__name__"): + return None + qual_name = _qualified_name(method) + class_name_map = _overloaded_methods.get(qual_name) + if class_name_map is None: + return None + overloads = class_name_map.get(mod_class.__name__, None) + if overloads is None: + return None + + method_line_no = get_source_lines_and_file(method)[1] + mod_class_fileno = get_source_lines_and_file(mod_class)[1] + mod_end_fileno = mod_class_fileno + len(get_source_lines_and_file(mod_class)[0]) + if not (method_line_no >= mod_class_fileno and method_line_no <= mod_end_fileno): + raise AssertionError( + "Overloads are not usable when a module is redeclared within the same file: " + + str(method) + ) + return overloads + + +def is_tuple(ann) -> bool: + # Check for typing.Tuple missing args (but `tuple` is fine) + if ann is typing.Tuple: # noqa: UP006 + raise_error_container_parameter_missing("Tuple") + + # For some reason Python 3.7 violates the Type[A, B].__origin__ == Type rule + if not hasattr(ann, "__module__"): + return False + + ann_origin = get_origin(ann) + return ann.__module__ in ("builtins", "typing") and ann_origin is tuple + + +def is_list(ann) -> bool: + # Check for typing.List missing args (but `list` is fine) + if ann is typing.List: # noqa: UP006 + raise_error_container_parameter_missing("List") + + if not hasattr(ann, "__module__"): + return False + + ann_origin = get_origin(ann) + return ann.__module__ in ("builtins", "typing") and ann_origin is list + + +def is_dict(ann) -> bool: + # Check for typing.Dict missing args (but `dict` is fine) + if ann is typing.Dict: # noqa: UP006 + raise_error_container_parameter_missing("Dict") + + if not hasattr(ann, "__module__"): + return False + + ann_origin = get_origin(ann) + return ann.__module__ in ("builtins", "typing") and ann_origin is dict + + +def is_union(ann): + if ann is Union: + raise_error_container_parameter_missing("Union") + + return isinstance(ann, BuiltinUnionType) or ( + hasattr(ann, "__module__") + and ann.__module__ == "typing" + and (get_origin(ann) is Union) + ) + + +def is_optional(ann): + if ann is Optional: + raise_error_container_parameter_missing("Optional") + + def is_optional_as_optional(ann): + return ( + hasattr(ann, "__module__") + and ann.__module__ == "typing" + and (get_origin(ann) is Optional) + ) + + def is_union_as_optional(ann): + ann_args = get_args(ann) + return len(ann_args) == 2 and (None in ann_args or type(None) in ann_args) + + return is_optional_as_optional(ann) or (is_union(ann) and is_union_as_optional(ann)) + + +def is_future(ann) -> bool: + if ann is Future: + raise RuntimeError( + "Attempted to use Future without a " + "contained type. Please add a contained type, e.g. " + "Future[int]" + ) + return get_origin(ann) is Future + + +def is_await(ann) -> bool: + if ann is _Await: + return True + return get_origin(ann) is _Await + + +if torch.distributed.rpc.is_available(): + from torch._C._distributed_rpc import PyRRef + from torch.distributed.rpc import RRef + + def is_rref(ann) -> bool: + if ann is RRef: + raise RuntimeError( + "Attempted to use RRef without a " + "contained type. Please add a contained type, e.g. " + "RRef[int]" + ) + return get_origin(ann) is RRef + + def is_rref_instance(obj) -> bool: + return isinstance(obj, PyRRef) + +else: + + def is_rref_instance(obj) -> bool: + # If the RPC module doesn't exist then RRefs don't exist either. + return False + + +def _try_get_dispatched_fn(fn): + if not callable(fn): + return None + return boolean_dispatched.get(fn) + + +def _get_named_tuple_properties( + obj, + loc: torch._C._jit_tree_views.SourceRange | None = None, + rcb=None, +): + if loc is None: + loc = fake_range() + + assert issubclass(obj, tuple) and hasattr(obj, "_fields") + if hasattr(obj, "_field_defaults"): + defaults = [ + obj._field_defaults[field] + for field in obj._fields + if field in obj._field_defaults + ] + else: + defaults = [] + + obj_annotations = inspect.get_annotations(obj) + if len(obj_annotations) == 0 and hasattr(obj, "__base__"): + obj_annotations = inspect.get_annotations( + # pyrefly: ignore [bad-argument-type] + obj.__base__ + ) + + annotations = [] + for field in obj._fields: + if field in obj_annotations: + field_type = obj_annotations[field] + # [Note: ForwardRef annotations in NamedTuple attributes] + # NamedTuple types are slightly different from normal types. + # + # Normally, annotations are evaluated like this (during jit.script): + # 1. Load strings of python code into c++ and parse. + # 2. Get annotations as strings + # 3. Use the PythonResolver's resolution callback (rcb) to convert + # the string into a python object + # 4. We call into annotations.py:ann_to_type to convert python obj + # from step 3 into a type that torchscript understands. + # + # NamedTuples are more complicated, because it has sub-types. + # Normally, once we have the NamedTuple type object from #3, + # we can just look at the annotation literal values and use + # ann_to_type directly on them. + # + # But sometimes, users will annotate with string literals, e.g. + # x: 'int' + # This also happens with PEP563 (from __forward__ import annotations) + # + # These annotations appear in the annotation dict as ForwardRef('int'). + # + # Then, we need to convert the string into a python object. This + # requires having local context for custom objects or imported types. + # rcb() is what gives us this. So, we plumb rcb through the stack so + # it can be used in this context for the if block below. + # + # FAQ: + # - Why do we need this special handling for NamedTuple but string + # annotations work fine for normal types? Normally, we parse the + # string directly and then call rcb() directly from C++. + # - Why not use ForwardRef._evaluate? For that, we need globals() + # and locals() for the local context where the NamedTuple was defined. + # rcb is what lets us look up into these. So, basically rcb does the + # hard work for us. + if isinstance(field_type, ForwardRef) and rcb is not None: + rcb_type = rcb(field_type.__forward_arg__) + # rcb returns None if it can't find anything. + if rcb_type is None: + raise ValueError( + f"Unknown type annotation: '{field_type}' in NamedTuple {obj.__name__}." + f" Likely due to partial support for ForwardRef parameters in NamedTuples, see #95858." + f" Issue occurred at {loc.highlight()}" + ) + field_type = rcb_type + the_type = torch.jit.annotations.ann_to_type(field_type, loc, rcb) + annotations.append(the_type) + else: + annotations.append(torch._C.TensorType.getInferred()) + return type(obj).__name__, obj._fields, annotations, defaults + + +def _create_named_tuple( + t, + unqual_name: str, + field_names: list[str], + defaults: tuple[Any, ...], +): + TupleType = collections.namedtuple(unqual_name, field_names, defaults=defaults) # type: ignore[call-arg, no-redef, misc] + return TupleType(*t) + + +@contextlib.contextmanager +def _disable_emit_hooks(): + hooks = torch._C._jit_get_emit_hooks() + torch._C._jit_set_emit_hooks(None, None) + try: + yield + finally: + torch._C._jit_set_emit_hooks(hooks[0], hooks[1]) + + +def _disable_emit_hooks_decorator(_DecoratorContextManager) -> None: # noqa: F811 + # noqa: F841 + def __enter__(self) -> None: + self.hooks = torch._C._jit_get_emit_hooks() + torch._C._jit_set_emit_hooks(None, None) + + def __exit__(self, *args) -> None: + torch._C._jit_set_emit_hooks(self.hooks[0], self.hooks[1]) + + +def _is_exception(obj) -> bool: + if not inspect.isclass(obj): + return False + return issubclass(obj, Exception) + + +def raise_error_container_parameter_missing(target_type) -> None: + if target_type.endswith("ict"): + raise RuntimeError( + f"Attempted to use {target_type} without " + "contained types. Please add contained type, e.g. " + f"{target_type}[int, int]" + ) + raise RuntimeError( + f"Attempted to use {target_type} without a " + "contained type. Please add a contained type, e.g. " + f"{target_type}[int]" + ) + + +_RAW_TYPE_NAME_MAPPING = { + dict: "dict", + list: "list", + tuple: "tuple", + typing.Dict: "Dict", # noqa: UP006 + typing.List: "List", # noqa: UP006 + typing.Optional: "Optional", + typing.Tuple: "Tuple", # noqa: UP006 +} + + +def check_args_exist(target_type) -> None: + if name := _RAW_TYPE_NAME_MAPPING.get(target_type): + raise_error_container_parameter_missing(name) + + +def check_empty_containers(obj) -> None: + if obj == [] or obj == {} or obj == (): + warnings.warn( + "The inner type of a container is lost when " + "calling torch.jit.isinstance in eager mode. For " + "example, List[int] would become list and " + "therefore falsely return True for List[float] or" + " List[str].", + stacklevel=2, + ) + + +# supports List/Dict/Tuple and Optional types +# TODO support future +def container_checker(obj, target_type) -> bool: + origin_type = get_origin(target_type) + check_args_exist(target_type) + if origin_type is None: + return False + elif origin_type is list or origin_type is typing.List: # noqa: UP006 + check_empty_containers(obj) + if not isinstance(obj, list): + return False + arg_type = get_args(target_type)[0] + arg_origin = get_origin(arg_type) + for el in obj: + # check if nested container, ex: List[List[str]] + if arg_origin: # processes nested container, ex: List[List[str]] + if not container_checker(el, arg_type): + return False + elif not isinstance(el, arg_type): + return False + return True + elif origin_type is typing.Dict or origin_type is dict: # noqa: UP006 + check_empty_containers(obj) + if not isinstance(obj, dict): + return False + key_type = get_args(target_type)[0] + val_type = get_args(target_type)[1] + for key, val in obj.items(): + # check if keys are of right type + if not isinstance(key, key_type): + return False + val_origin = get_origin(val_type) + if val_origin: + if not container_checker(val, val_type): + return False + elif not isinstance(val, val_type): + return False + return True + elif origin_type is typing.Tuple or origin_type is tuple: # noqa: UP006 + check_empty_containers(obj) + if not isinstance(obj, tuple): + return False + arg_types = get_args(target_type) + if len(obj) != len(arg_types): + return False + for el, el_type in zip(obj, arg_types): + el_origin = get_origin(el_type) + if el_origin: + if not container_checker(el, el_type): + return False + elif not isinstance(el, el_type): + return False + return True + elif origin_type is Union or issubclass( + # pyrefly: ignore [bad-argument-type] + origin_type, + BuiltinUnionType, + ): # also handles Optional + if obj is None: # check before recursion because None is always fine + return True + inner_types = get_args(target_type) + for t in inner_types: + t_origin = get_origin(t) + if t_origin: + return container_checker(obj, t) + elif isinstance(obj, t): + return True + return False + + +def _isinstance(obj, target_type) -> bool: + if isinstance(target_type, collections.abc.Container): + if not isinstance(target_type, tuple): + raise RuntimeError( + "The second argument to " + "`torch.jit.isinstance` must be a type " + "or a tuple of types" + ) + for t_type in target_type: + if _isinstance(obj, t_type): + return True + return False + + origin_type = get_origin(target_type) + if origin_type: + return container_checker(obj, target_type) + + # Check to handle non-typed optional origin returns as none instead + # of as optional in 3.7-3.8 + check_args_exist(target_type) + + # handle non-containers + return isinstance(obj, target_type) + + +class _TensorExtractor(pickle.Pickler): + def __init__(self, *args, tensors: list[torch.Tensor], **kwargs): + super().__init__(*args, **kwargs) + self.tensors = tensors + + def persistent_id(self, obj): + if isinstance(obj, torch.Tensor): + self.tensors.append(obj) + return "" + # Since we just want to extract tensors, we don't mind if an object is + # unpicklable if it doesn't contain tensors, as we can just ignore/skip + # it. To play it safe, we only do so for common objects that we're sure + # don't contain tensors. Feel free to add new types here. Note also that + # even if a type isn't listed here this won't block users, since they + # can just add a __getstate__ or __reduce__ method to their class. + if isinstance(obj, LockType): + return "" + # Futures and RRefs don't technically contain a value, they just offer + # the means to access a value. + if isinstance(obj, CFuture) or is_rref_instance(obj): + return "" + if isinstance(obj, CAwait): + return "" + if isinstance(obj, torch.cuda.Event): + return "" + if isinstance(obj, threading.Thread): + return "" + return None + + +def _extract_tensors(obj): + r""" + This function is exclusively called from C++. + See ``torch/csrc/jit/python/python_ivalue.h``. + + It extracts the tensors contained in the given object, through pickling. + """ + tensors: list[torch.Tensor] = [] + extractor = _TensorExtractor(io.BytesIO(), protocol=-1, tensors=tensors) + extractor.dump(obj) + return tensors + + +def _get_model_id(obj) -> str | None: + if isinstance(obj, torch.jit.ScriptModule): + return str(obj._c._type()) + elif isinstance(obj, torch.jit.ScriptFunction): + return obj.qualified_name + else: + return None + + +# In Python-3.11+ typed enums (i.e. IntEnum for example) retain number of base class methods in subclass +# that were previously dropped. To preserve the behavior, explicitly drop them there + +if sys.version_info >= (3, 11): + _drop(enum.Enum.__new__) + _drop(enum.Enum.__format__) + _drop(enum.Enum.__repr__) + _drop(enum.Enum.__str__) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_linalg_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_linalg_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..b44a82e155cda65ed4f06dc99a654c16c885a937 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_linalg_utils.py @@ -0,0 +1,148 @@ +# mypy: allow-untyped-defs +"""Various linear algebra utility methods for internal use.""" + +import torch +from torch import Tensor + + +def is_sparse(A): + """Check if tensor A is a sparse COO tensor. All other sparse storage formats (CSR, CSC, etc...) will return False.""" + if isinstance(A, torch.Tensor): + return A.layout == torch.sparse_coo + + error_str = "expected Tensor" + if not torch.jit.is_scripting(): + error_str += f" but got {type(A)}" + raise TypeError(error_str) + + +def get_floating_dtype(A): + """Return the floating point dtype of tensor A. + + Integer types map to float32. + """ + dtype = A.dtype + if dtype in (torch.float16, torch.float32, torch.float64): + return dtype + return torch.float32 + + +def matmul(A: Tensor | None, B: Tensor) -> Tensor: + """Multiply two matrices. + + If A is None, return B. A can be sparse or dense. B is always + dense. + """ + if A is None: + return B + if is_sparse(A): + return torch.sparse.mm(A, B) + return torch.matmul(A, B) + + +def bform(X: Tensor, A: Tensor | None, Y: Tensor) -> Tensor: + """Return bilinear form of matrices: :math:`X^T A Y`.""" + return matmul(X.mT, matmul(A, Y)) + + +def qform(A: Tensor | None, S: Tensor): + """Return quadratic form :math:`S^T A S`.""" + return bform(S, A, S) + + +def basis(A): + """Return orthogonal basis of A columns.""" + return torch.linalg.qr(A).Q + + +def symeig(A: Tensor, largest: bool | None = False) -> tuple[Tensor, Tensor]: + """Return eigenpairs of A with specified ordering.""" + if largest is None: + largest = False + E, Z = torch.linalg.eigh(A, UPLO="U") + # assuming that E is ordered + if largest: + E = torch.flip(E, dims=(-1,)) + Z = torch.flip(Z, dims=(-1,)) + return E, Z + + +# These functions were deprecated and removed +# This nice error message can be removed in version 1.13+ +def matrix_rank(input, tol=None, symmetric=False, *, out=None) -> Tensor: + raise RuntimeError( + "This function was deprecated since version 1.9 and is now removed.\n" + "Please use the `torch.linalg.matrix_rank` function instead. " + "The parameter 'symmetric' was renamed in `torch.linalg.matrix_rank()` to 'hermitian'." + ) + + +def solve(input: Tensor, A: Tensor, *, out=None) -> tuple[Tensor, Tensor]: + raise RuntimeError( + "This function was deprecated since version 1.9 and is now removed. " + "`torch.solve` is deprecated in favor of `torch.linalg.solve`. " + "`torch.linalg.solve` has its arguments reversed and does not return the LU factorization.\n\n" + "To get the LU factorization see `torch.lu`, which can be used with `torch.lu_solve` or `torch.lu_unpack`.\n" + "X = torch.solve(B, A).solution " + "should be replaced with:\n" + "X = torch.linalg.solve(A, B)" + ) + + +def lstsq(input: Tensor, A: Tensor, *, out=None) -> tuple[Tensor, Tensor]: + raise RuntimeError( + "This function was deprecated since version 1.9 and is now removed. " + "`torch.lstsq` is deprecated in favor of `torch.linalg.lstsq`.\n" + "`torch.linalg.lstsq` has reversed arguments and does not return the QR decomposition in " + "the returned tuple (although it returns other information about the problem).\n\n" + "To get the QR decomposition consider using `torch.linalg.qr`.\n\n" + "The returned solution in `torch.lstsq` stored the residuals of the solution in the " + "last m - n columns of the returned value whenever m > n. In torch.linalg.lstsq, " + "the residuals are in the field 'residuals' of the returned named tuple.\n\n" + "The unpacking of the solution, as in\n" + "X, _ = torch.lstsq(B, A).solution[:A.size(1)]\n" + "should be replaced with:\n" + "X = torch.linalg.lstsq(A, B).solution" + ) + + +def _symeig( + input, + eigenvectors=False, + upper=True, + *, + out=None, +) -> tuple[Tensor, Tensor]: + raise RuntimeError( + "This function was deprecated since version 1.9 and is now removed. " + "The default behavior has changed from using the upper triangular portion of the matrix by default " + "to using the lower triangular portion.\n\n" + "L, _ = torch.symeig(A, upper=upper) " + "should be replaced with:\n" + "L = torch.linalg.eigvalsh(A, UPLO='U' if upper else 'L')\n\n" + "and\n\n" + "L, V = torch.symeig(A, eigenvectors=True) " + "should be replaced with:\n" + "L, V = torch.linalg.eigh(A, UPLO='U' if upper else 'L')" + ) + + +def eig( + self: Tensor, + eigenvectors: bool = False, + *, + e=None, + v=None, +) -> tuple[Tensor, Tensor]: + raise RuntimeError( + "This function was deprecated since version 1.9 and is now removed. " + "`torch.linalg.eig` returns complex tensors of dtype `cfloat` or `cdouble` rather than real tensors " + "mimicking complex tensors.\n\n" + "L, _ = torch.eig(A) " + "should be replaced with:\n" + "L_complex = torch.linalg.eigvals(A)\n\n" + "and\n\n" + "L, V = torch.eig(A, eigenvectors=True) " + "should be replaced with:\n" + "L_complex, V_complex = torch.linalg.eig(A)" + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_lobpcg.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_lobpcg.py new file mode 100644 index 0000000000000000000000000000000000000000..c08362ef96f489da040a67d076bd06ec5b62914f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_lobpcg.py @@ -0,0 +1,1159 @@ +# mypy: allow-untyped-defs +"""Locally Optimal Block Preconditioned Conjugate Gradient methods.""" +# Author: Pearu Peterson +# Created: February 2020 + +import torch +from torch import _linalg_utils as _utils, Tensor +from torch.overrides import handle_torch_function, has_torch_function + + +__all__ = ["lobpcg"] + + +def _symeig_backward_complete_eigenspace(D_grad, U_grad, A, D, U): + # compute F, such that F_ij = (d_j - d_i)^{-1} for i != j, F_ii = 0 + F = D.unsqueeze(-2) - D.unsqueeze(-1) + F.diagonal(dim1=-2, dim2=-1).fill_(float("inf")) + F.pow_(-1) + + # A.grad = U (D.grad + (U^T U.grad * F)) U^T + Ut = U.mT.contiguous() + res = torch.matmul( + U, torch.matmul(torch.diag_embed(D_grad) + torch.matmul(Ut, U_grad) * F, Ut) + ) + + return res + + +def _polynomial_coefficients_given_roots(roots): + """ + Given the `roots` of a polynomial, find the polynomial's coefficients. + + If roots = (r_1, ..., r_n), then the method returns + coefficients (a_0, a_1, ..., a_n (== 1)) so that + p(x) = (x - r_1) * ... * (x - r_n) + = x^n + a_{n-1} * x^{n-1} + ... a_1 * x_1 + a_0 + + Note: for better performance requires writing a low-level kernel + """ + poly_order = roots.shape[-1] + poly_coeffs_shape = list(roots.shape) + # we assume p(x) = x^n + a_{n-1} * x^{n-1} + ... + a_1 * x + a_0, + # so poly_coeffs = {a_0, ..., a_n, a_{n+1}(== 1)}, + # but we insert one extra coefficient to enable better vectorization below + poly_coeffs_shape[-1] += 2 + poly_coeffs = roots.new_zeros(poly_coeffs_shape) + poly_coeffs[..., 0] = 1 + poly_coeffs[..., -1] = 1 + + # perform the Horner's rule + for i in range(1, poly_order + 1): + # note that it is computationally hard to compute backward for this method, + # because then given the coefficients it would require finding the roots and/or + # calculating the sensitivity based on the Vieta's theorem. + # So the code below tries to circumvent the explicit root finding by series + # of operations on memory copies imitating the Horner's method. + # The memory copies are required to construct nodes in the computational graph + # by exploiting the explicit (not in-place, separate node for each step) + # recursion of the Horner's method. + # Needs more memory, O(... * k^2), but with only O(... * k^2) complexity. + poly_coeffs_new = poly_coeffs.clone() if roots.requires_grad else poly_coeffs + out = poly_coeffs_new.narrow(-1, poly_order - i, i + 1) + out -= roots.narrow(-1, i - 1, 1) * poly_coeffs.narrow( + -1, poly_order - i + 1, i + 1 + ) + poly_coeffs = poly_coeffs_new + + return poly_coeffs.narrow(-1, 1, poly_order + 1) + + +def _polynomial_value(poly, x, zero_power, transition): + """ + A generic method for computing poly(x) using the Horner's rule. + + Args: + poly (Tensor): the (possibly batched) 1D Tensor representing + polynomial coefficients such that + poly[..., i] = (a_{i_0}, ..., a{i_n} (==1)), and + poly(x) = poly[..., 0] * zero_power + ... + poly[..., n] * x^n + + x (Tensor): the value (possible batched) to evaluate the polynomial `poly` at. + + zero_power (Tensor): the representation of `x^0`. It is application-specific. + + transition (Callable): the function that accepts some intermediate result `int_val`, + the `x` and a specific polynomial coefficient + `poly[..., k]` for some iteration `k`. + It basically performs one iteration of the Horner's rule + defined as `x * int_val + poly[..., k] * zero_power`. + Note that `zero_power` is not a parameter, + because the step `+ poly[..., k] * zero_power` depends on `x`, + whether it is a vector, a matrix, or something else, so this + functionality is delegated to the user. + """ + + res = zero_power.clone() + for k in range(poly.size(-1) - 2, -1, -1): + res = transition(res, x, poly[..., k]) + return res + + +def _matrix_polynomial_value(poly, x, zero_power=None): + """ + Evaluates `poly(x)` for the (batched) matrix input `x`. + Check out `_polynomial_value` function for more details. + """ + + # matrix-aware Horner's rule iteration + def transition(curr_poly_val, x, poly_coeff): + res = x.matmul(curr_poly_val) + res.diagonal(dim1=-2, dim2=-1).add_(poly_coeff.unsqueeze(-1)) + return res + + if zero_power is None: + zero_power = torch.eye( + x.size(-1), x.size(-1), dtype=x.dtype, device=x.device + ).view(*([1] * len(list(x.shape[:-2]))), x.size(-1), x.size(-1)) + + return _polynomial_value(poly, x, zero_power, transition) + + +def _vector_polynomial_value(poly, x, zero_power=None): + """ + Evaluates `poly(x)` for the (batched) vector input `x`. + Check out `_polynomial_value` function for more details. + """ + + # vector-aware Horner's rule iteration + def transition(curr_poly_val, x, poly_coeff): + res = torch.addcmul(poly_coeff.unsqueeze(-1), x, curr_poly_val) + return res + + if zero_power is None: + zero_power = x.new_ones(1).expand(x.shape) + + return _polynomial_value(poly, x, zero_power, transition) + + +def _symeig_backward_partial_eigenspace(D_grad, U_grad, A, D, U, largest): + # compute a projection operator onto an orthogonal subspace spanned by the + # columns of U defined as (I - UU^T) + Ut = U.mT.contiguous() + proj_U_ortho = -U.matmul(Ut) + proj_U_ortho.diagonal(dim1=-2, dim2=-1).add_(1) + + # compute U_ortho, a basis for the orthogonal complement to the span(U), + # by projecting a random [..., m, m - k] matrix onto the subspace spanned + # by the columns of U. + # + # fix generator for determinism + gen = torch.Generator(A.device) + + # orthogonal complement to the span(U) + U_ortho = proj_U_ortho.matmul( + torch.randn( + (*A.shape[:-1], A.size(-1) - D.size(-1)), + dtype=A.dtype, + device=A.device, + generator=gen, + ) + ) + U_ortho_t = U_ortho.mT.contiguous() + + # compute the coefficients of the characteristic polynomial of the tensor D. + # Note that D is diagonal, so the diagonal elements are exactly the roots + # of the characteristic polynomial. + chr_poly_D = _polynomial_coefficients_given_roots(D) + + # the code below finds the explicit solution to the Sylvester equation + # U_ortho^T A U_ortho dX - dX D = -U_ortho^T A U + # and incorporates it into the whole gradient stored in the `res` variable. + # + # Equivalent to the following naive implementation: + # res = A.new_zeros(A.shape) + # p_res = A.new_zeros(*A.shape[:-1], D.size(-1)) + # for k in range(1, chr_poly_D.size(-1)): + # p_res.zero_() + # for i in range(0, k): + # p_res += (A.matrix_power(k - 1 - i) @ U_grad) * D.pow(i).unsqueeze(-2) + # res -= chr_poly_D[k] * (U_ortho @ poly_D_at_A.inverse() @ U_ortho_t @ p_res @ U.t()) + # + # Note that dX is a differential, so the gradient contribution comes from the backward sensitivity + # Tr(f(U_grad, D_grad, A, U, D)^T dX) = Tr(g(U_grad, A, U, D)^T dA) for some functions f and g, + # and we need to compute g(U_grad, A, U, D) + # + # The naive implementation is based on the paper + # Hu, Qingxi, and Daizhan Cheng. + # "The polynomial solution to the Sylvester matrix equation." + # Applied mathematics letters 19.9 (2006): 859-864. + # + # We can modify the computation of `p_res` from above in a more efficient way + # p_res = U_grad * (chr_poly_D[1] * D.pow(0) + ... + chr_poly_D[k] * D.pow(k)).unsqueeze(-2) + # + A U_grad * (chr_poly_D[2] * D.pow(0) + ... + chr_poly_D[k] * D.pow(k - 1)).unsqueeze(-2) + # + ... + # + A.matrix_power(k - 1) U_grad * chr_poly_D[k] + # Note that this saves us from redundant matrix products with A (elimination of matrix_power) + U_grad_projected = U_grad + series_acc = U_grad_projected.new_zeros(U_grad_projected.shape) + for k in range(1, chr_poly_D.size(-1)): + poly_D = _vector_polynomial_value(chr_poly_D[..., k:], D) + series_acc += U_grad_projected * poly_D.unsqueeze(-2) + U_grad_projected = A.matmul(U_grad_projected) + + # compute chr_poly_D(A) which essentially is: + # + # chr_poly_D_at_A = A.new_zeros(A.shape) + # for k in range(chr_poly_D.size(-1)): + # chr_poly_D_at_A += chr_poly_D[k] * A.matrix_power(k) + # + # Note, however, for better performance we use the Horner's rule + chr_poly_D_at_A = _matrix_polynomial_value(chr_poly_D, A) + + # compute the action of `chr_poly_D_at_A` restricted to U_ortho_t + chr_poly_D_at_A_to_U_ortho = torch.matmul( + U_ortho_t, torch.matmul(chr_poly_D_at_A, U_ortho) + ) + # we need to invert 'chr_poly_D_at_A_to_U_ortho`, for that we compute its + # Cholesky decomposition and then use `torch.cholesky_solve` for better stability. + # Cholesky decomposition requires the input to be positive-definite. + # Note that `chr_poly_D_at_A_to_U_ortho` is positive-definite if + # 1. `largest` == False, or + # 2. `largest` == True and `k` is even + # under the assumption that `A` has distinct eigenvalues. + # + # check if `chr_poly_D_at_A_to_U_ortho` is positive-definite or negative-definite + chr_poly_D_at_A_to_U_ortho_sign = -1 if (largest and (k % 2 == 1)) else +1 + chr_poly_D_at_A_to_U_ortho_L = torch.linalg.cholesky( + chr_poly_D_at_A_to_U_ortho_sign * chr_poly_D_at_A_to_U_ortho + ) + + # compute the gradient part in span(U) + res = _symeig_backward_complete_eigenspace(D_grad, U_grad, A, D, U) + + # incorporate the Sylvester equation solution into the full gradient + # it resides in span(U_ortho) + res -= U_ortho.matmul( + chr_poly_D_at_A_to_U_ortho_sign + * torch.cholesky_solve( + U_ortho_t.matmul(series_acc), chr_poly_D_at_A_to_U_ortho_L + ) + ).matmul(Ut) + + return res + + +def _symeig_backward(D_grad, U_grad, A, D, U, largest): + # if `U` is square, then the columns of `U` is a complete eigenspace + if U.size(-1) == U.size(-2): + return _symeig_backward_complete_eigenspace(D_grad, U_grad, A, D, U) + else: + return _symeig_backward_partial_eigenspace(D_grad, U_grad, A, D, U, largest) + + +class LOBPCGAutogradFunction(torch.autograd.Function): + @staticmethod + def forward( # type: ignore[override] + ctx, + A: Tensor, + k: int | None = None, + B: Tensor | None = None, + X: Tensor | None = None, + n: int | None = None, + iK: Tensor | None = None, + niter: int | None = None, + tol: float | None = None, + largest: bool | None = None, + method: str | None = None, + tracker: None = None, + ortho_iparams: dict[str, int] | None = None, + ortho_fparams: dict[str, float] | None = None, + ortho_bparams: dict[str, bool] | None = None, + ) -> tuple[Tensor, Tensor]: + # makes sure that input is contiguous for efficiency. + # Note: autograd does not support dense gradients for sparse input yet. + A = A.contiguous() if (not A.is_sparse) else A + if B is not None: + B = B.contiguous() if (not B.is_sparse) else B + + D, U = _lobpcg( + A, + k, + B, + X, + n, + iK, + niter, + tol, + largest, + method, + tracker, + ortho_iparams, + ortho_fparams, + ortho_bparams, + ) + + ctx.save_for_backward(A, B, D, U) + ctx.largest = largest + + return D, U + + @staticmethod + def backward(ctx, D_grad, U_grad): # pyrefly: ignore # bad-override + A_grad = B_grad = None + grads = [None] * 14 + + A, B, D, U = ctx.saved_tensors + largest = ctx.largest + + # lobpcg.backward has some limitations. Checks for unsupported input + if A.is_sparse or (B is not None and B.is_sparse and ctx.needs_input_grad[2]): + raise ValueError( + "lobpcg.backward does not support sparse input yet." + "Note that lobpcg.forward does though." + ) + if ( + A.dtype in (torch.complex64, torch.complex128) + or B is not None + and B.dtype in (torch.complex64, torch.complex128) + ): + raise ValueError( + "lobpcg.backward does not support complex input yet." + "Note that lobpcg.forward does though." + ) + if B is not None: + raise ValueError( + "lobpcg.backward does not support backward with B != I yet." + ) + + if largest is None: + largest = True + + # symeig backward + if B is None: + A_grad = _symeig_backward(D_grad, U_grad, A, D, U, largest) + + # A has index 0 + grads[0] = A_grad + # B has index 2 + grads[2] = B_grad + return tuple(grads) + + +def lobpcg( + A: Tensor, + k: int | None = None, + B: Tensor | None = None, + X: Tensor | None = None, + n: int | None = None, + iK: Tensor | None = None, + niter: int | None = None, + tol: float | None = None, + largest: bool | None = None, + method: str | None = None, + tracker: None = None, + ortho_iparams: dict[str, int] | None = None, + ortho_fparams: dict[str, float] | None = None, + ortho_bparams: dict[str, bool] | None = None, +) -> tuple[Tensor, Tensor]: + """Find the k largest (or smallest) eigenvalues and the corresponding + eigenvectors of a symmetric positive definite generalized + eigenvalue problem using matrix-free LOBPCG methods. + + This function is a front-end to the following LOBPCG algorithms + selectable via `method` argument: + + `method="basic"` - the LOBPCG method introduced by Andrew + Knyazev, see [Knyazev2001]. A less robust method, may fail when + Cholesky is applied to singular input. + + `method="ortho"` - the LOBPCG method with orthogonal basis + selection [StathopoulosEtal2002]. A robust method. + + Supported inputs are dense, sparse, and batches of dense matrices. + + .. note:: In general, the basic method spends least time per + iteration. However, the robust methods converge much faster and + are more stable. So, the usage of the basic method is generally + not recommended but there exist cases where the usage of the + basic method may be preferred. + + .. warning:: The backward method does not support sparse and complex inputs. + It works only when `B` is not provided (i.e. `B == None`). + We are actively working on extensions, and the details of + the algorithms are going to be published promptly. + + .. warning:: While it is assumed that `A` is symmetric, `A.grad` is not. + To make sure that `A.grad` is symmetric, so that `A - t * A.grad` is symmetric + in first-order optimization routines, prior to running `lobpcg` + we do the following symmetrization map: `A -> (A + A.t()) / 2`. + The map is performed only when the `A` requires gradients. + + .. warning:: LOBPCG algorithm is not applicable when the number of `A`'s rows + is smaller than 3x the number of requested eigenpairs `n`. + + Args: + + A (Tensor): the input tensor of size :math:`(*, m, m)` + + k (integer, optional): the number of requested + eigenpairs. Default is the number of :math:`X` + columns (when specified) or `1`. + + B (Tensor, optional): the input tensor of size :math:`(*, m, + m)`. When not specified, `B` is interpreted as + identity matrix. + + X (tensor, optional): the input tensor of size :math:`(*, m, n)` + where `k <= n <= m`. When specified, it is used as + initial approximation of eigenvectors. X must be a + dense tensor. + + n (integer, optional): if :math:`X` is not specified then `n` + specifies the size of the generated random + approximation of eigenvectors. Default value for `n` + is `k`. If :math:`X` is specified, any provided value of `n` is + ignored and `n` is automatically set to the number of + columns in :math:`X`. + + iK (tensor, optional): the input tensor of size :math:`(*, m, + m)`. When specified, it will be used as preconditioner. + + niter (int, optional): maximum number of iterations. When + reached, the iteration process is hard-stopped and + the current approximation of eigenpairs is returned. + For infinite iteration but until convergence criteria + is met, use `-1`. + + tol (float, optional): residual tolerance for stopping + criterion. Default is `feps ** 0.5` where `feps` is + smallest non-zero floating-point number of the given + input tensor `A` data type. + + largest (bool, optional): when True, solve the eigenproblem for + the largest eigenvalues. Otherwise, solve the + eigenproblem for smallest eigenvalues. Default is + `True`. + + method (str, optional): select LOBPCG method. See the + description of the function above. Default is + "ortho". + + tracker (callable, optional) : a function for tracing the + iteration process. When specified, it is called at + each iteration step with LOBPCG instance as an + argument. The LOBPCG instance holds the full state of + the iteration process in the following attributes: + + `iparams`, `fparams`, `bparams` - dictionaries of + integer, float, and boolean valued input + parameters, respectively + + `ivars`, `fvars`, `bvars`, `tvars` - dictionaries + of integer, float, boolean, and Tensor valued + iteration variables, respectively. + + `A`, `B`, `iK` - input Tensor arguments. + + `E`, `X`, `S`, `R` - iteration Tensor variables. + + For instance: + + `ivars["istep"]` - the current iteration step + `X` - the current approximation of eigenvectors + `E` - the current approximation of eigenvalues + `R` - the current residual + `ivars["converged_count"]` - the current number of converged eigenpairs + `tvars["rerr"]` - the current state of convergence criteria + + Note that when `tracker` stores Tensor objects from + the LOBPCG instance, it must make copies of these. + + If `tracker` sets `bvars["force_stop"] = True`, the + iteration process will be hard-stopped. + + ortho_iparams, ortho_fparams, ortho_bparams (dict, optional): + various parameters to LOBPCG algorithm when using + `method="ortho"`. + + Returns: + + E (Tensor): tensor of eigenvalues of size :math:`(*, k)` + + X (Tensor): tensor of eigenvectors of size :math:`(*, m, k)` + + References: + + [Knyazev2001] Andrew V. Knyazev. (2001) Toward the Optimal + Preconditioned Eigensolver: Locally Optimal Block Preconditioned + Conjugate Gradient Method. SIAM J. Sci. Comput., 23(2), + 517-541. (25 pages) + https://epubs.siam.org/doi/abs/10.1137/S1064827500366124 + + [StathopoulosEtal2002] Andreas Stathopoulos and Kesheng + Wu. (2002) A Block Orthogonalization Procedure with Constant + Synchronization Requirements. SIAM J. Sci. Comput., 23(6), + 2165-2182. (18 pages) + https://epubs.siam.org/doi/10.1137/S1064827500370883 + + [DuerschEtal2018] Jed A. Duersch, Meiyue Shao, Chao Yang, Ming + Gu. (2018) A Robust and Efficient Implementation of LOBPCG. + SIAM J. Sci. Comput., 40(5), C655-C676. (22 pages) + https://arxiv.org/abs/1704.07458 + + """ + + if not torch.jit.is_scripting(): + tensor_ops = (A, B, X, iK) + if not set(map(type, tensor_ops)).issubset( + (torch.Tensor, type(None)) + ) and has_torch_function(tensor_ops): + return handle_torch_function( + lobpcg, + tensor_ops, + A, + k=k, + B=B, + X=X, + n=n, + iK=iK, + niter=niter, + tol=tol, + largest=largest, + method=method, + tracker=tracker, + ortho_iparams=ortho_iparams, + ortho_fparams=ortho_fparams, + ortho_bparams=ortho_bparams, + ) + + if not torch._jit_internal.is_scripting(): + if A.requires_grad or (B is not None and B.requires_grad): + # While it is expected that `A` is symmetric, + # the `A_grad` might be not. Therefore we perform the trick below, + # so that `A_grad` becomes symmetric. + # The symmetrization is important for first-order optimization methods, + # so that (A - alpha * A_grad) is still a symmetric matrix. + # Same holds for `B`. + A_sym = (A + A.mT) / 2 + B_sym = (B + B.mT) / 2 if (B is not None) else None + + return LOBPCGAutogradFunction.apply( + A_sym, + k, + B_sym, + X, + n, + iK, + niter, + tol, + largest, + method, + tracker, + ortho_iparams, + ortho_fparams, + ortho_bparams, + ) + else: + if A.requires_grad or (B is not None and B.requires_grad): + raise RuntimeError( + "Script and require grads is not supported atm." + "If you just want to do the forward, use .detach()" + "on A and B before calling into lobpcg" + ) + + return _lobpcg( + A, + k, + B, + X, + n, + iK, + niter, + tol, + largest, + method, + tracker, + ortho_iparams, + ortho_fparams, + ortho_bparams, + ) + + +def _lobpcg( + A: Tensor, + k: int | None = None, + B: Tensor | None = None, + X: Tensor | None = None, + n: int | None = None, + iK: Tensor | None = None, + niter: int | None = None, + tol: float | None = None, + largest: bool | None = None, + method: str | None = None, + tracker: None = None, + ortho_iparams: dict[str, int] | None = None, + ortho_fparams: dict[str, float] | None = None, + ortho_bparams: dict[str, bool] | None = None, +) -> tuple[Tensor, Tensor]: + # A must be square: + assert A.shape[-2] == A.shape[-1], A.shape + if B is not None: + # A and B must have the same shapes: + assert A.shape == B.shape, (A.shape, B.shape) + + dtype = _utils.get_floating_dtype(A) + device = A.device + if tol is None: + feps = {torch.float32: 1.2e-07, torch.float64: 2.23e-16}[dtype] + tol = feps**0.5 + + m = A.shape[-1] + k = (1 if X is None else X.shape[-1]) if k is None else k + n = (k if n is None else n) if X is None else X.shape[-1] + + if m < 3 * n: + raise ValueError( + f"LPBPCG algorithm is not applicable when the number of A rows (={m})" + f" is smaller than 3 x the number of requested eigenpairs (={n})" + ) + + method = "ortho" if method is None else method + + iparams = { + "m": m, + "n": n, + "k": k, + "niter": 1000 if niter is None else niter, + } + + fparams = { + "tol": tol, + } + + bparams = {"largest": True if largest is None else largest} + + if method == "ortho": + if ortho_iparams is not None: + iparams.update(ortho_iparams) + if ortho_fparams is not None: + fparams.update(ortho_fparams) + if ortho_bparams is not None: + bparams.update(ortho_bparams) + iparams["ortho_i_max"] = iparams.get("ortho_i_max", 3) + iparams["ortho_j_max"] = iparams.get("ortho_j_max", 3) + fparams["ortho_tol"] = fparams.get("ortho_tol", tol) + fparams["ortho_tol_drop"] = fparams.get("ortho_tol_drop", tol) + fparams["ortho_tol_replace"] = fparams.get("ortho_tol_replace", tol) + bparams["ortho_use_drop"] = bparams.get("ortho_use_drop", False) + + if not torch.jit.is_scripting(): + LOBPCG.call_tracker = LOBPCG_call_tracker # type: ignore[method-assign] + + if len(A.shape) > 2: + N = int(torch.prod(torch.tensor(A.shape[:-2]))) + bA = A.reshape((N,) + A.shape[-2:]) + bB = B.reshape((N,) + A.shape[-2:]) if B is not None else None + bX = X.reshape((N,) + X.shape[-2:]) if X is not None else None + bE = torch.empty((N, k), dtype=dtype, device=device) + bXret = torch.empty((N, m, k), dtype=dtype, device=device) + + for i in range(N): + A_ = bA[i] + B_ = bB[i] if bB is not None else None + X_ = ( + torch.randn((m, n), dtype=dtype, device=device) if bX is None else bX[i] + ) + assert len(X_.shape) == 2 and X_.shape == (m, n), (X_.shape, (m, n)) + iparams["batch_index"] = i + worker = LOBPCG(A_, B_, X_, iK, iparams, fparams, bparams, method, tracker) + worker.run() + bE[i] = worker.E[:k] + bXret[i] = worker.X[:, :k] + + if not torch.jit.is_scripting(): + LOBPCG.call_tracker = LOBPCG_call_tracker_orig # type: ignore[method-assign] + + return bE.reshape(A.shape[:-2] + (k,)), bXret.reshape(A.shape[:-2] + (m, k)) + + X = torch.randn((m, n), dtype=dtype, device=device) if X is None else X + assert len(X.shape) == 2 and X.shape == (m, n), (X.shape, (m, n)) + + worker = LOBPCG(A, B, X, iK, iparams, fparams, bparams, method, tracker) + + worker.run() + + if not torch.jit.is_scripting(): + LOBPCG.call_tracker = LOBPCG_call_tracker_orig # type: ignore[method-assign] + + return worker.E[:k], worker.X[:, :k] + + +class LOBPCG: + """Worker class of LOBPCG methods.""" + + def __init__( + self, + A: Tensor | None, + B: Tensor | None, + X: Tensor, + iK: Tensor | None, + iparams: dict[str, int], + fparams: dict[str, float], + bparams: dict[str, bool], + method: str, + tracker: None, + ) -> None: + # constant parameters + self.A = A + self.B = B + self.iK = iK + self.iparams = iparams + self.fparams = fparams + self.bparams = bparams + self.method = method + self.tracker = tracker + m = iparams["m"] + n = iparams["n"] + + # variable parameters + self.X = X + self.E = torch.zeros((n,), dtype=X.dtype, device=X.device) + self.R = torch.zeros((m, n), dtype=X.dtype, device=X.device) + self.S = torch.zeros((m, 3 * n), dtype=X.dtype, device=X.device) + self.tvars: dict[str, Tensor] = {} + self.ivars: dict[str, int] = {"istep": 0} + self.fvars: dict[str, float] = {"_": 0.0} + self.bvars: dict[str, bool] = {"_": False} + + def __str__(self): + lines = ["LOPBCG:"] + lines += [f" iparams={self.iparams}"] + lines += [f" fparams={self.fparams}"] + lines += [f" bparams={self.bparams}"] + lines += [f" ivars={self.ivars}"] + lines += [f" fvars={self.fvars}"] + lines += [f" bvars={self.bvars}"] + lines += [f" tvars={self.tvars}"] + lines += [f" A={self.A}"] + lines += [f" B={self.B}"] + lines += [f" iK={self.iK}"] + lines += [f" X={self.X}"] + lines += [f" E={self.E}"] + r = "" + for line in lines: + r += line + "\n" + return r + + def update(self): + """Set and update iteration variables.""" + if self.ivars["istep"] == 0: + X_norm = float(torch.norm(self.X)) + iX_norm = X_norm**-1 + A_norm = float(torch.norm(_utils.matmul(self.A, self.X))) * iX_norm + B_norm = float(torch.norm(_utils.matmul(self.B, self.X))) * iX_norm + self.fvars["X_norm"] = X_norm + self.fvars["A_norm"] = A_norm + self.fvars["B_norm"] = B_norm + self.ivars["iterations_left"] = self.iparams["niter"] + self.ivars["converged_count"] = 0 + self.ivars["converged_end"] = 0 + + if self.method == "ortho": + self._update_ortho() + else: + self._update_basic() + + self.ivars["iterations_left"] = self.ivars["iterations_left"] - 1 + self.ivars["istep"] = self.ivars["istep"] + 1 + + def update_residual(self): + """Update residual R from A, B, X, E.""" + mm = _utils.matmul + self.R = mm(self.A, self.X) - mm(self.B, self.X) * self.E + + def update_converged_count(self): + """Determine the number of converged eigenpairs using backward stable + convergence criterion, see discussion in Sec 4.3 of [DuerschEtal2018]. + + Users may redefine this method for custom convergence criteria. + """ + # (...) -> int + prev_count = self.ivars["converged_count"] + tol = self.fparams["tol"] + A_norm = self.fvars["A_norm"] + B_norm = self.fvars["B_norm"] + E, X, R = self.E, self.X, self.R + rerr = torch.norm(R, 2, (0,)) / ( + torch.norm(X, 2, (0,)) * (A_norm + torch.abs(E[: X.shape[-1]]) * B_norm) + ) + converged = rerr < tol + count = 0 + for b in converged: + if not b: + # ignore convergence of following pairs to ensure + # strict ordering of eigenpairs + break + count += 1 + assert count >= prev_count, ( + f"the number of converged eigenpairs (was {prev_count}, got {count}) cannot decrease" + ) + self.ivars["converged_count"] = count + self.tvars["rerr"] = rerr + return count + + def stop_iteration(self): + """Return True to stop iterations. + + Note that tracker (if defined) can force-stop iterations by + setting ``worker.bvars['force_stop'] = True``. + """ + return ( + self.bvars.get("force_stop", False) + or self.ivars["iterations_left"] == 0 + or self.ivars["converged_count"] >= self.iparams["k"] + ) + + def run(self): + """Run LOBPCG iterations. + + Use this method as a template for implementing LOBPCG + iteration scheme with custom tracker that is compatible with + TorchScript. + """ + self.update() + + if not torch.jit.is_scripting() and self.tracker is not None: + self.call_tracker() + + while not self.stop_iteration(): + self.update() + + if not torch.jit.is_scripting() and self.tracker is not None: + self.call_tracker() + + @torch.jit.unused + def call_tracker(self): + """Interface for tracking iteration process in Python mode. + + Tracking the iteration process is disabled in TorchScript + mode. In fact, one should specify tracker=None when JIT + compiling functions using lobpcg. + """ + # do nothing when in TorchScript mode + + # Internal methods + + def _update_basic(self): + """ + Update or initialize iteration variables when `method == "basic"`. + """ + mm = torch.matmul + ns = self.ivars["converged_end"] + nc = self.ivars["converged_count"] + n = self.iparams["n"] + largest = self.bparams["largest"] + + if self.ivars["istep"] == 0: + Ri = self._get_rayleigh_ritz_transform(self.X) + M = _utils.qform(_utils.qform(self.A, self.X), Ri) + E, Z = _utils.symeig(M, largest) + self.X[:] = mm(self.X, mm(Ri, Z)) + self.E[:] = E + np = 0 + self.update_residual() + nc = self.update_converged_count() + self.S[..., :n] = self.X + + W = _utils.matmul(self.iK, self.R) + self.ivars["converged_end"] = ns = n + np + W.shape[-1] + self.S[:, n + np : ns] = W + else: + S_ = self.S[:, nc:ns] + Ri = self._get_rayleigh_ritz_transform(S_) + M = _utils.qform(_utils.qform(self.A, S_), Ri) + E_, Z = _utils.symeig(M, largest) + self.X[:, nc:] = mm(S_, mm(Ri, Z[:, : n - nc])) + self.E[nc:] = E_[: n - nc] + P = mm(S_, mm(Ri, Z[:, n : 2 * n - nc])) + np = P.shape[-1] + + self.update_residual() + nc = self.update_converged_count() + self.S[..., :n] = self.X + self.S[:, n : n + np] = P + W = _utils.matmul(self.iK, self.R[:, nc:]) + + self.ivars["converged_end"] = ns = n + np + W.shape[-1] + self.S[:, n + np : ns] = W + + def _update_ortho(self): + """ + Update or initialize iteration variables when `method == "ortho"`. + """ + mm = torch.matmul + ns = self.ivars["converged_end"] + nc = self.ivars["converged_count"] + n = self.iparams["n"] + largest = self.bparams["largest"] + + if self.ivars["istep"] == 0: + Ri = self._get_rayleigh_ritz_transform(self.X) + M = _utils.qform(_utils.qform(self.A, self.X), Ri) + _E, Z = _utils.symeig(M, largest) + self.X = mm(self.X, mm(Ri, Z)) + self.update_residual() + np = 0 + nc = self.update_converged_count() + self.S[:, :n] = self.X + W = self._get_ortho(self.R, self.X) + ns = self.ivars["converged_end"] = n + np + W.shape[-1] + self.S[:, n + np : ns] = W + + else: + S_ = self.S[:, nc:ns] + # Rayleigh-Ritz procedure + E_, Z = _utils.symeig(_utils.qform(self.A, S_), largest) + + # Update E, X, P + self.X[:, nc:] = mm(S_, Z[:, : n - nc]) + self.E[nc:] = E_[: n - nc] + P = mm(S_, mm(Z[:, n - nc :], _utils.basis(Z[: n - nc, n - nc :].mT))) + np = P.shape[-1] + + # check convergence + self.update_residual() + nc = self.update_converged_count() + + # update S + self.S[:, :n] = self.X + self.S[:, n : n + np] = P + W = self._get_ortho(self.R[:, nc:], self.S[:, : n + np]) + ns = self.ivars["converged_end"] = n + np + W.shape[-1] + self.S[:, n + np : ns] = W + + def _get_rayleigh_ritz_transform(self, S): + """Return a transformation matrix that is used in Rayleigh-Ritz + procedure for reducing a general eigenvalue problem :math:`(S^TAS) + C = (S^TBS) C E` to a standard eigenvalue problem :math: `(Ri^T + S^TAS Ri) Z = Z E` where `C = Ri Z`. + + .. note:: In the original Rayleight-Ritz procedure in + [DuerschEtal2018], the problem is formulated as follows:: + + SAS = S^T A S + SBS = S^T B S + D = () ** -1/2 + R^T R = Cholesky(D SBS D) + Ri = D R^-1 + solve symeig problem Ri^T SAS Ri Z = Theta Z + C = Ri Z + + To reduce the number of matrix products (denoted by empty + space between matrices), here we introduce element-wise + products (denoted by symbol `*`) so that the Rayleight-Ritz + procedure becomes:: + + SAS = S^T A S + SBS = S^T B S + d = () ** -1/2 # this is 1-d column vector + dd = d d^T # this is 2-d matrix + R^T R = Cholesky(dd * SBS) + Ri = R^-1 * d # broadcasting + solve symeig problem Ri^T SAS Ri Z = Theta Z + C = Ri Z + + where `dd` is 2-d matrix that replaces matrix products `D M + D` with one element-wise product `M * dd`; and `d` replaces + matrix product `D M` with element-wise product `M * + d`. Also, creating the diagonal matrix `D` is avoided. + + Args: + S (Tensor): the matrix basis for the search subspace, size is + :math:`(m, n)`. + + Returns: + Ri (tensor): upper-triangular transformation matrix of size + :math:`(n, n)`. + + """ + B = self.B + SBS = _utils.qform(B, S) + d_row = SBS.diagonal(0, -2, -1) ** -0.5 + d_col = d_row.reshape(d_row.shape[0], 1) + # TODO use torch.linalg.cholesky_solve once it is implemented + R = torch.linalg.cholesky((SBS * d_row) * d_col, upper=True) + return torch.linalg.solve_triangular( + R, d_row.diag_embed(), upper=True, left=False + ) + + def _get_svqb(self, U: Tensor, drop: bool, tau: float) -> Tensor: + """Return B-orthonormal U. + + .. note:: When `drop` is `False` then `svqb` is based on the + Algorithm 4 from [DuerschPhD2015] that is a slight + modification of the corresponding algorithm + introduced in [StathopolousWu2002]. + + Args: + + U (Tensor) : initial approximation, size is (m, n) + drop (bool) : when True, drop columns that + contribution to the `span([U])` is small. + tau (float) : positive tolerance + + Returns: + + U (Tensor) : B-orthonormal columns (:math:`U^T B U = I`), size + is (m, n1), where `n1 = n` if `drop` is `False, + otherwise `n1 <= n`. + + """ + if torch.numel(U) == 0: + return U + UBU = _utils.qform(self.B, U) + d = UBU.diagonal(0, -2, -1) + + # Detect and drop exact zero columns from U. While the test + # `abs(d) == 0` is unlikely to be True for random data, it is + # possible to construct input data to lobpcg where it will be + # True leading to a failure (notice the `d ** -0.5` operation + # in the original algorithm). To prevent the failure, we drop + # the exact zero columns here and then continue with the + # original algorithm below. + nz = torch.where(abs(d) != 0.0) + assert len(nz) == 1, nz + if len(nz[0]) < len(d): + U = U[:, nz[0]] + if torch.numel(U) == 0: + return U + UBU = _utils.qform(self.B, U) + d = UBU.diagonal(0, -2, -1) + nz = torch.where(abs(d) != 0.0) + assert len(nz[0]) == len(d) + + # The original algorithm 4 from [DuerschPhD2015]. + d_col = (d**-0.5).reshape(d.shape[0], 1) + DUBUD = (UBU * d_col) * d_col.mT + E, Z = _utils.symeig(DUBUD) + t = tau * abs(E).max() + if drop: + keep = torch.where(E > t) + assert len(keep) == 1, keep + E = E[keep[0]] + Z = Z[:, keep[0]] + d_col = d_col[keep[0]] + else: + E[(torch.where(E < t))[0]] = t + + return torch.matmul( + U * d_col.mT, + # pyrefly: ignore [unsupported-operation] + Z * E**-0.5, + ) + + def _get_ortho(self, U, V): + """Return B-orthonormal U with columns are B-orthogonal to V. + + .. note:: When `bparams["ortho_use_drop"] == False` then + `_get_ortho` is based on the Algorithm 3 from + [DuerschPhD2015] that is a slight modification of + the corresponding algorithm introduced in + [StathopolousWu2002]. Otherwise, the method + implements Algorithm 6 from [DuerschPhD2015] + + .. note:: If all U columns are B-collinear to V then the + returned tensor U will be empty. + + Args: + + U (Tensor) : initial approximation, size is (m, n) + V (Tensor) : B-orthogonal external basis, size is (m, k) + + Returns: + + U (Tensor) : B-orthonormal columns (:math:`U^T B U = I`) + such that :math:`V^T B U=0`, size is (m, n1), + where `n1 = n` if `drop` is `False, otherwise + `n1 <= n`. + """ + mm = torch.matmul + mm_B = _utils.matmul + m = self.iparams["m"] + tau_ortho = self.fparams["ortho_tol"] + tau_drop = self.fparams["ortho_tol_drop"] + tau_replace = self.fparams["ortho_tol_replace"] + i_max = self.iparams["ortho_i_max"] + j_max = self.iparams["ortho_j_max"] + # when use_drop==True, enable dropping U columns that have + # small contribution to the `span([U, V])`. + use_drop = self.bparams["ortho_use_drop"] + + # clean up variables from the previous call + for vkey in list(self.fvars.keys()): + if vkey.startswith("ortho_") and vkey.endswith("_rerr"): + self.fvars.pop(vkey) + self.ivars.pop("ortho_i", 0) + self.ivars.pop("ortho_j", 0) + + BV_norm = torch.norm(mm_B(self.B, V)) + BU = mm_B(self.B, U) + VBU = mm(V.mT, BU) + i = j = 0 + for i in range(i_max): + U = U - mm(V, VBU) + drop = False + tau_svqb = tau_drop + for j in range(j_max): + if use_drop: + U = self._get_svqb(U, drop, tau_svqb) + drop = True + tau_svqb = tau_replace + else: + U = self._get_svqb(U, False, tau_replace) + if torch.numel(U) == 0: + # all initial U columns are B-collinear to V + self.ivars["ortho_i"] = i + self.ivars["ortho_j"] = j + return U + BU = mm_B(self.B, U) + UBU = mm(U.mT, BU) + U_norm = torch.norm(U) + BU_norm = torch.norm(BU) + R = UBU - torch.eye(UBU.shape[-1], device=UBU.device, dtype=UBU.dtype) + R_norm = torch.norm(R) + # https://github.com/pytorch/pytorch/issues/33810 workaround: + rerr = float(R_norm) * float(BU_norm * U_norm) ** -1 + vkey = f"ortho_UBUmI_rerr[{i}, {j}]" + self.fvars[vkey] = rerr + if rerr < tau_ortho: + break + VBU = mm(V.mT, BU) + VBU_norm = torch.norm(VBU) + U_norm = torch.norm(U) + rerr = float(VBU_norm) * float(BV_norm * U_norm) ** -1 + vkey = f"ortho_VBU_rerr[{i}]" + self.fvars[vkey] = rerr + if rerr < tau_ortho: + break + if m < U.shape[-1] + V.shape[-1]: + # TorchScript needs the class var to be assigned to a local to + # do optional type refinement + B = self.B + assert B is not None + raise ValueError( + "Overdetermined shape of U:" + f" #B-cols(={B.shape[-1]}) >= #U-cols(={U.shape[-1]}) + #V-cols(={V.shape[-1]}) must hold" + ) + self.ivars["ortho_i"] = i + self.ivars["ortho_j"] = j + return U + + +# Calling tracker is separated from LOBPCG definitions because +# TorchScript does not support user-defined callback arguments: +LOBPCG_call_tracker_orig = LOBPCG.call_tracker + + +def LOBPCG_call_tracker(self): + self.tracker(self) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_lowrank.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_lowrank.py new file mode 100644 index 0000000000000000000000000000000000000000..7ae290ab180e6ac455b76dfc9092721c75ec8cf1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_lowrank.py @@ -0,0 +1,293 @@ +"""Implement various linear algebra algorithms for low rank matrices.""" + +__all__ = ["svd_lowrank", "pca_lowrank"] + + +import torch +from torch import _linalg_utils as _utils, Tensor +from torch.overrides import handle_torch_function, has_torch_function + + +def get_approximate_basis( + A: Tensor, + q: int, + niter: int | None = 2, + M: Tensor | None = None, +) -> Tensor: + """Return tensor :math:`Q` with :math:`q` orthonormal columns such + that :math:`Q Q^H A` approximates :math:`A`. If :math:`M` is + specified, then :math:`Q` is such that :math:`Q Q^H (A - M)` + approximates :math:`A - M`. without instantiating any tensors + of the size of :math:`A` or :math:`M`. + + .. note:: The implementation is based on the Algorithm 4.4 from + Halko et al., 2009. + + .. note:: For an adequate approximation of a k-rank matrix + :math:`A`, where k is not known in advance but could be + estimated, the number of :math:`Q` columns, q, can be + chosen according to the following criteria: in general, + :math:`k <= q <= min(2*k, m, n)`. For large low-rank + matrices, take :math:`q = k + 5..10`. If k is + relatively small compared to :math:`min(m, n)`, choosing + :math:`q = k + 0..2` may be sufficient. + + .. note:: To obtain repeatable results, reset the seed for the + pseudorandom number generator + + Args:: + A (Tensor): the input tensor of size :math:`(*, m, n)` + + q (int): the dimension of subspace spanned by :math:`Q` + columns. + + niter (int, optional): the number of subspace iterations to + conduct; ``niter`` must be a + nonnegative integer. In most cases, the + default value 2 is more than enough. + + M (Tensor, optional): the input tensor's mean of size + :math:`(*, m, n)`. + + References:: + - Nathan Halko, Per-Gunnar Martinsson, and Joel Tropp, Finding + structure with randomness: probabilistic algorithms for + constructing approximate matrix decompositions, + arXiv:0909.4061 [math.NA; math.PR], 2009 (available at + `arXiv `_). + """ + + niter = 2 if niter is None else niter + dtype = _utils.get_floating_dtype(A) if not A.is_complex() else A.dtype + matmul = _utils.matmul + + R = torch.randn(A.shape[-1], q, dtype=dtype, device=A.device) + + # The following code could be made faster using torch.geqrf + torch.ormqr + # but geqrf is not differentiable + + X = matmul(A, R) + if M is not None: + X = X - matmul(M, R) + Q = torch.linalg.qr(X).Q + for _ in range(niter): + X = matmul(A.mH, Q) + if M is not None: + X = X - matmul(M.mH, Q) + Q = torch.linalg.qr(X).Q + X = matmul(A, Q) + if M is not None: + X = X - matmul(M, Q) + Q = torch.linalg.qr(X).Q + return Q + + +def svd_lowrank( + A: Tensor, + q: int | None = 6, + niter: int | None = 2, + M: Tensor | None = None, +) -> tuple[Tensor, Tensor, Tensor]: + r"""Return the singular value decomposition ``(U, S, V)`` of a matrix, + batches of matrices, or a sparse matrix :math:`A` such that + :math:`A \approx U \operatorname{diag}(S) V^{\text{H}}`. In case :math:`M` is given, then + SVD is computed for the matrix :math:`A - M`. + + .. note:: The implementation is based on the Algorithm 5.1 from + Halko et al., 2009. + + .. note:: For an adequate approximation of a k-rank matrix + :math:`A`, where k is not known in advance but could be + estimated, the number of :math:`Q` columns, q, can be + chosen according to the following criteria: in general, + :math:`k <= q <= min(2*k, m, n)`. For large low-rank + matrices, take :math:`q = k + 5..10`. If k is + relatively small compared to :math:`min(m, n)`, choosing + :math:`q = k + 0..2` may be sufficient. + + .. note:: This is a randomized method. To obtain repeatable results, + set the seed for the pseudorandom number generator + + .. note:: In general, use the full-rank SVD implementation + :func:`torch.linalg.svd` for dense matrices due to its 10x + higher performance characteristics. The low-rank SVD + will be useful for huge sparse matrices that + :func:`torch.linalg.svd` cannot handle. + + Args:: + A (Tensor): the input tensor of size :math:`(*, m, n)` + + q (int, optional): a slightly overestimated rank of A. + + niter (int, optional): the number of subspace iterations to + conduct; niter must be a nonnegative + integer, and defaults to 2 + + M (Tensor, optional): the input tensor's mean of size + :math:`(*, m, n)`, which will be broadcasted + to the size of A in this function. + + References:: + - Nathan Halko, Per-Gunnar Martinsson, and Joel Tropp, Finding + structure with randomness: probabilistic algorithms for + constructing approximate matrix decompositions, + arXiv:0909.4061 [math.NA; math.PR], 2009 (available at + `arXiv `_). + + """ + if not torch.jit.is_scripting(): + tensor_ops = (A, M) + if not set(map(type, tensor_ops)).issubset( + (torch.Tensor, type(None)) + ) and has_torch_function(tensor_ops): + return handle_torch_function( + svd_lowrank, tensor_ops, A, q=q, niter=niter, M=M + ) + return _svd_lowrank(A, q=q, niter=niter, M=M) + + +def _svd_lowrank( + A: Tensor, + q: int | None = 6, + niter: int | None = 2, + M: Tensor | None = None, +) -> tuple[Tensor, Tensor, Tensor]: + # Algorithm 5.1 in Halko et al., 2009 + + q = 6 if q is None else q + m, n = A.shape[-2:] + matmul = _utils.matmul + if M is not None: + M = M.broadcast_to(A.size()) + + # Assume that A is tall + if m < n: + A = A.mH + if M is not None: + M = M.mH + + Q = get_approximate_basis(A, q, niter=niter, M=M) + B = matmul(Q.mH, A) + if M is not None: + B = B - matmul(Q.mH, M) + U, S, Vh = torch.linalg.svd(B, full_matrices=False) + V = Vh.mH + U = Q.matmul(U) + + if m < n: + U, V = V, U + + return U, S, V + + +def pca_lowrank( + A: Tensor, + q: int | None = None, + center: bool = True, + niter: int = 2, +) -> tuple[Tensor, Tensor, Tensor]: + r"""Performs linear Principal Component Analysis (PCA) on a low-rank + matrix, batches of such matrices, or sparse matrix. + + This function returns a namedtuple ``(U, S, V)`` which is the + nearly optimal approximation of a singular value decomposition of + a centered matrix :math:`A` such that :math:`A \approx U \operatorname{diag}(S) V^{\text{H}}` + + .. note:: The relation of ``(U, S, V)`` to PCA is as follows: + + - :math:`A` is a data matrix with ``m`` samples and + ``n`` features + + - the :math:`V` columns represent the principal directions + + - :math:`S ** 2 / (m - 1)` contains the eigenvalues of + :math:`A^T A / (m - 1)` which is the covariance of + ``A`` when ``center=True`` is provided. + + - ``matmul(A, V[:, :k])`` projects data to the first k + principal components + + .. note:: Different from the standard SVD, the size of returned + matrices depend on the specified rank and q + values as follows: + + - :math:`U` is m x q matrix + + - :math:`S` is q-vector + + - :math:`V` is n x q matrix + + .. note:: To obtain repeatable results, reset the seed for the + pseudorandom number generator + + Args: + + A (Tensor): the input tensor of size :math:`(*, m, n)` + + q (int, optional): a slightly overestimated rank of + :math:`A`. By default, ``q = min(6, m, + n)``. + + center (bool, optional): if True, center the input tensor, + otherwise, assume that the input is + centered. + + niter (int, optional): the number of subspace iterations to + conduct; niter must be a nonnegative + integer, and defaults to 2. + + References:: + + - Nathan Halko, Per-Gunnar Martinsson, and Joel Tropp, Finding + structure with randomness: probabilistic algorithms for + constructing approximate matrix decompositions, + arXiv:0909.4061 [math.NA; math.PR], 2009 (available at + `arXiv `_). + + """ + + if not torch.jit.is_scripting(): + if type(A) is not torch.Tensor and has_torch_function((A,)): + return handle_torch_function( + pca_lowrank, (A,), A, q=q, center=center, niter=niter + ) + + (m, n) = A.shape[-2:] + + if q is None: + q = min(6, m, n) + elif not (q >= 0 and q <= min(m, n)): + raise ValueError( + f"q(={q}) must be non-negative integer and not greater than min(m, n)={min(m, n)}" + ) + if not (niter >= 0): + raise ValueError(f"niter(={niter}) must be non-negative integer") + + dtype = _utils.get_floating_dtype(A) + + if not center: + return _svd_lowrank(A, q, niter=niter, M=None) + + if _utils.is_sparse(A): + if len(A.shape) != 2: + raise ValueError("pca_lowrank input is expected to be 2-dimensional tensor") + c = torch.sparse.sum(A, dim=(-2,)) / m + # reshape c + column_indices = c.indices()[0] + indices = torch.zeros( + 2, + len(column_indices), + dtype=column_indices.dtype, + device=column_indices.device, + ) + indices[0] = column_indices + C_t = torch.sparse_coo_tensor( + indices, c.values(), (n, 1), dtype=dtype, device=A.device + ) + + ones_m1_t = torch.ones(A.shape[:-2] + (1, m), dtype=dtype, device=A.device) + M = torch.sparse.mm(C_t, ones_m1_t).mT + return _svd_lowrank(A, q, niter=niter, M=M) + else: + C = A.mean(dim=(-2,), keepdim=True) + return _svd_lowrank(A - C, q, niter=niter, M=None) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_meta_registrations.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_meta_registrations.py new file mode 100644 index 0000000000000000000000000000000000000000..2428682d02caaffc1e29a0186c786464d3aa3ddc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_meta_registrations.py @@ -0,0 +1,8456 @@ +# mypy: allow-untyped-defs +import math +from collections.abc import Callable, Sequence +from enum import Enum +from functools import wraps +from typing import TypeVar +from typing_extensions import ParamSpec + +import torch +import torch._prims_common as utils +from torch import SymBool, SymFloat, Tensor +from torch._decomp import ( + _add_op_to_registry, + _convert_out_params, + global_decomposition_table, + meta_table, +) +from torch._ops import OpOverload +from torch._prims import _prim_elementwise_meta, ELEMENTWISE_PRIM_TYPE_PROMOTION_KIND +from torch._prims_common import ( + BoolLike, + corresponding_complex_dtype, + corresponding_real_dtype, + elementwise_dtypes, + ELEMENTWISE_TYPE_PROMOTION_KIND, + FloatLike, + IntLike, + make_contiguous_strides_for, + Number, + suggest_memory_format, + TensorLike, +) +from torch._prims_common.wrappers import ( + _maybe_convert_to_dtype, + _maybe_resize_out, + _resize_output_check, + _safe_copy_out, + out_wrapper, +) +from torch._refs import _broadcast_shapes, _maybe_broadcast +from torch.fx.experimental import _config as exp_config +from torch.nn.functional import ScalingType, SwizzleType +from torch.utils import _pytree as pytree + + +_T = TypeVar("_T") +_P = ParamSpec("_P") + +aten = torch.ops.aten + +_meta_lib_dont_use_me_use_register_meta = torch.library.Library("aten", "IMPL", "Meta") +MODE_SUM, MODE_MEAN, MODE_MAX = range(3) + + +def ceil_div(a, b): + return (a + b - 1) // b + + +def round_up(x, y): + """Rounds up x to nearest multiple of y""" + return ((x + y - 1) // y) * y + + +def register_meta(op) -> Callable[[Callable[_P, _T]], Callable[_P, _T]]: + def wrapper(fn): + fn = _convert_out_params(fn) + + def register(op): + _add_op_to_registry(meta_table, op, fn) + + pytree.tree_map_(register, op) + return fn + + return wrapper + + +def elementwise_meta( + *args, + type_promotion: ELEMENTWISE_TYPE_PROMOTION_KIND, +): + # Perform type promotion, as this is expected from prim_metafunction + _, result_dtype = utils.elementwise_dtypes( + *args, + type_promotion_kind=type_promotion, + ) + args = [_maybe_convert_to_dtype(x, result_dtype) for x in args] + + # Broadcast + args = _maybe_broadcast(*args) + + # Perform prim checks + return _prim_elementwise_meta( + *args, type_promotion=ELEMENTWISE_PRIM_TYPE_PROMOTION_KIND.DEFAULT + ) + + +def toRealValueType(dtype): + from_complex = { + torch.complex32: torch.half, + torch.cfloat: torch.float, + torch.cdouble: torch.double, + } + return from_complex.get(dtype, dtype) + + +def check_inplace_broadcast(self_shape, *args_shape): + broadcasted_shape = tuple(_broadcast_shapes(self_shape, *args_shape)) + torch._check( + broadcasted_shape == self_shape, + lambda: f"output with shape {self_shape} doesn't match the broadcast shape {broadcasted_shape}", + ) + + +@register_meta([aten.linspace, aten.logspace]) +@out_wrapper() +def meta_linspace_logspace( + start, + end, + steps, + base=None, + dtype=None, + device=None, + layout=torch.strided, + pin_memory=False, + requires_grad=False, +): + if isinstance(start, torch.Tensor): + torch._check( + start.dim() == 0, + lambda: "linspace only supports 0-dimensional start and end tensors", + ) + if isinstance(end, torch.Tensor): + torch._check( + end.dim() == 0, + lambda: "linspace only supports 0-dimensional start and end tensors", + ) + + if any(isinstance(arg, complex) for arg in (start, end, steps)): + default_complex_dtype = utils.corresponding_complex_dtype( + torch.get_default_dtype() + ) + if dtype is None: + dtype = default_complex_dtype + else: + torch._check( + utils.is_complex_dtype(dtype), + lambda: f"linspace(): inferred dtype {default_complex_dtype} can't be safely cast to passed dtype {dtype}", + ) + else: + dtype = dtype or torch.get_default_dtype() + assert isinstance(dtype, torch.dtype) + + # steps does not participate in the computation of the dtype + torch._check_type( + isinstance(steps, IntLike), + lambda: f"received an invalid combination of arguments - got \ +({type(start).__name__}, {type(end).__name__}, {type(steps).__name__})", + ) + assert isinstance(steps, IntLike) # for mypy + torch._check(steps >= 0, lambda: "number of steps must be non-negative") + + return torch.empty( + (steps,), # type: ignore[arg-type] + dtype=dtype, + layout=layout, + device="meta", + pin_memory=pin_memory, + requires_grad=requires_grad, + ) + + +@register_meta([aten.take.default, aten.take.out]) +@out_wrapper() +def meta_take(self, index): + # Type and device checks + torch._check( + index.dtype == torch.long, + lambda: f"take(): Expected a long tensor for index, but got {index.dtype}", + ) + # Index checks + torch._check_index( + not (self.numel() == 0 and index.numel() != 0), + lambda: "take(): tried to take from an empty tensor", + ) + return self.new_empty(index.shape) + + +@register_meta([aten.linalg_cross.default, aten.linalg_cross.out]) +@out_wrapper() +def linalg_cross(self, other, *, dim=-1): + x_d = self.ndim + y_d = other.ndim + torch._check( + x_d == y_d, + lambda: "linalg.cross: inputs must have the same number of dimensions.", + ) + torch._check( + self.size(dim) == 3 and other.size(dim) == 3, + lambda: ( + f"linalg.cross: inputs dimension {dim} must have length 3. " + f"Got {self.size(dim)} and {other.size(dim)}" + ), + ) + out_shape = _broadcast_shapes(self.shape, other.shape) + return self.new_empty(out_shape) + + +@register_meta(aten.linalg_matrix_exp) +@out_wrapper() +def linalg_matrix_exp(self): + squareCheckInputs(self, "linalg.matrix_exp") + checkFloatingOrComplex(self, "linalg.matrix_exp") + return torch.empty_like(self, memory_format=torch.contiguous_format) + + +@register_meta( + [aten.cummax.default, aten.cummax.out, aten.cummin.default, aten.cummin.out] +) +@out_wrapper("values", "indices") +def cummaxmin(self, dim): + values = torch.empty(self.shape, device=self.device, dtype=self.dtype) + indices = torch.empty(self.shape, device=self.device, dtype=torch.int64) + if self.numel() != 0 and self.ndim != 0: + # Checks that dim is within bounds + maybe_wrap_dim(dim, self.ndim) + return values, indices + + +@register_meta([aten.logcumsumexp.default, aten.logcumsumexp.out]) +@out_wrapper() +def logcumsumexp(self, dim): + # Checks that dim is within bounds + maybe_wrap_dim(dim, self.ndim) + return torch.empty_like(self, memory_format=torch.contiguous_format) + + +# Stride-related code from _exec_fft in aten/src/ATen/native/mkl/SpectralOps.cpp +# and aten/src/ATen/cuda/SpectralOps.cpp +# +# Although the actual FFT launch is different, all the permuting code appears +# to be the same +def _exec_fft(out, self, out_sizes, dim, *, forward): + ndim = self.ndim + signal_ndim = len(dim) + batch_dims = ndim - signal_ndim + + # Permute dimensions so batch dimensions come first, and in stride order + dim_permute = list(range(ndim)) + + is_transformed_dim = [False for _ in range(ndim)] + for d in dim: + is_transformed_dim[d] = True + + # std::partition + left, right = [], [] + for d in dim_permute: + if not is_transformed_dim[d]: + left.append(d) + else: + right.append(d) + dim_permute = left + right + batch_end = len(left) + + self_strides = self.stride() + tmp = dim_permute[:batch_end] + tmp.sort(key=lambda x: self_strides[x], reverse=True) + dim_permute = tmp + dim_permute[batch_end:] + input = self.permute(dim_permute) + + # Collapse batch dimensions into a single dimension + batched_sizes = [-1] + list(input.shape[batch_dims:]) + input = input.reshape(batched_sizes) + + batch_size = input.size(0) + batched_sizes[0] = batch_size + batched_out_sizes = list(batched_sizes) + for i in range(len(dim)): + batched_out_sizes[i + 1] = out_sizes[dim[i]] + out.resize_(batched_out_sizes, memory_format=torch.contiguous_format) + + # Inplace reshaping to original batch shape and inverting the dimension permutation + out_strides = [0 for _ in range(ndim)] + batch_numel = 1 + i = batch_dims - 1 + while i >= 0: + out_strides[dim_permute[i]] = batch_numel * out.stride(0) + batch_numel *= out_sizes[dim_permute[i]] + i -= 1 + for i in range(batch_dims, ndim): + out_strides[dim_permute[i]] = out.stride(1 + (i - batch_dims)) + out.as_strided_(out_sizes, out_strides, out.storage_offset()) + + return out + + +def _sort_dims(self: Tensor, dim: list[int], exclude_last: bool = False): + sorted_dims = list(dim) + self_strides = self.stride() + sorted_dims[: len(sorted_dims) - int(exclude_last)].sort( + key=lambda i: self_strides[i] + ) + return sorted_dims + + +# See _fft_c2c_cufft in aten/src/ATen/native/cuda/SpectralOps.cpp +# and _fft_c2c_mkl in aten/src/ATen/native/mkl/SpectralOps.cpp +@register_meta([aten._fft_c2c.default, aten._fft_c2c.out]) +@out_wrapper() +def meta_fft_c2c(self, dim, normalization, forward): + torch._check(self.dtype.is_complex) + if not dim: + return self.clone() + + sorted_dims = _sort_dims(self, dim) + out = self.new_empty(self.size()) + return _exec_fft(out, self, self.size(), sorted_dims, forward=forward) + + +cufft_max_ndim = 3 + + +def use_optimized_cufft_path(dim: list[int]): + if len(dim) > cufft_max_ndim or (len(dim) >= 2 and dim[0] == 0 and dim[1] == 1): + return False + else: + return True + + +@register_meta([aten._fft_r2c.default, aten._fft_r2c.out]) +@out_wrapper() +def meta_fft_r2c(self, dim, normalization, onesided): + torch._check(self.dtype.is_floating_point) + input_sizes = list(self.size()) + out_sizes = list(input_sizes) + last_dim = dim[-1] + last_dim_halfsize = input_sizes[last_dim] // 2 + 1 + onesided_sizes = list(input_sizes) + onesided_sizes[last_dim] = last_dim_halfsize + + if onesided: + out_sizes[last_dim] = last_dim_halfsize + + if device_hint(self) == "cuda" or device_hint(self) == "xpu": + # _fft_r2c_cufft in aten/src/ATen/native/cuda/SpectralOps.cpp + # _fft_r2c_xpu in torch-xpu-ops/src/ATen/native/xpu/SpectralOps.cpp + output = self.new_empty( + out_sizes, dtype=utils.corresponding_complex_dtype(self.dtype) + ) + + working_tensor = self + if device_hint(self) == "cuda" and use_optimized_cufft_path(dim): + _exec_fft(output, working_tensor, out_sizes, dim, forward=True) + else: + # First do the R2C transform on the last dimension + target_sizes = out_sizes if len(dim) == 1 else onesided_sizes + _exec_fft(output, working_tensor, target_sizes, [last_dim], forward=True) + if len(dim) > 1: + working_tensor = self.new_empty( + out_sizes, dtype=utils.corresponding_complex_dtype(self.dtype) + ) + + # Then any remaining C2C transforms + sorted_dims = dim[:-1] + while sorted_dims: + output, working_tensor = working_tensor, output + strides = working_tensor.stride() + sorted_dims.sort( + key=lambda i: strides[i], reverse=True + ) # NB reverse! Not sure if this is og bug + max_dims = min(cufft_max_ndim, len(sorted_dims)) + last_dims = sorted_dims[len(sorted_dims) - max_dims :] + _exec_fft( + output, working_tensor, onesided_sizes, last_dims, forward=True + ) + sorted_dims = sorted_dims[: len(sorted_dims) - max_dims] + + if not onesided: + if output.size(last_dim) != out_sizes[last_dim]: + working_tensor.resize_(out_sizes, memory_format=torch.contiguous_format) + output = working_tensor + + return output + + else: + return self.new_empty( + out_sizes, dtype=utils.corresponding_complex_dtype(self.dtype) + ) + + +@register_meta(aten.randperm.generator_out) +def meta_randperm(n, *, generator=None, out): + return _maybe_resize_out(out, torch.Size([n])) + + +@register_meta(aten.randperm.default) +def meta_randperm_default( + n, + *, + dtype=torch.long, + layout=None, + device=None, + pin_memory=None, +): + return torch.empty( + n, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory + ) + + +@register_meta([aten.randint.default, aten.randint.out]) +@out_wrapper() +def meta_randint( + high, + size, + *, + dtype=torch.long, + layout=None, + device=None, + pin_memory=None, +): + low = 0 + torch._check( + high > low, + lambda: f"random_ expects 'from' to be less than 'to', but got from={low} >= to={high}", + ) + return torch.empty( + size, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory + ) + + +@register_meta([aten.randint.low, aten.randint.low_out]) +@out_wrapper() +def meta_randint_low( + low, + high, + size, + *, + dtype=torch.long, + layout=None, + device=None, + pin_memory=None, +): + torch._check( + high > low, + lambda: f"random_ expects 'from' to be less than 'to', but got from={low} >= to={high}", + ) + return torch.empty( + size, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory + ) + + +@register_meta([aten.rand.default, aten.rand.out]) +@out_wrapper() +def meta_rand_default(size, *, dtype=None, layout=None, device=None, pin_memory=None): + return torch.empty( + size, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory + ) + + +@register_meta([aten._fft_c2r.default, aten._fft_c2r.out]) +@out_wrapper() +def meta_fft_c2r(self: Tensor, dim: list[int], normalization: int, lastdim: int): + # _fft_c2r_mkl + torch._check(self.dtype.is_complex) + + if device_hint(self) == "cuda": + out_sizes = list(self.size()) + out_sizes[dim[-1]] = lastdim + + output = self.new_empty(out_sizes, dtype=toRealValueType(self.dtype)) + + if use_optimized_cufft_path(dim): + return _exec_fft( + output, + self.clone(memory_format=torch.contiguous_format), + out_sizes, + dim, + forward=False, + ) + else: + # First complete any C2C transforms + if len(dim) > 1: + temp = meta_fft_c2c(self, dim[:-1], 0, lastdim) # fft_norm_mode::none + else: + temp = self.clone(memory_format=torch.contiguous_format) + return _exec_fft(output, temp, out_sizes, [dim[-1]], forward=False) + + else: + input = self + if len(dim) > 1: + c2c_dims = dim[:-1] + input = meta_fft_c2c(self, c2c_dims, normalization, forward=False) + dim = dim[-1:] + + out_sizes = list(input.size()) + out_sizes[dim[-1]] = lastdim + out = self.new_empty(out_sizes, dtype=toRealValueType(self.dtype)) + return _exec_fft(out, input, out_sizes, dim, forward=False) + + +@register_meta(aten.copy_.default) +def meta_copy_(self, src, non_blocking=False): + # This code simulates the original decomp from inductor, + # which runs most of the meta checks that we care about. + # In theory, we should make this more robust by carefully + # auditing our C++ copy_() kernel and copying the checks here. + from torch.fx.experimental.symbolic_shapes import free_unbacked_symbols + + # TODO: Ideally, we'd insert a deferred runtime assert here, but if we are + # calling an actual copy_, you'll get that automatically + # https://github.com/pytorch/pytorch/issues/122477 + if ( + not free_unbacked_symbols(self) and torch._debug_has_internal_overlap(self) == 1 + ): # 1 == MemOverlap::Yes + raise RuntimeError( + "more than one element of the written-to tensor refers to a single memory location" + ) + + if isinstance(src, Tensor): + intermediate = src.to(self, non_blocking) + if self.size() != intermediate.size(): + aten.expand_copy.default(intermediate, self.size()) + return self + + +def inferUnsqueezeGeometry(tensor, dim): + result_sizes = list(tensor.size()) + result_strides = list(tensor.stride()) + # pyrefly: ignore [unsupported-operation] + new_stride = 1 if dim >= tensor.dim() else result_sizes[dim] * result_strides[dim] + # pyrefly: ignore [bad-argument-type] + result_sizes.insert(dim, 1) + # pyrefly: ignore [bad-argument-type] + result_strides.insert(dim, new_stride) + return result_sizes, result_strides + + +@register_meta(aten.unsqueeze_.default) +def meta_unsqueeze_(self, dim): + dim = maybe_wrap_dim(dim, self.dim() + 1) + g_sizes, g_strides = inferUnsqueezeGeometry(self, dim) + self.as_strided_(g_sizes, g_strides) + return self + + +@register_meta(aten._sparse_semi_structured_linear) +def meta_sparse_structured_linear( + input: Tensor, + weight: Tensor, + _meta: Tensor, + bias: Tensor | None = None, + _activation_opt: str | None = None, + out_dtype: torch.dtype | None = None, +): + output_sizes = list(input.shape) + if bias is not None: + assert weight.size(0) == bias.size(0), "output size mismatch" + assert weight.size(1) == input.size(-1) / 2 + output_sizes[-1] = weight.size(0) + + # see: https://github.com/pytorch/pytorch/pull/114477#issuecomment-1830121375 + # We assume that we have already squashed the inputs into a 2-D tensor + # Then, as the output is transposed, we need to propagate the transposed + # stride information to the output tensor + assert len(input.shape) == 2, "we can only handle the squashed input case" + transposed_strides = (1, input.size(0)) + + if out_dtype is not None: + assert input.dtype == torch.int8 and out_dtype == torch.int32, ( + "out_dtype is only supported for i8i8->i32 linear operator" + ) + output = input.new_empty( + output_sizes, + dtype=input.dtype if out_dtype is None else out_dtype, + ).as_strided(output_sizes, transposed_strides) + + return output + + +@register_meta(aten._sparse_semi_structured_mm) +def meta_sparse_structured_mm( + mat1: Tensor, + mat1_meta: Tensor, + mat2: Tensor, + out_dtype: torch.dtype | None = None, +): + assert len(mat1.shape) == 2 + assert len(mat1_meta.shape) == 2 + assert len(mat2.shape) == 2 + assert mat1.size(1) == mat2.size(0) / 2 + output_sizes = [mat1.size(0), mat2.size(1)] + + if out_dtype is not None: + assert mat2.dtype == torch.int8 and out_dtype == torch.int32, ( + "out_dtype is only supported for i8i8->i32 linear operator" + ) + output = mat2.new_empty( + output_sizes, + dtype=mat2.dtype if out_dtype is None else out_dtype, + ) + + return output + + +@register_meta(aten._sparse_semi_structured_addmm) +def meta_sparse_structured_addmm( + input: Tensor, + mat1: Tensor, + mat1_meta: Tensor, + mat2: Tensor, + *, + alpha=1, + beta=1, + out_dtype: torch.dtype | None = None, +): + assert len(input.shape) == 1, ( + "only input broadcasted to columns of mat1 * mat2 product is supported" + ) + assert len(mat1.shape) == 2 + assert len(mat1_meta.shape) == 2 + assert len(mat2.shape) == 2 + assert input.size(0) == mat1.size(0), ( + "only input broadcasted to columns of mat1 * mat2 product is supported" + ) + assert mat1.size(1) == mat2.size(0) / 2 + output_sizes = [mat1.size(0), mat2.size(1)] + + if out_dtype is not None: + assert mat2.dtype == torch.int8 and out_dtype == torch.int32, ( + "out_dtype is only supported for i8i8->i32 linear operator" + ) + output = mat2.new_empty( + output_sizes, + dtype=mat2.dtype if out_dtype is None else out_dtype, + ) + + return output + + +@register_meta(aten._cslt_sparse_mm) +def meta__cslt_sparse_mm( + compressed_A: torch.Tensor, + dense_B: torch.Tensor, + bias: Tensor | None = None, + alpha: Tensor | None = None, + out_dtype: torch.dtype | None = None, + transpose_result: bool = False, + alg_id: int = 0, + split_k: int = 1, + split_k_mode: int = -1, +): + assert dense_B.dtype in { + torch.float32, + torch.float16, + torch.bfloat16, + torch.int8, + torch.float8_e4m3fn, + }, "_cslt_sparse_mm only supports fp16, bf16, int8, and fp8e4m3" + assert compressed_A.dtype == dense_B.dtype, "inputs must have the same dtype" + assert len(dense_B.shape) == 2, "_cslt_sparse_mm only supports 2d inputs" + + is_8bit_input_type = compressed_A.dtype in [torch.int8, torch.float8_e4m3fn] + + if is_8bit_input_type: + assert not dense_B.is_contiguous(), ( + "dense input must be transposed for 8bit dtypes" + ) + + n = dense_B.size(1) + m = compressed_A.size(0) + if bias is not None: + assert m == bias.size(0) + + if out_dtype is not None: + assert is_8bit_input_type and out_dtype in { + torch.float16, + torch.bfloat16, + torch.int32, + torch.float8_e4m3fn, + }, ( + f"out_dtype is not supported for {compressed_A.dtype} x {dense_B.dtype} -> {out_dtype} matmul!" + ) + output_shape = (n, m) if transpose_result else (m, n) + return dense_B.new_empty(output_shape, dtype=out_dtype) + + +@register_meta(aten.index_reduce.default) +def meta_index_reduce( + self: Tensor, + dim: int, + index: Tensor, + source: torch.Tensor, + reduce: str, + *, + include_self: bool = True, +) -> Tensor: + return torch.empty_like(self, memory_format=torch.contiguous_format) + + +@register_meta(aten.index_reduce_.default) +def meta_index_reduce_( + self: Tensor, + dim: int, + index: Tensor, + source: torch.Tensor, + reduce: str, + *, + include_self: bool = True, +) -> Tensor: + return self + + +# Implementations below are taken from https://github.com/albanD/subclass_zoo/blob/main/python_meta_tensor.py +@out_wrapper() +@register_meta(aten.index_select.default) +def meta_index_select(self, dim, index): + result_size = list(self.size()) + if self.dim() > 0: + result_size[dim] = index.numel() + return self.new_empty(result_size) + + +@register_meta(aten.segment_reduce.default) +def meta_segment_reduce( + data: Tensor, + reduce: str, + *, + lengths: Tensor | None = None, + indices: Tensor | None = None, + offsets: Tensor | None = None, + axis: int = 0, + unsafe: bool = False, + initial=None, +) -> Tensor: + if indices is not None: + raise NotImplementedError( + "segment_reduce(): indices based reduction is not supported yet." + ) + + def segment_reduce_lengths_tensor(lengths_shape): + return torch.empty( + lengths_shape + data.shape[axis + 1 :], + dtype=data.dtype, + device="meta", + memory_format=torch.contiguous_format, + ) + + if lengths is not None: + return segment_reduce_lengths_tensor(lengths.shape) + # FIXME should probably check that lengths and offset aren't both set, but + # the ATen implementation neglects this too + if offsets is not None: + # lengths == torch.diff(offsets) + lengths_shape = offsets.shape[:-1] + (offsets.shape[-1] - 1,) + return segment_reduce_lengths_tensor(lengths_shape) + raise RuntimeError("segment_reduce(): Either lengths or offsets must be defined.") + + +@register_meta([aten.max.default, aten.max.unary_out]) +@out_wrapper() +def meta_max(self): + return self.new_empty(()) + + +@register_meta(aten.max.dim) +def meta_max_dim(self, dim, keepdim=False): + dim = utils.reduction_dims(self.shape, (dim,)) + output_shape = _compute_reduction_shape(self, dim, keepdim) + return ( + self.new_empty(output_shape), + self.new_empty(output_shape, dtype=torch.long), + ) + + +@register_meta([aten.min.default, aten.min.unary_out]) +@out_wrapper() +def meta_min(self): + return self.new_empty(()) + + +@register_meta(aten.min.dim) +def meta_min_dim(self, dim, keepdim=False): + dim = utils.reduction_dims(self.shape, (dim,)) + output_shape = _compute_reduction_shape(self, dim, keepdim) + return ( + self.new_empty(output_shape), + self.new_empty(output_shape, dtype=torch.long), + ) + + +@register_meta(aten.angle.default) +def meta_angle(self): + if self.is_complex(): + result_dtype = corresponding_real_dtype(self.dtype) + else: + _, result_dtype = elementwise_dtypes( + self, + type_promotion_kind=ELEMENTWISE_TYPE_PROMOTION_KIND.INT_TO_FLOAT, + ) + return torch.empty_like(self, dtype=result_dtype) + + +@register_meta(aten.angle.out) +def meta_angle_out(self, out): + torch._resize_output_(out, self.size(), self.device) + return out.copy_(torch.angle(self)) + + +@register_meta(aten._assert_async.default) +def assert_async(val): + return + + +@register_meta(aten._assert_async.msg) +def assert_async_meta(val, assert_msg): + return + + +@register_meta(aten._print.default) +def print_meta(s): + return + + +@register_meta(aten._make_dep_token.default) +def make_dep_token( + *, + dtype=None, + layout=None, + device=None, + pin_memory=None, + memory_format=None, +): + return torch.empty(0, device="meta") + + +@register_meta(aten.sym_constrain_range.default) +def sym_constrain_range(size, min=None, max=None): + # Avoid importing sympy at a module level + from torch.fx.experimental.symbolic_shapes import constrain_range + + if isinstance(size, (SymFloat, SymBool)): + raise ValueError("Constraining SymFloat or Symbool is nyi") + constrain_range(size, min=min, max=max) + + +@register_meta(aten._functional_sym_constrain_range.default) +def functional_sym_constrain_range(size, min=None, max=None, dep_token=None): + aten.sym_constrain_range(size, min=min, max=max) + return dep_token + + +@register_meta(aten.sym_constrain_range_for_size.default) +def sym_constrain_range_for_size(size, min=None, max=None): + # Avoid importing sympy at a module level + from torch.fx.experimental.symbolic_shapes import _constrain_range_for_size + + if min is None and max is None: + torch._check(size >= 0) + return + + if isinstance(size, (SymFloat, SymBool)): + raise ValueError("Constraining SymFloat or Symbool is nyi") + if type(size) is int: + if min is not None: + torch._check(size >= min) + if max is not None: + torch._check(size <= max) + return + _constrain_range_for_size(size, min=min, max=max) + + +@register_meta(aten._functional_sym_constrain_range_for_size.default) +def functional_sym_constrain_range_for_size(size, min, max, dep_token): + aten.sym_constrain_range_for_size(size, min=min, max=max) + return dep_token + + +@register_meta(aten._functional_assert_async.msg) +def functional_assert_async_meta(val, assert_msg, dep_token): + return dep_token + + +# From aten/src/ATen/native/LinearAlgebraUtils.h +def squareCheckInputs(self: Tensor, f_name: str): + assert self.dim() >= 2, ( + f"{f_name}: The input tensor must have at least 2 dimensions." + ) + assert self.size(-1) == self.size(-2), ( + f"{f_name}: A must be batches of square matrices, but they are {self.size(-2)} by {self.size(-1)} matrices" + ) + + +# Validates input shapes and devices +# for linear solve methods (solve, cholesky_solve, lu_solve, triangular_solve) +# From aten/src/ATen/native/LinearAlgebraUtils.h +def linearSolveCheckInputs(self: Tensor, A: Tensor, name: str): + torch._check( + self.device == A.device, + lambda: ( + f"Expected b and A to be on the same device, but found b on " + f"{self.device} and A on {A.device} instead." + ), + ) + + torch._check( + self.dtype == A.dtype, + lambda: ( + f"Expected b and A to have the same dtype, but found b of type " + f"{self.dtype} and A of type {A.dtype} instead." + ), + ) + + torch._check( + A.size(-1) == A.size(-2), + lambda: ( + f"A must be batches of square matrices, " + f"but they are {A.size(-2)} by {A.size(-1)} matrices" + ), + ) + + torch._check( + A.size(-1) == self.size(-2), + lambda: ( + f"Incompatible matrix sizes for {name}: each A " + f"matrix is {A.size(-1)} by {A.size(-1)}" + f" but each b matrix is {self.size(-2)} by {self.size(-1)}" + ), + ) + + +# From aten/src/ATen/native/LinearAlgebraUtils.h +def checkFloatingOrComplex( + t: Tensor, + f_name: str, + allow_low_precision_dtypes: bool = True, +): + dtype = t.dtype + torch._check( + t.is_floating_point() or t.is_complex(), + lambda: f"{f_name}: Expected a floating point or complex tensor as input. Got {dtype}", + ) + if not allow_low_precision_dtypes: + torch._check( + dtype in (torch.float, torch.double, torch.cfloat, torch.cdouble), + lambda: f"{f_name}: Low precision dtypes not supported. Got {dtype}", + ) + + +# From aten/src/ATen/native/LinearAlgebraUtils.h +def checkIsMatrix(A: Tensor, f_name: str, arg_name: str = "A"): + torch._check( + A.dim() >= 2, + lambda: f"{f_name}: The input tensor {arg_name} must have at least 2 dimensions.", + ) + + +def checkInputsSolver(A: Tensor, B: Tensor, left: bool, f_name: str): + squareCheckInputs(A, f_name) + checkIsMatrix(B, f_name) + torch._check( + A.size(-2) == B.size(-2) if left else A.size(-1) == B.size(-1), + lambda: ( + f"{f_name}: Incompatible shapes of A and B for the equation " + f"{'AX = B' if left else 'XA = B'}" + f" ({A.size(-2)}x{A.size(-1)} and {B.size(-2)}x{B.size(-1)})" + ), + ) + + +def checkSameDevice( + fn_name: str, + result: Tensor, + input: Tensor, + result_name: str = "result", +): + torch._check( + result.device == input.device, + lambda: ( + f"{fn_name}: Expected {result_name} and input tensors to be on the same device, but got " + f"{result_name} on {result.device} and input on {input.device}" + ), + ) + + +def checkUplo(UPLO: str): + UPLO_uppercase = UPLO.upper() + torch._check( + len(UPLO) == 1 and (UPLO_uppercase == "U" or UPLO_uppercase == "L"), + lambda: f"Expected UPLO argument to be 'L' or 'U', but got {UPLO}", + ) + + +@register_meta([aten._linalg_eigh.default, aten._linalg_eigh.eigenvalues]) +@out_wrapper("eigenvalues", "eigenvectors") +def meta__linalg_eigh(A: Tensor, UPLO: str = "L", compute_v: bool = True): + squareCheckInputs(A, "linalg.eigh") + checkUplo(UPLO) + + shape = list(A.shape) + if compute_v: + vecs = A.new_empty(shape) + vecs.as_strided_(shape, make_contiguous_strides_for(shape, row_major=False)) + else: + vecs = A.new_empty([0]) + + shape.pop() + vals = A.new_empty(shape, dtype=toRealValueType(A.dtype)) + + return vals, vecs + + +@register_meta([aten._linalg_eigvals.default, aten.linalg_eigvals.out]) +@out_wrapper() +def meta__linalg_eigvals(input: Tensor) -> Tensor: + squareCheckInputs(input, "linalg.eigvals") + complex_dtype = ( + input.dtype + if utils.is_complex_dtype(input.dtype) + else utils.corresponding_complex_dtype(input.dtype) + ) + return input.new_empty(input.shape[:-1], dtype=complex_dtype) + + +@register_meta([aten.linalg_eig]) +@out_wrapper("eigenvalues", "eigenvectors") +def meta_linalg_eig(input: Tensor): + squareCheckInputs(input, "linalg.eig") + complex_dtype = ( + input.dtype + if utils.is_complex_dtype(input.dtype) + else utils.corresponding_complex_dtype(input.dtype) + ) + values = input.new_empty(input.shape[:-1], dtype=complex_dtype) + vectors = input.new_empty(input.shape, dtype=complex_dtype) + is_cuda = device_hint(input) == "cuda" + vectors.as_strided_( + input.shape, make_contiguous_strides_for(input.shape, row_major=is_cuda) + ) + return values, vectors + + +def cloneBatchedColumnMajor(src: Tensor) -> Tensor: + return src.mT.clone(memory_format=torch.contiguous_format).transpose(-2, -1) + + +@register_meta(aten._cholesky_solve_helper) +@out_wrapper() +def _cholesky_solve_helper(self: Tensor, A: Tensor, upper: bool) -> Tensor: + return cloneBatchedColumnMajor(self) + + +@register_meta(aten.cholesky_solve) +@out_wrapper() +def cholesky_solve(self: Tensor, A: Tensor, upper: bool = False) -> Tensor: + torch._check( + self.ndim >= 2, + lambda: f"b should have at least 2 dimensions, but has {self.ndim} dimensions instead", + ) + torch._check( + A.ndim >= 2, + lambda: f"u should have at least 2 dimensions, but has {A.ndim} dimensions instead", + ) + self_broadcasted, A_broadcasted = _linalg_broadcast_batch_dims_name( + self, A, "cholesky_solve" + ) + return _cholesky_solve_helper(self_broadcasted, A_broadcasted, upper) + + +@register_meta(aten.cholesky) +@out_wrapper() +def cholesky(self: Tensor, upper: bool = False) -> Tensor: + if self.numel() == 0: + return torch.empty_like(self, memory_format=torch.legacy_contiguous_format) + squareCheckInputs(self, "cholesky") + return cloneBatchedColumnMajor(self) + + +@register_meta(aten.cholesky_inverse) +@out_wrapper() +def cholesky_inverse(self: Tensor, upper: bool = False) -> Tensor: + squareCheckInputs(self, "cholesky_inverse") + return cloneBatchedColumnMajor(self) + + +# From aten/src/ATen/native/BatchLinearAlgebra.cpp +@register_meta(aten.linalg_cholesky_ex.default) +def linalg_cholesky_ex(A: Tensor, upper: bool = False, check_errors: bool = False): + squareCheckInputs(A, "linalg.cholesky") + checkFloatingOrComplex(A, "linalg.cholesky") + + A_shape = A.shape + ndim = len(A_shape) + + # L + L_strides = make_contiguous_strides_for(A_shape, False) + L = A.new_empty(A_shape) + L.as_strided_(A_shape, L_strides) + + # infos + infos = A.new_empty(A_shape[0 : ndim - 2], dtype=torch.int32) + return L, infos + + +@register_meta( + [aten.linalg_householder_product.default, aten.linalg_householder_product.out] +) +@out_wrapper() +def linalg_householder_product(input: Tensor, tau: Tensor) -> Tensor: + torch._check( + input.ndim >= 2, + lambda: "torch.linalg.householder_product: input must have at least 2 dimensions.", + ) + torch._check( + input.size(-2) >= input.size(-1), + lambda: "torch.linalg.householder_product: input.shape[-2] must be greater than or equal to input.shape[-1]", + ) + torch._check( + input.size(-1) >= tau.size(-1), + lambda: "torch.linalg.householder_product: input.shape[-1] must be greater than or equal to tau.shape[-1]", + ) + + torch._check( + input.ndim - tau.ndim == 1, + lambda: ( + f"torch.linalg.householder_product: Expected tau to have one dimension less than input, " + f"but got tau.ndim equal to {tau.ndim} and input.ndim is equal to {input.ndim}" + ), + ) + if input.ndim > 2: + expected_batch_tau_shape = input.shape[:-2] + actual_batch_tau_shape = tau.shape[:-1] + torch._check( + actual_batch_tau_shape == expected_batch_tau_shape, + lambda: ( + f"torch.linalg.householder_product: Expected batch dimensions of tau to be " + f"equal to input.shape[:-2], but got {actual_batch_tau_shape}" + ), + ) + + torch._check( + tau.dtype == input.dtype, + lambda: ( + f"torch.linalg.householder_product: tau dtype {tau.dtype}" + f" does not match input dtype {input.dtype}" + ), + ) + checkSameDevice("torch.linalg.householder_product", tau, input, "tau") + + return torch.empty_strided( + size=input.shape, + stride=make_contiguous_strides_for(input.shape, row_major=False), + dtype=input.dtype, + device=input.device, + ) + + +# From aten/src/ATen/native/BatchLinearAlgebra.cpp +@register_meta(aten.linalg_inv_ex.default) +def linalg_inv_ex_meta(A: Tensor, check_errors: bool = False): + squareCheckInputs(A, "linalg.inv_ex") + checkFloatingOrComplex(A, "linalg.inv_ex", allow_low_precision_dtypes=False) + + L = A.new_empty(A.shape) + L.as_strided_(A.shape, make_contiguous_strides_for(A.shape, row_major=False)) + + infos = A.new_empty(A.shape[:-2], dtype=torch.int32) + return L, infos + + +@register_meta([aten.linalg_ldl_factor_ex.default, aten.linalg_ldl_factor_ex.out]) +@out_wrapper("LD", "pivots", "info") +def linalg_ldl_factor_ex_meta( + self: Tensor, + *, + hermitian: bool = False, + check_errors: bool = False, +) -> tuple[Tensor, Tensor, Tensor]: + squareCheckInputs(self, "torch.linalg.ldl_factor_ex") + checkFloatingOrComplex(self, "torch.linalg.ldl_factor_ex") + LD = torch.empty_strided( + size=self.shape, + stride=make_contiguous_strides_for(self.shape, row_major=False), + dtype=self.dtype, + device=self.device, + ) + pivots = self.new_empty(self.shape[:-1], dtype=torch.int) + info = self.new_empty(self.shape[:-2], dtype=torch.int) + return LD, pivots, info + + +@register_meta([aten.linalg_ldl_solve.default, aten.linalg_ldl_solve.out]) +@out_wrapper() +def linalg_ldl_solve_meta( + LD: Tensor, + pivots: Tensor, + B: Tensor, + *, + hermitian: bool = False, +) -> Tensor: + squareCheckInputs(LD, "torch.linalg.ldl_solve") + checkFloatingOrComplex(LD, "torch.linalg.ldl_solve") + linearSolveCheckInputs(B, LD, "torch.linalg.ldl_solve") + torch._check( + B.ndim >= 2, + lambda: ( + f"torch.linalg.ldl_solve: Expected B to have at least 2 dimensions, " + f"but it has {B.ndim} dimensions instead" + ), + ) + expected_pivots_shape = LD.shape[:-1] + torch._check( + expected_pivots_shape == pivots.shape, + lambda: ( + f"torch.linalg.ldl_solve: Expected LD.shape[:-1] and pivots.shape to be the same, " + f"but got pivots with shape {pivots.shape} instead" + ), + ) + torch._check( + utils.is_integer_dtype(pivots.dtype), + lambda: f"torch.linalg.ldl_solve: Expected pivots to be integers. Got {pivots.dtype}", + ) + torch._check( + LD.dtype == B.dtype, + lambda: f"torch.linalg.ldl_solve: LD dtype {LD.dtype} does not match b dtype {B.dtype}", + ) + B_broadcast_size, _ = _linalg_broadcast_batch_dims(B, LD) + return torch.empty_strided( + size=B_broadcast_size, + stride=make_contiguous_strides_for(B_broadcast_size, row_major=False), + dtype=B.dtype, + device=B.device, + ) + + +@register_meta([aten.linalg_lu.default, aten.linalg_lu.out]) +@out_wrapper("P", "L", "U") +def linalg_lu_meta(A: Tensor, *, pivot: bool = True) -> tuple[Tensor, Tensor, Tensor]: + torch._check( + A.ndim >= 2, + lambda: f"linalg.lu: Expected tensor with 2 or more dimensions. Got size: {A.shape} instead", + ) + + sizes = list(A.shape) + m = sizes[-2] + n = sizes[-1] + k = min(m, n) + + sizes[-1] = m + if pivot: + P = A.new_empty(sizes) + else: + P = A.new_empty([0]) + + sizes[-1] = k + L = A.new_empty(sizes) + + sizes[-2] = k + sizes[-1] = n + U = A.new_empty(sizes) + return P, L, U + + +@register_meta([aten.linalg_lu_factor_ex.default, aten.linalg_lu_factor_ex.out]) +@out_wrapper("LU", "pivots", "info") +def linalg_lu_factor_ex_meta( + A: Tensor, + *, + pivot: bool = True, + check_errors: bool = False, +) -> tuple[Tensor, Tensor, Tensor]: + torch._check( + A.ndim >= 2, + lambda: f"torch.lu_factor: Expected tensor with 2 or more dimensions. Got size: {A.shape} instead", + ) + + sizes = list(A.shape) + m = sizes[-2] + n = sizes[-1] + + LU = torch.empty_strided( + size=sizes, + stride=make_contiguous_strides_for(sizes, row_major=False), + dtype=A.dtype, + device=A.device, + ) + + # Sets sizes to the size of pivots + sizes.pop() + sizes[-1] = min(m, n) + pivots = A.new_empty(sizes, dtype=torch.int) + + # Sets sizes to the size of info + sizes.pop() + info = A.new_empty(sizes, dtype=torch.int) + + return LU, pivots, info + + +@register_meta([aten.linalg_lu_solve.default, aten.linalg_lu_solve.out]) +@out_wrapper() +def linalg_lu_solve_meta( + LU: Tensor, + pivots: Tensor, + B: Tensor, + *, + left: bool = True, + adjoint: bool = False, +) -> Tensor: + # dtype + checkFloatingOrComplex(LU, "torch.linalg.lu_solve") + torch._check( + LU.dtype == B.dtype, + lambda: ( + f"linalg.lu_solve: Expected LU and B to have the same dtype, " + f"but found LU of type {LU.dtype} and B of type {B.dtype} instead" + ), + ) + torch._check( + pivots.dtype == torch.int, + lambda: "linalg.lu_solve: pivots should be a Tensor of scalar type torch.int32", + ) + + # matrix shapes + squareCheckInputs(LU, "torch.linalg.lu_solve") + checkInputsSolver(LU, B, left, "linalg.lu_solve") + torch._check( + LU.size(-1) == pivots.size(-1), + lambda: "linalg.lu_solve: Number of pivots per batch should be same as the dimension of the matrix", + ) + + # batches + torch._check( + LU.shape[:-1] == pivots.shape, + lambda: ( + f"linalg.lu_solve: Expected LU.shape[:-1] and pivots.shape to be the same, " + f"but got pivots with shape {pivots.shape} instead" + ), + ) + + B_broadcast_size, _ = _linalg_broadcast_batch_dims(B, LU) + + result = torch.empty_strided( + size=B_broadcast_size, + stride=make_contiguous_strides_for(B_broadcast_size, row_major=not left), + dtype=B.dtype, + device=B.device, + ) + + if result.numel() != 0 and not left: + if result.is_complex(): + result = result.conj() + + return result + + +@register_meta(aten.lu_unpack) +@out_wrapper("P", "L", "U") +def lu_unpack_meta( + LU: Tensor, + pivots: Tensor, + unpack_data: bool = True, + unpack_pivots: bool = True, +) -> tuple[Tensor, Tensor, Tensor]: + torch._check( + LU.ndim >= 2, + lambda: f"torch.lu_unpack: Expected tensor with 2 or more dimensions. Got size: {LU.shape} instead", + ) + if unpack_pivots: + torch._check( + pivots.dtype == torch.int32, + lambda: ( + "torch.lu_unpack: LU_pivots is expected to be a contiguous tensor of torch.int32 dtype.\n" + "Note: this function is intended to be used with the output produced by torch.linalg.lu_factor" + ), + ) + sizes = list(LU.shape) + m = sizes[-2] + n = sizes[-1] + k = min(m, n) + sizes[-1] = m + if unpack_pivots: + P = LU.new_empty(sizes) + else: + P = LU.new_empty([0]) + if unpack_data: + sizes[-1] = k + L = LU.new_empty(sizes) + sizes[-2] = k + sizes[-1] = n + U = LU.new_empty(sizes) + else: + L = LU.new_empty([0]) + U = LU.new_empty([0]) + return P, L, U + + +# parse the "mode" param in linalg_qr: return a tuple of bools (compute_q, reduced) +def _parse_qr_mode(mode: str) -> tuple[bool, bool]: + if mode == "reduced": + compute_q = True + reduced = True + elif mode == "complete": + compute_q = True + reduced = False + elif mode == "r": + compute_q = False + reduced = True # this is actually irrelevant in this mode + else: + torch._check( + False, + lambda: ( + f"qr received unrecognized mode '{mode}' " + f"but expected one of 'reduced' (default), 'r', or 'complete'" + ), + ) + return compute_q, reduced # type: ignore[possibly-undefined] + + +@register_meta([aten.linalg_qr.default, aten.linalg_qr.out]) +@out_wrapper("Q", "R") +def linalg_qr_meta(A: Tensor, mode: str = "reduced") -> tuple[Tensor, Tensor]: + checkIsMatrix(A, "linalg.qr") + checkFloatingOrComplex(A, "linalg.qr") + + compute_q, reduced_mode = _parse_qr_mode(mode) + + m = A.shape[-2] + n = A.shape[-1] + k = min(m, n) + + if compute_q: + Q_shape = list(A.shape) + Q_shape[-1] = k if reduced_mode else m + Q = A.new_empty(Q_shape) + Q.as_strided_(Q_shape, make_contiguous_strides_for(Q_shape, row_major=False)) + else: + Q = A.new_empty([0]) + + # For readability + R_shape = list(A.shape) + R_shape[-2] = k if reduced_mode or not compute_q else m + R = A.new_empty(R_shape) + R.as_strided_(R_shape, make_contiguous_strides_for(R_shape, row_major=False)) + return Q, R + + +@register_meta([aten._linalg_slogdet.default, aten._linalg_slogdet.sign]) +@out_wrapper("sign", "logabsdet", "LU", "pivots") +def _linalg_slogdet(A: Tensor) -> tuple[Tensor, Tensor, Tensor, Tensor]: + squareCheckInputs(A, "linalg.slogdet") + checkFloatingOrComplex(A, "linalg.slogdet", False) + shape = A.shape + sign = A.new_empty(shape[:-2]) + logabsdet = A.new_empty(shape[:-2], dtype=toRealValueType(A.dtype)) + LU = torch.empty_strided( + size=shape, + stride=make_contiguous_strides_for(shape, False), + dtype=A.dtype, + device=A.device, + ) + pivots = A.new_empty(shape[:-1], dtype=torch.int32) + return sign, logabsdet, LU, pivots + + +# From aten/src/ATen/native/BatchLinearAlgebra.cpp +# NOTE: matching defaults in aten/src/ATen/native/native_functions.yaml +@register_meta(aten._linalg_svd.default) +def _linalg_svd_meta( + A: Tensor, + full_matrices: bool = False, + compute_uv: bool = True, + driver: str | None = None, +): + checkIsMatrix(A, "linalg.svd") + checkFloatingOrComplex(A, "linalg.svd") + + batch_dims = list(A.shape[:-2]) + m = A.shape[-2] + n = A.shape[-1] + k = min(m, n) + + if compute_uv: + U_shape = batch_dims + [m, m if full_matrices else k] + U = A.new_empty(U_shape) + U.as_strided_(U_shape, make_contiguous_strides_for(U_shape, row_major=False)) + + V_shape = batch_dims + [n if full_matrices else k, n] + V = A.new_empty(V_shape) + # NB: This checks for CUDA since there is no way to check for cuSolver. + # Also, this might not work correctly on CPU when fake_device is not + # available as device_hint just defaults to CUDA in that case. See + # _linalg_svd meta in core. + is_cuda = device_hint(A) == "cuda" + V.as_strided_(V_shape, make_contiguous_strides_for(V_shape, row_major=is_cuda)) + else: + # doesn't matter + U = A.new_empty([0]) + V = A.new_empty([0]) + + # S is always real, even when A is complex. + S = A.new_empty(batch_dims + [k], dtype=toRealValueType(A.dtype)) + return U, S, V + + +def _linalg_broadcast_batch_dims( + arg1: Tensor, + arg2: Tensor, +) -> tuple[list[int], list[int]]: + # broadcast the batch dimensions of arg1 and arg2. + arg1_batch_sizes = arg1.shape[:-2] + arg2_batch_sizes = arg2.shape[:-2] + expand_batch_portion = _broadcast_shapes(arg1_batch_sizes, arg2_batch_sizes) + + arg1_expand_size = list(expand_batch_portion) + arg1_expand_size += [arg1.size(-2), arg1.size(-1)] + + arg2_expand_size = list(expand_batch_portion) + arg2_expand_size += [arg2.size(-2), arg2.size(-1)] + return arg1_expand_size, arg2_expand_size + + +def _linalg_broadcast_batch_dims_name( + arg1: Tensor, + arg2: Tensor, + name: str | None, +) -> tuple[Tensor, Tensor]: + # If there's no name we assume we don't want to check the errors + if name: + linearSolveCheckInputs(arg1, arg2, name) + + arg1_expand_size, arg2_expand_size = _linalg_broadcast_batch_dims(arg1, arg2) + + arg1_broadcasted = ( + arg1 if arg1_expand_size == arg1.shape else arg1.expand(arg1_expand_size) + ) + arg2_broadcasted = ( + arg2 if arg2_expand_size == arg2.shape else arg2.expand(arg2_expand_size) + ) + return arg1_broadcasted, arg2_broadcasted + + +def linalg_solve_is_vector_rhs(input: Tensor, other: Tensor) -> bool: + expected_batched_rhs_shape = input.shape[:-1] + vector_case = other.ndim == 1 or ( + input.ndim - 1 == other.ndim and other.shape == expected_batched_rhs_shape + ) + return vector_case + + +@register_meta(aten._linalg_solve_ex) +def _linalg_solve_ex( + A: Tensor, + B: Tensor, + *, + left: bool = True, + check_errors: bool = False, + result: Tensor | None = None, + LU: Tensor | None = None, + pivots: Tensor | None = None, + info: Tensor | None = None, +) -> tuple[Tensor, Tensor, Tensor, Tensor]: + checkFloatingOrComplex(A, "linalg.solve") + torch._check( + A.dtype == B.dtype, + lambda: ( + f"linalg.solve: Expected A and B to have the same dtype, but found A of type " + f"{A.dtype} and B of type {B.dtype} instead" + ), + ) + vector_case = linalg_solve_is_vector_rhs(A, B) + B_ = B.unsqueeze(-1) if vector_case else B + checkInputsSolver(A, B_, left, "linalg.solve") + B_broad_shape, _ = _linalg_broadcast_batch_dims(B_, A) + torch._check( + left or not vector_case, + lambda: ( + "linalg.solve: Vector broadcasting of the left hand side is not supported for left=False. " + "In this case linalg.solve is equivalent to B / A.squeeze(-1)" + ), + ) + result_shape = B_broad_shape[:-1] if vector_case else B_broad_shape + result_ = torch.empty_strided( + size=result_shape, + stride=make_contiguous_strides_for(result_shape, not left), + dtype=B.dtype, + device=B.device, + ) + shape = A.shape + LU_ = torch.empty_strided( + size=shape, + stride=make_contiguous_strides_for(shape, False), + dtype=A.dtype, + device=A.device, + ) + pivots_ = A.new_empty(shape[:-1], dtype=torch.int32) + info_ = A.new_empty(shape[:-2], dtype=torch.int32) + out = (result, LU, pivots, info) + res = (result_, LU_, pivots_, info_) + if all(x is not None for x in out): + for r, o in zip(res, out): + # resize and copy operations are done in-place + _maybe_resize_out(o, r.shape) # type: ignore[arg-type] + # strides are not copied in out_wrapper + o.as_strided_(r.shape, r.stride()) # type: ignore[union-attr] + _safe_copy_out(copy_from=r, copy_to=o, exact_dtype=False) # type: ignore[arg-type] + return res + + +@register_meta([aten.linalg_solve_triangular.default, aten.linalg_solve_triangular.out]) +def linalg_solve_triangular_meta( + A: Tensor, + B: Tensor, + *, + upper: bool, + left: bool = True, + unitriangular: bool = False, + out: Tensor | None = None, +) -> Tensor: + if out is None: + out = A.new_empty([0]) + assert isinstance(out, TensorLike) + checkInputsSolver(A, B, left, "linalg.solve_triangular") + B_, A_ = _linalg_broadcast_batch_dims_name(B, A, None) + avoid_copy_A = A_.transpose(-2, -1).is_contiguous() and A_.is_conj() + if avoid_copy_A: + out = _maybe_resize_out(out, B_.shape) + else: + # reimplementation of resize_output with result F-contig + if _resize_output_check(out, B_.shape): + out.resize_(B_.transpose(-2, -1).shape) + out.transpose_(-2, -1) + return out # type: ignore[return-value] + + +@register_meta(aten.triangular_solve) +@out_wrapper("X", "M", exact_dtype=True) +def triangular_solve_meta( + self: Tensor, + A: Tensor, + upper: bool = True, + transpose: bool = False, + unitriangular: bool = False, +) -> tuple[Tensor, Tensor]: + torch._check( + self.ndim >= 2, + lambda: ( + f"torch.triangular_solve: Expected b to have at least 2 dimensions, " + f"but it has {self.ndim} dimensions instead" + ), + ) + torch._check( + A.ndim >= 2, + lambda: ( + f"torch.triangular_solve: Expected A to have at least 2 dimensions, " + f"but it has {A.ndim} dimensions instead" + ), + ) + + linearSolveCheckInputs(self, A, "triangular_solve") + + if A.layout == torch.strided: + self_broadcast_size, A_broadcast_size = _linalg_broadcast_batch_dims(self, A) + solution = torch.empty_strided( + size=self_broadcast_size, + stride=make_contiguous_strides_for(self_broadcast_size, row_major=False), + dtype=self.dtype, + device=self.device, + ) + cloned_coefficient = torch.empty_strided( + size=A_broadcast_size, + stride=make_contiguous_strides_for(A_broadcast_size, row_major=False), + dtype=A.dtype, + device=A.device, + ) + elif A.layout == torch.sparse_csr or A.layout == torch.sparse_bsr: + solution = torch.empty_like(self) + cloned_coefficient = self.new_empty([0]) + else: + torch._check(False, lambda: "triangular_solve: Got an unexpected layout.") + return solution, cloned_coefficient # type: ignore[possibly-undefined] + + +# From aten/src/ATen/native/LinearAlgebra.cpp +@register_meta(aten._linalg_det.default) +def _linalg_det_meta(A): + squareCheckInputs(A, "linalg.det") + checkFloatingOrComplex(A, "linalg.det") + + det = A.new_empty(A.shape[:-2]) + + LU = A.new_empty(A.shape) + LU.as_strided_(A.shape, make_contiguous_strides_for(A.shape, row_major=False)) + + pivots = A.new_empty(A.shape[:-1], dtype=torch.int32) + return det, LU, pivots + + +@register_meta(aten.ormqr) +@out_wrapper() +def ormqr( + input: Tensor, + tau: Tensor, + other: Tensor, + left: bool = True, + transpose: bool = False, +) -> Tensor: + torch._check( + input.ndim >= 2, lambda: "torch.ormqr: input must have at least 2 dimensions." + ) + torch._check( + other.ndim >= 2, lambda: "torch.ormqr: other must have at least 2 dimensions." + ) + + left_size_condition = -2 if left else -1 + torch._check( + other.shape[left_size_condition] >= tau.shape[-1], + lambda: f"torch.ormqr: other.shape[{left_size_condition}] must be greater than or equal to tau.shape[-1]", + ) + torch._check( + other.shape[left_size_condition] == input.shape[-2], + lambda: f"torch.ormqr: other.shape[{left_size_condition}] must be equal to input.shape[-2]", + ) + + torch._check( + tau.shape[-1] <= input.shape[-1], + lambda: "torch.ormqr: tau.shape[-1] must be less than or equal to input.shape[-1]", + ) + + torch._check( + input.ndim - tau.ndim == 1, + lambda: ( + f"torch.ormqr: Expected tau to have one dimension less than input, " + f"but got tau.ndim equal to {tau.ndim} and input.ndim is equal to {input.ndim}" + ), + ) + torch._check( + input.ndim == other.ndim, + lambda: ( + f"torch.ormqr: Expected other to have the same number of dimensions as input, " + f"but got other.ndim equal to {other.ndim} and input.ndim is equal to {input.ndim}" + ), + ) + + if input.ndim > 2: + expected_batch_shape = input.shape[:-2] + actual_batch_tau_shape = tau.shape[:-1] + torch._check( + actual_batch_tau_shape == expected_batch_shape, + lambda: ( + f"torch.ormqr: Expected batch dimensions of tau to be " + f"equal to input.shape[:-2], but got {actual_batch_tau_shape}" + ), + ) + + actual_batch_other_shape = other.shape[:-2] + torch._check( + actual_batch_other_shape == expected_batch_shape, + lambda: ( + f"torch.ormqr: Expected batch dimensions of other to be " + f"equal to input.shape[:-2], but got {actual_batch_other_shape}" + ), + ) + + torch._check( + tau.dtype == input.dtype, + lambda: ( + f"torch.ormqr: Expected input and tau to have the same dtype, " + f"but input has dtype {input.dtype} and tau has dtype {tau.dtype}" + ), + ) + torch._check( + other.dtype == input.dtype, + lambda: ( + f"torch.ormqr: Expected input and other to have the same dtype, " + f"but input has dtype {input.dtype} and other has dtype {other.dtype}" + ), + ) + + checkSameDevice("torch.ormqr", tau, input, "tau") + checkSameDevice("torch.ormqr", other, input, "other") + + return torch.empty_strided( + size=other.shape, + stride=make_contiguous_strides_for(other.shape, row_major=False), + dtype=other.dtype, + device=other.device, + ) + + +def _padding_check_valid_input(input, padding, *, dim): + torch._check( + len(padding) == 2 * dim, + lambda: f"padding size is expected to be {2 * dim}, but got: {len(padding)}", + ) + + input_dim = input.ndim + + is_batch_mode = input_dim == (dim + 2) + + valid_batch_mode = is_batch_mode + valid_non_batch_mode = not is_batch_mode + + if is_batch_mode: + # allow batch size of 0-dim. + for d in range(1, input_dim): + valid_batch_mode = valid_batch_mode and input.size(d) != 0 + else: + for d in range(input_dim): + valid_non_batch_mode = valid_non_batch_mode and input.size(d) != 0 + + # allow empty batch size but not other dimensions. + torch._check( + valid_batch_mode or valid_non_batch_mode, + lambda: ( + f"Expected {dim + 1}D or {dim + 2}D (batch mode) tensor with possibly 0 batch size " + f"and other non-zero dimensions for input, but got: {input.shape}" + ), + ) + + +def _pad1d_common(input, padding, *, is_reflection): + dim_plane = 0 + dim_w = 1 + nbatch = 1 + + if input.ndim == 3: + nbatch = input.size(0) + dim_w += 1 + dim_plane += 1 + + _padding_check_valid_input(input, padding, dim=1) + + pad_l, pad_r = padding + + nplane = input.size(dim_plane) + input_w = input.size(dim_w) + output_w = input_w + pad_l + pad_r + + if is_reflection: + torch._check( + pad_l < input_w and pad_r < input_w, + lambda: ( + f"Argument #4: Padding size should be less than the corresponding input dimension, " + f"but got: padding ({pad_l}, {pad_r}) at dimension {dim_w} of input {input.shape}" + ), + ) + + torch._check( + output_w >= 1, + lambda: f"input (W: {input_w}) is too small. Calculated output W: {output_w}", + ) + + if input.ndim == 2: + return input.new_empty((nplane, output_w)) + else: + return input.new_empty((nbatch, nplane, output_w)) + + +@register_meta(aten.reflection_pad1d) +@out_wrapper() +def meta_reflection_pad1d(input, padding): + return _pad1d_common(input, padding, is_reflection=True) + + +@register_meta(aten.replication_pad1d) +@out_wrapper() +def meta_replication_pad1d(input, padding): + torch._check( + input.dtype != torch.bool, + lambda: f""""replication_pad1d" not implemented for '{input.dtype.__str__()}'""", + ) + return _pad1d_common(input, padding, is_reflection=False) + + +def _pad1d_backward_common(grad_output, input, padding, *, is_reflection): + dim_w = 1 + if not is_reflection: + torch._check(len(padding) == 2, lambda: "padding size is expected to be 2") + + if input.ndim == 3: + dim_w += 1 + + pad_l, pad_r = padding + + input_w = input.size(dim_w) + output_w = input_w + pad_l + pad_r + + if is_reflection: + torch._check( + pad_l < input_w and pad_r < input_w, + lambda: ( + f"Argument #4: Padding size should be less than the corresponding input dimension, " + f"but got: padding ({pad_l}, {pad_r}) at dimension {dim_w} of input {input.shape}" + ), + ) + + torch._check( + output_w == grad_output.size(dim_w), + lambda: f"grad_output width unexpected. Expected: {output_w}, Got: {grad_output.size(dim_w)}", + ) + + return input.new_empty(input.shape) + + +@register_meta(aten.reflection_pad1d_backward) +@out_wrapper("grad_input") +def meta_reflection_pad1d_backward(grad_output, input, padding): + return _pad1d_backward_common(grad_output, input, padding, is_reflection=True) + + +@register_meta(aten.replication_pad1d_backward) +@out_wrapper("grad_input") +def meta_replication_pad1d_backward(grad_output, input, padding): + return _pad1d_backward_common(grad_output, input, padding, is_reflection=False) + + +def _pad2d_common(input, padding, *, is_reflection): + dim_w = 2 + dim_h = 1 + dim_slices = 0 + nbatch = 1 + + _padding_check_valid_input(input, padding, dim=2) + + ndim = input.ndim + if ndim == 4: + nbatch = input.size(0) + dim_w += 1 + dim_h += 1 + dim_slices += 1 + + pad_l, pad_r, pad_t, pad_b = padding + + nplane = input.size(dim_slices) + input_h = input.size(dim_h) + input_w = input.size(dim_w) + output_h = input_h + pad_t + pad_b + output_w = input_w + pad_l + pad_r + + if is_reflection: + torch._check( + pad_l < input_w and pad_r < input_w, + lambda: ( + f"Argument #4: Padding size should be less than the corresponding input dimension, " + f"but got: padding ({pad_l}, {pad_r}) at dimension {dim_w} of input {input.shape}" + ), + ) + torch._check( + pad_t < input_h and pad_b < input_h, + lambda: ( + f"Argument #6: Padding size should be less than the corresponding input dimension, " + f"but got: padding ({pad_t}, {pad_b}) at dimension {dim_h} of input {input.shape}" + ), + ) + + torch._check( + output_w >= 1 or output_h >= 1, + lambda: ( + f"input (H: {input_h} W: {input_w}) is too small. " + f"Calculated output H: {output_h} W: {output_w}" + ), + ) + + if input.ndim == 3: + return input.new_empty((nplane, output_h, output_w)) + else: + return input.new_empty((nbatch, nplane, output_h, output_w)) + + +@register_meta(aten.reflection_pad2d) +@out_wrapper() +def meta_reflection_pad2d(input, padding): + return _pad2d_common(input, padding, is_reflection=True) + + +@register_meta(aten.replication_pad2d) +@out_wrapper() +def meta_replication_pad2d(input, padding): + torch._check( + input.dtype != torch.bool, + lambda: f""""replication_pad2d" not implemented for '{input.dtype.__str__()}'""", + ) + return _pad2d_common(input, padding, is_reflection=False) + + +@register_meta( + aten._weight_norm_interface_backward.default, +) +def meta_weight_norm_backward(grad_w, saved_v, saved_g, saved_norms, dim): + grad_v = torch.empty_like(saved_v) + grad_g = torch.empty_like(saved_g) + return grad_v, grad_g + + +@register_meta( + [ + aten.reflection_pad2d_backward.default, + aten.reflection_pad2d_backward.grad_input, + aten.replication_pad2d_backward.default, + aten.replication_pad2d_backward.grad_input, + ] +) +@out_wrapper("grad_input") +def meta_pad2d_backward(grad_output, self, padding): + dim_w = 2 + dim_h = 1 + dim_plane = 0 + + self_shape = self.shape + if self.dim() == 4: + dim_w += 1 + dim_h += 1 + dim_plane += 1 + + pad_l, pad_r, pad_t, pad_b = padding + + input_h = self_shape[dim_h] + input_w = self_shape[dim_w] + output_h = input_h + pad_t + pad_b + output_w = input_w + pad_l + pad_r + + torch._check( + output_w == grad_output.size(dim_w), + lambda: f"grad_output width unexpected. Expected: {output_w}, Got: {grad_output.size(dim_w)}", + ) + torch._check( + output_h == grad_output.size(dim_h), + lambda: f"grad_output height unexpected. Expected: {output_h}, Got: {grad_output.size(dim_h)}", + ) + return self.new_empty(self.shape) + + +def _pad3d_common(input, padding, *, is_reflection): + dim_w = 3 + dim_h = 2 + dim_d = 1 + dim_plane = 0 + + _padding_check_valid_input(input, padding, dim=3) + + batch_mode = input.ndim == 5 + if batch_mode: + nbatch = input.size(0) + dim_w += 1 + dim_h += 1 + dim_d += 1 + dim_plane += 1 + + pad_l, pad_r, pad_t, pad_b, pad_f, pad_bk = padding + + nplane = input.size(dim_plane) + input_d = input.size(dim_d) + input_h = input.size(dim_h) + input_w = input.size(dim_w) + output_d = input_d + pad_f + pad_bk + output_h = input_h + pad_t + pad_b + output_w = input_w + pad_l + pad_r + + if is_reflection: + torch._check( + pad_l < input_w and pad_r < input_w, + lambda: ( + f"Argument #4: Padding size should be less than the corresponding input dimension, " + f"but got: padding ({pad_l}, {pad_r}) at dimension {dim_w} of input {input.shape}" + ), + ) + torch._check( + pad_t < input_h and pad_b < input_h, + lambda: ( + f"Argument #6: Padding size should be less than the corresponding input dimension, " + f"but got: padding ({pad_t}, {pad_b}) at dimension {dim_h} of input {input.shape}" + ), + ) + torch._check( + pad_f < input_d and pad_bk < input_d, + lambda: ( + f"Argument #8: Padding size should be less than the corresponding input dimension, " + f"but got: padding ({pad_f}, {pad_bk}) at dimension {dim_d} of input {input.shape}" + ), + ) + + torch._check( + output_w >= 1 or output_h >= 1 or output_d >= 1, + lambda: ( + f"input (D: {input_d} H: {input_h} W: {input_w}) is too small. " + f"Calculated output D: {output_d} H: {output_h} W: {output_w}" + ), + ) + + if batch_mode: + return input.new_empty((nbatch, nplane, output_d, output_h, output_w)) # type: ignore[possibly-undefined] + else: + return input.new_empty((nplane, output_d, output_h, output_w)) + + +@register_meta(aten.reflection_pad3d) +@out_wrapper() +def meta_reflection_pad3d(input, padding): + return _pad3d_common(input, padding, is_reflection=True) + + +@register_meta(aten.replication_pad3d) +@out_wrapper() +def meta_replication_pad3d(input, padding): + torch._check( + input.dtype != torch.bool, + lambda: f""""replication_pad3d" not implemented for '{input.dtype.__str__()}'""", + ) + return _pad3d_common(input, padding, is_reflection=False) + + +@register_meta( + [ + aten.reflection_pad3d_backward.default, + aten.reflection_pad3d_backward.grad_input, + aten.replication_pad3d_backward.default, + aten.replication_pad3d_backward.grad_input, + ] +) +@out_wrapper("grad_input") +def meta_pad3d_backward(grad_output, input, padding): + torch._check(len(padding) == 6, lambda: "padding size is expected to be 6") + assert input.ndim > 3 + assert grad_output.ndim == input.ndim + + dim_w = 3 + dim_h = 2 + dim_d = 1 + + if input.ndim == 5: + dim_w += 1 + dim_h += 1 + dim_d += 1 + + pad_l, pad_r, pad_t, pad_b, pad_f, pad_bk = padding + + input_d = input.size(dim_d) + input_h = input.size(dim_h) + input_w = input.size(dim_w) + output_d = input_d + pad_f + pad_bk + output_h = input_h + pad_t + pad_b + output_w = input_w + pad_l + pad_r + + torch._check( + output_w == grad_output.size(dim_w), + lambda: f"grad_output width unexpected. Expected: {output_w}, Got: {grad_output.size(dim_w)}", + ) + torch._check( + output_h == grad_output.size(dim_h), + lambda: f"grad_output height unexpected. Expected: {output_h}, Got: {grad_output.size(dim_h)}", + ) + torch._check( + output_d == grad_output.size(dim_d), + lambda: f"grad_output depth unexpected. Expected: {output_d}, Got: {grad_output.size(dim_d)}", + ) + + return input.new_empty(input.shape) + + +@register_meta(aten._pdist_forward) +@out_wrapper() +def meta__pdist_forward(self: Tensor, p: float = 2) -> Tensor: + torch._check( + self.is_contiguous(), lambda: "_pdist_forward requires contiguous input" + ) + n = self.size(0) + if n <= 1: + return self.new_empty([0]).to(memory_format=torch.legacy_contiguous_format) # type: ignore[call-overload] + else: + return self.new_empty((n * (n - 1) // 2,)).to( + memory_format=torch.legacy_contiguous_format + ) # type: ignore[call-overload] + + +@register_meta(aten._pdist_backward) +@out_wrapper() +def meta__pdist_backward(grad: Tensor, self: Tensor, p: float, pdist: Tensor) -> Tensor: + torch._check( + self.is_contiguous(), lambda: "_pdist_backward requires self to be contiguous" + ) + torch._check( + pdist.is_contiguous(), lambda: "_pdist_backward requires pdist to be contiguous" + ) + return torch.empty_like(self, memory_format=torch.legacy_contiguous_format) + + +@register_meta([aten.baddbmm.default, aten.baddbmm.out]) +@out_wrapper(exact_dtype=True) +def meta_baddbmm(self, batch1, batch2, *, beta=1, alpha=1): + from torch.fx.experimental.symbolic_shapes import guard_or_true, sym_eq + + dim1 = batch1.size(0) + dim2 = batch1.size(1) + dim3 = batch2.size(2) + if guard_or_true(torch.sym_not(sym_eq(self.shape, (dim1, dim2, dim3)))): + self = self.expand((dim1, dim2, dim3)) + torch._check(batch1.dim() == 3, lambda: "batch1 must be a 3D tensor") + torch._check(batch2.dim() == 3, lambda: "batch2 must be a 3D tensor") + if not exp_config.skip_dtype_check_in_meta_registrations: + torch._check( + self.dtype == batch1.dtype == batch2.dtype, + lambda: f"Input dtypes must be the same, got: input: {self.dtype}, batch1: {batch1.dtype}, batch2: {batch2.dtype}", + ) + batch1_sizes = batch1.shape + batch2_sizes = batch2.shape + bs = batch1_sizes[0] + contraction_size = batch1_sizes[2] + torch._check( + batch2_sizes[0] == bs and batch2_sizes[1] == contraction_size, + lambda: ( + f"Expected size for first two dimensions of batch2 tensor to be: " + f"[{bs}, {contraction_size}] but got: [{batch2_sizes[0]}, {batch2_sizes[1]}]." + ), + ) + return self.new_empty(self.size()) + + +@register_meta([aten.bernoulli.default, aten.bernoulli.out]) +@out_wrapper() +def meta_bernoulli(self, *, generator=None): + # https://github.com/pytorch/pytorch/issues/88612 + return torch.empty_like(self, memory_format=torch.contiguous_format) + + +@register_meta(aten.bernoulli_.float) +def meta_bernoulli_(self, p=0.5, generator=None): + return self + + +@register_meta(aten.bernoulli.p) +def meta_bernoulli_p(self, p=0.5, generator=None): + # https://github.com/pytorch/pytorch/issues/88612 + return torch.empty_like(self, memory_format=torch.contiguous_format) + + +@register_meta([aten.poisson.default, aten.poisson.out]) +@out_wrapper() +def meta_poisson(self, generator=None): + return torch.empty_like(self) + + +@register_meta(aten._fused_moving_avg_obs_fq_helper.default) +def meta__fused_moving_avg_obs_fq_helper( + self, + observer_on, + fake_quant_on, + running_min, + running_max, + scale, + zero_point, + averaging_const, + quant_min, + quant_max, + ch_axis, + per_row_fake_quant=False, + symmetric_quant=False, +): + torch._check( + ch_axis < self.dim(), + lambda: "Error in fused_moving_avg_obs_fake_quant_cpu: ch_axis must be < self.dim()", + ) + mask = torch.empty_like(self, dtype=torch.bool) + return (torch.empty_like(self), mask) + + +@register_meta(aten.mm) +@out_wrapper(exact_dtype=True) +def meta_mm(a, b, out_dtype: torch.dtype | None = None): + torch._check(a.dim() == 2, lambda: "a must be 2D") + torch._check(b.dim() == 2, lambda: "b must be 2D") + N, M1 = a.shape + M2, P = b.shape + torch._check( + M1 == M2, + lambda: f"a and b must have same reduction dim, but got [{N}, {M1}] X [{M2}, {P}].", + ) + if out_dtype is not None: + torch._check( + out_dtype == a.dtype + or ( + out_dtype == torch.float32 + and a.dtype in (torch.float16, torch.bfloat16) + ), + lambda: "out_dtype must be the same as input dtype or fp32 for fp16/bf16 inputs", + ) + result_dtype = a.dtype if out_dtype is None else out_dtype + return a.new_empty((N, P), dtype=result_dtype) + + +def _compute_reduction_shape(self, dims, keepdim): + if keepdim: + return tuple(self.shape[i] if i not in dims else 1 for i in range(self.ndim)) + + return utils.compute_reduction_output_shape(self.shape, dims) + + +# FakeTensors (meta tensors with a device) will report device as meta +# when running meta kernels. Here, access the "fake device" of FakeTensor if it +# exists so meta kernels which have diverge per device will be more +# accurate when run with FakeTensors +def device_hint(tensor) -> "str": + if isinstance(tensor, torch._subclasses.FakeTensor): + return tensor.fake_device.type + elif ( + hasattr(tensor, "device") + and hasattr(tensor.device, "type") + and tensor.device.type != "meta" + ): + return tensor.device.type + else: + return "cuda" # default to cuda + + +def calc_conv_nd_return_shape( + input_tensor: torch.Tensor, + weight: torch.Tensor, + stride: list[int] | int, + padding: list[int] | int, + dilation: list[int] | int, + is_transposed: bool, + groups: int, + output_padding: list[int] | int | None = None, +): + def _formula(ln: int, p: int, d: int, k: int, s: int) -> int: + """ + Formula to apply to calculate the length of some dimension of the output + + See: https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html + + Args: + ln: length of the dimension + p: padding in that dim + d: dilation in that dim + k: kernel size in that dim + s: stride in that dim + Returns: + The output length + """ + return (ln + 2 * p - d * (k - 1) - 1) // s + 1 + + def _formula_transposed(ln: int, p: int, d: int, k: int, s: int, op: int) -> int: + """ + Formula to apply to calculate the length of some dimension of the output + if transposed convolution is used. + See: https://pytorch.org/docs/stable/generated/torch.nn.ConvTranspose2d.html + + Args: + ln: length of the dimension + p: padding in that dim + d: dilation in that dim + k: kernel size in that dim + s: stride in that dim + op: output padding in that dim + + Returns: + The output length + """ + return (ln - 1) * s - 2 * p + d * (k - 1) + op + 1 + + kernel_size = weight.shape[2:] + dims = input_tensor.shape[2:] + if is_transposed: + out_channels = groups * weight.shape[1] + else: + out_channels = weight.shape[0] + if weight.shape[1] * groups != input_tensor.shape[1]: + raise RuntimeError("Invalid channel dimensions") + + ret_shape = [input_tensor.shape[0], out_channels] + if isinstance(stride, IntLike): + # pyrefly: ignore [bad-assignment] + stride = [stride] * len(dims) + elif len(stride) == 1: + stride = [stride[0]] * len(dims) + + if isinstance(padding, IntLike): + # pyrefly: ignore [bad-assignment] + padding = [padding] * len(dims) + elif len(padding) == 1: + padding = [padding[0]] * len(dims) + + if isinstance(dilation, IntLike): + # pyrefly: ignore [bad-assignment] + dilation = [dilation] * len(dims) + elif len(dilation) == 1: + dilation = [dilation[0]] * len(dims) + + output_padding_list: list[int] | None = None + if output_padding: + if isinstance(output_padding, IntLike): + # pyrefly: ignore [bad-assignment] + output_padding_list = [output_padding] * len(dims) + elif len(output_padding) == 1: + output_padding_list = [output_padding[0]] * len(dims) + else: + output_padding_list = output_padding + + for i in range(len(dims)): + # If output_padding is present, we are dealing with a transposed convolution + if output_padding_list: + ret_shape.append( + _formula_transposed( + dims[i], + # pyrefly: ignore [index-error] + padding[i], + # pyrefly: ignore [index-error] + dilation[i], + kernel_size[i], + # pyrefly: ignore [index-error] + stride[i], + output_padding_list[i], + ) + ) + else: + ret_shape.append( + # pyrefly: ignore [index-error] + _formula(dims[i], padding[i], dilation[i], kernel_size[i], stride[i]) + ) + from torch.fx.experimental.symbolic_shapes import sym_or + + torch._check( + sym_or(*[x > 0 for x in ret_shape[2:]]), + lambda: f"Given input size per channel: {list(dims)}. " + f"Calculated output size per channel: {ret_shape[2:]}. " + f"Output size is too small", + ) + + return ret_shape + + +def is_channels_last(ten): + return torch._prims_common.suggest_memory_format(ten) == torch.channels_last + + +@register_meta(aten.miopen_batch_norm.default) +def meta_miopen_batch_norm( + input_tensor: torch.Tensor, + weight: torch.Tensor, + bias: torch.Tensor | None, + running_mean: torch.Tensor | None, + running_var: torch.Tensor | None, + training: bool, + exponential_average_factor: float, + epsilon: float, +): + # In batch norm the output is of the same shape as the input + out_shape = input_tensor.shape + + # If tensor is provided for running_mean and running_var then use this. If these are not + # provided then we return the shape of weight tensor. Similar to how this is handled in the decomposition + save_mean_shape = running_mean.shape if running_mean is not None else weight.shape + save_var_shape = running_var.shape if running_var is not None else weight.shape + + def pick_memory_format(): + if is_channels_last(input_tensor): + return torch.channels_last + if input_tensor.is_contiguous(memory_format=torch.contiguous_format): + return torch.contiguous_format + return torch.contiguous_format + + out = input_tensor.new_empty(out_shape).to(memory_format=pick_memory_format()) + + if training: + save_mean = input_tensor.new_empty(save_mean_shape) + save_var = input_tensor.new_empty(save_var_shape) + else: + save_mean = input_tensor.new_empty((0,)) + save_var = input_tensor.new_empty((0,)) + + return out, save_mean, save_var + + +@register_meta(aten.convolution.default) +def meta_conv( + input_tensor: torch.Tensor, + weight: torch.Tensor, + bias: torch.Tensor, + stride: list[int], + padding: list[int], + dilation: list[int], + is_transposed: bool, + output_padding: list[int], + groups: int, +): + shape_out = calc_conv_nd_return_shape( + input_tensor, + weight, + stride, + padding, + dilation, + is_transposed, + groups, + output_padding if is_transposed else None, + ) + + input_channels_dim = 1 + output_channels_dim = 1 + if input_tensor.size(input_channels_dim) == 0: + shape_out[output_channels_dim] = 0 + + out = input_tensor.new_empty(shape_out) + return out + + +if torch._C._has_mkldnn: + _meta_lib_dont_use_me_use_register_meta_for_mkldnn = torch.library.Library( + "mkldnn", "IMPL", "Meta" + ) + + @register_meta(torch.ops.mkldnn._convolution_pointwise.default) + def meta_mkldnn_convolution_default( + input_tensor, + weight, + bias, + padding, + stride, + dilation, + groups, + attr, + scalars, + algorithm, + ): + shape_out = calc_conv_nd_return_shape( + input_tensor, weight, stride, padding, dilation, False, groups, [] + ) + out = input_tensor.new_empty(shape_out) + out_memory_format = torch.channels_last + if input_tensor.dim() == 5: + out_memory_format = torch.channels_last_3d + out = out.to(memory_format=out_memory_format) # type: ignore[call-overload] + return out + + @register_meta(torch.ops.mkldnn._linear_pointwise.default) + def meta_linear_pointwise_default( + input_tensor, weight, bias, attr, scalars, algorithm + ): + return input_tensor.new_empty((*input_tensor.shape[:-1], weight.shape[0])) + + if torch._C.has_mkl: + _meta_lib_dont_use_me_use_register_meta_for_mkl = torch.library.Library( + "mkl", "IMPL", "Meta" + ) + + @register_meta(torch.ops.mkl._mkl_linear) + def meta_mkl_linear(input_tensor, packed_weight, orig_weight, bias, batch_size): + return input_tensor.new_empty( + (*input_tensor.shape[:-1], orig_weight.shape[0]) + ) + + _meta_lib_dont_use_me_use_register_meta_for_onednn = torch.library.Library( + "onednn", "IMPL", "Meta" + ) + + @register_meta(torch.ops.onednn.qconv2d_pointwise.default) + @register_meta(torch.ops.onednn.qconv_pointwise.default) + @register_meta(torch.ops.onednn.qconv_pointwise.tensor) + def meta_qconv_pointwise( + x, + x_scale, + x_zp, + w, # prepacked_weight + w_scale, + w_zp, + bias, + stride, + padding, + dilation, + groups, + output_scale, + output_zero_point, + output_dtype, + attr, + scalars, + algorithm, + ): + shape_out = calc_conv_nd_return_shape( + x, + w, + stride, + padding, + dilation, + False, + groups, + None, + ) + if output_dtype is None: + output_dtype = x.dtype + assert output_dtype in [ + torch.float32, + torch.bfloat16, + torch.uint8, + torch.int8, + torch.float8_e4m3fn, + ] + out = x.new_empty(shape_out, dtype=output_dtype) + assert len(shape_out) in [3, 4, 5], ( + "Expect output to be 3d/4d/5d for conv1d/2d/3d" + ) + format = { + 3: torch.contiguous_format, + 4: torch.channels_last, + 5: torch.channels_last_3d, + }[len(shape_out)] + out = out.to(memory_format=format) + return out + + @register_meta(torch.ops.onednn.qconv2d_pointwise.binary) + @register_meta(torch.ops.onednn.qconv2d_pointwise.binary_tensor) + def meta_qconv2d_pointwise_binary( + x, + x_scale, + x_zp, + w, + w_scale, + w_zp, + accum, + bias, + stride, + padding, + dilation, + groups, + output_scale, + output_zero_point, + output_dtype, + accum_scale, + accum_zero_point, + binary_op_name, + alpha, + unary_op_name, + unary_op_args, + unary_op_algorithm, + ): + assert binary_op_name == "sum" + return accum + + @register_meta(torch.ops.onednn.qlinear_pointwise.default) + @register_meta(torch.ops.onednn.qlinear_pointwise.tensor) + def meta_qlinear_pointwise( + x, + x_scale, + x_zp, + w, + w_scale, + w_zp, + bias, + output_scale, + output_zero_point, + output_dtype, + post_op_name, + post_op_args, + post_op_algorithm, + ): + output_shape = list(x.shape) + # The weight has been transposed during the qlinear weight prepack process. + output_shape[-1] = w.shape[1] + assert output_dtype in [ + torch.float32, + torch.bfloat16, + torch.int8, + torch.uint8, + torch.float8_e4m3fn, + ] + out = x.new_empty(output_shape, dtype=output_dtype) + return out + + @register_meta(torch.ops.onednn.qlinear_pointwise.binary) + @register_meta(torch.ops.onednn.qlinear_pointwise.binary_tensor) + def meta_qlinear_pointwise_binary( + x, + x_scale, + x_zp, + w, + w_scale, + w_zp, + x_2, + bias, + output_scale, + output_zero_point, + output_dtype, + x2_scale, + x2_zp, + binary_op_name, + alpha, + unary_op_name, + unary_op_args, + unary_op_algorithm, + ): + if binary_op_name == "sum": + return x_2 + output_shape = list(x.shape) + # The weight has been transposed during the qlinear weight prepack process. + output_shape[-1] = w.shape[1] + assert output_dtype in [ + torch.float32, + torch.bfloat16, + torch.uint8, + torch.int8, + torch.float8_e4m3fn, + ] + out = x.new_empty(output_shape, dtype=output_dtype) + return out + + @register_meta(torch.ops.onednn.linear_dynamic_fp16.default) + @register_meta(torch.ops.onednn.linear_relu_dynamic_fp16.default) + def meta_linear_dynamic_fp16( + x, + w, + bias, + ): + output_shape = list(x.shape) + # The weight has been transposed during the qlinear weight prepack process. + output_shape[-1] = w.shape[1] + out = x.new_empty(output_shape) + return out + + _meta_lib_dont_use_me_use_register_meta_for_quantized = torch.library.Library( + "quantized", "IMPL", "Meta" + ) + + @register_meta(torch.ops.quantized.max_pool2d) + def meta_quantized_max_pool2d( + input, + kernel_size, + stride=(), + padding=(0,), + dilation=(1,), + ceil_mode=False, + ): + ( + nInputPlane, + outputHeight, + outputWidth, + ) = max_pool2d_checks_and_compute_shape( + input, kernel_size, stride, padding, dilation, ceil_mode + ) + nbatch = input.size(-4) if input.dim() == 4 else 1 + memory_format = torch.channels_last + if input.dim() == 3: + size = [nInputPlane, outputHeight, outputWidth] + else: + size = [nbatch, nInputPlane, outputHeight, outputWidth] + return torch.empty( + size, + dtype=input.dtype, + device=input.device, + memory_format=memory_format, + ) + + @register_meta(torch.ops.quantized.int4mm_packed_weight_cpu) + def meta_int4mm_packed_weight_cpu(x, w, q_group_size, q_scale_and_zeros): + torch._check(x.dim() == 2, lambda: f"x must be a 2D tensor, got {x.dim()}D") + torch._check(w.dim() == 2, lambda: f"w must be a 2D tensor, got {w.dim()}D") + torch._check( + x.dtype in [torch.float32, torch.float16, torch.bfloat16], + lambda: f"expected x to be f32/f16/bf16, got {x.dtype}", + ) + torch._check( + w.dtype == torch.uint8, lambda: f"expected w to be uint8, got {w.dtype}" + ) + torch._check( + q_group_size.dtype == torch.int64, + lambda: f"q_group_size must be int64, got {q_group_size.dtype}", + ) + torch._check( + q_scale_and_zeros.dtype == x.dtype, + lambda: f"q_scale_and_zeros must have the same dtype as x, got {q_scale_and_zeros.dtype}", + ) + return x.new_empty(x.size(0), w.size(0), dtype=x.dtype) + + +# from check_dim_size() in aten/src/ATen/TensorUtils.cpp. +def check_dim_size(tensor, dim, dim_size, size): + torch._check( + tensor.dim() == dim and tensor.shape[dim_size] == size, + lambda: f"Expected a tensor of dimension {dim} and tensor.size[{dim_size}] == {size}, " + + f"but got : dimension {tensor.dim()} and tensor.size[{dim_size}] = {tensor.shape[dim_size]}", + ) + + +@register_meta(aten.avg_pool2d.default) +def meta_avg_pool2d( + input, + kernel_size, + stride=(), + padding=(0,), + ceil_mode=False, + count_include_pad=True, + divisor_override=None, +): + def unpack(name, val): + torch._check( + len(val) in [1, 2], + lambda: f"avg_pool2d: {name} must either be a single int, or a tuple of two ints", + ) + H = val[0] + W = H if len(val) == 1 else val[1] + return H, W + + kH, kW = unpack("kernel_size", kernel_size) + torch._check( + len(stride) in [0, 1, 2], + lambda: "avg_pool2d: stride must either be omitted, a single int, or a tuple of two ints", + ) + torch._check( + input.dtype not in [torch.uint8, torch.uint16, torch.uint32, torch.uint64], + lambda: f""""avg_pool2d" not implemented for '{input.dtype.__str__()}'""", + ) + if len(stride) == 0: + dH, dW = kH, kW + elif len(stride) == 1: + dH, dW = stride[0], stride[0] + else: + dH, dW = unpack("stride", stride) + + padH, padW = unpack("padding", padding) + + torch._check( + divisor_override is None or divisor_override != 0, + lambda: "divisor must be not zero", + ) + + nbatch = input.size(-4) if input.dim() == 4 else 1 + nInputPlane = input.size(-3) + inputHeight = input.size(-2) + inputWidth = input.size(-1) + + outputHeight = pooling_output_shape(inputHeight, kH, padH, dH, 1, ceil_mode) + outputWidth = pooling_output_shape(inputWidth, kW, padW, dW, 1, ceil_mode) + + memory_format = utils.suggest_memory_format(input) + pool2d_shape_check( + input, + kH, + kW, + dH, + dW, + padH, + padW, + 1, + 1, + nInputPlane, + inputHeight, + inputWidth, + outputHeight, + outputWidth, + memory_format, + ) + + if input.dim() == 3: + size = [nInputPlane, outputHeight, outputWidth] + else: + size = [nbatch, nInputPlane, outputHeight, outputWidth] + return torch.empty( + size, + dtype=input.dtype, + device=input.device, + memory_format=memory_format, + ) + + +# from avg_pool2d_backward_shape_check() in aten/src/ATen/native/Pool.h. +def avg_pool2d_backward_shape_check( + input, + gradOutput, + nbatch, + kH, + kW, + dH, + dW, + padH, + padW, + nInputPlane, + inputHeight, + inputWidth, + outputHeight, + outputWidth, + mem_format, +): + pool2d_shape_check( + input, + kH, + kW, + dH, + dW, + padH, + padW, + 1, + 1, + nInputPlane, + inputHeight, + inputWidth, + outputHeight, + outputWidth, + mem_format, + ) + + ndim = input.dim() + nOutputPlane = nInputPlane + + check_dim_size(gradOutput, ndim, ndim - 3, nOutputPlane) + check_dim_size(gradOutput, ndim, ndim - 2, outputHeight) + check_dim_size(gradOutput, ndim, ndim - 1, outputWidth) + + +# Don't override the C++ registration. +@register_meta(aten.avg_pool2d_backward.default) +def meta_avg_pool2d_backward( + gradOutput_, + input, + kernel_size, + stride, + padding, + ceil_mode, + count_include_pad, + divisor_override, +): + # From aten/src/ATen/native/AveragePool2d.cpp structured kernel meta func. + torch._check( + len(kernel_size) == 1 or len(kernel_size) == 2, + lambda: "avg_pool2d: kernel_size must either be a single int, or a tuple of two ints", + ) + kH = kernel_size[0] + kW = kH if len(kernel_size) == 1 else kernel_size[1] + torch._check( + len(stride) == 0 or len(stride) == 1 or len(stride) == 2, + lambda: "avg_pool2d: stride must either be omitted, a single int, or a tuple of two ints", + ) + dH = kH if len(stride) == 0 else stride[0] + dW = kW if len(stride) == 0 else dH if len(stride) == 1 else stride[1] + torch._check( + len(padding) == 1 or len(padding) == 2, + lambda: "avg_pool2d: padding must either be a single int, or a tuple of two ints", + ) + padH = padding[0] + padW = padH if len(padding) == 1 else padding[1] + + torch._check( + divisor_override is None or divisor_override != 0, + lambda: "divisor must be not zero", + ) + + input_size = input.shape + nbatch = input_size[-4] if input.dim() == 4 else 1 + nInputPlane = input_size[-3] + inputHeight = input_size[-2] + inputWidth = input_size[-1] + + outputHeight = pooling_output_shape(inputHeight, kH, padH, dH, 1, ceil_mode) + outputWidth = pooling_output_shape(inputWidth, kW, padW, dW, 1, ceil_mode) + + mem_format = utils.suggest_memory_format(input) + + avg_pool2d_backward_shape_check( + input, + gradOutput_, + nbatch, + kH, + kW, + dH, + dW, + padH, + padW, + nInputPlane, + inputHeight, + inputWidth, + outputHeight, + outputWidth, + mem_format, + ) + + return torch.empty( + input_size, + dtype=input.dtype, + device=input.device, + memory_format=mem_format, + ) + + +@register_meta(aten.avg_pool3d) +@out_wrapper() +def meta_avg_pool3d( + input, + kernel_size, + stride=(), + padding=(0,), + ceil_mode=False, + count_include_pad=True, + divisor_override=None, +): + torch._check( + len(kernel_size) in (1, 3), + lambda: "avg_pool3d: kernel_size must be a single int, or a tuple of three ints", + ) + kT = kernel_size[0] + kH = kT if len(kernel_size) == 1 else kernel_size[1] + kW = kT if len(kernel_size) == 1 else kernel_size[2] + + torch._check( + not stride or len(stride) in (1, 3), + lambda: "avg_pool3d: stride must be omitted, a single int, or a tuple of three ints", + ) + torch._check( + input.dtype not in [torch.uint8, torch.uint16, torch.uint32, torch.uint64], + lambda: f""""avg_pool3d" not implemented for '{input.dtype.__str__()}'""", + ) + dT = kT if not stride else stride[0] + dH = kH if not stride else (dT if len(stride) == 1 else stride[1]) + dW = kW if not stride else (dT if len(stride) == 1 else stride[2]) + + torch._check( + len(padding) in (1, 3), + lambda: "avg_pool3d: padding must be a single int, or a tuple of three ints", + ) + padT = padding[0] + padH = padT if len(padding) == 1 else padding[1] + padW = padT if len(padding) == 1 else padding[2] + + torch._check( + input.ndim in (4, 5), + lambda: "non-empty 4D or 5D (batch mode) tensor expected for input", + ) + + torch._check( + not divisor_override or divisor_override != 0, + lambda: "divisor must be not zero", + ) + + nbatch = input.size(0) + nslices = input.size(-4) + itime = input.size(-3) + iheight = input.size(-2) + iwidth = input.size(-1) + + otime = pooling_output_shape(itime, kT, padT, dT, 1, ceil_mode) + oheight = pooling_output_shape(iheight, kH, padH, dH, 1, ceil_mode) + owidth = pooling_output_shape(iwidth, kW, padW, dW, 1, ceil_mode) + + pool3d_shape_check( + input, + nslices, + kT, + kH, + kW, + dT, + dH, + dW, + padT, + padH, + padW, + 1, + 1, + 1, + itime, + iheight, + iwidth, + otime, + oheight, + owidth, + "avg_pool3d()", + check_input_size=True, + ) + + if input.ndim == 4: + return input.new_empty((nslices, otime, oheight, owidth)) + else: + return input.new_empty((nbatch, nslices, otime, oheight, owidth)) + + +@register_meta(aten.avg_pool3d_backward) +@out_wrapper("grad_input") +def meta_avg_pool3d_backward( + grad_output, + input, + kernel_size, + stride, + padding, + ceil_mode, + count_include_pad, + divisor_override, +): + torch._check( + len(kernel_size) in (1, 3), + lambda: "avg_pool3d: kernel_size must be a single int, or a tuple of three ints", + ) + kT = kernel_size[0] + kH = kT if len(kernel_size) == 1 else kernel_size[1] + kW = kT if len(kernel_size) == 1 else kernel_size[2] + + torch._check( + not stride or len(stride) in (1, 3), + lambda: "avg_pool3d: stride must be omitted, a single int, or a tuple of three ints", + ) + dT = kT if not stride else stride[0] + dH = kH if not stride else (dT if len(stride) == 1 else stride[1]) + dW = kW if not stride else (dT if len(stride) == 1 else stride[2]) + + torch._check( + len(padding) in (1, 3), + lambda: "avg_pool3d: padding must be a single int, or a tuple of three ints", + ) + padT = padding[0] + padH = padT if len(padding) == 1 else padding[1] + padW = padT if len(padding) == 1 else padding[2] + + torch._check( + input.ndim in (4, 5), + lambda: "non-empty 4D or 5D (batch mode) tensor expected for input", + ) + + torch._check( + not divisor_override or divisor_override != 0, + lambda: "divisor must be not zero", + ) + + nslices = input.size(-4) + itime = input.size(-3) + iheight = input.size(-2) + iwidth = input.size(-1) + + otime_for_shape_check = pooling_output_shape(itime, kT, padT, dT, 1, ceil_mode) + oheight_for_shape_check = pooling_output_shape(iheight, kH, padH, dH, 1, ceil_mode) + owidth_for_shape_check = pooling_output_shape(iwidth, kW, padW, dW, 1, ceil_mode) + + avg_pool3d_backward_shape_check( + input, + grad_output, + nslices, + kT, + kH, + kW, + dT, + dH, + dW, + padT, + padH, + padW, + itime, + iheight, + iwidth, + otime_for_shape_check, + oheight_for_shape_check, + owidth_for_shape_check, + "avg_pool3d_backward()", + ) + + return input.new_empty(input.shape) + + +@register_meta(aten._adaptive_avg_pool2d.default) +def meta_adaptive_avg_pool2d(self, output_size): + torch._check( + self.ndim == 3 or self.ndim == 4, + lambda: f"Expected 3D or 4D tensor, but got {self.shape}", + ) + output_shape = self.shape[:-2] + tuple(output_size) + memory_format = utils.suggest_memory_format(self) + # need to set memory_format to preserve the memory format of the input + # channel last input should have channel last output + return torch.empty( + output_shape, + dtype=self.dtype, + device=self.device, + memory_format=memory_format, + ) + + +@register_meta(aten._adaptive_avg_pool3d.default) +def meta_adaptive_avg_pool3d(self, output_size): + torch._check( + self.ndim == 4 or self.ndim == 5, + lambda: f"Expected 4D or 5D tensor, but got {self.shape}", + ) + return self.new_empty(self.shape[:-3] + tuple(output_size)) + + +@register_meta(aten._adaptive_avg_pool2d_backward.default) +def meta__adaptive_avg_pool2d_backward(grad_out, self): + ndim = grad_out.ndim + for i in range(1, ndim): + torch._check( + grad_out.size(i) > 0, + lambda: f"adaptive_avg_pool2d_backward(): Expected grad_output to have non-zero \ + size for non-batch dimensions, {grad_out.shape} with dimension {i} being empty", + ) + torch._check( + ndim == 3 or ndim == 4, + lambda: f"adaptive_avg_pool2d_backward(): Expected 3D or 4D tensor, but got {self.shape}", + ) + torch._check( + self.dtype == grad_out.dtype, + lambda: f"expected dtype {self.dtype} for `grad_output` but got dtype {grad_out.dtype}", + ) + memory_format = torch.contiguous_format + if is_channels_last(self): + memory_format = torch.channels_last + return self.new_empty(self.shape).to(memory_format=memory_format) + + +@register_meta(aten._adaptive_avg_pool3d_backward) +@out_wrapper("grad_input") +def meta__adaptive_avg_pool3d_backward(grad_output, self): + _adaptive_pool_empty_output_check(grad_output, "adaptive_avg_pool3d_backward") + return torch.empty_like(self, memory_format=torch.legacy_contiguous_format) + + +def _adaptive_pool_empty_output_check(grad_output: Tensor, arg_name: str): + ndim = grad_output.ndim + for i in range(1, ndim): + torch._check( + grad_output.size(i) > 0, + lambda: ( + f"{arg_name}(): Expected grad_output to have non-zero size for non-batch dimensions, " + f"but grad_output has sizes {grad_output.shape} with dimension {i} being empty" + ), + ) + + +@register_meta(aten.adaptive_max_pool2d) +@out_wrapper("out", "indices") +def meta_adaptive_max_pool2d(input, output_size): + ndim = input.ndim + torch._check( + ndim in (3, 4), + lambda: f"adaptive_max_pool2d(): Expected 3D or 4D tensor, but got: {input.shape}", + ) + for i in range(1, ndim): + torch._check( + input.size(i) > 0, + lambda: ( + f"adaptive_max_pool2d(): Expected input to have non-zero size for non-batch dimensions, " + f"but input has sizes {input.shape} with dimension {i} being empty" + ), + ) + + torch._check( + len(output_size) == 2, + lambda: "adaptive_max_pool2d(): internal error: output_size.size() must be 2", + ) + + dimH = 1 + sizeB = 1 + sizeD = 0 + + if input.ndim == 4: + sizeB = input.size(0) + dimH += 1 + + sizeD = input.size(dimH - 1) + osizeH, osizeW = output_size + + if input.ndim == 3: + out_shape = (sizeD, osizeH, osizeW) + out = input.new_empty(out_shape) + indices = input.new_empty(out_shape, dtype=torch.int64) + return out, indices + else: + out_shape = (sizeB, sizeD, osizeH, osizeW) # type: ignore[assignment] + memory_format = utils.suggest_memory_format(input) + out = input.new_empty(out_shape).to(memory_format=memory_format) + indices = input.new_empty(out_shape, dtype=torch.int64).to( + memory_format=memory_format + ) + return out, indices + + +@register_meta(aten.adaptive_max_pool2d_backward) +@out_wrapper("grad_input") +def meta_adaptive_max_pool2d_backward(grad_output, input, indices): + ndim = grad_output.ndim + torch._check( + ndim in (3, 4), + lambda: f"adaptive_max_pooling2d_backward(): Expected 3D or 4D grad_output, but got: {grad_output.shape}", + ) + + _adaptive_pool_empty_output_check(grad_output, "adaptive_max_pool2d_backward") + + torch._check( + input.dtype == grad_output.dtype, + lambda: f"expected dtype {input.dtype} for `grad_output` but got dtype {grad_output.dtype}", + ) + + memory_format = utils.suggest_memory_format(input) + return input.new_empty(input.shape).to(memory_format=memory_format) + + +@register_meta(aten.adaptive_max_pool3d) +@out_wrapper("out", "indices") +def meta_adaptive_max_pool3d(input, output_size): + ndim = input.ndim + torch._check( + ndim in (4, 5), + lambda: f"adaptive_max_pool3d(): Expected 4D or 5D tensor, but got: {input.shape}", + ) + for i in range(1, ndim): + torch._check( + input.size(i) > 0, + lambda: ( + f"adaptive_max_pool3d(): Expected input to have non-zero size for non-batch dimensions, " + f"but input has sizes {input.shape} with dimension {i} being empty" + ), + ) + + torch._check( + len(output_size) == 3, + lambda: "adaptive_max_pool3d(): internal error: output_size.size() must be 3", + ) + + dimD = 0 + sizeB = 1 + sizeD = 0 + + if ndim == 5: + sizeB = input.size(0) + dimD += 1 + + sizeD = input.size(dimD) + osizeT, osizeH, osizeW = output_size + + if ndim == 4: + out_shape = (sizeD, osizeT, osizeH, osizeW) + else: + out_shape = (sizeB, sizeD, osizeT, osizeH, osizeW) # type: ignore[assignment] + + out = input.new_empty(out_shape) + indices = input.new_empty(out_shape, dtype=torch.int64) + + return out, indices + + +@register_meta(aten.adaptive_max_pool3d_backward) +@out_wrapper("grad_input") +def meta_adaptive_max_pool3d_backward(grad_output, input, indices): + _adaptive_pool_empty_output_check(grad_output, "adaptive_max_pool3d_backward") + return input.new_empty(input.shape) + + +@register_meta(aten.repeat_interleave.Tensor) +def meta_repeat_interleave_Tensor(repeats, output_size=None): + if output_size is None: + raise RuntimeError("cannot repeat_interleave a meta tensor without output_size") + return repeats.new_empty(output_size) + + +@register_meta([aten.complex.default, aten.complex.out]) +@out_wrapper() +def meta_complex(real, imag): + assert real.dtype.is_floating_point + assert imag.dtype.is_floating_point + result = elementwise_meta( + real.to(corresponding_complex_dtype(real.dtype)), + imag.to(corresponding_complex_dtype(imag.dtype)), + type_promotion=ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT, + ) + return result + + +@register_meta([aten.nonzero_static.default, aten.nonzero_static.out]) +@out_wrapper() +def nonzero_static(self, *, size, fill_value: int = -1): + return self.new_empty((size, self.dim()), dtype=torch.long) + + +@register_meta([torch.ops.aten.nonzero.default, torch.ops.aten.nonzero.out]) +@out_wrapper() +def nonzero(self): + torch._check_not_implemented( + exp_config.meta_nonzero_assume_all_nonzero, + lambda: "The register_meta function for torch.nonzero() raises unimplemented by default, " + "as a correct data-independent implementation does not exist. This implementation " + "returns a fake value, assuming all elements of the tensor are non-zero. " + "To enable this registration, please set " + "'torch.fx.experimental._config.meta_nonzero_assume_all_nonzero' to True.", + ) + return torch.empty_strided( + (self.numel(), self.dim()), + (1, self.numel()), + dtype=torch.long, + device=self.device, + ) + + +@register_meta([aten.index.Tensor, aten._unsafe_index.Tensor]) +def meta_index_Tensor(self, indices): + torch._check(bool(indices), lambda: "at least one index must be provided") + # aten::index is the internal advanced indexing implementation + # checkIndexTensorTypes and expandTensors + result: list[Tensor | None] = [] + for i, index in enumerate(indices): + if index is not None: + torch._check( + index.dtype in [torch.long, torch.int, torch.int8, torch.bool], + lambda: "tensors used as indices must be long, int, byte or bool tensors", + ) + if index.dtype in [torch.int8, torch.bool]: + nonzero = index.nonzero() + k = len(result) + torch._check_index( + k + index.ndim <= self.ndim, + lambda: f"too many indices for tensor of dimension {self.ndim}", + ) + for j in range(index.ndim): + torch._check_index( + index.shape[j] == self.shape[k + j], + lambda: f"The shape of the mask {index.shape} at index {i} " + f"does not match the shape of the indexed tensor {self.shape} at index {k + j}", + ) + result.append(nonzero.select(1, j)) + else: + result.append(index) + else: + result.append(index) + indices = result + torch._check( + len(indices) <= self.ndim, + lambda: f"too many indices for tensor of dimension {self.ndim} (got {len(indices)})", + ) + # expand_outplace + import torch._refs as refs # avoid import cycle in mypy + + indices = list(refs._maybe_broadcast(*indices)) + # add missing null tensors + while len(indices) < self.ndim: + indices.append(None) + + # hasContiguousSubspace + # true if all non-null tensors are adjacent + # See: + # https://numpy.org/doc/stable/user/basics.indexing.html#combining-advanced-and-basic-indexing + # https://stackoverflow.com/questions/53841497/why-does-numpy-mixed-basic-advanced-indexing-depend-on-slice-adjacency + state = 0 + has_contiguous_subspace = False + for index in indices: + if state == 0: + if index is not None: + state = 1 + elif state == 1: + if index is None: + state = 2 + else: + if index is not None: + break + else: + has_contiguous_subspace = True + + # transposeToFront + # This is the logic that causes the newly inserted dimensions to show up + # at the beginning of the tensor, if they're not contiguous + if not has_contiguous_subspace: + dims = [] + transposed_indices = [] + for i, index in enumerate(indices): + if index is not None: + dims.append(i) + transposed_indices.append(index) + for i, index in enumerate(indices): + if index is None: + dims.append(i) + transposed_indices.append(index) + self = self.permute(dims) + indices = transposed_indices + + # AdvancedIndex::AdvancedIndex + # Now we can assume the indices have contiguous subspace + # This is simplified from AdvancedIndex which goes to more effort + # to put the input and indices in a form so that TensorIterator can + # take them. If we write a ref for this, probably that logic should + # get implemented + before_shape: list[int] = [] + after_shape: list[int] = [] + replacement_shape: list[int] = [] + for dim, index in enumerate(indices): + if index is None: + if replacement_shape: + after_shape.append(self.shape[dim]) + else: + before_shape.append(self.shape[dim]) + else: + replacement_shape = list(index.shape) + + def _restride_src(self): + """ + This follows restride_src in TensorAdvancedIndexing.cpp + """ + shape = before_shape + replacement_shape + after_shape + strides = list(self.stride()) + # pyrefly: ignore [unsupported-operation] + strides[len(before_shape) : len(self.shape) - len(after_shape)] = [0] * len( + replacement_shape + ) + return self.as_strided(shape, strides) + + out = self.new_empty(before_shape + replacement_shape + after_shape) + from torch.fx.experimental.symbolic_shapes import guard_or_false + + if guard_or_false(self.numel() == 0): + # No need to worry about the output strides if self is empty. + return out + + # Try to follow eager to decide the output stride based on self. + # Note that perm here is the reverse of the 'perm_' decided by + # TensorIteratorBase::reorder_dimensions + restrided_self = _restride_src(self) + perm, _ = utils.compute_elementwise_output_logical_to_physical_perm(restrided_self) + + # Follow TensorIteratorBase::allocate_or_resize_outputs + if list(perm) != list(range(len(perm))): + perm_shape = utils.apply_perm(out.shape, perm) + new_stride = utils.make_contiguous_strides_for(perm_shape) + new_stride = utils.apply_perm(new_stride, utils.invert_perm(perm)) + out = out.as_strided(out.size(), new_stride) + return out + + +@register_meta([aten.convolution_backward.default]) +def meta_convolution_backward( + grad_output_, + input_, + weight_, + bias_sizes_opt, + stride, + padding, + dilation, + transposed, + output_padding, + groups, + output_mask, +): + # High level logic taken from slow_conv3d_backward_cpu which should + # be representative of all convolution_backward impls + backend_grad_input = None + backend_grad_weight = None + backend_grad_bias = None + + if output_mask[0]: + backend_grad_input = grad_output_.new_empty(input_.size()) + if output_mask[1]: + backend_grad_weight = grad_output_.new_empty(weight_.size()) + if output_mask[2]: + backend_grad_bias = grad_output_.new_empty(bias_sizes_opt) + + return (backend_grad_input, backend_grad_weight, backend_grad_bias) + + +@register_meta([aten.addbmm.default, aten.addbmm.out]) +@out_wrapper(exact_dtype=True) +def meta_addbmm(self, batch1, batch2, *, beta=1, alpha=1): + dim1 = batch1.size(1) + dim2 = batch2.size(2) + self = self.expand((dim1, dim2)) + torch._check(batch1.dim() == 3, lambda: "batch1 must be a 3D tensor") + torch._check(batch2.dim() == 3, lambda: "batch2 must be a 3D tensor") + torch._check( + batch1.size(0) == batch2.size(0), + lambda: f"batch1 and batch2 must have same number of batches, got {batch1.size(0)} and {batch2.size(0)}", + ) + torch._check( + batch1.size(2) == batch2.size(1), + lambda: ( + f"Incompatible matrix sizes for bmm ({batch1.size(1)}x{batch1.size(2)} " + f"and {batch2.size(1)}x{batch2.size(2)})" + ), + ) + torch._check( + self.size(0) == dim1 and self.size(1) == dim2, + lambda: "self tensor does not match matmul output shape", + ) + return self.new_empty(self.size()) + + +@register_meta([aten.randint_like.Tensor]) +def meta_randint_like(self, high, **kwargs): + return self.new_empty(self.size()) + + +@register_meta([aten._fused_adam_.default, aten._fused_adamw_.default]) +def meta__fused_adam_( + self, + grads, + exp_avgs, + exp_avg_sqs, + max_exp_avg_sqs, + state_steps, + *, + lr, + beta1, + beta2, + weight_decay, + eps, + amsgrad, + maximize, + grad_scale=None, + found_inf=None, +): + for l in [self, grads, exp_avgs, exp_avg_sqs, max_exp_avg_sqs, state_steps]: + torch._check( + isinstance(l, list), + lambda: f"exponent must be a tensor list but got {type(l)}", + ) + + +@register_meta([aten._fused_adam.default]) +def meta__fused_adam( + self, + grads, + exp_avgs, + exp_avg_sqs, + max_exp_avg_sqs, + state_steps, + *, + lr, + beta1, + beta2, + weight_decay, + eps, + amsgrad, + maximize, + grad_scale=None, + found_inf=None, +): + for l in [self, grads, exp_avgs, exp_avg_sqs, max_exp_avg_sqs, state_steps]: + torch._check( + isinstance(l, list), + lambda: f"exponent must be a tensor list but got {type(l)}", + ) + + def empty_like_list(tensor_list): + return [torch.empty_like(t) for t in tensor_list] + + return ( + empty_like_list(self), + empty_like_list(grads), + empty_like_list(exp_avgs), + empty_like_list(exp_avg_sqs), + empty_like_list(max_exp_avg_sqs), + ) + + +@register_meta([aten._int_mm]) +@out_wrapper() +def meta__int_mm(a, b): + torch._check(a.dim() == 2, lambda: "a must be a 2D tensor") + torch._check(b.dim() == 2, lambda: "b must be a 2D tensor") + torch._check( + a.dtype is torch.int8, + lambda: f"expected self to be int8, got {a.dtype}", + ) + torch._check( + b.dtype is torch.int8, + lambda: f"expected mat2 to be int8, got {b.dtype}", + ) + torch._check( + a.size(1) == b.size(0), + lambda: ( + f"Incompatible matrix sizes for _int_mm ({a.size(0)}x{a.size(1)} " + f"and {b.size(0)}x{b.size(1)})" + ), + ) + return a.new_empty((a.size(0), b.size(1)), dtype=torch.int32) + + +@register_meta([aten._convert_weight_to_int4pack]) +def meta__convert_weight_to_int4pack(w, inner_k_tiles): + torch._check(w.dim() == 2, lambda: "w must be a 2D tensor") + torch._check( + w.dtype is torch.uint8, + lambda: f"expected w to be uint8, got {w.dtype}", + ) + n = w.size(0) + k = w.size(1) * 2 # w is [n][k / 2] uint8 + return w.new_empty( + ( + n // 8, + k // (inner_k_tiles * 16), + 32, + inner_k_tiles // 2, + ), + dtype=torch.int32, + ) + + +@register_meta([aten._convert_weight_to_int4pack_for_cpu]) +def meta__convert_weight_to_int4pack_for_cpu(w, inner_k_tiles): + torch._check(w.dim() == 2, lambda: "w must be a 2D tensor") + torch._check( + w.dtype is torch.int32, + lambda: f"expected w to be int32, got {w.dtype}", + ) + n = w.size(0) + k = w.size(1) # w is [n][k] int32 + return w.new_empty( + (n, k // 2), + dtype=torch.uint8, + ) + + +@register_meta([aten._weight_int4pack_mm]) +def meta__weight_int4pack_mm(x, w, q_group_size, q_scale_and_zeros): + torch._check(x.dim() == 2, lambda: "x must be a 2D tensor") + torch._check(w.dim() == 4, lambda: "w must be a 4D tensor") + torch._check( + x.dtype in [torch.float32, torch.float16, torch.bfloat16], + lambda: f"expected x to be f32/f16/bf16, got {x.dtype}", + ) + torch._check( + w.dtype is torch.int32, + lambda: f"expected w to be int32, got {w.dtype}", + ) + return x.new_empty(x.size(0), w.size(0) * 8, dtype=x.dtype) + + +@register_meta([aten._weight_int4pack_mm_for_cpu]) +def meta__weight_int4pack_mm_for_cpu(x, w, q_group_size, q_scale_and_zeros): + torch._check(x.dim() == 2, lambda: "x must be a 2D tensor") + torch._check(w.dim() == 2, lambda: "w must be a 2D tensor") + torch._check( + x.dtype in [torch.float32, torch.float16, torch.bfloat16], + lambda: f"expected x to be f32/f16/bf16, got {x.dtype}", + ) + torch._check( + w.dtype is torch.uint8, + lambda: f"expected w to be uint8, got {w.dtype}", + ) + return x.new_empty(x.size(0), w.size(0), dtype=x.dtype) + + +@register_meta([aten._weight_int4pack_mm_with_scales_and_zeros]) +def _weight_int4pack_mm_with_scales_and_zeros(x, w, q_group_size, qScale, qZeros): + torch._check(x.dim() == 2, lambda: "x must be a 2D tensor") + torch._check(w.dim() == 2, lambda: "w must be a 2D tensor") + torch._check( + x.dtype in [torch.float32, torch.float16, torch.bfloat16], + lambda: f"expected x to be f32/f16/bf16, got {x.dtype}", + ) + torch._check( + w.dtype is torch.int32, + lambda: f"expected w to be int32, got {w.dtype}", + ) + return x.new_empty(x.size(0), w.size(0), dtype=x.dtype) + + +def kai_roundup(a: int, b: int) -> int: + return ((a + b - 1) // b) * b + + +def get_kai_packed_weight_size(n_bits, N, K, groupsize): + if n_bits == 4: + # Works for both fp32 and bf16 Kernels + if groupsize == K: # channelwise + # dotprod params only [1x8x32_neon_dotprod] + kai_nr = 8 + kai_kr = 16 + kai_sr = 2 + kai_num_bytes_sum_rhs = 4 # sizeof(int32_t) + kai_num_bytes_multiplier_rhs = 4 # sizeof(float) + kai_num_bytes_bias = 4 # sizeof(float) + + def kai_k_roundedup(k, kr, sr): + # Since we pack a float and int32 value at the end of the row, + # we must make sure that k is a multiple of 4 for alignment + kr_sr_roundedup4 = kai_roundup(kr * sr, 4) + return kai_roundup(k, kr_sr_roundedup4) + + def kai_get_rhs_packed_stride_rhs_pack_nxk_qsi4cxp_qsu4cxs1s0( + k, nr, kr, sr + ): + k_internal = kai_k_roundedup(k, kr, sr) + + assert (k_internal % 2) == 0, "k_internal must be even" + + return nr * ( + (k_internal // 2) + + kai_num_bytes_multiplier_rhs + + kai_num_bytes_sum_rhs + + kai_num_bytes_bias + ) + + def kai_get_rhs_packed_size_rhs_pack_nxk_qsi4cxp_qsu4cxs1s0( + n, k, nr, kr, sr + ): + num_rows = kai_roundup(n, nr) // nr + + return ( + num_rows + * kai_get_rhs_packed_stride_rhs_pack_nxk_qsi4cxp_qsu4cxs1s0( + k, nr, kr, sr + ) + ) + + return kai_get_rhs_packed_size_rhs_pack_nxk_qsi4cxp_qsu4cxs1s0( + N, K, kai_nr, kai_kr, kai_sr + ) + elif groupsize % 32 == 0 and K % groupsize == 0: # groupwise + kai_nr = 8 + kai_kr = 16 + kai_sr = 2 + kai_num_bytes_sum_rhs = 4 + kai_num_bytes_bias = 4 + kai_nr_multiple_of = 4 + kai_bl_multiple_of = 32 + + def kai_get_rhs_packed_size_rhs_pack_nxk_qsi4c32p_qsu4c32s1s0( + n, k, nr, kr, sr, bl + ): + assert (bl % kr) == 0 + assert (nr % kai_nr_multiple_of) == 0 + assert (bl % kai_bl_multiple_of) == 0 + + num_rows = kai_roundup(n, nr) // nr + + return ( + num_rows + * kai_get_rhs_packed_stride_rhs_pack_nxk_qsi4c32p_qsu4c32s1s0( + k, nr, kr, sr, bl + ) + ) + + def kai_get_rhs_packed_stride_rhs_pack_nxk_qsi4c32p_qsu4c32s1s0( + k, nr, kr, sr, bl + ): + assert (bl % kr) == 0 + assert (nr % kai_nr_multiple_of) == 0 + assert (bl % kai_bl_multiple_of) == 0 + + # kr and sr are unused in the calculation + num_bytes_multiplier_rhs = kai_get_bf16_datatype_size_in_bytes() + num_blocks_per_row = kai_num_blocks_per_row(k, bl) + num_bytes_per_block = kai_num_bytes_per_block( + bl, num_bytes_multiplier_rhs + ) + + return nr * ( + (num_bytes_per_block * num_blocks_per_row) + + kai_num_bytes_sum_rhs + + kai_num_bytes_bias + ) + + # This function returns size of these datatypes stored as enum. We modify it to just return bf16 datatype + # https://gitlab.arm.com/kleidi/kleidiai/-/blob/main/kai/kai_common.h?ref_type=heads#L55 + def kai_get_bf16_datatype_size_in_bytes(): + return 2 # 2 bytes + + def kai_num_blocks_per_row(k, bl): + assert (bl % kai_bl_multiple_of) == 0 + return kai_roundup(k, bl) // bl + + def kai_num_bytes_per_block(bl, num_bytes_multiplier_rhs): + assert (bl % kai_bl_multiple_of) == 0 + return (bl // 2) + num_bytes_multiplier_rhs + + return kai_get_rhs_packed_size_rhs_pack_nxk_qsi4c32p_qsu4c32s1s0( + N, K, kai_nr, kai_kr, kai_sr, groupsize + ) + + +@register_meta([aten._dyn_quant_pack_4bit_weight]) +def meta__dyn_quant_pack_4bit_weight( + weights, scales_zeros, bias: Tensor | None, block_size, in_features, out_features +): + torch._check( + weights.dtype is torch.uint8, + lambda: f"expected w to be uint8, got {weights.dtype}", + ) + if torch.backends.kleidiai.is_available() and ( + (block_size == in_features and scales_zeros.dtype == torch.float) + or ( + block_size < in_features + and block_size % 32 == 0 + and in_features % block_size == 0 + and scales_zeros.dtype == torch.bfloat16 + ) + ): + packed_weight_size = get_kai_packed_weight_size( + 4, out_features, in_features, block_size + ) + return weights.new_empty(int(packed_weight_size), dtype=torch.uint8) + packed_weight_size = weights.numel() + scales_zeros.numel() + if bias is not None: + packed_weight_size += bias.numel() + return weights.new_empty(packed_weight_size, dtype=torch.float) + + +@register_meta([aten._dyn_quant_matmul_4bit]) +def meta__dyn_quant_matmul_4bit( + inp, + packed_weights, + block_size, + in_features, + out_features, +): + torch._check(inp.dim() == 2, lambda: "input must be a 2D tensor") + torch._check( + (inp.dtype == torch.float32) + or (inp.dtype == torch.bfloat16 and block_size == in_features), + lambda: ( + f"expected input to be f32 or bf16 (bf16 requires block_size == in_features), " + f"got {inp.dtype} with block_size={block_size} and in_features={in_features}" + ), + ) + M = inp.size(0) + return inp.new_empty(M, out_features, dtype=inp.dtype) + + +@register_meta([aten._weight_int8pack_mm]) +def meta__weight_int8pack_mm(x, w, q_scales): + torch._check(x.dim() == 2, lambda: "x must be a 2D tensor") + torch._check( + x.dtype in [torch.float32, torch.float16, torch.bfloat16], + lambda: f"expected x to be f32/f16/bf16, got {x.dtype}", + ) + torch._check(w.dim() == 2, lambda: "w must be a 2D tensor") + torch._check( + w.dtype is torch.int8, + lambda: f"expected w to be int8, got {w.dtype}", + ) + return x.new_empty(x.size(0), w.size(0), dtype=x.dtype) + + +@register_meta(aten._cdist_forward.default) +def meta_cdist_forward(x1, x2, p, compute_mode): + torch._check( + x1.dim() >= 2, + lambda: f"cdist only supports at least 2D tensors, X1 got: {x1.dim()}D", + ) + torch._check( + x2.dim() >= 2, + lambda: f"cdist only supports at least 2D tensors, X2 got: {x2.dim()}D", + ) + torch._check( + x1.size(-1) == x2.size(-1), + lambda: f"X1 and X2 must have the same number of columns. X1: {x1.size(-1)} X2: {x2.size(-1)}", + ) + torch._check( + utils.is_float_dtype(x1.dtype), + lambda: f"cdist only supports floating-point dtypes, X1 got: {x1.dtype}", + ) + torch._check( + utils.is_float_dtype(x2.dtype), + lambda: f"cdist only supports floating-point dtypes, X2 got: {x2.dtype}", + ) + torch._check(p >= 0, lambda: "cdist only supports non-negative p values") + torch._check( + compute_mode in (None, 0, 1, 2), + lambda: f"possible modes: None, 0, 1, 2, but was: {compute_mode}", + ) + r1 = x1.size(-2) + r2 = x2.size(-2) + batch_tensor1 = x1.shape[:-2] + batch_tensor2 = x2.shape[:-2] + output_shape = list(torch.broadcast_shapes(batch_tensor1, batch_tensor2)) + output_shape.extend([r1, r2]) + return x1.new_empty(output_shape) + + +@register_meta(aten._cdist_backward) +@out_wrapper() +def meta_cdist_backward(grad, x1, x2, p, cdist): + c1 = x1.shape[-1] + r1 = x1.shape[-2] + r2 = x2.shape[-2] + batch_tensor1 = x1.shape[:-2] + batch_tensor2 = x2.shape[:-2] + expand_batch_portion = list(torch.broadcast_shapes(batch_tensor1, batch_tensor2)) + tensor1_expand_size = expand_batch_portion.copy() + tensor1_expand_size.extend([r1, c1]) + batch_product = math.prod(expand_batch_portion) + if r1 == 0 or r2 == 0 or c1 == 0 or batch_product == 0: + return torch.zeros_like(x1) + if tensor1_expand_size != list(x1.shape): + x1 = x1.expand(tensor1_expand_size) + return torch.empty_like(x1, memory_format=torch.contiguous_format) + + +# NB: This meta function accepts non-meta arguments! When this behavior +# was originally introduced this was accidental, but it is now load bearing +# as people are using this so that they can conveniently test code involving +# embeddings (feeding CPU tensor inputs with meta device EmbeddingBag module) +@register_meta(aten._embedding_bag.default) +def meta_embedding_bag( + weight, + indices, + offsets, + scale_grad_by_freq=False, + mode=0, + sparse=False, + per_sample_weights=None, + include_last_offset=False, + padding_idx=-1, +): + torch._check( + indices.dtype in (torch.long, torch.int), + lambda: f"expected indices to be long or int, got {indices.dtype}", + ) + torch._check( + offsets.dtype in (torch.long, torch.int), + lambda: f"expected offsets to be long or int, got {offsets.dtype}", + ) + torch._check( + utils.is_float_dtype(weight.dtype), + lambda: f"expected weight to be floating point type, got {weight.dtype}", + ) + + num_bags = offsets.size(0) + if include_last_offset: + torch._check( + num_bags >= 1, + lambda: "include_last_offset: numBags should be at least 1", + ) + num_bags -= 1 + + output = weight.new_empty(num_bags, weight.size(1)) + + if per_sample_weights is not None: + torch._check( + mode == MODE_SUM, + lambda: "embedding_bag: per_sample_weights only supported with mode='sum'", + ) + torch._check( + per_sample_weights.ndim == 1, + lambda: f"expected per_sample_weights to be 1D tensor, got {per_sample_weights.ndim}D", + ) + torch._check( + per_sample_weights.numel() == indices.numel(), + lambda: ( + f"expected per_sample_weights.numel() ({per_sample_weights.numel()} " + f"to be the same as indices.numel() ({indices.numel()})" + ), + ) + + def is_fast_path_index_select_scale(src, scale, output, padding_idx): + return ( + is_fast_path_index_select(src, output, padding_idx) and scale.stride(0) == 1 + ) + + def is_fast_path_index_select(src, output, padding_idx): + return ( + (src.dtype == torch.float or src.dtype == torch.half) + and src.stride(1) == 1 + and output.stride(1) == 1 + and padding_idx < 0 + ) + + def is_fast_path(src, scale, output, padding_idx): + if scale is not None: + return is_fast_path_index_select_scale(src, scale, output, padding_idx) + else: + return is_fast_path_index_select(src, output, padding_idx) + + if device_hint(offsets) != "cpu": + offset2bag = indices.new_empty(indices.size(0)) + bag_size = indices.new_empty(offsets.size()) + if mode == MODE_MAX: + max_indices = indices.new_empty(num_bags, weight.size(1)) + else: + max_indices = indices.new_empty(0) + else: + fast_path_sum = is_fast_path(weight, per_sample_weights, output, padding_idx) + if mode in (MODE_MEAN, MODE_MAX) or not fast_path_sum: + offset2bag = offsets.new_empty(indices.size(0)) + else: + offset2bag = offsets.new_empty(0) + bag_size = offsets.new_empty(num_bags) + # This part of the logic comes from make_max_indices_out in EmbeddingBag.cpp + numBags = offsets.shape[0] + if mode == MODE_MAX: + if include_last_offset: + torch._check( + numBags >= 1, + lambda: "include_last_offset: numBags should be at least 1", + ) + numBags -= 1 + max_indices = offsets.new_empty(numBags, weight.shape[1]) + else: + max_indices = offsets.new_empty(bag_size.size()) + return output, offset2bag, bag_size, max_indices + + +@register_meta(aten._embedding_bag_forward_only.default) +def meta_embedding_bag_forward_only(weight, indices, offsets, *args): + output, offset2bag, bag_size, max_indices = meta_embedding_bag( + weight, indices, offsets, *args + ) + if device_hint(offsets) == "cpu": + bag_size = offsets.new_empty(offsets.size()) + return output, offset2bag, bag_size, max_indices + + +def _get_reduction_dtype(input, dtype, promote_int_to_long=True): + # if specified, dtype takes precedence + if dtype: + return dtype + + if input.dtype.is_floating_point or input.dtype.is_complex: + return input.dtype + elif promote_int_to_long: + return torch.long + + return input.dtype + + +@register_meta([aten.nansum.default, aten.nansum.out]) +@out_wrapper() +def meta_nansum(input, dims=None, keepdim=False, *, dtype=None): + output_dtype = _get_reduction_dtype(input, dtype, promote_int_to_long=True) + dims = utils.reduction_dims(input.shape, dims) + output_shape = _compute_reduction_shape(input, dims, keepdim) + return input.new_empty(output_shape, dtype=output_dtype) + + +@register_meta([aten.median.default, aten.nanmedian.default]) +def meta_median(input): + output_shape = utils.compute_reduction_output_shape( + input.shape, tuple(range(input.dim())) + ) + return input.new_empty(output_shape) + + +@register_meta( + [ + aten.median.dim, + aten.median.dim_values, + aten.nanmedian.dim, + aten.nanmedian.dim_values, + aten.mode.default, + aten.mode.values, + ] +) +@out_wrapper("values", "indices") +def meta_median_mode_dim(input, dim=-1, keepdim=False): + if device_hint(input) == "cuda": + utils.alert_not_deterministic("median CUDA with indices output") + dim = utils.reduction_dims(input.shape, (dim,)) + output_shape = _compute_reduction_shape(input, dim, keepdim) + return ( + input.new_empty(output_shape), + input.new_empty(output_shape, dtype=torch.long), + ) + + +@register_meta(aten.logical_not_.default) +def meta_logical_not_(self): + return self + + +@register_meta(aten.repeat.default) +def meta_repeat(self, repeats): + torch._check( + len(repeats) >= self.dim(), + lambda: "Number of dimensions of repeat dims can not be smaller than number of dimensions of tensor", + ) + for i, rep in enumerate(repeats): + torch._check( + rep >= 0, + lambda: f"Repeats cannot be negative, found {rep} at index {i}", + ) + # Add new leading dimensions to the tensor if the + # number of target dimensions is larger than the + # number of source dimensions. + num_new_dimensions = len(repeats) - self.dim() + padded_size = (1,) * num_new_dimensions + tuple(self.shape) + target_size = [padded_size[i] * repeats[i] for i in range(len(repeats))] + return self.new_empty(target_size) + + +@register_meta(aten.zero_.default) +def meta_zero_(self): + return self + + +@register_meta( + [ + aten.mul_.Scalar, + aten.div_.Scalar, + aten.mul_.Tensor, + aten.div_.Tensor, + aten.logical_and_.default, + aten.logical_or_.default, + aten.logical_xor_.default, + ], +) +def meta_binop_inplace(self, other): + if isinstance(other, torch.Tensor): + check_inplace_broadcast(self.shape, other.shape) + return self + + +@register_meta( + [ + aten.add_.Scalar, + aten.sub_.Scalar, + aten.add_.Tensor, + aten.sub_.Tensor, + ], +) +def meta_binop_inplace_alpha(self, other, alpha=1): + """ + Some checks for inplace ops. + Checks for promotion rules for some dtypes. + int.add/sub_(float) and bool.add/sub_(others) are rejected. + Promoting in these in-place operations would require reallocating + and copying over elements, hence not allowed. + Checks for alpha param. + """ + + def is_integeric(arg): + if isinstance(arg, TensorLike): + return utils.is_integer_dtype(arg.dtype) + else: + return isinstance(arg, IntLike) + + def is_floatic(arg): + if isinstance(arg, TensorLike): + return utils.is_float_dtype(arg.dtype) + else: + return isinstance(arg, FloatLike) + + def is_booleanic(arg): + if isinstance(arg, TensorLike): + return utils.is_boolean_dtype(arg.dtype) + else: + return isinstance(arg, BoolLike) + + # Do not allow int+float->int in-place + if is_integeric(self) and is_floatic(other): + raise RuntimeError( + "Promotion of int.add/sub_(float) in in-place ops are not possible due to element size change." + ) + + # Do not allow bool+other->bool in-place + if is_booleanic(self) and not is_booleanic(other): + raise RuntimeError( + "Promotion of book.add/sub_(others) in in-place ops are not possible due to element size change." + ) + + if isinstance(other, torch.Tensor): + check_inplace_broadcast(self.shape, other.shape) + return self + + +@register_meta( + [ + aten.add.Scalar, + aten.sub.Scalar, + ], +) +def meta_binop_alpha(self, other, alpha=1): + return elementwise_meta( + self, other, type_promotion=ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT + ) + + +@register_meta([aten.round.default, aten.round.decimals]) +def meta_round(self, **kwargs): + return elementwise_meta( + self, type_promotion=ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT + ) + + +def shift_dtype_check(fn_name, self, val): + torch._check( + utils.is_integer_dtype(self.dtype), + lambda: f"{fn_name}: Expected input tensor to have an integral dtype. Got {self.dtype}", + ) + if isinstance(val, torch.Tensor): + torch._check( + utils.is_integer_dtype(val.dtype), + lambda: f"{fn_name}: Expected shift value to have an integral dtype. Got {val.dtype}", + ) + else: + torch._check( + isinstance(val, IntLike), + lambda: f"{fn_name}: Expected shift value to be an int. Got {val}", + ) + + +@register_meta([aten.__rshift__.Tensor, aten.__rshift__.Scalar]) +def meta_rshifts(self, other): + shift_dtype_check("rshift", self, other) + return elementwise_meta( + self, other, type_promotion=ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT + ) + + +@register_meta([aten.__lshift__.Tensor, aten.__lshift__.Scalar]) +def meta_lshifts(self, other): + shift_dtype_check("lshift", self, other) + return elementwise_meta( + self, other, type_promotion=ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT + ) + + +@register_meta(aten.zero.default) +def meta_zero(self): + return self.new_empty(self.shape) + + +@register_meta([aten.fill_.Tensor, aten.fill_.Scalar]) +def meta_fill_(self, val): + return self + + +@register_meta([aten.fill.Tensor, aten.fill.Scalar]) +def meta_fill(self, val): + return torch.empty_like(self) + + +@register_meta(aten.relu_.default) +def meta_relu_(self): + return self + + +@register_meta(aten._add_relu.Tensor) +@out_wrapper() +def meta__add_relu(self, other, alpha=1) -> Tensor: + return elementwise_meta( + self, other, type_promotion=ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT + ) + + +@register_meta([aten.rrelu_with_noise]) +@out_wrapper() +def meta_rrelu_with_noise( + self, noise, lower=0.125, upper=0.3333333333333333, training=False, generator=None +): + return torch.empty_like(self) + + +@register_meta([aten.rrelu_with_noise_functional]) +def meta_rrelu_with_noise_functional( + self, noise, lower=0.125, upper=0.3333333333333333, training=False, generator=None +): + return torch.empty_like(self), torch.empty_like(noise) + + +@register_meta([aten.rrelu_with_noise_]) +def meta_rrelu_with_noise_( + self, lower=0.125, upper=0.3333333333333333, training=False, generator=None +): + return self + + +@register_meta([aten.index_put.default, aten._unsafe_index_put.default]) +def meta_index_put(self, indices, values, accumulate=False): + return torch.empty_like(self) + + +@register_meta(aten.masked_fill_.Scalar) +def meta_masked_fill_(self, mask, value): + check_inplace_broadcast(self.shape, mask.shape) + return self + + +@register_meta(aten._masked_scale.default) +def meta__masked_scale(self, mask, scale): + masked_scale = self.new_empty(self.size()).to( + memory_format=utils.suggest_memory_format(self) + ) + return masked_scale + + +@register_meta(aten.masked_scatter_) +def meta_masked_scatter_(self, mask, source): + torch._check( + mask.dtype in (torch.bool, torch.uint8), lambda: "Mask must be bool or uint8" + ) + torch._check( + self.dtype == source.dtype, + lambda: "masked_scatter: expected self and source to have same " + f"dtypes but got {self.dtype} and {source.dtype}", + ) + return self + + +@register_meta(aten.masked_scatter) +@out_wrapper() +def meta_masked_scatter(self, mask, source): + self, mask = _maybe_broadcast(self, mask) + output = torch.empty_like(self, memory_format=torch.contiguous_format) + return meta_masked_scatter_(output, mask, source) + + +@register_meta(aten.masked_scatter_backward) +def meta_masked_scatter_backward(self, mask, sizes): + return self.new_empty(sizes) + + +@register_meta(aten.index_put_.default) +def meta_index_put_(self, indices, values, accumulate=False): + return self + + +def common_meta_baddbmm_bmm(batch1, batch2, is_bmm, self_baddbmm=None, out_dtype=None): + from torch.fx.experimental.symbolic_shapes import sym_and, sym_eq + + torch._check(batch1.dim() == 3, lambda: "batch1 must be a 3D tensor") + torch._check(batch2.dim() == 3, lambda: "batch2 must be a 3D tensor") + + batch1_sizes = batch1.size() + batch2_sizes = batch2.size() + + bs = batch1_sizes[0] + contraction_size = batch1_sizes[2] + res_rows = batch1_sizes[1] + res_cols = batch2_sizes[2] + output_size = (bs, res_rows, res_cols) + + torch._check( + sym_and(sym_eq(batch2_sizes[0], bs), sym_eq(batch2_sizes[1], contraction_size)), + lambda: f"Expected size for first two dimensions of batch2 tensor to be: [{bs}" + f", {contraction_size}] but got: [{batch2_sizes[0]}, {batch2_sizes[1]}].", + ) + if out_dtype: + supported_out_dtype = ( + batch1.dtype == torch.float16 or batch1.dtype == torch.bfloat16 + ) and out_dtype == torch.float32 + torch._check( + out_dtype == batch1.dtype or supported_out_dtype, + lambda: "out_dtype only supported for torch.float32 output with float16/bfloat16 inputs or same as input dtypes", + ) + output = batch2.new_empty(output_size).to(out_dtype) + else: + # TODO: handle out + output = batch2.new_empty(output_size) + + if not is_bmm and self_baddbmm is not None: + torch._check(self_baddbmm.dim() == 3, lambda: "self must be a 3D tensor") + torch._check( + sym_eq(self_baddbmm.size(), output_size), + lambda: f"Expected an input tensor shape with shape {output_size} but got shape: {self_baddbmm.size()}", + ) + + return output + + +@register_meta(aten.bmm.default) +def meta_bmm(self, mat2): + return common_meta_baddbmm_bmm(self, mat2, True) + + +@register_meta(aten.bmm.dtype) +def meta_bmm_dtype(self, mat2, out_dtype): + return common_meta_baddbmm_bmm(self, mat2, True, out_dtype=out_dtype) + + +def div_rtn(x, y): + q = x // y + r = x % y + # WARNING: explicit bool conversion here is necessary; + # would be fixed by SymBool + if r != 0 and (bool(r < 0) != bool(y < 0)): + q -= 1 + return q + + +def pooling_output_shape_pad_lr( + inputSize, + kernelSize, + pad_l, + pad_r, + stride, + dilation, + ceil_mode, +): + outputSize = ( + div_rtn( + inputSize + + pad_l + + pad_r + - dilation * (kernelSize - 1) + - 1 + + (stride - 1 if ceil_mode else 0), + stride, + ) + + 1 + ) + if ceil_mode: + if (outputSize - 1) * stride >= inputSize + pad_l: + outputSize -= 1 + return outputSize + + +def pooling_output_shape(inputSize, kernelSize, pad, stride, dilation, ceil_mode): + torch._check(stride != 0, lambda: "stride should not be zero") + torch._check(pad >= 0, lambda: f"pad must be non-negative, but got pad: {pad}") + torch._check( + pad <= ((kernelSize - 1) * dilation + 1) // 2, + lambda: ( + f"pad should be at most half of effective kernel size, but got pad={pad}, " + f"kernel_size={kernelSize} and dilation={dilation}" + ), + ) + return pooling_output_shape_pad_lr( + inputSize, kernelSize, pad, pad, stride, dilation, ceil_mode + ) + + +def pool2d_shape_check( + input, + kH, + kW, + dH, + dW, + padH, + padW, + dilationH, + dilationW, + nInputPlane, + inputHeight, + inputWidth, + outputHeight, + outputWidth, + memory_format, +): + ndim = input.dim() + nOutputPlane = nInputPlane + + torch._check( + kW > 0 and kH > 0, + lambda: f"kernel size should be greater than zero, but got kH: {kH}, kW: {kW}", + ) + torch._check( + dW > 0 and dH > 0, + lambda: f"stride should be greater than zero, but got dH: {dH}, dW: {dW}", + ) + torch._check( + dilationH > 0 and dilationW > 0, + lambda: f"dilation should be greater than zero, but got dilationH: {dilationH}, dilationW: {dilationW}", + ) + + valid_dims = input.size(1) != 0 and input.size(2) != 0 + + if memory_format == torch.channels_last: + torch._check( + ndim == 4 and valid_dims and input.size(3) != 0, + lambda: "Expected 4D (batch mode) tensor expected for input with channels_last layout" + f" with optional 0 dim batch size for input, but got: {input.size()}", + ) + else: + torch._check( + (ndim == 3 and input.size(0) != 0 and valid_dims) + or (ndim == 4 and valid_dims and input.size(3) != 0), + lambda: f"Expected 3D or 4D (batch mode) tensor with optional 0 dim batch size for input, but got: {input.size()}", + ) + + torch._check( + kW // 2 >= padW and kH // 2 >= padH, + lambda: "pad should be smaller than or equal to half of kernel size, but got " + f"padW = {padW}, padH = {padH}, kW = {kW}, kH = {kH}", + ) + + torch._check( + outputWidth >= 1 and outputHeight >= 1, + lambda: f"Given input size: ({nInputPlane}x{inputHeight}x{inputWidth}). " + f"Calculated output size: ({nOutputPlane}x{outputHeight}x{outputWidth}). " + "Output size is too small", + ) + + +def pool3d_shape_check( + input: Tensor, + nslices: int, + kT: int, + kH: int, + kW: int, + dT: int, + dH: int, + dW: int, + pT: int, + pH: int, + pW: int, + dilationT: int, + dilationH: int, + dilationW: int, + itime: int, + iheight: int, + iwidth: int, + otime: int, + oheight: int, + owidth: int, + fn_name: str, + check_input_size: bool = False, +): + ndim = input.ndim + + torch._check( + kT > 0 and kW > 0 and kH > 0, + lambda: ( + f"kernel size should be greater than zero, but got " + f"kT: {kT}, kH: {kH}, kW: {kW}" + ), + ) + torch._check( + dT > 0 and dW > 0 and dH > 0, + lambda: ( + f"stride should be greater than zero, but got dT: {dT}, dH: {dH}, dW: {dW}" + ), + ) + torch._check( + dilationT > 0 and dilationW > 0 and dilationH > 0, + lambda: ( + f"dilation should be greater than zero, but got " + f"dilationT: {dilationT}, dilationH: {dilationH}, dilationW: {dilationW}" + ), + ) + + torch._check( + ndim in (4, 5), + lambda: f"{fn_name}: Expected 4D or 5D tensor for input, but got: {input.shape}", + ) + + for i in range(ndim): + if ndim == 5 and i == 0: + # size of batch-dim can be 0. + continue + torch._check( + input.size(i) > 0, + lambda: ( + f"{fn_name}: Expected input's non-batch dimensions to have positive length," + f" but input has a shape of {input.shape}" + f" and non-batch dimension {input.size(i)} has length zero!" + ), + ) + + if check_input_size: # AveragePool3d + torch._check( + itime >= kT and iheight >= kH and iwidth >= kW, + lambda: ( + f"input image (T: {itime} H: {iheight} W: {iwidth}) smaller than " + f"kernel size (kT: {kT} kH: {kH} kW: {kW})" + ), + ) + + torch._check( + kT / 2 >= pT and kW / 2 >= pW and kH / 2 >= pH, + lambda: ( + f"pad should be smaller than or equal to half of kernel size, but got " + f"kT: {kT} kW: {kW} kH: {kH} padT: {pT} padW: {pW} padH: {pH}" + ), + ) + + torch._check( + otime >= 1 and owidth >= 1 and oheight >= 1, + lambda: ( + f"Given input size: ({nslices}x{itime}x{iheight}x{iwidth}). " + f"Calculated output size: ({nslices}x{otime}x{oheight}x{owidth}). " + f"Output size is too small" + ), + ) + + +def max_pool3d_backward_shape_check( + input, + grad_output, + indices, + nslices, + kT, + kH, + kW, + dT, + dH, + dW, + pT, + pH, + pW, + dilationT, + dilationH, + dilationW, + itime, + iheight, + iwidth, + otime, + oheight, + owidth, + fn_name, +): + ndim = input.ndim + + pool3d_shape_check( + input, + nslices, + kT, + kH, + kW, + dT, + dH, + dW, + pT, + pH, + pW, + dilationT, + dilationH, + dilationW, + itime, + iheight, + iwidth, + otime, + oheight, + owidth, + fn_name, + ) + + check_dim_size(grad_output, ndim, ndim - 4, nslices) + check_dim_size(grad_output, ndim, ndim - 3, otime) + check_dim_size(grad_output, ndim, ndim - 2, oheight) + check_dim_size(grad_output, ndim, ndim - 1, owidth) + + check_dim_size(indices, ndim, ndim - 4, nslices) + check_dim_size(indices, ndim, ndim - 3, otime) + check_dim_size(indices, ndim, ndim - 2, oheight) + check_dim_size(indices, ndim, ndim - 1, owidth) + + +def avg_pool3d_backward_shape_check( + input: Tensor, + grad_output: Tensor, + nslices: int, + kT: int, + kH: int, + kW: int, + dT: int, + dH: int, + dW: int, + pT: int, + pH: int, + pW: int, + itime: int, + iheight: int, + iwidth: int, + otime: int, + oheight: int, + owidth: int, + fn_name: str, +): + ndim = input.ndim + + pool3d_shape_check( + input, + nslices, + kT, + kH, + kW, + dT, + dH, + dW, + pT, + pH, + pW, + 1, + 1, + 1, + itime, + iheight, + iwidth, + otime, + oheight, + owidth, + fn_name, + True, + ) + + check_dim_size(grad_output, ndim, ndim - 4, nslices) + check_dim_size(grad_output, ndim, ndim - 3, otime) + check_dim_size(grad_output, ndim, ndim - 2, oheight) + check_dim_size(grad_output, ndim, ndim - 1, owidth) + + +def max_pool2d_checks_and_compute_shape( + input, + kernel_size, + stride, + padding, + dilation, + ceil_mode, +): + # Reference: aten/src/ATen/native/DilatedMaxPool2d.cpp + def unpack(name, val): + torch._check( + len(val) in [1, 2], + lambda: f"max_pool2d: {name} must either be a single int, or a tuple of two ints", + ) + H = val[0] + W = H if len(val) == 1 else val[1] + return H, W + + kH, kW = unpack("kernel_size", kernel_size) + + torch._check( + len(stride) in [0, 1, 2], + lambda: "max_pool2d: stride must either be omitted, a single int, or a tuple of two ints", + ) + if len(stride) == 0: + dH, dW = kH, kW + else: + dH, dW = unpack("stride", stride) + + padH, padW = unpack("padding", padding) + dilationH, dilationW = unpack("dilation", dilation) + nInputPlane = input.size(-3) + inputHeight = input.size(-2) + inputWidth = input.size(-1) + + memory_format = utils.suggest_memory_format(input) + if memory_format == torch.channels_last: + torch._check( + input.dim() == 4, + lambda: "non-empty 4D (batch mode) tensor expected for input with channels_last layout", + ) + elif memory_format == torch.contiguous_format: + torch._check( + input.dim() in [3, 4], + lambda: "non-empty 3D or 4D (batch mode) tensor expected for input", + ) + else: + torch._check( + False, + lambda: "Unsupported memory format. Supports only ChannelsLast, Contiguous", + ) + + outputHeight = pooling_output_shape(inputHeight, kH, padH, dH, dilationH, ceil_mode) + outputWidth = pooling_output_shape(inputWidth, kW, padW, dW, dilationW, ceil_mode) + + pool2d_shape_check( + input, + kH, + kW, + dH, + dW, + padH, + padW, + dilationH, + dilationW, + nInputPlane, + inputHeight, + inputWidth, + outputHeight, + outputWidth, + memory_format, + ) + + return nInputPlane, outputHeight, outputWidth + + +@register_meta(aten.max_pool2d_with_indices_backward.default) +def meta_max_pool2d_with_indices_backward( + grad_output, + self, + kernel_size, + stride, + padding, + dilation, + ceil_mode, + indices, +): + ( + nInputPlane, + outputHeight, + outputWidth, + ) = max_pool2d_checks_and_compute_shape( + self, kernel_size, stride, padding, dilation, ceil_mode + ) + + torch._check( + self.dtype == grad_output.dtype, + lambda: f"Expected dtype {self.dtype} for `gradOutput` but got dtype {grad_output.dtype}", + ) + + nOutputPlane = nInputPlane + ndim = self.ndim + + def _check_dim_size(t): + check_dim_size(t, ndim, ndim - 3, nOutputPlane) + check_dim_size(t, ndim, ndim - 2, outputHeight) + check_dim_size(t, ndim, ndim - 1, outputWidth) + + _check_dim_size(grad_output) + _check_dim_size(indices) + + memory_format = utils.suggest_memory_format(self) + return torch.empty( + self.shape, + dtype=self.dtype, + device=self.device, + memory_format=memory_format, + ) + + +@register_meta(aten.max_pool2d_with_indices.default) +def meta_max_pool2d_with_indices( + input, + kernel_size, + stride=(), + padding=(0,), + dilation=(1,), + ceil_mode=False, +): + ( + nInputPlane, + outputHeight, + outputWidth, + ) = max_pool2d_checks_and_compute_shape( + input, kernel_size, stride, padding, dilation, ceil_mode + ) + + nbatch = input.size(-4) if input.dim() == 4 else 1 + memory_format = utils.suggest_memory_format(input) + if input.dim() == 3: + size = [nInputPlane, outputHeight, outputWidth] + else: + size = [nbatch, nInputPlane, outputHeight, outputWidth] + return ( + torch.empty( + size, + dtype=input.dtype, + device=input.device, + memory_format=memory_format, + ), + torch.empty( + size, + dtype=torch.int64, + device=input.device, + memory_format=memory_format, + ), + ) + + +@register_meta(aten.fractional_max_pool2d.default) +def meta_fractional_max_pool2d(self, kernel_size, output_size, random_samples): + torch._check( + self.ndim in (3, 4), + lambda: f"fractional_max_pool2d: Expected 3D or 4D tensor, but got: {self.ndim}", + ) + ndim = self.ndim + + for d in range(ndim - 3, ndim): + torch._check( + self.size(d) > 0, + lambda: f"fractional_max_pool2d: Expected input to have non-zero " + f" size for non-batch dimensions, but got {self.size()} with dimension {d} empty", + ) + + # the check and message are out of sync, but this matches the structured meta + torch._check( + len(kernel_size) == 2, + lambda: "fractional_max_pool2d: kernel_size must" + "either be a single int or tuple of Ints", + ) + torch._check( + len(output_size) == 2, + lambda: "fractional_max_pool2d: output_size must " + "either be a single int or tuple of Ints", + ) + + input_channels = self.size(-3) + input_height = self.size(-2) + input_width = self.size(-1) + if ndim == 4: + input_batch = self.size(0) + else: + input_batch = 1 + + torch._check( + self.dtype == random_samples.dtype, + lambda: "Expect _random_samples to have the same dtype as input", + ) + torch._check( + random_samples.ndim == 3, + lambda: f"Expect _random samples to have 3 dimensions got, {random_samples.ndim}", + ) + + n = random_samples.size(0) + c = random_samples.size(1) + d = random_samples.size(2) + torch._check( + n >= input_batch, + lambda: "Expect _random_samples.size(0) no less then input batch size.", + ) + torch._check( + c == input_channels, + lambda: "Expect _random_samples.size(1) equals to input channel size.", + ) + torch._check(d == 2, lambda: f"Expect _random_samples.size(2) equals to 2 got {d}.") + + torch._check( + output_size[0] + kernel_size[0] - 1 <= input_height, + lambda: f"fractional_max_pool2d: kernel height {kernel_size[0]} is too large relative to input height {input_height}", + ) + torch._check( + output_size[1] + kernel_size[1] - 1 <= input_width, + lambda: f"fractional_max_pool2d: kernel width {kernel_size[1]} is too large relative to input width {input_width}", + ) + + if self.dim() == 4: + size = [input_batch, input_channels, output_size[0], output_size[1]] + else: + size = [input_channels, output_size[0], output_size[1]] + + return ( + torch.empty( + size, + dtype=self.dtype, + device=self.device, + ), + torch.empty( + size, + dtype=torch.int64, + device=self.device, + ), + ) + + +@register_meta(aten.max_pool3d_with_indices) +@out_wrapper("out", "indices") +def meta_max_pool3d_with_indices( + input, + kernel_size, + stride=(), + padding=(0,), + dilation=(1,), + ceil_mode=False, +): + torch._check( + len(kernel_size) in (1, 3), + lambda: "max_pool3d: kernel_size must either be a single int, or a tuple of three ints", + ) + kT = kernel_size[0] + kH = kT if len(kernel_size) == 1 else kernel_size[1] + kW = kT if len(kernel_size) == 1 else kernel_size[2] + + torch._check( + not stride or len(stride) in (1, 3), + lambda: "max_pool3d: stride must either be omitted, a single int, or a tuple of three ints", + ) + dT = kT if not stride else stride[0] + dH = kH if not stride else (dT if len(stride) == 1 else stride[1]) + dW = kW if not stride else (dT if len(stride) == 1 else stride[2]) + + torch._check( + len(padding) in (1, 3), + lambda: "max_pool3d: padding must either be a single int, or a tuple of three ints", + ) + pT = padding[0] + pH = pT if len(padding) == 1 else padding[1] + pW = pT if len(padding) == 1 else padding[2] + + torch._check( + len(dilation) in (1, 3), + lambda: "max_pool3d: dilation must be either a single int, or a tuple of three ints", + ) + dilationT = dilation[0] + dilationH = dilationT if len(dilation) == 1 else dilation[1] + dilationW = dilationT if len(dilation) == 1 else dilation[2] + + torch._check( + input.ndim in (4, 5), + lambda: "non-empty 4D or 5D (batch mode) tensor expected for input", + ) + + nbatch = input.size(-5) if input.ndim == 5 else 1 + nslices = input.size(-4) + itime = input.size(-3) + iheight = input.size(-2) + iwidth = input.size(-1) + + otime = pooling_output_shape(itime, kT, pT, dT, dilationT, ceil_mode) + oheight = pooling_output_shape(iheight, kH, pH, dH, dilationH, ceil_mode) + owidth = pooling_output_shape(iwidth, kW, pW, dW, dilationW, ceil_mode) + + pool3d_shape_check( + input, + nslices, + kT, + kH, + kW, + dT, + dH, + dW, + pT, + pH, + pW, + dilationT, + dilationH, + dilationW, + itime, + iheight, + iwidth, + otime, + oheight, + owidth, + "max_pool3d_with_indices()", + ) + + channels_last = ( + input.ndim == 5 and utils.suggest_memory_format(input) == torch.channels_last_3d + ) + if input.ndim == 4: + input_channels_last_check = input.unsqueeze(0) + channels_last = ( + not input_channels_last_check.is_contiguous() + ) and input_channels_last_check.is_contiguous( + memory_format=torch.channels_last_3d + ) + out_shape = (nslices, otime, oheight, owidth) + else: + out_shape = (nbatch, nslices, otime, oheight, owidth) # type: ignore[assignment] + + out = input.new_empty(out_shape) + indices = input.new_empty(out_shape, dtype=torch.int64) + + if channels_last: + out = out.to(memory_format=torch.channels_last_3d) + indices = indices.to(memory_format=torch.channels_last_3d) + + return out, indices + + +@register_meta(aten.max_pool3d_with_indices_backward) +@out_wrapper("grad_input") +def meta_max_pool3d_with_indices_backward( + grad_output, + input, + kernel_size, + stride, + padding, + dilation, + ceil_mode, + indices, +): + torch._check( + len(kernel_size) in (1, 3), + lambda: "max_pool3d: kernel_size must either be a single int, or a tuple of three ints", + ) + kT = kernel_size[0] + kH = kT if len(kernel_size) == 1 else kernel_size[1] + kW = kT if len(kernel_size) == 1 else kernel_size[2] + + torch._check( + not stride or len(stride) in (1, 3), + lambda: "max_pool3d: stride must either be omitted, a single int, or a tuple of three ints", + ) + dT = kT if not stride else stride[0] + dH = kH if not stride else (dT if len(stride) == 1 else stride[1]) + dW = kW if not stride else (dT if len(stride) == 1 else stride[2]) + + torch._check( + len(padding) in (1, 3), + lambda: "max_pool3d: padding must either be a single int, or a tuple of three ints", + ) + pT = padding[0] + pH = pT if len(padding) == 1 else padding[1] + pW = pT if len(padding) == 1 else padding[2] + + torch._check( + len(dilation) in (1, 3), + lambda: "max_pool3d: dilation must be either a single int, or a tuple of three ints", + ) + dilationT = dilation[0] + dilationH = dilationT if len(dilation) == 1 else dilation[1] + dilationW = dilationT if len(dilation) == 1 else dilation[2] + + torch._check( + input.ndim in (4, 5), + lambda: "non-empty 4D or 5D (batch mode) tensor expected for input", + ) + + nslices = input.size(-4) + itime = input.size(-3) + iheight = input.size(-2) + iwidth = input.size(-1) + + otime = grad_output.size(-3) + oheight = grad_output.size(-2) + owidth = grad_output.size(-1) + + max_pool3d_backward_shape_check( + input, + grad_output, + indices, + nslices, + kT, + kH, + kW, + dT, + dH, + dW, + pT, + pH, + pW, + dilationT, + dilationH, + dilationW, + itime, + iheight, + iwidth, + otime, + oheight, + owidth, + "max_pool3d_with_indices_backward()", + ) + + channels_last = ( + input.ndim == 5 and utils.suggest_memory_format(input) == torch.channels_last_3d + ) + if input.ndim == 4: + input_channels_last_check = input.unsqueeze(0) + channels_last = ( + not input_channels_last_check.is_contiguous() + ) and input_channels_last_check.is_contiguous( + memory_format=torch.channels_last_3d + ) + + grad_input = input.new_empty(input.shape) + + if channels_last: + grad_input = grad_input.to(memory_format=torch.channels_last_3d) + + return grad_input + + +def check_grid_sampler_common(input: Tensor, grid: Tensor): + torch._check( + input.device == grid.device, + lambda: ( + f"grid_sampler(): expected input and grid to be on same device, but input " + f"is on {input.device} and grid is on {grid.device}" + ), + ) + torch._check( + input.layout == torch.strided and grid.layout == torch.strided, + lambda: ( + f"grid_sampler(): expected input and grid to have torch.strided layout, but " + f"input has {input.layout} and grid has {grid.layout}" + ), + ) + torch._check( + input.shape[0] == grid.shape[0], + lambda: ( + f"grid_sampler(): expected grid and input to have same batch size, but got " + f"input with sizes {input.shape} and grid with sizes {grid.shape}" + ), + ) + torch._check( + grid.shape[-1] == input.ndim - 2, + lambda: ( + f"grid_sampler(): expected grid to have size {input.ndim - 2} in last " + f"dimension, but got grid with sizes {grid.shape}" + ), + ) + + for i in range(2, input.ndim): + torch._check( + input.shape[i] > 0, + lambda: ( + f"grid_sampler(): expected input to have non-empty spatial dimensions, " + f"but input has sizes {input.shape} with dimension {i} being empty" + ), + ) + + +class GridSamplerInterpolation(Enum): + BILINEAR = 0 + NEAREST = 1 + BICUBIC = 2 + + +def check_grid_sampler_3d(input: Tensor, grid: Tensor, interpolation_mode: int): + torch._check( + input.ndim == 5 and input.ndim == grid.ndim, + lambda: ( + f"grid_sampler(): expected 5D input and grid with same number of " + f"dimensions, but got input with sizes {input.shape}" + f" and grid with sizes {grid.shape}" + ), + ) + torch._check( + not ( + input.ndim == 5 + and interpolation_mode == GridSamplerInterpolation.BICUBIC.value + ), + lambda: "grid_sampler(): bicubic interpolation only supports 4D input", + ) + + +@register_meta(aten.grid_sampler_2d_backward.default) +def grid_sampler_2d_backward_meta( + grad_output, + input, + grid, + interpolation_mode, + padding_mode, + align_corners, + output_mask, +): + input_requires_grad = output_mask[0] + if input_requires_grad: + grad_input = torch.zeros_like(input, memory_format=torch.contiguous_format) + else: + grad_input = None + grad_grid = torch.empty_like(grid, memory_format=torch.contiguous_format) + return (grad_input, grad_grid) + + +@register_meta(aten.grid_sampler_3d) +@out_wrapper() +def grid_sampler_3d( + input, + grid, + interpolation_mode, + padding_mode, + align_corners, +): + check_grid_sampler_common(input, grid) + check_grid_sampler_3d(input, grid, interpolation_mode) + N = input.shape[0] + C = input.shape[1] + out_D = grid.shape[1] + out_H = grid.shape[2] + out_W = grid.shape[3] + return input.new_empty((N, C, out_D, out_H, out_W)) + + +@register_meta(aten.grid_sampler_3d_backward) +@out_wrapper("grad_input", "grad_grid") +def grid_sampler_3d_backward( + grad_output, + input, + grid, + interpolation_mode, + padding_mode, + align_corners, + output_mask, +): + check_grid_sampler_common(input, grid) + check_grid_sampler_3d(input, grid, interpolation_mode) + input_requires_grad = output_mask[0] + if input_requires_grad: + grad_input = torch.zeros_like( + input, memory_format=torch.legacy_contiguous_format + ) + else: + grad_input = None + grad_grid = torch.empty_like(grid, memory_format=torch.legacy_contiguous_format) + return grad_input, grad_grid + + +@register_meta([aten.full.default]) +def full(size, fill_value, *args, **kwargs): + dtype = kwargs.get("dtype") + if not dtype: + dtype = utils.get_dtype(fill_value) + kwargs["dtype"] = dtype + # pyrefly: ignore [not-iterable] + return torch.empty(size, *args, **kwargs) + + +# zeros_like is special cased to work for sparse +@register_meta(aten.zeros_like.default) +def zeros_like( + self, + dtype=None, + layout=None, + device=None, + pin_memory=None, + memory_format=None, +): + if layout == torch.sparse_coo: + torch._check( + memory_format is None, + lambda: "memory format option is only supported by strided tensors", + ) + + res = torch.empty( + 0, + dtype=self.dtype if dtype is None else dtype, + layout=layout, + device=self.device if device is None else device, + pin_memory=pin_memory, + ) + + if self.is_sparse: + res.sparse_resize_and_clear_( + self.size(), self.sparse_dim(), self.dense_dim() + ) + else: + res.sparse_resize_and_clear_(self.size(), self.dim(), 0) + + res._coalesced_(True) + return res + res = aten.empty_like.default( + self, + dtype=dtype, + layout=layout, + device=device, + pin_memory=pin_memory, + memory_format=memory_format, + ) + # device can be not "meta" + res.fill_(0) + return res + + +@register_meta([aten.ones.default, aten.ones.out]) +@out_wrapper() +def meta_ones( + size, + *, + dtype=None, + layout=None, + device=None, + pin_memory=None, + requires_grad=False, +): + if dtype is None: + dtype = torch.get_default_dtype() + if device is None: + device = torch.get_default_device() + if layout is None: + layout = torch.strided + return torch.empty( + size, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory + ) + + +@register_meta([aten.zeros.default, aten.zeros.out]) +@out_wrapper() +def meta_zeros( + size, + *, + dtype=None, + layout=None, + device=None, + pin_memory=None, + requires_grad=False, +): + if dtype is None: + dtype = torch.get_default_dtype() + if device is None: + device = torch.get_default_device() + if layout is None: + layout = torch.strided + return torch.empty( + size, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory + ) + + +@register_meta(aten.select_scatter.default) +def meta_select_scatter(self, src, dim, index): + return utils.clone_preserve_strides(self) + + +@register_meta(aten.slice_scatter.default) +def meta_slice_scatter(self, src, dim=0, start=None, end=None, step=1): + return utils.clone_preserve_strides(self) + + +# TODO: Deduplicate this with canonicalize_dim +def maybe_wrap_dim(dim: int, dim_post_expr: int, wrap_scalar: bool = True): + if dim_post_expr <= 0: + assert wrap_scalar + dim_post_expr = 1 + min = -dim_post_expr + max = dim_post_expr - 1 + assert not (dim < min or dim > max), f"dim {dim} out of bounds ({min}, {max})" + if dim < 0: + dim += dim_post_expr + return dim + + +def ensure_nonempty_size(t, dim): + return 1 if t.dim() == 0 else t.shape[dim] + + +# From aten/src/ATen/native/ScatterGatherChecks.h +def gather_shape_check(self, dim, index): + self_dims = max(self.dim(), 1) + index_dims = max(index.dim(), 1) + torch._check( + self_dims == index_dims, + lambda: "Index tensor must have the same number of dimensions as input tensor", + ) + for i in range(self_dims): + if i != dim: + torch._check( + ensure_nonempty_size(index, i) <= ensure_nonempty_size(self, i), + lambda: f"Size does not match at dimension {i} expected index {index.shape}" + + f" to be no larger than self {self.shape} apart from dimension {dim}", + ) + + +@register_meta(aten.gather.default) +def meta_gather(self, dim, index, sparse_grad=False): + from torch.fx.experimental.symbolic_shapes import guard_or_false + + wrapped_dim = maybe_wrap_dim(dim, self.dim()) + is_index_empty = guard_or_false(index.numel() == 0) + if not is_index_empty: + torch._check( + index.dtype == torch.long or index.dtype == torch.int, + lambda: f"gather(): Expected dtype int32/int64 for index, but got {index.dtype}", + ) + gather_shape_check(self, wrapped_dim, index) + return self.new_empty(index.shape) + + +# From aten/src/ATen/native/TensorAdvancedIndexing.cpp +def get_operator_enum(reduce_, use_new_options=False): + if use_new_options: + if reduce_ == "sum": + return "REDUCE_ADD" + elif reduce_ == "prod": + return "REDUCE_MULTIPLY" + elif reduce_ == "mean": + return "REDUCE_MEAN" + elif reduce_ == "amax": + return "REDUCE_MAXIMUM" + elif reduce_ == "amin": + return "REDUCE_MINIMUM" + torch._check( + False, + lambda: "reduce argument must be either sum, prod, mean, amax or amin.", + ) + return + else: + if reduce_ == "add": + return "REDUCE_ADD" + elif reduce_ == "multiply": + return "REDUCE_MULTIPLY" + torch._check(False, lambda: "reduce argument must be either add or multiply.") + return + + +# From aten/src/ATen/native/ScatterGatherChecks.h +def scatter_gather_dtype_check(method_name, self, index, src_opt=None): + from torch.fx.experimental.symbolic_shapes import guard_or_true + + if guard_or_true(index.numel() != 0): + torch._check( + index.dtype == torch.long or index.dtype == torch.int, + lambda: f"{method_name}(): Expected dtype int32/int64 for index", + ) + + if src_opt is not None: + torch._check( + self.dtype == src_opt.dtype, + lambda: f"{method_name}(): Expected self.dtype to be equal to src.dtype", + ) + + +def ensure_nonempty_dim(dim): + return max(dim, 1) + + +# From aten/src/ATen/native/ScatterGatherChecks.h +def scatter_shape_check(self, dim, index, src_opt=None): + from torch.fx.experimental.symbolic_shapes import guard_or_false + + if guard_or_false(index.numel() == 0): + return + torch._check( + ensure_nonempty_dim(self.dim()) == ensure_nonempty_dim(index.dim()), + lambda: "Index tensor must have the same number of dimensions as self tensor", + ) + + is_wrong_shape = False + self_dims = ensure_nonempty_dim(self.dim()) + + # Check: index.size(d) <= self.size(d) for all d != dim + for d in range(self_dims): + index_d_size = ensure_nonempty_size(index, d) + if d == dim: + continue + if index_d_size > ensure_nonempty_size(self, d): + is_wrong_shape = True + break + + # Check: index.size(d) <= src.size(d) for all d if src is Tensor + if not is_wrong_shape and src_opt is not None: + for d in range(self_dims): + index_d_size = ensure_nonempty_size(index, d) + if index_d_size > ensure_nonempty_size(src_opt, d): + is_wrong_shape = True + break + + if src_opt is not None: + torch._check( + ensure_nonempty_dim(self.dim()) == ensure_nonempty_dim(index.dim()), + lambda: "Index tensor must have the same number of dimensions as self tensor", + ) + torch._check( + not is_wrong_shape, + lambda: f"Expected index {index.shape} to be no larger than self {self.shape}" + + f" apart from dimension {dim} and to be no larger than src {src_opt.shape}", + ) + else: + torch._check( + not is_wrong_shape, + lambda: f"Expected index {index.shape} to be no larger than self {self.shape}" + + f" apart from dimension {dim}", + ) + + +# From aten/src/ATen/native/TensorAdvancedIndexing.cpp +def scatter_meta_impl(self, dim, index, src=None, reduce_=None, use_new_options=False): + wrapped_dim = maybe_wrap_dim(dim, self.dim()) + scatter_gather_dtype_check("scatter", self, index, src) + scatter_shape_check(self, wrapped_dim, index, src) + if reduce_ is not None: + # Check if we have a valid reduce operator. + get_operator_enum(reduce_, use_new_options) + + +@register_meta(aten.scatter_add.default) +def meta_scatter_add(self, dim, index, src): + scatter_meta_impl(self, dim, index, src, "add") + return self.new_empty(self.shape) + + +@register_meta(aten.scatter_add_) +def meta_scatter_add_(self, dim, index, src): + scatter_meta_impl(self, dim, index, src, "add") + return self + + +@register_meta( + [ + aten.scatter.src, + aten.scatter.value, + aten.scatter.reduce, + aten.scatter.value_reduce, + ] +) +@out_wrapper() +def meta_scatter(self, dim, index, src_or_value, reduce=None): + src = src_or_value if isinstance(src_or_value, torch.Tensor) else None + scatter_meta_impl(self, dim, index, src, reduce) + return self.new_empty(self.shape) + + +@register_meta( + [ + aten.scatter_.src, + aten.scatter_.value, + aten.scatter_.reduce, + aten.scatter_.value_reduce, + ] +) +def meta_scatter_(self, dim, index, src_or_value, reduce=None): + src = src_or_value if isinstance(src_or_value, torch.Tensor) else None + scatter_meta_impl(self, dim, index, src, reduce) + return self + + +@register_meta([aten._scaled_dot_product_flash_attention]) +def meta__scaled_dot_product_flash_attention( + query: Tensor, + key: Tensor, + value: Tensor, + dropout_p: float = 0.0, + is_causal: bool = False, + return_debug_mask: bool = False, + scale: float | None = None, +): + batch_size = query.size(0) + num_heads = query.size(1) + max_seqlen_batch_q = query.size(2) + head_dim = query.size(3) + max_seqlen_batch_k = key.size(2) + + attention = torch.empty_like(query) + logsumexp = torch.empty( + (batch_size, num_heads, max_seqlen_batch_q), + dtype=torch.float, + device=query.device, + ) + + if return_debug_mask: + blocksize_c = 128 if head_dim > 64 else 256 + max_seqlen_k = math.ceil(max_seqlen_batch_q / blocksize_c) + if max_seqlen_batch_k <= 128: + max_seqlen_k = 128 + elif max_seqlen_batch_k <= 256: + max_seqlen_k = 256 + debug_mask = torch.empty( + (batch_size, num_heads, max_seqlen_batch_q, max_seqlen_k), + dtype=query.dtype, + device=query.device, + ) + else: + debug_mask = torch.empty(0, dtype=query.dtype, device=query.device) + + # Note [Seed and Offset]: device for seed and offset below depends on whether we are + # capturing or not, but at the time of tracing we don't know if we + # are going to use cudagraphs or not, so we return meta tensors here + # it's possible we'll need to have some special handling in inductor for sdpa + # See [Note] BC breaking change to flash seed/offset + if torch.version.hip and torch.cuda.is_available() or device_hint(query) == "xpu": + # Maintain old path on AMD + seed = torch.empty((), dtype=torch.long, device="meta") + offset = torch.empty((), dtype=torch.long, device="meta") + else: + seed = torch.empty((2), dtype=torch.uint64, device="meta") + offset = torch.empty((), dtype=torch.uint64, device="meta") + + return ( + attention, + logsumexp, + None, + None, + max_seqlen_batch_q, + max_seqlen_batch_k, + seed, + offset, + debug_mask, + ) + + +def alloc_with_matching_layout( + query: Tensor, + res_shape: tuple[int, ...], +): + if tuple(query.shape) == res_shape: + res = torch.empty_like(query) + else: + dim_order = sorted( + [0, 1, 2, 3], key=lambda idx: query.stride()[idx], reverse=True + ) + permuted_shape = [res_shape[idx] for idx in dim_order] + final_permute = [dim_order.index(i) for i in range(len(dim_order))] + res = torch.empty( + permuted_shape, dtype=query.dtype, device=query.device + ).permute(final_permute) + + return res + + +@register_meta([aten._scaled_dot_product_cudnn_attention]) +def meta__scaled_dot_product_cudnn_attention( + query: Tensor, + key: Tensor, + value: Tensor, + attn_bias: Tensor | None, + compute_log_sumexp: bool, + dropout_p: float = 0.0, + is_causal: bool = False, + return_debug_mask: bool = False, + scale: float | None = None, +): + B = query.size(0) + H = query.size(1) + S_Q = query.size(2) + S_KV = key.size(2) + D_V = value.size(-1) + + res_shape = (B, H, S_Q, D_V) + res = alloc_with_matching_layout(query, res_shape) + + logsum_exp = torch.empty( + (B, H, S_Q, 1), + dtype=torch.float, + device=query.device, + ) + + # See Note [Seed and Offset] + seed = torch.empty((), dtype=torch.long, device="meta") + offset = torch.empty((), dtype=torch.long, device="meta") + + return ( + res, + logsum_exp, + None, + None, + S_Q, + S_KV, + seed, + offset, + None, + ) + + +@register_meta([aten._scaled_dot_product_fused_attention_overrideable]) +def meta__scaled_dot_product_fused_attention_overrideable( + query: Tensor, + key: Tensor, + value: Tensor, + attn_bias: Tensor | None = None, + dropout_p: float = 0.0, + is_causal: bool = False, + return_debug_mask: bool = False, + scale: float | None = None, +): + B = query.size(0) + H_Q = query.size(1) + S_Q = query.size(2) + S_KV = key.size(2) + D_V = value.size(-1) + + res_shape = (B, H_Q, S_Q, D_V) + res = alloc_with_matching_layout(query, res_shape) + + logsum_exp = torch.empty( + (B, H_Q, S_Q), + dtype=torch.float, + device=query.device, + ) + + # See Note [Seed and Offset] + seed = torch.empty((), dtype=torch.long, device="meta") + offset = torch.empty((), dtype=torch.long, device="meta") + + return ( + res, + logsum_exp, + None, + None, + S_Q, + S_KV, + seed, + offset, + None, + ) + + +@register_meta( + [ + aten._scaled_dot_product_flash_attention_backward, + ] +) +def meta__scaled_dot_product_flash_backward( + grad_out: Tensor, + query: Tensor, + key: Tensor, + value: Tensor, + out: Tensor, + logsumexp: Tensor, + cum_seq_q: Tensor, + cum_seq_k: Tensor, + max_q: int, + max_k: int, + dropout_p: float, + is_causal: bool, + philox_seed: Tensor, + philox_offset: Tensor, + scale: float | None = None, +): + grad_q = torch.empty_like(query) + grad_k = torch.empty_like(key) + grad_v = torch.empty_like(value) + return grad_q, grad_k, grad_v + + +@register_meta( + [ + aten._scaled_dot_product_flash_attention_for_cpu, + ] +) +def meta__scaled_dot_product_flash_attention_for_cpu( + query: Tensor, + key: Tensor, + value: Tensor, + dropout_p: float = 0.0, + is_causal: bool = False, + attn_mask: Tensor | None = None, + scale: float | None = None, +): + batch_size = query.size(0) + num_heads = query.size(1) + max_seqlen_batch_q = query.size(2) + + attention = torch.empty_like(query) + logsumexp = torch.empty( + ( + batch_size, + max_seqlen_batch_q, + num_heads, + ), + dtype=torch.float, + device=query.device, + ).transpose(1, 2) + return ( + attention, + logsumexp, + ) + + +@register_meta( + [ + aten._scaled_dot_product_flash_attention_for_cpu_backward, + ] +) +def meta__scaled_dot_product_flash_attention_for_cpu_backward( + grad_out: Tensor, + query: Tensor, + key: Tensor, + value: Tensor, + out: Tensor, + logsumexp: Tensor, + dropout_p: float, + is_causal: bool, + attn_mask: Tensor | None = None, + scale: float | None = None, +): + # cpus's grad layout is different from cuda's, + # i.e. (batch_size, seq_len, num_heads, head_dim) + grad_q = torch.empty_permuted( + query.size(), + (0, 2, 1, 3), + dtype=query.dtype, + device=query.device, + ) + grad_k = torch.empty_permuted( + key.size(), + (0, 2, 1, 3), + dtype=key.dtype, + device=key.device, + ) + grad_v = torch.empty_permuted( + value.size(), + (0, 2, 1, 3), + dtype=value.dtype, + device=value.device, + ) + + return grad_q, grad_k, grad_v + + +@register_meta([aten._scaled_dot_product_attention_math_for_mps]) +def meta__scaled_dot_product_attention_math_for_mps( + query: Tensor, + key: Tensor, + value: Tensor, + attn_mask: Tensor | None = None, + dropout_p: float = 0.0, + is_causal: bool = False, + dropout_mask: Tensor | None = None, + scale: float | None = None, +) -> tuple[Tensor, Tensor]: + def ensure_4d(x): + if x.dim() == 3: + return x.unsqueeze(0), True + elif x.dim() > 4: + batch_size = 1 + for i in range(x.dim() - 3): + batch_size *= x.shape[i] + return x.view(batch_size, x.size(-3), x.size(-2), x.size(-1)), True + else: + return x, False + + q_, unsqueezed = ensure_4d(query) + k_, _ = ensure_4d(key) + v_, _ = ensure_4d(value) + + batch_size, num_head, q_size, head_size = q_.shape + _, k_size, max_seq_length, _ = k_.shape + + def sdpa_vector_fast_mps(): + out = q_.new_empty(q_.shape) + if unsqueezed: + out = out.view_as(query) + + attn = q_.new_empty((batch_size, num_head, q_size, max_seq_length)) + if unsqueezed: + if query.dim() == 3: + attn = attn.squeeze(0) + else: + shape = list(query.shape[:-3]) + attn.shape[1:4] + attn = attn.view(shape) + return out, attn + + def sdpa_vector_2pass_mps(): + blocks = 32 + out = q_.new_empty(q_.shape) + intermediate = q_.new_empty((batch_size, num_head, q_size, blocks, head_size)) + return out, intermediate + + if (max_seq_length >= 1024) or (k_size < q_size and max_seq_length >= 4096): + return sdpa_vector_2pass_mps() + else: + return sdpa_vector_fast_mps() + + +@register_meta([aten._scaled_dot_product_efficient_attention]) +def meta__scaled_dot_product_efficient_attention( + query: Tensor, + key: Tensor, + value: Tensor, + attn_bias: Tensor | None, + compute_log_sumexp: bool, + dropout_p=0.0, + is_causal: bool = False, + scale: float | None = None, +): + query = query.transpose(1, 2) + key = key.transpose(1, 2) + value = value.transpose(1, 2) + + B = query.size(0) + M = query.size(1) + num_heads = query.size(-2) + Kv = value.size(-1) + + res = torch.empty(B, M, num_heads, Kv, dtype=query.dtype, device=query.device) + + if torch.version.hip and torch.cuda.is_available(): + """Please see: https://github.com/pytorch/pytorch/issues/146848 + longsumexp last dim should be seq length + """ + logsumexp_dim = M if compute_log_sumexp else 0 + else: + logsumexp_dim = math.ceil(M / 32) * 32 if compute_log_sumexp else 0 + + logsum_exp = torch.empty( + (B, num_heads, logsumexp_dim), + dtype=torch.float, + device=query.device, + ) + + res = res.transpose(1, 2) + + # See Note [Seed and Offset]: + seed = torch.empty((), dtype=torch.long, device="meta") + offset = torch.empty((), dtype=torch.long, device="meta") + + return res, logsum_exp, seed, offset + + +@register_meta( + [ + aten._scaled_dot_product_efficient_attention_backward, + ] +) +def meta__scaled_dot_product_efficient_backward( + grad_out: Tensor, + query: Tensor, + key: Tensor, + value: Tensor, + attn_bias: Tensor | None, + out: Tensor, + logsumexp: Tensor, + philox_seed: Tensor, + philox_offset: Tensor, + dropout_p: float, + grad_input_mask: list[bool], + is_causal: bool = False, + scale: float | None = None, +): + batch_size = query.size(0) + num_heads = query.size(1) + max_q = query.size(2) + head_dim = query.size(3) + head_dim_v = value.size(3) + + max_k = key.size(2) + + grad_q = torch.empty_permuted( + (batch_size, num_heads, max_q, head_dim), + (0, 2, 1, 3), + dtype=query.dtype, + device=query.device, + ) + grad_k = torch.empty_permuted( + (batch_size, num_heads, max_k, head_dim), + (0, 2, 1, 3), + dtype=key.dtype, + device=key.device, + ) + grad_v = torch.empty_permuted( + (batch_size, num_heads, max_k, head_dim_v), + (0, 2, 1, 3), + dtype=value.dtype, + device=value.device, + ) + grad_bias = None + if attn_bias is not None and grad_input_mask[3]: + lastDim = attn_bias.size(-1) + lastDimAligned = lastDim if lastDim % 16 == 0 else lastDim + 16 - lastDim % 16 + new_sizes = list(attn_bias.size()) + new_sizes[-1] = lastDimAligned + grad_bias = torch.empty( + new_sizes, dtype=attn_bias.dtype, device=attn_bias.device + ) + grad_bias = grad_bias[..., :lastDim] + + return grad_q, grad_k, grad_v, grad_bias + + +@register_meta( + [ + aten._scaled_dot_product_cudnn_attention_backward, + ] +) +def meta__scaled_dot_product_cudnn_backward( + grad_out: Tensor, + query: Tensor, + key: Tensor, + value: Tensor, + out: Tensor, + logsumexp: Tensor, + philox_seed: Tensor, + philox_offset: Tensor, + attn_bias: Tensor, + cum_seq_q: Tensor, + cum_seq_k: Tensor, + max_q: int, + max_k: int, + dropout_p: float, + is_causal: bool, + scale: float | None = None, +): + grad_q = torch.empty_like(query) + grad_k = torch.empty_like(key) + grad_v = torch.empty_like(value) + return grad_q, grad_k, grad_v + + +@register_meta( + [ + aten._flash_attention_forward, + ] +) +def meta__flash_attention_forward( + query: Tensor, + key: Tensor, + value: Tensor, + cum_seq_q: Tensor | None, + cum_seq_k: Tensor | None, + max_q: int, + max_k: int, + dropout_p: float, + is_causal: bool, + return_debug_mask: bool, + scale: float | None = None, + window_size_left: int | None = None, + window_size_right: int | None = None, + seqused_k: Tensor | None = None, + alibi_slopes: Tensor | None = None, +): + # NB: there are two underlying paths: + # 1. normal dense path; expect 4D inputs of shape (batch_size, seqlen, num_heads, head_dim) + # 2. varseqlen path; expect 3D inputs of shape (total, num_heads, head_dim) where total + # includes all batch item sequences. cum_seq_q / cum_seq_k contain offsets into total + batch_size = query.size(0) if cum_seq_q is None else cum_seq_q.numel() - 1 + max_seqlen_batch_q = query.size(1) if cum_seq_q is None else max_q + max_seqlen_batch_k = key.size(1) if cum_seq_k is None else max_k + num_heads = query.size(-2) + head_dim = query.size(-1) + + # Cuda Path + attention = torch.empty_like(query) + if cum_seq_q is None: + logsumexp = torch.empty( + (batch_size, num_heads, max_seqlen_batch_q), + dtype=torch.float, + device=query.device, + ) + else: + total_q = query.size(0) + logsumexp = torch.empty( + (num_heads, total_q), dtype=torch.float, device=query.device + ) + + if return_debug_mask: + blocksize_c = 128 if head_dim > 64 else 256 + max_seqlen_k = math.ceil(max_seqlen_batch_q / blocksize_c) + if max_seqlen_batch_k <= 128: + max_seqlen_k = 128 + elif max_seqlen_batch_k <= 256: + max_seqlen_k = 256 + debug_mask = torch.empty( + (batch_size, num_heads, max_seqlen_batch_q, max_seqlen_k), + dtype=query.dtype, + device=query.device, + ) + else: + debug_mask = torch.empty(0, dtype=query.dtype, device=query.device) + + # See Note [Seed and Offset] + # See [Note] BC breaking change to flash seed/offset + seed, offset = None, None + if torch.version.hip and torch.cuda.is_available(): + # Maintain old path on AMD + seed = torch.empty((), dtype=torch.long, device="meta") + offset = torch.empty((), dtype=torch.long, device="meta") + else: + seed = torch.empty((2), dtype=torch.uint64, device="meta") + offset = torch.empty((), dtype=torch.uint64, device="meta") + return ( + attention, + logsumexp, + seed, + offset, + debug_mask, + ) + + +@register_meta( + [ + aten._flash_attention_backward, + ] +) +def meta__flash_attention_backward( + grad_out: Tensor, + query: Tensor, + key: Tensor, + value: Tensor, + out: Tensor, + logsumexp: Tensor, + cum_seq_q: Tensor, + cum_seq_k: Tensor, + max_q: int, + max_k: int, + dropout_p: float, + is_causal: bool, + philox_seed: Tensor, + philox_offset: Tensor, + scale: float | None = None, + window_size_left: int | None = None, + window_size_right: int | None = None, +): + grad_query = torch.empty_like(query) + grad_key = torch.empty_like(key) + grad_value = torch.empty_like(value) + + return grad_query, grad_key, grad_value + + +@register_meta( + [ + aten._efficient_attention_forward, + ] +) +def meta__efficient_attention_forward( + query: Tensor, + key: Tensor, + value: Tensor, + bias: Tensor | None, + cu_seqlens_q: Tensor | None, + cu_seqlens_k: Tensor | None, + max_seqlen_q: int | None, + max_seqlen_k: int | None, + dropout_p: float, + custom_mask_type: int, + compute_log_sumexp: bool = False, + scale: float | None = None, + causal_diagonal: Tensor | None = None, + seqlen_k: Tensor | None = None, + window_size: int | None = None, +): + B = query.size(0) + M = query.size(1) + N = key.size(1) + num_heads = query.size(-2) + Kv = value.size(-1) + + res = torch.empty(B, M, num_heads, Kv, dtype=query.dtype, device=query.device) + + logsumexp_batch_dim = cu_seqlens_q.size(0) - 1 if (cu_seqlens_q is not None) else B + actual_max_seqlen_q = M + if cu_seqlens_q is not None: + assert max_seqlen_q is not None + actual_max_seqlen_q = max_seqlen_q + actual_max_seqlen_k = max_seqlen_k if max_seqlen_k is not None else N + logsumexp_dim = ( + math.ceil(actual_max_seqlen_q / 32) * 32 if compute_log_sumexp else 0 + ) + logsum_exp = torch.empty( + (logsumexp_batch_dim, num_heads, logsumexp_dim), + dtype=torch.float, + device=query.device, + ) + + # See Note [Seed and Offset]: + seed = torch.empty((), dtype=torch.long, device="meta") + offset = torch.empty((), dtype=torch.long, device="meta") + + return res, logsum_exp, seed, offset, actual_max_seqlen_q, actual_max_seqlen_k + + +@register_meta( + [ + aten._efficient_attention_backward, + ] +) +def meta__efficient_attention_backward( + grad_out: Tensor, + query: Tensor, + key: Tensor, + value: Tensor, + bias: Tensor | None, + cu_seqlens_q: Tensor | None, + cu_seqlens_k: Tensor | None, + max_seqlen_q: torch.SymInt, + max_seqlen_k: torch.SymInt, + logsumexp: Tensor, + dropout_p: float, + philox_seed: Tensor, + philox_offset: Tensor, + custom_mask_type: int, + bias_requires_grad: bool, + scale: float | None = None, + num_splits_key: int | None = None, + shared_storage_dqdkdv: bool = False, +): + if shared_storage_dqdkdv: + torch._check( + query.shape[1] == key.shape[1], + lambda: "seqlen must match for `shared_storage_dqdkdv", + ) + torch._check( + query.shape[3] == key.shape[3], + lambda: "embedding dim must match for `shared_storage_dqdkdv", + ) + chunk = torch.empty( + (*query.shape[0:-2], 3, query.shape[-2], query.shape[-1]), + dtype=query.dtype, + device=query.device, + ) + grad_query = chunk.select(-3, 0) + grad_key = chunk.select(-3, 1) + grad_value = chunk.select(-3, 2) + else: + grad_query = torch.empty_like(query) + grad_key = torch.empty_like(key) + grad_value = torch.empty_like(value) + + if bias is not None: + lastDim = bias.size(-1) + lastDimAligned = lastDim if lastDim % 16 == 0 else lastDim + 16 - lastDim % 16 + new_sizes = list(bias.size()) + new_sizes[-1] = lastDimAligned + grad_bias = torch.empty(new_sizes, dtype=bias.dtype, device=bias.device) + grad_bias = grad_bias[..., :lastDim] + else: + grad_bias = torch.empty((), device=query.device) + + return grad_query, grad_key, grad_value, grad_bias + + +def _check_scaled_mm_sizes( + self: torch.Tensor, + mat2: torch.Tensor, + scale_a: torch.Tensor, + scale_b: torch.Tensor, + bias: torch.Tensor | None = None, + scale_result: torch.Tensor | None = None, + out_dtype: torch.dtype | None = None, + use_fast_accum: bool = False, +): + def is_fp8_or_fp4_type(dtype): + return dtype in ( + torch.float8_e4m3fn, + torch.float8_e5m2, + torch.float8_e4m3fnuz, + torch.float8_e5m2fnuz, + torch.float4_e2m1fn_x2, + ) + + torch._check( + self.dim() == 2 and mat2.dim() == 2, + lambda: f"Inputs must be 2D but got self.dim()={self.dim()} and mat2.dim()={mat2.dim()}", + ) + torch._check( + is_fp8_or_fp4_type(self.dtype) and is_fp8_or_fp4_type(mat2.dtype), + lambda: f"Expected both inputs to be fp8 or fp4 types but got self.dtype={self.dtype} and mat2.dtype={mat2.dtype}", + ) + + if device_hint(self) == "cuda" or device_hint(self) == "xpu": + + def is_row_major(stride): + return stride[0] > stride[1] and stride[1] == 1 + + def is_col_major(stride): + return stride[0] == 1 and stride[1] > 1 + + def has_zero_dim(tensor_2d): + return tensor_2d.size(0) == 0 or tensor_2d.size(1) == 0 + + torch._check( + is_row_major(self.stride()) or has_zero_dim(self), + lambda: f"self must be row_major, got stride {self.stride()}", + ) + torch._check( + is_col_major(mat2.stride()) or has_zero_dim(mat2), + lambda: f"mat2 must be col_major, got stride {mat2.stride()}", + ) + torch._check( + self.size(1) % 16 == 0, + lambda: f"Expected self.size(1) to be divisible by 16, but got self.size(1)={self.size(1)}", + ) + torch._check( + mat2.size(0) % 16 == 0 and mat2.size(1) % 16 == 0, + lambda: f"Expected both dimensions of mat2 to be divisible by 16 but got {mat2.shape}", + ) + + # determine scaling type and check input dimensions (refer to Blas.cpp op) + + m, _k = self.shape + n = mat2.size(1) + + is_blockwise_scaling = ( + ( + scale_a.dtype == torch.float8_e8m0fnu + and scale_b.dtype == torch.float8_e8m0fnu + ) + or ( + scale_a.dtype == torch.float8_e4m3fn + and scale_b.dtype == torch.float8_e4m3fn + ) + ) # note: this applies to blockwise scaling for non-FP8 types (FP8 accepts FP32 scales) + + if scale_a.numel() == 1 and scale_b.numel() == 1: + # tensorwise scaling + torch._check( + scale_a.dtype == torch.float32 and scale_b.dtype == torch.float32, + lambda: "For tensorwise scaling, both scale_a and scale_b must be float (fp32) tensors.", + ) + elif is_blockwise_scaling: + # blockwise scaling + + if scale_a.dtype == torch.float8_e4m3fn: + # NVIDIA's nvfp4 recipe: + # * block size is 16 elements packed (32 unpacked) + # * _k needs to be translated to the unpacked version + block_size_k = 16 + _k = _k * 2 + else: + block_size_k = 32 + + block_size_mn = 128 + + num_k_blocks = ceil_div(_k, block_size_k) + padded_num_k_blocks = ceil_div(num_k_blocks, 4) * 4 + + expected_a_size = ( + block_size_mn * ceil_div(m, block_size_mn) * padded_num_k_blocks + ) + expected_b_size = ( + block_size_mn * ceil_div(n, block_size_mn) * padded_num_k_blocks + ) + + if ( + scale_a.numel() == expected_a_size + and scale_b.numel() == expected_b_size + ): + torch._check( + scale_a.is_contiguous(), + lambda: "scale_a must be contiguous", + ) + torch._check( + scale_b.is_contiguous(), + lambda: "scale_b must be contiguous", + ) + else: + torch._check( + False, + lambda: ( + "Invalid blockwise scaling configuration. " + f"For blockwise scaling, scale_a should have {expected_a_size} elements, got {scale_a.numel()}, " + f"scale_b should have {expected_b_size} elements, got {scale_b.numel()}." + ), + ) + else: + torch._check( + scale_a.dtype == torch.float32 and scale_b.dtype == torch.float32, + lambda: "For rowwise scaling, both scale_a and scale_b must be float (fp32) tensors.", + ) + # for rowwise scaling, enforce 2D input tensors + torch._check( + scale_a.dim() == 2 and scale_b.dim() == 2, + lambda: f"For non-tensorwise scaling, scale tensors must be 2D, but got {scale_a.dim()=} and {scale_b.dim()=}", + ) + + if ( + scale_a.size(0) == m + and scale_a.size(1) == 1 + and scale_b.size(0) == 1 + and scale_b.size(1) == n + ): + # rowwise scaling + torch._check( + scale_a.is_contiguous() and scale_b.is_contiguous(), + lambda: "Both scale_a and scale_b must be contiguous for rowwise scaling.", + ) + elif ( + scale_a.size(0) == m + and scale_a.size(1) == scale_b.size(0) == ceil_div(_k, 128) + and scale_b.size(1) == ceil_div(n, 128) + ): + # (BlockWise1x128, BlockWise128x128) + pass # do nothing, but do not error + elif ( + scale_a.size(0) == m + and scale_a.size(1) == scale_b.size(0) == ceil_div(_k, 128) + and scale_b.size(1) == n + ): + # (BlockWise1x128, BlockWise1x128) + pass # do nothing, but do not error + else: + # does not match any valid scaling type + torch._check( + False, + lambda: ( + "Invalid scaling configuration. " + "For tensorwise scaling, both scales should be scalar. " + f"For rowwise scaling, scale_a should be ({m}, 1), scale_b should be (1, {n}). " + f"For (BlockWise1x128, BlockWise128x128), scale_a should be ({m}, {ceil_div(_k, 128)}), " + + f"scale_b should be ({ceil_div(_k, 128)}, {ceil_div(n, 128)}). " + f"For (BlockWise1x128, BlockWise1x128), scale_a should be ({m}, {ceil_div(_k, 128)}), " + + f"scale_b should be ({ceil_div(_k, 128)}, {n}). " + f"Got scale_a.size()=({scale_a.size(0)}, {scale_a.size(1)}) " + f"and scale_b.size()=({scale_b.size(0)}, {scale_b.size(1)})" + ), + ) + + _out_dtype = out_dtype if out_dtype is not None else self.dtype + return torch.empty(self.size(0), mat2.size(1), dtype=_out_dtype, device=self.device) + + +@register_meta([aten._scaled_mm.default]) +def meta_scaled_mm( + self: torch.Tensor, + mat2: torch.Tensor, + scale_a: torch.Tensor, + scale_b: torch.Tensor, + bias: torch.Tensor | None = None, + scale_result: torch.Tensor | None = None, + out_dtype: torch.dtype | None = None, + use_fast_accum: bool = False, +): + return _check_scaled_mm_sizes( + self, mat2, scale_a, scale_b, bias, scale_result, out_dtype, use_fast_accum + ) + + +def _check_scaled_mm_sizes_v2( + self: torch.Tensor, + mat2: torch.Tensor, + scale_a: list[torch.Tensor], + scale_recipe_a: list[ScalingType], + scale_b: list[torch.Tensor], + scale_recipe_b: list[ScalingType], + bias: torch.Tensor | None = None, + out_dtype: torch.dtype | None = None, + swizzle_a: list[SwizzleType] | None = None, + swizzle_b: list[SwizzleType] | None = None, + use_fast_accum: bool = False, +): + def is_fp8_or_fp4_type(dtype): + return dtype in ( + torch.float8_e4m3fn, + torch.float8_e5m2, + torch.float8_e4m3fnuz, + torch.float8_e5m2fnuz, + torch.float4_e2m1fn_x2, + ) + + def is_fp4_type(dtype): + return dtype in (torch.float4_e2m1fn_x2,) + + torch._check( + self.dim() == 2 and mat2.dim() == 2, + lambda: f"Inputs must be 2D but got self.dim()={self.dim()} and mat2.dim()={mat2.dim()}", + ) + torch._check( + is_fp8_or_fp4_type(self.dtype) and is_fp8_or_fp4_type(mat2.dtype), + lambda: f"Expected both inputs to be fp8 or fp4 types but got self.dtype={self.dtype} and mat2.dtype={mat2.dtype}", + ) + + # Passed tensors: + # self: [M, K] + # mat2: [K, N] + M = self.shape[0] + K = self.shape[1] + N = mat2.shape[1] + + # If we're using fp4, using fp4x2 packed format - adjust K appropriately + if is_fp4_type(self.dtype) and is_fp4_type(mat2.dtype): + K_packed_multiplier = 2 + K *= K_packed_multiplier + + scale_recipe_a = [ScalingType(si) for si in scale_recipe_a] + scale_recipe_b = [ScalingType(si) for si in scale_recipe_b] + + if swizzle_a: + swizzle_a = [SwizzleType(si) for si in swizzle_a] + else: + swizzle_a = [ + SwizzleType.NO_SWIZZLE, + ] + if swizzle_b: + swizzle_b = [SwizzleType(si) for si in swizzle_b] + else: + swizzle_b = [ + SwizzleType.NO_SWIZZLE, + ] + + if device_hint(self) == "cuda" or device_hint(self) == "xpu": + + def is_row_major(stride): + return stride[0] > stride[1] and stride[1] == 1 + + def is_col_major(stride): + return stride[0] == 1 and stride[1] > 1 + + def has_zero_dim(tensor_2d): + return tensor_2d.size(0) == 0 or tensor_2d.size(1) == 0 + + torch._check( + is_row_major(self.stride()) or has_zero_dim(self), + lambda: f"self must be row_major, got stride {self.stride()}", + ) + torch._check( + is_col_major(mat2.stride()) or has_zero_dim(mat2), + lambda: f"mat2 must be col_major, got stride {mat2.stride()}", + ) + torch._check( + self.size(1) % 16 == 0, + lambda: f"Expected self.size(1) to be divisible by 16, but got self.size(1)={self.size(1)}", + ) + torch._check( + mat2.size(0) % 16 == 0 and mat2.size(1) % 16 == 0, + lambda: f"Expected both dimensions of mat2 to be divisible by 16 but got {mat2.shape}", + ) + + def is_tensorwise(recipe_a: list[ScalingType], recipe_b: list[ScalingType]): + return ( + len(recipe_a) == 1 + and len(recipe_b) == 1 + and recipe_a[0] == ScalingType.TensorWise + and recipe_b[0] == ScalingType.TensorWise + ) + + def is_rowwise(recipe_a: list[ScalingType], recipe_b: list[ScalingType]): + return ( + len(recipe_a) == 1 + and len(recipe_b) == 1 + and recipe_a[0] == ScalingType.RowWise + and recipe_b[0] == ScalingType.RowWise + ) + + def is_mx(recipe_a: list[ScalingType], recipe_b: list[ScalingType]): + return ( + len(recipe_a) == 1 + and len(recipe_b) == 1 + and recipe_a[0] == ScalingType.BlockWise1x32 + and recipe_b[0] == ScalingType.BlockWise1x32 + ) + + def is_nv(recipe_a: list[ScalingType], recipe_b: list[ScalingType]): + return ( + len(recipe_a) == 2 + and len(recipe_b) == 2 + and recipe_a[0] == ScalingType.BlockWise1x16 + and recipe_a[1] == ScalingType.TensorWise + and recipe_b[0] == ScalingType.BlockWise1x16 + and recipe_b[1] == ScalingType.TensorWise + ) + + def is_1x128_1x128(recipe_a: list[ScalingType], recipe_b: list[ScalingType]): + return ( + len(recipe_a) == 1 + and len(recipe_b) == 1 + and recipe_a[0] == ScalingType.BlockWise1x128 + and recipe_b[0] == ScalingType.BlockWise1x128 + ) + + def is_1x128_128x128(recipe_a: list[ScalingType], recipe_b: list[ScalingType]): + return ( + len(recipe_a) == 1 + and len(recipe_b) == 1 + and recipe_a[0] == ScalingType.BlockWise1x128 + and recipe_b[0] == ScalingType.BlockWise128x128 + ) + + def is_128x128_1x128(recipe_a: list[ScalingType], recipe_b: list[ScalingType]): + return ( + len(recipe_a) == 1 + and len(recipe_b) == 1 + and recipe_a[0] == ScalingType.BlockWise128x128 + and recipe_b[0] == ScalingType.BlockWise1x128 + ) + + # Given scaling types, check input dimensions + + if is_tensorwise(scale_recipe_a, scale_recipe_b): + # TensorWise + torch._check( + scale_a[0].numel() == 1 + and scale_b[0].numel() == 1 + and scale_a[0].dtype == torch.float32 + and scale_b[0].dtype == torch.float32, + lambda: "For Tensorwise scaling, both scale_a and scale_b must be single element float (fp32) tensors", + ) + elif is_rowwise(scale_recipe_a, scale_recipe_b): + torch._check( + scale_a[0].shape[0] == M + and scale_a[0].numel() == M + and scale_a[0].dtype == torch.float32 + and scale_b[0].numel() == N + and scale_b[0].dtype == torch.float32, + lambda: ( + f"For Rowwise scaling, scale_a must have {self.shape[0]} elements (got: {scale_a[0].numel()})" + f", and scale_b must have {mat2.shape[1]} elements (got: {scale_b[0].numel()})" + ), + ) + elif is_1x128_1x128(scale_recipe_a, scale_recipe_b): + # A, B are fp8, scales are fp32 + # As: [M x K // 128], stride: [1, M] + # Bs: [N x K // 128], stride: [1, N] + types_ok = ( + scale_a[0].dtype == torch.float32 and scale_b[0].dtype == torch.float32 + ) + sa = scale_a[0] + scale_a_ok = ( + sa.shape[0] == M + and sa.shape[1] == K // 128 + and sa.stride(0) == 1 + and (sa.stride(1) == M or (sa.shape[1] == 1 and sa.stride(1) == 1)) + ) + sb = scale_b[0] + scale_b_ok = ( + sb.shape[0] == N + and sb.shape[1] == K // 128 + and sb.stride(0) == 1 + and (sb.stride(1) == N or (sb.shape[1] == 1 and sb.stride(1) == 1)) + ) + + torch._check( + types_ok and scale_a_ok and scale_b_ok, + lambda: ( + "For 1x128 x 1x128 blockwise scaling, " + f"scale a must have shape [{M}, {K // 128}] (got: {sa.shape}) and stride [1, {M}] (got: {sa.stride})" + f"scale b must have shape [{N}, {K // 128}] (got: {sb.shape}) and stride [1, {N}] (got: {sb.stride})" + ), + ) + elif is_128x128_1x128(scale_recipe_a, scale_recipe_b): + # A, B are fp8, scales are fp32 + # L4 = round_up(K // 128, 4) + # As: [L4 x M // 128], stride: [1, L4] + # Bs: [N x K // 128], stride: [1, N] + types_ok = ( + scale_a[0].dtype == torch.float32 and scale_b[0].dtype == torch.float32 + ) + L4 = round_up(K / 128, 4) + sa = scale_a[0] + scale_a_ok = ( + sa.shape[0] == L4 + and sa.shape[1] == M // 128 + and sa.stride(0) == 1 + and (sa.stride(1) == L4 or (sa.shape[1] == 1 and sa.stride(1) == 1)) + ) + sb = scale_b[0] + scale_b_ok = ( + sb.shape[0] == N + and sb.shape[1] == K // 128 + and sb.stride(0) == 1 + and (sb.stride(1) == N or (sb.shape[1] == 1 and sb.stride(1) == 1)) + ) + torch._check( + types_ok and scale_a_ok and scale_b_ok, + lambda: ( + "For 128x128 x 1x128 blockwise scaling, L4 = {round_up(K / 128, 4)}, " + f"scale a must have shape [{L4}, {M // 128}] (got: {sa.shape}) and stride [1, {L4}] (got: {sa.stride})" + f"scale b must have shape [{N}, {K // 128}] (got: {sb.shape}) and stride [1, {N}] (got: {sb.stride})" + ), + ) + elif is_1x128_128x128(scale_recipe_a, scale_recipe_b): + # A, B are fp8, scales are fp32 + # L4 = round_up(K // 128, 4) + # As: [M x K // 128], stride: [1, M] + # Bs: [L4 x N // 128], stride: [1, L4] + types_ok = ( + scale_a[0].dtype == torch.float32 and scale_b[0].dtype == torch.float32 + ) + L4 = round_up(K / 128, 4) + sa = scale_a[0] + scale_a_ok = ( + sa.shape[0] == M + and sa.shape[1] == K // 128 + and sa.stride(0) == 1 + and (sa.stride(1) == M or (sa.shape[1] == 1 and sa.stride(1) == 1)) + ) + sb = scale_b[0] + scale_b_ok = ( + sb.shape[0] == L4 + and sb.shape[1] == N // 128 + and sb.stride(0) == 1 + and (sb.stride(1) == L4 or (sb.shape[1] == 1 and sb.stride(1) == 1)) + ) + torch._check( + types_ok and scale_a_ok and scale_b_ok, + lambda: ( + "For 1x128 x 128x128 blockwise scaling, L4 = {round_up(K / 128, 4)}, " + f"scale a must have shape [{M}, {K // 128}] (got: {sa.shape}) and stride [1, {M}] (got: {sa.stride})" + f"scale b must have shape [{L4}, {N // 128}] (got: {sb.shape}) and stride [1, {L4}] (got: {sb.stride})" + ), + ) + elif is_mx(scale_recipe_a, scale_recipe_b): + if torch.version.hip: + # Note(slayton58): These mirror ROCm in ScaledBlas.cpp, but I think they're wrong.. + expected_scale_a_elems = ceil_div(self.shape[0], 32) * self.shape[1] + expected_scale_b_elems = ceil_div(self.shape[1], 32) * self.shape[0] + expected_swizzle = SwizzleType.NO_SWIZZLE + else: + expected_scale_a_elems = round_up(self.shape[0], 128) * round_up( + ceil_div(self.shape[1], 32), 4 + ) + expected_scale_b_elems = round_up(mat2.shape[1], 128) * round_up( + ceil_div(self.shape[1], 32), 4 + ) + expected_swizzle = SwizzleType.SWIZZLE_32_4_4 + torch._check( + scale_a[0].numel() == expected_scale_a_elems + and scale_a[0].dtype == torch.float8_e8m0fnu + and scale_b[0].numel() == expected_scale_b_elems + and scale_b[0].dtype == torch.float8_e8m0fnu + and swizzle_a[0] == expected_swizzle + and swizzle_b[0] == expected_swizzle, + lambda: ( + f"for MX scaling scale_a must have {expected_scale_a_elems} (got: {scale_a[0].numel()}) " + f"and scale_b must have {expected_scale_b_elems} (got: {scale_b[0].numel()}). Scales must " + f"have types {torch.float8_e8m0fnu} (for self: {scale_a[0].dtype}, mat_b: {scale_b[0].dtype}) " + f"Must have swizzle type {expected_swizzle} (got self: {swizzle_a[0]}, mat_b: {swizzle_b[0]})" + ), + ) + elif is_nv(scale_recipe_a, scale_recipe_b): + expected_scale_a_elems = round_up(M, 128) * round_up(ceil_div(K, 16), 4) + expected_scale_b_elems = round_up(N, 128) * round_up(ceil_div(K, 16), 4) + expected_swizzle = SwizzleType.SWIZZLE_32_4_4 + torch._check( + scale_a[0].numel() == expected_scale_a_elems + and scale_a[0].dtype == torch.float8_e4m3fn + and scale_a[1].numel() == 1 + and scale_a[1].dtype == torch.float32 + and scale_b[0].numel() == expected_scale_b_elems + and scale_b[0].dtype == torch.float8_e4m3fn + and scale_b[1].numel() == 1 + and scale_b[1].dtype == torch.float32 + and swizzle_a[0] == expected_swizzle + and swizzle_b[0] == expected_swizzle, + lambda: ( + f"for NV scaling scale_a must have {expected_scale_a_elems} (got: {scale_a[0].numel()}) " + f"and scale_b must have {expected_scale_b_elems} (got: {scale_b[0].numel()}). Must have " + f"swizzle type {expected_swizzle} (got self: {swizzle_a[0]}, mat_b: {swizzle_b[0]})" + ), + ) + else: + torch._check( + False, + lambda: ( + "Invalid scaling configuration. " + "For tensorwise scaling, both scales should be scalar. " + f"For rowwise scaling, scale_a should be ({M}, 1), scale_b should be (1, {N}). " + f"For (BlockWise1x128, BlockWise128x128), scale_a should be ({M}, {ceil_div(K, 128)}), " + + f"scale_b should be ({ceil_div(K, 128)}, {ceil_div(N, 128)}). " + f"For (BlockWise1x128, BlockWise1x128), scale_a should be ({M}, {ceil_div(K, 128)}), " + + f"scale_b should be ({ceil_div(K, 128)}, {N}). " + f"Got scale_a.size()=({scale_a[0].size(0)}, {scale_a[0].size(1)}) " + f"and scale_b.size()=({scale_b[0].size(0)}, {scale_b[0].size(1)})" + ), + ) + + _out_dtype = out_dtype if out_dtype is not None else self.dtype + return torch.empty(M, N, dtype=_out_dtype, device=self.device) + + +@register_meta([aten._scaled_mm_v2.default]) +def meta_scaled_mm_v2( + self: torch.Tensor, + mat2: torch.Tensor, + scale_a: list[torch.Tensor], + scale_recipe_a: list[ScalingType], + swizzle_a: list[SwizzleType], + scale_b: list[torch.Tensor], + scale_recipe_b: list[ScalingType], + swizzle_b: list[SwizzleType], + bias: torch.Tensor | None = None, + output_dtype: torch.dtype | None = None, + contraction_dims: list[int] | None = None, + use_fast_accum: bool = False, +): + return _check_scaled_mm_sizes_v2( + self, + mat2, + scale_a, + scale_recipe_a, + scale_b, + scale_recipe_b, + bias=bias, + out_dtype=output_dtype, + swizzle_a=swizzle_a, + swizzle_b=swizzle_b, + use_fast_accum=use_fast_accum, + ) + + +@register_meta([aten.scatter_reduce.two, aten.scatter_reduce.two_out]) +@out_wrapper() +def meta_scatter_reduce_two(self, dim, index, src, reduce, include_self=True): + scatter_meta_impl(self, dim, index, src, reduce, use_new_options=True) + return self.new_empty(self.shape) + + +@register_meta(aten.scatter_reduce_.two) +def meta_scatter_reduce__two(self, dim, index, src, reduce, include_self=True): + scatter_meta_impl(self, dim, index, src, reduce, use_new_options=True) + return self + + +@register_meta([aten.multinomial.default, aten.multinomial.out]) +@out_wrapper() +def meta_multinomial(input, num_samples, replacement=False, *, generator=None): + torch._check( + 0 < input.dim() <= 2, + lambda: f"The probability distributions dimensions must be 1 or 2, but got {input.dim()}", + ) + if input.dim() == 1: + return torch.empty(num_samples, dtype=torch.long, device=input.device) + return torch.empty( + input.size(0), num_samples, dtype=torch.long, device=input.device + ) + + +def multiply_integers(vs): + r = 1 + for v in vs: + r *= v + return r + + +def upsample_common_check(input_size, output_size, num_spatial_dims): + torch._check( + len(output_size) == num_spatial_dims, + lambda: f"It is expected output_size equals to {num_spatial_dims}, but got size {len(output_size)}", + ) + expected_input_dims = num_spatial_dims + 2 # N, C, ... + torch._check( + len(input_size) == expected_input_dims, + lambda: f"It is expected input_size equals to {expected_input_dims}, but got size {len(input_size)}", + ) + + torch._check( + all(s > 0 for s in input_size[2:]) and all(s > 0 for s in output_size), + lambda: f"Input and output sizes should be greater than 0, but got " + f"input size {input_size} and output size {output_size}", + ) + + nbatch, channels = input_size[:2] + return (nbatch, channels, *output_size) + + +@register_meta( + [aten.upsample_nearest1d.default, aten._upsample_nearest_exact1d.default] +) +def upsample_nearest1d(input, output_size, scales=None): + torch._check( + input.numel() != 0 or multiply_integers(input.size()[1:]), + lambda: f"Non-empty 3D data tensor expected but got a tensor with sizes {input.size()}", + ) + full_output_size = upsample_common_check( + input.size(), output_size, num_spatial_dims=1 + ) + return input.new_empty(full_output_size).to( + memory_format=utils.suggest_memory_format(input) + ) + + +@register_meta( + [aten.upsample_nearest2d.default, aten._upsample_nearest_exact2d.default] +) +def upsample_nearest2d(input, output_size, scales_h=None, scales_w=None): + torch._check( + input.numel() != 0 or multiply_integers(input.size()[1:]), + lambda: f"Non-empty 4D data tensor expected but got a tensor with sizes {input.size()}", + ) + full_output_size = upsample_common_check( + input.size(), output_size, num_spatial_dims=2 + ) + output = input.new_empty(full_output_size) + + # convert output to correct memory format, if necessary + memory_format = utils.suggest_memory_format(input) + + # following "heuristic: only use channels_last path when it's faster than the contiguous path" + _, n_channels, _, _ = input.shape + if input.device.type == "cuda" and n_channels < 4: + memory_format = torch.contiguous_format + + output = output.contiguous(memory_format=memory_format) + + return output + + +@register_meta( + [ + aten.upsample_nearest2d_backward.default, + aten._upsample_nearest_exact2d_backward.default, + ] +) +def upsample_nearest2d_backward( + grad_output: Tensor, + output_size: Sequence[int | torch.SymInt], + input_size: Sequence[int | torch.SymInt], + scales_h: float | None = None, + scales_w: float | None = None, +): + full_output_size = upsample_common_check( + input_size, output_size, num_spatial_dims=2 + ) + torch._check( + grad_output.ndim == 4, + lambda: f"Expected grad_output to be a tensor of dimension 4 but got: dimension {grad_output.ndim}", + ) + for i in range(4): + torch._check( + grad_output.size(i) == full_output_size[i], + lambda: ( + f"Expected grad_output to have the same shape as output;" + f" output.size({i}) = {full_output_size[i]}" + f" but got grad_output.size({i}) = {grad_output.size(i)}" + ), + ) + + return grad_output.new_empty(input_size).to( + memory_format=utils.suggest_memory_format(grad_output) + ) # type: ignore[call-overload] + + +@register_meta( + [aten.upsample_nearest3d.default, aten._upsample_nearest_exact3d.default] +) +def upsample_nearest3d(input, output_size, scales_d=None, scales_h=None, scales_w=None): + torch._check( + input.numel() != 0 or multiply_integers(input.size()[1:]), + lambda: f"Non-empty 5D data tensor expected but got a tensor with sizes {input.size()}", + ) + full_output_size = upsample_common_check( + input.size(), output_size, num_spatial_dims=3 + ) + return input.new_empty(full_output_size).to( + memory_format=utils.suggest_memory_format(input) + ) + + +@register_meta( + [ + aten.sort.default, + aten.sort.stable, + aten.sort.values, + aten.sort.values_stable, + ] +) +def meta_sort(self, stable=None, dim=-1, descending=False, values=None, indices=None): + v, i = torch.empty_like(self), torch.empty_like(self, dtype=torch.int64) + if values is not None and indices is not None: + assert isinstance(values, TensorLike) + assert isinstance(indices, TensorLike) + # Makes sure values and indices have the same strides. For cases where + # these have different shapes, like (5, 10, 5) and (0) in msort. + out_shape = v.shape + out_stride = v.stride() + values = _maybe_resize_out(values, out_shape) + indices = _maybe_resize_out(indices, out_shape) + values.as_strided_(out_shape, out_stride) + indices.as_strided_(out_shape, out_stride) + _safe_copy_out(copy_from=v, copy_to=values) # type: ignore[arg-type] + _safe_copy_out(copy_from=i, copy_to=indices) # type: ignore[arg-type] + return values, indices + return v, i + + +def rnn_cell_checkSizes( + input_gates, + hidden_gates, + input_bias, + hidden_bias, + factor, + prev_hidden, +): + torch._check(input_gates.ndim == 2, lambda: f"{input_gates.ndim} != 2") + torch._check( + input_gates.shape == hidden_gates.shape, + lambda: f"{input_gates.shape} != {hidden_gates.shape}", + ) + gates_size = input_gates.size(1) + if input_bias is not None: + torch._check(input_bias.ndim == 1, lambda: f"{input_bias.ndim} != 1") + torch._check( + input_bias.numel() == gates_size, + lambda: f"{input_bias.numel()} != {gates_size}", + ) + torch._check( + input_bias.shape == hidden_bias.shape, + lambda: f"{input_bias.shape} != {hidden_bias.shape}", + ) + torch._check(prev_hidden.ndim == 2, lambda: f"{prev_hidden.ndim} != 2") + expected_prev_hidden_numel = input_gates.size(0) * gates_size // factor + torch._check( + prev_hidden.numel() == expected_prev_hidden_numel, + lambda: f"{prev_hidden.numel()} != {input_gates.size(0)} * {gates_size} // {factor} (aka {expected_prev_hidden_numel})", + ) + torch._check( + all( + # pyrefly: ignore [missing-attribute] + x.device == input_gates.device + for x in [hidden_gates, input_bias, hidden_bias, prev_hidden] + ), + lambda: "expected all inputs to be same device", + ) + + +@register_meta(aten._thnn_fused_lstm_cell.default) +def _thnn_fused_lstm_cell_meta( + input_gates, + hidden_gates, + cx, + input_bias=None, + hidden_bias=None, +): + rnn_cell_checkSizes(input_gates, hidden_gates, input_bias, hidden_bias, 4, cx) + workspace = torch.empty_like(input_gates, memory_format=torch.contiguous_format) + hy = torch.empty_like(cx, memory_format=torch.contiguous_format) + cy = torch.empty_like(cx, memory_format=torch.contiguous_format) + return (hy, cy, workspace) + + +@register_meta(aten._cudnn_rnn.default) +def _cudnn_rnn( + input, + weight, + weight_stride0, + weight_buf, + hx, + cx, + mode, + hidden_size, + proj_size, + num_layers, + batch_first, + dropout, + train, + bidirectional, + batch_sizes, + dropout_state, +): + is_input_packed = len(batch_sizes) != 0 + if is_input_packed: + seq_length = len(batch_sizes) + mini_batch = batch_sizes[0] + batch_sizes_sum = input.shape[0] + else: + seq_length = input.shape[1] if batch_first else input.shape[0] + mini_batch = input.shape[0] if batch_first else input.shape[1] + batch_sizes_sum = -1 + + num_directions = 2 if bidirectional else 1 + out_size = proj_size if proj_size != 0 else hidden_size + if is_input_packed: + out_shape = [batch_sizes_sum, out_size * num_directions] + else: + out_shape = ( + [mini_batch, seq_length, out_size * num_directions] + if batch_first + else [seq_length, mini_batch, out_size * num_directions] + ) + output = input.new_empty(out_shape) + + cell_shape = [num_layers * num_directions, mini_batch, hidden_size] + if cx is None: + cy = torch.empty(0, device=input.device) + else: + cy = cx.new_empty(cell_shape) + + hy = hx.new_empty([num_layers * num_directions, mini_batch, out_size]) + + # TODO: Query cudnnGetRNNTrainingReserveSize (expose to python) + reserve_shape = 0 if train else 0 + reserve = input.new_empty(reserve_shape, dtype=torch.uint8) + + return output, hy, cy, reserve, weight_buf + + +@register_meta(aten.mkldnn_rnn_layer.default) +def mkldnn_rnn_layer( + input, + w0, + w1, + w2, + w3, + hx_, + cx_, + reverse, + batch_sizes, + mode, + hidden_size, + num_layers, + has_biases, + bidirectional, + batch_first, + train, +): + seq_length = input.shape[1] if batch_first else input.shape[0] + mini_batch = input.shape[0] if batch_first else input.shape[1] + output_chanels = hidden_size + out_shape = ( + [mini_batch, seq_length, output_chanels] + if batch_first + else [seq_length, mini_batch, output_chanels] + ) + output = input.new_empty(out_shape) + if hx_ is None: + hy = torch.empty(0, device=input.device) + else: + hy = hx_.new_empty(hx_.shape) + if cx_ is None: + cy = torch.empty(0, device=input.device) + else: + cy = cx_.new_empty(cx_.shape) + workspace = torch.empty(0, device=input.device, dtype=torch.uint8) + return output, hy, cy, workspace + + +def zero_numel_check_dims(self, dim, fn_name): + if self.ndim == 0: + torch._check_index( + dim == 0 or dim == -1, + lambda: f"{fn_name}: Expected reduction dim -1 or 0 for scalar but got {dim}", + ) + else: + torch._check_index( + self.size(dim) != 0, + lambda: f"{fn_name}: Expected reduction dim {dim} to have non-zero size.", + ) + + +# From aten/src/ATen/native/ReduceOps.cpp +def check_argmax_argmin(name, self, dim): + if dim is not None: + dim = maybe_wrap_dim(dim, self.dim()) + zero_numel_check_dims(self, dim, name) + else: + torch._check( + self.numel() != 0, + lambda: f"{name}: Expected reduction dim to be specified for input.numel() == 0.", + ) + + +@register_meta([aten.argmax.default, aten.argmin.default]) +def argmax_argmin_meta(self, dim=None, keepdim=False): + check_argmax_argmin("argmax", self, dim) + dims = utils.reduction_dims(self.shape, (dim,) if dim is not None else None) + shape = _compute_reduction_shape(self, dims, keepdim) + return self.new_empty(shape, dtype=torch.int64) + + +@register_meta(aten.scalar_tensor.default) +def scalar_tensor(s, dtype=None, layout=None, device=None, pin_memory=None): + # NB: It's always wrong to try to create a scalar tensor with the jagged layout. + # Rather than fix this everywhere, just use the strided layout and let NJT handle + # scalar tensor broadcasting. + if layout == torch.jagged: + layout = torch.strided + return torch.empty( + (), dtype=dtype, layout=layout, device=device, pin_memory=pin_memory + ) + + +@register_meta(aten.topk.default) +def topk_meta(self, k, dim=-1, largest=True, sorted=True): + # From aten/src/ATen/native/Sorting.cpp + dim = maybe_wrap_dim(dim, self.dim(), wrap_scalar=True) + sliceSize = 1 if self.dim() == 0 else self.size(dim) + torch._check(k >= 0) + torch._check(k <= sliceSize, lambda: "k not in range for dimension") + + topKSize = list(self.shape) + if len(topKSize) > 0: + topKSize[dim] = k + return self.new_empty(topKSize), self.new_empty(topKSize, dtype=torch.int64) + + +@register_meta(aten._segment_reduce_backward) +@out_wrapper() +def meta__segment_reduce_backward( + grad, output, data, reduce, lengths=None, offsets=None, axis=0, initial=None +): + assert lengths is not None or offsets is not None, ( + "segment_reduce(): Either lengths or offsets must be defined" + ) + data_contig = data.contiguous() + grad_contig = grad.contiguous() + return torch.empty_like( + data_contig, + dtype=grad_contig.dtype, + device=grad_contig.device, + layout=grad_contig.layout, + ) + + +@register_meta([aten.kthvalue.default, aten.kthvalue.values]) +@out_wrapper("values", "indices") +def kthvalue_meta(self, k, dim=-1, keepdim=False): + from torch.fx.experimental.symbolic_shapes import sym_and + + dim = maybe_wrap_dim(dim, self.dim(), wrap_scalar=True) + dimSize = self.size(dim) if self.dim() > 0 else 1 + torch._check( + sym_and(k >= 1, k <= dimSize), + lambda: f"kthvalue(): selected number k out of range for dimension {dim}", + ) + + shape = list(self.shape[:dim] + self.shape[dim + 1 :]) + if keepdim and self.dim() > 0: + shape.insert(dim, 1) + return self.new_empty(shape), self.new_empty(shape, dtype=torch.int64) + + +legacy_contiguous_memory_format = torch.contiguous_format + + +# From aten/src/ATen/native/cuda/RNN.cu +def checkLSTMBackwardSizes(grad_hy, grad_cy, cx, cy, workspace): + defined_grad = grad_hy if grad_hy is not None else grad_cy + torch._check(defined_grad.dim() == 2, lambda: "") + exp_size = defined_grad.size() + if grad_hy is not None: + torch._check(grad_hy.size() == exp_size, lambda: "") + if grad_cy is not None: + torch._check(grad_cy.size() == exp_size, lambda: "") + torch._check(cx.size() == exp_size, lambda: "") + torch._check(cy.size() == exp_size, lambda: "") + torch._check(workspace.dim() == 2, lambda: "") + torch._check(workspace.numel() == exp_size[0] * exp_size[1] * 4, lambda: "") + + +# From aten/src/ATen/native/cuda/RNN.cu +@register_meta(aten._thnn_fused_lstm_cell_backward_impl.default) +def _thnn_fused_lstm_cell_backward_impl(grad_hy, grad_cy, cx, cy, workspace, has_bias): + if grad_hy is None and grad_cy is None: + return None, None, None + checkLSTMBackwardSizes(grad_hy, grad_cy, cx, cy, workspace) + grad_gates = torch.empty_like( + workspace, memory_format=legacy_contiguous_memory_format + ) + grad_cx = torch.empty_like(cx, memory_format=legacy_contiguous_memory_format) + grad_bias = grad_gates.sum(0, keepdim=False) if has_bias else None + return grad_gates, grad_cx, grad_bias + + +# From aten/src/ATen/native/mps/operations/Linear.mm +@register_meta(aten.linear_backward.default) +def linear_backward(input_, grad_output_, weight_, output_mask): + grad_input = None + grad_weight = None + grad_bias = None + if output_mask[0]: + grad_input = grad_output_.new_empty(input_.size()) + if output_mask[1] or output_mask[2]: + grad_weight = grad_output_.new_empty((grad_output_.size(-1), input_.size(-1))) + grad_bias = grad_output_.new_empty(grad_output_.size(-1)) + return (grad_input, grad_weight, grad_bias) + + +@register_meta(aten.pixel_shuffle.default) +def meta_pixel_shuffle(self, upscale_factor): + assert ( + len(self.shape) > 2 and self.shape[-3] % (upscale_factor * upscale_factor) == 0 + ), ( + f"Invalid input shape for pixel_shuffle: {self.shape} with upscale_factor = {upscale_factor}" + ) + + def is_channels_last(ten): + return torch._prims_common.suggest_memory_format(ten) == torch.channels_last + + def pick_memory_format(): + if is_channels_last(self): + if device_hint(self) == "cuda": + return torch.contiguous_format + else: + return torch.channels_last + elif self.is_contiguous(memory_format=torch.contiguous_format): + return torch.contiguous_format + elif self.is_contiguous(memory_format=torch.preserve_format): + return torch.preserve_format + + C = self.shape[-3] // (upscale_factor * upscale_factor) + Hr = self.shape[-2] * upscale_factor + Wr = self.shape[-1] * upscale_factor + out_shape = (*self.shape[:-3], C, Hr, Wr) + + out = self.new_empty(out_shape) + out = out.to(memory_format=pick_memory_format()) # type: ignore[call-overload] + return out + + +@register_meta(aten.mkldnn_rnn_layer_backward.default) +def mkldnn_rnn_layer_backward( + input, + weight0, + weight1, + weight2, + weight3, + hx_, + cx_tmp, + output, + hy_, + cy_, + grad_output_r_opt, + grad_hy_r_opt, + grad_cy_r_opt, + reverse, + mode, + hidden_size, + num_layers, + has_biases, + train, + bidirectional, + batch_sizes, + batch_first, + workspace, +): + diff_x = input.new_empty(input.shape) + diff_hx = hx_.new_empty(hx_.shape) + diff_cx = cx_tmp.new_empty(cx_tmp.shape) + diff_w1 = weight0.new_empty(weight0.shape) + diff_w2 = weight1.new_empty(weight1.shape) + diff_b = weight2.new_empty(weight2.shape) + return diff_x, diff_w1, diff_w2, diff_b, diff_b, diff_hx, diff_cx + + +@register_meta([aten.bucketize.Tensor, aten.bucketize.Tensor_out]) +@out_wrapper() +def meta_bucketize(self, boundaries, *, out_int32=False, right=False): + return torch.empty_like( + self, + dtype=torch.int32 if out_int32 else torch.int64, + memory_format=torch.contiguous_format, + ) + + +@register_meta([aten.histc]) +@out_wrapper() +def meta_histc(input, bins=100, min=0, max=0): + fn_name = "histc()" + if device_hint(input) == "cpu": + torch._check( + input.is_floating_point(), + lambda: f"\"histogram_cpu\" not implemented for '{input.dtype}'", + ) + if device_hint(input) == "cuda" and input.is_floating_point(): + utils.alert_not_deterministic("_histc_cuda with floating point input") + torch._check( + isinstance(bins, IntLike), + lambda: f"{fn_name}: argument 'bins' must be int, not {type(bins)}", + ) + torch._check(bins > 0, lambda: f"{fn_name}: bins must be > 0, but got {bins}") + torch._check( + isinstance(min, Number), + lambda: f"{fn_name}: argument 'min' must be Number, not {type(min)}", + ) + torch._check( + isinstance(max, Number), + lambda: f"{fn_name}: argument 'max' must be Number, not {type(max)}", + ) + torch._check(max >= min, lambda: f"{fn_name}: max must be larger than min") + return torch.empty(bins, device=input.device, dtype=input.dtype) + + +@register_meta( + [aten._upsample_bilinear2d_aa.default, aten._upsample_bicubic2d_aa.default] +) +def meta_upsample_bimode2d_aa( + input, + output_size, + align_corners, + scales_h=None, + scales_w=None, +): + full_output_size = upsample_common_check( + input.size(), output_size, num_spatial_dims=2 + ) + torch._check( + input.numel() != 0 or all(size > 0 for size in input.size()[1:]), + lambda: f"Non-empty 4D data tensor expected but got a tensor with sizes {input.size()}", + ) + return input.new_empty(full_output_size).to( + memory_format=utils.suggest_memory_format(input) + ) + + +@register_meta([aten._upsample_bilinear2d_aa_backward.default]) +def meta_upsample_bimode2d_aa_backward( + grad_output, + output_size, + input_size, + align_corners, + scales_h=None, + scales_w=None, +): + full_output_size = upsample_common_check( + input_size, output_size, num_spatial_dims=2 + ) + torch._check( + grad_output.ndim == 4, + lambda: f"Expected grad_output to be a tensor of dimension 4 but got: dimension {grad_output.ndim}", + ) + for i in range(4): + torch._check( + grad_output.shape[i] == full_output_size[i], + lambda: f""" +Expected grad_output to have the same shape as output; output.size({i}) = {full_output_size[i]} +but got grad_output_size({i}) = {grad_output.size(i)}""", + ) + return grad_output.new_empty(input_size).to( + memory_format=utils.suggest_memory_format(grad_output) + ) + + +# From aten/src/ATen/native/cuda/AmpKernels.cu +@register_meta(aten._amp_foreach_non_finite_check_and_unscale_.default) +def _amp_foreach_non_finite_check_and_unscale_(self, found_inf, inv_scale): + torch._check( + found_inf.numel() == 1, lambda: "found_inf must be a 1-element tensor." + ) + torch._check( + inv_scale.numel() == 1, lambda: "inv_scale must be a 1-element tensor." + ) + torch._check( + found_inf.dtype.is_floating_point, + lambda: "found_inf must be a float tensor.", + ) + torch._check( + inv_scale.dtype.is_floating_point, + lambda: "inv_scale must be a float tensor.", + ) + + +# From aten/src/ATen/native/UnaryOps.cpp +@register_meta([aten.nan_to_num.default, aten.nan_to_num.out]) +@out_wrapper() +def nan_to_num(self, nan=None, posinf=None, neginf=None): + return torch.empty_like(self) + + +@register_meta(torch.ops.aten.transpose_) +def transpose_(self, dim0, dim1): + assert self.layout not in { + torch.sparse_csr, + torch.sparse_csc, + torch.sparse_bsr, + torch.sparse_bsc, + }, ( + f"torch.transpose_: in-place transposition is not supported for {self.layout} layout" + ) + + ndims = self.ndim + + dim0 = maybe_wrap_dim(dim0, ndims) + dim1 = maybe_wrap_dim(dim1, ndims) + + if dim0 == dim1: + return self + + size = list(self.size()) + stride = list(self.stride()) + + stride[dim0], stride[dim1] = stride[dim1], stride[dim0] + size[dim0], size[dim1] = size[dim1], size[dim0] + + self.as_strided_(size, stride) + return self + + +@register_meta(torch.ops.aten.t_) +def t_(self): + ndims = self.ndim + + if self.is_sparse: + sparse_dim = self.sparse_dim() + dense_dim = self.dense_dim() + assert sparse_dim <= 2 and dense_dim == 0, ( + f"t_ expects a tensor with <= 2 sparse and 0 dense dimensions, " + f"but got {sparse_dim} sparse and {dense_dim} dense dimensions" + ) + else: + assert self.dim() <= 2, ( + f"t_ expects a tensor with <= 2 dimensions, but self is {ndims}D" + ) + + return transpose_(self, 0, 0 if ndims < 2 else 1) + + +@register_meta(aten.searchsorted) +@out_wrapper() +def meta_searchsorted( + sorted_sequence, + self, + *, + out_int32=False, + right=False, + side=None, + sorter=None, +): + # If the sorted_sequence is not one-dimensional, its shape must match that of values + # in all but the last dimension. + torch._check( + len(sorted_sequence.shape) <= 1 + or sorted_sequence.shape[:-1] == self.shape[:-1], + lambda: ( + "torch.searchsorted(): boundaries tensor should be 1 dimension or the " + "first N-1 dimensions of boundaries tensor and input value tensor must " + f"match, but we got boundaries tensor {list(sorted_sequence.shape)} and " + f"input value tensor {list(self.shape)}" + ), + ) + + # If a sorter array is provided, its dimensions must exactly match sorted_sequence. + torch._check( + sorter is None or sorted_sequence.shape == sorter.shape, + lambda: ( + "torch.searchsorted(): boundary and sorter must have the same size, but " + f"got boundary tensor {list(sorted_sequence.shape)} and got sorter tensor " + f"{list(sorter.shape) if sorter is not None else []}" + ), + ) + + # Per the docs, if side == "left" and right is True, we error. + torch._check( + side != "left" or not right, + lambda: "torch.searchsorted(): side and right can't be set to opposites, got side of " + "left while right was True", + ) + + dtype = torch.int32 if out_int32 else torch.int64 + if isinstance(self, torch.Tensor): + return torch.empty_like( + self, dtype=dtype, memory_format=torch.contiguous_format + ) + else: # Scalar + return torch.empty((), dtype=dtype, device=sorted_sequence.device) + + +def _check_for_unsupported_isin_dtype(dtype): + torch._check( + dtype not in (torch.bool, torch.complex128, torch.complex64), + lambda: f"Unsupported input type encountered for isin(): {dtype}", + ) + + +@register_meta(aten.embedding_dense_backward) +def meta_embedding_dense_backward( + grad_output, + indices, + num_weights, + padding_idx, + scale_grad_by_freq, +): + grad_weight = grad_output.new_empty((num_weights, grad_output.size(-1))) + return grad_weight + + +@register_meta(aten._embedding_bag_backward) +def meta_embedding_bag_backward( + grad, + indices, + offsets, + offset2bag, + bag_size, + maximum_indices, + num_weights, + scale_grad_by_freq, + mode, + sparse, + per_sample_weights, + padding_idx=-1, +): + if sparse: + return aten._embedding_bag_sparse_backward( + grad, + indices, + offsets, + offset2bag, + bag_size, + num_weights, + scale_grad_by_freq, + mode, + per_sample_weights, + padding_idx, + ) + else: + return meta_embedding_bag_dense_backward( + grad, + indices, + offset2bag, + bag_size, + maximum_indices, + num_weights, + scale_grad_by_freq, + mode, + per_sample_weights, + padding_idx, + ) + + +@register_meta(aten._embedding_bag_dense_backward) +def meta_embedding_bag_dense_backward( + grad, + indices, + offset2bag, + bag_size, + maximum_indices, + num_weights, + scale_grad_by_freq, + mode, + per_sample_weights, + padding_idx=-1, +): + torch._check( + grad.dtype in [torch.float16, torch.bfloat16, torch.float32, torch.float64], + lambda: f"Unsupported input type encountered: {grad.dtype}", + ) + if mode == MODE_MAX: + torch._check(maximum_indices is not None) + index_grad_weight = grad.new_empty((num_weights, grad.size(1))) + return index_grad_weight + + +@register_meta(aten._embedding_bag_per_sample_weights_backward) +def meta_embedding_bag_per_sample_weights_backward( + grad, + weight, + indices, + offsets, + offset2bag, + mode, + padding_idx=-1, +): + embedding_features = grad.size(1) + torch._check( + mode == MODE_SUM, + lambda: "embedding_bag_backward: per_sample_weights only supported for mode='sum'", + ) + torch._check(grad.dim() == 2) + torch._check(indices.dim() == 1) + num_samples = indices.size(0) + torch._check(weight.dim() == 2) + torch._check(weight.size(1) == embedding_features) + output = grad.new_empty((num_samples,)) + return output + + +@register_meta(aten.isin) +@out_wrapper() +def meta_isin(elements, test_elements, *, assume_unique=False, invert=False): + torch._check( + isinstance(elements, Tensor) or isinstance(test_elements, Tensor), + lambda: "At least one of elements and test_elements must be a Tensor.", + ) + if not isinstance(elements, Tensor): + elements = torch.tensor(elements, device=test_elements.device) + + if not isinstance(test_elements, Tensor): + test_elements = torch.tensor(test_elements, device=elements.device) + + _check_for_unsupported_isin_dtype(elements.dtype) + _check_for_unsupported_isin_dtype(test_elements.dtype) + return torch.empty_like(elements, dtype=torch.bool) + + +@register_meta(aten.polygamma) +@out_wrapper() +def meta_polygamma(n: int, self: Tensor) -> Tensor: + torch._check(n >= 0, lambda: "polygamma(n, x) does not support negative n.") + _, result_dtype = elementwise_dtypes( + self, + type_promotion_kind=ELEMENTWISE_TYPE_PROMOTION_KIND.INT_TO_FLOAT, + ) + return torch.empty_like(self, dtype=result_dtype) + + +@register_meta(aten._local_scalar_dense) +def meta_local_scalar_dense(self: Tensor): + raise RuntimeError("Tensor.item() cannot be called on meta tensors") + + +@register_meta(aten.silu) +@out_wrapper(exact_dtype=True) +def silu(self: Tensor) -> Tensor: + return torch.empty_like(self) + + +@register_meta(aten.sigmoid) +@out_wrapper() +def sigmoid(self: Tensor) -> Tensor: + _, result_dtype = elementwise_dtypes( + self, + type_promotion_kind=ELEMENTWISE_TYPE_PROMOTION_KIND.INT_TO_FLOAT, + ) + return torch.empty_like(self, dtype=result_dtype) + + +def _create_grouped_mm_output_tensor(mat1, mat2, offs, out_dtype): + mat1_is_2d = mat1.dim() == 2 + mat2_is_2d = mat2.dim() == 2 + + if mat1_is_2d: + if mat2_is_2d: + out_size = [offs.size(0), mat1.size(0), mat2.size(1)] + else: + torch._check( + offs.size(0) == mat2.size(0), lambda: "matrix batch sizes have to match" + ) + out_size = [mat1.size(0), mat2.size(-1)] + else: + if mat2_is_2d: + torch._check( + offs.size(0) == mat1.size(0), lambda: "matrix batch sizes have to match" + ) + out_size = [mat1.size(1), mat2.size(1)] + else: + # regular bmm + torch._check( + mat1.size(0) == mat2.size(0), lambda: "batched dimension has to match" + ) + out_size = [mat1.size(0), mat1.size(1), mat2.size(-1)] + + out_dtype = out_dtype or mat1.dtype + + if torch.version.cuda: + alignment = 16 // out_dtype.itemsize + size_padded = (out_size[-1] + alignment - 1) // alignment * alignment + if mat1_is_2d == mat2_is_2d: + out_stride = [out_size[1] * size_padded, size_padded, 1] + else: + out_stride = [size_padded, 1] + out = torch.empty_strided( + out_size, out_stride, dtype=out_dtype, device=mat1.device + ) + else: + out = torch.empty(out_size, dtype=out_dtype, device=mat1.device) + return out + + +def _meta_grouped_mm_common( + mat_a: Tensor, + mat_b: Tensor, + scale_a: torch.Tensor | None, + scale_b: torch.Tensor | None, + offs: Tensor | None = None, + bias: Tensor | None = None, + scale_result: torch.Tensor | None = None, + out_dtype: torch.dtype | None = None, + use_fast_accum: bool = False, +): + torch._check( + (scale_a is None) == (scale_b is None), + lambda: "Either both scale factors are given, or none", + ) + scaled = scale_a is not None and scale_b is not None + + # Implementing all the checks from + # _grouped_mm_cuda()/_scaled_grouped_mm_cuda() code in + # aten/src/ATen/native/cuda/Blas.cpp. + + if scaled: + fp8_dtype = torch.float8_e4m3fnuz if torch.version.hip else torch.float8_e4m3fn + torch._check( + mat_a.dtype == fp8_dtype and mat_b.dtype == fp8_dtype, + lambda: f"Expected inputs of E4M3 FP8 type but got mat_a.dtype={mat_a.dtype} and mat_b.dtype={mat_b.dtype}.", # noqa: B950 + ) + else: + torch._check( + mat_a.dtype == torch.bfloat16 and mat_b.dtype == torch.bfloat16, + lambda: f"Expected inputs of BF16 type but got mat_a.dtype={mat_a.dtype} and mat_b.dtype={mat_b.dtype}.", # noqa: B950 + ) + + torch._check( + mat_a.dim() in [2, 3] and mat_b.dim() in [2, 3], + lambda: f"Multiplicands must be 2D or 3D but got mat_a.dim()={mat_a.dim()} and mat_b.dim()={mat_b.dim()}", # noqa: B950 + ) + + mat_a_is_2d = mat_a.dim() == 2 + mat_b_is_2d = mat_b.dim() == 2 + + if not mat_a_is_2d or not mat_b_is_2d: + torch._check( + mat_a.size(-1) == mat_b.size(-2), + lambda: "contraction dimension of mat_a and mat_b must match", + ) + + if scaled: + + def is_row_major(mat): + mat_stride = mat.stride() + return mat_stride[-2] > 1 and mat_stride[-1] == 1 + + def is_col_major(mat): + mat_stride = mat.stride() + return mat_stride[-2] == 1 and mat_stride[-1] > 1 + + torch._check( + is_row_major(mat_a), + lambda: f"Expected mat_a tensor to be row major in the last two dimensions, got strides {mat_a.stride()[-2:]}", # noqa: B950 + ) + torch._check( + is_col_major(mat_b), + lambda: f"Expected mat_b tensor to be column major in the last two dimensions, got strides {mat_b.stride()[-2:]}", # noqa: B950 + ) + + def check_valid_strides(mat_name, mat): + end_dim = mat.dim() - 1 + alignment = 16 // mat.element_size() + mat_stride = mat.stride() + if mat_stride[end_dim - 1] == 1 and mat_stride[end_dim] >= max( + 1, mat.shape[end_dim - 1] + ): + torch._check( + mat_stride[end_dim] % alignment == 0, + lambda: f"Expected {mat_name} stride along {end_dim} dim to be multiple of 16 bytes, got {mat_stride[end_dim]}.", # noqa: B950 + ) + elif mat_stride[end_dim] == 1 and mat_stride[end_dim - 1] >= max( + 1, mat.shape[end_dim] + ): + torch._check( + mat_stride[end_dim - 1] % alignment == 0, + lambda: f"Expected {mat_name} stride along {end_dim - 1} dim to be multiple of 16 bytes, got {mat_stride[end_dim - 1]}.", # noqa: B950 + ) + else: + torch._check( + False, + lambda: f"Invalid strides/sizes, got {mat_stride} for strides and {mat.shape} for sizes.", # noqa: B950 + ) + + check_valid_strides("mat_a", mat_a) + check_valid_strides("mat_b", mat_b) + + if scale_a is not None and scale_b is not None: + torch._check( + (scale_a.dtype == torch.float32 and scale_b.dtype == torch.float32) + or ( + scale_a.dtype == torch.float8_e8m0fnu + and scale_b.dtype == torch.float8_e8m0fnu + ), + lambda: f"For FP8 scales must both be float32, or for MXFP8 both scales must be float8_e8m0fnu. Got scale_a.dtype={scale_a.dtype} and scale_b.dtype={scale_b.dtype}.", # noqa: B950 + ) + is_mxfp8 = ( + scale_a.dtype == torch.float8_e8m0fnu + and scale_b.dtype == torch.float8_e8m0fnu + ) + + def check_scale(scale_name, scale, mat, scaled_dim, scale_multiplier=1): + if mat.dim() == 2: + torch._check( + scale.is_contiguous(), + lambda: f"Expected {scale_name} to be contiguous.", + ) + # For MXFP8, 2d tensors have variable size groups represented as subtensors, + # that are converted to blocked padded format individually. At compile time we don't know + # the group sizes yet, so we don't know the expect size of the blocked format scale. + # This limits what we can check here. + if is_mxfp8: + torch._check( + scale.dim() == mat.dim(), + lambda: f"For MXFP8, scale must have same number of dimensions as target tensor, but {scale_name} has mat.ndim={mat.ndim} and scale.ndim={scale.ndim}", # noqa: B950 + ) + else: + torch._check( + scale.dim() == 1, + lambda: f"Expected {scale_name} to be 1D tensor, but got {scale.dim()}D tensor.", + ) + torch._check( + scale.shape[0] == mat.shape[scaled_dim] * scale_multiplier, + lambda: f"Expected {scale_name} to have {mat.shape[scaled_dim] * scale_multiplier} elements, got {scale.shape[0]} elements.", # noqa: B950 + ) + else: + torch._check( + scale.stride(-1) == 1, + lambda: f"Expected {scale_name} to be contiguous in the last dimension.", + ) + torch._check( + scale.shape[0] == mat.shape[0], + lambda: f"Expected {scale_name} batch dimension to be {mat.shape[0]}, got {scale.shape[0]}.", + ) + # For MXFP8, 3d tensors have static 'groups' (stack of 2d tensors) so we can know the expected blocked + # scale sizes at compile time. + if is_mxfp8: + torch._check( + scale.ndim == mat.ndim - 1, + lambda: f"For MXFP8, 3d tensor should have 2d scales, but {scale_name} has mat.ndim={mat.ndim} and scale.ndim={scale.ndim}", # noqa: B950 + ) + # TODO: This logic only holds for RHS tensor in 2d-3d case. + # We'll need to update it to handle LHS 3d tensor in 3d-2d and 3d-3d cases. + G, K, N = mat.shape + block_size = 32 + blocked_K = round_up(K / block_size, 4) + blocked_N = round_up(N, 128) + torch._check( + scale.shape[0] == G and scale.shape[1] == blocked_K * blocked_N, + lambda: f"For MXFP8, expected mat.shape={mat.shape} to have scale shape of ({G},{blocked_K * blocked_N}), but got {scale.shape}", # noqa: B950 + ) + else: + torch._check( + scale.dim() == 2, + lambda: f"Expected {scale_name} to be 2D tensor, but got {scale.dim()}D tensor.", + ) + torch._check( + scale.shape[1] == mat.shape[1 + scaled_dim], + lambda: f"Expected {scale_name} non-batch dimension to be {mat.shape[1 + scaled_dim]}, got {scale.shape[1]}.", # noqa: B950 + ) + + scale_multiplier = ( + offs.shape[0] if offs is not None and mat_a_is_2d and mat_b_is_2d else 1 + ) + check_scale("scale_a", scale_a, mat_a, 0, scale_multiplier) + check_scale("scale_b", scale_b, mat_b, 1, scale_multiplier) + + torch._check( + scale_result is None, + lambda: "Scale result tensor provided, but it is not supported yet.", + ) + + if mat_a_is_2d or mat_b_is_2d: + torch._check( + offs is not None, + lambda: f"Offsets tensor not provided, but is needed for {mat_a.dim()}D/{mat_b.dim()}D multiplicand layouts.", + ) + if offs is not None: # to silence Mypy + torch._check( + offs.dim() == 1, + lambda: f"Offsets tensor must be 1D, but got offs.dim()={offs.dim()}.", + ) + torch._check( + offs.dtype == torch.int32, + lambda: f"Offsets tensor must be integer (int32) tensor, but got {offs.dtype}.", + ) + else: + torch._check( + offs is None, + lambda: "Offsets tensor provided, but is not needed for 3D/3D multiplicand layouts.", + ) + + torch._check( + bias is None, + lambda: "Bias tensor provided, but it is not supported yet.", + ) + + torch._check( + out_dtype is None or out_dtype == torch.bfloat16, + lambda: "If output dtype provided, it must be torch.bfloat16.", + ) + + return _create_grouped_mm_output_tensor(mat_a, mat_b, offs, out_dtype) + + +@register_meta(aten._grouped_mm) +@out_wrapper() +def meta_grouped_mm( + mat_a: Tensor, + mat_b: Tensor, + offs: Tensor | None = None, + bias: Tensor | None = None, + out_dtype: torch.dtype | None = None, +) -> Tensor: + return _meta_grouped_mm_common( + mat_a, + mat_b, + scale_a=None, + scale_b=None, + offs=offs, + bias=bias, + scale_result=None, + out_dtype=out_dtype, + ) + + +@register_meta([aten._scaled_grouped_mm]) +def meta_scaled_grouped_mm( + mat_a: torch.Tensor, + mat_b: torch.Tensor, + scale_a: torch.Tensor, + scale_b: torch.Tensor, + offs: torch.Tensor | None = None, + bias: torch.Tensor | None = None, + scale_result: torch.Tensor | None = None, + out_dtype: torch.dtype | None = None, + use_fast_accum: bool = False, +): + # matching _scaled_grouped_mm_cuda Blas.cpp implementation + out_dtype = out_dtype or torch.bfloat16 + + return _meta_grouped_mm_common( + mat_a, + mat_b, + scale_a=scale_a, + scale_b=scale_b, + offs=offs, + bias=bias, + scale_result=scale_result, + out_dtype=out_dtype, + use_fast_accum=use_fast_accum, + ) + + +@register_meta(aten._softmax) +@out_wrapper() +def softmax(x: Tensor, dim: int, half_to_float: bool) -> Tensor: + if half_to_float: + assert x.dtype in [torch.half, torch.bfloat16] + + computation_dtype, result_dtype = utils.elementwise_dtypes( + x, type_promotion_kind=utils.ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT + ) + + result_dtype = result_dtype if not half_to_float else computation_dtype + res = torch.empty_like(x, dtype=result_dtype, memory_format=torch.contiguous_format) + return res + + +@register_meta(aten.constant_pad_nd) +@out_wrapper() +def _constant_pad_nd_meta(input, pad, value=0): + # same checks as decomposition in torch/_refs/__init__.py:constant_pad_nd() + torch._check( + len(pad) % 2 == 0, + lambda: f"Length of pad must be even but instead it equals {len(pad)}", + ) + + input_sizes = input.shape + l_inp = len(input_sizes) + l_pad = len(pad) // 2 + l_diff = l_inp - l_pad + + torch._check( + l_inp >= l_pad, + lambda: "Length of pad should be no more than twice the number of " + f"dimensions of the input. Pad length is {len(pad)} while the input has " + f"{l_inp} dimensions.", + ) + + if all(isinstance(p, utils.IntWithoutSymInt) and p <= 0 for p in pad): + c_input = input + for i in range(l_diff, l_inp): + pad_idx = 2 * (l_inp - i - 1) + if pad[pad_idx] < 0: + c_input = c_input.narrow( + i, -pad[pad_idx], c_input.shape[i] + pad[pad_idx] + ) + + if pad[pad_idx + 1] < 0: + c_input = c_input.narrow(i, 0, c_input.shape[i] + pad[pad_idx + 1]) + + return c_input.clone() + + new_shape = list(input_sizes[:l_diff]) + for i in range(l_pad): + pad_idx = len(pad) - ((i + 1) * 2) + new_dim = input_sizes[l_diff + i] + pad[pad_idx] + pad[pad_idx + 1] + torch._check( + new_dim >= 0, + lambda: f"The input size {input_sizes[l_diff + i]}, plus negative padding " + f"{pad[pad_idx]} and {pad[pad_idx + 1]} resulted in a negative output size, " + f"which is invalid. Check dimension {l_diff + i} of your input.", + ) + new_shape.append(new_dim) + + return torch.empty( + new_shape, + dtype=input.dtype, + device=input.device, + requires_grad=input.requires_grad, + memory_format=suggest_memory_format(input), + ) + + +@register_meta(aten.embedding) +@out_wrapper() +def embedding( + weight: Tensor, + indices: Tensor, + padding_idx: int = -1, + scale_grad_by_freq: bool = False, + sparse: bool = False, +) -> Tensor: + assert weight.dim() == 2, "'weight' must be 2-D" + weight_shape = weight.shape + indices_shape = indices.shape + + if indices.ndim == 0: + out_shape: tuple[int, ...] = (weight_shape[1],) + elif indices.ndim == 1: + out_shape = (indices_shape[0], weight_shape[1]) + else: + out_shape = (*indices_shape, weight_shape[1]) + + out_dtype = weight.dtype + return weight.new_empty(out_shape, dtype=out_dtype) + + +@register_meta(aten._jagged_to_padded_dense_forward.default) +def meta__jagged_to_padded_dense_forward( + values: Tensor, + offsets: list[Tensor], + max_lengths: list[int], + padding_value: float = 0.0, +): + # only one jagged dim is supported for now + assert len(offsets) == 1 + assert len(max_lengths) == 1 + + B = offsets[0].shape[0] - 1 + S = max_lengths[0] + output_shape = (B, S, *values.shape[1:]) + return values.new_empty(output_shape) + + +def _create_unary_float_meta_func(func): + @register_meta(func) + @out_wrapper() + def _f(x): + return elementwise_meta( + x, type_promotion=ELEMENTWISE_TYPE_PROMOTION_KIND.INT_TO_FLOAT + ) + + return _f + + +# Implementation follows cuda implementation native_multi_head_attention_cuda +@register_meta(aten._native_multi_head_attention.default) +def native_multi_head_attention_fake( + query, + key, + value, + embed_dim, + num_head, + qkv_weight, + qkv_bias, + proj_weight, + proj_bias, + mask=None, + need_weights=True, + average_attn_weights=True, + mask_type=None, +): + if query.is_nested or key.is_nested or value.is_nested: + raise NotImplementedError( + "_native_multi_head_attention fake implementation does not support nested tensors" + ) + + if query.numel() == 0: + return (query.new_empty(query.shape), query.new_empty(0)) + + B = query.size(0) # B: batch size + T = query.size(1) # T: target sequence length + + # In native_multi_head_attention_cuda, + # we have proj = transform0213_gemm_nt_bias(attn_ctx, proj_weight, proj_bias, query) + # , which does attn_ctx @ proj_weight.T + proj_bias + # so the last dim of output shape is proj_weight.size(0) + output_dim = proj_weight.size(0) + output = query.new_empty(B, T, output_dim) + + if need_weights: + if average_attn_weights: + # When averaging attention weights, shape is [B, T, T] (averaged over heads) + # T = query seq len, S = key/value seq len + attn_weights = query.new_empty(B, T, T) + else: + # When not averaging, shape is [B, num_head, T, T] + # T = query seq len, S = key/value seq len + attn_weights = query.new_empty(B, num_head, T, T) + else: + attn_weights = query.new_empty(0) + + return (output, attn_weights) + + +def _create_binary_float_meta_func(func): + @register_meta(func) + @out_wrapper() + def _f(x, y): + return elementwise_meta( + x, y, type_promotion=ELEMENTWISE_TYPE_PROMOTION_KIND.INT_TO_FLOAT + ) + + return _f + + +_create_unary_float_meta_func(aten.special_airy_ai) +_create_unary_float_meta_func(aten.special_bessel_y0) +_create_unary_float_meta_func(aten.special_bessel_y1) +_create_unary_float_meta_func(aten.special_modified_bessel_i0) +_create_unary_float_meta_func(aten.special_modified_bessel_i1) +_create_unary_float_meta_func(aten.special_modified_bessel_k0) +_create_unary_float_meta_func(aten.special_modified_bessel_k1) +_create_unary_float_meta_func(aten.special_scaled_modified_bessel_k0) +_create_unary_float_meta_func(aten.special_scaled_modified_bessel_k1) + + +_create_binary_float_meta_func(aten.special_chebyshev_polynomial_t) +_create_binary_float_meta_func(aten.special_chebyshev_polynomial_u) +_create_binary_float_meta_func(aten.special_chebyshev_polynomial_v) +_create_binary_float_meta_func(aten.special_chebyshev_polynomial_w) +_create_binary_float_meta_func(aten.special_shifted_chebyshev_polynomial_t) +_create_binary_float_meta_func(aten.special_shifted_chebyshev_polynomial_u) +_create_binary_float_meta_func(aten.special_shifted_chebyshev_polynomial_v) +_create_binary_float_meta_func(aten.special_shifted_chebyshev_polynomial_w) +_create_binary_float_meta_func(aten.special_hermite_polynomial_h) +_create_binary_float_meta_func(aten.special_hermite_polynomial_he) +_create_binary_float_meta_func(aten.special_laguerre_polynomial_l) +_create_binary_float_meta_func(aten.special_legendre_polynomial_p) + + +def _register_inplace_meta(fn): + @wraps(fn) + def _fn(self, *args, **kwargs): + out = fn(self, *args, **kwargs) + check_inplace_broadcast(self.shape, out.shape) + return self + + inplace_name = f"{fn.__name__}_" + _fn.__name__ = inplace_name + _fn = register_meta(getattr(aten, inplace_name))(_fn) # type: ignore[assignment] + + return _fn + + +@register_meta(aten.lerp) +@out_wrapper() +def lerp(start, end, weight): + torch._check( + start.dtype == end.dtype, + lambda: f"expected dtype {start.dtype} for `end`, but got dtype {end.dtype}", + ) + args = [start, end] + if isinstance(weight, TensorLike): + if weight.ndim != 0: + torch._check( + start.dtype == weight.dtype, + lambda: f"expected dtype {start.dtype} for `weight`, but got dtype {weight.dtype}", + ) + args.append(weight) + return elementwise_meta( + *args, type_promotion=ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT + ) + + +@register_meta(aten.addcmul) +@out_wrapper() +def addcmul(input, tensor1, tensor2, *, value=1): + return elementwise_meta( + input, tensor1, tensor2, type_promotion=ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT + ) + + +@register_meta(aten.addcdiv) +@out_wrapper() +def addcdiv(input, tensor1, tensor2, *, value=1): + torch._check( + not ( + utils.is_integer_dtype(tensor1.dtype) + and utils.is_integer_dtype(tensor2.dtype) + ), + lambda: ( + "Integer division with addcdiv is no longer supported, and in a future ", + "release addcdiv will perform a true division of tensor1 and tensor2. ", + "The historic addcdiv behavior can be implemented as ", + "(input + value * torch.trunc(tensor1 / tensor2)).to(input.dtype) ", + "for integer inputs and as ", + "(input + value * tensor1 / tensor2) for float inputs. ", + "The future addcdiv behavior is just the latter implementation: ", + "(input + value * tensor1 / tensor2), for all dtypes.", + ), + ) + return elementwise_meta( + input, tensor1, tensor2, type_promotion=ELEMENTWISE_TYPE_PROMOTION_KIND.DEFAULT + ) + + +lerp_ = _register_inplace_meta(aten.lerp) +addcmul_ = _register_inplace_meta(aten.addcmul) +addcdiv_ = _register_inplace_meta(aten.addcdiv) + + +# We must also trigger meta registrations from PrimTorch ref +# decompositions +import torch._refs +import torch._refs.nn.functional +import torch._refs.special + + +def activate_meta(): + activate_meta_table = {} + + # For a given op, we pick the most specific decomp function from + # global_decomp_table in the precedence order of meta > post_autograd > pre_autograd + for type in ["meta", "post_autograd", "pre_autograd"]: + registry = global_decomposition_table[type] + + for opo in registry: + if opo not in activate_meta_table: + activate_meta_table[opo] = registry[opo] + + for op_overload, fn in activate_meta_table.items(): + # Don't register meta for HigherOrderOp's decomp. + # We can reconsider this in the future, but in general, + # the way you do a meta for a HigherOrderOp is different from + # OpOverload. + if isinstance(op_overload, torch._ops.HigherOrderOperator): + continue + assert isinstance(op_overload, OpOverload) + + op_overload.py_impl(torch._C.DispatchKey.Meta)(fn) + + if torch._C._dispatch_has_kernel_for_dispatch_key( + op_overload.name(), "CompositeImplicitAutograd" + ): + # Internally, we shouldn't be registering meta kernels for any operators that + # have CompositeImplicitAutograd kernels. + # Instead, we should be letting those decompositions run, and writing meta kernels + # only for the base operators. + if op_overload in global_decomposition_table["meta"]: + raise RuntimeError( + f"{op_overload} is a CompositeImplicitAutograd op, we shouldn't " + "register meta function for it. Instead, we should let the decomposition run and write " + "meta kernels for the base operators." + ) + elif op_overload.is_view: + # Attempting to register a python meta kernel for a view operator. + # We shouldn't do this, because the output will report as not having aliased storages. + # All view ops have meta kernels in C++ today, so we should use those instead. + pass + elif ( + op_overload.name() + in { + "aten::empty_strided", # causing infinite recursion, test_meta.py + "aten::clone", # causing infinite recursion + "aten::_to_copy", # causing infinite recursion, test_serialization.py -k test_tensor_subclass_getstate_overwrite # noqa: B950 + "aten::copy_", # Exception not raised, test_torch.py -k test_storage_meta_errors_cpu_int64 # noqa: B950 + "aten::constant_pad_nd", # requires_grad mismatch, test_ops.py -k test_fake_crossref_backward_amp_istft_cuda_float32 # noqa: B950 + "aten::rot90", # requires_grad mismatch! test_ops.py -k test_fake_crossref_backward_amp_rot90_cuda_float32 # noqa: B950 + "aten::as_strided_scatter", # requires_grad mismatch, test_ops.py -k test_fake_crossref_backward_no_amp_as_strided_scatter_cuda_float32 # noqa: B950 + } + ): + pass + else: + if "mkldnn::" in op_overload.name(): + _meta_lib_dont_use_me_use_register_meta_for_mkldnn.impl(op_overload, fn) + elif "mkl::" in op_overload.name(): + _meta_lib_dont_use_me_use_register_meta_for_mkl.impl(op_overload, fn) + elif "onednn::" in op_overload.name(): + _meta_lib_dont_use_me_use_register_meta_for_onednn.impl(op_overload, fn) + elif "quantized::" in op_overload.name(): + _meta_lib_dont_use_me_use_register_meta_for_quantized.impl( + op_overload, fn + ) + else: + _meta_lib_dont_use_me_use_register_meta.impl(op_overload, fn) + + +activate_meta() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_namedtensor_internals.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_namedtensor_internals.py new file mode 100644 index 0000000000000000000000000000000000000000..9799578b6c98e804af284fb179be7363ae2a8dee --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_namedtensor_internals.py @@ -0,0 +1,159 @@ +# mypy: allow-untyped-defs +from collections import OrderedDict + + +""" +This file contains helper functions that implement experimental functionality +for named tensors in python. All of these are experimental, unstable, and +subject to change or deletion. +""" + + +def check_serializing_named_tensor(tensor): + if tensor.has_names(): + raise RuntimeError( + "NYI: Named tensors don't support serialization. Please drop " + "names via `tensor = tensor.rename(None)` before serialization." + ) + + +def build_dim_map(tensor): + """Returns a map of { dim: dim_name } where dim is a name if the dim is named + and the dim index otherwise.""" + return OrderedDict( + [(idx if name is None else name, name) for idx, name in enumerate(tensor.names)] + ) + + +def unzip_namedshape(namedshape): + if isinstance(namedshape, OrderedDict): + namedshape = namedshape.items() + if not hasattr(namedshape, "__iter__") and not isinstance(namedshape, tuple): + raise RuntimeError( + f"Expected namedshape to be OrderedDict or iterable of tuples, got: {type(namedshape)}" + ) + if len(namedshape) == 0: + raise RuntimeError("Expected namedshape to non-empty.") + return zip(*namedshape) + + +def namer_api_name(inplace): + if inplace: + return "rename_" + else: + return "rename" + + +def is_ellipsis(item): + return item == Ellipsis or item == "..." + + +def single_ellipsis_index(names, fn_name): + ellipsis_indices = [i for i, name in enumerate(names) if is_ellipsis(name)] + if len(ellipsis_indices) >= 2: + raise RuntimeError( + f"{fn_name}: More than one Ellipsis ('...') found in names (" + f"{names}). This function supports up to one Ellipsis." + ) + if len(ellipsis_indices) == 1: + return ellipsis_indices[0] + return None + + +def expand_single_ellipsis(numel_pre_glob, numel_post_glob, names): + return names[numel_pre_glob : len(names) - numel_post_glob] + + +def replace_ellipsis_by_position(ellipsis_idx, names, tensor_names): + globbed_names = expand_single_ellipsis( + ellipsis_idx, len(names) - ellipsis_idx - 1, tensor_names + ) + return names[:ellipsis_idx] + globbed_names + names[ellipsis_idx + 1 :] + + +def resolve_ellipsis(names, tensor_names, fn_name): + """ + Expands ... inside `names` to be equal to a list of names from `tensor_names`. + """ + ellipsis_idx = single_ellipsis_index(names, fn_name) + if ellipsis_idx is None: + return names + return replace_ellipsis_by_position(ellipsis_idx, names, tensor_names) + + +def update_names_with_list(tensor, names, inplace): + # Special case for tensor.rename(None) + if len(names) == 1 and names[0] is None: + return tensor._update_names(None, inplace) + + return tensor._update_names( + resolve_ellipsis(names, tensor.names, namer_api_name(inplace)), inplace + ) + + +def update_names_with_mapping(tensor, rename_map, inplace): + dim_map = build_dim_map(tensor) + for old_dim in rename_map: + new_dim = rename_map[old_dim] + if old_dim in dim_map: + dim_map[old_dim] = new_dim + else: + raise RuntimeError( + f"{namer_api_name(inplace)}: Tried to rename dim '{old_dim}' to dim " + f"{new_dim} in Tensor[{tensor.names}] but dim '{old_dim}' does not exist" + ) + return tensor._update_names(tuple(dim_map.values()), inplace) + + +def update_names(tensor, names, rename_map, inplace): + """There are two usages: + + tensor.rename(*names) returns a view on tensor with named dims `names`. + `names` must be of length `tensor.dim()`; otherwise, if '...' is in `names`, + then it is expanded greedily to be equal to the corresponding names from + `tensor.names`. + + For example, + ``` + >>> # xdoctest: +SKIP + >>> x = torch.empty(2, 3, 5, 7, names=('N', 'C', 'H', 'W')) + >>> x.rename('...', 'height', 'width').names + ('N', 'C', 'height', 'width') + + >>> # xdoctest: +SKIP + >>> x.rename('batch', '...', 'width').names + ('batch', 'C', 'H', 'width') + + ``` + + tensor.rename(**rename_map) returns a view on tensor that has rename dims + as specified in the mapping `rename_map`. + + For example, + ``` + >>> # xdoctest: +SKIP + >>> x = torch.empty(2, 3, 5, 7, names=('N', 'C', 'H', 'W')) + >>> x.rename(W='width', H='height').names + ('N', 'C', 'height', 'width') + + ``` + + Finally, tensor.rename has an in-place version called tensor.rename_. + """ + has_names = len(names) > 0 + has_rename_pairs = bool(rename_map) + if has_names and has_rename_pairs: + raise RuntimeError( + f"{namer_api_name(inplace)}: This function takes either positional " + f"args or keyword args, but not both. Use tensor.{namer_api_name(inplace)}(*names) " + f"to name dims and tensor.{namer_api_name(inplace)}(**rename_map) to rename " + "dims." + ) + + # Special case for tensor.rename(*[]), which is valid for a 0 dim tensor. + if not has_names and not has_rename_pairs: + return update_names_with_list(tensor, names, inplace) + + if has_names: + return update_names_with_list(tensor, names, inplace) + return update_names_with_mapping(tensor, rename_map, inplace) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_ops.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_ops.py new file mode 100644 index 0000000000000000000000000000000000000000..134ac61c278bbe69429fac7a3962656fee1d7920 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_ops.py @@ -0,0 +1,1449 @@ +# mypy: allow-untyped-defs +import abc +import contextlib +import ctypes +import importlib +import inspect +import sys +import types +from collections.abc import Callable, Iterator +from functools import cached_property +from typing import Any, ClassVar, Concatenate, final, Generic, TYPE_CHECKING +from typing_extensions import ParamSpec, TypeVar + +import torch +import torch.utils._pytree as pytree +from torch import _utils_internal +from torch._C import _dispatch_is_included_in_alias as is_included_in_alias, DispatchKey +from torch._functorch.pyfunctorch import dispatch_functorch, TransformType +from torch.utils._python_dispatch import TorchDispatchMode + + +if TYPE_CHECKING: + from torch._subclasses.functional_tensor import BaseFunctionalizeAPI + + +_T = TypeVar("_T", default=Any) +_P = ParamSpec("_P", default=...) + + +# Query `hasattr` only once. +_SET_GLOBAL_FLAGS = hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags") + + +@contextlib.contextmanager +def dl_open_guard(): + """ + Context manager to set the RTLD_GLOBAL dynamic linker flag while we open a + shared library to load custom operators. + """ + if not _SET_GLOBAL_FLAGS: + yield + return + old_flags = sys.getdlopenflags() + sys.setdlopenflags(old_flags | ctypes.RTLD_GLOBAL) + try: + yield + finally: + sys.setdlopenflags(old_flags) + + +class OperatorBase: + """ + Base class for OpOverload (which represents C++ ATen operators) and HigherOrderOperator + (which represents Python-only operators that are unrepresentable in TorchScript). + """ + + def __init__(self): + # The dispatch cache precomputes a mapping of dispatch key that the + # dispatcher wants to dispatch to, to an actual implementation of the + # dispatch key. Confusingly, the actual implementation could *also* be a + # dispatch key, but in this case, this refers to the C++ kernel that + # was registered to some dispatch key. Aliases are permitted in the + # latter but not the former; for example, you might lookup the + # entry for AutogradCPU, and this maps you to the Autograd key for + # the generic autograd kernel that works for all devices. Since this + # is the Python dispatcher, you can also put an arbitrary Python + # callable to call instead. This handler gets precisely the + # args/kwargs that the operator was __call__'ed with. + # NB: This name is hard-coded in torch/csrc/autograd/python_variable.cpp + # for use with OpOverload; cache lookup is done entirely from C++ + # for speed. + # TODO: The cache is NOT currently used by HigherOrderOperator, but it should! + self._dispatch_cache: dict[DispatchKey, DispatchKey | Callable[..., Any]] = {} + + # This table allows you to override the behavior of a particular + # dispatch key to call a custom Python function, rather than the + # ordinary C++ configured behavior. This is the raison d'etre of # codespell:ignore + # Python dispatcher: to let you program the dispatcher from Python + # in case you need something unusual, and don't want to clobber + # the existing registrations using the Python operator registration + # API. + self.py_kernels: dict[DispatchKey, Callable[..., Any]] = {} + + # This table allows you to override the behavior of a particular + # operator for a particular TorchDispatchMode. In practice, + # we are using this mostly for ProxyTensorMode. Modes can be + # thought of as an open world extension of dispatch keys, so it + # makes sense that you should be able to register them, the same + # way you can register dispatch keys. + self.python_key_table: dict[ + type[TorchDispatchMode | torch.Tensor], Callable[..., Any] + ] = {} + + # This table allows you to override the behavior of functorch + # transformations. NB: this currently only does something for + # HigherOrderOperator + self.functorch_table = {} + + def __call__(self, *args, **kwargs): + raise NotImplementedError + + def has_kernel_for_dispatch_key(self, k): + return k in self.py_kernels + + def has_kernel_for_any_dispatch_key(self, ks): + for k in self.py_kernels: + if not torch._C._dispatch_is_alias_key(k) and ks.has(k): + return True + return False + + def py_impl( + self, + k: type[TorchDispatchMode] | type[torch.Tensor] | TransformType | DispatchKey, + ) -> Callable[[Callable[_P, _T]], Callable[_P, _T]]: + def inner(fn: Callable[_P, _T]) -> Callable[_P, _T]: + if inspect.isclass(k) and ( + issubclass(k, TorchDispatchMode) or issubclass(k, torch.Tensor) + ): + assert k not in self.python_key_table + # TODO(voz): Should we replace setting DispatchKey.Python entirely with setting mode keys? + self.python_key_table[k] = fn + self._dispatch_cache.clear() + return fn + + if isinstance(k, TransformType): + assert k not in self.functorch_table + self.functorch_table[k] = fn + return fn + + assert isinstance(k, DispatchKey) + assert k != DispatchKey.Python, ( + "Please register a mode for the DispatchKey.Python key instead." + ) + + if k in self.py_kernels: + raise RuntimeError( + f"Trying to override a python impl for {k} on operator {self.name()}" + ) + self.py_kernels[k] = fn + self._dispatch_cache.clear() + return fn + + return inner + + # Registers an implementation to all **3** variants of functionalization that we have: + # - DispatchKey.Functionalize + # - functorch.TransformType.Functionalize + # - FunctionalTensorMode + # Example: + # @py_functionalize_impl + # def functionalize_rule(ctx, inner_f, *args): + # args_unwrapped = ctx.unwrap_tensors(args) + # with ctx.redispatch_to_next(): + # out = ctx.functionalize(inner_f)(*args_unwrapped) + # return ctx.wrap_tensors(out) + def py_functionalize_impl( + self, fn: Callable[Concatenate["BaseFunctionalizeAPI", _P], _T] + ) -> Callable[Concatenate["BaseFunctionalizeAPI", _P], _T]: + from torch._subclasses.functional_tensor import ( + CppFunctionalizeAPI, + FunctionalTensorMode, + FunctorchFunctionalizeAPI, + PythonFunctionalizeAPI, + ) + + # Construct our three flavors of functionalization, + # each of which have slightly different wrap/unwrap/redispatch policies + def functionalize_dk_fn(*args: _P.args, **kwargs: _P.kwargs) -> _T: + return fn(CppFunctionalizeAPI(), *args, **kwargs) + + def functionalize_dispatch_mode_fn( + mode: FunctionalTensorMode | None, *args: _P.args, **kwargs: _P.kwargs + ) -> _T: + return fn(PythonFunctionalizeAPI(mode), *args, **kwargs) + + def functionalize_functorch_fn( + interpreter, *args: _P.args, **kwargs: _P.kwargs + ) -> _T: + return fn(FunctorchFunctionalizeAPI(interpreter), *args, **kwargs) + + self.py_impl(DispatchKey.Functionalize)(functionalize_dk_fn) + self.py_impl(FunctionalTensorMode)(functionalize_dispatch_mode_fn) + self.py_impl(TransformType.Functionalize)(functionalize_functorch_fn) + + return fn + + def name(self): + raise NotImplementedError + + +# Equivalent to computeDispatchTableEntryWithDebug +def resolve_key(op: OperatorBase, k: DispatchKey): # type: ignore[valid-type] + # 1. (Direct) operator registration + if op.has_kernel_for_dispatch_key(k): + return k + # 2.1 Use CompositeExplicitAutogradNonFunctional kernel if available + cand = DispatchKey.CompositeExplicitAutogradNonFunctional + if ( + k == DispatchKey.Undefined or is_included_in_alias(k, cand) + ) and op.has_kernel_for_dispatch_key(cand): + return cand + # 2.2 Use CompositeExplicitAutograd kernel if available + cand = DispatchKey.CompositeExplicitAutograd + if ( + k == DispatchKey.Undefined or is_included_in_alias(k, cand) + ) and op.has_kernel_for_dispatch_key(cand): + return cand + has_backend_kernel = op.has_kernel_for_any_dispatch_key( + torch._C._dispatch_get_backend_keyset_from_autograd(k) + ) or op.has_kernel_for_dispatch_key(DispatchKey.CompositeExplicitAutograd) + # 2.3. Use CompositeImplicitAutograd kernel if available + cand = DispatchKey.CompositeImplicitAutogradNestedTensor + if ( + (k != DispatchKey.Undefined and is_included_in_alias(k, cand)) + and op.has_kernel_for_dispatch_key(cand) + and not has_backend_kernel + ): + return cand + cand = DispatchKey.CompositeImplicitAutograd + if ( + k == DispatchKey.Undefined or is_included_in_alias(k, cand) + ) and op.has_kernel_for_dispatch_key(cand): + if k == DispatchKey.AutogradOther and op.has_kernel_for_any_dispatch_key( + torch._C._dispatch_autogradother_backends + ): + raise RuntimeError("ambiguous autogradother kernel") + elif not has_backend_kernel: + return cand + # 2.4. For autograd backend keys, use kernel from DispatchKey::Autograd if available + cand = DispatchKey.Autograd + if is_included_in_alias(k, cand) and op.has_kernel_for_dispatch_key(cand): + return cand + # 2.5 Use kernel from DispatchKey::FuncTorchBatchedDecomposition if available + cand = DispatchKey.FuncTorchBatchedDecomposition + if is_included_in_alias(k, cand) and op.has_kernel_for_dispatch_key(cand): + return cand + # Backend fallback + if torch._C._dispatch_has_backend_fallback(k): + # The dispatch key itself will implicitly route to backend fallback. + # This is probably not great for the pure Python implementation. + return k + raise NotImplementedError(f"could not find kernel for {op} at dispatch key {k}") + + +_higher_order_ops: dict[str, "HigherOrderOperator"] = {} + +_HIGHER_ORDER_OP_DEFAULT_FALLTHROUGH_DISPATCH_KEYS = [ + DispatchKey.PythonDispatcher, # type: ignore[attr-defined] + DispatchKey.PythonTLSSnapshot, # type: ignore[attr-defined] + DispatchKey.ADInplaceOrView, + DispatchKey.BackendSelect, + DispatchKey.AutocastCPU, # type: ignore[attr-defined] + DispatchKey.AutocastCUDA, # type: ignore[attr-defined] + DispatchKey.AutocastXPU, # type: ignore[attr-defined] +] + + +class HigherOrderOperator(OperatorBase, abc.ABC): + # The HigherOrderOperator will appear as torch.ops.higher_order.{name} + # + # If you're creating a new HigherOrderOperator, please do not change the + # default. Adding operators to the global torch.ops namespace is a bad + # practice due to name collisions. + def __init__(self, name, *, cacheable=False): + super().__init__() + if type(self) is HigherOrderOperator: + raise RuntimeError( + "Direct instantiation of HigherOrderOperator is not allowed. Please subclass it." + ) + self._name = name + + # Make _OPNamespace not scream, this whole name based association needs a good hard look + self.__name__ = name + _higher_order_ops[name] = self + self._ns = "higher_order" + self.__module__ = "torch.ops.higher_order" + self._cacheable = cacheable + + self.non_fallthrough_keys = torch._C._dispatch_keyset_full() + + for dispatch_key in _HIGHER_ORDER_OP_DEFAULT_FALLTHROUGH_DISPATCH_KEYS: + self.fallthrough(dispatch_key) + + # [NOTE] We have to register pre-dispatch key implementation + # because sometimes HOP use aot-dispatch tracing to detect certain + # mutations. This is problematic when we are functionalizing HOP + # during pre-dispatch because when the inner tracer starts, it will see + # that PreDispatch key is still active. In that case, we just redispatch + # it to next key. This is only safe to do when PreDispatch key stack has no + # active modes. + + def py_impl( + self, + k: type[TorchDispatchMode] | type[torch.Tensor] | TransformType | DispatchKey, + ) -> Callable[[Callable[_P, _T]], Callable[_P, _T]]: + if isinstance(k, DispatchKey) and not self.non_fallthrough_keys.has(k): + self.non_fallthrough_keys = self.non_fallthrough_keys.add(k) + return super().py_impl(k) + + def py_autograd_impl( + self, + fn: Callable[_P, _T], + ) -> Callable[_P, _T]: + def maybe_run_autograd(*args: _P.args, **kwargs: _P.kwargs) -> _T: + if not torch.is_grad_enabled() or pytree.tree_all_only( + torch.Tensor, + lambda t: not t.requires_grad, # type: ignore[union-attr] + (*args, kwargs), + ): + with torch._C._AutoDispatchBelowAutograd(): + return self(*args, **kwargs) + + from torch._higher_order_ops.utils import _has_gen_schema + + if _has_gen_schema(self): + schema = self.gen_schema(*args, **kwargs) + if any(arg.is_write for arg in schema.arguments): + raise RuntimeError( + f"The {self.name()} HigherOrderOperator does not currently support training " + "with in-place input or buffer mutations " + "If you require this feature, please submit an issue to PyTorch. " + "Alternatively, consider creating your own custom autograd.Function. " + ) + + return fn(*args, **kwargs) + + self.py_impl(DispatchKey.Autograd)(maybe_run_autograd) + + return fn + + @property + def namespace(self): + return self._ns + + @final + def cacheable(self) -> bool: + from torch._functorch.autograd_function import AutogradFunctionApply + + return ( + self._cacheable + or f"{self.__module__}.{self.__name__}" + in torch._inductor.config.unsafe_marked_cacheable_functions + or ( + isinstance(self, AutogradFunctionApply) + and torch._functorch.config.autograd_cache_allow_custom_autograd_functions + ) + ) + + def fallthrough(self, dispatch_key): + self.non_fallthrough_keys = self.non_fallthrough_keys.remove(dispatch_key) + + # Use positional-only argument to avoid naming collide with custom ops arguments + # that are named "self". + def dispatch(self, /, dispatch_key, *args, **kwargs): + from torch.utils._python_dispatch import _get_current_dispatch_mode + + if dispatch_key in self._dispatch_cache: + kernel = self._dispatch_cache[dispatch_key] + assert not isinstance(kernel, DispatchKey) + return kernel(*args, **kwargs) + + if dispatch_key == DispatchKey.FuncTorchDynamicLayerFrontMode: + return dispatch_functorch(self, args, kwargs) + + if dispatch_key == DispatchKey.Python: + # Keep the following 1:1 with handle_torch_function_no_python_arg_parser + # in torch/csrc/utils/python_arg_parser.cpp + + overloaded_args_list = [] + + def has_python_key(tensor): + return torch._C._dispatch_keys(tensor).has("Python") + + def check_overloaded(arg): + if isinstance(arg, torch.Tensor) and has_python_key(arg): + overloaded_args_list.append(arg) + + for arg in (*args, *kwargs.values()): + check_overloaded(arg) + if isinstance(arg, (list, tuple)): + for a in arg: + check_overloaded(a) + + overloaded_args = tuple(overloaded_args_list) + + # Step 1: dispatch on any user TorchDispatchModes + from torch.utils._python_dispatch import _pop_mode_temporarily + + curr_mode = _get_current_dispatch_mode() + if curr_mode is not None: + if type(curr_mode) in self.python_key_table: + handler = self.python_key_table[type(curr_mode)] + with _pop_mode_temporarily() as mode: + # "natural" calling convention: (mode, *args, **kwargs) + # TODO(rzou): we should support torch_dispatch calling convention too. + result = handler(mode, *args, **kwargs) + else: + if curr_mode.supports_higher_order_operators: + with _pop_mode_temporarily() as mode: + return curr_mode.__torch_dispatch__(self, [], args, kwargs) + else: + raise NotImplementedError( + f"There was no rule registered for HigherOrderOperator {self._name} and mode {curr_mode}." + f"Hint: set {curr_mode}'s supports_higher_order_operators to True." + f" This causes all higher order operators to pass through {curr_mode}'s __torch_dispatch__," + f" so handle them accordingly by" + f" adding support for HigerOrderOperators (in this case, {self._name}) in" + f" {curr_mode}.__torch_dispatch__ or" + f" returning NotImplemented when not supported." + ) + if result is not NotImplemented: + return result + + # Step 2: dispatch on any subclasses + for arg in overloaded_args: + subclass_type = type(arg) + if ( + subclass_type.__torch_dispatch__ + is torch._C._disabled_torch_dispatch_impl + ): + continue + + # In some case, people are using FakeTensor without a FakeTensorMode. + # For example, some sparse arch model has a mix of FakeTensor and real + # tensor for weights during lowering, and ppl tends to run eager evaluation + # on the model without setting up the FakeTensorMode. + # In this case, we pull FakeTensorMode impl. + if subclass_type is torch._subclasses.fake_tensor.FakeTensor: + subclass_type = torch._subclasses.fake_tensor.FakeTensorMode # type: ignore[assignment] + handler = self.python_key_table[subclass_type] + result = handler(arg.fake_mode, *args, **kwargs) # type: ignore[attr-defined] + return result + + if subclass_type in self.python_key_table: + handler = self.python_key_table[subclass_type] + # "natural" calling convention: (*args, **kwargs) + # TODO(rzou): we should support torch_dispatch calling convention too. + result = handler(*args, **kwargs) + else: + raise NotImplementedError( + f"There was no rule registered for HOP {self._name} and subclass {subclass_type}. " + f"We recommend filing an issue." + ) + if result is not NotImplemented: + return result + + # All handlers returned NotImplemented + raise TypeError( + f"HigherOrderOperator '{self._name}' is not supported for the given input types. " + f"This typically happens when using custom tensor types or dispatch modes that don't " + f"have implementations for this operation.\n\n" + f"Current mode: {curr_mode}\n" + f"Input types: {[type(a).__name__ for a in overloaded_args]}\n\n" + f"To fix this, can add support for '{self._name}' in {curr_mode}'s __torch_dispatch__\n" + ) + + functionality_key = torch._C._to_functionality_key(dispatch_key) # type: ignore[attr-defined] + if functionality_key == DispatchKey.PreDispatch: + from torch.utils._python_dispatch import _pop_mode_temporarily + + # The check for Python in the exclude set is so we properly respect `with no_dispatch()` + # calls inside of a mode. + if ( + _len_torch_dispatch_stack_pre_dispatch() > 0 + ) and not torch._C._dispatch_tls_is_dispatch_key_excluded( + DispatchKey.Python + ): + curr_mode = _get_current_dispatch_mode_pre_dispatch() + assert curr_mode is not None, ( + "Illegal invocation of dispatch on DispatchKey.PreDispatch without a mode." + ) + assert type(curr_mode) in self.python_key_table, ( + f"Current active mode {curr_mode} not registered" + ) + handler = self.python_key_table[type(curr_mode)] + with _pop_mode_temporarily(functionality_key) as mode: + return handler(mode, *args, **kwargs) + + final_key = resolve_key(self, dispatch_key) + + # This can current fail due to backend fallbacks. You just have to + # register them by hand for HigherOrderOperator. + if final_key not in self.py_kernels: + raise NotImplementedError( + f"could not find kernel for HigherOrderOperator {self._name} " + f"at dispatch key {final_key} (resolved from {dispatch_key})" + ) + + # [NOTE] We shouldn't cache PreDispatch kernel here because depending + # on what modes are active, predispatch behaviour is different. + # Also we do same thing for normal ops: + # See Note [Not Caching Per-Dispatch-Key Mode Handlers] + if dispatch_key != DispatchKey.PreDispatch: + self._dispatch_cache[dispatch_key] = self.py_kernels[final_key] + kernel = self.py_kernels[final_key] + # It's illegal to register DispatchKey to py_kernels, since there's no + # C++ kernel to call into + assert not isinstance(kernel, DispatchKey) + return kernel(*args, **kwargs) + + @abc.abstractmethod + def __call__(self, /, *args, **kwargs): + flat_args = _to_flat_tuple(args, kwargs) + if torch.overrides.has_torch_function(flat_args): + return torch.overrides.handle_torch_function( + self, flat_args, *args, **kwargs + ) + + dispatch_key_set = _compute_keyset(args, kwargs, self.non_fallthrough_keys) + return self.dispatch(dispatch_key_set.highestPriorityTypeId(), *args, **kwargs) + + # NOTE [HigherOrderOperator Schema] + # Each invocation of a HigherOrderOperator (hop) should have its own schema because + # the subgraphs and the arguments can be different even for the same hop. + # + # Each hop should implement its own gen_schema method, which should + # take the same input as the __call__ method and returns a FunctionSchema. + # The schema provides a unified way to check if the hop mutates its inputs, + # which can be useful in implementing optimizations. + # + # If the hop doesn't implement the gen_schema method, + # we expect it to be functional. It should not mutate its inputs and there + # are no input, output aliasing via views or direct referencing. + def gen_schema(self, *args, **kwargs): + raise NotImplementedError( + f"HigherOrderOperator {self._name} does not implement a gen_schema. " + f"This is OK as long as the hop is functional. " + f"e.g. it should not mutate its inputs and there are no input, output aliasing " + f"via views or direct referencing." + ) + + def __str__(self): + return f"{self.name()}" + + def name(self): + return self._name + + # it's a no-op since HigherOrderOperator is immutable and must be unique for a given op. + def __deepcopy__(self, memo=None): + return self + + +def _to_flat_tuple(args, kwargs): + return pytree.arg_tree_leaves(*args, **kwargs) + + +def _compute_keyset(args, kwargs, non_fallthrough_keys): + tensors = _get_tensors(args, kwargs) + return key_extractor(tensors, non_fallthrough_keys) + + +def _get_tensors(args, kwargs): + flat_all = _to_flat_tuple(args, kwargs) + tensor_args = [t for t in flat_all if isinstance(t, torch.Tensor)] + return tuple(tensor_args) + + +# Note - this should maintain identical impl to the C++ dispatcher key extraction logic +# at ATen/core/dispatch/DispatchKeyExtractor.h +def key_extractor(tensors, key_mask): + key_set = torch._C._dispatch_tls_local_include_set() + for tensor in tensors: + key_set = key_set | torch._C._dispatch_keys(tensor) + key_set = key_set - torch._C._dispatch_tls_local_exclude_set() + key_set = key_set & key_mask + return key_set + + +# Mode stack for PreDispatchKey +# it should always have three keys with +# priority given to FunctionalTensorMode and +# then ProxyTorchDispatchMode. It means that +# slot 0 belongs to ProxyTorchDispatchMode and +# slot 1 belongs to FunctionalTensorMode. +# +# SchemaCheckMode is separate from the other 2, +# and is only valid when the stack is empty. +# SchemaCheckMode is for testing purposes, and +# is meant to run in eager mode on concrete inputs, +# checking for incorrect schemas in regards to +# aliasing or mutating ops. +class _ModeStackStateForPreDispatch: + def __init__(self): + self.__infra_modes = [None, None] + self._schema_check_mode = None + + def set(self, index, mode): + assert index < len(self.__infra_modes) + self.__infra_modes[index] = mode + + def get(self, index): + assert index < len(self.__infra_modes) + return self.__infra_modes[index] + + def count(self): + return len([i for i in self.__infra_modes if i is not None]) + int( + self._schema_check_mode is not None + ) + + +_mode_stack_state_for_pre_dispatch = _ModeStackStateForPreDispatch() + + +def unset_mode_pre_dispatch(mode_key, schema_check=False): + current_mode_stack_pre_dispatch = mode_stack_state_for_pre_dispatch() + assert mode_key is None or mode_key in ( + torch._C._TorchDispatchModeKey.PROXY, + torch._C._TorchDispatchModeKey.FUNCTIONAL, + ) + if schema_check: + assert mode_key is None + + def _unset_mode(): + # NOTE: Using `is` rather than `==` to work around slow enum comparison in + # pybind11. + if mode_key is torch._C._TorchDispatchModeKey.PROXY: + current_mode = current_mode_stack_pre_dispatch.get(0) + mode_stack_state_for_pre_dispatch().set(0, None) + return current_mode + elif mode_key is torch._C._TorchDispatchModeKey.FUNCTIONAL: + current_mode = current_mode_stack_pre_dispatch.get(1) + mode_stack_state_for_pre_dispatch().set(1, None) + return current_mode + else: + current_mode = mode_stack_state_for_pre_dispatch()._schema_check_mode + mode_stack_state_for_pre_dispatch()._schema_check_mode = None + return current_mode + + current_mode = _unset_mode() + + new_pre_dispatch_len = _len_torch_dispatch_stack_pre_dispatch() + # When we are unsetting a mode, we need to check if there is + # active mode left on the PreDispatch key. If there is nothing + # active, we need to remove PreDispatch key from local dispatch include + # set. + if new_pre_dispatch_len == 0: + torch._C._dispatch_tls_set_dispatch_key_included(DispatchKey.PreDispatch, False) + + return current_mode + + +def _set_mode_pre_dispatch(mode): + from torch._subclasses.functional_tensor import FunctionalTensorMode + from torch._subclasses.schema_check_mode import SchemaCheckMode + from torch.fx.experimental.proxy_tensor import ProxyTorchDispatchMode + + assert isinstance( + mode, + ( + FunctionalTensorMode, + ProxyTorchDispatchMode, + SchemaCheckMode, + ), + ) + + previous_mode_stack_len = _len_torch_dispatch_stack_pre_dispatch() + if isinstance(mode, SchemaCheckMode): + current_mode = mode_stack_state_for_pre_dispatch()._schema_check_mode + if previous_mode_stack_len > 0: + raise AssertionError( + "SchemaCheckMode for pre-dispatch must be used exclusively, found other modes on the stack" + ) + mode_stack_state_for_pre_dispatch()._schema_check_mode = mode + elif isinstance(mode, FunctionalTensorMode): + current_mode = mode_stack_state_for_pre_dispatch().get(1) + assert current_mode is None + mode_stack_state_for_pre_dispatch().set(1, mode) + else: + current_mode = mode_stack_state_for_pre_dispatch().get(0) + assert current_mode is None + mode_stack_state_for_pre_dispatch().set(0, mode) + + # When we are setting a mode, we need to check if there is + # active mode left on the PreDispatch key. If there was nothing + # active before setting this mode, it means that PreDispatch key + # was turned off. So we need to turn it on again. + if previous_mode_stack_len == 0: + torch._C._dispatch_tls_set_dispatch_key_included(DispatchKey.PreDispatch, True) + + +def _pop_mode_from_pre_dispatch(): + mode_stack = mode_stack_state_for_pre_dispatch() + pre_dispatch_len = _len_torch_dispatch_stack_pre_dispatch() + + if pre_dispatch_len == 0: + raise AssertionError("Trying to pop empty mode stack") + + if mode_stack._schema_check_mode is not None: + return unset_mode_pre_dispatch(None, schema_check=True) + if mode_stack.get(1) is not None: + return unset_mode_pre_dispatch(torch._C._TorchDispatchModeKey.FUNCTIONAL) + if mode_stack.get(0) is not None: + return unset_mode_pre_dispatch(torch._C._TorchDispatchModeKey.PROXY) + + +def _len_torch_dispatch_stack_pre_dispatch(): + return mode_stack_state_for_pre_dispatch().count() + + +def _get_dispatch_mode_pre_dispatch(mode_key): + # NOTE: Using `is` rather than `==` to work around slow enum comparison in pybind11. + if mode_key is torch._C._TorchDispatchModeKey.PROXY: + return mode_stack_state_for_pre_dispatch().get(0) + else: + assert mode_key is torch._C._TorchDispatchModeKey.FUNCTIONAL + return mode_stack_state_for_pre_dispatch().get(1) + + +def _get_current_dispatch_mode_pre_dispatch(): + if mode_stack_state_for_pre_dispatch()._schema_check_mode is not None: + return mode_stack_state_for_pre_dispatch()._schema_check_mode + else: + stack_len = mode_stack_state_for_pre_dispatch().count() + if stack_len == 2: + return mode_stack_state_for_pre_dispatch().get(1) + if stack_len == 1: + return ( + mode_stack_state_for_pre_dispatch().get(1) + if mode_stack_state_for_pre_dispatch().get(1) is not None + else mode_stack_state_for_pre_dispatch().get(0) + ) + return None + + +def mode_stack_state_for_pre_dispatch(): + global _mode_stack_state_for_pre_dispatch + return _mode_stack_state_for_pre_dispatch + + +cached_ops: set["OpOverload"] = set() + + +def add_cached_op(op_overload): + global cached_ops + cached_ops.add(op_overload) + + +def reset_cached_ops(): + global cached_ops + cached_ops.clear() + + +def get_cached_ops(): + global cached_ops + return cached_ops + + +# Each OpOverload object contains pointer to a specific operator overload, a pointer to the parent `OpOverloadPacket` object. +# You can obtain an OpOverload object through attribute query on OpOverloadPacket. +class OpOverload(OperatorBase, Generic[_P, _T]): + def __init__( + self, + overloadpacket: "OpOverloadPacket", + op: Callable[_P, _T], + op_dk: Callable[Concatenate[DispatchKey, _P], _T], + schema: torch._C.FunctionSchema, + tags: list[Any], + ) -> None: + super().__init__() + self._op = op + self._op_dk = op_dk + self._schema = schema + self._overloadpacket = overloadpacket + self._tags = tags + self._overloadname = ( + "default" if schema.overload_name == "" else schema.overload_name + ) + if tags: + self._nondeterministic_seeded = torch.Tag.nondeterministic_seeded in tags + self._name = self._schema.name + if schema.overload_name: + self._name += "." + schema.overload_name + self.__name__ = f"{self._schema.name.split('::')[1]}.{self._overloadname}" + self.__module__ = overloadpacket.__module__ + op.__module__ = overloadpacket.__module__ + self.__qualname__ = self._name + self.__annotations__ = {} + + # If the OpOverload was constructed from a Library.def in Python. + self._defined_in_python = self.__qualname__ in torch.library._defs + + # Logic replicated from aten/src/ATen/native/MathBitsFallback.h + is_write = None + for a in self._schema.arguments: # pyrefly: ignore # bad-assignment + if a.alias_info is None: + continue + if is_write is None: + is_write = a.alias_info.is_write + else: + # We will conservatively call mixed mutable/non-mutable + # aliased inputs as NOT a view + is_write = a.alias_info.is_write or is_write + self.is_view = is_write is not None and not is_write + + @cached_property + def _namespace(self) -> str: + return self._schema.name.split("::", maxsplit=1)[0] + + @cached_property + def _opname(self) -> str: + return self._schema.name.split("::", maxsplit=1)[1] + + @cached_property + def _handle(self) -> torch._C._DispatchOperatorHandle: + return torch._C._dispatch_find_schema_or_throw( + self._schema.name, self._schema.overload_name + ) + + # it's a no-op since OpOverload object is immutable and must be unique for a given op overload. + def __deepcopy__(self, memo=None): + return self + + def __repr__(self): + return f"" + + # Use positional-only argument to avoid naming collision with aten ops arguments + # that are named "self". This way, all the aten ops can be called by kwargs. + def __call__(self, /, *args: _P.args, **kwargs: _P.kwargs) -> _T: + return self._op(*args, **kwargs) + + # Use positional-only argument to avoid naming collision with aten ops arguments + # that are named "self". This way, all the aten ops can be called by kwargs. + def redispatch( + self, /, keyset: torch._C.DispatchKeySet, *args: _P.args, **kwargs: _P.kwargs + ) -> _T: + return self._handle.redispatch_boxed(keyset, *args, **kwargs) # type: ignore[return-value] + + def __hash__(self): + return hash(self._op) + + # `my_namespace.my_op_name.overload_name` + def __str__(self): + return "{}.{}.{}".format(*self._schema.name.split("::"), self._overloadname) + + def has_kernel_for_dispatch_key(self, k: DispatchKey) -> bool: + return super().has_kernel_for_dispatch_key( + k + ) or torch._C._dispatch_has_kernel_for_dispatch_key(self.name(), k) + + def has_kernel_for_any_dispatch_key(self, ks: torch._C.DispatchKeySet) -> bool: + return torch._C._dispatch_has_kernel_for_any_dispatch_key( + self.name(), ks + ) or super().has_kernel_for_any_dispatch_key(ks) + + @property + def namespace(self) -> str: + return self._namespace + + def _can_decompose(self) -> bool: + dk = DispatchKey.CompositeImplicitAutograd + return dk in self.py_kernels or torch._C._dispatch_has_kernel_for_dispatch_key( + self.name(), dk + ) + + def decompose(self, *args: _P.args, **kwargs: _P.kwargs) -> _T: + dk = DispatchKey.CompositeImplicitAutograd + if dk in self.py_kernels: + # NB: This branch is not too necessary anymore, because we can + # apply Python CompositeImplicitAutograd *before* tracing + # using Python dispatcher (also taking advantage of the autograd + # formula). But it's included for completeness + return self.py_kernels[dk](*args, **kwargs) + elif torch._C._dispatch_has_kernel_for_dispatch_key(self.name(), dk): + return self._op_dk(dk, *args, **kwargs) + else: + return NotImplemented # pyrefly: ignore [bad-return] + + # Remove a dispatch key from the dispatch cache. This will force it to get + # recomputed the next time. Does nothing + # WARNING: if you register a dispatch key to py_kernels of an OpOverload, + # calling _del_dispatch on that key is NOT sufficient to apply your change, + # because a single registration may affect MULTIPLE dispatch keys (e.g., + # registering Autograd affects AutogradCPU). del_dispatch is to be used + # only if you are specifically modifying how get_dispatch handles a + # particular input 'key'. + def _uncache_dispatch(self, key: DispatchKey) -> None: + self._dispatch_cache.pop(key, None) + + # This implements the pre-computation logic for the Python dispatcher. + def _get_dispatch(self, key: DispatchKey) -> DispatchKey | Callable[_P, _T]: + # This is only called upon a cache miss + assert key not in self._dispatch_cache, f"{self} {key}" + + if key == DispatchKey.Python: + if not isinstance(self, TorchBindOpOverload) and not self.python_key_table: + self._dispatch_cache[key] = key + add_cached_op(self) + return key + + def handler(*args: _P.args, **kwargs: _P.kwargs) -> _T: + from torch.utils._python_dispatch import _get_current_dispatch_mode + + # TODO: We also need to handle tensor subclasses here + # TODO(voz): We should walk all the nodes here / turn it into a list, topmode is ok for now. + curr_mode = type(_get_current_dispatch_mode()) + assert curr_mode is not None, ( + "Illegal invocation of dispatch on DispatchKey.Python without a mode." + ) + + if curr_mode not in self.python_key_table: + if isinstance(self, TorchBindOpOverload): + with ( + torch.utils._python_dispatch._pop_mode_temporarily() as mode + ): + return torch._library.utils.handle_dispatch_mode( + mode, self, *args, **kwargs + ) + else: + return self._op_dk(key, *args, **kwargs) + + with torch.utils._python_dispatch._pop_mode_temporarily() as mode: + return self.python_key_table[curr_mode](mode, *args, **kwargs) # type: ignore[index] + + self._dispatch_cache[key] = handler + add_cached_op(self) + return handler + + functionality_key = torch._C._to_functionality_key(key) # type: ignore[attr-defined] + if functionality_key == DispatchKey.PreDispatch: + curr_stack_len = _len_torch_dispatch_stack_pre_dispatch() + # The check for Python in the exclude set is so we properly respect `with no_dispatch()` + # calls inside of a mode. + if ( + curr_stack_len > 0 + and not torch._C._dispatch_tls_is_dispatch_key_excluded( + DispatchKey.Python + ) + ): + + def handler(*args: _P.args, **kwargs: _P.kwargs) -> _T: + @contextlib.contextmanager + def _temporarily_pop_modes_from_pre_dispatch(): + top_mode = _pop_mode_from_pre_dispatch() + try: + yield top_mode + finally: + _set_mode_pre_dispatch(top_mode) + + with _temporarily_pop_modes_from_pre_dispatch() as curr_mode: + return torch._library.utils.handle_dispatch_mode( + curr_mode, self, *args, **kwargs + ) + + # Note [Not Caching Per-Dispatch-Key Mode Handlers] + # Note that we're not caching this handler. There isn't really a point, since the slow bit + # is the handler itself (in python). + # Also, not caching means that we don't have to reset the cache when any existing + # modes go out of scope (which in of itself takes time to loop through all operators). + return handler + + final_key = resolve_key(self, key) + + # See Note [Not Caching Per-Dispatch-Key Mode Handlers] + cache_result = key != DispatchKey.PreDispatch + + # TODO: We could potentially have lots of debugging wrappers against + # dispatch keys; design some general registration mechanism instead of + # having if statement for each of them + if key == DispatchKey.Functionalize: + import torch._dispatch.python as pydispatch + + if pydispatch.CROSSREF_FUNCTIONALIZE: + handler = pydispatch.make_crossref_functionalize(self, final_key) # type: ignore[assignment] + if cache_result: + self._dispatch_cache[key] = handler + add_cached_op(self) + return handler + + r = self.py_kernels.get(final_key, final_key) + if cache_result: + self._dispatch_cache[key] = r # pyrefly: ignore [unsupported-operation] + add_cached_op(self) + return r # pyrefly: ignore [bad-return] + + def name(self): + return self._name + + @property + def overloadpacket(self): + return self._overloadpacket + + @property + def op(self): + return self._op + + @property + def tags(self): + return self._tags + + # TODO: add more methods to expose information about input and output arguments + + +# TorchBindOpOverload are those custom ops which have at least one overload's +# schema consists of torch.ScriptObject (i.e. custom class) input. +# TorchBindOpOverload will skip C++ dispatcher and purely dispatched in python +# when its inputs contain FakeScriptObject in a similar way as higher order ops. +class TorchBindOpOverload(OpOverload[_P, _T]): + def _fallthrough_keys(self) -> list[DispatchKey]: + # TODO: we should be calling the fallback for these, but a fallthrough is almost close + # enough to the fallback in most cases that we care about. + _DEFAULT_FALLTHROUGH_KEYS = [ + DispatchKey.Autograd, + DispatchKey.AutogradCPU, + DispatchKey.AutogradCUDA, + DispatchKey.ADInplaceOrView, + DispatchKey.BackendSelect, + DispatchKey.PythonTLSSnapshot, + DispatchKey.PythonDispatcher, + DispatchKey.Functionalize, + ] + + def _may_use_fallthrough_instead_of_fallback(key: DispatchKey): + if torch._C._dispatch_has_kernel_for_dispatch_key(self.name(), key): + return torch._C._dispatch_kernel_for_dispatch_key_is_fallthrough( + self.name(), key + ) + + return ( + key not in self.py_kernels + or self.py_kernels[key] is torch.library.fallthrough_kernel + ) + + return [ + key + for key in _DEFAULT_FALLTHROUGH_KEYS + if _may_use_fallthrough_instead_of_fallback(key) + ] + + # Use positional-only argument to avoid naming collision with aten ops arguments + # that are named "self". This way, all the aten ops can be called by kwargs. + def __call__(self, /, *args: _P.args, **kwargs: _P.kwargs) -> _T: + if _must_dispatch_in_python(args, kwargs): + # When any inputs are FakeScriptObject, we need to + # skip c++ dispatcher and dispatch in python through _get_dispatch of python_dispatcher + # because C++ dispatcher will check the schema and cannot recognize FakeScriptObject. + return self._dispatch_in_python(self._fallthrough_keys(), *args, **kwargs) + return self._op(*args, **kwargs) + + def _dispatch_in_python( + self, fallthrough_keys: list[DispatchKey], *args: _P.args, **kwargs: _P.kwargs + ) -> _T: + non_fallthrough_keys = torch._C._dispatch_keyset_full() + for key in fallthrough_keys: + non_fallthrough_keys = non_fallthrough_keys.remove(key) + + dispatch_key_set = _compute_keyset(args, kwargs, non_fallthrough_keys) + dispatch_key = dispatch_key_set.highestPriorityTypeId() + + handler = ( + self._get_dispatch(dispatch_key) + if dispatch_key not in self._dispatch_cache + else self._dispatch_cache[dispatch_key] + ) + + if isinstance(handler, DispatchKey): + # fallthrough keys can be registered at runtime via torch.library.impl + # so need to add it to fallthrough_keys and re-dispatch. + if torch._C._dispatch_kernel_for_dispatch_key_is_fallthrough( + self.name(), dispatch_key + ): + return self._dispatch_in_python( + fallthrough_keys + [dispatch_key], + *args, + **kwargs, + ) + + raise RuntimeError( + f"Torchbind op {self} received a FakeScriptObject input when dispatching {handler}." + f" but no python implementation is found." + f" Please file an issue on this when you encounter this error." + f" This error can happen when you export or compile the model." + f" It can still happen even if a C++ implementation for {dispatch_key}. " + f" has been registered. That's because FakeScriptObject purely lives in python and cannot work " + f" with a C++ implementation." + ) + + assert isinstance(handler, Callable) # type: ignore[arg-type] + return handler(*args, **kwargs) # pyrefly: ignore [bad-return] + + +def _must_dispatch_in_python(args, kwargs): + return pytree.tree_any( + lambda obj: isinstance( + obj, torch._library.fake_class_registry.FakeScriptObject + ), + (args, kwargs), + ) + + +def _has_script_object_arg(schema: torch.FunctionSchema) -> bool: + return any(isinstance(arg.type, torch.ClassType) for arg in schema.arguments) + + +# OpOverloadPacket class contains pointer to a base unresolved operator that doesn't correspond to a specific operator +# You can obtain an OpOverload object through attribute query. +class OpOverloadPacket(Generic[_P, _T]): + __file__: ClassVar[str] = "torch.ops" + + def __init__( + self, + qualified_op_name: str, + op_name: str, + op: Callable[_P, _T], + overload_names: list[str], + ) -> None: + # These attributes are accessible on the object through the properties + # defined below but are immutable + self._qualified_op_name = qualified_op_name + self.__name__ = op_name + self._op = op + self._overload_names = overload_names + self._dir: list[str] = [] + self._has_torchbind_op_overload = any( + _has_script_object_arg(schema) for schema in self._schemas.values() + ) + + # it's a no-op since OpOverloadPacket object is immutable and must be unique for a given op. + def __deepcopy__(self, memo=None): + return self + + def __repr__(self): + return "".format( + *self._qualified_op_name.split("::") + ) + + def __hash__(self): + return hash(self._op) + + def __str__(self): + return "{}.{}".format(*self._qualified_op_name.split("::")) + + @property + def op(self): + return self._op + + @property + def _schemas(self): + return { + overload_name: torch._C._get_schema(self._qualified_op_name, overload_name) + for overload_name in self._overload_names + } + + def __getattr__(self, key: str) -> OpOverload[_P, _T]: + # ensure that query for dunder attributes that does not exist on + # opoverloadpacket but instead exists on the self._op object does not unnecessarily call + # `_get_operation_overload` (which is an expensive operation). + # This is done to prevent any potential slowdown. This list can be extended + # if there exists other attributes like `__name__` that only exist on self._op and not on the + # opoverloadpacket. + # This is ok since we are guaranteed that an overload name for an aten op can't start with '__' + try: + if key.startswith("__"): + return getattr(self._op, key) + except AttributeError: + # for consistency because it seems weird to + # throw an attribute error with a message containing + # an object name different from the one the attribute + # query was performed on. + raise AttributeError( + f"'{str(self)}' can't have an overload name beginning with '__' and the " + f"underlying op {str(self._op)} has no attribute {key} either." + ) from None + + try: + # This is ok since we are guaranteed that an overload name for an aten op can't be 'default' + use_key = "" if key == "default" else key + # TODO: disallow access to overloads registered by JIT + op_dk_tags = torch._C._get_operation_overload( + self._qualified_op_name, use_key + ) + if op_dk_tags is None: + raise AttributeError( + f"The underlying op of '{str(self)}' has no overload name '{key}'" + ) + + op_, op_dk_, tags = op_dk_tags + schema = torch._C._get_schema(self._qualified_op_name, use_key) + overload: OpOverload[_P, _T] = ( + OpOverload(self, op_, op_dk_, schema, tags) + if not _has_script_object_arg(schema) + else TorchBindOpOverload(self, op_, op_dk_, schema, tags) + ) + # cache the overload object + setattr(self, key, overload) + self._dir.append(key) + return overload + except RuntimeError: + raise AttributeError( + f"The underlying op of '{str(self)}' has no overload name '{key}'" + ) from None + + def __iter__(self) -> Iterator[str]: + return iter(self._dir) + + # Use positional-only argument to avoid naming collision with aten ops arguments + # that are named "self". This way, all the aten ops can be called by kwargs. + def __call__(self, /, *args: _P.args, **kwargs: _P.kwargs) -> _T: + # overloading __call__ to ensure torch.ops.foo.bar() + # is still callable from JIT + # We save the function ptr as the `op` attribute on + # OpOverloadPacket to access it here. + + # Directly calling OverloadPacket goes into C++, which will check + # the schema and cause an error for torchbind op when inputs consist of FakeScriptObject so we + # intercept it here and call TorchBindOpverload instead. + if self._has_torchbind_op_overload and _must_dispatch_in_python(args, kwargs): + # pyrefly: ignore [bad-argument-type] + return _call_overload_packet_from_python(self, *args, **kwargs) + return self._op(*args, **kwargs) + + # TODO: use this to make a __dir__ + def overloads(self): + return [n if n else "default" for n in self._overload_names] + + +# Note - this mirrors the logic of the cpp_function defined in jit/python/init.cpp +# _jit_get_operations, which calls _get_operation_for_overload_or_packet. +def _call_overload_packet_from_python( + op: OpOverloadPacket[_P, _T], *args: _P.args, **kwargs: _P.kwargs +) -> _T: + # Reuse the torch function handling logic in cpp + torch_function_called, ret = torch._C._maybe_call_torch_function_for_op_packet( + op, *args, **kwargs + ) + + if torch_function_called: + return ret + + # The following mirrors getOpWithStack. + # In cpp, we do a schema matching for the arguments, and call ToIValue to + # to check whether the arguments are valid. But need to do similar things here + # and check the schema whether the FakeScriptObject is the corresponding fake class + # of the actual class used in schema. + exceptions = {} + found_op = None + for overload_name in op.overloads(): + op_overload = getattr(op, overload_name) + try: + _ = torch._C._check_schema_allow_fake_script_object( + op_overload._schema, *args, **kwargs + ) + found_op = op_overload + break + except RuntimeError as e: + exceptions[overload_name] = e + + if found_op: + return found_op(*args, **kwargs) + + err_msg = ( + f"Fail to match any TorchBindOverload of {op} with following exceptions:\n" + ) + for key, msg in exceptions.items(): + err_msg += f"Overload name {key}:\n {msg}\n" + raise RuntimeError(err_msg) + + +# Resolution of torch.fn is different from torch.ops.aten.fn +# torch.fn uses the Python argparser, matches with the +# appropriate schema, and calls into the unboxed version of the method +# torch.ops.aten.fn resolution is done via the mechanism defined in JIT. +# JIT creates a stack of all the overloads and then tries to match the +# correct one at runtime and always calls into the boxed version of the method +# Autograd codegen creates VariableType, TracerType, +# inplace or view type and python bindings. +# Aten codegen generates tensor methods for the tensor class. + +# _OpNamespace is a subclass of ModuleType because the torch script +# allows attribute lookups on modules only. Since we want torch.ops.foo.bar() +# to work from script, we need to ensure ops and foo are modules + + +class _OpNamespace(types.ModuleType): + """ + An op namespace to dynamically bind Operators into Python. + + Say a user has created a custom Operator called "my_namespace::my_op". To + call this op, the user will write torch.ops.my_namespace.my_op(...). + At startup, this operation will not yet be bound into Python. Instead, the + following sequence of magic tricks will occur: + 1. `torch.ops.my_namespace` will invoke the `__getattr__` magic method + on the `torch.ops` object, which will create a new `_OpNamespace` + object called `my_namespace` and set it as an attribute on the `ops` + object. + 2. `torch.ops.my_namespace.my_op` will then invoke `__getattr__` on + the `my_namespace` object, which will retrieve the operation via + `torch.get_operation`, a function bound from C++, and then in a similar + fashion bind this new object onto the `my_namespace` object. + 3. `torch.ops.my_namespace.my_op(...)` then calls this new operation + and subsequent accesses will incur no further lookup (the namespace and + operation will already exist). + """ + + __file__ = "torch.ops" + + def __init__(self, name: str) -> None: + super().__init__("torch.ops." + name) + self.name = name + self._dir: list[str] = [] + + def __iter__(self) -> Iterator[str]: + return iter(self._dir) + + def __getattr__(self, op_name: str) -> OpOverloadPacket: + if op_name in ("__origin__", "__self__"): + raise AttributeError( + f"Invalid attribute '{op_name}' for '_OpNamespace' '{self.name}'" + ) + + # Get the op `my_namespace::my_op` if available. This will also check + # for overloads and raise an exception if there are more than one. + namespace_name = self.name + qualified_op_name = f"{namespace_name}::{op_name}" + module_name = self.__module__ + "." + namespace_name + + try: + op, overload_names = _get_packet(qualified_op_name, module_name) + if op is None: + raise AttributeError( + f"'_OpNamespace' '{self.name}' object has no attribute '{op_name}'" + ) + except RuntimeError as e: + # Turn this into AttributeError so getattr(obj, key, default) + # works (this is called by TorchScript with __origin__) + raise AttributeError( + f"'_OpNamespace' '{self.name}' object has no attribute '{op_name}'" + ) from e + + op.__module__ = module_name + opoverloadpacket = OpOverloadPacket( + qualified_op_name, op_name, op, overload_names + ) + opoverloadpacket.__module__ = self.__module__ + "." + namespace_name + # cache the opoverloadpacket to ensure that each op corresponds to + # a unique OpOverloadPacket object + setattr(self, op_name, opoverloadpacket) + self._dir.append(op_name) + return opoverloadpacket + + +def _get_packet(qualname, op_module): + op, overload_names = torch._C._jit_get_operation(qualname) + if op is not None: + # let the script frontend know that op is identical to the builtin op + # with qualified_op_name + torch.jit._builtins._register_builtin(op, qualname) + op.__module__ = op_module + return op, overload_names + + +def _refresh_packet(packet): + op, overload_names = _get_packet(packet._qualified_op_name, packet._op.__module__) + assert op is not None + packet._op = op + packet._overload_names = overload_names + + +class _HigherOrderNamespace(types.ModuleType): + __file__ = "torch.ops" + + def __init__(self) -> None: + super().__init__("torch.ops.higher_order") + self._dir: list[str] = [] + + def __iter__(self) -> Iterator[str]: + return iter(self._dir) + + def __getattr__(self, name: str) -> HigherOrderOperator: + # Following _OpNamespace.__getattr__, we cache the op on this object. + op = _higher_order_ops.get(name) + if op is None: + raise AttributeError( + f"'_HigherOrderNamespace' 'torch.ops.higher_order' object has no attribute '{name}'" + ) + setattr(self, name, op) + self._dir.append(name) + return op + + +class _Ops(types.ModuleType): + __file__ = "_ops.py" + + def __init__(self): + super().__init__("torch.ops") + self.loaded_libraries = set() + self.higher_order = _HigherOrderNamespace() + self._dir = [] + + def __getattr__(self, name: str) -> _OpNamespace: + # Here we are creating `torch.ops.my_namespace` + namespace = _OpNamespace(name) + setattr(self, name, namespace) + self._dir.append(name) + return namespace + + def __iter__(self) -> Iterator[str]: + return iter(self._dir) + + def import_module(self, module): + """ + Imports a Python module that has torch.library registrations. + + Generally, to extend PyTorch with custom operators, a user will + create a Python module whose import triggers registration of + the custom operators via a torch.ops.load_library call or a call + to one or more torch.library.* APIs. + + It is unexpected for Python modules to have side effects, so some + linters and formatters will complain. Use this API to import Python + modules that contain these torch.library side effects. + + Args: + module (str): The name of the Python module to import + + """ + importlib.import_module(module) + + def load_library(self, path): + """ + Loads a shared library from the given path into the current process. + + The library being loaded may run global initialization code to register + custom operators with the PyTorch JIT runtime. This allows dynamically + loading custom operators. For this, you should compile your operator + and the static registration code into a shared library object, and then + call ``torch.ops.load_library('path/to/libcustom.so')`` to load the + shared object. + + After the library is loaded, it is added to the + ``torch.ops.loaded_libraries`` attribute, a set that may be inspected + for the paths of all libraries loaded using this function. + + Args: + path (str): A path to a shared library to load. + """ + path = _utils_internal.resolve_library_path(path) + with dl_open_guard(): + # Import the shared library into the process, thus running its + # static (global) initialization code in order to register custom + # operators with the JIT. + try: + ctypes.CDLL(path) + except Exception as e: + raise OSError(f"Could not load this library: {path}") from e + self.loaded_libraries.add(path) + + +# The ops "namespace" +ops: _Ops = _Ops() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_python_dispatcher.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_python_dispatcher.py new file mode 100644 index 0000000000000000000000000000000000000000..931205a88f43e43d4c993395f3609af1324c6e4b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_python_dispatcher.py @@ -0,0 +1,182 @@ +# mypy: allow-untyped-defs +import re + +import torch._C as C + + +""" +PythonDispatcher class is a thin python-binding to C++ dispatcher and it +is designed to show how dispatcher precompute works. In particular, +it shows for a certain op `foo`, what the computed dispatch table looks +like after user register their kernels to certains dispatch keys. + +In the real C++ dispatcher we support many dispatch keys for different +functionalities. For simplicity PythonDispatcher only supports dispatch +keys for a single example of each use case. These use cases are listed below: + +- CPU/AutogradCPU: represents in-tree backends which we usually have dedicated inference & + autograd kernel in pytorch core library. + E.g. CPU, CUDA +- FPGA/AutogradOther: represents in-tree backends which we usually have backend specific + inference kernels, but they share the same autograd kernel specified in AutogradOther. + E.g. FPGA, SparseCsrCPU +- XLA/AutogradXLA: represents out-of-tree backends which we don't have either inference or autograd + kernel defined in pytorch core library. Backend owner is responsible for registering both + inference & autograd kernels in their extensions(e.g. torch-xla) for the operators they support. + E.g. XLA, XPU, MPS +- CompositeExplicitAutograd: alias key mapped to inference kernels of all backends like CPU, CUDA, XLA etc. + Kernels registered to this key MUST work for inference for all backends. +- Autograd: alias key mapped to autograd of all backends like AutogradCPU, AutogradXLA, AutogradOther. + Kernels registered to this key MUST work for autograd for all backends. +- CompositeImplicitAutograd: alias key CompositeImplicitAutograd = CompositeExplicitAutograd + Autograd + Kernels registered to this key MUST work for both inference + autograd for all backends. + +Note we only allow registrations to alias keys inside pytorch core library. E.g +you shouldn't register a CompositeImplicitAutograd or CompositeExplicitAutograd +kernel from torch-xla extension, instead you should upstream the kernel into +pytorch/pytorch repo so that it's available for all backends and continuously +tested even without the extension. + +Usage: + dispatcher = PythonDispatcher() + dispatcher.register(["CPU", "XLA", "CompositeImplicitAutograd"]) + print(dispatcher.dispatchTable()) # This tells you exactly which kernel is used for certain backend. + # For more debugging information + # print(dispatcher.keys()) + # print(dispatcher.registrations()) + # print(dispatcher.rawRegistrations()) + # print(dispatcher.rawDispatchTable()) +PythonDispatcher calls C++ dispatcher under the hood for to precompute dispatch table. +This file only provides the simplified API for developers, relevant test code is located in +test/test_dispatch.py +""" + + +class PythonDispatcher: + namespace = "__test__" + name = "foo" + # fmt: off + runtime_keys = [ + "CPU", "AutogradCPU", + "FPGA", "AutogradOther", + "XLA", "AutogradXLA", + "Lazy", "AutogradLazy", + ] + # fmt: on + alias_keys = [ + "CompositeExplicitAutograd", + "Autograd", + "CompositeImplicitAutograd", + ] + supported_keys = runtime_keys + alias_keys + + def __init__(self) -> None: + C._dispatch_check_invariants(self.name) # type: ignore[attr-defined] + self.ref = C._dispatch_library("FRAGMENT", self.namespace, "") + self.ref.def_("foo(Tensor x) -> Tensor") + + """ + Returns a list of dispatch keys supported by PythonDispatcher. + You can register kernels to these keys. + """ + + def keys(self): + return self.supported_keys + + """ + Register kernels to the target dispatchKeys. + dispatchKeys(list[str]): a list of dispatch keys that you want to register + your own kernel. Note that you don't need to write the kernel yourself in + this PythonDispatcher.E.g. for CPU key, a kernel(e.g fn_CPU for CPU) is + automatically generated and registered. + """ + + def register(self, dispatchKeys): + # Overridden is not supported and triggers a warning in C++ dispatcher. + if len(set(dispatchKeys)) != len(dispatchKeys): + raise RuntimeError( + f"Overridden is not allowed but found duplicates in {dispatchKeys}." + ) + # We currently forbid this in codegen instead of C++ dispatcher. + if ( + "CompositeImplicitAutograd" in dispatchKeys + and "CompositeExplicitAutograd" in dispatchKeys + ): + raise RuntimeError( + "Registration to both CompositeImplicitAutograd and CompositeExplicitAutograd is not allowed." + ) + for key in dispatchKeys: + if key not in self.supported_keys: + raise RuntimeError( + f"{key} is not supported, please select a dispatch key in {self.supported_keys}." + ) + self.ref.impl_t_t("foo", dispatch=key, debug="fn_" + key) + + """ + Helper function to format (key, kernel). + """ + + def _format_line(self, key, kernel): + return f"{key:<15} {kernel}\n" + + """ + Helper function to print a table header. + """ + + def _format_header(self, header): + s = f""" +{header} +""" + s += self._format_line("key", "kernel") + s += "---------------------------\n" + return s + + """ + Returns raw output of all registration info for debugging only. + Use registrations() for a simplified version. + """ + + def rawRegistrations(self): + return C._dispatch_dump(f"{self.namespace}::{self.name}") # type: ignore[attr-defined] + + """ + Returns raw output of computed dispatch table for debugging only. + Use dispatchTable() for a simplified version. + """ + + def rawDispatchTable(self): + return C._dispatch_dump_table(f"{self.namespace}::{self.name}") # type: ignore[attr-defined] + + """ + Returns a table(str) including all the registrations from users. + Note this includes registrations to both runtime keys and alias keys. + """ + + def registrations(self): + output = self._format_header("Registered Kernels") + state = self.rawRegistrations() + state_entries = state.split("\n") + for line in state_entries: + first = line.split(":")[0] + if any(first.startswith(k) for k in self.supported_keys): + kernel = line.split("::")[0].split(" ")[1] + output += self._format_line(first, kernel) + return output + + """ + Returns the computed dispatch table(str). Note this only include + runtime keys, registrations to alias keys have been decoded to their + mapped runtime keys. + """ + + def dispatchTable(self): + output = self._format_header("Computed Dispatch Table") + table = self.rawDispatchTable() + table_entries = table.split("\n") + regex = re.compile(r"registered at .*FallbackKernel\.cpp.*(\[)") + for line in table_entries: + k = line.split(":")[0] + if k in self.runtime_keys: + entry = regex.sub("[", line) + output += self._format_line(k, entry.split(": ")[1]) + return output diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_size_docs.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_size_docs.py new file mode 100644 index 0000000000000000000000000000000000000000..ed7622c547ba6f96a03b118669347c391497df52 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_size_docs.py @@ -0,0 +1,39 @@ +"""Adds docstrings to torch.Size functions""" + +import torch._C +from torch._C import _add_docstr as add_docstr + + +def add_docstr_all(method: str, docstr: str) -> None: + add_docstr(getattr(torch._C.Size, method), docstr) + + +add_docstr_all( + "numel", + """ +numel() -> int + +Returns the number of elements a :class:`torch.Tensor` with the given size would contain. + +More formally, for a tensor ``x = tensor.ones(10, 10)`` with size ``s = torch.Size([10, 10])``, +``x.numel() == x.size().numel() == s.numel() == 100`` holds true. + +Example:: + + >>> x=torch.ones(10, 10) + >>> s=x.size() + >>> s + torch.Size([10, 10]) + >>> s.numel() + 100 + >>> x.numel() == s.numel() + True + + +.. warning:: + + This function does not return the number of dimensions described by :class:`torch.Size`, but instead the number + of elements a :class:`torch.Tensor` with that size would contain. + +""", +) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_sources.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_sources.py new file mode 100644 index 0000000000000000000000000000000000000000..afec8b6919cf5cdf7a24c4844033ee49eb070329 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_sources.py @@ -0,0 +1,138 @@ +# mypy: allow-untyped-defs +import ast +import functools +import inspect +from textwrap import dedent +from typing import Any, NamedTuple + +from torch._C import ErrorReport +from torch._C._jit_tree_views import SourceRangeFactory + + +def get_source_lines_and_file( + obj: Any, + error_msg: str | None = None, +) -> tuple[list[str], int, str | None]: + """ + Wrapper around inspect.getsourcelines and inspect.getsourcefile. + + Returns: (sourcelines, file_lino, filename) + """ + filename = None # in case getsourcefile throws + try: + filename = inspect.getsourcefile(obj) + sourcelines, file_lineno = inspect.getsourcelines(obj) + except OSError as e: + msg = ( + f"Can't get source for {obj}. TorchScript requires source access in " + "order to carry out compilation, make sure original .py files are " + "available." + ) + if error_msg: + msg += "\n" + error_msg + raise OSError(msg) from e + + return sourcelines, file_lineno, filename + + +def normalize_source_lines(sourcelines: list[str]) -> list[str]: + """ + This helper function accepts a list of source lines. It finds the + indentation level of the function definition (`def`), then it indents + all lines in the function body to a point at or greater than that + level. This allows for comments and continued string literals that + are at a lower indentation than the rest of the code. + Args: + sourcelines: function source code, separated into lines by + the '\n' character + Returns: + A list of source lines that have been correctly aligned + """ + + def remove_prefix(text, prefix): + return text[text.startswith(prefix) and len(prefix) :] + + # Find the line and line number containing the function definition + idx = None + for i, l in enumerate(sourcelines): + if l.lstrip().startswith("def"): + idx = i + break + + # This will happen when the function is a lambda- we won't find "def" anywhere in the source + # lines in that case. Currently trying to JIT compile a lambda will throw an error up in + # `parse_def()`, but we might want to handle this case in the future. + if idx is None: + return sourcelines + + # Get a string representing the amount of leading whitespace + fn_def = sourcelines[idx] + whitespace = fn_def.split("def")[0] + + # Add this leading whitespace to all lines before and after the `def` + aligned_prefix = [ + whitespace + remove_prefix(s, whitespace) for s in sourcelines[:idx] + ] + aligned_suffix = [ + whitespace + remove_prefix(s, whitespace) for s in sourcelines[idx + 1 :] + ] + + # Put it together again + aligned_prefix.append(fn_def) + return aligned_prefix + aligned_suffix + + +# Thin wrapper around SourceRangeFactory to store extra metadata +# about the function-to-be-compiled. +class SourceContext(SourceRangeFactory): + def __init__( + self, + source, + filename, + file_lineno, + leading_whitespace_len, + uses_true_division=True, + funcname=None, + ): + super().__init__(source, filename, file_lineno, leading_whitespace_len) + self.uses_true_division = uses_true_division + self.filename = filename + self.funcname = funcname + + +@functools.cache +def make_source_context(*args): + return SourceContext(*args) + + +def fake_range(): + return SourceContext("", None, 0, 0).make_raw_range(0, 1) + + +class ParsedDef(NamedTuple): + ast: ast.Module + ctx: SourceContext + source: str + filename: str | None + file_lineno: int + + +def parse_def(fn): + sourcelines, file_lineno, filename = get_source_lines_and_file( + fn, ErrorReport.call_stack() + ) + sourcelines = normalize_source_lines(sourcelines) + source = "".join(sourcelines) + dedent_src = dedent(source) + py_ast = ast.parse(dedent_src) + if len(py_ast.body) != 1 or not isinstance(py_ast.body[0], ast.FunctionDef): + raise RuntimeError( + f"Expected a single top-level function: {filename}:{file_lineno}" + ) + leading_whitespace_len = len(source.split("\n", 1)[0]) - len( + dedent_src.split("\n", 1)[0] + ) + ctx = make_source_context( + source, filename, file_lineno, leading_whitespace_len, True, fn.__name__ + ) + return ParsedDef(py_ast, ctx, source, filename, file_lineno) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_storage_docs.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_storage_docs.py new file mode 100644 index 0000000000000000000000000000000000000000..6b7082a3db282339bb6c2cf4d2f0144d4bc79a64 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_storage_docs.py @@ -0,0 +1,42 @@ +# mypy: allow-untyped-defs +"""Adds docstrings to Storage functions""" + +import torch._C +from torch._C import _add_docstr as add_docstr + + +storage_classes = ["StorageBase"] + + +def add_docstr_all(method, docstr): + for cls_name in storage_classes: + cls = getattr(torch._C, cls_name) + try: + add_docstr(getattr(cls, method), docstr) + except AttributeError: + pass + + +add_docstr_all( + "from_file", + """ +from_file(filename, shared=False, nbytes=0) -> Storage + +Creates a CPU storage backed by a memory-mapped file. + +If ``shared`` is ``True``, then memory is shared between all processes. +All changes are written to the file. If ``shared`` is ``False``, then the changes on +the storage do not affect the file. + +``nbytes`` is the number of bytes of storage. If ``shared`` is ``False``, +then the file must contain at least ``nbytes`` bytes. If ``shared`` is +``True`` the file will be created if needed. (Note that for ``UntypedStorage`` +this argument differs from that of ``TypedStorage.from_file``) + +Args: + filename (str): file name to map + shared (bool): whether to share memory (whether ``MAP_SHARED`` or ``MAP_PRIVATE`` is passed to the + underlying `mmap(2) call `_) + nbytes (int): number of bytes of storage +""", +) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_streambase.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_streambase.py new file mode 100644 index 0000000000000000000000000000000000000000..864c367df6cf0e28b677809983955056a9b687a7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_streambase.py @@ -0,0 +1,20 @@ +from typing_extensions import deprecated + +import torch + + +# Preserved only for BC reasons +@deprecated( + "`torch._streambase._StreamBase` is deprecated. Please use `torch.Stream` instead.", + category=FutureWarning, +) +class _StreamBase(torch.Stream): + pass + + +@deprecated( + "`torch._streambase._EventBase` is deprecated. Please use `torch.Event` instead.", + category=FutureWarning, +) +class _EventBase(torch.Event): + pass diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_tensor.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_tensor.py new file mode 100644 index 0000000000000000000000000000000000000000..9c5a8cd15b07d13cd1b0d021462a18e1a6c229ad --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_tensor.py @@ -0,0 +1,1889 @@ +# mypy: allow-untyped-defs +import copyreg +import enum +import functools +import itertools +import warnings +from collections import OrderedDict +from collections.abc import Callable +from copy import deepcopy +from numbers import Number +from typing import Any, cast, Concatenate, TypeVar, Union +from typing_extensions import ParamSpec + +import torch +import torch._C as _C +from torch._namedtensor_internals import ( + check_serializing_named_tensor, + is_ellipsis, + resolve_ellipsis, + single_ellipsis_index, + unzip_namedshape, + update_names, +) +from torch.overrides import ( + get_default_nowrap_functions, + handle_torch_function, + has_torch_function, + has_torch_function_unary, + has_torch_function_variadic, +) + + +_P = ParamSpec("_P") +_TensorLike = TypeVar("_TensorLike", bound=_C.TensorBase) + + +def _handle_torch_function_and_wrap_type_error_to_not_implemented( + f: Callable[Concatenate[_TensorLike, _P], "Tensor"], +) -> Callable[Concatenate[_TensorLike, _P], "Tensor"]: + @functools.wraps(f) + def wrapped(self: _TensorLike, *args: _P.args, **kwargs: _P.kwargs) -> "Tensor": + try: + # See https://github.com/pytorch/pytorch/issues/75462 + sargs = self, *args + if has_torch_function(sargs): + return handle_torch_function(wrapped, sargs, *sargs, **kwargs) + return f(self, *args, **kwargs) + except TypeError: + return NotImplemented + + return wrapped + + +# Should not be used, this is kept only for BC of loading old serialized Tensor subclasses +def _rebuild_from_type(func, type, args, dict): + if type is Tensor: + return func(*args) + + ret = func(*args).as_subclass(type) + ret.__dict__ = dict + return ret + + +def _rebuild_from_type_v2(func, new_type, args, state): + ret = func(*args) + if type(ret) is not new_type: + ret = ret.as_subclass(new_type) + # Tensor does define __setstate__ even though it doesn't define + # __getstate__. So only use __setstate__ if it is NOT the one defined + # on Tensor + if ( + getattr(ret.__class__, "__setstate__", Tensor.__setstate__) + is not Tensor.__setstate__ + ): + ret.__setstate__(state) + else: + ret = torch._utils._set_obj_state(ret, state) + return ret + + +def _dtype_to_typestr(dtype): + # CUDA devices are little-endian and tensors are stored in native byte + # order. 1-byte entries are endian-agnostic. + return { + torch.complex64: " torch.TypedStorage + + Returns the underlying :class:`TypedStorage`. + + .. warning:: + + :class:`TypedStorage` is deprecated. It will be removed in the future, and + :class:`UntypedStorage` will be the only storage class. To access the + :class:`UntypedStorage` directly, use :attr:`Tensor.untyped_storage()`. + """ + if has_torch_function_unary(self): + return handle_torch_function(Tensor.storage, (self,), self) + + torch.storage._warn_typed_storage_removal(stacklevel=2) + return self._typed_storage() + + # For internal use only, to avoid raising deprecation warning + def _typed_storage(self): + untyped_storage = self.untyped_storage() + return torch.TypedStorage( + wrap_storage=untyped_storage, dtype=self.dtype, _internal=True + ) + + def _reduce_ex_internal(self, proto): + check_serializing_named_tensor(self) + + from torch.utils.hooks import warn_if_has_hooks + + # See Note [Don't serialize hooks] + warn_if_has_hooks(self) + backward_hooks: dict[Any, Any] = OrderedDict() + + skip_data = torch.serialization._serialization_tls.skip_data + materialize_fake_tensors = ( + torch.serialization._serialization_tls.materialize_fake_tensors + ) + + if self.device.type in ["xla", "maia", "mtia"] or ( + not torch._C._has_storage(self) + and self.device.type == torch._C._get_privateuse1_backend_name() + ): + if skip_data: + raise RuntimeError( + "Cannot serialize tensors on backends with no storage under skip_data context manager" + ) + cpu_tensor = self.cpu() + return ( + torch._utils._rebuild_device_tensor_from_cpu_tensor, + (cpu_tensor, self.dtype, str(self.device), self.requires_grad), + ) + if self.device.type == "meta": + # NB: This implementation BREAKS storage sharing. Current + # hypothesis is that no one cares for meta tensors. + if skip_data: + warnings.warn( + "Serializing tensors on the meta device under skip_data context manager is a no-op", + stacklevel=2, + ) + arg_meta = ( + self.dtype, + tuple(self.size()), + self.stride(), + self.requires_grad, + ) + return (torch._utils._rebuild_meta_tensor_no_storage, arg_meta) + if self.is_quantized: + if skip_data: + raise RuntimeError( + "Cannot serialize qtensor under skip_data context manager, file an issue if you need this feature" + ) + # quantizer_params can be different type based on torch attribute + quantizer_params: ( + tuple[torch.qscheme, float, int] | tuple[Any, Tensor, Tensor, int] + ) + if self.qscheme() == torch.per_tensor_affine: + quantizer_params = ( + torch.per_tensor_affine, + self.q_scale(), + self.q_zero_point(), + ) + elif self.qscheme() in ( + torch.per_channel_affine, + torch.per_channel_affine_float_qparams, + ): + # convert scales and zero points to tuple to avoid recursive calls + # when/if we get multi-axis quantized tensors in the future, the shape + # is recoverable from the main tensor shape + quantizer_params = ( + torch.per_channel_affine, + self.q_per_channel_scales(), + self.q_per_channel_zero_points(), + self.q_per_channel_axis(), + ) + else: + raise RuntimeError( + f"Serialization is not supported for tensors of type {self.qscheme()}" + ) + # TODO: Once we decide to break serialization FC, no longer + # need to wrap with TypedStorage + args_qtensor = ( + torch.storage.TypedStorage( + wrap_storage=self._typed_storage()._untyped_storage, + dtype=self.dtype, + _internal=True, + ), + self.storage_offset(), + tuple(self.size()), + self.stride(), + quantizer_params, + self.requires_grad, + backward_hooks, + ) + return (torch._utils._rebuild_qtensor, args_qtensor) + elif self.is_sparse: + if self.layout == torch.sparse_coo: + args_sparse = ( + self.layout, + (self._indices(), self._values(), self.size(), self.is_coalesced()), + ) + else: + raise NotImplementedError( + f"sparse tensor __reduce_ex__ for layout `{self.layout}`" + ) + return (torch._utils._rebuild_sparse_tensor, args_sparse) + elif self.layout in { + torch.sparse_csr, + torch.sparse_csc, + torch.sparse_bsr, + torch.sparse_bsc, + }: + if self.layout in {torch.sparse_csr, torch.sparse_bsr}: + compressed_indices, plain_indices = ( + self.crow_indices(), + self.col_indices(), + ) + else: + compressed_indices, plain_indices = ( + self.ccol_indices(), + self.row_indices(), + ) + args_sparse_compressed = ( + self.layout, + ( + compressed_indices, + plain_indices, + self.values(), + self.size(), + ), + ) + return (torch._utils._rebuild_sparse_tensor, args_sparse_compressed) + elif self.is_nested: + if skip_data: + raise RuntimeError( + "Cannot serialize nested tensor under skip_data context manager, file an issue if you need this feature" + ) + args_nested = ( + # NB: values() currently returns the storage as a buffer in an unsafe way. + # Ideally, we'd use a private API for this instead. TODO: Switch to this if + # we ever get around to adding it. + self.values(), + self._nested_tensor_size(), + self._nested_tensor_strides(), + self._nested_tensor_storage_offsets(), + ) + return (torch._utils._rebuild_nested_tensor, args_nested) + elif ( + type(self) is not torch.Tensor + and type(self).__torch_dispatch__ is not torch.Tensor.__torch_dispatch__ + and ( + isinstance(self, torch._subclasses.functional_tensor.FunctionalTensor) + or ( + not isinstance(self, torch._subclasses.fake_tensor.FakeTensor) + and self.data_ptr() == 0 + ) + ) + ): + arg_wrapper_subclass = ( + type(self), + self.dtype, + tuple(self.size()), + self.stride(), + self.storage_offset(), + self.layout, + self.device, + self.requires_grad, + ) + return (torch._utils._rebuild_wrapper_subclass, arg_wrapper_subclass) + elif ( + type(self) is not torch.Tensor + and type(self).__torch_dispatch__ is not torch.Tensor.__torch_dispatch__ + and ( + isinstance(self, torch._subclasses.fake_tensor.FakeTensor) + and not (skip_data and materialize_fake_tensors) + ) + ): + arg_wrapper_subclass = ( + type(self), + self.dtype, + tuple(self.size()), + self.stride(), + self.storage_offset(), + self.layout, + self.device, + self.requires_grad, + ) + return (torch._utils._rebuild_wrapper_subclass, arg_wrapper_subclass) + else: + v3_dtypes = torch.storage._new_dtypes() + if self.dtype in v3_dtypes: + rebuild_func = torch._utils._rebuild_tensor_v3 + storage = self.untyped_storage() + else: + # TODO: Once we decide to break serialization FC, no longer + # need to wrap with TypedStorage + rebuild_func = torch._utils._rebuild_tensor_v2 # type: ignore[assignment] + storage = torch.storage.TypedStorage( + wrap_storage=self._typed_storage()._untyped_storage, + dtype=self.dtype, + _internal=True, + ) # type: ignore[assignment] + + # TODO: remove hasattr, it's a hack to support versions of torch that + # don't have _subclasses + if ( + hasattr(torch, "_subclasses") + and isinstance(self, torch._subclasses.fake_tensor.FakeTensor) + and skip_data + ): + storage._fake_device = self.device + + args = ( + storage, + self.storage_offset(), + tuple(self.size()), + self.stride(), + self.requires_grad, + backward_hooks, + ) # previously was self._backward_hooks + + if isinstance(storage, torch.storage.UntypedStorage): + args = args + (self.dtype,) # type: ignore[assignment] + + metadata = torch._utils.get_tensor_metadata(self) + if metadata: + args = args + (metadata,) # type: ignore[assignment] + + return (rebuild_func, args) + + def __setstate__(self, state): + if has_torch_function_unary(self): + return handle_torch_function(Tensor.__setstate__, (self,), self, state) + # Warning: this method is NOT called when you torch.load() a tensor; + # that is managed by _rebuild_tensor_v2 + if not self.is_leaf: + raise RuntimeError("__setstate__ can be only called on leaf Tensors") + if len(state) == 4: + # legacy serialization of Tensor + # pyrefly: ignore [not-iterable] + self.set_(*state) + return + elif len(state) == 5: + # legacy serialization of Variable + self.data = state[0] + state = (state[3], state[4], state[2]) + # The setting of _backward_hooks is expected to be a no-op. + # See Note [Don't serialize hooks] + self.requires_grad, _, self._backward_hooks = state + + def __repr__(self, *, tensor_contents=None): + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.__repr__, (self,), self, tensor_contents=tensor_contents + ) + # All strings are unicode in Python 3. + return torch._tensor_str._str(self, tensor_contents=tensor_contents) + + def backward( + self, gradient=None, retain_graph=None, create_graph=False, inputs=None + ): + r"""Computes the gradient of current tensor wrt graph leaves. + + The graph is differentiated using the chain rule. If the tensor is + non-scalar (i.e. its data has more than one element) and requires + gradient, the function additionally requires specifying a ``gradient``. + It should be a tensor of matching type and shape, that represents + the gradient of the differentiated function w.r.t. ``self``. + + This function accumulates gradients in the leaves - you might need to zero + ``.grad`` attributes or set them to ``None`` before calling it. + See :ref:`Default gradient layouts` + for details on the memory layout of accumulated gradients. + + .. note:: + + If you run any forward ops, create ``gradient``, and/or call ``backward`` + in a user-specified CUDA stream context, see + :ref:`Stream semantics of backward passes`. + + .. note:: + + When ``inputs`` are provided and a given input is not a leaf, + the current implementation will call its grad_fn (though it is not strictly needed to get this gradients). + It is an implementation detail on which the user should not rely. + See https://github.com/pytorch/pytorch/pull/60521#issuecomment-867061780 for more details. + + Args: + gradient (Tensor, optional): The gradient of the function + being differentiated w.r.t. ``self``. + This argument can be omitted if ``self`` is a scalar. Defaults to ``None``. + retain_graph (bool, optional): If ``False``, the graph used to compute the grads will be freed; + If ``True``, it will be retained. The default is ``None``, in which case the value is inferred from ``create_graph`` + (i.e., the graph is retained only when higher-order derivative tracking is requested). Note that in nearly all cases + setting this option to True is not needed and often can be worked around in a much more efficient way. + create_graph (bool, optional): If ``True``, graph of the derivative will + be constructed, allowing to compute higher order derivative + products. Defaults to ``False``. + inputs (Sequence[Tensor], optional): Inputs w.r.t. which the gradient will be + accumulated into ``.grad``. All other tensors will be ignored. If not + provided, the gradient is accumulated into all the leaf Tensors that were + used to compute the :attr:`tensors`. Defaults to ``None``. + """ + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.backward, + (self,), + self, + gradient=gradient, + retain_graph=retain_graph, + create_graph=create_graph, + inputs=inputs, + ) + torch.autograd.backward( + self, gradient, retain_graph, create_graph, inputs=inputs + ) + + def index(self, positions, dims): + """ + Index a regular tensor by binding specified positions to dims. + + This converts a regular tensor to a first-class tensor by binding + the specified positional dimensions to Dim objects. + + Args: + positions: Tuple of dimension positions to bind + dims: Dim objects or tuple of Dim objects to bind to + + Returns: + First-class tensor with specified dimensions bound + """ + # TODO: make it possible to dispatch on positions/dims + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.index, + (self,), + self, + positions, + dims, + ) + + from functorch.dim import index + + return index(self, positions, dims) + + def register_hook(self, hook): + r"""Registers a backward hook. + + The hook will be called every time a gradient with respect to the + Tensor is computed. The hook should have the following signature:: + + hook(grad) -> Tensor or None + + + The hook should not modify its argument, but it can optionally return + a new gradient which will be used in place of :attr:`grad`. + + This function returns a handle with a method ``handle.remove()`` + that removes the hook from the module. + + .. note:: + See :ref:`backward-hooks-execution` for more information on how when this hook + is executed, and how its execution is ordered relative to other hooks. + + Example:: + + >>> v = torch.tensor([0., 0., 0.], requires_grad=True) + >>> h = v.register_hook(lambda grad: grad * 2) # double the gradient + >>> v.backward(torch.tensor([1., 2., 3.])) + >>> v.grad + + 2 + 4 + 6 + [torch.FloatTensor of size (3,)] + + >>> h.remove() # removes the hook + """ + if has_torch_function_unary(self): + return handle_torch_function(Tensor.register_hook, (self,), self, hook) + if not self.requires_grad: + raise RuntimeError( + "cannot register a hook on a tensor that doesn't require gradient" + ) + if self._backward_hooks is None: + self._backward_hooks = OrderedDict() + if self.grad_fn is not None: + self.grad_fn._register_hook_dict(self) + + from torch.utils.hooks import RemovableHandle + + handle = RemovableHandle(self._backward_hooks) + self._backward_hooks[handle.id] = hook + return handle + + def register_post_accumulate_grad_hook(self, hook): + r"""Registers a backward hook that runs after grad accumulation. + + The hook will be called after all gradients for a tensor have been accumulated, + meaning that the .grad field has been updated on that tensor. The post + accumulate grad hook is ONLY applicable for leaf tensors (tensors without a + .grad_fn field). Registering this hook on a non-leaf tensor will error! + + The hook should have the following signature:: + + hook(param: Tensor) -> None + + Note that, unlike other autograd hooks, this hook operates on the tensor + that requires grad and not the grad itself. The hook can in-place modify + and access its Tensor argument, including its .grad field. + + This function returns a handle with a method ``handle.remove()`` + that removes the hook from the module. + + .. note:: + See :ref:`backward-hooks-execution` for more information on how when this hook + is executed, and how its execution is ordered relative to other hooks. Since + this hook runs during the backward pass, it will run in no_grad mode (unless + create_graph is True). You can use torch.enable_grad() to re-enable autograd + within the hook if you need it. + + Example:: + + >>> v = torch.tensor([0., 0., 0.], requires_grad=True) + >>> lr = 0.01 + >>> # simulate a simple SGD update + >>> h = v.register_post_accumulate_grad_hook(lambda p: p.add_(p.grad, alpha=-lr)) + >>> v.backward(torch.tensor([1., 2., 3.])) + >>> v + tensor([-0.0100, -0.0200, -0.0300], requires_grad=True) + + >>> h.remove() # removes the hook + """ + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.register_post_accumulate_grad_hook, (self,), self, hook + ) + if not self.requires_grad: + raise RuntimeError( + "cannot register a hook on a tensor that doesn't require gradient" + ) + if self.grad_fn is not None: + raise RuntimeError( + "post accumulate grad hooks cannot be registered on non-leaf tensors" + ) + if self._post_accumulate_grad_hooks is None: + self._post_accumulate_grad_hooks: dict[Any, Any] = ( + # pyrefly: ignore [bad-assignment] + OrderedDict() + ) + + from torch.utils.hooks import RemovableHandle + + handle = RemovableHandle(self._post_accumulate_grad_hooks) + self._post_accumulate_grad_hooks[handle.id] = hook + return handle + + def reinforce(self, reward): + def trim(str): + return "\n".join([line.strip() for line in str.split("\n")]) + + raise RuntimeError( + trim( + r"""reinforce() was removed. + Use torch.distributions instead. + See https://pytorch.org/docs/main/distributions.html + + Instead of: + + probs = policy_network(state) + action = probs.multinomial() + next_state, reward = env.step(action) + action.reinforce(reward) + action.backward() + + Use: + + probs = policy_network(state) + # NOTE: categorical is equivalent to what used to be called multinomial + m = torch.distributions.Categorical(probs) + action = m.sample() + next_state, reward = env.step(action) + loss = -m.log_prob(action) * reward + loss.backward() + """ + ) + ) + + detach = _C._add_docstr( + _C.TensorBase.detach, + r""" + Returns a new Tensor, detached from the current graph. + + The result will never require gradient. + + This method also affects forward mode AD gradients and the result will never + have forward mode AD gradients. + + .. note:: + + Returned Tensor shares the same storage with the original one. + In-place modifications on either of them will be seen, and may trigger + errors in correctness checks. + """, + ) + + detach_ = _C._add_docstr( + _C.TensorBase.detach_, + r""" + Detaches the Tensor from the graph that created it, making it a leaf. + Views cannot be detached in-place. + + This method also affects forward mode AD gradients and the result will never + have forward mode AD gradients. + """, + ) + + def is_shared(self): + r"""Checks if tensor is in shared memory. + + This is always ``True`` for CUDA tensors. + """ + if has_torch_function_unary(self): + return handle_torch_function(Tensor.is_shared, (self,), self) + return self._typed_storage()._is_shared() + + def share_memory_(self): + r"""Moves the underlying storage to shared memory. + + This is a no-op if the underlying storage is already in shared memory + and for CUDA tensors. Tensors in shared memory cannot be resized. + + See :meth:`torch.UntypedStorage.share_memory_` for more details. + """ + if has_torch_function_unary(self): + return handle_torch_function(Tensor.share_memory_, (self,), self) + self._typed_storage()._share_memory_() + return self + + def module_load(self, other, assign=False): + r"""Defines how to transform ``other`` when loading it into ``self`` in :meth:`~nn.Module.load_state_dict`. + + Used when :func:`~torch.__future__.get_swap_module_params_on_conversion` is ``True``. + + It is expected that ``self`` is a parameter or buffer in an ``nn.Module`` and ``other`` is the + value in the state dictionary with the corresponding key, this method defines + how ``other`` is remapped before being swapped with ``self`` via + :func:`~torch.utils.swap_tensors` in :meth:`~nn.Module.load_state_dict`. + + .. note:: + This method should always return a new object that is not ``self`` or ``other``. + For example, the default implementation returns ``self.copy_(other).detach()`` + if ``assign`` is ``False`` or ``other.detach()`` if ``assign`` is ``True``. + + Args: + other (Tensor): value in state dict with key corresponding to ``self`` + assign (bool): the assign argument passed to :meth:`nn.Module.load_state_dict` + + """ + if has_torch_function_variadic(self, other): + return handle_torch_function( + Tensor.module_load, (self, other), self, other, assign=assign + ) + + if assign: + return other.detach() + else: + return self.copy_(other).detach() + + def __reversed__(self): + r"""Reverses the tensor along dimension 0.""" + if has_torch_function_unary(self): + return handle_torch_function(Tensor.__reversed__, (self,), self) + if self.dim() == 0: + return self + else: + return self.flip(0) + + def norm( + self, + p: float | str | None = "fro", + dim=None, + keepdim=False, + dtype=None, + ): + r"""See :func:`torch.norm`""" + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.norm, (self,), self, p=p, dim=dim, keepdim=keepdim, dtype=dtype + ) + return torch.norm(self, p, dim, keepdim, dtype=dtype) + + def solve(self, other): + from torch._linalg_utils import solve + + return solve(self, other) + + def lstsq(self, other): + from torch._linalg_utils import lstsq + + return lstsq(self, other) + + def eig(self, eigenvectors=False): + from torch._linalg_utils import eig + + return eig(self, eigenvectors=eigenvectors) + + def symeig(self, eigenvectors=False): + from torch._linalg_utils import _symeig + + return _symeig(self, eigenvectors=eigenvectors) + + def lu(self, pivot=True, get_infos=False): + r"""See :func:`torch.lu`""" + # If get_infos is True, then we don't need to check for errors and vice versa + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.lu, (self,), self, pivot=pivot, get_infos=get_infos + ) + + LU, pivots, infos = torch._lu_with_info( + self, pivot=pivot, check_errors=(not get_infos) + ) + if get_infos: + return LU, pivots, infos + else: + return LU, pivots + + def stft( + self, + n_fft: int, + hop_length: int | None = None, + win_length: int | None = None, + window: "Tensor | None" = None, + center: bool = True, + pad_mode: str = "reflect", + normalized: bool = False, + onesided: bool | None = None, + return_complex: bool | None = None, + align_to_window: bool | None = None, + ): + r"""See :func:`torch.stft` + + .. warning:: + This function changed signature at version 0.4.1. Calling with + the previous signature may cause error or return incorrect result. + """ + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.stft, + (self,), + self, + n_fft, + hop_length=hop_length, + win_length=win_length, + window=window, + center=center, + pad_mode=pad_mode, + normalized=normalized, + onesided=onesided, + return_complex=return_complex, + align_to_window=align_to_window, + ) + return torch.stft( + self, + n_fft, + hop_length, + win_length, + window, + center, + pad_mode, + normalized, + onesided, + return_complex=return_complex, + align_to_window=align_to_window, + ) + + def istft( + self, + n_fft: int, + hop_length: int | None = None, + win_length: int | None = None, + window: "Tensor | None" = None, + center: bool = True, + normalized: bool = False, + onesided: bool | None = None, + length: int | None = None, + return_complex: bool = False, + ): + r"""See :func:`torch.istft`""" + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.istft, + (self,), + self, + n_fft, + hop_length=hop_length, + win_length=win_length, + window=window, + center=center, + normalized=normalized, + onesided=onesided, + length=length, + return_complex=return_complex, + ) + return torch.istft( + self, + n_fft, + hop_length, + win_length, + window, + center, + normalized, + onesided, + length, + return_complex=return_complex, + ) + + def resize(self, *sizes): + if has_torch_function_unary(self): + return handle_torch_function(Tensor.resize, (self,), self, *sizes) + warnings.warn("non-inplace resize is deprecated", stacklevel=2) + from torch.autograd._functions import Resize + + return Resize.apply(self, sizes) + + def resize_as(self, tensor): + if has_torch_function_variadic(self, tensor): + return handle_torch_function(Tensor.resize_as, (self, tensor), self, tensor) + warnings.warn("non-inplace resize_as is deprecated", stacklevel=2) + from torch.autograd._functions import Resize + + return Resize.apply(self, tensor.size()) + + def split(self, split_size, dim=0): + r"""See :func:`torch.split`""" + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.split, (self,), self, split_size, dim=dim + ) + if isinstance(split_size, Tensor): + try: + split_size = int(split_size) + except ValueError: + pass + + if isinstance(split_size, (int, torch.SymInt)): + return torch._VF.split(self, split_size, dim) # type: ignore[attr-defined] + else: + return torch._VF.split_with_sizes( + self, + # pyrefly: ignore [bad-argument-type] + split_size, + dim, + ) + + def unique(self, sorted=True, return_inverse=False, return_counts=False, dim=None): + r"""Returns the unique elements of the input tensor. + + See :func:`torch.unique` + """ + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.unique, + (self,), + self, + sorted=sorted, + return_inverse=return_inverse, + return_counts=return_counts, + dim=dim, + ) + return torch.unique( + self, + sorted=sorted, + return_inverse=return_inverse, + return_counts=return_counts, + dim=dim, + ) + + def unique_consecutive(self, return_inverse=False, return_counts=False, dim=None): + r"""Eliminates all but the first element from every consecutive group of equivalent elements. + + See :func:`torch.unique_consecutive` + """ + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.unique_consecutive, + (self,), + self, + return_inverse=return_inverse, + return_counts=return_counts, + dim=dim, + ) + return torch.unique_consecutive( + self, return_inverse=return_inverse, return_counts=return_counts, dim=dim + ) + + @_handle_torch_function_and_wrap_type_error_to_not_implemented + def __rsub__(self, other: Union["Tensor", int, float, bool, complex]) -> "Tensor": + return _C._VariableFunctions.rsub(self, other) + + @_handle_torch_function_and_wrap_type_error_to_not_implemented + def __rdiv__(self, other: Union["Tensor", int, float, bool, complex]) -> "Tensor": + return self.reciprocal() * other + + __rtruediv__ = __rdiv__ + __itruediv__ = _C.TensorBase.__idiv__ + + # pyrefly: ignore [bad-override] + __pow__ = cast( + Callable[ + ["torch._C.TensorBase", Union["Tensor", int, float, bool, complex]], + "Tensor", + ], + _handle_torch_function_and_wrap_type_error_to_not_implemented( + _C.TensorBase.pow + ), + ) + + __ipow__ = _handle_torch_function_and_wrap_type_error_to_not_implemented( + _C.TensorBase.pow_ + ) + + @_handle_torch_function_and_wrap_type_error_to_not_implemented + def __rmod__(self, other: Union["Tensor", int, float, bool, complex]) -> "Tensor": + return torch.remainder(other, self) + + def __format__(self, format_spec): + if has_torch_function_unary(self): + return handle_torch_function(Tensor.__format__, (self,), self, format_spec) + if self.dim() == 0 and not self.is_meta and type(self) is Tensor: + # Use detach() here to avoid the warning when converting a scalar Tensor that + # requires gradients to a python number. It is ok for formatting. + return self.detach().item().__format__(format_spec) + return object.__format__(self, format_spec) + + @_handle_torch_function_and_wrap_type_error_to_not_implemented + def __rpow__(self, other: Union["Tensor", int, float, bool, complex]) -> "Tensor": + return torch.pow(other, self) + + @_handle_torch_function_and_wrap_type_error_to_not_implemented + def __floordiv__(self, other: Union["Tensor", int, float, bool]) -> "Tensor": # type: ignore[override] + # TODO(rec): the superclass says it accepts complex here, + # but torch.floor_divide says it doesn't. + return torch.floor_divide(self, other) + + @_handle_torch_function_and_wrap_type_error_to_not_implemented + def __rfloordiv__(self, other: Union["Tensor", int, float, bool]) -> "Tensor": # type: ignore[override] + return torch.floor_divide(other, self) + + @_handle_torch_function_and_wrap_type_error_to_not_implemented + def __rlshift__( + self, other: Union["Tensor", int, float, bool, complex] + ) -> "Tensor": + return torch.bitwise_left_shift(other, self) + + @_handle_torch_function_and_wrap_type_error_to_not_implemented + def __rrshift__( + self, other: Union["Tensor", int, float, bool, complex] + ) -> "Tensor": + return torch.bitwise_right_shift(other, self) + + @_handle_torch_function_and_wrap_type_error_to_not_implemented + def __rmatmul__(self, other: "Tensor") -> "Tensor": + return torch.matmul(other, self) + + __pos__ = _C.TensorBase.positive + __neg__ = _C.TensorBase.neg + __abs__ = _C.TensorBase.abs + + def __len__(self): + if has_torch_function_unary(self): + return handle_torch_function(Tensor.__len__, (self,), self) + if self.dim() == 0: + raise TypeError("len() of a 0-d tensor") + if torch._C._get_tracing_state(): + warnings.warn( + "Using len to get tensor shape might cause the trace to be incorrect. " + "Recommended usage would be tensor.shape[0]. " + "Passing a tensor of different shape might lead to errors or silently give " + "incorrect results.", + category=torch.jit.TracerWarning, + stacklevel=2, + ) + return self.shape[0] + + def __iter__(self): + # NB: we use 'imap' and not 'map' here, so that in Python 2 we get a + # generator and don't eagerly perform all the indexes. This could + # save us work, and also helps keep trace ordering deterministic + # (e.g., if you zip(*hiddens), the eager map will force all the + # indexes of hiddens[0] before hiddens[1], while the generator + # map will interleave them.) + # NB: We have intentionally skipped __torch_function__ dispatch here. + # See gh-54457 + if self.dim() == 0: + raise TypeError("iteration over a 0-d tensor") + if torch._C._get_tracing_state(): + warnings.warn( + "Iterating over a tensor might cause the trace to be incorrect. " + "Passing a tensor of different shape won't change the number of " + "iterations executed (and might lead to errors or silently give " + "incorrect results).", + category=torch.jit.TracerWarning, + stacklevel=2, + ) + return iter(self.unbind(0)) + + def __hash__(self): + # Do NOT handle __torch_function__ here as user's default + # implementation that handle most functions will most likely do it wrong. + # It can be easily overridden by defining this method on the user + # subclass if needed. + return id(self) + + def __dir__(self): + if has_torch_function_unary(self): + return handle_torch_function(Tensor.__dir__, (self,), self) + tensor_methods = dir(self.__class__) + tensor_methods.remove("volatile") # deprecated + attrs = list(self.__dict__.keys()) + keys = tensor_methods + attrs + + # property only available dense, cuda tensors + if (not self.is_cuda) or self.is_sparse: + keys.remove("__cuda_array_interface__") + + return sorted(keys) + + # Numpy array interface, to support `numpy.asarray(tensor) -> ndarray` + __array_priority__ = 1000 # prefer Tensor ops over numpy ones + + def __array__(self, dtype=None): + if has_torch_function_unary(self): + return handle_torch_function(Tensor.__array__, (self,), self, dtype=dtype) + if dtype is None: + return self.numpy() + else: + return self.numpy().astype(dtype, copy=False) + + # Wrap Numpy array again in a suitable tensor when done, to support e.g. + # `numpy.sin(tensor) -> tensor` or `numpy.greater(tensor, 0) -> ByteTensor` + def __array_wrap__(self, array): + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.__array_wrap__, (self,), self, array=array + ) + if array.dtype == bool: + # Workaround, torch has no built-in bool tensor + array = array.astype("uint8") + return torch.from_numpy(array) + + def __contains__(self, element: Any, /) -> bool: + r"""Check if `element` is present in tensor + + Args: + element (Tensor or scalar): element to be checked + for presence in current tensor" + """ + if has_torch_function_unary(self): + return handle_torch_function(Tensor.__contains__, (self,), self, element) + if isinstance( + element, (torch.Tensor, Number, torch.SymInt, torch.SymFloat, torch.SymBool) + ): + # type hint doesn't understand the __contains__ result array + return bool((element == self).any().item()) # type: ignore[union-attr] + + raise RuntimeError( + f"Tensor.__contains__ only supports Tensor or scalar, but you passed in a {type(element)}." + ) + + @property + def __cuda_array_interface__(self): + """Array view description for cuda tensors. + + See: + https://numba.pydata.org/numba-doc/dev/cuda/cuda_array_interface.html + """ + if has_torch_function_unary(self): + # TODO mypy doesn't support @property, see: https://github.com/python/mypy/issues/6185 + return handle_torch_function( + Tensor.__cuda_array_interface__.__get__, # type: ignore[attr-defined] + (self,), + self, + ) + + # raise AttributeError for unsupported tensors, so that + # hasattr(cpu_tensor, "__cuda_array_interface__") is False. + if not self.is_cuda: + raise AttributeError( + f"Can't get __cuda_array_interface__ on non-CUDA tensor type: {self.type()} " + "If CUDA data is required use tensor.cuda() to copy tensor to device memory." + ) + + if self.is_sparse: + raise AttributeError( + f"Can't get __cuda_array_interface__ on sparse type: {self.type()} " + "Use Tensor.to_dense() to convert to a dense tensor first." + ) + + # RuntimeError, matching tensor.__array__() behavior. + if self.requires_grad: + raise RuntimeError( + "Can't get __cuda_array_interface__ on Variable that requires grad. " + "If gradients aren't required, use var.detach() to get Variable that doesn't require grad." + ) + + typestr = _dtype_to_typestr(self.dtype) + itemsize = self.element_size() + shape = tuple(self.shape) + if self.is_contiguous(): + # __cuda_array_interface__ v2 requires the strides to be omitted + # (either not set or set to None) for C-contiguous arrays. + strides = None + else: + strides = tuple(s * itemsize for s in self.stride()) + data_ptr = self.data_ptr() if self.numel() > 0 else 0 + data = (data_ptr, False) # read-only is false + + return dict(typestr=typestr, shape=shape, strides=strides, data=data, version=2) + + def storage_type(self): + r"""storage_type() -> type + + Returns the type of the underlying storage. + + """ + if has_torch_function_unary(self): + return handle_torch_function(Tensor.storage_type, (self,), self) + + torch.storage._warn_typed_storage_removal() + + return self._typed_storage()._get_legacy_storage_class() + + def refine_names(self, *names): # pyrefly: ignore # bad-override + r"""Refines the dimension names of :attr:`self` according to :attr:`names`. + + Refining is a special case of renaming that "lifts" unnamed dimensions. + A ``None`` dim can be refined to have any name; a named dim can only be + refined to have the same name. + + Because named tensors can coexist with unnamed tensors, refining names + gives a nice way to write named-tensor-aware code that works with both + named and unnamed tensors. + + :attr:`names` may contain up to one Ellipsis (``...``). + The Ellipsis is expanded greedily; it is expanded in-place to fill + :attr:`names` to the same length as ``self.dim()`` using names from the + corresponding indices of ``self.names``. + + Python 2 does not support Ellipsis but one may use a string literal + instead (``'...'``). + + Args: + names (iterable of str): The desired names of the output tensor. May + contain up to one Ellipsis. + + Examples:: + + >>> imgs = torch.randn(32, 3, 128, 128) + >>> named_imgs = imgs.refine_names('N', 'C', 'H', 'W') + >>> named_imgs.names + ('N', 'C', 'H', 'W') + + >>> tensor = torch.randn(2, 3, 5, 7, 11) + >>> tensor = tensor.refine_names('A', ..., 'B', 'C') + >>> tensor.names + ('A', None, None, 'B', 'C') + + .. warning:: + The named tensor API is experimental and subject to change. + + """ + if has_torch_function_unary(self): + return handle_torch_function(Tensor.refine_names, (self,), self, *names) + names = resolve_ellipsis(names, self.names, "refine_names") + return super().refine_names(names) + + def align_to(self, *names): # pyrefly: ignore # bad-override + r"""Permutes the dimensions of the :attr:`self` tensor to match the order + specified in :attr:`names`, adding size-one dims for any new names. + + All of the dims of :attr:`self` must be named in order to use this method. + The resulting tensor is a view on the original tensor. + + All dimension names of :attr:`self` must be present in :attr:`names`. + :attr:`names` may contain additional names that are not in ``self.names``; + the output tensor has a size-one dimension for each of those new names. + + :attr:`names` may contain up to one Ellipsis (``...``). + The Ellipsis is expanded to be equal to all dimension names of :attr:`self` + that are not mentioned in :attr:`names`, in the order that they appear + in :attr:`self`. + + Python 2 does not support Ellipsis but one may use a string literal + instead (``'...'``). + + Args: + names (iterable of str): The desired dimension ordering of the + output tensor. May contain up to one Ellipsis that is expanded + to all unmentioned dim names of :attr:`self`. + + Examples:: + + >>> tensor = torch.randn(2, 2, 2, 2, 2, 2) + >>> named_tensor = tensor.refine_names('A', 'B', 'C', 'D', 'E', 'F') + + # Move the F and E dims to the front while keeping the rest in order + >>> named_tensor.align_to('F', 'E', ...) + + .. warning:: + The named tensor API is experimental and subject to change. + + """ + if has_torch_function_unary(self): + return handle_torch_function(Tensor.align_to, (self,), self, *names) + ellipsis_idx = single_ellipsis_index(names, "align_to") + if ellipsis_idx is None: + return super().align_to(names) + return super().align_to( + [name for name in names if not is_ellipsis(name)], ellipsis_idx + ) + + def unflatten(self, dim, sizes): # type: ignore[override] + r""" + unflatten(dim, sizes) -> Tensor + + See :func:`torch.unflatten`. + + """ + if has_torch_function_unary(self): + return handle_torch_function(Tensor.unflatten, (self,), self, dim, sizes) + + if not sizes: + raise RuntimeError("unflatten: sizes must be non-empty") + + names = None + if isinstance(sizes, OrderedDict) or ( + isinstance(sizes, (tuple, list)) and isinstance(sizes[0], (tuple, list)) + ): + names, sizes = unzip_namedshape(sizes) + return super().unflatten(dim, sizes, names) + else: + return super().unflatten(dim, sizes) + + def rename_(self, *names, **rename_map): + """In-place version of :meth:`~Tensor.rename`.""" + + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.rename_, (self,), self, *names, **rename_map + ) + + # Note [rename_ / rename API] + # The Python API for these is different from the C++ API. In Python: + # 1) tensor.rename(*names) takes a vararglist of names + # 2) tensor.rename(**rename_map) takes a map of names to rename. + # C++ is static, making it difficult to implement similar behavior. + return update_names(self, names, rename_map, inplace=True) + + def rename(self, *names, **rename_map): + """Renames dimension names of :attr:`self`. + + There are two main usages: + + ``self.rename(**rename_map)`` returns a view on tensor that has dims + renamed as specified in the mapping :attr:`rename_map`. + + ``self.rename(*names)`` returns a view on tensor, renaming all + dimensions positionally using :attr:`names`. + Use ``self.rename(None)`` to drop names on a tensor. + + One cannot specify both positional args :attr:`names` and keyword args + :attr:`rename_map`. + + Examples:: + + >>> imgs = torch.rand(2, 3, 5, 7, names=('N', 'C', 'H', 'W')) + >>> renamed_imgs = imgs.rename(N='batch', C='channels') + >>> renamed_imgs.names + ('batch', 'channels', 'H', 'W') + + >>> renamed_imgs = imgs.rename(None) + >>> renamed_imgs.names + (None, None, None, None) + + >>> renamed_imgs = imgs.rename('batch', 'channel', 'height', 'width') + >>> renamed_imgs.names + ('batch', 'channel', 'height', 'width') + + .. warning:: + The named tensor API is experimental and subject to change. + + """ + if has_torch_function_unary(self): + return handle_torch_function( + Tensor.rename, (self,), self, *names, **rename_map + ) + + # See Note [rename_ / rename API] + return update_names(self, names, rename_map, inplace=False) + + def to_sparse_coo(self): + """Convert a tensor to :ref:`coordinate format `. + + Examples:: + + >>> dense = torch.randn(5, 5) + >>> sparse = dense.to_sparse_coo() + >>> sparse._nnz() + 25 + + """ + return self.to_sparse() + + def dim_order(self, *, ambiguity_check: bool | list[torch.memory_format] = False): + """ + dim_order(ambiguity_check=False) -> tuple + + Returns the uniquely determined tuple of int describing the dim order or + physical layout of :attr:`self`. + + The dim order represents how dimensions are laid out in memory of dense tensors, + starting from the outermost to the innermost dimension. + + Note that the dim order may not always be uniquely determined. + If `ambiguity_check` is True, this function raises a RuntimeError when the dim order cannot be uniquely determined; + If `ambiguity_check` is a list of memory formats, this function raises a RuntimeError when tensor can not be interpreted + into exactly one of the given memory formats, or it cannot be uniquely determined. + If `ambiguity_check` is False, it will return one of legal dim order(s) without checking its uniqueness. + Otherwise, it will raise TypeError. + + Args: + ambiguity_check (bool or List[torch.memory_format]): The check method for ambiguity of dim order. + + Examples:: + + >>> torch.empty((2, 3, 5, 7)).dim_order() + (0, 1, 2, 3) + >>> torch.empty((2, 3, 5, 7)).transpose(1, 2).dim_order() + (0, 2, 1, 3) + >>> torch.empty((2, 3, 5, 7), memory_format=torch.channels_last).dim_order() + (0, 2, 3, 1) + >>> torch.empty((1, 2, 3, 4)).dim_order() + (0, 1, 2, 3) + >>> try: + ... torch.empty((1, 2, 3, 4)).dim_order(ambiguity_check=True) + ... except RuntimeError as e: + ... print(e) + The tensor does not have unique dim order, or cannot map to exact one of the given memory formats. + >>> torch.empty((1, 2, 3, 4)).dim_order( + ... ambiguity_check=[torch.contiguous_format, torch.channels_last] + ... ) # It can be mapped to contiguous format + (0, 1, 2, 3) + >>> try: + ... torch.empty((1, 2, 3, 4)).dim_order(ambiguity_check="ILLEGAL") # type: ignore[arg-type] + ... except TypeError as e: + ... print(e) + The ambiguity_check argument must be a bool or a list of memory formats. + + .. warning:: + The dim_order tensor API is experimental and subject to change. + """ + if has_torch_function_unary(self): + return handle_torch_function(Tensor.dim_order, (self,), self) + + if self.is_sparse: + raise AttributeError( + f"Can't get dim order on sparse type: {self.type()} " + "Use Tensor.to_dense() to convert to a dense tensor first." + ) + + # Sanity check ambiguity_check data types + if not isinstance(ambiguity_check, bool): + if not isinstance(ambiguity_check, list): + raise TypeError( + "The ambiguity_check argument must be a bool or a list of memory formats." + ) + for memory_format in ambiguity_check: + if not isinstance(memory_format, torch.memory_format): + raise TypeError( + "The ambiguity_check argument must be a bool or a list of memory formats." + ) + + def invalid_unique_memory_format(tensor, valid_memory_formats): + """ + Returns True if the tensor cannot be uniquely mapped to any of the given memory formats, False otherwise. + """ + + n_legality = 0 + + for memory_format in valid_memory_formats: + if tensor.is_contiguous(memory_format=memory_format): + n_legality += 1 + + return n_legality != 1 + + def has_multiple_dim_order(tensor): + """ + Returns True if there're multiple legal dim orders for given tensor, False otherwise. + + The tensor is considered to have multiple legal dim orders if either of the following conditions is met: + + * Singleton Dimensions: There's at least one singleteon dimension in the tensor. + Since their size is 1, they don't affect the memory offset (stride * index + is zero because index is always zero). Therefore, they can be placed anywhere + in the dimension order without changing how data is accessed. + * Same strides: Strides reflect how the tensor is stored in memory. + If any two dimensions have the same stride, swapping these dimensions won't + change how data is accessed, leading to multiple correct dimension orders. + """ + from torch.fx.experimental.symbolic_shapes import guard_or_false + + sizes = tensor.size() + strides = tensor.stride() + + # Check if there are any duplicate strides + has_duplicate_strides = any( + guard_or_false(earlier == later) + for earlier, later in itertools.pairwise(strides) + ) + + # Check if there are any singleton dimensions + has_singleton_dims = any(guard_or_false(size == 1) for size in sizes) + + return has_duplicate_strides or has_singleton_dims + + valid_memory_formats = ( + ambiguity_check if isinstance(ambiguity_check, list) else [] + ) + check_multiple_dim_order = ( + ambiguity_check if isinstance(ambiguity_check, bool) else True + ) + + if ( + check_multiple_dim_order and has_multiple_dim_order(self) + ) and invalid_unique_memory_format(self, valid_memory_formats): + raise RuntimeError( + "The tensor does not have unique dim order, or cannot map to exact one of the given memory formats." + ) + + import torch._prims_common as utils + + out_perm, raise_ambiguity = ( + utils.compute_elementwise_output_logical_to_physical_perm( + self, ambiguity_check=ambiguity_check + ) + ) + if raise_ambiguity: + raise RuntimeError("The tensor does not have unique dim order.") + return tuple(out_perm) + + def _update_names(self, names, inplace): + if has_torch_function_unary(self): + return handle_torch_function( + Tensor._update_names, (self,), self, names, inplace + ) + + # See Note [rename_ / rename API] + if inplace: + return super().rename_(names) + else: + return super().rename(names) + + @classmethod + def __torch_function__(cls, func, types, args=(), kwargs=None): + """ + This __torch_function__ implementation wraps subclasses such that + methods called on subclasses return a subclass instance instead of + a ``torch.Tensor`` instance. + + One corollary to this is that you need coverage for torch.Tensor + methods if implementing __torch_function__ for subclasses. + + We recommend always calling ``super().__torch_function__`` as the base + case when doing the above. + + While not mandatory, we recommend making `__torch_function__` a classmethod. + """ + if kwargs is None: + kwargs = {} + + if not all(issubclass(cls, t) for t in types): + return NotImplemented + + with _C.DisableTorchFunctionSubclass(): + ret = func(*args, **kwargs) + if func in get_default_nowrap_functions(): + return ret + else: + return _convert(ret, cls) + + __torch_dispatch__ = _C._disabled_torch_dispatch_impl + + def __dlpack__( + self, + *, + stream: Any | None = -1, + max_version: tuple[int, int] | None = None, + dl_device: tuple[enum.IntEnum, int] | None = None, + copy: bool | None = None, + ): + """ + Creates a DLpack `capsule https://data-apis.org/array-api/latest/design_topics/data_interchange.html#data-interchange`_ + of the current tensor to be exported to other libraries. + + This function will be called from the `from_dlpack` method + of the library that will consume the capsule. `from_dlpack` passes the current + stream to this method as part of the specification. + + Args: + stream (integer or None): An optional Python integer representing a + pointer to a CUDA stream. The current stream is synchronized with + this stream before the capsule is created, and since the capsule + shares its storage with the tensor this make it safe to access from + both streams. If -1 is passed then no synchronization is performed. + If 1 (on CUDA) or 0 (on ROCM) then the default stream is used for + synchronization. This API intentionally slightly deviates from the DLPack + guidance: the default stream is -1 (stream-preserving; no cross-stream sync), + because many from_dlpack implementations intend stream preservation. + For non-CUDA devices, -1 is treated the same as None. + + max_version (tuple[int, int] or None): An optional Python tuple with + 2 integers, representing the maximum version the caller supports. If + None (default), PyTorch will fallback to DLPack 0.8. + + dl_device (tuple[DLDeviceType, int] or None): An optional tuple specifying + in which device the exported DLPack capsule should be on. If None (default), + the exported DLPack capsule will be on the same device as ``self``. + + copy (bool or None): An optional boolean indicating whether or not to copy + ``self``. If None, PyTorch will copy only if necessary. + """ + if has_torch_function_unary(self): + args = (self,) + kwargs = { + "stream": stream, + "max_version": max_version, + "dl_device": dl_device, + "copy": copy, + } + return handle_torch_function(Tensor.__dlpack__, (self,), *args, **kwargs) + + # DLPack capsules can't capture all of PyTorch's semantics, + # so we prohibit exporting tensors that would lose their properties like + # requires_grad and having the conjugate bit set. + if self.requires_grad: + raise BufferError( + "Can't export tensors that require gradient, use tensor.detach()" + ) + if self.is_conj(): + raise BufferError("Can't export tensors with the conjugate bit set") + if self.layout != torch.strided: + raise BufferError( + "Can't export tensors with layout other than torch.strided" + ) + + if ( + self.device.type == "cuda" + and self.device.index != torch.cuda.current_device() + ): + raise BufferError( + "Can't export tensors on a different CUDA device index. " + f"Expected: {self.device.index}. " + f"Current device: {torch.cuda.current_device()}." + ) + + if stream is not None and type(stream) is not int: + # Stream pointers in CUDA/ROCm are uniquely numbered and can + # be retrieved from their integer value. + raise TypeError("stream must be ``int`` or ``none``") + elif self.device.type == "cuda" and stream != -1: + # NB: This logic handles the special case values for default + # streams and must be kept in sync with from_dlpack in + # torch/utils/dlpack.py + is_rocm = torch.version.hip is not None + is_cuda = not is_rocm + + if stream is None or (is_rocm and stream == 0) or (is_cuda and stream == 1): + stream = torch.cuda.default_stream() + else: + if is_cuda and stream == 2: + raise BufferError("per-thread default stream is not supported.") + + device_str = "CUDA" if is_cuda else "ROCm" + assert (is_cuda and stream != 0) or ( + is_rocm and stream not in (1, 2) + ), f"unsupported stream on {device_str}: {stream}." + + stream = torch.cuda.ExternalStream(stream) + + # Only synchronize on different streams + current_stream = torch.cuda.current_stream() + if stream != current_stream: + event = torch.cuda.Event() + event.record(current_stream) + stream.wait_event(event) + elif self.device.type == "cpu": + assert stream is None or stream == -1, "stream should be None on cpu." + + if self.device.type == "xla": + import torch_xla + import torch_xla.utils.dlpack as xla_dlpack + + if ( + len(torch_xla.real_devices()) <= 0 + or "cuda" not in torch_xla.real_devices()[0].lower() + ): + raise RuntimeError( + "Can't export to dlpack an XLA tensor that is not on CUDA." + ) + + # Does not support DLPack 1.0, yet. + return xla_dlpack.to_dlpack(self) + + if max_version is None or max_version[0] < 1: + # Fallback to the old, unversioned variant. + return _C._to_dlpack(self, dl_device=dl_device, copy=copy) + + return _C._to_dlpack_versioned(self, dl_device=dl_device, copy=copy) + + def __dlpack_device__(self) -> tuple[enum.IntEnum, int]: + if has_torch_function_unary(self): + return handle_torch_function(Tensor.__dlpack_device__, (self,), self) + + from torch.utils.dlpack import DLDeviceType + + device = self.device + idx = device.index if device.index is not None else 0 + torch_device_type = device.type + if torch_device_type == "cuda" and torch.version.hip is not None: + device_type = DLDeviceType.kDLROCM + elif torch_device_type == "cpu" and self.is_pinned(): + device_type = DLDeviceType.kDLCUDAHost + elif torch_device_type == "cuda": + device_type = DLDeviceType.kDLCUDA + elif torch_device_type == "cpu": + device_type = DLDeviceType.kDLCPU + elif torch_device_type == "xpu": + device_type = DLDeviceType.kDLOneAPI + elif self.device.type == "privateuse1": + device_type = DLDeviceType.kDLExtDev + elif torch_device_type == "xla": + import torch_xla + + if ( + len(torch_xla.real_devices()) <= 0 + or "cuda" not in torch_xla.real_devices()[0].lower() + ): + raise ValueError(f"Unknown device type {torch_device_type} for Dlpack") + + device_type = DLDeviceType.kDLCUDA + elif torch_device_type == "mps": + device_type = DLDeviceType.kDLMetal + else: + raise ValueError(f"Unknown device type {torch_device_type} for Dlpack") + return (device_type, idx) + + __module__ = "torch" + + +def _convert(ret, cls): + if cls is Tensor: + return ret + + if isinstance(ret, Tensor) and not isinstance(ret, cls): + ret = ret.as_subclass(cls) + + if isinstance(ret, (tuple, list)): + # Also handles things like namedtuples + ret = type(ret)(_convert(r, cls) for r in ret) + + return ret diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_tensor_docs.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_tensor_docs.py new file mode 100644 index 0000000000000000000000000000000000000000..3f92e88e972af49815e981075568c4107a813430 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_tensor_docs.py @@ -0,0 +1,7004 @@ +# mypy: allow-untyped-defs +"""Adds docstrings to Tensor functions""" + +import torch._C +from torch._C import _add_docstr as add_docstr +from torch._torch_docs import parse_kwargs, reproducibility_notes + + +def add_docstr_all(method: str, docstr: str) -> None: + add_docstr(getattr(torch._C.TensorBase, method), docstr) + + +common_args = parse_kwargs( + """ + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. +""" +) + +new_common_args = parse_kwargs( + """ + size (int...): a list, tuple, or :class:`torch.Size` of integers defining the + shape of the output tensor. + dtype (:class:`torch.dtype`, optional): the desired type of returned tensor. + Default: if None, same :class:`torch.dtype` as this tensor. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if None, same :class:`torch.device` as this tensor. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. +""" +) + +add_docstr_all( + "new_tensor", + """ +new_tensor(data, *, dtype=None, device=None, requires_grad=False, layout=torch.strided, \ +pin_memory=False) -> Tensor +""" + + r""" + +Returns a new Tensor with :attr:`data` as the tensor data. +By default, the returned Tensor has the same :class:`torch.dtype` and +:class:`torch.device` as this tensor. + +.. warning:: + + :func:`new_tensor` always copies :attr:`data`. If you have a Tensor + ``data`` and want to avoid a copy, use :func:`torch.Tensor.requires_grad_` + or :func:`torch.Tensor.detach`. + If you have a numpy array and want to avoid a copy, use + :func:`torch.from_numpy`. + +.. warning:: + + When data is a tensor `x`, :func:`new_tensor()` reads out 'the data' from whatever it is passed, + and constructs a leaf variable. Therefore ``tensor.new_tensor(x)`` is equivalent to ``x.detach().clone()`` + and ``tensor.new_tensor(x, requires_grad=True)`` is equivalent to ``x.detach().clone().requires_grad_(True)``. + The equivalents using ``detach()`` and ``clone()`` are recommended. + +Args: + data (array_like): The returned Tensor copies :attr:`data`. + +Keyword args: + {dtype} + {device} + {requires_grad} + {layout} + {pin_memory} + +Example:: + + >>> tensor = torch.ones((2,), dtype=torch.int8) + >>> data = [[0, 1], [2, 3]] + >>> tensor.new_tensor(data) + tensor([[ 0, 1], + [ 2, 3]], dtype=torch.int8) + +""".format(**new_common_args), +) + +add_docstr_all( + "new_full", + """ +new_full(size, fill_value, *, dtype=None, device=None, requires_grad=False, layout=torch.strided, \ +pin_memory=False) -> Tensor +""" + + r""" + +Returns a Tensor of size :attr:`size` filled with :attr:`fill_value`. +By default, the returned Tensor has the same :class:`torch.dtype` and +:class:`torch.device` as this tensor. + +Args: + fill_value (scalar): the number to fill the output tensor with. + +Keyword args: + {dtype} + {device} + {requires_grad} + {layout} + {pin_memory} + +Example:: + + >>> tensor = torch.ones((2,), dtype=torch.float64) + >>> tensor.new_full((3, 4), 3.141592) + tensor([[ 3.1416, 3.1416, 3.1416, 3.1416], + [ 3.1416, 3.1416, 3.1416, 3.1416], + [ 3.1416, 3.1416, 3.1416, 3.1416]], dtype=torch.float64) + +""".format(**new_common_args), +) + +add_docstr_all( + "new_empty", + """ +new_empty(size, *, dtype=None, device=None, requires_grad=False, layout=torch.strided, \ +pin_memory=False) -> Tensor +""" + + r""" + +Returns a Tensor of size :attr:`size` filled with uninitialized data. +By default, the returned Tensor has the same :class:`torch.dtype` and +:class:`torch.device` as this tensor. + +Args: + size (int...): a list, tuple, or :class:`torch.Size` of integers defining the + shape of the output tensor. + +Keyword args: + {dtype} + {device} + {requires_grad} + {layout} + {pin_memory} + +Example:: + + >>> tensor = torch.ones(()) + >>> tensor.new_empty((2, 3)) + tensor([[ 5.8182e-18, 4.5765e-41, -1.0545e+30], + [ 3.0949e-41, 4.4842e-44, 0.0000e+00]]) + +""".format(**new_common_args), +) + +add_docstr_all( + "new_empty_strided", + """ +new_empty_strided(size, stride, dtype=None, device=None, requires_grad=False, layout=torch.strided, \ +pin_memory=False) -> Tensor +""" + + r""" + +Returns a Tensor of size :attr:`size` and strides :attr:`stride` filled with +uninitialized data. By default, the returned Tensor has the same +:class:`torch.dtype` and :class:`torch.device` as this tensor. + +Args: + size (int...): a list, tuple, or :class:`torch.Size` of integers defining the + shape of the output tensor. + +Keyword args: + {dtype} + {device} + {requires_grad} + {layout} + {pin_memory} + +Example:: + + >>> tensor = torch.ones(()) + >>> tensor.new_empty_strided((2, 3), (3, 1)) + tensor([[ 5.8182e-18, 4.5765e-41, -1.0545e+30], + [ 3.0949e-41, 4.4842e-44, 0.0000e+00]]) + +""".format(**new_common_args), +) + +add_docstr_all( + "new_ones", + """ +new_ones(size, *, dtype=None, device=None, requires_grad=False, layout=torch.strided, \ +pin_memory=False) -> Tensor +""" + + r""" + +Returns a Tensor of size :attr:`size` filled with ``1``. +By default, the returned Tensor has the same :class:`torch.dtype` and +:class:`torch.device` as this tensor. + +Args: + size (int...): a list, tuple, or :class:`torch.Size` of integers defining the + shape of the output tensor. + +Keyword args: + {dtype} + {device} + {requires_grad} + {layout} + {pin_memory} + +Example:: + + >>> tensor = torch.tensor((), dtype=torch.int32) + >>> tensor.new_ones((2, 3)) + tensor([[ 1, 1, 1], + [ 1, 1, 1]], dtype=torch.int32) + +""".format(**new_common_args), +) + +add_docstr_all( + "new_zeros", + """ +new_zeros(size, *, dtype=None, device=None, requires_grad=False, layout=torch.strided, \ +pin_memory=False) -> Tensor +""" + + r""" + +Returns a Tensor of size :attr:`size` filled with ``0``. +By default, the returned Tensor has the same :class:`torch.dtype` and +:class:`torch.device` as this tensor. + +Args: + size (int...): a list, tuple, or :class:`torch.Size` of integers defining the + shape of the output tensor. + +Keyword args: + {dtype} + {device} + {requires_grad} + {layout} + {pin_memory} + +Example:: + + >>> tensor = torch.tensor((), dtype=torch.float64) + >>> tensor.new_zeros((2, 3)) + tensor([[ 0., 0., 0.], + [ 0., 0., 0.]], dtype=torch.float64) + +""".format(**new_common_args), +) + +add_docstr_all( + "abs", + r""" +abs() -> Tensor + +See :func:`torch.abs` +""", +) + +add_docstr_all( + "abs_", + r""" +abs_() -> Tensor + +In-place version of :meth:`~Tensor.abs` +""", +) + +add_docstr_all( + "absolute", + r""" +absolute() -> Tensor + +Alias for :func:`abs` +""", +) + +add_docstr_all( + "absolute_", + r""" +absolute_() -> Tensor + +In-place version of :meth:`~Tensor.absolute` +Alias for :func:`abs_` +""", +) + +add_docstr_all( + "acos", + r""" +acos() -> Tensor + +See :func:`torch.acos` +""", +) + +add_docstr_all( + "acos_", + r""" +acos_() -> Tensor + +In-place version of :meth:`~Tensor.acos` +""", +) + +add_docstr_all( + "arccos", + r""" +arccos() -> Tensor + +See :func:`torch.arccos` +""", +) + +add_docstr_all( + "arccos_", + r""" +arccos_() -> Tensor + +In-place version of :meth:`~Tensor.arccos` +""", +) + +add_docstr_all( + "acosh", + r""" +acosh() -> Tensor + +See :func:`torch.acosh` +""", +) + +add_docstr_all( + "acosh_", + r""" +acosh_() -> Tensor + +In-place version of :meth:`~Tensor.acosh` +""", +) + +add_docstr_all( + "arccosh", + r""" +acosh() -> Tensor + +See :func:`torch.arccosh` +""", +) + +add_docstr_all( + "arccosh_", + r""" +acosh_() -> Tensor + +In-place version of :meth:`~Tensor.arccosh` +""", +) + +add_docstr_all( + "add", + r""" +add(other, *, alpha=1) -> Tensor + +Add a scalar or tensor to :attr:`self` tensor. If both :attr:`alpha` +and :attr:`other` are specified, each element of :attr:`other` is scaled by +:attr:`alpha` before being used. + +When :attr:`other` is a tensor, the shape of :attr:`other` must be +:ref:`broadcastable ` with the shape of the underlying +tensor + +See :func:`torch.add` +""", +) + +add_docstr_all( + "add_", + r""" +add_(other, *, alpha=1) -> Tensor + +In-place version of :meth:`~Tensor.add` +""", +) + +add_docstr_all( + "addbmm", + r""" +addbmm(batch1, batch2, *, beta=1, alpha=1) -> Tensor + +See :func:`torch.addbmm` +""", +) + +add_docstr_all( + "addbmm_", + r""" +addbmm_(batch1, batch2, *, beta=1, alpha=1) -> Tensor + +In-place version of :meth:`~Tensor.addbmm` +""", +) + +add_docstr_all( + "addcdiv", + r""" +addcdiv(tensor1, tensor2, *, value=1) -> Tensor + +See :func:`torch.addcdiv` +""", +) + +add_docstr_all( + "addcdiv_", + r""" +addcdiv_(tensor1, tensor2, *, value=1) -> Tensor + +In-place version of :meth:`~Tensor.addcdiv` +""", +) + +add_docstr_all( + "addcmul", + r""" +addcmul(tensor1, tensor2, *, value=1) -> Tensor + +See :func:`torch.addcmul` +""", +) + +add_docstr_all( + "addcmul_", + r""" +addcmul_(tensor1, tensor2, *, value=1) -> Tensor + +In-place version of :meth:`~Tensor.addcmul` +""", +) + +add_docstr_all( + "addmm", + r""" +addmm(mat1, mat2, *, beta=1, alpha=1) -> Tensor + +See :func:`torch.addmm` +""", +) + +add_docstr_all( + "addmm_", + r""" +addmm_(mat1, mat2, *, beta=1, alpha=1) -> Tensor + +In-place version of :meth:`~Tensor.addmm` +""", +) + +add_docstr_all( + "addmv", + r""" +addmv(mat, vec, *, beta=1, alpha=1) -> Tensor + +See :func:`torch.addmv` +""", +) + +add_docstr_all( + "addmv_", + r""" +addmv_(mat, vec, *, beta=1, alpha=1) -> Tensor + +In-place version of :meth:`~Tensor.addmv` +""", +) + +add_docstr_all( + "sspaddmm", + r""" +sspaddmm(mat1, mat2, *, beta=1, alpha=1) -> Tensor + +See :func:`torch.sspaddmm` +""", +) + +add_docstr_all( + "smm", + r""" +smm(mat) -> Tensor + +See :func:`torch.smm` +""", +) + +add_docstr_all( + "addr", + r""" +addr(vec1, vec2, *, beta=1, alpha=1) -> Tensor + +See :func:`torch.addr` +""", +) + +add_docstr_all( + "addr_", + r""" +addr_(vec1, vec2, *, beta=1, alpha=1) -> Tensor + +In-place version of :meth:`~Tensor.addr` +""", +) + +add_docstr_all( + "align_as", + r""" +align_as(other) -> Tensor + +Permutes the dimensions of the :attr:`self` tensor to match the dimension order +in the :attr:`other` tensor, adding size-one dims for any new names. + +This operation is useful for explicit broadcasting by names (see examples). + +All of the dims of :attr:`self` must be named in order to use this method. +The resulting tensor is a view on the original tensor. + +All dimension names of :attr:`self` must be present in ``other.names``. +:attr:`other` may contain named dimensions that are not in ``self.names``; +the output tensor has a size-one dimension for each of those new names. + +To align a tensor to a specific order, use :meth:`~Tensor.align_to`. + +Examples:: + + # Example 1: Applying a mask + >>> mask = torch.randint(2, [127, 128], dtype=torch.bool).refine_names('W', 'H') + >>> imgs = torch.randn(32, 128, 127, 3, names=('N', 'H', 'W', 'C')) + >>> imgs.masked_fill_(mask.align_as(imgs), 0) + + + # Example 2: Applying a per-channel-scale + >>> def scale_channels(input, scale): + >>> scale = scale.refine_names('C') + >>> return input * scale.align_as(input) + + >>> num_channels = 3 + >>> scale = torch.randn(num_channels, names=('C',)) + >>> imgs = torch.rand(32, 128, 128, num_channels, names=('N', 'H', 'W', 'C')) + >>> more_imgs = torch.rand(32, num_channels, 128, 128, names=('N', 'C', 'H', 'W')) + >>> videos = torch.randn(3, num_channels, 128, 128, 128, names=('N', 'C', 'H', 'W', 'D')) + + # scale_channels is agnostic to the dimension order of the input + >>> scale_channels(imgs, scale) + >>> scale_channels(more_imgs, scale) + >>> scale_channels(videos, scale) + +.. warning:: + The named tensor API is experimental and subject to change. + +""", +) + +add_docstr_all( + "all", + r""" +all(dim=None, keepdim=False) -> Tensor + +See :func:`torch.all` +""", +) + +add_docstr_all( + "allclose", + r""" +allclose(other, rtol=1e-05, atol=1e-08, equal_nan=False) -> Tensor + +See :func:`torch.allclose` +""", +) + +add_docstr_all( + "angle", + r""" +angle() -> Tensor + +See :func:`torch.angle` +""", +) + +add_docstr_all( + "any", + r""" +any(dim=None, keepdim=False) -> Tensor + +See :func:`torch.any` +""", +) + +add_docstr_all( + "apply_", + r""" +apply_(callable) -> Tensor + +Applies the function :attr:`callable` to each element in the tensor, replacing +each element with the value returned by :attr:`callable`. + +.. note:: + + This function only works with CPU tensors and should not be used in code + sections that require high performance. +""", +) + +add_docstr_all( + "asin", + r""" +asin() -> Tensor + +See :func:`torch.asin` +""", +) + +add_docstr_all( + "asin_", + r""" +asin_() -> Tensor + +In-place version of :meth:`~Tensor.asin` +""", +) + +add_docstr_all( + "arcsin", + r""" +arcsin() -> Tensor + +See :func:`torch.arcsin` +""", +) + +add_docstr_all( + "arcsin_", + r""" +arcsin_() -> Tensor + +In-place version of :meth:`~Tensor.arcsin` +""", +) + +add_docstr_all( + "asinh", + r""" +asinh() -> Tensor + +See :func:`torch.asinh` +""", +) + +add_docstr_all( + "asinh_", + r""" +asinh_() -> Tensor + +In-place version of :meth:`~Tensor.asinh` +""", +) + +add_docstr_all( + "arcsinh", + r""" +arcsinh() -> Tensor + +See :func:`torch.arcsinh` +""", +) + +add_docstr_all( + "arcsinh_", + r""" +arcsinh_() -> Tensor + +In-place version of :meth:`~Tensor.arcsinh` +""", +) + +add_docstr_all( + "as_strided", + r""" +as_strided(size, stride, storage_offset=None) -> Tensor + +See :func:`torch.as_strided` +""", +) + +add_docstr_all( + "as_strided_", + r""" +as_strided_(size, stride, storage_offset=None) -> Tensor + +In-place version of :meth:`~Tensor.as_strided` +""", +) + +add_docstr_all( + "atan", + r""" +atan() -> Tensor + +See :func:`torch.atan` +""", +) + +add_docstr_all( + "atan_", + r""" +atan_() -> Tensor + +In-place version of :meth:`~Tensor.atan` +""", +) + +add_docstr_all( + "arctan", + r""" +arctan() -> Tensor + +See :func:`torch.arctan` +""", +) + +add_docstr_all( + "arctan_", + r""" +arctan_() -> Tensor + +In-place version of :meth:`~Tensor.arctan` +""", +) + +add_docstr_all( + "atan2", + r""" +atan2(other) -> Tensor + +See :func:`torch.atan2` +""", +) + +add_docstr_all( + "atan2_", + r""" +atan2_(other) -> Tensor + +In-place version of :meth:`~Tensor.atan2` +""", +) + +add_docstr_all( + "arctan2", + r""" +arctan2(other) -> Tensor + +See :func:`torch.arctan2` +""", +) + +add_docstr_all( + "arctan2_", + r""" +atan2_(other) -> Tensor + +In-place version of :meth:`~Tensor.arctan2` +""", +) + +add_docstr_all( + "atanh", + r""" +atanh() -> Tensor + +See :func:`torch.atanh` +""", +) + +add_docstr_all( + "atanh_", + r""" +atanh_(other) -> Tensor + +In-place version of :meth:`~Tensor.atanh` +""", +) + +add_docstr_all( + "arctanh", + r""" +arctanh() -> Tensor + +See :func:`torch.arctanh` +""", +) + +add_docstr_all( + "arctanh_", + r""" +arctanh_(other) -> Tensor + +In-place version of :meth:`~Tensor.arctanh` +""", +) + +add_docstr_all( + "baddbmm", + r""" +baddbmm(batch1, batch2, *, beta=1, alpha=1) -> Tensor + +See :func:`torch.baddbmm` +""", +) + +add_docstr_all( + "baddbmm_", + r""" +baddbmm_(batch1, batch2, *, beta=1, alpha=1) -> Tensor + +In-place version of :meth:`~Tensor.baddbmm` +""", +) + +add_docstr_all( + "bernoulli", + r""" +bernoulli(*, generator=None) -> Tensor + +Returns a result tensor where each :math:`\texttt{result[i]}` is independently +sampled from :math:`\text{Bernoulli}(\texttt{self[i]})`. :attr:`self` must have +floating point ``dtype``, and the result will have the same ``dtype``. + +See :func:`torch.bernoulli` +""", +) + +add_docstr_all( + "bernoulli_", + r""" +bernoulli_(p=0.5, *, generator=None) -> Tensor + +Fills each location of :attr:`self` with an independent sample from +:math:`\text{Bernoulli}(\texttt{p})`. :attr:`self` can have integral +``dtype``. + +:attr:`p` should either be a scalar or tensor containing probabilities to be +used for drawing the binary random number. + +If it is a tensor, the :math:`\text{i}^{th}` element of :attr:`self` tensor +will be set to a value sampled from +:math:`\text{Bernoulli}(\texttt{p\_tensor[i]})`. In this case `p` must have +floating point ``dtype``. + +See also :meth:`~Tensor.bernoulli` and :func:`torch.bernoulli` +""", +) + +add_docstr_all( + "bincount", + r""" +bincount(weights=None, minlength=0) -> Tensor + +See :func:`torch.bincount` +""", +) + +add_docstr_all( + "bitwise_not", + r""" +bitwise_not() -> Tensor + +See :func:`torch.bitwise_not` +""", +) + +add_docstr_all( + "bitwise_not_", + r""" +bitwise_not_() -> Tensor + +In-place version of :meth:`~Tensor.bitwise_not` +""", +) + +add_docstr_all( + "bitwise_and", + r""" +bitwise_and() -> Tensor + +See :func:`torch.bitwise_and` +""", +) + +add_docstr_all( + "bitwise_and_", + r""" +bitwise_and_() -> Tensor + +In-place version of :meth:`~Tensor.bitwise_and` +""", +) + +add_docstr_all( + "bitwise_or", + r""" +bitwise_or() -> Tensor + +See :func:`torch.bitwise_or` +""", +) + +add_docstr_all( + "bitwise_or_", + r""" +bitwise_or_() -> Tensor + +In-place version of :meth:`~Tensor.bitwise_or` +""", +) + +add_docstr_all( + "bitwise_xor", + r""" +bitwise_xor() -> Tensor + +See :func:`torch.bitwise_xor` +""", +) + +add_docstr_all( + "bitwise_xor_", + r""" +bitwise_xor_() -> Tensor + +In-place version of :meth:`~Tensor.bitwise_xor` +""", +) + +add_docstr_all( + "bitwise_left_shift", + r""" +bitwise_left_shift(other) -> Tensor + +See :func:`torch.bitwise_left_shift` +""", +) + +add_docstr_all( + "bitwise_left_shift_", + r""" +bitwise_left_shift_(other) -> Tensor + +In-place version of :meth:`~Tensor.bitwise_left_shift` +""", +) + +add_docstr_all( + "bitwise_right_shift", + r""" +bitwise_right_shift(other) -> Tensor + +See :func:`torch.bitwise_right_shift` +""", +) + +add_docstr_all( + "bitwise_right_shift_", + r""" +bitwise_right_shift_(other) -> Tensor + +In-place version of :meth:`~Tensor.bitwise_right_shift` +""", +) + +add_docstr_all( + "broadcast_to", + r""" +broadcast_to(shape) -> Tensor + +See :func:`torch.broadcast_to`. +""", +) + +add_docstr_all( + "logical_and", + r""" +logical_and() -> Tensor + +See :func:`torch.logical_and` +""", +) + +add_docstr_all( + "logical_and_", + r""" +logical_and_() -> Tensor + +In-place version of :meth:`~Tensor.logical_and` +""", +) + +add_docstr_all( + "logical_not", + r""" +logical_not() -> Tensor + +See :func:`torch.logical_not` +""", +) + +add_docstr_all( + "logical_not_", + r""" +logical_not_() -> Tensor + +In-place version of :meth:`~Tensor.logical_not` +""", +) + +add_docstr_all( + "logical_or", + r""" +logical_or() -> Tensor + +See :func:`torch.logical_or` +""", +) + +add_docstr_all( + "logical_or_", + r""" +logical_or_() -> Tensor + +In-place version of :meth:`~Tensor.logical_or` +""", +) + +add_docstr_all( + "logical_xor", + r""" +logical_xor() -> Tensor + +See :func:`torch.logical_xor` +""", +) + +add_docstr_all( + "logical_xor_", + r""" +logical_xor_() -> Tensor + +In-place version of :meth:`~Tensor.logical_xor` +""", +) + +add_docstr_all( + "bmm", + r""" +bmm(batch2) -> Tensor + +See :func:`torch.bmm` +""", +) + +add_docstr_all( + "cauchy_", + r""" +cauchy_(median=0, sigma=1, *, generator=None) -> Tensor + +Fills the tensor with numbers drawn from the Cauchy distribution: + +.. math:: + + f(x) = \dfrac{1}{\pi} \dfrac{\sigma}{(x - \text{median})^2 + \sigma^2} + +.. note:: + Sigma (:math:`\sigma`) is used to denote the scale parameter in Cauchy distribution. +""", +) + +add_docstr_all( + "ceil", + r""" +ceil() -> Tensor + +See :func:`torch.ceil` +""", +) + +add_docstr_all( + "ceil_", + r""" +ceil_() -> Tensor + +In-place version of :meth:`~Tensor.ceil` +""", +) + +add_docstr_all( + "cholesky", + r""" +cholesky(upper=False) -> Tensor + +See :func:`torch.cholesky` +""", +) + +add_docstr_all( + "cholesky_solve", + r""" +cholesky_solve(input2, upper=False) -> Tensor + +See :func:`torch.cholesky_solve` +""", +) + +add_docstr_all( + "cholesky_inverse", + r""" +cholesky_inverse(upper=False) -> Tensor + +See :func:`torch.cholesky_inverse` +""", +) + +add_docstr_all( + "clamp", + r""" +clamp(min=None, max=None) -> Tensor + +See :func:`torch.clamp` +""", +) + +add_docstr_all( + "clamp_", + r""" +clamp_(min=None, max=None) -> Tensor + +In-place version of :meth:`~Tensor.clamp` +""", +) + +add_docstr_all( + "clip", + r""" +clip(min=None, max=None) -> Tensor + +Alias for :meth:`~Tensor.clamp`. +""", +) + +add_docstr_all( + "clip_", + r""" +clip_(min=None, max=None) -> Tensor + +Alias for :meth:`~Tensor.clamp_`. +""", +) + +add_docstr_all( + "clone", + r""" +clone(*, memory_format=torch.preserve_format) -> Tensor + +See :func:`torch.clone` +""".format(**common_args), +) + +add_docstr_all( + "coalesce", + r""" +coalesce() -> Tensor + +Returns a coalesced copy of :attr:`self` if :attr:`self` is an +:ref:`uncoalesced tensor `. + +Returns :attr:`self` if :attr:`self` is a coalesced tensor. + +.. warning:: + Throws an error if :attr:`self` is not a sparse COO tensor. +""", +) + +add_docstr_all( + "contiguous", + r""" +contiguous(memory_format=torch.contiguous_format) -> Tensor + +Returns a contiguous in memory tensor containing the same data as :attr:`self` tensor. If +:attr:`self` tensor is already in the specified memory format, this function returns the +:attr:`self` tensor. + +Args: + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.contiguous_format``. +""", +) + +add_docstr_all( + "copy_", + r""" +copy_(src, non_blocking=False) -> Tensor + +Copies the elements from :attr:`src` into :attr:`self` tensor and returns +:attr:`self`. + +The :attr:`src` tensor must be :ref:`broadcastable ` +with the :attr:`self` tensor. It may be of a different data type or reside on a +different device. + +Args: + src (Tensor): the source tensor to copy from + non_blocking (bool, optional): if ``True`` and this copy is between CPU and GPU, + the copy may occur asynchronously with respect to the host. For other + cases, this argument has no effect. Default: ``False`` +""", +) + +add_docstr_all( + "conj", + r""" +conj() -> Tensor + +See :func:`torch.conj` +""", +) + +add_docstr_all( + "conj_physical", + r""" +conj_physical() -> Tensor + +See :func:`torch.conj_physical` +""", +) + +add_docstr_all( + "conj_physical_", + r""" +conj_physical_() -> Tensor + +In-place version of :meth:`~Tensor.conj_physical` +""", +) + +add_docstr_all( + "resolve_conj", + r""" +resolve_conj() -> Tensor + +See :func:`torch.resolve_conj` +""", +) + +add_docstr_all( + "resolve_neg", + r""" +resolve_neg() -> Tensor + +See :func:`torch.resolve_neg` +""", +) + +add_docstr_all( + "copysign", + r""" +copysign(other) -> Tensor + +See :func:`torch.copysign` +""", +) + +add_docstr_all( + "copysign_", + r""" +copysign_(other) -> Tensor + +In-place version of :meth:`~Tensor.copysign` +""", +) + +add_docstr_all( + "cos", + r""" +cos() -> Tensor + +See :func:`torch.cos` +""", +) + +add_docstr_all( + "cos_", + r""" +cos_() -> Tensor + +In-place version of :meth:`~Tensor.cos` +""", +) + +add_docstr_all( + "cosh", + r""" +cosh() -> Tensor + +See :func:`torch.cosh` +""", +) + +add_docstr_all( + "cosh_", + r""" +cosh_() -> Tensor + +In-place version of :meth:`~Tensor.cosh` +""", +) + +add_docstr_all( + "cpu", + r""" +cpu(memory_format=torch.preserve_format) -> Tensor + +Returns a copy of this object in CPU memory. + +If this object is already in CPU memory, +then no copy is performed and the original object is returned. + +Args: + {memory_format} + +""".format(**common_args), +) + +add_docstr_all( + "count_nonzero", + r""" +count_nonzero(dim=None) -> Tensor + +See :func:`torch.count_nonzero` +""", +) + +add_docstr_all( + "cov", + r""" +cov(*, correction=1, fweights=None, aweights=None) -> Tensor + +See :func:`torch.cov` +""", +) + +add_docstr_all( + "corrcoef", + r""" +corrcoef() -> Tensor + +See :func:`torch.corrcoef` +""", +) + +add_docstr_all( + "cross", + r""" +cross(other, dim=None) -> Tensor + +See :func:`torch.cross` +""", +) + +add_docstr_all( + "cuda", + r""" +cuda(device=None, non_blocking=False, memory_format=torch.preserve_format) -> Tensor + +Returns a copy of this object in CUDA memory. + +If this object is already in CUDA memory and on the correct device, +then no copy is performed and the original object is returned. + +Args: + device (:class:`torch.device`, optional): The destination GPU device. + Defaults to the current CUDA device. + non_blocking (bool, optional): If ``True`` and the source is in pinned memory, + the copy will be asynchronous with respect to the host. + Otherwise, the argument has no effect. Default: ``False``. + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "mtia", + r""" +mtia(device=None, non_blocking=False, memory_format=torch.preserve_format) -> Tensor + +Returns a copy of this object in MTIA memory. + +If this object is already in MTIA memory and on the correct device, +then no copy is performed and the original object is returned. + +Args: + device (:class:`torch.device`, optional): The destination MTIA device. + Defaults to the current MTIA device. + non_blocking (bool, optional): If ``True`` and the source is in pinned memory, + the copy will be asynchronous with respect to the host. + Otherwise, the argument has no effect. Default: ``False``. + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "ipu", + r""" +ipu(device=None, non_blocking=False, memory_format=torch.preserve_format) -> Tensor + +Returns a copy of this object in IPU memory. + +If this object is already in IPU memory and on the correct device, +then no copy is performed and the original object is returned. + +Args: + device (:class:`torch.device`, optional): The destination IPU device. + Defaults to the current IPU device. + non_blocking (bool, optional): If ``True`` and the source is in pinned memory, + the copy will be asynchronous with respect to the host. + Otherwise, the argument has no effect. Default: ``False``. + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "xpu", + r""" +xpu(device=None, non_blocking=False, memory_format=torch.preserve_format) -> Tensor + +Returns a copy of this object in XPU memory. + +If this object is already in XPU memory and on the correct device, +then no copy is performed and the original object is returned. + +Args: + device (:class:`torch.device`, optional): The destination XPU device. + Defaults to the current XPU device. + non_blocking (bool, optional): If ``True`` and the source is in pinned memory, + the copy will be asynchronous with respect to the host. + Otherwise, the argument has no effect. Default: ``False``. + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "logcumsumexp", + r""" +logcumsumexp(dim) -> Tensor + +See :func:`torch.logcumsumexp` +""", +) + +add_docstr_all( + "cummax", + r""" +cummax(dim) -> (Tensor, Tensor) + +See :func:`torch.cummax` +""", +) + +add_docstr_all( + "cummin", + r""" +cummin(dim) -> (Tensor, Tensor) + +See :func:`torch.cummin` +""", +) + +add_docstr_all( + "cumprod", + r""" +cumprod(dim, dtype=None) -> Tensor + +See :func:`torch.cumprod` +""", +) + +add_docstr_all( + "cumprod_", + r""" +cumprod_(dim, dtype=None) -> Tensor + +In-place version of :meth:`~Tensor.cumprod` +""", +) + +add_docstr_all( + "cumsum", + r""" +cumsum(dim, dtype=None) -> Tensor + +See :func:`torch.cumsum` +""", +) + +add_docstr_all( + "cumsum_", + r""" +cumsum_(dim, dtype=None) -> Tensor + +In-place version of :meth:`~Tensor.cumsum` +""", +) + +add_docstr_all( + "data_ptr", + r""" +data_ptr() -> int + +Returns the address of the first element of :attr:`self` tensor. +""", +) + +add_docstr_all( + "dequantize", + r""" +dequantize() -> Tensor + +Given a quantized Tensor, dequantize it and return the dequantized float Tensor. +""", +) + +add_docstr_all( + "dense_dim", + r""" +dense_dim() -> int + +Return the number of dense dimensions in a :ref:`sparse tensor ` :attr:`self`. + +.. note:: + Returns ``len(self.shape)`` if :attr:`self` is not a sparse tensor. + +See also :meth:`Tensor.sparse_dim` and :ref:`hybrid tensors `. +""", +) + +add_docstr_all( + "diag", + r""" +diag(diagonal=0) -> Tensor + +See :func:`torch.diag` +""", +) + +add_docstr_all( + "diag_embed", + r""" +diag_embed(offset=0, dim1=-2, dim2=-1) -> Tensor + +See :func:`torch.diag_embed` +""", +) + +add_docstr_all( + "diagflat", + r""" +diagflat(offset=0) -> Tensor + +See :func:`torch.diagflat` +""", +) + +add_docstr_all( + "diagonal", + r""" +diagonal(offset=0, dim1=0, dim2=1) -> Tensor + +See :func:`torch.diagonal` +""", +) + +add_docstr_all( + "diagonal_scatter", + r""" +diagonal_scatter(src, offset=0, dim1=0, dim2=1) -> Tensor + +See :func:`torch.diagonal_scatter` +""", +) + +add_docstr_all( + "as_strided_scatter", + r""" +as_strided_scatter(src, size, stride, storage_offset=None) -> Tensor + +See :func:`torch.as_strided_scatter` +""", +) + +add_docstr_all( + "fill_diagonal_", + r""" +fill_diagonal_(fill_value, wrap=False) -> Tensor + +Fill the main diagonal of a tensor that has at least 2-dimensions. +When dims>2, all dimensions of input must be of equal length. +This function modifies the input tensor in-place, and returns the input tensor. + +Arguments: + fill_value (Scalar): the fill value + wrap (bool, optional): the diagonal 'wrapped' after N columns for tall matrices. Default: ``False`` + +Example:: + + >>> a = torch.zeros(3, 3) + >>> a.fill_diagonal_(5) + tensor([[5., 0., 0.], + [0., 5., 0.], + [0., 0., 5.]]) + >>> b = torch.zeros(7, 3) + >>> b.fill_diagonal_(5) + tensor([[5., 0., 0.], + [0., 5., 0.], + [0., 0., 5.], + [0., 0., 0.], + [0., 0., 0.], + [0., 0., 0.], + [0., 0., 0.]]) + >>> c = torch.zeros(7, 3) + >>> c.fill_diagonal_(5, wrap=True) + tensor([[5., 0., 0.], + [0., 5., 0.], + [0., 0., 5.], + [0., 0., 0.], + [5., 0., 0.], + [0., 5., 0.], + [0., 0., 5.]]) + +""", +) + +add_docstr_all( + "floor_divide", + r""" +floor_divide(value) -> Tensor + +See :func:`torch.floor_divide` +""", +) + +add_docstr_all( + "floor_divide_", + r""" +floor_divide_(value) -> Tensor + +In-place version of :meth:`~Tensor.floor_divide` +""", +) + +add_docstr_all( + "diff", + r""" +diff(n=1, dim=-1, prepend=None, append=None) -> Tensor + +See :func:`torch.diff` +""", +) + +add_docstr_all( + "digamma", + r""" +digamma() -> Tensor + +See :func:`torch.digamma` +""", +) + +add_docstr_all( + "digamma_", + r""" +digamma_() -> Tensor + +In-place version of :meth:`~Tensor.digamma` +""", +) + +add_docstr_all( + "dim", + r""" +dim() -> int + +Returns the number of dimensions of :attr:`self` tensor. +""", +) + +add_docstr_all( + "dist", + r""" +dist(other, p=2) -> Tensor + +See :func:`torch.dist` +""", +) + +add_docstr_all( + "div", + r""" +div(value, *, rounding_mode=None) -> Tensor + +See :func:`torch.div` +""", +) + +add_docstr_all( + "div_", + r""" +div_(value, *, rounding_mode=None) -> Tensor + +In-place version of :meth:`~Tensor.div` +""", +) + +add_docstr_all( + "divide", + r""" +divide(value, *, rounding_mode=None) -> Tensor + +See :func:`torch.divide` +""", +) + +add_docstr_all( + "divide_", + r""" +divide_(value, *, rounding_mode=None) -> Tensor + +In-place version of :meth:`~Tensor.divide` +""", +) + +add_docstr_all( + "dot", + r""" +dot(other) -> Tensor + +See :func:`torch.dot` +""", +) + +add_docstr_all( + "element_size", + r""" +element_size() -> int + +Returns the size in bytes of an individual element. + +Example:: + + >>> torch.tensor([]).element_size() + 4 + >>> torch.tensor([], dtype=torch.uint8).element_size() + 1 + +""", +) + +add_docstr_all( + "eq", + r""" +eq(other) -> Tensor + +See :func:`torch.eq` +""", +) + +add_docstr_all( + "eq_", + r""" +eq_(other) -> Tensor + +In-place version of :meth:`~Tensor.eq` +""", +) + +add_docstr_all( + "equal", + r""" +equal(other) -> bool + +See :func:`torch.equal` +""", +) + +add_docstr_all( + "erf", + r""" +erf() -> Tensor + +See :func:`torch.erf` +""", +) + +add_docstr_all( + "erf_", + r""" +erf_() -> Tensor + +In-place version of :meth:`~Tensor.erf` +""", +) + +add_docstr_all( + "erfc", + r""" +erfc() -> Tensor + +See :func:`torch.erfc` +""", +) + +add_docstr_all( + "erfc_", + r""" +erfc_() -> Tensor + +In-place version of :meth:`~Tensor.erfc` +""", +) + +add_docstr_all( + "erfinv", + r""" +erfinv() -> Tensor + +See :func:`torch.erfinv` +""", +) + +add_docstr_all( + "erfinv_", + r""" +erfinv_() -> Tensor + +In-place version of :meth:`~Tensor.erfinv` +""", +) + +add_docstr_all( + "exp", + r""" +exp() -> Tensor + +See :func:`torch.exp` +""", +) + +add_docstr_all( + "exp_", + r""" +exp_() -> Tensor + +In-place version of :meth:`~Tensor.exp` +""", +) + +add_docstr_all( + "exp2", + r""" +exp2() -> Tensor + +See :func:`torch.exp2` +""", +) + +add_docstr_all( + "exp2_", + r""" +exp2_() -> Tensor + +In-place version of :meth:`~Tensor.exp2` +""", +) + +add_docstr_all( + "expm1", + r""" +expm1() -> Tensor + +See :func:`torch.expm1` +""", +) + +add_docstr_all( + "expm1_", + r""" +expm1_() -> Tensor + +In-place version of :meth:`~Tensor.expm1` +""", +) + +add_docstr_all( + "exponential_", + r""" +exponential_(lambd=1, *, generator=None) -> Tensor + +Fills :attr:`self` tensor with elements drawn from the PDF (probability density function): + +.. math:: + + f(x) = \lambda e^{-\lambda x}, x > 0 + +.. note:: + In probability theory, exponential distribution is supported on interval [0, :math:`\inf`) (i.e., :math:`x >= 0`) + implying that zero can be sampled from the exponential distribution. + However, :func:`torch.Tensor.exponential_` does not sample zero, + which means that its actual support is the interval (0, :math:`\inf`). + + Note that :func:`torch.distributions.exponential.Exponential` is supported on the interval [0, :math:`\inf`) and can sample zero. +""", +) + +add_docstr_all( + "fill_", + r""" +fill_(value) -> Tensor + +Fills :attr:`self` tensor with the specified value. +""", +) + +add_docstr_all( + "floor", + r""" +floor() -> Tensor + +See :func:`torch.floor` +""", +) + +add_docstr_all( + "flip", + r""" +flip(dims) -> Tensor + +See :func:`torch.flip` +""", +) + +add_docstr_all( + "fliplr", + r""" +fliplr() -> Tensor + +See :func:`torch.fliplr` +""", +) + +add_docstr_all( + "flipud", + r""" +flipud() -> Tensor + +See :func:`torch.flipud` +""", +) + +add_docstr_all( + "roll", + r""" +roll(shifts, dims) -> Tensor + +See :func:`torch.roll` +""", +) + +add_docstr_all( + "floor_", + r""" +floor_() -> Tensor + +In-place version of :meth:`~Tensor.floor` +""", +) + +add_docstr_all( + "fmod", + r""" +fmod(divisor) -> Tensor + +See :func:`torch.fmod` +""", +) + +add_docstr_all( + "fmod_", + r""" +fmod_(divisor) -> Tensor + +In-place version of :meth:`~Tensor.fmod` +""", +) + +add_docstr_all( + "frac", + r""" +frac() -> Tensor + +See :func:`torch.frac` +""", +) + +add_docstr_all( + "frac_", + r""" +frac_() -> Tensor + +In-place version of :meth:`~Tensor.frac` +""", +) + +add_docstr_all( + "frexp", + r""" +frexp(input) -> (Tensor mantissa, Tensor exponent) + +See :func:`torch.frexp` +""", +) + +add_docstr_all( + "flatten", + r""" +flatten(start_dim=0, end_dim=-1) -> Tensor + +See :func:`torch.flatten` +""", +) + +add_docstr_all( + "gather", + r""" +gather(dim, index) -> Tensor + +See :func:`torch.gather` +""", +) + +add_docstr_all( + "gcd", + r""" +gcd(other) -> Tensor + +See :func:`torch.gcd` +""", +) + +add_docstr_all( + "gcd_", + r""" +gcd_(other) -> Tensor + +In-place version of :meth:`~Tensor.gcd` +""", +) + +add_docstr_all( + "ge", + r""" +ge(other) -> Tensor + +See :func:`torch.ge`. +""", +) + +add_docstr_all( + "ge_", + r""" +ge_(other) -> Tensor + +In-place version of :meth:`~Tensor.ge`. +""", +) + +add_docstr_all( + "greater_equal", + r""" +greater_equal(other) -> Tensor + +See :func:`torch.greater_equal`. +""", +) + +add_docstr_all( + "greater_equal_", + r""" +greater_equal_(other) -> Tensor + +In-place version of :meth:`~Tensor.greater_equal`. +""", +) + +add_docstr_all( + "geometric_", + r""" +geometric_(p, *, generator=None) -> Tensor + +Fills :attr:`self` tensor with elements drawn from the geometric distribution: + +.. math:: + + P(X=k) = (1 - p)^{k - 1} p, k = 1, 2, ... + +.. note:: + :func:`torch.Tensor.geometric_` `k`-th trial is the first success hence draws samples in :math:`\{1, 2, \ldots\}`, whereas + :func:`torch.distributions.geometric.Geometric` :math:`(k+1)`-th trial is the first success + hence draws samples in :math:`\{0, 1, \ldots\}`. +""", +) + +add_docstr_all( + "geqrf", + r""" +geqrf() -> (Tensor, Tensor) + +See :func:`torch.geqrf` +""", +) + +add_docstr_all( + "ger", + r""" +ger(vec2) -> Tensor + +See :func:`torch.ger` +""", +) + +add_docstr_all( + "inner", + r""" +inner(other) -> Tensor + +See :func:`torch.inner`. +""", +) + +add_docstr_all( + "outer", + r""" +outer(vec2) -> Tensor + +See :func:`torch.outer`. +""", +) + +add_docstr_all( + "hypot", + r""" +hypot(other) -> Tensor + +See :func:`torch.hypot` +""", +) + +add_docstr_all( + "hypot_", + r""" +hypot_(other) -> Tensor + +In-place version of :meth:`~Tensor.hypot` +""", +) + +add_docstr_all( + "i0", + r""" +i0() -> Tensor + +See :func:`torch.i0` +""", +) + +add_docstr_all( + "i0_", + r""" +i0_() -> Tensor + +In-place version of :meth:`~Tensor.i0` +""", +) + +add_docstr_all( + "igamma", + r""" +igamma(other) -> Tensor + +See :func:`torch.igamma` +""", +) + +add_docstr_all( + "igamma_", + r""" +igamma_(other) -> Tensor + +In-place version of :meth:`~Tensor.igamma` +""", +) + +add_docstr_all( + "igammac", + r""" +igammac(other) -> Tensor +See :func:`torch.igammac` +""", +) + +add_docstr_all( + "igammac_", + r""" +igammac_(other) -> Tensor +In-place version of :meth:`~Tensor.igammac` +""", +) + +add_docstr_all( + "indices", + r""" +indices() -> Tensor + +Return the indices tensor of a :ref:`sparse COO tensor `. + +.. warning:: + Throws an error if :attr:`self` is not a sparse COO tensor. + +See also :meth:`Tensor.values`. + +.. note:: + This method can only be called on a coalesced sparse tensor. See + :meth:`Tensor.coalesce` for details. +""", +) + +add_docstr_all( + "get_device", + r""" +get_device() -> Device ordinal (Integer) + +For CUDA tensors, this function returns the device ordinal of the GPU on which the tensor resides. +For CPU tensors, this function returns `-1`. + +Example:: + + >>> x = torch.randn(3, 4, 5, device='cuda:0') + >>> x.get_device() + 0 + >>> x.cpu().get_device() + -1 +""", +) + +add_docstr_all( + "values", + r""" +values() -> Tensor + +Return the values tensor of a :ref:`sparse COO tensor `. + +.. warning:: + Throws an error if :attr:`self` is not a sparse COO tensor. + +See also :meth:`Tensor.indices`. + +.. note:: + This method can only be called on a coalesced sparse tensor. See + :meth:`Tensor.coalesce` for details. +""", +) + +add_docstr_all( + "gt", + r""" +gt(other) -> Tensor + +See :func:`torch.gt`. +""", +) + +add_docstr_all( + "gt_", + r""" +gt_(other) -> Tensor + +In-place version of :meth:`~Tensor.gt`. +""", +) + +add_docstr_all( + "greater", + r""" +greater(other) -> Tensor + +See :func:`torch.greater`. +""", +) + +add_docstr_all( + "greater_", + r""" +greater_(other) -> Tensor + +In-place version of :meth:`~Tensor.greater`. +""", +) + +add_docstr_all( + "has_names", + r""" +Is ``True`` if any of this tensor's dimensions are named. Otherwise, is ``False``. +""", +) + +add_docstr_all( + "hardshrink", + r""" +hardshrink(lambd=0.5) -> Tensor + +See :func:`torch.nn.functional.hardshrink` +""", +) + +add_docstr_all( + "heaviside", + r""" +heaviside(values) -> Tensor + +See :func:`torch.heaviside` +""", +) + +add_docstr_all( + "heaviside_", + r""" +heaviside_(values) -> Tensor + +In-place version of :meth:`~Tensor.heaviside` +""", +) + +add_docstr_all( + "histc", + r""" +histc(bins=100, min=0, max=0) -> Tensor + +See :func:`torch.histc` +""", +) + +add_docstr_all( + "histogram", + r""" +histogram(input, bins, *, range=None, weight=None, density=False) -> (Tensor, Tensor) + +See :func:`torch.histogram` +""", +) + +add_docstr_all( + "index_add_", + r""" +index_add_(dim, index, source, *, alpha=1) -> Tensor + +Accumulate the elements of :attr:`alpha` times ``source`` into the :attr:`self` +tensor by adding to the indices in the order given in :attr:`index`. For example, +if ``dim == 0``, ``index[i] == j``, and ``alpha=-1``, then the ``i``\ th row of +``source`` is subtracted from the ``j``\ th row of :attr:`self`. + +The :attr:`dim`\ th dimension of ``source`` must have the same size as the +length of :attr:`index` (which must be a vector), and all other dimensions must +match :attr:`self`, or an error will be raised. + +For a 3-D tensor the output is given as:: + + self[index[i], :, :] += alpha * src[i, :, :] # if dim == 0 + self[:, index[i], :] += alpha * src[:, i, :] # if dim == 1 + self[:, :, index[i]] += alpha * src[:, :, i] # if dim == 2 + +Note: + {forward_reproducibility_note} + +Args: + dim (int): dimension along which to index + index (Tensor): indices of ``source`` to select from, + should have dtype either `torch.int64` or `torch.int32` + source (Tensor): the tensor containing values to add + +Keyword args: + alpha (Number): the scalar multiplier for ``source`` + +Example:: + + >>> x = torch.ones(5, 3) + >>> t = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=torch.float) + >>> index = torch.tensor([0, 4, 2]) + >>> x.index_add_(0, index, t) + tensor([[ 2., 3., 4.], + [ 1., 1., 1.], + [ 8., 9., 10.], + [ 1., 1., 1.], + [ 5., 6., 7.]]) + >>> x.index_add_(0, index, t, alpha=-1) + tensor([[ 1., 1., 1.], + [ 1., 1., 1.], + [ 1., 1., 1.], + [ 1., 1., 1.], + [ 1., 1., 1.]]) +""".format(**reproducibility_notes), +) + +add_docstr_all( + "index_copy_", + r""" +index_copy_(dim, index, tensor) -> Tensor + +Copies the elements of :attr:`tensor` into the :attr:`self` tensor by selecting +the indices in the order given in :attr:`index`. For example, if ``dim == 0`` +and ``index[i] == j``, then the ``i``\ th row of :attr:`tensor` is copied to the +``j``\ th row of :attr:`self`. + +The :attr:`dim`\ th dimension of :attr:`tensor` must have the same size as the +length of :attr:`index` (which must be a vector), and all other dimensions must +match :attr:`self`, or an error will be raised. + +.. note:: + If :attr:`index` contains duplicate entries, multiple elements from + :attr:`tensor` will be copied to the same index of :attr:`self`. The result + is nondeterministic since it depends on which copy occurs last. + +Args: + dim (int): dimension along which to index + index (LongTensor): indices of :attr:`tensor` to select from + tensor (Tensor): the tensor containing values to copy + +Example:: + + >>> x = torch.zeros(5, 3) + >>> t = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=torch.float) + >>> index = torch.tensor([0, 4, 2]) + >>> x.index_copy_(0, index, t) + tensor([[ 1., 2., 3.], + [ 0., 0., 0.], + [ 7., 8., 9.], + [ 0., 0., 0.], + [ 4., 5., 6.]]) +""", +) + +add_docstr_all( + "index_fill_", + r""" +index_fill_(dim, index, value) -> Tensor + +Fills the elements of the :attr:`self` tensor with value :attr:`value` by +selecting the indices in the order given in :attr:`index`. + +Args: + dim (int): dimension along which to index + index (LongTensor): indices of :attr:`self` tensor to fill in + value (float): the value to fill with + +Example:: + + >>> x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=torch.float) + >>> index = torch.tensor([0, 2]) + >>> x.index_fill_(1, index, -1) + tensor([[-1., 2., -1.], + [-1., 5., -1.], + [-1., 8., -1.]]) +""", +) + +add_docstr_all( + "index_put_", + r""" +index_put_(indices, values, accumulate=False) -> Tensor + +Puts values from the tensor :attr:`values` into the tensor :attr:`self` using +the indices specified in :attr:`indices` (which is a tuple of Tensors). The +expression ``tensor.index_put_(indices, values)`` is equivalent to +``tensor[indices] = values``. Returns :attr:`self`. + +If :attr:`accumulate` is ``True``, the elements in :attr:`values` are added to +:attr:`self`. If accumulate is ``False``, the behavior is undefined if indices +contain duplicate elements. + +Args: + indices (tuple of LongTensor): tensors used to index into `self`. + values (Tensor): tensor of same dtype as `self`. + accumulate (bool): whether to accumulate into self +""", +) + +add_docstr_all( + "index_put", + r""" +index_put(indices, values, accumulate=False) -> Tensor + +Out-place version of :meth:`~Tensor.index_put_`. +""", +) + +add_docstr_all( + "index_reduce_", + r""" +index_reduce_(dim, index, source, reduce, *, include_self=True) -> Tensor + +Accumulate the elements of ``source`` into the :attr:`self` +tensor by accumulating to the indices in the order given in :attr:`index` +using the reduction given by the ``reduce`` argument. For example, if ``dim == 0``, +``index[i] == j``, ``reduce == prod`` and ``include_self == True`` then the ``i``\ th +row of ``source`` is multiplied by the ``j``\ th row of :attr:`self`. If +:obj:`include_self="True"`, the values in the :attr:`self` tensor are included +in the reduction, otherwise, rows in the :attr:`self` tensor that are accumulated +to are treated as if they were filled with the reduction identities. + +The :attr:`dim`\ th dimension of ``source`` must have the same size as the +length of :attr:`index` (which must be a vector), and all other dimensions must +match :attr:`self`, or an error will be raised. + +For a 3-D tensor with :obj:`reduce="prod"` and :obj:`include_self=True` the +output is given as:: + + self[index[i], :, :] *= src[i, :, :] # if dim == 0 + self[:, index[i], :] *= src[:, i, :] # if dim == 1 + self[:, :, index[i]] *= src[:, :, i] # if dim == 2 + +Note: + {forward_reproducibility_note} + +.. note:: + + This function only supports floating point tensors. + +.. warning:: + + This function is in beta and may change in the near future. + +Args: + dim (int): dimension along which to index + index (Tensor): indices of ``source`` to select from, + should have dtype either `torch.int64` or `torch.int32` + source (FloatTensor): the tensor containing values to accumulate + reduce (str): the reduction operation to apply + (:obj:`"prod"`, :obj:`"mean"`, :obj:`"amax"`, :obj:`"amin"`) + +Keyword args: + include_self (bool): whether the elements from the ``self`` tensor are + included in the reduction + +Example:: + + >>> x = torch.empty(5, 3).fill_(2) + >>> t = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]], dtype=torch.float) + >>> index = torch.tensor([0, 4, 2, 0]) + >>> x.index_reduce_(0, index, t, 'prod') + tensor([[20., 44., 72.], + [ 2., 2., 2.], + [14., 16., 18.], + [ 2., 2., 2.], + [ 8., 10., 12.]]) + >>> x = torch.empty(5, 3).fill_(2) + >>> x.index_reduce_(0, index, t, 'prod', include_self=False) + tensor([[10., 22., 36.], + [ 2., 2., 2.], + [ 7., 8., 9.], + [ 2., 2., 2.], + [ 4., 5., 6.]]) +""".format(**reproducibility_notes), +) + +add_docstr_all( + "index_select", + r""" +index_select(dim, index) -> Tensor + +See :func:`torch.index_select` +""", +) + +add_docstr_all( + "sparse_mask", + r""" +sparse_mask(mask) -> Tensor + +Returns a new :ref:`sparse tensor ` with values from a +strided tensor :attr:`self` filtered by the indices of the sparse +tensor :attr:`mask`. The values of :attr:`mask` sparse tensor are +ignored. :attr:`self` and :attr:`mask` tensors must have the same +shape. + +.. note:: + + The returned sparse tensor might contain duplicate values if :attr:`mask` + is not coalesced. It is therefore advisable to pass ``mask.coalesce()`` + if such behavior is not desired. + +.. note:: + + The returned sparse tensor has the same indices as the sparse tensor + :attr:`mask`, even when the corresponding values in :attr:`self` are + zeros. + +Args: + mask (Tensor): a sparse tensor whose indices are used as a filter + +Example:: + + >>> nse = 5 + >>> dims = (5, 5, 2, 2) + >>> I = torch.cat([torch.randint(0, dims[0], size=(nse,)), + ... torch.randint(0, dims[1], size=(nse,))], 0).reshape(2, nse) + >>> V = torch.randn(nse, dims[2], dims[3]) + >>> S = torch.sparse_coo_tensor(I, V, dims).coalesce() + >>> D = torch.randn(dims) + >>> D.sparse_mask(S) + tensor(indices=tensor([[0, 0, 0, 2], + [0, 1, 4, 3]]), + values=tensor([[[ 1.6550, 0.2397], + [-0.1611, -0.0779]], + + [[ 0.2326, -1.0558], + [ 1.4711, 1.9678]], + + [[-0.5138, -0.0411], + [ 1.9417, 0.5158]], + + [[ 0.0793, 0.0036], + [-0.2569, -0.1055]]]), + size=(5, 5, 2, 2), nnz=4, layout=torch.sparse_coo) +""", +) + +add_docstr_all( + "inverse", + r""" +inverse() -> Tensor + +See :func:`torch.inverse` +""", +) + +add_docstr_all( + "isnan", + r""" +isnan() -> Tensor + +See :func:`torch.isnan` +""", +) + +add_docstr_all( + "isinf", + r""" +isinf() -> Tensor + +See :func:`torch.isinf` +""", +) + +add_docstr_all( + "isposinf", + r""" +isposinf() -> Tensor + +See :func:`torch.isposinf` +""", +) + +add_docstr_all( + "isneginf", + r""" +isneginf() -> Tensor + +See :func:`torch.isneginf` +""", +) + +add_docstr_all( + "isfinite", + r""" +isfinite() -> Tensor + +See :func:`torch.isfinite` +""", +) + +add_docstr_all( + "isclose", + r""" +isclose(other, rtol=1e-05, atol=1e-08, equal_nan=False) -> Tensor + +See :func:`torch.isclose` +""", +) + +add_docstr_all( + "isreal", + r""" +isreal() -> Tensor + +See :func:`torch.isreal` +""", +) + +add_docstr_all( + "is_coalesced", + r""" +is_coalesced() -> bool + +Returns ``True`` if :attr:`self` is a :ref:`sparse COO tensor +` that is coalesced, ``False`` otherwise. + +.. warning:: + Throws an error if :attr:`self` is not a sparse COO tensor. + +See :meth:`coalesce` and :ref:`uncoalesced tensors `. +""", +) + +add_docstr_all( + "is_contiguous", + r""" +is_contiguous(memory_format=torch.contiguous_format) -> bool + +Returns True if :attr:`self` tensor is contiguous in memory in the order specified +by memory format. + +Args: + memory_format (:class:`torch.memory_format`, optional): Specifies memory allocation + order. Default: ``torch.contiguous_format``. +""", +) + +add_docstr_all( + "is_pinned", + r""" +Returns true if this tensor resides in pinned memory. +By default, the device pinned memory on will be the current :ref:`accelerator`. +""", +) + +add_docstr_all( + "is_floating_point", + r""" +is_floating_point() -> bool + +Returns True if the data type of :attr:`self` is a floating point data type. +""", +) + +add_docstr_all( + "is_complex", + r""" +is_complex() -> bool + +Returns True if the data type of :attr:`self` is a complex data type. +""", +) + +add_docstr_all( + "is_inference", + r""" +is_inference() -> bool + +See :func:`torch.is_inference` +""", +) + +add_docstr_all( + "is_conj", + r""" +is_conj() -> bool + +Returns True if the conjugate bit of :attr:`self` is set to true. +""", +) + +add_docstr_all( + "is_neg", + r""" +is_neg() -> bool + +Returns True if the negative bit of :attr:`self` is set to true. +""", +) + +add_docstr_all( + "is_signed", + r""" +is_signed() -> bool + +Returns True if the data type of :attr:`self` is a signed data type. +""", +) + +add_docstr_all( + "is_set_to", + r""" +is_set_to(tensor) -> bool + +Returns True if both tensors are pointing to the exact same memory (same +storage, offset, size and stride). +""", +) + +add_docstr_all( + "item", + r""" +item() -> number + +Returns the value of this tensor as a standard Python number. This only works +for tensors with one element. For other cases, see :meth:`~Tensor.tolist`. + +This operation is not differentiable. + +Example:: + + >>> x = torch.tensor([1.0]) + >>> x.item() + 1.0 + +""", +) + +add_docstr_all( + "kron", + r""" +kron(other) -> Tensor + +See :func:`torch.kron` +""", +) + +add_docstr_all( + "kthvalue", + r""" +kthvalue(k, dim=None, keepdim=False) -> (Tensor, LongTensor) + +See :func:`torch.kthvalue` +""", +) + +add_docstr_all( + "ldexp", + r""" +ldexp(other) -> Tensor + +See :func:`torch.ldexp` +""", +) + +add_docstr_all( + "ldexp_", + r""" +ldexp_(other) -> Tensor + +In-place version of :meth:`~Tensor.ldexp` +""", +) + +add_docstr_all( + "lcm", + r""" +lcm(other) -> Tensor + +See :func:`torch.lcm` +""", +) + +add_docstr_all( + "lcm_", + r""" +lcm_(other) -> Tensor + +In-place version of :meth:`~Tensor.lcm` +""", +) + +add_docstr_all( + "le", + r""" +le(other) -> Tensor + +See :func:`torch.le`. +""", +) + +add_docstr_all( + "le_", + r""" +le_(other) -> Tensor + +In-place version of :meth:`~Tensor.le`. +""", +) + +add_docstr_all( + "less_equal", + r""" +less_equal(other) -> Tensor + +See :func:`torch.less_equal`. +""", +) + +add_docstr_all( + "less_equal_", + r""" +less_equal_(other) -> Tensor + +In-place version of :meth:`~Tensor.less_equal`. +""", +) + +add_docstr_all( + "lerp", + r""" +lerp(end, weight) -> Tensor + +See :func:`torch.lerp` +""", +) + +add_docstr_all( + "lerp_", + r""" +lerp_(end, weight) -> Tensor + +In-place version of :meth:`~Tensor.lerp` +""", +) + +add_docstr_all( + "lgamma", + r""" +lgamma() -> Tensor + +See :func:`torch.lgamma` +""", +) + +add_docstr_all( + "lgamma_", + r""" +lgamma_() -> Tensor + +In-place version of :meth:`~Tensor.lgamma` +""", +) + +add_docstr_all( + "log", + r""" +log() -> Tensor + +See :func:`torch.log` +""", +) + +add_docstr_all( + "log_", + r""" +log_() -> Tensor + +In-place version of :meth:`~Tensor.log` +""", +) + +add_docstr_all( + "log10", + r""" +log10() -> Tensor + +See :func:`torch.log10` +""", +) + +add_docstr_all( + "log10_", + r""" +log10_() -> Tensor + +In-place version of :meth:`~Tensor.log10` +""", +) + +add_docstr_all( + "log1p", + r""" +log1p() -> Tensor + +See :func:`torch.log1p` +""", +) + +add_docstr_all( + "log1p_", + r""" +log1p_() -> Tensor + +In-place version of :meth:`~Tensor.log1p` +""", +) + +add_docstr_all( + "log2", + r""" +log2() -> Tensor + +See :func:`torch.log2` +""", +) + +add_docstr_all( + "log2_", + r""" +log2_() -> Tensor + +In-place version of :meth:`~Tensor.log2` +""", +) + +add_docstr_all( + "logaddexp", + r""" +logaddexp(other) -> Tensor + +See :func:`torch.logaddexp` +""", +) + +add_docstr_all( + "logaddexp2", + r""" +logaddexp2(other) -> Tensor + +See :func:`torch.logaddexp2` +""", +) + +add_docstr_all( + "log_normal_", + r""" +log_normal_(mean=1, std=2, *, generator=None) + +Fills :attr:`self` tensor with numbers samples from the log-normal distribution +parameterized by the given mean :math:`\mu` and standard deviation +:math:`\sigma`. Note that :attr:`mean` and :attr:`std` are the mean and +standard deviation of the underlying normal distribution, and not of the +returned distribution: + +.. math:: + + f(x) = \dfrac{1}{x \sigma \sqrt{2\pi}}\ e^{-\frac{(\ln x - \mu)^2}{2\sigma^2}} +""", +) + +add_docstr_all( + "logsumexp", + r""" +logsumexp(dim, keepdim=False) -> Tensor + +See :func:`torch.logsumexp` +""", +) + +add_docstr_all( + "lt", + r""" +lt(other) -> Tensor + +See :func:`torch.lt`. +""", +) + +add_docstr_all( + "lt_", + r""" +lt_(other) -> Tensor + +In-place version of :meth:`~Tensor.lt`. +""", +) + +add_docstr_all( + "less", + r""" +lt(other) -> Tensor + +See :func:`torch.less`. +""", +) + +add_docstr_all( + "less_", + r""" +less_(other) -> Tensor + +In-place version of :meth:`~Tensor.less`. +""", +) + +add_docstr_all( + "lu_solve", + r""" +lu_solve(LU_data, LU_pivots) -> Tensor + +See :func:`torch.lu_solve` +""", +) + +add_docstr_all( + "map_", + r""" +map_(tensor, callable) + +Applies :attr:`callable` for each element in :attr:`self` tensor and the given +:attr:`tensor` and stores the results in :attr:`self` tensor. :attr:`self` tensor and +the given :attr:`tensor` must be :ref:`broadcastable `. + +The :attr:`callable` should have the signature:: + + def callable(a, b) -> number +""", +) + +add_docstr_all( + "masked_scatter_", + r""" +masked_scatter_(mask, source) + +Copies elements from :attr:`source` into :attr:`self` tensor at positions where +the :attr:`mask` is True. Elements from :attr:`source` are copied into :attr:`self` +starting at position 0 of :attr:`source` and continuing in order one-by-one for each +occurrence of :attr:`mask` being True. +The shape of :attr:`mask` must be :ref:`broadcastable ` +with the shape of the underlying tensor. The :attr:`source` should have at least +as many elements as the number of ones in :attr:`mask`. + +Args: + mask (BoolTensor): the boolean mask + source (Tensor): the tensor to copy from + +.. note:: + + The :attr:`mask` operates on the :attr:`self` tensor, not on the given + :attr:`source` tensor. + +Example: + + >>> self = torch.tensor([[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) + >>> mask = torch.tensor( + ... [[0, 0, 0, 1, 1], [1, 1, 0, 1, 1]], + ... dtype=torch.bool, + ... ) + >>> source = torch.tensor([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]) + >>> self.masked_scatter_(mask, source) + tensor([[0, 0, 0, 0, 1], + [2, 3, 0, 4, 5]]) + +""", +) + +add_docstr_all( + "masked_fill_", + r""" +masked_fill_(mask, value) + +Fills elements of :attr:`self` tensor with :attr:`value` where :attr:`mask` is +True. The shape of :attr:`mask` must be +:ref:`broadcastable ` with the shape of the underlying +tensor. + +Args: + mask (BoolTensor): the boolean mask + value (float): the value to fill in with +""", +) + +add_docstr_all( + "masked_select", + r""" +masked_select(mask) -> Tensor + +See :func:`torch.masked_select` +""", +) + +add_docstr_all( + "matrix_power", + r""" +matrix_power(n) -> Tensor + +.. note:: :meth:`~Tensor.matrix_power` is deprecated, use :func:`torch.linalg.matrix_power` instead. + +Alias for :func:`torch.linalg.matrix_power` +""", +) + +add_docstr_all( + "matrix_exp", + r""" +matrix_exp() -> Tensor + +See :func:`torch.matrix_exp` +""", +) + +add_docstr_all( + "max", + r""" +max(dim=None, keepdim=False) -> Tensor or (Tensor, Tensor) + +See :func:`torch.max` +""", +) + +add_docstr_all( + "amax", + r""" +amax(dim=None, keepdim=False) -> Tensor + +See :func:`torch.amax` +""", +) + +add_docstr_all( + "maximum", + r""" +maximum(other) -> Tensor + +See :func:`torch.maximum` +""", +) + +add_docstr_all( + "fmax", + r""" +fmax(other) -> Tensor + +See :func:`torch.fmax` +""", +) + +add_docstr_all( + "argmax", + r""" +argmax(dim=None, keepdim=False) -> LongTensor + +See :func:`torch.argmax` +""", +) + +add_docstr_all( + "argwhere", + r""" +argwhere() -> Tensor + +See :func:`torch.argwhere` +""", +) + +add_docstr_all( + "mean", + r""" +mean(dim=None, keepdim=False, *, dtype=None) -> Tensor + +See :func:`torch.mean` +""", +) + +add_docstr_all( + "nanmean", + r""" +nanmean(dim=None, keepdim=False, *, dtype=None) -> Tensor + +See :func:`torch.nanmean` +""", +) + +add_docstr_all( + "median", + r""" +median(dim=None, keepdim=False) -> (Tensor, LongTensor) + +See :func:`torch.median` +""", +) + +add_docstr_all( + "nanmedian", + r""" +nanmedian(dim=None, keepdim=False) -> (Tensor, LongTensor) + +See :func:`torch.nanmedian` +""", +) + +add_docstr_all( + "min", + r""" +min(dim=None, keepdim=False) -> Tensor or (Tensor, Tensor) + +See :func:`torch.min` +""", +) + +add_docstr_all( + "amin", + r""" +amin(dim=None, keepdim=False) -> Tensor + +See :func:`torch.amin` +""", +) + +add_docstr_all( + "minimum", + r""" +minimum(other) -> Tensor + +See :func:`torch.minimum` +""", +) + +add_docstr_all( + "aminmax", + r""" +aminmax(*, dim=None, keepdim=False) -> (Tensor min, Tensor max) + +See :func:`torch.aminmax` +""", +) + +add_docstr_all( + "fmin", + r""" +fmin(other) -> Tensor + +See :func:`torch.fmin` +""", +) + +add_docstr_all( + "argmin", + r""" +argmin(dim=None, keepdim=False) -> LongTensor + +See :func:`torch.argmin` +""", +) + +add_docstr_all( + "mm", + r""" +mm(mat2) -> Tensor + +See :func:`torch.mm` +""", +) + +add_docstr_all( + "mode", + r""" +mode(dim=None, keepdim=False) -> (Tensor, LongTensor) + +See :func:`torch.mode` +""", +) + +add_docstr_all( + "movedim", + r""" +movedim(source, destination) -> Tensor + +See :func:`torch.movedim` +""", +) + +add_docstr_all( + "moveaxis", + r""" +moveaxis(source, destination) -> Tensor + +See :func:`torch.moveaxis` +""", +) + +add_docstr_all( + "mul", + r""" +mul(value) -> Tensor + +See :func:`torch.mul`. +""", +) + +add_docstr_all( + "mul_", + r""" +mul_(value) -> Tensor + +In-place version of :meth:`~Tensor.mul`. +""", +) + +add_docstr_all( + "multiply", + r""" +multiply(value) -> Tensor + +See :func:`torch.multiply`. +""", +) + +add_docstr_all( + "multiply_", + r""" +multiply_(value) -> Tensor + +In-place version of :meth:`~Tensor.multiply`. +""", +) + +add_docstr_all( + "multinomial", + r""" +multinomial(num_samples, replacement=False, *, generator=None) -> Tensor + +See :func:`torch.multinomial` +""", +) + +add_docstr_all( + "mv", + r""" +mv(vec) -> Tensor + +See :func:`torch.mv` +""", +) + +add_docstr_all( + "mvlgamma", + r""" +mvlgamma(p) -> Tensor + +See :func:`torch.mvlgamma` +""", +) + +add_docstr_all( + "mvlgamma_", + r""" +mvlgamma_(p) -> Tensor + +In-place version of :meth:`~Tensor.mvlgamma` +""", +) + +add_docstr_all( + "narrow", + r""" +narrow(dimension, start, length) -> Tensor + +See :func:`torch.narrow`. +""", +) + +add_docstr_all( + "narrow_copy", + r""" +narrow_copy(dimension, start, length) -> Tensor + +See :func:`torch.narrow_copy`. +""", +) + +add_docstr_all( + "ndimension", + r""" +ndimension() -> int + +Alias for :meth:`~Tensor.dim()` +""", +) + +add_docstr_all( + "nan_to_num", + r""" +nan_to_num(nan=0.0, posinf=None, neginf=None) -> Tensor + +See :func:`torch.nan_to_num`. +""", +) + +add_docstr_all( + "nan_to_num_", + r""" +nan_to_num_(nan=0.0, posinf=None, neginf=None) -> Tensor + +In-place version of :meth:`~Tensor.nan_to_num`. +""", +) + +add_docstr_all( + "ne", + r""" +ne(other) -> Tensor + +See :func:`torch.ne`. +""", +) + +add_docstr_all( + "ne_", + r""" +ne_(other) -> Tensor + +In-place version of :meth:`~Tensor.ne`. +""", +) + +add_docstr_all( + "not_equal", + r""" +not_equal(other) -> Tensor + +See :func:`torch.not_equal`. +""", +) + +add_docstr_all( + "not_equal_", + r""" +not_equal_(other) -> Tensor + +In-place version of :meth:`~Tensor.not_equal`. +""", +) + +add_docstr_all( + "neg", + r""" +neg() -> Tensor + +See :func:`torch.neg` +""", +) + +add_docstr_all( + "negative", + r""" +negative() -> Tensor + +See :func:`torch.negative` +""", +) + +add_docstr_all( + "neg_", + r""" +neg_() -> Tensor + +In-place version of :meth:`~Tensor.neg` +""", +) + +add_docstr_all( + "negative_", + r""" +negative_() -> Tensor + +In-place version of :meth:`~Tensor.negative` +""", +) + +add_docstr_all( + "nelement", + r""" +nelement() -> int + +Alias for :meth:`~Tensor.numel` +""", +) + +add_docstr_all( + "nextafter", + r""" +nextafter(other) -> Tensor +See :func:`torch.nextafter` +""", +) + +add_docstr_all( + "nextafter_", + r""" +nextafter_(other) -> Tensor +In-place version of :meth:`~Tensor.nextafter` +""", +) + +add_docstr_all( + "nonzero", + r""" +nonzero() -> LongTensor + +See :func:`torch.nonzero` +""", +) + +add_docstr_all( + "nonzero_static", + r""" +nonzero_static(input, *, size, fill_value=-1) -> Tensor + +Returns a 2-D tensor where each row is the index for a non-zero value. +The returned Tensor has the same `torch.dtype` as `torch.nonzero()`. + +Args: + input (Tensor): the input tensor to count non-zero elements. + +Keyword args: + size (int): the size of non-zero elements expected to be included in the out + tensor. Pad the out tensor with `fill_value` if the `size` is larger + than total number of non-zero elements, truncate out tensor if `size` + is smaller. The size must be a non-negative integer. + fill_value (int, optional): the value to fill the output tensor with when `size` is larger + than the total number of non-zero elements. Default is `-1` to represent + invalid index. + +Example: + + # Example 1: Padding + >>> input_tensor = torch.tensor([[1, 0], [3, 2]]) + >>> static_size = 4 + >>> t = torch.nonzero_static(input_tensor, size=static_size) + tensor([[ 0, 0], + [ 1, 0], + [ 1, 1], + [ -1, -1]], dtype=torch.int64) + + # Example 2: Truncating + >>> input_tensor = torch.tensor([[1, 0], [3, 2]]) + >>> static_size = 2 + >>> t = torch.nonzero_static(input_tensor, size=static_size) + tensor([[ 0, 0], + [ 1, 0]], dtype=torch.int64) + + # Example 3: 0 size + >>> input_tensor = torch.tensor([10]) + >>> static_size = 0 + >>> t = torch.nonzero_static(input_tensor, size=static_size) + tensor([], size=(0, 1), dtype=torch.int64) + + # Example 4: 0 rank input + >>> input_tensor = torch.tensor(10) + >>> static_size = 2 + >>> t = torch.nonzero_static(input_tensor, size=static_size) + tensor([], size=(2, 0), dtype=torch.int64) +""", +) + +add_docstr_all( + "norm", + r""" +norm(p=2, dim=None, keepdim=False) -> Tensor + +See :func:`torch.norm` +""", +) + +add_docstr_all( + "normal_", + r""" +normal_(mean=0, std=1, *, generator=None) -> Tensor + +Fills :attr:`self` tensor with elements samples from the normal distribution +parameterized by :attr:`mean` and :attr:`std`. +""", +) + +add_docstr_all( + "numel", + r""" +numel() -> int + +See :func:`torch.numel` +""", +) + +add_docstr_all( + "numpy", + r""" +numpy(*, force=False) -> numpy.ndarray + +Returns the tensor as a NumPy :class:`ndarray`. + +If :attr:`force` is ``False`` (the default), the conversion +is performed only if the tensor is on the CPU, does not require grad, +does not have its conjugate bit set, and is a dtype and layout that +NumPy supports. The returned ndarray and the tensor will share their +storage, so changes to the tensor will be reflected in the ndarray +and vice versa. + +If :attr:`force` is ``True`` this is equivalent to +calling ``t.detach().cpu().resolve_conj().resolve_neg().numpy()``. +If the tensor isn't on the CPU or the conjugate or negative bit is set, +the tensor won't share its storage with the returned ndarray. +Setting :attr:`force` to ``True`` can be a useful shorthand. + +Args: + force (bool): if ``True``, the ndarray may be a copy of the tensor + instead of always sharing memory, defaults to ``False``. +""", +) + +add_docstr_all( + "orgqr", + r""" +orgqr(input2) -> Tensor + +See :func:`torch.orgqr` +""", +) + +add_docstr_all( + "ormqr", + r""" +ormqr(input2, input3, left=True, transpose=False) -> Tensor + +See :func:`torch.ormqr` +""", +) + +add_docstr_all( + "permute", + r""" +permute(*dims) -> Tensor + +See :func:`torch.permute` +""", +) + +add_docstr_all( + "polygamma", + r""" +polygamma(n) -> Tensor + +See :func:`torch.polygamma` +""", +) + +add_docstr_all( + "polygamma_", + r""" +polygamma_(n) -> Tensor + +In-place version of :meth:`~Tensor.polygamma` +""", +) + +add_docstr_all( + "positive", + r""" +positive() -> Tensor + +See :func:`torch.positive` +""", +) + +add_docstr_all( + "pow", + r""" +pow(exponent) -> Tensor + +See :func:`torch.pow` +""", +) + +add_docstr_all( + "pow_", + r""" +pow_(exponent) -> Tensor + +In-place version of :meth:`~Tensor.pow` +""", +) + +add_docstr_all( + "float_power", + r""" +float_power(exponent) -> Tensor + +See :func:`torch.float_power` +""", +) + +add_docstr_all( + "float_power_", + r""" +float_power_(exponent) -> Tensor + +In-place version of :meth:`~Tensor.float_power` +""", +) + +add_docstr_all( + "prod", + r""" +prod(dim=None, keepdim=False, dtype=None) -> Tensor + +See :func:`torch.prod` +""", +) + +add_docstr_all( + "put_", + r""" +put_(index, source, accumulate=False) -> Tensor + +Copies the elements from :attr:`source` into the positions specified by +:attr:`index`. For the purpose of indexing, the :attr:`self` tensor is treated as if +it were a 1-D tensor. + +:attr:`index` and :attr:`source` need to have the same number of elements, but not necessarily +the same shape. + +If :attr:`accumulate` is ``True``, the elements in :attr:`source` are added to +:attr:`self`. If accumulate is ``False``, the behavior is undefined if :attr:`index` +contain duplicate elements. + +Args: + index (LongTensor): the indices into self + source (Tensor): the tensor containing values to copy from + accumulate (bool, optional): whether to accumulate into self. Default: ``False`` + +Example:: + + >>> src = torch.tensor([[4, 3, 5], + ... [6, 7, 8]]) + >>> src.put_(torch.tensor([1, 3]), torch.tensor([9, 10])) + tensor([[ 4, 9, 5], + [ 10, 7, 8]]) +""", +) + +add_docstr_all( + "put", + r""" +put(input, index, source, accumulate=False) -> Tensor + +Out-of-place version of :meth:`torch.Tensor.put_`. +`input` corresponds to `self` in :meth:`torch.Tensor.put_`. +""", +) + +add_docstr_all( + "qr", + r""" +qr(some=True) -> (Tensor, Tensor) + +See :func:`torch.qr` +""", +) + +add_docstr_all( + "qscheme", + r""" +qscheme() -> torch.qscheme + +Returns the quantization scheme of a given QTensor. +""", +) + +add_docstr_all( + "quantile", + r""" +quantile(q, dim=None, keepdim=False, *, interpolation='linear') -> Tensor + +See :func:`torch.quantile` +""", +) + +add_docstr_all( + "nanquantile", + r""" +nanquantile(q, dim=None, keepdim=False, *, interpolation='linear') -> Tensor + +See :func:`torch.nanquantile` +""", +) + +add_docstr_all( + "q_scale", + r""" +q_scale() -> float + +Given a Tensor quantized by linear(affine) quantization, +returns the scale of the underlying quantizer(). +""", +) + +add_docstr_all( + "q_zero_point", + r""" +q_zero_point() -> int + +Given a Tensor quantized by linear(affine) quantization, +returns the zero_point of the underlying quantizer(). +""", +) + +add_docstr_all( + "q_per_channel_scales", + r""" +q_per_channel_scales() -> Tensor + +Given a Tensor quantized by linear (affine) per-channel quantization, +returns a Tensor of scales of the underlying quantizer. It has the number of +elements that matches the corresponding dimensions (from q_per_channel_axis) of +the tensor. +""", +) + +add_docstr_all( + "q_per_channel_zero_points", + r""" +q_per_channel_zero_points() -> Tensor + +Given a Tensor quantized by linear (affine) per-channel quantization, +returns a tensor of zero_points of the underlying quantizer. It has the number of +elements that matches the corresponding dimensions (from q_per_channel_axis) of +the tensor. +""", +) + +add_docstr_all( + "q_per_channel_axis", + r""" +q_per_channel_axis() -> int + +Given a Tensor quantized by linear (affine) per-channel quantization, +returns the index of dimension on which per-channel quantization is applied. +""", +) + +add_docstr_all( + "random_", + r""" +random_(from=0, to=None, *, generator=None) -> Tensor + +Fills :attr:`self` tensor with numbers sampled from the discrete uniform +distribution over ``[from, to - 1]``. If not specified, the values are usually +only bounded by :attr:`self` tensor's data type. However, for floating point +types, if unspecified, range will be ``[0, 2^mantissa]`` to ensure that every +value is representable. For example, `torch.tensor(1, dtype=torch.double).random_()` +will be uniform in ``[0, 2^53]``. +""", +) + +add_docstr_all( + "rad2deg", + r""" +rad2deg() -> Tensor + +See :func:`torch.rad2deg` +""", +) + +add_docstr_all( + "rad2deg_", + r""" +rad2deg_() -> Tensor + +In-place version of :meth:`~Tensor.rad2deg` +""", +) + +add_docstr_all( + "deg2rad", + r""" +deg2rad() -> Tensor + +See :func:`torch.deg2rad` +""", +) + +add_docstr_all( + "deg2rad_", + r""" +deg2rad_() -> Tensor + +In-place version of :meth:`~Tensor.deg2rad` +""", +) + +add_docstr_all( + "ravel", + r""" +ravel() -> Tensor + +see :func:`torch.ravel` +""", +) + +add_docstr_all( + "reciprocal", + r""" +reciprocal() -> Tensor + +See :func:`torch.reciprocal` +""", +) + +add_docstr_all( + "reciprocal_", + r""" +reciprocal_() -> Tensor + +In-place version of :meth:`~Tensor.reciprocal` +""", +) + +add_docstr_all( + "record_stream", + r""" +record_stream(stream) + +Marks the tensor as having been used by this stream. When the tensor +is deallocated, ensure the tensor memory is not reused for another tensor +until all work queued on :attr:`stream` at the time of deallocation is +complete. + +.. note:: + + The caching allocator is aware of only the stream where a tensor was + allocated. Due to the awareness, it already correctly manages the life + cycle of tensors on only one stream. But if a tensor is used on a stream + different from the stream of origin, the allocator might reuse the memory + unexpectedly. Calling this method lets the allocator know which streams + have used the tensor. + +.. warning:: + + This method is most suitable for use cases where you are providing a + function that created a tensor on a side stream, and want users to be able + to make use of the tensor without having to think carefully about stream + safety when making use of them. These safety guarantees come at some + performance and predictability cost (analogous to the tradeoff between GC + and manual memory management), so if you are in a situation where + you manage the full lifetime of your tensors, you may consider instead + manually managing CUDA events so that calling this method is not necessary. + In particular, when you call this method, on later allocations the + allocator will poll the recorded stream to see if all operations have + completed yet; you can potentially race with side stream computation and + non-deterministically reuse or fail to reuse memory for an allocation. + + You can safely use tensors allocated on side streams without + :meth:`~Tensor.record_stream`; you must manually ensure that + any non-creation stream uses of a tensor are synced back to the creation + stream before you deallocate the tensor. As the CUDA caching allocator + guarantees that the memory will only be reused with the same creation stream, + this is sufficient to ensure that writes to future reallocations of the + memory will be delayed until non-creation stream uses are done. + (Counterintuitively, you may observe that on the CPU side we have already + reallocated the tensor, even though CUDA kernels on the old tensor are + still in progress. This is fine, because CUDA operations on the new + tensor will appropriately wait for the old operations to complete, as they + are all on the same stream.) + + Concretely, this looks like this:: + + with torch.cuda.stream(s0): + x = torch.zeros(N) + + s1.wait_stream(s0) + with torch.cuda.stream(s1): + y = some_comm_op(x) + + ... some compute on s0 ... + + # synchronize creation stream s0 to side stream s1 + # before deallocating x + s0.wait_stream(s1) + del x + + Note that some discretion is required when deciding when to perform + ``s0.wait_stream(s1)``. In particular, if we were to wait immediately + after ``some_comm_op``, there wouldn't be any point in having the side + stream; it would be equivalent to have run ``some_comm_op`` on ``s0``. + Instead, the synchronization must be placed at some appropriate, later + point in time where you expect the side stream ``s1`` to have finished + work. This location is typically identified via profiling, e.g., using + Chrome traces produced + :meth:`torch.autograd.profiler.profile.export_chrome_trace`. If you + place the wait too early, work on s0 will block until ``s1`` has finished, + preventing further overlapping of communication and computation. If you + place the wait too late, you will use more memory than is strictly + necessary (as you are keeping ``x`` live for longer.) For a concrete + example of how this guidance can be applied in practice, see this post: + `FSDP and CUDACachingAllocator + `_. +""", +) + +add_docstr_all( + "remainder", + r""" +remainder(divisor) -> Tensor + +See :func:`torch.remainder` +""", +) + +add_docstr_all( + "remainder_", + r""" +remainder_(divisor) -> Tensor + +In-place version of :meth:`~Tensor.remainder` +""", +) + +add_docstr_all( + "renorm", + r""" +renorm(p, dim, maxnorm) -> Tensor + +See :func:`torch.renorm` +""", +) + +add_docstr_all( + "renorm_", + r""" +renorm_(p, dim, maxnorm) -> Tensor + +In-place version of :meth:`~Tensor.renorm` +""", +) + +add_docstr_all( + "repeat", + r""" +repeat(*repeats) -> Tensor + +Repeats this tensor along the specified dimensions. + +Unlike :meth:`~Tensor.expand`, this function copies the tensor's data. + +.. warning:: + + :meth:`~Tensor.repeat` behaves differently from + `numpy.repeat `_, + but is more similar to + `numpy.tile `_. + For the operator similar to `numpy.repeat`, see :func:`torch.repeat_interleave`. + +Args: + repeat (torch.Size, int..., tuple of int or list of int): The number of times to repeat this tensor along each dimension + +Example:: + + >>> x = torch.tensor([1, 2, 3]) + >>> x.repeat(4, 2) + tensor([[ 1, 2, 3, 1, 2, 3], + [ 1, 2, 3, 1, 2, 3], + [ 1, 2, 3, 1, 2, 3], + [ 1, 2, 3, 1, 2, 3]]) + >>> x.repeat(4, 2, 1).size() + torch.Size([4, 2, 3]) +""", +) + +add_docstr_all( + "repeat_interleave", + r""" +repeat_interleave(repeats, dim=None, *, output_size=None) -> Tensor + +See :func:`torch.repeat_interleave`. +""", +) + +add_docstr_all( + "requires_grad_", + r""" +requires_grad_(requires_grad=True) -> Tensor + +Change if autograd should record operations on this tensor: sets this tensor's +:attr:`requires_grad` attribute in-place. Returns this tensor. + +:func:`requires_grad_`'s main use case is to tell autograd to begin recording +operations on a Tensor ``tensor``. If ``tensor`` has ``requires_grad=False`` +(because it was obtained through a DataLoader, or required preprocessing or +initialization), ``tensor.requires_grad_()`` makes it so that autograd will +begin to record operations on ``tensor``. + +Args: + requires_grad (bool): If autograd should record operations on this tensor. + Default: ``True``. + +Example:: + + >>> # Let's say we want to preprocess some saved weights and use + >>> # the result as new weights. + >>> saved_weights = [0.1, 0.2, 0.3, 0.25] + >>> loaded_weights = torch.tensor(saved_weights) + >>> weights = preprocess(loaded_weights) # some function + >>> weights + tensor([-0.5503, 0.4926, -2.1158, -0.8303]) + + >>> # Now, start to record operations done to weights + >>> weights.requires_grad_() + >>> out = weights.pow(2).sum() + >>> out.backward() + >>> weights.grad + tensor([-1.1007, 0.9853, -4.2316, -1.6606]) + +""", +) + +add_docstr_all( + "reshape", + r""" +reshape(*shape) -> Tensor + +Returns a tensor with the same data and number of elements as :attr:`self` +but with the specified shape. This method returns a view if :attr:`shape` is +compatible with the current shape. See :meth:`torch.Tensor.view` on when it is +possible to return a view. + +See :func:`torch.reshape` + +Args: + shape (tuple of ints or int...): the desired shape + +""", +) + +add_docstr_all( + "reshape_as", + r""" +reshape_as(other) -> Tensor + +Returns this tensor as the same shape as :attr:`other`. +``self.reshape_as(other)`` is equivalent to ``self.reshape(other.sizes())``. +This method returns a view if ``other.sizes()`` is compatible with the current +shape. See :meth:`torch.Tensor.view` on when it is possible to return a view. + +Please see :meth:`reshape` for more information about ``reshape``. + +Args: + other (:class:`torch.Tensor`): The result tensor has the same shape + as :attr:`other`. +""", +) + +add_docstr_all( + "resize_", + r""" +resize_(*sizes, memory_format=torch.contiguous_format) -> Tensor + +Resizes :attr:`self` tensor to the specified size. If the number of elements is +larger than the current storage size, then the underlying storage is resized +to fit the new number of elements. If the number of elements is smaller, the +underlying storage is not changed. Existing elements are preserved but any new +memory is uninitialized. + +.. warning:: + + This is a low-level method. The storage is reinterpreted as C-contiguous, + ignoring the current strides (unless the target size equals the current + size, in which case the tensor is left unchanged). For most purposes, you + will instead want to use :meth:`~Tensor.view()`, which checks for + contiguity, or :meth:`~Tensor.reshape()`, which copies data if needed. To + change the size in-place with custom strides, see :meth:`~Tensor.set_()`. + +.. note:: + + If :func:`torch.use_deterministic_algorithms()` and + :attr:`torch.utils.deterministic.fill_uninitialized_memory` are both set to + ``True``, new elements are initialized to prevent nondeterministic behavior + from using the result as an input to an operation. Floating point and + complex values are set to NaN, and integer values are set to the maximum + value. + +Args: + sizes (torch.Size or int...): the desired size + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + Tensor. Default: ``torch.contiguous_format``. Note that memory format of + :attr:`self` is going to be unaffected if ``self.size()`` matches ``sizes``. + +Example:: + + >>> x = torch.tensor([[1, 2], [3, 4], [5, 6]]) + >>> x.resize_(2, 2) + tensor([[ 1, 2], + [ 3, 4]]) +""", +) + +add_docstr_all( + "resize_as_", + r""" +resize_as_(tensor, memory_format=torch.contiguous_format) -> Tensor + +Resizes the :attr:`self` tensor to be the same size as the specified +:attr:`tensor`. This is equivalent to ``self.resize_(tensor.size())``. + +Args: + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + Tensor. Default: ``torch.contiguous_format``. Note that memory format of + :attr:`self` is going to be unaffected if ``self.size()`` matches ``tensor.size()``. + +""", +) + +add_docstr_all( + "rot90", + r""" +rot90(k, dims) -> Tensor + +See :func:`torch.rot90` +""", +) + +add_docstr_all( + "round", + r""" +round(decimals=0) -> Tensor + +See :func:`torch.round` +""", +) + +add_docstr_all( + "round_", + r""" +round_(decimals=0) -> Tensor + +In-place version of :meth:`~Tensor.round` +""", +) + +add_docstr_all( + "rsqrt", + r""" +rsqrt() -> Tensor + +See :func:`torch.rsqrt` +""", +) + +add_docstr_all( + "rsqrt_", + r""" +rsqrt_() -> Tensor + +In-place version of :meth:`~Tensor.rsqrt` +""", +) + +add_docstr_all( + "scatter_", + r""" +scatter_(dim, index, src, *, reduce=None) -> Tensor + +Writes all values from the tensor :attr:`src` into :attr:`self` at the indices +specified in the :attr:`index` tensor. For each value in :attr:`src`, its output +index is specified by its index in :attr:`src` for ``dimension != dim`` and by +the corresponding value in :attr:`index` for ``dimension = dim``. + +For a 3-D tensor, :attr:`self` is updated as:: + + self[index[i][j][k]][j][k] = src[i][j][k] # if dim == 0 + self[i][index[i][j][k]][k] = src[i][j][k] # if dim == 1 + self[i][j][index[i][j][k]] = src[i][j][k] # if dim == 2 + +This is the reverse operation of the manner described in :meth:`~Tensor.gather`. + +It is also required that +``index.size(d) <= src.size(d)`` for all dimensions ``d``, and that +``index.size(d) <= self.size(d)`` for all dimensions ``d != dim``. +Note that ``input`` and ``index`` do not broadcast against each other for NPUs, +so when running on NPUs, :attr:`input` and :attr:`index` must have the same number of dimensions. +Standard broadcasting occurs in all other cases. + +Moreover, as for :meth:`~Tensor.gather`, the values of :attr:`index` must be +between ``0`` and ``self.size(dim) - 1`` inclusive. + +.. warning:: + + When indices are not unique, the behavior is non-deterministic (one of the + values from ``src`` will be picked arbitrarily) and the gradient will be + incorrect (it will be propagated to all locations in the source that + correspond to the same index)! + +.. note:: + + The backward pass is implemented only for ``src.shape == index.shape``. + +Additionally accepts an optional :attr:`reduce` argument that allows +specification of an optional reduction operation, which is applied to all +values in the tensor :attr:`src` into :attr:`self` at the indices +specified in the :attr:`index`. For each value in :attr:`src`, the reduction +operation is applied to an index in :attr:`self` which is specified by +its index in :attr:`src` for ``dimension != dim`` and by the corresponding +value in :attr:`index` for ``dimension = dim``. + +Given a 3-D tensor and reduction using the multiplication operation, :attr:`self` +is updated as:: + + self[index[i][j][k]][j][k] *= src[i][j][k] # if dim == 0 + self[i][index[i][j][k]][k] *= src[i][j][k] # if dim == 1 + self[i][j][index[i][j][k]] *= src[i][j][k] # if dim == 2 + +Reducing with the addition operation is the same as using +:meth:`~torch.Tensor.scatter_add_`. + +.. warning:: + The reduce argument with Tensor ``src`` is deprecated and will be removed in + a future PyTorch release. Please use :meth:`~torch.Tensor.scatter_reduce_` + instead for more reduction options. + +Args: + dim (int): the axis along which to index + index (LongTensor): the indices of elements to scatter, can be either empty + or of the same dimensionality as ``src``. When empty, the operation + returns ``self`` unchanged. + src (Tensor): the source element(s) to scatter. + +Keyword args: + reduce (str, optional): reduction operation to apply, can be either + ``'add'`` or ``'multiply'``. + +Example:: + + >>> src = torch.arange(1, 11).reshape((2, 5)) + >>> src + tensor([[ 1, 2, 3, 4, 5], + [ 6, 7, 8, 9, 10]]) + >>> index = torch.tensor([[0, 1, 2, 0]]) + >>> torch.zeros(3, 5, dtype=src.dtype).scatter_(0, index, src) + tensor([[1, 0, 0, 4, 0], + [0, 2, 0, 0, 0], + [0, 0, 3, 0, 0]]) + >>> index = torch.tensor([[0, 1, 2], [0, 1, 4]]) + >>> torch.zeros(3, 5, dtype=src.dtype).scatter_(1, index, src) + tensor([[1, 2, 3, 0, 0], + [6, 7, 0, 0, 8], + [0, 0, 0, 0, 0]]) + + >>> torch.full((2, 4), 2.).scatter_(1, torch.tensor([[2], [3]]), + ... 1.23, reduce='multiply') + tensor([[2.0000, 2.0000, 2.4600, 2.0000], + [2.0000, 2.0000, 2.0000, 2.4600]]) + >>> torch.full((2, 4), 2.).scatter_(1, torch.tensor([[2], [3]]), + ... 1.23, reduce='add') + tensor([[2.0000, 2.0000, 3.2300, 2.0000], + [2.0000, 2.0000, 2.0000, 3.2300]]) + +.. function:: scatter_(dim, index, value, *, reduce=None) -> Tensor: + :noindex: + +Writes the value from :attr:`value` into :attr:`self` at the indices +specified in the :attr:`index` tensor. This operation is equivalent to the previous version, +with the :attr:`src` tensor filled entirely with :attr:`value`. + +Args: + dim (int): the axis along which to index + index (LongTensor): the indices of elements to scatter, can be either empty + or of the same dimensionality as ``src``. When empty, the operation + returns ``self`` unchanged. + value (Scalar): the value to scatter. + +Keyword args: + reduce (str, optional): reduction operation to apply, can be either + ``'add'`` or ``'multiply'``. + +Example:: + + >>> index = torch.tensor([[0, 1]]) + >>> value = 2 + >>> torch.zeros(3, 5).scatter_(0, index, value) + tensor([[2., 0., 0., 0., 0.], + [0., 2., 0., 0., 0.], + [0., 0., 0., 0., 0.]]) +""", +) + +add_docstr_all( + "scatter_add_", + r""" +scatter_add_(dim, index, src) -> Tensor + +Adds all values from the tensor :attr:`src` into :attr:`self` at the indices +specified in the :attr:`index` tensor in a similar fashion as +:meth:`~torch.Tensor.scatter_`. For each value in :attr:`src`, it is added to +an index in :attr:`self` which is specified by its index in :attr:`src` +for ``dimension != dim`` and by the corresponding value in :attr:`index` for +``dimension = dim``. + +For a 3-D tensor, :attr:`self` is updated as:: + + self[index[i][j][k]][j][k] += src[i][j][k] # if dim == 0 + self[i][index[i][j][k]][k] += src[i][j][k] # if dim == 1 + self[i][j][index[i][j][k]] += src[i][j][k] # if dim == 2 + +:attr:`self`, :attr:`index` and :attr:`src` should have same number of +dimensions. It is also required that ``index.size(d) <= src.size(d)`` for all +dimensions ``d``, and that ``index.size(d) <= self.size(d)`` for all dimensions +``d != dim``. Note that ``index`` and ``src`` do not broadcast. +When :attr:`index` is empty, we always return the original tensor +without further error checking. + +Note: + {forward_reproducibility_note} + +.. note:: + + The backward pass is implemented only for ``src.shape == index.shape``. + +Args: + dim (int): the axis along which to index + index (LongTensor): the indices of elements to scatter and add, can be + either empty or of the same dimensionality as ``src``. When empty, the + operation returns ``self`` unchanged. + src (Tensor): the source elements to scatter and add + +Example:: + + >>> src = torch.ones((2, 5)) + >>> index = torch.tensor([[0, 1, 2, 0, 0]]) + >>> torch.zeros(3, 5, dtype=src.dtype).scatter_add_(0, index, src) + tensor([[1., 0., 0., 1., 1.], + [0., 1., 0., 0., 0.], + [0., 0., 1., 0., 0.]]) + >>> index = torch.tensor([[0, 1, 2, 0, 0], [0, 1, 2, 2, 2]]) + >>> torch.zeros(3, 5, dtype=src.dtype).scatter_add_(0, index, src) + tensor([[2., 0., 0., 1., 1.], + [0., 2., 0., 0., 0.], + [0., 0., 2., 1., 1.]]) + +""".format(**reproducibility_notes), +) + +add_docstr_all( + "scatter_reduce_", + r""" +scatter_reduce_(dim, index, src, reduce, *, include_self=True) -> Tensor + +Reduces all values from the :attr:`src` tensor to the indices specified in +the :attr:`index` tensor in the :attr:`self` tensor using the applied reduction +defined via the :attr:`reduce` argument (:obj:`"sum"`, :obj:`"prod"`, :obj:`"mean"`, +:obj:`"amax"`, :obj:`"amin"`). For each value in :attr:`src`, it is reduced to an +index in :attr:`self` which is specified by its index in :attr:`src` for +``dimension != dim`` and by the corresponding value in :attr:`index` for +``dimension = dim``. If :obj:`include_self="True"`, the values in the :attr:`self` +tensor are included in the reduction. + +:attr:`self`, :attr:`index` and :attr:`src` should all have +the same number of dimensions. It is also required that +``index.size(d) <= src.size(d)`` for all dimensions ``d``, and that +``index.size(d) <= self.size(d)`` for all dimensions ``d != dim``. +Note that ``index`` and ``src`` do not broadcast. + +For a 3-D tensor with :obj:`reduce="sum"` and :obj:`include_self=True` the +output is given as:: + + self[index[i][j][k]][j][k] += src[i][j][k] # if dim == 0 + self[i][index[i][j][k]][k] += src[i][j][k] # if dim == 1 + self[i][j][index[i][j][k]] += src[i][j][k] # if dim == 2 + +Note: + {forward_reproducibility_note} + +.. note:: + + The backward pass is implemented only for ``src.shape == index.shape``. + +.. warning:: + + This function is in beta and may change in the near future. + +Args: + dim (int): the axis along which to index + index (LongTensor): the indices of elements to scatter and reduce. + src (Tensor): the source elements to scatter and reduce + reduce (str): the reduction operation to apply for non-unique indices + (:obj:`"sum"`, :obj:`"prod"`, :obj:`"mean"`, :obj:`"amax"`, :obj:`"amin"`) + include_self (bool): whether elements from the :attr:`self` tensor are + included in the reduction + +Example:: + + >>> src = torch.tensor([1., 2., 3., 4., 5., 6.]) + >>> index = torch.tensor([0, 1, 0, 1, 2, 1]) + >>> input = torch.tensor([1., 2., 3., 4.]) + >>> input.scatter_reduce(0, index, src, reduce="sum") + tensor([5., 14., 8., 4.]) + >>> input.scatter_reduce(0, index, src, reduce="sum", include_self=False) + tensor([4., 12., 5., 4.]) + >>> input2 = torch.tensor([5., 4., 3., 2.]) + >>> input2.scatter_reduce(0, index, src, reduce="amax") + tensor([5., 6., 5., 2.]) + >>> input2.scatter_reduce(0, index, src, reduce="amax", include_self=False) + tensor([3., 6., 5., 2.]) + + +""".format(**reproducibility_notes), +) + +add_docstr_all( + "select", + r""" +select(dim, index) -> Tensor + +See :func:`torch.select` +""", +) + +add_docstr_all( + "select_scatter", + r""" +select_scatter(src, dim, index) -> Tensor + +See :func:`torch.select_scatter` +""", +) + +add_docstr_all( + "slice_scatter", + r""" +slice_scatter(src, dim=0, start=None, end=None, step=1) -> Tensor + +See :func:`torch.slice_scatter` +""", +) + +add_docstr_all( + "set_", + r""" +set_(source=None, storage_offset=0, size=None, stride=None) -> Tensor + +Sets the underlying storage, size, and strides. If :attr:`source` is a tensor, +:attr:`self` tensor will share the same storage and have the same size and +strides as :attr:`source`. Changes to elements in one tensor will be reflected +in the other. + +If :attr:`source` is a :class:`~torch.Storage`, the method sets the underlying +storage, offset, size, and stride. + +Args: + source (Tensor or Storage): the tensor or storage to use + storage_offset (int, optional): the offset in the storage + size (torch.Size, optional): the desired size. Defaults to the size of the source. + stride (tuple, optional): the desired stride. Defaults to C-contiguous strides. +""", +) + +add_docstr_all( + "sigmoid", + r""" +sigmoid() -> Tensor + +See :func:`torch.sigmoid` +""", +) + +add_docstr_all( + "sigmoid_", + r""" +sigmoid_() -> Tensor + +In-place version of :meth:`~Tensor.sigmoid` +""", +) + +add_docstr_all( + "logit", + r""" +logit() -> Tensor + +See :func:`torch.logit` +""", +) + +add_docstr_all( + "logit_", + r""" +logit_() -> Tensor + +In-place version of :meth:`~Tensor.logit` +""", +) + +add_docstr_all( + "sign", + r""" +sign() -> Tensor + +See :func:`torch.sign` +""", +) + +add_docstr_all( + "sign_", + r""" +sign_() -> Tensor + +In-place version of :meth:`~Tensor.sign` +""", +) + +add_docstr_all( + "signbit", + r""" +signbit() -> Tensor + +See :func:`torch.signbit` +""", +) + +add_docstr_all( + "sgn", + r""" +sgn() -> Tensor + +See :func:`torch.sgn` +""", +) + +add_docstr_all( + "sgn_", + r""" +sgn_() -> Tensor + +In-place version of :meth:`~Tensor.sgn` +""", +) + +add_docstr_all( + "sin", + r""" +sin() -> Tensor + +See :func:`torch.sin` +""", +) + +add_docstr_all( + "sin_", + r""" +sin_() -> Tensor + +In-place version of :meth:`~Tensor.sin` +""", +) + +add_docstr_all( + "sinc", + r""" +sinc() -> Tensor + +See :func:`torch.sinc` +""", +) + +add_docstr_all( + "sinc_", + r""" +sinc_() -> Tensor + +In-place version of :meth:`~Tensor.sinc` +""", +) + +add_docstr_all( + "sinh", + r""" +sinh() -> Tensor + +See :func:`torch.sinh` +""", +) + +add_docstr_all( + "sinh_", + r""" +sinh_() -> Tensor + +In-place version of :meth:`~Tensor.sinh` +""", +) + +add_docstr_all( + "size", + r""" +size(dim=None) -> torch.Size or int + +Returns the size of the :attr:`self` tensor. If ``dim`` is not specified, +the returned value is a :class:`torch.Size`, a subclass of :class:`tuple`. +If ``dim`` is specified, returns an int holding the size of that dimension. + +Args: + dim (int, optional): The dimension for which to retrieve the size. + +Example:: + + >>> t = torch.empty(3, 4, 5) + >>> t.size() + torch.Size([3, 4, 5]) + >>> t.size(dim=1) + 4 + +""", +) + +add_docstr_all( + "shape", + r""" +shape() -> torch.Size + +Returns the size of the :attr:`self` tensor. Alias for :attr:`size`. + +See also :meth:`Tensor.size`. + +Example:: + + >>> t = torch.empty(3, 4, 5) + >>> t.size() + torch.Size([3, 4, 5]) + >>> t.shape + torch.Size([3, 4, 5]) + +""", +) + +add_docstr_all( + "sort", + r""" +sort(dim=-1, descending=False) -> (Tensor, LongTensor) + +See :func:`torch.sort` +""", +) + +add_docstr_all( + "msort", + r""" +msort() -> Tensor + +See :func:`torch.msort` +""", +) + +add_docstr_all( + "argsort", + r""" +argsort(dim=-1, descending=False) -> LongTensor + +See :func:`torch.argsort` +""", +) + +add_docstr_all( + "sparse_dim", + r""" +sparse_dim() -> int + +Return the number of sparse dimensions in a :ref:`sparse tensor ` :attr:`self`. + +.. note:: + Returns ``0`` if :attr:`self` is not a sparse tensor. + +See also :meth:`Tensor.dense_dim` and :ref:`hybrid tensors `. +""", +) + +add_docstr_all( + "sparse_resize_", + r""" +sparse_resize_(size, sparse_dim, dense_dim) -> Tensor + +Resizes :attr:`self` :ref:`sparse tensor ` to the desired +size and the number of sparse and dense dimensions. + +.. note:: + If the number of specified elements in :attr:`self` is zero, then + :attr:`size`, :attr:`sparse_dim`, and :attr:`dense_dim` can be any + size and positive integers such that ``len(size) == sparse_dim + + dense_dim``. + + If :attr:`self` specifies one or more elements, however, then each + dimension in :attr:`size` must not be smaller than the corresponding + dimension of :attr:`self`, :attr:`sparse_dim` must equal the number + of sparse dimensions in :attr:`self`, and :attr:`dense_dim` must + equal the number of dense dimensions in :attr:`self`. + +.. warning:: + Throws an error if :attr:`self` is not a sparse tensor. + +Args: + size (torch.Size): the desired size. If :attr:`self` is non-empty + sparse tensor, the desired size cannot be smaller than the + original size. + sparse_dim (int): the number of sparse dimensions + dense_dim (int): the number of dense dimensions +""", +) + +add_docstr_all( + "sparse_resize_and_clear_", + r""" +sparse_resize_and_clear_(size, sparse_dim, dense_dim) -> Tensor + +Removes all specified elements from a :ref:`sparse tensor +` :attr:`self` and resizes :attr:`self` to the desired +size and the number of sparse and dense dimensions. + +.. warning: + Throws an error if :attr:`self` is not a sparse tensor. + +Args: + size (torch.Size): the desired size. + sparse_dim (int): the number of sparse dimensions + dense_dim (int): the number of dense dimensions +""", +) + +add_docstr_all( + "sqrt", + r""" +sqrt() -> Tensor + +See :func:`torch.sqrt` +""", +) + +add_docstr_all( + "sqrt_", + r""" +sqrt_() -> Tensor + +In-place version of :meth:`~Tensor.sqrt` +""", +) + +add_docstr_all( + "square", + r""" +square() -> Tensor + +See :func:`torch.square` +""", +) + +add_docstr_all( + "square_", + r""" +square_() -> Tensor + +In-place version of :meth:`~Tensor.square` +""", +) + +add_docstr_all( + "squeeze", + r""" +squeeze(dim=None) -> Tensor + +See :func:`torch.squeeze` +""", +) + +add_docstr_all( + "squeeze_", + r""" +squeeze_(dim=None) -> Tensor + +In-place version of :meth:`~Tensor.squeeze` +""", +) + +add_docstr_all( + "std", + r""" +std(dim=None, *, correction=1, keepdim=False) -> Tensor + +See :func:`torch.std` +""", +) + +add_docstr_all( + "storage_offset", + r""" +storage_offset() -> int + +Returns :attr:`self` tensor's offset in the underlying storage in terms of +number of storage elements (not bytes). + +Example:: + + >>> x = torch.tensor([1, 2, 3, 4, 5]) + >>> x.storage_offset() + 0 + >>> x[3:].storage_offset() + 3 + +""", +) + +add_docstr_all( + "untyped_storage", + r""" +untyped_storage() -> torch.UntypedStorage + +Returns the underlying :class:`UntypedStorage`. +""", +) + +add_docstr_all( + "stride", + r""" +stride(dim) -> tuple or int + +Returns the stride of :attr:`self` tensor. + +Stride is the jump necessary to go from one element to the next one in the +specified dimension :attr:`dim`. A tuple of all strides is returned when no +argument is passed in. Otherwise, an integer value is returned as the stride in +the particular dimension :attr:`dim`. + +Args: + dim (int, optional): the desired dimension in which stride is required + +Example:: + + >>> x = torch.tensor([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) + >>> x.stride() + (5, 1) + >>> x.stride(0) + 5 + >>> x.stride(-1) + 1 + +""", +) + +add_docstr_all( + "sub", + r""" +sub(other, *, alpha=1) -> Tensor + +See :func:`torch.sub`. +""", +) + +add_docstr_all( + "sub_", + r""" +sub_(other, *, alpha=1) -> Tensor + +In-place version of :meth:`~Tensor.sub` +""", +) + +add_docstr_all( + "subtract", + r""" +subtract(other, *, alpha=1) -> Tensor + +See :func:`torch.subtract`. +""", +) + +add_docstr_all( + "subtract_", + r""" +subtract_(other, *, alpha=1) -> Tensor + +In-place version of :meth:`~Tensor.subtract`. +""", +) + +add_docstr_all( + "sum", + r""" +sum(dim=None, keepdim=False, dtype=None) -> Tensor + +See :func:`torch.sum` +""", +) + +add_docstr_all( + "nansum", + r""" +nansum(dim=None, keepdim=False, dtype=None) -> Tensor + +See :func:`torch.nansum` +""", +) + +add_docstr_all( + "svd", + r""" +svd(some=True, compute_uv=True) -> (Tensor, Tensor, Tensor) + +See :func:`torch.svd` +""", +) + +add_docstr_all( + "swapdims", + r""" +swapdims(dim0, dim1) -> Tensor + +See :func:`torch.swapdims` +""", +) + +add_docstr_all( + "swapdims_", + r""" +swapdims_(dim0, dim1) -> Tensor + +In-place version of :meth:`~Tensor.swapdims` +""", +) + +add_docstr_all( + "swapaxes", + r""" +swapaxes(axis0, axis1) -> Tensor + +See :func:`torch.swapaxes` +""", +) + +add_docstr_all( + "swapaxes_", + r""" +swapaxes_(axis0, axis1) -> Tensor + +In-place version of :meth:`~Tensor.swapaxes` +""", +) + +add_docstr_all( + "t", + r""" +t() -> Tensor + +See :func:`torch.t` +""", +) + +add_docstr_all( + "t_", + r""" +t_() -> Tensor + +In-place version of :meth:`~Tensor.t` +""", +) + +add_docstr_all( + "tile", + r""" +tile(dims) -> Tensor + +See :func:`torch.tile` +""", +) + +add_docstr_all( + "to", + r""" +to(*args, **kwargs) -> Tensor + +Performs Tensor dtype and/or device conversion. A :class:`torch.dtype` and :class:`torch.device` are +inferred from the arguments of ``self.to(*args, **kwargs)``. + +.. note:: + + If the ``self`` Tensor already + has the correct :class:`torch.dtype` and :class:`torch.device`, then ``self`` is returned. + Otherwise, the returned tensor is a copy of ``self`` with the desired + :class:`torch.dtype` and :class:`torch.device`. + +.. note:: + + If ``self`` requires gradients (``requires_grad=True``) but the target + ``dtype`` specified is an integer type, the returned tensor will implicitly + set ``requires_grad=False``. This is because only tensors with + floating-point or complex dtypes can require gradients. + +Here are the ways to call ``to``: + +.. method:: to(dtype, non_blocking=False, copy=False, memory_format=torch.preserve_format) -> Tensor + :noindex: + + Returns a Tensor with the specified :attr:`dtype` + + Args: + {memory_format} + +.. note:: + + According to `C++ type conversion rules `_, + converting floating point value to integer type will truncate the fractional part. + If the truncated value cannot fit into the target type (e.g., casting ``torch.inf`` to ``torch.long``), + the behavior is undefined and the result may vary across platforms. + +.. method:: to(device=None, dtype=None, non_blocking=False, copy=False, memory_format=torch.preserve_format) -> Tensor + :noindex: + + Returns a Tensor with the specified :attr:`device` and (optional) + :attr:`dtype`. If :attr:`dtype` is ``None`` it is inferred to be ``self.dtype``. + When :attr:`non_blocking` is set to ``True``, the function attempts to perform + the conversion asynchronously with respect to the host, if possible. This + asynchronous behavior applies to both pinned and pageable memory. However, + caution is advised when using this feature. For more information, refer to the + `tutorial on good usage of non_blocking and pin_memory `__. + When :attr:`copy` is set, a new Tensor is created even when the Tensor + already matches the desired conversion. + + Args: + {memory_format} + +.. method:: to(other, non_blocking=False, copy=False) -> Tensor + :noindex: + + Returns a Tensor with same :class:`torch.dtype` and :class:`torch.device` as + the Tensor :attr:`other`. + When :attr:`non_blocking` is set to ``True``, the function attempts to perform + the conversion asynchronously with respect to the host, if possible. This + asynchronous behavior applies to both pinned and pageable memory. However, + caution is advised when using this feature. For more information, refer to the + `tutorial on good usage of non_blocking and pin_memory `__. + When :attr:`copy` is set, a new Tensor is created even when the Tensor + already matches the desired conversion. + +Example:: + + >>> tensor = torch.randn(2, 2) # Initially dtype=float32, device=cpu + >>> tensor.to(torch.float64) + tensor([[-0.5044, 0.0005], + [ 0.3310, -0.0584]], dtype=torch.float64) + + >>> cuda0 = torch.device('cuda:0') + >>> tensor.to(cuda0) + tensor([[-0.5044, 0.0005], + [ 0.3310, -0.0584]], device='cuda:0') + + >>> tensor.to(cuda0, dtype=torch.float64) + tensor([[-0.5044, 0.0005], + [ 0.3310, -0.0584]], dtype=torch.float64, device='cuda:0') + + >>> other = torch.randn((), dtype=torch.float64, device=cuda0) + >>> tensor.to(other, non_blocking=True) + tensor([[-0.5044, 0.0005], + [ 0.3310, -0.0584]], dtype=torch.float64, device='cuda:0') +""".format(**common_args), +) + +add_docstr_all( + "byte", + r""" +byte(memory_format=torch.preserve_format) -> Tensor + +``self.byte()`` is equivalent to ``self.to(torch.uint8)``. See :func:`to`. + +Args: + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "bool", + r""" +bool(memory_format=torch.preserve_format) -> Tensor + +``self.bool()`` is equivalent to ``self.to(torch.bool)``. See :func:`to`. + +Args: + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "char", + r""" +char(memory_format=torch.preserve_format) -> Tensor + +``self.char()`` is equivalent to ``self.to(torch.int8)``. See :func:`to`. + +Args: + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "bfloat16", + r""" +bfloat16(memory_format=torch.preserve_format) -> Tensor +``self.bfloat16()`` is equivalent to ``self.to(torch.bfloat16)``. See :func:`to`. + +Args: + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "double", + r""" +double(memory_format=torch.preserve_format) -> Tensor + +``self.double()`` is equivalent to ``self.to(torch.float64)``. See :func:`to`. + +Args: + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "float", + r""" +float(memory_format=torch.preserve_format) -> Tensor + +``self.float()`` is equivalent to ``self.to(torch.float32)``. See :func:`to`. + +Args: + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "cdouble", + r""" +cdouble(memory_format=torch.preserve_format) -> Tensor + +``self.cdouble()`` is equivalent to ``self.to(torch.complex128)``. See :func:`to`. + +Args: + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "cfloat", + r""" +cfloat(memory_format=torch.preserve_format) -> Tensor + +``self.cfloat()`` is equivalent to ``self.to(torch.complex64)``. See :func:`to`. + +Args: + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "chalf", + r""" +chalf(memory_format=torch.preserve_format) -> Tensor + +``self.chalf()`` is equivalent to ``self.to(torch.complex32)``. See :func:`to`. + +Args: + {memory_format} + """.format(**common_args), +) + +add_docstr_all( + "half", + r""" +half(memory_format=torch.preserve_format) -> Tensor + +``self.half()`` is equivalent to ``self.to(torch.float16)``. See :func:`to`. + +Args: + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "int", + r""" +int(memory_format=torch.preserve_format) -> Tensor + +``self.int()`` is equivalent to ``self.to(torch.int32)``. See :func:`to`. + +Args: + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "int_repr", + r""" +int_repr() -> Tensor + +Given a quantized Tensor, +``self.int_repr()`` returns a CPU Tensor with uint8_t as data type that stores the +underlying uint8_t values of the given Tensor. +""", +) + + +add_docstr_all( + "long", + r""" +long(memory_format=torch.preserve_format) -> Tensor + +``self.long()`` is equivalent to ``self.to(torch.int64)``. See :func:`to`. + +Args: + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "short", + r""" +short(memory_format=torch.preserve_format) -> Tensor + +``self.short()`` is equivalent to ``self.to(torch.int16)``. See :func:`to`. + +Args: + {memory_format} +""".format(**common_args), +) + +add_docstr_all( + "take", + r""" +take(indices) -> Tensor + +See :func:`torch.take` +""", +) + +add_docstr_all( + "take_along_dim", + r""" +take_along_dim(indices, dim) -> Tensor + +See :func:`torch.take_along_dim` +""", +) + +add_docstr_all( + "tan", + r""" +tan() -> Tensor + +See :func:`torch.tan` +""", +) + +add_docstr_all( + "tan_", + r""" +tan_() -> Tensor + +In-place version of :meth:`~Tensor.tan` +""", +) + +add_docstr_all( + "tanh", + r""" +tanh() -> Tensor + +See :func:`torch.tanh` +""", +) + +add_docstr_all( + "softmax", + r""" +softmax(dim) -> Tensor + +Alias for :func:`torch.nn.functional.softmax`. +""", +) + +add_docstr_all( + "tanh_", + r""" +tanh_() -> Tensor + +In-place version of :meth:`~Tensor.tanh` +""", +) + +add_docstr_all( + "tolist", + r""" +tolist() -> list or number + +Returns the tensor as a (nested) list. For scalars, a standard +Python number is returned, just like with :meth:`~Tensor.item`. +Tensors are automatically moved to the CPU first if necessary. + +This operation is not differentiable. + +Examples:: + + >>> a = torch.randn(2, 2) + >>> a.tolist() + [[0.012766935862600803, 0.5415473580360413], + [-0.08909505605697632, 0.7729271650314331]] + >>> a[0,0].tolist() + 0.012766935862600803 +""", +) + +add_docstr_all( + "topk", + r""" +topk(k, dim=None, largest=True, sorted=True) -> (Tensor, LongTensor) + +See :func:`torch.topk` +""", +) + +add_docstr_all( + "to_dense", + r""" +to_dense(dtype=None, *, masked_grad=True) -> Tensor + +Creates a strided copy of :attr:`self` if :attr:`self` is not a strided tensor, otherwise returns :attr:`self`. + +Keyword args: + {dtype} + masked_grad (bool, optional): If set to ``True`` (default) and + :attr:`self` has a sparse layout then the backward of + :meth:`to_dense` returns ``grad.sparse_mask(self)``. + +Example:: + + >>> s = torch.sparse_coo_tensor( + ... torch.tensor([[1, 1], + ... [0, 2]]), + ... torch.tensor([9, 10]), + ... size=(3, 3)) + >>> s.to_dense() + tensor([[ 0, 0, 0], + [ 9, 0, 10], + [ 0, 0, 0]]) +""", +) + +add_docstr_all( + "to_sparse", + r""" +to_sparse(sparseDims) -> Tensor + +Returns a sparse copy of the tensor. PyTorch supports sparse tensors in +:ref:`coordinate format `. + +Args: + sparseDims (int, optional): the number of sparse dimensions to include in the new sparse tensor + +Example:: + + >>> d = torch.tensor([[0, 0, 0], [9, 0, 10], [0, 0, 0]]) + >>> d + tensor([[ 0, 0, 0], + [ 9, 0, 10], + [ 0, 0, 0]]) + >>> d.to_sparse() + tensor(indices=tensor([[1, 1], + [0, 2]]), + values=tensor([ 9, 10]), + size=(3, 3), nnz=2, layout=torch.sparse_coo) + >>> d.to_sparse(1) + tensor(indices=tensor([[1]]), + values=tensor([[ 9, 0, 10]]), + size=(3, 3), nnz=1, layout=torch.sparse_coo) + +.. method:: to_sparse(*, layout=None, blocksize=None, dense_dim=None) -> Tensor + :noindex: + +Returns a sparse tensor with the specified layout and blocksize. If +the :attr:`self` is strided, the number of dense dimensions could be +specified, and a hybrid sparse tensor will be created, with +`dense_dim` dense dimensions and `self.dim() - 2 - dense_dim` batch +dimension. + +.. note:: If the :attr:`self` layout and blocksize parameters match + with the specified layout and blocksize, return + :attr:`self`. Otherwise, return a sparse tensor copy of + :attr:`self`. + +Args: + + layout (:class:`torch.layout`, optional): The desired sparse + layout. One of ``torch.sparse_coo``, ``torch.sparse_csr``, + ``torch.sparse_csc``, ``torch.sparse_bsr``, or + ``torch.sparse_bsc``. Default: if ``None``, + ``torch.sparse_coo``. + + blocksize (list, tuple, :class:`torch.Size`, optional): Block size + of the resulting BSR or BSC tensor. For other layouts, + specifying the block size that is not ``None`` will result in a + RuntimeError exception. A block size must be a tuple of length + two such that its items evenly divide the two sparse dimensions. + + dense_dim (int, optional): Number of dense dimensions of the + resulting CSR, CSC, BSR or BSC tensor. This argument should be + used only if :attr:`self` is a strided tensor, and must be a + value between 0 and dimension of :attr:`self` tensor minus two. + +Example:: + + >>> x = torch.tensor([[1, 0], [0, 0], [2, 3]]) + >>> x.to_sparse(layout=torch.sparse_coo) + tensor(indices=tensor([[0, 2, 2], + [0, 0, 1]]), + values=tensor([1, 2, 3]), + size=(3, 2), nnz=3, layout=torch.sparse_coo) + >>> x.to_sparse(layout=torch.sparse_bsr, blocksize=(1, 2)) + tensor(crow_indices=tensor([0, 1, 1, 2]), + col_indices=tensor([0, 0]), + values=tensor([[[1, 0]], + [[2, 3]]]), size=(3, 2), nnz=2, layout=torch.sparse_bsr) + >>> x.to_sparse(layout=torch.sparse_bsr, blocksize=(2, 1)) + RuntimeError: Tensor size(-2) 3 needs to be divisible by blocksize[0] 2 + >>> x.to_sparse(layout=torch.sparse_csr, blocksize=(3, 1)) + RuntimeError: to_sparse for Strided to SparseCsr conversion does not use specified blocksize + + >>> x = torch.tensor([[[1], [0]], [[0], [0]], [[2], [3]]]) + >>> x.to_sparse(layout=torch.sparse_csr, dense_dim=1) + tensor(crow_indices=tensor([0, 1, 1, 3]), + col_indices=tensor([0, 0, 1]), + values=tensor([[1], + [2], + [3]]), size=(3, 2, 1), nnz=3, layout=torch.sparse_csr) + +""", +) + +add_docstr_all( + "to_sparse_csr", + r""" +to_sparse_csr(dense_dim=None) -> Tensor + +Convert a tensor to compressed row storage format (CSR). Except for +strided tensors, only works with 2D tensors. If the :attr:`self` is +strided, then the number of dense dimensions could be specified, and a +hybrid CSR tensor will be created, with `dense_dim` dense dimensions +and `self.dim() - 2 - dense_dim` batch dimension. + +Args: + + dense_dim (int, optional): Number of dense dimensions of the + resulting CSR tensor. This argument should be used only if + :attr:`self` is a strided tensor, and must be a value between 0 + and dimension of :attr:`self` tensor minus two. + +Example:: + + >>> dense = torch.randn(5, 5) + >>> sparse = dense.to_sparse_csr() + >>> sparse._nnz() + 25 + + >>> dense = torch.zeros(3, 3, 1, 1) + >>> dense[0, 0] = dense[1, 2] = dense[2, 1] = 1 + >>> dense.to_sparse_csr(dense_dim=2) + tensor(crow_indices=tensor([0, 1, 2, 3]), + col_indices=tensor([0, 2, 1]), + values=tensor([[[1.]], + + [[1.]], + + [[1.]]]), size=(3, 3, 1, 1), nnz=3, + layout=torch.sparse_csr) + +""", +) + +add_docstr_all( + "to_sparse_csc", + r""" +to_sparse_csc() -> Tensor + +Convert a tensor to compressed column storage (CSC) format. Except +for strided tensors, only works with 2D tensors. If the :attr:`self` +is strided, then the number of dense dimensions could be specified, +and a hybrid CSC tensor will be created, with `dense_dim` dense +dimensions and `self.dim() - 2 - dense_dim` batch dimension. + +Args: + + dense_dim (int, optional): Number of dense dimensions of the + resulting CSC tensor. This argument should be used only if + :attr:`self` is a strided tensor, and must be a value between 0 + and dimension of :attr:`self` tensor minus two. + +Example:: + + >>> dense = torch.randn(5, 5) + >>> sparse = dense.to_sparse_csc() + >>> sparse._nnz() + 25 + + >>> dense = torch.zeros(3, 3, 1, 1) + >>> dense[0, 0] = dense[1, 2] = dense[2, 1] = 1 + >>> dense.to_sparse_csc(dense_dim=2) + tensor(ccol_indices=tensor([0, 1, 2, 3]), + row_indices=tensor([0, 2, 1]), + values=tensor([[[1.]], + + [[1.]], + + [[1.]]]), size=(3, 3, 1, 1), nnz=3, + layout=torch.sparse_csc) + +""", +) + +add_docstr_all( + "to_sparse_bsr", + r""" +to_sparse_bsr(blocksize, dense_dim) -> Tensor + +Convert a tensor to a block sparse row (BSR) storage format of given +blocksize. If the :attr:`self` is strided, then the number of dense +dimensions could be specified, and a hybrid BSR tensor will be +created, with `dense_dim` dense dimensions and `self.dim() - 2 - +dense_dim` batch dimension. + +Args: + + blocksize (list, tuple, :class:`torch.Size`, optional): Block size + of the resulting BSR tensor. A block size must be a tuple of + length two such that its items evenly divide the two sparse + dimensions. + + dense_dim (int, optional): Number of dense dimensions of the + resulting BSR tensor. This argument should be used only if + :attr:`self` is a strided tensor, and must be a value between 0 + and dimension of :attr:`self` tensor minus two. + +Example:: + + >>> dense = torch.randn(10, 10) + >>> sparse = dense.to_sparse_csr() + >>> sparse_bsr = sparse.to_sparse_bsr((5, 5)) + >>> sparse_bsr.col_indices() + tensor([0, 1, 0, 1]) + + >>> dense = torch.zeros(4, 3, 1) + >>> dense[0:2, 0] = dense[0:2, 2] = dense[2:4, 1] = 1 + >>> dense.to_sparse_bsr((2, 1), 1) + tensor(crow_indices=tensor([0, 2, 3]), + col_indices=tensor([0, 2, 1]), + values=tensor([[[[1.]], + + [[1.]]], + + + [[[1.]], + + [[1.]]], + + + [[[1.]], + + [[1.]]]]), size=(4, 3, 1), nnz=3, + layout=torch.sparse_bsr) + +""", +) + +add_docstr_all( + "to_sparse_bsc", + r""" +to_sparse_bsc(blocksize, dense_dim) -> Tensor + +Convert a tensor to a block sparse column (BSC) storage format of +given blocksize. If the :attr:`self` is strided, then the number of +dense dimensions could be specified, and a hybrid BSC tensor will be +created, with `dense_dim` dense dimensions and `self.dim() - 2 - +dense_dim` batch dimension. + +Args: + + blocksize (list, tuple, :class:`torch.Size`, optional): Block size + of the resulting BSC tensor. A block size must be a tuple of + length two such that its items evenly divide the two sparse + dimensions. + + dense_dim (int, optional): Number of dense dimensions of the + resulting BSC tensor. This argument should be used only if + :attr:`self` is a strided tensor, and must be a value between 0 + and dimension of :attr:`self` tensor minus two. + +Example:: + + >>> dense = torch.randn(10, 10) + >>> sparse = dense.to_sparse_csr() + >>> sparse_bsc = sparse.to_sparse_bsc((5, 5)) + >>> sparse_bsc.row_indices() + tensor([0, 1, 0, 1]) + + >>> dense = torch.zeros(4, 3, 1) + >>> dense[0:2, 0] = dense[0:2, 2] = dense[2:4, 1] = 1 + >>> dense.to_sparse_bsc((2, 1), 1) + tensor(ccol_indices=tensor([0, 1, 2, 3]), + row_indices=tensor([0, 1, 0]), + values=tensor([[[[1.]], + + [[1.]]], + + + [[[1.]], + + [[1.]]], + + + [[[1.]], + + [[1.]]]]), size=(4, 3, 1), nnz=3, + layout=torch.sparse_bsc) + +""", +) + +add_docstr_all( + "to_mkldnn", + r""" +to_mkldnn() -> Tensor +Returns a copy of the tensor in ``torch.mkldnn`` layout. + +""", +) + +add_docstr_all( + "trace", + r""" +trace() -> Tensor + +See :func:`torch.trace` +""", +) + +add_docstr_all( + "transpose", + r""" +transpose(dim0, dim1) -> Tensor + +See :func:`torch.transpose` +""", +) + +add_docstr_all( + "transpose_", + r""" +transpose_(dim0, dim1) -> Tensor + +In-place version of :meth:`~Tensor.transpose` +""", +) + +add_docstr_all( + "triangular_solve", + r""" +triangular_solve(A, upper=True, transpose=False, unitriangular=False) -> (Tensor, Tensor) + +See :func:`torch.triangular_solve` +""", +) + +add_docstr_all( + "tril", + r""" +tril(diagonal=0) -> Tensor + +See :func:`torch.tril` +""", +) + +add_docstr_all( + "tril_", + r""" +tril_(diagonal=0) -> Tensor + +In-place version of :meth:`~Tensor.tril` +""", +) + +add_docstr_all( + "triu", + r""" +triu(diagonal=0) -> Tensor + +See :func:`torch.triu` +""", +) + +add_docstr_all( + "triu_", + r""" +triu_(diagonal=0) -> Tensor + +In-place version of :meth:`~Tensor.triu` +""", +) + +add_docstr_all( + "true_divide", + r""" +true_divide(value) -> Tensor + +See :func:`torch.true_divide` +""", +) + +add_docstr_all( + "true_divide_", + r""" +true_divide_(value) -> Tensor + +In-place version of :meth:`~Tensor.true_divide_` +""", +) + +add_docstr_all( + "trunc", + r""" +trunc() -> Tensor + +See :func:`torch.trunc` +""", +) + +add_docstr_all( + "fix", + r""" +fix() -> Tensor + +See :func:`torch.fix`. +""", +) + +add_docstr_all( + "trunc_", + r""" +trunc_() -> Tensor + +In-place version of :meth:`~Tensor.trunc` +""", +) + +add_docstr_all( + "fix_", + r""" +fix_() -> Tensor + +In-place version of :meth:`~Tensor.fix` +""", +) + +add_docstr_all( + "type", + r""" +type(dtype=None, non_blocking=False, **kwargs) -> str or Tensor +Returns the type if `dtype` is not provided, else casts this object to +the specified type. + +If this is already of the correct type, no copy is performed and the +original object is returned. + +Args: + dtype (dtype or string): The desired type + non_blocking (bool): If ``True``, and the source is in pinned memory + and destination is on the GPU or vice versa, the copy is performed + asynchronously with respect to the host. Otherwise, the argument + has no effect. + **kwargs: For compatibility, may contain the key ``async`` in place of + the ``non_blocking`` argument. The ``async`` arg is deprecated. +""", +) + +add_docstr_all( + "type_as", + r""" +type_as(tensor) -> Tensor + +Returns this tensor cast to the type of the given tensor. + +This is a no-op if the tensor is already of the correct type. This is +equivalent to ``self.type(tensor.type())`` + +Args: + tensor (Tensor): the tensor which has the desired type +""", +) + +add_docstr_all( + "unfold", + r""" +unfold(dimension, size, step) -> Tensor + +Returns a view of the original tensor which contains all slices of size :attr:`size` from +:attr:`self` tensor in the dimension :attr:`dimension`. + +Step between two slices is given by :attr:`step`. + +If `sizedim` is the size of dimension :attr:`dimension` for :attr:`self`, the size of +dimension :attr:`dimension` in the returned tensor will be +`(sizedim - size) / step + 1`. + +An additional dimension of size :attr:`size` is appended in the returned tensor. + +Args: + dimension (int): dimension in which unfolding happens + size (int): the size of each slice that is unfolded + step (int): the step between each slice + +Example:: + + >>> x = torch.arange(1., 8) + >>> x + tensor([ 1., 2., 3., 4., 5., 6., 7.]) + >>> x.unfold(0, 2, 1) + tensor([[ 1., 2.], + [ 2., 3.], + [ 3., 4.], + [ 4., 5.], + [ 5., 6.], + [ 6., 7.]]) + >>> x.unfold(0, 2, 2) + tensor([[ 1., 2.], + [ 3., 4.], + [ 5., 6.]]) +""", +) + +add_docstr_all( + "uniform_", + r""" +uniform_(from=0, to=1, *, generator=None) -> Tensor + +Fills :attr:`self` tensor with numbers sampled from the continuous uniform +distribution: + +.. math:: + f(x) = \dfrac{1}{\text{to} - \text{from}} +""", +) + +add_docstr_all( + "unsqueeze", + r""" +unsqueeze(dim) -> Tensor + +See :func:`torch.unsqueeze` +""", +) + +add_docstr_all( + "unsqueeze_", + r""" +unsqueeze_(dim) -> Tensor + +In-place version of :meth:`~Tensor.unsqueeze` +""", +) + +add_docstr_all( + "var", + r""" +var(dim=None, *, correction=1, keepdim=False) -> Tensor + +See :func:`torch.var` +""", +) + +add_docstr_all( + "vdot", + r""" +vdot(other) -> Tensor + +See :func:`torch.vdot` +""", +) + +add_docstr_all( + "view", + r""" +view(*shape) -> Tensor + +Returns a new tensor with the same data as the :attr:`self` tensor but of a +different :attr:`shape`. + +The returned tensor shares the same data and must have the same number +of elements, but may have a different size. For a tensor to be viewed, the new +view size must be compatible with its original size and stride, i.e., each new +view dimension must either be a subspace of an original dimension, or only span +across original dimensions :math:`d, d+1, \dots, d+k` that satisfy the following +contiguity-like condition that :math:`\forall i = d, \dots, d+k-1`, + +.. math:: + + \text{stride}[i] = \text{stride}[i+1] \times \text{size}[i+1] + +Otherwise, it will not be possible to view :attr:`self` tensor as :attr:`shape` +without copying it (e.g., via :meth:`contiguous`). When it is unclear whether a +:meth:`view` can be performed, it is advisable to use :meth:`reshape`, which +returns a view if the shapes are compatible, and copies (equivalent to calling +:meth:`contiguous`) otherwise. + +Args: + shape (torch.Size or int...): the desired size + +Example:: + + >>> x = torch.randn(4, 4) + >>> x.size() + torch.Size([4, 4]) + >>> y = x.view(16) + >>> y.size() + torch.Size([16]) + >>> z = x.view(-1, 8) # the size -1 is inferred from other dimensions + >>> z.size() + torch.Size([2, 8]) + + >>> a = torch.randn(1, 2, 3, 4) + >>> a.size() + torch.Size([1, 2, 3, 4]) + >>> b = a.transpose(1, 2) # Swaps 2nd and 3rd dimension + >>> b.size() + torch.Size([1, 3, 2, 4]) + >>> c = a.view(1, 3, 2, 4) # Does not change tensor layout in memory + >>> c.size() + torch.Size([1, 3, 2, 4]) + >>> torch.equal(b, c) + False + + +.. method:: view(dtype) -> Tensor + :noindex: + +Returns a new tensor with the same data as the :attr:`self` tensor but of a +different :attr:`dtype`. + +If the element size of :attr:`dtype` is different than that of ``self.dtype``, +then the size of the last dimension of the output will be scaled +proportionally. For instance, if :attr:`dtype` element size is twice that of +``self.dtype``, then each pair of elements in the last dimension of +:attr:`self` will be combined, and the size of the last dimension of the output +will be half that of :attr:`self`. If :attr:`dtype` element size is half that +of ``self.dtype``, then each element in the last dimension of :attr:`self` will +be split in two, and the size of the last dimension of the output will be +double that of :attr:`self`. For this to be possible, the following conditions +must be true: + + * ``self.dim()`` must be greater than 0. + * ``self.stride(-1)`` must be 1. + +Additionally, if the element size of :attr:`dtype` is greater than that of +``self.dtype``, the following conditions must be true as well: + + * ``self.size(-1)`` must be divisible by the ratio between the element + sizes of the dtypes. + * ``self.storage_offset()`` must be divisible by the ratio between the + element sizes of the dtypes. + * The strides of all dimensions, except the last dimension, must be + divisible by the ratio between the element sizes of the dtypes. + +If any of the above conditions are not met, an error is thrown. + +.. warning:: + + This overload is not supported by TorchScript, and using it in a Torchscript + program will cause undefined behavior. + + +Args: + dtype (:class:`torch.dtype`): the desired dtype + +Example:: + + >>> x = torch.randn(4, 4) + >>> x + tensor([[ 0.9482, -0.0310, 1.4999, -0.5316], + [-0.1520, 0.7472, 0.5617, -0.8649], + [-2.4724, -0.0334, -0.2976, -0.8499], + [-0.2109, 1.9913, -0.9607, -0.6123]]) + >>> x.dtype + torch.float32 + + >>> y = x.view(torch.int32) + >>> y + tensor([[ 1064483442, -1124191867, 1069546515, -1089989247], + [-1105482831, 1061112040, 1057999968, -1084397505], + [-1071760287, -1123489973, -1097310419, -1084649136], + [-1101533110, 1073668768, -1082790149, -1088634448]], + dtype=torch.int32) + >>> y[0, 0] = 1000000000 + >>> x + tensor([[ 0.0047, -0.0310, 1.4999, -0.5316], + [-0.1520, 0.7472, 0.5617, -0.8649], + [-2.4724, -0.0334, -0.2976, -0.8499], + [-0.2109, 1.9913, -0.9607, -0.6123]]) + + >>> x.view(torch.cfloat) + tensor([[ 0.0047-0.0310j, 1.4999-0.5316j], + [-0.1520+0.7472j, 0.5617-0.8649j], + [-2.4724-0.0334j, -0.2976-0.8499j], + [-0.2109+1.9913j, -0.9607-0.6123j]]) + >>> x.view(torch.cfloat).size() + torch.Size([4, 2]) + + >>> x.view(torch.uint8) + tensor([[ 0, 202, 154, 59, 182, 243, 253, 188, 185, 252, 191, 63, 240, 22, + 8, 191], + [227, 165, 27, 190, 128, 72, 63, 63, 146, 203, 15, 63, 22, 106, + 93, 191], + [205, 59, 30, 192, 112, 206, 8, 189, 7, 95, 152, 190, 12, 147, + 89, 191], + [ 43, 246, 87, 190, 235, 226, 254, 63, 111, 240, 117, 191, 177, 191, + 28, 191]], dtype=torch.uint8) + >>> x.view(torch.uint8).size() + torch.Size([4, 16]) +""", +) + +add_docstr_all( + "view_as", + r""" +view_as(other) -> Tensor + +View this tensor as the same size as :attr:`other`. +``self.view_as(other)`` is equivalent to ``self.view(other.size())``. + +Please see :meth:`~Tensor.view` for more information about ``view``. + +Args: + other (:class:`torch.Tensor`): The result tensor has the same size + as :attr:`other`. +""", +) + +add_docstr_all( + "expand", + r""" +expand(*sizes) -> Tensor + +Returns a new view of the :attr:`self` tensor with singleton dimensions expanded +to a larger size. + +Passing -1 as the size for a dimension means not changing the size of +that dimension. + +Tensor can be also expanded to a larger number of dimensions, and the +new ones will be appended at the front. For the new dimensions, the +size cannot be set to -1. + +Expanding a tensor does not allocate new memory, but only creates a +new view on the existing tensor where a dimension of size one is +expanded to a larger size by setting the ``stride`` to 0. Any dimension +of size 1 can be expanded to an arbitrary value without allocating new +memory. + +Args: + *sizes (torch.Size or int...): the desired expanded size + +.. warning:: + + More than one element of an expanded tensor may refer to a single + memory location. As a result, in-place operations (especially ones that + are vectorized) may result in incorrect behavior. If you need to write + to the tensors, please clone them first. + +Example:: + + >>> x = torch.tensor([[1], [2], [3]]) + >>> x.size() + torch.Size([3, 1]) + >>> x.expand(3, 4) + tensor([[ 1, 1, 1, 1], + [ 2, 2, 2, 2], + [ 3, 3, 3, 3]]) + >>> x.expand(-1, 4) # -1 means not changing the size of that dimension + tensor([[ 1, 1, 1, 1], + [ 2, 2, 2, 2], + [ 3, 3, 3, 3]]) +""", +) + +add_docstr_all( + "expand_as", + r""" +expand_as(other) -> Tensor + +Expand this tensor to the same size as :attr:`other`. +``self.expand_as(other)`` is equivalent to ``self.expand(other.size())``. + +Please see :meth:`~Tensor.expand` for more information about ``expand``. + +Args: + other (:class:`torch.Tensor`): The result tensor has the same size + as :attr:`other`. +""", +) + +add_docstr_all( + "sum_to_size", + r""" +sum_to_size(*size) -> Tensor + +Sum ``this`` tensor to :attr:`size`. +:attr:`size` must be broadcastable to ``this`` tensor size. + +Args: + size (int...): a sequence of integers defining the shape of the output tensor. +""", +) + + +add_docstr_all( + "zero_", + r""" +zero_() -> Tensor + +Fills :attr:`self` tensor with zeros. +""", +) + +add_docstr_all( + "matmul", + r""" +matmul(tensor2) -> Tensor + +See :func:`torch.matmul` +""", +) + +add_docstr_all( + "chunk", + r""" +chunk(chunks, dim=0) -> List of Tensors + +See :func:`torch.chunk` +""", +) + +add_docstr_all( + "unsafe_chunk", + r""" +unsafe_chunk(chunks, dim=0) -> List of Tensors + +See :func:`torch.unsafe_chunk` +""", +) + +add_docstr_all( + "unsafe_split", + r""" +unsafe_split(split_size, dim=0) -> List of Tensors + +See :func:`torch.unsafe_split` +""", +) + +add_docstr_all( + "tensor_split", + r""" +tensor_split(indices_or_sections, dim=0) -> List of Tensors + +See :func:`torch.tensor_split` +""", +) + +add_docstr_all( + "hsplit", + r""" +hsplit(split_size_or_sections) -> List of Tensors + +See :func:`torch.hsplit` +""", +) + +add_docstr_all( + "vsplit", + r""" +vsplit(split_size_or_sections) -> List of Tensors + +See :func:`torch.vsplit` +""", +) + +add_docstr_all( + "dsplit", + r""" +dsplit(split_size_or_sections) -> List of Tensors + +See :func:`torch.dsplit` +""", +) + +add_docstr_all( + "stft", + r""" +stft(frame_length, hop, fft_size=None, return_onesided=True, window=None, + pad_end=0, align_to_window=None) -> Tensor + +See :func:`torch.stft` +""", +) + +add_docstr_all( + "istft", + r""" +istft(n_fft, hop_length=None, win_length=None, window=None, + center=True, normalized=False, onesided=True, length=None) -> Tensor + +See :func:`torch.istft` +""", +) + +add_docstr_all( + "det", + r""" +det() -> Tensor + +See :func:`torch.det` +""", +) + +add_docstr_all( + "where", + r""" +where(condition, y) -> Tensor + +``self.where(condition, y)`` is equivalent to ``torch.where(condition, self, y)``. +See :func:`torch.where` +""", +) + +add_docstr_all( + "logdet", + r""" +logdet() -> Tensor + +See :func:`torch.logdet` +""", +) + +add_docstr_all( + "slogdet", + r""" +slogdet() -> (Tensor, Tensor) + +See :func:`torch.slogdet` +""", +) + +add_docstr_all( + "unbind", + r""" +unbind(dim=0) -> seq + +See :func:`torch.unbind` +""", +) + +add_docstr_all( + "pin_memory", + r""" +pin_memory() -> Tensor + +Copies the tensor to pinned memory, if it's not already pinned. +By default, the device pinned memory on will be the current :ref:`accelerator`. +""", +) + +add_docstr_all( + "pinverse", + r""" +pinverse() -> Tensor + +See :func:`torch.pinverse` +""", +) + +add_docstr_all( + "index_add", + r""" +index_add(dim, index, source, *, alpha=1) -> Tensor + +Out-of-place version of :meth:`torch.Tensor.index_add_`. +""", +) + +add_docstr_all( + "index_copy", + r""" +index_copy(dim, index, tensor2) -> Tensor + +Out-of-place version of :meth:`torch.Tensor.index_copy_`. +""", +) + +add_docstr_all( + "index_fill", + r""" +index_fill(dim, index, value) -> Tensor + +Out-of-place version of :meth:`torch.Tensor.index_fill_`. +""", +) + +add_docstr_all( + "scatter", + r""" +scatter(dim, index, src) -> Tensor + +Out-of-place version of :meth:`torch.Tensor.scatter_` +""", +) + +add_docstr_all( + "scatter_add", + r""" +scatter_add(dim, index, src) -> Tensor + +Out-of-place version of :meth:`torch.Tensor.scatter_add_` +""", +) + +add_docstr_all( + "scatter_reduce", + r""" +scatter_reduce(dim, index, src, reduce, *, include_self=True) -> Tensor + +Out-of-place version of :meth:`torch.Tensor.scatter_reduce_` +""", +) + +add_docstr_all( + "masked_scatter", + r""" +masked_scatter(mask, tensor) -> Tensor + +Out-of-place version of :meth:`torch.Tensor.masked_scatter_` + +.. note:: + + The inputs :attr:`self` and :attr:`mask` + :ref:`broadcast `. + +Example: + + >>> self = torch.tensor([0, 0, 0, 0, 0]) + >>> mask = torch.tensor( + ... [[0, 0, 0, 1, 1], [1, 1, 0, 1, 1]], + ... dtype=torch.bool, + ... ) + >>> source = torch.tensor([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]) + >>> self.masked_scatter(mask, source) + tensor([[0, 0, 0, 0, 1], + [2, 3, 0, 4, 5]]) + +""", +) + +add_docstr_all( + "xlogy", + r""" +xlogy(other) -> Tensor + +See :func:`torch.xlogy` +""", +) + +add_docstr_all( + "xlogy_", + r""" +xlogy_(other) -> Tensor + +In-place version of :meth:`~Tensor.xlogy` +""", +) + +add_docstr_all( + "masked_fill", + r""" +masked_fill(mask, value) -> Tensor + +Out-of-place version of :meth:`torch.Tensor.masked_fill_` +""", +) + +add_docstr_all( + "grad", + r""" +This attribute is ``None`` by default and becomes a Tensor the first time a call to +:func:`backward` computes gradients for ``self``. +The attribute will then contain the gradients computed and future calls to +:func:`backward` will accumulate (add) gradients into it. +""", +) + +add_docstr_all( + "grad_dtype", + r""" +The allowed dtype of :attr:``grad`` for this tensor. + +:attr:``grad_dtype`` can be set to a specific dtype or ``None``. By default, +``t.grad_dtype == t.dtype``. When not None, the autograd engine casts +incoming gradients to this dtype. This attribute is only accessible and +settable for leaf tensors. + +.. warning:: + Use with caution. Diverging the dtypes of a tensor and its gradient may + break downstream systems that assume they match. + +Example:: + + >>> x = torch.tensor([1.0, 2.0], requires_grad=True) + >>> x.grad_dtype + torch.float32 + + >>> x.grad_dtype = torch.float16 + >>> x.grad_dtype + torch.float16 + + >>> # Allow any gradient dtype + >>> x.grad_dtype = None + >>> x.grad_dtype +""", +) + +add_docstr_all( + "retain_grad", + r""" +retain_grad() -> None + +Enables this Tensor to have their :attr:`grad` populated during +:func:`backward`. This is a no-op for leaf tensors. +""", +) + +add_docstr_all( + "retains_grad", + r""" +Is ``True`` if this Tensor is non-leaf and its :attr:`grad` is enabled to be +populated during :func:`backward`, ``False`` otherwise. +""", +) + +add_docstr_all( + "requires_grad", + r""" +Is ``True`` if gradients need to be computed for this Tensor, ``False`` otherwise. + +.. note:: + + The fact that gradients need to be computed for a Tensor do not mean that the :attr:`grad` + attribute will be populated, see :attr:`is_leaf` for more details. + +""", +) + +add_docstr_all( + "is_leaf", + r""" +All Tensors that have :attr:`requires_grad` which is ``False`` will be leaf Tensors by convention. + +For Tensors that have :attr:`requires_grad` which is ``True``, they will be leaf Tensors if they were +created by the user. This means that they are not the result of an operation and so +:attr:`grad_fn` is None. + +Only leaf Tensors will have their :attr:`grad` populated during a call to :func:`backward`. +To get :attr:`grad` populated for non-leaf Tensors, you can use :func:`retain_grad`. + +Example:: + + >>> a = torch.rand(10, requires_grad=True) + >>> a.is_leaf + True + >>> b = torch.rand(10, requires_grad=True).cuda() + >>> b.is_leaf + False + # b was created by the operation that cast a cpu Tensor into a cuda Tensor + >>> c = torch.rand(10, requires_grad=True) + 2 + >>> c.is_leaf + False + # c was created by the addition operation + >>> d = torch.rand(10).cuda() + >>> d.is_leaf + True + # d does not require gradients and so has no operation creating it (that is tracked by the autograd engine) + >>> e = torch.rand(10).cuda().requires_grad_() + >>> e.is_leaf + True + # e requires gradients and has no operations creating it + >>> f = torch.rand(10, requires_grad=True, device="cuda") + >>> f.is_leaf + True + # f requires grad, has no operation creating it + + +""", +) + +add_docstr_all( + "names", + r""" +Stores names for each of this tensor's dimensions. + +``names[idx]`` corresponds to the name of tensor dimension ``idx``. +Names are either a string if the dimension is named or ``None`` if the +dimension is unnamed. + +Dimension names may contain characters or underscore. Furthermore, a dimension +name must be a valid Python variable name (i.e., does not start with underscore). + +Tensors may not have two named dimensions with the same name. + +.. warning:: + The named tensor API is experimental and subject to change. + +""", +) + +add_docstr_all( + "is_cuda", + r""" +Is ``True`` if the Tensor is stored on the GPU, ``False`` otherwise. +""", +) + +add_docstr_all( + "is_cpu", + r""" +Is ``True`` if the Tensor is stored on the CPU, ``False`` otherwise. +""", +) + +add_docstr_all( + "is_xla", + r""" +Is ``True`` if the Tensor is stored on an XLA device, ``False`` otherwise. +""", +) + +add_docstr_all( + "is_ipu", + r""" +Is ``True`` if the Tensor is stored on the IPU, ``False`` otherwise. +""", +) + +add_docstr_all( + "is_xpu", + r""" +Is ``True`` if the Tensor is stored on the XPU, ``False`` otherwise. +""", +) + +add_docstr_all( + "is_quantized", + r""" +Is ``True`` if the Tensor is quantized, ``False`` otherwise. +""", +) + +add_docstr_all( + "is_meta", + r""" +Is ``True`` if the Tensor is a meta tensor, ``False`` otherwise. Meta tensors +are like normal tensors, but they carry no data. +""", +) + +add_docstr_all( + "is_mps", + r""" +Is ``True`` if the Tensor is stored on the MPS device, ``False`` otherwise. +""", +) + +add_docstr_all( + "is_sparse", + r""" +Is ``True`` if the Tensor uses sparse COO storage layout, ``False`` otherwise. +""", +) + +add_docstr_all( + "is_sparse_csr", + r""" +Is ``True`` if the Tensor uses sparse CSR storage layout, ``False`` otherwise. +""", +) + +add_docstr_all( + "device", + r""" +Is the :class:`torch.device` where this Tensor is. +""", +) + +add_docstr_all( + "ndim", + r""" +Alias for :meth:`~Tensor.dim()` +""", +) + +add_docstr_all( + "itemsize", + r""" +Alias for :meth:`~Tensor.element_size()` +""", +) + +add_docstr_all( + "nbytes", + r""" +Returns the number of bytes consumed by the "view" of elements of the Tensor +if the Tensor does not use sparse storage layout. +Defined to be :meth:`~Tensor.numel()` * :meth:`~Tensor.element_size()` +""", +) + +add_docstr_all( + "T", + r""" +Returns a view of this tensor with its dimensions reversed. + +If ``n`` is the number of dimensions in ``x``, +``x.T`` is equivalent to ``x.permute(n-1, n-2, ..., 0)``. + +.. warning:: + The use of :func:`Tensor.T` on tensors of dimension other than 2 to reverse their shape + is deprecated and it will throw an error in a future release. Consider :attr:`~.Tensor.mT` + to transpose batches of matrices or `x.permute(*torch.arange(x.ndim - 1, -1, -1))` to reverse + the dimensions of a tensor. +""", +) + +add_docstr_all( + "H", + r""" +Returns a view of a matrix (2-D tensor) conjugated and transposed. + +``x.H`` is equivalent to ``x.transpose(0, 1).conj()`` for complex matrices and +``x.transpose(0, 1)`` for real matrices. + +.. seealso:: + + :attr:`~.Tensor.mH`: An attribute that also works on batches of matrices. +""", +) + +add_docstr_all( + "mT", + r""" +Returns a view of this tensor with the last two dimensions transposed. + +``x.mT`` is equivalent to ``x.transpose(-2, -1)``. +""", +) + +add_docstr_all( + "mH", + r""" +Accessing this property is equivalent to calling :func:`adjoint`. +""", +) + +add_docstr_all( + "adjoint", + r""" +adjoint() -> Tensor + +Alias for :func:`adjoint` +""", +) + +add_docstr_all( + "real", + r""" +Returns a new tensor containing real values of the :attr:`self` tensor for a complex-valued input tensor. +The returned tensor and :attr:`self` share the same underlying storage. + +Returns :attr:`self` if :attr:`self` is a real-valued tensor tensor. + +Example:: + + >>> x=torch.randn(4, dtype=torch.cfloat) + >>> x + tensor([(0.3100+0.3553j), (-0.5445-0.7896j), (-1.6492-0.0633j), (-0.0638-0.8119j)]) + >>> x.real + tensor([ 0.3100, -0.5445, -1.6492, -0.0638]) + +""", +) + +add_docstr_all( + "imag", + r""" +Returns a new tensor containing imaginary values of the :attr:`self` tensor. +The returned tensor and :attr:`self` share the same underlying storage. + +.. warning:: + :func:`imag` is only supported for tensors with complex dtypes. + +Example:: + + >>> x=torch.randn(4, dtype=torch.cfloat) + >>> x + tensor([(0.3100+0.3553j), (-0.5445-0.7896j), (-1.6492-0.0633j), (-0.0638-0.8119j)]) + >>> x.imag + tensor([ 0.3553, -0.7896, -0.0633, -0.8119]) + +""", +) + +add_docstr_all( + "as_subclass", + r""" +as_subclass(cls) -> Tensor + +Makes a ``cls`` instance with the same data pointer as ``self``. Changes +in the output mirror changes in ``self``, and the output stays attached +to the autograd graph. ``cls`` must be a subclass of ``Tensor``. +""", +) + +add_docstr_all( + "crow_indices", + r""" +crow_indices() -> IntTensor + +Returns the tensor containing the compressed row indices of the :attr:`self` +tensor when :attr:`self` is a sparse CSR tensor of layout ``sparse_csr``. +The ``crow_indices`` tensor is strictly of shape (:attr:`self`.size(0) + 1) +and of type ``int32`` or ``int64``. When using MKL routines such as sparse +matrix multiplication, it is necessary to use ``int32`` indexing in order +to avoid downcasting and potentially losing information. + +Example:: + + >>> csr = torch.eye(5,5).to_sparse_csr() + >>> csr.crow_indices() + tensor([0, 1, 2, 3, 4, 5], dtype=torch.int32) + +""", +) + +add_docstr_all( + "col_indices", + r""" +col_indices() -> IntTensor + +Returns the tensor containing the column indices of the :attr:`self` +tensor when :attr:`self` is a sparse CSR tensor of layout ``sparse_csr``. +The ``col_indices`` tensor is strictly of shape (:attr:`self`.nnz()) +and of type ``int32`` or ``int64``. When using MKL routines such as sparse +matrix multiplication, it is necessary to use ``int32`` indexing in order +to avoid downcasting and potentially losing information. + +Example:: + + >>> csr = torch.eye(5,5).to_sparse_csr() + >>> csr.col_indices() + tensor([0, 1, 2, 3, 4], dtype=torch.int32) + +""", +) + +add_docstr_all( + "to_padded_tensor", + r""" +to_padded_tensor(padding, output_size=None) -> Tensor +See :func:`to_padded_tensor` +""", +) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_tensor_str.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_tensor_str.py new file mode 100644 index 0000000000000000000000000000000000000000..9d6a0b11956809380285a817cd22bcdabe27461d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_tensor_str.py @@ -0,0 +1,724 @@ +# mypy: allow-untyped-defs +import contextlib +import dataclasses +import math +import textwrap +from typing import Any + +import torch +from torch import inf + + +@dataclasses.dataclass +class __PrinterOptions: + precision: int = 4 + threshold: float = 1000 + edgeitems: int = 3 + linewidth: int = 80 + sci_mode: bool | None = None + + +PRINT_OPTS = __PrinterOptions() + + +# We could use **kwargs, but this will give better docs +def set_printoptions( + precision=None, + threshold=None, + edgeitems=None, + linewidth=None, + profile=None, + sci_mode=None, +): + r"""Set options for printing. Items shamelessly taken from NumPy + + Args: + precision: Number of digits of precision for floating point output + (default = 4). + threshold: Total number of array elements which trigger summarization + rather than full `repr` (default = 1000). + edgeitems: Number of array items in summary at beginning and end of + each dimension (default = 3). + linewidth: The number of characters per line for the purpose of + inserting line breaks (default = 80). Thresholded matrices will + ignore this parameter. + profile: Sane defaults for pretty printing. Can override with any of + the above options. (any one of `default`, `short`, `full`) + sci_mode: Enable (True) or disable (False) scientific notation. If + None (default) is specified, the value is defined by + `torch._tensor_str._Formatter`. This value is automatically chosen + by the framework. + + Example:: + + >>> # Limit the precision of elements + >>> torch.set_printoptions(precision=2) + >>> torch.tensor([1.12345]) + tensor([1.12]) + >>> # Limit the number of elements shown + >>> torch.set_printoptions(threshold=5) + >>> torch.arange(10) + tensor([0, 1, 2, ..., 7, 8, 9]) + >>> # Restore defaults + >>> torch.set_printoptions(profile='default') + >>> torch.tensor([1.12345]) + tensor([1.1235]) + >>> torch.arange(10) + tensor([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) + + """ + if profile is not None: + if profile == "default": + PRINT_OPTS.precision = 4 + PRINT_OPTS.threshold = 1000 + PRINT_OPTS.edgeitems = 3 + PRINT_OPTS.linewidth = 80 + elif profile == "short": + PRINT_OPTS.precision = 2 + PRINT_OPTS.threshold = 1000 + PRINT_OPTS.edgeitems = 2 + PRINT_OPTS.linewidth = 80 + elif profile == "full": + PRINT_OPTS.precision = 4 + PRINT_OPTS.threshold = inf + PRINT_OPTS.edgeitems = 3 + PRINT_OPTS.linewidth = 80 + + if precision is not None: + PRINT_OPTS.precision = precision + if threshold is not None: + PRINT_OPTS.threshold = threshold + if edgeitems is not None: + PRINT_OPTS.edgeitems = edgeitems + if linewidth is not None: + PRINT_OPTS.linewidth = linewidth + PRINT_OPTS.sci_mode = sci_mode + + +def get_printoptions() -> dict[str, Any]: + r"""Gets the current options for printing, as a dictionary that + can be passed as ``**kwargs`` to set_printoptions(). + """ + return dataclasses.asdict(PRINT_OPTS) + + +@contextlib.contextmanager +def printoptions(**kwargs): + r"""Context manager that temporarily changes the print options. Accepted + arguments are same as :func:`set_printoptions`.""" + old_kwargs = get_printoptions() + set_printoptions(**kwargs) + try: + yield + finally: + set_printoptions(**old_kwargs) + + +def tensor_totype(t): + dtype = ( + torch.float + if ( + t.is_mps + or (t.is_xpu and not torch.xpu.get_device_properties(t.device).has_fp64) + or t.is_maia + ) + else torch.double + ) + return t.to(dtype=dtype) + + +class _Formatter: + def __init__(self, tensor): + self.floating_dtype = tensor.dtype.is_floating_point + self.int_mode = True + self.sci_mode = False + self.max_width = 1 + + with torch.no_grad(): + tensor_view = tensor.reshape(-1) + + if not self.floating_dtype: + for value in tensor_view: + value_str = f"{value}" + self.max_width = max(self.max_width, len(value_str)) + + else: + if tensor.dtype == torch.float4_e2m1fn_x2: # type: ignore[attr-defined] + # torch.float4_e2m1fn_x2 is special and does not support the casts necessary + # to print it, we choose to display the uint8 representation here for + # convenience of being able to print a tensor. + # TODO(#146647): extend this to other dtypes without casts defined, such + # as the bits, uint1..7 and int1..7 dtypes. + tensor_view = tensor_view.view(torch.uint8) + + nonzero_finite_vals = torch.masked_select( + tensor_view, torch.isfinite(tensor_view) & tensor_view.ne(0) + ) + + if nonzero_finite_vals.numel() == 0: + # no valid number, do nothing + return + + if tensor.dtype == torch.float8_e8m0fnu: # type: ignore[attr-defined] + # float8_e8m0fnu is special and does not define arithmetic ops, + # and printing code further in this file assumes the existence + # of various arithmetic ops to figure out what to print. We hack + # and convert to float here to make printing work correctly. + # TODO(#113663): also add the other float8 dtypes here after arithmetic + # support for them is removed + nonzero_finite_vals = nonzero_finite_vals.float() + + # Convert to double (or float) for easy calculation. HalfTensor overflows with 1e8, and there's no div() on CPU. + nonzero_finite_abs = tensor_totype(nonzero_finite_vals.abs()) + nonzero_finite_min = tensor_totype(nonzero_finite_abs.min()) + nonzero_finite_max = tensor_totype(nonzero_finite_abs.max()) + + for value in nonzero_finite_vals: + if value != torch.ceil(value): + self.int_mode = False + break + + self.sci_mode = ( + nonzero_finite_max / nonzero_finite_min > 1000.0 + or nonzero_finite_max > 1.0e8 + or nonzero_finite_min < 1.0e-4 + if PRINT_OPTS.sci_mode is None + else PRINT_OPTS.sci_mode + ) + + if self.int_mode: + # in int_mode for floats, all numbers are integers, and we append a decimal to nonfinites + # to indicate that the tensor is of floating type. add 1 to the len to account for this. + if self.sci_mode: + for value in nonzero_finite_vals: + value_str = f"{{:.{PRINT_OPTS.precision}e}}".format(value) + self.max_width = max(self.max_width, len(value_str)) + else: + for value in nonzero_finite_vals: + value_str = f"{value:.0f}" + self.max_width = max(self.max_width, len(value_str) + 1) + else: + # Check if scientific representation should be used. + if self.sci_mode: + for value in nonzero_finite_vals: + value_str = f"{{:.{PRINT_OPTS.precision}e}}".format(value) + self.max_width = max(self.max_width, len(value_str)) + else: + for value in nonzero_finite_vals: + value_str = f"{{:.{PRINT_OPTS.precision}f}}".format(value) + self.max_width = max(self.max_width, len(value_str)) + + def width(self): + return self.max_width + + def format(self, value): + if self.floating_dtype: + if self.sci_mode: + ret = f"{{:{self.max_width}.{PRINT_OPTS.precision}e}}".format(value) + elif self.int_mode: + ret = f"{value:.0f}" + if not (math.isinf(value) or math.isnan(value)): + ret += "." + else: + ret = f"{{:.{PRINT_OPTS.precision}f}}".format(value) + else: + ret = f"{value}" + return (self.max_width - len(ret)) * " " + ret + + +def _scalar_str(self, formatter1, formatter2=None): + if formatter2 is not None: + real_str = _scalar_str(self.real, formatter1) + imag_str = (_scalar_str(self.imag, formatter2) + "j").lstrip() + # handles negative numbers, +0.0, -0.0 + if imag_str[0] == "+" or imag_str[0] == "-": + return real_str + imag_str + else: + return real_str + "+" + imag_str + else: + return formatter1.format(self.item()) + + +def _vector_str(self, indent, summarize, formatter1, formatter2=None): + # length includes spaces and comma between elements + element_length = formatter1.width() + 2 + if formatter2 is not None: + # width for imag_formatter + an extra j for complex + element_length += formatter2.width() + 1 + + elements_per_line = max( + 1, math.floor((PRINT_OPTS.linewidth - indent) / (element_length)) + ) + + def _val_formatter(val, formatter1=formatter1, formatter2=formatter2): + if formatter2 is not None: + real_str = formatter1.format(val.real) + imag_str = (formatter2.format(val.imag) + "j").lstrip() + # handles negative numbers, +0.0, -0.0 + if imag_str[0] == "+" or imag_str[0] == "-": + return real_str + imag_str + else: + return real_str + "+" + imag_str + else: + return formatter1.format(val) + + if self.dtype == torch.float4_e2m1fn_x2: # type: ignore[attr-defined] + # torch.float4_e2m1fn_x2 is special and does not support the casts necessary + # to print it, we choose to display the uint8 representation here for + # convenience of being able to print a tensor. + # TODO(#146647): extend this to other dtypes without casts defined, such + # as the bits, uint1..7 and int1..7 dtypes. + self = self.view(torch.uint8) + + if summarize and not PRINT_OPTS.edgeitems: + # Deal with edge case that negative zero is zero + data = ["..."] + elif summarize and self.size(0) > 2 * PRINT_OPTS.edgeitems: + data = ( + [_val_formatter(val) for val in self[: PRINT_OPTS.edgeitems].tolist()] + + [" ..."] + + [_val_formatter(val) for val in self[-PRINT_OPTS.edgeitems :].tolist()] + ) + else: + data = [_val_formatter(val) for val in self.tolist()] + + data_lines = [ + data[i : i + elements_per_line] for i in range(0, len(data), elements_per_line) + ] + lines = [", ".join(line) for line in data_lines] + return "[" + ("," + "\n" + " " * (indent + 1)).join(lines) + "]" + + +# formatter2 is only used for printing complex tensors. +# For complex tensors, formatter1 and formatter2 are the formatters for tensor.real +# and tensor.imag respesectively +def _tensor_str_with_formatter(self, indent, summarize, formatter1, formatter2=None): + dim = self.dim() + + if dim == 0: + return _scalar_str(self, formatter1, formatter2) + + if dim == 1: + return _vector_str(self, indent, summarize, formatter1, formatter2) + + if summarize and self.size(0) > 2 * PRINT_OPTS.edgeitems: + slices = ( + [ + _tensor_str_with_formatter( + self[i], indent + 1, summarize, formatter1, formatter2 + ) + for i in range(PRINT_OPTS.edgeitems) + ] + + ["..."] + + [ + _tensor_str_with_formatter( + self[i], indent + 1, summarize, formatter1, formatter2 + ) + for i in range(len(self) - PRINT_OPTS.edgeitems, len(self)) + ] + ) + else: + slices = [ + _tensor_str_with_formatter( + self[i], indent + 1, summarize, formatter1, formatter2 + ) + for i in range(self.size(0)) + ] + + tensor_str = ("," + "\n" * (dim - 1) + " " * (indent + 1)).join(slices) + return "[" + tensor_str + "]" + + +def _tensor_str(self, indent): + if self.numel() == 0: + return "[]" + + if self.has_names(): + # There are two main codepaths (possibly more) that tensor printing goes through: + # - tensor data can fit comfortably on screen + # - tensor data needs to be summarized + # Some of the codepaths don't fully support named tensors, so we send in + # an unnamed tensor to the formatting code as a workaround. + self = self.rename(None) + + summarize = self.numel() > PRINT_OPTS.threshold + + if self._is_zerotensor(): + self = self.clone() + + # handle the negative bit + if self.is_neg(): + self = self.resolve_neg() + + # TODO: Remove me when `masked_select` is implemented for FP8 + if self.dtype in [ + torch.float8_e5m2, + torch.float8_e5m2fnuz, + torch.float8_e4m3fn, + torch.float8_e4m3fnuz, + ]: + self = self.half() + + if self.dtype.is_complex: + # handle the conjugate bit + self = self.resolve_conj() + real_formatter = _Formatter( + get_summarized_data(self.real) if summarize else self.real + ) + imag_formatter = _Formatter( + get_summarized_data(self.imag) if summarize else self.imag + ) + return _tensor_str_with_formatter( + self, indent, summarize, real_formatter, imag_formatter + ) + else: + formatter = _Formatter(get_summarized_data(self) if summarize else self) + return _tensor_str_with_formatter(self, indent, summarize, formatter) + + +def _add_suffixes(tensor_str, suffixes, indent, force_newline): + tensor_strs = [tensor_str] + last_line_len = len(tensor_str) - tensor_str.rfind("\n") + 1 + for suffix in suffixes: + suffix_len = len(suffix) + if force_newline or last_line_len + suffix_len + 2 > PRINT_OPTS.linewidth: + tensor_strs.append(",\n" + " " * indent + suffix) + last_line_len = indent + suffix_len + force_newline = False + else: + tensor_strs.append(", " + suffix) + last_line_len += suffix_len + 2 + tensor_strs.append(")") + return "".join(tensor_strs) + + +def get_summarized_data(self): + dim = self.dim() + if dim == 0: + return self + if dim == 1: + if self.size(0) > 2 * PRINT_OPTS.edgeitems: + return torch.cat( + (self[: PRINT_OPTS.edgeitems], self[-PRINT_OPTS.edgeitems :]) + ) + else: + return self + if not PRINT_OPTS.edgeitems: + return self.new_empty([0] * self.dim()) + elif self.size(0) > 2 * PRINT_OPTS.edgeitems: + start = [self[i] for i in range(PRINT_OPTS.edgeitems)] + end = [self[i] for i in range(len(self) - PRINT_OPTS.edgeitems, len(self))] + return torch.stack([get_summarized_data(x) for x in (start + end)]) + else: + return torch.stack([get_summarized_data(x) for x in self]) + + +def _str_intern(inp, *, tensor_contents=None): + if torch._C._functorch.is_functorch_wrapped_tensor(inp): + return _functorch_wrapper_str_intern(inp, tensor_contents=tensor_contents) + is_plain_tensor = type(inp) is torch.Tensor or type(inp) is torch.nn.Parameter + if inp.is_nested: + prefix = "nested_tensor(" + elif is_plain_tensor: + prefix = "tensor(" + else: + prefix = f"{type(inp).__name__}(" + indent = len(prefix) + suffixes = [] + custom_contents_provided = tensor_contents is not None + if custom_contents_provided: + tensor_str = tensor_contents + + # This is used to extract the primal value and thus disable the forward AD + # within this function. + # TODO(albanD) This needs to be updated when more than one level is supported + self, tangent = torch.autograd.forward_ad.unpack_dual(inp) + + # Note [Print tensor device]: + # A general logic here is we only print device when it doesn't match + # the device specified in default tensor type. + # Currently torch.set_default_tensor_type() only supports CPU/CUDA, thus + # torch._C._get_default_device() only returns either cpu or cuda. + # In other cases, we don't have a way to set them as default yet, + # and we should always print out device for them. + if ( + self.device.type != torch._C._get_default_device() + or ( + self.device.type == "cuda" + and torch.cuda.current_device() != self.device.index + ) + or (self.device.type == "mps") + ): + suffixes.append("device='" + str(self.device) + "'") + + # Tensor printing performs tensor operations like slice, indexing, etc to make it in a + # representable format. These operations on ipu/xla/lazy/mtia tensor results in compilations. Hence, + # to avoid compilations, copying the tensor to cpu before printing. + if self.device.type in ["xla", "lazy", "ipu", "mtia"]: + self = self.to("cpu") + + # TODO: add an API to map real -> complex dtypes + _default_complex_dtype = ( + torch.cdouble if torch.get_default_dtype() == torch.double else torch.cfloat + ) + has_default_dtype = self.dtype in ( + torch.get_default_dtype(), + _default_complex_dtype, + torch.int64, + torch.bool, + ) + if self.is_sparse: + suffixes.append("size=" + str(tuple(self.shape))) + from torch._subclasses.fake_tensor import FakeTensor + + is_meta = self.is_meta or isinstance(self, FakeTensor) + if not is_meta: + suffixes.append("nnz=" + str(self._nnz())) + if not has_default_dtype: + suffixes.append("dtype=" + str(self.dtype)) + if not custom_contents_provided: + indices_prefix = "indices=tensor(" + indices = self._indices().detach() + if is_meta: + indices_str = "..." + else: + indices_str = _tensor_str(indices, indent + len(indices_prefix)) + if is_meta or indices.numel() == 0: + indices_str += ", size=" + str(tuple(indices.shape)) + values_prefix = "values=tensor(" + values = self._values().detach() + if is_meta: + values_str = "..." + else: + values_str = _tensor_str(values, indent + len(values_prefix)) + if is_meta or values.numel() == 0: + values_str += ", size=" + str(tuple(values.shape)) + tensor_str = ( + indices_prefix + + indices_str + + "),\n" + + " " * indent + + values_prefix + + values_str + + ")" + ) + elif self.layout in { + torch.sparse_csr, + torch.sparse_csc, + torch.sparse_bsr, + torch.sparse_bsc, + }: + from torch._subclasses.fake_tensor import FakeTensor + + suffixes.append("size=" + str(tuple(self.shape))) + is_meta = self.is_meta or isinstance(self, FakeTensor) + if not is_meta: + suffixes.append("nnz=" + str(self._nnz())) + if not has_default_dtype: + suffixes.append("dtype=" + str(self.dtype)) + if not custom_contents_provided: + compressed_indices_method, plain_indices_method = { + torch.sparse_csr: (torch.Tensor.crow_indices, torch.Tensor.col_indices), + torch.sparse_csc: (torch.Tensor.ccol_indices, torch.Tensor.row_indices), + torch.sparse_bsr: (torch.Tensor.crow_indices, torch.Tensor.col_indices), + torch.sparse_bsc: (torch.Tensor.ccol_indices, torch.Tensor.row_indices), + }[self.layout] + if self.layout in {torch.sparse_csr, torch.sparse_bsr}: + cdimname, pdimname = "row", "column" + else: + cdimname, pdimname = "column", "row" + compressed_indices_prefix = f"c{cdimname[:3]}_indices=tensor(" + compressed_indices = compressed_indices_method(self).detach() + if is_meta: + compressed_indices_str = "..." + else: + compressed_indices_str = _tensor_str( + compressed_indices, indent + len(compressed_indices_prefix) + ) + if compressed_indices.numel() == 0 or is_meta: + compressed_indices_str += ", size=" + str( + tuple(compressed_indices.shape) + ) + plain_indices_prefix = f"{pdimname[:3]}_indices=tensor(" + plain_indices = plain_indices_method(self).detach() + if is_meta: + plain_indices_str = "..." + else: + plain_indices_str = _tensor_str( + plain_indices, indent + len(plain_indices_prefix) + ) + if plain_indices.numel() == 0 or is_meta: + plain_indices_str += ", size=" + str(tuple(plain_indices.shape)) + values_prefix = "values=tensor(" + values = self.values().detach() + if is_meta: + values_str = "..." + else: + values_str = _tensor_str(values, indent + len(values_prefix)) + if values.numel() == 0 or is_meta: + values_str += ", size=" + str(tuple(values.shape)) + tensor_str = ( + compressed_indices_prefix + + compressed_indices_str + + "),\n" + + " " * indent + + plain_indices_prefix + + plain_indices_str + + "),\n" + + " " * indent + + values_prefix + + values_str + + ")" + ) + elif self.is_quantized: + suffixes.append("size=" + str(tuple(self.shape))) + if not has_default_dtype: + suffixes.append("dtype=" + str(self.dtype)) + suffixes.append("quantization_scheme=" + str(self.qscheme())) + if ( + self.qscheme() == torch.per_tensor_affine + or self.qscheme() == torch.per_tensor_symmetric + ): + suffixes.append("scale=" + str(self.q_scale())) + suffixes.append("zero_point=" + str(self.q_zero_point())) + elif ( + self.qscheme() == torch.per_channel_affine + or self.qscheme() == torch.per_channel_symmetric + or self.qscheme() == torch.per_channel_affine_float_qparams + ): + suffixes.append("scale=" + str(self.q_per_channel_scales())) + suffixes.append("zero_point=" + str(self.q_per_channel_zero_points())) + suffixes.append("axis=" + str(self.q_per_channel_axis())) + if not custom_contents_provided: + tensor_str = _tensor_str(self.dequantize(), indent) + elif self.is_nested: + if not custom_contents_provided: + + def indented_str(s, indent): + return "\n".join(f" {line}" for line in s.split("\n")) + + strs = ",\n".join( + indented_str(str(t), indent + 1) + for t in torch.ops.aten.unbind.int(self, 0) + ) + tensor_str = f"[\n{strs}\n]" + elif torch._is_functional_tensor(self): + prefix = "_to_functional_tensor(" + tensor_str = repr(torch._from_functional_tensor(self)) + else: + # Circular import problem, so we import it here + from torch._subclasses.fake_tensor import FakeTensor + + if self.is_meta or isinstance(self, FakeTensor): + suffixes.append("size=" + str(tuple(self.shape))) + if self.dtype != torch.get_default_dtype(): + suffixes.append("dtype=" + str(self.dtype)) + # TODO: This implies that ellipses is valid syntax for allocating + # a meta tensor or FakeTensor, which it could be, but it isn't right now + if not custom_contents_provided: + tensor_str = "..." + else: + if self.numel() == 0 and not self.is_sparse: + # Explicitly print the shape if it is not (0,), to match NumPy behavior + if self.dim() != 1: + suffixes.append("size=" + str(tuple(self.shape))) + + # In an empty tensor, there are no elements to infer if the dtype + # should be int64, so it must be shown explicitly. + if self.dtype != torch.get_default_dtype(): + suffixes.append("dtype=" + str(self.dtype)) + if not custom_contents_provided: + tensor_str = "[]" + else: + if not PRINT_OPTS.edgeitems: + suffixes.append("size=" + str(tuple(self.shape))) + + if not has_default_dtype: + suffixes.append("dtype=" + str(self.dtype)) + + if not custom_contents_provided: + if self.layout != torch.strided: + tensor_str = _tensor_str(self.to_dense(), indent) + else: + tensor_str = _tensor_str(self, indent) + + if self.layout != torch.strided: + suffixes.append("layout=" + str(self.layout)) + + # Use inp here to get the original grad_fn and not the one generated by the forward grad + # unpacking. + grad_fn_name = None + try: + grad_fn = inp.grad_fn + except RuntimeError: + # Accessing the grad_fn calls rebasing logic which would cause an error + # if that tensor is a view created in no-grad mode modified in-place in + # no-grad mode. See: https://github.com/pytorch/pytorch/issues/99968 + grad_fn_name = "Invalid" + + if grad_fn_name is None and grad_fn is not None: # type: ignore[possibly-undefined] + # pyrefly: ignore [unbound-name] + grad_fn_name = type(grad_fn).__name__ + if grad_fn_name == "CppFunction": + # pyrefly: ignore [unbound-name] + grad_fn_name = grad_fn.name().rsplit("::", 1)[-1] + + if grad_fn_name is not None: + suffixes.append(f"grad_fn=<{grad_fn_name}>") + elif inp.requires_grad: + suffixes.append("requires_grad=True") + + if self.has_names(): + suffixes.append(f"names={self.names}") + + if tangent is not None: + suffixes.append(f"tangent={tangent}") + + string_repr = _add_suffixes( + prefix + tensor_str, # type: ignore[possibly-undefined] + suffixes, + indent, + force_newline=self.is_sparse, + ) + + # Check if this instance is flagged as a parameter and change the repr accordingly. + # Unfortunately, this function has to be aware of this detail. + # NB: This is currently skipped for plain tensor parameters to maintain BC. In the future, + # this should be done for those as well to produce a valid repr. + if isinstance(self, torch.nn.Parameter) and not is_plain_tensor: + string_repr = f"Parameter({string_repr})" + + return string_repr + + +def _functorch_wrapper_str_intern(tensor, *, tensor_contents=None): + level = torch._C._functorch.maybe_get_level(tensor) + assert level != -1 + + if torch._C._functorch.is_functionaltensor(tensor): + # Since we're unwrapping the FunctionalTensorWrapper, we need to make sure + # that it's up to date first + torch._sync(tensor) + + value = torch._C._functorch.get_unwrapped(tensor) + value_repr = repr(value) + + indented_value_repr = textwrap.indent(value_repr, " " * 4) + if torch._C._functorch.is_batchedtensor(tensor): + bdim = torch._C._functorch.maybe_get_bdim(tensor) + assert bdim != -1 + return ( + f"BatchedTensor(lvl={level}, bdim={bdim}, value=\n{indented_value_repr}\n)" + ) + if torch._C._functorch.is_gradtrackingtensor(tensor): + return f"GradTrackingTensor(lvl={level}, value=\n{indented_value_repr}\n)" + if torch._C._functorch.is_functionaltensor(tensor): + return f"FunctionalTensor(lvl={level}, value=\\\n{value_repr})" + + raise ValueError("We don't know how to print this, please file us an issue") + + +def _str(self, *, tensor_contents=None): + with torch.no_grad(), torch.utils._python_dispatch._disable_current_modes(): + guard = torch._C._DisableFuncTorch() # noqa: F841 + return _str_intern(self, tensor_contents=tensor_contents) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_thread_safe_fork.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_thread_safe_fork.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_torch_docs.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_torch_docs.py new file mode 100644 index 0000000000000000000000000000000000000000..7a79911010052c86770a1ca98f665ac11586533b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_torch_docs.py @@ -0,0 +1,14392 @@ +# mypy: allow-untyped-defs +"""Adds docstrings to functions defined in the torch._C module.""" + +import re + +import torch._C +from torch._C import _add_docstr as add_docstr + + +def parse_kwargs(desc): + r"""Map a description of args to a dictionary of {argname: description}. + + Input: + (' weight (Tensor): a weight tensor\n' + + ' Some optional description') + Output: { + 'weight': \ + 'weight (Tensor): a weight tensor\n Some optional description' + } + """ + # Split on exactly 4 spaces after a newline + regx = re.compile(r"\n\s{4}(?!\s)") + kwargs = [section.strip() for section in regx.split(desc)] + kwargs = [section for section in kwargs if len(section) > 0] + return {desc.split(" ")[0]: desc for desc in kwargs} + + +def merge_dicts(*dicts): + """Merge dictionaries into a single dictionary.""" + return {x: d[x] for d in dicts for x in d} + + +common_args = parse_kwargs( + """ + input (Tensor): the input tensor. + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling + out (Tensor, optional): the output tensor. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned tensor. Default: ``torch.preserve_format``. +""" +) + +reduceops_common_args = merge_dicts( + common_args, + parse_kwargs( + """ + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + If specified, the input tensor is casted to :attr:`dtype` before the operation + is performed. This is useful for preventing data type overflows. Default: None. + keepdim (bool): whether the output tensor has :attr:`dim` retained or not. +""" + ), + { + "opt_keepdim": """ + keepdim (bool, optional): whether the output tensor has :attr:`dim` retained or not. Default: ``False``. +""" + }, +) + +multi_dim_common = merge_dicts( + reduceops_common_args, + parse_kwargs( + """ + dim (int or tuple of ints): the dimension or dimensions to reduce. +""" + ), + { + "keepdim_details": """ +If :attr:`keepdim` is ``True``, the output tensor is of the same size +as :attr:`input` except in the dimension(s) :attr:`dim` where it is of size 1. +Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in the +output tensor having 1 (or ``len(dim)``) fewer dimension(s). +""" + }, + { + "opt_dim": """ + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. +""" + }, + { + "opt_dim_all_reduce": """ + dim (int or tuple of ints, optional): the dimension or dimensions to reduce. + If ``None``, all dimensions are reduced. +""" + }, +) + +single_dim_common = merge_dicts( + reduceops_common_args, + parse_kwargs( + """ + dim (int): the dimension to reduce. +""" + ), + { + "opt_dim": """ + dim (int, optional): the dimension to reduce. +""" + }, + { + "opt_dim_all_reduce": """ + dim (int, optional): the dimension to reduce. + If ``None``, all dimensions are reduced. +""" + }, + { + "opt_dim_without_none": """ + dim (int, optional): the dimension to reduce. If omitted, all dimensions are reduced. Explicit ``None`` is not supported. +""" + }, + { + "keepdim_details": """If :attr:`keepdim` is ``True``, the output tensor is of the same size +as :attr:`input` except in the dimension :attr:`dim` where it is of size 1. +Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in +the output tensor having 1 fewer dimension than :attr:`input`.""" + }, +) + +factory_common_args = merge_dicts( + common_args, + parse_kwargs( + """ + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, uses a global default (see :func:`torch.set_default_dtype`). + layout (:class:`torch.layout`, optional): the desired layout of returned Tensor. + Default: ``torch.strided``. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.contiguous_format``. + check_invariants (bool, optional): If sparse tensor invariants are checked. + Default: as returned by :func:`torch.sparse.check_sparse_tensor_invariants.is_enabled`, + initially False. +""" + ), + { + "sparse_factory_device_note": """\ +.. note:: + + If the ``device`` argument is not specified the device of the given + :attr:`values` and indices tensor(s) must match. If, however, the + argument is specified the input Tensors will be converted to the + given device and in turn determine the device of the constructed + sparse tensor.""" + }, +) + +factory_like_common_args = parse_kwargs( + """ + input (Tensor): the size of :attr:`input` will determine size of the output tensor. + layout (:class:`torch.layout`, optional): the desired layout of returned tensor. + Default: if ``None``, defaults to the layout of :attr:`input`. + generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling. + dtype (:class:`torch.dtype`, optional): the desired data type of returned Tensor. + Default: if ``None``, defaults to the dtype of :attr:`input`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, defaults to the device of :attr:`input`. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. + memory_format (:class:`torch.memory_format`, optional): the desired memory format of + returned Tensor. Default: ``torch.preserve_format``. +""" +) + +factory_data_common_args = parse_kwargs( + """ + data (array_like): Initial data for the tensor. Can be a list, tuple, + NumPy ``ndarray``, scalar, and other types. + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if ``None``, infers data type from :attr:`data`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if ``None``, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + requires_grad (bool, optional): If autograd should record operations on the + returned tensor. Default: ``False``. + pin_memory (bool, optional): If set, returned tensor would be allocated in + the pinned memory. Works only for CPU tensors. Default: ``False``. +""" +) + +tf32_notes = { + "tf32_note": """This operator supports :ref:`TensorFloat32`.""" +} + +rocm_fp16_notes = { + "rocm_fp16_note": """On certain ROCm devices, when using float16 inputs this module will use \ +:ref:`different precision` for backward.""" +} + +reproducibility_notes: dict[str, str] = { + "forward_reproducibility_note": """This operation may behave nondeterministically when given tensors on \ +a CUDA device. See :doc:`/notes/randomness` for more information.""", + "backward_reproducibility_note": """This operation may produce nondeterministic gradients when given tensors on \ +a CUDA device. See :doc:`/notes/randomness` for more information.""", + "cudnn_reproducibility_note": """In some circumstances when given tensors on a CUDA device \ +and using CuDNN, this operator may select a nondeterministic algorithm to increase performance. If this is \ +undesirable, you can try to make the operation deterministic (potentially at \ +a performance cost) by setting ``torch.backends.cudnn.deterministic = True``. \ +See :doc:`/notes/randomness` for more information.""", +} + +sparse_support_notes = { + "sparse_beta_warning": """ +.. warning:: + Sparse support is a beta feature and some layout(s)/dtype/device combinations may not be supported, + or may not have autograd support. If you notice missing functionality please + open a feature request.""", +} + +add_docstr( + torch.abs, + r""" +abs(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Computes the absolute value of each element in :attr:`input`. + +.. math:: + \text{out}_{i} = |\text{input}_{i}| +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> torch.abs(torch.tensor([-1, -2, 3])) + tensor([ 1, 2, 3]) +""".format(**common_args), +) + +add_docstr( + torch.absolute, + r""" +absolute(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Alias for :func:`torch.abs` +""", +) + +add_docstr( + torch.acos, + r""" +acos(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Returns a new tensor with the arccosine (in radians) of each element in :attr:`input`. + +.. math:: + \text{out}_{i} = \cos^{-1}(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.3348, -0.5889, 0.2005, -0.1584]) + >>> torch.acos(a) + tensor([ 1.2294, 2.2004, 1.3690, 1.7298]) +""".format(**common_args), +) + +add_docstr( + torch.arccos, + r""" +arccos(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Alias for :func:`torch.acos`. +""", +) + +add_docstr( + torch.acosh, + r""" +acosh(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Returns a new tensor with the inverse hyperbolic cosine of the elements of :attr:`input`. + +.. math:: + \text{out}_{i} = \cosh^{-1}(\text{input}_{i}) + +Note: + The domain of the inverse hyperbolic cosine is `[1, inf)` and values outside this range + will be mapped to ``NaN``, except for `+ INF` for which the output is mapped to `+ INF`. +""" + + r""" +Args: + {input} + +Keyword arguments: + {out} + +Example:: + + >>> a = torch.randn(4).uniform_(1, 2) + >>> a + tensor([ 1.3192, 1.9915, 1.9674, 1.7151 ]) + >>> torch.acosh(a) + tensor([ 0.7791, 1.3120, 1.2979, 1.1341 ]) +""".format(**common_args), +) + +add_docstr( + torch.arccosh, + r""" +arccosh(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Alias for :func:`torch.acosh`. +""", +) + +add_docstr( + torch.index_add, + r""" +index_add(input: Tensor, dim: int, index: Tensor, source: Tensor, *, alpha: Union[Number, _complex] = 1, out: Optional[Tensor]) -> Tensor # noqa: B950 + +See :meth:`~Tensor.index_add_` for function description. +""", +) + +add_docstr( + torch.index_copy, + r""" +index_copy(input: Tensor, dim: int, index: Tensor, source: Tensor, *, out: Optional[Tensor]) -> Tensor + +See :meth:`~Tensor.index_add_` for function description. +""", +) + +add_docstr( + torch.index_reduce, + r""" +index_reduce(input: Tensor, dim: int, index: Tensor, source: Tensor, reduce: str, *, include_self: bool = True, out: Optional[Tensor]) -> Tensor # noqa: B950 + +See :meth:`~Tensor.index_reduce_` for function description. +""", +) + +add_docstr( + torch.add, + r""" +add(input, other, *, alpha=1, out=None) -> Tensor + +Adds :attr:`other`, scaled by :attr:`alpha`, to :attr:`input`. + +.. math:: + \text{{out}}_i = \text{{input}}_i + \text{{alpha}} \times \text{{other}}_i +""" + + r""" + +Supports :ref:`broadcasting to a common shape `, +:ref:`type promotion `, and integer, float, and complex inputs. + +Args: + {input} + other (Tensor or Number): the tensor or number to add to :attr:`input`. + +Keyword arguments: + alpha (Number): the multiplier for :attr:`other`. + {out} + +Examples:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.0202, 1.0985, 1.3506, -0.6056]) + >>> torch.add(a, 20) + tensor([ 20.0202, 21.0985, 21.3506, 19.3944]) + + >>> b = torch.randn(4) + >>> b + tensor([-0.9732, -0.3497, 0.6245, 0.4022]) + >>> c = torch.randn(4, 1) + >>> c + tensor([[ 0.3743], + [-1.7724], + [-0.5811], + [-0.8017]]) + >>> torch.add(b, c, alpha=10) + tensor([[ 2.7695, 3.3930, 4.3672, 4.1450], + [-18.6971, -18.0736, -17.0994, -17.3216], + [ -6.7845, -6.1610, -5.1868, -5.4090], + [ -8.9902, -8.3667, -7.3925, -7.6147]]) +""".format(**common_args), +) + +add_docstr( + torch.addbmm, + r""" +addbmm(input, batch1, batch2, *, beta=1, alpha=1, out=None) -> Tensor + +Performs a batch matrix-matrix product of matrices stored +in :attr:`batch1` and :attr:`batch2`, +with a reduced add step (all matrix multiplications get accumulated +along the first dimension). +:attr:`input` is added to the final result. + +:attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the +same number of matrices. + +If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a +:math:`(b \times m \times p)` tensor, :attr:`input` must be +:ref:`broadcastable ` with a :math:`(n \times p)` tensor +and :attr:`out` will be a :math:`(n \times p)` tensor. + +.. math:: + out = \beta\ \text{input} + \alpha\ (\sum_{i=0}^{b-1} \text{batch1}_i \mathbin{@} \text{batch2}_i) + +If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in +it will not be propagated. +""" + + r""" +For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and :attr:`alpha` +must be real numbers, otherwise they should be integers. + +{tf32_note} + +{rocm_fp16_note} + +Args: + input (Tensor): matrix to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + +Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for `batch1 @ batch2` (:math:`\alpha`) + {out} + +Example:: + + >>> M = torch.randn(3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.addbmm(M, batch1, batch2) + tensor([[ 6.6311, 0.0503, 6.9768, -12.0362, -2.1653], + [ -4.8185, -1.4255, -6.6760, 8.9453, 2.5743], + [ -3.8202, 4.3691, 1.0943, -1.1109, 5.4730]]) +""".format(**common_args, **tf32_notes, **rocm_fp16_notes), +) + +add_docstr( + torch.addcdiv, + r""" +addcdiv(input, tensor1, tensor2, *, value=1, out=None) -> Tensor + +Performs the element-wise division of :attr:`tensor1` by :attr:`tensor2`, +multiplies the result by the scalar :attr:`value` and adds it to :attr:`input`. + +.. warning:: + Integer division with addcdiv is no longer supported, and in a future + release addcdiv will perform a true division of tensor1 and tensor2. + The historic addcdiv behavior can be implemented as + (input + value * torch.trunc(tensor1 / tensor2)).to(input.dtype) + for integer inputs and as (input + value * tensor1 / tensor2) for float inputs. + The future addcdiv behavior is just the latter implementation: + (input + value * tensor1 / tensor2), for all dtypes. + +.. math:: + \text{out}_i = \text{input}_i + \text{value} \times \frac{\text{tensor1}_i}{\text{tensor2}_i} +""" + + r""" + +The shapes of :attr:`input`, :attr:`tensor1`, and :attr:`tensor2` must be +:ref:`broadcastable `. + +For inputs of type `FloatTensor` or `DoubleTensor`, :attr:`value` must be +a real number, otherwise an integer. + +Args: + input (Tensor): the tensor to be added + tensor1 (Tensor): the numerator tensor + tensor2 (Tensor): the denominator tensor + +Keyword args: + value (Number, optional): multiplier for :math:`\text{{tensor1}} / \text{{tensor2}}` + {out} + +Example:: + + >>> t = torch.randn(1, 3) + >>> t1 = torch.randn(3, 1) + >>> t2 = torch.randn(1, 3) + >>> torch.addcdiv(t, t1, t2, value=0.1) + tensor([[-0.2312, -3.6496, 0.1312], + [-1.0428, 3.4292, -0.1030], + [-0.5369, -0.9829, 0.0430]]) +""".format(**common_args), +) + +add_docstr( + torch.addcmul, + r""" +addcmul(input, tensor1, tensor2, *, value=1, out=None) -> Tensor + +Performs the element-wise multiplication of :attr:`tensor1` +by :attr:`tensor2`, multiplies the result by the scalar :attr:`value` +and adds it to :attr:`input`. + +.. math:: + \text{out}_i = \text{input}_i + \text{value} \times \text{tensor1}_i \times \text{tensor2}_i +""" + + r""" +The shapes of :attr:`tensor`, :attr:`tensor1`, and :attr:`tensor2` must be +:ref:`broadcastable `. + +For inputs of type `FloatTensor` or `DoubleTensor`, :attr:`value` must be +a real number, otherwise an integer. + +Args: + input (Tensor): the tensor to be added + tensor1 (Tensor): the tensor to be multiplied + tensor2 (Tensor): the tensor to be multiplied + +Keyword args: + value (Number, optional): multiplier for :math:`tensor1 .* tensor2` + {out} + +Example:: + + >>> t = torch.randn(1, 3) + >>> t1 = torch.randn(3, 1) + >>> t2 = torch.randn(1, 3) + >>> torch.addcmul(t, t1, t2, value=0.1) + tensor([[-0.8635, -0.6391, 1.6174], + [-0.7617, -0.5879, 1.7388], + [-0.8353, -0.6249, 1.6511]]) +""".format(**common_args), +) + +add_docstr( + torch.addmm, + r""" +addmm(input, mat1, mat2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + +Performs a matrix multiplication of the matrices :attr:`mat1` and :attr:`mat2`. +The matrix :attr:`input` is added to the final result. + +If :attr:`mat1` is a :math:`(n \times m)` tensor, :attr:`mat2` is a +:math:`(m \times p)` tensor, then :attr:`input` must be +:ref:`broadcastable ` with a :math:`(n \times p)` tensor +and :attr:`out` will be a :math:`(n \times p)` tensor. + +:attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between +:attr:`mat1` and :attr:`mat2` and the added matrix :attr:`input` respectively. + +.. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat1}_i \mathbin{@} \text{mat2}_i) + +If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in +it will not be propagated. +""" + + r""" +For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and +:attr:`alpha` must be real numbers, otherwise they should be integers. + +This operation has support for arguments with :ref:`sparse layouts`. If +:attr:`input` is sparse the result will have the same layout and if :attr:`out` +is provided it must have the same layout as :attr:`input`. + +{sparse_beta_warning} + +{tf32_note} + +{rocm_fp16_note} + +Args: + input (Tensor): matrix to be added + mat1 (Tensor): the first matrix to be matrix multiplied + mat2 (Tensor): the second matrix to be matrix multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + +Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\alpha`) + {out} + +Example:: + + >>> M = torch.randn(2, 3) + >>> mat1 = torch.randn(2, 3) + >>> mat2 = torch.randn(3, 3) + >>> torch.addmm(M, mat1, mat2) + tensor([[-4.8716, 1.4671, -1.3746], + [ 0.7573, -3.9555, -2.8681]]) +""".format(**common_args, **tf32_notes, **rocm_fp16_notes, **sparse_support_notes), +) + +add_docstr( + torch.adjoint, + r""" +adjoint(input: Tensor) -> Tensor +Returns a view of the tensor conjugated and with the last two dimensions transposed. + +``x.adjoint()`` is equivalent to ``x.transpose(-2, -1).conj()`` for complex tensors and +to ``x.transpose(-2, -1)`` for real tensors. + +Args: + {input} + +Example:: + + >>> x = torch.arange(4, dtype=torch.float) + >>> A = torch.complex(x, x).reshape(2, 2) + >>> A + tensor([[0.+0.j, 1.+1.j], + [2.+2.j, 3.+3.j]]) + >>> A.adjoint() + tensor([[0.-0.j, 2.-2.j], + [1.-1.j, 3.-3.j]]) + >>> (A.adjoint() == A.mH).all() + tensor(True) +""", +) + +add_docstr( + torch.sspaddmm, + r""" +sspaddmm(input, mat1, mat2, *, beta=1, alpha=1, out=None) -> Tensor + +Matrix multiplies a sparse tensor :attr:`mat1` with a dense tensor +:attr:`mat2`, then adds the sparse tensor :attr:`input` to the result. + +Note: This function is equivalent to :func:`torch.addmm`, except +:attr:`input` and :attr:`mat1` are sparse. + +Args: + input (Tensor): a sparse matrix to be added + mat1 (Tensor): a sparse matrix to be matrix multiplied + mat2 (Tensor): a dense matrix to be matrix multiplied + +Keyword args: + beta (Number, optional): multiplier for :attr:`mat` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat1 @ mat2` (:math:`\alpha`) + {out} +""".format(**common_args), +) + +add_docstr( + torch.smm, + r""" +smm(input, mat) -> Tensor + +Performs a matrix multiplication of the sparse matrix :attr:`input` +with the dense matrix :attr:`mat`. + +Args: + input (Tensor): a sparse matrix to be matrix multiplied + mat (Tensor): a dense matrix to be matrix multiplied +""", +) + +add_docstr( + torch.addmv, + r""" +addmv(input, mat, vec, *, beta=1, alpha=1, out=None) -> Tensor + +Performs a matrix-vector product of the matrix :attr:`mat` and +the vector :attr:`vec`. +The vector :attr:`input` is added to the final result. + +If :attr:`mat` is a :math:`(n \times m)` tensor, :attr:`vec` is a 1-D tensor of +size `m`, then :attr:`input` must be +:ref:`broadcastable ` with a 1-D tensor of size `n` and +:attr:`out` will be 1-D tensor of size `n`. + +:attr:`alpha` and :attr:`beta` are scaling factors on matrix-vector product between +:attr:`mat` and :attr:`vec` and the added tensor :attr:`input` respectively. + +.. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{mat} \mathbin{@} \text{vec}) + +If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in +it will not be propagated. +""" + + r""" +For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and +:attr:`alpha` must be real numbers, otherwise they should be integers. + +Args: + input (Tensor): vector to be added + mat (Tensor): matrix to be matrix multiplied + vec (Tensor): vector to be matrix multiplied + +Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`mat @ vec` (:math:`\alpha`) + {out} + +Example:: + + >>> M = torch.randn(2) + >>> mat = torch.randn(2, 3) + >>> vec = torch.randn(3) + >>> torch.addmv(M, mat, vec) + tensor([-0.3768, -5.5565]) +""".format(**common_args), +) + +add_docstr( + torch.addr, + r""" +addr(input, vec1, vec2, *, beta=1, alpha=1, out=None) -> Tensor + +Performs the outer-product of vectors :attr:`vec1` and :attr:`vec2` +and adds it to the matrix :attr:`input`. + +Optional values :attr:`beta` and :attr:`alpha` are scaling factors on the +outer product between :attr:`vec1` and :attr:`vec2` and the added matrix +:attr:`input` respectively. + +.. math:: + \text{out} = \beta\ \text{input} + \alpha\ (\text{vec1} \otimes \text{vec2}) + +If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in +it will not be propagated. +""" + + r""" +If :attr:`vec1` is a vector of size `n` and :attr:`vec2` is a vector +of size `m`, then :attr:`input` must be +:ref:`broadcastable ` with a matrix of size +:math:`(n \times m)` and :attr:`out` will be a matrix of size +:math:`(n \times m)`. + +Args: + input (Tensor): matrix to be added + vec1 (Tensor): the first vector of the outer product + vec2 (Tensor): the second vector of the outer product + +Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{{vec1}} \otimes \text{{vec2}}` (:math:`\alpha`) + {out} + +Example:: + + >>> vec1 = torch.arange(1., 4.) + >>> vec2 = torch.arange(1., 3.) + >>> M = torch.zeros(3, 2) + >>> torch.addr(M, vec1, vec2) + tensor([[ 1., 2.], + [ 2., 4.], + [ 3., 6.]]) +""".format(**common_args), +) + +add_docstr( + torch.allclose, + r""" +allclose(input: Tensor, other: Tensor, rtol: float = 1e-05, atol: float = 1e-08, equal_nan: bool = False) -> bool + +This function checks if :attr:`input` and :attr:`other` satisfy the condition: + +.. math:: + \lvert \text{input}_i - \text{other}_i \rvert \leq \texttt{atol} + \texttt{rtol} \times \lvert \text{other}_i \rvert +""" + + r""" +elementwise, for all elements of :attr:`input` and :attr:`other`. The behaviour of this function is analogous to +`numpy.allclose `_ + +Args: + input (Tensor): first tensor to compare + other (Tensor): second tensor to compare + atol (float, optional): absolute tolerance. Default: 1e-08 + rtol (float, optional): relative tolerance. Default: 1e-05 + equal_nan (bool, optional): if ``True``, then two ``NaN`` s will be considered equal. Default: ``False`` + +Example:: + + >>> torch.allclose(torch.tensor([10000., 1e-07]), torch.tensor([10000.1, 1e-08])) + False + >>> torch.allclose(torch.tensor([10000., 1e-08]), torch.tensor([10000.1, 1e-09])) + True + >>> torch.allclose(torch.tensor([1.0, float('nan')]), torch.tensor([1.0, float('nan')])) + False + >>> torch.allclose(torch.tensor([1.0, float('nan')]), torch.tensor([1.0, float('nan')]), equal_nan=True) + True +""", +) + +add_docstr( + torch.all, + r""" +all(input: Tensor, *, out=None) -> Tensor + +Tests if all elements in :attr:`input` evaluate to `True`. + +.. note:: This function matches the behaviour of NumPy in returning + output of dtype `bool` for all supported dtypes except `uint8`. + For `uint8` the dtype of output is `uint8` itself. + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.rand(1, 2).bool() + >>> a + tensor([[False, True]], dtype=torch.bool) + >>> torch.all(a) + tensor(False, dtype=torch.bool) + >>> a = torch.arange(0, 3) + >>> a + tensor([0, 1, 2]) + >>> torch.all(a) + tensor(False) + +.. function:: all(input, dim, keepdim=False, *, out=None) -> Tensor + :noindex: + +For each row of :attr:`input` in the given dimension :attr:`dim`, +returns `True` if all elements in the row evaluate to `True` and `False` otherwise. + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword args: + {out} + +Example:: + + >>> a = torch.rand(4, 2).bool() + >>> a + tensor([[True, True], + [True, False], + [True, True], + [True, True]], dtype=torch.bool) + >>> torch.all(a, dim=1) + tensor([ True, False, True, True], dtype=torch.bool) + >>> torch.all(a, dim=0) + tensor([ True, False], dtype=torch.bool) +""".format(**multi_dim_common), +) + +add_docstr( + torch.any, + r""" +any(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Tests if any element in :attr:`input` evaluates to `True`. + +.. note:: This function matches the behaviour of NumPy in returning + output of dtype `bool` for all supported dtypes except `uint8`. + For `uint8` the dtype of output is `uint8` itself. + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.rand(1, 2).bool() + >>> a + tensor([[False, True]], dtype=torch.bool) + >>> torch.any(a) + tensor(True, dtype=torch.bool) + >>> a = torch.arange(0, 3) + >>> a + tensor([0, 1, 2]) + >>> torch.any(a) + tensor(True) + +.. function:: any(input, dim, keepdim=False, *, out=None) -> Tensor + :noindex: + +For each row of :attr:`input` in the given dimension :attr:`dim`, +returns `True` if any element in the row evaluate to `True` and `False` otherwise. + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4, 2) < 0 + >>> a + tensor([[ True, True], + [False, True], + [ True, True], + [False, False]]) + >>> torch.any(a, 1) + tensor([ True, True, True, False]) + >>> torch.any(a, 0) + tensor([True, True]) +""".format(**multi_dim_common), +) + +add_docstr( + torch.angle, + r""" +angle(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Computes the element-wise angle (in radians) of the given :attr:`input` tensor. + +.. math:: + \text{out}_{i} = angle(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +.. note:: Starting in PyTorch 1.8, angle returns pi for negative real numbers, + zero for non-negative real numbers, and propagates NaNs. Previously + the function would return zero for all real numbers and not propagate + floating-point NaNs. + +Example:: + + >>> torch.angle(torch.tensor([-1 + 1j, -2 + 2j, 3 - 3j]))*180/3.14159 + tensor([ 135., 135, -45]) +""".format(**common_args), +) + +add_docstr( + torch.as_strided, + r""" +as_strided(input, size, stride, storage_offset=None) -> Tensor + +Create a view of an existing `torch.Tensor` :attr:`input` with specified +:attr:`size`, :attr:`stride` and :attr:`storage_offset`. + +.. warning:: + Prefer using other view functions, like :meth:`torch.Tensor.view` or + :meth:`torch.Tensor.expand`, to setting a view's strides manually with + `as_strided`, as this function will throw an error on non-standard Pytorch + backends (that do not have a concept of stride) and the result will depend + on the current layout in memory. The constructed view must only refer to + elements within the Tensor's storage or a runtime error will be thrown. + If the generated view is "overlapped" (with multiple indices referring to + the same element in memory), the behavior of inplace operations on this view + is undefined (and might not throw runtime errors). + +Args: + {input} + size (tuple or ints): the shape of the output tensor + stride (tuple or ints): the stride of the output tensor + storage_offset (int, optional): the offset in the underlying storage of the output tensor. + If ``None``, the storage_offset of the output tensor will match the input tensor. + +Example:: + + >>> x = torch.randn(3, 3) + >>> x + tensor([[ 0.9039, 0.6291, 1.0795], + [ 0.1586, 2.1939, -0.4900], + [-0.1909, -0.7503, 1.9355]]) + >>> t = torch.as_strided(x, (2, 2), (1, 2)) + >>> t + tensor([[0.9039, 1.0795], + [0.6291, 0.1586]]) + >>> t = torch.as_strided(x, (2, 2), (1, 2), 1) + tensor([[0.6291, 0.1586], + [1.0795, 2.1939]]) +""".format(**common_args), +) + +add_docstr( + torch.as_tensor, + r""" +as_tensor(data: Any, dtype: Optional[dtype] = None, device: Optional[DeviceLikeType]) -> Tensor + +Converts :attr:`data` into a tensor, sharing data and preserving autograd +history if possible. + +If :attr:`data` is already a tensor with the requested dtype and device +then :attr:`data` itself is returned, but if :attr:`data` is a +tensor with a different dtype or device then it's copied as if using +`data.to(dtype=dtype, device=device)`. + +If :attr:`data` is a NumPy array (an ndarray) with the same dtype and device then a +tensor is constructed using :func:`torch.from_numpy`. + +If :attr:`data` is a CuPy array, the returned tensor will be located on the same device as the CuPy array unless +specifically overwritten by :attr:`device` or a default device. The device of the CuPy array is inferred from the +pointer of the array using `cudaPointerGetAttributes` unless :attr:`device` is provided with an explicit device index. + +.. seealso:: + + :func:`torch.tensor` never shares its data and creates a new "leaf tensor" (see :doc:`/notes/autograd`). + + +Args: + {data} + {dtype} + device (:class:`torch.device`, optional): the device of the constructed tensor. If None and data is a tensor + then the device of data is used. If None and data is not a tensor then + the result tensor is constructed on the current device. + + +Example:: + + >>> a = numpy.array([1, 2, 3]) + >>> t = torch.as_tensor(a) + >>> t + tensor([ 1, 2, 3]) + >>> t[0] = -1 + >>> a + array([-1, 2, 3]) + + >>> a = numpy.array([1, 2, 3]) + >>> t = torch.as_tensor(a, device=torch.device('cuda')) + >>> t + tensor([ 1, 2, 3]) + >>> t[0] = -1 + >>> a + array([1, 2, 3]) +""".format(**factory_data_common_args), +) + +add_docstr( + torch.asin, + r""" +asin(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Returns a new tensor with the arcsine of the elements (in radians) in the :attr:`input` tensor. + +.. math:: + \text{out}_{i} = \sin^{-1}(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-0.5962, 1.4985, -0.4396, 1.4525]) + >>> torch.asin(a) + tensor([-0.6387, nan, -0.4552, nan]) +""".format(**common_args), +) + +add_docstr( + torch.arcsin, + r""" +arcsin(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Alias for :func:`torch.asin`. +""", +) + +add_docstr( + torch.asinh, + r""" +asinh(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Returns a new tensor with the inverse hyperbolic sine of the elements of :attr:`input`. + +.. math:: + \text{out}_{i} = \sinh^{-1}(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword arguments: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.1606, -1.4267, -1.0899, -1.0250 ]) + >>> torch.asinh(a) + tensor([ 0.1599, -1.1534, -0.9435, -0.8990 ]) +""".format(**common_args), +) + +add_docstr( + torch.arcsinh, + r""" +arcsinh(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Alias for :func:`torch.asinh`. +""", +) + +add_docstr( + torch.atan, + r""" +atan(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Returns a new tensor with the arctangent of the elements (in radians) in the :attr:`input` tensor. + +.. math:: + \text{out}_{i} = \tan^{-1}(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.2341, 0.2539, -0.6256, -0.6448]) + >>> torch.atan(a) + tensor([ 0.2299, 0.2487, -0.5591, -0.5727]) +""".format(**common_args), +) + +add_docstr( + torch.arctan, + r""" +arctan(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Alias for :func:`torch.atan`. +""", +) + +add_docstr( + torch.atan2, + r""" +atan2(input: Tensor, other: Tensor, *, out: Optional[Tensor]) -> Tensor + +Element-wise arctangent of :math:`\text{{input}}_{{i}} / \text{{other}}_{{i}}` +with consideration of the quadrant. Returns a new tensor with the signed angles +in radians between vector :math:`(\text{{other}}_{{i}}, \text{{input}}_{{i}})` +and vector :math:`(1, 0)`. (Note that :math:`\text{{other}}_{{i}}`, the second +parameter, is the x-coordinate, while :math:`\text{{input}}_{{i}}`, the first +parameter, is the y-coordinate.) + +The shapes of ``input`` and ``other`` must be +:ref:`broadcastable `. + +Args: + input (Tensor): the first input tensor + other (Tensor): the second input tensor + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.9041, 0.0196, -0.3108, -2.4423]) + >>> torch.atan2(a, torch.randn(4)) + tensor([ 0.9833, 0.0811, -1.9743, -1.4151]) +""".format(**common_args), +) + +add_docstr( + torch.arctan2, + r""" +arctan2(input: Tensor, other: Tensor, *, out: Optional[Tensor]) -> Tensor +Alias for :func:`torch.atan2`. +""", +) + +add_docstr( + torch.atanh, + r""" +atanh(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Returns a new tensor with the inverse hyperbolic tangent of the elements of :attr:`input`. + +Note: + The domain of the inverse hyperbolic tangent is `(-1, 1)` and values outside this range + will be mapped to ``NaN``, except for the values `1` and `-1` for which the output is + mapped to `+/-INF` respectively. + +.. math:: + \text{out}_{i} = \tanh^{-1}(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword arguments: + {out} + +Example:: + + >>> a = torch.randn(4).uniform_(-1, 1) + >>> a + tensor([ -0.9385, 0.2968, -0.8591, -0.1871 ]) + >>> torch.atanh(a) + tensor([ -1.7253, 0.3060, -1.2899, -0.1893 ]) +""".format(**common_args), +) + +add_docstr( + torch.arctanh, + r""" +arctanh(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Alias for :func:`torch.atanh`. +""", +) + +add_docstr( + torch.asarray, + r""" +asarray(obj: Any, *, dtype: Optional[dtype], device: Optional[DeviceLikeType], copy: Optional[bool] = None, requires_grad: bool = False) -> Tensor # noqa: B950 + +Converts :attr:`obj` to a tensor. + +:attr:`obj` can be one of: + +1. a tensor +2. a NumPy array or a NumPy scalar +3. a DLPack capsule +4. an object that implements Python's buffer protocol +5. a scalar +6. a sequence of scalars + +When :attr:`obj` is a tensor, NumPy array, or DLPack capsule the returned tensor will, +by default, not require a gradient, have the same datatype as :attr:`obj`, be on the +same device, and share memory with it. These properties can be controlled with the +:attr:`dtype`, :attr:`device`, :attr:`copy`, and :attr:`requires_grad` keyword arguments. +If the returned tensor is of a different datatype, on a different device, or a copy is +requested then it will not share its memory with :attr:`obj`. If :attr:`requires_grad` +is ``True`` then the returned tensor will require a gradient, and if :attr:`obj` is +also a tensor with an autograd history then the returned tensor will have the same history. + +When :attr:`obj` is not a tensor, NumPy array, or DLPack capsule but implements Python's +buffer protocol then the buffer is interpreted as an array of bytes grouped according to +the size of the datatype passed to the :attr:`dtype` keyword argument. (If no datatype is +passed then the default floating point datatype is used, instead.) The returned tensor +will have the specified datatype (or default floating point datatype if none is specified) +and, by default, be on the CPU device and share memory with the buffer. + +When :attr:`obj` is a NumPy scalar, the returned tensor will be a 0-dimensional tensor on +the CPU and that doesn't share its memory (i.e. ``copy=True``). By default datatype will +be the PyTorch datatype corresponding to the NumPy's scalar's datatype. + +When :attr:`obj` is none of the above but a scalar, or a sequence of scalars then the +returned tensor will, by default, infer its datatype from the scalar values, be on the +current default device, and not share its memory. + +.. seealso:: + + :func:`torch.tensor` creates a tensor that always copies the data from the input object. + :func:`torch.from_numpy` creates a tensor that always shares memory from NumPy arrays. + :func:`torch.frombuffer` creates a tensor that always shares memory from objects that + implement the buffer protocol. + :func:`torch.from_dlpack` creates a tensor that always shares memory from + DLPack capsules. + +Args: + obj (object): a tensor, NumPy array, DLPack Capsule, object that implements Python's + buffer protocol, scalar, or sequence of scalars. + +Keyword args: + dtype (:class:`torch.dtype`, optional): the datatype of the returned tensor. + Default: ``None``, which causes the datatype of the returned tensor to be + inferred from :attr:`obj`. + copy (bool, optional): controls whether the returned tensor shares memory with :attr:`obj`. + Default: ``None``, which causes the returned tensor to share memory with :attr:`obj` + whenever possible. If ``True`` then the returned tensor does not share its memory. + If ``False`` then the returned tensor shares its memory with :attr:`obj` and an + error is thrown if it cannot. + device (:class:`torch.device`, optional): the device of the returned tensor. + Default: ``None``, which causes the device of :attr:`obj` to be used. Or, if + :attr:`obj` is a Python sequence, the current default device will be used. + requires_grad (bool, optional): whether the returned tensor requires grad. + Default: ``False``, which causes the returned tensor not to require a gradient. + If ``True``, then the returned tensor will require a gradient, and if :attr:`obj` + is also a tensor with an autograd history then the returned tensor will have + the same history. + +Example:: + + >>> a = torch.tensor([1, 2, 3]) + >>> # Shares memory with tensor 'a' + >>> b = torch.asarray(a) + >>> a.data_ptr() == b.data_ptr() + True + >>> # Forces memory copy + >>> c = torch.asarray(a, copy=True) + >>> a.data_ptr() == c.data_ptr() + False + + >>> a = torch.tensor([1., 2., 3.], requires_grad=True) + >>> b = a + 2 + >>> b + tensor([3., 4., 5.], grad_fn=) + >>> # Shares memory with tensor 'b', with no grad + >>> c = torch.asarray(b) + >>> c + tensor([3., 4., 5.]) + >>> # Shares memory with tensor 'b', retaining autograd history + >>> d = torch.asarray(b, requires_grad=True) + >>> d + tensor([3., 4., 5.], grad_fn=) + + >>> array = numpy.array([1, 2, 3]) + >>> # Shares memory with array 'array' + >>> t1 = torch.asarray(array) + >>> array.__array_interface__['data'][0] == t1.data_ptr() + True + >>> # Copies memory due to dtype mismatch + >>> t2 = torch.asarray(array, dtype=torch.float32) + >>> array.__array_interface__['data'][0] == t2.data_ptr() + False + + >>> scalar = numpy.float64(0.5) + >>> torch.asarray(scalar) + tensor(0.5000, dtype=torch.float64) +""", +) + +add_docstr( + torch.baddbmm, + r""" +baddbmm(input, batch1, batch2, out_dtype=None, *, beta=1, alpha=1, out=None) -> Tensor + +Performs a batch matrix-matrix product of matrices in :attr:`batch1` +and :attr:`batch2`. +:attr:`input` is added to the final result. + +:attr:`batch1` and :attr:`batch2` must be 3-D tensors each containing the same +number of matrices. + +If :attr:`batch1` is a :math:`(b \times n \times m)` tensor, :attr:`batch2` is a +:math:`(b \times m \times p)` tensor, then :attr:`input` must be +:ref:`broadcastable ` with a +:math:`(b \times n \times p)` tensor and :attr:`out` will be a +:math:`(b \times n \times p)` tensor. Both :attr:`alpha` and :attr:`beta` mean the +same as the scaling factors used in :meth:`torch.addbmm`. + +.. math:: + \text{out}_i = \beta\ \text{input}_i + \alpha\ (\text{batch1}_i \mathbin{@} \text{batch2}_i) + +If :attr:`beta` is 0, then the content of :attr:`input` will be ignored, and `nan` and `inf` in +it will not be propagated. +""" + + r""" +For inputs of type `FloatTensor` or `DoubleTensor`, arguments :attr:`beta` and +:attr:`alpha` must be real numbers, otherwise they should be integers. + +{tf32_note} + +{rocm_fp16_note} + +Args: + input (Tensor): the tensor to be added + batch1 (Tensor): the first batch of matrices to be multiplied + batch2 (Tensor): the second batch of matrices to be multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + +Keyword args: + beta (Number, optional): multiplier for :attr:`input` (:math:`\beta`) + alpha (Number, optional): multiplier for :math:`\text{{batch1}} \mathbin{{@}} \text{{batch2}}` (:math:`\alpha`) + {out} + +Example:: + + >>> M = torch.randn(10, 3, 5) + >>> batch1 = torch.randn(10, 3, 4) + >>> batch2 = torch.randn(10, 4, 5) + >>> torch.baddbmm(M, batch1, batch2).size() + torch.Size([10, 3, 5]) +""".format(**common_args, **tf32_notes, **rocm_fp16_notes), +) + +add_docstr( + torch.bernoulli, + r""" +bernoulli(input: Tensor, *, generator: Optional[Generator], out: Optional[Tensor]) -> Tensor + +Draws binary random numbers (0 or 1) from a Bernoulli distribution. + +The :attr:`input` tensor should be a tensor containing probabilities +to be used for drawing the binary random number. +Hence, all values in :attr:`input` have to be in the range: +:math:`0 \leq \text{input}_i \leq 1`. + +The :math:`\text{i}^{th}` element of the output tensor will draw a +value :math:`1` according to the :math:`\text{i}^{th}` probability value given +in :attr:`input`. + +.. math:: + \text{out}_{i} \sim \mathrm{Bernoulli}(p = \text{input}_{i}) +""" + + r""" +The returned :attr:`out` tensor only has values 0 or 1 and is of the same +shape as :attr:`input`. + +:attr:`out` can have integral ``dtype``, but :attr:`input` must have floating +point ``dtype``. + +Args: + input (Tensor): the input tensor of probability values for the Bernoulli distribution + +Keyword args: + {generator} + {out} + +Example:: + + >>> a = torch.empty(3, 3).uniform_(0, 1) # generate a uniform random matrix with range [0, 1] + >>> a + tensor([[ 0.1737, 0.0950, 0.3609], + [ 0.7148, 0.0289, 0.2676], + [ 0.9456, 0.8937, 0.7202]]) + >>> torch.bernoulli(a) + tensor([[ 1., 0., 0.], + [ 0., 0., 0.], + [ 1., 1., 1.]]) + + >>> a = torch.ones(3, 3) # probability of drawing "1" is 1 + >>> torch.bernoulli(a) + tensor([[ 1., 1., 1.], + [ 1., 1., 1.], + [ 1., 1., 1.]]) + >>> a = torch.zeros(3, 3) # probability of drawing "1" is 0 + >>> torch.bernoulli(a) + tensor([[ 0., 0., 0.], + [ 0., 0., 0.], + [ 0., 0., 0.]]) +""".format(**common_args), +) + +add_docstr( + torch.bincount, + r""" +bincount(input, weights=None, minlength=0) -> Tensor + +Count the frequency of each value in an array of non-negative ints. + +The number of bins (size 1) is one larger than the largest value in +:attr:`input` unless :attr:`input` is empty, in which case the result is a +tensor of size 0. If :attr:`minlength` is specified, the number of bins is at least +:attr:`minlength` and if :attr:`input` is empty, then the result is tensor of size +:attr:`minlength` filled with zeros. If ``n`` is the value at position ``i``, +``out[n] += weights[i]`` if :attr:`weights` is specified else +``out[n] += 1``. + +Note: + {backward_reproducibility_note} + +Arguments: + input (Tensor): 1-d int tensor + weights (Tensor): optional, weight for each value in the input tensor. + Should be of same size as input tensor. + minlength (int): optional, minimum number of bins. Should be non-negative. + +Returns: + output (Tensor): a tensor of shape ``Size([max(input) + 1])`` if + :attr:`input` is non-empty, else ``Size(0)`` + +Example:: + + >>> input = torch.randint(0, 8, (5,), dtype=torch.int64) + >>> weights = torch.linspace(0, 1, steps=5) + >>> input, weights + (tensor([4, 3, 6, 3, 4]), + tensor([ 0.0000, 0.2500, 0.5000, 0.7500, 1.0000]) + + >>> torch.bincount(input) + tensor([0, 0, 0, 2, 2, 0, 1]) + + >>> input.bincount(weights) + tensor([0.0000, 0.0000, 0.0000, 1.0000, 1.0000, 0.0000, 0.5000]) +""".format(**reproducibility_notes), +) + +add_docstr( + torch.bitwise_not, + r""" +bitwise_not(input, *, out=None) -> Tensor + +Computes the bitwise NOT of the given input tensor. The input tensor must be of +integral or Boolean types. For bool tensors, it computes the logical NOT. + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> torch.bitwise_not(torch.tensor([-1, -2, 3], dtype=torch.int8)) + tensor([ 0, 1, -4], dtype=torch.int8) +""".format(**common_args), +) + +add_docstr( + torch.bmm, + r""" +bmm(input, mat2, out_dtype=None, *, out=None) -> Tensor + +Performs a batch matrix-matrix product of matrices stored in :attr:`input` +and :attr:`mat2`. + +:attr:`input` and :attr:`mat2` must be 3-D tensors each containing +the same number of matrices. + +If :attr:`input` is a :math:`(b \times n \times m)` tensor, :attr:`mat2` is a +:math:`(b \times m \times p)` tensor, :attr:`out` will be a +:math:`(b \times n \times p)` tensor. + +.. math:: + \text{out}_i = \text{input}_i \mathbin{@} \text{mat2}_i +""" + + r""" +{tf32_note} + +{rocm_fp16_note} + +.. note:: This function does not :ref:`broadcast `. + For broadcasting matrix products, see :func:`torch.matmul`. + +Args: + input (Tensor): the first batch of matrices to be multiplied + mat2 (Tensor): the second batch of matrices to be multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + +Keyword Args: + {out} + +Example:: + + >>> input = torch.randn(10, 3, 4) + >>> mat2 = torch.randn(10, 4, 5) + >>> res = torch.bmm(input, mat2) + >>> res.size() + torch.Size([10, 3, 5]) +""".format(**common_args, **tf32_notes, **rocm_fp16_notes), +) + +add_docstr( + torch.bitwise_and, + r""" +bitwise_and(input, other, *, out=None) -> Tensor + +Computes the bitwise AND of :attr:`input` and :attr:`other`. The input tensor must be of +integral or Boolean types. For bool tensors, it computes the logical AND. + +Args: + input: the first input tensor + other: the second input tensor + +Keyword args: + {out} + +Example:: + + >>> torch.bitwise_and(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([1, 0, 3], dtype=torch.int8) + >>> torch.bitwise_and(torch.tensor([True, True, False]), torch.tensor([False, True, False])) + tensor([ False, True, False]) +""".format(**common_args), +) + +add_docstr( + torch.bitwise_or, + r""" +bitwise_or(input: Tensor, other: Tensor, *, out: Optional[Tensor]) -> Tensor + +Computes the bitwise OR of :attr:`input` and :attr:`other`. The input tensor must be of +integral or Boolean types. For bool tensors, it computes the logical OR. + +Args: + input: the first input tensor + other: the second input tensor + +Keyword args: + {out} + +Example:: + + >>> torch.bitwise_or(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-1, -2, 3], dtype=torch.int8) + >>> torch.bitwise_or(torch.tensor([True, True, False]), torch.tensor([False, True, False])) + tensor([ True, True, False]) +""".format(**common_args), +) + +add_docstr( + torch.bitwise_xor, + r""" +bitwise_xor(input, other, *, out=None) -> Tensor + +Computes the bitwise XOR of :attr:`input` and :attr:`other`. The input tensor must be of +integral or Boolean types. For bool tensors, it computes the logical XOR. + +Args: + input: the first input tensor + other: the second input tensor + +Keyword args: + {out} + +Example:: + + >>> torch.bitwise_xor(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-2, -2, 0], dtype=torch.int8) + >>> torch.bitwise_xor(torch.tensor([True, True, False]), torch.tensor([False, True, False])) + tensor([ True, False, False]) +""".format(**common_args), +) + +add_docstr( + torch.bitwise_left_shift, + r""" +bitwise_left_shift(input, other, *, out=None) -> Tensor + +Computes the left arithmetic shift of :attr:`input` by :attr:`other` bits. +The input tensor must be of integral type. This operator supports +:ref:`broadcasting to a common shape ` and +:ref:`type promotion `. + +The operation applied is: + +.. math:: + \text{{out}}_i = \text{{input}}_i << \text{{other}}_i + +Args: + input (Tensor or Scalar): the first input tensor + other (Tensor or Scalar): the second input tensor + +Keyword args: + {out} + +Example:: + + >>> torch.bitwise_left_shift(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-2, -2, 24], dtype=torch.int8) +""".format(**common_args), +) + +add_docstr( + torch.bitwise_right_shift, + r""" +bitwise_right_shift(input, other, *, out=None) -> Tensor + +Computes the right arithmetic shift of :attr:`input` by :attr:`other` bits. +The input tensor must be of integral type. This operator supports +:ref:`broadcasting to a common shape ` and +:ref:`type promotion `. +In any case, if the value of the right operand is negative or is greater +or equal to the number of bits in the promoted left operand, the behavior is undefined. + +The operation applied is: + +.. math:: + \text{{out}}_i = \text{{input}}_i >> \text{{other}}_i + +Args: + input (Tensor or Scalar): the first input tensor + other (Tensor or Scalar): the second input tensor + +Keyword args: + {out} + +Example:: + + >>> torch.bitwise_right_shift(torch.tensor([-2, -7, 31], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) + tensor([-1, -7, 3], dtype=torch.int8) +""".format(**common_args), +) + +add_docstr( + torch.broadcast_to, + r""" +broadcast_to(input, shape) -> Tensor + +Broadcasts :attr:`input` to the shape :attr:`\shape`. +Equivalent to calling ``input.expand(shape)``. See :meth:`~Tensor.expand` for details. + +Args: + {input} + shape (list, tuple, or :class:`torch.Size`): the new shape. + +Example:: + + >>> x = torch.tensor([1, 2, 3]) + >>> torch.broadcast_to(x, (3, 3)) + tensor([[1, 2, 3], + [1, 2, 3], + [1, 2, 3]]) +""".format(**common_args), +) + +add_docstr( + torch.stack, + r""" +stack(tensors, dim=0, *, out=None) -> Tensor + +Concatenates a sequence of tensors along a new dimension. + +All tensors need to be of the same size. + +.. seealso:: + + :func:`torch.cat` concatenates the given sequence along an existing dimension. + +Arguments: + tensors (sequence of Tensors): sequence of tensors to concatenate + dim (int, optional): dimension to insert. Has to be between 0 and the number + of dimensions of concatenated tensors (inclusive). Default: 0 + +Keyword args: + {out} + +Example:: + + >>> x = torch.randn(2, 3) + >>> x + tensor([[ 0.3367, 0.1288, 0.2345], + [ 0.2303, -1.1229, -0.1863]]) + >>> torch.stack((x, x)) # same as torch.stack((x, x), dim=0) + tensor([[[ 0.3367, 0.1288, 0.2345], + [ 0.2303, -1.1229, -0.1863]], + + [[ 0.3367, 0.1288, 0.2345], + [ 0.2303, -1.1229, -0.1863]]]) + >>> torch.stack((x, x)).size() + torch.Size([2, 2, 3]) + >>> torch.stack((x, x), dim=1) + tensor([[[ 0.3367, 0.1288, 0.2345], + [ 0.3367, 0.1288, 0.2345]], + + [[ 0.2303, -1.1229, -0.1863], + [ 0.2303, -1.1229, -0.1863]]]) + >>> torch.stack((x, x), dim=2) + tensor([[[ 0.3367, 0.3367], + [ 0.1288, 0.1288], + [ 0.2345, 0.2345]], + + [[ 0.2303, 0.2303], + [-1.1229, -1.1229], + [-0.1863, -0.1863]]]) + >>> torch.stack((x, x), dim=-1) + tensor([[[ 0.3367, 0.3367], + [ 0.1288, 0.1288], + [ 0.2345, 0.2345]], + + [[ 0.2303, 0.2303], + [-1.1229, -1.1229], + [-0.1863, -0.1863]]]) +""".format(**common_args), +) + +add_docstr( + torch.hstack, + r""" +hstack(tensors, *, out=None) -> Tensor + +Stack tensors in sequence horizontally (column wise). + +This is equivalent to concatenation along the first axis for 1-D tensors, and along the second axis for all other tensors. + +Args: + tensors (sequence of Tensors): sequence of tensors to concatenate + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor([1, 2, 3]) + >>> b = torch.tensor([4, 5, 6]) + >>> torch.hstack((a,b)) + tensor([1, 2, 3, 4, 5, 6]) + >>> a = torch.tensor([[1],[2],[3]]) + >>> b = torch.tensor([[4],[5],[6]]) + >>> torch.hstack((a,b)) + tensor([[1, 4], + [2, 5], + [3, 6]]) + +""".format(**common_args), +) + +add_docstr( + torch.vstack, + r""" +vstack(tensors, *, out=None) -> Tensor + +Stack tensors in sequence vertically (row wise). + +This is equivalent to concatenation along the first axis after all 1-D tensors have been reshaped by :func:`torch.atleast_2d`. + +Args: + tensors (sequence of Tensors): sequence of tensors to concatenate + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor([1, 2, 3]) + >>> b = torch.tensor([4, 5, 6]) + >>> torch.vstack((a,b)) + tensor([[1, 2, 3], + [4, 5, 6]]) + >>> a = torch.tensor([[1],[2],[3]]) + >>> b = torch.tensor([[4],[5],[6]]) + >>> torch.vstack((a,b)) + tensor([[1], + [2], + [3], + [4], + [5], + [6]]) + + +""".format(**common_args), +) + +add_docstr( + torch.dstack, + r""" +dstack(tensors, *, out=None) -> Tensor + +Stack tensors in sequence depthwise (along third axis). + +This is equivalent to concatenation along the third axis after 1-D and 2-D tensors have been reshaped by :func:`torch.atleast_3d`. + +Args: + tensors (sequence of Tensors): sequence of tensors to concatenate + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor([1, 2, 3]) + >>> b = torch.tensor([4, 5, 6]) + >>> torch.dstack((a,b)) + tensor([[[1, 4], + [2, 5], + [3, 6]]]) + >>> a = torch.tensor([[1],[2],[3]]) + >>> b = torch.tensor([[4],[5],[6]]) + >>> torch.dstack((a,b)) + tensor([[[1, 4]], + [[2, 5]], + [[3, 6]]]) + + +""".format(**common_args), +) + +add_docstr( + torch.tensor_split, + r""" +tensor_split(input, indices_or_sections, dim=0) -> List of Tensors + +Splits a tensor into multiple sub-tensors, all of which are views of :attr:`input`, +along dimension :attr:`dim` according to the indices or number of sections specified +by :attr:`indices_or_sections`. This function is based on NumPy's +:func:`numpy.array_split`. + +Args: + input (Tensor): the tensor to split + indices_or_sections (Tensor, int or list or tuple of ints): + If :attr:`indices_or_sections` is an integer ``n`` or a zero dimensional long tensor + with value ``n``, :attr:`input` is split into ``n`` sections along dimension :attr:`dim`. + If :attr:`input` is divisible by ``n`` along dimension :attr:`dim`, each + section will be of equal size, :code:`input.size(dim) / n`. If :attr:`input` + is not divisible by ``n``, the sizes of the first :code:`int(input.size(dim) % n)` + sections will have size :code:`int(input.size(dim) / n) + 1`, and the rest will + have size :code:`int(input.size(dim) / n)`. + + If :attr:`indices_or_sections` is a list or tuple of ints, or a one-dimensional long + tensor, then :attr:`input` is split along dimension :attr:`dim` at each of the indices + in the list, tuple or tensor. For instance, :code:`indices_or_sections=[2, 3]` and :code:`dim=0` + would result in the tensors :code:`input[:2]`, :code:`input[2:3]`, and :code:`input[3:]`. + + If :attr:`indices_or_sections` is a tensor, it must be a zero-dimensional or one-dimensional + long tensor on the CPU. + + dim (int, optional): dimension along which to split the tensor. Default: ``0`` + +Example:: + + >>> x = torch.arange(8) + >>> torch.tensor_split(x, 3) + (tensor([0, 1, 2]), tensor([3, 4, 5]), tensor([6, 7])) + + >>> x = torch.arange(7) + >>> torch.tensor_split(x, 3) + (tensor([0, 1, 2]), tensor([3, 4]), tensor([5, 6])) + >>> torch.tensor_split(x, (1, 6)) + (tensor([0]), tensor([1, 2, 3, 4, 5]), tensor([6])) + + >>> x = torch.arange(14).reshape(2, 7) + >>> x + tensor([[ 0, 1, 2, 3, 4, 5, 6], + [ 7, 8, 9, 10, 11, 12, 13]]) + >>> torch.tensor_split(x, 3, dim=1) + (tensor([[0, 1, 2], + [7, 8, 9]]), + tensor([[ 3, 4], + [10, 11]]), + tensor([[ 5, 6], + [12, 13]])) + >>> torch.tensor_split(x, (1, 6), dim=1) + (tensor([[0], + [7]]), + tensor([[ 1, 2, 3, 4, 5], + [ 8, 9, 10, 11, 12]]), + tensor([[ 6], + [13]])) +""", +) + +add_docstr( + torch.chunk, + r""" +chunk(input: Tensor, chunks: int, dim: int = 0) -> Tuple[Tensor, ...] + +Attempts to split a tensor into the specified number of chunks. Each chunk is a view of +the input tensor. + + +.. note:: + + This function may return fewer than the specified number of chunks! + +.. seealso:: + + :func:`torch.tensor_split` a function that always returns exactly the specified number of chunks + +If the tensor size along the given dimension :attr:`dim` is divisible by :attr:`chunks`, +all returned chunks will be the same size. +If the tensor size along the given dimension :attr:`dim` is not divisible by :attr:`chunks`, +all returned chunks will be the same size, except the last one. +If such division is not possible, this function may return fewer +than the specified number of chunks. + +Arguments: + input (Tensor): the tensor to split + chunks (int): number of chunks to return + dim (int): dimension along which to split the tensor + +Example: + >>> torch.arange(11).chunk(6) + (tensor([0, 1]), + tensor([2, 3]), + tensor([4, 5]), + tensor([6, 7]), + tensor([8, 9]), + tensor([10])) + >>> torch.arange(12).chunk(6) + (tensor([0, 1]), + tensor([2, 3]), + tensor([4, 5]), + tensor([6, 7]), + tensor([8, 9]), + tensor([10, 11])) + >>> torch.arange(13).chunk(6) + (tensor([0, 1, 2]), + tensor([3, 4, 5]), + tensor([6, 7, 8]), + tensor([ 9, 10, 11]), + tensor([12])) +""", +) + +add_docstr( + torch.unsafe_chunk, + r""" +unsafe_chunk(input, chunks, dim=0) -> List of Tensors + +Works like :func:`torch.chunk` but without enforcing the autograd restrictions +on inplace modification of the outputs. + +.. warning:: + This function is safe to use as long as only the input, or only the outputs + are modified inplace after calling this function. It is user's + responsibility to ensure that is the case. If both the input and one or more + of the outputs are modified inplace, gradients computed by autograd will be + silently incorrect. +""", +) + +add_docstr( + torch.unsafe_split, + r""" +unsafe_split(tensor, split_size_or_sections, dim=0) -> List of Tensors + +Works like :func:`torch.split` but without enforcing the autograd restrictions +on inplace modification of the outputs. + +.. warning:: + This function is safe to use as long as only the input, or only the outputs + are modified inplace after calling this function. It is user's + responsibility to ensure that is the case. If both the input and one or more + of the outputs are modified inplace, gradients computed by autograd will be + silently incorrect. +""", +) + +add_docstr( + torch.hsplit, + r""" +hsplit(input, indices_or_sections) -> List of Tensors + +Splits :attr:`input`, a tensor with one or more dimensions, into multiple tensors +horizontally according to :attr:`indices_or_sections`. Each split is a view of +:attr:`input`. + +If :attr:`input` is one dimensional this is equivalent to calling +torch.tensor_split(input, indices_or_sections, dim=0) (the split dimension is +zero), and if :attr:`input` has two or more dimensions it's equivalent to calling +torch.tensor_split(input, indices_or_sections, dim=1) (the split dimension is 1), +except that if :attr:`indices_or_sections` is an integer it must evenly divide +the split dimension or a runtime error will be thrown. + +This function is based on NumPy's :func:`numpy.hsplit`. + +Args: + input (Tensor): tensor to split. + indices_or_sections (int or list or tuple of ints): See argument in :func:`torch.tensor_split`. + +Example:: + + >>> t = torch.arange(16.0).reshape(4,4) + >>> t + tensor([[ 0., 1., 2., 3.], + [ 4., 5., 6., 7.], + [ 8., 9., 10., 11.], + [12., 13., 14., 15.]]) + >>> torch.hsplit(t, 2) + (tensor([[ 0., 1.], + [ 4., 5.], + [ 8., 9.], + [12., 13.]]), + tensor([[ 2., 3.], + [ 6., 7.], + [10., 11.], + [14., 15.]])) + >>> torch.hsplit(t, [3, 6]) + (tensor([[ 0., 1., 2.], + [ 4., 5., 6.], + [ 8., 9., 10.], + [12., 13., 14.]]), + tensor([[ 3.], + [ 7.], + [11.], + [15.]]), + tensor([], size=(4, 0))) + +""", +) + +add_docstr( + torch.vsplit, + r""" +vsplit(input, indices_or_sections) -> List of Tensors + +Splits :attr:`input`, a tensor with two or more dimensions, into multiple tensors +vertically according to :attr:`indices_or_sections`. Each split is a view of +:attr:`input`. + +This is equivalent to calling torch.tensor_split(input, indices_or_sections, dim=0) +(the split dimension is 0), except that if :attr:`indices_or_sections` is an integer +it must evenly divide the split dimension or a runtime error will be thrown. + +This function is based on NumPy's :func:`numpy.vsplit`. + +Args: + input (Tensor): tensor to split. + indices_or_sections (int or list or tuple of ints): See argument in :func:`torch.tensor_split`. + +Example:: + + >>> t = torch.arange(16.0).reshape(4,4) + >>> t + tensor([[ 0., 1., 2., 3.], + [ 4., 5., 6., 7.], + [ 8., 9., 10., 11.], + [12., 13., 14., 15.]]) + >>> torch.vsplit(t, 2) + (tensor([[0., 1., 2., 3.], + [4., 5., 6., 7.]]), + tensor([[ 8., 9., 10., 11.], + [12., 13., 14., 15.]])) + >>> torch.vsplit(t, [3, 6]) + (tensor([[ 0., 1., 2., 3.], + [ 4., 5., 6., 7.], + [ 8., 9., 10., 11.]]), + tensor([[12., 13., 14., 15.]]), + tensor([], size=(0, 4))) + +""", +) + +add_docstr( + torch.dsplit, + r""" +dsplit(input, indices_or_sections) -> List of Tensors + +Splits :attr:`input`, a tensor with three or more dimensions, into multiple tensors +depthwise according to :attr:`indices_or_sections`. Each split is a view of +:attr:`input`. + +This is equivalent to calling torch.tensor_split(input, indices_or_sections, dim=2) +(the split dimension is 2), except that if :attr:`indices_or_sections` is an integer +it must evenly divide the split dimension or a runtime error will be thrown. + +This function is based on NumPy's :func:`numpy.dsplit`. + +Args: + input (Tensor): tensor to split. + indices_or_sections (int or list or tuple of ints): See argument in :func:`torch.tensor_split`. + +Example:: + + >>> t = torch.arange(16.0).reshape(2, 2, 4) + >>> t + tensor([[[ 0., 1., 2., 3.], + [ 4., 5., 6., 7.]], + [[ 8., 9., 10., 11.], + [12., 13., 14., 15.]]]) + >>> torch.dsplit(t, 2) + (tensor([[[ 0., 1.], + [ 4., 5.]], + [[ 8., 9.], + [12., 13.]]]), + tensor([[[ 2., 3.], + [ 6., 7.]], + [[10., 11.], + [14., 15.]]])) + + >>> torch.dsplit(t, [3, 6]) + (tensor([[[ 0., 1., 2.], + [ 4., 5., 6.]], + [[ 8., 9., 10.], + [12., 13., 14.]]]), + tensor([[[ 3.], + [ 7.]], + [[11.], + [15.]]]), + tensor([], size=(2, 2, 0))) + +""", +) + +add_docstr( + torch.can_cast, + r""" +can_cast(from_, to) -> bool + +Determines if a type conversion is allowed under PyTorch casting rules +described in the type promotion :ref:`documentation `. + +Args: + from\_ (dtype): The original :class:`torch.dtype`. + to (dtype): The target :class:`torch.dtype`. + +Example:: + + >>> torch.can_cast(torch.double, torch.float) + True + >>> torch.can_cast(torch.float, torch.int) + False +""", +) + +add_docstr( + torch.corrcoef, + r""" +corrcoef(input) -> Tensor + +Estimates the Pearson product-moment correlation coefficient matrix of the variables given by the :attr:`input` matrix, +where rows are the variables and columns are the observations. + +.. note:: + + The correlation coefficient matrix R is computed using the covariance matrix C as given by + :math:`R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} * C_{jj} } }` + +.. note:: + + Due to floating point rounding, the resulting array may not be Hermitian and its diagonal elements may not be 1. + The real and imaginary values are clipped to the interval [-1, 1] in an attempt to improve this situation. + +Args: + input (Tensor): A 2D matrix containing multiple variables and observations, or a + Scalar or 1D vector representing a single variable. + +Returns: + (Tensor) The correlation coefficient matrix of the variables. + +.. seealso:: + + :func:`torch.cov` covariance matrix. + +Example:: + + >>> x = torch.tensor([[0, 1, 2], [2, 1, 0]]) + >>> torch.corrcoef(x) + tensor([[ 1., -1.], + [-1., 1.]]) + >>> x = torch.randn(2, 4) + >>> x + tensor([[-0.2678, -0.0908, -0.3766, 0.2780], + [-0.5812, 0.1535, 0.2387, 0.2350]]) + >>> torch.corrcoef(x) + tensor([[1.0000, 0.3582], + [0.3582, 1.0000]]) + >>> torch.corrcoef(x[0]) + tensor(1.) +""", +) + +add_docstr( + torch.cov, + r""" +cov(input, *, correction=1, fweights=None, aweights=None) -> Tensor + +Estimates the covariance matrix of the variables given by the :attr:`input` matrix, where rows are +the variables and columns are the observations. + +A covariance matrix is a square matrix giving the covariance of each pair of variables. The diagonal contains +the variance of each variable (covariance of a variable with itself). By definition, if :attr:`input` represents +a single variable (Scalar or 1D) then its variance is returned. + +The sample covariance of the variables :math:`x` and :math:`y` is given by: + +.. math:: + \text{cov}(x,y) = \frac{\sum^{N}_{i = 1}(x_{i} - \bar{x})(y_{i} - \bar{y})}{\max(0,~N~-~\delta N)} + +where :math:`\bar{x}` and :math:`\bar{y}` are the simple means of the :math:`x` and :math:`y` respectively, and +:math:`\delta N` is the :attr:`correction`. + +If :attr:`fweights` and/or :attr:`aweights` are provided, the weighted covariance +is calculated, which is given by: + +.. math:: + \text{cov}_w(x,y) = \frac{\sum^{N}_{i = 1}w_i(x_{i} - \mu_x^*)(y_{i} - \mu_y^*)} + {\max(0,~\sum^{N}_{i = 1}w_i~-~\frac{\sum^{N}_{i = 1}w_ia_i}{\sum^{N}_{i = 1}w_i}~\delta N)} + +where :math:`w` denotes :attr:`fweights` or :attr:`aweights` (``f`` and ``a`` for brevity) based on whichever is +provided, or :math:`w = f \times a` if both are provided, and +:math:`\mu_x^* = \frac{\sum^{N}_{i = 1}w_ix_{i} }{\sum^{N}_{i = 1}w_i}` is the weighted mean of the variable. If not +provided, ``f`` and/or ``a`` can be seen as a :math:`\mathbb{1}` vector of appropriate size. + +Args: + input (Tensor): A 2D matrix containing multiple variables and observations, or a + Scalar or 1D vector representing a single variable. + +Keyword Args: + correction (int, optional): difference between the sample size and sample degrees of freedom. + Defaults to Bessel's correction, ``correction = 1`` which returns the unbiased estimate, + even if both :attr:`fweights` and :attr:`aweights` are specified. ``correction = 0`` + will return the simple average. Defaults to ``1``. + fweights (tensor, optional): A Scalar or 1D tensor of observation vector frequencies representing the number of + times each observation should be repeated. Its numel must equal the number of columns of :attr:`input`. + Must have integral dtype. Ignored if ``None``. Defaults to ``None``. + aweights (tensor, optional): A Scalar or 1D array of observation vector weights. + These relative weights are typically large for observations considered "important" and smaller for + observations considered less "important". Its numel must equal the number of columns of :attr:`input`. + Must have floating point dtype. Ignored if ``None``. Defaults to ``None``. + +Returns: + (Tensor) The covariance matrix of the variables. + +.. seealso:: + + :func:`torch.corrcoef` normalized covariance matrix. + +Example:: + + >>> x = torch.tensor([[0, 2], [1, 1], [2, 0]]).T + >>> x + tensor([[0, 1, 2], + [2, 1, 0]]) + >>> torch.cov(x) + tensor([[ 1., -1.], + [-1., 1.]]) + >>> torch.cov(x, correction=0) + tensor([[ 0.6667, -0.6667], + [-0.6667, 0.6667]]) + >>> fw = torch.randint(1, 10, (3,)) + >>> fw + tensor([1, 6, 9]) + >>> aw = torch.rand(3) + >>> aw + tensor([0.4282, 0.0255, 0.4144]) + >>> torch.cov(x, fweights=fw, aweights=aw) + tensor([[ 0.4169, -0.4169], + [-0.4169, 0.4169]]) +""", +) + +add_docstr( + torch.cat, + r""" +cat(tensors, dim=0, *, out=None) -> Tensor + +Concatenates the given sequence of tensors in :attr:`tensors` in the given dimension. +All tensors must either have the same shape (except in the concatenating +dimension) or be a 1-D empty tensor with size ``(0,)``. + +:func:`torch.cat` can be seen as an inverse operation for :func:`torch.split` +and :func:`torch.chunk`. + +:func:`torch.cat` can be best understood via examples. + +.. seealso:: + + :func:`torch.stack` concatenates the given sequence along a new dimension. + +Args: + tensors (sequence of Tensors): Non-empty tensors provided must have the same shape, + except in the cat dimension. + + dim (int, optional): the dimension over which the tensors are concatenated + +Keyword args: + {out} + +Example:: + + >>> x = torch.randn(2, 3) + >>> x + tensor([[ 0.6580, -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497]]) + >>> torch.cat((x, x, x), 0) + tensor([[ 0.6580, -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497], + [ 0.6580, -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497], + [ 0.6580, -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497]]) + >>> torch.cat((x, x, x), 1) + tensor([[ 0.6580, -1.0969, -0.4614, 0.6580, -1.0969, -0.4614, 0.6580, + -1.0969, -0.4614], + [-0.1034, -0.5790, 0.1497, -0.1034, -0.5790, 0.1497, -0.1034, + -0.5790, 0.1497]]) +""".format(**common_args), +) + +add_docstr( + torch.concat, + r""" +concat(tensors, dim=0, *, out=None) -> Tensor + +Alias of :func:`torch.cat`. +""", +) + +add_docstr( + torch.concatenate, + r""" +concatenate(tensors, axis=0, out=None) -> Tensor + +Alias of :func:`torch.cat`. +""", +) + +add_docstr( + torch.ceil, + r""" +ceil(input, *, out=None) -> Tensor + +Returns a new tensor with the ceil of the elements of :attr:`input`, +the smallest integer greater than or equal to each element. + +For integer inputs, follows the array-api convention of returning a +copy of the input tensor. + +.. math:: + \text{out}_{i} = \left\lceil \text{input}_{i} \right\rceil +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-0.6341, -1.4208, -1.0900, 0.5826]) + >>> torch.ceil(a) + tensor([-0., -1., -1., 1.]) +""".format(**common_args), +) + +add_docstr( + torch.real, + r""" +real(input) -> Tensor + +Returns a new tensor containing real values of the :attr:`self` tensor. +The returned tensor and :attr:`self` share the same underlying storage. + +Args: + {input} + +Example:: + + >>> x=torch.randn(4, dtype=torch.cfloat) + >>> x + tensor([(0.3100+0.3553j), (-0.5445-0.7896j), (-1.6492-0.0633j), (-0.0638-0.8119j)]) + >>> x.real + tensor([ 0.3100, -0.5445, -1.6492, -0.0638]) + +""".format(**common_args), +) + +add_docstr( + torch.imag, + r""" +imag(input) -> Tensor + +Returns a new tensor containing imaginary values of the :attr:`self` tensor. +The returned tensor and :attr:`self` share the same underlying storage. + +.. warning:: + :func:`imag` is only supported for tensors with complex dtypes. + +Args: + {input} + +Example:: + + >>> x=torch.randn(4, dtype=torch.cfloat) + >>> x + tensor([(0.3100+0.3553j), (-0.5445-0.7896j), (-1.6492-0.0633j), (-0.0638-0.8119j)]) + >>> x.imag + tensor([ 0.3553, -0.7896, -0.0633, -0.8119]) + +""".format(**common_args), +) + +add_docstr( + torch.view_as_real, + r""" +view_as_real(input) -> Tensor + +Returns a view of :attr:`input` as a real tensor. For an input complex tensor of +:attr:`size` :math:`m1, m2, \dots, mi`, this function returns a new +real tensor of size :math:`m1, m2, \dots, mi, 2`, where the last dimension of size 2 +represents the real and imaginary components of complex numbers. + +.. warning:: + :func:`view_as_real` is only supported for tensors with ``complex dtypes``. + +Args: + {input} + +Example:: + + >>> x=torch.randn(4, dtype=torch.cfloat) + >>> x + tensor([(0.4737-0.3839j), (-0.2098-0.6699j), (0.3470-0.9451j), (-0.5174-1.3136j)]) + >>> torch.view_as_real(x) + tensor([[ 0.4737, -0.3839], + [-0.2098, -0.6699], + [ 0.3470, -0.9451], + [-0.5174, -1.3136]]) +""".format(**common_args), +) + +add_docstr( + torch.view_as_complex, + r""" +view_as_complex(input) -> Tensor + +Returns a view of :attr:`input` as a complex tensor. For an input complex +tensor of :attr:`size` :math:`m1, m2, \dots, mi, 2`, this function returns a +new complex tensor of :attr:`size` :math:`m1, m2, \dots, mi` where the last +dimension of the input tensor is expected to represent the real and imaginary +components of complex numbers. + +.. warning:: + :func:`view_as_complex` is only supported for tensors with + :class:`torch.dtype` ``torch.float64`` and ``torch.float32``. The input is + expected to have the last dimension of :attr:`size` 2. In addition, the + tensor must have a `stride` of 1 for its last dimension. The strides of all + other dimensions must be even numbers. + +Args: + {input} + +Example:: + + >>> x=torch.randn(4, 2) + >>> x + tensor([[ 1.6116, -0.5772], + [-1.4606, -0.9120], + [ 0.0786, -1.7497], + [-0.6561, -1.6623]]) + >>> torch.view_as_complex(x) + tensor([(1.6116-0.5772j), (-1.4606-0.9120j), (0.0786-1.7497j), (-0.6561-1.6623j)]) +""".format(**common_args), +) + +add_docstr( + torch.reciprocal, + r""" +reciprocal(input, *, out=None) -> Tensor + +Returns a new tensor with the reciprocal of the elements of :attr:`input` + +.. math:: + \text{out}_{i} = \frac{1}{\text{input}_{i}} + +.. note:: + Unlike NumPy's reciprocal, torch.reciprocal supports integral inputs. Integral + inputs to reciprocal are automatically :ref:`promoted ` to + the default scalar type. +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-0.4595, -2.1219, -1.4314, 0.7298]) + >>> torch.reciprocal(a) + tensor([-2.1763, -0.4713, -0.6986, 1.3702]) +""".format(**common_args), +) + +add_docstr( + torch.cholesky, + r""" +cholesky(input, upper=False, *, out=None) -> Tensor + +Computes the Cholesky decomposition of a symmetric positive-definite +matrix :math:`A` or for batches of symmetric positive-definite matrices. + +If :attr:`upper` is ``True``, the returned matrix ``U`` is upper-triangular, and +the decomposition has the form: + +.. math:: + + A = U^TU + +If :attr:`upper` is ``False``, the returned matrix ``L`` is lower-triangular, and +the decomposition has the form: + +.. math:: + + A = LL^T + +If :attr:`upper` is ``True``, and :math:`A` is a batch of symmetric positive-definite +matrices, then the returned tensor will be composed of upper-triangular Cholesky factors +of each of the individual matrices. Similarly, when :attr:`upper` is ``False``, the returned +tensor will be composed of lower-triangular Cholesky factors of each of the individual +matrices. + +.. warning:: + + :func:`torch.cholesky` is deprecated in favor of :func:`torch.linalg.cholesky` + and will be removed in a future PyTorch release. + + ``L = torch.cholesky(A)`` should be replaced with + + .. code:: python + + L = torch.linalg.cholesky(A) + + ``U = torch.cholesky(A, upper=True)`` should be replaced with + + .. code:: python + + U = torch.linalg.cholesky(A).mH + + This transform will produce equivalent results for all valid (symmetric positive definite) inputs. + +Args: + input (Tensor): the input tensor :math:`A` of size :math:`(*, n, n)` where `*` is zero or more + batch dimensions consisting of symmetric positive-definite matrices. + upper (bool, optional): flag that indicates whether to return a + upper or lower triangular matrix. Default: ``False`` + +Keyword args: + out (Tensor, optional): the output matrix + +Example:: + + >>> a = torch.randn(3, 3) + >>> a = a @ a.mT + 1e-3 # make symmetric positive-definite + >>> l = torch.cholesky(a) + >>> a + tensor([[ 2.4112, -0.7486, 1.4551], + [-0.7486, 1.3544, 0.1294], + [ 1.4551, 0.1294, 1.6724]]) + >>> l + tensor([[ 1.5528, 0.0000, 0.0000], + [-0.4821, 1.0592, 0.0000], + [ 0.9371, 0.5487, 0.7023]]) + >>> l @ l.mT + tensor([[ 2.4112, -0.7486, 1.4551], + [-0.7486, 1.3544, 0.1294], + [ 1.4551, 0.1294, 1.6724]]) + >>> a = torch.randn(3, 2, 2) # Example for batched input + >>> a = a @ a.mT + 1e-03 # make symmetric positive-definite + >>> l = torch.cholesky(a) + >>> z = l @ l.mT + >>> torch.dist(z, a) + tensor(2.3842e-07) +""", +) + +add_docstr( + torch.cholesky_solve, + r""" +cholesky_solve(B, L, upper=False, *, out=None) -> Tensor + +Computes the solution of a system of linear equations with complex Hermitian +or real symmetric positive-definite lhs given its Cholesky decomposition. + +Let :math:`A` be a complex Hermitian or real symmetric positive-definite matrix, +and :math:`L` its Cholesky decomposition such that: + +.. math:: + + A = LL^{\text{H}} + +where :math:`L^{\text{H}}` is the conjugate transpose when :math:`L` is complex, +and the transpose when :math:`L` is real-valued. + +Returns the solution :math:`X` of the following linear system: + +.. math:: + + AX = B + +Supports inputs of float, double, cfloat and cdouble dtypes. +Also supports batches of matrices, and if :math:`A` or :math:`B` is a batch of matrices +then the output has the same batch dimensions. + +Args: + B (Tensor): right-hand side tensor of shape `(*, n, k)` + where :math:`*` is zero or more batch dimensions + L (Tensor): tensor of shape `(*, n, n)` where `*` is zero or more batch dimensions + consisting of lower or upper triangular Cholesky decompositions of + symmetric or Hermitian positive-definite matrices. + upper (bool, optional): flag that indicates whether :math:`L` is lower triangular + or upper triangular. Default: ``False``. + +Keyword args: + out (Tensor, optional): output tensor. Ignored if `None`. Default: `None`. + +Example:: + + >>> A = torch.randn(3, 3) + >>> A = A @ A.T + torch.eye(3) * 1e-3 # Creates a symmetric positive-definite matrix + >>> L = torch.linalg.cholesky(A) # Extract Cholesky decomposition + >>> B = torch.randn(3, 2) + >>> torch.cholesky_solve(B, L) + tensor([[ -8.1625, 19.6097], + [ -5.8398, 14.2387], + [ -4.3771, 10.4173]]) + >>> A.inverse() @ B + tensor([[ -8.1626, 19.6097], + [ -5.8398, 14.2387], + [ -4.3771, 10.4173]]) + + >>> A = torch.randn(3, 2, 2, dtype=torch.complex64) + >>> A = A @ A.mH + torch.eye(2) * 1e-3 # Batch of Hermitian positive-definite matrices + >>> L = torch.linalg.cholesky(A) + >>> B = torch.randn(2, 1, dtype=torch.complex64) + >>> X = torch.cholesky_solve(B, L) + >>> torch.dist(X, A.inverse() @ B) + tensor(1.6881e-5) +""", +) + +add_docstr( + torch.cholesky_inverse, + r""" +cholesky_inverse(L, upper=False, *, out=None) -> Tensor + +Computes the inverse of a complex Hermitian or real symmetric +positive-definite matrix given its Cholesky decomposition. + +Let :math:`A` be a complex Hermitian or real symmetric positive-definite matrix, +and :math:`L` its Cholesky decomposition such that: + +.. math:: + + A = LL^{\text{H}} + +where :math:`L^{\text{H}}` is the conjugate transpose when :math:`L` is complex, +and the transpose when :math:`L` is real-valued. + +Computes the inverse matrix :math:`A^{-1}`. + +Supports input of float, double, cfloat and cdouble dtypes. +Also supports batches of matrices, and if :math:`A` is a batch of matrices +then the output has the same batch dimensions. + +Args: + L (Tensor): tensor of shape `(*, n, n)` where `*` is zero or more batch dimensions + consisting of lower or upper triangular Cholesky decompositions of + symmetric or Hermitian positive-definite matrices. + upper (bool, optional): flag that indicates whether :math:`L` is lower triangular + or upper triangular. Default: ``False`` + +Keyword args: + out (Tensor, optional): output tensor. Ignored if `None`. Default: `None`. + +Example:: + + >>> A = torch.randn(3, 3) + >>> A = A @ A.T + torch.eye(3) * 1e-3 # Creates a symmetric positive-definite matrix + >>> L = torch.linalg.cholesky(A) # Extract Cholesky decomposition + >>> torch.cholesky_inverse(L) + tensor([[ 1.9314, 1.2251, -0.0889], + [ 1.2251, 2.4439, 0.2122], + [-0.0889, 0.2122, 0.1412]]) + >>> A.inverse() + tensor([[ 1.9314, 1.2251, -0.0889], + [ 1.2251, 2.4439, 0.2122], + [-0.0889, 0.2122, 0.1412]]) + + >>> A = torch.randn(3, 2, 2, dtype=torch.complex64) + >>> A = A @ A.mH + torch.eye(2) * 1e-3 # Batch of Hermitian positive-definite matrices + >>> L = torch.linalg.cholesky(A) + >>> torch.dist(torch.inverse(A), torch.cholesky_inverse(L)) + tensor(5.6358e-7) +""", +) + +add_docstr( + torch.clone, + r""" +clone(input, *, memory_format=torch.preserve_format) -> Tensor + +Returns a copy of :attr:`input`. + +.. note:: + + This function is differentiable, so gradients will flow back from the + result of this operation to :attr:`input`. To create a tensor without an + autograd relationship to :attr:`input` see :meth:`~Tensor.detach`. + + In addition, when ``torch.preserve_format`` is used: + If the input tensor is dense (i.e., non-overlapping strided), + its memory format (including strides) is retained. + Otherwise (e.g., a non-dense view like a stepped slice), + the output is converted to the dense (contiguous) format. + +Args: + {input} + +Keyword args: + {memory_format} +""".format(**common_args), +) + +add_docstr( + torch.clamp, + r""" +clamp(input, min=None, max=None, *, out=None) -> Tensor + +Clamps all elements in :attr:`input` into the range `[` :attr:`min`, :attr:`max` `]`. +Letting min_value and max_value be :attr:`min` and :attr:`max`, respectively, this returns: + +.. math:: + y_i = \min(\max(x_i, \text{min\_value}_i), \text{max\_value}_i) + +If :attr:`min` is ``None``, there is no lower bound. +Or, if :attr:`max` is ``None`` there is no upper bound. +""" + + r""" + +.. note:: + If :attr:`min` is greater than :attr:`max` :func:`torch.clamp(..., min, max) ` + sets all elements in :attr:`input` to the value of :attr:`max`. + +Args: + {input} + min (Number or Tensor, optional): lower-bound of the range to be clamped to + max (Number or Tensor, optional): upper-bound of the range to be clamped to + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-1.7120, 0.1734, -0.0478, -0.0922]) + >>> torch.clamp(a, min=-0.5, max=0.5) + tensor([-0.5000, 0.1734, -0.0478, -0.0922]) + + >>> min = torch.linspace(-1, 1, steps=4) + >>> torch.clamp(a, min=min) + tensor([-1.0000, 0.1734, 0.3333, 1.0000]) + +""".format(**common_args), +) + +add_docstr( + torch.clip, + r""" +clip(input, min=None, max=None, *, out=None) -> Tensor + +Alias for :func:`torch.clamp`. +""", +) + +add_docstr( + torch.column_stack, + r""" +column_stack(tensors, *, out=None) -> Tensor + +Creates a new tensor by horizontally stacking the tensors in :attr:`tensors`. + +Equivalent to ``torch.hstack(tensors)``, except each zero or one dimensional tensor ``t`` +in :attr:`tensors` is first reshaped into a ``(t.numel(), 1)`` column before being stacked horizontally. + +Args: + tensors (sequence of Tensors): sequence of tensors to concatenate + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor([1, 2, 3]) + >>> b = torch.tensor([4, 5, 6]) + >>> torch.column_stack((a, b)) + tensor([[1, 4], + [2, 5], + [3, 6]]) + >>> a = torch.arange(5) + >>> b = torch.arange(10).reshape(5, 2) + >>> torch.column_stack((a, b, b)) + tensor([[0, 0, 1, 0, 1], + [1, 2, 3, 2, 3], + [2, 4, 5, 4, 5], + [3, 6, 7, 6, 7], + [4, 8, 9, 8, 9]]) + +""".format(**common_args), +) + +add_docstr( + torch.complex, + r""" +complex(real, imag, *, out=None) -> Tensor + +Constructs a complex tensor with its real part equal to :attr:`real` and its +imaginary part equal to :attr:`imag`. + +Args: + real (Tensor): The real part of the complex tensor. Must be half, float or double. + imag (Tensor): The imaginary part of the complex tensor. Must be same dtype + as :attr:`real`. + +Keyword args: + out (Tensor): If the inputs are ``torch.float32``, must be + ``torch.complex64``. If the inputs are ``torch.float64``, must be + ``torch.complex128``. + +Example:: + + >>> real = torch.tensor([1, 2], dtype=torch.float32) + >>> imag = torch.tensor([3, 4], dtype=torch.float32) + >>> z = torch.complex(real, imag) + >>> z + tensor([(1.+3.j), (2.+4.j)]) + >>> z.dtype + torch.complex64 + +""", +) + +add_docstr( + torch.polar, + r""" +polar(abs, angle, *, out=None) -> Tensor + +Constructs a complex tensor whose elements are Cartesian coordinates +corresponding to the polar coordinates with absolute value :attr:`abs` and angle +:attr:`angle`. + +.. math:: + \text{out} = \text{abs} \cdot \cos(\text{angle}) + \text{abs} \cdot \sin(\text{angle}) \cdot j + +.. note:: + `torch.polar` is similar to + `std::polar `_ + and does not compute the polar decomposition + of a complex tensor like Python's `cmath.polar` and SciPy's `linalg.polar` do. + The behavior of this function is undefined if `abs` is negative or NaN, or if `angle` is + infinite. + +""" + + r""" +Args: + abs (Tensor): The absolute value the complex tensor. Must be float or double. + angle (Tensor): The angle of the complex tensor. Must be same dtype as + :attr:`abs`. + +Keyword args: + out (Tensor): If the inputs are ``torch.float32``, must be + ``torch.complex64``. If the inputs are ``torch.float64``, must be + ``torch.complex128``. + +Example:: + + >>> import numpy as np + >>> abs = torch.tensor([1, 2], dtype=torch.float64) + >>> angle = torch.tensor([np.pi / 2, 5 * np.pi / 4], dtype=torch.float64) + >>> z = torch.polar(abs, angle) + >>> z + tensor([(0.0000+1.0000j), (-1.4142-1.4142j)], dtype=torch.complex128) +""", +) + +add_docstr( + torch.conj_physical, + r""" +conj_physical(input, *, out=None) -> Tensor + +Computes the element-wise conjugate of the given :attr:`input` tensor. +If :attr:`input` has a non-complex dtype, this function just returns :attr:`input`. + +.. note:: + This performs the conjugate operation regardless of the fact conjugate bit is set or not. + +.. warning:: In the future, :func:`torch.conj_physical` may return a non-writeable view for an :attr:`input` of + non-complex dtype. It's recommended that programs not modify the tensor returned by :func:`torch.conj_physical` + when :attr:`input` is of non-complex dtype to be compatible with this change. + +.. math:: + \text{out}_{i} = conj(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> torch.conj_physical(torch.tensor([-1 + 1j, -2 + 2j, 3 - 3j])) + tensor([-1 - 1j, -2 - 2j, 3 + 3j]) +""".format(**common_args), +) + +add_docstr( + torch.conj, + r""" +conj(input) -> Tensor + +Returns a view of :attr:`input` with a flipped conjugate bit. If :attr:`input` has a non-complex dtype, +this function just returns :attr:`input`. + +.. note:: + :func:`torch.conj` performs a lazy conjugation, but the actual conjugated tensor can be materialized + at any time using :func:`torch.resolve_conj`. + +.. warning:: In the future, :func:`torch.conj` may return a non-writeable view for an :attr:`input` of + non-complex dtype. It's recommended that programs not modify the tensor returned by :func:`torch.conj_physical` + when :attr:`input` is of non-complex dtype to be compatible with this change. + +Args: + {input} + +Example:: + + >>> x = torch.tensor([-1 + 1j, -2 + 2j, 3 - 3j]) + >>> x.is_conj() + False + >>> y = torch.conj(x) + >>> y.is_conj() + True +""".format(**common_args), +) + +add_docstr( + torch.resolve_conj, + r""" +resolve_conj(input) -> Tensor + +Returns a new tensor with materialized conjugation if :attr:`input`'s conjugate bit is set to `True`, +else returns :attr:`input`. The output tensor will always have its conjugate bit set to `False`. + +Args: + {input} + +Example:: + + >>> x = torch.tensor([-1 + 1j, -2 + 2j, 3 - 3j]) + >>> y = x.conj() + >>> y.is_conj() + True + >>> z = y.resolve_conj() + >>> z + tensor([-1 - 1j, -2 - 2j, 3 + 3j]) + >>> z.is_conj() + False +""".format(**common_args), +) + +add_docstr( + torch.resolve_neg, + r""" +resolve_neg(input) -> Tensor + +Returns a new tensor with materialized negation if :attr:`input`'s negative bit is set to `True`, +else returns :attr:`input`. The output tensor will always have its negative bit set to `False`. + +Args: + {input} + +Example:: + + >>> x = torch.tensor([-1 + 1j, -2 + 2j, 3 - 3j]) + >>> y = x.conj() + >>> z = y.imag + >>> z.is_neg() + True + >>> out = z.resolve_neg() + >>> out + tensor([-1., -2., 3.]) + >>> out.is_neg() + False +""".format(**common_args), +) + +add_docstr( + torch.copysign, + r""" +copysign(input, other, *, out=None) -> Tensor + +Create a new floating-point tensor with the magnitude of :attr:`input` and the sign of :attr:`other`, elementwise. + +.. math:: + \text{out}_{i} = \begin{cases} + -|\text{input}_{i}| & \text{if } \text{other}_{i} \leq -0.0 \\ + |\text{input}_{i}| & \text{if } \text{other}_{i} \geq 0.0 \\ + \end{cases} +""" + + r""" + +Supports :ref:`broadcasting to a common shape `, +and integer and float inputs. + +Args: + input (Tensor): magnitudes. + other (Tensor or Number): contains value(s) whose signbit(s) are + applied to the magnitudes in :attr:`input`. + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(5) + >>> a + tensor([-1.2557, -0.0026, -0.5387, 0.4740, -0.9244]) + >>> torch.copysign(a, 1) + tensor([1.2557, 0.0026, 0.5387, 0.4740, 0.9244]) + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.7079, 0.2778, -1.0249, 0.5719], + [-0.0059, -0.2600, -0.4475, -1.3948], + [ 0.3667, -0.9567, -2.5757, -0.1751], + [ 0.2046, -0.0742, 0.2998, -0.1054]]) + >>> b = torch.randn(4) + tensor([ 0.2373, 0.3120, 0.3190, -1.1128]) + >>> torch.copysign(a, b) + tensor([[ 0.7079, 0.2778, 1.0249, -0.5719], + [ 0.0059, 0.2600, 0.4475, -1.3948], + [ 0.3667, 0.9567, 2.5757, -0.1751], + [ 0.2046, 0.0742, 0.2998, -0.1054]]) + >>> a = torch.tensor([1.]) + >>> b = torch.tensor([-0.]) + >>> torch.copysign(a, b) + tensor([-1.]) + +.. note:: + copysign handles signed zeros. If the other argument has a negative zero (-0), + the corresponding output value will be negative. + +""".format(**common_args), +) + +add_docstr( + torch.cos, + r""" +cos(input, *, out=None) -> Tensor + +Returns a new tensor with the cosine of the elements of :attr:`input` given in radians. + +.. math:: + \text{out}_{i} = \cos(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 1.4309, 1.2706, -0.8562, 0.9796]) + >>> torch.cos(a) + tensor([ 0.1395, 0.2957, 0.6553, 0.5574]) +""".format(**common_args), +) + +add_docstr( + torch.cosh, + r""" +cosh(input, *, out=None) -> Tensor + +Returns a new tensor with the hyperbolic cosine of the elements of +:attr:`input`. + +.. math:: + \text{out}_{i} = \cosh(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.1632, 1.1835, -0.6979, -0.7325]) + >>> torch.cosh(a) + tensor([ 1.0133, 1.7860, 1.2536, 1.2805]) + +.. note:: + When :attr:`input` is on the CPU, the implementation of torch.cosh may use + the Sleef library, which rounds very large results to infinity or negative + infinity. See `here `_ for details. +""".format(**common_args), +) + +add_docstr( + torch.cross, + r""" +cross(input, other, dim=None, *, out=None) -> Tensor + + +Returns the cross product of vectors in dimension :attr:`dim` of :attr:`input` +and :attr:`other`. + +Supports input of float, double, cfloat and cdouble dtypes. Also supports batches +of vectors, for which it computes the product along the dimension :attr:`dim`. +In this case, the output has the same batch dimensions as the inputs. + +.. warning:: + If :attr:`dim` is not given, it defaults to the first dimension found + with the size 3. Note that this might be unexpected. + + This behavior is deprecated and will be changed to match that of :func:`torch.linalg.cross` + in a future release. + +.. seealso:: + :func:`torch.linalg.cross` which has dim=-1 as default. + + +Args: + {input} + other (Tensor): the second input tensor + dim (int, optional): the dimension to take the cross-product in. + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4, 3) + >>> a + tensor([[-0.3956, 1.1455, 1.6895], + [-0.5849, 1.3672, 0.3599], + [-1.1626, 0.7180, -0.0521], + [-0.1339, 0.9902, -2.0225]]) + >>> b = torch.randn(4, 3) + >>> b + tensor([[-0.0257, -1.4725, -1.2251], + [-1.1479, -0.7005, -1.9757], + [-1.3904, 0.3726, -1.1836], + [-0.9688, -0.7153, 0.2159]]) + >>> torch.cross(a, b, dim=1) + tensor([[ 1.0844, -0.5281, 0.6120], + [-2.4490, -1.5687, 1.9792], + [-0.8304, -1.3037, 0.5650], + [-1.2329, 1.9883, 1.0551]]) + >>> torch.cross(a, b) + tensor([[ 1.0844, -0.5281, 0.6120], + [-2.4490, -1.5687, 1.9792], + [-0.8304, -1.3037, 0.5650], + [-1.2329, 1.9883, 1.0551]]) +""".format(**common_args), +) + +add_docstr( + torch.logcumsumexp, + r""" +logcumsumexp(input, dim, *, out=None) -> Tensor +Returns the logarithm of the cumulative summation of the exponentiation of +elements of :attr:`input` in the dimension :attr:`dim`. + +For summation index :math:`j` given by `dim` and other indices :math:`i`, the result is + + .. math:: + \text{{logcumsumexp}}(x)_{{ij}} = \log \sum\limits_{{k=0}}^{{j}} \exp(x_{{ik}}) + +Args: + {input} + dim (int): the dimension to do the operation over + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(10) + >>> torch.logcumsumexp(a, dim=0) + tensor([-0.42296738, -0.04462666, 0.86278635, 0.94622083, 1.05277811, + 1.39202815, 1.83525007, 1.84492621, 2.06084887, 2.06844475])) +""".format(**reduceops_common_args), +) + +add_docstr( + torch.cummax, + r""" +cummax(input, dim, *, out=None) -> (Tensor, LongTensor) +Returns a namedtuple ``(values, indices)`` where ``values`` is the cumulative maximum of +elements of :attr:`input` in the dimension :attr:`dim`. And ``indices`` is the index +location of each maximum value found in the dimension :attr:`dim`. + +.. math:: + y_i = max(x_1, x_2, x_3, \dots, x_i) + +Args: + {input} + dim (int): the dimension to do the operation over + +Keyword args: + out (tuple, optional): the result tuple of two output tensors (values, indices) + +Example:: + + >>> a = torch.randn(10) + >>> a + tensor([-0.3449, -1.5447, 0.0685, -1.5104, -1.1706, 0.2259, 1.4696, -1.3284, + 1.9946, -0.8209]) + >>> torch.cummax(a, dim=0) + torch.return_types.cummax( + values=tensor([-0.3449, -0.3449, 0.0685, 0.0685, 0.0685, 0.2259, 1.4696, 1.4696, + 1.9946, 1.9946]), + indices=tensor([0, 0, 2, 2, 2, 5, 6, 6, 8, 8])) +""".format(**reduceops_common_args), +) + +add_docstr( + torch.cummin, + r""" +cummin(input, dim, *, out=None) -> (Tensor, LongTensor) +Returns a namedtuple ``(values, indices)`` where ``values`` is the cumulative minimum of +elements of :attr:`input` in the dimension :attr:`dim`. And ``indices`` is the index +location of each maximum value found in the dimension :attr:`dim`. + +.. math:: + y_i = min(x_1, x_2, x_3, \dots, x_i) + +Args: + {input} + dim (int): the dimension to do the operation over + +Keyword args: + out (tuple, optional): the result tuple of two output tensors (values, indices) + +Example:: + + >>> a = torch.randn(10) + >>> a + tensor([-0.2284, -0.6628, 0.0975, 0.2680, -1.3298, -0.4220, -0.3885, 1.1762, + 0.9165, 1.6684]) + >>> torch.cummin(a, dim=0) + torch.return_types.cummin( + values=tensor([-0.2284, -0.6628, -0.6628, -0.6628, -1.3298, -1.3298, -1.3298, -1.3298, + -1.3298, -1.3298]), + indices=tensor([0, 1, 1, 1, 4, 4, 4, 4, 4, 4])) +""".format(**reduceops_common_args), +) + +add_docstr( + torch.cumprod, + r""" +cumprod(input, dim, *, dtype=None, out=None) -> Tensor + +Returns the cumulative product of elements of :attr:`input` in the dimension +:attr:`dim`. + +For example, if :attr:`input` is a vector of size N, the result will also be +a vector of size N, with elements. + +.. math:: + y_i = x_1 \times x_2\times x_3\times \dots \times x_i + +Args: + {input} + dim (int): the dimension to do the operation over + +Keyword args: + {dtype} + {out} + +Example:: + + >>> a = torch.randn(10) + >>> a + tensor([ 0.6001, 0.2069, -0.1919, 0.9792, 0.6727, 1.0062, 0.4126, + -0.2129, -0.4206, 0.1968]) + >>> torch.cumprod(a, dim=0) + tensor([ 0.6001, 0.1241, -0.0238, -0.0233, -0.0157, -0.0158, -0.0065, + 0.0014, -0.0006, -0.0001]) + + >>> a[5] = 0.0 + >>> torch.cumprod(a, dim=0) + tensor([ 0.6001, 0.1241, -0.0238, -0.0233, -0.0157, -0.0000, -0.0000, + 0.0000, -0.0000, -0.0000]) +""".format(**reduceops_common_args), +) + +add_docstr( + torch.cumsum, + r""" +cumsum(input, dim, *, dtype=None, out=None) -> Tensor + +Returns the cumulative sum of elements of :attr:`input` in the dimension +:attr:`dim`. + +For example, if :attr:`input` is a vector of size N, the result will also be +a vector of size N, with elements. + +.. math:: + y_i = x_1 + x_2 + x_3 + \dots + x_i + +Args: + {input} + dim (int): the dimension to do the operation over + +Keyword args: + {dtype} + {out} + +Example:: + + >>> a = torch.randint(1, 20, (10,)) + >>> a + tensor([13, 7, 3, 10, 13, 3, 15, 10, 9, 10]) + >>> torch.cumsum(a, dim=0) + tensor([13, 20, 23, 33, 46, 49, 64, 74, 83, 93]) +""".format(**reduceops_common_args), +) + +add_docstr( + torch.count_nonzero, + r""" +count_nonzero(input, dim=None) -> Tensor + +Counts the number of non-zero values in the tensor :attr:`input` along the given :attr:`dim`. +If no dim is specified then all non-zeros in the tensor are counted. + +Args: + {input} + dim (int or tuple of ints, optional): Dim or tuple of dims along which to count non-zeros. + +Example:: + + >>> x = torch.zeros(3,3) + >>> x[torch.randn(3,3) > 0.5] = 1 + >>> x + tensor([[0., 1., 1.], + [0., 0., 0.], + [0., 0., 1.]]) + >>> torch.count_nonzero(x) + tensor(3) + >>> torch.count_nonzero(x, dim=0) + tensor([0, 1, 2]) +""".format(**reduceops_common_args), +) + +add_docstr( + torch.dequantize, + r""" +dequantize(tensor) -> Tensor + +Returns an fp32 Tensor by dequantizing a quantized Tensor + +Args: + tensor (Tensor): A quantized Tensor + +.. function:: dequantize(tensors) -> sequence of Tensors + :noindex: + +Given a list of quantized Tensors, dequantize them and return a list of fp32 Tensors + +Args: + tensors (sequence of Tensors): A list of quantized Tensors +""", +) + +add_docstr( + torch.diag, + r""" +diag(input, diagonal=0, *, out=None) -> Tensor + +- If :attr:`input` is a vector (1-D tensor), then returns a 2-D square tensor + with the elements of :attr:`input` as the diagonal. +- If :attr:`input` is a matrix (2-D tensor), then returns a 1-D tensor with + the diagonal elements of :attr:`input`. + +The argument :attr:`diagonal` controls which diagonal to consider: + +- If :attr:`diagonal` = 0, it is the main diagonal. +- If :attr:`diagonal` > 0, it is above the main diagonal. +- If :attr:`diagonal` < 0, it is below the main diagonal. + +Args: + {input} + diagonal (int, optional): the diagonal to consider + +Keyword args: + {out} + +.. seealso:: + + :func:`torch.diagonal` always returns the diagonal of its input. + + :func:`torch.diagflat` always constructs a tensor with diagonal elements + specified by the input. + +Examples: + +Get the square matrix where the input vector is the diagonal:: + + >>> a = torch.randn(3) + >>> a + tensor([ 0.5950,-0.0872, 2.3298]) + >>> torch.diag(a) + tensor([[ 0.5950, 0.0000, 0.0000], + [ 0.0000,-0.0872, 0.0000], + [ 0.0000, 0.0000, 2.3298]]) + >>> torch.diag(a, 1) + tensor([[ 0.0000, 0.5950, 0.0000, 0.0000], + [ 0.0000, 0.0000,-0.0872, 0.0000], + [ 0.0000, 0.0000, 0.0000, 2.3298], + [ 0.0000, 0.0000, 0.0000, 0.0000]]) + +Get the k-th diagonal of a given matrix:: + + >>> a = torch.randn(3, 3) + >>> a + tensor([[-0.4264, 0.0255,-0.1064], + [ 0.8795,-0.2429, 0.1374], + [ 0.1029,-0.6482,-1.6300]]) + >>> torch.diag(a, 0) + tensor([-0.4264,-0.2429,-1.6300]) + >>> torch.diag(a, 1) + tensor([ 0.0255, 0.1374]) +""".format(**common_args), +) + +add_docstr( + torch.diag_embed, + r""" +diag_embed(input, offset=0, dim1=-2, dim2=-1) -> Tensor + +Creates a tensor whose diagonals of certain 2D planes (specified by +:attr:`dim1` and :attr:`dim2`) are filled by :attr:`input`. +To facilitate creating batched diagonal matrices, the 2D planes formed by +the last two dimensions of the returned tensor are chosen by default. + +The argument :attr:`offset` controls which diagonal to consider: + +- If :attr:`offset` = 0, it is the main diagonal. +- If :attr:`offset` > 0, it is above the main diagonal. +- If :attr:`offset` < 0, it is below the main diagonal. + +The size of the new matrix will be calculated to make the specified diagonal +of the size of the last input dimension. +Note that for :attr:`offset` other than :math:`0`, the order of :attr:`dim1` +and :attr:`dim2` matters. Exchanging them is equivalent to changing the +sign of :attr:`offset`. + +Applying :meth:`torch.diagonal` to the output of this function with +the same arguments yields a matrix identical to input. However, +:meth:`torch.diagonal` has different default dimensions, so those +need to be explicitly specified. + +Args: + {input} Must be at least 1-dimensional. + offset (int, optional): which diagonal to consider. Default: 0 + (main diagonal). + dim1 (int, optional): first dimension with respect to which to + take diagonal. Default: -2. + dim2 (int, optional): second dimension with respect to which to + take diagonal. Default: -1. + +Example:: + + >>> a = torch.randn(2, 3) + >>> torch.diag_embed(a) + tensor([[[ 1.5410, 0.0000, 0.0000], + [ 0.0000, -0.2934, 0.0000], + [ 0.0000, 0.0000, -2.1788]], + + [[ 0.5684, 0.0000, 0.0000], + [ 0.0000, -1.0845, 0.0000], + [ 0.0000, 0.0000, -1.3986]]]) + + >>> torch.diag_embed(a, offset=1, dim1=0, dim2=2) + tensor([[[ 0.0000, 1.5410, 0.0000, 0.0000], + [ 0.0000, 0.5684, 0.0000, 0.0000]], + + [[ 0.0000, 0.0000, -0.2934, 0.0000], + [ 0.0000, 0.0000, -1.0845, 0.0000]], + + [[ 0.0000, 0.0000, 0.0000, -2.1788], + [ 0.0000, 0.0000, 0.0000, -1.3986]], + + [[ 0.0000, 0.0000, 0.0000, 0.0000], + [ 0.0000, 0.0000, 0.0000, 0.0000]]]) +""".format(**common_args), +) + + +add_docstr( + torch.diagflat, + r""" +diagflat(input, offset=0) -> Tensor + +- If :attr:`input` is a vector (1-D tensor), then returns a 2-D square tensor + with the elements of :attr:`input` as the diagonal. +- If :attr:`input` is a tensor with more than one dimension, then returns a + 2-D tensor with diagonal elements equal to a flattened :attr:`input`. + +The argument :attr:`offset` controls which diagonal to consider: + +- If :attr:`offset` = 0, it is the main diagonal. +- If :attr:`offset` > 0, it is above the main diagonal. +- If :attr:`offset` < 0, it is below the main diagonal. + +Args: + {input} + offset (int, optional): the diagonal to consider. Default: 0 (main + diagonal). + +Examples:: + + >>> a = torch.randn(3) + >>> a + tensor([-0.2956, -0.9068, 0.1695]) + >>> torch.diagflat(a) + tensor([[-0.2956, 0.0000, 0.0000], + [ 0.0000, -0.9068, 0.0000], + [ 0.0000, 0.0000, 0.1695]]) + >>> torch.diagflat(a, 1) + tensor([[ 0.0000, -0.2956, 0.0000, 0.0000], + [ 0.0000, 0.0000, -0.9068, 0.0000], + [ 0.0000, 0.0000, 0.0000, 0.1695], + [ 0.0000, 0.0000, 0.0000, 0.0000]]) + + >>> a = torch.randn(2, 2) + >>> a + tensor([[ 0.2094, -0.3018], + [-0.1516, 1.9342]]) + >>> torch.diagflat(a) + tensor([[ 0.2094, 0.0000, 0.0000, 0.0000], + [ 0.0000, -0.3018, 0.0000, 0.0000], + [ 0.0000, 0.0000, -0.1516, 0.0000], + [ 0.0000, 0.0000, 0.0000, 1.9342]]) +""".format(**common_args), +) + +add_docstr( + torch.diagonal, + r""" +diagonal(input, offset=0, dim1=0, dim2=1) -> Tensor + +Returns a partial view of :attr:`input` with the its diagonal elements +with respect to :attr:`dim1` and :attr:`dim2` appended as a dimension +at the end of the shape. + +The argument :attr:`offset` controls which diagonal to consider: + +- If :attr:`offset` = 0, it is the main diagonal. +- If :attr:`offset` > 0, it is above the main diagonal. +- If :attr:`offset` < 0, it is below the main diagonal. + +Applying :meth:`torch.diag_embed` to the output of this function with +the same arguments yields a diagonal matrix with the diagonal entries +of the input. However, :meth:`torch.diag_embed` has different default +dimensions, so those need to be explicitly specified. + +Args: + {input} Must be at least 2-dimensional. + offset (int, optional): which diagonal to consider. Default: 0 + (main diagonal). + dim1 (int, optional): first dimension with respect to which to + take diagonal. Default: 0. + dim2 (int, optional): second dimension with respect to which to + take diagonal. Default: 1. + +.. note:: To take a batch diagonal, pass in dim1=-2, dim2=-1. + +Examples:: + + >>> a = torch.randn(3, 3) + >>> a + tensor([[-1.0854, 1.1431, -0.1752], + [ 0.8536, -0.0905, 0.0360], + [ 0.6927, -0.3735, -0.4945]]) + + + >>> torch.diagonal(a) + tensor([-1.0854, -0.0905, -0.4945]) + + + >>> torch.diagonal(a, 1) + tensor([ 1.1431, 0.0360]) + + >>> b = torch.randn(2, 5) + >>> b + tensor([[-1.7948, -1.2731, -0.3181, 2.0200, -1.6745], + [ 1.8262, -1.5049, 0.4114, 1.0704, -1.2607]]) + + >>> torch.diagonal(b, 1, 1, 0) + tensor([1.8262]) + + >>> x = torch.randn(2, 5, 4, 2) + >>> torch.diagonal(x, offset=-1, dim1=1, dim2=2) + tensor([[[-1.2631, 0.3755, -1.5977, -1.8172], + [-1.1065, 1.0401, -0.2235, -0.7938]], + + [[-1.7325, -0.3081, 0.6166, 0.2335], + [ 1.0500, 0.7336, -0.3836, -1.1015]]]) +""".format(**common_args), +) + +add_docstr( + torch.diagonal_scatter, + r""" +diagonal_scatter(input, src, offset=0, dim1=0, dim2=1) -> Tensor + +Embeds the values of the :attr:`src` tensor into :attr:`input` along +the diagonal elements of :attr:`input`, with respect to :attr:`dim1` +and :attr:`dim2`. + +This function returns a tensor with fresh storage; it does not +return a view. + +The argument :attr:`offset` controls which diagonal to consider: + +- If :attr:`offset` = 0, it is the main diagonal. +- If :attr:`offset` > 0, it is above the main diagonal. +- If :attr:`offset` < 0, it is below the main diagonal. + +Args: + {input} Must be at least 2-dimensional. + src (Tensor): the tensor to embed into :attr:`input`. + offset (int, optional): which diagonal to consider. Default: 0 + (main diagonal). + dim1 (int, optional): first dimension with respect to which to + take diagonal. Default: 0. + dim2 (int, optional): second dimension with respect to which to + take diagonal. Default: 1. + +.. note:: + + :attr:`src` must be of the proper size in order to be embedded + into :attr:`input`. Specifically, it should have the same shape as + ``torch.diagonal(input, offset, dim1, dim2)`` + +Examples:: + + >>> a = torch.zeros(3, 3) + >>> a + tensor([[0., 0., 0.], + [0., 0., 0.], + [0., 0., 0.]]) + + >>> torch.diagonal_scatter(a, torch.ones(3), 0) + tensor([[1., 0., 0.], + [0., 1., 0.], + [0., 0., 1.]]) + + >>> torch.diagonal_scatter(a, torch.ones(2), 1) + tensor([[0., 1., 0.], + [0., 0., 1.], + [0., 0., 0.]]) +""".format(**common_args), +) + +add_docstr( + torch.as_strided_scatter, + r""" +as_strided_scatter(input, src, size, stride, storage_offset=None) -> Tensor + +Embeds the values of the :attr:`src` tensor into :attr:`input` along +the elements corresponding to the result of calling +input.as_strided(size, stride, storage_offset). + +This function returns a tensor with fresh storage; it does not +return a view. + +Args: + {input} + size (tuple or ints): the shape of the output tensor + stride (tuple or ints): the stride of the output tensor + storage_offset (int, optional): the offset in the underlying storage of the output tensor + +.. note:: + + :attr:`src` must be of the proper size in order to be embedded + into :attr:`input`. Specifically, it should have the same shape as + `torch.as_strided(input, size, stride, storage_offset)` + +Example:: + + >>> a = torch.arange(4).reshape(2, 2) + 1 + >>> a + tensor([[1, 2], + [3, 4]]) + >>> b = torch.zeros(3, 3) + >>> b + tensor([[0., 0., 0.], + [0., 0., 0.], + [0., 0., 0.]]) + >>> torch.as_strided_scatter(b, a, (2, 2), (1, 2)) + tensor([[1., 3., 2.], + [4., 0., 0.], + [0., 0., 0.]]) + +""".format(**common_args), +) + +add_docstr( + torch.diff, + r""" +diff(input, n=1, dim=-1, prepend=None, append=None) -> Tensor + +Computes the n-th forward difference along the given dimension. + +The first-order differences are given by `out[i] = input[i + 1] - input[i]`. Higher-order +differences are calculated by using :func:`torch.diff` recursively. + +Args: + input (Tensor): the tensor to compute the differences on + n (int, optional): the number of times to recursively compute the difference + dim (int, optional): the dimension to compute the difference along. + Default is the last dimension. + prepend, append (Tensor, optional): values to prepend or append to + :attr:`input` along :attr:`dim` before computing the difference. + Their dimensions must be equivalent to that of input, and their shapes + must match input's shape except on :attr:`dim`. + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor([1, 3, 2]) + >>> torch.diff(a) + tensor([ 2, -1]) + >>> b = torch.tensor([4, 5]) + >>> torch.diff(a, append=b) + tensor([ 2, -1, 2, 1]) + >>> c = torch.tensor([[1, 2, 3], [3, 4, 5]]) + >>> torch.diff(c, dim=0) + tensor([[2, 2, 2]]) + >>> torch.diff(c, dim=1) + tensor([[1, 1], + [1, 1]]) +""".format(**common_args), +) + +add_docstr( + torch.digamma, + r""" +digamma(input, *, out=None) -> Tensor + +Alias for :func:`torch.special.digamma`. +""", +) + +add_docstr( + torch.dist, + r""" +dist(input, other, p=2) -> Tensor + +Returns the p-norm of (:attr:`input` - :attr:`other`) + +The shapes of :attr:`input` and :attr:`other` must be +:ref:`broadcastable `. + +Args: + {input} + other (Tensor): the Right-hand-side input tensor + p (float, optional): the norm to be computed + +Example:: + + >>> x = torch.randn(4) + >>> x + tensor([-1.5393, -0.8675, 0.5916, 1.6321]) + >>> y = torch.randn(4) + >>> y + tensor([ 0.0967, -1.0511, 0.6295, 0.8360]) + >>> torch.dist(x, y, 3.5) + tensor(1.6727) + >>> torch.dist(x, y, 3) + tensor(1.6973) + >>> torch.dist(x, y, 0) + tensor(4.) + >>> torch.dist(x, y, 1) + tensor(2.6537) +""".format(**common_args), +) + +add_docstr( + torch.div, + r""" +div(input, other, *, rounding_mode=None, out=None) -> Tensor + +Divides each element of the input ``input`` by the corresponding element of +:attr:`other`. + +.. math:: + \text{{out}}_i = \frac{{\text{{input}}_i}}{{\text{{other}}_i}} + +.. note:: + By default, this performs a "true" division like Python 3. + See the :attr:`rounding_mode` argument for floor division. + +Supports :ref:`broadcasting to a common shape `, +:ref:`type promotion `, and integer, float, and complex inputs. +Always promotes integer types to the default scalar type. + +Args: + input (Tensor): the dividend + other (Tensor or Number): the divisor + +Keyword args: + rounding_mode (str, optional): Type of rounding applied to the result: + + * None - default behavior. Performs no rounding and, if both :attr:`input` and + :attr:`other` are integer types, promotes the inputs to the default scalar type. + Equivalent to true division in Python (the ``/`` operator) and NumPy's ``np.true_divide``. + * ``"trunc"`` - rounds the results of the division towards zero. + Equivalent to C-style integer division. + * ``"floor"`` - rounds the results of the division down. + Equivalent to floor division in Python (the ``//`` operator) and NumPy's ``np.floor_divide``. + + {out} + +Examples:: + + >>> x = torch.tensor([ 0.3810, 1.2774, -0.2972, -0.3719, 0.4637]) + >>> torch.div(x, 0.5) + tensor([ 0.7620, 2.5548, -0.5944, -0.7438, 0.9274]) + + >>> a = torch.tensor([[-0.3711, -1.9353, -0.4605, -0.2917], + ... [ 0.1815, -1.0111, 0.9805, -1.5923], + ... [ 0.1062, 1.4581, 0.7759, -1.2344], + ... [-0.1830, -0.0313, 1.1908, -1.4757]]) + >>> b = torch.tensor([ 0.8032, 0.2930, -0.8113, -0.2308]) + >>> torch.div(a, b) + tensor([[-0.4620, -6.6051, 0.5676, 1.2639], + [ 0.2260, -3.4509, -1.2086, 6.8990], + [ 0.1322, 4.9764, -0.9564, 5.3484], + [-0.2278, -0.1068, -1.4678, 6.3938]]) + + >>> torch.div(a, b, rounding_mode='trunc') + tensor([[-0., -6., 0., 1.], + [ 0., -3., -1., 6.], + [ 0., 4., -0., 5.], + [-0., -0., -1., 6.]]) + + >>> torch.div(a, b, rounding_mode='floor') + tensor([[-1., -7., 0., 1.], + [ 0., -4., -2., 6.], + [ 0., 4., -1., 5.], + [-1., -1., -2., 6.]]) + +""".format(**common_args), +) + +add_docstr( + torch.divide, + r""" +divide(input, other, *, rounding_mode=None, out=None) -> Tensor + +Alias for :func:`torch.div`. +""", +) + +add_docstr( + torch.dot, + r""" +dot(input, tensor, *, out=None) -> Tensor + +Computes the dot product of two 1D tensors. + +.. note:: + + Unlike NumPy's dot, torch.dot intentionally only supports computing the dot product + of two 1D tensors with the same number of elements. + +Args: + input (Tensor): first tensor in the dot product, must be 1D. + tensor (Tensor): second tensor in the dot product, must be 1D. + +Keyword args: + {out} + +Example:: + + >>> torch.dot(torch.tensor([2, 3]), torch.tensor([2, 1])) + tensor(7) + + >>> t1, t2 = torch.tensor([0, 1]), torch.tensor([2, 3]) + >>> torch.dot(t1, t2) + tensor(3) +""".format(**common_args), +) + +add_docstr( + torch.vdot, + r""" +vdot(input, other, *, out=None) -> Tensor + +Computes the dot product of two 1D vectors along a dimension. + +In symbols, this function computes + +.. math:: + + \sum_{i=1}^n \overline{x_i}y_i. + +where :math:`\overline{x_i}` denotes the conjugate for complex +vectors, and it is the identity for real vectors. + +.. note:: + + Unlike NumPy's vdot, torch.vdot intentionally only supports computing the dot product + of two 1D tensors with the same number of elements. + +.. seealso:: + + :func:`torch.linalg.vecdot` computes the dot product of two batches of vectors along a dimension. + +Args: + input (Tensor): first tensor in the dot product, must be 1D. Its conjugate is used if it's complex. + other (Tensor): second tensor in the dot product, must be 1D. + +Keyword args: +""" + + rf""" +.. note:: {common_args["out"]} +""" + + r""" + +Example:: + + >>> torch.vdot(torch.tensor([2, 3]), torch.tensor([2, 1])) + tensor(7) + >>> a = torch.tensor((1 +2j, 3 - 1j)) + >>> b = torch.tensor((2 +1j, 4 - 0j)) + >>> torch.vdot(a, b) + tensor([16.+1.j]) + >>> torch.vdot(b, a) + tensor([16.-1.j]) +""", +) + +add_docstr( + torch.eq, + r""" +eq(input, other, *, out=None) -> Tensor + +Computes element-wise equality + +The second argument can be a number or a tensor whose shape is +:ref:`broadcastable ` with the first argument. + +Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + +Keyword args: + {out} + +Returns: + A boolean tensor that is True where :attr:`input` is equal to :attr:`other` and False elsewhere + +Example:: + + >>> torch.eq(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[ True, False], + [False, True]]) +""".format(**common_args), +) + +add_docstr( + torch.equal, + r""" +equal(input, other) -> bool + +``True`` if two tensors have the same size and elements, ``False`` otherwise. + +.. note:: + + Tensors containing NaNs are never equal to each other. Additionally, this function does not + differentiate between the data types of the tensors during comparison. For more thorough tensor checks, + use :meth:`torch.testing.assert_close`. + +Example:: + + >>> torch.equal(torch.tensor([1, 2]), torch.tensor([1, 2])) + True + >>> torch.equal(torch.tensor([3, torch.nan]), torch.tensor([3, torch.nan])) + False + >>> torch.equal(torch.tensor([1, 2, 3], dtype=torch.int32), torch.tensor([1, 2, 3], dtype=torch.float32)) + True +""", +) + +add_docstr( + torch.erf, + r""" +erf(input, *, out=None) -> Tensor + +Alias for :func:`torch.special.erf`. +""", +) + +add_docstr( + torch.erfc, + r""" +erfc(input, *, out=None) -> Tensor + +Alias for :func:`torch.special.erfc`. +""", +) + +add_docstr( + torch.erfinv, + r""" +erfinv(input, *, out=None) -> Tensor + +Alias for :func:`torch.special.erfinv`. +""", +) + +add_docstr( + torch.exp, + r""" +exp(input, *, out=None) -> Tensor + +Returns a new tensor with the exponential of the elements +of the input tensor :attr:`input`. + +.. math:: + y_{i} = e^{x_{i}} +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> torch.exp(torch.tensor([0, math.log(2.)])) + tensor([ 1., 2.]) +""".format(**common_args), +) + +add_docstr( + torch.exp2, + r""" +exp2(input, *, out=None) -> Tensor + +Alias for :func:`torch.special.exp2`. +""", +) + +add_docstr( + torch.expm1, + r""" +expm1(input, *, out=None) -> Tensor + +Alias for :func:`torch.special.expm1`. +""", +) + +add_docstr( + torch.eye, + r""" +eye(n, m=None, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + +Returns a 2-D tensor with ones on the diagonal and zeros elsewhere. + +Args: + n (int): the number of rows + m (int, optional): the number of columns with default being :attr:`n` + +Keyword arguments: + {out} + {dtype} + {layout} + {device} + {requires_grad} + +Returns: + Tensor: A 2-D tensor with ones on the diagonal and zeros elsewhere + +Example:: + + >>> torch.eye(3) + tensor([[ 1., 0., 0.], + [ 0., 1., 0.], + [ 0., 0., 1.]]) +""".format(**factory_common_args), +) + +add_docstr( + torch.floor, + r""" +floor(input, *, out=None) -> Tensor + +Returns a new tensor with the floor of the elements of :attr:`input`, +the largest integer less than or equal to each element. + +For integer inputs, follows the array-api convention of returning a +copy of the input tensor. + +.. math:: + \text{out}_{i} = \left\lfloor \text{input}_{i} \right\rfloor +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-0.8166, 1.5308, -0.2530, -0.2091]) + >>> torch.floor(a) + tensor([-1., 1., -1., -1.]) +""".format(**common_args), +) + +add_docstr( + torch.floor_divide, + r""" +floor_divide(input, other, *, out=None) -> Tensor + +.. note:: + + Before PyTorch 1.13 :func:`torch.floor_divide` incorrectly performed + truncation division. To restore the previous behavior use + :func:`torch.div` with ``rounding_mode='trunc'``. + +Computes :attr:`input` divided by :attr:`other`, elementwise, and floors +the result. + +.. math:: + \text{{out}}_i = \text{floor} \left( \frac{{\text{{input}}_i}}{{\text{{other}}_i}} \right) + +""" + + r""" + +Supports broadcasting to a common shape, type promotion, and integer and float inputs. + +Args: + input (Tensor or Number): the dividend + other (Tensor or Number): the divisor + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor([4.0, 3.0]) + >>> b = torch.tensor([2.0, 2.0]) + >>> torch.floor_divide(a, b) + tensor([2.0, 1.0]) + >>> torch.floor_divide(a, 1.4) + tensor([2.0, 2.0]) +""".format(**common_args), +) + +add_docstr( + torch.fmod, + r""" +fmod(input, other, *, out=None) -> Tensor + +Applies C++'s `std::fmod `_ entrywise. +The result has the same sign as the dividend :attr:`input` and its absolute value +is less than that of :attr:`other`. + +This function may be defined in terms of :func:`torch.div` as + +.. code:: python + + torch.fmod(a, b) == a - a.div(b, rounding_mode="trunc") * b + +Supports :ref:`broadcasting to a common shape `, +:ref:`type promotion `, and integer and float inputs. + +.. note:: + + When the divisor is zero, returns ``NaN`` for floating point dtypes + on both CPU and GPU; raises ``RuntimeError`` for integer division by + zero on CPU; Integer division by zero on GPU may return any value. + +.. note:: + + Complex inputs are not supported. In some cases, it is not mathematically + possible to satisfy the definition of a modulo operation with complex numbers. + +.. seealso:: + + :func:`torch.remainder` which implements Python's modulus operator. + This one is defined using division rounding down the result. + +Args: + input (Tensor): the dividend + other (Tensor or Scalar): the divisor + +Keyword args: + {out} + +Example:: + + >>> torch.fmod(torch.tensor([-3., -2, -1, 1, 2, 3]), 2) + tensor([-1., -0., -1., 1., 0., 1.]) + >>> torch.fmod(torch.tensor([1, 2, 3, 4, 5]), -1.5) + tensor([1.0000, 0.5000, 0.0000, 1.0000, 0.5000]) + +""".format(**common_args), +) + +add_docstr( + torch.frac, + r""" +frac(input, *, out=None) -> Tensor + +Computes the fractional portion of each element in :attr:`input`. + +.. math:: + \text{out}_{i} = \text{input}_{i} - \left\lfloor |\text{input}_{i}| \right\rfloor * \operatorname{sgn}(\text{input}_{i}) + +Example:: + + >>> torch.frac(torch.tensor([1, 2.5, -3.2])) + tensor([ 0.0000, 0.5000, -0.2000]) +""", +) + +add_docstr( + torch.frexp, + r""" +frexp(input, *, out=None) -> (Tensor mantissa, Tensor exponent) + +Decomposes :attr:`input` into mantissa and exponent tensors +such that :math:`\text{input} = \text{mantissa} \times 2^{\text{exponent}}`. + +The range of mantissa is the open interval (-1, 1). + +Supports float inputs. + +Args: + input (Tensor): the input tensor + + +Keyword args: + out (tuple, optional): the output tensors + +Example:: + + >>> x = torch.arange(9.) + >>> mantissa, exponent = torch.frexp(x) + >>> mantissa + tensor([0.0000, 0.5000, 0.5000, 0.7500, 0.5000, 0.6250, 0.7500, 0.8750, 0.5000]) + >>> exponent + tensor([0, 1, 2, 2, 3, 3, 3, 3, 4], dtype=torch.int32) + >>> torch.ldexp(mantissa, exponent) + tensor([0., 1., 2., 3., 4., 5., 6., 7., 8.]) +""", +) + +add_docstr( + torch.from_numpy, + r""" +from_numpy(ndarray) -> Tensor + +Creates a :class:`Tensor` from a :class:`numpy.ndarray`. + +The returned tensor and :attr:`ndarray` share the same memory. Modifications to +the tensor will be reflected in the :attr:`ndarray` and vice versa. The returned +tensor is not resizable. + +It currently accepts :attr:`ndarray` with dtypes of ``numpy.float64``, +``numpy.float32``, ``numpy.float16``, ``numpy.complex64``, ``numpy.complex128``, +``numpy.int64``, ``numpy.int32``, ``numpy.int16``, ``numpy.int8``, ``numpy.uint8``, +and ``bool``. + +.. warning:: + Writing to a tensor created from a read-only NumPy array is not supported and will result in undefined behavior. + +Example:: + + >>> a = numpy.array([1, 2, 3]) + >>> t = torch.from_numpy(a) + >>> t + tensor([ 1, 2, 3]) + >>> t[0] = -1 + >>> a + array([-1, 2, 3]) +""", +) + +add_docstr( + torch.frombuffer, + r""" +frombuffer(buffer, *, dtype, count=-1, offset=0, requires_grad=False) -> Tensor + +Creates a 1-dimensional :class:`Tensor` from an object that implements +the Python buffer protocol. + +Skips the first :attr:`offset` bytes in the buffer, and interprets the rest of +the raw bytes as a 1-dimensional tensor of type :attr:`dtype` with :attr:`count` +elements. + +Note that either of the following must be true: + +1. :attr:`count` is a positive non-zero number, and the total number of bytes +in the buffer is more than :attr:`offset` plus :attr:`count` times the size +(in bytes) of :attr:`dtype`. + +2. :attr:`count` is negative, and the length (number of bytes) of the buffer +subtracted by the :attr:`offset` is a multiple of the size (in bytes) of +:attr:`dtype`. + +The returned tensor and buffer share the same memory. Modifications to +the tensor will be reflected in the buffer and vice versa. The returned +tensor is not resizable. + +.. note:: + This function increments the reference count for the object that + owns the shared memory. Therefore, such memory will not be deallocated + before the returned tensor goes out of scope. + +.. warning:: + This function's behavior is undefined when passed an object implementing + the buffer protocol whose data is not on the CPU. Doing so is likely to + cause a segmentation fault. + +.. warning:: + This function does not try to infer the :attr:`dtype` (hence, it is not + optional). Passing a different :attr:`dtype` than its source may result + in unexpected behavior. + +Args: + buffer (object): a Python object that exposes the buffer interface. + +Keyword args: + dtype (:class:`torch.dtype`): the desired data type of returned tensor. + count (int, optional): the number of desired elements to be read. + If negative, all the elements (until the end of the buffer) will be + read. Default: -1. + offset (int, optional): the number of bytes to skip at the start of + the buffer. Default: 0. + {requires_grad} + +Example:: + + >>> import array + >>> a = array.array('i', [1, 2, 3]) + >>> t = torch.frombuffer(a, dtype=torch.int32) + >>> t + tensor([ 1, 2, 3]) + >>> t[0] = -1 + >>> a + array([-1, 2, 3]) + + >>> # Interprets the signed char bytes as 32-bit integers. + >>> # Each 4 signed char elements will be interpreted as + >>> # 1 signed 32-bit integer. + >>> import array + >>> a = array.array('b', [-1, 0, 0, 0]) + >>> torch.frombuffer(a, dtype=torch.int32) + tensor([255], dtype=torch.int32) +""".format(**factory_common_args), +) + +add_docstr( + torch.from_file, + r""" +from_file(filename, shared=None, size=0, *, dtype=None, layout=None, device=None, pin_memory=False) + +Creates a CPU tensor with a storage backed by a memory-mapped file. + +If ``shared`` is True, then memory is shared between processes. All changes are written to the file. +If ``shared`` is False, then changes to the tensor do not affect the file. + +``size`` is the number of elements in the Tensor. If ``shared`` is ``False``, then the file must contain +at least ``size * sizeof(dtype)`` bytes. If ``shared`` is ``True`` the file will be created if needed. + +.. note:: + Only CPU tensors can be mapped to files. + +.. note:: + For now, tensors with storages backed by a memory-mapped file cannot be created in pinned memory. + + +Args: + filename (str): file name to map + shared (bool): whether to share memory (whether ``MAP_SHARED`` or ``MAP_PRIVATE`` is passed to the + underlying `mmap(2) call `_) + size (int): number of elements in the tensor + +Keyword args: + {dtype} + {layout} + {device} + {pin_memory} + +Example:: + + >>> t = torch.randn(2, 5, dtype=torch.float64) + >>> t.numpy().tofile('storage.pt') + >>> t_mapped = torch.from_file('storage.pt', shared=False, size=10, dtype=torch.float64) + """.format(**factory_common_args), +) + +add_docstr( + torch.flatten, + r""" +flatten(input, start_dim=0, end_dim=-1) -> Tensor + +Flattens :attr:`input` by reshaping it into a one-dimensional tensor. If :attr:`start_dim` or :attr:`end_dim` +are passed, only dimensions starting with :attr:`start_dim` and ending with :attr:`end_dim` are flattened. +The order of elements in :attr:`input` is unchanged. + +Unlike NumPy's flatten, which always copies input's data, this function may return the original object, a view, +or copy. If no dimensions are flattened, then the original object :attr:`input` is returned. Otherwise, if input can +be viewed as the flattened shape, then that view is returned. Finally, only if the input cannot be viewed as the +flattened shape is input's data copied. See :meth:`torch.Tensor.view` for details on when a view will be returned. + +.. note:: + Flattening a zero-dimensional tensor will return a one-dimensional view. + +Args: + {input} + start_dim (int): the first dim to flatten + end_dim (int): the last dim to flatten + +Example:: + + >>> t = torch.tensor([[[1, 2], + ... [3, 4]], + ... [[5, 6], + ... [7, 8]]]) + >>> torch.flatten(t) + tensor([1, 2, 3, 4, 5, 6, 7, 8]) + >>> torch.flatten(t, start_dim=1) + tensor([[1, 2, 3, 4], + [5, 6, 7, 8]]) +""".format(**common_args), +) + +add_docstr( + torch.unflatten, + r""" +unflatten(input, dim, sizes) -> Tensor + +Expands a dimension of the input tensor over multiple dimensions. + +.. seealso:: + + :func:`torch.flatten` the inverse of this function. It coalesces several dimensions into one. + +Args: + {input} + dim (int): Dimension to be unflattened, specified as an index into + ``input.shape``. + sizes (Tuple[int]): New shape of the unflattened dimension. + One of its elements can be `-1` in which case the corresponding output + dimension is inferred. Otherwise, the product of ``sizes`` *must* + equal ``input.shape[dim]``. + +Returns: + A View of input with the specified dimension unflattened. + +Examples:: + >>> torch.unflatten(torch.randn(3, 4, 1), 1, (2, 2)).shape + torch.Size([3, 2, 2, 1]) + >>> torch.unflatten(torch.randn(3, 4, 1), 1, (-1, 2)).shape + torch.Size([3, 2, 2, 1]) + >>> torch.unflatten(torch.randn(5, 12, 3), -2, (2, 2, 3, 1, 1)).shape + torch.Size([5, 2, 2, 3, 1, 1, 3]) +""".format(**common_args), +) + +add_docstr( + torch.gather, + r""" +gather(input, dim, index, *, sparse_grad=False, out=None) -> Tensor + +Gathers values along an axis specified by `dim`. + +For a 3-D tensor the output is specified by:: + + out[i][j][k] = input[index[i][j][k]][j][k] # if dim == 0 + out[i][j][k] = input[i][index[i][j][k]][k] # if dim == 1 + out[i][j][k] = input[i][j][index[i][j][k]] # if dim == 2 + +:attr:`input` and :attr:`index` must have the same number of dimensions. +It is also required that ``index.size(d) <= input.size(d)`` for all +dimensions ``d != dim``. :attr:`out` will have the same shape as :attr:`index`. +Note that ``input`` and ``index`` do not broadcast against each other. +When :attr:`index` is empty, we always return an empty output with the same shape +without further error checking. + +Args: + input (Tensor): the source tensor + dim (int): the axis along which to index + index (LongTensor): the indices of elements to gather + +Keyword arguments: + sparse_grad (bool, optional): If ``True``, gradient w.r.t. :attr:`input` will be a sparse tensor. + out (Tensor, optional): the destination tensor + +Example:: + + >>> t = torch.tensor([[1, 2], [3, 4]]) + >>> torch.gather(t, 1, torch.tensor([[0, 0], [1, 0]])) + tensor([[ 1, 1], + [ 4, 3]]) +""", +) + + +add_docstr( + torch.gcd, + r""" +gcd(input, other, *, out=None) -> Tensor + +Computes the element-wise greatest common divisor (GCD) of :attr:`input` and :attr:`other`. + +Both :attr:`input` and :attr:`other` must have integer types. + +.. note:: + This defines :math:`gcd(0, 0) = 0`. + +Args: + {input} + other (Tensor): the second input tensor + +Keyword arguments: + {out} + +Example:: + + >>> a = torch.tensor([5, 10, 15]) + >>> b = torch.tensor([3, 4, 5]) + >>> torch.gcd(a, b) + tensor([1, 2, 5]) + >>> c = torch.tensor([3]) + >>> torch.gcd(a, c) + tensor([1, 1, 3]) +""".format(**common_args), +) + +add_docstr( + torch.ge, + r""" +ge(input, other, *, out=None) -> Tensor + +Computes :math:`\text{input} \geq \text{other}` element-wise. +""" + + r""" + +The second argument can be a number or a tensor whose shape is +:ref:`broadcastable ` with the first argument. + +Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + +Keyword args: + {out} + +Returns: + A boolean tensor that is True where :attr:`input` is greater than or equal to :attr:`other` and False elsewhere + +Example:: + + >>> torch.ge(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[True, True], [False, True]]) +""".format(**common_args), +) + +add_docstr( + torch.greater_equal, + r""" +greater_equal(input, other, *, out=None) -> Tensor + +Alias for :func:`torch.ge`. +""", +) + +add_docstr( + torch.gradient, + r""" +gradient(input, *, spacing=1, dim=None, edge_order=1) -> List of Tensors + +Estimates the gradient of a function :math:`g : \mathbb{R}^n \rightarrow \mathbb{R}` in +one or more dimensions using the `second-order accurate central differences method +`_ and +either first or second order estimates at the boundaries. + +The gradient of :math:`g` is estimated using samples. By default, when :attr:`spacing` is not +specified, the samples are entirely described by :attr:`input`, and the mapping of input coordinates +to an output is the same as the tensor's mapping of indices to values. For example, for a three-dimensional +:attr:`input` the function described is :math:`g : \mathbb{R}^3 \rightarrow \mathbb{R}`, and +:math:`g(1, 2, 3)\ == input[1, 2, 3]`. + +When :attr:`spacing` is specified, it modifies the relationship between :attr:`input` and input coordinates. +This is detailed in the "Keyword Arguments" section below. + +The gradient is estimated by estimating each partial derivative of :math:`g` independently. This estimation is +accurate if :math:`g` is in :math:`C^3` (it has at least 3 continuous derivatives), and the estimation can be +improved by providing closer samples. Mathematically, the value at each interior point of a partial derivative +is estimated using `Taylor's theorem with remainder `_. +Letting :math:`x` be an interior point with :math:`x-h_l` and :math:`x+h_r` be points neighboring +it to the left and right respectively, :math:`f(x+h_r)` and :math:`f(x-h_l)` can be estimated using: + +.. math:: + \begin{aligned} + f(x+h_r) = f(x) + h_r f'(x) + {h_r}^2 \frac{f''(x)}{2} + {h_r}^3 \frac{f'''(\xi_1)}{6}, \xi_1 \in (x, x+h_r) \\ + f(x-h_l) = f(x) - h_l f'(x) + {h_l}^2 \frac{f''(x)}{2} - {h_l}^3 \frac{f'''(\xi_2)}{6}, \xi_2 \in (x, x-h_l) \\ + \end{aligned} + +Using the fact that :math:`f \in C^3` and solving the linear system, we derive: + +.. math:: + f'(x) \approx \frac{ {h_l}^2 f(x+h_r) - {h_r}^2 f(x-h_l) + + ({h_r}^2-{h_l}^2 ) f(x) }{ {h_r} {h_l}^2 + {h_r}^2 {h_l} } + +.. note:: + We estimate the gradient of functions in complex domain + :math:`g : \mathbb{C}^n \rightarrow \mathbb{C}` in the same way. + +The value of each partial derivative at the boundary points is computed differently. See edge_order below. + +Args: + input (``Tensor``): the tensor that represents the values of the function + +Keyword args: + spacing (``scalar``, ``list of scalar``, ``list of Tensor``, optional): :attr:`spacing` can be used to modify + how the :attr:`input` tensor's indices relate to sample coordinates. If :attr:`spacing` is a scalar then + the indices are multiplied by the scalar to produce the coordinates. For example, if :attr:`spacing=2` the + indices (1, 2, 3) become coordinates (2, 4, 6). If :attr:`spacing` is a list of scalars then the corresponding + indices are multiplied. For example, if :attr:`spacing=(2, -1, 3)` the indices (1, 2, 3) become coordinates (2, -2, 9). + Finally, if :attr:`spacing` is a list of one-dimensional tensors then each tensor specifies the coordinates for + the corresponding dimension. For example, if the indices are (1, 2, 3) and the tensors are (t0, t1, t2), then + the coordinates are (t0[1], t1[2], t2[3]) + + dim (``int``, ``list of int``, optional): the dimension or dimensions to approximate the gradient over. By default + the partial gradient in every dimension is computed. Note that when :attr:`dim` is specified the elements of + the :attr:`spacing` argument must correspond with the specified dims." + + edge_order (``int``, optional): 1 or 2, for `first-order + `_ or + `second-order `_ + estimation of the boundary ("edge") values, respectively. Note that when :attr:`edge_order` is specified, each + dimension size of :attr:`input` should be at least edge_order+1 + +Examples:: + + >>> # Estimates the gradient of f(x)=x^2 at points [-2, -1, 2, 4] + >>> coordinates = (torch.tensor([-2., -1., 1., 4.]),) + >>> values = torch.tensor([4., 1., 1., 16.], ) + >>> torch.gradient(values, spacing = coordinates) + (tensor([-3., -2., 2., 5.]),) + + >>> # Estimates the gradient of the R^2 -> R function whose samples are + >>> # described by the tensor t. Implicit coordinates are [0, 1] for the outermost + >>> # dimension and [0, 1, 2, 3] for the innermost dimension, and function estimates + >>> # partial derivative for both dimensions. + >>> t = torch.tensor([[1, 2, 4, 8], [10, 20, 40, 80]]) + >>> torch.gradient(t) + (tensor([[ 9., 18., 36., 72.], + [ 9., 18., 36., 72.]]), + tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]])) + + >>> # A scalar value for spacing modifies the relationship between tensor indices + >>> # and input coordinates by multiplying the indices to find the + >>> # coordinates. For example, below the indices of the innermost + >>> # 0, 1, 2, 3 translate to coordinates of [0, 2, 4, 6], and the indices of + >>> # the outermost dimension 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = 2.0) # dim = None (implicitly [0, 1]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.5000, 0.7500, 1.5000, 2.0000], + [ 5.0000, 7.5000, 15.0000, 20.0000]])) + >>> # doubling the spacing between samples halves the estimated partial gradients. + + >>> + >>> # Estimates only the partial derivative for dimension 1 + >>> torch.gradient(t, dim = 1) # spacing = None (implicitly 1.) + (tensor([[ 1.0000, 1.5000, 3.0000, 4.0000], + [10.0000, 15.0000, 30.0000, 40.0000]]),) + + >>> # When spacing is a list of scalars, the relationship between the tensor + >>> # indices and input coordinates changes based on dimension. + >>> # For example, below, the indices of the innermost dimension 0, 1, 2, 3 translate + >>> # to coordinates of [0, 3, 6, 9], and the indices of the outermost dimension + >>> # 0, 1 translate to coordinates of [0, 2]. + >>> torch.gradient(t, spacing = [3., 2.]) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + + >>> # The following example is a replication of the previous one with explicit + >>> # coordinates. + >>> coords = (torch.tensor([0, 2]), torch.tensor([0, 3, 6, 9])) + >>> torch.gradient(t, spacing = coords) + (tensor([[ 4.5000, 9.0000, 18.0000, 36.0000], + [ 4.5000, 9.0000, 18.0000, 36.0000]]), + tensor([[ 0.3333, 0.5000, 1.0000, 1.3333], + [ 3.3333, 5.0000, 10.0000, 13.3333]])) + +""", +) + +add_docstr( + torch.geqrf, + r""" +geqrf(input, *, out=None) -> (Tensor, Tensor) + +This is a low-level function for calling LAPACK's geqrf directly. This function +returns a namedtuple (a, tau) as defined in `LAPACK documentation for geqrf`_ . + +Computes a QR decomposition of :attr:`input`. +Both `Q` and `R` matrices are stored in the same output tensor `a`. +The elements of `R` are stored on and above the diagonal. +Elementary reflectors (or Householder vectors) implicitly defining matrix `Q` +are stored below the diagonal. +The results of this function can be used together with :func:`torch.linalg.householder_product` +to obtain the `Q` matrix or +with :func:`torch.ormqr`, which uses an implicit representation of the `Q` matrix, +for an efficient matrix-matrix multiplication. + +See `LAPACK documentation for geqrf`_ for further details. + +.. note:: + See also :func:`torch.linalg.qr`, which computes Q and R matrices, and :func:`torch.linalg.lstsq` + with the ``driver="gels"`` option for a function that can solve matrix equations using a QR decomposition. + +Args: + input (Tensor): the input matrix + +Keyword args: + out (tuple, optional): the output tuple of (Tensor, Tensor). Ignored if `None`. Default: `None`. + +.. _LAPACK documentation for geqrf: + http://www.netlib.org/lapack/explore-html/df/dc5/group__variants_g_ecomputational_ga3766ea903391b5cf9008132f7440ec7b.html + +""", +) + +add_docstr( + torch.inner, + r""" +inner(input, other, *, out=None) -> Tensor + +Computes the dot product for 1D tensors. For higher dimensions, sums the product +of elements from :attr:`input` and :attr:`other` along their last dimension. + +.. note:: + + If either :attr:`input` or :attr:`other` is a scalar, the result is equivalent + to `torch.mul(input, other)`. + + If both :attr:`input` and :attr:`other` are non-scalars, the size of their last + dimension must match and the result is equivalent to `torch.tensordot(input, + other, dims=([-1], [-1]))` + +Args: + input (Tensor): First input tensor + other (Tensor): Second input tensor + +Keyword args: + out (Tensor, optional): Optional output tensor to write result into. The output + shape is `input.shape[:-1] + other.shape[:-1]`. + +Example:: + + # Dot product + >>> torch.inner(torch.tensor([1, 2, 3]), torch.tensor([0, 2, 1])) + tensor(7) + + # Multidimensional input tensors + >>> a = torch.randn(2, 3) + >>> a + tensor([[0.8173, 1.0874, 1.1784], + [0.3279, 0.1234, 2.7894]]) + >>> b = torch.randn(2, 4, 3) + >>> b + tensor([[[-0.4682, -0.7159, 0.1506], + [ 0.4034, -0.3657, 1.0387], + [ 0.9892, -0.6684, 0.1774], + [ 0.9482, 1.3261, 0.3917]], + + [[ 0.4537, 0.7493, 1.1724], + [ 0.2291, 0.5749, -0.2267], + [-0.7920, 0.3607, -0.3701], + [ 1.3666, -0.5850, -1.7242]]]) + >>> torch.inner(a, b) + tensor([[[-0.9837, 1.1560, 0.2907, 2.6785], + [ 2.5671, 0.5452, -0.6912, -1.5509]], + + [[ 0.1782, 2.9843, 0.7366, 1.5672], + [ 3.5115, -0.4864, -1.2476, -4.4337]]]) + + # Scalar input + >>> torch.inner(a, torch.tensor(2)) + tensor([[1.6347, 2.1748, 2.3567], + [0.6558, 0.2469, 5.5787]]) +""", +) + +add_docstr( + torch.outer, + r""" +outer(input, vec2, *, out=None) -> Tensor + +Outer product of :attr:`input` and :attr:`vec2`. +If :attr:`input` is a vector of size :math:`n` and :attr:`vec2` is a vector of +size :math:`m`, then :attr:`out` must be a matrix of size :math:`(n \times m)`. + +.. note:: This function does not :ref:`broadcast `. + +Args: + input (Tensor): 1-D input vector + vec2 (Tensor): 1-D input vector + +Keyword args: + out (Tensor, optional): optional output matrix + +Example:: + + >>> v1 = torch.arange(1., 5.) + >>> v2 = torch.arange(1., 4.) + >>> torch.outer(v1, v2) + tensor([[ 1., 2., 3.], + [ 2., 4., 6.], + [ 3., 6., 9.], + [ 4., 8., 12.]]) +""", +) + +add_docstr( + torch.ger, + r""" +ger(input, vec2, *, out=None) -> Tensor + +Alias of :func:`torch.outer`. + +.. warning:: + This function is deprecated and will be removed in a future PyTorch release. + Use :func:`torch.outer` instead. +""", +) + +add_docstr( + torch.get_default_dtype, + r""" +get_default_dtype() -> torch.dtype + +Get the current default floating point :class:`torch.dtype`. + +Example:: + + >>> torch.get_default_dtype() # initial default for floating point is torch.float32 + torch.float32 + >>> torch.set_default_dtype(torch.float64) + >>> torch.get_default_dtype() # default is now changed to torch.float64 + torch.float64 + +""", +) + +add_docstr( + torch.get_num_threads, + r""" +get_num_threads() -> int + +Returns the number of threads used for parallelizing CPU operations +""", +) + +add_docstr( + torch.get_num_interop_threads, + r""" +get_num_interop_threads() -> int + +Returns the number of threads used for inter-op parallelism on CPU +(e.g. in JIT interpreter) +""", +) + +add_docstr( + torch.gt, + r""" +gt(input, other, *, out=None) -> Tensor + +Computes :math:`\text{input} > \text{other}` element-wise. +""" + + r""" + +The second argument can be a number or a tensor whose shape is +:ref:`broadcastable ` with the first argument. + +Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + +Keyword args: + {out} + +Returns: + A boolean tensor that is True where :attr:`input` is greater than :attr:`other` and False elsewhere + +Example:: + + >>> torch.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[False, True], [False, False]]) +""".format(**common_args), +) + +add_docstr( + torch.greater, + r""" +greater(input, other, *, out=None) -> Tensor + +Alias for :func:`torch.gt`. +""", +) + +add_docstr( + torch.hash_tensor, + r""" +hash_tensor(input, *, mode=0) -> Tensor + +Returns a hash of all elements in the :attr:`input` tensor. + +Currently only mode=0 (reduction via xor) is supported. The output will always +be of type ``torch.uint64``. The elements of ``input`` are upcasted to their +64 bit float / integer equivalent and bitcasted to ``torch.uint64`` before +reduction via xor. + +Args: + {input} + +Keyword Args: + mode (int) : The hash to use. Default: 0 (xor_reduction) + +Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 1.1918, -1.1813, 0.3373]]) + >>> torch.hash_tensor(a) + tensor(13822780554648485888, dtype=torch.uint64) + +.. function:: hash_tensor(input, dim, *, keepdim=False, mode=0) -> Tensor + :noindex: + +Returns the hash of each row of the :attr:`input` tensor in the given +dimension :attr:`dim` given by mode. If :attr:`dim` is a list of dimensions, +reduce over all of them. + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword Args: + mode (int) : The hash to use. Default: 0 (xor_reduction) + +Example:: + + >>> a = torch.randn(2, 4) + >>> a + tensor([[ 0.1317, -0.5554, -1.4724, -1.1391], + [ 0.0778, -0.6070, 0.6375, 0.1798]]) + >>> torch.hash_tensor(a, 1) + tensor([9233691267014066176, 9255993250844508160], dtype=torch.uint64) +""".format(**multi_dim_common), +) + +add_docstr( + torch.histc, + r""" +histc(input, bins=100, min=0, max=0, *, out=None) -> Tensor + +Computes the histogram of a tensor. + +The elements are sorted into equal width bins between :attr:`min` and +:attr:`max`. If :attr:`min` and :attr:`max` are both zero, the minimum and +maximum values of the data are used. + +Elements lower than min and higher than max and ``NaN`` elements are ignored. + +Args: + {input} + bins (int): number of histogram bins + min (Scalar): lower end of the range (inclusive) + max (Scalar): upper end of the range (inclusive) + +Keyword args: + {out} + +Returns: + Tensor: Histogram represented as a tensor + +Example:: + + >>> torch.histc(torch.tensor([1., 2, 1]), bins=4, min=0, max=3) + tensor([ 0., 2., 1., 0.]) +""".format(**common_args), +) + +add_docstr( + torch.histogram, + r""" +histogram(input, bins, *, range=None, weight=None, density=False, out=None) -> (Tensor, Tensor) + +Computes a histogram of the values in a tensor. + +:attr:`bins` can be an integer or a 1D tensor. + +If :attr:`bins` is an int, it specifies the number of equal-width bins. +By default, the lower and upper range of the bins is determined by the +minimum and maximum elements of the input tensor. The :attr:`range` +argument can be provided to specify a range for the bins. + +If :attr:`bins` is a 1D tensor, it specifies the sequence of bin edges +including the rightmost edge. It should contain at least 2 elements +and its elements should be increasing. + +Args: + {input} + bins: int or 1D Tensor. If int, defines the number of equal-width bins. If tensor, + defines the sequence of bin edges including the rightmost edge. + +Keyword args: + range (tuple of float): Defines the range of the bins. + weight (Tensor): If provided, weight should have the same shape as input. Each value in + input contributes its associated weight towards its bin's result. + density (bool): If False, the result will contain the count (or total weight) in each bin. + If True, the result is the value of the probability density function over the bins, + normalized such that the integral over the range of the bins is 1. + {out} (tuple, optional): The result tuple of two output tensors (hist, bin_edges). + +Returns: + hist (Tensor): 1D Tensor containing the values of the histogram. + bin_edges(Tensor): 1D Tensor containing the edges of the histogram bins. + +Example:: + + >>> torch.histogram(torch.tensor([1., 2, 1]), bins=4, range=(0., 3.), weight=torch.tensor([1., 2., 4.])) + (tensor([ 0., 5., 2., 0.]), tensor([0., 0.75, 1.5, 2.25, 3.])) + >>> torch.histogram(torch.tensor([1., 2, 1]), bins=4, range=(0., 3.), weight=torch.tensor([1., 2., 4.]), density=True) + (tensor([ 0., 0.9524, 0.3810, 0.]), tensor([0., 0.75, 1.5, 2.25, 3.])) +""".format(**common_args), +) + +add_docstr( + torch.histogramdd, + r""" +histogramdd(input, bins, *, range=None, weight=None, density=False, out=None) -> (Tensor, Tensor[]) + +Computes a multi-dimensional histogram of the values in a tensor. + +Interprets the elements of an input tensor whose innermost dimension has size N +as a collection of N-dimensional points. Maps each of the points into a set of +N-dimensional bins and returns the number of points (or total weight) in each bin. + +:attr:`input` must be a tensor with at least 2 dimensions. +If input has shape (M, N), each of its M rows defines a point in N-dimensional space. +If input has three or more dimensions, all but the last dimension are flattened. + +Each dimension is independently associated with its own strictly increasing sequence +of bin edges. Bin edges may be specified explicitly by passing a sequence of 1D +tensors. Alternatively, bin edges may be constructed automatically by passing a +sequence of integers specifying the number of equal-width bins in each dimension. + +For each N-dimensional point in input: + - Each of its coordinates is binned independently among the bin edges + corresponding to its dimension + - Binning results are combined to identify the N-dimensional bin (if any) + into which the point falls + - If the point falls into a bin, the bin's count (or total weight) is incremented + - Points which do not fall into any bin do not contribute to the output + +:attr:`bins` can be a sequence of N 1D tensors, a sequence of N ints, or a single int. + +If :attr:`bins` is a sequence of N 1D tensors, it explicitly specifies the N sequences +of bin edges. Each 1D tensor should contain a strictly increasing sequence with at +least one element. A sequence of K bin edges defines K-1 bins, explicitly specifying +the left and right edges of all bins. Every bin is inclusive of its left edge. Only +the rightmost bin is inclusive of its right edge. + +If :attr:`bins` is a sequence of N ints, it specifies the number of equal-width bins +in each dimension. By default, the leftmost and rightmost bin edges in each dimension +are determined by the minimum and maximum elements of the input tensor in the +corresponding dimension. The :attr:`range` argument can be provided to manually +specify the leftmost and rightmost bin edges in each dimension. + +If :attr:`bins` is an int, it specifies the number of equal-width bins for all dimensions. + +.. note:: + See also :func:`torch.histogram`, which specifically computes 1D histograms. + While :func:`torch.histogramdd` infers the dimensionality of its bins and + binned values from the shape of :attr:`input`, :func:`torch.histogram` + accepts and flattens :attr:`input` of any shape. + +Args: + {input} + bins: Tensor[], int[], or int. + If Tensor[], defines the sequences of bin edges. + If int[], defines the number of equal-width bins in each dimension. + If int, defines the number of equal-width bins for all dimensions. +Keyword args: + range (sequence of float): Defines the leftmost and rightmost bin edges + in each dimension. + weight (Tensor): By default, each value in the input has weight 1. If a weight + tensor is passed, each N-dimensional coordinate in input + contributes its associated weight towards its bin's result. + The weight tensor should have the same shape as the :attr:`input` + tensor excluding its innermost dimension N. + density (bool): If False (default), the result will contain the count (or total weight) + in each bin. If True, each count (weight) is divided by the total count + (total weight), then divided by the volume of its associated bin. +Returns: + hist (Tensor): N-dimensional Tensor containing the values of the histogram. + bin_edges(Tensor[]): sequence of N 1D Tensors containing the bin edges. + +Example:: + + >>> torch.histogramdd(torch.tensor([[0., 1.], [1., 0.], [2., 0.], [2., 2.]]), bins=[3, 3], + ... weight=torch.tensor([1., 2., 4., 8.])) + torch.return_types.histogramdd( + hist=tensor([[0., 1., 0.], + [2., 0., 0.], + [4., 0., 8.]]), + bin_edges=(tensor([0.0000, 0.6667, 1.3333, 2.0000]), + tensor([0.0000, 0.6667, 1.3333, 2.0000]))) + + >>> torch.histogramdd(torch.tensor([[0., 0.], [1., 1.], [2., 2.]]), bins=[2, 2], + ... range=[0., 1., 0., 1.], density=True) + torch.return_types.histogramdd( + hist=tensor([[2., 0.], + [0., 2.]]), + bin_edges=(tensor([0.0000, 0.5000, 1.0000]), + tensor([0.0000, 0.5000, 1.0000]))) + +""".format(**common_args), +) +# TODO: Fix via https://github.com/pytorch/pytorch/issues/75798 +torch.histogramdd.__module__ = "torch" + +add_docstr( + torch.hypot, + r""" +hypot(input, other, *, out=None) -> Tensor + +Given the legs of a right triangle, return its hypotenuse. + +.. math:: + \text{out}_{i} = \sqrt{\text{input}_{i}^{2} + \text{other}_{i}^{2}} + +The shapes of ``input`` and ``other`` must be +:ref:`broadcastable `. +""" + + r""" +Args: + input (Tensor): the first input tensor + other (Tensor): the second input tensor + +Keyword args: + {out} + +Example:: + + >>> a = torch.hypot(torch.tensor([4.0]), torch.tensor([3.0, 4.0, 5.0])) + tensor([5.0000, 5.6569, 6.4031]) + +""".format(**common_args), +) + +add_docstr( + torch.i0, + r""" +i0(input, *, out=None) -> Tensor + +Alias for :func:`torch.special.i0`. +""", +) + +add_docstr( + torch.igamma, + r""" +igamma(input, other, *, out=None) -> Tensor + +Alias for :func:`torch.special.gammainc`. +""", +) + +add_docstr( + torch.igammac, + r""" +igammac(input, other, *, out=None) -> Tensor + +Alias for :func:`torch.special.gammaincc`. +""", +) + +add_docstr( + torch.index_select, + r""" +index_select(input, dim, index, *, out=None) -> Tensor + +Returns a new tensor which indexes the :attr:`input` tensor along dimension +:attr:`dim` using the entries in :attr:`index`. + +The returned tensor has the same number of dimensions as the original tensor +(:attr:`input`). The :attr:`dim`\ th dimension has the same size as the length +of :attr:`index`; other dimensions have the same size as in the original tensor. + +.. note:: The returned tensor does **not** use the same storage as the original + tensor. If :attr:`out` has a different shape than expected, we + silently change it to the correct shape, reallocating the underlying + storage if necessary. + +Args: + {input} + dim (int): the dimension in which we index + index (IntTensor or LongTensor): the 1-D tensor containing the indices to index + +Keyword args: + {out} + +Example:: + + >>> x = torch.randn(3, 4) + >>> x + tensor([[ 0.1427, 0.0231, -0.5414, -1.0009], + [-0.4664, 0.2647, -0.1228, -1.1068], + [-1.1734, -0.6571, 0.7230, -0.6004]]) + >>> indices = torch.tensor([0, 2]) + >>> torch.index_select(x, 0, indices) + tensor([[ 0.1427, 0.0231, -0.5414, -1.0009], + [-1.1734, -0.6571, 0.7230, -0.6004]]) + >>> torch.index_select(x, 1, indices) + tensor([[ 0.1427, -0.5414], + [-0.4664, -0.1228], + [-1.1734, 0.7230]]) +""".format(**common_args), +) + +add_docstr( + torch.inverse, + r""" +inverse(input, *, out=None) -> Tensor + +Alias for :func:`torch.linalg.inv` +""", +) + +add_docstr( + torch.isin, + r""" +isin(elements, test_elements, *, assume_unique=False, invert=False) -> Tensor + +Tests if each element of :attr:`elements` is in :attr:`test_elements`. Returns +a boolean tensor of the same shape as :attr:`elements` that is True for elements +in :attr:`test_elements` and False otherwise. + +.. note:: + One of :attr:`elements` or :attr:`test_elements` can be a scalar, but not both. + +Args: + elements (Tensor or Scalar): Input elements + test_elements (Tensor or Scalar): Values against which to test for each input element + assume_unique (bool, optional): If True, assumes both :attr:`elements` and + :attr:`test_elements` contain unique elements, which can speed up the + calculation. Default: False + invert (bool, optional): If True, inverts the boolean return tensor, resulting in True + values for elements *not* in :attr:`test_elements`. Default: False + +Returns: + A boolean tensor of the same shape as :attr:`elements` that is True for elements in + :attr:`test_elements` and False otherwise + +Example: + >>> torch.isin(torch.tensor([[1, 2], [3, 4]]), torch.tensor([2, 3])) + tensor([[False, True], + [ True, False]]) +""", +) + +add_docstr( + torch.isinf, + r""" +isinf(input) -> Tensor + +Tests if each element of :attr:`input` is infinite +(positive or negative infinity) or not. + +.. note:: + Complex values are infinite when their real or imaginary part is + infinite. + +Args: + {input} + +Returns: + A boolean tensor that is True where :attr:`input` is infinite and False elsewhere + +Example:: + + >>> torch.isinf(torch.tensor([1, float('inf'), 2, float('-inf'), float('nan')])) + tensor([False, True, False, True, False]) +""".format(**common_args), +) + +add_docstr( + torch.isposinf, + r""" +isposinf(input, *, out=None) -> Tensor +Tests if each element of :attr:`input` is positive infinity or not. + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor([-float('inf'), float('inf'), 1.2]) + >>> torch.isposinf(a) + tensor([False, True, False]) +""".format(**common_args), +) + +add_docstr( + torch.isneginf, + r""" +isneginf(input, *, out=None) -> Tensor +Tests if each element of :attr:`input` is negative infinity or not. + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor([-float('inf'), float('inf'), 1.2]) + >>> torch.isneginf(a) + tensor([ True, False, False]) +""".format(**common_args), +) + +add_docstr( + torch.isclose, + r""" +isclose(input, other, rtol=1e-05, atol=1e-08, equal_nan=False) -> Tensor + +Returns a new tensor with boolean elements representing if each element of +:attr:`input` is "close" to the corresponding element of :attr:`other`. +Closeness is defined as: + +.. math:: + \lvert \text{input}_i - \text{other}_i \rvert \leq \texttt{rtol} \times \lvert \text{other}_i \rvert + \texttt{atol} +""" + + r""" + +where :attr:`input` and :attr:`other` are finite. Where :attr:`input` +and/or :attr:`other` are nonfinite they are close if and only if +they are equal, with NaNs being considered equal to each other when +:attr:`equal_nan` is True. + +Args: + input (Tensor): first tensor to compare + other (Tensor): second tensor to compare + rtol (float, optional): relative tolerance. Default: 1e-05 + atol (float, optional): absolute tolerance. Default: 1e-08 + equal_nan (bool, optional): if ``True``, then two ``NaN`` s will be considered equal. Default: ``False`` + +Examples:: + + >>> torch.isclose(torch.tensor((1., 2, 3)), torch.tensor((1 + 1e-10, 3, 4))) + tensor([ True, False, False]) + >>> torch.isclose(torch.tensor((float('inf'), 4)), torch.tensor((float('inf'), 6)), rtol=.5) + tensor([True, True]) +""", +) + +add_docstr( + torch.isfinite, + r""" +isfinite(input) -> Tensor + +Returns a new tensor with boolean elements representing if each element is `finite` or not. + +Real values are finite when they are not NaN, negative infinity, or infinity. +Complex values are finite when both their real and imaginary parts are finite. + +Args: + {input} + +Returns: + A boolean tensor that is True where :attr:`input` is finite and False elsewhere + +Example:: + + >>> torch.isfinite(torch.tensor([1, float('inf'), 2, float('-inf'), float('nan')])) + tensor([True, False, True, False, False]) +""".format(**common_args), +) + +add_docstr( + torch.isnan, + r""" +isnan(input) -> Tensor + +Returns a new tensor with boolean elements representing if each element of :attr:`input` +is NaN or not. Complex values are considered NaN when either their real +and/or imaginary part is NaN. + +Arguments: + {input} + +Returns: + A boolean tensor that is True where :attr:`input` is NaN and False elsewhere + +Example:: + + >>> torch.isnan(torch.tensor([1, float('nan'), 2])) + tensor([False, True, False]) +""".format(**common_args), +) + +add_docstr( + torch.isreal, + r""" +isreal(input) -> Tensor + +Returns a new tensor with boolean elements representing if each element of :attr:`input` is real-valued or not. +All real-valued types are considered real. Complex values are considered real when their imaginary part is 0. + +Arguments: + {input} + +Returns: + A boolean tensor that is True where :attr:`input` is real and False elsewhere + +Example:: + + >>> torch.isreal(torch.tensor([1, 1+1j, 2+0j])) + tensor([True, False, True]) +""".format(**common_args), +) + +add_docstr( + torch.is_floating_point, + r""" +is_floating_point(input: Tensor) -> bool + +Returns True if the data type of :attr:`input` is a floating point data type i.e., +one of ``torch.float64``, ``torch.float32``, ``torch.float16``, and ``torch.bfloat16``. + +Args: + {input} + +Example:: + + >>> torch.is_floating_point(torch.tensor([1.0, 2.0, 3.0])) + True + >>> torch.is_floating_point(torch.tensor([1, 2, 3], dtype=torch.int32)) + False + >>> torch.is_floating_point(torch.tensor([1.0, 2.0, 3.0], dtype=torch.float16)) + True + >>> torch.is_floating_point(torch.tensor([1, 2, 3], dtype=torch.complex64)) + False +""".format(**common_args), +) + +add_docstr( + torch.is_complex, + r""" +is_complex(input: Tensor) -> bool + +Returns True if the data type of :attr:`input` is a complex data type i.e., +one of ``torch.complex64``, and ``torch.complex128``. + +Args: + {input} + +Example:: + + >>> torch.is_complex(torch.tensor([1, 2, 3], dtype=torch.complex64)) + True + >>> torch.is_complex(torch.tensor([1, 2, 3], dtype=torch.complex128)) + True + >>> torch.is_complex(torch.tensor([1, 2, 3], dtype=torch.int32)) + False + >>> torch.is_complex(torch.tensor([1.0, 2.0, 3.0], dtype=torch.float16)) + False +""".format(**common_args), +) + +add_docstr( + torch.is_grad_enabled, + r""" +is_grad_enabled() -> (bool) + +Returns True if grad mode is currently enabled. +""".format(**common_args), +) + +add_docstr( + torch.is_inference_mode_enabled, + r""" +is_inference_mode_enabled() -> (bool) + +Returns True if inference mode is currently enabled. +""".format(**common_args), +) + +add_docstr( + torch.is_inference, + r""" +is_inference(input) -> (bool) + +Returns True if :attr:`input` is an inference tensor. + +A non-view tensor is an inference tensor if and only if it was +allocated during inference mode. A view tensor is an inference +tensor if and only if the tensor it is a view of is an inference tensor. + +For details on inference mode please see +`Inference Mode `_. + +Args: + {input} +""".format(**common_args), +) + +add_docstr( + torch.is_conj, + r""" +is_conj(input) -> (bool) + +Returns True if the :attr:`input` is a conjugated tensor, i.e. its conjugate bit is set to `True`. + +Args: + {input} +""".format(**common_args), +) + +add_docstr( + torch.is_nonzero, + r""" +is_nonzero(input) -> (bool) + +Returns True if the :attr:`input` is a single element tensor which is not equal to zero +after type conversions. +i.e. not equal to ``torch.tensor([0.])`` or ``torch.tensor([0])`` or +``torch.tensor([False])``. +Throws a ``RuntimeError`` if ``torch.numel() != 1`` (even in case +of sparse tensors). + +Args: + {input} + +Examples:: + + >>> torch.is_nonzero(torch.tensor([0.])) + False + >>> torch.is_nonzero(torch.tensor([1.5])) + True + >>> torch.is_nonzero(torch.tensor([False])) + False + >>> torch.is_nonzero(torch.tensor([3])) + True + >>> torch.is_nonzero(torch.tensor([1, 3, 5])) + Traceback (most recent call last): + ... + RuntimeError: Boolean value of Tensor with more than one value is ambiguous + >>> torch.is_nonzero(torch.tensor([])) + Traceback (most recent call last): + ... + RuntimeError: Boolean value of Tensor with no values is ambiguous +""".format(**common_args), +) + +add_docstr( + torch.kron, + r""" +kron(input, other, *, out=None) -> Tensor + +Computes the Kronecker product, denoted by :math:`\otimes`, of :attr:`input` and :attr:`other`. + +If :attr:`input` is a :math:`(a_0 \times a_1 \times \dots \times a_n)` tensor and :attr:`other` is a +:math:`(b_0 \times b_1 \times \dots \times b_n)` tensor, the result will be a +:math:`(a_0*b_0 \times a_1*b_1 \times \dots \times a_n*b_n)` tensor with the following entries: + +.. math:: + (\text{input} \otimes \text{other})_{k_0, k_1, \dots, k_n} = + \text{input}_{i_0, i_1, \dots, i_n} * \text{other}_{j_0, j_1, \dots, j_n}, + +where :math:`k_t = i_t * b_t + j_t` for :math:`0 \leq t \leq n`. +If one tensor has fewer dimensions than the other it is unsqueezed until it has the same number of dimensions. + +Supports real-valued and complex-valued inputs. + +.. note:: + This function generalizes the typical definition of the Kronecker product for two matrices to two tensors, + as described above. When :attr:`input` is a :math:`(m \times n)` matrix and :attr:`other` is a + :math:`(p \times q)` matrix, the result will be a :math:`(p*m \times q*n)` block matrix: + + .. math:: + \mathbf{A} \otimes \mathbf{B}=\begin{bmatrix} + a_{11} \mathbf{B} & \cdots & a_{1 n} \mathbf{B} \\ + \vdots & \ddots & \vdots \\ + a_{m 1} \mathbf{B} & \cdots & a_{m n} \mathbf{B} \end{bmatrix} + + where :attr:`input` is :math:`\mathbf{A}` and :attr:`other` is :math:`\mathbf{B}`. + +Arguments: + input (Tensor) + other (Tensor) + +Keyword args: + out (Tensor, optional): The output tensor. Ignored if ``None``. Default: ``None`` + +Examples:: + + >>> mat1 = torch.eye(2) + >>> mat2 = torch.ones(2, 2) + >>> torch.kron(mat1, mat2) + tensor([[1., 1., 0., 0.], + [1., 1., 0., 0.], + [0., 0., 1., 1.], + [0., 0., 1., 1.]]) + + >>> mat1 = torch.eye(2) + >>> mat2 = torch.arange(1, 5).reshape(2, 2) + >>> torch.kron(mat1, mat2) + tensor([[1., 2., 0., 0.], + [3., 4., 0., 0.], + [0., 0., 1., 2.], + [0., 0., 3., 4.]]) +""", +) + +add_docstr( + torch.kthvalue, + r""" +kthvalue(input, k, dim=None, keepdim=False, *, out=None) -> (Tensor, LongTensor) + +Returns a namedtuple ``(values, indices)`` where ``values`` is the :attr:`k` th +smallest element of each row of the :attr:`input` tensor in the given dimension +:attr:`dim`. And ``indices`` is the index location of each element found. + +If :attr:`dim` is not given, the last dimension of the `input` is chosen. + +If :attr:`keepdim` is ``True``, both the :attr:`values` and :attr:`indices` tensors +are the same size as :attr:`input`, except in the dimension :attr:`dim` where +they are of size 1. Otherwise, :attr:`dim` is squeezed +(see :func:`torch.squeeze`), resulting in both the :attr:`values` and +:attr:`indices` tensors having 1 fewer dimension than the :attr:`input` tensor. + +.. note:: + When :attr:`input` is a CUDA tensor and there are multiple valid + :attr:`k` th values, this function may nondeterministically return + :attr:`indices` for any of them. + +Args: + {input} + k (int): k for the k-th smallest element + dim (int, optional): the dimension to find the kth value along + {opt_keepdim} + +Keyword args: + out (tuple, optional): the output tuple of (Tensor, LongTensor) + can be optionally given to be used as output buffers + +Example:: + + >>> x = torch.arange(1., 6.) + >>> x + tensor([ 1., 2., 3., 4., 5.]) + >>> torch.kthvalue(x, 4) + torch.return_types.kthvalue(values=tensor(4.), indices=tensor(3)) + + >>> x=torch.arange(1.,7.).resize_(2,3) + >>> x + tensor([[ 1., 2., 3.], + [ 4., 5., 6.]]) + >>> torch.kthvalue(x, 2, 0, True) + torch.return_types.kthvalue(values=tensor([[4., 5., 6.]]), indices=tensor([[1, 1, 1]])) +""".format(**single_dim_common), +) + +add_docstr( + torch.lcm, + r""" +lcm(input, other, *, out=None) -> Tensor + +Computes the element-wise least common multiple (LCM) of :attr:`input` and :attr:`other`. + +Both :attr:`input` and :attr:`other` must have integer types. + +.. note:: + This defines :math:`lcm(0, 0) = 0` and :math:`lcm(0, a) = 0`. + +Args: + {input} + other (Tensor): the second input tensor + +Keyword arguments: + {out} + +Example:: + + >>> a = torch.tensor([5, 10, 15]) + >>> b = torch.tensor([3, 4, 5]) + >>> torch.lcm(a, b) + tensor([15, 20, 15]) + >>> c = torch.tensor([3]) + >>> torch.lcm(a, c) + tensor([15, 30, 15]) +""".format(**common_args), +) + +add_docstr( + torch.ldexp, + r""" +ldexp(input, other, *, out=None) -> Tensor + +Multiplies :attr:`input` by 2 ** :attr:`other`. + +.. math:: + \text{{out}}_i = \text{{input}}_i * 2^\text{{other}}_i +""" + + r""" + +Typically this function is used to construct floating point numbers by multiplying +mantissas in :attr:`input` with integral powers of two created from the exponents +in :attr:`other`. + +Args: + {input} + other (Tensor): a tensor of exponents, typically integers. + +Keyword args: + {out} + +Example:: + + >>> torch.ldexp(torch.tensor([1.]), torch.tensor([1])) + tensor([2.]) + >>> torch.ldexp(torch.tensor([1.0]), torch.tensor([1, 2, 3, 4])) + tensor([ 2., 4., 8., 16.]) + + +""".format(**common_args), +) + +add_docstr( + torch.le, + r""" +le(input, other, *, out=None) -> Tensor + +Computes :math:`\text{input} \leq \text{other}` element-wise. +""" + + r""" + +The second argument can be a number or a tensor whose shape is +:ref:`broadcastable ` with the first argument. + +Args: + input (Tensor): the tensor to compare + other (Tensor or Scalar): the tensor or value to compare + +Keyword args: + {out} + +Returns: + A boolean tensor that is True where :attr:`input` is less than or equal to + :attr:`other` and False elsewhere + +Example:: + + >>> torch.le(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[True, False], [True, True]]) +""".format(**common_args), +) + +add_docstr( + torch.less_equal, + r""" +less_equal(input, other, *, out=None) -> Tensor + +Alias for :func:`torch.le`. +""", +) + +add_docstr( + torch.lerp, + r""" +lerp(input, end, weight, *, out=None) + +Does a linear interpolation of two tensors :attr:`start` (given by :attr:`input`) and :attr:`end` based +on a scalar or tensor :attr:`weight` and returns the resulting :attr:`out` tensor. + +.. math:: + \text{out}_i = \text{start}_i + \text{weight}_i \times (\text{end}_i - \text{start}_i) +""" + + r""" +The shapes of :attr:`start` and :attr:`end` must be +:ref:`broadcastable `. If :attr:`weight` is a tensor, then +the shapes of :attr:`weight`, :attr:`start`, and :attr:`end` must be :ref:`broadcastable `. + +Args: + input (Tensor): the tensor with the starting points + end (Tensor): the tensor with the ending points + weight (float or tensor): the weight for the interpolation formula + +Keyword args: + {out} + +Example:: + + >>> start = torch.arange(1., 5.) + >>> end = torch.empty(4).fill_(10) + >>> start + tensor([ 1., 2., 3., 4.]) + >>> end + tensor([ 10., 10., 10., 10.]) + >>> torch.lerp(start, end, 0.5) + tensor([ 5.5000, 6.0000, 6.5000, 7.0000]) + >>> torch.lerp(start, end, torch.full_like(start, 0.5)) + tensor([ 5.5000, 6.0000, 6.5000, 7.0000]) +""".format(**common_args), +) + +add_docstr( + torch.lgamma, + r""" +lgamma(input, *, out=None) -> Tensor + +Computes the natural logarithm of the absolute value of the gamma function on :attr:`input`. + +.. math:: + \text{out}_{i} = \ln |\Gamma(\text{input}_{i})| +""" + + """ +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.arange(0.5, 2, 0.5) + >>> torch.lgamma(a) + tensor([ 0.5724, 0.0000, -0.1208]) +""".format(**common_args), +) + +add_docstr( + torch.linspace, + r""" +linspace(start, end, steps, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + +Creates a one-dimensional tensor of size :attr:`steps` whose values are evenly +spaced from :attr:`start` to :attr:`end`, inclusive. That is, the value are: + +.. math:: + (\text{start}, + \text{start} + \frac{\text{end} - \text{start}}{\text{steps} - 1}, + \ldots, + \text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{\text{steps} - 1}, + \text{end}) +""" + + """ + +From PyTorch 1.11 linspace requires the steps argument. Use steps=100 to restore the previous behavior. + +Args: + start (float or Tensor): the starting value for the set of points. If `Tensor`, it must be 0-dimensional + end (float or Tensor): the ending value for the set of points. If `Tensor`, it must be 0-dimensional + steps (int): size of the constructed tensor + +Keyword arguments: + {out} + dtype (torch.dtype, optional): the data type to perform the computation in. + Default: if None, uses the global default dtype (see torch.get_default_dtype()) + when both :attr:`start` and :attr:`end` are real, + and corresponding complex dtype when either is complex. + {layout} + {device} + {requires_grad} + + +Example:: + + >>> torch.linspace(3, 10, steps=5) + tensor([ 3.0000, 4.7500, 6.5000, 8.2500, 10.0000]) + >>> torch.linspace(-10, 10, steps=5) + tensor([-10., -5., 0., 5., 10.]) + >>> torch.linspace(start=-10, end=10, steps=5) + tensor([-10., -5., 0., 5., 10.]) + >>> torch.linspace(start=-10, end=10, steps=1) + tensor([-10.]) +""".format(**factory_common_args), +) + +add_docstr( + torch.log, + r""" +log(input, *, out=None) -> Tensor + +Returns a new tensor with the natural logarithm of the elements +of :attr:`input`. + +.. math:: + y_{i} = \log_{e} (x_{i}) +""" + + r""" + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.rand(5) * 5 + >>> a + tensor([4.7767, 4.3234, 1.2156, 0.2411, 4.5739]) + >>> torch.log(a) + tensor([ 1.5637, 1.4640, 0.1952, -1.4226, 1.5204]) +""".format(**common_args), +) + +add_docstr( + torch.log10, + r""" +log10(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Returns a new tensor with the logarithm to the base 10 of the elements +of :attr:`input`. + +.. math:: + y_{i} = \log_{10} (x_{i}) +""" + + r""" + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.rand(5) + >>> a + tensor([ 0.5224, 0.9354, 0.7257, 0.1301, 0.2251]) + + + >>> torch.log10(a) + tensor([-0.2820, -0.0290, -0.1392, -0.8857, -0.6476]) + +""".format(**common_args), +) + +add_docstr( + torch.log1p, + r""" +log1p(input, *, out=None) -> Tensor + +Returns a new tensor with the natural logarithm of (1 + :attr:`input`). + +.. math:: + y_i = \log_{e} (x_i + 1) +""" + + r""" +.. note:: This function is more accurate than :func:`torch.log` for small + values of :attr:`input` + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(5) + >>> a + tensor([-1.0090, -0.9923, 1.0249, -0.5372, 0.2492]) + >>> torch.log1p(a) + tensor([ nan, -4.8653, 0.7055, -0.7705, 0.2225]) +""".format(**common_args), +) + +add_docstr( + torch.log2, + r""" +log2(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Returns a new tensor with the logarithm to the base 2 of the elements +of :attr:`input`. + +.. math:: + y_{i} = \log_{2} (x_{i}) +""" + + r""" + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.rand(5) + >>> a + tensor([ 0.8419, 0.8003, 0.9971, 0.5287, 0.0490]) + + + >>> torch.log2(a) + tensor([-0.2483, -0.3213, -0.0042, -0.9196, -4.3504]) + +""".format(**common_args), +) + +add_docstr( + torch.logaddexp, + r""" +logaddexp(input, other, *, out=None) -> Tensor + +Logarithm of the sum of exponentiations of the inputs. + +Calculates pointwise :math:`\log\left(e^x + e^y\right)`. This function is useful +in statistics where the calculated probabilities of events may be so small as to +exceed the range of normal floating point numbers. In such cases the logarithm +of the calculated probability is stored. This function allows adding +probabilities stored in such a fashion. + +This op should be disambiguated with :func:`torch.logsumexp` which performs a +reduction on a single tensor. + +Args: + {input} + other (Tensor): the second input tensor + +Keyword arguments: + {out} + +Example:: + + >>> torch.logaddexp(torch.tensor([-1.0]), torch.tensor([-1.0, -2, -3])) + tensor([-0.3069, -0.6867, -0.8731]) + >>> torch.logaddexp(torch.tensor([-100.0, -200, -300]), torch.tensor([-1.0, -2, -3])) + tensor([-1., -2., -3.]) + >>> torch.logaddexp(torch.tensor([1.0, 2000, 30000]), torch.tensor([-1.0, -2, -3])) + tensor([1.1269e+00, 2.0000e+03, 3.0000e+04]) +""".format(**common_args), +) + +add_docstr( + torch.logaddexp2, + r""" +logaddexp2(input, other, *, out=None) -> Tensor + +Logarithm of the sum of exponentiations of the inputs in base-2. + +Calculates pointwise :math:`\log_2\left(2^x + 2^y\right)`. See +:func:`torch.logaddexp` for more details. + +Args: + {input} + other (Tensor): the second input tensor + +Keyword arguments: + {out} +""".format(**common_args), +) + +add_docstr( + torch.xlogy, + r""" +xlogy(input, other, *, out=None) -> Tensor + +Alias for :func:`torch.special.xlogy`. +""", +) + +add_docstr( + torch.logical_and, + r""" +logical_and(input, other, *, out=None) -> Tensor + +Computes the element-wise logical AND of the given input tensors. Zeros are treated as ``False`` and nonzeros are +treated as ``True``. + +Args: + {input} + other (Tensor): the tensor to compute AND with + +Keyword args: + {out} + +Example:: + + >>> torch.logical_and(torch.tensor([True, False, True]), torch.tensor([True, False, False])) + tensor([ True, False, False]) + >>> a = torch.tensor([0, 1, 10, 0], dtype=torch.int8) + >>> b = torch.tensor([4, 0, 1, 0], dtype=torch.int8) + >>> torch.logical_and(a, b) + tensor([False, False, True, False]) + >>> torch.logical_and(a.double(), b.double()) + tensor([False, False, True, False]) + >>> torch.logical_and(a.double(), b) + tensor([False, False, True, False]) + >>> torch.logical_and(a, b, out=torch.empty(4, dtype=torch.bool)) + tensor([False, False, True, False]) +""".format(**common_args), +) + +add_docstr( + torch.logical_not, + r""" +logical_not(input, *, out=None) -> Tensor + +Computes the element-wise logical NOT of the given input tensor. If not specified, the output tensor will have the bool +dtype. If the input tensor is not a bool tensor, zeros are treated as ``False`` and non-zeros are treated as ``True``. + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> torch.logical_not(torch.tensor([True, False])) + tensor([False, True]) + >>> torch.logical_not(torch.tensor([0, 1, -10], dtype=torch.int8)) + tensor([ True, False, False]) + >>> torch.logical_not(torch.tensor([0., 1.5, -10.], dtype=torch.double)) + tensor([ True, False, False]) + >>> torch.logical_not(torch.tensor([0., 1., -10.], dtype=torch.double), out=torch.empty(3, dtype=torch.int16)) + tensor([1, 0, 0], dtype=torch.int16) +""".format(**common_args), +) + +add_docstr( + torch.logical_or, + r""" +logical_or(input, other, *, out=None) -> Tensor + +Computes the element-wise logical OR of the given input tensors. Zeros are treated as ``False`` and nonzeros are +treated as ``True``. + +Args: + {input} + other (Tensor): the tensor to compute OR with + +Keyword args: + {out} + +Example:: + + >>> torch.logical_or(torch.tensor([True, False, True]), torch.tensor([True, False, False])) + tensor([ True, False, True]) + >>> a = torch.tensor([0, 1, 10, 0], dtype=torch.int8) + >>> b = torch.tensor([4, 0, 1, 0], dtype=torch.int8) + >>> torch.logical_or(a, b) + tensor([ True, True, True, False]) + >>> torch.logical_or(a.double(), b.double()) + tensor([ True, True, True, False]) + >>> torch.logical_or(a.double(), b) + tensor([ True, True, True, False]) + >>> torch.logical_or(a, b, out=torch.empty(4, dtype=torch.bool)) + tensor([ True, True, True, False]) +""".format(**common_args), +) + +add_docstr( + torch.logical_xor, + r""" +logical_xor(input: Tensor, other: Tensor, *, out: Optional[Tensor]) -> Tensor + +Computes the element-wise logical XOR of the given input tensors. Zeros are treated as ``False`` and nonzeros are +treated as ``True``. + +Args: + {input} + other (Tensor): the tensor to compute XOR with + +Keyword args: + {out} + +Example:: + + >>> torch.logical_xor(torch.tensor([True, False, True]), torch.tensor([True, False, False])) + tensor([False, False, True]) + >>> a = torch.tensor([0, 1, 10, 0], dtype=torch.int8) + >>> b = torch.tensor([4, 0, 1, 0], dtype=torch.int8) + >>> torch.logical_xor(a, b) + tensor([ True, True, False, False]) + >>> torch.logical_xor(a.double(), b.double()) + tensor([ True, True, False, False]) + >>> torch.logical_xor(a.double(), b) + tensor([ True, True, False, False]) + >>> torch.logical_xor(a, b, out=torch.empty(4, dtype=torch.bool)) + tensor([ True, True, False, False]) +""".format(**common_args), +) + +add_docstr( + torch.logspace, + """ +logspace(start, end, steps, base=10.0, *, \ + out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor +""" + + r""" + +Creates a one-dimensional tensor of size :attr:`steps` whose values are evenly +spaced from :math:`{{\text{{base}}}}^{{\text{{start}}}}` to +:math:`{{\text{{base}}}}^{{\text{{end}}}}`, inclusive, on a logarithmic scale +with base :attr:`base`. That is, the values are: + +.. math:: + (\text{base}^{\text{start}}, + \text{base}^{(\text{start} + \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, + \ldots, + \text{base}^{(\text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, + \text{base}^{\text{end}}) +""" + + """ + + +From PyTorch 1.11 logspace requires the steps argument. Use steps=100 to restore the previous behavior. + +Args: + start (float or Tensor): the starting value for the set of points. If `Tensor`, it must be 0-dimensional + end (float or Tensor): the ending value for the set of points. If `Tensor`, it must be 0-dimensional + steps (int): size of the constructed tensor + base (float, optional): base of the logarithm function. Default: ``10.0``. + +Keyword arguments: + {out} + dtype (torch.dtype, optional): the data type to perform the computation in. + Default: if None, uses the global default dtype (see torch.get_default_dtype()) + when both :attr:`start` and :attr:`end` are real, + and corresponding complex dtype when either is complex. + {layout} + {device} + {requires_grad} + +Example:: + + >>> torch.logspace(start=-10, end=10, steps=5) + tensor([ 1.0000e-10, 1.0000e-05, 1.0000e+00, 1.0000e+05, 1.0000e+10]) + >>> torch.logspace(start=0.1, end=1.0, steps=5) + tensor([ 1.2589, 2.1135, 3.5481, 5.9566, 10.0000]) + >>> torch.logspace(start=0.1, end=1.0, steps=1) + tensor([1.2589]) + >>> torch.logspace(start=2, end=2, steps=1, base=2) + tensor([4.0]) +""".format(**factory_common_args), +) + +add_docstr( + torch.logsumexp, + r""" +logsumexp(input, dim, keepdim=False, *, out=None) + +Returns the log of summed exponentials of each row of the :attr:`input` +tensor in the given dimension :attr:`dim`. The computation is numerically +stabilized. + +For summation index :math:`j` given by `dim` and other indices :math:`i`, the result is + + .. math:: + \text{{logsumexp}}(x)_{{i}} = \log \sum_j \exp(x_{{ij}}) + +{keepdim_details} + +Args: + {input} + {dim} + {opt_keepdim} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(3, 3) + >>> torch.logsumexp(a, 1) + tensor([1.4907, 1.0593, 1.5696]) + >>> torch.dist(torch.logsumexp(a, 1), torch.log(torch.sum(torch.exp(a), 1))) + tensor(1.6859e-07) +""".format(**multi_dim_common), +) + +add_docstr( + torch.lt, + r""" +lt(input, other, *, out=None) -> Tensor + +Computes :math:`\text{input} < \text{other}` element-wise. +""" + + r""" + +The second argument can be a number or a tensor whose shape is +:ref:`broadcastable ` with the first argument. + +Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + +Keyword args: + {out} + +Returns: + A boolean tensor that is True where :attr:`input` is less than :attr:`other` and False elsewhere + +Example:: + + >>> torch.lt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[False, False], [True, False]]) +""".format(**common_args), +) + +add_docstr( + torch.lu_unpack, + r""" +lu_unpack(LU_data, LU_pivots, unpack_data=True, unpack_pivots=True, *, out=None) -> (Tensor, Tensor, Tensor) + +Unpacks the LU decomposition returned by :func:`~linalg.lu_factor` into the `P, L, U` matrices. + +.. seealso:: + + :func:`~linalg.lu` returns the matrices from the LU decomposition. Its gradient formula is more efficient + than that of doing :func:`~linalg.lu_factor` followed by :func:`~linalg.lu_unpack`. + +Args: + LU_data (Tensor): the packed LU factorization data + LU_pivots (Tensor): the packed LU factorization pivots + unpack_data (bool): flag indicating if the data should be unpacked. + If ``False``, then the returned ``L`` and ``U`` are empty tensors. + Default: ``True`` + unpack_pivots (bool): flag indicating if the pivots should be unpacked into a permutation matrix ``P``. + If ``False``, then the returned ``P`` is an empty tensor. + Default: ``True`` + +Keyword args: + out (tuple, optional): output tuple of three tensors. Ignored if `None`. + +Returns: + A namedtuple ``(P, L, U)`` + +Examples:: + + >>> A = torch.randn(2, 3, 3) + >>> LU, pivots = torch.linalg.lu_factor(A) + >>> P, L, U = torch.lu_unpack(LU, pivots) + >>> # We can recover A from the factorization + >>> A_ = P @ L @ U + >>> torch.allclose(A, A_) + True + + >>> # LU factorization of a rectangular matrix: + >>> A = torch.randn(2, 3, 2) + >>> LU, pivots = torch.linalg.lu_factor(A) + >>> P, L, U = torch.lu_unpack(LU, pivots) + >>> # P, L, U are the same as returned by linalg.lu + >>> P_, L_, U_ = torch.linalg.lu(A) + >>> torch.allclose(P, P_) and torch.allclose(L, L_) and torch.allclose(U, U_) + True + +""".format(**common_args), +) + +add_docstr( + torch.less, + r""" +less(input, other, *, out=None) -> Tensor + +Alias for :func:`torch.lt`. +""", +) + +add_docstr( + torch.lu_solve, + r""" +lu_solve(b, LU_data, LU_pivots, *, out=None) -> Tensor + +Returns the LU solve of the linear system :math:`Ax = b` using the partially pivoted +LU factorization of A from :func:`~linalg.lu_factor`. + +This function supports ``float``, ``double``, ``cfloat`` and ``cdouble`` dtypes for :attr:`input`. + +.. warning:: + + :func:`torch.lu_solve` is deprecated in favor of :func:`torch.linalg.lu_solve`. + :func:`torch.lu_solve` will be removed in a future PyTorch release. + ``X = torch.lu_solve(B, LU, pivots)`` should be replaced with + + .. code:: python + + X = linalg.lu_solve(LU, pivots, B) + +Arguments: + b (Tensor): the RHS tensor of size :math:`(*, m, k)`, where :math:`*` + is zero or more batch dimensions. + LU_data (Tensor): the pivoted LU factorization of A from :meth:`~linalg.lu_factor` of size :math:`(*, m, m)`, + where :math:`*` is zero or more batch dimensions. + LU_pivots (IntTensor): the pivots of the LU factorization from :meth:`~linalg.lu_factor` of size :math:`(*, m)`, + where :math:`*` is zero or more batch dimensions. + The batch dimensions of :attr:`LU_pivots` must be equal to the batch dimensions of + :attr:`LU_data`. + +Keyword args: + {out} + +Example:: + + >>> A = torch.randn(2, 3, 3) + >>> b = torch.randn(2, 3, 1) + >>> LU, pivots = torch.linalg.lu_factor(A) + >>> x = torch.lu_solve(b, LU, pivots) + >>> torch.dist(A @ x, b) + tensor(1.00000e-07 * + 2.8312) +""".format(**common_args), +) + +add_docstr( + torch.masked_select, + r""" +masked_select(input, mask, *, out=None) -> Tensor + +Returns a new 1-D tensor which indexes the :attr:`input` tensor according to +the boolean mask :attr:`mask` which is a `BoolTensor`. + +The shapes of the :attr:`mask` tensor and the :attr:`input` tensor don't need +to match, but they must be :ref:`broadcastable `. + +.. note:: The returned tensor does **not** use the same storage + as the original tensor + +Args: + {input} + mask (BoolTensor): the tensor containing the binary mask to index with + +Keyword args: + {out} + +Example:: + + >>> x = torch.randn(3, 4) + >>> x + tensor([[ 0.3552, -2.3825, -0.8297, 0.3477], + [-1.2035, 1.2252, 0.5002, 0.6248], + [ 0.1307, -2.0608, 0.1244, 2.0139]]) + >>> mask = x.ge(0.5) + >>> mask + tensor([[False, False, False, False], + [False, True, True, True], + [False, False, False, True]]) + >>> torch.masked_select(x, mask) + tensor([ 1.2252, 0.5002, 0.6248, 2.0139]) +""".format(**common_args), +) + +add_docstr( + torch.matrix_power, + r""" +matrix_power(input, n, *, out=None) -> Tensor + +Alias for :func:`torch.linalg.matrix_power` +""", +) + +add_docstr( + torch.matrix_exp, + r""" +matrix_exp(A) -> Tensor + +Alias for :func:`torch.linalg.matrix_exp`. +""", +) + +add_docstr( + torch.max, + r""" +max(input, *, out=None) -> Tensor + +Returns the maximum value of all elements in the ``input`` tensor. + +.. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.6763, 0.7445, -2.2369]]) + >>> torch.max(a) + tensor(0.7445) + +.. function:: max(input, dim, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + +Returns a namedtuple ``(values, indices)`` where ``values`` is the maximum +value of each row of the :attr:`input` tensor in the given dimension +:attr:`dim`. And ``indices`` is the index location of each maximum value found +(argmax). + +If ``keepdim`` is ``True``, the output tensors are of the same size +as ``input`` except in the dimension ``dim`` where they are of size 1. +Otherwise, ``dim`` is squeezed (see :func:`torch.squeeze`), resulting +in the output tensors having 1 fewer dimension than ``input``. + +.. note:: If there are multiple maximal values in a reduced row then + the indices of the first maximal value are returned. + +Args: + {input} + {opt_dim_without_none} + {opt_keepdim} + +Keyword args: + out (tuple, optional): the result tuple of two output tensors (max, max_indices) + +Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-1.2360, -0.2942, -0.1222, 0.8475], + [ 1.1949, -1.1127, -2.2379, -0.6702], + [ 1.5717, -0.9207, 0.1297, -1.8768], + [-0.6172, 1.0036, -0.6060, -0.2432]]) + >>> torch.max(a, 1) + torch.return_types.max(values=tensor([0.8475, 1.1949, 1.5717, 1.0036]), indices=tensor([3, 0, 0, 1])) + >>> a = torch.tensor([[1.0, 2.0], [3.0, 4.0]]) + >>> a.max(dim=1, keepdim=True) + torch.return_types.max( + values=tensor([[2.], [4.]]), + indices=tensor([[1], [1]])) + >>> a.max(dim=1, keepdim=False) + torch.return_types.max( + values=tensor([2., 4.]), + indices=tensor([1, 1])) + +.. function:: max(input, other, *, out=None) -> Tensor + :noindex: + +See :func:`torch.maximum`. + +""".format(**single_dim_common), +) + +add_docstr( + torch.maximum, + r""" +maximum(input, other, *, out=None) -> Tensor + +Computes the element-wise maximum of :attr:`input` and :attr:`other`. + +.. note:: + If one of the elements being compared is a NaN, then that element is returned. + :func:`maximum` is not supported for tensors with complex dtypes. + +Args: + {input} + other (Tensor): the second input tensor + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor((1, 2, -1)) + >>> b = torch.tensor((3, 0, 4)) + >>> torch.maximum(a, b) + tensor([3, 2, 4]) +""".format(**common_args), +) + +add_docstr( + torch.fmax, + r""" +fmax(input, other, *, out=None) -> Tensor + +Computes the element-wise maximum of :attr:`input` and :attr:`other`. + +This is like :func:`torch.maximum` except it handles NaNs differently: +if exactly one of the two elements being compared is a NaN then the non-NaN element is taken as the maximum. +Only if both elements are NaN is NaN propagated. + +This function is a wrapper around C++'s ``std::fmax`` and is similar to NumPy's ``fmax`` function. + +Supports :ref:`broadcasting to a common shape `, +:ref:`type promotion `, and integer and floating-point inputs. + +Args: + {input} + other (Tensor): the second input tensor + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor([9.7, float('nan'), 3.1, float('nan')]) + >>> b = torch.tensor([-2.2, 0.5, float('nan'), float('nan')]) + >>> torch.fmax(a, b) + tensor([9.7000, 0.5000, 3.1000, nan]) +""".format(**common_args), +) + +add_docstr( + torch.amax, + r""" +amax(input, dim, keepdim=False, *, out=None) -> Tensor + +Returns the maximum value of each slice of the :attr:`input` tensor in the given +dimension(s) :attr:`dim`. + +.. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.8177, 1.4878, -0.2491, 0.9130], + [-0.7158, 1.1775, 2.0992, 0.4817], + [-0.0053, 0.0164, -1.3738, -0.0507], + [ 1.9700, 1.1106, -1.0318, -1.0816]]) + >>> torch.amax(a, 1) + tensor([1.4878, 2.0992, 0.0164, 1.9700]) +""".format(**multi_dim_common), +) + +add_docstr( + torch.argmax, + r""" +argmax(input) -> LongTensor + +Returns the indices of the maximum value of all elements in the :attr:`input` tensor. + +This is the second value returned by :meth:`torch.max`. See its +documentation for the exact semantics of this method. + +.. note:: If there are multiple maximal values then the indices of the first maximal value are returned. + +Args: + {input} + +Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], + [-0.7401, -0.8805, -0.3402, -1.1936], + [ 0.4907, -1.3948, -1.0691, -0.3132], + [-1.6092, 0.5419, -0.2993, 0.3195]]) + >>> torch.argmax(a) + tensor(0) + +.. function:: argmax(input, dim, keepdim=False) -> LongTensor + :noindex: + +Returns the indices of the maximum values of a tensor across a dimension. + +This is the second value returned by :meth:`torch.max`. See its +documentation for the exact semantics of this method. + +Args: + {input} + {opt_dim} If ``None``, the argmax of the flattened input is returned. + {opt_keepdim} + +Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], + [-0.7401, -0.8805, -0.3402, -1.1936], + [ 0.4907, -1.3948, -1.0691, -0.3132], + [-1.6092, 0.5419, -0.2993, 0.3195]]) + >>> torch.argmax(a, dim=1) + tensor([ 0, 2, 0, 1]) +""".format(**single_dim_common), +) + +add_docstr( + torch.argwhere, + r""" +argwhere(input) -> Tensor + +Returns a tensor containing the indices of all non-zero elements of +:attr:`input`. Each row in the result contains the indices of a non-zero +element in :attr:`input`. The result is sorted lexicographically, with +the last index changing the fastest (C-style). + +If :attr:`input` has :math:`n` dimensions, then the resulting indices tensor +:attr:`out` is of size :math:`(z \times n)`, where :math:`z` is the total number of +non-zero elements in the :attr:`input` tensor. + +.. note:: + This function is similar to NumPy's `argwhere`. + + When :attr:`input` is on CUDA, this function causes host-device synchronization. + +Args: + {input} + +Example:: + + >>> t = torch.tensor([1, 0, 1]) + >>> torch.argwhere(t) + tensor([[0], + [2]]) + >>> t = torch.tensor([[1, 0, 1], [0, 1, 1]]) + >>> torch.argwhere(t) + tensor([[0, 0], + [0, 2], + [1, 1], + [1, 2]]) +""", +) + +add_docstr( + torch.mean, + r""" +mean(input, *, dtype=None) -> Tensor + +.. note:: + If the `input` tensor is empty, ``torch.mean()`` returns ``nan``. + This behavior is consistent with NumPy and follows the definition + that the mean over an empty set is undefined. + + +Returns the mean value of all elements in the :attr:`input` tensor. Input must be floating point or complex. + +Args: + input (Tensor): + the input tensor, either of floating point or complex dtype + +Keyword args: + {dtype} + +Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.2294, -0.5481, 1.3288]]) + >>> torch.mean(a) + tensor(0.3367) + +.. function:: mean(input, dim, keepdim=False, *, dtype=None, out=None) -> Tensor + :noindex: + +Returns the mean value of each row of the :attr:`input` tensor in the given +dimension :attr:`dim`. If :attr:`dim` is a list of dimensions, +reduce over all of them. + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword args: + {dtype} + {out} + +.. seealso:: + + :func:`torch.nanmean` computes the mean value of `non-NaN` elements. + +Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-0.3841, 0.6320, 0.4254, -0.7384], + [-0.9644, 1.0131, -0.6549, -1.4279], + [-0.2951, -1.3350, -0.7694, 0.5600], + [ 1.0842, -0.9580, 0.3623, 0.2343]]) + >>> torch.mean(a, 1) + tensor([-0.0163, -0.5085, -0.4599, 0.1807]) + >>> torch.mean(a, 1, True) + tensor([[-0.0163], + [-0.5085], + [-0.4599], + [ 0.1807]]) +""".format(**multi_dim_common), +) + +add_docstr( + torch.nanmean, + r""" +nanmean(input, dim=None, keepdim=False, *, dtype=None, out=None) -> Tensor + +Computes the mean of all `non-NaN` elements along the specified dimensions. +Input must be floating point or complex. + +This function is identical to :func:`torch.mean` when there are no `NaN` values +in the :attr:`input` tensor. In the presence of `NaN`, :func:`torch.mean` will +propagate the `NaN` to the output whereas :func:`torch.nanmean` will ignore the +`NaN` values (`torch.nanmean(a)` is equivalent to `torch.mean(a[~a.isnan()])`). + +{keepdim_details} + +Args: + input (Tensor): the input tensor, either of floating point or complex dtype + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword args: + {dtype} + {out} + +.. seealso:: + + :func:`torch.mean` computes the mean value, propagating `NaN`. + +Example:: + + >>> x = torch.tensor([[torch.nan, 1, 2], [1, 2, 3]]) + >>> x.mean() + tensor(nan) + >>> x.nanmean() + tensor(1.8000) + >>> x.mean(dim=0) + tensor([ nan, 1.5000, 2.5000]) + >>> x.nanmean(dim=0) + tensor([1.0000, 1.5000, 2.5000]) + + # If all elements in the reduced dimensions are NaN then the result is NaN + >>> torch.tensor([torch.nan]).nanmean() + tensor(nan) +""".format(**multi_dim_common), +) + +add_docstr( + torch.median, + r""" +median(input) -> Tensor + +Returns the median of the values in :attr:`input`. + +.. note:: + The median is not unique for :attr:`input` tensors with an even number + of elements. In this case the lower of the two medians is returned. To + compute the mean of both medians, use :func:`torch.quantile` with ``q=0.5`` instead. + +.. warning:: + This function produces deterministic (sub)gradients unlike ``median(dim=0)`` + +Args: + {input} + +Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 1.5219, -1.5212, 0.2202]]) + >>> torch.median(a) + tensor(0.2202) + +.. function:: median(input, dim=-1, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + +Returns a namedtuple ``(values, indices)`` where ``values`` contains the median of each row of :attr:`input` +in the dimension :attr:`dim`, and ``indices`` contains the index of the median values found in the dimension :attr:`dim`. + +By default, :attr:`dim` is the last dimension of the :attr:`input` tensor. + +If :attr:`keepdim` is ``True``, the output tensors are of the same size +as :attr:`input` except in the dimension :attr:`dim` where they are of size 1. +Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in +the outputs tensor having 1 fewer dimension than :attr:`input`. + +.. note:: + The median is not unique for :attr:`input` tensors with an even number + of elements in the dimension :attr:`dim`. In this case the lower of the + two medians is returned. To compute the mean of both medians in + :attr:`input`, use :func:`torch.quantile` with ``q=0.5`` instead. + +.. warning:: + ``indices`` does not necessarily contain the first occurrence of each + median value found, unless it is unique. + The exact implementation details are device-specific. + Do not expect the same result when run on CPU and GPU in general. + For the same reason do not expect the gradients to be deterministic. + +Args: + {input} + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword args: + out ((Tensor, Tensor), optional): The first tensor will be populated with the median values and the second + tensor, which must have dtype long, with their indices in the dimension + :attr:`dim` of :attr:`input`. + +Example:: + + >>> a = torch.randn(4, 5) + >>> a + tensor([[ 0.2505, -0.3982, -0.9948, 0.3518, -1.3131], + [ 0.3180, -0.6993, 1.0436, 0.0438, 0.2270], + [-0.2751, 0.7303, 0.2192, 0.3321, 0.2488], + [ 1.0778, -1.9510, 0.7048, 0.4742, -0.7125]]) + >>> torch.median(a, 1) + torch.return_types.median(values=tensor([-0.3982, 0.2270, 0.2488, 0.4742]), indices=tensor([1, 4, 4, 3])) +""".format(**single_dim_common), +) + +add_docstr( + torch.nanmedian, + r""" +nanmedian(input) -> Tensor + +Returns the median of the values in :attr:`input`, ignoring ``NaN`` values. + +This function is identical to :func:`torch.median` when there are no ``NaN`` values in :attr:`input`. +When :attr:`input` has one or more ``NaN`` values, :func:`torch.median` will always return ``NaN``, +while this function will return the median of the non-``NaN`` elements in :attr:`input`. +If all the elements in :attr:`input` are ``NaN`` it will also return ``NaN``. + +Args: + {input} + +Example:: + + >>> a = torch.tensor([1, float('nan'), 3, 2]) + >>> a.median() + tensor(nan) + >>> a.nanmedian() + tensor(2.) + +.. function:: nanmedian(input, dim=-1, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + +Returns a namedtuple ``(values, indices)`` where ``values`` contains the median of each row of :attr:`input` +in the dimension :attr:`dim`, ignoring ``NaN`` values, and ``indices`` contains the index of the median values +found in the dimension :attr:`dim`. + +This function is identical to :func:`torch.median` when there are no ``NaN`` values in a reduced row. When a reduced row has +one or more ``NaN`` values, :func:`torch.median` will always reduce it to ``NaN``, while this function will reduce it to the +median of the non-``NaN`` elements. If all the elements in a reduced row are ``NaN`` then it will be reduced to ``NaN``, too. + +Args: + {input} + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword args: + out ((Tensor, Tensor), optional): The first tensor will be populated with the median values and the second + tensor, which must have dtype long, with their indices in the dimension + :attr:`dim` of :attr:`input`. + +Example:: + + >>> a = torch.tensor([[2, 3, 1], [float('nan'), 1, float('nan')]]) + >>> a + tensor([[2., 3., 1.], + [nan, 1., nan]]) + >>> a.median(0) + torch.return_types.median(values=tensor([nan, 1., nan]), indices=tensor([1, 1, 1])) + >>> a.nanmedian(0) + torch.return_types.nanmedian(values=tensor([2., 1., 1.]), indices=tensor([0, 1, 0])) +""".format(**single_dim_common), +) + +add_docstr( + torch.quantile, + r""" +quantile(input, q, dim=None, keepdim=False, *, interpolation='linear', out=None) -> Tensor + +Computes the q-th quantiles of each row of the :attr:`input` tensor along the dimension :attr:`dim`. + +To compute the quantile, we map q in [0, 1] to the range of indices [0, n] to find the location +of the quantile in the sorted input. If the quantile lies between two data points ``a < b`` with +indices ``i`` and ``j`` in the sorted order, result is computed according to the given +:attr:`interpolation` method as follows: + +- ``linear``: ``a + (b - a) * fraction``, where ``fraction`` is the fractional part of the computed quantile index. +- ``lower``: ``a``. +- ``higher``: ``b``. +- ``nearest``: ``a`` or ``b``, whichever's index is closer to the computed quantile index (follows :func:`torch.round`). +- ``midpoint``: ``(a + b) / 2``. + +If :attr:`q` is a 1D tensor, the first dimension of the output represents the quantiles and has size +equal to the size of :attr:`q`, the remaining dimensions are what remains from the reduction. + +.. note:: + By default :attr:`dim` is ``None`` resulting in the :attr:`input` tensor being flattened before computation. + +Args: + {input} + q (float or Tensor): a scalar or 1D tensor of values in the range [0, 1]. + {opt_dim} + {opt_keepdim} + +Keyword arguments: + interpolation (str, optional): interpolation method to use when the desired quantile lies between two data points. + Can be ``linear``, ``lower``, ``higher``, ``midpoint`` and ``nearest``. + Default is ``linear``. + {out} + +Example:: + + >>> a = torch.randn(2, 3) + >>> a + tensor([[ 0.0795, -1.2117, 0.9765], + [ 1.1707, 0.6706, 0.4884]]) + >>> q = torch.tensor([0.25, 0.5, 0.75]) + >>> torch.quantile(a, q, dim=1, keepdim=True) + tensor([[[-0.5661], + [ 0.5795]], + + [[ 0.0795], + [ 0.6706]], + + [[ 0.5280], + [ 0.9206]]]) + >>> torch.quantile(a, q, dim=1, keepdim=True).shape + torch.Size([3, 2, 1]) + >>> a = torch.arange(4.) + >>> a + tensor([0., 1., 2., 3.]) + >>> torch.quantile(a, 0.6, interpolation='linear') + tensor(1.8000) + >>> torch.quantile(a, 0.6, interpolation='lower') + tensor(1.) + >>> torch.quantile(a, 0.6, interpolation='higher') + tensor(2.) + >>> torch.quantile(a, 0.6, interpolation='midpoint') + tensor(1.5000) + >>> torch.quantile(a, 0.6, interpolation='nearest') + tensor(2.) + >>> torch.quantile(a, 0.4, interpolation='nearest') + tensor(1.) +""".format(**single_dim_common), +) + +add_docstr( + torch.nanquantile, + r""" +nanquantile(input, q, dim=None, keepdim=False, *, interpolation='linear', out=None) -> Tensor + +This is a variant of :func:`torch.quantile` that "ignores" ``NaN`` values, +computing the quantiles :attr:`q` as if ``NaN`` values in :attr:`input` did +not exist. If all values in a reduced row are ``NaN`` then the quantiles for +that reduction will be ``NaN``. See the documentation for :func:`torch.quantile`. + +Args: + {input} + q (float or Tensor): a scalar or 1D tensor of quantile values in the range [0, 1] + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword arguments: + interpolation (str): interpolation method to use when the desired quantile lies between two data points. + Can be ``linear``, ``lower``, ``higher``, ``midpoint`` and ``nearest``. + Default is ``linear``. + {out} + +Example:: + + >>> t = torch.tensor([float('nan'), 1, 2]) + >>> t.quantile(0.5) + tensor(nan) + >>> t.nanquantile(0.5) + tensor(1.5000) + >>> t = torch.tensor([[float('nan'), float('nan')], [1, 2]]) + >>> t + tensor([[nan, nan], + [1., 2.]]) + >>> t.nanquantile(0.5, dim=0) + tensor([1., 2.]) + >>> t.nanquantile(0.5, dim=1) + tensor([ nan, 1.5000]) +""".format(**single_dim_common), +) + +add_docstr( + torch.min, + r""" +min(input, *, out=None) -> Tensor + +Returns the minimum value of all elements in the :attr:`input` tensor. + +.. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.6750, 1.0857, 1.7197]]) + >>> torch.min(a) + tensor(0.6750) + +.. function:: min(input, dim, keepdim=False, *, out=None) -> (Tensor, LongTensor) + :noindex: + +Returns a namedtuple ``(values, indices)`` where ``values`` is the minimum +value of each row of the :attr:`input` tensor in the given dimension +:attr:`dim`. And ``indices`` is the index location of each minimum value found +(argmin). + +If :attr:`keepdim` is ``True``, the output tensors are of the same size as +:attr:`input` except in the dimension :attr:`dim` where they are of size 1. +Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting in +the output tensors having 1 fewer dimension than :attr:`input`. + +.. note:: If there are multiple minimal values in a reduced row then + the indices of the first minimal value are returned. + +Args: + {input} + {opt_dim_without_none} + {opt_keepdim} + +Keyword args: + out (tuple, optional): the tuple of two output tensors (min, min_indices) + +Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[-0.6248, 1.1334, -1.1899, -0.2803], + [-1.4644, -0.2635, -0.3651, 0.6134], + [ 0.2457, 0.0384, 1.0128, 0.7015], + [-0.1153, 2.9849, 2.1458, 0.5788]]) + >>> torch.min(a, 1) + torch.return_types.min(values=tensor([-1.1899, -1.4644, 0.0384, -0.1153]), indices=tensor([2, 0, 1, 0])) + +.. function:: min(input, other, *, out=None) -> Tensor + :noindex: + +See :func:`torch.minimum`. +""".format(**single_dim_common), +) + +add_docstr( + torch.minimum, + r""" +minimum(input, other, *, out=None) -> Tensor + +Computes the element-wise minimum of :attr:`input` and :attr:`other`. + +.. note:: + If one of the elements being compared is a NaN, then that element is returned. + :func:`minimum` is not supported for tensors with complex dtypes. + +Args: + {input} + other (Tensor): the second input tensor + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor((1, 2, -1)) + >>> b = torch.tensor((3, 0, 4)) + >>> torch.minimum(a, b) + tensor([1, 0, -1]) +""".format(**common_args), +) + +add_docstr( + torch.fmin, + r""" +fmin(input, other, *, out=None) -> Tensor + +Computes the element-wise minimum of :attr:`input` and :attr:`other`. + +This is like :func:`torch.minimum` except it handles NaNs differently: +if exactly one of the two elements being compared is a NaN then the non-NaN element is taken as the minimum. +Only if both elements are NaN is NaN propagated. + +This function is a wrapper around C++'s ``std::fmin`` and is similar to NumPy's ``fmin`` function. + +Supports :ref:`broadcasting to a common shape `, +:ref:`type promotion `, and integer and floating-point inputs. + +Args: + {input} + other (Tensor): the second input tensor + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor([2.2, float('nan'), 2.1, float('nan')]) + >>> b = torch.tensor([-9.3, 0.1, float('nan'), float('nan')]) + >>> torch.fmin(a, b) + tensor([-9.3000, 0.1000, 2.1000, nan]) +""".format(**common_args), +) + +add_docstr( + torch.amin, + r""" +amin(input, dim, keepdim=False, *, out=None) -> Tensor + +Returns the minimum value of each slice of the :attr:`input` tensor in the given +dimension(s) :attr:`dim`. + +.. note:: + The difference between ``max``/``min`` and ``amax``/``amin`` is: + - ``amax``/``amin`` supports reducing on multiple dimensions, + - ``amax``/``amin`` does not return indices. + + Both ``amax``/``amin`` evenly distribute gradients between equal values + when there are multiple input elements with the same minimum or maximum value. + + For ``max``/``min``: + - If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values. + - If reduce over one specified axis, only propagate to the indexed element. + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.6451, -0.4866, 0.2987, -1.3312], + [-0.5744, 1.2980, 1.8397, -0.2713], + [ 0.9128, 0.9214, -1.7268, -0.2995], + [ 0.9023, 0.4853, 0.9075, -1.6165]]) + >>> torch.amin(a, 1) + tensor([-1.3312, -0.5744, -1.7268, -1.6165]) +""".format(**multi_dim_common), +) + +add_docstr( + torch.aminmax, + r""" +aminmax(input, *, dim=None, keepdim=False, out=None) -> (Tensor min, Tensor max) + +Computes the minimum and maximum values of the :attr:`input` tensor. + +Args: + input (Tensor): + The input tensor + +Keyword Args: + dim (Optional[int]): + The dimension along which to compute the values. If `None`, + computes the values over the entire :attr:`input` tensor. + Default is `None`. + keepdim (bool): + If `True`, the reduced dimensions will be kept in the output + tensor as dimensions with size 1 for broadcasting, otherwise + they will be removed, as if calling (:func:`torch.squeeze`). + Default is `False`. + out (Optional[Tuple[Tensor, Tensor]]): + Optional tensors on which to write the result. Must have the same + shape and dtype as the expected output. + Default is `None`. + +Returns: + A named tuple `(min, max)` containing the minimum and maximum values. + +Raises: + RuntimeError + If any of the dimensions to compute the values over has size 0. + +.. note:: + NaN values are propagated to the output if at least one value is NaN. + +.. seealso:: + :func:`torch.amin` computes just the minimum value + :func:`torch.amax` computes just the maximum value + +Example:: + + >>> torch.aminmax(torch.tensor([1, -3, 5])) + torch.return_types.aminmax( + min=tensor(-3), + max=tensor(5)) + + >>> # aminmax propagates NaNs + >>> torch.aminmax(torch.tensor([1, -3, 5, torch.nan])) + torch.return_types.aminmax( + min=tensor(nan), + max=tensor(nan)) + + >>> t = torch.arange(10).view(2, 5) + >>> t + tensor([[0, 1, 2, 3, 4], + [5, 6, 7, 8, 9]]) + >>> t.aminmax(dim=0, keepdim=True) + torch.return_types.aminmax( + min=tensor([[0, 1, 2, 3, 4]]), + max=tensor([[5, 6, 7, 8, 9]])) +""", +) + +add_docstr( + torch.argmin, + r""" +argmin(input, dim=None, keepdim=False) -> LongTensor + +Returns the indices of the minimum value(s) of the flattened tensor or along a dimension + +This is the second value returned by :meth:`torch.min`. See its +documentation for the exact semantics of this method. + +.. note:: If there are multiple minimal values then the indices of the first minimal value are returned. + +Args: + {input} + {opt_dim} If ``None``, the argmin of the flattened input is returned. + {opt_keepdim} + +Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.1139, 0.2254, -0.1381, 0.3687], + [ 1.0100, -1.1975, -0.0102, -0.4732], + [-0.9240, 0.1207, -0.7506, -1.0213], + [ 1.7809, -1.2960, 0.9384, 0.1438]]) + >>> torch.argmin(a) + tensor(13) + >>> torch.argmin(a, dim=1) + tensor([ 2, 1, 3, 1]) + >>> torch.argmin(a, dim=1, keepdim=True) + tensor([[2], + [1], + [3], + [1]]) +""".format(**single_dim_common), +) + +add_docstr( + torch.mm, + r""" +mm(input, mat2, out_dtype=None, *, out=None) -> Tensor + +Performs a matrix multiplication of the matrices :attr:`input` and :attr:`mat2`. + +If :attr:`input` is a :math:`(n \times m)` tensor, :attr:`mat2` is a +:math:`(m \times p)` tensor, :attr:`out` will be a :math:`(n \times p)` tensor. + +.. note:: This function does not :ref:`broadcast `. + For broadcasting matrix products, see :func:`torch.matmul`. + +Supports strided and sparse 2-D tensors as inputs, autograd with +respect to strided inputs. + +This operation has support for arguments with :ref:`sparse layouts`. +If :attr:`out` is provided its layout will be used. Otherwise, the result +layout will be deduced from that of :attr:`input`. + +{sparse_beta_warning} + +{tf32_note} + +{rocm_fp16_note} + +Args: + input (Tensor): the first matrix to be matrix multiplied + mat2 (Tensor): the second matrix to be matrix multiplied + out_dtype (dtype, optional): the dtype of the output tensor, + Supported only on CUDA and for torch.float32 given + torch.float16/torch.bfloat16 input dtypes + +Keyword args: + {out} + +Example:: + + >>> mat1 = torch.randn(2, 3) + >>> mat2 = torch.randn(3, 3) + >>> torch.mm(mat1, mat2) + tensor([[ 0.4851, 0.5037, -0.3633], + [-0.0760, -3.6705, 2.4784]]) +""".format(**common_args, **tf32_notes, **rocm_fp16_notes, **sparse_support_notes), +) + +add_docstr( + torch.hspmm, + r""" +hspmm(mat1, mat2, *, out=None) -> Tensor + +Performs a matrix multiplication of a :ref:`sparse COO matrix +` :attr:`mat1` and a strided matrix :attr:`mat2`. The +result is a (1 + 1)-dimensional :ref:`hybrid COO matrix +`. + +Args: + mat1 (Tensor): the first sparse matrix to be matrix multiplied + mat2 (Tensor): the second strided matrix to be matrix multiplied + +Keyword args: + {out} +""".format(**common_args), +) + +add_docstr( + torch.matmul, + r""" +matmul(input, other, *, out=None) -> Tensor + +Matrix product of two tensors. + +The behavior depends on the dimensionality of the tensors as follows: + +- If both tensors are 1-dimensional, the dot product (scalar) is returned. +- If both arguments are 2-dimensional, the matrix-matrix product is returned. +- If the first argument is 1-dimensional and the second argument is 2-dimensional, + a 1 is prepended to its dimension for the purpose of the matrix multiply. + After the matrix multiply, the prepended dimension is removed. +- If the first argument is 2-dimensional and the second argument is 1-dimensional, + the matrix-vector product is returned. +- If both arguments are at least 1-dimensional and at least one argument is + N-dimensional (where N > 2), then a batched matrix multiply is returned. If the first + argument is 1-dimensional, a 1 is prepended to its dimension for the purpose of the + batched matrix multiply and removed after. If the second argument is 1-dimensional, a + 1 is appended to its dimension for the purpose of the batched matrix multiply and removed after. + + The first N-2 dimensions of each argument, the batch dimensions, are + :ref:`broadcast ` (and thus must be broadcastable). + The last 2, the matrix dimensions, are handled as in the matrix-matrix product. + + For example, if :attr:`input` is a + :math:`(j \times 1 \times n \times m)` tensor and :attr:`other` is a :math:`(k \times m \times p)` + tensor, the batch dimensions are :math:`(j \times 1)` and :math:`(k)`, + and the matrix dimensions are :math:`(n \times m)` and :math:`(m \times p)`. + :attr:`out` will be a :math:`(j \times k \times n \times p)` tensor. + +This operation has support for arguments with :ref:`sparse layouts`. In particular the +matrix-matrix (both arguments 2-dimensional) supports sparse arguments with the same restrictions +as :func:`torch.mm` + +{sparse_beta_warning} + +{tf32_note} + +{rocm_fp16_note} + +.. note:: + + The 1-dimensional dot product version of this function does not support an :attr:`out` parameter. + +Arguments: + input (Tensor): the first tensor to be multiplied + other (Tensor): the second tensor to be multiplied + +Keyword args: + {out} + +Example:: + + >>> # vector x vector + >>> tensor1 = torch.randn(3) + >>> tensor2 = torch.randn(3) + >>> torch.matmul(tensor1, tensor2).size() + torch.Size([]) + >>> # matrix x vector + >>> tensor1 = torch.randn(3, 4) + >>> tensor2 = torch.randn(4) + >>> torch.matmul(tensor1, tensor2).size() + torch.Size([3]) + >>> # batched matrix x broadcasted vector + >>> tensor1 = torch.randn(10, 3, 4) + >>> tensor2 = torch.randn(4) + >>> torch.matmul(tensor1, tensor2).size() + torch.Size([10, 3]) + >>> # batched matrix x batched matrix + >>> tensor1 = torch.randn(10, 3, 4) + >>> tensor2 = torch.randn(10, 4, 5) + >>> torch.matmul(tensor1, tensor2).size() + torch.Size([10, 3, 5]) + >>> # batched matrix x broadcasted matrix + >>> tensor1 = torch.randn(10, 3, 4) + >>> tensor2 = torch.randn(4, 5) + >>> torch.matmul(tensor1, tensor2).size() + torch.Size([10, 3, 5]) + +""".format(**common_args, **tf32_notes, **rocm_fp16_notes, **sparse_support_notes), +) + +add_docstr( + torch.mode, + r""" +mode(input, dim=-1, keepdim=False, *, out=None) -> (Tensor, LongTensor) + +Returns a namedtuple ``(values, indices)`` where ``values`` is the mode +value of each row of the :attr:`input` tensor in the given dimension +:attr:`dim`, i.e. a value which appears most often +in that row, and ``indices`` is the index location of each mode value found. + +By default, :attr:`dim` is the last dimension of the :attr:`input` tensor. + +If :attr:`keepdim` is ``True``, the output tensors are of the same size as +:attr:`input` except in the dimension :attr:`dim` where they are of size 1. +Otherwise, :attr:`dim` is squeezed (see :func:`torch.squeeze`), resulting +in the output tensors having 1 fewer dimension than :attr:`input`. + +Args: + {input} + {opt_dim} + {opt_keepdim} + +Keyword args: + out (tuple, optional): the result tuple of two output tensors (values, indices) + +Example:: + + >>> b = torch.tensor([[0, 0, 0, 2, 0, 0, 2], + ... [0, 3, 0, 0, 2, 0, 1], + ... [2, 2, 2, 0, 0, 0, 3], + ... [2, 2, 3, 0, 1, 1, 0], + ... [1, 1, 0, 0, 2, 0, 2]]) + >>> torch.mode(b, 0) + torch.return_types.mode( + values=tensor([0, 2, 0, 0, 0, 0, 2]), + indices=tensor([1, 3, 4, 4, 2, 4, 4])) +""".format(**single_dim_common), +) + +add_docstr( + torch.mul, + r""" +mul(input, other, *, out=None) -> Tensor + +Multiplies :attr:`input` by :attr:`other`. + + +.. math:: + \text{out}_i = \text{input}_i \times \text{other}_i +""" + + r""" + +Supports :ref:`broadcasting to a common shape `, +:ref:`type promotion `, and integer, float, and complex inputs. + +Args: + {input} + other (Tensor or Number): the tensor or number to multiply input by. + +Keyword args: + {out} + +Examples:: + + >>> a = torch.randn(3) + >>> a + tensor([ 0.2015, -0.4255, 2.6087]) + >>> torch.mul(a, 100) + tensor([ 20.1494, -42.5491, 260.8663]) + + >>> b = torch.randn(4, 1) + >>> b + tensor([[ 1.1207], + [-0.3137], + [ 0.0700], + [ 0.8378]]) + >>> c = torch.randn(1, 4) + >>> c + tensor([[ 0.5146, 0.1216, -0.5244, 2.2382]]) + >>> torch.mul(b, c) + tensor([[ 0.5767, 0.1363, -0.5877, 2.5083], + [-0.1614, -0.0382, 0.1645, -0.7021], + [ 0.0360, 0.0085, -0.0367, 0.1567], + [ 0.4312, 0.1019, -0.4394, 1.8753]]) +""".format(**common_args), +) + +add_docstr( + torch.multiply, + r""" +multiply(input, other, *, out=None) + +Alias for :func:`torch.mul`. +""", +) + +add_docstr( + torch.multinomial, + r""" +multinomial(input, num_samples, replacement=False, *, generator=None, out=None) -> LongTensor + +Returns a tensor where each row contains :attr:`num_samples` indices sampled +from the multinomial (a stricter definition would be multivariate, +refer to :class:`torch.distributions.multinomial.Multinomial` for more details) +probability distribution located in the corresponding row +of tensor :attr:`input`. + +.. note:: + The rows of :attr:`input` do not need to sum to one (in which case we use + the values as weights), but must be non-negative, finite and have + a non-zero sum. + +Indices are ordered from left to right according to when each was sampled +(first samples are placed in first column). + +If :attr:`input` is a vector, :attr:`out` is a vector of size :attr:`num_samples`. + +If :attr:`input` is a matrix with `m` rows, :attr:`out` is an matrix of shape +:math:`(m \times \text{{num\_samples}})`. + +If replacement is ``True``, samples are drawn with replacement. + +If not, they are drawn without replacement, which means that when a +sample index is drawn for a row, it cannot be drawn again for that row. + +.. note:: + When drawn without replacement, :attr:`num_samples` must be lower than + number of non-zero elements in :attr:`input` (or the min number of non-zero + elements in each row of :attr:`input` if it is a matrix). + +Args: + input (Tensor): the input tensor containing probabilities + num_samples (int): number of samples to draw + replacement (bool, optional): whether to draw with replacement or not + +Keyword args: + {generator} + {out} + +Example:: + + >>> weights = torch.tensor([0, 10, 3, 0], dtype=torch.float) # create a tensor of weights + >>> torch.multinomial(weights, 2) + tensor([1, 2]) + >>> torch.multinomial(weights, 5) # ERROR! + RuntimeError: cannot sample n_sample > prob_dist.size(-1) samples without replacement + >>> torch.multinomial(weights, 4, replacement=True) + tensor([ 2, 1, 1, 1]) +""".format(**common_args), +) + +add_docstr( + torch.mv, + r""" +mv(input, vec, *, out=None) -> Tensor + +Performs a matrix-vector product of the matrix :attr:`input` and the vector +:attr:`vec`. + +If :attr:`input` is a :math:`(n \times m)` tensor, :attr:`vec` is a 1-D tensor of +size :math:`m`, :attr:`out` will be 1-D of size :math:`n`. + +.. note:: This function does not :ref:`broadcast `. + +Args: + input (Tensor): matrix to be multiplied + vec (Tensor): vector to be multiplied + +Keyword args: + {out} + +Example:: + + >>> mat = torch.randn(2, 3) + >>> vec = torch.randn(3) + >>> torch.mv(mat, vec) + tensor([ 1.0404, -0.6361]) +""".format(**common_args), +) + +add_docstr( + torch.mvlgamma, + r""" +mvlgamma(input, p, *, out=None) -> Tensor + +Alias for :func:`torch.special.multigammaln`. +""", +) + +add_docstr( + torch.movedim, + r""" +movedim(input, source, destination) -> Tensor + +Moves the dimension(s) of :attr:`input` at the position(s) in :attr:`source` +to the position(s) in :attr:`destination`. + +Other dimensions of :attr:`input` that are not explicitly moved remain in +their original order and appear at the positions not specified in :attr:`destination`. + +Args: + {input} + source (int or tuple of ints): Original positions of the dims to move. These must be unique. + destination (int or tuple of ints): Destination positions for each of the original dims. These must also be unique. + +Examples:: + + >>> t = torch.randn(3,2,1) + >>> t + tensor([[[-0.3362], + [-0.8437]], + + [[-0.9627], + [ 0.1727]], + + [[ 0.5173], + [-0.1398]]]) + >>> torch.movedim(t, 1, 0).shape + torch.Size([2, 3, 1]) + >>> torch.movedim(t, 1, 0) + tensor([[[-0.3362], + [-0.9627], + [ 0.5173]], + + [[-0.8437], + [ 0.1727], + [-0.1398]]]) + >>> torch.movedim(t, (1, 2), (0, 1)).shape + torch.Size([2, 1, 3]) + >>> torch.movedim(t, (1, 2), (0, 1)) + tensor([[[-0.3362, -0.9627, 0.5173]], + + [[-0.8437, 0.1727, -0.1398]]]) +""".format(**common_args), +) + +add_docstr( + torch.moveaxis, + r""" +moveaxis(input, source, destination) -> Tensor + +Alias for :func:`torch.movedim`. + +This function is equivalent to NumPy's moveaxis function. + +Examples:: + + >>> t = torch.randn(3,2,1) + >>> t + tensor([[[-0.3362], + [-0.8437]], + + [[-0.9627], + [ 0.1727]], + + [[ 0.5173], + [-0.1398]]]) + >>> torch.moveaxis(t, 1, 0).shape + torch.Size([2, 3, 1]) + >>> torch.moveaxis(t, 1, 0) + tensor([[[-0.3362], + [-0.9627], + [ 0.5173]], + + [[-0.8437], + [ 0.1727], + [-0.1398]]]) + >>> torch.moveaxis(t, (1, 2), (0, 1)).shape + torch.Size([2, 1, 3]) + >>> torch.moveaxis(t, (1, 2), (0, 1)) + tensor([[[-0.3362, -0.9627, 0.5173]], + + [[-0.8437, 0.1727, -0.1398]]]) +""".format(**common_args), +) + +add_docstr( + torch.swapdims, + r""" +swapdims(input, dim0, dim1) -> Tensor + +Alias for :func:`torch.transpose`. + +This function is equivalent to NumPy's swapaxes function. + +Examples:: + + >>> x = torch.tensor([[[0,1],[2,3]],[[4,5],[6,7]]]) + >>> x + tensor([[[0, 1], + [2, 3]], + + [[4, 5], + [6, 7]]]) + >>> torch.swapdims(x, 0, 1) + tensor([[[0, 1], + [4, 5]], + + [[2, 3], + [6, 7]]]) + >>> torch.swapdims(x, 0, 2) + tensor([[[0, 4], + [2, 6]], + + [[1, 5], + [3, 7]]]) +""".format(**common_args), +) + +add_docstr( + torch.swapaxes, + r""" +swapaxes(input, axis0, axis1) -> Tensor + +Alias for :func:`torch.transpose`. + +This function is equivalent to NumPy's swapaxes function. + +Examples:: + + >>> x = torch.tensor([[[0,1],[2,3]],[[4,5],[6,7]]]) + >>> x + tensor([[[0, 1], + [2, 3]], + + [[4, 5], + [6, 7]]]) + >>> torch.swapaxes(x, 0, 1) + tensor([[[0, 1], + [4, 5]], + + [[2, 3], + [6, 7]]]) + >>> torch.swapaxes(x, 0, 2) + tensor([[[0, 4], + [2, 6]], + + [[1, 5], + [3, 7]]]) +""".format(**common_args), +) + +add_docstr( + torch.narrow, + r""" +narrow(input, dim, start, length) -> Tensor + +Returns a new tensor that is a narrowed version of :attr:`input` tensor. The +dimension :attr:`dim` is input from :attr:`start` to ``start + length``. The +returned tensor and :attr:`input` tensor share the same underlying storage. + +Args: + input (Tensor): the tensor to narrow + dim (int): the dimension along which to narrow + start (int or Tensor): index of the element to start the narrowed dimension + from. Can be negative, which means indexing from the end of `dim`. If + `Tensor`, it must be an 0-dim integral `Tensor` (bools not allowed) + length (int): length of the narrowed dimension, must be weakly positive + +Example:: + + >>> x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) + >>> torch.narrow(x, 0, 0, 2) + tensor([[ 1, 2, 3], + [ 4, 5, 6]]) + >>> torch.narrow(x, 1, 1, 2) + tensor([[ 2, 3], + [ 5, 6], + [ 8, 9]]) + >>> torch.narrow(x, -1, torch.tensor(-1), 1) + tensor([[3], + [6], + [9]]) +""", +) + +add_docstr( + torch.narrow_copy, + r""" +narrow_copy(input, dim, start, length, *, out=None) -> Tensor + +Same as :meth:`Tensor.narrow` except this returns a copy rather +than shared storage. This is primarily for sparse tensors, which +do not have a shared-storage narrow method. + +Args: + input (Tensor): the tensor to narrow + dim (int): the dimension along which to narrow + start (int): index of the element to start the narrowed dimension from. Can + be negative, which means indexing from the end of `dim` + length (int): length of the narrowed dimension, must be weakly positive + +Keyword args: + {out} + +Example:: + + >>> x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) + >>> torch.narrow_copy(x, 0, 0, 2) + tensor([[ 1, 2, 3], + [ 4, 5, 6]]) + >>> torch.narrow_copy(x, 1, 1, 2) + tensor([[ 2, 3], + [ 5, 6], + [ 8, 9]]) + >>> s = torch.arange(16).reshape(2, 2, 2, 2).to_sparse(2) + >>> torch.narrow_copy(s, 0, 0, 1) + tensor(indices=tensor([[0, 0], + [0, 1]]), + values=tensor([[[0, 1], + [2, 3]], + + [[4, 5], + [6, 7]]]), + size=(1, 2, 2, 2), nnz=2, layout=torch.sparse_coo) + +.. seealso:: + + :func:`torch.narrow` for a non copy variant + +""".format(**common_args), +) + +add_docstr( + torch.nan_to_num, + r""" +nan_to_num(input, nan=0.0, posinf=None, neginf=None, *, out=None) -> Tensor + +Replaces :literal:`NaN`, positive infinity, and negative infinity values in :attr:`input` +with the values specified by :attr:`nan`, :attr:`posinf`, and :attr:`neginf`, respectively. +By default, :literal:`NaN`\ s are replaced with zero, positive infinity is replaced with the +greatest finite value representable by :attr:`input`'s dtype, and negative infinity +is replaced with the least finite value representable by :attr:`input`'s dtype. + +Args: + {input} + nan (Number, optional): the value to replace :literal:`NaN`\s with. Default is zero. + posinf (Number, optional): if a Number, the value to replace positive infinity values with. + If None, positive infinity values are replaced with the greatest finite value representable by :attr:`input`'s dtype. + Default is None. + neginf (Number, optional): if a Number, the value to replace negative infinity values with. + If None, negative infinity values are replaced with the lowest finite value representable by :attr:`input`'s dtype. + Default is None. + +Keyword args: + {out} + +Example:: + + >>> x = torch.tensor([float('nan'), float('inf'), -float('inf'), 3.14]) + >>> torch.nan_to_num(x) + tensor([ 0.0000e+00, 3.4028e+38, -3.4028e+38, 3.1400e+00]) + >>> torch.nan_to_num(x, nan=2.0) + tensor([ 2.0000e+00, 3.4028e+38, -3.4028e+38, 3.1400e+00]) + >>> torch.nan_to_num(x, nan=2.0, posinf=1.0) + tensor([ 2.0000e+00, 1.0000e+00, -3.4028e+38, 3.1400e+00]) + +""".format(**common_args), +) + +add_docstr( + torch.ne, + r""" +ne(input, other, *, out=None) -> Tensor + +Computes :math:`\text{input} \neq \text{other}` element-wise. +""" + + r""" + +The second argument can be a number or a tensor whose shape is +:ref:`broadcastable ` with the first argument. + +Args: + input (Tensor): the tensor to compare + other (Tensor or float): the tensor or value to compare + +Keyword args: + {out} + +Returns: + A boolean tensor that is True where :attr:`input` is not equal to :attr:`other` and False elsewhere + +Example:: + + >>> torch.ne(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + tensor([[False, True], [True, False]]) +""".format(**common_args), +) + +add_docstr( + torch.not_equal, + r""" +not_equal(input, other, *, out=None) -> Tensor + +Alias for :func:`torch.ne`. +""", +) + +add_docstr( + torch.neg, + r""" +neg(input, *, out=None) -> Tensor + +Returns a new tensor with the negative of the elements of :attr:`input`. + +.. math:: + \text{out} = -1 \times \text{input} +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(5) + >>> a + tensor([ 0.0090, -0.2262, -0.0682, -0.2866, 0.3940]) + >>> torch.neg(a) + tensor([-0.0090, 0.2262, 0.0682, 0.2866, -0.3940]) +""".format(**common_args), +) + +add_docstr( + torch.negative, + r""" +negative(input, *, out=None) -> Tensor + +Alias for :func:`torch.neg` +""", +) + +add_docstr( + torch.nextafter, + r""" +nextafter(input, other, *, out=None) -> Tensor + +Return the next floating-point value after :attr:`input` towards :attr:`other`, elementwise. + +The shapes of ``input`` and ``other`` must be +:ref:`broadcastable `. + +Args: + input (Tensor): the first input tensor + other (Tensor): the second input tensor + +Keyword args: + {out} + +Example:: + + >>> eps = torch.finfo(torch.float32).eps + >>> torch.nextafter(torch.tensor([1.0, 2.0]), torch.tensor([2.0, 1.0])) == torch.tensor([eps + 1, 2 - eps]) + tensor([True, True]) + +""".format(**common_args), +) + +add_docstr( + torch.nonzero, + r""" +nonzero(input, *, out=None, as_tuple=False) -> LongTensor or tuple of LongTensors + +.. note:: + :func:`torch.nonzero(..., as_tuple=False) ` (default) returns a + 2-D tensor where each row is the index for a nonzero value. + + :func:`torch.nonzero(..., as_tuple=True) ` returns a tuple of 1-D + index tensors, allowing for advanced indexing, so ``x[x.nonzero(as_tuple=True)]`` + gives all nonzero values of tensor ``x``. Of the returned tuple, each index tensor + contains nonzero indices for a certain dimension. + + See below for more details on the two behaviors. + + When :attr:`input` is on CUDA, :func:`torch.nonzero() ` causes + host-device synchronization. + +**When** :attr:`as_tuple` **is** ``False`` **(default)**: + +Returns a tensor containing the indices of all non-zero elements of +:attr:`input`. Each row in the result contains the indices of a non-zero +element in :attr:`input`. The result is sorted lexicographically, with +the last index changing the fastest (C-style). + +If :attr:`input` has :math:`n` dimensions, then the resulting indices tensor +:attr:`out` is of size :math:`(z \times n)`, where :math:`z` is the total number of +non-zero elements in the :attr:`input` tensor. + +**When** :attr:`as_tuple` **is** ``True``: + +Returns a tuple of 1-D tensors, one for each dimension in :attr:`input`, +each containing the indices (in that dimension) of all non-zero elements of +:attr:`input` . + +If :attr:`input` has :math:`n` dimensions, then the resulting tuple contains :math:`n` +tensors of size :math:`z`, where :math:`z` is the total number of +non-zero elements in the :attr:`input` tensor. + +As a special case, when :attr:`input` has zero dimensions and a nonzero scalar +value, it is treated as a one-dimensional tensor with one element. + +Args: + {input} + +Keyword args: + out (LongTensor, optional): the output tensor containing indices + +Returns: + LongTensor or tuple of LongTensor: If :attr:`as_tuple` is ``False``, the output + tensor containing indices. If :attr:`as_tuple` is ``True``, one 1-D tensor for + each dimension, containing the indices of each nonzero element along that + dimension. + +Example:: + + >>> torch.nonzero(torch.tensor([1, 1, 1, 0, 1])) + tensor([[ 0], + [ 1], + [ 2], + [ 4]]) + >>> torch.nonzero(torch.tensor([[0.6, 0.0, 0.0, 0.0], + ... [0.0, 0.4, 0.0, 0.0], + ... [0.0, 0.0, 1.2, 0.0], + ... [0.0, 0.0, 0.0,-0.4]])) + tensor([[ 0, 0], + [ 1, 1], + [ 2, 2], + [ 3, 3]]) + >>> torch.nonzero(torch.tensor([1, 1, 1, 0, 1]), as_tuple=True) + (tensor([0, 1, 2, 4]),) + >>> torch.nonzero(torch.tensor([[0.6, 0.0, 0.0, 0.0], + ... [0.0, 0.4, 0.0, 0.0], + ... [0.0, 0.0, 1.2, 0.0], + ... [0.0, 0.0, 0.0,-0.4]]), as_tuple=True) + (tensor([0, 1, 2, 3]), tensor([0, 1, 2, 3])) + >>> torch.nonzero(torch.tensor(5), as_tuple=True) + (tensor([0]),) +""".format(**common_args), +) + +add_docstr( + torch.normal, + r""" +normal(mean, std, *, generator=None, out=None) -> Tensor + +Returns a tensor of random numbers drawn from separate normal distributions +whose mean and standard deviation are given. + +The :attr:`mean` is a tensor with the mean of +each output element's normal distribution + +The :attr:`std` is a tensor with the standard deviation of +each output element's normal distribution + +The shapes of :attr:`mean` and :attr:`std` don't need to match, but the +total number of elements in each tensor need to be the same. + +.. note:: When the shapes do not match, the shape of :attr:`mean` + is used as the shape for the returned output tensor + +.. note:: When :attr:`std` is a CUDA tensor, this function synchronizes + its device with the CPU. + +Args: + mean (Tensor): the tensor of per-element means + std (Tensor): the tensor of per-element standard deviations + +Keyword args: + {generator} + {out} + +Example:: + + >>> torch.normal(mean=torch.arange(1., 11.), std=torch.arange(1, 0, -0.1)) + tensor([ 1.0425, 3.5672, 2.7969, 4.2925, 4.7229, 6.2134, + 8.0505, 8.1408, 9.0563, 10.0566]) + +.. function:: normal(mean=0.0, std, *, out=None) -> Tensor + :noindex: + +Similar to the function above, but the means are shared among all drawn +elements. + +Args: + mean (float, optional): the mean for all distributions + std (Tensor): the tensor of per-element standard deviations + +Keyword args: + {out} + +Example:: + + >>> torch.normal(mean=0.5, std=torch.arange(1., 6.)) + tensor([-1.2793, -1.0732, -2.0687, 5.1177, -1.2303]) + +.. function:: normal(mean, std=1.0, *, out=None) -> Tensor + :noindex: + +Similar to the function above, but the standard deviations are shared among +all drawn elements. + +Args: + mean (Tensor): the tensor of per-element means + std (float, optional): the standard deviation for all distributions + +Keyword args: + out (Tensor, optional): the output tensor + +Example:: + + >>> torch.normal(mean=torch.arange(1., 6.)) + tensor([ 1.1552, 2.6148, 2.6535, 5.8318, 4.2361]) + +.. function:: normal(mean, std, size, *, out=None) -> Tensor + :noindex: + +Similar to the function above, but the means and standard deviations are shared +among all drawn elements. The resulting tensor has size given by :attr:`size`. + +Args: + mean (float): the mean for all distributions + std (float): the standard deviation for all distributions + size (int...): a sequence of integers defining the shape of the output tensor. + +Keyword args: + {out} + +Example:: + + >>> torch.normal(2, 3, size=(1, 4)) + tensor([[-1.3987, -1.9544, 3.6048, 0.7909]]) +""".format(**common_args), +) + +add_docstr( + torch.numel, + r""" +numel(input: Tensor) -> int + +Returns the total number of elements in the :attr:`input` tensor. + +Args: + {input} + +Example:: + + >>> a = torch.randn(1, 2, 3, 4, 5) + >>> torch.numel(a) + 120 + >>> a = torch.zeros(4,4) + >>> torch.numel(a) + 16 + +""".format(**common_args), +) + +add_docstr( + torch.ones, + r""" +ones(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + +Returns a tensor filled with the scalar value `1`, with the shape defined +by the variable argument :attr:`size`. + +Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + +Keyword arguments: + {out} + {dtype} + {layout} + {device} + {requires_grad} + +Example:: + + >>> torch.ones(2, 3) + tensor([[ 1., 1., 1.], + [ 1., 1., 1.]]) + + >>> torch.ones(5) + tensor([ 1., 1., 1., 1., 1.]) + +""".format(**factory_common_args), +) + +add_docstr( + torch.ones_like, + r""" +ones_like(input, *, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + +Returns a tensor filled with the scalar value `1`, with the same size as +:attr:`input`. ``torch.ones_like(input)`` is equivalent to +``torch.ones(input.size(), dtype=input.dtype, layout=input.layout, device=input.device)``. + +.. warning:: + As of 0.4, this function does not support an :attr:`out` keyword. As an alternative, + the old ``torch.ones_like(input, out=output)`` is equivalent to + ``torch.ones(input.size(), out=output)``. + +Args: + {input} + +Keyword arguments: + {dtype} + {layout} + {device} + {requires_grad} + {memory_format} + +Example:: + + >>> input = torch.empty(2, 3) + >>> torch.ones_like(input) + tensor([[ 1., 1., 1.], + [ 1., 1., 1.]]) +""".format(**factory_like_common_args), +) + +add_docstr( + torch.orgqr, + r""" +orgqr(input, tau) -> Tensor + +Alias for :func:`torch.linalg.householder_product`. +""", +) + +add_docstr( + torch.ormqr, + r""" +ormqr(input, tau, other, left=True, transpose=False, *, out=None) -> Tensor + +Computes the matrix-matrix multiplication of a product of Householder matrices with a general matrix. + +Multiplies a :math:`m \times n` matrix `C` (given by :attr:`other`) with a matrix `Q`, +where `Q` is represented using Householder reflectors `(input, tau)`. +See `Representation of Orthogonal or Unitary Matrices`_ for further details. + +If :attr:`left` is `True` then `op(Q)` times `C` is computed, otherwise the result is `C` times `op(Q)`. +When :attr:`left` is `True`, the implicit matrix `Q` has size :math:`m \times m`. +It has size :math:`n \times n` otherwise. +If :attr:`transpose` is `True` then `op` is the conjugate transpose operation, otherwise it's a no-op. + +Supports inputs of float, double, cfloat and cdouble dtypes. +Also supports batched inputs, and, if the input is batched, the output is batched with the same dimensions. + +.. seealso:: + :func:`torch.geqrf` can be used to form the Householder representation `(input, tau)` of matrix `Q` + from the QR decomposition. + +.. note:: + This function supports backward but it is only fast when ``(input, tau)`` do not require gradients + and/or ``tau.size(-1)`` is very small. + `` + +Args: + input (Tensor): tensor of shape `(*, mn, k)` where `*` is zero or more batch dimensions + and `mn` equals to `m` or `n` depending on the :attr:`left`. + tau (Tensor): tensor of shape `(*, min(mn, k))` where `*` is zero or more batch dimensions. + other (Tensor): tensor of shape `(*, m, n)` where `*` is zero or more batch dimensions. + left (bool): controls the order of multiplication. + transpose (bool): controls whether the matrix `Q` is conjugate transposed or not. + +Keyword args: + out (Tensor, optional): the output Tensor. Ignored if `None`. Default: `None`. + +.. _Representation of Orthogonal or Unitary Matrices: + https://www.netlib.org/lapack/lug/node128.html +""", +) + +add_docstr( + torch.permute, + r""" +permute(input, dims) -> Tensor + +Returns a view of the original tensor :attr:`input` with its dimensions permuted. + +Args: + {input} + dims (tuple of int): The desired ordering of dimensions + +Example: + >>> x = torch.randn(2, 3, 5) + >>> x.size() + torch.Size([2, 3, 5]) + >>> torch.permute(x, (2, 0, 1)).size() + torch.Size([5, 2, 3]) +""".format(**common_args), +) + +add_docstr( + torch.poisson, + r""" +poisson(input, generator=None) -> Tensor + +Returns a tensor of the same size as :attr:`input` with each element +sampled from a Poisson distribution with rate parameter given by the corresponding +element in :attr:`input` i.e., + +.. math:: + \text{{out}}_i \sim \text{{Poisson}}(\text{{input}}_i) + +:attr:`input` must be non-negative. + +Args: + input (Tensor): the input tensor containing the rates of the Poisson distribution + +Keyword args: + {generator} + +Example:: + + >>> rates = torch.rand(4, 4) * 5 # rate parameter between 0 and 5 + >>> torch.poisson(rates) + tensor([[9., 1., 3., 5.], + [8., 6., 6., 0.], + [0., 4., 5., 3.], + [2., 1., 4., 2.]]) +""".format(**common_args), +) + +add_docstr( + torch.polygamma, + r""" +polygamma(n, input, *, out=None) -> Tensor + +Alias for :func:`torch.special.polygamma`. +""", +) + +add_docstr( + torch.positive, + r""" +positive(input) -> Tensor + +Returns :attr:`input`. +Throws a runtime error if :attr:`input` is a bool tensor. +""" + + r""" +Args: + {input} + +Example:: + + >>> t = torch.randn(5) + >>> t + tensor([ 0.0090, -0.2262, -0.0682, -0.2866, 0.3940]) + >>> torch.positive(t) + tensor([ 0.0090, -0.2262, -0.0682, -0.2866, 0.3940]) +""".format(**common_args), +) + +add_docstr( + torch.pow, + r""" +pow(input, exponent, *, out=None) -> Tensor + +Takes the power of each element in :attr:`input` with :attr:`exponent` and +returns a tensor with the result. + +:attr:`exponent` can be either a single ``float`` number or a `Tensor` +with the same number of elements as :attr:`input`. + +When :attr:`exponent` is a scalar value, the operation applied is: + +.. math:: + \text{out}_i = x_i ^ \text{exponent} + +When :attr:`exponent` is a tensor, the operation applied is: + +.. math:: + \text{out}_i = x_i ^ {\text{exponent}_i} +""" + + r""" +When :attr:`exponent` is a tensor, the shapes of :attr:`input` +and :attr:`exponent` must be :ref:`broadcastable `. + +Args: + {input} + exponent (float or tensor): the exponent value + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.4331, 1.2475, 0.6834, -0.2791]) + >>> torch.pow(a, 2) + tensor([ 0.1875, 1.5561, 0.4670, 0.0779]) + >>> exp = torch.arange(1., 5.) + + >>> a = torch.arange(1., 5.) + >>> a + tensor([ 1., 2., 3., 4.]) + >>> exp + tensor([ 1., 2., 3., 4.]) + >>> torch.pow(a, exp) + tensor([ 1., 4., 27., 256.]) + +.. function:: pow(self, exponent, *, out=None) -> Tensor + :noindex: + +:attr:`self` is a scalar ``float`` value, and :attr:`exponent` is a tensor. +The returned tensor :attr:`out` is of the same shape as :attr:`exponent` + +The operation applied is: + +.. math:: + \text{{out}}_i = \text{{self}} ^ {{\text{{exponent}}_i}} + +Args: + self (float): the scalar base value for the power operation + exponent (Tensor): the exponent tensor + +Keyword args: + {out} + +Example:: + + >>> exp = torch.arange(1., 5.) + >>> base = 2 + >>> torch.pow(base, exp) + tensor([ 2., 4., 8., 16.]) +""".format(**common_args), +) + +add_docstr( + torch.float_power, + r""" +float_power(input, exponent, *, out=None) -> Tensor + +Raises :attr:`input` to the power of :attr:`exponent`, elementwise, in double precision. +If neither input is complex returns a ``torch.float64`` tensor, +and if one or more inputs is complex returns a ``torch.complex128`` tensor. + +.. note:: + This function always computes in double precision, unlike :func:`torch.pow`, + which implements more typical :ref:`type promotion `. + This is useful when the computation needs to be performed in a wider or more precise dtype, + or the results of the computation may contain fractional values not representable in the input dtypes, + like when an integer base is raised to a negative integer exponent. + +Args: + input (Tensor or Number): the base value(s) + exponent (Tensor or Number): the exponent value(s) + +Keyword args: + {out} + +Example:: + + >>> a = torch.randint(10, (4,)) + >>> a + tensor([6, 4, 7, 1]) + >>> torch.float_power(a, 2) + tensor([36., 16., 49., 1.], dtype=torch.float64) + + >>> a = torch.arange(1, 5) + >>> a + tensor([ 1, 2, 3, 4]) + >>> exp = torch.tensor([2, -3, 4, -5]) + >>> exp + tensor([ 2, -3, 4, -5]) + >>> torch.float_power(a, exp) + tensor([1.0000e+00, 1.2500e-01, 8.1000e+01, 9.7656e-04], dtype=torch.float64) +""".format(**common_args), +) + +add_docstr( + torch.prod, + r""" +prod(input: Tensor, *, dtype: Optional[_dtype]) -> Tensor + +Returns the product of all elements in the :attr:`input` tensor. + +Args: + {input} + +Keyword args: + {dtype} + +Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[-0.8020, 0.5428, -1.5854]]) + >>> torch.prod(a) + tensor(0.6902) + +.. function:: prod(input, dim, keepdim=False, *, dtype=None) -> Tensor + :noindex: + +Returns the product of each row of the :attr:`input` tensor in the given +dimension :attr:`dim`. + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword args: + {dtype} + +Example:: + + >>> a = torch.randn(4, 2) + >>> a + tensor([[ 0.5261, -0.3837], + [ 1.1857, -0.2498], + [-1.1646, 0.0705], + [ 1.1131, -1.0629]]) + >>> torch.prod(a, 1) + tensor([-0.2018, -0.2962, -0.0821, -1.1831]) +""".format(**single_dim_common), +) + +add_docstr( + torch.promote_types, + r""" +promote_types(type1, type2) -> dtype + +Returns the :class:`torch.dtype` with the smallest size and scalar kind that is +not smaller nor of lower kind than either `type1` or `type2`. See type promotion +:ref:`documentation ` for more information on the type +promotion logic. + +Args: + type1 (:class:`torch.dtype`) + type2 (:class:`torch.dtype`) + +Example:: + + >>> torch.promote_types(torch.int32, torch.float32) + torch.float32 + >>> torch.promote_types(torch.uint8, torch.long) + torch.long +""", +) + +add_docstr( + torch.qr, + r""" +qr(input: Tensor, some: bool = True, *, out: Union[Tensor, Tuple[Tensor, ...], List[Tensor], None]) -> (Tensor, Tensor) + +Computes the QR decomposition of a matrix or a batch of matrices :attr:`input`, +and returns a namedtuple (Q, R) of tensors such that :math:`\text{input} = Q R` +with :math:`Q` being an orthogonal matrix or batch of orthogonal matrices and +:math:`R` being an upper triangular matrix or batch of upper triangular matrices. + +If :attr:`some` is ``True``, then this function returns the thin (reduced) QR factorization. +Otherwise, if :attr:`some` is ``False``, this function returns the complete QR factorization. + +.. warning:: + + :func:`torch.qr` is deprecated in favor of :func:`torch.linalg.qr` + and will be removed in a future PyTorch release. The boolean parameter :attr:`some` has been + replaced with a string parameter :attr:`mode`. + + ``Q, R = torch.qr(A)`` should be replaced with + + .. code:: python + + Q, R = torch.linalg.qr(A) + + ``Q, R = torch.qr(A, some=False)`` should be replaced with + + .. code:: python + + Q, R = torch.linalg.qr(A, mode="complete") + +.. warning:: + If you plan to backpropagate through QR, note that the current backward implementation + is only well-defined when the first :math:`\min(input.size(-1), input.size(-2))` + columns of :attr:`input` are linearly independent. + This behavior will probably change once QR supports pivoting. + +.. note:: This function uses LAPACK for CPU inputs and MAGMA for CUDA inputs, + and may produce different (valid) decompositions on different device types + or different platforms. + +Args: + input (Tensor): the input tensor of size :math:`(*, m, n)` where `*` is zero or more + batch dimensions consisting of matrices of dimension :math:`m \times n`. + some (bool, optional): Set to ``True`` for reduced QR decomposition and ``False`` for + complete QR decomposition. If `k = min(m, n)` then: + + * ``some=True`` : returns `(Q, R)` with dimensions (m, k), (k, n) (default) + + * ``'some=False'``: returns `(Q, R)` with dimensions (m, m), (m, n) + +Keyword args: + out (tuple, optional): tuple of `Q` and `R` tensors. + The dimensions of `Q` and `R` are detailed in the description of :attr:`some` above. + +Example:: + + >>> a = torch.tensor([[12., -51, 4], [6, 167, -68], [-4, 24, -41]]) + >>> q, r = torch.qr(a) + >>> q + tensor([[-0.8571, 0.3943, 0.3314], + [-0.4286, -0.9029, -0.0343], + [ 0.2857, -0.1714, 0.9429]]) + >>> r + tensor([[ -14.0000, -21.0000, 14.0000], + [ 0.0000, -175.0000, 70.0000], + [ 0.0000, 0.0000, -35.0000]]) + >>> torch.mm(q, r).round() + tensor([[ 12., -51., 4.], + [ 6., 167., -68.], + [ -4., 24., -41.]]) + >>> torch.mm(q.t(), q).round() + tensor([[ 1., 0., 0.], + [ 0., 1., -0.], + [ 0., -0., 1.]]) + >>> a = torch.randn(3, 4, 5) + >>> q, r = torch.qr(a, some=False) + >>> torch.allclose(torch.matmul(q, r), a) + True + >>> torch.allclose(torch.matmul(q.mT, q), torch.eye(5)) + True +""", +) + +add_docstr( + torch.rad2deg, + r""" +rad2deg(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Returns a new tensor with each of the elements of :attr:`input` +converted from angles in radians to degrees. + +Args: + {input} + +Keyword arguments: + {out} + +Example:: + + >>> a = torch.tensor([[3.142, -3.142], [6.283, -6.283], [1.570, -1.570]]) + >>> torch.rad2deg(a) + tensor([[ 180.0233, -180.0233], + [ 359.9894, -359.9894], + [ 89.9544, -89.9544]]) + +""".format(**common_args), +) + +add_docstr( + torch.deg2rad, + r""" +deg2rad(input, *, out=None) -> Tensor + +Returns a new tensor with each of the elements of :attr:`input` +converted from angles in degrees to radians. + +Args: + {input} + +Keyword arguments: + {out} + +Example:: + + >>> a = torch.tensor([[180.0, -180.0], [360.0, -360.0], [90.0, -90.0]]) + >>> torch.deg2rad(a) + tensor([[ 3.1416, -3.1416], + [ 6.2832, -6.2832], + [ 1.5708, -1.5708]]) + +""".format(**common_args), +) + +add_docstr( + torch.heaviside, + r""" +heaviside(input, values, *, out=None) -> Tensor + +Computes the Heaviside step function for each element in :attr:`input`. +The Heaviside step function is defined as: + +.. math:: + \text{{heaviside}}(input, values) = \begin{cases} + 0, & \text{if input < 0}\\ + values, & \text{if input == 0}\\ + 1, & \text{if input > 0} + \end{cases} +""" + + r""" + +Args: + {input} + values (Tensor): The values to use where :attr:`input` is zero. + +Keyword arguments: + {out} + +Example:: + + >>> input = torch.tensor([-1.5, 0, 2.0]) + >>> values = torch.tensor([0.5]) + >>> torch.heaviside(input, values) + tensor([0.0000, 0.5000, 1.0000]) + >>> values = torch.tensor([1.2, -2.0, 3.5]) + >>> torch.heaviside(input, values) + tensor([0., -2., 1.]) + +""".format(**common_args), +) + +add_docstr( + torch.rand, + """ +rand(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, \ +requires_grad=False, pin_memory=False) -> Tensor +""" + + r""" +Returns a tensor filled with random numbers from a uniform distribution +on the interval :math:`[0, 1)` + +The shape of the tensor is defined by the variable argument :attr:`size`. + +Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + +Keyword args: + {generator} + {out} + {dtype} + {layout} + {device} + {requires_grad} + {pin_memory} + +Example:: + + >>> torch.rand(4) + tensor([ 0.5204, 0.2503, 0.3525, 0.5673]) + >>> torch.rand(2, 3) + tensor([[ 0.8237, 0.5781, 0.6879], + [ 0.3816, 0.7249, 0.0998]]) +""".format(**factory_common_args), +) + +add_docstr( + torch.rand_like, + """ +rand_like(input, *, generator=None, dtype=None, layout=None, device=None, \ +requires_grad=False, memory_format=torch.preserve_format) -> Tensor +""" + + r""" +Returns a tensor with the same size as :attr:`input` that is filled with +random numbers from a uniform distribution on the interval :math:`[0, 1)`. +``torch.rand_like(input)`` is equivalent to +``torch.rand(input.size(), dtype=input.dtype, layout=input.layout, device=input.device)``. + +Args: + {input} + +Keyword args: + {generator} + {dtype} + {layout} + {device} + {requires_grad} + {memory_format} + +""".format(**factory_like_common_args), +) + +add_docstr( + torch.randint, + """ +randint(low=0, high, size, \\*, generator=None, out=None, \ +dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + +Returns a tensor filled with random integers generated uniformly +between :attr:`low` (inclusive) and :attr:`high` (exclusive). + +The shape of the tensor is defined by the variable argument :attr:`size`. + +.. note:: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + +Args: + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + size (tuple): a tuple defining the shape of the output tensor. + +Keyword args: + {generator} + {out} + dtype (torch.dtype, optional): the desired data type of returned tensor. Default: if ``None``, + this function returns a tensor with dtype ``torch.int64``. + {layout} + {device} + {requires_grad} + +Example:: + + >>> torch.randint(3, 5, (3,)) + tensor([4, 3, 4]) + + + >>> torch.randint(10, (2, 2)) + tensor([[0, 2], + [5, 5]]) + + + >>> torch.randint(3, 10, (2, 2)) + tensor([[4, 5], + [6, 7]]) + + +""".format(**factory_common_args), +) + +add_docstr( + torch.randint_like, + """ +randint_like(input, low=0, high, \\*, generator=None, dtype=None, layout=torch.strided, \ +device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor +""" + + r""" +Returns a tensor with the same shape as Tensor :attr:`input` filled with +random integers generated uniformly between :attr:`low` (inclusive) and +:attr:`high` (exclusive). + +.. note: + With the global dtype default (``torch.float32``), this function returns + a tensor with dtype ``torch.int64``. + +Args: + {input} + low (int, optional): Lowest integer to be drawn from the distribution. Default: 0. + high (int): One above the highest integer to be drawn from the distribution. + +Keyword args: + {generator} + {dtype} + {layout} + {device} + {requires_grad} + {memory_format} + +""".format(**factory_like_common_args), +) + +add_docstr( + torch.randn, + """ +randn(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, \ +pin_memory=False) -> Tensor +""" + + r""" + +Returns a tensor filled with random numbers from a normal distribution +with mean `0` and variance `1` (also called the standard normal +distribution). + +.. math:: + \text{{out}}_{{i}} \sim \mathcal{{N}}(0, 1) + +For complex dtypes, the tensor is i.i.d. sampled from a `complex normal distribution`_ with zero mean and +unit variance as + +.. math:: + \text{{out}}_{{i}} \sim \mathcal{{CN}}(0, 1) + +This is equivalent to separately sampling the real :math:`(\operatorname{{Re}})` and imaginary +:math:`(\operatorname{{Im}})` part of :math:`\text{{out}}_i` as + +.. math:: + \operatorname{{Re}}(\text{{out}}_{{i}}) \sim \mathcal{{N}}(0, \frac{{1}}{{2}}),\quad + \operatorname{{Im}}(\text{{out}}_{{i}}) \sim \mathcal{{N}}(0, \frac{{1}}{{2}}) + +The shape of the tensor is defined by the variable argument :attr:`size`. + + +Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + +Keyword args: + {generator} + {out} + {dtype} + {layout} + {device} + {requires_grad} + {pin_memory} + +Example:: + + >>> torch.randn(4) + tensor([-2.1436, 0.9966, 2.3426, -0.6366]) + >>> torch.randn(2, 3) + tensor([[ 1.5954, 2.8929, -1.0923], + [ 1.1719, -0.4709, -0.1996]]) + +.. _complex normal distribution: https://en.wikipedia.org/wiki/Complex_normal_distribution +""".format(**factory_common_args), +) + +add_docstr( + torch.randn_like, + """ +randn_like(input, *, generator=None, dtype=None, layout=None, device=None, \ +requires_grad=False, memory_format=torch.preserve_format) -> Tensor +""" + + r""" +Returns a tensor with the same size as :attr:`input` that is filled with +random numbers from a normal distribution with mean 0 and variance 1. Please refer to :func:`torch.randn` for the +sampling process of complex dtypes. ``torch.randn_like(input)`` is equivalent to +``torch.randn(input.size(), dtype=input.dtype, layout=input.layout, device=input.device)``. + +Args: + {input} + +Keyword args: + {generator} + {dtype} + {layout} + {device} + {requires_grad} + {memory_format} + +""".format(**factory_like_common_args), +) + +add_docstr( + torch.randperm, + """ +randperm(n, *, generator=None, out=None, dtype=torch.int64,layout=torch.strided, \ +device=None, requires_grad=False, pin_memory=False) -> Tensor +""" + + r""" +Returns a random permutation of integers from ``0`` to ``n - 1``. + +Args: + n (int): the upper bound (exclusive) + +Keyword args: + {generator} + {out} + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: ``torch.int64``. + {layout} + {device} + {requires_grad} + {pin_memory} + +Example:: + + >>> torch.randperm(4) + tensor([2, 1, 0, 3]) +""".format(**factory_common_args), +) + +add_docstr( + torch.tensor, + r""" +tensor(data, *, dtype=None, device=None, requires_grad=False, pin_memory=False) -> Tensor + +Constructs a tensor with no autograd history (also known as a "leaf tensor", see :doc:`/notes/autograd`) by copying :attr:`data`. + +.. warning:: + + When working with tensors prefer using :func:`torch.Tensor.clone`, + :func:`torch.Tensor.detach`, and :func:`torch.Tensor.requires_grad_` for + readability. Letting `t` be a tensor, ``torch.tensor(t)`` is equivalent to + ``t.detach().clone()``, and ``torch.tensor(t, requires_grad=True)`` + is equivalent to ``t.detach().clone().requires_grad_(True)``. + +.. seealso:: + + :func:`torch.as_tensor` preserves autograd history and avoids copies where possible. + :func:`torch.from_numpy` creates a tensor that shares storage with a NumPy array. + +Args: + {data} + +Keyword args: + {dtype} + device (:class:`torch.device`, optional): the device of the constructed tensor. If None and data is a tensor + then the device of data is used. If None and data is not a tensor then + the result tensor is constructed on the current device. + {requires_grad} + {pin_memory} + + +Example:: + + >>> torch.tensor([[0.1, 1.2], [2.2, 3.1], [4.9, 5.2]]) + tensor([[ 0.1000, 1.2000], + [ 2.2000, 3.1000], + [ 4.9000, 5.2000]]) + + >>> torch.tensor([0, 1]) # Type inference on data + tensor([ 0, 1]) + + >>> torch.tensor([[0.11111, 0.222222, 0.3333333]], + ... dtype=torch.float64, + ... device=torch.device('cuda:0')) # creates a double tensor on a CUDA device + tensor([[ 0.1111, 0.2222, 0.3333]], dtype=torch.float64, device='cuda:0') + + >>> torch.tensor(3.14159) # Create a zero-dimensional (scalar) tensor + tensor(3.1416) + + >>> torch.tensor([]) # Create an empty tensor (of size (0,)) + tensor([]) +""".format(**factory_data_common_args), +) + +add_docstr( + torch.range, + r""" +range(start=0, end, step=1, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + +Returns a 1-D tensor of size :math:`\left\lfloor \frac{\text{end} - \text{start}}{\text{step}} \right\rfloor + 1` +with values from :attr:`start` to :attr:`end` with step :attr:`step`. Step is +the gap between two values in the tensor. + +.. math:: + \text{out}_{i+1} = \text{out}_i + \text{step}. +""" + + r""" +.. warning:: + This function is deprecated and will be removed in a future release because its behavior is inconsistent with + Python's range builtin. Instead, use :func:`torch.arange`, which produces values in [start, end). + +Args: + start (float, optional): the starting value for the set of points. Default: ``0``. + end (float): the ending value for the set of points + step (float, optional): the gap between each pair of adjacent points. Default: ``1``. + +Keyword args: + {out} + {dtype} If `dtype` is not given, infer the data type from the other input + arguments. If any of `start`, `end`, or `step` are floating-point, the + `dtype` is inferred to be the default dtype, see + :meth:`~torch.get_default_dtype`. Otherwise, the `dtype` is inferred to + be `torch.int64`. + {layout} + {device} + {requires_grad} + +Example:: + + >>> torch.range(1, 4) + tensor([ 1., 2., 3., 4.]) + >>> torch.range(1, 4, 0.5) + tensor([ 1.0000, 1.5000, 2.0000, 2.5000, 3.0000, 3.5000, 4.0000]) +""".format(**factory_common_args), +) + +add_docstr( + torch.arange, + r""" +arange(start=0, end, step=1, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + +Returns a 1-D tensor of size :math:`\left\lceil \frac{\text{end} - \text{start}}{\text{step}} \right\rceil` +with values from the interval ``[start, end)`` taken with common difference +:attr:`step` beginning from `start`. + +Note: When using floating-point dtypes (especially reduced precision types like ``bfloat16``), +the results may be affected by floating-point rounding behavior. Some values in the sequence +might not be exactly representable in certain floating-point formats, which can lead to +repeated values or unexpected rounding. For precise sequences, it is recommended to use +integer dtypes instead of floating-point dtypes. + +Note that non-integer :attr:`step` is subject to floating point rounding errors when +comparing against :attr:`end`; to avoid inconsistency, we advise subtracting a small epsilon from :attr:`end` +in such cases. + +.. math:: + \text{out}_{{i+1}} = \text{out}_{i} + \text{step} +""" + + r""" +Args: + start (Number, optional): the starting value for the set of points. Default: ``0``. + end (Number): the ending value for the set of points + step (Number, optional): the gap between each pair of adjacent points. Default: ``1``. + +Keyword args: + {out} + {dtype} If `dtype` is not given, infer the data type from the other input + arguments. If any of `start`, `end`, or `stop` are floating-point, the + `dtype` is inferred to be the default dtype, see + :meth:`~torch.get_default_dtype`. Otherwise, the `dtype` is inferred to + be `torch.int64`. + {layout} + {device} + {requires_grad} + +Example:: + + >>> torch.arange(5) + tensor([ 0, 1, 2, 3, 4]) + >>> torch.arange(1, 4) + tensor([ 1, 2, 3]) + >>> torch.arange(1, 2.5, 0.5) + tensor([ 1.0000, 1.5000, 2.0000]) +""".format(**factory_common_args), +) + +add_docstr( + torch.ravel, + r""" +ravel(input) -> Tensor + +Return a contiguous flattened tensor. A copy is made only if needed. + +Args: + {input} + +Example:: + + >>> t = torch.tensor([[[1, 2], + ... [3, 4]], + ... [[5, 6], + ... [7, 8]]]) + >>> torch.ravel(t) + tensor([1, 2, 3, 4, 5, 6, 7, 8]) +""".format(**common_args), +) + +add_docstr( + torch.remainder, + r""" +remainder(input, other, *, out=None) -> Tensor + +Computes +`Python's modulus operation `_ +entrywise. The result has the same sign as the divisor :attr:`other` and its absolute value +is less than that of :attr:`other`. + +It may also be defined in terms of :func:`torch.div` as + +.. code:: python + + torch.remainder(a, b) == a - a.div(b, rounding_mode="floor") * b + +Supports :ref:`broadcasting to a common shape `, +:ref:`type promotion `, and integer and float inputs. + +.. note:: + Complex inputs are not supported. In some cases, it is not mathematically + possible to satisfy the definition of a modulo operation with complex numbers. + See :func:`torch.fmod` for how division by zero is handled. + +.. seealso:: + + :func:`torch.fmod` which implements C++'s `std::fmod `_. + This one is defined in terms of division rounding towards zero. + +Args: + input (Tensor or Scalar): the dividend + other (Tensor or Scalar): the divisor + +Keyword args: + {out} + +Example:: + + >>> torch.remainder(torch.tensor([-3., -2, -1, 1, 2, 3]), 2) + tensor([ 1., 0., 1., 1., 0., 1.]) + >>> torch.remainder(torch.tensor([1, 2, 3, 4, 5]), -1.5) + tensor([ -0.5000, -1.0000, 0.0000, -0.5000, -1.0000 ]) +""".format(**common_args), +) + +add_docstr( + torch.renorm, + r""" +renorm(input, p, dim, maxnorm, *, out=None) -> Tensor + +Returns a tensor where each sub-tensor of :attr:`input` along dimension +:attr:`dim` is normalized such that the `p`-norm of the sub-tensor is lower +than the value :attr:`maxnorm` + +.. note:: If the norm of a row is lower than `maxnorm`, the row is unchanged + +Args: + {input} + p (float): the power for the norm computation + dim (int): the dimension to slice over to get the sub-tensors + maxnorm (float): the maximum norm to keep each sub-tensor under + +Keyword args: + {out} + +Example:: + + >>> x = torch.ones(3, 3) + >>> x[1].fill_(2) + tensor([ 2., 2., 2.]) + >>> x[2].fill_(3) + tensor([ 3., 3., 3.]) + >>> x + tensor([[ 1., 1., 1.], + [ 2., 2., 2.], + [ 3., 3., 3.]]) + >>> torch.renorm(x, 1, 0, 5) + tensor([[ 1.0000, 1.0000, 1.0000], + [ 1.6667, 1.6667, 1.6667], + [ 1.6667, 1.6667, 1.6667]]) +""".format(**common_args), +) + +add_docstr( + torch.reshape, + r""" +reshape(input, shape) -> Tensor + +Returns a tensor with the same data and number of elements as :attr:`input`, +but with the specified shape. When possible, the returned tensor will be a view +of :attr:`input`. Otherwise, it will be a copy. Contiguous inputs and inputs +with compatible strides can be reshaped without copying, but you should not +depend on the copying vs. viewing behavior. + +See :meth:`torch.Tensor.view` on when it is possible to return a view. + +A single dimension may be -1, in which case it's inferred from the remaining +dimensions and the number of elements in :attr:`input`. + +Args: + input (Tensor): the tensor to be reshaped + shape (tuple of int): the new shape + +Example:: + + >>> a = torch.arange(4.) + >>> torch.reshape(a, (2, 2)) + tensor([[ 0., 1.], + [ 2., 3.]]) + >>> b = torch.tensor([[0, 1], [2, 3]]) + >>> torch.reshape(b, (-1,)) + tensor([ 0, 1, 2, 3]) +""", +) + + +add_docstr( + torch.result_type, + r""" +result_type(tensor1, tensor2) -> dtype + +Returns the :class:`torch.dtype` that would result from performing an arithmetic +operation on the provided input tensors. See type promotion :ref:`documentation ` +for more information on the type promotion logic. + +Args: + tensor1 (Tensor or Number): an input tensor or number + tensor2 (Tensor or Number): an input tensor or number + +Example:: + + >>> torch.result_type(torch.tensor([1, 2], dtype=torch.int), 1.0) + torch.float32 + >>> torch.result_type(torch.tensor([1, 2], dtype=torch.uint8), torch.tensor(1)) + torch.uint8 +""", +) + +add_docstr( + torch.row_stack, + r""" +row_stack(tensors, *, out=None) -> Tensor + +Alias of :func:`torch.vstack`. +""", +) + +add_docstr( + torch.round, + r""" +round(input, *, decimals=0, out=None) -> Tensor + +Rounds elements of :attr:`input` to the nearest integer. + +For integer inputs, follows the array-api convention of returning a +copy of the input tensor. +The return type of output is same as that of input's dtype. + +.. note:: + This function implements the "round half to even" to + break ties when a number is equidistant from two + integers (e.g. `round(2.5)` is 2). + + When the :attr:\`decimals\` argument is specified the + algorithm used is similar to NumPy's `around`. This + algorithm is fast but inexact and it can easily + overflow for low precision dtypes. + Eg. `round(tensor([10000], dtype=torch.float16), decimals=3)` is `inf`. + +.. seealso:: + :func:`torch.ceil`, which rounds up. + :func:`torch.floor`, which rounds down. + :func:`torch.trunc`, which rounds towards zero. + +Args: + {input} + decimals (int): Number of decimal places to round to (default: 0). + If decimals is negative, it specifies the number of positions + to the left of the decimal point. + +Keyword args: + {out} + +Example:: + + >>> torch.round(torch.tensor((4.7, -2.3, 9.1, -7.7))) + tensor([ 5., -2., 9., -8.]) + + >>> # Values equidistant from two integers are rounded towards the + >>> # the nearest even value (zero is treated as even) + >>> torch.round(torch.tensor([-0.5, 0.5, 1.5, 2.5])) + tensor([-0., 0., 2., 2.]) + + >>> # A positive decimals argument rounds to the to that decimal place + >>> torch.round(torch.tensor([0.1234567]), decimals=3) + tensor([0.1230]) + + >>> # A negative decimals argument rounds to the left of the decimal + >>> torch.round(torch.tensor([1200.1234567]), decimals=-3) + tensor([1000.]) +""".format(**common_args), +) + +add_docstr( + torch.rsqrt, + r""" +rsqrt(input, *, out=None) -> Tensor + +Returns a new tensor with the reciprocal of the square-root of each of +the elements of :attr:`input`. + +.. math:: + \text{out}_{i} = \frac{1}{\sqrt{\text{input}_{i}}} +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-0.0370, 0.2970, 1.5420, -0.9105]) + >>> torch.rsqrt(a) + tensor([ nan, 1.8351, 0.8053, nan]) +""".format(**common_args), +) + +add_docstr( + torch.scatter, + r""" +scatter(input, dim, index, src) -> Tensor + +Out-of-place version of :meth:`torch.Tensor.scatter_` +""", +) + +add_docstr( + torch.scatter_add, + r""" +scatter_add(input, dim, index, src) -> Tensor + +Out-of-place version of :meth:`torch.Tensor.scatter_add_` +""", +) + +add_docstr( + torch.scatter_reduce, + r""" +scatter_reduce(input, dim, index, src, reduce, *, include_self=True) -> Tensor + +Out-of-place version of :meth:`torch.Tensor.scatter_reduce_` +""", +) + +add_docstr( + torch.segment_reduce, + r""" +segment_reduce(data: Tensor, reduce: str, *, lengths: Tensor | None = None, indices: Tensor | None = None, offsets: Tensor | None = None, axis: _int = 0, unsafe: _bool = False, initial: Number | _complex | None = None) -> Tensor # noqa: B950 + +Perform a segment reduction operation on the input tensor along the specified axis. + +Args: + data (Tensor): The input tensor on which the segment reduction operation will be performed. + reduce (str): The type of reduction operation. Supported values are ``sum``, ``mean``, ``max``, ``min``, ``prod``. + +Keyword args: + lengths (Tensor, optional): Length of each segment. Default: ``None``. + offsets (Tensor, optional): Offset of each segment. Default: ``None``. + axis (int, optional): The axis perform reduction. Default: ``0``. + unsafe (bool, optional): Skip validation If `True`. Default: ``False``. + initial (Number, optional): The initial value for the reduction operation. Default: ``None``. + +Example:: + + >>> data = torch.tensor([[1, 2, 3, 4],[5, 6, 7, 8],[9, 10, 11, 12]], dtype=torch.float32, device='cuda') + >>> lengths = torch.tensor([2, 1], device='cuda') + >>> torch.segment_reduce(data, 'max', lengths=lengths) + tensor([[ 5., 6., 7., 8.], + [ 9., 10., 11., 12.]], device='cuda:0') +""", +) + +add_docstr( + torch.select, + r""" +select(input, dim, index) -> Tensor + +Slices the :attr:`input` tensor along the selected dimension at the given index. +This function returns a view of the original tensor with the given dimension removed. + +.. note:: If :attr:`input` is a sparse tensor and returning a view of + the tensor is not possible, a RuntimeError exception is + raised. In this is the case, consider using + :func:`torch.select_copy` function. + +Args: + {input} + dim (int): the dimension to slice + index (int): the index to select with + +.. note:: + + :meth:`select` is equivalent to slicing. For example, + ``tensor.select(0, index)`` is equivalent to ``tensor[index]`` and + ``tensor.select(2, index)`` is equivalent to ``tensor[:,:,index]``. +""".format(**common_args), +) + +add_docstr( + torch.select_scatter, + r""" +select_scatter(input, src, dim, index) -> Tensor + +Embeds the values of the :attr:`src` tensor into :attr:`input` at the given index. +This function returns a tensor with fresh storage; it does not create a view. + + +Args: + {input} + src (Tensor): The tensor to embed into :attr:`input` + dim (int): the dimension to insert the slice into. + index (int): the index to select with + +.. note:: + + :attr:`src` must be of the proper size in order to be embedded + into :attr:`input`. Specifically, it should have the same shape as + ``torch.select(input, dim, index)`` + +Example:: + + >>> a = torch.zeros(2, 2) + >>> b = torch.ones(2) + >>> a.select_scatter(b, 0, 0) + tensor([[1., 1.], + [0., 0.]]) +""".format(**common_args), +) + +add_docstr( + torch.slice_scatter, + r""" +slice_scatter(input, src, dim=0, start=None, end=None, step=1) -> Tensor + +Embeds the values of the :attr:`src` tensor into :attr:`input` at the given +dimension. +This function returns a tensor with fresh storage; it does not create a view. + + +Args: + {input} + src (Tensor): The tensor to embed into :attr:`input` + dim (int): the dimension to insert the slice into + start (Optional[int]): the start index of where to insert the slice + end (Optional[int]): the end index of where to insert the slice + step (int): the how many elements to skip in + +Example:: + + >>> a = torch.zeros(8, 8) + >>> b = torch.ones(2, 8) + >>> a.slice_scatter(b, start=6) + tensor([[0., 0., 0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0., 0., 0.], + [1., 1., 1., 1., 1., 1., 1., 1.], + [1., 1., 1., 1., 1., 1., 1., 1.]]) + + >>> b = torch.ones(8, 2) + >>> a.slice_scatter(b, dim=1, start=2, end=6, step=2) + tensor([[0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.], + [0., 0., 1., 0., 1., 0., 0., 0.]]) +""".format(**common_args), +) + +add_docstr( + torch.set_flush_denormal, + r""" +set_flush_denormal(mode) -> bool + +Disables denormal floating numbers on CPU. + +Returns ``True`` if your system supports flushing denormal numbers and it +successfully configures flush denormal mode. :meth:`~torch.set_flush_denormal` +is supported on x86 architectures supporting SSE3 and AArch64 architecture. + +Args: + mode (bool): Controls whether to enable flush denormal mode or not + +Example:: + + >>> torch.set_flush_denormal(True) + True + >>> torch.tensor([1e-323], dtype=torch.float64) + tensor([ 0.], dtype=torch.float64) + >>> torch.set_flush_denormal(False) + True + >>> torch.tensor([1e-323], dtype=torch.float64) + tensor(9.88131e-324 * + [ 1.0000], dtype=torch.float64) +""", +) + +add_docstr( + torch.set_num_threads, + r""" +set_num_threads(int) + +Sets the number of threads used for intraop parallelism on CPU. + +.. warning:: + To ensure that the correct number of threads is used, set_num_threads + must be called before running eager, JIT or autograd code. +""", +) + +add_docstr( + torch.set_num_interop_threads, + r""" +set_num_interop_threads(int) + +Sets the number of threads used for interop parallelism +(e.g. in JIT interpreter) on CPU. + +.. warning:: + Can only be called once and before any inter-op parallel work + is started (e.g. JIT execution). +""", +) + +add_docstr( + torch.sigmoid, + r""" +sigmoid(input, *, out=None) -> Tensor + +Alias for :func:`torch.special.expit`. +""", +) + +add_docstr( + torch.logit, + r""" +logit(input, eps=None, *, out=None) -> Tensor + +Alias for :func:`torch.special.logit`. +""", +) + +add_docstr( + torch.sign, + r""" +sign(input, *, out=None) -> Tensor + +Returns a new tensor with the signs of the elements of :attr:`input`. + +.. math:: + \text{out}_{i} = \operatorname{sgn}(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor([0.7, -1.2, 0., 2.3]) + >>> a + tensor([ 0.7000, -1.2000, 0.0000, 2.3000]) + >>> torch.sign(a) + tensor([ 1., -1., 0., 1.]) +""".format(**common_args), +) + +add_docstr( + torch.signbit, + r""" +signbit(input, *, out=None) -> Tensor + +Tests if each element of :attr:`input` has its sign bit set or not. + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.tensor([0.7, -1.2, 0., 2.3]) + >>> torch.signbit(a) + tensor([ False, True, False, False]) + >>> a = torch.tensor([-0.0, 0.0]) + >>> torch.signbit(a) + tensor([ True, False]) + +.. note:: + signbit handles signed zeros, so negative zero (-0) returns True. + +""".format(**common_args), +) + +add_docstr( + torch.sgn, + r""" +sgn(input, *, out=None) -> Tensor + +This function is an extension of torch.sign() to complex tensors. +It computes a new tensor whose elements have +the same angles as the corresponding elements of :attr:`input` and +absolute values (i.e. magnitudes) of one for complex tensors and +is equivalent to torch.sign() for non-complex tensors. + +.. math:: + \text{out}_{i} = \begin{cases} + 0 & |\text{{input}}_i| == 0 \\ + \frac{{\text{{input}}_i}}{|{\text{{input}}_i}|} & \text{otherwise} + \end{cases} + +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> t = torch.tensor([3+4j, 7-24j, 0, 1+2j]) + >>> t.sgn() + tensor([0.6000+0.8000j, 0.2800-0.9600j, 0.0000+0.0000j, 0.4472+0.8944j]) +""".format(**common_args), +) + +add_docstr( + torch.sin, + r""" +sin(input, *, out=None) -> Tensor + +Returns a new tensor with the sine of the elements in the :attr:`input` tensor, +where each value in this input tensor is in radians. + +.. math:: + \text{out}_{i} = \sin(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-0.5461, 0.1347, -2.7266, -0.2746]) + >>> torch.sin(a) + tensor([-0.5194, 0.1343, -0.4032, -0.2711]) +""".format(**common_args), +) + +add_docstr( + torch.sinc, + r""" +sinc(input, *, out=None) -> Tensor + +Alias for :func:`torch.special.sinc`. +""", +) + +add_docstr( + torch.sinh, + r""" +sinh(input, *, out=None) -> Tensor + +Returns a new tensor with the hyperbolic sine of the elements of +:attr:`input`. + +.. math:: + \text{out}_{i} = \sinh(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.5380, -0.8632, -0.1265, 0.9399]) + >>> torch.sinh(a) + tensor([ 0.5644, -0.9744, -0.1268, 1.0845]) + +.. note:: + When :attr:`input` is on the CPU, the implementation of torch.sinh may use + the Sleef library, which rounds very large results to infinity or negative + infinity. See `here `_ for details. +""".format(**common_args), +) + +add_docstr( + torch.sort, + r""" +sort(input, dim=-1, descending=False, *, stable=False, out=None) -> (Tensor, LongTensor) + +Sorts the elements of the :attr:`input` tensor along a given dimension +in ascending order by value. + +If :attr:`dim` is not given, the last dimension of the `input` is chosen. + +If :attr:`descending` is ``True`` then the elements are sorted in descending +order by value. + +If :attr:`stable` is ``True`` then the sorting routine becomes stable, preserving +the order of equivalent elements. + +A namedtuple of (values, indices) is returned, where the `values` are the +sorted values and `indices` are the indices of the elements in the original +`input` tensor. + +Args: + {input} + dim (int, optional): the dimension to sort along + descending (bool, optional): controls the sorting order (ascending or descending) + +Keyword args: + stable (bool, optional): makes the sorting routine stable, which guarantees that the order + of equivalent elements is preserved. + out (tuple, optional): the output tuple of (`Tensor`, `LongTensor`) that can + be optionally given to be used as output buffers + +Example:: + + >>> x = torch.randn(3, 4) + >>> sorted, indices = torch.sort(x) + >>> sorted + tensor([[-0.2162, 0.0608, 0.6719, 2.3332], + [-0.5793, 0.0061, 0.6058, 0.9497], + [-0.5071, 0.3343, 0.9553, 1.0960]]) + >>> indices + tensor([[ 1, 0, 2, 3], + [ 3, 1, 0, 2], + [ 0, 3, 1, 2]]) + + >>> sorted, indices = torch.sort(x, 0) + >>> sorted + tensor([[-0.5071, -0.2162, 0.6719, -0.5793], + [ 0.0608, 0.0061, 0.9497, 0.3343], + [ 0.6058, 0.9553, 1.0960, 2.3332]]) + >>> indices + tensor([[ 2, 0, 0, 1], + [ 0, 1, 1, 2], + [ 1, 2, 2, 0]]) + >>> x = torch.tensor([0, 1] * 9) + >>> x.sort() + torch.return_types.sort( + values=tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]), + indices=tensor([ 2, 16, 4, 6, 14, 8, 0, 10, 12, 9, 17, 15, 13, 11, 7, 5, 3, 1])) + >>> x.sort(stable=True) + torch.return_types.sort( + values=tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]), + indices=tensor([ 0, 2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15, 17])) +""".format(**common_args), +) + +add_docstr( + torch.argsort, + r""" +argsort(input, dim=-1, descending=False, *, stable=False) -> Tensor + +Returns the indices that sort a tensor along a given dimension in ascending +order by value. + +This is the second value returned by :meth:`torch.sort`. See its documentation +for the exact semantics of this method. + +If :attr:`stable` is ``True`` then the sorting routine becomes stable, preserving +the order of equivalent elements. If ``False``, the relative order of values +which compare equal is not guaranteed. ``True`` is slower. + +Args: + {input} + dim (int, optional): the dimension to sort along + descending (bool, optional): controls the sorting order (ascending or descending) + +Keyword args: + stable (bool, optional): controls the relative order of equivalent elements + +Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.0785, 1.5267, -0.8521, 0.4065], + [ 0.1598, 0.0788, -0.0745, -1.2700], + [ 1.2208, 1.0722, -0.7064, 1.2564], + [ 0.0669, -0.2318, -0.8229, -0.9280]]) + + + >>> torch.argsort(a, dim=1) + tensor([[2, 0, 3, 1], + [3, 2, 1, 0], + [2, 1, 0, 3], + [3, 2, 1, 0]]) +""".format(**common_args), +) + +add_docstr( + torch.msort, + r""" +msort(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Sorts the elements of the :attr:`input` tensor along its first dimension +in ascending order by value. + +.. note:: `torch.msort(t)` is equivalent to `torch.sort(t, dim=0)[0]`. + See also :func:`torch.sort`. + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> t = torch.randn(3, 4) + >>> t + tensor([[-0.1321, 0.4370, -1.2631, -1.1289], + [-2.0527, -1.1250, 0.2275, 0.3077], + [-0.0881, -0.1259, -0.5495, 1.0284]]) + >>> torch.msort(t) + tensor([[-2.0527, -1.1250, -1.2631, -1.1289], + [-0.1321, -0.1259, -0.5495, 0.3077], + [-0.0881, 0.4370, 0.2275, 1.0284]]) +""".format(**common_args), +) + +add_docstr( + torch.sparse_compressed_tensor, + r"""sparse_compressed_tensor(compressed_indices, plain_indices, values, size=None, """ + r"""*, dtype=None, layout=None, device=None, pin_memory=False, requires_grad=False, check_invariants=None) -> Tensor + +Constructs a :ref:`sparse tensor in Compressed Sparse format - CSR, +CSC, BSR, or BSC - ` with specified values at +the given :attr:`compressed_indices` and :attr:`plain_indices`. Sparse +matrix multiplication operations in Compressed Sparse format are +typically faster than that for sparse tensors in COO format. Make you +have a look at :ref:`the note on the data type of the indices +`. + +{sparse_factory_device_note} + +Args: + compressed_indices (array_like): (B+1)-dimensional array of size + ``(*batchsize, compressed_dim_size + 1)``. The last element of + each batch is the number of non-zero elements or blocks. This + tensor encodes the index in ``values`` and ``plain_indices`` + depending on where the given compressed dimension (row or + column) starts. Each successive number in the tensor + subtracted by the number before it denotes the number of + elements or blocks in a given compressed dimension. + plain_indices (array_like): Plain dimension (column or row) + coordinates of each element or block in values. (B+1)-dimensional + tensor with the same length as values. + + values (array_list): Initial values for the tensor. Can be a list, + tuple, NumPy ``ndarray``, scalar, and other types. that + represents a (1+K)-dimensional (for CSR and CSC layouts) or + (1+2+K)-dimensional tensor (for BSR and BSC layouts) where + ``K`` is the number of dense dimensions. + size (list, tuple, :class:`torch.Size`, optional): Size of the + sparse tensor: ``(*batchsize, nrows * blocksize[0], ncols * + blocksize[1], *densesize)`` where ``blocksize[0] == + blocksize[1] == 1`` for CSR and CSC formats. If not provided, + the size will be inferred as the minimum size big enough to + hold all non-zero elements or blocks. + +Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of + returned tensor. Default: if None, infers data type from + :attr:`values`. + layout (:class:`torch.layout`, required): the desired layout of + returned tensor: :attr:`torch.sparse_csr`, + :attr:`torch.sparse_csc`, :attr:`torch.sparse_bsr`, or + :attr:`torch.sparse_bsc`. + device (:class:`torch.device`, optional): the desired device of + returned tensor. Default: if None, uses the current device + for the default tensor type (see + :func:`torch.set_default_device`). :attr:`device` will be + the CPU for CPU tensor types and the current CUDA device for + CUDA tensor types. + {pin_memory} + {requires_grad} + {check_invariants} + +Example:: + + >>> compressed_indices = [0, 2, 4] + >>> plain_indices = [0, 1, 0, 1] + >>> values = [1, 2, 3, 4] + >>> torch.sparse_compressed_tensor(torch.tensor(compressed_indices, dtype=torch.int64), + ... torch.tensor(plain_indices, dtype=torch.int64), + ... torch.tensor(values), dtype=torch.double, layout=torch.sparse_csr) + tensor(crow_indices=tensor([0, 2, 4]), + col_indices=tensor([0, 1, 0, 1]), + values=tensor([1., 2., 3., 4.]), size=(2, 2), nnz=4, + dtype=torch.float64, layout=torch.sparse_csr) +""".format(**factory_common_args), +) + +add_docstr( + torch.sparse_csr_tensor, + r"""sparse_csr_tensor(crow_indices, col_indices, values, size=None, """ + r"""*, dtype=None, device=None, pin_memory=False, requires_grad=False, check_invariants=None) -> Tensor + +Constructs a :ref:`sparse tensor in CSR (Compressed Sparse Row) ` with specified +values at the given :attr:`crow_indices` and :attr:`col_indices`. Sparse matrix multiplication operations +in CSR format are typically faster than that for sparse tensors in COO format. Make you have a look +at :ref:`the note on the data type of the indices `. + +{sparse_factory_device_note} + +Args: + crow_indices (array_like): (B+1)-dimensional array of size + ``(*batchsize, nrows + 1)``. The last element of each batch + is the number of non-zeros. This tensor encodes the index in + values and col_indices depending on where the given row + starts. Each successive number in the tensor subtracted by the + number before it denotes the number of elements in a given + row. + col_indices (array_like): Column coordinates of each element in + values. (B+1)-dimensional tensor with the same length + as values. + values (array_list): Initial values for the tensor. Can be a list, + tuple, NumPy ``ndarray``, scalar, and other types that + represents a (1+K)-dimensional tensor where ``K`` is the number + of dense dimensions. + size (list, tuple, :class:`torch.Size`, optional): Size of the + sparse tensor: ``(*batchsize, nrows, ncols, *densesize)``. If + not provided, the size will be inferred as the minimum size + big enough to hold all non-zero elements. + +Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of + returned tensor. Default: if None, infers data type from + :attr:`values`. + device (:class:`torch.device`, optional): the desired device of + returned tensor. Default: if None, uses the current device + for the default tensor type (see + :func:`torch.set_default_device`). :attr:`device` will be + the CPU for CPU tensor types and the current CUDA device for + CUDA tensor types. + {pin_memory} + {requires_grad} + {check_invariants} + +Example:: + + >>> crow_indices = [0, 2, 4] + >>> col_indices = [0, 1, 0, 1] + >>> values = [1, 2, 3, 4] + >>> torch.sparse_csr_tensor(torch.tensor(crow_indices, dtype=torch.int64), + ... torch.tensor(col_indices, dtype=torch.int64), + ... torch.tensor(values), dtype=torch.double) + tensor(crow_indices=tensor([0, 2, 4]), + col_indices=tensor([0, 1, 0, 1]), + values=tensor([1., 2., 3., 4.]), size=(2, 2), nnz=4, + dtype=torch.float64, layout=torch.sparse_csr) +""".format(**factory_common_args), +) + +add_docstr( + torch.sparse_csc_tensor, + r"""sparse_csc_tensor(ccol_indices, row_indices, values, size=None, """ + r"""*, dtype=None, device=None, pin_memory=False, requires_grad=False, check_invariants=None) -> Tensor + +Constructs a :ref:`sparse tensor in CSC (Compressed Sparse Column) +` with specified values at the given +:attr:`ccol_indices` and :attr:`row_indices`. Sparse matrix +multiplication operations in CSC format are typically faster than that +for sparse tensors in COO format. Make you have a look at :ref:`the +note on the data type of the indices `. + +{sparse_factory_device_note} + +Args: + ccol_indices (array_like): (B+1)-dimensional array of size + ``(*batchsize, ncols + 1)``. The last element of each batch + is the number of non-zeros. This tensor encodes the index in + values and row_indices depending on where the given column + starts. Each successive number in the tensor subtracted by the + number before it denotes the number of elements in a given + column. + row_indices (array_like): Row coordinates of each element in + values. (B+1)-dimensional tensor with the same length as + values. + values (array_list): Initial values for the tensor. Can be a list, + tuple, NumPy ``ndarray``, scalar, and other types that + represents a (1+K)-dimensional tensor where ``K`` is the number + of dense dimensions. + size (list, tuple, :class:`torch.Size`, optional): Size of the + sparse tensor: ``(*batchsize, nrows, ncols, *densesize)``. If + not provided, the size will be inferred as the minimum size + big enough to hold all non-zero elements. + +Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of + returned tensor. Default: if None, infers data type from + :attr:`values`. + device (:class:`torch.device`, optional): the desired device of + returned tensor. Default: if None, uses the current device + for the default tensor type (see + :func:`torch.set_default_device`). :attr:`device` will be + the CPU for CPU tensor types and the current CUDA device for + CUDA tensor types. + {pin_memory} + {requires_grad} + {check_invariants} + +Example:: + + >>> ccol_indices = [0, 2, 4] + >>> row_indices = [0, 1, 0, 1] + >>> values = [1, 2, 3, 4] + >>> torch.sparse_csc_tensor(torch.tensor(ccol_indices, dtype=torch.int64), + ... torch.tensor(row_indices, dtype=torch.int64), + ... torch.tensor(values), dtype=torch.double) + tensor(ccol_indices=tensor([0, 2, 4]), + row_indices=tensor([0, 1, 0, 1]), + values=tensor([1., 2., 3., 4.]), size=(2, 2), nnz=4, + dtype=torch.float64, layout=torch.sparse_csc) +""".format(**factory_common_args), +) + +add_docstr( + torch.sparse_bsr_tensor, + r"""sparse_bsr_tensor(crow_indices, col_indices, values, size=None, """ + r"""*, dtype=None, device=None, pin_memory=False, requires_grad=False, check_invariants=None) -> Tensor + +Constructs a :ref:`sparse tensor in BSR (Block Compressed Sparse Row)) +` with specified 2-dimensional blocks at the given +:attr:`crow_indices` and :attr:`col_indices`. Sparse matrix +multiplication operations in BSR format are typically faster than that +for sparse tensors in COO format. Make you have a look at :ref:`the +note on the data type of the indices `. + +{sparse_factory_device_note} + +Args: + crow_indices (array_like): (B+1)-dimensional array of size + ``(*batchsize, nrowblocks + 1)``. The last element of each + batch is the number of non-zeros. This tensor encodes the + block index in values and col_indices depending on where the + given row block starts. Each successive number in the tensor + subtracted by the number before it denotes the number of + blocks in a given row. + col_indices (array_like): Column block coordinates of each block + in values. (B+1)-dimensional tensor with the same length as + values. + values (array_list): Initial values for the tensor. Can be a list, + tuple, NumPy ``ndarray``, scalar, and other types that + represents a (1 + 2 + K)-dimensional tensor where ``K`` is the + number of dense dimensions. + size (list, tuple, :class:`torch.Size`, optional): Size of the + sparse tensor: ``(*batchsize, nrows * blocksize[0], ncols * + blocksize[1], *densesize)`` where ``blocksize == + values.shape[1:3]``. If not provided, the size will be + inferred as the minimum size big enough to hold all non-zero + blocks. + +Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of + returned tensor. Default: if None, infers data type from + :attr:`values`. + device (:class:`torch.device`, optional): the desired device of + returned tensor. Default: if None, uses the current device + for the default tensor type (see + :func:`torch.set_default_device`). :attr:`device` will be + the CPU for CPU tensor types and the current CUDA device for + CUDA tensor types. + {pin_memory} + {requires_grad} + {check_invariants} + +Example:: + + >>> crow_indices = [0, 1, 2] + >>> col_indices = [0, 1] + >>> values = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] + >>> torch.sparse_bsr_tensor(torch.tensor(crow_indices, dtype=torch.int64), + ... torch.tensor(col_indices, dtype=torch.int64), + ... torch.tensor(values), dtype=torch.double) + tensor(crow_indices=tensor([0, 1, 2]), + col_indices=tensor([0, 1]), + values=tensor([[[1., 2.], + [3., 4.]], + [[5., 6.], + [7., 8.]]]), size=(2, 2), nnz=2, dtype=torch.float64, + layout=torch.sparse_bsr) +""".format(**factory_common_args), +) + +add_docstr( + torch.sparse_bsc_tensor, + r"""sparse_bsc_tensor(ccol_indices, row_indices, values, size=None, """ + r"""*, dtype=None, device=None, pin_memory=False, requires_grad=False, check_invariants=None) -> Tensor + +Constructs a :ref:`sparse tensor in BSC (Block Compressed Sparse +Column)) ` with specified 2-dimensional blocks at the +given :attr:`ccol_indices` and :attr:`row_indices`. Sparse matrix +multiplication operations in BSC format are typically faster than that +for sparse tensors in COO format. Make you have a look at :ref:`the +note on the data type of the indices `. + +{sparse_factory_device_note} + +Args: + ccol_indices (array_like): (B+1)-dimensional array of size + ``(*batchsize, ncolblocks + 1)``. The last element of each + batch is the number of non-zeros. This tensor encodes the + index in values and row_indices depending on where the given + column starts. Each successive number in the tensor subtracted + by the number before it denotes the number of elements in a + given column. + row_indices (array_like): Row block coordinates of each block in + values. (B+1)-dimensional tensor with the same length + as values. + values (array_list): Initial blocks for the tensor. Can be a list, + tuple, NumPy ``ndarray``, and other types that + represents a (1 + 2 + K)-dimensional tensor where ``K`` is the + number of dense dimensions. + size (list, tuple, :class:`torch.Size`, optional): Size of the + sparse tensor: ``(*batchsize, nrows * blocksize[0], ncols * + blocksize[1], *densesize)`` If not provided, the size will be + inferred as the minimum size big enough to hold all non-zero + blocks. + +Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of + returned tensor. Default: if None, infers data type from + :attr:`values`. + device (:class:`torch.device`, optional): the desired device of + returned tensor. Default: if None, uses the current device + for the default tensor type (see + :func:`torch.set_default_device`). :attr:`device` will be + the CPU for CPU tensor types and the current CUDA device for + CUDA tensor types. + {pin_memory} + {requires_grad} + {check_invariants} + +Example:: + + >>> ccol_indices = [0, 1, 2] + >>> row_indices = [0, 1] + >>> values = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] + >>> torch.sparse_bsc_tensor(torch.tensor(ccol_indices, dtype=torch.int64), + ... torch.tensor(row_indices, dtype=torch.int64), + ... torch.tensor(values), dtype=torch.double) + tensor(ccol_indices=tensor([0, 1, 2]), + row_indices=tensor([0, 1]), + values=tensor([[[1., 2.], + [3., 4.]], + [[5., 6.], + [7., 8.]]]), size=(2, 2), nnz=2, dtype=torch.float64, + layout=torch.sparse_bsc) +""".format(**factory_common_args), +) + +add_docstr( + torch.sparse_coo_tensor, + r"""sparse_coo_tensor(indices, values, size=None, """ + r"""*, dtype=None, device=None, pin_memory=False, requires_grad=False, check_invariants=None, is_coalesced=None) -> Tensor + +Constructs a :ref:`sparse tensor in COO(rdinate) format +` with specified values at the given +:attr:`indices`. + +.. note:: + + This function returns an :ref:`uncoalesced tensor + ` when :attr:`is_coalesced` is + unspecified or ``None``. + +{sparse_factory_device_note} + +Args: + indices (array_like): Initial data for the tensor. Can be a list, tuple, + NumPy ``ndarray``, scalar, and other types. Will be cast to a :class:`torch.LongTensor` + internally. The indices are the coordinates of the non-zero values in the matrix, and thus + should be two-dimensional where the first dimension is the number of tensor dimensions and + the second dimension is the number of non-zero values. + values (array_like): Initial values for the tensor. Can be a list, tuple, + NumPy ``ndarray``, scalar, and other types. + size (list, tuple, or :class:`torch.Size`, optional): Size of the sparse tensor. If not + provided the size will be inferred as the minimum size big enough to hold all non-zero + elements. + +Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor. + Default: if None, infers data type from :attr:`values`. + device (:class:`torch.device`, optional): the desired device of returned tensor. + Default: if None, uses the current device for the default tensor type + (see :func:`torch.set_default_device`). :attr:`device` will be the CPU + for CPU tensor types and the current CUDA device for CUDA tensor types. + {pin_memory} + {requires_grad} + {check_invariants} + is_coalesced (bool, optional): When``True``, the caller is + responsible for providing tensor indices that correspond to a + coalesced tensor. If the :attr:`check_invariants` flag is + False, no error will be raised if the prerequisites are not + met and this will lead to silently incorrect results. To force + coalescion please use :meth:`coalesce` on the resulting + Tensor. + Default: None: except for trivial cases (e.g. nnz < 2) the + resulting Tensor has is_coalesced set to ``False```. + +Example:: + + >>> i = torch.tensor([[0, 1, 1], + ... [2, 0, 2]]) + >>> v = torch.tensor([3, 4, 5], dtype=torch.float32) + >>> torch.sparse_coo_tensor(i, v, [2, 4]) + tensor(indices=tensor([[0, 1, 1], + [2, 0, 2]]), + values=tensor([3., 4., 5.]), + size=(2, 4), nnz=3, layout=torch.sparse_coo) + + >>> torch.sparse_coo_tensor(i, v) # Shape inference + tensor(indices=tensor([[0, 1, 1], + [2, 0, 2]]), + values=tensor([3., 4., 5.]), + size=(2, 3), nnz=3, layout=torch.sparse_coo) + + >>> torch.sparse_coo_tensor(i, v, [2, 4], + ... dtype=torch.float64, + ... device=torch.device('cuda:0')) + tensor(indices=tensor([[0, 1, 1], + [2, 0, 2]]), + values=tensor([3., 4., 5.]), + device='cuda:0', size=(2, 4), nnz=3, dtype=torch.float64, + layout=torch.sparse_coo) + + # Create an empty sparse tensor with the following invariants: + # 1. sparse_dim + dense_dim = len(SparseTensor.shape) + # 2. SparseTensor._indices().shape = (sparse_dim, nnz) + # 3. SparseTensor._values().shape = (nnz, SparseTensor.shape[sparse_dim:]) + # + # For instance, to create an empty sparse tensor with nnz = 0, dense_dim = 0 and + # sparse_dim = 1 (hence indices is a 2D tensor of shape = (1, 0)) + >>> S = torch.sparse_coo_tensor(torch.empty([1, 0]), [], [1]) + tensor(indices=tensor([], size=(1, 0)), + values=tensor([], size=(0,)), + size=(1,), nnz=0, layout=torch.sparse_coo) + + # and to create an empty sparse tensor with nnz = 0, dense_dim = 1 and + # sparse_dim = 1 + >>> S = torch.sparse_coo_tensor(torch.empty([1, 0]), torch.empty([0, 2]), [1, 2]) + tensor(indices=tensor([], size=(1, 0)), + values=tensor([], size=(0, 2)), + size=(1, 2), nnz=0, layout=torch.sparse_coo) + +.. _torch.sparse: https://pytorch.org/docs/stable/sparse.html +""".format(**factory_common_args), +) + +add_docstr( + torch.sqrt, + r""" +sqrt(input, *, out=None) -> Tensor + +Returns a new tensor with the square-root of the elements of :attr:`input`. + +.. math:: + \text{out}_{i} = \sqrt{\text{input}_{i}} +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-2.0755, 1.0226, 0.0831, 0.4806]) + >>> torch.sqrt(a) + tensor([ nan, 1.0112, 0.2883, 0.6933]) +""".format(**common_args), +) + +add_docstr( + torch.square, + r""" +square(input: Tensor, *, out: Optional[Tensor]) -> Tensor + +Returns a new tensor with the square of the elements of :attr:`input`. + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-2.0755, 1.0226, 0.0831, 0.4806]) + >>> torch.square(a) + tensor([ 4.3077, 1.0457, 0.0069, 0.2310]) +""".format(**common_args), +) + +add_docstr( + torch.squeeze, + r""" +squeeze(input: Tensor, dim: Optional[Union[int, List[int]]]) -> Tensor + +Returns a tensor with all specified dimensions of :attr:`input` of size `1` removed. + +For example, if `input` is of shape: +:math:`(A \times 1 \times B \times C \times 1 \times D)` then the `input.squeeze()` +will be of shape: :math:`(A \times B \times C \times D)`. + +When :attr:`dim` is given, a squeeze operation is done only in the given +dimension(s). If `input` is of shape: :math:`(A \times 1 \times B)`, +``squeeze(input, 0)`` leaves the tensor unchanged, but ``squeeze(input, 1)`` +will squeeze the tensor to the shape :math:`(A \times B)`. + +.. note:: The returned tensor shares the storage with the input tensor, + so changing the contents of one will change the contents of the other. + +.. warning:: If the tensor has a batch dimension of size 1, then `squeeze(input)` + will also remove the batch dimension, which can lead to unexpected + errors. Consider specifying only the dims you wish to be squeezed. + +Args: + {input} + dim (int or tuple of ints, optional): if given, the input will be squeezed + only in the specified dimensions. + + .. versionchanged:: 2.0 + :attr:`dim` now accepts tuples of dimensions. + +Example:: + + >>> x = torch.zeros(2, 1, 2, 1, 2) + >>> x.size() + torch.Size([2, 1, 2, 1, 2]) + >>> y = torch.squeeze(x) + >>> y.size() + torch.Size([2, 2, 2]) + >>> y = torch.squeeze(x, 0) + >>> y.size() + torch.Size([2, 1, 2, 1, 2]) + >>> y = torch.squeeze(x, 1) + >>> y.size() + torch.Size([2, 2, 1, 2]) + >>> y = torch.squeeze(x, (1, 2, 3)) + torch.Size([2, 2, 2]) +""".format(**common_args), +) + +add_docstr( + torch.std, + r""" +std(input, dim=None, *, correction=1, keepdim=False, out=None) -> Tensor + +Calculates the standard deviation over the dimensions specified by :attr:`dim`. +:attr:`dim` can be a single dimension, list of dimensions, or ``None`` to +reduce over all dimensions. + +The standard deviation (:math:`\sigma`) is calculated as + +.. math:: \sigma = \sqrt{\frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2} + +where :math:`x` is the sample set of elements, :math:`\bar{x}` is the +sample mean, :math:`N` is the number of samples and :math:`\delta N` is +the :attr:`correction`. +""" + + r""" + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + +Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + {opt_keepdim} + {out} + +Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.std(a, dim=1, keepdim=True) + tensor([[1.0311], + [0.7477], + [1.2204], + [0.9087]]) + +.. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + +""".format(**multi_dim_common), +) + +add_docstr( + torch.std_mean, + r""" +std_mean(input, dim=None, *, correction=1, keepdim=False, out=None) -> (Tensor, Tensor) + +Calculates the standard deviation and mean over the dimensions specified by +:attr:`dim`. :attr:`dim` can be a single dimension, list of dimensions, or +``None`` to reduce over all dimensions. + +The standard deviation (:math:`\sigma`) is calculated as + +.. math:: \sigma = \sqrt{\frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2} + +where :math:`x` is the sample set of elements, :math:`\bar{x}` is the +sample mean, :math:`N` is the number of samples and :math:`\delta N` is +the :attr:`correction`. + +""" + + r""" + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + +Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + {opt_keepdim} + {out} + +Returns: + A tuple (std, mean) containing the standard deviation and mean. + +Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.std_mean(a, dim=0, keepdim=True) + (tensor([[1.2620, 1.0028, 1.0957, 0.6038]]), + tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]])) + +.. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + +""".format(**multi_dim_common), +) + +add_docstr( + torch.sub, + r""" +sub(input, other, *, alpha=1, out=None) -> Tensor + +Subtracts :attr:`other`, scaled by :attr:`alpha`, from :attr:`input`. + +.. math:: + \text{{out}}_i = \text{{input}}_i - \text{{alpha}} \times \text{{other}}_i +""" + + r""" + +Supports :ref:`broadcasting to a common shape `, +:ref:`type promotion `, and integer, float, and complex inputs. + +Args: + {input} + other (Tensor or Number): the tensor or number to subtract from :attr:`input`. + +Keyword args: + alpha (Number): the multiplier for :attr:`other`. + {out} + +Example:: + + >>> a = torch.tensor((1, 2)) + >>> b = torch.tensor((0, 1)) + >>> torch.sub(a, b, alpha=2) + tensor([1, 0]) +""".format(**common_args), +) + +add_docstr( + torch.subtract, + r""" +subtract(input, other, *, alpha=1, out=None) -> Tensor + +Alias for :func:`torch.sub`. +""", +) + +add_docstr( + torch.sum, + r""" +sum(input, *, dtype=None) -> Tensor + +Returns the sum of all elements in the :attr:`input` tensor. + +Args: + {input} + +Keyword args: + {dtype} + +.. note:: Use the `dtype` argument if you need the result in a specific tensor type. + Otherwise, the result type may be automatically promoted (e.g., from `torch.int32` to `torch.int64`). + +Example:: + + >>> a = torch.randn(1, 3) + >>> a + tensor([[ 0.1133, -0.9567, 0.2958]]) + >>> torch.sum(a) + tensor(-0.5475) + +.. function:: sum(input, dim, keepdim=False, *, dtype=None) -> Tensor + :noindex: + +Returns the sum of each row of the :attr:`input` tensor in the given +dimension :attr:`dim`. If :attr:`dim` is a list of dimensions, +reduce over all of them. + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword args: + {dtype} + +Example:: + + >>> a = torch.randn(4, 4) + >>> a + tensor([[ 0.0569, -0.2475, 0.0737, -0.3429], + [-0.2993, 0.9138, 0.9337, -1.6864], + [ 0.1132, 0.7892, -0.1003, 0.5688], + [ 0.3637, -0.9906, -0.4752, -1.5197]]) + >>> torch.sum(a, 1) + tensor([-0.4598, -0.1381, 1.3708, -2.6217]) + >>> b = torch.arange(4 * 5 * 6).view(4, 5, 6) + >>> torch.sum(b, (2, 1)) + tensor([ 435., 1335., 2235., 3135.]) +""".format(**multi_dim_common), +) + +add_docstr( + torch.nansum, + r""" +nansum(input, *, dtype=None) -> Tensor + +Returns the sum of all elements, treating Not a Numbers (NaNs) as zero. + +Args: + {input} + +Keyword args: + {dtype} + +Example:: + + >>> a = torch.tensor([1., 2., float('nan'), 4.]) + >>> torch.nansum(a) + tensor(7.) + +.. function:: nansum(input, dim, keepdim=False, *, dtype=None) -> Tensor + :noindex: + +Returns the sum of each row of the :attr:`input` tensor in the given +dimension :attr:`dim`, treating Not a Numbers (NaNs) as zero. +If :attr:`dim` is a list of dimensions, reduce over all of them. + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + {opt_keepdim} + +Keyword args: + {dtype} + +Example:: + + >>> torch.nansum(torch.tensor([1., float("nan")])) + tensor(1.) + >>> a = torch.tensor([[1, 2], [3., float("nan")]]) + >>> torch.nansum(a) + tensor(6.) + >>> torch.nansum(a, dim=0) + tensor([4., 2.]) + >>> torch.nansum(a, dim=1) + tensor([3., 3.]) +""".format(**multi_dim_common), +) + +add_docstr( + torch.svd, + r""" +svd(input, some=True, compute_uv=True, *, out=None) -> (Tensor, Tensor, Tensor) + +Computes the singular value decomposition of either a matrix or batch of +matrices :attr:`input`. The singular value decomposition is represented as a +namedtuple `(U, S, V)`, such that :attr:`input` :math:`= U \text{diag}(S) V^{\text{H}}`. +where :math:`V^{\text{H}}` is the transpose of `V` for real inputs, +and the conjugate transpose of `V` for complex inputs. +If :attr:`input` is a batch of matrices, then `U`, `S`, and `V` are also +batched with the same batch dimensions as :attr:`input`. + +If :attr:`some` is `True` (default), the method returns the reduced singular +value decomposition. In this case, if the last two dimensions of :attr:`input` are +`m` and `n`, then the returned `U` and `V` matrices will contain only +`min(n, m)` orthonormal columns. + +If :attr:`compute_uv` is `False`, the returned `U` and `V` will be +zero-filled matrices of shape `(m, m)` and `(n, n)` +respectively, and the same device as :attr:`input`. The argument :attr:`some` +has no effect when :attr:`compute_uv` is `False`. + +Supports :attr:`input` of float, double, cfloat and cdouble data types. +The dtypes of `U` and `V` are the same as :attr:`input`'s. `S` will +always be real-valued, even if :attr:`input` is complex. + +.. warning:: + + :func:`torch.svd` is deprecated in favor of :func:`torch.linalg.svd` + and will be removed in a future PyTorch release. + + ``U, S, V = torch.svd(A, some=some, compute_uv=True)`` (default) should be replaced with + + .. code:: python + + U, S, Vh = torch.linalg.svd(A, full_matrices=not some) + V = Vh.mH + + ``_, S, _ = torch.svd(A, some=some, compute_uv=False)`` should be replaced with + + .. code:: python + + S = torch.linalg.svdvals(A) + +.. note:: Differences with :func:`torch.linalg.svd`: + + * :attr:`some` is the opposite of + :func:`torch.linalg.svd`'s :attr:`full_matrices`. Note that + default value for both is `True`, so the default behavior is + effectively the opposite. + * :func:`torch.svd` returns `V`, whereas :func:`torch.linalg.svd` returns + `Vh`, that is, :math:`V^{\text{H}}`. + * If :attr:`compute_uv` is `False`, :func:`torch.svd` returns zero-filled + tensors for `U` and `Vh`, whereas :func:`torch.linalg.svd` returns + empty tensors. + +.. note:: The singular values are returned in descending order. If :attr:`input` is a batch of matrices, + then the singular values of each matrix in the batch are returned in descending order. + +.. note:: The `S` tensor can only be used to compute gradients if :attr:`compute_uv` is `True`. + +.. note:: When :attr:`some` is `False`, the gradients on `U[..., :, min(m, n):]` + and `V[..., :, min(m, n):]` will be ignored in the backward pass, as those vectors + can be arbitrary bases of the corresponding subspaces. + +.. note:: The implementation of :func:`torch.linalg.svd` on CPU uses LAPACK's routine `?gesdd` + (a divide-and-conquer algorithm) instead of `?gesvd` for speed. Analogously, + on GPU, it uses cuSOLVER's routines `gesvdj` and `gesvdjBatched` on CUDA 10.1.243 + and later, and MAGMA's routine `gesdd` on earlier versions of CUDA. + +.. note:: The returned `U` will not be contiguous. The matrix (or batch of matrices) will + be represented as a column-major matrix (i.e. Fortran-contiguous). + +.. warning:: The gradients with respect to `U` and `V` will only be finite when the input does not + have zero nor repeated singular values. + +.. warning:: If the distance between any two singular values is close to zero, the gradients with respect to + `U` and `V` will be numerically unstable, as they depends on + :math:`\frac{1}{\min_{i \neq j} \sigma_i^2 - \sigma_j^2}`. The same happens when the matrix + has small singular values, as these gradients also depend on `S^{-1}`. + +.. warning:: For complex-valued :attr:`input` the singular value decomposition is not unique, + as `U` and `V` may be multiplied by an arbitrary phase factor :math:`e^{i \phi}` on every column. + The same happens when :attr:`input` has repeated singular values, where one may multiply + the columns of the spanning subspace in `U` and `V` by a rotation matrix + and `the resulting vectors will span the same subspace`_. + Different platforms, like NumPy, or inputs on different device types, + may produce different `U` and `V` tensors. + +Args: + input (Tensor): the input tensor of size `(*, m, n)` where `*` is zero or more + batch dimensions consisting of `(m, n)` matrices. + some (bool, optional): controls whether to compute the reduced or full decomposition, and + consequently, the shape of returned `U` and `V`. Default: `True`. + compute_uv (bool, optional): controls whether to compute `U` and `V`. Default: `True`. + +Keyword args: + out (tuple, optional): the output tuple of tensors + +Example:: + + >>> a = torch.randn(5, 3) + >>> a + tensor([[ 0.2364, -0.7752, 0.6372], + [ 1.7201, 0.7394, -0.0504], + [-0.3371, -1.0584, 0.5296], + [ 0.3550, -0.4022, 1.5569], + [ 0.2445, -0.0158, 1.1414]]) + >>> u, s, v = torch.svd(a) + >>> u + tensor([[ 0.4027, 0.0287, 0.5434], + [-0.1946, 0.8833, 0.3679], + [ 0.4296, -0.2890, 0.5261], + [ 0.6604, 0.2717, -0.2618], + [ 0.4234, 0.2481, -0.4733]]) + >>> s + tensor([2.3289, 2.0315, 0.7806]) + >>> v + tensor([[-0.0199, 0.8766, 0.4809], + [-0.5080, 0.4054, -0.7600], + [ 0.8611, 0.2594, -0.4373]]) + >>> torch.dist(a, torch.mm(torch.mm(u, torch.diag(s)), v.t())) + tensor(8.6531e-07) + >>> a_big = torch.randn(7, 5, 3) + >>> u, s, v = torch.svd(a_big) + >>> torch.dist(a_big, torch.matmul(torch.matmul(u, torch.diag_embed(s)), v.mT)) + tensor(2.6503e-06) + +.. _the resulting vectors will span the same subspace: + (https://en.wikipedia.org/wiki/Singular_value_decomposition#Singular_values,_singular_vectors,_and_their_relation_to_the_SVD) +""", +) + + +add_docstr( + torch.t, + r""" +t(input) -> Tensor + +Expects :attr:`input` to be <= 2-D tensor and transposes dimensions 0 +and 1. + +0-D and 1-D tensors are returned as is. When input is a 2-D tensor this +is equivalent to ``transpose(input, 0, 1)``. + +Args: + {input} + +Example:: + + >>> x = torch.randn(()) + >>> x + tensor(0.1995) + >>> torch.t(x) + tensor(0.1995) + >>> x = torch.randn(3) + >>> x + tensor([ 2.4320, -0.4608, 0.7702]) + >>> torch.t(x) + tensor([ 2.4320, -0.4608, 0.7702]) + >>> x = torch.randn(2, 3) + >>> x + tensor([[ 0.4875, 0.9158, -0.5872], + [ 0.3938, -0.6929, 0.6932]]) + >>> torch.t(x) + tensor([[ 0.4875, 0.3938], + [ 0.9158, -0.6929], + [-0.5872, 0.6932]]) + +See also :func:`torch.transpose`. +""".format(**common_args), +) + +add_docstr( + torch.flip, + r""" +flip(input, dims) -> Tensor + +Reverse the order of an n-D tensor along given axis in dims. + +.. note:: + `torch.flip` makes a copy of :attr:`input`'s data. This is different from NumPy's `np.flip`, + which returns a view in constant time. Since copying a tensor's data is more work than viewing that data, + `torch.flip` is expected to be slower than `np.flip`. + +Args: + {input} + dims (a list or tuple): axis to flip on + +Example:: + + >>> x = torch.arange(8).view(2, 2, 2) + >>> x + tensor([[[ 0, 1], + [ 2, 3]], + + [[ 4, 5], + [ 6, 7]]]) + >>> torch.flip(x, [0, 1]) + tensor([[[ 6, 7], + [ 4, 5]], + + [[ 2, 3], + [ 0, 1]]]) +""".format(**common_args), +) + +add_docstr( + torch.fliplr, + r""" +fliplr(input) -> Tensor + +Flip tensor in the left/right direction, returning a new tensor. + +Flip the entries in each row in the left/right direction. +Columns are preserved, but appear in a different order than before. + +Note: + Requires the tensor to be at least 2-D. + +.. note:: + `torch.fliplr` makes a copy of :attr:`input`'s data. This is different from NumPy's `np.fliplr`, + which returns a view in constant time. Since copying a tensor's data is more work than viewing that data, + `torch.fliplr` is expected to be slower than `np.fliplr`. + +Args: + input (Tensor): Must be at least 2-dimensional. + +Example:: + + >>> x = torch.arange(4).view(2, 2) + >>> x + tensor([[0, 1], + [2, 3]]) + >>> torch.fliplr(x) + tensor([[1, 0], + [3, 2]]) +""".format(**common_args), +) + +add_docstr( + torch.flipud, + r""" +flipud(input) -> Tensor + +Flip tensor in the up/down direction, returning a new tensor. + +Flip the entries in each column in the up/down direction. +Rows are preserved, but appear in a different order than before. + +Note: + Requires the tensor to be at least 1-D. + +.. note:: + `torch.flipud` makes a copy of :attr:`input`'s data. This is different from NumPy's `np.flipud`, + which returns a view in constant time. Since copying a tensor's data is more work than viewing that data, + `torch.flipud` is expected to be slower than `np.flipud`. + +Args: + input (Tensor): Must be at least 1-dimensional. + +Example:: + + >>> x = torch.arange(4).view(2, 2) + >>> x + tensor([[0, 1], + [2, 3]]) + >>> torch.flipud(x) + tensor([[2, 3], + [0, 1]]) +""".format(**common_args), +) + +add_docstr( + torch.roll, + r""" +roll(input, shifts, dims=None) -> Tensor + +Roll the tensor :attr:`input` along the given dimension(s). Elements that are +shifted beyond the last position are re-introduced at the first position. If +:attr:`dims` is `None`, the tensor will be flattened before rolling and then +restored to the original shape. + +Args: + {input} + shifts (int or tuple of ints): The number of places by which the elements + of the tensor are shifted. If shifts is a tuple, dims must be a tuple of + the same size, and each dimension will be rolled by the corresponding + value + dims (int or tuple of ints): Axis along which to roll + +Example:: + + >>> x = torch.tensor([1, 2, 3, 4, 5, 6, 7, 8]).view(4, 2) + >>> x + tensor([[1, 2], + [3, 4], + [5, 6], + [7, 8]]) + >>> torch.roll(x, 1) + tensor([[8, 1], + [2, 3], + [4, 5], + [6, 7]]) + >>> torch.roll(x, 1, 0) + tensor([[7, 8], + [1, 2], + [3, 4], + [5, 6]]) + >>> torch.roll(x, -1, 0) + tensor([[3, 4], + [5, 6], + [7, 8], + [1, 2]]) + >>> torch.roll(x, shifts=(2, 1), dims=(0, 1)) + tensor([[6, 5], + [8, 7], + [2, 1], + [4, 3]]) +""".format(**common_args), +) + +add_docstr( + torch.rot90, + r""" +rot90(input, k=1, dims=(0, 1)) -> Tensor + +Rotate an n-D tensor by 90 degrees in the plane specified by dims axis. +Rotation direction is from the first towards the second axis if k > 0, and from the second towards the first for k < 0. + +Args: + {input} + k (int): number of times to rotate. Default value is 1 + dims (a list or tuple): axis to rotate. Default value is [0, 1] + +Example:: + + >>> x = torch.arange(4).view(2, 2) + >>> x + tensor([[0, 1], + [2, 3]]) + >>> torch.rot90(x, 1, [0, 1]) + tensor([[1, 3], + [0, 2]]) + + >>> x = torch.arange(8).view(2, 2, 2) + >>> x + tensor([[[0, 1], + [2, 3]], + + [[4, 5], + [6, 7]]]) + >>> torch.rot90(x, 1, [1, 2]) + tensor([[[1, 3], + [0, 2]], + + [[5, 7], + [4, 6]]]) +""".format(**common_args), +) + +add_docstr( + torch.take, + r""" +take(input, index) -> Tensor + +Returns a new tensor with the elements of :attr:`input` at the given indices. +The input tensor is treated as if it were viewed as a 1-D tensor. The result +takes the same shape as the indices. + +Args: + {input} + index (LongTensor): the indices into tensor + +Example:: + + >>> src = torch.tensor([[4, 3, 5], + ... [6, 7, 8]]) + >>> torch.take(src, torch.tensor([0, 2, 5])) + tensor([ 4, 5, 8]) +""".format(**common_args), +) + +add_docstr( + torch.take_along_dim, + r""" +take_along_dim(input, indices, dim=None, *, out=None) -> Tensor + +Selects values from :attr:`input` at the 1-dimensional indices from :attr:`indices` along the given :attr:`dim`. + +If :attr:`dim` is None, the input array is treated as if it has been flattened to 1d. + +Functions that return indices along a dimension, like :func:`torch.argmax` and :func:`torch.argsort`, +are designed to work with this function. See the examples below. + +.. note:: + This function is similar to NumPy's `take_along_axis`. + See also :func:`torch.gather`. + +Args: + {input} + indices (LongTensor): the indices into :attr:`input`. Must have long dtype. + dim (int, optional): dimension to select along. Default: 0 + +Keyword args: + {out} + +Example:: + + >>> t = torch.tensor([[10, 30, 20], [60, 40, 50]]) + >>> max_idx = torch.argmax(t) + >>> torch.take_along_dim(t, max_idx) + tensor([60]) + >>> sorted_idx = torch.argsort(t, dim=1) + >>> torch.take_along_dim(t, sorted_idx, dim=1) + tensor([[10, 20, 30], + [40, 50, 60]]) +""".format(**common_args), +) + +add_docstr( + torch.tan, + r""" +tan(input, *, out=None) -> Tensor + +Returns a new tensor with the tangent of the elements in the :attr:`input` tensor, +where each value in this input tensor is in radians. + +.. math:: + \text{out}_{i} = \tan(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([-1.2027, -1.7687, 0.4412, -1.3856]) + >>> torch.tan(a) + tensor([-2.5930, 4.9859, 0.4722, -5.3366]) +""".format(**common_args), +) + +add_docstr( + torch.tanh, + r""" +tanh(input, *, out=None) -> Tensor + +Returns a new tensor with the hyperbolic tangent of the elements +of :attr:`input`. + +.. math:: + \text{out}_{i} = \tanh(\text{input}_{i}) +""" + + r""" +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 0.8986, -0.7279, 1.1745, 0.2611]) + >>> torch.tanh(a) + tensor([ 0.7156, -0.6218, 0.8257, 0.2553]) +""".format(**common_args), +) + +add_docstr( + # torch.softmax doc str. Point this to torch.nn.functional.softmax + torch.softmax, + r""" +softmax(input, dim, *, dtype=None) -> Tensor + +Alias for :func:`torch.nn.functional.softmax`. +""", +) + +add_docstr( + torch.topk, + r""" +topk(input, k, dim=None, largest=True, sorted=True, *, out=None) -> (Tensor, LongTensor) + +Returns the :attr:`k` largest elements of the given :attr:`input` tensor along +a given dimension. + +If :attr:`dim` is not given, the last dimension of the `input` is chosen. + +If :attr:`largest` is ``False`` then the `k` smallest elements are returned. + +A namedtuple of `(values, indices)` is returned with the `values` and +`indices` of the largest `k` elements of each row of the `input` tensor in the +given dimension `dim`. + +The boolean option :attr:`sorted` if ``True``, will make sure that the returned +`k` elements are themselves sorted + +.. note:: + When using `torch.topk`, the indices of tied elements are not guaranteed to be stable + and may vary across different invocations. + +Args: + {input} + k (int): the k in "top-k" + dim (int, optional): the dimension to sort along + largest (bool, optional): controls whether to return largest or + smallest elements + sorted (bool, optional): controls whether to return the elements + in sorted order + +Keyword args: + out (tuple, optional): the output tuple of (Tensor, LongTensor) that can be + optionally given to be used as output buffers + +Example:: + + >>> x = torch.arange(1., 6.) + >>> x + tensor([ 1., 2., 3., 4., 5.]) + >>> torch.topk(x, 3) + torch.return_types.topk(values=tensor([5., 4., 3.]), indices=tensor([4, 3, 2])) +""".format(**common_args), +) + +add_docstr( + torch.trace, + r""" +trace(input) -> Tensor + +Returns the sum of the elements of the diagonal of the input 2-D matrix. + +Example:: + + >>> x = torch.arange(1., 10.).view(3, 3) + >>> x + tensor([[ 1., 2., 3.], + [ 4., 5., 6.], + [ 7., 8., 9.]]) + >>> torch.trace(x) + tensor(15.) +""", +) + +add_docstr( + torch.transpose, + r""" +transpose(input, dim0, dim1) -> Tensor + +Returns a tensor that is a transposed version of :attr:`input`. +The given dimensions :attr:`dim0` and :attr:`dim1` are swapped. + +If :attr:`input` is a strided tensor then the resulting :attr:`out` +tensor shares its underlying storage with the :attr:`input` tensor, so +changing the content of one would change the content of the other. + +If :attr:`input` is a :ref:`sparse tensor ` then the +resulting :attr:`out` tensor *does not* share the underlying storage +with the :attr:`input` tensor. + +If :attr:`input` is a :ref:`sparse tensor ` with compressed +layout (SparseCSR, SparseBSR, SparseCSC or SparseBSC) the arguments +:attr:`dim0` and :attr:`dim1` must be both batch dimensions, or must +both be sparse dimensions. The batch dimensions of a sparse tensor are the +dimensions preceding the sparse dimensions. + +.. note:: + Transpositions which interchange the sparse dimensions of a `SparseCSR` + or `SparseCSC` layout tensor will result in the layout changing between + the two options. Transposition of the sparse dimensions of a ` SparseBSR` + or `SparseBSC` layout tensor will likewise generate a result with the + opposite layout. + + +Args: + {input} + dim0 (int): the first dimension to be transposed + dim1 (int): the second dimension to be transposed + +Example:: + + >>> x = torch.randn(2, 3) + >>> x + tensor([[ 1.0028, -0.9893, 0.5809], + [-0.1669, 0.7299, 0.4942]]) + >>> torch.transpose(x, 0, 1) + tensor([[ 1.0028, -0.1669], + [-0.9893, 0.7299], + [ 0.5809, 0.4942]]) + +See also :func:`torch.t`. +""".format(**common_args), +) + +add_docstr( + torch.triangular_solve, + r""" +triangular_solve(b, A, upper=True, transpose=False, unitriangular=False, *, out=None) -> (Tensor, Tensor) + +Solves a system of equations with a square upper or lower triangular invertible matrix :math:`A` +and multiple right-hand sides :math:`b`. + +In symbols, it solves :math:`AX = b` and assumes :math:`A` is square upper-triangular +(or lower-triangular if :attr:`upper`\ `= False`) and does not have zeros on the diagonal. + +`torch.triangular_solve(b, A)` can take in 2D inputs `b, A` or inputs that are +batches of 2D matrices. If the inputs are batches, then returns +batched outputs `X` + +If the diagonal of :attr:`A` contains zeros or elements that are very close to zero and +:attr:`unitriangular`\ `= False` (default) or if the input matrix is badly conditioned, +the result may contain `NaN` s. + +Supports input of float, double, cfloat and cdouble data types. + +.. warning:: + + :func:`torch.triangular_solve` is deprecated in favor of :func:`torch.linalg.solve_triangular` + and will be removed in a future PyTorch release. + :func:`torch.linalg.solve_triangular` has its arguments reversed and does not return a + copy of one of the inputs. + + ``X = torch.triangular_solve(B, A).solution`` should be replaced with + + .. code:: python + + X = torch.linalg.solve_triangular(A, B) + +Args: + b (Tensor): multiple right-hand sides of size :math:`(*, m, k)` where + :math:`*` is zero of more batch dimensions + A (Tensor): the input triangular coefficient matrix of size :math:`(*, m, m)` + where :math:`*` is zero or more batch dimensions + upper (bool, optional): whether :math:`A` is upper or lower triangular. Default: ``True``. + transpose (bool, optional): solves `op(A)X = b` where `op(A) = A^T` if this flag is ``True``, + and `op(A) = A` if it is ``False``. Default: ``False``. + unitriangular (bool, optional): whether :math:`A` is unit triangular. + If True, the diagonal elements of :math:`A` are assumed to be + 1 and not referenced from :math:`A`. Default: ``False``. + +Keyword args: + out ((Tensor, Tensor), optional): tuple of two tensors to write + the output to. Ignored if `None`. Default: `None`. + +Returns: + A namedtuple `(solution, cloned_coefficient)` where `cloned_coefficient` + is a clone of :math:`A` and `solution` is the solution :math:`X` to :math:`AX = b` + (or whatever variant of the system of equations, depending on the keyword arguments.) + +Examples:: + + >>> A = torch.randn(2, 2).triu() + >>> A + tensor([[ 1.1527, -1.0753], + [ 0.0000, 0.7986]]) + >>> b = torch.randn(2, 3) + >>> b + tensor([[-0.0210, 2.3513, -1.5492], + [ 1.5429, 0.7403, -1.0243]]) + >>> torch.triangular_solve(b, A) + torch.return_types.triangular_solve( + solution=tensor([[ 1.7841, 2.9046, -2.5405], + [ 1.9320, 0.9270, -1.2826]]), + cloned_coefficient=tensor([[ 1.1527, -1.0753], + [ 0.0000, 0.7986]])) +""", +) + +add_docstr( + torch.tril, + r""" +tril(input, diagonal=0, *, out=None) -> Tensor + +Returns the lower triangular part of the matrix (2-D tensor) or batch of matrices +:attr:`input`, the other elements of the result tensor :attr:`out` are set to 0. + +The lower triangular part of the matrix is defined as the elements on and +below the diagonal. + +The argument :attr:`diagonal` controls which diagonal to consider. If +:attr:`diagonal` = 0, all elements on and below the main diagonal are +retained. A positive value includes just as many diagonals above the main +diagonal, and similarly a negative value excludes just as many diagonals below +the main diagonal. The main diagonal are the set of indices +:math:`\lbrace (i, i) \rbrace` for :math:`i \in [0, \min\{d_{1}, d_{2}\} - 1]` where +:math:`d_{1}, d_{2}` are the dimensions of the matrix. +""" + + r""" +Args: + {input} + diagonal (int, optional): the diagonal to consider + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(3, 3) + >>> a + tensor([[-1.0813, -0.8619, 0.7105], + [ 0.0935, 0.1380, 2.2112], + [-0.3409, -0.9828, 0.0289]]) + >>> torch.tril(a) + tensor([[-1.0813, 0.0000, 0.0000], + [ 0.0935, 0.1380, 0.0000], + [-0.3409, -0.9828, 0.0289]]) + + >>> b = torch.randn(4, 6) + >>> b + tensor([[ 1.2219, 0.5653, -0.2521, -0.2345, 1.2544, 0.3461], + [ 0.4785, -0.4477, 0.6049, 0.6368, 0.8775, 0.7145], + [ 1.1502, 3.2716, -1.1243, -0.5413, 0.3615, 0.6864], + [-0.0614, -0.7344, -1.3164, -0.7648, -1.4024, 0.0978]]) + >>> torch.tril(b, diagonal=1) + tensor([[ 1.2219, 0.5653, 0.0000, 0.0000, 0.0000, 0.0000], + [ 0.4785, -0.4477, 0.6049, 0.0000, 0.0000, 0.0000], + [ 1.1502, 3.2716, -1.1243, -0.5413, 0.0000, 0.0000], + [-0.0614, -0.7344, -1.3164, -0.7648, -1.4024, 0.0000]]) + >>> torch.tril(b, diagonal=-1) + tensor([[ 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000], + [ 0.4785, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000], + [ 1.1502, 3.2716, 0.0000, 0.0000, 0.0000, 0.0000], + [-0.0614, -0.7344, -1.3164, 0.0000, 0.0000, 0.0000]]) +""".format(**common_args), +) + +# docstr is split in two parts to avoid format mis-captureing :math: braces '{}' +# as common args. +add_docstr( + torch.tril_indices, + r""" +tril_indices(row, col, offset=0, *, dtype=torch.long, device='cpu', layout=torch.strided) -> Tensor + +Returns the indices of the lower triangular part of a :attr:`row`-by- +:attr:`col` matrix in a 2-by-N Tensor, where the first row contains row +coordinates of all indices and the second row contains column coordinates. +Indices are ordered based on rows and then columns. + +The lower triangular part of the matrix is defined as the elements on and +below the diagonal. + +The argument :attr:`offset` controls which diagonal to consider. If +:attr:`offset` = 0, all elements on and below the main diagonal are +retained. A positive value includes just as many diagonals above the main +diagonal, and similarly a negative value excludes just as many diagonals below +the main diagonal. The main diagonal are the set of indices +:math:`\lbrace (i, i) \rbrace` for :math:`i \in [0, \min\{d_{1}, d_{2}\} - 1]` +where :math:`d_{1}, d_{2}` are the dimensions of the matrix. + +.. note:: + When running on CUDA, ``row * col`` must be less than :math:`2^{59}` to + prevent overflow during calculation. +""" + + r""" +Args: + row (``int``): number of rows in the 2-D matrix. + col (``int``): number of columns in the 2-D matrix. + offset (``int``): diagonal offset from the main diagonal. + Default: if not provided, 0. + +Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor, + only support ``torch.int``, ``torch.long``. Default: if ``None``, ``torch.long``. + {device} + layout (:class:`torch.layout`, optional): currently only support ``torch.strided``. + +Example:: + + >>> a = torch.tril_indices(3, 3) + >>> a + tensor([[0, 1, 1, 2, 2, 2], + [0, 0, 1, 0, 1, 2]]) + + >>> a = torch.tril_indices(4, 3, -1) + >>> a + tensor([[1, 2, 2, 3, 3, 3], + [0, 0, 1, 0, 1, 2]]) + + >>> a = torch.tril_indices(4, 3, 1) + >>> a + tensor([[0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3], + [0, 1, 0, 1, 2, 0, 1, 2, 0, 1, 2]]) +""".format(**factory_common_args), +) + +add_docstr( + torch.triu, + r""" +triu(input, diagonal=0, *, out=None) -> Tensor + +Returns the upper triangular part of a matrix (2-D tensor) or batch of matrices +:attr:`input`, the other elements of the result tensor :attr:`out` are set to 0. + +The upper triangular part of the matrix is defined as the elements on and +above the diagonal. + +The argument :attr:`diagonal` controls which diagonal to consider. If +:attr:`diagonal` = 0, all elements on and above the main diagonal are +retained. A positive value excludes just as many diagonals above the main +diagonal, and similarly a negative value includes just as many diagonals below +the main diagonal. The main diagonal are the set of indices +:math:`\lbrace (i, i) \rbrace` for :math:`i \in [0, \min\{d_{1}, d_{2}\} - 1]` where +:math:`d_{1}, d_{2}` are the dimensions of the matrix. +""" + + r""" +Args: + {input} + diagonal (int, optional): the diagonal to consider + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(3, 3) + >>> a + tensor([[ 0.2309, 0.5207, 2.0049], + [ 0.2072, -1.0680, 0.6602], + [ 0.3480, -0.5211, -0.4573]]) + >>> torch.triu(a) + tensor([[ 0.2309, 0.5207, 2.0049], + [ 0.0000, -1.0680, 0.6602], + [ 0.0000, 0.0000, -0.4573]]) + >>> torch.triu(a, diagonal=1) + tensor([[ 0.0000, 0.5207, 2.0049], + [ 0.0000, 0.0000, 0.6602], + [ 0.0000, 0.0000, 0.0000]]) + >>> torch.triu(a, diagonal=-1) + tensor([[ 0.2309, 0.5207, 2.0049], + [ 0.2072, -1.0680, 0.6602], + [ 0.0000, -0.5211, -0.4573]]) + + >>> b = torch.randn(4, 6) + >>> b + tensor([[ 0.5876, -0.0794, -1.8373, 0.6654, 0.2604, 1.5235], + [-0.2447, 0.9556, -1.2919, 1.3378, -0.1768, -1.0857], + [ 0.4333, 0.3146, 0.6576, -1.0432, 0.9348, -0.4410], + [-0.9888, 1.0679, -1.3337, -1.6556, 0.4798, 0.2830]]) + >>> torch.triu(b, diagonal=1) + tensor([[ 0.0000, -0.0794, -1.8373, 0.6654, 0.2604, 1.5235], + [ 0.0000, 0.0000, -1.2919, 1.3378, -0.1768, -1.0857], + [ 0.0000, 0.0000, 0.0000, -1.0432, 0.9348, -0.4410], + [ 0.0000, 0.0000, 0.0000, 0.0000, 0.4798, 0.2830]]) + >>> torch.triu(b, diagonal=-1) + tensor([[ 0.5876, -0.0794, -1.8373, 0.6654, 0.2604, 1.5235], + [-0.2447, 0.9556, -1.2919, 1.3378, -0.1768, -1.0857], + [ 0.0000, 0.3146, 0.6576, -1.0432, 0.9348, -0.4410], + [ 0.0000, 0.0000, -1.3337, -1.6556, 0.4798, 0.2830]]) +""".format(**common_args), +) + +# docstr is split in two parts to avoid format mis-capturing :math: braces '{}' +# as common args. +add_docstr( + torch.triu_indices, + r""" +triu_indices(row, col, offset=0, *, dtype=torch.long, device='cpu', layout=torch.strided) -> Tensor + +Returns the indices of the upper triangular part of a :attr:`row` by +:attr:`col` matrix in a 2-by-N Tensor, where the first row contains row +coordinates of all indices and the second row contains column coordinates. +Indices are ordered based on rows and then columns. + +The upper triangular part of the matrix is defined as the elements on and +above the diagonal. + +The argument :attr:`offset` controls which diagonal to consider. If +:attr:`offset` = 0, all elements on and above the main diagonal are +retained. A positive value excludes just as many diagonals above the main +diagonal, and similarly a negative value includes just as many diagonals below +the main diagonal. The main diagonal are the set of indices +:math:`\lbrace (i, i) \rbrace` for :math:`i \in [0, \min\{d_{1}, d_{2}\} - 1]` +where :math:`d_{1}, d_{2}` are the dimensions of the matrix. + +.. note:: + When running on CUDA, ``row * col`` must be less than :math:`2^{59}` to + prevent overflow during calculation. +""" + + r""" +Args: + row (``int``): number of rows in the 2-D matrix. + col (``int``): number of columns in the 2-D matrix. + offset (``int``): diagonal offset from the main diagonal. + Default: if not provided, 0. + +Keyword args: + dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor, + only support ``torch.int``, ``torch.long``. Default: if ``None``, ``torch.long``. + {device} + layout (:class:`torch.layout`, optional): currently only support ``torch.strided``. + +Example:: + + >>> a = torch.triu_indices(3, 3) + >>> a + tensor([[0, 0, 0, 1, 1, 2], + [0, 1, 2, 1, 2, 2]]) + + >>> a = torch.triu_indices(4, 3, -1) + >>> a + tensor([[0, 0, 0, 1, 1, 1, 2, 2, 3], + [0, 1, 2, 0, 1, 2, 1, 2, 2]]) + + >>> a = torch.triu_indices(4, 3, 1) + >>> a + tensor([[0, 0, 1], + [1, 2, 2]]) +""".format(**factory_common_args), +) + +add_docstr( + torch.true_divide, + r""" +true_divide(dividend, divisor, *, out) -> Tensor + +Alias for :func:`torch.div` with ``rounding_mode=None``. +""", +) + +add_docstr( + torch.trunc, + r""" +trunc(input, *, out=None) -> Tensor + +Returns a new tensor with the truncated integer values of +the elements of :attr:`input`. + +For integer inputs, follows the array-api convention of returning a +copy of the input tensor. + +Args: + {input} + +Keyword args: + {out} + +Example:: + + >>> a = torch.randn(4) + >>> a + tensor([ 3.4742, 0.5466, -0.8008, -0.9079]) + >>> torch.trunc(a) + tensor([ 3., 0., -0., -0.]) +""".format(**common_args), +) + +add_docstr( + torch.fake_quantize_per_tensor_affine, + r""" +fake_quantize_per_tensor_affine(input, scale, zero_point, quant_min, quant_max) -> Tensor + +Returns a new tensor with the data in :attr:`input` fake quantized using :attr:`scale`, +:attr:`zero_point`, :attr:`quant_min` and :attr:`quant_max`. + +.. math:: + \text{output} = ( + min( + \text{quant\_max}, + max( + \text{quant\_min}, + \text{std::nearby\_int}(\text{input} / \text{scale}) + \text{zero\_point} + ) + ) - \text{zero\_point} + ) \times \text{scale} + +Args: + input (Tensor): the input value(s), ``torch.float32`` tensor + scale (double scalar or ``float32`` Tensor): quantization scale + zero_point (int64 scalar or ``int32`` Tensor): quantization zero_point + quant_min (int64): lower bound of the quantized domain + quant_max (int64): upper bound of the quantized domain + +Returns: + Tensor: A newly fake_quantized ``torch.float32`` tensor + +Example:: + + >>> x = torch.randn(4) + >>> x + tensor([ 0.0552, 0.9730, 0.3973, -1.0780]) + >>> torch.fake_quantize_per_tensor_affine(x, 0.1, 0, 0, 255) + tensor([0.1000, 1.0000, 0.4000, 0.0000]) + >>> torch.fake_quantize_per_tensor_affine(x, torch.tensor(0.1), torch.tensor(0), 0, 255) + tensor([0.1000, 1.0000, 0.4000, 0.0000]) +""", +) + +add_docstr( + torch.fake_quantize_per_channel_affine, + r""" +fake_quantize_per_channel_affine(input, scale, zero_point, axis, quant_min, quant_max) -> Tensor + +Returns a new tensor with the data in :attr:`input` fake quantized per channel using :attr:`scale`, +:attr:`zero_point`, :attr:`quant_min` and :attr:`quant_max`, across the channel specified by :attr:`axis`. + +.. math:: + \text{output} = ( + min( + \text{quant\_max}, + max( + \text{quant\_min}, + \text{std::nearby\_int}(\text{input} / \text{scale}) + \text{zero\_point} + ) + ) - \text{zero\_point} + ) \times \text{scale} + +Args: + input (Tensor): the input value(s), in ``torch.float32`` + scale (Tensor): quantization scale, per channel in ``torch.float32`` + zero_point (Tensor): quantization zero_point, per channel in ``torch.int32`` or ``torch.half`` or ``torch.float32`` + axis (int32): channel axis + quant_min (int64): lower bound of the quantized domain + quant_max (int64): upper bound of the quantized domain + +Returns: + Tensor: A newly fake_quantized per channel ``torch.float32`` tensor + +Example:: + + >>> x = torch.randn(2, 2, 2) + >>> x + tensor([[[-0.2525, -0.0466], + [ 0.3491, -0.2168]], + + [[-0.5906, 1.6258], + [ 0.6444, -0.0542]]]) + >>> scales = (torch.randn(2) + 1) * 0.05 + >>> scales + tensor([0.0475, 0.0486]) + >>> zero_points = torch.zeros(2).to(torch.int32) + >>> zero_points + tensor([0, 0]) + >>> torch.fake_quantize_per_channel_affine(x, scales, zero_points, 1, 0, 255) + tensor([[[0.0000, 0.0000], + [0.3405, 0.0000]], + + [[0.0000, 1.6134], + [0.6323, 0.0000]]]) +""", +) + +add_docstr( + torch.fix, + r""" +fix(input, *, out=None) -> Tensor + +Alias for :func:`torch.trunc` +""", +) + +add_docstr( + torch.unsqueeze, + r""" +unsqueeze(input, dim) -> Tensor + +Returns a new tensor with a dimension of size one inserted at the +specified position. + +The returned tensor shares the same underlying data with this tensor. + +A :attr:`dim` value within the range ``[-input.dim() - 1, input.dim() + 1)`` +can be used. Negative :attr:`dim` will correspond to :meth:`unsqueeze` +applied at :attr:`dim` = ``dim + input.dim() + 1``. + +Args: + {input} + dim (int): the index at which to insert the singleton dimension + +Example:: + + >>> x = torch.tensor([1, 2, 3, 4]) + >>> torch.unsqueeze(x, 0) + tensor([[ 1, 2, 3, 4]]) + >>> torch.unsqueeze(x, 1) + tensor([[ 1], + [ 2], + [ 3], + [ 4]]) +""".format(**common_args), +) + +add_docstr( + torch.var, + r""" +var(input, dim=None, *, correction=1, keepdim=False, out=None) -> Tensor + +Calculates the variance over the dimensions specified by :attr:`dim`. :attr:`dim` +can be a single dimension, list of dimensions, or ``None`` to reduce over all +dimensions. + +The variance (:math:`\sigma^2`) is calculated as + +.. math:: \sigma^2 = \frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2 + +where :math:`x` is the sample set of elements, :math:`\bar{x}` is the +sample mean, :math:`N` is the number of samples and :math:`\delta N` is +the :attr:`correction`. +""" + + r""" + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + +Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + {opt_keepdim} + {out} + +Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.var(a, dim=1, keepdim=True) + tensor([[1.0631], + [0.5590], + [1.4893], + [0.8258]]) + +.. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + +""".format(**multi_dim_common), +) + +add_docstr( + torch.var_mean, + r""" +var_mean(input, dim=None, *, correction=1, keepdim=False, out=None) -> (Tensor, Tensor) + +Calculates the variance and mean over the dimensions specified by :attr:`dim`. +:attr:`dim` can be a single dimension, list of dimensions, or ``None`` to +reduce over all dimensions. + +The variance (:math:`\sigma^2`) is calculated as + +.. math:: \sigma^2 = \frac{1}{\max(0,~N - \delta N)}\sum_{i=0}^{N-1}(x_i-\bar{x})^2 + +where :math:`x` is the sample set of elements, :math:`\bar{x}` is the +sample mean, :math:`N` is the number of samples and :math:`\delta N` is +the :attr:`correction`. +""" + + r""" + +{keepdim_details} + +Args: + {input} + {opt_dim_all_reduce} + +Keyword args: + correction (int): difference between the sample size and sample degrees of freedom. + Defaults to `Bessel's correction`_, ``correction=1``. + + .. versionchanged:: 2.0 + Previously this argument was called ``unbiased`` and was a boolean + with ``True`` corresponding to ``correction=1`` and ``False`` being + ``correction=0``. + {opt_keepdim} + {out} + +Returns: + A tuple (var, mean) containing the variance and mean. + +Example: + + >>> a = torch.tensor( + ... [[ 0.2035, 1.2959, 1.8101, -0.4644], + ... [ 1.5027, -0.3270, 0.5905, 0.6538], + ... [-1.5745, 1.3330, -0.5596, -0.6548], + ... [ 0.1264, -0.5080, 1.6420, 0.1992]] + ... ) # fmt: skip + >>> torch.var_mean(a, dim=0, keepdim=True) + (tensor([[1.5926, 1.0056, 1.2005, 0.3646]]), + tensor([[ 0.0645, 0.4485, 0.8707, -0.0665]])) + +.. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel%27s_correction + +""".format(**multi_dim_common), +) + +add_docstr( + torch.zeros, + r""" +zeros(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + +Returns a tensor filled with the scalar value `0`, with the shape defined +by the variable argument :attr:`size`. + +Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + +Keyword args: + {out} + {dtype} + {layout} + {device} + {requires_grad} + +Example:: + + >>> torch.zeros(2, 3) + tensor([[ 0., 0., 0.], + [ 0., 0., 0.]]) + + >>> torch.zeros(5) + tensor([ 0., 0., 0., 0., 0.]) +""".format(**factory_common_args), +) + +add_docstr( + torch.zeros_like, + r""" +zeros_like(input, *, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + +Returns a tensor filled with the scalar value `0`, with the same size as +:attr:`input`. ``torch.zeros_like(input)`` is equivalent to +``torch.zeros(input.size(), dtype=input.dtype, layout=input.layout, device=input.device)``. + +.. warning:: + As of 0.4, this function does not support an :attr:`out` keyword. As an alternative, + the old ``torch.zeros_like(input, out=output)`` is equivalent to + ``torch.zeros(input.size(), out=output)``. + +Args: + {input} + +Keyword args: + {dtype} + {layout} + {device} + {requires_grad} + {memory_format} + +Example:: + + >>> input = torch.empty(2, 3) + >>> torch.zeros_like(input) + tensor([[ 0., 0., 0.], + [ 0., 0., 0.]]) +""".format(**factory_like_common_args), +) + +add_docstr( + torch.empty, + """ +empty(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False, \ +memory_format=torch.contiguous_format) -> Tensor + +Returns a tensor filled with uninitialized data. The shape of the tensor is +defined by the variable argument :attr:`size`. + +.. note:: + If :func:`torch.use_deterministic_algorithms()` and + :attr:`torch.utils.deterministic.fill_uninitialized_memory` are both set to + ``True``, the output tensor is initialized to prevent any possible + nondeterministic behavior from using the data as an input to an operation. + Floating point and complex tensors are filled with NaN, and integer tensors + are filled with the maximum value. + +Args: + size (int...): a sequence of integers defining the shape of the output tensor. + Can be a variable number of arguments or a collection like a list or tuple. + +Keyword args: + {out} + {dtype} + {layout} + {device} + {requires_grad} + {pin_memory} + {memory_format} + +Example:: + + >>> torch.empty((2,3), dtype=torch.int64) + tensor([[ 9.4064e+13, 2.8000e+01, 9.3493e+13], + [ 7.5751e+18, 7.1428e+18, 7.5955e+18]]) +""".format(**factory_common_args), +) + +add_docstr( + torch.empty_like, + r""" +empty_like(input, *, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format) -> Tensor + +Returns an uninitialized tensor with the same size as :attr:`input`. +``torch.empty_like(input)`` is equivalent to +``torch.empty(input.size(), dtype=input.dtype, layout=input.layout, device=input.device)``. + +.. note:: + If :func:`torch.use_deterministic_algorithms()` and + :attr:`torch.utils.deterministic.fill_uninitialized_memory` are both set to + ``True``, the output tensor is initialized to prevent any possible + nondeterministic behavior from using the data as an input to an operation. + Floating point and complex tensors are filled with NaN, and integer tensors + are filled with the maximum value. + + When ``torch.preserve_format`` is used: + If the input tensor is dense (i.e., non-overlapping strided), + its memory format (including strides) is retained. + Otherwise (e.g., a non-dense view like a stepped slice), + the output is converted to the dense format. + +Args: + {input} + +Keyword args: + {dtype} + {layout} + {device} + {requires_grad} + {memory_format} + +Example:: + + >>> a=torch.empty((2,3), dtype=torch.int32, device = 'cuda') + >>> torch.empty_like(a) + tensor([[0, 0, 0], + [0, 0, 0]], device='cuda:0', dtype=torch.int32) +""".format(**factory_like_common_args), +) + +add_docstr( + torch.empty_strided, + r""" +empty_strided(size, stride, *, dtype=None, layout=None, device=None, requires_grad=False, pin_memory=False) -> Tensor + +Creates a tensor with the specified :attr:`size` and :attr:`stride` and filled with undefined data. + +.. warning:: + If the constructed tensor is "overlapped" (with multiple indices referring to the same element + in memory) its behavior is undefined. + +.. note:: + If :func:`torch.use_deterministic_algorithms()` and + :attr:`torch.utils.deterministic.fill_uninitialized_memory` are both set to + ``True``, the output tensor is initialized to prevent any possible + nondeterministic behavior from using the data as an input to an operation. + Floating point and complex tensors are filled with NaN, and integer tensors + are filled with the maximum value. + +Args: + size (tuple of int): the shape of the output tensor + stride (tuple of int): the strides of the output tensor + +Keyword args: + {dtype} + {layout} + {device} + {requires_grad} + {pin_memory} + +Example:: + + >>> a = torch.empty_strided((2, 3), (1, 2)) + >>> a + tensor([[8.9683e-44, 4.4842e-44, 5.1239e+07], + [0.0000e+00, 0.0000e+00, 3.0705e-41]]) + >>> a.stride() + (1, 2) + >>> a.size() + torch.Size([2, 3]) +""".format(**factory_common_args), +) + +add_docstr( + torch.empty_permuted, + r""" +empty_permuted(size, physical_layout, *, dtype=None, layout=None, device=None, requires_grad=False, pin_memory=False) -> Tensor + +Creates an uninitialized, non-overlapping and dense tensor with the +specified :attr:`size`, with :attr:`physical_layout` specifying how the +dimensions are physically laid out in memory (each logical dimension is listed +from outermost to innermost). :attr:`physical_layout` is a generalization +of NCHW/NHWC notation: if each dimension is assigned a number according to +what order they occur in size (N=0, C=1, H=2, W=3), then NCHW is ``(0, 1, 2, 3)`` +while NHWC is ``(0, 2, 3, 1)``. Equivalently, the strides of the output +tensor ``t`` are such that ``t.stride(physical_layout[i]) == contiguous_strides[i]`` +(notably, this function is *not* equivalent to ``torch.empty(size).permute(physical_layout)``). + +Unlike :func:`torch.empty_strided`, this is guaranteed to produce a dense +tensor with no overlaps. If possible, prefer using this function over +:func:`torch.empty_strided` or manual use of :func:`torch.as_strided`. + +.. note:: + If :func:`torch.use_deterministic_algorithms()` and + :attr:`torch.utils.deterministic.fill_uninitialized_memory` are both set to + ``True``, the output tensor is initialized to prevent any possible + nondeterministic behavior from using the data as an input to an operation. + Floating point and complex tensors are filled with NaN, and integer tensors + are filled with the maximum value. + +Args: + size (tuple of int): the shape of the output tensor + physical_layout (tuple of int): the ordering of dimensions physically in memory + +Keyword args: + {dtype} + {layout} + {device} + {requires_grad} + {pin_memory} + +Examples: + + >>> torch.empty((2, 3, 5, 7)).stride() + (105, 35, 7, 1) + >>> torch.empty_permuted((2, 3, 5, 7), (0, 1, 2, 3)).stride() + (105, 35, 7, 1) + >>> torch.empty((2, 3, 5, 7), memory_format=torch.channels_last).stride() + (105, 1, 21, 3) + >>> torch.empty_permuted((2, 3, 5, 7), (0, 2, 3, 1)).stride() + (105, 1, 21, 3) + >>> torch.empty_permuted((2, 3, 5, 7), (0, 2, 3, 1)).dim_order() + (0, 2, 3, 1) +""".format(**factory_common_args), +) + +add_docstr( + torch.full, + r""" +full(size, fill_value, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor + +Creates a tensor of size :attr:`size` filled with :attr:`fill_value`. The +tensor's dtype is inferred from :attr:`fill_value`. + +Args: + size (int...): a list, tuple, or :class:`torch.Size` of integers defining the + shape of the output tensor. + fill_value (Scalar): the value to fill the output tensor with. + +Keyword args: + {out} + {dtype} + {layout} + {device} + {requires_grad} + +Example:: + + >>> torch.full((2, 3), 3.141592) + tensor([[ 3.1416, 3.1416, 3.1416], + [ 3.1416, 3.1416, 3.1416]]) +""".format(**factory_common_args), +) + +add_docstr( + torch.full_like, + """ +full_like(input, fill_value, \\*, dtype=None, layout=torch.strided, device=None, requires_grad=False, \ +memory_format=torch.preserve_format) -> Tensor + +Returns a tensor with the same size as :attr:`input` filled with :attr:`fill_value`. +``torch.full_like(input, fill_value)`` is equivalent to +``torch.full(input.size(), fill_value, dtype=input.dtype, layout=input.layout, device=input.device)``. + +Args: + {input} + fill_value: the number to fill the output tensor with. + +Keyword args: + {dtype} + {layout} + {device} + {requires_grad} + {memory_format} + +Example:: + + >>> x = torch.ones(2, 3) + >>> torch.full_like(x, 3.141592) + tensor([[ 3.1416, 3.1416, 3.1416], + [ 3.1416, 3.1416, 3.1416]]) + >>> torch.full_like(x, 7) + tensor([[7., 7., 7.], + [7., 7., 7.]]) + >>> torch.full_like(x, 0.5, dtype=torch.int32) + tensor([[0, 0, 0], + [0, 0, 0]], dtype=torch.int32) + >>> y = torch.randn(3, 4, dtype=torch.float64) + >>> torch.full_like(y, -1.0) + tensor([[-1., -1., -1., -1.], + [-1., -1., -1., -1.], + [-1., -1., -1., -1.]], dtype=torch.float64) +""".format(**factory_like_common_args), +) + +add_docstr( + torch.det, + r""" +det(input) -> Tensor + +Alias for :func:`torch.linalg.det` +""", +) + +add_docstr( + torch.where, + r""" +where(condition, input, other, *, out=None) -> Tensor + +Return a tensor of elements selected from either :attr:`input` or :attr:`other`, depending on :attr:`condition`. + +The operation is defined as: + +.. math:: + \text{out}_i = \begin{cases} + \text{input}_i & \text{if } \text{condition}_i \\ + \text{other}_i & \text{otherwise} \\ + \end{cases} +""" + + r""" +.. note:: + The tensors :attr:`condition`, :attr:`input`, :attr:`other` must be :ref:`broadcastable `. + +Arguments: + condition (BoolTensor): When True (nonzero), yield input, otherwise yield other + input (Tensor or Scalar): value (if :attr:`input` is a scalar) or values selected at indices + where :attr:`condition` is ``True`` + other (Tensor or Scalar): value (if :attr:`other` is a scalar) or values selected at indices + where :attr:`condition` is ``False`` + +Keyword args: + {out} + +Returns: + Tensor: A tensor of shape equal to the broadcasted shape of :attr:`condition`, :attr:`input`, :attr:`other` + +Example:: + + >>> x = torch.randn(3, 2) + >>> y = torch.ones(3, 2) + >>> x + tensor([[-0.4620, 0.3139], + [ 0.3898, -0.7197], + [ 0.0478, -0.1657]]) + >>> torch.where(x > 0, 1.0, 0.0) + tensor([[0., 1.], + [1., 0.], + [1., 0.]]) + >>> torch.where(x > 0, x, y) + tensor([[ 1.0000, 0.3139], + [ 0.3898, 1.0000], + [ 0.0478, 1.0000]]) + >>> x = torch.randn(2, 2, dtype=torch.double) + >>> x + tensor([[ 1.0779, 0.0383], + [-0.8785, -1.1089]], dtype=torch.float64) + >>> torch.where(x > 0, x, 0.) + tensor([[1.0779, 0.0383], + [0.0000, 0.0000]], dtype=torch.float64) + +.. function:: where(condition) -> tuple of LongTensor + :noindex: + +``torch.where(condition)`` is identical to +``torch.nonzero(condition, as_tuple=True)``. + +.. note:: + See also :func:`torch.nonzero`. +""".format(**common_args), +) + +add_docstr( + torch.logdet, + r""" +logdet(input) -> Tensor + +Calculates log determinant of a square matrix or batches of square matrices. + +It returns ``-inf`` if the input has a determinant of zero, and ``NaN`` if it has +a negative determinant. + +.. note:: + Backward through :meth:`logdet` internally uses SVD results when :attr:`input` + is not invertible. In this case, double backward through :meth:`logdet` will + be unstable in when :attr:`input` doesn't have distinct singular values. See + :func:`torch.linalg.svd` for details. + +.. seealso:: + + :func:`torch.linalg.slogdet` computes the sign (resp. angle) and natural logarithm of the + absolute value of the determinant of real-valued (resp. complex) square matrices. + +Arguments: + input (Tensor): the input tensor of size ``(*, n, n)`` where ``*`` is zero or more + batch dimensions. + +Example:: + + >>> A = torch.randn(3, 3) + >>> torch.det(A) + tensor(0.2611) + >>> torch.logdet(A) + tensor(-1.3430) + >>> A + tensor([[[ 0.9254, -0.6213], + [-0.5787, 1.6843]], + + [[ 0.3242, -0.9665], + [ 0.4539, -0.0887]], + + [[ 1.1336, -0.4025], + [-0.7089, 0.9032]]]) + >>> A.det() + tensor([1.1990, 0.4099, 0.7386]) + >>> A.det().log() + tensor([ 0.1815, -0.8917, -0.3031]) +""", +) + +add_docstr( + torch.slogdet, + r""" +slogdet(input) -> (Tensor, Tensor) + +Alias for :func:`torch.linalg.slogdet` +""", +) + +add_docstr( + torch.pinverse, + r""" +pinverse(input, rcond=1e-15) -> Tensor + +Alias for :func:`torch.linalg.pinv` +""", +) + +add_docstr( + torch.hann_window, + """ +hann_window(window_length, periodic=True, *, dtype=None, \ +layout=torch.strided, device=None, requires_grad=False) -> Tensor +""" + + r""" +Hann window function. + +.. math:: + w[n] = \frac{1}{2}\ \left[1 - \cos \left( \frac{2 \pi n}{N - 1} \right)\right] = + \sin^2 \left( \frac{\pi n}{N - 1} \right), + +where :math:`N` is the full window size. + +The input :attr:`window_length` is a positive integer controlling the +returned window size. :attr:`periodic` flag determines whether the returned +window trims off the last duplicate value from the symmetric window and is +ready to be used as a periodic window with functions like +:meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in +above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have +``torch.hann_window(L, periodic=True)`` equal to +``torch.hann_window(L + 1, periodic=False)[:-1])``. + +.. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. +""" + + r""" +Arguments: + window_length (int): the size of returned window + periodic (bool, optional): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + +Keyword args: + {dtype} Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + {device} + {requires_grad} + +Returns: + Tensor: A 1-D tensor of size :math:`(\text{{window\_length}},)` containing the window + +""".format(**factory_common_args), +) + + +add_docstr( + torch.hamming_window, + """ +hamming_window(window_length, *, dtype=None, layout=None, device=None, pin_memory=False, \ +requires_grad=False) -> Tensor +""" + + r""" +Hamming window function. + +.. math:: + w[n] = \alpha - \beta\ \cos \left( \frac{2 \pi n}{N - 1} \right), + +where :math:`N` is the full window size. + +The input :attr:`window_length` is a positive integer controlling the +returned window size. :attr:`periodic` flag determines whether the returned +window trims off the last duplicate value from the symmetric window and is +ready to be used as a periodic window with functions like +:meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in +above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have +``torch.hamming_window(L, periodic=True)`` equal to +``torch.hamming_window(L + 1, periodic=False)[:-1])``. + +.. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. + +.. note:: + This is a generalized version of :meth:`torch.hann_window`. +""" + + r""" +Arguments: + window_length (int): the size of returned window + +Keyword args: + {dtype} Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + {device} + {pin_memory} + {requires_grad} + +Returns: + Tensor: A 1-D tensor of size :math:`(\text{{window\_length}},)` containing the window. + +.. function:: hamming_window(window_length, periodic, *, dtype=None, layout=None, device=None, \ + pin_memory=False, requires_grad=False) -> Tensor + :noindex: + +Hamming window function with periodic specified. + +Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + +Keyword args: + {dtype} Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + {device} + {pin_memory} + {requires_grad} + +Returns: + Tensor: A 1-D tensor of size :math:`(\text{{window\_length}},)` containing the window. + +.. function:: hamming_window(window_length, periodic, float alpha, *, dtype=None, layout=None, device=None, \ + pin_memory=False, requires_grad=False) -> Tensor + :noindex: + +Hamming window function with periodic and alpha specified. + +Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + alpha (float): The coefficient :math:`\alpha` in the equation above + +Keyword args: + {dtype} Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + {device} + {pin_memory} + {requires_grad} + +Returns: + Tensor: A 1-D tensor of size :math:`(\text{{window\_length}},)` containing the window. + +.. function:: hamming_window(window_length, periodic, float alpha, float beta, *, dtype=None, layout=None, \ + device=None, pin_memory=False, requires_grad=False) -> Tensor + :noindex: + +Hamming window function with periodic, alpha and beta specified. + +Arguments: + window_length (int): the size of returned window + periodic (bool): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + alpha (float): The coefficient :math:`\alpha` in the equation above + beta (float): The coefficient :math:`\beta` in the equation above + +Keyword args: + {dtype} Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + {device} + {pin_memory} + {requires_grad} + +Returns: + Tensor: A 1-D tensor of size :math:`(\text{{window\_length}},)` containing the window. + +""".format(**factory_common_args), +) + + +add_docstr( + torch.bartlett_window, + """ +bartlett_window(window_length, periodic=True, *, dtype=None, \ +layout=torch.strided, device=None, requires_grad=False) -> Tensor +""" + + r""" +Bartlett window function. + +.. math:: + w[n] = 1 - \left| \frac{2n}{N-1} - 1 \right| = \begin{cases} + \frac{2n}{N - 1} & \text{if } 0 \leq n \leq \frac{N - 1}{2} \\ + 2 - \frac{2n}{N - 1} & \text{if } \frac{N - 1}{2} < n < N \\ + \end{cases}, + +where :math:`N` is the full window size. + +The input :attr:`window_length` is a positive integer controlling the +returned window size. :attr:`periodic` flag determines whether the returned +window trims off the last duplicate value from the symmetric window and is +ready to be used as a periodic window with functions like +:meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in +above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have +``torch.bartlett_window(L, periodic=True)`` equal to +``torch.bartlett_window(L + 1, periodic=False)[:-1])``. + +.. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. +""" + + r""" +Arguments: + window_length (int): the size of returned window + periodic (bool, optional): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + +Keyword args: + {dtype} Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + {device} + {requires_grad} + +Returns: + Tensor: A 1-D tensor of size :math:`(\text{{window\_length}},)` containing the window + +""".format(**factory_common_args), +) + + +add_docstr( + torch.blackman_window, + """ +blackman_window(window_length, periodic=True, *, dtype=None, \ +layout=torch.strided, device=None, requires_grad=False) -> Tensor +""" + + r""" +Blackman window function. + +.. math:: + w[n] = 0.42 - 0.5 \cos \left( \frac{2 \pi n}{N - 1} \right) + 0.08 \cos \left( \frac{4 \pi n}{N - 1} \right) + +where :math:`N` is the full window size. + +The input :attr:`window_length` is a positive integer controlling the +returned window size. :attr:`periodic` flag determines whether the returned +window trims off the last duplicate value from the symmetric window and is +ready to be used as a periodic window with functions like +:meth:`torch.stft`. Therefore, if :attr:`periodic` is true, the :math:`N` in +above formula is in fact :math:`\text{window\_length} + 1`. Also, we always have +``torch.blackman_window(L, periodic=True)`` equal to +``torch.blackman_window(L + 1, periodic=False)[:-1]``. + +.. note:: + If :attr:`window_length` :math:`=1`, the returned window contains a single value 1. +""" + + r""" +Arguments: + window_length (int): the size of returned window + periodic (bool, optional): If True, returns a window to be used as periodic + function. If False, return a symmetric window. + +Keyword args: + {dtype} Only floating point types are supported. + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + {device} + {requires_grad} + +Returns: + Tensor: A 1-D tensor of size :math:`(\text{{window\_length}},)` containing the window + +""".format(**factory_common_args), +) + + +add_docstr( + torch.kaiser_window, + """ +kaiser_window(window_length, periodic=True, beta=12.0, *, dtype=None, \ +layout=torch.strided, device=None, requires_grad=False) -> Tensor +""" + + r""" +Computes the Kaiser window with window length :attr:`window_length` and shape parameter :attr:`beta`. + +Let I_0 be the zeroth order modified Bessel function of the first kind (see :func:`torch.i0`) and +``N = L - 1`` if :attr:`periodic` is False and ``L`` if :attr:`periodic` is True, +where ``L`` is the :attr:`window_length`. This function computes: + +.. math:: + out_i = I_0 \left( \beta \sqrt{1 - \left( {\frac{i - N/2}{N/2}} \right) ^2 } \right) / I_0( \beta ) + +Calling ``torch.kaiser_window(L, B, periodic=True)`` is equivalent to calling +``torch.kaiser_window(L + 1, B, periodic=False)[:-1])``. +The :attr:`periodic` argument is intended as a helpful shorthand +to produce a periodic window as input to functions like :func:`torch.stft`. + +.. note:: + If :attr:`window_length` is one, then the returned window is a single element tensor containing a one. + +""" + + r""" +Args: + window_length (int): length of the window. + periodic (bool, optional): If True, returns a periodic window suitable for use in spectral analysis. + If False, returns a symmetric window suitable for use in filter design. + beta (float, optional): shape parameter for the window. + +Keyword args: + {dtype} + layout (:class:`torch.layout`, optional): the desired layout of returned window tensor. Only + ``torch.strided`` (dense layout) is supported. + {device} + {requires_grad} + +""".format(**factory_common_args), +) + + +add_docstr( + torch.vander, + """ +vander(x, N=None, increasing=False) -> Tensor +""" + + r""" +Generates a Vandermonde matrix. + +The columns of the output matrix are elementwise powers of the input vector :math:`x^{{(N-1)}}, x^{{(N-2)}}, ..., x^0`. +If increasing is True, the order of the columns is reversed :math:`x^0, x^1, ..., x^{{(N-1)}}`. Such a +matrix with a geometric progression in each row is named for Alexandre-Theophile Vandermonde. + +Arguments: + x (Tensor): 1-D input tensor. + N (int, optional): Number of columns in the output. If N is not specified, + a square array is returned :math:`(N = len(x))`. + increasing (bool, optional): Order of the powers of the columns. If True, + the powers increase from left to right, if False (the default) they are reversed. + +Returns: + Tensor: Vandermonde matrix. If increasing is False, the first column is :math:`x^{{(N-1)}}`, + the second :math:`x^{{(N-2)}}` and so forth. If increasing is True, the columns + are :math:`x^0, x^1, ..., x^{{(N-1)}}`. + +Example:: + + >>> x = torch.tensor([1, 2, 3, 5]) + >>> torch.vander(x) + tensor([[ 1, 1, 1, 1], + [ 8, 4, 2, 1], + [ 27, 9, 3, 1], + [125, 25, 5, 1]]) + >>> torch.vander(x, N=3) + tensor([[ 1, 1, 1], + [ 4, 2, 1], + [ 9, 3, 1], + [25, 5, 1]]) + >>> torch.vander(x, N=3, increasing=True) + tensor([[ 1, 1, 1], + [ 1, 2, 4], + [ 1, 3, 9], + [ 1, 5, 25]]) + +""".format(**factory_common_args), +) + + +add_docstr( + torch.unbind, + r""" +unbind(input, dim=0) -> seq + +Removes a tensor dimension. + +Returns a tuple of all slices along a given dimension, already without it. + +Arguments: + input (Tensor): the tensor to unbind + dim (int): dimension to remove + +Example:: + + >>> torch.unbind(torch.tensor([[1, 2, 3], + >>> [4, 5, 6], + >>> [7, 8, 9]])) + (tensor([1, 2, 3]), tensor([4, 5, 6]), tensor([7, 8, 9])) +""", +) + + +add_docstr( + torch.combinations, + r""" +combinations(input: Tensor, r: int = 2, with_replacement: bool = False) -> seq + +Compute combinations of length :math:`r` of the given tensor. The behavior is similar to +python's `itertools.combinations` when `with_replacement` is set to `False`, and +`itertools.combinations_with_replacement` when `with_replacement` is set to `True`. + +Arguments: + input (Tensor): 1D vector. + r (int, optional): number of elements to combine + with_replacement (bool, optional): whether to allow duplication in combination + +Returns: + Tensor: A tensor equivalent to converting all the input tensors into lists, do + `itertools.combinations` or `itertools.combinations_with_replacement` on these + lists, and finally convert the resulting list into tensor. + +Example:: + + >>> a = [1, 2, 3] + >>> list(itertools.combinations(a, r=2)) + [(1, 2), (1, 3), (2, 3)] + >>> list(itertools.combinations(a, r=3)) + [(1, 2, 3)] + >>> list(itertools.combinations_with_replacement(a, r=2)) + [(1, 1), (1, 2), (1, 3), (2, 2), (2, 3), (3, 3)] + >>> tensor_a = torch.tensor(a) + >>> torch.combinations(tensor_a) + tensor([[1, 2], + [1, 3], + [2, 3]]) + >>> torch.combinations(tensor_a, r=3) + tensor([[1, 2, 3]]) + >>> torch.combinations(tensor_a, with_replacement=True) + tensor([[1, 1], + [1, 2], + [1, 3], + [2, 2], + [2, 3], + [3, 3]]) + +""", +) + +add_docstr( + torch.trapezoid, + r""" +trapezoid(y, x=None, *, dx=None, dim=-1) -> Tensor + +Computes the `trapezoidal rule `_ along +:attr:`dim`. By default the spacing between elements is assumed to be 1, but +:attr:`dx` can be used to specify a different constant spacing, and :attr:`x` can be +used to specify arbitrary spacing along :attr:`dim`. Only one of :attr:`x` or :attr:`dx` should be specified. + + +Assuming :attr:`y` is a one-dimensional tensor with elements :math:`{y_0, y_1, ..., y_n}`, +the default computation is + +.. math:: + \begin{aligned} + \sum_{i = 1}^{n} \frac{1}{2} (y_i + y_{i-1}) + \end{aligned} + +When :attr:`dx` is specified the computation becomes + +.. math:: + \begin{aligned} + \sum_{i = 1}^{n} \frac{\Delta x}{2} (y_i + y_{i-1}) + \end{aligned} + +effectively multiplying the result by :attr:`dx`. When :attr:`x` is specified, +assuming :attr:`x` is also a one-dimensional tensor with +elements :math:`{x_0, x_1, ..., x_n}`, the computation becomes + +.. math:: + \begin{aligned} + \sum_{i = 1}^{n} \frac{(x_i - x_{i-1})}{2} (y_i + y_{i-1}) + \end{aligned} + +When :attr:`x` and :attr:`y` have the same size, the computation is as described above and no broadcasting is needed. +The broadcasting behavior of this function is as follows when their sizes are different. For both :attr:`x` +and :attr:`y`, the function computes the difference between consecutive elements along +dimension :attr:`dim`. This effectively creates two tensors, `x_diff` and `y_diff`, that have +the same shape as the original tensors except their lengths along the dimension :attr:`dim` is reduced by 1. +After that, those two tensors are broadcast together to compute final output as part of the trapezoidal rule. +See the examples below for details. + +.. note:: + The trapezoidal rule is a technique for approximating the definite integral of a function + by averaging its left and right Riemann sums. The approximation becomes more accurate as + the resolution of the partition increases. + +Arguments: + y (Tensor): Values to use when computing the trapezoidal rule. + x (Tensor): If specified, defines spacing between values as specified above. + +Keyword arguments: + dx (float): constant spacing between values. If neither :attr:`x` or :attr:`dx` + are specified then this defaults to 1. Effectively multiplies the result by its value. + dim (int): The dimension along which to compute the trapezoidal rule. + The last (inner-most) dimension by default. + +Examples:: + + >>> # Computes the trapezoidal rule in 1D, spacing is implicitly 1 + >>> y = torch.tensor([1, 5, 10]) + >>> torch.trapezoid(y) + tensor(10.5) + + >>> # Computes the same trapezoidal rule directly to verify + >>> (1 + 10 + 10) / 2 + 10.5 + + >>> # Computes the trapezoidal rule in 1D with constant spacing of 2 + >>> # NOTE: the result is the same as before, but multiplied by 2 + >>> torch.trapezoid(y, dx=2) + 21.0 + + >>> # Computes the trapezoidal rule in 1D with arbitrary spacing + >>> x = torch.tensor([1, 3, 6]) + >>> torch.trapezoid(y, x) + 28.5 + + >>> # Computes the same trapezoidal rule directly to verify + >>> ((3 - 1) * (1 + 5) + (6 - 3) * (5 + 10)) / 2 + 28.5 + + >>> # Computes the trapezoidal rule for each row of a 3x3 matrix + >>> y = torch.arange(9).reshape(3, 3) + tensor([[0, 1, 2], + [3, 4, 5], + [6, 7, 8]]) + >>> torch.trapezoid(y) + tensor([ 2., 8., 14.]) + + >>> # Computes the trapezoidal rule for each column of the matrix + >>> torch.trapezoid(y, dim=0) + tensor([ 6., 8., 10.]) + + >>> # Computes the trapezoidal rule for each row of a 3x3 ones matrix + >>> # with the same arbitrary spacing + >>> y = torch.ones(3, 3) + >>> x = torch.tensor([1, 3, 6]) + >>> torch.trapezoid(y, x) + array([5., 5., 5.]) + + >>> # Computes the trapezoidal rule for each row of a 3x3 ones matrix + >>> # with different arbitrary spacing per row + >>> y = torch.ones(3, 3) + >>> x = torch.tensor([[1, 2, 3], [1, 3, 5], [1, 4, 7]]) + >>> torch.trapezoid(y, x) + array([2., 4., 6.]) +""", +) + +add_docstr( + torch.trapz, + r""" +trapz(y, x, *, dim=-1) -> Tensor + +Alias for :func:`torch.trapezoid`. +""", +) + +add_docstr( + torch.cumulative_trapezoid, + r""" +cumulative_trapezoid(y, x=None, *, dx=None, dim=-1) -> Tensor + +Cumulatively computes the `trapezoidal rule `_ +along :attr:`dim`. By default the spacing between elements is assumed to be 1, but +:attr:`dx` can be used to specify a different constant spacing, and :attr:`x` can be +used to specify arbitrary spacing along :attr:`dim`. + +For more details, please read :func:`torch.trapezoid`. The difference between :func:`torch.trapezoid` +and this function is that, :func:`torch.trapezoid` returns a value for each integration, +where as this function returns a cumulative value for every spacing within the integration. This +is analogous to how `.sum` returns a value and `.cumsum` returns a cumulative sum. + +Arguments: + y (Tensor): Values to use when computing the trapezoidal rule. + x (Tensor): If specified, defines spacing between values as specified above. + +Keyword arguments: + dx (float): constant spacing between values. If neither :attr:`x` or :attr:`dx` + are specified then this defaults to 1. Effectively multiplies the result by its value. + dim (int): The dimension along which to compute the trapezoidal rule. + The last (inner-most) dimension by default. + +Examples:: + + >>> # Cumulatively computes the trapezoidal rule in 1D, spacing is implicitly 1. + >>> y = torch.tensor([1, 5, 10]) + >>> torch.cumulative_trapezoid(y) + tensor([3., 10.5]) + + >>> # Computes the same trapezoidal rule directly up to each element to verify + >>> (1 + 5) / 2 + 3.0 + >>> (1 + 10 + 10) / 2 + 10.5 + + >>> # Cumulatively computes the trapezoidal rule in 1D with constant spacing of 2 + >>> # NOTE: the result is the same as before, but multiplied by 2 + >>> torch.cumulative_trapezoid(y, dx=2) + tensor([6., 21.]) + + >>> # Cumulatively computes the trapezoidal rule in 1D with arbitrary spacing + >>> x = torch.tensor([1, 3, 6]) + >>> torch.cumulative_trapezoid(y, x) + tensor([6., 28.5]) + + >>> # Computes the same trapezoidal rule directly up to each element to verify + >>> ((3 - 1) * (1 + 5)) / 2 + 6.0 + >>> ((3 - 1) * (1 + 5) + (6 - 3) * (5 + 10)) / 2 + 28.5 + + >>> # Cumulatively computes the trapezoidal rule for each row of a 3x3 matrix + >>> y = torch.arange(9).reshape(3, 3) + tensor([[0, 1, 2], + [3, 4, 5], + [6, 7, 8]]) + >>> torch.cumulative_trapezoid(y) + tensor([[ 0.5, 2.], + [ 3.5, 8.], + [ 6.5, 14.]]) + + >>> # Cumulatively computes the trapezoidal rule for each column of the matrix + >>> torch.cumulative_trapezoid(y, dim=0) + tensor([[ 1.5, 2.5, 3.5], + [ 6.0, 8.0, 10.0]]) + + >>> # Cumulatively computes the trapezoidal rule for each row of a 3x3 ones matrix + >>> # with the same arbitrary spacing + >>> y = torch.ones(3, 3) + >>> x = torch.tensor([1, 3, 6]) + >>> torch.cumulative_trapezoid(y, x) + tensor([[2., 5.], + [2., 5.], + [2., 5.]]) + + >>> # Cumulatively computes the trapezoidal rule for each row of a 3x3 ones matrix + >>> # with different arbitrary spacing per row + >>> y = torch.ones(3, 3) + >>> x = torch.tensor([[1, 2, 3], [1, 3, 5], [1, 4, 7]]) + >>> torch.cumulative_trapezoid(y, x) + tensor([[1., 2.], + [2., 4.], + [3., 6.]]) +""", +) + +add_docstr( + torch.repeat_interleave, + r""" +repeat_interleave(input, repeats, dim=None, *, output_size=None) -> Tensor + +Repeat elements of a tensor. + +.. warning:: + + This is different from :meth:`torch.Tensor.repeat` but similar to ``numpy.repeat``. + +Args: + {input} + repeats (Tensor or int): The number of repetitions for each element. + repeats is broadcasted to fit the shape of the given axis. + dim (int, optional): The dimension along which to repeat values. + By default, use the flattened input array, and return a flat output + array. + +Keyword args: + output_size (int, optional): Total output size for the given axis + ( e.g. sum of repeats). If given, it will avoid stream synchronization + needed to calculate output shape of the tensor. + +Returns: + Tensor: Repeated tensor which has the same shape as input, except along the given axis. + +Example:: + + >>> x = torch.tensor([1, 2, 3]) + >>> x.repeat_interleave(2) + tensor([1, 1, 2, 2, 3, 3]) + >>> y = torch.tensor([[1, 2], [3, 4]]) + >>> torch.repeat_interleave(y, 2) + tensor([1, 1, 2, 2, 3, 3, 4, 4]) + >>> torch.repeat_interleave(y, 3, dim=1) + tensor([[1, 1, 1, 2, 2, 2], + [3, 3, 3, 4, 4, 4]]) + >>> torch.repeat_interleave(y, torch.tensor([1, 2]), dim=0) + tensor([[1, 2], + [3, 4], + [3, 4]]) + >>> torch.repeat_interleave(y, torch.tensor([1, 2]), dim=0, output_size=3) + tensor([[1, 2], + [3, 4], + [3, 4]]) + +If the `repeats` is `tensor([n1, n2, n3, ...])`, then the output will be +`tensor([0, 0, ..., 1, 1, ..., 2, 2, ..., ...])` where `0` appears `n1` times, +`1` appears `n2` times, `2` appears `n3` times, etc. + +.. function:: repeat_interleave(repeats, *) -> Tensor + :noindex: + +Repeats 0 repeats[0] times, 1 repeats[1] times, 2 repeats[2] times, etc. + +Args: + repeats (Tensor): The number of repetitions for each element. + +Returns: + Tensor: Repeated tensor of size `sum(repeats)`. + +Example:: + + >>> torch.repeat_interleave(torch.tensor([1, 2, 3])) + tensor([0, 1, 1, 2, 2, 2]) + +""".format(**common_args), +) + +add_docstr( + torch.tile, + r""" +tile(input, dims) -> Tensor + +Constructs a tensor by repeating the elements of :attr:`input`. +The :attr:`dims` argument specifies the number of repetitions +in each dimension. + +If :attr:`dims` specifies fewer dimensions than :attr:`input` has, then +ones are prepended to :attr:`dims` until all dimensions are specified. +For example, if :attr:`input` has shape (8, 6, 4, 2) and :attr:`dims` +is (2, 2), then :attr:`dims` is treated as (1, 1, 2, 2). + +Analogously, if :attr:`input` has fewer dimensions than :attr:`dims` +specifies, then :attr:`input` is treated as if it were unsqueezed at +dimension zero until it has as many dimensions as :attr:`dims` specifies. +For example, if :attr:`input` has shape (4, 2) and :attr:`dims` +is (3, 3, 2, 2), then :attr:`input` is treated as if it had the +shape (1, 1, 4, 2). + +.. note:: + + This function is similar to NumPy's tile function. + +Args: + input (Tensor): the tensor whose elements to repeat. + dims (tuple): the number of repetitions per dimension. + +Example:: + + >>> x = torch.tensor([1, 2, 3]) + >>> x.tile((2,)) + tensor([1, 2, 3, 1, 2, 3]) + >>> y = torch.tensor([[1, 2], [3, 4]]) + >>> torch.tile(y, (2, 2)) + tensor([[1, 2, 1, 2], + [3, 4, 3, 4], + [1, 2, 1, 2], + [3, 4, 3, 4]]) +""", +) + +add_docstr( + torch.quantize_per_tensor, + r""" +quantize_per_tensor(input, scale, zero_point, dtype) -> Tensor + +Converts a float tensor to a quantized tensor with given scale and zero point. + +Arguments: + input (Tensor): float tensor or list of tensors to quantize + scale (float or Tensor): scale to apply in quantization formula + zero_point (int or Tensor): offset in integer value that maps to float zero + dtype (:class:`torch.dtype`): the desired data type of returned tensor. + Has to be one of the quantized dtypes: ``torch.quint8``, ``torch.qint8``, ``torch.qint32`` + +Returns: + Tensor: A newly quantized tensor or list of quantized tensors. + +Example:: + + >>> torch.quantize_per_tensor(torch.tensor([-1.0, 0.0, 1.0, 2.0]), 0.1, 10, torch.quint8) + tensor([-1., 0., 1., 2.], size=(4,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.1, zero_point=10) + >>> torch.quantize_per_tensor(torch.tensor([-1.0, 0.0, 1.0, 2.0]), 0.1, 10, torch.quint8).int_repr() + tensor([ 0, 10, 20, 30], dtype=torch.uint8) + >>> torch.quantize_per_tensor([torch.tensor([-1.0, 0.0]), torch.tensor([-2.0, 2.0])], + >>> torch.tensor([0.1, 0.2]), torch.tensor([10, 20]), torch.quint8) + (tensor([-1., 0.], size=(2,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.1, zero_point=10), + tensor([-2., 2.], size=(2,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.2, zero_point=20)) + >>> torch.quantize_per_tensor(torch.tensor([-1.0, 0.0, 1.0, 2.0]), torch.tensor(0.1), torch.tensor(10), torch.quint8) + tensor([-1., 0., 1., 2.], size=(4,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.10, zero_point=10) +""", +) + +add_docstr( + torch.quantize_per_tensor_dynamic, + r""" +quantize_per_tensor_dynamic(input, dtype, reduce_range) -> Tensor + +Converts a float tensor to a quantized tensor with scale and zero_point calculated +dynamically based on the input. + +Arguments: + input (Tensor): float tensor or list of tensors to quantize + dtype (:class:`torch.dtype`): the desired data type of returned tensor. + Has to be one of the quantized dtypes: ``torch.quint8``, ``torch.qint8`` + reduce_range (bool): a flag to indicate whether to reduce the range of quantized + data by 1 bit, it's required to avoid instruction overflow for some hardwares + +Returns: + Tensor: A newly (dynamically) quantized tensor + +Example:: + + >>> t = torch.quantize_per_tensor_dynamic(torch.tensor([-1.0, 0.0, 1.0, 2.0]), torch.quint8, False) + >>> print(t) + tensor([-1., 0., 1., 2.], size=(4,), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.011764705882352941, + zero_point=85) + >>> t.int_repr() + tensor([ 0, 85, 170, 255], dtype=torch.uint8) +""", +) + +add_docstr( + torch.quantize_per_channel, + r""" +quantize_per_channel(input, scales, zero_points, axis, dtype) -> Tensor + +Converts a float tensor to a per-channel quantized tensor with given scales and zero points. + +Arguments: + input (Tensor): float tensor to quantize + scales (Tensor): float 1D tensor of scales to use, size should match ``input.size(axis)`` + zero_points (int): integer 1D tensor of offset to use, size should match ``input.size(axis)`` + axis (int): dimension on which apply per-channel quantization + dtype (:class:`torch.dtype`): the desired data type of returned tensor. + Has to be one of the quantized dtypes: ``torch.quint8``, ``torch.qint8``, ``torch.qint32`` + +Returns: + Tensor: A newly quantized tensor + +Example:: + + >>> x = torch.tensor([[-1.0, 0.0], [1.0, 2.0]]) + >>> torch.quantize_per_channel(x, torch.tensor([0.1, 0.01]), torch.tensor([10, 0]), 0, torch.quint8) + tensor([[-1., 0.], + [ 1., 2.]], size=(2, 2), dtype=torch.quint8, + quantization_scheme=torch.per_channel_affine, + scale=tensor([0.1000, 0.0100], dtype=torch.float64), + zero_point=tensor([10, 0]), axis=0) + >>> torch.quantize_per_channel(x, torch.tensor([0.1, 0.01]), torch.tensor([10, 0]), 0, torch.quint8).int_repr() + tensor([[ 0, 10], + [100, 200]], dtype=torch.uint8) +""", +) + + +add_docstr( + torch.quantized_batch_norm, + r""" +quantized_batch_norm(input, weight=None, bias=None, mean, var, eps, output_scale, output_zero_point) -> Tensor + +Applies batch normalization on a 4D (NCHW) quantized tensor. + +.. math:: + + y = \frac{x - \mathrm{E}[x]}{\sqrt{\mathrm{Var}[x] + \epsilon}} * \gamma + \beta + +Arguments: + input (Tensor): quantized tensor + weight (Tensor): float tensor that corresponds to the gamma, size C + bias (Tensor): float tensor that corresponds to the beta, size C + mean (Tensor): float mean value in batch normalization, size C + var (Tensor): float tensor for variance, size C + eps (float): a value added to the denominator for numerical stability. + output_scale (float): output quantized tensor scale + output_zero_point (int): output quantized tensor zero_point + +Returns: + Tensor: A quantized tensor with batch normalization applied. + +Example:: + + >>> qx = torch.quantize_per_tensor(torch.rand(2, 2, 2, 2), 1.5, 3, torch.quint8) + >>> torch.quantized_batch_norm(qx, torch.ones(2), torch.zeros(2), torch.rand(2), torch.rand(2), 0.00001, 0.2, 2) + tensor([[[[-0.2000, -0.2000], + [ 1.6000, -0.2000]], + + [[-0.4000, -0.4000], + [-0.4000, 0.6000]]], + + + [[[-0.2000, -0.2000], + [-0.2000, -0.2000]], + + [[ 0.6000, -0.4000], + [ 0.6000, -0.4000]]]], size=(2, 2, 2, 2), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=0.2, zero_point=2) +""", +) + + +add_docstr( + torch.quantized_max_pool1d, + r""" +quantized_max_pool1d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False) -> Tensor + +Applies a 1D max pooling over an input quantized tensor composed of several input planes. + +Arguments: + input (Tensor): quantized tensor + kernel_size (list of int): the size of the sliding window + stride (``list of int``, optional): the stride of the sliding window + padding (``list of int``, optional): padding to be added on both sides, must be >= 0 and <= kernel_size / 2 + dilation (``list of int``, optional): The stride between elements within a sliding window, must be > 0. Default 1 + ceil_mode (bool, optional): If True, will use ceil instead of floor to compute the output shape. + Defaults to False. + + +Returns: + Tensor: A quantized tensor with max_pool1d applied. + +Example:: + + >>> qx = torch.quantize_per_tensor(torch.rand(2, 2), 1.5, 3, torch.quint8) + >>> torch.quantized_max_pool1d(qx, [2]) + tensor([[0.0000], + [1.5000]], size=(2, 1), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=1.5, zero_point=3) +""", +) + + +add_docstr( + torch.quantized_max_pool2d, + r""" +quantized_max_pool2d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False) -> Tensor + +Applies a 2D max pooling over an input quantized tensor composed of several input planes. + +Arguments: + input (Tensor): quantized tensor + kernel_size (``list of int``): the size of the sliding window + stride (``list of int``, optional): the stride of the sliding window + padding (``list of int``, optional): padding to be added on both sides, must be >= 0 and <= kernel_size / 2 + dilation (``list of int``, optional): The stride between elements within a sliding window, must be > 0. Default 1 + ceil_mode (bool, optional): If True, will use ceil instead of floor to compute the output shape. + Defaults to False. + + +Returns: + Tensor: A quantized tensor with max_pool2d applied. + +Example:: + + >>> qx = torch.quantize_per_tensor(torch.rand(2, 2, 2, 2), 1.5, 3, torch.quint8) + >>> torch.quantized_max_pool2d(qx, [2,2]) + tensor([[[[1.5000]], + + [[1.5000]]], + + + [[[0.0000]], + + [[0.0000]]]], size=(2, 2, 1, 1), dtype=torch.quint8, + quantization_scheme=torch.per_tensor_affine, scale=1.5, zero_point=3) +""", +) + + +add_docstr( + torch.Stream, + r""" +Stream(device, *, priority) -> Stream + +An in-order queue of executing the respective tasks asynchronously in first in first out (FIFO) order. +It can control or synchronize the execution of other Stream or block the current host thread to ensure +the correct task sequencing. It supports with statement as a context manager to ensure the operators +within the with block are running on the corresponding stream. + +See in-depth description of the CUDA behavior at :ref:`cuda-semantics` for details +on the exact semantic that applies to all devices. + +Arguments: + device (:class:`torch.device`, optional): the desired device for the Stream. + If not given, the current :ref:`accelerator` type will be used. + priority (int, optional): priority of the stream, should be 0 or negative, where negative + numbers indicate higher priority. By default, streams have priority 0. + +Returns: + Stream: An torch.Stream object. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> with torch.Stream(device='cuda') as s_cuda: + >>> a = torch.randn(10, 5, device='cuda') + >>> b = torch.randn(5, 10, device='cuda') + >>> c = torch.mm(a, b) +""", +) + + +add_docstr( + torch.Stream.query, + r""" +Stream.query() -> bool + +Check if all the work submitted has been completed. + +Returns: + bool: A boolean indicating if all kernels in this stream are completed. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> s_cuda = torch.Stream(device='cuda') + >>> s_cuda.query() + True +""", +) + + +add_docstr( + torch.Stream.record_event, + r""" +Stream.record_event(event) -> Event + +Record an event. En-queuing it into the Stream to allow further synchronization from the current point in the FIFO queue. + +Arguments: + event (:class:`torch.Event`, optional): event to record. If not given, a new one will be allocated. + +Returns: + Event: Recorded event. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> s_cuda = torch.Stream(device='cuda') + >>> e_cuda = s_cuda.record_event() +""", +) + + +add_docstr( + torch.Stream.synchronize, + r""" +Stream.synchronize() -> None + +Wait for all the kernels in this stream to complete. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> s_cuda = torch.Stream(device='cuda') + >>> s_cuda.synchronize() +""", +) + + +add_docstr( + torch.Stream.wait_event, + r""" +Stream.wait_event(event) -> None + +Make all future work submitted to the stream wait for an event. + +Arguments: + event (:class:`torch.Event`): an event to wait for. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> s1_cuda = torch.Stream(device='cuda') + >>> s2_cuda = torch.Stream(device='cuda') + >>> e_cuda = s1_cuda.record_event() + >>> s2_cuda.wait_event(e_cuda) +""", +) + + +add_docstr( + torch.Stream.wait_stream, + r""" +Stream.wait_stream(stream) -> None + +Synchronize with another stream. All future work submitted to this stream will wait until all kernels +already submitted to the given stream are completed. + +Arguments: + stream (:class:`torch.Stream`): a stream to synchronize. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> s1_cuda = torch.Stream(device='cuda') + >>> s2_cuda = torch.Stream(device='cuda') + >>> s2_cuda.wait_stream(s1_cuda) +""", +) + + +add_docstr( + torch.Event, + r""" +Event(device=None, *, enable_timing=False, blocking=False, interprocess=False) + +Query and record Stream status to identify or control dependencies across Stream and measure timing. + +Arguments: + device (:class:`torch.device`, optional): the desired device for the Event. + If not given, the current :ref:`accelerator` type will be used. + enable_timing (bool, optional): indicates if the event should measure time (default: ``False``) + blocking (bool, optional): if ``True``, :meth:`wait` will be blocking (default: ``False``) + interprocess (bool): if ``True``, the event can be shared between processes (default: ``False``) + +.. warning:: + + Both blocking and interprocess are not supported right now and are noops. + +Returns: + Event: An torch.Event object. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> event = torch.Event() + >>> e_cuda = torch.Event(device='cuda') +""", +) + + +add_docstr( + torch.Event.elapsed_time, + r""" +Event.elapsed_time(end_event) -> float + +Returns the elapsed time in milliseconds between when this event and the :attr:`end_event` are +each recorded via :func:`torch.Stream.record_event`. + +Arguments: + end_event (:class:`torch.Event`): The ending event has been recorded. + +Returns: + float: Time between starting and ending event in milliseconds. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> s_cuda = torch.Stream(device='cuda') + >>> e1_cuda = s_cuda.record_event() + >>> e2_cuda = s_cuda.record_event() + >>> ms = e1_cuda.elapsed_time(e2_cuda) +""", +) + + +add_docstr( + torch.Event.query, + r""" +Event.query() -> bool + +Check if the stream where this event was recorded already moved past the point where the event was recorded. +Always returns ``True`` if the Event was not recorded. + +Returns: + bool: A boolean indicating if all work currently captured by event has completed. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> s_cuda = torch.Stream(device='cuda') + >>> e_cuda = s_cuda.record_event() + >>> e_cuda.query() + True +""", +) + + +add_docstr( + torch.Event.record, + r""" +Event.record(stream=None) -> None + +Record the event in a given stream. The stream's device must match the event's device. +This function is equivalent to ``stream.record_event(self)``. + +Arguments: + stream (:class:`torch.Stream`, optional): A stream to be recorded. + If not given, the current stream will be used. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> e_cuda = torch.Event(device='cuda') + >>> e_cuda.record() +""", +) + + +add_docstr( + torch.Event.synchronize, + r""" +Event.synchronize() -> None + +Wait for the event to complete. This prevents the CPU thread from proceeding until the event completes. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> s_cuda = torch.Stream(device='cuda') + >>> e_cuda = s_cuda.record_event() + >>> e_cuda.synchronize() +""", +) + + +add_docstr( + torch.Event.wait, + r""" +Event.wait(stream=None) -> None + +Make all future work submitted to the given stream wait for this event. + +Arguments: + stream (:class:`torch.Stream`, optional): A stream to synchronize. + If not given, the current stream will be used. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> s1_cuda = torch.Stream(device='cuda') + >>> s2_cuda = torch.Stream(device='cuda') + >>> e_cuda = s1_cuda.record() + >>> e_cuda.wait(s2) +""", +) + + +add_docstr( + torch.Generator, + r""" +Generator(device='cpu') -> Generator + +Creates and returns a generator object that manages the state of the algorithm which +produces pseudo random numbers. Used as a keyword argument in many :ref:`inplace-random-sampling` +functions. + +Arguments: + device (:class:`torch.device`, optional): the desired device for the generator. + +Returns: + Generator: An torch.Generator object. + +Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> g_cpu = torch.Generator() + >>> g_cuda = torch.Generator(device='cuda') +""", +) + + +add_docstr( + torch.Generator.set_state, + r""" +Generator.set_state(new_state) -> void + +Sets the Generator state. + +Arguments: + new_state (torch.ByteTensor): The desired state. + +Example:: + + >>> g_cpu = torch.Generator() + >>> g_cpu_other = torch.Generator() + >>> g_cpu.set_state(g_cpu_other.get_state()) +""", +) + + +add_docstr( + torch.Generator.get_state, + r""" +Generator.get_state() -> Tensor + +Returns the Generator state as a ``torch.ByteTensor``. + +Returns: + Tensor: A ``torch.ByteTensor`` which contains all the necessary bits + to restore a Generator to a specific point in time. + +Example:: + + >>> g_cpu = torch.Generator() + >>> g_cpu.get_state() +""", +) + +add_docstr( + torch.Generator.graphsafe_set_state, + r""" +Generator.graphsafe_set_state(state) -> None + +Sets the state of the generator to the specified state in a manner that is safe for use in graph capture. +This method is crucial for ensuring that the generator's state can be captured in the CUDA graph. + +Arguments: + state (torch.Generator): A Generator point to the new state for the generator, typically obtained from `graphsafe_get_state`. + +Example: + >>> g_cuda = torch.Generator(device='cuda') + >>> g_cuda_other = torch.Generator(device='cuda') + >>> current_state = g_cuda_other.graphsafe_get_state() + >>> g_cuda.graphsafe_set_state(current_state) +""", +) + +add_docstr( + torch.Generator.graphsafe_get_state, + r""" +Generator.graphsafe_get_state() -> torch.Generator + +Retrieves the current state of the generator in a manner that is safe for graph capture. +This method is crucial for ensuring that the generator's state can be captured in the CUDA graph. + +Returns: + torch.Generator: A Generator point to the current state of the generator + +Example: + >>> g_cuda = torch.Generator(device='cuda') + >>> current_state = g_cuda.graphsafe_get_state() +""", +) + +add_docstr( + torch.Generator.clone_state, + r""" +Generator.clone_state() -> torch.Generator + +Clones the current state of the generator and returns a new generator pointing to this cloned state. +This method is beneficial for preserving a particular state of a generator to restore at a later point. + +Returns: + torch.Generator: A Generator pointing to the newly cloned state. + +Example: + >>> g_cuda = torch.Generator(device='cuda') + >>> cloned_state = g_cuda.clone_state() +""", +) + +add_docstr( + torch.Generator.manual_seed, + r""" +Generator.manual_seed(seed) -> Generator + +Sets the seed for generating random numbers. Returns a `torch.Generator` object. Any 32-bit integer is a valid seed. + +Arguments: + seed (int): The desired seed. Value must be within the inclusive range + `[-0x8000_0000_0000_0000, 0xffff_ffff_ffff_ffff]`. Otherwise, a RuntimeError + is raised. Negative inputs are remapped to positive values with the formula + `0xffff_ffff_ffff_ffff + seed`. + +Returns: + Generator: An torch.Generator object. + +Example:: + + >>> g_cpu = torch.Generator() + >>> g_cpu.manual_seed(2147483647) +""", +) + + +add_docstr( + torch.Generator.initial_seed, + r""" +Generator.initial_seed() -> int + +Returns the initial seed for generating random numbers. + +Example:: + + >>> g_cpu = torch.Generator() + >>> g_cpu.initial_seed() + 2147483647 +""", +) + + +add_docstr( + torch.Generator.seed, + r""" +Generator.seed() -> int + +Gets a non-deterministic random number from std::random_device or the current +time and uses it to seed a Generator. + +Example:: + + >>> g_cpu = torch.Generator() + >>> g_cpu.seed() + 1516516984916 +""", +) + + +add_docstr( + torch.Generator.device, + r""" +Generator.device -> device + +Gets the current device of the generator. + +Example:: + + >>> g_cpu = torch.Generator() + >>> g_cpu.device + device(type='cpu') +""", +) + +add_docstr( + torch._assert_async, + r""" +_assert_async(tensor) -> void + +Asynchronously assert that the contents of tensor are nonzero. For CPU tensors, +this is equivalent to ``assert tensor`` or ``assert tensor.is_nonzero()``; for +CUDA tensors, we DO NOT synchronize and you may only find out the assertion +failed at a later CUDA kernel launch. Asynchronous assertion can be helpful for +testing invariants in CUDA tensors without giving up performance. This function +is NOT intended to be used for regular error checking, as it will trash your CUDA +context if the assert fails (forcing you to restart your PyTorch process.) + +Args: + tensor (Tensor): a one element tensor to test to see if it is nonzero. Zero + elements (including False for boolean tensors) cause an assertion failure + to be raised. +""", +) + +add_docstr( + torch.searchsorted, + r""" +searchsorted(sorted_sequence, values, *, out_int32=False, right=False, side=None, out=None, sorter=None) -> Tensor + +Find the indices from the *innermost* dimension of :attr:`sorted_sequence` such that, if the +corresponding values in :attr:`values` were inserted before the indices, when sorted, the order +of the corresponding *innermost* dimension within :attr:`sorted_sequence` would be preserved. +Return a new tensor with the same size as :attr:`values`. More formally, +the returned index satisfies the following rules: + +.. list-table:: + :widths: 12 10 78 + :header-rows: 1 + + * - :attr:`sorted_sequence` + - :attr:`right` + - *returned index satisfies* + * - 1-D + - False + - ``sorted_sequence[i-1] < values[m][n]...[l][x] <= sorted_sequence[i]`` + * - 1-D + - True + - ``sorted_sequence[i-1] <= values[m][n]...[l][x] < sorted_sequence[i]`` + * - N-D + - False + - ``sorted_sequence[m][n]...[l][i-1] < values[m][n]...[l][x] <= sorted_sequence[m][n]...[l][i]`` + * - N-D + - True + - ``sorted_sequence[m][n]...[l][i-1] <= values[m][n]...[l][x] < sorted_sequence[m][n]...[l][i]`` + +Args: + sorted_sequence (Tensor): N-D or 1-D tensor, containing monotonically increasing sequence on the *innermost* + dimension unless :attr:`sorter` is provided, in which case the sequence does not + need to be sorted + values (Tensor or Scalar): N-D tensor or a Scalar containing the search value(s). + +Keyword args: + out_int32 (bool, optional): indicate the output data type. torch.int32 if True, torch.int64 otherwise. + Default value is False, i.e. default output data type is torch.int64. + right (bool, optional): if False, return the first suitable location that is found. If True, return the + last such index. If no suitable index found, return 0 for non-numerical value + (eg. nan, inf) or the size of *innermost* dimension within :attr:`sorted_sequence` + (one pass the last index of the *innermost* dimension). In other words, if False, + gets the lower bound index for each value in :attr:`values` on the corresponding + *innermost* dimension of the :attr:`sorted_sequence`. If True, gets the upper + bound index instead. Default value is False. :attr:`side` does the same and is + preferred. It will error if :attr:`side` is set to "left" while this is True. + side (str, optional): the same as :attr:`right` but preferred. "left" corresponds to False for :attr:`right` + and "right" corresponds to True for :attr:`right`. It will error if this is set to + "left" while :attr:`right` is True. Default value is None. + out (Tensor, optional): the output tensor, must be the same size as :attr:`values` if provided. + sorter (LongTensor, optional): if provided, a tensor matching the shape of the unsorted + :attr:`sorted_sequence` containing a sequence of indices that sort it in the + ascending order on the innermost dimension + + +Example:: + + >>> sorted_sequence = torch.tensor([[1, 3, 5, 7, 9], [2, 4, 6, 8, 10]]) + >>> sorted_sequence + tensor([[ 1, 3, 5, 7, 9], + [ 2, 4, 6, 8, 10]]) + >>> values = torch.tensor([[3, 6, 9], [3, 6, 9]]) + >>> values + tensor([[3, 6, 9], + [3, 6, 9]]) + >>> torch.searchsorted(sorted_sequence, values) + tensor([[1, 3, 4], + [1, 2, 4]]) + >>> torch.searchsorted(sorted_sequence, values, side='right') + tensor([[2, 3, 5], + [1, 3, 4]]) + + >>> sorted_sequence_1d = torch.tensor([1, 3, 5, 7, 9]) + >>> sorted_sequence_1d + tensor([1, 3, 5, 7, 9]) + >>> torch.searchsorted(sorted_sequence_1d, values) + tensor([[1, 3, 4], + [1, 3, 4]]) +""", +) + +add_docstr( + torch.bucketize, + r""" +bucketize(input, boundaries, *, out_int32=False, right=False, out=None) -> Tensor + +Returns the indices of the buckets to which each value in the :attr:`input` belongs, where the +boundaries of the buckets are set by :attr:`boundaries`. Return a new tensor with the same size +as :attr:`input`. If :attr:`right` is False (default), then the left boundary is open. Note that +this behavior is opposite the behavior of +`numpy.digitize `_. +More formally, the returned index satisfies the following rules: + +.. list-table:: + :widths: 15 85 + :header-rows: 1 + + * - :attr:`right` + - *returned index satisfies* + * - False + - ``boundaries[i-1] < input[m][n]...[l][x] <= boundaries[i]`` + * - True + - ``boundaries[i-1] <= input[m][n]...[l][x] < boundaries[i]`` + +Args: + input (Tensor or Scalar): N-D tensor or a Scalar containing the search value(s). + boundaries (Tensor): 1-D tensor, must contain a strictly increasing sequence, or the return value is undefined. + +Keyword args: + out_int32 (bool, optional): indicate the output data type. torch.int32 if True, torch.int64 otherwise. + Default value is False, i.e. default output data type is torch.int64. + right (bool, optional): determines the behavior for values in :attr:`boundaries`. See the table above. + out (Tensor, optional): the output tensor, must be the same size as :attr:`input` if provided. + + +Example:: + + >>> boundaries = torch.tensor([1, 3, 5, 7, 9]) + >>> boundaries + tensor([1, 3, 5, 7, 9]) + >>> v = torch.tensor([[3, 6, 9], [3, 6, 9]]) + >>> v + tensor([[3, 6, 9], + [3, 6, 9]]) + >>> torch.bucketize(v, boundaries) + tensor([[1, 3, 4], + [1, 3, 4]]) + >>> torch.bucketize(v, boundaries, right=True) + tensor([[2, 3, 5], + [2, 3, 5]]) +""", +) + +add_docstr( + torch.view_as_real_copy, + r""" +Performs the same operation as :func:`torch.view_as_real`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.view_as_complex_copy, + r""" +Performs the same operation as :func:`torch.view_as_complex`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.as_strided_copy, + r""" +Performs the same operation as :func:`torch.as_strided`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.diagonal_copy, + r""" +Performs the same operation as :func:`torch.diagonal`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.expand_copy, + r""" +Performs the same operation as :func:`torch.Tensor.expand`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.permute_copy, + r""" +Performs the same operation as :func:`torch.permute`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.select_copy, + r""" +Performs the same operation as :func:`torch.select`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.detach_copy, + r""" +Performs the same operation as :func:`torch.detach`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.slice_copy, + r""" +Performs the same operation as :func:`torch.slice`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.split_copy, + r""" +Performs the same operation as :func:`torch.split`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.split_with_sizes_copy, + r""" +Performs the same operation as :func:`torch.split_with_sizes`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.squeeze_copy, + r""" +Performs the same operation as :func:`torch.squeeze`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.t_copy, + r""" +Performs the same operation as :func:`torch.t`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.transpose_copy, + r""" +Performs the same operation as :func:`torch.transpose`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.unsqueeze_copy, + r""" +Performs the same operation as :func:`torch.unsqueeze`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.indices_copy, + r""" +Performs the same operation as :func:`torch.indices`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.values_copy, + r""" +Performs the same operation as :func:`torch.values`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.crow_indices_copy, + r""" +Performs the same operation as :func:`torch.crow_indices`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.col_indices_copy, + r""" +Performs the same operation as :func:`torch.col_indices`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.unbind_copy, + r""" +Performs the same operation as :func:`torch.unbind`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.view_copy, + r""" +Performs the same operation as :func:`torch.view`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.unfold_copy, + r""" +Performs the same operation as :func:`torch.unfold`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +add_docstr( + torch.alias_copy, + r""" +Performs the same operation as :func:`torch.alias`, but all output tensors +are freshly created instead of aliasing the input. +""", +) + +for unary_base_func_name in ( + "exp", + "sqrt", + "abs", + "acos", + "asin", + "atan", + "ceil", + "cos", + "cosh", + "erf", + "erfc", + "expm1", + "floor", + "log", + "log10", + "log1p", + "log2", + "neg", + "tan", + "tanh", + "sin", + "sinh", + "round", + "lgamma", + "frac", + "reciprocal", + "sigmoid", + "trunc", + "zero", +): + unary_foreach_func_name = f"_foreach_{unary_base_func_name}" + if hasattr(torch, unary_foreach_func_name): + add_docstr( + getattr(torch, unary_foreach_func_name), + rf""" +{unary_foreach_func_name}(self: List[Tensor]) -> List[Tensor] + +Apply :func:`torch.{unary_base_func_name}` to each Tensor of the input list. + """, + ) + unary_inplace_foreach_func_name = f"{unary_foreach_func_name}_" + if hasattr(torch, unary_inplace_foreach_func_name): + add_docstr( + getattr(torch, unary_inplace_foreach_func_name), + rf""" +{unary_inplace_foreach_func_name}(self: List[Tensor]) -> None + +Apply :func:`torch.{unary_base_func_name}` to each Tensor of the input list. + """, + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..8153aa26da2260fcc44d9803ee2fe805c1d28196 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_utils.py @@ -0,0 +1,1117 @@ +# mypy: allow-untyped-defs +import copyreg +import functools +import importlib +import logging +import sys +import traceback +import warnings +from collections import defaultdict +from collections.abc import Callable +from types import ModuleType +from typing import Any, Generic, TYPE_CHECKING +from typing_extensions import deprecated, ParamSpec + +import torch + + +def _type(self, dtype=None, non_blocking=False, **kwargs): + """Returns the type if `dtype` is not provided, else casts this object to + the specified type. + + If this is already of the correct type, no copy is performed and the + original object is returned. + + Args: + dtype (type or string): The desired type + non_blocking (bool): If ``True``, and the source is in pinned memory + and destination is on the GPU or vice versa, the copy is performed + asynchronously with respect to the host. Otherwise, the argument + has no effect. + **kwargs: For compatibility, may contain the key ``async`` in place of + the ``non_blocking`` argument. The ``async`` arg is deprecated. + """ + non_blocking = _get_async_or_non_blocking("type", non_blocking, kwargs) + if dtype is None: + return self.__module__ + "." + self.__class__.__name__ + + if isinstance(dtype, str): + dtype = _import_dotted_name(dtype) + if dtype is type(self): + return self + if self.is_sparse: + if not dtype.is_sparse: + raise RuntimeError("Cannot cast sparse tensor to dense tensor") + new_module_name = dtype.__module__.replace(".sparse", "") + new_values_type_name = new_module_name + "." + dtype.__name__ + new_values = torch.Tensor._values(self).type(new_values_type_name, non_blocking) + new_indices_type_name = new_module_name + ".LongTensor" + new_indices = torch.Tensor._indices(self).type( + new_indices_type_name, non_blocking + ) + return dtype(new_indices, new_values, self.size()) + if dtype.is_sparse: + raise RuntimeError("Cannot cast dense tensor to sparse tensor") + return dtype(self.size()).copy_(self, non_blocking) + + +def _to(self, device, non_blocking=False): + """Returns a copy of this object in device memory. + + If this object is already on the correct device, then no copy is performed + and the original object is returned. + + Args: + device (int): The destination device. + non_blocking (bool): If ``True`` and the source is in pinned memory, + the copy will be asynchronous with respect to the host. Otherwise, + the argument has no effect. + """ + if self.device == device: + return self + + if device.type == "cpu": + pin_memory = non_blocking and self.device.type in ( + "cuda", + torch._C._get_privateuse1_backend_name(), + ) + untyped_storage = torch.empty( + self.nbytes(), dtype=torch.uint8, device=device, pin_memory=pin_memory + ).untyped_storage() + untyped_storage.copy_(self, non_blocking) + return untyped_storage + + device_module = getattr(torch, device.type, None) + assert device_module is not None, ( + f"{device.type.upper()} device module is not loaded" + ) + with device_module.device(device): + if self.is_sparse and hasattr(device_module, "sparse"): + new_type = getattr(device_module.sparse, self.__class__.__name__) + indices = getattr(torch.Tensor._indices(self), device.type)( + device, non_blocking + ) + values = getattr(torch.Tensor._values(self), device.type)( + device, non_blocking + ) + return new_type(indices, values, self.size()) + else: + assert not self.is_sparse, ( + f"sparse storage is not supported for {device.type.upper()} tensors" + ) + untyped_storage = torch.UntypedStorage(self.size(), device=device) + untyped_storage.copy_(self, non_blocking) + return untyped_storage + + +def _get_async_or_non_blocking(function_name, non_blocking, kwargs): + """Return the non-blocking flag given the function name and kwargs. + + Args: + function_name (str): the name of the function being used. + non_blocking (bool): the default value. + **kwargs (dict): the kwargs passed to the function. + """ + if not kwargs: + return non_blocking + if len(kwargs) != 1 or "async" not in kwargs: + message = "{}() got an unexpected keyword argument '{}'" + argument = list(kwargs.keys()).pop() + raise TypeError(message.format(function_name, argument)) + warnings.warn("'async' is deprecated; use 'non_blocking'", stacklevel=2) + return kwargs["async"] + + +def _get_restore_location(device): + """Return the map_location location. + + Used for rebuild functions where the tensor device is distinct from the storage + """ + + map_location = torch.serialization._serialization_tls.map_location + if map_location is None: + return device + else: + if isinstance(map_location, dict): + return map_location.get(device, device) + elif isinstance(map_location, (str, torch.device)): + return map_location + else: + assert callable(map_location) + raise RuntimeError( + "Callable map_location not supported with _rebuild_wrapper_subclass " + "or _rebuild_device_tensor_from_numpy" + ) + + +# Note [Don't serialize hooks] +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Since time immemorial, we have serialized the backward hooks associated with +# variables. This kind of half-worked--Python can pickle global functions +# (but not closures!)--but there were problems. +# +# - It's fragile. If you serialize a backward hook into a saved +# model, and then you rename the function associated with the hook, +# now your saved model is broken and you can't load it anymore. +# +# - It's not actually used. The standard recommendation is to +# serialize the *state_dict* of a model, not the model itself +# (since this is more stable to code changes affecting the model +# serialization), and the state dict saves "data" only, thus +# stripping the backward hooks. In some cases, hooks are +# essential to the well-functioning of a model (e.g., DDP), +# but DDP already manages re-adding the hooks! +# +# - We didn't serialize them in many cases. Prior to #10220, we +# were dropping backward hooks in ForkingPickler. We "fixed" this +# to be convenient with other serialization sites, but lack of +# serializing backward hooks wasn't actually the root cause of +# the bug. +# +# With these cases in mind, we have decided that a better strategy +# is to just NOT serialize hooks at all. +# +# Since this is a BC-breaking change, we should warn when we previously +# serialized a hook, but no longer do so. This will be done by adding a special +# sentinel property to hooks will be used to suppress this warning. If a hook +# has the property _torch_serialize_ignore, we will not emit a warning if we +# attempt to serialize a Tensor with this hook attached to it. +# +# By the way, when _backward_hooks is skipped, we must give an EMPTY +# OrderedDict(), if you pass a None you'll run afoul #12219. + + +# TODO: Once we decide to break serialization FC, `storage` no longer needs to +# be a TypedStorage +def _rebuild_tensor(storage, storage_offset, size, stride): + # first construct a tensor with the correct dtype/device + t = torch.empty((0,), dtype=storage.dtype, device=storage._untyped_storage.device) + return t.set_(storage._untyped_storage, storage_offset, size, stride) + + +def get_tensor_metadata(tensor): + # Tensor's Metadata for serializing. + # Currently, this only returns a dict[string, bool] specifying whether + # `conj` or `neg` bit is set. + assert isinstance(tensor, torch.Tensor) + return torch._C._get_tensor_metadata(tensor) # type: ignore[attr-defined] + + +def set_tensor_metadata(tensor, metadata): + # See `get_tensor_metadata` above + assert isinstance(metadata, dict) + assert isinstance(tensor, torch.Tensor) + torch._C._set_tensor_metadata(tensor, metadata) # type: ignore[attr-defined] + + +def _restore_device_fake_mode(tensor): + if torch._guards.detect_fake_mode(None) is not None: + if tensor.untyped_storage()._fake_device is not None: + device = _get_restore_location(tensor.untyped_storage()._fake_device) + if not isinstance(device, torch.device): + device = torch.device(device) + tensor.fake_device = torch.device(device) + return tensor + + +def _rebuild_tensor_v2( + storage, + storage_offset, + size, + stride, + requires_grad, + backward_hooks, + metadata=None, +): + tensor = _rebuild_tensor(storage, storage_offset, size, stride) + tensor.requires_grad = requires_grad + if metadata: + set_tensor_metadata(tensor, metadata) + + # NB: This line exists only for backwards compatibility; the + # general expectation is that backward_hooks is an empty + # OrderedDict. See Note [Don't serialize hooks] + tensor._backward_hooks = backward_hooks + + tensor = _restore_device_fake_mode(tensor) + return tensor + + +def _rebuild_tensor_v3( + storage, + storage_offset, + size, + stride, + requires_grad, + backward_hooks, + dtype, + metadata=None, +): + t = torch.empty( + (0,), + dtype=dtype, + device=storage._untyped_storage.device, + requires_grad=requires_grad, + ) + t.set_(storage._untyped_storage, storage_offset, size, stride) + if metadata: + set_tensor_metadata(t, metadata) + t._backward_hooks = backward_hooks + t = _restore_device_fake_mode(t) + return t + + +_sparse_tensors_to_validate: list["torch.Tensor"] = [] + + +# In _legacy_load() in serialization.py we unpickle storages after the sparse +# tensors have been already unpickled. Those storages contain data necessary for +# validating sparse tensors: indices and values. That's why sparse tensors are +# first unpickled without any validation, and then this function is called just +# before _legacy_load() returns, so that all the sparse tensors can be validated +# in bulk. +# +# The same procedure must be followed by _load() in serialization.py because due +# to Pickler semantics, we have to use the same (non-validating) function for +# unpickling sparse tensors, regardless of the caller. +def _validate_loaded_sparse_tensors(): + if not torch.sparse.check_sparse_tensor_invariants().is_enabled(): + # Skip sparse tensor invariants validation for better + # performance. See check_sparse_tensor_invariants + # documentation for how to control sparse tensor invariants + # checking. + _sparse_tensors_to_validate.clear() + return + try: + # We disable pinning check (see check_pinning=False below) to + # avoid gh-153143. In fact, pinning check is unnecessary + # anywhy when loading sparse data from external sources. + for t in _sparse_tensors_to_validate: + if t.layout is torch.sparse_coo: + torch._validate_sparse_coo_tensor_args( + t._indices(), + t._values(), + t.size(), + t.is_coalesced(), + check_pinning=False, + ) + elif t.layout in { + torch.sparse_csr, + torch.sparse_csc, + torch.sparse_bsr, + torch.sparse_bsc, + }: + # TODO: Validation currently involves an expensive traversal + # on CPU, which may include a device transfer. + if t.layout in {torch.sparse_csr, torch.sparse_bsr}: + compressed_indices, plain_indices = ( + t.crow_indices(), + t.col_indices(), + ) + else: + compressed_indices, plain_indices = ( + t.ccol_indices(), + t.row_indices(), + ) + torch._validate_sparse_compressed_tensor_args( + compressed_indices, + plain_indices, + t.values(), + t.size(), + t.layout, + check_pinning=False, + ) + else: + raise NotImplementedError( + f"_validate_loaded_sparse_tensors for layout `{t.layout}`" + ) + + finally: + _sparse_tensors_to_validate.clear() + + +def _rebuild_sparse_tensor(layout, data): + """ + Rebuilds a sparse tensor from its sparse storage representation. + + Args: + layout (str): The sparse storage layout of the tensor. + data (tuple): The tensor's sparse storage representation. + """ + if layout == torch.sparse_coo: + if len(data) == 3: + # For BC: + indices, values, size = data + is_coalesced = None + else: + indices, values, size, is_coalesced = data + result = torch.sparse_coo_tensor( + indices, values, size, check_invariants=False, is_coalesced=is_coalesced + ) + _sparse_tensors_to_validate.append(result) + return result + + elif layout in { + torch.sparse_csr, + torch.sparse_csc, + torch.sparse_bsr, + torch.sparse_bsc, + }: + compressed_indices, plain_indices, values, size = data + result = torch.sparse_compressed_tensor( + compressed_indices, + plain_indices, + values, + size, + layout=layout, + check_invariants=False, + ) + _sparse_tensors_to_validate.append(result) + return result + + raise NotImplementedError(f"rebuilding sparse tensor for layout {layout}") + + +def _rebuild_nested_tensor(buffer, sizes, strides, storage_offsets): + return torch._nested_view_from_buffer(buffer, sizes, strides, storage_offsets) + + +def _rebuild_device_tensor_from_cpu_tensor(data, dtype, device, requires_grad): + device = _get_restore_location(device) + tensor = data.to(dtype=dtype, device=device) + tensor.requires_grad = requires_grad + return tensor + + +def _rebuild_device_tensor_from_numpy(data, dtype, device, requires_grad): + device = _get_restore_location(device) + tensor = torch.from_numpy(data).to(dtype=dtype, device=device) + tensor.requires_grad = requires_grad + return tensor + + +# Should not be used, only here to be able to load Tensors serialized with older versions of pytorch +_rebuild_xla_tensor = _rebuild_device_tensor_from_numpy + + +def _rebuild_meta_tensor_no_storage(dtype, size, stride, requires_grad): + return torch.empty_strided( + size, stride, dtype=dtype, device="meta", requires_grad=requires_grad + ) + + +def _rebuild_wrapper_subclass( + cls, + dtype, + size, + stride, + storage_offset, + layout, + device, + requires_grad, +): + device = _get_restore_location(device) + return torch.Tensor._make_wrapper_subclass( + cls, + size, + strides=stride, + dtype=dtype, + storage_offset=storage_offset, + layout=layout, + device=device, + requires_grad=requires_grad, + ) + + +# TODO: Once we decide to break serialization FC, `storage` no longer needs to +# be a TypedStorage +def _rebuild_qtensor( + storage, + storage_offset, + size, + stride, + quantizer_params, + requires_grad, + backward_hooks, +): + qscheme = quantizer_params[0] + if qscheme == torch.per_tensor_affine: + _, scale, zero_point = quantizer_params + tensor = torch._empty_affine_quantized( + size, + scale=scale, + zero_point=zero_point, + dtype=storage.dtype, + device=storage.device, + ) + elif qscheme in (torch.per_channel_affine, torch.per_channel_affine_float_qparams): + _, scales, zero_points, axis = quantizer_params + if type(scales) is list and type(zero_points) is list: + if qscheme == torch.per_channel_affine: + scales = torch.tensor(scales, dtype=torch.double, device=storage.device) + zero_points = torch.tensor( + zero_points, dtype=torch.long, device=storage.device + ) + else: + scales = torch.tensor(scales, dtype=torch.float, device=storage.device) + zero_points = torch.tensor( + zero_points, dtype=torch.float, device=storage.device + ) + tensor = torch._empty_per_channel_affine_quantized( + size, + scales=scales, + zero_points=zero_points, + axis=axis, + dtype=storage.dtype, + device=storage.device, + ) + else: + raise RuntimeError(f"Can't deserialize quantized tensor with qscheme {qscheme}") + tensor.set_(storage, storage_offset, size, stride) + tensor.requires_grad = requires_grad + # NB: This line exists only for backwards compatibility; the + # general expectation is that backward_hooks is an empty + # OrderedDict. See Note [Don't serialize hooks] + tensor._backward_hooks = backward_hooks + return tensor + + +def _rebuild_parameter(data, requires_grad, backward_hooks): + param = torch.nn.Parameter(data, requires_grad) + # NB: This line exists only for backwards compatibility; the + # general expectation is that backward_hooks is an empty + # OrderedDict. See Note [Don't serialize hooks] + param._backward_hooks = backward_hooks + + return param + + +def _rebuild_parameter_with_state(data, requires_grad, backward_hooks, state): + param = torch.nn.Parameter(data, requires_grad) + # NB: This line exists only for backwards compatibility; the + # general expectation is that backward_hooks is an empty + # OrderedDict. See Note [Don't serialize hooks] + param._backward_hooks = backward_hooks + + # Restore state on Parameter like python attr. + param = _set_obj_state(param, state) + return param + + +def _get_obj_state(obj): + # Get the state of the python subclass + # This loosely mimics the function on the object class but since Tensor do not inherit + # from it, we cannot call that function directly + # https://github.com/python/cpython/blob/c83919bd635f4433f1c6ae8504996a9fe3c215e5/Objects/typeobject.c#L4891 + # Note that starting with Python 3.11, this `__getstate__` is always defined and thus + # the else branch will never be taken. + getstate_fn = getattr(obj, "__getstate__", None) + if getstate_fn: + state = getstate_fn() + else: + slots_to_save = copyreg._slotnames(obj.__class__) # type: ignore[attr-defined] + if slots_to_save: + state = ( + obj.__dict__, + { + name: getattr(obj, name) + for name in slots_to_save + if hasattr(obj, name) + }, + ) + else: + state = obj.__dict__ + + return state + + +def _set_obj_state(obj, state): + if isinstance(state, tuple): + if not len(state) == 2: + raise RuntimeError(f"Invalid serialized state: {state}") + dict_state = state[0] + slots_state = state[1] + else: + dict_state = state + slots_state = None + + # Starting with Python 3.11, the __dict__ attribute is lazily created + # and is serialized as None when not needed. + if dict_state: + for k, v in dict_state.items(): + setattr(obj, k, v) + + if slots_state: + for k, v in slots_state.items(): + setattr(obj, k, v) + return obj + + +def _import_dotted_name(name): + components = name.split(".") + obj = __import__(components[0]) + for component in components[1:]: + obj = getattr(obj, component) + return obj + + +def _flatten_dense_tensors(tensors): + """Flatten dense tensors into a contiguous 1D buffer. Assume tensors are of + same dense type. + + Since inputs are dense, the resulting tensor will be a concatenated 1D + buffer. Element-wise operation on this buffer will be equivalent to + operating individually. + + Args: + tensors (Iterable[Tensor]): dense tensors to flatten. + + Returns: + A contiguous 1D buffer containing input tensors. + """ + return torch._C._nn.flatten_dense_tensors(tensors) + + +def _flatten_sparse_tensors(tensors): + """Flatten sparse tensors into two contiguous 1D buffers, one of indices and + one of values. Assume tensors are of same sparse type. + + Args: + tensors (Iterable[Tensor]): sparse tensors to flatten. + + Returns: + A tuple of two contiguous 1D buffers, one containing input tensors' + indices and the other containing the values. + """ + flat_indices = torch._C._nn.flatten_dense_tensors( + [torch.Tensor._indices(t) for t in tensors] + ) + flat_values = torch._C._nn.flatten_dense_tensors( + [torch.Tensor._values(t) for t in tensors] + ) + return flat_indices, flat_values + + +def _unflatten_dense_tensors(flat, tensors): + """View a flat buffer using the sizes of tensors. Assume that tensors are of + same dense type, and that flat is given by _flatten_dense_tensors. + + Args: + flat (Tensor): flattened dense tensors to unflatten. + tensors (Iterable[Tensor]): dense tensors whose sizes will be used to + unflatten flat. + + Returns: + Unflattened dense tensors with sizes same as tensors and values from + flat. + """ + return torch._C._nn.unflatten_dense_tensors(flat, tensors) + + +def _unflatten_sparse_tensors(flat, tensors): + """View flat buffer (containing indices and values) using the sizes of + tensors. Assume that tensors are of same sparse type, and that flat is given + by _flatten_sparse_tensors. + + Args: + flat (tuple(Tensor, Tensor)): flattened indices and values of sparse + tensors to unflatten. + tensors (Iterable[Tensor]): sparse tensors whose sizes will be used to + unflatten flat. + + Returns: + Unflattened sparse tensors with sizes same as tensors and values from + flat. + """ + flat_indices, flat_values = flat + indices = torch._C._nn.unflatten_dense_tensors( + flat_indices, [torch.Tensor._indices(t) for t in tensors] + ) + values = torch._C._nn.unflatten_dense_tensors( + flat_values, [torch.Tensor._values(t) for t in tensors] + ) + outputs = [] + for t, i, v in zip(tensors, indices, values): + outputs.append(t.new(i, v, t.size())) + return tuple(outputs) + + +def _reorder_tensors_as(tensors, ordered_tensors): + """Assume that tensors are of same order as ordered_tensors within their + types, e.g., from _take_tensors. Reorder them to be of same order as + ordered_tensors. + + Args: + tensors (Iterable[Tensor]): tensors to be reordered. They should be of + the same order as ordered_tensors within their own types. + ordered_tensors (Iterable[Tensor]): tensors whose order will be the + reference. + + Returns: + Ordered tuple of tensors with contents from tensors and order of + ordered_tensors. + """ + type_dict = defaultdict(list) + for tensor in tensors: + type_dict[tensor.type()].append(tensor) + type_dict_ = {t: iter(coll) for t, coll in type_dict.items()} + return tuple(next(type_dict_[tensor.type()]) for tensor in ordered_tensors) + + +def _take_tensors(tensors, size_limit): + """Group tensors into chunks. This generator yields a chunk at each time, + each containing tensors of same type up to certain byte limit in total size. + + Args: + tensors (Sequence): A sequence of tensors to be separated into chunks. + size_limit (int): The limit of each chunk in bytes. + + Yields: + Blocks of tensors of same type and within size_limit. The yielded + tensors are only ordered as the original sequence within its types. + """ + buf_dict: defaultdict[str, list] = defaultdict(lambda: [[], 0]) + for tensor in tensors: + t = tensor.type() + if tensor.is_sparse: + indices = torch.Tensor._indices(tensor) + values = torch.Tensor._values(tensor) + size = ( + indices.numel() * indices.element_size() + + values.numel() * values.element_size() + ) + else: + size = tensor.numel() * tensor.element_size() + buf_and_size = buf_dict[t] + if buf_and_size[1] + size > size_limit and buf_and_size[1] > 0: + yield buf_and_size[0] + buf_and_size = buf_dict[t] = [[], 0] + buf_and_size[0].append(tensor) # pyrefly: ignore [missing-attribute] + buf_and_size[1] += size # pyrefly: ignore [unsupported-operation] + for buf, _ in buf_dict.values(): + if len(buf) > 0: + yield buf + + +# annotation decorator to get annotations in a way that is compatible +# with both Python 2 and 3 +def annotate(ret, **kwargs): + def dec(fun): + fun.__annotations__ = dict(kwargs) + fun.__annotations__["return"] = ret + return fun + + return dec + + +def render_call(fn, args, kwargs): + str_fn = torch.overrides.resolve_name(fn) + if str_fn is None: + str_fn = str(fn) + + str_args: list[str] = [] + with torch._tensor_str.printoptions(threshold=0, edgeitems=0): + str_args.extend(repr(a) for a in args) + str_args.extend(f"{k}={repr(v)}" for k, v in kwargs.items()) + r = f"{str_fn}({', '.join(str_args)})" + return r + + +# NOTE [ Python Traceback Reference Cycle Problem ] +# +# When using sys.exc_info(), it is important to **not** store the exc_info[2], +# which is the traceback, because otherwise you will run into the traceback +# reference cycle problem, i.e., the traceback holding reference to the frame, +# and the frame (which holds reference to all the object in its temporary scope) +# holding reference the traceback. + + +class KeyErrorMessage(str): + r"""str subclass that returns itself in repr""" + + __slots__ = () + + def __repr__(self): + return self + + +class ExceptionWrapper: + r"""Wraps an exception plus traceback to communicate across threads""" + + def __init__(self, exc_info=None, where="in background"): + # It is important that we don't store exc_info, see + # NOTE [ Python Traceback Reference Cycle Problem ] + if exc_info is None: + exc_info = sys.exc_info() + self.exc_type = exc_info[0] + # pyrefly: ignore [not-iterable] + self.exc_msg = "".join(traceback.format_exception(*exc_info)) + self.where = where + + def reraise(self): + r"""Reraises the wrapped exception in the current thread""" + # Format a message such as: "Caught ValueError in DataLoader worker + # process 2. Original Traceback:", followed by the traceback. + msg = f"Caught {self.exc_type.__name__} {self.where}.\nOriginal {self.exc_msg}" # pyrefly: ignore [missing-attribute] + if self.exc_type is KeyError: + # KeyError calls repr() on its argument (usually a dict key). This + # makes stack traces unreadable. It will not be changed in Python + # (https://bugs.python.org/issue2651), so we work around it. + msg = KeyErrorMessage(msg) + elif getattr(self.exc_type, "message", None): + # Some exceptions have first argument as non-str but explicitly + # have message field + # pyrefly: ignore [not-callable] + raise self.exc_type( + # pyrefly: ignore [unexpected-keyword] + message=msg + ) + try: + exception = self.exc_type(msg) # pyrefly: ignore [not-callable] + except Exception: + # If the exception takes multiple arguments or otherwise can't + # be constructed, don't try to instantiate since we don't know how to + raise RuntimeError(msg) from None + raise exception + + +def _get_available_device_type(): + if torch.cuda.is_available(): + return "cuda" + if torch.backends.mps.is_available(): + return "mps" + if hasattr(torch, "xpu") and torch.xpu.is_available(): # type: ignore[attr-defined] + return "xpu" + if hasattr(torch, "mtia") and torch.mtia.is_available(): + return "mtia" + custom_backend_name = torch._C._get_privateuse1_backend_name() + custom_device_mod = getattr(torch, custom_backend_name, None) + if custom_device_mod and custom_device_mod.is_available(): + return custom_backend_name + # add more available device types here + return None + + +def _get_device_attr(get_member): + device_type = _get_available_device_type() + if device_type and device_type.lower() == "cuda": + return get_member(torch.cuda) + if device_type and device_type.lower() == "mps": + return get_member(torch.mps) + if device_type and device_type.lower() == "xpu": + return get_member(torch.xpu) # type: ignore[attr-defined] + if device_type and device_type.lower() == "mtia": + return get_member(torch.mtia) + if device_type == torch._C._get_privateuse1_backend_name(): + return get_member(getattr(torch, device_type)) + # add more available device types here + return None + + +def _get_current_device_index(): + # current device index + return _get_device_attr(lambda m: m.current_device()) + + +def _get_all_device_indices(): + # all device index + return _get_device_attr(lambda m: list(range(m.device_count()))) + + +def _get_devices_properties(device_ids): + # all device properties + return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids] + + +def get_current_device_index() -> int: + r"""Checks if there are CUDA devices available and + returns the device index of the current default CUDA device. + Returns -1 in case there are no CUDA devices available. + Arguments: ``None`` + """ + if torch.cuda.device_count() > 0: + return torch.cuda.current_device() + return -1 + + +def _get_device_index( + device: Any, + optional: bool = False, + allow_cpu: bool = False, +) -> int: + r"""Gets the device index from :attr:`device`, which can be a torch.device + object, a Python integer, or ``None``. + + If :attr:`device` is a torch.device object, returns the device index if it + has index. Note that for a device without a specified index, + i.e., ``torch.device('xxx')``, this will return the current default + device of that type if :attr:`optional` is ``True``. If :attr:`allow_cpu` is ``True``, + CPU devices will be accepted and ``-1`` will be returned in this case. + + If :attr:`device` is a Python integer, it is returned as is. + + If :attr:`device` is ``None``, this will return the current default + device of the supported runtime platform if :attr:`optional` is ``True``. + i.e., the current default CUDA device will be returned if CUDA runtime is supported. + """ + if isinstance(device, str): + device = torch.device(device) + device_idx: int | None = None + if isinstance(device, torch.device): + if not allow_cpu and device.type == "cpu": + raise ValueError(f"Expected a non cpu device, but got: {device}") + device_idx = -1 if device.type == "cpu" else device.index + if isinstance(device, int): + device_idx = device + if device_idx is None: + if optional: + # The eager API _get_current_device_index uses `lambda` functions which are + # not supported in JIT and hence not scriptable. The JIT equivalent API to get + # the current device index is `get_current_device_index()` which can + # be scripted. We use is_scripting to check the mode we are in and call the + # appropriate API. + if torch.jit.is_scripting(): + device_idx = get_current_device_index() + else: + device_idx = _get_current_device_index() + else: + raise ValueError( + f"Expected a torch.device with a specified index or an integer, but got:{device}" + ) + return device_idx + + +def _handle_complex(tensor): + """ + Returns a real view of a tensor if complex dtype else just the tensor + need to check if a UninitializedParameter because otherwise checking is_complex is an error for a LazyModule + """ + return ( + torch.view_as_real(tensor) + if not isinstance(tensor, torch.nn.UninitializedParameter) + and tensor.is_complex() + else tensor + ) + + +def _element_size(dtype): + """ + Returns the element size for a dtype, in bytes + """ + if not isinstance(dtype, torch.dtype): + raise RuntimeError(f"expected torch.dtype, but got {type(dtype)}") + + if dtype.is_complex: + return torch.finfo(dtype).bits >> 2 + elif dtype.is_floating_point: + return torch.finfo(dtype).bits >> 3 + elif dtype == torch.bool: + # NOTE: torch.bool is not supported in torch.iinfo() + return 1 + else: + return torch.iinfo(dtype).bits >> 3 + + +class _ClassPropertyDescriptor: + def __init__(self, fget, fset=None): + self.fget = fget + + def __get__(self, instance, owner=None): + if owner is None: + owner = type(instance) + return self.fget.__get__(instance, owner)() + + +def classproperty(func): + if not isinstance(func, (classmethod, staticmethod)): + func = classmethod(func) + return _ClassPropertyDescriptor(func) + + +if TYPE_CHECKING: + # TorchScript does not support `@deprecated` + # This is a workaround to avoid breaking TorchScript + @deprecated( + "`torch._utils.is_compiling` is deprecated. Use `torch.compiler.is_compiling` instead.", + category=FutureWarning, + ) + def is_compiling() -> bool: + return torch.compiler.is_compiling() + +else: + + def is_compiling() -> bool: + """ + Indicates whether we are tracing/compiling with torch.compile() or torch.export(). + """ + warnings.warn( # use `warnings.warn` instead of `@deprecated` + "`torch._utils.is_compiling` is deprecated. Use `torch.compiler.is_compiling` instead.", + # FutureWarning, # TorchScript does not support Warning type + stacklevel=2, + ) + return torch.compiler.is_compiling() + + +def _functionalize_sync(t): + # This code lives in python instead of C++ since conditioning on a certain python subclass + # is much more of a pain in C++. + from torch._subclasses.functional_tensor import FunctionalTensor + + if isinstance(t, FunctionalTensor): + # If a FunctionalTensorMode is active while syncing, we don't want it to intercept any ops that get called + # when we sync our inner tensor. + # Why? + # (1) If there are input mutations in the graph, then they will be re-applied during + # AOTAutograd when we call _sync() from inside of our functionalization kernels. + # (2) _sync() causes us to regenerate our updated the tensor from the updated base, + # which dispatches to a bunch of view ops + # (3) The input to these view ops is our inner FunctionalTensorWrapper + # (since the sync was called from C++), not the python FunctionalTensor + # (4) if a python FunctionalTensorMode is active, it will complain when it intercepts + # the view op, since it will see an input that is a C++ FunctionalTensorWrapper + # (aka a normal torch.Tensor) instead of a python `FunctionalTensor). + maybe_functional_mode = torch._C._unset_dispatch_mode( + torch._C._TorchDispatchModeKey.FUNCTIONAL + ) + try: + torch._functionalize_sync(t.elem) # type: ignore[attr-defined] + finally: + if maybe_functional_mode is not None: + torch._C._set_dispatch_mode(maybe_functional_mode) + else: + torch._functionalize_sync(t) # type: ignore[attr-defined] + + +@functools.lru_cache(2) +def _get_device_module(device_type: str): + device_module = getattr(torch, device_type, None) + if device_module is None: + raise RuntimeError( + f"Device '{device_type}' does not have a corresponding module registered as 'torch.{device_type}'." + ) + return device_module + + +def _dummy_type(name: str) -> type: + def get_err_fn(is_init: bool): + def err_fn(obj, *args, **kwargs): + if is_init: + class_name = obj.__class__.__name__ + else: + class_name = obj.__name__ + raise RuntimeError(f"Tried to instantiate dummy base class {class_name}") + + return err_fn + + return type( + name, (object,), {"__init__": get_err_fn(True), "__new__": get_err_fn(False)} + ) + + +class _LazySeedTracker: + # Since seeding is memory-less, only track the latest seed. + # Note: `manual_seed_all` followed by `manual_seed` overwrites + # the seed on current device. We track the order of **latest** + # calls between these two API. + def __init__(self): + self.manual_seed_all_cb = None + self.manual_seed_cb = None + self.call_order = [] + + def queue_seed_all(self, cb, traceback): + self.manual_seed_all_cb = (cb, traceback) # pyrefly: ignore [bad-assignment] + # update seed_all to be latest + self.call_order = [self.manual_seed_cb, self.manual_seed_all_cb] + + def queue_seed(self, cb, traceback): + self.manual_seed_cb = (cb, traceback) # pyrefly: ignore [bad-assignment] + # update seed to be latest + self.call_order = [self.manual_seed_all_cb, self.manual_seed_cb] + + def get_calls(self) -> list: + return self.call_order + + +logger = logging.getLogger(__name__) +P = ParamSpec("P") + + +class CallbackRegistry(Generic[P]): + def __init__(self, name: str): + self.name = name + self.callback_list: list[Callable[P, None]] = [] + + def add_callback(self, cb: Callable[P, None]) -> None: + self.callback_list.append(cb) + + def fire_callbacks(self, *args: P.args, **kwargs: P.kwargs) -> None: + for cb in self.callback_list: + try: + cb(*args, **kwargs) + except Exception: + logger.exception( + "Exception in callback for %s registered with gpu trace", self.name + ) + + +def try_import(module_name: str) -> ModuleType | None: + # Implementation based on + # https://docs.python.org/3/library/importlib.html#checking-if-a-module-can-be-imported + if (module := sys.modules.get(module_name, None)) is not None: + return module + + if (spec := importlib.util.find_spec(module_name)) is not None: + module = importlib.util.module_from_spec(spec) + sys.modules[module_name] = module + + # https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec.loader + # "The finder should always set this attribute" + assert spec.loader is not None, "The loader attribute should always be set" + spec.loader.exec_module(module) + return module + + return None + + +# IMPORT_MAPPING and NAME_MAPPING are adapted from https://github.com/python/cpython/blob/main/Lib/_compat_pickle.py +# for use in the weights_only Unpickler. + +IMPORT_MAPPING = { + "__builtin__": "builtins", + "copy_reg": "copyreg", + "Queue": "queue", + "repr": "reprlib", + "_abcoll": "collections.abc", + # Non-mutual mappings. + "UserDict": "collections", + "UserList": "collections", + "UserString": "collections", + "whichdb": "dbm", + "StringIO": "io", + "cStringIO": "io", +} + + +# This contains rename rules that are easy to handle. We ignore the more +# complex stuff (e.g. mapping the names in the urllib and types modules). +# These rules should be run before import names are fixed. +NAME_MAPPING = { + ("__builtin__", "xrange"): ("builtins", "range"), + ("__builtin__", "reduce"): ("functools", "reduce"), + ("__builtin__", "intern"): ("sys", "intern"), + ("__builtin__", "unichr"): ("builtins", "chr"), + ("__builtin__", "unicode"): ("builtins", "str"), + ("__builtin__", "long"): ("builtins", "int"), + ("itertools", "izip"): ("builtins", "zip"), + ("itertools", "imap"): ("builtins", "map"), + ("itertools", "ifilter"): ("builtins", "filter"), + ("itertools", "ifilterfalse"): ("itertools", "filterfalse"), + ("itertools", "izip_longest"): ("itertools", "zip_longest"), + ("UserDict", "IterableUserDict"): ("collections", "UserDict"), + ("UserList", "UserList"): ("collections", "UserList"), + ("UserString", "UserString"): ("collections", "UserString"), + # Non-mutual mappings. + ("__builtin__", "basestring"): ("builtins", "str"), + ("exceptions", "StandardError"): ("builtins", "Exception"), + ("UserDict", "UserDict"): ("collections", "UserDict"), +} diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_utils_internal.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_utils_internal.py new file mode 100644 index 0000000000000000000000000000000000000000..10fc4b3ace41798dd5ca757a1eb6e21f26f4351f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_utils_internal.py @@ -0,0 +1,378 @@ +# mypy: allow-untyped-defs +import functools +import logging +import os +import sys +import tempfile +import typing_extensions +from collections.abc import Callable +from typing import Any, TypeVar +from typing_extensions import ParamSpec + +import torch +from torch._strobelight.compile_time_profiler import StrobelightCompileTimeProfiler + + +_T = TypeVar("_T") +_P = ParamSpec("_P") + +log = logging.getLogger(__name__) + +if os.environ.get("TORCH_COMPILE_STROBELIGHT", False): + import shutil + + if not shutil.which("strobeclient"): + log.info( + "TORCH_COMPILE_STROBELIGHT is true, but seems like you are not on a FB machine." + ) + else: + log.info("Strobelight profiler is enabled via environment variable") + StrobelightCompileTimeProfiler.enable() + +# this arbitrary-looking assortment of functionality is provided here +# to have a central place for overridable behavior. The motivating +# use is the FB build environment, where this source file is replaced +# by an equivalent. + +if os.path.basename(os.path.dirname(__file__)) == "shared": + torch_parent = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) +else: + torch_parent = os.path.dirname(os.path.dirname(__file__)) + + +def get_file_path(*path_components: str) -> str: + return os.path.join(torch_parent, *path_components) + + +def get_file_path_2(*path_components: str) -> str: + return os.path.join(*path_components) + + +def get_writable_path(path: str) -> str: + if os.access(path, os.W_OK): + return path + return tempfile.mkdtemp(suffix=os.path.basename(path)) + + +def prepare_multiprocessing_environment(path: str) -> None: + pass + + +def resolve_library_path(path: str) -> str: + return os.path.realpath(path) + + +def throw_abstract_impl_not_imported_error(opname, module, context): + if module in sys.modules: + raise NotImplementedError( + f"{opname}: We could not find the fake impl for this operator. " + ) + else: + raise NotImplementedError( + f"{opname}: We could not find the fake impl for this operator. " + f"The operator specified that you may need to import the '{module}' " + f"Python module to load the fake impl. {context}" + ) + + +# NB! This treats "skip" kwarg specially!! +def compile_time_strobelight_meta( + phase_name: str, +) -> Callable[[Callable[_P, _T]], Callable[_P, _T]]: + def compile_time_strobelight_meta_inner( + function: Callable[_P, _T], + ) -> Callable[_P, _T]: + @functools.wraps(function) + def wrapper_function(*args: _P.args, **kwargs: _P.kwargs) -> _T: + if "skip" in kwargs and isinstance( + # pyrefly: ignore [unsupported-operation] + skip := kwargs["skip"], + int, + ): + kwargs["skip"] = skip + 1 + + # This is not needed but we have it here to avoid having profile_compile_time + # in stack traces when profiling is not enabled. + if not StrobelightCompileTimeProfiler.enabled: + return function(*args, **kwargs) + + return StrobelightCompileTimeProfiler.profile_compile_time( + function, phase_name, *args, **kwargs + ) + + return wrapper_function + + return compile_time_strobelight_meta_inner + + +# Meta only, see +# https://www.internalfb.com/intern/wiki/ML_Workflow_Observability/User_Guides/Adding_instrumentation_to_your_code/ +# +# This will cause an event to get logged to Scuba via the signposts API. You +# can view samples on the API at https://fburl.com/scuba/workflow_signpost/zh9wmpqs +# we log to subsystem "torch", and the category and name you provide here. +# Each of the arguments translate into a Scuba column. We're still figuring +# out local conventions in PyTorch, but category should be something like +# "dynamo" or "inductor", and name should be a specific string describing what +# kind of event happened. +# +# Killswitch is at +# https://www.internalfb.com/intern/justknobs/?name=pytorch%2Fsignpost#event +def signpost_event(category: str, name: str, parameters: dict[str, Any]): + log.info("%s %s: %r", category, name, parameters) + + +def add_mlhub_insight(category: str, insight: str, insight_description: str): + pass + + +def log_compilation_event(metrics): + log.info("%s", metrics) + + +def upload_graph(graph): + pass + + +def set_pytorch_distributed_envs_from_justknobs(): + pass + + +def log_export_usage(**kwargs): + pass + + +def log_draft_export_usage(**kwargs): + pass + + +def log_trace_structured_event(*args, **kwargs) -> None: + pass + + +def log_cache_bypass(*args, **kwargs) -> None: + pass + + +def log_torchscript_usage(api: str, **kwargs): + _ = api + return + + +def check_if_torch_exportable(): + return False + + +def export_training_ir_rollout_check() -> bool: + return True + + +def full_aoti_runtime_assert() -> bool: + return True + + +def log_torch_jit_trace_exportability( + api: str, + type_of_export: str, + export_outcome: str, + result: str, +): + _, _, _, _ = api, type_of_export, export_outcome, result + return + + +DISABLE_JUSTKNOBS = True + + +def justknobs_check(name: str, default: bool = True) -> bool: + """ + This function can be used to killswitch functionality in FB prod, + where you can toggle this value to False in JK without having to + do a code push. In OSS, we always have everything turned on all + the time, because downstream users can simply choose to not update + PyTorch. (If more fine-grained enable/disable is needed, we could + potentially have a map we lookup name in to toggle behavior. But + the point is that it's all tied to source code in OSS, since there's + no live server to query.) + + This is the bare minimum functionality I needed to do some killswitches. + We have a more detailed plan at + https://docs.google.com/document/d/1Ukerh9_42SeGh89J-tGtecpHBPwGlkQ043pddkKb3PU/edit + In particular, in some circumstances it may be necessary to read in + a knob once at process start, and then use it consistently for the + rest of the process. Future functionality will codify these patterns + into a better high level API. + + WARNING: Do NOT call this function at module import time, JK is not + fork safe and you will break anyone who forks the process and then + hits JK again. + """ + return default + + +def justknobs_getval_int(name: str) -> int: + """ + Read warning on justknobs_check + """ + return 0 + + +def is_fb_unit_test() -> bool: + return False + + +@functools.cache +def max_clock_rate(): + """ + unit: MHz + """ + if not torch.version.hip: + from triton.testing import nvsmi + + return nvsmi(["clocks.max.sm"])[0] + else: + # Manually set max-clock speeds on ROCm until equivalent nvmsi + # functionality in triton.testing or via pyamdsmi enablement. Required + # for test_snode_runtime unit tests. + gcn_arch = str(torch.cuda.get_device_properties(0).gcnArchName.split(":", 1)[0]) + if "gfx94" in gcn_arch: + return 1700 + elif "gfx90a" in gcn_arch: + return 1700 + elif "gfx908" in gcn_arch: + return 1502 + elif "gfx12" in gcn_arch: + return 1700 + elif "gfx11" in gcn_arch: + return 1700 + elif "gfx103" in gcn_arch: + return 1967 + elif "gfx101" in gcn_arch: + return 1144 + elif "gfx95" in gcn_arch: + return 1700 # TODO: placeholder, get actual value + else: + return 1100 + + +def get_mast_job_name_version() -> tuple[str, int] | None: + return None + + +TEST_MASTER_ADDR = "127.0.0.1" +TEST_MASTER_PORT = 29500 +# USE_GLOBAL_DEPS controls whether __init__.py tries to load +# libtorch_global_deps, see Note [Global dependencies] +USE_GLOBAL_DEPS = True +# USE_RTLD_GLOBAL_WITH_LIBTORCH controls whether __init__.py tries to load +# _C.so with RTLD_GLOBAL during the call to dlopen. +USE_RTLD_GLOBAL_WITH_LIBTORCH = False +# If an op was defined in C++ and extended from Python using the +# torch.library.register_fake, returns if we require that there be a +# m.set_python_module("mylib.ops") call from C++ that associates +# the C++ op with a python module. +REQUIRES_SET_PYTHON_MODULE = False + + +def maybe_upload_prof_stats_to_manifold(profile_path: str) -> str | None: + print("Uploading profile stats (fb-only otherwise no-op)") + return None + + +def log_chromium_event_internal( + event: dict[str, Any], + stack: list[str], + logger_uuid: str, + start_time_ns: int, +): + return None + + +def record_chromium_event_internal( + event: dict[str, Any], +): + return None + + +def profiler_allow_cudagraph_cupti_lazy_reinit_cuda12(): + return True + + +def deprecated(): + """ + When we deprecate a function that might still be in use, we make it internal + by adding a leading underscore. This decorator is used with a private function, + and creates a public alias without the leading underscore, but has a deprecation + warning. This tells users "THIS FUNCTION IS DEPRECATED, please use something else" + without breaking them, however, if they still really really want to use the + deprecated function without the warning, they can do so by using the internal + function name. + """ + + def decorator(func: Callable[_P, _T]) -> Callable[_P, _T]: + # Validate naming convention - single leading underscore, not dunder + if not (func.__name__.startswith("_")): + raise ValueError( + "@deprecate must decorate a function whose name " + "starts with a single leading underscore (e.g. '_foo') as the api should be considered internal for deprecation." + ) + + public_name = func.__name__[1:] # drop exactly one leading underscore + module = sys.modules[func.__module__] + + # Don't clobber an existing symbol accidentally. + if hasattr(module, public_name): + raise RuntimeError( + f"Cannot create alias '{public_name}' -> symbol already exists in {module.__name__}. \ + Please rename it or consult a pytorch developer on what to do" + ) + + warning_msg = f"{func.__name__[1:]} is DEPRECATED, please consider using an alternative API(s). " + + # public deprecated alias + alias = typing_extensions.deprecated( + # pyrefly: ignore [bad-argument-type] + warning_msg, + category=UserWarning, + stacklevel=1, + )(func) + + alias.__name__ = public_name + + # Adjust qualname if nested inside a class or another function + if "." in func.__qualname__: + alias.__qualname__ = func.__qualname__.rsplit(".", 1)[0] + "." + public_name + else: + alias.__qualname__ = public_name + + setattr(module, public_name, alias) + + return func + + return decorator + + +def get_default_numa_options(): + """ + When using elastic agent, if no numa options are provided, we will use these + as the default. + + For external use cases, we return None, i.e. no numa binding. If you would like + to use torch's automatic numa binding capabilities, you should provide + NumaOptions to your launch config directly or use the numa binding option + available in torchrun. + + Must return None or NumaOptions, but not specifying to avoid circular import. + """ + return None + + +def log_triton_builds(fail: str | None): + pass + + +def find_compile_subproc_binary() -> str | None: + """ + Allows overriding the binary used for subprocesses + """ + return None diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_vmap_internals.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_vmap_internals.py new file mode 100644 index 0000000000000000000000000000000000000000..df5f6ad9917f873b8698b1f77c3c2aed2a9b5067 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_vmap_internals.py @@ -0,0 +1,246 @@ +# mypy: allow-untyped-defs +import functools +from collections.abc import Callable +from typing import Any +from typing_extensions import deprecated + +import torch +from torch import Tensor +from torch.utils._pytree import _broadcast_to_and_flatten, tree_flatten, tree_unflatten + + +in_dims_t = int | tuple +out_dims_t = int | tuple[int, ...] + + +# Checks that all args-to-be-batched have the same batch dim size +def _validate_and_get_batch_size( + flat_in_dims: list[int | None], + flat_args: list, +) -> int: + batch_sizes = [ + arg.size(in_dim) + for in_dim, arg in zip(flat_in_dims, flat_args) + if in_dim is not None + ] + if batch_sizes and any(size != batch_sizes[0] for size in batch_sizes): + raise ValueError( + f"vmap: Expected all tensors to have the same size in the mapped " + f"dimension, got sizes {batch_sizes} for the mapped dimension" + ) + return batch_sizes[0] + + +def _num_outputs(batched_outputs: Tensor | tuple[Tensor, ...]) -> int: + if isinstance(batched_outputs, tuple): + return len(batched_outputs) + return 1 + + +# If value is a tuple, check it has length `num_elements`. +# If value is not a tuple, make a tuple with `value` repeated `num_elements` times +def _as_tuple( + value: Any, + num_elements: int, + error_message_lambda: Callable[[], str], +) -> tuple: + if not isinstance(value, tuple): + return (value,) * num_elements + if len(value) != num_elements: + raise ValueError(error_message_lambda()) + return value + + +# Creates BatchedTensors for every Tensor in arg that should be batched. +# Returns the (potentially) batched arguments and the batch_size. +def _create_batched_inputs( + in_dims: in_dims_t, + args: tuple, + vmap_level: int, + func: Callable, +) -> tuple[tuple, int]: + if not isinstance(in_dims, int) and not isinstance(in_dims, tuple): + raise ValueError( + f"vmap({_get_name(func)}, in_dims={in_dims}, ...)(): " + f"expected `in_dims` to be int or a (potentially nested) tuple " + f"matching the structure of inputs, got: {type(in_dims)}." + ) + if len(args) == 0: + raise ValueError( + f"vmap({_get_name(func)})(): got no inputs. Maybe you forgot to add " + f"inputs, or you are trying to vmap over a function with no inputs. " + f"The latter is unsupported." + ) + + flat_args, args_spec = tree_flatten(args) + flat_in_dims = _broadcast_to_and_flatten(in_dims, args_spec) + if flat_in_dims is None: + raise ValueError( + f"vmap({_get_name(func)}, in_dims={in_dims}, ...)(): " + f"in_dims is not compatible with the structure of `inputs`. " + f"in_dims has structure {tree_flatten(in_dims)[1]} but inputs " + f"has structure {args_spec}." + ) + + for arg, in_dim in zip(flat_args, flat_in_dims): + if not isinstance(in_dim, int) and in_dim is not None: + raise ValueError( + f"vmap({_get_name(func)}, in_dims={in_dims}, ...)(): " + f"Got in_dim={in_dim} for an input but in_dim must be either " + f"an integer dimension or None." + ) + if isinstance(in_dim, int) and not isinstance(arg, Tensor): + raise ValueError( + f"vmap({_get_name(func)}, in_dims={in_dims}, ...)(): " + f"Got in_dim={in_dim} for an input but the input is of type " + f"{type(arg)}. We cannot vmap over non-Tensor arguments, " + f"please use None as the respective in_dim" + ) + if in_dim is not None and (in_dim < 0 or in_dim >= arg.dim()): + raise ValueError( + f"vmap({_get_name(func)}, in_dims={in_dims}, ...)(): " + f"Got in_dim={in_dim} for some input, but that input is a Tensor " + f"of dimensionality {arg.dim()} so expected in_dim to satisfy " + f"0 <= in_dim < {arg.dim()}." + ) + + batch_size = _validate_and_get_batch_size(flat_in_dims, flat_args) + # See NOTE [Ignored _remove_batch_dim, _add_batch_dim] + batched_inputs = [ + arg if in_dim is None else torch._add_batch_dim(arg, in_dim, vmap_level) + for in_dim, arg in zip(flat_in_dims, flat_args) + ] + return tree_unflatten(batched_inputs, args_spec), batch_size + + +# Undos the batching (and any batch dimensions) associated with the `vmap_level`. +def _unwrap_batched( + batched_outputs: Tensor | tuple[Tensor, ...], + out_dims: out_dims_t, + vmap_level: int, + batch_size: int, + func: Callable, + allow_none_pass_through: bool = False, +) -> tuple: + num_outputs = _num_outputs(batched_outputs) + out_dims_as_tuple = _as_tuple( + out_dims, + num_outputs, + lambda: f"vmap({_get_name(func)}, ..., out_dims={out_dims}): `out_dims` must " + f"have one dim per output (got {num_outputs} outputs) of {_get_name(func)}.", + ) + + # NOTE [Ignored _remove_batch_dim, _add_batch_dim] + # There is something wrong with our type bindings for functions that begin + # with '_', see #40397. + if isinstance(batched_outputs, Tensor): + out_dim = out_dims_as_tuple[0] + return torch._remove_batch_dim(batched_outputs, vmap_level, batch_size, out_dim) # type: ignore[return-value] + if allow_none_pass_through: + return tuple( + ( + torch._remove_batch_dim(out, vmap_level, batch_size, out_dim) + if out is not None + else None + ) + for out, out_dim in zip(batched_outputs, out_dims_as_tuple) + ) + else: + return tuple( + torch._remove_batch_dim(out, vmap_level, batch_size, out_dim) + for out, out_dim in zip(batched_outputs, out_dims_as_tuple) + ) + + +# Checks that `fn` returned one or more Tensors and nothing else. +# NB: A python function that return multiple arguments returns a single tuple, +# so we are effectively checking that `outputs` is a single Tensor or a tuple of +# Tensors. +def _validate_outputs(outputs: Any, func: Callable) -> None: + if isinstance(outputs, Tensor): + return + if not isinstance(outputs, tuple): + raise ValueError( + f"vmap({_get_name(func)}, ...): `{_get_name(func)}` must only return " + f"Tensors, got type {type(outputs)} as the return." + ) + for idx, output in enumerate(outputs): + if isinstance(output, Tensor): + continue + raise ValueError( + f"vmap({_get_name(func)}, ...): `{_get_name(func)}` must only return " + f"Tensors, got type {type(output)} for return {idx}." + ) + + +def _check_out_dims_is_int_or_int_tuple(out_dims: out_dims_t, func: Callable) -> None: + if isinstance(out_dims, int): + return + if not isinstance(out_dims, tuple) or not all( + isinstance(out_dim, int) for out_dim in out_dims + ): + raise ValueError( + f"vmap({_get_name(func)}, ..., out_dims={out_dims}): `out_dims` must be " + f"an int or a tuple of int representing where in the outputs the " + f"vmapped dimension should appear." + ) + + +def _get_name(func: Callable): + if hasattr(func, "__name__"): + return func.__name__ + + # Not all callables have __name__, in fact, only static functions/methods do. + # A callable created via functools.partial or an nn.Module, to name some + # examples, don't have a __name__. + return repr(func) + + +# vmap(func)(inputs) wraps all Tensor inputs to be batched in BatchedTensors, +# sends those into func, and then unwraps the output BatchedTensors. Operations +# on BatchedTensors perform the batched operations that the user is asking for. +@deprecated( + "Please use `torch.vmap` instead of `torch._vmap_internals.vmap`.", + category=FutureWarning, +) +def vmap(func: Callable, in_dims: in_dims_t = 0, out_dims: out_dims_t = 0) -> Callable: + """ + Please use torch.vmap instead of this API. + """ + return _vmap(func, in_dims, out_dims) + + +# A version of vmap but without the initial "experimental prototype" warning +def _vmap( + func: Callable, + in_dims: in_dims_t = 0, + out_dims: out_dims_t = 0, + allow_none_pass_through: bool = False, +) -> Callable: + # The `allow_none_pass_through` argument is a temporary workaround may be removed. + # Currently it enables us to wrap the call in `autograd.grad` to the autograd engine, + # which may return None if any of the inputs are unused. See the issue discussing this: + # https://github.com/pytorch/functorch/issues/159. + @functools.wraps(func) + def wrapped(*args): + _check_out_dims_is_int_or_int_tuple(out_dims, func) + vmap_level = torch._C._vmapmode_increment_nesting() + try: + batched_inputs, batch_size = _create_batched_inputs( + in_dims, args, vmap_level, func + ) + batched_outputs = func(*batched_inputs) + if not allow_none_pass_through: + _validate_outputs(batched_outputs, func) + return _unwrap_batched( + batched_outputs, + out_dims, + vmap_level, + batch_size, + func, + allow_none_pass_through=allow_none_pass_through, + ) + finally: + torch._C._vmapmode_decrement_nesting() + + return wrapped diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/_weights_only_unpickler.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/_weights_only_unpickler.py new file mode 100644 index 0000000000000000000000000000000000000000..85c01e6474bf4ede4588a593014190e40b006ffb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/_weights_only_unpickler.py @@ -0,0 +1,588 @@ +# mypy: allow-untyped-defs +# Unpickler restricted to loading only state dicts +# Restrict constructing types to a list defined in _get_allowed_globals() +# Restrict BUILD operation to `Tensor`, `Parameter` and `OrderedDict` types only +# Restrict APPEND/APPENDS to `list` +# In `GLOBALS` operation do not do class lookup by name, but rather rely on dictionary +# defined by `_get_allowed_globals()` method, that contains: +# - torch types (Storage, dtypes, Tensor, `torch.Size`), +# - `torch._utils._rebuild` functions. +# - `torch.nn.Parameter` +# - `collections.Counter` +# - `collections.OrderedDict` +# Additionally, users can use an allowlist for adding classes they have deemed as safe using +# `_add_safe_globals()` (`torch.serialization.add_safe_globals`) +# `_clear_safe_globals()` (`torch.serialization.clear_safe_globals`) +# `_get_safe_globals()` (`torch.serialization.get_safe_globals`) + +# Based of https://github.com/python/cpython/blob/main/Lib/pickle.py +# Expected to be useful for loading PyTorch model weights +# For example: +# data = urllib.request.urlopen('https://download.pytorch.org/models/resnet50-0676ba61.pth').read() +# buf = io.BytesIO(data) +# weights = torch.load(buf, weights_only = True) + +import functools as _functools +import warnings + +from _codecs import encode +from collections import Counter, OrderedDict +from collections.abc import Callable +from pickle import ( + APPEND, + APPENDS, + BINFLOAT, + BINGET, + BININT, + BININT1, + BININT2, + BINPERSID, + BINPUT, + BINUNICODE, + BUILD, + bytes_types, + decode_long, + EMPTY_DICT, + EMPTY_LIST, + EMPTY_SET, + EMPTY_TUPLE, + GLOBAL, + LONG1, + LONG_BINGET, + LONG_BINPUT, + MARK, + NEWFALSE, + NEWOBJ, + NEWTRUE, + NONE, + PROTO, + REDUCE, + SETITEM, + SETITEMS, + SHORT_BINSTRING, + STOP, + TUPLE, + TUPLE1, + TUPLE2, + TUPLE3, + UnpicklingError, +) +from struct import unpack +from sys import maxsize +from typing import Any + +import torch +from torch._utils import _sparse_tensors_to_validate, IMPORT_MAPPING, NAME_MAPPING + + +# modules in this list are never allowed, even if the user attempts to allowlist +# functions/classes from them +_blocklisted_modules = [ + "sys", + "os", + "posix", + "nt", +] + +_marked_safe_globals_set: set[Callable | tuple[Callable, str]] = set() + + +def _add_safe_globals(safe_globals: list[Callable | tuple[Callable, str]]): + global _marked_safe_globals_set + _marked_safe_globals_set = _marked_safe_globals_set.union(set(safe_globals)) + + +def _get_safe_globals() -> list[Callable | tuple[Callable, str]]: + global _marked_safe_globals_set + return list(_marked_safe_globals_set) + + +def _clear_safe_globals(): + global _marked_safe_globals_set + _marked_safe_globals_set = set() + + +def _remove_safe_globals( + globals_to_remove: list[Callable | tuple[Callable, str]], +): + global _marked_safe_globals_set + _marked_safe_globals_set = _marked_safe_globals_set - set(globals_to_remove) + + +class _safe_globals: + def __init__(self, safe_globals: list[Callable | tuple[Callable, str]]): + self.safe_globals = safe_globals + + def __enter__(self): + _add_safe_globals(self.safe_globals) + + def __exit__(self, type, value, tb): + _remove_safe_globals(self.safe_globals) + + +# Separate from _get_allowed_globals because of the lru_cache on _get_allowed_globals +# For example if user had a script like +# torch.load(file_a) +# torch.serialization._add_safe_globals([torch.foo]) +# torch.load(file_b) +# the dynamic additions to safe_globals would not be picked up by +# _get_allowed_globals due to the lru_cache +def _get_user_allowed_globals(): + rc: dict[str, Any] = {} + for f in _marked_safe_globals_set: + if isinstance(f, tuple): + if len(f) != 2: + raise ValueError( + f"Expected tuple of length 2 (global, str of callable full path), but got tuple of length: {len(f)}" + ) + if type(f[1]) is not str: + raise TypeError( + f"Expected second item in tuple to be str of callable full path, but got: {type(f[1])}" + ) + f, name = f + rc[name] = f + else: + module, name = f.__module__, f.__qualname__ + rc[f"{module}.{name}"] = f + return rc + + +def _tensor_rebuild_functions(): + return { + torch._utils._rebuild_parameter, + torch._utils._rebuild_parameter_with_state, + torch._utils._rebuild_qtensor, + torch._utils._rebuild_tensor, + torch._utils._rebuild_tensor_v2, + torch._utils._rebuild_tensor_v3, + torch._utils._rebuild_sparse_tensor, + torch._utils._rebuild_meta_tensor_no_storage, + torch._utils._rebuild_nested_tensor, + torch._utils._rebuild_wrapper_subclass, + # Allowlisting this, but not allowlisting the numpy functions by default + # Reasoning is that we don't have control over the numpy functions, but + # this utility is provided by pytorch + torch._utils._rebuild_device_tensor_from_numpy, + # In 2.6, we should no longer have a dependency on numpy and the above + # _rebuild_device_tensor_from_numpy function. + torch._utils._rebuild_device_tensor_from_cpu_tensor, + } + + +# Unpickling machinery +@_functools.lru_cache(maxsize=1) +def _get_allowed_globals(): + rc: dict[str, Any] = { + "collections.OrderedDict": OrderedDict, + "collections.Counter": Counter, + "torch.nn.parameter.Parameter": torch.nn.Parameter, + "torch.serialization._get_layout": torch.serialization._get_layout, + "torch.Size": torch.Size, + "torch.Tensor": torch.Tensor, + "torch.device": torch.device, + "_codecs.encode": encode, # for bytes + "builtins.bytearray": bytearray, # for bytearray + "builtins.set": set, # for set + "builtins.complex": complex, # for complex + } + + # dtype + for t in torch.storage._dtype_to_storage_type_map(): + rc[str(t)] = t + for t in torch.storage._new_dtypes(): + rc[str(t)] = t + for t in [getattr(torch, f"uint{x}") for x in range(1, 8)]: + rc[str(t)] = t + for t in [getattr(torch, f"int{x}") for x in range(1, 8)]: + rc[str(t)] = t + + # Tensor classes + for tt in torch._tensor_classes: + rc[f"{tt.__module__}.{tt.__name__}"] = tt + # Storage classes + for ts in torch._storage_classes: + if ts not in (torch.storage.TypedStorage, torch.storage.UntypedStorage): + # Wrap legacy storage types in a dummy class + rc[f"{ts.__module__}.{ts.__name__}"] = torch.serialization.StorageType( + ts.__name__ + ) + else: + rc[f"{ts.__module__}.{ts.__name__}"] = ts + # Quantization specific + for qt in [ + torch.per_tensor_affine, + torch.per_tensor_symmetric, + torch.per_channel_affine, + torch.per_channel_symmetric, + torch.per_channel_affine_float_qparams, + ]: + rc[str(qt)] = qt + # Rebuild functions + for f in _tensor_rebuild_functions(): + rc[f"torch._utils.{f.__name__}"] = f + + # Handles Tensor Subclasses, Tensor's with attributes. + # NOTE: It calls into above rebuild functions for regular Tensor types. + rc["torch._tensor._rebuild_from_type_v2"] = torch._tensor._rebuild_from_type_v2 + return rc + + +def _read_global_instruction(readline: Callable) -> tuple[str, str]: + module = readline()[:-1].decode("utf-8") + name = readline()[:-1].decode("utf-8") + # Patch since torch.save default protocol is 2 + # users will be running this code in python > 3 + if (module, name) in NAME_MAPPING: + module, name = NAME_MAPPING[(module, name)] + elif module in IMPORT_MAPPING: + module = IMPORT_MAPPING[module] + return module, name + + +def get_globals_in_pkl(file) -> set[str]: + globals_in_checkpoint = set() + read = file.read + readline = file.readline + op_to_bytes_to_read = { + NEWOBJ[0]: 0, + REDUCE[0]: 0, + BUILD[0]: 0, + APPEND[0]: 0, + APPENDS[0]: 0, + SETITEM[0]: 0, + SETITEMS[0]: 0, + MARK[0]: 0, + TUPLE[0]: 0, + TUPLE1[0]: 0, + TUPLE2[0]: 0, + TUPLE3[0]: 0, + NONE[0]: 0, + NEWFALSE[0]: 0, + NEWTRUE[0]: 0, + EMPTY_TUPLE[0]: 0, + EMPTY_LIST[0]: 0, + EMPTY_DICT[0]: 0, + EMPTY_SET[0]: 0, + BINPERSID[0]: 0, + BININT[0]: 4, + BININT1[0]: 1, + BININT2[0]: 2, + BINFLOAT[0]: 8, + BINGET[0]: 1, + LONG_BINGET[0]: 4, + BINPUT[0]: 1, + LONG_BINPUT[0]: 4, + } + while True: + key = read(1) + if not key: + raise EOFError + assert isinstance(key, bytes_types) + if key[0] == GLOBAL[0]: + module, name = _read_global_instruction(readline) + globals_in_checkpoint.add(f"{module}.{name}") + elif key[0] in op_to_bytes_to_read: + bytes_to_read = op_to_bytes_to_read[key[0]] + if bytes_to_read: + read(bytes_to_read) + # ops where bytes to read depends on the data + elif key[0] == BINUNICODE[0]: + strlen = unpack(" maxsize: + raise UnpicklingError("String is too long") + read(strlen) + elif key[0] in {SHORT_BINSTRING[0], LONG1[0]}: + strlen = read(1)[0] + read(strlen) + # first and last op + elif key[0] == PROTO[0]: + read(1)[0] + elif key[0] == STOP[0]: + return globals_in_checkpoint + else: + raise UnpicklingError(f"Unsupported operand {key[0]}") + + +class Unpickler: + def __init__(self, file, *, encoding: str = "bytes"): + self.encoding = encoding + self.readline = file.readline + self.read = file.read + self.memo: dict[int, Any] = {} + self.proto: int = -1 + + def load(self): + """Read a pickled object representation from the open file. + + Return the reconstituted object hierarchy specified in the file. + """ + self.metastack = [] + self.stack: list[Any] = [] + self.append = self.stack.append + read = self.read + while True: + key = read(1) + if not key: + raise EOFError + assert isinstance(key, bytes_types) + # Risky operators + if key[0] == GLOBAL[0]: + module, name = _read_global_instruction(self.readline) + full_path = f"{module}.{name}" + if module in _blocklisted_modules: + raise UnpicklingError( + f"Trying to load unsupported GLOBAL {full_path} whose module {module} is blocked." + ) + if full_path in _get_allowed_globals(): + self.append(_get_allowed_globals()[full_path]) + elif full_path in _get_user_allowed_globals(): + self.append(_get_user_allowed_globals()[full_path]) + elif full_path in ( + [ + "torch.nested._internal.nested_tensor.NestedTensor", + "torch.nested._internal.nested_tensor._rebuild_njt", + "torch._dynamo.decorators._DimRange", + ] + ): + raise UnpicklingError( + "``torch.nested`` and ``torch._dynamo`` must be imported to load nested jagged tensors (NJTs)" + ) + elif full_path in ( + [ + "torch.distributed.device_mesh.DeviceMesh", + "torch.distributed.tensor._dtensor_spec.DTensorSpec", + "torch.distributed.tensor._dtensor_spec.TensorMeta", + "torch.distributed.tensor.DTensor", + "torch.distributed.tensor.placement_types.Partial", + "torch.distributed.tensor.placement_types.Replicate", + "torch.distributed.tensor.placement_types.Shard", + ] + ): + raise UnpicklingError( + "``torch.distributed.tensor`` must be imported to load DTensors" + ) + else: + builtins_name = "builtins" + if ( + builtins_name in full_path + and builtins_name == full_path[: len(builtins_name)] + ): + full_path = full_path[len(builtins_name) :] + full_path = ( + full_path[1:] + if len(full_path) > 0 and full_path[0] == "." + else builtins_name + full_path + ) + raise UnpicklingError( + f"Unsupported global: GLOBAL {full_path} was not an allowed global by default. " + f"Please use `torch.serialization.add_safe_globals([{full_path}])` or the " + f"`torch.serialization.safe_globals([{full_path}])` context manager to allowlist this global " + "if you trust this class/function." + ) + elif key[0] == NEWOBJ[0]: + args = self.stack.pop() + cls = self.stack.pop() + if cls is torch.nn.Parameter: + self.append(torch.nn.Parameter(*args)) + elif ( + cls in _get_user_allowed_globals().values() + or cls in _get_allowed_globals().values() + ): + result = cls.__new__(cls, *args) + if cls in torch._tensor_classes and "sparse" in cls.__module__: + _sparse_tensors_to_validate.append(result) + self.append(result) + else: + raise UnpicklingError( + "Can only create new object for nn.Parameter or classes allowlisted " + f"via `add_safe_globals` but got {cls}" + ) + elif key[0] == REDUCE[0]: + args = self.stack.pop() + func = self.stack[-1] + if ( + func not in _get_allowed_globals().values() + and func not in _get_user_allowed_globals().values() + ): + error_msg = ( + f"Trying to call reduce for unrecognized function {func}" + ) + if hasattr(func, "__self__"): + error_msg += f" which belongs to {func.__self__}" + raise UnpicklingError(error_msg) + result = func(*args) + if func in torch._tensor_classes and "sparse" in func.__module__: + _sparse_tensors_to_validate.append(result) + self.stack[-1] = result + elif key[0] == BUILD[0]: + state = self.stack.pop() + inst = self.stack[-1] + if type(inst) is torch.Tensor: + # Legacy unpickling + # pyrefly: ignore [not-iterable] + inst.set_(*state) + elif type(inst) is torch.nn.Parameter: + inst.__setstate__(state) + elif type(inst) is OrderedDict: + inst.__dict__.update(state) + elif ( + type(inst) in _get_user_allowed_globals().values() + or type(inst) in _get_allowed_globals().values() + ): + if hasattr(inst, "__setstate__"): + inst.__setstate__(state) + else: + # mimics load_build in pickle + # https://github.com/python/cpython/blob/f0c6fccd08904787a39269367f09f263d496114c/Lib/pickle.py#L1854-L1867 + slotstate = None + if isinstance(state, tuple) and len(state) == 2: + state, slotstate = state + if state: + inst.__dict__.update(state) + if slotstate: + for k, v in slotstate.items(): + setattr(inst, k, v) + else: + raise UnpicklingError( + "Can only build Tensor, Parameter, OrderedDict or types allowlisted " + f"via `add_safe_globals`, but got {type(inst)}" + ) + # Stack manipulation + elif key[0] == APPEND[0]: + item = self.stack.pop() + list_obj = self.stack[-1] + if type(list_obj) is not list: + raise UnpicklingError( + f"Can only append to lists, but got {type(list_obj)}" + ) + list_obj.append(item) + elif key[0] == APPENDS[0]: + items = self.pop_mark() + list_obj = self.stack[-1] + if type(list_obj) is not list: + raise UnpicklingError( + f"Can only extend lists, but got {type(list_obj)}" + ) + list_obj.extend(items) + elif key[0] == SETITEM[0]: + (v, k) = (self.stack.pop(), self.stack.pop()) + self._check_set_item_target("SETITEM") + self.stack[-1][k] = v + elif key[0] == SETITEMS[0]: + items = self.pop_mark() + self._check_set_item_target("SETITEMS") + for i in range(0, len(items), 2): + self.stack[-1][items[i]] = items[i + 1] + elif key[0] == MARK[0]: + self.metastack.append(self.stack) + self.stack = [] + self.append = self.stack.append + elif key[0] == TUPLE[0]: + items = self.pop_mark() + self.append(tuple(items)) + elif key[0] == TUPLE1[0]: + self.stack[-1] = (self.stack[-1],) + elif key[0] == TUPLE2[0]: + self.stack[-2:] = [(self.stack[-2], self.stack[-1])] + elif key[0] == TUPLE3[0]: + self.stack[-3:] = [(self.stack[-3], self.stack[-2], self.stack[-1])] + # Basic types construction + elif key[0] == NONE[0]: + self.append(None) + elif key[0] == NEWFALSE[0]: + self.append(False) + elif key[0] == NEWTRUE[0]: + self.append(True) + elif key[0] == EMPTY_TUPLE[0]: + self.append(()) + elif key[0] == EMPTY_LIST[0]: + self.append([]) + elif key[0] == EMPTY_DICT[0]: + self.append({}) + elif key[0] == EMPTY_SET[0]: + self.append(set()) + elif key[0] == BININT[0]: + self.append(unpack("d", self.read(8))[0]) + elif key[0] == BINUNICODE[0]: + strlen = unpack(" maxsize: + raise UnpicklingError("String is too long") + strval = str(read(strlen), "utf-8", "surrogatepass") + self.append(strval) + elif key[0] == SHORT_BINSTRING[0]: + strlen = read(1)[0] + strdata = read(strlen) + if self.encoding != "bytes": + strdata = strdata.decode(self.encoding, "strict") + self.append(strdata) + elif key[0] == BINPERSID[0]: + pid = self.stack.pop() + # Only allow persistent load of storage + if type(pid) is not tuple and type(pid) is not int: + raise UnpicklingError( + f"persistent_load id must be tuple or int, but got {type(pid)}" + ) + if ( + type(pid) is tuple + and len(pid) > 0 + and torch.serialization._maybe_decode_ascii(pid[0]) != "storage" + ): + raise UnpicklingError( + f"Only persistent_load of storage is allowed, but got {type(pid[0])}" + ) + self.append(self.persistent_load(pid)) + elif key[0] in [BINGET[0], LONG_BINGET[0]]: + idx = (read(1) if key[0] == BINGET[0] else unpack(" List of Tensors + + Broadcasts the given tensors according to :ref:`broadcasting-semantics`. + + Args: + *tensors: any number of tensors of the same type + + .. warning:: + + More than one element of a broadcasted tensor may refer to a single + memory location. As a result, in-place operations (especially ones that + are vectorized) may result in incorrect behavior. If you need to write + to the tensors, please clone them first. + + Example:: + + >>> x = torch.arange(3).view(1, 3) + >>> y = torch.arange(2).view(2, 1) + >>> a, b = torch.broadcast_tensors(x, y) + >>> a.size() + torch.Size([2, 3]) + >>> a + tensor([[0, 1, 2], + [0, 1, 2]]) + """ + # This wrapper exists to support variadic args. + if has_torch_function(tensors): + return handle_torch_function(broadcast_tensors, tensors, *tensors) + return _VF.broadcast_tensors(tensors) # type: ignore[attr-defined] + + +def broadcast_shapes(*shapes): + r"""broadcast_shapes(*shapes) -> Size + + Similar to :func:`broadcast_tensors` but for shapes. + + This is equivalent to + ``torch.broadcast_tensors(*map(torch.empty, shapes))[0].shape`` + but avoids the need create to intermediate tensors. This is useful for + broadcasting tensors of common batch shape but different rightmost shape, + e.g. to broadcast mean vectors with covariance matrices. + + Example:: + + >>> torch.broadcast_shapes((2,), (3, 1), (1, 1, 1)) + torch.Size([1, 3, 2]) + + Args: + \*shapes (torch.Size): Shapes of tensors. + + Returns: + shape (torch.Size): A shape compatible with all input shapes. + + Raises: + RuntimeError: If shapes are incompatible. + """ + # This wrapper exists to support variadic args. + # TODO Move this to C++ once the jit has better support for torch.Size. + if not torch.jit.is_tracing(): + result = torch._refs._broadcast_shapes(*shapes) + if result is None: + return torch.Size([]) + return torch.Size(result) + else: + # with implementation above, torch.jit.trace hardcodes the sizes which makes subsequent replays fail + with torch.no_grad(): + scalar = torch.zeros((), device="cpu") + tensors = [scalar.expand(shape) for shape in shapes] + tensors = broadcast_tensors(*tensors) + return tensors[0].shape + + +def split( + tensor: Tensor, + split_size_or_sections: int | list[int], + dim: int = 0, +) -> tuple[Tensor, ...]: + r"""Splits the tensor into chunks. Each chunk is a view of the original tensor. + + If :attr:`split_size_or_sections` is an integer type, then :attr:`tensor` will + be split into equally sized chunks (if possible). Last chunk will be smaller if + the tensor size along the given dimension :attr:`dim` is not divisible by + :attr:`split_size`. + + If :attr:`split_size_or_sections` is a list, then :attr:`tensor` will be split + into ``len(split_size_or_sections)`` chunks with sizes in :attr:`dim` according + to :attr:`split_size_or_sections`. + + Args: + tensor (Tensor): tensor to split. + split_size_or_sections (int) or (list(int)): size of a single chunk or + list of sizes for each chunk + dim (int): dimension along which to split the tensor. + + Example:: + + >>> a = torch.arange(10).reshape(5, 2) + >>> a + tensor([[0, 1], + [2, 3], + [4, 5], + [6, 7], + [8, 9]]) + >>> torch.split(a, 2) + (tensor([[0, 1], + [2, 3]]), + tensor([[4, 5], + [6, 7]]), + tensor([[8, 9]])) + >>> torch.split(a, [1, 4]) + (tensor([[0, 1]]), + tensor([[2, 3], + [4, 5], + [6, 7], + [8, 9]])) + """ + if has_torch_function_unary(tensor): + return handle_torch_function( + split, (tensor,), tensor, split_size_or_sections, dim=dim + ) + # Overwriting reason: + # This dispatches to two ATen functions depending on the type of + # split_size_or_sections. The branching code is in _tensor.py, which we + # call here. + return tensor.split(split_size_or_sections, dim) + + +def einsum(*args: Any) -> Tensor: + r"""einsum(equation, *operands) -> Tensor + + Sums the product of the elements of the input :attr:`operands` along dimensions specified using a notation + based on the Einstein summation convention. + + Einsum allows computing many common multi-dimensional linear algebraic array operations by representing them + in a short-hand format based on the Einstein summation convention, given by :attr:`equation`. The details of + this format are described below, but the general idea is to label every dimension of the input :attr:`operands` + with some subscript and define which subscripts are part of the output. The output is then computed by summing + the product of the elements of the :attr:`operands` along the dimensions whose subscripts are not part of the + output. For example, matrix multiplication can be computed using einsum as `torch.einsum("ij,jk->ik", A, B)`. + Here, j is the summation subscript and i and k the output subscripts (see section below for more details on why). + + Equation: + + The :attr:`equation` string specifies the subscripts (letters in `[a-zA-Z]`) for each dimension of + the input :attr:`operands` in the same order as the dimensions, separating subscripts for each operand by a + comma (','), e.g. `'ij,jk'` specify subscripts for two 2D operands. The dimensions labeled with the same subscript + must be broadcastable, that is, their size must either match or be `1`. The exception is if a subscript is + repeated for the same input operand, in which case the dimensions labeled with this subscript for this operand + must match in size and the operand will be replaced by its diagonal along these dimensions. The subscripts that + appear exactly once in the :attr:`equation` will be part of the output, sorted in increasing alphabetical order. + The output is computed by multiplying the input :attr:`operands` element-wise, with their dimensions aligned based + on the subscripts, and then summing out the dimensions whose subscripts are not part of the output. + + Optionally, the output subscripts can be explicitly defined by adding an arrow ('->') at the end of the equation + followed by the subscripts for the output. For instance, the following equation computes the transpose of a + matrix multiplication: 'ij,jk->ki'. The output subscripts must appear at least once for some input operand and + at most once for the output. + + Ellipsis ('...') can be used in place of subscripts to broadcast the dimensions covered by the ellipsis. + Each input operand may contain at most one ellipsis which will cover the dimensions not covered by subscripts, + e.g. for an input operand with 5 dimensions, the ellipsis in the equation `'ab...c'` cover the third and fourth + dimensions. The ellipsis does not need to cover the same number of dimensions across the :attr:`operands` but the + 'shape' of the ellipsis (the size of the dimensions covered by them) must broadcast together. If the output is not + explicitly defined with the arrow ('->') notation, the ellipsis will come first in the output (left-most dimensions), + before the subscript labels that appear exactly once for the input operands. e.g. the following equation implements + batch matrix multiplication `'...ij,...jk'`. + + A few final notes: the equation may contain whitespaces between the different elements (subscripts, ellipsis, + arrow and comma) but something like `'. . .'` is not valid. An empty string `''` is valid for scalar operands. + + .. note:: + + ``torch.einsum`` handles ellipsis ('...') differently from NumPy in that it allows dimensions + covered by the ellipsis to be summed over, that is, ellipsis are not required to be part of the output. + + .. note:: + + Please install opt-einsum (https://optimized-einsum.readthedocs.io/en/stable/) in order to enroll into a more + performant einsum. You can install when installing torch like so: `pip install torch[opt-einsum]` or by itself + with `pip install opt-einsum`. + + If opt-einsum is available, this function will automatically speed up computation and/or consume less memory + by optimizing contraction order through our opt_einsum backend :mod:`torch.backends.opt_einsum` (The _ vs - is + confusing, I know). This optimization occurs when there are at least three inputs, since the order does not matter + otherwise. Note that finding `the` optimal path is an NP-hard problem, thus, opt-einsum relies on different + heuristics to achieve near-optimal results. If opt-einsum is not available, the default order is to contract + from left to right. + + To bypass this default behavior, add the following to disable opt_einsum and skip path calculation: + ``torch.backends.opt_einsum.enabled = False`` + + To specify which strategy you'd like for opt_einsum to compute the contraction path, add the following line: + ``torch.backends.opt_einsum.strategy = 'auto'``. The default strategy is 'auto', and we also support 'greedy' and + 'optimal'. Disclaimer that the runtime of 'optimal' is factorial in the number of inputs! See more details in + the opt_einsum documentation (https://optimized-einsum.readthedocs.io/en/stable/path_finding.html). + + .. note:: + + As of PyTorch 1.10 :func:`torch.einsum` also supports the sublist format (see examples below). In this format, + subscripts for each operand are specified by sublists, list of integers in the range [0, 52). These sublists + follow their operands, and an extra sublist can appear at the end of the input to specify the output's + subscripts., e.g. `torch.einsum(op1, sublist1, op2, sublist2, ..., [subslist_out])`. Python's `Ellipsis` object + may be provided in a sublist to enable broadcasting as described in the Equation section above. + + Args: + equation (str): The subscripts for the Einstein summation. + operands (List[Tensor]): The tensors to compute the Einstein summation of. + + Examples:: + + >>> # xdoctest: +IGNORE_WANT("non-deterministic") + >>> # trace + >>> torch.einsum('ii', torch.randn(4, 4)) + tensor(-1.2104) + + >>> # xdoctest: +IGNORE_WANT("non-deterministic") + >>> # diagonal + >>> torch.einsum('ii->i', torch.randn(4, 4)) + tensor([-0.1034, 0.7952, -0.2433, 0.4545]) + + >>> # xdoctest: +IGNORE_WANT("non-deterministic") + >>> # outer product + >>> x = torch.randn(5) + >>> y = torch.randn(4) + >>> torch.einsum('i,j->ij', x, y) + tensor([[ 0.1156, -0.2897, -0.3918, 0.4963], + [-0.3744, 0.9381, 1.2685, -1.6070], + [ 0.7208, -1.8058, -2.4419, 3.0936], + [ 0.1713, -0.4291, -0.5802, 0.7350], + [ 0.5704, -1.4290, -1.9323, 2.4480]]) + + >>> # xdoctest: +IGNORE_WANT("non-deterministic") + >>> # batch matrix multiplication + >>> As = torch.randn(3, 2, 5) + >>> Bs = torch.randn(3, 5, 4) + >>> torch.einsum('bij,bjk->bik', As, Bs) + tensor([[[-1.0564, -1.5904, 3.2023, 3.1271], + [-1.6706, -0.8097, -0.8025, -2.1183]], + + [[ 4.2239, 0.3107, -0.5756, -0.2354], + [-1.4558, -0.3460, 1.5087, -0.8530]], + + [[ 2.8153, 1.8787, -4.3839, -1.2112], + [ 0.3728, -2.1131, 0.0921, 0.8305]]]) + + >>> # xdoctest: +IGNORE_WANT("non-deterministic") + >>> # with sublist format and ellipsis + >>> torch.einsum(As, [..., 0, 1], Bs, [..., 1, 2], [..., 0, 2]) + tensor([[[-1.0564, -1.5904, 3.2023, 3.1271], + [-1.6706, -0.8097, -0.8025, -2.1183]], + + [[ 4.2239, 0.3107, -0.5756, -0.2354], + [-1.4558, -0.3460, 1.5087, -0.8530]], + + [[ 2.8153, 1.8787, -4.3839, -1.2112], + [ 0.3728, -2.1131, 0.0921, 0.8305]]]) + + >>> # batch permute + >>> A = torch.randn(2, 3, 4, 5) + >>> torch.einsum('...ij->...ji', A).shape + torch.Size([2, 3, 5, 4]) + + >>> # equivalent to torch.nn.functional.bilinear + >>> A = torch.randn(3, 5, 4) + >>> l = torch.randn(2, 5) + >>> r = torch.randn(2, 4) + >>> torch.einsum('bn,anm,bm->ba', l, A, r) + tensor([[-0.3430, -5.2405, 0.4494], + [ 0.3311, 5.5201, -3.0356]]) + """ + import torch.backends.opt_einsum as opt_einsum + + # This wrapper exists to support variadic args. + if len(args) < 2: + raise ValueError( + "einsum(): must specify the equation string and at least one operand, " + "or at least one operand and its subscripts list" + ) + + equation = None + operands = None + + if isinstance(args[0], torch.Tensor): + # Convert the subscript list format which is an interleaving of operand and its subscripts + # list with an optional output subscripts list at the end (see documentation for more details on this) + # to the equation string format by creating the equation string from the subscripts list and grouping the + # input operands into a tensorlist (List[Tensor]). + def parse_subscript(n: int) -> str: + if n == Ellipsis: + return "..." + if n >= 0 and n < 26: + return chr(ord("A") + n) + if n >= 26 and n < 52: + return chr(ord("a") + n - 26) + raise ValueError( + "einsum(): subscript in subscript list is not within the valid range [0, 52)" + ) + + # Parse subscripts for input operands + equation = ",".join("".join(parse_subscript(s) for s in l) for l in args[1::2]) + + # Parse optional output subscripts (provided when the number of arguments is odd) + if len(args) % 2 == 1: + equation += "->" + "".join(parse_subscript(s) for s in args[-1]) + operands = args[:-1:2] + else: + operands = args[::2] + else: + equation = args[0] + operands = args[1:] + + if has_torch_function(operands): + return handle_torch_function(einsum, operands, equation, *operands) + + if len(operands) == 1 and isinstance(operands[0], (list, tuple)): + # the old interface of passing the operands as one list argument + _operands = operands[0] + # recurse in case operands contains value that has torch function + # in the original implementation this line is omitted + return einsum(equation, *_operands) + + if len(operands) <= 2 or not opt_einsum.enabled: + # the path for contracting 0 or 1 time(s) is already optimized + # or the user has disabled using opt_einsum + return _VF.einsum(equation, operands) # type: ignore[attr-defined] + + path = None + if opt_einsum.is_available(): + _opt_einsum = opt_einsum.get_opt_einsum() + tupled_path = _opt_einsum.contract_path( + equation, *operands, optimize=opt_einsum.strategy + )[0] + # flatten path for dispatching to C++ + path = [*itertools.chain.from_iterable(tupled_path)] + return _VF.einsum(equation, operands, path=path) # type: ignore[attr-defined] + + +# This wrapper exists to support variadic args. +if TYPE_CHECKING: + # The JIT doesn't understand Union, so only add type annotation for mypy + def meshgrid( + *tensors: Tensor | list[Tensor], indexing: str | None = None + ) -> tuple[Tensor, ...]: + return _meshgrid(*tensors, indexing=indexing) + +else: + + def meshgrid(*tensors, indexing: str | None = None) -> tuple[Tensor, ...]: + r"""Creates grids of coordinates specified by the 1D inputs in `attr`:tensors. + + This is helpful when you want to visualize data over some + range of inputs. See below for a plotting example. + + Given :math:`N` 1D tensors :math:`T_0 \ldots T_{N-1}` as + inputs with corresponding sizes :math:`S_0 \ldots S_{N-1}`, + this creates :math:`N` N-dimensional tensors :math:`G_0 \ldots + G_{N-1}`, each with shape :math:`(S_0, ..., S_{N-1})` where + the output :math:`G_i` is constructed by expanding :math:`T_i` + to the result shape. + + .. note:: + 0D inputs are treated equivalently to 1D inputs of a + single element. + + .. warning:: + `torch.meshgrid(*tensors)` currently has the same behavior + as calling `numpy.meshgrid(*arrays, indexing='ij')`. + + In the future `torch.meshgrid` will transition to + `indexing='xy'` as the default. + + https://github.com/pytorch/pytorch/issues/50276 tracks + this issue with the goal of migrating to NumPy's behavior. + + .. seealso:: + + :func:`torch.cartesian_prod` has the same effect but it + collects the data in a tensor of vectors. + + Args: + tensors (list of Tensor): list of scalars or 1 dimensional tensors. Scalars will be + treated as tensors of size :math:`(1,)` automatically + + indexing: (str, optional): the indexing mode, either "xy" + or "ij", defaults to "ij". See warning for future changes. + + If "xy" is selected, the first dimension corresponds + to the cardinality of the second input and the second + dimension corresponds to the cardinality of the first + input. + + If "ij" is selected, the dimensions are in the same + order as the cardinality of the inputs. + + Returns: + seq (sequence of Tensors): If the input has :math:`N` + tensors of size :math:`S_0 \ldots S_{N-1}``, then the + output will also have :math:`N` tensors, where each tensor + is of shape :math:`(S_0, ..., S_{N-1})`. + + Example:: + + >>> x = torch.tensor([1, 2, 3]) + >>> y = torch.tensor([4, 5, 6]) + + Observe the element-wise pairings across the grid, (1, 4), + (1, 5), ..., (3, 6). This is the same thing as the + cartesian product. + >>> grid_x, grid_y = torch.meshgrid(x, y, indexing='ij') + >>> grid_x + tensor([[1, 1, 1], + [2, 2, 2], + [3, 3, 3]]) + >>> grid_y + tensor([[4, 5, 6], + [4, 5, 6], + [4, 5, 6]]) + + This correspondence can be seen when these grids are + stacked properly. + >>> torch.equal(torch.cat(tuple(torch.dstack([grid_x, grid_y]))), + ... torch.cartesian_prod(x, y)) + True + + `torch.meshgrid` is commonly used to produce a grid for + plotting. + >>> # xdoctest: +REQUIRES(module:matplotlib) + >>> # xdoctest: +REQUIRES(env:DOCTEST_SHOW) + >>> import matplotlib.pyplot as plt + >>> xs = torch.linspace(-5, 5, steps=100) + >>> ys = torch.linspace(-5, 5, steps=100) + >>> x, y = torch.meshgrid(xs, ys, indexing='xy') + >>> z = torch.sin(torch.sqrt(x * x + y * y)) + >>> ax = plt.axes(projection='3d') + >>> ax.plot_surface(x.numpy(), y.numpy(), z.numpy()) + >>> plt.show() + + .. image:: ../_static/img/meshgrid.png + :width: 512 + + """ + return _meshgrid(*tensors, indexing=indexing) + + +def _meshgrid(*tensors, indexing: str | None): + if has_torch_function(tensors): + return handle_torch_function(meshgrid, tensors, *tensors, indexing=indexing) + if len(tensors) == 1 and isinstance(tensors[0], (list, tuple)): + # the old interface of passing the operands as one list argument + tensors = tensors[0] # type: ignore[assignment] + + # Continue allowing call of old method that takes no indexing + # kwarg for forward compatibility reasons. + # + # Remove this two weeks after landing. + kwargs = {} if indexing is None else {"indexing": indexing} + return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] + + +def stft( + input: Tensor, + n_fft: int, + hop_length: int | None = None, + win_length: int | None = None, + window: Tensor | None = None, + center: bool = True, + pad_mode: str = "reflect", + normalized: bool = False, + onesided: bool | None = None, + return_complex: bool | None = None, + align_to_window: bool | None = None, +) -> Tensor: + r"""Short-time Fourier transform (STFT). + + .. warning:: + From version 1.8.0, :attr:`return_complex` must always be given + explicitly for real inputs and `return_complex=False` has been + deprecated. Strongly prefer `return_complex=True` as in a future + pytorch release, this function will only return complex tensors. + + Note that :func:`torch.view_as_real` can be used to recover a real + tensor with an extra last dimension for real and imaginary components. + + .. warning:: + From version 2.1, a warning will be provided if a :attr:`window` is + not specified. In a future release, this attribute will be required. + Not providing a window currently defaults to using a rectangular window, + which may result in undesirable artifacts. Consider using tapered windows, + such as :func:`torch.hann_window`. + + The STFT computes the Fourier transform of short overlapping windows of the + input. This giving frequency components of the signal as they change over + time. The interface of this function is modeled after (but *not* a drop-in + replacement for) librosa_ stft function. + + .. _librosa: https://librosa.org/doc/latest/generated/librosa.stft.html + + Ignoring the optional batch dimension, this method computes the following + expression: + + .. math:: + X[\omega, m] = \sum_{k = 0}^{\text{win\_length-1}}% + \text{window}[k]\ \text{input}[m \times \text{hop\_length} + k]\ % + \exp\left(- j \frac{2 \pi \cdot \omega k}{\text{n\_fft}}\right), + + where :math:`m` is the index of the sliding window, and :math:`\omega` is + the frequency :math:`0 \leq \omega < \text{n\_fft}` for ``onesided=False``, + or :math:`0 \leq \omega < \lfloor \text{n\_fft} / 2 \rfloor + 1` for ``onesided=True``. + + * :attr:`input` must be either a 1-D time sequence or a 2-D batch of time + sequences. + + * If :attr:`hop_length` is ``None`` (default), it is treated as equal to + ``floor(n_fft / 4)``. + + * If :attr:`win_length` is ``None`` (default), it is treated as equal to + :attr:`n_fft`. + + * :attr:`window` can be a 1-D tensor of size :attr:`win_length`, e.g., from + :meth:`torch.hann_window`. If :attr:`window` is ``None`` (default), it is + treated as if having :math:`1` everywhere in the window. If + :math:`\text{win\_length} < \text{n\_fft}`, :attr:`window` will be padded on + both sides to length :attr:`n_fft` before being applied. + + * If :attr:`center` is ``True`` (default), :attr:`input` will be padded on + both sides so that the :math:`t`-th frame is centered at time + :math:`t \times \text{hop\_length}`. Otherwise, the :math:`t`-th frame + begins at time :math:`t \times \text{hop\_length}`. + + * :attr:`pad_mode` determines the padding method used on :attr:`input` when + :attr:`center` is ``True``. See :meth:`torch.nn.functional.pad` for + all available options. Default is ``"reflect"``. + + * If :attr:`onesided` is ``True`` (default for real input), only values for + :math:`\omega` in :math:`\left[0, 1, 2, \dots, \left\lfloor + \frac{\text{n\_fft}}{2} \right\rfloor + 1\right]` are returned because + the real-to-complex Fourier transform satisfies the conjugate symmetry, + i.e., :math:`X[m, \omega] = X[m, \text{n\_fft} - \omega]^*`. + Note if the input or window tensors are complex, then :attr:`onesided` + output is not possible. + + * If :attr:`normalized` is ``True`` (default is ``False``), the function + returns the normalized STFT results, i.e., multiplied by :math:`(\text{frame\_length})^{-0.5}`. + + * If :attr:`return_complex` is ``True`` (default if input is complex), the + return is a ``input.dim() + 1`` dimensional complex tensor. If ``False``, + the output is a ``input.dim() + 2`` dimensional real tensor where the last + dimension represents the real and imaginary components. + + Returns either a complex tensor of size :math:`(* \times N \times T)` if + :attr:`return_complex` is true, or a real tensor of size :math:`(* \times N + \times T \times 2)`. Where :math:`*` is the optional batch size of + :attr:`input`, :math:`N` is the number of frequencies where STFT is applied + and :math:`T` is the total number of frames used. + + .. warning:: + This function changed signature at version 0.4.1. Calling with the + previous signature may cause error or return incorrect result. + + Args: + input (Tensor): the input tensor of shape `(B?, L)` where `B?` is an optional + batch dimension + n_fft (int): size of Fourier transform + hop_length (int, optional): the distance between neighboring sliding window + frames. Default: ``None`` (treated as equal to ``floor(n_fft / 4)``) + win_length (int, optional): the size of window frame and STFT filter. + Default: ``None`` (treated as equal to :attr:`n_fft`) + window (Tensor, optional): the optional window function. + Shape must be 1d and `<= n_fft` + Default: ``None`` (treated as window of all :math:`1` s) + center (bool, optional): whether to pad :attr:`input` on both sides so + that the :math:`t`-th frame is centered at time :math:`t \times \text{hop\_length}`. + Default: ``True`` + pad_mode (str, optional): controls the padding method used when + :attr:`center` is ``True``. Default: ``"reflect"`` + normalized (bool, optional): controls whether to return the normalized STFT results + Default: ``False`` + onesided (bool, optional): controls whether to return half of results to + avoid redundancy for real inputs. + Default: ``True`` for real :attr:`input` and :attr:`window`, ``False`` otherwise. + return_complex (bool, optional): whether to return a complex tensor, or + a real tensor with an extra last dimension for the real and + imaginary components. + + .. versionchanged:: 2.0 + ``return_complex`` is now a required argument for real inputs, + as the default is being transitioned to ``True``. + + .. deprecated:: 2.0 + ``return_complex=False`` is deprecated, instead use ``return_complex=True`` + Note that calling :func:`torch.view_as_real` on the output will + recover the deprecated output format. + + Returns: + Tensor: A tensor containing the STFT result with shape `(B?, N, T, C?)` where + - `B?` is an optional batch dimension from the input. + - `N` is the number of frequency samples, `(n_fft // 2) + 1` for + `onesided=True`, or otherwise `n_fft`. + - `T` is the number of frames, `1 + L // hop_length` + for `center=True`, or `1 + (L - n_fft) // hop_length` otherwise. + - `C?` is an optional length-2 dimension of real and imaginary + components, present when `return_complex=False`. + + """ + if has_torch_function_unary(input): + return handle_torch_function( + stft, + (input,), + input, + n_fft, + hop_length=hop_length, + win_length=win_length, + window=window, + center=center, + pad_mode=pad_mode, + normalized=normalized, + onesided=onesided, + return_complex=return_complex, + align_to_window=align_to_window, + ) + if center and align_to_window is not None: + raise RuntimeError( + "stft align_to_window should only be set when center = false" + ) + # NOTE: Do not edit. This code will be removed once the forward-compatibility + # period is over for PR #73432 + if center: + signal_dim = input.dim() + extended_shape = [1] * (3 - signal_dim) + list(input.size()) + pad = int(n_fft // 2) + input = F.pad(input.view(extended_shape), [pad, pad], pad_mode) + input = input.view(input.shape[-signal_dim:]) + return _VF.stft( # type: ignore[attr-defined] + input, + n_fft, + hop_length, + win_length, + window, + normalized, + onesided, + return_complex, + align_to_window, + ) + + +istft = _add_docstr( + torch.istft, + "istft(input, n_fft, hop_length=None, win_length=None, window=None, center=True, " + "normalized=False, onesided=None, length=None, return_complex=False) -> Tensor:\n" + r""" +Inverse short time Fourier Transform. This is expected to be the inverse of :func:`~torch.stft`. + +.. warning:: + From version 2.1, a warning will be provided if a :attr:`window` is + not specified. In a future release, this attribute will be required. + Please provide the same window used in the stft call. + +It has the same parameters (+ additional optional parameter of :attr:`length`) and it should return the +least squares estimation of the original signal. The algorithm will check using the NOLA condition ( +nonzero overlap). + +Important consideration in the parameters :attr:`window` and :attr:`center` so that the envelope +created by the summation of all the windows is never zero at certain point in time. Specifically, +:math:`\sum_{t=-\infty}^{\infty} |w|^2[n-t\times hop\_length] \cancel{=} 0`. + +Since :func:`~torch.stft` discards elements at the end of the signal if they do not fit in a frame, +``istft`` may return a shorter signal than the original signal (can occur if :attr:`center` is False +since the signal isn't padded). If `length` is given in the arguments and is longer than expected, +``istft`` will pad zeros to the end of the returned signal. + +If :attr:`center` is ``True``, then there will be padding e.g. ``'constant'``, ``'reflect'``, etc. +Left padding can be trimmed off exactly because they can be calculated but right padding cannot be +calculated without additional information. + +Example: Suppose the last window is: +``[17, 18, 0, 0, 0]`` vs ``[18, 0, 0, 0, 0]`` + +The :attr:`n_fft`, :attr:`hop_length`, :attr:`win_length` are all the same which prevents the calculation +of right padding. These additional values could be zeros or a reflection of the signal so providing +:attr:`length` could be useful. If :attr:`length` is ``None`` then padding will be aggressively removed +(some loss of signal). + +[1] D. W. Griffin and J. S. Lim, "Signal estimation from modified short-time Fourier transform," +IEEE Trans. ASSP, vol.32, no.2, pp.236-243, Apr. 1984. + +Args: + input (Tensor): The input tensor. Expected to be in the format of :func:`~torch.stft`, + output. That is a complex tensor of shape `(B?, N, T)` where + + - `B?` is an optional batch dimension + - `N` is the number of frequency samples, `(n_fft // 2) + 1` + for onesided input, or otherwise `n_fft`. + - `T` is the number of frames, `1 + length // hop_length` for centered stft, + or `1 + (length - n_fft) // hop_length` otherwise. + + .. versionchanged:: 2.0 + Real datatype inputs are no longer supported. Input must now have a + complex datatype, as returned by ``stft(..., return_complex=True)``. + n_fft (int): Size of Fourier transform + hop_length (Optional[int]): The distance between neighboring sliding window frames. + (Default: ``n_fft // 4``) + win_length (Optional[int]): The size of window frame and STFT filter. (Default: ``n_fft``) + window (Optional[torch.Tensor]): The optional window function. + Shape must be 1d and `<= n_fft` + (Default: ``torch.ones(win_length)``) + center (bool): Whether :attr:`input` was padded on both sides so that the :math:`t`-th frame is + centered at time :math:`t \times \text{hop\_length}`. + (Default: ``True``) + normalized (bool): Whether the STFT was normalized. (Default: ``False``) + onesided (Optional[bool]): Whether the STFT was onesided. + (Default: ``True`` if `n_fft != fft_size` in the input size) + length (Optional[int]): The amount to trim the signal by (i.e. the + original signal length). Defaults to `(T - 1) * hop_length` for + centered stft, or `n_fft + (T - 1) * hop_length` otherwise, where `T` + is the number of input frames. + return_complex (Optional[bool]): + Whether the output should be complex, or if the input should be + assumed to derive from a real signal and window. + Note that this is incompatible with ``onesided=True``. + (Default: ``False``) + +Returns: + Tensor: Least squares estimation of the original signal of shape `(B?, length)` where + `B?` is an optional batch dimension from the input tensor. +""", +) + + +if TYPE_CHECKING: + # These _impl functions return a variable number of tensors as output with + # __torch_function__; tuple unpacking is done already rather than being + # done by the caller of the _impl function + _unique_impl_out = Any +else: + _unique_impl_out = tuple[Tensor, Tensor, Tensor] + + +def _unique_impl( + input: Tensor, + sorted: bool = True, + return_inverse: bool = False, + return_counts: bool = False, + dim: int | None = None, +) -> _unique_impl_out: + r"""unique(input, sorted=True, return_inverse=False, return_counts=False, dim=None) -> tuple[Tensor, Tensor, Tensor] + + Returns the unique elements of the input tensor. + + .. note:: This function is different from :func:`torch.unique_consecutive` in the sense that + this function also eliminates non-consecutive duplicate values. + + .. note:: Currently in the CUDA implementation and the CPU implementation, + `torch.unique` always sort the tensor at the beginning regardless of the `sort` argument. + Sorting could be slow, so if your input tensor is already sorted, it is recommended to use + :func:`torch.unique_consecutive` which avoids the sorting. + + Args: + input (Tensor): the input tensor + sorted (bool): Whether to sort the unique elements in ascending order + before returning as output. + return_inverse (bool): Whether to also return the indices for where + elements in the original input ended up in the returned unique list. + return_counts (bool): Whether to also return the counts for each unique + element. + dim (int, optional): the dimension to operate upon. If ``None``, the + unique of the flattened input is returned. Otherwise, each of the + tensors indexed by the given dimension is treated as one of the + elements to apply the unique operation upon. See examples for more + details. Default: ``None`` + + Returns: + (Tensor, Tensor (optional), Tensor (optional)): A tensor or a tuple of tensors containing + + - **output** (*Tensor*): the output list of unique scalar elements. + - **inverse_indices** (*Tensor*): (optional) if + :attr:`return_inverse` is True, there will be an additional + returned tensor (same shape as input) representing the indices + for where elements in the original input map to in the output; + otherwise, this function will only return a single tensor. + - **counts** (*Tensor*): (optional) if + :attr:`return_counts` is True, there will be an additional + returned tensor (same shape as output or output.size(dim), + if dim was specified) representing the number of occurrences + for each unique value or tensor. + + Example:: + + >>> output = torch.unique(torch.tensor([1, 3, 2, 3], dtype=torch.long)) + >>> output + tensor([1, 2, 3]) + + >>> output, inverse_indices = torch.unique( + ... torch.tensor([1, 3, 2, 3], dtype=torch.long), sorted=True, return_inverse=True) + >>> output + tensor([1, 2, 3]) + >>> inverse_indices + tensor([0, 2, 1, 2]) + + >>> output, inverse_indices = torch.unique( + ... torch.tensor([[1, 3], [2, 3]], dtype=torch.long), sorted=True, return_inverse=True) + >>> output + tensor([1, 2, 3]) + >>> inverse_indices + tensor([[0, 2], + [1, 2]]) + + >>> a = torch.tensor([ + ... [ + ... [1, 1, 0, 0], + ... [1, 1, 0, 0], + ... [0, 0, 1, 1], + ... ], + ... [ + ... [0, 0, 1, 1], + ... [0, 0, 1, 1], + ... [1, 1, 1, 1], + ... ], + ... [ + ... [1, 1, 0, 0], + ... [1, 1, 0, 0], + ... [0, 0, 1, 1], + ... ], + ... ]) + + >>> # If we call `torch.unique(a, dim=0)`, each of the tensors `a[idx, :, :]` + >>> # will be compared. We can see that `a[0, :, :]` and `a[2, :, :]` match + >>> # each other, so one of them will be removed. + >>> (a[0, :, :] == a[2, :, :]).all() + tensor(True) + >>> a_unique_dim0 = torch.unique(a, dim=0) + >>> a_unique_dim0 + tensor([[[0, 0, 1, 1], + [0, 0, 1, 1], + [1, 1, 1, 1]], + [[1, 1, 0, 0], + [1, 1, 0, 0], + [0, 0, 1, 1]]]) + + >>> # Notice which sub-tensors from `a` match with the sub-tensors from + >>> # `a_unique_dim0`: + >>> (a_unique_dim0[0, :, :] == a[1, :, :]).all() + tensor(True) + >>> (a_unique_dim0[1, :, :] == a[0, :, :]).all() + tensor(True) + + >>> # For `torch.unique(a, dim=1)`, each of the tensors `a[:, idx, :]` are + >>> # compared. `a[:, 0, :]` and `a[:, 1, :]` match each other, so one of + >>> # them will be removed. + >>> (a[:, 0, :] == a[:, 1, :]).all() + tensor(True) + >>> torch.unique(a, dim=1) + tensor([[[0, 0, 1, 1], + [1, 1, 0, 0]], + [[1, 1, 1, 1], + [0, 0, 1, 1]], + [[0, 0, 1, 1], + [1, 1, 0, 0]]]) + + >>> # For `torch.unique(a, dim=2)`, the tensors `a[:, :, idx]` are compared. + >>> # `a[:, :, 0]` and `a[:, :, 1]` match each other. Also, `a[:, :, 2]` and + >>> # `a[:, :, 3]` match each other as well. So in this case, two of the + >>> # sub-tensors will be removed. + >>> (a[:, :, 0] == a[:, :, 1]).all() + tensor(True) + >>> (a[:, :, 2] == a[:, :, 3]).all() + tensor(True) + >>> torch.unique(a, dim=2) + tensor([[[0, 1], + [0, 1], + [1, 0]], + [[1, 0], + [1, 0], + [1, 1]], + [[0, 1], + [0, 1], + [1, 0]]]) + """ + if has_torch_function_unary(input): + return handle_torch_function( + unique, + (input,), + input, + sorted=sorted, + return_inverse=return_inverse, + return_counts=return_counts, + dim=dim, + ) + + if dim is not None: + output, inverse_indices, counts = _VF.unique_dim( + input, + dim, + sorted=sorted, + return_inverse=return_inverse, + return_counts=return_counts, + ) + else: + output, inverse_indices, counts = torch._unique2( + input, + sorted=sorted, + return_inverse=return_inverse, + return_counts=return_counts, + ) + return output, inverse_indices, counts + + +def _unique_consecutive_impl( + input: Tensor, + return_inverse: bool = False, + return_counts: bool = False, + dim: int | None = None, +) -> _unique_impl_out: + r"""Eliminates all but the first element from every consecutive group of equivalent elements. + + .. note:: This function is different from :func:`torch.unique` in the sense that this function + only eliminates consecutive duplicate values. This semantics is similar to `std::unique` + in C++. + + Args: + input (Tensor): the input tensor + return_inverse (bool): Whether to also return the indices for where + elements in the original input ended up in the returned unique list. + return_counts (bool): Whether to also return the counts for each unique + element. + dim (int): the dimension to apply unique. If ``None``, the unique of the + flattened input is returned. default: ``None`` + + Returns: + (Tensor, Tensor (optional), Tensor (optional)): A tensor or a tuple of tensors containing + + - **output** (*Tensor*): the output list of unique scalar elements. + - **inverse_indices** (*Tensor*): (optional) if + :attr:`return_inverse` is True, there will be an additional + returned tensor (same shape as input) representing the indices + for where elements in the original input map to in the output; + otherwise, this function will only return a single tensor. + - **counts** (*Tensor*): (optional) if + :attr:`return_counts` is True, there will be an additional + returned tensor (same shape as output or output.size(dim), + if dim was specified) representing the number of occurrences + for each unique value or tensor. + + Example:: + + >>> x = torch.tensor([1, 1, 2, 2, 3, 1, 1, 2]) + >>> output = torch.unique_consecutive(x) + >>> output + tensor([1, 2, 3, 1, 2]) + + >>> output, inverse_indices = torch.unique_consecutive(x, return_inverse=True) + >>> output + tensor([1, 2, 3, 1, 2]) + >>> inverse_indices + tensor([0, 0, 1, 1, 2, 3, 3, 4]) + + >>> output, counts = torch.unique_consecutive(x, return_counts=True) + >>> output + tensor([1, 2, 3, 1, 2]) + >>> counts + tensor([2, 2, 1, 2, 1]) + """ + if has_torch_function_unary(input): + return handle_torch_function( + unique_consecutive, + (input,), + input, + return_inverse=return_inverse, + return_counts=return_counts, + dim=dim, + ) + output, inverse_indices, counts = _VF.unique_consecutive( # type: ignore[attr-defined] + input, return_inverse=return_inverse, return_counts=return_counts, dim=dim + ) + return output, inverse_indices, counts + + +def _return_counts( + input, + sorted=True, + return_inverse=False, + return_counts=False, + dim=None, +): + # type: (Tensor, bool, bool, bool, Optional[int]) -> tuple[Tensor, Tensor] + + if has_torch_function_unary(input): + return _unique_impl(input, sorted, return_inverse, return_counts, dim) + + output, _, counts = _unique_impl(input, sorted, return_inverse, return_counts, dim) + return output, counts + + +def _return_output( + input, + sorted=True, + return_inverse=False, + return_counts=False, + dim=None, +): + # type: (Tensor, bool, bool, bool, Optional[int]) -> Tensor + + if has_torch_function_unary(input): + return _unique_impl(input, sorted, return_inverse, return_counts, dim) + + output, _, _ = _unique_impl(input, sorted, return_inverse, return_counts, dim) + return output + + +def _return_inverse( + input, + sorted=True, + return_inverse=False, + return_counts=False, + dim=None, +): + # type: (Tensor, bool, bool, bool, Optional[int]) -> tuple[Tensor, Tensor] + + if has_torch_function_unary(input): + return _unique_impl(input, sorted, return_inverse, return_counts, dim) + + output, inverse_indices, _ = _unique_impl( + input, sorted, return_inverse, return_counts, dim + ) + return output, inverse_indices + + +_return_inverse_false = boolean_dispatch( + arg_name="return_counts", + arg_index=3, + default=False, + if_true=_return_counts, + if_false=_return_output, + module_name=__name__, + func_name="unique", +) + +_return_inverse_true = boolean_dispatch( + arg_name="return_counts", + arg_index=3, + default=False, + if_true=_unique_impl, + if_false=_return_inverse, + module_name=__name__, + func_name="unique", +) + +# The return type of unique depends on `return_inverse`, and `return_counts` so in order to +# resolve the output type in TorchScript we need to statically know the value of both parameters + +unique = boolean_dispatch( + arg_name="return_inverse", + arg_index=2, + default=False, + if_true=_return_inverse_true, + if_false=_return_inverse_false, + module_name=__name__, + func_name="unique", +) +unique.__doc__ = _unique_impl.__doc__ + + +def _consecutive_return_counts( + input, + return_inverse=False, + return_counts=False, + dim=None, +): + # type: (Tensor, bool, bool, Optional[int]) -> tuple[Tensor, Tensor] + + if has_torch_function_unary(input): + return _unique_consecutive_impl(input, return_inverse, return_counts, dim) + + output, _, counts = _unique_consecutive_impl( + input, return_inverse, return_counts, dim + ) + return output, counts + + +def _consecutive_return_output( + input, + return_inverse=False, + return_counts=False, + dim=None, +): + # type: (Tensor, bool, bool, Optional[int]) -> Tensor + + if has_torch_function_unary(input): + return _unique_consecutive_impl(input, return_inverse, return_counts, dim) + + output, _, _ = _unique_consecutive_impl(input, return_inverse, return_counts, dim) + return output + + +def _consecutive_return_inverse( + input, + return_inverse=False, + return_counts=False, + dim=None, +): + # type: (Tensor, bool, bool, Optional[int]) -> tuple[Tensor, Tensor] + + if has_torch_function_unary(input): + return _unique_consecutive_impl(input, return_inverse, return_counts, dim) + + output, inverse_indices, _ = _unique_consecutive_impl( + input, return_inverse, return_counts, dim + ) + return output, inverse_indices + + +_consecutive_return_inverse_false = boolean_dispatch( + arg_name="return_counts", + arg_index=1, + default=False, + if_true=_consecutive_return_counts, + if_false=_consecutive_return_output, + module_name=__name__, + func_name="unique_consecutive", +) + +_consecutive_return_inverse_true = boolean_dispatch( + arg_name="return_counts", + arg_index=1, + default=False, + if_true=_unique_consecutive_impl, + if_false=_consecutive_return_inverse, + module_name=__name__, + func_name="unique_consecutive", +) + +# The return type of unique depends on `return_inverse`, and `return_counts` so in order to +# resolve the output type in TorchScript we need to statically know the value of both parameters + +unique_consecutive = boolean_dispatch( + arg_name="return_inverse", + arg_index=2, + default=False, + if_true=_consecutive_return_inverse_true, + if_false=_consecutive_return_inverse_false, + module_name=__name__, + func_name="unique_consecutive", +) +unique_consecutive.__doc__ = _unique_consecutive_impl.__doc__ + +if TYPE_CHECKING: + pass + # There's no good way to use this type annotation without breaking JIT + # overloads. So leave untyped for mypy for now. +else: + + @overload + def tensordot( + a, + b, + dims: int = 2, + out: torch.Tensor | None = None, + ): + pass + + @overload + def tensordot( # noqa: F811 + a, + b, + dims: tuple[list[int], list[int]], + out: torch.Tensor | None = None, + ): + pass + + @overload + def tensordot( # noqa: F811 + a, + b, + dims: list[list[int]], + out: torch.Tensor | None = None, + ): + pass + + @overload + def tensordot( # noqa: F811 + a, + b, + dims: torch.Tensor, + out: torch.Tensor | None = None, + ): + pass + + +def tensordot( # noqa: F811 + a, + b, + dims=2, + out: torch.Tensor | None = None, +): + r"""Returns a contraction of a and b over multiple dimensions. + + :attr:`tensordot` implements a generalized matrix product. + + Args: + a (Tensor): Left tensor to contract + b (Tensor): Right tensor to contract + dims (int or Tuple[List[int], List[int]] or List[List[int]] containing two lists or Tensor): number of dimensions to + contract or explicit lists of dimensions for :attr:`a` and + :attr:`b` respectively + + When called with a non-negative integer argument :attr:`dims` = :math:`d`, and + the number of dimensions of :attr:`a` and :attr:`b` is :math:`m` and :math:`n`, + respectively, :func:`~torch.tensordot` computes + + .. math:: + r_{i_0,...,i_{m-d}, i_d,...,i_n} + = \sum_{k_0,...,k_{d-1}} a_{i_0,...,i_{m-d},k_0,...,k_{d-1}} \times b_{k_0,...,k_{d-1}, i_d,...,i_n}. + + When called with :attr:`dims` of the list form, the given dimensions will be contracted + in place of the last :math:`d` of :attr:`a` and the first :math:`d` of :math:`b`. The sizes + in these dimensions must match, but :func:`~torch.tensordot` will deal with broadcasted + dimensions. + + Examples:: + + >>> a = torch.arange(60.).reshape(3, 4, 5) + >>> b = torch.arange(24.).reshape(4, 3, 2) + >>> torch.tensordot(a, b, dims=([1, 0], [0, 1])) + tensor([[4400., 4730.], + [4532., 4874.], + [4664., 5018.], + [4796., 5162.], + [4928., 5306.]]) + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> a = torch.randn(3, 4, 5, device='cuda') + >>> b = torch.randn(4, 5, 6, device='cuda') + >>> c = torch.tensordot(a, b, dims=2).cpu() + tensor([[ 8.3504, -2.5436, 6.2922, 2.7556, -1.0732, 3.2741], + [ 3.3161, 0.0704, 5.0187, -0.4079, -4.3126, 4.8744], + [ 0.8223, 3.9445, 3.2168, -0.2400, 3.4117, 1.7780]]) + + >>> a = torch.randn(3, 5, 4, 6) + >>> b = torch.randn(6, 4, 5, 3) + >>> torch.tensordot(a, b, dims=([2, 1, 3], [1, 2, 0])) + tensor([[ 7.7193, -2.4867, -10.3204], + [ 1.5513, -14.4737, -6.5113], + [ -0.2850, 4.2573, -3.5997]]) + """ + if has_torch_function_variadic(a, b): + return handle_torch_function(tensordot, (a, b), a, b, dims=dims, out=out) + + if not isinstance(dims, (tuple, list, torch.Tensor, int, torch.SymInt)): + raise RuntimeError( + "tensordot expects dims to be int or " + + "tuple[list[int], list[int]] or " + + "list[list[int]] containing two lists, but got " + + f"dims={dims}" + ) + + dims_a: list[int] = [] + dims_b: list[int] = [] + + if isinstance(dims, (tuple, list)): + dims_a, dims_b = dims + + if isinstance(dims, torch.Tensor): + num_elements = dims.numel() + if num_elements > 1: + assert dims.size()[0] == 2 + dims_a = torch.jit.annotate(list[int], dims[0].tolist()) + dims_b = torch.jit.annotate(list[int], dims[1].tolist()) + else: + dims_val = int(dims.item()) + if dims_val < 0: + raise RuntimeError(f"tensordot expects dims >= 0, but got dims={dims}") + dims_a = list(range(-dims_val, 0)) + dims_b = list(range(dims_val)) + + if isinstance(dims, (int, torch.SymInt)): + if dims < 0: + raise RuntimeError(f"tensordot expects dims >= 0, but got dims={dims}") + if dims > min(a.dim(), b.dim()): + raise RuntimeError( + f"tensordot expects dims < ndim_a or ndim_b, but got dims={dims}" + ) + dims_a = list(range(-dims, 0)) + dims_b = list(range(dims)) + + if out is None: + return _VF.tensordot(a, b, dims_a, dims_b) # type: ignore[attr-defined] + else: + return _VF.tensordot(a, b, dims_a, dims_b, out=out) # type: ignore[attr-defined] + + +def cartesian_prod(*tensors: Tensor) -> Tensor: + """Do cartesian product of the given sequence of tensors. The behavior is similar to + python's `itertools.product`. + + Args: + *tensors: any number of 1 dimensional tensors. + + Returns: + Tensor: A tensor equivalent to converting all the input tensors into lists, + do `itertools.product` on these lists, and finally convert the resulting list + into tensor. + + Example:: + + >>> import itertools + >>> a = [1, 2, 3] + >>> b = [4, 5] + >>> list(itertools.product(a, b)) + [(1, 4), (1, 5), (2, 4), (2, 5), (3, 4), (3, 5)] + >>> tensor_a = torch.tensor(a) + >>> tensor_b = torch.tensor(b) + >>> torch.cartesian_prod(tensor_a, tensor_b) + tensor([[1, 4], + [1, 5], + [2, 4], + [2, 5], + [3, 4], + [3, 5]]) + """ + # This wrapper exists to support variadic args. + if has_torch_function(tensors): + return handle_torch_function(cartesian_prod, tensors, *tensors) + return _VF.cartesian_prod(tensors) # type: ignore[attr-defined] + + +def block_diag(*tensors): + """Create a block diagonal matrix from provided tensors. + + Args: + *tensors: One or more tensors with 0, 1, or 2 dimensions. + + Returns: + Tensor: A 2 dimensional tensor with all the input tensors arranged in + order such that their upper left and lower right corners are + diagonally adjacent. All other elements are set to 0. + + Example:: + + >>> import torch + >>> A = torch.tensor([[0, 1], [1, 0]]) + >>> B = torch.tensor([[3, 4, 5], [6, 7, 8]]) + >>> C = torch.tensor(7) + >>> D = torch.tensor([1, 2, 3]) + >>> E = torch.tensor([[4], [5], [6]]) + >>> torch.block_diag(A, B, C, D, E) + tensor([[0, 1, 0, 0, 0, 0, 0, 0, 0, 0], + [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 3, 4, 5, 0, 0, 0, 0, 0], + [0, 0, 6, 7, 8, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 7, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 1, 2, 3, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 4], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 5], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 6]]) + """ + # This wrapper exists to support variadic args. + if has_torch_function(tensors): + return handle_torch_function(block_diag, tensors, *tensors) + return torch._C._VariableFunctions.block_diag(tensors) # type: ignore[attr-defined] + + +def cdist(x1, x2, p=2.0, compute_mode="use_mm_for_euclid_dist_if_necessary"): + # type: (Tensor, Tensor, float, str) -> (Tensor) + r"""Computes batched the p-norm distance between each pair of the two collections of row vectors. + + Args: + x1 (Tensor): input tensor where the last two dimensions represent the points and the feature dimension respectively. + The shape can be :math:`D_1 \times D_2 \times \cdots \times D_n \times P \times M`, + where :math:`P` is the number of points and :math:`M` is the feature dimension. + x2 (Tensor): input tensor where the last two dimensions also represent the points and the feature dimension respectively. + The shape can be :math:`D_1' \times D_2' \times \cdots \times D_m' \times R \times M`, + where :math:`R` is the number of points and :math:`M` is the feature dimension, + which should match the feature dimension of `x1`. + p: p value for the p-norm distance to calculate between each vector pair + :math:`\in [0, \infty]`. + compute_mode: + 'use_mm_for_euclid_dist_if_necessary' - will use matrix multiplication approach to calculate + euclidean distance (p = 2) if P > 25 or R > 25 + 'use_mm_for_euclid_dist' - will always use matrix multiplication approach to calculate + euclidean distance (p = 2) + 'donot_use_mm_for_euclid_dist' - will never use matrix multiplication approach to calculate + euclidean distance (p = 2) + Default: use_mm_for_euclid_dist_if_necessary. + + If x1 has shape :math:`B \times P \times M` and x2 has shape :math:`B \times R \times M` then the + output will have shape :math:`B \times P \times R`. + + This function is equivalent to `scipy.spatial.distance.cdist(input,'minkowski', p=p)` + if :math:`p \in (0, \infty)`. When :math:`p = 0` it is equivalent to + `scipy.spatial.distance.cdist(input, 'hamming') * M`. When :math:`p = \infty`, the closest + scipy function is `scipy.spatial.distance.cdist(xn, lambda x, y: np.abs(x - y).max())`. + + Example: + + >>> a = torch.tensor([[0.9041, 0.0196], [-0.3108, -2.4423], [-0.4821, 1.059]]) + >>> a + tensor([[ 0.9041, 0.0196], + [-0.3108, -2.4423], + [-0.4821, 1.0590]]) + >>> b = torch.tensor([[-2.1763, -0.4713], [-0.6986, 1.3702]]) + >>> b + tensor([[-2.1763, -0.4713], + [-0.6986, 1.3702]]) + >>> torch.cdist(a, b, p=2) + tensor([[3.1193, 2.0959], + [2.7138, 3.8322], + [2.2830, 0.3791]]) + """ + if has_torch_function_variadic(x1, x2): + return handle_torch_function( + cdist, (x1, x2), x1, x2, p=p, compute_mode=compute_mode + ) + if compute_mode == "use_mm_for_euclid_dist_if_necessary": + return _VF.cdist(x1, x2, p, None) # type: ignore[attr-defined] + elif compute_mode == "use_mm_for_euclid_dist": + return _VF.cdist(x1, x2, p, 1) # type: ignore[attr-defined] + elif compute_mode == "donot_use_mm_for_euclid_dist": + return _VF.cdist(x1, x2, p, 2) # type: ignore[attr-defined] + else: + raise ValueError(f"{compute_mode} is not a valid value for compute_mode") + + +def atleast_1d(*tensors): + r""" + Returns a 1-dimensional view of each input tensor with zero dimensions. + Input tensors with one or more dimensions are returned as-is. + + Args: + input (Tensor or sequence of Tensors): tensor(s) to be converted to at least 1-dimensional. + + Returns: + output (Tensor or tuple of Tensors) + + Example:: + + >>> x = torch.arange(2) + >>> x + tensor([0, 1]) + >>> torch.atleast_1d(x) + tensor([0, 1]) + >>> x = torch.tensor(1.) + >>> x + tensor(1.) + >>> torch.atleast_1d(x) + tensor([1.]) + >>> x = torch.tensor(0.5) + >>> y = torch.tensor(1.) + >>> torch.atleast_1d((x, y)) + (tensor([0.5000]), tensor([1.])) + >>> torch.atleast_1d() + () + """ + # This wrapper exists to support variadic args. + if has_torch_function(tensors): + return handle_torch_function(atleast_1d, tensors, *tensors) + if len(tensors) == 1: + tensors = tensors[0] + return _VF.atleast_1d(tensors) # type: ignore[attr-defined] + + +def atleast_2d(*tensors): + r""" + Returns a 2-dimensional view of each input tensor with zero dimensions. + Input tensors with two or more dimensions are returned as-is. + + Args: + input (Tensor or sequence of Tensors): tensor(s) to be converted to at least 2-dimensional. + + Returns: + output (Tensor or tuple of Tensors) + + Example:: + + >>> x = torch.tensor(1.) + >>> x + tensor(1.) + >>> torch.atleast_2d(x) + tensor([[1.]]) + >>> x = torch.arange(4).view(2, 2) + >>> x + tensor([[0, 1], + [2, 3]]) + >>> torch.atleast_2d(x) + tensor([[0, 1], + [2, 3]]) + >>> x = torch.tensor(0.5) + >>> y = torch.tensor(1.) + >>> torch.atleast_2d((x, y)) + (tensor([[0.5000]]), tensor([[1.]])) + >>> torch.atleast_2d() + () + """ + # This wrapper exists to support variadic args. + if has_torch_function(tensors): + return handle_torch_function(atleast_2d, tensors, *tensors) + if len(tensors) == 1: + tensors = tensors[0] + return _VF.atleast_2d(tensors) # type: ignore[attr-defined] + + +def atleast_3d(*tensors): + r""" + Returns a 3-dimensional view of each input tensor with zero dimensions. + Input tensors with three or more dimensions are returned as-is. + + Args: + input (Tensor or sequence of Tensors): tensor(s) to be converted to at least 3-dimensional. + + Returns: + output (Tensor or tuple of Tensors) + + Example: + + >>> x = torch.tensor(0.5) + >>> x + tensor(0.5000) + >>> torch.atleast_3d(x) + tensor([[[0.5000]]]) + >>> y = torch.arange(4).view(2, 2) + >>> y + tensor([[0, 1], + [2, 3]]) + >>> torch.atleast_3d(y) + tensor([[[0], + [1]], + + [[2], + [3]]]) + >>> x = torch.tensor(1).view(1, 1, 1) + >>> x + tensor([[[1]]]) + >>> torch.atleast_3d(x) + tensor([[[1]]]) + >>> x = torch.tensor(0.5) + >>> y = torch.tensor(1.0) + >>> torch.atleast_3d((x, y)) + (tensor([[[0.5000]]]), tensor([[[1.]]])) + >>> torch.atleast_3d() + () + """ + # This wrapper exists to support variadic args. + if has_torch_function(tensors): + return handle_torch_function(atleast_3d, tensors, *tensors) + if len(tensors) == 1: + tensors = tensors[0] + return _VF.atleast_3d(tensors) # type: ignore[attr-defined] + + +if TYPE_CHECKING: + pass + # There's no good way to use this type annotation; cannot rename norm() to + # _norm_impl() in a way that doesn't break JIT overloads. So leave untyped + # for mypy for now. + # def norm(input: Tensor, + # p: Optional[Union[str, Number]] = "fro", + # dim: Optional[Union[int, List[int]]] = None, + # keepdim: bool = False, + # out: Optional[Tensor] = None, + # dtype: _dtype = None) -> Tensor: + # return _norm_impl(input, p, dim, keepdim, out, dtype) +else: + # TODO: type dim as BroadcastingList when + # https://github.com/pytorch/pytorch/issues/33782 is fixed + @overload + def norm( + input, + p="fro", + dim=None, + keepdim=False, + out=None, + dtype=None, + ): + # type: (Tensor, str, Optional[List[int]], bool, Optional[Tensor], Optional[int]) -> Tensor + pass + + @overload + def norm( # noqa: F811 + input, + p="fro", + dim=None, + keepdim=False, + out=None, + dtype=None, + ): + # type: (Tensor, Optional[number], Optional[List[int]], bool, Optional[Tensor], Optional[int]) -> Tensor + pass + + @overload + def norm( # noqa: F811 + input, + p="fro", + dim=None, + keepdim=False, + out=None, + dtype=None, + ): + # type: (Tensor, Optional[number], Optional[int], bool, Optional[Tensor], Optional[int]) -> Tensor + pass + + @overload + def norm( # noqa: F811 + input, + p="fro", + dim=None, + keepdim=False, + out=None, + dtype=None, + ): + # type: (Tensor, str, Optional[int], bool, Optional[Tensor], Optional[int]) -> Tensor + pass + + +def norm( # noqa: F811 + input, + p: float | str | None = "fro", + dim=None, + keepdim=False, + out=None, + dtype=None, +): + r"""Returns the matrix norm or vector norm of a given tensor. + + .. warning:: + + torch.norm is deprecated and may be removed in a future PyTorch release. + Its documentation and behavior may be incorrect, and it is no longer + actively maintained. + + Use :func:`torch.linalg.vector_norm` when computing vector norms and + :func:`torch.linalg.matrix_norm` when computing matrix norms. + For a function with a similar behavior as this one see :func:`torch.linalg.norm`. + Note, however, the signature for these functions is slightly different than the + signature for ``torch.norm``. + + Args: + input (Tensor): The input tensor. Its data type must be either a floating + point or complex type. For complex inputs, the norm is calculated using the + absolute value of each element. If the input is complex and neither + :attr:`dtype` nor :attr:`out` is specified, the result's data type will + be the corresponding floating point type (e.g. float if :attr:`input` is + complexfloat). + + p (int, float, inf, -inf, 'fro', 'nuc', optional): the order of norm. Default: ``'fro'`` + The following norms can be calculated: + + ====== ============== ========================== + ord matrix norm vector norm + ====== ============== ========================== + 'fro' Frobenius norm -- + 'nuc' nuclear norm -- + Number -- sum(abs(x)**ord)**(1./ord) + ====== ============== ========================== + + The vector norm can be calculated across any number of dimensions. + The corresponding dimensions of :attr:`input` are flattened into + one dimension, and the norm is calculated on the flattened + dimension. + + Frobenius norm produces the same result as ``p=2`` in all cases + except when :attr:`dim` is a list of three or more dims, in which + case Frobenius norm throws an error. + + Nuclear norm can only be calculated across exactly two dimensions. + + dim (int, tuple of ints, list of ints, optional): + Specifies which dimension or dimensions of :attr:`input` to + calculate the norm across. If :attr:`dim` is ``None``, the norm will + be calculated across all dimensions of :attr:`input`. If the norm + type indicated by :attr:`p` does not support the specified number of + dimensions, an error will occur. + keepdim (bool, optional): whether the output tensors have :attr:`dim` + retained or not. Ignored if :attr:`dim` = ``None`` and + :attr:`out` = ``None``. Default: ``False`` + out (Tensor, optional): the output tensor. Ignored if + :attr:`dim` = ``None`` and :attr:`out` = ``None``. + dtype (:class:`torch.dtype`, optional): the desired data type of + returned tensor. If specified, the input tensor is casted to + :attr:`dtype` while performing the operation. Default: None. + + .. note:: + Even though ``p='fro'`` supports any number of dimensions, the true + mathematical definition of Frobenius norm only applies to tensors with + exactly two dimensions. :func:`torch.linalg.matrix_norm` with ``ord='fro'`` + aligns with the mathematical definition, since it can only be applied across + exactly two dimensions. + + Example:: + + >>> import torch + >>> a = torch.arange(9, dtype= torch.float) - 4 + >>> b = a.reshape((3, 3)) + >>> torch.norm(a) + tensor(7.7460) + >>> torch.norm(b) + tensor(7.7460) + >>> torch.norm(a, float('inf')) + tensor(4.) + >>> torch.norm(b, float('inf')) + tensor(4.) + >>> c = torch.tensor([[ 1, 2, 3], [-1, 1, 4]] , dtype=torch.float) + >>> torch.norm(c, dim=0) + tensor([1.4142, 2.2361, 5.0000]) + >>> torch.norm(c, dim=1) + tensor([3.7417, 4.2426]) + >>> torch.norm(c, p=1, dim=1) + tensor([6., 6.]) + >>> d = torch.arange(8, dtype=torch.float).reshape(2, 2, 2) + >>> torch.norm(d, dim=(1, 2)) + tensor([ 3.7417, 11.2250]) + >>> torch.norm(d[0, :, :]), torch.norm(d[1, :, :]) + (tensor(3.7417), tensor(11.2250)) + """ + + if has_torch_function_unary(input): + return handle_torch_function( + norm, (input,), input, p=p, dim=dim, keepdim=keepdim, out=out, dtype=dtype + ) + + # NB. All the repeated code and weird python is to please TorchScript. + # For a more compact implementation see the relevant function in `_refs/__init__.py` + + # We don't do this for MPS or sparse tensors + if input.layout == torch.strided and input.device.type in ( + "cpu", + "cuda", + "xpu", + "meta", + torch.utils.backend_registration._privateuse1_backend_name, + ): + if dim is not None: + if isinstance(dim, (int, torch.SymInt)): + _dim = [dim] + else: + _dim = dim + else: + _dim = None # type: ignore[assignment] + + if isinstance(p, str): + if p == "fro" and ( + dim is None + or isinstance(dim, (int, torch.SymInt)) + or len(dim) <= 2 # pyrefly: ignore # bad-argument-type + ): + if out is None: + return torch.linalg.vector_norm( + input, 2, _dim, keepdim, dtype=dtype + ) + else: + return torch.linalg.vector_norm( + input, 2, _dim, keepdim, dtype=dtype, out=out + ) + + # Here we either call the nuclear norm, or we call matrix_norm with some arguments + # that will throw an error + if _dim is None: + _dim = list(range(input.ndim)) + if out is None: + return torch.linalg.matrix_norm(input, p, _dim, keepdim, dtype=dtype) + else: + return torch.linalg.matrix_norm( + input, p, _dim, keepdim, dtype=dtype, out=out + ) + else: + # NB. p should be Union[str, number], not Optional! + _p = 2.0 if p is None else p + if out is None: + return torch.linalg.vector_norm(input, _p, _dim, keepdim, dtype=dtype) + else: + return torch.linalg.vector_norm( + input, _p, _dim, keepdim, dtype=dtype, out=out + ) + + ndim = input.dim() + + # catch default case + if dim is None and out is None and dtype is None and p is not None: + if isinstance(p, str): + if p == "fro": + return _VF.frobenius_norm(input, dim=(), keepdim=keepdim) + if not isinstance(p, str): + _dim = list(range(ndim)) + return _VF.norm(input, p, dim=_dim, keepdim=keepdim) # type: ignore[attr-defined] + + # TODO: when https://github.com/pytorch/pytorch/issues/33782 is fixed + # remove the overloads where dim is an int and replace with BroadcastingList1 + # and remove next four lines, replace _dim with dim + if dim is not None: + if isinstance(dim, (int, torch.SymInt)): + _dim = [dim] + else: + _dim = dim + else: + _dim = None # type: ignore[assignment] + + if isinstance(p, str): + if p == "fro": + if dtype is not None: + raise ValueError("dtype argument is not supported in frobenius norm") + + if _dim is None: + _dim = list(range(ndim)) + if out is None: + return _VF.frobenius_norm(input, _dim, keepdim=keepdim) # type: ignore[arg-type] + else: + return _VF.frobenius_norm(input, _dim, keepdim=keepdim, out=out) # type: ignore[arg-type] + elif p == "nuc": + if dtype is not None: + raise ValueError("dtype argument is not supported in nuclear norm") + if _dim is None: + if out is None: + return _VF.nuclear_norm(input, keepdim=keepdim) # type: ignore[arg-type] + else: + return _VF.nuclear_norm(input, keepdim=keepdim, out=out) # type: ignore[arg-type] + else: + if out is None: + return _VF.nuclear_norm(input, _dim, keepdim=keepdim) # type: ignore[arg-type] + else: + return _VF.nuclear_norm(input, _dim, keepdim=keepdim, out=out) # type: ignore[arg-type] + raise RuntimeError(f"only valid string values are 'fro' and 'nuc', found {p}") + else: + if _dim is None: + _dim = list(range(ndim)) + + if out is None: + if dtype is None: + return _VF.norm(input, p, _dim, keepdim=keepdim) # type: ignore[attr-defined] + else: + return _VF.norm(input, p, _dim, keepdim=keepdim, dtype=dtype) # type: ignore[attr-defined] + else: + if dtype is None: + return _VF.norm(input, p, _dim, keepdim=keepdim, out=out) # type: ignore[attr-defined] + else: + return _VF.norm(input, p, _dim, keepdim=keepdim, dtype=dtype, out=out) # type: ignore[attr-defined] + + +def unravel_index( + indices: Tensor, + shape: int | Sequence[int] | torch.Size, +) -> tuple[Tensor, ...]: + r"""Converts a tensor of flat indices into a tuple of coordinate tensors that + index into an arbitrary tensor of the specified shape. + + Args: + indices (Tensor): An integer tensor containing indices into the + flattened version of an arbitrary tensor of shape :attr:`shape`. + All elements must be in the range ``[0, prod(shape) - 1]``. + + shape (int, sequence of ints, or torch.Size): The shape of the arbitrary + tensor. All elements must be non-negative. + + Returns: + tuple of Tensors: Each ``i``-th tensor in the output corresponds with + dimension ``i`` of :attr:`shape`. Each tensor has the same shape as + ``indices`` and contains one index into dimension ``i`` for each of the + flat indices given by ``indices``. + + Example:: + + >>> import torch + >>> torch.unravel_index(torch.tensor(4), (3, 2)) + (tensor(2), + tensor(0)) + + >>> torch.unravel_index(torch.tensor([4, 1]), (3, 2)) + (tensor([2, 0]), + tensor([0, 1])) + + >>> torch.unravel_index(torch.tensor([0, 1, 2, 3, 4, 5]), (3, 2)) + (tensor([0, 0, 1, 1, 2, 2]), + tensor([0, 1, 0, 1, 0, 1])) + + >>> torch.unravel_index(torch.tensor([1234, 5678]), (10, 10, 10, 10)) + (tensor([1, 5]), + tensor([2, 6]), + tensor([3, 7]), + tensor([4, 8])) + + >>> torch.unravel_index(torch.tensor([[1234], [5678]]), (10, 10, 10, 10)) + (tensor([[1], [5]]), + tensor([[2], [6]]), + tensor([[3], [7]]), + tensor([[4], [8]])) + + >>> torch.unravel_index(torch.tensor([[1234], [5678]]), (100, 100)) + (tensor([[12], [56]]), + tensor([[34], [78]])) + """ + if has_torch_function_unary(indices): + return handle_torch_function(unravel_index, (indices,), indices, shape=shape) + res_tensor = _unravel_index(indices, shape) + return res_tensor.unbind(-1) + + +def _unravel_index(indices: Tensor, shape: int | Sequence[int]) -> Tensor: + torch._check_type( + not indices.is_complex() + and not indices.is_floating_point() + and indices.dtype != torch.bool, + lambda: f"expected 'indices' to be integer dtype, but got {indices.dtype}", + ) + + torch._check_type( + isinstance(shape, (int, torch.SymInt, Sequence)), + lambda: f"expected 'shape' to be int or sequence of ints, but got {type(shape)}", + ) + + if isinstance(shape, (int, torch.SymInt)): + shape = torch.Size([shape]) # pyrefly: ignore [bad-argument-type] + else: + for dim in shape: + torch._check_type( + isinstance(dim, (int, torch.SymInt)), + lambda: f"expected 'shape' sequence to only contain ints, but got {type(dim)}", + ) + shape = torch.Size(shape) + + torch._check_value( + all(dim >= 0 for dim in shape), + lambda: f"'shape' cannot have negative values, but got {tuple(shape)}", + ) + + coefs = list( + reversed( + list( + itertools.accumulate( + reversed(shape[1:] + torch.Size([1])), func=operator.mul + ) + ) + ) + ) + return indices.unsqueeze(-1).floor_divide( + torch.tensor(coefs, device=indices.device, dtype=torch.int64) + ) % torch.tensor(shape, device=indices.device, dtype=torch.int64) + + +def chain_matmul(*matrices, out=None): + r"""Returns the matrix product of the :math:`N` 2-D tensors. This product is efficiently computed + using the matrix chain order algorithm which selects the order in which incurs the lowest cost in terms + of arithmetic operations (`[CLRS]`_). Note that since this is a function to compute the product, :math:`N` + needs to be greater than or equal to 2; if equal to 2 then a trivial matrix-matrix product is returned. + If :math:`N` is 1, then this is a no-op - the original matrix is returned as is. + + .. warning:: + + :func:`torch.chain_matmul` is deprecated and will be removed in a future PyTorch release. + Use :func:`torch.linalg.multi_dot` instead, which accepts a list of two or more tensors + rather than multiple arguments. + + Args: + matrices (Tensors...): a sequence of 2 or more 2-D tensors whose product is to be determined. + out (Tensor, optional): the output tensor. Ignored if :attr:`out` = ``None``. + + Returns: + Tensor: if the :math:`i^{th}` tensor was of dimensions :math:`p_{i} \times p_{i + 1}`, then the product + would be of dimensions :math:`p_{1} \times p_{N + 1}`. + + Example:: + + >>> # xdoctest: +SKIP + >>> # xdoctest: +IGNORE_WANT("non-deterministic") + >>> a = torch.randn(3, 4) + >>> b = torch.randn(4, 5) + >>> c = torch.randn(5, 6) + >>> d = torch.randn(6, 7) + >>> # will raise a deprecation warning + >>> torch.chain_matmul(a, b, c, d) + tensor([[ -2.3375, -3.9790, -4.1119, -6.6577, 9.5609, -11.5095, -3.2614], + [ 21.4038, 3.3378, -8.4982, -5.2457, -10.2561, -2.4684, 2.7163], + [ -0.9647, -5.8917, -2.3213, -5.2284, 12.8615, -12.2816, -2.5095]]) + + .. _`[CLRS]`: https://mitpress.mit.edu/books/introduction-algorithms-third-edition + """ + # This wrapper exists to support variadic args. + if has_torch_function(matrices): + return handle_torch_function(chain_matmul, matrices, *matrices) + + if out is None: + return _VF.chain_matmul(matrices) # type: ignore[attr-defined] + else: + return _VF.chain_matmul(matrices, out=out) # type: ignore[attr-defined] + + +def _lu_impl(A, pivot=True, get_infos=False, out=None): + # type: (Tensor, bool, bool, Any) -> tuple[Tensor, Tensor, Tensor] + r"""Computes the LU factorization of a matrix or batches of matrices + :attr:`A`. Returns a tuple containing the LU factorization and + pivots of :attr:`A`. Pivoting is done if :attr:`pivot` is set to + ``True``. + + .. warning:: + + :func:`torch.lu` is deprecated in favor of :func:`torch.linalg.lu_factor` + and :func:`torch.linalg.lu_factor_ex`. :func:`torch.lu` will be removed in a + future PyTorch release. + ``LU, pivots, info = torch.lu(A, compute_pivots)`` should be replaced with + + .. code:: python + + LU, pivots = torch.linalg.lu_factor(A, compute_pivots) + + ``LU, pivots, info = torch.lu(A, compute_pivots, get_infos=True)`` should be replaced with + + .. code:: python + + LU, pivots, info = torch.linalg.lu_factor_ex(A, compute_pivots) + + .. note:: + * The returned permutation matrix for every matrix in the batch is + represented by a 1-indexed vector of size ``min(A.shape[-2], A.shape[-1])``. + ``pivots[i] == j`` represents that in the ``i``-th step of the algorithm, + the ``i``-th row was permuted with the ``j-1``-th row. + * LU factorization with :attr:`pivot` = ``False`` is not available + for CPU, and attempting to do so will throw an error. However, + LU factorization with :attr:`pivot` = ``False`` is available for + CUDA. + * This function does not check if the factorization was successful + or not if :attr:`get_infos` is ``True`` since the status of the + factorization is present in the third element of the return tuple. + * In the case of batches of square matrices with size less or equal + to 32 on a CUDA device, the LU factorization is repeated for + singular matrices due to the bug in the MAGMA library + (see magma issue 13). + * ``L``, ``U``, and ``P`` can be derived using :func:`torch.lu_unpack`. + + .. warning:: + The gradients of this function will only be finite when :attr:`A` is full rank. + This is because the LU decomposition is just differentiable at full rank matrices. + Furthermore, if :attr:`A` is close to not being full rank, + the gradient will be numerically unstable as it depends on the computation of :math:`L^{-1}` and :math:`U^{-1}`. + + Args: + A (Tensor): the tensor to factor of size :math:`(*, m, n)` + pivot (bool, optional): Whether to compute the LU decomposition with partial pivoting, or the regular LU + decomposition. :attr:`pivot`\ `= False` not supported on CPU. Default: `True`. + get_infos (bool, optional): if set to ``True``, returns an info IntTensor. + Default: ``False`` + out (tuple, optional): optional output tuple. If :attr:`get_infos` is ``True``, + then the elements in the tuple are Tensor, IntTensor, + and IntTensor. If :attr:`get_infos` is ``False``, then the + elements in the tuple are Tensor, IntTensor. Default: ``None`` + + Returns: + (Tensor, IntTensor, IntTensor (optional)): A tuple of tensors containing + + - **factorization** (*Tensor*): the factorization of size :math:`(*, m, n)` + + - **pivots** (*IntTensor*): the pivots of size :math:`(*, \text{min}(m, n))`. + ``pivots`` stores all the intermediate transpositions of rows. + The final permutation ``perm`` could be reconstructed by + applying ``swap(perm[i], perm[pivots[i] - 1])`` for ``i = 0, ..., pivots.size(-1) - 1``, + where ``perm`` is initially the identity permutation of :math:`m` elements + (essentially this is what :func:`torch.lu_unpack` is doing). + + - **infos** (*IntTensor*, *optional*): if :attr:`get_infos` is ``True``, this is a tensor of + size :math:`(*)` where non-zero values indicate whether factorization for the matrix or + each minibatch has succeeded or failed + + Example:: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_LAPACK) + >>> # xdoctest: +IGNORE_WANT("non-deterministic") + >>> A = torch.randn(2, 3, 3) + >>> A_LU, pivots = torch.lu(A) + >>> A_LU + tensor([[[ 1.3506, 2.5558, -0.0816], + [ 0.1684, 1.1551, 0.1940], + [ 0.1193, 0.6189, -0.5497]], + + [[ 0.4526, 1.2526, -0.3285], + [-0.7988, 0.7175, -0.9701], + [ 0.2634, -0.9255, -0.3459]]]) + >>> pivots + tensor([[ 3, 3, 3], + [ 3, 3, 3]], dtype=torch.int32) + >>> A_LU, pivots, info = torch.lu(A, get_infos=True) + >>> if info.nonzero().size(0) == 0: + ... print('LU factorization succeeded for all samples!') + LU factorization succeeded for all samples! + """ + # If get_infos is True, then we don't need to check for errors and vice versa + return torch._lu_with_info(A, pivot=pivot, check_errors=(not get_infos)) + + +if TYPE_CHECKING: + _ListOrSeq = Sequence[Tensor] +else: + _ListOrSeq = list[Tensor] + + +def _check_list_size(out_len: int, get_infos: bool, out: _ListOrSeq) -> None: + get_infos_int = 1 if get_infos else 0 + if out_len - get_infos_int != 2: + raise TypeError( + f"expected tuple of {2 + int(get_infos)} elements but got {out_len}" + ) + if not isinstance(out, (tuple, list)): + raise TypeError( + f"argument 'out' must be tuple of Tensors, not {type(out).__name__}" + ) + + +def _lu_with_infos(A, pivot=True, get_infos=False, out=None): + # type: (Tensor, bool, bool, Optional[tuple[Tensor, Tensor, Tensor]]) -> tuple[Tensor, Tensor, Tensor] + if has_torch_function_unary(A): + return handle_torch_function( + lu, (A,), A, pivot=pivot, get_infos=get_infos, out=out + ) + result = _lu_impl(A, pivot, get_infos, out) + if out is not None: + _check_list_size(len(out), get_infos, out) + for i in range(len(out)): + out[i].resize_as_(result[i]).copy_(result[i]) + return out + else: + return result # A_LU, pivots, infos + + +def _lu_no_infos(A, pivot=True, get_infos=False, out=None): + # type: (Tensor, bool, bool, Optional[tuple[Tensor, Tensor]]) -> tuple[Tensor, Tensor] + # need to check for torch_function here so that we exit if + if has_torch_function_unary(A): + return handle_torch_function( + lu, (A,), A, pivot=pivot, get_infos=get_infos, out=out + ) + result = _lu_impl(A, pivot, get_infos, out) + if out is not None: + _check_list_size(len(out), get_infos, out) + for i in range(len(out)): + out[i].resize_as_(result[i]).copy_(result[i]) + return out + else: + return result[0], result[1] # A_LU, pivots + + +# The return type of lu depends on `get_infos`, so in order to resolve the output type +# of lu in TorchScript we need to statically know the value of `get_infos` +lu = boolean_dispatch( + arg_name="get_infos", + arg_index=2, + default=False, + if_true=_lu_with_infos, + if_false=_lu_no_infos, + module_name=__name__, + func_name="lu", +) +lu.__doc__ = _lu_impl.__doc__ + + +def align_tensors(*tensors): + raise RuntimeError("`align_tensors` not yet implemented.") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/hub.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/hub.py new file mode 100644 index 0000000000000000000000000000000000000000..9b27bdcde6487b832aa7fb97e0fc453b84c55d72 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/hub.py @@ -0,0 +1,884 @@ +# mypy: allow-untyped-defs +import contextlib +import errno +import hashlib +import json +import os +import re +import shutil +import sys +import tempfile +import uuid +import warnings +import zipfile +from pathlib import Path +from typing import Any +from typing_extensions import deprecated +from urllib.error import HTTPError, URLError +from urllib.parse import urlparse # noqa: F401 +from urllib.request import Request, urlopen + +import torch +from torch.serialization import MAP_LOCATION + + +class _Faketqdm: # type: ignore[no-redef] + def __init__(self, total=None, disable=False, unit=None, *args, **kwargs): + self.total = total + self.disable = disable + self.n = 0 + # Ignore all extra *args and **kwargs lest you want to reinvent tqdm + + def update(self, n): + if self.disable: + return + + self.n += n + if self.total is None: + sys.stderr.write(f"\r{self.n:.1f} bytes") + else: + sys.stderr.write(f"\r{100 * self.n / float(self.total):.1f}%") + sys.stderr.flush() + + # Don't bother implementing; use real tqdm if you want + def set_description(self, *args, **kwargs): + pass + + def write(self, s): + sys.stderr.write(f"{s}\n") + + def close(self): + self.disable = True + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + if self.disable: + return + + sys.stderr.write("\n") + + +try: + from tqdm import tqdm # If tqdm is installed use it, otherwise use the fake wrapper +except ImportError: + tqdm = _Faketqdm + +__all__ = [ + "download_url_to_file", + "get_dir", + "help", + "list", + "load", + "load_state_dict_from_url", + "set_dir", +] + +# matches bfd8deac from resnet18-bfd8deac.pth +HASH_REGEX = re.compile(r"-([a-f0-9]*)\.") + +_TRUSTED_REPO_OWNERS = ( + "facebookresearch", + "facebookincubator", + "pytorch", + "fairinternal", +) +ENV_GITHUB_TOKEN = "GITHUB_TOKEN" +ENV_TORCH_HOME = "TORCH_HOME" +ENV_XDG_CACHE_HOME = "XDG_CACHE_HOME" +DEFAULT_CACHE_DIR = "~/.cache" +VAR_DEPENDENCY = "dependencies" +MODULE_HUBCONF = "hubconf.py" +READ_DATA_CHUNK = 128 * 1024 +_hub_dir: str | None = None + + +@contextlib.contextmanager +def _add_to_sys_path(path): + sys.path.insert(0, path) + try: + yield + finally: + sys.path.remove(path) + + +# Copied from tools/shared/module_loader to be included in torch package +def _import_module(name, path): + import importlib.util + from importlib.abc import Loader + + spec = importlib.util.spec_from_file_location(name, path) + assert spec is not None + module = importlib.util.module_from_spec(spec) + assert isinstance(spec.loader, Loader) + spec.loader.exec_module(module) + return module + + +def _remove_if_exists(path): + if os.path.exists(path): + if os.path.isfile(path): + os.remove(path) + else: + shutil.rmtree(path) + + +def _git_archive_link(repo_owner, repo_name, ref): + # See https://docs.github.com/en/rest/reference/repos#download-a-repository-archive-zip + return f"https://github.com/{repo_owner}/{repo_name}/zipball/{ref}" + + +def _load_attr_from_module(module, func_name): + # Check if callable is defined in the module + if func_name not in dir(module): + return None + return getattr(module, func_name) + + +def _get_torch_home(): + torch_home = os.path.expanduser( + os.getenv( + ENV_TORCH_HOME, + os.path.join(os.getenv(ENV_XDG_CACHE_HOME, DEFAULT_CACHE_DIR), "torch"), + ) + ) + return torch_home + + +def _parse_repo_info(github): + if ":" in github: + repo_info, ref = github.split(":") + else: + repo_info, ref = github, None + repo_owner, repo_name = repo_info.split("/") + + if ref is None: + # The ref wasn't specified by the user, so we need to figure out the + # default branch: main or master. Our assumption is that if main exists + # then it's the default branch, otherwise it's master. + try: + with urlopen(f"https://github.com/{repo_owner}/{repo_name}/tree/main/"): + ref = "main" + except HTTPError as e: + if e.code == 404: + ref = "master" + else: + raise + except URLError as e: + # No internet connection, need to check for cache as last resort + for possible_ref in ("main", "master"): + if os.path.exists( + f"{get_dir()}/{repo_owner}_{repo_name}_{possible_ref}" + ): + ref = possible_ref + break + if ref is None: + raise RuntimeError( + "It looks like there is no internet connection and the " + f"repo could not be found in the cache ({get_dir()})" + ) from e + return repo_owner, repo_name, ref + + +def _read_url(url): + with urlopen(url) as r: + return r.read().decode(r.headers.get_content_charset("utf-8")) + + +def _validate_not_a_forked_repo(repo_owner, repo_name, ref): + # Use urlopen to avoid depending on local git. + headers = {"Accept": "application/vnd.github.v3+json"} + token = os.environ.get(ENV_GITHUB_TOKEN) + if token is not None: + headers["Authorization"] = f"token {token}" + for url_prefix in ( + f"https://api.github.com/repos/{repo_owner}/{repo_name}/branches", + f"https://api.github.com/repos/{repo_owner}/{repo_name}/tags", + ): + page = 0 + while True: + page += 1 + url = f"{url_prefix}?per_page=100&page={page}" + try: + response = json.loads(_read_url(Request(url, headers=headers))) + except HTTPError: + # Retry without token in case it had insufficient permissions. + del headers["Authorization"] + response = json.loads(_read_url(Request(url, headers=headers))) + # Empty response means no more data to process + if not response: + break + for br in response: + if br["name"] == ref or br["commit"]["sha"].startswith(ref): + return + + raise ValueError( + f"Cannot find {ref} in https://github.com/{repo_owner}/{repo_name}. " + "If it's a commit from a forked repo, please call hub.load() with forked repo directly." + ) + + +def _get_cache_or_reload( + github, + force_reload, + trust_repo, + calling_fn, + verbose=True, + skip_validation=False, +): + # Setup hub_dir to save downloaded files + hub_dir = get_dir() + os.makedirs(hub_dir, exist_ok=True) + # Parse github repo information + repo_owner, repo_name, ref = _parse_repo_info(github) + # Github allows branch name with slash '/', + # this causes confusion with path on both Linux and Windows. + # Backslash is not allowed in Github branch name so no need to + # to worry about it. + normalized_br = ref.replace("/", "_") + # Github renames folder repo-v1.x.x to repo-1.x.x + # We don't know the repo name before downloading the zip file + # and inspect name from it. + # To check if cached repo exists, we need to normalize folder names. + owner_name_branch = "_".join([repo_owner, repo_name, normalized_br]) + repo_dir = os.path.join(hub_dir, owner_name_branch) + # Check that the repo is in the trusted list + _check_repo_is_trusted( + repo_owner, + repo_name, + owner_name_branch, + trust_repo=trust_repo, + calling_fn=calling_fn, + ) + + use_cache = (not force_reload) and os.path.exists(repo_dir) + + if use_cache: + if verbose: + sys.stderr.write(f"Using cache found in {repo_dir}\n") + else: + # Validate the tag/branch is from the original repo instead of a forked repo + if not skip_validation: + _validate_not_a_forked_repo(repo_owner, repo_name, ref) + + cached_file = os.path.join(hub_dir, normalized_br + ".zip") + _remove_if_exists(cached_file) + + try: + url = _git_archive_link(repo_owner, repo_name, ref) + sys.stdout.write(f'Downloading: "{url}" to {cached_file}\n') + download_url_to_file(url, cached_file, progress=False) + except HTTPError as err: + if err.code == 300: + # Getting a 300 Multiple Choices error likely means that the ref is both a tag and a branch + # in the repo. This can be disambiguated by explicitly using refs/heads/ or refs/tags + # See https://git-scm.com/book/en/v2/Git-Internals-Git-References + # Here, we do the same as git: we throw a warning, and assume the user wanted the branch + warnings.warn( + f"The ref {ref} is ambiguous. Perhaps it is both a tag and a branch in the repo? " + "Torchhub will now assume that it's a branch. " + "You can disambiguate tags and branches by explicitly passing refs/heads/branch_name or " + "refs/tags/tag_name as the ref. That might require using skip_validation=True.", + stacklevel=2, + ) + disambiguated_branch_ref = f"refs/heads/{ref}" + url = _git_archive_link( + repo_owner, repo_name, ref=disambiguated_branch_ref + ) + download_url_to_file(url, cached_file, progress=False) + else: + raise + + with zipfile.ZipFile(cached_file) as cached_zipfile: + extraced_repo_name = cached_zipfile.infolist()[0].filename + extracted_repo = os.path.join(hub_dir, extraced_repo_name) + _remove_if_exists(extracted_repo) + # Unzip the code and rename the base folder + cached_zipfile.extractall(hub_dir) + + _remove_if_exists(cached_file) + _remove_if_exists(repo_dir) + shutil.move(extracted_repo, repo_dir) # rename the repo + + return repo_dir + + +def _check_repo_is_trusted( + repo_owner, + repo_name, + owner_name_branch, + trust_repo, + calling_fn="load", +): + hub_dir = get_dir() + filepath = os.path.join(hub_dir, "trusted_list") + + if not os.path.exists(filepath): + Path(filepath).touch() + with open(filepath) as file: + trusted_repos = tuple(line.strip() for line in file) + + # To minimize friction of introducing the new trust_repo mechanism, we consider that + # if a repo was already downloaded by torchhub, then it is already trusted (even if it's not in the allowlist) + trusted_repos_legacy = next(os.walk(hub_dir))[1] + + owner_name = "_".join([repo_owner, repo_name]) + is_trusted = ( + owner_name in trusted_repos + or owner_name_branch in trusted_repos_legacy + or repo_owner in _TRUSTED_REPO_OWNERS + ) + + # TODO: Remove `None` option in 2.0 and change the default to "check" + if trust_repo is None: + if not is_trusted: + warnings.warn( + "You are about to download and run code from an untrusted repository. In a future release, this won't " + f"be allowed. To add the repository to your trusted list, change the command to {calling_fn}(..., " + "trust_repo=False) and a command prompt will appear asking for an explicit confirmation of trust, " + f"or {calling_fn}(..., trust_repo=True), which will assume that the prompt is to be answered with " + f"'yes'. You can also use {calling_fn}(..., trust_repo='check') which will only prompt for " + f"confirmation if the repo is not already trusted. This will eventually be the default behaviour", + stacklevel=2, + ) + return + + if (trust_repo is False) or (trust_repo == "check" and not is_trusted): + response = input( + f"The repository {owner_name} does not belong to the list of trusted repositories and as such cannot be downloaded. " + "Do you trust this repository and wish to add it to the trusted list of repositories (y/N)?" + ) + if response.lower() in ("y", "yes"): + if is_trusted: + print("The repository is already trusted.") + elif response.lower() in ("n", "no", ""): + raise Exception("Untrusted repository.") # noqa: TRY002 + else: + raise ValueError(f"Unrecognized response {response}.") + + # At this point we're sure that the user trusts the repo (or wants to trust it) + if not is_trusted: + with open(filepath, "a") as file: + file.write(owner_name + "\n") + + +def _check_module_exists(name): + import importlib.util + + return importlib.util.find_spec(name) is not None + + +def _check_dependencies(m): + dependencies = _load_attr_from_module(m, VAR_DEPENDENCY) + + if dependencies is not None: + missing_deps = [pkg for pkg in dependencies if not _check_module_exists(pkg)] + if missing_deps: + raise RuntimeError(f"Missing dependencies: {', '.join(missing_deps)}") + + +def _load_entry_from_hubconf(m, model): + if not isinstance(model, str): + raise ValueError("Invalid input: model should be a string of function name") + + # Note that if a missing dependency is imported at top level of hubconf, it will + # throw before this function. It's a chicken and egg situation where we have to + # load hubconf to know what're the dependencies, but to import hubconf it requires + # a missing package. This is fine, Python will throw proper error message for users. + _check_dependencies(m) + + func = _load_attr_from_module(m, model) + + if func is None or not callable(func): + raise RuntimeError(f"Cannot find callable {model} in hubconf") + + return func + + +def get_dir() -> str: + r""" + Get the Torch Hub cache directory used for storing downloaded models & weights. + + If :func:`~torch.hub.set_dir` is not called, default path is ``$TORCH_HOME/hub`` where + environment variable ``$TORCH_HOME`` defaults to ``$XDG_CACHE_HOME/torch``. + ``$XDG_CACHE_HOME`` follows the X Design Group specification of the Linux + filesystem layout, with a default value ``~/.cache`` if the environment + variable is not set. + """ + # Issue warning to move data if old env is set + if os.getenv("TORCH_HUB"): + warnings.warn( + "TORCH_HUB is deprecated, please use env TORCH_HOME instead", stacklevel=2 + ) + + if _hub_dir is not None: + return _hub_dir + return os.path.join(_get_torch_home(), "hub") + + +def set_dir(d: str | os.PathLike) -> None: + r""" + Optionally set the Torch Hub directory used to save downloaded models & weights. + + Args: + d (str): path to a local folder to save downloaded models & weights. + """ + global _hub_dir + _hub_dir = os.path.expanduser(d) + + +def list( + github, + force_reload=False, + skip_validation=False, + trust_repo=None, + verbose=True, +): + r""" + List all callable entrypoints available in the repo specified by ``github``. + + Args: + github (str): a string with format "repo_owner/repo_name[:ref]" with an optional + ref (tag or branch). If ``ref`` is not specified, the default branch is assumed to be ``main`` if + it exists, and otherwise ``master``. + Example: 'pytorch/vision:0.10' + force_reload (bool, optional): whether to discard the existing cache and force a fresh download. + Default is ``False``. + skip_validation (bool, optional): if ``False``, torchhub will check that the branch or commit + specified by the ``github`` argument properly belongs to the repo owner. This will make + requests to the GitHub API; you can specify a non-default GitHub token by setting the + ``GITHUB_TOKEN`` environment variable. Default is ``False``. + trust_repo (bool, str or None): ``"check"``, ``True``, ``False`` or ``None``. + This parameter was introduced in v1.12 and helps ensuring that users + only run code from repos that they trust. + + - If ``False``, a prompt will ask the user whether the repo should + be trusted. + - If ``True``, the repo will be added to the trusted list and loaded + without requiring explicit confirmation. + - If ``"check"``, the repo will be checked against the list of + trusted repos in the cache. If it is not present in that list, the + behaviour will fall back onto the ``trust_repo=False`` option. + - If ``None``: this will raise a warning, inviting the user to set + ``trust_repo`` to either ``False``, ``True`` or ``"check"``. This + is only present for backward compatibility and will be removed in + v2.0. + + Default is ``None`` and will eventually change to ``"check"`` in v2.0. + verbose (bool, optional): If ``False``, mute messages about hitting + local caches. Note that the message about first download cannot be + muted. Default is ``True``. + + Returns: + list: The available callables entrypoint + + Example: + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_HUB) + >>> entrypoints = torch.hub.list("pytorch/vision", force_reload=True) + """ + repo_dir = _get_cache_or_reload( + github, + force_reload, + trust_repo, + "list", + verbose=verbose, + skip_validation=skip_validation, + ) + + with _add_to_sys_path(repo_dir): + hubconf_path = os.path.join(repo_dir, MODULE_HUBCONF) + hub_module = _import_module(MODULE_HUBCONF, hubconf_path) + + # We take functions starts with '_' as internal helper functions + entrypoints = [ + f + for f in dir(hub_module) + if callable(getattr(hub_module, f)) and not f.startswith("_") + ] + + return entrypoints + + +def help(github, model, force_reload=False, skip_validation=False, trust_repo=None): + r""" + Show the docstring of entrypoint ``model``. + + Args: + github (str): a string with format with an optional + ref (a tag or a branch). If ``ref`` is not specified, the default branch is assumed + to be ``main`` if it exists, and otherwise ``master``. + Example: 'pytorch/vision:0.10' + model (str): a string of entrypoint name defined in repo's ``hubconf.py`` + force_reload (bool, optional): whether to discard the existing cache and force a fresh download. + Default is ``False``. + skip_validation (bool, optional): if ``False``, torchhub will check that the ref + specified by the ``github`` argument properly belongs to the repo owner. This will make + requests to the GitHub API; you can specify a non-default GitHub token by setting the + ``GITHUB_TOKEN`` environment variable. Default is ``False``. + trust_repo (bool, str or None): ``"check"``, ``True``, ``False`` or ``None``. + This parameter was introduced in v1.12 and helps ensuring that users + only run code from repos that they trust. + + - If ``False``, a prompt will ask the user whether the repo should + be trusted. + - If ``True``, the repo will be added to the trusted list and loaded + without requiring explicit confirmation. + - If ``"check"``, the repo will be checked against the list of + trusted repos in the cache. If it is not present in that list, the + behaviour will fall back onto the ``trust_repo=False`` option. + - If ``None``: this will raise a warning, inviting the user to set + ``trust_repo`` to either ``False``, ``True`` or ``"check"``. This + is only present for backward compatibility and will be removed in + v2.0. + + Default is ``None`` and will eventually change to ``"check"`` in v2.0. + Example: + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_HUB) + >>> print(torch.hub.help("pytorch/vision", "resnet18", force_reload=True)) + """ + repo_dir = _get_cache_or_reload( + github, + force_reload, + trust_repo, + "help", + verbose=True, + skip_validation=skip_validation, + ) + + with _add_to_sys_path(repo_dir): + hubconf_path = os.path.join(repo_dir, MODULE_HUBCONF) + hub_module = _import_module(MODULE_HUBCONF, hubconf_path) + + entry = _load_entry_from_hubconf(hub_module, model) + + return entry.__doc__ + + +def load( + repo_or_dir, + model, + *args, + source="github", + trust_repo=None, + force_reload=False, + verbose=True, + skip_validation=False, + **kwargs, +): + r""" + Load a model from a github repo or a local directory. + + Note: Loading a model is the typical use case, but this can also be used to + for loading other objects such as tokenizers, loss functions, etc. + + If ``source`` is 'github', ``repo_or_dir`` is expected to be + of the form ``repo_owner/repo_name[:ref]`` with an optional + ref (a tag or a branch). + + If ``source`` is 'local', ``repo_or_dir`` is expected to be a + path to a local directory. + + Args: + repo_or_dir (str): If ``source`` is 'github', + this should correspond to a github repo with format ``repo_owner/repo_name[:ref]`` with + an optional ref (tag or branch), for example 'pytorch/vision:0.10'. If ``ref`` is not specified, + the default branch is assumed to be ``main`` if it exists, and otherwise ``master``. + If ``source`` is 'local' then it should be a path to a local directory. + model (str): the name of a callable (entrypoint) defined in the + repo/dir's ``hubconf.py``. + *args (optional): the corresponding args for callable ``model``. + source (str, optional): 'github' or 'local'. Specifies how + ``repo_or_dir`` is to be interpreted. Default is 'github'. + trust_repo (bool, str or None): ``"check"``, ``True``, ``False`` or ``None``. + This parameter was introduced in v1.12 and helps ensuring that users + only run code from repos that they trust. + + - If ``False``, a prompt will ask the user whether the repo should + be trusted. + - If ``True``, the repo will be added to the trusted list and loaded + without requiring explicit confirmation. + - If ``"check"``, the repo will be checked against the list of + trusted repos in the cache. If it is not present in that list, the + behaviour will fall back onto the ``trust_repo=False`` option. + - If ``None``: this will raise a warning, inviting the user to set + ``trust_repo`` to either ``False``, ``True`` or ``"check"``. This + is only present for backward compatibility and will be removed in + v2.0. + + Default is ``None`` and will eventually change to ``"check"`` in v2.0. + force_reload (bool, optional): whether to force a fresh download of + the github repo unconditionally. Does not have any effect if + ``source = 'local'``. Default is ``False``. + verbose (bool, optional): If ``False``, mute messages about hitting + local caches. Note that the message about first download cannot be + muted. Does not have any effect if ``source = 'local'``. + Default is ``True``. + skip_validation (bool, optional): if ``False``, torchhub will check that the branch or commit + specified by the ``github`` argument properly belongs to the repo owner. This will make + requests to the GitHub API; you can specify a non-default GitHub token by setting the + ``GITHUB_TOKEN`` environment variable. Default is ``False``. + **kwargs (optional): the corresponding kwargs for callable ``model``. + + Returns: + The output of the ``model`` callable when called with the given + ``*args`` and ``**kwargs``. + + Example: + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_HUB) + >>> # from a github repo + >>> repo = "pytorch/vision" + >>> model = torch.hub.load( + ... repo, "resnet50", weights="ResNet50_Weights.IMAGENET1K_V1" + ... ) + >>> # from a local directory + >>> path = "/some/local/path/pytorch/vision" + >>> # xdoctest: +SKIP + >>> model = torch.hub.load(path, "resnet50", weights="ResNet50_Weights.DEFAULT") + """ + source = source.lower() + + if source not in ("github", "local"): + raise ValueError( + f'Unknown source: "{source}". Allowed values: "github" | "local".' + ) + + if source == "github": + repo_or_dir = _get_cache_or_reload( + repo_or_dir, + force_reload, + trust_repo, + "load", + verbose=verbose, + skip_validation=skip_validation, + ) + + model = _load_local(repo_or_dir, model, *args, **kwargs) + return model + + +def _load_local(hubconf_dir, model, *args, **kwargs): + r""" + Load a model from a local directory with a ``hubconf.py``. + + Args: + hubconf_dir (str): path to a local directory that contains a + ``hubconf.py``. + model (str): name of an entrypoint defined in the directory's + ``hubconf.py``. + *args (optional): the corresponding args for callable ``model``. + **kwargs (optional): the corresponding kwargs for callable ``model``. + + Returns: + a single model with corresponding pretrained weights. + + Example: + >>> # xdoctest: +SKIP("stub local path") + >>> path = "/some/local/path/pytorch/vision" + >>> model = _load_local( + ... path, + ... "resnet50", + ... weights="ResNet50_Weights.IMAGENET1K_V1", + ... ) + """ + with _add_to_sys_path(hubconf_dir): + hubconf_path = os.path.join(hubconf_dir, MODULE_HUBCONF) + hub_module = _import_module(MODULE_HUBCONF, hubconf_path) + + entry = _load_entry_from_hubconf(hub_module, model) + model = entry(*args, **kwargs) + + return model + + +def download_url_to_file( + url: str, + dst: str, + hash_prefix: str | None = None, + progress: bool = True, +) -> None: + r"""Download object at the given URL to a local path. + + Args: + url (str): URL of the object to download + dst (str): Full path where object will be saved, e.g. ``/tmp/temporary_file`` + hash_prefix (str, optional): If not None, the SHA256 downloaded file should start with ``hash_prefix``. + Default: None + progress (bool, optional): whether or not to display a progress bar to stderr + Default: True + + Example: + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_HUB) + >>> # xdoctest: +REQUIRES(POSIX) + >>> torch.hub.download_url_to_file( + ... "https://s3.amazonaws.com/pytorch/models/resnet18-5c106cde.pth", + ... "/tmp/temporary_file", + ... ) + + """ + # We deliberately save it in a temp file and move it after + # download is complete. This prevents a local working checkpoint + # being overridden by a broken download. + # We deliberately do not use NamedTemporaryFile to avoid restrictive + # file permissions being applied to the downloaded file. + dst = os.path.expanduser(dst) + for _ in range(tempfile.TMP_MAX): + tmp_dst = dst + "." + uuid.uuid4().hex + ".partial" + try: + f = open(tmp_dst, "w+b") # noqa: SIM115 + except FileExistsError: + continue + break + else: + raise FileExistsError(errno.EEXIST, "No usable temporary file name found") + req = Request(url, headers={"User-Agent": "torch.hub"}) + try: + with urlopen(req) as u: + meta = u.info() + if hasattr(meta, "getheaders"): + content_length = meta.getheaders("Content-Length") + else: + content_length = meta.get_all("Content-Length") + file_size = None + if content_length is not None and len(content_length) > 0: + file_size = int(content_length[0]) + + sha256 = hashlib.sha256() if hash_prefix is not None else None + with tqdm( + total=file_size, + disable=not progress, + unit="B", + unit_scale=True, + unit_divisor=1024, + ) as pbar: + while True: + buffer = u.read(READ_DATA_CHUNK) + if len(buffer) == 0: + break + f.write(buffer) + if sha256 is not None: + sha256.update(buffer) + pbar.update(len(buffer)) + + f.close() + if sha256 is not None and hash_prefix is not None: + digest = sha256.hexdigest() + if digest[: len(hash_prefix)] != hash_prefix: + raise RuntimeError( + f'invalid hash value (expected "{hash_prefix}", got "{digest}")' + ) + shutil.move(f.name, dst) + finally: + f.close() + if os.path.exists(f.name): + os.remove(f.name) + + +# Hub used to support automatically extracts from zipfile manually compressed by users. +# The legacy zip format expects only one file from torch.save() < 1.6 in the zip. +# We should remove this support since zipfile is now default zipfile format for torch.save(). +def _is_legacy_zip_format(filename: str) -> bool: + if zipfile.is_zipfile(filename): + with zipfile.ZipFile(filename) as zf: + infolist = zf.infolist() + return len(infolist) == 1 and not infolist[0].is_dir() + return False + + +@deprecated( + "Falling back to the old format < 1.6. This support will be " + "deprecated in favor of default zipfile format introduced in 1.6. " + "Please redo torch.save() to save it in the new zipfile format.", + category=FutureWarning, +) +def _legacy_zip_load( + filename: str, + model_dir: str, + map_location: MAP_LOCATION, + weights_only: bool, +) -> dict[str, Any]: + # Note: extractall() defaults to overwrite file if exists. No need to clean up beforehand. + # We deliberately don't handle tarfile here since our legacy serialization format was in tar. + # E.g. resnet18-5c106cde.pth which is widely used. + with zipfile.ZipFile(filename) as f: + members = f.infolist() + if len(members) != 1: + raise RuntimeError("Only one file(not dir) is allowed in the zipfile") + f.extractall(model_dir) + extraced_name = members[0].filename + extracted_file = os.path.join(model_dir, extraced_name) + return torch.load( + extracted_file, map_location=map_location, weights_only=weights_only + ) + + +def load_state_dict_from_url( + url: str, + model_dir: str | None = None, + map_location: MAP_LOCATION = None, + progress: bool = True, + check_hash: bool = False, + file_name: str | None = None, + weights_only: bool = False, +) -> dict[str, Any]: + r"""Loads the Torch serialized object at the given URL. + + If downloaded file is a zip file, it will be automatically + decompressed. + + If the object is already present in `model_dir`, it's deserialized and + returned. + The default value of ``model_dir`` is ``/checkpoints`` where + ``hub_dir`` is the directory returned by :func:`~torch.hub.get_dir`. + + Args: + url (str): URL of the object to download + model_dir (str, optional): directory in which to save the object + map_location (optional): a function or a dict specifying how to remap storage locations (see torch.load) + progress (bool, optional): whether or not to display a progress bar to stderr. + Default: True + check_hash(bool, optional): If True, the filename part of the URL should follow the naming convention + ``filename-.ext`` where ```` is the first eight or more + digits of the SHA256 hash of the contents of the file. The hash is used to + ensure unique names and to verify the contents of the file. + Default: False + file_name (str, optional): name for the downloaded file. Filename from ``url`` will be used if not set. + weights_only(bool, optional): If True, only weights will be loaded and no complex pickled objects. + Recommended for untrusted sources. See :func:`~torch.load` for more details. + + Example: + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_HUB) + >>> state_dict = torch.hub.load_state_dict_from_url( + ... "https://s3.amazonaws.com/pytorch/models/resnet18-5c106cde.pth" + ... ) + + """ + # Issue warning to move data if old env is set + if os.getenv("TORCH_MODEL_ZOO"): + warnings.warn( + "TORCH_MODEL_ZOO is deprecated, please use env TORCH_HOME instead", + stacklevel=2, + ) + + if model_dir is None: + hub_dir = get_dir() + model_dir = os.path.join(hub_dir, "checkpoints") + + os.makedirs(model_dir, exist_ok=True) + + parts = urlparse(url) + filename = os.path.basename(parts.path) + if file_name is not None: + filename = file_name + cached_file = os.path.join(model_dir, filename) + if not os.path.exists(cached_file): + sys.stdout.write(f'Downloading: "{url}" to {cached_file}\n') + hash_prefix = None + if check_hash: + r = HASH_REGEX.search(filename) # r is Optional[Match[str]] + hash_prefix = r.group(1) if r else None + download_url_to_file(url, cached_file, hash_prefix, progress=progress) + + if _is_legacy_zip_format(cached_file): + return _legacy_zip_load(cached_file, model_dir, map_location, weights_only) + return torch.load(cached_file, map_location=map_location, weights_only=weights_only) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/library.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/library.py new file mode 100644 index 0000000000000000000000000000000000000000..391af433e0088d42814fece9611351782a78808f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/library.py @@ -0,0 +1,1736 @@ +# mypy: allow-untyped-defs +import contextlib +import functools +import inspect +import re +import sys +import traceback +import weakref +from collections.abc import Callable, Sequence +from typing import Any, overload, TYPE_CHECKING, TypeVar, Union +from typing_extensions import deprecated, ParamSpec + +import torch +import torch._library as _library +from torch._library.custom_ops import ( + _cast, + _maybe_get_opdef, + custom_op, + CustomOpDef, + device_types_t, +) +from torch._library.effects import EffectType +from torch._library.infer_schema import infer_schema # noqa: F401 +from torch._library.triton import triton_op, wrap_triton +from torch._ops import OpOverload +from torch.types import _dtype + + +__all__ = [ + "Library", + "impl", + "define", + "fallthrough_kernel", + "impl_abstract", + "register_autocast", + "register_fake", + "register_torch_dispatch", + "register_vmap", + "get_ctx", + "get_kernel", + "custom_op", + "triton_op", + "wrap_triton", + "infer_schema", +] + +_T = TypeVar("_T") +_P = ParamSpec("_P") + +# Set containing the combination of (namespace, operator, DispatchKey) for which a new kernel has been registered +# The keys in the set are of the form `namespace + "/" + op_name + "/" + dispatch_key`. +# This set is maintained to ensure that two libraries don't try to override the exact same functionality to avoid +# libraries calling into kernels not intended to be called. +_impls: set[str] = set() +_defs: set[str] = set() + +# prim is reserved by TorchScript interpreter +_reserved_namespaces = ["prim"] + + +def fallthrough_kernel(): + """ + A dummy function to pass to ``Library.impl`` in order to register a fallthrough. + """ + raise NotImplementedError("fallthrough_kernel() should never be called.") + + +class Library: + """ + A class to create libraries that can be used to register new operators or + override operators in existing libraries from Python. + A user can optionally pass in a dispatch keyname if they only want to register + kernels corresponding to only one specific dispatch key. + + To create a library to override operators in an existing library (with name ns), set the kind to "IMPL". + To create a new library (with name ns) to register new operators, set the kind to "DEF". + To create a fragment of a possibly existing library to register operators (and bypass + the limitation that there is only one library for a given namespace), set the kind to + "FRAGMENT". + + Args: + ns: library name + kind: "DEF", "IMPL", "FRAGMENT" + dispatch_key: PyTorch dispatch key (default: "") + """ + + def __init__(self, ns, kind, dispatch_key=""): + from torch.fx.operator_schemas import _SCHEMA_TO_SIGNATURE_CACHE + + if kind not in ("IMPL", "DEF", "FRAGMENT"): + raise ValueError("Unsupported kind: ", kind) + + if ns in _reserved_namespaces and (kind == "DEF" or kind == "FRAGMENT"): + raise ValueError( + ns, + " is a reserved namespace. Please try creating a library with another name.", + ) + + frame = traceback.extract_stack(limit=2)[0] + filename, lineno = frame.filename, frame.lineno + self.m: Any | None = torch._C._dispatch_library( + kind, ns, dispatch_key, filename, lineno + ) + self.ns = ns + self._op_defs: set[str] = set() + self._op_impls: set[str] = set() + self._registration_handles: list[torch._library.utils.RegistrationHandle] = [] + self.kind = kind + self.dispatch_key = dispatch_key + # Use a finalizer to setup the "destructor" instead of __del__. + # Python __del__ can lead to weird things (globals and locals may already + # be gone when __del__ actually gets called!). finalizers help the + # situation because it lets us capture references and keeps them alive + weakref.finalize( + self, + _del_library, + _impls, + self._op_impls, + _defs, + self._op_defs, + self._registration_handles, + self.m, + _SCHEMA_TO_SIGNATURE_CACHE, + ) + + def __repr__(self): + return f"Library(kind={self.kind}, ns={self.ns}, dispatch_key={self.dispatch_key})>" + + def define(self, schema, alias_analysis="", *, tags=()): + r"""Defines a new operator and its semantics in the ns namespace. + + Args: + schema: function schema to define a new operator. + alias_analysis (optional): Indicates if the aliasing properties of the operator arguments can be + inferred from the schema (default behavior) or not ("CONSERVATIVE"). + tags (Tag | Sequence[Tag]): one or more torch.Tag to apply to this + operator. Tagging an operator changes the operator's behavior + under various PyTorch subsystems; please read the docs for the + torch.Tag carefully before applying it. + + Returns: + name of the operator as inferred from the schema. + + Example:: + + >>> my_lib = Library("mylib", "DEF") + >>> my_lib.define("sum(Tensor self) -> Tensor") + """ + + # This is added because we also want to disallow PURE_FUNCTION alias analysis which is a valid + # AliasAnalysis type in C++ + if alias_analysis not in ["", "FROM_SCHEMA", "CONSERVATIVE"]: + raise RuntimeError(f"Invalid alias_analysis type {alias_analysis}") + assert self.m is not None + if isinstance(tags, torch.Tag): + tags = (tags,) + + name = schema.split("(")[0] + packet_name = name.split(".")[0] if "." in name else name + has_preexisting_packet = hasattr(torch.ops, self.ns) and hasattr( + getattr(torch.ops, self.ns), packet_name + ) + + result = self.m.define(schema, alias_analysis, tuple(tags)) + name = schema.split("(")[0] + qualname = self.ns + "::" + name + + # If the OpOverloadPacket exists already, then this means we're adding a + # new OpOverload for it. Refresh the packet to include the new OpOverload. + if has_preexisting_packet: + ns = getattr(torch.ops, self.ns) + packet = getattr(ns, packet_name) + torch._ops._refresh_packet(packet) + + self._op_defs.add(qualname) + _defs.add(qualname) + return result + + def _register_fake(self, op_name, fn, _stacklevel=1, *, allow_override=False): + r"""Registers the fake impl for an operator defined in the library.""" + + source = torch._library.utils.get_source(_stacklevel + 1) + frame = sys._getframe(_stacklevel) + caller_module = inspect.getmodule(frame) + # Can be none if you call register_fake from somewhere there isn't a module + # (e.g. __main__) + caller_module_name = None if caller_module is None else caller_module.__name__ + + # TODO(rzou): We're gonna need to stage this change with torchvision, + # since torchvision is github first. + if caller_module_name is not None and caller_module_name.startswith( + "torchvision." + ): + caller_module_name = None + + qualname = f"{self.ns}::{op_name}" + entry = torch._library.simple_registry.singleton.find(qualname) + if caller_module_name is not None: + func_to_register = _check_pystubs_once(fn, qualname, caller_module_name) + else: + func_to_register = fn + + handle = entry.fake_impl.register( + func_to_register, source, lib=self, allow_override=allow_override + ) + self._registration_handles.append(handle) + + def _register_torch_dispatch_rule(self, op_name, torch_dispatch_class, fn): + r"""Registers a torch_dispatch rule for the given operator and torch_dispatch_class. + + This allows for open registration to specify the behavior between the operator + and the torch_dispatch_class without needing to modify the torch_dispatch_class + or the operator directly. + + The torch_dispatch_class is either a Tensor subclass with `__torch_dispatch__` or a + TorchDispatchMode. + + If it is a Tensor subclass, we expect fn to have the following signature: + (cls, func: OpOverload, types: Tuple[type, ...], args, kwargs) -> Any + + If it is a TorchDispatchMode, we expect fn to have the following signature: + (mode, func: OpOverload, types: Tuple[type, ...], args, kwargs) -> Any + """ + + qualname = f"{self.ns}::{op_name}" + entry = torch._library.simple_registry.singleton.find(qualname) + handle = entry.torch_dispatch_rules.register(torch_dispatch_class, fn) + self._registration_handles.append(handle) + + def _impl_with_aoti_compile(self, op_name, dispatch_key=""): + r"""Register the operator to use the AOTI-compiled implementation. + + Args: + op_name: operator name (along with the overload) or OpOverload object. + dispatch_key: dispatch key that the input function should be registered for. By default, it uses + the dispatch key that the library was created with. + + Example:: + + >>> my_lib = Library("aten", "IMPL") + >>> my_lib._impl_with_aoti_compile("div.Tensor", "CPU") + """ + + if dispatch_key == "": + dispatch_key = self.dispatch_key + # pyrefly: ignore [bad-argument-type] + assert torch.DispatchKeySet(dispatch_key).has(torch._C.DispatchKey.Dense) + + if isinstance(op_name, str): + name = op_name + elif isinstance(op_name, OpOverload): + name = op_name._schema.name + overload_name = op_name._schema.overload_name + if overload_name != "": + name = name + "." + overload_name + else: + raise RuntimeError( + "_impl_with_aoti_compile should be passed either a name or an OpOverload object " + "as the first argument" + ) + + key = self.ns + "/" + name.split("::")[-1] + "/" + dispatch_key + if key in _impls: + # TODO: in future, add more info about where the existing function is registered (this info is + # today already returned by the C++ warning when _impl_with_aoti_compile is called but we error out before that) + raise RuntimeError( + "This is not allowed since there's already a kernel registered from python overriding {}" + "'s behavior for {} dispatch key and {} namespace.".format( + name.split("::")[-1], dispatch_key, self.ns + ) + ) + + assert self.m is not None + impl_fn: Callable = self.m.impl_with_aoti_compile + impl_fn(self.ns, name.split("::")[-1], dispatch_key) + + _impls.add(key) + self._op_impls.add(key) + + def impl( + self, op_name, fn, dispatch_key="", *, with_keyset=False, allow_override=False + ): + r"""Registers the function implementation for an operator defined in the library. + + Args: + op_name: operator name (along with the overload) or OpOverload object. + fn: function that's the operator implementation for the input dispatch key or :func:`~fallthrough_kernel` + to register a fallthrough. + dispatch_key: dispatch key that the input function should be registered for. By default, it uses + the dispatch key that the library was created with. + with_keyset: flag controlling if the current dispatcher call keyset should be passed as the first argument + to :attr:`fn` when calling. This should be used to create the appropriate keyset for redispatch calls. + allow_override: Flag controlling if we want to override an + existing registered kernel implementation. This is by + default off, and will error you're trying to register a + kernel to a dispatch key with a kernel already + registered. + + Example:: + + >>> my_lib = Library("aten", "IMPL") + >>> def div_cpu(self, other): + >>> return self * (1 / other) + >>> my_lib.impl("div.Tensor", div_cpu, "CPU") + """ + + if not callable(fn): + raise TypeError( + f"Input function is required to be a callable but found type {type(fn)}" + ) + if dispatch_key == "": + dispatch_key = self.dispatch_key + + if isinstance(op_name, str): + name = op_name + elif isinstance(op_name, OpOverload): + name = op_name._schema.name + overload_name = op_name._schema.overload_name + if overload_name != "": + name = name + "." + overload_name + else: + raise RuntimeError( + "impl should be passed either a name or an OpOverload object as the first argument" + ) + + key = self.ns + "/" + name.split("::")[-1] + "/" + dispatch_key + if (not allow_override) and key in _impls: + # TODO: in future, add more info about where the existing function is registered (this info is + # today already returned by the C++ warning when impl is called but we error out before that) + raise RuntimeError( + "This is not allowed since there's already a kernel registered from python overriding {}" + "'s behavior for {} dispatch key and {} namespace.".format( + name.split("::")[-1], dispatch_key, self.ns + ) + ) + + if dispatch_key == "Meta": + dispatcher_op_name = name + if "::" not in dispatcher_op_name: + dispatcher_op_name = f"{self.ns}::{dispatcher_op_name}" + + # Internally, we shouldn't be registering meta kernels for any operators that + # have CompositeImplicitAutograd kernels. + # Instead, we should be letting those decompositions run, and writing meta kernels + # only for the base operators. + if torch._C._dispatch_has_kernel_for_dispatch_key( + dispatcher_op_name, "CompositeImplicitAutograd" + ): + raise RuntimeError( + f"We should not register a meta kernel directly to the operator '{name}'," + " because it has a CompositeImplicitAutograd kernel in core." + " Instead we should let the operator decompose, and ensure that we have meta kernels" + " for the base ops that it decomposes into." + ) + + assert self.m is not None + self.m.impl( + name, + dispatch_key if dispatch_key != "" else "CompositeImplicitAutograd", + fn, + with_keyset, + ) + + _impls.add(key) + self._op_impls.add(key) + + def fallback(self, fn, dispatch_key="", *, with_keyset=False): + r"""Registers the function implementation as the fallback for the given key. + + This function only works for a library with global namespace ("_"). + + Args: + fn: function used as fallback for the given dispatch key or :func:`~fallthrough_kernel` + to register a fallthrough. + dispatch_key: dispatch key that the input function should be registered for. By default, it uses + the dispatch key that the library was created with. + with_keyset: flag controlling if the current dispatcher call keyset should be passed as the first argument + to :attr:`fn` when calling. This should be used to create the appropriate keyset for redispatch calls. + + Example:: + + >>> my_lib = Library("_", "IMPL") + >>> def fallback_kernel(op, *args, **kwargs): + >>> # Handle all autocast ops generically + >>> # ... + >>> my_lib.fallback(fallback_kernel, "Autocast") + """ + + if dispatch_key == "": + dispatch_key = self.dispatch_key + + if self.ns != "_": + raise RuntimeError( + f"""Fallback can only be registered using library fragment on the global namespace "_" but it is {self.ns}""" + ) + + assert dispatch_key != "" + assert self.m is not None + + self.m.fallback(dispatch_key, fn, with_keyset) + + def _register_effectful_op(self, op_name: str, effect: EffectType | None): + """ + Registers an effect to an operator. This is used to register an op that + has side effects that is not capturable by the schema. + + Args: + op_name: operator name (along with the overload) or OpOverload object. + effect: The effect of the op. + """ + from torch._higher_order_ops.effects import ( + _register_effectful_op as hoo_register_effect, + ) + + handle = hoo_register_effect(op_name, effect) + self._registration_handles.append(handle) + + def _destroy(self): + if self.m is not None: + self.m.reset() + self.m = None + for handle in self._registration_handles: + handle.destroy() + self._registration_handles.clear() + global _impls + _impls -= self._op_impls + for name in self._op_defs: + # Delete the cached torch.ops.ns.foo if it was registered. + # Otherwise, accessing it leads to a segfault. + # It's possible that we only registered an overload in this Library + # and another library owns an alive overload. + # That's OK - the next time torch.ops.ns.foo gets called, it'll be + # recomputed to point at the right collection of overloads. + ns, name_with_overload = name.split("::") + name = name_with_overload.split(".")[0] + if not hasattr(torch.ops, ns): + continue + namespace = getattr(torch.ops, ns) + if not hasattr(namespace, name): + continue + delattr(namespace, name) + namespace._dir.remove(name) + + +def _del_library( + captured_impls, + op_impls, + captured_defs, + op_defs, + registration_handles, + m, + schema_to_signature_cache, +): + for op_def in op_defs: + name = op_def + overload_name = "" + if "." in op_def: + name, overload_name = op_def.split(".") + if ( + name, + overload_name, + ) in schema_to_signature_cache: + del schema_to_signature_cache[(name, overload_name)] + + captured_impls -= op_impls + captured_defs -= op_defs + for handle in registration_handles: + handle.destroy() + + if m is not None: + m.reset() + + +@contextlib.contextmanager +def _scoped_library(*args, **kwargs): + try: + lib = Library(*args, **kwargs) + yield lib + finally: + lib._destroy() + + +_keep_alive: list[Library] = [] + + +NAMELESS_SCHEMA = re.compile(r"\(.*\) -> .*") + + +@functools.singledispatch +def define(qualname, schema, *, lib=None, tags=()): + r"""Defines a new operator. + + In PyTorch, defining an op (short for "operator") is a two step-process: + - we need to define the op (by providing an operator name and schema) + - we need to implement behavior for how the operator interacts with + various PyTorch subsystems, like CPU/CUDA Tensors, Autograd, etc. + + This entrypoint defines the custom operator (the first step) + you must then perform the second step by calling various + ``impl_*`` APIs, like :func:`torch.library.impl` or + :func:`torch.library.register_fake`. + + Args: + qualname (str): The qualified name for the operator. Should be + a string that looks like "namespace::name", e.g. "aten::sin". + Operators in PyTorch need a namespace to + avoid name collisions; a given operator may only be created once. + If you are writing a Python library, we recommend the namespace to + be the name of your top-level module. + schema (str): The schema of the operator. E.g. "(Tensor x) -> Tensor" + for an op that accepts one Tensor and returns one Tensor. It does + not contain the operator name (that is passed in ``qualname``). + lib (Optional[Library]): If provided, the lifetime of this operator + will be tied to the lifetime of the Library object. + tags (Tag | Sequence[Tag]): one or more torch.Tag to apply to this + operator. Tagging an operator changes the operator's behavior + under various PyTorch subsystems; please read the docs for the + torch.Tag carefully before applying it. + + Example:: + >>> import torch + >>> import numpy as np + >>> + >>> # Define the operator + >>> torch.library.define("mylib::sin", "(Tensor x) -> Tensor") + >>> + >>> # Add implementations for the operator + >>> @torch.library.impl("mylib::sin", "cpu") + >>> def f(x): + >>> return torch.from_numpy(np.sin(x.numpy())) + >>> + >>> # Call the new operator from torch.ops. + >>> x = torch.randn(3) + >>> y = torch.ops.mylib.sin(x) + >>> assert torch.allclose(y, x.sin()) + + """ + if not isinstance(qualname, str): + raise ValueError( + f"define(qualname, schema): expected qualname " + f"to be instance of str, got {type(qualname)}" + ) + namespace, name = torch._library.utils.parse_namespace(qualname) + if lib is None: + lib = Library(namespace, "FRAGMENT") + _keep_alive.append(lib) + if not NAMELESS_SCHEMA.fullmatch(schema): + raise ValueError( + f"define(qualname, schema, ...): expected schema " + f'to look like e.g. "(Tensor x) -> Tensor" but ' + f'got "{schema}"' + ) + lib.define(name + schema, alias_analysis="", tags=tags) + + +@define.register +def _(lib: Library, schema, alias_analysis=""): + """The old torch.library.define. + We're keeping this around for BC reasons + """ + + def wrap(f): + name = lib.define(schema, alias_analysis) + lib.impl(name, f) + return f + + return wrap + + +@overload +def impl( + qualname: str, + types: str | Sequence[str], + func: None = None, + *, + lib: Library | None = None, +) -> Callable[[Callable[..., object]], None]: ... + + +@overload +def impl( + qualname: str, + types: str | Sequence[str], + func: Callable[..., object], + *, + lib: Library | None = None, +) -> None: ... + + +# Deprecated BC API +@overload +def impl( + lib: Library, + name: str, + dispatch_key: str = "", +) -> Callable[[Callable[_P, _T]], Callable[_P, _T]]: ... + + +@functools.singledispatch +def impl( + qualname: str, + types: str | Sequence[str], + func: Callable[_P, _T] | None = None, + *, + lib: Library | None = None, +) -> object: + """Register an implementation for a device type for this operator. + + You may pass "default" for ``types`` to register this implementation as the + default implementation for ALL device types. + Please only use this if the implementation truly supports all device types; + for example, this is true if it is a composition of built-in PyTorch operators. + + This API may be used as a decorator. You can use nested decorators + with this API provided they return a function and are placed inside + this API (see Example 2). + + Some valid types are: "cpu", "cuda", "xla", "mps", "ipu", "xpu". + + Args: + qualname (str): Should be a string that looks like "namespace::operator_name". + types (str | Sequence[str]): The device types to register an impl to. + lib (Optional[Library]): If provided, the lifetime of this registration + will be tied to the lifetime of the Library object. + + Examples: + >>> import torch + >>> import numpy as np + >>> # Example 1: Register function. + >>> # Define the operator + >>> torch.library.define("mylib::mysin", "(Tensor x) -> Tensor") + >>> + >>> # Add implementations for the cpu device + >>> @torch.library.impl("mylib::mysin", "cpu") + >>> def f(x): + >>> return torch.from_numpy(np.sin(x.numpy())) + >>> + >>> x = torch.randn(3) + >>> y = torch.ops.mylib.mysin(x) + >>> assert torch.allclose(y, x.sin()) + >>> + >>> # Example 2: Register function with decorator. + >>> def custom_decorator(func): + >>> def wrapper(*args, **kwargs): + >>> return func(*args, **kwargs) + 1 + >>> return wrapper + >>> + >>> # Define the operator + >>> torch.library.define("mylib::sin_plus_one", "(Tensor x) -> Tensor") + >>> + >>> # Add implementations for the operator + >>> @torch.library.impl("mylib::sin_plus_one", "cpu") + >>> @custom_decorator + >>> def f(x): + >>> return torch.from_numpy(np.sin(x.numpy())) + >>> + >>> # Call the new operator from torch.ops. + >>> x = torch.randn(3) + >>> + >>> y1 = torch.ops.mylib.sin_plus_one(x) + >>> y2 = torch.sin(x) + 1 + >>> assert torch.allclose(y1, y2) + """ + + return _impl(qualname, types, func, lib=lib, disable_dynamo=False) + + +if not TYPE_CHECKING: + + @impl.register + def _( + lib: Library, name: str, dispatch_key: str = "" + ) -> Callable[[Callable[_P, _T]], Callable[_P, _T]]: + """Legacy torch.library.impl API. Kept around for BC""" + + def wrap(f: Callable[_P, _T]) -> Callable[_P, _T]: + lib.impl(name, f, dispatch_key) + return f + + return wrap + + +@overload +def _impl( + qualname: str, + types: str | Sequence[str], + func: None = None, + *, + lib: Library | None = None, + disable_dynamo: bool = False, +) -> Callable[[Callable[..., object]], None]: ... + + +@overload +def _impl( + qualname: str, + types: str | Sequence[str], + func: Callable[..., object], + *, + lib: Library | None = None, + disable_dynamo: bool = False, +) -> None: ... + + +def _impl( + qualname: str, + types: str | Sequence[str], + func: Callable[..., object] | None = None, + *, + lib: Library | None = None, + disable_dynamo: bool = False, +) -> Callable[[Callable[..., object]], None] | None: + # See impl() + if isinstance(types, str): + types = (types,) + keys = set({}) + for typ in types: + is_dispatch_key = torch._C._parse_dispatch_key(typ) + if is_dispatch_key: + # We also support passing a DispatchKey to impl. Please prefer using + # the higher-level torch.library APIs and only pass DispatchKey to + # torch.library.impl with caution (or even better, don't use this + # option and file an issue on GitHub for what you need). + # We don't advertise this to users because + # it is very easy to shoot yourself in the foot. + keys.add(typ) + else: + keys.add(_device_type_to_key(typ)) + + def register_(func: Callable[..., object]) -> None: + namespace, _ = torch._library.utils.parse_namespace(qualname) + + if lib is None: + use_lib = Library(namespace, "FRAGMENT") + _keep_alive.append(use_lib) + else: + use_lib = lib + if disable_dynamo: + + @torch._disable_dynamo + def func_no_dynamo(*args, **kwargs): + return func(*args, **kwargs) + + for key in keys: + use_lib.impl(qualname, func_no_dynamo, key) + else: + for key in keys: + use_lib.impl(qualname, func, key) + + if func is None: + return register_ + else: + register_(func) + return None + + +def _device_type_to_key(device_type: str) -> str: + if device_type == "default": + # This is technically not correct, because although all device_type + # DispatchKeys are included in CompositeExplicitAutograd, + # not everything in CompositeExplicitAutograd is associated with a + # device_type. I don't really care that much about the difference. + return "CompositeExplicitAutograd" + return torch._C._dispatch_key_for_device(device_type) + + +@deprecated( + "`torch.library.impl_abstract` was renamed to `torch.library.register_fake`. Please use that " + "instead; we will remove `torch.library.impl_abstract` in a future version of PyTorch.", + category=FutureWarning, +) +def impl_abstract(qualname, func=None, *, lib=None, _stacklevel=1): + r"""This API was renamed to :func:`torch.library.register_fake` in PyTorch 2.4. + Please use that instead. + """ + if func is not None: + _stacklevel = _stacklevel + 1 + return register_fake(qualname, func, lib=lib, _stacklevel=_stacklevel) + + +_op_identifier = Union[ + str, "torch._ops.OpOverload", "torch._library.custom_ops.CustomOpDef" +] + + +def register_kernel( + op: _op_identifier, + device_types: device_types_t, + func: Callable | None = None, + /, + *, + lib: Library | None = None, +): + """Register an implementation for a device type for this operator. + + Some valid device_types are: "cpu", "cuda", "xla", "mps", "ipu", "xpu". + This API may be used as a decorator. + + Args: + op (str | OpOverload): The operator to register an impl to. + device_types (None | str | Sequence[str]): The device_types to register an impl to. + If None, we will register to all device types -- please only use + this option if your implementation is truly device-type-agnostic. + func (Callable): The function to register as the implementation for + the given device types. + lib (Optional[Library]): If provided, the lifetime of this registration + + Examples:: + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> import torch + >>> from torch import Tensor + >>> from torch.library import custom_op + >>> import numpy as np + >>> + >>> # Create a custom op that works on cpu + >>> @custom_op("mylib::numpy_sin", mutates_args=(), device_types="cpu") + >>> def numpy_sin(x: Tensor) -> Tensor: + >>> x_np = x.numpy() + >>> y_np = np.sin(x_np) + >>> return torch.from_numpy(y_np) + >>> + >>> # Add implementations for the cuda device + >>> @torch.library.register_kernel("mylib::numpy_sin", "cuda") + >>> def _(x): + >>> x_np = x.cpu().numpy() + >>> y_np = np.sin(x_np) + >>> return torch.from_numpy(y_np).to(device=x.device) + >>> + >>> x_cpu = torch.randn(3) + >>> x_cuda = x_cpu.cuda() + >>> assert torch.allclose(numpy_sin(x_cpu), x_cpu.sin()) + >>> assert torch.allclose(numpy_sin(x_cuda), x_cuda.sin()) + + """ + + if not isinstance( + op, (str, torch._ops.OpOverload, torch._library.custom_ops.CustomOpDef) + ): + raise ValueError( + f"register_kernel({op}): got unexpected type for op: {type(op)}" + ) + if isinstance(op, torch._ops.OpOverload): + op = op._name + opdef = _maybe_get_opdef(op) + if opdef is not None: + return opdef.register_kernel(device_types, func) + assert isinstance(op, str) + if device_types is None: + device_types = "CompositeExplicitAutograd" + + return _impl(op, device_types, func, lib=lib, disable_dynamo=True) + + +def register_autocast( + op: _op_identifier, + device_type: str, + cast_inputs: _dtype, + /, + *, + lib: Library | None = None, +): + r"""Register an autocast dispatch rule for this custom op. + + Valid `device_type` include: "cpu" and "cuda". + + Args: + op (str | OpOverload): The operator to register an autocast dispatch rule to. + device_type(str): Device type to use. 'cuda' or 'cpu'. + The type is the same as the `type` attribute of a :class:`torch.device`. + Thus, you may obtain the device type of a tensor using `Tensor.device.type`. + cast_inputs (:class:`torch.dtype`): When custom op runs in an autocast-enabled region, + casts incoming floating-point Tensors to the target dtype (non-floating-point Tensors + are not affected), then executes custom op with autocast disabled. + lib (Optional[Library]): If provided, the lifetime of this registration + + Examples:: + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> import torch + >>> from torch import Tensor + >>> from torch.library import custom_op + >>> + >>> # Create a custom op that works on cuda + >>> @torch.library.custom_op("mylib::my_sin", mutates_args=()) + >>> def my_sin(x: Tensor) -> Tensor: + >>> return torch.sin(x) + >>> + >>> # Register autocast dispatch rule for the cuda device + >>> torch.library.register_autocast("mylib::my_sin", "cuda", torch.float16) + >>> + >>> x = torch.randn(3, dtype=torch.float32, device="cuda") + >>> with torch.autocast("cuda", dtype=torch.float16): + >>> y = torch.ops.mylib.my_sin(x) + >>> assert y.dtype == torch.float16 + + """ + if not isinstance( + op, (str, torch._ops.OpOverload, torch._library.custom_ops.CustomOpDef) + ): + raise ValueError( + f"register_autocast({op}): got unexpected type for op: {type(op)}" + ) + if device_type not in ["cpu", "cuda"]: + raise ValueError(f"Unknown device type: {device_type}") + + if isinstance(op, torch._ops.OpOverload): + op = op._name + opdef = _maybe_get_opdef(op) + if opdef is not None: + return opdef.register_autocast(device_type, cast_inputs) + + assert isinstance(op, str) + qualname = op + _op = torch._library.utils.lookup_op(qualname) + + namespace, opname = torch._library.utils.parse_namespace(qualname) + if lib is None: + lib = Library(namespace, "FRAGMENT") + _keep_alive.append(lib) + + def _maybe_override_py_impl(op: torch._ops.OpOverload, dispatch_key): + def inner(kernel): + if op.has_kernel_for_dispatch_key(dispatch_key): + op.py_kernels.pop(dispatch_key) + return op.py_impl(dispatch_key)(kernel) + + return inner + + @_maybe_override_py_impl(_op, torch._C.DispatchKey.AutocastCPU) + @_maybe_override_py_impl(_op, torch._C.DispatchKey.AutocastCUDA) + def _autocast_py_impl(*args, **kwargs): + assert len(kwargs) == 0, "Custom ops do not support kwargs yet." + autocast_keyset = torch._C.DispatchKeySet( + torch._C.DispatchKey.AutocastCPU + ) | torch._C.DispatchKeySet(torch._C.DispatchKey.AutocastCUDA) + with torch._C._ExcludeDispatchKeyGuard(autocast_keyset): + return _op(*_cast(args, device_type, cast_inputs)) + + def kernel(_, *args, **kwargs): + assert len(kwargs) == 0, "Custom ops do not support kwargs yet." + return _autocast_py_impl(*args, **kwargs) + + if device_type == "cuda": + return lib.impl(opname, kernel, "AutocastCUDA", with_keyset=True) + else: + # device_type is "cpu" + return lib.impl(opname, kernel, "AutocastCPU", with_keyset=True) + + +def register_fake( + op: _op_identifier, + func: Callable | None = None, + /, + *, + lib: Library | None = None, + _stacklevel: int = 1, + allow_override: bool = False, +): + r"""Register a FakeTensor implementation ("fake impl") for this operator. + + Also sometimes known as a "meta kernel", "abstract impl". + + An "FakeTensor implementation" specifies the behavior of this operator on + Tensors that carry no data ("FakeTensor"). Given some input Tensors with + certain properties (sizes/strides/storage_offset/device), it specifies + what the properties of the output Tensors are. + + The FakeTensor implementation has the same signature as the operator. + It is run for both FakeTensors and meta tensors. To write a FakeTensor + implementation, assume that all Tensor inputs to the operator are + regular CPU/CUDA/Meta tensors, but they do not have storage, and + you are trying to return regular CPU/CUDA/Meta tensor(s) as output. + The FakeTensor implementation must consist of only PyTorch operations + (and may not directly access the storage or data of any input or + intermediate Tensors). + + This API may be used as a decorator (see examples). + + For a detailed guide on custom ops, please see + https://pytorch.org/tutorials/advanced/custom_ops_landing_page.html + + Args: + op_name: Operator name (along with the overload) or OpOverload object. + func: Fake tensor implementation. + lib (Optional[Library]): Library to register the fake tensor to. + allow_override: Flag controlling if we want to override an + existing registered fake impl. This is by default off, + and will error you're trying to register a fake impl to + an operator that already has a fake impl. This also only + applies if the custom operator was not created via + torch.library.custom_op, as overriding and existing fake + impl is already allowed. + + Examples: + >>> import torch + >>> import numpy as np + >>> from torch import Tensor + >>> + >>> # Example 1: an operator without data-dependent output shape + >>> @torch.library.custom_op("mylib::custom_linear", mutates_args=()) + >>> def custom_linear(x: Tensor, weight: Tensor, bias: Tensor) -> Tensor: + >>> raise NotImplementedError("Implementation goes here") + >>> + >>> @torch.library.register_fake("mylib::custom_linear") + >>> def _(x, weight, bias): + >>> assert x.dim() == 2 + >>> assert weight.dim() == 2 + >>> assert bias.dim() == 1 + >>> assert x.shape[1] == weight.shape[1] + >>> assert weight.shape[0] == bias.shape[0] + >>> assert x.device == weight.device + >>> + >>> return (x @ weight.t()) + bias + >>> + >>> with torch._subclasses.fake_tensor.FakeTensorMode(): + >>> x = torch.randn(2, 3) + >>> w = torch.randn(3, 3) + >>> b = torch.randn(3) + >>> y = torch.ops.mylib.custom_linear(x, w, b) + >>> + >>> assert y.shape == (2, 3) + >>> + >>> # Example 2: an operator with data-dependent output shape + >>> @torch.library.custom_op("mylib::custom_nonzero", mutates_args=()) + >>> def custom_nonzero(x: Tensor) -> Tensor: + >>> x_np = x.numpy(force=True) + >>> res = np.stack(np.nonzero(x_np), axis=1) + >>> return torch.tensor(res, device=x.device) + >>> + >>> @torch.library.register_fake("mylib::custom_nonzero") + >>> def _(x): + >>> # Number of nonzero-elements is data-dependent. + >>> # Since we cannot peek at the data in an fake impl, + >>> # we use the ctx object to construct a new symint that + >>> # represents the data-dependent size. + >>> ctx = torch.library.get_ctx() + >>> nnz = ctx.new_dynamic_size() + >>> shape = [nnz, x.dim()] + >>> result = x.new_empty(shape, dtype=torch.int64) + >>> return result + >>> + >>> from torch.fx.experimental.proxy_tensor import make_fx + >>> + >>> x = torch.tensor([0, 1, 2, 3, 4, 0]) + >>> trace = make_fx(torch.ops.mylib.custom_nonzero, tracing_mode="symbolic")(x) + >>> trace.print_readable() + >>> + >>> assert torch.allclose(trace(x), torch.ops.mylib.custom_nonzero(x)) + + """ + if not isinstance( + op, (str, torch._ops.OpOverload, torch._library.custom_ops.CustomOpDef) + ): + raise ValueError(f"register_fake({op}): got unexpected type for op: {type(op)}") + if isinstance(op, torch._ops.OpOverload): + op = op._name + opdef = _maybe_get_opdef(op) + if opdef is not None: + if func is None: + return opdef.register_fake + else: + return opdef.register_fake(func) + assert isinstance(op, str) + + stacklevel = _stacklevel + + def register(func): + namespace, op_name = torch._library.utils.parse_namespace(op) + if lib is None: + use_lib = Library(namespace, "FRAGMENT") + _keep_alive.append(use_lib) + else: + use_lib = lib + use_lib._register_fake( + op_name, func, _stacklevel=stacklevel + 1, allow_override=allow_override + ) + return func + + if func is None: + return register + else: + stacklevel += 1 + return register(func) + + +def _register_effectful_op( + op: _op_identifier, + effect: EffectType | None, + *, + lib: Library | None = None, +) -> None: + r""" + To specify that an operator has side-effects, we must register an effect + type for the operator. This will prevent graph passes in torch.compile from + reordering operations with the same effect type. + + Args: + op_name: Operator name (along with the overload) or OpOverload object. + effect: Effect type to register. None means the operator is not effectful. + """ + if not isinstance( + op, (str, torch._ops.OpOverload, torch._library.custom_ops.CustomOpDef) + ): + raise ValueError( + f"register_effectful_op({op}): got unexpected type for op: {type(op)}" + ) + + if isinstance(op, torch._ops.OpOverload): + op = op._name + opdef = _maybe_get_opdef(op) + if opdef is not None: + opdef.register_effect(effect) + assert isinstance(op, str) + + namespace, _ = torch._library.utils.parse_namespace(op) + if lib is None: + use_lib = Library(namespace, "FRAGMENT") + _keep_alive.append(use_lib) + else: + use_lib = lib + use_lib._register_effectful_op(op, effect) + + +def register_autograd( + op: _op_identifier, + backward: Callable, + /, + *, + setup_context: Callable | None = None, + lib=None, +) -> None: + r"""Register a backward formula for this custom op. + + In order for an operator to work with autograd, you need to register + a backward formula: + 1. You must tell us how to compute gradients during the backward pass + by providing us a "backward" function. + 2. If you need any values from the forward to compute gradients, you can + use `setup_context` to save values for backward. + + ``backward`` runs during the backward pass. It accepts ``(ctx, *grads)``: + - ``grads`` is one or more gradients. The number of gradients matches + the number of outputs of the operator. + The ``ctx`` object is `the same ctx object `_ used by + :class:`torch.autograd.Function`. The semantics of ``backward_fn`` are the + same as :meth:`torch.autograd.Function.backward`. + + ``setup_context(ctx, inputs, output)`` runs during the forward pass. + Please save quantities needed for backward onto the ``ctx`` object via + either :meth:`torch.autograd.function.FunctionCtx.save_for_backward` + or assigning them as attributes of ``ctx``. If your custom op has + kwarg-only arguments, we expect the signature of ``setup_context`` + to be ``setup_context(ctx, inputs, keyword_only_inputs, output)``. + + Both ``setup_context_fn`` and ``backward_fn`` must be traceable. That is, + they may not directly access :meth:`torch.Tensor.data_ptr` and they must + not depend on or mutate global state. If you need a non-traceable backward, + you can make it a separate custom_op that you call inside ``backward_fn``. + + If you need different autograd behavior on different devices, then we + recommend creating two different custom operators, one for each device + that needs different behavior, and switching between them at runtime. + + Examples: + >>> import torch + >>> import numpy as np + >>> from torch import Tensor + >>> + >>> @torch.library.custom_op("mylib::numpy_sin", mutates_args=()) + >>> def numpy_sin(x: Tensor) -> Tensor: + >>> x_np = x.cpu().numpy() + >>> y_np = np.sin(x_np) + >>> return torch.from_numpy(y_np).to(device=x.device) + >>> + >>> def setup_context(ctx, inputs, output) -> Tensor: + >>> x, = inputs + >>> ctx.save_for_backward(x) + >>> + >>> def backward(ctx, grad): + >>> x, = ctx.saved_tensors + >>> return grad * x.cos() + >>> + >>> torch.library.register_autograd( + ... "mylib::numpy_sin", backward, setup_context=setup_context + ... ) + >>> + >>> x = torch.randn(3, requires_grad=True) + >>> y = numpy_sin(x) + >>> (grad_x,) = torch.autograd.grad(y, x, torch.ones_like(y)) + >>> assert torch.allclose(grad_x, x.cos()) + >>> + >>> # Example with a keyword-only arg + >>> @torch.library.custom_op("mylib::numpy_mul", mutates_args=()) + >>> def numpy_mul(x: Tensor, *, val: float) -> Tensor: + >>> x_np = x.cpu().numpy() + >>> y_np = x_np * val + >>> return torch.from_numpy(y_np).to(device=x.device) + >>> + >>> def setup_context(ctx, inputs, keyword_only_inputs, output) -> Tensor: + >>> ctx.val = keyword_only_inputs["val"] + >>> + >>> def backward(ctx, grad): + >>> return grad * ctx.val + >>> + >>> torch.library.register_autograd( + ... "mylib::numpy_mul", backward, setup_context=setup_context + ... ) + >>> + >>> x = torch.randn(3, requires_grad=True) + >>> y = numpy_mul(x, val=3.14) + >>> (grad_x,) = torch.autograd.grad(y, x, torch.ones_like(y)) + >>> assert torch.allclose(grad_x, torch.full_like(x, 3.14)) + + """ + if not isinstance( + op, (str, torch._ops.OpOverload, torch._library.custom_ops.CustomOpDef) + ): + raise ValueError( + f"register_autograd({op}): got unexpected type for op: {type(op)}" + ) + if isinstance(op, torch._ops.OpOverload): + op = op._name + opdef = _maybe_get_opdef(op) + if opdef is not None: + opdef.register_autograd(backward, setup_context=setup_context) + return + + assert isinstance(op, str) + qualname = op + op = torch._library.utils.lookup_op(qualname) + schema = op._schema + if not _library.utils.is_functional_schema(schema): + raise RuntimeError( + f"Cannot register autograd formula for non-functional operator " + f"{op} with schema {schema}. Please create " + f"a functional operator and register an autograd formula for that." + ) + if _library.utils.has_kwarg_only_tensors(schema): + raise NotImplementedError( + f"register_autograd with kwarg-only Tensor args. In the original " + f"definition of the op, please make your tensors not kwarg-only. " + f"Got: {schema}" + ) + + info = _library.autograd.Info(backward, setup_context) + autograd_kernel = _library.autograd.make_autograd_impl(op, info) + namespace, opname = torch._library.utils.parse_namespace(qualname) + if lib is None: + lib = Library(namespace, "FRAGMENT") + _keep_alive.append(lib) + lib.impl(opname, autograd_kernel, "Autograd", with_keyset=True) + + +def register_torch_dispatch( + op: _op_identifier, + torch_dispatch_class: Any, + func: Callable | None = None, + /, + *, + lib: Library | None = None, +): + r"""Registers a torch_dispatch rule for the given operator and ``torch_dispatch_class``. + + This allows for open registration to specify the behavior between the operator + and the ``torch_dispatch_class`` without needing to modify the ``torch_dispatch_class`` + or the operator directly. + + The ``torch_dispatch_class`` is either a Tensor subclass with ``__torch_dispatch__`` or a + TorchDispatchMode. + + If it is a Tensor subclass, we expect ``func`` to have the following signature: + ``(cls, func: OpOverload, types: Tuple[type, ...], args, kwargs) -> Any`` + + If it is a TorchDispatchMode, we expect ``func`` to have the following signature: + ``(mode, func: OpOverload, types: Tuple[type, ...], args, kwargs) -> Any`` + + ``args`` and ``kwargs`` will have been normalized the same way they are + in ``__torch_dispatch__`` (see :ref:`torch-dispatch-calling-convention`). + + Examples: + + >>> import torch + >>> + >>> @torch.library.custom_op("mylib::foo", mutates_args={}) + >>> def foo(x: torch.Tensor) -> torch.Tensor: + >>> return x.clone() + >>> + >>> class MyMode(torch.utils._python_dispatch.TorchDispatchMode): + >>> def __torch_dispatch__(self, func, types, args=(), kwargs=None): + >>> return func(*args, **kwargs) + >>> + >>> @torch.library.register_torch_dispatch("mylib::foo", MyMode) + >>> def _(mode, func, types, args, kwargs): + >>> x, = args + >>> return x + 1 + >>> + >>> x = torch.randn(3) + >>> y = foo(x) + >>> assert torch.allclose(y, x) + >>> + >>> with MyMode(): + >>> y = foo(x) + >>> assert torch.allclose(y, x + 1) + + """ + if not isinstance( + op, (str, torch._ops.OpOverload, torch._library.custom_ops.CustomOpDef) + ): + raise ValueError( + f"register_torch_dispatch({op}): got unexpected type for op: {type(op)}" + ) + if isinstance(op, torch._ops.OpOverload): + op = op._name + opdef = _maybe_get_opdef(op) + if opdef is not None: + return opdef.register_torch_dispatch(torch_dispatch_class, func) + assert isinstance(op, str) + + def register(func): + namespace, op_name = torch._library.utils.parse_namespace(op) + if lib is None: + use_lib = Library(namespace, "FRAGMENT") + _keep_alive.append(use_lib) + else: + use_lib = lib + use_lib._register_torch_dispatch_rule(op_name, torch_dispatch_class, func) + return func + + if func is None: + return register + else: + return register(func) + + +def register_vmap( + op: _op_identifier, + func: Callable | None = None, + /, + *, + lib=None, +): + r"""Register a vmap implementation to support :func:`torch.vmap` for this custom op. + + This API may be used as a decorator (see examples). + + In order for an operator to work with :func:`torch.vmap`, you may need to register a + vmap implementation in the following signature: + + ``vmap_func(info, in_dims: Tuple[Optional[int]], *args, **kwargs)``, + + where ``*args`` and ``**kwargs`` are the arguments and kwargs for ``op``. + We do not support kwarg-only Tensor args. + + It specifies how do we compute the batched version of ``op`` given inputs with an additional + dimension (specified by ``in_dims``). + + For each arg in ``args``, ``in_dims`` has a corresponding ``Optional[int]``. It is ``None`` + if the arg is not a Tensor or if the arg is not being vmapped over, otherwise, it is an integer + specifying what dimension of the Tensor is being vmapped over. + + ``info`` is a collection of additional metadata that may be helpful: + ``info.batch_size`` specifies the size of the dimension being vmapped over, while + ``info.randomness`` is the ``randomness`` option that was passed to :func:`torch.vmap`. + + The return of the function ``func`` is a tuple of ``(output, out_dims)``. Similar to ``in_dims``, + ``out_dims`` should be of the same structure as ``output`` and contain one ``out_dim`` + per output that specifies if the output has the vmapped dimension and what index it is in. + + Examples: + >>> import torch + >>> import numpy as np + >>> from torch import Tensor + >>> from typing import Tuple + >>> + >>> def to_numpy(tensor): + >>> return tensor.cpu().numpy() + >>> + >>> lib = torch.library.Library("mylib", "FRAGMENT") + >>> @torch.library.custom_op("mylib::numpy_cube", mutates_args=()) + >>> def numpy_cube(x: Tensor) -> Tuple[Tensor, Tensor]: + >>> x_np = to_numpy(x) + >>> dx = torch.tensor(3 * x_np ** 2, device=x.device) + >>> return torch.tensor(x_np ** 3, device=x.device), dx + >>> + >>> def numpy_cube_vmap(info, in_dims, x): + >>> result = numpy_cube(x) + >>> return result, (in_dims[0], in_dims[0]) + >>> + >>> torch.library.register_vmap(numpy_cube, numpy_cube_vmap) + >>> + >>> x = torch.randn(3) + >>> torch.vmap(numpy_cube)(x) + >>> + >>> @torch.library.custom_op("mylib::numpy_mul", mutates_args=()) + >>> def numpy_mul(x: Tensor, y: Tensor) -> Tensor: + >>> return torch.tensor(to_numpy(x) * to_numpy(y), device=x.device) + >>> + >>> @torch.library.register_vmap("mylib::numpy_mul") + >>> def numpy_mul_vmap(info, in_dims, x, y): + >>> x_bdim, y_bdim = in_dims + >>> x = x.movedim(x_bdim, -1) if x_bdim is not None else x.unsqueeze(-1) + >>> y = y.movedim(y_bdim, -1) if y_bdim is not None else y.unsqueeze(-1) + >>> result = x * y + >>> result = result.movedim(-1, 0) + >>> return result, 0 + >>> + >>> + >>> x = torch.randn(3) + >>> y = torch.randn(3) + >>> torch.vmap(numpy_mul)(x, y) + + .. note:: + The vmap function should aim to preserve the semantics of the entire custom operator. + That is, ``grad(vmap(op))`` should be replaceable with a ``grad(map(op))``. + + If your custom operator has any custom behavior in the backward pass, please + keep this in mind. + + """ + if not isinstance( + op, (str, torch._ops.OpOverload, torch._library.custom_ops.CustomOpDef) + ): + raise ValueError(f"register_vmap({op}): got unexpected type for op: {type(op)}") + if isinstance(op, torch._ops.OpOverload): + op = op._name + opdef = _maybe_get_opdef(op) + if opdef is not None: + return opdef.register_vmap(func) + assert isinstance(op, str) + qualname = op + op = torch._library.utils.lookup_op(qualname) + schema = op._schema + if _library.utils.has_kwarg_only_tensors(schema): + raise NotImplementedError( + f"register_vmap with kwarg-only Tensor args. In the original " + f"definition of the op, please make your tensors not kwarg-only. " + f"Got: {schema}" + ) + + def register(func): + nonlocal op, lib + + namespace, opname = torch._library.utils.parse_namespace(qualname) + if lib is None: + lib = Library(namespace, "FRAGMENT") + _keep_alive.append(lib) + + from torch._functorch.autograd_function import custom_function_call_vmap_helper + from torch._functorch.pyfunctorch import retrieve_current_functorch_interpreter + + def wrapped_func(keyset, *args, **kwargs): + interpreter = retrieve_current_functorch_interpreter() + return custom_function_call_vmap_helper( + interpreter, func, op, *args, **kwargs + ) + + lib.impl(opname, wrapped_func, "FuncTorchBatched", with_keyset=True) + + if func is None: + return register + else: + return register(func) + + +# If the op was defined in C++, then we want to make sure there was an +# m.set_python_module(module, ...) call and that the module is the +# same as the module that called torch.library.register_fake. +def _check_pystubs_once(func, qualname, actual_module_name): + checked = False + + def inner(*args, **kwargs): + nonlocal checked + if checked: + return func(*args, **kwargs) + + op = torch._library.utils.lookup_op(qualname) + if op._defined_in_python: + checked = True + return func(*args, **kwargs) + + maybe_pystub = torch._C._dispatch_pystub( + op._schema.name, op._schema.overload_name + ) + if maybe_pystub is None: + if torch._library.utils.requires_set_python_module(): + namespace = op.namespace + cpp_filename = op._handle.debug() + raise RuntimeError( + f"Operator '{qualname}' was defined in C++ and has a Python " + f"fake impl. In this situation, we require there to also be a " + f'companion C++ `m.set_python_module("{actual_module_name}")` ' + f"call, but we could not find one. Please add that to " + f"to the top of the C++ TORCH_LIBRARY({namespace}, ...) block the " + f"operator was registered in ({cpp_filename})" + ) + else: + pystub_module = maybe_pystub[0] + if actual_module_name != pystub_module: + cpp_filename = op._handle.debug() + raise RuntimeError( + f"Operator '{qualname}' specified that its python fake impl " + f"is in the Python module '{pystub_module}' but it was actually found " + f"in '{actual_module_name}'. Please either move the fake impl " + f"or correct the m.set_python_module call ({cpp_filename})" + ) + checked = True + return func(*args, **kwargs) + + return inner + + +# NOTE [ctx inside the fake implementation] +# If a user has an operator with data-dependent output shape, then when writing +# a fake implementation they must query the current ctx and use methods on the +# ctx to construct a new unbacked symint. +# +# This is done via us setting the global_ctx_getter function every time a fake +# implementation is invoked. +def get_ctx() -> "torch._library.fake_impl.FakeImplCtx": + """get_ctx() returns the current AbstractImplCtx object. + + Calling ``get_ctx()`` is only valid inside of an fake impl + (see :func:`torch.library.register_fake` for more usage details. + """ + return torch._library.fake_impl.global_ctx_getter() + + +def get_kernel( + op: _op_identifier, dispatch_key: str | torch.DispatchKey +) -> torch._C._SafeKernelFunction: + """Returns the computed kernel for a given operator and dispatch key. + + This function retrieves the kernel that would be executed for a given + operator and dispatch key combination. The returned SafeKernelFunction + can be used to call the kernel in a boxed fashion. The intended use + case for this function is to retrieve the original kernel for a given + dispatch key and then register another kernel to the same dispatch key + that calls into the original kernel for certain cases. + + Args: + op: Operator name (along with the overload) or OpOverload object + Can be a string (e.g., "aten::add.Tensor"), an OpOverload, or a CustomOpDef. + dispatch_key (str | torch.DispatchKey): The dispatch key to get the kernel for. + Can be a string (e.g., "CPU", "CUDA") or a DispatchKey enum value. + + Returns: + torch._C._SafeKernelFunction: A safe kernel function that can be used to + call the kernel. + + Raises: + RuntimeError: If the operator does not exist. + + Example: + >>> # Get the CPU kernel for torch.add + >>> kernel = torch.library.get_kernel("aten::add.Tensor", "CPU") + >>> + >>> # You can also use DispatchKey enum + >>> kernel = torch.library.get_kernel("aten::add.Tensor", torch.DispatchKey.CPU) + >>> + >>> # Or use an OpOverload directly + >>> kernel = torch.library.get_kernel(torch.ops.aten.add.Tensor, "CPU") + >>> + >>> # Example: Using get_kernel in a custom op with conditional dispatch + >>> # Get the original kernel for torch.sin + >>> original_sin_kernel = torch.library.get_kernel("aten::sin", "CPU") + >>> + >>> # If input has negative values, use original sin, otherwise return zeros + >>> def conditional_sin_impl(dispatch_keys, x): + >>> if (x < 0).any(): + >>> return original_sin_kernel.call_boxed(dispatch_keys, x) + >>> else: + >>> return torch.zeros_like(x) + >>> + >>> lib = torch.library.Library("aten", "IMPL") + >>> # with_keyset=True so the first argument to the impl is the current DispatchKeySet + >>> which needs to be the first argument to ``kernel.call_boxed`` + >>> lib.impl("sin", conditional_sin_impl, "CPU", with_keyset=True) + >>> + >>> # Test the conditional behavior + >>> x_positive = torch.tensor([1.0, 2.0]) + >>> x_mixed = torch.tensor([-1.0, 2.0]) + >>> torch.sin(x_positive) + tensor([0., 0.]) + >>> torch.sin(x_mixed) + tensor([-0.8415, 0.9093]) + """ + if not isinstance(op, (str, torch._ops.OpOverload)): + raise ValueError(f"get_kernel({op}): got unexpected type for op: {type(op)}") + + if isinstance(op, torch._ops.OpOverload): + op = op._name + + if isinstance(dispatch_key, str): + try: + dispatch_key = torch._C.DispatchKey.__members__[dispatch_key] + except KeyError: + raise ValueError(f"Invalid dispatch key: {dispatch_key}") from None + + return torch._C._dispatch_get_computed_kernel_for_dispatch_key(op, dispatch_key) + + +_OPCHECK_DEFAULT_UTILS = ( + "test_schema", + "test_autograd_registration", + "test_faketensor", + "test_aot_dispatch_dynamic", +) + + +def opcheck( + op: torch._ops.OpOverload | torch._ops.OpOverloadPacket | CustomOpDef, + args: tuple[Any, ...], + kwargs: dict[str, Any] | None = None, + *, + test_utils: str | Sequence[str] = _OPCHECK_DEFAULT_UTILS, + raise_exception: bool = True, + atol=None, + rtol=None, +) -> dict[str, str]: + """Given an operator and some sample arguments, tests if the operator is + registered correctly. + + That is, when you use the torch.library/TORCH_LIBRARY APIs to create a + custom op, you specified metadata (e.g. mutability info) about the custom op + and these APIs require that the functions you pass them satisfy certain + properties (e.g. no data pointer access in the fake/meta/abstract kernel) + ``opcheck`` tests these metadata and properties. + + Concretely, we test the following: + + - test_schema: If the schema matches the implementation of + the operator. For example: if the schema specifies a Tensor is mutated, + then we check the implementation mutates the Tensor. If the schema + specifies that we return a new Tensor, then we check that the + implementation returns a new Tensor (instead of an existing one or + a view of an existing one). + - test_autograd_registration: If the operator supports training + (autograd): we check that its autograd formula is registered via + torch.library.register_autograd or a manual registration to one + or more DispatchKey::Autograd keys. Any other DispatchKey-based + registrations may lead to undefined behavior. + - test_faketensor: If the operator has a FakeTensor kernel + (and if it is correct). The FakeTensor kernel is necessary ( + but not sufficient) for the operator to work with PyTorch compilation + APIs (torch.compile/export/FX). We check that a FakeTensor kernel + (also sometimes known as a meta kernel) was registered for the + operator and that it is correct. This test takes the result of + running the operator on real tensors and the result of running + the operator on FakeTensors and checks that they have the same + Tensor metadata (sizes/strides/dtype/device/etc). + - test_aot_dispatch_dynamic: If the operator has correct behavior + with PyTorch compilation APIs (torch.compile/export/FX). + This checks that the outputs (and gradients, if applicable) are the + same under eager-mode PyTorch and torch.compile. + This test is a superset of ``test_faketensor`` and is an e2e test; + other things it tests are that the operator supports + functionalization and that the backward pass (if it exists) also + supports FakeTensor and functionalization. + + For best results, please call ``opcheck`` multiple times with a + representative set of inputs. If your operator supports + autograd, please use ``opcheck`` with inputs with ``requires_grad = True``; + if your operator supports multiple devices (e.g. CPU and CUDA), please + use ``opcheck`` with inputs on all supported devices. + + Args: + op: The operator. Must either be a function decorated with + :func:`torch.library.custom_op` or an OpOverload/OpOverloadPacket + found in torch.ops.* (e.g. torch.ops.aten.sin, torch.ops.mylib.foo) + args: The args to the operator + kwargs: The kwargs to the operator + test_utils: Tests that we should run. Default: all of them. + Example: ("test_schema", "test_faketensor") + raise_exception: If we should raise an exception on the first + error. If False, we will return a dict with information + on if each test passed or not. + rtol (Optional[float]): Relative tolerance for floating point comparisons. + If specified ``atol`` must also be specified. + If omitted, default values based on the ``dtype`` are selected + (see the table in :func:`torch.testing.assert_close`). + atol (Optional[float]): Absolute tolerance for floating point comparisons. + If specified ``rtol`` must also be specified. + If omitted, default values based on the ``dtype`` are selected + (see the table in :func:`torch.testing.assert_close`). + + .. warning:: + + opcheck and :func:`torch.autograd.gradcheck` test different things; + opcheck tests if your usage of torch.library APIs is correct while + :func:`torch.autograd.gradcheck` tests if your autograd formula is + mathematically correct. Use both to test custom ops that support + gradient computation. + + Example: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA) + >>> @torch.library.custom_op("mylib::numpy_mul", mutates_args=()) + >>> def numpy_mul(x: Tensor, y: float) -> Tensor: + >>> x_np = x.numpy(force=True) + >>> z_np = x_np * y + >>> return torch.from_numpy(z_np).to(x.device) + >>> + >>> @numpy_mul.register_fake + >>> def _(x, y): + >>> return torch.empty_like(x) + >>> + >>> def setup_context(ctx, inputs, output): + >>> y, = inputs + >>> ctx.y = y + >>> + >>> def backward(ctx, grad): + >>> return grad * ctx.y, None + >>> + >>> numpy_mul.register_autograd(backward, setup_context=setup_context) + >>> + >>> sample_inputs = [ + >>> (torch.randn(3), 3.14), + >>> (torch.randn(2, 3, device='cuda'), 2.718), + >>> (torch.randn(1, 10, requires_grad=True), 1.234), + >>> (torch.randn(64, 64, device='cuda', requires_grad=True), 90.18), + >>> ] + >>> + >>> for args in sample_inputs: + >>> torch.library.opcheck(numpy_mul, args) + + """ + import torch.testing._internal.optests as optests + + return optests.opcheck( + op, + args, + kwargs, + test_utils=test_utils, + raise_exception=raise_exception, + rtol=rtol, + atol=atol, + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/overrides.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/overrides.py new file mode 100644 index 0000000000000000000000000000000000000000..b96d93742b53d1511aca8826d4f13257c1a8ce90 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/overrides.py @@ -0,0 +1,2134 @@ +""" +Python implementation of ``__torch_function__`` + +While most of the torch API and handling for ``__torch_function__`` happens +at the C++ level, some of the torch API is written in Python so we need +python-level handling for ``__torch_function__`` overrides as well. The main +developer-facing functionality in this file are handle_torch_function and +has_torch_function. See torch/functional.py and test/test_overrides.py +for usage examples. + +Note +---- +heavily inspired by NumPy's ``__array_function__`` (see: +https://github.com/pytorch/pytorch/issues/24015 and +https://www.numpy.org/neps/nep-0018-array-function-protocol.html +) + +If changing this file in a way that can affect ``__torch_function__`` overhead, +please report the benchmarks in ``benchmarks/overrides_benchmark``. See the +instructions in the ``README.md`` in that directory. +""" + +import __future__ # noqa: F404 + +import collections +import contextlib +import functools +import sys +import types +import warnings +from collections.abc import Callable, Iterable +from functools import wraps +from typing import Any, TypeVar +from typing_extensions import ParamSpec + +import torch +from torch._C import ( + _add_docstr, + _get_function_stack_at, + _has_torch_function, + _has_torch_function_unary, + _has_torch_function_variadic, + _is_torch_function_mode_enabled, + _len_torch_function_stack, + _pop_torch_function_stack, + _push_on_torch_function_stack, +) + + +__all__ = [ + "get_ignored_functions", + "get_overridable_functions", + "get_testing_overrides", + "handle_torch_function", + "has_torch_function", + "resolve_name", + "is_tensor_like", + "is_tensor_method_or_property", + "wrap_torch_function", + "enable_reentrant_dispatch", +] + +_P = ParamSpec("_P") +_R = TypeVar("_R") + + +def _disable_user_warnings( + func: Callable[_P, _R], + regex: str = ".*is deprecated, please use.*", + module: str = "torch", +) -> Callable[_P, _R]: + """ + Decorator that temporarily disables ``UserWarning``s for the given ``module`` if the warning message matches the + given ``regex`` pattern. + + Arguments + --------- + func : function + Function to disable the warnings for. + regex : str + A regex pattern compilable by ``re.compile``. This is used to match the ``UserWarning`` message. + module : str + The python module to which the filtering should be restricted. + + Returns + ------- + function + The wrapped function. + """ + + @wraps(func) + def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _R: + with warnings.catch_warnings(): + warnings.filterwarnings( + "ignore", category=UserWarning, message=regex, module=module + ) + return func(*args, **kwargs) + + return wrapper + + +@functools.cache +@_disable_user_warnings +def get_ignored_functions() -> set[Callable]: + """ + Return public functions that cannot be overridden by ``__torch_function__``. + + Returns + ------- + set[Callable] + A tuple of functions that are publicly available in the torch API but cannot + be overridden with ``__torch_function__``. Mostly this is because none of the + arguments of these functions are tensors or tensor-likes. + + Examples + -------- + >>> torch.Tensor.as_subclass in torch.overrides.get_ignored_functions() + True + >>> torch.add in torch.overrides.get_ignored_functions() + False + """ + Tensor = torch.Tensor + functions = { + torch.typename, + torch.is_tensor, + torch.is_storage, + torch.set_default_tensor_type, + torch.set_default_device, + torch.get_default_device, + torch.set_rng_state, + torch.get_rng_state, + torch.manual_seed, + torch.initial_seed, + torch.seed, + torch.save, + torch.load, + torch.set_printoptions, + torch.fork, + torch.get_default_dtype, + torch.get_num_interop_threads, + torch.get_num_threads, + torch.init_num_threads, + torch.import_ir_module, + torch.import_ir_module_from_buffer, + torch.is_anomaly_enabled, + torch.is_anomaly_check_nan_enabled, + torch.is_grad_enabled, + torch.merge_type_from_type_comment, + torch.parse_ir, + torch.parse_schema, + torch.parse_type_comment, + torch.set_anomaly_enabled, + torch.set_flush_denormal, + torch.set_num_interop_threads, + torch.set_num_threads, + torch.wait, + torch.as_tensor, + torch.from_numpy, + torch.tensor, + torch.default_generator, + torch.has_cuda, + torch.has_cudnn, + torch.has_lapack, + torch.device, + torch.dtype, + torch.finfo, + torch.has_mkl, + torch.has_mps, + torch.has_mkldnn, + torch.has_openmp, + torch.iinfo, + torch.memory_format, + torch.qscheme, + torch.set_grad_enabled, + torch.no_grad, + torch.enable_grad, + torch.inference_mode, + torch.is_inference_mode_enabled, + torch.layout, + torch.align_tensors, + torch.arange, + torch.as_strided, + torch.bartlett_window, + torch.blackman_window, + torch.broadcast_shapes, + torch.can_cast, + torch.compile, + torch.cudnn_affine_grid_generator, + torch.cudnn_batch_norm, + torch.cudnn_convolution, + torch.cudnn_convolution_transpose, + torch.cudnn_convolution_relu, + torch.cudnn_convolution_add_relu, + torch.cudnn_grid_sampler, + torch.cudnn_is_acceptable, + torch.empty, + torch.empty_permuted, + torch.empty_strided, + torch.empty_quantized, + torch.export.export, + torch.export.load, + torch.export.register_dataclass, + torch.export.save, + torch.eye, + torch.fft.fftfreq, + torch.fft.rfftfreq, + torch.from_file, + torch.full, + torch.fill, + torch.hamming_window, + torch.hann_window, + torch.kaiser_window, + torch.linspace, + torch.logspace, + torch.mkldnn_adaptive_avg_pool2d, + torch.mkldnn_convolution, + torch.mkldnn_max_pool2d, + torch.mkldnn_max_pool3d, + torch.mkldnn_linear_backward_weights, + torch.mkldnn_rnn_layer, + torch.normal, + torch.ones, + torch.promote_types, + torch.rand, + torch.rand_like, + torch.randn, + torch.randn_like, + torch.randint, + torch.randint_like, + torch.randperm, + torch.range, + torch.result_type, + torch.scalar_tensor, + torch.sparse_coo_tensor, + torch.sparse_compressed_tensor, + torch.sparse_csr_tensor, + torch.sparse_csc_tensor, + torch.sparse_bsr_tensor, + torch.sparse_bsc_tensor, + torch.sym_constrain_range, + torch.sym_constrain_range_for_size, + torch.sym_fresh_size, + torch.tril_indices, + torch.triu_indices, + torch.vander, + torch.zeros, + torch._jit_internal.boolean_dispatch, + torch.nn.functional.assert_int_or_pair, + torch.nn.functional.upsample, + torch.nn.functional.upsample_bilinear, + torch.nn.functional.upsample_nearest, + torch.nn.functional.has_torch_function, + torch.nn.functional.has_torch_function_unary, + torch.nn.functional.has_torch_function_variadic, + torch.nn.functional.handle_torch_function, + torch.nn.functional.grouped_mm, + torch.nn.functional.scaled_grouped_mm, + torch.nn.functional.scaled_mm, + torch.nn.functional.sigmoid, + torch.nn.functional.hardsigmoid, + torch.nn.functional.tanh, + torch.nn.functional._canonical_mask, + torch.nn.functional._none_or_dtype, + # Doesn't actually take or return tensor arguments + torch.nn.init.calculate_gain, + # These are deprecated; don't test them + torch.nn.init.uniform, + torch.nn.init.normal, + torch.nn.init.constant, + torch.nn.init.eye, + torch.nn.init.dirac, + torch.nn.init.xavier_uniform, + torch.nn.init.xavier_normal, + torch.nn.init.kaiming_uniform, + torch.nn.init.kaiming_normal, + torch.nn.init.orthogonal, + torch.nn.init.sparse, + torch.nested.to_padded_tensor, + has_torch_function, + handle_torch_function, + torch.set_autocast_enabled, + torch.is_autocast_enabled, + torch.set_autocast_dtype, + torch.get_autocast_dtype, + torch.clear_autocast_cache, + torch.set_autocast_cpu_enabled, + torch.is_autocast_cpu_enabled, + torch.set_autocast_xla_enabled, + torch.is_autocast_xla_enabled, + torch.set_autocast_ipu_enabled, + torch.is_autocast_ipu_enabled, + torch.set_autocast_cpu_dtype, + torch.get_autocast_cpu_dtype, + torch.set_autocast_ipu_dtype, + torch.get_autocast_ipu_dtype, + torch.get_autocast_gpu_dtype, + torch.set_autocast_gpu_dtype, + torch.get_autocast_xla_dtype, + torch.set_autocast_xla_dtype, + torch.autocast_increment_nesting, + torch.autocast_decrement_nesting, + torch.is_autocast_cache_enabled, + torch.set_autocast_cache_enabled, + torch.nn.functional.hardswish, + torch.is_vulkan_available, + torch.are_deterministic_algorithms_enabled, + torch.use_deterministic_algorithms, + torch.is_deterministic_algorithms_warn_only_enabled, + torch.set_deterministic_debug_mode, + torch.get_device_module, + torch.get_deterministic_debug_mode, + torch.set_float32_matmul_precision, + torch.get_float32_matmul_precision, + torch.unify_type_list, + torch.is_warn_always_enabled, + torch.set_warn_always, + torch.vitals_enabled, + torch.set_vital, + torch.read_vitals, + torch.vmap, + torch.cond, + torch.frombuffer, + torch.asarray, + torch._functional_sym_constrain_range, + torch._make_dep_token, + Tensor.__delitem__, + Tensor.__dir__, + Tensor.__getattribute__, + Tensor.__init__, + Tensor.__iter__, + Tensor.__init_subclass__, + Tensor.__delattr__, + Tensor.__setattr__, + Tensor.__torch_function__, + Tensor.__torch_dispatch__, + Tensor.__new__, + Tensor.__class__, + Tensor.__subclasshook__, + Tensor.__hash__, + Tensor.as_subclass, + Tensor.eig, + Tensor.lstsq, + Tensor.reinforce, + Tensor.new, + Tensor.new_tensor, + Tensor.new_empty, + Tensor.new_empty_strided, + Tensor.new_zeros, + Tensor.new_ones, + Tensor.new_full, + Tensor._make_subclass, + Tensor.solve, + Tensor.symeig, + Tensor.stride, + Tensor.unflatten, + Tensor.to_sparse_coo, + Tensor.to_sparse_csr, + Tensor.to_sparse_csc, + Tensor.to_sparse_bsr, + Tensor.to_sparse_bsc, + Tensor._to_sparse, + Tensor._to_sparse_csr, + Tensor._to_sparse_csc, + Tensor._to_sparse_bsr, + Tensor._to_sparse_bsc, + Tensor._typed_storage, + Tensor._reduce_ex_internal, + Tensor._fix_weakref, + Tensor._view_func, + Tensor._view_func_unsafe, + Tensor._rev_view_func_unsafe, + Tensor._dtensor__new__, + Tensor._make_wrapper_subclass, + Tensor._python_dispatch.__get__, + Tensor._has_symbolic_sizes_strides.__get__, + Tensor._conj, + Tensor._conj_physical, + Tensor._lazy_clone, + Tensor._neg_view, + Tensor._is_zerotensor, + Tensor._is_all_true, + Tensor._is_any_true, + Tensor._addmm_activation, + Tensor.to_padded_tensor, + Tensor._use_count, + } + + if sys.version_info >= (3, 14): + functions.add(Tensor.__annotate__) + + return functions + + +@functools.cache +def get_default_nowrap_functions() -> set[Callable]: + """ + Return public functions that do not wrap in a subclass when invoked by + the default ``Tensor.__torch_function__`` that preserves subclasses. Typically, + these functions represent field accesses (i.e., retrieving a Tensor that + is stored somewhere on the Tensor) as opposed to computation. Users of + these functions expect object identity to be preserved over multiple accesses + (e.g., ``a.grad is a.grad``) which cannot be upheld if we're wrapping on + the fly every time (furthermore, the tensor stored here might already be + the subclass, in which case wrapping really ought not to happen). + + Not ALL property accessors have this property; for example ``Tensor.T`` actually + just creates a new transposed tensor on the fly, and so we SHOULD interpose on + these calls (you need to check the implementation of the function to see if + this is the case or not). Additionally, if a property accessor doesn't return a Tensor, + it doesn't have to be on this list (though it is harmless if it is). + """ + Tensor = torch.Tensor + return { + Tensor._base.__get__, + Tensor.grad.__get__, + Tensor._grad.__get__, + } + + +@functools.cache +@_disable_user_warnings +def get_testing_overrides() -> dict[Callable, Callable]: + """Return a dict containing dummy overrides for all overridable functions + + Returns + ------- + Dict[Callable, Callable] + A dictionary that maps overridable functions in the PyTorch API to + lambda functions that have the same signature as the real function + and unconditionally return -1. These lambda functions are useful + for testing API coverage for a type that defines ``__torch_function__``. + + Examples + -------- + >>> import inspect + >>> my_add = torch.overrides.get_testing_overrides()[torch.add] + >>> inspect.signature(my_add) + + """ + # Every function in the PyTorchAPI that can be overridden needs an entry + # in this dict. + # + # Optimally we would use inspect to get the function signature and define + # the lambda function procedurally but that is blocked by generating + # function signatures for native kernels that can be consumed by inspect. + # See Issue #28233. + Tensor = torch.Tensor + ret: dict[Callable, Callable] = { + torch.abs: lambda input, out=None: -1, + torch.absolute: lambda input, out=None: -1, + torch.adaptive_avg_pool1d: lambda input, output_size: -1, + torch.adaptive_max_pool1d: lambda inputs, output_size: -1, + torch.acos: lambda input, out=None: -1, + torch.adjoint: lambda input: -1, + torch.arccos: lambda input, out=None: -1, + torch.acosh: lambda input, out=None: -1, + torch.arccosh: lambda input, out=None: -1, + torch.add: lambda input, other, out=None: -1, + torch.addbmm: lambda input, batch1, batch2, alpha=1, beta=1, out=None: -1, + torch.addcdiv: lambda input, tensor1, tensor2, value=1, out=None: -1, + torch.addcmul: lambda input, tensor1, tensor2, value=1, out=None: -1, + torch.addmm: lambda input, mat1, mat2, beta=1, alpha=1, out=None: -1, + torch.addmv: lambda input, mat, vec, beta=1, alpha=1, out=None: -1, + torch.addr: lambda input, vec1, vec2, beta=1, alpha=1, out=None: -1, + torch.affine_grid_generator: lambda theta, size, align_corners: -1, + torch.all: lambda input, dim=None: -1, + torch.allclose: lambda input, other, trol=1e-05, atol=1e-08, equal_nan=False: -1, + torch.alpha_dropout: lambda input, p, train, inplace=False: -1, + torch.amax: lambda input, dim=None: -1, + torch.amin: lambda input, dim=None: -1, + torch.aminmax: lambda input, dim=None, keepdim=False, out=None: -1, + torch.angle: lambda input, out=None: -1, + torch.any: lambda input, dim=None, keepdim=False, out=None: -1, + torch.argmax: lambda input: -1, + torch.argmin: lambda input: -1, + torch.argsort: lambda input, dim=None: -1, + torch.asin: lambda input, out=None: -1, + torch._assert_async: lambda input, msg: -1, + torch.arcsin: lambda input, out=None: -1, + torch.asinh: lambda input, out=None: -1, + torch.arcsinh: lambda input, out=None: -1, + torch.atan: lambda input, out=None: -1, + torch.arctan: lambda input, out=None: -1, + torch.atan2: lambda input, other, out=None: -1, + torch.arctan2: lambda input, other, out=None: -1, + torch.atanh: lambda input, out=None: -1, + torch.arctanh: lambda input, out=None: -1, + torch.atleast_1d: lambda *tensors: -1, + torch.atleast_2d: lambda *tensors: -1, + torch.atleast_3d: lambda *tensors: -1, + torch.avg_pool1d: lambda input, kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True: -1, + torch.baddbmm: lambda input, batch1, batch2, alpha=1, beta=1, out=None: -1, + torch.batch_norm: lambda input, weight, bias, running_mean, running_var, training, momentum, eps, cudnn_enabled: -1, + torch.batch_norm_backward_elemt: lambda grad_out, input, mean, invstd, weight, sum_dy, sum_dy_xmu, count_tensor: -1, + torch.batch_norm_backward_reduce: lambda grad_out, input, mean, invstd, weight, input_g, weight_g, bias_g: -1, + torch.batch_norm_elemt: lambda input, weight, bias, mean, invstd, eps: -1, + torch.batch_norm_gather_stats: lambda input, mean, invstd, running_mean, running_var, momentum, eps, count: -1, + torch.batch_norm_gather_stats_with_counts: lambda input, mean, invstd, running_mean, running_var, momentum, eps, count: -1, + torch.batch_norm_stats: lambda input, eps: -1, + torch.batch_norm_update_stats: lambda input, running_mean, running_var, momentum: -1, + torch.bernoulli: lambda input, generator=None, out=None: -1, + torch.bilinear: lambda input1, input2, weight, bias: -1, + torch.binary_cross_entropy_with_logits: ( + lambda input, target, weight=None, size_average=None, reduce=None, reduction="mean", pos_weight=None: -1 + ), + torch.bincount: lambda input, weights=None, minlength=0: -1, + torch.binomial: lambda count, prob, generator=None: -1, + torch.bitwise_and: lambda input, other, out=None: -1, + torch.bitwise_not: lambda input, out=None: -1, + torch.bitwise_or: lambda input, other, out=None: -1, + torch.bitwise_xor: lambda input, other, out=None: -1, + torch.bitwise_left_shift: lambda input, other, out=None: -1, + torch.bitwise_right_shift: lambda input, other, out=None: -1, + torch.block_diag: lambda *tensors: -1, + torch.bmm: lambda input, mat2, out_dtype=None, out=None: -1, + torch.broadcast_tensors: lambda *tensors: -1, + torch.broadcast_to: lambda self, size: -1, + torch.bucketize: lambda input, boundaries, out_int32=False, right=False, out=None: -1, + torch.cartesian_prod: lambda *tensors: -1, + torch.cat: lambda tensors, dim=0, out=None: -1, + torch.concat: lambda tensors, dim=0, out=None: -1, # alias for torch.cat + torch.concatenate: lambda tensors, dim=0, out=None: -1, # alias for torch.concatenate + torch.cdist: lambda x1, x2, p=2.0, compute_mode="use_mm_for_euclid_dist_if_necessary": -1, + torch.ceil: lambda input, out=None: -1, + torch.celu: lambda input, alpha=1.0, inplace=False: -1, + torch.chain_matmul: lambda *matrices, out=None: -1, + torch.channel_shuffle: lambda input, groups: -1, + torch.cholesky: lambda input, upper=False, out=None: -1, + torch.linalg.cholesky: lambda input, out=None: -1, + torch.linalg.cholesky_ex: lambda input, check_errors=False, out=None: -1, + torch.cholesky_inverse: lambda input, upper=False, out=None: -1, + torch.cholesky_solve: lambda input1, input2, upper=False, out=None: -1, + torch.choose_qparams_optimized: lambda input, numel, n_bins, ratio, bit_width: -1, + torch.chunk: lambda input, chunks, dim=0: -1, + torch.clamp: lambda input, min=None, max=None, out=None: -1, + torch.clip: lambda input, min=None, max=None, out=None: -1, + torch.clamp_min: lambda input, min, out=None: -1, + torch.clamp_max: lambda input, max, out=None: -1, + torch.column_stack: lambda tensors, out=None: -1, + torch.cov: lambda input, correction=1, fweights=None, aweights=None: -1, + torch.clone: lambda input: -1, + torch.combinations: lambda input, r=2, with_replacement=False: -1, + torch.complex: lambda real, imag: -1, + torch.copysign: lambda input, other, out=None: -1, + torch.polar: lambda abs, ang: -1, + torch.linalg.cond: lambda input, ord=None: -1, + torch.conj: lambda input, out=None: -1, + torch.conj_physical: lambda input, out=None: -1, + torch.resolve_conj: lambda input, out=None: -1, + torch.resolve_neg: lambda input, out=None: -1, + torch.constant_pad_nd: lambda input, pad, value=0: -1, + torch.conv1d: lambda input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1: -1, + torch.conv2d: lambda input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1: -1, + torch.conv3d: lambda input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1: -1, + torch.convolution: lambda input, weight, bias, stride, padding, dilation, transposed, output_adding, groups: -1, + torch.conv_tbc: lambda input, weight, bias, pad=0: -1, + torch.conv_transpose1d: lambda input, weight, bias=None, stride=1, padding=0, output_padding=0, groups=1, dilation=1: -1, + torch.conv_transpose2d: lambda input, weight, bias=None, stride=1, padding=0, output_padding=0, groups=1, dilation=1: -1, + torch.conv_transpose3d: lambda input, weight, bias=None, stride=1, padding=0, output_padding=0, groups=1, dilation=1: -1, + torch.corrcoef: lambda input: -1, + torch.cos: lambda input, out=None: -1, + torch.cosine_embedding_loss: lambda input1, input2, target, margin=0, size_average=None, reduce=None, reduction="mean": -1, + torch.cosh: lambda input, out=None: -1, + torch.cosine_similarity: lambda x1, x2, dim=1, eps=1e-8: -1, + torch.count_nonzero: lambda input: -1, + torch.cross: lambda input, other, dim=None, out=None: -1, + torch.linalg.cross: lambda input, other, dim=-1, out=None: -1, + torch.ctc_loss: ( + lambda log_probs, targets, input_lengths, target_lengths, blank=0, reduction="mean", zero_infinity=False: -1 + ), + torch.cummax: lambda input, dim, out=None: -1, + torch.cummin: lambda input, dim, out=None: -1, + torch.cumprod: lambda input, dim, out=None, dtype=None: -1, + torch.cumsum: lambda input, dim, out=None, dtype=None: -1, + torch.cumulative_trapezoid: lambda y, x=None, dim=-1: -1, + torch.logcumsumexp: lambda input, dim, out=None: -1, + torch.deg2rad: lambda input, out=None: -1, + torch.dequantize: lambda input: -1, + torch.det: lambda input: -1, + torch.linalg.det: lambda input: -1, # alias for torch.det # type: ignore[attr-defined] + torch.detach: lambda input: -1, + torch.diag: lambda input, diagonal=0, out=None: -1, + torch.diag_embed: lambda input, diagonal=0, out=None: -1, + torch.diagflat: lambda input, offset=0: -1, + torch.diff: lambda input, n=1, dim=-1, prepend=None, append=None, out=None: -1, + torch.diagonal: lambda input, offset=0, dim1=0, dim2=1: -1, + torch.linalg.diagonal: lambda input, offset=0, dim1=-2, dim2=-1: -1, + torch.diagonal_scatter: lambda input, src, offset=0, dim1=0, dim2=1: -1, + torch.as_strided_scatter: lambda self, src, size, stride, storage_offset=None: -1, + torch.digamma: lambda input, out=None: -1, + torch.dist: lambda input, other, p=2: -1, + torch.div: lambda input, other, rounding_mode=None, out=None: -1, + torch.divide: lambda input, other, rounding_mode=None, out=None: -1, + torch.dot: lambda input, other, out=None: -1, + torch.dropout: lambda input, p, train, inplace=False: -1, + torch.dsmm: lambda input, mat2, out_dtype=None: -1, + torch.hsmm: lambda mat1, mat2: -1, + torch.dsplit: lambda input, indices_or_sections: -1, + torch.dstack: lambda tensors, out=None: -1, + torch.linalg.eig: lambda input, out=None: -1, + torch.linalg.eigvals: lambda input, out=None: -1, + torch.linalg.eigh: lambda input, UPLO="L", out=None: -1, + torch.linalg.eigvalsh: lambda input, UPLO="L", out=None: -1, + torch.einsum: lambda equation, *operands: -1, + torch.embedding: ( + lambda input, weight, padding_idx=None, max_norm=None, norm_type=2.0, scale_grad_by_freq=False, sparse=False: -1 # noqa: B950 + ), + torch.embedding_bag: ( + lambda input, weight, offsets, max_norm=None, norm_type=2, scale_grad_by_freq=False, mode="mean", sparse=False, per_sample_weights=None, padding_idx=None: -1 # noqa: B950 + ), + torch.empty_like: lambda input, dtype=None, layout=None, device=None, requires_grad=False: -1, + torch.eq: lambda input, other, out=None: -1, + torch.equal: lambda input, other: -1, + torch.erf: lambda input, out=None: -1, + torch.erfc: lambda input, out=None: -1, + torch.erfinv: lambda input, out=None: -1, + torch.exp: lambda input, out=None: -1, + torch.exp2: lambda input, out=None: -1, + torch.expm1: lambda input, out=None: -1, + torch.fake_quantize_per_channel_affine: lambda input, scale, zero_point, axis, quant_min, quant_max: -1, + torch.fake_quantize_per_tensor_affine: lambda input, scale, zero_point, quant_min, quant_max: -1, + torch.fused_moving_avg_obs_fake_quant: ( + lambda x, observer_on, fake_quant_on, averaging_const, running_min, running_max, scale, zero_point, quant_min, quant_max, ch_axis, per_row_fake_quant=False, symmetric_quant=False: -1 # noqa: B950 + ), + torch.fbgemm_linear_fp16_weight: lambda input, packed_weight, bias, output: -1, + torch.fbgemm_linear_fp16_weight_fp32_activation: lambda input, packed_weight, bias, output: -1, + torch.fbgemm_linear_int8_weight: lambda input, weight, packed, col_offsets, weight_scale, weight_zero_point, bias: -1, # noqa: B950 + torch.fbgemm_linear_int8_weight_fp32_activation: ( + lambda input, weight, packed, col_offsets, weight_scale, weight_zero_point, bias: -1 + ), + torch.fbgemm_linear_quantize_weight: lambda input: -1, + torch.fbgemm_pack_gemm_matrix_fp16: lambda input: -1, + torch.fbgemm_pack_quantized_matrix: lambda input, a, b: -1, + torch.feature_alpha_dropout: lambda input, p, train: -1, + torch.feature_dropout: lambda input, p, train: -1, + torch.fft.ifft: lambda input, n=None, dim=-1, norm=None: -1, + torch.fft.rfft: lambda input, n=None, dim=-1, norm=None: -1, + torch.fft.irfft: lambda input, n=None, dim=-1, norm=None: -1, + torch.fft.hfft: lambda input, n=None, dim=-1, norm=None: -1, + torch.fft.ihfft: lambda input, n=None, dim=-1, norm=None: -1, + torch.fft.hfft2: lambda input, s=None, dim=(-2, -1), norm=None: -1, + torch.fft.ihfft2: lambda input, s=None, dim=(-2, -1), norm=None: -1, + torch.fft.hfftn: lambda input, s=None, dim=-1, norm=None: -1, + torch.fft.ihfftn: lambda input, s=None, dim=-1, norm=None: -1, + torch.fft.fftn: lambda input, s=None, dim=None, norm=None: -1, + torch.fft.ifftn: lambda input, s=None, dim=None, norm=None: -1, + torch.fft.rfftn: lambda input, s=None, dim=None, norm=None: -1, + torch.fft.irfftn: lambda input, s=None, dim=None, norm=None: -1, + torch.fft.fft2: lambda input, s=None, dim=(-2, -1), norm=None: -1, + torch.fft.ifft2: lambda input, s=None, dim=(-2, -1), norm=None: -1, + torch.fft.rfft2: lambda input, s=None, dim=(-2, -1), norm=None: -1, + torch.fft.irfft2: lambda input, s=None, dim=(-2, -1), norm=None: -1, + torch.fft.fftshift: lambda input, dim=None: -1, + torch.fft.ifftshift: lambda input, dim=None: -1, + torch.fft.fft: lambda input, n=None, dim=-1, norm=None: -1, + torch.fix: lambda input, out=None: -1, + torch.flatten: lambda input, start_dim=0, end_dim=-1: -1, + torch.flip: lambda input, dims: -1, + torch.fliplr: lambda input: -1, + torch.flipud: lambda input: -1, + torch.frobenius_norm: lambda input, dim=None, keepdim=False, out=None: -1, + torch.floor: lambda input, out=None: -1, + torch.floor_divide: lambda input, other: -1, + torch.float_power: lambda input, exponent, out=None: -1, + torch.fmod: lambda input, other, out=None: -1, + torch.frac: lambda input, out=None: -1, + torch.frexp: lambda input, out=None: -1, + torch.full_like: lambda input, fill_value, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False: -1, # noqa: B950 + torch._functional_assert_async: lambda input, msg, dep_token: -1, + torch.lu_unpack: lambda LU_data, LU_pivots, unpack_data=True, unpack_pivots=True: -1, + torch.gather: lambda input, dim, index, out=None, sparse_grad=False: -1, + torch.gcd: lambda input, other, out=None: -1, + torch.ge: lambda input, other, out=None: -1, + torch.get_device: lambda input: -1, + torch.greater_equal: lambda input, other, out=None: -1, + torch.geqrf: lambda input, out=None: -1, + torch.i0: lambda input, out=None: -1, + torch.inner: lambda input, other, out=None: -1, + torch.outer: lambda input, vec2, out=None: -1, + torch.ger: lambda input, vec2, out=None: -1, # alias for torch.outer + torch.gradient: lambda input, spacing=None, dim=None, edge_order=1: -1, + torch.grid_sampler: lambda input, grid, interpolation_mode, padding_mode, align_corners: -1, + torch.grid_sampler_2d: lambda input, grid, interpolation_mode, padding_mode, align_corners: -1, + torch.grid_sampler_3d: lambda input, grid, interpolation_mode, padding_mode, align_corners: -1, + torch.group_norm: lambda input, num_groups, weight=None, bias=None, eps=1e-05, cudnn_enabled=True: -1, + torch.gru: lambda input, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first: -1, + torch.gru_cell: lambda input, hx, w_ih, w_hh, b_ih=None, b_hh=None: -1, + torch.gt: lambda input, other, out=None: -1, + torch.greater: lambda input, other, out=None: -1, + torch.hardshrink: lambda input, lambd=0.5: -1, + torch.hash_tensor: lambda input, dim=None, keepdim=False, mode=0, out=None: -1, + torch.heaviside: lambda input, values, out=None: -1, + torch.hinge_embedding_loss: lambda input, target, margin=1.0, size_average=None, reduce=None, reduction="mean": -1, # noqa: B950 + torch.histc: lambda input, bins=100, min=0, max=0, out=None: -1, + torch.histogram: lambda input, bins=100, min=None, max=None, weight=None, density=False, out=None: -1, + torch.histogramdd: lambda input, bins, range=None, weight=None, density=False: -1, + torch.linalg.householder_product: lambda input, tau: -1, + torch.hspmm: lambda mat1, mat2, out=None: -1, + torch.hsplit: lambda input, indices_or_sections: -1, + torch.hstack: lambda tensors, out=None: -1, + torch.hypot: lambda input, other, out=None: -1, + torch.igamma: lambda input, other, out=None: -1, + torch.igammac: lambda input, other, out=None: -1, + torch.imag: lambda input, out=None: -1, + torch.index_add: lambda input, dim, index, source: -1, + torch.index_copy: lambda input, dim, index, source: -1, + torch.index_put: lambda input, indices, values, accumulate=False: -1, + torch.index_select: lambda input, dim, index, out=None: -1, + torch.index_fill: lambda input, dim, index, value: -1, + torch.index_reduce: lambda input, dim, index, source, reduce, include_input=True: -1, + torch.isfinite: lambda tensor: -1, + torch.isin: lambda e, te, assume_unique=False, invert=False: -1, + torch.isinf: lambda tensor: -1, + torch.isreal: lambda tensor: -1, + torch.isposinf: lambda input, out=None: -1, + torch.isneginf: lambda input, out=None: -1, + torch.instance_norm: ( + lambda input, running_mean, running_var, weight, bias, use_input_stats, momentum, eps, cudnn_enabled: -1 + ), + torch.int_repr: lambda input: -1, + torch.inverse: lambda input, out=None: -1, + torch.linalg.inv: lambda input, out=None: -1, + torch.linalg.inv_ex: lambda input, check_errors=False, out=None: -1, + torch.is_complex: lambda input: -1, + torch.is_conj: lambda input: -1, + torch.is_neg: lambda input: -1, + torch.is_distributed: lambda input: -1, + torch.is_inference: lambda input: -1, + torch.is_floating_point: lambda input: -1, + torch.is_nonzero: lambda input: -1, + torch.is_same_size: lambda input, other: -1, + torch.is_signed: lambda input: -1, + torch.isclose: lambda input, other, rtol=1e-05, atol=1e-08, equal_nan=False: -1, + torch.isnan: lambda input: -1, + torch.istft: ( + lambda input, n_fft, hop_length=None, win_length=None, window=None, center=True, normalized=False, onesided=None, length=None, return_complex=False: -1 # noqa: B950 + ), + torch.kl_div: lambda input, target, size_average=None, reduce=None, reduction="mean", log_target=False: -1, + torch.kron: lambda input, other: -1, + torch.kthvalue: lambda input, k, dim=None, keepdim=False, out=None: -1, + torch.linalg.ldl_factor_ex: lambda input, hermitian=False, check_errors=False, out=None: -1, + torch.linalg.ldl_factor: lambda input, hermitian=False, out=None: -1, + torch.linalg.ldl_solve: lambda LD, pivots, B, hermitian=False, out=None: -1, + torch.layer_norm: lambda input, normalized_shape, weight=None, bias=None, esp=1e-05, cudnn_enabled=True: -1, + torch.lcm: lambda input, other, out=None: -1, + torch.ldexp: lambda input, other, out=None: -1, + torch.le: lambda input, other, out=None: -1, + torch.less_equal: lambda input, other, out=None: -1, + torch.lerp: lambda input, end, weight, out=None: -1, + torch.lgamma: lambda input, out=None: -1, + torch.lobpcg: lambda input, k=None, B=None, X=None, n=None, iK=None, niter=None, tol=None, largest=None, method=None, tracker=None, ortho_iparams=None, ortho_fparams=None, ortho_bparams=None: -1, # noqa: B950 + torch.log: lambda input, out=None: -1, + torch.log_softmax: lambda input, dim, dtype=None: -1, + torch.log10: lambda input, out=None: -1, + torch.log1p: lambda input, out=None: -1, + torch.log2: lambda input, out=None: -1, + torch.logaddexp: lambda input, other, out=None: -1, + torch.logaddexp2: lambda input, other, out=None: -1, + torch.logdet: lambda input: -1, + torch.xlogy: lambda x, y, out=None: -1, + torch.logical_and: lambda input, other, out=None: -1, + torch.logical_not: lambda input, out=None: -1, + torch.logical_or: lambda input, other, out=None: -1, + torch.logical_xor: lambda input, other, out=None: -1, + torch.logit: lambda input, eps=None: -1, + torch.logsumexp: lambda input, names, keepdim=False, out=None: -1, + torch.lstm: lambda data, batch_sizes, hx, params, has_biases, num_layers, dropout, train, bidirectional: -1, + torch.lstm_cell: lambda input, hx, w_ih, w_hh, b_ih=None, b_hh=None: -1, + torch.lt: lambda input, other, out=None: -1, + torch.less: lambda input, other, out=None: -1, + torch.lu: lambda A, pivot=True, get_infos=False, out=None: -1, + torch.lu_solve: lambda b, LU_data, LU_pivots, out=None: -1, + torch.margin_ranking_loss: lambda input1, input2, target, margin=0, size_average=None, reduce=None, reduction="mean": -1, # type: ignore[attr-defined] # noqa: B950 + torch.masked_fill: lambda input, mask, value: -1, + torch.masked_scatter: lambda input, mask, source: -1, + torch.masked_select: lambda input, mask, out=None: -1, + torch.matmul: lambda input, other, out=None: -1, + torch.linalg.lu: lambda input, pivot=True, out=None: -1, + torch.linalg.lu_factor: lambda input, pivot=True, out=None: -1, + torch.linalg.lu_factor_ex: lambda input, pivot=True, check_errors=False, out=None: -1, + torch.linalg.lu_solve: lambda LU, pivots, B, left=True, adjoint=False, out=None: -1, + torch.linalg.matmul: lambda input, other, out=None: -1, # alias for torch.matmul + torch.matrix_power: lambda input, n: -1, + torch.linalg.matrix_power: lambda input, n, out=None: -1, + torch.linalg.matrix_rank: lambda input, tol=None, hermitian=False: -1, + torch.linalg.multi_dot: lambda tensors, out=None: -1, + torch.matrix_exp: lambda input: -1, + torch.linalg.matrix_exp: lambda input: -1, + torch.max: lambda input, out=None: -1, + torch.maximum: lambda input, other, out=None: -1, + torch.fmax: lambda input, other, out=None: -1, + torch.max_pool1d: lambda input, kernel_size, stride=None, padding=0, dilation=1, ceil_mode=False: -1, + torch.max_pool2d: lambda input, kernel_size, stride=None, padding=0, dilation=1, ceil_mode=False: -1, + torch.max_pool3d: lambda input, kernel_size, stride=None, padding=0, dilation=1, ceil_mode=False: -1, + torch.max_pool1d_with_indices: ( + lambda input, kernel_size, stride=None, padding=0, dilation=1, return_indices=False, ceil_mode=False: -1 + ), + torch.mean: lambda input, dim=None: -1, + torch.nanmean: lambda input, dim=None, keepdim=False, dtype=None, out=None: -1, + torch.median: lambda input, dim=None: -1, + torch.nanmedian: lambda input, dim=None: -1, + torch.meshgrid: lambda *tensors, **kwargs: -1, + torch.min: lambda input, out=None: -1, + torch.minimum: lambda input, other, out=None: -1, + torch.fmin: lambda input, other, out=None: -1, + torch.miopen_batch_norm: ( + lambda input, weight, bias, running_mean, running_var, training, exponential_average_factor, epsilon: -1 + ), + torch.miopen_convolution: lambda input, weight, bias, padding, stride, dilation, groups, benchmark, deterministic: -1, # noqa: B950 + torch.miopen_convolution_add_relu: lambda input, weight, z, alpha, bias, stride, padding, dilation, groups: -1, + torch.miopen_convolution_relu: lambda input, weight, bias, stride, padding, dilation, groups: -1, + torch.miopen_convolution_transpose: ( + lambda input, weight, bias, padding, output_padding, stride, dilation, groups, benchmark, deterministic: -1 + ), + torch.miopen_depthwise_convolution: ( + lambda input, weight, bias, padding, stride, dilation, groups, benchmark, deterministic: -1 + ), + torch.miopen_rnn: ( + lambda input, weight, weight_stride0, hx, cx, mode, hidden_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state: -1 # noqa: B950 + ), + torch.mm: lambda input, mat2, out_dtype=None, out=None: -1, + torch.mode: lambda input, dim=-1, keepdim=False, out=None: -1, + torch.movedim: lambda input, source, destination: -1, + torch.moveaxis: lambda input, source, destination: -1, + torch.msort: lambda input, descending=False, out=None: -1, + torch.mul: lambda input, other, out=None: -1, + torch.multiply: lambda input, other, out=None: -1, + torch.multinomial: lambda input, num_samples, replacement=False, out=None: -1, + torch.mv: lambda input, vec, out=None: -1, + torch.mvlgamma: lambda input, p: -1, + torch.narrow: lambda input, dim, start, length: -1, + torch.nan_to_num: lambda input, nan=0.0, posinf=None, neginf=None, out=None: -1, + torch.native_batch_norm: lambda input, weight, bias, running_mean, running_var, training, momentum, eps: -1, + torch._native_batch_norm_legit: lambda input, weight, bias, training, momentum, eps: -1, + torch.native_dropout: lambda input, p, train: -1, + torch.native_layer_norm: lambda input, normalized_shape, weight=None, bias=None, eps=1e-05: -1, + torch._fused_rms_norm: lambda input, normalized_shape, weight=None, eps=1e-05: -1, + torch.native_group_norm: lambda input, weight, bias, N, C, HxW, group, eps: -1, + torch.native_norm: lambda input, p=2, dim=None, keepdim=False, dtype=None: -1, + torch.native_channel_shuffle: lambda input, groups: -1, + torch.ne: lambda input, other, out=None: -1, + torch.not_equal: lambda input, other, out=None: -1, + torch.neg: lambda input, out=None: -1, + torch.negative: lambda input, out=None: -1, + torch.nextafter: lambda input, other, out=None: -1, + torch.nn.functional.adaptive_avg_pool2d: lambda input, output_size: -1, + torch.nn.functional.adaptive_avg_pool3d: lambda input, output_size: -1, + torch.nn.functional.adaptive_max_pool1d: lambda input, output_size, return_indices=False: -1, + torch.nn.functional.adaptive_max_pool1d_with_indices: lambda input, output_size, return_indices=False: -1, + torch.nn.functional.adaptive_max_pool2d: lambda input, output_size, return_indices=False: -1, + torch.nn.functional.adaptive_max_pool2d_with_indices: lambda input, output_size, return_indices=False: -1, + torch.nn.functional.adaptive_max_pool3d: lambda input, output_size, return_indices=False: -1, + torch.nn.functional.adaptive_max_pool3d_with_indices: lambda input, output_size, return_indices=False: -1, + torch.nn.functional.affine_grid: lambda theta, size, align_corners=None: -1, + torch.nn.functional.alpha_dropout: lambda input, p=0.5, training=False, inplace=False: -1, + torch.nn.functional.avg_pool2d: ( + lambda input, kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True, divisor_override=None: -1 # noqa: B950 + ), + torch.nn.functional.avg_pool3d: ( + lambda input, kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True, divisor_override=None: -1 # noqa: B950 + ), + torch.nn.functional.batch_norm: ( + lambda input, running_mean, running_var, weight=None, bias=None, training=False, momentum=0.1, eps=1e-05: -1 + ), + torch.nn.functional.bilinear: lambda input1, input2, weight, bias=None: -1, + torch.nn.functional.binary_cross_entropy: ( + lambda input, target, weight=None, size_average=None, reduce=None, reduction="mean": -1 + ), + torch.nn.functional.binary_cross_entropy_with_logits: ( + lambda input, target, weight=None, size_average=None, reduce=None, reduction="mean", pos_weight=None: -1 + ), + torch.nn.functional.celu: lambda input, alpha=1.0, inplace=False: -1, + torch.nn.functional.cosine_embedding_loss: ( + lambda input1, input2, target, margin=0, size_average=None, reduce=None, reduction="mean": -1 + ), + torch.nn.functional.cross_entropy: ( + lambda input, target, weight=None, size_average=None, ignore_index=-100, reduce=None, reduction="mean", label_smoothing=0.0: -1 # noqa: B950 + ), + torch.nn.functional.ctc_loss: ( + lambda log_probs, targets, input_lengths, target_lengths, blank=0, reduction="mean", zero_infinity=False: -1 + ), + torch.nn.functional.dropout: lambda input, p=0.5, training=True, inplace=False: -1, + torch.nn.functional.dropout1d: lambda input, p=0.5, training=True, inplace=False: -1, + torch.nn.functional.dropout2d: lambda input, p=0.5, training=True, inplace=False: -1, + torch.nn.functional.dropout3d: lambda input, p=0.5, training=True, inplace=False: -1, + torch.nn.functional.elu: lambda input, alpha=1.0, inplace=False: -1, + torch.nn.functional.embedding: ( + lambda input, weight, padding_idx=None, max_norm=None, norm_type=2.0, scale_grad_by_freq=False, sparse=False: -1 # noqa: B950 + ), + torch.nn.functional.embedding_bag: ( + lambda input, weight, offsets=None, max_norm=None, norm_type=2, scale_grad_by_freq=False, mode="mean", sparse=False, per_sample_weights=None, include_last_offset=False, padding_idx=None: -1 # noqa: B950 + ), + torch.nn.functional.feature_alpha_dropout: lambda input, p=0.5, training=False, inplace=False: -1, + torch.nn.functional.fold: lambda input, output_size, kernel_size, dilation=1, padding=0, stride=1: -1, + torch.nn.functional.fractional_max_pool2d: ( + lambda input, kernel_size, output_size=None, output_ratio=None, return_indices=False, _random_samples=None: -1 # noqa: B950 + ), + torch.nn.functional.fractional_max_pool2d_with_indices: ( + lambda input, kernel_size, output_size=None, output_ratio=None, return_indices=False, _random_samples=None: -1 # noqa: B950 + ), + torch.nn.functional.fractional_max_pool3d: ( + lambda input, kernel_size, output_size=None, output_ratio=None, return_indices=False, _random_samples=None: -1 # noqa: B950 + ), + torch.nn.functional.fractional_max_pool3d_with_indices: ( + lambda input, kernel_size, output_size=None, output_ratio=None, return_indices=False, _random_samples=None: -1 # noqa: B950 + ), + torch.nn.functional.gaussian_nll_loss: lambda input, target, var, full=False, eps=1e-06, reduction="mean": -1, + torch.nn.functional.gelu: lambda input, approximate="none": -1, + torch.nn.functional.glu: lambda input, dim=-1: -1, + torch.nn.functional.grid_sample: lambda input, grid, mode="bilinear", padding_mode="zeros", align_corners=None: -1, # noqa: B950 + torch.nn.functional.group_norm: lambda input, num_groups, weight=None, bias=None, eps=1e-05: -1, + torch.nn.functional.gumbel_softmax: lambda logits, tau=1, hard=False, eps=1e-10, dim=-1: -1, + torch.nn.functional.hardshrink: lambda input, lambd=0.5: -1, + torch.nn.functional.hardtanh: lambda input, min_val=-1.0, max_val=1.0, inplace=False: -1, + torch.nn.functional.hinge_embedding_loss: ( + lambda input, target, margin=1.0, size_average=None, reduce=None, reduction="mean": -1 + ), + torch.nn.functional.instance_norm: ( + lambda input, running_mean=None, running_var=None, weight=None, bias=None, use_input_stats=True, momentum=0.1, eps=1e-05: -1 # noqa: B950 + ), + torch.nn.functional.interpolate: ( + lambda input, size=None, scale_factor=None, mode="nearest", align_corners=None, recompute_scale_factor=None, antialias=False: -1 # noqa: B950 + ), + torch.nn.functional.kl_div: lambda input, target, size_average=None, reduce=None, reduction="mean", log_target=False: -1, # noqa: B950 + torch.nn.functional.l1_loss: lambda input, target, size_average=None, reduce=None, reduction="mean", weight=None: -1, + torch.nn.functional.layer_norm: lambda input, normalized_shape, weight=None, bias=None, eps=1e-05: -1, + torch.nn.functional.leaky_relu: lambda input, negative_slope=0.01, inplace=False: -1, + torch.nn.functional.linear: lambda input, weight, bias=None: -1, + torch.nn.functional.local_response_norm: lambda input, size, alpha=0.0001, beta=0.75, k=1.0: -1, + torch.nn.functional.log_softmax: lambda input, dim=None, _stacklevel=3, dtype=None: -1, + torch.nn.functional.logsigmoid: lambda input: -1, + torch.nn.functional.lp_pool1d: lambda input, norm_type, kernel_size, stride=None, ceil_mode=False: -1, + torch.nn.functional.lp_pool2d: lambda input, norm_type, kernel_size, stride=None, ceil_mode=False: -1, + torch.nn.functional.lp_pool3d: lambda input, norm_type, kernel_size, stride=None, ceil_mode=False: -1, + torch.nn.functional.margin_ranking_loss: ( + lambda input1, input2, target, margin=0, size_average=None, reduce=None, reduction="mean": -1 + ), + torch.nn.functional.max_pool1d: ( + lambda input, kernel_size, stride=None, padding=0, dilation=1, ceil_mode=False, return_indices=False: -1 + ), + torch.nn.functional.max_pool1d_with_indices: ( + lambda input, kernel_size, stride=None, padding=0, dilation=1, return_indices=False, ceil_mode=False: -1 + ), + torch.nn.functional.max_pool2d: ( + lambda input, kernel_size, stride=None, padding=0, dilation=1, ceil_mode=False, return_indices=False: -1 + ), + torch.nn.functional.max_pool2d_with_indices: ( + lambda input, kernel_size, stride=None, padding=0, dilation=1, return_indices=False, ceil_mode=False: -1 + ), + torch.nn.functional.max_pool3d: ( + lambda input, kernel_size, stride=None, padding=0, dilation=1, return_indices=False, ceil_mode=False: -1 + ), + torch.nn.functional.max_pool3d_with_indices: ( + lambda input, kernel_size, stride=None, padding=0, dilation=1, return_indices=False, ceil_mode=False: -1 + ), + torch.nn.functional.max_unpool1d: lambda input, indices, kernel_size, stride=None, padding=0, output_size=None: -1, # noqa: B950 + torch.nn.functional.max_unpool2d: lambda input, indices, kernel_size, stride=None, padding=0, output_size=None: -1, # noqa: B950 + torch.nn.functional.max_unpool3d: lambda input, indices, kernel_size, stride=None, padding=0, output_size=None: -1, # noqa: B950 + torch.nn.functional.mse_loss: lambda input, target, size_average=None, reduce=None, reduction="mean", weight=None: -1, + torch.nn.functional.multi_head_attention_forward: ( + lambda query, key, value, embed_dim_to_check, num_heads, in_proj_weight, in_proj_bias, bias_k, bias_v, add_zero_attn, dropout_p, out_proj_weight, out_proj_bias, training=True, key_padding_mask=None, need_weights=True, attn_mask=None, use_separate_proj_weight=False, q_proj_weight=None, k_proj_weight=None, v_proj_weight=None, static_k=None, static_v=None, average_attn_weights=None, is_causal=False: -1 # noqa: B950 + ), + torch.nn.functional.multi_margin_loss: ( + lambda input, target, p=1, margin=1.0, weight=None, size_average=None, reduce=None, reduction="mean": -1 + ), + torch.nn.functional.multilabel_margin_loss: ( + lambda input, target, size_average=None, reduce=None, reduction="mean": -1 + ), + torch.nn.functional.multilabel_soft_margin_loss: ( + lambda input, target, weight=None, size_average=None, reduce=None, reduction="mean": -1 + ), + torch.nn.functional.nll_loss: ( + lambda input, target, weight=None, size_average=None, ignore_index=-100, reduce=None, reduction="mean": -1 + ), + torch.nn.functional.normalize: lambda input, p=2, dim=1, eps=1e-12, out=None: -1, + torch.nn.functional.one_hot: lambda tensor, num_classes=-1: -1, + torch.nn.functional.pad: lambda input, pad, mode="constant", value=0: -1, + torch.nn.functional.pairwise_distance: lambda x1, x2, p=2.0, eps=1e-06, keepdim=False: -1, + torch.nn.functional.poisson_nll_loss: ( + lambda input, target, log_input=True, full=False, size_average=None, eps=1e-08, reduce=None, reduction="mean": -1 # noqa: B950 + ), + torch.nn.functional.prelu: lambda input, weight: -1, + torch.nn.functional.relu: lambda input, inplace=False: -1, + torch.nn.functional.relu6: lambda input, inplace=False: -1, + torch.nn.functional.rms_norm: lambda input, normalized_shape, weight=None, eps=1e-6: -1, + torch.nn.functional.rrelu: lambda input, lower=0.125, upper=0.3333333333333333, training=False, inplace=False: -1, # noqa: B950 + torch.nn.functional.selu: lambda input, inplace=False: -1, + torch.nn.functional.silu: lambda input, inplace=False: -1, + torch.nn.functional.mish: lambda input, inplace=False: -1, + torch.nn.functional.scaled_dot_product_attention: lambda query, key, value, attn_mask=None, dropout_p=0.0: -1, + torch.nn.functional.smooth_l1_loss: lambda input, target, size_average=None, reduce=None, reduction="mean", beta=1.0: -1, # noqa: B950 + torch.nn.functional.huber_loss: lambda input, target, reduction="mean", delta=1.0, weight=None: -1, + torch.nn.functional.soft_margin_loss: lambda input, target, size_average=None, reduce=None, reduction="mean": -1, # noqa: B950 + torch.nn.functional.softmax: lambda input, dim=None, _stacklevel=3, dtype=None: -1, + torch.nn.functional.softmin: lambda input, dim=None, _stacklevel=3, dtype=None: -1, + torch.nn.functional.softplus: lambda input, beta=1, threshold=20: -1, + torch.nn.functional.softshrink: lambda input, lambd=0.5: -1, + torch.nn.functional.softsign: lambda input: -1, + torch.nn.functional.tanhshrink: lambda input: -1, + torch.nn.functional.threshold: lambda input, threshold, value, inplace=False: -1, + torch.nn.functional.triplet_margin_loss: ( + lambda anchor, positive, negative, margin=1.0, p=2, eps=1e-06, swap=False, size_average=None, reduce=None, reduction="mean": -1 # noqa: B950 + ), + torch.nn.functional.triplet_margin_with_distance_loss: ( + lambda anchor, positive, negative, *, distance_function=None, margin=1.0, swap=False, reduction="mean": -1 + ), + torch.nn.functional.unfold: lambda input, kernel_size, dilation=1, padding=0, stride=1: -1, + torch.nn.init.uniform_: lambda tensor, a=0.0, b=1.0, generator=None: -1, + torch.nn.init.normal_: lambda tensor, mean=0.0, std=1.0, generator=None: -1, + torch.nn.init.constant_: lambda tensor, val: -1, + torch.nn.init.kaiming_uniform_: lambda tensor, a=0, mode="fan_in", nonlinearity="leaky_relu", generator=None: -1, # noqa: B950 + torch.nonzero: lambda input, as_tuple=False: -1, + torch.nonzero_static: lambda input, *, size, fill_value=-1: -1, + torch.argwhere: lambda input: -1, + torch.norm: lambda input, p="fro", dim=None, keepdim=False, out=None, dtype=None: -1, + torch.linalg.norm: lambda input, ord=None, dim=None, keepdim=False, out=None, dtype=None: -1, + torch.linalg.vector_norm: lambda input, ord=2, dim=None, keepdim=False, out=None, dtype=None: -1, + torch.linalg.matrix_norm: lambda input, ord="fro", dim=( + -2, + -1, + ), keepdim=False, out=None, dtype=None: -1, + torch.norm_except_dim: lambda v, pow=2, dim=0: -1, + torch.nuclear_norm: lambda input, p="fro", dim=None, keepdim=False, out=None, dtype=None: -1, + torch.numel: lambda input: -1, + torch.orgqr: lambda input, tau: -1, + torch.ormqr: lambda input, input2, input3, left=True, transpose=False: -1, + torch.pairwise_distance: lambda x1, x2, p=2.0, eps=1e-06, keepdim=False: -1, + torch.permute: lambda self, dim: -1, + torch.pca_lowrank: lambda input, q=None, center=True, niter=2: -1, + torch.pdist: lambda input, p=2: -1, + torch.pinverse: lambda input, rcond=1e-15: -1, + torch.linalg.pinv: lambda input, rcond=1e-15, hermitian=False: -1, + torch.pixel_shuffle: lambda input, upscale_factor: -1, + torch.pixel_unshuffle: lambda input, downscale_factor: -1, + torch.poisson: lambda input, generator=None: -1, + torch.poisson_nll_loss: lambda input, target, log_input, full, eps, reduction: -1, + torch.polygamma: lambda input, n, out=None: -1, + torch.positive: lambda input, out=None: -1, + torch.prelu: lambda input, weight: -1, + torch.ones_like: lambda input, dtype=None, layout=None, device=None, requires_grad=False: -1, + torch.pow: lambda input, exponent, out=None: -1, + torch.prod: lambda input, dtype=None: -1, + torch.put: lambda input, index, source, accumulate=False: -1, + torch.q_per_channel_axis: lambda input: -1, + torch.q_per_channel_scales: lambda input: -1, + torch.q_per_channel_zero_points: lambda input: -1, + torch.q_scale: lambda input: -1, + torch.q_zero_point: lambda input: -1, + torch.qr: lambda input, some=True, out=None: -1, + torch.linalg.qr: lambda input, mode="reduced", out=None: -1, + torch.quantile: lambda input, q, dim=None, keepdim=False, interpolation="linear", out=None: -1, + torch.nanquantile: lambda input, q, dim=None, keepdim=False, interpolation="linear", out=None: -1, + torch.quantize_per_channel: lambda input, scales, zero_points, axis, dtype: -1, + torch.quantize_per_tensor: lambda input, scale, zero_point, dtype: -1, + torch.quantize_per_tensor_dynamic: lambda input, dtype, reduce_range: -1, + torch.quantized_batch_norm: lambda input, weight, bias, mean, var, eps, output_scale, output_zero_point: -1, + torch.quantized_gru_cell: ( + lambda input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh: -1 # noqa: B950 + ), + torch.quantized_lstm_cell: ( + lambda input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh: -1 # noqa: B950 + ), + torch.quantized_max_pool1d: ( + lambda input, kernel_size, stride=(), padding=(0,), dilation=( + 1, + ), ceil_mode=False: -1 + ), + torch.quantized_max_pool2d: ( + lambda input, kernel_size, stride=(), padding=(0, 0), dilation=( + 1, + 1, + ), ceil_mode=False: -1 + ), + torch.quantized_max_pool3d: ( + lambda input, kernel_size, stride=(), padding=(0, 0, 0), dilation=( + 1, + 1, + 1, + ), ceil_mode=False: -1 + ), + torch.quantized_rnn_relu_cell: ( + lambda input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh: -1 # noqa: B950 + ), + torch.quantized_rnn_tanh_cell: ( + lambda input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh: -1 # noqa: B950 + ), + torch.rad2deg: lambda input, out=None: -1, + torch.ravel: lambda input: -1, + torch.real: lambda input, out=None: -1, + torch.vdot: lambda input, other, out=None: -1, + torch.linalg.vecdot: lambda input, other, dim=-1, out=None: -1, + torch.view_as_real: lambda input: -1, + torch.view_as_complex: lambda input: -1, + torch.reciprocal: lambda input, out=None: -1, + torch.relu: lambda input, inplace=False: -1, + torch.remainder: lambda input, other, out=None: -1, + torch.renorm: lambda input, p, dim, maxnorm, out=None: -1, + torch.repeat_interleave: lambda input, dim=None: -1, + torch.reshape: lambda input, shape: -1, + torch.rms_norm: lambda input, normalized_shape, weight=None, eps=1e-6: -1, + torch.rnn_relu: lambda input, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first: -1, # noqa: B950 + torch.rnn_relu_cell: lambda input, hx, w_ih, w_hh, b_ih=None, b_hh=None: -1, + torch.rnn_tanh: lambda input, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first: -1, # noqa: B950 + torch.rnn_tanh_cell: lambda input, hx, w_ih, w_hh, b_ih=None, b_hh=None: -1, + torch.roll: lambda input, shifts, dims=None: -1, + torch.rot90: lambda input, k=1, dims=(0, 1): -1, + torch.round: lambda input, out=None: -1, + torch.row_stack: lambda tensors, out=None: -1, # alias for torch.vstack + torch._rowwise_prune: (lambda weight, mask, compressed_indices_dtype: -1), + torch.rrelu: lambda input, lower=1.0 / 8, upper=1.0 / 3, training=False, inplace=False: -1, + torch.rsqrt: lambda input, out=None: -1, + torch.rsub: lambda input, other, alpha=1: -1, + torch.saddmm: lambda input, mat1, mat2, beta=1, alpha=1, out=None: -1, + torch.scatter: lambda input, dim, index, src: -1, + torch.scatter_add: lambda input, dim, index, src: -1, + torch.scatter_reduce: lambda input, dim, index, src, reduce, include_self=True: -1, + torch.searchsorted: lambda sorted_sequence, input, out_int32=False, right=False, out=None: -1, + torch._segment_reduce: lambda data, reduce="max", lengths=None, indices=None, offsets=None, axis=0, unsafe=False: -1, # noqa: B950 + torch.select: lambda input, dim, index: -1, + torch.select_scatter: lambda input, src, dim, index: -1, + torch.slice_inverse: lambda input, src, dim=0, start=None, end=None, step=1: -1, + torch.slice_scatter: lambda input, src, dim=0, start=None, end=None, step=1: -1, + torch.selu: lambda input, inplace=False: -1, + torch.sigmoid: lambda input, out=None: -1, + torch.sign: lambda input, out=None: -1, + torch.signbit: lambda input, out=None: -1, + torch.sgn: lambda input, out=None: -1, + torch.sin: lambda input, out=None: -1, + torch.sinc: lambda input, out=None: -1, + torch.sinh: lambda input, out=None: -1, + torch.slogdet: lambda input: -1, + torch.linalg.slogdet: lambda input: -1, + torch.smm: lambda input, mat2, out_dtype=None: -1, + torch.spmm: lambda input, mat2, out_dtype=None: -1, + torch.softmax: lambda input, dim, dtype=None: -1, + torch.linalg.solve: lambda A, B, left=True, out=None: -1, + torch.linalg.solve_ex: lambda A, B, left=True, check_errors=False, out=None: -1, + torch.sort: lambda input, dim=-1, descending=False, *, stable=False, out=None: -1, + torch.split: lambda tensor, split_size_or_sections, dim=0: -1, + torch.split_with_sizes: lambda tensor, split_size_or_sections, dim=0: -1, + torch.sqrt: lambda input, out=None: -1, + torch.square: lambda input, out=None: -1, + torch.squeeze: lambda input, dim=None, out=None: -1, + torch.sspaddmm: lambda input, mat1, mat2, beta=1, alpha=1, out=None: -1, + torch.stack: lambda tensors, dim=0, out=None: -1, + torch.std: lambda input, dim=None: -1, + torch.std_mean: lambda input, dim=None: -1, + torch.stft: ( + lambda input, n_fft, hop_length=None, win_length=None, window=None, center=True, pad_mode="reflect", normalized=False, onesided=True, return_complex=None, align_to_window=None: -1 # noqa: B950 + ), + torch.sub: lambda input, other, out=None: -1, + torch.subtract: lambda input, other, out=None: -1, + torch.sum: lambda input, dim=None: -1, + torch.sym_float: lambda input: -1, + torch.sym_int: lambda input: -1, + torch.sym_max: lambda a, b: -1, + torch.sym_min: lambda a, b: -1, + torch.sym_not: lambda input: -1, + torch.sym_ite: lambda a, b, c: -1, + torch.sym_sum: lambda args: -1, + torch._sym_sqrt: lambda input: -1, + torch._sym_cos: lambda input: -1, + torch._sym_cosh: lambda input: -1, + torch._sym_sin: lambda input: -1, + torch._sym_sinh: lambda input: -1, + torch._sym_tan: lambda input: -1, + torch._sym_tanh: lambda input: -1, + torch._sym_asin: lambda input: -1, + torch._sym_acos: lambda input: -1, + torch._sym_atan: lambda input: -1, + torch.nansum: lambda input, dim=None: -1, + torch.svd: lambda input, some=True, compute_uv=True, out=None: -1, + torch.svd_lowrank: lambda input, q=6, niter=2, M=None: -1, + torch.linalg.svd: lambda input, full_matrices=True, out=None: -1, + torch.linalg.svdvals: lambda input, out=None: -1, + torch.swapaxes: lambda input, dim0, dim1: -1, + torch.swapdims: lambda input, axis0, axis1: -1, + torch.special.airy_ai: lambda input: -1, + torch.special.bessel_j0: lambda input: -1, + torch.special.bessel_j1: lambda input: -1, + torch.special.bessel_y0: lambda input: -1, + torch.special.bessel_y1: lambda input: -1, + torch.special.chebyshev_polynomial_t: lambda input, n, out=None: -1, + torch.special.chebyshev_polynomial_u: lambda input, n, out=None: -1, + torch.special.chebyshev_polynomial_v: lambda input, n, out=None: -1, + torch.special.chebyshev_polynomial_w: lambda input, n, out=None: -1, + torch.special.digamma: lambda input: -1, + torch.special.entr: lambda input: -1, + torch.special.erf: lambda input: -1, + torch.special.erfc: lambda input: -1, + torch.special.erfcx: lambda input: -1, + torch.special.erfinv: lambda input: -1, + torch.special.exp2: lambda input: -1, + torch.special.expit: lambda input: -1, + torch.special.expm1: lambda input: -1, + torch.special.gammainc: lambda input, other, out=None: -1, + torch.special.gammaincc: lambda input, other, out=None: -1, + torch.special.gammaln: lambda input: -1, + torch.special.hermite_polynomial_h: lambda input, n, out=None: -1, + torch.special.hermite_polynomial_he: lambda input, n, out=None: -1, + torch.special.i0: lambda input: -1, + torch.special.i0e: lambda input: -1, + torch.special.i1: lambda input: -1, + torch.special.i1e: lambda input: -1, + torch.special.laguerre_polynomial_l: lambda input, n, out=None: -1, + torch.special.legendre_polynomial_p: lambda input, n, out=None: -1, + torch.special.log1p: lambda input: -1, + torch.special.log_ndtr: lambda input: -1, + torch.special.log_softmax: lambda input, dim, dtype=None: -1, + torch.special.logit: lambda input: -1, + torch.special.logsumexp: lambda input, dim, keepdim=False, out=None: -1, + torch.special.modified_bessel_i0: lambda input: -1, + torch.special.modified_bessel_i1: lambda input: -1, + torch.special.modified_bessel_k0: lambda input: -1, + torch.special.modified_bessel_k1: lambda input: -1, + torch.special.multigammaln: lambda input, p: -1, + torch.special.ndtr: lambda input: -1, + torch.special.ndtri: lambda input: -1, + torch.special.polygamma: lambda input, n, out=None: -1, + torch.special.psi: lambda input: -1, + torch.special.round: lambda input: -1, + torch.special.scaled_modified_bessel_k0: lambda input: -1, + torch.special.scaled_modified_bessel_k1: lambda input: -1, + torch.special.shifted_chebyshev_polynomial_t: lambda input, n, out=None: -1, + torch.special.shifted_chebyshev_polynomial_u: lambda input, n, out=None: -1, + torch.special.shifted_chebyshev_polynomial_v: lambda input, n, out=None: -1, + torch.special.shifted_chebyshev_polynomial_w: lambda input, n, out=None: -1, + torch.special.sinc: lambda input: -1, + torch.special.softmax: lambda input, dim, dtype=None: -1, + torch.special.spherical_bessel_j0: lambda input: -1, + torch.special.xlog1py: lambda input, other, out=None: -1, + torch.special.xlogy: lambda input, other, out=None: -1, + torch.special.zeta: lambda self, other, out=None: -1, + torch.t: lambda input: -1, + torch.take: lambda input, index: -1, + torch.take_along_dim: lambda input, indices, dim=None, out=None: -1, + torch.tan: lambda input, out=None: -1, + torch.tanh: lambda input, out=None: -1, + torch.linalg.tensorinv: lambda a, ind=2: -1, + torch.linalg.tensorsolve: lambda a, b, dims=None: -1, + torch.tensordot: lambda a, b, dims=2, out=None: -1, + torch.tensor_split: lambda input, indices_or_sections, dim=0: -1, + torch.threshold: lambda input, threshold, value, inplace=False: -1, + torch.tile: lambda input, dims: -1, + torch.topk: lambda input, k, dim=-1, descending=False, out=None: -1, + torch.trace: lambda input: -1, + torch.transpose: lambda input, dim0, dim1: -1, + torch.trapz: lambda y, x=None, dim=-1: -1, + torch.trapezoid: lambda y, x=None, dim=-1: -1, + torch.triangular_solve: lambda input, A, upper=True, transpose=False, unitriangular=False: -1, + torch.linalg.solve_triangular: lambda input, B, upper, left=True, unitriangular=False: -1, + torch.tril: lambda input, diagonal=0, out=None: -1, + torch.triplet_margin_loss: ( + lambda anchor, positive, negative, margin=1.0, p=2, eps=1e-06, swap=False, size_average=None, reduce=None, reduction="mean": -1 # noqa: B950 + ), + torch.triu: lambda input, diagonal=0, out=None: -1, + torch.true_divide: lambda input, other: -1, + torch.trunc: lambda input, out=None: -1, + torch.unbind: lambda input, dim=0: -1, + torch.unflatten: lambda input, dim, sizes, names: -1, + torch.unique: lambda input, sorted=True, return_inverse=False, return_counts=False, dim=None: -1, + torch.unique_consecutive: lambda input, return_inverse=False, return_counts=False, dim=None: -1, + torch.unravel_index: lambda indices, shape: -1, + torch.unsafe_chunk: lambda input, chunks, dim=0: -1, + torch.unsafe_split: lambda tensor, split_size_or_sections, dim=0: -1, + torch.unsafe_split_with_sizes: lambda tensor, split_size_or_sections, dim=0: -1, + torch.unsqueeze: lambda input, dim, out=None: -1, + torch.linalg.vander: lambda x, N=None: -1, + torch.var: lambda input, dim=None: -1, + torch.var_mean: lambda input, dim=None: -1, + torch.vsplit: lambda input, indices_or_sections: -1, + torch.vstack: lambda tensors, out=None: -1, + torch.where: lambda condition, x=None, y=None: -1, + torch._wrapped_linear_prepack: lambda weight, weight_scale, weight_zero_point, bias : -1, + torch._wrapped_quantized_linear_prepacked: ( + lambda input, input_scale, input_zero_point, prepacked, out_scale, out_zero_point, out_channel : -1 # noqa: B950 + ), + torch.zeros_like: lambda input, dtype=None, layout=None, device=None, requires_grad=False: -1, + torch._fw_primal_copy: lambda self, level: -1, + torch._make_dual_copy: lambda primal, tangent, level: -1, + torch.view_as_real_copy: lambda self: -1, + torch.view_as_complex_copy: lambda self: -1, + torch._conj_copy: lambda self: -1, + torch._neg_view_copy: lambda self: -1, + torch.as_strided_copy: lambda self, size, stride, storage_offset=None: -1, + torch._sparse_broadcast_to_copy: lambda self, size: -1, + torch.diagonal_copy: lambda self, offset=0, dim1=0, dim2=1: -1, + torch.expand_copy: lambda self, size, *, implicit=False: -1, + torch.narrow_copy: lambda self, dim, start, length: -1, + torch.permute_copy: lambda self, dims: -1, + torch._reshape_alias_copy: lambda self, size, stride: -1, + torch.select_copy: lambda self, dim, index: -1, + torch.detach_copy: lambda self: -1, + torch.slice_copy: lambda self, dim=0, start=None, end=None, step=1: -1, + torch.split_copy: lambda self, split_size, dim=0: -1, + torch.split_with_sizes_copy: lambda self, split_sizes, dim=0: -1, + torch.squeeze_copy: lambda self, dim: -1, + torch.t_copy: lambda self: -1, + torch.transpose_copy: lambda self, dim0, dim1: -1, + torch.unsqueeze_copy: lambda self, dim: -1, + torch._indices_copy: lambda self: -1, + torch._values_copy: lambda self: -1, + torch.indices_copy: lambda self: -1, + torch.values_copy: lambda self: -1, + torch.crow_indices_copy: lambda self: -1, + torch.col_indices_copy: lambda self: -1, + torch.ccol_indices_copy: lambda self: -1, + torch.row_indices_copy: lambda self: -1, + torch.unbind_copy: lambda self, dim=0: -1, + torch.view_copy: lambda self, dtype: -1, + torch.unfold_copy: lambda self, dimension, size, step: -1, + torch.alias_copy: lambda self: -1, + Tensor.__floordiv__: lambda self, other: -1, + Tensor.__rfloordiv__: lambda self, other: -1, + Tensor.__ifloordiv__: lambda self, other: -1, + Tensor.__truediv__: lambda self, other: -1, + Tensor.__rtruediv__: lambda self, other: -1, + Tensor.__itruediv__: lambda self, other: -1, + Tensor.__lshift__: lambda self, other: -1, + Tensor.__rlshift__: lambda self, other: -1, + Tensor.__ilshift__: lambda self, other: -1, + Tensor.__rshift__: lambda self, other: -1, + Tensor.__rrshift__: lambda self, other: -1, + Tensor.__irshift__: lambda self, other: -1, + Tensor.__and__: lambda self, other: -1, + Tensor.__or__: lambda self, other: -1, + Tensor.__xor__: lambda self, other: -1, + Tensor.__float__: lambda self: -1, + Tensor.__complex__: lambda self: -1, + Tensor.__array__: lambda self, dtype: -1, + Tensor.__bool__: lambda self: -1, + Tensor.__contains__: lambda self, other: -1, + Tensor.__neg__: lambda self: -1, + Tensor.__invert__: lambda self: -1, + Tensor.__mod__: lambda self, other: -1, + Tensor.__rmod__: lambda self, other: -1, + Tensor.__imod__: lambda self, other: -1, + Tensor.__array_wrap__: lambda self, array: -1, + Tensor.__getitem__: lambda self, idx: -1, + Tensor.__deepcopy__: lambda self, memo: -1, + Tensor.__int__: lambda self: -1, + Tensor.__long__: lambda self: -1, + Tensor.__index__: lambda self: -1, + Tensor.__len__: lambda self: -1, + Tensor.__format__: lambda self, format_spec: -1, + Tensor.__reduce_ex__: lambda self, proto: -1, + Tensor.__reversed__: lambda self: -1, + Tensor.__repr__: lambda self, *, tensor_contents=None: -1, + Tensor.__setitem__: lambda self, k, v: -1, + Tensor.__setstate__: lambda self, d: -1, + Tensor.T.__get__: lambda self: -1, + Tensor.H.__get__: lambda self: -1, + Tensor.mT.__get__: lambda self: -1, + Tensor.mH.__get__: lambda self: -1, + Tensor._backward_hooks.__get__: lambda self: -1, + Tensor._post_accumulate_grad_hooks.__get__: lambda self: -1, + Tensor._base.__get__: lambda self: -1, + Tensor._cdata.__get__: lambda self: -1, + Tensor.grad.__get__: lambda self: -1, + Tensor._grad.__get__: lambda self: -1, + Tensor._grad_fn.__get__: lambda self: -1, + Tensor.grad_fn.__get__: lambda self: -1, + Tensor.grad_dtype.__get__: lambda self: -1, + Tensor._version.__get__: lambda self: -1, + Tensor._autocast_to_reduced_precision: lambda self, cuda_enabled, cpu_enabled, cuda_dtype, cpu_dtype: -1, + Tensor._autocast_to_full_precision: lambda self, cuda_enabled, cpu_enabled: -1, + Tensor._clear_non_serializable_cached_data: lambda self: -1, + Tensor.data.__get__: lambda self: -1, + Tensor.device.__get__: lambda self: -1, + Tensor.dtype.__get__: lambda self: -1, + Tensor.is_cuda.__get__: lambda self: -1, + Tensor.is_cpu.__get__: lambda self: -1, + Tensor.is_xla.__get__: lambda self: -1, + Tensor.is_xpu.__get__: lambda self: -1, + Tensor.is_ipu.__get__: lambda self: -1, + Tensor.is_leaf.__get__: lambda self: -1, + Tensor.retains_grad.__get__: lambda self: -1, + Tensor.is_meta.__get__: lambda self: -1, + Tensor.is_mps.__get__: lambda self: -1, + Tensor.is_mtia.__get__: lambda self: -1, + Tensor.is_nested.__get__: lambda self: -1, + Tensor.is_maia.__get__: lambda self: -1, + Tensor.is_mkldnn.__get__: lambda self: -1, + Tensor.is_quantized.__get__: lambda self: -1, + Tensor.is_sparse.__get__: lambda self: -1, + Tensor.is_sparse_csr.__get__: lambda self: -1, + Tensor.is_vulkan.__get__: lambda self: -1, + Tensor.itemsize.__get__: lambda self: -1, + Tensor.layout.__get__: lambda self: -1, + Tensor.name.__get__: lambda self: -1, + Tensor.names.__get__: lambda self: -1, + Tensor.nbytes.__get__: lambda self: -1, + Tensor.ndim.__get__: lambda self: -1, + Tensor.output_nr.__get__: lambda self: -1, + Tensor.requires_grad.__get__: lambda self: -1, + Tensor.shape.__get__: lambda self: -1, + Tensor.volatile.__get__: lambda self: -1, + Tensor.real.__get__: lambda self: -1, + Tensor.imag.__get__: lambda self: -1, + Tensor.__cuda_array_interface__.__get__: lambda self: -1, + Tensor.type: lambda self, dtype=None, non_blocking=False, **kwargs: -1, + Tensor._dimI: lambda self: -1, + Tensor._dimV: lambda self: -1, + Tensor._indices: lambda self: -1, + Tensor._is_view: lambda self: -1, + Tensor._nnz: lambda self: -1, + Tensor.crow_indices: lambda self: -1, + Tensor.col_indices: lambda self: -1, + Tensor.ccol_indices: lambda self: -1, + Tensor.row_indices: lambda self: -1, + Tensor._update_names: lambda self, names, inplace: -1, + Tensor._values: lambda self: -1, + Tensor.adjoint: lambda self: -1, + Tensor.align_as: lambda self, other: -1, + Tensor.align_to: lambda self, order, ellipsis_idx: -1, + Tensor.apply_: lambda self, callable: -1, + Tensor.as_strided: lambda self, size, stride: -1, + Tensor.as_strided_: lambda self, size, stride: -1, + Tensor.backward: lambda self, gradient=None, retain_graph=None, create_graph=False, inputs=None: -1, + Tensor.bfloat16: lambda self, memory_format=torch.preserve_format: -1, + Tensor.bool: lambda self, memory_format=torch.preserve_format: -1, + Tensor.byte: lambda self, memory_format=torch.preserve_format: -1, + Tensor.char: lambda self, memory_format=torch.preserve_format: -1, + Tensor.cauchy_: lambda self, median=0, sigma=1, *, generator=None: -1, + Tensor.coalesce: lambda self: -1, + Tensor._coalesced_: lambda self, coalesced: -1, + Tensor.contiguous: lambda self, memory_format=torch.contiguous_format: -1, + Tensor.copy_: lambda self, src, non_blocking=False: -1, + Tensor.cpu: lambda self, memory_format=torch.preserve_format: -1, + Tensor.cuda: lambda self, memory_format=torch.preserve_format: -1, + Tensor.mtia: lambda self, memory_format=torch.preserve_format: -1, + Tensor.xpu: lambda self, memory_format=torch.preserve_format: -1, + Tensor.ipu: lambda self, memory_format=torch.preserve_format: -1, + Tensor.data_ptr: lambda self: -1, + Tensor.dense_dim: lambda self: -1, + Tensor.diagonal_scatter: lambda self, src, offset=0, dim1=0, dim2=1: -1, + Tensor.dim: lambda self: -1, + Tensor.dim_order: lambda self, ambiguity_check=False: -1, + Tensor.double: lambda self, memory_format=torch.preserve_format: -1, + Tensor.cdouble: lambda self, memory_format=torch.preserve_format: -1, + Tensor.element_size: lambda self: -1, + Tensor.expand: lambda self, size: -1, + Tensor.expand_as: lambda self, other: -1, + Tensor.exponential_: lambda self, lambd=1, *, generator=None: -1, + Tensor.fill_: lambda self, value: -1, + Tensor.fill_diagonal_: lambda self, value: -1, + Tensor.float: lambda self, memory_format=torch.preserve_format: -1, + Tensor.cfloat: lambda self, memory_format=torch.preserve_format: -1, + Tensor.geometric_: lambda self, p, *, generator=None: -1, + Tensor.get_device: lambda self: -1, + Tensor.half: lambda self, memory_format=torch.preserve_format: -1, + Tensor.chalf: lambda self, memory_format=torch.preserve_format: -1, + Tensor.has_names: lambda self: -1, + Tensor.indices: lambda self: -1, + Tensor.int: lambda self, memory_format=torch.preserve_format: -1, + Tensor.is_coalesced: lambda self: -1, + Tensor.is_contiguous: lambda self: -1, + Tensor.is_inference: lambda self: -1, + Tensor.is_pinned: lambda self: -1, + Tensor.is_set_to: lambda self, tensor: -1, + Tensor.is_shared: lambda self: -1, + Tensor.item: lambda self: -1, + Tensor.log_normal_: lambda self, mean=1, std=2, *, generator=None: -1, + Tensor.log_softmax: lambda self, dim: -1, + Tensor.long: lambda self, memory_format=torch.preserve_format: -1, + Tensor.map_: lambda self, tensor, callable: -1, + Tensor.map2_: lambda self, x, y, callable: -1, + Tensor.mm: lambda self, mat2, out_dtype=None: -1, + Tensor.module_load: lambda self, other, assign=False: -1, + Tensor.narrow_copy: lambda self, dimension, start, length: -1, + Tensor.ndimension: lambda self: -1, + Tensor.nelement: lambda self: -1, + Tensor._nested_tensor_size: lambda self: -1, + Tensor._nested_tensor_storage_offsets: lambda self: -1, + Tensor._nested_tensor_strides: lambda self: -1, + Tensor.normal_: lambda self: -1, + Tensor.numpy: lambda self: -1, + Tensor.permute: lambda self, dim: -1, + Tensor.pin_memory: lambda self: -1, + Tensor.put_: lambda self, indices, tensor, accumulate=False: -1, + Tensor.qscheme: lambda self: -1, + Tensor.random_: lambda self, from_=0, to=None, *, generator=None: -1, + Tensor.record_stream: lambda self, stream: -1, + Tensor.refine_names: lambda self, names: -1, + Tensor.register_hook: lambda self, hook: -1, + Tensor.register_post_accumulate_grad_hook: lambda self, hook: -1, + Tensor.rename: lambda self, name: -1, + Tensor.repeat: lambda self, *size: -1, + Tensor.requires_grad_: lambda self, requires_grad=True: -1, + Tensor.reshape_as: lambda self, other: -1, + Tensor.resize: lambda self, *size: -1, + Tensor.resize_: lambda self, size: -1, + Tensor.resize_as: lambda self, other: -1, + Tensor.resize_as_sparse_: lambda self, other: -1, + Tensor.retain_grad: lambda self: -1, + Tensor.set_: lambda self, source=None, storage_offset=0, size=None, stride=None: -1, + Tensor.select_scatter: lambda self, src, dim, index: -1, + Tensor.share_memory_: lambda self: -1, + Tensor.short: lambda self, memory_format=torch.preserve_format: -1, + Tensor.size: lambda self: -1, + Tensor.slice_scatter: lambda self, src, dim=0, start=None, end=None, step=1: -1, + Tensor.sparse_dim: lambda self: -1, + Tensor.sparse_mask: lambda self, mask: -1, + Tensor._sparse_mask_projection: lambda self, mask, accumulate_matches=False: -1, + Tensor.sparse_resize_: lambda self, size1, size2, dense_dim: -1, + Tensor.sparse_resize_and_clear_: lambda self, size1, size2, dense_dim: -1, + Tensor.sspaddmm: lambda self, mat1, mat2, beta=1, alpha=1, out=None: -1, + Tensor.storage: lambda self: -1, + Tensor.untyped_storage: lambda self: -1, + Tensor.storage_offset: lambda self: -1, + Tensor.storage_type: lambda self: -1, + Tensor.sum_to_size: lambda self, size: -1, + Tensor.tile: lambda self, *reps: -1, + Tensor.to: lambda self, dtype, non_blocking=False, copy=False, memory_format=torch.preserve_format: -1, + Tensor.to_dense: lambda self, dtype=None, *, masked_grad=None: -1, + Tensor._to_dense: lambda self, dtype=None, masked_grad=None: -1, + Tensor.to_sparse: lambda self: -1, + Tensor.tolist: lambda self: -1, + Tensor.to_mkldnn: lambda self: -1, + Tensor.type_as: lambda self, other: -1, + Tensor.unfold: lambda self, dimension, size, step: -1, + Tensor.uniform_: lambda self, from_=0, to=1: -1, + Tensor.values: lambda self: -1, + Tensor.view: lambda self, shape: -1, + Tensor.view_as: lambda self, other: -1, + Tensor.zero_: lambda self: -1, + Tensor.__dlpack__: lambda self, stream=None, max_version=None, dl_device=None, copy=None: -1, + Tensor.__dlpack_device__: lambda self: -1, + Tensor.index: lambda self, a, b: -1, + torch.linalg.lstsq: lambda self, b, cond=None, driver=None: -1, + } # fmt: skip + + privateuse1_backend_name = ( + torch.utils.backend_registration._privateuse1_backend_name + ) + if hasattr(Tensor, privateuse1_backend_name): + ret[getattr(Tensor, privateuse1_backend_name)] = ( + lambda self, device=None, non_blocking=False, **kwargs: -1 + ) + ret[getattr(Tensor, f"is_{privateuse1_backend_name}").__get__] = lambda self: -1 + + ret2 = {} + ignored = get_ignored_functions() + + for k, v in ret.items(): + # Generate methods like __add__ and add_ by default from add + names = [ + k.__name__, # Default method + k.__name__ + "_", # Inplace variant + "__" + k.__name__ + "__", # Dunder method + "__i" + k.__name__ + "__", # Inplace dunder method + "__r" + k.__name__ + "__", # Reverse dunder method + ] + + if k.__name__.startswith("bitwise_"): + # bitwise_ have dunder methods of the form ____ + # And so on. + subname = k.__name__[len("bitwise_") :] + names.extend( + ["__" + subname + "__", "__i" + subname + "__", "__r" + subname + "__"] + ) + + for name in names: + func = getattr(Tensor, name, None) + if callable(func) and func not in ret and func not in ignored: + ret2[func] = v + + ret.update(ret2) + return ret + + +def wrap_torch_function(dispatcher: Callable): + """Wraps a given function with ``__torch_function__`` -related functionality. + + Parameters + ---------- + dispatcher: Callable + A callable that returns an iterable of Tensor-likes passed into the function. + + Note + ---- + This decorator may reduce the performance of your code. Generally, it's enough to express + your code as a series of functions that, themselves, support __torch_function__. If you + find yourself in the rare situation where this is not the case, e.g. if you're wrapping a + low-level library and you also need it to work for Tensor-likes, then this function is available. + + Examples + -------- + >>> def dispatcher(a): # Must have the same signature as func + ... return (a,) + >>> @torch.overrides.wrap_torch_function(dispatcher) + >>> def func(a): # This will make func dispatchable by __torch_function__ + ... return a + 0 + """ + + def inner(func): + @functools.wraps(func) + def wrapped(*args, **kwargs): + relevant_args = dispatcher(*args, **kwargs) + if has_torch_function(relevant_args): + return handle_torch_function(wrapped, relevant_args, *args, **kwargs) + + return func(*args, **kwargs) + + return wrapped + + return inner + + +def _get_overloaded_args( + relevant_args: Iterable[Any], + get_type_fn: Callable[[Any], type] | None = None, +) -> list[Any]: + """Returns a list of arguments on which to call __torch_function__. + + Checks arguments in relevant_args for __torch_function__ implementations, + storing references to the arguments and their types in overloaded_args and + overloaded_types in order of calling precedence. Only distinct types are + considered. If a type is a subclass of another type it will have higher + precedence, otherwise the precedence order is the same as the order of + arguments in relevant_args, that is, from left-to-right in the argument list. + + The precedence-determining algorithm implemented in this function is + described in `NEP-0018`_. + + See torch::append_overloaded_arg for the equivalent function in the C++ + implementation. + + Parameters + ---------- + relevant_args : iterable of array-like + Iterable of array-like arguments to check for __torch_function__ + methods. + + get_type_fn : callable, optional + Function to call on each argument in relevant_args to get its type. + + Returns + ------- + overloaded_args : list + Arguments from relevant_args on which to call __torch_function__ + methods, in the order in which they should be called. + + .. _NEP-0018: + https://numpy.org/neps/nep-0018-array-function-protocol.html + """ + if get_type_fn is None: + get_type_fn = type + + # If torch function is not enabled, there are no overloaded types + if not torch._C._is_torch_function_enabled(): + return [] + # Runtime is O(num_arguments * num_unique_types) + overloaded_types: set[type] = set() + overloaded_args: list[Any] = [] + for arg in relevant_args: + arg_type = get_type_fn(arg) + # We only collect arguments if they have a unique type, which ensures + # reasonable performance even with a long list of possibly overloaded + # arguments. + # + # NB: Important to exclude _disabled_torch_function_impl, otherwise + # https://github.com/pytorch/pytorch/issues/64687 + if ( + arg_type not in overloaded_types + and hasattr(arg_type, "__torch_function__") + and arg_type.__torch_function__ + is not torch._C._disabled_torch_function_impl + ): + # Create lists explicitly for the first type (usually the only one + # done) to avoid setting up the iterator for overloaded_args. + if overloaded_types: + overloaded_types.add(arg_type) + # By default, insert argument at the end, but if it is + # subclass of another argument, insert it before that argument. + # This ensures "subclasses before superclasses". + index = len(overloaded_args) + for i, old_arg in enumerate(overloaded_args): + if issubclass(arg_type, get_type_fn(old_arg)): + index = i + break + overloaded_args.insert(index, arg) + else: + overloaded_types = {arg_type} + overloaded_args = [arg] + return overloaded_args + + +def handle_torch_function( + public_api: Callable, + relevant_args: Iterable[Any], + *args, + **kwargs, +) -> Any: + """Implement a function with checks for ``__torch_function__`` overrides. + + See torch::autograd::handle_torch_function for the equivalent of this + function in the C++ implementation. + + Arguments + --------- + public_api : function + Function exposed by the public torch API originally called like + ``public_api(*args, **kwargs)`` on which arguments are now being + checked. + relevant_args : iterable + Iterable of arguments to check for __torch_function__ methods. + args : tuple + Arbitrary positional arguments originally passed into ``public_api``. + kwargs : tuple + Arbitrary keyword arguments originally passed into ``public_api``. + + Returns + ------- + object + Result from calling ``implementation`` or an ``__torch_function__`` + method, as appropriate. + + Raises + ------ + TypeError : if no implementation is found. + + Example + ------- + >>> def func(a): + ... if has_torch_function_unary(a): + ... return handle_torch_function(func, (a,), a) + ... return a + 0 + """ + # Check for __torch_function__ methods. + overloaded_args = _get_overloaded_args(relevant_args) + # overloaded_args already have unique types. + types = tuple(map(type, overloaded_args)) + + # Check for __torch_function__ mode. + if _is_torch_function_mode_enabled(): + # if we're here, the mode must be set to a TorchFunctionStackMode + # this unsets it and calls directly into TorchFunctionStackMode's torch function + with _pop_mode_temporarily() as mode: + result = mode.__torch_function__(public_api, types, args, kwargs) + if result is not NotImplemented: + return result + + # Call overrides + for overloaded_arg in overloaded_args: + # This call needs to become a classmethod call in the future. + # See https://github.com/pytorch/pytorch/issues/63767 + torch_func_method = overloaded_arg.__torch_function__ + if ( + hasattr(torch_func_method, "__self__") + and torch_func_method.__self__ is overloaded_arg + and torch_func_method is not torch._C._disabled_torch_function_impl + ): + warnings.warn( + "Defining your `__torch_function__ as a plain method is deprecated and " + "will be an error in future, please define it as a classmethod.", + DeprecationWarning, + stacklevel=2, + ) + + # Use `public_api` instead of `implementation` so __torch_function__ + # implementations can do equality/identity comparisons. + result = torch_func_method(public_api, types, args, kwargs) + + if result is not NotImplemented: + return result + + func_name = f"{public_api.__module__}.{public_api.__name__}" + msg = ( + f"no implementation found for '{func_name}' on types that implement " + f"__torch_function__: {[type(arg) for arg in overloaded_args]}" + ) + if _is_torch_function_mode_enabled(): + msg += f" nor in mode {_get_current_function_mode()}" + raise TypeError(msg) + + +has_torch_function = _add_docstr( + _has_torch_function, + r"""Check for __torch_function__ implementations in the elements of an iterable + or if a __torch_function__ mode is enabled. Considers exact ``Tensor`` s + and ``Parameter`` s non-dispatchable. Use this to guard a call to + :func:`handle_torch_function`; don't use it to test if something + is Tensor-like, use :func:`is_tensor_like` instead. + Arguments + --------- + relevant_args : iterable + Iterable or arguments to check for __torch_function__ methods. + Returns + ------- + bool + True if any of the elements of relevant_args have __torch_function__ + implementations, False otherwise. + See Also + ________ + torch.is_tensor_like + Checks if something is a Tensor-like, including an exact ``Tensor``. + """, +) + +has_torch_function_unary = _add_docstr( + _has_torch_function_unary, + r"""Special case of `has_torch_function` for single inputs. + Instead of: + `has_torch_function((t,))` + call: + `has_torch_function_unary(t)` + which skips unnecessary packing and unpacking work. + """, +) + +has_torch_function_variadic = _add_docstr( + _has_torch_function_variadic, + r"""Special case of `has_torch_function` that skips tuple creation. + + This uses the METH_FASTCALL protocol introduced in Python 3.7 + + Instead of: + `has_torch_function((a, b))` + call: + `has_torch_function_variadic(a, b)` + which skips unnecessary packing and unpacking work. + """, +) + + +@functools.cache +def _get_overridable_functions() -> tuple[ + dict[Any, list[Callable]], dict[Callable, str] +]: + overridable_funcs = collections.defaultdict(list) + index = {} + tested_namespaces = [ + ("torch", torch, torch.__all__), + ("torch.functional", torch.functional, torch.functional.__all__), + ("torch.nn.functional", torch.nn.functional, dir(torch.nn.functional)), + ("torch.nn.init", torch.nn.init, dir(torch.nn.init)), + ("torch.Tensor", torch.Tensor, dir(torch.Tensor)), + ("torch.linalg", torch.linalg, dir(torch.linalg)), + ("torch.fft", torch.fft, dir(torch.fft)), + ("torch.special", torch.special, dir(torch.special)), + ] + for namespace_str, namespace, ns_funcs in tested_namespaces: + for func_name in ns_funcs: + ignore = False + # ignore private functions or functions that are deleted in torch.__init__ + if namespace is not torch.Tensor: + if func_name.startswith("__"): + continue + elif func_name.startswith("_"): + ignore = True + elif func_name.endswith("_"): + ignore = True + elif not func_name[0].islower(): + ignore = True + elif func_name == "unique_dim": + continue + else: + func = getattr(namespace, func_name) + if getattr(object, func_name, None) == func: + continue + if func_name == "__weakref__": + continue + func = getattr(namespace, func_name) + if namespace is torch.Tensor and getattr(object, func_name, None) == func: + continue + # ignore re-exported modules + if isinstance(func, types.ModuleType): + continue + # ignore __future__ imports + if isinstance(func, __future__._Feature): + continue + + if not callable(func) and hasattr(func, "__get__"): + index[func.__get__] = f"{namespace_str}.{func_name}.__get__" + index[func.__set__] = f"{namespace_str}.{func_name}.__set__" + if ignore: + continue + if func.__get__ in get_ignored_functions(): + msg = ( + "{}.{} is in the tuple returned by torch._overrides.get_ignored_functions " + "but still has an explicit override" + ) + assert func.__get__ not in get_testing_overrides(), msg.format( + namespace, func.__name__ + ) + continue + else: + overridable_funcs[func].append(func.__get__) + continue + + if not callable(func): + continue + + index[func] = f"{namespace_str}.{func_name}" + + if ignore: + continue + + # cannot be overridden by __torch_function__ + if func in get_ignored_functions(): + msg = ( + "{}.{} is in the tuple returned by torch._overrides.get_ignored_functions " + "but still has an explicit override" + ) + assert func not in get_testing_overrides(), msg.format( + namespace, func.__name__ + ) + continue + overridable_funcs[namespace].append(func) + return overridable_funcs, index + + +@_disable_user_warnings +def get_overridable_functions() -> dict[Any, list[Callable]]: + """List functions that are overridable via __torch_function__ + + Returns + ------- + Dict[Any, List[Callable]] + A dictionary that maps namespaces that contain overridable functions + to functions in that namespace that can be overridden. + """ + return _get_overridable_functions()[0] + + +@_disable_user_warnings +def resolve_name(f): + """Get a human readable string name for a function passed to + __torch_function__ + + Arguments + --------- + f : Callable + Function to resolve the name of. + + Returns + ------- + str + Name of the function; if eval'ed it should give back the input + function. + """ + if isinstance(f, (torch._ops.OpOverload, torch._ops.OpOverloadPacket)): + return str(f) + return _get_overridable_functions()[1].get(f) + + +@functools.cache +def _get_tensor_methods() -> set[Callable]: + """Returns a set of the overridable methods on ``torch.Tensor``""" + overridable_funcs = get_overridable_functions() + methods = set(overridable_funcs[torch.Tensor]) + return methods + + +@_disable_user_warnings +def is_tensor_method_or_property(func: Callable) -> bool: + """ + Returns True if the function passed in is a handler for a + method or property belonging to ``torch.Tensor``, as passed + into ``__torch_function__``. + + .. note:: + For properties, their ``__get__`` method must be passed in. + + This may be needed, in particular, for the following reasons: + + 1. Methods/properties sometimes don't contain a `__module__` slot. + 2. They require that the first passed-in argument is an instance + of ``torch.Tensor``. + + Examples + -------- + >>> is_tensor_method_or_property(torch.Tensor.add) + True + >>> is_tensor_method_or_property(torch.add) + False + """ + return func in _get_tensor_methods() or func.__name__ == "__get__" + + +def is_tensor_like(inp): + """ + Returns ``True`` if the passed-in input is a Tensor-like. + + Currently, this occurs whenever there's a ``__torch_function__`` + attribute on the type of the input. + + Examples + -------- + A subclass of tensor is generally a Tensor-like. + + >>> class SubTensor(torch.Tensor): ... + >>> is_tensor_like(SubTensor([0])) + True + + Built-in or user types aren't usually Tensor-like. + + >>> is_tensor_like(6) + False + >>> is_tensor_like(None) + False + >>> class NotATensor: ... + >>> is_tensor_like(NotATensor()) + False + + But, they can be made Tensor-like by implementing __torch_function__. + + >>> class TensorLike: + ... @classmethod + ... def __torch_function__(cls, func, types, args, kwargs): + ... return -1 + >>> is_tensor_like(TensorLike()) + True + """ + return type(inp) is torch.Tensor or hasattr(inp, "__torch_function__") + + +class TorchFunctionMode: + """ + A ``TorchFunctionMode`` allows you to override the meaning of all + ``__torch_function__`` overridable functions within a dynamic scope, + without having to actually create a tensor subclass or manually + monkey-patch functions in the PyTorch API. Some common situations + where you should use a mode: + + * You want to override the meaning of factory functions, or other + functions that do not otherwise take a tensor as an argument + (these cannot be overridden with tensor subclasses). + + * You want to override the behavior of all functions without needing + to wrap your inputs in tensor subclasses; e.g., if you are just + interested in logging intermediate computations. + + * You want to control the order of execution of various tensor + subclasses explicitly, rather than implicitly via the return of + ``NotImplemented``. + + Independent subclasses of :class:`TorchFunctionMode` are compositional: + modes can be pushed onto a stack using ``with MyMode():``. + When you call functions in the PyTorch API inside your + ``__torch_function__`` implementation, by default, they will forward on to + the next mode on the mode stack. If you want recursively call back into + your current ``__torch_function__`` implementation, either explicitly + invoke ``self.__torch_function__(...)``, or use the context manager + ``enable_torch_function_mode(self, replace=self.inner)`` to make PyTorch + API self-referential (beware of infinite loops, in this case!) + """ + + inner: "TorchFunctionMode" + + # Force metaclass to generate constructor at the base of the hierarchy + def __init__(self) -> None: + pass + + def __torch_function__(self, func, types, args=(), kwargs=None): + raise NotImplementedError + + def __enter__(self): + _push_mode(self) + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + _pop_mode() + + @classmethod + def push(cls, *args, **kwargs): + warnings.warn( + "`Mode.push()` is no longer necessary and can be replaced with just `with Mode()`", + stacklevel=2, + ) + instance = cls(*args, **kwargs) + return instance + + +def _get_current_function_mode(): + stack_len = _len_torch_function_stack() + return _get_function_stack_at(stack_len - 1) if stack_len > 0 else None + + +def _get_current_function_mode_stack(): + stack_len = _len_torch_function_stack() + return [_get_function_stack_at(i) for i in range(stack_len)] + + +def _push_mode(mode): + _push_on_torch_function_stack(mode) + + +def _pop_mode(): + old = _pop_torch_function_stack() + return old + + +@contextlib.contextmanager +def _pop_mode_temporarily(): + old = _pop_mode() + try: + yield old + finally: + _push_mode(old) + + +class BaseTorchFunctionMode(TorchFunctionMode): + def __torch_function__(self, func, types, args=(), kwargs=None): + if kwargs is None: + kwargs = {} + return func(*args, **kwargs) + + +@contextlib.contextmanager +def _enable_torch_function(): + old_state = torch._C._get_torch_function_state() + try: + torch._C._set_torch_function_state(torch._C._TorchFunctionState.ENABLED) + yield + finally: + torch._C._set_torch_function_state(old_state) + + +@contextlib.contextmanager +def enable_reentrant_dispatch(): + # NB: this can't simply be + # `enable_reentrant_dispatch = torch._C._RestorePythonTLSSnapshot` + # because: + # 1. torch._C._RestorePythonTLSSnapshot is unavailable when this file + # initially gets imported. Probably an import order thing. + # 2. enable_reentrant_dispatch is technically public API; assigning + # it the object would change the __module__ to look private. + with torch._C._RestorePythonTLSSnapshot(): + try: + yield + finally: + pass diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/py.typed b/TTS/Kokoro/.venv/Lib/site-packages/torch/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/quasirandom.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/quasirandom.py new file mode 100644 index 0000000000000000000000000000000000000000..97a2ebbb54d5472f7bf18b1a6e897d17bf37090d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/quasirandom.py @@ -0,0 +1,216 @@ +# mypy: allow-untyped-defs + +import torch + + +class SobolEngine: + r""" + The :class:`torch.quasirandom.SobolEngine` is an engine for generating + (scrambled) Sobol sequences. Sobol sequences are an example of low + discrepancy quasi-random sequences. + + This implementation of an engine for Sobol sequences is capable of + sampling sequences up to a maximum dimension of 21201. It uses direction + numbers from https://web.maths.unsw.edu.au/~fkuo/sobol/ obtained using the + search criterion D(6) up to the dimension 21201. This is the recommended + choice by the authors. + + References: + - Art B. Owen. Scrambling Sobol and Niederreiter-Xing points. + Journal of Complexity, 14(4):466-489, December 1998. + + - I. M. Sobol. The distribution of points in a cube and the accurate + evaluation of integrals. + Zh. Vychisl. Mat. i Mat. Phys., 7:784-802, 1967. + + Args: + dimension (Int): The dimensionality of the sequence to be drawn + scramble (bool, optional): Setting this to ``True`` will produce + scrambled Sobol sequences. Scrambling is + capable of producing better Sobol + sequences. Default: ``False``. + seed (Int, optional): This is the seed for the scrambling. The seed + of the random number generator is set to this, + if specified. Otherwise, it uses a random seed. + Default: ``None`` + + Examples:: + + >>> # xdoctest: +SKIP("unseeded random state") + >>> soboleng = torch.quasirandom.SobolEngine(dimension=5) + >>> soboleng.draw(3) + tensor([[0.0000, 0.0000, 0.0000, 0.0000, 0.0000], + [0.5000, 0.5000, 0.5000, 0.5000, 0.5000], + [0.7500, 0.2500, 0.2500, 0.2500, 0.7500]]) + """ + + MAXBIT = 30 + MAXDIM = 21201 + + def __init__(self, dimension, scramble=False, seed=None): + if dimension > self.MAXDIM or dimension < 1: + raise ValueError( + "Supported range of dimensionality " + f"for SobolEngine is [1, {self.MAXDIM}]" + ) + + self.seed = seed + self.scramble = scramble + self.dimension = dimension + + cpu = torch.device("cpu") + + self.sobolstate = torch.zeros( + dimension, self.MAXBIT, device=cpu, dtype=torch.long + ) + torch._sobol_engine_initialize_state_(self.sobolstate, self.dimension) + + if not self.scramble: + self.shift = torch.zeros(self.dimension, device=cpu, dtype=torch.long) + else: + self._scramble() + + self.quasi = self.shift.clone(memory_format=torch.contiguous_format) + self._first_point = (self.quasi / 2**self.MAXBIT).reshape(1, -1) + self.num_generated = 0 + + def draw( + self, + n: int = 1, + out: torch.Tensor | None = None, + dtype: torch.dtype | None = None, + ) -> torch.Tensor: + r""" + Function to draw a sequence of :attr:`n` points from a Sobol sequence. + Note that the samples are dependent on the previous samples. The size + of the result is :math:`(n, dimension)`. + + Args: + n (Int, optional): The length of sequence of points to draw. + Default: 1 + out (Tensor, optional): The output tensor + dtype (:class:`torch.dtype`, optional): the desired data type of the + returned tensor. + Default: ``None`` + """ + if dtype is None: + dtype = torch.get_default_dtype() + + if self.num_generated == 0: + if n == 1: + result = self._first_point.to(dtype) + else: + result, self.quasi = torch._sobol_engine_draw( + self.quasi, + n - 1, + self.sobolstate, + self.dimension, + self.num_generated, + dtype=dtype, + ) + result = torch.cat((self._first_point.to(dtype), result), dim=-2) + else: + result, self.quasi = torch._sobol_engine_draw( + self.quasi, + n, + self.sobolstate, + self.dimension, + self.num_generated - 1, + dtype=dtype, + ) + + self.num_generated += n + + if out is not None: + out.resize_as_(result).copy_(result) + return out + + return result + + def draw_base2( + self, + m: int, + out: torch.Tensor | None = None, + dtype: torch.dtype | None = None, + ) -> torch.Tensor: + r""" + Function to draw a sequence of :attr:`2**m` points from a Sobol sequence. + Note that the samples are dependent on the previous samples. The size + of the result is :math:`(2**m, dimension)`. + + Args: + m (Int): The (base2) exponent of the number of points to draw. + out (Tensor, optional): The output tensor + dtype (:class:`torch.dtype`, optional): the desired data type of the + returned tensor. + Default: ``None`` + """ + n = 2**m + total_n = self.num_generated + n + if not (total_n & (total_n - 1) == 0): + raise ValueError( + "The balance properties of Sobol' points require " + f"n to be a power of 2. {self.num_generated} points have been " + f"previously generated, then: n={self.num_generated}+2**{m}={total_n}. " + "If you still want to do this, please use " + "'SobolEngine.draw()' instead." + ) + return self.draw(n=n, out=out, dtype=dtype) + + def reset(self): + r""" + Function to reset the ``SobolEngine`` to base state. + """ + self.quasi.copy_(self.shift) + self.num_generated = 0 + return self + + def fast_forward(self, n): + r""" + Function to fast-forward the state of the ``SobolEngine`` by + :attr:`n` steps. This is equivalent to drawing :attr:`n` samples + without using the samples. + + Args: + n (Int): The number of steps to fast-forward by. + """ + if self.num_generated == 0: + torch._sobol_engine_ff_( + self.quasi, n - 1, self.sobolstate, self.dimension, self.num_generated + ) + else: + torch._sobol_engine_ff_( + self.quasi, n, self.sobolstate, self.dimension, self.num_generated - 1 + ) + self.num_generated += n + return self + + def _scramble(self): + g: torch.Generator | None = None + if self.seed is not None: + g = torch.Generator() + g.manual_seed(self.seed) + + cpu = torch.device("cpu") + + # Generate shift vector + shift_ints = torch.randint( + 2, (self.dimension, self.MAXBIT), device=cpu, generator=g + ) + self.shift = torch.mv( + shift_ints, torch.pow(2, torch.arange(0, self.MAXBIT, device=cpu)) + ) + + # Generate lower triangular matrices (stacked across dimensions) + ltm_dims = (self.dimension, self.MAXBIT, self.MAXBIT) + ltm = torch.randint(2, ltm_dims, device=cpu, generator=g).tril() + + torch._sobol_engine_scramble_(self.sobolstate, ltm, self.dimension) + + def __repr__(self): + fmt_string = [f"dimension={self.dimension}"] + if self.scramble: + fmt_string += ["scramble=True"] + if self.seed is not None: + fmt_string += [f"seed={self.seed}"] + return self.__class__.__name__ + "(" + ", ".join(fmt_string) + ")" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/random.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/random.py new file mode 100644 index 0000000000000000000000000000000000000000..9de5b216c6681c79500b307aa618f876d5c5e215 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/random.py @@ -0,0 +1,207 @@ +# mypy: allow-untyped-defs +import contextlib +import warnings +from collections.abc import Generator + +import torch +from torch._C import default_generator + + +def set_rng_state(new_state: torch.Tensor) -> None: + r"""Sets the random number generator state. + + .. note:: This function only works for CPU. For CUDA, please use + :func:`torch.manual_seed`, which works for both CPU and CUDA. + + Args: + new_state (torch.ByteTensor): The desired state + """ + default_generator.set_state(new_state) + + +def get_rng_state() -> torch.Tensor: + r"""Returns the random number generator state as a `torch.ByteTensor`. + + .. note:: The returned state is for the default generator on CPU only. + + See also: :func:`torch.random.fork_rng`. + """ + return default_generator.get_state() + + +def manual_seed(seed) -> torch._C.Generator: + r"""Sets the seed for generating random numbers on all devices. Returns a + `torch.Generator` object. + + Args: + seed (int): The desired seed. Value must be within the inclusive range + `[-0x8000_0000_0000_0000, 0xffff_ffff_ffff_ffff]`. Otherwise, a RuntimeError + is raised. Negative inputs are remapped to positive values with the formula + `0xffff_ffff_ffff_ffff + seed`. + """ + return _manual_seed_impl(seed) + + +def _manual_seed_impl(seed) -> torch._C.Generator: + seed = int(seed) + import torch.cuda + + if not torch.cuda._is_in_bad_fork(): + torch.cuda.manual_seed_all(seed) + + import torch.mps + + if not torch.mps._is_in_bad_fork(): + torch.mps.manual_seed(seed) + + import torch.xpu + + if not torch.xpu._is_in_bad_fork(): + torch.xpu.manual_seed_all(seed) + + _seed_custom_device(seed) + + return default_generator.manual_seed(seed) + + +def seed() -> int: + r"""Sets the seed for generating random numbers to a non-deterministic + random number on all devices. Returns a 64 bit number used to seed the RNG. + """ + seed = default_generator.seed() + import torch.cuda + + if not torch.cuda._is_in_bad_fork(): + torch.cuda.manual_seed_all(seed) + + import torch.mps + + if not torch.mps._is_in_bad_fork(): + torch.mps.manual_seed(seed) + + import torch.xpu + + if not torch.xpu._is_in_bad_fork(): + torch.xpu.manual_seed_all(seed) + + _seed_custom_device(seed) + + return seed + + +def _seed_custom_device(seed) -> None: + r"""Sets the seed to generate random numbers for custom device. + + Args: + seed (int): The desired seed. + + See [Note: support the custom device with privateuse1] + """ + seed = int(seed) + custom_backend_name = torch._C._get_privateuse1_backend_name() + if hasattr(torch, custom_backend_name): + custom_device_mod = getattr(torch, custom_backend_name) + _bad_fork_name = "_is_in_bad_fork" + _seed_all_name = "manual_seed_all" + if hasattr(custom_device_mod, _bad_fork_name) and hasattr( + custom_device_mod, _seed_all_name + ): + if not getattr(custom_device_mod, _bad_fork_name)(): + getattr(custom_device_mod, _seed_all_name)(seed) + else: + message = f"Set seed for `{custom_backend_name}` device does not take effect, please add API's " + message += f"`{_bad_fork_name}` and `{_seed_all_name}` to `{custom_backend_name}` device module." + warnings.warn(message, UserWarning, stacklevel=3) + + +def initial_seed() -> int: + r"""Returns the initial seed for generating random numbers as a + Python `long`. + + .. note:: The returned seed is for the default generator on CPU only. + """ + return default_generator.initial_seed() + + +_fork_rng_warned_already = False + + +@contextlib.contextmanager +def fork_rng( + devices=None, + enabled=True, + _caller="fork_rng", + _devices_kw="devices", + device_type="cuda", +) -> Generator: + """ + Forks the RNG, so that when you return, the RNG is reset + to the state that it was previously in. + + Args: + devices (iterable of Device IDs): devices for which to fork + the RNG. CPU RNG state is always forked. By default, :meth:`fork_rng` operates + on all devices, but will emit a warning if your machine has a lot + of devices, since this function will run very slowly in that case. + If you explicitly specify devices, this warning will be suppressed + enabled (bool): if ``False``, the RNG is not forked. This is a convenience + argument for easily disabling the context manager without having + to delete it and unindent your Python code under it. + device_type (str): device type str, default is `cuda`. As for supported device, + see details in :ref:`accelerator` + """ + + if device_type == "meta": + yield + return + + device_type = torch.device(device_type).type + device_mod = getattr(torch, device_type, None) + if device_mod is None: + raise RuntimeError( + f"torch has no module of `{device_type}`, you should register " + + "a module by `torch._register_device_module`." + ) + global _fork_rng_warned_already + + # Internal arguments: + # _caller: the function which called fork_rng, which the user used + # _devices_kw: the devices keyword of _caller + + if not enabled: + yield + return + + if devices is None: + num_devices = device_mod.device_count() + if num_devices > 1 and not _fork_rng_warned_already: + message = ( + f"{device_type.upper()} reports that you have {num_devices} available devices, and " + f"you have used {_caller} without explicitly specifying which devices are being used. " + f"For safety, we initialize *every* {device_type.upper()} device by default, which can " + f"be quite slow if you have a lot of {device_type.upper()}s. If you know that you are only" + f" making use of a few {device_type.upper()} devices, set the environment variable " + f"{device_type.upper()}_VISIBLE_DEVICES or the '{_devices_kw}' keyword argument of {_caller} " + "with the set of devices you are actually using. For example, if you are using CPU only, " + "set device.upper()_VISIBLE_DEVICES= or devices=[]; if you are using device 0 only, " + f"set {device_type.upper()}_VISIBLE_DEVICES=0 or devices=[0]. To initialize all devices " + f"and suppress this warning, set the '{_devices_kw}' keyword argument to " + f"`range(torch.{device_type}.device_count())`." + ) + warnings.warn(message, stacklevel=2) + _fork_rng_warned_already = True + devices = list(range(num_devices)) + else: + # Protect against user passing us a generator; we need to traverse this + # multiple times but a generator will be exhausted upon first traversal + devices = list(devices) + + cpu_rng_state = torch.get_rng_state() + device_rng_states = [device_mod.get_rng_state(device) for device in devices] + + try: + yield + finally: + torch.set_rng_state(cpu_rng_state) + for device, device_rng_state in zip(devices, device_rng_states): + device_mod.set_rng_state(device_rng_state, device) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/return_types.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/return_types.py new file mode 100644 index 0000000000000000000000000000000000000000..950406023fa161d0896fdd12823fd451f1dba7a0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/return_types.py @@ -0,0 +1,51 @@ +import inspect + +import torch +from torch.utils._pytree import register_pytree_node, SequenceKey + + +__all__ = ["pytree_register_structseq", "all_return_types"] + +all_return_types = [] + +# error: Module has no attribute "_return_types" +return_types = torch._C._return_types # type: ignore[attr-defined] + + +def pytree_register_structseq(cls): + def structseq_flatten(structseq): + return list(structseq), None + + def structseq_flatten_with_keys(structseq): + values, context = structseq_flatten(structseq) + return [(SequenceKey(i), v) for i, v in enumerate(values)], context + + def structseq_unflatten(values, context): + return cls(values) + + register_pytree_node( + cls, + structseq_flatten, + structseq_unflatten, + flatten_with_keys_fn=structseq_flatten_with_keys, + ) + + +for name in dir(return_types): + if name.startswith("__"): + continue + + _attr = getattr(return_types, name) + globals()[name] = _attr + + if not name.startswith("_"): + __all__.append(name) + all_return_types.append(_attr) + + # Today everything in torch.return_types is a structseq, aka a "namedtuple"-like + # thing defined by the Python C-API. We're going to need to modify this when that + # is no longer the case. + # NB: I don't know how to check that something is a "structseq" so we do a fuzzy + # check for tuple + if inspect.isclass(_attr) and issubclass(_attr, tuple): + pytree_register_structseq(_attr) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/return_types.pyi b/TTS/Kokoro/.venv/Lib/site-packages/torch/return_types.pyi new file mode 100644 index 0000000000000000000000000000000000000000..1b4b9814d0fc59e9660c2dcb2a42362489aeab00 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/return_types.pyi @@ -0,0 +1,605 @@ +# @generated by tools/pyi/gen_pyi.py from torch/_C/return_types.pyi.in +# mypy: allow-untyped-defs + +from typing import Final, NoReturn +from typing_extensions import Self + +from torch import SymInt, Tensor +from torch.types import ( # noqa: F401 + _bool, + _device, + _dtype, + _float, + _int, + _layout, + _qscheme, + _size, + Number, +) + +__all__ = [ + "pytree_register_structseq", + "all_return_types", + "_fake_quantize_per_tensor_affine_cachemask_tensor_qparams", + "_fused_moving_avg_obs_fq_helper", + "_linalg_det", + "_linalg_eigh", + "_linalg_slogdet", + "_linalg_solve_ex", + "_linalg_svd", + "_lu_with_info", + "_scaled_dot_product_cudnn_attention", + "_scaled_dot_product_efficient_attention", + "_scaled_dot_product_flash_attention", + "_scaled_dot_product_flash_attention_for_cpu", + "_unpack_dual", + "aminmax", + "cummax", + "cummin", + "frexp", + "geqrf", + "histogram", + "histogramdd", + "kthvalue", + "lu_unpack", + "max", + "median", + "min", + "mode", + "nanmedian", + "qr", + "slogdet", + "sort", + "svd", + "topk", + "triangular_solve", +] + +def pytree_register_structseq(cls: type) -> None: ... + +class _fake_quantize_per_tensor_affine_cachemask_tensor_qparams(tuple[Tensor, Tensor]): # fmt: skip + @property + def output(self) -> Tensor: ... + @property + def mask(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class _fused_moving_avg_obs_fq_helper(tuple[Tensor, Tensor]): # fmt: skip + @property + def output(self) -> Tensor: ... + @property + def mask(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class _linalg_det(tuple[Tensor, Tensor, Tensor]): # fmt: skip + @property + def result(self) -> Tensor: ... + @property + def LU(self) -> Tensor: ... + @property + def pivots(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 3 + n_sequence_fields: Final[_int] = 3 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class _linalg_eigh(tuple[Tensor, Tensor]): # fmt: skip + @property + def eigenvalues(self) -> Tensor: ... + @property + def eigenvectors(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class _linalg_slogdet(tuple[Tensor, Tensor, Tensor, Tensor]): # fmt: skip + @property + def sign(self) -> Tensor: ... + @property + def logabsdet(self) -> Tensor: ... + @property + def LU(self) -> Tensor: ... + @property + def pivots(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor, Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 4 + n_sequence_fields: Final[_int] = 4 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class _linalg_solve_ex(tuple[Tensor, Tensor, Tensor, Tensor]): # fmt: skip + @property + def result(self) -> Tensor: ... + @property + def LU(self) -> Tensor: ... + @property + def pivots(self) -> Tensor: ... + @property + def info(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor, Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 4 + n_sequence_fields: Final[_int] = 4 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class _linalg_svd(tuple[Tensor, Tensor, Tensor]): # fmt: skip + @property + def U(self) -> Tensor: ... + @property + def S(self) -> Tensor: ... + @property + def Vh(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 3 + n_sequence_fields: Final[_int] = 3 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class _lu_with_info(tuple[Tensor, Tensor, Tensor]): # fmt: skip + @property + def LU(self) -> Tensor: ... + @property + def pivots(self) -> Tensor: ... + @property + def info(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 3 + n_sequence_fields: Final[_int] = 3 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class _scaled_dot_product_cudnn_attention(tuple[Tensor, Tensor, Tensor, Tensor, _int | SymInt, _int | SymInt, Tensor, Tensor, Tensor]): # fmt: skip + @property + def output(self) -> Tensor: ... + @property + def logsumexp(self) -> Tensor: ... + @property + def cum_seq_q(self) -> Tensor: ... + @property + def cum_seq_k(self) -> Tensor: ... + @property + def max_q(self) -> _int | SymInt: ... + @property + def max_k(self) -> _int | SymInt: ... + @property + def philox_seed(self) -> Tensor: ... + @property + def philox_offset(self) -> Tensor: ... + @property + def debug_attn_mask(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor, Tensor, Tensor, _int | SymInt, _int | SymInt, Tensor, Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 9 + n_sequence_fields: Final[_int] = 9 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class _scaled_dot_product_efficient_attention(tuple[Tensor, Tensor, Tensor, Tensor]): # fmt: skip + @property + def output(self) -> Tensor: ... + @property + def log_sumexp(self) -> Tensor: ... + @property + def philox_seed(self) -> Tensor: ... + @property + def philox_offset(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor, Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 4 + n_sequence_fields: Final[_int] = 4 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class _scaled_dot_product_flash_attention(tuple[Tensor, Tensor, Tensor, Tensor, _int | SymInt, _int | SymInt, Tensor, Tensor, Tensor]): # fmt: skip + @property + def output(self) -> Tensor: ... + @property + def logsumexp(self) -> Tensor: ... + @property + def cum_seq_q(self) -> Tensor: ... + @property + def cum_seq_k(self) -> Tensor: ... + @property + def max_q(self) -> _int | SymInt: ... + @property + def max_k(self) -> _int | SymInt: ... + @property + def rng_state(self) -> Tensor: ... + @property + def unused(self) -> Tensor: ... + @property + def debug_attn_mask(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor, Tensor, Tensor, _int | SymInt, _int | SymInt, Tensor, Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 9 + n_sequence_fields: Final[_int] = 9 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class _scaled_dot_product_flash_attention_for_cpu(tuple[Tensor, Tensor]): # fmt: skip + @property + def output(self) -> Tensor: ... + @property + def logsumexp(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class _unpack_dual(tuple[Tensor, Tensor]): # fmt: skip + @property + def primal(self) -> Tensor: ... + @property + def tangent(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class aminmax(tuple[Tensor, Tensor]): # fmt: skip + @property + def min(self) -> Tensor: ... + @property + def max(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class cummax(tuple[Tensor, Tensor]): # fmt: skip + @property + def values(self) -> Tensor: ... + @property + def indices(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class cummin(tuple[Tensor, Tensor]): # fmt: skip + @property + def values(self) -> Tensor: ... + @property + def indices(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class frexp(tuple[Tensor, Tensor]): # fmt: skip + @property + def mantissa(self) -> Tensor: ... + @property + def exponent(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class geqrf(tuple[Tensor, Tensor]): # fmt: skip + @property + def a(self) -> Tensor: ... + @property + def tau(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class histogram(tuple[Tensor, Tensor]): # fmt: skip + @property + def hist(self) -> Tensor: ... + @property + def bin_edges(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class histogramdd(tuple[Tensor, tuple[Tensor, ...]]): # fmt: skip + @property + def hist(self) -> Tensor: ... + @property + def bin_edges(self) -> tuple[Tensor, ...]: ... + def __new__( + cls, + sequence: tuple[Tensor, tuple[Tensor, ...]], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class kthvalue(tuple[Tensor, Tensor]): # fmt: skip + @property + def values(self) -> Tensor: ... + @property + def indices(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class lu_unpack(tuple[Tensor, Tensor, Tensor]): # fmt: skip + @property + def P(self) -> Tensor: ... + @property + def L(self) -> Tensor: ... + @property + def U(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 3 + n_sequence_fields: Final[_int] = 3 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class max(tuple[Tensor, Tensor]): # fmt: skip + @property + def values(self) -> Tensor: ... + @property + def indices(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class median(tuple[Tensor, Tensor]): # fmt: skip + @property + def values(self) -> Tensor: ... + @property + def indices(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class min(tuple[Tensor, Tensor]): # fmt: skip + @property + def values(self) -> Tensor: ... + @property + def indices(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class mode(tuple[Tensor, Tensor]): # fmt: skip + @property + def values(self) -> Tensor: ... + @property + def indices(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class nanmedian(tuple[Tensor, Tensor]): # fmt: skip + @property + def values(self) -> Tensor: ... + @property + def indices(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class qr(tuple[Tensor, Tensor]): # fmt: skip + @property + def Q(self) -> Tensor: ... + @property + def R(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class slogdet(tuple[Tensor, Tensor]): # fmt: skip + @property + def sign(self) -> Tensor: ... + @property + def logabsdet(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class sort(tuple[Tensor, Tensor]): # fmt: skip + @property + def values(self) -> Tensor: ... + @property + def indices(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class svd(tuple[Tensor, Tensor, Tensor]): # fmt: skip + @property + def U(self) -> Tensor: ... + @property + def S(self) -> Tensor: ... + @property + def V(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 3 + n_sequence_fields: Final[_int] = 3 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class topk(tuple[Tensor, Tensor]): # fmt: skip + @property + def values(self) -> Tensor: ... + @property + def indices(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +class triangular_solve(tuple[Tensor, Tensor]): # fmt: skip + @property + def solution(self) -> Tensor: ... + @property + def cloned_coefficient(self) -> Tensor: ... + def __new__( + cls, + sequence: tuple[Tensor, Tensor], + ) -> Self: # fmt: skip + ... + n_fields: Final[_int] = 2 + n_sequence_fields: Final[_int] = 2 + n_unnamed_fields: Final[_int] = 0 + def __init_subclass__(cls) -> NoReturn: ... # prohibit subclassing + +all_return_types: list[type] = ... diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/serialization.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/serialization.py new file mode 100644 index 0000000000000000000000000000000000000000..95f6d3e9ab4b3487240538f9ebe711089719e7f2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/serialization.py @@ -0,0 +1,2154 @@ +# mypy: allow-untyped-defs +import copyreg +import difflib +import functools +import io +import os +import pickle +import re +import shutil +import struct +import sys +import tarfile +import tempfile +import threading +import warnings +from collections.abc import Callable +from contextlib import closing, contextmanager +from enum import Enum +from typing import Any, cast, Generic, IO, TypeAlias, TypeVar +from typing_extensions import TypeIs + +import torch +import torch._weights_only_unpickler as _weights_only_unpickler +from torch._sources import get_source_lines_and_file +from torch._utils import _import_dotted_name +from torch.storage import _get_dtype_from_pickle_storage_type +from torch.types import FileLike, Storage + + +__all__ = [ + "SourceChangeWarning", + "mkdtemp", + "register_package", + "check_module_version_greater_or_equal", + "validate_cuda_device", + "validate_hpu_device", + "location_tag", + "default_restore_location", + "normalize_storage_type", + "storage_to_tensor_type", + "save", + "load", + "StorageType", + "LoadEndianness", + "get_crc32_options", + "set_crc32_options", + "get_default_load_endianness", + "set_default_load_endianness", + "get_default_mmap_options", + "set_default_mmap_options", + "clear_safe_globals", + "get_safe_globals", + "add_safe_globals", + "safe_globals", + "get_unsafe_globals_in_checkpoint", + "skip_data", +] + +DEFAULT_PROTOCOL = 2 + +LONG_SIZE = struct.Struct("=l").size +INT_SIZE = struct.Struct("=i").size +SHORT_SIZE = struct.Struct("=h").size + +MAGIC_NUMBER = 0x1950A86A20F9469CFC6C +PROTOCOL_VERSION = 1001 +STORAGE_KEY_SEPARATOR = "," + +MAP_LOCATION: TypeAlias = ( + Callable[[Storage, str], Storage] | torch.device | str | dict[str, str] | None +) +STORAGE: TypeAlias = Storage | torch.storage.TypedStorage | torch.UntypedStorage + +IS_WINDOWS = sys.platform == "win32" + +UNSAFE_MESSAGE = ( + "In PyTorch 2.6, we changed the default value of the `weights_only` argument in `torch.load` " + "from `False` to `True`. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, " + "but it can result in arbitrary code execution. Do it only if you got the file from a " + "trusted source." +) + +if not IS_WINDOWS: + from mmap import MAP_PRIVATE, MAP_SHARED +else: + MAP_SHARED, MAP_PRIVATE = None, None # type: ignore[assignment] + + +def _default_to_weights_only(pickle_module): + is_fbcode = not hasattr(torch.version, "git_version") + return pickle_module is None and not is_fbcode + + +# _serialization_tls is used to store thread local state specific to serialization +# that needs to be propagated to other files, in particular we use this for +# (1) map_location (needed for wrapper subclasses/third party devices to torch._utils) +# (2) skip_data (needed for torch.Tensor.__reduce_ex__ for skip_data ctx) +# (3) materialize_fake_tensors (needed for torch.Tensor.__reduce_ex__ for skip_data ctx) +class _SerializationLocal(threading.local): + def __init__(self): + super().__init__() + self.map_location: MAP_LOCATION | None = None + self.skip_data: bool = False + self.materialize_fake_tensors: bool = False + + +_serialization_tls = _SerializationLocal() + + +class SourceChangeWarning(Warning): + pass + + +@contextmanager +def mkdtemp(): + path = tempfile.mkdtemp() + try: + yield path + finally: + shutil.rmtree(path) + + +_package_registry: list[ + tuple[ + int, + Callable[[STORAGE], str | None], + Callable[[STORAGE, str], STORAGE | None], + ] +] = [] + + +class LoadEndianness(Enum): + NATIVE = 1 + LITTLE = 2 + BIG = 3 + + +def get_default_load_endianness() -> LoadEndianness | None: + """ + Get fallback byte order for loading files + + If byteorder mark is not present in saved checkpoint, + this byte order is used as fallback. + By default, it's "native" byte order. + + Returns: + default_load_endian: Optional[LoadEndianness] + """ + from torch.utils.serialization import config + + return config.load.endianness + + +def set_default_load_endianness(endianness): + """ + Set fallback byte order for loading files + + If byteorder mark is not present in saved checkpoint, + this byte order is used as fallback. + By default, it's "native" byte order. + + Args: + endianness: the new fallback byte order + """ + if not isinstance(endianness, LoadEndianness) and endianness is not None: + raise TypeError("Invalid argument type in function set_default_load_endianness") + from torch.utils.serialization import config + + config.load.endianness = endianness + + +def get_crc32_options() -> bool: + """ + Get whether :func:`torch.save` computes and writes crc32 for each record. + + Defaults to ``True``. + """ + from torch.utils.serialization import config + + return config.save.compute_crc32 + + +def set_crc32_options(compute_crc32: bool): + """ + Set whether :func:`torch.save` computes and writes crc32 for each record. + + .. note:: + Setting this to ``False`` may make unzipping of the ``torch.save`` output + fail or warn due to corrupted CRC32. However ``torch.load`` will be + able to load the file. + + Args: + compute_crc32 (bool): set crc32 computation flag + """ + from torch.utils.serialization import config + + config.save.compute_crc32 = compute_crc32 + + +def get_default_mmap_options() -> int | None: + """ + Get default mmap options for :func:`torch.load` with ``mmap=True``. + + Defaults to ``mmap.MAP_PRIVATE``. + + + Returns: + default_mmap_options: int + """ + from torch.utils.serialization import config + + return config.load.mmap_flags + + +def _get_storage_alignment() -> int: + """ + Gets alignment for storages in torch.save files/ + + Defaults to 64. + + Returns: + storage_alginment: int + """ + from torch.utils.serialization import config + + return config.save.storage_alignment + + +class set_default_mmap_options: + """ + Context manager or function to set default mmap options for :func:`torch.load` with ``mmap=True`` to flags. + + For now, only either ``mmap.MAP_PRIVATE`` or ``mmap.MAP_SHARED`` are supported. + Please open an issue if you need any other option to be added here. + + .. note:: + This feature is currently not supported for Windows. + + Args: + flags: ``mmap.MAP_PRIVATE`` or ``mmap.MAP_SHARED`` + """ + + def __init__(self, flags: int) -> None: + if IS_WINDOWS: + raise RuntimeError( + "Changing the default mmap options is currently not supported for Windows" + ) + if flags != MAP_PRIVATE and flags != MAP_SHARED: + raise ValueError( + "Invalid argument in function set_default_mmap_options, " + f"expected mmap.MAP_PRIVATE or mmap.MAP_SHARED, but got {flags}" + ) + # global config + from torch.utils.serialization import config + + self.prev = config.load.mmap_flags + config.load.mmap_flags = flags + + def __enter__(self) -> None: + pass + + def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: + from torch.utils.serialization import config + + config.load.mmap_flags = self.prev + + +def clear_safe_globals() -> None: + """ + Clears the list of globals that are safe for ``weights_only`` load. + """ + _weights_only_unpickler._clear_safe_globals() + + +def get_safe_globals() -> list[Callable | tuple[Callable, str]]: + """ + Returns the list of user-added globals that are safe for ``weights_only`` load. + """ + return _weights_only_unpickler._get_safe_globals() + + +def add_safe_globals(safe_globals: list[Callable | tuple[Callable, str]]) -> None: + """ + Marks the given globals as safe for ``weights_only`` load. For example, functions + added to this list can be called during unpickling, classes could be instantiated + and have state set. + + Each item in the list can either be a function/class or a tuple of the form + (function/class, string) where string is the full path of the function/class. + + Within the serialized format, each function is identified with its full + path as ``{__module__}.{__qualname__}``. When calling this API, you can provide this + full path that should match the one in the checkpoint otherwise the default + ``{fn.__module__}.{fn.__qualname__}`` will be used. + + Args: + safe_globals (List[Union[Callable, Tuple[Callable, str]]]): list of globals to mark as safe + + Example: + >>> # xdoctest: +SKIP("Can't torch.save(t, ...) as doctest thinks MyTensor is defined on torch.serialization") + >>> import tempfile + >>> class MyTensor(torch.Tensor): + ... pass + >>> t = MyTensor(torch.randn(2, 3)) + >>> with tempfile.NamedTemporaryFile() as f: + ... torch.save(t, f.name) + # Running `torch.load(f.name, weights_only=True)` will fail with + # Unsupported global: GLOBAL __main__.MyTensor was not an allowed global by default. + # Check the code and make sure MyTensor is safe to be used when loaded from an arbitrary checkpoint. + ... torch.serialization.add_safe_globals([MyTensor]) + ... torch.load(f.name, weights_only=True) + # MyTensor([[-0.5024, -1.8152, -0.5455], + # [-0.8234, 2.0500, -0.3657]]) + """ + _weights_only_unpickler._add_safe_globals(safe_globals) + + +class safe_globals(_weights_only_unpickler._safe_globals): + r"""Context-manager that adds certain globals as safe for ``weights_only`` load. + + Args: + safe_globals: List of globals for weights_only load. + + Example: + >>> # xdoctest: +SKIP("Can't torch.save(t, ...) as doctest thinks MyTensor is defined on torch.serialization") + >>> import tempfile + >>> class MyTensor(torch.Tensor): + ... pass + >>> t = MyTensor(torch.randn(2, 3)) + >>> with tempfile.NamedTemporaryFile() as f: + ... torch.save(t, f.name) + # Running `torch.load(f.name, weights_only=True)` will fail with + # Unsupported global: GLOBAL __main__.MyTensor was not an allowed global by default. + # Check the code and make sure MyTensor is safe to be used when loaded from an arbitrary checkpoint. + ... with torch.serialization.safe_globals([MyTensor]): + ... torch.load(f.name, weights_only=True) + # MyTensor([[-0.5024, -1.8152, -0.5455], + # [-0.8234, 2.0500, -0.3657]]) + >>> assert torch.serialization.get_safe_globals() == [] + """ + + +def get_unsafe_globals_in_checkpoint(f: FileLike) -> list[str]: + """Returns a list of strings of functions/classes in a ``torch.save`` object that are not safe for ``weights_only``. + + For a given function or class ``f``, the corresponding string will be of the form + ``{f.__module__}.{f.__name__}``. + + This function will return any GLOBALs in the checkpoint that are not in the set marked safe + for ``weights_only`` (either via :func:`add_safe_globals` or :class:`safe_globals` context or + allowlisted by ``torch`` by default). + + .. note:: + This function will statically disassemble the pickle file in the checkpoint. + The implication is any classes dynamically pushed onto the stack during unpickling + will not be included in the output. + + Args: + f: File-like object or string containing the checkpoint object saved via ``torch.save`` + + Returns: + A list of strings of pickle GLOBALs in the checkpoint that are not allowlisted for ``weights_only``. + """ + default_safe_globals_strings = set( + _weights_only_unpickler._get_allowed_globals().keys() + ) + user_safe_global_strings = set( + _weights_only_unpickler._get_user_allowed_globals().keys() + ) + safe_global_strings = default_safe_globals_strings.union(user_safe_global_strings) + + with _open_file_like(f, "rb") as opened_file: + if not _is_zipfile(opened_file): + raise ValueError("Expected input to be a checkpoint returned by torch.save") + with _open_zipfile_reader(opened_file) as zip_file: + if _is_torchscript_zip(zip_file): + raise ValueError( + "Expected input to be a checkpoint returned by torch.save but got a torchscript checkpoint" + ) + data_file = io.BytesIO(zip_file.get_record("data.pkl")) + all_globals = _weights_only_unpickler.get_globals_in_pkl(data_file) + return list(all_globals.difference(safe_global_strings)) + + +class skip_data: + """ + Context-manager that skips writing/reading storage bytes for ``torch.save`` / ``torch.load`` calls. + + For the save path, storages will still be saved, but the space that their bytes would usually be written to + will be empty space. The storage bytes can then be populated in a separate pass. + + For the load path, tensors will be loaded per the checkpoint but their storages will not be populated with data. + + .. warning:: + The ``skip_data`` context manager is an early prototype and is subject to change. + + Args: + materialize_fake_tensors: Whether to materialize FakeTensors during save. This is a no-op for the load path. + + Example: + >>> # xdoctest: +SKIP("NamedTemporaryFile on Windows") + >>> import tempfile + >>> t = torch.randn(2, 3) + >>> with tempfile.NamedTemporaryFile() as f: + ... with torch.serialization.skip_data(): + ... torch.save(t, f.name) + ... torch.load(f.name, weights_only=True) + tensor([[0., 0., 0.], + [0., 0., 0.]]) + """ + + def __init__(self, materialize_fake_tensors: bool = False): + self.materialize_fake_tensors = materialize_fake_tensors + + def __enter__(self): + global _serialization_tls + self._old_skip_data = _serialization_tls.skip_data + self._old_materialize_fake_tensors = _serialization_tls.materialize_fake_tensors + _serialization_tls.skip_data = True + _serialization_tls.materialize_fake_tensors = self.materialize_fake_tensors + + def __exit__(self, type, value, tb): + global _serialization_tls + _serialization_tls.skip_data = self._old_skip_data + _serialization_tls.materialize_fake_tensors = self._old_materialize_fake_tensors + + +def _is_zipfile(f) -> bool: + # This is a stricter implementation than zipfile.is_zipfile(). + # zipfile.is_zipfile() is True if the magic number appears anywhere in the + # binary. Since we expect the files here to be generated by torch.save or + # torch.jit.save, it's safe to only check the start bytes and avoid + # collisions and assume the zip has only 1 file. + # See bugs.python.org/issue28494. + + start = f.tell() + # Read the first few bytes and match against the ZIP file signature + local_header_magic_number = b"PK\x03\x04" + read_bytes = f.read(len(local_header_magic_number)) + f.seek(start) + return read_bytes == local_header_magic_number + + +def register_package( + priority: int, + tagger: Callable[[STORAGE], str | None], + deserializer: Callable[[STORAGE, str], STORAGE | None], +): + """ + Registers callables for tagging and deserializing storage objects with an associated priority. + Tagging associates a device with a storage object at save time while deserializing moves a + storage object to an appropriate device at load time. :attr:`tagger` and :attr:`deserializer` + are run in the order given by their :attr:`priority` until a tagger/deserializer returns a + value that is not `None`. + + To override the deserialization behavior for a device in the global registry, one can register a + tagger with a higher priority than the existing tagger. + + This function can also be used to register a tagger and deserializer for new devices. + + Args: + priority: Indicates the priority associated with the tagger and deserializer, where a lower + value indicates higher priority. + tagger: Callable that takes in a storage object and returns its tagged device as a string + or None. + deserializer: Callable that takes in storage object and a device string and returns a storage + object on the appropriate device or None. + + Returns: + `None` + + Example: + >>> def ipu_tag(obj): + >>> if obj.device.type == 'ipu': + >>> return 'ipu' + >>> def ipu_deserialize(obj, location): + >>> if location.startswith('ipu'): + >>> ipu = getattr(torch, "ipu", None) + >>> assert ipu is not None, "IPU device module is not loaded" + >>> assert torch.ipu.is_available(), "ipu is not available" + >>> return obj.ipu(location) + >>> torch.serialization.register_package(11, ipu_tag, ipu_deserialize) + """ + queue_elem = (priority, tagger, deserializer) + _package_registry.append(queue_elem) + _package_registry.sort() + + +def check_module_version_greater_or_equal( + module, + req_version_tuple, + error_if_malformed=True, +): + """ + Check if a module's version satisfies requirements + + Usually, a module's version string will be like 'x.y.z', which would be represented + as a tuple (x, y, z), but sometimes it could be an unexpected format. If the version + string does not match the given tuple's format up to the length of the tuple, then + error and exit or emit a warning. + + Args: + module: the module to check the version of + req_version_tuple: tuple (usually of ints) representing the required version + error_if_malformed: whether we should exit if module version string is malformed + + Returns: + requirement_is_met: bool + """ + try: + version_strs = module.__version__.split(".") + # Cast module version fields to match the types of the required version + module_version = tuple( + type(req_field)(version_strs[idx]) + for idx, req_field in enumerate(req_version_tuple) + ) + requirement_is_met = module_version >= req_version_tuple + + except Exception as e: + message = ( + f"'{module.__name__}' module version string is malformed '{module.__version__}' and cannot be compared" + f" with tuple {str(req_version_tuple)}" + ) + if error_if_malformed: + raise RuntimeError(message) from e + else: + warnings.warn( + message + ", but continuing assuming that requirement is met", + stacklevel=2, + ) + requirement_is_met = True + + return requirement_is_met + + +def _cpu_tag(obj): + if obj.device.type == "cpu": + return "cpu" + + +def _mps_tag(obj): + if obj.device.type == "mps": + return "mps" + + +def _meta_tag(obj): + if obj.device.type == "meta": + return "meta" + + +def _backend_tag(backend_name, obj): + if backend_name == "privateuse1": + backend_name = torch._C._get_privateuse1_backend_name() + if obj.device.type == backend_name: + if obj.device.index is None: + return backend_name + else: + return backend_name + ":" + str(obj.device.index) + + +def _cpu_deserialize(obj, location): + if location == "cpu": + return obj + + +def _mps_deserialize(obj, location): + if location.startswith("mps"): + return obj.mps() + + +def _meta_deserialize(obj, location): + if location == "meta": + return torch.UntypedStorage(obj.nbytes(), device="meta") + + +def _validate_device(location, backend_name): + """ + Check whether the device index of specified backend is valid + + In case of privateuse1 backend, your must first register a device_module for + privateuse1 using torch._register_device_module. Implement the following + methods in device_module like cuda: device_module._utils._get_device_index(location, True), + device_module.device_count(). + + Args: + location: string of device + backend_name: the backend name or the name of privateuse1, which can be renamed + + Returns: + device_index: int + """ + if not hasattr(torch, backend_name): + raise RuntimeError( + f"The {backend_name.upper()} device module is not registered. " + "If you are running on a CPU-only machine, " + "please use torch.load with map_location=torch.device('cpu') " + "to map your storages to the CPU." + ) + device_module = getattr(torch, backend_name) + if hasattr(device_module, "_utils") and hasattr( + device_module._utils, "_get_device_index" + ): + device_index = device_module._utils._get_device_index(location, True) + device = torch.device(backend_name, device_index) + else: + device = torch.device(location) + device_index = device.index if device.index else 0 + if hasattr(device_module, "is_available") and not device_module.is_available(): + raise RuntimeError( + f"Attempting to deserialize object on a {backend_name.upper()} " + f"device but torch.{backend_name}.is_available() is False. " + "If you are running on a CPU-only machine, " + "please use torch.load with map_location=torch.device('cpu') " + "to map your storages to the CPU." + ) + if hasattr(device_module, "device_count"): + device_count = device_module.device_count() + if device_index >= device_count: + raise RuntimeError( + f"Attempting to deserialize object on {backend_name.upper()} device " + f"{device_index} but torch.{backend_name}.device_count() is {device_count}. " + "Please use torch.load with map_location to map your storages " + "to an existing device." + ) + return device + + +def validate_cuda_device(location): + return _validate_device(location, "cuda").index + + +def validate_hpu_device(location): + return _validate_device(location, "hpu").index + + +def _deserialize(backend_name, obj, location): + if backend_name == "privateuse1": + backend_name = torch._C._get_privateuse1_backend_name() + if location.startswith(backend_name): + device = _validate_device(location, backend_name) + return obj.to(device=device) + + +register_package(10, _cpu_tag, _cpu_deserialize) +register_package( + 20, + functools.partial(_backend_tag, "cuda"), + functools.partial(_deserialize, "cuda"), +) +register_package(21, _mps_tag, _mps_deserialize) +register_package(22, _meta_tag, _meta_deserialize) +register_package( + 23, + functools.partial(_backend_tag, "privateuse1"), + functools.partial(_deserialize, "privateuse1"), +) +register_package( + 24, + functools.partial(_backend_tag, "hpu"), + functools.partial(_deserialize, "hpu"), +) +register_package( + 25, + functools.partial(_backend_tag, "xpu"), + functools.partial(_deserialize, "xpu"), +) +register_package( + 26, + functools.partial(_backend_tag, "mtia"), + functools.partial(_deserialize, "mtia"), +) + + +def location_tag( + storage: Storage | torch.storage.TypedStorage | torch.UntypedStorage, +): + for _, tagger, _ in _package_registry: + location = tagger(storage) + if location: + return location + raise RuntimeError( + "don't know how to determine data location of " + torch.typename(storage) + ) + + +def default_restore_location(storage, location): + """ + Restores `storage` using a deserializer function registered for the `location`. + + This function looks in the registry for deserializer functions that match the `location`. + If found, it attempts to use them, in priority order, to restore `storage` until one + returns a not `None` result. If no deserializer can be found in the registry, or all found fail + to bear a result, it raises a `RuntimeError`. + + Args: + storage (STORAGE): the storage object to restore + location (str): the location tag associated with the storage object + + Returns: + storage: Optional[STORAGE] + + Raises: + RuntimeError: If no deserializer matching `location` is found in the registry or if + all matching ones return `None`. + """ + for _, _, fn in _package_registry: + result = fn(storage, location) + if result is not None: + return result + raise RuntimeError( + "don't know how to restore data location of " + + torch.typename(storage) + + " (tagged with " + + location + + ")" + ) + + +def normalize_storage_type(storage_type): + return getattr(torch, storage_type.__name__) + + +def storage_to_tensor_type(storage): + storage_type = type(storage) + module = _import_dotted_name(storage_type.__module__) + return getattr(module, storage_type.__name__.replace("Storage", "Tensor")) + + +def _is_path(name_or_buffer: object) -> TypeIs[str | os.PathLike]: + return isinstance(name_or_buffer, (str, os.PathLike)) + + +T = TypeVar("T") + + +class _opener(Generic[T]): + def __init__(self, file_like: T) -> None: + self.file_like: T = file_like + + def __enter__(self): + return self.file_like + + def __exit__(self, *args): + pass + + +class _open_file(_opener[IO[bytes]]): + def __init__(self, name: str | os.PathLike[str], mode: str) -> None: + super().__init__(open(name, mode)) # noqa: SIM115 + + def __exit__(self, *args): + self.file_like.close() + + +class _open_buffer_reader(_opener[IO[bytes]]): + def __init__(self, buffer: IO[bytes]) -> None: + super().__init__(buffer) + _check_seekable(buffer) + + +class _open_buffer_writer(_opener[IO[bytes]]): + def __exit__(self, *args): + self.file_like.flush() + + +def _open_file_like(name_or_buffer: FileLike, mode: str) -> _opener[IO[bytes]]: + if _is_path(name_or_buffer): + return _open_file(name_or_buffer, mode) + else: + if "w" in mode: + return _open_buffer_writer(name_or_buffer) + elif "r" in mode: + return _open_buffer_reader(name_or_buffer) + else: + raise RuntimeError(f"Expected 'r' or 'w' in mode but got {mode}") + + +class _open_zipfile_reader(_opener[torch._C.PyTorchFileReader]): + def __init__(self, name_or_buffer: str | IO[bytes]) -> None: + super().__init__(torch._C.PyTorchFileReader(name_or_buffer)) + + +class _open_zipfile_writer_file(_opener[torch._C.PyTorchFileWriter]): + def __init__(self, name: str) -> None: + self.file_stream = None + self.name = name + try: + self.name.encode("ascii") + except UnicodeEncodeError: + # PyTorchFileWriter only supports ascii filename. + # For filenames with non-ascii characters, we rely on Python + # for writing out the file. + # pyrefly: ignore [bad-assignment] + self.file_stream = io.FileIO(self.name, mode="w") + super().__init__( + torch._C.PyTorchFileWriter( # pyrefly: ignore # no-matching-overload + self.file_stream, get_crc32_options(), _get_storage_alignment() + ) + ) + else: + super().__init__( + torch._C.PyTorchFileWriter( + self.name, get_crc32_options(), _get_storage_alignment() + ) + ) + + def __exit__(self, *args) -> None: + self.file_like.write_end_of_file() + if self.file_stream is not None: + self.file_stream.close() + + +class _open_zipfile_writer_buffer(_opener[torch._C.PyTorchFileWriter]): + def __init__(self, buffer: IO[bytes]) -> None: + if not callable(getattr(buffer, "write", None)): + msg = f"Buffer of {str(type(buffer)).strip('<>')} has no callable attribute 'write'" + if not hasattr(buffer, "write"): + raise AttributeError(msg) + raise TypeError(msg) + self.buffer = buffer + super().__init__( + torch._C.PyTorchFileWriter( + buffer, get_crc32_options(), _get_storage_alignment() + ) + ) + + def __exit__(self, *args) -> None: + self.file_like.write_end_of_file() + self.buffer.flush() + + +def _open_zipfile_writer(name_or_buffer: str | IO[bytes]) -> _opener: + container: type[_opener] + if _is_path(name_or_buffer): + container = _open_zipfile_writer_file + else: + container = _open_zipfile_writer_buffer + return container(name_or_buffer) # type: ignore[arg-type] + + +def _is_compressed_file(f) -> bool: + compress_modules = ["gzip"] + try: + return f.__module__ in compress_modules + except AttributeError: + return False + + +def _should_read_directly(f): + """ + Checks if f is a file that should be read directly. It should be read + directly if it is backed by a real file (has a fileno) and is not a + a compressed file (e.g. gzip) + """ + if _is_compressed_file(f): + return False + try: + return f.fileno() >= 0 + except io.UnsupportedOperation: + return False + except AttributeError: + return False + + +def _check_seekable(f) -> bool: + def raise_err_msg(patterns, e): + for p in patterns: + if p in str(e): + msg = ( + str(e) + + ". You can only torch.load from a file that is seekable." + + " Please pre-load the data into a buffer like io.BytesIO and" + + " try to load from it instead." + ) + raise type(e)(msg) + raise e + + try: + f.seek(f.tell()) + return True + except (io.UnsupportedOperation, AttributeError) as e: + raise_err_msg(["seek", "tell"], e) + return False + + +def _check_dill_version(pickle_module) -> None: + """Checks if using dill as the pickle module, and if so, checks if it is the correct version. + If dill version is lower than 0.3.1, a ValueError is raised. + + Args: + pickle_module: module used for pickling metadata and objects + + """ + if pickle_module is not None and pickle_module.__name__ == "dill": + required_dill_version = (0, 3, 1) + if not check_module_version_greater_or_equal( + pickle_module, required_dill_version, False + ): + raise ValueError( + ( + "'torch' supports dill >= {}, but you have dill {}." + " Please upgrade dill or switch to 'pickle'" + ).format( + ".".join([str(num) for num in required_dill_version]), + pickle_module.__version__, + ) + ) + + +def _check_save_filelike(f): + if not _is_path(f) and not hasattr(f, "write"): + raise AttributeError( + "expected 'f' to be string, path, or a file-like object with " + "a 'write' attribute" + ) + + +def save( + obj: object, + f: FileLike, + pickle_module: Any = pickle, + pickle_protocol: int = DEFAULT_PROTOCOL, + _use_new_zipfile_serialization: bool = True, + _disable_byteorder_record: bool = False, +) -> None: + # Reference: https://github.com/pytorch/pytorch/issues/54354 + # The first line of this docstring overrides the one Sphinx generates for the + # documentation. We need it so that Sphinx doesn't leak `pickle`s path from + # the build environment (e.g. `>> # xdoctest: +SKIP("makes cwd dirty") + >>> # Save to file + >>> x = torch.tensor([0, 1, 2, 3, 4]) + >>> torch.save(x, "tensor.pt") + >>> # Save to io.BytesIO buffer + >>> buffer = io.BytesIO() + >>> torch.save(x, buffer) + """ + torch._C._log_api_usage_once("torch.save") + _check_dill_version(pickle_module) + _check_save_filelike(f) + + if isinstance(f, (str, os.PathLike)): + f = os.fspath(f) + + if _use_new_zipfile_serialization: + with _open_zipfile_writer(f) as opened_zipfile: + _save( + obj, + opened_zipfile, + pickle_module, + pickle_protocol, + _disable_byteorder_record, + ) + return + else: + global _serialization_tls + if _serialization_tls.skip_data: + raise RuntimeError( + "Cannot use skip_data=True with _use_new_zipfile_serialization=False" + ) + with _open_file_like(f, "wb") as opened_file: + _legacy_save(obj, opened_file, pickle_module, pickle_protocol) + + +def _legacy_save(obj, f, pickle_module, pickle_protocol) -> None: + import torch.nn as nn + + serialized_container_types = {} + serialized_storages: dict[str, tuple[torch.UntypedStorage, torch.dtype]] = {} + + # Since loading storages that view the same data with different dtypes is + # not supported, we need to keep track of the dtype associated with each + # storage data_ptr and throw an error if the dtype is ever different. + # TODO: This feature could be added in the future + storage_dtypes: dict[int, torch.dtype] = {} + + def persistent_id(obj: Any) -> tuple | None: + # FIXME: the docs say that persistent_id should only return a string + # but torch store returns tuples. This works only in the binary protocol + # see + # https://docs.python.org/2/library/pickle.html#pickling-and-unpickling-external-objects + # https://github.com/python/cpython/blob/master/Lib/pickle.py#L527-L537 + if isinstance(obj, type) and issubclass(obj, nn.Module): + if obj in serialized_container_types: + return None + serialized_container_types[obj] = True + source_file = source = None + try: + source_lines, _, source_file = get_source_lines_and_file(obj) + source = "".join(source_lines) + except ( + Exception + ): # saving the source is optional, so we can ignore any errors + warnings.warn( + "Couldn't retrieve source code for container of " + "type " + obj.__name__ + ". It won't be checked " + "for correctness upon loading.", + stacklevel=2, + ) + return ("module", obj, source_file, source) + + if isinstance(obj, torch.storage.TypedStorage) or torch.is_storage(obj): + storage: torch.UntypedStorage + + if isinstance(obj, torch.storage.TypedStorage): + # TODO: Once we decide to break serialization FC, this case + # can be deleted + storage = obj._untyped_storage + storage_dtype = obj.dtype + storage_type_str = obj._pickle_storage_type() + storage_type = getattr(torch, storage_type_str) + dtype = obj.dtype + storage_numel = obj._size() + + elif isinstance(obj, torch.UntypedStorage): + storage = obj + storage_dtype = torch.uint8 + storage_type = normalize_storage_type(type(obj)) + dtype = torch.uint8 + storage_numel = storage.nbytes() + else: + raise TypeError(f"type not recognized: {type(obj)}") + + # If storage is allocated, ensure that any other saved storages + # pointing to the same data all have the same dtype. If storage is + # not allocated, don't perform this check + if storage.data_ptr() != 0: + if storage.data_ptr() in storage_dtypes: + if storage_dtype != storage_dtypes[storage.data_ptr()]: + raise RuntimeError( + "Cannot save multiple tensors or storages that " + "view the same data as different types" + ) + else: + storage_dtypes[storage.data_ptr()] = storage_dtype + + view_metadata: tuple[str, int, int] | None + + # Offset is always 0, but we keep it for backwards compatibility + # with the old serialization format (which supported storage views) + offset = 0 + storage_key = str(storage._cdata) + location = location_tag(storage) + + # TODO: There's an issue here with FC. It might be impossible to + # solve, but it's worth noting. Imagine we save a list `[storage, + # tensor]`, where `tensor.storage()` is the same as `storage`, and + # `tensor.element_size() > 1`. Let's say that `tensor.dtype == + # torch.float`. The storage will be serialized with element size + # of 1, since we're choosing to serialize the first occurrence of + # a duplicate storage. Since this legacy serialization format saves + # the numel of the storage, rather than nbytes directly, we'll be + # effectively saving nbytes in this case. We'll be able to load it + # and the tensor back up with no problems in _this_ and future + # versions of pytorch, but in older versions, here's the problem: + # the storage will be loaded up as a UntypedStorage, and then the + # FloatTensor will loaded and the UntypedStorage will be assigned to + # it. Since the storage dtype does not match the tensor dtype, this + # will cause an error. If we reverse the list, like `[tensor, + # storage]`, then we will save the `tensor.storage()` as a faked + # `FloatStorage`, and the saved size will be the correct + # dtype-specific numel count that old versions expect. `tensor` + # will be able to load up properly in old versions, pointing to + # a FloatStorage. However, `storage` is still being translated to + # a UntypedStorage, and it will try to resolve to the same + # FloatStorage that `tensor` contains. This will also cause an + # error. It doesn't seem like there's any way around this. + # Probably, we just cannot maintain FC for the legacy format if the + # saved list contains both a tensor and a storage that point to the + # same data. We should still be able to maintain FC for lists of + # just tensors, as long as all views share the same dtype as the + # tensor they are viewing. + + if storage_key not in serialized_storages: + serialized_storages[storage_key] = (storage, dtype) + is_view = storage._cdata != storage._cdata + if is_view: + view_metadata = (str(storage._cdata), offset, storage.nbytes()) + else: + view_metadata = None + + res = ( + "storage", + storage_type, + storage_key, + location, + storage_numel, + view_metadata, + ) + return res + return None + + sys_info = { + "protocol_version": PROTOCOL_VERSION, + "little_endian": sys.byteorder == "little", + "type_sizes": { + "short": SHORT_SIZE, + "int": INT_SIZE, + "long": LONG_SIZE, + }, + } + + pickle_module.dump(MAGIC_NUMBER, f, protocol=pickle_protocol) + pickle_module.dump(PROTOCOL_VERSION, f, protocol=pickle_protocol) + pickle_module.dump(sys_info, f, protocol=pickle_protocol) + + class PyTorchLegacyPickler(pickle_module.Pickler): + def persistent_id(self, obj): + return persistent_id(obj) # noqa: F821 + + pickler = PyTorchLegacyPickler(f, protocol=pickle_protocol) + pickler.dump(obj) + + # The class def keeps the persistent_id closure alive, leaking memory. + del persistent_id + + serialized_storage_keys = sorted(serialized_storages.keys()) + pickle_module.dump(serialized_storage_keys, f, protocol=pickle_protocol) + f.flush() + for key in serialized_storage_keys: + storage, dtype = serialized_storages[key] + storage._write_file( + f, _should_read_directly(f), True, torch._utils._element_size(dtype) + ) + + +def _save( + obj, + zip_file, + pickle_module, + pickle_protocol, + _disable_byteorder_record, +): + serialized_storages: dict[str, torch.storage.UntypedStorage] = {} + id_map: dict[int, str] = {} + + # Since loading storages that view the same data with different dtypes is + # not supported, we need to keep track of the dtype associated with each + # storage data_ptr and throw an error if the dtype is ever different. + # TODO: This feature could be added in the future + storage_dtypes: dict[int, torch.dtype] = {} + + def persistent_id(obj): + # FIXME: the docs say that persistent_id should only return a string + # but torch store returns tuples. This works only in the binary protocol + # see + # https://docs.python.org/2/library/pickle.html#pickling-and-unpickling-external-objects + # https://github.com/python/cpython/blob/master/Lib/pickle.py#L527-L537 + if isinstance(obj, torch.storage.TypedStorage) or torch.is_storage(obj): + if isinstance(obj, torch.storage.TypedStorage): + # TODO: Once we decide to break serialization FC, this case + # can be deleted + storage = obj._untyped_storage + storage_dtype = obj.dtype + storage_type_str = obj._pickle_storage_type() + storage_type = getattr(torch, storage_type_str) + storage_numel = obj._size() + + else: + storage = obj + storage_dtype = torch.uint8 + storage_type = normalize_storage_type(type(obj)) + storage_numel = storage.nbytes() + + # If storage is allocated, ensure that any other saved storages + # pointing to the same data all have the same dtype. If storage is + # not allocated, don't perform this check + if str(storage.device) != "meta" and storage.data_ptr() != 0: + if storage.data_ptr() in storage_dtypes: + if storage_dtype != storage_dtypes[storage.data_ptr()]: + raise RuntimeError( + "Cannot save multiple tensors or storages that " + "view the same data as different types" + ) + else: + storage_dtypes[storage.data_ptr()] = storage_dtype + + storage_key = id_map.setdefault(storage._cdata, str(len(id_map))) + if hasattr(obj, "_fake_device") and obj._fake_device is not None: + location = str(obj._fake_device) + else: + location = location_tag(storage) + serialized_storages[storage_key] = storage + + return ("storage", storage_type, storage_key, location, storage_numel) + + return None + + # Write the pickle data for `obj` + data_buf = io.BytesIO() + + class PyTorchPickler(pickle_module.Pickler): # type: ignore[name-defined] + def persistent_id(self, obj): + return persistent_id(obj) # noqa: F821 + + pickler = PyTorchPickler(data_buf, protocol=pickle_protocol) + pickler.dump(obj) + + # The class def keeps the persistent_id closure alive, leaking memory. + del persistent_id + + data_value = data_buf.getvalue() + zip_file.write_record("data.pkl", data_value, len(data_value)) + # .format_version is used to track + # 1. version 1 represents the order of storages being changed from + # lexicographical based on keys to numerically ordered based on keys + # 2. version 2 represents including storage_alignment as a record + # within the zipfile + zip_file.write_record(".format_version", "1", len("1")) + storage_alignment = str(_get_storage_alignment()) + zip_file.write_record( + ".storage_alignment", storage_alignment, len(storage_alignment) + ) + + # Write byte order marker + if not _disable_byteorder_record: + if sys.byteorder not in ["little", "big"]: + raise ValueError("Unknown endianness type: " + sys.byteorder) + + zip_file.write_record("byteorder", sys.byteorder, len(sys.byteorder)) + + # Write each tensor to a file named tensor/the_tensor_key in the zip archive + for key in serialized_storages: + name = f"data/{key}" + storage = serialized_storages[key] + num_bytes = storage.nbytes() + global _serialization_tls + if _serialization_tls.skip_data: + zip_file.write_record_metadata(name, num_bytes) + else: + # given that we copy things around anyway, we might use storage.cpu() + # this means to that to get tensors serialized, you need to implement + # .cpu() on the underlying Storage + if storage.device.type != "cpu": + from torch.utils.serialization import config + + if ( + config.save.use_pinned_memory_for_d2h + and ( + acc := torch.accelerator.current_accelerator( + check_available=True + ) + ) + is not None + and acc.type == storage.device.type + ): + new_storage = torch.empty( + num_bytes, dtype=torch.uint8, device="cpu", pin_memory=True + ).untyped_storage() + new_storage.copy_(storage) + torch.accelerator.current_stream(storage.device.index).synchronize() + storage = new_storage + else: + storage = storage.cpu() + # Now that it is on the CPU we can directly copy it into the zip file + zip_file.write_record(name, storage, num_bytes) + + +def load( + f: FileLike, + map_location: MAP_LOCATION = None, + pickle_module: Any = None, + *, + weights_only: bool | None = None, + mmap: bool | None = None, + **pickle_load_args: Any, +) -> Any: + # Reference: https://github.com/pytorch/pytorch/issues/54354 + # The first line of this docstring overrides the one Sphinx generates for the + # documentation. We need it so that Sphinx doesn't leak `pickle`s path from + # the build environment (e.g. `>> # xdoctest: +SKIP("undefined filepaths") + >>> torch.load("tensors.pt", weights_only=True) + # Load all tensors onto the CPU + >>> torch.load( + ... "tensors.pt", + ... map_location=torch.device("cpu"), + ... weights_only=True, + ... ) + # Load all tensors onto the CPU, using a function + >>> torch.load( + ... "tensors.pt", + ... map_location=lambda storage, loc: storage, + ... weights_only=True, + ... ) + # Load all tensors onto GPU 1 + >>> torch.load( + ... "tensors.pt", + ... map_location=lambda storage, loc: storage.cuda(1), # type: ignore[attr-defined] + ... weights_only=True, + ... ) # type: ignore[attr-defined] + # Map tensors from GPU 1 to GPU 0 + >>> torch.load( + ... "tensors.pt", + ... map_location={"cuda:1": "cuda:0"}, + ... weights_only=True, + ... ) + # Load tensor from io.BytesIO object + # Loading from a buffer setting weights_only=False, warning this can be unsafe + >>> with open("tensor.pt", "rb") as f: + ... buffer = io.BytesIO(f.read()) + >>> torch.load(buffer, weights_only=False) + # Load a module with 'ascii' encoding for unpickling + # Loading from a module setting weights_only=False, warning this can be unsafe + >>> torch.load("module.pt", encoding="ascii", weights_only=False) + """ + torch._C._log_api_usage_once("torch.load") + DOCS_MESSAGE = ( + "\n\nCheck the documentation of torch.load to learn more about types accepted by default with " + "weights_only https://pytorch.org/docs/stable/generated/torch.load.html." + ) + + def _get_wo_message(message: str) -> str: + unsafe_global_pattern = r"GLOBAL (\S+) was not an allowed global by default." + has_unsafe_global = re.search(unsafe_global_pattern, message) is not None + blocklist_pattern = r"whose module (\S+) is blocked" + has_blocklist = re.search(blocklist_pattern, message) is not None + import_pattern = r"(\S+) must be (\S+) to load" + has_import = re.search(import_pattern, message) is not None + if has_unsafe_global: + updated_message = ( + "Weights only load failed. This file can still be loaded, to do so you have two options, " + "\033[1mdo those steps only if you trust the source of the checkpoint\033[0m. " + f"\n\t(1) {UNSAFE_MESSAGE}\n\t(2) Alternatively, to load with `weights_only=True` please check " + "the recommended steps in the following error message.\n\tWeightsUnpickler error: " + + message + ) + else: + if has_import: + return f"Weights only load failed. {message}\n {UNSAFE_MESSAGE}\n" + else: + updated_message = f"Weights only load failed. {UNSAFE_MESSAGE}\n" + if not has_blocklist: + updated_message += ( + "Please file an issue with the following so that we can make " + "`weights_only=True` compatible with your use case: WeightsUnpickler error: " + ) + updated_message += "\n\n" + message + return updated_message + DOCS_MESSAGE + + weights_only_not_set = weights_only is None + + if weights_only_not_set: + weights_only = _default_to_weights_only(pickle_module) + + true_values = ["1", "y", "yes", "true"] + # Add ability to force safe only or non-safe weight loads via environment variables + force_weights_only_load = ( + os.getenv("TORCH_FORCE_WEIGHTS_ONLY_LOAD", "0") in true_values + ) + force_no_weights_only_load = ( + os.getenv("TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD", "0") in true_values + ) + + if force_weights_only_load and force_no_weights_only_load: + raise RuntimeError( + "Only one of `TORCH_FORCE_WEIGHTS_ONLY_LOAD` or `TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD` " + "should be set, but both were set." + ) + elif force_weights_only_load: + weights_only = True + elif force_no_weights_only_load: + # TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD can only override if callsite did not explicitly set weights_only + if weights_only_not_set: + warnings.warn( + "Environment variable TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD detected, since the" + "`weights_only` argument was not explicitly passed to `torch.load`, forcing weights_only=False.", + UserWarning, + stacklevel=2, + ) + weights_only = False + + if weights_only: + if pickle_module is not None: + raise RuntimeError( + "Can not safely load weights when explicit pickle_module is specified" + ) + else: + if pickle_module is None: + pickle_module = pickle + + # make flipping default BC-compatible + if mmap is None: + from torch.utils.serialization import config + + mmap = config.load.mmap + + _check_dill_version(pickle_module) + + if "encoding" not in pickle_load_args: + pickle_load_args["encoding"] = "utf-8" + + with _open_file_like(f, "rb") as opened_file: + if _is_zipfile(opened_file): + # The zipfile reader is going to advance the current file position. + # If we want to actually tail call to torch.jit.load, we need to + # reset back to the original position. + orig_position = opened_file.tell() + overall_storage = None + with _open_zipfile_reader(opened_file) as opened_zipfile: + if _is_torchscript_zip(opened_zipfile): + warnings.warn( + "'torch.load' received a zip file that looks like a TorchScript archive" + " dispatching to 'torch.jit.load' (call 'torch.jit.load' directly to" + " silence this warning)", + UserWarning, + stacklevel=2, + ) + if weights_only: + raise RuntimeError( + "Cannot use ``weights_only=True`` with TorchScript archives passed to " + "``torch.load``. " + UNSAFE_MESSAGE + ) + opened_file.seek(orig_position) + return torch.jit.load(opened_file, map_location=map_location) + if mmap: + if not _is_path(f): + raise ValueError( + "f must be a file path in order to use the mmap argument" + ) + size = os.path.getsize(f) + if not IS_WINDOWS: + shared = get_default_mmap_options() == MAP_SHARED + else: + shared = False + overall_storage = torch.UntypedStorage.from_file( + os.fspath(f), + shared, + size, + ) + if weights_only: + try: + return _load( + opened_zipfile, + map_location, + _weights_only_unpickler, + overall_storage=overall_storage, + **pickle_load_args, + ) + except pickle.UnpicklingError as e: + raise pickle.UnpicklingError(_get_wo_message(str(e))) from None + return _load( + opened_zipfile, + map_location, + pickle_module, + overall_storage=overall_storage, + **pickle_load_args, + ) + if mmap: + f_name = "" if not isinstance(f, str) else f"{f}, " + raise RuntimeError( + "mmap can only be used with files saved with " + f"`torch.save({f_name}_use_new_zipfile_serialization=True), " + "please torch.save your checkpoint with this option in order to use mmap." + ) + if weights_only: + try: + return _legacy_load( + opened_file, + map_location, + _weights_only_unpickler, + **pickle_load_args, + ) + except pickle.UnpicklingError as e: + raise pickle.UnpicklingError(_get_wo_message(str(e))) from None + return _legacy_load( + opened_file, map_location, pickle_module, **pickle_load_args + ) + + +# Register pickling support for layout instances such as +# torch.sparse_coo, etc +def _get_layout(name): + """Get layout extension object from its string representation.""" + cache = _get_layout.cache # type: ignore[attr-defined] + if not cache: + for v in torch.__dict__.values(): + if isinstance(v, torch.layout): + cache[str(v)] = v + return cache[name] + + +# There are yet not good way to type annotate function attributes https://github.com/python/mypy/issues/2087 +_get_layout.cache = {} # type: ignore[attr-defined] +copyreg.pickle(torch.layout, lambda obj: (_get_layout, (str(obj),))) + + +def _legacy_load(f, map_location, pickle_module, **pickle_load_args): + deserialized_objects: dict[int, Any] = {} + + restore_location = _get_restore_location(map_location) + + class UnpicklerWrapper(pickle_module.Unpickler): # type: ignore[name-defined] + def find_class(self, mod_name, name): + if type(name) is str and "Storage" in name: + try: + return StorageType(name) + except KeyError: + pass + return super().find_class(mod_name, name) + + def _check_container_source(container_type, source_file, original_source): + try: + current_source = "".join(get_source_lines_and_file(container_type)[0]) + except Exception: # saving the source is optional, so we can ignore any errors + warnings.warn( + "Couldn't retrieve source code for container of " + "type " + container_type.__name__ + ". It won't be checked " + "for correctness upon loading.", + stacklevel=2, + ) + return + if original_source != current_source: + if container_type.dump_patches: + file_name = container_type.__name__ + ".patch" + diff = difflib.unified_diff( + current_source.split("\n"), + original_source.split("\n"), + source_file, + source_file, + lineterm="", + ) + lines = "\n".join(diff) + try: + with open(file_name, "a+") as f: + file_size = f.seek(0, 2) + f.seek(0) + if file_size == 0: + f.write(lines) + elif file_size != len(lines) or f.read() != lines: + raise OSError + msg = ( + "Saved a reverse patch to " + file_name + ". " + "Run `patch -p0 < " + file_name + "` to revert your " + "changes." + ) + except OSError: + msg = ( + "Tried to save a patch, but couldn't create a " + "writable file " + file_name + ". Make sure it " + "doesn't exist and your working directory is " + "writable." + ) + else: + msg = ( + "you can retrieve the original source code by " + "accessing the object's source attribute or set " + "`torch.nn.Module.dump_patches = True` and use the " + "patch tool to revert the changes." + ) + msg = f"source code of class '{torch.typename(container_type)}' has changed. {msg}" + warnings.warn(msg, SourceChangeWarning, stacklevel=2) + + def legacy_load(f): + deserialized_objects: dict[int, Any] = {} + + def persistent_load(saved_id): + if isinstance(saved_id, tuple): + # Ignore containers that don't have any sources saved + if all(saved_id[1:]): + _check_container_source(*saved_id) + return saved_id[0] + return deserialized_objects[int(saved_id)] + + with ( + closing( + tarfile.open(fileobj=f, mode="r:", format=tarfile.PAX_FORMAT) + ) as tar, + mkdtemp() as tmpdir, + ): + if pickle_module is _weights_only_unpickler: + raise RuntimeError( + "Cannot use ``weights_only=True`` with files saved in the " + "legacy .tar format. " + UNSAFE_MESSAGE + ) + tar.extract("storages", path=tmpdir) + with open(os.path.join(tmpdir, "storages"), "rb", 0) as f: + num_storages = pickle_module.load(f, **pickle_load_args) + for _ in range(num_storages): + args = pickle_module.load(f, **pickle_load_args) + key, location, storage_type = args + dtype = storage_type._dtype + obj = cast(Storage, torch.UntypedStorage)._new_with_file( + f, torch._utils._element_size(dtype) + ) + obj = restore_location(obj, location) + # TODO: Once we decide to break serialization FC, we can + # stop wrapping with TypedStorage + deserialized_objects[key] = torch.storage.TypedStorage( + wrap_storage=obj, dtype=dtype, _internal=True + ) + + storage_views = pickle_module.load(f, **pickle_load_args) + for target_cdata, root_cdata, offset, numel in storage_views: + root = deserialized_objects[root_cdata] + element_size = torch._utils._element_size(root.dtype) + offset_bytes = offset * element_size + # TODO: Once we decide to break serialization FC, we can + # stop wrapping with TypedStorage + deserialized_objects[target_cdata] = torch.storage.TypedStorage( + wrap_storage=root._untyped_storage[ + offset_bytes : offset_bytes + numel * element_size + ], + dtype=root.dtype, + _internal=True, + ) + + tar.extract("tensors", path=tmpdir) + with open(os.path.join(tmpdir, "tensors"), "rb", 0) as f: + num_tensors = pickle_module.load(f, **pickle_load_args) + for _ in range(num_tensors): + args = pickle_module.load(f, **pickle_load_args) + key, storage_id, _original_tensor_type = args + storage = deserialized_objects[storage_id] + (ndim,) = struct.unpack(" str: + # When using encoding='bytes' in Py3, some **internal** keys stored as + # strings in Py2 are loaded as bytes. This function decodes them with + # ascii encoding, one that Py3 uses by default. + # + # NOTE: This should only be used on internal keys (e.g., `typename` and + # `location` in `persistent_load` below! + if isinstance(bytes_str, bytes): + return bytes_str.decode("ascii") + return bytes_str + + +def _get_restore_location(map_location): + if map_location is None: + restore_location = default_restore_location + elif isinstance(map_location, dict): + + def restore_location(storage, location): + location = map_location.get(location, location) + return default_restore_location(storage, location) + + elif isinstance(map_location, (str, bytes)): + + def restore_location(storage, location): + return default_restore_location(storage, map_location) + + elif isinstance(map_location, torch.device): + + def restore_location(storage, location): + return default_restore_location(storage, str(map_location)) + + else: + + def restore_location(storage, location): + result = map_location(storage, location) + if result is None: + result = default_restore_location(storage, location) + return result + + return restore_location + + +class StorageType: + def __init__(self, name): + self._dtype = _get_dtype_from_pickle_storage_type(name) + + @property + def dtype(self): + return self._dtype + + def __str__(self): + return f"StorageType(dtype={self.dtype})" + + +def _load( + zip_file, + map_location, + pickle_module, + pickle_file="data.pkl", + overall_storage=None, + **pickle_load_args, +): + restore_location = _get_restore_location(map_location) + + loaded_storages = {} + + can_calculate_storage_offsets = False + if zip_file.has_record(".format_version"): + version = zip_file.get_record(".format_version") + can_calculate_storage_offsets = version >= b"1" + + # check if byteswapping is needed + byteordername = "byteorder" + byteorderdata = None + if zip_file.has_record(byteordername): + byteorderdata = zip_file.get_record(byteordername) + if byteorderdata not in [b"little", b"big"]: + raise ValueError("Unknown endianness type: " + byteorderdata.decode()) + elif ( + get_default_load_endianness() == LoadEndianness.LITTLE + or get_default_load_endianness() is None + ): + byteorderdata = b"little" + elif get_default_load_endianness() == LoadEndianness.BIG: + byteorderdata = b"big" + elif get_default_load_endianness() == LoadEndianness.NATIVE: + pass + else: + raise ValueError("Invalid load endianness type") + + storage_alignment = 64 + if zip_file.has_record(".storage_alignment"): + storage_alignment = int(zip_file.get_record(".storage_alignment")) + + if ( + not zip_file.has_record(byteordername) + and get_default_load_endianness() is None + and sys.byteorder == "big" + ): + # Default behaviour was changed + # See https://github.com/pytorch/pytorch/issues/101688 + warnings.warn( + "The default load endianness for checkpoints without a byteorder mark " + "on big endian machines was changed from 'native' to 'little' endian, " + "to avoid this behavior please use " + "torch.serialization.set_default_load_endianness to set " + "the desired default load endianness", + UserWarning, + stacklevel=2, + ) + + from torch.utils.serialization import config + + calculate_storage_offsets = config.load.calculate_storage_offsets + run_debug_asserts = os.environ.get("TORCH_SERIALIZATION_DEBUG", "0") == "1" + current_offset = None + # constants from miniz.h/miniz.c + data_descripter_size64 = 24 + data_descripter_size32 = 16 + mz_uint32_max = 0xFFFFFFFF + offsets: dict[str, int] = dict() + + def _get_offset(key, name, numel): + """ + Return the offset of the storage associated with key with record name `name` and size numel. + It is expected that the zipfile header of this storage starts at current_offset. + + WARNING: This function relies on the behavior of the zipwriter in miniz.c. In particular, + the behavior of `mz_zip_writer_add_mem_ex_v2`. The behavior of this function must be kept + in sync with that of miniz! + + After reading a storage of size numel that starts at storage_offset + if it is the first time that storage was read, update nonlocal variable + current_offset to the start of the next zipfile header by incrementing + it by numel and the data descriptor size. + """ + nonlocal current_offset, offsets + if name in offsets: + storage_offset = offsets[name] + return storage_offset + + if current_offset is None: + assert key == "0" + current_offset = zip_file.get_record_offset(name) + local_header_offset = zip_file.get_record_header_offset(name) + storage_offset = current_offset + else: + storage_offset = zip_file.get_record_offset_no_read( + current_offset, name, numel, storage_alignment + ) + local_header_offset = current_offset + + # This is only actually needed for storages that have typed_storage._data_ptr() == 0 + # after being read. Otherwise persistent_load would never "re-call" load_tensor + # for a given key. + offsets[name] = storage_offset + + # Increment current_offset to offset where next zipfile header starts + current_offset = storage_offset + numel + # add size of data descriptor after payload + if numel > 0: + if local_header_offset >= mz_uint32_max or numel >= mz_uint32_max: + current_offset += data_descripter_size64 + else: + current_offset += data_descripter_size32 + + return storage_offset + + def load_tensor(dtype, numel, key, location): + name = f"data/{key}" + if torch._guards.detect_fake_mode(None) is not None: + nbytes = numel * torch._utils._element_size(dtype) + storage = torch.UntypedStorage(nbytes, device="meta") + if can_calculate_storage_offsets: + storage._checkpoint_offset = _get_offset(key, name, numel) + else: + storage._checkpoint_offset = zip_file.get_record_offset(name) + elif _serialization_tls.skip_data: + nbytes = numel * torch._utils._element_size(dtype) + storage = torch.UntypedStorage(nbytes) + elif overall_storage is not None: + if can_calculate_storage_offsets and calculate_storage_offsets: + storage_offset = _get_offset(key, name, numel) + if run_debug_asserts: + if storage_offset != zip_file.get_record_offset(name): + raise RuntimeError( + "This is a debug assert that was run as the `TORCH_SERIALIZATION_DEBUG` environment " + f"variable was set: Incorrect offset for {name}, got {storage_offset} expected " + f"{zip_file.get_record_offset(name)}" + ) + else: + storage_offset = zip_file.get_record_offset(name) + storage = overall_storage[storage_offset : storage_offset + numel] + else: + if can_calculate_storage_offsets and run_debug_asserts: + # This is debug code that we use to test the validity of + # torch.utils.serialization.config.load.calculate_storage_offsets throughout CI + storage_offset = _get_offset(key, name, numel) + if storage_offset != zip_file.get_record_offset(name): + raise RuntimeError( + "This is a debug assert that was run as the `TORCH_SERIALIZATION_DEBUG` environment " + f"variable was set: Incorrect offset for {name}, got {storage_offset} expected " + f"{zip_file.get_record_offset(name)}" + ) + storage = ( + zip_file.get_storage_from_record(name, numel, torch.UntypedStorage) + ._typed_storage() + ._untyped_storage + ) + # swap here if byteswapping is needed + if byteorderdata is not None: + if byteorderdata.decode() != sys.byteorder: + storage.byteswap(dtype) + + # TODO: Once we decide to break serialization FC, we can + # stop wrapping with TypedStorage + + if torch._guards.detect_fake_mode(None) is None: + wrap_storage = restore_location(storage, location) + else: + storage._fake_device = location + wrap_storage = storage + + typed_storage = torch.storage.TypedStorage( + wrap_storage=wrap_storage, + dtype=dtype, + _internal=True, + ) + + if typed_storage._data_ptr() != 0: + loaded_storages[key] = typed_storage + + return typed_storage + + def persistent_load(saved_id): + assert isinstance(saved_id, tuple) + typename = _maybe_decode_ascii(saved_id[0]) + data = saved_id[1:] + + assert typename == "storage", ( + f"Unknown typename for persistent_load, expected 'storage' but got '{typename}'" + ) + storage_type, key, location, numel = data + if storage_type is torch.UntypedStorage: + dtype = torch.uint8 + else: + dtype = storage_type.dtype + + if key in loaded_storages: + typed_storage = loaded_storages[key] + else: + nbytes = numel * torch._utils._element_size(dtype) + typed_storage = load_tensor( + dtype, nbytes, key, _maybe_decode_ascii(location) + ) + + return typed_storage + + load_module_mapping: dict[str, str] = { + # See https://github.com/pytorch/pytorch/pull/51633 + "torch.tensor": "torch._tensor" + } + + # Need to subclass Unpickler instead of directly monkey-patching the find_class method + # because it's marked readonly in pickle. + # The type: ignore is because mypy can't statically determine the type of this class. + class UnpicklerWrapper(pickle_module.Unpickler): # type: ignore[name-defined] + # from https://stackoverflow.com/questions/13398462/unpickling-python-objects-with-a-changed-module-path/13405732 + # Lets us override the imports that pickle uses when unpickling an object. + # This is useful for maintaining BC if we change a module path that tensor instantiation relies on. + def find_class(self, mod_name, name): + if type(name) is str and "Storage" in name: + try: + return StorageType(name) + except KeyError: + pass + mod_name = load_module_mapping.get(mod_name, mod_name) + return super().find_class(mod_name, name) + + # Load the data (which may in turn use `persistent_load` to load tensors) + data_file = io.BytesIO(zip_file.get_record(pickle_file)) + + unpickler = UnpicklerWrapper(data_file, **pickle_load_args) + unpickler.persistent_load = persistent_load + # Needed for tensors where storage device and rebuild tensor device are + # not connected (wrapper subclasses and tensors rebuilt using numpy) + global _serialization_tls + _serialization_tls.map_location = map_location + result = unpickler.load() + _serialization_tls.map_location = None + + torch._utils._validate_loaded_sparse_tensors() + torch._C._log_api_usage_metadata( + "torch.load.metadata", {"serialization_id": zip_file.serialization_id()} + ) + return result + + +def _is_torchscript_zip(zip_file): + return "constants.pkl" in zip_file.get_all_records() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/storage.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/storage.py new file mode 100644 index 0000000000000000000000000000000000000000..79d11ea13e3e6bc088248996e60a3f5e2772a079 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/storage.py @@ -0,0 +1,1549 @@ +# mypy: allow-untyped-defs + +from __future__ import annotations + +import collections +import copy +import functools +import io +import threading +import warnings +from typing import Any, cast, TYPE_CHECKING, TypeVar +from typing_extensions import Self + +import torch +from torch._utils import _to, _type +from torch.types import _bool, _int, Storage + + +if TYPE_CHECKING: + from torch._prims_common import DeviceLikeType + + +__all__ = ["TypedStorage", "UntypedStorage"] + + +try: + import numpy as np + + HAS_NUMPY = True +except ModuleNotFoundError: + HAS_NUMPY = False + np = None # type: ignore[assignment] + + +_share_memory_lock = threading.Lock() +_share_memory_map: dict[int, threading.RLock] = {} + +T = TypeVar("T", bound="_StorageBase | TypedStorage") + + +class _StorageBase: + _cdata: Any + is_sparse: _bool = False + is_sparse_csr: _bool = False + device: torch.device + # Used when + # (1) stashing FakeTensor device onto storage in torch.serialization.skip_data + # (2) stashing device onto storage to propagate to FakeTensor when torch.load under FakeTensorMode + _fake_device: torch.device | None = None + # Used when loading with FakeTensorMode to give information about offset of storage in torch.saved-file + _checkpoint_offset: int | None = None + + def __init__(self, *args, **kwargs): + pass + + def __len__(self) -> _int: + raise NotImplementedError + + def __getitem__(self, idx): + raise NotImplementedError + + def __setitem__(self, *args, **kwargs): + raise NotImplementedError + + def copy_(self, source: T, non_blocking: _bool | None = None) -> T: + raise NotImplementedError + + def new(self) -> _StorageBase | TypedStorage: + raise NotImplementedError + + def nbytes(self) -> _int: + raise NotImplementedError + + def size(self) -> _int: + return self.nbytes() + + def type( + self, dtype: str | None = None, non_blocking: _bool = False + ) -> _StorageBase | TypedStorage: + return _type(self, dtype, non_blocking) + + def cuda(self, device=None, non_blocking=False) -> _StorageBase | TypedStorage: + """Returns a copy of this object in CUDA memory. + + If this object is already in CUDA memory and on the correct device, then + no copy is performed and the original object is returned. + + Args: + device (int): The destination GPU id. Defaults to the current device. + non_blocking (bool): If ``True`` and the source is in pinned memory, + the copy will be asynchronous with respect to the host. Otherwise, + the argument has no effect. + """ + device2 = torch.device("cuda", device) if device else torch.device("cuda") + return self.to(device=device2, non_blocking=non_blocking) + + def hpu(self, device=None, non_blocking=False) -> _StorageBase | TypedStorage: + """Returns a copy of this object in HPU memory. + + If this object is already in HPU memory and on the correct device, then + no copy is performed and the original object is returned. + + Args: + device (int): The destination HPU id. Defaults to the current device. + non_blocking (bool): If ``True`` and the source is in pinned memory, + the copy will be asynchronous with respect to the host. Otherwise, + the argument has no effect. + """ + device2 = torch.device("hpu", device) if device else torch.device("hpu") + return self.to(device=device2, non_blocking=non_blocking) + + def element_size(self) -> _int: + raise NotImplementedError + + def get_device(self) -> _int: + return self.device.index + + def data_ptr(self) -> _int: + raise NotImplementedError + + def resizable(self) -> _bool: + raise NotImplementedError + + # Defined in torch/csrc/generic/StorageSharing.cpp + def _share_filename_cpu_(self, *args, **kwargs): + raise NotImplementedError + + def _share_fd_cpu_(self, *args, **kwargs): + raise NotImplementedError + + @classmethod + def _new_using_filename_cpu(cls, size: _int) -> Self: + raise NotImplementedError + + @classmethod + def _new_using_fd_cpu(cls, size: _int) -> Self: + raise NotImplementedError + + @classmethod + def from_buffer(cls, *args, **kwargs) -> Self: + raise NotImplementedError + + @classmethod + def _new_shared_filename_cpu( + cls, + manager, + obj, + size, + *, + device=None, + dtype=None, + ) -> Self: + raise NotImplementedError + + @classmethod + def _release_ipc_counter(cls, *args, device=None, **kwargs): + return cls._release_ipc_counter_cuda(*args, **kwargs) + + @classmethod + def _release_ipc_counter_cuda(cls, *args, **kwargs) -> Self: + raise NotImplementedError + + @classmethod + def _new_with_weak_ptr(cls, *args, **kwargs) -> Self: + raise NotImplementedError + + def _shared_decref(self) -> _StorageBase | TypedStorage: + raise NotImplementedError + + def _write_file(self, *args, **kwargs): + raise NotImplementedError + + def resize_(self, size: _int): + raise NotImplementedError + + def _weak_ref(self, *args, **kwargs) -> _StorageBase | TypedStorage: + raise NotImplementedError + + def _set_from_file(self, *args, **kwargs): + raise NotImplementedError + + def _set_cdata(self, *args, **kwargs): + raise NotImplementedError + + def _share_cuda_(self, *args, **kwargs): + raise NotImplementedError + + def is_shared(self) -> _bool: + raise NotImplementedError + + @classmethod + def _new_shared_cuda(cls, *args, **kwargs) -> Self: + raise NotImplementedError + + def _shared_incref(self, *args, **kwargs): + raise NotImplementedError + + @classmethod + def _free_weak_ref(cls, *args, **kwargs): + raise NotImplementedError + + @property + def is_cuda(self): + raise NotImplementedError + + @property + def is_hpu(self): + raise NotImplementedError + + @classmethod + def from_file(cls, filename, shared, nbytes) -> _StorageBase | TypedStorage: + raise NotImplementedError + + @classmethod + def _expired(cls, *args, **kwargs) -> _StorageBase | TypedStorage: + raise NotImplementedError + + def _byteswap(self, *args, **kwargs): + raise NotImplementedError + + def _get_filename(self, *args, **kwargs) -> str | None: + raise NotImplementedError + + def __repr__(self): + info_str = f"[{torch.typename(self)}(device={self.device}) of size {len(self)}]" + if self.device.type == "meta": + return "...\n" + info_str + data_str = " " + "\n ".join(str(self[i]) for i in range(self.size())) + return data_str + "\n" + info_str + + def __iter__(self): + return iter(self[i] for i in range(self.size())) + + def __copy__(self): + return self.clone() + + def __deepcopy__(self, memo): + memo = memo.setdefault("torch", {}) + if self._cdata in memo: + return memo[self._cdata] + new_storage = self.clone() + memo[self._cdata] = new_storage + return new_storage + + def __reduce__(self): + b = io.BytesIO() + torch.save(self, b, _use_new_zipfile_serialization=False) + return (_load_from_bytes, (b.getvalue(),)) + + def __sizeof__(self): + return super().__sizeof__() + self.size() + + def clone(self): + """Return a copy of this storage.""" + return type(self)(self.nbytes(), device=self.device).copy_(self) + + def tolist(self): + """Return a list containing the elements of this storage.""" + return list(self) + + def cpu(self): + """Return a CPU copy of this storage if it's not already on the CPU.""" + if self.device.type != "cpu": + return torch.UntypedStorage(self.size()).copy_(self, False) + return self + + def mps(self): + """Return a MPS copy of this storage if it's not already on the MPS.""" + if self.device.type != "mps": + return torch.UntypedStorage(self.size(), device="mps").copy_(self, False) + return self + + def _to(self, dtype): + if not isinstance(dtype, torch.dtype): + raise TypeError(f"Argument 'dtype' must be torch.dtype, not {type(dtype)}") + storage = ( + torch.tensor([], dtype=torch.uint8, device=self.device) + .set_(cast(Storage, self)) + .to(dtype) + ._typed_storage() + ) + if storage.data_ptr() == self.data_ptr(): + storage = storage.clone() + return storage + + def to(self, *, device: DeviceLikeType, non_blocking: _bool = False): + if not isinstance(device, torch.device): + device = torch.device(device) + return _to(self, device, non_blocking) + + def double(self): + """Casts this storage to double type.""" + return self._to(torch.double) + + def float(self): + """Casts this storage to float type.""" + return self._to(torch.float) + + def half(self): + """Casts this storage to half type.""" + return self._to(torch.half) + + def long(self): + """Casts this storage to long type.""" + return self._to(torch.long) + + def int(self): + """Casts this storage to int type.""" + return self._to(torch.int) + + def short(self): + """Casts this storage to short type.""" + return self._to(torch.short) + + def char(self): + """Casts this storage to char type.""" + return self._to(torch.int8) + + def byte(self): + """Casts this storage to byte type.""" + return self._to(torch.uint8) + + def bool(self): + """Casts this storage to bool type.""" + return self._to(torch.bool) + + def bfloat16(self): + """Casts this storage to bfloat16 type.""" + return self._to(torch.bfloat16) + + def complex_double(self): + """Casts this storage to complex double type.""" + return self._to(torch.cdouble) + + def complex_float(self): + """Casts this storage to complex float type.""" + return self._to(torch.cfloat) + + def float8_e5m2(self): + """Casts this storage to float8_e5m2 type""" + return self._to(torch.float8_e5m2) + + def float8_e4m3fn(self): + """Casts this storage to float8_e4m3fn type""" + return self._to(torch.float8_e4m3fn) + + def float8_e5m2fnuz(self): + """Casts this storage to float8_e5m2fnuz type""" + return self._to(torch.float8_e5m2fnuz) + + def float8_e4m3fnuz(self): + """Casts this storage to float8_e4m3fnuz type""" + return self._to(torch.float8_e4m3fnuz) + + def is_pinned(self, device: str | torch.device = "cuda"): + r"""Determine whether the CPU storage is already pinned on device. + + Args: + device (str or torch.device): The device to pin memory on (default: ``'cuda'``). + This argument is discouraged and subject to deprecated. + + Returns: + A boolean variable. + """ + return ( + torch.tensor([], dtype=torch.uint8, device=self.device) + .set_(cast(Storage, self)) + .is_pinned(device) + ) + + def pin_memory(self, device: str | torch.device = "cuda"): + r"""Copy the CPU storage to pinned memory, if it's not already pinned. + + Args: + device (str or torch.device): The device to pin memory on (default: ``'cuda'``). + This argument is discouraged and subject to deprecated. + + Returns: + A pinned CPU storage. + """ + if self.device.type != "cpu": + raise TypeError(f"cannot pin '{self.type()}' only CPU memory can be pinned") + + pinned_tensor = ( + torch.tensor([], dtype=torch.uint8, device=self.device) + .set_(cast(Storage, self)) + .pin_memory(device) + ) + return pinned_tensor.untyped_storage() + + def share_memory_(self): + """See :meth:`torch.UntypedStorage.share_memory_`""" + from torch.multiprocessing import get_sharing_strategy + + if self.device.type in ["cuda", torch._C._get_privateuse1_backend_name()]: + pass # CUDA or PrivateUse1 doesn't use POSIX shared memory + elif get_sharing_strategy() == "file_system": + self._share_filename_cpu_() + else: + self._share_fd_cpu_() + return self + + @classmethod + def _new_shared(cls, size, *, device="cpu"): + """Create a new storage in shared memory with the same data type.""" + from torch.multiprocessing import get_sharing_strategy + + device = torch.device(device) + if device.type in ["cuda", torch._C._get_privateuse1_backend_name(), "hpu"]: + return cls(size, device=device) + elif get_sharing_strategy() == "file_system": + return cls._new_using_filename_cpu(size) + else: + return cls._new_using_fd_cpu(size) + + def untyped(self): + return self + + def byteswap(self, dtype): + """Swap bytes in underlying data.""" + elem_size = torch._utils._element_size(dtype) + # for complex types, don't swap first and second numbers + if dtype.is_complex: + elem_size = max(int(elem_size / 2), 1) + self._byteswap(elem_size) + + +def _share_memory_lock_protected(fn): + @functools.wraps(fn) + def wrapper(self, *args, **kwargs): + to_free = None + to_wait = None + with _share_memory_lock: + key = self._cdata + if key in _share_memory_map: + to_wait = _share_memory_map[key] + else: + _share_memory_map[key] = threading.RLock() + _share_memory_map[key].acquire() + to_free = key + + # If we're already in the process of sharing the storage, wait + # for it to be done. + if to_wait is not None: + with to_wait: + pass + + try: + return fn(self, *args, **kwargs) + finally: + # If we acquired the storage lock here and we're done working on it + # we can now release it and free the entry. + if to_free is not None: + # Ensure that the cdata from the storage didn't change and only + # the data_ptr did. + assert self._cdata == to_free + with _share_memory_lock: + _share_memory_map[to_free].release() + del _share_memory_map[to_free] + + return wrapper + + +class UntypedStorage(torch._C.StorageBase, _StorageBase): + def __getitem__(self, *args, **kwargs): + if self.device.type == "meta": + raise NotImplementedError("Not available for 'meta' device type") + return super().__getitem__(*args, **kwargs) + + @property + def is_cuda(self): + return self.device.type == "cuda" + + @property + def is_hpu(self): + return self.device.type == "hpu" + + @property + def filename(self) -> str | None: + """Returns the file name associated with this storage. + + The file name will be a string if the storage is on CPU and was created via + :meth:`~torch.from_file()` with ``shared`` as ``True``. This attribute is ``None`` otherwise. + """ + return self._get_filename() + + @_share_memory_lock_protected + def share_memory_(self, *args, **kwargs): + """ + Moves the storage to shared memory. + + This is a no-op for storages already in shared memory and for CUDA + storages, which do not need to be moved for sharing across processes. + Storages in shared memory cannot be resized. + + Note that to mitigate issues like `this `_ + it is thread safe to call this function from multiple threads on the same object. + It is NOT thread safe though to call any other function on self without proper + synchronization. Please see :doc:`/notes/multiprocessing` for more details. + + .. note:: + When all references to a storage in shared memory are deleted, the associated shared memory + object will also be deleted. PyTorch has a special cleanup process to ensure that this happens + even if the current process exits unexpectedly. + + It is worth noting the difference between :meth:`share_memory_` and :meth:`from_file` with ``shared = True`` + + #. ``share_memory_`` uses `shm_open(3) `_ to create a + POSIX shared memory object while :meth:`from_file` uses + `open(2) `_ to open the filename passed by the user. + #. Both use an `mmap(2) call `_ with ``MAP_SHARED`` + to map the file/object into the current virtual address space + #. ``share_memory_`` will call ``shm_unlink(3)`` on the object after mapping it to make sure the shared memory + object is freed when no process has the object open. ``torch.from_file(shared=True)`` does not unlink the + file. This file is persistent and will remain until it is deleted by the user. + + Returns: + ``self`` + """ + return super().share_memory_(*args, **kwargs) + + @_share_memory_lock_protected + def _share_fd_cpu_(self, *args, **kwargs): + return super()._share_fd_cpu_(*args, **kwargs) + + @_share_memory_lock_protected + def _share_filename_cpu_(self, *args, **kwargs): + return super()._share_filename_cpu_(*args, **kwargs) + + +def _load_from_bytes(b): + return torch.load(io.BytesIO(b), weights_only=False) + + +@functools.cache +def _new_dtypes(): + # These are dtypes serialized as UntypedStorage unlike those in + # _dtype_to_storage_type_map + return { + torch.float8_e5m2, + torch.float8_e4m3fn, + torch.float8_e5m2fnuz, + torch.float8_e4m3fnuz, + torch.float8_e8m0fnu, + torch.float4_e2m1fn_x2, + torch.bits8, + torch.bits16, + torch.bits1x8, + torch.bits2x4, + torch.bits4x2, + torch.complex32, + torch.uint16, + torch.uint32, + torch.uint64, + } + + +@functools.cache +def _dtype_to_storage_type_map(): + # NOTE: We should no longer add dtypes to this map. This map + # is only used for BC/FC with older PyTorch versions. Going forward, + # new dtypes of TypedStorage should not translate to a legacy + # Storage class. Instead, new dtypes of TypedStorage should + # be serialized as an UntypedStorage paired with a torch.dtype + return { + torch.double: "DoubleStorage", + torch.float: "FloatStorage", + torch.half: "HalfStorage", + torch.long: "LongStorage", + torch.int: "IntStorage", + torch.int16: "ShortStorage", + torch.int8: "CharStorage", + torch.uint8: "ByteStorage", + torch.bool: "BoolStorage", + torch.bfloat16: "BFloat16Storage", + torch.cdouble: "ComplexDoubleStorage", + torch.cfloat: "ComplexFloatStorage", + torch.qint8: "QInt8Storage", + torch.qint32: "QInt32Storage", + torch.quint8: "QUInt8Storage", + torch.quint4x2: "QUInt4x2Storage", + torch.quint2x4: "QUInt2x4Storage", + } + + +@functools.cache +def _storage_type_to_dtype_map(): + dtype_map = {val: key for key, val in _dtype_to_storage_type_map().items()} + return dtype_map + + +def _get_storage_from_sequence(sequence, dtype, device): + if dtype in [ + torch.quint8, + torch.quint4x2, + torch.quint2x4, + torch.qint32, + torch.qint8, + ]: + interpret_dtypes = { + torch.quint8: torch.uint8, + torch.quint4x2: torch.uint8, + torch.quint2x4: torch.uint8, + torch.qint32: torch.int32, + torch.qint8: torch.int8, + } + tmp_tensor = torch.tensor( + sequence, dtype=interpret_dtypes[dtype], device=device + ) + + else: + tmp_tensor = torch.tensor(sequence, dtype=dtype, device=device) + + return tmp_tensor._typed_storage()._untyped_storage + + +def _isint(x): + if HAS_NUMPY: + return isinstance(x, (int, np.integer)) # pyrefly: ignore [missing-attribute] + else: + return isinstance(x, int) + + +_always_warn_typed_storage_removal = False + + +def _get_always_warn_typed_storage_removal(): + return _always_warn_typed_storage_removal + + +def _set_always_warn_typed_storage_removal(always_warn): + global _always_warn_typed_storage_removal + assert isinstance(always_warn, bool) + _always_warn_typed_storage_removal = always_warn + + +def _warn_typed_storage_removal(stacklevel=2): + global _always_warn_typed_storage_removal + + def is_first_time(): + if not hasattr(_warn_typed_storage_removal, "has_warned"): + return True + else: + return not _warn_typed_storage_removal.__dict__["has_warned"] + + if _get_always_warn_typed_storage_removal() or is_first_time(): + message = ( + "TypedStorage is deprecated. It will be removed in the future and " + "UntypedStorage will be the only storage class. This should only matter " + "to you if you are using storages directly. To access UntypedStorage " + "directly, use tensor.untyped_storage() instead of tensor.storage()" + ) + warnings.warn(message, UserWarning, stacklevel=stacklevel + 1) + _warn_typed_storage_removal.__dict__["has_warned"] = True + + +def _reset_warn_typed_storage_removal(): + _warn_typed_storage_removal.__dict__["has_warned"] = False + + +def _get_device_from_module(module: str): + last_part = module.rsplit(".", 1)[-1] + if last_part in ["cuda", torch._C._get_privateuse1_backend_name(), "hpu"]: + return last_part + else: + return "cpu" + + +class TypedStorage: + is_sparse: _bool = False + # Used when stashing FakeTensor device onto storage in torch.save(metadata_only=True) + _fake_device: torch.device | None = None + + dtype: torch.dtype + + @property + def _dtype(self): + return self.dtype + + @property + def filename(self) -> str | None: + """Returns the file name associated with this storage if the storage was memory mapped from a file. + or ``None`` if the storage was not created by memory mapping a file.""" + return self._untyped_storage.filename + + def fill_(self, value): + _warn_typed_storage_removal() + self._setitem(slice(0, self._size()), value) + return self + + def __new__( + cls, + *args, + wrap_storage=None, + dtype=None, + device=None, + _internal=False, + ): + if not _internal: + _warn_typed_storage_removal() + + if cls == torch.storage._LegacyStorage: + raise RuntimeError( + "Only child classes of _LegacyStorage can be instantiated" + ) + + if cls == TypedStorage: + return super().__new__(cls) + + else: + arg_error_msg = ( + f"{cls}.__new__ received an invalid combination " + f"of arguments. Expected one of:\n" + " * no arguments\n" + " * (int size)\n" + " * (Sequence data)\n" + " * (*, UntypedStorage wrap_storage)" + ) + + if device is not None: + raise RuntimeError( + arg_error_msg + "\nKeyword argument 'device' cannot be specified" + ) + + if dtype is not None: + raise RuntimeError( + arg_error_msg + "\nKeyword argument 'dtype' cannot be specified" + ) + + if wrap_storage is None: + if len(args) > 1: + raise RuntimeError( + arg_error_msg + "\nToo many positional arguments" + ) + + if ( + len(args) == 1 + and not _isint(args[0]) + and not isinstance(args[0], collections.abc.Sequence) + ): + raise TypeError( + arg_error_msg + + f"\nArgument type not recognized: {type(args[0])}" + ) + + return TypedStorage( + *args, + dtype=cls._dtype, + device=_get_device_from_module(cls.__module__), + _internal=True, + ) + + else: + if len(args) != 0: + raise RuntimeError( + arg_error_msg + + "\nNo positional arguments should be given when using " + "'wrap_storage'" + ) + + if not isinstance(wrap_storage, torch.UntypedStorage): + raise TypeError( + arg_error_msg + + f"\nArgument 'wrap_storage' must be UntypedStorage, but got {type(wrap_storage)}" + ) + + cls_device = _get_device_from_module(cls.__module__) + + if wrap_storage.device.type != cls_device: + raise RuntimeError( + arg_error_msg + + f"\nDevice of 'wrap_storage' must be {cls_device}" + f", but got {wrap_storage.device.type}" + ) + + return TypedStorage( + *args, + wrap_storage=wrap_storage, + dtype=cls.dtype, + _internal=True, + ) + + def __init__( + self, + *args, + device=None, + dtype=None, + wrap_storage=None, + _internal=False, + ): + if not _internal: + _warn_typed_storage_removal() + arg_error_msg = ( + "TypedStorage.__init__ received an invalid combination " + "of arguments. Expected one of:\n" + " * (*, torch.device device, torch.dtype dtype)\n" + " * (int size, *, torch.device device, torch.dtype dtype)\n" + " * (Sequence data, *, torch.device device, torch.dtype dtype)\n" + " * (*, UntypedStorage wrap_storage, torch.dtype dtype)" + ) + + if wrap_storage is not None: + if len(args) != 0: + raise RuntimeError( + arg_error_msg + + "\nNo positional arguments should be given when using " + "'wrap_storage'" + ) + + if dtype is None: + raise RuntimeError( + arg_error_msg + "\nArgument 'dtype' must be specified" + ) + + if not isinstance(dtype, torch.dtype): + raise TypeError( + arg_error_msg + + f"\nArgument 'dtype' must be torch.dtype, not {type(dtype)}" + ) + + if device is not None: + raise RuntimeError( + arg_error_msg + + "\nArgument 'device' should not be specified when 'wrap_storage' is given" + ) + + self.dtype = dtype + + if not isinstance(wrap_storage, torch.UntypedStorage): + raise TypeError( + arg_error_msg + + f"\nArgument 'wrap_storage' must be UntypedStorage, but got {type(wrap_storage)}" + ) + + self._untyped_storage = wrap_storage + + else: + self.dtype = torch.get_default_dtype() if dtype is None else dtype + device = torch.device("cpu" if device is None else device) + + if self.dtype in [ + torch.quint8, + torch.quint4x2, + torch.quint2x4, + torch.qint32, + torch.qint8, + ]: + if device.type == "cuda": + raise RuntimeError( + "Cannot create CUDA storage with quantized dtype" + ) + + if len(args) == 0: + self._untyped_storage = torch.UntypedStorage(device=device) + + elif len(args) == 1: + if _isint(args[0]): + self._untyped_storage = torch.UntypedStorage( + int(args[0]) * self._element_size(), device=device + ) + elif isinstance(args[0], collections.abc.Sequence): + self._untyped_storage = _get_storage_from_sequence( + args[0], self.dtype, device + ) + else: + raise TypeError( + arg_error_msg + + f"\nArgument type not recognized: {type(args[0])}" + ) + + else: + raise RuntimeError(arg_error_msg + "\nToo many positional arguments") + + @property + def is_cuda(self): + _warn_typed_storage_removal() + return self._untyped_storage.device.type == "cuda" + + @property + def is_hpu(self): + _warn_typed_storage_removal() + return self._untyped_storage.device.type == "hpu" + + def untyped(self): + """Return the internal :class:`torch.UntypedStorage`.""" + _warn_typed_storage_removal() + return self._untyped_storage + + def _new_wrapped_storage(self, untyped_storage) -> Self: + assert type(untyped_storage) is torch.UntypedStorage + + if type(self) is TypedStorage: + return cast( + Self, + TypedStorage( + wrap_storage=untyped_storage, dtype=self.dtype, _internal=True + ), + ) + else: + return type(self)(wrap_storage=untyped_storage) + + def __len__(self): + _warn_typed_storage_removal() + return self._size() + + def _maybe_wrap_index(self, idx, is_stop=False): + if idx is None: + if is_stop: + return self._size() + else: + return 0 + + else: + if type(idx) is not int: + raise TypeError(f"can't index a {type(self)} with {type(idx)}") + if is_stop: + if (idx > self._size()) or (idx < -self._size()): + raise IndexError( + f"index {idx} out of range for storage of size {self.size()}" + ) + if idx > 0: + return idx + else: + return idx % self._size() + else: + if (idx >= self._size()) or (idx < -self._size()): + raise IndexError( + f"index {idx} out of range for storage of size {self.size()}" + ) + return idx % self._size() + + def __setitem__(self, idx, value): + _warn_typed_storage_removal() + return self._setitem(idx, value) + + def _setitem(self, idx, value): + if not isinstance(idx, (int, slice)): + raise RuntimeError(f"can't index a {type(self)} with {type(idx)}") + if torch.is_storage(value): + raise RuntimeError(f"cannot set item with value type {type(value)}") + if self.dtype in [ + torch.quint8, + torch.quint4x2, + torch.quint2x4, + torch.qint32, + torch.qint8, + ]: + interpret_dtypes = { + torch.quint8: torch.uint8, + torch.quint4x2: torch.uint8, + torch.quint2x4: torch.uint8, + torch.qint32: torch.int32, + torch.qint8: torch.int8, + } + tmp_dtype = interpret_dtypes[self.dtype] + tmp_tensor = torch.tensor( + [], dtype=tmp_dtype, device=self._untyped_storage.device + ) + tmp_tensor.set_( + TypedStorage( + wrap_storage=self._untyped_storage, dtype=tmp_dtype, _internal=True + ) + ) + else: + tmp_tensor = torch.tensor( + [], dtype=self.dtype, device=self._untyped_storage.device + ).set_(self) + + tmp_tensor[idx] = value + + def __getitem__(self, idx): + _warn_typed_storage_removal() + return self._getitem(idx) + + def _getitem(self, idx): + if self._untyped_storage.device.type == "meta": + raise NotImplementedError("Not available for 'meta' device type") + + # NOTE: Before TypedStorage existed, indexing with a slice used to be + # possible for Storage objects. However, it would return + # a storage view, which would be a hassle to implement in TypedStorage, + # so it was disabled + if isinstance(idx, slice): + raise RuntimeError( + "slices are only supported in UntypedStorage.__getitem__" + ) + elif not isinstance(idx, int): + raise RuntimeError(f"can't index a {type(self)} with {type(idx)}") + + if self.dtype in [ + torch.quint8, + torch.quint4x2, + torch.quint2x4, + torch.qint32, + torch.qint8, + ]: + interpret_dtypes = { + torch.quint8: torch.uint8, + torch.quint4x2: torch.uint8, + torch.quint2x4: torch.uint8, + torch.qint32: torch.int32, + torch.qint8: torch.int8, + } + return TypedStorage( + wrap_storage=self._untyped_storage, + dtype=interpret_dtypes[self.dtype], + _internal=True, + )._getitem(idx) + + idx_wrapped = self._maybe_wrap_index(idx) + from torch._subclasses.fake_tensor import unset_fake_temporarily + + with unset_fake_temporarily(): + tmp_tensor = torch.tensor( + [], dtype=self.dtype, device=self._untyped_storage.device + ).set_(self) + return tmp_tensor[idx_wrapped].item() + + def copy_(self, source: T, non_blocking: bool | None = None): + _warn_typed_storage_removal() + if isinstance(source, TypedStorage): + self._untyped_storage.copy_(source._untyped_storage, non_blocking) + else: + self._untyped_storage.copy_(source, non_blocking) + return self + + def nbytes(self): + _warn_typed_storage_removal() + return self._nbytes() + + # For internal use only, to avoid deprecation warning + def _nbytes(self): + return self._untyped_storage.nbytes() + + def type( + self, + dtype: str | None = None, + non_blocking: bool = False, + ) -> _StorageBase | TypedStorage | str: + _warn_typed_storage_removal() + if dtype is None: + legacy_class = self._get_legacy_storage_class() + + if legacy_class is not None: + return legacy_class.__module__ + "." + legacy_class.__name__ + + return ".".join([self.__module__, type(self).__name__]) + + else: + return self._untyped_storage.type(dtype, non_blocking) + + def cuda(self, device=None, non_blocking=False) -> Self: + _warn_typed_storage_removal() + if self.dtype in [ + torch.quint8, + torch.quint4x2, + torch.quint2x4, + torch.qint32, + torch.qint8, + ]: + raise RuntimeError("Cannot create CUDA storage with quantized dtype") + cuda_storage = self._untyped_storage.cuda(device, non_blocking) + return self._new_wrapped_storage(cuda_storage) + + def hpu(self, device=None, non_blocking=False) -> Self: + _warn_typed_storage_removal() + if self.dtype in [ + torch.quint8, + torch.quint4x2, + torch.quint2x4, + torch.qint32, + torch.qint8, + ]: + raise RuntimeError("Cannot create HPU storage with quantized dtype") + hpu_storage = self._untyped_storage.hpu(device, non_blocking) + return self._new_wrapped_storage(hpu_storage) + + def to(self, *, device: DeviceLikeType, non_blocking: bool = False) -> Self: + _warn_typed_storage_removal() + if not isinstance(device, torch.device): + device = torch.device(device) + if self.dtype in [ + torch.quint8, + torch.quint4x2, + torch.quint2x4, + torch.qint32, + torch.qint8, + ]: + raise RuntimeError( + f"Cannot create {device.type.upper()} storage with quantized dtype" + ) + to_storage = self._untyped_storage.to(device=device, non_blocking=non_blocking) + return self._new_wrapped_storage(to_storage) + + def element_size(self): + _warn_typed_storage_removal() + return self._element_size() + + # For internal use only, to avoid deprecation warning + def _element_size(self): + return torch._utils._element_size(self.dtype) + + def get_device(self) -> _int: + _warn_typed_storage_removal() + return self._untyped_storage.get_device() + + def __str__(self): + _warn_typed_storage_removal() + info_str = ( + f"[{torch.typename(self)}(dtype={self.dtype}, " + f"device={self.device}) of size {len(self)}]" + ) + if self.device.type == "meta": + return "...\n" + info_str + else: + data_str = " " + "\n ".join(str(self[i]) for i in range(self.size())) + return data_str + "\n" + info_str + + def __repr__(self): + _warn_typed_storage_removal() + return str(self) + + def __iter__(self): + _warn_typed_storage_removal() + return iter(self[i] for i in range(self.size())) + + def __copy__(self): + _warn_typed_storage_removal() + return self._new_wrapped_storage(copy.copy(self._untyped_storage)) + + def __deepcopy__(self, memo): + _warn_typed_storage_removal() + return self._deepcopy(memo) + + # For internal use only, to avoid deprecation warning + def _deepcopy(self, memo): + return self._new_wrapped_storage(copy.deepcopy(self._untyped_storage, memo)) + + def __sizeof__(self): + _warn_typed_storage_removal() + return super().__sizeof__() + self.nbytes() + + def clone(self): + """Return a copy of this storage.""" + _warn_typed_storage_removal() + return self._new_wrapped_storage(self._untyped_storage.clone()) + + def tolist(self): + """Return a list containing the elements of this storage.""" + _warn_typed_storage_removal() + return list(self) + + def cpu(self): + """Return a CPU copy of this storage if it's not already on the CPU.""" + _warn_typed_storage_removal() + return self._new_wrapped_storage(self._untyped_storage.cpu()) + + def is_pinned(self, device: str | torch.device = "cuda"): + r"""Determine whether the CPU TypedStorage is already pinned on device. + + Args: + device (str or torch.device): The device to pin memory on (default: ``'cuda'``). + This argument is discouraged and subject to deprecated. + + Returns: + A boolean variable. + """ + _warn_typed_storage_removal() + return self._untyped_storage.is_pinned(device) + + def pin_memory(self, device: str | torch.device = "cuda"): + r"""Copy the CPU TypedStorage to pinned memory, if it's not already pinned. + + Args: + device (str or torch.device): The device to pin memory on (default: ``'cuda'``). + This argument is discouraged and subject to deprecated. + + Returns: + A pinned CPU storage. + """ + _warn_typed_storage_removal() + return self._new_wrapped_storage( + self._untyped_storage.pin_memory(device=device) + ) + + def share_memory_(self): + """See :meth:`torch.UntypedStorage.share_memory_`""" + _warn_typed_storage_removal() + return self._share_memory_() + + # For internal use only, to avoid deprecation warning + def _share_memory_(self): + self._untyped_storage.share_memory_() + return self + + def _new_shared(self, size, *, device=None): + """Create a new storage in shared memory with the same data type.""" + if device is None: + device = "cpu" + device = torch.device(device) + untyped_storage = torch.UntypedStorage._new_shared( + size * self._element_size(), device=device + ) + return TypedStorage( + wrap_storage=untyped_storage, dtype=self.dtype, _internal=True + ) + + @property + def _cdata(self): + return self._untyped_storage._cdata + + @property + def device(self): + _warn_typed_storage_removal() + return self._untyped_storage.device + + def size(self): + _warn_typed_storage_removal() + return self._size() + + # For internal use only, to avoid deprecation warning + def _size(self): + # NB: don't indirect through __len__, as that requires + # an int to be returned + return self._untyped_storage.nbytes() // self._element_size() + + def pickle_storage_type(self): + _warn_typed_storage_removal() + return self._pickle_storage_type() + + # For internal use only, to avoid deprecation warning + def _pickle_storage_type(self): + try: + return _dtype_to_storage_type_map()[self.dtype] + except KeyError as e: + raise KeyError(f"dtype {self.dtype} is not recognized") from e + + def __reduce__(self): + b = io.BytesIO() + torch.save(self, b, _use_new_zipfile_serialization=False) + return (_load_from_bytes, (b.getvalue(),)) + + def data_ptr(self): + _warn_typed_storage_removal() + return self._data_ptr() + + # For internal use only, to avoid deprecation warning + def _data_ptr(self): + return self._untyped_storage.data_ptr() + + def resizable(self): + _warn_typed_storage_removal() + return self._untyped_storage.resizable() + + def resize_(self, size): + _warn_typed_storage_removal() + self._resize_(size) + + # For internal use only, to avoid deprecation warning + def _resize_(self, size): + self._untyped_storage.resize_(size * self._element_size()) + + @classmethod + def _free_weak_ref(cls, *args, **kwargs): + return UntypedStorage._free_weak_ref(*args, **kwargs) + + def _weak_ref(self, *args, **kwargs): + return self._untyped_storage._weak_ref(*args, **kwargs) + + @classmethod + def from_buffer(cls, *args, **kwargs): + _warn_typed_storage_removal() + return cls._from_buffer(*args, **kwargs) + + @classmethod + def _from_buffer(cls, *args, dtype=None, device=None, **kwargs): + if cls == TypedStorage: + dtype = torch.get_default_dtype() if dtype is None else dtype + device = torch.device("cpu" if device is None else device) + if device.type != "cpu": + raise RuntimeError( + f"TypedStorage.from_buffer: Not available for device {device.type}" + ) + untyped_storage: torch.UntypedStorage = torch.UntypedStorage.from_buffer( + *args, dtype=dtype, **kwargs + ) + + else: + if dtype is not None or len(args) == 5: + raise RuntimeError( + "from_buffer: 'dtype' can only be specified in " + "UntypedStorage.from_buffer and TypedStorage.from_buffer" + ) + if device is not None: + raise RuntimeError( + "from_buffer: 'device' can only be specified in " + "UntypedStorage.from_buffer and TypedStorage.from_buffer" + ) + + dtype = cls._dtype + untyped_storage = torch.UntypedStorage.from_buffer( + *args, dtype=dtype, **kwargs + ) + + return TypedStorage(wrap_storage=untyped_storage, dtype=dtype, _internal=True) + + def _to(self, dtype): + if not isinstance(dtype, torch.dtype): + raise TypeError(f"Argument 'dtype' must be torch.dtype, not {type(dtype)}") + storage = ( + torch.tensor([], dtype=self.dtype, device=self.device) + .set_(self) + .to(dtype) + ._typed_storage() + ) + if storage.data_ptr() == self.data_ptr(): + storage = storage.clone() + return storage + + def double(self): + """Casts this storage to double type.""" + _warn_typed_storage_removal() + return self._to(torch.double) + + def float(self): + """Casts this storage to float type.""" + _warn_typed_storage_removal() + return self._to(torch.float) + + def half(self): + """Casts this storage to half type.""" + _warn_typed_storage_removal() + return self._to(torch.half) + + def long(self): + """Casts this storage to long type.""" + _warn_typed_storage_removal() + return self._to(torch.long) + + def int(self): + """Casts this storage to int type.""" + _warn_typed_storage_removal() + return self._to(torch.int) + + def short(self): + """Casts this storage to short type.""" + _warn_typed_storage_removal() + return self._to(torch.short) + + def char(self): + """Casts this storage to char type.""" + _warn_typed_storage_removal() + return self._to(torch.int8) + + def byte(self): + """Casts this storage to byte type.""" + _warn_typed_storage_removal() + return self._to(torch.uint8) + + def bool(self): + """Casts this storage to bool type.""" + _warn_typed_storage_removal() + return self._to(torch.bool) + + def bfloat16(self): + """Casts this storage to bfloat16 type.""" + _warn_typed_storage_removal() + return self._to(torch.bfloat16) + + def complex_double(self): + """Casts this storage to complex double type.""" + _warn_typed_storage_removal() + return self._to(torch.cdouble) + + def complex_float(self): + """Casts this storage to complex float type.""" + _warn_typed_storage_removal() + return self._to(torch.cfloat) + + def float8_e5m2(self): + """Casts this storage to float8_e5m2 type""" + _warn_typed_storage_removal() + return self._to(torch.float8_e5m2) + + def float8_e4m3fn(self): + """Casts this storage to float8_e4m3fn type""" + _warn_typed_storage_removal() + return self._to(torch.float8_e4m3fn) + + def float8_e5m2fnuz(self): + """Casts this storage to float8_e5m2fnuz type""" + _warn_typed_storage_removal() + return self._to(torch.float8_e5m2fnuz) + + def float8_e4m3fnuz(self): + """Casts this storage to float8_e4m3fnuz type""" + _warn_typed_storage_removal() + return self._to(torch.float8_e4m3fnuz) + + @classmethod + def from_file(cls, filename, shared, size): + """from_file(filename, shared=False, size=0) -> Storage + + Creates a CPU storage backed by a memory-mapped file. + + If ``shared`` is ``True``, then memory is shared between all processes. + All changes are written to the file. If ``shared`` is ``False``, then the changes on + the storage do not affect the file. + + ``size`` is the number of elements in the storage. If ``shared`` is ``False``, + then the file must contain at least ``size * sizeof(Type)`` bytes + (``Type`` is the type of storage). If ``shared`` is ``True`` the file will be created if needed. + + Args: + filename (str): file name to map + shared (bool): whether to share memory (whether ``MAP_SHARED`` or ``MAP_PRIVATE`` is passed to the + underlying `mmap(2) call `_) + size (int): number of elements in the storage + """ + _warn_typed_storage_removal() + if cls == TypedStorage: + raise RuntimeError("from_file can only be called on derived classes") + untyped_storage = UntypedStorage.from_file( + filename, shared, size * torch._utils._element_size(cls.dtype) + ) + storage = cls(wrap_storage=untyped_storage) + return storage + + @classmethod + def _expired(cls, *args, **kwargs): + return UntypedStorage._expired(*args, **kwargs) + + def _write_file(self, *args, **kwargs): + return self._untyped_storage._write_file(*args, **kwargs) + + def _set_from_file(self, *args, **kwargs): + return self._untyped_storage._set_from_file(*args, **kwargs) + + def _set_cdata(self, *args, **kwargs): + return self._untyped_storage._set_cdata(*args, **kwargs) + + def _share_cuda_(self, *args, **kwargs): + return self._untyped_storage._share_cuda_(*args, **kwargs) + + def is_shared(self): + _warn_typed_storage_removal() + return self._is_shared() + + # For internal use only, to avoid deprecation warning + def _is_shared(self): + return self._untyped_storage.is_shared() + + @classmethod + def _new_shared_cuda(cls, *args, **kwargs): + return torch.UntypedStorage._new_shared_cuda(*args, **kwargs) + + def _share_filename_cpu_(self, *args, **kwargs): + ( + manager_handle, + storage_handle, + size, + ) = self._untyped_storage._share_filename_cpu_(*args, **kwargs) + return manager_handle, storage_handle, size // self._element_size() + + def _shared_decref(self): + self._untyped_storage._shared_decref() + return self + + @classmethod + def _release_ipc_counter(cls, *args, device=None, **kwargs): + return torch.UntypedStorage._release_ipc_counter_cuda(*args, **kwargs) + + def _shared_incref(self, *args, **kwargs): + return self._untyped_storage._shared_incref(*args, **kwargs) + + def _share_fd_cpu_(self, *args, **kwargs): + fd, size = self._untyped_storage._share_fd_cpu_(*args, **kwargs) + return fd, size // self._element_size() + + def _get_legacy_storage_class(self): + if self.dtype not in _dtype_to_storage_type_map(): + return None + + storage_name = _dtype_to_storage_type_map()[self.dtype] + + if self.device.type not in [ + "cpu", + "cuda", + "hpu", + torch._C._get_privateuse1_backend_name(), + ]: + return None + + module = ( + torch if self.device.type == "cpu" else getattr(torch, self.device.type) + ) + + try: + return getattr(module, storage_name) + except AttributeError: + return None + + +TypedStorage.type.__doc__ = _type.__doc__ +TypedStorage.cuda.__doc__ = _StorageBase.cuda.__doc__ +TypedStorage.hpu.__doc__ = _StorageBase.hpu.__doc__ +TypedStorage.to.__doc__ = _to.__doc__ + + +class _LegacyStorageMeta(type): + dtype: torch.dtype + + def __instancecheck__(cls, instance): + if type(instance) is TypedStorage: + cls_device = _get_device_from_module(cls.__module__) + return (cls_device == instance.device.type) and ( + cls.dtype == instance.dtype + ) + return False + + +class _LegacyStorage(TypedStorage, metaclass=_LegacyStorageMeta): + @classmethod + def _new_shared(cls, size): # type: ignore[override] + """Create a new storage in shared memory with the same data type.""" + untyped_storage = torch.UntypedStorage._new_shared(size * cls()._element_size()) + return cls(wrap_storage=untyped_storage) + + @classmethod + def _release_ipc_counter(cls, *args, **kwargs): + return torch.UntypedStorage._release_ipc_counter_cuda(*args, **kwargs) + + @classmethod + def _new_shared_filename(cls, manager, obj, size): + bytes_size = size * torch._utils._element_size(cls.dtype) + return cls( + wrap_storage=torch.UntypedStorage._new_shared_filename_cpu( + manager, obj, bytes_size + ) + ) + + +def _get_dtype_from_pickle_storage_type(pickle_storage_type: str): + try: + return _storage_type_to_dtype_map()[pickle_storage_type] + except KeyError as e: + raise KeyError( + f'pickle storage type "{pickle_storage_type}" is not recognized' + ) from e diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/torch_version.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/torch_version.py new file mode 100644 index 0000000000000000000000000000000000000000..5cbfec5cc5855b21af23de61c272bffeac3af6b1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/torch_version.py @@ -0,0 +1,66 @@ +from collections.abc import Iterable +from typing import Any + +from torch._vendor.packaging.version import InvalidVersion, Version +from torch.version import __version__ as internal_version + + +__all__ = ["TorchVersion"] + + +class TorchVersion(str): + """A string with magic powers to compare to both Version and iterables! + Prior to 1.10.0 torch.__version__ was stored as a str and so many did + comparisons against torch.__version__ as if it were a str. In order to not + break them we have TorchVersion which masquerades as a str while also + having the ability to compare against both packaging.version.Version as + well as tuples of values, eg. (1, 2, 1) + Examples: + Comparing a TorchVersion object to a Version object + TorchVersion('1.10.0a') > Version('1.10.0a') + Comparing a TorchVersion object to a Tuple object + TorchVersion('1.10.0a') > (1, 2) # 1.2 + TorchVersion('1.10.0a') > (1, 2, 1) # 1.2.1 + Comparing a TorchVersion object against a string + TorchVersion('1.10.0a') > '1.2' + TorchVersion('1.10.0a') > '1.2.1' + """ + + __slots__ = () + + # fully qualified type names here to appease mypy + def _convert_to_version(self, inp: Any) -> Any: + if isinstance(inp, Version): + return inp + elif isinstance(inp, str): + return Version(inp) + elif isinstance(inp, Iterable): + # Ideally this should work for most cases by attempting to group + # the version tuple, assuming the tuple looks (MAJOR, MINOR, ?PATCH) + # Examples: + # * (1) -> Version("1") + # * (1, 20) -> Version("1.20") + # * (1, 20, 1) -> Version("1.20.1") + return Version(".".join(str(item) for item in inp)) + else: + raise InvalidVersion(inp) + + def _cmp_wrapper(self, cmp: Any, method: str) -> bool: + try: + return getattr(Version(self), method)(self._convert_to_version(cmp)) + except BaseException as e: + if not isinstance(e, InvalidVersion): + raise + # Fall back to regular string comparison if dealing with an invalid + # version like 'parrot' + return getattr(super(), method)(cmp) + + +for cmp_method in ["__gt__", "__lt__", "__eq__", "__ge__", "__le__"]: + setattr( + TorchVersion, + cmp_method, + lambda x, y, method=cmp_method: x._cmp_wrapper(y, method), + ) + +__version__ = TorchVersion(internal_version) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/types.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/types.py new file mode 100644 index 0000000000000000000000000000000000000000..5e38502570d43fca8cacc06457a04d7d1c34f40d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/types.py @@ -0,0 +1,130 @@ +# In some cases, these basic types are shadowed by corresponding +# top-level values. The underscore variants let us refer to these +# types. See https://github.com/python/mypy/issues/4146 for why these +# workarounds is necessary +import os +from builtins import ( # noqa: F401 + bool as _bool, + bytes as _bytes, + complex as _complex, + float as _float, + int as _int, + str as _str, +) +from collections.abc import Sequence +from typing import Any, IO, TYPE_CHECKING, TypeAlias, Union +from typing_extensions import Self + +# `as` imports have better static analysis support than assignment `ExposedType: TypeAlias = HiddenType` +from torch import ( # noqa: F401 + device as _device, + DispatchKey, + dtype as _dtype, + layout as _layout, + qscheme as _qscheme, + Size, + SymBool, + SymFloat, + SymInt, + Tensor, +) + + +if TYPE_CHECKING: + from torch.autograd.graph import GradientEdge + + +__all__ = ["Number", "Device", "FileLike", "Storage"] + +# Convenience aliases for common composite types that we need +# to talk about in PyTorch +_TensorOrTensors: TypeAlias = Tensor | Sequence[Tensor] # noqa: PYI047 +_TensorOrTensorsOrGradEdge: TypeAlias = Union[ # noqa: PYI047 + Tensor, + Sequence[Tensor], + "GradientEdge", + Sequence["GradientEdge"], +] + +_size: TypeAlias = Size | list[int] | tuple[int, ...] # noqa: PYI042,PYI047 +_symsize: TypeAlias = Size | Sequence[int | SymInt] # noqa: PYI042,PYI047 +_dispatchkey: TypeAlias = str | DispatchKey # noqa: PYI042,PYI047 + +# int or SymInt +IntLikeType: TypeAlias = int | SymInt +# float or SymFloat +FloatLikeType: TypeAlias = float | SymFloat +# bool or SymBool +BoolLikeType: TypeAlias = bool | SymBool + +py_sym_types = (SymInt, SymFloat, SymBool) # left un-annotated intentionally +PySymType: TypeAlias = SymInt | SymFloat | SymBool + +# Meta-type for "numeric" things; matches our docs +Number: TypeAlias = int | float | bool +# tuple for isinstance(x, Number) checks. +# FIXME: refactor once python 3.9 support is dropped. +_Number = (int, float, bool) + +FileLike: TypeAlias = str | os.PathLike[str] | IO[bytes] + +# Meta-type for "device-like" things. Not to be confused with 'device' (a +# literal device object). This nomenclature is consistent with PythonArgParser. +# None means use the default device (typically CPU) +Device: TypeAlias = _device | str | int | None + + +# Storage protocol implemented by ${Type}StorageBase classes +class Storage: + _cdata: int + device: _device + dtype: _dtype + _torch_load_uninitialized: bool + + def __deepcopy__(self, memo: dict[int, Any]) -> Self: + raise NotImplementedError + + def _new_shared(self, size: int) -> Self: + raise NotImplementedError + + def _write_file( + self, + f: Any, + is_real_file: bool, + save_size: bool, + element_size: int, + ) -> None: + raise NotImplementedError + + def element_size(self) -> int: + raise NotImplementedError + + def is_shared(self) -> bool: + raise NotImplementedError + + def share_memory_(self) -> Self: + raise NotImplementedError + + def nbytes(self) -> int: + raise NotImplementedError + + def cpu(self) -> Self: + raise NotImplementedError + + def data_ptr(self) -> int: + raise NotImplementedError + + def from_file( + self, + filename: str, + shared: bool = False, + nbytes: int = 0, + ) -> Self: + raise NotImplementedError + + def _new_with_file( + self, + f: Any, + element_size: int, + ) -> Self: + raise NotImplementedError diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torch/version.py b/TTS/Kokoro/.venv/Lib/site-packages/torch/version.py new file mode 100644 index 0000000000000000000000000000000000000000..9593594ebe1364a258c62c063dc1f4f2b90df984 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torch/version.py @@ -0,0 +1,10 @@ +from typing import Optional + +__all__ = ['__version__', 'debug', 'cuda', 'git_version', 'hip', 'rocm', 'xpu'] +__version__ = '2.10.0+cpu' +debug = False +cuda: Optional[str] = None +git_version = '449b1768410104d3ed79d3bcfe4ba1d65c7f22c0' +hip: Optional[str] = None +rocm: Optional[str] = None +xpu: Optional[str] = None diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a8b61af2c4b58ff14ab7e3b24bf22e8ec6a95da0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/__init__.py @@ -0,0 +1,10 @@ +"""torchgen + +This module contains codegeneration utilities for PyTorch. It is used to +build PyTorch from source, but may also be used for out-of-tree projects +that extend PyTorch. + +Note well that we provide no BC guarantees for torchgen. If you're interested +in using torchgen and want the PyTorch team to be aware, please reach out +on GitHub. +""" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/code_template.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/code_template.py new file mode 100644 index 0000000000000000000000000000000000000000..c8a37df8c779f8b418cccad7ff337f57e778da47 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/code_template.py @@ -0,0 +1,108 @@ +from __future__ import annotations + +import itertools +import re +import textwrap +from typing import TYPE_CHECKING + + +if TYPE_CHECKING: + from collections.abc import Mapping, Sequence + + +# match $identifier or ${identifier} and replace with value in env +# If this identifier is at the beginning of whitespace on a line +# and its value is a list then it is treated as +# block substitution by indenting to that depth and putting each element +# of the list on its own line +# if the identifier is on a line starting with non-whitespace and a list +# then it is comma separated ${,foo} will insert a comma before the list +# if this list is not empty and ${foo,} will insert one after. + + +class CodeTemplate: + substitution_str = r"(^[^\n\S]*)?\$([^\d\W]\w*|\{,?[^\d\W]\w*\,?})" + substitution = re.compile(substitution_str, re.MULTILINE) + + pattern: str + filename: str + + @staticmethod + def from_file(filename: str) -> CodeTemplate: + with open(filename) as f: + return CodeTemplate(f.read(), filename) + + def __init__(self, pattern: str, filename: str = "") -> None: + self.pattern = pattern + self.filename = filename + + def substitute( + self, env: Mapping[str, object] | None = None, **kwargs: object + ) -> str: + if env is None: + env = {} + + def lookup(v: str) -> object: + assert env is not None + return kwargs[v] if v in kwargs else env[v] + + def indent_lines(indent: str, v: Sequence[object]) -> str: + content = "\n".join( + itertools.chain.from_iterable(str(e).splitlines() for e in v) + ) + content = textwrap.indent(content, prefix=indent) + # Remove trailing whitespace on each line + return "\n".join(map(str.rstrip, content.splitlines())).rstrip() + + def replace(match: re.Match[str]) -> str: + indent = match.group(1) + key = match.group(2) + comma_before = "" + comma_after = "" + if key[0] == "{": + key = key[1:-1] + if key[0] == ",": + comma_before = ", " + key = key[1:] + if key[-1] == ",": + comma_after = ", " + key = key[:-1] + v = lookup(key) + if indent is not None: + if not isinstance(v, list): + v = [v] + return indent_lines(indent, v) + elif isinstance(v, list): + middle = ", ".join([str(x) for x in v]) + if len(v) == 0: + return middle + return comma_before + middle + comma_after + else: + return str(v) + + return self.substitution.sub(replace, self.pattern) + + +if __name__ == "__main__": + c = CodeTemplate( + """\ + int foo($args) { + + $bar + $bar + $a+$b + } + int commatest(int a${,stuff}) + int notest(int a${,empty,}) + """ + ) + print( + c.substitute( + args=["hi", 8], + bar=["what", 7], + a=3, + b=4, + stuff=["things...", "others"], + empty=[], + ) + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/context.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/context.py new file mode 100644 index 0000000000000000000000000000000000000000..c6f70b5a9df5347503fe236f918ed38954aa6067 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/context.py @@ -0,0 +1,134 @@ +from __future__ import annotations + +import contextlib +import functools +from typing import Any, TYPE_CHECKING, TypeVar + +import torchgen.local as local +from torchgen.model import ( + BackendIndex, + DispatchKey, + NativeFunction, + NativeFunctionsGroup, + NativeFunctionsViewGroup, +) +from torchgen.utils import context, S, T + + +if TYPE_CHECKING: + from collections.abc import Callable, Iterator + + +# Helper functions for defining generators on things in the model + +F = TypeVar( + "F", + NativeFunction, + NativeFunctionsGroup, + NativeFunctionsViewGroup, + NativeFunction | NativeFunctionsGroup, + NativeFunction | NativeFunctionsViewGroup, +) + +F2 = TypeVar( + "F2", + NativeFunction, + NativeFunctionsGroup, + NativeFunction | None, + bool, + str, +) + +F3 = TypeVar("F3", tuple[NativeFunction, Any], list[NativeFunction]) + + +@contextlib.contextmanager +def native_function_manager( + g: NativeFunctionsGroup | NativeFunctionsViewGroup | NativeFunction, +) -> Iterator[None]: + if isinstance(g, NativeFunctionsGroup): + # By default, we associate all errors with structured native functions + # with the out variant. In some cases, it might be better to have + # a more specific place to hang things; if so, use + # native_function_manager again on the inside + f = g.out + elif isinstance(g, NativeFunctionsViewGroup): + # We associate errors with the view operator + f = g.view + else: + f = g + with context(lambda: f"in native_functions.yaml line {f.loc}:\n {f.func}"): + with local.parametrize( + use_const_ref_for_mutable_tensors=f.use_const_ref_for_mutable_tensors, + use_ilistref_for_tensor_lists=f.part_of_structured_group, + ): + yield + + +# Given a function that operates on NativeFunction, wrap it into a new function +# that sets some appropriate context managers for that native function. +# YOU MUST WRAP FUNCTIONS IN THIS for calls to api modules to be sound +# (you will get an error if we try to access the local variables without having +# set them). +def with_native_function(func: Callable[[F], T]) -> Callable[[F], T]: + @functools.wraps(func) + def wrapper(f: F) -> T: + with native_function_manager(f): + return func(f) + + return wrapper + + +def with_native_function_and(func: Callable[[F, F2], T]) -> Callable[[F, F2], T]: + @functools.wraps(func) + def wrapper(f: F, f2: F2) -> T: + # The first native_function is assumed to be the one with the appropriate context. + with native_function_manager(f): + return func(f, f2) + + return wrapper + + +def method_with_native_function(func: Callable[[S, F], T]) -> Callable[[S, F], T]: + @functools.wraps(func) + def wrapper(slf: S, f: F) -> T: + with native_function_manager(f): + return func(slf, f) + + return wrapper + + +def method_with_nested_native_function( + func: Callable[[S, F3], T], +) -> Callable[[S, F3], T]: + @functools.wraps(func) + def wrapper(slf: S, f: F3) -> T: + with native_function_manager(f[0]): + return func(slf, f) + + return wrapper + + +# Convenience decorator for functions that explicitly take in a BackendIndex, +# instead of indirectly taking one in as a closure +def with_native_function_and_index( + func: Callable[[F, BackendIndex], T], +) -> Callable[[F, BackendIndex], T]: + @functools.wraps(func) + def wrapper(f: F, backend_index: BackendIndex) -> T: + with native_function_manager(f): + return func(f, backend_index) + + return wrapper + + +# Convenience decorator for functions that explicitly take in a Dict of BackendIndices +def with_native_function_and_indices( + func: Callable[[F, dict[DispatchKey, BackendIndex]], T], +) -> Callable[[F, dict[DispatchKey, BackendIndex]], T]: + @functools.wraps(func) + def wrapper(f: F, backend_indices: dict[DispatchKey, BackendIndex]) -> T: + with native_function_manager(f): + return func(f, backend_indices) + + return wrapper diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen.py new file mode 100644 index 0000000000000000000000000000000000000000..722cbca9f8a53c0f18a720f0f2a25751f6159403 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen.py @@ -0,0 +1,3032 @@ +from __future__ import annotations + +import argparse +import functools +import json +import keyword +import os +from collections import defaultdict, namedtuple, OrderedDict +from dataclasses import dataclass, field +from pathlib import Path +from typing import Any, Literal, TYPE_CHECKING, TypeVar +from typing_extensions import assert_never + +import yaml + +import torchgen.api.dispatcher as dispatcher +import torchgen.api.meta as meta +import torchgen.api.native as native +import torchgen.api.structured as structured +import torchgen.dest as dest +from torchgen.api import cpp +from torchgen.api.translate import translate +from torchgen.api.types import ( + Binding, + CppSignature, + CppSignatureGroup, + DispatcherSignature, + NamedCType, + NativeSignature, + SpecialArgName, +) +from torchgen.context import ( + method_with_native_function, + native_function_manager, + with_native_function, + with_native_function_and_indices, +) +from torchgen.gen_aoti_c_shim import ( + gen_aoti_c_shim_files, + gen_static_dispatch_backend_call_signature, +) +from torchgen.gen_functionalization_type import ( + gen_functionalization_definition, + gen_functionalization_registration, + gen_functionalization_view_inverse_declaration, + gen_functionalization_view_meta_classes_decl, + gen_functionalization_view_meta_classes_impl, + GenCompositeViewCopyKernel, +) +from torchgen.gen_vmap_plumbing import gen_all_vmap_plumbing +from torchgen.model import ( + Argument, + BackendIndex, + BackendMetadata, + BaseOperatorName, + DEFAULT_KERNEL_NAMESPACE, + dispatch_device_map, + DispatchKey, + FRAGMENT_NAMESPACES, + FunctionSchema, + is_cuda_dispatch_key, + is_generic_dispatch_key, + is_ufunc_dispatch_key, + is_xpu_dispatch_key, + Location, + NativeFunction, + NativeFunctionsGroup, + NativeFunctionsViewGroup, + OperatorName, + OptionalType, + SchemaKind, + SelfArgument, + STRUCTURED_DISPATCH_KEYS, + TensorOptionsArguments, + Type, + Variant, + ViewSchemaKind, +) +from torchgen.native_function_generation import ( + add_generated_native_functions, + gen_composite_functional_kernel, + gen_composite_out_kernel, + pre_group_native_functions, +) +from torchgen.selective_build.selector import SelectiveBuilder +from torchgen.utils import ( + concatMap, + context, + FileManager, + make_file_manager, + mapMaybe, + NamespaceHelper, + Target, +) +from torchgen.yaml_utils import YamlDumper, YamlLoader + + +if TYPE_CHECKING: + from collections.abc import Callable, Sequence + + +T = TypeVar("T") + +# Welcome to the ATen code generator v2! The ATen code generator is +# responsible for parsing native_functions.yaml and then generating +# various generated files (e.g., TypeDefault.cpp) based on the operators +# defined in this file. This means that the code generator knows how to +# parse function schema, and then translate this into various C++ types +# and boilerplate code. +# +# Some things to know about this file when you modify it: +# +# - This file has STRICT mypy typechecking. Typecheck it with +# `mypy --config mypy-strict.ini` in the root source directory +# +# - Most of the heavy lifting lives in external modules: +# - 'model' has the data model for native_functions.yaml. The classes +# in those file represent what you see when you look at +# a native_functions.yaml +# - 'api' has conversions for how to translate JIT schema into +# the various C++ APIs that the codegen interacts with. There +# are in fact THREE different C++ APIs: the public C++ API, +# the dispatcher API, and the legacy dispatcher API. See each +# of these respective files for more information + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # +# +# HELPER FUNCTIONS +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # + + +# A custom loader for YAML to let us also keep track of line numbers +# of each entry in the YAML file +class LineLoader(YamlLoader): + def construct_mapping(self, node, deep=False): # type: ignore[no-untyped-def] + mapping = super().construct_mapping(node, deep=deep) # type: ignore[no-untyped-call] + # Add 1 so line numbering starts at 1 + mapping["__line__"] = node.start_mark.line + 1 + return mapping + + +# Parse native_functions.yaml into a sequence of NativeFunctions and Backend Indices. +ParsedYaml = namedtuple("ParsedYaml", ["native_functions", "backend_indices"]) + + +_GLOBAL_PARSE_NATIVE_YAML_CACHE: dict[str, ParsedYaml] = {} +_GLOBAL_PARSE_TAGS_YAML_CACHE: dict[str, set[str]] = {} + + +def file_manager_from_dispatch_key( + dispatch_key: DispatchKey, + device_fms: dict[str, FileManager], + default_fm: FileManager, +) -> FileManager: + fm = device_fms.get( + next( + ( + device + for check, device in dispatch_device_map.items() + if check(dispatch_key) + ), + "", + ), + default_fm, + ) + return fm + + +def parse_native_yaml_struct( + es: object, + valid_tags: set[str], + ignore_keys: set[DispatchKey] | None = None, + path: str = "", + skip_native_fns_gen: bool = False, +) -> ParsedYaml: + assert isinstance(es, list) + rs: list[NativeFunction] = [] + bs: dict[DispatchKey, dict[OperatorName, BackendMetadata]] = defaultdict(dict) + for e in es: + assert isinstance(e, dict), f"expected to be dict: {e}" + assert isinstance(e.get("__line__"), int), e + loc = Location(path, e["__line__"]) + funcs = e.get("func") + assert funcs is not None, f"missed 'func' in {e}" + with context(lambda: f"in {loc}:\n {funcs}"): + func, m = NativeFunction.from_yaml(e, loc, valid_tags, ignore_keys) + rs.append(func) + BackendIndex.grow_index(bs, m) + error_check_native_functions(rs) + # Default dict is to prevent the codegen from barfing when we have a dispatch key that has no kernels yet. + indices: dict[DispatchKey, BackendIndex] = defaultdict( + lambda: BackendIndex( + dispatch_key=DispatchKey.Undefined, + use_out_as_primary=True, + external=False, + device_guard=False, + # I'm actually not sure about this; undefined could be hit on + # empty TensorList, hypothetically that could have sizes in it + index={}, + ) + ) + if not skip_native_fns_gen: + add_generated_native_functions(rs, bs) + for k, v in bs.items(): + # All structured in-tree operators are implemented in terms of their out operator. + indices[k] = BackendIndex( + dispatch_key=k, + use_out_as_primary=True, + external=False, + # Only cuda-like devices in tree require device guards + device_guard=is_cuda_dispatch_key(k) or is_xpu_dispatch_key(k), + index=v, + ) + return ParsedYaml(rs, indices) + + +def parse_tags_yaml_struct(es: object, path: str = "") -> set[str]: + assert isinstance(es, list) + rs: set[str] = set() + for e in es: + assert isinstance(e.get("__line__"), int), e + loc = Location(path, e["__line__"]) + tags = e.get("tag") + with context(lambda: f"in {loc}:\n {tags}"): + e_i = e.copy() + name = e_i.pop("tag") + desc = e_i.pop("desc", "") + # ensure that each tag has a non-empty description + assert desc != "" + rs.add(name) + return rs + + +@functools.cache +def parse_tags_yaml(path: str) -> set[str]: + global _GLOBAL_PARSE_TAGS_YAML_CACHE + if path not in _GLOBAL_PARSE_TAGS_YAML_CACHE: + with open(path) as f: + es = yaml.load(f, Loader=LineLoader) + _GLOBAL_PARSE_TAGS_YAML_CACHE[path] = parse_tags_yaml_struct(es, path=path) + + return _GLOBAL_PARSE_TAGS_YAML_CACHE[path] + + +def parse_native_yaml( + path: str, + tags_yaml_path: str, + ignore_keys: set[DispatchKey] | None = None, + *, + skip_native_fns_gen: bool = False, + loaded_yaml: object | None = None, +) -> ParsedYaml: + global _GLOBAL_PARSE_NATIVE_YAML_CACHE + if path not in _GLOBAL_PARSE_NATIVE_YAML_CACHE: + valid_tags = parse_tags_yaml(tags_yaml_path) + + # if a loaded yaml is provided, use that instead of reading from path + if loaded_yaml is None: + with open(path) as f: + es = yaml.load(f, Loader=LineLoader) + else: + es = loaded_yaml + + _GLOBAL_PARSE_NATIVE_YAML_CACHE[path] = parse_native_yaml_struct( + es, + valid_tags, + ignore_keys, + path=path, + skip_native_fns_gen=skip_native_fns_gen, + ) + + return _GLOBAL_PARSE_NATIVE_YAML_CACHE[path] + + +# Some assertions are already performed during parsing, but those are only within a single NativeFunction. +# Assertions here are meant to be performed across NativeFunctions. +def error_check_native_functions(funcs: Sequence[NativeFunction]) -> None: + func_map: dict[OperatorName, NativeFunction] = {} + base_func_map: dict[BaseOperatorName, list[NativeFunction]] = defaultdict(list) + for f in funcs: + func_map[f.func.name] = f + base_func_map[f.func.name.name].append(f) + for f in funcs: + if f.structured_delegate is not None: + delegate_func = func_map.get(f.structured_delegate) + assert delegate_func is not None, ( + f"{f.func.name} is marked as a structured_delegate pointing to " + f"{f.structured_delegate}, but {f.structured_delegate} is missing." + ) + assert delegate_func.structured, ( + f"{f.func.name} is marked as a structured_delegate pointing to " + f"{f.structured_delegate}, but {f.structured_delegate} is not marked as structured. " + f"Consider adding 'structured=True' to the delegated operator" + ) + + # Check for reserved Python keywords + PYTHON_RESERVED_KEYWORDS = set(keyword.kwlist) + # List of pre-existing operators that are known to have reserved keywords + # Exclusion list is used to suppress the assertion for these operators + EXCLUSION_LIST = { + ("_has_compatible_shallow_copy_type", "from"), + ("random_.from", "from"), + ("uniform_", "from"), + } + + for arg in f.func.arguments.flat_all: + if arg.name in PYTHON_RESERVED_KEYWORDS: + if (str(f.func.name), arg.name) not in EXCLUSION_LIST: + raise AssertionError( + f"Argument name '{arg.name}' in function '{f.func.name}' is a reserved Python keyword." + ) + # See Note [resize_ in Functionalization] + # resize_() is technically an inplace view op (and therefore needs the tag), + # but it would be overkill to add a true "view" variant of resize. + # Instead, resize_() gets special treatment in functionalization, + # and we have a resize() op that is non-aliasing + functional. + if ( + "inplace_view" in f.tags + and str(f.func.name) != "resize_" + and str(f.func.name) != "resize_as_" + and str(f.func.name.name) != "set_" + ): + base_name = f.func.name.name + assert base_name.inplace, ( + f"{f.func.name} is marked with tag: inplace_view, but it doesn't follow the naming " + "convention for inplace ops - the codegen expects the base name to have a trailing underscore. " + ) + out_of_place_base_name = BaseOperatorName( + base_name.base, False, base_name.dunder_method + ) + assert len(base_func_map[out_of_place_base_name]) > 0, ( + f"{f.func.name} is marked with tag: inplace_view. The codegen expects there to be a corresponding " + f"out-of-place view op with the name '{base_name}' and matching schema, but it didn't find one. " + ) + + +def cpp_string(s: str) -> str: + """Convert a python string into a c++ string literal""" + s = s.replace("\\", "\\\\") + s = s.replace('"', '\\"') + s = s.replace("\a", "\\a") + s = s.replace("\b", "\\b") + s = s.replace("\f", "\\f") + s = s.replace("\n", "\\n") + s = s.replace("\v", "\\v") + s = s.replace("\t", "\\t") + return f'"{s}"' + + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # +# +# C++ CODE GENERATION +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # + +# Most functions in this section are curried: they consist of a function +# that takes some parameters (e.g., what is to be generated) which itself +# returns a function that actually maps NativeFunction to the code +# to be generated. This pattern makes it convenient to use map, concatMap +# and similar functional combinators. + + +def static_dispatch_keys(backends: list[BackendIndex]) -> list[DispatchKey]: + if len(backends) == 0: + return [] + else: + return [backend.dispatch_key for backend in backends] + [ + DispatchKey.CompositeImplicitAutograd, + DispatchKey.CompositeImplicitAutogradNestedTensor, + DispatchKey.CompositeExplicitAutograd, + DispatchKey.CompositeExplicitAutogradNonFunctional, + ] + + +def get_static_dispatch_backend( + f: NativeFunction, backend_index: BackendIndex +) -> DispatchKey | None: + if f.structured_delegate is not None or backend_index.has_kernel(f): + # TODO: for ops with structured_delegate it should check the dispatch table of + # the out variant instead. For now, these structured ops all have CPU/CUDA kernels + # so we always dispatch to the `backend`, but this could be wrong when we + # migrate math/default_backend ops to use structured delegate. + return backend_index.dispatch_key + elif f.has_composite_explicit_autograd_kernel: + return DispatchKey.CompositeExplicitAutograd + elif f.has_composite_explicit_autograd_non_functional_kernel: + return DispatchKey.CompositeExplicitAutogradNonFunctional + elif f.has_composite_implicit_autograd_kernel: + return DispatchKey.CompositeImplicitAutograd + elif f.has_composite_implicit_autograd_nested_tensor_kernel: + return DispatchKey.CompositeImplicitAutogradNestedTensor + return None + + +def static_dispatch_ops_header( + f: NativeFunction, backend_index: list[BackendIndex] +) -> str | None: + if backend_index is None or f.manual_kernel_registration: + return None + + output = [] + for index in backend_index: + dispatch_key = get_static_dispatch_backend(f, index) + if dispatch_key is not None: + output.append( + f"#include " + ) + return "\n".join(output) + + +def static_dispatch_extra_headers(backends: list[BackendIndex]) -> list[str]: + return [ + f"#include " + for dispatch_key in static_dispatch_keys(backends) + ] + + +# Translates arguments of `sig` to CppSignature bindings. +# Note that we have a special case for `memory_format` argument and this case is not covered by +# tools.codegen.api.translate() yet as its application is limited to static dispatch. +def translate_args( + sig: CppSignature | DispatcherSignature, + cpp_sig: CppSignature, +) -> str: + # Adds SpecialArgName.possibly_redundant_memory_format NamedCType for memory_format bindings + def add_spl_memory_format_binding(input_bindings: list[Binding]) -> list[Binding]: + output_bindings: list[Binding] = [] + for binding in input_bindings: + if binding.name == "memory_format": + spl_mem_format_binding = Binding( + nctype=NamedCType( + SpecialArgName.possibly_redundant_memory_format, + binding.nctype.type, + ), + name=binding.name, + default=binding.default, + argument=binding.argument, + ) + output_bindings.append(spl_mem_format_binding) + else: + output_bindings.append(binding) + return output_bindings + + src_bindings = list(sig.arguments()) + goal_bindings = list(cpp_sig.arguments()) + # When last argument of CPP signature has SpecialArgName.possibly_redundant_memory_format NCType, + # get memory_format bindings of dispatcher signature to have the same NCType as well + for arg in goal_bindings: + if arg.nctype.name == SpecialArgName.possibly_redundant_memory_format: + src_bindings = add_spl_memory_format_binding(src_bindings) + break + exprs = translate(src_bindings, goal_bindings) + return ", ".join(a.expr for a in exprs) + + +def generate_static_dispatch_backend_call( + sig: CppSignature | DispatcherSignature, + f: NativeFunction, + backend_index: BackendIndex, +) -> str: + cpp_sig = gen_static_dispatch_backend_call_signature(sig, f) + name = cpp_sig.name() + exprs = translate_args(sig, cpp_sig) + backend_metadata = backend_index.get_kernel(f) + kernel_ns = ( + backend_metadata.cpp_namespace + if backend_metadata and backend_metadata.cpp_namespace + else DEFAULT_KERNEL_NAMESPACE + ) + ns = kernel_ns.replace("::native", "") + return f"return {ns}::{backend_index.dispatch_key.lower()}::{name}({exprs});" + + +def generate_static_dispatch_fallback_call( + sig: CppSignature | DispatcherSignature, + f: NativeFunction, + backend_indices: list[BackendIndex], +) -> str: + cpp_sigs = CppSignatureGroup.from_native_function( + f, method=False, fallback_binding=False + ) + if sig.symint and f.func.has_symint(): + cpp_sig = cpp_sigs.symint_signature + else: + cpp_sig = cpp_sigs.signature + assert cpp_sig is not None + name = cpp_sig.name() + exprs = translate_args(sig, cpp_sig) + ns = DEFAULT_KERNEL_NAMESPACE.replace("::native", "") + if f.has_composite_explicit_autograd_kernel: + return f"return {ns}::{DispatchKey.CompositeExplicitAutograd.lower()}::{name}({exprs});" + elif f.has_composite_explicit_autograd_non_functional_kernel: + return f"return {ns}::{DispatchKey.CompositeExplicitAutogradNonFunctional.lower()}::{name}({exprs});" + elif f.has_composite_implicit_autograd_kernel: + return f"return {ns}::{DispatchKey.CompositeImplicitAutograd.lower()}::{name}({exprs});" + elif f.has_composite_implicit_autograd_nested_tensor_kernel: + return f"return {ns}::{DispatchKey.CompositeImplicitAutogradNestedTensor.lower()}::{name}({exprs});" + else: + return f"""TORCH_CHECK(false, "Static dispatch does not support {name} for\ +{", ".join([str(index.dispatch_key) for index in backend_indices])} ");""" + + +def static_dispatch( + sig: CppSignature | DispatcherSignature, + f: NativeFunction, + backend_indices: list[BackendIndex], +) -> str: + """ + For a given `NativeFunction`, find out the corresponding backend and dispatch to it. If more than one + backends exist, fallback to static dispatch by determining dispatch key from inputs. + Arguments: + sig: A CppSignature or DispatcherSignature for this native function we want to use. + f: NativeFunction to generate static dispatch. + backend_indices: All available backends. + Return: + C++ code to call backend-specific functions, e.g., "return at::cpu::add(self, other, scale);" + """ + if len(backend_indices) == 0 or f.manual_kernel_registration: + return "" + + keys = [ + b + for b in backend_indices + if b.has_kernel(f) + or ( + f.structured_delegate is not None + and b.dispatch_key in STRUCTURED_DISPATCH_KEYS + ) + ] + if len(keys) == 1: + return generate_static_dispatch_backend_call(sig, f, keys[0]) + elif len(keys) == 0: + return generate_static_dispatch_fallback_call(sig, f, backend_indices) + + native_tensor_args = [ + a.name + for a in sig.arguments() + if isinstance(a.argument, SelfArgument) + or isinstance(a.argument, Argument) + and a.argument.type.is_tensor_like() + ] + tensor_args = ", ".join(native_tensor_args) + tensor_opts = f.func.arguments.tensor_options + + stmts = [] + subexprs: list[str] = [] + if tensor_opts is not None: + subexprs.append( + "DispatchKeySet(c10::computeDispatchKey(dtype, layout, device))" + ) + if tensor_args != "": + subexprs.append(f"c10::detail::multi_dispatch_key_set({tensor_args})") + stmts.append(f"""DispatchKeySet _dk_set = {" | ".join(subexprs)};""") + stmts.append("DispatchKey _dk = c10::highestPriorityBackendTypeId(_dk_set);") + + dispatch_code = [] + for index in keys: + dispatch_code.append(f"""case DispatchKey::{index.dispatch_key}:""") + dispatch_code.append( + f"""\t{generate_static_dispatch_backend_call(sig, f, index)};""" + ) + + fallback = generate_static_dispatch_fallback_call(sig, f, backend_indices) + connector = "\n\t\t" + + return f""" + {connector.join(stmts)} + switch (_dk) {{ + {connector.join(dispatch_code)} + default: + {fallback} + }} + """ + + +# Generates RegisterSchema.cpp. Depending on the selector, either +# all schemas are registered, or only some are (in the case of +# selective build) +@dataclass(frozen=True) +class RegisterSchema: + selector: SelectiveBuilder + known_tags: dict[str, int] = field(default_factory=dict) + + @method_with_native_function + def __call__(self, f: NativeFunction) -> str | None: + if not self.selector.is_native_function_selected(f): + return None + tags = "{" + ", ".join(f"at::Tag::{tag}" for tag in sorted(f.tags)) + "}" + if tags == "{}": + return f"m.def({cpp_string(str(f.func))}, {{}});\n" + maybe_tags = "" + if tags not in self.known_tags: + idx = len(self.known_tags) + self.known_tags[tags] = idx + maybe_tags = f"const std::vector tags_{idx} = {tags};\n" + return f"{maybe_tags}m.def({cpp_string(str(f.func))}, tags_{self.known_tags[tags]});\n" + + +# Generates Operators.h and Operators.cpp. +# These provide macros that, given an operator and overload name, allow users +# to access an "un-overloaded" function version of the operator. This +# is useful for extension writers who want to (1) want to decltype the operator +# and (2) don't want to worry about method-only operators. +@dataclass(frozen=True) +class ComputeOperators: + target: Literal[Target.DECLARATION, Target.DEFINITION] + static_dispatch_backend_indices: list[BackendIndex] + + @method_with_native_function + def __call__(self, f: NativeFunction) -> str: + sig = DispatcherSignature.from_schema(f.func) + name = f.func.name.unambiguous_name() + + if self.target is Target.DECLARATION: + # Note [The ATen Operators API] + # The ATen Operators API lives in the at::_ops namespace, and contains compile-time + # metadata about each operator + entry points into the Dispatcher. + # The C++ function, method, and redispatch API's are all implemented as wrappers + # into various bits of the structs defined here. + # + # Important characteristics about the Operators API: + # (1) It follows the Dispatcher API. + # This is kind of necessary to avoid overhead. + # For example: if it followed the C++ API, then all of the faithful C++ factory functions + # would need to wrap their arguments into TensorOptions only to unwrap them again. + # (2) Overload names are disambiguated. + # This is helpful for pytorch extenders who would like to decltype() an aten operator, + # that has overloads, e.g. decltype(at::_ops::mul_Tensor::call) + # (3) No argument defaulting is allowed. + # This is more of an implementation detail to avoid #include cycles, + # since TensorBody.h (which defines the Tensor class) needs to include this file. + # (4) manual_cpp_bindings and faithful names are not included in the API. + # This applies to stuff like __dispatch__is_complex(), and add_outf(). + # These aren't "real aten ops", they're just additional functions provided by the C++ API. + # They're implemented as wrappers in Functions.h that call into the actual operators + # defined here, i.e. at::_ops::is_complex::call() and at::_ops::add_out::call(). + # This means that ATEN_OP(is_complex) will not fastpath, and will go through the dispatcher. + return f""" +struct TORCH_API {name} {{ + using schema = {sig.type()}; + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + static constexpr const char* name = "aten::{f.func.name.name}"; + static constexpr const char* overload_name = "{f.func.name.overload_name}"; + static constexpr const char* schema_str = {cpp_string(str(f.func))}; + static {sig.defn(name="call", is_redispatching_fn=False)}; + static {sig.defn(name="redispatch", is_redispatching_fn=True)}; +}};""" + + elif self.target is Target.DEFINITION: + defns = f""" +// aten::{f.func} +static C10_NOINLINE c10::TypedOperatorHandle<{name}::schema> create_{name}_typed_handle() {{ + return c10::Dispatcher::singleton() + .findSchemaOrThrow({name}::name, {name}::overload_name) + .typed<{name}::schema>(); +}} +""" + for is_redispatching_fn in [False, True]: + if is_redispatching_fn: + dispatcher_exprs_str = ", ".join( + ["dispatchKeySet"] + [a.name for a in sig.arguments()] + ) + method_base = "redispatch" + else: + dispatcher_exprs_str = ", ".join([a.name for a in sig.arguments()]) + method_base = "call" + + dispatcher_call = method_base + method_name = f"{name}::{method_base}" + + fn_body = f""" + static auto op = create_{name}_typed_handle(); + return op.{dispatcher_call}({dispatcher_exprs_str});""" + + if ( + not is_redispatching_fn + and len(self.static_dispatch_backend_indices) > 0 + ): + # call() should go through static dispatch + fn_body = static_dispatch( + sig, f, backend_indices=self.static_dispatch_backend_indices + ) + defns += f""" +// aten::{f.func} +{sig.defn(name=method_name, is_redispatching_fn=is_redispatching_fn)} {{ + {fn_body} +}} +""" + return defns + else: + assert_never(self.target) + + +# Generates Functions.h, which provides the functional public C++ API, +# and the scaffolding to call into the dispatcher from these functions. +@dataclass(frozen=True) +class ComputeFunction: + @method_with_native_function + def __call__(self, f: NativeFunction) -> str | None: + sig_group = CppSignatureGroup.from_native_function( + f, method=False, fallback_binding=f.manual_cpp_binding + ) + has_symint = f.func.has_symint() + + result = "" + for sig in sig_group.signatures(): + # See Note [The ATen Operators API] + target_sig = DispatcherSignature.from_schema(f.func) + exprs = translate(sig.arguments(), target_sig.arguments()) + exprs_str = ", ".join([e.expr for e in exprs]) + + if sig.symint: + intlike_t = "c10::SymInt" + else: + intlike_t = "int64_t" + + if Variant.function in f.variants: + result += f""" +// aten::{f.func} +inline {sig.decl()} {{ + return at::_ops::{f.func.name.unambiguous_name()}::call({exprs_str}); +}}""" + + # The template function can be used from template situations + # where you want to switch between the symint or not version + # depending on a template argument + # + # NB: we ALWAYS generate this even for methods. But we put it in + # this header so it can take advantage of per-op headers + if has_symint: + result += f""" +namespace symint {{ + template >> + {sig.decl(suppress_symint_suffix=True)} {{ + return at::_ops::{f.func.name.unambiguous_name()}::call({exprs_str}); + }} +}} +""" + return result + + +# Generates TensorBody.h. This file provides the object-oriented (method-based) +# public C++ API, and the scaffolding to call into the dispatcher from these functions. +@dataclass(frozen=True) +class ComputeTensorMethod: + target: Literal[Target.DECLARATION, Target.DEFINITION] + static_dispatch_backend_indices: list[BackendIndex] + + @method_with_native_function + def __call__(self, f: NativeFunction) -> str | None: + if Variant.method not in f.variants: + return None + + assert not f.func.is_out_fn() + assert f.func.arguments.self_arg is not None + + sig_group = CppSignatureGroup.from_native_function( + f, method=True, fallback_binding=f.manual_cpp_binding + ) + + if self.target is Target.DECLARATION: + result = "" + for sig in sig_group.signatures(): + result += f"{sig.decl()} const;\n" + return result + + if self.target is not Target.DEFINITION: + assert_never(self.target) + + result = "" + + for sig in sig_group.signatures(): + target_sig = DispatcherSignature.from_schema(f.func) + exprs = translate(sig.arguments(), target_sig.arguments(), method=True) + exprs_str = ", ".join([e.expr for e in exprs]) + + result += f""" +// aten::{f.func} +inline {sig.defn(prefix="Tensor::")} const {{ + return at::_ops::{f.func.name.unambiguous_name()}::call({exprs_str}); +}} +""" + + return result + + +# Generates RedispatchFunctions.h. +# This is similar to the C++ API defined in Functions.h, but provides access +# to the dispatcher's redispatch API. +@dataclass(frozen=True) +class ComputeRedispatchFunction: + @method_with_native_function + def __call__(self, f: NativeFunction) -> str | None: + # We unconditionally generate function variants of the redispatch API. + # This is mainly because we can namespace functions separately, but not methods, + sig_group = CppSignatureGroup.from_native_function( + f, method=False, fallback_binding=f.manual_cpp_binding + ) + + result = "" + for sig in sig_group.signatures(): + target_sig = DispatcherSignature.from_schema(f.func) + exprs = translate(sig.arguments(), target_sig.arguments()) + exprs_str = ", ".join(["dispatchKeySet"] + [a.expr for a in exprs]) + + result += f""" +// aten::{f.func} +inline {sig.decl(is_redispatching_fn=True)} {{ + return at::_ops::{f.func.name.unambiguous_name()}::redispatch({exprs_str}); +}} +""" + + return result + + +# Generates ATenOpList.cpp, a runtime accessible list of all aten +# operators. +# TODO: This was historically used to help some JIT interop code +# figure out whether or not to treat aten namespace'd operators +# one way or another, we should reevaluate if this is actually needed. +@with_native_function +def compute_aten_op(f: NativeFunction) -> str: + return f'{{"aten::{f.func.name.name}", "{f.func.name.overload_name}"}},' + + +# Generates MetaFunctions.h +def compute_meta_function_declaration(g: NativeFunctionsGroup) -> str | None: + if not g.structured: + return None + with native_function_manager(g.out): + name = meta.name(g) + args = structured.meta_arguments(g) + args_str = ", ".join(a.decl() for a in args) + parent_class = g.out.structured_inherits + if parent_class is None: + parent_class = "at::impl::MetaBase" + meta_return = "void" + precomputed = g.out.precomputed if g.structured else None + + if precomputed: + # Generate the template declaration with one bool parameter for each + # precomputed element. Each parameter is true if the corresponding (in + # terms of position) precomputed element has been set. + precomputed_values = [*precomputed.replace.values(), precomputed.add] + precomputed_elements = [ + elem for replace_list in precomputed_values for elem in replace_list + ] + precomputed_template_parameters = [ + elem.name.upper() for elem in precomputed_elements + ] + precomputed_template_params_str = ", ".join( + f"bool {param} = false" for param in precomputed_template_parameters + ) + precompute_template_decl = f"template <{precomputed_template_params_str}>" + + # Generate a string containing declarations of all precomputed elements. + precomputed_elements_with_cpp_types = [ + structured.argument_type(elem, binds=elem.name) + for elem in precomputed_elements + ] + + precomputed_elements_decl = ";\n".join( + f"{elem.cpp_type(strip_ref=True)} {elem.name}" + for elem in precomputed_elements_with_cpp_types + ) + + # Generate "setter" methods for each precomputed element. Each method will return + # a new instance of precompute_out with the template parameter that corresponds to + # the member set by the method to true (to indicate that it has been set). + setter_methods = [] + for i, elem in enumerate(precomputed_elements): + # Generate the signature. The return type will be the same + # as the type of `this` but with the template parameter + # corresponding to the element set by this method set to true. + # The assert generated below will ensure that this template + # parameter is false on the type of `this`. + return_ty_templates = ", ".join( + precomputed_template_parameters[:i] + + ["true"] + + precomputed_template_parameters[i + 1 :] + ) + return_ty = f"precompute_out<{return_ty_templates}>" + elem_cpp_ty = precomputed_elements_with_cpp_types[i].cpp_type( + strip_ref=True + ) + signature = f"{return_ty} set_{elem.name}({elem_cpp_ty} value)" + + # Generate an assert which checks that the + # template parameter corresponding to the precomputed + # element that is set by this method is false on the + # class corresponding to the object that `this` points to. + # This ensures that each element can be set only once. + assert_msg = f'"{elem.name} already set"' + assert_stmt = f"static_assert({precomputed_template_parameters[i]} == false, {assert_msg});" + + # Generate the new object construction block. All state + # except the element that this method sets is copied from the + # object that `this` points to. The value for the element that + # the method sets is taken from a method parameter. + construction_stmts = [] + construction_stmts.append(f"{return_ty} ret;") + + for j, elem in enumerate(precomputed_elements): + if i == j: + construction_stmts.append(f"ret.{elem.name} = value;") + else: + construction_stmts.append( + f"ret.{elem.name} = this->{elem.name};" + ) + + construction_stmts.append("return ret;") + construction_block = "\n".join(construction_stmts) + + setter_methods.append( + f""" + {signature} {{ + {assert_stmt} + {construction_block} + }} + """ + ) + setter_methods_decl = "\n".join(setter_methods) + + # Meta should return an instance of the struct containing the precomputed elements. + meta_return_template_params = ", ".join( + ["true"] * len(precomputed_template_parameters) + ) + # This typedef (actually a using statement) is needed so that TORCH_META_FUNC can reuse the return + # type (which has a variable number of template parameters). + meta_return_typedef = f"using meta_return_ty = precompute_out <{meta_return_template_params}>;" + meta_return = "meta_return_ty" + precomputed_decl = f""" + {precompute_template_decl} + struct TORCH_API precompute_out {{ + {setter_methods_decl} + {precomputed_elements_decl}; + }};""" + else: + meta_return_typedef = "" + precomputed_decl = "" + + return f"""\ +struct TORCH_API structured_{name} : public {parent_class} {{ + {precomputed_decl} + {meta_return_typedef} + {meta_return} meta({args_str}); +}}; +""" + + +def needs_backend_select(f: NativeFunction, selector: SelectiveBuilder) -> bool: + name = str(f.func.name.name) + if name.endswith("_like") or name.startswith("new_"): + return False + if f.func.arguments.tensor_options is None: + return False + return selector.is_native_function_selected(f) + + +# Generates RegisterBackendSelect.cpp, a series of kernels which provide +# specialized computation of dispatch key for operator signatures which cannot +# be easily done automatically using templating. +@dataclass(frozen=True) +class ComputeBackendSelect: + target: Literal[Target.DEFINITION, Target.REGISTRATION] + + # Selector object to determine which operators to generate + # registration code for. + selector: SelectiveBuilder + + @method_with_native_function + def __call__(self, f: NativeFunction) -> str | None: + if not needs_backend_select(f, self.selector): + return None + + name = native.name(f.func) + # BackendSelect can go to Meta, so it must preserve symints + native_sig = NativeSignature(f.func, symint=True) + + native_tensor_args = [ + a + for a in native_sig.arguments() + if isinstance(a.argument, Argument) and a.argument.type.is_tensor_like() + ] + + dispatcher_sig = DispatcherSignature.from_schema(f.func) + + sig: NativeSignature | DispatcherSignature + sig = dispatcher_sig + dispatcher_exprs = dispatcher_sig.exprs() + dispatch_key = "c10::computeDispatchKey(dtype, layout, device)" + + if self.target is Target.DEFINITION: + # I don't think there's actually a good reason to generate + # these two cases differently + # The first case could probably be improved though- it calls computeDispatchKeySet(), + # which looks at TLS dispatch keys- there should not be any by the time we reach backend select. + if native_tensor_args: + assert f.func.arguments.has_tensor_arg() + tensor_args = ", ".join(a.name for a in native_tensor_args) + compute_dk = f"""\ +DispatchKeySet _dk_set = c10::DispatchKeySet({dispatch_key}) | c10::detail::multi_dispatch_key_set({tensor_args}); +DispatchKeySet _dk_mask = c10::DispatchKeySet(DispatchKeySet::FULL_AFTER, DispatchKey::BackendSelect); +DispatchKeySet _dk = c10::impl::computeDispatchKeySet(_dk_set, _dk_mask);""" + else: + assert not f.func.arguments.has_tensor_arg() + compute_dk = ( + f"DispatchKeySet _dk = c10::DispatchKeySet({dispatch_key});" + ) + return f"""\ +// aten::{f.func} +C10_ALWAYS_INLINE +{sig.defn(name)} {{ + {compute_dk} + return at::_ops::{f.func.name.unambiguous_name()}::redispatch( + _dk, {", ".join(a.expr for a in dispatcher_exprs)}); +}} +""" + elif self.target is Target.REGISTRATION: + return f"""m.impl("aten::{f.func.name}", TORCH_FN({name}));""" + else: + assert_never(self.target) + + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # +# +# YAML CODE GENERATION +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # + + +def format_yaml(data: object) -> str: + # Ignore alias in Dumper + YamlDumper.ignore_aliases = lambda self, data: True # type: ignore[assignment] + + # Support serializing OrderedDict + def dict_representer(dumper: Any, data: Any) -> Any: + return dumper.represent_dict(data.items()) + + YamlDumper.add_representer(OrderedDict, dict_representer) # type: ignore[no-untyped-call] + # Some yaml parsers (e.g. Haskell's) don't understand line breaks. + # width=1e9 turns off optional line breaks and improves + # the portability of the outputted yaml. + return yaml.dump(data, default_flow_style=False, Dumper=YamlDumper, width=1e9) # type: ignore[no-any-return, call-overload] + + +# For some reason, some defaults we write to YAML are written as native +# YAML objects, rather than doing them uniformly as strings. This +# function detects those cases and converts them into native Python +# objects. +def pythonify_default(s: str) -> object: + if s == "true": + return True + elif s == "false": + return False + + try: + return int(s) + except ValueError: + try: + return float(s) + except ValueError: + return s + + +# What is a dynamic type? Over time, the semantic meaning of +# dynamic type has degraded to meaninglessness (in the old days, +# it captured dtype-ness of types, but that has gone away with +# the removal of TH). These days, it's mostly the same thing as +# the C++ API argument type, except that Tensor and Tensor? +# arguments simply present as Tensor. +# +# TODO: Get rid of dynamic_type, after getting tools/autograd +# to use the new codegen framework +def dynamic_type(t: Type) -> str: + if isinstance(t, OptionalType): + return dynamic_type(t.elem) + # Note we don't use t.is_tensor_like() here because it would + # also include Tensor[] + if str(t) == "Tensor": + return "at::Tensor" + # This is a legacy concept, so never report SymInt + return cpp.argumenttype_type( + t, mutable=False, binds="__placeholder__", symint=False + ).cpp_type() + + +def compute_method_of_yaml(variants: set[Variant]) -> list[str]: + # This is written out explicitly to ensure that Tensor and + # namespace are put into the list in the right order + method_of = ["Type"] + if Variant.method in variants: + method_of.append("Tensor") + if Variant.function in variants: + method_of.append("namespace") + return method_of + + +def compute_returns_yaml( + f: NativeFunction, +) -> tuple[list[dict[str, str]], dict[str, str]]: + # Note [name and field_name] + # ~~~~~~~~~~~~~~~~~~~~~~~~~~ + # To understand name_to_field_name, we must first talk about this + # schema: + # + # lstsq.X(Tensor self, Tensor A, *, Tensor(a!) X, Tensor(b!) qr) -> (Tensor(a!) solution, Tensor(b!) QR) + # + # There is something very odd about this schema: it is an out + # variant of the function (that is to say, it will convert into + # at::lstsq_out() in the C++ API), but the names of the output + # return arguments don't match the keyword argument names of + # the inputs. It TURNS OUT that in this situation, the historical + # Declarations.yaml we want to output is this (abbreviated to + # only show relevant fields): + # + # arguments: + # ... + # - field_name: solution + # name: X + # - field_name: QR + # name: qr + # ... + # + # returns: + # - field_name: solution + # name: X + # - field_name: QR + # name: qr + # + # The name of the return fields is stored in 'field_name', and the + # name of the arguments is stored in 'name'. So when we process + # arguments, we need a way to get at the corresponding return. At + # the moment, this is most conveniently done by constructing a + # mapping from name (the argument concept) to field_name (the + # return concept) while processing return arguments, since we don't + # directly maintain this correspondence in the modeling of function + # schema itself. + # + # See also https://github.com/pytorch/pytorch/issues/43114 + name_to_field_name: dict[str, str] = {} + + # Compute the returns field of the YAML entry + names = cpp.return_names(f) + returns = [] + for i, (r, name) in enumerate(zip(f.func.returns, names)): + ret = { + "dynamic_type": dynamic_type(r.type), + "name": name, + # legacy, report ints + "type": cpp.return_type(r, symint=False).cpp_type(), + } + + if r.name: + # See Note [name and field_name] + ret["field_name"] = r.name + if f.func.is_out_fn(): + name_to_field_name[f.func.arguments.out[i].name] = r.name + + returns.append(ret) + + return returns, name_to_field_name + + +# arguments in yaml roughly corresponds to the public C++ API +def compute_cpp_argument_yaml( + cpp_a: Binding, + *, + schema_order: bool, + kwarg_only_set: set[str], + out_arg_set: set[str], + name_to_field_name: dict[str, str], +) -> object: + if isinstance(cpp_a.argument, TensorOptionsArguments): + arg: dict[str, object] = { + "annotation": None, + "dynamic_type": "at::TensorOptions", + "is_nullable": False, + "name": cpp_a.name, + "type": cpp_a.type, + "kwarg_only": True, + } + if cpp_a.default is not None: + arg["default"] = cpp_a.default + return arg + elif isinstance(cpp_a.argument, SelfArgument): + raise AssertionError + elif isinstance(cpp_a.argument, Argument): + return compute_argument_yaml( + cpp_a.argument, + schema_order=schema_order, + kwarg_only_set=kwarg_only_set, + out_arg_set=out_arg_set, + name_to_field_name=name_to_field_name, + ) + + +def compute_argument_yaml( + a: Argument, + *, + schema_order: bool, + kwarg_only_set: set[str], + out_arg_set: set[str], + name_to_field_name: dict[str, str], +) -> object: + arg: dict[str, object] = { + "annotation": str(a.annotation) if a.annotation else None, + "dynamic_type": dynamic_type(a.type), + "is_nullable": a.type.is_nullable(), + "name": a.name, + # legacy, report ints + "type": cpp.argument_type(a, binds="__placeholder__", symint=False).cpp_type(), + } + if a.default is not None: + arg["default"] = pythonify_default( + cpp.default_expr(a.default, a.type, symint=False) + ) + if a.name in kwarg_only_set: + arg["kwarg_only"] = True + if a.name in out_arg_set: + arg["output"] = True + arg["allocate"] = True + # See Note [name and field_name] + if a.name in name_to_field_name: + arg["field_name"] = name_to_field_name[a.name] + # Historically, booleans don't get their size recorded, because it + # is already built into the cpp type (e.g., std::array) + l = a.type.is_list_like() + if l is not None and l.size is not None and str(l.elem) != "bool": + arg["size"] = l.size + return arg + + +@with_native_function +def compute_declaration_yaml(f: NativeFunction) -> object: + returns, name_to_field_name = compute_returns_yaml(f) + + # These sets are used to conveniently test if an argument is a + # kwarg-only or out argument + kwarg_only_set = {a.name for a in f.func.arguments.flat_kwarg_only} + out_arg_set = {a.name for a in f.func.arguments.out} + + sig_group = CppSignatureGroup.from_native_function( + f, method=False, fallback_binding=False + ) + cpp_args = sig_group.signature.arguments() + arguments = [ + compute_cpp_argument_yaml( + cpp_a, + schema_order=False, + kwarg_only_set=kwarg_only_set, + out_arg_set=out_arg_set, + name_to_field_name=name_to_field_name, + ) + for cpp_a in cpp_args + ] + + schema_order_jit_arguments = list(f.func.schema_order_arguments()) + + schema_order_arguments = [ + compute_argument_yaml( + a, + schema_order=True, + kwarg_only_set=kwarg_only_set, + out_arg_set=out_arg_set, + name_to_field_name=name_to_field_name, + ) + for a in schema_order_jit_arguments + ] + + cpp_schema_order_types = [ + # NB: method here doesn't matter + r.type + for a in schema_order_jit_arguments + for r in cpp.argument( + a, + method=False, + cpp_no_default_args=set(), + faithful=False, + symint=False, + has_tensor_options=False, + ) + ] + + # legacy, report ints + cpp_returns = cpp.returns_type(f.func.returns, symint=False).cpp_type() + schema_order_cpp_signature = f"{cpp_returns} ({', '.join(cpp_schema_order_types)})" + + is_factory_method = ( + any(isinstance(a.argument, TensorOptionsArguments) for a in cpp_args) + and Variant.method not in f.variants + ) + + return OrderedDict( + [ + ("name", cpp.name(f.func)), + ("operator_name", str(f.func.name.name)), + ("overload_name", str(f.func.name.overload_name)), + ("manual_kernel_registration", f.manual_kernel_registration), + ( + "category_override", + f.category_override if f.category_override is not None else "", + ), + ("schema_string", f"aten::{f.func}"), + ("arguments", arguments), + ("schema_order_cpp_signature", schema_order_cpp_signature), + ("schema_order_arguments", schema_order_arguments), + ("method_of", compute_method_of_yaml(f.variants)), + ("mode", "native"), + ("python_module", "" if f.python_module is None else f.python_module), + ("returns", returns), + ("inplace", f.func.name.name.inplace), + ("is_factory_method", is_factory_method), + ("abstract", f.is_abstract), + ("device_guard", f.device_guard), + ("with_gil", False), + ("deprecated", False), + ("has_math_kernel", f.has_composite_implicit_autograd_kernel), + ] + ) + + +# See Note [Auto generated composite kernels] +def has_autogenerated_composite_kernel(f: NativeFunction) -> bool: + return (f.structured or f.structured_delegate is not None) and ( + f.func.kind() == SchemaKind.functional or f.func.kind() == SchemaKind.inplace + ) + + +@with_native_function_and_indices +def compute_registration_declarations( + f: NativeFunction, backend_indices: dict[DispatchKey, BackendIndex] +) -> str: + name = dispatcher.name(f.func) + returns_type = dispatcher.returns_type(f.func.returns).cpp_type() + args = dispatcher.arguments(f.func) + args_str = ", ".join(a.no_default().decl() for a in args) + comment_data: dict[str, str] = { + "schema": f"aten::{f.func}", + # TODO: What exactly is the semantics of the 'dispatch' field? + "dispatch": str( + {k for k, v in backend_indices.items() if v.has_kernel(f)} + != {DispatchKey.CompositeImplicitAutograd} + and {k for k, v in backend_indices.items() if v.has_kernel(f)} + != { + DispatchKey.CompositeImplicitAutograd, + DispatchKey.CompositeImplicitAutogradNestedTensor, + } + ), + "default": str(f.has_composite_kernel or has_autogenerated_composite_kernel(f)), + } + return f"""{returns_type} {name}({args_str}); // {json.dumps(comment_data)} +""" + + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # +# +# RUN IT ALL +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # + + +def get_custom_build_selector( + provided_op_registration_allowlist: list[str] | None, + op_selection_yaml_path: str | None, +) -> SelectiveBuilder: + assert not ( + provided_op_registration_allowlist is not None + and op_selection_yaml_path is not None + ), ( + "Both provided_op_registration_allowlist and " + + "op_selection_yaml_path can NOT be provided at the " + + "same time." + ) + + op_registration_allowlist: set[str] | None = None + if provided_op_registration_allowlist is not None: + op_registration_allowlist = set(provided_op_registration_allowlist) + + if op_registration_allowlist is not None: + selector = SelectiveBuilder.from_legacy_op_registration_allow_list( + op_registration_allowlist, + True, + False, + ) + elif op_selection_yaml_path is not None: + selector = SelectiveBuilder.from_yaml_path(op_selection_yaml_path) + else: + selector = SelectiveBuilder.get_nop_selector() + + return selector + + +def get_grouped_by_view_native_functions( + native_functions: Sequence[NativeFunction], +) -> Sequence[NativeFunction | NativeFunctionsViewGroup]: + def maybe_create_view_group( + d: dict[ViewSchemaKind | SchemaKind, NativeFunction], + ) -> list[NativeFunction | NativeFunctionsViewGroup]: + funcs: list[NativeFunction | NativeFunctionsViewGroup] = [] + if ViewSchemaKind.aliasing in d: + view = d.pop(ViewSchemaKind.aliasing) + view_inplace = d.pop(ViewSchemaKind.aliasing_inplace, None) + view_copy = d.pop(SchemaKind.functional, None) + + funcs.append( + NativeFunctionsViewGroup( + view=view, + view_copy=view_copy, + view_inplace=view_inplace, + ) + ) + # Take the remaining functions that weren't part of the view group + # and emit them separately + funcs.extend(d.values()) + return funcs + + grouped_by_views: dict[ + FunctionSchema, dict[SchemaKind | ViewSchemaKind, NativeFunction] + ] = defaultdict(dict) + for f in native_functions: + schema = f.func.view_signature() + view_kind: ViewSchemaKind = f.view_schema_kind + # We need to group up ops relevant to the same "view", consisting of: + # view op (ViewSchemaKind.aliasing) + # view_inplace op (ViewSchemaKind.aliasing_inplace) + # view_copy op (SchemaKind.functional) + if view_kind == ViewSchemaKind.non_aliasing: + kind = f.func.kind() + assert kind not in grouped_by_views[schema] + grouped_by_views[schema][kind] = f + else: + assert view_kind not in grouped_by_views[schema], ( + f"{view_kind} already in {grouped_by_views[schema].keys()}" + ) + grouped_by_views[schema][view_kind] = f + + return list(concatMap(maybe_create_view_group, grouped_by_views.values())) + + +def get_grouped_native_functions( + native_functions: Sequence[NativeFunction], +) -> Sequence[NativeFunction | NativeFunctionsGroup]: + def flatten_pre_group( + d: dict[SchemaKind, NativeFunction], + ) -> Sequence[NativeFunction | NativeFunctionsGroup]: + r = NativeFunctionsGroup.from_dict(d) + if r is None: + # Invariant: any NativeFunctions that are code-generated + # should have been grouped into NativeFunctionsGroup objects + assert not any("generated" in f.tags for f in d.values()) + return list(d.values()) + else: + return [r] + + # TODO: how come ValuesView isn't a Sequence lol + pre_grouped_native_functions = pre_group_native_functions(native_functions) + return list( + concatMap(flatten_pre_group, list(pre_grouped_native_functions.values())) + ) + + +def get_ns_grouped_kernels( + *, + grouped_native_functions: Sequence[NativeFunction | NativeFunctionsGroup], + backend_indices: dict[DispatchKey, BackendIndex], + native_function_decl_gen: Callable[ + [NativeFunctionsGroup | NativeFunction, BackendIndex], list[str] + ] = dest.compute_native_function_declaration, +) -> dict[str, list[str]]: + ns_grouped_kernels: dict[str, list[str]] = defaultdict(list) + for f in grouped_native_functions: + native_function_namespaces = set() + dispatch_keys = set() + for dispatch_key, backend_idx in backend_indices.items(): + backend_metadata = backend_idx.get_kernel(f) + if backend_metadata: + namespace = backend_metadata.cpp_namespace + dispatch_keys.add(dispatch_key) + native_function_namespaces.add(namespace) + else: + namespace = DEFAULT_KERNEL_NAMESPACE + assert len(native_function_namespaces) <= 1, ( + f"Codegen only supports one namespace per operator, got {native_function_namespaces} from {dispatch_keys}" + ) + ns_grouped_kernels[namespace].extend( + native_function_decl_gen(f, backend_idx) + ) + return ns_grouped_kernels + + +def get_native_function_declarations_from_ns_grouped_kernels( + *, + ns_grouped_kernels: dict[str, list[str]], +) -> list[str]: + declarations: list[str] = [] + newline = "\n" + for namespace, kernels in ns_grouped_kernels.items(): + ns_helper = NamespaceHelper( + namespace_str=namespace, + entity_name="", + max_level=4, + ) + # Convert to a set first to remove duplicate kernel names. Backends are + # allowed to repeat kernel names; only generate the declaration once! + ordered_kernels = list(OrderedDict.fromkeys(kernels)) + declarations.extend( + f""" +{ns_helper.prologue} +{newline.join(ordered_kernels)} +{ns_helper.epilogue} + """.split(newline) + ) + return declarations + + +# Return native function declarations grouped by their namespaces. +def get_native_function_declarations( + *, + grouped_native_functions: Sequence[NativeFunction | NativeFunctionsGroup], + backend_indices: dict[DispatchKey, BackendIndex], + native_function_decl_gen: Callable[ + [NativeFunctionsGroup | NativeFunction, BackendIndex], list[str] + ] = dest.compute_native_function_declaration, +) -> list[str]: + """ + Generate kernel declarations, in `NativeFunction(s).h`. + :param grouped_native_functions: a sequence of `NativeFunction` or `NativeFunctionGroup`. + :param backend_indices: kernel collections grouped by dispatch key. + :param native_function_decl_gen: callable to generate kernel declaration for each `NativeFunction`. + :return: a list of string, from the string with all declarations, grouped by namespaces, split by newline. + """ + + ns_grouped_kernels = get_ns_grouped_kernels( + grouped_native_functions=grouped_native_functions, + backend_indices=backend_indices, + native_function_decl_gen=native_function_decl_gen, + ) + return get_native_function_declarations_from_ns_grouped_kernels( + ns_grouped_kernels=ns_grouped_kernels + ) + + +def get_kernel_namespace( + *, f: NativeFunction | NativeFunctionsGroup, backend_idx: BackendIndex +) -> str: + backend_metadata = backend_idx.get_kernel(f) + assert not backend_metadata or "::native" in backend_metadata.cpp_namespace, ( + f"The kernel for function {f.func.name if isinstance(f, NativeFunction) else f.functional.func.name} " + f"with dispatch key {backend_idx.dispatch_key}" + f" has a namespace {backend_metadata.cpp_namespace} and it's not ending with '::native'." + ) + return ( + backend_metadata.cpp_namespace if backend_metadata else DEFAULT_KERNEL_NAMESPACE + ) + + +# Return native function definitions grouped by dispatch key and custom namespace. +# Used in RegisterDispatchKey.cpp and etc. +def get_native_function_definitions( + *, + fm: FileManager, + grouped_native_functions: Sequence[NativeFunction | NativeFunctionsGroup], + dispatch_key: DispatchKey, + backend_idx: BackendIndex, + selector: SelectiveBuilder, + rocm: bool, + symint: bool, + skip_dispatcher_op_registration: bool, + gen_dispatch_helpers: bool, +) -> list[str]: + definitions: list[str] = [] + ns_definitions: dict[str, list[str]] = defaultdict(list) + anonymous_definitions: dict[str, list[str]] = defaultdict(list) + registrations: dict[str, dict[str, list[str]]] = defaultdict(dict) + newline = "\n" + ns_gen = dest.RegisterDispatchKey( + backend_idx, + Target.NAMESPACED_DEFINITION, + selector, + rocm=rocm, + symint=symint, + class_method_name=None, + skip_dispatcher_op_registration=skip_dispatcher_op_registration, + ) + anonymous_gen = dest.RegisterDispatchKey( + backend_idx, + Target.ANONYMOUS_DEFINITION, + selector, + rocm=rocm, + symint=symint, + class_method_name=None, + skip_dispatcher_op_registration=skip_dispatcher_op_registration, + ) + reg_gen = dest.RegisterDispatchKey( + backend_idx, + Target.REGISTRATION, + selector, + rocm=rocm, + symint=symint, + class_method_name=None, + skip_dispatcher_op_registration=skip_dispatcher_op_registration, + ) + for f in grouped_native_functions: + kernel_namespace = get_kernel_namespace(f=f, backend_idx=backend_idx).replace( + "::native", "" + ) + + ns_definitions[kernel_namespace].extend( + ns_gen(f), + ) + anonymous_definitions[kernel_namespace].extend( + anonymous_gen(f), + ) + namespace = ( + f.namespace if isinstance(f, NativeFunction) else f.functional.namespace + ) + if namespace not in registrations[kernel_namespace]: + registrations[kernel_namespace] = defaultdict(list) + registrations[kernel_namespace][namespace].extend( + reg_gen(f), + ) + + for kernel_namespace in ns_definitions: + if len(ns_definitions[kernel_namespace]) == 0: + continue + ns_helper = NamespaceHelper(namespace_str=kernel_namespace) + registration_body = "" + for namespace in registrations[kernel_namespace]: + if not registrations[kernel_namespace][namespace]: + continue + registration_body += f""" +TORCH_LIBRARY_IMPL({namespace}, {dispatch_key}, m) {{ + {newline.join(registrations[kernel_namespace][namespace])} +}}""" + definitions.extend( + fm.substitute_with_template( + "RegisterDispatchDefinitions.ini", + lambda: { + "ns_prologue": ns_helper.prologue, + "ns_epilogue": ns_helper.epilogue, + "dispatch_anonymous_definitions": anonymous_definitions[ + kernel_namespace + ], + "static_init_dispatch_registrations": "" + if skip_dispatcher_op_registration + else registration_body, + "deferred_dispatch_registrations": "", + "dispatch_namespace": dispatch_key.lower(), + "dispatch_namespaced_definitions": ns_definitions[kernel_namespace], + }, + ).split(newline) + ) + + return definitions + + +# Return native function declarations grouped by dispatch key and custom namespace. +# Used in CPUFunctions_inl.h and etc. +def get_namespaced_declaration( + *, + grouped_native_functions: Sequence[NativeFunction | NativeFunctionsGroup], + dispatch_key: DispatchKey, + backend_idx: BackendIndex, + selector: SelectiveBuilder, + rocm: bool, + symint: bool, +) -> list[str]: + declarations: list[str] = [] + ns_grouped_kernels: dict[str, list[str]] = defaultdict(list) + newline = "\n" + func = dest.RegisterDispatchKey( + backend_idx, + Target.NAMESPACED_DECLARATION, + selector, + rocm=rocm, + class_method_name=None, + skip_dispatcher_op_registration=False, + symint=symint, + ) + for f in grouped_native_functions: + namespace = get_kernel_namespace(f=f, backend_idx=backend_idx).replace( + "native", dispatch_key.lower() + ) + + ns_grouped_kernels[namespace].extend( + func(f), + ) + + for namespace, kernels in ns_grouped_kernels.items(): + if len(kernels) == 0: + continue + ns_helper = NamespaceHelper( + namespace_str=namespace, entity_name="", max_level=3 + ) + ordered_kernels = list(OrderedDict.fromkeys(kernels)) + declarations.extend( + f""" +{ns_helper.prologue} +{newline.join(ordered_kernels)} +{ns_helper.epilogue} + """.split(newline) + ) + return declarations + + +# Return native function schema registration code for aten and other namespaces. +def get_native_function_schema_registrations( + *, + native_functions: Sequence[NativeFunction], + schema_selector: SelectiveBuilder, +) -> tuple[list[str], str]: + ns_native_functions: dict[str, list[NativeFunction]] = defaultdict(list) + for native_function in native_functions: + ns_native_functions[native_function.namespace].append(native_function) + schema_registrations = "" + aten_schema_registrations = [] + custom_namespace = None + for namespace, funcs in ns_native_functions.items(): + schema_registrations_body = list( + mapMaybe(RegisterSchema(schema_selector), funcs) + ) + # NB: we have to separate aten namespace registration from other namespaces, + # because in the template we hardcoded an operator for ATen already. + if namespace == "aten": + aten_schema_registrations = schema_registrations_body + else: + custom_namespace = namespace + tab = "\t" + # if the namespace is predefined, we should use define a library fragment + # instead of a new library + torch_library_macro = ( + "TORCH_LIBRARY_FRAGMENT" + if namespace in FRAGMENT_NAMESPACES + else "TORCH_LIBRARY" + ) + schema_registrations += f""" +{torch_library_macro}({custom_namespace}, m) {{ + {tab.join(schema_registrations_body)} +}};""" + return (aten_schema_registrations, schema_registrations) + + +def gen_aggregated_headers( + *, + native_functions: Sequence[NativeFunction], + grouped_native_functions: Sequence[NativeFunction | NativeFunctionsGroup], + structured_native_functions: Sequence[NativeFunctionsGroup], + static_dispatch_idx: list[BackendIndex], + selector: SelectiveBuilder, + backend_indices: dict[DispatchKey, BackendIndex], + cpu_fm: FileManager, + device_fms: dict[str, FileManager], + functions_keys: set[DispatchKey], + dispatch_keys: Sequence[DispatchKey], + rocm: bool, +) -> None: + # Buck doesn't support dynamic output files, so we aggregate all operator + # headers into a single file + cpu_fm.write( + "NativeMetaFunctions.h", + lambda: { + "NativeMetaFunctions_includes": [], + "NativeMetaFunctions_declarations": list( + mapMaybe(compute_meta_function_declaration, structured_native_functions) + ), + }, + ) + method_native_functions = [ + fn for fn in native_functions if Variant.method in fn.variants + ] + non_method_native_functions = [ + fn for fn in native_functions if fn not in method_native_functions + ] + cpu_fm.write( + "MethodOperators.h", + lambda: { + "MethodOperators_includes": [], + "MethodOperators_declarations": list( + mapMaybe( + ComputeOperators( + Target.DECLARATION, + static_dispatch_backend_indices=static_dispatch_idx, + ), + method_native_functions, + ) + ), + }, + ) + cpu_fm.write( + "Operators.h", + lambda: { + "Operators_includes": ["#include "], + "Operators_declarations": list( + mapMaybe( + ComputeOperators( + Target.DECLARATION, + static_dispatch_backend_indices=static_dispatch_idx, + ), + non_method_native_functions, + ) + ), + }, + ) + cpu_fm.write( + "Functions.h", + lambda: { + "static_dispatch_extra_headers": static_dispatch_extra_headers( + static_dispatch_idx + ), + "Functions_includes": ["#include "], + "Functions_declarations": list( + mapMaybe( + ComputeFunction(), + native_functions, + ) + ), + }, + ) + declarations = get_native_function_declarations( + grouped_native_functions=grouped_native_functions, + backend_indices=backend_indices, + ) + cpu_fm.write( + "NativeFunctions.h", + lambda: { + "NativeFunctions_includes": ["#include "], + "NativeFunctions_declarations": declarations, + }, + ) + + for dispatch_key in dispatch_keys: + fm = file_manager_from_dispatch_key(dispatch_key, device_fms, cpu_fm) + if dispatch_key in functions_keys: + inl_headers = f"#include " + + fm.write_with_template( + f"{dispatch_key}Functions.h", + "DispatchKeyFunctions.h", + lambda: { + "dispatch_key": str(dispatch_key), + "inline_headers": inl_headers, + }, + ) + fm.write_with_template( + f"{dispatch_key}Functions_inl.h", + "DispatchKeyFunctions_inl.h", + lambda: { + "DispatchKeyFunctions_inl_includes": [], + "dispatch_namespace": dispatch_key.lower(), + "dispatch_namespaced_declarations": get_namespaced_declaration( + grouped_native_functions=grouped_native_functions, + dispatch_key=dispatch_key, + backend_idx=backend_indices[dispatch_key], + selector=selector, + rocm=rocm, + symint=True, + ), + }, + ) + + del fm + + +def gen_per_operator_headers( + *, + native_functions: Sequence[NativeFunction], + grouped_native_functions: Sequence[NativeFunction | NativeFunctionsGroup], + static_dispatch_idx: list[BackendIndex], + selector: SelectiveBuilder, + backend_indices: dict[DispatchKey, BackendIndex], + cpu_fm: FileManager, + device_fms: dict[str, FileManager], + ops_fm: FileManager, + functions_keys: set[DispatchKey], + dispatch_keys: Sequence[DispatchKey], + rocm: bool, +) -> None: + # For CMake builds, split operator declarations into separate headers in + # the ATen/ops folder to split up header dependencies + functions_by_root_name: dict[str, list[NativeFunction]] = defaultdict(list) + for fn in native_functions: + functions_by_root_name[fn.root_name].append(fn) + + grouped_functions_by_root_name: dict[ + str, list[NativeFunction | NativeFunctionsGroup] + ] = defaultdict(list) + for group in grouped_native_functions: + name = group.root_name + grouped_functions_by_root_name[name].append(group) + + for name, functions in functions_by_root_name.items(): + ops_fm.write_with_template( + f"{name}_ops.h", + "Operator.h", + lambda: { + "declarations": list( + mapMaybe( + ComputeOperators( + Target.DECLARATION, + static_dispatch_backend_indices=static_dispatch_idx, + ), + functions, + ) + ), + }, + ) + + ops_fm.write_with_template( + f"{name}.h", + "Function.h", + lambda: { + "static_dispatch_ops_headers": list( + mapMaybe( + lambda fn: static_dispatch_ops_header( + fn, backend_index=static_dispatch_idx + ), + functions, + ) + ), + "operator_includes": f"#include ", + "function_definitions": list( + mapMaybe( + ComputeFunction(), + functions, + ) + ), + }, + ) + + grouped_functions = grouped_functions_by_root_name.get(name, []) + structured_functions = [ + fn + for fn in grouped_functions + if isinstance(fn, NativeFunctionsGroup) and fn.structured + ] + is_structured = len(structured_functions) > 0 + + if is_structured: + ops_fm.write_with_template( + f"{name}_meta.h", + "NativeMetaFunction.h", + lambda: { + "meta_function_declarations": list( + mapMaybe( + compute_meta_function_declaration, structured_functions + ) + ), + }, + ) + declarations = get_native_function_declarations( + grouped_native_functions=grouped_functions, + backend_indices=backend_indices, + native_function_decl_gen=dest.compute_native_function_declaration, + ) + ops_fm.write_with_template( + f"{name}_native.h", + "NativeFunction.h", + lambda: { + "extra_includes": ( + f"#include " if is_structured else [] + ), + "native_function_declarations": declarations, + }, + ) + + for category, suffix in [ + ("Functions", ""), + ("Operators", "_ops"), + ("NativeMetaFunctions", "_meta"), + ("NativeFunctions", "_native"), + ]: + cpu_fm.write( + f"{category}.h", + lambda: { + f"{category}_includes": [ + f"#include " + for name in sorted(functions_by_root_name.keys()) + ], + f"{category}_declarations": [], + }, + ) + + for dispatch_key in dispatch_keys: + if dispatch_key not in functions_keys: + continue + + dispatch_namespace = dispatch_key.lower() + dispatch_names = [] + + for name, functions in functions_by_root_name.items(): + grouped_functions = grouped_functions_by_root_name.get(name, []) + declarations = list( + concatMap( + dest.RegisterDispatchKey( + backend_indices[dispatch_key], + Target.NAMESPACED_DECLARATION, + selector, + rocm=rocm, + symint=True, + class_method_name=None, + skip_dispatcher_op_registration=False, + ), + grouped_functions, + ) + ) + + if len(declarations) == 0: + continue + + dispatch_names.append(name) + ops_fm.write_with_template( + f"{name}_{dispatch_namespace}_dispatch.h", + "DispatchKeyFunction.h", + lambda: { + "dispatch_namespace": dispatch_namespace, + "dispatch_namespaced_declarations": declarations, + }, + ) + + fm = file_manager_from_dispatch_key(dispatch_key, device_fms, cpu_fm) + inl_headers = f"#include " + + fm.write_with_template( + f"{dispatch_key}Functions.h", + "DispatchKeyFunctions.h", + lambda: { + "dispatch_key": str(dispatch_key), + "inline_headers": inl_headers, + }, + ) + fm.write_with_template( + f"{dispatch_key}Functions_inl.h", + "DispatchKeyFunctions_inl.h", + lambda: { + "dispatch_namespace": dispatch_namespace, + "DispatchKeyFunctions_inl_includes": [ + f"#include " + for name in sorted(dispatch_names) + ], + "dispatch_namespaced_declarations": [], + }, + ) + del fm + + cpu_fm.write( + "MethodOperators.h", + lambda: { + "MethodOperators_includes": sorted( + f"#include " + for name, functions in functions_by_root_name.items() + if any(Variant.method in fn.variants for fn in functions) + ), + "MethodOperators_declarations": [], + }, + ) + + +def gen_headers( + *, + native_functions: Sequence[NativeFunction], + valid_tags: set[str], + grouped_native_functions: Sequence[NativeFunction | NativeFunctionsGroup], + structured_native_functions: Sequence[NativeFunctionsGroup], + static_dispatch_idx: list[BackendIndex], + selector: SelectiveBuilder, + backend_indices: dict[DispatchKey, BackendIndex], + core_fm: FileManager, + cpu_fm: FileManager, + device_fms: dict[str, FileManager], + ops_fm: FileManager, + dispatch_keys: Sequence[DispatchKey], + functions_keys: set[DispatchKey], + rocm: bool, + per_operator_headers: bool, +) -> None: + if per_operator_headers: + gen_per_operator_headers( + native_functions=native_functions, + grouped_native_functions=grouped_native_functions, + static_dispatch_idx=static_dispatch_idx, + selector=selector, + backend_indices=backend_indices, + cpu_fm=cpu_fm, + device_fms=device_fms, + ops_fm=ops_fm, + dispatch_keys=dispatch_keys, + functions_keys=functions_keys, + rocm=rocm, + ) + else: + gen_aggregated_headers( + native_functions=native_functions, + grouped_native_functions=grouped_native_functions, + structured_native_functions=structured_native_functions, + static_dispatch_idx=static_dispatch_idx, + selector=selector, + backend_indices=backend_indices, + cpu_fm=cpu_fm, + device_fms=device_fms, + dispatch_keys=dispatch_keys, + functions_keys=functions_keys, + rocm=rocm, + ) + + core_fm.write( + "TensorBody.h", + lambda: { + "tensor_method_declarations": list( + mapMaybe( + ComputeTensorMethod( + target=Target.DECLARATION, + static_dispatch_backend_indices=static_dispatch_idx, + ), + native_functions, + ) + ), + "tensor_method_definitions": list( + mapMaybe( + ComputeTensorMethod( + target=Target.DEFINITION, + static_dispatch_backend_indices=static_dispatch_idx, + ), + native_functions, + ) + ), + }, + ) + + cpu_fm.write( + "RedispatchFunctions.h", + lambda: { + "function_redispatch_definitions": list( + mapMaybe(ComputeRedispatchFunction(), native_functions) + ), + }, + ) + + cpu_fm.write( + "RegistrationDeclarations.h", + lambda: { + "registration_declarations": [ + compute_registration_declarations(f, backend_indices) + for f in native_functions + ], + }, + ) + + cpu_fm.write( + "VmapGeneratedPlumbing.h", lambda: gen_all_vmap_plumbing(native_functions) + ) + + def gen_aten_interned_strings() -> dict[str, str]: + attrs: set[str] = set() # All function argument names + names = set() # All ATen function names + for func in native_functions: + names.add(str(func.func.name.name)) + # Some operators don't have a functional variant but we still create a + # symbol without the underscore + names.add(func.func.name.name.base) + + attrs.update(arg.name for arg in func.func.schema_order_arguments()) + + # These are keywords in C++, so aren't valid symbol names + # https://en.cppreference.com/w/cpp/language/operator_alternative + names -= { + "and", + "and_eq", + "bitand", + "bitor", + "compl", + "not", + "not_eq", + "or", + "or_eq", + "xor", + "xor_eq", + } + + return { + "aten_symbols": " \\\n".join( + [f"_(aten, {name})" for name in sorted(names)] + ), + "attr_symbols": " \\\n".join( + [f"_(attr, {name})" for name in sorted(attrs)] + ), + } + + core_fm.write("aten_interned_strings.h", gen_aten_interned_strings) + + def gen_tags_enum() -> dict[str, str]: + return {"enum_of_valid_tags": (",\n".join(sorted(valid_tags)))} + + core_fm.write("enum_tag.h", gen_tags_enum) + + +def gen_source_files( + *, + native_functions: Sequence[NativeFunction], + grouped_native_functions: Sequence[NativeFunction | NativeFunctionsGroup], + structured_native_functions: Sequence[NativeFunctionsGroup], + view_groups: Sequence[NativeFunctionsViewGroup], + selector: SelectiveBuilder, + static_dispatch_idx: list[BackendIndex], + backend_indices: dict[DispatchKey, BackendIndex], + aoti_fm: FileManager, + core_fm: FileManager, + cpu_vec_fm: FileManager, + cpu_fm: FileManager, + device_fms: dict[str, FileManager], + dispatch_keys: Sequence[DispatchKey], + functions_keys: set[DispatchKey], + rocm: bool, + force_schema_registration: bool, + per_operator_headers: bool, + skip_dispatcher_op_registration: bool, + update_aoti_c_shim: bool, + aoti_backends: set[DispatchKey | None], + extend_aoti_c_shim: bool, +) -> None: + extra_cuda_headers = """\ +#include +#include +#include +#include """ + if rocm: + extra_cuda_headers = """\ +#include +#include +#include +#include """ + + for dispatch_key in dispatch_keys: + fm = file_manager_from_dispatch_key(dispatch_key, device_fms, cpu_fm) + if per_operator_headers: + + def operator_headers() -> list[str]: + headers = [] + for g in grouped_native_functions: + is_registered = False + if backend_index.has_kernel(g): + is_registered = True + # The above has_kernel test on a group will only test for + # the existence of out dispatch, because that's how + # structured kernels work. But sometimes functions can be + # grouped but not be structured, and then you need to check + # each individual piece, as they may have manual dispatch + # entries. + elif isinstance(g, NativeFunctionsGroup) and any( + backend_index.has_kernel(fn) for fn in g.functions() + ): + is_registered = True + # TODO: this condition is a bit questionable + # (It has to do with the fact that structured kernels get generated kernels + # to the Meta + CompositeExplicitAutogradNonFunctional keys). + elif g.structured and dispatch_key in ( + DispatchKey.Meta, + DispatchKey.CompositeExplicitAutogradNonFunctional, + ): + is_registered = True + if not is_registered: + continue + + headers.append(f"#include ") + if ( + dispatch_key + == DispatchKey.CompositeExplicitAutogradNonFunctional + ): + headers.append(f"#include ") + if dispatch_key in functions_keys: + headers.append( + f"#include " + ) + + return sorted(set(headers)) + + else: + + def operator_headers() -> list[str]: + headers = ["#include "] + if dispatch_key == DispatchKey.CompositeExplicitAutogradNonFunctional: + headers.append("#include ") + if dispatch_key in functions_keys: + headers.append(f"#include ") + return headers + + backend_index = backend_indices[dispatch_key] + ns_grouped_native_functions = defaultdict(list) + for grouped_native_function in grouped_native_functions: + namespace = ( + grouped_native_function.namespace + if isinstance(grouped_native_function, NativeFunction) + else grouped_native_function.functional.namespace + ) + ns_grouped_native_functions[namespace].append(grouped_native_function) + + dispatch_namespace = str(dispatch_key).lower() + + # CompositeImplicitAutogradNestdTensor does not currently user the helpers generated + # compilation will fail when `-Werror=unused-function` flag is set + gen_dispatch_helpers: bool = ( + dispatch_key != DispatchKey.CompositeImplicitAutogradNestedTensor + ) + + register_dispatch_key_base_env = { + "extra_cuda_headers": extra_cuda_headers + if is_cuda_dispatch_key(dispatch_key) + else "", + "external_backend_headers": "", + "dispatch_headers": dest.gen_registration_headers( + backend_index, per_operator_headers, rocm + ), + # ops_headers *could* be sharded, but doesn't seem necessary? + "ops_headers": operator_headers(), + "dispatch_helpers": ( + dest.gen_registration_helpers(backend_index) + if gen_dispatch_helpers + else [] + ), + } + + def register_dispatch_key_env_callable( + gnf: NativeFunction | NativeFunctionsGroup, + ) -> dict[str, list[str]]: + return { + "dispatch_definitions": get_native_function_definitions( + fm=fm, # noqa: F821 + grouped_native_functions=[gnf], + dispatch_key=dispatch_key, + backend_idx=backend_index, + selector=selector, + rocm=rocm, + symint=True, + skip_dispatcher_op_registration=skip_dispatcher_op_registration, + gen_dispatch_helpers=gen_dispatch_helpers, + ) + } + + fm.write_sharded_with_template( + f"Register{dispatch_key}.cpp", + "RegisterDispatchKey.cpp", + grouped_native_functions, + key_fn=lambda x: x.root_name, + env_callable=register_dispatch_key_env_callable, + num_shards=4 if dispatch_key == DispatchKey.CPU else 1, + base_env=register_dispatch_key_base_env, + sharded_keys={"dispatch_definitions"}, + ) + + for g in structured_native_functions: + if not g.out.ufunc_inner_loop or not is_ufunc_dispatch_key(dispatch_key): + continue + name = g.functional.func.name.name + if dispatch_key is DispatchKey.CPU: + assert fm is cpu_fm + fm.write_with_template( + f"UfuncCPU_{name}.cpp", + "UfuncCPU.cpp", + lambda: { + "meta_declaration": compute_meta_function_declaration(g), + "native_declaration": dest.compute_native_function_declaration( + g, backend_indices[dispatch_key] + ), + "native_definitions": dest.compute_ufunc_cpu(g), + }, + ) + cpu_vec_fm.write_with_template( + f"UfuncCPUKernel_{name}.cpp", + "UfuncCPUKernel.cpp", + lambda: { + "name": name, + "native_definitions": dest.compute_ufunc_cpu_kernel(g), + }, + ) + elif dispatch_key is DispatchKey.CUDA: + cuda_headers = "#include " + if rocm: + cuda_headers = "#include " + fm.write_with_template( + f"UfuncCUDA_{name}.cu", + "UfuncCUDA.cu", + lambda: { + "name": name, + "cuda_headers": cuda_headers, + "meta_declaration": compute_meta_function_declaration(g), + "native_declaration": dest.compute_native_function_declaration( + g, backend_indices[dispatch_key] + ), + "native_definitions": dest.compute_ufunc_cuda(g), + }, + ) + else: + raise AssertionError(f"unrecognized {dispatch_key} for ufunc") + + del fm + + gen_aoti_c_shim_files( + aoti_fm=aoti_fm, + aoti_backends=aoti_backends, + native_functions=native_functions, + backend_indices=backend_indices, + structured_native_functions=structured_native_functions, + extra_cuda_headers=extra_cuda_headers, + update_aoti_c_shim=update_aoti_c_shim, + extend_aoti_c_shim=extend_aoti_c_shim, + ) + + # BackendSelect is generated specially + def gen_backend_select() -> dict[str, list[str]]: + relevant_fns = [ + fn for fn in native_functions if needs_backend_select(fn, selector) + ] + return { + "ops_headers": [ + f"#include " for fn in relevant_fns + ], + "backend_select_method_definitions": list( + mapMaybe( + ComputeBackendSelect(Target.DEFINITION, selector), relevant_fns + ) + ), + "backend_select_function_registrations": list( + mapMaybe( + ComputeBackendSelect(Target.REGISTRATION, selector), relevant_fns + ) + ), + } + + cpu_fm.write("RegisterBackendSelect.cpp", gen_backend_select) + + schema_selector = selector + if force_schema_registration: + schema_selector = SelectiveBuilder.get_nop_selector() + + ( + aten_schema_registrations, + schema_registrations, + ) = get_native_function_schema_registrations( + native_functions=native_functions, schema_selector=schema_selector + ) + cpu_fm.write( + "RegisterSchema.cpp", + lambda: { + "aten_schema_registrations": [] + if skip_dispatcher_op_registration + else aten_schema_registrations, + "schema_registrations": [] + if skip_dispatcher_op_registration + else schema_registrations, + }, + ) + + def key_func( + fn: NativeFunction | NativeFunctionsGroup | NativeFunctionsViewGroup, + ) -> str: + return fn.root_name + + cpu_fm.write_sharded( + "Operators.cpp", + native_functions, + key_fn=key_func, + env_callable=lambda fn: { + "operator_headers": [f"#include "], + "definitions": [ + ComputeOperators( + Target.DEFINITION, + static_dispatch_backend_indices=static_dispatch_idx, + )(fn) + ], + }, + base_env={ + "static_dispatch_extra_headers": static_dispatch_extra_headers( + static_dispatch_idx + ), + }, + num_shards=5, + sharded_keys={ + "operator_headers", + "definitions", + "static_dispatch_extra_headers", + }, + ) + + cpu_fm.write("Functions.cpp", dict) + + core_fm.write("TensorMethods.cpp", dict) + + core_fm.write( + "ATenOpList.cpp", + lambda: { + "aten_ops": list(mapMaybe(compute_aten_op, native_functions)), + }, + ) + + def gen_op_headers( + g: NativeFunction | NativeFunctionsGroup | NativeFunctionsViewGroup, + ) -> list[str]: + if isinstance(g, NativeFunctionsViewGroup): + # view ops always get a functionalization kernel + headers = [ + f"#include ", + f"#include ", + ] + if g.view_copy is not None: + headers += [ + f"#include ", + f"#include ", + ] + return headers + elif isinstance(g, NativeFunctionsGroup): + headers = [ + f"#include ", + f"#include ", + f"#include ", + f"#include ", + ] + if g.inplace is not None: + headers += [ + f"#include ", + f"#include ", + ] + if g.mutable is not None: + headers += [ + f"#include ", + f"#include ", + ] + return headers + else: + return [ + f"#include ", + f"#include ", + ] + + def functionalization_env_callable( + g: NativeFunction | NativeFunctionsGroup | NativeFunctionsViewGroup, + ) -> dict[str, list[str]]: + return { + "ops_headers": gen_op_headers(g), + "func_definitions": gen_functionalization_definition( + selector, + g, + ), + "func_registrations": gen_functionalization_registration( + selector, + g, + backend_indices[DispatchKey.CompositeImplicitAutograd], + ), + } + + all_groups: list[ + NativeFunction | NativeFunctionsGroup | NativeFunctionsViewGroup + ] = list(structured_native_functions) + list( + view_groups # type: ignore[assignment, arg-type, operator] + ) + # Note: all operators that functionalization needs to handle (mutable and aliasing ops) should be grouped properly. + # The only reason we really need to deal with direct NativeFunctions here (instead of the groups) is because: + # (1) We can provide better error checking (error out if someone introduces a mutable op that doesn't obey the grouping logic) + # (2) functionalization needs to manually register CompositeImplicitAutograd kernels, which might not be grouped. + # Although this could go away long-term if we add a dedicated dispatch key for decompositions. + structured_map: dict[OperatorName, NativeFunction] = { + f.func.name: f + for f in concatMap(lambda g: list(g.functions()), structured_native_functions) + } + view_map: dict[OperatorName, NativeFunction] = { + f.func.name: f for f in concatMap(lambda g: list(g.functions()), view_groups) + } + all_groups.extend( + f + for f in native_functions + if f.func.name not in structured_map and f.func.name not in view_map + ) + + cpu_fm.write_sharded( + "RegisterFunctionalization.cpp", + all_groups, + key_fn=key_func, + env_callable=functionalization_env_callable, + num_shards=4, + sharded_keys={ + "ops_headers", + "func_definitions", + "func_registrations", + "func_add_back_views_definitions", + "func_add_back_views_registrations", + }, + ) + + cpu_fm.write( + "FunctionalInverses.h", + lambda: { + "view_inverse_declarations": list( + mapMaybe( + lambda g: gen_functionalization_view_inverse_declaration( + selector, g + ), + view_groups, + ) + ) + }, + ) + + cpu_fm.write( + "ViewMetaClasses.h", + lambda: { + "view_meta_declarations": list( + concatMap( + lambda g: gen_functionalization_view_meta_classes_decl(selector, g), + view_groups, + ) + ) + }, + ) + + cpu_fm.write( + "ViewMetaClasses.cpp", + lambda: { + "view_meta_implementations": list( + concatMap( + lambda g: gen_functionalization_view_meta_classes_impl(selector, g), + view_groups, + ) + ), + "op_headers": list(concatMap(gen_op_headers, view_groups)), + }, + ) + + # Note [view_copy NativeFunctions] + # Every view operator in native_functions.yaml that is not CompositeImplicitAutograd + # needs to have a corresponding non-aliasing {view}_copy variant. + # Backends that use functionalization and don't know how to handle aliasing ops + # are expected to implement kernels for these {view}_copy kernels instead. + # The code for {view}_copy operators in core is pretty boilerplate-heavy however, + # so we codegen the following: + # (1) A CompositeExplicitAutogradNonFunctional kernel for every {view}_copy operator. + # These are never explicitly invoked by the functionalization pass, + # but they could theoretically be called from user code (I added these kernels for completeness, + # since the ops are part of the public API). + # (2) A derivative formula for every {view}_copy operator + # {view}_copy operators can reuse the same derivative formulas as their {view} op counterparts, + # so rather than stamping all of the entries out in derivatives.yaml, + # we codegen them in. + # This is similar to how autograd codegen doesn't require inplace ops to have a derivatives.yaml entry. + cpu_fm.write( + "CompositeViewCopyKernels.cpp", + lambda: { + "ops_headers": [ + "\n".join( + f"#include \n" + # NB: this include is important as it ensures we + # set the visibility on generated view_copy kernels + # correctly + f"#include " + for f in ( + [g.view] if g.view_copy is None else [g.view, g.view_copy] + ) + ) + for g in view_groups + ] + + [ + "\n".join( + f"#include \n" + # NB: this include is also important for correct visibility + f"#include " + for f in [g.inplace, g.mutable, g.functional] + if f is not None and "generated" not in f.tags + ) + for g in structured_native_functions + ], + "CompositeViewCopyKernel_Definitions": list( + mapMaybe( + GenCompositeViewCopyKernel( + backend_indices[ + DispatchKey.CompositeExplicitAutogradNonFunctional + ] + ), + view_groups, + ) + ), + "GeneratedCompositeFunctional_Definitions": list( + mapMaybe( + gen_composite_functional_kernel, + structured_native_functions, + ) + ), + "GeneratedCompositeOut_Definitions": list( + mapMaybe( + gen_composite_out_kernel, + structured_native_functions, + ) + ), + }, + ) + + +def gen_declarations_yaml( + cpu_fm: FileManager, native_functions: Sequence[NativeFunction] +) -> None: + cpu_fm.write( + "Declarations.yaml", + lambda: format_yaml([compute_declaration_yaml(f) for f in native_functions]), + ) + + +def get_torchgen_root() -> Path: + """ + If you're depending on torchgen out-of-tree, you can use the root to figure + out the path to native_functions.yaml + """ + return Path(__file__).parent.resolve() + + +def main() -> None: + parser = argparse.ArgumentParser(description="Generate ATen source files") + parser.add_argument( + "-s", + "--source-path", + help="path to source directory for ATen", + default="aten/src/ATen", + ) + parser.add_argument( + "-o", + "--output-dependencies", + help="output a list of dependencies into the given file and exit", + ) + parser.add_argument( + "--dry-run", + action="store_true", + help="run without writing any files (still updates outputs)", + ) + parser.add_argument( + "--per-operator-headers", + action="store_true", + help="generate separate headers per operator in ATen/ops", + ) + parser.add_argument( + "-d", + "--install-dir", + "--install_dir", + help="output directory", + default="build/aten/src/ATen", + ) + parser.add_argument( + "--aoti-install-dir", + "--aoti_install_dir", + help="output directory for AOTInductor shim", + default="torch/csrc/inductor/aoti_torch/generated", + ) + parser.add_argument( + "--rocm", + action="store_true", + help="reinterpret CUDA as ROCm/HIP and adjust filepaths accordingly", + ) + parser.add_argument( + "--mps", + action="store_true", + help="Generate MPS registration code when set", + ) + parser.add_argument( + "--xpu", + action="store_true", + help="Generate XPU registration code when set", + ) + parser.add_argument( + "--mtia", + action="store_true", + help="Generate MTIA registration code when set", + ) + + # TODO: --op-registration-whitelist will be removed when all call-sites + # for gen.py are moved over to using the operator YAML file for mobile + # custom build. + parser.add_argument( + "--op-registration-whitelist", + "--op_registration_whitelist", + nargs="*", + help="filter op registrations by the whitelist (if set); " + "each item is `namespace`::`operator name` without overload name; " + "e.g.: aten::empty aten::conv2d ...", + ) + parser.add_argument( + "--op-selection-yaml-path", + "--op_selection_yaml_path", + help="Provide a path to the operator selection (for custom build) YAML " + "that contains the information about the set of selected operators " + "and their categories (training, ...). Each operator is either a " + "full operator name with overload or just a bare operator name. " + "The operator names also contain the namespace prefix (e.g. aten::)", + ) + parser.add_argument( + "--backend-whitelist", + "--backend_whitelist", + nargs="*", + help="filter dispatch backend by the whitelist (if set), " + "e.g.: CPU CUDA QuantizedCPU ...", + ) + parser.add_argument( + "--static-dispatch-backend", + "--static_dispatch_backend", + nargs="*", + help="generate static dispatch code for the specific backend (if set)", + ) + parser.add_argument( + "--skip-dispatcher-op-registration", + "--skip_dispatcher_op_registration", + action="store_true", + help="Avoid registering operators into the dispatcher.", + ) + parser.add_argument( + "--force-schema-registration", + "--force_schema_registration", + action="store_true", + help="force it to generate schema-only registrations for all ops, including" + "those that are not listed on --op-registration-whitelist", + ) + parser.add_argument( + "--generate", + type=str, + nargs="*", + choices=["headers", "sources", "declarations_yaml"], + default=["headers", "sources", "declarations_yaml"], + help="Generate only a subset of files", + ) + parser.add_argument( + "--update-aoti-c-shim", + action="store_true", + help="Update AOTInductor C shim after adding an entry to inductor_fallback_ops in torchgen/aoti/fallback_ops.py. " + "WARNING: Do not use this unless you are sure what you are doing!!!", + ) + parser.add_argument( + "--extend-aoti-c-shim", + action="store_true", + help="This Flag indicates the generation of c shims for out-of-tree ATen ops," + "which is an extension to the In-tree ATen op c shims. This flag needs to be combined with" + "---source-path=" + "--aoti-install-dir=/extend" + " default is torch/csrc/inductor/aoti_torch/generated/extend" + "WARNING: Do not use this unless you are sure what you are doing!!!", + ) + + options = parser.parse_args() + + selector = get_custom_build_selector( + options.op_registration_whitelist, + options.op_selection_yaml_path, + ) + + native_yaml_path = os.path.join(options.source_path, "native/native_functions.yaml") + tags_yaml_path = os.path.join(options.source_path, "native/tags.yaml") + + from torchgen.model import dispatch_keys + + # Only a limited set of dispatch keys get CPUFunctions.h headers generated + # for them; this is the set + functions_keys = { + DispatchKey.CPU, + DispatchKey.CUDA, + DispatchKey.CompositeImplicitAutograd, + DispatchKey.CompositeImplicitAutogradNestedTensor, + DispatchKey.CompositeExplicitAutograd, + DispatchKey.CompositeExplicitAutogradNonFunctional, + DispatchKey.Meta, + DispatchKey.MTIA, + } + + aoti_backends = { + DispatchKey.CPU, + DispatchKey.CUDA, + # None will generate the aten shim based on aten_shimified_ops + # which does not bypass the dispatcher + None, + } + + # TODO: stop generating CUDA kernels for non-CUDA builds + ignore_keys = set() + + MPS_KEYS = {DispatchKey.MPS, DispatchKey.SparseMPS, DispatchKey.SparseCsrMPS} + if options.mps or options.update_aoti_c_shim: + functions_keys.update(MPS_KEYS) + aoti_backends.add(DispatchKey.MPS) + else: + ignore_keys.update(MPS_KEYS) + dispatch_keys[:] = [k for k in dispatch_keys if k not in MPS_KEYS] + + if options.xpu or options.update_aoti_c_shim: + functions_keys.add(DispatchKey.XPU) + aoti_backends.add(DispatchKey.XPU) + else: + ignore_keys.add(DispatchKey.XPU) + + if DispatchKey.XPU in dispatch_keys: + del dispatch_keys[dispatch_keys.index(DispatchKey.XPU)] + + if not options.mtia: + ignore_keys.add(DispatchKey.MTIA) + + if DispatchKey.MTIA in dispatch_keys: + del dispatch_keys[dispatch_keys.index(DispatchKey.MTIA)] + + if options.backend_whitelist: + dispatch_keys = [ + k + for k in dispatch_keys + if is_generic_dispatch_key(k) or str(k) in options.backend_whitelist + ] + + parsed_yaml = parse_native_yaml(native_yaml_path, tags_yaml_path, ignore_keys) + valid_tags = _GLOBAL_PARSE_TAGS_YAML_CACHE[tags_yaml_path] + native_functions, backend_indices = ( + parsed_yaml.native_functions, + parsed_yaml.backend_indices, + ) + + grouped_native_functions = get_grouped_native_functions(native_functions) + + structured_native_functions = [ + g for g in grouped_native_functions if isinstance(g, NativeFunctionsGroup) + ] + native_functions_with_view_groups = get_grouped_by_view_native_functions( + native_functions + ) + view_groups = [ + g + for g in native_functions_with_view_groups + if isinstance(g, NativeFunctionsViewGroup) + ] + + # NB: It is mandatory to NOT use os.path.join here, as the install directory + # will eventually be ingested by cmake, which does not respect Windows style + # path slashes. If you switch this to use os.path.join, you'll get an error + # like: + # + # Syntax error in cmake code when parsing string + # + # C:/Jenkins/workspace/pytorch-builds/pytorch-win-ws2016-cuda9-cudnn7-py3-build/build/aten/src/ATen\core/TensorMethods.h + # + # Invalid character escape '\c'. + core_install_dir = f"{options.install_dir}/core" + Path(core_install_dir).mkdir(parents=True, exist_ok=True) + ops_install_dir = f"{options.install_dir}/ops" + Path(ops_install_dir).mkdir(parents=True, exist_ok=True) + + aoti_install_dir = f"{options.aoti_install_dir}" + Path(aoti_install_dir).mkdir(parents=True, exist_ok=True) + + core_fm = make_file_manager(options=options, install_dir=core_install_dir) + cpu_fm = make_file_manager(options=options) + cpu_vec_fm = make_file_manager(options=options) + cuda_fm = make_file_manager(options=options) + ops_fm = make_file_manager(options=options, install_dir=ops_install_dir) + aoti_fm = make_file_manager(options=options, install_dir=aoti_install_dir) + device_fms = {"cuda": cuda_fm} + if options.xpu: + device_fms["xpu"] = make_file_manager(options=options) + + static_dispatch_idx: list[BackendIndex] = [] + if options.static_dispatch_backend: + static_dispatch_idx = [ + backend_indices[DispatchKey.parse(key)] + for key in options.static_dispatch_backend + ] + for key in options.static_dispatch_backend: + dp_key = DispatchKey.parse(key) + if dp_key not in functions_keys: + functions_keys.add(dp_key) + + if "sources" in options.generate: + gen_source_files( + native_functions=native_functions, + grouped_native_functions=grouped_native_functions, + structured_native_functions=structured_native_functions, + view_groups=view_groups, + selector=selector, + static_dispatch_idx=static_dispatch_idx, + backend_indices=backend_indices, + aoti_fm=aoti_fm, + core_fm=core_fm, + cpu_vec_fm=cpu_vec_fm, + cpu_fm=cpu_fm, + device_fms=device_fms, + dispatch_keys=dispatch_keys, + functions_keys=functions_keys, + rocm=options.rocm, + force_schema_registration=options.force_schema_registration, + per_operator_headers=options.per_operator_headers, + skip_dispatcher_op_registration=options.skip_dispatcher_op_registration, + update_aoti_c_shim=options.update_aoti_c_shim, + aoti_backends=aoti_backends, + extend_aoti_c_shim=options.extend_aoti_c_shim, + ) + + if "headers" in options.generate: + gen_headers( + native_functions=native_functions, + valid_tags=valid_tags, + grouped_native_functions=grouped_native_functions, + structured_native_functions=structured_native_functions, + static_dispatch_idx=static_dispatch_idx, + selector=selector, + backend_indices=backend_indices, + core_fm=core_fm, + cpu_fm=cpu_fm, + device_fms=device_fms, + ops_fm=ops_fm, + dispatch_keys=dispatch_keys, + functions_keys=functions_keys, + rocm=options.rocm, + per_operator_headers=options.per_operator_headers, + ) + + if "declarations_yaml" in options.generate: + gen_declarations_yaml(native_functions=native_functions, cpu_fm=cpu_fm) + + if options.output_dependencies: + depfile_path = Path(options.output_dependencies).resolve() + depfile_name = depfile_path.name + depfile_stem = depfile_path.stem + + for fm, prefix in [ + (cpu_fm, ""), + (cpu_vec_fm, "cpu_vec_"), + (core_fm, "core_"), + (ops_fm, "ops_"), + ] + [(device_fm, f"{device}_") for device, device_fm in device_fms.items()]: + varname = prefix + depfile_stem + path = depfile_path.parent / (prefix + depfile_name) + fm.write_outputs(varname, str(path)) + + +if __name__ == "__main__": + main() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_aoti_c_shim.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_aoti_c_shim.py new file mode 100644 index 0000000000000000000000000000000000000000..af8efffd4c858874691b4200889250870ff2b207 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_aoti_c_shim.py @@ -0,0 +1,770 @@ +from __future__ import annotations + +import difflib +import os +import textwrap +from dataclasses import dataclass +from typing import TYPE_CHECKING + +from torchgen.aoti.fallback_ops import aten_shimified_ops, inductor_fallback_ops +from torchgen.api.types import DispatcherSignature +from torchgen.api.types.signatures import CppSignature, CppSignatureGroup +from torchgen.context import method_with_native_function +from torchgen.model import ( + Argument, + BackendIndex, + BaseTy, + BaseType, + DispatchKey, + FunctionSchema, + is_cuda_dispatch_key, + ListType, + NativeFunction, + NativeFunctionsGroup, + OperatorName, + OptionalType, + Type, + Variant, +) +from torchgen.utils import FileManager, mapMaybe + + +if TYPE_CHECKING: + from collections.abc import Sequence + + +base_type_to_c_type = { + BaseTy.Tensor: "AtenTensorHandle", + BaseTy.bool: "int32_t", # Use int to pass bool + BaseTy.int: "int64_t", + BaseTy.SymInt: "int64_t", # Inductor-generated code won't see a SymInt + BaseTy.Scalar: "double", # Use double to pass both integer and floating point + BaseTy.float: "double", # TODO: how about other floating point types? + BaseTy.str: "const char*", + BaseTy.DeviceIndex: "int32_t", + BaseTy.Layout: "int32_t", # Represent enum as int + BaseTy.MemoryFormat: "int32_t", # Represent enum as int + BaseTy.ScalarType: "int32_t", # Represent enum as int + BaseTy.Generator: "AtenGeneratorHandle", +} + +base_type_to_aten_type = { + BaseTy.Tensor: "at::Tensor", + BaseTy.bool: "bool", + BaseTy.int: "int64_t", + BaseTy.SymInt: "c10::SymInt", + BaseTy.Scalar: "c10::Scalar", + BaseTy.float: "double", + BaseTy.str: "::std::string_view", + BaseTy.DeviceIndex: "c10::DeviceIndex", + BaseTy.Layout: "c10::Layout", + BaseTy.MemoryFormat: "c10::MemoryFormat", + BaseTy.ScalarType: "c10::ScalarType", + BaseTy.Generator: "at::Generator", +} + +base_type_to_callsite_expr = { + BaseTy.Tensor: "resolve_tensor_dispatch_flags", + BaseTy.bool: "", + BaseTy.int: "", + BaseTy.SymInt: "", + BaseTy.Scalar: "", + BaseTy.float: "", + BaseTy.str: "", + BaseTy.DeviceIndex: "static_cast", + BaseTy.Layout: "static_cast", + BaseTy.MemoryFormat: "static_cast", + BaseTy.ScalarType: "static_cast", + BaseTy.Generator: "*generator_handle_to_generator_pointer", +} + + +# convert args to C types, names in declarations, and expressions in function bodies +def convert_arg_type_and_name( + typ: Type, + name: str, + is_write: bool = False, +) -> tuple[list[str], list[str], list[str], list[str]]: + if isinstance(typ, BaseType): + if typ.name in base_type_to_c_type: + if typ.name == BaseTy.Tensor and is_write: + # For output tensors, our normal call to resolve_tensor_dispatch_flags + # results in an rvalue tensor, which can't be passed to at::Tensor&. + # Override this case specifically. + callsite_expr = [f"*tensor_handle_to_tensor_pointer({name})"] + else: + callsite_expr = [ + f"{base_type_to_callsite_expr[typ.name]}({name})" + if base_type_to_callsite_expr[typ.name] + else name + ] + + return ( + [base_type_to_c_type[typ.name]], + [name], + [base_type_to_aten_type[typ.name]], + callsite_expr, + ) + elif typ.name == BaseTy.Device: + return ( + ["int32_t", "int32_t"], + [name, name + "_index_"], + ["c10::Device"], + [ + f"c10::Device(static_cast({name}), static_cast({name}_index_))" + ], + ) + else: + # TODO: BaseTy.Dimname, etc. + raise NotImplementedError(f"TODO: add support for arg type {repr(typ)}") + elif isinstance(typ, OptionalType): + c_types, names, aten_types, callsite_exprs = convert_arg_type_and_name( + typ.elem, name + ) + j = 0 # index for names + new_aten_types = [] + new_callsite_exprs = [] + for aten_type in aten_types: + # Use pointer to denote optional type + c_types[j] = c_types[j] + "*" + if aten_type.startswith("c10::ArrayRef<"): + # ArrayRef is passed as pointer + size, but no need to add "*" to the size argument + new_aten_types.append(f"::std::optional<{aten_type}>") + base_type = aten_type[len("c10::ArrayRef<") : -1] + new_callsite_exprs.append( + f"pointer_to_optional_list<{base_type}>({names[j]}, {names[j + 1]})" + ) + j += 2 + elif aten_type == "c10::Device": + # Device is passed as device_type + device_index + new_aten_types.append("::std::optional") + new_callsite_exprs.append( + f"pointer_to_optional_device({names[j]}, {names[j + 1]})" + ) + j += 2 + elif aten_type == "at::Tensor": + new_aten_types.append(f"::std::optional<{aten_type}>") + new_callsite_exprs.append(f"resolve_tensor_dispatch_flags({names[j]})") + j += 1 + else: + new_aten_types.append(f"::std::optional<{aten_type}>") + new_callsite_exprs.append( + f"pointer_to_optional<{aten_type}>({names[j]})" + ) + j += 1 + + return ( + c_types, + names, + new_aten_types, + new_callsite_exprs, + ) + elif isinstance(typ, ListType): + # Need to explicitly pass the list as pointer + length + c_types, names, aten_types, _ = convert_arg_type_and_name(typ.elem, name) + assert len(c_types) == 1, "ListType with unsupported element type " + repr(typ) + + # The list content should never be modified + c_types[0] = f"const {c_types[0]}*" + c_types.append("int64_t") + name = names[0] + names.append(name + "_len_") + + atype = aten_types[0] + callsite_exprs = [] + if atype == "bool": + # no converter from std::vector to c10::ArrayRef + # construct std::array instead + assert typ.size is not None + callsite_exprs.append(f"pointer_to_list<{typ.size}>({name})") + elif atype == "at::Tensor" and not is_write: + callsite_exprs.append( + f"resolve_tensor_list_dispatch_flags({name}, {name}_len_)" + ) + elif atype == "::std::optional": + # convert from std::vector<::std::optional> to c10::List<::std::optional> + callsite_exprs.append( + f"c10::List<{atype}>(c10::ArrayRef<{atype}>(resolve_tensor_list_dispatch_flags({name}, {name}_len_)))" + ) + else: + callsite_exprs.append(f"pointer_to_list<{atype}>({name}, {name}_len_)") + + aten_types = [f"c10::ArrayRef<{t}>" for t in aten_types] + return ( + c_types, + names, + aten_types, + callsite_exprs, + ) + raise NotImplementedError(f"Argument type {repr(typ)} not supported!") + + +def zip_type_and_name(types: list[str], names: list[str]) -> list[str]: + return [typ + " " + name for typ, name in zip(types, names)] + + +# Generate argument declarations and callsite expressions +def gen_arguments( + flat_arguments: Sequence[Argument], skipped_args: set[str] +) -> tuple[list[str], list[str]]: + types: list[str] = [] + new_names: list[str] = [] + callsite_exprs: list[str] = [] + for arg in flat_arguments: + if arg.name in skipped_args: + callsite_exprs.append("std::nullopt") + continue + new_types, names, _, new_callsite_exprs = convert_arg_type_and_name( + arg.type, arg.name, arg.is_write + ) + types.extend(new_types) + new_names.extend(names) + callsite_exprs.extend(new_callsite_exprs) + return zip_type_and_name(types, new_names), callsite_exprs + + +# Return values are passed out as pointer arguments because all the C shim functions +# are expected to return AOTITorchError. +# Generate returns as declarations and callsite expressions +def gen_returns(schema: FunctionSchema) -> tuple[list[str], list[str]]: + types = [] + names = [] + for idx, ret in enumerate(schema.returns): + names.append(f"ret{idx}") + if isinstance(ret.type, BaseType) and ret.type.name in base_type_to_c_type: + types.append(base_type_to_c_type[ret.type.name] + "*") + else: + raise NotImplementedError( + f"TODO: add support for return type {repr(ret.type)}" + ) + + def convert_return(typ: BaseType, val: str) -> str: + if typ.name == BaseTy.Tensor: + return f"new_tensor_handle(std::move({val}))" + elif typ.name == BaseTy.SymInt: + return f"{val}.expect_int()" + elif typ.name == BaseTy.Scalar: + return f"{val}.toDouble()" + else: + return val + + ret_pointer_can_be_null = False + unambiguous_name = schema.name.unambiguous_name() + for name in ( + "_functional_sym_constrain_range", + "_scaled_dot_product_cudnn_attention", + "_scaled_dot_product_efficient_attention_backward", + "_scaled_dot_product_efficient_attention", + "_scaled_dot_product_flash_attention", + "_scaled_dot_product_fused_attention_overrideable", + "_thhn_fused_lstm_cell_backward_impl", + "convolution_backward", + "grid_sampler_2d_backward", + "grid_sampler_3d_backward", + "linear_backward", + ): + if name in unambiguous_name: + ret_pointer_can_be_null = True + break + + callsite_exprs: list[str] = [] + for idx, ret in enumerate(schema.returns): + tmp = "tmp_result" if len(names) == 1 else f"std::get<{idx}>(tmp_result)" + assert isinstance(ret.type, BaseType) + rval = convert_return(ret.type, tmp) + if ret_pointer_can_be_null: + callsite_exprs.append(f"if ({names[idx]}) {{ *{names[idx]} = {rval}; }}") + else: + callsite_exprs.append(f"*{names[idx]} = {rval};") + + return zip_type_and_name(types, names), callsite_exprs + + +# gen.py generates header first and then src, so caching the result here to avoid duplicate work +declaration_definition_cache: dict[tuple[str, str, str], tuple[str, str]] = {} + + +def gen_declaration_and_definition( + schema: FunctionSchema, + device: str, + backend_call: str, + version_info: dict[str, list[str]], +) -> tuple[str, str]: + base_name = schema.name.unambiguous_name() + + global declaration_definition_cache + if (base_name, device, backend_call) in declaration_definition_cache: + return declaration_definition_cache[(base_name, device, backend_call)] + + # Check the validity of version_info. The format should look like + # {"v2" : ["new_arg1"], "v3": ["new_arg2, new_arg3"]}. + indexed_version_info: dict[int, list[str]] = {1: []} + for ver_str, new_args in sorted(version_info.items()): + assert ver_str.startswith("v"), ( + f"Version number for {base_name} is {ver_str}, not starting with 'v'" + ) + try: + ver_id = int(ver_str[1:]) + except ValueError as e: + raise AssertionError( + f"Version number for {base_name} is {ver_str}, not a valid integer after 'v'" + ) from e + assert ver_id not in indexed_version_info, ( + f"{ver_str} for {base_name} has already been defined" + ) + indexed_version_info[ver_id] = new_args + + declarations: list[str] = [] + definitions: list[str] = [] + skipped_args: set[str] = set() + + for ver_id, new_args in sorted(indexed_version_info.items(), reverse=True): + # Iterate in the reverse order, so the latest version of an op will get generated first + # with all the arguments included, while a set of to-be-trimmed args is carried down + # to generate earlier version of the op. + func_name = base_name if ver_id == 1 else f"{base_name}_v{ver_id}" + if schema.is_out_fn(): + # out_variant has out arguments in the front, and it's ok to ignore return values + # because C shim functions only return AOTITorchError + args, callsite_exprs = gen_arguments( + [*schema.arguments.out, *schema.arguments.flat_non_out], skipped_args + ) + ret_assignments: list[str] = [] + else: + args, callsite_exprs = gen_arguments( + schema.arguments.flat_all, skipped_args + ) + # ignore return values for inplace ops + ret_declarations, ret_assignments = ( + ([], []) if schema.name.name.inplace else gen_returns(schema) + ) + args.extend(ret_declarations) + + declaration = textwrap.dedent( + f"AOTITorchError aoti_torch_{device}_{func_name}({', '.join(args)})" + ) + + tmp_result = "auto tmp_result = " if ret_assignments else "" + indent = "\t\t" + ret_assignments_str = ( + "\n".join(indent + r for r in ret_assignments) if ret_assignments else "" + ) + definition = ( + textwrap.dedent(f""" + {declaration} {{ + AOTI_TORCH_CONVERT_EXCEPTION_TO_ERROR_CODE({{ + {tmp_result}{backend_call}( + {", ".join(callsite_exprs)} + ); + """) + + ret_assignments_str + + textwrap.dedent(""" + }); + } + """) + ) + skipped_args.update(new_args) + declarations.append(f"AOTI_TORCH_EXPORT {declaration};") + definitions.append(definition) + + declaration_definition_cache[(base_name, device, backend_call)] = ( + "\n".join(declarations), + "\n".join(definitions), + ) + return declaration_definition_cache[(base_name, device, backend_call)] + + +def gen_static_dispatch_backend_call_signature( + sig: CppSignature | DispatcherSignature, + f: NativeFunction, +) -> CppSignature: + sig = DispatcherSignature.from_schema(f.func) + cpp_sigs = CppSignatureGroup.from_native_function( + f, method=False, fallback_binding=False + ) + if sig.symint and f.func.has_symint(): + cpp_sig = cpp_sigs.symint_signature + else: + cpp_sig = cpp_sigs.signature + assert cpp_sig is not None + return cpp_sig + + +def gen_static_dispatch_backend_call( + f: NativeFunction, + backend_index: BackendIndex | None = None, +) -> str: + sig = DispatcherSignature.from_schema(f.func) + cpp_sig = gen_static_dispatch_backend_call_signature(sig, f) + + if backend_index is None: + # Check if this is a symint function and if the function only has method variants + if sig.symint and f.func.has_symint(): + has_function_variant = Variant.function in f.variants + + if not has_function_variant: + # Functions with both function and method variants can use the at::{*}_symint version + # (e.g., narrow -> at::narrow_symint), BUT + # Method-only functions with symint parameters should use at::symint:: namespace + # Remove the _symint suffix since at::symint:: namespace uses the base name + # (e.g., new_empty -> at::symint::new_empty) + base_name = cpp_sig.name() + base_name = base_name.removesuffix("_symint") # Remove "_symint" suffix + return f"at::symint::{base_name}" + + return f"at::{cpp_sig.name()}" + else: + return f"at::{backend_index.dispatch_key.lower()}::{cpp_sig.name()}" + + +def get_backend_index_for_aoti( + func: NativeFunction, + func_group_mapping: dict[OperatorName, NativeFunctionsGroup], + dispatch_key: DispatchKey | None, + backend_indices: dict[DispatchKey, BackendIndex], + extend_aoti_c_shim: bool, +) -> BackendIndex | None: + backend_index = None + + if dispatch_key is None: + return backend_index + + if backend_indices[dispatch_key].has_kernel(func) or ( + func.structured_delegate is not None + and func.structured_delegate in func_group_mapping + and backend_indices[dispatch_key].has_kernel( + func_group_mapping[func.structured_delegate] + ) + ): + backend_index = backend_indices[dispatch_key] + else: + # for the extend out-of-tree kernels, we don't need to + # duplicatly create C shim wrappers for other dispatch keys + if extend_aoti_c_shim: + return backend_index + + elif backend_indices[DispatchKey.CompositeExplicitAutograd].has_kernel(func): + # We need to create C shim wrappers for CompositeExplicitAutograd kernels + backend_index = backend_indices[DispatchKey.CompositeExplicitAutograd] + elif backend_indices[ + DispatchKey.CompositeExplicitAutogradNonFunctional + ].has_kernel(func): + # We need to create C shim wrappers for CompositeExplicitAutogradNonFunctional kernels + backend_index = backend_indices[ + DispatchKey.CompositeExplicitAutogradNonFunctional + ] + elif backend_indices[DispatchKey.CompositeImplicitAutograd].has_kernel(func): + backend_index = backend_indices[DispatchKey.CompositeImplicitAutograd] + + return backend_index + + +def get_header_for_aoti( + func: NativeFunction, + func_group_mapping: dict[OperatorName, NativeFunctionsGroup], + dispatch_key: DispatchKey | None, + backend_indices: dict[DispatchKey, BackendIndex], + extend_aoti_c_shim: bool, +) -> str | None: + backend_index = get_backend_index_for_aoti( + func, func_group_mapping, dispatch_key, backend_indices, extend_aoti_c_shim + ) + if backend_index is None: + if dispatch_key is None: + return f"#include " + return None + + return f"#include " + + +def get_fallback_op_name(func: NativeFunction) -> str: + return ( + f"{func.namespace}.{func.func.name.name}.{func.func.name.overload_name}" + if func.func.name.overload_name + else f"{func.namespace}.{func.func.name.name}.default" + ) + + +def gen_c_shim( + func: NativeFunction, + version_info: dict[str, list[str]], + func_group_mapping: dict[OperatorName, NativeFunctionsGroup], + dispatch_key: DispatchKey | None, + backend_indices: dict[DispatchKey, BackendIndex], + header: bool, + extend_aoti_c_shim: bool, +) -> str | None: + backend_index = get_backend_index_for_aoti( + func, func_group_mapping, dispatch_key, backend_indices, extend_aoti_c_shim + ) + if backend_index is None and dispatch_key is not None: + return None + + schema = func.func + device = "aten" if dispatch_key is None else dispatch_key.lower() + backend_call = gen_static_dispatch_backend_call( + func, + backend_index, + ) + + try: + if header: + declaration, _ = gen_declaration_and_definition( + schema, device, backend_call, version_info + ) + return declaration + else: + _, definition = gen_declaration_and_definition( + schema, device, backend_call, version_info + ) + return definition + + except NotImplementedError: + return None + + +@dataclass(frozen=True) +class ShimGenerator: + inductor_fallback_ops: dict[str, dict[str, list[str]]] + func_group_mapping: dict[OperatorName, NativeFunctionsGroup] + dispatch_key: DispatchKey | None + backend_indices: dict[DispatchKey, BackendIndex] + header: bool # True to generate .h and False to generate .cpp + extend_aoti_c_shim: bool + + @method_with_native_function + def __call__( + self, + func: NativeFunction, + ) -> str | None: + version_info = self.inductor_fallback_ops[get_fallback_op_name(func)] + result = gen_c_shim( + func, + version_info, + self.func_group_mapping, + self.dispatch_key, + self.backend_indices, + self.header, + self.extend_aoti_c_shim, + ) + return result + + +def gen_aoti_c_shim( + native_functions: Sequence[NativeFunction], + inductor_fallback_ops: dict[str, dict[str, list[str]]], + func_group_mapping: dict[OperatorName, NativeFunctionsGroup], + dispatch_key: DispatchKey | None, + backend_indices: dict[DispatchKey, BackendIndex], + header: bool, + extend_aoti_c_shim: bool, + includes: str = "", +) -> str: + body = "\n".join( + list( + mapMaybe( + ShimGenerator( + inductor_fallback_ops, + func_group_mapping, + dispatch_key, + backend_indices, + header, + extend_aoti_c_shim, + ), + native_functions, + ) + ) + ) + device = "aten" if dispatch_key is None else dispatch_key.lower() + include_device_functions = ( + "#include " + if dispatch_key is None + else f"#include " + ) + aten_warning = ( + ( + "\n\n// This file corresponds to the aten_shimified_ops list in torchgen/aoti/fallback_ops.py\n" + ) + if dispatch_key is None + else "" + ) + warning = """ + +// WARNING: THIS FILE IS AUTOGENERATED BY torchgen. DO NOT MODIFY BY HAND. +// See https://github.com/pytorch/pytorch/blob/7e86a7c0155295539996e0cf422883571126073e/torchgen/gen.py#L2424-L2436 for details""" + + if header: + return ( + warning + + aten_warning + + textwrap.dedent(""" + + #pragma once + + #include + + #ifdef __cplusplus + extern "C" { + #endif + + """) + + body + + textwrap.dedent(""" + + #ifdef __cplusplus + } // extern "C" + #endif + """) + ) + else: + return ( + warning + + aten_warning + + textwrap.dedent(f""" + + #include + #include + + #ifndef AT_PER_OPERATOR_HEADERS + {include_device_functions} + #include + #include + #include + #else + """) + + includes + + textwrap.dedent(""" + #endif // AT_PER_OPERATOR_HEADERS + + using namespace torch::aot_inductor; + + """) + + body + ) + + +def gen_aoti_c_shim_files( + aoti_fm: FileManager, + aoti_backends: set[DispatchKey | None], + native_functions: Sequence[NativeFunction], + backend_indices: dict[DispatchKey, BackendIndex], + structured_native_functions: Sequence[NativeFunctionsGroup], + extra_cuda_headers: str, + extend_aoti_c_shim: bool, + update_aoti_c_shim: bool, +) -> None: + structured_func_group_dict = {} + for func_group in structured_native_functions: + for func in func_group.functions(): + if func.structured_delegate is not None: + structured_func_group_dict[func.structured_delegate] = func_group + break + + for dispatch_key in aoti_backends: + # Use aten_shimified_ops for the aten backend, inductor_fallback_ops for others + fallback_ops_dict = ( + aten_shimified_ops if dispatch_key is None else inductor_fallback_ops + ) + fallbacks = {} + for func in native_functions: + op_name = get_fallback_op_name(func) + if op_name in fallback_ops_dict: + fallbacks[op_name] = func + fallback_native_functions = tuple( + value for _, value in sorted(fallbacks.items()) + ) + + # Use "aten" as the device name when dispatch_key is Generic + device_name = "aten" if dispatch_key is None else dispatch_key.lower() + + # header files were checked in for ABI-compatibility checking + header_file_name = f"c_shim_{device_name}.h" + new_header = gen_aoti_c_shim( + fallback_native_functions, + fallback_ops_dict, + structured_func_group_dict, + dispatch_key, + backend_indices, + header=True, + extend_aoti_c_shim=extend_aoti_c_shim, + includes="", + ) + if update_aoti_c_shim: + aoti_fm.write( + header_file_name, + lambda: new_header, + ) + else: + try: + with open( + os.path.join(aoti_fm.install_dir, header_file_name) + ) as old_file: + old_header = old_file.read() + + if old_header != new_header: + diff = "\n".join( + difflib.unified_diff( + old_header.splitlines(), + new_header.splitlines(), + fromfile="expected", + tofile="actual", + lineterm="", + ) + ) + + raise RuntimeError(f""" +The generated AOTInductor C shim header files have unexpectedly changed. This +indicates an AOTInductor fallback operator ABI backward compatibility breakage!!! +Only in a limited number of situations, this is allowed: + +1. You added a fallback op to the inductor_fallback_ops list in torchgen/aoti/fallback_ops.py. +If that's the case, run `python torchgen/gen.py --update-aoti-c-shim` to add a new entry to +existing C shim header files. + +2. You added a new default argument to an existing fallback op. This is clearly a BC breaking +change in the AOTInductor land. You need to annotate the new default argument in +torchgen/aoti/fallback_ops.py, and then run `python torchgen/gen.py --update-aoti-c-shim` to +update the C shim header files by creating different versions of the fallback op. See +https://github.com/pytorch/pytorch/pull/154848 as an example. + +{diff} + """) + except FileNotFoundError: + print( + f"{os.path.join(aoti_fm.install_dir, header_file_name)} not found" + ) + + # cpp files are always generated on-the-fly + def headers_for_aoti() -> str: + headers = [] + for func in fallback_native_functions: + header = get_header_for_aoti( + func, + structured_func_group_dict, + dispatch_key, + backend_indices, + extend_aoti_c_shim=extend_aoti_c_shim, + ) + if header is not None: + headers.append(header) + return "\n".join(sorted(set(headers))) + + extra_headers = ( + extra_cuda_headers + if dispatch_key is not None and is_cuda_dispatch_key(dispatch_key) + else "" + ) + + aoti_fm.write( + f"c_shim_{device_name}.cpp", + lambda: gen_aoti_c_shim( + fallback_native_functions, + fallback_ops_dict, + structured_func_group_dict, + dispatch_key, + backend_indices, + header=False, + extend_aoti_c_shim=extend_aoti_c_shim, + includes=headers_for_aoti() + "\n" + extra_headers, + ), + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_backend_stubs.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_backend_stubs.py new file mode 100644 index 0000000000000000000000000000000000000000..85fe64e95b17352f657890fe65f37a72ec89320e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_backend_stubs.py @@ -0,0 +1,614 @@ +from __future__ import annotations + +import argparse +import os +import re +from collections import Counter, defaultdict, namedtuple +from pathlib import Path +from typing import TYPE_CHECKING + +import yaml + +import torchgen.api.dispatcher as dispatcher +import torchgen.dest as dest +from torchgen.api.types import DispatcherSignature +from torchgen.code_template import CodeTemplate +from torchgen.context import native_function_manager +from torchgen.gen import get_grouped_native_functions, parse_native_yaml +from torchgen.model import ( + BackendIndex, + BackendMetadata, + DispatchKey, + NativeFunction, + NativeFunctionsGroup, + OperatorName, +) +from torchgen.selective_build.selector import SelectiveBuilder +from torchgen.utils import concatMap, context, FileManager, NamespaceHelper, Target +from torchgen.yaml_utils import YamlLoader + + +if TYPE_CHECKING: + from collections.abc import Sequence + + +# Parses the external backend's yaml, and adds a new BackendIndex for the backend's dispatch key. +# Returns a Tuple of (backend_key, autograd_key, cpp_namespace, updated BackendIndex mapping) +ParsedExternalYaml = namedtuple( + "ParsedExternalYaml", + ["backend_key", "autograd_key", "class_name", "cpp_namespace", "backend_indices"], +) + + +def parse_backend_yaml( + backend_yaml_path: str, + grouped_native_functions: Sequence[NativeFunction | NativeFunctionsGroup], + backend_indices: dict[DispatchKey, BackendIndex], +) -> ParsedExternalYaml: + native_functions_map: dict[OperatorName, NativeFunction] = { + f.func.name: f + for f in concatMap( + lambda f: [f] if isinstance(f, NativeFunction) else list(f.functions()), + grouped_native_functions, + ) + } + + with open(backend_yaml_path) as f: + yaml_values = yaml.load(f, Loader=YamlLoader) + assert isinstance(yaml_values, dict) + + valid_keys = [ + "backend", + "class_name", + "cpp_namespace", + "extra_headers", + "supported", + "autograd", + "full_codegen", + "non_native", + "ir_gen", + "symint", + ] + + backend = yaml_values.pop("backend", None) + assert backend is not None, 'You must provide a value for "backend"' + + class_name = yaml_values.pop("class_name", None) + + cpp_namespace = yaml_values.pop("cpp_namespace", None) + assert cpp_namespace is not None, 'You must provide a value for "cpp_namespace"' + + # Mostly just defaulting to false to stick with LazyTensor convention. + use_out_as_primary = yaml_values.pop("use_out_as_primary", False) + assert isinstance(use_out_as_primary, bool), ( + f"You must provide either True or False for use_out_as_primary. Provided: {use_out_as_primary}" + ) + + use_device_guard = yaml_values.pop("device_guard", False) + assert isinstance(use_device_guard, bool), ( + f"You must provide either True or False for device_guard. Provided: {use_device_guard}" + ) + + supported = yaml_values.pop("supported", []) + if supported is None: + supported = [] # Allow an empty list of supported ops + assert isinstance(supported, list), ( + f'expected "supported" to be a list, but got: {supported} (of type {type(supported)})' + ) + + symint = yaml_values.pop("symint", []) + if symint is None: + symint = [] # Allow an empty list of symint ops + assert isinstance(symint, list), ( + f'expected "symint" to be a list, but got: {supported} (of type {type(supported)})' + ) + symint_set = set(symint) + + supported_autograd = yaml_values.pop("autograd", []) + assert isinstance(supported_autograd, list), ( + f'expected "autograd" to be a list, but got: {supported_autograd}' + ) + + # full_codegen is ignored by parse_backend_yaml, and re-parsed in gen_lazy_tensor.py + full_codegen = yaml_values.pop("full_codegen", []) + supported.extend(full_codegen) + + # non_native is ignored by parse_backend_yaml, and re-parsed in gen_lazy_tensor.py + yaml_values.pop("non_native", {}) + + # ir_gen is ignored by parse_backend_yaml, and re-parsed in gen_lazy_tensor.py + yaml_values.pop("ir_gen", {}) + + assert len(yaml_values.keys()) == 0, ( + f"{backend_yaml_path} contains unexpected keys: {', '.join(yaml_values.keys())}. " + f"Only the following keys are supported: {', '.join(valid_keys)}" + ) + + def create_backend_index( + backend_ops: list[str], + symint_ops: set[str], + dispatch_key: DispatchKey, + *, + use_out_as_primary: bool, + use_device_guard: bool, + ) -> BackendIndex: + metadata: dict[OperatorName, BackendMetadata] = {} + for op in backend_ops: + op_name = OperatorName.parse(op) + assert op_name in native_functions_map, ( + f"Found an invalid operator name: {op_name}" + ) + # See Note [External Backends Follow Dispatcher API] + kernel_name = dispatcher.name(native_functions_map[op_name].func) + if op in symint_ops: + kernel_name += "_symint" + # TODO: allow structured external backends later. + m = BackendMetadata( + kernel=kernel_name, structured=False, cpp_namespace=cpp_namespace + ) + metadata[op_name] = m + return BackendIndex( + dispatch_key=dispatch_key, + use_out_as_primary=use_out_as_primary, + external=True, + device_guard=use_device_guard, + index=metadata, + ) + + backend_key: DispatchKey | None = None + if len(supported) > 0: + with context( + lambda: f'The provided value for "backend" must be a valid DispatchKey, but got {backend}.' + ): + backend_key = DispatchKey.parse(backend) + + backend_idx = create_backend_index( + supported, + symint_set, + backend_key, + use_out_as_primary=use_out_as_primary, + use_device_guard=use_device_guard, + ) + assert backend_key not in backend_indices + backend_indices[backend_key] = backend_idx + + autograd_key: DispatchKey | None = None + if len(supported_autograd) > 0: + with context( + lambda: f'The "autograd" key was specified, which indicates that you would like to override \ +the behavior of autograd for some operators on your backend. However "Autograd{backend}" is not a valid DispatchKey.' + ): + autograd_key = DispatchKey.parse(f"Autograd{backend}") + + autograd_idx = create_backend_index( + supported_autograd, + symint_set, + autograd_key, + use_out_as_primary=use_out_as_primary, + use_device_guard=use_device_guard, + ) + assert autograd_key not in backend_indices + backend_indices[autograd_key] = autograd_idx + + for g in grouped_native_functions: + if isinstance(g, NativeFunction): + forward_kernels = ( + [] + if backend_key is None + else [ + m + for m in [backend_indices[backend_key].get_kernel(g)] + if m is not None + ] + ) + backward_kernels = ( + [] + if autograd_key is None + else [ + m + for m in [backend_indices[autograd_key].get_kernel(g)] + if m is not None + ] + ) + else: + forward_kernels = ( + [] + if backend_key is None + else [ + m + for m in [ + backend_indices[backend_key].get_kernel(f) + for f in g.functions() + ] + if m is not None + ] + ) + backward_kernels = ( + [] + if autograd_key is None + else [ + m + for m in [ + backend_indices[autograd_key].get_kernel(f) + for f in g.functions() + ] + if m is not None + ] + ) + + forward_kernels = [f for f in forward_kernels if f is not None] + backward_kernels = [f for f in backward_kernels if f is not None] + assert len(forward_kernels) == 0 or len(backward_kernels) == 0, ( + f'Currently, all variants of an op must either be registered to a backend key, or to a backend\'s \ +autograd key. They cannot be mix and matched. If this is something you need, feel free to create an issue! \ +{forward_kernels[0].kernel} is listed under "supported", but {backward_kernels[0].kernel} is listed under "autograd".' + ) + + return ParsedExternalYaml( + backend_key, autograd_key, class_name, cpp_namespace, backend_indices + ) + + +def error_on_missing_kernels( + native_functions: Sequence[NativeFunction], + backend_indices: dict[DispatchKey, BackendIndex], + backend_key: DispatchKey, + autograd_key: DispatchKey | None, + class_name: str, + kernel_defn_file_path: str, + full_codegen: list[OperatorName] | None = None, +) -> None: + try: + with open(kernel_defn_file_path) as f: + backend_defns = f.read() + except OSError as e: + raise AssertionError( + f"Unable to read from the specified impl_path file: {kernel_defn_file_path}" + ) from e + + if full_codegen is None: + full_codegen = [] + + indices = [backend_indices[backend_key].index] + ( + [] if autograd_key is None else [backend_indices[autograd_key].index] + ) + # Quick mapping from each OperatorName used by the external backend + # to its backend kernel name + expected_backend_op_names: dict[OperatorName, str] = dict( + list( + concatMap( + lambda index: [ + (op_name, metadata.kernel) for op_name, metadata in index.items() + ], + indices, + ) + ) + ) + expected_backend_native_funcs: list[NativeFunction] = [ + f + for f in native_functions + if f.func.name in expected_backend_op_names and f.func.name not in full_codegen + ] + expected_backend_kernel_name_counts: dict[str, list[NativeFunction]] = defaultdict( + list + ) + for native_f in expected_backend_native_funcs: + expected_backend_kernel_name_counts[ + expected_backend_op_names[native_f.func.name] + ].append(native_f) + + # This just looks for lines containing "foo(", and assumes that the kernel foo has been implemented. + # It might cause false negatives (we won't catch all cases), but that's ok - if we catch a missing kernel + # here, then we get a nicer error message. If we miss it, you get a linker error. + kernel_defn_regex = rf"(.*){class_name}::\s*([\w\d]*)\(" + actual_backend_kernel_name_counts = Counter( + # A bit unwieldy (this could probably be moved into regex), + # but we don't want to include kernel names that come from function calls, + # like "return torch_xla::XLANativeFunctions::empty_strided_symint(...)". + # Easy check is to ignore any lines with colons before the class name. + [ + y + for (x, y) in re.findall(kernel_defn_regex, backend_defns) + if not x.endswith(":") + ] + ) + + missing_kernels_err_msg = "" + for expected_name, funcs in expected_backend_kernel_name_counts.items(): + expected_overload_count = len(funcs) + actual_overload_count = actual_backend_kernel_name_counts[expected_name] + if expected_overload_count != actual_overload_count: + + def create_decl(f: NativeFunction) -> str: + with native_function_manager(f): + return DispatcherSignature.from_schema(f.func).decl() + + expected_schemas_str = "\n".join([create_decl(f) for f in funcs]) + missing_kernels_err_msg += f""" +{class_name} is missing a kernel definition for {expected_name}. We found {actual_overload_count} kernel(s) with that name, +but expected {expected_overload_count} kernel(s). The expected function schemas for the missing operator are: +{expected_schemas_str} + +""" + assert missing_kernels_err_msg == "", missing_kernels_err_msg + + +def main() -> None: + parser = argparse.ArgumentParser(description="Generate backend stub files") + parser.add_argument( + "-s", + "--source-yaml", + "--source_yaml", + help="path to source yaml file containing operator external definitions", + ) + parser.add_argument("-o", "--output-dir", "--output_dir", help="output directory") + parser.add_argument( + "--dry-run", "--dry_run", type=bool, default=False, help="output directory" + ) + parser.add_argument( + "--impl-path", + "--impl_path", + type=str, + default=None, + help="path to the source C++ file containing kernel definitions", + ) + options = parser.parse_args() + + run(options.source_yaml, options.output_dir, options.dry_run, options.impl_path) + + +def gen_dispatchkey_nativefunc_headers( + fm: FileManager, + class_name: str, + cpp_namespace: str, + backend_indices: dict[DispatchKey, BackendIndex], + grouped_native_functions: Sequence[NativeFunction | NativeFunctionsGroup], + backend_dispatch_key: DispatchKey, + autograd_dispatch_key: DispatchKey | None, + backend_name: str = "", +) -> None: + assert class_name is not None + generated_comment = ( + "Autogenerated file by gen_backend_stubs.py. Do not edit directly!" + ) + + # Convert to a set first to remove duplicate kernel names. + # Backends are allowed to repeat kernel names; only generate the declaration once! + # Sort for deterministic output. + backend_declarations = sorted( + set( + concatMap( + lambda f: dest.compute_native_function_declaration( + f, backend_indices[backend_dispatch_key] + ), + grouped_native_functions, + ) + ) + ) + autograd_declarations = sorted( + set( + concatMap( + lambda f: [] + if autograd_dispatch_key is None + else dest.compute_native_function_declaration( + f, backend_indices[autograd_dispatch_key] + ), + grouped_native_functions, + ) + ) + ) + + ns_helper = NamespaceHelper(cpp_namespace) + fm.write_with_template( + f"{backend_dispatch_key}NativeFunctions.h", + "DispatchKeyNativeFunctions.h", + lambda: { + "generated_comment": generated_comment, + "namespace_prologue": ns_helper.prologue, + "class_name": class_name, + "namespace_epilogue": ns_helper.epilogue, + "dispatch_declarations": backend_declarations + autograd_declarations, + "BackendName": backend_name, + "DispatchKey": backend_dispatch_key, + }, + ) + + +def gen_dispatcher_registrations( + fm: FileManager, + output_dir: str, + class_name: str, + backend_indices: dict[DispatchKey, BackendIndex], + grouped_native_functions: Sequence[NativeFunction | NativeFunctionsGroup], + backend_dispatch_key: DispatchKey, + dispatch_key: DispatchKey, + selector: SelectiveBuilder, + # build_in_tree is true for lazy TS backend and affects include paths, not used for external backends + build_in_tree: bool = False, + per_operator_headers: bool = False, + backend_name: str = "", + eager_registration: bool = True, +) -> None: + headers = [ + f"{output_dir}/{backend_dispatch_key}NativeFunctions.h", + ] + if build_in_tree: + external_backend_headers_str = "\n".join(f"#include <{h}>" for h in headers) + else: + external_backend_headers_str = "\n".join(f'#include "{h}"' for h in headers) + + assert class_name is not None + backend_index = backend_indices[dispatch_key] + + dispatch_registrations_body = list( + concatMap( + dest.RegisterDispatchKey( + backend_index, + Target.REGISTRATION, + selector, + rocm=False, + symint=True, + class_method_name=f"{class_name}", + skip_dispatcher_op_registration=False, + ), + grouped_native_functions, + ) + ) + newline = "\n" + ns_helper = NamespaceHelper(namespace_str="at") + deferred_dispatch_registrations = "" + static_init_dispatch_registrations = "" + if eager_registration: + static_template = CodeTemplate( + """\ +TORCH_LIBRARY_IMPL(aten, $dispatch_key, m) { + $dispatch_registrations_body +}""" + ) + static_init_dispatch_registrations = static_template.substitute( + dispatch_key=dispatch_key, + dispatch_registrations_body=dispatch_registrations_body, + ) + else: + deferred_template = CodeTemplate( + """\ +TORCH_API void Register${backend_name}${dispatch_key}NativeFunctions(); +TORCH_API void Register${backend_name}${dispatch_key}NativeFunctions() { + static auto m = MAKE_TORCH_LIBRARY_IMPL(aten, $dispatch_key); + $dispatch_registrations_body +}""" + ) + deferred_dispatch_registrations = deferred_template.substitute( + backend_name=backend_name, + dispatch_key=dispatch_key, + dispatch_registrations_body=dispatch_registrations_body, + ) + + fm.write_with_template( + f"Register{dispatch_key}.cpp", + "RegisterDispatchKey.cpp", + lambda: { + "extra_cuda_headers": "", + "external_backend_headers": external_backend_headers_str, + "ops_headers": "#include " + if not per_operator_headers + else "", + "DispatchKey": dispatch_key, + "dispatch_namespace": dispatch_key.lower(), + "dispatch_headers": dest.gen_registration_headers( + backend_index, per_operator_headers=per_operator_headers, rocm=False + ), + "dispatch_helpers": dest.gen_registration_helpers(backend_index), + "dispatch_definitions": fm.substitute_with_template( + "RegisterDispatchDefinitions.ini", + lambda: { + "ns_prologue": ns_helper.prologue, + "ns_epilogue": ns_helper.epilogue, + "static_init_dispatch_registrations": static_init_dispatch_registrations, + "deferred_dispatch_registrations": deferred_dispatch_registrations, + "dispatch_namespace": dispatch_key.lower(), + "dispatch_namespaced_definitions": "", + "dispatch_anonymous_definitions": list( + concatMap( + dest.RegisterDispatchKey( + backend_index, + Target.ANONYMOUS_DEFINITION, + selector, + rocm=False, + symint=True, + class_method_name=f"{class_name}", + skip_dispatcher_op_registration=False, + ), + grouped_native_functions, + ) + ), + }, + ).split(newline), + }, + ) + + +def run( + source_yaml: str, output_dir: str, dry_run: bool, impl_path: str | None = None +) -> None: + # Assumes that this file lives at PYTORCH_ROOT/torchgen/gen_backend_stubs.py + pytorch_root = Path(__file__).absolute().parent.parent + template_dir = os.path.join(pytorch_root, "aten/src/ATen/templates") + + def make_file_manager(install_dir: str) -> FileManager: + return FileManager( + install_dir=install_dir, template_dir=template_dir, dry_run=dry_run + ) + + fm = make_file_manager(output_dir) + + native_yaml_path = os.path.join( + pytorch_root, "aten/src/ATen/native/native_functions.yaml" + ) + tags_yaml_path = os.path.join(pytorch_root, "aten/src/ATen/native/tags.yaml") + parsed_yaml = parse_native_yaml(native_yaml_path, tags_yaml_path) + native_functions, backend_indices = ( + parsed_yaml.native_functions, + parsed_yaml.backend_indices, + ) + grouped_native_functions = get_grouped_native_functions(native_functions) + parsed_backend_yaml = parse_backend_yaml( + source_yaml, grouped_native_functions, backend_indices + ) + backend_key = parsed_backend_yaml.backend_key + autograd_key = parsed_backend_yaml.autograd_key + cpp_namespace = parsed_backend_yaml.cpp_namespace + class_name = parsed_backend_yaml.class_name + backend_indices = parsed_backend_yaml.backend_indices + + selector = SelectiveBuilder.get_nop_selector() + + if backend_key is None: + # This could be useful if a backend wants to quickly set up a noop yaml file but doesn't have any kernels ready yet. + return + + if class_name is None: + # class_name is an optional argument to backend yaml file. + # if specified it allows an external backend to override + # the name of the class that all generated kernel definitions live under. + # if not specified, its value is given as native_function_class_name. + class_name = backend_indices[backend_key].native_function_class_name() + assert class_name is not None + + if impl_path is not None: + error_on_missing_kernels( + native_functions, + backend_indices, + backend_key, + autograd_key, + class_name, + impl_path, + ) + + gen_dispatchkey_nativefunc_headers( + fm, + class_name, + cpp_namespace, + backend_indices, + grouped_native_functions, + backend_key, + autograd_key, + ) + + for dispatch_key in ( + [backend_key] if autograd_key is None else [backend_key, autograd_key] + ): + gen_dispatcher_registrations( + fm, + output_dir, + class_name, + backend_indices, + grouped_native_functions, + backend_key, + dispatch_key, + selector, + ) + + +if __name__ == "__main__": + main() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_functionalization_type.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_functionalization_type.py new file mode 100644 index 0000000000000000000000000000000000000000..fe02fb1c18aed00508db31170705fefed2112027 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_functionalization_type.py @@ -0,0 +1,1138 @@ +from __future__ import annotations + +from dataclasses import dataclass +from typing import TYPE_CHECKING + +from torchgen.api import cpp, dispatcher, functionalization +from torchgen.api.translate import translate +from torchgen.api.types import ( + BaseCType, + Binding, + CType, + DispatcherSignature, + iTensorListRefT, + NativeSignature, + OptionalCType, + optionalSymIntArrayRefT, + symIntArrayRefT, + SymIntT, + tensorListT, + tensorT, + VectorCType, + ViewInverseSignature, +) +from torchgen.context import ( + method_with_native_function, + native_function_manager, + with_native_function, + with_native_function_and, +) +from torchgen.model import ( + Argument, + BackendIndex, + BaseTy, + BaseType, + FunctionSchema, + ListType, + NativeFunction, + NativeFunctionsGroup, + NativeFunctionsViewGroup, + Return, + SchemaKind, + SelfArgument, + TensorOptionsArguments, +) +from torchgen.native_function_generation import ( + INPLACE_OPS_THAT_DONT_GET_GROUPED_PROPERLY, + MUTABLE_OPS_THAT_CANNOT_GET_AN_OUT_VARIANT, + OUT_OPS_THAT_DONT_GET_GROUPED_PROPERLY, +) +from torchgen.utils import concatMap, dataclass_repr, FileManager + + +if TYPE_CHECKING: + from collections.abc import Callable + + from torchgen.selective_build.selector import SelectiveBuilder + + +# Note: [Mutable Ops Not Using Functionalization] +# Ops in this list currently do not work with functionalization and should be fixed. +MUTABLE_OPS_NOT_USING_FUNCTIONALIZATION = ( + OUT_OPS_THAT_DONT_GET_GROUPED_PROPERLY + + MUTABLE_OPS_THAT_CANNOT_GET_AN_OUT_VARIANT + + INPLACE_OPS_THAT_DONT_GET_GROUPED_PROPERLY + + [ + # It will be BC-breaking, but we should fix their schemas. + # should be inplace? + "record_stream", + # See Note [resize_ in Functionalization] + "resize_", + "resize_as_", + # This function is used as for testing purposes only. + "_fill_mem_eff_dropout_mask_", + ] +) + +# This file contains codegen that relates to the functionalization pass. +# It includes: +# - gen_functionalization_definition +# Generates dispatcher kernel definitions for the functionalization pass. +# - gen_functionalization_registration +# Generates dispatcher kernel registrations for the functionalization pass. +# - gen_functionalization_view_inverse_declaration +# Generates a declaration for an "inverse view", for every view op +# that is needed in functionalization. We manually implement their definitions. +# - gen_composite_view_copy_kernel +# Generates view_copy() composite kernels for all view_copy operators. + + +# Generates the body of the default composite C++ kernel for a {view}_copy NativeFunction +# See Note [view_copy NativeFunctions] +@dataclass(frozen=True) +class GenCompositeViewCopyKernel: + backend_index: BackendIndex + + @method_with_native_function + def __call__(self, g: NativeFunctionsViewGroup) -> str | None: + if g.view_copy is None: + return None + elif g.view_copy.func.name.name.base != f"{g.view.func.name.name}_copy": + # If the view_copy doesn't match the standard naming scheme of _copy, + # assume it already exists and doesn't need to be generated. + # Example: slice_inverse() with the copy variant named slice_scatter() + # instead of slice_inverse_copy() + return None + + metadata = self.backend_index.get_kernel(g.view_copy) + assert metadata is not None + + # We can make view_copy work in more cases by using reshape() + # when a normal view call would ordinarily fail. + # This also makes LTC more efficient, because they don't need to include + # clone() calls in their graph (which is normally needed by reshape). + if str(g.view_copy.func.name) == "view_copy": + assert metadata.kernel == "view_copy_symint" + return """\ +at::Tensor view_copy_symint(const at::Tensor & self, at::SymIntArrayRef size) { + c10::SymDimVector shape = infer_size_dv(size, self.sym_numel()); + if (!at::detail::computeStride(self.sym_sizes(), self.sym_strides(), shape).has_value()) { + return self.reshape_symint(size); + } else { + auto output = at::_ops::view::call(self, size); + return output.clone(/*memory_format=*/at::MemoryFormat::Contiguous); + } +} +""" + # view_copy is a native signature, since we're generating an at::native:: kernel + # Functionalization always operates on symints though + view_copy_sig = NativeSignature( + g.view_copy.func, symint=metadata.supports_symint() + ) + + # view is a dispatcher signature, since we're calling into the at::_ops API + view_sig = DispatcherSignature(g.view.func) + + view_api_name = g.view.func.name.unambiguous_name() + exprs = ", ".join( + [e.expr for e in translate(view_copy_sig.arguments(), view_sig.arguments())] + ) + + # view ops today always return either a Tensor or a list of Tensors + assert len(g.view.func.returns) == 1 + assert g.view.func.returns[0].type == BaseType( + BaseTy.Tensor + ) or g.view.func.returns[0].type == ListType(BaseType(BaseTy.Tensor), None) + + if g.view.func.returns[0].type == BaseType(BaseTy.Tensor): + return_cloned_output = """\ + return output.clone(/*memory_format=*/at::MemoryFormat::Contiguous);""" + else: + # If the return type is a list, we need to clone each tensor in the list. + return_cloned_output = f"""\ + {view_copy_sig.returns_type().cpp_type()} out_clone; + for (const auto i : c10::irange(output.size())) {{ + out_clone.push_back(output[i].clone(/*memory_format=*/at::MemoryFormat::Contiguous)); + }} + return out_clone;""" + + # The default generated composite kernel for {view}_copy() operators just clones + # the input tensor, and runs the underlying view on the clone. + return f""" +{view_copy_sig.defn(name=metadata.kernel)} {{ + auto output = at::_ops::{view_api_name}::call({exprs}); + {return_cloned_output} +}} +""" + + +def return_str(rets: tuple[Return, ...], names: list[str]) -> str: + assert len(rets) == len(names) + if len(rets) == 0: + return "" + elif len(rets) == 1: + return f"return {names[0]};" + else: + return f"return {dispatcher.returns_type(rets).cpp_type()}({', '.join(names)});" + + +def modifies_arguments(f: NativeFunction) -> bool: + return any( + a.annotation is not None and a.annotation.is_write + for a in f.func.arguments.flat_all + ) + + +def wrapper_name(func: FunctionSchema) -> str: + if func.name.overload_name: + return f"{cpp.name(func)}_{func.name.overload_name}" + else: + return cpp.name(func) + + +def is_tensor_like(a: Argument | TensorOptionsArguments | SelfArgument) -> bool: + return isinstance(a, SelfArgument) or ( + isinstance(a, Argument) and a.type.is_tensor_like() + ) + + +# We need to wrap / unwrap various arguments from the op in the functionalization kernels. +# Some op schemas include non-owning types though (like TensorList), +# and when we unwrap them we expect to get out an owning type!. +# We also return a lambda that tells you how to convert the non-owning type argument into the owning type. +def get_owning_type(t: CType) -> tuple[CType, Callable[[str], str]]: + if t == BaseCType(tensorListT): + return VectorCType(BaseCType(tensorT)), lambda x: f"{x}.vec()" + if t == BaseCType(iTensorListRefT): + return VectorCType(BaseCType(tensorT)), lambda x: f"{{{x}.begin(), {x}.end()}}" + # There are technically other non-owning types out there (like IntArrayRef), + # but functionalization only actually cares about the ones involving tensors. + return t, lambda x: x + + +# unwraps all tensor-like arguments, returning: +# (1) a string containing all of the logic that does the unwrapping +# (2) a context, to be used by translate(), with all of the relevant bindings. +def unwrap_tensor_args( + sig: DispatcherSignature, *, is_view_op: bool +) -> tuple[str, list[Binding]]: + context: list[Binding] = [] + unwrapped_tensor_args: list[str] = [] + for arg in sig.arguments(): + if is_tensor_like(arg.argument): + # for tensor inputs, we want to unwrap them before passing them into the redispatch calls. + unwrapped_name = f"{arg.name}_" + # For most ops, the functionalization needs to sync any pending updates on the input tensors + # before calling the operator, since otherwise the operator will act on stale data. + # For view ops though, we can continue to defer syncing until the tensor is used by + # a non-view operator. + maybe_sync_input = ( + "" if is_view_op else f"at::functionalization::impl::sync({arg.name});" + ) + unwrapped_type, conversion_fn = get_owning_type( + arg.nctype.remove_const_ref().type + ) + unwrapped_tensor_args.append( + f""" + {unwrapped_type.cpp_type()} {unwrapped_name}; + if (at::functionalization::impl::isFunctionalTensor({arg.name})) {{ + {maybe_sync_input} + {unwrapped_name} = at::functionalization::impl::from_functional_tensor({arg.name}); + }} else {{ + {unwrapped_name} = {conversion_fn(arg.name)}; + }}""" + ) + context.append(arg.with_name(unwrapped_name)) + else: + # for non-tensor inputs, we want to pass them directly into the redispatch calls. + context.append(arg) + unwrap_tensor_args_str = "\n ".join(unwrapped_tensor_args) + return unwrap_tensor_args_str, context + + +# converts all tensor-like arguments to meta tensors, which are used to compute stride info. Returns: +# (1) a string containing all of the logic that does the conversions. +# (2) a context, to be used by translate(), with all of the relevant bindings. +def convert_to_meta_tensors(sig: DispatcherSignature) -> tuple[str, list[Binding]]: + context: list[Binding] = [] + unwrapped_tensor_args: list[str] = [] + for arg in sig.arguments(): + if is_tensor_like(arg.argument): + # for tensor inputs, we want to unwrap them before passing them into the redispatch calls. + a_ = arg.name + unwrapped_name = f"{arg.name}_meta" + unwrapped_tensor_args.append(f"auto {unwrapped_name} = to_meta({a_});") + context.append(arg.with_name(unwrapped_name)) + else: + # for non-tensor inputs, we want to pass them directly into the redispatch calls. + context.append(arg) + unwrap_tensor_args_str = "\n ".join(unwrapped_tensor_args) + return unwrap_tensor_args_str, context + + +# The functionalization codegen currently expects view op schemas to have this form: +# foo(Tensor(a), ...) -> Tensor(a) (e.g. transpose) +# foo(Tensor(a!), ...) -> Tensor(a!) (e.g. transpose_) +def assert_view_op_properties(func: FunctionSchema) -> None: + def is_alias(a: Argument) -> bool: + return a.annotation is not None + + args = func.arguments.flat_non_out + # The first argument is a tensor with an alias semantics (annotations) + assert ( + len(args) > 0 and args[0].type == BaseType(BaseTy.Tensor) + ), f"""In the functionalization codegen, we expect the first argument of every view operator to be a tensor, +but found an argument of type {str(args[0].type)} for operator: {str(func.name)}.""" + # No other arguments have aliasing semantics + assert ( + is_alias(args[0]) and not any(is_alias(a) for a in args[1:]) + ), """In the functionalization codegen, we expect the first argument of every view operator to alias the output. +View operators with multiple aliasing inputs aren't supported yet. Found an operator that doesn't satisfy this constraint""" + + +# One-liner expression for checking if an expression expr of type type has any +# symbolic values. +def emit_expr_has_symbolic_values(expr: str, type: CType) -> str: + if type == BaseCType(SymIntT): + return f"{expr}.is_symbolic()" + + if isinstance(type, OptionalCType): + innerexpr = f"(*{expr})" + return f"{expr}.has_value() ? {emit_expr_has_symbolic_values(innerexpr, type.elem)} : false" + + if type == BaseCType(optionalSymIntArrayRefT): + return emit_expr_has_symbolic_values( + expr, OptionalCType(BaseCType(symIntArrayRefT)) + ) + + if type in (BaseCType(symIntArrayRefT), VectorCType(BaseCType(SymIntT))): + argname = "arg" + lambda_check = emit_expr_has_symbolic_values(argname, BaseCType(SymIntT)) + return ( + "std::any_of(" + f"{expr}.begin(), {expr}.end(), " + f"[=](auto& {argname}) {{ return {lambda_check}; }})" + ) + + raise ValueError( + "unsupported type for has_symbolic_values check. " + "It should be a SymInt or a collection of those. " + f"Got: {type.cpp_type()}" + ) + + +# Detects whether any of the SymInt arguments are, in fact, symbolic values. +# This is used in the constructor of ViewMeta. +def emit_has_symbolic_inputs(sig: DispatcherSignature) -> tuple[str, str]: + name = "has_symbolic_inputs" + statements = [ + f"{name} = {name} | ({emit_expr_has_symbolic_values(binding.name, binding.nctype.type)});" + for binding in sig.arguments() + if ( + isinstance(binding.argument, Argument) + and binding.argument.type.is_symint_like() + ) + ] + body = "\n ".join(statements) + return ( + name, + f""" + bool {name} = false; + {body}""", + ) + + +# Generates the Functionalization kernel for: +# - ops that create aliases (e.g. transpose()) +# - ops that are views AND mutations (e.g. transpose_()) +def emit_view_functionalization_body( + g: NativeFunctionsViewGroup, *, view_inplace: bool +) -> str: + if view_inplace: + # This op is both an inplace op AND a view op. + # See Note [Functionalization Pass - Inplace View Ops] for details. + # I currently have the view meta call into the out-of-place variant of the view, to avoid + # having to define an extra ~20 inplace {view}_inverse_ functions. + # Most view ops don't have NativeFunctionGroup's both, because we don't define out= variants for view ops. + # I'm assuming that every inplace-view op has a corresponding out-of-place view op, + # with the same name but the trailing underscore removed. + # This is currently asserted at parse time in gen.py (see error_check_native_functions). + assert g.view_inplace is not None + f = g.view_inplace + else: + f = g.view + + assert g.view_copy is not None + with native_function_manager(f): + call_sig = DispatcherSignature.from_schema(g.view_copy.func) + + spec = ViewMetaSpecialization(g, f=f) + + # the "view_copy" op name that the functionalization kernels need to call + api_name = g.view_copy.func.name.unambiguous_name() + # Sometimes the functionalization pass needs to no-op (e.g. if it was passed non-functional tensors) + # "no-op"ing in this context is just redispatching to the original op. + noop_api_name = f.func.name.unambiguous_name() + + dispatcher_sig = DispatcherSignature.from_schema(f.func) + assert_view_op_properties(f.func) + view_tensor_name = dispatcher_sig.arguments()[0].name + + return_type = dispatcher_sig.returns_type().remove_const_ref().cpp_type() + + unwrap_tensor_args_str, unwrapped_args_ctx = unwrap_tensor_args( + dispatcher_sig, is_view_op=True + ) + view_redispatch_args = [ + e.expr + for e in translate(unwrapped_args_ctx, call_sig.arguments(), method=False) + ] + + # The meta API call should use the same arguments, but convert all tensors to meta tensors first. + meta_conversion_str, meta_call_ctx = convert_to_meta_tensors(dispatcher_sig) + meta_call_args = [ + e.expr for e in translate(meta_call_ctx, call_sig.arguments(), method=False) + ] + + ( + symbolic_inputs_varname, + symbolic_inputs_check, + ) = emit_has_symbolic_inputs(call_sig) + + if "inplace_view" in f.tags: + # See Note [Functionalization Pass - Inplace View Ops] for more details + return f""" + {dispatcher_sig.defn(name=wrapper_name(f.func), is_redispatching_fn=True)} {{ + if (!at::functionalization::impl::isFunctionalTensor({view_tensor_name})) {{ + // functionalization is re-entrant, but will no-op if it wasn't passed a FunctionalTensorWrapper. + {unwrap_tensor_args_str} + at::AutoDispatchSkipFunctionalize guard; + return at::_ops::{noop_api_name}::call({", ".join(view_redispatch_args)}); + }} + auto reapply_views = at::functionalization::impl::getFunctionalizationReapplyViewsTLS(); + auto inverse_return_mode = ( + reapply_views ? at::functionalization::InverseReturnMode::ViewOrScatterInverse + : at::functionalization::InverseReturnMode::NeverView + ); + {symbolic_inputs_check} + auto view_meta = {spec.new()}; + auto compute_reference_meta = + {view_tensor_name}.key_set().has_backend(c10::BackendComponent::XLABit) || + {view_tensor_name}.key_set().has_backend(c10::BackendComponent::LazyBit); + {return_type} reference_tensor_output; + if (compute_reference_meta && !disable_meta_reference()) {{ + {meta_conversion_str} + at::AutoDispatchSkipFunctionalize func_guard; + c10::impl::ExcludeDispatchKeyGuard guard(exclude_keys_for_meta_dispatch); + reference_tensor_output = at::_ops::{noop_api_name}::call({", ".join(meta_call_args)}); + }} + // This function adds the above view meta to the current tensor and replays them off the base, + // mutating the size/stride info of the current FunctionalTensorWrapper. + // Because of this, we need to make sure to run the reference shape function above, + // BEFORE doing this (otherwise we'll end up running the reference function using the wrong sizes/strides) + at::functionalization::impl::mutate_view_meta({view_tensor_name}, view_meta); + // See Note [Propagating strides in the functionalization pass] + // XLA/LTC don't implement the logic to propagate strides correctly, so we need to rely + // on a reference implementation here (instead of relying on the output from the forward lambda + // having the correct stride info) + if (compute_reference_meta && !disable_meta_reference()) {{ + at::functionalization::impl::set_sizes_strides_offset({view_tensor_name}, reference_tensor_output); + }} + return {view_tensor_name}; + }} +""" + + else: + return f""" + {dispatcher_sig.defn(name=wrapper_name(f.func), is_redispatching_fn=True)} {{ + {unwrap_tensor_args_str} + if (!at::functionalization::impl::isFunctionalTensor({view_tensor_name})) {{ + // functionalization is re-entrant, but will no-op if it wasn't passed a FunctionalTensorWrapper. + at::AutoDispatchSkipFunctionalize guard; + return at::_ops::{noop_api_name}::call({", ".join(view_redispatch_args)}); + }} + auto reapply_views = at::functionalization::impl::getFunctionalizationReapplyViewsTLS(); + auto inverse_return_mode = ( + reapply_views ? at::functionalization::InverseReturnMode::ViewOrScatterInverse + : at::functionalization::InverseReturnMode::NeverView + ); + auto compute_reference_meta = + {view_tensor_name}.key_set().has_backend(c10::BackendComponent::XLABit) || + {view_tensor_name}.key_set().has_backend(c10::BackendComponent::LazyBit); + {return_type} reference_tensor_output; + if (compute_reference_meta && !disable_meta_reference()) {{ + {meta_conversion_str} + at::AutoDispatchSkipFunctionalize func_guard; + c10::impl::ExcludeDispatchKeyGuard guard(exclude_keys_for_meta_dispatch); + reference_tensor_output = at::_ops::{noop_api_name}::call({", ".join(meta_call_args)}); + }} + {return_type} tmp_output; + {{ + at::AutoDispatchSkipFunctionalize guard; + if (reapply_views) {{ + tmp_output = at::_ops::{noop_api_name}::call({", ".join(view_redispatch_args)}); + }} else {{ + tmp_output = at::_ops::{api_name}::call({", ".join(view_redispatch_args)}); + }} + }} + {symbolic_inputs_check} + auto view_meta = {spec.new()}; + auto out = at::functionalization::impl::create_functional_tensor_with_view_meta(tmp_output, {view_tensor_name}, view_meta); + // See Note [Propagating strides in the functionalization pass] + if (compute_reference_meta && !disable_meta_reference()) {{ + at::functionalization::impl::set_sizes_strides_offset(out, reference_tensor_output); + }} + return out; + }} +""" + + +def maybe_create_output(f: NativeFunction, var_name: str) -> str: + if len(f.func.returns) == 0: + return "" + return_type = dispatcher.returns_type(f.func.returns).remove_const_ref().cpp_type() + return f"{return_type} {var_name} = " + + +# Given a NativeFunction, and a variable name corresponding to the output of redispatching on the function, +# this returns two lists of names, consisting of: +# - the names of returns corresponding to the original (mutable) inputs of the outer function +# - the names of returns corresponding to the (immutable) outputs of the inner redispatched function +def get_mutable_redispatch_return_names( + f: NativeFunction, inner_return_var: str +) -> tuple[list[str], list[str]]: + aliased_returns = [] + non_aliased_returns = [] + for i, name in enumerate(f.func.aliased_return_names()): + if name is not None: + aliased_returns.append(name) + else: + non_aliased_returns.append( + inner_return_var + if len(f.func.returns) == 1 + else f"std::get<{i}>({inner_return_var})" + ) + return aliased_returns, non_aliased_returns + + +# When functionalization "no-op's" and redispatches on a mutable operator, we need to take care so that: +# - For fresh outputs, we return the result of the redispatch (without wrapping outputs) +# - For outputs that were aliased to inputs, we return the inputs directly (since some of them might have been wrapped) +def return_from_mutable_noop_redispatch( + f: NativeFunction, inner_return_var: str +) -> str: + aliased, non_aliased = get_mutable_redispatch_return_names(f, inner_return_var) + # Just get all of the return names, and immediately return them + return return_str(f.func.returns, aliased + non_aliased) + + +def wrap_propagate_mutations_and_return( + f: NativeFunction, functional_op: NativeFunction, inner_return_var: str +) -> str: + mutable_arg_names = f.func.arguments.mutable_arg_names() + ( + aliased_outer_rets, + non_aliased_outer_rets, + ) = get_mutable_redispatch_return_names(f, inner_return_var) + _, non_aliased_inner_rets = get_mutable_redispatch_return_names( + functional_op, inner_return_var + ) + # The outer function may have a mix of aliased and non-aliased outputs, + # But the inner functional op that we're transforming to should only have non-aliased outputs + assert len(mutable_arg_names) + len(non_aliased_outer_rets) == len( + non_aliased_inner_rets + ) + + # First, take all of the newly created outputs from the inner call and wrap them into functional tensors + updates = [] + non_aliased_wrapped_ret_names = [] + for i, inner_ret in enumerate( + non_aliased_inner_rets[: len(non_aliased_outer_rets)] + ): + ret_name = f"output_{i}" + updates.append( + f"""\ + auto output_{i} = at::functionalization::impl::to_functional_tensor({inner_ret});""" + ) + non_aliased_wrapped_ret_names.append(ret_name) + + # Next, take all of the mutated outputs from the inner call corresponding to mutated inputs, + # and propagate the mutations + for outer_arg, inner_ret in zip( + mutable_arg_names, non_aliased_inner_rets[len(non_aliased_outer_rets) :] + ): + updates.append( + f"""\ + auto {outer_arg}_inner = at::functionalization::impl::from_functional_tensor({outer_arg}); + at::functionalization::impl::replace_({outer_arg}, {inner_ret}); + at::functionalization::impl::commit_update({outer_arg}); + at::functionalization::impl::sync({outer_arg}); + auto {outer_arg}_inner_updated = at::functionalization::impl::from_functional_tensor({outer_arg}); + at::functionalization::impl::propagate_xla_data_direct({outer_arg}_inner, {outer_arg}_inner_updated);""" + ) + + # Finally, we return: + # - Any mutable arguments that also returns + # - Any immutable returns that were created wrapping the output from the inner call + returns_str = return_str( + f.func.returns, aliased_outer_rets + non_aliased_wrapped_ret_names + ) + updates_str = "\n".join(updates) + return f"""\ +{updates_str} + {returns_str}""" + + +# Generates the Functionalization kernel for: +# - mutation ops (inplace and out= ops) +@with_native_function_and +def emit_inplace_functionalization_body( + f: NativeFunction, g: NativeFunctionsGroup +) -> str: + # mutation case + assert modifies_arguments(f) + + dispatcher_sig = DispatcherSignature.from_schema(f.func) + + unwrap_tensor_args_str, unwrapped_args_ctx = unwrap_tensor_args( + dispatcher_sig, is_view_op=False + ) + + mutated_names = [ + a.name + for a in f.func.arguments.flat_all + if a.type.is_tensor_like() and a.annotation is not None + ] + non_mutated_names = [ + a.name + for a in f.func.arguments.flat_all + if a.type.is_tensor_like() and a.annotation is None + ] + non_mutated_tensor_names = [ + a.name + for a in f.func.arguments.flat_all + if a.type == BaseType(BaseTy.Tensor) and a.annotation is None + ] + # all mutable inputs must be functional tensors in order to participate in functionalization + check_all_mutated_args_are_functional = " && ".join( + ["true"] + + [ + f"at::functionalization::impl::isFunctionalTensor({a})" + for a in mutated_names + ] + ) + check_any_non_mutated_args_are_functional = " || ".join( + ["false"] + + [ + f"at::functionalization::impl::isFunctionalTensor({a})" + for a in non_mutated_names + ] + ) + + check_any_non_mutated_tensors_are_xla = " || ".join( + ["false"] + + [ + f"{a}.device().type() == c10::DeviceType::XLA" + for a in non_mutated_tensor_names + ] + ) + # These are used in the cases where we don't functionalize and redispatch to the inplace op + # case 1: we hit an inplace op that doesn't have an out-of-place equivalent + # case 2: we hit an inplace ops but our inputs are not functional tensors (in which case our kernel just no-ops) + inplace_exprs = [ + e.expr + for e in translate(unwrapped_args_ctx, dispatcher_sig.arguments(), method=False) + ] + + # call the out-of-place variant of the op + return_type = ( + dispatcher.returns_type(g.functional.func.returns).remove_const_ref().cpp_type() + ) + functional_sig = DispatcherSignature.from_schema(g.functional.func) + functional_exprs = [ + e.expr + for e in translate(unwrapped_args_ctx, functional_sig.arguments(), method=False) + ] + + meta_conversion_str, meta_call_ctx = convert_to_meta_tensors(dispatcher_sig) + # We don't want to run the inplace meta func for ops like .set_(), because: + # (1) they're unnecessary: inplace meta checks are only useful for ops like add_(), + # where broadcasting will work for the out-of-place case but should fail on the inplace call + # (2) They'll also fail without adding extra infra: we'd need to convert the input storage argument + # into a meta storage + any_storage_args = any( + a.type == BaseType(BaseTy.Storage) for a in f.func.arguments.flat_all + ) + + return f""" + {dispatcher_sig.defn(name=wrapper_name(f.func), is_redispatching_fn=True)} {{ + if ({str(not any_storage_args and f.func.kind() == SchemaKind.inplace).lower()} && !disable_meta_reference()) {{ + // Before converting the mutable op to its functional variant, run meta tensors through the original op. + // This will help us catch shape errors that apply to inplace ops that wouldn't apply to their functional variants. + // (We can only do this for inplace ops today though, because they technically all support meta tensors). + {meta_conversion_str} + at::AutoDispatchSkipFunctionalize func_guard; + c10::impl::ExcludeDispatchKeyGuard guard(exclude_keys_for_meta_dispatch); + at::_ops::{f.func.name.unambiguous_name()}::call({", ".join(a.name for a in meta_call_ctx)}); + }} + {unwrap_tensor_args_str} + if (!({check_all_mutated_args_are_functional})) {{ + // We want to disable this check if there are any XLA tensors. + // cpu_tensor.copy_(xla_tensor) is valid code. + if (!({check_any_non_mutated_tensors_are_xla}) && ({check_any_non_mutated_args_are_functional})) {{ + // case 1: trying to mutate a non functional tensor with a functional tensor is an error + TORCH_INTERNAL_ASSERT(false, + "mutating a non-functional tensor with a functional tensor is not allowed.", + " Please ensure that all of your inputs are wrapped inside of a functionalize() call."); + }} else {{ + // case 2: arguments are not functional tensors, so we no-op and redispatch. + at::AutoDispatchSkipFunctionalize guard; + {maybe_create_output(f, "tmp_output")}at::_ops::{f.func.name.unambiguous_name()}::call({", ".join(inplace_exprs)}); + {return_from_mutable_noop_redispatch(f, "tmp_output")} + }} + }} else {{ + {return_type} tmp_output; + {{ + at::AutoDispatchSkipFunctionalize guard; + tmp_output = at::_ops::{g.functional.func.name.unambiguous_name()}::call({", ".join(functional_exprs)}); + }} + {wrap_propagate_mutations_and_return(f, g.functional, "tmp_output")} + }} + }}""" + + +# The below functions generate RegisterFunctionalization.cpp +# These files provide the kernels that run the functionalization pass, which can be opted into +# per backend (e.g. XLA or Vulkan), or as a composable transform (functionalize() in functorch). + + +# See Note [Functionalization Pass: View Inverses]. +def gen_functionalization_view_inverse_declaration( + selector: SelectiveBuilder, g: NativeFunctionsViewGroup +) -> str | None: + # For every (non-composite) view op, we need a corresponding "inverse view" function. + # This generates the declarations so we get a good compiler error when someone adds a new view. + @with_native_function + def emit_decl_helper(g: NativeFunctionsViewGroup) -> str | None: + if g.view.has_composite_implicit_autograd_kernel: + return None + view_inverse_sig = ViewInverseSignature(g) + return view_inverse_sig.decl() + + return emit_decl_helper(g) + + +# Helper class for generating `ViewMeta` specializations. +@dataclass +class ViewMetaSpecialization: + g: NativeFunctionsViewGroup + f: NativeFunction + + @property + def is_multi_output(self) -> bool: + return functionalization.is_multi_output(self.f.func) + + @property + def is_as_strided(self) -> bool: + return str(self.f.func.name) == "as_strided" + + @property + def out_index(self) -> str: + if self.is_multi_output: + return functionalization.out_index_binding.name + return "0" + + @property + def classname(self) -> str: + return functionalization.classname(self.f.func) + + def decl(self) -> list[str]: + base_ctor_arguments = functionalization.base_ctor_arguments(self.f.func) + extra_ctor_arguments = functionalization.extra_ctor_arguments(self.f.func) + attributes = functionalization.attributes(self.f.func) + + # List of types for declaring the `SerializableTuple` type. + serializable_tuple_args = ",\n".join( + f" {binding.type} /* {binding.name} */" + for binding in (base_ctor_arguments + attributes) + ) + + # Arguments used for forwarding the tuple elements to the constructor. + destructure_tuple_args = ", ".join( + f"std::get<{i}>(tpl)" + for i in range(len(base_ctor_arguments) + len(extra_ctor_arguments)) + ) + + # List of constructor parameters + ctor_parameters = ", ".join( + binding.decl() for binding in (base_ctor_arguments + extra_ctor_arguments) + ) + + # Call the base class `ViewMeta` constructor. + # + # Both of `is_multi_output` and `is_as_strided` are known values, given the + # operation schema. + is_multi_output_str = str(self.is_multi_output).lower() + is_as_strided_str = str(self.is_as_strided).lower() + + base_ctor_bindings = ", ".join( + [ + # `has_symbolic_inputs` is always taken as parameter. + functionalization.has_symbolic_inputs_binding.name, + f"/*is_multi_output=*/{is_multi_output_str}", + f"/*is_as_strided=*/{is_as_strided_str}", + # `out_index` is know if the operation returns only one value. Otherwise, + # we also take it as parameter. + f"/*out_index=*/{self.out_index}", + ] + ) + + # Assignments of `extra_ctor_arguments` to their corresponding fields. + # These are extra fields to-be-declared in this specialization. + # + # We need to set `allow_expensive_conversions`, since we are storing owned versions + # of the non-owning arguments. + ctor_assignments = ",\n".join( + f" {e.type.name}({e.expr})" + for e in translate( + extra_ctor_arguments, + attributes, + method=False, + allow_expensive_conversions=True, + ) + ) + + # List of arguments for constructing the `SerializableTuple` from an instance. + tuple_arguments = ", ".join( + binding.name for binding in (base_ctor_arguments + attributes) + ) + + # List of field declarations. + attr_declarations = "\n".join(f" {binding.decl()};" for binding in attributes) + + # Override `to_out_index` if this operation returns more than 1 value. + to_out_index_decl = "" + if self.is_multi_output: + to_out_index_decl = ( + " std::shared_ptr to_out_index(int64_t out_idx) override;" + ) + + return [ + f""" +struct TORCH_API {self.classname} : public ViewMeta {{ + FUNCTIONALIZATION_VIEWMETA_NAME({self.classname}) + FUNCTIONALIZATION_VIEWMETA_SERIALIZABLE_TUPLE(\n{serializable_tuple_args}); + + {self.classname}(const SerializableTuple& tpl) + : {self.classname}({destructure_tuple_args}) {{}} + + {self.classname}({ctor_parameters}) + : at::functionalization::ViewMeta({base_ctor_bindings}), +{ctor_assignments} {{}} + + Tensor forward(const Tensor& base) override; + Tensor reverse(const Tensor& base, const Tensor& mutated_view) override; +{to_out_index_decl} + + SerializableTuple to_serializable_tuple() {{ + return std::make_tuple({tuple_arguments}); + }} + +{attr_declarations} +}}; +""" + ] + + # Generate a call to the actual operation. + def opcall(self, is_reverse: bool, reapply_views: bool) -> str: + opname = functionalization.name( + self.g, + is_reverse=is_reverse, + include_namespace=True, + reapply_views=reapply_views, + ) + + # Expected arguments for the operation. + assert self.g.view_copy is not None + op_arguments = functionalization.op_arguments(self.g.view_copy.func, is_reverse) + + # The context is composed by the constructor arguments (which are also + # the field variables stored in the instance), and the `base` tensor. + context = [functionalization.base_binding] + context += functionalization.base_ctor_arguments(self.f.func) + context += functionalization.attributes(self.f.func) + + # If we are generating the call for the reverse function, we also have + # access to `mutated_view` argument. + if is_reverse: + context.append(functionalization.mutated_view_binding) + + arguments = ", ".join( + [e.expr for e in translate(context, op_arguments, method=False)] + ) + + # Index the result if this operation returns multiple values. + maybe_index = "" + if not is_reverse and self.is_multi_output: + maybe_index = f"[{self.out_index}]" + + return f"{opname}({arguments}){maybe_index}" + + def impl(self) -> list[str]: + functions = [ + f""" +at::Tensor {self.classname}::forward(const at::Tensor& base) {{ + if (reapply_views) {{ + return {self.opcall(is_reverse=False, reapply_views=True)}; + }} else {{ + return {self.opcall(is_reverse=False, reapply_views=False)}; + }} +}}""", + f""" +at::Tensor {self.classname}::reverse(const at::Tensor& base, const Tensor& mutated_view) {{ + return {self.opcall(is_reverse=True, reapply_views=True)}; +}}""", + ] + + # If this operation returns multiple values, also generate a `to_out_index` + # implementation. + if self.is_multi_output: + functions.append(f""" +std::shared_ptr {self.classname}::to_out_index(int64_t out_index) {{ + return {self.new("out_index")}; +}} +""") + + return functions + + # Create the Python binding for this specialized class. + def binding(self) -> list[str]: + name = functionalization.classname(self.f.func, with_namespace=True) + return [f" create_binding_with_pickle<{name}>(functionalization);"] + + # Generate an instantiation of this specialized class. + def new(self, out_index: str = "0") -> str: + name = functionalization.classname(self.f.func, with_namespace=True) + ctor_arguments = functionalization.base_ctor_arguments( + self.f.func + ) + functionalization.extra_ctor_arguments(self.f.func) + # Replace the `out_index` parameter with the given `out_index`. + arguments = ", ".join( + binding.name if binding.name != "out_index" else out_index + for binding in ctor_arguments + ) + return f"std::make_shared<{name}>({arguments})" + + # Run the function `run` for both: `view` and `view_inplace` functions. + @staticmethod + def map( + g: NativeFunctionsViewGroup, run: Callable[[ViewMetaSpecialization], list[str]] + ) -> list[str]: + def maybe_run(f: NativeFunction | None) -> list[str]: + if f is None: + return [] + with native_function_manager(f): + return run(ViewMetaSpecialization(g, f)) + + return list(concatMap(maybe_run, (g.view, g.view_inplace))) + + +def gen_functionalization_view_meta_classes_base( + selector: SelectiveBuilder, + g: NativeFunctionsViewGroup, + run: Callable[[ViewMetaSpecialization], list[str]], +) -> list[str]: + if not selector.include_all_operators: + return [] + + if g.composite: + return [] + + return ViewMetaSpecialization.map(g, run) + + +def gen_functionalization_view_meta_classes_decl( + selector: SelectiveBuilder, g: NativeFunctionsViewGroup +) -> list[str]: + return gen_functionalization_view_meta_classes_base( + selector, g, ViewMetaSpecialization.decl + ) + + +def gen_functionalization_view_meta_classes_impl( + selector: SelectiveBuilder, g: NativeFunctionsViewGroup +) -> list[str]: + return gen_functionalization_view_meta_classes_base( + selector, g, ViewMetaSpecialization.impl + ) + + +def gen_functionalization_view_meta_classes_binding( + selector: SelectiveBuilder, g: NativeFunctionsViewGroup +) -> list[str]: + return gen_functionalization_view_meta_classes_base( + selector, g, ViewMetaSpecialization.binding + ) + + +# Generates the Python bindings for the `ViewMeta` specialized classes. +def gen_functionalization_view_meta_classes( + native_functions_path: str, + tags_path: str, + selector: SelectiveBuilder, + install_dir: str, + template_dir: str, +) -> None: + from torchgen.gen import get_grouped_by_view_native_functions, parse_native_yaml + + # Parse the native_functions.yaml. + # Then, group them into `NativeFunctionsViewGroup`. + # + # This is the same steps we do in gen.py (ATen codegen). + native_functions = parse_native_yaml( + native_functions_path, tags_path + ).native_functions + native_functions_with_view_groups = get_grouped_by_view_native_functions( + native_functions + ) + view_groups = [ + g + for g in native_functions_with_view_groups + if isinstance(g, NativeFunctionsViewGroup) + ] + + fm = FileManager(install_dir=install_dir, template_dir=template_dir, dry_run=False) + fm.write( + "ViewMetaClassesPythonBinding.cpp", + lambda: { + "view_meta_bindings": list( + concatMap( + lambda g: gen_functionalization_view_meta_classes_binding( + selector, g + ), + view_groups, + ) + ), + }, + ) + + +def gen_functionalization_registration( + selector: SelectiveBuilder, + g: NativeFunction | NativeFunctionsGroup | NativeFunctionsViewGroup, + composite_implicit_autograd_index: BackendIndex, +) -> list[str]: + @with_native_function + def emit_registration_helper(f: NativeFunction) -> str: + if f.has_composite_implicit_autograd_kernel: + metadata = composite_implicit_autograd_index.get_kernel(f) + assert metadata is not None + native_api_name = metadata.kernel + sig = NativeSignature(f.func, symint=metadata.supports_symint()) + # Note [Composite view ops in the functionalization pass] + # We don't need to worry about implemententing functionalization kernels for views with + # CompositeImplicitAutograd kernels, because we can just decompose them into their base operators. + # We can't just opt the entire Functionalization dispatch key into the composite keyset though, + # because we don't want to decompose non-view ops that are composite, like `at::ones`. + registration_str = ( + f"static_cast<{sig.ptr_type()}>(at::native::{native_api_name})" + ) + else: + # non-composite view ops (and inplace ops) get a normal registration. + registration_str = f"TORCH_FN(functionalization::{wrapper_name(f.func)})" + return f'm.impl("{f.func.name}", {registration_str});' + + # Don't generate kernels in mobile build + if not selector.include_all_operators: + return [] + + if isinstance(g, NativeFunctionsViewGroup): + # functionalization needs to register kernels for view + view_inplace ops + # See Note [Functionalization <> torch.Tensor constructor] + if str(g.view.func.name) == "lift_fresh": + return [] + view_str = [] + view_str.append(emit_registration_helper(g.view)) + if g.view_inplace is not None: + assert g.view_inplace.is_view_op + view_str.append(emit_registration_helper(g.view_inplace)) + return view_str + + elif isinstance(g, NativeFunctionsGroup): + # Gets a hand-written functionalization kernel + if g.inplace is not None and str(g.inplace.func.name) == "set_.source_Tensor": + fns = [] + else: + fns = list(g.functions()) + else: + if str(g.func.name) in MUTABLE_OPS_NOT_USING_FUNCTIONALIZATION: + return [] + fns = [g] + + registrations = [] + for f in fns: + if f.has_composite_implicit_autograd_kernel: + continue + if str(f.func.name) == "lift": + # See Note [Functionalization <> torch.Tensor constructor] + return [] + if str(f.func.name) == "resize_": + # See Note [resize_ in Functionalization] + return [] + if str(f.func.name.name) != "set_": + assert not f.is_view_op + # functionalization needs to generate and register kernels for inplace ops. + # We *also* need to directly register CompositeImplicitAUtograd kernels + # so that they decompose properly before functioanlization. + if modifies_arguments(f): + registrations.append(emit_registration_helper(f)) + return registrations + + +def gen_functionalization_definition( + selector: SelectiveBuilder, + # Note: Ideally this code should never have to look at NativeFunction + # (and instead only need to operate on grouped NativeFunctions). + # The only reason currently is because we need to emit direct dispatch registrations + # For CompositeImplicitAutograd operators, which are potentially ungrouped. + g: NativeFunction | NativeFunctionsGroup | NativeFunctionsViewGroup, +) -> list[str]: + # Don't generate kernels in mobile build + if not selector.include_all_operators: + return [] + + if isinstance(g, NativeFunctionsViewGroup): + # Case 1: emit view -> view_copy kernels for the functionalization pass + view_defs = [] + if not g.composite: + # invariant: NativeFunctionsViewGroup's always have a view_copy operator + # if the view is not composite (implicit autograd) + assert g.view_copy is not None, dataclass_repr(g, indent=1) + view_defs.append(emit_view_functionalization_body(g, view_inplace=False)) + if g.view_inplace is not None: + view_defs.append(emit_view_functionalization_body(g, view_inplace=True)) + return view_defs + elif isinstance(g, NativeFunction): + # Invariant: all mutable operators that we need to handle in functionalization + # should have been properly grouped up. + # TODO: The below ops all have "problematic" schemas that prevent them from + # getting functionalized. Instead of bending over backwards to get things to work, + # I think we should either: + # (1) fix their schemas (BC-breaking) + # (2) hand-write their functionalization kernels + if ( + str(g.func.name) not in MUTABLE_OPS_NOT_USING_FUNCTIONALIZATION + and str(g.func.name.name) not in MUTABLE_OPS_NOT_USING_FUNCTIONALIZATION + ): + assert g.has_composite_implicit_autograd_kernel or not modifies_arguments(g) + return [] + else: + # Case 2: emit inplace -> out-of-place kernels for the functionalization pass + mutation_defs = [] + mutation_defs.append(emit_inplace_functionalization_body(g.out, g)) + if g.inplace is not None: + mutation_defs.append(emit_inplace_functionalization_body(g.inplace, g)) + if g.mutable is not None: + mutation_defs.append(emit_inplace_functionalization_body(g.mutable, g)) + return mutation_defs + return [] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_lazy_tensor.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_lazy_tensor.py new file mode 100644 index 0000000000000000000000000000000000000000..89b065e705ca50cd07dcb7e21f862ca9ae2b3829 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_lazy_tensor.py @@ -0,0 +1,585 @@ +from __future__ import annotations + +import argparse +import os +from collections import namedtuple +from pathlib import Path +from typing import Any, TYPE_CHECKING + +import yaml + +import torchgen.dest as dest +from torchgen.api.lazy import setValueT +from torchgen.api.types import BaseCppType +from torchgen.dest.lazy_ir import GenLazyIR, GenLazyNativeFuncDefinition, GenTSLazyIR +from torchgen.gen import get_grouped_native_functions, parse_native_yaml +from torchgen.gen_backend_stubs import ( + error_on_missing_kernels, + gen_dispatcher_registrations, + gen_dispatchkey_nativefunc_headers, + parse_backend_yaml, +) +from torchgen.model import NativeFunction, NativeFunctionsGroup, OperatorName +from torchgen.selective_build.selector import SelectiveBuilder +from torchgen.utils import FileManager, NamespaceHelper +from torchgen.yaml_utils import YamlLoader + + +if TYPE_CHECKING: + from collections.abc import Callable, Iterable, Iterator, Sequence + + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # +# +# Lazy Tensor Codegen +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # +# Overview +# ~~~~~~~~ +# +# This codegen script builds on existing data models and helpers used +# by all ATen backends, and adds new functionality specific to lazy +# tensor backends. +# +# Inputs: +# - _native_functions.yaml: controls which operators are +# supported by the backend. +# +# Outputs: +# (for all backends) +# Ir.h defines Lazy IR classes to be constructed during tracing +# - opt-in: also generate 'lowering' methods for the TorchScript backend only +# NativeFunctions.cpp defines implementations of native functions which perform lazy tracing +# - opt-in: 'full_codegen' section of backend yaml; 'supported' section omits these implementations +# NativeFunctions.h declares implementations of native functions for both 'supported' and 'full_codegen' +# ops +# +# Register.cpp registers all op implementations with the dispatcher +# RegisterAutograd.cpp registers all autograd implementations with the dispatcher +# +# Validation Helpers: +# - Shape Inference: errs if any ops in backend yaml require shape inference not provided by meta kernels or +# implementations in torch/csrc/lazy/core/shape_inference.* +# - native function impls: errs if any 'supported' ops do not have an implementation defined in the backend +# (non-codegen) implementation file +# +# +# About the Data Model +# ~~~~~~~~~~~~~~~~~~~~ +# +# Modeled after ATen codegen, the first step is to parse yaml and build a data model for the operators +# we care about. In this case, the _native_functions yaml defines a subset of the core operators +# (defined in more detail in the main native_functions.yaml), which will be supported by your backend. +# Backends can list ops in two categories: +# - `supported` ops require hand-implementations but still get codegenned declarations and registrations +# - `full_codegen` ops get implementations (and IR classes) generated too +# +# Each native function is modeled as an object with a schema, and each schema has objects representing their +# arguments. Much of the codegen is manipulation of the arguments and their types. For example, lazy tensor +# backends need to transform 'at::Tensor' arguments into 'lazy::Value' objects, as well as replacing reference +# types (stringref) with actual string objects, and this is done by manipulating the data model objects. +# - see api/lazy.py for the lazy data model +# +# Once the data model is set up, the rest of this script processes a number of templates for output CPP file +# and fills in the template values using helpers in `dest/lazy_ir.py` and `dest/lazy_ts_lowering.py`. These +# helpers mostly iterate over functions and their arguments, outputting different c++ snippets. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # + + +# Parses the external backend's yaml, and adds a new BackendIndex for the backend's dispatch key. +# Returns a Tuple of (backend_key, autograd_key, cpp_namespace, updated BackendIndex mapping, full_codegen) +ParsedExternalYaml = namedtuple( + "ParsedExternalYaml", + ["backend_key", "autograd_key", "cpp_namespace", "backend_indices", "full_codegen"], +) + + +def parse_native_functions_keys( + backend_yaml_path: str, + grouped_native_functions: Sequence[NativeFunction | NativeFunctionsGroup], +) -> tuple[list[OperatorName], list[Any], list[OperatorName]]: + with open(backend_yaml_path) as f: + yaml_values = yaml.load(f, Loader=YamlLoader) + assert isinstance(yaml_values, dict) + + full_codegen = yaml_values.pop("full_codegen", []) + non_native = yaml_values.pop("non_native", []) + ir_gen = yaml_values.pop("ir_gen", []) + assert isinstance(full_codegen, list) + assert isinstance(non_native, list) + assert isinstance(ir_gen, list) + full_codegen_opnames = [OperatorName.parse(name) for name in full_codegen] + ir_gen_opnames = [OperatorName.parse(name) for name in ir_gen] + return full_codegen_opnames, non_native, ir_gen_opnames + + +def validate_shape_inference_header( + shape_inference_hdr: str, expected_shape_infr_decls: list[str] +) -> None: + try: + with open(shape_inference_hdr) as f: + shape_infr_decls = f.read() + shape_infr_decl_lines = set(shape_infr_decls.split("\n")) + except OSError as e: + raise AssertionError( + f"Unable to read from the specified shape_inference_hdr file: {shape_inference_hdr}" + ) from e + + # TODO(whc) add a check for shape inference functions that have meta kernels implement and should be retired. + + missing_decls = [ + decl for decl in expected_shape_infr_decls if decl not in shape_infr_decl_lines + ] + if missing_decls: + raise Exception( # noqa: TRY002 + f"""Missing shape inference function.\n +Please add declare this function in {shape_inference_hdr}:\n +and implement it in the corresponding shape_inference.cpp file.\n +{os.linesep.join(missing_decls)}""" + ) + + +# Some helper functions for the codegen. +def get_ltc_helper_fns() -> str: + return """\ +at::Tensor to_meta(const at::Tensor& tensor) { + // undefined tensors can't be converted to the meta device, since they don't have sizes/strides + if (!tensor.defined()) return tensor; + auto out = at::native::empty_strided_meta_symint(tensor.sym_sizes(), tensor.sym_strides(), \ +/*dtype=*/tensor.scalar_type(), /*layout=*/tensor.layout(), \ +/*device=*/c10::Device(c10::kMeta), /*pin_memory=*/std::nullopt); + // needs to handle wrapped numbers, so dtype promotion works properly. + if (tensor.unsafeGetTensorImpl()->is_wrapped_number()) { + out.unsafeGetTensorImpl()->set_wrapped_number(true); + } + return out; +} +std::optional to_meta(const std::optional& tensor) { + if (tensor.has_value()) { + return to_meta(*tensor); + } + return std::nullopt; +} + +std::vector to_meta(at::ITensorListRef t_list) { + std::vector outs; + outs.reserve(t_list.size()); + for (const auto& tensor : t_list) { + outs.push_back(to_meta(tensor)); + } + return outs; +} +""" + + +class default_args: + node_base: str = "Node" + node_base_hdr: str | None = None + shape_inference_hdr: str = "torch/csrc/lazy/core/shape_inference.h" + tensor_class: str = "torch::lazy::LazyTensor" + tensor_class_hdr: str = "torch/csrc/lazy/core/tensor.h" + lazy_ir_generator: type[GenLazyIR] = GenLazyIR + native_func_definition_generator: type[GenLazyNativeFuncDefinition] = ( + GenLazyNativeFuncDefinition + ) + backend_name: str = "TorchScript" + + +def main() -> None: + parser = argparse.ArgumentParser(description="Generate Lazy Tensor backend files") + parser.add_argument( + "-s", + "--source-yaml", + "--source_yaml", + help="path to source yaml file containing operator external definitions", + ) + parser.add_argument("-o", "--output-dir", "--output_dir", help="output directory") + parser.add_argument( + "--dry-run", "--dry_run", type=bool, default=False, help="output directory" + ) + parser.add_argument( + "--impl-path", + "--impl_path", + type=str, + default=None, + help="path to the source C++ file containing kernel definitions", + ) + parser.add_argument( + "--gen-ts-lowerings", + "--gen_ts_lowerings", + action="store_true", + help="Generate TorchScript lowerings in addition to Lazy IR and NativeFunctions", + ) + parser.add_argument( + "--node-base", + "--node_base", + type=str, + default=default_args.node_base, + help="Name of backend specific custom Lazy IR Node base class", + ) + parser.add_argument( + "--node-base-hdr", + "--node_base_hdr", + type=str, + default=default_args.node_base_hdr, + help="Path to header file defining custom Lazy IR Node base class", + ) + parser.add_argument( + "--shape-inference-hdr", + "--shape_inference_hdr", + type=str, + default=default_args.shape_inference_hdr, + help="Path to header file defining custom Lazy shape inference functions", + ) + parser.add_argument( + "--tensor-class", + "--tensor_class", + type=str, + default=default_args.tensor_class, + help="Name of backend specific custom Lazy Tensor class", + ) + parser.add_argument( + "--tensor-class-hdr", + "--tensor_class_hdr", + type=str, + default=default_args.tensor_class_hdr, + help="Path to header file defining custom Lazy Tensor class", + ) + parser.add_argument( + "--backend-name", + "--backend_name", + type=str, + default=default_args.backend_name, + help="Name of the backend to generate", + ) + options = parser.parse_args() + + # Assumes that this file lives at PYTORCH_ROOT/torchgen/gen_backend_stubs.py + torch_root = Path(__file__).absolute().parents[2] + aten_path = str(torch_root / "aten" / "src" / "ATen") + lazy_ir_generator: type[GenLazyIR] = default_args.lazy_ir_generator + if options.gen_ts_lowerings: + lazy_ir_generator = GenTSLazyIR + native_func_definition_generator: type[GenLazyNativeFuncDefinition] = ( + default_args.native_func_definition_generator + ) + + run_gen_lazy_tensor( + aten_path, + options.source_yaml, + options.output_dir, + options.dry_run, + options.impl_path, + options.node_base, + options.node_base_hdr, + options.tensor_class, + options.tensor_class_hdr, + options.shape_inference_hdr, + lazy_ir_generator, + native_func_definition_generator, + options.backend_name, + ) + + +def run_gen_lazy_tensor( + aten_path: str, + source_yaml: str, + output_dir: str, + dry_run: bool, + impl_path: str | None, + node_base: str = default_args.node_base, + node_base_hdr: str | None = default_args.node_base_hdr, + tensor_class: str = default_args.tensor_class, + tensor_class_hdr: str = default_args.tensor_class_hdr, + shape_inference_hdr: str = default_args.shape_inference_hdr, + lazy_ir_generator: type[GenLazyIR] = default_args.lazy_ir_generator, + native_func_definition_generator: type[ + GenLazyNativeFuncDefinition + ] = default_args.native_func_definition_generator, + # build_in_tree is true for TS backend and affects include paths + build_in_tree: bool = False, + # per_operator_headers changes whether ATen/Functions.h or individual operator headers are used + # it must match how ATen was built + per_operator_headers: bool = False, + backend_name: str = default_args.backend_name, + gen_forced_fallback_code: bool = False, + use_lazy_shape: bool = True, + # the following arguments are temporary customization points for xla backend migration. + # do not rely on them otherwise, they should be removed once migration is complete + backend_namespace: str = "torch::lazy", + get_tensorlist: str = "GetTensorList", + get_tensor_or_wrap_number: str = "GetLtcTensorOrCreateForWrappedNumber", + try_get_tensor: str = "TryGetLtcTensor", + metrics_counter: str = 'TORCH_LAZY_FN_COUNTER("lazy::")', + create_tensor: str = "LazyTensor::Create", + create_from_first_tensor: bool = False, + create_aten_from_ltc_tensor: str = "torch::lazy::CreateAtenFromLtcTensor", + tuple_aten_from_ltc_tensors: str = "torch::lazy::TupleAtenFromLtcTensors", + lazy_value_class: str = "torch::lazy::Value", + lazy_tensor_ptr: str = "LazyTensorPtr", + get_device_fn: str = "torch::lazy::GetBackendDevice", +) -> None: + lv_tokens = lazy_value_class.split("::") + lv_class = lv_tokens[-1] + lv_ns = "::".join(lv_tokens[:-1]) + setValueT(BaseCppType(lv_ns, lv_class)) + template_dir = os.path.join(aten_path, "templates") + + def make_file_manager(install_dir: str) -> FileManager: + return FileManager( + install_dir=install_dir, template_dir=template_dir, dry_run=dry_run + ) + + fm = make_file_manager(output_dir) + + native_yaml_path = os.path.join(aten_path, "native/native_functions.yaml") + tags_yaml_path = os.path.join(aten_path, "native/tags.yaml") + parsed_yaml = parse_native_yaml(native_yaml_path, tags_yaml_path) + native_functions, backend_indices = ( + parsed_yaml.native_functions, + parsed_yaml.backend_indices, + ) + grouped_native_functions = get_grouped_native_functions(native_functions) + + def sort_native_function(f: NativeFunctionsGroup | NativeFunction) -> str: + """ + We sort the native function because of the note in concat_map_codegen. + TODO(alanwaketan): Remove this sorting hack once all ops are grouped properly. + """ + func = f.functional.func if isinstance(f, NativeFunctionsGroup) else f.func + return str(func.name.name) + + grouped_native_functions = sorted( + grouped_native_functions, key=sort_native_function + ) + + parsed_backend_yaml = parse_backend_yaml( + source_yaml, grouped_native_functions, backend_indices + ) + backend_key = parsed_backend_yaml.backend_key + autograd_key = parsed_backend_yaml.autograd_key + cpp_namespace = parsed_backend_yaml.cpp_namespace + backend_indices = parsed_backend_yaml.backend_indices + # the following 3 keys are all processed differently + # for full_codegen, we generate IR, kernels, etc + # for ir_gen, we generate only IR + # non_native is used to register kernels not declared in + # native_functions.yaml + full_codegen, non_native, ir_gen = parse_native_functions_keys( + source_yaml, grouped_native_functions + ) + + def concat_map_codegen( + func: Callable[[NativeFunction], Sequence[str]], + xs: Iterable[NativeFunctionsGroup | NativeFunction], + ops_list: list[OperatorName] = full_codegen, + ) -> Iterator[str]: + """ + We code-gen for the functional variant, which is all we need for IR classes/lowerings/shape inferences, but we + only code-gen additional entries for the inplace variant for the native functions. + """ + + for x in xs: + fs = list(x.functions()) if isinstance(x, NativeFunctionsGroup) else [x] + for f in fs: + if f.func.name in ops_list: + yield from func(f) + + selector = SelectiveBuilder.get_nop_selector() + + assert backend_key is not None + class_name = backend_indices[backend_key].native_function_class_name() + + if impl_path is not None: + error_on_missing_kernels( + native_functions, + backend_indices, + backend_key, + autograd_key, + class_name, + impl_path, + full_codegen, + ) + + """ Validate Shape Inference Definitions + + Generated lazy native functions all perform shape inference, by first using a meta:: kernel + if available for that op, and otherwise using a 'compute_shape_{op}' function instead. The generator + knows the call signature for compute_shape_{op} because it matches the nativefunction (and meta::) signature, + so it just has to check whether the op is structured and generate a call for one or the other. It's up to the dev + to supply the missing compute_shape_{op} function, but the codegen at least warns you about this and provides + the expected signature which can be copy-pasted into shape_inference.h. + + compute_shape_{op} functions are handwritten and should be replaced over time as ops get ported + to structured kernels. + + See torch/csrc/lazy/core/shape_inference.cpp #READ THIS! for more information. + """ + if shape_inference_hdr is not None: + expected_shape_infr_decls = list( + concat_map_codegen( + dest.GenLazyShapeInferenceDefinition( + backend_indices[backend_key], tensor_class + ), + grouped_native_functions, + ) + ) + + validate_shape_inference_header(shape_inference_hdr, expected_shape_infr_decls) + assert class_name is not None + + # Generate nativefunction declarations + # Note, eager registrations is set to False for the lazy TS backend as another LTC backend + # may want to register their own lazy kernels instead of registering the TS ones. + # The registration will lazily happen when init_ts_backend is called. + gen_dispatchkey_nativefunc_headers( + fm, + class_name, + cpp_namespace, + backend_indices, + grouped_native_functions, + backend_key, + autograd_key, + backend_name, + ) + + # Generate Dispatcher registrations which hook up the nativefunctions + for dispatch_key in ( + [backend_key] if autograd_key is None else [backend_key, autograd_key] + ): + gen_dispatcher_registrations( + fm, + output_dir, + class_name, + backend_indices, + grouped_native_functions, + backend_key, + dispatch_key, + selector, + build_in_tree=build_in_tree, + per_operator_headers=per_operator_headers, + backend_name=backend_name, + eager_registration=False, + ) + + # Generate native function impls that build IR nodes + ns_helper = NamespaceHelper(cpp_namespace) + fm.write_with_template( + f"{backend_key}NativeFunctions.cpp", + "DispatchKeyNativeFunctions.cpp", + lambda: { + "includes": [ + f"#include <{path}>" + for path in [ + tensor_class_hdr, + shape_inference_hdr, + "ATen/Functions.h", + "ATen/native/TensorConversions.h", + "ATen/NativeFunctions.h", + "ATen/CompositeExplicitAutogradNonFunctionalFunctions.h", + "ATen/MetaFunctions.h", + "ATen/Operators.h", + "ATen/native/CPUFallback.h", + "torch/csrc/lazy/core/ir_builder.h", + "torch/csrc/lazy/core/lazy_graph_executor.h", + "torch/csrc/lazy/core/metrics.h", + "torch/csrc/lazy/core/shape.h", + f"{output_dir}/{backend_key}NativeFunctions.h", + f"{output_dir}/LazyIr.h", + ] + + ( + ["torch/csrc/lazy/ts_backend/ts_eager_fallback.h"] + if gen_forced_fallback_code + else [] + ) + ], + "helper_fns": get_ltc_helper_fns(), + "native_functions_include": "", + "namespace_prologue": ns_helper.prologue, + "namespace_epilogue": ns_helper.epilogue, + "native_function_definitions": list( + concat_map_codegen( + native_func_definition_generator( + f"{backend_key}NativeFunctions", + backend_indices[backend_key], + tensor_class, + gen_forced_fallback_code, + backend_namespace, + get_tensorlist, + get_tensor_or_wrap_number, + try_get_tensor, + metrics_counter, + create_tensor, + create_from_first_tensor, + create_aten_from_ltc_tensor, + tuple_aten_from_ltc_tensors, + lazy_tensor_ptr, + get_device_fn, + ), + grouped_native_functions, + ) + ), + }, + ) + # Generate IR node classes + lazy_ir_obj = lazy_ir_generator( + backend_indices[backend_key], backend_name, node_base, use_lazy_shape + ) + + fm.write_with_template( + "LazyIr.h", + "LazyIr.h", + lambda: { + "lazy_ir_sysinc": [ + f"#include <{path}>" + for path in [ + "ATen/core/Formatting.h", + "c10/core/ScalarType.h", + "torch/csrc/lazy/core/hash.h", + "torch/csrc/lazy/core/ir.h", + "torch/csrc/lazy/core/shape.h", + "optional", + "vector", + ] + ], + "lazy_ir_inc": [f'#include "{node_base_hdr}"'] + if node_base_hdr is not None + else [], + "ir_declarations": list( + concat_map_codegen( + lazy_ir_obj, grouped_native_functions, full_codegen + ir_gen + ) + ), + "namespace_prologue": ns_helper.prologue, + "namespace_epilogue": ns_helper.epilogue, + }, + ) + + # Generate Non Native IR Node classes + fm.write_with_template( + "LazyNonNativeIr.h", + "LazyNonNativeIr.h", + lambda: { + "lazy_non_native_ir_inc": [ + f"#include <{path}>" + for path in [ + "torch/csrc/lazy/core/ir.h", + "torch/csrc/lazy/core/ir_builder.h", + "torch/csrc/lazy/core/internal_ops/ltc_ops.h", + "torch/csrc/lazy/core/shape_inference.h", + ] + + ([node_base_hdr] if node_base_hdr else []) + if path + ], + "non_native_ir_nodes": dest.generate_non_native_lazy_ir_nodes( + non_native, lazy_ir_obj + ), + "namespace_prologue": ns_helper.prologue, + "namespace_epilogue": ns_helper.epilogue, + }, + ) + + +if __name__ == "__main__": + main() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_schema_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_schema_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..98a6505a8289cf5c46d854255d7df152c273d01c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_schema_utils.py @@ -0,0 +1,97 @@ +from typing import Any + +from torchgen.model import ( + Annotation, + Argument, + Arguments, + BaseOperatorName, + BaseTy, + BaseType, + CustomClassType, + FunctionSchema, + ListType, + OperatorName, + Return, +) + + +# Note: These aren't actually used in torchgen, they're some utilities for generating a schema +# from real arguments. For example, this is used to generate HigherOrderOperators' schema since +# their schemas can vary for different instances of the same HOP. + + +class TypeGen: + convert_to_base_ty = { + int: BaseTy.int, + float: BaseTy.float, + str: BaseTy.str, + bool: BaseTy.bool, + } + + @staticmethod + def from_example(obj: Any) -> BaseType | ListType | CustomClassType: + import torch + + if isinstance(obj, torch.fx.GraphModule): + return BaseType(BaseTy.GraphModule) + elif isinstance(obj, torch.Tensor): + return BaseType(BaseTy.Tensor) + elif isinstance(obj, torch.SymInt): + return BaseType(BaseTy.SymInt) + elif isinstance(obj, torch.SymBool): + return BaseType(BaseTy.SymBool) + elif isinstance(obj, torch.ScriptObject): + return CustomClassType(obj._type().name()) # type: ignore[attr-defined] + elif isinstance(obj, (list, tuple)): + assert len(obj) > 0 + all_base_tys = [TypeGen.from_example(x) for x in obj] + if len(set(all_base_tys)) > 1: + raise RuntimeError( + f"Cannot generate schema for a sequence of args of heterogeneous types: {all_base_tys}. " + "Consider unpacking the argument and give proper names to them if possible " + "instead of using *args." + ) + return ListType(all_base_tys[0], len(obj)) + tp = type(obj) + if tp not in TypeGen.convert_to_base_ty: + raise RuntimeError(f"unsupported type {tp}") + return BaseType(TypeGen.convert_to_base_ty[tp]) + + +class ReturnGen: + @staticmethod + def from_example( + name: str | None, obj: Any, annotation: Annotation | None + ) -> Return: + return Return(name, TypeGen.from_example(obj), annotation) + + +class ArgumentGen: + @staticmethod + def from_example( + name: str, obj: Any, default: str | None, annotation: Annotation | None + ) -> Argument: + return Argument( + name, TypeGen.from_example(obj), default=default, annotation=annotation + ) + + +class FunctionSchemaGen: + @staticmethod + def from_example( + op_name: str, + example_inputs: tuple[tuple[str, Any], ...], + example_outputs: tuple[Any, ...], + ) -> FunctionSchema: + args = [] + for name, inp in example_inputs: + args.append(ArgumentGen.from_example(name, inp, None, None)) + # ignore the annotations and other attributes for now, we could add more when needed. + arguments = Arguments( + tuple(), None, tuple(args), tuple(), None, tuple(), tuple() + ) + returns = tuple( + ReturnGen.from_example(None, out, None) for out in example_outputs + ) + op_name = OperatorName(BaseOperatorName(op_name, False, False, False), "") + return FunctionSchema(op_name, arguments, returns) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_vmap_plumbing.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_vmap_plumbing.py new file mode 100644 index 0000000000000000000000000000000000000000..01e27f220fadaa9c16f2c5c5d6d72f1f438c4e8c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/gen_vmap_plumbing.py @@ -0,0 +1,275 @@ +from __future__ import annotations + +import textwrap +from dataclasses import dataclass +from typing import TYPE_CHECKING + +from torchgen.api.translate import translate +from torchgen.api.types import DispatcherSignature +from torchgen.context import method_with_native_function +from torchgen.model import ( + Argument, + BaseTy, + BaseType, + FunctionSchema, + ListType, + NativeFunction, + OptionalType, + Return, + SchemaKind, + Type, +) +from torchgen.utils import mapMaybe + + +if TYPE_CHECKING: + from collections.abc import Sequence + + +def is_tensor(typ: Type) -> bool: + return isinstance(typ, BaseType) and typ.name == BaseTy.Tensor + + +def is_optional_tensor(typ: Type) -> bool: + return isinstance(typ, OptionalType) and is_tensor(typ.elem) + + +def is_tensor_list(typ: Type) -> bool: + return isinstance(typ, ListType) and is_tensor(typ.elem) + + +def unwrap_tensor(name: str, cur_level_var: str) -> list[str]: + result = f"""\ + auto [{name}_value, {name}_bdim] = unwrapTensorAtLevel({name}, {cur_level_var});""" + return textwrap.dedent(result).split("\n") + + +def unwrap_optional_tensor(name: str, cur_level_var: str) -> list[str]: + result = f"""\ + std::optional {name}_value; + std::optional {name}_bdim; + if ({name}) {{ + std::tie({name}_value, {name}_bdim) = unwrapTensorAtLevel({name}.value(), {cur_level_var}); + }}""" + return textwrap.dedent(result).split("\n") + + +def gen_unwraps( + flat_arguments: Sequence[Argument], cur_level_var: str +) -> tuple[str, list[str]]: + arg_names = [a.name for a in flat_arguments] + arg_types = [a.type for a in flat_arguments] + + tensors = [name for typ, name in zip(arg_types, arg_names) if is_tensor(typ)] + optional_tensors = [ + name for typ, name in zip(arg_types, arg_names) if is_optional_tensor(typ) + ] + + unwraps = [] + for tensor in tensors: + unwraps += unwrap_tensor(tensor, cur_level_var) + + for opt_tensor in optional_tensors: + unwraps += unwrap_optional_tensor(opt_tensor, cur_level_var) + unwrap_code = "\n".join(unwraps) + + unwrapped_arg_list = [] + for arg in arg_names: + if arg in tensors or arg in optional_tensors: + unwrapped_arg_list += [f"{arg}_value", f"{arg}_bdim"] + else: + unwrapped_arg_list.append(arg) + return unwrap_code, unwrapped_arg_list + + +def gen_case_where_all_bdims_are_none( + outer_sig: DispatcherSignature, schema: FunctionSchema, cur_level_var: str +) -> str: + conditions = [] + flat_args = schema.arguments.flat_all + for arg in flat_args: + if not arg.type.is_tensor_like(): + continue + conditions.append(f"!isBatchedAtLevel({arg.name}, {cur_level_var})") + + sig = DispatcherSignature.from_schema(schema) + translated_args = ", ".join( + e.expr for e in translate(outer_sig.arguments(), sig.arguments()) + ) + return f"""\ +if ({" && ".join(conditions)}) {{ + return at::_ops::{sig.func.name.unambiguous_name()}::call({translated_args}); +}}""" + + +def gen_returns( + returns: tuple[Return, ...], cur_level_var: str, results_var: str +) -> str: + idx = 0 + wrapped_returns = [] + for ret in returns: + if is_tensor(ret.type): + wrapped_returns.append( + f"makeBatched(std::get<{idx}>({results_var}), std::get<{idx + 1}>({results_var}), {cur_level_var})" + ) + idx += 2 + elif is_tensor_list(ret.type): + wrapped_returns.append( + f"makeBatchedVector(std::get<{idx}>({results_var}), std::get<{idx + 1}>({results_var}), {cur_level_var})" + ) + idx += 2 + else: + wrapped_returns.append(f"std::get<{idx}>({results_var})") + idx += 1 + if len(wrapped_returns) == 1: + result = f"return {wrapped_returns[0]};" + else: + result = f"return std::make_tuple({', '.join(wrapped_returns)});" + return result + + +def accepts_at_least_one_tensor_input(schema: FunctionSchema) -> bool: + return any(a.type.is_tensor_like() for a in schema.arguments.flat_all) + + +def is_mutated_arg(argument: Argument) -> bool: + return argument.annotation is not None and argument.annotation.is_write + + +def gen_vmap_inplace_plumbing(native_function: NativeFunction) -> str | None: + # Assumptions: + # - only one argument is being modified in-place + # - the argument that is being modified in-place is the first argument + # - all returns are either Tensor, tuple of Tensor, or TensorList + schema = native_function.func + sig = DispatcherSignature.from_schema(schema) + returns = schema.returns + + # Check assumptions. If these are invalid we return None + # and punt the work to handle them to the future. + assert schema.kind() == SchemaKind.inplace + if not is_mutated_arg(schema.arguments.flat_all[0]): + return None + if len([arg for arg in schema.arguments.flat_all if is_mutated_arg(arg)]) != 1: + return None + + # Only support cases where all returns are Tensors or vector + if len(returns) == 0: + return None + if not all(is_tensor(ret.type) or is_tensor_list(ret.type) for ret in returns): + return None + if not accepts_at_least_one_tensor_input(schema): + return None + + cur_level_var = "cur_level" + + unwraps, unwrapped_arg_list = gen_unwraps(schema.arguments.flat_all, cur_level_var) + bdims_all_none_case = gen_case_where_all_bdims_are_none(sig, schema, cur_level_var) + + return f"""\ +template +{sig.decl(name=schema.name.unambiguous_name() + "_generated_plumbing")} {{ + c10::impl::ExcludeDispatchKeyGuard guard(DispatchKey::FuncTorchBatched); + auto maybe_layer = maybeCurrentDynamicLayer(); + vmap_check_escaped(maybe_layer, "gen_vmap_inplace_plumbing"); + int64_t {cur_level_var} = maybe_layer->layerId(); +{textwrap.indent(bdims_all_none_case, " ")} +{textwrap.indent(unwraps, " ")} + batch_rule({", ".join(unwrapped_arg_list)}); + return {schema.arguments.flat_all[0].name}; +}}""" + + +def gen_vmap_plumbing_no_returns(native_function: NativeFunction) -> str: + schema = native_function.func + sig = DispatcherSignature.from_schema(schema) + cur_level_var = "cur_level" + + unwraps, unwrapped_arg_list = gen_unwraps(schema.arguments.flat_all, cur_level_var) + bdims_all_none_case = gen_case_where_all_bdims_are_none(sig, schema, cur_level_var) + + return f"""\ +template +{sig.decl(name=schema.name.unambiguous_name() + "_generated_plumbing")} {{ + c10::impl::ExcludeDispatchKeyGuard guard(DispatchKey::FuncTorchBatched); + auto maybe_layer = maybeCurrentDynamicLayer(); + vmap_check_escaped(maybe_layer, "gen_vmap_plumbing_no_returns"); + int64_t {cur_level_var} = maybe_layer->layerId(); +{textwrap.indent(bdims_all_none_case, " ")} +{textwrap.indent(unwraps, " ")} + batch_rule({", ".join(unwrapped_arg_list)}); +}}""" + + +def gen_vmap_plumbing(native_function: NativeFunction) -> str | None: + schema = native_function.func + sig = DispatcherSignature.from_schema(schema) + returns = schema.returns + + # Only support cases where all returns are Tensors or vector + if not accepts_at_least_one_tensor_input(schema): + return None + if len(returns) == 0: + return gen_vmap_plumbing_no_returns(native_function) + return_symint_overrides = [ + "_scaled_dot_product_flash_attention", + "_scaled_dot_product_cudnn_attention", + ] + if ( + not all(ret.type.is_tensor_like() for ret in returns) + and schema.name.unambiguous_name() not in return_symint_overrides + ): + return None + # in-place views need special handling + if "inplace_view" in native_function.tags: + return None + + if schema.kind() == SchemaKind.inplace: + return gen_vmap_inplace_plumbing(native_function) + + # Don't support these (mutable, out, scratch) + if schema.kind() != SchemaKind.functional: + return None + + results_var = "results" + cur_level_var = "cur_level" + + unwraps, unwrapped_arg_list = gen_unwraps(schema.arguments.flat_all, cur_level_var) + bdims_all_none_case = gen_case_where_all_bdims_are_none(sig, schema, cur_level_var) + + wrapped_returns = gen_returns(returns, cur_level_var, results_var) + return f"""\ +template +{sig.decl(name=schema.name.unambiguous_name() + "_generated_plumbing")} {{ + c10::impl::ExcludeDispatchKeyGuard guard(DispatchKey::FuncTorchBatched); + auto maybe_layer = maybeCurrentDynamicLayer(); + vmap_check_escaped(maybe_layer, "gen_vmap_plumbing"); + int64_t {cur_level_var} = maybe_layer->layerId(); +{textwrap.indent(bdims_all_none_case, " ")} +{textwrap.indent(unwraps, " ")} + auto {results_var} = batch_rule({", ".join(unwrapped_arg_list)}); + {wrapped_returns} +}}""" + + +@dataclass(frozen=True) +class ComputeBatchRulePlumbing: + @method_with_native_function + def __call__(self, f: NativeFunction) -> str | None: + result = gen_vmap_plumbing(f) + return result + + +def gen_all_vmap_plumbing(native_functions: Sequence[NativeFunction]) -> str: + body = "\n".join(list(mapMaybe(ComputeBatchRulePlumbing(), native_functions))) + return f""" +#pragma once +#include +#include + +namespace at {{ namespace functorch {{ + +{body} + +}}}} // namespace at::functorch +""" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/local.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/local.py new file mode 100644 index 0000000000000000000000000000000000000000..b359a29b74e76be5a65ae8588b054d4a9009b890 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/local.py @@ -0,0 +1,62 @@ +from __future__ import annotations + +import threading +from contextlib import contextmanager +from typing import TYPE_CHECKING + + +if TYPE_CHECKING: + from collections.abc import Iterator + + +# Simple dynamic scoping implementation. The name "parametrize" comes +# from Racket. +# +# WARNING WARNING: LOOKING TO EDIT THIS FILE? Think carefully about +# why you need to add a toggle to the global behavior of code +# generation. The parameters here should really only be used +# for "temporary" situations, where we need to temporarily change +# the codegen in some cases because we cannot conveniently update +# all call sites, and are slated to be eliminated once all call +# sites are eliminated. If you don't have a plan for how to get there, +# DON'T add a new entry here. + + +class Locals(threading.local): + use_const_ref_for_mutable_tensors: bool | None = None + use_ilistref_for_tensor_lists: bool | None = None + + +_locals = Locals() + + +def use_const_ref_for_mutable_tensors() -> bool: + assert _locals.use_const_ref_for_mutable_tensors is not None, ( + "need to initialize local.use_const_ref_for_mutable_tensors with " + "local.parametrize" + ) + return _locals.use_const_ref_for_mutable_tensors + + +def use_ilistref_for_tensor_lists() -> bool: + assert _locals.use_ilistref_for_tensor_lists is not None, ( + "need to initialize local.use_ilistref_for_tensor_lists with local.parametrize" + ) + return _locals.use_ilistref_for_tensor_lists + + +@contextmanager +def parametrize( + *, use_const_ref_for_mutable_tensors: bool, use_ilistref_for_tensor_lists: bool +) -> Iterator[None]: + old_use_const_ref_for_mutable_tensors = _locals.use_const_ref_for_mutable_tensors + old_use_ilistref_for_tensor_lists = _locals.use_ilistref_for_tensor_lists + try: + _locals.use_const_ref_for_mutable_tensors = use_const_ref_for_mutable_tensors + _locals.use_ilistref_for_tensor_lists = use_ilistref_for_tensor_lists + yield + finally: + _locals.use_const_ref_for_mutable_tensors = ( + old_use_const_ref_for_mutable_tensors + ) + _locals.use_ilistref_for_tensor_lists = old_use_ilistref_for_tensor_lists diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/model.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/model.py new file mode 100644 index 0000000000000000000000000000000000000000..59063ef8b26e749149681c18854d2df64f177c28 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/model.py @@ -0,0 +1,2903 @@ +from __future__ import annotations + +import dataclasses +import itertools +import re +from dataclasses import dataclass +from enum import auto, Enum +from typing import TYPE_CHECKING +from typing_extensions import assert_never + +from torchgen.utils import NamespaceHelper, OrderedSet + + +if TYPE_CHECKING: + from collections.abc import Callable, Iterator, Sequence + + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # +# +# DATA MODEL +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # +# +# Some general principles for our data model. +# +# - Stop using C++ data types as the internal data representation +# format. Instead, the internal data structures are centered +# around JIT schema representation. This avoid a big problem +# with the old codegen where we read in all the types from +# native_functions.yaml and then immediately had to retranslate +# them into C++ types. +# +# - More semantic data representation. Instead of representing +# everything as dicts and strings, we define dataclasses for +# every interesting entity the code generation has to deal with. +# These dataclasses have strong semantic invariants: for example, +# we generally require them to roundtrip losslessly into the +# form they were parsed from. These structures are immutable +# and you're expected to populate information once during +# construction. + + +# Represent a source location; used for better error reporting +@dataclass(frozen=True) +class Location: + file: str + line: int + + def __str__(self) -> str: + return f"{self.file}:{self.line}" + + +# Valid values of the 'variants' field in native_functions.yaml +class Variant(Enum): + function = auto() + method = auto() + + +# Default kernel namespace +DEFAULT_KERNEL_NAMESPACE = "at::native" + +# NOTE: Keep the list in sync with `DispatchKey` in c10/core/DispatchKey.h +BACKEND_COMPONENTS = [ + "CPU", + "CUDA", + "HIP", + "XLA", + "MTIA", + "MPS", + "IPU", + "XPU", + "HPU", + "VE", + "Lazy", + "Meta", + "PrivateUse1", + "PrivateUse2", + "PrivateUse3", +] +FUNCTIONALITY_KEYS = [ + "", + "Quantized", + "Sparse", + "SparseCsr", + "NestedTensor", + "Autograd", +] + +# This list guards dispatches that can be used in derivatives.yaml +# For now we omit AutogradFunctionality and AutogradOther +AUTOGRAD_KEYS = ["AutogradNestedTensor"] + [ + "Autograd" + component for component in BACKEND_COMPONENTS +] + +FRAGMENT_NAMESPACES = {"quantized", "quantized_decomposed"} + + +# This doesn't have to be in sync with the header, it only needs to contain +# entries that we actually use in the codegen or want pyi entries for +class DispatchKey(Enum): + Undefined = 0 + CatchAll = Undefined + + FPGA = auto() + MAIA = auto() + Vulkan = auto() + Metal = auto() + MKLDNN = auto() + OpenGL = auto() + OpenCL = auto() + IDEEP = auto() + CustomRNGKeyId = auto() + MkldnnCPU = auto() + Sparse = auto() + SparseCsr = auto() + NestedTensor = auto() + Dense = auto() + + PythonTLSSnapshot = auto() + PreDispatch = auto() + PythonDispatcher = auto() + Python = auto() + FuncTorchDynamicLayerBackMode = auto() + ZeroTensor = auto() + Conjugate = auto() + Negative = auto() + BackendSelect = auto() + Named = auto() + AutogradOther = auto() + AutogradFunctionality = auto() + AutogradNestedTensor = auto() + Tracer = auto() + Autocast = auto() + AutocastCPU = auto() + AutocastCUDA = auto() + Batched = auto() + VmapMode = auto() + FuncTorchGradWrapper = auto() + FuncTorchBatched = auto() + BatchedNestedTensor = auto() + FuncTorchVmapMode = auto() + FuncTorchDynamicLayerFrontMode = auto() + Functionalize = auto() + TESTING_ONLY_GenericWrapper = auto() + TESTING_ONLY_GenericMode = auto() + + ADInplaceOrView = auto() + Autograd = auto() + CompositeImplicitAutograd = auto() + CompositeImplicitAutogradNestedTensor = auto() + CompositeExplicitAutograd = auto() + CompositeExplicitAutogradNonFunctional = auto() + FuncTorchBatchedDecomposition = auto() + + # BEGIN autogenerated + CPU = auto() + CUDA = auto() + HIP = auto() + XLA = auto() + MTIA = auto() + MPS = auto() + IPU = auto() + XPU = auto() + HPU = auto() + VE = auto() + Lazy = auto() + Meta = auto() + PrivateUse1 = auto() + PrivateUse2 = auto() + PrivateUse3 = auto() + QuantizedCPU = auto() + QuantizedCUDA = auto() + QuantizedHIP = auto() + QuantizedXLA = auto() + QuantizedMTIA = auto() + QuantizedMPS = auto() + QuantizedIPU = auto() + QuantizedXPU = auto() + QuantizedHPU = auto() + QuantizedVE = auto() + QuantizedLazy = auto() + QuantizedMeta = auto() + QuantizedPrivateUse1 = auto() + QuantizedPrivateUse2 = auto() + QuantizedPrivateUse3 = auto() + SparseCPU = auto() + SparseCUDA = auto() + SparseHIP = auto() + SparseXLA = auto() + SparseMTIA = auto() + SparseMPS = auto() + SparseIPU = auto() + SparseXPU = auto() + SparseHPU = auto() + SparseVE = auto() + SparseLazy = auto() + SparseMeta = auto() + SparsePrivateUse1 = auto() + SparsePrivateUse2 = auto() + SparsePrivateUse3 = auto() + SparseCsrCPU = auto() + SparseCsrCUDA = auto() + SparseCsrHIP = auto() + SparseCsrXLA = auto() + SparseCsrMTIA = auto() + SparseCsrMPS = auto() + SparseCsrIPU = auto() + SparseCsrXPU = auto() + SparseCsrHPU = auto() + SparseCsrVE = auto() + SparseCsrLazy = auto() + SparseCsrMeta = auto() + SparseCsrPrivateUse1 = auto() + SparseCsrPrivateUse2 = auto() + SparseCsrPrivateUse3 = auto() + NestedTensorCPU = auto() + NestedTensorCUDA = auto() + NestedTensorHIP = auto() + NestedTensorXLA = auto() + NestedTensorMTIA = auto() + NestedTensorMPS = auto() + NestedTensorIPU = auto() + NestedTensorXPU = auto() + NestedTensorHPU = auto() + NestedTensorVE = auto() + NestedTensorLazy = auto() + NestedTensorMeta = auto() + NestedTensorPrivateUse1 = auto() + NestedTensorPrivateUse2 = auto() + NestedTensorPrivateUse3 = auto() + AutogradCPU = auto() + AutogradCUDA = auto() + AutogradHIP = auto() + AutogradXLA = auto() + AutogradMTIA = auto() + AutogradMPS = auto() + AutogradIPU = auto() + AutogradXPU = auto() + AutogradHPU = auto() + AutogradVE = auto() + AutogradLazy = auto() + AutogradMeta = auto() + AutogradPrivateUse1 = auto() + AutogradPrivateUse2 = auto() + AutogradPrivateUse3 = auto() + # END autogenerated + + def __str__(self) -> str: + return self.name + + def lower(self) -> str: + return str(self).lower() + + @staticmethod + def parse(value: str) -> DispatchKey: + for k, v in DispatchKey.__members__.items(): + if k == value: + return v + raise AssertionError(f"unknown dispatch key {value}") + + +class _TorchDispatchModeKey(Enum): + FAKE = auto() + PROXY = auto() + FUNCTIONAL = auto() + + +def codegen_per_backend_entries() -> str: + r: list[str] = [] + for fk in FUNCTIONALITY_KEYS: + r.extend(f" {fk}{bc} = auto()" for bc in BACKEND_COMPONENTS) + return "\n".join(r) + + +for fk in FUNCTIONALITY_KEYS: + for bc in BACKEND_COMPONENTS: + if not hasattr(DispatchKey, fk + bc): + r = codegen_per_backend_entries() + print(r) + raise RuntimeError( + f"Missing {fk}{bc} from DispatchKey enum. Here is the autogenerated list we expect to have:\n\n{r}" + ) + + +STRUCTURED_DISPATCH_KEYS = { + DispatchKey.MPS, + DispatchKey.CUDA, + DispatchKey.CPU, + DispatchKey.XPU, + DispatchKey.MTIA, +} +UFUNC_DISPATCH_KEYS = {DispatchKey.CUDA, DispatchKey.CPU} + +# Set of supported dispatch keys +dispatch_keys = [ + DispatchKey.CPU, + DispatchKey.SparseCPU, + DispatchKey.SparseCsrCPU, + DispatchKey.MkldnnCPU, + DispatchKey.CUDA, + DispatchKey.MPS, + DispatchKey.XPU, + DispatchKey.SparseXPU, + DispatchKey.SparseCsrXPU, + DispatchKey.SparseCUDA, + DispatchKey.SparseCsrCUDA, + DispatchKey.SparseMPS, + DispatchKey.SparseCsrMPS, + DispatchKey.QuantizedCPU, + DispatchKey.QuantizedCUDA, + DispatchKey.CompositeImplicitAutograd, + DispatchKey.CompositeImplicitAutogradNestedTensor, + DispatchKey.CompositeExplicitAutograd, + DispatchKey.CompositeExplicitAutogradNonFunctional, + DispatchKey.NestedTensorCPU, + DispatchKey.NestedTensorCUDA, + DispatchKey.NestedTensorXPU, + DispatchKey.NestedTensorHPU, + # Meta is a magic key: it is automatically generated for structured + # kernels + DispatchKey.Meta, + DispatchKey.SparseMeta, + DispatchKey.SparseCsrMeta, + DispatchKey.QuantizedMeta, + DispatchKey.NestedTensorMeta, + DispatchKey.ZeroTensor, + DispatchKey.MTIA, +] + + +# Dispatch keys that "support all backends". These codegen slightly differently +# then backend specific keys. +def is_generic_dispatch_key(dk: DispatchKey) -> bool: + return dk in { + DispatchKey.CompositeExplicitAutograd, + DispatchKey.CompositeExplicitAutogradNonFunctional, + DispatchKey.CompositeImplicitAutograd, + DispatchKey.CompositeImplicitAutogradNestedTensor, + } + + +# CUDA specific dispatch keys +def is_cuda_dispatch_key(dk: DispatchKey) -> bool: + return dk in { + DispatchKey.CUDA, + DispatchKey.QuantizedCUDA, + DispatchKey.SparseCUDA, + DispatchKey.SparseCsrCUDA, + DispatchKey.NestedTensorCUDA, + DispatchKey.AutogradCUDA, + } + + +# XPU specific dispatcy keys +def is_xpu_dispatch_key(dk: DispatchKey) -> bool: + return dk in { + DispatchKey.XPU, + DispatchKey.QuantizedXPU, + DispatchKey.SparseXPU, + DispatchKey.SparseCsrXPU, + DispatchKey.NestedTensorXPU, + DispatchKey.AutogradXPU, + } + + +# Structured kernel generation is only supported for certain key types; +# otherwise use old-style +def is_structured_dispatch_key(dk: DispatchKey) -> bool: + return dk in STRUCTURED_DISPATCH_KEYS + + +def is_ufunc_dispatch_key(dk: DispatchKey) -> bool: + # For now, ufunc dispatch keys coincide with structured keys + return dk in UFUNC_DISPATCH_KEYS + + +dispatch_device_map = {is_cuda_dispatch_key: "cuda", is_xpu_dispatch_key: "xpu"} + + +# This is oddly named ScalarType and not DType for symmetry with C++ +class ScalarType(Enum): + Byte = auto() + Char = auto() + Short = auto() + Int = auto() + Long = auto() + Half = auto() + Float = auto() + Double = auto() + ComplexHalf = auto() + ComplexFloat = auto() + ComplexDouble = auto() + Bool = auto() + BFloat16 = auto() + Float8_e5m2 = auto() + Float8_e5m2fnuz = auto() + Float8_e4m3fn = auto() + Float8_e4m3fnuz = auto() + Float8_e8m0fnu = auto() + + def __str__(self) -> str: + return self.name + + @staticmethod + def maybe_parse(value: str) -> ScalarType | None: + for k, v in ScalarType.__members__.items(): + if k == value: + return v + return None + + @staticmethod + def parse(value: str) -> ScalarType: + mb_r = ScalarType.maybe_parse(value) + assert mb_r is not None, f"unknown dtype {value}" + return mb_r + + @staticmethod + def parse_set(values: str) -> OrderedSet[ScalarType]: + dtypes: OrderedSet[ScalarType] = OrderedSet() + for value in values.split(", "): + if value in DTYPE_CLASSES: + dtypes.update(DTYPE_CLASSES[value]) + else: + dtypes.add(ScalarType.parse(value)) + return dtypes + + +DTYPE_CLASSES: dict[str, OrderedSet[ScalarType]] = {} +# NB: Integral doesn't include boolean +DTYPE_CLASSES["Integral"] = OrderedSet( + [ + ScalarType.Byte, + ScalarType.Char, + ScalarType.Int, + ScalarType.Long, + ScalarType.Short, + ] +) +# NB: Floating doesn't include low precision types +DTYPE_CLASSES["Floating"] = OrderedSet([ScalarType.Float, ScalarType.Double]) +DTYPE_CLASSES["Complex"] = OrderedSet( + [ScalarType.ComplexFloat, ScalarType.ComplexDouble] +) +DTYPE_CLASSES["All"] = DTYPE_CLASSES["Integral"] | DTYPE_CLASSES["Floating"] +DTYPE_CLASSES["AllAndComplex"] = DTYPE_CLASSES["All"] | DTYPE_CLASSES["Complex"] +DTYPE_CLASSES["FloatingAndComplex"] = ( + DTYPE_CLASSES["Floating"] | DTYPE_CLASSES["Complex"] +) + + +# Represents the valid entries for ufunc_inner_loop in native_functions.yaml. +# NB: if you add a new UfuncKey, you will teach torchgen.dest.ufunc how +# to process it. Most logic will ignore keys they don't understand, so your +# new key will get silently ignored until you hook in logic to deal with it. +class UfuncKey(Enum): + # These are low level keys that represent exactly one particular + # instantiation of the kernel produced by codegen + CUDAFunctor = auto() + CUDAFunctorOnOther = auto() + CUDAFunctorOnSelf = auto() + + CPUScalar = auto() + CPUVector = auto() + + # These are the ones users will usually specify, and + # implicitly "fill in" the low level keys + ScalarOnly = auto() # CUDA*, CPUScalar + Generic = auto() # CUDA*, CPU* + + def __str__(self) -> str: + return self.name + + @staticmethod + def parse(value: str) -> UfuncKey: + for k, v in UfuncKey.__members__.items(): + if k == value: + return v + raise AssertionError(f"unknown ufunc key {value}") + + +class DeviceCheckType(Enum): + NoCheck = 0 + ExactSame = 1 + + +class ViewSchemaKind(Enum): + aliasing = auto() + aliasing_inplace = auto() + non_aliasing = auto() + + +# The basic input to the code generation is native_functions.yaml. +# The name "native", BTW, comes from the distinction between native +# functions and legacy TH functions. The legacy TH functions are gone, +# but the "native" descriptor has stuck. +# +# NativeFunction models a single entry in native_functions.yaml. Its +# fields roughly correspond to what you would see in the YAML itself, +# but after canonicalization and parsing has occurred. +# +# You can see some of the overall design patterns for how we setup +# dataclasses in this class, but we will defer a complete discussion +# of this at FunctionSchema. +@dataclass(frozen=True) +class NativeFunction: + # The namespace for this operator. For example, if we have "at::add" + # then the namespace would be "at". This enables ops to be registered + # through the same DSL with a custom namespace. If not specified, the + # default namespace would be "at". + namespace: str + + # The function schema of the operator in question. This schema + # has been parsed; see FunctionSchema for more about its structure. + # (This type is quoted as we are forward referencing a type + # defined later in the file. I opted for this ordering of the + # classes for expository clarity.) + func: FunctionSchema + + # Whether or not to generate mutable tensor arguments like regular + # ones + use_const_ref_for_mutable_tensors: bool + + # Whether or not to omit automatic generation of a DeviceGuard + device_guard: bool + + # How to emit automatic generation of device check + device_check: DeviceCheckType + + # What python module to put the function in + python_module: str | None + + # TODO: figure out what this does + category_override: str | None + + # If no variants are specified in native_functions.yaml, this is + # assumed to be {'function'}. + variants: set[Variant] + + # Whether or not we should skip generating registrations for + # this kernel. This is a bit of a double-edged sword, as manual + # registrations don't participate in codegen-based selective build! + manual_kernel_registration: bool + + # Whether or not to skip generating TensorMethod/Functions bindings + # for this kernel. Technically, this doesn't actually skip generating + # the binding; instead, the binding gets generated to __dispatch_{funcname} + # so you can make use of the normal binding if you need it. + manual_cpp_binding: bool + + # The location in the YAML file were this native function entry was + # defined. This is for conveniently reporting error messages! + loc: Location + + # A list of operators that are expected to be auto-generated for this NativeFunction. + # Note: This list isn't actually directly used by the codegen to generate anything. + # Instead, the codegen figures out what operators to generate purely based off of + # function schema, and uses the autogen declarations to error check. + # We expect every NativeFunction that gets auto-generated be explicitly called out + # in native_functions.yaml + autogen: list[OperatorName] + + # If non-empty, this kernel is subject to ufunc codegen. + # Sorted by ufunc_key + ufunc_inner_loop: dict[UfuncKey, UfuncInnerLoop] + + # Whether or not this out functions is a "structured kernel". Structured + # kernels are defined a little differently from normal kernels; in + # particular, their shape checking logic is defined separately from + # the kernel. Only out functions can be structured; other functions + # delegate to the out function using the structured_delegate keyword. + # Every structured kernel must have at least an out and a functional + # variant. + structured: bool + + # Whether or not this non-out function is a structured kernel, defined + # in terms of the out kernel referenced by the string here. + structured_delegate: OperatorName | None + + # Only valid for structured kernels. Specifies alternative of what + # to inherit from when defining the meta class for the structured + # operator. This will usually be TensorIteratorBase. This also + # changes the semantics of set_output to call the parent class. + structured_inherits: str | None + + # Structured kernels can declare elements as "precomputed". These elements + # are returned by the meta function in one struct and passed to the impl + # function in lieu of certain kernel arguments that these precomputed + # elements supersede. Information about the names and types of these + # precomputed elements and how they correspond to kernel arguments is stored + # in this member, if applicable. + precomputed: Precompute | None + + # Argument names whose default should be excluded from the C++ interface. + # Intended for resolving overload ambiguities between signatures. + cpp_no_default_args: set[str] + + # Note [Abstract ATen methods] + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # An abstract ATen method is one whose dispatch differs between + # types. These are implemented in derived types (with a + # standard (throwing) definition in Type). A concrete ATen + # method is one which has the same dispatch for all types; + # we just implement it in the base Type. This is exposed + # in Declarations.yaml via a field named 'abstract'. + is_abstract: bool + + # Whether or not the NativeFunction contains a backend-agnostic kernel + has_composite_implicit_autograd_kernel: bool + has_composite_implicit_autograd_nested_tensor_kernel: bool + has_composite_explicit_autograd_kernel: bool + has_composite_explicit_autograd_non_functional_kernel: bool + + # Tags are used to describe semantic information about (groups of) operators, + # That aren't easily inferable directly from the operator's schema. + tags: set[str] + + # NB: The benefit of defining a dataclass is that we automatically get + # a constructor defined for all the fields we specify. No need + # to explicitly write it out. + + # We parse both the NativeFunction + backend-specific information about it, which it stored in a corresponding BackendIndex. + @staticmethod + def from_yaml( + ei: dict[str, object], + loc: Location, + valid_tags: set[str], + ignore_keys: set[DispatchKey] | None = None, + ) -> tuple[NativeFunction, dict[DispatchKey, dict[OperatorName, BackendMetadata]]]: + """ + Parse a NativeFunction from a dictionary as directly parsed + from native_functions.yaml + """ + e = ei.copy() + + funcs = e.pop("func") + assert isinstance(funcs, str), f"not a str: {funcs}" + # only support one level of namespace. E.g., aten::add + namespace_helper = NamespaceHelper.from_namespaced_entity( + namespaced_entity=funcs, max_level=1 + ) + namespace = namespace_helper.get_cpp_namespace(default="aten") + func = FunctionSchema.parse(namespace_helper.entity_name) + + cpp_no_default_args_list = e.pop("cpp_no_default_args", []) + assert isinstance(cpp_no_default_args_list, list) + cpp_no_default_args = set(cpp_no_default_args_list) + + use_const_ref_for_mutable_tensors = e.pop( + "use_const_ref_for_mutable_tensors", False + ) + assert isinstance(use_const_ref_for_mutable_tensors, bool) + + if use_const_ref_for_mutable_tensors: + assert not func.arguments.out, ( + "see https://github.com/pytorch/pytorch/issues/145522" + ) + + variants_s = e.pop("variants", "function") + assert isinstance(variants_s, str) + variants: set[Variant] = set() + for v in variants_s.split(", "): + if v == "function": + variants.add(Variant.function) + elif v == "method": + variants.add(Variant.method) + else: + raise AssertionError(f"illegal variant {v}") + + manual_kernel_registration = e.pop("manual_kernel_registration", False) + assert isinstance(manual_kernel_registration, bool), ( + f"not a bool: {manual_kernel_registration}" + ) + + manual_cpp_binding = e.pop("manual_cpp_binding", False) + assert isinstance(manual_cpp_binding, bool), f"not a bool: {manual_cpp_binding}" + + device_guard = e.pop("device_guard", True) + assert isinstance(device_guard, bool), f"not a bool: {device_guard}" + + device_check_s = e.pop("device_check", None) + assert device_check_s is None or isinstance(device_check_s, str), ( + f"not a str: {device_check_s}" + ) + assert ( + device_check_s is None or device_check_s in DeviceCheckType.__members__ + ), f"illegal device_check: {device_check_s}" + device_check: DeviceCheckType + if device_check_s is None: + device_check = DeviceCheckType.ExactSame + else: + device_check = DeviceCheckType[device_check_s] + + structured = e.pop("structured", False) + assert isinstance(structured, bool), f"not a bool: {structured}" + + structured_delegate_s = e.pop("structured_delegate", None) + assert structured_delegate_s is None or isinstance( + structured_delegate_s, str + ), f"not a str: {structured_delegate_s}" + assert structured_delegate_s is None or "::" not in structured_delegate_s, ( + "namespace is not supported in structured delegate," + " using the same namespace as the native function" + ) + structured_delegate: OperatorName | None = None + if structured_delegate_s is not None: + structured_delegate = OperatorName.parse(structured_delegate_s) + + structured_inherits = e.pop("structured_inherits", None) + assert structured_inherits is None or isinstance(structured_inherits, str), ( + f"not a str: {structured_inherits}" + ) + assert structured_inherits is None or "::" not in structured_inherits, ( + "namespace is not supported in structured inherits," + " using the same namespace as the native function" + ) + + python_module = e.pop("python_module", None) + assert python_module is None or isinstance(python_module, str), ( + f"not a str: {python_module}" + ) + assert python_module is None or Variant.method not in variants, ( + "functions in modules cannot be methods" + ) + + category_override = e.pop("category_override", None) + assert category_override is None or isinstance(category_override, str), ( + f"not a str: {category_override}" + ) + + precomputed_dict = e.pop("precomputed", None) + assert precomputed_dict is None or structured is True + precomputed = Precompute.parse(precomputed_dict) if precomputed_dict else None + + tags_inp = e.pop("tags", []) + if isinstance(tags_inp, str): + tags_inp = [tags_inp] + assert isinstance(tags_inp, list) + + # All aten ops generated by torchgen receive the pt2_compliant tag. + if namespace == "aten" and "pt2_compliant_tag" in valid_tags: + tags_inp.append("pt2_compliant_tag") + + tags: set[str] = set() + for t in tags_inp: + assert len(valid_tags) > 0 + # TODO: verify that the tag is valid and has an entry in tags.yaml + if t in valid_tags: + tags.add(t) + else: + raise AssertionError(f"illegal tag {t}") + + from torchgen.api import cpp + + raw_dispatch = e.pop("dispatch", None) + assert raw_dispatch is None or isinstance(raw_dispatch, dict), e + dispatch: dict[DispatchKey, BackendMetadata] = {} + num_dispatch_keys: int = 0 + if raw_dispatch is not None: + assert not manual_kernel_registration, ( + "cannot specify both manual_kernel_registration and dispatch; with " + "manual registration, dispatch has no effect!" + ) + redundant_composite_implicit_autograd = False + for ks, v in raw_dispatch.items(): + if ks == "__line__": + continue # not worth tracking line numbers for dispatch entries + assert isinstance(ks, str), ( + f"illegal dispatch key '{ks}' in {raw_dispatch}" + ) + assert isinstance(v, str), ( + f"illegal dispatch value '{v}' in {raw_dispatch}" + ) + for k in ks.split(","): + dispatch_key = DispatchKey.parse(k.strip()) + num_dispatch_keys += 1 + + if ignore_keys and dispatch_key in ignore_keys: + continue + assert dispatch_key in dispatch_keys, ( + f"Dispatch key {dispatch_key} of kernel {v} " + "is not a supported dispatch key." + ) + # We only allow at most 3 levels of namespace for kernels. + # We will append "native" to a custom kernel namespace. + namespace_helper = NamespaceHelper.from_namespaced_entity( + v, max_level=3 + ) + kernel_namespace = namespace_helper.get_cpp_namespace(default="at") + # Why is 'structured' included? External backends (e.g. + # XLA) opt into which ops are structured independently + # of which in-tree ops are structured + dispatch[dispatch_key] = BackendMetadata( + kernel=namespace_helper.entity_name, + structured=structured + and is_structured_dispatch_key(dispatch_key), + cpp_namespace=(kernel_namespace + "::native"), + ) + if ( + dispatch_key is DispatchKey.CompositeImplicitAutograd + and v == cpp.name(func) + ): + redundant_composite_implicit_autograd = True + + # We count the number of dispatch keys which have not been ignored to prevent a dispatch table + # in which all backend keys are ignored but necessarily kept, remaining compositeimplicit, + # from being treated as redundant. + assert not ( + num_dispatch_keys == 1 and redundant_composite_implicit_autograd + ), ( + "unnecessary dispatch table for this function; just delete the dispatch " + "key entirely" + ) + # if a function is a structured delegate, deleting the dispatch + # table is NOT semantics preserving + assert ( + structured_delegate + or dispatch.keys() != {DispatchKey.CompositeImplicitAutograd} + or dispatch[DispatchKey.CompositeImplicitAutograd].supports_symint() + or num_dispatch_keys != 1 + ), ( + f"unexpected name for singleton CompositeImplicitAutograd dispatch entry: expected {cpp.name(func)} " + f"but got {dispatch[DispatchKey.CompositeImplicitAutograd]}. Rename your implementation to the expected " + "name, then delete the dispatch table" + ) + elif not structured and structured_delegate is None: + name = str(func.name.name) + assert not ( + name.startswith("new_") + or name.endswith("_like") + # TODO: maybe it's better to test the return + or ( + func.arguments.tensor_options + and not func.arguments.has_tensor_arg() + ) + ), ( + f"expected {name} to have a CompositeExplicitAutograd " + "dispatch entry, but there was no dispatch table. Factory functions " + "should not have implicit dispatch as they should not be decomposed " + "for __torch_dispatch__" + ) + dispatch[DispatchKey.CompositeImplicitAutograd] = BackendMetadata( + cpp.name(func), structured=False, cpp_namespace=DEFAULT_KERNEL_NAMESPACE + ) + + composites_in_dispatch = [ + d + for d in dispatch + if d == DispatchKey.CompositeExplicitAutograd + or d == DispatchKey.CompositeExplicitAutogradNonFunctional + or d == DispatchKey.CompositeImplicitAutograd + or d == DispatchKey.CompositeImplicitAutogradNestedTensor + ] + + assert len(composites_in_dispatch) <= 1 or ( + len(composites_in_dispatch) == 2 + and ( + DispatchKey.CompositeExplicitAutogradNonFunctional + not in composites_in_dispatch + ) + and ( + DispatchKey.CompositeImplicitAutogradNestedTensor + in composites_in_dispatch + ) + ), ( + "cannot specify more than one of CompositeExplicitAutograd, CompositeExplicitAutogradNonFunctional, " + "or CompositeImplicitAutograd on a single kernel; each " + "strictly subsumes the other. If you wanted to provide an explicit autograd " + "implementation, specify CompositeExplicitAutograd; otherwise specify CompositeImplicitAutograd only" + ) + + autogen_str = e.pop("autogen", "") + assert isinstance(autogen_str, str) + autogen = ( + [] + if autogen_str == "" + else [OperatorName.parse(x) for x in autogen_str.split(", ")] + ) + + raw_ufunc_inner_loop = e.pop("ufunc_inner_loop", {}) + ufunc_inner_loop = {} + if isinstance(raw_ufunc_inner_loop, str): + ufunc_inner_loop[UfuncKey.Generic] = UfuncInnerLoop.parse( + raw_ufunc_inner_loop, UfuncKey.Generic + ) + elif isinstance(raw_ufunc_inner_loop, dict): + for k, vo in raw_ufunc_inner_loop.items(): + if k == "__line__": + continue + assert isinstance(k, str), f"ufunc_inner_loop key is not a str: {k}" + assert isinstance(vo, str), f"ufunc_inner_loop value is not a str: {v}" + ufunc_key = UfuncKey.parse(k) + ufunc_inner_loop[ufunc_key] = UfuncInnerLoop.parse(vo, ufunc_key) + else: + raise AssertionError( + f"ufunc_inner_loop not str or dict: {raw_ufunc_inner_loop}" + ) + # Program the BackendIndex for the implicit dispatch entry from ufunc + if ufunc_inner_loop: + assert structured, "ufunc must be structured" + + # Delay import ufunc here to avoid circular import issue + # See: https://github.com/pytorch/pytorch/issues/81294 + import torchgen.api.ufunc as ufunc + + for dispatch_key in UFUNC_DISPATCH_KEYS: + assert dispatch_key not in dispatch, ( + f"ufunc should not have explicit dispatch entry for {dispatch_key}" + ) + dispatch[dispatch_key] = BackendMetadata( + kernel=ufunc.schema_kernel_name(func, dispatch_key), + structured=True, + cpp_namespace=DEFAULT_KERNEL_NAMESPACE, + ) + + if structured_delegate: + # Structured functions MUST have a dispatch table + is_abstract = True + else: + is_abstract = ( + dispatch.keys() != {DispatchKey.CompositeImplicitAutograd} + and dispatch.keys() + != {DispatchKey.CompositeImplicitAutogradNestedTensor} + and dispatch.keys() + != { + DispatchKey.CompositeImplicitAutograd, + DispatchKey.CompositeImplicitAutogradNestedTensor, + } + ) + + has_composite_implicit_autograd_kernel = ( + DispatchKey.CompositeImplicitAutograd in dispatch + ) + has_composite_implicit_autograd_nested_tensor_kernel = ( + DispatchKey.CompositeImplicitAutogradNestedTensor in dispatch + ) + has_composite_explicit_autograd_kernel = ( + DispatchKey.CompositeExplicitAutograd in dispatch + ) + has_composite_explicit_autograd_non_functional_kernel = ( + DispatchKey.CompositeExplicitAutogradNonFunctional in dispatch + ) + + # We aren't going to store dispatch metadata inline in NativeFunctions; + # instead it is separately indexed by backend (so other backends can + # add more dispatch entries after the fact). Reindex the individual + # metadata by OperatorName! + backend_metadata = {k: {func.name: v} for k, v in dispatch.items()} + + # don't care if it exists or not; make it easier to use this function + # with other yaml parsers that aren't setting __line__ in the dict + e.pop("__line__", None) + assert not e, f"leftover entries: {e}" + + # Asserts that we can't do in post_init, because they rely on backend-specific info + if structured_delegate is not None: + for key in STRUCTURED_DISPATCH_KEYS: + assert key not in dispatch, ( + f"if structured_delegate, then must not have {key} in dispatch dictionary " + "(it is delegated!)" + ) + + return ( + NativeFunction( + func=func, + use_const_ref_for_mutable_tensors=use_const_ref_for_mutable_tensors, + variants=variants, + structured=structured, + structured_delegate=structured_delegate, + structured_inherits=structured_inherits, + precomputed=precomputed, + autogen=autogen, + ufunc_inner_loop=ufunc_inner_loop, + manual_kernel_registration=manual_kernel_registration, + manual_cpp_binding=manual_cpp_binding, + python_module=python_module, + category_override=category_override, + device_guard=device_guard, + device_check=device_check, + loc=loc, + cpp_no_default_args=cpp_no_default_args, + is_abstract=is_abstract, + has_composite_implicit_autograd_kernel=has_composite_implicit_autograd_kernel, + has_composite_implicit_autograd_nested_tensor_kernel=has_composite_implicit_autograd_nested_tensor_kernel, + has_composite_explicit_autograd_kernel=has_composite_explicit_autograd_kernel, + has_composite_explicit_autograd_non_functional_kernel=has_composite_explicit_autograd_non_functional_kernel, + tags=tags, + namespace=namespace, + ), + backend_metadata, + ) + + def validate_unstructured(self) -> None: + # TODO: probably better to accumulate these errors and report them all + # at once + assert not self.structured, ( + "This function is structured, but there was " + "no valid functional variant of it." + ) + assert self.structured_delegate, ( + "This function delegates to another structured out function, " + "but no valid function was found (the delegate may not exist, or it has the wrong type)" + ) + + # __post_init__ functions in dataclasses can be used to do extra + # validation after construction. + # + # Notice that we don't do any type validation here. In fact, we + # rely exclusively on mypy to check if you've done types correctly! + # Validation is for nontrivial invariants that cannot be (conveniently) + # encoded in the type system. + def __post_init__(self) -> None: + if self.func.arguments.out: + assert self.variants == {Variant.function}, ( + "Native functions with out arguments MUST " + "be declared with only function variant; e.g., variants: function; " + "otherwise you will tickle a Python argument binding bug " + "(which usually manifests itself as the result variable being undefined.)" + ) + if self.structured: + assert self.func.kind() == SchemaKind.out, ( + "Put structured field on the out= " + "variant of a function; did you mean structured_delegate?" + ) + assert self.device_guard, ( + "device_guard: False is not respected by structured kernels" + ) + if self.structured_delegate: + assert self.func.kind() != SchemaKind.out, ( + "structured_delegate field not allowed " + "on out= functions; did you mean structured?" + ) + assert self.device_guard, ( + "device_guard: False is not respected by structured kernels" + ) + # Technically, with the asserts above, this assert is impossible to + # happen + assert not (self.structured and self.structured_delegate), ( + "Cannot have both structured and structured_delegate on function" + ) + defaulted_arguments = { + a.name for a in self.func.schema_order_arguments() if a.default is not None + } + invalid_args = set.difference(self.cpp_no_default_args, defaulted_arguments) + assert len(invalid_args) == 0, f"Invalid cpp_no_default_args: {invalid_args}" + if self.structured_inherits is not None: + assert self.structured, ( + "structured_inherits must also imply structured: True" + ) + if str(self.func.name).startswith("_foreach"): + assert self.device_check == DeviceCheckType.NoCheck, ( + "foreach kernels fall back to slow path when tensor are on different devices, " + "device_check not allowed to be enabled" + ) + + # NB: if your function accidentally has rand/dropout/... in its name + # but is not actually random, feel free to amend this to special case + if ( + "rand" in str(self.func.name) + or ( + ( + "dropout" in str(self.func.name) + or any( + "dropout" in arg.name for arg in self.func.arguments.flat_all + ) + ) + # Backwards of dropout is typically deterministic + and "backward" not in str(self.func.name) + and str(self.func.name.name) not in ["_cudnn_init_dropout_state"] + ) + or self.func.arguments.has_generator_arg() + ): + assert "nondeterministic_seeded" in self.tags, str(self.func.name) + + @property + def has_composite_kernel(self) -> bool: + return ( + self.has_composite_implicit_autograd_kernel + or self.has_composite_explicit_autograd_kernel + or self.has_composite_explicit_autograd_non_functional_kernel + ) or ( + self.has_composite_implicit_autograd_kernel + and self.has_composite_implicit_autograd_nested_tensor_kernel + ) + + @property + def is_view_op(self) -> bool: + rets = self.func.returns + is_non_mutating_view = len(rets) > 0 and any( + r.annotation is not None and not r.annotation.is_write for r in rets + ) + # See Note [resize_ in Functionalization] for more dtails + is_inplace_view = ( + "inplace_view" in self.tags + and str(self.func.name) != "resize_" + and str(self.func.name) != "resize_as_" + ) + is_wildcard_view = any( + inp.annotation is not None and "*" in inp.annotation.alias_set_after + for inp in self.func.schema_order_arguments() + ) + return is_non_mutating_view or is_inplace_view or is_wildcard_view + + @property + def view_schema_kind(self) -> ViewSchemaKind: + if self.is_view_op and self.func.name.name.inplace: + assert "inplace_view" in self.tags + return ViewSchemaKind.aliasing_inplace + if self.is_view_op: + return ViewSchemaKind.aliasing + else: + return ViewSchemaKind.non_aliasing + + @property + def root_name(self) -> str: + return self.func.name.name.base + + @property + def part_of_structured_group(self) -> bool: + return self.structured or self.structured_delegate is not None + + +class SchemaKind(Enum): + functional = auto() + inplace = auto() + out = auto() + mutable = auto() + scratch = auto() + + +# A structured kernel is guaranteed to have a functional and out variant, and +# optionally an inplace variant. +# +# NB: we create NativeFunctionsGroup *even if* the function is not +# actually annotated structured. Test the structured boolean to see if it +# actually is structured or not. +@dataclass(frozen=True) +class NativeFunctionsGroup: + functional: NativeFunction + inplace: NativeFunction | None + mutable: NativeFunction | None + out: NativeFunction + + @property + def structured(self) -> bool: + # Whether or not the operator has a meta() function. This information is backend-agnostic. + return self.out.structured + + def __post_init__(self) -> None: + test_sig: FunctionSchema = self.functional.func.signature() + for f in self.functions(): + if test_sig != f.func.signature(): + raise AssertionError( + "NativeFunctionsGroup constructed from two NativeFunctions " + f"that don't have matching signatures: {test_sig} != {f.func.signature()}" + ) + + if self.structured != f.part_of_structured_group: + raise AssertionError( + "NativeFunctionsGroup constructed from structured and unstructured " + f"functions: {self.out.func.name} and {f.func.name}" + ) + assert self.functional.func.kind() == SchemaKind.functional + assert self.out.func.kind() == SchemaKind.out + assert self.functional.namespace == self.out.namespace + if self.inplace is not None: + assert self.inplace.func.kind() == SchemaKind.inplace + assert self.inplace.namespace == self.functional.namespace + + if self.mutable is not None: + assert self.mutable.func.kind() == SchemaKind.mutable + assert self.mutable.namespace == self.functional.namespace + # See Note [Overload Ambiguity With Functional Variants] + assert self.functional.func.name.name.functional_overload + + if self.structured: + # For now, structured composite kernels are not supported (need some + # design work to figure out how to make the composite case work) + assert ( + not self.out.has_composite_implicit_autograd_kernel + and not self.out.has_composite_implicit_autograd_nested_tensor_kernel + ) + + assert self.functional.structured_delegate == self.out.func.name, ( + f"{self.functional.func.name} delegates to {self.functional.structured_delegate} " + f"but its actual delegate is {self.out.func.name}" + ) + if self.inplace is not None: + assert self.inplace.structured_delegate == self.out.func.name + + generated_fns = sorted( + [str(f.func.name) for f in self.functions() if "generated" in f.tags] + ) + generated_fns_str = ", ".join(str(x) for x in generated_fns) + expected_generated_fns: set[str] = set() + for f in self.functions(): + expected_generated_fns.update(str(op) for op in f.autogen) + expected_generated_fns_str = ", ".join( + str(x) for x in sorted(expected_generated_fns) + ) + if len(expected_generated_fns) == 0 and len(generated_fns) > 0: + raise RuntimeError( + f"The codegen expects to be able to generate '{generated_fns_str}'." + " In order to generate them however, we expect them to be called out explicitly in the yaml." + f" Please add an 'autogen: {generated_fns_str}' line to the entry for {str(f.func.name)}" + ) + if expected_generated_fns_str != generated_fns_str: + raise RuntimeError( + f"The codegen expects to be able to generate '{generated_fns_str}'." + f" To do so, it expects a line: 'autogen: {generated_fns_str}'." + f" Instead, it found 'autogen: {expected_generated_fns_str}'" + ) + + def signature(self) -> FunctionSchema: + return self.out.func.signature() + + def functions(self) -> Iterator[NativeFunction]: + yield self.functional + yield self.out + if self.inplace is not None: + yield self.inplace + if self.mutable is not None: + yield self.mutable + + @property + def root_name(self) -> str: + return self.functional.root_name + + @staticmethod + def from_dict(d: dict[SchemaKind, NativeFunction]) -> NativeFunctionsGroup | None: + assert d + if len(d) == 1: + return None + d = dict(d) # non-destructive updates please + functional = d.pop(SchemaKind.functional, None) + inplace = d.pop(SchemaKind.inplace, None) + mutable = d.pop(SchemaKind.mutable, None) + out = d.pop(SchemaKind.out, None) + assert not d + assert functional is not None + # There are a few operators which only have functional/inplace variants; + # these don't count as structured for our purposes here + if out is None: + return None + # assuming all variants have the same namespace + return NativeFunctionsGroup( + functional=functional, + inplace=inplace, + mutable=mutable, + out=out, + ) + + +@dataclass(frozen=True) +class BackendMetadata: + # The name of the backend kernel, for a given operator + # for in-tree backends. These names come directly from the 'dispatch" field + # in native_functions.yaml. The dispatch entry is optional; in that + # case, that is equivalent to having written: + # + # dispatch: + # CompositeImplicitAutograd: $operator_name + kernel: str + # Whether or not the operator has a structured kernel implemented, for this particular backend. + # For in-tree backends, they all have the same value for structured- this is listed + # in native_functions.yaml. + # However, external backends like XLA can indendently toggle which ops are structured. + structured: bool + + # The namespace for kernels, default value: DEFAULT_KERNEL_NAMESPACE + cpp_namespace: str + + def supports_symint(self) -> bool: + return "_symint" in self.kernel + + +@dataclass(frozen=True) +class UfuncInnerLoop: + name: str + supported_dtypes: OrderedSet[ScalarType] + # key is stored here because it affects the semantics of name, + # so its helpful to have them together for further processing + ufunc_key: UfuncKey + + @staticmethod + def parse(value: str, ufunc_key: UfuncKey) -> UfuncInnerLoop: + name, supported_dtypes_str = value.split(" ", 1) + assert supported_dtypes_str[0] == "(" + assert supported_dtypes_str[-1] == ")" + supported_dtypes: OrderedSet[ScalarType] = OrderedSet() + for k in supported_dtypes_str[1:-1].split(", "): + supported_dtypes |= ScalarType.parse_set(k) + return UfuncInnerLoop( + name=name, supported_dtypes=supported_dtypes, ufunc_key=ufunc_key + ) + + +# BackendIndex represents a backend. +# The BackendIndex encodes per-operator information that is potentially different +# for each backend. The most obvious example is the name of the kernel +# (the 'dispatch' entry in native_functions.yaml). +# However, there can be other examples of different backends having different information. +# External backends can choose to opt their kernels to be structured independently from in-tree backends, +# which means that this information isn't inherently tied to a NativeFunction- it's different per backend. +@dataclass(frozen=True) +class BackendIndex: + dispatch_key: DispatchKey + # Mainly important for structured kernels, this determines which variant in the operator group is used to implement the others. + # All in-tree ops use out kernels, while XLA uses functional kernels. + use_out_as_primary: bool + # Whether the backend requires a device guard, and device checks. + # For in-tree backends, this is currently just CUDA/HIP + # For out-of-tree backends, this is currently just Intel XPU + device_guard: bool + # Whether the backend is in-tree (CPU/CUDA) or out-of-tree (XLA) + external: bool + # Other backend-specific information that is on a per-operator basis + index: dict[OperatorName, BackendMetadata] + + @staticmethod + def grow_index( + parent_index: dict[DispatchKey, dict[OperatorName, BackendMetadata]], + child_index: dict[DispatchKey, dict[OperatorName, BackendMetadata]], + ) -> None: + for k, v in child_index.items(): + for op_name, metadata in v.items(): + assert op_name not in parent_index[k], ( + f"duplicate operator {op_name} for dispatch key {k}" + ) + parent_index[k][op_name] = metadata + + def primary(self, g: NativeFunctionsGroup) -> NativeFunction: + if self.use_out_as_primary: + return g.out + else: + return g.functional + + def has_kernel(self, g: NativeFunction | NativeFunctionsGroup) -> bool: + m = self.get_kernel(g) + return m is not None + + def get_kernel( + self, g: NativeFunction | NativeFunctionsGroup + ) -> BackendMetadata | None: + if isinstance(g, NativeFunction): + f = g + elif isinstance(g, NativeFunctionsGroup): + f = self.primary(g) + else: + assert_never(g) + if f.func.name not in self.index: + return None + return self.index[f.func.name] + + def native_function_class_name(self) -> str | None: + if self.external: + return f"{str(self.dispatch_key)}NativeFunctions" + else: + # TODO: This discrepancy isn't required; we could also generated + # a class for in-tree kernels. It'll just require carefully + # updating every kernel definition + callsite of every in-tree aten kernel. + return None + + +# The function schema is undoubtedly the most important data structure +# in all of the codegen, as it defines the type signature for operators, +# and most of the code generation we do is type directed (e.g., look at +# the types, decide what to do. Think about how we code generate +# C++ function stubs!) +# +# We will also see in this class the general structure for how we model +# data in this code generation. A few notable properties to point out +# ahead of time: +# +# - These dataclasses are a *lossless* representation of the strings +# they are parsed from. In fact, we assert that given the +# information stored in the dataclass, we can exactly reconstruct +# the string we parsed from (and assert this inside the parse +# definition). There are a few reasons for this: +# +# - If you find that it is difficult to reconstruct the string +# given a dataclass, that is a clue that you are data +# representation is wrong. +# +# - It helps ensure that all relevant information is present +# in the dataclass, so that downstream users aren't tempted +# to reparse the original string to get some information +# that was omitted. +# +# - It forces you to represent the data in-memory in the same way +# it is recorded textually, which makes the dataclasses easier +# to understand for someone who is familiar with the +# textual format. (As a tradeoff, it means you have to model +# the syntax, even when it is inconvenient. But maybe that means +# the syntax is bad!) If you don't understand the internal +# representation, go look at the printing code to see how +# it maps onto the surface syntax! +# +# - It makes it easy to test the parsing code, as parsing code +# that is inconsistent with the string code will fail early +# and loudly. (As a tradeoff, it makes the parsing code a bit +# brittle (in particular, with trivial whitespace changes you +# are likely to trigger an assert error). +# +# In general, try to make the __str__ code as simple as possible +# (even at the cost of more complex parsing logic.) Additionally, +# try to minimize redundancy in data representation. (Precomputed +# fields are OK though: they are defined as a simple function on +# the canonical representation in question.) +# +# - These dataclasses are all frozen; once constructed their +# values never change. This makes it easy to tell where any +# given data came from: just look to the constructor. As a +# tradeoff, you can't easily "decorate" a schema with extra +# information from a post-facto analysis. We impose this +# restriction to make these structures more understandable. +# +@dataclass(frozen=True) +class FunctionSchema: + # The name of the operator this function schema describes. + name: OperatorName + + arguments: Arguments + + # TODO: Need to handle collisions with argument names at some point + returns: tuple[Return, ...] + + @property + def is_mutable(self) -> bool: + def is_write(arg: Argument) -> bool: + if arg.annotation is None: + return False + return arg.annotation.is_write + + # Corresponds to torch._C._FunctionSchema.is_mutable + # See aten/src/ATen/core/function_schema.h (keep these in sync) + return any(is_write(a) for a in self.arguments.flat_all) + + def schema_order_arguments(self) -> Iterator[Argument]: + return itertools.chain( + self.arguments.flat_positional, + self.arguments.flat_kwarg_only, + self.arguments.out, + ) + + decl_re = re.compile(r"(?P[^\(]+)\((?P.*)\) -> (?P.*)") + + @staticmethod + def parse(func: str) -> FunctionSchema: + # We should probably get a proper parser here + decls = FunctionSchema.decl_re.findall(func) + assert len(decls) == 1, f"Invalid function schema: {func}" + ops, args, return_decl = decls[0] + name = OperatorName.parse(ops) + arguments = Arguments.parse(args) + returns = parse_returns(return_decl) + r = FunctionSchema(name=name, arguments=arguments, returns=returns) + assert str(r) == func, f"{str(r)} != {func}" + return r + + def returns_are_aliased(self) -> bool: + # We assert earlier that schemas can't have a mix of aliased and non-aliased returns + return any( + r + for r in self.returns + if r.annotation is not None and r.annotation.is_write + ) + + def __post_init__(self) -> None: + for arg, ret in zip(self.arguments.out, self.returns): + assert arg.annotation == ret.annotation, ( + "Out arguments must have matching return Tensor; furthermore, " + "the ith-argument needs to correspond to the ith return" + ) + # We also enforce that if you have any mutable, positional args, then they are not returned. + # This makes it easier to group these functions properly with their functional/out= counterparts. + for a in self.arguments.post_self_positional_mutable: + assert not any(a.annotation == r.annotation for r in self.returns), ( + f"If you have a schema with mutable positional args, we expect them to not be returned. schema: {str(self)}" + ) + # Invariant: we expect out arguments to appear as keyword arguments in the schema. + # This means that all mutable returns should be aliased to a keyword argument + # (except for "self", which we explicitly don't treat as an out argument because of its use in methods) + # See Note [is_out_fn] + out_and_self = list(self.arguments.out) + [ + arg for arg in self.arguments.flat_positional if arg.name == "self" + ] + mutable_returns = [ + ret + for ret in self.returns + if ret.annotation is not None and ret.annotation.is_write + ] + immutable_returns = [ + ret + for ret in self.returns + if ret.annotation is None or not ret.annotation.is_write + ] + # Some assertions: We don't want any functions with a return type of "-> (Tensor(a!), Tensor)", + # because: + # (1) It's more annoying to handle properly + # (2) It's unnecessary - you can't method-chain on the first (mutated) output because it's part of a tuple. + # Instead, we expect the (a!) argument to not be returned. + assert len(mutable_returns) == 0 or len(immutable_returns) == 0, ( + f"NativeFunctions must have either only mutable returns, or only immutable returns. Found: {str(self)}" + ) + for ret in mutable_returns: + assert any(ret.annotation == arg.annotation for arg in out_and_self), ( + 'All mutable returns must be aliased either to a keyword argument, or to "self". ' + "Did you forget to mark an out argument as keyword-only?" + ) + if self.arguments.out: + # out= ops that return their mutable inputs are only really useful for method chaining. + # And method chaining is only really useful if the thing you're returning is a plain Tensor. + # So ideally, we'd enforce that out= ops with a single plain mutable tensor should return the tensor, + # and all other types of out= op schemas should return void. + # There are a bunch of existing out= ops that return tuples of tensors though, so we're stuck with allowing that. + if any(a.type != BaseType(BaseTy.Tensor) for a in self.arguments.out): + assert len(self.returns) == 0, ( + "out= ops that accept tensor lists as out arguments " + ) + "are expected to have no return type (since you can't do method chaining on them)" + else: + # mutable keyword arguments whose name has _scratch_ prefix are + # scratch tensors for memory planning and should not be returned + assert len( + [ + arg + for arg in self.arguments.out + if not arg.name.startswith("_scratch_") + ] + ) == len(self.returns), ( + "Must return as many arguments as there are out arguments, or no return at all" + ) + + if self.name.name.inplace: + self_a = self.arguments.self_arg + assert ( + self_a + and self_a.argument.annotation + and self_a.argument.annotation.is_write + ) + if self_a.argument.type == BaseType(BaseTy.Tensor): + # All inplace ops with an ordinary `Tensor self` argument should return self, + # to allow for method chaining. + assert ( + len(self.returns) == 1 + and self.returns[0].annotation == self_a.argument.annotation + ) + else: + # You can't method chain on non-tensor self arguments though (like a list[Tensor]) + # so in all other cases we expect the return type to be none. + assert len(self.returns) == 0 + + if self.arguments.tensor_options is not None: + assert self.kind() == SchemaKind.functional, ( + "Found an operator that is not functional or out variant, but has tensor options arguments." + "This is not allowed- tensor options arguments are only allowed for factory functions." + f"schema: {str(self)}" + ) + if self.is_functional_fn(): + assert self.kind() == SchemaKind.functional, ( + "Found an operator that is not functional, but its overload contains the string 'functional'." + "This is a special keyword in the codegen, please use a different overload name." + f"schema: {str(self)}" + ) + + def is_functional_fn(self) -> bool: + return "functional" in self.name.overload_name + + def is_out_fn(self) -> bool: + # Note [is_out_fn] + # + # out functions are the variants which take an explicit out= argument + # to populate into. We need to know if a schema corresponds to an + # out function for several reasons: + # + # - They codegen differently in C++ API + # - codegen to at::add_out rather than at::add + # - out argument is moved to front of C++ argument list + # + # out functions are DEFINED to be any function with a keyword-only + # argument that is mutable. In principle, this could lead to a + # false positive if you define a function that mutates a + # kwarg only argument, but this isn't the "true" output of this + # function. A more robust definition that would work in this + # case would also look at: + # + # - The output types. Out functions take in the arguments + # they mutate and then return them again; this is sort + # of "definitionally" what makes something an out function. + # Historically, we DO check this for consistency. + # - Correspondence with pure variant. An out function + # should have a signature equivalent to its pure variant, + # but just with extra kwargs for the output elements. This + # is difficult to actually check for and historically + # we only do this check in tools/ + return bool(self.arguments.out) + + def kind(self) -> SchemaKind: + """ + What kind of schema is this? A functional schema is one + that returns a newly allocated output; an inplace schema + modifies the self argument inplace; an out schema writes + the result into an explicitly provided out argument. + """ + is_out = bool(self.arguments.out) + is_scratch = bool( + [arg for arg in self.arguments.out if arg.name.startswith("_scratch_")] + ) + is_inplace = self.name.name.inplace + is_mutable = any( + a.annotation is not None and a.annotation.is_write + for a in self.arguments.post_self_positional + ) + assert not (is_out and is_inplace) + # out= and inplace schemas can also have post_self_positional mutable args, + # but we give precedence to out= and inplace when deciding the schema kind. + # Tradeoff: we probably don't want to have to teach codegen that looks at inplace ops + # to also worry about mutable post_self_positional arguments, + # but it seems like a much bigger lift to classify them has having a new schema kind. + # The number of ops that fit in this strange category is small enough that + # we can probably manually write code for them instead of forcing the codegen to handle them. + if is_inplace: + return SchemaKind.inplace + elif is_scratch: + assert is_out, ( + "invariant: all scratch operators are expected to be out= operators too" + ) + return SchemaKind.scratch + elif is_out: + assert not is_scratch, ( + "We should not categorize a scratch op as an out variant. Check if the order of if statements are expected!" + ) # noqa: B950 + return SchemaKind.out + elif is_mutable: + return SchemaKind.mutable + else: + return SchemaKind.functional + + # For every return: + # - If the return aliases an input, we return the input name + # - Otherwise, we return None. + # If return names were enforced to be consistent with aliasing information, then we wouldn't need this. + def aliased_return_names(self) -> list[str | None]: + outs: list[str | None] = [] + for r in self.returns: + aliased_args = [ + a + for a in self.arguments.flat_all + if a.annotation is not None and a.annotation == r.annotation + ] + if len(aliased_args) == 0: + outs.append(None) + elif len(aliased_args) == 1: + outs.append(aliased_args[0].name) + else: + aliased_names = ", ".join(a.name for a in aliased_args) + raise AssertionError( + f"Found a return ({r.name})that aliases multiple inputs ({aliased_names})" + ) + return outs + + def signature( + self, + *, + strip_default: bool = False, + strip_view_copy_name: bool = False, + keep_return_names: bool = False, + ) -> FunctionSchema: + """ + Certain schemas are 'related', in that they are simply + inplace/out/functional versions of the same function. This method + factors these schemas into the "core" functional signature which + is equal across all versions. + + Here is what normalization happens to the schema to convert + it to a signature: + - The overload name is stripped (name is retained, since + it expresses semantic content about what the function does) + - Inplace is set False + - Out arguments are stripped + - Mutable post_self_positional args are converted to returns + - Mutability annotations are stripped (this is sound + because you cannot overload on mutability annotation) + - Return names are stripped since they are not overloadable and + some variants have return names but some not + - TensorOptions are dropped + because out= variants of factory functions don't include them + (and we want to be able to pair up factory functions with their out variants) + + Finally, we want to be able to pair up related "view" and their + corresponding "view_copy" operators. We do this by optionally + stripping the trailing "_copy" from the base name. + + Example of a mutable op before and after: + + f.func (Mutable operator): + _fused_moving_avg_obs_fq_helper(Tensor self, Tensor observer_on, Tensor fake_quant_on, Tensor(a!) running_min, Tensor(b!) running_max, Tensor(c!) scale, Tensor(d!) zero_point, float averaging_const, int quant_min, int quant_max, int ch_axis, bool per_row_fake_quant=False, bool symmetric_quant=False) -> (Tensor output, Tensor mask) # noqa: B950 + + f.func (Corresponding functional operator): + _fused_moving_avg_obs_fq_helper.functional(Tensor self, Tensor observer_on, Tensor fake_quant_on, Tensor running_min, Tensor running_max, Tensor scale, Tensor zero_point, float averaging_const, int quant_min, int quant_max, int ch_axis, bool per_row_fake_quant=False, bool symmetric_quant=False) -> (Tensor output, Tensor mask, Tensor running_min_out, Tensor running_max_out, Tensor scale_out, Tensor zero_point_out) # noqa: B950 + + f.func.signature() output: + _fused_moving_avg_obs_fq_helper(Tensor self, Tensor observer_on, Tensor fake_quant_on, Tensor running_min, Tensor running_max, Tensor scale, Tensor zero_point, float averaging_const, int quant_min, int quant_max, int ch_axis, bool per_row_fake_quant=False, bool symmetric_quant=False) -> (Tensor, Tensor, Tensor, Tensor, Tensor, Tensor) # noqa: B950 + """ + + def strip_ret_annotation(r: Return) -> Return: + return Return( + name=r.name if keep_return_names else None, + type=r.type, + annotation=None, + ) + + base_name = self.name.name.base + if strip_view_copy_name: + if base_name.endswith("_copy"): + base_name = base_name.replace("_copy", "") + elif base_name.endswith("_scatter"): + base_name = base_name.replace("scatter", "inverse") + + # find mutable inputs that are not originally returned, and convert them to returns + returns_from_mutable_inputs = tuple( + # When we're grouping functions we strip the return names, + # but when we're generating the actual functional variants then we follow + # a convention for what to name the returns + Return( + name=f"{a.name}_out" if keep_return_names else None, + type=a.type, + annotation=None, + ) + for a in itertools.chain( + # Order is important here (otherwise e.g. inplace with mutable args + # and out= with mutable args won't have the same signature) + ( + [self.arguments.self_arg.argument] + if self.arguments.self_arg is not None + else [] + ), + self.arguments.out, + self.arguments.post_self_positional, + ) + if a.annotation is not None + and a.annotation.is_write + and not any(a.annotation == r.annotation for r in self.returns) + ) + original_returns = tuple(map(strip_ret_annotation, self.returns)) + # Ordering is important here. We expect the "mutable input" returns to come last. + returns = original_returns + returns_from_mutable_inputs + + args_sig = self.arguments.signature(strip_default=strip_default) + # See Note [bernoulli.p schema] + if str(self.name) == "bernoulli.p": + args_sig = Arguments.parse(str(args_sig).replace("float p", "float p=0.5")) + + return FunctionSchema( + name=OperatorName( + name=BaseOperatorName( + base=base_name, + inplace=False, + dunder_method=self.name.name.dunder_method, + ), + overload_name="", # stripped + ), + arguments=args_sig, + returns=returns, + ) + + def view_signature(self) -> FunctionSchema: + return self.signature(strip_view_copy_name=True) + + def with_name(self, name: OperatorName) -> FunctionSchema: + return FunctionSchema( + name=name, + arguments=self.arguments, + returns=self.returns, + ) + + @property + def modifies_arguments(self) -> bool: + return self.kind() in [SchemaKind.inplace, SchemaKind.out, SchemaKind.mutable] + + def has_symint(self) -> bool: + return self.arguments.has_symint_arg() + + def __str__(self) -> str: + all_arguments_str = str(self.arguments) + if len(self.returns) == 1: + returns = str(self.returns[0]) # omit parentheses + else: + returns = "(" + ", ".join(map(str, self.returns)) + ")" + return f"{self.name}({all_arguments_str}) -> {returns}" + + +# Here is the rest of the data model, described more briefly. + + +# Simplified version for what actually shows up in built-ins. +# Look at alias_info.h for expanded syntax. If you need the structure, +# you also need to make this structure recursive so it can be lined +# up with the type components too. For primitives this isn't really +# necessary +@dataclass(frozen=True) +class Annotation: + # Typically only has one element. Not actually a set so + # we can conveniently assume it is canonically ordered + alias_set: tuple[str, ...] + is_write: bool + alias_set_after: tuple[str, ...] + + @staticmethod + def parse(ann: str) -> Annotation: + # TODO: implement a proper parser if this gets more ugly + # Regex Explanation: + # Example: "a! -> a|b" + # Group #1: alias before optional '|', required. Matches the first + # character 'a' in the example + # Group #2: optional alias set after optional '|', matches empty string + # in the example + # Group #3: optional "is write" flag, matches '!' in the example. + # Group #4: optional section containing arrow, matches " -> a|b" in the + # example. + # Group #5: optional alias after set, supports wildcard, matches "a|b" + # in the example. + # Group #6: optional sub-section of alias after set, matches "|b" in the + # example. + m = re.match(r"^([a-z])(\|[a-z])*(!?)( -> (\*|[a-z](\|[a-z])*))?$", ann) + + assert m is not None, f"unrecognized alias annotation {ann}" + before_alias = m.group(1) + (m.group(2) if m.group(2) else "") + alias_set = tuple(before_alias.split("|")) + is_write = m.group(3) == "!" + assert not (is_write and len(alias_set) > 1), ( + f"alias set larger than 1 is not mutable, got {ann} instead." + ) + after_set = tuple(m.group(5).split("|")) if m.group(5) else () + assert not (len(before_alias) > 1 and len(after_set) > 1), ( + f"before alias set and after alias set cannot be larger than 1 at the same time, got {ann} instead." + ) + r = Annotation( + alias_set=alias_set, is_write=is_write, alias_set_after=after_set + ) + assert str(r) == ann, f"{r} != {ann}" + return r + + def __str__(self) -> str: + alias_set = "|".join(self.alias_set) + if self.is_write: + alias_set = f"{alias_set}!" + alias_set_after = "|".join(self.alias_set_after) + if alias_set_after: + alias_set = f"{alias_set} -> {alias_set_after}" + return alias_set + + +# The base class for the type system. This is also loosely modeled +# off of jit_type.h, but we've simplified the hierarchy to focus +# in on the aspects of the type system that matter for code generation +# (for example, there's no SingleElementType subclass anymore). +# You never actually construct a Type; usually it's going to be one +# of the subclasses. If Python had ADTs this would be one! +@dataclass(frozen=True) +class Type: + @staticmethod + def parse(t: str) -> Type: + r = Type._parse(t) + assert str(r) == t, f"{r} != {t}" + return r + + @staticmethod + def _parse(t: str) -> Type: + m = re.match(r"^(.+)\?$", t) + if m is not None: + return OptionalType(Type.parse(m.group(1))) + m = re.match(r"^(.+)\[([0-9]+)?\]$", t) + if m is not None: + size = int(m.group(2)) if m.group(2) is not None else None + return ListType(elem=Type.parse(m.group(1)), size=size) + + # '__torch__.torch.classes.' is the prefix for custom class + m = re.match(r"^__torch__\.torch\.classes\.([a-zA-Z0-9_.]+)$", t) + if m is not None: + return CustomClassType(m.group(1)) + try: + return BaseType(BaseTy[t]) + except KeyError as e: + raise RuntimeError(f"unrecognized type {t}") from e + + def __str__(self) -> str: + raise NotImplementedError + + # WARNING: These concepts are not very well-defined. For example, + # is "int?" nullable? How about "int?[]". They are defined + # so we can conveniently generate legacy Declarations.yaml but + # really we should probably just remove these at some point + + def is_base_ty_like(self, base_ty: BaseTy) -> bool: + raise NotImplementedError + + def is_tensor_like(self) -> bool: + return self.is_base_ty_like(BaseTy.Tensor) + + def is_generator_like(self) -> bool: + return self.is_base_ty_like(BaseTy.Generator) + + def is_symint_like(self) -> bool: + return self.is_base_ty_like(BaseTy.SymInt) + + def is_nullable(self) -> bool: + raise NotImplementedError + + def is_list_like(self) -> ListType | None: + raise NotImplementedError + + +# Base types are simple, atomic types with no further structure +class BaseTy(Enum): + Generator = auto() + ScalarType = auto() + Tensor = auto() + int = auto() + Dimname = auto() + DimVector = auto() + float = auto() + str = auto() + bool = auto() + Layout = auto() + Device = auto() + DeviceIndex = auto() + Scalar = auto() + MemoryFormat = auto() + QScheme = auto() + Storage = auto() + Stream = auto() + SymInt = auto() + SymBool = auto() + GraphModule = auto() + + +@dataclass(frozen=True) +class BaseType(Type): + name: BaseTy + + def __str__(self) -> str: + return f"{self.name.name}" + + def is_base_ty_like(self, base_ty: BaseTy) -> bool: + return self.name == base_ty + + def is_nullable(self) -> bool: + return False + + def is_list_like(self) -> ListType | None: + return None + + def is_symint_like(self) -> bool: + return self.name == BaseTy.SymInt + + +# Optional types may be specified, or may also be validly given None +@dataclass(frozen=True) +class OptionalType(Type): + elem: Type + + def __str__(self) -> str: + return f"{self.elem}?" + + def is_base_ty_like(self, base_ty: BaseTy) -> bool: + return self.elem.is_base_ty_like(base_ty) + + def is_symint_like(self) -> bool: + return self.elem.is_symint_like() + + def is_nullable(self) -> bool: + return True + + def is_list_like(self) -> ListType | None: + return self.elem.is_list_like() + + +# A type representing a PyTorch custom class +@dataclass(frozen=True) +class CustomClassType(Type): + class_name: str + + def __str__(self) -> str: + """ + Return the class name will prefix __torch__.torch.classes + """ + return f"__torch__.torch.classes.{self.class_name}" + + def is_base_ty_like(self, base_ty: BaseTy) -> bool: + return False + + def is_symint_like(self) -> bool: + return False + + def is_nullable(self) -> bool: + """ + Assume a custom class is not nullable. + """ + return False + + def is_list_like(self) -> ListType | None: + return None + + +# List types specify that we may have multiples of an element. We +# also support explicit sizes on list types, but these have +# some nontrivial semantics! (However, for C++ API purposes, explicit +# sizes are mostly erased from the type system.) +# +# DANGER WILL ROBINSON: C++ elaboration depends on elem type; e.g., +# int[] elaborates differently than bool[3]! +@dataclass(frozen=True) +class ListType(Type): + elem: Type + size: int | None + + def __str__(self) -> str: + size = f"{self.size}" if self.size else "" + return f"{self.elem}[{size}]" + + def is_base_ty_like(self, base_ty: BaseTy) -> bool: + return self.elem.is_base_ty_like(base_ty) + + def is_symint_like(self) -> bool: + return self.elem.is_symint_like() + + def is_nullable(self) -> bool: + return self.elem.is_nullable() + + def is_list_like(self) -> ListType | None: + return self + + +@dataclass(frozen=True) +class Argument: + # NB: I didn't put kwarg_only as a boolean field here, unlike + # c10::Argument, so that printing works correctly + + name: str + type: Type + default: str | None + + # The semantics of the annotation field are a little strange. + # + # Alias annotations parametrize Tensors (since Tensors are the only things + # that can alias.) This motivates why I write Tensor(a!)? (and not, for + # example, Tensor?(a!)), because the (a!) describes aliasing on the tensor, + # which may be optional (i.e., the alias annotation should bind first to + # Tensor, before the optional postfix annotation). + # + # However, despite being a property of Tensor, we (and c10::Argument) + # store the annotation at the top level of the Argument, rather than + # inside the embedded Tensor type. In the C++ version of this + # class, we then go through great lengths to mimic the type + # structure in the annotation structure so we can correlate + # annotations with types. + # + # Now, it turns out, in all applications in code generation, the + # structure of annotated types is very simple. So we just hard + # code it here. But if we ever do get anything more complex, this + # model will have to change! + annotation: Annotation | None + + @property + def alias_info(self) -> Annotation | None: + return self.annotation + + @staticmethod + def parse(arg: str) -> Argument: + name: str + default: str | None + assert " " in arg, f"illegal argument '{arg}'" + if "=" in arg: + assert arg.count("=") == 1, f"illegal argument with default value: '{arg}'" + type_and_annot_and_name, default = arg.split("=") + type_and_annot, name = type_and_annot_and_name.rsplit(" ", 1) + name_and_default = f"{name}={default}" + else: + type_and_annot, name_and_default = arg.rsplit(" ", 1) + name = name_and_default + default = None + # TODO: deduplicate annotation matching with Return + match = re.match(r"Tensor\((.+)\)(.*)", type_and_annot) + annotation: Annotation | None + if match: + # If you update this, make sure the __str__ still works too + assert match.group(2) in [ + "", + "?", + "[]", + ], "unrecognized alias analysis form with Tensor" + type_s = "Tensor" + match.group(2) + annotation = Annotation.parse(match.group(1)) + else: + type_s = type_and_annot + annotation = None + type = Type.parse(type_s) + r = Argument( + name=name, + type=type, + default=default, + annotation=annotation, + ) + assert str(r) == arg, f"{str(r)} != {arg}" + return r + + @property + def is_write(self) -> bool: + return self.annotation is not None and self.annotation.is_write + + def __str__(self) -> str: + type = f"{self.type}" + if self.annotation: + assert type in ["Tensor", "Tensor?", "Tensor[]"] + type = type.replace("Tensor", f"Tensor({self.annotation})") + if self.name is None: + return type + else: + mb_default = "" + if self.default: + mb_default = f"={self.default}" + return f"{type} {self.name}{mb_default}" + + +@dataclass(frozen=True) +class Return: + name: str | None + type: Type + annotation: Annotation | None + + @property + def alias_info(self) -> Annotation | None: + return self.annotation + + @staticmethod + def parse(arg: str) -> Return: + name: str | None + if " " in arg: + type_and_annot, name = arg.rsplit(" ", 1) + else: + type_and_annot = arg + name = None + match = re.match(r"Tensor\((.+)\)(.*)", type_and_annot) + annotation: Annotation | None + if match: + # If you update this, make sure the __str__ still works too + assert match.group(2) in [ + "", + "?", + "[]", + ], "unrecognized alias analysis form with Tensor" + type_s = "Tensor" + match.group(2) + annotation = Annotation.parse(match.group(1)) + else: + type_s = type_and_annot + annotation = None + type = Type.parse(type_s) + r = Return( + name=name, + type=type, + annotation=annotation, + ) + assert str(r) == arg, f"{str(r)} != {arg}" + return r + + @property + def is_write(self) -> bool: + return self.annotation is not None and self.annotation.is_write + + def __str__(self) -> str: + type = f"{self.type}" + if self.annotation: + assert type in ["Tensor", "Tensor?", "Tensor[]"] + type = type.replace("Tensor", f"Tensor({self.annotation})") + if self.name is None: + return type + else: + return f"{type} {self.name}" + + +# Represents the self argument for functions that may be methods +@dataclass(frozen=True) +class SelfArgument: + argument: Argument + + +# Bundle of arguments that represent a TensorOptions. This is mostly +# relevant for the public C++ API but we bake it into the core data +# model because other APIs often have to interact with it +@dataclass(frozen=True) +class TensorOptionsArguments: + dtype: Argument + layout: Argument + device: Argument + pin_memory: Argument + + def all(self) -> Sequence[Argument]: + return [self.dtype, self.layout, self.device, self.pin_memory] + + +@dataclass(frozen=True) +class Arguments: + # pre_self_positional is usually empty, but is notably non-empty + # for where.self, where the condition argument comes before the + # self argument + pre_self_positional: tuple[Argument, ...] + self_arg: SelfArgument | None + post_self_positional: tuple[Argument, ...] + + pre_tensor_options_kwarg_only: tuple[Argument, ...] + tensor_options: TensorOptionsArguments | None + # post_tensor_options is typically memory format, which should be + # part of tensor options but isn't right now, and is usually + # placed after the tensor options arguments + post_tensor_options_kwarg_only: tuple[Argument, ...] + + # Unlike in the previous codegen, we have factored out 'out' arguments + # in the canonical representation, removing them from kwarg + # arguments. This choice is justified by numerous downstream + # transformations which treat out arguments specially; additionally, + # you can see that canonicity is not violated! + out: tuple[Argument, ...] # these are also kwarg-only + + @property + def flat_non_out(self) -> Sequence[Argument]: + ret: list[Argument] = [] + ret.extend(self.flat_positional) + ret.extend(self.flat_kwarg_only) + return ret + + @property + def flat_positional(self) -> Sequence[Argument]: + ret: list[Argument] = [] + ret.extend(self.pre_self_positional) + if self.self_arg is not None: + ret.append(self.self_arg.argument) + ret.extend(self.post_self_positional) + return ret + + @property + def post_self_positional_mutable(self) -> Sequence[Argument]: + return [a for a in self.post_self_positional if a.is_write] + + # NB: doesn't contain out arguments + @property + def flat_kwarg_only(self) -> Sequence[Argument]: + ret: list[Argument] = [] + ret.extend(self.pre_tensor_options_kwarg_only) + if self.tensor_options is not None: + ret.extend(self.tensor_options.all()) + ret.extend(self.post_tensor_options_kwarg_only) + return ret + + @property + def flat_all(self) -> Sequence[Argument]: + ret: list[Argument] = [] + ret.extend(self.flat_positional) + ret.extend(self.flat_kwarg_only) + ret.extend(self.out) + return ret + + @property + def non_out( + self, + ) -> Sequence[Argument | SelfArgument | TensorOptionsArguments]: + ret: list[Argument | SelfArgument | TensorOptionsArguments] = [] + ret.extend(self.positional) + ret.extend(self.kwarg_only) + return ret + + @property + def positional(self) -> Sequence[Argument | SelfArgument]: + ret: list[Argument | SelfArgument] = [] + ret.extend(self.pre_self_positional) + if self.self_arg is not None: + ret.append(self.self_arg) + ret.extend(self.post_self_positional) + return ret + + @property + def kwarg_only(self) -> Sequence[Argument | TensorOptionsArguments]: + ret: list[Argument | TensorOptionsArguments] = [] + ret.extend(self.pre_tensor_options_kwarg_only) + if self.tensor_options is not None: + ret.append(self.tensor_options) + ret.extend(self.post_tensor_options_kwarg_only) + return ret + + @property + def all(self) -> Sequence[Argument | SelfArgument | TensorOptionsArguments]: + ret: list[Argument | SelfArgument | TensorOptionsArguments] = [] + ret.extend(self.positional) + ret.extend(self.kwarg_only) + ret.extend(self.out) + return ret + + def mutable_arg_names(self) -> list[str]: + return [ + a.name + for a in self.flat_all + if a.annotation is not None and a.annotation.is_write + ] + + def has_tensor_arg(self) -> bool: + return any(a.type.is_tensor_like() for a in self.flat_non_out) + + def has_symint_arg(self) -> bool: + return any(a.type.is_symint_like() for a in self.flat_non_out) + + def has_generator_arg(self) -> bool: + return any(a.type.is_generator_like() for a in self.flat_non_out) + + def signature(self, *, strip_default: bool = False) -> Arguments: + # dataclasses.replace could be used here, but it is less + # type safe so for now I've opted to type everything out + def strip_arg_annotation(a: Argument) -> Argument: + return Argument( + name=a.name, + type=a.type, + default=a.default if not strip_default else None, + annotation=None, + ) + + return Arguments( + pre_self_positional=tuple( + map(strip_arg_annotation, self.pre_self_positional) + ), + self_arg=( + SelfArgument(strip_arg_annotation(self.self_arg.argument)) + if self.self_arg is not None + else None + ), + post_self_positional=tuple( + map(strip_arg_annotation, self.post_self_positional) + ), + # Since TensorOptions are dropped, the post_tensor_options_kwargs are + # converted to pre_tensor_options_kwargs + pre_tensor_options_kwarg_only=tuple( + map(strip_arg_annotation, self.pre_tensor_options_kwarg_only) + ) + + tuple(map(strip_arg_annotation, self.post_tensor_options_kwarg_only)), + # TensorOptions are dropped in signature, + # so we can pair factory functions with their out= variants. + tensor_options=None, + post_tensor_options_kwarg_only=(), + # out arguments are dropped in signature + out=(), + ) + + def remove_self_annotation(self) -> Arguments: + assert self.self_arg is not None + return dataclasses.replace( + self, + self_arg=SelfArgument( + dataclasses.replace(self.self_arg.argument, annotation=None) + ), + ) + + def with_out_args(self, outs: list[Argument]) -> Arguments: + assert len(self.out) == 0 + return dataclasses.replace( + self, + out=tuple(outs), + ) + + @staticmethod + def _preparse(args: str) -> tuple[list[Argument], list[Argument], list[Argument]]: + positional: list[Argument] = [] + kwarg_only: list[Argument] = [] + out: list[Argument] = [] + arguments_acc = positional + + # TODO: Use a real parser here; this will get bamboozled + # by signatures that contain things like std::array (note the space) + for arg in args.split(", "): + if not arg: + continue + if arg == "*": + assert arguments_acc is positional, ( + "invalid syntax: kwarg-only specifier * can only occur once" + ) + arguments_acc = kwarg_only + continue + parg = Argument.parse(arg) + # Currently, we rely directly on the invariant that there are NO + # kwarg-only mutating arguments. If you want to relax this, + # we will need a more semantic way of matching that takes + # into account return arguments. In that case, you will have + # to manage out computation a level up, in FunctionSchema. See Note + # [is_out_fn] + if parg.annotation is not None and parg.annotation.is_write: + if arguments_acc is positional: + pass # do nothing + elif arguments_acc is kwarg_only: + arguments_acc = out + else: + assert arguments_acc is not out + arguments_acc.append(parg) + + return positional, kwarg_only, out + + @staticmethod + def parse(args: str) -> Arguments: + """ + Input: 'int x, int y, int z' + """ + + # We do this in two phases. First we parse into three + # main categories: positional, kwarg_only, out. + # Then, we reparse positional and kwarg_only to separate + # out the self argument and tensor options arguments. + + positional, kwarg_only, out = Arguments._preparse(args) + + # Split self argument + self_ix = None + for i, a in enumerate(positional): + if a.name == "self": + self_ix = i + break + pre_self_positional: list[Argument] + self_arg: SelfArgument | None + post_self_positional: list[Argument] + if self_ix is not None: + pre_self_positional = positional[:self_ix] + self_arg = SelfArgument(positional[self_ix]) + post_self_positional = positional[self_ix + 1 :] + else: + pre_self_positional = [] + self_arg = None + post_self_positional = positional + + # Group tensor options arguments + pre_tensor_options_kwarg_only: list[Argument] = [] + tensor_options: TensorOptionsArguments | None = None + post_tensor_options_kwarg_only: list[Argument] = [] + kwarg_only_acc = pre_tensor_options_kwarg_only + + def pred(name: str, ty: Type) -> Callable[[Argument], bool]: + return lambda a: a.name == name and a.type in [ty, OptionalType(ty)] + + predicates = [ # order matters + pred("dtype", Type.parse("ScalarType")), + pred("layout", Type.parse("Layout")), + pred("device", Type.parse("Device")), + pred("pin_memory", Type.parse("bool")), + ] + + i = 0 + while i < len(kwarg_only): + # If there is enough space... + if i <= len(kwarg_only) - len(predicates): + # And the next len(predicates) arguments look like TensorOptions arguments + if all( + p(a) + for p, a in zip(predicates, kwarg_only[i : i + len(predicates)]) + ): + assert kwarg_only_acc is pre_tensor_options_kwarg_only + # Group them together as one argument + tensor_options = TensorOptionsArguments( + dtype=kwarg_only[i], + layout=kwarg_only[i + 1], + device=kwarg_only[i + 2], + pin_memory=kwarg_only[i + 3], + ) + i += len(predicates) + kwarg_only_acc = post_tensor_options_kwarg_only + continue + kwarg_only_acc.append(kwarg_only[i]) + i += 1 + + return Arguments( + pre_self_positional=tuple(pre_self_positional), + self_arg=self_arg, + post_self_positional=tuple(post_self_positional), + pre_tensor_options_kwarg_only=tuple(pre_tensor_options_kwarg_only), + tensor_options=tensor_options, + post_tensor_options_kwarg_only=tuple(post_tensor_options_kwarg_only), + out=tuple(out), + ) + + def __str__(self) -> str: + all_arguments: list[str] = [] + all_arguments.extend(map(str, self.flat_positional)) + if self.flat_kwarg_only or self.out: + all_arguments.append("*") + all_arguments.extend(map(str, self.flat_kwarg_only)) + all_arguments.extend(map(str, self.out)) + return ", ".join(all_arguments) + + def __post_init__(self) -> None: + # TODO: These invariants are weirdly asymmetric? + # TODO: Fancier types? + if self.self_arg is None: + assert not self.pre_self_positional + if self.tensor_options is None: + assert not self.post_tensor_options_kwarg_only + + # We don't allow any of the following to have argument annotations, + # to keep things simple. + mutable_pre_self_positionals = [ + a + for a in self.pre_self_positional + if a.annotation is not None and a.annotation.is_write + ] + assert len(mutable_pre_self_positionals) == 0, ( + "mutable pre_self_positional arguments are not currently supported in the schema" + ) + + +# Names that validly are __iXXX__ indicating inplace operations. +# Taken from https://www.python.org/dev/peps/pep-0203/#new-methods +# NB: PyTorch hasn't actually implemented all of these +AUGMENTED_ASSIGNMENT_NAMES = [ + "add", + "sub", + "mul", + "div", + "mod", + "pow", + "lshift", + "rshift", + "and", + "xor", + "or", +] + + +# A BaseOperatorName is what we think of the operator name, without +# the overload name. Unusually, we don't represent this as just a +# string; instead, we directly represent a few important semantic +# bits of information we derive from the string: namely whether +# or not it's inplace (add_) and whether or not it's a double-underscore +# method (__add__) +@dataclass(frozen=True) +class BaseOperatorName: + base: str + inplace: bool + dunder_method: bool + # Note [Overload Ambiguity With Functional Variants] + # A handful of operators have both a "mutable" and a "functional" variant. + # (native_batch_norm is a good example, although this isn't the case today). + # For those operators, the mutable and functional variant take in the same set of + # arguments, but have different alias annotations. + # this makes it ambiguous when you try to resolve an OverloadPacket into an overload, + # given a set of input arguments. + # + # So instead of making the "functional" variant in this case a real overload, e.g: + # native_batch_norm (mutable variant) + # native_batch_norm.functional (functional variant) + # we make it a new base operator, + # native_batch_norm_functional (functional variant) + # + # In an ideal world, we would probably invert this so the operators were: + # native_batch_norm.mutable (mutable variant) + # native_batch_norm (functional variant) + # + # Doing that is BC-breaking though, so we're stuck with the above modeling. + functional_overload: bool = False + + # NB: We don't officially support namespace in FunctionSchema, we treat this prefix + # as part of the base operator name, for __str__() to consume. + # The canonical input (from the rest of the infra) will not contain namespace, but + # we have a usecase in ExecuTorch where we want to support BaseOperatorName with namespace. + namespace: str | None = None + + @staticmethod + def parse(op: str) -> BaseOperatorName: + assert op != "" + assert not op.endswith("_out"), ( + "_out suffix is reserved and not permitted for operator names; " + "did you mean to specify an out overload name instead?" + ) + # Extract namespace out. Base operator name may or may not contain namespace. + # E.g., aten::__lshift__ is a valid base operator name, __lshift__ is also valid. + # We want to split the namespace out from the base operator name. + match = re.match(r"^(?:(.*)::)?(.*)$", op) + namespace = match.group(1) if match else "" + op_without_ns = match.group(2) if match else op + m = re.match(r"^__([^_]+)__$", op_without_ns) + if m is not None: + dunder_method = True + base = m.group(1) + if any(base == f"i{n}" for n in AUGMENTED_ASSIGNMENT_NAMES): + inplace = True + base = base[1:] + else: + inplace = False + # temporary, this is not intrinsically true but + # has been historically true for dunder methods + # we support (but, if we ever got, say, __int__, this would + # be wrong!) + assert base[0] != "i" + else: + dunder_method = False + base = op_without_ns + if base[-1] == "_": + inplace = True + base = base[:-1] + else: + inplace = False + + # See Note [Overload Ambiguity With Functional Variants] + functional_suffix = "_functional" + if base.endswith(functional_suffix): + functional_overload = True + base = base[: -len(functional_suffix)] + # This seems complicated and unnecessary, so banning dunder methods + # for now on ops that have a functional + mutable variant (like native_batch_norm). + assert not dunder_method and not inplace + else: + functional_overload = False + + r = BaseOperatorName( + base=base, + inplace=inplace, + dunder_method=dunder_method, + functional_overload=functional_overload, + namespace=namespace, + ) + assert str(r) == op, f"{str(r)} != {op}" + return r + + def __str__(self) -> str: + namespace_prefix = f"{self.namespace}::" if self.namespace else "" + if self.dunder_method: + i = "i" if self.inplace else "" + return f"{namespace_prefix}__{i}{self.base}__" + else: + i = ( + "_" + if self.inplace + else "_functional" + if self.functional_overload + else "" + ) + return f"{namespace_prefix}{self.base}{i}" + + +# Operator name is the base operator name along with the (typically not +# user visible) overload string. +@dataclass(frozen=True) +class OperatorName: + name: BaseOperatorName + overload_name: str + + @staticmethod + def parse(op_name: str) -> OperatorName: + if "." in op_name: + name, overload_name = op_name.split(".", 1) + else: + name = op_name + overload_name = "" + r = OperatorName(name=BaseOperatorName.parse(name), overload_name=overload_name) + assert str(r) == op_name, f"{str(r)} != {op_name}" + return r + + def __str__(self) -> str: + if self.overload_name: + return f"{self.name}.{self.overload_name}" + else: + return f"{self.name}" + + # NB: This must be synchronized with the naming scheme in + # aten/src/ATen/templates/Operators.h + # Given a function schema "aten::op.overload(...)", + # If there is no overload name, this returns f"{op}" + # If there is an overload name, this returns f"{op}_{overload}" + def unambiguous_name(self) -> str: + if self.overload_name: + return f"{self.name}_{self.overload_name}" + else: + return f"{self.name}" + + def remove_inplace(self) -> OperatorName: + return OperatorName( + name=BaseOperatorName( + base=self.name.base, + inplace=False, + dunder_method=self.name.dunder_method, + ), + overload_name=self.overload_name, + ) + + def with_overload(self, overload: str) -> OperatorName: + return OperatorName( + name=BaseOperatorName( + base=self.name.base, + inplace=False, + dunder_method=self.name.dunder_method, + ), + overload_name=overload, + ) + + +def gets_generated_out_inplace_wrapper( + f: NativeFunction, g: NativeFunctionsGroup, b: BackendIndex +) -> bool: + return ( + f.func.kind() is not SchemaKind.functional + and not b.has_kernel(f) + and b.has_kernel(g.functional) + ) + + +# NativeFunction objects that are views (f.is_view_op returns True) +# are added into a `NativeFunctionsViewGroup`, which we can use to +# easily access the generated (optional) view_copy NativeFunction. +# It's convenient to group them together, so we pair them up in NativeFunctionsViewGroup. +# See Note [Codegen'd {view}_copy Operators] +# +# One property of this representation is that in order for a view-like op to be part of +# a NativeFunctionsViewGroup, the "aliasing" version of that view op must exist. +# There's one case where that doesn't happen: we have a non-aliasing `narrow_copy.out` op, +# but don't have corresponding aliasing `narrow.out` op. +# This means that `narrow_copy.out` won't appear as a NativeFunctionsViewGroup. +@dataclass(frozen=True) +class NativeFunctionsViewGroup: + view: NativeFunction + # Note: the {view}_copy operator is optional because we currently don't generate copy variants + # for all view ops. Notably, we don't generate them for CompositeImplicitAutograd views + # (we already get them "for free" through decomposition) + view_copy: NativeFunction | None + # view_inplace ops are also optional, but every view_inplace op should have out-of-place variant. + view_inplace: NativeFunction | None + + def __post_init__(self) -> None: + assert self.view.is_view_op + if self.view_copy is None: + assert not gets_generated_view_copy(self.view), ( + f"{str(self.view.func.name)} appears to be a new operator that aliases its inputs." + " The codegen expects you to add a corresponding operator to native_functions.yaml:" + f" {get_view_copy_name(self.view)!s}." + " See Note [view_copy NativeFunctions] for details." + ) + else: + assert self.view_copy.func.name.name.base.endswith(("_copy", "_scatter")) + assert self.view.func.signature() == self.view_copy.func.signature( + strip_view_copy_name=True, + ) + assert "view_copy" in self.view_copy.tags, ( + f"{str(self.view_copy.func.name), str(self.view.tags)} appears to be a view_copy operator. The codegen expects" + " view_copy operators to be annotated with the 'view_copy' tag in native_functions.yaml." + " See Note [view_copy NativeFunction] for details." + ) + if self.view_inplace is not None: + assert self.view.func.signature() == self.view_inplace.func.signature() + + if self.view.has_composite_implicit_autograd_kernel: + if self.view_inplace is not None: + assert self.view_inplace.has_composite_implicit_autograd_kernel, ( + f"{str(self.view.func.name)} and {str(self.view_inplace.func.name)} must either" + " both have CompositeImplicitAutograd kernels, or both not have composite kernels." + ) + if self.view.has_composite_implicit_autograd_nested_tensor_kernel: + if self.view_inplace is not None: + assert self.view_inplace.has_composite_implicit_autograd_nested_tensor_kernel, ( + f"{str(self.view.func.name)} and {str(self.view_inplace.func.name)} must either" + " both have CompositeImplicitAutogradNestedTensor kernels, or both not have composite kernels." + ) + + def functions(self, *, include_copy: bool = True) -> Iterator[NativeFunction]: + yield self.view + if self.view_inplace is not None: + yield self.view_inplace + if self.view_copy is not None and include_copy: + yield self.view_copy + + @property + def root_name(self) -> str: + return self.view.root_name + + @property + def composite(self) -> bool: + # We currently assert that the "group" is consistent. + # If the view op is composite, then its view_inplace op is too. + return self.view.has_composite_implicit_autograd_kernel + + +def gets_generated_view_copy(f: NativeFunction) -> bool: + # Only aliasing (view) operators get a copy variant. + if not f.is_view_op: + return False + # We don't need to bother generating copy variants for CompositeImplicitAutograd ops, + # because we can let them decompose into base view ops. + if f.has_composite_implicit_autograd_kernel: + return False + # We also don't need to generate copy variants for inplace views. + if "inplace_view" in f.tags: + return False + # Assume ops ending in _inverse have manually-defined copy variants + # (e.g. slice_inverse() has the copy variant slice_scatter()). + # We -could- probably generate these as well, but the codegen will be + # slightly different, and hand-writing these few kernels keeps codegen + # complexity lower. + if f.func.name.name.base.endswith("_inverse"): + return False + return True + + +# Given a NativeFunction that corresponds to a view op, +# returns the OperatorName of the corresponding "copy" variant of the op. +def get_view_copy_name(f: NativeFunction) -> OperatorName: + # Right now, when asking for a view op's corresponding "view_copy" name + # we assert for sanity that the op is allowed to have a generated view_copy variant. + # (We can do this because "gets_generated_view_copy()" tell us which ops get a generated view_copy op). + # However, narrow_copy() already exists as an op directly in native_functions.yaml. + # I'm hardcoding narrow_copy here for now to maintain the assert, + # But we could also just get rid of the assert. + list_of_ops_with_explicit_view_copy_operators = ["narrow"] + if str(f.func.name) not in list_of_ops_with_explicit_view_copy_operators: + assert gets_generated_view_copy(f) + + base_name = f"{f.func.name.name.base}_copy" + view_copy_name = OperatorName( + name=BaseOperatorName( + base=base_name, inplace=False, dunder_method=f.func.name.name.dunder_method + ), + overload_name=f.func.name.overload_name, + ) + return view_copy_name + + +# Helper functions for parsing argument lists (both inputs and returns) + + +def parse_returns(return_decl: str) -> tuple[Return, ...]: + """ + Input: '()' + Output: [] + """ + if return_decl == "()": + return () + if return_decl[0] == "(" and return_decl[-1] == ")": + return_decl = return_decl[1:-1] + return tuple(Return.parse(arg) for arg in return_decl.split(", ")) + + +# A Precompute instance consists of a map from kernel argument name +# to the list of Argument instances that should replace that +# kernel argument in the impl function. +@dataclass(frozen=True) +class Precompute: + # A map from kernel argument name -> a list of precomputed + # elements that replaces/supersedes it. + replace: dict[str, list[Argument]] + # List of precomputed args added without replacement + add: list[Argument] + + @staticmethod + def parse(src: object) -> Precompute: + assert isinstance(src, list) + + # src is a list of strings of the format: + # {kernel param name} -> {replacement decl}[, {replacement decl}, ...] + # [{add decl}[, {add decl}, ...]] + # The last line is optional and contains the precomputed parameters that are + # added without replacement. + # The other lines are parsed to get the names of which precomputed elements + # should replace which kernel arguments. + add_args = [] + if " -> " not in src[-1]: + add_list = src[-1].split(",") + add_args = [Argument.parse(name.strip()) for name in add_list] + src = src[:-1] + + replace = {} + for raw_replace_item in src: + assert isinstance(raw_replace_item, str) + assert " -> " in raw_replace_item, ( + "precomputed parameters without replacement" + " are allowed only in the last line" + ) + + arg, with_list_raw = raw_replace_item.split(" -> ") + assert " " not in arg, ( + f"illegal kernel param name '{arg}' in precomputed parameters'" + ) + with_list = with_list_raw.split(",") + with_list_args = [Argument.parse(name.strip()) for name in with_list] + replace[arg] = with_list_args + + r = Precompute(replace=replace, add=add_args) + assert r.to_list() == src, "r.to_list() != src" + return r + + def __post_init__(self) -> None: + # the template parameters are upper so if these are the + # same then it is ambiguous + for a in self.add: + assert a.name.upper() != a.name + for args in self.replace.values(): + for a in args: + assert a.name.upper() != a.name + + def to_list(self) -> list[str]: + replace_list = [] + for kernel_param, replacement_params in self.replace.items(): + replacements = ", ".join(str(param) for param in replacement_params) + replace_list.append(f"{kernel_param} -> {replacements}") + + return replace_list diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/native_function_generation.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/native_function_generation.py new file mode 100644 index 0000000000000000000000000000000000000000..3c2ec2e7dc47d9b507bb44be87db3b845f355898 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/native_function_generation.py @@ -0,0 +1,651 @@ +from __future__ import annotations + +import string +from collections import defaultdict +from typing import TYPE_CHECKING + +import torchgen.api.dispatcher as dispatcher +from torchgen.api.translate import translate +from torchgen.api.types import Binding, DispatcherSignature, Expr +from torchgen.context import with_native_function +from torchgen.model import ( + Annotation, + Argument, + BackendIndex, + BackendMetadata, + BaseOperatorName, + BaseTy, + BaseType, + DEFAULT_KERNEL_NAMESPACE, + DeviceCheckType, + DispatchKey, + FunctionSchema, + NativeFunction, + NativeFunctionsGroup, + OperatorName, + Return, + SchemaKind, + Variant, +) +from torchgen.utils import concatMap + + +if TYPE_CHECKING: + from collections.abc import Sequence + + +# See Note: [Out ops with functional variants that don't get grouped properly] +OUT_OPS_THAT_DONT_GET_GROUPED_PROPERLY = [ + # This has a functional variant, but it's currently marked private. + # This function should be marked private as well (*_backward ops aren't exposed to python anyway). + "adaptive_avg_pool3d_backward.grad_input", + # There's a functional variant, _slow_conv2d_backward.output_mask, that isn't grouped properly. + # Maybe we can kill this operator in favor of convolution_backward? + "_slow_conv2d_backward.grad_input", +] + + +# See Note: [Mutable ops that cannot get an out variant] +MUTABLE_OPS_THAT_CANNOT_GET_AN_OUT_VARIANT = [ + # should be out=? + "_cummax_helper", + # should be out=? + "_cummin_helper", +] + +# All of these operators don't have any tensor like returns +FUNCTIONAL_OPS_THAT_CANNOT_GET_AN_OUT_VARIANT = [ + "_assert_async", # no return + "_assert_async.msg", # no return + "_assert_tensor_metadata", # no return + "_cslt_sparse_mm_search", # returns an int + "_assert_scalar", # no return + "_dimI", # returns an int + "_dimV", # returns an int + "_has_same_storage_numel", # returns a boolean + "_linalg_check_errors", # no return + "_local_scalar_dense", # returns a Scalar + "_nested_tensor_from_mask_left_aligned", # returns a boolean + "_nnz", # returns an int + "_use_cudnn_ctc_loss", # returns a boolean + "_use_cudnn_ctc_loss.Tensor", # returns a boolean + "_validate_compressed_sparse_indices", # no return + "allclose", # returns a boolean + "dense_dim", # returns an int + "equal", # returns a boolean + "is_coalesced", # returns an boolean + "is_pinned", # returns a boolean + "is_same_size", # returns a boolean + "is_set_to", # returns a boolean + "q_per_channel_axis", # returns an int + "q_scale", # returns a float + "q_zero_point", # returns an int + "qscheme", # returns a QScheme + "record_stream", # no return + "sparse_dim", # returns an int + "sym_constrain_range", # no return + "sym_constrain_range_for_size", # no return + "_nested_tensor_storage_offsets", # returns a vector of ints + "_chunk_grad_outputs_efficient_attention", # returns a bool + "_fused_sdp_choice", # returns an int + "_print", # no return + "_sink_tokens", # no return + "_nested_get_ragged_idx", # returns an int +] + +INPLACE_OPS_THAT_DONT_GET_GROUPED_PROPERLY = [ + # polygamma and polygamma.out both exist, but have a + # pre-self arg (while polygamma_ does not) + # We should either fix this schema so it can be grouped properly, + # or allow the codegen to generate new functional/out= NativeFunctions for this op + # (which would require changing its overload name to prevent overload ambiguity). + "polygamma_" +] + + +# Groups "similar" NativeFunctions together +# example add.Tensor, add_.Tensor, add.out +# "similar" NativeFunctions are all expected to have an identical `signature()`, +# But have differing SchemaKinds. +def pre_group_native_functions( + native_functions: Sequence[NativeFunction], +) -> dict[FunctionSchema, dict[SchemaKind, NativeFunction]]: + pre_grouped_native_functions: dict[ + FunctionSchema, dict[SchemaKind, NativeFunction] + ] = defaultdict(dict) + for f in native_functions: + d = pre_grouped_native_functions[f.func.signature()] + assert f.func.kind() not in d + d[f.func.kind()] = f + return pre_grouped_native_functions + + +# Returns the out variant overload name given a base function overload name +def get_expected_out_variant_overload_name(overload_name: str | None) -> str: + return "out" if not overload_name else f"{overload_name}_out" + + +# Helper function: given an inplace FunctionSchema, generate its corresponding out= variant +# Example before: +# _add_relu_.Scalar(Tensor(a!) self, Scalar other, Scalar alpha=1) -> Tensor(a!) +# Example after: +# _add_relu.Scalar_out(Tensor self, Scalar other, Scalar alpha=1, *, Tensor(a!) out) +def self_to_out_signature(func: FunctionSchema) -> FunctionSchema: + # Generating an out= schema from an inplace schema. + assert func.kind() == SchemaKind.inplace + assert func.arguments.self_arg is not None + # The new out= schema has: + # - a new out argument with the same type as "func" (but with a mutable annotation) + # - The returns (if any) now alias the out= argument instead of "func" + # - an "out" overload name + return FunctionSchema( + name=func.name.remove_inplace().with_overload( + get_expected_out_variant_overload_name(func.name.overload_name) + ), + arguments=func.arguments.remove_self_annotation().with_out_args( + [ + Argument( + name="out", + type=func.arguments.self_arg.argument.type, + default=None, + annotation=func.arguments.self_arg.argument.annotation, + ) + ] + ), + returns=func.returns, + ) + + +# Helper function: given a functional FunctionSchema, generate its corresponding out= variant +# Example before: +# _to_copy(Tensor self, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, +# bool? pin_memory=None, bool non_blocking=False, MemoryFormat? memory_format=None) -> Tensor +# Example after: +# _to_copy._out(Tensor self, *, bool non_blocking=False, MemoryFormat? memory_format=None, +# Tensor(a!) out) -> Tensor(a!) +def functional_to_out_signature(func: FunctionSchema) -> FunctionSchema: + # Generating an out= schema from a functional schema. + assert func.kind() == SchemaKind.functional + + new_returns, new_out_args = generate_out_args_from_schema(func) + # The new out= schema has: + # - one or more new out argument(s) with the same type as returns (but with a mutable annotation) + # - The returns now alias the out= arguments + # - an "_out" overload name + return FunctionSchema( + name=func.name.with_overload( + get_expected_out_variant_overload_name(func.name.overload_name) + ), + arguments=func.arguments.signature().with_out_args( + new_out_args, + ), + returns=tuple(new_returns), + ) + + +# Helper function: given a function schema, generate corresponding out arguments, also the updated return annotations. +def generate_out_args_from_schema( + func: FunctionSchema, +) -> tuple[list[Return], list[Argument]]: + # More of a sanity check - our existing restrictions on schemas should enforce that + # mutable schema kinds never return their mutable arguments. + assert not any( + r.annotation is not None and r.annotation.is_write for r in func.returns + ) + + tensorlike_rets = [r for r in func.returns if r.type.is_tensor_like()] + assert len(tensorlike_rets) > 0 + + used_annotations = concatMap( + lambda a: [] if a.annotation is None else a.annotation.alias_set, + func.arguments.flat_all, + ) + valid_annotations = [x for x in string.ascii_lowercase if x not in used_annotations] + + all_rets_are_tensors = all(r.type == BaseType(BaseTy.Tensor) for r in func.returns) + + new_out_args: list[Argument] = [] + # The end result of new_returns is that: + # - If every return is a plain tensor, then the new returns == the old returns, but with the out= alias annotations added. + # - Otherwise, none of the out arguments show up in the returns (and we're only left with non-tensor-like returns, if any). + new_returns: list[Return] = [] + for i, r in enumerate(func.returns): + if r.type.is_tensor_like(): + new_out = Argument( + name="out" if len(func.returns) == 1 else f"out{i}", + type=r.type, + default=None, + annotation=Annotation.parse(f"{valid_annotations[i]}!"), + ) + new_out_args.append(new_out) + if all_rets_are_tensors: + # The convention for out= schemas is that they only return their out arguments + # if the return is a plain Tensor (or if it's a tuple of plain Tensors) + new_ret = Return( + name=None, type=new_out.type, annotation=new_out.annotation + ) + new_returns.append(new_ret) + else: + new_returns.append(r) + return new_returns, new_out_args + + +# Helper function: given a mutable FunctionSchema, generate its corresponding out= variant +# Example before: +# _fused_moving_avg_obs_fq_helper(Tensor self, Tensor observer_on, Tensor fake_quant_on, Tensor(a!) running_min, Tensor(b!) running_max, Tensor(c!) scale, Tensor(d!) zero_point, float averaging_const, int quant_min, int quant_max, int ch_axis, bool per_row_fake_quant=False, bool symmetric_quant=False) -> (Tensor output, Tensor mask) # noqa: B950 +# Example after: +# _fused_moving_avg_obs_fq_helper._out(Tensor self, Tensor observer_on, Tensor fake_quant_on, Tensor(a!) running_min, Tensor(b!) running_max, Tensor(c!) scale, Tensor(d!) zero_point, float averaging_const, int quant_min, int quant_max, int ch_axis, bool per_row_fake_quant=False, bool symmetric_quant=False, *, Tensor(e!) out0, Tensor(f!) out1) -> (Tensor(e!), Tensor(f!)) # noqa: B950 +def mutable_to_out_signature(func: FunctionSchema) -> FunctionSchema: + # Generating an out= schema from a mutable schema. + assert func.kind() == SchemaKind.mutable + # The new out= schema has: + # - Any non-aliased tensor-like returns are converted to mutable, aliased out= arguments + # (if the argument is a tensor then we also return it for method chaining, + # otherwise we return nothing) + # - an "out" overload name + # + # Note that: + # (1) This also means that we can *only* generate an out= variant from a mutable schema + # if the mutable schema has at least one tensor-like non-aliasing return. + # (2) The generated out= variant still has mutable positional arguments, + # but if necessary we could probably add another out= variant that also + # functionalizes the mutable arguments (a functional_out variant) + + new_returns, new_out_args = generate_out_args_from_schema(func) + + return FunctionSchema( + name=func.name.remove_inplace().with_overload( + get_expected_out_variant_overload_name(func.name.overload_name) + ), + arguments=func.arguments.with_out_args(new_out_args), + returns=tuple(new_returns), + ) + + +# This function, given function of one SchemaKind, as well as a target SchemaKind, +# generates a new NativeFunction with the same properties, but using the target SchemaKind. +# We only actually generate functions for either functional or out= SchemaKinds. +# This function returns a tuple, with: +# - The generated NativeFunction +# - a dictionary of `BackendIndex` objects, describing which dispatch keys +# we will generate kernels for, for the new NativeFunction. +# Details are in the function, but we only generate composite kernels (in some cases) today. +def generate_function( + f: NativeFunction, k: SchemaKind +) -> tuple[NativeFunction, dict[DispatchKey, dict[OperatorName, BackendMetadata]]]: + from torchgen.api import cpp + + if k == SchemaKind.functional: + assert f.func.kind() != SchemaKind.functional + # The new "functional" NativeFunction has: + # - any mutable arguments have been converted into (immutable) returns. + # (if a mutable argument was not also a return, it gets converted to one) + # - "_functional" appended to the base name, ONLY IF this op has a mutable variant. + # See Note [Overload Ambiguity With Functional Variants] + # The default grouping logic in signature() actually already does this, + # so we can piggy-back off it (but we still want return names) + func = f.func.signature(keep_return_names=True).with_name( + OperatorName( + name=BaseOperatorName( + base=f.func.name.name.base, + inplace=False, + dunder_method=f.func.name.name.dunder_method, + # See Note [Overload Ambiguity With Functional Variants] + functional_overload=f.func.kind() == SchemaKind.mutable, + ), + overload_name=f.func.name.overload_name, + ) + ) + elif k == SchemaKind.out: + # We generate out= ops mostly just so that we can pair up NativeFunctions into groups easily, + # but at least today, there is no good reason to actually use them. + # we'll generate a dispatcher entry for them, but won't actually register any kernels for them. + if f.func.kind() == SchemaKind.inplace: + func = self_to_out_signature(f.func) + elif f.func.kind() == SchemaKind.mutable: + func = mutable_to_out_signature(f.func) + elif f.func.kind() == SchemaKind.functional: + func = functional_to_out_signature(f.func) + else: + raise AssertionError( + "We only bother generating out= functions from either inplace or mutable or functional variants" + ) + else: + raise AssertionError( + "We currently only generate either functional or out= NativeFunctions" + ) + + # Generated kernel naming convention for out: _. The reason for this is to + # disambiguate operator with the same name but different overload name, e.g., `randn.names_out` and + # `randn.generator_with_names_out`. + kernel_name = ( + func.name.unambiguous_name() + if func.kind() == SchemaKind.out + else cpp.name(func) + ) + if f.func.has_symint(): + kernel_name += "_symint" + backend_metadata = { + DispatchKey.CompositeExplicitAutograd: { + func.name: BackendMetadata( + kernel=kernel_name, + structured=False, + cpp_namespace=DEFAULT_KERNEL_NAMESPACE, + ) + } + } + tags = {"generated"} | set( + f.tags & {"nondeterministic_seeded", "view_copy", "pt2_compliant_tag"} + ) + + return ( + NativeFunction( + func=func, + use_const_ref_for_mutable_tensors=f.use_const_ref_for_mutable_tensors, + # These generated fn's aren't meant to be user friendly- don't generate methods. + variants={Variant.function}, + structured=False, + structured_delegate=None, + structured_inherits=None, + precomputed=None, + autogen=[], + ufunc_inner_loop={}, + manual_kernel_registration=False, + manual_cpp_binding=False, + python_module=None, + category_override=None, + device_guard=False, + device_check=DeviceCheckType.NoCheck, + loc=f.loc, + cpp_no_default_args=set(), + is_abstract=f.is_abstract, + has_composite_implicit_autograd_kernel=False, + has_composite_implicit_autograd_nested_tensor_kernel=False, + has_composite_explicit_autograd_kernel=True, + has_composite_explicit_autograd_non_functional_kernel=False, + # Every generated NativeFunction gets a "generated" tag, so it's easy to tell + # which NativeFunction objects did not come directly from native_functions.yaml. + tags=tags, + namespace=f.namespace, + ), + backend_metadata, + ) + + +# This function is responsible for adding generated NativeFunctions which don't appear +# explicitly in the codegen. +# You can inspect the full list of NativeFunctions yourself with the torchgen package, by running +# torchgen.parse_native_yaml("aten/src/ATen/native/native_functions.yaml", "aten/src/ATen/native/tags.yaml") +# (Maybe we should make a friendly API for this) +# +# Note: this function *mutates* its two inputs, +# adding the new NativeFunctions / BackendMetadata to them +def add_generated_native_functions( + rs: list[NativeFunction], + indices: dict[DispatchKey, dict[OperatorName, BackendMetadata]], +) -> None: + # The main code for generating new NativeFunctions + # First we group of NativeFunctions by schema kind, + # then we detect which ones are missing and generate them. + pre_grouped_native_functions = pre_group_native_functions(rs) + for d in pre_grouped_native_functions.values(): + has_functional = SchemaKind.functional in d + has_inplace = SchemaKind.inplace in d + has_mutable = SchemaKind.mutable in d + has_out = SchemaKind.out in d + is_core = any("core" in variant.tags for variant in d.values()) + + # We automatically generate a few native functions that don't exist in the yaml, for a few reasons: + # (1) If an operator has an inplace/out= variant but no functional variant, we can generate + # a simple functional variant that the functionalization pass can consume. + # (2) If an operator has an inplace or functional but no out= variant, we generate an out= + # variant, mostly so we can easily pair up functions into NativeFunctionsGroup, + # while maintaining the constraint that the out= variant is "required". + if has_mutable or has_inplace or has_out or has_functional: + # Don't bother generating functions trio's for native functions that bypass the dispatcher. + are_manual = all(f.manual_cpp_binding for f in d.values()) + # Don't bother generating functional + out= variants for view operators + # set_ is technically an inplace_view, but for now it is treated + # as a normal inplace op in the codegen + has_view_ops = any( + f.is_view_op and str(f.func.name.name) != "set_" for f in d.values() + ) + # Don't generate the other variants for non-core CompositeImplicitAutograd operators. + # We could probably do this, but the main benefit of generating the function triplets + # is for transforms that need them, and transforms don't need to act directly + # on CompositeImplicitAutograd operators (since we let them decompose). + are_composite_implicit = all( + f.has_composite_implicit_autograd_kernel for f in d.values() + ) + if are_manual or has_view_ops or are_composite_implicit and not is_core: + continue + if has_out and len(d.values()) == 1: + # Note: [Out ops with functional variants that don't get grouped properly] + # In theory we could validly have an out= operator in native_functions.yaml + # that has no other variants. + # But today, all of the operators where that's the case actually do have + # functional variants, that we are just unable to pair up properly. + # I think banning this all together is probably safer + # (you can always add a functional variant yourself if you want to add a new out= operator). + # + # We should probably fix the existing cases; this check is to prevent us from adding more over time. + if ( + str(d[SchemaKind.out].func.name) + not in OUT_OPS_THAT_DONT_GET_GROUPED_PROPERLY + ): + raise AssertionError( + f"Found an out= operator that we could not find any other variants of: {str(d[SchemaKind.out].func)}" + ) + continue + + # Some inplace ops that have problematic schemas (that we should fix), which prevent us + # from generating out= and functional variants + if ( + has_inplace + and str(d[SchemaKind.inplace].func.name) + in INPLACE_OPS_THAT_DONT_GET_GROUPED_PROPERLY + ): + continue + + base_fn = ( + d[SchemaKind.mutable] + if has_mutable + else d[SchemaKind.inplace] + if has_inplace + else d[SchemaKind.out] + if has_out + else d[SchemaKind.functional] + ) + + # Note: [Mutable ops that cannot get an out variant] + # We can only generate an out= variant if either: + # - the original function has tensor-like returns (since we can convert them to out kwargs) + # - or it's inplace (since we can convert `self` to an out kwarg) + # There are only two functions that don't fit this criteria today though, + # and they both look like they should be fixed to be out= variants, + # so if feels safer to ban this schema all-together + base_fn_valid = base_fn.func.kind() == SchemaKind.inplace or any( + r.type.is_tensor_like() for r in base_fn.func.returns + ) + # Note: [Loosen the assertion that all functional should have out variant] + # By design all functional operators should have our variants. The needs_out check + # is loosening this requirement, changing it to only generate out variant if there's + # an `autogen` block in the native function, in the long run it should be removed. + # FIXME: Remove this after figuring out CI job failures related to min, max, mean + needs_out = any("out" in str(op_name) for op_name in base_fn.autogen) + gets_out_variant = not has_out and base_fn_valid and needs_out + if not has_out and not base_fn_valid: + if ( + str(base_fn.func.name) + not in MUTABLE_OPS_THAT_CANNOT_GET_AN_OUT_VARIANT + and str(base_fn.func.name) + not in FUNCTIONAL_OPS_THAT_CANNOT_GET_AN_OUT_VARIANT + ): + raise AssertionError( + f"""Found an operator that we could not generate an out= variant for: {str(base_fn.func)}. +This type of operators don't have tensor-like return, making it difficult to generate a proper out= variant. If +out= variant is not needed, please add the function name into FUNCTIONAL_OPS_THAT_CANNOT_GET_AN_OUT_VARIANT list.""" + ) + + # Generate an out= variant + if gets_out_variant: + fn, metadata = generate_function(base_fn, SchemaKind.out) + d[SchemaKind.out] = fn + BackendIndex.grow_index(indices, metadata) + rs.append(fn) + + # Generate a functional variant, but only do it if the operator got an out= variant + # (Functional variants are only useful if we can group up the variants, + # which we can only do if they have an out= variant) + if not has_functional and (has_out or gets_out_variant): + fn, metadata = generate_function(base_fn, SchemaKind.functional) + d[SchemaKind.functional] = fn + BackendIndex.grow_index(indices, metadata) + rs.append(fn) + + +def return_str(rets: tuple[Return, ...], names: list[str]) -> str: + assert len(rets) == len(names) + if len(rets) == 0: + return "" + elif len(rets) == 1: + return f"return {names[0]};" + else: + return f"return {dispatcher.returns_type(rets).cpp_type()}({', '.join(names)});" + + +# Given a function, and the name of a variable corresponding to the output of that function, +# gather up all of the individual returns that are not aliased +def gather_nonaliased_inner_rets(func: FunctionSchema, out_var: str) -> list[str]: + aliased_rets = func.aliased_return_names() + non_aliased_names = [] + is_out_var_a_tuple = len(func.returns) > 1 + for i, r in enumerate(aliased_rets): + if r is None: + non_aliased_names.append( + f"std::get<{i}>({out_var})" if is_out_var_a_tuple else out_var + ) + return non_aliased_names + + +# Generates functional kernels in terms of their inplace.mutable counterparts. +# We only do this for "generated" NativeFunctions +@with_native_function +def gen_composite_functional_kernel(g: NativeFunctionsGroup) -> str | None: + # We should only be generating these for code-generated NativeFunctions + if "generated" not in g.functional.tags: + return None + # And we always write the kernel for a generated op in terms of a non-generated op. + if g.inplace is not None and "generated" not in g.inplace.tags: + target_f = g.inplace + elif g.mutable is not None and "generated" not in g.mutable.tags: + target_f = g.mutable + else: + # We should be guaranteed to have a valid inplace/mutable variant to call into. + # See Note: [Mutable Ops Not Using Functionalization] + raise AssertionError(str(g.functional.func)) + + sig = DispatcherSignature(g.functional.func) + target_sig = DispatcherSignature(target_f.func) + + context: list[Binding | Expr] = [] + clone_mutable_inputs = [] + cloned_return_names = [] + # We can't just directly pass all of the arguments from the functional op into the mutating op. + # We need to check for which inputs to the mutating operator are mutable, + # and clone those inputs first. + for a_curr, a_tgt in zip( + dispatcher.jit_arguments(g.functional.func), + dispatcher.jit_arguments(target_f.func), + ): + if a_tgt.annotation is not None and a_tgt.annotation.is_write: + clone_mutable_inputs.append( + f"auto {a_curr.name}_clone = clone_arg({a_curr.name});" + ) + context.append( + Expr( + expr=f"{a_curr.name}_clone", + type=dispatcher.argument_type(a_curr, binds=a_curr.name), + ) + ) + # Invariant: mutable arguments on the inner mutable op are always returns on the functional op. + cloned_return_names.append(f"{a_curr.name}_clone") + else: + context.append(dispatcher.argument(a_curr)) + exprs = ", ".join([e.expr for e in translate(context, target_sig.arguments())]) + + out_name = "output" + maybe_assign = f"auto {out_name} = " if len(target_f.func.returns) > 0 else "" + inner_return_names = gather_nonaliased_inner_rets(target_f.func, out_name) + ret_str = return_str( + g.functional.func.returns, inner_return_names + cloned_return_names + ) + + clone_mutable_inputs_str = "\n".join(clone_mutable_inputs) + return f""" +{sig.defn(name=sig.name() + ("_symint" if g.out.func.has_symint() else ""))} {{ + {clone_mutable_inputs_str} + {maybe_assign}at::_ops::{target_f.func.name.unambiguous_name()}::call({exprs}); + {ret_str} +}} +""" + + +# Generates out= kernels in terms of their functional counterparts. +# We only do this for "generated" NativeFunctions +@with_native_function +def gen_composite_out_kernel(g: NativeFunctionsGroup) -> str | None: + # We should only be generating these for code-generated NativeFunctions + if "generated" not in g.out.tags: + return None + # And we always write the kernel for the out= op in terms of the functional. + # Note that the functional op might have also been generated, but we don't have to + # worry about cycles, because the generated functional kernels are always implemented + # in terms of non-generated kernels (see gen_composite_functional_kernel). + + sig = DispatcherSignature(g.out.func) + target_sig = DispatcherSignature(g.functional.func) + + exprs = ", ".join( + [e.expr for e in translate(sig.arguments(), target_sig.arguments())] + ) + + copy_outs = [] + out_name = "tmp_output" + for i, out_arg in enumerate(g.out.func.arguments.out): + functional_return_name = ( + out_name + if len(g.functional.func.returns) == 1 + else f"std::get<{i}>({out_name})" + ) + copy_outs.append( + f"""\ + resize_out_helper({out_arg.name}, {functional_return_name}); + copy_arg({out_arg.name}, {functional_return_name});""" + ) + + rets = [] + # For each return arg in the calling (out=) operator, + # If it corresponds to an aliased input, return the input. + # Otherwise, return the corresponding output from calling the functional operator. + for i, ret_name in enumerate(g.out.func.aliased_return_names()): + if ret_name is not None: + rets.append(ret_name) + else: + functional_return_name = ( + out_name + if len(g.functional.func.returns) == 1 + else f"std::get<{i}>({out_name})" + ) + rets.append(functional_return_name) + + copy_outs_str = "\n".join(copy_outs) + + # Kernel name needs to follow the naming convention defined in `generate_function()` + return f""" +{sig.defn(name=g.out.func.name.unambiguous_name() + ("_symint" if g.out.func.has_symint() else ""))} {{ + auto {out_name} = at::_ops::{g.functional.func.name.unambiguous_name()}::call({exprs}); + {copy_outs_str} + {return_str(g.out.func.returns, rets)} +}} +""" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/utils.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..0e557e41da4d0b20bcfdbfe51e4d766b0c15d835 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/utils.py @@ -0,0 +1,519 @@ +from __future__ import annotations + +import contextlib +import functools +import hashlib +import os +import re +import sys +import textwrap +from dataclasses import is_dataclass +from enum import auto, Enum +from pathlib import Path +from pprint import pformat +from typing import Any, Generic, TYPE_CHECKING, TypeVar +from typing_extensions import assert_never, Self + +from torchgen.code_template import CodeTemplate + + +if TYPE_CHECKING: + from argparse import Namespace + from collections.abc import Callable, Iterable, Iterator, Sequence + + +TORCHGEN_ROOT = Path(__file__).absolute().parent +REPO_ROOT = TORCHGEN_ROOT.parent + + +# Many of these functions share logic for defining both the definition +# and declaration (for example, the function signature is the same), so +# we organize them into one function that takes a Target to say which +# code we want. +# +# This is an OPEN enum (we may add more cases to it in the future), so be sure +# to explicitly specify with Literal[Target.XXX] or Literal[Target.XXX, Target.YYY] +# what targets are valid for your use. +class Target(Enum): + # top level namespace (not including at) + DEFINITION = auto() + DECLARATION = auto() + # TORCH_LIBRARY(...) { ... } + REGISTRATION = auto() + # namespace { ... } + ANONYMOUS_DEFINITION = auto() + # namespace cpu { ... } + NAMESPACED_DEFINITION = auto() + NAMESPACED_DECLARATION = auto() + + +# Matches "foo" in "foo, bar" but not "foobar". Used to search for the +# occurrence of a parameter in the derivative formula +IDENT_REGEX = r"(^|\W){}($|\W)" + + +# TODO: Use a real parser here; this will get bamboozled +def split_name_params(schema: str) -> tuple[str, list[str]]: + m = re.match(r"(\w+)(\.\w+)?\((.*)\)", schema) + if m is None: + raise RuntimeError(f"Unsupported function schema: {schema}") + name, _, params = m.groups() + return name, params.split(", ") + + +T = TypeVar("T") +S = TypeVar("S") + +# These two functions purposely return generators in analogy to map() +# so that you don't mix up when you need to list() them + + +# Map over function that may return None; omit Nones from output sequence +def mapMaybe(func: Callable[[T], S | None], xs: Iterable[T]) -> Iterator[S]: + for x in xs: + r = func(x) + if r is not None: + yield r + + +# Map over function that returns sequences and cat them all together +def concatMap(func: Callable[[T], Sequence[S]], xs: Iterable[T]) -> Iterator[S]: + for x in xs: + yield from func(x) + + +# Conveniently add error context to exceptions raised. Lets us +# easily say that an error occurred while processing a specific +# context. +@contextlib.contextmanager +def context(msg_fn: Callable[[], str]) -> Iterator[None]: + try: + yield + except Exception as e: + # TODO: this does the wrong thing with KeyError + msg = msg_fn() + msg = textwrap.indent(msg, " ") + msg = f"{e.args[0]}\n{msg}" if e.args else msg + e.args = (msg,) + e.args[1:] + raise + + +@functools.cache +def _read_template(template_fn: str) -> CodeTemplate: + return CodeTemplate.from_file(template_fn) + + +# String hash that's stable across different executions, unlike builtin hash +def string_stable_hash(s: str) -> int: + sha1 = hashlib.sha1(s.encode("latin1"), usedforsecurity=False).digest() + return int.from_bytes(sha1, byteorder="little") + + +# A small abstraction for writing out generated files and keeping track +# of what files have been written (so you can write out a list of output +# files) +class FileManager: + def __init__( + self, + install_dir: str | Path, + template_dir: str | Path, + dry_run: bool, + ) -> None: + self.install_dir = Path(install_dir) + self.template_dir = Path(template_dir) + self.files: set[Path] = set() + self.dry_run = dry_run + + @property + def filenames(self) -> frozenset[str]: + return frozenset({file.as_posix() for file in self.files}) + + def _write_if_changed(self, filename: str | Path, contents: str) -> None: + file = Path(filename) + old_contents: str | None = None + try: + old_contents = file.read_text(encoding="utf-8") + except OSError: + pass + if contents != old_contents: + # Create output directory if it doesn't exist + file.parent.mkdir(parents=True, exist_ok=True) + file.write_text(contents, encoding="utf-8") + + # Read from template file and replace pattern with callable (type could be dict or str). + def substitute_with_template( + self, + template_fn: str | Path, + env_callable: Callable[[], str | dict[str, Any]], + ) -> str: + assert not Path(template_fn).is_absolute(), ( + f"template_fn must be relative: {template_fn}" + ) + template_path = self.template_dir / template_fn + env = env_callable() + if isinstance(env, dict): + if "generated_comment" not in env: + generator_default = TORCHGEN_ROOT / "gen.py" + try: + generator = Path( + sys.modules["__main__"].__file__ or generator_default + ).absolute() + except (KeyError, AttributeError): + generator = generator_default.absolute() + + try: + generator_path = generator.relative_to(REPO_ROOT).as_posix() + except ValueError: + generator_path = generator.name + + env = { + **env, # copy the original dict instead of mutating it + "generated_comment": ( + "@" + f"generated by {generator_path} from {template_fn}" + ), + } + template = _read_template(template_path) + substitute_out = template.substitute(env) + # Ensure an extra blank line between the class/function definition + # and the docstring of the previous class/function definition. + # NB: It is generally not recommended to have docstrings in pyi stub + # files. But if there are any, we need to ensure that the file + # is properly formatted. + return re.sub( + r''' + (""")\n+ # match triple quotes + ( + (\s*@.+\n)* # match decorators if any + \s*(class|def) # match class/function definition + ) + ''', + r"\g<1>\n\n\g<2>", + substitute_out, + flags=re.VERBOSE, + ) + if isinstance(env, str): + return env + assert_never(env) + + def write_with_template( + self, + filename: str | Path, + template_fn: str | Path, + env_callable: Callable[[], str | dict[str, Any]], + ) -> None: + filename = Path(filename) + assert not filename.is_absolute(), f"filename must be relative: {filename}" + file = self.install_dir / filename + assert file not in self.files, f"duplicate file write {file}" + self.files.add(file) + if not self.dry_run: + substitute_out = self.substitute_with_template( + template_fn=template_fn, + env_callable=env_callable, + ) + self._write_if_changed(filename=file, contents=substitute_out) + + def write( + self, + filename: str | Path, + env_callable: Callable[[], str | dict[str, Any]], + ) -> None: + self.write_with_template(filename, filename, env_callable) + + def write_sharded( + self, + filename: str | Path, + items: Iterable[T], + *, + key_fn: Callable[[T], str], + env_callable: Callable[[T], dict[str, list[str]]], + num_shards: int, + base_env: dict[str, Any] | None = None, + sharded_keys: set[str], + ) -> None: + self.write_sharded_with_template( + filename, + filename, + items, + key_fn=key_fn, + env_callable=env_callable, + num_shards=num_shards, + base_env=base_env, + sharded_keys=sharded_keys, + ) + + def write_sharded_with_template( + self, + filename: str | Path, + template_fn: str | Path, + items: Iterable[T], + *, + key_fn: Callable[[T], str], + env_callable: Callable[[T], dict[str, list[str]]], + num_shards: int, + base_env: dict[str, Any] | None = None, + sharded_keys: set[str], + ) -> None: + file = Path(filename) + assert not file.is_absolute(), f"filename must be relative: {filename}" + everything: dict[str, Any] = {"shard_id": "Everything"} + shards: list[dict[str, Any]] = [ + {"shard_id": f"_{i}"} for i in range(num_shards) + ] + all_shards = [everything] + shards + + if base_env is not None: + for shard in all_shards: + shard.update(base_env) + + for key in sharded_keys: + for shard in all_shards: + if key in shard: + assert isinstance(shard[key], list), ( + "sharded keys in base_env must be a list" + ) + shard[key] = shard[key].copy() + else: + shard[key] = [] + + def merge_env(into: dict[str, list[str]], from_: dict[str, list[str]]) -> None: + for k, v in from_.items(): + assert k in sharded_keys, f"undeclared sharded key {k}" + into[k] += v + + if self.dry_run: + # Dry runs don't write any templates, so incomplete environments are fine + items = () + + for item in items: + key = key_fn(item) + sid = string_stable_hash(key) % num_shards + env = env_callable(item) + + merge_env(shards[sid], env) + merge_env(everything, env) + + for shard in all_shards: + shard_id = shard["shard_id"] + self.write_with_template( + file.with_stem(f"{file.stem}{shard_id}"), + template_fn, + lambda: shard, + ) + + # filenames is used to track compiled files, but FooEverything.cpp isn't meant to be compiled + self.files.discard(self.install_dir / file.with_stem(f"{file.stem}Everything")) + + def write_outputs(self, variable_name: str, filename: str | Path) -> None: + """Write a file containing the list of all outputs which are generated by this script.""" + content = "\n".join( + ( + "set(", + variable_name, + # Use POSIX paths to avoid invalid escape sequences on Windows + *(f' "{file.as_posix()}"' for file in sorted(self.files)), + ")", + ) + ) + self._write_if_changed(filename, content) + + def template_dir_for_comments(self) -> str: + """ + This needs to be deterministic. The template dir is an absolute path + that varies across builds. So, just use the path relative to this file, + which will point to the codegen source but will be stable. + """ + return os.path.relpath(self.template_dir, os.path.dirname(__file__)) + + +# Helper function to generate file manager +def make_file_manager( + options: Namespace, + install_dir: str | Path | None = None, +) -> FileManager: + template_dir = os.path.join(options.source_path, "templates") + install_dir = install_dir if install_dir else options.install_dir + return FileManager( + install_dir=install_dir, + template_dir=template_dir, + dry_run=options.dry_run, + ) + + +# Helper function to create a pretty representation for dataclasses +def dataclass_repr( + obj: Any, + indent: int = 0, + width: int = 80, +) -> str: + return pformat(obj, indent, width) + + +def _format_dict( + attr: dict[Any, Any], + indent: int, + width: int, + curr_indent: int, +) -> str: + curr_indent += indent + 3 + dict_repr = [] + for k, v in attr.items(): + k_repr = repr(k) + v_str = ( + pformat(v, indent, width, curr_indent + len(k_repr)) + if is_dataclass(v) + else repr(v) + ) + dict_repr.append(f"{k_repr}: {v_str}") + + return _format(dict_repr, indent, width, curr_indent, "{", "}") + + +def _format_list( + attr: list[Any] | set[Any] | tuple[Any, ...], + indent: int, + width: int, + curr_indent: int, +) -> str: + curr_indent += indent + 1 + list_repr = [ + pformat(l, indent, width, curr_indent) if is_dataclass(l) else repr(l) + for l in attr + ] + start, end = ("[", "]") if isinstance(attr, list) else ("(", ")") + return _format(list_repr, indent, width, curr_indent, start, end) + + +def _format( + fields_str: list[str], + indent: int, + width: int, + curr_indent: int, + start: str, + end: str, +) -> str: + delimiter, curr_indent_str = "", "" + # if it exceed the max width then we place one element per line + if len(repr(fields_str)) >= width: + delimiter = "\n" + curr_indent_str = " " * curr_indent + + indent_str = " " * indent + body = f", {delimiter}{curr_indent_str}".join(fields_str) + return f"{start}{indent_str}{body}{end}" + + +class NamespaceHelper: + """A helper for constructing the namespace open and close strings for a nested set of namespaces. + + e.g. for namespace_str torch::lazy, + + prologue: + namespace torch { + namespace lazy { + + epilogue: + } // namespace lazy + } // namespace torch + """ + + def __init__( + self, + namespace_str: str, + entity_name: str = "", + max_level: int = 2, + ) -> None: + # cpp_namespace can be a colon joined string such as torch::lazy + cpp_namespaces = namespace_str.split("::") + assert len(cpp_namespaces) <= max_level, ( + f"Codegen doesn't support more than {max_level} level(s) of custom namespace. Got {namespace_str}." + ) + self.cpp_namespace_ = namespace_str + self.prologue_ = "\n".join([f"namespace {n} {{" for n in cpp_namespaces]) + self.epilogue_ = "\n".join( + [f"}} // namespace {n}" for n in reversed(cpp_namespaces)] + ) + self.namespaces_ = cpp_namespaces + self.entity_name_ = entity_name + + @staticmethod + def from_namespaced_entity( + namespaced_entity: str, + max_level: int = 2, + ) -> NamespaceHelper: + """ + Generate helper from nested namespaces as long as class/function name. E.g.: "torch::lazy::add" + """ + names = namespaced_entity.split("::") + entity_name = names[-1] + namespace_str = "::".join(names[:-1]) + return NamespaceHelper( + namespace_str=namespace_str, entity_name=entity_name, max_level=max_level + ) + + @property + def prologue(self) -> str: + return self.prologue_ + + @property + def epilogue(self) -> str: + return self.epilogue_ + + @property + def entity_name(self) -> str: + return self.entity_name_ + + # Only allow certain level of namespaces + def get_cpp_namespace(self, default: str = "") -> str: + """ + Return the namespace string from joining all the namespaces by "::" (hence no leading "::"). + Return default if namespace string is empty. + """ + return self.cpp_namespace_ if self.cpp_namespace_ else default + + +class OrderedSet(Generic[T]): + storage: dict[T, None] + + def __init__(self, iterable: Iterable[T] | None = None) -> None: + if iterable is None: + self.storage = {} + else: + self.storage = dict.fromkeys(iterable) + + def __contains__(self, item: T) -> bool: + return item in self.storage + + def __iter__(self) -> Iterator[T]: + return iter(self.storage.keys()) + + def update(self, items: OrderedSet[T]) -> None: + self.storage.update(items.storage) + + def add(self, item: T) -> None: + self.storage[item] = None + + def copy(self) -> OrderedSet[T]: + ret: OrderedSet[T] = OrderedSet() + ret.storage = self.storage.copy() + return ret + + @staticmethod + def union(*args: OrderedSet[T]) -> OrderedSet[T]: + ret = args[0].copy() + for s in args[1:]: + ret.update(s) + return ret + + def __or__(self, other: OrderedSet[T]) -> OrderedSet[T]: + return OrderedSet.union(self, other) + + def __ior__(self, other: OrderedSet[T]) -> Self: + self.update(other) + return self + + def __eq__(self, other: object) -> bool: + if isinstance(other, OrderedSet): + return self.storage == other.storage + else: + return set(self.storage.keys()) == other diff --git a/TTS/Kokoro/.venv/Lib/site-packages/torchgen/yaml_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/yaml_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..53379216638e79cbdb9a21409812ad948c3f7cf5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/torchgen/yaml_utils.py @@ -0,0 +1,26 @@ +# Safely load fast C Yaml loader/dumper if they are available +try: + from yaml import CSafeLoader as Loader +except ImportError: + from yaml import SafeLoader as Loader # type: ignore[assignment, misc] + +try: + from yaml import CSafeDumper as Dumper +except ImportError: + from yaml import SafeDumper as Dumper # type: ignore[assignment, misc] +YamlDumper = Dumper + + +# A custom loader for YAML that errors on duplicate keys. +# This doesn't happen by default: see https://github.com/yaml/pyyaml/issues/165 +class YamlLoader(Loader): + def construct_mapping(self, node, deep=False): # type: ignore[no-untyped-def] + mapping = [] + for key_node, value_node in node.value: + key = self.construct_object(key_node, deep=deep) # type: ignore[no-untyped-call] + assert key not in mapping, ( + f"Found a duplicate key in the yaml. key={key}, line={node.start_mark.line}" + ) + mapping.append(key) + mapping = super().construct_mapping(node, deep=deep) # type: ignore[no-untyped-call] + return mapping diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..fb6453e5b2468e0f16b4653f413868ba32e0930c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/METADATA @@ -0,0 +1,1595 @@ +Metadata-Version: 2.4 +Name: tqdm +Version: 4.67.3 +Summary: Fast, Extensible Progress Meter +Maintainer-email: tqdm developers +License: MPL-2.0 AND MIT +Project-URL: homepage, https://tqdm.github.io +Project-URL: repository, https://github.com/tqdm/tqdm +Project-URL: changelog, https://tqdm.github.io/releases +Project-URL: wiki, https://github.com/tqdm/tqdm/wiki +Keywords: progressbar,progressmeter,progress,bar,meter,rate,eta,console,terminal,time +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Environment :: MacOS X +Classifier: Environment :: Other Environment +Classifier: Environment :: Win32 (MS Windows) +Classifier: Environment :: X11 Applications +Classifier: Framework :: IPython +Classifier: Framework :: Jupyter +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Education +Classifier: Intended Audience :: End Users/Desktop +Classifier: Intended Audience :: Other Audience +Classifier: Intended Audience :: System Administrators +Classifier: Operating System :: MacOS +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft +Classifier: Operating System :: Microsoft :: MS-DOS +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: POSIX +Classifier: Operating System :: POSIX :: BSD +Classifier: Operating System :: POSIX :: BSD :: FreeBSD +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: POSIX :: SunOS/Solaris +Classifier: Operating System :: Unix +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: Implementation +Classifier: Programming Language :: Python :: Implementation :: IronPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Programming Language :: Unix Shell +Classifier: Topic :: Desktop Environment +Classifier: Topic :: Education :: Computer Aided Instruction (CAI) +Classifier: Topic :: Education :: Testing +Classifier: Topic :: Office/Business +Classifier: Topic :: Other/Nonlisted Topic +Classifier: Topic :: Software Development :: Build Tools +Classifier: Topic :: Software Development :: Libraries +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Software Development :: Pre-processors +Classifier: Topic :: Software Development :: User Interfaces +Classifier: Topic :: System :: Installation/Setup +Classifier: Topic :: System :: Logging +Classifier: Topic :: System :: Monitoring +Classifier: Topic :: System :: Shells +Classifier: Topic :: Terminals +Classifier: Topic :: Utilities +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +License-File: LICENCE +Requires-Dist: colorama; platform_system == "Windows" +Requires-Dist: importlib_metadata; python_version < "3.8" +Provides-Extra: dev +Requires-Dist: pytest>=6; extra == "dev" +Requires-Dist: pytest-cov; extra == "dev" +Requires-Dist: pytest-timeout; extra == "dev" +Requires-Dist: pytest-asyncio>=0.24; extra == "dev" +Requires-Dist: nbval; extra == "dev" +Provides-Extra: discord +Requires-Dist: requests; extra == "discord" +Provides-Extra: slack +Requires-Dist: slack-sdk; extra == "slack" +Provides-Extra: telegram +Requires-Dist: requests; extra == "telegram" +Provides-Extra: notebook +Requires-Dist: ipywidgets>=6; extra == "notebook" +Dynamic: license-file + +|Logo| + +tqdm +==== + +|Py-Versions| |Versions| |Conda-Forge-Status| |Docker| |Snapcraft| + +|Build-Status| |Coverage-Status| |Branch-Coverage-Status| |Codacy-Grade| |Libraries-Rank| |PyPI-Downloads| + +|LICENCE| |OpenHub-Status| |binder-demo| |awesome-python| + +``tqdm`` derives from the Arabic word *taqaddum* (تقدّم) which can mean "progress," +and is an abbreviation for "I love you so much" in Spanish (*te quiero demasiado*). + +Instantly make your loops show a smart progress meter - just wrap any +iterable with ``tqdm(iterable)``, and you're done! + +.. code:: python + + from tqdm import tqdm + for i in tqdm(range(10000)): + ... + +``76%|████████████████████████        | 7568/10000 [00:33<00:10, 229.00it/s]`` + +``trange(N)`` can be also used as a convenient shortcut for +``tqdm(range(N))``. + +|Screenshot| + |Video| |Slides| |Merch| + +It can also be executed as a module with pipes: + +.. code:: sh + + $ seq 9999999 | tqdm --bytes | wc -l + 75.2MB [00:00, 217MB/s] + 9999999 + + $ tar -zcf - docs/ | tqdm --bytes --total `du -sb docs/ | cut -f1` \ + > backup.tgz + 32%|██████████▍ | 8.89G/27.9G [00:42<01:31, 223MB/s] + +Overhead is low -- about 60ns per iteration (80ns with ``tqdm.gui``), and is +unit tested against performance regression. +By comparison, the well-established +`ProgressBar `__ has +an 800ns/iter overhead. + +In addition to its low overhead, ``tqdm`` uses smart algorithms to predict +the remaining time and to skip unnecessary iteration displays, which allows +for a negligible overhead in most cases. + +``tqdm`` works on any platform +(Linux, Windows, Mac, FreeBSD, NetBSD, Solaris/SunOS), +in any console or in a GUI, and is also friendly with IPython/Jupyter notebooks. + +``tqdm`` does not require any dependencies (not even ``curses``!), just +Python and an environment supporting ``carriage return \r`` and +``line feed \n`` control characters. + +------------------------------------------ + +.. contents:: Table of contents + :backlinks: top + :local: + + +Installation +------------ + +Latest PyPI stable release +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +|Versions| |PyPI-Downloads| |Libraries-Dependents| + +.. code:: sh + + pip install tqdm + +Latest development release on GitHub +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +|GitHub-Status| |GitHub-Stars| |GitHub-Commits| |GitHub-Forks| |GitHub-Updated| + +Pull and install pre-release ``devel`` branch: + +.. code:: sh + + pip install "git+https://github.com/tqdm/tqdm.git@devel#egg=tqdm" + +Latest Conda release +~~~~~~~~~~~~~~~~~~~~ + +|Conda-Forge-Status| + +.. code:: sh + + conda install -c conda-forge tqdm + +Latest Snapcraft release +~~~~~~~~~~~~~~~~~~~~~~~~ + +|Snapcraft| + +There are 3 channels to choose from: + +.. code:: sh + + snap install tqdm # implies --stable, i.e. latest tagged release + snap install tqdm --candidate # master branch + snap install tqdm --edge # devel branch + +Note that ``snap`` binaries are purely for CLI use (not ``import``-able), and +automatically set up ``bash`` tab-completion. + +Latest Docker release +~~~~~~~~~~~~~~~~~~~~~ + +|Docker| + +.. code:: sh + + docker pull tqdm/tqdm + docker run -i --rm tqdm/tqdm --help + +Other +~~~~~ + +There are other (unofficial) places where ``tqdm`` may be downloaded, particularly for CLI use: + +|Repology| + +.. |Repology| image:: https://repology.org/badge/tiny-repos/python:tqdm.svg + :target: https://repology.org/project/python:tqdm/versions + +Changelog +--------- + +The list of all changes is available either on GitHub's Releases: +|GitHub-Status|, on the +`wiki `__, or on the +`website `__. + + +Usage +----- + +``tqdm`` is very versatile and can be used in a number of ways. +The three main ones are given below. + +Iterable-based +~~~~~~~~~~~~~~ + +Wrap ``tqdm()`` around any iterable: + +.. code:: python + + from tqdm import tqdm + from time import sleep + + text = "" + for char in tqdm(["a", "b", "c", "d"]): + sleep(0.25) + text = text + char + +``trange(i)`` is a special optimised instance of ``tqdm(range(i))``: + +.. code:: python + + from tqdm import trange + + for i in trange(100): + sleep(0.01) + +Instantiation outside of the loop allows for manual control over ``tqdm()``: + +.. code:: python + + pbar = tqdm(["a", "b", "c", "d"]) + for char in pbar: + sleep(0.25) + pbar.set_description("Processing %s" % char) + +Manual +~~~~~~ + +Manual control of ``tqdm()`` updates using a ``with`` statement: + +.. code:: python + + with tqdm(total=100) as pbar: + for i in range(10): + sleep(0.1) + pbar.update(10) + +If the optional variable ``total`` (or an iterable with ``len()``) is +provided, predictive stats are displayed. + +``with`` is also optional (you can just assign ``tqdm()`` to a variable, +but in this case don't forget to ``del`` or ``close()`` at the end: + +.. code:: python + + pbar = tqdm(total=100) + for i in range(10): + sleep(0.1) + pbar.update(10) + pbar.close() + +Module +~~~~~~ + +Perhaps the most wonderful use of ``tqdm`` is in a script or on the command +line. Simply inserting ``tqdm`` (or ``python -m tqdm``) between pipes will pass +through all ``stdin`` to ``stdout`` while printing progress to ``stderr``. + +The example below demonstrate counting the number of lines in all Python files +in the current directory, with timing information included. + +.. code:: sh + + $ time find . -name '*.py' -type f -exec cat \{} \; | wc -l + 857365 + + real 0m3.458s + user 0m0.274s + sys 0m3.325s + + $ time find . -name '*.py' -type f -exec cat \{} \; | tqdm | wc -l + 857366it [00:03, 246471.31it/s] + 857365 + + real 0m3.585s + user 0m0.862s + sys 0m3.358s + +Note that the usual arguments for ``tqdm`` can also be specified. + +.. code:: sh + + $ find . -name '*.py' -type f -exec cat \{} \; | + tqdm --unit loc --unit_scale --total 857366 >> /dev/null + 100%|█████████████████████████████████| 857K/857K [00:04<00:00, 246Kloc/s] + +Backing up a large directory? + +.. code:: sh + + $ tar -zcf - docs/ | tqdm --bytes --total `du -sb docs/ | cut -f1` \ + > backup.tgz + 44%|██████████████▊ | 153M/352M [00:14<00:18, 11.0MB/s] + +This can be beautified further: + +.. code:: sh + + $ BYTES=$(du -sb docs/ | cut -f1) + $ tar -cf - docs/ \ + | tqdm --bytes --total "$BYTES" --desc Processing | gzip \ + | tqdm --bytes --total "$BYTES" --desc Compressed --position 1 \ + > ~/backup.tgz + Processing: 100%|██████████████████████| 352M/352M [00:14<00:00, 30.2MB/s] + Compressed: 42%|█████████▎ | 148M/352M [00:14<00:19, 10.9MB/s] + +Or done on a file level using 7-zip: + +.. code:: sh + + $ 7z a -bd -r backup.7z docs/ | grep Compressing \ + | tqdm --total $(find docs/ -type f | wc -l) --unit files \ + | grep -v Compressing + 100%|██████████████████████████▉| 15327/15327 [01:00<00:00, 712.96files/s] + +Pre-existing CLI programs already outputting basic progress information will +benefit from ``tqdm``'s ``--update`` and ``--update_to`` flags: + +.. code:: sh + + $ seq 3 0.1 5 | tqdm --total 5 --update_to --null + 100%|████████████████████████████████████| 5.0/5 [00:00<00:00, 9673.21it/s] + $ seq 10 | tqdm --update --null # 1 + 2 + ... + 10 = 55 iterations + 55it [00:00, 90006.52it/s] + +FAQ and Known Issues +-------------------- + +|GitHub-Issues| + +The most common issues relate to excessive output on multiple lines, instead +of a neat one-line progress bar. + +- Consoles in general: require support for carriage return (``CR``, ``\r``). + + * Some cloud logging consoles which don't support ``\r`` properly + (`cloudwatch `__, + `K8s `__) may benefit from + ``export TQDM_POSITION=-1``. + +- Nested progress bars: + + * Consoles in general: require support for moving cursors up to the + previous line. For example, + `IDLE `__, + `ConEmu `__ and + `PyCharm `__ (also + `here `__, + `here `__, and + `here `__) + lack full support. + * Windows: additionally may require the Python module ``colorama`` + to ensure nested bars stay within their respective lines. + +- Unicode: + + * Environments which report that they support unicode will have solid smooth + progressbars. The fallback is an ``ascii``-only bar. + * Windows consoles often only partially support unicode and thus + `often require explicit ascii=True `__ + (also `here `__). This is due to + either normal-width unicode characters being incorrectly displayed as + "wide", or some unicode characters not rendering. + +- Wrapping generators: + + * Generator wrapper functions tend to hide the length of iterables. + ``tqdm`` does not. + * Replace ``tqdm(enumerate(...))`` with ``enumerate(tqdm(...))`` or + ``tqdm(enumerate(x), total=len(x), ...)``. + The same applies to ``numpy.ndenumerate``. + * Replace ``tqdm(zip(a, b))`` with ``zip(tqdm(a), b)`` or even + ``zip(tqdm(a), tqdm(b))``. + * The same applies to ``itertools``. + * Some useful convenience functions can be found under ``tqdm.contrib``. + +- `No intermediate output in docker-compose `__: + use ``docker-compose run`` instead of ``docker-compose up`` and ``tty: true``. + +- Overriding defaults via environment variables: + e.g. in CI/cloud jobs, ``export TQDM_MININTERVAL=5`` to avoid log spam. + This override logic is handled by the ``tqdm.utils.envwrap`` decorator + (useful independent of ``tqdm``). + +If you come across any other difficulties, browse and file |GitHub-Issues|. + +Documentation +------------- + +|Py-Versions| |README-Hits| (Since 19 May 2016) + +.. code:: python + + class tqdm(): + """ + Decorate an iterable object, returning an iterator which acts exactly + like the original iterable, but prints a dynamically updating + progressbar every time a value is requested. + """ + + @envwrap("TQDM_") # override defaults via env vars + def __init__(self, iterable=None, desc=None, total=None, leave=True, + file=None, ncols=None, mininterval=0.1, + maxinterval=10.0, miniters=None, ascii=None, disable=False, + unit='it', unit_scale=False, dynamic_ncols=False, + smoothing=0.3, bar_format=None, initial=0, position=None, + postfix=None, unit_divisor=1000, write_bytes=False, + lock_args=None, nrows=None, colour=None, delay=0): + +Parameters +~~~~~~~~~~ + +* iterable : iterable, optional + Iterable to decorate with a progressbar. + Leave blank to manually manage the updates. +* desc : str, optional + Prefix for the progressbar. +* total : int or float, optional + The number of expected iterations. If unspecified, + len(iterable) is used if possible. If float("inf") or as a last + resort, only basic progress statistics are displayed + (no ETA, no progressbar). + If ``gui`` is True and this parameter needs subsequent updating, + specify an initial arbitrary large positive number, + e.g. 9e9. +* leave : bool, optional + If [default: True], keeps all traces of the progressbar + upon termination of iteration. + If ``None``, will leave only if ``position`` is ``0``. +* file : ``io.TextIOWrapper`` or ``io.StringIO``, optional + Specifies where to output the progress messages + (default: sys.stderr). Uses ``file.write(str)`` and ``file.flush()`` + methods. For encoding, see ``write_bytes``. +* ncols : int, optional + The width of the entire output message. If specified, + dynamically resizes the progressbar to stay within this bound. + If unspecified, attempts to use environment width. The + fallback is a meter width of 10 and no limit for the counter and + statistics. If 0, will not print any meter (only stats). +* mininterval : float, optional + Minimum progress display update interval [default: 0.1] seconds. +* maxinterval : float, optional + Maximum progress display update interval [default: 10] seconds. + Automatically adjusts ``miniters`` to correspond to ``mininterval`` + after long display update lag. Only works if ``dynamic_miniters`` + or monitor thread is enabled. +* miniters : int or float, optional + Minimum progress display update interval, in iterations. + If 0 and ``dynamic_miniters``, will automatically adjust to equal + ``mininterval`` (more CPU efficient, good for tight loops). + If > 0, will skip display of specified number of iterations. + Tweak this and ``mininterval`` to get very efficient loops. + If your progress is erratic with both fast and slow iterations + (network, skipping items, etc) you should set miniters=1. +* ascii : bool or str, optional + If unspecified or False, use unicode (smooth blocks) to fill + the meter. The fallback is to use ASCII characters " 123456789#". +* disable : bool, optional + Whether to disable the entire progressbar wrapper + [default: False]. If set to None, disable on non-TTY. +* unit : str, optional + String that will be used to define the unit of each iteration + [default: it]. +* unit_scale : bool or int or float, optional + If 1 or True, the number of iterations will be reduced/scaled + automatically and a metric prefix following the + International System of Units standard will be added + (kilo, mega, etc.) [default: False]. If any other non-zero + number, will scale ``total`` and ``n``. +* dynamic_ncols : bool, optional + If set, constantly alters ``ncols`` and ``nrows`` to the + environment (allowing for window resizes) [default: False]. +* smoothing : float, optional + Exponential moving average smoothing factor for speed estimates + (ignored in GUI mode). Ranges from 0 (average speed) to 1 + (current/instantaneous speed) [default: 0.3]. +* bar_format : str, optional + Specify a custom bar string formatting. May impact performance. + [default: '{l_bar}{bar}{r_bar}'], where + l_bar='{desc}: {percentage:3.0f}%|' and + r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' + '{rate_fmt}{postfix}]' + Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, + percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, + rate, rate_fmt, rate_noinv, rate_noinv_fmt, + rate_inv, rate_inv_fmt, postfix, unit_divisor, + remaining, remaining_s, eta. + Note that a trailing ": " is automatically removed after {desc} + if the latter is empty. +* initial : int or float, optional + The initial counter value. Useful when restarting a progress + bar [default: 0]. If using float, consider specifying ``{n:.3f}`` + or similar in ``bar_format``, or specifying ``unit_scale``. +* position : int, optional + Specify the line offset to print this bar (starting from 0) + Automatic if unspecified. + Useful to manage multiple bars at once (eg, from threads). +* postfix : dict or ``*``, optional + Specify additional stats to display at the end of the bar. + Calls ``set_postfix(**postfix)`` if possible (dict). +* unit_divisor : float, optional + [default: 1000], ignored unless ``unit_scale`` is True. +* write_bytes : bool, optional + Whether to write bytes. If (default: False) will write unicode. +* lock_args : tuple, optional + Passed to ``refresh`` for intermediate output + (initialisation, iterating, and updating). +* nrows : int, optional + The screen height. If specified, hides nested bars outside this + bound. If unspecified, attempts to use environment height. + The fallback is 20. +* colour : str, optional + Bar colour (e.g. 'green', '#00ff00'). +* delay : float, optional + Don't display until [default: 0] seconds have elapsed. + +Extra CLI Options +~~~~~~~~~~~~~~~~~ + +* delim : chr, optional + Delimiting character [default: '\n']. Use '\0' for null. + N.B.: on Windows systems, Python converts '\n' to '\r\n'. +* buf_size : int, optional + String buffer size in bytes [default: 256] + used when ``delim`` is specified. +* bytes : bool, optional + If true, will count bytes, ignore ``delim``, and default + ``unit_scale`` to True, ``unit_divisor`` to 1024, and ``unit`` to 'B'. +* tee : bool, optional + If true, passes ``stdin`` to both ``stderr`` and ``stdout``. +* update : bool, optional + If true, will treat input as newly elapsed iterations, + i.e. numbers to pass to ``update()``. Note that this is slow + (~2e5 it/s) since every input must be decoded as a number. +* update_to : bool, optional + If true, will treat input as total elapsed iterations, + i.e. numbers to assign to ``self.n``. Note that this is slow + (~2e5 it/s) since every input must be decoded as a number. +* null : bool, optional + If true, will discard input (no stdout). +* manpath : str, optional + Directory in which to install tqdm man pages. +* comppath : str, optional + Directory in which to place tqdm completion. +* log : str, optional + CRITICAL|FATAL|ERROR|WARN(ING)|[default: 'INFO']|DEBUG|NOTSET. + +Returns +~~~~~~~ + +* out : decorated iterator. + +.. code:: python + + class tqdm(): + def update(self, n=1): + """ + Manually update the progress bar, useful for streams + such as reading files. + E.g.: + >>> t = tqdm(total=filesize) # Initialise + >>> for current_buffer in stream: + ... ... + ... t.update(len(current_buffer)) + >>> t.close() + The last line is highly recommended, but possibly not necessary if + ``t.update()`` will be called in such a way that ``filesize`` will be + exactly reached and printed. + + Parameters + ---------- + n : int or float, optional + Increment to add to the internal counter of iterations + [default: 1]. If using float, consider specifying ``{n:.3f}`` + or similar in ``bar_format``, or specifying ``unit_scale``. + + Returns + ------- + out : bool or None + True if a ``display()`` was triggered. + """ + + def close(self): + """Cleanup and (if leave=False) close the progressbar.""" + + def clear(self, nomove=False): + """Clear current bar display.""" + + def refresh(self): + """ + Force refresh the display of this bar. + + Parameters + ---------- + nolock : bool, optional + If ``True``, does not lock. + If [default: ``False``]: calls ``acquire()`` on internal lock. + lock_args : tuple, optional + Passed to internal lock's ``acquire()``. + If specified, will only ``display()`` if ``acquire()`` returns ``True``. + """ + + def unpause(self): + """Restart tqdm timer from last print time.""" + + def reset(self, total=None): + """ + Resets to 0 iterations for repeated use. + + Consider combining with ``leave=True``. + + Parameters + ---------- + total : int or float, optional. Total to use for the new bar. + """ + + def set_description(self, desc=None, refresh=True): + """ + Set/modify description of the progress bar. + + Parameters + ---------- + desc : str, optional + refresh : bool, optional + Forces refresh [default: True]. + """ + + def set_postfix(self, ordered_dict=None, refresh=True, **tqdm_kwargs): + """ + Set/modify postfix (additional stats) + with automatic formatting based on datatype. + + Parameters + ---------- + ordered_dict : dict or OrderedDict, optional + refresh : bool, optional + Forces refresh [default: True]. + kwargs : dict, optional + """ + + @classmethod + def write(cls, s, file=sys.stdout, end="\n"): + """Print a message via tqdm (without overlap with bars).""" + + @property + def format_dict(self): + """Public API for read-only member access.""" + + def display(self, msg=None, pos=None): + """ + Use ``self.sp`` to display ``msg`` in the specified ``pos``. + + Consider overloading this function when inheriting to use e.g.: + ``self.some_frontend(**self.format_dict)`` instead of ``self.sp``. + + Parameters + ---------- + msg : str, optional. What to display (default: ``repr(self)``). + pos : int, optional. Position to ``moveto`` + (default: ``abs(self.pos)``). + """ + + @classmethod + @contextmanager + def wrapattr(cls, stream, method, total=None, bytes=True, **tqdm_kwargs): + """ + stream : file-like object. + method : str, "read" or "write". The result of ``read()`` and + the first argument of ``write()`` should have a ``len()``. + + >>> with tqdm.wrapattr(file_obj, "read", total=file_obj.size) as fobj: + ... while True: + ... chunk = fobj.read(chunk_size) + ... if not chunk: + ... break + """ + + @classmethod + def pandas(cls, *targs, **tqdm_kwargs): + """Registers the current `tqdm` class with `pandas`.""" + + def trange(*args, **tqdm_kwargs): + """Shortcut for `tqdm(range(*args), **tqdm_kwargs)`.""" + +Convenience Functions +~~~~~~~~~~~~~~~~~~~~~ + +.. code:: python + + def tqdm.contrib.tenumerate(iterable, start=0, total=None, + tqdm_class=tqdm.auto.tqdm, **tqdm_kwargs): + """Equivalent of `numpy.ndenumerate` or builtin `enumerate`.""" + + def tqdm.contrib.tzip(iter1, *iter2plus, **tqdm_kwargs): + """Equivalent of builtin `zip`.""" + + def tqdm.contrib.tmap(function, *sequences, **tqdm_kwargs): + """Equivalent of builtin `map`.""" + +Submodules +~~~~~~~~~~ + +.. code:: python + + class tqdm.notebook.tqdm(tqdm.tqdm): + """IPython/Jupyter Notebook widget.""" + + class tqdm.auto.tqdm(tqdm.tqdm): + """Automatically chooses beween `tqdm.notebook` and `tqdm.tqdm`.""" + + class tqdm.asyncio.tqdm(tqdm.tqdm): + """Asynchronous version.""" + @classmethod + def as_completed(cls, fs, *, loop=None, timeout=None, total=None, + **tqdm_kwargs): + """Wrapper for `asyncio.as_completed`.""" + + class tqdm.gui.tqdm(tqdm.tqdm): + """Matplotlib GUI version.""" + + class tqdm.tk.tqdm(tqdm.tqdm): + """Tkinter GUI version.""" + + class tqdm.rich.tqdm(tqdm.tqdm): + """`rich.progress` version.""" + + class tqdm.keras.TqdmCallback(keras.callbacks.Callback): + """Keras callback for epoch and batch progress.""" + + class tqdm.dask.TqdmCallback(dask.callbacks.Callback): + """Dask callback for task progress.""" + + +``contrib`` ++++++++++++ + +The ``tqdm.contrib`` package also contains experimental modules: + +- ``tqdm.contrib.itertools``: Thin wrappers around ``itertools`` +- ``tqdm.contrib.concurrent``: Thin wrappers around ``concurrent.futures`` +- ``tqdm.contrib.slack``: Posts to `Slack `__ bots +- ``tqdm.contrib.discord``: Posts to `Discord `__ bots +- ``tqdm.contrib.telegram``: Posts to `Telegram `__ bots +- ``tqdm.contrib.bells``: Automagically enables all optional features + + * ``auto``, ``pandas``, ``slack``, ``discord``, ``telegram`` + +Examples and Advanced Usage +--------------------------- + +- See the `examples `__ + folder; +- import the module and run ``help()``; +- consult the `wiki `__; + + * this has an + `excellent article `__ + on how to make a **great** progressbar; + +- check out the `slides from PyData London `__, or +- run the |binder-demo|. + +Description and additional stats +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Custom information can be displayed and updated dynamically on ``tqdm`` bars +with the ``desc`` and ``postfix`` arguments: + +.. code:: python + + from tqdm import tqdm, trange + from random import random, randint + from time import sleep + + with trange(10) as t: + for i in t: + # Description will be displayed on the left + t.set_description('GEN %i' % i) + # Postfix will be displayed on the right, + # formatted automatically based on argument's datatype + t.set_postfix(loss=random(), gen=randint(1,999), str='h', + lst=[1, 2]) + sleep(0.1) + + with tqdm(total=10, bar_format="{postfix[0]} {postfix[1][value]:>8.2g}", + postfix=["Batch", {"value": 0}]) as t: + for i in range(10): + sleep(0.1) + t.postfix[1]["value"] = i / 2 + t.update() + +Points to remember when using ``{postfix[...]}`` in the ``bar_format`` string: + +- ``postfix`` also needs to be passed as an initial argument in a compatible + format, and +- ``postfix`` will be auto-converted to a string if it is a ``dict``-like + object. To prevent this behaviour, insert an extra item into the dictionary + where the key is not a string. + +Additional ``bar_format`` parameters may also be defined by overriding +``format_dict``, and the bar itself may be modified using ``ascii``: + +.. code:: python + + from tqdm import tqdm + class TqdmExtraFormat(tqdm): + """Provides a `total_time` format parameter""" + @property + def format_dict(self): + d = super().format_dict + total_time = d["elapsed"] * (d["total"] or 0) / max(d["n"], 1) + d.update(total_time=self.format_interval(total_time) + " in total") + return d + + for i in TqdmExtraFormat( + range(9), ascii=" .oO0", + bar_format="{total_time}: {percentage:.0f}%|{bar}{r_bar}"): + if i == 4: + break + +.. code:: + + 00:00 in total: 44%|0000. | 4/9 [00:00<00:00, 962.93it/s] + +Note that ``{bar}`` also supports a format specifier ``[width][type]``. + +- ``width`` + + * unspecified (default): automatic to fill ``ncols`` + * ``int >= 0``: fixed width overriding ``ncols`` logic + * ``int < 0``: subtract from the automatic default + +- ``type`` + + * ``a``: ascii (``ascii=True`` override) + * ``u``: unicode (``ascii=False`` override) + * ``b``: blank (``ascii=" "`` override) + +This means a fixed bar with right-justified text may be created by using: +``bar_format="{l_bar}{bar:10}|{bar:-10b}right-justified"`` + +Nested progress bars +~~~~~~~~~~~~~~~~~~~~ + +``tqdm`` supports nested progress bars. Here's an example: + +.. code:: python + + from tqdm.auto import trange + from time import sleep + + for i in trange(4, desc='1st loop'): + for j in trange(5, desc='2nd loop'): + for k in trange(50, desc='3rd loop', leave=False): + sleep(0.01) + +For manual control over positioning (e.g. for multi-processing use), +you may specify ``position=n`` where ``n=0`` for the outermost bar, +``n=1`` for the next, and so on. +However, it's best to check if ``tqdm`` can work without manual ``position`` +first. + +.. code:: python + + from time import sleep + from tqdm import trange, tqdm + from multiprocessing import Pool, RLock, freeze_support + + L = list(range(9)) + + def progresser(n): + interval = 0.001 / (n + 2) + total = 5000 + text = f"#{n}, est. {interval * total:<04.2}s" + for _ in trange(total, desc=text, position=n): + sleep(interval) + + if __name__ == '__main__': + freeze_support() # for Windows support + tqdm.set_lock(RLock()) # for managing output contention + p = Pool(initializer=tqdm.set_lock, initargs=(tqdm.get_lock(),)) + p.map(progresser, L) + +Note that in Python 3, ``tqdm.write`` is thread-safe: + +.. code:: python + + from time import sleep + from tqdm import tqdm, trange + from concurrent.futures import ThreadPoolExecutor + + L = list(range(9)) + + def progresser(n): + interval = 0.001 / (n + 2) + total = 5000 + text = f"#{n}, est. {interval * total:<04.2}s" + for _ in trange(total, desc=text): + sleep(interval) + if n == 6: + tqdm.write("n == 6 completed.") + tqdm.write("`tqdm.write()` is thread-safe in py3!") + + if __name__ == '__main__': + with ThreadPoolExecutor() as p: + p.map(progresser, L) + +Hooks and callbacks +~~~~~~~~~~~~~~~~~~~ + +``tqdm`` can easily support callbacks/hooks and manual updates. +Here's an example with ``urllib``: + +**``urllib.urlretrieve`` documentation** + + | [...] + | If present, the hook function will be called once + | on establishment of the network connection and once after each block read + | thereafter. The hook will be passed three arguments; a count of blocks + | transferred so far, a block size in bytes, and the total size of the file. + | [...] + +.. code:: python + + import urllib, os + from tqdm import tqdm + urllib = getattr(urllib, 'request', urllib) + + class TqdmUpTo(tqdm): + """Provides `update_to(n)` which uses `tqdm.update(delta_n)`.""" + def update_to(self, b=1, bsize=1, tsize=None): + """ + b : int, optional + Number of blocks transferred so far [default: 1]. + bsize : int, optional + Size of each block (in tqdm units) [default: 1]. + tsize : int, optional + Total size (in tqdm units). If [default: None] remains unchanged. + """ + if tsize is not None: + self.total = tsize + return self.update(b * bsize - self.n) # also sets self.n = b * bsize + + eg_link = "https://caspersci.uk.to/matryoshka.zip" + with TqdmUpTo(unit='B', unit_scale=True, unit_divisor=1024, miniters=1, + desc=eg_link.split('/')[-1]) as t: # all optional kwargs + urllib.urlretrieve(eg_link, filename=os.devnull, + reporthook=t.update_to, data=None) + t.total = t.n + +Inspired by `twine#242 `__. +Functional alternative in +`examples/tqdm_wget.py `__. + +It is recommend to use ``miniters=1`` whenever there is potentially +large differences in iteration speed (e.g. downloading a file over +a patchy connection). + +**Wrapping read/write methods** + +To measure throughput through a file-like object's ``read`` or ``write`` +methods, use ``CallbackIOWrapper``: + +.. code:: python + + from tqdm.auto import tqdm + from tqdm.utils import CallbackIOWrapper + + with tqdm(total=file_obj.size, + unit='B', unit_scale=True, unit_divisor=1024) as t: + fobj = CallbackIOWrapper(t.update, file_obj, "read") + while True: + chunk = fobj.read(chunk_size) + if not chunk: + break + t.reset() + # ... continue to use `t` for something else + +Alternatively, use the even simpler ``wrapattr`` convenience function, +which would condense both the ``urllib`` and ``CallbackIOWrapper`` examples +down to: + +.. code:: python + + import urllib, os + from tqdm import tqdm + + eg_link = "https://caspersci.uk.to/matryoshka.zip" + response = getattr(urllib, 'request', urllib).urlopen(eg_link) + with tqdm.wrapattr(open(os.devnull, "wb"), "write", + miniters=1, desc=eg_link.split('/')[-1], + total=getattr(response, 'length', None)) as fout: + for chunk in response: + fout.write(chunk) + +The ``requests`` equivalent is nearly identical: + +.. code:: python + + import requests, os + from tqdm import tqdm + + eg_link = "https://caspersci.uk.to/matryoshka.zip" + response = requests.get(eg_link, stream=True) + with tqdm.wrapattr(open(os.devnull, "wb"), "write", + miniters=1, desc=eg_link.split('/')[-1], + total=int(response.headers.get('content-length', 0))) as fout: + for chunk in response.iter_content(chunk_size=4096): + fout.write(chunk) + +**Custom callback** + +``tqdm`` is known for intelligently skipping unnecessary displays. To make a +custom callback take advantage of this, simply use the return value of +``update()``. This is set to ``True`` if a ``display()`` was triggered. + +.. code:: python + + from tqdm.auto import tqdm as std_tqdm + + def external_callback(*args, **kwargs): + ... + + class TqdmExt(std_tqdm): + def update(self, n=1): + displayed = super().update(n) + if displayed: + external_callback(**self.format_dict) + return displayed + +``asyncio`` +~~~~~~~~~~~ + +Note that ``break`` isn't currently caught by asynchronous iterators. +This means that ``tqdm`` cannot clean up after itself in this case: + +.. code:: python + + from tqdm.asyncio import tqdm + + async for i in tqdm(range(9)): + if i == 2: + break + +Instead, either call ``pbar.close()`` manually or use the context manager syntax: + +.. code:: python + + from tqdm.asyncio import tqdm + + with tqdm(range(9)) as pbar: + async for i in pbar: + if i == 2: + break + +Pandas Integration +~~~~~~~~~~~~~~~~~~ + +Due to popular demand we've added support for ``pandas`` -- here's an example +for ``DataFrame.progress_apply`` and ``DataFrameGroupBy.progress_apply``: + +.. code:: python + + import pandas as pd + import numpy as np + from tqdm import tqdm + + df = pd.DataFrame(np.random.randint(0, 100, (100000, 6))) + + # Register `pandas.progress_apply` and `pandas.Series.map_apply` with `tqdm` + # (can use `tqdm.gui.tqdm`, `tqdm.notebook.tqdm`, optional kwargs, etc.) + tqdm.pandas(desc="my bar!") + + # Now you can use `progress_apply` instead of `apply` + # and `progress_map` instead of `map` + df.progress_apply(lambda x: x**2) + # can also groupby: + # df.groupby(0).progress_apply(lambda x: x**2) + +In case you're interested in how this works (and how to modify it for your +own callbacks), see the +`examples `__ +folder or import the module and run ``help()``. + +Keras Integration +~~~~~~~~~~~~~~~~~ + +A ``keras`` callback is also available: + +.. code:: python + + from tqdm.keras import TqdmCallback + + ... + + model.fit(..., verbose=0, callbacks=[TqdmCallback()]) + +Dask Integration +~~~~~~~~~~~~~~~~ + +A ``dask`` callback is also available: + +.. code:: python + + from tqdm.dask import TqdmCallback + + with TqdmCallback(desc="compute"): + ... + arr.compute() + + # or use callback globally + cb = TqdmCallback(desc="global") + cb.register() + arr.compute() + +IPython/Jupyter Integration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +IPython/Jupyter is supported via the ``tqdm.notebook`` submodule: + +.. code:: python + + from tqdm.notebook import trange, tqdm + from time import sleep + + for i in trange(3, desc='1st loop'): + for j in tqdm(range(100), desc='2nd loop'): + sleep(0.01) + +In addition to ``tqdm`` features, the submodule provides a native Jupyter +widget (compatible with IPython v1-v4 and Jupyter), fully working nested bars +and colour hints (blue: normal, green: completed, red: error/interrupt, +light blue: no ETA); as demonstrated below. + +|Screenshot-Jupyter1| +|Screenshot-Jupyter2| +|Screenshot-Jupyter3| + +The ``notebook`` version supports percentage or pixels for overall width +(e.g.: ``ncols='100%'`` or ``ncols='480px'``). + +It is also possible to let ``tqdm`` automatically choose between +console or notebook versions by using the ``autonotebook`` submodule: + +.. code:: python + + from tqdm.autonotebook import tqdm + tqdm.pandas() + +Note that this will issue a ``TqdmExperimentalWarning`` if run in a notebook +since it is not meant to be possible to distinguish between ``jupyter notebook`` +and ``jupyter console``. Use ``auto`` instead of ``autonotebook`` to suppress +this warning. + +Note that notebooks will display the bar in the cell where it was created. +This may be a different cell from the one where it is used. +If this is not desired, either + +- delay the creation of the bar to the cell where it must be displayed, or +- create the bar with ``display=False``, and in a later cell call + ``display(bar.container)``: + +.. code:: python + + from tqdm.notebook import tqdm + pbar = tqdm(..., display=False) + +.. code:: python + + # different cell + display(pbar.container) + +The ``keras`` callback has a ``display()`` method which can be used likewise: + +.. code:: python + + from tqdm.keras import TqdmCallback + cbk = TqdmCallback(display=False) + +.. code:: python + + # different cell + cbk.display() + model.fit(..., verbose=0, callbacks=[cbk]) + +Another possibility is to have a single bar (near the top of the notebook) +which is constantly re-used (using ``reset()`` rather than ``close()``). +For this reason, the notebook version (unlike the CLI version) does not +automatically call ``close()`` upon ``Exception``. + +.. code:: python + + from tqdm.notebook import tqdm + pbar = tqdm() + +.. code:: python + + # different cell + iterable = range(100) + pbar.reset(total=len(iterable)) # initialise with new `total` + for i in iterable: + pbar.update() + pbar.refresh() # force print final status but don't `close()` + +Custom Integration +~~~~~~~~~~~~~~~~~~ + +To change the default arguments (such as making ``dynamic_ncols=True``), +simply use built-in Python magic: + +.. code:: python + + from functools import partial + from tqdm import tqdm as std_tqdm + tqdm = partial(std_tqdm, dynamic_ncols=True) + +For further customisation, +``tqdm`` may be inherited from to create custom callbacks (as with the +``TqdmUpTo`` example `above <#hooks-and-callbacks>`__) or for custom frontends +(e.g. GUIs such as notebook or plotting packages). In the latter case: + +1. ``def __init__()`` to call ``super().__init__(..., gui=True)`` to disable + terminal ``status_printer`` creation. +2. Redefine: ``close()``, ``clear()``, ``display()``. + +Consider overloading ``display()`` to use e.g. +``self.frontend(**self.format_dict)`` instead of ``self.sp(repr(self))``. + +Some submodule examples of inheritance: + +- `tqdm/notebook.py `__ +- `tqdm/gui.py `__ +- `tqdm/tk.py `__ +- `tqdm/contrib/slack.py `__ +- `tqdm/contrib/discord.py `__ +- `tqdm/contrib/telegram.py `__ + +Dynamic Monitor/Meter +~~~~~~~~~~~~~~~~~~~~~ + +You can use a ``tqdm`` as a meter which is not monotonically increasing. +This could be because ``n`` decreases (e.g. a CPU usage monitor) or ``total`` +changes. + +One example would be recursively searching for files. The ``total`` is the +number of objects found so far, while ``n`` is the number of those objects which +are files (rather than folders): + +.. code:: python + + from tqdm import tqdm + import os.path + + def find_files_recursively(path, show_progress=True): + files = [] + # total=1 assumes `path` is a file + t = tqdm(total=1, unit="file", disable=not show_progress) + if not os.path.exists(path): + raise IOError("Cannot find:" + path) + + def append_found_file(f): + files.append(f) + t.update() + + def list_found_dir(path): + """returns os.listdir(path) assuming os.path.isdir(path)""" + listing = os.listdir(path) + # subtract 1 since a "file" we found was actually this directory + t.total += len(listing) - 1 + # fancy way to give info without forcing a refresh + t.set_postfix(dir=path[-10:], refresh=False) + t.update(0) # may trigger a refresh + return listing + + def recursively_search(path): + if os.path.isdir(path): + for f in list_found_dir(path): + recursively_search(os.path.join(path, f)) + else: + append_found_file(path) + + recursively_search(path) + t.set_postfix(dir=path) + t.close() + return files + +Using ``update(0)`` is a handy way to let ``tqdm`` decide when to trigger a +display refresh to avoid console spamming. + +Writing messages +~~~~~~~~~~~~~~~~ + +This is a work in progress (see +`#737 `__). + +Since ``tqdm`` uses a simple printing mechanism to display progress bars, +you should not write any message in the terminal using ``print()`` while +a progressbar is open. + +To write messages in the terminal without any collision with ``tqdm`` bar +display, a ``.write()`` method is provided: + +.. code:: python + + from tqdm.auto import tqdm, trange + from time import sleep + + bar = trange(10) + for i in bar: + # Print using tqdm class method .write() + sleep(0.1) + if not (i % 3): + tqdm.write("Done task %i" % i) + # Can also use bar.write() + +By default, this will print to standard output ``sys.stdout``. but you can +specify any file-like object using the ``file`` argument. For example, this +can be used to redirect the messages writing to a log file or class. + +Redirecting writing +~~~~~~~~~~~~~~~~~~~ + +If using a library that can print messages to the console, editing the library +by replacing ``print()`` with ``tqdm.write()`` may not be desirable. +In that case, redirecting ``sys.stdout`` to ``tqdm.write()`` is an option. + +To redirect ``sys.stdout``, create a file-like class that will write +any input string to ``tqdm.write()``, and supply the arguments +``file=sys.stdout, dynamic_ncols=True``. + +A reusable canonical example is given below: + +.. code:: python + + from time import sleep + import contextlib + import sys + from tqdm import tqdm + from tqdm.contrib import DummyTqdmFile + + + @contextlib.contextmanager + def std_out_err_redirect_tqdm(): + orig_out_err = sys.stdout, sys.stderr + try: + sys.stdout, sys.stderr = map(DummyTqdmFile, orig_out_err) + yield orig_out_err[0] + # Relay exceptions + except Exception as exc: + raise exc + # Always restore sys.stdout/err if necessary + finally: + sys.stdout, sys.stderr = orig_out_err + + def some_fun(i): + print("Fee, fi, fo,".split()[i]) + + # Redirect stdout to tqdm.write() (don't forget the `as save_stdout`) + with std_out_err_redirect_tqdm() as orig_stdout: + # tqdm needs the original stdout + # and dynamic_ncols=True to autodetect console width + for i in tqdm(range(3), file=orig_stdout, dynamic_ncols=True): + sleep(.5) + some_fun(i) + + # After the `with`, printing is restored + print("Done!") + +Redirecting ``logging`` +~~~~~~~~~~~~~~~~~~~~~~~ + +Similar to ``sys.stdout``/``sys.stderr`` as detailed above, console ``logging`` +may also be redirected to ``tqdm.write()``. + +Warning: if also redirecting ``sys.stdout``/``sys.stderr``, make sure to +redirect ``logging`` first if needed. + +Helper methods are available in ``tqdm.contrib.logging``. For example: + +.. code:: python + + import logging + from tqdm import trange + from tqdm.contrib.logging import logging_redirect_tqdm + + LOG = logging.getLogger(__name__) + + if __name__ == '__main__': + logging.basicConfig(level=logging.INFO) + with logging_redirect_tqdm(): + for i in trange(9): + if i == 4: + LOG.info("console logging redirected to `tqdm.write()`") + # logging restored + +Monitoring thread, intervals and miniters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``tqdm`` implements a few tricks to increase efficiency and reduce overhead. + +- Avoid unnecessary frequent bar refreshing: ``mininterval`` defines how long + to wait between each refresh. ``tqdm`` always gets updated in the background, + but it will display only every ``mininterval``. +- Reduce number of calls to check system clock/time. +- ``mininterval`` is more intuitive to configure than ``miniters``. + A clever adjustment system ``dynamic_miniters`` will automatically adjust + ``miniters`` to the amount of iterations that fit into time ``mininterval``. + Essentially, ``tqdm`` will check if it's time to print without actually + checking time. This behaviour can be still be bypassed by manually setting + ``miniters``. + +However, consider a case with a combination of fast and slow iterations. +After a few fast iterations, ``dynamic_miniters`` will set ``miniters`` to a +large number. When iteration rate subsequently slows, ``miniters`` will +remain large and thus reduce display update frequency. To address this: + +- ``maxinterval`` defines the maximum time between display refreshes. + A concurrent monitoring thread checks for overdue updates and forces one + where necessary. + +The monitoring thread should not have a noticeable overhead, and guarantees +updates at least every 10 seconds by default. +This value can be directly changed by setting the ``monitor_interval`` of +any ``tqdm`` instance (i.e. ``t = tqdm.tqdm(...); t.monitor_interval = 2``). +The monitor thread may be disabled application-wide by setting +``tqdm.tqdm.monitor_interval = 0`` before instantiation of any ``tqdm`` bar. + + +Merch +----- + +You can buy `tqdm branded merch `__ now! + +Contributions +------------- + +|GitHub-Commits| |GitHub-Issues| |GitHub-PRs| |OpenHub-Status| |GitHub-Contributions| |CII Best Practices| + +All source code is hosted on `GitHub `__. +Contributions are welcome. + +See the +`CONTRIBUTING `__ +file for more information. + +Developers who have made significant contributions, ranked by *SLoC* +(surviving lines of code, +`git fame `__ ``-wMC --excl '\.(png|gif|jpg)$'``), +are: + +==================== ======================================================== ==== ================================ +Name ID SLoC Notes +==================== ======================================================== ==== ================================ +Casper da Costa-Luis `casperdcl `__ ~80% primary maintainer |Gift-Casper| +Stephen Larroque `lrq3000 `__ ~9% team member +Martin Zugnoni `martinzugnoni `__ ~3% +Daniel Ecer `de-code `__ ~2% +Richard Sheridan `richardsheridan `__ ~1% +Guangshuo Chen `chengs `__ ~1% +Helio Machado `0x2b3bfa0 `__ ~1% +Kyle Altendorf `altendky `__ <1% +Noam Yorav-Raphael `noamraph `__ <1% original author +Matthew Stevens `mjstevens777 `__ <1% +Hadrien Mary `hadim `__ <1% team member +Mikhail Korobov `kmike `__ <1% team member +==================== ======================================================== ==== ================================ + +Ports to Other Languages +~~~~~~~~~~~~~~~~~~~~~~~~ + +A list is available on +`this wiki page `__. + + +LICENCE +------- + +Open Source (OSI approved): |LICENCE| + +Citation information: |DOI| + +|README-Hits| (Since 19 May 2016) + +.. |Logo| image:: https://tqdm.github.io/img/logo.gif +.. |Screenshot| image:: https://tqdm.github.io/img/tqdm.gif +.. |Video| image:: https://tqdm.github.io/img/video.jpg + :target: https://tqdm.github.io/video +.. |Slides| image:: https://tqdm.github.io/img/slides.jpg + :target: https://tqdm.github.io/PyData2019/slides.html +.. |Merch| image:: https://tqdm.github.io/img/merch.jpg + :target: https://tqdm.github.io/merch +.. |Build-Status| image:: https://img.shields.io/github/actions/workflow/status/tqdm/tqdm/test.yml?branch=master&label=tqdm&logo=GitHub + :target: https://github.com/tqdm/tqdm/actions/workflows/test.yml +.. |Coverage-Status| image:: https://img.shields.io/coveralls/github/tqdm/tqdm/master?logo=coveralls + :target: https://coveralls.io/github/tqdm/tqdm +.. |Branch-Coverage-Status| image:: https://codecov.io/gh/tqdm/tqdm/branch/master/graph/badge.svg + :target: https://codecov.io/gh/tqdm/tqdm +.. |Codacy-Grade| image:: https://app.codacy.com/project/badge/Grade/3f965571598f44549c7818f29cdcf177 + :target: https://www.codacy.com/gh/tqdm/tqdm/dashboard +.. |CII Best Practices| image:: https://bestpractices.coreinfrastructure.org/projects/3264/badge + :target: https://bestpractices.coreinfrastructure.org/projects/3264 +.. |GitHub-Status| image:: https://img.shields.io/github/tag/tqdm/tqdm.svg?maxAge=86400&logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/releases +.. |GitHub-Forks| image:: https://img.shields.io/github/forks/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/network +.. |GitHub-Stars| image:: https://img.shields.io/github/stars/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/stargazers +.. |GitHub-Commits| image:: https://img.shields.io/github/commit-activity/y/tqdm/tqdm.svg?logo=git&logoColor=white + :target: https://github.com/tqdm/tqdm/graphs/commit-activity +.. |GitHub-Issues| image:: https://img.shields.io/github/issues-closed/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/issues?q= +.. |GitHub-PRs| image:: https://img.shields.io/github/issues-pr-closed/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/pulls +.. |GitHub-Contributions| image:: https://img.shields.io/github/contributors/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/graphs/contributors +.. |GitHub-Updated| image:: https://img.shields.io/github/last-commit/tqdm/tqdm/master.svg?logo=github&logoColor=white&label=pushed + :target: https://github.com/tqdm/tqdm/pulse +.. |Gift-Casper| image:: https://img.shields.io/badge/dynamic/json.svg?color=ff69b4&label=gifts%20received&prefix=%C2%A3&query=%24..sum&url=https%3A%2F%2Fcaspersci.uk.to%2Fgifts.json + :target: https://cdcl.ml/sponsor +.. |Versions| image:: https://img.shields.io/pypi/v/tqdm.svg + :target: https://tqdm.github.io/releases +.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg?label=pypi%20downloads&logo=PyPI&logoColor=white + :target: https://pepy.tech/project/tqdm +.. |Py-Versions| image:: https://img.shields.io/pypi/pyversions/tqdm.svg?logo=python&logoColor=white + :target: https://pypi.org/project/tqdm +.. |Conda-Forge-Status| image:: https://img.shields.io/conda/v/conda-forge/tqdm.svg?label=conda-forge&logo=conda-forge + :target: https://anaconda.org/conda-forge/tqdm +.. |Snapcraft| image:: https://img.shields.io/badge/snap-install-82BEA0.svg?logo=snapcraft + :target: https://snapcraft.io/tqdm +.. |Docker| image:: https://img.shields.io/badge/docker-pull-blue.svg?logo=docker&logoColor=white + :target: https://hub.docker.com/r/tqdm/tqdm +.. |Libraries-Rank| image:: https://img.shields.io/librariesio/sourcerank/pypi/tqdm.svg?logo=koding&logoColor=white + :target: https://libraries.io/pypi/tqdm +.. |Libraries-Dependents| image:: https://img.shields.io/librariesio/dependent-repos/pypi/tqdm.svg?logo=koding&logoColor=white + :target: https://github.com/tqdm/tqdm/network/dependents +.. |OpenHub-Status| image:: https://www.openhub.net/p/tqdm/widgets/project_thin_badge?format=gif + :target: https://www.openhub.net/p/tqdm?ref=Thin+badge +.. |awesome-python| image:: https://awesome.re/mentioned-badge.svg + :target: https://github.com/vinta/awesome-python +.. |LICENCE| image:: https://img.shields.io/pypi/l/tqdm.svg + :target: https://raw.githubusercontent.com/tqdm/tqdm/master/LICENCE +.. |DOI| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.595120-blue.svg + :target: https://doi.org/10.5281/zenodo.595120 +.. |binder-demo| image:: https://mybinder.org/badge_logo.svg + :target: https://mybinder.org/v2/gh/tqdm/tqdm/master?filepath=DEMO.ipynb +.. |Screenshot-Jupyter1| image:: https://tqdm.github.io/img/jupyter-1.gif +.. |Screenshot-Jupyter2| image:: https://tqdm.github.io/img/jupyter-2.gif +.. |Screenshot-Jupyter3| image:: https://tqdm.github.io/img/jupyter-3.gif +.. |README-Hits| image:: https://cgi.cdcl.ml/hits?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif + :target: https://cgi.cdcl.ml/hits?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif&style=social diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..ce35f11ac7fc4a43609eb5296891a53364dd4a34 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/RECORD @@ -0,0 +1,72 @@ +../../Scripts/tqdm.exe,sha256=WZy4WarVY_AHr71bGC_cmLXPJQdGPOFjD6RuH9gY_p8,108371 +tqdm-4.67.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +tqdm-4.67.3.dist-info/METADATA,sha256=fA6aZiwZCV8zmkt2EgHrBs_5xh-5WBU1svlvROcY7Sk,57679 +tqdm-4.67.3.dist-info/RECORD,, +tqdm-4.67.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92 +tqdm-4.67.3.dist-info/entry_points.txt,sha256=ReJCH7Ui3Zyh6M16E4OhsZ1oU7WtMXCfbtoyBhGO29Y,39 +tqdm-4.67.3.dist-info/licenses/LICENCE,sha256=_P-Hw6R86AKKhRKqGC1PzwrRyQVE7nXPmzQ2hMrBlN4,1985 +tqdm-4.67.3.dist-info/top_level.txt,sha256=NLiUJNfmc9At15s7JURiwvqMEjUi9G5PMGRrmMYzNSM,5 +tqdm/__init__.py,sha256=9mQNYSSqP99JasubEC1POJLMmhkkBH6cJZxPIR5G2pQ,1572 +tqdm/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30 +tqdm/__pycache__/__init__.cpython-312.pyc,, +tqdm/__pycache__/__main__.cpython-312.pyc,, +tqdm/__pycache__/_main.cpython-312.pyc,, +tqdm/__pycache__/_monitor.cpython-312.pyc,, +tqdm/__pycache__/_tqdm.cpython-312.pyc,, +tqdm/__pycache__/_tqdm_gui.cpython-312.pyc,, +tqdm/__pycache__/_tqdm_notebook.cpython-312.pyc,, +tqdm/__pycache__/_tqdm_pandas.cpython-312.pyc,, +tqdm/__pycache__/_utils.cpython-312.pyc,, +tqdm/__pycache__/asyncio.cpython-312.pyc,, +tqdm/__pycache__/auto.cpython-312.pyc,, +tqdm/__pycache__/autonotebook.cpython-312.pyc,, +tqdm/__pycache__/cli.cpython-312.pyc,, +tqdm/__pycache__/dask.cpython-312.pyc,, +tqdm/__pycache__/gui.cpython-312.pyc,, +tqdm/__pycache__/keras.cpython-312.pyc,, +tqdm/__pycache__/notebook.cpython-312.pyc,, +tqdm/__pycache__/rich.cpython-312.pyc,, +tqdm/__pycache__/std.cpython-312.pyc,, +tqdm/__pycache__/tk.cpython-312.pyc,, +tqdm/__pycache__/utils.cpython-312.pyc,, +tqdm/__pycache__/version.cpython-312.pyc,, +tqdm/_main.py,sha256=9ySvgmi_2Sw4CAo5UDW0Q2dxfTryboEWGHohfCJz0sA,283 +tqdm/_monitor.py,sha256=Uku-DPWgzJ7dO5CK08xKJK-E_F6qQ-JB3ksuXczSYR0,3699 +tqdm/_tqdm.py,sha256=LfLCuJ6bpsVo9xilmtBXyEm1vGnUCFrliW85j3J-nD4,283 +tqdm/_tqdm_gui.py,sha256=03Hc8KayxJveieI5-0-2NGiDpLvw9jZekofJUV7CCwk,287 +tqdm/_tqdm_notebook.py,sha256=BuHiLuxu6uEfZFaPJW3RPpPaxaVctEQA3kdSJSDL1hw,307 +tqdm/_tqdm_pandas.py,sha256=c9jptUgigN6axRDhRd4Rif98Tmxeopc1nFNFhIpbFUE,888 +tqdm/_utils.py,sha256=_4E73bfDj4f1s3sM42NLHNrZDOkijZoWq-n6xWLkdZ8,553 +tqdm/asyncio.py,sha256=Kp2rSkNRf9KRqa3d9YpgeZQ7L7EZf2Ki4bSc7UPIyoo,2757 +tqdm/auto.py,sha256=nDZflj6p2zKkjBCNBourrhS81zYfZy1_dQvbckrdW8o,871 +tqdm/autonotebook.py,sha256=Yb9F5uaiBPhfbDDFpbtoG8I2YUw3uQJ89rUDLbfR6ws,956 +tqdm/cli.py,sha256=orEaahqDEBGZR1uCcTW8BkhSPEhBlSO0BKYbJ1Qgc6k,10994 +tqdm/completion.sh,sha256=j79KbSmpIj_E11jfTfBXrGnUTzKXVpQ1vGVQvsyDRl4,946 +tqdm/contrib/__init__.py,sha256=1GMYYE866WCvlHg5MdmzOvPsQj4ZuMlXzz8xcRcJD60,2479 +tqdm/contrib/__pycache__/__init__.cpython-312.pyc,, +tqdm/contrib/__pycache__/bells.cpython-312.pyc,, +tqdm/contrib/__pycache__/concurrent.cpython-312.pyc,, +tqdm/contrib/__pycache__/discord.cpython-312.pyc,, +tqdm/contrib/__pycache__/itertools.cpython-312.pyc,, +tqdm/contrib/__pycache__/logging.cpython-312.pyc,, +tqdm/contrib/__pycache__/slack.cpython-312.pyc,, +tqdm/contrib/__pycache__/telegram.cpython-312.pyc,, +tqdm/contrib/__pycache__/utils_worker.cpython-312.pyc,, +tqdm/contrib/bells.py,sha256=Yx1HqGCmHrESCAO700j5wE__JCleNODJxedh1ijPLD0,837 +tqdm/contrib/concurrent.py,sha256=K1yjloKS5WRNFyjLRth0DmU5PAnDbF0A-GD27N-J4a8,3986 +tqdm/contrib/discord.py,sha256=MtVIL1s_dxH21G4sL8FBgQ4Wei23ho9Ek5T-AommvNc,5243 +tqdm/contrib/itertools.py,sha256=WdKKQU5eSzsqHu29SN_oH12huYZo0Jihqoi9-nVhwz4,774 +tqdm/contrib/logging.py,sha256=NsYtnKttj2mMrGm58mEdo5a9DP_2vv8pZyrimSuWulA,3760 +tqdm/contrib/slack.py,sha256=eP_Mr5sQonYniHxxQNGue3jk2JkIPmPWFZqIYxnOui0,4007 +tqdm/contrib/telegram.py,sha256=vn_9SATMbbwn2PAbzSDyOX6av3eBB01QBug11P4H-Og,5008 +tqdm/contrib/utils_worker.py,sha256=vaxyJyagYwOCQXLUMd86bCbI4sPqZysuMGbDSGmvEWo,1199 +tqdm/dask.py,sha256=9Ei58eVqTossRLhAfWyUFCduXYKjmLmwkaXIy-CHYfs,1319 +tqdm/gui.py,sha256=STIB3K8iDzDgkNUqWIpvcI_u0OGtbGNy5NwpALXhfWs,5479 +tqdm/keras.py,sha256=op9sBkb6q6c6dw2wJ0SD2ZwpPK7yM1Vbg4l1Qiy3MIo,4373 +tqdm/notebook.py,sha256=scgzRQmDYzIFag_1gRh98LhtZdu3ig2yrmZdqvlgops,10802 +tqdm/rich.py,sha256=YyMPkEHVyYUVUR3adJKbVX26iTmNKpNMf3DEqmm-m60,5021 +tqdm/std.py,sha256=Sk24SwOd59hpNbb0UL8Y3_8ueRmL3_5O72Vy2XKasjE,57510 +tqdm/tk.py,sha256=Gu0uwXwLCGPRGHORdi3WvBLGiseUp_xxX_h_gp9VpK0,6701 +tqdm/tqdm.1,sha256=cDyo6hSykXedJ3Pcx5tkogR1ai3QXRnrJ0MbR2Gd9-s,7581 +tqdm/utils.py,sha256=dpGZUeqoLPinM-kEsULTSe2E3jzp8wUunL6eKzkYOgk,11810 +tqdm/version.py,sha256=oBM1eCOTDZDGZHffNqlehXTeQdKdracckNAEaMRmPjM,337 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..0885d055554a9bce53952482316a33cebf0845e4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.10.2) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..540e60f4e073bc53a5f0a521a3639e0d80780af4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +tqdm = tqdm.cli:main diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..78620c472c9d799a14ccb02a0233f4669b3bcdcb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm-4.67.3.dist-info/top_level.txt @@ -0,0 +1 @@ +tqdm diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8081f77b8812f3b42d7949daa4195d2c35dc70ac --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/__init__.py @@ -0,0 +1,38 @@ +from ._monitor import TMonitor, TqdmSynchronisationWarning +from ._tqdm_pandas import tqdm_pandas +from .cli import main # TODO: remove in v5.0.0 +from .gui import tqdm as tqdm_gui # TODO: remove in v5.0.0 +from .gui import trange as tgrange # TODO: remove in v5.0.0 +from .std import ( + TqdmDeprecationWarning, TqdmExperimentalWarning, TqdmKeyError, TqdmMonitorWarning, + TqdmTypeError, TqdmWarning, tqdm, trange) +from .version import __version__ + +__all__ = ['tqdm', 'tqdm_gui', 'trange', 'tgrange', 'tqdm_pandas', + 'tqdm_notebook', 'tnrange', 'main', 'TMonitor', + 'TqdmTypeError', 'TqdmKeyError', + 'TqdmWarning', 'TqdmDeprecationWarning', + 'TqdmExperimentalWarning', + 'TqdmMonitorWarning', 'TqdmSynchronisationWarning', + '__version__'] + + +def tqdm_notebook(*args, **kwargs): # pragma: no cover + """See tqdm.notebook.tqdm for full documentation""" + from warnings import warn + + from .notebook import tqdm as _tqdm_notebook + warn("This function will be removed in tqdm==5.0.0\n" + "Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`", + TqdmDeprecationWarning, stacklevel=2) + return _tqdm_notebook(*args, **kwargs) + + +def tnrange(*args, **kwargs): # pragma: no cover + """Shortcut for `tqdm.notebook.tqdm(range(*args), **kwargs)`.""" + from warnings import warn + + from .notebook import trange as _tnrange + warn("Please use `tqdm.notebook.trange` instead of `tqdm.tnrange`", + TqdmDeprecationWarning, stacklevel=2) + return _tnrange(*args, **kwargs) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/__main__.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..4e28416e104515e90fca4b69cc60d0c61fd15d61 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/__main__.py @@ -0,0 +1,3 @@ +from .cli import main + +main() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_main.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_main.py new file mode 100644 index 0000000000000000000000000000000000000000..04fdeeff17b5cc84b210f445b54b87d5b99e3748 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_main.py @@ -0,0 +1,9 @@ +from warnings import warn + +from .cli import * # NOQA +from .cli import __all__ # NOQA +from .std import TqdmDeprecationWarning + +warn("This function will be removed in tqdm==5.0.0\n" + "Please use `tqdm.cli.*` instead of `tqdm._main.*`", + TqdmDeprecationWarning, stacklevel=2) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_monitor.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_monitor.py new file mode 100644 index 0000000000000000000000000000000000000000..f71aa56817ca77eba5df4a2dd11cb0c4a9a7ea1c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_monitor.py @@ -0,0 +1,95 @@ +import atexit +from threading import Event, Thread, current_thread +from time import time +from warnings import warn + +__all__ = ["TMonitor", "TqdmSynchronisationWarning"] + + +class TqdmSynchronisationWarning(RuntimeWarning): + """tqdm multi-thread/-process errors which may cause incorrect nesting + but otherwise no adverse effects""" + pass + + +class TMonitor(Thread): + """ + Monitoring thread for tqdm bars. + Monitors if tqdm bars are taking too much time to display + and readjusts miniters automatically if necessary. + + Parameters + ---------- + tqdm_cls : class + tqdm class to use (can be core tqdm or a submodule). + sleep_interval : float + Time to sleep between monitoring checks. + """ + _test = {} # internal vars for unit testing + + def __init__(self, tqdm_cls, sleep_interval): + Thread.__init__(self) + self.daemon = True # kill thread when main killed (KeyboardInterrupt) + self.woken = 0 # last time woken up, to sync with monitor + self.tqdm_cls = tqdm_cls + self.sleep_interval = sleep_interval + self._time = self._test.get("time", time) + self.was_killed = self._test.get("Event", Event)() + atexit.register(self.exit) + self.start() + + def exit(self): + self.was_killed.set() + if self is not current_thread(): + self.join() + return self.report() + + def get_instances(self): + # returns a copy of started `tqdm_cls` instances + return [i for i in self.tqdm_cls._instances.copy() + # Avoid race by checking that the instance started + if hasattr(i, 'start_t')] + + def run(self): + cur_t = self._time() + while True: + # After processing and before sleeping, notify that we woke + # Need to be done just before sleeping + self.woken = cur_t + # Sleep some time... + self.was_killed.wait(self.sleep_interval) + # Quit if killed + if self.was_killed.is_set(): + return + # Then monitor! + # Acquire lock (to access _instances) + with self.tqdm_cls.get_lock(): + cur_t = self._time() + # Check tqdm instances are waiting too long to print + instances = self.get_instances() + for instance in instances: + # Check event in loop to reduce blocking time on exit + if self.was_killed.is_set(): + return + # Only if mininterval > 1 (else iterations are just slow) + # and last refresh exceeded maxinterval + if ( + instance.miniters > 1 + and (cur_t - instance.last_print_t) >= instance.maxinterval + ): + # force bypassing miniters on next iteration + # (dynamic_miniters adjusts mininterval automatically) + instance.miniters = 1 + # Refresh now! (works only for manual tqdm) + instance.refresh(nolock=True) + # Remove accidental long-lived strong reference + del instance + if instances != self.get_instances(): # pragma: nocover + warn("Set changed size during iteration" + + " (see https://github.com/tqdm/tqdm/issues/481)", + TqdmSynchronisationWarning, stacklevel=2) + # Remove accidental long-lived strong references + del instances + + def report(self): + return not self.was_killed.is_set() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_tqdm.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_tqdm.py new file mode 100644 index 0000000000000000000000000000000000000000..7fc4962774a4651db7a739a3f143633b6215a9bd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_tqdm.py @@ -0,0 +1,9 @@ +from warnings import warn + +from .std import * # NOQA +from .std import __all__ # NOQA +from .std import TqdmDeprecationWarning + +warn("This function will be removed in tqdm==5.0.0\n" + "Please use `tqdm.std.*` instead of `tqdm._tqdm.*`", + TqdmDeprecationWarning, stacklevel=2) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_tqdm_gui.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_tqdm_gui.py new file mode 100644 index 0000000000000000000000000000000000000000..f32aa894f54b3a5b47a0fbf4263c2fd20df56c9d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_tqdm_gui.py @@ -0,0 +1,9 @@ +from warnings import warn + +from .gui import * # NOQA +from .gui import __all__ # NOQA +from .std import TqdmDeprecationWarning + +warn("This function will be removed in tqdm==5.0.0\n" + "Please use `tqdm.gui.*` instead of `tqdm._tqdm_gui.*`", + TqdmDeprecationWarning, stacklevel=2) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_tqdm_notebook.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_tqdm_notebook.py new file mode 100644 index 0000000000000000000000000000000000000000..f225fbf5b52d04987ccf68f4d5ee4b735e3158b0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_tqdm_notebook.py @@ -0,0 +1,9 @@ +from warnings import warn + +from .notebook import * # NOQA +from .notebook import __all__ # NOQA +from .std import TqdmDeprecationWarning + +warn("This function will be removed in tqdm==5.0.0\n" + "Please use `tqdm.notebook.*` instead of `tqdm._tqdm_notebook.*`", + TqdmDeprecationWarning, stacklevel=2) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_tqdm_pandas.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_tqdm_pandas.py new file mode 100644 index 0000000000000000000000000000000000000000..c4fe6efdc603579e7f8acfa27ac10dccdf3e94ce --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_tqdm_pandas.py @@ -0,0 +1,24 @@ +import sys + +__author__ = "github.com/casperdcl" +__all__ = ['tqdm_pandas'] + + +def tqdm_pandas(tclass, **tqdm_kwargs): + """ + Registers the given `tqdm` instance with + `pandas.core.groupby.DataFrameGroupBy.progress_apply`. + """ + from tqdm import TqdmDeprecationWarning + + if isinstance(tclass, type) or (getattr(tclass, '__name__', '').startswith( + 'tqdm_')): # delayed adapter case + TqdmDeprecationWarning( + "Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm, ...)`.", + fp_write=getattr(tqdm_kwargs.get('file', None), 'write', sys.stderr.write)) + tclass.pandas(**tqdm_kwargs) + else: + TqdmDeprecationWarning( + "Please use `tqdm.pandas(...)` instead of `tqdm_pandas(tqdm(...))`.", + fp_write=getattr(tclass.fp, 'write', sys.stderr.write)) + type(tclass).pandas(deprecated_t=tclass) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..385e849e106d1319fe21045f14eb0aa6552fb153 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/_utils.py @@ -0,0 +1,11 @@ +from warnings import warn + +from .std import TqdmDeprecationWarning +from .utils import ( # NOQA, pylint: disable=unused-import + CUR_OS, IS_NIX, IS_WIN, RE_ANSI, Comparable, FormatReplace, SimpleTextIOWrapper, + _environ_cols_wrapper, _is_ascii, _is_utf, _screen_shape_linux, _screen_shape_tput, + _screen_shape_windows, _screen_shape_wrapper, _supports_unicode, _term_move_up, colorama) + +warn("This function will be removed in tqdm==5.0.0\n" + "Please use `tqdm.utils.*` instead of `tqdm._utils.*`", + TqdmDeprecationWarning, stacklevel=2) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/asyncio.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/asyncio.py new file mode 100644 index 0000000000000000000000000000000000000000..2d00a0a2e755f36068d079ccc12ca84d86ff42be --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/asyncio.py @@ -0,0 +1,93 @@ +""" +Asynchronous progressbar decorator for iterators. +Includes a default `range` iterator printing to `stderr`. + +Usage: +>>> from tqdm.asyncio import trange, tqdm +>>> async for i in trange(10): +... ... +""" +import asyncio +from sys import version_info + +from .std import tqdm as std_tqdm + +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['tqdm_asyncio', 'tarange', 'tqdm', 'trange'] + + +class tqdm_asyncio(std_tqdm): + """ + Asynchronous-friendly version of tqdm. + """ + def __init__(self, iterable=None, *args, **kwargs): + super().__init__(iterable, *args, **kwargs) + self.iterable_awaitable = False + if iterable is not None: + if hasattr(iterable, "__anext__"): + self.iterable_next = iterable.__anext__ + self.iterable_awaitable = True + elif hasattr(iterable, "__next__"): + self.iterable_next = iterable.__next__ + else: + self.iterable_iterator = iter(iterable) + self.iterable_next = self.iterable_iterator.__next__ + + def __aiter__(self): + return self + + async def __anext__(self): + try: + if self.iterable_awaitable: + res = await self.iterable_next() + else: + res = self.iterable_next() + self.update() + return res + except StopIteration: + self.close() + raise StopAsyncIteration + except BaseException: + self.close() + raise + + def send(self, *args, **kwargs): + return self.iterable.send(*args, **kwargs) + + @classmethod + def as_completed(cls, fs, *, loop=None, timeout=None, total=None, **tqdm_kwargs): + """ + Wrapper for `asyncio.as_completed`. + """ + if total is None: + total = len(fs) + kwargs = {} + if version_info[:2] < (3, 10): + kwargs['loop'] = loop + yield from cls(asyncio.as_completed(fs, timeout=timeout, **kwargs), + total=total, **tqdm_kwargs) + + @classmethod + async def gather(cls, *fs, loop=None, timeout=None, total=None, **tqdm_kwargs): + """ + Wrapper for `asyncio.gather`. + """ + async def wrap_awaitable(i, f): + return i, await f + + ifs = [wrap_awaitable(i, f) for i, f in enumerate(fs)] + res = [await f for f in cls.as_completed(ifs, loop=loop, timeout=timeout, + total=total, **tqdm_kwargs)] + return [i for _, i in sorted(res)] + + +def tarange(*args, **kwargs): + """ + A shortcut for `tqdm.asyncio.tqdm(range(*args), **kwargs)`. + """ + return tqdm_asyncio(range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_asyncio +trange = tarange diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/auto.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/auto.py new file mode 100644 index 0000000000000000000000000000000000000000..206c4409d5269594bdbab3a092ef6e09e7c01947 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/auto.py @@ -0,0 +1,40 @@ +""" +Enables multiple commonly used features. + +Method resolution order: + +- `tqdm.autonotebook` without import warnings +- `tqdm.asyncio` +- `tqdm.std` base class + +Usage: +>>> from tqdm.auto import trange, tqdm +>>> for i in trange(10): +... ... +""" +import warnings + +from .std import TqdmExperimentalWarning + +with warnings.catch_warnings(): + warnings.simplefilter("ignore", category=TqdmExperimentalWarning) + from .autonotebook import tqdm as notebook_tqdm + +from .asyncio import tqdm as asyncio_tqdm +from .std import tqdm as std_tqdm + +if notebook_tqdm != std_tqdm: + class tqdm(notebook_tqdm, asyncio_tqdm): # pylint: disable=inconsistent-mro + pass +else: + tqdm = asyncio_tqdm + + +def trange(*args, **kwargs): + """ + A shortcut for `tqdm.auto.tqdm(range(*args), **kwargs)`. + """ + return tqdm(range(*args), **kwargs) + + +__all__ = ["tqdm", "trange"] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/autonotebook.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/autonotebook.py new file mode 100644 index 0000000000000000000000000000000000000000..a09f2ec4b8c95f12b8c7b7774f84d5ec55826334 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/autonotebook.py @@ -0,0 +1,29 @@ +""" +Automatically choose between `tqdm.notebook` and `tqdm.std`. + +Usage: +>>> from tqdm.autonotebook import trange, tqdm +>>> for i in trange(10): +... ... +""" +import sys +from warnings import warn + +try: + get_ipython = sys.modules['IPython'].get_ipython + if 'IPKernelApp' not in get_ipython().config: # pragma: no cover + raise ImportError("console") + from .notebook import WARN_NOIPYW, IProgress + if IProgress is None: + from .std import TqdmWarning + warn(WARN_NOIPYW, TqdmWarning, stacklevel=2) + raise ImportError('ipywidgets') +except Exception: + from .std import tqdm, trange +else: # pragma: no cover + from .notebook import tqdm, trange + from .std import TqdmExperimentalWarning + warn("Using `tqdm.autonotebook.tqdm` in notebook mode." + " Use `tqdm.tqdm` instead to force console mode" + " (e.g. in jupyter console)", TqdmExperimentalWarning, stacklevel=2) +__all__ = ["tqdm", "trange"] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/cli.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/cli.py new file mode 100644 index 0000000000000000000000000000000000000000..1dd08f6053b992274dc8242a4e81ec7e66ddd937 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/cli.py @@ -0,0 +1,324 @@ +""" +Module version for monitoring CLI pipes (`... | python -m tqdm | ...`). +""" +import logging +import re +import sys +from ast import literal_eval as numeric +from textwrap import indent + +from .std import TqdmKeyError, TqdmTypeError, tqdm +from .version import __version__ + +__all__ = ["main"] +log = logging.getLogger(__name__) + + +def cast(val, typ): + log.debug((val, typ)) + if " or " in typ: + for t in typ.split(" or "): + try: + return cast(val, t) + except TqdmTypeError: + pass + raise TqdmTypeError(f"{val} : {typ}") + + # sys.stderr.write('\ndebug | `val:type`: `' + val + ':' + typ + '`.\n') + if typ == 'bool': + if (val == 'True') or (val == ''): + return True + if val == 'False': + return False + raise TqdmTypeError(val + ' : ' + typ) + if typ == 'chr': + if len(val) == 1: + return val.encode() + if re.match(r"^\\\w+$", val): + return eval(f'"{val}"').encode() + raise TqdmTypeError(f"{val} : {typ}") + if typ == 'str': + return val + if typ == 'int': + try: + return int(val) + except ValueError as exc: + raise TqdmTypeError(f"{val} : {typ}") from exc + if typ == 'float': + try: + return float(val) + except ValueError as exc: + raise TqdmTypeError(f"{val} : {typ}") from exc + raise TqdmTypeError(f"{val} : {typ}") + + +def posix_pipe(fin, fout, delim=b'\\n', buf_size=256, + callback=lambda float: None, callback_len=True): + """ + Params + ------ + fin : binary file with `read(buf_size : int)` method + fout : binary file with `write` (and optionally `flush`) methods. + callback : function(float), e.g.: `tqdm.update` + callback_len : If (default: True) do `callback(len(buffer))`. + Otherwise, do `callback(data) for data in buffer.split(delim)`. + """ + fp_write = fout.write + + if not delim: + while True: + tmp = fin.read(buf_size) + + # flush at EOF + if not tmp: + getattr(fout, 'flush', lambda: None)() + return + + fp_write(tmp) + callback(len(tmp)) + # return + + buf = b'' + len_delim = len(delim) + # n = 0 + while True: + tmp = fin.read(buf_size) + + # flush at EOF + if not tmp: + if buf: + fp_write(buf) + if callback_len: + # n += 1 + buf.count(delim) + callback(1 + buf.count(delim)) + else: + for i in buf.split(delim): + callback(i) + getattr(fout, 'flush', lambda: None)() + return # n + + while True: + i = tmp.find(delim) + if i < 0: + buf += tmp + break + fp_write(buf + tmp[:i + len(delim)]) + # n += 1 + callback(1 if callback_len else (buf + tmp[:i])) + buf = b'' + tmp = tmp[i + len_delim:] + + +# ((opt, type), ... ) +RE_OPTS = re.compile(r'\n {4}(\S+)\s{2,}:\s*([^,]+)') +# better split method assuming no positional args +RE_SHLEX = re.compile(r'\s*(? : \2', d) + split = RE_OPTS.split(d) + opt_types_desc = zip(split[1::3], split[2::3], split[3::3]) + d = ''.join(('\n --{0} : {2}{3}' if otd[1] == 'bool' else + '\n --{0}=<{1}> : {2}{3}').format( + otd[0].replace('_', '-'), otd[0], *otd[1:]) + for otd in opt_types_desc if otd[0] not in UNSUPPORTED_OPTS) + + help_short = "Usage:\n tqdm [--help | options]\n" + d = help_short + """ +Options: + -h, --help Print this help and exit. + -v, --version Print version and exit. +""" + d.strip('\n') + '\n' + + # opts = docopt(d, version=__version__) + if any(v in argv for v in ('-v', '--version')): + sys.stdout.write(__version__ + '\n') + sys.exit(0) + elif any(v in argv for v in ('-h', '--help')): + sys.stdout.write(d + '\n') + sys.exit(0) + elif argv and argv[0][:2] != '--': + sys.stderr.write(f"Error:Unknown argument:{argv[0]}\n{help_short}") + + argv = RE_SHLEX.split(' '.join(["tqdm"] + argv)) + opts = dict(zip(argv[1::3], argv[3::3])) + + log.debug(opts) + opts.pop('log', True) + + tqdm_args = {'file': fp} + try: + for (o, v) in opts.items(): + o = o.replace('-', '_') + try: + tqdm_args[o] = cast(v, opt_types[o]) + except KeyError as e: + raise TqdmKeyError(str(e)) + log.debug('args:' + str(tqdm_args)) + + delim_per_char = tqdm_args.pop('bytes', False) + update = tqdm_args.pop('update', False) + update_to = tqdm_args.pop('update_to', False) + if sum((delim_per_char, update, update_to)) > 1: + raise TqdmKeyError("Can only have one of --bytes --update --update_to") + except Exception: + fp.write("\nError:\n" + help_short) + stdin, stdout_write = sys.stdin, sys.stdout.write + for i in stdin: + stdout_write(i) + raise + else: + buf_size = tqdm_args.pop('buf_size', 256) + delim = tqdm_args.pop('delim', b'\\n') + tee = tqdm_args.pop('tee', False) + manpath = tqdm_args.pop('manpath', None) + comppath = tqdm_args.pop('comppath', None) + if tqdm_args.pop('null', False): + class stdout: + @staticmethod + def write(_): + pass + else: + stdout = sys.stdout + stdout = getattr(stdout, 'buffer', stdout) + stdin = getattr(sys.stdin, 'buffer', sys.stdin) + if manpath or comppath: + try: # py<3.9 + import importlib_resources as resources + except ImportError: + from importlib import resources + from pathlib import Path + + def cp(name, dst): + """copy resource `name` to `dst`""" + fi = resources.files('tqdm') / name + dst.write_bytes(fi.read_bytes()) + log.info("written:%s", dst) + if manpath is not None: + cp('tqdm.1', Path(manpath) / 'tqdm.1') + if comppath is not None: + cp('completion.sh', Path(comppath) / 'tqdm_completion.sh') + sys.exit(0) + if tee: + stdout_write = stdout.write + fp_write = getattr(fp, 'buffer', fp).write + + class stdout: # pylint: disable=function-redefined + @staticmethod + def write(x): + with tqdm.external_write_mode(file=fp): + fp_write(x) + stdout_write(x) + if delim_per_char: + tqdm_args.setdefault('unit', 'B') + tqdm_args.setdefault('unit_scale', True) + tqdm_args.setdefault('unit_divisor', 1024) + log.debug(tqdm_args) + with tqdm(**tqdm_args) as t: + posix_pipe(stdin, stdout, '', buf_size, t.update) + elif delim == b'\\n': + log.debug(tqdm_args) + write = stdout.write + if update or update_to: + with tqdm(**tqdm_args) as t: + if update: + def callback(i): + t.update(numeric(i.decode())) + else: # update_to + def callback(i): + t.update(numeric(i.decode()) - t.n) + for i in stdin: + write(i) + callback(i) + else: + for i in tqdm(stdin, **tqdm_args): + write(i) + else: + log.debug(tqdm_args) + with tqdm(**tqdm_args) as t: + callback_len = False + if update: + def callback(i): + t.update(numeric(i.decode())) + elif update_to: + def callback(i): + t.update(numeric(i.decode()) - t.n) + else: + callback = t.update + callback_len = True + posix_pipe(stdin, stdout, delim, buf_size, callback, callback_len) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/completion.sh b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/completion.sh new file mode 100644 index 0000000000000000000000000000000000000000..9f61c7f14bb8c1f6099b9eb75dce28ece6a7ae96 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/completion.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +_tqdm(){ + local cur prv + cur="${COMP_WORDS[COMP_CWORD]}" + prv="${COMP_WORDS[COMP_CWORD - 1]}" + + case ${prv} in + --bar_format|--buf_size|--colour|--comppath|--delay|--delim|--desc|--initial|--lock_args|--manpath|--maxinterval|--mininterval|--miniters|--ncols|--nrows|--position|--postfix|--smoothing|--total|--unit|--unit_divisor) + # await user input + ;; + "--log") + COMPREPLY=($(compgen -W 'CRITICAL FATAL ERROR WARN WARNING INFO DEBUG NOTSET' -- ${cur})) + ;; + *) + COMPREPLY=($(compgen -W '--ascii --bar_format --buf_size --bytes --colour --comppath --delay --delim --desc --disable --dynamic_ncols --help --initial --leave --lock_args --log --manpath --maxinterval --mininterval --miniters --ncols --nrows --null --position --postfix --smoothing --tee --total --unit --unit_divisor --unit_scale --update --update_to --version --write_bytes -h -v' -- ${cur})) + ;; + esac +} +complete -F _tqdm tqdm diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/dask.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/dask.py new file mode 100644 index 0000000000000000000000000000000000000000..57f1b668f59dc5991019eee34c7df3232a2c2cd7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/dask.py @@ -0,0 +1,44 @@ +from functools import partial + +from dask.callbacks import Callback + +from .auto import tqdm as tqdm_auto + +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['TqdmCallback'] + + +class TqdmCallback(Callback): + """Dask callback for task progress.""" + def __init__(self, start=None, pretask=None, tqdm_class=tqdm_auto, + **tqdm_kwargs): + """ + Parameters + ---------- + tqdm_class : optional + `tqdm` class to use for bars [default: `tqdm.auto.tqdm`]. + tqdm_kwargs : optional + Any other arguments used for all bars. + """ + super().__init__(start=start, pretask=pretask) + if tqdm_kwargs: + tqdm_class = partial(tqdm_class, **tqdm_kwargs) + self.tqdm_class = tqdm_class + + def _start_state(self, _, state): + self.pbar = self.tqdm_class(total=sum( + len(state[k]) for k in ['ready', 'waiting', 'running', 'finished'])) + + def _posttask(self, *_, **__): + self.pbar.update() + + def _finish(self, *_, **__): + self.pbar.close() + + def display(self): + """Displays in the current cell in Notebooks.""" + container = getattr(self.bar, 'container', None) + if container is None: + return + from .notebook import display + display(container) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/gui.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/gui.py new file mode 100644 index 0000000000000000000000000000000000000000..cb52fb91a8661f4c73edd352bbc6f21b877dcfee --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/gui.py @@ -0,0 +1,179 @@ +""" +Matplotlib GUI progressbar decorator for iterators. + +Usage: +>>> from tqdm.gui import trange, tqdm +>>> for i in trange(10): +... ... +""" +# future division is important to divide integers and get as +# a result precise floating numbers (instead of truncated int) +import re +from warnings import warn + +# to inherit from the tqdm class +from .std import TqdmExperimentalWarning +from .std import tqdm as std_tqdm + +# import compatibility functions and utilities + +__author__ = {"github.com/": ["casperdcl", "lrq3000"]} +__all__ = ['tqdm_gui', 'tgrange', 'tqdm', 'trange'] + + +class tqdm_gui(std_tqdm): # pragma: no cover + """Experimental Matplotlib GUI version of tqdm!""" + # TODO: @classmethod: write() on GUI? + def __init__(self, *args, **kwargs): + from collections import deque + + import matplotlib as mpl + import matplotlib.pyplot as plt + kwargs = kwargs.copy() + kwargs['gui'] = True + colour = kwargs.pop('colour', 'g') + super().__init__(*args, **kwargs) + + if self.disable: + return + + warn("GUI is experimental/alpha", TqdmExperimentalWarning, stacklevel=2) + self.mpl = mpl + self.plt = plt + + # Remember if external environment uses toolbars + self.toolbar = self.mpl.rcParams['toolbar'] + self.mpl.rcParams['toolbar'] = 'None' + + self.mininterval = max(self.mininterval, 0.5) + self.fig, ax = plt.subplots(figsize=(9, 2.2)) + # self.fig.subplots_adjust(bottom=0.2) + total = self.__len__() # avoids TypeError on None #971 + if total is not None: + self.xdata = [] + self.ydata = [] + self.zdata = [] + else: + self.xdata = deque([]) + self.ydata = deque([]) + self.zdata = deque([]) + self.line1, = ax.plot(self.xdata, self.ydata, color='b') + self.line2, = ax.plot(self.xdata, self.zdata, color='k') + ax.set_ylim(0, 0.001) + if total is not None: + ax.set_xlim(0, 100) + ax.set_xlabel("percent") + self.fig.legend((self.line1, self.line2), ("cur", "est"), + loc='center right') + # progressbar + self.hspan = plt.axhspan(0, 0.001, xmin=0, xmax=0, color=colour) + else: + # ax.set_xlim(-60, 0) + ax.set_xlim(0, 60) + ax.invert_xaxis() + ax.set_xlabel("seconds") + ax.legend(("cur", "est"), loc='lower left') + ax.grid() + # ax.set_xlabel('seconds') + ax.set_ylabel((self.unit if self.unit else "it") + "/s") + if self.unit_scale: + plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) + ax.yaxis.get_offset_text().set_x(-0.15) + + # Remember if external environment is interactive + self.wasion = plt.isinteractive() + plt.ion() + self.ax = ax + + def close(self): + if self.disable: + return + + self.disable = True + + with self.get_lock(): + self._instances.remove(self) + + # Restore toolbars + self.mpl.rcParams['toolbar'] = self.toolbar + # Return to non-interactive mode + if not self.wasion: + self.plt.ioff() + if self.leave: + self.display() + else: + self.plt.close(self.fig) + + def clear(self, *_, **__): + pass + + def display(self, *_, **__): + n = self.n + cur_t = self._time() + elapsed = cur_t - self.start_t + delta_it = n - self.last_print_n + delta_t = cur_t - self.last_print_t + + # Inline due to multiple calls + total = self.total + xdata = self.xdata + ydata = self.ydata + zdata = self.zdata + ax = self.ax + line1 = self.line1 + line2 = self.line2 + hspan = getattr(self, 'hspan', None) + # instantaneous rate + y = delta_it / delta_t + # overall rate + z = n / elapsed + # update line data + xdata.append(n * 100.0 / total if total else cur_t) + ydata.append(y) + zdata.append(z) + + # Discard old values + # xmin, xmax = ax.get_xlim() + # if (not total) and elapsed > xmin * 1.1: + if (not total) and elapsed > 66: + xdata.popleft() + ydata.popleft() + zdata.popleft() + + ymin, ymax = ax.get_ylim() + if y > ymax or z > ymax: + ymax = 1.1 * y + ax.set_ylim(ymin, ymax) + ax.figure.canvas.draw() + + if total: + line1.set_data(xdata, ydata) + line2.set_data(xdata, zdata) + if hspan: + hspan.set_xy((0, ymin)) + hspan.set_height(ymax - ymin) + hspan.set_width(n / total) + else: + t_ago = [cur_t - i for i in xdata] + line1.set_data(t_ago, ydata) + line2.set_data(t_ago, zdata) + + d = self.format_dict + # remove {bar} + d['bar_format'] = (d['bar_format'] or "{l_bar}{r_bar}").replace( + "{bar}", "") + msg = self.format_meter(**d) + if '' in msg: + msg = "".join(re.split(r'\|?\|?', msg, maxsplit=1)) + ax.set_title(msg, fontname="DejaVu Sans Mono", fontsize=11) + self.plt.pause(1e-9) + + +def tgrange(*args, **kwargs): + """Shortcut for `tqdm.gui.tqdm(range(*args), **kwargs)`.""" + return tqdm_gui(range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_gui +trange = tgrange diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/keras.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/keras.py new file mode 100644 index 0000000000000000000000000000000000000000..cce9467c51a95388aaa502d1da9a42f3ebf0af24 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/keras.py @@ -0,0 +1,122 @@ +from copy import copy +from functools import partial + +from .auto import tqdm as tqdm_auto + +try: + import keras +except (ImportError, AttributeError) as e: + try: + from tensorflow import keras + except ImportError: + raise e +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['TqdmCallback'] + + +class TqdmCallback(keras.callbacks.Callback): + """Keras callback for epoch and batch progress.""" + @staticmethod + def bar2callback(bar, pop=None, delta=(lambda logs: 1)): + def callback(_, logs=None): + n = delta(logs) + if logs: + if pop: + logs = copy(logs) + [logs.pop(i, 0) for i in pop] + bar.set_postfix(logs, refresh=False) + bar.update(n) + + return callback + + def __init__(self, epochs=None, data_size=None, batch_size=None, verbose=1, + tqdm_class=tqdm_auto, **tqdm_kwargs): + """ + Parameters + ---------- + epochs : int, optional + data_size : int, optional + Number of training pairs. + batch_size : int, optional + Number of training pairs per batch. + verbose : int + 0: epoch, 1: batch (transient), 2: batch. [default: 1]. + Will be set to `0` unless both `data_size` and `batch_size` + are given. + tqdm_class : optional + `tqdm` class to use for bars [default: `tqdm.auto.tqdm`]. + tqdm_kwargs : optional + Any other arguments used for all bars. + """ + if tqdm_kwargs: + tqdm_class = partial(tqdm_class, **tqdm_kwargs) + self.tqdm_class = tqdm_class + self.epoch_bar = tqdm_class(total=epochs, unit='epoch') + self.on_epoch_end = self.bar2callback(self.epoch_bar) + if data_size and batch_size: + self.batches = batches = (data_size + batch_size - 1) // batch_size + else: + self.batches = batches = None + self.verbose = verbose + if verbose == 1: + self.batch_bar = tqdm_class(total=batches, unit='batch', leave=False) + self.on_batch_end = self.bar2callback( + self.batch_bar, pop=['batch', 'size'], + delta=lambda logs: logs.get('size', 1)) + + def on_train_begin(self, *_, **__): + params = self.params.get + auto_total = params('epochs', params('nb_epoch', None)) + if auto_total is not None and auto_total != self.epoch_bar.total: + self.epoch_bar.reset(total=auto_total) + + def on_epoch_begin(self, epoch, *_, **__): + if self.epoch_bar.n < epoch: + ebar = self.epoch_bar + ebar.n = ebar.last_print_n = ebar.initial = epoch + if self.verbose: + params = self.params.get + total = params('samples', params( + 'nb_sample', params('steps', None))) or self.batches + if self.verbose == 2: + if hasattr(self, 'batch_bar'): + self.batch_bar.close() + self.batch_bar = self.tqdm_class( + total=total, unit='batch', leave=True, + unit_scale=1 / (params('batch_size', 1) or 1)) + self.on_batch_end = self.bar2callback( + self.batch_bar, pop=['batch', 'size'], + delta=lambda logs: logs.get('size', 1)) + elif self.verbose == 1: + self.batch_bar.unit_scale = 1 / (params('batch_size', 1) or 1) + self.batch_bar.reset(total=total) + else: + raise KeyError('Unknown verbosity') + + def on_train_end(self, *_, **__): + if hasattr(self, 'batch_bar'): + self.batch_bar.close() + self.epoch_bar.close() + + def display(self): + """Displays in the current cell in Notebooks.""" + container = getattr(self.epoch_bar, 'container', None) + if container is None: + return + from .notebook import display + display(container) + batch_bar = getattr(self, 'batch_bar', None) + if batch_bar is not None: + display(batch_bar.container) + + @staticmethod + def _implements_train_batch_hooks(): + return True + + @staticmethod + def _implements_test_batch_hooks(): + return True + + @staticmethod + def _implements_predict_batch_hooks(): + return True diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/notebook.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/notebook.py new file mode 100644 index 0000000000000000000000000000000000000000..83178e981f46c0784a36bee1f9e347022c7678a4 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/notebook.py @@ -0,0 +1,315 @@ +""" +IPython/Jupyter Notebook progressbar decorator for iterators. +Includes a default `range` iterator printing to `stderr`. + +Usage: +>>> from tqdm.notebook import trange, tqdm +>>> for i in trange(10): +... ... +""" +# import compatibility functions and utilities +import re +import sys +from html import escape +from weakref import proxy + +# to inherit from the tqdm class +from .std import tqdm as std_tqdm + +if True: # pragma: no cover + # import IPython/Jupyter base widget and display utilities + IPY = 0 + try: # IPython 4.x + import ipywidgets + IPY = 4 + except ImportError: # IPython 3.x / 2.x + IPY = 32 + import warnings + with warnings.catch_warnings(): + warnings.filterwarnings( + 'ignore', message=".*The `IPython.html` package has been deprecated.*") + try: + import IPython.html.widgets as ipywidgets # NOQA: F401 + except ImportError: + pass + + try: # IPython 4.x / 3.x + if IPY == 32: + from IPython.html.widgets import HTML + from IPython.html.widgets import FloatProgress as IProgress + from IPython.html.widgets import HBox + IPY = 3 + else: + from ipywidgets import HTML + from ipywidgets import FloatProgress as IProgress + from ipywidgets import HBox + except ImportError: + try: # IPython 2.x + from IPython.html.widgets import HTML + from IPython.html.widgets import ContainerWidget as HBox + from IPython.html.widgets import FloatProgressWidget as IProgress + IPY = 2 + except ImportError: + IPY = 0 + IProgress = None + HBox = object + + try: + from IPython.display import display # , clear_output + except ImportError: + pass + +__author__ = {"github.com/": ["lrq3000", "casperdcl", "alexanderkuk"]} +__all__ = ['tqdm_notebook', 'tnrange', 'tqdm', 'trange'] +WARN_NOIPYW = ("IProgress not found. Please update jupyter and ipywidgets." + " See https://ipywidgets.readthedocs.io/en/stable" + "/user_install.html") + + +class TqdmHBox(HBox): + """`ipywidgets.HBox` with a pretty representation""" + def _json_(self, pretty=None): + pbar = getattr(self, 'pbar', None) + if pbar is None: + return {} + d = pbar.format_dict + if pretty is not None: + d["ascii"] = not pretty + return d + + def __repr__(self, pretty=False): + pbar = getattr(self, 'pbar', None) + if pbar is None: + return super().__repr__() + return pbar.format_meter(**self._json_(pretty)) + + def _repr_pretty_(self, pp, *_, **__): + pp.text(self.__repr__(True)) + + +class tqdm_notebook(std_tqdm): + """ + Experimental IPython/Jupyter Notebook widget using tqdm! + """ + @staticmethod + def status_printer(_, total=None, desc=None, ncols=None): + """ + Manage the printing of an IPython/Jupyter Notebook progress bar widget. + """ + # Fallback to text bar if there's no total + # DEPRECATED: replaced with an 'info' style bar + # if not total: + # return super(tqdm_notebook, tqdm_notebook).status_printer(file) + + # fp = file + + # Prepare IPython progress bar + if IProgress is None: # #187 #451 #558 #872 + raise ImportError(WARN_NOIPYW) + if total: + pbar = IProgress(min=0, max=total) + else: # No total? Show info style bar with no progress tqdm status + pbar = IProgress(min=0, max=1) + pbar.value = 1 + pbar.bar_style = 'info' + if ncols is None: + pbar.layout.width = "20px" + + ltext = HTML() + rtext = HTML() + if desc: + ltext.value = desc + container = TqdmHBox(children=[ltext, pbar, rtext]) + # Prepare layout + if ncols is not None: # use default style of ipywidgets + # ncols could be 100, "100px", "100%" + ncols = str(ncols) # ipywidgets only accepts string + try: + if int(ncols) > 0: # isnumeric and positive + ncols += 'px' + except ValueError: + pass + pbar.layout.flex = '2' + container.layout.width = ncols + container.layout.display = 'inline-flex' + container.layout.flex_flow = 'row wrap' + + return container + + def display(self, msg=None, pos=None, + # additional signals + close=False, bar_style=None, check_delay=True): + # Note: contrary to native tqdm, msg='' does NOT clear bar + # goal is to keep all infos if error happens so user knows + # at which iteration the loop failed. + + # Clear previous output (really necessary?) + # clear_output(wait=1) + + if not msg and not close: + d = self.format_dict + # remove {bar} + d['bar_format'] = (d['bar_format'] or "{l_bar}{r_bar}").replace( + "{bar}", "") + msg = self.format_meter(**d) + + ltext, pbar, rtext = self.container.children + pbar.value = self.n + + if msg: + msg = msg.replace(' ', '\u2007') # fix html space padding + # html escape special characters (like '&') + if '' in msg: + left, right = map(escape, re.split(r'\|?\|?', msg, maxsplit=1)) + else: + left, right = '', escape(msg) + + # Update description + ltext.value = left + # never clear the bar (signal: msg='') + if right: + rtext.value = right + + # Change bar style + if bar_style: + # Hack-ish way to avoid the danger bar_style being overridden by + # success because the bar gets closed after the error... + if pbar.bar_style != 'danger' or bar_style != 'success': + pbar.bar_style = bar_style + + # Special signal to close the bar + if close and pbar.bar_style != 'danger': # hide only if no error + try: + self.container.close() + except AttributeError: + self.container.visible = False + self.container.layout.visibility = 'hidden' # IPYW>=8 + + if check_delay and self.delay > 0 and not self.displayed: + display(self.container) + self.displayed = True + + @property + def colour(self): + if hasattr(self, 'container'): + return self.container.children[-2].style.bar_color + + @colour.setter + def colour(self, bar_color): + if hasattr(self, 'container'): + self.container.children[-2].style.bar_color = bar_color + + def __init__(self, *args, **kwargs): + """ + Supports the usual `tqdm.tqdm` parameters as well as those listed below. + + Parameters + ---------- + display : Whether to call `display(self.container)` immediately + [default: True]. + """ + kwargs = kwargs.copy() + # Setup default output + file_kwarg = kwargs.get('file', sys.stderr) + if file_kwarg is sys.stderr or file_kwarg is None: + kwargs['file'] = sys.stdout # avoid the red block in IPython + + # Initialize parent class + avoid printing by using gui=True + kwargs['gui'] = True + # convert disable = None to False + kwargs['disable'] = bool(kwargs.get('disable', False)) + colour = kwargs.pop('colour', None) + display_here = kwargs.pop('display', True) + super().__init__(*args, **kwargs) + if self.disable or not kwargs['gui']: + self.disp = lambda *_, **__: None + return + + # Get bar width + self.ncols = '100%' if self.dynamic_ncols else kwargs.get("ncols", None) + + # Replace with IPython progress bar display (with correct total) + unit_scale = 1 if self.unit_scale is True else self.unit_scale or 1 + total = self.total * unit_scale if self.total else self.total + self.container = self.status_printer(self.fp, total, self.desc, self.ncols) + self.container.pbar = proxy(self) + self.displayed = False + if display_here and self.delay <= 0: + display(self.container) + self.displayed = True + self.disp = self.display + self.colour = colour + + # Print initial bar state + if not self.disable: + self.display(check_delay=False) + + def __iter__(self): + try: + it = super().__iter__() + yield from it + # NB: except ... [ as ...] breaks IPython async KeyboardInterrupt + except: # NOQA + self.disp(bar_style='danger') + raise + # NB: don't `finally: close()` + # since this could be a shared bar which the user will `reset()` + + def update(self, n=1): + try: + return super().update(n=n) + # NB: except ... [ as ...] breaks IPython async KeyboardInterrupt + except: # NOQA + # cannot catch KeyboardInterrupt when using manual tqdm + # as the interrupt will most likely happen on another statement + self.disp(bar_style='danger') + raise + # NB: don't `finally: close()` + # since this could be a shared bar which the user will `reset()` + + def close(self): + if self.disable: + return + super().close() + # Try to detect if there was an error or KeyboardInterrupt + # in manual mode: if n < total, things probably got wrong + if self.total and self.n < self.total: + self.disp(bar_style='danger', check_delay=False) + else: + if self.leave: + self.disp(bar_style='success', check_delay=False) + else: + self.disp(close=True, check_delay=False) + + def clear(self, *_, **__): + pass + + def reset(self, total=None): + """ + Resets to 0 iterations for repeated use. + + Consider combining with `leave=True`. + + Parameters + ---------- + total : int or float, optional. Total to use for the new bar. + """ + if self.disable: + return super().reset(total=total) + _, pbar, _ = self.container.children + pbar.bar_style = '' + if total is not None: + pbar.max = total + if not self.total and self.ncols is None: # no longer unknown total + pbar.layout.width = None # reset width + return super().reset(total=total) + + +def tnrange(*args, **kwargs): + """Shortcut for `tqdm.notebook.tqdm(range(*args), **kwargs)`.""" + return tqdm_notebook(range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_notebook +trange = tnrange diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/rich.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/rich.py new file mode 100644 index 0000000000000000000000000000000000000000..3d392edaf115a93f7c145de52cbe8978dcf1ede8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/rich.py @@ -0,0 +1,151 @@ +""" +`rich.progress` decorator for iterators. + +Usage: +>>> from tqdm.rich import trange, tqdm +>>> for i in trange(10): +... ... +""" +from warnings import warn + +from rich.progress import ( + BarColumn, Progress, ProgressColumn, Text, TimeElapsedColumn, TimeRemainingColumn, filesize) + +from .std import TqdmExperimentalWarning +from .std import tqdm as std_tqdm + +__author__ = {"github.com/": ["casperdcl"]} +__all__ = ['tqdm_rich', 'trrange', 'tqdm', 'trange'] + + +class FractionColumn(ProgressColumn): + """Renders completed/total, e.g. '0.5/2.3 G'.""" + def __init__(self, unit_scale=False, unit_divisor=1000): + self.unit_scale = unit_scale + self.unit_divisor = unit_divisor + super().__init__() + + def render(self, task): + """Calculate common unit for completed and total.""" + completed = int(task.completed) + total = int(task.total) + if self.unit_scale: + unit, suffix = filesize.pick_unit_and_suffix( + total, + ["", "K", "M", "G", "T", "P", "E", "Z", "Y"], + self.unit_divisor, + ) + else: + unit, suffix = filesize.pick_unit_and_suffix(total, [""], 1) + precision = 0 if unit == 1 else 1 + return Text( + f"{completed/unit:,.{precision}f}/{total/unit:,.{precision}f} {suffix}", + style="progress.download") + + +class RateColumn(ProgressColumn): + """Renders human readable transfer speed.""" + def __init__(self, unit="", unit_scale=False, unit_divisor=1000): + self.unit = unit + self.unit_scale = unit_scale + self.unit_divisor = unit_divisor + super().__init__() + + def render(self, task): + """Show data transfer speed.""" + speed = task.speed + if speed is None: + return Text(f"? {self.unit}/s", style="progress.data.speed") + if self.unit_scale: + unit, suffix = filesize.pick_unit_and_suffix( + speed, + ["", "K", "M", "G", "T", "P", "E", "Z", "Y"], + self.unit_divisor, + ) + else: + unit, suffix = filesize.pick_unit_and_suffix(speed, [""], 1) + precision = 0 if unit == 1 else 1 + return Text(f"{speed/unit:,.{precision}f} {suffix}{self.unit}/s", + style="progress.data.speed") + + +class tqdm_rich(std_tqdm): # pragma: no cover + """Experimental rich.progress GUI version of tqdm!""" + # TODO: @classmethod: write()? + def __init__(self, *args, **kwargs): + """ + This class accepts the following parameters *in addition* to + the parameters accepted by `tqdm`. + + Parameters + ---------- + progress : tuple, optional + arguments for `rich.progress.Progress()`. + options : dict, optional + keyword arguments for `rich.progress.Progress()`. + """ + kwargs = kwargs.copy() + kwargs['gui'] = True + # convert disable = None to False + kwargs['disable'] = bool(kwargs.get('disable', False)) + progress = kwargs.pop('progress', None) + options = kwargs.pop('options', {}).copy() + super().__init__(*args, **kwargs) + + if self.disable: + return + + warn("rich is experimental/alpha", TqdmExperimentalWarning, stacklevel=2) + d = self.format_dict + if progress is None: + progress = ( + "[progress.description]{task.description}" + "[progress.percentage]{task.percentage:>4.0f}%", + BarColumn(bar_width=None), + FractionColumn( + unit_scale=d['unit_scale'], unit_divisor=d['unit_divisor']), + "[", TimeElapsedColumn(), "<", TimeRemainingColumn(), + ",", RateColumn(unit=d['unit'], unit_scale=d['unit_scale'], + unit_divisor=d['unit_divisor']), "]" + ) + options.setdefault('transient', not self.leave) + self._prog = Progress(*progress, **options) + self._prog.__enter__() + self._task_id = self._prog.add_task(self.desc or "", **d) + + def close(self): + if self.disable: + return + self.display() # print 100%, vis #1306 + super().close() + self._prog.__exit__(None, None, None) + + def clear(self, *_, **__): + pass + + def display(self, *_, **__): + if not hasattr(self, '_prog'): + return + self._prog.update(self._task_id, completed=self.n, description=self.desc) + + def reset(self, total=None): + """ + Resets to 0 iterations for repeated use. + + Parameters + ---------- + total : int or float, optional. Total to use for the new bar. + """ + if hasattr(self, '_prog'): + self._prog.reset(total=total) + super().reset(total=total) + + +def trrange(*args, **kwargs): + """Shortcut for `tqdm.rich.tqdm(range(*args), **kwargs)`.""" + return tqdm_rich(range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_rich +trange = trrange diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/std.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/std.py new file mode 100644 index 0000000000000000000000000000000000000000..14b0c1963156d9aea344889d8c72603ae0265e59 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/std.py @@ -0,0 +1,1524 @@ +""" +Customisable progressbar decorator for iterators. +Includes a default `range` iterator printing to `stderr`. + +Usage: +>>> from tqdm import trange, tqdm +>>> for i in trange(10): +... ... +""" +import sys +from collections import OrderedDict, defaultdict +from contextlib import contextmanager +from datetime import datetime, timedelta, timezone +from numbers import Number +from time import time +from warnings import warn +from weakref import WeakSet + +from ._monitor import TMonitor +from .utils import ( + CallbackIOWrapper, Comparable, DisableOnWriteError, FormatReplace, SimpleTextIOWrapper, + _is_ascii, _screen_shape_wrapper, _supports_unicode, _term_move_up, disp_len, disp_trim, + envwrap) + +__author__ = "https://github.com/tqdm/tqdm#contributions" +__all__ = ['tqdm', 'trange', + 'TqdmTypeError', 'TqdmKeyError', 'TqdmWarning', + 'TqdmExperimentalWarning', 'TqdmDeprecationWarning', + 'TqdmMonitorWarning'] + + +class TqdmTypeError(TypeError): + pass + + +class TqdmKeyError(KeyError): + pass + + +class TqdmWarning(Warning): + """base class for all tqdm warnings. + + Used for non-external-code-breaking errors, such as garbled printing. + """ + def __init__(self, msg, fp_write=None): # noqa: B042 + if fp_write is not None: + fp_write("\n" + self.__class__.__name__ + ": " + str(msg).rstrip() + '\n') + else: + super().__init__(msg) + + +class TqdmExperimentalWarning(TqdmWarning, FutureWarning): + """beta feature, unstable API and behaviour""" + pass + + +class TqdmDeprecationWarning(TqdmWarning, DeprecationWarning): + # not suppressed if raised + pass + + +class TqdmMonitorWarning(TqdmWarning, RuntimeWarning): + """tqdm monitor errors which do not affect external functionality""" + pass + + +def TRLock(*args, **kwargs): + """threading RLock""" + try: + from threading import RLock + return RLock(*args, **kwargs) + except (ImportError, OSError): # pragma: no cover + pass + + +class TqdmDefaultWriteLock: + """ + Provide a default write lock for thread and multiprocessing safety. + Works only on platforms supporting `fork` (so Windows is excluded). + You must initialise a `tqdm` or `TqdmDefaultWriteLock` instance + before forking in order for the write lock to work. + On Windows, you need to supply the lock from the parent to the children as + an argument to joblib or the parallelism lib you use. + """ + # global thread lock so no setup required for multithreading. + # NB: Do not create multiprocessing lock as it sets the multiprocessing + # context, disallowing `spawn()`/`forkserver()` + th_lock = TRLock() + + def __init__(self): + # Create global parallelism locks to avoid racing issues with parallel + # bars works only if fork available (Linux/MacOSX, but not Windows) + cls = type(self) + root_lock = cls.th_lock + if root_lock is not None: + root_lock.acquire() + cls.create_mp_lock() + self.locks = [lk for lk in [cls.mp_lock, cls.th_lock] if lk is not None] + if root_lock is not None: + root_lock.release() + + def acquire(self, *a, **k): + for lock in self.locks: + lock.acquire(*a, **k) + + def release(self): + for lock in self.locks[::-1]: # Release in inverse order of acquisition + lock.release() + + def __enter__(self): + self.acquire() + + def __exit__(self, *exc): + self.release() + + @classmethod + def create_mp_lock(cls): + if not hasattr(cls, 'mp_lock'): + try: + from multiprocessing import RLock + cls.mp_lock = RLock() + except (ImportError, OSError): # pragma: no cover + cls.mp_lock = None + + @classmethod + def create_th_lock(cls): + assert hasattr(cls, 'th_lock') + warn("create_th_lock not needed anymore", TqdmDeprecationWarning, stacklevel=2) + + +class Bar: + """ + `str.format`-able bar with format specifiers: `[width][type]` + + - `width` + + unspecified (default): use `self.default_len` + + `int >= 0`: overrides `self.default_len` + + `int < 0`: subtract from `self.default_len` + - `type` + + `a`: ascii (`charset=self.ASCII` override) + + `u`: unicode (`charset=self.UTF` override) + + `b`: blank (`charset=" "` override) + """ + ASCII = " 123456789#" + UTF = " " + ''.join(map(chr, range(0x258F, 0x2587, -1))) + BLANK = " " + COLOUR_RESET = '\x1b[0m' + COLOUR_RGB = '\x1b[38;2;%d;%d;%dm' + COLOURS = {'BLACK': '\x1b[30m', 'RED': '\x1b[31m', 'GREEN': '\x1b[32m', + 'YELLOW': '\x1b[33m', 'BLUE': '\x1b[34m', 'MAGENTA': '\x1b[35m', + 'CYAN': '\x1b[36m', 'WHITE': '\x1b[37m'} + + def __init__(self, frac, default_len=10, charset=UTF, colour=None): + if not 0 <= frac <= 1: + warn("clamping frac to range [0, 1]", TqdmWarning, stacklevel=2) + frac = max(0, min(1, frac)) + assert default_len > 0 + self.frac = frac + self.default_len = default_len + self.charset = charset + self.colour = colour + + @property + def colour(self): + return self._colour + + @colour.setter + def colour(self, value): + if not value: + self._colour = None + return + try: + if value.upper() in self.COLOURS: + self._colour = self.COLOURS[value.upper()] + elif value[0] == '#' and len(value) == 7: + self._colour = self.COLOUR_RGB % tuple( + int(i, 16) for i in (value[1:3], value[3:5], value[5:7])) + else: + raise KeyError + except (KeyError, AttributeError): + warn(f"Unknown colour ({value}); valid choices:" + f" [hex (#00ff00), {', '.join(self.COLOURS)}]", TqdmWarning, stacklevel=2) + self._colour = None + + def __format__(self, format_spec): + if format_spec: + _type = format_spec[-1].lower() + try: + charset = {'a': self.ASCII, 'u': self.UTF, 'b': self.BLANK}[_type] + except KeyError: + charset = self.charset + else: + format_spec = format_spec[:-1] + if format_spec: + N_BARS = int(format_spec) + if N_BARS < 0: + N_BARS += self.default_len + else: + N_BARS = self.default_len + else: + charset = self.charset + N_BARS = self.default_len + + nsyms = len(charset) - 1 + bar_length, frac_bar_length = divmod(int(self.frac * N_BARS * nsyms), nsyms) + + res = charset[-1] * bar_length + if bar_length < N_BARS: # whitespace padding + res = res + charset[frac_bar_length] + charset[0] * (N_BARS - bar_length - 1) + return self.colour + res + self.COLOUR_RESET if self.colour else res + + +class EMA: + """ + Exponential moving average: smoothing to give progressively lower + weights to older values. + + Parameters + ---------- + smoothing : float, optional + Smoothing factor in range [0, 1], [default: 0.3]. + Increase to give more weight to recent values. + Ranges from 0 (yields old value) to 1 (yields new value). + """ + def __init__(self, smoothing=0.3): + self.alpha = smoothing + self.last = 0 + self.calls = 0 + + def __call__(self, x=None): + """ + Parameters + ---------- + x : float + New value to include in EMA. + """ + beta = 1 - self.alpha + if x is not None: + self.last = self.alpha * x + beta * self.last + self.calls += 1 + return self.last / (1 - beta ** self.calls) if self.calls else self.last + + +class tqdm(Comparable): + """ + Decorate an iterable object, returning an iterator which acts exactly + like the original iterable, but prints a dynamically updating + progressbar every time a value is requested. + + Parameters + ---------- + iterable : iterable, optional + Iterable to decorate with a progressbar. + Leave blank to manually manage the updates. + desc : str, optional + Prefix for the progressbar. + total : int or float, optional + The number of expected iterations. If unspecified, + len(iterable) is used if possible. If float("inf") or as a last + resort, only basic progress statistics are displayed + (no ETA, no progressbar). + If `gui` is True and this parameter needs subsequent updating, + specify an initial arbitrary large positive number, + e.g. 9e9. + leave : bool, optional + If [default: True], keeps all traces of the progressbar + upon termination of iteration. + If `None`, will leave only if `position` is `0`. + file : `io.TextIOWrapper` or `io.StringIO`, optional + Specifies where to output the progress messages + (default: sys.stderr). Uses `file.write(str)` and `file.flush()` + methods. For encoding, see `write_bytes`. + ncols : int, optional + The width of the entire output message. If specified, + dynamically resizes the progressbar to stay within this bound. + If unspecified, attempts to use environment width. The + fallback is a meter width of 10 and no limit for the counter and + statistics. If 0, will not print any meter (only stats). + mininterval : float, optional + Minimum progress display update interval [default: 0.1] seconds. + maxinterval : float, optional + Maximum progress display update interval [default: 10] seconds. + Automatically adjusts `miniters` to correspond to `mininterval` + after long display update lag. Only works if `dynamic_miniters` + or monitor thread is enabled. + miniters : int or float, optional + Minimum progress display update interval, in iterations. + If 0 and `dynamic_miniters`, will automatically adjust to equal + `mininterval` (more CPU efficient, good for tight loops). + If > 0, will skip display of specified number of iterations. + Tweak this and `mininterval` to get very efficient loops. + If your progress is erratic with both fast and slow iterations + (network, skipping items, etc) you should set miniters=1. + ascii : bool or str, optional + If unspecified or False, use unicode (smooth blocks) to fill + the meter. The fallback is to use ASCII characters " 123456789#". + disable : bool, optional + Whether to disable the entire progressbar wrapper + [default: False]. If set to None, disable on non-TTY. + unit : str, optional + String that will be used to define the unit of each iteration + [default: it]. + unit_scale : bool or int or float, optional + If 1 or True, the number of iterations will be reduced/scaled + automatically and a metric prefix following the + International System of Units standard will be added + (kilo, mega, etc.) [default: False]. If any other non-zero + number, will scale `total` and `n`. + dynamic_ncols : bool, optional + If set, constantly alters `ncols` and `nrows` to the + environment (allowing for window resizes) [default: False]. + smoothing : float, optional + Exponential moving average smoothing factor for speed estimates + (ignored in GUI mode). Ranges from 0 (average speed) to 1 + (current/instantaneous speed) [default: 0.3]. + bar_format : str, optional + Specify a custom bar string formatting. May impact performance. + [default: '{l_bar}{bar}{r_bar}'], where + l_bar='{desc}: {percentage:3.0f}%|' and + r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' + '{rate_fmt}{postfix}]' + Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, + percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, + rate, rate_fmt, rate_noinv, rate_noinv_fmt, + rate_inv, rate_inv_fmt, postfix, unit_divisor, + remaining, remaining_s, eta. + Note that a trailing ": " is automatically removed after {desc} + if the latter is empty. + initial : int or float, optional + The initial counter value. Useful when restarting a progress + bar [default: 0]. If using float, consider specifying `{n:.3f}` + or similar in `bar_format`, or specifying `unit_scale`. + position : int, optional + Specify the line offset to print this bar (starting from 0) + Automatic if unspecified. + Useful to manage multiple bars at once (eg, from threads). + postfix : dict or *, optional + Specify additional stats to display at the end of the bar. + Calls `set_postfix(**postfix)` if possible (dict). + unit_divisor : float, optional + [default: 1000], ignored unless `unit_scale` is True. + write_bytes : bool, optional + Whether to write bytes. If (default: False) will write unicode. + lock_args : tuple, optional + Passed to `refresh` for intermediate output + (initialisation, iterating, and updating). + nrows : int, optional + The screen height. If specified, hides nested bars outside this + bound. If unspecified, attempts to use environment height. + The fallback is 20. + colour : str, optional + Bar colour (e.g. 'green', '#00ff00'). + delay : float, optional + Don't display until [default: 0] seconds have elapsed. + gui : bool, optional + WARNING: internal parameter - do not use. + Use tqdm.gui.tqdm(...) instead. If set, will attempt to use + matplotlib animations for a graphical output [default: False]. + + Returns + ------- + out : decorated iterator. + """ + + monitor_interval = 10 # set to 0 to disable the thread + monitor = None + _instances = WeakSet() + + @staticmethod + def format_sizeof(num, suffix='', divisor=1000): + """ + Formats a number (greater than unity) with SI Order of Magnitude + prefixes. + + Parameters + ---------- + num : float + Number ( >= 1) to format. + suffix : str, optional + Post-postfix [default: '']. + divisor : float, optional + Divisor between prefixes [default: 1000]. + + Returns + ------- + out : str + Number with Order of Magnitude SI unit postfix. + """ + for unit in ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z']: + if abs(num) < 999.5: + if abs(num) < 99.95: + if abs(num) < 9.995: + return f'{num:1.2f}{unit}{suffix}' + return f'{num:2.1f}{unit}{suffix}' + return f'{num:3.0f}{unit}{suffix}' + num /= divisor + return f'{num:3.1f}Y{suffix}' + + @staticmethod + def format_interval(t): + """ + Formats a number of seconds as a clock time, [H:]MM:SS + + Parameters + ---------- + t : int + Number of seconds. + + Returns + ------- + out : str + [H:]MM:SS + """ + sign = '-' if t < 0 else '' + mins, s = divmod(abs(int(t)), 60) + h, m = divmod(mins, 60) + return f'{sign}{h:d}:{m:02d}:{s:02d}' if h else f'{sign}{m:02d}:{s:02d}' + + @staticmethod + def format_num(n): + """ + Intelligent scientific notation (.3g). + + Parameters + ---------- + n : int or float or Numeric + A Number. + + Returns + ------- + out : str + Formatted number. + """ + f = f'{n:.3g}'.replace('e+0', 'e+').replace('e-0', 'e-') + n = str(n) + return f if len(f) < len(n) else n + + @staticmethod + def status_printer(file): + """ + Manage the printing and in-place updating of a line of characters. + Note that if the string is longer than a line, then in-place + updating may not work (it will print a new line at each refresh). + """ + fp = file + fp_flush = getattr(fp, 'flush', lambda: None) # pragma: no cover + if fp in (sys.stderr, sys.stdout): + getattr(sys.stderr, 'flush', lambda: None)() + getattr(sys.stdout, 'flush', lambda: None)() + + def fp_write(s): + fp.write(str(s)) + fp_flush() + + last_len = [0] + + def print_status(s): + len_s = disp_len(s) + fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0))) + last_len[0] = len_s + + return print_status + + @staticmethod + def format_meter(n, total, elapsed, ncols=None, prefix='', ascii=False, unit='it', + unit_scale=False, rate=None, bar_format=None, postfix=None, + unit_divisor=1000, initial=0, colour=None, **extra_kwargs): + """ + Return a string-based progress bar given some parameters + + Parameters + ---------- + n : int or float + Number of finished iterations. + total : int or float + The expected total number of iterations. If meaningless (None), + only basic progress statistics are displayed (no ETA). + elapsed : float + Number of seconds passed since start. + ncols : int, optional + The width of the entire output message. If specified, + dynamically resizes `{bar}` to stay within this bound + [default: None]. If `0`, will not print any bar (only stats). + The fallback is `{bar:10}`. + prefix : str, optional + Prefix message (included in total width) [default: '']. + Use as {desc} in bar_format string. + ascii : bool, optional or str, optional + If not set, use unicode (smooth blocks) to fill the meter + [default: False]. The fallback is to use ASCII characters + " 123456789#". + unit : str, optional + The iteration unit [default: 'it']. + unit_scale : bool or int or float, optional + If 1 or True, the number of iterations will be printed with an + appropriate SI metric prefix (k = 10^3, M = 10^6, etc.) + [default: False]. If any other non-zero number, will scale + `total` and `n`. + rate : float, optional + Manual override for iteration rate. + If [default: None], uses n/elapsed. + bar_format : str, optional + Specify a custom bar string formatting. May impact performance. + [default: '{l_bar}{bar}{r_bar}'], where + l_bar='{desc}: {percentage:3.0f}%|' and + r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' + '{rate_fmt}{postfix}]' + Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, + percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, + rate, rate_fmt, rate_noinv, rate_noinv_fmt, + rate_inv, rate_inv_fmt, postfix, unit_divisor, + remaining, remaining_s, eta. + Note that a trailing ": " is automatically removed after {desc} + if the latter is empty. + postfix : *, optional + Similar to `prefix`, but placed at the end + (e.g. for additional stats). + Note: postfix is usually a string (not a dict) for this method, + and will if possible be set to postfix = ', ' + postfix. + However other types are supported (#382). + unit_divisor : float, optional + [default: 1000], ignored unless `unit_scale` is True. + initial : int or float, optional + The initial counter value [default: 0]. + colour : str, optional + Bar colour (e.g. 'green', '#00ff00'). + + Returns + ------- + out : Formatted meter and stats, ready to display. + """ + + # sanity check: total + if total and n >= (total + 0.5): # allow float imprecision (#849) + total = None + + # apply custom scale if necessary + if unit_scale and unit_scale not in (True, 1): + if total: + total *= unit_scale + n *= unit_scale + if rate: + rate *= unit_scale # by default rate = self.avg_dn / self.avg_dt + unit_scale = False + + elapsed_str = tqdm.format_interval(elapsed) + + # if unspecified, attempt to use rate = average speed + # (we allow manual override since predicting time is an arcane art) + if rate is None and elapsed: + rate = (n - initial) / elapsed + inv_rate = 1 / rate if rate else None + format_sizeof = tqdm.format_sizeof + rate_noinv_fmt = ((format_sizeof(rate) if unit_scale else f'{rate:5.2f}') + if rate else '?') + unit + '/s' + rate_inv_fmt = ( + (format_sizeof(inv_rate) if unit_scale else f'{inv_rate:5.2f}') + if inv_rate else '?') + 's/' + unit + rate_fmt = rate_inv_fmt if inv_rate and inv_rate > 1 else rate_noinv_fmt + + if unit_scale: + n_fmt = format_sizeof(n, divisor=unit_divisor) + total_fmt = format_sizeof(total, divisor=unit_divisor) if total is not None else '?' + else: + n_fmt = str(n) + total_fmt = str(total) if total is not None else '?' + + try: + postfix = ', ' + postfix if postfix else '' + except TypeError: + pass + + remaining = (total - n) / rate if rate and total else 0 + remaining_str = tqdm.format_interval(remaining) if rate else '?' + try: + eta_dt = (datetime.now() + timedelta(seconds=remaining) + if rate and total else datetime.fromtimestamp(0, timezone.utc)) + except OverflowError: + eta_dt = datetime.max + + # format the stats displayed to the left and right sides of the bar + if prefix: + # old prefix setup work around + bool_prefix_colon_already = (prefix[-2:] == ": ") + l_bar = prefix if bool_prefix_colon_already else prefix + ": " + else: + l_bar = '' + + r_bar = f'| {n_fmt}/{total_fmt} [{elapsed_str}<{remaining_str}, {rate_fmt}{postfix}]' + + # Custom bar formatting + # Populate a dict with all available progress indicators + format_dict = { + # slight extension of self.format_dict + 'n': n, 'n_fmt': n_fmt, 'total': total, 'total_fmt': total_fmt, + 'elapsed': elapsed_str, 'elapsed_s': elapsed, + 'ncols': ncols, 'desc': prefix or '', 'unit': unit, + 'rate': inv_rate if inv_rate and inv_rate > 1 else rate, + 'rate_fmt': rate_fmt, 'rate_noinv': rate, + 'rate_noinv_fmt': rate_noinv_fmt, 'rate_inv': inv_rate, + 'rate_inv_fmt': rate_inv_fmt, + 'postfix': postfix, 'unit_divisor': unit_divisor, + 'colour': colour, + # plus more useful definitions + 'remaining': remaining_str, 'remaining_s': remaining, + 'l_bar': l_bar, 'r_bar': r_bar, 'eta': eta_dt, + **extra_kwargs} + + # total is known: we can predict some stats + if total: + # fractional and percentage progress + frac = n / total + percentage = frac * 100 + + l_bar += f'{percentage:3.0f}%|' + + if ncols == 0: + return l_bar[:-1] + r_bar[1:] + + format_dict.update(l_bar=l_bar) + if bar_format: + format_dict.update(percentage=percentage) + + # auto-remove colon for empty `{desc}` + if not prefix: + bar_format = bar_format.replace("{desc}: ", '') + else: + bar_format = "{l_bar}{bar}{r_bar}" + + full_bar = FormatReplace() + nobar = bar_format.format(bar=full_bar, **format_dict) + if not full_bar.format_called: + return nobar # no `{bar}`; nothing else to do + + # Formatting progress bar space available for bar's display + full_bar = Bar(frac, + max(1, ncols - disp_len(nobar)) if ncols else 10, + charset=Bar.ASCII if ascii is True else ascii or Bar.UTF, + colour=colour) + if not _is_ascii(full_bar.charset) and _is_ascii(bar_format): + bar_format = str(bar_format) + res = bar_format.format(bar=full_bar, **format_dict) + return disp_trim(res, ncols) if ncols else res + + elif bar_format: + # user-specified bar_format but no total + l_bar += '|' + format_dict.update(l_bar=l_bar, percentage=0) + full_bar = FormatReplace() + nobar = bar_format.format(bar=full_bar, **format_dict) + if not full_bar.format_called: + return nobar + full_bar = Bar(0, + max(1, ncols - disp_len(nobar)) if ncols else 10, + charset=Bar.BLANK, colour=colour) + res = bar_format.format(bar=full_bar, **format_dict) + return disp_trim(res, ncols) if ncols else res + else: + # no total: no progressbar, ETA, just progress stats + return (f'{(prefix + ": ") if prefix else ""}' + f'{n_fmt}{unit} [{elapsed_str}, {rate_fmt}{postfix}]') + + def __new__(cls, *_, **__): + instance = object.__new__(cls) + with cls.get_lock(): # also constructs lock if non-existent + cls._instances.add(instance) + # create monitoring thread + if cls.monitor_interval and (cls.monitor is None + or not cls.monitor.report()): + try: + cls.monitor = TMonitor(cls, cls.monitor_interval) + except Exception as e: # pragma: nocover + warn("tqdm:disabling monitor support" + " (monitor_interval = 0) due to:\n" + str(e), + TqdmMonitorWarning, stacklevel=2) + cls.monitor_interval = 0 + return instance + + @classmethod + def _get_free_pos(cls, instance=None): + """Skips specified instance.""" + positions = {abs(inst.pos) for inst in cls._instances + if inst is not instance and hasattr(inst, "pos")} + return min(set(range(len(positions) + 1)).difference(positions)) + + @classmethod + def _decr_instances(cls, instance): + """ + Remove from list and reposition another unfixed bar + to fill the new gap. + + This means that by default (where all nested bars are unfixed), + order is not maintained but screen flicker/blank space is minimised. + (tqdm<=4.44.1 moved ALL subsequent unfixed bars up.) + """ + with cls._lock: + try: + cls._instances.remove(instance) + except KeyError: + # if not instance.gui: # pragma: no cover + # raise + pass # py2: maybe magically removed already + # else: + if not instance.gui: + last = (instance.nrows or 20) - 1 + # find unfixed (`pos >= 0`) overflow (`pos >= nrows - 1`) + instances = list(filter( + lambda i: hasattr(i, "pos") and last <= i.pos, + cls._instances)) + # set first found to current `pos` + if instances: + inst = min(instances, key=lambda i: i.pos) + inst.clear(nolock=True) + inst.pos = abs(instance.pos) + + @classmethod + def write(cls, s, file=None, end="\n", nolock=False): + """Print a message via tqdm (without overlap with bars).""" + fp = file if file is not None else sys.stdout + with cls.external_write_mode(file=file, nolock=nolock): + # Write the message + fp.write(s) + fp.write(end) + + @classmethod + @contextmanager + def external_write_mode(cls, file=None, nolock=False): + """ + Disable tqdm within context and refresh tqdm when exits. + Useful when writing to standard output stream + """ + fp = file if file is not None else sys.stdout + + try: + if not nolock: + cls.get_lock().acquire() + # Clear all bars + inst_cleared = [] + for inst in getattr(cls, '_instances', []): + # Clear instance if in the target output file + # or if write output + tqdm output are both either + # sys.stdout or sys.stderr (because both are mixed in terminal) + if hasattr(inst, "start_t") and (inst.fp == fp or all( + f in (sys.stdout, sys.stderr) for f in (fp, inst.fp))): + inst.clear(nolock=True) + inst_cleared.append(inst) + yield + # Force refresh display of bars we cleared + for inst in inst_cleared: + inst.refresh(nolock=True) + finally: + if not nolock: + cls._lock.release() + + @classmethod + def set_lock(cls, lock): + """Set the global lock.""" + cls._lock = lock + + @classmethod + def get_lock(cls): + """Get the global lock. Construct it if it does not exist.""" + if not hasattr(cls, '_lock'): + cls._lock = TqdmDefaultWriteLock() + return cls._lock + + @classmethod + def pandas(cls, **tqdm_kwargs): + """ + Registers the current `tqdm` class with + pandas.core. + ( frame.DataFrame + | series.Series + | groupby.(generic.)DataFrameGroupBy + | groupby.(generic.)SeriesGroupBy + ).progress_apply + + A new instance will be created every time `progress_apply` is called, + and each instance will automatically `close()` upon completion. + + Parameters + ---------- + tqdm_kwargs : arguments for the tqdm instance + + Examples + -------- + >>> import pandas as pd + >>> import numpy as np + >>> from tqdm import tqdm + >>> from tqdm.gui import tqdm as tqdm_gui + >>> + >>> df = pd.DataFrame(np.random.randint(0, 100, (100000, 6))) + >>> tqdm.pandas(ncols=50) # can use tqdm_gui, optional kwargs, etc + >>> # Now you can use `progress_apply` instead of `apply` + >>> df.groupby(0).progress_apply(lambda x: x**2) + + References + ---------- + + """ + from warnings import catch_warnings, simplefilter + + from pandas.core.frame import DataFrame + from pandas.core.series import Series + try: + with catch_warnings(): + simplefilter("ignore", category=FutureWarning) + from pandas import Panel + except ImportError: # pandas>=1.2.0 + Panel = None + Rolling, Expanding = None, None + try: # pandas>=1.0.0 + from pandas.core.window.rolling import _Rolling_and_Expanding + except ImportError: + try: # pandas>=0.18.0 + from pandas.core.window import _Rolling_and_Expanding + except ImportError: # pandas>=1.2.0 + try: # pandas>=1.2.0 + from pandas.core.window.expanding import Expanding + from pandas.core.window.rolling import Rolling + _Rolling_and_Expanding = Rolling, Expanding + except ImportError: # pragma: no cover + _Rolling_and_Expanding = None + try: # pandas>=0.25.0 + from pandas.core.groupby.generic import SeriesGroupBy # , NDFrameGroupBy + from pandas.core.groupby.generic import DataFrameGroupBy + except ImportError: # pragma: no cover + try: # pandas>=0.23.0 + from pandas.core.groupby.groupby import DataFrameGroupBy, SeriesGroupBy + except ImportError: + from pandas.core.groupby import DataFrameGroupBy, SeriesGroupBy + try: # pandas>=0.23.0 + from pandas.core.groupby.groupby import GroupBy + except ImportError: # pragma: no cover + from pandas.core.groupby import GroupBy + + try: # pandas>=0.23.0 + from pandas.core.groupby.groupby import PanelGroupBy + except ImportError: + try: + from pandas.core.groupby import PanelGroupBy + except ImportError: # pandas>=0.25.0 + PanelGroupBy = None + + tqdm_kwargs = tqdm_kwargs.copy() + deprecated_t = [tqdm_kwargs.pop('deprecated_t', None)] + + def inner_generator(df_function='apply'): + def inner(df, func, *args, **kwargs): + """ + Parameters + ---------- + df : (DataFrame|Series)[GroupBy] + Data (may be grouped). + func : function + To be applied on the (grouped) data. + **kwargs : optional + Transmitted to `df.apply()`. + """ + + # Precompute total iterations + total = tqdm_kwargs.pop("total", getattr(df, 'ngroups', None)) + if total is None: # not grouped + if df_function == 'applymap': + total = df.size + elif isinstance(df, Series): + total = len(df) + elif (_Rolling_and_Expanding is None or + not isinstance(df, _Rolling_and_Expanding)): + # DataFrame or Panel + axis = kwargs.get('axis', 0) + if axis == 'index': + axis = 0 + elif axis == 'columns': + axis = 1 + # when axis=0, total is shape[axis1] + total = df.size // df.shape[axis] + + # Init bar + if deprecated_t[0] is not None: + t = deprecated_t[0] + deprecated_t[0] = None + else: + t = cls(total=total, **tqdm_kwargs) + + if len(args) > 0: + # *args intentionally not supported (see #244, #299) + TqdmDeprecationWarning( + "Except func, normal arguments are intentionally" + + " not supported by" + + " `(DataFrame|Series|GroupBy).progress_apply`." + + " Use keyword arguments instead.", + fp_write=getattr(t.fp, 'write', sys.stderr.write)) + + try: # pandas>=1.3.0,<3.0 + from pandas.core.common import is_builtin_func + except ImportError: # pandas<1.3.0 + is_builtin_func = getattr(df, '_is_builtin_func', lambda f: f) + try: + func = is_builtin_func(func) + except TypeError: + pass + + # Define bar updating wrapper + def wrapper(*args, **kwargs): + # update tbar correctly + # it seems `pandas apply` calls `func` twice + # on the first column/row to decide whether it can + # take a fast or slow code path; so stop when t.total==t.n + t.update(n=1 if not t.total or t.n < t.total else 0) + return func(*args, **kwargs) + + # Apply the provided function (in **kwargs) + # on the df using our wrapper (which provides bar updating) + try: + return getattr(df, df_function)(wrapper, **kwargs) + finally: + t.close() + + return inner + + # Monkeypatch pandas to provide easy methods + # Enable custom tqdm progress in pandas! + Series.progress_apply = inner_generator() + SeriesGroupBy.progress_apply = inner_generator() + Series.progress_map = inner_generator('map') + SeriesGroupBy.progress_map = inner_generator('map') + + DataFrame.progress_apply = inner_generator() + DataFrameGroupBy.progress_apply = inner_generator() + DataFrame.progress_applymap = inner_generator('applymap') + DataFrame.progress_map = inner_generator('map') + DataFrameGroupBy.progress_map = inner_generator('map') + + if Panel is not None: + Panel.progress_apply = inner_generator() + if PanelGroupBy is not None: + PanelGroupBy.progress_apply = inner_generator() + + GroupBy.progress_apply = inner_generator() + GroupBy.progress_aggregate = inner_generator('aggregate') + GroupBy.progress_transform = inner_generator('transform') + + if Rolling is not None and Expanding is not None: + Rolling.progress_apply = inner_generator() + Expanding.progress_apply = inner_generator() + elif _Rolling_and_Expanding is not None: + _Rolling_and_Expanding.progress_apply = inner_generator() + + # override defaults via env vars + @envwrap("TQDM_", is_method=True, types={'total': float, 'ncols': int, 'miniters': float, + 'position': int, 'nrows': int}) + def __init__(self, iterable=None, desc=None, total=None, leave=True, file=None, + ncols=None, mininterval=0.1, maxinterval=10.0, miniters=None, + ascii=None, disable=False, unit='it', unit_scale=False, + dynamic_ncols=False, smoothing=0.3, bar_format=None, initial=0, + position=None, postfix=None, unit_divisor=1000, write_bytes=False, + lock_args=None, nrows=None, colour=None, delay=0.0, gui=False, + **kwargs): + """see tqdm.tqdm for arguments""" + if file is None: + file = sys.stderr + + if write_bytes: + # Despite coercing unicode into bytes, py2 sys.std* streams + # should have bytes written to them. + file = SimpleTextIOWrapper( + file, encoding=getattr(file, 'encoding', None) or 'utf-8') + + file = DisableOnWriteError(file, tqdm_instance=self) + + if disable is None and hasattr(file, "isatty") and not file.isatty(): + disable = True + + if total is None and iterable is not None: + try: + total = len(iterable) + except (TypeError, AttributeError): + total = None + if total == float("inf"): + # Infinite iterations, behave same as unknown + total = None + + if disable: + self.iterable = iterable + self.disable = disable + with self._lock: + self.pos = self._get_free_pos(self) + self._instances.remove(self) + self.n = initial + self.total = total + self.leave = leave + return + + if kwargs: + self.disable = True + with self._lock: + self.pos = self._get_free_pos(self) + self._instances.remove(self) + raise ( + TqdmDeprecationWarning( + "`nested` is deprecated and automated.\n" + "Use `position` instead for manual control.\n", + fp_write=getattr(file, 'write', sys.stderr.write)) + if "nested" in kwargs else + TqdmKeyError("Unknown argument(s): " + str(kwargs))) + + # Preprocess the arguments + if ( + (ncols is None or nrows is None) and (file in (sys.stderr, sys.stdout)) + ) or dynamic_ncols: # pragma: no cover + if dynamic_ncols: + dynamic_ncols = _screen_shape_wrapper() + if dynamic_ncols: + ncols, nrows = dynamic_ncols(file) + else: + _dynamic_ncols = _screen_shape_wrapper() + if _dynamic_ncols: + _ncols, _nrows = _dynamic_ncols(file) + if ncols is None: + ncols = _ncols + if nrows is None: + nrows = _nrows + + if miniters is None: + miniters = 0 + dynamic_miniters = True + else: + dynamic_miniters = False + + if mininterval is None: + mininterval = 0 + + if maxinterval is None: + maxinterval = 0 + + if ascii is None: + ascii = not _supports_unicode(file) + + if bar_format and ascii is not True and not _is_ascii(ascii): + # Convert bar format into unicode since terminal uses unicode + bar_format = str(bar_format) + + if smoothing is None: + smoothing = 0 + + # Store the arguments + self.iterable = iterable + self.desc = desc or '' + self.total = total + self.leave = leave + self.fp = file + self.ncols = ncols + self.nrows = nrows + self.mininterval = mininterval + self.maxinterval = maxinterval + self.miniters = miniters + self.dynamic_miniters = dynamic_miniters + self.ascii = ascii + self.disable = disable + self.unit = unit + self.unit_scale = unit_scale + self.unit_divisor = unit_divisor + self.initial = initial + self.lock_args = lock_args + self.delay = delay + self.gui = gui + self.dynamic_ncols = dynamic_ncols + self.smoothing = smoothing + self._ema_dn = EMA(smoothing) + self._ema_dt = EMA(smoothing) + self._ema_miniters = EMA(smoothing) + self.bar_format = bar_format + self.postfix = None + self.colour = colour + self._time = time + if postfix: + try: + self.set_postfix(refresh=False, **postfix) + except TypeError: + self.postfix = postfix + + # Init the iterations counters + self.last_print_n = initial + self.n = initial + + # if nested, at initial sp() call we replace '\r' by '\n' to + # not overwrite the outer progress bar + with self._lock: + # mark fixed positions as negative + self.pos = self._get_free_pos(self) if position is None else -position + + if not gui: + # Initialize the screen printer + self.sp = self.status_printer(self.fp) + if delay <= 0: + self.refresh(lock_args=self.lock_args) + + # Init the time counter + self.last_print_t = self._time() + # NB: Avoid race conditions by setting start_t at the very end of init + self.start_t = self.last_print_t + + def __bool__(self): + if self.total is not None: + return self.total > 0 + if self.iterable is None: + raise TypeError('bool() undefined when iterable == total == None') + return bool(self.iterable) + + def __len__(self): + return ( + self.total if self.iterable is None + else self.iterable.shape[0] if hasattr(self.iterable, "shape") + else len(self.iterable) if hasattr(self.iterable, "__len__") + else self.iterable.__length_hint__() if hasattr(self.iterable, "__length_hint__") + else getattr(self, "total", None)) + + def __reversed__(self): + try: + orig = self.iterable + except AttributeError: + raise TypeError("'tqdm' object is not reversible") + else: + self.iterable = reversed(self.iterable) + return self.__iter__() + finally: + self.iterable = orig + + def __contains__(self, item): + contains = getattr(self.iterable, '__contains__', None) + return contains(item) if contains is not None else item in self.__iter__() + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + try: + self.close() + except AttributeError: + # maybe eager thread cleanup upon external error + if (exc_type, exc_value, traceback) == (None, None, None): + raise + warn("AttributeError ignored", TqdmWarning, stacklevel=2) + + def __del__(self): + self.close() + + def __str__(self): + return self.format_meter(**self.format_dict) + + @property + def _comparable(self): + return abs(getattr(self, "pos", 1 << 31)) + + def __hash__(self): + return id(self) + + def __iter__(self): + """Backward-compatibility to use: for x in tqdm(iterable)""" + + # Inlining instance variables as locals (speed optimisation) + iterable = self.iterable + + # If the bar is disabled, then just walk the iterable + # (note: keep this check outside the loop for performance) + if self.disable: + for obj in iterable: + yield obj + return + + mininterval = self.mininterval + last_print_t = self.last_print_t + last_print_n = self.last_print_n + min_start_t = self.start_t + self.delay + n = self.n + time = self._time + + try: + for obj in iterable: + yield obj + # Update and possibly print the progressbar. + # Note: does not call self.update(1) for speed optimisation. + n += 1 + + if n - last_print_n >= self.miniters: + cur_t = time() + dt = cur_t - last_print_t + if dt >= mininterval and cur_t >= min_start_t: + self.update(n - last_print_n) + last_print_n = self.last_print_n + last_print_t = self.last_print_t + finally: + self.n = n + self.close() + + def update(self, n=1): + """ + Manually update the progress bar, useful for streams + such as reading files. + E.g.: + >>> t = tqdm(total=filesize) # Initialise + >>> for current_buffer in stream: + ... ... + ... t.update(len(current_buffer)) + >>> t.close() + The last line is highly recommended, but possibly not necessary if + `t.update()` will be called in such a way that `filesize` will be + exactly reached and printed. + + Parameters + ---------- + n : int or float, optional + Increment to add to the internal counter of iterations + [default: 1]. If using float, consider specifying `{n:.3f}` + or similar in `bar_format`, or specifying `unit_scale`. + + Returns + ------- + out : bool or None + True if a `display()` was triggered. + """ + if self.disable: + return + + if n < 0: + self.last_print_n += n # for auto-refresh logic to work + self.n += n + + # check counter first to reduce calls to time() + if self.n - self.last_print_n >= self.miniters: + cur_t = self._time() + dt = cur_t - self.last_print_t + if dt >= self.mininterval and cur_t >= self.start_t + self.delay: + cur_t = self._time() + dn = self.n - self.last_print_n # >= n + if self.smoothing and dt and dn: + # EMA (not just overall average) + self._ema_dn(dn) + self._ema_dt(dt) + self.refresh(lock_args=self.lock_args) + if self.dynamic_miniters: + # If no `miniters` was specified, adjust automatically to the + # maximum iteration rate seen so far between two prints. + # e.g.: After running `tqdm.update(5)`, subsequent + # calls to `tqdm.update()` will only cause an update after + # at least 5 more iterations. + if self.maxinterval and dt >= self.maxinterval: + self.miniters = dn * (self.mininterval or self.maxinterval) / dt + elif self.smoothing: + # EMA miniters update + self.miniters = self._ema_miniters( + dn * (self.mininterval / dt if self.mininterval and dt + else 1)) + else: + # max iters between two prints + self.miniters = max(self.miniters, dn) + + # Store old values for next call + self.last_print_n = self.n + self.last_print_t = cur_t + return True + + def close(self): + """Cleanup and (if leave=False) close the progressbar.""" + if self.disable: + return + + # Prevent multiple closures + self.disable = True + + # decrement instance pos and remove from internal set + pos = abs(self.pos) + self._decr_instances(self) + + if self.last_print_t < self.start_t + self.delay: + # haven't ever displayed; nothing to clear + return + + # GUI mode + if getattr(self, 'sp', None) is None: + return + + # annoyingly, _supports_unicode isn't good enough + def fp_write(s): + self.fp.write(str(s)) + + try: + fp_write('') + except ValueError as e: + if 'closed' in str(e): + return + raise # pragma: no cover + + leave = pos == 0 if self.leave is None else self.leave + + with self._lock: + if leave: + # stats for overall rate (no weighted average) + self._ema_dt = lambda: None + self.display(pos=0) + fp_write('\n') + else: + # clear previous display + if self.display(msg='', pos=pos) and not pos: + fp_write('\r') + + def clear(self, nolock=False): + """Clear current bar display.""" + if self.disable: + return + + if not nolock: + self._lock.acquire() + pos = abs(self.pos) + if pos < (self.nrows or 20): + self.moveto(pos) + self.sp('') + self.fp.write('\r') # place cursor back at the beginning of line + self.moveto(-pos) + if not nolock: + self._lock.release() + + def refresh(self, nolock=False, lock_args=None): + """ + Force refresh the display of this bar. + + Parameters + ---------- + nolock : bool, optional + If `True`, does not lock. + If [default: `False`]: calls `acquire()` on internal lock. + lock_args : tuple, optional + Passed to internal lock's `acquire()`. + If specified, will only `display()` if `acquire()` returns `True`. + """ + if self.disable: + return + + if not nolock: + if lock_args: + if not self._lock.acquire(*lock_args): + return False + else: + self._lock.acquire() + self.display() + if not nolock: + self._lock.release() + return True + + def unpause(self): + """Restart tqdm timer from last print time.""" + if self.disable: + return + cur_t = self._time() + self.start_t += cur_t - self.last_print_t + self.last_print_t = cur_t + + def reset(self, total=None): + """ + Resets to 0 iterations for repeated use. + + Consider combining with `leave=True`. + + Parameters + ---------- + total : int or float, optional. Total to use for the new bar. + """ + self.n = 0 + if total is not None: + self.total = total + if self.disable: + return + self.last_print_n = 0 + self.last_print_t = self.start_t = self._time() + self._ema_dn = EMA(self.smoothing) + self._ema_dt = EMA(self.smoothing) + self._ema_miniters = EMA(self.smoothing) + self.refresh() + + def set_description(self, desc=None, refresh=True): + """ + Set/modify description of the progress bar. + + Parameters + ---------- + desc : str, optional + refresh : bool, optional + Forces refresh [default: True]. + """ + self.desc = desc + ': ' if desc else '' + if refresh: + self.refresh() + + def set_description_str(self, desc=None, refresh=True): + """Set/modify description without ': ' appended.""" + self.desc = desc or '' + if refresh: + self.refresh() + + def set_postfix(self, ordered_dict=None, refresh=True, **kwargs): + """ + Set/modify postfix (additional stats) + with automatic formatting based on datatype. + + Parameters + ---------- + ordered_dict : dict or OrderedDict, optional + refresh : bool, optional + Forces refresh [default: True]. + kwargs : dict, optional + """ + # Sort in alphabetical order to be more deterministic + postfix = OrderedDict([] if ordered_dict is None else ordered_dict) + for key in sorted(kwargs.keys()): + postfix[key] = kwargs[key] + # Preprocess stats according to datatype + for key in postfix.keys(): + # Number: limit the length of the string + if isinstance(postfix[key], Number): + postfix[key] = self.format_num(postfix[key]) + # Else for any other type, try to get the string conversion + elif not isinstance(postfix[key], str): + postfix[key] = str(postfix[key]) + # Else if it's a string, don't need to preprocess anything + # Stitch together to get the final postfix + self.postfix = ', '.join(key + '=' + postfix[key].strip() + for key in postfix.keys()) + if refresh: + self.refresh() + + def set_postfix_str(self, s='', refresh=True): + """ + Postfix without dictionary expansion, similar to prefix handling. + """ + self.postfix = str(s) + if refresh: + self.refresh() + + def moveto(self, n): + # TODO: private method + self.fp.write('\n' * n + _term_move_up() * -n) + getattr(self.fp, 'flush', lambda: None)() + + @property + def format_dict(self): + """Public API for read-only member access.""" + if self.disable and not hasattr(self, 'unit'): + return defaultdict(lambda: None, { + 'n': self.n, 'total': self.total, 'elapsed': 0, 'unit': 'it'}) + if self.dynamic_ncols: + self.ncols, self.nrows = self.dynamic_ncols(self.fp) + return { + 'n': self.n, 'total': self.total, + 'elapsed': self._time() - self.start_t if hasattr(self, 'start_t') else 0, + 'ncols': self.ncols, 'nrows': self.nrows, 'prefix': self.desc, + 'ascii': self.ascii, 'unit': self.unit, 'unit_scale': self.unit_scale, + 'rate': self._ema_dn() / self._ema_dt() if self._ema_dt() else None, + 'bar_format': self.bar_format, 'postfix': self.postfix, + 'unit_divisor': self.unit_divisor, 'initial': self.initial, + 'colour': self.colour} + + def display(self, msg=None, pos=None): + """ + Use `self.sp` to display `msg` in the specified `pos`. + + Consider overloading this function when inheriting to use e.g.: + `self.some_frontend(**self.format_dict)` instead of `self.sp`. + + Parameters + ---------- + msg : str, optional. What to display (default: `repr(self)`). + pos : int, optional. Position to `moveto` + (default: `abs(self.pos)`). + """ + if pos is None: + pos = abs(self.pos) + + nrows = self.nrows or 20 + if pos >= nrows - 1: + if pos >= nrows: + return False + if msg or msg is None: # override at `nrows - 1` + msg = " ... (more hidden) ..." + + if not hasattr(self, "sp"): + raise TqdmDeprecationWarning( + "Please use `tqdm.gui.tqdm(...)`" + " instead of `tqdm(..., gui=True)`\n", + fp_write=getattr(self.fp, 'write', sys.stderr.write)) + + if pos: + self.moveto(pos) + self.sp(self.__str__() if msg is None else msg) + if pos: + self.moveto(-pos) + return True + + @classmethod + @contextmanager + def wrapattr(cls, stream, method, total=None, bytes=True, **tqdm_kwargs): + """ + stream : file-like object. + method : str, "read" or "write". The result of `read()` and + the first argument of `write()` should have a `len()`. + + >>> with tqdm.wrapattr(file_obj, "read", total=file_obj.size) as fobj: + ... while True: + ... chunk = fobj.read(chunk_size) + ... if not chunk: + ... break + """ + with cls(total=total, **tqdm_kwargs) as t: + if bytes: + t.unit = "B" + t.unit_scale = True + t.unit_divisor = 1024 + yield CallbackIOWrapper(t.update, stream, method) + + +def trange(*args, **kwargs): + """Shortcut for tqdm(range(*args), **kwargs).""" + return tqdm(range(*args), **kwargs) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/tk.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/tk.py new file mode 100644 index 0000000000000000000000000000000000000000..788303c8687e007338ce816bf9afeec8581f0188 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/tk.py @@ -0,0 +1,196 @@ +""" +Tkinter GUI progressbar decorator for iterators. + +Usage: +>>> from tqdm.tk import trange, tqdm +>>> for i in trange(10): +... ... +""" +import re +import sys +import tkinter +import tkinter.ttk as ttk +from warnings import warn + +from .std import TqdmExperimentalWarning, TqdmWarning +from .std import tqdm as std_tqdm + +__author__ = {"github.com/": ["richardsheridan", "casperdcl"]} +__all__ = ['tqdm_tk', 'ttkrange', 'tqdm', 'trange'] + + +class tqdm_tk(std_tqdm): # pragma: no cover + """ + Experimental Tkinter GUI version of tqdm! + + Note: Window interactivity suffers if `tqdm_tk` is not running within + a Tkinter mainloop and values are generated infrequently. In this case, + consider calling `tqdm_tk.refresh()` frequently in the Tk thread. + """ + + # TODO: @classmethod: write()? + + def __init__(self, *args, **kwargs): + """ + This class accepts the following parameters *in addition* to + the parameters accepted by `tqdm`. + + Parameters + ---------- + grab : bool, optional + Grab the input across all windows of the process. + tk_parent : `tkinter.Wm`, optional + Parent Tk window. + cancel_callback : Callable, optional + Create a cancel button and set `cancel_callback` to be called + when the cancel or window close button is clicked. + """ + kwargs = kwargs.copy() + kwargs['gui'] = True + # convert disable = None to False + kwargs['disable'] = bool(kwargs.get('disable', False)) + self._warn_leave = 'leave' in kwargs + grab = kwargs.pop('grab', False) + tk_parent = kwargs.pop('tk_parent', None) + self._cancel_callback = kwargs.pop('cancel_callback', None) + super().__init__(*args, **kwargs) + + if self.disable: + return + + if tk_parent is None: # Discover parent widget + try: + tk_parent = tkinter._default_root + except AttributeError: + raise AttributeError( + "`tk_parent` required when using `tkinter.NoDefaultRoot()`") + if tk_parent is None: # use new default root window as display + self._tk_window = tkinter.Tk() + else: # some other windows already exist + self._tk_window = tkinter.Toplevel() + else: + self._tk_window = tkinter.Toplevel(tk_parent) + + warn("GUI is experimental/alpha", TqdmExperimentalWarning, stacklevel=2) + self._tk_dispatching = self._tk_dispatching_helper() + + self._tk_window.protocol("WM_DELETE_WINDOW", self.cancel) + self._tk_window.wm_title(self.desc) + self._tk_window.wm_attributes("-topmost", 1) + self._tk_window.after(0, lambda: self._tk_window.wm_attributes("-topmost", 0)) + self._tk_n_var = tkinter.DoubleVar(self._tk_window, value=0) + self._tk_text_var = tkinter.StringVar(self._tk_window) + pbar_frame = ttk.Frame(self._tk_window, padding=5) + pbar_frame.pack() + _tk_label = ttk.Label(pbar_frame, textvariable=self._tk_text_var, + wraplength=600, anchor="center", justify="center") + _tk_label.pack() + self._tk_pbar = ttk.Progressbar( + pbar_frame, variable=self._tk_n_var, length=450) + if self.total is not None: + self._tk_pbar.configure(maximum=self.total) + else: + self._tk_pbar.configure(mode="indeterminate") + self._tk_pbar.pack() + if self._cancel_callback is not None: + _tk_button = ttk.Button(pbar_frame, text="Cancel", command=self.cancel) + _tk_button.pack() + if grab: + self._tk_window.grab_set() + + def close(self): + if self.disable: + return + + self.disable = True + + with self.get_lock(): + self._instances.remove(self) + + def _close(): + self._tk_window.after('idle', self._tk_window.destroy) + if not self._tk_dispatching: + self._tk_window.update() + + self._tk_window.protocol("WM_DELETE_WINDOW", _close) + + # if leave is set but we are self-dispatching, the left window is + # totally unresponsive unless the user manually dispatches + if not self.leave: + _close() + elif not self._tk_dispatching: + if self._warn_leave: + warn("leave flag ignored if not in tkinter mainloop", + TqdmWarning, stacklevel=2) + _close() + + def clear(self, *_, **__): + pass + + def display(self, *_, **__): + self._tk_n_var.set(self.n) + d = self.format_dict + # remove {bar} + d['bar_format'] = (d['bar_format'] or "{l_bar}{r_bar}").replace( + "{bar}", "") + msg = self.format_meter(**d) + if '' in msg: + msg = "".join(re.split(r'\|?\|?', msg, maxsplit=1)) + self._tk_text_var.set(msg) + if not self._tk_dispatching: + self._tk_window.update() + + def set_description(self, desc=None, refresh=True): + self.set_description_str(desc, refresh) + + def set_description_str(self, desc=None, refresh=True): + self.desc = desc + if not self.disable: + self._tk_window.wm_title(desc) + if refresh and not self._tk_dispatching: + self._tk_window.update() + + def cancel(self): + """ + `cancel_callback()` followed by `close()` + when close/cancel buttons clicked. + """ + if self._cancel_callback is not None: + self._cancel_callback() + self.close() + + def reset(self, total=None): + """ + Resets to 0 iterations for repeated use. + + Parameters + ---------- + total : int or float, optional. Total to use for the new bar. + """ + if hasattr(self, '_tk_pbar'): + if total is None: + self._tk_pbar.configure(maximum=100, mode="indeterminate") + else: + self._tk_pbar.configure(maximum=total, mode="determinate") + super().reset(total=total) + + @staticmethod + def _tk_dispatching_helper(): + """determine if Tkinter mainloop is dispatching events""" + codes = {tkinter.mainloop.__code__, tkinter.Misc.mainloop.__code__} + for frame in sys._current_frames().values(): + while frame: + if frame.f_code in codes: + return True + frame = frame.f_back + return False + + +def ttkrange(*args, **kwargs): + """Shortcut for `tqdm.tk.tqdm(range(*args), **kwargs)`.""" + return tqdm_tk(range(*args), **kwargs) + + +# Aliases +tqdm = tqdm_tk +trange = ttkrange diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/tqdm.1 b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/tqdm.1 new file mode 100644 index 0000000000000000000000000000000000000000..fe29b8a7d503aaada0305707c934086997da2d29 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/tqdm.1 @@ -0,0 +1,243 @@ +.\" Automatically generated by Pandoc 3.8.3 +.\" +.TH "TQDM" "1" "2015\-2026" "tqdm User Manuals" +.SH NAME +tqdm \- fast, extensible progress bar for Python and CLI +.SH SYNOPSIS +tqdm [\f[I]options\f[R]] +.SH DESCRIPTION +See \c +.UR https://github.com/tqdm/tqdm +.UE \c +\&. +Can be used as a pipe: +.IP +.EX +$ \f[I]# count lines of code\f[R] +$ cat *.py \f[B]|\f[R] tqdm \f[B]|\f[R] wc \-l +327it [00:00, 981773.38it/s] +327 + +$ \f[I]# find all files\f[R] +$ find . \-name \(dq*.py\(dq \f[B]|\f[R] tqdm \f[B]|\f[R] wc \-l +432it [00:00, 833842.30it/s] +432 + +\f[I]# ... and more info\f[R] +$ find . \-name \(aq*.py\(aq \-exec wc \-l \(rs{} \(rs; \(rs + \f[B]|\f[R] tqdm \-\-total 432 \-\-unit files \-\-desc counting \(rs + \f[B]|\f[R] awk \(aq{ sum += $1 }; END { print sum }\(aq +counting: 100%\f[B]|\f[R]█████████\f[B]|\f[R] 432/432 [00:00<00:00, 794361.83files/s] +131998 +.EE +.SH OPTIONS +.TP +\-h, \-\-help +Print this help and exit. +.TP +\-v, \-\-version +Print version and exit. +.TP +\-\-desc=\f[I]desc\f[R] +str, optional. +Prefix for the progressbar. +.TP +\-\-total=\f[I]total\f[R] +int or float, optional. +The number of expected iterations. +If unspecified, len(iterable) is used if possible. +If float(\(lqinf\(rq) or as a last resort, only basic progress +statistics are displayed (no ETA, no progressbar). +If \f[CR]gui\f[R] is True and this parameter needs subsequent updating, +specify an initial arbitrary large positive number, e.g.\ 9e9. +.TP +\-\-leave +bool, optional. +If [default: True], keeps all traces of the progressbar upon termination +of iteration. +If \f[CR]None\f[R], will leave only if \f[CR]position\f[R] is +\f[CR]0\f[R]. +.TP +\-\-ncols=\f[I]ncols\f[R] +int, optional. +The width of the entire output message. +If specified, dynamically resizes the progressbar to stay within this +bound. +If unspecified, attempts to use environment width. +The fallback is a meter width of 10 and no limit for the counter and +statistics. +If 0, will not print any meter (only stats). +.TP +\-\-mininterval=\f[I]mininterval\f[R] +float, optional. +Minimum progress display update interval [default: 0.1] seconds. +.TP +\-\-maxinterval=\f[I]maxinterval\f[R] +float, optional. +Maximum progress display update interval [default: 10] seconds. +Automatically adjusts \f[CR]miniters\f[R] to correspond to +\f[CR]mininterval\f[R] after long display update lag. +Only works if \f[CR]dynamic_miniters\f[R] or monitor thread is enabled. +.TP +\-\-miniters=\f[I]miniters\f[R] +int or float, optional. +Minimum progress display update interval, in iterations. +If 0 and \f[CR]dynamic_miniters\f[R], will automatically adjust to equal +\f[CR]mininterval\f[R] (more CPU efficient, good for tight loops). +If > 0, will skip display of specified number of iterations. +Tweak this and \f[CR]mininterval\f[R] to get very efficient loops. +If your progress is erratic with both fast and slow iterations (network, +skipping items, etc) you should set miniters=1. +.TP +\-\-ascii=\f[I]ascii\f[R] +bool or str, optional. +If unspecified or False, use unicode (smooth blocks) to fill the meter. +The fallback is to use ASCII characters \(rq 123456789#\(lq. +.TP +\-\-disable +bool, optional. +Whether to disable the entire progressbar wrapper [default: False]. +If set to None, disable on non\-TTY. +.TP +\-\-unit=\f[I]unit\f[R] +str, optional. +String that will be used to define the unit of each iteration [default: +it]. +.TP +\-\-unit\-scale=\f[I]unit_scale\f[R] +bool or int or float, optional. +If 1 or True, the number of iterations will be reduced/scaled +automatically and a metric prefix following the International System of +Units standard will be added (kilo, mega, etc.) +[default: False]. +If any other non\-zero number, will scale \f[CR]total\f[R] and +\f[CR]n\f[R]. +.TP +\-\-dynamic\-ncols +bool, optional. +If set, constantly alters \f[CR]ncols\f[R] and \f[CR]nrows\f[R] to the +environment (allowing for window resizes) [default: False]. +.TP +\-\-smoothing=\f[I]smoothing\f[R] +float, optional. +Exponential moving average smoothing factor for speed estimates (ignored +in GUI mode). +Ranges from 0 (average speed) to 1 (current/instantaneous speed) +[default: 0.3]. +.TP +\-\-bar\-format=\f[I]bar_format\f[R] +str, optional. +Specify a custom bar string formatting. +May impact performance. +[default: `{l_bar}{bar}{r_bar}'], where l_bar=`{desc}: +{percentage:3.0f}%|' and r_bar=`| {n_fmt}/{total_fmt} +[{elapsed}<{remaining}, \(cq \(cq{rate_fmt}{postfix}]' Possible vars: +l_bar, bar, r_bar, n, n_fmt, total, total_fmt, percentage, elapsed, +elapsed_s, ncols, nrows, desc, unit, rate, rate_fmt, rate_noinv, +rate_noinv_fmt, rate_inv, rate_inv_fmt, postfix, unit_divisor, +remaining, remaining_s, eta. +Note that a trailing \(lq:\(rq is automatically removed after {desc} if +the latter is empty. +.TP +\-\-initial=\f[I]initial\f[R] +int or float, optional. +The initial counter value. +Useful when restarting a progress bar [default: 0]. +If using float, consider specifying \f[CR]{n:.3f}\f[R] or similar in +\f[CR]bar_format\f[R], or specifying \f[CR]unit_scale\f[R]. +.TP +\-\-position=\f[I]position\f[R] +int, optional. +Specify the line offset to print this bar (starting from 0) Automatic if +unspecified. +Useful to manage multiple bars at once (eg, from threads). +.TP +\-\-postfix=\f[I]postfix\f[R] +dict or *, optional. +Specify additional stats to display at the end of the bar. +Calls \f[CR]set_postfix(**postfix)\f[R] if possible (dict). +.TP +\-\-unit\-divisor=\f[I]unit_divisor\f[R] +float, optional. +[default: 1000], ignored unless \f[CR]unit_scale\f[R] is True. +.TP +\-\-write\-bytes +bool, optional. +Whether to write bytes. +If (default: False) will write unicode. +.TP +\-\-lock\-args=\f[I]lock_args\f[R] +tuple, optional. +Passed to \f[CR]refresh\f[R] for intermediate output (initialisation, +iterating, and updating). +.TP +\-\-nrows=\f[I]nrows\f[R] +int, optional. +The screen height. +If specified, hides nested bars outside this bound. +If unspecified, attempts to use environment height. +The fallback is 20. +.TP +\-\-colour=\f[I]colour\f[R] +str, optional. +Bar colour (e.g.\ `green', `#00ff00'). +.TP +\-\-delay=\f[I]delay\f[R] +float, optional. +Don\(cqt display until [default: 0] seconds have elapsed. +.TP +\-\-delim=\f[I]delim\f[R] +chr, optional. +Delimiting character [default: `\(rsn']. +Use `\(rs0' for null. +N.B.: on Windows systems, Python converts `\(rsn' to `\(rsr\(rsn'. +.TP +\-\-buf\-size=\f[I]buf_size\f[R] +int, optional. +String buffer size in bytes [default: 256] used when \f[CR]delim\f[R] is +specified. +.TP +\-\-bytes +bool, optional. +If true, will count bytes, ignore \f[CR]delim\f[R], and default +\f[CR]unit_scale\f[R] to True, \f[CR]unit_divisor\f[R] to 1024, and +\f[CR]unit\f[R] to `B'. +.TP +\-\-tee +bool, optional. +If true, passes \f[CR]stdin\f[R] to both \f[CR]stderr\f[R] and +\f[CR]stdout\f[R]. +.TP +\-\-update +bool, optional. +If true, will treat input as newly elapsed iterations, i.e.\ numbers to +pass to \f[CR]update()\f[R]. +Note that this is slow (\(ti2e5 it/s) since every input must be decoded +as a number. +.TP +\-\-update\-to +bool, optional. +If true, will treat input as total elapsed iterations, i.e.\ numbers to +assign to \f[CR]self.n\f[R]. +Note that this is slow (\(ti2e5 it/s) since every input must be decoded +as a number. +.TP +\-\-null +bool, optional. +If true, will discard input (no stdout). +.TP +\-\-manpath=\f[I]manpath\f[R] +str, optional. +Directory in which to install tqdm man pages. +.TP +\-\-comppath=\f[I]comppath\f[R] +str, optional. +Directory in which to place tqdm completion. +.TP +\-\-log=\f[I]log\f[R] +str, optional. +CRITICAL|FATAL|ERROR|WARN(ING)|[default: `INFO']|DEBUG|NOTSET. +.SH AUTHORS +tqdm developers \c +.UR https://github.com/tqdm +.UE \c. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/utils.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..ab454de7c2a7f6c8e47dd9f61e5d288351bd143b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/utils.py @@ -0,0 +1,399 @@ +""" +General helpers required for `tqdm.std`. +""" +import os +import re +import sys +from functools import partial, partialmethod, wraps +from inspect import signature +# TODO consider using wcswidth third-party package for 0-width characters +from unicodedata import east_asian_width +from warnings import warn +from weakref import proxy + +_range, _unich, _unicode, _basestring = range, chr, str, str +CUR_OS = sys.platform +IS_WIN = any(CUR_OS.startswith(i) for i in ['win32', 'cygwin']) +IS_NIX = any(CUR_OS.startswith(i) for i in ['aix', 'linux', 'darwin', 'freebsd']) +RE_ANSI = re.compile(r"\x1b\[[;\d]*[A-Za-z]") + +try: + if IS_WIN: + import colorama + else: + raise ImportError +except ImportError: + colorama = None +else: + try: + colorama.init(strip=False) + except TypeError: + colorama.init() + + +def envwrap(prefix, types=None, is_method=False): + """ + Override parameter defaults via `os.environ[prefix + param_name]`. + Maps UPPER_CASE env vars map to lower_case param names. + camelCase isn't supported (because Windows ignores case). + + Precedence (highest first): + + - call (`foo(a=3)`) + - environ (`FOO_A=2`) + - signature (`def foo(a=1)`) + + Parameters + ---------- + prefix : str + Env var prefix, e.g. "FOO_" + types : dict, optional + Fallback mappings `{'param_name': type, ...}` if types cannot be + inferred from function signature. + Consider using `types=collections.defaultdict(lambda: ast.literal_eval)`. + is_method : bool, optional + Whether to use `functools.partialmethod`. If (default: False) use `functools.partial`. + + Examples + -------- + ``` + $ cat foo.py + from tqdm.utils import envwrap + @envwrap("FOO_") + def test(a=1, b=2, c=3): + print(f"received: a={a}, b={b}, c={c}") + + $ FOO_A=42 FOO_C=1337 python -c 'import foo; foo.test(c=99)' + received: a=42, b=2, c=99 + ``` + """ + if types is None: + types = {} + i = len(prefix) + env_overrides = {k[i:].lower(): v for k, v in os.environ.items() if k.startswith(prefix)} + part = partialmethod if is_method else partial + + def wrap(func): + params = signature(func).parameters + # ignore unknown env vars + overrides = {k: v for k, v in env_overrides.items() if k in params} + # infer overrides' `type`s + for k in overrides: + param = params[k] + if param.annotation is not param.empty: # typehints + for typ in getattr(param.annotation, '__args__', (param.annotation,)): + try: + overrides[k] = typ(overrides[k]) + except Exception: + pass + else: + break + elif param.default is not None: # type of default value + overrides[k] = type(param.default)(overrides[k]) + else: + try: # `types` fallback + overrides[k] = types[k](overrides[k]) + except KeyError: # keep unconverted (`str`) + pass + return part(func, **overrides) + return wrap + + +class FormatReplace: + """ + >>> a = FormatReplace('something') + >>> f"{a:5d}" + 'something' + """ # NOQA: P102 + def __init__(self, replace=''): + self.replace = replace + self.format_called = 0 + + def __format__(self, _): + self.format_called += 1 + return self.replace + + +class Comparable: + """Assumes child has self._comparable attr/@property""" + def __lt__(self, other): + return self._comparable < other._comparable + + def __le__(self, other): + return (self < other) or (self == other) + + def __eq__(self, other): + return self._comparable == other._comparable + + def __ne__(self, other): + return not self == other + + def __gt__(self, other): + return not self <= other + + def __ge__(self, other): + return not self < other + + +class ObjectWrapper: + def __getattr__(self, name): + return getattr(self._wrapped, name) + + def __setattr__(self, name, value): + return setattr(self._wrapped, name, value) + + def wrapper_getattr(self, name): + """Actual `self.getattr` rather than self._wrapped.getattr""" + try: + return object.__getattr__(self, name) + except AttributeError: # py2 + return getattr(self, name) + + def wrapper_setattr(self, name, value): + """Actual `self.setattr` rather than self._wrapped.setattr""" + return object.__setattr__(self, name, value) + + def __init__(self, wrapped): + """ + Thin wrapper around a given object + """ + self.wrapper_setattr('_wrapped', wrapped) + + +class SimpleTextIOWrapper(ObjectWrapper): + """ + Change only `.write()` of the wrapped object by encoding the passed + value and passing the result to the wrapped object's `.write()` method. + """ + # pylint: disable=too-few-public-methods + def __init__(self, wrapped, encoding): + super().__init__(wrapped) + self.wrapper_setattr('encoding', encoding) + + def write(self, s): + """ + Encode `s` and pass to the wrapped object's `.write()` method. + """ + return self._wrapped.write(s.encode(self.wrapper_getattr('encoding'))) + + def __eq__(self, other): + return self._wrapped == getattr(other, '_wrapped', other) + + +class DisableOnWriteError(ObjectWrapper): + """ + Disable the given `tqdm_instance` upon `write()` or `flush()` errors. + """ + @staticmethod + def disable_on_exception(tqdm_instance, func): + """ + Quietly set `tqdm_instance.miniters=inf` if `func` raises `errno=5`. + """ + tqdm_instance = proxy(tqdm_instance) + + def inner(*args, **kwargs): + try: + return func(*args, **kwargs) + except OSError as e: + if e.errno != 5: + raise + try: + tqdm_instance.miniters = float('inf') + except ReferenceError: + pass + except ValueError as e: + if 'closed' not in str(e): + raise + try: + tqdm_instance.miniters = float('inf') + except ReferenceError: + pass + return inner + + def __init__(self, wrapped, tqdm_instance): # noqa: B042 + super().__init__(wrapped) + if hasattr(wrapped, 'write'): + self.wrapper_setattr( + 'write', self.disable_on_exception(tqdm_instance, wrapped.write)) + if hasattr(wrapped, 'flush'): + self.wrapper_setattr( + 'flush', self.disable_on_exception(tqdm_instance, wrapped.flush)) + + def __eq__(self, other): + return self._wrapped == getattr(other, '_wrapped', other) + + +class CallbackIOWrapper(ObjectWrapper): + def __init__(self, callback, stream, method="read"): + """ + Wrap a given `file`-like object's `read()` or `write()` to report + lengths to the given `callback` + """ + super().__init__(stream) + func = getattr(stream, method) + if method == "write": + @wraps(func) + def write(data, *args, **kwargs): + res = func(data, *args, **kwargs) + callback(len(data)) + return res + self.wrapper_setattr('write', write) + elif method == "read": + @wraps(func) + def read(*args, **kwargs): + data = func(*args, **kwargs) + callback(len(data)) + return data + self.wrapper_setattr('read', read) + else: + raise KeyError("Can only wrap read/write methods") + + +def _is_utf(encoding): + try: + '\u2588\u2589'.encode(encoding) + except UnicodeEncodeError: + return False + except Exception: + try: + return encoding.lower().startswith('utf-') or ('U8' == encoding) + except Exception: + return False + else: + return True + + +def _supports_unicode(fp): + try: + return _is_utf(fp.encoding) + except AttributeError: + return False + + +def _is_ascii(s): + if isinstance(s, str): + for c in s: + if ord(c) > 255: + return False + return True + return _supports_unicode(s) + + +def _screen_shape_wrapper(): # pragma: no cover + """ + Return a function which returns console dimensions (width, height). + Supported: linux, osx, windows, cygwin. + """ + _screen_shape = None + if IS_WIN: + _screen_shape = _screen_shape_windows + if _screen_shape is None: + _screen_shape = _screen_shape_tput + if IS_NIX: + _screen_shape = _screen_shape_linux + return _screen_shape + + +def _screen_shape_windows(fp): # pragma: no cover + try: + import struct + from ctypes import create_string_buffer, windll + from sys import stdin, stdout + + io_handle = -12 # assume stderr + if fp == stdin: + io_handle = -10 + elif fp == stdout: + io_handle = -11 + + h = windll.kernel32.GetStdHandle(io_handle) + csbi = create_string_buffer(22) + res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi) + if res: + (_bufx, _bufy, _curx, _cury, _wattr, left, top, right, bottom, + _maxx, _maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw) + return right - left, bottom - top # +1 + except Exception: # nosec + pass + return None, None + + +def _screen_shape_tput(*_): # pragma: no cover + """cygwin xterm (windows)""" + try: + import shlex + from subprocess import check_call # nosec + return [int(check_call(shlex.split('tput ' + i))) - 1 + for i in ('cols', 'lines')] + except Exception: # nosec + pass + return None, None + + +def _screen_shape_linux(fp): # pragma: no cover + + try: + from array import array + from fcntl import ioctl + from termios import TIOCGWINSZ + except ImportError: + return None, None + else: + try: + rows, cols = array('h', ioctl(fp, TIOCGWINSZ, '\0' * 8))[:2] + return cols, rows + except Exception: + try: + return [int(os.environ[i]) - 1 for i in ("COLUMNS", "LINES")] + except (KeyError, ValueError): + return None, None + + +def _environ_cols_wrapper(): # pragma: no cover + """ + Return a function which returns console width. + Supported: linux, osx, windows, cygwin. + """ + warn("Use `_screen_shape_wrapper()(file)[0]` instead of" + " `_environ_cols_wrapper()(file)`", DeprecationWarning, stacklevel=2) + shape = _screen_shape_wrapper() + if not shape: + return None + + @wraps(shape) + def inner(fp): + return shape(fp)[0] + + return inner + + +def _term_move_up(): # pragma: no cover + return '' if (os.name == 'nt') and (colorama is None) else '\x1b[A' + + +def _text_width(s): + return sum(2 if east_asian_width(ch) in 'FW' else 1 for ch in str(s)) + + +def disp_len(data): + """ + Returns the real on-screen length of a string which may contain + ANSI control codes and wide chars. + """ + return _text_width(RE_ANSI.sub('', data)) + + +def disp_trim(data, length): + """ + Trim a string which may contain ANSI control characters. + """ + if len(data) == disp_len(data): + return data[:length] + + ansi_present = bool(RE_ANSI.search(data)) + while disp_len(data) > length: # carefully delete one char at a time + data = data[:-1] + if ansi_present and bool(RE_ANSI.search(data)): + # assume ANSI reset is required + return data if data.endswith("\033[0m") else data + "\033[0m" + return data diff --git a/TTS/Kokoro/.venv/Lib/site-packages/tqdm/version.py b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/version.py new file mode 100644 index 0000000000000000000000000000000000000000..9338fb19799fd1d094357bacb91fc7d8aa350ad7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/tqdm/version.py @@ -0,0 +1,10 @@ +"""`tqdm` version detector. Precedence: installed dist, git, 'UNKNOWN'.""" +try: + from importlib.metadata import PackageNotFoundError, version +except ImportError: # py<3.8 + from importlib_metadata import PackageNotFoundError, version + +try: + __version__ = version('tqdm') +except PackageNotFoundError: + __version__ = "UNKNOWN" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..81b70db1503c28448c67f40fe54382ca28a11e78 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/RECORD @@ -0,0 +1,4249 @@ +../../Scripts/transformers.exe,sha256=T2A0pDT8V47PYVKDFlelz7TR682pHjtLnlq--xfvsn0,108392 +transformers-5.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +transformers-5.2.0.dist-info/METADATA,sha256=Q0DQ9VC_d9ZZXk76_gZs2IMGMHV3cB345VitYgVRxl8,32319 +transformers-5.2.0.dist-info/RECORD,, +transformers-5.2.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91 +transformers-5.2.0.dist-info/entry_points.txt,sha256=TcBlmquYV475KJBK8EhQNnsLiegWUy_QoKR4R0pMh2g,68 +transformers-5.2.0.dist-info/licenses/LICENSE,sha256=d_1HEN757DwPYiWADgI18VpCWr1KiwNVkSf814JhIEk,11418 +transformers-5.2.0.dist-info/top_level.txt,sha256=GLBaeTo_CSdhnHvbxQ0kzpEHdlLuA_33foIogaWxntI,13 +transformers/__init__.py,sha256=kbLFRMaEj0zoITx3CqpwXOaC7mVsmV9M5YNSxLc2juc,38424 +transformers/__pycache__/__init__.cpython-312.pyc,, +transformers/__pycache__/activations.cpython-312.pyc,, +transformers/__pycache__/audio_utils.cpython-312.pyc,, +transformers/__pycache__/backbone_utils.cpython-312.pyc,, +transformers/__pycache__/cache_utils.cpython-312.pyc,, +transformers/__pycache__/configuration_utils.cpython-312.pyc,, +transformers/__pycache__/conversion_mapping.cpython-312.pyc,, +transformers/__pycache__/convert_slow_tokenizer.cpython-312.pyc,, +transformers/__pycache__/convert_slow_tokenizers_checkpoints_to_fast.cpython-312.pyc,, +transformers/__pycache__/core_model_loading.cpython-312.pyc,, +transformers/__pycache__/debug_utils.cpython-312.pyc,, +transformers/__pycache__/dependency_versions_check.cpython-312.pyc,, +transformers/__pycache__/dependency_versions_table.cpython-312.pyc,, +transformers/__pycache__/dynamic_module_utils.cpython-312.pyc,, +transformers/__pycache__/feature_extraction_sequence_utils.cpython-312.pyc,, +transformers/__pycache__/feature_extraction_utils.cpython-312.pyc,, +transformers/__pycache__/file_utils.cpython-312.pyc,, +transformers/__pycache__/hf_argparser.cpython-312.pyc,, +transformers/__pycache__/hyperparameter_search.cpython-312.pyc,, +transformers/__pycache__/image_processing_base.cpython-312.pyc,, +transformers/__pycache__/image_processing_utils.cpython-312.pyc,, +transformers/__pycache__/image_processing_utils_fast.cpython-312.pyc,, +transformers/__pycache__/image_transforms.cpython-312.pyc,, +transformers/__pycache__/image_utils.cpython-312.pyc,, +transformers/__pycache__/initialization.cpython-312.pyc,, +transformers/__pycache__/masking_utils.cpython-312.pyc,, +transformers/__pycache__/model_debugging_utils.cpython-312.pyc,, +transformers/__pycache__/modelcard.cpython-312.pyc,, +transformers/__pycache__/modeling_attn_mask_utils.cpython-312.pyc,, +transformers/__pycache__/modeling_flash_attention_utils.cpython-312.pyc,, +transformers/__pycache__/modeling_gguf_pytorch_utils.cpython-312.pyc,, +transformers/__pycache__/modeling_layers.cpython-312.pyc,, +transformers/__pycache__/modeling_outputs.cpython-312.pyc,, +transformers/__pycache__/modeling_rope_utils.cpython-312.pyc,, +transformers/__pycache__/modeling_utils.cpython-312.pyc,, +transformers/__pycache__/optimization.cpython-312.pyc,, +transformers/__pycache__/processing_utils.cpython-312.pyc,, +transformers/__pycache__/pytorch_utils.cpython-312.pyc,, +transformers/__pycache__/safetensors_conversion.cpython-312.pyc,, +transformers/__pycache__/testing_utils.cpython-312.pyc,, +transformers/__pycache__/time_series_utils.cpython-312.pyc,, +transformers/__pycache__/tokenization_mistral_common.cpython-312.pyc,, +transformers/__pycache__/tokenization_python.cpython-312.pyc,, +transformers/__pycache__/tokenization_utils_base.cpython-312.pyc,, +transformers/__pycache__/tokenization_utils_sentencepiece.cpython-312.pyc,, +transformers/__pycache__/tokenization_utils_tokenizers.cpython-312.pyc,, +transformers/__pycache__/trainer.cpython-312.pyc,, +transformers/__pycache__/trainer_callback.cpython-312.pyc,, +transformers/__pycache__/trainer_jit_checkpoint.cpython-312.pyc,, +transformers/__pycache__/trainer_optimizer.cpython-312.pyc,, +transformers/__pycache__/trainer_pt_utils.cpython-312.pyc,, +transformers/__pycache__/trainer_seq2seq.cpython-312.pyc,, +transformers/__pycache__/trainer_utils.cpython-312.pyc,, +transformers/__pycache__/training_args.cpython-312.pyc,, +transformers/__pycache__/training_args_seq2seq.cpython-312.pyc,, +transformers/__pycache__/video_processing_utils.cpython-312.pyc,, +transformers/__pycache__/video_utils.cpython-312.pyc,, +transformers/activations.py,sha256=EKXLSC-FTF06--W7Heq18U_yHIANCKOLEChTi54fOGc,13176 +transformers/audio_utils.py,sha256=HtLgV6nkfqJjhxYYX180Ugprt2sjyJETRftJLgtq1hA,54555 +transformers/backbone_utils.py,sha256=BQY9JzEZQ37iA_QKOWxOabbg4L628jAVKXhMxsRpjqY,15266 +transformers/cache_utils.py,sha256=5P4gyh7rF-oM5-YtHb0Nbqsy5wcgRPKTYSQDuODEd_0,60147 +transformers/cli/__init__.py,sha256=A4zmzuHD2OHjQ5zmdfcnsj0JeCzHVPtpzh-wCjInugA,606 +transformers/cli/__pycache__/__init__.cpython-312.pyc,, +transformers/cli/__pycache__/add_fast_image_processor.cpython-312.pyc,, +transformers/cli/__pycache__/add_new_model_like.cpython-312.pyc,, +transformers/cli/__pycache__/chat.cpython-312.pyc,, +transformers/cli/__pycache__/download.cpython-312.pyc,, +transformers/cli/__pycache__/serve.cpython-312.pyc,, +transformers/cli/__pycache__/system.cpython-312.pyc,, +transformers/cli/__pycache__/transformers.cpython-312.pyc,, +transformers/cli/add_fast_image_processor.py,sha256=G4tcJrarc3ajPML4rLiBBjiY4Xp4_wcqG_emkJ-Bot4,23296 +transformers/cli/add_new_model_like.py,sha256=mUGL-AajBXUnZkYraoj570MWGHa_e0D7I7U5-ckkUco,33031 +transformers/cli/chat.py,sha256=PwHvO0OaWVN5TqVRFsEDp-D1T6R8Jba7JtBvPKvJciY,24695 +transformers/cli/download.py,sha256=hO2NipXmWif_xNAR0c4CPvZUnxPzfHxBmOu8s2dfTuE,1692 +transformers/cli/serve.py,sha256=BubKSvN8xoldoWjPmBubghbmEIqGrRa5Meok8uHt91Y,79828 +transformers/cli/system.py,sha256=BqPPxBLFzNjKjfCv3AklfqnVVKyQ04NigSx8HlpDxso,4738 +transformers/cli/transformers.py,sha256=nSgHO3PAGkufNbOI8funjzT36Lb3QR7lUuchJfXa5M4,1367 +transformers/configuration_utils.py,sha256=UhACcuO_WVUcByoGQFPpC8MPH9Cqnkj6x61LZ1xj68w,57894 +transformers/conversion_mapping.py,sha256=yO_MbOIiSTkpmATUlbpPNhq1luWfM-PbKOm0Yp_EgeA,19302 +transformers/convert_slow_tokenizer.py,sha256=bvo2Z-vy3s5Emy-5OLpqo-RUI3W32TKtEj7gDbPOJ5c,75372 +transformers/convert_slow_tokenizers_checkpoints_to_fast.py,sha256=clQ6w0W8vfL_CrRDpPBO4CGXAxAG4AJ9pb8YL5MPhpA,5790 +transformers/core_model_loading.py,sha256=A0-GCYkFa3yE7mtvvsGXrHU9Fr7BIKWI7vBT0tZ0GCw,57649 +transformers/data/__init__.py,sha256=MuXSchTzRSaUtUDC1uSeDkHiSbjtrQZg4IoKeKHoH6A,1490 +transformers/data/__pycache__/__init__.cpython-312.pyc,, +transformers/data/__pycache__/data_collator.cpython-312.pyc,, +transformers/data/data_collator.py,sha256=TvK95b5THl-zQUsi4_ST9i_UbuezVEjgXXUlF5ysF6w,69690 +transformers/data/datasets/__init__.py,sha256=_KGvq0E6uO2iT0Kzl_HDJIuz9xkQmePGgfqkRU4hvS8,724 +transformers/data/datasets/__pycache__/__init__.cpython-312.pyc,, +transformers/data/datasets/__pycache__/glue.cpython-312.pyc,, +transformers/data/datasets/__pycache__/squad.cpython-312.pyc,, +transformers/data/datasets/glue.py,sha256=4LZJgtGm27re7foc6KOZ2rAZB3PoCS10JsQ-sbumIBo,6086 +transformers/data/datasets/squad.py,sha256=VaZNZ2SyyZbgOFg-hqnkeI0atrgNIQw5XBYPeYXp4MI,9145 +transformers/data/metrics/__init__.py,sha256=km9yg-ht5wbJYlaeBkJskzapjfpiv9wPArDP_5k4DQw,3640 +transformers/data/metrics/__pycache__/__init__.cpython-312.pyc,, +transformers/data/metrics/__pycache__/squad_metrics.cpython-312.pyc,, +transformers/data/metrics/squad_metrics.py,sha256=__cjdPU1qt3bjnXq3k6CC2_p_5DxbU8p6I5EL40unrg,29685 +transformers/data/processors/__init__.py,sha256=lvN5mp9mdrr5v6QvZT6VcoZ78zZUvXiumTm6Gdvlgvo,1014 +transformers/data/processors/__pycache__/__init__.cpython-312.pyc,, +transformers/data/processors/__pycache__/glue.cpython-312.pyc,, +transformers/data/processors/__pycache__/squad.cpython-312.pyc,, +transformers/data/processors/__pycache__/utils.cpython-312.pyc,, +transformers/data/processors/__pycache__/xnli.cpython-312.pyc,, +transformers/data/processors/glue.py,sha256=e-TbSIQFJ29WhxnS1rn-Ne61Tf322Eh9HzKyZR2c95U,21368 +transformers/data/processors/squad.py,sha256=t7BnHz6ePs3TYfUJA4MekR84fQjw7ocR6HbCVyQyLBE,28895 +transformers/data/processors/utils.py,sha256=IEiGb4u5z80mOFaFUnRVkkk7lT-l19UllT05FUYBxVo,12829 +transformers/data/processors/xnli.py,sha256=6E-hvbeM2Gn_cKCqwB5eq1zHXDRitDTgam6prnfC-KE,3466 +transformers/debug_utils.py,sha256=6m6Ks51IXFlIhEPdbXbsFi_3ZWjM34kpxV5l7-LR4bU,12891 +transformers/dependency_versions_check.py,sha256=Uj3M5Rn38MDjLg5q9DAz2TGnOdvkdDpwrSrxGjVukQM,2099 +transformers/dependency_versions_table.py,sha256=deSDUTrIsrPIo3eo8ZdJBuGB9Pk1xvxYpvEnIbufOHg,3324 +transformers/distributed/__init__.py,sha256=ds-xiU6Hko8BN-XiIF2cJZPCjrQ-JFlodRARkPK8g-0,978 +transformers/distributed/__pycache__/__init__.cpython-312.pyc,, +transformers/distributed/__pycache__/configuration_utils.cpython-312.pyc,, +transformers/distributed/configuration_utils.py,sha256=c43IoxSKL3FnA9q3-suCYgoMyjfJnLQr5HASppruVTQ,4386 +transformers/dynamic_module_utils.py,sha256=yckPXLh-yxLqzgi0CMcZj-4hP9fSXD4hBZuRfKeKYD8,34746 +transformers/feature_extraction_sequence_utils.py,sha256=RoNp3S-PKE_uwUuFivsJXv03Y6-C1X0PRzjtp7UvaOU,18846 +transformers/feature_extraction_utils.py,sha256=F5qOivmPnVPSQJDgEAeD2f5KMQHxXj7fMrJW7cwHLMM,30132 +transformers/file_utils.py,sha256=csjz46-BAJ-tNyLjRAqBQWxZZWCVrRGOoAvDTxgyHSs,2935 +transformers/generation/__init__.py,sha256=ybSh7NZJ4KzeQ_qSGefwE2tDTR86sFHHewnuxMRmQtA,6830 +transformers/generation/__pycache__/__init__.cpython-312.pyc,, +transformers/generation/__pycache__/candidate_generator.cpython-312.pyc,, +transformers/generation/__pycache__/configuration_utils.cpython-312.pyc,, +transformers/generation/__pycache__/logits_process.cpython-312.pyc,, +transformers/generation/__pycache__/stopping_criteria.cpython-312.pyc,, +transformers/generation/__pycache__/streamers.cpython-312.pyc,, +transformers/generation/__pycache__/utils.cpython-312.pyc,, +transformers/generation/__pycache__/watermarking.cpython-312.pyc,, +transformers/generation/candidate_generator.py,sha256=hqNkjkaIh1spmGIJZ9KCYs3dX_AcflfEe58X0DlqO2Y,67662 +transformers/generation/configuration_utils.py,sha256=AUbVIR-L4VlOXDpd_5GBc8DOHNai7f7ke--8-jT4zAQ,78958 +transformers/generation/continuous_batching/__init__.py,sha256=X3bo8vwLZ3HgUL0z5KAnoyEFQb1VhLwf0nKAyVr-RWs,1027 +transformers/generation/continuous_batching/__pycache__/__init__.cpython-312.pyc,, +transformers/generation/continuous_batching/__pycache__/cache.cpython-312.pyc,, +transformers/generation/continuous_batching/__pycache__/cache_manager.cpython-312.pyc,, +transformers/generation/continuous_batching/__pycache__/continuous_api.cpython-312.pyc,, +transformers/generation/continuous_batching/__pycache__/input_ouputs.cpython-312.pyc,, +transformers/generation/continuous_batching/__pycache__/requests.cpython-312.pyc,, +transformers/generation/continuous_batching/__pycache__/scheduler.cpython-312.pyc,, +transformers/generation/continuous_batching/cache.py,sha256=0qce9kApzwNM8wKpURcZ_Ddert-ZVMbayvr4lqEjpr8,38969 +transformers/generation/continuous_batching/cache_manager.py,sha256=GaEIq77arOZRpkLO9aZ4vvJS0FKHyautAYA37b3FAns,26205 +transformers/generation/continuous_batching/continuous_api.py,sha256=7kmKNuLRmKYWSyt9kCaEYJaiqpwOBvII0dK-ORiEW9w,48902 +transformers/generation/continuous_batching/input_ouputs.py,sha256=9R8OtSgCohgO9KRmG4YIpl7wZaGUsIf8QIhXavMcgBE,24096 +transformers/generation/continuous_batching/requests.py,sha256=12ixC8aaXvAvKDOEcsc5AxpJxcjorxaEgex3fTR4dSo,14478 +transformers/generation/continuous_batching/scheduler.py,sha256=OXdmTNhna0L4eqRbtBq-38flm5taDupPfeVorJZb5iE,19703 +transformers/generation/logits_process.py,sha256=-HoUlkMdd5tyEsKa5dEWBRy3b_9tJnJ8mKbmvbo5PYc,149974 +transformers/generation/stopping_criteria.py,sha256=UbIHEmi0BGOVoYOQH-jjZrykGfFA-nqI0xUAxcoy54M,28818 +transformers/generation/streamers.py,sha256=qVM28Z9ELIm4rdI_FsjE2bYzQtvLHLScblTGUoU3SlQ,12970 +transformers/generation/utils.py,sha256=_JgMXODm5F_8ryo3E14Br-ZX35G5nWhK8UUTBghBllI,214388 +transformers/generation/watermarking.py,sha256=rgkr5v3JeYcNOERGB_qyUQAeiKnvCfB0jRvnK53aLws,24565 +transformers/hf_argparser.py,sha256=dJktlWax22pHlUhCaXiAgNuCTGfGvZXpBB_-tWBRfRA,19734 +transformers/hyperparameter_search.py,sha256=kfMEB-nYTBT2stCzMWeAPvsleR7eI7SJKiIJu3jx1gU,3684 +transformers/image_processing_base.py,sha256=8W0m7au0LU6HwSQwWmEcY1YmrPi_fzUtQipKxqYg6I8,22570 +transformers/image_processing_utils.py,sha256=i7QTWl6JD-aPvbJ8gQ0qRLGdwU0W96G4rLLWpJKCPCM,13746 +transformers/image_processing_utils_fast.py,sha256=aPJLHkv60jNaFPKLNqcifYZLfMIKHftb3EDea_Wl8DQ,38000 +transformers/image_transforms.py,sha256=DxKckrVmeF3lIuWQyMwzEfiAA42IKCdMZxS1denkjwQ,43982 +transformers/image_utils.py,sha256=OmaKT_WPfhaF4T30mzaZD3FGsA6UKk_TeEUBQ4hRByA,37242 +transformers/initialization.py,sha256=WJk05fQ-YuotiSP1w4oLkX2MjBN39BbFofFbiXfw7PE,10979 +transformers/integrations/__init__.py,sha256=8lTcGQl2c4M9NzpJrLBxq31g5t9JwTdqcNSoA4ukfRg,9612 +transformers/integrations/__pycache__/__init__.cpython-312.pyc,, +transformers/integrations/__pycache__/accelerate.cpython-312.pyc,, +transformers/integrations/__pycache__/aqlm.cpython-312.pyc,, +transformers/integrations/__pycache__/awq.cpython-312.pyc,, +transformers/integrations/__pycache__/bitnet.cpython-312.pyc,, +transformers/integrations/__pycache__/bitsandbytes.cpython-312.pyc,, +transformers/integrations/__pycache__/deepspeed.cpython-312.pyc,, +transformers/integrations/__pycache__/eager_paged.cpython-312.pyc,, +transformers/integrations/__pycache__/eetq.cpython-312.pyc,, +transformers/integrations/__pycache__/executorch.cpython-312.pyc,, +transformers/integrations/__pycache__/fbgemm_fp8.cpython-312.pyc,, +transformers/integrations/__pycache__/finegrained_fp8.cpython-312.pyc,, +transformers/integrations/__pycache__/flash_attention.cpython-312.pyc,, +transformers/integrations/__pycache__/flash_paged.cpython-312.pyc,, +transformers/integrations/__pycache__/flex_attention.cpython-312.pyc,, +transformers/integrations/__pycache__/fp_quant.cpython-312.pyc,, +transformers/integrations/__pycache__/fsdp.cpython-312.pyc,, +transformers/integrations/__pycache__/ggml.cpython-312.pyc,, +transformers/integrations/__pycache__/higgs.cpython-312.pyc,, +transformers/integrations/__pycache__/hqq.cpython-312.pyc,, +transformers/integrations/__pycache__/hub_kernels.cpython-312.pyc,, +transformers/integrations/__pycache__/integration_utils.cpython-312.pyc,, +transformers/integrations/__pycache__/liger.cpython-312.pyc,, +transformers/integrations/__pycache__/mistral.cpython-312.pyc,, +transformers/integrations/__pycache__/moe.cpython-312.pyc,, +transformers/integrations/__pycache__/mxfp4.cpython-312.pyc,, +transformers/integrations/__pycache__/neftune.cpython-312.pyc,, +transformers/integrations/__pycache__/npu_flash_attention.cpython-312.pyc,, +transformers/integrations/__pycache__/peft.cpython-312.pyc,, +transformers/integrations/__pycache__/quanto.cpython-312.pyc,, +transformers/integrations/__pycache__/quark.cpython-312.pyc,, +transformers/integrations/__pycache__/sdpa_attention.cpython-312.pyc,, +transformers/integrations/__pycache__/sdpa_paged.cpython-312.pyc,, +transformers/integrations/__pycache__/sinq.cpython-312.pyc,, +transformers/integrations/__pycache__/spqr.cpython-312.pyc,, +transformers/integrations/__pycache__/tensor_parallel.cpython-312.pyc,, +transformers/integrations/__pycache__/tiktoken.cpython-312.pyc,, +transformers/integrations/__pycache__/torchao.cpython-312.pyc,, +transformers/integrations/__pycache__/tpu.cpython-312.pyc,, +transformers/integrations/__pycache__/vptq.cpython-312.pyc,, +transformers/integrations/accelerate.py,sha256=ZUYWuXu5YFcDVUDdJXUf0_9T4gWKwlD0wMzGoTzfceY,40368 +transformers/integrations/aqlm.py,sha256=EDEKYoQvw6dF685rU68LtCqv6UuzcydP7rk3Dk7nZIY,3013 +transformers/integrations/awq.py,sha256=YJNs6ZJpE0u8lc70tvUZCZDcw68u83mKYuPE5iry618,4891 +transformers/integrations/bitnet.py,sha256=CPnBKBLOS427NnaISR6YJPnbupmjQ1-9uuvKey-yK0I,14771 +transformers/integrations/bitsandbytes.py,sha256=QvaBP9yi6WFmLWS8P0e7YKNfIh0jtoRS_Nxhp-p7EyY,14469 +transformers/integrations/deepspeed.py,sha256=P9CKmvLZvqYZU9YarIlj_XhkZIVXUnZwlkMhJWLN2A4,31260 +transformers/integrations/eager_paged.py,sha256=HlcqmSZtvwHzyPtWzO0NeDiy66yZRJVnvoD5ZkQOXAE,3334 +transformers/integrations/eetq.py,sha256=x-zrfBIlJkwJwkNMtHlWmXHZwAtjIwkC6TYIz8Vldok,4849 +transformers/integrations/executorch.py,sha256=gp1hOkfFgjuYudIvCeGkxyj3ulia5aMCMy2LQtmkq1w,46116 +transformers/integrations/fbgemm_fp8.py,sha256=0kBij-u186qgeNfDqfXH-ZEZnzp1FRbeEQsEFPtD3Pg,14280 +transformers/integrations/finegrained_fp8.py,sha256=pIZijE8Dq_4pllMgDr0sxXep_1FPo3zHcwMUQHAhB6c,34397 +transformers/integrations/flash_attention.py,sha256=HfEll3ptkLhI0qBp8imhEwo9xcLxpdTyG9LnQY9eDfM,3225 +transformers/integrations/flash_paged.py,sha256=eXhytN8pnAjsBGw6-mueDVG5aWLtrdovv1hdadSg4ck,3581 +transformers/integrations/flex_attention.py,sha256=npRY3utTDWP3KKIy3GmZupgE70S388Oa8trKICCXCy8,13331 +transformers/integrations/fp_quant.py,sha256=YxMIY6w_Gp-uAp7zUmIOMNbTQpe5-WPiEF9c1SFVvFs,5712 +transformers/integrations/fsdp.py,sha256=yd1PIBt4d4LlaoV96JWrYEOc0wivcyHfFjozUc-QZgw,3021 +transformers/integrations/ggml.py,sha256=7plilF9IQ7bSc683OjGolUGwqe5ADhbE9XttnC441y8,30843 +transformers/integrations/higgs.py,sha256=sCuXXEolpskQAMq26cfet8jivD0xo4rabunGux7jVDU,30612 +transformers/integrations/hqq.py,sha256=GeTogGSqPyrgTvTHzxwt5TZhpc1vRj_lb2DdWy5BKkI,5075 +transformers/integrations/hub_kernels.py,sha256=0hmmmgMzIvquU5UCCHSIgeUHPSuO8nmw_DM3qGUELgQ,16705 +transformers/integrations/integration_utils.py,sha256=Yb4p6EYuLanMNDWGi9qLkJ1brzTcKq6bw6bYN5d50hs,106216 +transformers/integrations/liger.py,sha256=zDMJmGnYHUcZxlLIgKOfjg7RavF_nSCM6qvJxD7cZMk,2012 +transformers/integrations/mistral.py,sha256=dIlmD952S101yuAW7xVlDkZkRJzNxRqpjGPprMEZ_ro,4714 +transformers/integrations/moe.py,sha256=H-JZTfaj6HC4fM3yLJtA2bAg-ZqzuQ_KatQ-yhlf-hM,16997 +transformers/integrations/mxfp4.py,sha256=HZv3qngs16kcE4UzH84dj1p3FgJVVXNa8wOvqDZbsRg,25382 +transformers/integrations/neftune.py,sha256=1YyICbg6VsIQEnzdBcj3tLUXozmjBufVHf00DsLEoGQ,4352 +transformers/integrations/npu_flash_attention.py,sha256=5YBiW6jSW1dlYP-0dLfQJ0XFcX5zqLRUS6qRlESf5s4,4189 +transformers/integrations/peft.py,sha256=p1XC68hpVPxT4c6X8oKO0jNbs06b2ApShDi8LpakG6E,47323 +transformers/integrations/quanto.py,sha256=6hTEepeftmrV6M9tmkcp66CZxLgUNo8Ac0gCBqg-XCs,4878 +transformers/integrations/quark.py,sha256=XyOw_pR_3lOkTqSMPW4JWXb2KV2cN5U4i4WOLxL8ayo,2236 +transformers/integrations/sdpa_attention.py,sha256=h_kz0aLYUI31ctpcB0jGskwi_ytiV5aUmVfc2GzFdWQ,4851 +transformers/integrations/sdpa_paged.py,sha256=BBovk8Q4tDw2AQVyUXl4dqXbIyBsLesXXQ5bCWoMdo0,2421 +transformers/integrations/sinq.py,sha256=QHZhvyMzX-2EPpXK7ircYMG0BUd1LQCfDgvfdSrR8Lo,5581 +transformers/integrations/spqr.py,sha256=YPuXOC0FfS5RFYsJ9JbxhAUs3xDKTToMBLvoSxQxKZU,3306 +transformers/integrations/tensor_parallel.py,sha256=sqClN1bh68G9lMpXgRe9-RoX6oVmhaZfi7Ktc5OmXf8,57656 +transformers/integrations/tiktoken.py,sha256=G3tVAsANX0WyvDx4aNKarPB7l9RNhJ1ghvI7i5cp3qQ,1993 +transformers/integrations/torchao.py,sha256=EeSVTEUFaCvQ70uEog85fwjddP9bCXe70uvDji8_zWs,12196 +transformers/integrations/tpu.py,sha256=9mL_kSiV1hSj6RMCzllIO1sI54E-G9omWqxCTOXdP-A,9736 +transformers/integrations/vptq.py,sha256=5VngTj5ip6JdWAFgfXY4YdFsaoRpegGzZd8S5zHheVY,3623 +transformers/loss/__init__.py,sha256=qETsqCwayu6Ymj_J4_A_eiwiaMRHQ0noWKM35naanzc,606 +transformers/loss/__pycache__/__init__.cpython-312.pyc,, +transformers/loss/__pycache__/loss_d_fine.cpython-312.pyc,, +transformers/loss/__pycache__/loss_deformable_detr.cpython-312.pyc,, +transformers/loss/__pycache__/loss_for_object_detection.cpython-312.pyc,, +transformers/loss/__pycache__/loss_grounding_dino.cpython-312.pyc,, +transformers/loss/__pycache__/loss_lw_detr.cpython-312.pyc,, +transformers/loss/__pycache__/loss_rt_detr.cpython-312.pyc,, +transformers/loss/__pycache__/loss_utils.cpython-312.pyc,, +transformers/loss/loss_d_fine.py,sha256=YdS9uLVALctyEBpvI1Zzxv2MxcwvBlSx7qIPfJA4wrA,15466 +transformers/loss/loss_deformable_detr.py,sha256=e9Jc3K5fIygR9xO1kQm1_8FQhVw2GfhkmtaV2SHEbZ0,8134 +transformers/loss/loss_for_object_detection.py,sha256=i68qif_xh3i4nzqMqMoRjRYMPpQb_AMhuXK5UORb9P4,24347 +transformers/loss/loss_grounding_dino.py,sha256=RZZzjQgZPbLi89rq1iBYBhhzDx89orv4hY03NcVe7TA,12003 +transformers/loss/loss_lw_detr.py,sha256=B8CTgSpwwAu2QLM8_538PfgMo8ezBgQ6Vj2MGqhYV2k,15379 +transformers/loss/loss_rt_detr.py,sha256=94p5gMIdF5hTMFeylN-AQ-W5mH6VOo-l_DJvGKP8hsc,21952 +transformers/loss/loss_utils.py,sha256=PfNDjwy4DLe5A9bQb1IoOXVvTKkwGgLXk3SK4JnCfZ8,7061 +transformers/masking_utils.py,sha256=w8gve3tuA9PwS6bGxYo91pEGI2NkUuxn73Dj61Ivn-c,74373 +transformers/model_debugging_utils.py,sha256=4ug0HoBDCE0o9gq10ghjFNrq2k4D0cjGtO30IlDLGEQ,17044 +transformers/modelcard.py,sha256=og6z3rl_xPxx0UbOZQn14joF1MN7AX_JlTYsGMFI9zg,22372 +transformers/modeling_attn_mask_utils.py,sha256=-z7EZjmhn9oeuZM59Od3AzKg9PdbneSrs0oLHuN5g4s,21930 +transformers/modeling_flash_attention_utils.py,sha256=mh-vkAt8w4MrMSJzDKbN303hn8K6yB4Y8h2dBx_wD_Y,31636 +transformers/modeling_gguf_pytorch_utils.py,sha256=SsigKAA9xJJWBEwJcn7v0Lkrh4fWHgevuq-bMdHLf8I,24799 +transformers/modeling_layers.py,sha256=nkcmwHz8iV2V-adbDn0juFYVdQgIEWlecPqHmwoY2uQ,11476 +transformers/modeling_outputs.py,sha256=uyFra5xLPWnydzZ7NxHF80yOQtf5jgo5MKZNEHRl9_A,108678 +transformers/modeling_rope_utils.py,sha256=-mEoj2bOAL8GDToWzI5YrvL5T-NoyWG2hLu0vRn5Cy0,52962 +transformers/modeling_utils.py,sha256=L0XCE5zmM-bj6ukpBnXdWBVkOzfCfyzE3YNYb7ZI97s,247340 +transformers/models/__init__.py,sha256=bEuOkPKwApcJHgdRnxQMXia0gGoaStoOVEzAJ0rBds4,12850 +transformers/models/__pycache__/__init__.cpython-312.pyc,, +transformers/models/afmoe/__init__.py,sha256=6JBjMRMPG1r9Ivg3wbHIKDaEdBKfqmhPYLJOLz2ZCz0,1009 +transformers/models/afmoe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/afmoe/__pycache__/configuration_afmoe.cpython-312.pyc,, +transformers/models/afmoe/__pycache__/modeling_afmoe.cpython-312.pyc,, +transformers/models/afmoe/__pycache__/modular_afmoe.cpython-312.pyc,, +transformers/models/afmoe/configuration_afmoe.py,sha256=R_WB8Hd5WH9K93gLWcHXPyNTry5852dtTin60NFLBkg,10837 +transformers/models/afmoe/modeling_afmoe.py,sha256=aVzrkpuXfeE_707wr4uMjzRmHkTPG8lvojajXWCePPI,30213 +transformers/models/afmoe/modular_afmoe.py,sha256=ErdPG_6Lt89V1wNh_CC7DMOolIlIROh3wgg0IJGSado,18202 +transformers/models/aimv2/__init__.py,sha256=cDli19QT_YABtn4DPLYfoWHtkmOQYGipAgPKGuRje4c,991 +transformers/models/aimv2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/aimv2/__pycache__/configuration_aimv2.cpython-312.pyc,, +transformers/models/aimv2/__pycache__/modeling_aimv2.cpython-312.pyc,, +transformers/models/aimv2/__pycache__/modular_aimv2.cpython-312.pyc,, +transformers/models/aimv2/configuration_aimv2.py,sha256=fu3f4349RxTIZcDSCOBc5TfzInbgaeyeh2n4wGc9mVM,13520 +transformers/models/aimv2/modeling_aimv2.py,sha256=uatT1mdp5dAAKO82CnHaO2LcM-4sOo1oZeH8DNsyjj0,29242 +transformers/models/aimv2/modular_aimv2.py,sha256=5K1Rud3H2YJYML3rm_zb3RXnZdMu2bqyBCM1ak5AXU8,28257 +transformers/models/albert/__init__.py,sha256=hxvpETbDcdrI03UPZb4pTpVbADWISlvpVvoMw-x67mY,1032 +transformers/models/albert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/albert/__pycache__/configuration_albert.cpython-312.pyc,, +transformers/models/albert/__pycache__/modeling_albert.cpython-312.pyc,, +transformers/models/albert/__pycache__/tokenization_albert.cpython-312.pyc,, +transformers/models/albert/configuration_albert.py,sha256=L9xH9yGFEQfZs5vd6swOIcbQ6YlZY5QgQcZzOgqtxuw,6845 +transformers/models/albert/modeling_albert.py,sha256=ecze7TR0M32wX33HV9mjyApM8kZKdZUP3YaxqufFnec,38577 +transformers/models/albert/tokenization_albert.py,sha256=_V2aLl8NT0jldwOocNmjC4G9svDD7UVN6B5Z6ZbfJo8,7737 +transformers/models/align/__init__.py,sha256=QqTKk-Z4BylY6EkBSlYvKXVhT2te-m2Al626OUAz-r4,1027 +transformers/models/align/__pycache__/__init__.cpython-312.pyc,, +transformers/models/align/__pycache__/configuration_align.cpython-312.pyc,, +transformers/models/align/__pycache__/modeling_align.cpython-312.pyc,, +transformers/models/align/__pycache__/processing_align.cpython-312.pyc,, +transformers/models/align/configuration_align.py,sha256=RpkRggefCJgUdhophYdbMEsEFpcbKY4uL2_xvOs3Yq8,15449 +transformers/models/align/modeling_align.py,sha256=eaG1YnpKF_SyilYXDLiu3b7QAC_qhar-1cqp3uno0q0,48828 +transformers/models/align/processing_align.py,sha256=oUDbKwqG-ts86VV2V5tY0PbIfGIW1hiBwnkU1j8ljPg,1237 +transformers/models/altclip/__init__.py,sha256=405IijUCYr1EGvOqg1xzds_GHOlxCl0HCsf1rI0wtPY,1033 +transformers/models/altclip/__pycache__/__init__.cpython-312.pyc,, +transformers/models/altclip/__pycache__/configuration_altclip.cpython-312.pyc,, +transformers/models/altclip/__pycache__/modeling_altclip.cpython-312.pyc,, +transformers/models/altclip/__pycache__/processing_altclip.cpython-312.pyc,, +transformers/models/altclip/configuration_altclip.py,sha256=0Z9gcS6LNWjbOszuJpIcEfqHOrbSsgIyDnw1v-WD-Bg,17672 +transformers/models/altclip/modeling_altclip.py,sha256=jIzihduJ2rdOvin0xur0xSNZpf5gO8kwT5b_SJhRsvo,54918 +transformers/models/altclip/processing_altclip.py,sha256=tyodo5ptS2sggwrFhAJMWjlia7qrYPNDDeJc4y5mnaY,1000 +transformers/models/apertus/__init__.py,sha256=GthOdmsWx7l04JZ0ucrJtn6ayZzaHRgujOMGUbGdtvY,1256 +transformers/models/apertus/__pycache__/__init__.cpython-312.pyc,, +transformers/models/apertus/__pycache__/configuration_apertus.cpython-312.pyc,, +transformers/models/apertus/__pycache__/modeling_apertus.cpython-312.pyc,, +transformers/models/apertus/__pycache__/modular_apertus.cpython-312.pyc,, +transformers/models/apertus/configuration_apertus.py,sha256=qapcgBFi-vqzRRMokaDtCHTGTO-_AvZXJexh9ptu-yc,8760 +transformers/models/apertus/modeling_apertus.py,sha256=Yr5tn33QNKzXVvOi4JL4-bHFf5uzgl_ActtaLLkDkg4,22418 +transformers/models/apertus/modular_apertus.py,sha256=r-5q8vTALPEHb2ajcsVbn5VXrddcut3xpN-vsbIiWXk,14481 +transformers/models/arcee/__init__.py,sha256=bysIumYEa1Z1bCLBaaP_SCT_6poh8zFLgxt_4Ib-Diw,1009 +transformers/models/arcee/__pycache__/__init__.cpython-312.pyc,, +transformers/models/arcee/__pycache__/configuration_arcee.cpython-312.pyc,, +transformers/models/arcee/__pycache__/modeling_arcee.cpython-312.pyc,, +transformers/models/arcee/__pycache__/modular_arcee.cpython-312.pyc,, +transformers/models/arcee/configuration_arcee.py,sha256=BXeNnUPiVGECUaqWBvQC-bgtrre3JgqRRPum8SIs02I,9096 +transformers/models/arcee/modeling_arcee.py,sha256=XldHBXyg6vNOG5PWxPaFM2j0oG0oPVHkn6W3uC7sGdE,22366 +transformers/models/arcee/modular_arcee.py,sha256=qtSWZn0NfcbQ1o9smgIRwelbl3Fvy8RwRRXatbk3kYA,8866 +transformers/models/aria/__init__.py,sha256=I3vYPjV-sDl0OAILLADGZ7hUkk9ZsmyZ8CEf9tie_dY,1066 +transformers/models/aria/__pycache__/__init__.cpython-312.pyc,, +transformers/models/aria/__pycache__/configuration_aria.cpython-312.pyc,, +transformers/models/aria/__pycache__/image_processing_aria.cpython-312.pyc,, +transformers/models/aria/__pycache__/modeling_aria.cpython-312.pyc,, +transformers/models/aria/__pycache__/modular_aria.cpython-312.pyc,, +transformers/models/aria/__pycache__/processing_aria.cpython-312.pyc,, +transformers/models/aria/configuration_aria.py,sha256=kOiIT6xFVGz1WoB08Z8iNGljukzQMYE8JDMo96I29l0,13316 +transformers/models/aria/image_processing_aria.py,sha256=5WlAr7abi7u95Da30xs-tjx_3y1hA_VJ99XnX4F61dc,24588 +transformers/models/aria/modeling_aria.py,sha256=_JFipCufAwsLdJw0m6ropxuOM1i-WvGuBcL4Hk_BvPo,51338 +transformers/models/aria/modular_aria.py,sha256=2IyEOFWBpWxjJI5hHRKoncmcOUSkmL3Ea9zzwT4dkmk,66124 +transformers/models/aria/processing_aria.py,sha256=AGOLyF1eGFtFIjElzx1RCWjC9dpQhJIGv-rhv7K126Q,8925 +transformers/models/audio_spectrogram_transformer/__init__.py,sha256=a_YVwB1p4_PPeqPFWqFsGSGSQVTaSUXY0xsOd_Gflqs,1107 +transformers/models/audio_spectrogram_transformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/audio_spectrogram_transformer/__pycache__/configuration_audio_spectrogram_transformer.cpython-312.pyc,, +transformers/models/audio_spectrogram_transformer/__pycache__/feature_extraction_audio_spectrogram_transformer.cpython-312.pyc,, +transformers/models/audio_spectrogram_transformer/__pycache__/modeling_audio_spectrogram_transformer.cpython-312.pyc,, +transformers/models/audio_spectrogram_transformer/configuration_audio_spectrogram_transformer.py,sha256=IfR4TKKLVsbGAI56k7xe9stuB2w_jYAKnA1oLCm640g,5886 +transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py,sha256=q0lXdJtREwZ0E9zWYtwhKVK5phDSl-i0UV4sqx_x_OQ,9795 +transformers/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.py,sha256=yuwxkI3eIP7X00Fylqzd05Ivx54I0sZtrgWd0tiEOmY,17947 +transformers/models/audioflamingo3/__init__.py,sha256=IIl7s3NZKsVHtQapt7nCGPMbZ2OhlGsgUe8MPeeKgDE,1085 +transformers/models/audioflamingo3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/audioflamingo3/__pycache__/configuration_audioflamingo3.cpython-312.pyc,, +transformers/models/audioflamingo3/__pycache__/modeling_audioflamingo3.cpython-312.pyc,, +transformers/models/audioflamingo3/__pycache__/modular_audioflamingo3.cpython-312.pyc,, +transformers/models/audioflamingo3/__pycache__/processing_audioflamingo3.cpython-312.pyc,, +transformers/models/audioflamingo3/configuration_audioflamingo3.py,sha256=O7ZSXZdZsJwFPCR3LbMoHw0G-lTpkAJsjRlnzXHLRf8,8983 +transformers/models/audioflamingo3/modeling_audioflamingo3.py,sha256=KNM65JoU0bcZDnlJyj0jtA6lmhLwBTvhq1V2mPLr_fo,26531 +transformers/models/audioflamingo3/modular_audioflamingo3.py,sha256=zFTk7VGWrL6fdU68LOn4jFORXQHq-XO2MbDLUJnDE-0,13080 +transformers/models/audioflamingo3/processing_audioflamingo3.py,sha256=2jKhVlQL2hU7HfDdSxzNZdZbHrL_J_b1cD3ZYIL07fI,13547 +transformers/models/auto/__init__.py,sha256=X1F9TGTiKC60ZRJwdrKDzp1SRadfScfXpM5VqoUrk6M,1218 +transformers/models/auto/__pycache__/__init__.cpython-312.pyc,, +transformers/models/auto/__pycache__/auto_factory.cpython-312.pyc,, +transformers/models/auto/__pycache__/configuration_auto.cpython-312.pyc,, +transformers/models/auto/__pycache__/feature_extraction_auto.cpython-312.pyc,, +transformers/models/auto/__pycache__/image_processing_auto.cpython-312.pyc,, +transformers/models/auto/__pycache__/modeling_auto.cpython-312.pyc,, +transformers/models/auto/__pycache__/processing_auto.cpython-312.pyc,, +transformers/models/auto/__pycache__/tokenization_auto.cpython-312.pyc,, +transformers/models/auto/__pycache__/video_processing_auto.cpython-312.pyc,, +transformers/models/auto/auto_factory.py,sha256=rtd3Vpmt3fhhEVDxf7kRk5dMb3vSeCbv-mJ_-Kul3uM,31452 +transformers/models/auto/configuration_auto.py,sha256=ZPsmydgNTXpK9rrfzIeiViLlfCaSahwLd_wXPr00-QM,59217 +transformers/models/auto/feature_extraction_auto.py,sha256=FdGGGgx9rV7ei7RnNS-sEouN2Ln8DkkDsiQPJ9YCc34,19011 +transformers/models/auto/image_processing_auto.py,sha256=ODBpJNJEClAVHnxePfx46TKG8PXYI9c2OwZt9b4bsW8,39398 +transformers/models/auto/modeling_auto.py,sha256=9i-ApVMrkgesmyd6yWijA7LPJ5m4Yn9G9Yr9es2SIBo,93901 +transformers/models/auto/processing_auto.py,sha256=EVuASKiBV2XEjge_B4ieMg41mtfz6uu_vQZPW4j5wvQ,21113 +transformers/models/auto/tokenization_auto.py,sha256=-g_O9_Nlof9va17G-T5lo3mngAkG0nr80B-B-LJ404M,42673 +transformers/models/auto/video_processing_auto.py,sha256=P5jtPXHiElgOExSOEiIIyv_0I-wlvaRnsMioVXWvDmo,20464 +transformers/models/autoformer/__init__.py,sha256=EzGIA8hECx9XytdzTifaGyGp7hrXqlyP0slqAq8xBNY,1001 +transformers/models/autoformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/autoformer/__pycache__/configuration_autoformer.cpython-312.pyc,, +transformers/models/autoformer/__pycache__/modeling_autoformer.cpython-312.pyc,, +transformers/models/autoformer/configuration_autoformer.py,sha256=vPBNEtegp9l-AbyUVGRQ3W1MA9M3d-p0uqJ9J1OLogg,12136 +transformers/models/autoformer/modeling_autoformer.py,sha256=0eVKO1E4LV8uvIJBdzfAJTgVRIcA-P66LO40LWCOc5Y,98591 +transformers/models/aya_vision/__init__.py,sha256=-DIHmMjkXOyNGbMtZJkHtLiOzdxOYSrKq4_mmR09cfk,1042 +transformers/models/aya_vision/__pycache__/__init__.cpython-312.pyc,, +transformers/models/aya_vision/__pycache__/configuration_aya_vision.cpython-312.pyc,, +transformers/models/aya_vision/__pycache__/modeling_aya_vision.cpython-312.pyc,, +transformers/models/aya_vision/__pycache__/modular_aya_vision.cpython-312.pyc,, +transformers/models/aya_vision/__pycache__/processing_aya_vision.cpython-312.pyc,, +transformers/models/aya_vision/configuration_aya_vision.py,sha256=V1zZH5qzEeMkQYcBzLToin17G4kWFv-QuXx4wRx_1IE,4980 +transformers/models/aya_vision/modeling_aya_vision.py,sha256=XtTbLRwdQgtIGSxjiIh0hpssfjuXYzlGHp5XZ9wF5mo,20578 +transformers/models/aya_vision/modular_aya_vision.py,sha256=WB_8An06s3oaXV7nS8xnqyt2mNRdbdEQk_Bk7LPobSM,11385 +transformers/models/aya_vision/processing_aya_vision.py,sha256=PjgsEdgLifbSsIgIrQSh5pxZfTVDFItpzQjyau44rP4,9272 +transformers/models/bamba/__init__.py,sha256=gtebRUrAdiwq-rJmlM5qpbtbGEg-xxA3pjivOHJvaRs,1040 +transformers/models/bamba/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bamba/__pycache__/configuration_bamba.cpython-312.pyc,, +transformers/models/bamba/__pycache__/modeling_bamba.cpython-312.pyc,, +transformers/models/bamba/__pycache__/modular_bamba.cpython-312.pyc,, +transformers/models/bamba/configuration_bamba.py,sha256=QKjEmyJI_91RgKvJ32TuEbd4jFeMGO57UUGjs5NvLNE,11683 +transformers/models/bamba/modeling_bamba.py,sha256=WOT_a2K9ZaDT2IwM_UwdsvzqFhWGNvLnLpzbSuGTzHU,64245 +transformers/models/bamba/modular_bamba.py,sha256=zD9x8OWUKs9Kjwk1qf_potJFeZHddfwetSQbGVf0Zw4,47696 +transformers/models/bark/__init__.py,sha256=fIlOQ6RPBARVhUKdjNx2Nvf09azEI6AiPv3lyWjk0Gc,1024 +transformers/models/bark/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bark/__pycache__/configuration_bark.cpython-312.pyc,, +transformers/models/bark/__pycache__/generation_configuration_bark.cpython-312.pyc,, +transformers/models/bark/__pycache__/modeling_bark.cpython-312.pyc,, +transformers/models/bark/__pycache__/processing_bark.cpython-312.pyc,, +transformers/models/bark/configuration_bark.py,sha256=e2uR82rAtFLU53kS_zRc75y358yXawOthHIa2zXRI-g,11627 +transformers/models/bark/generation_configuration_bark.py,sha256=_aItFYGQo7FpoRIhWqeyleIlazrOhCBnF4HYq5AViCg,14890 +transformers/models/bark/modeling_bark.py,sha256=5eZMQ8WLTHsRHEaqClTWOUCcmlgULNyMsVGVX7Po15A,66893 +transformers/models/bark/processing_bark.py,sha256=S248G60IBsCzKoC8X4XXDK7oYshMaOEY-S192rsHfa4,14097 +transformers/models/bart/__init__.py,sha256=S_TylapQzJgRn1IAHgBjIlpDKOUiRDrWXvXbf-72BQc,1070 +transformers/models/bart/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bart/__pycache__/configuration_bart.cpython-312.pyc,, +transformers/models/bart/__pycache__/modeling_bart.cpython-312.pyc,, +transformers/models/bart/__pycache__/tokenization_bart.cpython-312.pyc,, +transformers/models/bart/configuration_bart.py,sha256=0I4w_MSdSVIhHB4JRa0hFP9vwijAHq7zNF2KJtjByQk,7621 +transformers/models/bart/modeling_bart.py,sha256=SCkYieva6cY-pLQwq8MTdey0mNJbIvt-tOkfpqE6rlo,71286 +transformers/models/bart/tokenization_bart.py,sha256=DnPB-2ksaq1XKX-4IC6iQ-B5fPUsErQVrDPn_4R7X8A,827 +transformers/models/barthez/__init__.py,sha256=LJe6JwskLg0PCFB6QkvMYXdiQ8ofaLI5NrfeQD0NHGE,958 +transformers/models/barthez/__pycache__/__init__.cpython-312.pyc,, +transformers/models/barthez/__pycache__/tokenization_barthez.cpython-312.pyc,, +transformers/models/barthez/tokenization_barthez.py,sha256=SJ-XLtE6H58H5zU5oJWvtiigDaJs6Uzc9B-5VUIpYIA,6111 +transformers/models/bartpho/__init__.py,sha256=DN0zgU4dM841Kqqo6wN8FpWFeWYHCBxIq3lxrg5vUoU,958 +transformers/models/bartpho/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bartpho/__pycache__/tokenization_bartpho.cpython-312.pyc,, +transformers/models/bartpho/tokenization_bartpho.py,sha256=K6XSQKIJPKdkwmLtnmXzFHfpo-vzamVIYx_nKfHL70c,14255 +transformers/models/beit/__init__.py,sha256=hvsrXPo9G4bktKW3Re5u3DZaDp8GU57HYNKL2firnPg,1119 +transformers/models/beit/__pycache__/__init__.cpython-312.pyc,, +transformers/models/beit/__pycache__/configuration_beit.cpython-312.pyc,, +transformers/models/beit/__pycache__/image_processing_beit.cpython-312.pyc,, +transformers/models/beit/__pycache__/image_processing_beit_fast.cpython-312.pyc,, +transformers/models/beit/__pycache__/modeling_beit.cpython-312.pyc,, +transformers/models/beit/configuration_beit.py,sha256=_6hz8q5d_ajIG0TiwwUvqVAXNj2L4i9_g2GXUc-DmQc,10576 +transformers/models/beit/image_processing_beit.py,sha256=zW704TiUqjLqNYHq87MBwz4eCkX7yYysZ72iDIYPQcQ,23997 +transformers/models/beit/image_processing_beit_fast.py,sha256=otP57DKidDrRyK2qgKWUaAOMWTgCwjZx1l8WNUgmzgM,8257 +transformers/models/beit/modeling_beit.py,sha256=G0s9pJaOw-8ZMz0wM5fQnCVtvz6M82NsBmxqi457NHs,59754 +transformers/models/bert/__init__.py,sha256=8wed5_ySi76CWDslJ4BoPdgV2Yg_TJ0vJjlDgbNKUMo,1026 +transformers/models/bert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bert/__pycache__/configuration_bert.cpython-312.pyc,, +transformers/models/bert/__pycache__/modeling_bert.cpython-312.pyc,, +transformers/models/bert/__pycache__/tokenization_bert.cpython-312.pyc,, +transformers/models/bert/__pycache__/tokenization_bert_legacy.cpython-312.pyc,, +transformers/models/bert/configuration_bert.py,sha256=O2VLcScpCItezBFvTxUlFUSQ7rPs_2zvW3Lgkw_yKOI,6247 +transformers/models/bert/modeling_bert.py,sha256=hB1KEzsN3UN_ZdKu0RVLJGx17yP4tCDZSoOHf71b64o,57159 +transformers/models/bert/tokenization_bert.py,sha256=u4k0PDH2cfbIAsTlaBEt7fuI_UmKZFeqjGfkFqKNgvs,6077 +transformers/models/bert/tokenization_bert_legacy.py,sha256=ReTGY8HTxwQSPRvp0Q_9EQCmMtXn-RERINT8f7xNin4,19727 +transformers/models/bert_generation/__init__.py,sha256=sLEyyFf2yI6QflP1lTI9LXUF5PvWBvu-fsaFbjund5I,1059 +transformers/models/bert_generation/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bert_generation/__pycache__/configuration_bert_generation.cpython-312.pyc,, +transformers/models/bert_generation/__pycache__/modeling_bert_generation.cpython-312.pyc,, +transformers/models/bert_generation/__pycache__/tokenization_bert_generation.cpython-312.pyc,, +transformers/models/bert_generation/configuration_bert_generation.py,sha256=KXVF97Hzie-ke6bPOwBmaRRMNw3nUuLQkhCbpgcI05k,6384 +transformers/models/bert_generation/modeling_bert_generation.py,sha256=3vLNnsneu9wDePObaaaw0j983ZqO2ek_3WF7XLiX9wM,30717 +transformers/models/bert_generation/tokenization_bert_generation.py,sha256=y8DaWI_h6ETCn27QThQ2ciu2V4JKgEsaXUNgC0QNlNQ,4342 +transformers/models/bert_japanese/__init__.py,sha256=94xfgVPnIQuHQxvmc55_EedJlJQTnHiL4va6Ry6x3LE,964 +transformers/models/bert_japanese/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bert_japanese/__pycache__/tokenization_bert_japanese.cpython-312.pyc,, +transformers/models/bert_japanese/tokenization_bert_japanese.py,sha256=jkBjaGI_BaR33MlOniWhh1PSt3vehied8hXRbS4mYEo,35322 +transformers/models/bertweet/__init__.py,sha256=EZegs0rWTTCiOC_eY-M8eV7bCcwU60dB0HsM1S1VDzQ,959 +transformers/models/bertweet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bertweet/__pycache__/tokenization_bertweet.cpython-312.pyc,, +transformers/models/bertweet/tokenization_bertweet.py,sha256=2wVAfZKa_0vdlUG-CCVxygWZxrCKS6PAhKJrJqPWJXs,24387 +transformers/models/big_bird/__init__.py,sha256=VAC27mMypSm_-3AEQ179PtQF1Dpq4XNnhs29j6n5KyU,1038 +transformers/models/big_bird/__pycache__/__init__.cpython-312.pyc,, +transformers/models/big_bird/__pycache__/configuration_big_bird.cpython-312.pyc,, +transformers/models/big_bird/__pycache__/modeling_big_bird.cpython-312.pyc,, +transformers/models/big_bird/__pycache__/tokenization_big_bird.cpython-312.pyc,, +transformers/models/big_bird/configuration_big_bird.py,sha256=912eTArz_9yfyO4bBtFyHfTJZKyOFsCFyo_CQQkAX3I,7528 +transformers/models/big_bird/modeling_big_bird.py,sha256=L5l-CVqDLhUCW8SnGyNP5s3ZZRcta0P6BEI16ZbX9uw,119417 +transformers/models/big_bird/tokenization_big_bird.py,sha256=mTVWymvsL_HJ0UYDkF99iVcC_aY4HH2Kku2MJ8u1Mys,7521 +transformers/models/bigbird_pegasus/__init__.py,sha256=7zOl1EhO8W2S9jE0FsyEoW8kV6yn5bLA0dspGFM1mLQ,1011 +transformers/models/bigbird_pegasus/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bigbird_pegasus/__pycache__/configuration_bigbird_pegasus.cpython-312.pyc,, +transformers/models/bigbird_pegasus/__pycache__/modeling_bigbird_pegasus.cpython-312.pyc,, +transformers/models/bigbird_pegasus/configuration_bigbird_pegasus.py,sha256=WnvUs5jElreefBeCvbss1oiLJxtjWD3UVaO2gRLzWs4,8700 +transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py,sha256=4zpvmSImH1vz5Khc7e2MK_0jeZaP8w8fiwW7aQep9pQ,125526 +transformers/models/biogpt/__init__.py,sha256=pZxVjmVzt7FXlkMO_5fMg01eyPvvHYXmDA33MKhp6Yk,1032 +transformers/models/biogpt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/biogpt/__pycache__/configuration_biogpt.cpython-312.pyc,, +transformers/models/biogpt/__pycache__/modeling_biogpt.cpython-312.pyc,, +transformers/models/biogpt/__pycache__/modular_biogpt.cpython-312.pyc,, +transformers/models/biogpt/__pycache__/tokenization_biogpt.cpython-312.pyc,, +transformers/models/biogpt/configuration_biogpt.py,sha256=437iAIL_5evhRIP3siKaVOamCeliBrnta1ZpEHasD4Q,6446 +transformers/models/biogpt/modeling_biogpt.py,sha256=E_xUsseRMDYhl9jv2tJEN7uvtnKVn0ld3JpGC74Vu04,33951 +transformers/models/biogpt/modular_biogpt.py,sha256=ErcsPOA-bTShFi00z-tnzHr2y8cYxFErjRhaekWmBEs,25503 +transformers/models/biogpt/tokenization_biogpt.py,sha256=Tg8IQ6ZhPb7eT_sdrLJBgPb2t0cNQ12Hb70yNjUnXIc,12106 +transformers/models/bit/__init__.py,sha256=I9z2RYsPRokD1ycMBRLaesbyMKK4MwLPM5oTles2KmQ,1072 +transformers/models/bit/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bit/__pycache__/configuration_bit.cpython-312.pyc,, +transformers/models/bit/__pycache__/image_processing_bit.cpython-312.pyc,, +transformers/models/bit/__pycache__/image_processing_bit_fast.cpython-312.pyc,, +transformers/models/bit/__pycache__/modeling_bit.cpython-312.pyc,, +transformers/models/bit/configuration_bit.py,sha256=yMlWggmw_iyHiluWsk8SKKlS3kFP-NY8bkyVfKitEJY,6135 +transformers/models/bit/image_processing_bit.py,sha256=QLuBmOegutiWk5nw-gL8XcpBMdwxSHhWz8jR8YtA8aU,15514 +transformers/models/bit/image_processing_bit_fast.py,sha256=3x8ALWaCWTzU2lWyWY6wZHrB5PsbUADef4jj86RXYWg,1312 +transformers/models/bit/modeling_bit.py,sha256=DhkM2rv5De1e2I-dw478m3t8YbHSdfsAD0WBS7Oevm0,28311 +transformers/models/bitnet/__init__.py,sha256=0u3B40Xd6dJ7J7TBxJzSQWcyUe2ZWJTbT6iaWVod_-A,1018 +transformers/models/bitnet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bitnet/__pycache__/configuration_bitnet.cpython-312.pyc,, +transformers/models/bitnet/__pycache__/modeling_bitnet.cpython-312.pyc,, +transformers/models/bitnet/__pycache__/modular_bitnet.cpython-312.pyc,, +transformers/models/bitnet/configuration_bitnet.py,sha256=aomquZ_YEd01JMTSYhWysjOZRAKxZNlHCaaObCVNxhA,7226 +transformers/models/bitnet/modeling_bitnet.py,sha256=MivRw5d3NMYkixwHuEt6uPKgBj08jo-madsJE9-Wxf4,22532 +transformers/models/bitnet/modular_bitnet.py,sha256=EeBTeac0b1_FCqyY7FCxWS-uE7z0Uetg6kX5EUm8DFc,5672 +transformers/models/blenderbot/__init__.py,sha256=jU3e_DqjuRka882xLbvHUibBwY6ODhrBxmwP08UiLFg,1044 +transformers/models/blenderbot/__pycache__/__init__.cpython-312.pyc,, +transformers/models/blenderbot/__pycache__/configuration_blenderbot.cpython-312.pyc,, +transformers/models/blenderbot/__pycache__/modeling_blenderbot.cpython-312.pyc,, +transformers/models/blenderbot/__pycache__/tokenization_blenderbot.cpython-312.pyc,, +transformers/models/blenderbot/configuration_blenderbot.py,sha256=TF7uKn1n0vzN0Jvp6VNsWkHX154JH0_dVSW04Qh-bZQ,7696 +transformers/models/blenderbot/modeling_blenderbot.py,sha256=J3CGxukzLP184Xb4Z1pQQkrzYdiWsH4A4X8lVl1O6Ng,55518 +transformers/models/blenderbot/tokenization_blenderbot.py,sha256=qYgtJl1RDovPkFkQpEgAW-1uDWEM8mOvERqrt2TghO0,7161 +transformers/models/blenderbot_small/__init__.py,sha256=d6Zj-S0-76DHKXAjwOdnyU3j2rtUDyktiXP_y0It9l8,1116 +transformers/models/blenderbot_small/__pycache__/__init__.cpython-312.pyc,, +transformers/models/blenderbot_small/__pycache__/configuration_blenderbot_small.cpython-312.pyc,, +transformers/models/blenderbot_small/__pycache__/modeling_blenderbot_small.cpython-312.pyc,, +transformers/models/blenderbot_small/__pycache__/tokenization_blenderbot_small.cpython-312.pyc,, +transformers/models/blenderbot_small/configuration_blenderbot_small.py,sha256=FwHUPU5X8Aiv4uhYqHKb-kRPh-FJXQxVKWrM2ajAocc,7678 +transformers/models/blenderbot_small/modeling_blenderbot_small.py,sha256=DPqqYRusqyob33sWmH9zB1WUHEbLEJEgqy4i9cMq-Ow,55448 +transformers/models/blenderbot_small/tokenization_blenderbot_small.py,sha256=R7MeZBgkSaOAXd7_TDdk4sOBIibYrzN4xElF8y4GS-Q,7944 +transformers/models/blip/__init__.py,sha256=iYvgOjk8ISposmsmPNG-IGUNrR7sZqTT4vCfHUnCLSU,1149 +transformers/models/blip/__pycache__/__init__.cpython-312.pyc,, +transformers/models/blip/__pycache__/configuration_blip.cpython-312.pyc,, +transformers/models/blip/__pycache__/image_processing_blip.cpython-312.pyc,, +transformers/models/blip/__pycache__/image_processing_blip_fast.cpython-312.pyc,, +transformers/models/blip/__pycache__/modeling_blip.cpython-312.pyc,, +transformers/models/blip/__pycache__/modeling_blip_text.cpython-312.pyc,, +transformers/models/blip/__pycache__/processing_blip.cpython-312.pyc,, +transformers/models/blip/configuration_blip.py,sha256=HAgvNcQFCDnvtfX2QztbayBZygmNoz-ytekdVbhZ2gE,14730 +transformers/models/blip/image_processing_blip.py,sha256=Dd3ztTtUth1VHlYAjNGQNp1nV7j5AFfrK9J7DUv3boE,14916 +transformers/models/blip/image_processing_blip_fast.py,sha256=Cu42tOg3ZoBqdoum_7QMkVWXiMTcmMdDtuhGaIpkmKQ,1297 +transformers/models/blip/modeling_blip.py,sha256=uiz9vcOSUo6wj-BUDC7hg_Rfp7RFNeuknB-vBY6cTpc,51460 +transformers/models/blip/modeling_blip_text.py,sha256=W5IDX8dKK0Va7bgUK1ichF8IuZYt5dLXcirYCzBLkBk,39467 +transformers/models/blip/processing_blip.py,sha256=iCW3H4cK8hcVldAymMFxx-chGII87LEngs95uNEuHHw,3061 +transformers/models/blip_2/__init__.py,sha256=kj_6H0rQ7dLoQk-COIb06LlDRnbORu3GLU3m4EdMkAM,1030 +transformers/models/blip_2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/blip_2/__pycache__/configuration_blip_2.cpython-312.pyc,, +transformers/models/blip_2/__pycache__/modeling_blip_2.cpython-312.pyc,, +transformers/models/blip_2/__pycache__/processing_blip_2.cpython-312.pyc,, +transformers/models/blip_2/configuration_blip_2.py,sha256=iSKUbMgRX8j_Gx4EZOBSnNS3-j12HWlfGJzQCfdnXr4,14650 +transformers/models/blip_2/modeling_blip_2.py,sha256=PiO0Ovg-ryxf94StqYAjLgjMhD54waPQ3CGNfRYf188,87838 +transformers/models/blip_2/processing_blip_2.py,sha256=5VOE__t-z0fuNCxpKcDJXOH8bqpKACIsCMwvADd856Q,4813 +transformers/models/bloom/__init__.py,sha256=hVsmMQEVK2LVTQd_zlExF9SJjdMLX7pjgFVP6lKg2IY,1029 +transformers/models/bloom/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bloom/__pycache__/configuration_bloom.cpython-312.pyc,, +transformers/models/bloom/__pycache__/modeling_bloom.cpython-312.pyc,, +transformers/models/bloom/configuration_bloom.py,sha256=CiD2g-DUaCY0lSbJijDPBe5XDVxBn5x9r_BaFdz-q-s,6436 +transformers/models/bloom/modeling_bloom.py,sha256=LJqXF-MDphHB47dBzCqB_IFb7rRHTb_zzB1uiW0hBCU,42217 +transformers/models/blt/__init__.py,sha256=Eg5lWtgdEQ8Yld6WH0R7-x3R6hnVQJFqUMEuAooZOyo,1023 +transformers/models/blt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/blt/__pycache__/configuration_blt.cpython-312.pyc,, +transformers/models/blt/__pycache__/modeling_blt.cpython-312.pyc,, +transformers/models/blt/__pycache__/modular_blt.cpython-312.pyc,, +transformers/models/blt/configuration_blt.py,sha256=vkIQI0QAqf6ap8u-F6SImACH-EL_g0rCor36OTpyFEc,19735 +transformers/models/blt/modeling_blt.py,sha256=3sRuBuZ1j9jG1gGAHvAxORw-JzCFw4dJJZ7WHEGsY18,64769 +transformers/models/blt/modular_blt.py,sha256=IabL5bPUTta9RTtbYqcIQMJxNPqTaMdczaMcaYlYt-M,51161 +transformers/models/bridgetower/__init__.py,sha256=S9u22GAHi1LVcS3OYGBzfBVTjDvk_WU9JZGPTEo6zxw,1146 +transformers/models/bridgetower/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bridgetower/__pycache__/configuration_bridgetower.cpython-312.pyc,, +transformers/models/bridgetower/__pycache__/image_processing_bridgetower.cpython-312.pyc,, +transformers/models/bridgetower/__pycache__/image_processing_bridgetower_fast.cpython-312.pyc,, +transformers/models/bridgetower/__pycache__/modeling_bridgetower.cpython-312.pyc,, +transformers/models/bridgetower/__pycache__/processing_bridgetower.cpython-312.pyc,, +transformers/models/bridgetower/configuration_bridgetower.py,sha256=H0eyJOMhM-ES-Kr7zi8iUUtuVc7_wckk7somKfpmYFU,14058 +transformers/models/bridgetower/image_processing_bridgetower.py,sha256=q8BAajTkrcg06znbJdpZqplTNfYNVplunx61ddXxYDw,25812 +transformers/models/bridgetower/image_processing_bridgetower_fast.py,sha256=fMj7j_APJxVQn9i94WDNdXjmIupl8THc5YNzRPByCwM,9583 +transformers/models/bridgetower/modeling_bridgetower.py,sha256=f7fK6P_eqINeBxjzrr-O_Fi5pbF-49KvgriXBcJWd8w,81821 +transformers/models/bridgetower/processing_bridgetower.py,sha256=pPLA_1cSpsz5S6BfddtG4JSdJdN4pWlP89mksXfGRsQ,1617 +transformers/models/bros/__init__.py,sha256=wT0avJ_J50-WK6jOB-6UbgN5kjHiBwG-NNT_iefMXr8,1024 +transformers/models/bros/__pycache__/__init__.cpython-312.pyc,, +transformers/models/bros/__pycache__/configuration_bros.cpython-312.pyc,, +transformers/models/bros/__pycache__/modeling_bros.cpython-312.pyc,, +transformers/models/bros/__pycache__/processing_bros.cpython-312.pyc,, +transformers/models/bros/configuration_bros.py,sha256=5h7Oj__BF7DKA4acy3drVutbpV-uYoIpkb6rpMyePT0,6872 +transformers/models/bros/modeling_bros.py,sha256=Tdqk_alf8Slkws7GJXRF_U6phfs630NQJ1pgH8rc0yQ,44196 +transformers/models/bros/processing_bros.py,sha256=dUxWojDc6X766HgXqRFZxb7PeJ8q_sKs1krsZSPhyWw,1467 +transformers/models/byt5/__init__.py,sha256=O7yXvHyqMZ7stkKX67knnddmJ81pPHoKrY_7NCAauU4,955 +transformers/models/byt5/__pycache__/__init__.cpython-312.pyc,, +transformers/models/byt5/__pycache__/tokenization_byt5.cpython-312.pyc,, +transformers/models/byt5/tokenization_byt5.py,sha256=hAt4Eic6Hgb8HBKwDq_Tg1MZmWhRtgYXaNRUFFGz6kw,9992 +transformers/models/camembert/__init__.py,sha256=-akJBxnuua6C8t5logymVZJ5dvX9-5ADk93h0cU3d64,1041 +transformers/models/camembert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/camembert/__pycache__/configuration_camembert.cpython-312.pyc,, +transformers/models/camembert/__pycache__/modeling_camembert.cpython-312.pyc,, +transformers/models/camembert/__pycache__/modular_camembert.cpython-312.pyc,, +transformers/models/camembert/__pycache__/tokenization_camembert.cpython-312.pyc,, +transformers/models/camembert/configuration_camembert.py,sha256=QdkH5vQ0jHwmyZHgEhYWjFIDfUBQ_gTRmGE4VDZCfko,6190 +transformers/models/camembert/modeling_camembert.py,sha256=ehkj8weFLvAwnzoLZSoBgTpKKNN3aXTviUb0DJqpgvA,54856 +transformers/models/camembert/modular_camembert.py,sha256=AJw1GzwklD9n_TkNFXLAtIUOH00U6s3X_WegZ7iqVgg,22686 +transformers/models/camembert/tokenization_camembert.py,sha256=pnUHPAJBqhagZFHuUu8lEt_7HlWmnIwTaTQHRViJ59U,7321 +transformers/models/canine/__init__.py,sha256=ThkEqO6wPzWCnAplx0EWCUqVaKKsNYQKXQhWfTblEBU,1032 +transformers/models/canine/__pycache__/__init__.cpython-312.pyc,, +transformers/models/canine/__pycache__/configuration_canine.cpython-312.pyc,, +transformers/models/canine/__pycache__/modeling_canine.cpython-312.pyc,, +transformers/models/canine/__pycache__/tokenization_canine.cpython-312.pyc,, +transformers/models/canine/configuration_canine.py,sha256=GeD99sGEi2LnW012m3ur7ehMpbKcFmLTOmaPRE1kx_Q,6611 +transformers/models/canine/modeling_canine.py,sha256=tx7apZszRqSAXsg0lkbw_8tmxcrjHgWzMztEwg1rOcA,58720 +transformers/models/canine/tokenization_canine.py,sha256=hoJ8hVXuy7aibySanfuOdbOV6aOt43myk_jounws-OY,5932 +transformers/models/chameleon/__init__.py,sha256=EJ5kOvTyCFQjjWv9h4CMGHDRjQZ3CJ6j9Ygk2bEylA0,1136 +transformers/models/chameleon/__pycache__/__init__.cpython-312.pyc,, +transformers/models/chameleon/__pycache__/configuration_chameleon.cpython-312.pyc,, +transformers/models/chameleon/__pycache__/image_processing_chameleon.cpython-312.pyc,, +transformers/models/chameleon/__pycache__/image_processing_chameleon_fast.cpython-312.pyc,, +transformers/models/chameleon/__pycache__/modeling_chameleon.cpython-312.pyc,, +transformers/models/chameleon/__pycache__/processing_chameleon.cpython-312.pyc,, +transformers/models/chameleon/configuration_chameleon.py,sha256=ORLLKiBFeKyrBgSLCRQkF0iPq1v2_qYeKwI7iAGdFNU,12100 +transformers/models/chameleon/image_processing_chameleon.py,sha256=GphMeboa0KytveIag4y2AQ2UoZ2NjRU4Ix5YBrnE-wY,16519 +transformers/models/chameleon/image_processing_chameleon_fast.py,sha256=E0SOez2vLJUWeIWUi8ks3ULUDF5ejcOTLuIwaPPSzxo,4032 +transformers/models/chameleon/modeling_chameleon.py,sha256=d4BZBYcyyfmweIVwK24CLJjI3YfQGQikwVaDcVgjnbM,52333 +transformers/models/chameleon/processing_chameleon.py,sha256=Z8qzTqlRKo86Y9VVqXT5Fdcy4Dcgm7-GhYPD2keDU24,7136 +transformers/models/chinese_clip/__init__.py,sha256=-koN80ZGdGEDnTkLDGSDlzQ3fZcahTtaOgjtl3sddSE,1202 +transformers/models/chinese_clip/__pycache__/__init__.cpython-312.pyc,, +transformers/models/chinese_clip/__pycache__/configuration_chinese_clip.cpython-312.pyc,, +transformers/models/chinese_clip/__pycache__/image_processing_chinese_clip.cpython-312.pyc,, +transformers/models/chinese_clip/__pycache__/image_processing_chinese_clip_fast.cpython-312.pyc,, +transformers/models/chinese_clip/__pycache__/modeling_chinese_clip.cpython-312.pyc,, +transformers/models/chinese_clip/__pycache__/processing_chinese_clip.cpython-312.pyc,, +transformers/models/chinese_clip/configuration_chinese_clip.py,sha256=IAveqbQwwunXzO0qm1pRhOxWJkeLfgZ8rvOh6W5H8po,18012 +transformers/models/chinese_clip/image_processing_chinese_clip.py,sha256=blnbqNK1DjZnokbnace6XFyZZDDI8TAIeswnrTmRha8,15150 +transformers/models/chinese_clip/image_processing_chinese_clip_fast.py,sha256=TE5c6k3nSWlLODKO86ANI1PFiIqvzAAKVPJFv4x-Y4U,1332 +transformers/models/chinese_clip/modeling_chinese_clip.py,sha256=jT7cE1mOyG9ryvJQJfQVpGhCait4nKK6tXP-MSuCWf8,49976 +transformers/models/chinese_clip/processing_chinese_clip.py,sha256=JAPbqZs4NVJCTDXTRh8kZvKh0IPxNG5CU_nKKQRgrp0,995 +transformers/models/clap/__init__.py,sha256=751udHbsD7FBLGAByjx_8Z4XPLly1MaQQ4wKN_9vbOY,1067 +transformers/models/clap/__pycache__/__init__.cpython-312.pyc,, +transformers/models/clap/__pycache__/configuration_clap.cpython-312.pyc,, +transformers/models/clap/__pycache__/feature_extraction_clap.cpython-312.pyc,, +transformers/models/clap/__pycache__/modeling_clap.cpython-312.pyc,, +transformers/models/clap/__pycache__/processing_clap.cpython-312.pyc,, +transformers/models/clap/configuration_clap.py,sha256=_nxTAMxdrLj5pVfHmxK-CnsBI7HJm5WQBPHREQ5r4zM,17366 +transformers/models/clap/feature_extraction_clap.py,sha256=orx0svfj0Ru3BLnnaZcF4tW_5iQAN18YAg3ab3OC20U,18699 +transformers/models/clap/modeling_clap.py,sha256=fWsDlaw43VvcoyKRoG2bGtF7XG6nuDLikZp5QBLixvk,79439 +transformers/models/clap/processing_clap.py,sha256=f85IpsPResgKvu7LTfKRuVG3ny-J57bRzpDlfN6Y_aE,961 +transformers/models/clip/__init__.py,sha256=aW_KGBn-oJBYJVdBCey5mj8f8u00nBiEzigid2aLY7o,1191 +transformers/models/clip/__pycache__/__init__.cpython-312.pyc,, +transformers/models/clip/__pycache__/configuration_clip.cpython-312.pyc,, +transformers/models/clip/__pycache__/image_processing_clip.cpython-312.pyc,, +transformers/models/clip/__pycache__/image_processing_clip_fast.cpython-312.pyc,, +transformers/models/clip/__pycache__/modeling_clip.cpython-312.pyc,, +transformers/models/clip/__pycache__/processing_clip.cpython-312.pyc,, +transformers/models/clip/__pycache__/tokenization_clip.cpython-312.pyc,, +transformers/models/clip/configuration_clip.py,sha256=IKB-7RFYGoCnVUOcNdg7sAMZkago4AmRyBAB-79Fjw0,17366 +transformers/models/clip/image_processing_clip.py,sha256=Tpa-HLujorLV7_6aLRTVJ1hB7wKaunxDMcsaaaGYcC4,16611 +transformers/models/clip/image_processing_clip_fast.py,sha256=Ch5n7XYOFW6UOZv9-2CZBbSX0Iy0XydXh-VlD3lEggs,1805 +transformers/models/clip/modeling_clip.py,sha256=p1EScYnfgqCfC9BybkqZcZAromRQ4YHrzenVLJVZZGw,44295 +transformers/models/clip/processing_clip.py,sha256=Um6KNOUZ3pksQqCKrMbAXqaJewINGkmH2E5qkY78czI,928 +transformers/models/clip/tokenization_clip.py,sha256=-1M4oNko3rlHC8hNSTL7LWRWYR8c4U_xFAjMPsbwHvc,5202 +transformers/models/clipseg/__init__.py,sha256=12Y-b3sRDKM3Hy8-6rK4GUF2a91V1S3nLUF7559AALw,1033 +transformers/models/clipseg/__pycache__/__init__.cpython-312.pyc,, +transformers/models/clipseg/__pycache__/configuration_clipseg.cpython-312.pyc,, +transformers/models/clipseg/__pycache__/modeling_clipseg.cpython-312.pyc,, +transformers/models/clipseg/__pycache__/processing_clipseg.cpython-312.pyc,, +transformers/models/clipseg/configuration_clipseg.py,sha256=uQAdtGjC9qknR-MNjuJ-aHmJ6ifUOoSljXZOjVuW4pA,19076 +transformers/models/clipseg/modeling_clipseg.py,sha256=dE9l2uYNbdQXwEQOX8F8BXLKnhm2sLY7IFE0xpai6aY,56457 +transformers/models/clipseg/processing_clipseg.py,sha256=LwTtI7ddVol3tUk8IhkSwCheSSmRBD5OFqW7ssGzpaQ,3932 +transformers/models/clvp/__init__.py,sha256=RRnPofxkr_llgSxCP9tcAhu3xCR7E_m1PkrHv7KLMzo,1104 +transformers/models/clvp/__pycache__/__init__.cpython-312.pyc,, +transformers/models/clvp/__pycache__/configuration_clvp.cpython-312.pyc,, +transformers/models/clvp/__pycache__/feature_extraction_clvp.cpython-312.pyc,, +transformers/models/clvp/__pycache__/modeling_clvp.cpython-312.pyc,, +transformers/models/clvp/__pycache__/number_normalizer.cpython-312.pyc,, +transformers/models/clvp/__pycache__/processing_clvp.cpython-312.pyc,, +transformers/models/clvp/__pycache__/tokenization_clvp.cpython-312.pyc,, +transformers/models/clvp/configuration_clvp.py,sha256=JWhcgqjViVdqu0Rfgi24RQp9M7_dk8BD0F0UEj6r-8c,19781 +transformers/models/clvp/feature_extraction_clvp.py,sha256=5v9w0dCsEF9UVvpMvt98OkBbdRBbAZbuh28DiJmdgxE,10851 +transformers/models/clvp/modeling_clvp.py,sha256=PJXVwkH7nYjQJoKe1MJnHRC_dULCytfJbO2wsVZukFw,85088 +transformers/models/clvp/number_normalizer.py,sha256=KLJC2bIft4UKZrQVM8zisA70vOeJlHI1jtbV1xVIjd8,8918 +transformers/models/clvp/processing_clvp.py,sha256=1u5mgmf1tmUdDwITZUG_GTbon6TTOcZNCa7Ek5Cr2EY,1345 +transformers/models/clvp/tokenization_clvp.py,sha256=om3tlQSKLb-fasG20VMamRMrxTAszRcxJ2PtMYA6Vfo,10181 +transformers/models/code_llama/__init__.py,sha256=vitmyj4qzyn4U2NOEZcp0LhLYGSN4PWHXm8L_UCbvsU,961 +transformers/models/code_llama/__pycache__/__init__.cpython-312.pyc,, +transformers/models/code_llama/__pycache__/tokenization_code_llama.cpython-312.pyc,, +transformers/models/code_llama/tokenization_code_llama.py,sha256=Dc-FsYs5EItOG3d1B3VCTDjFzA82xYHYh-uAm37nEFQ,15116 +transformers/models/codegen/__init__.py,sha256=KofDAB0YGRrmc5s6s8TS9ColIyx-a6_AUeBzZbTQqrY,1114 +transformers/models/codegen/__pycache__/__init__.cpython-312.pyc,, +transformers/models/codegen/__pycache__/configuration_codegen.cpython-312.pyc,, +transformers/models/codegen/__pycache__/modeling_codegen.cpython-312.pyc,, +transformers/models/codegen/__pycache__/tokenization_codegen.cpython-312.pyc,, +transformers/models/codegen/configuration_codegen.py,sha256=ne9QBpA-sx-cn1wZPUaIsrElsTcUOTHCECYJL5Z52Ko,6215 +transformers/models/codegen/modeling_codegen.py,sha256=BliW4UCXOq585zlzpdEEjoPdUkVkI-C39fHgQmYQnco,21097 +transformers/models/codegen/tokenization_codegen.py,sha256=uO-6sBK0bcRJ-p74gvNHP30SJSc-NaINzJWlvIlSgvw,8512 +transformers/models/cohere/__init__.py,sha256=ODwuQ7yp4l1fhMjzk_yO5EAmCzXh1cNOmf10iBD3H9A,1032 +transformers/models/cohere/__pycache__/__init__.cpython-312.pyc,, +transformers/models/cohere/__pycache__/configuration_cohere.cpython-312.pyc,, +transformers/models/cohere/__pycache__/modeling_cohere.cpython-312.pyc,, +transformers/models/cohere/__pycache__/modular_cohere.cpython-312.pyc,, +transformers/models/cohere/__pycache__/tokenization_cohere.cpython-312.pyc,, +transformers/models/cohere/configuration_cohere.py,sha256=wgSkhIO1RY3ulb-natgHygEEppA6XIh7FLQu9NXP168,8545 +transformers/models/cohere/modeling_cohere.py,sha256=KDRamyJqMAgcq0z9yDh7ZDjaACTC7K_PoCGY1bT8fOE,25317 +transformers/models/cohere/modular_cohere.py,sha256=zCqPlaHLHSnoq7a2gp_OFhTMqHzFnQW_8ySylLI3XW4,15635 +transformers/models/cohere/tokenization_cohere.py,sha256=Cqhqs5wcCt9bennRPaaNTMC0cw3F6BalIWjXna72O4E,19625 +transformers/models/cohere2/__init__.py,sha256=6Cx_c-uTSNopbO3NLWCgMmEB2-5hzkrunUWmMrb8YSU,1011 +transformers/models/cohere2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/cohere2/__pycache__/configuration_cohere2.cpython-312.pyc,, +transformers/models/cohere2/__pycache__/modeling_cohere2.cpython-312.pyc,, +transformers/models/cohere2/__pycache__/modular_cohere2.cpython-312.pyc,, +transformers/models/cohere2/configuration_cohere2.py,sha256=QYW0vf6CpnSA7voHRHyhzBexWEej8wy1vFAxKAvvKyQ,10022 +transformers/models/cohere2/modeling_cohere2.py,sha256=BJNR5EMvU_RedVddshQj3gzIE76P2OC68GMYaTafdGw,24697 +transformers/models/cohere2/modular_cohere2.py,sha256=vW1ckpLayy_yiBOKNcBMHWAphxLtnksZro-NQ3NVTP0,18575 +transformers/models/cohere2_vision/__init__.py,sha256=VZPnI0ugmeUt8tHNLXhSF1X4maFa0T4pqnm3VAPEyo0,1110 +transformers/models/cohere2_vision/__pycache__/__init__.cpython-312.pyc,, +transformers/models/cohere2_vision/__pycache__/configuration_cohere2_vision.cpython-312.pyc,, +transformers/models/cohere2_vision/__pycache__/image_processing_cohere2_vision_fast.cpython-312.pyc,, +transformers/models/cohere2_vision/__pycache__/modeling_cohere2_vision.cpython-312.pyc,, +transformers/models/cohere2_vision/__pycache__/modular_cohere2_vision.cpython-312.pyc,, +transformers/models/cohere2_vision/__pycache__/processing_cohere2_vision.cpython-312.pyc,, +transformers/models/cohere2_vision/configuration_cohere2_vision.py,sha256=hHHHIM9CeQntpqtPUiy6lGYx-N-_Id0_1oi45HQV2HA,3735 +transformers/models/cohere2_vision/image_processing_cohere2_vision_fast.py,sha256=vSnNNijQ-wpdjEzY2eymG3CugWBAoN6lTUJvt9X3fr4,13569 +transformers/models/cohere2_vision/modeling_cohere2_vision.py,sha256=V6IvHPmN17ojJ-3Bs9M8dBRbStPpb-vsj--TX6nW4nM,17783 +transformers/models/cohere2_vision/modular_cohere2_vision.py,sha256=mCi6SXlt2ZdzEisGgaXfgSSiXlFAJyrMcUV5d7LsOUc,14252 +transformers/models/cohere2_vision/processing_cohere2_vision.py,sha256=3ZMWbNSBcZ8HOFDh7AQc6w36MJo15wrFbY-0tW7x73M,7239 +transformers/models/colpali/__init__.py,sha256=eG-nOojo-DPkgZJACn6hbJqqfnGE97uKmLkpWVin66A,1033 +transformers/models/colpali/__pycache__/__init__.cpython-312.pyc,, +transformers/models/colpali/__pycache__/configuration_colpali.cpython-312.pyc,, +transformers/models/colpali/__pycache__/modeling_colpali.cpython-312.pyc,, +transformers/models/colpali/__pycache__/modular_colpali.cpython-312.pyc,, +transformers/models/colpali/__pycache__/processing_colpali.cpython-312.pyc,, +transformers/models/colpali/configuration_colpali.py,sha256=hKl3OOp_w3tSZzOWKYBqJwZ02O_wO_6pssrNO5vq00g,4285 +transformers/models/colpali/modeling_colpali.py,sha256=pb31s9WIOIzU1XsZ8nGBLvaJOa7UBZO1OmzQD4wmVaM,8600 +transformers/models/colpali/modular_colpali.py,sha256=V_a8F8rJLrPZKi4T7_C1HCKDfStL-66eiQk9apmWE8E,12861 +transformers/models/colpali/processing_colpali.py,sha256=ar5_XMFiEkU9rVroi-89Lvf4EqCmbLqq322-1_qIJcU,16492 +transformers/models/colqwen2/__init__.py,sha256=GBrOYGkXcXTOuCd6AhVMss6TVb2igEKFcrAkgJbbg-Q,1036 +transformers/models/colqwen2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/colqwen2/__pycache__/configuration_colqwen2.cpython-312.pyc,, +transformers/models/colqwen2/__pycache__/modeling_colqwen2.cpython-312.pyc,, +transformers/models/colqwen2/__pycache__/modular_colqwen2.cpython-312.pyc,, +transformers/models/colqwen2/__pycache__/processing_colqwen2.cpython-312.pyc,, +transformers/models/colqwen2/configuration_colqwen2.py,sha256=uStnTnom3s4wvmHKTX6P_57HSiM6KhdV163G0MCuQmc,3791 +transformers/models/colqwen2/modeling_colqwen2.py,sha256=dn1XQW7fR96lEAMRVEvxUfxU9PCNnuMmvlowSxs3FYs,10760 +transformers/models/colqwen2/modular_colqwen2.py,sha256=ZWM88SoYzGVvl4S5dDfk9HKGYqXAeQ4kKeILnsOEwVM,15846 +transformers/models/colqwen2/processing_colqwen2.py,sha256=nJVkwfGQG8j0rgE1qw5DuxNhlROq9JCySo1GPJ-DxqM,16763 +transformers/models/conditional_detr/__init__.py,sha256=p8luCb38qMZvKdI7GLvBTx1eiKGFMv8Obd5iKaqoVe8,1179 +transformers/models/conditional_detr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/conditional_detr/__pycache__/configuration_conditional_detr.cpython-312.pyc,, +transformers/models/conditional_detr/__pycache__/image_processing_conditional_detr.cpython-312.pyc,, +transformers/models/conditional_detr/__pycache__/image_processing_conditional_detr_fast.cpython-312.pyc,, +transformers/models/conditional_detr/__pycache__/modeling_conditional_detr.cpython-312.pyc,, +transformers/models/conditional_detr/__pycache__/modular_conditional_detr.cpython-312.pyc,, +transformers/models/conditional_detr/configuration_conditional_detr.py,sha256=Hz4hdVVynOroMhQmxqYHVgJUvm6uXcYXLQStozXJLkU,10861 +transformers/models/conditional_detr/image_processing_conditional_detr.py,sha256=ZRmciRWzZ94-hLqwSDchDLtpo95yQqR4mq_9gIvqRj4,79605 +transformers/models/conditional_detr/image_processing_conditional_detr_fast.py,sha256=Isoq18RKyl4-jHyVEPJ_ejuUQ4OpjKm02j9wtPQ1rtE,41240 +transformers/models/conditional_detr/modeling_conditional_detr.py,sha256=0nRbDNxeONojv7Tge5tW8EaDPxxX9D9IavgPDow8ryQ,85498 +transformers/models/conditional_detr/modular_conditional_detr.py,sha256=dYcqgQnAqiDRmk1gqRdKaY1ogskUe1JvNhkaIp1hNIU,44737 +transformers/models/convbert/__init__.py,sha256=Y0-hcRZvFjmIVqDFCtOKhQDRqp0d7wKCZc10seKejqI,1118 +transformers/models/convbert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/convbert/__pycache__/configuration_convbert.cpython-312.pyc,, +transformers/models/convbert/__pycache__/modeling_convbert.cpython-312.pyc,, +transformers/models/convbert/__pycache__/tokenization_convbert.cpython-312.pyc,, +transformers/models/convbert/configuration_convbert.py,sha256=fOCTwKxRIgodaKtPCgTXrB6kvVVk66n_ol2ELely18I,6358 +transformers/models/convbert/modeling_convbert.py,sha256=Ysht8PJQtWnQugEUbYRNak4YCzMoJhcjtA74gl5NNUE,48940 +transformers/models/convbert/tokenization_convbert.py,sha256=x-ytkim2fLoFmpF9-VgIEuigm6tggJLwkaSsC1_radg,1092 +transformers/models/convnext/__init__.py,sha256=VPV1GFqj2NaPR0h-sDQL_tafoXLmUbgb6LcKN1oViVY,1139 +transformers/models/convnext/__pycache__/__init__.cpython-312.pyc,, +transformers/models/convnext/__pycache__/configuration_convnext.cpython-312.pyc,, +transformers/models/convnext/__pycache__/image_processing_convnext.cpython-312.pyc,, +transformers/models/convnext/__pycache__/image_processing_convnext_fast.cpython-312.pyc,, +transformers/models/convnext/__pycache__/modeling_convnext.cpython-312.pyc,, +transformers/models/convnext/configuration_convnext.py,sha256=PnESDYeCBz40WJqcWNDdKWMDSSAZ2cb_Ngxoxg54ZRk,5471 +transformers/models/convnext/image_processing_convnext.py,sha256=M-_VmG0-qHcLtgF6qT4ge70w3L59KfZxj38qCudYmas,15989 +transformers/models/convnext/image_processing_convnext_fast.py,sha256=IGmuh0P_nj7mbxOISBjbRTJw6yH87PJBCRwELsJZ0rU,6611 +transformers/models/convnext/modeling_convnext.py,sha256=m91JjPIO_Igj5SdG3h981vfEi4Qft5d_7JQBjpmHGhU,16155 +transformers/models/convnextv2/__init__.py,sha256=WcvDfW6VT_st_i235oLAM_okTePdPNtxNVHsOZ4_Bi4,1001 +transformers/models/convnextv2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/convnextv2/__pycache__/configuration_convnextv2.cpython-312.pyc,, +transformers/models/convnextv2/__pycache__/modeling_convnextv2.cpython-312.pyc,, +transformers/models/convnextv2/configuration_convnextv2.py,sha256=1vA89oXl-O746q-L4_pHtsMWkBVZpDoNFLBa4AYB24o,5404 +transformers/models/convnextv2/modeling_convnextv2.py,sha256=EWrWKPai-Jb36CeQiJNOETydkvYwnxjKLnPgEH6oe7s,17637 +transformers/models/cpm/__init__.py,sha256=psXgdNRVfFj8JbyWxWhM84oflsqVA5_ODqYatXvkpzU,954 +transformers/models/cpm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/cpm/__pycache__/tokenization_cpm.cpython-312.pyc,, +transformers/models/cpm/__pycache__/tokenization_cpm_fast.cpython-312.pyc,, +transformers/models/cpm/tokenization_cpm.py,sha256=XCOcTehy4nF7oE1K5m_b2oXGYoz6i8D0Mf8T-KEa06Y,13822 +transformers/models/cpm/tokenization_cpm_fast.py,sha256=kO2p2Z3rthXylnGlz0QKFhBe2vjGRSnsdVxP69qKVBU,9917 +transformers/models/cpmant/__init__.py,sha256=RfkbbhNqdbioJ5XVaTtxBLnZRt1GFnXugS3UFXHYV0c,1032 +transformers/models/cpmant/__pycache__/__init__.cpython-312.pyc,, +transformers/models/cpmant/__pycache__/configuration_cpmant.cpython-312.pyc,, +transformers/models/cpmant/__pycache__/modeling_cpmant.cpython-312.pyc,, +transformers/models/cpmant/__pycache__/tokenization_cpmant.cpython-312.pyc,, +transformers/models/cpmant/configuration_cpmant.py,sha256=pKqNPHTW5U0Tmct9utAeWq6MZ0NUr0ilaMPd9U29Sxw,5334 +transformers/models/cpmant/modeling_cpmant.py,sha256=HvZgKpC1DZ3EE2zpLhDxFxzkQUi0d8-E72KKvCiMg4Y,32343 +transformers/models/cpmant/tokenization_cpmant.py,sha256=7y32Z-rvAP2lv8eoz6qyU6cht69VgtytfN-VMfL5b6A,7993 +transformers/models/csm/__init__.py,sha256=n-AQHwxZwD8imEHipiQoTDRf_OMo5zJhQ0tKKWMCPYs,1021 +transformers/models/csm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/csm/__pycache__/configuration_csm.cpython-312.pyc,, +transformers/models/csm/__pycache__/generation_csm.cpython-312.pyc,, +transformers/models/csm/__pycache__/modeling_csm.cpython-312.pyc,, +transformers/models/csm/__pycache__/modular_csm.cpython-312.pyc,, +transformers/models/csm/__pycache__/processing_csm.cpython-312.pyc,, +transformers/models/csm/configuration_csm.py,sha256=UrwC8E9oa8K-caz38ZA1XalIsC485egU-4N5-nSkdg8,18093 +transformers/models/csm/generation_csm.py,sha256=YC2Q-uZN1PhK6bSVfr7yxXp5nbIcuOB93jMndcn5lSY,25722 +transformers/models/csm/modeling_csm.py,sha256=pVit1i-dpoWtFZzvaH7gi1j6t2uxvquwgoB4Tp9bVxw,51874 +transformers/models/csm/modular_csm.py,sha256=agF6waZdFgTb738TexsEXIRXtXZk5rHYvTzusl1-NtA,35348 +transformers/models/csm/processing_csm.py,sha256=v6WkNkanMqvF3vAZ5KACKpzSmy-x7bbkfMVUN3RIVl0,13710 +transformers/models/ctrl/__init__.py,sha256=Uj8X4puguEkwCqBv_qOznsAW6GPOlieWNi-IGUh6mBQ,1026 +transformers/models/ctrl/__pycache__/__init__.cpython-312.pyc,, +transformers/models/ctrl/__pycache__/configuration_ctrl.cpython-312.pyc,, +transformers/models/ctrl/__pycache__/modeling_ctrl.cpython-312.pyc,, +transformers/models/ctrl/__pycache__/tokenization_ctrl.cpython-312.pyc,, +transformers/models/ctrl/configuration_ctrl.py,sha256=6JzjBOF4O3OZLQIVBfEoWwFx15tWNRo2g35C4eUWsGs,5271 +transformers/models/ctrl/modeling_ctrl.py,sha256=ry71FkxK2aIo9vYHjiC99PioMJS61wtKLKXrpHKI_mo,27314 +transformers/models/ctrl/tokenization_ctrl.py,sha256=BFU4oTzkz9G141xRPHYJRXMMuY1Jv_CsBitg-Jf2VL4,6855 +transformers/models/cvt/__init__.py,sha256=PWfHQ1umBPnzjBcUQnJn2YvYAqxyWu8YrGzqmDsSHJo,987 +transformers/models/cvt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/cvt/__pycache__/configuration_cvt.cpython-312.pyc,, +transformers/models/cvt/__pycache__/modeling_cvt.cpython-312.pyc,, +transformers/models/cvt/configuration_cvt.py,sha256=uotXWRSaU5wDQnBxPxeYHH8wpignkq7o9z3LIOccw8Q,6669 +transformers/models/cvt/modeling_cvt.py,sha256=5Oce_dXnRdPeCYeGIzAJ-xwGBcswsBDx15f-Ciu5vvM,24148 +transformers/models/cwm/__init__.py,sha256=03y-UaFJQwrYUyzQX5j0e7reFrGcd7uD93fnOrUsJSA,988 +transformers/models/cwm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/cwm/__pycache__/configuration_cwm.cpython-312.pyc,, +transformers/models/cwm/__pycache__/modeling_cwm.cpython-312.pyc,, +transformers/models/cwm/__pycache__/modular_cwm.cpython-312.pyc,, +transformers/models/cwm/configuration_cwm.py,sha256=vozL5JNdO7K48UpC1ACMsqhTxYL4RhxvQoD6LvtyR3s,9612 +transformers/models/cwm/modeling_cwm.py,sha256=C28S7oagSSIMNu8U9cA8ZT9OmB_wAq--ErwQrbYn0L0,22291 +transformers/models/cwm/modular_cwm.py,sha256=RNncqPNbcj5l-Z5rz4zabkWv3lEHsfEZQdPEZWkJd2o,12634 +transformers/models/d_fine/__init__.py,sha256=1gNscomeWytwZT7K2GJBwyXxDkfVNLhRjuDwyde2A0s,995 +transformers/models/d_fine/__pycache__/__init__.cpython-312.pyc,, +transformers/models/d_fine/__pycache__/configuration_d_fine.cpython-312.pyc,, +transformers/models/d_fine/__pycache__/modeling_d_fine.cpython-312.pyc,, +transformers/models/d_fine/__pycache__/modular_d_fine.cpython-312.pyc,, +transformers/models/d_fine/configuration_d_fine.py,sha256=alh3H511safWNkWtjE94CRNuXIO8ccj7IOQgpGF_NsM,19358 +transformers/models/d_fine/modeling_d_fine.py,sha256=qjGYaadQIIgmOzcu1SKsBIMtTlCqRIB0ISlABonpRkY,95247 +transformers/models/d_fine/modular_d_fine.py,sha256=UwT08Dqa4rEagRYtcA727QQ-7Sr7QhrNP4weffhFQ0U,52948 +transformers/models/dab_detr/__init__.py,sha256=ZvNYPQyXWplaRQIxFR8CURcsnu_HRPXrwojF5nTmGd4,998 +transformers/models/dab_detr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/dab_detr/__pycache__/configuration_dab_detr.cpython-312.pyc,, +transformers/models/dab_detr/__pycache__/modeling_dab_detr.cpython-312.pyc,, +transformers/models/dab_detr/configuration_dab_detr.py,sha256=fjcZVwy6FBw0bIF11yiAKppiNhdM4piE7P-rDoIPM90,11706 +transformers/models/dab_detr/modeling_dab_detr.py,sha256=hQIkFb9H5boJ3jsIHn5hvhDU6Jksw-MG7L8Rc6wbZwY,74317 +transformers/models/dac/__init__.py,sha256=UpwXPmSOQOwvbIvklM21-y5HKY7MEIInmTt65xMX6Hw,1029 +transformers/models/dac/__pycache__/__init__.cpython-312.pyc,, +transformers/models/dac/__pycache__/configuration_dac.cpython-312.pyc,, +transformers/models/dac/__pycache__/feature_extraction_dac.cpython-312.pyc,, +transformers/models/dac/__pycache__/modeling_dac.cpython-312.pyc,, +transformers/models/dac/configuration_dac.py,sha256=U2L-tEoIyDwjVqmYiomzvx4wpmNbFo-wn-cQXVMRSBY,4566 +transformers/models/dac/feature_extraction_dac.py,sha256=npYuHvnX-pyTvcfzxndRrLXgf-HLobCxF1Tt6-vhCpI,7911 +transformers/models/dac/modeling_dac.py,sha256=nycRu4erohiVg8MLuUggiyuDd9I_INl63wUn_qCmXSI,28980 +transformers/models/data2vec/__init__.py,sha256=BBiRVhmDgkquO28CdLOZNQztFSNQ9H-qP5wFYnI0NEc,1191 +transformers/models/data2vec/__pycache__/__init__.cpython-312.pyc,, +transformers/models/data2vec/__pycache__/configuration_data2vec_audio.cpython-312.pyc,, +transformers/models/data2vec/__pycache__/configuration_data2vec_text.cpython-312.pyc,, +transformers/models/data2vec/__pycache__/configuration_data2vec_vision.cpython-312.pyc,, +transformers/models/data2vec/__pycache__/modeling_data2vec_audio.cpython-312.pyc,, +transformers/models/data2vec/__pycache__/modeling_data2vec_text.cpython-312.pyc,, +transformers/models/data2vec/__pycache__/modeling_data2vec_vision.cpython-312.pyc,, +transformers/models/data2vec/__pycache__/modular_data2vec_audio.cpython-312.pyc,, +transformers/models/data2vec/__pycache__/modular_data2vec_text.cpython-312.pyc,, +transformers/models/data2vec/configuration_data2vec_audio.py,sha256=9km76IXHdakE-LGcSmRL6NuwRS7jieMRGfKB1MYevfc,16372 +transformers/models/data2vec/configuration_data2vec_text.py,sha256=jPhQS2d1AlOnnfLaKpJq6S6VXpTdf9kb5sxoyZ9c96c,6279 +transformers/models/data2vec/configuration_data2vec_vision.py,sha256=I9paAkhmabRr0UuoBrDQtrJ-FpJI6q8HNZnuXRChmuY,8656 +transformers/models/data2vec/modeling_data2vec_audio.py,sha256=T2spDJM6Bk5rB6Ondpm2CbAZG55gPTUe12--H1099GQ,55781 +transformers/models/data2vec/modeling_data2vec_text.py,sha256=XSsNk1qRMpjRn1eR80o6x3Wst6tEKBWT_-4Z9w2k2Ao,50766 +transformers/models/data2vec/modeling_data2vec_vision.py,sha256=SzdDUm_U8M3Ko-2NyMVm83VFx2Jgaxxq9pB7OWOghSY,53828 +transformers/models/data2vec/modular_data2vec_audio.py,sha256=9f7UwTtLQdTDQgY5er-WbBIMpJQ-t6aJhwRlxt00lYA,9673 +transformers/models/data2vec/modular_data2vec_text.py,sha256=28YoIAs7dfyr_GUtmD8kI2Jz_49aUNKi0Nyx2iHFAC4,23111 +transformers/models/dbrx/__init__.py,sha256=Kzn3gm0QHW9RKEmog_IfdCGam5TXSCzkOs_WHC43sgM,989 +transformers/models/dbrx/__pycache__/__init__.cpython-312.pyc,, +transformers/models/dbrx/__pycache__/configuration_dbrx.cpython-312.pyc,, +transformers/models/dbrx/__pycache__/modeling_dbrx.cpython-312.pyc,, +transformers/models/dbrx/__pycache__/modular_dbrx.cpython-312.pyc,, +transformers/models/dbrx/configuration_dbrx.py,sha256=jomeHhDvHRSn186SDdE-3Qp5UgHJNtyEPU2Yw5aiQfs,10261 +transformers/models/dbrx/modeling_dbrx.py,sha256=Hv5Y0_PxeSZZRCjUw9YhjTOTZs81qyt4XPYc2sXb1eU,32905 +transformers/models/dbrx/modular_dbrx.py,sha256=NlUtTubg1E4VVGDsK4b0t4JTznzmVcSCiVh8FNSM1cc,22540 +transformers/models/deberta/__init__.py,sha256=m87EmHGlh9isDhJ7-X7MlUa1cPhWtRYuqZPC3yGNE9I,1035 +transformers/models/deberta/__pycache__/__init__.cpython-312.pyc,, +transformers/models/deberta/__pycache__/configuration_deberta.cpython-312.pyc,, +transformers/models/deberta/__pycache__/modeling_deberta.cpython-312.pyc,, +transformers/models/deberta/__pycache__/tokenization_deberta.cpython-312.pyc,, +transformers/models/deberta/configuration_deberta.py,sha256=EzY9QZ-wOKwqLKr03ZWxmDQI6ceTSV8Lp1oKOE-sgc0,7383 +transformers/models/deberta/modeling_deberta.py,sha256=N__IL51LlMbFtO9fq8f0dVWO1BfJtW_8oEJ0GX9gk0k,47708 +transformers/models/deberta/tokenization_deberta.py,sha256=jNbgUuJtq-ydvv8AvtPDfC9CDErYTmBgKQxg7u3KEgI,7794 +transformers/models/deberta_v2/__init__.py,sha256=XIzvjcNgxx7TXV5zmtSG35QaaQMn86eQrHjijCcDM-M,1044 +transformers/models/deberta_v2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/deberta_v2/__pycache__/configuration_deberta_v2.cpython-312.pyc,, +transformers/models/deberta_v2/__pycache__/modeling_deberta_v2.cpython-312.pyc,, +transformers/models/deberta_v2/__pycache__/tokenization_deberta_v2.cpython-312.pyc,, +transformers/models/deberta_v2/configuration_deberta_v2.py,sha256=SawGOL6295bJAee0NEx54ZlaYeBrCy60f5K9LzDphas,7455 +transformers/models/deberta_v2/modeling_deberta_v2.py,sha256=OoNZ4ySHZ2o0LyYulaABDPxJb5bgSJ2P5YjAIaIlWZQ,55656 +transformers/models/deberta_v2/tokenization_deberta_v2.py,sha256=X6QSEsBkJznuYssnr6iX7qTKPW5NGGpkjMn1J93JzJE,6634 +transformers/models/decision_transformer/__init__.py,sha256=8XAHnFrFv8IFz495cQLTeaAk2G1AVRT7roauVHCGoJs,1021 +transformers/models/decision_transformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/decision_transformer/__pycache__/configuration_decision_transformer.cpython-312.pyc,, +transformers/models/decision_transformer/__pycache__/modeling_decision_transformer.cpython-312.pyc,, +transformers/models/decision_transformer/configuration_decision_transformer.py,sha256=09DDdWKcxQQiw7Xr2-x8VdoaO17jLYGMaWNZfhNGYAc,7050 +transformers/models/decision_transformer/modeling_decision_transformer.py,sha256=aDv6sM6FVIv8QYCHzJfJZ-82MU3mPA81eOC-ONzuJgM,32408 +transformers/models/deepseek_v2/__init__.py,sha256=cRpNT946KLnKXl4i2mGlImi9QLOe2a1ocnWNjBSbK68,1005 +transformers/models/deepseek_v2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/deepseek_v2/__pycache__/configuration_deepseek_v2.cpython-312.pyc,, +transformers/models/deepseek_v2/__pycache__/modeling_deepseek_v2.cpython-312.pyc,, +transformers/models/deepseek_v2/__pycache__/modular_deepseek_v2.cpython-312.pyc,, +transformers/models/deepseek_v2/configuration_deepseek_v2.py,sha256=AChqqr02g5YUloFlYRpcbNAZDEYZPEE2JBpUJNHlwtc,12087 +transformers/models/deepseek_v2/modeling_deepseek_v2.py,sha256=8AfiuIWgL1RThlfZX6CaVr_CsWbkIH_jb3Ihfnaf1-o,28173 +transformers/models/deepseek_v2/modular_deepseek_v2.py,sha256=ZbpQCSxT05e_gJj7QGlIUtni_gBcStW5IZMiVlJtSNo,21847 +transformers/models/deepseek_v3/__init__.py,sha256=t-ejxAfULC_tUrUucNLt-x3hbTEIqUQp96m2DRFeaTg,1008 +transformers/models/deepseek_v3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/deepseek_v3/__pycache__/configuration_deepseek_v3.cpython-312.pyc,, +transformers/models/deepseek_v3/__pycache__/modeling_deepseek_v3.cpython-312.pyc,, +transformers/models/deepseek_v3/__pycache__/modular_deepseek_v3.cpython-312.pyc,, +transformers/models/deepseek_v3/configuration_deepseek_v3.py,sha256=aN6-5xZqDpcDA9aXFe2nJ68wIKSlN8vR7ppT2DRb0-0,12957 +transformers/models/deepseek_v3/modeling_deepseek_v3.py,sha256=tEVdHKVzsCJMANbqOmn3x-995m_kYf3vxMgAtADtBRc,32412 +transformers/models/deepseek_v3/modular_deepseek_v3.py,sha256=Nlrd2w0Ejai7ehl1Q5Pk8NZHam5bDhisWVAZ7yZflss,14195 +transformers/models/deepseek_vl/__init__.py,sha256=ZjpL2NkjCM_tsGMz_fY7bOQ2HQwimj3RL4cocjrEtHI,1162 +transformers/models/deepseek_vl/__pycache__/__init__.cpython-312.pyc,, +transformers/models/deepseek_vl/__pycache__/configuration_deepseek_vl.cpython-312.pyc,, +transformers/models/deepseek_vl/__pycache__/image_processing_deepseek_vl.cpython-312.pyc,, +transformers/models/deepseek_vl/__pycache__/image_processing_deepseek_vl_fast.cpython-312.pyc,, +transformers/models/deepseek_vl/__pycache__/modeling_deepseek_vl.cpython-312.pyc,, +transformers/models/deepseek_vl/__pycache__/modular_deepseek_vl.cpython-312.pyc,, +transformers/models/deepseek_vl/__pycache__/processing_deepseek_vl.cpython-312.pyc,, +transformers/models/deepseek_vl/configuration_deepseek_vl.py,sha256=oW3DCnx2yadN_iVP5N5FbNNKQRGhI9CNhYRW_239jyI,4777 +transformers/models/deepseek_vl/image_processing_deepseek_vl.py,sha256=hxEk4GB7I3q-tnI7a_GtlI7em6Zp8kdJ0AJxIgqomRQ,21554 +transformers/models/deepseek_vl/image_processing_deepseek_vl_fast.py,sha256=lUnrkNw3fmUfPXFgfAPY-7L-CkVDQXlvH7_wlJaQLyo,7707 +transformers/models/deepseek_vl/modeling_deepseek_vl.py,sha256=uuTNw6otr8DOt15uzjx899J4Sr9F5aykEDmINHp_Zh0,15316 +transformers/models/deepseek_vl/modular_deepseek_vl.py,sha256=MyzeyFwZqib7J7UIS9kgdsIsJKO-hTHzDxh6_WrFZF4,10922 +transformers/models/deepseek_vl/processing_deepseek_vl.py,sha256=MBcQDEDZ5jHzIk2CjvU1ioTLGIrltFVKCogv3j1esFk,5389 +transformers/models/deepseek_vl_hybrid/__init__.py,sha256=FjSY1MYTEUP8BbAqIG2DZSAzmLh17w8aZr7pUkC_Gto,1257 +transformers/models/deepseek_vl_hybrid/__pycache__/__init__.cpython-312.pyc,, +transformers/models/deepseek_vl_hybrid/__pycache__/configuration_deepseek_vl_hybrid.cpython-312.pyc,, +transformers/models/deepseek_vl_hybrid/__pycache__/image_processing_deepseek_vl_hybrid.cpython-312.pyc,, +transformers/models/deepseek_vl_hybrid/__pycache__/image_processing_deepseek_vl_hybrid_fast.cpython-312.pyc,, +transformers/models/deepseek_vl_hybrid/__pycache__/modeling_deepseek_vl_hybrid.cpython-312.pyc,, +transformers/models/deepseek_vl_hybrid/__pycache__/modular_deepseek_vl_hybrid.cpython-312.pyc,, +transformers/models/deepseek_vl_hybrid/__pycache__/processing_deepseek_vl_hybrid.cpython-312.pyc,, +transformers/models/deepseek_vl_hybrid/configuration_deepseek_vl_hybrid.py,sha256=4Uo3V25PULUfhQXR93vYNhXQUhVGht5gYukv8HzVV_4,5686 +transformers/models/deepseek_vl_hybrid/image_processing_deepseek_vl_hybrid.py,sha256=GqDzYTNFdSkuO4kivOhVA2UpEuvUJYeAc6kCO6FsMME,28075 +transformers/models/deepseek_vl_hybrid/image_processing_deepseek_vl_hybrid_fast.py,sha256=aUVLO5j7zi5zrmx4_rKL7k4flmO0BV6PkobzSXzlxxE,12792 +transformers/models/deepseek_vl_hybrid/modeling_deepseek_vl_hybrid.py,sha256=dsNscx4FZRxlPYnMQ17IumJNuddnJsasGpeNcobQtfg,25320 +transformers/models/deepseek_vl_hybrid/modular_deepseek_vl_hybrid.py,sha256=3WlOXUYlLunuwTk69NFotu7ZwDYXT-Y9TKTTUPv0k8E,49619 +transformers/models/deepseek_vl_hybrid/processing_deepseek_vl_hybrid.py,sha256=USx2UqYc0Ocp1cRNrFrQratD8wm67iOGSHeaI00zLt4,5552 +transformers/models/deformable_detr/__init__.py,sha256=_ae-sABBY17hOT28SN_d0GLeRVjya0W4aqniH8u8Bcw,1176 +transformers/models/deformable_detr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/deformable_detr/__pycache__/configuration_deformable_detr.cpython-312.pyc,, +transformers/models/deformable_detr/__pycache__/image_processing_deformable_detr.cpython-312.pyc,, +transformers/models/deformable_detr/__pycache__/image_processing_deformable_detr_fast.cpython-312.pyc,, +transformers/models/deformable_detr/__pycache__/modeling_deformable_detr.cpython-312.pyc,, +transformers/models/deformable_detr/__pycache__/modular_deformable_detr.cpython-312.pyc,, +transformers/models/deformable_detr/configuration_deformable_detr.py,sha256=Y6MO1uFuL9qxS9ITvPV6zKl1dQBEQno_G_uqVfpt5TQ,12669 +transformers/models/deformable_detr/image_processing_deformable_detr.py,sha256=j9RQ8K40wuqfc3snUrddPXS952MZLp1fCqu4SYqRbAk,67106 +transformers/models/deformable_detr/image_processing_deformable_detr_fast.py,sha256=E4fbnaaGLUNMo45D_5sLAWn0CN6Ckn_r6Z6iW8im3DM,29150 +transformers/models/deformable_detr/modeling_deformable_detr.py,sha256=7q2ereeFxBmLFZorI3Y32_-2rck51y789z5j7QjAQgA,78884 +transformers/models/deformable_detr/modular_deformable_detr.py,sha256=3BoiLJ9OA-bHQrQaxNgsJFU5Mu2YnL-b1MdEC8T-7To,68936 +transformers/models/deit/__init__.py,sha256=22WX8RQ-IVaOQsYrJ4D8ZQPZ_OHFGJf9dZ_6F-mRHAg,1119 +transformers/models/deit/__pycache__/__init__.cpython-312.pyc,, +transformers/models/deit/__pycache__/configuration_deit.cpython-312.pyc,, +transformers/models/deit/__pycache__/image_processing_deit.cpython-312.pyc,, +transformers/models/deit/__pycache__/image_processing_deit_fast.cpython-312.pyc,, +transformers/models/deit/__pycache__/modeling_deit.cpython-312.pyc,, +transformers/models/deit/configuration_deit.py,sha256=7OeJSbdqJw-P8AqBfYbZrgTb_RlkmAxH2ExSt7QKAkA,5624 +transformers/models/deit/image_processing_deit.py,sha256=y-N0WSuoiE5DK6T_LtkSiE0je1njU8_GDvgVXH7OOBw,14925 +transformers/models/deit/image_processing_deit_fast.py,sha256=f9sMcuPByCWA_ZDVb-qaucE-kQk769oP4iA4fESKhus,1384 +transformers/models/deit/modeling_deit.py,sha256=WddVqPwax70zVa2nYWutxR0QJqjL0ziB97O6wXBOwko,30280 +transformers/models/deprecated/__init__.py,sha256=cBbCmNwJS_K7Qxng1In7TGSmzj61crBAhb6mN_NoqDI,988 +transformers/models/deprecated/__pycache__/__init__.cpython-312.pyc,, +transformers/models/depth_anything/__init__.py,sha256=Jbd8LXt-fU3_cTF7jBrkBBw-Kzscv6o7O0YiZy0R8-A,1009 +transformers/models/depth_anything/__pycache__/__init__.cpython-312.pyc,, +transformers/models/depth_anything/__pycache__/configuration_depth_anything.cpython-312.pyc,, +transformers/models/depth_anything/__pycache__/modeling_depth_anything.cpython-312.pyc,, +transformers/models/depth_anything/configuration_depth_anything.py,sha256=3ZBbBFvT_vyt-B-hdrv17Ke6lAYKSAVfydm4fPSxzRo,5531 +transformers/models/depth_anything/modeling_depth_anything.py,sha256=bNyDEj_1-R3rQv0ZnL_nVNIsj8Qi-fc6Qwv_ZH8mKbk,16130 +transformers/models/depth_pro/__init__.py,sha256=5R4N4IVUQuK8bCFtg9qGvJFceJaHXNj4HdCWkcsyELc,1096 +transformers/models/depth_pro/__pycache__/__init__.cpython-312.pyc,, +transformers/models/depth_pro/__pycache__/configuration_depth_pro.cpython-312.pyc,, +transformers/models/depth_pro/__pycache__/image_processing_depth_pro.cpython-312.pyc,, +transformers/models/depth_pro/__pycache__/image_processing_depth_pro_fast.cpython-312.pyc,, +transformers/models/depth_pro/__pycache__/modeling_depth_pro.cpython-312.pyc,, +transformers/models/depth_pro/configuration_depth_pro.py,sha256=XzLH10lsxx5iw7zk-sNidYASQQxSucoaeVSduO92WyM,10660 +transformers/models/depth_pro/image_processing_depth_pro.py,sha256=ImE0AuaF8tuRmaJKyRxH7hSWJVvSrP6l44w0fd-tJ2o,18546 +transformers/models/depth_pro/image_processing_depth_pro_fast.py,sha256=1nCyOa139QDSqPu57iCil3kcv7NKau8fPQUJ_IlAxh0,6532 +transformers/models/depth_pro/modeling_depth_pro.py,sha256=a21KoslZNzT8EzJiFiAfpF_S-aVY3H4zCm_BPejOQCI,42507 +transformers/models/detr/__init__.py,sha256=YEWZnoCCgWt4KZNfbSi-v4KNDOJT2-ii2sxanyVDkvY,1120 +transformers/models/detr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/detr/__pycache__/configuration_detr.cpython-312.pyc,, +transformers/models/detr/__pycache__/image_processing_detr.cpython-312.pyc,, +transformers/models/detr/__pycache__/image_processing_detr_fast.cpython-312.pyc,, +transformers/models/detr/__pycache__/modeling_detr.cpython-312.pyc,, +transformers/models/detr/configuration_detr.py,sha256=seCsIsaVuD4zXrnPkQsCEO2W24m7kxBG4yGyBeoaJH0,10442 +transformers/models/detr/image_processing_detr.py,sha256=SYvJ5RrkQffGG78ciqK3ZQXYvghnxTNnBQAq7LbVwyc,76482 +transformers/models/detr/image_processing_detr_fast.py,sha256=rF1XNhdwqNRuKdA1zs9faB-7Q7NbzbWkvX56ZGTQkYA,40187 +transformers/models/detr/modeling_detr.py,sha256=72M8j3NNC19vMh0w8cuZw5s16EGZbZEbQOzW0HfBSBw,73655 +transformers/models/dia/__init__.py,sha256=fvBcwJ7FAFDO6RNyUUMGrdSlUtowciNo3YYv7R2Qz1c,1133 +transformers/models/dia/__pycache__/__init__.cpython-312.pyc,, +transformers/models/dia/__pycache__/configuration_dia.cpython-312.pyc,, +transformers/models/dia/__pycache__/feature_extraction_dia.cpython-312.pyc,, +transformers/models/dia/__pycache__/generation_dia.cpython-312.pyc,, +transformers/models/dia/__pycache__/modeling_dia.cpython-312.pyc,, +transformers/models/dia/__pycache__/modular_dia.cpython-312.pyc,, +transformers/models/dia/__pycache__/processing_dia.cpython-312.pyc,, +transformers/models/dia/__pycache__/tokenization_dia.cpython-312.pyc,, +transformers/models/dia/configuration_dia.py,sha256=Swh0mNqV1B8fsxLnxQahr6qTsbMTniejhTIkfMeKLvk,16037 +transformers/models/dia/feature_extraction_dia.py,sha256=6-jSEtsGgLZx8gbI9MC_MVbTdfyz6fnpc6olNxPkcD8,8353 +transformers/models/dia/generation_dia.py,sha256=nzF61cxnD910FkSRKR6zoqu0r8MxPy10THfa0WIzor8,21486 +transformers/models/dia/modeling_dia.py,sha256=WMofJsgoG5ZFyNvx_XgtUh02yw1YQYUiJSHZF6dm2KE,40523 +transformers/models/dia/modular_dia.py,sha256=zJ1hgG2OaX-tpqdHbJysbsCo15Tr6QbMBVR6uLG7a4w,30182 +transformers/models/dia/processing_dia.py,sha256=P2-E6-6QQJl5YcBG1CM7JmUuTjbXXDbO-SKqSBUpqJA,20782 +transformers/models/dia/tokenization_dia.py,sha256=lWhjp7RgJ5Ok8TErIHH12dMHzbRPt9Q_m5_AgwUP5JY,4489 +transformers/models/dialogpt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +transformers/models/dialogpt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/diffllama/__init__.py,sha256=Yosk5eQ82PblntLff-bL3pfJZ-AVKp5jbQK5R2SLVc8,1004 +transformers/models/diffllama/__pycache__/__init__.cpython-312.pyc,, +transformers/models/diffllama/__pycache__/configuration_diffllama.cpython-312.pyc,, +transformers/models/diffllama/__pycache__/modeling_diffllama.cpython-312.pyc,, +transformers/models/diffllama/__pycache__/modular_diffllama.cpython-312.pyc,, +transformers/models/diffllama/configuration_diffllama.py,sha256=XTiEO3lP4HDImFNGPybRaCDC9yjcZpVj4bSPjFn9ht0,7812 +transformers/models/diffllama/modeling_diffllama.py,sha256=86y5Cegle2KcsrgpAZnvpAtZ2HqNZJI40qR2P5gZJ7k,35108 +transformers/models/diffllama/modular_diffllama.py,sha256=pHiUWgmi83f0xGMJOkgLNGUJZSonWbFHlFPoy4sdc80,19073 +transformers/models/dinat/__init__.py,sha256=N0HykajUSY5KsvPQNUxc8jAuuJntmDJ-Dz8Qa8_sJ9E,991 +transformers/models/dinat/__pycache__/__init__.cpython-312.pyc,, +transformers/models/dinat/__pycache__/configuration_dinat.cpython-312.pyc,, +transformers/models/dinat/__pycache__/modeling_dinat.cpython-312.pyc,, +transformers/models/dinat/configuration_dinat.py,sha256=rtRc6yrNLl1NBCp1iHtnIP2FiJnrhoBbAyvoEfusf_8,7196 +transformers/models/dinat/modeling_dinat.py,sha256=bTLuaSsMNTz5fAD-3TpcyyeUghYfkHpBxFabJve0XVs,31396 +transformers/models/dinov2/__init__.py,sha256=OvrAMlhyPaMvvE5W2x3hxQ6EjkPYZgesizI_jOC5K3E,993 +transformers/models/dinov2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/dinov2/__pycache__/configuration_dinov2.cpython-312.pyc,, +transformers/models/dinov2/__pycache__/modeling_dinov2.cpython-312.pyc,, +transformers/models/dinov2/configuration_dinov2.py,sha256=AMMGX-4R0xwnx7nBlbpCUhU8PfR9yAg6cxBDeELrhsI,7574 +transformers/models/dinov2/modeling_dinov2.py,sha256=GIzisMmp4WMcOhUreCHklVBYTk9W38Syw54dRL9GcDw,25325 +transformers/models/dinov2_with_registers/__init__.py,sha256=s0cefgSRnlIVcdZYV0qz3Q9X3IEChU7mkGbbnr2IH6E,1023 +transformers/models/dinov2_with_registers/__pycache__/__init__.cpython-312.pyc,, +transformers/models/dinov2_with_registers/__pycache__/configuration_dinov2_with_registers.cpython-312.pyc,, +transformers/models/dinov2_with_registers/__pycache__/modeling_dinov2_with_registers.cpython-312.pyc,, +transformers/models/dinov2_with_registers/__pycache__/modular_dinov2_with_registers.cpython-312.pyc,, +transformers/models/dinov2_with_registers/configuration_dinov2_with_registers.py,sha256=qJQexsJEHcqK1Wiof71llu2OGa41COKI2yVyg9DrAKM,8474 +transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py,sha256=Dq_ISTP0hkH03go2DG3KBUu58xi6J7IOVfLbsUwHXCQ,27619 +transformers/models/dinov2_with_registers/modular_dinov2_with_registers.py,sha256=cRdtE-es0rLtPz7CIP0Bb_89HG4YRPaJtrwhcKsCwTA,18830 +transformers/models/dinov3_convnext/__init__.py,sha256=8VOE7Jnq3g2JBuwkVcsFoZEerdZF5dn2p5XZ26BMRY4,1011 +transformers/models/dinov3_convnext/__pycache__/__init__.cpython-312.pyc,, +transformers/models/dinov3_convnext/__pycache__/configuration_dinov3_convnext.cpython-312.pyc,, +transformers/models/dinov3_convnext/__pycache__/modeling_dinov3_convnext.cpython-312.pyc,, +transformers/models/dinov3_convnext/configuration_dinov3_convnext.py,sha256=_tvzf7vZq4wtpryOp3tvlEzCKwFg2bKp2mI-tOchnOM,5494 +transformers/models/dinov3_convnext/modeling_dinov3_convnext.py,sha256=BX4ptxOF7uzkgMvIOz-d6j8H41OXSaf8hYjTMaSmp2c,11665 +transformers/models/dinov3_vit/__init__.py,sha256=DYSqKAAuJCZAhQyu7pcechuSR025KnzcKNtJIafTq1E,1053 +transformers/models/dinov3_vit/__pycache__/__init__.cpython-312.pyc,, +transformers/models/dinov3_vit/__pycache__/configuration_dinov3_vit.cpython-312.pyc,, +transformers/models/dinov3_vit/__pycache__/image_processing_dinov3_vit_fast.cpython-312.pyc,, +transformers/models/dinov3_vit/__pycache__/modeling_dinov3_vit.cpython-312.pyc,, +transformers/models/dinov3_vit/__pycache__/modular_dinov3_vit.cpython-312.pyc,, +transformers/models/dinov3_vit/configuration_dinov3_vit.py,sha256=JBfI2Amz3X6Ui6R8X3593J3ePBbRt5vP0eetzPEUf38,8922 +transformers/models/dinov3_vit/image_processing_dinov3_vit_fast.py,sha256=UTZsVUraoQkqdbJD3d6uIXktU1pL10tAsYmc4lqpgho,3785 +transformers/models/dinov3_vit/modeling_dinov3_vit.py,sha256=8ej9_lhvaRniKbcrlTigiK9QCmfGWQHIjKhcp5VtwL0,24523 +transformers/models/dinov3_vit/modular_dinov3_vit.py,sha256=btlOJ7xLGQj4qltmydRYWaebtJVlVsqZHYSEN6HpM40,19792 +transformers/models/distilbert/__init__.py,sha256=g2DClKY8TLVEIIc78BEBK1nFt50A0aVoL2o3OVuF_yE,1087 +transformers/models/distilbert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/distilbert/__pycache__/configuration_distilbert.cpython-312.pyc,, +transformers/models/distilbert/__pycache__/modeling_distilbert.cpython-312.pyc,, +transformers/models/distilbert/__pycache__/tokenization_distilbert.cpython-312.pyc,, +transformers/models/distilbert/configuration_distilbert.py,sha256=Rk-RpZhopJaxGI-bf0SFzbN4U6e1-kWoqup5nCLF_wg,5645 +transformers/models/distilbert/modeling_distilbert.py,sha256=P60z4xDcBIWn0tLy-WZ-KqQM1gW89KEYl59g7rQI2yU,40033 +transformers/models/distilbert/tokenization_distilbert.py,sha256=BeXGmu3Y-cDILXqWBBWipyXXTluNyemzkquubE2lhFs,1716 +transformers/models/dit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +transformers/models/dit/__pycache__/__init__.cpython-312.pyc,, +transformers/models/doge/__init__.py,sha256=VtPJpOlqDfo3mV2yzOowL6LTgQkm61JpmgaSmQX18t4,1009 +transformers/models/doge/__pycache__/__init__.cpython-312.pyc,, +transformers/models/doge/__pycache__/configuration_doge.cpython-312.pyc,, +transformers/models/doge/__pycache__/modeling_doge.cpython-312.pyc,, +transformers/models/doge/__pycache__/modular_doge.cpython-312.pyc,, +transformers/models/doge/configuration_doge.py,sha256=R7BarJ0XvOZxUTIDRVkFrnd8nwQlayItqUCluudxkcw,11251 +transformers/models/doge/modeling_doge.py,sha256=1pj508z4ZETHVkgAaMxlZ0pnGOICT1Af0HMArsB-kMc,37130 +transformers/models/doge/modular_doge.py,sha256=7ayRpBKtMuDCrCr2KjANYC5Zhq7deTyoTCoee5usotc,34223 +transformers/models/donut/__init__.py,sha256=O1JOQtPxtjcxSfWgC_PUZkmfvcKzjPgNAakujNra1PA,1170 +transformers/models/donut/__pycache__/__init__.cpython-312.pyc,, +transformers/models/donut/__pycache__/configuration_donut_swin.cpython-312.pyc,, +transformers/models/donut/__pycache__/image_processing_donut.cpython-312.pyc,, +transformers/models/donut/__pycache__/image_processing_donut_fast.cpython-312.pyc,, +transformers/models/donut/__pycache__/modeling_donut_swin.cpython-312.pyc,, +transformers/models/donut/__pycache__/processing_donut.cpython-312.pyc,, +transformers/models/donut/configuration_donut_swin.py,sha256=SCjrLe7uGr7eOrIMW8M5PAK0Ei-hKo9ayT1fDPE-SIc,5770 +transformers/models/donut/image_processing_donut.py,sha256=FBr0kdbC5rbPk54m0720vksabRuBNIk32MZF-Naoz00,22228 +transformers/models/donut/image_processing_donut_fast.py,sha256=kSUh5i3UTCMvfwsTVXA5csUwrcBiUbSF-1yKbU0ZvuM,9177 +transformers/models/donut/modeling_donut_swin.py,sha256=Ou_ndzqYJ6cXTJa-BghF4UjgY5jhnXRtzofAyVlF8H0,42263 +transformers/models/donut/processing_donut.py,sha256=lBJU3ezF9anLjKfhib448PCzwZ8q1WDOLH-fAdlr6dk,5287 +transformers/models/dots1/__init__.py,sha256=A2jXARtNWOrbWAW2SIrsvvydm2_2keRyUBbNEz0By-I,991 +transformers/models/dots1/__pycache__/__init__.cpython-312.pyc,, +transformers/models/dots1/__pycache__/configuration_dots1.cpython-312.pyc,, +transformers/models/dots1/__pycache__/modeling_dots1.cpython-312.pyc,, +transformers/models/dots1/__pycache__/modular_dots1.cpython-312.pyc,, +transformers/models/dots1/configuration_dots1.py,sha256=tPNOvhnrDkIhLpN-mW8XZw5hXXYm5UA2IyHB4LYwM_g,10716 +transformers/models/dots1/modeling_dots1.py,sha256=u_o_ucrFYjJxmO0OcK_2PfgboTbOUFdnCJpdOt9JXQA,29600 +transformers/models/dots1/modular_dots1.py,sha256=Zx07vgiM2UmQbh4R9669e0sUqsjglaNVZw3a86tcKlo,4587 +transformers/models/dpr/__init__.py,sha256=YLpIDXI8WhGlQM_ED82JpDIdk4k0C8HKgw5Qigt5NkY,1064 +transformers/models/dpr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/dpr/__pycache__/configuration_dpr.cpython-312.pyc,, +transformers/models/dpr/__pycache__/modeling_dpr.cpython-312.pyc,, +transformers/models/dpr/__pycache__/tokenization_dpr.cpython-312.pyc,, +transformers/models/dpr/__pycache__/tokenization_dpr_fast.cpython-312.pyc,, +transformers/models/dpr/configuration_dpr.py,sha256=GFtTbX6CHzNaHL3WrttQkBgmPDxarQ02_EtHXT8ZJfw,6489 +transformers/models/dpr/modeling_dpr.py,sha256=B_uY-YTmr8hKVKCE64gokoq4tqEnqw239d_zDN79EKY,21848 +transformers/models/dpr/tokenization_dpr.py,sha256=7cfukFJ146eWUSK2euLdUWbZeVjpltfEapqB6aliLGY,16128 +transformers/models/dpr/tokenization_dpr_fast.py,sha256=ObKSKMda0tBWvBA1uNjQlZMtNK0EJ3b7qUkXDRhgd38,16020 +transformers/models/dpt/__init__.py,sha256=7i4wNFCo8NTFsJQi7TO9u0VGxpZ8xg1_QNvD862jNk4,1114 +transformers/models/dpt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/dpt/__pycache__/configuration_dpt.cpython-312.pyc,, +transformers/models/dpt/__pycache__/image_processing_dpt.cpython-312.pyc,, +transformers/models/dpt/__pycache__/image_processing_dpt_fast.cpython-312.pyc,, +transformers/models/dpt/__pycache__/modeling_dpt.cpython-312.pyc,, +transformers/models/dpt/__pycache__/modular_dpt.cpython-312.pyc,, +transformers/models/dpt/configuration_dpt.py,sha256=_lJYB-ch2xGsaYjos9M8IgSxqKAlKFuePx7DMfDG6q8,11668 +transformers/models/dpt/image_processing_dpt.py,sha256=3gTA-CC5_eBXDQKc8Ne8aH3XmZMJnRj8fUgRlQbPo9U,32105 +transformers/models/dpt/image_processing_dpt_fast.py,sha256=y59Qn0SSBcK7wEjNXnTFUoIrxZxZ0wDMw4wB5o2851Y,15628 +transformers/models/dpt/modeling_dpt.py,sha256=0OvrMDjbKNq8jbhaQSlGmPEr5QlPbOJTepoIHsHrrE4,48306 +transformers/models/dpt/modular_dpt.py,sha256=ps6WtygQYgCG-fR4nIp1SsTbtf_72L4F_3Rom8S7hZY,10479 +transformers/models/edgetam/__init__.py,sha256=oGzMZGNhQp2fv5UQEYcLdYLUIRQEnn3_vucmlOvmM_o,995 +transformers/models/edgetam/__pycache__/__init__.cpython-312.pyc,, +transformers/models/edgetam/__pycache__/configuration_edgetam.cpython-312.pyc,, +transformers/models/edgetam/__pycache__/modeling_edgetam.cpython-312.pyc,, +transformers/models/edgetam/__pycache__/modular_edgetam.cpython-312.pyc,, +transformers/models/edgetam/configuration_edgetam.py,sha256=isGXAI-MEswVuIl1jN6v9Qhezm2xqxw0rD8qoRr3qX8,15752 +transformers/models/edgetam/modeling_edgetam.py,sha256=5YKRi6qEA6EuK14hnD_Vi_govBYQ9XN6FckRpkvQlp0,58870 +transformers/models/edgetam/modular_edgetam.py,sha256=DN8bEi_CH4EQcoA_TxRBvoES6anCZsO0AxEpk-eiEMI,12139 +transformers/models/edgetam_video/__init__.py,sha256=aNgAv9cdlvg857E879-BnK4HwZ-LuC1LC2fw8hOPtFU,1008 +transformers/models/edgetam_video/__pycache__/__init__.cpython-312.pyc,, +transformers/models/edgetam_video/__pycache__/configuration_edgetam_video.cpython-312.pyc,, +transformers/models/edgetam_video/__pycache__/modeling_edgetam_video.cpython-312.pyc,, +transformers/models/edgetam_video/__pycache__/modular_edgetam_video.cpython-312.pyc,, +transformers/models/edgetam_video/configuration_edgetam_video.py,sha256=YmXZfXvSHOuT2iNmoqkn62mmCYFGNM1I6IGoqAkLjyI,23952 +transformers/models/edgetam_video/modeling_edgetam_video.py,sha256=Ajau-Zd8sIl1xZrLz2xhkzXkVRsHxvZpTNTgAzD_ZkM,146530 +transformers/models/edgetam_video/modular_edgetam_video.py,sha256=VyOA8dMAkhAyELT2C_xuLPqHUvuj77--5mQ8k74uV_4,71115 +transformers/models/efficientloftr/__init__.py,sha256=tG2whk3HBxtW2jyKIXiiHuLxzHhaGo8YmfxgZbX-57k,1116 +transformers/models/efficientloftr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/efficientloftr/__pycache__/configuration_efficientloftr.cpython-312.pyc,, +transformers/models/efficientloftr/__pycache__/image_processing_efficientloftr.cpython-312.pyc,, +transformers/models/efficientloftr/__pycache__/image_processing_efficientloftr_fast.cpython-312.pyc,, +transformers/models/efficientloftr/__pycache__/modeling_efficientloftr.cpython-312.pyc,, +transformers/models/efficientloftr/__pycache__/modular_efficientloftr.cpython-312.pyc,, +transformers/models/efficientloftr/configuration_efficientloftr.py,sha256=mxRxEWagKcvL1eTY_zz3I4LeL4VMhwj5o9cmkHmxtbo,9406 +transformers/models/efficientloftr/image_processing_efficientloftr.py,sha256=arxSJJ0BH7IjA4hbA6HBmXT3H17UvmAW5pnB6YM1p6E,21509 +transformers/models/efficientloftr/image_processing_efficientloftr_fast.py,sha256=wi7p8ESzwEdyi9tsTbSrRyLEzLLSYruPzH1pUS_-HTw,12433 +transformers/models/efficientloftr/modeling_efficientloftr.py,sha256=h8KFcfzfW5BucRke4rX6voluLdwBHrwyPyWSmpsQ5Vw,61444 +transformers/models/efficientloftr/modular_efficientloftr.py,sha256=F0rcfYhynItNCvyjMhLazwuocF2UWpjKgGFhMXTNN6E,3263 +transformers/models/efficientnet/__init__.py,sha256=0wxLCBxWBCh8uj4nH1syYJ76kRvUlMS6EUN5E2L2Qwc,1108 +transformers/models/efficientnet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/efficientnet/__pycache__/configuration_efficientnet.cpython-312.pyc,, +transformers/models/efficientnet/__pycache__/image_processing_efficientnet.cpython-312.pyc,, +transformers/models/efficientnet/__pycache__/image_processing_efficientnet_fast.cpython-312.pyc,, +transformers/models/efficientnet/__pycache__/modeling_efficientnet.cpython-312.pyc,, +transformers/models/efficientnet/configuration_efficientnet.py,sha256=EnjJHPh_xZDW0jbYWL6HOg1l1VVBTBVu9LLXB19t3pA,7076 +transformers/models/efficientnet/image_processing_efficientnet.py,sha256=eD8RII0RaBMkKZBe3YL6yGqcdj3b3LicuPt2HIcfTm4,18470 +transformers/models/efficientnet/image_processing_efficientnet_fast.py,sha256=_lS_kf94Y8Q54507kM7592sgtrjtEHkqk0JtSri6F7Q,7180 +transformers/models/efficientnet/modeling_efficientnet.py,sha256=aeauNMai59TDV9rLPLyVOAGrqhVOnIG7brKG2C_rW1c,20366 +transformers/models/electra/__init__.py,sha256=foRaRrXexLO6dUKs4iPX0nc27V1AuGrUur66Ih64Zk4,1070 +transformers/models/electra/__pycache__/__init__.cpython-312.pyc,, +transformers/models/electra/__pycache__/configuration_electra.cpython-312.pyc,, +transformers/models/electra/__pycache__/modeling_electra.cpython-312.pyc,, +transformers/models/electra/configuration_electra.py,sha256=aD8-jenY8A4q_F5iYvu0vHWeTl-Zry7sm9EZ0VvQ9O4,8088 +transformers/models/electra/modeling_electra.py,sha256=O4IP91Op_paAy4NWF_CJQkyElP2_K0jr8ST7ol3fAjI,58467 +transformers/models/emu3/__init__.py,sha256=VEBLADqeToacty2xd3Zu0F_fLQRxvhfiKPkuB9jwcFM,1070 +transformers/models/emu3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/emu3/__pycache__/configuration_emu3.cpython-312.pyc,, +transformers/models/emu3/__pycache__/image_processing_emu3.cpython-312.pyc,, +transformers/models/emu3/__pycache__/modeling_emu3.cpython-312.pyc,, +transformers/models/emu3/__pycache__/modular_emu3.cpython-312.pyc,, +transformers/models/emu3/__pycache__/processing_emu3.cpython-312.pyc,, +transformers/models/emu3/configuration_emu3.py,sha256=yONcECjqiD25t1cbMuZzoTDGlmuIZxWUswf0Htzk4_o,13481 +transformers/models/emu3/image_processing_emu3.py,sha256=XO61pIkkjE502c49V6TRYV-feKOg5EB1IAH8_9IWLxc,27118 +transformers/models/emu3/modeling_emu3.py,sha256=UlxjzQNzsvq8lPUgDggiaPTMtIY4I_DE29iUkTCiUGU,67692 +transformers/models/emu3/modular_emu3.py,sha256=oPLuv6hXqExcNIs40LCCia9UWoxxfzWAWYPf-NwjIyE,47874 +transformers/models/emu3/processing_emu3.py,sha256=C6s-VHhfwmNUvT-FvhG06AETbF2jUObSkXVSWUqtTI0,11488 +transformers/models/encodec/__init__.py,sha256=QbO9yEfCaRwYKbK0vvmwKMbqRAToyos-HTHhRmf7n5s,1041 +transformers/models/encodec/__pycache__/__init__.cpython-312.pyc,, +transformers/models/encodec/__pycache__/configuration_encodec.cpython-312.pyc,, +transformers/models/encodec/__pycache__/feature_extraction_encodec.cpython-312.pyc,, +transformers/models/encodec/__pycache__/modeling_encodec.cpython-312.pyc,, +transformers/models/encodec/configuration_encodec.py,sha256=Jpd4Ct4dmoDnT10dr6YSM8dd2-dmB6MQnjIckd1zLbc,8656 +transformers/models/encodec/feature_extraction_encodec.py,sha256=sVGWrleWmP3YZodQeRg6FU3mlLWPxjc-m4vK-qI_E0g,9784 +transformers/models/encodec/modeling_encodec.py,sha256=nahm0gi9hHJpuLysOruB4Sr8qwIcpuWagZKyZbnJXJg,35224 +transformers/models/encoder_decoder/__init__.py,sha256=NRHrw_Gq2RpeLthXifL3JiePYtsXaetRuhXbVkQtQUs,1011 +transformers/models/encoder_decoder/__pycache__/__init__.cpython-312.pyc,, +transformers/models/encoder_decoder/__pycache__/configuration_encoder_decoder.cpython-312.pyc,, +transformers/models/encoder_decoder/__pycache__/modeling_encoder_decoder.cpython-312.pyc,, +transformers/models/encoder_decoder/configuration_encoder_decoder.py,sha256=Bo7uLsyIUyHV_1rdhPt90JYJ9YFi3PTEwrfp-GB8QG0,5007 +transformers/models/encoder_decoder/modeling_encoder_decoder.py,sha256=yejO8tVAJSlX7HxNBxCE2yieuuX83Qlo9sgoPLu-ARQ,22527 +transformers/models/eomt/__init__.py,sha256=yXVhFSLXI_umGHqTtRHHaTevf4KwrA9LOldvY7DfuFk,1076 +transformers/models/eomt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/eomt/__pycache__/configuration_eomt.cpython-312.pyc,, +transformers/models/eomt/__pycache__/image_processing_eomt.cpython-312.pyc,, +transformers/models/eomt/__pycache__/image_processing_eomt_fast.cpython-312.pyc,, +transformers/models/eomt/__pycache__/modeling_eomt.cpython-312.pyc,, +transformers/models/eomt/__pycache__/modular_eomt.cpython-312.pyc,, +transformers/models/eomt/configuration_eomt.py,sha256=dhMJZnQ9sog1ojOFkB2ZY0jRd1tu-KKt2g6-mAmHy50,8053 +transformers/models/eomt/image_processing_eomt.py,sha256=IHFmgkExd9bgl-bsElRElRrNIHAcmo5CEtIJSYcaW48,40587 +transformers/models/eomt/image_processing_eomt_fast.py,sha256=LHYH8ETxhQDRro9yua-ZD987G9gADS-FmurOl1q97IQ,22466 +transformers/models/eomt/modeling_eomt.py,sha256=-alkhX10-SSFM0WdnTYLeouKznWxbIg7O2j7ATFdi0Y,54712 +transformers/models/eomt/modular_eomt.py,sha256=A90eBIV-1kdkKJg8SYXpbvbGc4_2TLCzDNlTOQX1xmM,25946 +transformers/models/eomt_dinov3/__init__.py,sha256=Z1U6ubtfNVB84kWYgRZX1bZy1vrJCVHKB_vfU9H1TwU,1004 +transformers/models/eomt_dinov3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/eomt_dinov3/__pycache__/configuration_eomt_dinov3.cpython-312.pyc,, +transformers/models/eomt_dinov3/__pycache__/modeling_eomt_dinov3.cpython-312.pyc,, +transformers/models/eomt_dinov3/__pycache__/modular_eomt_dinov3.cpython-312.pyc,, +transformers/models/eomt_dinov3/configuration_eomt_dinov3.py,sha256=E9chM2Iit8CSumZuXQv_w1T4hzaH17prUIbjkABUT54,10427 +transformers/models/eomt_dinov3/modeling_eomt_dinov3.py,sha256=Rghe3KeQWzBxKbyKA2a3rOKz-JlJlsEWvI-TcpoK6vs,61174 +transformers/models/eomt_dinov3/modular_eomt_dinov3.py,sha256=2LaxUnyBrOn8Wk78IEZCaygwvntZqgdhtX3Skn24Orw,19880 +transformers/models/ernie/__init__.py,sha256=TyzaXpzGwu-WqsIn1tavDqa7BCV9X-mPho4JDa9gk0I,991 +transformers/models/ernie/__pycache__/__init__.cpython-312.pyc,, +transformers/models/ernie/__pycache__/configuration_ernie.cpython-312.pyc,, +transformers/models/ernie/__pycache__/modeling_ernie.cpython-312.pyc,, +transformers/models/ernie/__pycache__/modular_ernie.cpython-312.pyc,, +transformers/models/ernie/configuration_ernie.py,sha256=j9SWHIagDdk4tivnQ-ON-lR56seMDXAP02qu-dRFWbM,7247 +transformers/models/ernie/modeling_ernie.py,sha256=Ou7nh40MNLgZ7M-wSUaEVnZa45fEkuKYwK_7Rh4nSYQ,64351 +transformers/models/ernie/modular_ernie.py,sha256=enpFHZymNzM1xkGvcAYC2JhvCeeyxTIWThfClgDDNU4,38546 +transformers/models/ernie4_5/__init__.py,sha256=5tqpitaOWvT1CdXTgMtMLCKIkUG683y3jdcTZ8yuwfM,997 +transformers/models/ernie4_5/__pycache__/__init__.cpython-312.pyc,, +transformers/models/ernie4_5/__pycache__/configuration_ernie4_5.cpython-312.pyc,, +transformers/models/ernie4_5/__pycache__/modeling_ernie4_5.cpython-312.pyc,, +transformers/models/ernie4_5/__pycache__/modular_ernie4_5.cpython-312.pyc,, +transformers/models/ernie4_5/configuration_ernie4_5.py,sha256=17rFJv-vI9AKo5VMmn4Vbo0Kg7poRurhmUNbcV4q8uo,7820 +transformers/models/ernie4_5/modeling_ernie4_5.py,sha256=3dRrxpKVhAXUp6F5oUVW7PXQ_KjyBniJbmhKkCf9CzM,21654 +transformers/models/ernie4_5/modular_ernie4_5.py,sha256=-DWvU2AvgqFoIkCidrgMKyQk2QSlFV-puDeVR88KCsk,5569 +transformers/models/ernie4_5_moe/__init__.py,sha256=MJaAQxyB3YypXN79FGJpkSvnX6KWt86iunOFXjiA7a4,1005 +transformers/models/ernie4_5_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/ernie4_5_moe/__pycache__/configuration_ernie4_5_moe.cpython-312.pyc,, +transformers/models/ernie4_5_moe/__pycache__/modeling_ernie4_5_moe.cpython-312.pyc,, +transformers/models/ernie4_5_moe/__pycache__/modular_ernie4_5_moe.cpython-312.pyc,, +transformers/models/ernie4_5_moe/configuration_ernie4_5_moe.py,sha256=JMDbfGFLiAdXpespPbyOT_1OlSWa1nxi9ud5WygwHkU,10356 +transformers/models/ernie4_5_moe/modeling_ernie4_5_moe.py,sha256=IqlPEpcq3NqP7mcTC1pnA-aVguvnSEjwUNJSKpir5oU,33076 +transformers/models/ernie4_5_moe/modular_ernie4_5_moe.py,sha256=V_da4Jg1h9_SDQBX_rHz6Fdy_2EHl7Lu3AQwUXbotdg,13072 +transformers/models/ernie4_5_vl_moe/__init__.py,sha256=b096LAMrXDv0c4xZqiMBN8Uqo9UZEqqc03Hy0QC-w6M,1241 +transformers/models/ernie4_5_vl_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/ernie4_5_vl_moe/__pycache__/configuration_ernie4_5_vl_moe.cpython-312.pyc,, +transformers/models/ernie4_5_vl_moe/__pycache__/image_processing_ernie4_5_vl_moe.cpython-312.pyc,, +transformers/models/ernie4_5_vl_moe/__pycache__/image_processing_ernie4_5_vl_moe_fast.cpython-312.pyc,, +transformers/models/ernie4_5_vl_moe/__pycache__/modeling_ernie4_5_vl_moe.cpython-312.pyc,, +transformers/models/ernie4_5_vl_moe/__pycache__/modular_ernie4_5_vl_moe.cpython-312.pyc,, +transformers/models/ernie4_5_vl_moe/__pycache__/processing_ernie4_5_vl_moe.cpython-312.pyc,, +transformers/models/ernie4_5_vl_moe/__pycache__/video_processing_ernie4_5_vl_moe.cpython-312.pyc,, +transformers/models/ernie4_5_vl_moe/configuration_ernie4_5_vl_moe.py,sha256=uaTNdgA1amHwH6Iwi9rOpM9U3aeydaNWR-v7TJmt9F0,16961 +transformers/models/ernie4_5_vl_moe/image_processing_ernie4_5_vl_moe.py,sha256=QmhgbriMzXwYFhsq03lqvvIcmMU1ZDDY9fKIrd01H3o,23377 +transformers/models/ernie4_5_vl_moe/image_processing_ernie4_5_vl_moe_fast.py,sha256=uRh71Ny2O6f3XqObdcab-OHzpTK1RVLuOSF-BgSQNgA,10147 +transformers/models/ernie4_5_vl_moe/modeling_ernie4_5_vl_moe.py,sha256=4gQadau3eIZEC6dap3OAbGN20g8GEYZidU2C61X2_wE,87742 +transformers/models/ernie4_5_vl_moe/modular_ernie4_5_vl_moe.py,sha256=iOZfD0FN2yoAQdKfPoWl90xTSIn_VIL_3fMbNcoYqe0,85884 +transformers/models/ernie4_5_vl_moe/processing_ernie4_5_vl_moe.py,sha256=1zDWgnGMZmqD22MJ-S1eMa-PCujk-YJE7msbmRUSHXo,12798 +transformers/models/ernie4_5_vl_moe/video_processing_ernie4_5_vl_moe.py,sha256=RjCbZFcjeLSMiVcQmlxjU9Do2sCKuDq0JnDoFqwvKZA,25862 +transformers/models/esm/__init__.py,sha256=TT8AHFpMRg_GNzhHdNTdh120qHr5TIal5Aouok1vTCM,1059 +transformers/models/esm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/esm/__pycache__/configuration_esm.cpython-312.pyc,, +transformers/models/esm/__pycache__/modeling_esm.cpython-312.pyc,, +transformers/models/esm/__pycache__/modeling_esmfold.cpython-312.pyc,, +transformers/models/esm/__pycache__/tokenization_esm.cpython-312.pyc,, +transformers/models/esm/configuration_esm.py,sha256=73FsoGv67OvMVbVTOqNWSV3aVA0WQ71lpYOVRjXcfec,13671 +transformers/models/esm/modeling_esm.py,sha256=pb5eEPyRBHNQ8QxC8LnuHsV4mcmudbgpjsI9xm8EPg4,39318 +transformers/models/esm/modeling_esmfold.py,sha256=fZHueu7QpWYLTVjUFASamw8aurTK6S4r7brHAzBbH6k,85457 +transformers/models/esm/openfold_utils/__init__.py,sha256=Xy2uqvFsLC8Ax-OOce5PgoBDiZgEJgJPqs__p5SBWUY,446 +transformers/models/esm/openfold_utils/__pycache__/__init__.cpython-312.pyc,, +transformers/models/esm/openfold_utils/__pycache__/chunk_utils.cpython-312.pyc,, +transformers/models/esm/openfold_utils/__pycache__/data_transforms.cpython-312.pyc,, +transformers/models/esm/openfold_utils/__pycache__/feats.cpython-312.pyc,, +transformers/models/esm/openfold_utils/__pycache__/loss.cpython-312.pyc,, +transformers/models/esm/openfold_utils/__pycache__/protein.cpython-312.pyc,, +transformers/models/esm/openfold_utils/__pycache__/residue_constants.cpython-312.pyc,, +transformers/models/esm/openfold_utils/__pycache__/rigid_utils.cpython-312.pyc,, +transformers/models/esm/openfold_utils/__pycache__/tensor_utils.cpython-312.pyc,, +transformers/models/esm/openfold_utils/chunk_utils.py,sha256=LoQvShWGqJyLyyHp9RB3P7ct8a87NMDKm_0FLcrCfDU,14357 +transformers/models/esm/openfold_utils/data_transforms.py,sha256=Q5J_BpJ_8Fa5fZ8nP6kPB5ops-Y4MydSQkwZ-_yMDBA,3688 +transformers/models/esm/openfold_utils/feats.py,sha256=QCYupsVINo5jJuwYk38TejNYkPlGm6Kfc1YpNUxpI8s,8355 +transformers/models/esm/openfold_utils/loss.py,sha256=ItYvWtSw-3tCUNtQjag7_kzfsKjPm8Oiy02lt1mwjqE,3661 +transformers/models/esm/openfold_utils/protein.py,sha256=MA6iShflwkUpZRwEefmT45Ll5KPU8lJ2IuJPyH2N_mI,11482 +transformers/models/esm/openfold_utils/residue_constants.py,sha256=-y44cw8jjQJakRSjn4MAMCeGhFSHoPzUCiMv9MfdGes,37875 +transformers/models/esm/openfold_utils/rigid_utils.py,sha256=gKiZUD7ngpTm7JqRJynvm-7dfrt3VLV0E0alUkFp-34,41006 +transformers/models/esm/openfold_utils/tensor_utils.py,sha256=_LAucmEB_4mVJY1oAIL1ls_5uJNpbSYv9J0PNDA6NQ8,4716 +transformers/models/esm/tokenization_esm.py,sha256=a1NTnhESsOiS3_-KdFcZgjHv93RkLi-2uANler5lIN0,5331 +transformers/models/evolla/__init__.py,sha256=pOj8KGoc9jqtS_PYTeNCxZUtQrlFR_txE-kdZpiAkCw,1030 +transformers/models/evolla/__pycache__/__init__.cpython-312.pyc,, +transformers/models/evolla/__pycache__/configuration_evolla.cpython-312.pyc,, +transformers/models/evolla/__pycache__/modeling_evolla.cpython-312.pyc,, +transformers/models/evolla/__pycache__/modular_evolla.cpython-312.pyc,, +transformers/models/evolla/__pycache__/processing_evolla.cpython-312.pyc,, +transformers/models/evolla/configuration_evolla.py,sha256=pUxQrOKvnGcvDNWhWQm0TBj4H1ugWvw6wrCmybt3aFA,14484 +transformers/models/evolla/modeling_evolla.py,sha256=iKH_XXp_hxptBsNzQ19DGxjFbowv_94UxClEY2f1poU,63283 +transformers/models/evolla/modular_evolla.py,sha256=7AxLW0ZVctWVo5YlW-4AMTkNLXHt6Cf-FXHmWQQROMY,37702 +transformers/models/evolla/processing_evolla.py,sha256=nj9l_xNCRBz8-wEaraNDLR5X5gZq2-snwm_iq4lowRw,8231 +transformers/models/exaone4/__init__.py,sha256=gUDbb0olRjqxaPnB3APYKYKRlDPG2phGkfrmf7mIVD4,1018 +transformers/models/exaone4/__pycache__/__init__.cpython-312.pyc,, +transformers/models/exaone4/__pycache__/configuration_exaone4.cpython-312.pyc,, +transformers/models/exaone4/__pycache__/modeling_exaone4.cpython-312.pyc,, +transformers/models/exaone4/__pycache__/modular_exaone4.cpython-312.pyc,, +transformers/models/exaone4/configuration_exaone4.py,sha256=yKxCO6lWGhQzS1O2BiazxQVDyq4FSXR7i42p1dsD_ss,10131 +transformers/models/exaone4/modeling_exaone4.py,sha256=aZ26YhAJWDxvzoN8YuqKO5r6aCigiVSngefO-FWQRx8,24748 +transformers/models/exaone4/modular_exaone4.py,sha256=dOZdZKYXkDouGiGakdeWTBsphsrdmzUUXwhppD2do-A,21185 +transformers/models/exaone_moe/__init__.py,sha256=HXJMLnAy-yxDJWMl_xQ4vgzy49kgs9xR-oWUz2MF5Xw,1024 +transformers/models/exaone_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/exaone_moe/__pycache__/configuration_exaone_moe.cpython-312.pyc,, +transformers/models/exaone_moe/__pycache__/modeling_exaone_moe.cpython-312.pyc,, +transformers/models/exaone_moe/__pycache__/modular_exaone_moe.cpython-312.pyc,, +transformers/models/exaone_moe/configuration_exaone_moe.py,sha256=bvU8aNI8KV6BFPLWndnrDarSwciIFLpbJ5R0wwRas2s,12244 +transformers/models/exaone_moe/modeling_exaone_moe.py,sha256=4yUL4YA1DswXIuz6NfPWXCgcjwHU01Y-0I346l8fWX8,30533 +transformers/models/exaone_moe/modular_exaone_moe.py,sha256=at65H67-MIvd4MIVHrFjLCtqYdxALOjwjojdxlOlrqA,17152 +transformers/models/falcon/__init__.py,sha256=qmBlF_xusyrueKMfriC2ldVrHzeLIT7ruSdduMODuE4,993 +transformers/models/falcon/__pycache__/__init__.cpython-312.pyc,, +transformers/models/falcon/__pycache__/configuration_falcon.cpython-312.pyc,, +transformers/models/falcon/__pycache__/modeling_falcon.cpython-312.pyc,, +transformers/models/falcon/configuration_falcon.py,sha256=9Lp0FuPWcwmvUx7YYk-sIlVlyb-uapwdrHHZ3M6Wiw8,8808 +transformers/models/falcon/modeling_falcon.py,sha256=9L_GUlPAYMAOUmc_F5FRuQ_rCl3896uQr240Aof8bqY,56344 +transformers/models/falcon_h1/__init__.py,sha256=cpix3f3f_xMDLf2OLuyYZULnb7enZl3UZapPQuf0YZc,1012 +transformers/models/falcon_h1/__pycache__/__init__.cpython-312.pyc,, +transformers/models/falcon_h1/__pycache__/configuration_falcon_h1.cpython-312.pyc,, +transformers/models/falcon_h1/__pycache__/modeling_falcon_h1.cpython-312.pyc,, +transformers/models/falcon_h1/__pycache__/modular_falcon_h1.cpython-312.pyc,, +transformers/models/falcon_h1/configuration_falcon_h1.py,sha256=qUZ16eN7DgIiqoVyrpQNSiyqRjueAQnSX2SB12FwGgQ,15045 +transformers/models/falcon_h1/modeling_falcon_h1.py,sha256=vR-DzM2jOqaAV63ivr_KDzveUG0uYi3Bs6SUNN9nMPc,68407 +transformers/models/falcon_h1/modular_falcon_h1.py,sha256=TKs6ACs8lsdoxJY8OGqu8wrzEqYgE2qARe6SnPXaCkg,53894 +transformers/models/falcon_mamba/__init__.py,sha256=Czo-T_Nt73nvRbK-yJEZAYsU3Bxu4i1fOxFuPosiFPw,1005 +transformers/models/falcon_mamba/__pycache__/__init__.cpython-312.pyc,, +transformers/models/falcon_mamba/__pycache__/configuration_falcon_mamba.cpython-312.pyc,, +transformers/models/falcon_mamba/__pycache__/modeling_falcon_mamba.cpython-312.pyc,, +transformers/models/falcon_mamba/__pycache__/modular_falcon_mamba.cpython-312.pyc,, +transformers/models/falcon_mamba/configuration_falcon_mamba.py,sha256=6ZxnctCrxytC7iufeElNn0Bzex5AApHnHmDxLFHg1wk,8955 +transformers/models/falcon_mamba/modeling_falcon_mamba.py,sha256=a9KYX6Zv-lhT8f_PzF1YuCvFd64fDWECFqLIrVEWtRs,42353 +transformers/models/falcon_mamba/modular_falcon_mamba.py,sha256=1itqjs_yZZI28bJedRHdZ_2Ea82EobVLFKCMXzSA2bw,26234 +transformers/models/fast_vlm/__init__.py,sha256=5RFlXojuEHJ2nPYyxGIADcwSQCcVg1irLZPsgZvsgcQ,997 +transformers/models/fast_vlm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/fast_vlm/__pycache__/configuration_fast_vlm.cpython-312.pyc,, +transformers/models/fast_vlm/__pycache__/modeling_fast_vlm.cpython-312.pyc,, +transformers/models/fast_vlm/__pycache__/modular_fast_vlm.cpython-312.pyc,, +transformers/models/fast_vlm/configuration_fast_vlm.py,sha256=rhqojsMOhJiKXg_VIb0FHflyDVZ9H2av3dFXfMdfMJE,6969 +transformers/models/fast_vlm/modeling_fast_vlm.py,sha256=ldCmIQ16OQCymT6XXDXWzJHANndHKQp6s99rKz0vieo,19440 +transformers/models/fast_vlm/modular_fast_vlm.py,sha256=kzwt_Hjw1IyFTM4qlBIcDlUcb1jFJXvf442UOIw_orY,16648 +transformers/models/fastspeech2_conformer/__init__.py,sha256=pILmX51CcqSiFGtl_dsX1yW2S_QugA3UHAT8f4psOtA,1077 +transformers/models/fastspeech2_conformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/fastspeech2_conformer/__pycache__/configuration_fastspeech2_conformer.cpython-312.pyc,, +transformers/models/fastspeech2_conformer/__pycache__/modeling_fastspeech2_conformer.cpython-312.pyc,, +transformers/models/fastspeech2_conformer/__pycache__/tokenization_fastspeech2_conformer.cpython-312.pyc,, +transformers/models/fastspeech2_conformer/configuration_fastspeech2_conformer.py,sha256=nqHCJWOkSFfzvlvGJUOLfX7uuq8QtPIhwc4iqr4ITAY,24797 +transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py,sha256=YMJtN8P_YS3QRH65E8JuKYqouR3lr8ptqnz696zpm4g,70272 +transformers/models/fastspeech2_conformer/tokenization_fastspeech2_conformer.py,sha256=F5D0ttj52fzIrhefFP-w7v1GQANukmv-sYW1b117hZQ,6256 +transformers/models/flaubert/__init__.py,sha256=qjdNghRds8za303ngqPdZ5rqK6zT84rcumEAjitmWi4,1038 +transformers/models/flaubert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/flaubert/__pycache__/configuration_flaubert.cpython-312.pyc,, +transformers/models/flaubert/__pycache__/modeling_flaubert.cpython-312.pyc,, +transformers/models/flaubert/__pycache__/tokenization_flaubert.cpython-312.pyc,, +transformers/models/flaubert/configuration_flaubert.py,sha256=2Jln1Bqen5ezXszsBuQOTfd1mO2ZvX7NmvpPDbUvg1w,10797 +transformers/models/flaubert/modeling_flaubert.py,sha256=UxboBRkZxAq_wKx3EUPpizeBlsBfWjZH_tP5CvU1ZNc,77718 +transformers/models/flaubert/tokenization_flaubert.py,sha256=CoczyQLIL-XC4V0ug7tr3rL132vKugO2JFaeU2dq9YA,20919 +transformers/models/flava/__init__.py,sha256=UZ-PnfpalIOh2pPXWj_WSjsxjLgMBh2kKVyyLsNTUOk,1160 +transformers/models/flava/__pycache__/__init__.cpython-312.pyc,, +transformers/models/flava/__pycache__/configuration_flava.cpython-312.pyc,, +transformers/models/flava/__pycache__/image_processing_flava.cpython-312.pyc,, +transformers/models/flava/__pycache__/image_processing_flava_fast.cpython-312.pyc,, +transformers/models/flava/__pycache__/modeling_flava.cpython-312.pyc,, +transformers/models/flava/__pycache__/processing_flava.cpython-312.pyc,, +transformers/models/flava/configuration_flava.py,sha256=rVHuEug7oH2nAuRAIhu7aq8hl55aNpUa2CZuWPGNKxQ,32919 +transformers/models/flava/image_processing_flava.py,sha256=DIj0KvgVEWaT38JUmBSf-2yIWIJCUOKkNzDXqKrIsog,42407 +transformers/models/flava/image_processing_flava_fast.py,sha256=W_oL1VbU7O3K3OcONQUo18sl5wRUt_SWIHceoFENXp8,16408 +transformers/models/flava/modeling_flava.py,sha256=hlLjjLM0ES8KN7y9wr1nfH22JBDr1yDup2GurAbAX80,89356 +transformers/models/flava/processing_flava.py,sha256=gZiybXA2r8vs1P9AxGalkHDlcM6scMUhWNUyeyUe0JU,974 +transformers/models/flex_olmo/__init__.py,sha256=6_Fhd7qPsgNuP-c5XXBFy6YvzC_qExXPzfR48w19o3c,1000 +transformers/models/flex_olmo/__pycache__/__init__.cpython-312.pyc,, +transformers/models/flex_olmo/__pycache__/configuration_flex_olmo.cpython-312.pyc,, +transformers/models/flex_olmo/__pycache__/modeling_flex_olmo.cpython-312.pyc,, +transformers/models/flex_olmo/__pycache__/modular_flex_olmo.cpython-312.pyc,, +transformers/models/flex_olmo/configuration_flex_olmo.py,sha256=PvpTfZPNXHeaBwOBNfYXrbWd-mbY5PRUlC3H80ecmMk,10093 +transformers/models/flex_olmo/modeling_flex_olmo.py,sha256=AP3aLrhO9sjqwEEbr-cmDpleD-dxYJ_Gyi-8TE7ZQ_g,31370 +transformers/models/flex_olmo/modular_flex_olmo.py,sha256=cRPoQWm8EYQVphjGeQ0uaVVa1bUAY82hK_j6oUC1vL4,15943 +transformers/models/florence2/__init__.py,sha256=H4rJT4tWJithwWolb041i7SM693Y_-oO8hhdePbjYpY,1039 +transformers/models/florence2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/florence2/__pycache__/configuration_florence2.cpython-312.pyc,, +transformers/models/florence2/__pycache__/modeling_florence2.cpython-312.pyc,, +transformers/models/florence2/__pycache__/modular_florence2.cpython-312.pyc,, +transformers/models/florence2/__pycache__/processing_florence2.cpython-312.pyc,, +transformers/models/florence2/configuration_florence2.py,sha256=do5yp0fGmfgHcQMbAUypctgXb4hobImpaey_rGLK13k,9830 +transformers/models/florence2/modeling_florence2.py,sha256=l5Iy1k9neGI7W7QRLQ7MsdfbXihU2oIcqluUUYbhh5M,43211 +transformers/models/florence2/modular_florence2.py,sha256=3yqlKO6K2P6TPBSgMUzqBoiS8pMAgrL1REUkzYkSckk,76814 +transformers/models/florence2/processing_florence2.py,sha256=aITPB3f8K1g35BvbRDw-7b_jElRaGr-d6uTQdKsr8bc,34330 +transformers/models/fnet/__init__.py,sha256=mgas9n6aWayAl9GsoRBmd70n-8gTEB0vq6hXceuu4QE,1057 +transformers/models/fnet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/fnet/__pycache__/configuration_fnet.cpython-312.pyc,, +transformers/models/fnet/__pycache__/modeling_fnet.cpython-312.pyc,, +transformers/models/fnet/__pycache__/tokenization_fnet.cpython-312.pyc,, +transformers/models/fnet/configuration_fnet.py,sha256=asC94EQd4Jbrgxhf_JMul2dXdVnDarU2n1M5qoSEBSE,5645 +transformers/models/fnet/modeling_fnet.py,sha256=qkdOid_lfFERoCUXdQGlOaP__bErkkehP_vtsX0Ub34,42608 +transformers/models/fnet/tokenization_fnet.py,sha256=udORINJoinlRY1mE-K5CKF2RUZOFHcwW5xN2xXfWO-g,3226 +transformers/models/focalnet/__init__.py,sha256=kFk7pYv4troBIWdCYosHMKh8PAnpXqjlxaRRQ5adkG0,997 +transformers/models/focalnet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/focalnet/__pycache__/configuration_focalnet.cpython-312.pyc,, +transformers/models/focalnet/__pycache__/modeling_focalnet.cpython-312.pyc,, +transformers/models/focalnet/configuration_focalnet.py,sha256=ocfvVXZyIk3sjdqviB6ZuOjbFwb2D-7LniQms7iR_aQ,7897 +transformers/models/focalnet/modeling_focalnet.py,sha256=9o2xvv-wTk9HWWJmlp2RM_0JL_v1xvRU_qTVDYenLBA,36659 +transformers/models/fsmt/__init__.py,sha256=u_Xx7d3qDicqwR_W0js1h2wPiLKWM1RlMu7fsBdIHy4,1026 +transformers/models/fsmt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/fsmt/__pycache__/configuration_fsmt.cpython-312.pyc,, +transformers/models/fsmt/__pycache__/modeling_fsmt.cpython-312.pyc,, +transformers/models/fsmt/__pycache__/tokenization_fsmt.cpython-312.pyc,, +transformers/models/fsmt/configuration_fsmt.py,sha256=zMO8a6kCF9J1IUiEAASdDT12bbB92O8H4Fyzm1o58sE,10140 +transformers/models/fsmt/modeling_fsmt.py,sha256=KW_ic21kxrNZEliI08iP7PpbM089kmURzgIu_nOKiMo,46933 +transformers/models/fsmt/tokenization_fsmt.py,sha256=SUXZffNt4x4Rc3xgB3XP2pled00mgCRpkNxy9pMrr1U,17893 +transformers/models/funnel/__init__.py,sha256=Splt8ur4jydU5mQDedRgc9OIezrmQdoOXtEMb6AURDU,1100 +transformers/models/funnel/__pycache__/__init__.cpython-312.pyc,, +transformers/models/funnel/__pycache__/configuration_funnel.cpython-312.pyc,, +transformers/models/funnel/__pycache__/modeling_funnel.cpython-312.pyc,, +transformers/models/funnel/__pycache__/tokenization_funnel.cpython-312.pyc,, +transformers/models/funnel/configuration_funnel.py,sha256=0UEvUgAFlG3cK5ZeflSrIOwSP7e0jKWmICmnCKBJxJI,7969 +transformers/models/funnel/modeling_funnel.py,sha256=BwSBGjPfgwFTQII1Qupo1RjRjKgp_R8c9GS2xE5vEkg,57857 +transformers/models/funnel/tokenization_funnel.py,sha256=G2HlIGS88ivH_5DF1F7-L9Ww72RdzSYDO6XiqzZTuTI,6792 +transformers/models/fuyu/__init__.py,sha256=bZi77XDrzLji-rn9aS4eLY1Bh-hSB9Ibc6IxUkARBGk,1111 +transformers/models/fuyu/__pycache__/__init__.cpython-312.pyc,, +transformers/models/fuyu/__pycache__/configuration_fuyu.cpython-312.pyc,, +transformers/models/fuyu/__pycache__/image_processing_fuyu.cpython-312.pyc,, +transformers/models/fuyu/__pycache__/image_processing_fuyu_fast.cpython-312.pyc,, +transformers/models/fuyu/__pycache__/modeling_fuyu.cpython-312.pyc,, +transformers/models/fuyu/__pycache__/processing_fuyu.cpython-312.pyc,, +transformers/models/fuyu/configuration_fuyu.py,sha256=GD57COQ50-wXe6UYOtwnmed2VVX6bWT5J8J8S5vYh7A,8651 +transformers/models/fuyu/image_processing_fuyu.py,sha256=bXdoGjLig3EmA1Tv3q14iE8d74-Yv-sotEpHo0ZTfxA,33958 +transformers/models/fuyu/image_processing_fuyu_fast.py,sha256=lHtcgsbjmtrUiqhtxVs-Eyfm2x2M9RrPCwqJlNEVyMc,17173 +transformers/models/fuyu/modeling_fuyu.py,sha256=Cb4PfRxtBTVpoz4QmxodmF1_6GXRetBSNGqkeIFANsk,17619 +transformers/models/fuyu/processing_fuyu.py,sha256=C9VGoeAZCJSoliwU6SeTveaGIuKVKNBMn6zz4_Qbx50,35522 +transformers/models/gemma/__init__.py,sha256=LH4Ol4ZYhkhYMywv0wWsYggrcbX1UOsAMD-psGm8P-c,1072 +transformers/models/gemma/__pycache__/__init__.cpython-312.pyc,, +transformers/models/gemma/__pycache__/configuration_gemma.cpython-312.pyc,, +transformers/models/gemma/__pycache__/modeling_gemma.cpython-312.pyc,, +transformers/models/gemma/__pycache__/modular_gemma.cpython-312.pyc,, +transformers/models/gemma/__pycache__/tokenization_gemma.cpython-312.pyc,, +transformers/models/gemma/configuration_gemma.py,sha256=wQXNyYNfANO_C0oZV01zNf40p6NMYmM53uyfAlJH2jI,8843 +transformers/models/gemma/modeling_gemma.py,sha256=vxz7wcZfzfyTQQ-hmQqq407CRPBTE6FtH_mQncbBhA4,22503 +transformers/models/gemma/modular_gemma.py,sha256=asow0VPgCVmW4cugkhSWBWc0HiMK4dNXuv2mlgCYkoU,14298 +transformers/models/gemma/tokenization_gemma.py,sha256=hXhgr-6dIOmyXiPQiDZTMNspwdHEXyXWJmPl10SJzmE,3826 +transformers/models/gemma2/__init__.py,sha256=H0jWJX-AcGRTjdzkGJagKnjB6GnpqVUG4ODFhMF9OWM,993 +transformers/models/gemma2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/gemma2/__pycache__/configuration_gemma2.cpython-312.pyc,, +transformers/models/gemma2/__pycache__/modeling_gemma2.cpython-312.pyc,, +transformers/models/gemma2/__pycache__/modular_gemma2.cpython-312.pyc,, +transformers/models/gemma2/configuration_gemma2.py,sha256=RIt2n-quaZyrI5uTpdzkaEB6Av0WKhsuVjc0muRhUwM,10528 +transformers/models/gemma2/modeling_gemma2.py,sha256=-rn8FGu1PAoDBaFSigvaBmHzQ7mZYqOfZXqFAVV5x5s,24482 +transformers/models/gemma2/modular_gemma2.py,sha256=amG5MmBSlwuBEdjoS6irPprip2I5pRMiRrrqS2RUVbM,25080 +transformers/models/gemma3/__init__.py,sha256=yDt-ADg8e57SlRlpfsC7KzQCeYYgUrTz9ZO5VC5v_W4,1121 +transformers/models/gemma3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/gemma3/__pycache__/configuration_gemma3.cpython-312.pyc,, +transformers/models/gemma3/__pycache__/image_processing_gemma3.cpython-312.pyc,, +transformers/models/gemma3/__pycache__/image_processing_gemma3_fast.cpython-312.pyc,, +transformers/models/gemma3/__pycache__/modeling_gemma3.cpython-312.pyc,, +transformers/models/gemma3/__pycache__/modular_gemma3.cpython-312.pyc,, +transformers/models/gemma3/__pycache__/processing_gemma3.cpython-312.pyc,, +transformers/models/gemma3/configuration_gemma3.py,sha256=MlkRMFzItxdsOoaNGb5tig2mHMvYr6vMlC6WuW6BXBA,16971 +transformers/models/gemma3/image_processing_gemma3.py,sha256=lFj0lrwXUJ5r-rt3i6zFSUIZWB9DSAFupZHovhd83jA,20426 +transformers/models/gemma3/image_processing_gemma3_fast.py,sha256=2t2vOgrDsYz4ay9T_qmUzaZaoizsB8ba9PHaBUeRxN4,10099 +transformers/models/gemma3/modeling_gemma3.py,sha256=oRFe354MSjtTZX8h4t5d4KmUiHZ9hBgdtuBeCCrbT2k,58009 +transformers/models/gemma3/modular_gemma3.py,sha256=yUT0xbkPRfBRs8aYcGUZd5FTnfqdVUvYvad8sH9MMGM,52597 +transformers/models/gemma3/processing_gemma3.py,sha256=Yfw3xLFHIsdj2pgqbIMqWX23hIW73WGZHlUR2SGPQH8,7321 +transformers/models/gemma3n/__init__.py,sha256=ZSrv5oSiULGXY7Vszb--vaJh1l7FBe1lrZD_3LX6cj4,1079 +transformers/models/gemma3n/__pycache__/__init__.cpython-312.pyc,, +transformers/models/gemma3n/__pycache__/configuration_gemma3n.cpython-312.pyc,, +transformers/models/gemma3n/__pycache__/feature_extraction_gemma3n.cpython-312.pyc,, +transformers/models/gemma3n/__pycache__/modeling_gemma3n.cpython-312.pyc,, +transformers/models/gemma3n/__pycache__/modular_gemma3n.cpython-312.pyc,, +transformers/models/gemma3n/__pycache__/processing_gemma3n.cpython-312.pyc,, +transformers/models/gemma3n/configuration_gemma3n.py,sha256=gtoCdpPm96-k6CZ6XzOSTO0zuKGkkcJOQru7Fd6rImI,35700 +transformers/models/gemma3n/feature_extraction_gemma3n.py,sha256=N8o-Mp0OJDpV7nL3g_wKq179gWIBcVsjRZA3DCuMgEA,14875 +transformers/models/gemma3n/modeling_gemma3n.py,sha256=eLC10UF3kT15Viefegi2L0X1sMpqsZk1B_xlOtlXmww,114392 +transformers/models/gemma3n/modular_gemma3n.py,sha256=a7AIuMJwz2kCOZ8JhZpe9461FM9cr_CIgjB9u-v-rx8,129983 +transformers/models/gemma3n/processing_gemma3n.py,sha256=L1AHdCYqg_pTEQTxPHisRKPGtjw5Dq_l1ZpRAefkrJk,6287 +transformers/models/git/__init__.py,sha256=jY1iLd7UMOmcCfrKgzoUJawLa0DQ55wHN26L09YSwhc,1021 +transformers/models/git/__pycache__/__init__.cpython-312.pyc,, +transformers/models/git/__pycache__/configuration_git.cpython-312.pyc,, +transformers/models/git/__pycache__/modeling_git.cpython-312.pyc,, +transformers/models/git/__pycache__/processing_git.cpython-312.pyc,, +transformers/models/git/configuration_git.py,sha256=BWdBIwbfndwCkjYBZaupHcn81BOBCZzhb7yQ6wX95ac,9626 +transformers/models/git/modeling_git.py,sha256=2EuhZRV7ZvYo2YIwfqb8PLmE-i1PjZ1qhzMdFXARyoU,58400 +transformers/models/git/processing_git.py,sha256=tj0eMBNee_EHZLrbVDzfodzk8C6BKXXgB4bH0W8wA4E,905 +transformers/models/glm/__init__.py,sha256=fIafw6FAflbbeG_nEM_VPJyMJHnu_NbWHTHjECIAvIs,987 +transformers/models/glm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/glm/__pycache__/configuration_glm.cpython-312.pyc,, +transformers/models/glm/__pycache__/modeling_glm.cpython-312.pyc,, +transformers/models/glm/__pycache__/modular_glm.cpython-312.pyc,, +transformers/models/glm/configuration_glm.py,sha256=uYPVqY4U07twJHWBsnrzoaec8RYLS0JmJ_NmPOPj-10,7993 +transformers/models/glm/modeling_glm.py,sha256=fnXty11yk0ou2WXkkGI0kZ7mR8Z7i_oNiu0dgdAcQeM,22578 +transformers/models/glm/modular_glm.py,sha256=PAErjm8zLbyLeSPhr4JRd0HB0MRTse4k4EDWOTuqg-Y,5526 +transformers/models/glm4/__init__.py,sha256=okqViVxR-MUlkyIdKmSwrDKA7u8pGG49OIKtW9X1hvU,989 +transformers/models/glm4/__pycache__/__init__.cpython-312.pyc,, +transformers/models/glm4/__pycache__/configuration_glm4.cpython-312.pyc,, +transformers/models/glm4/__pycache__/modeling_glm4.cpython-312.pyc,, +transformers/models/glm4/__pycache__/modular_glm4.cpython-312.pyc,, +transformers/models/glm4/configuration_glm4.py,sha256=u1SNpXryjvuMc5WP_6NDiuBPoDr-SiSt1NJIjuYVqdQ,8009 +transformers/models/glm4/modeling_glm4.py,sha256=VRxgRri9lMze1yT5kb3UIsz9aaAsXKWmEe1UGzAJO_4,23454 +transformers/models/glm4/modular_glm4.py,sha256=Es0bmuAn0U6yklH31D1BTP1kysxKrwXFDGGyi07Jm_s,5125 +transformers/models/glm46v/__init__.py,sha256=cXOkEaPOTiAltGVluSMJ_MdlzNmcRrBd84xUd-1YFHM,1164 +transformers/models/glm46v/__pycache__/__init__.cpython-312.pyc,, +transformers/models/glm46v/__pycache__/configuration_glm46v.cpython-312.pyc,, +transformers/models/glm46v/__pycache__/image_processing_glm46v.cpython-312.pyc,, +transformers/models/glm46v/__pycache__/image_processing_glm46v_fast.cpython-312.pyc,, +transformers/models/glm46v/__pycache__/modeling_glm46v.cpython-312.pyc,, +transformers/models/glm46v/__pycache__/modular_glm46v.cpython-312.pyc,, +transformers/models/glm46v/__pycache__/processing_glm46v.cpython-312.pyc,, +transformers/models/glm46v/__pycache__/video_processing_glm46v.cpython-312.pyc,, +transformers/models/glm46v/configuration_glm46v.py,sha256=H3x7P9leIl06v0SUJ7Uqp24TFihi286Gug-U-32qtME,5418 +transformers/models/glm46v/image_processing_glm46v.py,sha256=2XGHRB2vFDfiaIz1R7CX06kWGCF4nibWxaxPlEdPngo,24566 +transformers/models/glm46v/image_processing_glm46v_fast.py,sha256=mUh2irCsljN1fkkmnUKlA0-DSOC5CxnwG8iO07fS-hk,7947 +transformers/models/glm46v/modeling_glm46v.py,sha256=-zKyQfkiXTyp0FDLIhDrgDj3a35CPSW55IeHyIy3I_M,41267 +transformers/models/glm46v/modular_glm46v.py,sha256=Zuf6lR3DqIIRtSOZDLW82lbNdTKQU-q9TDHJ2rimhfY,8758 +transformers/models/glm46v/processing_glm46v.py,sha256=VjmWr_7gOOY3VYCCcL1mVvkJ-cOpOz6vtxhFHSxsRTM,12364 +transformers/models/glm46v/video_processing_glm46v.py,sha256=wd-yNcTdDabOueT1JG_CLdbJRzUJR6omvLsZ32kAdEc,11728 +transformers/models/glm4_moe/__init__.py,sha256=dfmB1kPUzq5-xfXh3zFtfGdSJu7CDDbfL401u_EayjM,997 +transformers/models/glm4_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/glm4_moe/__pycache__/configuration_glm4_moe.cpython-312.pyc,, +transformers/models/glm4_moe/__pycache__/modeling_glm4_moe.cpython-312.pyc,, +transformers/models/glm4_moe/__pycache__/modular_glm4_moe.cpython-312.pyc,, +transformers/models/glm4_moe/configuration_glm4_moe.py,sha256=RTuAcbeqjY_hBXJKJpbciwMDbafbPNkgXOYashEbGlQ,10997 +transformers/models/glm4_moe/modeling_glm4_moe.py,sha256=aq_tiG0CORsqf3dd9F5eABMAYcmYae5LFIuQQvLDyoA,29242 +transformers/models/glm4_moe/modular_glm4_moe.py,sha256=_j30KOhtyoc5Z80RekMqvOHstXwf7j_0cHwhuhkSBjg,13319 +transformers/models/glm4_moe_lite/__init__.py,sha256=QhYOQontNMp2Fw5CMVOJcNDD36LzURkY1csW-Y2Bpcw,1008 +transformers/models/glm4_moe_lite/__pycache__/__init__.cpython-312.pyc,, +transformers/models/glm4_moe_lite/__pycache__/configuration_glm4_moe_lite.cpython-312.pyc,, +transformers/models/glm4_moe_lite/__pycache__/modeling_glm4_moe_lite.cpython-312.pyc,, +transformers/models/glm4_moe_lite/__pycache__/modular_glm4_moe_lite.cpython-312.pyc,, +transformers/models/glm4_moe_lite/configuration_glm4_moe_lite.py,sha256=QNTGc7Ej12fFOZenBg-uOpVsTmybny00Hrkaf3WGva0,12556 +transformers/models/glm4_moe_lite/modeling_glm4_moe_lite.py,sha256=myHZmHWCc_NtlGndoYBjJvSWrvVh419jDZz3ut4F2FE,33090 +transformers/models/glm4_moe_lite/modular_glm4_moe_lite.py,sha256=AH81weJPmx9F2AlFIyB5E5FxXNPA1b5BUvlpmLaSEGY,13422 +transformers/models/glm4v/__init__.py,sha256=emjATAJWT2oG9zrk7Qkhq08EouMBwzoYLc95lOsvYXY,1111 +transformers/models/glm4v/__pycache__/__init__.cpython-312.pyc,, +transformers/models/glm4v/__pycache__/configuration_glm4v.cpython-312.pyc,, +transformers/models/glm4v/__pycache__/image_processing_glm4v.cpython-312.pyc,, +transformers/models/glm4v/__pycache__/image_processing_glm4v_fast.cpython-312.pyc,, +transformers/models/glm4v/__pycache__/modeling_glm4v.cpython-312.pyc,, +transformers/models/glm4v/__pycache__/modular_glm4v.cpython-312.pyc,, +transformers/models/glm4v/__pycache__/processing_glm4v.cpython-312.pyc,, +transformers/models/glm4v/__pycache__/video_processing_glm4v.cpython-312.pyc,, +transformers/models/glm4v/configuration_glm4v.py,sha256=xFG94XoOD256ZyYSBAh8Hhu70vVPh35D6YgdS5hYByc,15909 +transformers/models/glm4v/image_processing_glm4v.py,sha256=Gw6gln4V_Pso_Np8JmKFUDSjxRYImzd92mZNGa6lux0,23830 +transformers/models/glm4v/image_processing_glm4v_fast.py,sha256=8ArXSJhKBPESukKeLvPoHJU7yMkjZh6x4B6CEVrc35E,7311 +transformers/models/glm4v/modeling_glm4v.py,sha256=MmhZhYmX7xNC4tGzIXkz_9ezaYaZiOFZR7sAILW7JO4,78234 +transformers/models/glm4v/modular_glm4v.py,sha256=u308gq4Gc3yZWy-rFfH_6B3KvLIaPP_6pZzRkOvpc-A,73344 +transformers/models/glm4v/processing_glm4v.py,sha256=_Ono0zeLCxkAwE-YxPL0k69hjE8IImkldSn1VWL080s,12375 +transformers/models/glm4v/video_processing_glm4v.py,sha256=t5vdG3JLfSfn8k7IcRZSnAYFKazd3BoxUKNVNVIpN44,9933 +transformers/models/glm4v_moe/__init__.py,sha256=4MuhU3oMjO5wL4YHEEhn0uU4qIsXz17DJPMs_xqMyHA,999 +transformers/models/glm4v_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/glm4v_moe/__pycache__/configuration_glm4v_moe.cpython-312.pyc,, +transformers/models/glm4v_moe/__pycache__/modeling_glm4v_moe.cpython-312.pyc,, +transformers/models/glm4v_moe/__pycache__/modular_glm4v_moe.cpython-312.pyc,, +transformers/models/glm4v_moe/configuration_glm4v_moe.py,sha256=QA-Jx5BRK3GEdWkHBFYse4Lpq3nQDPIeuq6TXfkVowM,18794 +transformers/models/glm4v_moe/modeling_glm4v_moe.py,sha256=d981ziSt5RYMuGy_QAo3WqTwZuJ5eY79Atj75TtrZYU,89624 +transformers/models/glm4v_moe/modular_glm4v_moe.py,sha256=vdDYnJvjvP3xZc4kgdagpvpIu-1CXV6aD5yGdtNr_Cw,25363 +transformers/models/glm_image/__init__.py,sha256=Y5MpC55fr1lus7NV8vp4FSo5a6YMSdGdlM2228Xd4Jc,1137 +transformers/models/glm_image/__pycache__/__init__.cpython-312.pyc,, +transformers/models/glm_image/__pycache__/configuration_glm_image.cpython-312.pyc,, +transformers/models/glm_image/__pycache__/image_processing_glm_image.cpython-312.pyc,, +transformers/models/glm_image/__pycache__/image_processing_glm_image_fast.cpython-312.pyc,, +transformers/models/glm_image/__pycache__/modeling_glm_image.cpython-312.pyc,, +transformers/models/glm_image/__pycache__/modular_glm_image.cpython-312.pyc,, +transformers/models/glm_image/__pycache__/processing_glm_image.cpython-312.pyc,, +transformers/models/glm_image/configuration_glm_image.py,sha256=n7FlX3j33TK6Xryf3xCrIKM55lxH1zQNSteii9uw6j4,17537 +transformers/models/glm_image/image_processing_glm_image.py,sha256=2rPFtmOhu6639zBLrwytsPfLwXjQCxV3bk4Jp4oE9Mg,25285 +transformers/models/glm_image/image_processing_glm_image_fast.py,sha256=eyXiFvevFUkxYVhAkXnoyp0bbIIdt2GNJz3ZlnXUF94,12298 +transformers/models/glm_image/modeling_glm_image.py,sha256=WlszQ6YpqexN2hpYVwqwBd-TFuGqqY4f5m7B3pE1QL8,75843 +transformers/models/glm_image/modular_glm_image.py,sha256=X2SV2Njd-zLiSeA1Z6-pcP0PZu1i28TsPQEn6D09FzY,72512 +transformers/models/glm_image/processing_glm_image.py,sha256=nttdFQH3I_V58v17Z9ssbhfDmqX8rNWpjGP2dc_2gOs,12117 +transformers/models/glm_moe_dsa/__init__.py,sha256=sW2Trp4R9zjg37__07KUEMPo4dkirLgDtHthTsViU-Y,1004 +transformers/models/glm_moe_dsa/__pycache__/__init__.cpython-312.pyc,, +transformers/models/glm_moe_dsa/__pycache__/configuration_glm_moe_dsa.cpython-312.pyc,, +transformers/models/glm_moe_dsa/__pycache__/modeling_glm_moe_dsa.cpython-312.pyc,, +transformers/models/glm_moe_dsa/__pycache__/modular_glm_moe_dsa.cpython-312.pyc,, +transformers/models/glm_moe_dsa/configuration_glm_moe_dsa.py,sha256=FK2I5xEGg-rhrc4Tg-1KpnM5H9SCHjT3GDIJc_OqI0w,12095 +transformers/models/glm_moe_dsa/modeling_glm_moe_dsa.py,sha256=w7vzp-kUhN6ghJ6ftuoyAx4mrlQJhFM3qZ_WhKO3eK4,40099 +transformers/models/glm_moe_dsa/modular_glm_moe_dsa.py,sha256=TrUz8hp3B1EnFdeOp8ymwPvf77yif62xZZIeOiJXJ88,28852 +transformers/models/glm_ocr/__init__.py,sha256=oeeKm635ED_6WvzpS6UgtVQK8Czp18lLyVVzsHNU8NE,996 +transformers/models/glm_ocr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/glm_ocr/__pycache__/configuration_glm_ocr.cpython-312.pyc,, +transformers/models/glm_ocr/__pycache__/modeling_glm_ocr.cpython-312.pyc,, +transformers/models/glm_ocr/__pycache__/modular_glm_ocr.cpython-312.pyc,, +transformers/models/glm_ocr/configuration_glm_ocr.py,sha256=qE8gkUT96v0zdYkewjCmYX1VJ3AuXRUI4nN9UaMYMGc,15495 +transformers/models/glm_ocr/modeling_glm_ocr.py,sha256=SEezuVqg0HxZHaHYvHiN-Iqcxc1tX79rMTmqJZ_DPYo,74910 +transformers/models/glm_ocr/modular_glm_ocr.py,sha256=8JvqP4oa8sNXQdmXZ--yfKdmzF4hmfTWFZ-MsFPVBR0,18622 +transformers/models/glmasr/__init__.py,sha256=UpS-w64zO1l1qsMI0GggLWffkdh2EKlW08BISsMiZz4,1031 +transformers/models/glmasr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/glmasr/__pycache__/configuration_glmasr.cpython-312.pyc,, +transformers/models/glmasr/__pycache__/modeling_glmasr.cpython-312.pyc,, +transformers/models/glmasr/__pycache__/modular_glmasr.cpython-312.pyc,, +transformers/models/glmasr/__pycache__/processing_glmasr.cpython-312.pyc,, +transformers/models/glmasr/configuration_glmasr.py,sha256=8GM-bOIsgnqUC05Plaz7X1UuPvvQ5vCDjpVZN76s1eA,8835 +transformers/models/glmasr/modeling_glmasr.py,sha256=CWfxHhNhJpCC2k8rv7W1ze5xEOihgtebBcpDKTIc-kw,22788 +transformers/models/glmasr/modular_glmasr.py,sha256=2iTKGU-jmh3DbW0TlofLiN6F33IAjxowrNqCpnRxnAg,18872 +transformers/models/glmasr/processing_glmasr.py,sha256=okL1d7kjmFr-uLC-HkCXuoYd6JcISle8KvuujN088VI,14462 +transformers/models/glpn/__init__.py,sha256=kZWLi39Z6IaKfiAJ5WSbQwAqYExpBxQDwl8ZVPASC4M,1119 +transformers/models/glpn/__pycache__/__init__.cpython-312.pyc,, +transformers/models/glpn/__pycache__/configuration_glpn.cpython-312.pyc,, +transformers/models/glpn/__pycache__/image_processing_glpn.cpython-312.pyc,, +transformers/models/glpn/__pycache__/image_processing_glpn_fast.cpython-312.pyc,, +transformers/models/glpn/__pycache__/modeling_glpn.cpython-312.pyc,, +transformers/models/glpn/configuration_glpn.py,sha256=Y2K-2yI5DDsYx0HjvVUsEnuZX-iP9o5klmx0f-D2-Hg,5983 +transformers/models/glpn/image_processing_glpn.py,sha256=2O2wM__kTSjoxvOW4iFwDjRuFFoJAPKfyju5CZYBWsM,13305 +transformers/models/glpn/image_processing_glpn_fast.py,sha256=X7RAD_xMhUFD7qYduukurP4zWEDR7P2-QLX5FAUQr4Y,5247 +transformers/models/glpn/modeling_glpn.py,sha256=AFBmOospzJRMfP7V_XNBjvnYcnm1wG3gB8L1Z7ZaLlg,26384 +transformers/models/got_ocr2/__init__.py,sha256=LBVZP8CBfOxaD9NLC2ZbZpLloHLIX7uDyM8m1-W2m6g,1138 +transformers/models/got_ocr2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/got_ocr2/__pycache__/configuration_got_ocr2.cpython-312.pyc,, +transformers/models/got_ocr2/__pycache__/image_processing_got_ocr2.cpython-312.pyc,, +transformers/models/got_ocr2/__pycache__/image_processing_got_ocr2_fast.cpython-312.pyc,, +transformers/models/got_ocr2/__pycache__/modeling_got_ocr2.cpython-312.pyc,, +transformers/models/got_ocr2/__pycache__/modular_got_ocr2.cpython-312.pyc,, +transformers/models/got_ocr2/__pycache__/processing_got_ocr2.cpython-312.pyc,, +transformers/models/got_ocr2/configuration_got_ocr2.py,sha256=KK4g69VwJQFVXH7RM6KAkA3LhVEE0MRgqWrO6Ab8n-o,9581 +transformers/models/got_ocr2/image_processing_got_ocr2.py,sha256=eM2_HKYRDjikiEjgYr7fuRo5R3OI-HXJDlK1vYka9c4,26180 +transformers/models/got_ocr2/image_processing_got_ocr2_fast.py,sha256=DkmL05hstkivTg_-2W0lRn_aXp6674sVOh1uAh-IeA0,9453 +transformers/models/got_ocr2/modeling_got_ocr2.py,sha256=QGhBbKGfklirPj8y4HyROHKMoNNt4nWGf0Mya0lPyxg,36070 +transformers/models/got_ocr2/modular_got_ocr2.py,sha256=4Q9RtyVQDCgY0-UaFrTK1vjLmztZrUSK83LisgWA-rk,20095 +transformers/models/got_ocr2/processing_got_ocr2.py,sha256=sfqk_UZ1H83uNNU8gGhawieUz8anxa7dWiQd1y5cwNQ,10450 +transformers/models/gpt2/__init__.py,sha256=trifYw4vnBNfaiVq-8aSyPTNAGWdUE-eSOVJfR28nhE,1026 +transformers/models/gpt2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/gpt2/__pycache__/configuration_gpt2.cpython-312.pyc,, +transformers/models/gpt2/__pycache__/modeling_gpt2.cpython-312.pyc,, +transformers/models/gpt2/__pycache__/tokenization_gpt2.cpython-312.pyc,, +transformers/models/gpt2/configuration_gpt2.py,sha256=IiGAR8Mz-Ezks9cIfCBFwimCMAxPwn0cekWQWZQ_BhA,9071 +transformers/models/gpt2/modeling_gpt2.py,sha256=l8Pgja3_s-VKbHXZNa-ZWyzJunI_xJwW6yEFbUnuTr0,56919 +transformers/models/gpt2/tokenization_gpt2.py,sha256=qdvEf7AwS5jMmgxGQrkpJHP5ZlLInB8dePQgYTU18eU,5370 +transformers/models/gpt_bigcode/__init__.py,sha256=KQNb7PO57eZpP345wSbe_C3iL-N4VPscw1GY2mv81uE,1003 +transformers/models/gpt_bigcode/__pycache__/__init__.cpython-312.pyc,, +transformers/models/gpt_bigcode/__pycache__/configuration_gpt_bigcode.cpython-312.pyc,, +transformers/models/gpt_bigcode/__pycache__/modeling_gpt_bigcode.cpython-312.pyc,, +transformers/models/gpt_bigcode/configuration_gpt_bigcode.py,sha256=R39nA_YIPBqmR95jAmCVJIvrTfrKl1GAfqY-_QFgfBA,6553 +transformers/models/gpt_bigcode/modeling_gpt_bigcode.py,sha256=r1HOx_8SxmkkrzQ-9PsF9xrp4k9Jt6ia88gCkti_AmA,38283 +transformers/models/gpt_neo/__init__.py,sha256=OG3bA-FgdEYzI3Qs45XGMCa-4zdz5F9zQycsYBXuQ_4,995 +transformers/models/gpt_neo/__pycache__/__init__.cpython-312.pyc,, +transformers/models/gpt_neo/__pycache__/configuration_gpt_neo.cpython-312.pyc,, +transformers/models/gpt_neo/__pycache__/modeling_gpt_neo.cpython-312.pyc,, +transformers/models/gpt_neo/configuration_gpt_neo.py,sha256=6KUFt4ElA0b0aokLFZEpg_ij9DIVtGl10NVNuRwpBRk,9425 +transformers/models/gpt_neo/modeling_gpt_neo.py,sha256=cuyDeOIBBaQUd2PtIZ4j3dGnLrZ7I9cIbezTLxQ9X3E,39093 +transformers/models/gpt_neox/__init__.py,sha256=vH3qZOHNV6DsvrKyPvzXoO_D26e0N78HDOYSlxMWTYQ,1038 +transformers/models/gpt_neox/__pycache__/__init__.cpython-312.pyc,, +transformers/models/gpt_neox/__pycache__/configuration_gpt_neox.cpython-312.pyc,, +transformers/models/gpt_neox/__pycache__/modeling_gpt_neox.cpython-312.pyc,, +transformers/models/gpt_neox/__pycache__/modular_gpt_neox.cpython-312.pyc,, +transformers/models/gpt_neox/__pycache__/tokenization_gpt_neox.cpython-312.pyc,, +transformers/models/gpt_neox/configuration_gpt_neox.py,sha256=F5ED8s1f9VfLa_hUPPjqqkySXKCYMUtdW58udAEmbn0,8807 +transformers/models/gpt_neox/modeling_gpt_neox.py,sha256=DOLe7A-x1WM0APwI0_OtTDI_FgIrtC_IZePZDUILRbI,28875 +transformers/models/gpt_neox/modular_gpt_neox.py,sha256=BSqfV38rMAkT7n34QNt3PmibS8dwc3OcRsfoG-J_dLs,25894 +transformers/models/gpt_neox/tokenization_gpt_neox.py,sha256=l74U3ivN33dUEO7yTP7M2PmHAvaL5D-ztpT1_Y5M_h8,6045 +transformers/models/gpt_neox_japanese/__init__.py,sha256=z4kbUmZSjE-Hs9ba8ul3Yncc9ZJy7ePufbwwRlfqWqw,1065 +transformers/models/gpt_neox_japanese/__pycache__/__init__.cpython-312.pyc,, +transformers/models/gpt_neox_japanese/__pycache__/configuration_gpt_neox_japanese.cpython-312.pyc,, +transformers/models/gpt_neox_japanese/__pycache__/modeling_gpt_neox_japanese.cpython-312.pyc,, +transformers/models/gpt_neox_japanese/__pycache__/tokenization_gpt_neox_japanese.cpython-312.pyc,, +transformers/models/gpt_neox_japanese/configuration_gpt_neox_japanese.py,sha256=y6Qts9NgoiNBDyLgnvJNpAR0zXi8kS6VdHNNdD7iJ0U,6988 +transformers/models/gpt_neox_japanese/modeling_gpt_neox_japanese.py,sha256=lDxBDPDegdZA4n21BD_Wdw4wK7FIs2xzRqFUc6bFGgM,25866 +transformers/models/gpt_neox_japanese/tokenization_gpt_neox_japanese.py,sha256=0DiKz_OKPMHfUIEXHj2eOizNdvHOP5Ib5CCwj-sbRPs,16931 +transformers/models/gpt_oss/__init__.py,sha256=a3dnVKgP6RwbuxBJW3kodYKj8oVF5Y6pLJixMthP1yA,995 +transformers/models/gpt_oss/__pycache__/__init__.cpython-312.pyc,, +transformers/models/gpt_oss/__pycache__/configuration_gpt_oss.cpython-312.pyc,, +transformers/models/gpt_oss/__pycache__/modeling_gpt_oss.cpython-312.pyc,, +transformers/models/gpt_oss/__pycache__/modular_gpt_oss.cpython-312.pyc,, +transformers/models/gpt_oss/configuration_gpt_oss.py,sha256=sDGDfnSirVE7x5sYKnKbBPAhhRKWvw8HXB0-VUs0jYA,5969 +transformers/models/gpt_oss/modeling_gpt_oss.py,sha256=jcJ_iPhL6xPjp1nJxFbSJFXkelcW_DUKgaHaPMdKJoU,31385 +transformers/models/gpt_oss/modular_gpt_oss.py,sha256=bb0waatvaKAvRZqWYgMYWS9SRV6l0CUS5TaiE_xS11M,17867 +transformers/models/gpt_sw3/__init__.py,sha256=-g6WlJ6EhhrJKCCsPf78cgvGD7oWvfeW9GBGBpW6wcM,958 +transformers/models/gpt_sw3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/gpt_sw3/__pycache__/tokenization_gpt_sw3.cpython-312.pyc,, +transformers/models/gpt_sw3/tokenization_gpt_sw3.py,sha256=Ia96IzTjuLUWbK2oHgvVfhgwMmI83Vf3tHupH-x3umo,10021 +transformers/models/gptj/__init__.py,sha256=8X2gitvP4-NmFJp4CE22JAuc0DrUHg9-lAty6XqyBkE,989 +transformers/models/gptj/__pycache__/__init__.cpython-312.pyc,, +transformers/models/gptj/__pycache__/configuration_gptj.cpython-312.pyc,, +transformers/models/gptj/__pycache__/modeling_gptj.cpython-312.pyc,, +transformers/models/gptj/configuration_gptj.py,sha256=T8Sly2fDdCgxd3EWeZEepBFDA1ihw1d59iZYoLyqomI,5492 +transformers/models/gptj/modeling_gptj.py,sha256=3uxamVCYcohIvcJOW9exLYliALkztxeGQrP027eowys,37651 +transformers/models/granite/__init__.py,sha256=cDxmZNuphkDCs2U8W5C95Vhu577kdZHKHUWWaQ3vk5U,1015 +transformers/models/granite/__pycache__/__init__.cpython-312.pyc,, +transformers/models/granite/__pycache__/configuration_granite.cpython-312.pyc,, +transformers/models/granite/__pycache__/modeling_granite.cpython-312.pyc,, +transformers/models/granite/__pycache__/modular_granite.cpython-312.pyc,, +transformers/models/granite/configuration_granite.py,sha256=UIuAA8Vq5D_aBKZ4Y1Z0XJLUgMx_Nc33ZtjdMETOdb0,9062 +transformers/models/granite/modeling_granite.py,sha256=Ifrqvu0G-vX9j2rE8YVTPPDekDEbIaI_ITE2jmRHwHY,25965 +transformers/models/granite/modular_granite.py,sha256=a5a0E_yY3f00dUfmnJG3nwBYxmgF--jENs3Pqt_-018,11482 +transformers/models/granite_speech/__init__.py,sha256=xD_zbTTnBiaB6EEG4yinaWd-yza1waa01GNKVhsGL1M,1107 +transformers/models/granite_speech/__pycache__/__init__.cpython-312.pyc,, +transformers/models/granite_speech/__pycache__/configuration_granite_speech.cpython-312.pyc,, +transformers/models/granite_speech/__pycache__/feature_extraction_granite_speech.cpython-312.pyc,, +transformers/models/granite_speech/__pycache__/modeling_granite_speech.cpython-312.pyc,, +transformers/models/granite_speech/__pycache__/processing_granite_speech.cpython-312.pyc,, +transformers/models/granite_speech/configuration_granite_speech.py,sha256=SpaGZOP9TfPDP3GPbHbDOAVh3w8yb7N2zmrd_zCjbuo,8550 +transformers/models/granite_speech/feature_extraction_granite_speech.py,sha256=Ll7tLm3n75dseBGXYm3uhgKV2Rj2javxY0XchtY8x2A,7349 +transformers/models/granite_speech/modeling_granite_speech.py,sha256=1x6T1emVPB8KyMkSuwGJqDXsetAB9yJHo-gYhzeeH-A,26742 +transformers/models/granite_speech/processing_granite_speech.py,sha256=XET-j4EGK4Fem-NmNdO_dqZFpk5m9X5R-60P2oUbV5g,4180 +transformers/models/granitemoe/__init__.py,sha256=e4KKtNT7YFkYkPBfcS0VyhpT_1vF0JkR2qdYKPqRUcE,1001 +transformers/models/granitemoe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/granitemoe/__pycache__/configuration_granitemoe.cpython-312.pyc,, +transformers/models/granitemoe/__pycache__/modeling_granitemoe.cpython-312.pyc,, +transformers/models/granitemoe/__pycache__/modular_granitemoe.cpython-312.pyc,, +transformers/models/granitemoe/configuration_granitemoe.py,sha256=RnZBCrGsvi1cs8_q5Picea0_Idbn--Ywq4Tdcmbf_Pg,9162 +transformers/models/granitemoe/modeling_granitemoe.py,sha256=FhPbph7afkLPwpVn5n6JMqe-44CPovpTgwnmydYJp84,32390 +transformers/models/granitemoe/modular_granitemoe.py,sha256=9Rh4-f0NwuRqdPxl0KO7BCGl1n_EGWncChkJ9_IDjk4,13313 +transformers/models/granitemoehybrid/__init__.py,sha256=V5SQbC7YI-EoIlyHo5LoSpJ7SyuquuA5DcsuNlRoSVI,1028 +transformers/models/granitemoehybrid/__pycache__/__init__.cpython-312.pyc,, +transformers/models/granitemoehybrid/__pycache__/configuration_granitemoehybrid.cpython-312.pyc,, +transformers/models/granitemoehybrid/__pycache__/modeling_granitemoehybrid.cpython-312.pyc,, +transformers/models/granitemoehybrid/__pycache__/modular_granitemoehybrid.cpython-312.pyc,, +transformers/models/granitemoehybrid/configuration_granitemoehybrid.py,sha256=zpmWphmapVh0g4MSkxV6mh2Qmbc6xN19jNzUSz1Hl_g,13165 +transformers/models/granitemoehybrid/modeling_granitemoehybrid.py,sha256=mHtCxdNRX0yX_SzrrikHQq-TCzJQhZRnr5bYlCTkscw,71092 +transformers/models/granitemoehybrid/modular_granitemoehybrid.py,sha256=8hDgl-j4_pUfU6koIitcUUkD6OoUnU3x_XPw_UItB9I,14154 +transformers/models/granitemoeshared/__init__.py,sha256=vmY98tLts1c_yvkLn9X-xk6CFtXIKskzYvFGMqQAskc,1013 +transformers/models/granitemoeshared/__pycache__/__init__.cpython-312.pyc,, +transformers/models/granitemoeshared/__pycache__/configuration_granitemoeshared.cpython-312.pyc,, +transformers/models/granitemoeshared/__pycache__/modeling_granitemoeshared.cpython-312.pyc,, +transformers/models/granitemoeshared/__pycache__/modular_granitemoeshared.cpython-312.pyc,, +transformers/models/granitemoeshared/configuration_granitemoeshared.py,sha256=hn8mUTqchXpPQdnTFPhbgEn_IgsThwUXGL75tZNSvvE,9715 +transformers/models/granitemoeshared/modeling_granitemoeshared.py,sha256=b5Day2g1SHbi61vuHdBIVP0F1EZA3UeyldMkNPjhvxs,35168 +transformers/models/granitemoeshared/modular_granitemoeshared.py,sha256=mTOAGg3Nr1HFOsVlAxrI-jjo1FjiacG6aMIzrdd42iE,5707 +transformers/models/grounding_dino/__init__.py,sha256=nTxZfZioCpS8hj_L80qZQkgPviMZrTxkz14B9sQQJjk,1161 +transformers/models/grounding_dino/__pycache__/__init__.cpython-312.pyc,, +transformers/models/grounding_dino/__pycache__/configuration_grounding_dino.cpython-312.pyc,, +transformers/models/grounding_dino/__pycache__/image_processing_grounding_dino.cpython-312.pyc,, +transformers/models/grounding_dino/__pycache__/image_processing_grounding_dino_fast.cpython-312.pyc,, +transformers/models/grounding_dino/__pycache__/modeling_grounding_dino.cpython-312.pyc,, +transformers/models/grounding_dino/__pycache__/modular_grounding_dino.cpython-312.pyc,, +transformers/models/grounding_dino/__pycache__/processing_grounding_dino.cpython-312.pyc,, +transformers/models/grounding_dino/configuration_grounding_dino.py,sha256=4_Jvq2ojgwBXkWmC1j0oTtmOypd-g36Px1ZG7Go-D8E,12796 +transformers/models/grounding_dino/image_processing_grounding_dino.py,sha256=2MvSGLiG97z7omdb7D2w2HiplVwUA78QHBLfXrd2CHs,68499 +transformers/models/grounding_dino/image_processing_grounding_dino_fast.py,sha256=0Tc5Q1fnpBPlmFSbv6HKzKUvzmjB-seH2Xg_e1LqVpk,30362 +transformers/models/grounding_dino/modeling_grounding_dino.py,sha256=eV2hmA_7ucJ74W9mIuaVgQ5Y3FIh1zvqIsOLSZvCRHk,129179 +transformers/models/grounding_dino/modular_grounding_dino.py,sha256=UIu-gc19YF8Q1Yi8DAZCa6dDzLTrDLj1BiUwhI0JWe0,5575 +transformers/models/grounding_dino/processing_grounding_dino.py,sha256=-HQ14qL3SOeK_CnRWTeKJx5MdjqvourWN8eZsweBkMk,9659 +transformers/models/groupvit/__init__.py,sha256=8z8yBl-b-usbrGBx0-rNE-6pqPf4jPP_Ev4U5t8Sphc,997 +transformers/models/groupvit/__pycache__/__init__.cpython-312.pyc,, +transformers/models/groupvit/__pycache__/configuration_groupvit.cpython-312.pyc,, +transformers/models/groupvit/__pycache__/modeling_groupvit.cpython-312.pyc,, +transformers/models/groupvit/configuration_groupvit.py,sha256=kTJzZ89-l6Az-OwVQEezVCPjOERnocQI-cfdAcMyojM,17149 +transformers/models/groupvit/modeling_groupvit.py,sha256=RCHgiOmptkXzHTNh2nQzhYKu5FMZBHYLBi3hEcQRJ5k,58859 +transformers/models/helium/__init__.py,sha256=b1Senw5Mr129rzZSd1sW6-Ies2kIAUHfplpzgGeuTFE,993 +transformers/models/helium/__pycache__/__init__.cpython-312.pyc,, +transformers/models/helium/__pycache__/configuration_helium.cpython-312.pyc,, +transformers/models/helium/__pycache__/modeling_helium.cpython-312.pyc,, +transformers/models/helium/__pycache__/modular_helium.cpython-312.pyc,, +transformers/models/helium/configuration_helium.py,sha256=RZWs6kg7b-JLVUmAde7EKaqaVSai3XuNImYbk9EpYWg,7988 +transformers/models/helium/modeling_helium.py,sha256=eLCuf_4eXzFbnVWG8jgshonn2mow0Po9bYF0mWGU8eQ,21943 +transformers/models/helium/modular_helium.py,sha256=UfVwU2XOvCSRaG0BAfKekfMwp2C1qPbieXHPl70VcDY,5261 +transformers/models/herbert/__init__.py,sha256=TSI8jVDbbhzcO4Bl6xkcmLyL9VtLWTV8JuPy2_dk2sE,958 +transformers/models/herbert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/herbert/__pycache__/tokenization_herbert.cpython-312.pyc,, +transformers/models/herbert/tokenization_herbert.py,sha256=d8uN5yO5NnTeA_70H-N9W9xNwrMBiRo8yrxHMrCgCWw,3917 +transformers/models/hgnet_v2/__init__.py,sha256=sBFNC0RNpS-oEnOiwtxy2SkUPAJgmI5uXXq2WjSHRd8,999 +transformers/models/hgnet_v2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/hgnet_v2/__pycache__/configuration_hgnet_v2.cpython-312.pyc,, +transformers/models/hgnet_v2/__pycache__/modeling_hgnet_v2.cpython-312.pyc,, +transformers/models/hgnet_v2/__pycache__/modular_hgnet_v2.cpython-312.pyc,, +transformers/models/hgnet_v2/configuration_hgnet_v2.py,sha256=VzmmGzR9VkQtOB8_1D-uw0o_kPZ8D5GPZXfcLE-NVzY,8663 +transformers/models/hgnet_v2/modeling_hgnet_v2.py,sha256=opRD_F27Kwn2nk1aE6243LrKDo7GMCjOhvNA6LwoyJ4,18412 +transformers/models/hgnet_v2/modular_hgnet_v2.py,sha256=ZXvUpeJupmh6sesbOxjcGdX_xSqwFLaMLycyvbFWGgE,24713 +transformers/models/hiera/__init__.py,sha256=b1kwKtpZVISJZ5Pri421uvH2v3IoRQ6XXHzxFOPHN-g,991 +transformers/models/hiera/__pycache__/__init__.cpython-312.pyc,, +transformers/models/hiera/__pycache__/configuration_hiera.cpython-312.pyc,, +transformers/models/hiera/__pycache__/modeling_hiera.cpython-312.pyc,, +transformers/models/hiera/configuration_hiera.py,sha256=UuJ_NG3_4qIfvDPtRzQHrXassQKWuPAucVp_wXJaVeo,9159 +transformers/models/hiera/modeling_hiera.py,sha256=6h2x8SZGB-PL7P8o3T9H13UiJuLGqXl1gB6OPNSJXZg,59539 +transformers/models/hubert/__init__.py,sha256=99_KVlRuVQxpVPnX_qPki0yEzJpggZOD527N_-aFvYM,993 +transformers/models/hubert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/hubert/__pycache__/configuration_hubert.cpython-312.pyc,, +transformers/models/hubert/__pycache__/modeling_hubert.cpython-312.pyc,, +transformers/models/hubert/__pycache__/modular_hubert.cpython-312.pyc,, +transformers/models/hubert/configuration_hubert.py,sha256=l4KqllLpemnEwFzFgTz8XIHP6GvINVpBrZYdL5KVlRU,14989 +transformers/models/hubert/modeling_hubert.py,sha256=E1kO7yrGwJ6cqrcTaSt1giLjNOoEVrm3qZULeeoz04M,51141 +transformers/models/hubert/modular_hubert.py,sha256=saIb-88ht-9AdZjiLorsI2_qJc4SaKiP9Bz7okUHiMQ,11915 +transformers/models/hunyuan_v1_dense/__init__.py,sha256=FZn7rOtjmLA5vwEeH99QcgAveRMl1LbHQOyBKhywPWY,442 +transformers/models/hunyuan_v1_dense/__pycache__/__init__.cpython-312.pyc,, +transformers/models/hunyuan_v1_dense/__pycache__/configuration_hunyuan_v1_dense.cpython-312.pyc,, +transformers/models/hunyuan_v1_dense/__pycache__/modeling_hunyuan_v1_dense.cpython-312.pyc,, +transformers/models/hunyuan_v1_dense/__pycache__/modular_hunyuan_v1_dense.cpython-312.pyc,, +transformers/models/hunyuan_v1_dense/configuration_hunyuan_v1_dense.py,sha256=0bxgHyncMBPEdX99hT6jHaSLHVQl9SWBk1AL3V5ai8Q,8027 +transformers/models/hunyuan_v1_dense/modeling_hunyuan_v1_dense.py,sha256=pv0gHP-cgvm8dvxT2qo5dSo7ITcL8HfxlER7Un70RR8,24406 +transformers/models/hunyuan_v1_dense/modular_hunyuan_v1_dense.py,sha256=Y5fzyH64s6lhvJRTBLE0Lz13qPwrwtl4wuw5nPUAgPM,7400 +transformers/models/hunyuan_v1_moe/__init__.py,sha256=JPxEpmnMsJGVMZzSx6_wGtDDkQD33aU1BEdPdXKzHUg,403 +transformers/models/hunyuan_v1_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/hunyuan_v1_moe/__pycache__/configuration_hunyuan_v1_moe.cpython-312.pyc,, +transformers/models/hunyuan_v1_moe/__pycache__/modeling_hunyuan_v1_moe.cpython-312.pyc,, +transformers/models/hunyuan_v1_moe/__pycache__/modular_hunyuan_v1_moe.cpython-312.pyc,, +transformers/models/hunyuan_v1_moe/configuration_hunyuan_v1_moe.py,sha256=SBRpAm6bwsAaxcIL8dwclBlQasEvN580Ql5IMGIO1uU,10588 +transformers/models/hunyuan_v1_moe/modeling_hunyuan_v1_moe.py,sha256=0muywyZBlEa24Rv1KgDKA9iOL8Wb-DGfcCMJrjsQuMI,28912 +transformers/models/hunyuan_v1_moe/modular_hunyuan_v1_moe.py,sha256=PrPnY8h39LXXPC8jtFGOPgRfGUap4i9u-8a_zAUh5RA,9281 +transformers/models/ibert/__init__.py,sha256=UMTcE54y6O9UNF8l9VV2rrTlJSAHooxeNeHNzPSgr_E,991 +transformers/models/ibert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/ibert/__pycache__/configuration_ibert.cpython-312.pyc,, +transformers/models/ibert/__pycache__/modeling_ibert.cpython-312.pyc,, +transformers/models/ibert/__pycache__/quant_modules.cpython-312.pyc,, +transformers/models/ibert/configuration_ibert.py,sha256=4PF-acAokMuDm9CdrhKH5LqhC3DyeZdl57qIAIKoCTQ,5810 +transformers/models/ibert/modeling_ibert.py,sha256=woU94KFptjqm44LGc179EQZfq3zC66Vci5Gu6k2xR_M,48804 +transformers/models/ibert/quant_modules.py,sha256=eQX3kw7hmlwleHnFmdDyliQpQkotzmaLpsFFb3KYcuU,30059 +transformers/models/idefics/__init__.py,sha256=mD0QaE4NyvNcabX_alDD8QSPpYMxbNZ3E6lJFOskjb0,1077 +transformers/models/idefics/__pycache__/__init__.cpython-312.pyc,, +transformers/models/idefics/__pycache__/configuration_idefics.cpython-312.pyc,, +transformers/models/idefics/__pycache__/image_processing_idefics.cpython-312.pyc,, +transformers/models/idefics/__pycache__/modeling_idefics.cpython-312.pyc,, +transformers/models/idefics/__pycache__/perceiver.cpython-312.pyc,, +transformers/models/idefics/__pycache__/processing_idefics.cpython-312.pyc,, +transformers/models/idefics/__pycache__/vision.cpython-312.pyc,, +transformers/models/idefics/configuration_idefics.py,sha256=LovrauA3mRc9bkFPDrAdxif3NDj1UmyLFYCOOsJRpHY,15274 +transformers/models/idefics/image_processing_idefics.py,sha256=wxv8wEIpGtWG2o0D88FzqGrMHjhLGc2Byc2GsfO1lRs,9772 +transformers/models/idefics/modeling_idefics.py,sha256=y0fYYULKji9_AYiekorUNtmkFjuYckbgPF7n4y6f2Vg,57134 +transformers/models/idefics/perceiver.py,sha256=9rh7lz2ImHaRk2U3X_Mg-FoZXPtKzybt2hgAOJ9vX58,9394 +transformers/models/idefics/processing_idefics.py,sha256=JtlJ-2SmALq0Z9IXHRMldLvaQWqA7Xg98hquMqBk7to,16923 +transformers/models/idefics/vision.py,sha256=yZHGy0lqFuA5HdwgNnpISLtRGUV-C_NFNeM13V_VCR8,20867 +transformers/models/idefics2/__init__.py,sha256=YmU2OQi-BTXESv52a4jtTwWC2ingparNU4-rXVCPWzQ,1131 +transformers/models/idefics2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/idefics2/__pycache__/configuration_idefics2.cpython-312.pyc,, +transformers/models/idefics2/__pycache__/image_processing_idefics2.cpython-312.pyc,, +transformers/models/idefics2/__pycache__/image_processing_idefics2_fast.cpython-312.pyc,, +transformers/models/idefics2/__pycache__/modeling_idefics2.cpython-312.pyc,, +transformers/models/idefics2/__pycache__/processing_idefics2.cpython-312.pyc,, +transformers/models/idefics2/configuration_idefics2.py,sha256=m1utlGsZMebf1TPkTk9sq246KIly9bTtfbiovoCHLOE,12124 +transformers/models/idefics2/image_processing_idefics2.py,sha256=dLAlhlaGDv4APCcWD8XgR-JJGLZEMyaVcFF6IVCaQuk,26505 +transformers/models/idefics2/image_processing_idefics2_fast.py,sha256=xMsn0PrHvoQ5q5SEVmn6-RgVitjNzSNXNsmPAuexwpk,11678 +transformers/models/idefics2/modeling_idefics2.py,sha256=A4eeO9P3YgfgkFlReZdgKA8TUQ_P5P-n-LoMOD8tL_c,50745 +transformers/models/idefics2/processing_idefics2.py,sha256=b6SmPArpHmJoNL-XagKJPgG8Nzl3Df4XjWfSfZyyjbY,8093 +transformers/models/idefics3/__init__.py,sha256=zLsOtUFi074lvfGbwZEMVSvV08TZgoq0DVhJJagYoRo,1131 +transformers/models/idefics3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/idefics3/__pycache__/configuration_idefics3.cpython-312.pyc,, +transformers/models/idefics3/__pycache__/image_processing_idefics3.cpython-312.pyc,, +transformers/models/idefics3/__pycache__/image_processing_idefics3_fast.cpython-312.pyc,, +transformers/models/idefics3/__pycache__/modeling_idefics3.cpython-312.pyc,, +transformers/models/idefics3/__pycache__/processing_idefics3.cpython-312.pyc,, +transformers/models/idefics3/configuration_idefics3.py,sha256=ljACO4aq0bJ9EqPp_DDP__vsZYTkgbJMhxFGlycS4Hk,8439 +transformers/models/idefics3/image_processing_idefics3.py,sha256=AfwM3l7eMqkKqZrLzSEJ6LMTIzrG53xlUr013jKpwe8,44242 +transformers/models/idefics3/image_processing_idefics3_fast.py,sha256=Vk-1CsGOfh5WNNJgkjiRr8pZN_6tRHetwXtp9YLwu3k,23464 +transformers/models/idefics3/modeling_idefics3.py,sha256=Upid9i_unoT_ujm3xUdJc8gl7YV2oBvuF76jTUKw7YA,41821 +transformers/models/idefics3/processing_idefics3.py,sha256=wKEW8erWTB6i1ud11Sz7Ec3rmA-kbr1TwPLPG8IHvhU,14875 +transformers/models/ijepa/__init__.py,sha256=O0_Jqpy8kmorYC-x0QsoMYSHdqQt3E1j-UZGLQ9aCv0,991 +transformers/models/ijepa/__pycache__/__init__.cpython-312.pyc,, +transformers/models/ijepa/__pycache__/configuration_ijepa.cpython-312.pyc,, +transformers/models/ijepa/__pycache__/modeling_ijepa.cpython-312.pyc,, +transformers/models/ijepa/__pycache__/modular_ijepa.cpython-312.pyc,, +transformers/models/ijepa/configuration_ijepa.py,sha256=_FkXEDsARAt3Li8ScLgpTX38Xpjg4FuvIIpF6r4sM4w,5247 +transformers/models/ijepa/modeling_ijepa.py,sha256=FSg3y6crZAzcAKGmkx261fikllUl1BdMauFsgwZdWeo,20748 +transformers/models/ijepa/modular_ijepa.py,sha256=vvtZa--W223-VhvEoyyn1IuCIJonMa7OjXM1Kb-oOX0,7128 +transformers/models/imagegpt/__init__.py,sha256=NIc1rPRLS3e06c-xUW5Vk80IOSPK2L1ZrY_PJrHn1GY,1139 +transformers/models/imagegpt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/imagegpt/__pycache__/configuration_imagegpt.cpython-312.pyc,, +transformers/models/imagegpt/__pycache__/image_processing_imagegpt.cpython-312.pyc,, +transformers/models/imagegpt/__pycache__/image_processing_imagegpt_fast.cpython-312.pyc,, +transformers/models/imagegpt/__pycache__/modeling_imagegpt.cpython-312.pyc,, +transformers/models/imagegpt/configuration_imagegpt.py,sha256=zx0hIezVdFXXgpS_aKFKh7xK92iHRKbvdc8F7f-1mas,6433 +transformers/models/imagegpt/image_processing_imagegpt.py,sha256=4tzRsDlCToSlRkTsB2S8oWKv5gmGtnZHaxR61sbFBig,15516 +transformers/models/imagegpt/image_processing_imagegpt_fast.py,sha256=d3gOg2ZS3hEj4qE5OZEJPwvKdxD90uygx-jq_xhvfXY,7221 +transformers/models/imagegpt/modeling_imagegpt.py,sha256=fdL-SPpierMHU7xo1LXIVaJIzhFuRHX77sj687a6zpw,37404 +transformers/models/informer/__init__.py,sha256=L-BwVQfdq5ve06VJJ-OnTh-m_YqSMNcpDQ1z6sbDtNI,997 +transformers/models/informer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/informer/__pycache__/configuration_informer.cpython-312.pyc,, +transformers/models/informer/__pycache__/modeling_informer.cpython-312.pyc,, +transformers/models/informer/__pycache__/modular_informer.cpython-312.pyc,, +transformers/models/informer/configuration_informer.py,sha256=Jp661LZdCGbnw3-qJgf_Y-F7W1OyRAupSKW26jaWVsI,12413 +transformers/models/informer/modeling_informer.py,sha256=Tk-U2Sp1ajZhj9Mr7laGXbRZ0Z8xFTDnzQkeXecgGV8,95497 +transformers/models/informer/modular_informer.py,sha256=-n142Khr8hGmsOkyN56PBV3Z4XjhJbgCooroAeXuq1k,41053 +transformers/models/instructblip/__init__.py,sha256=gI7F0N1dRSYdZtTumtuoPcIJcuBI8PO4DEOQS4_nWuc,1048 +transformers/models/instructblip/__pycache__/__init__.cpython-312.pyc,, +transformers/models/instructblip/__pycache__/configuration_instructblip.cpython-312.pyc,, +transformers/models/instructblip/__pycache__/modeling_instructblip.cpython-312.pyc,, +transformers/models/instructblip/__pycache__/processing_instructblip.cpython-312.pyc,, +transformers/models/instructblip/configuration_instructblip.py,sha256=ddEcdgwFGtt3SjjKLmbYniAL9DoCuOuKiEm9ZDufX6A,14703 +transformers/models/instructblip/modeling_instructblip.py,sha256=Iqf6qdAeiLqmW0_nhS7MNyclL4aXRbbX-Gt4wOjfQaA,63768 +transformers/models/instructblip/processing_instructblip.py,sha256=afU05hN3vHDxe8hW8TpYm8NsHHqIdGOxfBnRMDlw7IU,5403 +transformers/models/instructblipvideo/__init__.py,sha256=sgK7MEwrqKB6mQyEvhxcgOQc_OAtMDc9tAZqKF0sxfM,1171 +transformers/models/instructblipvideo/__pycache__/__init__.cpython-312.pyc,, +transformers/models/instructblipvideo/__pycache__/configuration_instructblipvideo.cpython-312.pyc,, +transformers/models/instructblipvideo/__pycache__/modeling_instructblipvideo.cpython-312.pyc,, +transformers/models/instructblipvideo/__pycache__/modular_instructblipvideo.cpython-312.pyc,, +transformers/models/instructblipvideo/__pycache__/processing_instructblipvideo.cpython-312.pyc,, +transformers/models/instructblipvideo/__pycache__/video_processing_instructblipvideo.cpython-312.pyc,, +transformers/models/instructblipvideo/configuration_instructblipvideo.py,sha256=G3hspUpP1MHuRTcUzvxbKWpl4ObuHlIQKT9_fe8n1V8,15826 +transformers/models/instructblipvideo/modeling_instructblipvideo.py,sha256=oFi2ThN5oTrQH3i5UjDkewpSPHnSMvLu8uYIMRPMxuY,66205 +transformers/models/instructblipvideo/modular_instructblipvideo.py,sha256=jqiDWERA6tw6z7lyeeMzO9Ia0qPyIwAlODNvUjOBHds,27631 +transformers/models/instructblipvideo/processing_instructblipvideo.py,sha256=Yjx3AOxIIOO0Xvl9oQGnFxFeNXhzUqsTBNtCYN0D3NA,6953 +transformers/models/instructblipvideo/video_processing_instructblipvideo.py,sha256=qaPXSa8i7SiN-SFxtf3wGQc3JlE003ijSx92p_yTHj0,3611 +transformers/models/internvl/__init__.py,sha256=tNXeZ8TIWlY70CelRiihyPOudKQtRBZp-c9WqglJ8ss,1081 +transformers/models/internvl/__pycache__/__init__.cpython-312.pyc,, +transformers/models/internvl/__pycache__/configuration_internvl.cpython-312.pyc,, +transformers/models/internvl/__pycache__/modeling_internvl.cpython-312.pyc,, +transformers/models/internvl/__pycache__/modular_internvl.cpython-312.pyc,, +transformers/models/internvl/__pycache__/processing_internvl.cpython-312.pyc,, +transformers/models/internvl/__pycache__/video_processing_internvl.cpython-312.pyc,, +transformers/models/internvl/configuration_internvl.py,sha256=ok9uXE_F7Meoy-wFVrVn69BYa7AqOEvmhs-NX3f0tD8,10812 +transformers/models/internvl/modeling_internvl.py,sha256=F16Q0BJK2ImPL6ve2uMcrIHtBjOxCBit3ovVgCYw7pY,38137 +transformers/models/internvl/modular_internvl.py,sha256=WPJB2PtbYd0LO2a4vSqLu3RQC2GavE81WeUWbxZPmH8,25332 +transformers/models/internvl/processing_internvl.py,sha256=2b1v8nUlRrbUEEZqJqUtisx7FQnXQsE66_8xLtzmV5U,12777 +transformers/models/internvl/video_processing_internvl.py,sha256=B2z0lpywKF9SUJNnm2ARVEfzpOMhKK8taWOhK8MeAXs,6385 +transformers/models/jais2/__init__.py,sha256=LVvqkaW19UQe2FBjDw020iqwElvB1n4uqk7Snf_gcac,991 +transformers/models/jais2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/jais2/__pycache__/configuration_jais2.cpython-312.pyc,, +transformers/models/jais2/__pycache__/modeling_jais2.cpython-312.pyc,, +transformers/models/jais2/__pycache__/modular_jais2.cpython-312.pyc,, +transformers/models/jais2/configuration_jais2.py,sha256=fIuPFqBpoZv5zwd-5FcflRBgWIRk4d12HL-8xpZsIa4,7115 +transformers/models/jais2/modeling_jais2.py,sha256=BoRHlnF0-FGBkJEPVqM1yyNsAoQ7eBXSd-ZeSsNyPNg,20691 +transformers/models/jais2/modular_jais2.py,sha256=KBrWCvsULsjRtsnC8y_3PmH10pos9yhsWyjfTtQUOVA,7733 +transformers/models/jamba/__init__.py,sha256=zN7Rmr--d5GCEJzMA7gxIz-BYFydPN3cyuif85YU0Fk,991 +transformers/models/jamba/__pycache__/__init__.cpython-312.pyc,, +transformers/models/jamba/__pycache__/configuration_jamba.cpython-312.pyc,, +transformers/models/jamba/__pycache__/modeling_jamba.cpython-312.pyc,, +transformers/models/jamba/__pycache__/modular_jamba.cpython-312.pyc,, +transformers/models/jamba/configuration_jamba.py,sha256=Q4WHVy0LunqjO8BQhCII0kImRRy0CojedIDMYFpmjaU,10937 +transformers/models/jamba/modeling_jamba.py,sha256=_qDJ3WIKzzhJXQ3mdLB3TGkMtNEYeQ3eR8f_3jeW1aE,49125 +transformers/models/jamba/modular_jamba.py,sha256=dhM6cMaDG2m15VBv3DYTRMRIgM3J4bBGcza1iDg-FpE,35715 +transformers/models/janus/__init__.py,sha256=rTnJnHMmmoPxIVasip4sdS5aZ1wvetOtZUobIMYMHX4,1132 +transformers/models/janus/__pycache__/__init__.cpython-312.pyc,, +transformers/models/janus/__pycache__/configuration_janus.cpython-312.pyc,, +transformers/models/janus/__pycache__/image_processing_janus.cpython-312.pyc,, +transformers/models/janus/__pycache__/image_processing_janus_fast.cpython-312.pyc,, +transformers/models/janus/__pycache__/modeling_janus.cpython-312.pyc,, +transformers/models/janus/__pycache__/modular_janus.cpython-312.pyc,, +transformers/models/janus/__pycache__/processing_janus.cpython-312.pyc,, +transformers/models/janus/configuration_janus.py,sha256=iba9lsTuJB3tGgFoao1P_Kpt-zfPdsOkOTFFcvulves,14893 +transformers/models/janus/image_processing_janus.py,sha256=4kJvl3m9KTX8TDw1QaOLEJgoTKNL1m2YadgCN-n6HSw,26116 +transformers/models/janus/image_processing_janus_fast.py,sha256=djbsj7kyOqeC8_iE_-cyHAaBH4MuDr8D8Co8N4d4OmQ,8707 +transformers/models/janus/modeling_janus.py,sha256=cNC1YfzvdfA6MWsIe7X7GMIo1OjoHx5VQ24k8juiMEw,59402 +transformers/models/janus/modular_janus.py,sha256=esC-UdR0sZ90BO_NEBUjM81TKNYlIJr2Cdi2I1KgI-c,79439 +transformers/models/janus/processing_janus.py,sha256=Xyjb4fM2cvj39wqkVnRO8wgyxEdtS-E9OjKokEfaQVk,7227 +transformers/models/jetmoe/__init__.py,sha256=zhqtP2ZDCCl3Fp3VBnnuaA044Ztbh7fsUKogAKABOt0,993 +transformers/models/jetmoe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/jetmoe/__pycache__/configuration_jetmoe.cpython-312.pyc,, +transformers/models/jetmoe/__pycache__/modeling_jetmoe.cpython-312.pyc,, +transformers/models/jetmoe/__pycache__/modular_jetmoe.cpython-312.pyc,, +transformers/models/jetmoe/configuration_jetmoe.py,sha256=XJAmWJQaYkQDu4jLl-tcPexewr2wd7Z14M3tRrdyPK4,7546 +transformers/models/jetmoe/modeling_jetmoe.py,sha256=xqvcIAsE5sm_VNGeLYe5CXUogirQOgKoaIZ34yc9Nw4,35910 +transformers/models/jetmoe/modular_jetmoe.py,sha256=oXSWfzpyanPtn9YtDn9L8t4CrAn3H2tWynyEWs-iIk8,24518 +transformers/models/kosmos2/__init__.py,sha256=Ow8cLelhxl6fm5XvXzNQtPLt1xjIdVmGUwz5NoVVVto,1033 +transformers/models/kosmos2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/kosmos2/__pycache__/configuration_kosmos2.cpython-312.pyc,, +transformers/models/kosmos2/__pycache__/modeling_kosmos2.cpython-312.pyc,, +transformers/models/kosmos2/__pycache__/processing_kosmos2.cpython-312.pyc,, +transformers/models/kosmos2/configuration_kosmos2.py,sha256=Z4IRDMGyqDlHF1c89sBNwzfBdicTuEp9S3q0XZBApKo,12316 +transformers/models/kosmos2/modeling_kosmos2.py,sha256=aR9sxVekOsOgD-TdkIP8HBdXM_EnaCQLLyd_iURUX0c,80270 +transformers/models/kosmos2/processing_kosmos2.py,sha256=dZMtfTH5Xj-skpD1YgtEgXQ1YpohcnTRVUAerepGr9A,29686 +transformers/models/kosmos2_5/__init__.py,sha256=Ry_vGQuW5FUZfpqseOHgHpb9Qivx1rMLHxq15iNGJVU,1164 +transformers/models/kosmos2_5/__pycache__/__init__.cpython-312.pyc,, +transformers/models/kosmos2_5/__pycache__/configuration_kosmos2_5.cpython-312.pyc,, +transformers/models/kosmos2_5/__pycache__/image_processing_kosmos2_5.cpython-312.pyc,, +transformers/models/kosmos2_5/__pycache__/image_processing_kosmos2_5_fast.cpython-312.pyc,, +transformers/models/kosmos2_5/__pycache__/modeling_kosmos2_5.cpython-312.pyc,, +transformers/models/kosmos2_5/__pycache__/processing_kosmos2_5.cpython-312.pyc,, +transformers/models/kosmos2_5/configuration_kosmos2_5.py,sha256=fdQv9ZhuHhyMtrt4KTKJ21xCFWruK469AoowkNXMz_g,12010 +transformers/models/kosmos2_5/image_processing_kosmos2_5.py,sha256=hWo56kUZF5mCLaEk31Uzqe4_Q-DXhhkTqRoQDy1F-go,14856 +transformers/models/kosmos2_5/image_processing_kosmos2_5_fast.py,sha256=yOr86Y8gPUICWgGVAOSFnxglEx1iFnDHkBht5UUtqMs,10925 +transformers/models/kosmos2_5/modeling_kosmos2_5.py,sha256=9fZjXcfqUjB-2Syt3gvFmM4LSY1FbTn6-3vnd3i58-w,76341 +transformers/models/kosmos2_5/processing_kosmos2_5.py,sha256=JGMgmk_AEwP4P2Lbcixwper8irDA_em4PdQp4xOwSIw,5022 +transformers/models/kyutai_speech_to_text/__init__.py,sha256=KxatXD7pSOmwZWzs7nFOXG9Hc2wxaAS3CYwxg54lq9g,1135 +transformers/models/kyutai_speech_to_text/__pycache__/__init__.cpython-312.pyc,, +transformers/models/kyutai_speech_to_text/__pycache__/configuration_kyutai_speech_to_text.cpython-312.pyc,, +transformers/models/kyutai_speech_to_text/__pycache__/feature_extraction_kyutai_speech_to_text.cpython-312.pyc,, +transformers/models/kyutai_speech_to_text/__pycache__/modeling_kyutai_speech_to_text.cpython-312.pyc,, +transformers/models/kyutai_speech_to_text/__pycache__/modular_kyutai_speech_to_text.cpython-312.pyc,, +transformers/models/kyutai_speech_to_text/__pycache__/processing_kyutai_speech_to_text.cpython-312.pyc,, +transformers/models/kyutai_speech_to_text/configuration_kyutai_speech_to_text.py,sha256=WM-Xlk3t1FJIHswr2ENjeU7fjuJhJIWPL_qy9sK46tg,9843 +transformers/models/kyutai_speech_to_text/feature_extraction_kyutai_speech_to_text.py,sha256=jwuZlFRJXx7ugj587aj1Hy2HcFzT0rQesJkd9piw36A,11643 +transformers/models/kyutai_speech_to_text/modeling_kyutai_speech_to_text.py,sha256=vCIeZf2fW_eB-JXmDYYfapWZpffnnPnTvafYMIesse4,56141 +transformers/models/kyutai_speech_to_text/modular_kyutai_speech_to_text.py,sha256=DC9e40dJZzGtWRABsW5Dajf0UF7E6FA1DIN7Fmeb26Q,23845 +transformers/models/kyutai_speech_to_text/processing_kyutai_speech_to_text.py,sha256=4ytDDKi8Hm7naE_eOdlJzWs44n3ls2MNNi4so6pzS2Q,1222 +transformers/models/lasr/__init__.py,sha256=UbsmofJn1eRFzyEA05Ln2QkBbfutcUmuFy43LhASHGA,1069 +transformers/models/lasr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/lasr/__pycache__/configuration_lasr.cpython-312.pyc,, +transformers/models/lasr/__pycache__/feature_extraction_lasr.cpython-312.pyc,, +transformers/models/lasr/__pycache__/modeling_lasr.cpython-312.pyc,, +transformers/models/lasr/__pycache__/modular_lasr.cpython-312.pyc,, +transformers/models/lasr/__pycache__/processing_lasr.cpython-312.pyc,, +transformers/models/lasr/__pycache__/tokenization_lasr.cpython-312.pyc,, +transformers/models/lasr/configuration_lasr.py,sha256=jlYf1rmD9o_Knh8rvSpyfLEpDXPDY9e9LAhcVR7n5sk,12064 +transformers/models/lasr/feature_extraction_lasr.py,sha256=8hX0fxflZSWv3iomJzw0w1RyXHh2kS6cesoH9B_Ufrw,12852 +transformers/models/lasr/modeling_lasr.py,sha256=R3hUZXxqttljl9pED57oOTP8XknWHyxIujDAjQ6uCLU,31096 +transformers/models/lasr/modular_lasr.py,sha256=pW2ieYypLZBaQuMftr97ChsR2aGYy564WOgP1_W_Fvs,23739 +transformers/models/lasr/processing_lasr.py,sha256=5523eQzqjXvv72sZNt5BMFr0MG22G5lbanBlRPHDn7Y,4494 +transformers/models/lasr/tokenization_lasr.py,sha256=5LjUbCcmRQE04zmupdHZzLJpsG61NOgf_oM0Y-kjQtM,7929 +transformers/models/layoutlm/__init__.py,sha256=CXQ3kNqiSnGoJfjGmZnCsZWFljg1MYZVKSGXtSRpPyg,1153 +transformers/models/layoutlm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/layoutlm/__pycache__/configuration_layoutlm.cpython-312.pyc,, +transformers/models/layoutlm/__pycache__/modeling_layoutlm.cpython-312.pyc,, +transformers/models/layoutlm/configuration_layoutlm.py,sha256=Z_DFyI8LfUi76ll1NsvF89U5_lrlwNHBHFX4egQV8HQ,6319 +transformers/models/layoutlm/modeling_layoutlm.py,sha256=WASmZrLLxl0So3oulz99rfpaiHET_9cZk1Yl99PT0YQ,44004 +transformers/models/layoutlmv2/__init__.py,sha256=a7lJ1uczcz0ea-KPeNk_S6JyNTPNKW6d39qneREmUTk,1233 +transformers/models/layoutlmv2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/layoutlmv2/__pycache__/configuration_layoutlmv2.cpython-312.pyc,, +transformers/models/layoutlmv2/__pycache__/image_processing_layoutlmv2.cpython-312.pyc,, +transformers/models/layoutlmv2/__pycache__/image_processing_layoutlmv2_fast.cpython-312.pyc,, +transformers/models/layoutlmv2/__pycache__/modeling_layoutlmv2.cpython-312.pyc,, +transformers/models/layoutlmv2/__pycache__/processing_layoutlmv2.cpython-312.pyc,, +transformers/models/layoutlmv2/__pycache__/tokenization_layoutlmv2.cpython-312.pyc,, +transformers/models/layoutlmv2/configuration_layoutlmv2.py,sha256=ogZgbdspKiurk4Fhtf4V9sCfFlZgeKwtKTn2dW9mdYc,11112 +transformers/models/layoutlmv2/image_processing_layoutlmv2.py,sha256=z4ztDkVewClX3nZe0NdsQkkT4Q98kjTQF-_jxCFri9o,14241 +transformers/models/layoutlmv2/image_processing_layoutlmv2_fast.py,sha256=FefKs0bhIn_PeRlJfi7DPoapoH0-P0v-IePxeOVtQkw,4434 +transformers/models/layoutlmv2/modeling_layoutlmv2.py,sha256=7PpSKuzEfYZlSCFZhCGcsFgXQ7wrbIPBI_qW3KuVdlE,60774 +transformers/models/layoutlmv2/processing_layoutlmv2.py,sha256=TIowT2fNZDsaTRFVmtaCSX4D23LUw2n_cDr7xyY7sig,5316 +transformers/models/layoutlmv2/tokenization_layoutlmv2.py,sha256=6c2iWBua1aOSUhaFtwRlJTTDhmqspe6wP6GeqzdRQVg,42519 +transformers/models/layoutlmv3/__init__.py,sha256=bgVnOOaQ4iwNhUFh6XgKWEc7NJ-EP_26AsJl2uH-_E4,1233 +transformers/models/layoutlmv3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/layoutlmv3/__pycache__/configuration_layoutlmv3.cpython-312.pyc,, +transformers/models/layoutlmv3/__pycache__/image_processing_layoutlmv3.cpython-312.pyc,, +transformers/models/layoutlmv3/__pycache__/image_processing_layoutlmv3_fast.cpython-312.pyc,, +transformers/models/layoutlmv3/__pycache__/modeling_layoutlmv3.cpython-312.pyc,, +transformers/models/layoutlmv3/__pycache__/processing_layoutlmv3.cpython-312.pyc,, +transformers/models/layoutlmv3/__pycache__/tokenization_layoutlmv3.cpython-312.pyc,, +transformers/models/layoutlmv3/configuration_layoutlmv3.py,sha256=H7s9dWEDywbCEqm5rtTw_xg9faGcpkBw28fsbpwP7Go,8460 +transformers/models/layoutlmv3/image_processing_layoutlmv3.py,sha256=LE8uZxMzepeSSy2K_HH3Rjd4MqrxipR5m7FdQ3XKdSw,19353 +transformers/models/layoutlmv3/image_processing_layoutlmv3_fast.py,sha256=gH1qG-AH6zEgSb8Dcaq3fCnQW1XyaZgcQRfE7PVmT7o,5003 +transformers/models/layoutlmv3/modeling_layoutlmv3.py,sha256=pRijVUlaM_BSX_DjwgepX7xnMotlUFd3KCkVX1krkKk,52299 +transformers/models/layoutlmv3/processing_layoutlmv3.py,sha256=rMkBG1RLG4OvWbyhl5tVddhS0bt3G9ShwUkwVR5NSOY,5097 +transformers/models/layoutlmv3/tokenization_layoutlmv3.py,sha256=ZDTROT5oDFfLQ6cVMFAIeP2U-aVUDfiFWQFPQ1yAuJE,42660 +transformers/models/layoutxlm/__init__.py,sha256=G7vpZzVESxlNUZ7PtI8z28ng6MalHJAXFViKeoFSkCA,1043 +transformers/models/layoutxlm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/layoutxlm/__pycache__/configuration_layoutxlm.cpython-312.pyc,, +transformers/models/layoutxlm/__pycache__/modular_layoutxlm.cpython-312.pyc,, +transformers/models/layoutxlm/__pycache__/processing_layoutxlm.cpython-312.pyc,, +transformers/models/layoutxlm/__pycache__/tokenization_layoutxlm.cpython-312.pyc,, +transformers/models/layoutxlm/configuration_layoutxlm.py,sha256=le5Valj8b0aMMj2g-RAbJxwHl8xJepRLnKT8bQYavTQ,11801 +transformers/models/layoutxlm/modular_layoutxlm.py,sha256=UYbSsoU2jezheCSpPuG4iuLknunD9Xsi4TLS50TWDco,6425 +transformers/models/layoutxlm/processing_layoutxlm.py,sha256=ibbzcqmbnKb4mUSVMZjY-AfJ7ZfxuiEVh7zTR1ABBNo,5294 +transformers/models/layoutxlm/tokenization_layoutxlm.py,sha256=u6W_Tmk83PS5KI5rozEAJjt9a1sMgFEYijuZpH3k10I,46151 +transformers/models/led/__init__.py,sha256=Zsd1RB7usdzST298N6SYV9M-3tC1W6Z8d4k-xwF-Vm8,1067 +transformers/models/led/__pycache__/__init__.cpython-312.pyc,, +transformers/models/led/__pycache__/configuration_led.cpython-312.pyc,, +transformers/models/led/__pycache__/modeling_led.cpython-312.pyc,, +transformers/models/led/configuration_led.py,sha256=8Qrq_bHicXzs-2t_-8PwcnVOoMfMjj-Vn7FsxI0YJEA,7467 +transformers/models/led/modeling_led.py,sha256=gEEIVrrt9pNfIMpCRMf4YSk-NvUB65pQkWh15Z922No,107847 +transformers/models/levit/__init__.py,sha256=acEjEeDtpQ9q3a-hf90z6TZ0js04BtZvbCcn4HGWCyk,1124 +transformers/models/levit/__pycache__/__init__.cpython-312.pyc,, +transformers/models/levit/__pycache__/configuration_levit.cpython-312.pyc,, +transformers/models/levit/__pycache__/image_processing_levit.cpython-312.pyc,, +transformers/models/levit/__pycache__/image_processing_levit_fast.cpython-312.pyc,, +transformers/models/levit/__pycache__/modeling_levit.cpython-312.pyc,, +transformers/models/levit/configuration_levit.py,sha256=Zzy87xKwOp97lfYhH-p1FAdRfgk5f-P9yp_ovbw3WAA,5132 +transformers/models/levit/image_processing_levit.py,sha256=W17jvj2W_PNaQ9BfZcaDAKHSet14c71LjNeXS1fXb18,16325 +transformers/models/levit/image_processing_levit_fast.py,sha256=lPgGEtvBCuNekwmezoNzrGn2ToQ5KCleTLbimhqUQbs,3721 +transformers/models/levit/modeling_levit.py,sha256=Xx_63PQA7LZQxgZpRNSd9QP5tLmZxJLAoM60iX6sDi4,25355 +transformers/models/lfm2/__init__.py,sha256=9fNMRtqveDp18iRtUjNqCu0XELuvwJOmizUyI1h0zHw,989 +transformers/models/lfm2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/lfm2/__pycache__/configuration_lfm2.cpython-312.pyc,, +transformers/models/lfm2/__pycache__/modeling_lfm2.cpython-312.pyc,, +transformers/models/lfm2/__pycache__/modular_lfm2.cpython-312.pyc,, +transformers/models/lfm2/configuration_lfm2.py,sha256=KPex3cD3Ljv2SoOJMdb7McKfIuheRp9bslMv1wvYEm4,8214 +transformers/models/lfm2/modeling_lfm2.py,sha256=2cCsMHabiTlANbv4wtDQAKE-zAw1uj8Bv-jBIPkyNEU,32731 +transformers/models/lfm2/modular_lfm2.py,sha256=3-J3I8Plf1Az2i5GhjGLse_z4cciIrKvAHpQMpchTjs,20058 +transformers/models/lfm2_moe/__init__.py,sha256=_yqIDhEkNsZIDJ1IlpVkA9Lvnlby05bpiPZvZid9na8,998 +transformers/models/lfm2_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/lfm2_moe/__pycache__/configuration_lfm2_moe.cpython-312.pyc,, +transformers/models/lfm2_moe/__pycache__/modeling_lfm2_moe.cpython-312.pyc,, +transformers/models/lfm2_moe/__pycache__/modular_lfm2_moe.cpython-312.pyc,, +transformers/models/lfm2_moe/configuration_lfm2_moe.py,sha256=DU3jX4a-IyAbVAfGuM0sb9s2W2tv99QNr5WG7tTsr_4,8384 +transformers/models/lfm2_moe/modeling_lfm2_moe.py,sha256=OWWZCTnbB1s17xyL8mHUPSwzaBDEtqXynNZv7KypdN4,37167 +transformers/models/lfm2_moe/modular_lfm2_moe.py,sha256=3hbnRAYirfVFQxHAvzjsiV-FRh99XTzmpjysPDqMo18,8764 +transformers/models/lfm2_vl/__init__.py,sha256=qKhv0-rYp9emO4HCSVPOpPCB8hUy62P2v2rYjkBeTAI,1082 +transformers/models/lfm2_vl/__pycache__/__init__.cpython-312.pyc,, +transformers/models/lfm2_vl/__pycache__/configuration_lfm2_vl.cpython-312.pyc,, +transformers/models/lfm2_vl/__pycache__/image_processing_lfm2_vl_fast.cpython-312.pyc,, +transformers/models/lfm2_vl/__pycache__/modeling_lfm2_vl.cpython-312.pyc,, +transformers/models/lfm2_vl/__pycache__/modular_lfm2_vl.cpython-312.pyc,, +transformers/models/lfm2_vl/__pycache__/processing_lfm2_vl.cpython-312.pyc,, +transformers/models/lfm2_vl/configuration_lfm2_vl.py,sha256=b-HmIVvjUsof02KsrhqaruJi-m0PJek6b2Q7DbK4VQ4,4339 +transformers/models/lfm2_vl/image_processing_lfm2_vl_fast.py,sha256=zL1aWVqtWt4ruWJGZlHBlajQPjILwJeO-z_qCKPJMJs,23597 +transformers/models/lfm2_vl/modeling_lfm2_vl.py,sha256=ZhzYjzXmFU8dIN6OHqnMjEK--mUjTss2MEuvH-3Rjuc,21032 +transformers/models/lfm2_vl/modular_lfm2_vl.py,sha256=P1RN91NsDHzDUX19Fm2aRSXU4ypFaQ8KHpw4R-qw4A4,14944 +transformers/models/lfm2_vl/processing_lfm2_vl.py,sha256=TcOxkkO_pDXn4sPAOJ22bfUDai8t2zd20KXAFPS_FJw,11061 +transformers/models/lightglue/__init__.py,sha256=EI3kV4B5hnpUdzpP3PylbMIWX3Na80-8R0-tK1l_9g4,1096 +transformers/models/lightglue/__pycache__/__init__.cpython-312.pyc,, +transformers/models/lightglue/__pycache__/configuration_lightglue.cpython-312.pyc,, +transformers/models/lightglue/__pycache__/image_processing_lightglue.cpython-312.pyc,, +transformers/models/lightglue/__pycache__/image_processing_lightglue_fast.cpython-312.pyc,, +transformers/models/lightglue/__pycache__/modeling_lightglue.cpython-312.pyc,, +transformers/models/lightglue/__pycache__/modular_lightglue.cpython-312.pyc,, +transformers/models/lightglue/configuration_lightglue.py,sha256=_JVnWv0KcM8oKpUWMJs0bpLM-XWMCUgWi8gwr6oTTBE,8135 +transformers/models/lightglue/image_processing_lightglue.py,sha256=mdQpPkzN53Faq0JZ4sQ-VU0cB-qoQpGp0VWaKF2AfG0,22104 +transformers/models/lightglue/image_processing_lightglue_fast.py,sha256=5zDA4TD0Zhxpw4RcNB7oAPjNtCru_p-Q1LKH_zVS5uk,13415 +transformers/models/lightglue/modeling_lightglue.py,sha256=3uFdps7LRlfr37JeYC4ABWBoftKAFBBYEVgk9o0IqL8,43311 +transformers/models/lightglue/modular_lightglue.py,sha256=m0mRllwEvhpjC4rZar7I_Uq7SRiaGb7CIiYANSvyZf8,45910 +transformers/models/lighton_ocr/__init__.py,sha256=AuPKc-HKbs3mL5TQMIXjGEKFSgmqiesmHdh_vz1ufgA,1071 +transformers/models/lighton_ocr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/lighton_ocr/__pycache__/configuration_lighton_ocr.cpython-312.pyc,, +transformers/models/lighton_ocr/__pycache__/modeling_lighton_ocr.cpython-312.pyc,, +transformers/models/lighton_ocr/__pycache__/modular_lighton_ocr.cpython-312.pyc,, +transformers/models/lighton_ocr/__pycache__/processing_lighton_ocr.cpython-312.pyc,, +transformers/models/lighton_ocr/configuration_lighton_ocr.py,sha256=543HtJ22QU7r_Ys1WsZuoxq_ny2xjtedZtY_ECZzNBA,5817 +transformers/models/lighton_ocr/modeling_lighton_ocr.py,sha256=DMVTJeeVS-olmO1B27e8ej2iN7MpQFD_aj4SSAUjzdI,20806 +transformers/models/lighton_ocr/modular_lighton_ocr.py,sha256=OMDinUinLqvrZ4o1-EEK7prBqllt3jCaK9VpzI-UsMo,16992 +transformers/models/lighton_ocr/processing_lighton_ocr.py,sha256=geRPzTsqs-3sofqMaSfoplga6QZaf0HVnW3C20qxCVo,10514 +transformers/models/lilt/__init__.py,sha256=9XEq7kJwN0mKO469mR0mtlRUdljjq7V80gejpqb59K0,989 +transformers/models/lilt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/lilt/__pycache__/configuration_lilt.cpython-312.pyc,, +transformers/models/lilt/__pycache__/modeling_lilt.cpython-312.pyc,, +transformers/models/lilt/configuration_lilt.py,sha256=El4nERIMVPaq7iHrRG5dv4I4ZSwMj9IV_NZ0WhUy4Jo,6107 +transformers/models/lilt/modeling_lilt.py,sha256=l2A_ji3nb7JTMZ7RHDgc1E9C_nbKt1dxw_MjY696WwI,42307 +transformers/models/llama/__init__.py,sha256=LudwEMppX6Bp64aF29OM0FLgQ8KOlJwqvA0Uhcax-cM,1029 +transformers/models/llama/__pycache__/__init__.cpython-312.pyc,, +transformers/models/llama/__pycache__/configuration_llama.cpython-312.pyc,, +transformers/models/llama/__pycache__/modeling_llama.cpython-312.pyc,, +transformers/models/llama/__pycache__/tokenization_llama.cpython-312.pyc,, +transformers/models/llama/configuration_llama.py,sha256=gbpKEOcuBGr4zB4yRZFEFUqbISI3lF4u3ETB10iVT44,9230 +transformers/models/llama/modeling_llama.py,sha256=xEy3u9gtYSirR12AH_PjrqypNW-XWhdYuqeIkPzhnnc,21837 +transformers/models/llama/tokenization_llama.py,sha256=zPlApP7BmmzCAHnKz2X-kWGma1jujUaaQ23lOihfysg,6346 +transformers/models/llama4/__init__.py,sha256=YLpUGkKivYWky6rr715H2yMb9fCPr_3AV8OwWd2mrpA,1078 +transformers/models/llama4/__pycache__/__init__.cpython-312.pyc,, +transformers/models/llama4/__pycache__/configuration_llama4.cpython-312.pyc,, +transformers/models/llama4/__pycache__/image_processing_llama4_fast.cpython-312.pyc,, +transformers/models/llama4/__pycache__/modeling_llama4.cpython-312.pyc,, +transformers/models/llama4/__pycache__/processing_llama4.cpython-312.pyc,, +transformers/models/llama4/configuration_llama4.py,sha256=H55rb0u7piXwbx3iOksBqe5EuEyA22oPMkmJPiW6YLo,22254 +transformers/models/llama4/image_processing_llama4_fast.py,sha256=8ZAOAVrqtfN4G94bzRNgAjfzO_kfEzGth61uZccoeUc,17001 +transformers/models/llama4/modeling_llama4.py,sha256=IlpTa5yBqi_1LQ_TwjzF8qSKDQI3_OMboLo9KQhGJxY,60033 +transformers/models/llama4/processing_llama4.py,sha256=oCaHuMVqg45Nfz-3NPBhTZlxdD7gL9crBT805oBe0ok,14177 +transformers/models/llava/__init__.py,sha256=h7TDiwhtiqDQbay9v760sbmBGM6yWs3J1tmnIr3PCys,1074 +transformers/models/llava/__pycache__/__init__.cpython-312.pyc,, +transformers/models/llava/__pycache__/configuration_llava.cpython-312.pyc,, +transformers/models/llava/__pycache__/image_processing_llava.cpython-312.pyc,, +transformers/models/llava/__pycache__/image_processing_llava_fast.cpython-312.pyc,, +transformers/models/llava/__pycache__/modeling_llava.cpython-312.pyc,, +transformers/models/llava/__pycache__/processing_llava.cpython-312.pyc,, +transformers/models/llava/configuration_llava.py,sha256=--Tvme4j6pAWcJI15aIjFPGCl4G8ueHpDCStjmhL7UY,6353 +transformers/models/llava/image_processing_llava.py,sha256=87R3gDUTyWprS5UCGKQjb2-QMz1zN6T6cwPm4xZQyZk,20812 +transformers/models/llava/image_processing_llava_fast.py,sha256=f2miX838xvCJEYPIZ1gxjZ-OAuu_31Qvw4ni99h5JSs,6072 +transformers/models/llava/modeling_llava.py,sha256=n-py1VlyVnV1aPi8GXQMxy5nSaBKIuavTH3y7y0o7Ic,18780 +transformers/models/llava/processing_llava.py,sha256=5dxlcEgfPP6WPa-dGus_Qhy6QxVjikYlQNOa7P1dlTQ,7447 +transformers/models/llava_next/__init__.py,sha256=gyT3qcEjuxecgCiFoQoz-tf10ShqzfOL8IzPOhpjfto,1141 +transformers/models/llava_next/__pycache__/__init__.cpython-312.pyc,, +transformers/models/llava_next/__pycache__/configuration_llava_next.cpython-312.pyc,, +transformers/models/llava_next/__pycache__/image_processing_llava_next.cpython-312.pyc,, +transformers/models/llava_next/__pycache__/image_processing_llava_next_fast.cpython-312.pyc,, +transformers/models/llava_next/__pycache__/modeling_llava_next.cpython-312.pyc,, +transformers/models/llava_next/__pycache__/processing_llava_next.cpython-312.pyc,, +transformers/models/llava_next/configuration_llava_next.py,sha256=_rjez8bcHNQd0OzgOZS3cdkM14Om5_ij5r6PaBqRVcM,6775 +transformers/models/llava_next/image_processing_llava_next.py,sha256=2HB1YEnlUibVlwsSSkTtvaCgAmYl9A22MmbpWai3tos,35817 +transformers/models/llava_next/image_processing_llava_next_fast.py,sha256=YSmorIPpi-DmlPlT6VEZFSqruBeKHUSz72eY4fxvju4,10102 +transformers/models/llava_next/modeling_llava_next.py,sha256=66El0sRTbQ8pRUj9Yv2tbQoYAI1x6ENmKWQ_ahWMkkM,32706 +transformers/models/llava_next/processing_llava_next.py,sha256=skipesVMRszW3aCmyXymXShEtvDgJTXCnPIyp5WcqRc,10613 +transformers/models/llava_next_video/__init__.py,sha256=OGiUL7X9x0bzmsnZi0KA6Sl2ycalLQHkTgOpISYu3q8,1113 +transformers/models/llava_next_video/__pycache__/__init__.cpython-312.pyc,, +transformers/models/llava_next_video/__pycache__/configuration_llava_next_video.cpython-312.pyc,, +transformers/models/llava_next_video/__pycache__/modeling_llava_next_video.cpython-312.pyc,, +transformers/models/llava_next_video/__pycache__/modular_llava_next_video.cpython-312.pyc,, +transformers/models/llava_next_video/__pycache__/processing_llava_next_video.cpython-312.pyc,, +transformers/models/llava_next_video/__pycache__/video_processing_llava_next_video.cpython-312.pyc,, +transformers/models/llava_next_video/configuration_llava_next_video.py,sha256=y92eZcUlAaBmOaQAuoQWoYGDcagQpRFrhNUJ9hbd13U,8631 +transformers/models/llava_next_video/modeling_llava_next_video.py,sha256=_RRItpHVZKjjFhDi9La765TqHCv-m5ePSPVQgkAtPrU,43772 +transformers/models/llava_next_video/modular_llava_next_video.py,sha256=YAFomFizvbfdGuHVqdrEddiYi6CVywv4tMMu3dpaur4,35231 +transformers/models/llava_next_video/processing_llava_next_video.py,sha256=pG38uFnf-WGT20m60WhZEHY36Azyt_MKjD1FGQL2i4I,12147 +transformers/models/llava_next_video/video_processing_llava_next_video.py,sha256=M9zikrv4btULV6w01WgzWLoQsLFh1QZdOkr6xiFeLf8,1333 +transformers/models/llava_onevision/__init__.py,sha256=Eeg8yGcfdjCxwjSCg_zoXG48JG6gSYH8_aXBcOxQvnA,1218 +transformers/models/llava_onevision/__pycache__/__init__.cpython-312.pyc,, +transformers/models/llava_onevision/__pycache__/configuration_llava_onevision.cpython-312.pyc,, +transformers/models/llava_onevision/__pycache__/image_processing_llava_onevision.cpython-312.pyc,, +transformers/models/llava_onevision/__pycache__/image_processing_llava_onevision_fast.cpython-312.pyc,, +transformers/models/llava_onevision/__pycache__/modeling_llava_onevision.cpython-312.pyc,, +transformers/models/llava_onevision/__pycache__/modular_llava_onevision.cpython-312.pyc,, +transformers/models/llava_onevision/__pycache__/processing_llava_onevision.cpython-312.pyc,, +transformers/models/llava_onevision/__pycache__/video_processing_llava_onevision.cpython-312.pyc,, +transformers/models/llava_onevision/configuration_llava_onevision.py,sha256=uneVChPYmU_1EU_1o_ubIObuT8aSa8WKd3Ydci8y-UA,8426 +transformers/models/llava_onevision/image_processing_llava_onevision.py,sha256=Mjk5GXv3C7jvtCG18dslvQb_tN5FKH5EtlsJOP8SAo4,38360 +transformers/models/llava_onevision/image_processing_llava_onevision_fast.py,sha256=9sWnftxAVQoUtuowEZhW4ytaT2R-XYWzsGBCEjlm3nY,14137 +transformers/models/llava_onevision/modeling_llava_onevision.py,sha256=cU67o9siXlhQowYVrfSgYUKX6tzNqehBawrbcpN7DG8,42492 +transformers/models/llava_onevision/modular_llava_onevision.py,sha256=9Hw_G579CjmjV7-aDiOo6nyLVTt12eYEAQwKy9qwO4M,34142 +transformers/models/llava_onevision/processing_llava_onevision.py,sha256=pAZGfYrURXcwz9tLKckAKwi1-stoey8SxnY_ijZxJUg,14146 +transformers/models/llava_onevision/video_processing_llava_onevision.py,sha256=HESFKZLb3MKHPq_ONupz6cN4RZYGippChiPIMsSvD8c,1343 +transformers/models/longcat_flash/__init__.py,sha256=UhywfXc2iMxAuE8H--Mm6vxHLlKUp0FAAe0aq8QBxKA,1025 +transformers/models/longcat_flash/__pycache__/__init__.cpython-312.pyc,, +transformers/models/longcat_flash/__pycache__/configuration_longcat_flash.cpython-312.pyc,, +transformers/models/longcat_flash/__pycache__/modeling_longcat_flash.cpython-312.pyc,, +transformers/models/longcat_flash/__pycache__/modular_longcat_flash.cpython-312.pyc,, +transformers/models/longcat_flash/configuration_longcat_flash.py,sha256=uGQ7h_R00Ms-x1ITfJlKSM34xSHadeIM-T6zP2swzZE,11915 +transformers/models/longcat_flash/modeling_longcat_flash.py,sha256=wnVzSUwFCBylOb8F5pM2xUvsaEvVVgN2n0CmfJPcHFk,32155 +transformers/models/longcat_flash/modular_longcat_flash.py,sha256=akz7EuuKxJsTAmNrJtXf3RBCZnlcrcXVlE_Vl7VgARE,18097 +transformers/models/longformer/__init__.py,sha256=qPm9rxvA-GeXV4gkzDqwu-SooVa3SBUvYI8C_SFgeYE,1088 +transformers/models/longformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/longformer/__pycache__/configuration_longformer.cpython-312.pyc,, +transformers/models/longformer/__pycache__/modeling_longformer.cpython-312.pyc,, +transformers/models/longformer/configuration_longformer.py,sha256=-bIvN1PQkWm5u_i6g-uy-GcDVoUyYcKZ2-TeNftxggM,6324 +transformers/models/longformer/modeling_longformer.py,sha256=vf31l_MtglKa9bjDF_rH8hcG-_C0_oL2CGZHdVl48F0,103166 +transformers/models/longt5/__init__.py,sha256=nmh4Vo8chv_I8xPFPFKu3Rfa_YbctUxl4ik5Ao-AaIM,993 +transformers/models/longt5/__pycache__/__init__.cpython-312.pyc,, +transformers/models/longt5/__pycache__/configuration_longt5.cpython-312.pyc,, +transformers/models/longt5/__pycache__/modeling_longt5.cpython-312.pyc,, +transformers/models/longt5/configuration_longt5.py,sha256=MDIqhoGthNw6VqFPPqDwD_nOtJd5iqc6H7JmjYLJdeM,7196 +transformers/models/longt5/modeling_longt5.py,sha256=O5eEwTYzLf03dmP_FBeh8GfmcPU7sulGpbCnQ6Aj9II,86059 +transformers/models/luke/__init__.py,sha256=YQL403sV6tk5t8sjvi-4hgvx1rvyThx45l7S4T4xpEE,1026 +transformers/models/luke/__pycache__/__init__.cpython-312.pyc,, +transformers/models/luke/__pycache__/configuration_luke.cpython-312.pyc,, +transformers/models/luke/__pycache__/modeling_luke.cpython-312.pyc,, +transformers/models/luke/__pycache__/tokenization_luke.cpython-312.pyc,, +transformers/models/luke/configuration_luke.py,sha256=oYdK8wUjRFvtd9JkEPVJ_4m433yyK83qYmDpFkmtA4o,6859 +transformers/models/luke/modeling_luke.py,sha256=mACTjSm0qF5wY7kg_qRr4M_PX88Mgy3QH55FUc4c_Po,95981 +transformers/models/luke/tokenization_luke.py,sha256=SNK1u0UbPwVpaF6ys6RdFIgFeWphS2EcPZNyAsWnfI0,82419 +transformers/models/lw_detr/__init__.py,sha256=aR6j6aZ-ntKyVKN1HzWJHOPLZjeNK9iVKg-476Chk04,995 +transformers/models/lw_detr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/lw_detr/__pycache__/configuration_lw_detr.cpython-312.pyc,, +transformers/models/lw_detr/__pycache__/modeling_lw_detr.cpython-312.pyc,, +transformers/models/lw_detr/__pycache__/modular_lw_detr.cpython-312.pyc,, +transformers/models/lw_detr/configuration_lw_detr.py,sha256=RCoN9P3oksMt2f19nffy9MdbNQ8C_ztu3P-VIW2wv0A,18965 +transformers/models/lw_detr/modeling_lw_detr.py,sha256=wMIHMKJQDJqULb1hbT3sUed6siDfsCoAjzNkQVmAw3k,75969 +transformers/models/lw_detr/modular_lw_detr.py,sha256=J0w9FBEfs3boYAq5sduytMc4iuzg3YWMFmjM_j5ZXZ8,72373 +transformers/models/lxmert/__init__.py,sha256=kt9QI783KwDwwUPx4BIY8AH-IHKydHuVJal6hRZpINU,1067 +transformers/models/lxmert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/lxmert/__pycache__/configuration_lxmert.cpython-312.pyc,, +transformers/models/lxmert/__pycache__/modeling_lxmert.cpython-312.pyc,, +transformers/models/lxmert/configuration_lxmert.py,sha256=iI68lQ1Lu71i1IpKDkCosOjIQZW7HBmJ-CURuWuG7S4,9313 +transformers/models/lxmert/modeling_lxmert.py,sha256=tmOZaVkjpjyW9LOVEJMSfAK3wKKrdazeSNcyiQQD9eI,58743 +transformers/models/m2m_100/__init__.py,sha256=0uPov299rgQmMwwSyM_m0yGFejP5djgaUY37GkNGnC8,1035 +transformers/models/m2m_100/__pycache__/__init__.cpython-312.pyc,, +transformers/models/m2m_100/__pycache__/configuration_m2m_100.cpython-312.pyc,, +transformers/models/m2m_100/__pycache__/modeling_m2m_100.cpython-312.pyc,, +transformers/models/m2m_100/__pycache__/tokenization_m2m_100.cpython-312.pyc,, +transformers/models/m2m_100/configuration_m2m_100.py,sha256=R_5RIp87-hXhvBfJgenwebeCKq4J4qUMYgrUD3tr2EI,7131 +transformers/models/m2m_100/modeling_m2m_100.py,sha256=9ZyDw2O5mbr0xV8ibdjG4BLHFyj1cn7G0Vi3p32TxJ0,51505 +transformers/models/m2m_100/tokenization_m2m_100.py,sha256=II_GyUrqHFNEFzTylsmYDQ-aWskX7byIXtXvwnmrrOE,16373 +transformers/models/mamba/__init__.py,sha256=4oGJySQbwoALRGVWMEwXBm0A6fhKsr4Raly46a5g1G0,991 +transformers/models/mamba/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mamba/__pycache__/configuration_mamba.cpython-312.pyc,, +transformers/models/mamba/__pycache__/modeling_mamba.cpython-312.pyc,, +transformers/models/mamba/configuration_mamba.py,sha256=ApzbTvcj1EJvfrSZze0R7JuwbfUUKBi3lox4GpTD0Lw,7540 +transformers/models/mamba/modeling_mamba.py,sha256=YMesSOj-U82eqmY9BYlCr2DloYg6nkb7F-Fl7T1qIPY,39154 +transformers/models/mamba2/__init__.py,sha256=Ui4j-I2cnPEEszkzRTLSUW42SE4Qg1YTuW6hGeaOFZg,993 +transformers/models/mamba2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mamba2/__pycache__/configuration_mamba2.cpython-312.pyc,, +transformers/models/mamba2/__pycache__/modeling_mamba2.cpython-312.pyc,, +transformers/models/mamba2/configuration_mamba2.py,sha256=gqDS-hNqOi7SkLmOf3RBBH0gTZqSpdTVfNag3-4KaVU,8184 +transformers/models/mamba2/modeling_mamba2.py,sha256=jtTEWVVTYFReAVVQRaDK1gpbYPqeDub5yQup0ebGcxw,47647 +transformers/models/marian/__init__.py,sha256=IavSoQb-8nSlrq_0eDIkX4zD1tGNj4ybHyRKrDOTnMY,1032 +transformers/models/marian/__pycache__/__init__.cpython-312.pyc,, +transformers/models/marian/__pycache__/configuration_marian.cpython-312.pyc,, +transformers/models/marian/__pycache__/modeling_marian.cpython-312.pyc,, +transformers/models/marian/__pycache__/tokenization_marian.cpython-312.pyc,, +transformers/models/marian/configuration_marian.py,sha256=nlpnn8agTz7YaWahOXBZztcPI2WY6R21QPLy0Ps_d6I,7837 +transformers/models/marian/modeling_marian.py,sha256=B6_8VvmBCkYtvtR77EH9tJsAv4-T2iBwxM6cd5D73z0,61225 +transformers/models/marian/tokenization_marian.py,sha256=14YSQmg4xlvitWyRhFGVOGi1Fa3Q-ZP-u_TjkM6czL0,18086 +transformers/models/markuplm/__init__.py,sha256=-zg9rYmX3BVnq2mZPjDnW2bvZv2LIu6vm_y9grRTTRU,1083 +transformers/models/markuplm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/markuplm/__pycache__/configuration_markuplm.cpython-312.pyc,, +transformers/models/markuplm/__pycache__/feature_extraction_markuplm.cpython-312.pyc,, +transformers/models/markuplm/__pycache__/modeling_markuplm.cpython-312.pyc,, +transformers/models/markuplm/__pycache__/processing_markuplm.cpython-312.pyc,, +transformers/models/markuplm/__pycache__/tokenization_markuplm.cpython-312.pyc,, +transformers/models/markuplm/configuration_markuplm.py,sha256=23UgTNtrtQrRSGyz2wP7XQpIixKNWZSSoYGACyIzYjY,7203 +transformers/models/markuplm/feature_extraction_markuplm.py,sha256=DTZiB6aiAsEW1sPj_w5qTtr76BSVCpd15wmZUXCuj9A,6428 +transformers/models/markuplm/modeling_markuplm.py,sha256=ppT37N3s43KdG59UlFdnjsRZCs1_WGCF9Qsfux_KGT8,39525 +transformers/models/markuplm/processing_markuplm.py,sha256=pTpnvCXls-BqlEL0KG0OuIhEB5M-KMwj7shprN8iY1k,5710 +transformers/models/markuplm/tokenization_markuplm.py,sha256=NCA_J-GDnJmNNiFkZ3VZxbFgyy23Uct9SiOwG9XImkw,48683 +transformers/models/mask2former/__init__.py,sha256=ceWZ-4gEaZxvgdhdvM-K18wZxuovtdS8vXkQIFNlfr4,1104 +transformers/models/mask2former/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mask2former/__pycache__/configuration_mask2former.cpython-312.pyc,, +transformers/models/mask2former/__pycache__/image_processing_mask2former.cpython-312.pyc,, +transformers/models/mask2former/__pycache__/image_processing_mask2former_fast.cpython-312.pyc,, +transformers/models/mask2former/__pycache__/modeling_mask2former.cpython-312.pyc,, +transformers/models/mask2former/__pycache__/modular_mask2former.cpython-312.pyc,, +transformers/models/mask2former/configuration_mask2former.py,sha256=ubG20EaFTJFXS3bYxVA0uZ96G13PGUMdmBB7s24fDuw,9741 +transformers/models/mask2former/image_processing_mask2former.py,sha256=Go4prhR1CYi6MrhQZrkFBrrYh-QgszgYgIre3iBzi8E,57877 +transformers/models/mask2former/image_processing_mask2former_fast.py,sha256=KVuFTTF9qjyBRK712CDAN-htUPsSmiperKHunB6nYQk,32348 +transformers/models/mask2former/modeling_mask2former.py,sha256=ptN45_MYs_o-eDxrBV3Em1ba1SomgZVtGfp7jp9oVac,117587 +transformers/models/mask2former/modular_mask2former.py,sha256=8CF1tF24x25XMhswD7Npm-zwICVCSiSJU72f5GRJmc0,15516 +transformers/models/maskformer/__init__.py,sha256=DWCF0SA7DGofmzu3y-j05x1NLeuKZHADvyyx4XfJwkw,1242 +transformers/models/maskformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/maskformer/__pycache__/configuration_maskformer.cpython-312.pyc,, +transformers/models/maskformer/__pycache__/configuration_maskformer_swin.cpython-312.pyc,, +transformers/models/maskformer/__pycache__/image_processing_maskformer.cpython-312.pyc,, +transformers/models/maskformer/__pycache__/image_processing_maskformer_fast.cpython-312.pyc,, +transformers/models/maskformer/__pycache__/modeling_maskformer.cpython-312.pyc,, +transformers/models/maskformer/__pycache__/modeling_maskformer_swin.cpython-312.pyc,, +transformers/models/maskformer/configuration_maskformer.py,sha256=ezTfgCaV42cN6btCb6G3cqnvUSJU4Q3uYg-IOtMarEY,7694 +transformers/models/maskformer/configuration_maskformer_swin.py,sha256=ZyJFX5136_kt1uxEFCtUNKPF7-mmJGFx2YeeR83xvJg,7093 +transformers/models/maskformer/image_processing_maskformer.py,sha256=mPTSecDFVUGh0LSsyplGhtBZ1Uer8xDUCF_SYW9GGlw,56442 +transformers/models/maskformer/image_processing_maskformer_fast.py,sha256=gEGcK_dJtcHOTK4mGBeV0zpu1Mv1K5Wmu9c8L9EC_Mc,31339 +transformers/models/maskformer/modeling_maskformer.py,sha256=SoKZdDyABU45fpCxvtqqE4gGo7KQOwADFcNPdsmo5G0,85299 +transformers/models/maskformer/modeling_maskformer_swin.py,sha256=YM5eA9qWqy8b8Xw9ZRinfjtR4dd76iBw07BB23T1zck,37582 +transformers/models/mbart/__init__.py,sha256=VYCZE-XKXmLlOTjcAToavJNZALlW0UNqkgdcdhLnm8c,1029 +transformers/models/mbart/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mbart/__pycache__/configuration_mbart.cpython-312.pyc,, +transformers/models/mbart/__pycache__/modeling_mbart.cpython-312.pyc,, +transformers/models/mbart/__pycache__/tokenization_mbart.cpython-312.pyc,, +transformers/models/mbart/configuration_mbart.py,sha256=Cvn0pdHmrFAUA0MFug_-9m38gwlSm3b7VsyArkCbuIs,7741 +transformers/models/mbart/modeling_mbart.py,sha256=w_tH0ZC2G9mSQIe1DH7SAGFINvC1bM4LgKYmdcW1nGY,70665 +transformers/models/mbart/tokenization_mbart.py,sha256=iChlZW6tL561ENOD_oTXF97aUcCk0kI0Qfmm9QA8njE,8473 +transformers/models/mbart50/__init__.py,sha256=ZxOzDc6AP0x0jp3EgGeQZx1xOApVeWbuQan7aqj-Xeo,958 +transformers/models/mbart50/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mbart50/__pycache__/tokenization_mbart50.cpython-312.pyc,, +transformers/models/mbart50/tokenization_mbart50.py,sha256=EHj00Oq3GxEase8qQ7gA9n-9oCchSqQg-r1SDKJ3PWc,14853 +transformers/models/megatron_bert/__init__.py,sha256=u1UIYjQlrfHcy81i2FzehRDJpt6KNfNJ4AePQYKgwOU,1007 +transformers/models/megatron_bert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/megatron_bert/__pycache__/configuration_megatron_bert.cpython-312.pyc,, +transformers/models/megatron_bert/__pycache__/modeling_megatron_bert.cpython-312.pyc,, +transformers/models/megatron_bert/configuration_megatron_bert.py,sha256=TeK8PfB3SlL3CplTlCjH5akgw5K--063hKvzRkrDltA,6129 +transformers/models/megatron_bert/modeling_megatron_bert.py,sha256=wqE2pDqfPnVHdd9A39yPXeqpKr7oUlsu6XpBR1B_8YI,61412 +transformers/models/megatron_gpt2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +transformers/models/megatron_gpt2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/megatron_gpt2/__pycache__/checkpoint_reshaping_and_interoperability.cpython-312.pyc,, +transformers/models/megatron_gpt2/checkpoint_reshaping_and_interoperability.py,sha256=3Oe0z75_0SQSM4OR-hRtH_w24LmhSV9AgsyzwKA2R9Y,37650 +transformers/models/metaclip_2/__init__.py,sha256=S5n45gZa_DwDJ3PtBbKzcjqDd6uOY4sbsSXR227oFZI,1001 +transformers/models/metaclip_2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/metaclip_2/__pycache__/configuration_metaclip_2.cpython-312.pyc,, +transformers/models/metaclip_2/__pycache__/modeling_metaclip_2.cpython-312.pyc,, +transformers/models/metaclip_2/__pycache__/modular_metaclip_2.cpython-312.pyc,, +transformers/models/metaclip_2/configuration_metaclip_2.py,sha256=KOrkF5zw2qjrebkSX1uKtpb2EIoFUO15AWhPz_HIQHg,18052 +transformers/models/metaclip_2/modeling_metaclip_2.py,sha256=qs0wERh8BjaCN4MjA8ayNrSP45VgJctzJ0nFvVoFUZg,52206 +transformers/models/metaclip_2/modular_metaclip_2.py,sha256=acFCJjkIu0sZcxzFbeCykP22jo2wwuVoOvaozL_wawU,33736 +transformers/models/mgp_str/__init__.py,sha256=Qb3mXPCrWbQ1ksMRYMeXorrva97OOFNr1zoy4YQg-9k,1073 +transformers/models/mgp_str/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mgp_str/__pycache__/configuration_mgp_str.cpython-312.pyc,, +transformers/models/mgp_str/__pycache__/modeling_mgp_str.cpython-312.pyc,, +transformers/models/mgp_str/__pycache__/processing_mgp_str.cpython-312.pyc,, +transformers/models/mgp_str/__pycache__/tokenization_mgp_str.cpython-312.pyc,, +transformers/models/mgp_str/configuration_mgp_str.py,sha256=lK-qmv8dNVqpUB64FjwXr4bRFsXPx6UL7_IsB-yZWew,5795 +transformers/models/mgp_str/modeling_mgp_str.py,sha256=k_s_OvLxvoNQ9tQpqSNz92Xcw5SLAbc1cJiq1KN4FHg,18435 +transformers/models/mgp_str/processing_mgp_str.py,sha256=UDIB0OiQH9v7waJ-0khtCBO6Hv0vCj8bYMr0VPKzEaE,7804 +transformers/models/mgp_str/tokenization_mgp_str.py,sha256=XrqjbDcTci9sZ-d-CXHlzzhwyw7h0lAnD6GRouCNYrs,3791 +transformers/models/mimi/__init__.py,sha256=VXRZ-D8-AyOYcmRGvSxhjwTYQcSNXcCXi5ubks6Qxhk,989 +transformers/models/mimi/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mimi/__pycache__/configuration_mimi.cpython-312.pyc,, +transformers/models/mimi/__pycache__/modeling_mimi.cpython-312.pyc,, +transformers/models/mimi/configuration_mimi.py,sha256=1Vqbg_W1dE-oqvpiqi5a0AePd7Eue3znxfoTDsk1v6g,14582 +transformers/models/mimi/modeling_mimi.py,sha256=lvVVmjiXgzqQ4954eBJhbRnufEhGjDDPDXsxUmspNkY,80147 +transformers/models/minimax/__init__.py,sha256=hP-D2E-RR4ySxC0IkUuB8AatsJj3vOX1-VbWQ01WwAM,1013 +transformers/models/minimax/__pycache__/__init__.cpython-312.pyc,, +transformers/models/minimax/__pycache__/configuration_minimax.cpython-312.pyc,, +transformers/models/minimax/__pycache__/modeling_minimax.cpython-312.pyc,, +transformers/models/minimax/__pycache__/modular_minimax.cpython-312.pyc,, +transformers/models/minimax/configuration_minimax.py,sha256=HeSWGIeeKPsHboMlg1Ru90PH0Vfcvr9VdIakDHLgu-g,12624 +transformers/models/minimax/modeling_minimax.py,sha256=v43mJABCmF-Q1a7nbpVKHeyXRMC7saJZxJHEMSXq_Qs,41368 +transformers/models/minimax/modular_minimax.py,sha256=QDHXhRkOXksJXeOrbomMDbURD9sRZGuWSWsfyp-8Dmc,29653 +transformers/models/minimax_m2/__init__.py,sha256=DtCF0nGskHZe44Z1-UfHth74oV7lXM52VPncoKsSzXQ,1002 +transformers/models/minimax_m2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/minimax_m2/__pycache__/configuration_minimax_m2.cpython-312.pyc,, +transformers/models/minimax_m2/__pycache__/modeling_minimax_m2.cpython-312.pyc,, +transformers/models/minimax_m2/__pycache__/modular_minimax_m2.cpython-312.pyc,, +transformers/models/minimax_m2/configuration_minimax_m2.py,sha256=m7MGzDTiy-_0P3KNjqik5wX7CfGV1LzokWuRsbRUsCY,10123 +transformers/models/minimax_m2/modeling_minimax_m2.py,sha256=8aAspfG3zjhkK8HKH-Pkz-x3Y1urwuIbgBPoGnZdPZY,31675 +transformers/models/minimax_m2/modular_minimax_m2.py,sha256=gSHMF6KQ-J1Uz4Mxwwt4cGKPJt2G_cBxZwh0sZSYV_I,15962 +transformers/models/ministral/__init__.py,sha256=618E2UYWKhHRaJQnG5YToNFqqiEPQBnYNlAVyZq889c,1019 +transformers/models/ministral/__pycache__/__init__.cpython-312.pyc,, +transformers/models/ministral/__pycache__/configuration_ministral.cpython-312.pyc,, +transformers/models/ministral/__pycache__/modeling_ministral.cpython-312.pyc,, +transformers/models/ministral/__pycache__/modular_ministral.cpython-312.pyc,, +transformers/models/ministral/configuration_ministral.py,sha256=KsycdJ14urppF3332XP31z9HNKD06ie5BE16N1GV1Yw,8800 +transformers/models/ministral/modeling_ministral.py,sha256=0ldKa6475pVShw1MC9OeXgDC6raBFphu8d1RbYoKfv8,22638 +transformers/models/ministral/modular_ministral.py,sha256=hFcK3I7Z-vAYultQePQNwchvx4pOerJ1bz0TeWtntT8,12388 +transformers/models/ministral3/__init__.py,sha256=5_FEbQFnuUpKN4SRGHPrlEwB_zYU28vzWuUcwTm8Q8E,1021 +transformers/models/ministral3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/ministral3/__pycache__/configuration_ministral3.cpython-312.pyc,, +transformers/models/ministral3/__pycache__/modeling_ministral3.cpython-312.pyc,, +transformers/models/ministral3/__pycache__/modular_ministral3.cpython-312.pyc,, +transformers/models/ministral3/configuration_ministral3.py,sha256=L55fFLhieefvep90AAFLUUmHVRCRhWjgeHJ_bYkYa7Q,9773 +transformers/models/ministral3/modeling_ministral3.py,sha256=pT46DzUebqDrZr0QlwNN-sbH92-_rA7ZgSb7rVCnDSY,22504 +transformers/models/ministral3/modular_ministral3.py,sha256=wcyQ8OjrB6zqkvR7cfvcOApAZVIfFvyknKH3pkIjYLg,4039 +transformers/models/mistral/__init__.py,sha256=uMtejpzqHBbx1-TTTyda0f9lIZlqvdvrV45C-MFTyt4,1015 +transformers/models/mistral/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mistral/__pycache__/configuration_mistral.cpython-312.pyc,, +transformers/models/mistral/__pycache__/modeling_mistral.cpython-312.pyc,, +transformers/models/mistral/__pycache__/modular_mistral.cpython-312.pyc,, +transformers/models/mistral/configuration_mistral.py,sha256=PUz4HiTlMzg2hMCISfWoWsptfywn1lL6pMSo8aZtZd4,8628 +transformers/models/mistral/modeling_mistral.py,sha256=0QfaXpGTgFuIblGNXQWrvy3VTtpt9fNlauFA_gihQh8,21827 +transformers/models/mistral/modular_mistral.py,sha256=ydfRSju1qiyM3MWSEXMJdcBF5Hw-0ZpDMAnNdkopZ-8,7532 +transformers/models/mistral3/__init__.py,sha256=ccR4AQqjFkPl8JVYyVmVvbVm618FlOw4cpwT7N-8ZD4,1036 +transformers/models/mistral3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mistral3/__pycache__/configuration_mistral3.cpython-312.pyc,, +transformers/models/mistral3/__pycache__/modeling_mistral3.cpython-312.pyc,, +transformers/models/mistral3/__pycache__/modular_mistral3.cpython-312.pyc,, +transformers/models/mistral3/configuration_mistral3.py,sha256=BzpWIAwHUsjCk_ADFew13jFrQJhC5cBl88wbXLewFwI,5922 +transformers/models/mistral3/modeling_mistral3.py,sha256=CNNeYI7FeGo8Yo14hKJJ-DCztxHm0CSsaWSpNDUakKk,22745 +transformers/models/mistral3/modular_mistral3.py,sha256=sfRauVs6a5nMggvJM22bwa3RyO9Jj607t1C6z9ojWQw,13997 +transformers/models/mixtral/__init__.py,sha256=_i66uHDx5A0-UBwgR2nwibxSf0ZePqpTa_Qsm0Cg_Bs,1015 +transformers/models/mixtral/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mixtral/__pycache__/configuration_mixtral.cpython-312.pyc,, +transformers/models/mixtral/__pycache__/modeling_mixtral.cpython-312.pyc,, +transformers/models/mixtral/__pycache__/modular_mixtral.cpython-312.pyc,, +transformers/models/mixtral/configuration_mixtral.py,sha256=tKePIPjNAb1Y3bhsgW6N7BLPnHXQxfr2YPreFvO30CE,9685 +transformers/models/mixtral/modeling_mixtral.py,sha256=MntDxAd2VMEQO-wFnlGznfkGb4rzbFhkfk9ryajygeY,31412 +transformers/models/mixtral/modular_mixtral.py,sha256=iLTRZzkiiyGkIK8H1HmDetaDMexNiTcj_vhjf75S534,18875 +transformers/models/mlcd/__init__.py,sha256=hLiLB1E0jT7sI3s8TraLb_Z1WOpwS69zac5kyHNfx4E,989 +transformers/models/mlcd/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mlcd/__pycache__/configuration_mlcd.cpython-312.pyc,, +transformers/models/mlcd/__pycache__/modeling_mlcd.cpython-312.pyc,, +transformers/models/mlcd/__pycache__/modular_mlcd.cpython-312.pyc,, +transformers/models/mlcd/configuration_mlcd.py,sha256=C-r5Vg-6jvxEWXZjIedSUPp-TqgZ85R1xnvdm4a-UMQ,5789 +transformers/models/mlcd/modeling_mlcd.py,sha256=HiL_UmeXj-SF9_06c16mEsqqf6OWqL1ZOwI10ohTdRw,24681 +transformers/models/mlcd/modular_mlcd.py,sha256=X9ObiAN2E8JnoQeeR69I0BNuYLJBEAN_EsIIVq2owOc,20295 +transformers/models/mllama/__init__.py,sha256=EzCpjuAv2Ke2xlpINWvTPIZLnYxA8D-2mvlGTZu6Zj4,1121 +transformers/models/mllama/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mllama/__pycache__/configuration_mllama.cpython-312.pyc,, +transformers/models/mllama/__pycache__/image_processing_mllama.cpython-312.pyc,, +transformers/models/mllama/__pycache__/image_processing_mllama_fast.cpython-312.pyc,, +transformers/models/mllama/__pycache__/modeling_mllama.cpython-312.pyc,, +transformers/models/mllama/__pycache__/processing_mllama.cpython-312.pyc,, +transformers/models/mllama/configuration_mllama.py,sha256=Iq1ySgpfhKWUjrVKYrEvbXBLVWWTIFyyidx4CZAq5go,15234 +transformers/models/mllama/image_processing_mllama.py,sha256=1td5E5uFG5UcV7-TQQCYBng0L0ENf8VJL5A1Q5jHCkM,37265 +transformers/models/mllama/image_processing_mllama_fast.py,sha256=c8vchu2AZlsXe56SsH1_iF2zaKXFl98QdvJglaS3RMM,15680 +transformers/models/mllama/modeling_mllama.py,sha256=ez1p0PQTdo7fA-of_M8dt3d-yFJK1Lq4eD57_3azCiU,73921 +transformers/models/mllama/processing_mllama.py,sha256=ge5kwpV3gs6cgPR2PnIsnUc_RXfxDJ1gvopR7471TmQ,14026 +transformers/models/mluke/__init__.py,sha256=e_3cNftWOmhNXk-zsA1-2DOBT9L56SHr-6qev0xI7Ws,956 +transformers/models/mluke/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mluke/__pycache__/tokenization_mluke.cpython-312.pyc,, +transformers/models/mluke/tokenization_mluke.py,sha256=yaJh0TOH5qLe-cpd2DYv3_m-gBbWI9JgSMfa7vr1bm4,88121 +transformers/models/mm_grounding_dino/__init__.py,sha256=mk2hUY_rZw6JSjfkqSL4hVYJKxh5ViM3TZfib-09kpc,1015 +transformers/models/mm_grounding_dino/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mm_grounding_dino/__pycache__/configuration_mm_grounding_dino.cpython-312.pyc,, +transformers/models/mm_grounding_dino/__pycache__/modeling_mm_grounding_dino.cpython-312.pyc,, +transformers/models/mm_grounding_dino/__pycache__/modular_mm_grounding_dino.cpython-312.pyc,, +transformers/models/mm_grounding_dino/configuration_mm_grounding_dino.py,sha256=j2WCGpfPFxSu7D4LRNHofxYom_h1jwX6hsZJCqT-aII,12831 +transformers/models/mm_grounding_dino/modeling_mm_grounding_dino.py,sha256=0zoTZkpggKWGzEd7darT-LCOZ4wvrMGFQgckeKtwdW8,128444 +transformers/models/mm_grounding_dino/modular_mm_grounding_dino.py,sha256=iOFAji-j882ABK3ENitPLBS3lP2bmsbjuugudKZK4GQ,17654 +transformers/models/mobilebert/__init__.py,sha256=Ahrfu5ZVpOcRpNP81dbzqZO9mJAz-gajqgpAZW5xj1Y,1087 +transformers/models/mobilebert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mobilebert/__pycache__/configuration_mobilebert.cpython-312.pyc,, +transformers/models/mobilebert/__pycache__/modeling_mobilebert.cpython-312.pyc,, +transformers/models/mobilebert/__pycache__/tokenization_mobilebert.cpython-312.pyc,, +transformers/models/mobilebert/configuration_mobilebert.py,sha256=ZYrVeiWjvn7qnC2RBWRLkcAgtGkmDA4wsn_bsOotb_s,7555 +transformers/models/mobilebert/modeling_mobilebert.py,sha256=OYGURY2LYKs5D7UruLgKYbkqLxLE1pqnLZqH-H68nSA,50885 +transformers/models/mobilebert/tokenization_mobilebert.py,sha256=7vAsL3wIML89C7QOqQpHA0YYCBFBvcNY4wBLnGPRJQc,1002 +transformers/models/mobilenet_v1/__init__.py,sha256=kS0kf8Q0rDhNcqIJM6iI6iVufztYwEl-TsOzVQZwn-Y,1159 +transformers/models/mobilenet_v1/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mobilenet_v1/__pycache__/configuration_mobilenet_v1.cpython-312.pyc,, +transformers/models/mobilenet_v1/__pycache__/image_processing_mobilenet_v1.cpython-312.pyc,, +transformers/models/mobilenet_v1/__pycache__/image_processing_mobilenet_v1_fast.cpython-312.pyc,, +transformers/models/mobilenet_v1/__pycache__/modeling_mobilenet_v1.cpython-312.pyc,, +transformers/models/mobilenet_v1/configuration_mobilenet_v1.py,sha256=B0prIMcZtAQicuIzM9FN6mffSi1NhTEgChUa1Se-fKQ,4157 +transformers/models/mobilenet_v1/image_processing_mobilenet_v1.py,sha256=aJnK1o9P74dVZ2wXe0l1Ay05yqlwLiP8TKdujPBCVvY,14985 +transformers/models/mobilenet_v1/image_processing_mobilenet_v1_fast.py,sha256=aG4adaNucFZ_gzzgNWWL9XxpHwaOrcTJw3OSv9vC6pY,1315 +transformers/models/mobilenet_v1/modeling_mobilenet_v1.py,sha256=OGiA2Of7CaTz9V3DOG9cgYSJ74yJUrphipKz14qz0G8,10313 +transformers/models/mobilenet_v2/__init__.py,sha256=PGEnF5QRb3bZg_Iux0DuD7VPysu8nA0WxJEd6YOXtmw,1159 +transformers/models/mobilenet_v2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mobilenet_v2/__pycache__/configuration_mobilenet_v2.cpython-312.pyc,, +transformers/models/mobilenet_v2/__pycache__/image_processing_mobilenet_v2.cpython-312.pyc,, +transformers/models/mobilenet_v2/__pycache__/image_processing_mobilenet_v2_fast.cpython-312.pyc,, +transformers/models/mobilenet_v2/__pycache__/modeling_mobilenet_v2.cpython-312.pyc,, +transformers/models/mobilenet_v2/configuration_mobilenet_v2.py,sha256=VROByGcEfOoNLwGS_3ATymE3TtgYwEGjqLEVrTvbkk0,6053 +transformers/models/mobilenet_v2/image_processing_mobilenet_v2.py,sha256=T8C14YlEUXMQzAguLRM7gApC5W71zb_ArhvGD4hLRJE,24693 +transformers/models/mobilenet_v2/image_processing_mobilenet_v2_fast.py,sha256=-c8uSkHCOBJcc485nWu_f3asCF2O_QGnxZARntxLk3M,9017 +transformers/models/mobilenet_v2/modeling_mobilenet_v2.py,sha256=Q0GMxi2qNwXK55clxqL-YWntI6Ota21Iwm5YThQF-6I,21187 +transformers/models/mobilevit/__init__.py,sha256=1xy-4YP_-uEBx4eL8jVEjgN9mMwCT2Uj29YbovBBx50,1144 +transformers/models/mobilevit/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mobilevit/__pycache__/configuration_mobilevit.cpython-312.pyc,, +transformers/models/mobilevit/__pycache__/image_processing_mobilevit.cpython-312.pyc,, +transformers/models/mobilevit/__pycache__/image_processing_mobilevit_fast.cpython-312.pyc,, +transformers/models/mobilevit/__pycache__/modeling_mobilevit.cpython-312.pyc,, +transformers/models/mobilevit/configuration_mobilevit.py,sha256=_CXQ-onVFRw0txhjqQdEqGV74eV8pw-X9KPkul6nn34,6774 +transformers/models/mobilevit/image_processing_mobilevit.py,sha256=HFnjkwWzMGR7oz0Tn-ww26tyuB45TJ8VSOrdqz7hfBQ,23639 +transformers/models/mobilevit/image_processing_mobilevit_fast.py,sha256=tEUTcFVXmk7H3TvvgU016LjZjyk1wqxWBg4RDcNVv1w,9054 +transformers/models/mobilevit/modeling_mobilevit.py,sha256=fxkXrsHEcsElMzLrx46F6glJ8sBc0jHxLWh0wDVPWfI,35146 +transformers/models/mobilevitv2/__init__.py,sha256=pAGk_9X22yOYvlcwbqTc4nm6fL4rPhAhDpdBguna5Q0,1003 +transformers/models/mobilevitv2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mobilevitv2/__pycache__/configuration_mobilevitv2.cpython-312.pyc,, +transformers/models/mobilevitv2/__pycache__/modeling_mobilevitv2.cpython-312.pyc,, +transformers/models/mobilevitv2/configuration_mobilevitv2.py,sha256=s1XWXLRjUTjTrZs2DVJr4_JG0LuQyla45BPyh-4kZU0,6333 +transformers/models/mobilevitv2/modeling_mobilevitv2.py,sha256=XLbn_lYl5fyvOz9e8QqUtIXr2hRYIT7c0D4QQZ_Wa14,33939 +transformers/models/modernbert/__init__.py,sha256=BEQFRFfcKvUlphA1ibW3s34Vkbm-MUuyqzaLbrIFiAA,1006 +transformers/models/modernbert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/modernbert/__pycache__/configuration_modernbert.cpython-312.pyc,, +transformers/models/modernbert/__pycache__/modeling_modernbert.cpython-312.pyc,, +transformers/models/modernbert/__pycache__/modular_modernbert.cpython-312.pyc,, +transformers/models/modernbert/configuration_modernbert.py,sha256=fjc5kwRlzlGdl1qotrWat9Qe8mJLauXCL1xGryRDTZY,14840 +transformers/models/modernbert/modeling_modernbert.py,sha256=1lfnaKtBnLQQHTVk00bP6VtpFJ3UXh0vPgsvsTjGcAs,36771 +transformers/models/modernbert/modular_modernbert.py,sha256=_h9GEmOC0Hjv3x-9ShXJvYGalYGfwEHB88PXiuVlJ9s,44819 +transformers/models/modernbert_decoder/__init__.py,sha256=RjLebVKPcGgNEORY5xypTPd8oYWcnFmbGm3hBqQX-HE,1022 +transformers/models/modernbert_decoder/__pycache__/__init__.cpython-312.pyc,, +transformers/models/modernbert_decoder/__pycache__/configuration_modernbert_decoder.cpython-312.pyc,, +transformers/models/modernbert_decoder/__pycache__/modeling_modernbert_decoder.cpython-312.pyc,, +transformers/models/modernbert_decoder/__pycache__/modular_modernbert_decoder.cpython-312.pyc,, +transformers/models/modernbert_decoder/configuration_modernbert_decoder.py,sha256=SQ29i0PmQ5Ua7K9KUtWT8rgfxSf4bCXqseCRzhYwtQE,13003 +transformers/models/modernbert_decoder/modeling_modernbert_decoder.py,sha256=8PFIZJmKCmFLuD5CGaM37JX8IedDo5iBjWunqotxNxQ,34412 +transformers/models/modernbert_decoder/modular_modernbert_decoder.py,sha256=NdMkllRDmeloh_wh_UdLbbUmtlbZlsPVNIhWCW5xDsI,36900 +transformers/models/moonshine/__init__.py,sha256=eBgvc9LtoDnB6HnNvrObDWL3h_L4Sgn5-D-hepNfAmI,999 +transformers/models/moonshine/__pycache__/__init__.cpython-312.pyc,, +transformers/models/moonshine/__pycache__/configuration_moonshine.cpython-312.pyc,, +transformers/models/moonshine/__pycache__/modeling_moonshine.cpython-312.pyc,, +transformers/models/moonshine/__pycache__/modular_moonshine.cpython-312.pyc,, +transformers/models/moonshine/configuration_moonshine.py,sha256=1273Kk0DEFej0T5F_xDUsbRh7OyvOehom7c_qNNS7K4,11159 +transformers/models/moonshine/modeling_moonshine.py,sha256=9YbsjeHJiiur7AcAHdrqrLYWrKefUXUGpWDPps4uhMA,42484 +transformers/models/moonshine/modular_moonshine.py,sha256=fAJlfOA9Jv0520FkqCqam6F7-jYAzkXcCIpN_56kvGw,40496 +transformers/models/moonshine_streaming/__init__.py,sha256=9S0QRymrUyt5h-mdWY9w45E_kuoxd_mlBZuX8pLv65s,1020 +transformers/models/moonshine_streaming/__pycache__/__init__.cpython-312.pyc,, +transformers/models/moonshine_streaming/__pycache__/configuration_moonshine_streaming.cpython-312.pyc,, +transformers/models/moonshine_streaming/__pycache__/modeling_moonshine_streaming.cpython-312.pyc,, +transformers/models/moonshine_streaming/__pycache__/modular_moonshine_streaming.cpython-312.pyc,, +transformers/models/moonshine_streaming/__pycache__/processing_moonshine_streaming.cpython-312.pyc,, +transformers/models/moonshine_streaming/configuration_moonshine_streaming.py,sha256=MccVb8-thhtL2qumMCHrN0WSLyXSE5fOaxWLhtT1xr8,12782 +transformers/models/moonshine_streaming/modeling_moonshine_streaming.py,sha256=V-RZpkYLWA2ojE6DEYkqlCo2bOtVUgkEMIbIaLOhDVs,50065 +transformers/models/moonshine_streaming/modular_moonshine_streaming.py,sha256=atuDOVsflrOaNKwnTpTI7G6OlU3WrjuZ-sDInQYm-BA,16701 +transformers/models/moonshine_streaming/processing_moonshine_streaming.py,sha256=GcoGNJunzBg8SRe4B80IliE1SzCzKwLZDfL-v1VYt1Y,5173 +transformers/models/moshi/__init__.py,sha256=uW4oqTKZdbmURZaC_xwwHXnYEMyLJrMEJAlfbUzSWO8,991 +transformers/models/moshi/__pycache__/__init__.cpython-312.pyc,, +transformers/models/moshi/__pycache__/configuration_moshi.cpython-312.pyc,, +transformers/models/moshi/__pycache__/modeling_moshi.cpython-312.pyc,, +transformers/models/moshi/configuration_moshi.py,sha256=nZqUHV6zIwSyahqOIwAuxeDyrPhm_TRoyJiJdH-XT28,17613 +transformers/models/moshi/modeling_moshi.py,sha256=F1eS6hYNIFBZ2VZxbOKysnDwbwufrJgCxWUNCFoYD-M,104389 +transformers/models/mpnet/__init__.py,sha256=Lmtzs8K18d_lydT3fpJIAjwD0nBAZnNa6NdiNdqvEJg,1029 +transformers/models/mpnet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mpnet/__pycache__/configuration_mpnet.cpython-312.pyc,, +transformers/models/mpnet/__pycache__/modeling_mpnet.cpython-312.pyc,, +transformers/models/mpnet/__pycache__/tokenization_mpnet.cpython-312.pyc,, +transformers/models/mpnet/configuration_mpnet.py,sha256=FmE_J9QW4ZhCk6JJ3sxnzeZQ65eNiit3gmW6u9wod_4,5401 +transformers/models/mpnet/modeling_mpnet.py,sha256=m8MeUEqURcb0jUSz-ejBgz007lcD5pXNbgh6OPPDxLI,35067 +transformers/models/mpnet/tokenization_mpnet.py,sha256=5es3kknt0_UvkK2nxAX6v5cEpZ_orG_vHESkQHHdTnM,8732 +transformers/models/mpt/__init__.py,sha256=DAIIAY0kPL-bXMkPUvxmP97HCXPi-SoM3NLnlJJYarg,987 +transformers/models/mpt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mpt/__pycache__/configuration_mpt.cpython-312.pyc,, +transformers/models/mpt/__pycache__/modeling_mpt.cpython-312.pyc,, +transformers/models/mpt/configuration_mpt.py,sha256=dmVDhAzjuMEl6sej8FOHRGvFCf02NMVynHbSJYKIw2A,10859 +transformers/models/mpt/modeling_mpt.py,sha256=dVG_Oluzke74oxkQTnp3Z_lnyPZjrAZbMDmgn9x4oZo,32693 +transformers/models/mra/__init__.py,sha256=51mnm4DFq6aWxOsmaaVZDL28QozNauXyTtbEihDxUQU,987 +transformers/models/mra/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mra/__pycache__/configuration_mra.cpython-312.pyc,, +transformers/models/mra/__pycache__/modeling_mra.cpython-312.pyc,, +transformers/models/mra/configuration_mra.py,sha256=ljyaDdfyGWU2Ok2F_xHCceJB47l7ygWyM8xk8NTZOAk,6446 +transformers/models/mra/modeling_mra.py,sha256=G-W51_y1X4OUQIdpm9L9QIcgh7yYseSB4RmqqI5YHD4,53708 +transformers/models/mt5/__init__.py,sha256=BTuFEuI7Ojp3tXOaLCepiUPbxYxotr4_ToZ1eXvITyA,1023 +transformers/models/mt5/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mt5/__pycache__/configuration_mt5.cpython-312.pyc,, +transformers/models/mt5/__pycache__/modeling_mt5.cpython-312.pyc,, +transformers/models/mt5/configuration_mt5.py,sha256=Y-iJID4x-3OE9yad0Ng1lf09Ir4vh-VCMASMpAYnOtw,6864 +transformers/models/mt5/modeling_mt5.py,sha256=AYT6-rzZ4B_C6Q4QI-fqb8lzdJ33d8uR1Btb_DemGS4,77287 +transformers/models/musicgen/__init__.py,sha256=iwtW9pg6iDe5D2dWVC4IRU8QbNmRK5kMqPCM8fsUSgo,1036 +transformers/models/musicgen/__pycache__/__init__.cpython-312.pyc,, +transformers/models/musicgen/__pycache__/configuration_musicgen.cpython-312.pyc,, +transformers/models/musicgen/__pycache__/modeling_musicgen.cpython-312.pyc,, +transformers/models/musicgen/__pycache__/processing_musicgen.cpython-312.pyc,, +transformers/models/musicgen/configuration_musicgen.py,sha256=jWA0xL2xciStqvARBsiFpClDNsJMI6gDiyb3ezW38bQ,10350 +transformers/models/musicgen/modeling_musicgen.py,sha256=I9P15KyJjS7-dQWi6fbzCOQbWxRXSatpTVevKwDS2Ys,109583 +transformers/models/musicgen/processing_musicgen.py,sha256=Tj7AG78Ai04tF0izuDwMS8iY1lMnz_lSsa1BlhwVuJk,3360 +transformers/models/musicgen_melody/__init__.py,sha256=WVEsVs7g0XlpO_yd1X0X4QnMjhG0h_n6T41FpdJcnS8,1011 +transformers/models/musicgen_melody/__pycache__/__init__.cpython-312.pyc,, +transformers/models/musicgen_melody/__pycache__/configuration_musicgen_melody.cpython-312.pyc,, +transformers/models/musicgen_melody/__pycache__/feature_extraction_musicgen_melody.cpython-312.pyc,, +transformers/models/musicgen_melody/__pycache__/modeling_musicgen_melody.cpython-312.pyc,, +transformers/models/musicgen_melody/__pycache__/processing_musicgen_melody.cpython-312.pyc,, +transformers/models/musicgen_melody/configuration_musicgen_melody.py,sha256=fU66zIveWodHE0fUsZeV1BYz-PWFg6cBi7Bl1NC1bGM,11657 +transformers/models/musicgen_melody/feature_extraction_musicgen_melody.py,sha256=u7RdsQUkosd0vDq5y4AQjxDj_NphdFOj3eR8juaSlG4,15232 +transformers/models/musicgen_melody/modeling_musicgen_melody.py,sha256=4l8_96ri5qeOgPOmek7c4PbWsykJncNYap6oq1L5jig,106039 +transformers/models/musicgen_melody/processing_musicgen_melody.py,sha256=jC5ueLR2V-SU3ZKPnW6RP9HVQOV4t6uHlIf0Ky4dR34,5024 +transformers/models/mvp/__init__.py,sha256=WZmfe74gf6cjN8OLNQ6ngkwTFzie-OV6VRPiAbBCTk8,1067 +transformers/models/mvp/__pycache__/__init__.cpython-312.pyc,, +transformers/models/mvp/__pycache__/configuration_mvp.cpython-312.pyc,, +transformers/models/mvp/__pycache__/modeling_mvp.cpython-312.pyc,, +transformers/models/mvp/configuration_mvp.py,sha256=BAL19VqriWm47u3qno-WP4fZ6D1x7RRA5KbPoCy4ul0,7888 +transformers/models/mvp/modeling_mvp.py,sha256=zARriXzccBp7nwqqntrshns7dXNDdwPhkgq4Cipnhlo,73991 +transformers/models/myt5/__init__.py,sha256=MFQX-RuvZujGb_twBWBQpTt4NZq6FxreEysWmF2fFGI,955 +transformers/models/myt5/__pycache__/__init__.cpython-312.pyc,, +transformers/models/myt5/__pycache__/tokenization_myt5.cpython-312.pyc,, +transformers/models/myt5/tokenization_myt5.py,sha256=9x5iRVCKPjao8zsLbD5_8ACxZ9WLZtg59E1c7KmTk3s,15450 +transformers/models/nanochat/__init__.py,sha256=goJP7g0uNynZWyVMqvOWSR9yAOeWGSXbaUU8sq3aZhI,391 +transformers/models/nanochat/__pycache__/__init__.cpython-312.pyc,, +transformers/models/nanochat/__pycache__/configuration_nanochat.cpython-312.pyc,, +transformers/models/nanochat/__pycache__/modeling_nanochat.cpython-312.pyc,, +transformers/models/nanochat/__pycache__/modular_nanochat.cpython-312.pyc,, +transformers/models/nanochat/configuration_nanochat.py,sha256=m4wV4C8BEHX9Wx4gA-_yGp-dhE7ucgjPqwhKjd73pUo,7579 +transformers/models/nanochat/modeling_nanochat.py,sha256=i30AMECJVu5LdCE6Y707_3aOtTlv-7y30Jlbc3J5Kb0,22352 +transformers/models/nanochat/modular_nanochat.py,sha256=TL-I8s-rFikhLrMQkTWTNsx1XDAcAyDiYczBUhtlHJo,8961 +transformers/models/nemotron/__init__.py,sha256=ZwaMH1AQ0VIuFnouYe0Sx0HcCGA7PaCp3-_yw3xjeQA,997 +transformers/models/nemotron/__pycache__/__init__.cpython-312.pyc,, +transformers/models/nemotron/__pycache__/configuration_nemotron.cpython-312.pyc,, +transformers/models/nemotron/__pycache__/modeling_nemotron.cpython-312.pyc,, +transformers/models/nemotron/configuration_nemotron.py,sha256=MuT82l8mTpaiEg5IZ3QAv3uoVuk-wZXZNRj6X3HpYQU,7732 +transformers/models/nemotron/modeling_nemotron.py,sha256=Kk2GC1LCGJnBZHEcHe_RFCfG850TsV57Tca64xZJOAA,36504 +transformers/models/nllb/__init__.py,sha256=fBkcHp1TFP4bRdUvTzwZf2syVKJZul8cTf5csjI2EbY,955 +transformers/models/nllb/__pycache__/__init__.cpython-312.pyc,, +transformers/models/nllb/__pycache__/tokenization_nllb.cpython-312.pyc,, +transformers/models/nllb/tokenization_nllb.py,sha256=e0V3Aw73YYj1pZOxxRsaUQdTE9yEW-4u07N1WwqBLqw,14179 +transformers/models/nllb_moe/__init__.py,sha256=sAfoAnhHK_reU1a2WUoF1rFtPBckeGGrzJCD8gUv54A,997 +transformers/models/nllb_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/nllb_moe/__pycache__/configuration_nllb_moe.cpython-312.pyc,, +transformers/models/nllb_moe/__pycache__/modeling_nllb_moe.cpython-312.pyc,, +transformers/models/nllb_moe/configuration_nllb_moe.py,sha256=WYB31JSUTZ0yq4JsdiJLJuL4Siu14Ovp634K7gdYCwc,11269 +transformers/models/nllb_moe/modeling_nllb_moe.py,sha256=LO8I51yhgnXYNX_7-SsS6QPHaUg4Hmf74YAHs3Ju4yY,50332 +transformers/models/nougat/__init__.py,sha256=NR2EgftVRP0ltdLWEhgsjaw3PbxG21vwy9pb9-hWTdQ,1085 +transformers/models/nougat/__pycache__/__init__.cpython-312.pyc,, +transformers/models/nougat/__pycache__/image_processing_nougat.cpython-312.pyc,, +transformers/models/nougat/__pycache__/image_processing_nougat_fast.cpython-312.pyc,, +transformers/models/nougat/__pycache__/processing_nougat.cpython-312.pyc,, +transformers/models/nougat/__pycache__/tokenization_nougat.cpython-312.pyc,, +transformers/models/nougat/image_processing_nougat.py,sha256=6SCJUGkSf9Nv2FY4wfxkRWkdJ1WOH7ojCrmj8CiqRZ0,24381 +transformers/models/nougat/image_processing_nougat_fast.py,sha256=DtteJ3wfzpqdWhDR15gXlcJt7VPl74QIG1t6CzEc1fo,10574 +transformers/models/nougat/processing_nougat.py,sha256=TtuqEqsaYGsPHbGvkVABcux50-fxA8bFpkV5ckA_k9Q,6221 +transformers/models/nougat/tokenization_nougat.py,sha256=pCewH677NvZQAokX0nR7ya3qM7h_5LaYST4OBNunwk4,26091 +transformers/models/nystromformer/__init__.py,sha256=CwEg6m4nJW_AfNDws_MIv1O1x5IO3xPp-FYqirlFXwk,1007 +transformers/models/nystromformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/nystromformer/__pycache__/configuration_nystromformer.cpython-312.pyc,, +transformers/models/nystromformer/__pycache__/modeling_nystromformer.cpython-312.pyc,, +transformers/models/nystromformer/configuration_nystromformer.py,sha256=--0aacEb6KLruQqNkmBLHgSUocxjg2CDWDN2O-LJQmk,6608 +transformers/models/nystromformer/modeling_nystromformer.py,sha256=jJBI7FkkDu3noXURcBinuk2iY2AeRrWK2cjVusZr9wI,39903 +transformers/models/olmo/__init__.py,sha256=x9u_5vqI52-uBuj89-6aYucGDlvBUEPSOhPLLB1asok,1009 +transformers/models/olmo/__pycache__/__init__.cpython-312.pyc,, +transformers/models/olmo/__pycache__/configuration_olmo.cpython-312.pyc,, +transformers/models/olmo/__pycache__/modeling_olmo.cpython-312.pyc,, +transformers/models/olmo/__pycache__/modular_olmo.cpython-312.pyc,, +transformers/models/olmo/configuration_olmo.py,sha256=0b55q1arKaQCE_MlQI2T7FmdYWKLxhU_q5KN36RssGY,8097 +transformers/models/olmo/modeling_olmo.py,sha256=Xii6pi-Dq14_S3VUHCMbnCtE3UuKT254yylcaV6U3xU,21803 +transformers/models/olmo/modular_olmo.py,sha256=lwudPe6bFW4Swj7AFNZ9j4iMKex2OFr-W0s-y-68xm0,7903 +transformers/models/olmo2/__init__.py,sha256=Frt9nEMsfPszod1lkFTAJUobU50IjOFlqI6uJkuQVcY,1011 +transformers/models/olmo2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/olmo2/__pycache__/configuration_olmo2.cpython-312.pyc,, +transformers/models/olmo2/__pycache__/modeling_olmo2.cpython-312.pyc,, +transformers/models/olmo2/__pycache__/modular_olmo2.cpython-312.pyc,, +transformers/models/olmo2/configuration_olmo2.py,sha256=mPrW-RhiSPRhZxF6FKf5XO-3aLUGsBG9exUOG5Sfu_Y,9058 +transformers/models/olmo2/modeling_olmo2.py,sha256=8se0M94selIyFX5052nNJ5xxtBxZdES4xgwplLtTdEk,22236 +transformers/models/olmo2/modular_olmo2.py,sha256=pGmS_A0plaYz_EmXEq9Fc_TnFrQnLTxjYrThmN3p4Nk,14556 +transformers/models/olmo3/__init__.py,sha256=NpEGa6NN749b7p7EtG9F8yf6oGweZ6wQZZ8-6YEzjL4,992 +transformers/models/olmo3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/olmo3/__pycache__/configuration_olmo3.cpython-312.pyc,, +transformers/models/olmo3/__pycache__/modeling_olmo3.cpython-312.pyc,, +transformers/models/olmo3/__pycache__/modular_olmo3.cpython-312.pyc,, +transformers/models/olmo3/configuration_olmo3.py,sha256=zGGHFevUyCU1ohck8e4qoYYUKA4ejEPtRIF2GORs0fA,9566 +transformers/models/olmo3/modeling_olmo3.py,sha256=GUvUh8bjjlSffngE55gXeQlBLUSCGLHTZRg-97gUOtM,22704 +transformers/models/olmo3/modular_olmo3.py,sha256=UBkOGfnckOfNs6hG6lq5IfaBoYwxkgUpuqZTvc-6cGA,15645 +transformers/models/olmoe/__init__.py,sha256=eQ6mx9aBIcA4RiK3p7dbqORokkuMfQNRss06E8uWNrk,991 +transformers/models/olmoe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/olmoe/__pycache__/configuration_olmoe.cpython-312.pyc,, +transformers/models/olmoe/__pycache__/modeling_olmoe.cpython-312.pyc,, +transformers/models/olmoe/__pycache__/modular_olmoe.cpython-312.pyc,, +transformers/models/olmoe/configuration_olmoe.py,sha256=-u6ERudu-PWSsODTwVlKGlzNco5AmfpVsAZ8baVbhCA,8578 +transformers/models/olmoe/modeling_olmoe.py,sha256=AgXkargD2leNLIGpHkIvjnRioIwDwrOZQVRUzMHCigU,31831 +transformers/models/olmoe/modular_olmoe.py,sha256=4PE1BoVDyyyUUvFX7E2jkcIq9Yxunsnw1RcRwTnjrkM,11636 +transformers/models/omdet_turbo/__init__.py,sha256=XIckpuo9tkT7NB5uTs9wLdpxr9GDedQPVJL2P8XU-7Q,1045 +transformers/models/omdet_turbo/__pycache__/__init__.cpython-312.pyc,, +transformers/models/omdet_turbo/__pycache__/configuration_omdet_turbo.cpython-312.pyc,, +transformers/models/omdet_turbo/__pycache__/modeling_omdet_turbo.cpython-312.pyc,, +transformers/models/omdet_turbo/__pycache__/processing_omdet_turbo.cpython-312.pyc,, +transformers/models/omdet_turbo/configuration_omdet_turbo.py,sha256=IF_uqMuWfLWLV2xmh8sActnhE73FxH9YqhifVBxoLHA,12885 +transformers/models/omdet_turbo/modeling_omdet_turbo.py,sha256=619JwK0hsrpEX4EHRvQahSbf5Za3FT1nTkZnFThUgog,74349 +transformers/models/omdet_turbo/processing_omdet_turbo.py,sha256=0ZP_V3gWR0KQqykY1_2LQv3jk4jx5n0MFvrRLNSf468,14342 +transformers/models/oneformer/__init__.py,sha256=MrdVp7ZBJOVbWMpwojOPnEzDDW2HSqs5oSZG81jdCQI,1136 +transformers/models/oneformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/oneformer/__pycache__/configuration_oneformer.cpython-312.pyc,, +transformers/models/oneformer/__pycache__/image_processing_oneformer.cpython-312.pyc,, +transformers/models/oneformer/__pycache__/image_processing_oneformer_fast.cpython-312.pyc,, +transformers/models/oneformer/__pycache__/modeling_oneformer.cpython-312.pyc,, +transformers/models/oneformer/__pycache__/processing_oneformer.cpython-312.pyc,, +transformers/models/oneformer/configuration_oneformer.py,sha256=XT4d6nuS0TGLmIXQRvsaSNtgDGPMA0basR-wleMUaAo,11337 +transformers/models/oneformer/image_processing_oneformer.py,sha256=oDf_6jWU0pjKWrp4T3XT3tQb3PVC7vrfp8nc8AdBYYw,61082 +transformers/models/oneformer/image_processing_oneformer_fast.py,sha256=t6MPovYB512EAkQVkZdr9z3DxRssea-JMHex1y6vp8s,39918 +transformers/models/oneformer/modeling_oneformer.py,sha256=i1jI_SoknVyvD6VnJhRVRaPtFKxAOoQnIg3LM9dOvWs,138404 +transformers/models/oneformer/processing_oneformer.py,sha256=xU3fmwOzcxir0Q2RPP23mRL_jKG6TBKjAd4hbnIKFgs,8231 +transformers/models/openai/__init__.py,sha256=6Xrt4E8F9t4MlKOmv-zaguA_Vx93QCHsYLCVVtAONvQ,1032 +transformers/models/openai/__pycache__/__init__.cpython-312.pyc,, +transformers/models/openai/__pycache__/configuration_openai.cpython-312.pyc,, +transformers/models/openai/__pycache__/modeling_openai.cpython-312.pyc,, +transformers/models/openai/__pycache__/tokenization_openai.cpython-312.pyc,, +transformers/models/openai/configuration_openai.py,sha256=0v4pFWsLhqyOiKAQjfLy0DUbxPLxrEikv1BCDbqV3Q4,7686 +transformers/models/openai/modeling_openai.py,sha256=9WiylUqC4Wbb8lXP6TKzqSuWQoJqRSnDRswc96gVCzw,31961 +transformers/models/openai/tokenization_openai.py,sha256=yEDqZyx3WAvek15wSGegxKnvIc58yWVvU5tjgk_VYuU,3730 +transformers/models/opt/__init__.py,sha256=CiUBzuuyvAs-mBmRsBpCbMjI8ATPNgUMzzqEl5VhkIk,987 +transformers/models/opt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/opt/__pycache__/configuration_opt.cpython-312.pyc,, +transformers/models/opt/__pycache__/modeling_opt.cpython-312.pyc,, +transformers/models/opt/configuration_opt.py,sha256=lV5nfoawjnjnSK1Mf-DMSc0kkTIslkhLRCWNRwyFZ-U,6751 +transformers/models/opt/modeling_opt.py,sha256=LJqvmib1fWH-D2l1alM4vFR4thbEovUn87OcnPyo6B8,39313 +transformers/models/ovis2/__init__.py,sha256=HwxC8kFIZohrCDX0F9PYW8dH9R0OEnSnx5LNpXmA_Y4,1122 +transformers/models/ovis2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/ovis2/__pycache__/configuration_ovis2.cpython-312.pyc,, +transformers/models/ovis2/__pycache__/image_processing_ovis2.cpython-312.pyc,, +transformers/models/ovis2/__pycache__/image_processing_ovis2_fast.cpython-312.pyc,, +transformers/models/ovis2/__pycache__/modeling_ovis2.cpython-312.pyc,, +transformers/models/ovis2/__pycache__/modular_ovis2.cpython-312.pyc,, +transformers/models/ovis2/__pycache__/processing_ovis2.cpython-312.pyc,, +transformers/models/ovis2/configuration_ovis2.py,sha256=KQlHaSM_Std4zbCRJ4_ATNBPHJqqsRbtpVnEnDLRpjw,8376 +transformers/models/ovis2/image_processing_ovis2.py,sha256=NS1pVMsAsEPCP777v8NtKMOuoSC4ng_ZxicErSfmgDU,28736 +transformers/models/ovis2/image_processing_ovis2_fast.py,sha256=MIjedbugEImKf2AZYBbmPfR3NrbwUCWCr4oMbxNil6M,9334 +transformers/models/ovis2/modeling_ovis2.py,sha256=_Y-HXQU26gAxf0jV-4mNFiNAh4yn_oi5WKeYKm-5geg,32497 +transformers/models/ovis2/modular_ovis2.py,sha256=wG4XFk7PbhTNpExgLLMAppsNVXwLOnbU7-SSy-WHIp4,19100 +transformers/models/ovis2/processing_ovis2.py,sha256=n8aFkT7PlZhJSsEAsZZHR8fs1ni33hyQMP_Jh4xPchw,5847 +transformers/models/owlv2/__init__.py,sha256=vHnQwYJ0hEc12ofOV3b1k9fHscBgfQEXcLLgo4-H3GU,1116 +transformers/models/owlv2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/owlv2/__pycache__/configuration_owlv2.cpython-312.pyc,, +transformers/models/owlv2/__pycache__/image_processing_owlv2.cpython-312.pyc,, +transformers/models/owlv2/__pycache__/image_processing_owlv2_fast.cpython-312.pyc,, +transformers/models/owlv2/__pycache__/modeling_owlv2.cpython-312.pyc,, +transformers/models/owlv2/__pycache__/modular_owlv2.cpython-312.pyc,, +transformers/models/owlv2/__pycache__/processing_owlv2.cpython-312.pyc,, +transformers/models/owlv2/configuration_owlv2.py,sha256=LSWfo-J9ioi7TIwlJ8-Uixf-yIeWMAonLx1JOyhM_74,12836 +transformers/models/owlv2/image_processing_owlv2.py,sha256=EI7_Pr4RutS7fZ3QMzfZ5zK5StP8uu3C6d97RIs3j_c,27632 +transformers/models/owlv2/image_processing_owlv2_fast.py,sha256=_EApqIg6b0b39alnq6C1J8CgbCGXUPrOFyD0jVuK1fs,15231 +transformers/models/owlv2/modeling_owlv2.py,sha256=3mLL874BaLLN6JoXp0AisJkuSoqRUyeE_pePhMWk9qo,77096 +transformers/models/owlv2/modular_owlv2.py,sha256=PjF6GJTQ-yQAr4ZHvpC87qT6yubfN8Oj374BgOB25u0,8006 +transformers/models/owlv2/processing_owlv2.py,sha256=4YYmsD3J5I7LlcOTz9HCL5RTFiPMncBjvzYUsEs0sAY,10439 +transformers/models/owlvit/__init__.py,sha256=Nhrrja_j2RZtj-rQS6TDJ8upQqnMptnFukq49QAkito,1166 +transformers/models/owlvit/__pycache__/__init__.cpython-312.pyc,, +transformers/models/owlvit/__pycache__/configuration_owlvit.cpython-312.pyc,, +transformers/models/owlvit/__pycache__/image_processing_owlvit.cpython-312.pyc,, +transformers/models/owlvit/__pycache__/image_processing_owlvit_fast.cpython-312.pyc,, +transformers/models/owlvit/__pycache__/modeling_owlvit.cpython-312.pyc,, +transformers/models/owlvit/__pycache__/processing_owlvit.cpython-312.pyc,, +transformers/models/owlvit/configuration_owlvit.py,sha256=_yIPreNO8Rz0dlUUivGxHb1YNzdJf1mOJ0n1nsp2P48,12382 +transformers/models/owlvit/image_processing_owlvit.py,sha256=YBz63bSKLvKovKU_ah4qkJLCjykv879YKN115UPGuZk,26870 +transformers/models/owlvit/image_processing_owlvit_fast.py,sha256=cl6jw6x2U7SFFQIPYB0Keuh_gtKMyQUHWrypSWNXEbw,8178 +transformers/models/owlvit/modeling_owlvit.py,sha256=dl381YDb8EaLE-1TVkOq8Y-B5YPcIuQ0LuydtkBZ2NU,72555 +transformers/models/owlvit/processing_owlvit.py,sha256=mNqcLhleQR-oBxPd7Z1CfT3YnHghJlm7gLSIGtiF3hM,10389 +transformers/models/paddleocr_vl/__init__.py,sha256=2FIAOeLbqCTbEEzHOM5Gh0i-WQOkrZOFyhRof2fZzaQ,1152 +transformers/models/paddleocr_vl/__pycache__/__init__.cpython-312.pyc,, +transformers/models/paddleocr_vl/__pycache__/configuration_paddleocr_vl.cpython-312.pyc,, +transformers/models/paddleocr_vl/__pycache__/image_processing_paddleocr_vl.cpython-312.pyc,, +transformers/models/paddleocr_vl/__pycache__/image_processing_paddleocr_vl_fast.cpython-312.pyc,, +transformers/models/paddleocr_vl/__pycache__/modeling_paddleocr_vl.cpython-312.pyc,, +transformers/models/paddleocr_vl/__pycache__/modular_paddleocr_vl.cpython-312.pyc,, +transformers/models/paddleocr_vl/__pycache__/processing_paddleocr_vl.cpython-312.pyc,, +transformers/models/paddleocr_vl/configuration_paddleocr_vl.py,sha256=hDURucEtFDchNVGKbV_dpNDhacx_9orZ4V0fwQVgeVE,16640 +transformers/models/paddleocr_vl/image_processing_paddleocr_vl.py,sha256=Bl3TC6pqtklrkVEiylYVZyabJpGZxAVSdutPq8Ni38s,25011 +transformers/models/paddleocr_vl/image_processing_paddleocr_vl_fast.py,sha256=sEMvmLsh4JRugNKrzHOrZuDx--DNDcDvbayGpJaSAGw,9298 +transformers/models/paddleocr_vl/modeling_paddleocr_vl.py,sha256=21fFeVaI1kk4PD30LwVQIVPs81s4O9ePeo5UtPraOVI,77465 +transformers/models/paddleocr_vl/modular_paddleocr_vl.py,sha256=vDc6JYNgrkz1HqH0yiMIbVRwKHzFYSR6qHl3jGWQY64,59213 +transformers/models/paddleocr_vl/processing_paddleocr_vl.py,sha256=pWEtf3Xo3SU4i9VGixYTLg4Zc6uMILExwt6KkQyhRN4,6640 +transformers/models/paligemma/__init__.py,sha256=nKnTTLC8XYlI7uYfS8h-D4vz3gFhknkNeDlZIwZlZ9w,1039 +transformers/models/paligemma/__pycache__/__init__.cpython-312.pyc,, +transformers/models/paligemma/__pycache__/configuration_paligemma.cpython-312.pyc,, +transformers/models/paligemma/__pycache__/modeling_paligemma.cpython-312.pyc,, +transformers/models/paligemma/__pycache__/processing_paligemma.cpython-312.pyc,, +transformers/models/paligemma/configuration_paligemma.py,sha256=_yKP-wd4C6Q1tt3VaMxgDEkefVFMwi0IiCoV-yYsF1g,5883 +transformers/models/paligemma/modeling_paligemma.py,sha256=PYPnMMuDZ4mUn62p_1SNVwZcvjuEfLnLKLNB3bKNY0M,27328 +transformers/models/paligemma/processing_paligemma.py,sha256=1bunlD42ZYjO8k-txXz6-tM3DvR6E5MghcnhrC2U_Dk,11657 +transformers/models/parakeet/__init__.py,sha256=hUBWAelpUTDzNsO6U5c1w2mts5ePvfNbov_OzhNh8X4,1090 +transformers/models/parakeet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/parakeet/__pycache__/configuration_parakeet.cpython-312.pyc,, +transformers/models/parakeet/__pycache__/feature_extraction_parakeet.cpython-312.pyc,, +transformers/models/parakeet/__pycache__/modeling_parakeet.cpython-312.pyc,, +transformers/models/parakeet/__pycache__/modular_parakeet.cpython-312.pyc,, +transformers/models/parakeet/__pycache__/processing_parakeet.cpython-312.pyc,, +transformers/models/parakeet/__pycache__/tokenization_parakeet.cpython-312.pyc,, +transformers/models/parakeet/configuration_parakeet.py,sha256=waFRRo64gYZgchT_e8i8QIUlL-wjYcrcrUAd_Ere-A0,10231 +transformers/models/parakeet/feature_extraction_parakeet.py,sha256=rgPjYQrUS34yK3T70hK1HKPGN3Xn4SnnoIcR_v7uvQI,13060 +transformers/models/parakeet/modeling_parakeet.py,sha256=6NLft9kFcROETUh8LmdAWdNC8eE5HOkMgL_lxpywiw0,35162 +transformers/models/parakeet/modular_parakeet.py,sha256=NtlEhOQW0aROrTcoDqeg0ZivbXw2YHpx9NCibnVeb2c,27575 +transformers/models/parakeet/processing_parakeet.py,sha256=uunbJnQFnuXngkefqJysUUbXY7KycnS6e5_eXUh7Q3c,3688 +transformers/models/parakeet/tokenization_parakeet.py,sha256=8XBCL3RL_d1jqZTYYaZ_kKoO59-dh0wqyOH78GQc7Pc,1873 +transformers/models/patchtsmixer/__init__.py,sha256=deFjF_Tu67XcAcNHaq1PXO77N4kVW9wG80SnXBaeagE,1005 +transformers/models/patchtsmixer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/patchtsmixer/__pycache__/configuration_patchtsmixer.cpython-312.pyc,, +transformers/models/patchtsmixer/__pycache__/modeling_patchtsmixer.cpython-312.pyc,, +transformers/models/patchtsmixer/configuration_patchtsmixer.py,sha256=SkzYUOn-8SWRnyf_aNM0J9yBHsu_SXIy5qUdhaNgi5I,12502 +transformers/models/patchtsmixer/modeling_patchtsmixer.py,sha256=8U32-u3Lv4EzYTsuUGfG5Qovnm5niQYNZ9QGbCniDhw,85169 +transformers/models/patchtst/__init__.py,sha256=lrpuBvP25Yq6HZOCyS4yWVYZ47qWzK--rqC0AOIGGPE,997 +transformers/models/patchtst/__pycache__/__init__.cpython-312.pyc,, +transformers/models/patchtst/__pycache__/configuration_patchtst.cpython-312.pyc,, +transformers/models/patchtst/__pycache__/modeling_patchtst.cpython-312.pyc,, +transformers/models/patchtst/configuration_patchtst.py,sha256=Oucc9IBZOeaQEes5r4YI2Gt4ahbhKzmDLoC6TNTijD0,12228 +transformers/models/patchtst/modeling_patchtst.py,sha256=PW20B9IfpYhmFU4QNt09nLradBwhlXBQFSo--KVVGuY,85005 +transformers/models/pe_audio/__init__.py,sha256=kPx9mIPU77pDtiJYg4xOr3RFIz_cUYBbToLt0dfC4k8,1088 +transformers/models/pe_audio/__pycache__/__init__.cpython-312.pyc,, +transformers/models/pe_audio/__pycache__/configuration_pe_audio.cpython-312.pyc,, +transformers/models/pe_audio/__pycache__/feature_extraction_pe_audio.cpython-312.pyc,, +transformers/models/pe_audio/__pycache__/modeling_pe_audio.cpython-312.pyc,, +transformers/models/pe_audio/__pycache__/modular_pe_audio.cpython-312.pyc,, +transformers/models/pe_audio/__pycache__/processing_pe_audio.cpython-312.pyc,, +transformers/models/pe_audio/configuration_pe_audio.py,sha256=rptnZixlKXsbI4AvvFSDSVKRU5NM6-PtGIY6Rhvspr8,8766 +transformers/models/pe_audio/feature_extraction_pe_audio.py,sha256=EzwR1sqIA2h1fr8VflbeFujIbnajl_0oUUEeuhov62o,6484 +transformers/models/pe_audio/modeling_pe_audio.py,sha256=FTO_l4VPam8zJp6DznAmXLOwExPSCO5oMmXHNRNmOfU,33045 +transformers/models/pe_audio/modular_pe_audio.py,sha256=85s62fMLPCCPe7J7EcZOq78sWXpkA-Gyba1HVm-I-UE,11380 +transformers/models/pe_audio/processing_pe_audio.py,sha256=DGJ-IjGrDuYgn9eSlH0s-l2nsrmQzh-e8sMBGvBf4hM,879 +transformers/models/pe_audio_video/__init__.py,sha256=tt4bWq6NXVc6hA7uTtMYQ3CD9APPTUlhUrPwpOKl22k,1059 +transformers/models/pe_audio_video/__pycache__/__init__.cpython-312.pyc,, +transformers/models/pe_audio_video/__pycache__/configuration_pe_audio_video.cpython-312.pyc,, +transformers/models/pe_audio_video/__pycache__/modeling_pe_audio_video.cpython-312.pyc,, +transformers/models/pe_audio_video/__pycache__/modular_pe_audio_video.cpython-312.pyc,, +transformers/models/pe_audio_video/__pycache__/processing_pe_audio_video.cpython-312.pyc,, +transformers/models/pe_audio_video/configuration_pe_audio_video.py,sha256=BKkqKs1nRhAiOoR_BggqNrZ1oN0duVL4oLqnBYKDDwU,9742 +transformers/models/pe_audio_video/modeling_pe_audio_video.py,sha256=tT9lK1nB_QFEIhxwqs_97PHv5wvKmcrfHqCBDnziK3o,42545 +transformers/models/pe_audio_video/modular_pe_audio_video.py,sha256=JSpvBp1gc5W_MYMUI1BnZH91qS0mDHgngYr9QhAM1vI,32526 +transformers/models/pe_audio_video/processing_pe_audio_video.py,sha256=ZlWrgf_y_zgW8waV4194VBAAcioM6fz6OGQUucezpBo,960 +transformers/models/pe_video/__init__.py,sha256=vCPdJDp9o_fTkcffIBjSBjuOqHM-PRhS5jf74KcKQdk,1086 +transformers/models/pe_video/__pycache__/__init__.cpython-312.pyc,, +transformers/models/pe_video/__pycache__/configuration_pe_video.cpython-312.pyc,, +transformers/models/pe_video/__pycache__/modeling_pe_video.cpython-312.pyc,, +transformers/models/pe_video/__pycache__/modular_pe_video.cpython-312.pyc,, +transformers/models/pe_video/__pycache__/processing_pe_video.cpython-312.pyc,, +transformers/models/pe_video/__pycache__/video_processing_pe_video.cpython-312.pyc,, +transformers/models/pe_video/configuration_pe_video.py,sha256=g86covIsYvHL5suYSjKWLDKAKVAWxLJwGoufO6EJHc0,8993 +transformers/models/pe_video/modeling_pe_video.py,sha256=CC2-FhM3hY7mVD8VsB1VHg3MH7c7q6jTTN3qah0gXP8,26657 +transformers/models/pe_video/modular_pe_video.py,sha256=fnl6-8DG1kMsAj7PRGouH-u34fRJ5p08MXeNtTt4bjY,8873 +transformers/models/pe_video/processing_pe_video.py,sha256=ZrP95LzdcixtU5U_ZjcgKRCHnbH4_35SoFhyCSXtNwI,262 +transformers/models/pe_video/video_processing_pe_video.py,sha256=v04MsBAnyhLJfIkd2iZL6PROPIdiuYsE2R6bOKnCoFE,2663 +transformers/models/pegasus/__init__.py,sha256=jCo_uusFhqSgC-X8TuopKyGESiE96TLPuo7ooxzMx2M,1035 +transformers/models/pegasus/__pycache__/__init__.cpython-312.pyc,, +transformers/models/pegasus/__pycache__/configuration_pegasus.cpython-312.pyc,, +transformers/models/pegasus/__pycache__/modeling_pegasus.cpython-312.pyc,, +transformers/models/pegasus/__pycache__/tokenization_pegasus.cpython-312.pyc,, +transformers/models/pegasus/configuration_pegasus.py,sha256=Ey83j4LK-WiyMEiz-LICTA5gTELPlPNWhNX_1t0_oUQ,7462 +transformers/models/pegasus/modeling_pegasus.py,sha256=l2XKB93pw4Rpzjln0lx0ZXOAkCvRQArlvUTH-YICmt8,61668 +transformers/models/pegasus/tokenization_pegasus.py,sha256=bM3Sn-l7pu8f4QA0Cyidkap4zO1TEgnM628_qgWJrnA,6122 +transformers/models/pegasus_x/__init__.py,sha256=qSLaqKRA1upZOobapHW5MjSZvIEzf-ij-ZmY1VGzqaE,999 +transformers/models/pegasus_x/__pycache__/__init__.cpython-312.pyc,, +transformers/models/pegasus_x/__pycache__/configuration_pegasus_x.cpython-312.pyc,, +transformers/models/pegasus_x/__pycache__/modeling_pegasus_x.cpython-312.pyc,, +transformers/models/pegasus_x/configuration_pegasus_x.py,sha256=S9lVxUPcvviUd4qlV2Ue7iSoCfhDhu4E-7NfCP_Dbs0,8034 +transformers/models/pegasus_x/modeling_pegasus_x.py,sha256=pDmSvqeGg4KWXGVHmapyS_XU_bCkrFVwePAv3KsAEOI,67323 +transformers/models/perceiver/__init__.py,sha256=LKUlUJfZGRC1jU6TNkG-4kNy8aIeHIqvAnwLI_33AVY,1186 +transformers/models/perceiver/__pycache__/__init__.cpython-312.pyc,, +transformers/models/perceiver/__pycache__/configuration_perceiver.cpython-312.pyc,, +transformers/models/perceiver/__pycache__/image_processing_perceiver.cpython-312.pyc,, +transformers/models/perceiver/__pycache__/image_processing_perceiver_fast.cpython-312.pyc,, +transformers/models/perceiver/__pycache__/modeling_perceiver.cpython-312.pyc,, +transformers/models/perceiver/__pycache__/tokenization_perceiver.cpython-312.pyc,, +transformers/models/perceiver/configuration_perceiver.py,sha256=6VhJXpcTgpZX80UEOxl8ABUKY_axtP04b-i6EfPIZmI,8986 +transformers/models/perceiver/image_processing_perceiver.py,sha256=3ZV968wpP3NuFHWSQ7hspm_KPuAq7phLhlouB_3hnGY,17150 +transformers/models/perceiver/image_processing_perceiver_fast.py,sha256=ZuIZIII8al0rLUoFnU5n8b_vSvDYmavNwSD2x4_0VlU,4888 +transformers/models/perceiver/modeling_perceiver.py,sha256=_RW15BtDHfS7KZwHLE-dZ9Otr6NgNrHR8QIl9FNpSX0,134809 +transformers/models/perceiver/tokenization_perceiver.py,sha256=GVEoliqqJb7AtXDXRtjmp_45E-IJLoPZA8jNIgcHvP8,7982 +transformers/models/perception_lm/__init__.py,sha256=RVEjQWlzsHJm3D-3JXLThzBjJLSCMpvFslQMIkvRKiA,1106 +transformers/models/perception_lm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/perception_lm/__pycache__/configuration_perception_lm.cpython-312.pyc,, +transformers/models/perception_lm/__pycache__/image_processing_perception_lm_fast.cpython-312.pyc,, +transformers/models/perception_lm/__pycache__/modeling_perception_lm.cpython-312.pyc,, +transformers/models/perception_lm/__pycache__/modular_perception_lm.cpython-312.pyc,, +transformers/models/perception_lm/__pycache__/processing_perception_lm.cpython-312.pyc,, +transformers/models/perception_lm/__pycache__/video_processing_perception_lm.cpython-312.pyc,, +transformers/models/perception_lm/configuration_perception_lm.py,sha256=6XjSd9WSh1orySWa40xP-xMmmQsCPgKvoE0fW5KzNpU,3873 +transformers/models/perception_lm/image_processing_perception_lm_fast.py,sha256=vfheD9pfofybGomiacPiZgBB7rzYpLQJnJVeweBK1RY,13806 +transformers/models/perception_lm/modeling_perception_lm.py,sha256=PW9jxAPp9cAZKEm-E_btd4VtE0D3-zFP5veI-9Xn2iY,21263 +transformers/models/perception_lm/modular_perception_lm.py,sha256=RoPcqRKERmMihIQBQh5rbeaXyNDMxjbyKPZMh05bDr4,18852 +transformers/models/perception_lm/processing_perception_lm.py,sha256=gRjgGRjmU25ON-eKddy3CB-I_FWE_-JhVOcl6mGQnUM,8828 +transformers/models/perception_lm/video_processing_perception_lm.py,sha256=i49-VYt3kgRhkf7XRyD3sYaoI2pIKCNSTlyXfzjnBPk,1211 +transformers/models/persimmon/__init__.py,sha256=T1WqyE78N2TO74u9a9QdRIGaMowYqP6vWv8KhPojkLg,999 +transformers/models/persimmon/__pycache__/__init__.cpython-312.pyc,, +transformers/models/persimmon/__pycache__/configuration_persimmon.cpython-312.pyc,, +transformers/models/persimmon/__pycache__/modeling_persimmon.cpython-312.pyc,, +transformers/models/persimmon/configuration_persimmon.py,sha256=mAdkyEBvTDIAFBn-eJgH5nDEnaiqiTwjTElwuSpx9Rc,6103 +transformers/models/persimmon/modeling_persimmon.py,sha256=8RLPAmQecl4PNXC3RtfCTCcQNivv3lSV1J1AoyhADeM,27400 +transformers/models/phi/__init__.py,sha256=4DUgmUqGKcGXxzTrxUVGcacZ43uv3SzXsOV_Ke6oeGg,1006 +transformers/models/phi/__pycache__/__init__.cpython-312.pyc,, +transformers/models/phi/__pycache__/configuration_phi.cpython-312.pyc,, +transformers/models/phi/__pycache__/modeling_phi.cpython-312.pyc,, +transformers/models/phi/__pycache__/modular_phi.cpython-312.pyc,, +transformers/models/phi/configuration_phi.py,sha256=DsZqkrnaBCFhyKwFxtoDg_NW_9wvyEZ_MbtcDtPA50Y,8304 +transformers/models/phi/modeling_phi.py,sha256=jAIu0h3qfJqfQesmDZaP1SKYLu4qMsLKI745VQmpjYo,23278 +transformers/models/phi/modular_phi.py,sha256=bU8Wd5A2yaoRleHusMVtTX9IlMJEV-LzJseeSXFNkw0,12736 +transformers/models/phi3/__init__.py,sha256=dxyO-jIh0yB6t2Dzs173aRrEnTceVMIYIkg6JxIeyWs,989 +transformers/models/phi3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/phi3/__pycache__/configuration_phi3.cpython-312.pyc,, +transformers/models/phi3/__pycache__/modeling_phi3.cpython-312.pyc,, +transformers/models/phi3/__pycache__/modular_phi3.cpython-312.pyc,, +transformers/models/phi3/configuration_phi3.py,sha256=LUff5nDohJf31WJk1htAp464PozT2s_yaBLyruNABH0,12196 +transformers/models/phi3/modeling_phi3.py,sha256=h6UOi-ynmlBNowUCgC-XQIQMB0kZwKqJlk6Z1RQooIc,24379 +transformers/models/phi3/modular_phi3.py,sha256=RRwpm5PYINbS5KDsAq4rk4QHYvVujV6ByPr71xmv-1U,10809 +transformers/models/phi4_multimodal/__init__.py,sha256=EqoKUvkh9f14qg07g-4MLclztlyiyLfN2qqEp3RGp2w,1170 +transformers/models/phi4_multimodal/__pycache__/__init__.cpython-312.pyc,, +transformers/models/phi4_multimodal/__pycache__/configuration_phi4_multimodal.cpython-312.pyc,, +transformers/models/phi4_multimodal/__pycache__/feature_extraction_phi4_multimodal.cpython-312.pyc,, +transformers/models/phi4_multimodal/__pycache__/image_processing_phi4_multimodal_fast.cpython-312.pyc,, +transformers/models/phi4_multimodal/__pycache__/modeling_phi4_multimodal.cpython-312.pyc,, +transformers/models/phi4_multimodal/__pycache__/modular_phi4_multimodal.cpython-312.pyc,, +transformers/models/phi4_multimodal/__pycache__/processing_phi4_multimodal.cpython-312.pyc,, +transformers/models/phi4_multimodal/configuration_phi4_multimodal.py,sha256=tgVbkM1-adIfkWFBBkxvd_I_HJh6Id7E-MK3hNUaLJY,25062 +transformers/models/phi4_multimodal/feature_extraction_phi4_multimodal.py,sha256=HDFWut0WDq1UnvOatGpJmlmVYTG0s6vEOYpW_JUd-3A,13283 +transformers/models/phi4_multimodal/image_processing_phi4_multimodal_fast.py,sha256=m172F56wOLW0X3wld-FRbV82Mt47hQIVlW3gSdDXSg4,10427 +transformers/models/phi4_multimodal/modeling_phi4_multimodal.py,sha256=x4NRZ2FseIqzKyHK8U_DRi9JeDsKGOr-eGrXBkS6jnw,77342 +transformers/models/phi4_multimodal/modular_phi4_multimodal.py,sha256=SLVU7BkKDXrAtAr05DShocAAPFNBVB9lpBHZo12udcw,77368 +transformers/models/phi4_multimodal/processing_phi4_multimodal.py,sha256=rymz4P7We8z3eH4OgoQWa5zcW9oSjZpZG7poRwIsHNc,5512 +transformers/models/phimoe/__init__.py,sha256=wGasPysu0EH_q0QGaZmXqQL57GxfZn8NTsvB2I6U2ro,1013 +transformers/models/phimoe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/phimoe/__pycache__/configuration_phimoe.cpython-312.pyc,, +transformers/models/phimoe/__pycache__/modeling_phimoe.cpython-312.pyc,, +transformers/models/phimoe/__pycache__/modular_phimoe.cpython-312.pyc,, +transformers/models/phimoe/configuration_phimoe.py,sha256=2eXzxlzl4cjRAs3j1pbX3BT5VhmPD2PjQXbXXgSLTqk,10337 +transformers/models/phimoe/modeling_phimoe.py,sha256=ijqVI8ytMTeOroWr69eJKB4lElsEW3P7J6Uznj8dotk,39547 +transformers/models/phimoe/modular_phimoe.py,sha256=6G5zo42B0TS-heG8ThG8-wW4RGJAfPQ2SJJEmzj8iEY,15642 +transformers/models/phobert/__init__.py,sha256=mau-2HIOzSk8qGIhxivVBPPYTx3hhdgoKPtnptDF38M,958 +transformers/models/phobert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/phobert/__pycache__/tokenization_phobert.cpython-312.pyc,, +transformers/models/phobert/tokenization_phobert.py,sha256=WKrjnlFs4-Oh41kJMLDkdegGB50YKNAjooQY7WxxZ5E,13057 +transformers/models/pix2struct/__init__.py,sha256=nqs7D1WX64OUEJY7gRDIvAygxcnwhxlnEewOHLE9-O0,1141 +transformers/models/pix2struct/__pycache__/__init__.cpython-312.pyc,, +transformers/models/pix2struct/__pycache__/configuration_pix2struct.cpython-312.pyc,, +transformers/models/pix2struct/__pycache__/image_processing_pix2struct.cpython-312.pyc,, +transformers/models/pix2struct/__pycache__/image_processing_pix2struct_fast.cpython-312.pyc,, +transformers/models/pix2struct/__pycache__/modeling_pix2struct.cpython-312.pyc,, +transformers/models/pix2struct/__pycache__/processing_pix2struct.cpython-312.pyc,, +transformers/models/pix2struct/configuration_pix2struct.py,sha256=MWGhdyOvyJSVvSwy4Gf28nBRR3nMIo2kF67oARBUvkI,15862 +transformers/models/pix2struct/image_processing_pix2struct.py,sha256=X3kuH7EMc80gQPIzCjhpZ4h3T7yvptcBvM072Dnraxg,19918 +transformers/models/pix2struct/image_processing_pix2struct_fast.py,sha256=thtFvzgGBU0UUrX79D0f3qIBza9_Ls6eughecsRI3bE,13189 +transformers/models/pix2struct/modeling_pix2struct.py,sha256=-EWKgqJOgFrhIKxdRx_aCG0IkmCNKCLoc00DBX3lPB4,60770 +transformers/models/pix2struct/processing_pix2struct.py,sha256=GW-ZQSxH38270eh03EbjRm3nVT7sS4zFck7JwL2w-mk,4167 +transformers/models/pixio/__init__.py,sha256=G834ZPfjQ3fixXcSbc1mYJcb5FurIq7Ux5fYfD5ECGc,1041 +transformers/models/pixio/__pycache__/__init__.cpython-312.pyc,, +transformers/models/pixio/__pycache__/configuration_pixio.cpython-312.pyc,, +transformers/models/pixio/__pycache__/modeling_pixio.cpython-312.pyc,, +transformers/models/pixio/__pycache__/modular_pixio.cpython-312.pyc,, +transformers/models/pixio/configuration_pixio.py,sha256=hI7ZOugPjRzcs7pDvOmgbe5jwUm0kjtN3kSW77P1oHw,7832 +transformers/models/pixio/modeling_pixio.py,sha256=hUuixO8jtlnMke9Hx2_HWOVVORQKAIHH5OsNTat5GsY,21151 +transformers/models/pixio/modular_pixio.py,sha256=VZaCiVraLZwKp4Bb8pTOfScjIJaZN6J8RoY4dXEkt9s,16740 +transformers/models/pixtral/__init__.py,sha256=WKCxuWpCeTYsYSaTH1XnUcGkIHEx5BIIXwwwqG_E83s,1126 +transformers/models/pixtral/__pycache__/__init__.cpython-312.pyc,, +transformers/models/pixtral/__pycache__/configuration_pixtral.cpython-312.pyc,, +transformers/models/pixtral/__pycache__/image_processing_pixtral.cpython-312.pyc,, +transformers/models/pixtral/__pycache__/image_processing_pixtral_fast.cpython-312.pyc,, +transformers/models/pixtral/__pycache__/modeling_pixtral.cpython-312.pyc,, +transformers/models/pixtral/__pycache__/processing_pixtral.cpython-312.pyc,, +transformers/models/pixtral/configuration_pixtral.py,sha256=19KxBzXEZ77jkuA56zb_9fEb-b2T3JXNVfH4zJ4dZ4U,4453 +transformers/models/pixtral/image_processing_pixtral.py,sha256=YPXvB2KEcYufmYeDaknTNQU1uuCGVl88uFLDuGvjmMk,22088 +transformers/models/pixtral/image_processing_pixtral_fast.py,sha256=ShIuq__FzRkWUrykWO-HNbiHjOH-wQD96SFZl5J7esw,7418 +transformers/models/pixtral/modeling_pixtral.py,sha256=rGfEG6Lne1urZU0KT6Vonj0ojOnJW5gGgI3QlwENVbU,21907 +transformers/models/pixtral/processing_pixtral.py,sha256=oZHyKodZxm0dhYoK-YpTRfZVvxkeC6fry08Ic5V1Qio,9508 +transformers/models/plbart/__init__.py,sha256=jmP857QTG7jGfr9n0qK3TB_1-hdVDD1ajtJvP6C7FIw,1032 +transformers/models/plbart/__pycache__/__init__.cpython-312.pyc,, +transformers/models/plbart/__pycache__/configuration_plbart.cpython-312.pyc,, +transformers/models/plbart/__pycache__/modeling_plbart.cpython-312.pyc,, +transformers/models/plbart/__pycache__/modular_plbart.cpython-312.pyc,, +transformers/models/plbart/__pycache__/tokenization_plbart.cpython-312.pyc,, +transformers/models/plbart/configuration_plbart.py,sha256=2PXRu5XOiOOags31hLzI3cf_ramnk5x1lNP8q0lb2rE,7701 +transformers/models/plbart/modeling_plbart.py,sha256=Y3LH3HRgCMUTTEi_87HHvaxFxiXv8AJTFcQpgWbumXc,63693 +transformers/models/plbart/modular_plbart.py,sha256=r4F02UA2V3NSTj9bwS5klv7HAYyRXeELPkk2oFTweD8,18769 +transformers/models/plbart/tokenization_plbart.py,sha256=rYsqJH4aJmZz9WUDd2tDiqN30CTaou3BTKV1CBk9xno,16439 +transformers/models/poolformer/__init__.py,sha256=FgSXHIGeF8uz-Ye67HSRQefjounknzaqm0ZCOiMj4zo,1149 +transformers/models/poolformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/poolformer/__pycache__/configuration_poolformer.cpython-312.pyc,, +transformers/models/poolformer/__pycache__/image_processing_poolformer.cpython-312.pyc,, +transformers/models/poolformer/__pycache__/image_processing_poolformer_fast.cpython-312.pyc,, +transformers/models/poolformer/__pycache__/modeling_poolformer.cpython-312.pyc,, +transformers/models/poolformer/configuration_poolformer.py,sha256=-AOQSev1-Cgw3lvsTKnOJBLl8EAy8usPdGV56inufb8,5061 +transformers/models/poolformer/image_processing_poolformer.py,sha256=ivm6nSf5n33HzjH18bm4Jc4cHI8O90b99CFlKxczbZw,17874 +transformers/models/poolformer/image_processing_poolformer_fast.py,sha256=7tfl9sREG15Djf1O5DQrSxqNY9ktV67M3ww3PEtkBYo,9892 +transformers/models/poolformer/modeling_poolformer.py,sha256=2oiqSJbbPQDuts6pmdtirwhONIzOo3I5zNsKmTfcX1E,14459 +transformers/models/pop2piano/__init__.py,sha256=I2PPcFi-p0X5py7dLqobymv3E9g-mUv1QRn0luyPlIk,999 +transformers/models/pop2piano/__pycache__/__init__.cpython-312.pyc,, +transformers/models/pop2piano/__pycache__/configuration_pop2piano.cpython-312.pyc,, +transformers/models/pop2piano/__pycache__/feature_extraction_pop2piano.cpython-312.pyc,, +transformers/models/pop2piano/__pycache__/modeling_pop2piano.cpython-312.pyc,, +transformers/models/pop2piano/__pycache__/processing_pop2piano.cpython-312.pyc,, +transformers/models/pop2piano/__pycache__/tokenization_pop2piano.cpython-312.pyc,, +transformers/models/pop2piano/configuration_pop2piano.py,sha256=y_NPg9dFNLigd0g_cJQXTDzauDZj9F10SP-VNUC-n1E,6057 +transformers/models/pop2piano/feature_extraction_pop2piano.py,sha256=gwI8jIAeCX2P86gLyddK7Tqv11-4m3fxCk1sTToQl4s,19870 +transformers/models/pop2piano/modeling_pop2piano.py,sha256=8KZbNYYQm-ymRWGdE0L8IhprT3qaKvHp8aAr6cEMKg8,51699 +transformers/models/pop2piano/processing_pop2piano.py,sha256=Ufls4EQt6eAMcMuFhWnvJA4R-dshtRGKv-hiDoFYcIA,5235 +transformers/models/pop2piano/tokenization_pop2piano.py,sha256=cV3QqOZxqUG_5RpdOEktAOp73pRRu6Jeo6dJjqZCQek,32550 +transformers/models/pp_doclayout_v3/__init__.py,sha256=NQrHEFooIN59S0_WZkfYR0YxizAgjVa8wdNGtOz6T1c,1070 +transformers/models/pp_doclayout_v3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/pp_doclayout_v3/__pycache__/configuration_pp_doclayout_v3.cpython-312.pyc,, +transformers/models/pp_doclayout_v3/__pycache__/image_processing_pp_doclayout_v3_fast.cpython-312.pyc,, +transformers/models/pp_doclayout_v3/__pycache__/modeling_pp_doclayout_v3.cpython-312.pyc,, +transformers/models/pp_doclayout_v3/__pycache__/modular_pp_doclayout_v3.cpython-312.pyc,, +transformers/models/pp_doclayout_v3/configuration_pp_doclayout_v3.py,sha256=Gx7qqTfskWX0BnYXohiS0DkgA8Zs3X1xEU72VC35uVI,14646 +transformers/models/pp_doclayout_v3/image_processing_pp_doclayout_v3_fast.py,sha256=Up-SUcka0A_XgygeuPhmTx7wX5kC89Q8-B4EioB9Y6I,13491 +transformers/models/pp_doclayout_v3/modeling_pp_doclayout_v3.py,sha256=JCRmJy4P14BCqEcd_P_0skwK_V6BCRGpRAWPiMrQqz8,95491 +transformers/models/pp_doclayout_v3/modular_pp_doclayout_v3.py,sha256=y9i79tt7PaJpCZsS0BQ_ID1v7ngS2iD_0hki516xvng,74106 +transformers/models/prompt_depth_anything/__init__.py,sha256=KjyIVKAGtL4B0RRW4s5WyyFNmvimW_Cv36LkiyuPbGA,1333 +transformers/models/prompt_depth_anything/__pycache__/__init__.cpython-312.pyc,, +transformers/models/prompt_depth_anything/__pycache__/configuration_prompt_depth_anything.cpython-312.pyc,, +transformers/models/prompt_depth_anything/__pycache__/image_processing_prompt_depth_anything.cpython-312.pyc,, +transformers/models/prompt_depth_anything/__pycache__/image_processing_prompt_depth_anything_fast.cpython-312.pyc,, +transformers/models/prompt_depth_anything/__pycache__/modeling_prompt_depth_anything.cpython-312.pyc,, +transformers/models/prompt_depth_anything/__pycache__/modular_prompt_depth_anything.cpython-312.pyc,, +transformers/models/prompt_depth_anything/configuration_prompt_depth_anything.py,sha256=Wf7gnMQw4TIMNP0kXzFv75NzrlKZUXN2QTrtAROFiQg,6351 +transformers/models/prompt_depth_anything/image_processing_prompt_depth_anything.py,sha256=g0LoTQixD0sZim1WqljFE99_4XDiiVviH1tFA6V5hU4,25030 +transformers/models/prompt_depth_anything/image_processing_prompt_depth_anything_fast.py,sha256=9xk70kR_ldmYd8AgWQrHFr2MZgpQfL-x-pT0GUkfC9s,13209 +transformers/models/prompt_depth_anything/modeling_prompt_depth_anything.py,sha256=qa5r3gLJpMvP1qEeLvLSLNALBE20v7IGCRvO5Co2ge8,20507 +transformers/models/prompt_depth_anything/modular_prompt_depth_anything.py,sha256=0KZoKEkrO6JI4c9kAU2z8qnoN6FtdKuhnA-zxFjgp5o,13825 +transformers/models/prophetnet/__init__.py,sha256=TYI21JDlj449kTgKAOtUBpuxVv5L_I70CDjofSZ627M,1044 +transformers/models/prophetnet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/prophetnet/__pycache__/configuration_prophetnet.cpython-312.pyc,, +transformers/models/prophetnet/__pycache__/modeling_prophetnet.cpython-312.pyc,, +transformers/models/prophetnet/__pycache__/tokenization_prophetnet.cpython-312.pyc,, +transformers/models/prophetnet/configuration_prophetnet.py,sha256=fx4EloBPW_YyczxPlDUEliAgQAejRs_0CrpscXrYng8,8943 +transformers/models/prophetnet/modeling_prophetnet.py,sha256=LjsHrJqW-IgWC_8B600N7kk3jMVlZkJ8zh6siZF3BVs,87498 +transformers/models/prophetnet/tokenization_prophetnet.py,sha256=nPUW6PS_olcfRbKhJeNpHISbX_mf1ygEayGIwSEACIs,19845 +transformers/models/pvt/__init__.py,sha256=-4ajQRrz2cTp2czAd6D23yxShatfUpHzZrHyyLRsku0,1072 +transformers/models/pvt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/pvt/__pycache__/configuration_pvt.cpython-312.pyc,, +transformers/models/pvt/__pycache__/image_processing_pvt.cpython-312.pyc,, +transformers/models/pvt/__pycache__/image_processing_pvt_fast.cpython-312.pyc,, +transformers/models/pvt/__pycache__/modeling_pvt.cpython-312.pyc,, +transformers/models/pvt/configuration_pvt.py,sha256=HlD5pTeBP5WyS5zkQpRGqvcxmRyvE4EWYQ6c6tyHwyY,6362 +transformers/models/pvt/image_processing_pvt.py,sha256=AysoQbMtXEq6CcIDao37q6fYRuq3aWH4QElWMn1wXX4,13388 +transformers/models/pvt/image_processing_pvt_fast.py,sha256=dLmpkHo4M8YCjQzv3E9-b61uAkgfQAfDU-ZyZLz8UlU,1325 +transformers/models/pvt/modeling_pvt.py,sha256=I_3itQejied9CPewMa1DHyGrwMLw02P5Y04-MJCdfiQ,22525 +transformers/models/pvt_v2/__init__.py,sha256=LkmqeLd7cZGKTFX_2d9_jU0sj_bDlML042kr_vMJTLw,993 +transformers/models/pvt_v2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/pvt_v2/__pycache__/configuration_pvt_v2.cpython-312.pyc,, +transformers/models/pvt_v2/__pycache__/modeling_pvt_v2.cpython-312.pyc,, +transformers/models/pvt_v2/configuration_pvt_v2.py,sha256=hF-GLYZ2NEtZl6Vy05Z7RrXXvRMFD0XBmxOgH4Dy9m8,7808 +transformers/models/pvt_v2/modeling_pvt_v2.py,sha256=Y7ff-2ZGD3cEg4fYgNDBaP8VyV1GjegtPnuwZg7NbBc,23534 +transformers/models/qwen2/__init__.py,sha256=e49oEzErXujE0UVl_q_agf5XHzHES4vV2kLwmqdk2kg,1095 +transformers/models/qwen2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen2/__pycache__/configuration_qwen2.cpython-312.pyc,, +transformers/models/qwen2/__pycache__/modeling_qwen2.cpython-312.pyc,, +transformers/models/qwen2/__pycache__/modular_qwen2.cpython-312.pyc,, +transformers/models/qwen2/__pycache__/tokenization_qwen2.cpython-312.pyc,, +transformers/models/qwen2/configuration_qwen2.py,sha256=fGq-jsMa5IRankvEfIOUeeboitdK8AlsY4Vv2PI4_nY,8994 +transformers/models/qwen2/modeling_qwen2.py,sha256=WoAk7vsHj5racx_8xELglhxSj0GHj9P76kuDMeHYX2Q,22663 +transformers/models/qwen2/modular_qwen2.py,sha256=wscUvUkmpZ1tH5e55cbucxp0h1g8jJ52rDcbc1IPxMI,8228 +transformers/models/qwen2/tokenization_qwen2.py,sha256=-sTmV2v-I2lzG-FHpOUw8mK98y8qxQQ2-W8Ni90vxig,3323 +transformers/models/qwen2_5_omni/__init__.py,sha256=YEDAlOoWmhkZ4L6lxmlVqVhe5A0P6aVSJNSziEFSN4E,1071 +transformers/models/qwen2_5_omni/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen2_5_omni/__pycache__/configuration_qwen2_5_omni.cpython-312.pyc,, +transformers/models/qwen2_5_omni/__pycache__/modeling_qwen2_5_omni.cpython-312.pyc,, +transformers/models/qwen2_5_omni/__pycache__/modular_qwen2_5_omni.cpython-312.pyc,, +transformers/models/qwen2_5_omni/__pycache__/processing_qwen2_5_omni.cpython-312.pyc,, +transformers/models/qwen2_5_omni/configuration_qwen2_5_omni.py,sha256=srO94tNCjF-sz8JhEbt-88w2fPnJSafxadDScpjldmI,48048 +transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py,sha256=Q1aP7HUmqKDodjynjiOuT-RNs1OsuUZ9SnnEcF2fI6E,181312 +transformers/models/qwen2_5_omni/modular_qwen2_5_omni.py,sha256=4GA9-VC7VcJdfVxGZSw18XhPXcdzbRdtv3kFgzR4fII,186461 +transformers/models/qwen2_5_omni/processing_qwen2_5_omni.py,sha256=ZN-7KOrrUfS2j7PNAJlapotFZHVrzCYik_W5L5AtCgo,18896 +transformers/models/qwen2_5_vl/__init__.py,sha256=8-dsgLIeeE3n90n6F0XOu-tBZ-80Wotz89pjZi5GqjQ,1065 +transformers/models/qwen2_5_vl/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen2_5_vl/__pycache__/configuration_qwen2_5_vl.cpython-312.pyc,, +transformers/models/qwen2_5_vl/__pycache__/modeling_qwen2_5_vl.cpython-312.pyc,, +transformers/models/qwen2_5_vl/__pycache__/modular_qwen2_5_vl.cpython-312.pyc,, +transformers/models/qwen2_5_vl/__pycache__/processing_qwen2_5_vl.cpython-312.pyc,, +transformers/models/qwen2_5_vl/configuration_qwen2_5_vl.py,sha256=a0iBSVqnpwDao7oT522P0jLftw63fcH7r6Zy77fkaLA,15942 +transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py,sha256=MXj8CiT84wd5ldAmzW62HT4h3KigdKwc7Z1JFzVeGRU,85052 +transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py,sha256=FEqynsBZZ-43U3HBUVj-00E-VUJqVIMi0BwxAk1Dkr4,45039 +transformers/models/qwen2_5_vl/processing_qwen2_5_vl.py,sha256=g-anW41MYKv27VQ0c_OTM92mr0sUt1EPUZvUjNw58e0,11878 +transformers/models/qwen2_audio/__init__.py,sha256=KaUmP3FK3GdeWvbunzyp1QjBki0USS4E80NlvhaJ3D8,1045 +transformers/models/qwen2_audio/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen2_audio/__pycache__/configuration_qwen2_audio.cpython-312.pyc,, +transformers/models/qwen2_audio/__pycache__/modeling_qwen2_audio.cpython-312.pyc,, +transformers/models/qwen2_audio/__pycache__/processing_qwen2_audio.cpython-312.pyc,, +transformers/models/qwen2_audio/configuration_qwen2_audio.py,sha256=0Sv3GNIIi9Sw4wn-8cX6YyiawWIpJ1i_niHtA7uINRU,8658 +transformers/models/qwen2_audio/modeling_qwen2_audio.py,sha256=4-0BGz9jbuKae7wb5GLtDk5rj1EFYFuQxrMpaoGLRJI,39553 +transformers/models/qwen2_audio/processing_qwen2_audio.py,sha256=HNcynxm64NaFntXKua0rNVevmG9XtzaH12Ke9UH5lrc,9302 +transformers/models/qwen2_moe/__init__.py,sha256=TZM20WtUr1UyV-hDDgq5B-qFT4aUulMpjWwSUNdUs2w,999 +transformers/models/qwen2_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen2_moe/__pycache__/configuration_qwen2_moe.cpython-312.pyc,, +transformers/models/qwen2_moe/__pycache__/modeling_qwen2_moe.cpython-312.pyc,, +transformers/models/qwen2_moe/__pycache__/modular_qwen2_moe.cpython-312.pyc,, +transformers/models/qwen2_moe/configuration_qwen2_moe.py,sha256=SU6tkJBYXsAV74uiG81_ch_QUSIi-3y62AWKLL3JnWs,11609 +transformers/models/qwen2_moe/modeling_qwen2_moe.py,sha256=N87-dSp00LyK3zM_R_ATWkF7He05bWiWUOiJFVBijp4,33255 +transformers/models/qwen2_moe/modular_qwen2_moe.py,sha256=hQaiDRKs6OnPEGHeLPUZKsh9gDWOgoN6gYgDsQnzHGw,11132 +transformers/models/qwen2_vl/__init__.py,sha256=MtNDD6sEQws-WTLwPxUL5UNd-UyDPrDh8yWzIAsRp-U,1131 +transformers/models/qwen2_vl/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen2_vl/__pycache__/configuration_qwen2_vl.cpython-312.pyc,, +transformers/models/qwen2_vl/__pycache__/image_processing_qwen2_vl.cpython-312.pyc,, +transformers/models/qwen2_vl/__pycache__/image_processing_qwen2_vl_fast.cpython-312.pyc,, +transformers/models/qwen2_vl/__pycache__/modeling_qwen2_vl.cpython-312.pyc,, +transformers/models/qwen2_vl/__pycache__/processing_qwen2_vl.cpython-312.pyc,, +transformers/models/qwen2_vl/__pycache__/video_processing_qwen2_vl.cpython-312.pyc,, +transformers/models/qwen2_vl/configuration_qwen2_vl.py,sha256=8I_FsnLaZPoDDOEjg-C7rrjyGnDGPbDzTKy8RM0e6Vg,14575 +transformers/models/qwen2_vl/image_processing_qwen2_vl.py,sha256=IY_5N0r2-cPDsODKidLCEwi9EEO_Zcg4bWWJAsr4hFc,24667 +transformers/models/qwen2_vl/image_processing_qwen2_vl_fast.py,sha256=eMRR6c4VYTSRkol54beN8C28aKujd_Liu0ZNesL3GqA,10537 +transformers/models/qwen2_vl/modeling_qwen2_vl.py,sha256=0V8QM8tKMQSF6mFlsKdyst_1d_3Y1zG-E-O3GYScVew,77859 +transformers/models/qwen2_vl/processing_qwen2_vl.py,sha256=YX9kGm9BHHWGI_5sBm7SMk3B_p_kIa15Xhx_moLtNR4,9518 +transformers/models/qwen2_vl/video_processing_qwen2_vl.py,sha256=q-40Qr6MsTnwIdKOmlFUXE_xVkh1o3PGfkaQ5xmkgmo,14498 +transformers/models/qwen3/__init__.py,sha256=5JU8uO9x0AmJ-YjY36MxtbMKT_B38dLJkrnAwLyjcTY,1014 +transformers/models/qwen3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen3/__pycache__/configuration_qwen3.cpython-312.pyc,, +transformers/models/qwen3/__pycache__/modeling_qwen3.cpython-312.pyc,, +transformers/models/qwen3/__pycache__/modular_qwen3.cpython-312.pyc,, +transformers/models/qwen3/configuration_qwen3.py,sha256=jvtlu5R7rBkV7djI2db4zjsDAdcgaw8XRtKDKWXIjjE,9435 +transformers/models/qwen3/modeling_qwen3.py,sha256=eX-GARYlsglHU2J-k6k2kHG7ZUbyZUfaibt4yaDsozg,24094 +transformers/models/qwen3/modular_qwen3.py,sha256=EgFgo1qFvjdPERJTZI5w1V_AKWUuW_eT4TsGKCcwSBc,5965 +transformers/models/qwen3_5/__init__.py,sha256=4da9M8C_zn94Li0Yb4S8wOQvgmDqyFwQ0Wu3gIZlobU,1035 +transformers/models/qwen3_5/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen3_5/__pycache__/configuration_qwen3_5.cpython-312.pyc,, +transformers/models/qwen3_5/__pycache__/modeling_qwen3_5.cpython-312.pyc,, +transformers/models/qwen3_5/__pycache__/modular_qwen3_5.cpython-312.pyc,, +transformers/models/qwen3_5/__pycache__/tokenization_qwen3_5.cpython-312.pyc,, +transformers/models/qwen3_5/configuration_qwen3_5.py,sha256=IoDG5r2dZtcoEVUkP2fPX-0nVqgor0ExZWav5hH_FsA,14576 +transformers/models/qwen3_5/modeling_qwen3_5.py,sha256=0a44VvU3Y1kexlBUEpr0bgA6FxXvz37vK3UqMehVJrg,97339 +transformers/models/qwen3_5/modular_qwen3_5.py,sha256=K6ZBkE6xLkGZtHApKjqmzLd7i_J2UvYl9c_y1D38yLI,33253 +transformers/models/qwen3_5/tokenization_qwen3_5.py,sha256=PS-Yq8HG7sYeRUgXEoa4j16Bc6xtY5VLj9Ilt-JM8lo,3127 +transformers/models/qwen3_5_moe/__init__.py,sha256=u611HCFpy5zFLNE9U0Ae0BcaT5gOja1Iw_b7M57Ksw0,1003 +transformers/models/qwen3_5_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen3_5_moe/__pycache__/configuration_qwen3_5_moe.cpython-312.pyc,, +transformers/models/qwen3_5_moe/__pycache__/modeling_qwen3_5_moe.cpython-312.pyc,, +transformers/models/qwen3_5_moe/__pycache__/modular_qwen3_5_moe.cpython-312.pyc,, +transformers/models/qwen3_5_moe/configuration_qwen3_5_moe.py,sha256=tjMSkdaY1DKd7yEeTpAs2csW6lNnAe_z1pww3sVkZfQ,16073 +transformers/models/qwen3_5_moe/modeling_qwen3_5_moe.py,sha256=swAaty293OJoIHpXcTZeCZYVBeXp_QkiRPoX02L1faU,107979 +transformers/models/qwen3_5_moe/modular_qwen3_5_moe.py,sha256=l02S4XR1oG8zpXXK_8ZbXp0_EXudNl_A4khRvsS3s3M,19236 +transformers/models/qwen3_moe/__init__.py,sha256=q5WfIniJecmOju3Lhy277H3Puu7viwc9vUhUWen3UZY,999 +transformers/models/qwen3_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen3_moe/__pycache__/configuration_qwen3_moe.cpython-312.pyc,, +transformers/models/qwen3_moe/__pycache__/modeling_qwen3_moe.cpython-312.pyc,, +transformers/models/qwen3_moe/__pycache__/modular_qwen3_moe.cpython-312.pyc,, +transformers/models/qwen3_moe/configuration_qwen3_moe.py,sha256=Und2K4DCpeYVitrnyAaYn2HYBJr3J4IX_y7FqAgz_G0,10579 +transformers/models/qwen3_moe/modeling_qwen3_moe.py,sha256=VmCRQp9DYvgbW8Usuzs6BmA7TuizVEb_AIeysCvgLtA,32741 +transformers/models/qwen3_moe/modular_qwen3_moe.py,sha256=ps6IJBxroHwVqBClJx70vozfErWrllo5-EuKD1Naz1o,7377 +transformers/models/qwen3_next/__init__.py,sha256=PuPvF5xcEfBxUKjqiZaWCiHeDeKuTmNdfuI6wvb-cbI,1001 +transformers/models/qwen3_next/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen3_next/__pycache__/configuration_qwen3_next.cpython-312.pyc,, +transformers/models/qwen3_next/__pycache__/modeling_qwen3_next.cpython-312.pyc,, +transformers/models/qwen3_next/__pycache__/modular_qwen3_next.cpython-312.pyc,, +transformers/models/qwen3_next/configuration_qwen3_next.py,sha256=PL80IGw21jHxM2_vodB25gACiRXWdOCgja2CjmeZYoM,12417 +transformers/models/qwen3_next/modeling_qwen3_next.py,sha256=pzmNCAS6B7R4NPW2rFPtMjnNY8g8eWAgWoSoYKKZJ4Y,56855 +transformers/models/qwen3_next/modular_qwen3_next.py,sha256=JrYP_R2yx9UBJJAY9rUMohrx6GzNgZYb0NbCS5_TKnc,38412 +transformers/models/qwen3_omni_moe/__init__.py,sha256=6xE3okskjamaUt4t3k8qJeJWbTPvLH7MfEjmtKtCC3I,1077 +transformers/models/qwen3_omni_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen3_omni_moe/__pycache__/configuration_qwen3_omni_moe.cpython-312.pyc,, +transformers/models/qwen3_omni_moe/__pycache__/modeling_qwen3_omni_moe.cpython-312.pyc,, +transformers/models/qwen3_omni_moe/__pycache__/modular_qwen3_omni_moe.cpython-312.pyc,, +transformers/models/qwen3_omni_moe/__pycache__/processing_qwen3_omni_moe.cpython-312.pyc,, +transformers/models/qwen3_omni_moe/configuration_qwen3_omni_moe.py,sha256=zjG3tphRwbWbKS2wskvON9OvR6vYtuO0rIIG5a20Ga4,58153 +transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py,sha256=C26abp2IgU3j4lscplxJ0Gd75zMbgRi2oM0CLGwd0nA,183406 +transformers/models/qwen3_omni_moe/modular_qwen3_omni_moe.py,sha256=VWAyT5Dp032mND7uyQxUWeChExxTq9yXAlHVfAvZ1L8,131604 +transformers/models/qwen3_omni_moe/processing_qwen3_omni_moe.py,sha256=rjbWUIMcVVsNL3UbCqa1jurJ0YCehfxiPExHQ4LHr0c,19063 +transformers/models/qwen3_vl/__init__.py,sha256=abVaeHwwKgL-3gVI3c5PSZfroZlU4TxEKXweDd75BXQ,1104 +transformers/models/qwen3_vl/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen3_vl/__pycache__/configuration_qwen3_vl.cpython-312.pyc,, +transformers/models/qwen3_vl/__pycache__/modeling_qwen3_vl.cpython-312.pyc,, +transformers/models/qwen3_vl/__pycache__/modular_qwen3_vl.cpython-312.pyc,, +transformers/models/qwen3_vl/__pycache__/processing_qwen3_vl.cpython-312.pyc,, +transformers/models/qwen3_vl/__pycache__/video_processing_qwen3_vl.cpython-312.pyc,, +transformers/models/qwen3_vl/configuration_qwen3_vl.py,sha256=jDvWjnIV8COEnVucJnIK2pRroXlcHiKp8xnzPjnVtEM,12369 +transformers/models/qwen3_vl/modeling_qwen3_vl.py,sha256=HMp53pC41_diFgOIwYTJW4CorToY4w-0MRx7exbtDkw,76577 +transformers/models/qwen3_vl/modular_qwen3_vl.py,sha256=ARo3SWcp1g_q5u-8NnF_bFG8rQbfzzA9BnIgoPq-WHg,69266 +transformers/models/qwen3_vl/processing_qwen3_vl.py,sha256=GalMBIKTFh-mM2LuNmDnPFp3wNw85YcWl6NGgnoczUE,13682 +transformers/models/qwen3_vl/video_processing_qwen3_vl.py,sha256=oy8h1ZpPNj3PJFFqW1_DtnY8j_k7A6_OQ1-upVhiPhA,11289 +transformers/models/qwen3_vl_moe/__init__.py,sha256=kZX59YLK-ZPItl-fKkUko_3uNM_QthuwE-rfzurn9iY,1028 +transformers/models/qwen3_vl_moe/__pycache__/__init__.cpython-312.pyc,, +transformers/models/qwen3_vl_moe/__pycache__/configuration_qwen3_vl_moe.cpython-312.pyc,, +transformers/models/qwen3_vl_moe/__pycache__/modeling_qwen3_vl_moe.cpython-312.pyc,, +transformers/models/qwen3_vl_moe/__pycache__/modular_qwen3_vl_moe.cpython-312.pyc,, +transformers/models/qwen3_vl_moe/configuration_qwen3_vl_moe.py,sha256=O8zBJf9DtTP3LtOn5kH65DGN8Lgn1MhfVd4gu-TbXm4,14433 +transformers/models/qwen3_vl_moe/modeling_qwen3_vl_moe.py,sha256=NFfU3OAvp1QQI_XFzXv7So-emDBZvhyPqsaQx2Cnhk0,86423 +transformers/models/qwen3_vl_moe/modular_qwen3_vl_moe.py,sha256=95Ly2S3jLwOvSOiVg33DIBNIdDGjUEm_0vWSMygxQ-A,25179 +transformers/models/rag/__init__.py,sha256=IRUxwdcZdE-6fRnJUhqgl8bB_Iu2XaHUa2qDvdK8zMQ,1056 +transformers/models/rag/__pycache__/__init__.cpython-312.pyc,, +transformers/models/rag/__pycache__/configuration_rag.cpython-312.pyc,, +transformers/models/rag/__pycache__/modeling_rag.cpython-312.pyc,, +transformers/models/rag/__pycache__/retrieval_rag.cpython-312.pyc,, +transformers/models/rag/__pycache__/tokenization_rag.cpython-312.pyc,, +transformers/models/rag/configuration_rag.py,sha256=MORbrWKZlOSld-y3j2K8BetHRmMbJx64SgiChachptQ,8104 +transformers/models/rag/modeling_rag.py,sha256=1MFgtqsnTKlbRJJddrPYhOiCpF228u7EwtCmwqBI9dg,88599 +transformers/models/rag/retrieval_rag.py,sha256=xp-ymlC7bEVcEF5qx6KSpcaadliHxFNhqQptTs81lfk,29948 +transformers/models/rag/tokenization_rag.py,sha256=tboHOP0AiAEM2O6S4Cjs-mGRn54z29D9ijWCGLXqF6E,2784 +transformers/models/recurrent_gemma/__init__.py,sha256=i86Cydx-eAdwsVMjNc0yG9hGxe_amyfAdvF5Eg-UCGM,1011 +transformers/models/recurrent_gemma/__pycache__/__init__.cpython-312.pyc,, +transformers/models/recurrent_gemma/__pycache__/configuration_recurrent_gemma.cpython-312.pyc,, +transformers/models/recurrent_gemma/__pycache__/modeling_recurrent_gemma.cpython-312.pyc,, +transformers/models/recurrent_gemma/configuration_recurrent_gemma.py,sha256=kua-Dd-SliFJGeQEQjB73Wthalhrm_qTeY_zPX2EjSw,8391 +transformers/models/recurrent_gemma/modeling_recurrent_gemma.py,sha256=b23vw6BpOdHd1N2UIsOn6tIXo8ztRnSw9eGbsv9b6tc,38538 +transformers/models/reformer/__init__.py,sha256=hJ-mLQGtig9HdVaq2HBnpc5qAhWb4OBfjdidb55QBrY,1038 +transformers/models/reformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/reformer/__pycache__/configuration_reformer.cpython-312.pyc,, +transformers/models/reformer/__pycache__/modeling_reformer.cpython-312.pyc,, +transformers/models/reformer/__pycache__/tokenization_reformer.cpython-312.pyc,, +transformers/models/reformer/configuration_reformer.py,sha256=Uybcqdvz1JswZttlMa15U0DhD_1GnuiZAJl2ddPDz-8,13234 +transformers/models/reformer/modeling_reformer.py,sha256=5Row18RxM4dIfXOZQLsBqV0uSMtYpfuj6omJwqWFUPA,113364 +transformers/models/reformer/tokenization_reformer.py,sha256=g6bo2LZyKT4AeXYbsaewTAj5gP4IXhGu2vkOXNNTPnw,4219 +transformers/models/regnet/__init__.py,sha256=ycvH_P4FO9zOsxgrXAXAHtK7FXQCjUJz6EgwLH4JD9c,993 +transformers/models/regnet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/regnet/__pycache__/configuration_regnet.cpython-312.pyc,, +transformers/models/regnet/__pycache__/modeling_regnet.cpython-312.pyc,, +transformers/models/regnet/configuration_regnet.py,sha256=AEk3PMRU_EsDVRiZLybS7tz9ZIrmAxqAifDSl4Z45fk,3959 +transformers/models/regnet/modeling_regnet.py,sha256=mE8VfiUOeMNhEbAKvNMPyIjT3Xwi2j3fiZxt7Ps-Fg0,14335 +transformers/models/rembert/__init__.py,sha256=2-jjTgRWHbTKw873X9XGzooYrv9BlSSIvz7GcemXGbw,1035 +transformers/models/rembert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/rembert/__pycache__/configuration_rembert.cpython-312.pyc,, +transformers/models/rembert/__pycache__/modeling_rembert.cpython-312.pyc,, +transformers/models/rembert/__pycache__/tokenization_rembert.cpython-312.pyc,, +transformers/models/rembert/configuration_rembert.py,sha256=AWGlY2ppaWHmgRqWAMbNBwiHsqaSwh6NEPn3k2sohys,6731 +transformers/models/rembert/modeling_rembert.py,sha256=om5B6FnfDBYwy3VN4IqaUxRQY7Hx0QaD7I92X5hlM0I,49164 +transformers/models/rembert/tokenization_rembert.py,sha256=KvTdia7SYOJ2yaOueM2y7oQdF3BSkD_SXTambhzVYb4,7808 +transformers/models/resnet/__init__.py,sha256=fvRmAOL_0o36oByTYgw9MmHL4wB20CHQ7h68S5fDazs,993 +transformers/models/resnet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/resnet/__pycache__/configuration_resnet.cpython-312.pyc,, +transformers/models/resnet/__pycache__/modeling_resnet.cpython-312.pyc,, +transformers/models/resnet/configuration_resnet.py,sha256=8GTNIode9_TMXVIOuvi4XRtv2dRUsHLUOs22JRJP6w8,5359 +transformers/models/resnet/modeling_resnet.py,sha256=VF54FvzljMw4Q6l2TdaFvRBvD8Zc3UCDjgaCLai0gX4,16569 +transformers/models/roberta/__init__.py,sha256=L5plEsZ85q9ufY9TKiQoW0V0xzGOJ12WVI2dFHicq-k,1035 +transformers/models/roberta/__pycache__/__init__.cpython-312.pyc,, +transformers/models/roberta/__pycache__/configuration_roberta.cpython-312.pyc,, +transformers/models/roberta/__pycache__/modeling_roberta.cpython-312.pyc,, +transformers/models/roberta/__pycache__/modular_roberta.cpython-312.pyc,, +transformers/models/roberta/__pycache__/tokenization_roberta.cpython-312.pyc,, +transformers/models/roberta/__pycache__/tokenization_roberta_old.cpython-312.pyc,, +transformers/models/roberta/configuration_roberta.py,sha256=QS8iP1mb17wSv3mBvqbmQ7tVaBqcmbcsJgi4Wd-lU-4,6196 +transformers/models/roberta/modeling_roberta.py,sha256=_og5zyUgzoXNOWPN0DNKOiUSEBOisFFsQiw-cEyWj2w,54685 +transformers/models/roberta/modular_roberta.py,sha256=A-7fLxwAkh8At_lTN7exZR56ujRJm6D6MnMm9Y5MHSk,31676 +transformers/models/roberta/tokenization_roberta.py,sha256=Y5CLVBJtUu7rSugjxvMsSb3B48GkPALEt0fjh1UW-aE,7378 +transformers/models/roberta/tokenization_roberta_old.py,sha256=0-oEwTRx5FxsyVcHmVeofxJpmzNU8qCJTKgwl23uMMg,10935 +transformers/models/roberta_prelayernorm/__init__.py,sha256=oZ3DNaebEY7KXvSEjkOGdDGHzqbtrqk0efDZ-sM3W2k,1021 +transformers/models/roberta_prelayernorm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/roberta_prelayernorm/__pycache__/configuration_roberta_prelayernorm.cpython-312.pyc,, +transformers/models/roberta_prelayernorm/__pycache__/modeling_roberta_prelayernorm.cpython-312.pyc,, +transformers/models/roberta_prelayernorm/configuration_roberta_prelayernorm.py,sha256=Mu6vMqvfsrkzkVVQRhg1jvGY9cL8XP_84J_7iADO-Es,6592 +transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py,sha256=kC81nzYjYyhvc4l_tm_9pUK6vaIYpQb1FYsqzof3Dc8,58397 +transformers/models/roc_bert/__init__.py,sha256=4CveMGU-dY3nV4E6x-Xpb1jicRniwrPuSOrY8-SHIUI,1038 +transformers/models/roc_bert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/roc_bert/__pycache__/configuration_roc_bert.cpython-312.pyc,, +transformers/models/roc_bert/__pycache__/modeling_roc_bert.cpython-312.pyc,, +transformers/models/roc_bert/__pycache__/tokenization_roc_bert.cpython-312.pyc,, +transformers/models/roc_bert/configuration_roc_bert.py,sha256=4S8CwXCuZf2OKPBqBbRXTW6T2L7Hr0wOm-kUlnDL1d0,8020 +transformers/models/roc_bert/modeling_roc_bert.py,sha256=PJPpZZ81w-fMQKsYtNyh0xiBychRWV9seN9el0gqXKo,74653 +transformers/models/roc_bert/tokenization_roc_bert.py,sha256=HGUL8avso6HH4kiyVYhQ33L2f2k2_2Pmggi0-f4G1sk,58670 +transformers/models/roformer/__init__.py,sha256=ujlqcOUcpfg7P3ICGkMw00Dv8Z7wldj-8ctGf8zmk4A,1084 +transformers/models/roformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/roformer/__pycache__/configuration_roformer.cpython-312.pyc,, +transformers/models/roformer/__pycache__/modeling_roformer.cpython-312.pyc,, +transformers/models/roformer/__pycache__/tokenization_roformer.cpython-312.pyc,, +transformers/models/roformer/__pycache__/tokenization_utils.cpython-312.pyc,, +transformers/models/roformer/configuration_roformer.py,sha256=tpWq5-eL-Zx0rf1foHH9VLbbHWM9FmHXhUN1FrMAKIw,6517 +transformers/models/roformer/modeling_roformer.py,sha256=-qtEaFM3AKMverCrFmkcxeSoW97AvK3Et3lDYnSwglM,56671 +transformers/models/roformer/tokenization_roformer.py,sha256=OP7Z4HNkVPShy7llQuwDHfqyZTGshBo0IhwGZPlgyr8,6246 +transformers/models/roformer/tokenization_utils.py,sha256=n5oqaXLHh85OA7sRbcQ9VBYxQEV4Syy8l72Hy7gz0aU,2610 +transformers/models/rt_detr/__init__.py,sha256=c9Y3NeKQwBP46tyFF99kjqTngoIWhLMq7XvzEJOfLaY,1181 +transformers/models/rt_detr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/rt_detr/__pycache__/configuration_rt_detr.cpython-312.pyc,, +transformers/models/rt_detr/__pycache__/configuration_rt_detr_resnet.cpython-312.pyc,, +transformers/models/rt_detr/__pycache__/image_processing_rt_detr.cpython-312.pyc,, +transformers/models/rt_detr/__pycache__/image_processing_rt_detr_fast.cpython-312.pyc,, +transformers/models/rt_detr/__pycache__/modeling_rt_detr.cpython-312.pyc,, +transformers/models/rt_detr/__pycache__/modeling_rt_detr_resnet.cpython-312.pyc,, +transformers/models/rt_detr/__pycache__/modular_rt_detr.cpython-312.pyc,, +transformers/models/rt_detr/configuration_rt_detr.py,sha256=b66skTfWTj4HehMeQ7veT-MBpNhQnNA4cKKgJ-6w8jU,15071 +transformers/models/rt_detr/configuration_rt_detr_resnet.py,sha256=UWqeor5AVhUMR0F9uiZHfazsQ6fanG7nh0cNOD9KYrs,5397 +transformers/models/rt_detr/image_processing_rt_detr.py,sha256=rmuOPoU1ZwW1vChsXq6GddJCaCFkba3t238axnmViVA,49676 +transformers/models/rt_detr/image_processing_rt_detr_fast.py,sha256=k1zDPKROmDwThyVbcvBjsoJbiVutPIll8u2Mu51uuUI,23047 +transformers/models/rt_detr/modeling_rt_detr.py,sha256=HyDs9DS5YU5fTcuRXQT5pw1v0zkGf1vv3VMY66YOe-A,84622 +transformers/models/rt_detr/modeling_rt_detr_resnet.py,sha256=sNRvE5Q7IzLGRFA6RIh7zqmNu0NPdoU4J6z-o0lNPFs,15487 +transformers/models/rt_detr/modular_rt_detr.py,sha256=UuBEYOmqoeEXQXHmdcnZQB4QK_GTg-h0KLdBGOHiCPQ,84141 +transformers/models/rt_detr_v2/__init__.py,sha256=7RL5U-hsGt3HQZ5SuWn8iZY_L166EYswBvaQXFRkzRc,1003 +transformers/models/rt_detr_v2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/rt_detr_v2/__pycache__/configuration_rt_detr_v2.cpython-312.pyc,, +transformers/models/rt_detr_v2/__pycache__/modeling_rt_detr_v2.cpython-312.pyc,, +transformers/models/rt_detr_v2/__pycache__/modular_rt_detr_v2.cpython-312.pyc,, +transformers/models/rt_detr_v2/configuration_rt_detr_v2.py,sha256=le_3yRe5CS4H9V2LASKq2STQj2QpYIDKL80lA9BIa-w,16657 +transformers/models/rt_detr_v2/modeling_rt_detr_v2.py,sha256=Ban2-JhRLJNX2gYwBJnWbkSzMAvgQAZ3yzVOd0uOa3Q,86707 +transformers/models/rt_detr_v2/modular_rt_detr_v2.py,sha256=UY30z2zFrKtFJ8LZXvyJuh_u-EL3m61STHhygQ_tsMk,27165 +transformers/models/rwkv/__init__.py,sha256=HAiwEvW1j_xuHj_PbmN25srY9RtA1gLmN_0RWvAyG78,989 +transformers/models/rwkv/__pycache__/__init__.cpython-312.pyc,, +transformers/models/rwkv/__pycache__/configuration_rwkv.cpython-312.pyc,, +transformers/models/rwkv/__pycache__/modeling_rwkv.cpython-312.pyc,, +transformers/models/rwkv/configuration_rwkv.py,sha256=oCueGonvMH-ECnQZQu-8GbAymz_UQx_eXnQ6eu0yOsQ,5127 +transformers/models/rwkv/modeling_rwkv.py,sha256=vD1zAx8kHirX-c0hQubEqpgJa8C0NER9E1DoFoBtN_o,32129 +transformers/models/sam/__init__.py,sha256=piwSVkUVVyFvPUuusA3QYxDGIwYo9KmztKxhwJ8oVCM,1106 +transformers/models/sam/__pycache__/__init__.cpython-312.pyc,, +transformers/models/sam/__pycache__/configuration_sam.cpython-312.pyc,, +transformers/models/sam/__pycache__/image_processing_sam.cpython-312.pyc,, +transformers/models/sam/__pycache__/image_processing_sam_fast.cpython-312.pyc,, +transformers/models/sam/__pycache__/modeling_sam.cpython-312.pyc,, +transformers/models/sam/__pycache__/processing_sam.cpython-312.pyc,, +transformers/models/sam/configuration_sam.py,sha256=wVQstISbdgjAjTBGZC6LeZqCJSBOJB-4EnrfJq__AHU,14833 +transformers/models/sam/image_processing_sam.py,sha256=ikmW7oIAg1W0iYXeyNulwnrKYNor7xXQLde-kD5Am8Y,54438 +transformers/models/sam/image_processing_sam_fast.py,sha256=cePFZ-aS3d_TnAbrSxv4Lp7KYqKkNtjysZV-OEJ8D4U,33122 +transformers/models/sam/modeling_sam.py,sha256=AxHdyt9zC2dwEfMorgmcCOsfON6-K5sdIMB5NWJtlqg,61321 +transformers/models/sam/processing_sam.py,sha256=hH49ghIKhju1NnWo0aq32kzktpUvcBu_5BA6_6oqMh4,12559 +transformers/models/sam2/__init__.py,sha256=H7LrRCnUmUZ9fj5C_p_Mp8xNB5Zdtoo1S__LcYcs_i4,1070 +transformers/models/sam2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/sam2/__pycache__/configuration_sam2.cpython-312.pyc,, +transformers/models/sam2/__pycache__/image_processing_sam2_fast.cpython-312.pyc,, +transformers/models/sam2/__pycache__/modeling_sam2.cpython-312.pyc,, +transformers/models/sam2/__pycache__/modular_sam2.cpython-312.pyc,, +transformers/models/sam2/__pycache__/processing_sam2.cpython-312.pyc,, +transformers/models/sam2/configuration_sam2.py,sha256=Zq2JvDJnTsn22P1Za_ZfOSPkmqYfSMs7yY4uplwjpWw,20937 +transformers/models/sam2/image_processing_sam2_fast.py,sha256=9hSRtetQTGa0vF2mdYwcxqKylnBZq-23nrn2xLzpwh0,30440 +transformers/models/sam2/modeling_sam2.py,sha256=zkUGQ5NgA4kbt8BEB4lD9aIb6cEpuvF1gSa6uaTPrpk,72391 +transformers/models/sam2/modular_sam2.py,sha256=4Zix1mYXn6ZenS5-h6J6SnrSvz54b2epWC0rqQu5nBY,64708 +transformers/models/sam2/processing_sam2.py,sha256=3B53-zcWIYe6X19WZDxx2-HQuJxEHJSXdmzUZjX35hs,22411 +transformers/models/sam2_video/__init__.py,sha256=WFP70wbKsoPQuuR0Aq6sMpFZ9m2cQJwNgdCpngg4C1o,1089 +transformers/models/sam2_video/__pycache__/__init__.cpython-312.pyc,, +transformers/models/sam2_video/__pycache__/configuration_sam2_video.cpython-312.pyc,, +transformers/models/sam2_video/__pycache__/modeling_sam2_video.cpython-312.pyc,, +transformers/models/sam2_video/__pycache__/modular_sam2_video.cpython-312.pyc,, +transformers/models/sam2_video/__pycache__/processing_sam2_video.cpython-312.pyc,, +transformers/models/sam2_video/__pycache__/video_processing_sam2_video.cpython-312.pyc,, +transformers/models/sam2_video/configuration_sam2_video.py,sha256=-RbxxjiFG64YWo2WVU86QkGm4PjZNtr5-MQGo-u_6N4,20735 +transformers/models/sam2_video/modeling_sam2_video.py,sha256=fe46o-EGp7AMHwhES-YllecDKy1nyIPJbRrbQtvPx0g,133217 +transformers/models/sam2_video/modular_sam2_video.py,sha256=pThB_DqbK9jo1pres2lXfwM5l6k7urlDdbQERXFgfa4,124707 +transformers/models/sam2_video/processing_sam2_video.py,sha256=87Qw8x3OL9lhAKAz85q4RhbipVuZfSBzKQokDpZJzXQ,37447 +transformers/models/sam2_video/video_processing_sam2_video.py,sha256=TZt4Yd149iJBA2wXH8IqkxHEATRZJAom5bE2UxY-0MQ,4868 +transformers/models/sam3/__init__.py,sha256=sHbyLDFgub6Y90Saw8bbz2UQhMDMMTgg8Ko7FbhsZuQ,1024 +transformers/models/sam3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/sam3/__pycache__/configuration_sam3.cpython-312.pyc,, +transformers/models/sam3/__pycache__/image_processing_sam3_fast.cpython-312.pyc,, +transformers/models/sam3/__pycache__/modeling_sam3.cpython-312.pyc,, +transformers/models/sam3/__pycache__/modular_sam3.cpython-312.pyc,, +transformers/models/sam3/__pycache__/processing_sam3.cpython-312.pyc,, +transformers/models/sam3/configuration_sam3.py,sha256=2ocwbfmnQlMWkS9jzbiOD7KcWB-Qp4C8AzChGwMUHNc,21262 +transformers/models/sam3/image_processing_sam3_fast.py,sha256=LghEP1DwcgGe-8l2HuRKw3nKST-04gPeQ7yei3a9Jf4,40707 +transformers/models/sam3/modeling_sam3.py,sha256=yuIK9LRpBQ45HkIbHTBHEX_kpOtEfCcqPT7pMm0vm5s,101596 +transformers/models/sam3/modular_sam3.py,sha256=Yg-pc7YbE7MYhJMVx8LtjkaqIGtR7cJnCTX_Kte2zb8,11324 +transformers/models/sam3/processing_sam3.py,sha256=bt2IvjgXKdN_1tTr7Wq8hNDzMn8NIQjD_bFGtPE199Q,27873 +transformers/models/sam3_tracker/__init__.py,sha256=TPRKgIS2Z6Wq8WTVACG7_2akZcTNqFNnBYeDOjZF2Aw,1049 +transformers/models/sam3_tracker/__pycache__/__init__.cpython-312.pyc,, +transformers/models/sam3_tracker/__pycache__/configuration_sam3_tracker.cpython-312.pyc,, +transformers/models/sam3_tracker/__pycache__/modeling_sam3_tracker.cpython-312.pyc,, +transformers/models/sam3_tracker/__pycache__/modular_sam3_tracker.cpython-312.pyc,, +transformers/models/sam3_tracker/__pycache__/processing_sam3_tracker.cpython-312.pyc,, +transformers/models/sam3_tracker/configuration_sam3_tracker.py,sha256=4wz8a8vXFRbt70loH1Fn0Vhg1Flw9tzaQCVtSDt4PFQ,11637 +transformers/models/sam3_tracker/modeling_sam3_tracker.py,sha256=SEdJkRelna_VqnyBTLMWZnswkzj0YBbeZVXpAkc0Zic,53767 +transformers/models/sam3_tracker/modular_sam3_tracker.py,sha256=TBR0p2VHKQbBKQo_CNQIyq1mYlcEMM712HBuT2eXZKk,10998 +transformers/models/sam3_tracker/processing_sam3_tracker.py,sha256=Q9uNPR1hyuQiiH4Axssmxyxhgzg6v8RGucQrD-wzZ7U,23143 +transformers/models/sam3_tracker_video/__init__.py,sha256=WEogj5NnwI_O925jgVstv_dAiSqHq1pPTmkWWxGzOiY,1067 +transformers/models/sam3_tracker_video/__pycache__/__init__.cpython-312.pyc,, +transformers/models/sam3_tracker_video/__pycache__/configuration_sam3_tracker_video.cpython-312.pyc,, +transformers/models/sam3_tracker_video/__pycache__/modeling_sam3_tracker_video.cpython-312.pyc,, +transformers/models/sam3_tracker_video/__pycache__/modular_sam3_tracker_video.cpython-312.pyc,, +transformers/models/sam3_tracker_video/__pycache__/processing_sam3_tracker_video.cpython-312.pyc,, +transformers/models/sam3_tracker_video/configuration_sam3_tracker_video.py,sha256=BCdBzwn4DehMjzx9P83IBUmeRLa9AgALbe2oFm3VgzA,22170 +transformers/models/sam3_tracker_video/modeling_sam3_tracker_video.py,sha256=FpYkkmaciwBAqOzeUabkrkmWlg9QEeX8q4lNYt_Mbr0,134988 +transformers/models/sam3_tracker_video/modular_sam3_tracker_video.py,sha256=aXScrGYdOPdjKtnKYN13nru7scHfKSeQxZHSOwzb9xg,26543 +transformers/models/sam3_tracker_video/processing_sam3_tracker_video.py,sha256=4JC7q7aXLBr1kUdhPiAbVvxyR7Hs-oEm5dJ-9KDmaOo,37541 +transformers/models/sam3_video/__init__.py,sha256=-FBW7aAvRRXbmSCE0NRCcjbgaStvq1lgOn4h8-7ZbGE,1042 +transformers/models/sam3_video/__pycache__/__init__.cpython-312.pyc,, +transformers/models/sam3_video/__pycache__/configuration_sam3_video.cpython-312.pyc,, +transformers/models/sam3_video/__pycache__/modeling_sam3_video.cpython-312.pyc,, +transformers/models/sam3_video/__pycache__/processing_sam3_video.cpython-312.pyc,, +transformers/models/sam3_video/configuration_sam3_video.py,sha256=ossxhnLIUK6Iq5081wdtVssaKPhuAQjBgtQp1e_jDDI,12013 +transformers/models/sam3_video/modeling_sam3_video.py,sha256=0OiFw75ccDM2jofEXnRDwhFo4w7PPCJjkRPIcx8N22Y,92980 +transformers/models/sam3_video/processing_sam3_video.py,sha256=a_2l-7dBOGi0K7HD28AxC3FmGlUax8hY3xTnpxkvHsM,17653 +transformers/models/sam_hq/__init__.py,sha256=4B3IBWfFKvM9GThbmIj6Ig-KAUbOquWgv0RW3QvNjxM,1030 +transformers/models/sam_hq/__pycache__/__init__.cpython-312.pyc,, +transformers/models/sam_hq/__pycache__/configuration_sam_hq.cpython-312.pyc,, +transformers/models/sam_hq/__pycache__/modeling_sam_hq.cpython-312.pyc,, +transformers/models/sam_hq/__pycache__/modular_sam_hq.cpython-312.pyc,, +transformers/models/sam_hq/__pycache__/processing_sam_hq.cpython-312.pyc,, +transformers/models/sam_hq/configuration_sam_hq.py,sha256=W-pQEY4muyeJgRBApcRH-IGcYZuIrUrnRBSTfJkjiIM,14957 +transformers/models/sam_hq/modeling_sam_hq.py,sha256=0_pjsOZmC3EdUDFxV0S-JM03p0m2AQgN5NEJOpESASI,68936 +transformers/models/sam_hq/modular_sam_hq.py,sha256=Ayc0B4IkYlqBisDkLL6lb4Isf7nKN52Tjn9oBWvOzXw,31411 +transformers/models/sam_hq/processing_sam_hq.py,sha256=d3HkKI9FLzK7w9BIbXXU7-v6bRrcJuJb1c1kBSthARs,13391 +transformers/models/seamless_m4t/__init__.py,sha256=aGTGuFUq4FqWWVcwKaf0ehT4bQpECvqA5V0Tcrm1WtY,1144 +transformers/models/seamless_m4t/__pycache__/__init__.cpython-312.pyc,, +transformers/models/seamless_m4t/__pycache__/configuration_seamless_m4t.cpython-312.pyc,, +transformers/models/seamless_m4t/__pycache__/feature_extraction_seamless_m4t.cpython-312.pyc,, +transformers/models/seamless_m4t/__pycache__/modeling_seamless_m4t.cpython-312.pyc,, +transformers/models/seamless_m4t/__pycache__/processing_seamless_m4t.cpython-312.pyc,, +transformers/models/seamless_m4t/__pycache__/tokenization_seamless_m4t.cpython-312.pyc,, +transformers/models/seamless_m4t/configuration_seamless_m4t.py,sha256=cdziRk7bVWYtLRK_AQsXE9uvAvMhKMSO0Wc_EXkjBEo,23570 +transformers/models/seamless_m4t/feature_extraction_seamless_m4t.py,sha256=WivktIwNAFGVIITYRJ6Wm_vuU5zso8QHMrq1IWj3ItY,13477 +transformers/models/seamless_m4t/modeling_seamless_m4t.py,sha256=cE9d72QCI4m5Ri6yadC0FpsGZKM3PtrJkvSVpso41Xw,185858 +transformers/models/seamless_m4t/processing_seamless_m4t.py,sha256=S7sWW_Ce-nzRLlkziyqfZ3G8E6iw3yjSVfmsEOV9-NY,3119 +transformers/models/seamless_m4t/tokenization_seamless_m4t.py,sha256=abW0ypMlSxwi08aygOfipsvezAWAI0JSpzZriwGGusk,18201 +transformers/models/seamless_m4t_v2/__init__.py,sha256=mMY04PBMrOwTIQLq01RHqZjssvrSYl3UDhP5Y5vFifs,1011 +transformers/models/seamless_m4t_v2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/seamless_m4t_v2/__pycache__/configuration_seamless_m4t_v2.cpython-312.pyc,, +transformers/models/seamless_m4t_v2/__pycache__/modeling_seamless_m4t_v2.cpython-312.pyc,, +transformers/models/seamless_m4t_v2/configuration_seamless_m4t_v2.py,sha256=APw6nlgt9bbFoZmib1qhAAl2emvGMlVIJG3J2EPpOHE,24437 +transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py,sha256=CWcVKf_jMcWIM9XVCTmGMuXSMz1k4bbw1WkQjDTTeHk,203615 +transformers/models/seed_oss/__init__.py,sha256=ukqpfG-W3jFJvA9UiL5bI_2jl_CTZFynUL0Tq9WD63M,1025 +transformers/models/seed_oss/__pycache__/__init__.cpython-312.pyc,, +transformers/models/seed_oss/__pycache__/configuration_seed_oss.cpython-312.pyc,, +transformers/models/seed_oss/__pycache__/modeling_seed_oss.cpython-312.pyc,, +transformers/models/seed_oss/__pycache__/modular_seed_oss.cpython-312.pyc,, +transformers/models/seed_oss/configuration_seed_oss.py,sha256=lD6CXsMZcLufiIZliAsYO-EkuKCVmYzQbOFOWp_LfWo,9288 +transformers/models/seed_oss/modeling_seed_oss.py,sha256=ocGsDdC3CQ9gakGyToK0zVzL_LMDdLFC4VhVoX69J6M,23064 +transformers/models/seed_oss/modular_seed_oss.py,sha256=acPdowxks5362oPsZe2Qp_K4SWAzjaarUGKbxyvMx98,7493 +transformers/models/segformer/__init__.py,sha256=eE8wZP6VldFpYlnLQ_cNptaXwdK5-bDtlVlmSDL8_lA,1144 +transformers/models/segformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/segformer/__pycache__/configuration_segformer.cpython-312.pyc,, +transformers/models/segformer/__pycache__/image_processing_segformer.cpython-312.pyc,, +transformers/models/segformer/__pycache__/image_processing_segformer_fast.cpython-312.pyc,, +transformers/models/segformer/__pycache__/modeling_segformer.cpython-312.pyc,, +transformers/models/segformer/__pycache__/modular_segformer.cpython-312.pyc,, +transformers/models/segformer/configuration_segformer.py,sha256=Lapbj-S02yQRDsSuAIJWfsWXUcmp_7Dx0QvFZWxyaYM,6392 +transformers/models/segformer/image_processing_segformer.py,sha256=juerbcOkQrS2sJvi-EBO1QL07O754OAuQ9h71ahS9mw,22215 +transformers/models/segformer/image_processing_segformer_fast.py,sha256=YCoA1J9dlDrPEvVW9gffgbzoobwoVWOVamEKASaFQJg,9363 +transformers/models/segformer/modeling_segformer.py,sha256=IzIL49_DnPgMh2vaII1nXM7NC6RXEBRF6YnycyN66n0,28991 +transformers/models/segformer/modular_segformer.py,sha256=yzCXC7Dlmyrc3Zp_JmPRPtiusnXuQY-ePkwnLnQo0Xo,5636 +transformers/models/seggpt/__init__.py,sha256=RzV8DKCX1lOWGqXv2BlE1R7T4QuEcdYAVy_csccLvEw,1036 +transformers/models/seggpt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/seggpt/__pycache__/configuration_seggpt.cpython-312.pyc,, +transformers/models/seggpt/__pycache__/image_processing_seggpt.cpython-312.pyc,, +transformers/models/seggpt/__pycache__/modeling_seggpt.cpython-312.pyc,, +transformers/models/seggpt/configuration_seggpt.py,sha256=2YaJ3zkHkbISR7sdH5jML4yYNY4Ml8a-pDNoV9m6WKU,6477 +transformers/models/seggpt/image_processing_seggpt.py,sha256=4KQEdDiiNTGiaEeYyQ94DMYGbnKTWK5KPnsEi2BjvRo,30820 +transformers/models/seggpt/modeling_seggpt.py,sha256=0xPSDp_aQq2fl90dHFxMRjWYfd8vZD6U2PpjDOfWhh0,43402 +transformers/models/sew/__init__.py,sha256=POCF36ZRa_dr7oQhkDU2X17bsZuLoWI5V8DSihqr_vU,987 +transformers/models/sew/__pycache__/__init__.cpython-312.pyc,, +transformers/models/sew/__pycache__/configuration_sew.cpython-312.pyc,, +transformers/models/sew/__pycache__/modeling_sew.cpython-312.pyc,, +transformers/models/sew/__pycache__/modular_sew.cpython-312.pyc,, +transformers/models/sew/configuration_sew.py,sha256=cQWYOkXSHJn16vbN1if1tYc06dFX74DRcNbwlr-rEfc,14258 +transformers/models/sew/modeling_sew.py,sha256=uQmbKMMM5WPlk-QkMWFe-jB23Ynnb32lfd5EHoWDQyM,46258 +transformers/models/sew/modular_sew.py,sha256=jvJtKB3hWWUVXthqVyN6T3EayNL58eMAt7uFwVnWhjI,18366 +transformers/models/sew_d/__init__.py,sha256=zE9sw10e_a1d-8-Jsb75z5frCjkFGD0dZMHAXiNgGwk,991 +transformers/models/sew_d/__pycache__/__init__.cpython-312.pyc,, +transformers/models/sew_d/__pycache__/configuration_sew_d.cpython-312.pyc,, +transformers/models/sew_d/__pycache__/modeling_sew_d.cpython-312.pyc,, +transformers/models/sew_d/configuration_sew_d.py,sha256=37FIejX37vzb-ue4jTBBThMJscKBwzN9skAnkMk5pVs,16218 +transformers/models/sew_d/modeling_sew_d.py,sha256=YNVMZIOzRMm-j2GuwqPTPSLIzS9jb7yPnjYppehQXfY,67814 +transformers/models/shieldgemma2/__init__.py,sha256=B7eqFJSWi0p49QNvKqUGR8NPyFjQuMdBANevIjTsSxw,1048 +transformers/models/shieldgemma2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/shieldgemma2/__pycache__/configuration_shieldgemma2.cpython-312.pyc,, +transformers/models/shieldgemma2/__pycache__/modeling_shieldgemma2.cpython-312.pyc,, +transformers/models/shieldgemma2/__pycache__/processing_shieldgemma2.cpython-312.pyc,, +transformers/models/shieldgemma2/configuration_shieldgemma2.py,sha256=nQMUdufngEg6ggjk1EiFmdMSswo_bl79ubYIOiZSYiM,4790 +transformers/models/shieldgemma2/modeling_shieldgemma2.py,sha256=T--g5k0drCkyx7t8fOvNIZUaCbgsKFg5jYYfX3TPgaQ,5745 +transformers/models/shieldgemma2/processing_shieldgemma2.py,sha256=CIomoND_vEP_UIHYq8qiXVlftrDj6W8NEYql4S3554E,8432 +transformers/models/siglip/__init__.py,sha256=CnNqbSQ25tKLz0MGJVmhSXjVyASRDu7v5yjTHWYZ6M4,1160 +transformers/models/siglip/__pycache__/__init__.cpython-312.pyc,, +transformers/models/siglip/__pycache__/configuration_siglip.cpython-312.pyc,, +transformers/models/siglip/__pycache__/image_processing_siglip.cpython-312.pyc,, +transformers/models/siglip/__pycache__/image_processing_siglip_fast.cpython-312.pyc,, +transformers/models/siglip/__pycache__/modeling_siglip.cpython-312.pyc,, +transformers/models/siglip/__pycache__/processing_siglip.cpython-312.pyc,, +transformers/models/siglip/__pycache__/tokenization_siglip.cpython-312.pyc,, +transformers/models/siglip/configuration_siglip.py,sha256=rJUIBo2XZ_7Mi9MTN9lD16Uik3qfhoTWJ6HeIdDpZqI,11928 +transformers/models/siglip/image_processing_siglip.py,sha256=ET692vmQ5--PBUKciSU_A7mzY1WMPBL2YgFgL7mPHgo,11690 +transformers/models/siglip/image_processing_siglip_fast.py,sha256=TcuuuktjwSBXhPnjRkEhFydFlfB-5VhXB3Cgk07kjFk,1242 +transformers/models/siglip/modeling_siglip.py,sha256=foyedsMvEB7hJWJ87MnPGOOD7aRDV2u1o1nnme8Jf1o,38783 +transformers/models/siglip/processing_siglip.py,sha256=aOQ5MSoMpf_MFh1vt2truSm1Y0oFpHCSZX77G1oRUIc,915 +transformers/models/siglip/tokenization_siglip.py,sha256=CmnaWyjLTBJ5p5DnFcfNAGz9yQ119FPZ0jUc-4RE9Ho,14286 +transformers/models/siglip2/__init__.py,sha256=amD21WA9L0J-5pYBJuPdbekOq5RaFpKX5mq3IkKN7nE,1166 +transformers/models/siglip2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/siglip2/__pycache__/configuration_siglip2.cpython-312.pyc,, +transformers/models/siglip2/__pycache__/image_processing_siglip2.cpython-312.pyc,, +transformers/models/siglip2/__pycache__/image_processing_siglip2_fast.cpython-312.pyc,, +transformers/models/siglip2/__pycache__/modeling_siglip2.cpython-312.pyc,, +transformers/models/siglip2/__pycache__/modular_siglip2.cpython-312.pyc,, +transformers/models/siglip2/__pycache__/processing_siglip2.cpython-312.pyc,, +transformers/models/siglip2/__pycache__/tokenization_siglip2.cpython-312.pyc,, +transformers/models/siglip2/configuration_siglip2.py,sha256=NV0c1LVwB1fgM38_HpYYCbZfH_WaZWovhQlN6m95ltU,13052 +transformers/models/siglip2/image_processing_siglip2.py,sha256=nKfoXCYCjubtazBD4XsRWdaxSCd0W7fOY_Ki9yCZLls,16314 +transformers/models/siglip2/image_processing_siglip2_fast.py,sha256=uoCuFjoD6JwHk0RDhli4ny05s3TIH-wSMd8r0HBtMi0,5650 +transformers/models/siglip2/modeling_siglip2.py,sha256=Cr3CCUs7oeSvJX0__SapaEl0lpAkNkJ_CuxOlpSdCxA,45949 +transformers/models/siglip2/modular_siglip2.py,sha256=6_SmEJY1FcdZETJuH2E_zkWKBuqZd7OCfHOWsPm3Cv4,27559 +transformers/models/siglip2/processing_siglip2.py,sha256=JIEHRW0qhiZyc7jxo52jeIVyNhuCegfXPYN-aN-gxBk,1315 +transformers/models/siglip2/tokenization_siglip2.py,sha256=69skOMcmgJD0m5MWYFrKC3d8WPcM3wU4-px6dut0zMI,3750 +transformers/models/smollm3/__init__.py,sha256=BZA2MiDpGmv2swg1yO14tkgi_SZ0yVg8ndr-PJwY-fI,1000 +transformers/models/smollm3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/smollm3/__pycache__/configuration_smollm3.cpython-312.pyc,, +transformers/models/smollm3/__pycache__/modeling_smollm3.cpython-312.pyc,, +transformers/models/smollm3/__pycache__/modular_smollm3.cpython-312.pyc,, +transformers/models/smollm3/configuration_smollm3.py,sha256=kEq26TJk8occ-prslZWkzQLXPmDtysBMEbXFsvwTD5s,10686 +transformers/models/smollm3/modeling_smollm3.py,sha256=t0IcBDfgmfLT09PzT0HaA2ytbcP1QHRbsn69Etr7JMM,23481 +transformers/models/smollm3/modular_smollm3.py,sha256=wiI53MmZXi4jKPqru7vYLrs1tTh0unj2ajTgl5tKtDQ,13617 +transformers/models/smolvlm/__init__.py,sha256=fE-znTLrbxNe5qkHVgI4xmwFz-paFymZuxTAd2GKkOo,1126 +transformers/models/smolvlm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/smolvlm/__pycache__/configuration_smolvlm.cpython-312.pyc,, +transformers/models/smolvlm/__pycache__/image_processing_smolvlm.cpython-312.pyc,, +transformers/models/smolvlm/__pycache__/image_processing_smolvlm_fast.cpython-312.pyc,, +transformers/models/smolvlm/__pycache__/modeling_smolvlm.cpython-312.pyc,, +transformers/models/smolvlm/__pycache__/modular_smolvlm.cpython-312.pyc,, +transformers/models/smolvlm/__pycache__/processing_smolvlm.cpython-312.pyc,, +transformers/models/smolvlm/__pycache__/video_processing_smolvlm.cpython-312.pyc,, +transformers/models/smolvlm/configuration_smolvlm.py,sha256=nFF2ntArNkX8aNtpH_zo-89_tG8E-N1rsuZkibV1S60,9233 +transformers/models/smolvlm/image_processing_smolvlm.py,sha256=0MoOYenoWEsoO_HAVBtp9BhTQ3WK31kN0NOdnmKwiK4,44693 +transformers/models/smolvlm/image_processing_smolvlm_fast.py,sha256=PLlFsjY1r_vR4u-ECWlgM0_O_GFeqawdIf1YljRjSjQ,23757 +transformers/models/smolvlm/modeling_smolvlm.py,sha256=Yd4JYkBZ4idmSH5KyMLrAy7u_c9LGf5JYrzC3lqpnd8,39761 +transformers/models/smolvlm/modular_smolvlm.py,sha256=zWv7SX5J3OAAEqcR7uMFNj3bqaDiMuXX9AAii5RRr1s,19479 +transformers/models/smolvlm/processing_smolvlm.py,sha256=rXRZZlbeM5NfRnJ-woJ9S_EWV1weSiMbDBFaL0SwOec,15692 +transformers/models/smolvlm/video_processing_smolvlm.py,sha256=pcG0gLb8PqlKhsOxkocVr3--szcgq46_M0bcWaQM7Tk,14695 +transformers/models/solar_open/__init__.py,sha256=_IuMoJHTvrxSNxcHGJe1QpLINdHuEUV7BeCLSQkzPgs,1001 +transformers/models/solar_open/__pycache__/__init__.cpython-312.pyc,, +transformers/models/solar_open/__pycache__/configuration_solar_open.cpython-312.pyc,, +transformers/models/solar_open/__pycache__/modeling_solar_open.cpython-312.pyc,, +transformers/models/solar_open/__pycache__/modular_solar_open.cpython-312.pyc,, +transformers/models/solar_open/configuration_solar_open.py,sha256=dKi-RP9xdkNW53a8zEzRxvM_I3YK-Ed6Kbu2eu3bhz0,9009 +transformers/models/solar_open/modeling_solar_open.py,sha256=-G5hyYdeNjnx9i7P5wR1F9tTdkkN3LBREkTZJ3zIjIs,28192 +transformers/models/solar_open/modular_solar_open.py,sha256=8RBDInB7N2D8CZZ-TC9FDd0kiabkagyK5MzhpHrFg1w,9019 +transformers/models/speech_encoder_decoder/__init__.py,sha256=YJ8Vz0n_ZDxYjI_2r-G3iRCoKQy58r8C1n4t2s42BSw,1025 +transformers/models/speech_encoder_decoder/__pycache__/__init__.cpython-312.pyc,, +transformers/models/speech_encoder_decoder/__pycache__/configuration_speech_encoder_decoder.cpython-312.pyc,, +transformers/models/speech_encoder_decoder/__pycache__/modeling_speech_encoder_decoder.cpython-312.pyc,, +transformers/models/speech_encoder_decoder/configuration_speech_encoder_decoder.py,sha256=SbTPozwtY1VUN2HqM69NpHUrvDHor7uF4UnB7xWSwlg,4678 +transformers/models/speech_encoder_decoder/modeling_speech_encoder_decoder.py,sha256=Ho1rUWNaNvc9N3wsbfHXOG9D1QXdyO93iyzr7IJn9kg,24600 +transformers/models/speech_to_text/__init__.py,sha256=HmMO19XDk0Inzvsd1Kgxdr7JYZMA1UrjEEqPT1f9ksI,1154 +transformers/models/speech_to_text/__pycache__/__init__.cpython-312.pyc,, +transformers/models/speech_to_text/__pycache__/configuration_speech_to_text.cpython-312.pyc,, +transformers/models/speech_to_text/__pycache__/feature_extraction_speech_to_text.cpython-312.pyc,, +transformers/models/speech_to_text/__pycache__/modeling_speech_to_text.cpython-312.pyc,, +transformers/models/speech_to_text/__pycache__/processing_speech_to_text.cpython-312.pyc,, +transformers/models/speech_to_text/__pycache__/tokenization_speech_to_text.cpython-312.pyc,, +transformers/models/speech_to_text/configuration_speech_to_text.py,sha256=a90toFpnPdWA6L7WDjj5dfdIf5rkcVRC0hnCyGwL5Jg,9987 +transformers/models/speech_to_text/feature_extraction_speech_to_text.py,sha256=-e_x4Qob2NkK8Uuy0H7szz9CxlwcZmCJLN7d_vemOXc,13798 +transformers/models/speech_to_text/modeling_speech_to_text.py,sha256=95OsvD0Q1lt1FZp8MHNpKoJlcT2eqBK4NEE1boC17QU,51389 +transformers/models/speech_to_text/processing_speech_to_text.py,sha256=EMa7GGoDf3TA-2Xec8TRiate7Lj22VIjmijDtmae-I0,1770 +transformers/models/speech_to_text/tokenization_speech_to_text.py,sha256=JZrzUriA7dZnQoHtJ81lODxqxbZprXT3qWht7mpqf5A,11455 +transformers/models/speecht5/__init__.py,sha256=DploRLnZX4ZO40Z7BstCZ7aNWGuZE06tIeMo0GTyR60,1124 +transformers/models/speecht5/__pycache__/__init__.cpython-312.pyc,, +transformers/models/speecht5/__pycache__/configuration_speecht5.cpython-312.pyc,, +transformers/models/speecht5/__pycache__/feature_extraction_speecht5.cpython-312.pyc,, +transformers/models/speecht5/__pycache__/modeling_speecht5.cpython-312.pyc,, +transformers/models/speecht5/__pycache__/number_normalizer.cpython-312.pyc,, +transformers/models/speecht5/__pycache__/processing_speecht5.cpython-312.pyc,, +transformers/models/speecht5/__pycache__/tokenization_speecht5.cpython-312.pyc,, +transformers/models/speecht5/configuration_speecht5.py,sha256=Yi-v_PX_QmYOjlqxHH1vNNzWYa3lesHQZ-pdGoOOunM,23513 +transformers/models/speecht5/feature_extraction_speecht5.py,sha256=xMEQ55FOnnFirIQCFrFYWuhjHDiTI-MAWJtOMFRT7jM,16724 +transformers/models/speecht5/modeling_speecht5.py,sha256=bRCwJjAXSLECPg6mX6Yd2AHUXquGMNkkalQELyEYizk,140410 +transformers/models/speecht5/number_normalizer.py,sha256=L9vC3QKmC_27nv978ifR-f4gkCCgw2aMjpqqFrpDJEA,7004 +transformers/models/speecht5/processing_speecht5.py,sha256=rUA2C5j1-VxIbKBaGeFgYChGTVjPPtuEskeYCC8fglY,5373 +transformers/models/speecht5/tokenization_speecht5.py,sha256=39_jjTEYCN-CEqALP6R53KA0ZnaI220gUGf8jNS1T6U,6688 +transformers/models/splinter/__init__.py,sha256=N3tdgJIqZRPK0g3pfLE3p3-HkGJMRf-GQ189anQ51to,1084 +transformers/models/splinter/__pycache__/__init__.cpython-312.pyc,, +transformers/models/splinter/__pycache__/configuration_splinter.cpython-312.pyc,, +transformers/models/splinter/__pycache__/modeling_splinter.cpython-312.pyc,, +transformers/models/splinter/__pycache__/tokenization_splinter.cpython-312.pyc,, +transformers/models/splinter/configuration_splinter.py,sha256=ZXuO3ly1JWDPbyooq2A5IHlgDx-tW3iMrg5VlnU2M1k,5478 +transformers/models/splinter/modeling_splinter.py,sha256=CXG3euyfY8RmRMv0MXcQmBSVk0Cpo0_2Y9fm4fiJ_cg,34676 +transformers/models/splinter/tokenization_splinter.py,sha256=hm-SaCCy7IhVgH5ZztphxXctnoOZ8iK7Mqad-P0o44s,6692 +transformers/models/squeezebert/__init__.py,sha256=N2L22551dhssCbWpQgWZJ172TnRjxUdnRlSKr8xW48w,1092 +transformers/models/squeezebert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/squeezebert/__pycache__/configuration_squeezebert.cpython-312.pyc,, +transformers/models/squeezebert/__pycache__/modeling_squeezebert.cpython-312.pyc,, +transformers/models/squeezebert/__pycache__/tokenization_squeezebert.cpython-312.pyc,, +transformers/models/squeezebert/configuration_squeezebert.py,sha256=yGlfsxFyzQXIJ4BtZnsWRolyWQ8knXPgLIvaW4MTBkE,7062 +transformers/models/squeezebert/modeling_squeezebert.py,sha256=8NZgDopn4y31WXVJM_Yu0ZkRUWbPYYQTJsT9aorPISQ,36318 +transformers/models/squeezebert/tokenization_squeezebert.py,sha256=U8LyiVJ_oBc5ejnes_tLUB2espGVrNiqDiVZtsrEOqI,1011 +transformers/models/stablelm/__init__.py,sha256=aVgWTcwBuuiGJDp8H_ZU6BvhYqjmNEqCukU7jEfwd_I,997 +transformers/models/stablelm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/stablelm/__pycache__/configuration_stablelm.cpython-312.pyc,, +transformers/models/stablelm/__pycache__/modeling_stablelm.cpython-312.pyc,, +transformers/models/stablelm/configuration_stablelm.py,sha256=RsNj81u-0HFqcBcErO5NqHwCZLGK2dVEvEIgAZ2bGWY,8003 +transformers/models/stablelm/modeling_stablelm.py,sha256=RPUZEjBS3vV9uYAP4h_mHiYYSlt9TMdxPlO3jmRWWxM,29077 +transformers/models/starcoder2/__init__.py,sha256=fZ8HHZCGjxRfVgROe7zuoi9ADIAa4SeqxGHkvKUQiQM,1001 +transformers/models/starcoder2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/starcoder2/__pycache__/configuration_starcoder2.cpython-312.pyc,, +transformers/models/starcoder2/__pycache__/modeling_starcoder2.cpython-312.pyc,, +transformers/models/starcoder2/__pycache__/modular_starcoder2.cpython-312.pyc,, +transformers/models/starcoder2/configuration_starcoder2.py,sha256=7Jf-ghDpzdedGYw-rDgdnAPgmQDfyEivykh7zLtU2RM,8397 +transformers/models/starcoder2/modeling_starcoder2.py,sha256=tcVkxqR-KRZTm4gl__HsVvYYDdUMcuBBpOQoJJkXwsE,22480 +transformers/models/starcoder2/modular_starcoder2.py,sha256=egeMseHaVO_t4ZD4pxOCn58VqWAKmrre_AOgYP8r3So,9523 +transformers/models/superglue/__init__.py,sha256=MIQs2BH0RmiKt3rZwwW28v4HKdE-nOX3uU2O0dUwYQA,1096 +transformers/models/superglue/__pycache__/__init__.cpython-312.pyc,, +transformers/models/superglue/__pycache__/configuration_superglue.cpython-312.pyc,, +transformers/models/superglue/__pycache__/image_processing_superglue.cpython-312.pyc,, +transformers/models/superglue/__pycache__/image_processing_superglue_fast.cpython-312.pyc,, +transformers/models/superglue/__pycache__/modeling_superglue.cpython-312.pyc,, +transformers/models/superglue/configuration_superglue.py,sha256=3QyEeKVWxJCZ4AlVLiNfw4UQaFK4Ke8qKbxgzd7M38c,5659 +transformers/models/superglue/image_processing_superglue.py,sha256=dlYdXa8IIMvXZXEshy3VyXaQsDKlwEwFRzZQujiYOKY,21963 +transformers/models/superglue/image_processing_superglue_fast.py,sha256=ALeMIam25GAPCtLW_pwLrPU4TWSI7lfqQsOHK1puNZI,12487 +transformers/models/superglue/modeling_superglue.py,sha256=bX7uwwrSgXDiMp-EX8rc13WpHf407d0SecRzIfg0VTQ,32597 +transformers/models/superpoint/__init__.py,sha256=6fQQ-p4220IUaIQCZseKItiHWVV7KOiA5mXoTdJSJmI,1100 +transformers/models/superpoint/__pycache__/__init__.cpython-312.pyc,, +transformers/models/superpoint/__pycache__/configuration_superpoint.cpython-312.pyc,, +transformers/models/superpoint/__pycache__/image_processing_superpoint.cpython-312.pyc,, +transformers/models/superpoint/__pycache__/image_processing_superpoint_fast.cpython-312.pyc,, +transformers/models/superpoint/__pycache__/modeling_superpoint.cpython-312.pyc,, +transformers/models/superpoint/configuration_superpoint.py,sha256=ukYp0RbUXxjIOBsTjyHEWToI_ATxWkaEYxKCiK8tRM8,4048 +transformers/models/superpoint/image_processing_superpoint.py,sha256=2Dzp4DObwxyQy8z3HPb02ZvHqqPeJNCzLF1Ifr07UWM,16373 +transformers/models/superpoint/image_processing_superpoint_fast.py,sha256=jpnXXEn9LpabylUAqDBmg6Cl2jzUfTiPVma3CRNb6eA,6444 +transformers/models/superpoint/modeling_superpoint.py,sha256=B3pg1NRWe5bZGyvsop-ygbST4B26uvuGPmNQx6AsrDc,19490 +transformers/models/swiftformer/__init__.py,sha256=PDcV6Hp4K5CT7w3dsfXb3c9Rd2fgIw7_WLTOH4JQgJU,1003 +transformers/models/swiftformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/swiftformer/__pycache__/configuration_swiftformer.cpython-312.pyc,, +transformers/models/swiftformer/__pycache__/modeling_swiftformer.cpython-312.pyc,, +transformers/models/swiftformer/configuration_swiftformer.py,sha256=j3WQK5w4uGcTu7divgCdKcYilJ96ubrvj8-jbAzGF7Q,5285 +transformers/models/swiftformer/modeling_swiftformer.py,sha256=Frj9a3bHP_WcV7T3hYxKqn2-ZY6W6XbGwutfC1dK6IM,19362 +transformers/models/swin/__init__.py,sha256=upidQvan2_lviVSI8s92-qKh7-Z28XC9Ug9aMV1wnjc,989 +transformers/models/swin/__pycache__/__init__.cpython-312.pyc,, +transformers/models/swin/__pycache__/configuration_swin.cpython-312.pyc,, +transformers/models/swin/__pycache__/modeling_swin.cpython-312.pyc,, +transformers/models/swin/configuration_swin.py,sha256=N9hPwOaVcuBou_Uu9sHJR2Ij8VAZ1-FcOgb57B_bRXs,7245 +transformers/models/swin/modeling_swin.py,sha256=OrCE0dtp8vkLXMx56_FNGcfZWxzUD0xuANzDSzk-0Vc,50971 +transformers/models/swin2sr/__init__.py,sha256=PLCBXwTQF37hLur2ROcYXUiNropQ6u5Ig_HgK29MOu8,1088 +transformers/models/swin2sr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/swin2sr/__pycache__/configuration_swin2sr.cpython-312.pyc,, +transformers/models/swin2sr/__pycache__/image_processing_swin2sr.cpython-312.pyc,, +transformers/models/swin2sr/__pycache__/image_processing_swin2sr_fast.cpython-312.pyc,, +transformers/models/swin2sr/__pycache__/modeling_swin2sr.cpython-312.pyc,, +transformers/models/swin2sr/configuration_swin2sr.py,sha256=H7d6JCeERB-MABZd32v4phemlfgpZ9HHLqYu7h4ROEs,6826 +transformers/models/swin2sr/image_processing_swin2sr.py,sha256=noC9l79H7O4JI3jBzrQvbtjB8eTTLUVnXqZYbni4Cok,9022 +transformers/models/swin2sr/image_processing_swin2sr_fast.py,sha256=RtgcJHyjgUReOTVdOJcliBv5rCFxmwCdblS_EqZNrns,3581 +transformers/models/swin2sr/modeling_swin2sr.py,sha256=WP7fJapYr8TcrVmKwXgSNhe7U9h8LGJ10ivwOJ9Dq_Q,44865 +transformers/models/swinv2/__init__.py,sha256=njM902tlEQ82mYRN9ZTMOiXpJn1NHnxKbm_LCvn2I-M,993 +transformers/models/swinv2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/swinv2/__pycache__/configuration_swinv2.cpython-312.pyc,, +transformers/models/swinv2/__pycache__/modeling_swinv2.cpython-312.pyc,, +transformers/models/swinv2/configuration_swinv2.py,sha256=ESpjaqr-z2lYBYap7n_p_KT5YSuna5-UzxhtUAZBQpI,7387 +transformers/models/swinv2/modeling_swinv2.py,sha256=-mLDTHu0PRkit2bIINWNxGzM9cG3bi8vs3mkTIfte5I,55854 +transformers/models/switch_transformers/__init__.py,sha256=Iw38A9kfIT5mJ0G00YE-TVN-M_b1DBHYQqb0pEyTZMY,1019 +transformers/models/switch_transformers/__pycache__/__init__.cpython-312.pyc,, +transformers/models/switch_transformers/__pycache__/configuration_switch_transformers.cpython-312.pyc,, +transformers/models/switch_transformers/__pycache__/modeling_switch_transformers.cpython-312.pyc,, +transformers/models/switch_transformers/__pycache__/modular_switch_transformers.cpython-312.pyc,, +transformers/models/switch_transformers/configuration_switch_transformers.py,sha256=l_-9fdSLwhK5beVtT92WQLfwcA7aztFZ3YsHz4yNOZU,9764 +transformers/models/switch_transformers/modeling_switch_transformers.py,sha256=Wro7-wQWozg8ocdvJ1yRZQ8h_MXCu2eNRLW5iF6D1B4,51175 +transformers/models/switch_transformers/modular_switch_transformers.py,sha256=WaWgapx1FYQxHShIUlSTqoQt4DUWQCxZisRUOpY9qMI,35649 +transformers/models/t5/__init__.py,sha256=ieynYXP35xsyLPJPIK2Xjq4FtzCq_5aI5Kg7i3kHF44,1020 +transformers/models/t5/__pycache__/__init__.cpython-312.pyc,, +transformers/models/t5/__pycache__/configuration_t5.cpython-312.pyc,, +transformers/models/t5/__pycache__/modeling_t5.cpython-312.pyc,, +transformers/models/t5/__pycache__/tokenization_t5.cpython-312.pyc,, +transformers/models/t5/configuration_t5.py,sha256=oW1L-AiyeNJ5RV-ADiBgbRmnsdHVE7gGH-K0wkxUhi0,6843 +transformers/models/t5/modeling_t5.py,sha256=iz7prwIyktEMpjBxeZvVF0phOi66ExNcP4DvvZuYPlQ,73290 +transformers/models/t5/tokenization_t5.py,sha256=8qOQaAHe3z6tiefKEirFysbIGSZ7A3QlZ3FVeJi5goc,6388 +transformers/models/t5gemma/__init__.py,sha256=S7m_HiGfMyAtU_CSHx9VTNPtSxcnLp8V67FCSGHpLCs,995 +transformers/models/t5gemma/__pycache__/__init__.cpython-312.pyc,, +transformers/models/t5gemma/__pycache__/configuration_t5gemma.cpython-312.pyc,, +transformers/models/t5gemma/__pycache__/modeling_t5gemma.cpython-312.pyc,, +transformers/models/t5gemma/__pycache__/modular_t5gemma.cpython-312.pyc,, +transformers/models/t5gemma/configuration_t5gemma.py,sha256=R-0SAm_jGrppoDHOtJrzQieBmcwVkLE-Wntt8kkDdIc,15101 +transformers/models/t5gemma/modeling_t5gemma.py,sha256=GbqboVUVHqW9t8i_T2DCZRG3pamFvf7DEalbBK4QGiM,59441 +transformers/models/t5gemma/modular_t5gemma.py,sha256=L5CQ-3GMlifmxDTvi2Cn8drS7m_xVccEVt5ufKgDOTk,59460 +transformers/models/t5gemma2/__init__.py,sha256=AF59388HsGjMPsRnN8iRdDNwYBE-uyTZ-U8zEKnYRyI,997 +transformers/models/t5gemma2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/t5gemma2/__pycache__/configuration_t5gemma2.cpython-312.pyc,, +transformers/models/t5gemma2/__pycache__/modeling_t5gemma2.cpython-312.pyc,, +transformers/models/t5gemma2/__pycache__/modular_t5gemma2.cpython-312.pyc,, +transformers/models/t5gemma2/configuration_t5gemma2.py,sha256=vXYDwLXDL9TyA-TT83N3hiyCEW1sMUtp2OSlwRQQXc4,31729 +transformers/models/t5gemma2/modeling_t5gemma2.py,sha256=4C5v7Hc72XbtlcxXkvbkQSJFjeJBp4GKv9QFOt2Ewio,69830 +transformers/models/t5gemma2/modular_t5gemma2.py,sha256=GkkhdpRY58Dh81W-jI2r4Z_xqmynjN1pYtYYhlrav5g,71892 +transformers/models/table_transformer/__init__.py,sha256=VT-KM0_6LZ6fdOAglbfA8zEhCQuYa6He10Div7WEcD8,1015 +transformers/models/table_transformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/table_transformer/__pycache__/configuration_table_transformer.cpython-312.pyc,, +transformers/models/table_transformer/__pycache__/modeling_table_transformer.cpython-312.pyc,, +transformers/models/table_transformer/configuration_table_transformer.py,sha256=49Zsj_wrs68-zpbLVhmvporuW1QZuMJmdDGcY6o7SSg,10542 +transformers/models/table_transformer/modeling_table_transformer.py,sha256=VAFJWskBhH-TsifRbWTN02uEzK2nDss-U-_ADEglOmI,60046 +transformers/models/tapas/__init__.py,sha256=Q4UNvDF5OHuAeLJFMEeBOGKzgO-ytt4t8x9shTlIb2o,1029 +transformers/models/tapas/__pycache__/__init__.cpython-312.pyc,, +transformers/models/tapas/__pycache__/configuration_tapas.cpython-312.pyc,, +transformers/models/tapas/__pycache__/modeling_tapas.cpython-312.pyc,, +transformers/models/tapas/__pycache__/tokenization_tapas.cpython-312.pyc,, +transformers/models/tapas/configuration_tapas.py,sha256=HEuGt4xfYL76dKmRJke5rf5Njp_cyNSfjFyAngCBdFA,12670 +transformers/models/tapas/modeling_tapas.py,sha256=OzFA3xXoPbftwqX2quM7t4EmC2QEcqvey6AmaxjHfhU,98183 +transformers/models/tapas/tokenization_tapas.py,sha256=ZE9MRtaO7G4rOuyJvBrYUtkmNyfLDbl806ooj99y350,119179 +transformers/models/textnet/__init__.py,sha256=nqXafUk5z5F_61jrGF9gK_sI66uj7kq5sUYrit9bsno,1088 +transformers/models/textnet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/textnet/__pycache__/configuration_textnet.cpython-312.pyc,, +transformers/models/textnet/__pycache__/image_processing_textnet.cpython-312.pyc,, +transformers/models/textnet/__pycache__/image_processing_textnet_fast.cpython-312.pyc,, +transformers/models/textnet/__pycache__/modeling_textnet.cpython-312.pyc,, +transformers/models/textnet/configuration_textnet.py,sha256=KS3u663CIUCLwZJAoAX3rj07wnKzycYR1phc3-L6fSE,6042 +transformers/models/textnet/image_processing_textnet.py,sha256=2QKffUUBxTaIQjM22LGyImy6kfNIYVOOiQDBeHwzi-o,17488 +transformers/models/textnet/image_processing_textnet_fast.py,sha256=T0XfPLeYHWHuY7xVqmId4_33W7utVwWhNT6tWf2su4I,5336 +transformers/models/textnet/modeling_textnet.py,sha256=tLOvHkgvXC6ABzXFl-tlQjasp5lgTjVIPCjJz3gw1VY,15152 +transformers/models/time_series_transformer/__init__.py,sha256=3A_3Wog-6NDwCoBIMtkzJv9slc_wXpzDzsOo-xBQ8hE,1027 +transformers/models/time_series_transformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/time_series_transformer/__pycache__/configuration_time_series_transformer.cpython-312.pyc,, +transformers/models/time_series_transformer/__pycache__/modeling_time_series_transformer.cpython-312.pyc,, +transformers/models/time_series_transformer/configuration_time_series_transformer.py,sha256=E8ZVYmOVp-xpGLcHBa9qRPtuJZNhzIEjbqM8kC8aRm0,11623 +transformers/models/time_series_transformer/modeling_time_series_transformer.py,sha256=HYtfMWJS7gC-Cmjgt1FiJR3Vcwdoj3SuYtKMGwQwsz4,84275 +transformers/models/timesfm/__init__.py,sha256=gcfLgRAbwZThFP98fst9wsoTMB0fkR28tzWYoQIs5qU,995 +transformers/models/timesfm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/timesfm/__pycache__/configuration_timesfm.cpython-312.pyc,, +transformers/models/timesfm/__pycache__/modeling_timesfm.cpython-312.pyc,, +transformers/models/timesfm/__pycache__/modular_timesfm.cpython-312.pyc,, +transformers/models/timesfm/configuration_timesfm.py,sha256=cJB6lo5fzOTa9lCSlRxZKmETdkOWoLi6CMEG-UsRADk,5660 +transformers/models/timesfm/modeling_timesfm.py,sha256=tHCHAT0CU8niVHYa7PHZbzF0z3Vdo2f_ZaGeEoNKhbU,34681 +transformers/models/timesfm/modular_timesfm.py,sha256=ey-s2jjq0zYgmYZ7MT8Q8sxNbic5N2x0tAGLbxVT-Ak,32366 +transformers/models/timesformer/__init__.py,sha256=4ODuyNRrYkbgpSbMHJX8XmpJdekHlu__zWey-plUSgI,1003 +transformers/models/timesformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/timesformer/__pycache__/configuration_timesformer.cpython-312.pyc,, +transformers/models/timesformer/__pycache__/modeling_timesformer.cpython-312.pyc,, +transformers/models/timesformer/configuration_timesformer.py,sha256=SNfbY5pVfjmLWMvTU7e_u3Xl7RORM6sYhMwZe4bs5J8,5553 +transformers/models/timesformer/modeling_timesformer.py,sha256=PmI4KdFLS9O8e84Qy-xygUq7X7RYcrEmCw56zYNiLGE,31911 +transformers/models/timm_backbone/__init__.py,sha256=s0GlTaJ43Yt9ZdzG9-qjJNlp0Ol4vjN-14S6N7gXLsA,1007 +transformers/models/timm_backbone/__pycache__/__init__.cpython-312.pyc,, +transformers/models/timm_backbone/__pycache__/configuration_timm_backbone.cpython-312.pyc,, +transformers/models/timm_backbone/__pycache__/modeling_timm_backbone.cpython-312.pyc,, +transformers/models/timm_backbone/configuration_timm_backbone.py,sha256=PISnTd3lvcAEHT_vwtR5l4v5xHpn2EXL5VXkhc-VU8g,4104 +transformers/models/timm_backbone/modeling_timm_backbone.py,sha256=36WvBIqZTx3KQ0UJzjI6izIKzFEZ28Xnr1xuIYZ37u8,6723 +transformers/models/timm_wrapper/__init__.py,sha256=U19BCtZcAQdmBto5bqG6u69W5rnUBtIyP11EcRh_0Tk,1054 +transformers/models/timm_wrapper/__pycache__/__init__.cpython-312.pyc,, +transformers/models/timm_wrapper/__pycache__/configuration_timm_wrapper.cpython-312.pyc,, +transformers/models/timm_wrapper/__pycache__/image_processing_timm_wrapper.cpython-312.pyc,, +transformers/models/timm_wrapper/__pycache__/modeling_timm_wrapper.cpython-312.pyc,, +transformers/models/timm_wrapper/configuration_timm_wrapper.py,sha256=N0WqUdR9u3l4ZqTmL2TumGGv3o8IQC1QxkE27YLpa-0,5583 +transformers/models/timm_wrapper/image_processing_timm_wrapper.py,sha256=ER8ITuGx1vIT2LWD4InZpkKZcC0i8RufGGDsGygexUA,5298 +transformers/models/timm_wrapper/modeling_timm_wrapper.py,sha256=D5uLjDglDhbbu2orrSJKYe5hxdZCekMmr4UmjGLnreo,16993 +transformers/models/trocr/__init__.py,sha256=Hllbq_42XbGRZyXsGOzYHcb33MOA5_yfijMRKEXJ4n4,1027 +transformers/models/trocr/__pycache__/__init__.cpython-312.pyc,, +transformers/models/trocr/__pycache__/configuration_trocr.cpython-312.pyc,, +transformers/models/trocr/__pycache__/modeling_trocr.cpython-312.pyc,, +transformers/models/trocr/__pycache__/processing_trocr.cpython-312.pyc,, +transformers/models/trocr/configuration_trocr.py,sha256=BPwCKrmq7wue_PIgm1z13g7O2qbnWjzMVVVsN6OQmkg,6793 +transformers/models/trocr/modeling_trocr.py,sha256=JPQIyx5aKtCho1UQetozzV470VpmEWH5Nol4wXVgxcU,35009 +transformers/models/trocr/processing_trocr.py,sha256=Ua_wrqvHlTgXiPiMSVgAe_axfYz8_IIknqCJaCDgFrc,2376 +transformers/models/tvp/__init__.py,sha256=zY4KwnUt4Q8f_afJGLIxUIfZf8RIyOOCbv9tnAJk1ic,1106 +transformers/models/tvp/__pycache__/__init__.cpython-312.pyc,, +transformers/models/tvp/__pycache__/configuration_tvp.cpython-312.pyc,, +transformers/models/tvp/__pycache__/image_processing_tvp.cpython-312.pyc,, +transformers/models/tvp/__pycache__/image_processing_tvp_fast.cpython-312.pyc,, +transformers/models/tvp/__pycache__/modeling_tvp.cpython-312.pyc,, +transformers/models/tvp/__pycache__/processing_tvp.cpython-312.pyc,, +transformers/models/tvp/configuration_tvp.py,sha256=WL2sz-5MRd1K_ccCScSixmJ8tAHuoD0dTG6q_o8hKpk,7541 +transformers/models/tvp/image_processing_tvp.py,sha256=vlfs7i3zGpbBjlECWnb3KyiGhaf7ySXtTWD6MNcAeTQ,22837 +transformers/models/tvp/image_processing_tvp_fast.py,sha256=O-U-aUWv-acg3ZjBjswQXA4_ukypOdlLRKbdN14VJsU,7866 +transformers/models/tvp/modeling_tvp.py,sha256=4tdxIK5ea8bnXTmXl4T2f1wIfhlqgUZcftPCoJGfwG0,37941 +transformers/models/tvp/processing_tvp.py,sha256=3pETNxZZvG6cD2JdlWcTU8qu62Pcz4joiPyCGu4J0xE,1973 +transformers/models/udop/__init__.py,sha256=GOiuT5Vm4kOkkZNVQ5AciUkw7BnJLB2quIn9jv9h5Nw,1061 +transformers/models/udop/__pycache__/__init__.cpython-312.pyc,, +transformers/models/udop/__pycache__/configuration_udop.cpython-312.pyc,, +transformers/models/udop/__pycache__/modeling_udop.cpython-312.pyc,, +transformers/models/udop/__pycache__/processing_udop.cpython-312.pyc,, +transformers/models/udop/__pycache__/tokenization_udop.cpython-312.pyc,, +transformers/models/udop/configuration_udop.py,sha256=9jlFhYuMYXt1ydwdUQyLPxn2I8NedxbybkiB6MMUHFI,8343 +transformers/models/udop/modeling_udop.py,sha256=HB7OmL6Q-sxcsLJe4Z8FIVfuQGZQNwDDqPArsUY7GaQ,79801 +transformers/models/udop/processing_udop.py,sha256=F78VvxPHlSEDUozH9cLrlSIFHCnPQn-QU-znDTKell4,7148 +transformers/models/udop/tokenization_udop.py,sha256=CblxD_A60VDOkDwNyt8Xthockkdi_wI_MyXyOZYFtt4,49668 +transformers/models/umt5/__init__.py,sha256=FKt6Ap3AvOCIKoeOM-5qY84lNEML9IujaDaYROINJMs,989 +transformers/models/umt5/__pycache__/__init__.cpython-312.pyc,, +transformers/models/umt5/__pycache__/configuration_umt5.cpython-312.pyc,, +transformers/models/umt5/__pycache__/modeling_umt5.cpython-312.pyc,, +transformers/models/umt5/configuration_umt5.py,sha256=6fChPfubivtNjzuAbne-HrrXk70q5lqG7No9D4TCixs,6454 +transformers/models/umt5/modeling_umt5.py,sha256=dAaGlcUfkhqIiC-TCi5I8N2DRAYJ87vfZRyF3GhNvjI,75085 +transformers/models/unispeech/__init__.py,sha256=AXJMExDoYYI71OKNXhAt7lyqcFIvcLHEQ1Fsm171m5w,999 +transformers/models/unispeech/__pycache__/__init__.cpython-312.pyc,, +transformers/models/unispeech/__pycache__/configuration_unispeech.cpython-312.pyc,, +transformers/models/unispeech/__pycache__/modeling_unispeech.cpython-312.pyc,, +transformers/models/unispeech/__pycache__/modular_unispeech.cpython-312.pyc,, +transformers/models/unispeech/configuration_unispeech.py,sha256=LZqwCBTds8aX7mOoq36V3YDHQwJK-23Fan-NkjZBN3U,17537 +transformers/models/unispeech/modeling_unispeech.py,sha256=R-atHtnd3G_q0TMxOq3C2VTLH8-dyXle32kW4BcKIGE,60296 +transformers/models/unispeech/modular_unispeech.py,sha256=wNjFfLNqzRlBZIyix0kboaYB3v6K9dw6ehxgaWrHzbk,17560 +transformers/models/unispeech_sat/__init__.py,sha256=P9lCzMg01s4Gj_Pb8t1l36MRAeoOcxUa4d7dbQSe9N4,1007 +transformers/models/unispeech_sat/__pycache__/__init__.cpython-312.pyc,, +transformers/models/unispeech_sat/__pycache__/configuration_unispeech_sat.cpython-312.pyc,, +transformers/models/unispeech_sat/__pycache__/modeling_unispeech_sat.cpython-312.pyc,, +transformers/models/unispeech_sat/__pycache__/modular_unispeech_sat.cpython-312.pyc,, +transformers/models/unispeech_sat/configuration_unispeech_sat.py,sha256=SC2ZitixAwMYer5jGpTlzIDEn11IE2nADDkej4CgP-Q,18882 +transformers/models/unispeech_sat/modeling_unispeech_sat.py,sha256=3voSVQvGXAmkIs1R41rMvPP3BJPy3qRI3Ewkr7Zkllw,73336 +transformers/models/unispeech_sat/modular_unispeech_sat.py,sha256=jwX-Ao2iQUw1uHjJRp3TZSmEl7-xLizFsAMXXhznjtU,17953 +transformers/models/univnet/__init__.py,sha256=hfHyxyKGEfd58p1fUSA3IxK2q6JkVatkGceVaoKuODk,1041 +transformers/models/univnet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/univnet/__pycache__/configuration_univnet.cpython-312.pyc,, +transformers/models/univnet/__pycache__/feature_extraction_univnet.cpython-312.pyc,, +transformers/models/univnet/__pycache__/modeling_univnet.cpython-312.pyc,, +transformers/models/univnet/configuration_univnet.py,sha256=0iphUNQuhWX9ttAp8lQ0LC8ZnqRSn22vuQGlSGYWSsE,6758 +transformers/models/univnet/feature_extraction_univnet.py,sha256=fLIbEVY2ItwXSTfwkmqZxC1obyHtDaWIXzJqHACsmK0,22748 +transformers/models/univnet/modeling_univnet.py,sha256=q4CqsvHDQXsxM2jruUgwj7amtCjZrTabuGY-6xN6OYI,25423 +transformers/models/upernet/__init__.py,sha256=Wq3u7yXJul5PLmjalxKgx451sa_WuSXbEM45bZsRv3E,995 +transformers/models/upernet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/upernet/__pycache__/configuration_upernet.cpython-312.pyc,, +transformers/models/upernet/__pycache__/modeling_upernet.cpython-312.pyc,, +transformers/models/upernet/configuration_upernet.py,sha256=_LBTSTQqF4fT4zIYAjUmaEndsOJE-eRN8n_a8aADXIU,4899 +transformers/models/upernet/modeling_upernet.py,sha256=WYFJ_TRxtUbxMoZsLFmCZM1P_K-ZjpveuFvHNd0FUOM,14155 +transformers/models/vaultgemma/__init__.py,sha256=d-2ptvRau3FlBamhyOMQnMVX3tvL-dQnfm4CyQJBBRA,1002 +transformers/models/vaultgemma/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vaultgemma/__pycache__/configuration_vaultgemma.cpython-312.pyc,, +transformers/models/vaultgemma/__pycache__/modeling_vaultgemma.cpython-312.pyc,, +transformers/models/vaultgemma/__pycache__/modular_vaultgemma.cpython-312.pyc,, +transformers/models/vaultgemma/configuration_vaultgemma.py,sha256=m_nYTjtBqadFJnfRb69c2tSYEHutjR9O_iwJiqwLH2A,10319 +transformers/models/vaultgemma/modeling_vaultgemma.py,sha256=r6rgq7fBZ7pM1DoXCTrtwOeflt3rXeb-ubYp7DQqMnk,23836 +transformers/models/vaultgemma/modular_vaultgemma.py,sha256=qbMzO6j8S0MufGdH7MV4pgx_h6qzMOgtpYrwiHpqoTw,10624 +transformers/models/vibevoice_acoustic_tokenizer/__init__.py,sha256=B8iNqUEKPRSTqVHk_x8cIYdTtZJz9CyFb9CXxPs2xbQ,1104 +transformers/models/vibevoice_acoustic_tokenizer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vibevoice_acoustic_tokenizer/__pycache__/configuration_vibevoice_acoustic_tokenizer.cpython-312.pyc,, +transformers/models/vibevoice_acoustic_tokenizer/__pycache__/feature_extraction_vibevoice_acoustic_tokenizer.cpython-312.pyc,, +transformers/models/vibevoice_acoustic_tokenizer/__pycache__/modeling_vibevoice_acoustic_tokenizer.cpython-312.pyc,, +transformers/models/vibevoice_acoustic_tokenizer/__pycache__/modular_vibevoice_acoustic_tokenizer.cpython-312.pyc,, +transformers/models/vibevoice_acoustic_tokenizer/configuration_vibevoice_acoustic_tokenizer.py,sha256=RrKuyvl6ErzUIj7V9ZepMydnylgfr1OLguX8MbqhzqI,4509 +transformers/models/vibevoice_acoustic_tokenizer/feature_extraction_vibevoice_acoustic_tokenizer.py,sha256=fewKQ3gnPKFzd3IrJdZNKtpPUso5Sqn-GpJCZlvp_NY,6261 +transformers/models/vibevoice_acoustic_tokenizer/modeling_vibevoice_acoustic_tokenizer.py,sha256=3uSqkS5OQiZuoHrJiMRig1R579VU5WDTsosj_npj6ik,28068 +transformers/models/vibevoice_acoustic_tokenizer/modular_vibevoice_acoustic_tokenizer.py,sha256=QAZXyrlWRSwsON9N0TYlM_SNirfzADDeFW1Ipan90vA,22525 +transformers/models/video_llama_3/__init__.py,sha256=_ZgoZnMTkVXzGnu_xWzcfmccT80nN3Sa4OxLA28LNag,1206 +transformers/models/video_llama_3/__pycache__/__init__.cpython-312.pyc,, +transformers/models/video_llama_3/__pycache__/configuration_video_llama_3.cpython-312.pyc,, +transformers/models/video_llama_3/__pycache__/image_processing_video_llama_3.cpython-312.pyc,, +transformers/models/video_llama_3/__pycache__/image_processing_video_llama_3_fast.cpython-312.pyc,, +transformers/models/video_llama_3/__pycache__/modeling_video_llama_3.cpython-312.pyc,, +transformers/models/video_llama_3/__pycache__/modular_video_llama_3.cpython-312.pyc,, +transformers/models/video_llama_3/__pycache__/processing_video_llama_3.cpython-312.pyc,, +transformers/models/video_llama_3/__pycache__/video_processing_video_llama_3.cpython-312.pyc,, +transformers/models/video_llama_3/configuration_video_llama_3.py,sha256=P-US42nX6b3WpAcC0lliGTRr8cNs1PRu1TrHGmdmV3I,7275 +transformers/models/video_llama_3/image_processing_video_llama_3.py,sha256=D5i-wlJ9KeRdFbMvfI3TWJ4muZK89Th2cwv9fWZdwYE,25849 +transformers/models/video_llama_3/image_processing_video_llama_3_fast.py,sha256=5NLagvdYnBy3U5UBwZV3YlBsV1k4s1vpgYQx4FFpvy0,12604 +transformers/models/video_llama_3/modeling_video_llama_3.py,sha256=nhMHtc04M1XwDlCgsKzzR6aQNYJ8ls3UHd036w6q-j0,50324 +transformers/models/video_llama_3/modular_video_llama_3.py,sha256=0-WBep8zwpnUDsTm_xEWZolkSlz8JdcP-EwTb6qPkuY,74707 +transformers/models/video_llama_3/processing_video_llama_3.py,sha256=SI1H7tDo1SL3smzk12qr326E0HaarOo1wO7MNBBTm6k,11716 +transformers/models/video_llama_3/video_processing_video_llama_3.py,sha256=441j-z0RU63L2yt3CtkgpZdMgZMxUeS7Birk9ctCaGU,18414 +transformers/models/video_llava/__init__.py,sha256=bsLGp1WBBO_AvNVRxzOn5k7OYQIbX9SqFhESd24FImc,1093 +transformers/models/video_llava/__pycache__/__init__.cpython-312.pyc,, +transformers/models/video_llava/__pycache__/configuration_video_llava.cpython-312.pyc,, +transformers/models/video_llava/__pycache__/image_processing_video_llava.cpython-312.pyc,, +transformers/models/video_llava/__pycache__/modeling_video_llava.cpython-312.pyc,, +transformers/models/video_llava/__pycache__/processing_video_llava.cpython-312.pyc,, +transformers/models/video_llava/__pycache__/video_processing_video_llava.cpython-312.pyc,, +transformers/models/video_llava/configuration_video_llava.py,sha256=2XkFxJsJN5KbhXlWAKvVffR_kU72jXpCY8YVVzxDrtY,6639 +transformers/models/video_llava/image_processing_video_llava.py,sha256=FiopnKA5a9Sa0ZGfXaYout_cemM5oG1IaeM70dSB9H8,16825 +transformers/models/video_llava/modeling_video_llava.py,sha256=JrLEl_pzngqU0JSiJPsh8yxJDk4bGR0O90_8f71AS-M,29727 +transformers/models/video_llava/processing_video_llava.py,sha256=U2IjhsbigW-5CEJIxc0rtsL28IPWiL8SiG57K3JOeD0,7450 +transformers/models/video_llava/video_processing_video_llava.py,sha256=Aomg9TFiRNtufNGT00RZArhv46Dl6FBl3tc3VQZosjg,1320 +transformers/models/videomae/__init__.py,sha256=4vBgjF7k3KHmqe9T6mBDxpHZu6VPh6zSFhhhMVdvVjM,1134 +transformers/models/videomae/__pycache__/__init__.cpython-312.pyc,, +transformers/models/videomae/__pycache__/configuration_videomae.cpython-312.pyc,, +transformers/models/videomae/__pycache__/image_processing_videomae.cpython-312.pyc,, +transformers/models/videomae/__pycache__/modeling_videomae.cpython-312.pyc,, +transformers/models/videomae/__pycache__/video_processing_videomae.cpython-312.pyc,, +transformers/models/videomae/configuration_videomae.py,sha256=oNe2fBtG8RrjJdRtpT733emfi6_sqizqEezDu1aFF30,6585 +transformers/models/videomae/image_processing_videomae.py,sha256=aQ_ba2hiuK-wugP1yDEUcPBP3yASaE6FviRbOlVnL9A,16317 +transformers/models/videomae/modeling_videomae.py,sha256=7xvzAn1TlYBHbh1mRalXxJfJ6SuRKZ_mqU2iC7JPFpw,30969 +transformers/models/videomae/video_processing_videomae.py,sha256=VivwNTSmRKdflwjtm5LTvJFPoQXeY-YmtxFlpR-6c70,1582 +transformers/models/vilt/__init__.py,sha256=efaZSTGsk3QhZmBrc6F29q55LkC_1Vb8fNC0MY4881Q,1154 +transformers/models/vilt/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vilt/__pycache__/configuration_vilt.cpython-312.pyc,, +transformers/models/vilt/__pycache__/image_processing_vilt.cpython-312.pyc,, +transformers/models/vilt/__pycache__/image_processing_vilt_fast.cpython-312.pyc,, +transformers/models/vilt/__pycache__/modeling_vilt.cpython-312.pyc,, +transformers/models/vilt/__pycache__/processing_vilt.cpython-312.pyc,, +transformers/models/vilt/configuration_vilt.py,sha256=sdn1ntgN8l40Ll05QCzp4TnL4xNZ2lBjSyuUSvlkF2Y,6935 +transformers/models/vilt/image_processing_vilt.py,sha256=uuBNA4Ij16WdBYWEOT6ekjRrWMCbGQHifyMcOa9Th5Y,22082 +transformers/models/vilt/image_processing_vilt_fast.py,sha256=Qu8nTrv7t32CqyJv4qg6J5bOq0ocKZOSU1tUZRGmdeQ,9012 +transformers/models/vilt/modeling_vilt.py,sha256=NkGg6_7egh3PQqujl0zrFcqSO0WcdMsCT-D54xNsP3w,54108 +transformers/models/vilt/processing_vilt.py,sha256=ENfJmMX9MAGot1QsNiYnsyDF48iIXqs5eH4XnM74paM,1408 +transformers/models/vipllava/__init__.py,sha256=HJ5mZUNdt_bmaC9l-GycD7mVT2r1oN15prmnlBtz6oA,997 +transformers/models/vipllava/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vipllava/__pycache__/configuration_vipllava.cpython-312.pyc,, +transformers/models/vipllava/__pycache__/modeling_vipllava.cpython-312.pyc,, +transformers/models/vipllava/__pycache__/modular_vipllava.cpython-312.pyc,, +transformers/models/vipllava/configuration_vipllava.py,sha256=mY0TB-AOOh6-CFuvHynzixyZbcSCGvjn5dL1bRYLuns,5240 +transformers/models/vipllava/modeling_vipllava.py,sha256=-ArzAqY1EV4YivKAfIATWTyuQ8BUF9u5MhujPv78XeE,21165 +transformers/models/vipllava/modular_vipllava.py,sha256=euKVJnmoi8lWZrp8w9dzzjG5XNlIFo4yOS0HsnkTi78,13185 +transformers/models/vision_encoder_decoder/__init__.py,sha256=noRw3j3TsUX_pmu-lPHZtprgJIRoohYtpDl-Ebwbfgo,1025 +transformers/models/vision_encoder_decoder/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vision_encoder_decoder/__pycache__/configuration_vision_encoder_decoder.cpython-312.pyc,, +transformers/models/vision_encoder_decoder/__pycache__/modeling_vision_encoder_decoder.cpython-312.pyc,, +transformers/models/vision_encoder_decoder/configuration_vision_encoder_decoder.py,sha256=WJu-LiZyMKsJwyRUJqXdI1cjTUptPZm-VzGoVkxyC1Y,4685 +transformers/models/vision_encoder_decoder/modeling_vision_encoder_decoder.py,sha256=MVaGC4LNRR35vVLGfIVZERmGYoUJRSTPNk4Wg6jbxEI,22010 +transformers/models/vision_text_dual_encoder/__init__.py,sha256=j-CUSG80TkFAaWDzRmQSBgARhrzpHUaKWQUPJ2ZdvIw,1084 +transformers/models/vision_text_dual_encoder/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vision_text_dual_encoder/__pycache__/configuration_vision_text_dual_encoder.cpython-312.pyc,, +transformers/models/vision_text_dual_encoder/__pycache__/modeling_vision_text_dual_encoder.cpython-312.pyc,, +transformers/models/vision_text_dual_encoder/__pycache__/processing_vision_text_dual_encoder.cpython-312.pyc,, +transformers/models/vision_text_dual_encoder/configuration_vision_text_dual_encoder.py,sha256=1V5owZl17CHivX7Oc6OdkumaYW5D--y_fEtIisM36Iw,5008 +transformers/models/vision_text_dual_encoder/modeling_vision_text_dual_encoder.py,sha256=mA1K6uh-pINRo2u7uu8pU2dPjAEMDBEeFIf9ti4xU9Q,17553 +transformers/models/vision_text_dual_encoder/processing_vision_text_dual_encoder.py,sha256=2EGdP2Ram632GK8HbvjxpKZGwAEDGke9vIZfccaI2hw,1082 +transformers/models/visual_bert/__init__.py,sha256=zZFHfkE7OUMZUwYvB7v4ZIBXVUW9Mboqoa1QdTQURWM,1003 +transformers/models/visual_bert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/visual_bert/__pycache__/configuration_visual_bert.cpython-312.pyc,, +transformers/models/visual_bert/__pycache__/modeling_visual_bert.cpython-312.pyc,, +transformers/models/visual_bert/configuration_visual_bert.py,sha256=5D5Eb3C87JxZ2ZJqBZxYCBp_GKVFCawyNb6Dg-ccy34,6883 +transformers/models/visual_bert/modeling_visual_bert.py,sha256=E_BfiMocB941Cb0FrSlkrmphfHw5MiZQkF1EIVF32oc,67332 +transformers/models/vit/__init__.py,sha256=893K3i6fsEym2vyvQFpE2_yfZcCxo4C3xf7vr8vY38I,1114 +transformers/models/vit/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vit/__pycache__/configuration_vit.cpython-312.pyc,, +transformers/models/vit/__pycache__/image_processing_vit.cpython-312.pyc,, +transformers/models/vit/__pycache__/image_processing_vit_fast.cpython-312.pyc,, +transformers/models/vit/__pycache__/modeling_vit.cpython-312.pyc,, +transformers/models/vit/configuration_vit.py,sha256=Xd0pzqtYLPT22b8Y6DbR2ZC1apPmnkaiA69l3QAoyd8,5541 +transformers/models/vit/image_processing_vit.py,sha256=ELRtmsGTmMWhjxDkEQJytrj8CYdKD_ER-LHVWFyh1sY,14034 +transformers/models/vit/image_processing_vit_fast.py,sha256=NlrrjSsiM4hGTeVpxknZ_aX-8tKPkkHVdcIy24gkSGY,1222 +transformers/models/vit/modeling_vit.py,sha256=NMXRaJr9fgACmQowBWXgJ4rIemRjTmMbYM658wrf6Z4,26040 +transformers/models/vit_mae/__init__.py,sha256=yrtk-59bpQGketwQFpVmON5rOe7GOctf8NJJZH09WBk,995 +transformers/models/vit_mae/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vit_mae/__pycache__/configuration_vit_mae.cpython-312.pyc,, +transformers/models/vit_mae/__pycache__/modeling_vit_mae.cpython-312.pyc,, +transformers/models/vit_mae/configuration_vit_mae.py,sha256=ay-3DSdGyJ1U26wwpyxJzmkucUSyJvx0KPvDOXE7isI,6357 +transformers/models/vit_mae/modeling_vit_mae.py,sha256=IcZxjkyhCrSdfEEpko7d3lQTn7BNtKUjmCtcXN9B-Vs,38305 +transformers/models/vit_msn/__init__.py,sha256=Y1g56VRSNr-PxS-g4Cp2IlRR5M9CiaFGlhAQXwszGHo,995 +transformers/models/vit_msn/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vit_msn/__pycache__/configuration_vit_msn.cpython-312.pyc,, +transformers/models/vit_msn/__pycache__/modeling_vit_msn.cpython-312.pyc,, +transformers/models/vit_msn/configuration_vit_msn.py,sha256=khhczZQ1gekgE-vK4urtfVDS7X8k1FSIkrF9iQpEJKk,4849 +transformers/models/vit_msn/modeling_vit_msn.py,sha256=aV1hAjEYDWvU40Vn74JAVTfgy_4NfuT_uUH2APSLjFw,21855 +transformers/models/vitdet/__init__.py,sha256=13LNGZwvKK3tBrQWVs43rQbxbgqvxLfnM0uMqomHqhM,993 +transformers/models/vitdet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vitdet/__pycache__/configuration_vitdet.cpython-312.pyc,, +transformers/models/vitdet/__pycache__/modeling_vitdet.cpython-312.pyc,, +transformers/models/vitdet/configuration_vitdet.py,sha256=HMqE2GjxVI6h2LmUtNyCjAJ2Z0b28vrinUc3WkIXmJM,7381 +transformers/models/vitdet/modeling_vitdet.py,sha256=OKauot-xaNBXoQzUezJ6r1hXsjnD5L-FPBZAYGuZ8bE,29796 +transformers/models/vitmatte/__init__.py,sha256=al6dWrth9LhRLjmVZrxSi0SRcMMUH_UNpMmR5nwflSc,1092 +transformers/models/vitmatte/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vitmatte/__pycache__/configuration_vitmatte.cpython-312.pyc,, +transformers/models/vitmatte/__pycache__/image_processing_vitmatte.cpython-312.pyc,, +transformers/models/vitmatte/__pycache__/image_processing_vitmatte_fast.cpython-312.pyc,, +transformers/models/vitmatte/__pycache__/modeling_vitmatte.cpython-312.pyc,, +transformers/models/vitmatte/configuration_vitmatte.py,sha256=CMuXb_j9HzwOX8RRNYgFdRPC3HJH_XCj6t5hDDrxJ3g,3980 +transformers/models/vitmatte/image_processing_vitmatte.py,sha256=gN5ooEP9nQy_9jLGTzXBV8lNoHPejYEwqpv8k6QZYJ4,13203 +transformers/models/vitmatte/image_processing_vitmatte_fast.py,sha256=R3_ZNGx3EvNhdOx6hM4Pya84WmZDI9_t5L_Hw5Xipuc,5831 +transformers/models/vitmatte/modeling_vitmatte.py,sha256=ihMN7L4Um0xNQ8Qa2gT7icA7qnxtIwFaWqUKaZLQdf0,10873 +transformers/models/vitpose/__init__.py,sha256=Nt5JL9KutJ_ut6MLlr6oUDeyOYIeZY0MtKZsePTm1Ps,1088 +transformers/models/vitpose/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vitpose/__pycache__/configuration_vitpose.cpython-312.pyc,, +transformers/models/vitpose/__pycache__/image_processing_vitpose.cpython-312.pyc,, +transformers/models/vitpose/__pycache__/image_processing_vitpose_fast.cpython-312.pyc,, +transformers/models/vitpose/__pycache__/modeling_vitpose.cpython-312.pyc,, +transformers/models/vitpose/configuration_vitpose.py,sha256=r-B273YF3MuE6PgaP1_w3vAWBH7H6zPKY520c2H79eI,3593 +transformers/models/vitpose/image_processing_vitpose.py,sha256=nKhCbAC54i_dJs5X_sMi5lqx6zMDQXmWq1dcSYlxl7w,29828 +transformers/models/vitpose/image_processing_vitpose_fast.py,sha256=RkjZucsP9n1ao2Gm_GBGYUqpcuYsNuzsZ5UtfH4ynTs,11811 +transformers/models/vitpose/modeling_vitpose.py,sha256=liTbils_xmJEsZNycLdv1LNrnG8AczLQ2-UKaCqgra4,11513 +transformers/models/vitpose_backbone/__init__.py,sha256=W5IjP47Ykg5KRs8S9ztAbtfQ__n6sbJUZG4UDIGdGmA,577 +transformers/models/vitpose_backbone/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vitpose_backbone/__pycache__/configuration_vitpose_backbone.cpython-312.pyc,, +transformers/models/vitpose_backbone/__pycache__/modeling_vitpose_backbone.cpython-312.pyc,, +transformers/models/vitpose_backbone/configuration_vitpose_backbone.py,sha256=0v3rIoNkltmhh4CVO4VyvnwuPCo_sHF-tQrYcXx939g,6491 +transformers/models/vitpose_backbone/modeling_vitpose_backbone.py,sha256=2ENVsYtgFLy4cECxoglZ9N1N2kUqWAwehopfNty8GfI,17329 +transformers/models/vits/__init__.py,sha256=7baZcqGvFlYQxAl721XtMptMZKkzvBOa2ttyOhqhUtk,1026 +transformers/models/vits/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vits/__pycache__/configuration_vits.cpython-312.pyc,, +transformers/models/vits/__pycache__/modeling_vits.cpython-312.pyc,, +transformers/models/vits/__pycache__/tokenization_vits.cpython-312.pyc,, +transformers/models/vits/configuration_vits.py,sha256=KSF7D__c3W40_ilsxib_LWSq-2OgotSnU9F38vQJliE,14017 +transformers/models/vits/modeling_vits.py,sha256=A82KdoF0uofgAzZQ1vSxKBfF4g98F35GvCJ7ejjTjac,61434 +transformers/models/vits/tokenization_vits.py,sha256=0TjYs-5TIx7K5ujDYCYz-bEl2SEOBrtM6of2chEqXaU,9402 +transformers/models/vivit/__init__.py,sha256=LT2FipIBdB69s9UY4viyuB5q2e0v3bCwtQMiOEOj2xg,1033 +transformers/models/vivit/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vivit/__pycache__/configuration_vivit.cpython-312.pyc,, +transformers/models/vivit/__pycache__/image_processing_vivit.cpython-312.pyc,, +transformers/models/vivit/__pycache__/modeling_vivit.cpython-312.pyc,, +transformers/models/vivit/configuration_vivit.py,sha256=SKyPstXxyrqMtQlhh73_O14wIT44ldCRUTQqEdsYBXk,5127 +transformers/models/vivit/image_processing_vivit.py,sha256=Zxlzx1tUw7QYjoRpJkMIvKCUz2fU3EG8jv41llp3qLs,18761 +transformers/models/vivit/modeling_vivit.py,sha256=KtfPe30MYR86PMyFltxkIJ5kBnoHYmpIA2mM4HZvQ3s,25907 +transformers/models/vjepa2/__init__.py,sha256=VpyCyuPpmmGMFjOOK4dG0E14Kb_wv5vn3CWyJ7dG7zk,1041 +transformers/models/vjepa2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/vjepa2/__pycache__/configuration_vjepa2.cpython-312.pyc,, +transformers/models/vjepa2/__pycache__/modeling_vjepa2.cpython-312.pyc,, +transformers/models/vjepa2/__pycache__/video_processing_vjepa2.cpython-312.pyc,, +transformers/models/vjepa2/configuration_vjepa2.py,sha256=BHXFNbz6svFGBrMsjuKirj-zeBCEo0IltvmxdNfxdio,7040 +transformers/models/vjepa2/modeling_vjepa2.py,sha256=3QZYY1cAwGyOzP7Gj8GwFSXQNYg7fGFLUk4XALmfZKg,44788 +transformers/models/vjepa2/video_processing_vjepa2.py,sha256=EAhWf1LAr8WF5cu_QNG34Wa6gDnDP__jyGdrZ-bRpFM,1739 +transformers/models/voxtral/__init__.py,sha256=79Rf85nRl4CR_MQPk1x12SviCaAnMITesrFTeeX4F8g,1038 +transformers/models/voxtral/__pycache__/__init__.cpython-312.pyc,, +transformers/models/voxtral/__pycache__/configuration_voxtral.cpython-312.pyc,, +transformers/models/voxtral/__pycache__/modeling_voxtral.cpython-312.pyc,, +transformers/models/voxtral/__pycache__/modular_voxtral.cpython-312.pyc,, +transformers/models/voxtral/__pycache__/processing_voxtral.cpython-312.pyc,, +transformers/models/voxtral/configuration_voxtral.py,sha256=dmvanRSOXmaRgCE9gsOni4Fm8skT0Ieqh-fnc38nesU,8410 +transformers/models/voxtral/modeling_voxtral.py,sha256=9emuzSpceFJPZ1hfJr6hKN4T2dGDC-i0xzxPIZKDp08,21800 +transformers/models/voxtral/modular_voxtral.py,sha256=jJT_Q0ZrcphCFtNzyNkXZt8rMWPG4fKMD9GG7CViQQY,11780 +transformers/models/voxtral/processing_voxtral.py,sha256=kFH9AhUnvzlPOpDVAErkiEd1i8aIXqstiKy9ZbhvBa0,18442 +transformers/models/voxtral_realtime/__init__.py,sha256=7xSSVk6n6J-niLQixx6mUsLLsaNU7PEGwibIyIiGBhk,1065 +transformers/models/voxtral_realtime/__pycache__/__init__.cpython-312.pyc,, +transformers/models/voxtral_realtime/__pycache__/configuration_voxtral_realtime.cpython-312.pyc,, +transformers/models/voxtral_realtime/__pycache__/feature_extraction_voxtral_realtime.cpython-312.pyc,, +transformers/models/voxtral_realtime/__pycache__/modeling_voxtral_realtime.cpython-312.pyc,, +transformers/models/voxtral_realtime/__pycache__/modular_voxtral_realtime.cpython-312.pyc,, +transformers/models/voxtral_realtime/__pycache__/processing_voxtral_realtime.cpython-312.pyc,, +transformers/models/voxtral_realtime/configuration_voxtral_realtime.py,sha256=ejlcGFCWWXNL-1JXehGT2EKljwrA0Rga8rqk7jNo6YQ,10625 +transformers/models/voxtral_realtime/feature_extraction_voxtral_realtime.py,sha256=9pEmv3rBiDhkpBeMLYlwQqpcDK_K2ERx_XXlXIwyPWU,12412 +transformers/models/voxtral_realtime/modeling_voxtral_realtime.py,sha256=D_BIrCvzLb_4zWDQk5NmwsyN2qKcK3YofLC_oa7WPPM,57471 +transformers/models/voxtral_realtime/modular_voxtral_realtime.py,sha256=OxA4To8TC1lqiymc7BJAz3CAjrEnc0MU4jJ-6lFCFVM,39022 +transformers/models/voxtral_realtime/processing_voxtral_realtime.py,sha256=3kk8ePc247IEX39a_-6jda6BtDm38lEYS0r6SjOngKc,9294 +transformers/models/wav2vec2/__init__.py,sha256=jc_01S-UEuKOfO2DY2mzogAoCZnLvrTlS_yDV9SQW5w,1124 +transformers/models/wav2vec2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/wav2vec2/__pycache__/configuration_wav2vec2.cpython-312.pyc,, +transformers/models/wav2vec2/__pycache__/feature_extraction_wav2vec2.cpython-312.pyc,, +transformers/models/wav2vec2/__pycache__/modeling_wav2vec2.cpython-312.pyc,, +transformers/models/wav2vec2/__pycache__/processing_wav2vec2.cpython-312.pyc,, +transformers/models/wav2vec2/__pycache__/tokenization_wav2vec2.cpython-312.pyc,, +transformers/models/wav2vec2/configuration_wav2vec2.py,sha256=JObEyzEq8Bz2TjOg89TzPSrNKJA4R5ZMo6ILwnVEMi0,20104 +transformers/models/wav2vec2/feature_extraction_wav2vec2.py,sha256=5emguvcHFv7lA_T2anphMSoTK-mJstfiZJ4FfMvvosw,11461 +transformers/models/wav2vec2/modeling_wav2vec2.py,sha256=FnOTxU1KfwYtO_l5xHDin6KxE9vExhIzkps_tn6mi6I,92112 +transformers/models/wav2vec2/processing_wav2vec2.py,sha256=la2vToOYyj1yVw66MpJdzZZO07ACfvmr_x_SRUqW1Vk,4105 +transformers/models/wav2vec2/tokenization_wav2vec2.py,sha256=u9I5G5iiCR0X7Wne16i7ULbvANXCoO9k3Uj7BUNLC2A,28843 +transformers/models/wav2vec2_bert/__init__.py,sha256=DL010VL3ZV3lAugPH-BOTNSgIedotOEaoy8iHo0sC1Q,1051 +transformers/models/wav2vec2_bert/__pycache__/__init__.cpython-312.pyc,, +transformers/models/wav2vec2_bert/__pycache__/configuration_wav2vec2_bert.cpython-312.pyc,, +transformers/models/wav2vec2_bert/__pycache__/modeling_wav2vec2_bert.cpython-312.pyc,, +transformers/models/wav2vec2_bert/__pycache__/modular_wav2vec2_bert.cpython-312.pyc,, +transformers/models/wav2vec2_bert/__pycache__/processing_wav2vec2_bert.cpython-312.pyc,, +transformers/models/wav2vec2_bert/configuration_wav2vec2_bert.py,sha256=PYiTbIIqa9txnY-m4ChXgC1o1N1NbL2mz48cG4zUYrY,18169 +transformers/models/wav2vec2_bert/modeling_wav2vec2_bert.py,sha256=JrNsh-nwjTEcuoRxKzlJA6SDzipS1cEpwFFm7_k6ivU,66620 +transformers/models/wav2vec2_bert/modular_wav2vec2_bert.py,sha256=DQCNV1V9YKC7pwntFdeAFAvaMDJKyAD8h0vYDy8ofvo,45274 +transformers/models/wav2vec2_bert/processing_wav2vec2_bert.py,sha256=EVdhaO29UKL23HTimd5t0a1wTW6O9Vi5WCNGC_HZcsQ,4230 +transformers/models/wav2vec2_conformer/__init__.py,sha256=JBpapW8VF3yck4Bk29xKyUiQZqB_CXLSYtYxXGXAu2Q,1017 +transformers/models/wav2vec2_conformer/__pycache__/__init__.cpython-312.pyc,, +transformers/models/wav2vec2_conformer/__pycache__/configuration_wav2vec2_conformer.cpython-312.pyc,, +transformers/models/wav2vec2_conformer/__pycache__/modeling_wav2vec2_conformer.cpython-312.pyc,, +transformers/models/wav2vec2_conformer/__pycache__/modular_wav2vec2_conformer.cpython-312.pyc,, +transformers/models/wav2vec2_conformer/configuration_wav2vec2_conformer.py,sha256=26ATO-ZerENQo9pkDzaHX0wsdOYkc40DYjsvQzsDkks,20965 +transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py,sha256=zHz1I5c3WzcmTuiOJ5Q9KTNojpNJQacZ0MXw1S4PGE8,85961 +transformers/models/wav2vec2_conformer/modular_wav2vec2_conformer.py,sha256=0_Z45el2aM6rMUuGm7y0Kbt48c7bWSRAe12MY0H6_V0,30722 +transformers/models/wav2vec2_phoneme/__init__.py,sha256=LV4FKcFYNt0GuJvfsUOwTYVFRVfuzUuclKRybFyN9lk,967 +transformers/models/wav2vec2_phoneme/__pycache__/__init__.cpython-312.pyc,, +transformers/models/wav2vec2_phoneme/__pycache__/tokenization_wav2vec2_phoneme.cpython-312.pyc,, +transformers/models/wav2vec2_phoneme/tokenization_wav2vec2_phoneme.py,sha256=vshAJq_PHEs5cZDkmFh_JdCwmVY81u_ouuoR5BJ050Y,22848 +transformers/models/wav2vec2_with_lm/__init__.py,sha256=yZKHsma85j7AMLB8g8uNXL5D_E5Gc3Vqe-D-V2W15oY,965 +transformers/models/wav2vec2_with_lm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/wav2vec2_with_lm/__pycache__/processing_wav2vec2_with_lm.cpython-312.pyc,, +transformers/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.py,sha256=WbCAA5CaEeQDUeuFb3HwX-rXVXLM346TuY-WABeQ4ew,27470 +transformers/models/wavlm/__init__.py,sha256=wYnYuOpw2e95lauqDbD7u3OC-Pez8yoRsrgExSh_WJQ,991 +transformers/models/wavlm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/wavlm/__pycache__/configuration_wavlm.cpython-312.pyc,, +transformers/models/wavlm/__pycache__/modeling_wavlm.cpython-312.pyc,, +transformers/models/wavlm/__pycache__/modular_wavlm.cpython-312.pyc,, +transformers/models/wavlm/configuration_wavlm.py,sha256=IXCNe5s6e8qtPT3mYz8GPZGvi44cLV10HoRyIbYN9iQ,18615 +transformers/models/wavlm/modeling_wavlm.py,sha256=UBYbBST4r9kik-ipPCAWk5JPYwSBrQK-Bl7H6vJ-Ink,70091 +transformers/models/wavlm/modular_wavlm.py,sha256=B21bwv6Rp_FZJqyqgAKnaTw7QiD-bu6oR6xb9tLa20o,23192 +transformers/models/whisper/__init__.py,sha256=0PLlY8YXw9EADkK4hYK-E8ZaR_46sujYbzefSXOyQD4,1119 +transformers/models/whisper/__pycache__/__init__.cpython-312.pyc,, +transformers/models/whisper/__pycache__/configuration_whisper.cpython-312.pyc,, +transformers/models/whisper/__pycache__/english_normalizer.cpython-312.pyc,, +transformers/models/whisper/__pycache__/feature_extraction_whisper.cpython-312.pyc,, +transformers/models/whisper/__pycache__/generation_whisper.cpython-312.pyc,, +transformers/models/whisper/__pycache__/modeling_whisper.cpython-312.pyc,, +transformers/models/whisper/__pycache__/processing_whisper.cpython-312.pyc,, +transformers/models/whisper/__pycache__/tokenization_whisper.cpython-312.pyc,, +transformers/models/whisper/configuration_whisper.py,sha256=fiigvpF927vjWKHyzxB0jTGEn0axFYRU__cnqlxqAw8,14701 +transformers/models/whisper/english_normalizer.py,sha256=7MFEktX8DRMyrqNymmzcfExIrqcr7OrPy824R7bBrIM,22804 +transformers/models/whisper/feature_extraction_whisper.py,sha256=NKbYqtn38nSBliKSnk_3S-KhNvzWH4Dslo-eBcRcfzo,16784 +transformers/models/whisper/generation_whisper.py,sha256=8Zdxhb4QeloYS4jzDFajv673WjSQi8Uru_WW4TGGR28,109268 +transformers/models/whisper/modeling_whisper.py,sha256=KDg3cQQRZtNuZYg8W0O1IRc94CLjoTUyXUyhtTykNz4,67392 +transformers/models/whisper/processing_whisper.py,sha256=lAYDAlcpwO0fDd-zO-NzIChkdsIO1UgqvYBuY5oCMNY,2101 +transformers/models/whisper/tokenization_whisper.py,sha256=7Vze8guYd_WoB1FJJlnKsqKFPrIzGZjmxirNrv-JvSI,57861 +transformers/models/x_clip/__init__.py,sha256=ufjh6w7SNuNAUjAHp_MK3yRcrHm22-SfhZ0ZfbiXhGw,1030 +transformers/models/x_clip/__pycache__/__init__.cpython-312.pyc,, +transformers/models/x_clip/__pycache__/configuration_x_clip.cpython-312.pyc,, +transformers/models/x_clip/__pycache__/modeling_x_clip.cpython-312.pyc,, +transformers/models/x_clip/__pycache__/processing_x_clip.cpython-312.pyc,, +transformers/models/x_clip/configuration_x_clip.py,sha256=7i9gee-bCx-OjND7nCCyryBx8Csc3JyTkBzUTwKoOTk,18461 +transformers/models/x_clip/modeling_x_clip.py,sha256=UXcKBXIeYuE1xUNiON2dx-WnFmvIEYOWNtTb1UD3-2Q,60858 +transformers/models/x_clip/processing_x_clip.py,sha256=SVDxdPgQClodpKJCFo6xkwxO2O8j8WHPWqCsqGm-P9c,983 +transformers/models/xcodec/__init__.py,sha256=X16pTVB3loZ9OMnqHAaxInF1X5EOhxlmHjyxEvoqSWE,993 +transformers/models/xcodec/__pycache__/__init__.cpython-312.pyc,, +transformers/models/xcodec/__pycache__/configuration_xcodec.cpython-312.pyc,, +transformers/models/xcodec/__pycache__/modeling_xcodec.cpython-312.pyc,, +transformers/models/xcodec/configuration_xcodec.py,sha256=kwpb1Z4_nx1Z_ZHsHz6lbSa4JQdFxGsjKHJMgGCW7UU,7878 +transformers/models/xcodec/modeling_xcodec.py,sha256=_Fmk7x3ANVNrxxpgLDgb1hGky-OlQfDQRfdn00TpWd4,25536 +transformers/models/xglm/__init__.py,sha256=9hKLQSFEPq3h3EOSrIJj7Hex0mtUKMx_OvplVlDmuOA,1026 +transformers/models/xglm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/xglm/__pycache__/configuration_xglm.cpython-312.pyc,, +transformers/models/xglm/__pycache__/modeling_xglm.cpython-312.pyc,, +transformers/models/xglm/__pycache__/tokenization_xglm.cpython-312.pyc,, +transformers/models/xglm/configuration_xglm.py,sha256=whGH1vOMRrWXF-LSg8oqLgPGijgHtSpMHsZPNgPO97o,6009 +transformers/models/xglm/modeling_xglm.py,sha256=CFfoNAex31xtIi_ZZw8H-1egc55R_x4MiRqwAOcHMQk,29445 +transformers/models/xglm/tokenization_xglm.py,sha256=5uQZlWjFNi5fw3KeDqxoUfIujDsRHE6KJxUVtNSFfiM,5185 +transformers/models/xlm/__init__.py,sha256=P7Y7S7kLVM6Ww21JlaJYU7wmWagdieMfBoTycNZ5syU,1023 +transformers/models/xlm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/xlm/__pycache__/configuration_xlm.cpython-312.pyc,, +transformers/models/xlm/__pycache__/modeling_xlm.cpython-312.pyc,, +transformers/models/xlm/__pycache__/tokenization_xlm.cpython-312.pyc,, +transformers/models/xlm/configuration_xlm.py,sha256=LmiXN-3jJR7BJdZoGBB9Z_J3LHv-A0w7qhQ_syMjGGE,10443 +transformers/models/xlm/modeling_xlm.py,sha256=YJ3R0xfwBy_ow-TgIOM-SI4QpU2rG1nqmbtLv9hNSsI,73560 +transformers/models/xlm/tokenization_xlm.py,sha256=g_yHWpJ34iTTN0oOsAzoGgjuWrygv-PLv6NDkxpTXBg,23357 +transformers/models/xlm_roberta/__init__.py,sha256=-FQ--ViqECUGBbnvEqwsodV_ZHis5j565quw2s3ZoU0,1096 +transformers/models/xlm_roberta/__pycache__/__init__.cpython-312.pyc,, +transformers/models/xlm_roberta/__pycache__/configuration_xlm_roberta.cpython-312.pyc,, +transformers/models/xlm_roberta/__pycache__/modeling_xlm_roberta.cpython-312.pyc,, +transformers/models/xlm_roberta/__pycache__/modular_xlm_roberta.cpython-312.pyc,, +transformers/models/xlm_roberta/__pycache__/tokenization_xlm_roberta.cpython-312.pyc,, +transformers/models/xlm_roberta/configuration_xlm_roberta.py,sha256=a0tl8hMnZs2VgSSEN-bMuViqSKrGSMRkpjMLdZAx7zI,6322 +transformers/models/xlm_roberta/modeling_xlm_roberta.py,sha256=gfwlh3XIgJx9r_UXl-KtLm6iZ2r_wttq8V40wOComwc,54029 +transformers/models/xlm_roberta/modular_xlm_roberta.py,sha256=h5gMUNCgRlBoWixb5o4BiKEflVTDqer82zsnwl7Eg30,23214 +transformers/models/xlm_roberta/tokenization_xlm_roberta.py,sha256=QvJPE0U5XWDJBQ4RdxcEmklq_Gumih2SBO4tvVCIH4g,4794 +transformers/models/xlm_roberta_xl/__init__.py,sha256=V0fXTKk2hQmf5dKogCJ0HSiRBxVX-rs7c414ZoZIh28,1009 +transformers/models/xlm_roberta_xl/__pycache__/__init__.cpython-312.pyc,, +transformers/models/xlm_roberta_xl/__pycache__/configuration_xlm_roberta_xl.cpython-312.pyc,, +transformers/models/xlm_roberta_xl/__pycache__/modeling_xlm_roberta_xl.cpython-312.pyc,, +transformers/models/xlm_roberta_xl/__pycache__/modular_xlm_roberta_xl.cpython-312.pyc,, +transformers/models/xlm_roberta_xl/configuration_xlm_roberta_xl.py,sha256=Fq9c2WPte7kt0LKYH8nrvlZk1vUAeuyzHEFB8lAnlc0,6089 +transformers/models/xlm_roberta_xl/modeling_xlm_roberta_xl.py,sha256=FEGXqjLixEkYNLXHBdY086vb12S_7CA2SrHIRJAI3xE,51859 +transformers/models/xlm_roberta_xl/modular_xlm_roberta_xl.py,sha256=ZL4yr29cAgieYO9nG4kXhM1G7S-3Yn16JhooPGmBCd4,29818 +transformers/models/xlnet/__init__.py,sha256=duiSzkjZEX4hcXiYQ6O49FLoa5UMuKtMahrF5QnDM_Y,1029 +transformers/models/xlnet/__pycache__/__init__.cpython-312.pyc,, +transformers/models/xlnet/__pycache__/configuration_xlnet.cpython-312.pyc,, +transformers/models/xlnet/__pycache__/modeling_xlnet.cpython-312.pyc,, +transformers/models/xlnet/__pycache__/tokenization_xlnet.cpython-312.pyc,, +transformers/models/xlnet/configuration_xlnet.py,sha256=qCFmK4bmLjyJmjUA-4dLDu1IO-MhbVjq7qxg4WI7YLk,10413 +transformers/models/xlnet/modeling_xlnet.py,sha256=D_dKyxANxcPNrfD8yfJUb0Gla2UWqV07zMJszQ7gECo,97569 +transformers/models/xlnet/tokenization_xlnet.py,sha256=Rrp8n_Gu1yofyNhWkgjpEb7Zs0Iz2kCecCJE1xFPqfM,7668 +transformers/models/xlstm/__init__.py,sha256=-Vfj7bUcDAD3TguoDgKW0zpzZ8KtOmnUNwSkvL6Df8k,1047 +transformers/models/xlstm/__pycache__/__init__.cpython-312.pyc,, +transformers/models/xlstm/__pycache__/configuration_xlstm.cpython-312.pyc,, +transformers/models/xlstm/__pycache__/modeling_xlstm.cpython-312.pyc,, +transformers/models/xlstm/configuration_xlstm.py,sha256=NYucYOU_UXCflnRmXuA0YJ-FS3lrmnlc70PSEPc6V58,12794 +transformers/models/xlstm/modeling_xlstm.py,sha256=CS13JKPTSuY7bsb6MS0dO8KNfHiKcoABhamvLA9ygsI,64628 +transformers/models/xmod/__init__.py,sha256=WLxIbzC8oCEkMrerWHTy7GLopz0mqocSaacdcyb_BhQ,989 +transformers/models/xmod/__pycache__/__init__.cpython-312.pyc,, +transformers/models/xmod/__pycache__/configuration_xmod.cpython-312.pyc,, +transformers/models/xmod/__pycache__/modeling_xmod.cpython-312.pyc,, +transformers/models/xmod/configuration_xmod.py,sha256=WRgBTFZJAwZLZDRECN4ZOXgjMRS4x8-kqCkitkP1ju8,8013 +transformers/models/xmod/modeling_xmod.py,sha256=Gz2IzbHwfe0vJxsncTvfxBIHpx2jyzOiYFyXRfoav6U,60008 +transformers/models/yolos/__init__.py,sha256=UlbQDtMQJaGRcin-iz6NOEFWT8otanBndRuw4VrWUiQ,1124 +transformers/models/yolos/__pycache__/__init__.cpython-312.pyc,, +transformers/models/yolos/__pycache__/configuration_yolos.cpython-312.pyc,, +transformers/models/yolos/__pycache__/image_processing_yolos.cpython-312.pyc,, +transformers/models/yolos/__pycache__/image_processing_yolos_fast.cpython-312.pyc,, +transformers/models/yolos/__pycache__/modeling_yolos.cpython-312.pyc,, +transformers/models/yolos/__pycache__/modular_yolos.cpython-312.pyc,, +transformers/models/yolos/configuration_yolos.py,sha256=QdDYiCoDudP_FO8EWGsOiLjBCjj-uFW92Jo9FtIQHVE,6983 +transformers/models/yolos/image_processing_yolos.py,sha256=i5r7c4yLZNh7Trt1TuSM7mgo8Y49GkLpwq5nJHwQN1U,63407 +transformers/models/yolos/image_processing_yolos_fast.py,sha256=-gx9V4c_ied9l8ikhekrN9oc67w2AbLwscOeU7zdhjw,29683 +transformers/models/yolos/modeling_yolos.py,sha256=UofdusXxXJYRttM3anPlb2vPz0NdToUFlA9FQ7XAWR0,27349 +transformers/models/yolos/modular_yolos.py,sha256=-mvDuzCGaZTvcN6psyLpf_Xi-svZCXT65OZbXkWvLGU,5043 +transformers/models/yoso/__init__.py,sha256=sCXsXYZuOQLFkZMexRb8qY7EJCftR54G_eO7qIUvdss,989 +transformers/models/yoso/__pycache__/__init__.cpython-312.pyc,, +transformers/models/yoso/__pycache__/configuration_yoso.cpython-312.pyc,, +transformers/models/yoso/__pycache__/modeling_yoso.cpython-312.pyc,, +transformers/models/yoso/configuration_yoso.py,sha256=uHNIWaL3Yo_kgcfhngJSSNYdH0Tdz51HqFKHUp8V0h8,6625 +transformers/models/yoso/modeling_yoso.py,sha256=d5Im1O2z9RPLnwlEtYeLbuVjbDORuo_4oxvSeP0KlL8,46052 +transformers/models/youtu/__init__.py,sha256=NiHuSA5gdHBMrrsi5C8nCRGL5LRvKkEBf2hAzzT-csU,996 +transformers/models/youtu/__pycache__/__init__.cpython-312.pyc,, +transformers/models/youtu/__pycache__/configuration_youtu.cpython-312.pyc,, +transformers/models/youtu/__pycache__/modeling_youtu.cpython-312.pyc,, +transformers/models/youtu/__pycache__/modular_youtu.cpython-312.pyc,, +transformers/models/youtu/configuration_youtu.py,sha256=mK2qGDgfHvclDtmMDy7MD8ya1EhzMogcEkPkgnv7Ge8,10169 +transformers/models/youtu/modeling_youtu.py,sha256=_91O8Ah6df8kHrvfC6vGAs0DxKtofn_lxFYIjPB7b-g,27113 +transformers/models/youtu/modular_youtu.py,sha256=YtpqL6Z_iptQ6dMXGmV81rlmNiiE3joezNLl_W4oVGg,10769 +transformers/models/zamba/__init__.py,sha256=iqZnf8BQ49TLcB4mYwIfuJeF4aGvYhOBRiGI6_74ZFk,991 +transformers/models/zamba/__pycache__/__init__.cpython-312.pyc,, +transformers/models/zamba/__pycache__/configuration_zamba.cpython-312.pyc,, +transformers/models/zamba/__pycache__/modeling_zamba.cpython-312.pyc,, +transformers/models/zamba/configuration_zamba.py,sha256=vcVAmOLJqr-j1vabfIr7KPoL-YumqRUoLCBrO2eHrqI,11262 +transformers/models/zamba/modeling_zamba.py,sha256=tXQfL_iOetOJ7oBS1mIKqxa6OY6AgIrVBX21f0soCt8,57156 +transformers/models/zamba2/__init__.py,sha256=3FgH8KelorllnKF6ncpKGREwZXt6YwsQ7NPS8W6jcmQ,993 +transformers/models/zamba2/__pycache__/__init__.cpython-312.pyc,, +transformers/models/zamba2/__pycache__/configuration_zamba2.cpython-312.pyc,, +transformers/models/zamba2/__pycache__/modeling_zamba2.cpython-312.pyc,, +transformers/models/zamba2/__pycache__/modular_zamba2.cpython-312.pyc,, +transformers/models/zamba2/configuration_zamba2.py,sha256=XohSWyWfQbj_fe5qpxver-1vOwH7Mc-uymLOnhb2bGA,12786 +transformers/models/zamba2/modeling_zamba2.py,sha256=0gwa3QOiBs1rlAfSovRZmwH1yilSbMrZHZ91wO74KZk,80186 +transformers/models/zamba2/modular_zamba2.py,sha256=EMBncS-_KwxhMlVehBVI5zpG4nxqXBQ40cco5Q012rY,53756 +transformers/models/zoedepth/__init__.py,sha256=BUGUeWtpJJRRdQGT1dIOi-B5v89Ae8eTTxbEmVqiu0k,1092 +transformers/models/zoedepth/__pycache__/__init__.cpython-312.pyc,, +transformers/models/zoedepth/__pycache__/configuration_zoedepth.cpython-312.pyc,, +transformers/models/zoedepth/__pycache__/image_processing_zoedepth.cpython-312.pyc,, +transformers/models/zoedepth/__pycache__/image_processing_zoedepth_fast.cpython-312.pyc,, +transformers/models/zoedepth/__pycache__/modeling_zoedepth.cpython-312.pyc,, +transformers/models/zoedepth/configuration_zoedepth.py,sha256=K3rj4yb0b5vBmIZTt95ZXokhsswemB0QjzvpznRPmPw,11207 +transformers/models/zoedepth/image_processing_zoedepth.py,sha256=leMBNG4KVn2bJeR3O48ybU2herpJqmYC9BfowM7wVfs,28963 +transformers/models/zoedepth/image_processing_zoedepth_fast.py,sha256=VfK2bJ8hQjPb2NGXUstR68S_N0EdksHtVus8qzRo8iw,11983 +transformers/models/zoedepth/modeling_zoedepth.py,sha256=PUC3GcBbI_JX3SiCIPxa_cmd6yx0ESNBr7f49JG6s_4,54321 +transformers/optimization.py,sha256=eENDHMtyZIxHqcjNJFMtLREeiFfkjtzrXG6BIqvZtRM,39891 +transformers/pipelines/__init__.py,sha256=aVXsdYFmjCzMJ828ekGjS4HAY24rVnRKN1OjDxem2BM,69115 +transformers/pipelines/__pycache__/__init__.cpython-312.pyc,, +transformers/pipelines/__pycache__/any_to_any.cpython-312.pyc,, +transformers/pipelines/__pycache__/audio_classification.cpython-312.pyc,, +transformers/pipelines/__pycache__/audio_utils.cpython-312.pyc,, +transformers/pipelines/__pycache__/automatic_speech_recognition.cpython-312.pyc,, +transformers/pipelines/__pycache__/base.cpython-312.pyc,, +transformers/pipelines/__pycache__/depth_estimation.cpython-312.pyc,, +transformers/pipelines/__pycache__/document_question_answering.cpython-312.pyc,, +transformers/pipelines/__pycache__/feature_extraction.cpython-312.pyc,, +transformers/pipelines/__pycache__/fill_mask.cpython-312.pyc,, +transformers/pipelines/__pycache__/image_classification.cpython-312.pyc,, +transformers/pipelines/__pycache__/image_feature_extraction.cpython-312.pyc,, +transformers/pipelines/__pycache__/image_segmentation.cpython-312.pyc,, +transformers/pipelines/__pycache__/image_text_to_text.cpython-312.pyc,, +transformers/pipelines/__pycache__/image_to_image.cpython-312.pyc,, +transformers/pipelines/__pycache__/keypoint_matching.cpython-312.pyc,, +transformers/pipelines/__pycache__/mask_generation.cpython-312.pyc,, +transformers/pipelines/__pycache__/object_detection.cpython-312.pyc,, +transformers/pipelines/__pycache__/pt_utils.cpython-312.pyc,, +transformers/pipelines/__pycache__/question_answering.cpython-312.pyc,, +transformers/pipelines/__pycache__/table_question_answering.cpython-312.pyc,, +transformers/pipelines/__pycache__/text_classification.cpython-312.pyc,, +transformers/pipelines/__pycache__/text_generation.cpython-312.pyc,, +transformers/pipelines/__pycache__/text_to_audio.cpython-312.pyc,, +transformers/pipelines/__pycache__/token_classification.cpython-312.pyc,, +transformers/pipelines/__pycache__/video_classification.cpython-312.pyc,, +transformers/pipelines/__pycache__/visual_question_answering.cpython-312.pyc,, +transformers/pipelines/__pycache__/zero_shot_audio_classification.cpython-312.pyc,, +transformers/pipelines/__pycache__/zero_shot_classification.cpython-312.pyc,, +transformers/pipelines/__pycache__/zero_shot_image_classification.cpython-312.pyc,, +transformers/pipelines/__pycache__/zero_shot_object_detection.cpython-312.pyc,, +transformers/pipelines/any_to_any.py,sha256=1mmbt6Xf07SWrdHkRmJuVsKcQJRyHhRI8k19lOpWX6Q,24680 +transformers/pipelines/audio_classification.py,sha256=JZg1fxtxoHEyWkI9i5IZik_Wiunm1u9PQqucW6Ij0kM,11074 +transformers/pipelines/audio_utils.py,sha256=WsfwXqFVypl161NslcANX5KSb8yNWZaJ8iMJc74oIqg,12191 +transformers/pipelines/automatic_speech_recognition.py,sha256=_knXQBXpUE5aiDSYRVeZTB0JBKrBgXzKepCgHc2WA2o,33511 +transformers/pipelines/base.py,sha256=jwKRV2VohE5SrqIaeasSKTSaF5qEuQA-8bi7u9pBU9k,59155 +transformers/pipelines/depth_estimation.py,sha256=DskN8ZSr9fG63bxB2MLoL6baSLd5AnXd8edlHZgyi6U,6115 +transformers/pipelines/document_question_answering.py,sha256=h1ya7nDfRchD2-ZRVnpp4nqDNpegOQsQnBLkN8aNrPY,25269 +transformers/pipelines/feature_extraction.py,sha256=bvhwET2PwuMMHTXyO-IZTzuy78eoYUm-wO9mNbVyqTU,3406 +transformers/pipelines/fill_mask.py,sha256=3Au1MFhfq2x7fCP_66yKI1rnkvNTQk8TdORtcaulsLc,11064 +transformers/pipelines/image_classification.py,sha256=94dhxM9yixOWl6caJooKU_LkbUE20IqUcqsplVKFlfg,9880 +transformers/pipelines/image_feature_extraction.py,sha256=KdDTJoXMg8tuGGXmGEsXlEN3G_-qNiJB2NoRznjY13w,4794 +transformers/pipelines/image_segmentation.py,sha256=AkJiNMpo5h7P6yAOIrKzhuJqkv6cxT_lZTRVFLd-L_M,9748 +transformers/pipelines/image_text_to_text.py,sha256=pd-iL8nZiOHpGOpievzT4oaGvv-zHgn0cXLcYMW1Bak,21352 +transformers/pipelines/image_to_image.py,sha256=X5dctyPh61iYOG7dm7r5CmwvXe7fKAOsH0fmWtViUSs,5261 +transformers/pipelines/keypoint_matching.py,sha256=yf6w0ru1iPRKhkE3Z11lVGzPfnf_-zUCpTIHliRoa6s,7056 +transformers/pipelines/mask_generation.py,sha256=lUPtS9Bvz-VMX3vtGiqqzPu0vXVIO-rDNoCSYpu0MI4,15328 +transformers/pipelines/object_detection.py,sha256=B6iAuT0x5XaZxcZExjyC8fYGykaKDuiaiMMlihQ1F9g,8346 +transformers/pipelines/pt_utils.py,sha256=DtNVgO1ud1n0bYMwJclMvnIJqtoNs9aedcXuCvJL_SM,12816 +transformers/pipelines/question_answering.py,sha256=4bntPMxYA6oqQ-jKL4GwhLPxiuWx5TWcLgKLYOuLTQg,28793 +transformers/pipelines/table_question_answering.py,sha256=ZAkeA2UISRSkCMph6JEMuPnaoDgyD_7hAixIxO1cD_I,17171 +transformers/pipelines/text_classification.py,sha256=C66ihBlJVY0H-H7YlqY88RdbHhTuBROh7HIOVl4FNPs,9975 +transformers/pipelines/text_generation.py,sha256=EtN8GJkjsTFKDTW85_sx_3XVstHgwT-5B5Ye6RVuhDU,24920 +transformers/pipelines/text_to_audio.py,sha256=k_bc306uoF1l9dTEGErHNwswPQL1A-CBqztaROEdtuc,13103 +transformers/pipelines/token_classification.py,sha256=SfdSFdb0sKxaqbO6l_OOP0pbHl6dnDAhYo4i-V-oX2o,28882 +transformers/pipelines/video_classification.py,sha256=zYygC0MKsUUuCtp-OJD7pmqUiuC354Z_QIKyp54vV0E,7628 +transformers/pipelines/visual_question_answering.py,sha256=YDS7RexlDieFgj2_6PLUjBE75YiPldK27FEGbmoJ7_U,9599 +transformers/pipelines/zero_shot_audio_classification.py,sha256=iAcpyeO3QLGkliwHe7mha7AlDy2NNGv6WtbI7-5QqIY,6687 +transformers/pipelines/zero_shot_classification.py,sha256=B-0_i7OVYbyBA2wo3izjL__AxiEXW0JoOPNtyxMaqAQ,11976 +transformers/pipelines/zero_shot_image_classification.py,sha256=Ph0sKorUOLy5CZbQHLVZ5YH096vPMXirILFsu9hACCE,7644 +transformers/pipelines/zero_shot_object_detection.py,sha256=g6X6znGVEZYDbXUB1EuaglZgzRQJ_bbCYpbcLwRqs_8,10393 +transformers/processing_utils.py,sha256=6h7RaVXIKTI-qVVmyo9_fgEXnZnqSrKQAAyYCwuDenc,96329 +transformers/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +transformers/pytorch_utils.py,sha256=HRrgl9LJtKFlFr1YjylByRs-yfiuWt6Q4Y2_qp9YiJQ,10077 +transformers/quantizers/__init__.py,sha256=S_xTSTbkDOvjLgR3jgR4EAkP_sc3NE8e38T-lllAaNo,800 +transformers/quantizers/__pycache__/__init__.cpython-312.pyc,, +transformers/quantizers/__pycache__/auto.cpython-312.pyc,, +transformers/quantizers/__pycache__/base.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_aqlm.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_auto_round.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_awq.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_bitnet.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_bnb_4bit.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_bnb_8bit.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_compressed_tensors.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_eetq.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_fbgemm_fp8.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_finegrained_fp8.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_fp_quant.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_gptq.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_higgs.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_hqq.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_mxfp4.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_quanto.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_quark.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_sinq.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_spqr.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_torchao.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizer_vptq.cpython-312.pyc,, +transformers/quantizers/__pycache__/quantizers_utils.cpython-312.pyc,, +transformers/quantizers/auto.py,sha256=CRUOibmlM-YV8Elsy0EFotb_fWE82B65F4f2jDXh17M,13901 +transformers/quantizers/base.py,sha256=z8jC3Dr_80-3IpUYRob_lccgG4NzF_As3luWUapFMdg,12727 +transformers/quantizers/quantizer_aqlm.py,sha256=V5P2jlHwMAkfXBDmieUSu85-MJRIZXG9WrOY4Zd6jvE,2567 +transformers/quantizers/quantizer_auto_round.py,sha256=VbVkIrKju6WyP5UrhgEVMBap46MWURP_M2WeHqqfpV4,2686 +transformers/quantizers/quantizer_awq.py,sha256=UEx7Mz9VA73hPKoKmvMV3yFENnY0LiyqRxCXoHcwl0g,3680 +transformers/quantizers/quantizer_bitnet.py,sha256=yblRZyo7cD2wGqA6wRYNVfz6i3kf3VEnUS9Fli3QvYI,4426 +transformers/quantizers/quantizer_bnb_4bit.py,sha256=4ru6Iza4jLd5xJ7I2snpTj6v1U7IbxffGg1i5kxPGuI,7087 +transformers/quantizers/quantizer_bnb_8bit.py,sha256=meDXj5J_aI3XkvRO5IHJlZhcmXu_J6lxqpIxzh1qFXE,6751 +transformers/quantizers/quantizer_compressed_tensors.py,sha256=TiDPs8OnwxYE1S6ZtkjGAyHkwCIqx1QRFQVOlRTNcsw,4781 +transformers/quantizers/quantizer_eetq.py,sha256=x6SJMlML06w9_slKyq2vQt43Y5To_j8bjTTPDkftRP4,3841 +transformers/quantizers/quantizer_fbgemm_fp8.py,sha256=qblr4bf775KbYhPuMPNQNvAGzZgOWryh4fScqOYjUsY,9722 +transformers/quantizers/quantizer_finegrained_fp8.py,sha256=-EaG0G_7AVCvQKfRwiMju1V0WdkPFzZpsw7L2qr3le0,6829 +transformers/quantizers/quantizer_fp_quant.py,sha256=zlGvtTAOd2YuIZIjQPSRLkLD7B9tdZCr2dCxf2OsazY,6197 +transformers/quantizers/quantizer_gptq.py,sha256=wrz1-E8jOCKJTW3BuhhAyYwTm5twc9j0E1KH4yl1wv4,4334 +transformers/quantizers/quantizer_higgs.py,sha256=1paXt3YWa1TuILsMbYvMpWzK9pivvxcwfRt5uD0xGuU,7390 +transformers/quantizers/quantizer_hqq.py,sha256=5Thh7fTBkY3wHYJiesN2Tcb3jNZuWeyAyCLtHuSBtfU,11059 +transformers/quantizers/quantizer_mxfp4.py,sha256=izFRKQZRYcWjA1yDxnOax7KNdfRWYY70EN_iG7AOEhQ,11772 +transformers/quantizers/quantizer_quanto.py,sha256=H0X93tCjDQCnqMsvAV9s1cCfk28htKH8jQ9szy2x4Kc,4761 +transformers/quantizers/quantizer_quark.py,sha256=-zkhx5YpOmU_-xcsOKJ1FzfgGLHMOMds0ULD57EU6Gg,4519 +transformers/quantizers/quantizer_sinq.py,sha256=_YavZy6XnqrOnGGUl2BK1cLYyraKKmCEDhb4RZD0TqQ,9482 +transformers/quantizers/quantizer_spqr.py,sha256=dPTgHzyvXjLTQ1U3YhjuUlOpagZ72nAxcrIfByrSgqA,2688 +transformers/quantizers/quantizer_torchao.py,sha256=tDbjLTt0W405fiGWNWnvt5g7rsFlLvWRs4cTXl2Ak_I,11498 +transformers/quantizers/quantizer_vptq.py,sha256=xmV5b_f0iJTbxkxJL9d1QPAcKls1HG6cPH1o3GqyA1o,2416 +transformers/quantizers/quantizers_utils.py,sha256=GqiyI9-Qf1hvdPwgsAzILMsElbQYsxAQBrYIm7gmagg,1717 +transformers/safetensors_conversion.py,sha256=aBJ_lN7RSXZ5uBQOu1BQY4eqlNkZCGhxIcVHhcsGSoU,4541 +transformers/testing_utils.py,sha256=9K8MyvIORH7y077sEDROYw2CvEqQaLmJm5VHD2gGaWQ,156557 +transformers/time_series_utils.py,sha256=6wfH0kcAucf05T7HJcAAjETE2wcoNneAus2UDQRg_d4,7480 +transformers/tokenization_mistral_common.py,sha256=GBmWmnf2gc17GecV6Y8gd4ze0s_RoNShqhdEZPH3MXk,79315 +transformers/tokenization_python.py,sha256=XU-QLL0nEg7zI2BGmcbfZwu3BHdFjbwfAWqcv39ErEw,63125 +transformers/tokenization_utils_base.py,sha256=o3ue9jbXIHEBiOveqpdgF-l3qrB8KCkYaYTy3DDwqMM,173390 +transformers/tokenization_utils_sentencepiece.py,sha256=eVBFeKcNFpODXnAtvHiLQvDk4POE-8BtAimXtAdHF_4,13649 +transformers/tokenization_utils_tokenizers.py,sha256=PZCKYIBj1SIFK-d4p2F6RHxJHxgPNjSJVLbYVwn6w0I,59899 +transformers/trainer.py,sha256=-ndkkzqv-Urics86VF7XjoXFTAtiqx4wnjr2MhCVoJU,215960 +transformers/trainer_callback.py,sha256=rsQVkk__kcar4mORDM8Nxzh8R0R7RlXvajKQgSlaAn0,33642 +transformers/trainer_jit_checkpoint.py,sha256=0UPaTOmfMyssbS_VPrtB-FIoNOf6jMk8BVymIGQDMaw,5274 +transformers/trainer_optimizer.py,sha256=FD-V5Y7njXMbX9M3nKQCIHzbs36qJSD09emjo6I5D6g,23082 +transformers/trainer_pt_utils.py,sha256=7LzAPaoMCCieajZ6cIl_51nuelHhK0AhSsDGf8ywd0E,57264 +transformers/trainer_seq2seq.py,sha256=jPTudxaPi771CEL6hWfjkGrrtChBnpdmlUnQNAe9CU8,18138 +transformers/trainer_utils.py,sha256=xGHCIhMplNkH9pSmSw70RUckzGUsgO2JkT5i6IT9rtI,49361 +transformers/training_args.py,sha256=M0ELHHdILDdViotP1r9M52IIkZ7LofvY0FdB6dwEHaQ,138733 +transformers/training_args_seq2seq.py,sha256=zjrJmh2VMnQgW-I4KclAUU56swWdYxkuHF3g_Oc7qGs,3847 +transformers/utils/__init__.py,sha256=iTDNwroL12PFwYRwQZzUOoJ_Z5HwKjMoKBFHWvnmh80,9323 +transformers/utils/__pycache__/__init__.cpython-312.pyc,, +transformers/utils/__pycache__/attention_visualizer.cpython-312.pyc,, +transformers/utils/__pycache__/auto_docstring.cpython-312.pyc,, +transformers/utils/__pycache__/backbone_utils.cpython-312.pyc,, +transformers/utils/__pycache__/chat_parsing_utils.cpython-312.pyc,, +transformers/utils/__pycache__/chat_template_utils.cpython-312.pyc,, +transformers/utils/__pycache__/constants.cpython-312.pyc,, +transformers/utils/__pycache__/deprecation.cpython-312.pyc,, +transformers/utils/__pycache__/doc.cpython-312.pyc,, +transformers/utils/__pycache__/dummy_detectron2_objects.cpython-312.pyc,, +transformers/utils/__pycache__/dummy_essentia_and_librosa_and_pretty_midi_and_scipy_and_torch_objects.cpython-312.pyc,, +transformers/utils/__pycache__/dummy_mistral_common_objects.cpython-312.pyc,, +transformers/utils/__pycache__/dummy_music_objects.cpython-312.pyc,, +transformers/utils/__pycache__/dummy_pt_objects.cpython-312.pyc,, +transformers/utils/__pycache__/dummy_sentencepiece_and_tokenizers_objects.cpython-312.pyc,, +transformers/utils/__pycache__/dummy_speech_objects.cpython-312.pyc,, +transformers/utils/__pycache__/dummy_timm_and_torchvision_objects.cpython-312.pyc,, +transformers/utils/__pycache__/dummy_tokenizers_objects.cpython-312.pyc,, +transformers/utils/__pycache__/dummy_torchaudio_objects.cpython-312.pyc,, +transformers/utils/__pycache__/dummy_torchvision_objects.cpython-312.pyc,, +transformers/utils/__pycache__/dummy_vision_objects.cpython-312.pyc,, +transformers/utils/__pycache__/generic.cpython-312.pyc,, +transformers/utils/__pycache__/hp_naming.cpython-312.pyc,, +transformers/utils/__pycache__/hub.cpython-312.pyc,, +transformers/utils/__pycache__/import_utils.cpython-312.pyc,, +transformers/utils/__pycache__/kernel_config.cpython-312.pyc,, +transformers/utils/__pycache__/loading_report.cpython-312.pyc,, +transformers/utils/__pycache__/logging.cpython-312.pyc,, +transformers/utils/__pycache__/metrics.cpython-312.pyc,, +transformers/utils/__pycache__/notebook.cpython-312.pyc,, +transformers/utils/__pycache__/output_capturing.cpython-312.pyc,, +transformers/utils/__pycache__/peft_utils.cpython-312.pyc,, +transformers/utils/__pycache__/pytest_helpers.cpython-312.pyc,, +transformers/utils/__pycache__/quantization_config.cpython-312.pyc,, +transformers/utils/__pycache__/sentencepiece_model_pb2.cpython-312.pyc,, +transformers/utils/__pycache__/sentencepiece_model_pb2_new.cpython-312.pyc,, +transformers/utils/__pycache__/type_validators.cpython-312.pyc,, +transformers/utils/__pycache__/versions.cpython-312.pyc,, +transformers/utils/attention_visualizer.py,sha256=ENM_nWnXYD72SeXIreTX_GR_ljWCd-AE-h_N8tx_Wbk,9987 +transformers/utils/auto_docstring.py,sha256=zyjzOLLFxgwGG68ktDbbQWfgv-mOA23rEN6_SaPqnsg,105444 +transformers/utils/backbone_utils.py,sha256=NBW7XA-8AA280RQ9sZaR6wYqy69bHeq0s_zpYlLN6us,699 +transformers/utils/chat_parsing_utils.py,sha256=7oo5EbIkP6tuWwsbKJ4ghZQbNXtTKqGJKCzmkK5T7OA,11277 +transformers/utils/chat_template_utils.py,sha256=fkjTCa-WuVZioLm4ORbQfh3eOIFuzpB4kBZVujhCY24,24376 +transformers/utils/constants.py,sha256=sZsUwOnA3CbtN1svs9YoaNLTTsAc9RVaITsgpf8K4iI,282 +transformers/utils/deprecation.py,sha256=9eOb1v_hJIypO3SHeyOTCBAnJytxhrvGh8mXn6N6tL8,8031 +transformers/utils/doc.py,sha256=-r8QF7oNWFlLudvvb98FD9ifwT_LU31BIcQgZRqa8ss,37221 +transformers/utils/dummy_detectron2_objects.py,sha256=n7Pt_7sbVBNfohKGcOARB-ZcPcJRbjEAcoLd2vTXndU,340 +transformers/utils/dummy_essentia_and_librosa_and_pretty_midi_and_scipy_and_torch_objects.py,sha256=n6pY4s7zCII3dzo7Ejd0RviHa_pMateuDEwbbHgsTUY,902 +transformers/utils/dummy_mistral_common_objects.py,sha256=_NEeG5StQyLHKZ_4OyTgvyxkxMBawME8knKX1y8Bqr8,309 +transformers/utils/dummy_music_objects.py,sha256=1lxIebYUOdHJWMQ_T5IQgPgcO_wp_8YM_HGc3skuGVg,458 +transformers/utils/dummy_pt_objects.py,sha256=3KwElc_huy-ynj6RSKBZMT_5dWlfA8LVC2kKclNAxJo,12894 +transformers/utils/dummy_sentencepiece_and_tokenizers_objects.py,sha256=BgPLr8Wz8A-17K86x04N21CKXtWNQLJEWx2c4aZRqaA,286 +transformers/utils/dummy_speech_objects.py,sha256=9eFm1cjdsYOPBoAz9JTgP35Bg8WF2C9AZ_y1hFpKZdQ,465 +transformers/utils/dummy_timm_and_torchvision_objects.py,sha256=EFuC5z6IsKOqqowoUGviJ3KgTjzvdTTN7gGQ3it-4t0,324 +transformers/utils/dummy_tokenizers_objects.py,sha256=PFIh5nBDmhWG2XDGuwIyBGldm6b_jdZdL3E8t5A8FsY,304 +transformers/utils/dummy_torchaudio_objects.py,sha256=EG0q0JkedoNb_4ntsf6EyTOE6Nr1whvHOzHPKy1t7x0,847 +transformers/utils/dummy_torchvision_objects.py,sha256=BaUQGsNL0Xfj-HP-pOVXSKYw5UFaNlWD_Iso9D8muGw,479 +transformers/utils/dummy_vision_objects.py,sha256=GDbX7-GrqykExLY91SMhSf508DinS5NSFfavbeDsCMU,630 +transformers/utils/generic.py,sha256=T0sdlHUH2Ub4x1Xe2OFgyxWGLBIsD5d-0EobC-Us2f4,33857 +transformers/utils/hp_naming.py,sha256=vqcOXcDOyqbISWo8-ClUJUOBVbZM1h08EcymTwcRthc,4979 +transformers/utils/hub.py,sha256=Hf8_7hHK2OJwec-HWB3zYlB1lNwVnPHbowFLZrVm1t0,38955 +transformers/utils/import_utils.py,sha256=6Ko-CmPFr18As7aQ_EgDhoHkLyc7DLNbioB4-wIPjC8,104076 +transformers/utils/kernel_config.py,sha256=EM2-9x4qcgx5-SFqow0xizTssYB932fb78akRLlWOo8,10288 +transformers/utils/loading_report.py,sha256=Q7xZojoaOqSp4Jn5ejv3PzrKlsicvBJuZ55LMftSZEk,10082 +transformers/utils/logging.py,sha256=5-p7krAeSwwP9X2h6eKfZvkerzyonlDo7MnkrKx_n3k,12185 +transformers/utils/metrics.py,sha256=LEJk-c65bszQ78uWZqQtCVNJxcJZjZ2wgoYQ36Yk85A,15583 +transformers/utils/notebook.py,sha256=VrNiVRVoj7X4jA_o2tH-9_77iPx4TTLysRk0IfuuChg,15711 +transformers/utils/output_capturing.py,sha256=rwRUo1LnoUpNUtPT3vFkQvt0hjvZJPHGyPxk4o6uZ94,12602 +transformers/utils/peft_utils.py,sha256=d12tVktSw2fVNQks6h1WH9twe9af8BqdaBL-h6bK2pw,4815 +transformers/utils/pytest_helpers.py,sha256=WjWr38_XlTI7DkTdMAkKGo1pcSOYaq0uVwpD-PSV2IU,3571 +transformers/utils/quantization_config.py,sha256=O0LdgIZH4LspSfnevRA95deJLUZw7leO98uqndOhfVc,87511 +transformers/utils/sentencepiece_model_pb2.py,sha256=WcMZRm2-571XwxSfo-6FZih9fDy_Zl5mMwqrDrC1Dlg,50663 +transformers/utils/sentencepiece_model_pb2_new.py,sha256=ahaV--amhGIL3nXFCTHqezqxuGXm8SHr_C3Zvj7KbAY,6598 +transformers/utils/type_validators.py,sha256=U1Sc1_UlNw94V2bJ2yky_YxnrrLkuu_a12NwqfG6vy8,5526 +transformers/utils/versions.py,sha256=WCo4WQGtDdOJlRXZ8UJCA41sRBSySmmbSj6cZQGHbIg,4306 +transformers/video_processing_utils.py,sha256=-Kqxqthjhjrc5D1f5-jU2SXliNaIa-cLslwrS87H0WU,40925 +transformers/video_utils.py,sha256=7wMoBWSJBcBHdl65sZWt_X4eKp3nR1iC3uv79PLPf_Q,34395 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..1ef5583317a5e59140e3f1c85c2db91aec0961e8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (82.0.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf2a3b68e9616562bcdd157626656933ea607c29 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +transformers = transformers.cli.transformers:main diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..976a2b1f3998279c10c413279a095be86bf69167 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers-5.2.0.dist-info/top_level.txt @@ -0,0 +1 @@ +transformers diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..cd2628afe25dbaaf55f2d7813e6e0d43b30a7f22 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/__init__.py @@ -0,0 +1,808 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# When adding a new object to this init, remember to add it twice: once inside the `_import_structure` dictionary and +# once inside the `if TYPE_CHECKING` branch. The `TYPE_CHECKING` should have import statements as usual, but they are +# only there for type checking. The `_import_structure` is a dictionary submodule to list of object names, and is used +# to defer the actual importing for when the objects are requested. This way `import transformers` provides the names +# in the namespace without actually importing anything (and especially none of the backends). + +__version__ = "5.2.0" + +import importlib +import sys +import types +from pathlib import Path +from typing import TYPE_CHECKING + +# Check the dependencies satisfy the minimal versions required. +from . import dependency_versions_check +from .utils import ( + OptionalDependencyNotAvailable, + _LazyModule, + is_essentia_available, + is_g2p_en_available, + is_librosa_available, + is_mistral_common_available, + is_mlx_available, + is_numba_available, + is_pretty_midi_available, +) + +# Note: the following symbols are deliberately exported with `as` +# so that mypy, pylint or other static linters can recognize them, +# given that they are not exported using `__all__` in this file. +from .utils import is_bitsandbytes_available as is_bitsandbytes_available +from .utils import is_scipy_available as is_scipy_available +from .utils import is_sentencepiece_available as is_sentencepiece_available +from .utils import is_speech_available as is_speech_available +from .utils import is_timm_available as is_timm_available +from .utils import is_tokenizers_available as is_tokenizers_available +from .utils import is_torch_available as is_torch_available +from .utils import is_torchaudio_available as is_torchaudio_available +from .utils import is_torchvision_available as is_torchvision_available +from .utils import is_vision_available as is_vision_available +from .utils import logging as logging +from .utils.import_utils import define_import_structure + + +logger = logging.get_logger(__name__) # pylint: disable=invalid-name + +# Base objects, independent of any specific backend +_import_structure = { + "audio_utils": [], + "cli": [], + "configuration_utils": ["PreTrainedConfig", "PretrainedConfig"], + "convert_slow_tokenizers_checkpoints_to_fast": [], + "data": [ + "DataProcessor", + "InputExample", + "InputFeatures", + "SingleSentenceClassificationProcessor", + "SquadExample", + "SquadFeatures", + "SquadV1Processor", + "SquadV2Processor", + "glue_compute_metrics", + "glue_convert_examples_to_features", + "glue_output_modes", + "glue_processors", + "glue_tasks_num_labels", + "squad_convert_examples_to_features", + "xnli_compute_metrics", + "xnli_output_modes", + "xnli_processors", + "xnli_tasks_num_labels", + ], + "data.data_collator": [ + "DataCollator", + "DataCollatorForLanguageModeling", + "DataCollatorForMultipleChoice", + "DataCollatorForPermutationLanguageModeling", + "DataCollatorForSeq2Seq", + "DataCollatorForSOP", + "DataCollatorForTokenClassification", + "DataCollatorForWholeWordMask", + "DataCollatorWithFlattening", + "DataCollatorWithPadding", + "DefaultDataCollator", + "default_data_collator", + ], + "data.metrics": [], + "data.processors": [], + "debug_utils": [], + "dependency_versions_check": [], + "dependency_versions_table": [], + "dynamic_module_utils": [], + "feature_extraction_sequence_utils": ["SequenceFeatureExtractor"], + "feature_extraction_utils": ["BatchFeature", "FeatureExtractionMixin"], + "file_utils": [], + "generation": [ + "AsyncTextIteratorStreamer", + "CompileConfig", + "GenerationConfig", + "TextIteratorStreamer", + "TextStreamer", + "WatermarkingConfig", + ], + "hf_argparser": ["HfArgumentParser"], + "hyperparameter_search": [], + "image_transforms": [], + "integrations": [ + "is_clearml_available", + "is_comet_available", + "is_dvclive_available", + "is_neptune_available", + "is_optuna_available", + "is_ray_available", + "is_ray_tune_available", + "is_swanlab_available", + "is_tensorboard_available", + "is_trackio_available", + "is_wandb_available", + ], + "loss": [], + "pipelines": [ + "AnyToAnyPipeline", + "AudioClassificationPipeline", + "AutomaticSpeechRecognitionPipeline", + "CsvPipelineDataFormat", + "DepthEstimationPipeline", + "DocumentQuestionAnsweringPipeline", + "FeatureExtractionPipeline", + "FillMaskPipeline", + "ImageClassificationPipeline", + "ImageFeatureExtractionPipeline", + "ImageSegmentationPipeline", + "ImageTextToTextPipeline", + "ImageToImagePipeline", + "JsonPipelineDataFormat", + "KeypointMatchingPipeline", + "MaskGenerationPipeline", + "NerPipeline", + "ObjectDetectionPipeline", + "PipedPipelineDataFormat", + "Pipeline", + "PipelineDataFormat", + "QuestionAnsweringPipeline", + "TableQuestionAnsweringPipeline", + "TextClassificationPipeline", + "TextGenerationPipeline", + "TextToAudioPipeline", + "TokenClassificationPipeline", + "VideoClassificationPipeline", + "VisualQuestionAnsweringPipeline", + "ZeroShotAudioClassificationPipeline", + "ZeroShotClassificationPipeline", + "ZeroShotImageClassificationPipeline", + "ZeroShotObjectDetectionPipeline", + "pipeline", + ], + "processing_utils": ["ProcessorMixin"], + "quantizers": [], + "testing_utils": [], + "tokenization_python": ["PreTrainedTokenizer", "PythonBackend"], + "tokenization_utils": [], + "tokenization_utils_base": [ + "AddedToken", + "BatchEncoding", + "CharSpan", + "PreTrainedTokenizerBase", + "TokenSpan", + ], + "tokenization_utils_fast": [], + "tokenization_utils_sentencepiece": ["SentencePieceBackend"], + "trainer_callback": [ + "DefaultFlowCallback", + "EarlyStoppingCallback", + "PrinterCallback", + "ProgressCallback", + "TrainerCallback", + "TrainerControl", + "TrainerState", + ], + "trainer_utils": [ + "EvalPrediction", + "IntervalStrategy", + "SchedulerType", + "enable_full_determinism", + "set_seed", + ], + "training_args": ["TrainingArguments"], + "training_args_seq2seq": ["Seq2SeqTrainingArguments"], + "utils": [ + "CONFIG_NAME", + "MODEL_CARD_NAME", + "SPIECE_UNDERLINE", + "WEIGHTS_NAME", + "TensorType", + "add_end_docstrings", + "add_start_docstrings", + "is_apex_available", + "is_av_available", + "is_bitsandbytes_available", + "is_datasets_available", + "is_faiss_available", + "is_matplotlib_available", + "is_mlx_available", + "is_phonemizer_available", + "is_psutil_available", + "is_py3nvml_available", + "is_pyctcdecode_available", + "is_sacremoses_available", + "is_scipy_available", + "is_sentencepiece_available", + "is_sklearn_available", + "is_speech_available", + "is_timm_available", + "is_tokenizers_available", + "is_torch_available", + "is_torch_hpu_available", + "is_torch_mlu_available", + "is_torch_musa_available", + "is_torch_neuroncore_available", + "is_torch_npu_available", + "is_torchvision_available", + "is_torch_xla_available", + "is_torch_xpu_available", + "is_vision_available", + "logging", + ], + "utils.import_utils": ["requires_backends"], + "utils.kernel_config": ["KernelConfig"], + "utils.quantization_config": [ + "AqlmConfig", + "AutoRoundConfig", + "AwqConfig", + "BitNetQuantConfig", + "BitsAndBytesConfig", + "CompressedTensorsConfig", + "EetqConfig", + "FbgemmFp8Config", + "FineGrainedFP8Config", + "FPQuantConfig", + "GPTQConfig", + "HiggsConfig", + "HqqConfig", + "Mxfp4Config", + "QuantoConfig", + "QuarkConfig", + "SinqConfig", + "SpQRConfig", + "TorchAoConfig", + "VptqConfig", + ], + "video_utils": [], +} + +# tokenizers-backed objects +try: + if not is_tokenizers_available(): + raise OptionalDependencyNotAvailable() +except OptionalDependencyNotAvailable: + from .utils import dummy_tokenizers_objects + + _import_structure["utils.dummy_tokenizers_objects"] = [ + name for name in dir(dummy_tokenizers_objects) if not name.startswith("_") + ] +else: + # Fast tokenizers structure + _import_structure["tokenization_utils_tokenizers"] = [ + "PreTrainedTokenizerFast", + "TokenizersBackend", + ] + + +try: + if not (is_sentencepiece_available() and is_tokenizers_available()): + raise OptionalDependencyNotAvailable() +except OptionalDependencyNotAvailable: + from .utils import dummy_sentencepiece_and_tokenizers_objects + + _import_structure["utils.dummy_sentencepiece_and_tokenizers_objects"] = [ + name for name in dir(dummy_sentencepiece_and_tokenizers_objects) if not name.startswith("_") + ] +else: + _import_structure["convert_slow_tokenizer"] = [ + "SLOW_TO_FAST_CONVERTERS", + "convert_slow_tokenizer", + ] + +try: + if not (is_mistral_common_available()): + raise OptionalDependencyNotAvailable() +except OptionalDependencyNotAvailable: + from .utils import dummy_mistral_common_objects + + _import_structure["utils.dummy_mistral_common_objects"] = [ + name for name in dir(dummy_mistral_common_objects) if not name.startswith("_") + ] +else: + _import_structure["tokenization_mistral_common"] = ["MistralCommonBackend"] + +# Vision-specific objects +try: + if not is_vision_available(): + raise OptionalDependencyNotAvailable() +except OptionalDependencyNotAvailable: + from .utils import dummy_vision_objects + + _import_structure["utils.dummy_vision_objects"] = [ + name for name in dir(dummy_vision_objects) if not name.startswith("_") + ] +else: + _import_structure["image_processing_base"] = ["ImageProcessingMixin"] + _import_structure["image_processing_utils"] = ["BaseImageProcessor"] + _import_structure["image_utils"] = ["ImageFeatureExtractionMixin"] + +try: + if not is_torchvision_available(): + raise OptionalDependencyNotAvailable() +except OptionalDependencyNotAvailable: + from .utils import dummy_torchvision_objects + + _import_structure["utils.dummy_torchvision_objects"] = [ + name for name in dir(dummy_torchvision_objects) if not name.startswith("_") + ] +else: + _import_structure["image_processing_utils_fast"] = ["BaseImageProcessorFast"] + _import_structure["video_processing_utils"] = ["BaseVideoProcessor"] + +# PyTorch-backed objects +try: + if not is_torch_available(): + raise OptionalDependencyNotAvailable() +except OptionalDependencyNotAvailable: + from .utils import dummy_pt_objects + + _import_structure["utils.dummy_pt_objects"] = [name for name in dir(dummy_pt_objects) if not name.startswith("_")] +else: + _import_structure["model_debugging_utils"] = [ + "model_addition_debugger_context", + ] + _import_structure["activations"] = [] + _import_structure["cache_utils"] = [ + "CacheLayerMixin", + "DynamicLayer", + "StaticLayer", + "StaticSlidingWindowLayer", + "QuantoQuantizedLayer", + "HQQQuantizedLayer", + "Cache", + "DynamicCache", + "EncoderDecoderCache", + "QuantizedCache", + "StaticCache", + ] + _import_structure["data.datasets"] = [ + "GlueDataset", + "GlueDataTrainingArguments", + "SquadDataset", + "SquadDataTrainingArguments", + ] + _import_structure["generation"].extend( + [ + "AlternatingCodebooksLogitsProcessor", + "BayesianDetectorConfig", + "BayesianDetectorModel", + "ClassifierFreeGuidanceLogitsProcessor", + "ContinuousBatchingManager", + "ContinuousMixin", + "EncoderNoRepeatNGramLogitsProcessor", + "EncoderRepetitionPenaltyLogitsProcessor", + "EosTokenCriteria", + "EpsilonLogitsWarper", + "MinPLogitsWarper", + "EtaLogitsWarper", + "ExponentialDecayLengthPenalty", + "ForcedBOSTokenLogitsProcessor", + "ForcedEOSTokenLogitsProcessor", + "GenerationMixin", + "InfNanRemoveLogitsProcessor", + "LogitNormalization", + "LogitsProcessor", + "LogitsProcessorList", + "MaxLengthCriteria", + "MaxTimeCriteria", + "MinLengthLogitsProcessor", + "MinNewTokensLengthLogitsProcessor", + "NoBadWordsLogitsProcessor", + "NoRepeatNGramLogitsProcessor", + "PrefixConstrainedLogitsProcessor", + "RepetitionPenaltyLogitsProcessor", + "SequenceBiasLogitsProcessor", + "StoppingCriteria", + "StoppingCriteriaList", + "StopStringCriteria", + "SuppressTokensAtBeginLogitsProcessor", + "SuppressTokensLogitsProcessor", + "SynthIDTextWatermarkDetector", + "SynthIDTextWatermarkingConfig", + "SynthIDTextWatermarkLogitsProcessor", + "TemperatureLogitsWarper", + "TopHLogitsWarper", + "TopKLogitsWarper", + "TopPLogitsWarper", + "TypicalLogitsWarper", + "UnbatchedClassifierFreeGuidanceLogitsProcessor", + "WatermarkDetector", + "WatermarkLogitsProcessor", + "WhisperTimeStampLogitsProcessor", + ] + ) + + # PyTorch domain libraries integration + _import_structure["integrations.executorch"] = [ + "TorchExportableModuleWithStaticCache", + "convert_and_export_with_cache", + ] + + _import_structure["core_model_loading"] = [ + "Chunk", + "Concatenate", + "ConversionOps", + "MergeModulelist", + "PermuteForRope", + "SplitModulelist", + "WeightConverter", + ] + _import_structure["modeling_flash_attention_utils"] = [] + _import_structure["modeling_layers"] = ["GradientCheckpointingLayer"] + _import_structure["modeling_outputs"] = [] + _import_structure["backbone_utils"] = ["BackboneConfigMixin", "BackboneMixin"] + _import_structure["modeling_rope_utils"] = ["ROPE_INIT_FUNCTIONS", "dynamic_rope_update", "RopeParameters"] + _import_structure["modeling_utils"] = ["PreTrainedModel", "AttentionInterface"] + _import_structure["masking_utils"] = ["AttentionMaskInterface"] + _import_structure["optimization"] = [ + "Adafactor", + "get_constant_schedule", + "get_constant_schedule_with_warmup", + "get_cosine_schedule_with_warmup", + "get_cosine_with_hard_restarts_schedule_with_warmup", + "get_cosine_with_min_lr_schedule_with_warmup", + "get_cosine_with_min_lr_schedule_with_warmup_lr_rate", + "get_inverse_sqrt_schedule", + "get_linear_schedule_with_warmup", + "get_polynomial_decay_schedule_with_warmup", + "get_scheduler", + "get_wsd_schedule", + "get_reduce_on_plateau_schedule", + ] + _import_structure["pytorch_utils"] = ["Conv1D", "apply_chunking_to_forward"] + _import_structure["time_series_utils"] = [] + _import_structure["trainer"] = ["Trainer"] + _import_structure["trainer_pt_utils"] = ["torch_distributed_zero_first"] + _import_structure["trainer_seq2seq"] = ["Seq2SeqTrainer"] + + +# Direct imports for type-checking +if TYPE_CHECKING: + # All modeling imports + # Models + from .backbone_utils import BackboneConfigMixin, BackboneMixin + from .cache_utils import Cache as Cache + from .cache_utils import DynamicCache as DynamicCache + from .cache_utils import DynamicLayer as DynamicLayer + from .cache_utils import EncoderDecoderCache as EncoderDecoderCache + from .cache_utils import HQQQuantizedLayer as HQQQuantizedLayer + from .cache_utils import QuantizedCache as QuantizedCache + from .cache_utils import QuantoQuantizedLayer as QuantoQuantizedLayer + from .cache_utils import StaticCache as StaticCache + from .cache_utils import StaticLayer as StaticLayer + from .cache_utils import StaticSlidingWindowLayer as StaticSlidingWindowLayer + from .configuration_utils import PreTrainedConfig as PreTrainedConfig + from .configuration_utils import PretrainedConfig as PretrainedConfig + from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS as SLOW_TO_FAST_CONVERTERS + from .convert_slow_tokenizer import convert_slow_tokenizer as convert_slow_tokenizer + from .core_model_loading import Chunk as Chunk + from .core_model_loading import Concatenate as Concatenate + from .core_model_loading import ConversionOps as ConversionOps + from .core_model_loading import MergeModulelist as MergeModulelist + from .core_model_loading import PermuteForRope as PermuteForRope + from .core_model_loading import SplitModulelist as SplitModulelist + from .core_model_loading import WeightConverter as WeightConverter + + # Data + from .data import DataProcessor as DataProcessor + from .data import InputExample as InputExample + from .data import InputFeatures as InputFeatures + from .data import SingleSentenceClassificationProcessor as SingleSentenceClassificationProcessor + from .data import SquadExample as SquadExample + from .data import SquadFeatures as SquadFeatures + from .data import SquadV1Processor as SquadV1Processor + from .data import SquadV2Processor as SquadV2Processor + from .data import glue_compute_metrics as glue_compute_metrics + from .data import glue_convert_examples_to_features as glue_convert_examples_to_features + from .data import glue_output_modes as glue_output_modes + from .data import glue_processors as glue_processors + from .data import glue_tasks_num_labels as glue_tasks_num_labels + from .data import squad_convert_examples_to_features as squad_convert_examples_to_features + from .data import xnli_compute_metrics as xnli_compute_metrics + from .data import xnli_output_modes as xnli_output_modes + from .data import xnli_processors as xnli_processors + from .data import xnli_tasks_num_labels as xnli_tasks_num_labels + from .data.data_collator import DataCollator as DataCollator + from .data.data_collator import DataCollatorForLanguageModeling as DataCollatorForLanguageModeling + from .data.data_collator import DataCollatorForMultipleChoice as DataCollatorForMultipleChoice + from .data.data_collator import ( + DataCollatorForPermutationLanguageModeling as DataCollatorForPermutationLanguageModeling, + ) + from .data.data_collator import DataCollatorForSeq2Seq as DataCollatorForSeq2Seq + from .data.data_collator import DataCollatorForSOP as DataCollatorForSOP + from .data.data_collator import DataCollatorForTokenClassification as DataCollatorForTokenClassification + from .data.data_collator import DataCollatorForWholeWordMask as DataCollatorForWholeWordMask + from .data.data_collator import DataCollatorWithFlattening as DataCollatorWithFlattening + from .data.data_collator import DataCollatorWithPadding as DataCollatorWithPadding + from .data.data_collator import DefaultDataCollator as DefaultDataCollator + from .data.data_collator import default_data_collator as default_data_collator + from .data.datasets import GlueDataset as GlueDataset + from .data.datasets import GlueDataTrainingArguments as GlueDataTrainingArguments + from .data.datasets import SquadDataset as SquadDataset + from .data.datasets import SquadDataTrainingArguments as SquadDataTrainingArguments + from .feature_extraction_sequence_utils import SequenceFeatureExtractor as SequenceFeatureExtractor + + # Feature Extractor + from .feature_extraction_utils import BatchFeature as BatchFeature + from .feature_extraction_utils import FeatureExtractionMixin as FeatureExtractionMixin + + # Generation + from .generation import AlternatingCodebooksLogitsProcessor as AlternatingCodebooksLogitsProcessor + from .generation import AsyncTextIteratorStreamer as AsyncTextIteratorStreamer + from .generation import BayesianDetectorConfig as BayesianDetectorConfig + from .generation import BayesianDetectorModel as BayesianDetectorModel + from .generation import ClassifierFreeGuidanceLogitsProcessor as ClassifierFreeGuidanceLogitsProcessor + from .generation import CompileConfig as CompileConfig + from .generation import ContinuousBatchingManager as ContinuousBatchingManager + from .generation import ContinuousMixin as ContinuousMixin + from .generation import EncoderNoRepeatNGramLogitsProcessor as EncoderNoRepeatNGramLogitsProcessor + from .generation import EncoderRepetitionPenaltyLogitsProcessor as EncoderRepetitionPenaltyLogitsProcessor + from .generation import EosTokenCriteria as EosTokenCriteria + from .generation import EpsilonLogitsWarper as EpsilonLogitsWarper + from .generation import EtaLogitsWarper as EtaLogitsWarper + from .generation import ExponentialDecayLengthPenalty as ExponentialDecayLengthPenalty + from .generation import ForcedBOSTokenLogitsProcessor as ForcedBOSTokenLogitsProcessor + from .generation import ForcedEOSTokenLogitsProcessor as ForcedEOSTokenLogitsProcessor + from .generation import GenerationConfig as GenerationConfig + from .generation import GenerationMixin as GenerationMixin + from .generation import InfNanRemoveLogitsProcessor as InfNanRemoveLogitsProcessor + from .generation import LogitNormalization as LogitNormalization + from .generation import LogitsProcessor as LogitsProcessor + from .generation import LogitsProcessorList as LogitsProcessorList + from .generation import MaxLengthCriteria as MaxLengthCriteria + from .generation import MaxTimeCriteria as MaxTimeCriteria + from .generation import MinLengthLogitsProcessor as MinLengthLogitsProcessor + from .generation import MinNewTokensLengthLogitsProcessor as MinNewTokensLengthLogitsProcessor + from .generation import MinPLogitsWarper as MinPLogitsWarper + from .generation import NoBadWordsLogitsProcessor as NoBadWordsLogitsProcessor + from .generation import NoRepeatNGramLogitsProcessor as NoRepeatNGramLogitsProcessor + from .generation import PrefixConstrainedLogitsProcessor as PrefixConstrainedLogitsProcessor + from .generation import RepetitionPenaltyLogitsProcessor as RepetitionPenaltyLogitsProcessor + from .generation import SequenceBiasLogitsProcessor as SequenceBiasLogitsProcessor + from .generation import StoppingCriteria as StoppingCriteria + from .generation import StoppingCriteriaList as StoppingCriteriaList + from .generation import StopStringCriteria as StopStringCriteria + from .generation import SuppressTokensAtBeginLogitsProcessor as SuppressTokensAtBeginLogitsProcessor + from .generation import SuppressTokensLogitsProcessor as SuppressTokensLogitsProcessor + from .generation import SynthIDTextWatermarkDetector as SynthIDTextWatermarkDetector + from .generation import SynthIDTextWatermarkingConfig as SynthIDTextWatermarkingConfig + from .generation import SynthIDTextWatermarkLogitsProcessor as SynthIDTextWatermarkLogitsProcessor + from .generation import TemperatureLogitsWarper as TemperatureLogitsWarper + from .generation import TextIteratorStreamer as TextIteratorStreamer + from .generation import TextStreamer as TextStreamer + from .generation import TopHLogitsWarper as TopHLogitsWarper + from .generation import TopKLogitsWarper as TopKLogitsWarper + from .generation import TopPLogitsWarper as TopPLogitsWarper + from .generation import TypicalLogitsWarper as TypicalLogitsWarper + from .generation import ( + UnbatchedClassifierFreeGuidanceLogitsProcessor as UnbatchedClassifierFreeGuidanceLogitsProcessor, + ) + from .generation import WatermarkDetector as WatermarkDetector + from .generation import WatermarkingConfig as WatermarkingConfig + from .generation import WatermarkLogitsProcessor as WatermarkLogitsProcessor + from .generation import WhisperTimeStampLogitsProcessor as WhisperTimeStampLogitsProcessor + from .hf_argparser import HfArgumentParser as HfArgumentParser + from .image_processing_base import ImageProcessingMixin as ImageProcessingMixin + from .image_processing_utils import BaseImageProcessor as BaseImageProcessor + from .image_processing_utils_fast import BaseImageProcessorFast as BaseImageProcessorFast + from .image_utils import ImageFeatureExtractionMixin as ImageFeatureExtractionMixin + + # Integrations + from .integrations import is_clearml_available as is_clearml_available + from .integrations import is_comet_available as is_comet_available + from .integrations import is_dvclive_available as is_dvclive_available + from .integrations import is_neptune_available as is_neptune_available + from .integrations import is_optuna_available as is_optuna_available + from .integrations import is_ray_available as is_ray_available + from .integrations import is_ray_tune_available as is_ray_tune_available + from .integrations import is_swanlab_available as is_swanlab_available + from .integrations import is_tensorboard_available as is_tensorboard_available + from .integrations import is_trackio_available as is_trackio_available + from .integrations import is_wandb_available as is_wandb_available + from .integrations.executorch import TorchExportableModuleWithStaticCache as TorchExportableModuleWithStaticCache + from .integrations.executorch import convert_and_export_with_cache as convert_and_export_with_cache + from .masking_utils import AttentionMaskInterface as AttentionMaskInterface + from .model_debugging_utils import model_addition_debugger_context as model_addition_debugger_context + from .modeling_layers import GradientCheckpointingLayer as GradientCheckpointingLayer + from .modeling_rope_utils import ROPE_INIT_FUNCTIONS as ROPE_INIT_FUNCTIONS + from .modeling_rope_utils import RopeParameters as RopeParameters + from .modeling_rope_utils import dynamic_rope_update as dynamic_rope_update + from .modeling_utils import AttentionInterface as AttentionInterface + from .modeling_utils import PreTrainedModel as PreTrainedModel + from .models import * + from .models.mamba.modeling_mamba import MambaCache as MambaCache + from .models.timm_wrapper import TimmWrapperImageProcessor as TimmWrapperImageProcessor + + # Optimization + from .optimization import Adafactor as Adafactor + from .optimization import get_constant_schedule as get_constant_schedule + from .optimization import get_constant_schedule_with_warmup as get_constant_schedule_with_warmup + from .optimization import get_cosine_schedule_with_warmup as get_cosine_schedule_with_warmup + from .optimization import ( + get_cosine_with_hard_restarts_schedule_with_warmup as get_cosine_with_hard_restarts_schedule_with_warmup, + ) + from .optimization import ( + get_cosine_with_min_lr_schedule_with_warmup as get_cosine_with_min_lr_schedule_with_warmup, + ) + from .optimization import ( + get_cosine_with_min_lr_schedule_with_warmup_lr_rate as get_cosine_with_min_lr_schedule_with_warmup_lr_rate, + ) + from .optimization import get_inverse_sqrt_schedule as get_inverse_sqrt_schedule + from .optimization import get_linear_schedule_with_warmup as get_linear_schedule_with_warmup + from .optimization import get_polynomial_decay_schedule_with_warmup as get_polynomial_decay_schedule_with_warmup + from .optimization import get_scheduler as get_scheduler + from .optimization import get_wsd_schedule as get_wsd_schedule + + # Pipelines + from .pipelines import AnyToAnyPipeline as AnyToAnyPipeline + from .pipelines import AudioClassificationPipeline as AudioClassificationPipeline + from .pipelines import AutomaticSpeechRecognitionPipeline as AutomaticSpeechRecognitionPipeline + from .pipelines import CsvPipelineDataFormat as CsvPipelineDataFormat + from .pipelines import DepthEstimationPipeline as DepthEstimationPipeline + from .pipelines import DocumentQuestionAnsweringPipeline as DocumentQuestionAnsweringPipeline + from .pipelines import FeatureExtractionPipeline as FeatureExtractionPipeline + from .pipelines import FillMaskPipeline as FillMaskPipeline + from .pipelines import ImageClassificationPipeline as ImageClassificationPipeline + from .pipelines import ImageFeatureExtractionPipeline as ImageFeatureExtractionPipeline + from .pipelines import ImageSegmentationPipeline as ImageSegmentationPipeline + from .pipelines import ImageTextToTextPipeline as ImageTextToTextPipeline + from .pipelines import ImageToImagePipeline as ImageToImagePipeline + from .pipelines import JsonPipelineDataFormat as JsonPipelineDataFormat + from .pipelines import KeypointMatchingPipeline as KeypointMatchingPipeline + from .pipelines import MaskGenerationPipeline as MaskGenerationPipeline + from .pipelines import NerPipeline as NerPipeline + from .pipelines import ObjectDetectionPipeline as ObjectDetectionPipeline + from .pipelines import PipedPipelineDataFormat as PipedPipelineDataFormat + from .pipelines import Pipeline as Pipeline + from .pipelines import PipelineDataFormat as PipelineDataFormat + from .pipelines import QuestionAnsweringPipeline as QuestionAnsweringPipeline + from .pipelines import TableQuestionAnsweringPipeline as TableQuestionAnsweringPipeline + from .pipelines import TextClassificationPipeline as TextClassificationPipeline + from .pipelines import TextGenerationPipeline as TextGenerationPipeline + from .pipelines import TextToAudioPipeline as TextToAudioPipeline + from .pipelines import TokenClassificationPipeline as TokenClassificationPipeline + from .pipelines import VideoClassificationPipeline as VideoClassificationPipeline + from .pipelines import VisualQuestionAnsweringPipeline as VisualQuestionAnsweringPipeline + from .pipelines import ZeroShotAudioClassificationPipeline as ZeroShotAudioClassificationPipeline + from .pipelines import ZeroShotClassificationPipeline as ZeroShotClassificationPipeline + from .pipelines import ZeroShotImageClassificationPipeline as ZeroShotImageClassificationPipeline + from .pipelines import ZeroShotObjectDetectionPipeline as ZeroShotObjectDetectionPipeline + from .pipelines import pipeline as pipeline + from .processing_utils import ProcessorMixin as ProcessorMixin + from .pytorch_utils import Conv1D as Conv1D + from .pytorch_utils import apply_chunking_to_forward as apply_chunking_to_forward + + # Tokenization + from .tokenization_python import PreTrainedTokenizer as PreTrainedTokenizer + from .tokenization_python import PythonBackend as PythonBackend + from .tokenization_utils_base import AddedToken as AddedToken + from .tokenization_utils_base import BatchEncoding as BatchEncoding + from .tokenization_utils_base import CharSpan as CharSpan + from .tokenization_utils_base import PreTrainedTokenizerBase as PreTrainedTokenizerBase + from .tokenization_utils_base import TokenSpan as TokenSpan + + # Tokenization + from .tokenization_utils_sentencepiece import SentencePieceBackend as SentencePieceBackend + from .tokenization_utils_tokenizers import PreTrainedTokenizerFast as PreTrainedTokenizerFast + from .tokenization_utils_tokenizers import ( + TokenizersBackend as TokenizersBackend, + ) + + # Trainer + from .trainer import Trainer as Trainer + from .trainer_callback import DefaultFlowCallback as DefaultFlowCallback + from .trainer_callback import EarlyStoppingCallback as EarlyStoppingCallback + from .trainer_callback import PrinterCallback as PrinterCallback + from .trainer_callback import ProgressCallback as ProgressCallback + from .trainer_callback import TrainerCallback as TrainerCallback + from .trainer_callback import TrainerControl as TrainerControl + from .trainer_callback import TrainerState as TrainerState + from .trainer_pt_utils import torch_distributed_zero_first as torch_distributed_zero_first + from .trainer_seq2seq import Seq2SeqTrainer as Seq2SeqTrainer + from .trainer_utils import EvalPrediction as EvalPrediction + from .trainer_utils import IntervalStrategy as IntervalStrategy + from .trainer_utils import SchedulerType as SchedulerType + from .trainer_utils import enable_full_determinism as enable_full_determinism + from .trainer_utils import set_seed as set_seed + from .training_args import TrainingArguments as TrainingArguments + from .training_args_seq2seq import Seq2SeqTrainingArguments as Seq2SeqTrainingArguments + + # Files and general utilities + from .utils import CONFIG_NAME as CONFIG_NAME + from .utils import MODEL_CARD_NAME as MODEL_CARD_NAME + from .utils import SPIECE_UNDERLINE as SPIECE_UNDERLINE + from .utils import WEIGHTS_NAME as WEIGHTS_NAME + from .utils import TensorType as TensorType + from .utils import add_end_docstrings as add_end_docstrings + from .utils import add_start_docstrings as add_start_docstrings + from .utils import is_apex_available as is_apex_available + from .utils import is_av_available as is_av_available + from .utils import is_datasets_available as is_datasets_available + from .utils import is_faiss_available as is_faiss_available + from .utils import is_matplotlib_available as is_matplotlib_available + from .utils import is_phonemizer_available as is_phonemizer_available + from .utils import is_psutil_available as is_psutil_available + from .utils import is_py3nvml_available as is_py3nvml_available + from .utils import is_pyctcdecode_available as is_pyctcdecode_available + from .utils import is_sacremoses_available as is_sacremoses_available + from .utils import is_sklearn_available as is_sklearn_available + from .utils import is_torch_hpu_available as is_torch_hpu_available + from .utils import is_torch_mlu_available as is_torch_mlu_available + from .utils import is_torch_musa_available as is_torch_musa_available + from .utils import is_torch_neuroncore_available as is_torch_neuroncore_available + from .utils import is_torch_npu_available as is_torch_npu_available + from .utils import is_torch_xla_available as is_torch_xla_available + from .utils import is_torch_xpu_available as is_torch_xpu_available + from .utils.import_utils import requires_backends + from .utils.kernel_config import KernelConfig as KernelConfig + + # Quantization config + from .utils.quantization_config import AqlmConfig as AqlmConfig + from .utils.quantization_config import AutoRoundConfig as AutoRoundConfig + from .utils.quantization_config import AwqConfig as AwqConfig + from .utils.quantization_config import BitNetQuantConfig as BitNetQuantConfig + from .utils.quantization_config import BitsAndBytesConfig as BitsAndBytesConfig + from .utils.quantization_config import CompressedTensorsConfig as CompressedTensorsConfig + from .utils.quantization_config import EetqConfig as EetqConfig + from .utils.quantization_config import FbgemmFp8Config as FbgemmFp8Config + from .utils.quantization_config import FineGrainedFP8Config as FineGrainedFP8Config + from .utils.quantization_config import FPQuantConfig as FPQuantConfig + from .utils.quantization_config import GPTQConfig as GPTQConfig + from .utils.quantization_config import HiggsConfig as HiggsConfig + from .utils.quantization_config import HqqConfig as HqqConfig + from .utils.quantization_config import QuantoConfig as QuantoConfig + from .utils.quantization_config import QuarkConfig as QuarkConfig + from .utils.quantization_config import SinqConfig as SinqConfig + from .utils.quantization_config import SpQRConfig as SpQRConfig + from .utils.quantization_config import TorchAoConfig as TorchAoConfig + from .utils.quantization_config import VptqConfig as VptqConfig + from .video_processing_utils import BaseVideoProcessor as BaseVideoProcessor +else: + _import_structure = {k: set(v) for k, v in _import_structure.items()} + + import_structure = define_import_structure(Path(__file__).parent / "models", prefix="models") + import_structure[frozenset({})].update(_import_structure) + + sys.modules[__name__] = _LazyModule( + __name__, + globals()["__file__"], + import_structure, + module_spec=__spec__, + extra_objects={"__version__": __version__}, + ) + + def _create_tokenization_alias(alias: str, target: str) -> None: + """ + Lazily redirect legacy tokenization module paths to their replacements without importing heavy deps. + """ + + module = types.ModuleType(alias) + module.__doc__ = f"Alias module for backward compatibility with `{target}`." + + def _get_target(): + return importlib.import_module(target, __name__) + + module.__getattr__ = lambda name: getattr(_get_target(), name) + module.__dir__ = lambda: dir(_get_target()) + + sys.modules[alias] = module + setattr(sys.modules[__name__], alias.rsplit(".", 1)[-1], module) + + _create_tokenization_alias(f"{__name__}.tokenization_utils_fast", ".tokenization_utils_tokenizers") + _create_tokenization_alias(f"{__name__}.tokenization_utils", ".tokenization_utils_sentencepiece") + + +if not is_torch_available(): + logger.warning_advice( + "PyTorch was not found. Models won't be available and only tokenizers, configuration and file/data utilities can be used." + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/activations.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/activations.py new file mode 100644 index 0000000000000000000000000000000000000000..32346ebbd5dfeeb729c5fbbbd7b2ad67d6ba97da --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/activations.py @@ -0,0 +1,360 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import functools +import math +from collections import OrderedDict + +import torch +from torch import Tensor, nn + +from .integrations.hub_kernels import use_kernel_forward_from_hub +from .utils import logging +from .utils.import_utils import is_torchdynamo_compiling + + +logger = logging.get_logger(__name__) + + +@use_kernel_forward_from_hub("GeluTanh") +class GELUTanh(nn.Module): + """ + A fast C implementation of the tanh approximation of the GeLU activation function. See + https://huggingface.co/papers/1606.08415. + + This implementation is equivalent to NewGELU and FastGELU but much faster. However, it is not an exact numerical + match due to rounding errors. + """ + + def __init__(self, use_gelu_tanh_python: bool = False): + super().__init__() + if use_gelu_tanh_python: + self.act = self._gelu_tanh_python + else: + self.act = functools.partial(nn.functional.gelu, approximate="tanh") + + def _gelu_tanh_python(self, input: Tensor) -> Tensor: + return input * 0.5 * (1.0 + torch.tanh(math.sqrt(2.0 / math.pi) * (input + 0.044715 * torch.pow(input, 3.0)))) + + def forward(self, input: Tensor) -> Tensor: + return self.act(input) + + +# Added for compatibility with autoawq which is archived now and imports PytorchGELUTanh from activations.py +PytorchGELUTanh = GELUTanh + + +@use_kernel_forward_from_hub("NewGELU") +class NewGELUActivation(nn.Module): + """ + Implementation of the GELU activation function currently in Google BERT repo (identical to OpenAI GPT). Also see + the Gaussian Error Linear Units paper: https://huggingface.co/papers/1606.08415 + """ + + def forward(self, input: Tensor) -> Tensor: + return 0.5 * input * (1.0 + torch.tanh(math.sqrt(2.0 / math.pi) * (input + 0.044715 * torch.pow(input, 3.0)))) + + +@use_kernel_forward_from_hub("GeLU") +class GELUActivation(nn.Module): + """ + Original Implementation of the GELU activation function in Google BERT repo when initially created. For + information: OpenAI GPT's GELU is slightly different (and gives slightly different results): 0.5 * x * (1 + + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) This is now written in C in nn.functional + Also see the Gaussian Error Linear Units paper: https://huggingface.co/papers/1606.08415 + """ + + def __init__(self, use_gelu_python: bool = False): + super().__init__() + if use_gelu_python: + self.act = self._gelu_python + else: + self.act = nn.functional.gelu + + def _gelu_python(self, input: Tensor) -> Tensor: + return input * 0.5 * (1.0 + torch.erf(input / math.sqrt(2.0))) + + def forward(self, input: Tensor) -> Tensor: + return self.act(input) + + +@use_kernel_forward_from_hub("SiLU") +class SiLUActivation(nn.Module): + """ + See Gaussian Error Linear Units (Hendrycks et al., https://arxiv.org/abs/1606.08415) where the SiLU (Sigmoid Linear + Unit) was originally introduced and coined, and see Sigmoid-Weighted Linear Units for Neural Network Function + Approximation in Reinforcement Learning (Elfwing et al., https://arxiv.org/abs/1702.03118) and Swish: a Self-Gated + Activation Function (Ramachandran et al., https://arxiv.org/abs/1710.05941v1) where the SiLU was experimented with + later. + """ + + def forward(self, input: Tensor) -> Tensor: + return nn.functional.silu(input) + + +@use_kernel_forward_from_hub("FastGELU") +class FastGELUActivation(nn.Module): + """ + Applies GELU approximation that is slower than QuickGELU but more accurate. See: https://github.com/hendrycks/GELUs + """ + + def forward(self, input: Tensor) -> Tensor: + return 0.5 * input * (1.0 + torch.tanh(input * 0.7978845608 * (1.0 + 0.044715 * input * input))) + + +@use_kernel_forward_from_hub("QuickGELU") +class QuickGELUActivation(nn.Module): + """ + Applies GELU approximation that is fast but somewhat inaccurate. See: https://github.com/hendrycks/GELUs + """ + + def forward(self, input: Tensor) -> Tensor: + return input * torch.sigmoid(1.702 * input) + + +class ClippedGELUActivation(nn.Module): + """ + Clip the range of possible GeLU outputs between [min, max]. This is especially useful for quantization purpose, as + it allows mapping negatives values in the GeLU spectrum. For more information on this trick, please refer to + https://huggingface.co/papers/2004.09602. + + Gaussian Error Linear Unit. Original Implementation of the gelu activation function in Google Bert repo when + initially created. + + For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))). See https://huggingface.co/papers/1606.08415 + """ + + def __init__(self, min: float, max: float): + if min > max: + raise ValueError(f"min should be < max (got min: {min}, max: {max})") + + super().__init__() + self.min = min + self.max = max + + def forward(self, x: Tensor) -> Tensor: + return torch.clip(gelu(x), self.min, self.max) + + +class AccurateGELUActivation(nn.Module): + """ + Applies GELU approximation that is faster than default and more accurate than QuickGELU. See: + https://github.com/hendrycks/GELUs + + Implemented along with MEGA (Moving Average Equipped Gated Attention) + """ + + def __init__(self): + super().__init__() + self.precomputed_constant = math.sqrt(2 / math.pi) + + def forward(self, input: Tensor) -> Tensor: + return 0.5 * input * (1 + torch.tanh(self.precomputed_constant * (input + 0.044715 * torch.pow(input, 3)))) + + +class MishActivation(nn.Module): + """ + See Mish: A Self-Regularized Non-Monotonic Activation Function (Misra., https://huggingface.co/papers/1908.08681). Also + visit the official repository for the paper: https://github.com/digantamisra98/Mish + """ + + def __init__(self): + super().__init__() + self.act = nn.functional.mish + + def _mish_python(self, input: Tensor) -> Tensor: + return input * torch.tanh(nn.functional.softplus(input)) + + def forward(self, input: Tensor) -> Tensor: + return self.act(input) + + +class LinearActivation(nn.Module): + """ + Applies the linear activation function, i.e. forwarding input directly to output. + """ + + def forward(self, input: Tensor) -> Tensor: + return input + + +class LaplaceActivation(nn.Module): + """ + Applies elementwise activation based on Laplace function, introduced in MEGA as an attention activation. See + https://huggingface.co/papers/2209.10655 + + Inspired by squared relu, but with bounded range and gradient for better stability + """ + + def forward(self, input, mu=0.707107, sigma=0.282095): + input = (input - mu).div(sigma * math.sqrt(2.0)) + return 0.5 * (1.0 + torch.erf(input)) + + +class ReLUSquaredActivation(nn.Module): + """ + Applies the relu^2 activation introduced in https://huggingface.co/papers/2109.08668 + """ + + def forward(self, input): + relu_applied = nn.functional.relu(input) + squared = torch.square(relu_applied) + return squared + + +class ClassInstantier(OrderedDict): + def __getitem__(self, key): + content = super().__getitem__(key) + cls, kwargs = content if isinstance(content, tuple) else (content, {}) + return cls(**kwargs) + + +class XIELUActivation(nn.Module): + """ + Applies the xIELU activation function introduced in https://arxiv.org/abs/2411.13010 + + If the user has installed the nickjbrowning/XIELU wheel, we import xIELU CUDA + Otherwise, we emit a single warning and use xIELU Python + """ + + def __init__( + self, + alpha_p_init=0.8, + alpha_n_init=0.8, + beta=0.5, + eps=-1e-6, + dtype=torch.bfloat16, + with_vector_loads=False, + ): + super().__init__() + self.alpha_p = nn.Parameter(torch.log(torch.expm1(torch.tensor(alpha_p_init, dtype=dtype))).unsqueeze(0)) + self.alpha_n = nn.Parameter( + torch.log(torch.expm1(torch.tensor(alpha_n_init - beta, dtype=dtype))).unsqueeze(0) + ) + self.register_buffer("beta", torch.tensor(beta, dtype=dtype)) + self.register_buffer("eps", torch.tensor(eps, dtype=dtype)) + self.with_vector_loads = with_vector_loads + # Temporary until xIELU CUDA fully implemented + self._beta_scalar = float(beta) + self._eps_scalar = float(eps) + + self._xielu_cuda_obj = None + try: + import xielu.ops # noqa: F401 + + self._xielu_cuda_obj = torch.classes.xielu.XIELU() + msg = "Using experimental xIELU CUDA." + try: + from torch.compiler import allow_in_graph + + self._xielu_cuda_fn = allow_in_graph(self._xielu_cuda) + msg += " Enabled torch._dynamo for xIELU CUDA." + except Exception as err: + msg += f" Could not enable torch._dynamo for xIELU ({err}) - this may result in slower performance." + self._xielu_cuda_fn = self._xielu_cuda + logger.warning_once(msg) + except Exception as err: + logger.warning_once( + "CUDA-fused xIELU not available (%s) – falling back to a Python version.\n" + "For CUDA xIELU (experimental), `pip install git+https://github.com/nickjbrowning/XIELU`", + str(err), + ) + + def _xielu_python(self, x: Tensor) -> Tensor: + alpha_p = nn.functional.softplus(self.alpha_p) + alpha_n = self.beta + nn.functional.softplus(self.alpha_n) + return torch.where( + x > 0, + alpha_p * x * x + self.beta * x, + (torch.expm1(torch.min(x, self.eps)) - x) * alpha_n + self.beta * x, + ) + + def _xielu_cuda(self, x: Tensor) -> Tensor: + """Firewall function to prevent torch.compile from seeing .item() calls""" + original_shape = x.shape + # CUDA kernel expects 3D tensors, reshape if needed + while x.dim() < 3: + x = x.unsqueeze(0) + if x.dim() > 3: + x = x.view(-1, 1, x.size(-1)) + if original_shape != x.shape: + logger.warning_once( + "Warning: xIELU input tensor expects 3 dimensions but got (shape: %s). Reshaping to (shape: %s).", + original_shape, + x.shape, + ) + result = self._xielu_cuda_obj.forward( + x, + self.alpha_p.to(x.dtype), + self.alpha_n.to(x.dtype), + # Temporary until xIELU CUDA fully implemented -> self.{beta,eps}.item() + self._beta_scalar, + self._eps_scalar, + self.with_vector_loads, + ) + return result.view(original_shape) + + def forward(self, input: Tensor) -> Tensor: + if self._xielu_cuda_obj is not None and input.is_cuda: + if not is_torchdynamo_compiling(): + return self._xielu_cuda_fn(input) + else: + logger.warning_once("torch._dynamo is compiling, using Python version of xIELU.") + return self._xielu_python(input) + + +ACT2CLS = { + "gelu": GELUActivation, + "gelu_10": (ClippedGELUActivation, {"min": -10, "max": 10}), + "gelu_fast": FastGELUActivation, + "gelu_new": NewGELUActivation, + "gelu_python": (GELUActivation, {"use_gelu_python": True}), + "gelu_pytorch_tanh": GELUTanh, + "gelu_python_tanh": (GELUTanh, {"use_gelu_tanh_python": True}), + "gelu_accurate": AccurateGELUActivation, + "laplace": LaplaceActivation, + "leaky_relu": nn.LeakyReLU, + "linear": LinearActivation, + "mish": MishActivation, + "quick_gelu": QuickGELUActivation, + "relu": nn.ReLU, + "relu2": ReLUSquaredActivation, + "relu6": nn.ReLU6, + "sigmoid": nn.Sigmoid, + "silu": SiLUActivation, + "swish": nn.SiLU, + "tanh": nn.Tanh, + "prelu": nn.PReLU, + "xielu": XIELUActivation, +} +ACT2FN = ClassInstantier(ACT2CLS) + + +def get_activation(activation_string): + if activation_string in ACT2FN: + return ACT2FN[activation_string] + else: + raise KeyError(f"function {activation_string} not found in ACT2FN mapping {list(ACT2FN.keys())}") + + +# For backwards compatibility with: from activations import gelu_python +gelu_python = get_activation("gelu_python") +gelu_new = get_activation("gelu_new") +gelu = get_activation("gelu") +gelu_fast = get_activation("gelu_fast") +quick_gelu = get_activation("quick_gelu") +silu = get_activation("silu") +mish = get_activation("mish") +linear_act = get_activation("linear") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/audio_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/audio_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..85b56634afe7c12afbf69361b727c49aa9755994 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/audio_utils.py @@ -0,0 +1,1237 @@ +# Copyright 2023 The HuggingFace Inc. team and the librosa & torchaudio authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Audio processing functions to extract features from audio waveforms. This code is pure numpy to support all frameworks +and remove unnecessary dependencies. +""" + +import base64 +import importlib +import io +import os +import warnings +from collections.abc import Sequence +from io import BytesIO +from typing import TYPE_CHECKING, Any, Union + +import httpx +import numpy as np +from packaging import version + +from .utils import ( + is_librosa_available, + is_numpy_array, + is_soundfile_available, + is_torch_tensor, + is_torchcodec_available, + requires_backends, +) + + +if TYPE_CHECKING: + import torch + +if is_soundfile_available(): + import soundfile as sf + +if is_librosa_available(): + import librosa + + # TODO: @eustlb, we actually don't need librosa but soxr is installed with librosa + import soxr + +if is_torchcodec_available(): + TORCHCODEC_VERSION = version.parse(importlib.metadata.version("torchcodec")) + +AudioInput = Union[np.ndarray, "torch.Tensor", Sequence[np.ndarray], Sequence["torch.Tensor"]] + + +def load_audio(audio: str | np.ndarray, sampling_rate=16000, timeout=None) -> np.ndarray: + """ + Loads `audio` to an np.ndarray object. + + Args: + audio (`str` or `np.ndarray`): + The audio to be loaded to the numpy array format. + sampling_rate (`int`, *optional*, defaults to 16000): + The sampling rate to be used when loading the audio. It should be same as the + sampling rate the model you will be using further was trained with. + timeout (`float`, *optional*): + The timeout value in seconds for the URL request. + + Returns: + `np.ndarray`: A numpy array representing the audio. + """ + if isinstance(audio, str): + # Try to load with `torchcodec` but do not enforce users to install it. If not found + # fallback to `librosa`. If using an audio-only model, most probably `torchcodec` won't be + # needed. Do not raise any errors if not installed or versions do not match + if is_torchcodec_available() and version.parse("0.3.0") <= TORCHCODEC_VERSION: + audio = load_audio_torchcodec(audio, sampling_rate=sampling_rate) + else: + audio = load_audio_librosa(audio, sampling_rate=sampling_rate, timeout=timeout) + elif not isinstance(audio, np.ndarray): + raise TypeError( + "Incorrect format used for `audio`. Should be an url linking to an audio, a local path, or numpy array." + ) + return audio + + +def load_audio_torchcodec(audio: str | np.ndarray, sampling_rate=16000) -> np.ndarray: + """ + Loads `audio` to an np.ndarray object using `torchcodec`. + + Args: + audio (`str` or `np.ndarray`): + The audio to be loaded to the numpy array format. + sampling_rate (`int`, *optional*, defaults to 16000): + The sampling rate to be used when loading the audio. It should be same as the + sampling rate the model you will be using further was trained with. + + Returns: + `np.ndarray`: A numpy array representing the audio. + """ + # Lazy import so that issues in torchcodec compatibility don't crash the whole library + requires_backends(load_audio_torchcodec, ["torchcodec"]) + from torchcodec.decoders import AudioDecoder + + # Set `num_channels` to `1` which is what most models expects and the default in librosa + decoder = AudioDecoder(audio, sample_rate=sampling_rate, num_channels=1) + audio = decoder.get_all_samples().data[0].numpy() # NOTE: feature extractors don't accept torch tensors + return audio + + +def load_audio_librosa(audio: str | np.ndarray, sampling_rate=16000, timeout=None) -> np.ndarray: + """ + Loads `audio` to an np.ndarray object using `librosa`. + + Args: + audio (`str` or `np.ndarray`): + The audio to be loaded to the numpy array format. + sampling_rate (`int`, *optional*, defaults to 16000): + The sampling rate to be used when loading the audio. It should be same as the + sampling rate the model you will be using further was trained with. + timeout (`float`, *optional*): + The timeout value in seconds for the URL request. + + Returns: + `np.ndarray`: A numpy array representing the audio. + """ + requires_backends(load_audio_librosa, ["librosa"]) + + # Load audio from URL (e.g https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-Audio/audio/translate_to_chinese.wav) + if audio.startswith("http://") or audio.startswith("https://"): + audio = librosa.load( + BytesIO(httpx.get(audio, follow_redirects=True, timeout=timeout).content), sr=sampling_rate + )[0] + elif os.path.isfile(audio): + audio = librosa.load(audio, sr=sampling_rate)[0] + return audio + + +def load_audio_as( + audio: str, + return_format: str, + timeout: int | None = None, + force_mono: bool = False, + sampling_rate: int | None = None, +) -> str | dict[str, Any] | io.BytesIO | None: + """ + Load audio from either a local file path or URL and return in specified format. + + Args: + audio (`str`): Either a local file path or a URL to an audio file + return_format (`str`): Format to return the audio in: + - "base64": Base64 encoded string + - "dict": Dictionary with data and format + - "buffer": BytesIO object + timeout (`int`, *optional*): Timeout for URL requests in seconds + force_mono (`bool`): Whether to convert stereo audio to mono + sampling_rate (`int`, *optional*): If provided, the audio will be resampled to the specified sampling rate. + + Returns: + `Union[str, Dict[str, Any], io.BytesIO, None]`: + - `str`: Base64 encoded audio data (if return_format="base64") + - `dict`: Dictionary with 'data' (base64 encoded audio data) and 'format' keys (if return_format="dict") + - `io.BytesIO`: BytesIO object containing audio data (if return_format="buffer") + """ + requires_backends(load_audio_as, ["librosa"]) + + if return_format not in ["base64", "dict", "buffer"]: + raise ValueError(f"Invalid return_format: {return_format}. Must be 'base64', 'dict', or 'buffer'") + + try: + # Load audio bytes from URL or file + audio_bytes = None + if audio.startswith(("http://", "https://")): + response = httpx.get(audio, follow_redirects=True, timeout=timeout) + response.raise_for_status() + audio_bytes = response.content + elif os.path.isfile(audio): + with open(audio, "rb") as audio_file: + audio_bytes = audio_file.read() + else: + raise ValueError(f"File not found: {audio}") + + # Process audio data + with io.BytesIO(audio_bytes) as audio_file: + with sf.SoundFile(audio_file) as f: + audio_array = f.read(dtype="float32") + original_sr = f.samplerate + audio_format = f.format + if sampling_rate is not None and sampling_rate != original_sr: + # Resample audio to target sampling rate + audio_array = soxr.resample(audio_array, original_sr, sampling_rate, quality="HQ") + else: + sampling_rate = original_sr + + # Convert to mono if needed + if force_mono and audio_array.ndim != 1: + audio_array = audio_array.mean(axis=1) + + buffer = io.BytesIO() + sf.write(buffer, audio_array, sampling_rate, format=audio_format.upper()) + buffer.seek(0) + + if return_format == "buffer": + return buffer + elif return_format == "base64": + return base64.b64encode(buffer.read()).decode("utf-8") + elif return_format == "dict": + return { + "data": base64.b64encode(buffer.read()).decode("utf-8"), + "format": audio_format.lower(), + } + + except Exception as e: + raise ValueError(f"Error loading audio: {e}") + + +def conv1d_output_length(module: "torch.nn.Conv1d", input_length: int) -> int: + """ + Computes the output length of a 1D convolution layer according to torch's documentation: + https://docs.pytorch.org/docs/stable/generated/torch.nn.Conv1d.html + """ + return int( + (input_length + 2 * module.padding[0] - module.dilation[0] * (module.kernel_size[0] - 1) - 1) + / module.stride[0] + + 1 + ) + + +def is_valid_audio(audio): + return is_numpy_array(audio) or is_torch_tensor(audio) + + +def is_valid_list_of_audio(audio): + return audio and all(is_valid_audio(audio_i) for audio_i in audio) + + +def make_list_of_audio( + audio: list[AudioInput] | AudioInput, +) -> AudioInput: + """ + Ensure that the output is a list of audio. + Args: + audio (`Union[list[AudioInput], AudioInput]`): + The input audio. + Returns: + list: A list of audio. + """ + # If it's a list of audios, it's already in the right format + if isinstance(audio, (list, tuple)) and is_valid_list_of_audio(audio): + return audio + + # If it's a single audio, convert it to a list of + if is_valid_audio(audio): + return [audio] + + raise ValueError("Invalid input type. Must be a single audio or a list of audio") + + +def hertz_to_mel(freq: float | np.ndarray, mel_scale: str = "htk") -> float | np.ndarray: + """ + Convert frequency from hertz to mels. + + Args: + freq (`float` or `np.ndarray`): + The frequency, or multiple frequencies, in hertz (Hz). + mel_scale (`str`, *optional*, defaults to `"htk"`): + The mel frequency scale to use, `"htk"`, `"kaldi"` or `"slaney"`. + + Returns: + `float` or `np.ndarray`: The frequencies on the mel scale. + """ + + if mel_scale not in ["slaney", "htk", "kaldi"]: + raise ValueError('mel_scale should be one of "htk", "slaney" or "kaldi".') + + if mel_scale == "htk": + return 2595.0 * np.log10(1.0 + (freq / 700.0)) + elif mel_scale == "kaldi": + return 1127.0 * np.log(1.0 + (freq / 700.0)) + + min_log_hertz = 1000.0 + min_log_mel = 15.0 + logstep = 27.0 / np.log(6.4) + mels = 3.0 * freq / 200.0 + + if isinstance(freq, np.ndarray): + log_region = freq >= min_log_hertz + mels[log_region] = min_log_mel + np.log(freq[log_region] / min_log_hertz) * logstep + elif freq >= min_log_hertz: + mels = min_log_mel + np.log(freq / min_log_hertz) * logstep + + return mels + + +def mel_to_hertz(mels: float | np.ndarray, mel_scale: str = "htk") -> float | np.ndarray: + """ + Convert frequency from mels to hertz. + + Args: + mels (`float` or `np.ndarray`): + The frequency, or multiple frequencies, in mels. + mel_scale (`str`, *optional*, `"htk"`): + The mel frequency scale to use, `"htk"`, `"kaldi"` or `"slaney"`. + + Returns: + `float` or `np.ndarray`: The frequencies in hertz. + """ + + if mel_scale not in ["slaney", "htk", "kaldi"]: + raise ValueError('mel_scale should be one of "htk", "slaney" or "kaldi".') + + if mel_scale == "htk": + return 700.0 * (np.power(10, mels / 2595.0) - 1.0) + elif mel_scale == "kaldi": + return 700.0 * (np.exp(mels / 1127.0) - 1.0) + + min_log_hertz = 1000.0 + min_log_mel = 15.0 + logstep = np.log(6.4) / 27.0 + freq = 200.0 * mels / 3.0 + + if isinstance(mels, np.ndarray): + log_region = mels >= min_log_mel + freq[log_region] = min_log_hertz * np.exp(logstep * (mels[log_region] - min_log_mel)) + elif mels >= min_log_mel: + freq = min_log_hertz * np.exp(logstep * (mels - min_log_mel)) + + return freq + + +def hertz_to_octave(freq: float | np.ndarray, tuning: float = 0.0, bins_per_octave: int = 12): + """ + Convert frequency from hertz to fractional octave numbers. + Adapted from *librosa*. + + Args: + freq (`float` or `np.ndarray`): + The frequency, or multiple frequencies, in hertz (Hz). + tuning (`float`, defaults to `0.`): + Tuning deviation from the Stuttgart pitch (A440) in (fractional) bins per octave. + bins_per_octave (`int`, defaults to `12`): + Number of bins per octave. + + Returns: + `float` or `np.ndarray`: The frequencies on the octave scale. + """ + stuttgart_pitch = 440.0 * 2.0 ** (tuning / bins_per_octave) + octave = np.log2(freq / (float(stuttgart_pitch) / 16)) + return octave + + +def _create_triangular_filter_bank(fft_freqs: np.ndarray, filter_freqs: np.ndarray) -> np.ndarray: + """ + Creates a triangular filter bank. + + Adapted from *torchaudio* and *librosa*. + + Args: + fft_freqs (`np.ndarray` of shape `(num_frequency_bins,)`): + Discrete frequencies of the FFT bins in Hz. + filter_freqs (`np.ndarray` of shape `(num_mel_filters,)`): + Center frequencies of the triangular filters to create, in Hz. + + Returns: + `np.ndarray` of shape `(num_frequency_bins, num_mel_filters)` + """ + filter_diff = np.diff(filter_freqs) + slopes = np.expand_dims(filter_freqs, 0) - np.expand_dims(fft_freqs, 1) + down_slopes = -slopes[:, :-2] / filter_diff[:-1] + up_slopes = slopes[:, 2:] / filter_diff[1:] + return np.maximum(np.zeros(1), np.minimum(down_slopes, up_slopes)) + + +def chroma_filter_bank( + num_frequency_bins: int, + num_chroma: int, + sampling_rate: int, + tuning: float = 0.0, + power: float | None = 2.0, + weighting_parameters: tuple[float, float] | None = (5.0, 2.0), + start_at_c_chroma: bool = True, +): + """ + Creates a chroma filter bank, i.e a linear transformation to project spectrogram bins onto chroma bins. + + Adapted from *librosa*. + + Args: + num_frequency_bins (`int`): + Number of frequencies used to compute the spectrogram (should be the same as in `stft`). + num_chroma (`int`): + Number of chroma bins (i.e pitch classes). + sampling_rate (`float`): + Sample rate of the audio waveform. + tuning (`float`): + Tuning deviation from A440 in fractions of a chroma bin. + power (`float`, *optional*, defaults to 2.0): + If 12.0, normalizes each column with their L2 norm. If 1.0, normalizes each column with their L1 norm. + weighting_parameters (`tuple[float, float]`, *optional*, defaults to `(5., 2.)`): + If specified, apply a Gaussian weighting parameterized by the first element of the tuple being the center and + the second element being the Gaussian half-width. + start_at_c_chroma (`bool`, *optional*, defaults to `True`): + If True, the filter bank will start at the 'C' pitch class. Otherwise, it will start at 'A'. + Returns: + `np.ndarray` of shape `(num_frequency_bins, num_chroma)` + """ + # Get the FFT bins, not counting the DC component + frequencies = np.linspace(0, sampling_rate, num_frequency_bins, endpoint=False)[1:] + + freq_bins = num_chroma * hertz_to_octave(frequencies, tuning=tuning, bins_per_octave=num_chroma) + + # make up a value for the 0 Hz bin = 1.5 octaves below bin 1 + # (so chroma is 50% rotated from bin 1, and bin width is broad) + freq_bins = np.concatenate(([freq_bins[0] - 1.5 * num_chroma], freq_bins)) + + bins_width = np.concatenate((np.maximum(freq_bins[1:] - freq_bins[:-1], 1.0), [1])) + + chroma_filters = np.subtract.outer(freq_bins, np.arange(0, num_chroma, dtype="d")).T + + num_chroma2 = np.round(float(num_chroma) / 2) + + # Project into range -num_chroma/2 .. num_chroma/2 + # add on fixed offset of 10*num_chroma to ensure all values passed to + # rem are positive + chroma_filters = np.remainder(chroma_filters + num_chroma2 + 10 * num_chroma, num_chroma) - num_chroma2 + + # Gaussian bumps - 2*D to make them narrower + chroma_filters = np.exp(-0.5 * (2 * chroma_filters / np.tile(bins_width, (num_chroma, 1))) ** 2) + + # normalize each column + if power is not None: + chroma_filters = chroma_filters / np.sum(chroma_filters**power, axis=0, keepdims=True) ** (1.0 / power) + + # Maybe apply scaling for fft bins + if weighting_parameters is not None: + center, half_width = weighting_parameters + chroma_filters *= np.tile( + np.exp(-0.5 * (((freq_bins / num_chroma - center) / half_width) ** 2)), + (num_chroma, 1), + ) + + if start_at_c_chroma: + chroma_filters = np.roll(chroma_filters, -3 * (num_chroma // 12), axis=0) + + # remove aliasing columns, copy to ensure row-contiguity + return np.ascontiguousarray(chroma_filters[:, : int(1 + num_frequency_bins / 2)]) + + +def mel_filter_bank( + num_frequency_bins: int, + num_mel_filters: int, + min_frequency: float, + max_frequency: float, + sampling_rate: int, + norm: str | None = None, + mel_scale: str = "htk", + triangularize_in_mel_space: bool = False, +) -> np.ndarray: + """ + Creates a frequency bin conversion matrix used to obtain a mel spectrogram. This is called a *mel filter bank*, and + various implementation exist, which differ in the number of filters, the shape of the filters, the way the filters + are spaced, the bandwidth of the filters, and the manner in which the spectrum is warped. The goal of these + features is to approximate the non-linear human perception of the variation in pitch with respect to the frequency. + + Different banks of mel filters were introduced in the literature. The following variations are supported: + + - MFCC FB-20: introduced in 1980 by Davis and Mermelstein, it assumes a sampling frequency of 10 kHz and a speech + bandwidth of `[0, 4600]` Hz. + - MFCC FB-24 HTK: from the Cambridge HMM Toolkit (HTK) (1995) uses a filter bank of 24 filters for a speech + bandwidth of `[0, 8000]` Hz. This assumes sampling rate ≥ 16 kHz. + - MFCC FB-40: from the Auditory Toolbox for MATLAB written by Slaney in 1998, assumes a sampling rate of 16 kHz and + speech bandwidth of `[133, 6854]` Hz. This version also includes area normalization. + - HFCC-E FB-29 (Human Factor Cepstral Coefficients) of Skowronski and Harris (2004), assumes a sampling rate of + 12.5 kHz and speech bandwidth of `[0, 6250]` Hz. + + This code is adapted from *torchaudio* and *librosa*. Note that the default parameters of torchaudio's + `melscale_fbanks` implement the `"htk"` filters while librosa uses the `"slaney"` implementation. + + Args: + num_frequency_bins (`int`): + Number of frequency bins (should be the same as `n_fft // 2 + 1` where `n_fft` is the size of the Fourier Transform used to compute the spectrogram). + num_mel_filters (`int`): + Number of mel filters to generate. + min_frequency (`float`): + Lowest frequency of interest in Hz. + max_frequency (`float`): + Highest frequency of interest in Hz. This should not exceed `sampling_rate / 2`. + sampling_rate (`int`): + Sample rate of the audio waveform. + norm (`str`, *optional*): + If `"slaney"`, divide the triangular mel weights by the width of the mel band (area normalization). + mel_scale (`str`, *optional*, defaults to `"htk"`): + The mel frequency scale to use, `"htk"`, `"kaldi"` or `"slaney"`. + triangularize_in_mel_space (`bool`, *optional*, defaults to `False`): + If this option is enabled, the triangular filter is applied in mel space rather than frequency space. This + should be set to `true` in order to get the same results as `torchaudio` when computing mel filters. + + Returns: + `np.ndarray` of shape (`num_frequency_bins`, `num_mel_filters`): Triangular filter bank matrix. This is a + projection matrix to go from a spectrogram to a mel spectrogram. + """ + if norm is not None and norm != "slaney": + raise ValueError('norm must be one of None or "slaney"') + + if num_frequency_bins < 2: + raise ValueError(f"Require num_frequency_bins: {num_frequency_bins} >= 2") + + if min_frequency > max_frequency: + raise ValueError(f"Require min_frequency: {min_frequency} <= max_frequency: {max_frequency}") + + # center points of the triangular mel filters + mel_min = hertz_to_mel(min_frequency, mel_scale=mel_scale) + mel_max = hertz_to_mel(max_frequency, mel_scale=mel_scale) + mel_freqs = np.linspace(mel_min, mel_max, num_mel_filters + 2) + filter_freqs = mel_to_hertz(mel_freqs, mel_scale=mel_scale) + + if triangularize_in_mel_space: + # frequencies of FFT bins in Hz, but filters triangularized in mel space + fft_bin_width = sampling_rate / ((num_frequency_bins - 1) * 2) + fft_freqs = hertz_to_mel(fft_bin_width * np.arange(num_frequency_bins), mel_scale=mel_scale) + filter_freqs = mel_freqs + else: + # frequencies of FFT bins in Hz + fft_freqs = np.linspace(0, sampling_rate // 2, num_frequency_bins) + + mel_filters = _create_triangular_filter_bank(fft_freqs, filter_freqs) + + if norm is not None and norm == "slaney": + # Slaney-style mel is scaled to be approx constant energy per channel + enorm = 2.0 / (filter_freqs[2 : num_mel_filters + 2] - filter_freqs[:num_mel_filters]) + mel_filters *= np.expand_dims(enorm, 0) + + if (mel_filters.max(axis=0) == 0.0).any(): + warnings.warn( + "At least one mel filter has all zero values. " + f"The value for `num_mel_filters` ({num_mel_filters}) may be set too high. " + f"Or, the value for `num_frequency_bins` ({num_frequency_bins}) may be set too low." + ) + + return mel_filters + + +def optimal_fft_length(window_length: int) -> int: + """ + Finds the best FFT input size for a given `window_length`. This function takes a given window length and, if not + already a power of two, rounds it up to the next power or two. + + The FFT algorithm works fastest when the length of the input is a power of two, which may be larger than the size + of the window or analysis frame. For example, if the window is 400 samples, using an FFT input size of 512 samples + is more optimal than an FFT size of 400 samples. Using a larger FFT size does not affect the detected frequencies, + it simply gives a higher frequency resolution (i.e. the frequency bins are smaller). + """ + return 2 ** int(np.ceil(np.log2(window_length))) + + +def window_function( + window_length: int, + name: str = "hann", + periodic: bool = True, + frame_length: int | None = None, + center: bool = True, +) -> np.ndarray: + """ + Returns an array containing the specified window. This window is intended to be used with `stft`. + + The following window types are supported: + + - `"boxcar"`: a rectangular window + - `"hamming"`: the Hamming window + - `"hann"`: the Hann window + - `"povey"`: the Povey window + + Args: + window_length (`int`): + The length of the window in samples. + name (`str`, *optional*, defaults to `"hann"`): + The name of the window function. + periodic (`bool`, *optional*, defaults to `True`): + Whether the window is periodic or symmetric. + frame_length (`int`, *optional*): + The length of the analysis frames in samples. Provide a value for `frame_length` if the window is smaller + than the frame length, so that it will be zero-padded. + center (`bool`, *optional*, defaults to `True`): + Whether to center the window inside the FFT buffer. Only used when `frame_length` is provided. + + Returns: + `np.ndarray` of shape `(window_length,)` or `(frame_length,)` containing the window. + """ + length = window_length + 1 if periodic else window_length + + if name == "boxcar": + window = np.ones(length) + elif name in ["hamming", "hamming_window"]: + window = np.hamming(length) + elif name in ["hann", "hann_window"]: + window = np.hanning(length) + elif name == "povey": + window = np.power(np.hanning(length), 0.85) + else: + raise ValueError(f"Unknown window function '{name}'") + + if periodic: + window = window[:-1] + + if frame_length is None: + return window + + if window_length > frame_length: + raise ValueError( + f"Length of the window ({window_length}) may not be larger than frame_length ({frame_length})" + ) + + padded_window = np.zeros(frame_length) + offset = (frame_length - window_length) // 2 if center else 0 + padded_window[offset : offset + window_length] = window + return padded_window + + +# Note: This method processes a single waveform. For batch processing, use spectrogram_batch(). +def spectrogram( + waveform: np.ndarray, + window: np.ndarray, + frame_length: int, + hop_length: int, + fft_length: int | None = None, + power: float | None = 1.0, + center: bool = True, + pad_mode: str = "reflect", + onesided: bool = True, + dither: float = 0.0, + preemphasis: float | None = None, + mel_filters: np.ndarray | None = None, + mel_floor: float = 1e-10, + log_mel: str | None = None, + reference: float = 1.0, + min_value: float = 1e-10, + db_range: float | None = None, + remove_dc_offset: bool = False, + dtype: np.dtype = np.float32, +) -> np.ndarray: + """ + Calculates a spectrogram over one waveform using the Short-Time Fourier Transform. + + This function can create the following kinds of spectrograms: + + - amplitude spectrogram (`power = 1.0`) + - power spectrogram (`power = 2.0`) + - complex-valued spectrogram (`power = None`) + - log spectrogram (use `log_mel` argument) + - mel spectrogram (provide `mel_filters`) + - log-mel spectrogram (provide `mel_filters` and `log_mel`) + + How this works: + + 1. The input waveform is split into frames of size `frame_length` that are partially overlapping by `frame_length + - hop_length` samples. + 2. Each frame is multiplied by the window and placed into a buffer of size `fft_length`. + 3. The DFT is taken of each windowed frame. + 4. The results are stacked into a spectrogram. + + We make a distinction between the following "blocks" of sample data, each of which may have a different lengths: + + - The analysis frame. This is the size of the time slices that the input waveform is split into. + - The window. Each analysis frame is multiplied by the window to avoid spectral leakage. + - The FFT input buffer. The length of this determines how many frequency bins are in the spectrogram. + + In this implementation, the window is assumed to be zero-padded to have the same size as the analysis frame. A + padded window can be obtained from `window_function()`. The FFT input buffer may be larger than the analysis frame, + typically the next power of two. + + Note: This function is not optimized for speed yet. It should be mostly compatible with `librosa.stft` and + `torchaudio.functional.transforms.Spectrogram`, although it is more flexible due to the different ways spectrograms + can be constructed. + + Args: + waveform (`np.ndarray` of shape `(length,)`): + The input waveform. This must be a single real-valued, mono waveform. + window (`np.ndarray` of shape `(frame_length,)`): + The windowing function to apply, including zero-padding if necessary. The actual window length may be + shorter than `frame_length`, but we're assuming the array has already been zero-padded. + frame_length (`int`): + The length of the analysis frames in samples. With librosa this is always equal to `fft_length` but we also + allow smaller sizes. + hop_length (`int`): + The stride between successive analysis frames in samples. + fft_length (`int`, *optional*): + The size of the FFT buffer in samples. This determines how many frequency bins the spectrogram will have. + For optimal speed, this should be a power of two. If `None`, uses `frame_length`. + power (`float`, *optional*, defaults to 1.0): + If 1.0, returns the amplitude spectrogram. If 2.0, returns the power spectrogram. If `None`, returns + complex numbers. + center (`bool`, *optional*, defaults to `True`): + Whether to pad the waveform so that frame `t` is centered around time `t * hop_length`. If `False`, frame + `t` will start at time `t * hop_length`. + pad_mode (`str`, *optional*, defaults to `"reflect"`): + Padding mode used when `center` is `True`. Possible values are: `"constant"` (pad with zeros), `"edge"` + (pad with edge values), `"reflect"` (pads with mirrored values). + onesided (`bool`, *optional*, defaults to `True`): + If True, only computes the positive frequencies and returns a spectrogram containing `fft_length // 2 + 1` + frequency bins. If False, also computes the negative frequencies and returns `fft_length` frequency bins. + dither (`float`, *optional*, defaults to 0.0): + Adds dithering. In other words, adds a small Gaussian noise to each frame. + E.g. use 4.0 to add dithering with a normal distribution centered + around 0.0 with standard deviation 4.0, 0.0 means no dithering. + Dithering has similar effect as `mel_floor`. It reduces the high log_mel_fbank + values for signals with hard-zero sections, when VAD cutoff is present in the signal. + preemphasis (`float`, *optional*) + Coefficient for a low-pass filter that applies pre-emphasis before the DFT. + mel_filters (`np.ndarray` of shape `(num_freq_bins, num_mel_filters)`, *optional*): + The mel filter bank. If supplied, applies a this filter bank to create a mel spectrogram. + mel_floor (`float`, *optional*, defaults to 1e-10): + Minimum value of mel frequency banks. + log_mel (`str`, *optional*): + How to convert the spectrogram to log scale. Possible options are: `None` (don't convert), `"log"` (take + the natural logarithm) `"log10"` (take the base-10 logarithm), `"dB"` (convert to decibels). Can only be + used when `power` is not `None`. + reference (`float`, *optional*, defaults to 1.0): + Sets the input spectrogram value that corresponds to 0 dB. For example, use `np.max(spectrogram)` to set + the loudest part to 0 dB. Must be greater than zero. + min_value (`float`, *optional*, defaults to `1e-10`): + The spectrogram will be clipped to this minimum value before conversion to decibels, to avoid taking + `log(0)`. For a power spectrogram, the default of `1e-10` corresponds to a minimum of -100 dB. For an + amplitude spectrogram, the value `1e-5` corresponds to -100 dB. Must be greater than zero. + db_range (`float`, *optional*): + Sets the maximum dynamic range in decibels. For example, if `db_range = 80`, the difference between the + peak value and the smallest value will never be more than 80 dB. Must be greater than zero. + remove_dc_offset (`bool`, *optional*): + Subtract mean from waveform on each frame, applied before pre-emphasis. This should be set to `true` in + order to get the same results as `torchaudio.compliance.kaldi.fbank` when computing mel filters. + dtype (`np.dtype`, *optional*, defaults to `np.float32`): + Data type of the spectrogram tensor. If `power` is None, this argument is ignored and the dtype will be + `np.complex64`. + + Returns: + `nd.array` containing a spectrogram of shape `(num_frequency_bins, length)` for a regular spectrogram or shape + `(num_mel_filters, length)` for a mel spectrogram. + """ + window_length = len(window) + + if fft_length is None: + fft_length = frame_length + + if frame_length > fft_length: + raise ValueError(f"frame_length ({frame_length}) may not be larger than fft_length ({fft_length})") + + if window_length != frame_length: + raise ValueError(f"Length of the window ({window_length}) must equal frame_length ({frame_length})") + + if hop_length <= 0: + raise ValueError("hop_length must be greater than zero") + + if waveform.ndim != 1: + raise ValueError(f"Input waveform must have only one dimension, shape is {waveform.shape}") + + if np.iscomplexobj(waveform): + raise ValueError("Complex-valued input waveforms are not currently supported") + + if power is None and mel_filters is not None: + raise ValueError( + "You have provided `mel_filters` but `power` is `None`. Mel spectrogram computation is not yet supported for complex-valued spectrogram." + "Specify `power` to fix this issue." + ) + + # center pad the waveform + if center: + padding = [(int(frame_length // 2), int(frame_length // 2))] + waveform = np.pad(waveform, padding, mode=pad_mode) + + # promote to float64, since np.fft uses float64 internally + waveform = waveform.astype(np.float64) + window = window.astype(np.float64) + + # split waveform into frames of frame_length size + num_frames = int(1 + np.floor((waveform.size - frame_length) / hop_length)) + + num_frequency_bins = (fft_length // 2) + 1 if onesided else fft_length + spectrogram = np.empty((num_frames, num_frequency_bins), dtype=np.complex64) + + # rfft is faster than fft + fft_func = np.fft.rfft if onesided else np.fft.fft + buffer = np.zeros(fft_length) + + timestep = 0 + for frame_idx in range(num_frames): + buffer[:frame_length] = waveform[timestep : timestep + frame_length] + + if dither != 0.0: + buffer[:frame_length] += dither * np.random.randn(frame_length) + + if remove_dc_offset: + buffer[:frame_length] = buffer[:frame_length] - buffer[:frame_length].mean() + + if preemphasis is not None: + buffer[1:frame_length] -= preemphasis * buffer[: frame_length - 1] + buffer[0] *= 1 - preemphasis + + buffer[:frame_length] *= window + + spectrogram[frame_idx] = fft_func(buffer) + timestep += hop_length + + # note: ** is much faster than np.power + if power is not None: + spectrogram = np.abs(spectrogram, dtype=np.float64) ** power + + spectrogram = spectrogram.T + + if mel_filters is not None: + spectrogram = np.maximum(mel_floor, np.dot(mel_filters.T, spectrogram)) + + if power is not None and log_mel is not None: + if log_mel == "log": + spectrogram = np.log(spectrogram) + elif log_mel == "log10": + spectrogram = np.log10(spectrogram) + elif log_mel == "dB": + if power == 1.0: + spectrogram = amplitude_to_db(spectrogram, reference, min_value, db_range) + elif power == 2.0: + spectrogram = power_to_db(spectrogram, reference, min_value, db_range) + else: + raise ValueError(f"Cannot use log_mel option '{log_mel}' with power {power}") + else: + raise ValueError(f"Unknown log_mel option: {log_mel}") + + spectrogram = np.asarray(spectrogram, dtype) + + return spectrogram + + +def spectrogram_batch( + waveform_list: list[np.ndarray], + window: np.ndarray, + frame_length: int, + hop_length: int, + fft_length: int | None = None, + power: float | None = 1.0, + center: bool = True, + pad_mode: str = "reflect", + onesided: bool = True, + dither: float = 0.0, + preemphasis: float | None = None, + mel_filters: np.ndarray | None = None, + mel_floor: float = 1e-10, + log_mel: str | None = None, + reference: float = 1.0, + min_value: float = 1e-10, + db_range: float | None = None, + remove_dc_offset: bool = False, + dtype: np.dtype = np.float32, +) -> list[np.ndarray]: + """ + Calculates spectrograms for a list of waveforms using the Short-Time Fourier Transform, optimized for batch processing. + This function extends the capabilities of the `spectrogram` function to handle multiple waveforms efficiently by leveraging broadcasting. + + It supports generating various types of spectrograms: + + - amplitude spectrogram (`power = 1.0`) + - power spectrogram (`power = 2.0`) + - complex-valued spectrogram (`power = None`) + - log spectrogram (use `log_mel` argument) + - mel spectrogram (provide `mel_filters`) + - log-mel spectrogram (provide `mel_filters` and `log_mel`) + + How this works: + + 1. The input waveform is split into frames of size `frame_length` that are partially overlapping by `frame_length + - hop_length` samples. + 2. Each frame is multiplied by the window and placed into a buffer of size `fft_length`. + 3. The DFT is taken of each windowed frame. + 4. The results are stacked into a spectrogram. + + We make a distinction between the following "blocks" of sample data, each of which may have a different lengths: + + - The analysis frame. This is the size of the time slices that the input waveform is split into. + - The window. Each analysis frame is multiplied by the window to avoid spectral leakage. + - The FFT input buffer. The length of this determines how many frequency bins are in the spectrogram. + + In this implementation, the window is assumed to be zero-padded to have the same size as the analysis frame. A + padded window can be obtained from `window_function()`. The FFT input buffer may be larger than the analysis frame, + typically the next power of two. + + Note: This function is designed for efficient batch processing of multiple waveforms but retains compatibility with individual waveform processing methods like `librosa.stft`. + + Args: + waveform_list (`list[np.ndarray]` with arrays of shape `(length,)`): + The list of input waveforms, each a single-channel (mono) signal. + window (`np.ndarray` of shape `(frame_length,)`): + The windowing function to apply, including zero-padding if necessary. + frame_length (`int`): + The length of each frame for analysis. + hop_length (`int`): + The step size between successive frames. + fft_length (`int`, *optional*): + The size of the FFT buffer, defining frequency bin resolution. + power (`float`, *optional*, defaults to 1.0): + Determines the type of spectrogram: 1.0 for amplitude, 2.0 for power, None for complex. + center (`bool`, *optional*, defaults to `True`): + Whether to center-pad the waveform frames. + pad_mode (`str`, *optional*, defaults to `"reflect"`): + The padding strategy when `center` is `True`. + onesided (`bool`, *optional*, defaults to `True`): + If True, returns a one-sided spectrogram for real input signals. + dither (`float`, *optional*, defaults to 0.0): + Adds dithering. In other words, adds a small Gaussian noise to each frame. + E.g. use 4.0 to add dithering with a normal distribution centered + around 0.0 with standard deviation 4.0, 0.0 means no dithering. + preemphasis (`float`, *optional*): + Applies a pre-emphasis filter to each frame. + mel_filters (`np.ndarray`, *optional*): + Mel filter bank for converting to mel spectrogram. + mel_floor (`float`, *optional*, defaults to 1e-10): + Floor value for mel spectrogram to avoid log(0). + log_mel (`str`, *optional*): + Specifies log scaling strategy; options are None, "log", "log10", "dB". + reference (`float`, *optional*, defaults to 1.0): + Reference value for dB conversion in log_mel. + min_value (`float`, *optional*, defaults to 1e-10): + Minimum floor value for log scale conversions. + db_range (`float`, *optional*): + Dynamic range for dB scale spectrograms. + remove_dc_offset (`bool`, *optional*): + Whether to remove the DC offset from each frame. + dtype (`np.dtype`, *optional*, defaults to `np.float32`): + Data type of the output spectrogram. + + Returns: + list[`np.ndarray`]: A list of spectrogram arrays, one for each input waveform. + """ + window_length = len(window) + + if fft_length is None: + fft_length = frame_length + + if frame_length > fft_length: + raise ValueError(f"frame_length ({frame_length}) may not be larger than fft_length ({fft_length})") + + if window_length != frame_length: + raise ValueError(f"Length of the window ({window_length}) must equal frame_length ({frame_length})") + + if hop_length <= 0: + raise ValueError("hop_length must be greater than zero") + + # Check the dimensions of the waveform , and if waveform is complex + for waveform in waveform_list: + if waveform.ndim != 1: + raise ValueError(f"Input waveform must have only one dimension, shape is {waveform.shape}") + if np.iscomplexobj(waveform): + raise ValueError("Complex-valued input waveforms are not currently supported") + # Center pad the waveform + if center: + padding = [(int(frame_length // 2), int(frame_length // 2))] + waveform_list = [ + np.pad( + waveform, + padding, + mode=pad_mode, + ) + for waveform in waveform_list + ] + original_waveform_lengths = [ + len(waveform) for waveform in waveform_list + ] # these lengths will be used to remove padding later + + # Batch pad the waveform + max_length = max(original_waveform_lengths) + padded_waveform_batch = np.array( + [ + np.pad(waveform, (0, max_length - len(waveform)), mode="constant", constant_values=0) + for waveform in waveform_list + ], + dtype=dtype, + ) + + # Promote to float64, since np.fft uses float64 internally + padded_waveform_batch = padded_waveform_batch.astype(np.float64) + window = window.astype(np.float64) + + # Split waveform into frames of frame_length size + num_frames = int(1 + np.floor((padded_waveform_batch.shape[1] - frame_length) / hop_length)) + # these lengths will be used to remove padding later + true_num_frames = [int(1 + np.floor((length - frame_length) / hop_length)) for length in original_waveform_lengths] + num_batches = padded_waveform_batch.shape[0] + + num_frequency_bins = (fft_length // 2) + 1 if onesided else fft_length + spectrogram = np.empty((num_batches, num_frames, num_frequency_bins), dtype=np.complex64) + + # rfft is faster than fft + fft_func = np.fft.rfft if onesided else np.fft.fft + buffer = np.zeros((num_batches, fft_length)) + + for frame_idx in range(num_frames): + timestep = frame_idx * hop_length + buffer[:, :frame_length] = padded_waveform_batch[:, timestep : timestep + frame_length] + + if dither != 0.0: + buffer[:, :frame_length] += dither * np.random.randn(*buffer[:, :frame_length].shape) + + if remove_dc_offset: + buffer[:, :frame_length] -= buffer[:, :frame_length].mean(axis=1, keepdims=True) + + if preemphasis is not None: + buffer[:, 1:frame_length] -= preemphasis * buffer[:, : frame_length - 1] + buffer[:, 0] *= 1 - preemphasis + + buffer[:, :frame_length] *= window + + spectrogram[:, frame_idx] = fft_func(buffer) + + # Note: ** is much faster than np.power + if power is not None: + spectrogram = np.abs(spectrogram, dtype=np.float64) ** power + + # Apply mel filters if provided + if mel_filters is not None: + result = np.tensordot(spectrogram, mel_filters.T, axes=([2], [1])) + spectrogram = np.maximum(mel_floor, result) + + # Convert to log scale if specified + if power is not None and log_mel is not None: + if log_mel == "log": + spectrogram = np.log(spectrogram) + elif log_mel == "log10": + spectrogram = np.log10(spectrogram) + elif log_mel == "dB": + if power == 1.0: + spectrogram = amplitude_to_db_batch(spectrogram, reference, min_value, db_range) + elif power == 2.0: + spectrogram = power_to_db_batch(spectrogram, reference, min_value, db_range) + else: + raise ValueError(f"Cannot use log_mel option '{log_mel}' with power {power}") + else: + raise ValueError(f"Unknown log_mel option: {log_mel}") + + spectrogram = np.asarray(spectrogram, dtype) + + spectrogram_list = [spectrogram[i, : true_num_frames[i], :].T for i in range(len(true_num_frames))] + + return spectrogram_list + + +def power_to_db( + spectrogram: np.ndarray, + reference: float = 1.0, + min_value: float = 1e-10, + db_range: float | None = None, +) -> np.ndarray: + """ + Converts a power spectrogram to the decibel scale. This computes `10 * log10(spectrogram / reference)`, using basic + logarithm properties for numerical stability. + + The motivation behind applying the log function on the (mel) spectrogram is that humans do not hear loudness on a + linear scale. Generally to double the perceived volume of a sound we need to put 8 times as much energy into it. + This means that large variations in energy may not sound all that different if the sound is loud to begin with. + This compression operation makes the (mel) spectrogram features match more closely what humans actually hear. + + Based on the implementation of `librosa.power_to_db`. + + Args: + spectrogram (`np.ndarray`): + The input power (mel) spectrogram. Note that a power spectrogram has the amplitudes squared! + reference (`float`, *optional*, defaults to 1.0): + Sets the input spectrogram value that corresponds to 0 dB. For example, use `np.max(spectrogram)` to set + the loudest part to 0 dB. Must be greater than zero. + min_value (`float`, *optional*, defaults to `1e-10`): + The spectrogram will be clipped to this minimum value before conversion to decibels, to avoid taking + `log(0)`. The default of `1e-10` corresponds to a minimum of -100 dB. Must be greater than zero. + db_range (`float`, *optional*): + Sets the maximum dynamic range in decibels. For example, if `db_range = 80`, the difference between the + peak value and the smallest value will never be more than 80 dB. Must be greater than zero. + + Returns: + `np.ndarray`: the spectrogram in decibels + """ + if reference <= 0.0: + raise ValueError("reference must be greater than zero") + if min_value <= 0.0: + raise ValueError("min_value must be greater than zero") + + reference = max(min_value, reference) + + spectrogram = np.clip(spectrogram, a_min=min_value, a_max=None) + spectrogram = 10.0 * (np.log10(spectrogram) - np.log10(reference)) + + if db_range is not None: + if db_range <= 0.0: + raise ValueError("db_range must be greater than zero") + spectrogram = np.clip(spectrogram, a_min=spectrogram.max() - db_range, a_max=None) + + return spectrogram + + +def power_to_db_batch( + spectrogram: np.ndarray, + reference: float = 1.0, + min_value: float = 1e-10, + db_range: float | None = None, +) -> np.ndarray: + """ + Converts a batch of power spectrograms to the decibel scale. This computes `10 * log10(spectrogram / reference)`, + using basic logarithm properties for numerical stability. + + This function supports batch processing, where each item in the batch is an individual power (mel) spectrogram. + + Args: + spectrogram (`np.ndarray`): + The input batch of power (mel) spectrograms. Expected shape is (batch_size, *spectrogram_shape). + Note that a power spectrogram has the amplitudes squared! + reference (`float`, *optional*, defaults to 1.0): + Sets the input spectrogram value that corresponds to 0 dB. For example, use `np.max(spectrogram)` to set + the loudest part to 0 dB. Must be greater than zero. + min_value (`float`, *optional*, defaults to `1e-10`): + The spectrogram will be clipped to this minimum value before conversion to decibels, to avoid taking + `log(0)`. The default of `1e-10` corresponds to a minimum of -100 dB. Must be greater than zero. + db_range (`float`, *optional*): + Sets the maximum dynamic range in decibels. For example, if `db_range = 80`, the difference between the + peak value and the smallest value will never be more than 80 dB. Must be greater than zero. + + Returns: + `np.ndarray`: the batch of spectrograms in decibels + """ + if reference <= 0.0: + raise ValueError("reference must be greater than zero") + if min_value <= 0.0: + raise ValueError("min_value must be greater than zero") + + reference = max(min_value, reference) + + spectrogram = np.clip(spectrogram, a_min=min_value, a_max=None) + spectrogram = 10.0 * (np.log10(spectrogram) - np.log10(reference)) + + if db_range is not None: + if db_range <= 0.0: + raise ValueError("db_range must be greater than zero") + # Apply db_range clipping per batch item + max_values = spectrogram.max(axis=(1, 2), keepdims=True) + spectrogram = np.clip(spectrogram, a_min=max_values - db_range, a_max=None) + + return spectrogram + + +def amplitude_to_db( + spectrogram: np.ndarray, + reference: float = 1.0, + min_value: float = 1e-5, + db_range: float | None = None, +) -> np.ndarray: + """ + Converts an amplitude spectrogram to the decibel scale. This computes `20 * log10(spectrogram / reference)`, using + basic logarithm properties for numerical stability. + + The motivation behind applying the log function on the (mel) spectrogram is that humans do not hear loudness on a + linear scale. Generally to double the perceived volume of a sound we need to put 8 times as much energy into it. + This means that large variations in energy may not sound all that different if the sound is loud to begin with. + This compression operation makes the (mel) spectrogram features match more closely what humans actually hear. + + Args: + spectrogram (`np.ndarray`): + The input amplitude (mel) spectrogram. + reference (`float`, *optional*, defaults to 1.0): + Sets the input spectrogram value that corresponds to 0 dB. For example, use `np.max(spectrogram)` to set + the loudest part to 0 dB. Must be greater than zero. + min_value (`float`, *optional*, defaults to `1e-5`): + The spectrogram will be clipped to this minimum value before conversion to decibels, to avoid taking + `log(0)`. The default of `1e-5` corresponds to a minimum of -100 dB. Must be greater than zero. + db_range (`float`, *optional*): + Sets the maximum dynamic range in decibels. For example, if `db_range = 80`, the difference between the + peak value and the smallest value will never be more than 80 dB. Must be greater than zero. + + Returns: + `np.ndarray`: the spectrogram in decibels + """ + if reference <= 0.0: + raise ValueError("reference must be greater than zero") + if min_value <= 0.0: + raise ValueError("min_value must be greater than zero") + + reference = max(min_value, reference) + + spectrogram = np.clip(spectrogram, a_min=min_value, a_max=None) + spectrogram = 20.0 * (np.log10(spectrogram) - np.log10(reference)) + + if db_range is not None: + if db_range <= 0.0: + raise ValueError("db_range must be greater than zero") + spectrogram = np.clip(spectrogram, a_min=spectrogram.max() - db_range, a_max=None) + + return spectrogram + + +def amplitude_to_db_batch( + spectrogram: np.ndarray, reference: float = 1.0, min_value: float = 1e-5, db_range: float | None = None +) -> np.ndarray: + """ + Converts a batch of amplitude spectrograms to the decibel scale. This computes `20 * log10(spectrogram / reference)`, + using basic logarithm properties for numerical stability. + + The function supports batch processing, where each item in the batch is an individual amplitude (mel) spectrogram. + + Args: + spectrogram (`np.ndarray`): + The input batch of amplitude (mel) spectrograms. Expected shape is (batch_size, *spectrogram_shape). + reference (`float`, *optional*, defaults to 1.0): + Sets the input spectrogram value that corresponds to 0 dB. For example, use `np.max(spectrogram)` to set + the loudest part to 0 dB. Must be greater than zero. + min_value (`float`, *optional*, defaults to `1e-5`): + The spectrogram will be clipped to this minimum value before conversion to decibels, to avoid taking + `log(0)`. The default of `1e-5` corresponds to a minimum of -100 dB. Must be greater than zero. + db_range (`float`, *optional*): + Sets the maximum dynamic range in decibels. For example, if `db_range = 80`, the difference between the + peak value and the smallest value will never be more than 80 dB. Must be greater than zero. + + Returns: + `np.ndarray`: the batch of spectrograms in decibels + """ + if reference <= 0.0: + raise ValueError("reference must be greater than zero") + if min_value <= 0.0: + raise ValueError("min_value must be greater than zero") + + reference = max(min_value, reference) + + spectrogram = np.clip(spectrogram, a_min=min_value, a_max=None) + spectrogram = 20.0 * (np.log10(spectrogram) - np.log10(reference)) + + if db_range is not None: + if db_range <= 0.0: + raise ValueError("db_range must be greater than zero") + # Apply db_range clipping per batch item + max_values = spectrogram.max(axis=(1, 2), keepdims=True) + spectrogram = np.clip(spectrogram, a_min=max_values - db_range, a_max=None) + + return spectrogram diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/backbone_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/backbone_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..30a3a140b783a62c2675c100c5851dab773b20ba --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/backbone_utils.py @@ -0,0 +1,341 @@ +# Copyright 2026 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Collection of utils to be used by backbones and their components.""" + +import enum +import inspect + +from huggingface_hub import repo_exists + +from .utils import logging + + +logger = logging.get_logger(__name__) + + +class BackboneType(enum.Enum): + TIMM = "timm" + TRANSFORMERS = "transformers" + + +class BackboneConfigMixin: + """ + A Mixin to support handling the `out_features` and `out_indices` attributes for the backbone configurations. + """ + + def set_output_features_output_indices( + self, + out_features: list | None, + out_indices: list | None, + ): + """ + Sets output indices and features to new values and aligns them with the given `stage_names`. + If one of the inputs is not given, find the corresponding `out_features` or `out_indices` + for the given `stage_names`. + + Args: + out_features (`list[str]`, *optional*): + The names of the features for the backbone to output. Defaults to `config._out_features` if not provided. + out_indices (`list[int]` or `tuple[int]`, *optional*): + The indices of the features for the backbone to output. Defaults to `config._out_indices` if not provided. + """ + self._out_features = out_features + self._out_indices = list(out_indices) if isinstance(out_indices, tuple) else out_indices + + # First verify that the out_features and out_indices are valid + self.verify_out_features_out_indices() + + # Align output features with indices + out_features, out_indices = self._out_features, self._out_indices + if out_indices is None and out_features is None: + out_indices = [len(self.stage_names) - 1] + out_features = [self.stage_names[-1]] + elif out_indices is None and out_features is not None: + out_indices = [self.stage_names.index(layer) for layer in out_features] + elif out_features is None and out_indices is not None: + out_features = [self.stage_names[idx] for idx in out_indices] + + # Update values and verify that the aligned out_features and out_indices are valid + self._out_features, self._out_indices = out_features, out_indices + self.verify_out_features_out_indices() + + def verify_out_features_out_indices(self): + """ + Verify that out_indices and out_features are valid for the given stage_names. + """ + if self.stage_names is None: + raise ValueError("Stage_names must be set for transformers backbones") + + if self._out_features is not None: + if not isinstance(self._out_features, (list,)): + raise ValueError(f"out_features must be a list got {type(self._out_features)}") + if any(feat not in self.stage_names for feat in self._out_features): + raise ValueError( + f"out_features must be a subset of stage_names: {self.stage_names} got {self._out_features}" + ) + if len(self._out_features) != len(set(self._out_features)): + raise ValueError(f"out_features must not contain any duplicates, got {self._out_features}") + if self._out_features != ( + sorted_feats := [feat for feat in self.stage_names if feat in self._out_features] + ): + raise ValueError( + f"out_features must be in the same order as stage_names, expected {sorted_feats} got {self._out_features}" + ) + + if self._out_indices is not None: + if not isinstance(self._out_indices, list): + raise ValueError(f"out_indices must be a list, got {type(self._out_indices)}") + # Convert negative indices to their positive equivalent: [-1,] -> [len(stage_names) - 1,] + positive_indices = tuple(idx % len(self.stage_names) if idx < 0 else idx for idx in self._out_indices) + if any(idx for idx in positive_indices if idx not in range(len(self.stage_names))): + raise ValueError( + f"out_indices must be valid indices for stage_names {self.stage_names}, got {self._out_indices}" + ) + if len(positive_indices) != len(set(positive_indices)): + msg = f"out_indices must not contain any duplicates, got {self._out_indices}" + msg += f"(equivalent to {positive_indices}))" if positive_indices != self._out_indices else "" + raise ValueError(msg) + if positive_indices != tuple(sorted(positive_indices)): + sorted_negative = [ + idx for _, idx in sorted(zip(positive_indices, self._out_indices), key=lambda x: x[0]) + ] + raise ValueError( + f"out_indices must be in the same order as stage_names, expected {sorted_negative} got {self._out_indices}" + ) + + if self._out_features is not None and self._out_indices is not None: + if len(self._out_features) != len(self._out_indices): + raise ValueError("out_features and out_indices should have the same length if both are set") + if self._out_features != [self.stage_names[idx] for idx in self._out_indices]: + raise ValueError("out_features and out_indices should correspond to the same stages if both are set") + + @property + def out_features(self): + return self._out_features + + @out_features.setter + def out_features(self, out_features: list[str]): + """ + Set the out_features attribute. This will also update the out_indices attribute to match the new out_features. + """ + self.set_output_features_output_indices(out_features=out_features, out_indices=None) + + @property + def out_indices(self): + return self._out_indices + + @out_indices.setter + def out_indices(self, out_indices: tuple[int, ...] | list[int]): + """ + Set the out_indices attribute. This will also update the out_features attribute to match the new out_indices. + """ + out_indices = list(out_indices) if out_indices is not None else out_indices + self.set_output_features_output_indices(out_features=None, out_indices=out_indices) + + def to_dict(self): + """ + Serializes this instance to a Python dictionary. Override the default `to_dict()` from `PreTrainedConfig` to + include the `out_features` and `out_indices` attributes. + """ + output = super().to_dict() + output["out_features"] = output.pop("_out_features", None) + output["out_indices"] = output.pop("_out_indices", None) + return output + + +class BackboneMixin: + backbone_type: BackboneType | None = None + + # Attribute to indicate if the backbone has attention and can return attention outputs. + # Should be set to `False` for conv-based models to be able to run `forward_with_filtered_kwargs` + has_attentions: bool = True + + def __init__(self, *args, **kwargs) -> None: + """ + Method to initialize the backbone. This method is called by the constructor of the base class after the + pretrained model weights have been loaded. + """ + super().__init__(*args, **kwargs) + timm_backbone = kwargs.pop("timm_backbone", None) + if timm_backbone is not None: + self.backbone_type = BackboneType.TIMM + else: + self.backbone_type = BackboneType.TRANSFORMERS + + if self.backbone_type == BackboneType.TIMM: + self._init_timm_backbone(backbone=timm_backbone) + elif self.backbone_type == BackboneType.TRANSFORMERS: + self._init_transformers_backbone() + else: + raise ValueError(f"backbone_type {self.backbone_type} not supported.") + + def _init_timm_backbone(self, backbone) -> None: + """ + Initialize the backbone model from timm. The backbone must already be loaded to backbone + """ + + out_features_from_config = getattr(self.config, "out_features", None) + stage_names_from_config = getattr(self.config, "stage_names", None) + + # These will disagree with the defaults for the transformers models e.g. for resnet50 + # the transformer model has out_features = ['stem', 'stage1', 'stage2', 'stage3', 'stage4'] + # the timm model has out_features = ['act', 'layer1', 'layer2', 'layer3', 'layer4'] + self.stage_names = [stage["module"] for stage in backbone.feature_info.info] + self.num_features = [stage["num_chs"] for stage in backbone.feature_info.info] + + out_indices = list(backbone.feature_info.out_indices) + out_features = backbone.feature_info.module_name() + + if out_features_from_config is not None and out_features_from_config != out_features: + raise ValueError( + f"Config has `out_features` set to {out_features_from_config} which doesn't match `out_features` " + "from backbone's feature_info. Please check if your checkpoint has correct out features/indices saved." + ) + + if stage_names_from_config is not None and stage_names_from_config != self.stage_names: + raise ValueError( + f"Config has `stage_names` set to {stage_names_from_config} which doesn't match `stage_names` " + "from backbone's feature_info. Please check if your checkpoint has correct `stage_names` saved." + ) + + # We set, align and verify out indices, out features and stage names + self.config.stage_names = self.stage_names + self.config.set_output_features_output_indices(out_features, out_indices) + + def _init_transformers_backbone(self) -> None: + self.stage_names = self.config.stage_names + self.config.verify_out_features_out_indices() + # Number of channels for each stage. This is set in the transformer backbone model init + self.num_features = None + + @property + def out_features(self): + return self.config._out_features + + @out_features.setter + def out_features(self, out_features: list[str]): + """ + Set the out_features attribute. This will also update the out_indices attribute to match the new out_features. + """ + self.config.out_features = out_features + + @property + def out_indices(self): + return self.config._out_indices + + @out_indices.setter + def out_indices(self, out_indices: tuple[int] | list[int]): + """ + Set the out_indices attribute. This will also update the out_features attribute to match the new out_indices. + """ + self.config.out_indices = out_indices + + @property + def out_feature_channels(self): + # the current backbones will output the number of channels for each stage + # even if that stage is not in the out_features list. + return {stage: self.num_features[i] for i, stage in enumerate(self.stage_names)} + + @property + def channels(self): + return [self.out_feature_channels[name] for name in self.out_features] + + def forward_with_filtered_kwargs(self, *args, **kwargs): + if not self.has_attentions: + kwargs.pop("output_attentions", None) + if self.backbone_type == BackboneType.TIMM: + signature = dict(inspect.signature(self.forward).parameters) + kwargs = {k: v for k, v in kwargs.items() if k in signature} + return self(*args, **kwargs) + + def forward( + self, + pixel_values, + output_hidden_states: bool | None = None, + output_attentions: bool | None = None, + return_dict: bool | None = None, + ): + raise NotImplementedError("This method should be implemented by the derived class.") + + +def consolidate_backbone_kwargs_to_config( + backbone_config, + default_backbone: str | None = None, + default_config_type: str | None = None, + default_config_kwargs: dict | None = None, + timm_default_kwargs: dict | None = None, + **kwargs, +): + # Lazy import to avoid circular import issues. Can be imported properly + # after deleting ref to `BackboneMixin` in `utils/backbone_utils.py` + from .configuration_utils import PreTrainedConfig + from .models.auto import CONFIG_MAPPING + + use_timm_backbone = kwargs.pop("use_timm_backbone", True) + backbone_kwargs = kwargs.pop("backbone_kwargs", {}) + backbone = kwargs.pop("backbone") if kwargs.get("backbone") is not None else default_backbone + kwargs.pop("use_pretrained_backbone", None) + + # Init timm backbone with hardcoded values for BC. If everything is set to `None` and there is + # a default timm config, we use it to init the backbone. + if ( + timm_default_kwargs is not None + and use_timm_backbone + and backbone is not None + and backbone_config is None + and not backbone_kwargs + ): + backbone_config = CONFIG_MAPPING["timm_backbone"](backbone=backbone, **timm_default_kwargs) + elif backbone is not None and backbone_config is None: + if repo_exists(backbone): + config_dict, _ = PreTrainedConfig.get_config_dict(backbone) + config_class = CONFIG_MAPPING[config_dict["model_type"]] + config_dict.update(backbone_kwargs) + backbone_config = config_class(**config_dict) + else: + backbone_config = CONFIG_MAPPING["timm_backbone"](backbone=backbone, **backbone_kwargs) + elif backbone_config is None and default_config_type is not None: + logger.info( + f"`backbone_config` is `None`. Initializing the config with the default `{default_config_type}` vision config." + ) + default_config_kwargs = default_config_kwargs or {} + backbone_config = CONFIG_MAPPING[default_config_type](**default_config_kwargs) + elif isinstance(backbone_config, dict): + backbone_model_type = backbone_config.get("model_type") + config_class = CONFIG_MAPPING[backbone_model_type] + backbone_config = config_class.from_dict(backbone_config) + + return backbone_config, kwargs + + +def load_backbone(config): + """ + Loads the backbone model from a config object. + + If the config is from the backbone model itself, then we return a backbone model with randomly initialized + weights. + + If the config is from the parent model of the backbone model itself, then we load the pretrained backbone weights + if specified. + """ + from transformers import AutoBackbone + + backbone_config = getattr(config, "backbone_config", None) + + if backbone_config is None: + backbone = AutoBackbone.from_config(config=config) + else: + backbone = AutoBackbone.from_config(config=backbone_config) + return backbone diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/cache_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/cache_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..530ceda9d593fb5cdc36d82e0086888d7e0286a3 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/cache_utils.py @@ -0,0 +1,1290 @@ +from abc import ABC, abstractmethod +from collections.abc import Iterable +from typing import Any + +import torch + +from .configuration_utils import PreTrainedConfig +from .utils import ( + is_hqq_available, + is_optimum_quanto_available, + is_quanto_greater, + is_torch_greater_or_equal, + is_torchdynamo_compiling, + logging, +) + + +if is_hqq_available(): + from hqq.core.quantize import Quantizer as HQQQuantizer + +_is_torch_greater_or_equal_than_2_7 = is_torch_greater_or_equal("2.7", accept_dev=True) + + +logger = logging.get_logger(__name__) + + +class CacheLayerMixin(ABC): + """Base, abstract class for a single layer's cache.""" + + is_compileable = False + + def __init__(self): + self.keys: torch.Tensor | None = None + self.values: torch.Tensor | None = None + self.is_initialized = False + + def __repr__(self): + return f"{self.__class__.__name__}" + + @abstractmethod + def lazy_initialization(self, key_states: torch.Tensor, value_states: torch.Tensor) -> None: ... + + @abstractmethod + def update( + self, key_states: torch.Tensor, value_states: torch.Tensor, cache_kwargs: dict[str, Any] | None = None + ) -> tuple[torch.Tensor, torch.Tensor]: ... + + @abstractmethod + def get_mask_sizes(self, cache_position: torch.Tensor) -> tuple[int, int]: ... + + @abstractmethod + def get_seq_length(self) -> int: ... + + @abstractmethod + def get_max_cache_shape(self) -> int: ... + + def offload(self): + """Offload this layer's data to CPU device.""" + if self.is_initialized: + self.keys = self.keys.to("cpu", non_blocking=True) + self.values = self.values.to("cpu", non_blocking=True) + + def prefetch(self): + """In case of layer offloading, this allows to move the data back to the layer's device ahead of time.""" + if self.is_initialized and self.keys.device != self.device: + self.keys = self.keys.to(self.device, non_blocking=True) + self.values = self.values.to(self.device, non_blocking=True) + + def reset(self) -> None: + """Resets the cache values while preserving the objects""" + if self.is_initialized: + self.keys.zero_() + self.values.zero_() + # This attribute is set on several Layers + if hasattr(self, "cumulative_length"): + self.cumulative_length = 0 + + def reorder_cache(self, beam_idx: torch.LongTensor) -> None: + """Reorders this layer's cache for beam search.""" + if self.get_seq_length() > 0: + self.keys = self.keys.index_select(0, beam_idx.to(self.keys.device)) + self.values = self.values.index_select(0, beam_idx.to(self.values.device)) + + +class DynamicLayer(CacheLayerMixin): + """ + A cache layer that grows dynamically as more tokens are generated. This is the default for generative models. + It stores the key and value states as tensors of shape `[batch_size, num_heads, seq_len, head_dim]`. + """ + + is_sliding = False + + def lazy_initialization(self, key_states: torch.Tensor, value_states: torch.Tensor) -> None: + self.dtype, self.device = key_states.dtype, key_states.device + self.keys = torch.tensor([], dtype=self.dtype, device=self.device) + self.values = torch.tensor([], dtype=self.dtype, device=self.device) + self.is_initialized = True + + def update( + self, + key_states: torch.Tensor, + value_states: torch.Tensor, + cache_kwargs: dict[str, Any] | None = None, + ) -> tuple[torch.Tensor, torch.Tensor]: + """ + Update the key and value caches in-place, and return the necessary keys and value states. + + Args: + key_states (`torch.Tensor`): The new key states to cache. + value_states (`torch.Tensor`): The new value states to cache. + cache_kwargs (`dict[str, Any]`, *optional*): Additional arguments for the cache. + + Returns: + tuple[`torch.Tensor`, `torch.Tensor`]: The key and value states. + """ + # Lazy initialization + if not self.is_initialized: + self.lazy_initialization(key_states, value_states) + + self.keys = torch.cat([self.keys, key_states], dim=-2) + self.values = torch.cat([self.values, value_states], dim=-2) + return self.keys, self.values + + def get_mask_sizes(self, cache_position: torch.Tensor) -> tuple[int, int]: + """Return the length and offset of the cache, used to generate the mask""" + kv_offset = 0 + query_length = cache_position.shape[0] + kv_length = self.get_seq_length() + query_length + return kv_length, kv_offset + + def get_seq_length(self) -> int: + """Returns the sequence length of the cached states.""" + if not self.is_initialized or self.keys.numel() == 0: + return 0 + return self.keys.shape[-2] + + def get_max_cache_shape(self) -> int: + """Returns the maximum sequence length of the cache object. DynamicLayer does not have a maximum length.""" + return -1 + + def crop(self, max_length: int) -> None: + """ + Crop the past key values up to a new `max_length` in terms of tokens. `max_length` can also be negative + to remove `max_length` tokens. + """ + if max_length < 0: + max_length = self.get_seq_length() - abs(max_length) + + if self.get_seq_length() <= max_length: + return + + self.keys = self.keys[..., :max_length, :] + self.values = self.values[..., :max_length, :] + + def batch_repeat_interleave(self, repeats: int) -> None: + """Repeat the cache `repeats` times in the batch dimension.""" + if self.get_seq_length() > 0: + self.keys = self.keys.repeat_interleave(repeats, dim=0) + self.values = self.values.repeat_interleave(repeats, dim=0) + + def batch_select_indices(self, indices: torch.Tensor) -> None: + """Only keep the `indices` in the batch dimension of the cache.""" + if self.get_seq_length() > 0: + self.keys = self.keys[indices, ...] + self.values = self.values[indices, ...] + + +class DynamicSlidingWindowLayer(DynamicLayer): + """ + A cache layer that grows dynamically as more tokens are generated, up until the sliding window size. + It stores the key and value states as tensors of shape `[batch_size, num_heads, min(seq_len, sliding_window), head_dim]`. + """ + + is_sliding = True + + def __init__(self, sliding_window: int): + super().__init__() + self.sliding_window = sliding_window + self.cumulative_length = 0 + self._sliding_window_tensor = torch.tensor(self.sliding_window, dtype=torch.long) + + def lazy_initialization(self, key_states: torch.Tensor, value_states: torch.Tensor) -> None: + super().lazy_initialization(key_states, value_states) + self._sliding_window_tensor = self._sliding_window_tensor.to(self.device) + + def update( + self, + key_states: torch.Tensor, + value_states: torch.Tensor, + cache_kwargs: dict[str, Any] | None = None, + ) -> tuple[torch.Tensor, torch.Tensor]: + """ + Update the key and value caches in-place, and return the necessary keys and value states. + + Args: + key_states (`torch.Tensor`): The new key states to cache. + value_states (`torch.Tensor`): The new value states to cache. + cache_kwargs (`dict[str, Any]`, *optional*): Additional arguments for the cache. + + Returns: + tuple[`torch.Tensor`, `torch.Tensor`]: The key and value states. + """ + # Lazy initialization + if not self.is_initialized: + self.lazy_initialization(key_states, value_states) + + self.cumulative_length += key_states.shape[-2] + + # Compute the full states + full_key_states = torch.cat([self.keys, key_states], dim=-2) + full_value_states = torch.cat([self.values, value_states], dim=-2) + # Only cache the last `self.sliding_window - 1` tokens (or all of them if lower than that) + self.keys = full_key_states[:, :, -self.sliding_window + 1 :, :] + self.values = full_value_states[:, :, -self.sliding_window + 1 :, :] + + # Return the full states + return full_key_states, full_value_states + + def get_mask_sizes(self, cache_position: torch.Tensor) -> tuple[int, int]: + """Return the length and offset of the cache, used to generate the attention mask""" + query_length = cache_position.shape[0] + is_full = self.cumulative_length >= self.sliding_window + + kv_offset = max(self.cumulative_length - self.sliding_window + 1, 0) + if is_full: + kv_length = self.sliding_window - 1 + query_length + else: + kv_length = self.cumulative_length + query_length + + return kv_length, kv_offset + + def get_seq_length(self) -> int: + """Returns the sequence length of the cached states.""" + return self.cumulative_length + + def get_max_cache_shape(self) -> int: + """Return the maximum cache shape of the cache""" + return self.sliding_window + + def crop(self, max_length: int) -> None: + """ + Crop the past key values up to a new `max_length` in terms of tokens. `max_length` can also be + negative to remove `max_length` tokens. + """ + if self.get_seq_length() >= self.sliding_window: + raise ValueError( + "Cannot `crop` a `DynamicSlidingWindowLayer` after it has seen more tokens than its" + "sliding window (otherwise some states are lost)" + ) + super().crop(max_length) + self.cumulative_length = self.keys.shape[-2] + + +class StaticLayer(CacheLayerMixin): + """ + A static cache layer that stores the key and value states as static tensors of shape `[batch_size, num_heads, max_cache_len), head_dim]`. + It lazily allocates its full backing tensors, and then mutates them in-place. Built for `torch.compile` support. + + Args: + max_cache_len (`int`): + Maximum number of tokens that can be stored, used for tensor preallocation. + """ + + is_compileable = True + is_sliding = False + + def __init__(self, max_cache_len: int): + super().__init__() + self.max_cache_len = max_cache_len + + def lazy_initialization(self, key_states: torch.Tensor, value_states: torch.Tensor) -> None: + """ + Lazy initialization of the keys and values tensors. This allows to get all properties (dtype, device, + num_heads in case of TP etc...) at runtime directly, which is extremely practical as it avoids moving + devices, dtypes etc later on for each `update` (which could break the static dynamo addresses as well). + + If this is unwanted, one can call `early_initialization(...)` on the Cache directly, which will call this + function ahead-of-time (this is required for `torch.export` for example). Note that for `compile`, as we + internally don't compile the prefill, this is guaranteed to have been called already when compiling. + If compiling the prefill as well, e.g. calling `model.compile(...)` before `generate` with a static cache, + it is still supported in general, but without guarantees depending on the compilation options (e.g. cuda graphs, + i.e. `mode="reduce-overhead"` is known to fail). But it will in general work correctly, and prefill should + not be compiled anyway for performances! + """ + self.dtype, self.device = key_states.dtype, key_states.device + self.max_batch_size, self.num_heads = key_states.shape[:2] + self.v_head_dim = value_states.shape[-1] + self.k_head_dim = key_states.shape[-1] + + self.keys = torch.zeros( + (self.max_batch_size, self.num_heads, self.max_cache_len, self.k_head_dim), + dtype=self.dtype, + device=self.device, + ) + self.values = torch.zeros( + (self.max_batch_size, self.num_heads, self.max_cache_len, self.v_head_dim), + dtype=self.dtype, + device=self.device, + ) + # Note: `mark_static_address` is used to tag the cache as a fixed data pointer, preventing compiled graph + # breaks when updating the cache. However, it is not supported when tracing the graph, so we skip it in this case. + # As prefill should never be compiled, this is not an issue and it will still be run (except when users compile + # prefill explicitly, but this should be avoided!) + if not is_torchdynamo_compiling(): + torch._dynamo.mark_static_address(self.keys) + torch._dynamo.mark_static_address(self.values) + + self.is_initialized = True + + def update( + self, + key_states: torch.Tensor, + value_states: torch.Tensor, + cache_kwargs: dict[str, Any] | None = None, + ) -> tuple[torch.Tensor, torch.Tensor]: + """ + Update the key and value caches in-place, and return the necessary keys and value states. + + Args: + key_states (`torch.Tensor`): The new key states to cache. + value_states (`torch.Tensor`): The new value states to cache. + cache_kwargs (`dict[str, Any]`, *optional*): Additional arguments for the cache. + + Returns: + tuple[`torch.Tensor`, `torch.Tensor`]: The key and value states. + """ + # Lazy initialization + if not self.is_initialized: + self.lazy_initialization(key_states, value_states) + + # Some old models give None for `cache_position` or even omit passing `cache_kwargs` when used as cross-attention, + # in which case we should copy the whole Layer (key_states.shape[-2] == self.max_cache_len) + cache_position = cache_kwargs.get("cache_position") if cache_kwargs is not None else None + cache_position = ( + cache_position if cache_position is not None else torch.arange(key_states.shape[-2], device=self.device) + ) + + # Update the cache + try: + self.keys.index_copy_(2, cache_position, key_states) + self.values.index_copy_(2, cache_position, value_states) + except NotImplementedError: + # Fallback for devices like MPS where index_copy_ might not be supported. + self.keys[:, :, cache_position] = key_states + self.values[:, :, cache_position] = value_states + return self.keys, self.values + + def get_mask_sizes(self, cache_position: torch.Tensor) -> tuple[int, int]: + """Return the length and offset of the cache, used to generate the attention mask""" + kv_offset = 0 + kv_length = self.max_cache_len + return kv_length, kv_offset + + def get_seq_length(self) -> int: + """Returns the sequence length of the cached states.""" + # Occupied cache == any slot in the 3rd dim (sequence length) holds a non-zero value. To save on compute, let's + # limit the check to the first batch member and head dimension. + return (self.keys[0, 0].any(dim=-1)).sum() if self.is_initialized else 0 + + def get_max_cache_shape(self) -> int: + """Return the maximum cache shape of the cache""" + return self.max_cache_len + + +class StaticSlidingWindowLayer(StaticLayer): + """ + A static cache layer that stores the key and value states as static tensors of shape + `[batch_size, num_heads, min(max_cache_len, sliding_window), head_dim]`. It lazily allocates its full backing + tensors, and then mutates them in-place. Built for `torch.compile` support. + + Args: + max_cache_len (`int`): + Maximum number of tokens that can be stored, used for tensor preallocation. + sliding_window (`int`): + The size of the sliding window. + """ + + is_sliding = True + + def __init__(self, max_cache_len: int, sliding_window: int): + effective_max_cache_len = min(sliding_window, max_cache_len) + super().__init__(max_cache_len=effective_max_cache_len) + self.cumulative_length = 0 + + def update( + self, + key_states: torch.Tensor, + value_states: torch.Tensor, + cache_kwargs: dict[str, Any] | None = None, + ) -> tuple[torch.Tensor, torch.Tensor]: + """ + Update the key and value caches in-place, and return the necessary keys and value states. + + Args: + key_states (`torch.Tensor`): The new key states to cache. + value_states (`torch.Tensor`): The new value states to cache. + cache_kwargs (`dict[str, Any]`, *optional*): Additional arguments for the cache. + + Returns: + tuple[`torch.Tensor`, `torch.Tensor`]: The key and value states. + """ + # Lazy initialization + if not self.is_initialized: + self.lazy_initialization(key_states, value_states) + + # Some old models give None for `cache_position` or even omit passing `cache_kwargs` when used as cross-attention, + # in which case we should copy the whole Layer (key_states.shape[-2] == self.max_cache_len) + cache_position = cache_kwargs.get("cache_position") if cache_kwargs is not None else None + cache_position = ( + cache_position if cache_position is not None else torch.arange(key_states.shape[-2], device=self.device) + ) + + cumulative_length = self.cumulative_length + is_full = cumulative_length >= self.max_cache_len + # Update it now that we saved the value above + self.cumulative_length += key_states.shape[-2] + + if is_full: + # In general, we should use a much simpler `cat` here as well, independently of the states size. However, + # dynamo is currently bugged when doing it - see https://github.com/pytorch/pytorch/issues/159855 for more details + if key_states.shape[-2] == 1: + # Roll all values to the left by 1 position + new_keys = self.keys.roll(-1, dims=-2) + new_values = self.values.roll(-1, dims=-2) + # Overwrite the last position with new states + # (note: very important to use a tensor to index here, see https://github.com/pytorch/pytorch/issues/159855) + index = torch.tensor([-1], dtype=int, device=self.device) + new_keys[:, :, index] = key_states + new_values[:, :, index] = value_states + + # Copy back into `self` (do not just assign again) in order to keep the static dynamo address + self.keys.copy_(new_keys) + self.values.copy_(new_values) + # Very important to return the `self` tensors here, as they have the static dynamo address + return self.keys, self.values + # Already full but using more than 1 new token (e.g. prefill caching, chat continuation, etc...) + else: + full_key_states = torch.cat((self.keys[:, :, 1:, :], key_states), dim=-2) + full_value_states = torch.cat((self.values[:, :, 1:, :], value_states), dim=-2) + # Not yet full, but becoming full on this update + elif cumulative_length + key_states.shape[2] > self.max_cache_len: + # Fast prefill path, no need to cat() in this case, as the cache is currently empty + if cumulative_length == 0: + full_key_states = key_states + full_value_states = value_states + else: + full_key_states = torch.cat((self.keys[:, :, :cumulative_length, :], key_states), dim=-2) + full_value_states = torch.cat((self.values[:, :, :cumulative_length, :], value_states), dim=-2) + else: + try: + self.keys.index_copy_(2, cache_position, key_states) + self.values.index_copy_(2, cache_position, value_states) + except NotImplementedError: + self.keys[:, :, cache_position] = key_states + self.values[:, :, cache_position] = value_states + + # Very important to return the `self` tensors here, as they have the static dynamo address + return self.keys, self.values + + # We only cache the last `sliding_window` tokens + self.keys.copy_(full_key_states[:, :, -self.max_cache_len :, :]) + self.values.copy_(full_value_states[:, :, -self.max_cache_len :, :]) + # we should return the whole states instead of `self.keys/values` here, as otherwise we lose some context + return full_key_states, full_value_states + + def get_mask_sizes(self, cache_position: torch.Tensor) -> tuple[int, int]: + """Return the length and offset of the cache, used to generate the attention mask""" + query_length = cache_position.shape[0] + sliding_window = self.max_cache_len + is_full = self.cumulative_length >= self.max_cache_len + + kv_offset = max(self.cumulative_length - sliding_window + 1, 0) + # The cache is already full + if is_full: + kv_length = sliding_window + query_length - 1 + # Not yet full, but becoming full on this update + elif self.cumulative_length + query_length > sliding_window: + kv_length = self.cumulative_length + query_length + # Here the Cache is still smaller than the local size, but we return the local size as it's static + else: + kv_length = sliding_window + + return kv_length, kv_offset + + def get_seq_length(self) -> int: + """Returns the sequence length of the cached states.""" + return self.cumulative_length + + +class QuantizedLayer(DynamicLayer): + """ + A quantized layer similar to what is described in the [KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache paper](https://huggingface.co/papers/2402.02750). + It allows the model to generate longer sequence length without allocating too much memory for the key and value caches by + applying quantization. + + The cache has two types of storage, one for original precision and one for the quantized cache. A `residual length` + is set as a maximum capacity for the original precision cache. When the length goes beyond maximum capacity, the original + precision cache is discarded and moved into the quantized cache. The quantization is done per-channel with a set `q_group_size` + for both Keys and Values, in contrast to what was described in the paper. + """ + + def __init__( + self, + nbits: int = 4, + axis_key: int = 0, + axis_value: int = 0, + q_group_size: int = 64, + residual_length: int = 128, + ): + super().__init__() + self.nbits = nbits + self.axis_key = axis_key + self.axis_value = axis_value + self.q_group_size = q_group_size + self.residual_length = residual_length + self.cumulative_length = 0 + + def update( + self, + key_states: torch.Tensor, + value_states: torch.Tensor, + cache_kwargs: dict[str, Any] | None = None, + ) -> tuple[torch.Tensor, torch.Tensor]: + """ + Update the key and value caches in-place, and return the necessary keys and value states. + + Args: + key_states (`torch.Tensor`): The new key states to cache. + value_states (`torch.Tensor`): The new value states to cache. + cache_kwargs (`dict[str, Any]`, *optional*): Additional arguments for the cache. + + Returns: + tuple[`torch.Tensor`, `torch.Tensor`]: The key and value states. + """ + self.cumulative_length += key_states.shape[-2] + + # Lazy initialization + if not self.is_initialized: + self.lazy_initialization(key_states, value_states) + self._quantized_keys = self._quantize(key_states.contiguous(), axis=self.axis_key) + self._quantized_values = self._quantize(value_states.contiguous(), axis=self.axis_value) + return key_states, value_states + + dequant_keys = self._dequantize(self._quantized_keys) + dequant_values = self._dequantize(self._quantized_values) + keys_to_return = torch.cat([dequant_keys, self.keys, key_states], dim=-2) + values_to_return = torch.cat([dequant_values, self.values, value_states], dim=-2) + if self.keys.dim() == 4 and self.keys.shape[-2] + 1 >= self.residual_length: + self._quantized_keys = self._quantize(keys_to_return.contiguous(), axis=self.axis_key) + self._quantized_values = self._quantize(values_to_return.contiguous(), axis=self.axis_value) + self.keys = torch.tensor([], dtype=key_states.dtype, device=key_states.device) + self.values = torch.tensor([], dtype=key_states.dtype, device=key_states.device) + else: + self.keys = torch.cat([self.keys, key_states], dim=-2) + self.values = torch.cat([self.values, value_states], dim=-2) + + return keys_to_return, values_to_return + + @abstractmethod + def _quantize(self, tensor, axis): ... + + @abstractmethod + def _dequantize(self, q_tensor): ... + + def get_seq_length(self) -> int: + """Returns the sequence length of the cached states.""" + return self.cumulative_length + + +class QuantoQuantizedLayer(QuantizedLayer): + def __init__( + self, + nbits: int = 4, + axis_key: int = 0, + axis_value: int = 0, + q_group_size: int = 64, + residual_length: int = 128, + ): + super().__init__( + nbits=nbits, + axis_key=axis_key, + axis_value=axis_value, + q_group_size=q_group_size, + residual_length=residual_length, + ) + + # We need to import quanto here to avoid circular imports due to optimum/quanto/models/transformers_models.py + if not is_optimum_quanto_available(): + raise ImportError( + "You need to install optimum-quanto in order to use KV cache quantization with optimum-quanto " + "backend. Please install it via with `pip install optimum-quanto`" + ) + elif is_quanto_greater("0.2.5", accept_dev=True): + from optimum.quanto import MaxOptimizer, qint2, qint4 + else: + raise ImportError( + "You need optimum-quanto package version to be greater or equal than 0.2.5 to use `QuantoQuantizedLayer`. " + ) + + if self.nbits not in [2, 4]: + raise ValueError(f"`nbits` for `quanto` backend has to be one of [`2`, `4`] but got {self.nbits}") + + if self.axis_key not in [0, -1]: + raise ValueError(f"`axis_key` for `quanto` backend has to be one of [`0`, `-1`] but got {self.axis_key}") + + if self.axis_value not in [0, -1]: + raise ValueError( + f"`axis_value` for `quanto` backend has to be one of [`0`, `-1`] but got {self.axis_value}" + ) + + self.qtype = qint4 if self.nbits == 4 else qint2 + self.optimizer = MaxOptimizer() # hardcode as it's the only one for per-channel quantization + + def _quantize(self, tensor, axis): + from optimum.quanto import quantize_weight + + scale, zeropoint = self.optimizer(tensor, self.qtype, axis, self.q_group_size) + qtensor = quantize_weight(tensor, self.qtype, axis, scale, zeropoint, self.q_group_size) + return qtensor + + def _dequantize(self, qtensor): + return qtensor.dequantize() + + +class HQQQuantizedLayer(QuantizedLayer): + def __init__( + self, + nbits: int = 4, + axis_key: int = 0, + axis_value: int = 0, + q_group_size: int = 64, + residual_length: int = 128, + ): + super().__init__( + nbits=nbits, + axis_key=axis_key, + axis_value=axis_value, + q_group_size=q_group_size, + residual_length=residual_length, + ) + + if not is_hqq_available(): + raise ImportError( + "You need to install `HQQ` in order to use KV cache quantization with HQQ backend. " + "Please install it via with `pip install hqq`" + ) + + if self.nbits not in [1, 2, 3, 4, 8]: + raise ValueError( + f"`nbits` for `HQQ` backend has to be one of [`1`, `2`, `3`, `4`, `8`] but got {self.nbits}" + ) + + if self.axis_key not in [0, 1]: + raise ValueError(f"`axis_key` for `HQQ` backend has to be one of [`0`, `1`] but got {self.axis_key}") + + if self.axis_value not in [0, 1]: + raise ValueError(f"`axis_value` for `HQQ` backend has to be one of [`0`, `1`] but got {self.axis_value}") + + self.quantizer = HQQQuantizer + + def _quantize(self, tensor, axis): + qtensor, meta = self.quantizer.quantize( + tensor, + axis=axis, + device=self.keys.device, + compute_dtype=self.keys.dtype, + nbits=self.nbits, + group_size=self.q_group_size, + ) + meta["compute_dtype"] = self.keys.dtype + self.quantizer.cuda(qtensor, meta=meta, device=self.keys.device) # Move to device and cast to dtype + meta["scale"] = meta["scale"].to(qtensor.device) + meta["zero"] = meta["zero"].to(qtensor.device) + return qtensor, meta + + def _dequantize(self, qtensor): + quant_tensor, meta = qtensor + tensor = self.quantizer.dequantize(quant_tensor, meta) + return tensor + + +class Cache: + """ + A `Cache` is mostly a list of `CacheLayerMixin` objects, one per model layer. It serves as a container for + the Cache of each layer. + + Args: + layers (`Optional`, *optional*): + A list of pre-created `CacheLayerMixin`. If omitted (`None`), then `layer_class_to_replicate` will + be used. + layer_class_to_replicate (`type[CacheLayerMixin]`, *optional*): + Only used if `layers` is omitted (`None`), in which case it will be used as the base class for each layer, + and the layers will be added lazily as soon as `update` is called with a `layer_idx` greater than the current + list of layers. + offloading (`bool`, *optional*, defaults to `False`): + Whether to perform offloading of the layers to `cpu`, to save GPU memory. + offload_only_non_sliding (`bool`, *optional*, defaults to `True`): + If `offloading` is `True`, this further decides if only the non-sliding layers will be offloaded (because + usually the sliding layers are small in size, so there is no need to offload them, and skipping it is faster). + """ + + def __init__( + self, + layers: list[CacheLayerMixin] | None = None, + layer_class_to_replicate: type[CacheLayerMixin] | None = None, + offloading: bool = False, + offload_only_non_sliding: bool = True, + ): + if layers is not None and layer_class_to_replicate is not None: + raise ValueError( + "You can construct a Cache either from a list `layers` of all the predefined `CacheLayer`, or from a " + "`layer_class_to_replicate`, in which case the Cache will append a new layer corresponding to " + "`layer_class_to_replicate` for each new call to `update` with an idx not already in the Cache." + ) + if layers is None and layer_class_to_replicate is None: + raise ValueError( + "You should provide exactly one of `layers` or `layer_class_to_replicate` to initialize a Cache." + ) + self.layers = layers if layers is not None else [] + self.layer_class_to_replicate = layer_class_to_replicate + self.offloading = offloading + if self.offloading: + self.only_non_sliding = offload_only_non_sliding + self.prefetch_stream = torch.Stream() if _is_torch_greater_or_equal_than_2_7 else torch.cuda.Stream() + + def __repr__(self): + return f"{self.__class__.__name__}(layers={self.layers})" + + def prefetch(self, layer_idx: int, only_non_sliding: bool = True): + """ + Prefetch a given layer on its device. If `only_non_sliding` is True, it will try to prefetch only the layers + which are non-sliding. If the `layer_idx` is outside the range, this will circle back to the first layers. + Note that we use a non-default stream for this, to avoid blocking. + """ + if only_non_sliding: + # Try to find next non-sliding, starting at `layer_idx` + try: + layer_idx = layer_idx + self.is_sliding[layer_idx:].index(False) + # In this case, we need to circle back to the beginning + except ValueError: + layer_idx = self.is_sliding.index(False) + else: + layer_idx = layer_idx if layer_idx < len(self.layers) else 0 + + # Prefetch + with self.prefetch_stream if _is_torch_greater_or_equal_than_2_7 else torch.cuda.stream(self.prefetch_stream): + self.layers[layer_idx].prefetch() + + def offload(self, layer_idx: int, only_non_sliding: bool = True): + """ + Offload a given `layer_idx`. If `only_non_sliding` is True, it will offload `layer_idx` only if it is a + non-sliding layer. Note that we do it on the default stream, so that we ensure all earlier + computation in the layer's `update` methods are finished. + """ + if not (only_non_sliding and self.is_sliding[layer_idx]): + self.layers[layer_idx].offload() + + def update( + self, + key_states: torch.Tensor, + value_states: torch.Tensor, + layer_idx: int, + cache_kwargs: dict[str, Any] | None = None, + ) -> tuple[torch.Tensor, torch.Tensor]: + """ + Updates the cache with the new `key_states` and `value_states` for the layer `layer_idx`. + + Parameters: + key_states (`torch.Tensor`): + The new key states to cache. + value_states (`torch.Tensor`): + The new value states to cache. + layer_idx (`int`): + The index of the layer to cache the states for. + cache_kwargs (`dict[str, Any]`, *optional*): + Additional arguments for the cache subclass. These are specific to each subclass and allow new types of + cache to be created. + + Return: + A tuple containing the updated key and value states. + """ + # In this case, the `layers` were not provided, and we must append as much as `layer_idx` + if self.layer_class_to_replicate is not None: + while len(self.layers) <= layer_idx: + self.layers.append(self.layer_class_to_replicate()) + + if self.offloading: + # Wait for the stream to finish if needed, and start prefetching the next layer + torch.cuda.default_stream(key_states.device).wait_stream(self.prefetch_stream) + self.prefetch(layer_idx + 1, self.only_non_sliding) + + keys, values = self.layers[layer_idx].update(key_states, value_states, cache_kwargs) + + if self.offloading: + self.offload(layer_idx, self.only_non_sliding) + + return keys, values + + def early_initialization( + self, batch_size: int, num_heads: int, head_dim: int, dtype: torch.dtype, device: torch.device + ): + """ + Initialize all the layers in advance (it's otherwise lazily initialized on the first `update` call). + This is useful for our `export` recipes, as `export` needs everything in advance. + """ + # Note that the initialization needs all dimensions (except -2), as well as device and dtype, so we use + # this fake tensor approach. It has size 0 on the -2 dimension, so it does not allocate any data (it only + # creates an empty tensor with correct shape, dtype and device), which is very efficient and practical + fake_kv_tensor = torch.zeros((batch_size, num_heads, 0, head_dim), dtype=dtype, device=device) + # Init all layers + for layer in self.layers: + layer.lazy_initialization(fake_kv_tensor, fake_kv_tensor) + + def get_seq_length(self, layer_idx: int = 0) -> int: + """Returns the sequence length of the cache for the given layer.""" + if layer_idx >= len(self.layers): + return 0 + return self.layers[layer_idx].get_seq_length() + + def get_mask_sizes(self, cache_position: torch.Tensor, layer_idx: int) -> tuple[int, int]: + """ + Return a tuple (kv_length, kv_offset) corresponding to the length and offset that will be returned for + the given layer at `layer_idx`. + The masks are then prepared according to the given lengths (kv_length, kv_offset) and patterns for each layer. + """ + # For DynamicCache, where the layers are created at runtime -> if it was not yet created, the size is + # simply the shape of `cache_position` + if layer_idx >= len(self.layers): + return cache_position.shape[0], 0 + return self.layers[layer_idx].get_mask_sizes(cache_position) + + def get_max_cache_shape(self, layer_idx: int = 0) -> int: + """Returns maximum sequence length of the cache object. Dynamic caches do not have a maximum length.""" + # For DynamicCache, where the layers are created at runtime -> if it was not yet created, return -1 + # as DynamicLayer does + if layer_idx >= len(self.layers): + return -1 + return self.layers[layer_idx].get_max_cache_shape() + + def reset(self): + """Recursively reset all layers tensors""" + for layer_idx in range(len(self.layers)): + self.layers[layer_idx].reset() + + def reorder_cache(self, beam_idx: torch.LongTensor): + """Reorder the cache for beam search""" + for layer_idx in range(len(self.layers)): + self.layers[layer_idx].reorder_cache(beam_idx) + + def crop(self, max_length: int): + """Crop the cache to the given length""" + for layer_idx in range(len(self.layers)): + self.layers[layer_idx].crop(max_length) + + def batch_repeat_interleave(self, repeats: int): + """Repeat and interleave the cache""" + for layer_idx in range(len(self.layers)): + self.layers[layer_idx].batch_repeat_interleave(repeats) + + def batch_select_indices(self, indices: torch.Tensor): + """Select indices from the cache""" + for layer_idx in range(len(self.layers)): + self.layers[layer_idx].batch_select_indices(indices) + + @property + def max_batch_size(self) -> int: + """Return the maximum batch size of the cache""" + values = [layer.max_batch_size for layer in self.layers] + if len(set(values)) > 1: + raise ValueError(f"Max batch size is not consistent across layers: {values}") + return values[0] + + @property + def max_cache_len(self) -> int: + """Return the maximum cache length of the cache""" + values = [layer.max_cache_len for layer in self.layers] + return max(values) + + @property + def is_compileable(self) -> bool: + """Return whether the cache is compilable""" + # For DynamicCache dispatching the layers lazily (otherwise, all([]) is True) + if len(self.layers) == 0: + return False + return all(layer.is_compileable for layer in self.layers) + + @property + def is_initialized(self) -> bool: + """Return whether the cache data is initialized""" + return len(self.layers) > 0 and all(layer.is_initialized for layer in self.layers) + + @property + def is_sliding(self) -> list[bool]: + """Return whether the layers of the cache are sliding window""" + return [getattr(layer, "is_sliding", False) for layer in self.layers] + + def __len__(self): + """ + This value corresponds to the number of layers in the model. + """ + # Note: for DynamicCache, layers are initialized lazily, so this will not be accurate before the first + # forward through all the layers + return len(self.layers) + + +class DynamicCache(Cache): + """ + A cache that grows dynamically as more tokens are generated. This is the default for generative models. + It stores the key and value states as a list of `CacheLayer`, one for each layer. The expected shape for each tensor + in the `CacheLayer`s is `[batch_size, num_heads, seq_len, head_dim]`. + If a config is passed, it will additionally check for sliding or hybrid cache structure, greatly reducing the + memory requirement of the cached tensors to `[batch_size, num_heads, min(seq_len, sliding_window), head_dim]`. + + See `Cache` for details on common methods that are implemented by all cache classes. + + Args: + ddp_cache_data (`Iterable[tuple[torch.Tensor, torch.Tensor]]`, *optional*): + It was originally added for compatibility with `torch.distributed` (DDP). In a nutshell, it is + `map(gather_map, zip(*caches))`, i.e. each item in the iterable contains the key and value states + for a layer gathered across replicas by torch.distributed (shape=[global batch size, num_heads, seq_len, head_dim]). + Note: it needs to be the 1st arg as well to work correctly + config (`PreTrainedConfig`, *optional*): + The config of the model for which this Cache will be used. If passed, it will be used to check for sliding + or hybrid layer structure, greatly reducing the memory requirement of the cached tensors to + `[batch_size, num_heads, min(seq_len, sliding_window), head_dim]`. + offloading (`bool`, *optional*, defaults to `False`): + Whether to perform offloading of the layers to `cpu`, to save GPU memory. + offload_only_non_sliding (`bool`, *optional*, defaults to `False`): + If `offloading` is `True`, this further decides if only the non-sliding layers will be offloaded (because + usually the sliding layers are small in size, so there is no need to offload them, and skipping it is faster). + + Example: + + ```python + >>> from transformers import AutoTokenizer, AutoModelForCausalLM, DynamicCache + + >>> model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2-0.5B-Instruct") + >>> tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-0.5B-Instruct") + + >>> inputs = tokenizer(text="My name is Qwen2", return_tensors="pt") + + >>> # Prepare a cache class and pass it to model's forward + >>> past_key_values = DynamicCache(config=model.config) + >>> outputs = model(**inputs, past_key_values=past_key_values, use_cache=True) + >>> outputs.past_key_values # access cache filled with key/values from generation + ``` + """ + + def __init__( + self, + ddp_cache_data: Iterable[tuple[torch.Tensor | None, ...]] | None = None, + config: PreTrainedConfig | None = None, + offloading: bool = False, + offload_only_non_sliding: bool = False, + ): + layers = [] + # If a config is passed, use it to infer the layer types and initialize accordingly + if config is not None: + decoder_config = config.get_text_config(decoder=True) + sliding_window = getattr(decoder_config, "sliding_window", None) or getattr( + decoder_config, "attention_chunk_size", None + ) + layer_types = getattr(decoder_config, "layer_types", None) + if layer_types is None: + layer_types = [ + "sliding_attention" if sliding_window is not None else "full_attention" + for _ in range(decoder_config.num_hidden_layers) + ] + # Some models have shared layers thus no cache is needed for them (e.g. Gemma3n) + if hasattr(decoder_config, "num_kv_shared_layers"): + layer_types = layer_types[: -decoder_config.num_kv_shared_layers] + + for layer_type in layer_types: + # From a cache point of view, both sliding and chunked are the same in how they should behave and how many + # states they should return - only the mask changes to make them different at the end! + if layer_type in ("sliding_attention", "chunked_attention"): + layers.append(DynamicSlidingWindowLayer(sliding_window=sliding_window)) + else: + layers.append(DynamicLayer()) + + # In this case, use the passed data to already fill in the Cache + if ddp_cache_data is not None: + # Init all the layers with the data + for layer_idx, kv_and_optional_sliding in enumerate(ddp_cache_data): + # If the config was not passed above, initialize a new cache layer for each entry of the ddp_data + if config is None: + # kv_and_optional_sliding contains at least two elements: the key and value states. It can also + # contain a third element, which is an optional sliding window tensor. + sliding_window_tensor = kv_and_optional_sliding[2] if len(kv_and_optional_sliding) == 3 else None + # If there is a sliding window tensor, use it to initialize the layer + if sliding_window_tensor is not None: + # Since the same layer is dispatched across replicas, sliding_window is the same for all + sliding_window = sliding_window_tensor[0].item() + layers.append(DynamicSlidingWindowLayer(sliding_window=sliding_window)) + else: + layers.append(DynamicLayer()) + # Update the layer with the data + _, _ = layers[layer_idx].update(kv_and_optional_sliding[0], kv_and_optional_sliding[1]) + + # If neither of config nor ddp_data was passed, then simply lazy init a full cache of DynamicLayer + if len(layers) == 0: + super().__init__( + layer_class_to_replicate=DynamicLayer, + offloading=offloading, + offload_only_non_sliding=offload_only_non_sliding, + ) + else: + super().__init__(layers=layers, offloading=offloading, offload_only_non_sliding=offload_only_non_sliding) + + def __iter__(self): + for layer in self.layers: + yield layer.keys, layer.values, getattr(layer, "_sliding_window_tensor", None) + + +class StaticCache(Cache): + """ + Static Cache class to be used with `torch.compile(model)` and `torch.export()`. It will check the `config` + for potential hybrid cache structure, and initialize each layer accordingly. + + See `Cache` for details on common methods that are implemented by all cache classes. + + Args: + config (`PreTrainedConfig`): + The config of the model for which this Cache will be used. It will be used to check for sliding + or hybrid layer structure, and initialize each layer accordingly. + max_cache_len (`int`): + The maximum number of tokens that this Cache should hold. + offloading (`bool`, *optional*, defaults to `False`): + Whether to perform offloading of the layers to `cpu`, to save GPU memory. + offload_only_non_sliding (`bool`, *optional*, defaults to `True`): + If `offloading` is `True`, this further decides if only the non-sliding layers will be offloaded (because + usually the sliding layers are small in size, so there is no need to offload them, and skipping it is faster). + + Example: + + ```python + >>> from transformers import AutoTokenizer, AutoModelForCausalLM, StaticCache + + >>> model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf") + >>> tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf") + + >>> inputs = tokenizer(text="My name is Llama", return_tensors="pt") + + >>> # Prepare a cache class and pass it to model's forward + >>> # Leave empty space for 10 new tokens, which can be used when calling forward iteratively 10 times to generate + >>> max_generated_length = inputs.input_ids.shape[1] + 10 + >>> past_key_values = StaticCache(config=model.config, max_cache_len=max_generated_length) + >>> outputs = model(**inputs, past_key_values=past_key_values, use_cache=True) + >>> outputs.past_key_values # access cache filled with key/values from generation + StaticCache() + ``` + """ + + # Pass-in kwargs as well to avoid crashing for BC (it used more arguments before) + def __init__( + self, + config: PreTrainedConfig, + max_cache_len: int, + offloading: bool = False, + offload_only_non_sliding: bool = True, + **kwargs, + ): + config = config.get_text_config(decoder=True) + layer_types = getattr(config, "layer_types", None) + # If `layer_types` is not explicitly provided, infer if the model is fully sliding + if layer_types is None: + if getattr(config, "sliding_window", None) is not None: + layer_types = ["sliding_attention" for _ in range(config.num_hidden_layers)] + elif getattr(config, "attention_chunk_size", None) is not None: + layer_types = ["chunked_attention" for _ in range(config.num_hidden_layers)] + else: + layer_types = ["full_attention" for _ in range(config.num_hidden_layers)] + # Some models have shared layers thus no cache is needed for them (e.g. Gemma3n) + if hasattr(config, "num_kv_shared_layers"): + layer_types = layer_types[: -config.num_kv_shared_layers] + + layers = [] + for layer_type in layer_types: + if layer_type == "sliding_attention": + layer = StaticSlidingWindowLayer(max_cache_len=max_cache_len, sliding_window=config.sliding_window) + elif layer_type == "chunked_attention": + # From a cache point of view, both sliding and chunked are the same in how they should behave and how many + # states they should return - only the mask changes to make them different at the end! + layer = StaticSlidingWindowLayer( + max_cache_len=max_cache_len, sliding_window=config.attention_chunk_size + ) + else: + layer = StaticLayer(max_cache_len=max_cache_len) + layers.append(layer) + + super().__init__(layers=layers, offloading=offloading, offload_only_non_sliding=offload_only_non_sliding) + + +class QuantizedCache(Cache): + """ + A quantizer cache similar to what is described in the + [KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache paper](https://huggingface.co/papers/2402.02750). + It allows the model to generate longer sequence length without allocating too much memory for keys and values + by applying quantization. + The cache has two types of storage, one for original precision and one for the + quantized cache. A `residual length` is set as a maximum capacity for the original precision cache. When the + length goes beyond maximum capacity, the original precision cache is discarded and moved into the quantized cache. + The quantization is done per-channel with a set `q_group_size` for both keys and values, in contrast to what was + described in the paper. + + See `Cache` for details on common methods that are implemented by all cache classes. + + Args: + backend (`str`): + The quantization backend to use. One of `("quanto", "hqq"). + config (`PreTrainedConfig`): + The config of the model for which this Cache will be used. + nbits (`int`, *optional*, defaults to 4): + The number of bits for quantization. + axis_key (`int`, *optional*, defaults to 0): + The axis on which to quantize the keys. + axis_value (`int`, *optional*, defaults to 0): + The axis on which to quantize the values. + q_group_size (`int`, *optional*, defaults to 64): + Quantization is done per-channel according to a set `q_group_size` for both keys and values. + residual_length (`int`, *optional*, defaults to 128): + Maximum capacity for the original precision cache + """ + + def __init__( + self, + backend: str, + config: PreTrainedConfig, + nbits: int = 4, + axis_key: int = 0, + axis_value: int = 0, + q_group_size: int = 64, + residual_length: int = 128, + ): + if backend == "quanto": + layer_class = QuantoQuantizedLayer + elif backend == "hqq": + layer_class = HQQQuantizedLayer + else: + raise ValueError(f"Unknown quantization backend `{backend}`") + + config = config.get_text_config(decoder=True) + layers = [ + layer_class(nbits, axis_key, axis_value, q_group_size, residual_length) + for _ in range(config.num_hidden_layers) + ] + super().__init__(layers=layers) + + +class EncoderDecoderCache(Cache): + """ + Base, abstract class for all encoder-decoder caches. Can be used to hold combinations of self-attention and + cross-attention caches. + + See `Cache` for details on common methods that are implemented by all cache classes. + + Args: + caches (`Iterable`): + Usually an iterable of length 2, containing 2 `Cache` objects, the first one for self-attention, the + second one for cross-attention. Can optionally also be an iterable of length 1, containing a + `tuple[tuple[torch.Tensor]]` (usually used for compatibility with torch dp and ddp). + + Example: + + ```python + >>> from transformers import AutoProcessor, AutoModelForCausalLM, DynamicCache, EncoderDecoderCache + + >>> model = AutoModelForCausalLM.from_pretrained("openai/whisper-small") + >>> processor = AutoProcessor.from_pretrained("openai/whisper-small") + + >>> inputs = processor(audio=YOUR-AUDIO, return_tensors="pt") + + >>> # Prepare cache classes for encoder and decoder and pass it to model's forward + >>> self_attention_cache = DynamicCache(config=self.config) + >>> cross_attention_cache = DynamicCache(config=self.config) + >>> past_key_values = EncoderDecoderCache(self_attention_cache, cross_attention_cache) + >>> outputs = model(**inputs, past_key_values=past_key_values, use_cache=True) + >>> outputs.past_key_values # access cache filled with key/values from generation + EncoderDecoderCache() + ``` + """ + + def __init__(self, *caches) -> None: + # For dp and ddp support, if only one argument is passed, it should be an iterable of DynamicCache ddp data + if len(caches) == 1: + self_attention_cache_data, cross_attention_cache_data = [], [] + for combined_cache_data in caches[0]: + if len(combined_cache_data) == 6: # two tuple of style (self_attn_k, self_attn_v, self_attn_sliding) + self_attention_cache_data.append(combined_cache_data[:3]) + cross_attention_cache_data.append(combined_cache_data[3:]) + # To support old DDP-style init, we handle the case where the tuple has no sliding window tensor + elif len(combined_cache_data) == 4: # two tuple of style (self_attn_k, self_attn_v) + self_attention_cache_data.append(combined_cache_data[:2]) + cross_attention_cache_data.append(combined_cache_data[2:]) + else: + raise ValueError(f"Expected {len(combined_cache_data) = } to be 4 or 6.\n{combined_cache_data = }") + self.self_attention_cache = DynamicCache(self_attention_cache_data) + self.cross_attention_cache = DynamicCache(cross_attention_cache_data) + # Otherwise, we should get two arguments, a self-attention cache and a cross-attention cache + elif len(caches) == 2: + if not isinstance(caches[0], Cache) or not isinstance(caches[1], Cache): + raise TypeError(f"One of the two arguments is not a Cache: {type(caches[0]) = }, {type(caches[1]) = }") + self.self_attention_cache = caches[0] + self.cross_attention_cache = caches[1] + # Error case + else: + raise ValueError(f"Expected 1 or 2 arguments, got {len(caches)}") + + self.is_updated = {} + for layer_idx in range(len(self.cross_attention_cache)): + self.is_updated[layer_idx] = bool(self.cross_attention_cache.get_seq_length(layer_idx) > 0) + + def __iter__(self): + """Returns tuples of style (self_attn_k, self_attn_v, self_attn_sliding, cross_attn_k, cross_attn_v, cross_attn_sliding)""" + for self_attention_layer, cross_attention_layer in zip(self.self_attention_cache, self.cross_attention_cache): + yield self_attention_layer + cross_attention_layer + + def __repr__(self) -> str: + return ( + f"{self.__class__.__name__}(self_attention_cache={self.self_attention_cache}, cross_attention_cache=" + f"{self.cross_attention_cache})" + ) + + def __len__(self): + """ + Support for backwards-compatible `past_key_values` length, e.g. `len(past_key_values)`. This value corresponds + to the number of layers in the model. + """ + return len(self.self_attention_cache) + + def get_seq_length(self, layer_idx: int = 0) -> int: + """Returns the sequence length of the cached states. A layer index can be optionally passed.""" + return self.self_attention_cache.get_seq_length(layer_idx) + + def reset(self): + self.self_attention_cache.reset() + self.cross_attention_cache.reset() + for layer_idx in self.is_updated: + self.is_updated[layer_idx] = False + + def reorder_cache(self, beam_idx: torch.LongTensor): + """Reorders the cache for beam search, given the selected beam indices.""" + self.self_attention_cache.reorder_cache(beam_idx) + self.cross_attention_cache.reorder_cache(beam_idx) + + def check_dynamic_cache(self, method: str): + if not ( + isinstance(self.self_attention_cache, DynamicCache) + and isinstance(self.cross_attention_cache, DynamicCache) + ): + raise TypeError( + f"`{method}` is only defined for dynamic cache, got {self.self_attention_cache.__str__()} for the self " + f"attention cache and {self.cross_attention_cache.__str__()} for the cross attention cache." + ) + + # TODO(gante, sanchit-gandhi): move following functionality into `.generate` + def crop(self, maximum_length: int): + """ + Crop the past key values up to a new `maximum_length` in terms of tokens. `maximum_length` can also be + negative to remove `maximum_length` tokens. This is used in assisted decoding and contrastive search (on the Hub). + """ + self.check_dynamic_cache(self.crop.__name__) + self.self_attention_cache.crop(maximum_length) + + def batch_repeat_interleave(self, repeats: int): + """Repeat the cache `repeats` times in the batch dimension. Used in contrastive search (on the Hub).""" + self.check_dynamic_cache(self.batch_repeat_interleave.__name__) + self.self_attention_cache.batch_repeat_interleave(repeats) + self.cross_attention_cache.batch_repeat_interleave(repeats) + + def batch_select_indices(self, indices: torch.Tensor): + """Only keep the `indices` in the batch dimension of the cache. Used in contrastive search (on the Hub).""" + self.check_dynamic_cache(self.batch_select_indices.__name__) + self.self_attention_cache.batch_select_indices(indices) + self.cross_attention_cache.batch_select_indices(indices) + + def get_max_cache_shape(self) -> int: + """Returns the maximum sequence length (i.e. max capacity) of the cache object""" + return self.self_attention_cache.get_max_cache_shape() + + def get_mask_sizes(self, cache_position: torch.Tensor, layer_idx: int) -> tuple[int, int]: + return self.self_attention_cache.get_mask_sizes(cache_position, layer_idx) + + @property + def is_sliding(self): + return self.self_attention_cache.is_sliding + + @property + def is_compileable(self) -> bool: + return self.self_attention_cache.is_compileable diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/configuration_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/configuration_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..ad599a1378c0569eb857269c45c1f112e88ae280 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/configuration_utils.py @@ -0,0 +1,1251 @@ +# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. +# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Configuration base class and utilities.""" + +import copy +import json +import math +import os +from typing import TYPE_CHECKING, Any, TypeVar, Union + +from huggingface_hub import create_repo +from packaging import version + +from . import __version__ +from .dynamic_module_utils import custom_object_save +from .generation.configuration_utils import GenerationConfig +from .modeling_gguf_pytorch_utils import load_gguf_checkpoint +from .modeling_rope_utils import RotaryEmbeddingConfigMixin +from .utils import ( + CONFIG_NAME, + PushToHubMixin, + cached_file, + copy_func, + extract_commit_hash, + is_torch_available, + logging, +) +from .utils.generic import is_timm_config_dict + + +if TYPE_CHECKING: + import torch + + +logger = logging.get_logger(__name__) + + +# type hinting: specifying the type of config class that inherits from PreTrainedConfig +SpecificPreTrainedConfigType = TypeVar("SpecificPreTrainedConfigType", bound="PreTrainedConfig") + +_FLOAT_TAG_KEY = "__float__" +_FLOAT_TAG_VALUES = {"Infinity": float("inf"), "-Infinity": float("-inf"), "NaN": float("nan")} + + +class PreTrainedConfig(PushToHubMixin, RotaryEmbeddingConfigMixin): + # no-format + r""" + Base class for all configuration classes. Handles a few parameters common to all models' configurations as well as + methods for loading/downloading/saving configurations. + + + + A configuration file can be loaded and saved to disk. Loading the configuration file and using this file to + initialize a model does **not** load the model weights. It only affects the model's configuration. + + + + Class attributes (overridden by derived classes): + + - **model_type** (`str`) -- An identifier for the model type, serialized into the JSON file, and used to recreate + the correct object in [`~transformers.AutoConfig`]. + - **has_no_defaults_at_init** (`bool`) -- Whether the config class can be initialized without providing input arguments. + Some configurations requires inputs to be defined at init and have no default values, usually these are composite configs, + (but not necessarily) such as [`~transformers.EncoderDecoderConfig`] or [`~RagConfig`]. They have to be initialized from + two or more configs of type [`~transformers.PreTrainedConfig`]. + - **keys_to_ignore_at_inference** (`list[str]`) -- A list of keys to ignore by default when looking at dictionary + outputs of the model during inference. + - **attribute_map** (`dict[str, str]`) -- A dict that maps model specific attribute names to the standardized + naming of attributes. + - **base_model_tp_plan** (`dict[str, Any]`) -- A dict that maps sub-modules FQNs of a base model to a tensor + parallel plan applied to the sub-module when `model.tensor_parallel` is called. + - **base_model_pp_plan** (`dict[str, tuple[list[str]]]`) -- A dict that maps child-modules of a base model to a + pipeline parallel plan that enables users to place the child-module on the appropriate device. + + Common attributes (present in all subclasses): + + - **vocab_size** (`int`) -- The number of tokens in the vocabulary, which is also the first dimension of the + embeddings matrix (this attribute may be missing for models that don't have a text modality like ViT). + - **hidden_size** (`int`) -- The hidden size of the model. + - **num_attention_heads** (`int`) -- The number of attention heads used in the multi-head attention layers of the + model. + - **num_hidden_layers** (`int`) -- The number of blocks in the model. + + + + Setting parameters for sequence generation in the model config is deprecated. For backward compatibility, loading + some of them will still be possible, but attempting to overwrite them will throw an exception -- you should set + them in a [~transformers.GenerationConfig]. Check the documentation of [~transformers.GenerationConfig] for more + information about the individual parameters. + + + + Arg: + name_or_path (`str`, *optional*, defaults to `""`): + Store the string that was passed to [`PreTrainedModel.from_pretrained`] as `pretrained_model_name_or_path` + if the configuration was created with such a method. + output_hidden_states (`bool`, *optional*, defaults to `False`): + Whether or not the model should return all hidden-states. + output_attentions (`bool`, *optional*, defaults to `False`): + Whether or not the model should returns all attentions. + return_dict (`bool`, *optional*, defaults to `True`): + Whether or not the model should return a [`~transformers.utils.ModelOutput`] instead of a plain tuple. + is_encoder_decoder (`bool`, *optional*, defaults to `False`): + Whether the model is used as an encoder/decoder or not. + chunk_size_feed_forward (`int`, *optional*, defaults to `0`): + The chunk size of all feed forward layers in the residual attention blocks. A chunk size of `0` means that + the feed forward layer is not chunked. A chunk size of n means that the feed forward layer processes `n` < + sequence_length embeddings at a time. For more information on feed forward chunking, see [How does Feed + Forward Chunking work?](../glossary.html#feed-forward-chunking). + + > Parameters for fine-tuning tasks + + architectures (`list[str]`, *optional*): + Model architectures that can be used with the model pretrained weights. + id2label (`dict[int, str]`, *optional*): + A map from index (for instance prediction index, or target index) to label. + label2id (`dict[str, int]`, *optional*): + A map from label to index for the model. + num_labels (`int`, *optional*): + Number of labels to use in the last layer added to the model, typically for a classification task. + problem_type (`str`, *optional*): + Problem type for `XxxForSequenceClassification` models. Can be one of `"regression"`, + `"single_label_classification"` or `"multi_label_classification"`. + + > PyTorch specific parameters + + dtype (`str`, *optional*): + The `dtype` of the weights. This attribute can be used to initialize the model to a non-default `dtype` + (which is normally `float32`) and thus allow for optimal storage allocation. For example, if the saved + model is `float16`, ideally we want to load it back using the minimal amount of memory needed to load + `float16` weights. + """ + + model_type: str = "" + base_config_key: str = "" + sub_configs: dict[str, type["PreTrainedConfig"]] = {} + has_no_defaults_at_init: bool = False + attribute_map: dict[str, str] = {} + base_model_tp_plan: dict[str, Any] | None = None + base_model_pp_plan: dict[str, tuple[list[str]]] | None = None + base_model_ep_plan: dict[str, tuple[list[str]]] | None = None + _auto_class: str | None = None + + def __setattr__(self, key, value): + if key in super().__getattribute__("attribute_map"): + key = super().__getattribute__("attribute_map")[key] + super().__setattr__(key, value) + + def __getattribute__(self, key): + if key != "attribute_map" and key in super().__getattribute__("attribute_map"): + key = super().__getattribute__("attribute_map")[key] + return super().__getattribute__(key) + + def __init__( + self, + *, + # All models common arguments + output_hidden_states: bool = False, + output_attentions: bool = False, + return_dict: bool = True, + dtype: Union[str, "torch.dtype"] | None = None, + # Common arguments + chunk_size_feed_forward: int = 0, + is_encoder_decoder: bool = False, + # Fine-tuning task arguments + architectures: list[str] | None = None, + id2label: dict[int, str] | None = None, + label2id: dict[str, int] | None = None, + num_labels: int | None = None, + problem_type: str | None = None, + **kwargs, + ): + # Validation for some arguments + if label2id is not None and not isinstance(label2id, dict): + raise ValueError("Argument label2id should be a dictionary.") + if id2label is not None and not isinstance(id2label, dict): + raise ValueError("Argument id2label should be a dictionary.") + if num_labels is not None and id2label is not None and len(id2label) != num_labels: + logger.warning( + f"You passed `num_labels={num_labels}` which is incompatible to " + f"the `id2label` map of length `{len(id2label)}`." + ) + if problem_type is not None and problem_type not in ( + "regression", + "single_label_classification", + "multi_label_classification", + ): + raise ValueError( + f"The config parameter `problem_type` was not understood: received {problem_type} " + "but only 'regression', 'single_label_classification' and 'multi_label_classification' are valid." + ) + # BC for the `torch_dtype` argument instead of the simpler `dtype` + # Do not warn, as it would otherwise always be triggered since most configs on the hub have `torch_dtype` + if (torch_dtype := kwargs.pop("torch_dtype", None)) is not None: + # If both are provided, keep `dtype` + dtype = dtype if dtype is not None else torch_dtype + if dtype is not None and isinstance(dtype, str) and is_torch_available(): + # we will start using self.dtype in v5, but to be consistent with + # from_pretrained's dtype arg convert it to an actual torch.dtype object + import torch + + dtype = getattr(torch, dtype) + + # BC for rotary embeddings. We will pop out legacy keys from kwargs and rename to new format + if hasattr(self, "rope_parameters"): + ignore_keys_at_rope_validation = kwargs.pop("ignore_keys_at_rope_validation", None) + kwargs = self.convert_rope_params_to_dict( + ignore_keys_at_rope_validation=ignore_keys_at_rope_validation, **kwargs + ) + + # Attributes common for all models + self.return_dict = return_dict + self.output_hidden_states = output_hidden_states + self.dtype = dtype + self._output_attentions = output_attentions # has public property + + # Less common kwargs, only used by some models + self.chunk_size_feed_forward = chunk_size_feed_forward + + # Encoder-decoder models attributes + self.is_encoder_decoder = is_encoder_decoder + + # Fine-tuning task attributes + self.architectures = architectures + self.id2label = id2label + self.label2id = label2id + self.problem_type = problem_type + + if self.id2label is None: + self._create_id_label_maps(num_labels if num_labels is not None else 2) + else: + # Keys are always strings in JSON so convert ids to int here. + self.id2label = {int(key): value for key, value in self.id2label.items()} + + # Parameters for sequence generation saved in the config are popped instead of loading them. + for parameter_name in GenerationConfig._get_default_generation_params().keys(): + kwargs.pop(parameter_name, None) + + # Name or path to the pretrained checkpoint + self._name_or_path = str(kwargs.pop("name_or_path", "")) + self._commit_hash = kwargs.pop("_commit_hash", None) + + # Attention implementation to use, if relevant (it sets it recursively on sub-configs) + self._attn_implementation: str | None = kwargs.pop("attn_implementation", None) + + # Experts implementation to use, if relevant (it sets it recursively on sub-configs) + self._experts_implementation = kwargs.pop("experts_implementation", None) + + # Drop the transformers version info + self.transformers_version = kwargs.pop("transformers_version", None) + + # Additional attributes without default values + for key, value in kwargs.items(): + try: + setattr(self, key, value) + except AttributeError as err: + logger.error(f"Can't set {key} with value {value} for {self}") + raise err + + def _create_id_label_maps(self, num_labels: int): + self.id2label = {i: f"LABEL_{i}" for i in range(num_labels)} + self.label2id = dict(zip(self.id2label.values(), self.id2label.keys())) + + @property + def name_or_path(self) -> str | None: + return getattr(self, "_name_or_path", None) + + @name_or_path.setter + def name_or_path(self, value): + self._name_or_path = str(value) # Make sure that name_or_path is a string (for JSON encoding) + + @property + def output_attentions(self): + """ + `bool`: Whether or not the model should returns all attentions. + """ + return self._output_attentions + + @output_attentions.setter + def output_attentions(self, value: bool): + # If we set `output_attentions` explicitly before the attn implementation, dispatch eager + if value and self._attn_implementation is None: + self._attn_implementation = "eager" + if value and self._attn_implementation != "eager": + raise ValueError( + "The `output_attentions` attribute is not supported when using the `attn_implementation` set to " + f"{self._attn_implementation}. Please set it to 'eager' instead." + ) + self._output_attentions = value + + @property + def use_return_dict(self) -> bool: + """ + `bool`: Whether or not return [`~utils.ModelOutput`] instead of tuples. + """ + return self.return_dict + + @property + def num_labels(self) -> int: + """ + `int`: The number of labels for classification models. + """ + return len(self.id2label) + + @num_labels.setter + def num_labels(self, num_labels: int): + # we do not store `num_labels` attribute in config, but instead + # compute it based on the length of the `id2label` map + if self.id2label is None or self.num_labels != num_labels: + self._create_id_label_maps(num_labels) + + @property + def _attn_implementation(self): + return self._attn_implementation_internal + + @_attn_implementation.setter + def _attn_implementation(self, value: str | dict | None): + """We set it recursively on the sub-configs as well""" + # Set if for current config + current_attn = getattr(self, "_attn_implementation", None) + attn_implementation = value if not isinstance(value, dict) else value.get("", current_attn) + self._attn_implementation_internal = attn_implementation + + # Set it recursively on the subconfigs + for subconfig_key in self.sub_configs: + subconfig = getattr(self, subconfig_key, None) + if subconfig is not None: + current_subconfig_attn = getattr(subconfig, "_attn_implementation", None) + sub_implementation = ( + value if not isinstance(value, dict) else value.get(subconfig_key, current_subconfig_attn) + ) + subconfig._attn_implementation = sub_implementation + + @property + def _experts_implementation(self): + return self._experts_implementation_internal + + @_experts_implementation.setter + def _experts_implementation(self, value: str | dict | None): + """We set it recursively on the sub-configs as well""" + # Set if for current config + current_moe = getattr(self, "_experts_implementation", None) + experts_implementation = value if not isinstance(value, dict) else value.get("", current_moe) + self._experts_implementation_internal = experts_implementation + + # Set it recursively on the subconfigs + for subconfig_key in self.sub_configs: + subconfig = getattr(self, subconfig_key, None) + if subconfig is not None: + current_subconfig_moe = getattr(subconfig, "_experts_implementation", None) + sub_implementation = ( + value if not isinstance(value, dict) else value.get(subconfig_key, current_subconfig_moe) + ) + subconfig._experts_implementation = sub_implementation + + @property + def torch_dtype(self): + logger.warning_once("`torch_dtype` is deprecated! Use `dtype` instead!") + return self.dtype + + @torch_dtype.setter + def torch_dtype(self, value): + logger.warning_once("`torch_dtype` is deprecated! Use `dtype` instead!") + self.dtype = value + + @property + def rope_scaling(self): + return self.rope_parameters + + @rope_scaling.setter + def rope_scaling(self, value): + self.rope_parameters = value + + def save_pretrained(self, save_directory: str | os.PathLike, push_to_hub: bool = False, **kwargs): + """ + Save a configuration object to the directory `save_directory`, so that it can be re-loaded using the + [`~PreTrainedConfig.from_pretrained`] class method. + + Args: + save_directory (`str` or `os.PathLike`): + Directory where the configuration JSON file will be saved (will be created if it does not exist). + push_to_hub (`bool`, *optional*, defaults to `False`): + Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the + repository you want to push to with `repo_id` (will default to the name of `save_directory` in your + namespace). + kwargs (`dict[str, Any]`, *optional*): + Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method. + """ + if os.path.isfile(save_directory): + raise AssertionError(f"Provided path ({save_directory}) should be a directory, not a file") + + generation_parameters = self._get_generation_parameters() + if len(generation_parameters) > 0: + raise ValueError( + "Some generation parameters are set in the model config. These should go into `model.generation_config`" + f"as opposed to `model.config`. \nGeneration parameters found: {str(generation_parameters)}", + ) + + os.makedirs(save_directory, exist_ok=True) + + if push_to_hub: + commit_message = kwargs.pop("commit_message", None) + repo_id = kwargs.pop("repo_id", save_directory.split(os.path.sep)[-1]) + repo_id = create_repo(repo_id, exist_ok=True, **kwargs).repo_id + files_timestamps = self._get_files_timestamps(save_directory) + + # This attribute is important to know on load, but should not be serialized on save. + if "transformers_weights" in self: + delattr(self, "transformers_weights") + + # If we have a custom config, we copy the file defining it in the folder and set the attributes so it can be + # loaded from the Hub. + if self._auto_class is not None: + custom_object_save(self, save_directory, config=self) + + # If we save using the predefined names, we can load using `from_pretrained` + output_config_file = os.path.join(save_directory, CONFIG_NAME) + + self.to_json_file(output_config_file, use_diff=True) + logger.info(f"Configuration saved in {output_config_file}") + + if push_to_hub: + self._upload_modified_files( + save_directory, + repo_id, + files_timestamps, + commit_message=commit_message, + token=kwargs.get("token"), + ) + + @classmethod + def from_pretrained( + cls: type[SpecificPreTrainedConfigType], + pretrained_model_name_or_path: str | os.PathLike, + cache_dir: str | os.PathLike | None = None, + force_download: bool = False, + local_files_only: bool = False, + token: str | bool | None = None, + revision: str = "main", + **kwargs, + ) -> SpecificPreTrainedConfigType: + r""" + Instantiate a [`PreTrainedConfig`] (or a derived class) from a pretrained model configuration. + + Args: + pretrained_model_name_or_path (`str` or `os.PathLike`): + This can be either: + + - a string, the *model id* of a pretrained model configuration hosted inside a model repo on + huggingface.co. + - a path to a *directory* containing a configuration file saved using the + [`~PreTrainedConfig.save_pretrained`] method, e.g., `./my_model_directory/`. + - a path or url to a saved configuration JSON *file*, e.g., `./my_model_directory/configuration.json`. + cache_dir (`str` or `os.PathLike`, *optional*): + Path to a directory in which a downloaded pretrained model configuration should be cached if the + standard cache should not be used. + force_download (`bool`, *optional*, defaults to `False`): + Whether or not to force to (re-)download the configuration files and override the cached versions if + they exist. + proxies (`dict[str, str]`, *optional*): + A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128', + 'http://hostname': 'foo.bar:4012'}.` The proxies are used on each request. + token (`str` or `bool`, *optional*): + The token to use as HTTP bearer authorization for remote files. If `True`, or not specified, will use + the token generated when running `hf auth login` (stored in `~/.huggingface`). + revision (`str`, *optional*, defaults to `"main"`): + The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a + git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + identifier allowed by git. + + + + To test a pull request you made on the Hub, you can pass `revision="refs/pr/"`. + + + + return_unused_kwargs (`bool`, *optional*, defaults to `False`): + If `False`, then this function returns just the final configuration object. + + If `True`, then this functions returns a `Tuple(config, unused_kwargs)` where *unused_kwargs* is a + dictionary consisting of the key/value pairs whose keys are not configuration attributes: i.e., the + part of `kwargs` which has not been used to update `config` and is otherwise ignored. + subfolder (`str`, *optional*, defaults to `""`): + In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + specify the folder name here. + kwargs (`dict[str, Any]`, *optional*): + The values in kwargs of any keys which are configuration attributes will be used to override the loaded + values. Behavior concerning key/value pairs whose keys are *not* configuration attributes is controlled + by the `return_unused_kwargs` keyword parameter. + + Returns: + [`PreTrainedConfig`]: The configuration object instantiated from this pretrained model. + + Examples: + + ```python + # We can't instantiate directly the base class *PreTrainedConfig* so let's show the examples on a + # derived class: BertConfig + config = BertConfig.from_pretrained( + "google-bert/bert-base-uncased" + ) # Download configuration from huggingface.co and cache. + config = BertConfig.from_pretrained( + "./test/saved_model/" + ) # E.g. config (or model) was saved using *save_pretrained('./test/saved_model/')* + config = BertConfig.from_pretrained("./test/saved_model/my_configuration.json") + config = BertConfig.from_pretrained("google-bert/bert-base-uncased", output_attentions=True, foo=False) + assert config.output_attentions == True + config, unused_kwargs = BertConfig.from_pretrained( + "google-bert/bert-base-uncased", output_attentions=True, foo=False, return_unused_kwargs=True + ) + assert config.output_attentions == True + assert unused_kwargs == {"foo": False} + ```""" + kwargs["cache_dir"] = cache_dir + kwargs["force_download"] = force_download + kwargs["local_files_only"] = local_files_only + kwargs["revision"] = revision + + config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs) + if cls.base_config_key and cls.base_config_key in config_dict: + config_dict = config_dict[cls.base_config_key] + + if "model_type" in config_dict and hasattr(cls, "model_type") and config_dict["model_type"] != cls.model_type: + # sometimes the config has no `base_config_key` if the config is used in several composite models + # e.g. LlamaConfig. In that case we try to see if there is match in `model_type` before raising a warning + for v in config_dict.values(): + if isinstance(v, dict) and v.get("model_type") == cls.model_type: + config_dict = v + + # raise warning only if we still can't see a match in `model_type` + if config_dict["model_type"] != cls.model_type: + logger.warning( + f"You are using a model of type `{config_dict['model_type']}` to instantiate a model of type " + f"`{cls.model_type}`. This may be expected if you are loading a checkpoint that shares a subset " + f"of the architecture (e.g., loading a `sam2_video` checkpoint into `Sam2Model`), but is otherwise " + f"not supported and can yield errors. Please verify that the checkpoint is compatible with the " + f"model you are instantiating." + ) + + return cls.from_dict(config_dict, **kwargs) + + @classmethod + def get_config_dict( + cls, pretrained_model_name_or_path: str | os.PathLike, **kwargs + ) -> tuple[dict[str, Any], dict[str, Any]]: + """ + From a `pretrained_model_name_or_path`, resolve to a dictionary of parameters, to be used for instantiating a + [`PreTrainedConfig`] using `from_dict`. + + Parameters: + pretrained_model_name_or_path (`str` or `os.PathLike`): + The identifier of the pre-trained checkpoint from which we want the dictionary of parameters. + + Returns: + `tuple[Dict, Dict]`: The dictionary(ies) that will be used to instantiate the configuration object. + + """ + original_kwargs = copy.deepcopy(kwargs) + # Get config dict associated with the base config file + config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs) + if config_dict is None: + return {}, kwargs + if "_commit_hash" in config_dict: + original_kwargs["_commit_hash"] = config_dict["_commit_hash"] + + # That config file may point us toward another config file to use. + if "configuration_files" in config_dict: + configuration_file = get_configuration_file(config_dict["configuration_files"]) + config_dict, kwargs = cls._get_config_dict( + pretrained_model_name_or_path, _configuration_file=configuration_file, **original_kwargs + ) + + return config_dict, kwargs + + @classmethod + def _get_config_dict( + cls, pretrained_model_name_or_path: str | os.PathLike, **kwargs + ) -> tuple[dict[str, Any], dict[str, Any]]: + cache_dir = kwargs.pop("cache_dir", None) + force_download = kwargs.pop("force_download", False) + proxies = kwargs.pop("proxies", None) + token = kwargs.pop("token", None) + local_files_only = kwargs.pop("local_files_only", False) + revision = kwargs.pop("revision", None) + trust_remote_code = kwargs.pop("trust_remote_code", None) + subfolder = kwargs.pop("subfolder", "") + from_pipeline = kwargs.pop("_from_pipeline", None) + from_auto_class = kwargs.pop("_from_auto", False) + commit_hash = kwargs.pop("_commit_hash", None) + + gguf_file = kwargs.get("gguf_file") + + if trust_remote_code is True: + logger.warning( + "The argument `trust_remote_code` is to be used with Auto classes. It has no effect here and is" + " ignored." + ) + + user_agent = {"file_type": "config", "from_auto_class": from_auto_class} + if from_pipeline is not None: + user_agent["using_pipeline"] = from_pipeline + + pretrained_model_name_or_path = str(pretrained_model_name_or_path) + + is_local = os.path.isdir(pretrained_model_name_or_path) + if os.path.isfile(os.path.join(subfolder, pretrained_model_name_or_path)): + # Special case when pretrained_model_name_or_path is a local file + resolved_config_file = pretrained_model_name_or_path + is_local = True + else: + configuration_file = kwargs.pop("_configuration_file", CONFIG_NAME) if gguf_file is None else gguf_file + + try: + # Load from local folder or from cache or download from model Hub and cache + resolved_config_file = cached_file( + pretrained_model_name_or_path, + configuration_file, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _commit_hash=commit_hash, + ) + if resolved_config_file is None: + return None, kwargs + commit_hash = extract_commit_hash(resolved_config_file, commit_hash) + except OSError: + # Raise any environment error raise by `cached_file`. It will have a helpful error message adapted to + # the original exception. + raise + except Exception: + # For any other exception, we throw a generic error. + raise OSError( + f"Can't load the configuration of '{pretrained_model_name_or_path}'. If you were trying to load it" + " from 'https://huggingface.co/models', make sure you don't have a local directory with the same" + f" name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a directory" + f" containing a {configuration_file} file" + ) + + try: + if gguf_file: + config_dict = load_gguf_checkpoint(resolved_config_file, return_tensors=False)["config"] + else: + # Load config dict + config_dict = cls._dict_from_json_file(resolved_config_file) + + config_dict["_commit_hash"] = commit_hash + except (json.JSONDecodeError, UnicodeDecodeError): + raise OSError(f"It looks like the config file at '{resolved_config_file}' is not a valid JSON file.") + + if is_local: + logger.info(f"loading configuration file {resolved_config_file}") + else: + logger.info(f"loading configuration file {configuration_file} from cache at {resolved_config_file}") + + # timm models are not saved with the model_type in the config file + if "model_type" not in config_dict and is_timm_config_dict(config_dict): + config_dict["model_type"] = "timm_wrapper" + + return config_dict, kwargs + + @classmethod + def from_dict( + cls: type[SpecificPreTrainedConfigType], config_dict: dict[str, Any], **kwargs + ) -> SpecificPreTrainedConfigType: + """ + Instantiates a [`PreTrainedConfig`] from a Python dictionary of parameters. + + Args: + config_dict (`dict[str, Any]`): + Dictionary that will be used to instantiate the configuration object. Such a dictionary can be + retrieved from a pretrained checkpoint by leveraging the [`~PreTrainedConfig.get_config_dict`] method. + kwargs (`dict[str, Any]`): + Additional parameters from which to initialize the configuration object. + + Returns: + [`PreTrainedConfig`]: The configuration object instantiated from those parameters. + """ + return_unused_kwargs = kwargs.pop("return_unused_kwargs", False) + # Those arguments may be passed along for our internal telemetry. + # We remove them so they don't appear in `return_unused_kwargs`. + kwargs.pop("_from_auto", None) + kwargs.pop("_from_pipeline", None) + # The commit hash might have been updated in the `config_dict`, we don't want the kwargs to erase that update. + if "_commit_hash" in kwargs and "_commit_hash" in config_dict: + kwargs["_commit_hash"] = config_dict["_commit_hash"] + + # For BC on the old `torch_dtype` + if (torch_dtype := kwargs.pop("torch_dtype", None)) is not None: + logger.warning_once("`torch_dtype` is deprecated! Use `dtype` instead!") + # If both are present, use `dtype` + kwargs["dtype"] = kwargs.get("dtype", torch_dtype) + + # We remove them from kwargs so that they do not appear in `return_unused_kwargs`. + config_dict["attn_implementation"] = kwargs.pop("attn_implementation", None) + config_dict["experts_implementation"] = kwargs.pop("experts_implementation", None) + + config = cls(**config_dict) + + # Update config with kwargs if needed + if "num_labels" in kwargs and "id2label" in kwargs: + num_labels = kwargs["num_labels"] + id2label = kwargs["id2label"] if kwargs["id2label"] is not None else [] + if len(id2label) != num_labels: + raise ValueError( + f"You passed along `num_labels={num_labels}` with an incompatible id to label map: " + f"{kwargs['id2label']}. Since those arguments are inconsistent with each other, you should remove " + "one of them." + ) + to_remove = [] + for key, value in kwargs.items(): + if hasattr(config, key): + current_attr = getattr(config, key) + # To authorize passing a custom subconfig as kwarg in models that have nested configs. + # We need to update only custom kwarg values instead and keep other attributes in subconfig. + if isinstance(current_attr, PreTrainedConfig) and isinstance(value, dict): + current_attr_updated = current_attr.to_dict() + current_attr_updated.update(value) + value = current_attr.__class__(**current_attr_updated) + setattr(config, key, value) + if key != "dtype": + to_remove.append(key) + for key in to_remove: + kwargs.pop(key, None) + + logger.info(f"Model config {config}") + if return_unused_kwargs: + return config, kwargs + else: + return config + + @classmethod + def from_json_file( + cls: type[SpecificPreTrainedConfigType], json_file: str | os.PathLike + ) -> SpecificPreTrainedConfigType: + """ + Instantiates a [`PreTrainedConfig`] from the path to a JSON file of parameters. + + Args: + json_file (`str` or `os.PathLike`): + Path to the JSON file containing the parameters. + + Returns: + [`PreTrainedConfig`]: The configuration object instantiated from that JSON file. + + """ + config_dict = cls._dict_from_json_file(json_file) + return cls(**config_dict) + + @classmethod + def _dict_from_json_file(cls, json_file: str | os.PathLike): + with open(json_file, encoding="utf-8") as reader: + text = reader.read() + config_dict = json.loads(text) + + return cls._decode_special_floats(config_dict) + + @classmethod + def _encode_special_floats(cls, obj: Any) -> Any: + """ + Iterates over the passed object and encode specific floats that cannot be JSON-serialized. Python's JSON + engine saves floats like `Infinity` (+/-) or `NaN` which are not compatible with other JSON engines. + + It serializes floats like `Infinity` as an object: `{'__float__': Infinity}`. + """ + if isinstance(obj, float): + if math.isnan(obj): + return {_FLOAT_TAG_KEY: "NaN"} + if obj == float("inf"): + return {_FLOAT_TAG_KEY: "Infinity"} + if obj == float("-inf"): + return {_FLOAT_TAG_KEY: "-Infinity"} + return obj + + if isinstance(obj, dict): + return {k: cls._encode_special_floats(v) for k, v in obj.items()} + + if isinstance(obj, (list, tuple)): + return [cls._encode_special_floats(v) for v in obj] + + return obj + + @classmethod + def _decode_special_floats(cls, obj: Any) -> Any: + """ + Iterates over the passed object and decode specific floats that cannot be JSON-serialized. Python's JSON + engine saves floats like `Infinity` (+/-) or `NaN` which are not compatible with other JSON engines. + + This method deserializes objects like `{'__float__': Infinity}` to their float values like `Infinity`. + """ + if isinstance(obj, dict): + if set(obj.keys()) == {_FLOAT_TAG_KEY} and isinstance(obj[_FLOAT_TAG_KEY], str): + tag = obj[_FLOAT_TAG_KEY] + if tag in _FLOAT_TAG_VALUES: + return _FLOAT_TAG_VALUES[tag] + return obj + + return {k: cls._decode_special_floats(v) for k, v in obj.items()} + + if isinstance(obj, list): + return [cls._decode_special_floats(v) for v in obj] + + return obj + + def __eq__(self, other): + return isinstance(other, PreTrainedConfig) and (self.__dict__ == other.__dict__) + + def __repr__(self): + return f"{self.__class__.__name__} {self.to_json_string()}" + + def __iter__(self): + yield from self.__dict__ + + def to_diff_dict(self) -> dict[str, Any]: + """ + Removes all attributes from the configuration that correspond to the default config attributes for + better readability, while always retaining the `config` attribute from the class. Serializes to a + Python dictionary. + + Returns: + dict[str, Any]: Dictionary of all the attributes that make up this configuration instance. + """ + config_dict = self.to_dict() + + # Get the default config dict (from a fresh PreTrainedConfig instance) + default_config_dict = PreTrainedConfig().to_dict() + + # get class specific config dict + class_config_dict = self.__class__().to_dict() if not self.has_no_defaults_at_init else {} + + serializable_config_dict = {} + + # Only serialize values that differ from the default config, + # except always keep the 'config' attribute. + for key, value in config_dict.items(): + if ( + isinstance(getattr(self, key, None), PreTrainedConfig) + and key in class_config_dict + and isinstance(class_config_dict[key], dict) + ): + # For nested configs we need to clean the diff recursively + diff = recursive_diff_dict(value, default_config_dict, config_obj=getattr(self, key, None)) + if "model_type" in value: + # Needs to be set even if it's not in the diff + diff["model_type"] = value["model_type"] + + serializable_config_dict[key] = diff + elif ( + key not in default_config_dict + or key == "transformers_version" + or key == "vocab_file" + or value != default_config_dict[key] + or (key in default_config_dict and value != class_config_dict.get(key, value)) + ): + serializable_config_dict[key] = value + + self._remove_keys_not_serialized(serializable_config_dict) + + # Key removed only in diff dict + if "_name_or_path" in serializable_config_dict: + del serializable_config_dict["_name_or_path"] + + if hasattr(self, "quantization_config"): + serializable_config_dict["quantization_config"] = ( + self.quantization_config.to_dict() + if not isinstance(self.quantization_config, dict) and self.quantization_config is not None + else self.quantization_config + ) + self.dict_dtype_to_str(serializable_config_dict) + + return serializable_config_dict + + def to_dict(self) -> dict[str, Any]: + """ + Serializes this instance to a Python dictionary. + + Returns: + `dict[str, Any]`: Dictionary of all the attributes that make up this configuration instance. + """ + output = copy.deepcopy(self.__dict__) + if hasattr(self.__class__, "model_type"): + output["model_type"] = self.__class__.model_type + + # Transformers version when serializing the model + output["transformers_version"] = __version__ + + for key, value in output.items(): + # Deal with nested configs like CLIP + if isinstance(value, PreTrainedConfig): + value = value.to_dict() + del value["transformers_version"] + + output[key] = value + + self._remove_keys_not_serialized(output) + + if hasattr(self, "quantization_config"): + output["quantization_config"] = ( + self.quantization_config.to_dict() + if not isinstance(self.quantization_config, dict) and self.quantization_config is not None + else self.quantization_config + ) + self.dict_dtype_to_str(output) + + return output + + def to_json_string(self, use_diff: bool = True) -> str: + """ + Serializes this instance to a JSON string. + + Args: + use_diff (`bool`, *optional*, defaults to `True`): + If set to `True`, only the difference between the config instance and the default `PreTrainedConfig()` + is serialized to JSON string. + + Returns: + `str`: String containing all the attributes that make up this configuration instance in JSON format. + """ + if use_diff is True: + config_dict = self.to_diff_dict() + else: + config_dict = self.to_dict() + + # Handle +/-Infinity and NaNs + config_dict = self._encode_special_floats(config_dict) + + return json.dumps(config_dict, indent=2, sort_keys=True) + "\n" + + def to_json_file(self, json_file_path: str | os.PathLike, use_diff: bool = True): + """ + Save this instance to a JSON file. + + Args: + json_file_path (`str` or `os.PathLike`): + Path to the JSON file in which this configuration instance's parameters will be saved. + use_diff (`bool`, *optional*, defaults to `True`): + If set to `True`, only the difference between the config instance and the default `PreTrainedConfig()` + is serialized to JSON file. + """ + with open(json_file_path, "w", encoding="utf-8") as writer: + writer.write(self.to_json_string(use_diff=use_diff)) + + def update(self, config_dict: dict[str, Any]): + """ + Updates attributes of this class with attributes from `config_dict`. + + Args: + config_dict (`dict[str, Any]`): Dictionary of attributes that should be updated for this class. + """ + for key, value in config_dict.items(): + setattr(self, key, value) + + def update_from_string(self, update_str: str): + """ + Updates attributes of this class with attributes from `update_str`. + + The expected format is ints, floats and strings as is, and for booleans use `true` or `false`. For example: + "n_embd=10,resid_pdrop=0.2,scale_attn_weights=false,summary_type=cls_index" + + The keys to change have to already exist in the config object. + + Args: + update_str (`str`): String with attributes that should be updated for this class. + + """ + + d = dict(x.split("=") for x in update_str.split(",")) + for k, v in d.items(): + if not hasattr(self, k): + raise ValueError(f"key {k} isn't in the original config dict") + + old_v = getattr(self, k) + if isinstance(old_v, bool): + if v.lower() in ["true", "1", "y", "yes"]: + v = True + elif v.lower() in ["false", "0", "n", "no"]: + v = False + else: + raise ValueError(f"can't derive true or false from {v} (key {k})") + elif isinstance(old_v, int): + v = int(v) + elif isinstance(old_v, float): + v = float(v) + elif not isinstance(old_v, str): + raise TypeError( + f"You can only update int, float, bool or string values in the config, got {v} for key {k}" + ) + + setattr(self, k, v) + + def dict_dtype_to_str(self, d: dict[str, Any]) -> None: + """ + Checks whether the passed dictionary and its nested dicts have a *dtype* key and if it's not None, + converts torch.dtype to a string of just the type. For example, `torch.float32` get converted into *"float32"* + string, which can then be stored in the json format. + """ + if d.get("dtype") is not None: + if isinstance(d["dtype"], dict): + d["dtype"] = {k: str(v).split(".")[-1] for k, v in d["dtype"].items()} + # models like Emu3 can have "dtype" as token in config's vocabulary map, + # so we also exclude int type here to avoid error in this special case. + elif not isinstance(d["dtype"], (str, int)): + d["dtype"] = str(d["dtype"]).split(".")[1] + for value in d.values(): + if isinstance(value, dict): + self.dict_dtype_to_str(value) + + def _remove_keys_not_serialized(self, d: dict[str, Any]) -> None: + """ + Checks and removes if there are any keys in the dict that should not be serialized when saving the config. + Runs recursive check on the dict, to remove from all sub configs. + """ + + if "_is_quantized" in d: + del d["_is_quantized"] + if "_auto_class" in d: + del d["_auto_class"] + if "_output_attentions" in d: + d["output_attentions"] = d.pop("_output_attentions") + if "_commit_hash" in d: + del d["_commit_hash"] + if "_attn_implementation_internal" in d: + del d["_attn_implementation_internal"] + if "_experts_implementation_internal" in d: + del d["_experts_implementation_internal"] + # Do not serialize `base_model_tp_plan` for now + if "base_model_tp_plan" in d: + del d["base_model_tp_plan"] + # Do not serialize `base_model_pp_plan` for now + if "base_model_pp_plan" in d: + del d["base_model_pp_plan"] + for value in d.values(): + if isinstance(value, dict): + self._remove_keys_not_serialized(value) + + @classmethod + def register_for_auto_class(cls, auto_class="AutoConfig"): + """ + Register this class with a given auto class. This should only be used for custom configurations as the ones in + the library are already mapped with `AutoConfig`. + + + + Args: + auto_class (`str` or `type`, *optional*, defaults to `"AutoConfig"`): + The auto class to register this new configuration with. + """ + if not isinstance(auto_class, str): + auto_class = auto_class.__name__ + + import transformers.models.auto as auto_module + + if not hasattr(auto_module, auto_class): + raise ValueError(f"{auto_class} is not a valid auto class.") + + cls._auto_class = auto_class + + def _get_generation_parameters(self) -> dict[str, Any]: + """ + Checks if there are generation parameters in `PreTrainedConfig` instance. Note that + we should not save generation params in PreTrainedConfig, and we will raise error + if there are any. + """ + generation_params = {} + default_config = self.__class__().to_dict() if not self.has_no_defaults_at_init else {} + for key in GenerationConfig._get_default_generation_params().keys(): + if key == "use_cache": + continue # common key for most models + if hasattr(self, key) and getattr(self, key) is not None and key not in default_config: + generation_params[key] = getattr(self, key) + + return generation_params + + def get_text_config(self, decoder=None, encoder=None) -> "PreTrainedConfig": + """ + Returns the text config related to the text input (encoder) or text output (decoder) of the model. The + `decoder` and `encoder` input arguments can be used to specify which end of the model we are interested in, + which is useful on models that have both text input and output modalities. + + There are three possible outcomes of using this method: + 1. On most models, it returns the original config instance itself. + 2. On newer (2024+) composite models, it returns the text section of the config, which is nested under a set + of valid names. + 3. On older (2023-) composite models, it discards decoder-only parameters when `encoder=True` and vice-versa. + + Args: + decoder (`Optional[bool]`, *optional*): + If set to `True`, then only search for decoder config names. + encoder (`Optional[bool]`, *optional*): + If set to `True`, then only search for encoder config names. + """ + return_both = decoder == encoder # both unset or both set -> search all possible names + + decoder_possible_text_config_names = ("decoder", "generator", "text_config") + encoder_possible_text_config_names = ("text_encoder",) + if return_both: + possible_text_config_names = encoder_possible_text_config_names + decoder_possible_text_config_names + elif decoder: + possible_text_config_names = decoder_possible_text_config_names + else: + possible_text_config_names = encoder_possible_text_config_names + + valid_text_config_names = [] + for text_config_name in possible_text_config_names: + if hasattr(self, text_config_name): + text_config = getattr(self, text_config_name, None) + if text_config is not None: + valid_text_config_names += [text_config_name] + + if len(valid_text_config_names) > 1: + raise ValueError( + f"Multiple valid text configs were found in the model config: {valid_text_config_names}. In this " + "case, using `get_text_config()` would be ambiguous. Please specify the desired text config directly, " + "e.g. `text_config = config.sub_config_name`" + ) + elif len(valid_text_config_names) == 1: + config_to_return = getattr(self, valid_text_config_names[0]) + else: + config_to_return = self + + # handle legacy models with flat config structure, when we only want one of the configs + if not return_both and len(valid_text_config_names) == 0 and config_to_return.is_encoder_decoder: + config_to_return = copy.deepcopy(config_to_return) + prefix_to_discard = "encoder" if decoder else "decoder" + prefix_to_keep = "decoder" if decoder else "encoder" + for key in config_to_return.to_dict(): + # NOTE: We don't want to discard the key if it is mapped from a different attribute name at read time + if key.startswith(prefix_to_discard) and key not in config_to_return.attribute_map.values(): + delattr(config_to_return, key) + if key.startswith(prefix_to_keep): + # [encoder/decoder]_layers -> num_hidden_layers + if key == prefix_to_keep + "_layers": + new_key = "num_hidden_layers" + # [encoder/decoder]_attention_heads -> num_attention_heads + elif key == prefix_to_keep + "_attention_heads": + new_key = "num_attention_heads" + # e.g. encoder_hidden_act -> hidden_act + else: + new_key = key[len(prefix_to_keep) + 1 :] + + # Does the class map the new key into a different attribute name at read time? if so, let's write + # into that attribute instead + if new_key in config_to_return.attribute_map: + new_key = config_to_return.attribute_map[new_key] + + value = getattr(config_to_return, key) + delattr(config_to_return, key) + setattr(config_to_return, new_key, value) + + return config_to_return + + +def get_configuration_file(configuration_files: list[str]) -> str: + """ + Get the configuration file to use for this version of transformers. + + Args: + configuration_files (`list[str]`): The list of available configuration files. + + Returns: + `str`: The configuration file to use. + """ + configuration_files_map = {} + for file_name in configuration_files: + if file_name.startswith("config.") and file_name.endswith(".json") and file_name != "config.json": + v = file_name.removeprefix("config.").removesuffix(".json") + configuration_files_map[v] = file_name + available_versions = sorted(configuration_files_map.keys()) + + # Defaults to FULL_CONFIGURATION_FILE and then try to look at some newer versions. + configuration_file = CONFIG_NAME + transformers_version = version.parse(__version__) + for v in available_versions: + if version.parse(v) <= transformers_version: + configuration_file = configuration_files_map[v] + else: + # No point going further since the versions are sorted. + break + + return configuration_file + + +def recursive_diff_dict(dict_a, dict_b, config_obj=None): + """ + Helper function to recursively take the diff between two nested dictionaries. The resulting diff only contains the + values from `dict_a` that are different from values in `dict_b`. + + dict_b : the default config dictionary. We want to remove values that are in this one + """ + diff = {} + default = config_obj.__class__().to_dict() if config_obj is not None else {} + for key, value in dict_a.items(): + obj_value = getattr(config_obj, str(key), None) + if isinstance(obj_value, PreTrainedConfig) and key in dict_b and isinstance(dict_b[key], dict): + diff_value = recursive_diff_dict(value, dict_b[key], config_obj=obj_value) + diff[key] = diff_value + elif key not in dict_b or (value != default[key]): + diff[key] = value + return diff + + +PreTrainedConfig.push_to_hub = copy_func(PreTrainedConfig.push_to_hub) +if PreTrainedConfig.push_to_hub.__doc__ is not None: + PreTrainedConfig.push_to_hub.__doc__ = PreTrainedConfig.push_to_hub.__doc__.format( + object="config", object_class="AutoConfig", object_files="configuration file" + ) + + +# The alias is only here for BC - we did not have the correct CamelCasing before +PretrainedConfig = PreTrainedConfig + + +ALLOWED_ATTENTION_LAYER_TYPES = ( + "full_attention", + "sliding_attention", + "chunked_attention", + "linear_attention", # used in minimax +) + +ALLOWED_MLP_LAYER_TYPES = ( + "sparse", + "dense", +) + + +def layer_type_validation(layer_types: list[str], num_hidden_layers: int | None = None, attention: bool = True): + """Check that `layer_types` is correctly defined.""" + allowed_layer_types = ALLOWED_ATTENTION_LAYER_TYPES if attention else ALLOWED_MLP_LAYER_TYPES + if not all(layer_type in allowed_layer_types for layer_type in layer_types): + raise ValueError(f"The `layer_types` entries must be in {allowed_layer_types}") + if num_hidden_layers is not None and num_hidden_layers != len(layer_types): + raise ValueError( + f"`num_hidden_layers` ({num_hidden_layers}) must be equal to the number of layer types " + f"({len(layer_types)})" + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/conversion_mapping.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/conversion_mapping.py new file mode 100644 index 0000000000000000000000000000000000000000..03c056c9124ea5e9d3be3148c2eaaf2c18b9f271 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/conversion_mapping.py @@ -0,0 +1,446 @@ +# Copyright (C) 2025 the HuggingFace Inc. team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +from copy import deepcopy +from typing import TYPE_CHECKING + +from .core_model_loading import ( + Chunk, + Concatenate, + ErnieFuseAndSplitTextVisionExperts, + Force16BytesAlignment, + MergeModulelist, + Transpose, + WeightConverter, + WeightRenaming, +) + + +if TYPE_CHECKING: + from .modeling_utils import PreTrainedModel + from .quantizers import HfQuantizer + + +_MODEL_TO_CONVERSION_PATTERN = { + # Mixtral-style MoE + "mixtral": "mixtral", + "minimax": "mixtral", + "minimax_m2": "mixtral", + # Qwen2-style MoE + "qwen2_moe": "qwen2_moe", + "deepseek_v2": "qwen2_moe", + "deepseek_v3": "qwen2_moe", + "dots1": "qwen2_moe", + "ernie4_5_moe": "qwen2_moe", + "glm4_moe": "qwen2_moe", + "glm4_moe_lite": "qwen2_moe", + "glm_moe_dsa": "qwen2_moe", + "glm4v_moe": "qwen2_moe", + "longcat_flash": "qwen2_moe", + "solar_open": "qwen2_moe", + "qwen3_moe": "qwen2_moe", + "qwen3_omni_moe": "qwen2_moe", + "qwen3_omni_moe_thinker": "qwen2_moe", + "qwen3_next": "qwen2_moe", + "qwen3_5_moe": "qwen2_moe", + "hunyuan_v1_moe": "qwen2_moe", + "flex_olmo": "qwen2_moe", + "olmoe": "qwen2_moe", + "exaone_moe": "qwen2_moe", + "rt_detr_v2": "rt_detr", + "pp_doclayout_v3": "rt_detr", +} + + +def _build_checkpoint_conversion_mapping(): + mapping = { + "qwen3_5_text": [ + WeightRenaming(source_patterns=r"^model.language_model", target_patterns="model"), + ], + "t5gemma2": [ + WeightRenaming(r"(? we end up with 2 tensors + Concatenate(dim=1), # each process has 2 tensors, gate and up, we concat them into gate_up + ], # we want the loading to add this shard operation here. Though we can't shard after concats and merge, needs to be first + ), + WeightConverter( + source_patterns=[ + ".experts.*.w2.weight", + ], + target_patterns=".experts.down_proj", # target key gets the list of two tensors + operations=[ + MergeModulelist( + dim=0 + ), # each process has two lists of tensors, we cat each list. -> we end up with 2 tensors + ], # we want the loading to add this shard operation here. Though we can't shard after concats and merge, needs to be first + ), + ], + "qwen2_moe": [ + WeightConverter( + source_patterns=[ + "mlp.experts.*.gate_proj.weight", + "mlp.experts.*.up_proj.weight", + ], + target_patterns="mlp.experts.gate_up_proj", + operations=[MergeModulelist(dim=0), Concatenate(dim=1)], + ), + WeightConverter( + source_patterns="mlp.experts.*.down_proj.weight", + target_patterns="mlp.experts.down_proj", + operations=[MergeModulelist(dim=0)], + ), + ], + "qwen3_vl_moe": [ + WeightConverter( + source_patterns="mlp.experts.gate_up_proj", + target_patterns="mlp.experts.gate_up_proj", + operations=[Transpose(1, 2, check_dims=True), Force16BytesAlignment()], + ), + WeightConverter( + source_patterns="mlp.experts.down_proj", + target_patterns="mlp.experts.down_proj", + operations=[Transpose(1, 2, check_dims=True), Force16BytesAlignment()], + ), + ], + "phimoe": [ + WeightRenaming(".block_sparse_moe.", ".mlp."), + WeightRenaming(".gate.weight", ".router.weight"), + WeightConverter( + source_patterns=[ + ".experts.*.w1.weight", + ".experts.*.w3.weight", + ], + target_patterns=".experts.gate_up_proj", + operations=[MergeModulelist(dim=0), Concatenate(dim=1)], + ), + WeightConverter( + source_patterns=".experts.*.w2.weight", + target_patterns=".experts.down_proj", + operations=[MergeModulelist(dim=0)], + ), + ], + "lfm2_moe": [ + WeightConverter( + source_patterns=[ + "feed_forward.experts.*.w1.weight", + "feed_forward.experts.*.w3.weight", + ], + target_patterns="feed_forward.experts.gate_up_proj", + operations=[MergeModulelist(dim=0), Concatenate(dim=1)], + ), + WeightConverter( + source_patterns="feed_forward.experts.*.w2.weight", + target_patterns="feed_forward.experts.down_proj", + operations=[MergeModulelist(dim=0)], + ), + ], + "ernie4_5_vl_moe": [ + # vision + WeightRenaming("vision_model", "vision_tower"), + # resampler + WeightRenaming("spatial_linear.0", "spatial_linear.fc1"), + WeightRenaming("spatial_linear.2", "spatial_linear.fc2"), + WeightRenaming("spatial_linear.3", "spatial_linear.ln"), + WeightRenaming("temporal_linear.0", "temporal_linear.fc1"), + WeightRenaming("temporal_linear.2", "temporal_linear.fc2"), + WeightRenaming("temporal_linear.3", "temporal_linear.ln"), + # language model + WeightRenaming(r"(? None: + global _checkpoint_conversion_mapping_cache + if _checkpoint_conversion_mapping_cache is None: + _checkpoint_conversion_mapping_cache = _build_checkpoint_conversion_mapping() + if model_type in _checkpoint_conversion_mapping_cache and not overwrite: + raise ValueError(f"Model type {model_type} already exists in the checkpoint conversion mapping.") + _checkpoint_conversion_mapping_cache[model_type] = mapping + + +# DO NOT MODIFY, KEPT FOR BC ONLY +VLMS = [ + "aria", + "ayavision", + "colpali", + "emu3", + "fuyu", + "gotocr2", + "gemma3", + "internvl", + "llava", # all llava prefixed models fall under this check + "mistral3", + "mllama", + "paligemma", + "shieldgemma2", + "qwen2vl", + "qwen2_5_vl", + "videollava", + "vipllava", + "sam3_video", + "sam3", + "sam3_tracker", + "sam3_tracker_video", + "paddleocrvl", + "ernie4_5_vl_moe", + "detr", +] + + +def get_model_conversion_mapping( + model: PreTrainedModel, + key_mapping: dict[str, str] | None = None, + hf_quantizer: HfQuantizer | None = None, + add_legacy: bool = True, +) -> list[WeightConverter | WeightRenaming]: + """ + For a given `model`, obtain the weight conversion mapping if any are registered either as a simple renaming + `_checkpoint_conversion_mapping` class argument, or in the general WeightConverter mapping. + """ + weight_conversions = [] + + # Load models with explicit, user-provided key mapping + if key_mapping is not None: + weight_conversions = [WeightRenaming(source_patterns=k, target_patterns=v) for k, v in key_mapping.items()] + elif any( + allowed_name in class_name.__name__.lower() + for class_name in model.__class__.__mro__[:-1] + for allowed_name in VLMS + ): + weight_conversions = [ + WeightRenaming(source_patterns=k, target_patterns=v) + for k, v in model._checkpoint_conversion_mapping.items() + ] + + # TODO: should be checked recursively on submodels!! + model_type = getattr(model.config, "model_type", None) + if model_type is not None: + model_specific_conversions = get_checkpoint_conversion_mapping(model_type) + if model_specific_conversions is not None: + weight_conversions.extend(model_specific_conversions) + + if add_legacy: + weight_conversions.extend(get_checkpoint_conversion_mapping("legacy")) + + # Add the ones from the quantizer as well if provided + if hf_quantizer is not None: + # NOTE: Since get_weight_conversions() only serve to dequantize, we would normally want to apply them first. + # However, for now it's not possible to cascade converters (i.e., applying model-specific conversions on top + # of tensors created by the dequantization conversions) + # This means that if a model has model-specific conversions and is being dequantized, the model-specific conversion + # that relies on tensors created by dequantization conversions will not be applied. + # GptOss example: with Mxfp4Config(dequantize=True), Force16BytesAlignment converters are ignored because the tensors + # "mlp.experts.gate_up_proj$" and "mlp.experts.down_proj$" are only created after dequantization conversions are applied. + weight_conversions.extend(hf_quantizer.get_weight_conversions()) + + return weight_conversions diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/convert_slow_tokenizer.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/convert_slow_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..ce4385e478b21a99ee9ffab20bce85abdf700e18 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/convert_slow_tokenizer.py @@ -0,0 +1,2080 @@ +# Copyright 2018 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Utilities to convert slow tokenizers in their fast tokenizers counterparts. + +All the conversions are grouped here to gather SentencePiece dependencies outside of the fast tokenizers files and +allow to make our dependency on SentencePiece optional. +""" + +import warnings +from collections.abc import Collection +from functools import lru_cache + +from packaging import version +from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, processors +from tokenizers.models import BPE, Unigram, WordPiece +from tqdm import tqdm + +from .utils import is_protobuf_available, is_sentencepiece_available, logging, requires_backends +from .utils.import_utils import PROTOBUF_IMPORT_ERROR + + +logger = logging.get_logger(__name__) + +MBART_LANGUAGES = [ + "ar_AR", + "cs_CZ", + "de_DE", + "en_XX", + "es_XX", + "et_EE", + "fi_FI", + "fr_XX", + "gu_IN", + "hi_IN", + "it_IT", + "ja_XX", + "kk_KZ", + "ko_KR", + "lt_LT", + "lv_LV", + "my_MM", + "ne_NP", + "nl_XX", + "ro_RO", + "ru_RU", + "si_LK", + "tr_TR", + "vi_VN", + "zh_CN", +] + +MBART50_LANGUAGES = MBART_LANGUAGES + [ + "af_ZA", + "az_AZ", + "bn_IN", + "fa_IR", + "he_IL", + "hr_HR", + "id_ID", + "ka_GE", + "km_KH", + "mk_MK", + "ml_IN", + "mn_MN", + "mr_IN", + "pl_PL", + "ps_AF", + "pt_XX", + "sv_SE", + "sw_KE", + "ta_IN", + "te_IN", + "th_TH", + "tl_XX", + "uk_UA", + "ur_PK", + "xh_ZA", + "gl_ES", + "sl_SI", +] + + +def import_protobuf(error_message=""): + if is_sentencepiece_available(): + from sentencepiece import sentencepiece_model_pb2 + + return sentencepiece_model_pb2 + if is_protobuf_available(): + import google.protobuf + + if version.parse(google.protobuf.__version__) < version.parse("4.0.0"): + from transformers.utils import sentencepiece_model_pb2 + else: + from transformers.utils import sentencepiece_model_pb2_new as sentencepiece_model_pb2 + return sentencepiece_model_pb2 + else: + raise ImportError(PROTOBUF_IMPORT_ERROR.format(error_message)) + + +def _get_prepend_scheme(add_prefix_space: bool, original_tokenizer) -> str: + if add_prefix_space: + prepend_scheme = "always" + if not getattr(original_tokenizer, "legacy", True): + prepend_scheme = "first" + else: + prepend_scheme = "never" + return prepend_scheme + + +def generate_merges(vocab, vocab_scores, skip_tokens: Collection[str] | None = None): + skip_tokens = set(skip_tokens) if skip_tokens is not None else set() + reverse = vocab_scores is not None + vocab_scores = dict(vocab_scores) if reverse else vocab + + merges = [] + for merge, piece_score in vocab_scores.items(): + if merge in skip_tokens: + continue + local = [] + for index in range(1, len(merge)): + piece_l, piece_r = merge[:index], merge[index:] + if piece_l in skip_tokens or piece_r in skip_tokens: + continue + if piece_l in vocab and piece_r in vocab: + local.append((piece_l, piece_r, piece_score)) + local = sorted(local, key=lambda x: (vocab[x[0]], vocab[x[1]])) + merges.extend(local) + + merges = sorted(merges, key=lambda val: (val[2], len(val[0]), len(val[1])), reverse=reverse) + merges = [(val[0], val[1]) for val in merges] + return merges + + +class SentencePieceExtractor: + """ + Extractor implementation for SentencePiece trained models. https://github.com/google/sentencepiece + """ + + def __init__(self, model: str): + requires_backends(self, "sentencepiece") + requires_backends(self, "protobuf") + + # from .utils import sentencepiece_model_pb2 as model_pb2 + model_pb2 = import_protobuf() + + m = model_pb2.ModelProto() + with open(model, "rb") as f: + m.ParseFromString(f.read()) + self.proto = m + + def extract(self, model_type, **kwargs) -> tuple[dict[str, int], list[tuple]]: + """ + By default will return vocab and merges with respect to their order, by sending `vocab_scores` we're going to + order the merges with respect to the piece scores instead. + """ + self.proto.trainer_spec.unk_id + if model_type is None: + from tokenizers.models import BPE, Unigram + + model_type = Unigram if self.proto.trainer_spec.model_type == 1 else BPE + vocab = [(piece.piece, piece.score) for piece in self.proto.pieces] + + if model_type.__name__ != "BPE": + kwargs["unk_id"] = self.proto.trainer_spec.unk_id + kwargs["vocab"] = vocab + else: + from .tokenization_utils_base import generate_merges + + vocab = {word: i for i, (word, score) in enumerate(vocab)} + merges = generate_merges(vocab) + kwargs["vocab"] = vocab + kwargs["merges"] = merges + + # control tokens are special + # user defined symbols are not + # both user and control tokens are AddedTokens + # Add user defined symbols (type == 4) from sentencepiece (https://github.com/google/sentencepiece/blob/6225e08edb2577757163b3f5dbba4c0b670ef445/src/sentencepiece_model.proto#L299C29-L299C33) + spm_added_tokens = [(id, p.piece, p.type == 3) for id, p in enumerate(self.proto.pieces) if p.type in [3, 4]] + kwargs["additional_special_tokens"] = [ + AddedToken(token, normalized=False, special=special) + for id, token, special in sorted(spm_added_tokens, key=lambda x: x[0]) + ] + return kwargs + + +class GemmaSentencePieceExtractor(SentencePieceExtractor): + def extract(self, vocab_scores=None) -> tuple[dict[str, int], list[tuple]]: + """ + By default will return vocab and merges with respect to their order, by sending `vocab_scores` we're going to + order the merges with respect to the piece scores instead. + """ + sp = self.sp + vocab = {sp.id_to_piece(index): index for index in range(sp.GetPieceSize())} + + # If "\t" is missing in the vocab, we have to do this to support merges + # "<0x09>" is the bytefallback for `\t` + if "\t" not in vocab: + vocab["\t"] = vocab.get("<0x09>") + merges = generate_merges(vocab, vocab_scores) + return vocab, merges + + +def check_number_comma(piece: str) -> bool: + return len(piece) < 2 or piece[-1] != "," or not piece[-2].isdigit() + + +class Converter: + def __init__(self, original_tokenizer): + self.original_tokenizer = original_tokenizer + + def converted(self) -> Tokenizer: + raise NotImplementedError() + + +class BertConverter(Converter): + def converted(self) -> Tokenizer: + vocab = self.original_tokenizer.vocab + tokenizer = Tokenizer(WordPiece(vocab, unk_token=str(self.original_tokenizer.unk_token))) + + tokenize_chinese_chars = False + strip_accents = False + do_lower_case = False + if hasattr(self.original_tokenizer, "basic_tokenizer"): + tokenize_chinese_chars = self.original_tokenizer.basic_tokenizer.tokenize_chinese_chars + strip_accents = self.original_tokenizer.basic_tokenizer.strip_accents + do_lower_case = self.original_tokenizer.basic_tokenizer.do_lower_case + + tokenizer.normalizer = normalizers.BertNormalizer( + clean_text=True, + handle_chinese_chars=tokenize_chinese_chars, + strip_accents=strip_accents, + lowercase=do_lower_case, + ) + tokenizer.pre_tokenizer = pre_tokenizers.BertPreTokenizer() + + cls = str(self.original_tokenizer.cls_token) + sep = str(self.original_tokenizer.sep_token) + cls_token_id = self.original_tokenizer.cls_token_id + sep_token_id = self.original_tokenizer.sep_token_id + + tokenizer.post_processor = processors.TemplateProcessing( + single=f"{cls}:0 $A:0 {sep}:0", + pair=f"{cls}:0 $A:0 {sep}:0 $B:1 {sep}:1", + special_tokens=[ + (cls, cls_token_id), + (sep, sep_token_id), + ], + ) + tokenizer.decoder = decoders.WordPiece(prefix="##") + + return tokenizer + + +class SplinterConverter(Converter): + def converted(self) -> Tokenizer: + vocab = self.original_tokenizer.vocab + tokenizer = Tokenizer(WordPiece(vocab, unk_token=str(self.original_tokenizer.unk_token))) + + tokenize_chinese_chars = False + strip_accents = False + do_lower_case = False + if hasattr(self.original_tokenizer, "basic_tokenizer"): + tokenize_chinese_chars = self.original_tokenizer.basic_tokenizer.tokenize_chinese_chars + strip_accents = self.original_tokenizer.basic_tokenizer.strip_accents + do_lower_case = self.original_tokenizer.basic_tokenizer.do_lower_case + + tokenizer.normalizer = normalizers.BertNormalizer( + clean_text=True, + handle_chinese_chars=tokenize_chinese_chars, + strip_accents=strip_accents, + lowercase=do_lower_case, + ) + tokenizer.pre_tokenizer = pre_tokenizers.BertPreTokenizer() + + cls = str(self.original_tokenizer.cls_token) + sep = str(self.original_tokenizer.sep_token) + question = str(self.original_tokenizer.question_token) + dot = "." + cls_token_id = self.original_tokenizer.cls_token_id + sep_token_id = self.original_tokenizer.sep_token_id + question_token_id = self.original_tokenizer.question_token_id + dot_token_id = self.original_tokenizer.convert_tokens_to_ids(".") + + if self.original_tokenizer.padding_side == "right": + pair = f"{cls}:0 $A:0 {question} {dot} {sep}:0 $B:1 {sep}:1" + else: + pair = f"{cls}:0 $A:0 {sep}:0 $B:1 {question} {dot} {sep}:1" + + tokenizer.post_processor = processors.TemplateProcessing( + single=f"{cls}:0 $A:0 {sep}:0", + pair=pair, + special_tokens=[ + (cls, cls_token_id), + (sep, sep_token_id), + (question, question_token_id), + (dot, dot_token_id), + ], + ) + tokenizer.decoder = decoders.WordPiece(prefix="##") + + return tokenizer + + +class FunnelConverter(Converter): + def converted(self) -> Tokenizer: + vocab = self.original_tokenizer.vocab + tokenizer = Tokenizer(WordPiece(vocab, unk_token=str(self.original_tokenizer.unk_token))) + + tokenize_chinese_chars = False + strip_accents = False + do_lower_case = False + if hasattr(self.original_tokenizer, "basic_tokenizer"): + tokenize_chinese_chars = self.original_tokenizer.basic_tokenizer.tokenize_chinese_chars + strip_accents = self.original_tokenizer.basic_tokenizer.strip_accents + do_lower_case = self.original_tokenizer.basic_tokenizer.do_lower_case + + tokenizer.normalizer = normalizers.BertNormalizer( + clean_text=True, + handle_chinese_chars=tokenize_chinese_chars, + strip_accents=strip_accents, + lowercase=do_lower_case, + ) + tokenizer.pre_tokenizer = pre_tokenizers.BertPreTokenizer() + + cls = str(self.original_tokenizer.cls_token) + sep = str(self.original_tokenizer.sep_token) + cls_token_id = self.original_tokenizer.cls_token_id + sep_token_id = self.original_tokenizer.sep_token_id + + tokenizer.post_processor = processors.TemplateProcessing( + single=f"{cls}:2 $A:0 {sep}:0", # token_type_id is 2 for Funnel transformer + pair=f"{cls}:2 $A:0 {sep}:0 $B:1 {sep}:1", + special_tokens=[ + (cls, cls_token_id), + (sep, sep_token_id), + ], + ) + tokenizer.decoder = decoders.WordPiece(prefix="##") + + return tokenizer + + +class MPNetConverter(Converter): + def converted(self) -> Tokenizer: + vocab = self.original_tokenizer.vocab + tokenizer = Tokenizer(WordPiece(vocab, unk_token=str(self.original_tokenizer.unk_token))) + + tokenize_chinese_chars = False + strip_accents = False + do_lower_case = False + if hasattr(self.original_tokenizer, "basic_tokenizer"): + tokenize_chinese_chars = self.original_tokenizer.basic_tokenizer.tokenize_chinese_chars + strip_accents = self.original_tokenizer.basic_tokenizer.strip_accents + do_lower_case = self.original_tokenizer.basic_tokenizer.do_lower_case + + tokenizer.normalizer = normalizers.BertNormalizer( + clean_text=True, + handle_chinese_chars=tokenize_chinese_chars, + strip_accents=strip_accents, + lowercase=do_lower_case, + ) + tokenizer.pre_tokenizer = pre_tokenizers.BertPreTokenizer() + + cls = str(self.original_tokenizer.cls_token) + sep = str(self.original_tokenizer.sep_token) + cls_token_id = self.original_tokenizer.cls_token_id + sep_token_id = self.original_tokenizer.sep_token_id + + tokenizer.post_processor = processors.TemplateProcessing( + single=f"{cls}:0 $A:0 {sep}:0", + pair=f"{cls}:0 $A:0 {sep}:0 {sep}:0 $B:1 {sep}:1", # MPNet uses two [SEP] tokens + special_tokens=[ + (cls, cls_token_id), + (sep, sep_token_id), + ], + ) + tokenizer.decoder = decoders.WordPiece(prefix="##") + + return tokenizer + + +class OpenAIGPTConverter(Converter): + def converted(self) -> Tokenizer: + vocab = self.original_tokenizer.encoder + merges = list(self.original_tokenizer.bpe_ranks.keys()) + unk_token = self.original_tokenizer.unk_token + + tokenizer = Tokenizer( + BPE( + vocab=vocab, + merges=merges, + dropout=None, + unk_token=str(unk_token), + end_of_word_suffix="", + fuse_unk=False, + ) + ) + + if tokenizer.token_to_id(str(unk_token)) is not None: + tokenizer.add_special_tokens([str(unk_token)]) + + tokenizer.normalizer = normalizers.BertNormalizer(lowercase=True) + tokenizer.pre_tokenizer = pre_tokenizers.BertPreTokenizer() + tokenizer.decoder = decoders.BPEDecoder(suffix="") + + return tokenizer + + +class GPT2Converter(Converter): + def converted(self, vocab: dict[str, int] | None = None, merges: list[tuple[str, str]] | None = None) -> Tokenizer: + if not vocab: + vocab = self.original_tokenizer.encoder + if not merges: + merges = list(self.original_tokenizer.bpe_ranks) + + tokenizer = Tokenizer( + BPE( + vocab=vocab, + merges=merges, + dropout=None, + continuing_subword_prefix="", + end_of_word_suffix="", + fuse_unk=False, + ) + ) + + add_prefix_space = getattr(self.original_tokenizer, "add_prefix_space", False) + tokenizer.pre_tokenizer = pre_tokenizers.ByteLevel(add_prefix_space=add_prefix_space) + tokenizer.decoder = decoders.ByteLevel() + if getattr(self.original_tokenizer, "add_bos_token", False): + bos = self.original_tokenizer.bos_token + bos_token_id = self.original_tokenizer.bos_token_id + tokenizer.post_processor = processors.TemplateProcessing( + single=f"{bos}:0 $A:0", + pair=f"{bos}:0 $A:0 $B:1", + special_tokens=[ + (bos, bos_token_id), + ], + ) + else: + # XXX trim_offsets=False actually means this post_processor doesn't + # really do anything. + tokenizer.post_processor = processors.ByteLevel(trim_offsets=False) + return tokenizer + + +class HerbertConverter(Converter): + def converted(self) -> Tokenizer: + tokenizer_info_str = "#version:" + token_suffix = "" + + vocab = self.original_tokenizer.encoder + merges = list(self.original_tokenizer.bpe_ranks.keys()) + if tokenizer_info_str in merges[0][0]: + merges = merges[1:] + + tokenizer = Tokenizer( + BPE( + vocab, + merges, + dropout=None, + unk_token=self.original_tokenizer.unk_token, + end_of_word_suffix=token_suffix, + ) + ) + + tokenizer.normalizer = normalizers.BertNormalizer(lowercase=False, strip_accents=False) + tokenizer.pre_tokenizer = pre_tokenizers.BertPreTokenizer() + tokenizer.decoder = decoders.BPEDecoder(suffix=token_suffix) + tokenizer.post_processor = processors.BertProcessing( + sep=(self.original_tokenizer.sep_token, self.original_tokenizer.sep_token_id), + cls=(self.original_tokenizer.cls_token, self.original_tokenizer.cls_token_id), + ) + + return tokenizer + + +class Qwen2Converter(Converter): + def converted(self, vocab: dict[str, int] | None = None, merges: list[tuple[str, str]] | None = None) -> Tokenizer: + if not vocab: + vocab = self.original_tokenizer.encoder + if not merges: + merges = list(self.original_tokenizer.bpe_ranks.keys()) + + tokenizer = Tokenizer( + BPE( + vocab=vocab, + merges=merges, + dropout=None, + unk_token=None, + continuing_subword_prefix="", + end_of_word_suffix="", + fuse_unk=False, + byte_fallback=False, + ) + ) + + tokenizer.normalizer = normalizers.NFC() + + tokenizer.pre_tokenizer = pre_tokenizers.Sequence( + [ + pre_tokenizers.Split( + Regex( + r"""(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+""" + ), + behavior="isolated", + invert=False, + ), + pre_tokenizers.ByteLevel( + add_prefix_space=getattr(self.original_tokenizer, "add_prefix_space", False), + use_regex=False, + ), + ] + ) + + tokenizer.decoder = decoders.ByteLevel() + tokenizer.post_processor = processors.ByteLevel(trim_offsets=False) + + return tokenizer + + +class RobertaConverter(Converter): + def converted(self) -> Tokenizer: + ot = self.original_tokenizer + vocab = ot.encoder + merges = list(ot.bpe_ranks.keys()) + + tokenizer = Tokenizer( + BPE( + vocab=vocab, + merges=merges, + dropout=None, + continuing_subword_prefix="", + end_of_word_suffix="", + fuse_unk=False, + ) + ) + + tokenizer.pre_tokenizer = pre_tokenizers.ByteLevel(add_prefix_space=ot.add_prefix_space) + tokenizer.decoder = decoders.ByteLevel() + tokenizer.post_processor = processors.RobertaProcessing( + sep=(ot.sep_token, ot.sep_token_id), + cls=(ot.cls_token, ot.cls_token_id), + add_prefix_space=ot.add_prefix_space, + trim_offsets=True, # True by default on Roberta (historical) + ) + + return tokenizer + + +class RoFormerConverter(Converter): + def converted(self) -> Tokenizer: + from .models.roformer.tokenization_utils import JiebaPreTokenizer + + vocab = self.original_tokenizer.vocab + tokenizer = Tokenizer(WordPiece(vocab, unk_token=str(self.original_tokenizer.unk_token))) + + strip_accents = False + do_lower_case = False + if hasattr(self.original_tokenizer, "basic_tokenizer"): + strip_accents = self.original_tokenizer.basic_tokenizer.strip_accents + do_lower_case = self.original_tokenizer.basic_tokenizer.do_lower_case + + tokenizer.normalizer = normalizers.BertNormalizer( + clean_text=True, + handle_chinese_chars=False, + strip_accents=strip_accents, + lowercase=do_lower_case, + ) + tokenizer.pre_tokenizer = pre_tokenizers.PreTokenizer.custom(JiebaPreTokenizer(vocab)) + + cls = str(self.original_tokenizer.cls_token) + sep = str(self.original_tokenizer.sep_token) + cls_token_id = self.original_tokenizer.cls_token_id + sep_token_id = self.original_tokenizer.sep_token_id + + tokenizer.post_processor = processors.TemplateProcessing( + single=f"{cls}:0 $A:0 {sep}:0", + pair=f"{cls}:0 $A:0 {sep}:0 $B:1 {sep}:1", + special_tokens=[ + (cls, cls_token_id), + (sep, sep_token_id), + ], + ) + tokenizer.decoder = decoders.WordPiece(prefix="##") + + return tokenizer + + +class DebertaConverter(Converter): + def converted(self) -> Tokenizer: + ot = self.original_tokenizer + vocab = ot.encoder + merges = list(ot.bpe_ranks.keys()) + + tokenizer = Tokenizer( + BPE( + vocab=vocab, + merges=merges, + dropout=None, + continuing_subword_prefix="", + end_of_word_suffix="", + fuse_unk=False, + ) + ) + + tokenizer.pre_tokenizer = pre_tokenizers.ByteLevel(add_prefix_space=ot.add_prefix_space) + tokenizer.decoder = decoders.ByteLevel() + tokenizer.post_processor = processors.TemplateProcessing( + single="[CLS]:0 $A:0 [SEP]:0", + pair="[CLS]:0 $A:0 [SEP]:0 $B:1 [SEP]:1", + special_tokens=[ + ("[CLS]", self.original_tokenizer.convert_tokens_to_ids("[CLS]")), + ("[SEP]", self.original_tokenizer.convert_tokens_to_ids("[SEP]")), + ], + ) + + return tokenizer + + +class SpmConverter(Converter): + handle_byte_fallback = False + SpmExtractor = SentencePieceExtractor + special_tokens = {} + + @classmethod + def convert_from_spm(cls, vocab=None, **kwargs): + """ + Hook used when converting directly from a SentencePiece model without a slow tokenizer instance. + By default, return kwargs unchanged. + """ + if vocab is not None: + kwargs["vocab"] = vocab + return kwargs + + def __init__(self, *args): + requires_backends(self, "protobuf") + + super().__init__(*args) + + # from .utils import sentencepiece_model_pb2 as model_pb2 + model_pb2 = import_protobuf() + + m = model_pb2.ModelProto() + with open(self.original_tokenizer.vocab_file, "rb") as f: + m.ParseFromString(f.read()) + self.proto = m + + if self.proto.trainer_spec.byte_fallback and not self.handle_byte_fallback: + warnings.warn( + "The sentencepiece tokenizer that you are converting to a fast tokenizer uses the byte fallback option" + " which is not implemented in the fast tokenizers. In practice this means that the fast version of the" + " tokenizer can produce unknown tokens whereas the sentencepiece version would have converted these " + "unknown tokens into a sequence of byte tokens matching the original piece of text." + ) + + def vocab(self, proto): + return [(piece.piece, piece.score) for piece in proto.pieces] + + def unk_id(self, proto): + return proto.trainer_spec.unk_id + + def tokenizer(self, proto): + model_type = proto.trainer_spec.model_type + vocab_scores = self.vocab(proto) + + if model_type == 1: + tokenizer = Tokenizer( + Unigram( + vocab_scores, + unk_id=self.unk_id(proto), + byte_fallback=self.handle_byte_fallback, + ) + ) + + elif model_type == 2: + _, merges = self.SpmExtractor(self.original_tokenizer.vocab_file).extract(vocab_scores) + bpe_vocab = {word: i for i, (word, score) in enumerate(vocab_scores)} + tokenizer = Tokenizer( + BPE( + bpe_vocab, + merges, + unk_token=proto.trainer_spec.unk_piece, + fuse_unk=True, + byte_fallback=self.handle_byte_fallback, + dropout=None, + ) + ) + + else: + raise Exception( + "You're trying to run a `Unigram` model but you're file was trained with a different algorithm" + ) + + # control tokens are special + # user defined symbols are not + # both user and control tokens are AddedTokens + # Add user defined symbols (type == 4) from sentencepiece (https://github.com/google/sentencepiece/blob/6225e08edb2577757163b3f5dbba4c0b670ef445/src/sentencepiece_model.proto#L299C29-L299C33) + spm_added_tokens = [ + (id, p.piece, p.type == 3 or p.piece in self.special_tokens) + for id, p in enumerate(proto.pieces) + if p.type in [3, 4] + ] + tokenizer.add_tokens( + [ + AddedToken(token, normalized=False, special=special) + for id, token, special in sorted(spm_added_tokens, key=lambda x: x[0]) + ] + ) + + return tokenizer + + def normalizer(self, proto): + precompiled_charsmap = proto.normalizer_spec.precompiled_charsmap + _normalizers = [ + normalizers.Strip(left=False, right=True), # stripping is important + normalizers.Replace(Regex(" {2,}"), "▁"), + ] + if not precompiled_charsmap: + return normalizers.Sequence(_normalizers) + else: + return normalizers.Sequence([normalizers.Precompiled(precompiled_charsmap)] + _normalizers) + + def pre_tokenizer(self, replacement, add_prefix_space): + prepend_scheme = _get_prepend_scheme(add_prefix_space, self.original_tokenizer) + return pre_tokenizers.Metaspace(replacement=replacement, prepend_scheme=prepend_scheme) + + def post_processor(self): + return None + + def decoder(self, replacement, add_prefix_space): + prepend_scheme = _get_prepend_scheme(add_prefix_space, self.original_tokenizer) + return decoders.Metaspace(replacement=replacement, prepend_scheme=prepend_scheme) + + def converted(self) -> Tokenizer: + tokenizer = self.tokenizer(self.proto) + + # Tokenizer assemble + normalizer = self.normalizer(self.proto) + if normalizer is not None: + tokenizer.normalizer = normalizer + + replacement = "▁" + add_prefix_space = True + if hasattr(self.original_tokenizer, "add_prefix_space"): + add_prefix_space = self.original_tokenizer.add_prefix_space + + pre_tokenizer = self.pre_tokenizer(replacement, add_prefix_space) + if pre_tokenizer is not None: + tokenizer.pre_tokenizer = pre_tokenizer + + tokenizer.decoder = self.decoder(replacement, add_prefix_space) + post_processor = self.post_processor() + if post_processor: + tokenizer.post_processor = post_processor + + return tokenizer + + +class AlbertConverter(SpmConverter): + def vocab(self, proto): + return [ + (piece.piece, piece.score) if check_number_comma(piece.piece) else (piece.piece, piece.score - 100) + for piece in proto.pieces + ] + + def normalizer(self, proto): + list_normalizers = [ + normalizers.Replace("``", '"'), + normalizers.Replace("''", '"'), + ] + if not self.original_tokenizer.keep_accents: + list_normalizers.append(normalizers.NFKD()) + list_normalizers.append(normalizers.StripAccents()) + if self.original_tokenizer.do_lower_case: + list_normalizers.append(normalizers.Lowercase()) + + precompiled_charsmap = proto.normalizer_spec.precompiled_charsmap + + if precompiled_charsmap: + list_normalizers.append(normalizers.Precompiled(precompiled_charsmap)) + + list_normalizers.append(normalizers.Replace(Regex(" {2,}"), " ")) + return normalizers.Sequence(list_normalizers) + + def post_processor(self): + return processors.TemplateProcessing( + single="[CLS]:0 $A:0 [SEP]:0", + pair="[CLS]:0 $A:0 [SEP]:0 $B:1 [SEP]:1", + special_tokens=[ + ("[CLS]", self.original_tokenizer.convert_tokens_to_ids("[CLS]")), + ("[SEP]", self.original_tokenizer.convert_tokens_to_ids("[SEP]")), + ], + ) + + +class BarthezConverter(SpmConverter): + def unk_id(self, proto): + unk_id = 3 + return unk_id + + def post_processor(self): + return processors.TemplateProcessing( + single=" $A ", + pair=" $A $B ", + special_tokens=[ + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ], + ) + + +class CamembertConverter(SpmConverter): + def vocab(self, proto): + vocab = [ + ("NOTUSED", 0.0), + ("", 0.0), + ("NOTUSED", 0.0), + ("", 0.0), + ("NOTUSED", -100), + ] + # We down-grade the original SentencePiece by -100 to avoid using it and use our added token instead + vocab += [(piece.piece, piece.score) for piece in proto.pieces[1:]] + vocab += [("", 0.0)] + return vocab + + def unk_id(self, proto): + # See vocab unk position + return 3 + + def post_processor(self): + return processors.TemplateProcessing( + single=" $A ", + pair=" $A $B ", + special_tokens=[ + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ], + ) + + @classmethod + def convert_from_spm(cls, vocab=None, **kwargs): + pad_token = str(kwargs.get("pad_token", "")) + unk_token = str(kwargs.get("unk_token", "")) + mask_token = str(kwargs.get("mask_token", "")) + + vocab_list = [ + ("NOTUSED", 0.0), + (pad_token, 0.0), + ("NOTUSED", 0.0), + (unk_token, 0.0), + ("NOTUSED", -100.0), + ] + if vocab is not None: + vocab_list.extend(list(vocab)[1:]) + vocab_list.append((mask_token, 0.0)) + kwargs["vocab"] = vocab_list + return kwargs + + +class DebertaV2Converter(SpmConverter): + def pre_tokenizer(self, replacement, add_prefix_space): + list_pretokenizers = [] + if self.original_tokenizer.split_by_punct: + list_pretokenizers.append(pre_tokenizers.Punctuation(behavior="isolated")) + prepend_scheme = _get_prepend_scheme(add_prefix_space, self.original_tokenizer) + list_pretokenizers.append(pre_tokenizers.Metaspace(replacement=replacement, prepend_scheme=prepend_scheme)) + return pre_tokenizers.Sequence(list_pretokenizers) + + def normalizer(self, proto): + list_normalizers = [] + if self.original_tokenizer.do_lower_case: + list_normalizers.append(normalizers.Lowercase()) + list_normalizers.append(normalizers.Strip()) + + precompiled_charsmap = proto.normalizer_spec.precompiled_charsmap + if precompiled_charsmap: + list_normalizers.append(normalizers.Precompiled(precompiled_charsmap)) + list_normalizers.append(normalizers.Replace(Regex(" {2,}"), " ")) + + return normalizers.Sequence(list_normalizers) + + def post_processor(self): + return processors.TemplateProcessing( + single="[CLS]:0 $A:0 [SEP]:0", + pair="[CLS]:0 $A:0 [SEP]:0 $B:1 [SEP]:1", + special_tokens=[ + ("[CLS]", self.original_tokenizer.convert_tokens_to_ids("[CLS]")), + ("[SEP]", self.original_tokenizer.convert_tokens_to_ids("[SEP]")), + ], + ) + + +class MBartConverter(SpmConverter): + def vocab(self, proto): + vocab = [ + ("", 0.0), + ("", 0.0), + ("", 0.0), + ("", 0.0), + ] + vocab += [(piece.piece, piece.score) for piece in proto.pieces[3:]] + vocab += [ + ("ar_AR", 0.0), + ("cs_CZ", 0.0), + ("de_DE", 0.0), + ("en_XX", 0.0), + ("es_XX", 0.0), + ("et_EE", 0.0), + ("fi_FI", 0.0), + ("fr_XX", 0.0), + ("gu_IN", 0.0), + ("hi_IN", 0.0), + ("it_IT", 0.0), + ("ja_XX", 0.0), + ("kk_KZ", 0.0), + ("ko_KR", 0.0), + ("lt_LT", 0.0), + ("lv_LV", 0.0), + ("my_MM", 0.0), + ("ne_NP", 0.0), + ("nl_XX", 0.0), + ("ro_RO", 0.0), + ("ru_RU", 0.0), + ("si_LK", 0.0), + ("tr_TR", 0.0), + ("vi_VN", 0.0), + ("zh_CN", 0.0), + ] + vocab += [("", 0.0)] + return vocab + + def unk_id(self, proto): + return 3 + + def post_processor(self): + return processors.TemplateProcessing( + single="$A en_XX", + pair="$A $B en_XX", + special_tokens=[ + ("en_XX", self.original_tokenizer.convert_tokens_to_ids("en_XX")), + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ], + ) + + @classmethod + def convert_from_spm(cls, vocab=None, **kwargs): + bos_token = str(kwargs.get("bos_token", "")) + pad_token = str(kwargs.get("pad_token", "")) + eos_token = str(kwargs.get("eos_token", "")) + unk_token = str(kwargs.get("unk_token", "")) + mask_token = str(kwargs.get("mask_token", "")) + + vocab_list = [ + (bos_token, 0.0), + (pad_token, 0.0), + (eos_token, 0.0), + (unk_token, 0.0), + ] + if vocab is not None: + vocab_list.extend(list(vocab)[3:]) + vocab_list.extend((lang_code, 0.0) for lang_code in MBART_LANGUAGES) + vocab_list.append((mask_token, 0.0)) + kwargs["vocab"] = vocab_list + return kwargs + + +class MBart50Converter(SpmConverter): + def vocab(self, proto): + vocab = [ + ("", 0.0), + ("", 0.0), + ("", 0.0), + ("", 0.0), + ] + vocab += [(piece.piece, piece.score) for piece in proto.pieces[3:]] + vocab += [("ar_AR", 0.0), ("cs_CZ", 0.0), ("de_DE", 0.0), ("en_XX", 0.0), ("es_XX", 0.0), ("et_EE", 0.0), ("fi_FI", 0.0), ("fr_XX", 0.0), ("gu_IN", 0.0), ("hi_IN", 0.0), ("it_IT", 0.0), ("ja_XX", 0.0), ("kk_KZ", 0.0), ("ko_KR", 0.0), ("lt_LT", 0.0), ("lv_LV", 0.0), ("my_MM", 0.0), ("ne_NP", 0.0), ("nl_XX", 0.0), ("ro_RO", 0.0), ("ru_RU", 0.0), ("si_LK", 0.0), ("tr_TR", 0.0), ("vi_VN", 0.0), ("zh_CN", 0.0), ("af_ZA", 0.0), ("az_AZ", 0.0), ("bn_IN", 0.0), ("fa_IR", 0.0), ("he_IL", 0.0), ("hr_HR", 0.0), ("id_ID", 0.0), ("ka_GE", 0.0), ("km_KH", 0.0), ("mk_MK", 0.0), ("ml_IN", 0.0), ("mn_MN", 0.0), ("mr_IN", 0.0), ("pl_PL", 0.0), ("ps_AF", 0.0), ("pt_XX", 0.0), ("sv_SE", 0.0), ("sw_KE", 0.0), ("ta_IN", 0.0), ("te_IN", 0.0), ("th_TH", 0.0), ("tl_XX", 0.0), ("uk_UA", 0.0), ("ur_PK", 0.0), ("xh_ZA", 0.0), ("gl_ES", 0.0), ("sl_SI", 0.0)] # fmt: skip + vocab += [("", 0.0)] + return vocab + + def unk_id(self, proto): + return 3 + + def post_processor(self): + return processors.TemplateProcessing( + single="en_XX $A ", + pair="en_XX $A $B ", + special_tokens=[ + ("en_XX", self.original_tokenizer.convert_tokens_to_ids("en_XX")), + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ], + ) + + @classmethod + def convert_from_spm(cls, vocab=None, **kwargs): + cls_token = str(kwargs.get("cls_token", "")) + pad_token = str(kwargs.get("pad_token", "")) + eos_token = str(kwargs.get("eos_token", "")) + unk_token = str(kwargs.get("unk_token", "")) + mask_token = str(kwargs.get("mask_token", "")) + + vocab_list = [ + (cls_token, 0.0), + (pad_token, 0.0), + (eos_token, 0.0), + (unk_token, 0.0), + ] + if vocab is not None: + vocab_list.extend(list(vocab)[3:]) + vocab_list.extend((lang_code, 0.0) for lang_code in MBART50_LANGUAGES) + vocab_list.append((mask_token, 0.0)) + kwargs["vocab"] = vocab_list + return kwargs + + +class NllbConverter(SpmConverter): + def vocab(self, proto): + vocab = [ + ("", 0.0), + ("", 0.0), + ("", 0.0), + ("", 0.0), + ] + vocab += [(piece.piece, piece.score) for piece in proto.pieces[3:]] + return vocab + + def unk_id(self, proto): + return 3 + + def post_processor(self): + return processors.TemplateProcessing( + single="eng_Latn $A ", + pair="eng_Latn $A $B ", + special_tokens=[ + ("eng_Latn", self.original_tokenizer.convert_tokens_to_ids("eng_Latn")), + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ], + ) + + @classmethod + def convert_from_spm(cls, vocab=None, **kwargs): + bos_token = str(kwargs.get("bos_token", "")) + pad_token = str(kwargs.get("pad_token", "")) + eos_token = str(kwargs.get("eos_token", "")) + unk_token = str(kwargs.get("unk_token", "")) + + reordered_vocab = { + bos_token: 0, + pad_token: 1, + eos_token: 2, + unk_token: 3, + } + if vocab is not None: + tokens = vocab.keys() if isinstance(vocab, dict) else [tok for tok, _ in vocab] + for token in tokens: + if token in reordered_vocab: + continue + reordered_vocab[token] = len(reordered_vocab) + kwargs["vocab"] = reordered_vocab + return kwargs + + +class SeamlessM4TConverter(SpmConverter): + def vocab(self, proto): + vocab = [ + ("", 0.0), + ("", 0.0), + ("", 0.0), + ("", 0.0), + ] + vocab += [(piece.piece, piece.score) for piece in proto.pieces[3:]] + return vocab + + def unk_id(self, proto): + return self.original_tokenizer.unk_token_id + + def post_processor(self): + return processors.TemplateProcessing( + single="__eng__ $A ", + pair="__eng__ $A $B ", + special_tokens=[ + ("__eng__", self.original_tokenizer.convert_tokens_to_ids("__eng__")), + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ], + ) + + +class XLMRobertaConverter(SpmConverter): + def vocab(self, proto): + vocab = [ + ("", 0.0), + ("", 0.0), + ("", 0.0), + ("", 0.0), + ] + vocab += [(piece.piece, piece.score) for piece in proto.pieces[3:]] + vocab += [("", 0.0)] + return vocab + + def unk_id(self, proto): + unk_id = 3 + return unk_id + + def post_processor(self): + return processors.TemplateProcessing( + single=" $A ", + pair=" $A $B ", + special_tokens=[ + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ], + ) + + @classmethod + def convert_from_spm(cls, vocab=None, **kwargs): + bos_token = str(kwargs.get("bos_token", "")) + pad_token = str(kwargs.get("pad_token", "")) + eos_token = str(kwargs.get("eos_token", "")) + unk_token = str(kwargs.get("unk_token", "")) + mask_token = str(kwargs.get("mask_token", "")) + + vocab_list = [ + (bos_token, 0.0), + (pad_token, 0.0), + (eos_token, 0.0), + (unk_token, 0.0), + ] + if vocab is not None: + vocab_list.extend(list(vocab)[3:]) + vocab_list.append((mask_token, 0.0)) + kwargs["vocab"] = vocab_list + return kwargs + + +class XLNetConverter(SpmConverter): + def vocab(self, proto): + return [ + (piece.piece, piece.score) if check_number_comma(piece.piece) else (piece.piece, piece.score - 100) + for piece in proto.pieces + ] + + def normalizer(self, proto): + list_normalizers = [ + normalizers.Replace("``", '"'), + normalizers.Replace("''", '"'), + ] + if not self.original_tokenizer.keep_accents: + list_normalizers.append(normalizers.NFKD()) + list_normalizers.append(normalizers.StripAccents()) + if self.original_tokenizer.do_lower_case: + list_normalizers.append(normalizers.Lowercase()) + + precompiled_charsmap = proto.normalizer_spec.precompiled_charsmap + + if precompiled_charsmap: + list_normalizers.append(normalizers.Precompiled(precompiled_charsmap)) + + list_normalizers.append(normalizers.Replace(Regex(" {2,}"), " ")) + return normalizers.Sequence(list_normalizers) + + def post_processor(self): + return processors.TemplateProcessing( + single="$A:0 :0 :2", + pair="$A:0 :0 $B:1 :1 :2", + special_tokens=[ + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ], + ) + + +class ReformerConverter(SpmConverter): + pass + + +class RemBertConverter(SpmConverter): + # Inspired from AlbertConverter + def normalizer(self, proto): + list_normalizers = [ + normalizers.Replace("``", '"'), + normalizers.Replace("''", '"'), + normalizers.Replace(Regex(" {2,}"), " "), + ] + if not self.original_tokenizer.keep_accents: + list_normalizers.append(normalizers.NFKD()) + list_normalizers.append(normalizers.StripAccents()) + if self.original_tokenizer.do_lower_case: + list_normalizers.append(normalizers.Lowercase()) + + precompiled_charsmap = proto.normalizer_spec.precompiled_charsmap + + if precompiled_charsmap: + list_normalizers.append(normalizers.Precompiled(precompiled_charsmap)) + + return normalizers.Sequence(list_normalizers) + + def post_processor(self): + return processors.TemplateProcessing( + single="[CLS]:0 $A:0 [SEP]:0", + pair="[CLS]:0 $A:0 [SEP]:0 $B:1 [SEP]:1", + special_tokens=[ + ("[CLS]", self.original_tokenizer.convert_tokens_to_ids("[CLS]")), + ("[SEP]", self.original_tokenizer.convert_tokens_to_ids("[SEP]")), + ], + ) + + +class BertGenerationConverter(SpmConverter): + pass + + +class PegasusConverter(SpmConverter): + def vocab(self, proto): + vocab = [ + (self.original_tokenizer.pad_token, 0.0), + (self.original_tokenizer.eos_token, 0.0), + ] + + if self.original_tokenizer.mask_token_sent is not None: + vocab += [(self.original_tokenizer.mask_token_sent, 0.0)] + + if ( + self.original_tokenizer.mask_token is not None + and self.original_tokenizer.mask_token_id < self.original_tokenizer.offset + ): + vocab += [(self.original_tokenizer.mask_token, 0.0)] + + vocab += [(f"", -100.0) for i in range(2, self.original_tokenizer.offset)] + vocab += [(piece.piece, piece.score) for piece in proto.pieces[2:]] + return vocab + + def unk_id(self, proto): + return proto.trainer_spec.unk_id + self.original_tokenizer.offset + + def pre_tokenizer(self, replacement, add_prefix_space): + prepend_scheme = _get_prepend_scheme(add_prefix_space, self.original_tokenizer) + return pre_tokenizers.Sequence( + [ + pre_tokenizers.WhitespaceSplit(), + pre_tokenizers.Metaspace(replacement=replacement, prepend_scheme=prepend_scheme), + ] + ) + + def post_processor(self): + eos = self.original_tokenizer.eos_token + special_tokens = [ + (eos, self.original_tokenizer.eos_token_id), + ] + return processors.TemplateProcessing(single=["$A", eos], pair=["$A", "$B", eos], special_tokens=special_tokens) + + +class T5Converter(SpmConverter): + def vocab(self, proto): + num_extra_ids = self.original_tokenizer._extra_ids + vocab = [(piece.piece, piece.score) for piece in proto.pieces] + vocab += [(f"", 0.0) for i in range(num_extra_ids - 1, -1, -1)] + return vocab + + def post_processor(self): + return processors.TemplateProcessing( + single=["$A", ""], + pair=["$A", "", "$B", ""], + special_tokens=[ + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ], + ) + + @classmethod + def convert_from_spm(cls, vocab=None, **kwargs): + extra_ids = kwargs.get("extra_ids", 100) + extra_tokens = [f"" for i in range(extra_ids - 1, -1, -1)] + vocab_list = list(vocab) if vocab is not None else [] + vocab_list.extend((token, 0.0) for token in extra_tokens) + + kwargs.setdefault("additional_special_tokens", extra_tokens) + kwargs["vocab"] = vocab_list + return kwargs + + +class UdopConverter(SpmConverter): + def post_processor(self): + return processors.TemplateProcessing( + single=["$A", ""], + pair=["$A", "", "$B", ""], + special_tokens=[ + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ], + ) + + +class WhisperConverter(Converter): + def converted(self) -> Tokenizer: + vocab = self.original_tokenizer.encoder + merges = list(self.original_tokenizer.bpe_ranks.keys()) + + tokenizer = Tokenizer( + BPE( + vocab=vocab, + merges=merges, + dropout=None, + continuing_subword_prefix="", + end_of_word_suffix="", + fuse_unk=False, + ) + ) + + tokenizer.pre_tokenizer = pre_tokenizers.ByteLevel(add_prefix_space=self.original_tokenizer.add_prefix_space) + tokenizer.decoder = decoders.ByteLevel() + + prefix_token_ids = self.original_tokenizer.prefix_tokens + prefixes = self.original_tokenizer.convert_ids_to_tokens(prefix_token_ids) + eos = self.original_tokenizer.eos_token + eos_token_id = self.original_tokenizer.eos_token_id + prefix_template = " ".join([f"{token}:0" for token in prefixes]) + tokenizer.post_processor = processors.TemplateProcessing( + single=f"{prefix_template} $A:0 {eos}:0", + pair=f"{prefix_template} $A:0 $B:1 {eos}:1", + special_tokens=[ + (eos, eos_token_id), + *zip(prefixes, prefix_token_ids), + ], + ) + + return tokenizer + + +class BigBirdConverter(SpmConverter): + def post_processor(self): + return processors.TemplateProcessing( + single="[CLS]:0 $A:0 [SEP]:0", + pair="[CLS]:0 $A:0 [SEP]:0 $B:1 [SEP]:1", + special_tokens=[ + ("[CLS]", self.original_tokenizer.convert_tokens_to_ids("[CLS]")), + ("[SEP]", self.original_tokenizer.convert_tokens_to_ids("[SEP]")), + ], + ) + + +class CLIPConverter(Converter): + def converted(self) -> Tokenizer: + vocab = self.original_tokenizer.encoder + merges = list(self.original_tokenizer.bpe_ranks.keys()) + unk_token = self.original_tokenizer.unk_token + + tokenizer = Tokenizer( + BPE( + vocab=vocab, + merges=merges, + dropout=None, + continuing_subword_prefix="", + end_of_word_suffix="", + fuse_unk=False, + unk_token=str(unk_token), + ) + ) + + tokenizer.normalizer = normalizers.Sequence( + [normalizers.NFC(), normalizers.Replace(Regex(r"\s+"), " "), normalizers.Lowercase()] + ) + tokenizer.pre_tokenizer = pre_tokenizers.Sequence( + [ + pre_tokenizers.Split( + Regex(r"""'s|'t|'re|'ve|'m|'ll|'d|[\p{L}]+|[\p{N}]|[^\s\p{L}\p{N}]+"""), + behavior="removed", + invert=True, + ), + pre_tokenizers.ByteLevel(add_prefix_space=False), + ] + ) + tokenizer.decoder = decoders.ByteLevel() + + # Hack to have a ByteLevel and TemplateProcessor + tokenizer.post_processor = processors.RobertaProcessing( + sep=(self.original_tokenizer.eos_token, self.original_tokenizer.eos_token_id), + cls=(self.original_tokenizer.bos_token, self.original_tokenizer.bos_token_id), + add_prefix_space=False, + trim_offsets=False, + ) + return tokenizer + + +class LayoutLMv2Converter(Converter): + def converted(self) -> Tokenizer: + vocab = self.original_tokenizer.vocab + tokenizer = Tokenizer(WordPiece(vocab, unk_token=str(self.original_tokenizer.unk_token))) + + tokenize_chinese_chars = False + strip_accents = False + do_lower_case = True + if hasattr(self.original_tokenizer, "basic_tokenizer"): + tokenize_chinese_chars = self.original_tokenizer.basic_tokenizer.tokenize_chinese_chars + strip_accents = self.original_tokenizer.basic_tokenizer.strip_accents + do_lower_case = self.original_tokenizer.basic_tokenizer.do_lower_case + + tokenizer.normalizer = normalizers.BertNormalizer( + clean_text=True, + handle_chinese_chars=tokenize_chinese_chars, + strip_accents=strip_accents, + lowercase=do_lower_case, + ) + tokenizer.pre_tokenizer = pre_tokenizers.BertPreTokenizer() + + cls = str(self.original_tokenizer.cls_token) + sep = str(self.original_tokenizer.sep_token) + cls_token_id = self.original_tokenizer.cls_token_id + sep_token_id = self.original_tokenizer.sep_token_id + + tokenizer.post_processor = processors.TemplateProcessing( + single=f"{cls}:0 $A:0 {sep}:0", + pair=f"{cls}:0 $A:0 {sep}:0 $B:1 {sep}:1", + special_tokens=[ + (cls, cls_token_id), + (sep, sep_token_id), + ], + ) + tokenizer.decoder = decoders.WordPiece(prefix="##") + + return tokenizer + + +class BlenderbotConverter(Converter): + def converted(self) -> Tokenizer: + ot = self.original_tokenizer + vocab = ot.encoder + merges = list(ot.bpe_ranks.keys()) + + tokenizer = Tokenizer( + BPE( + vocab=vocab, + merges=merges, + dropout=None, + continuing_subword_prefix="", + end_of_word_suffix="", + fuse_unk=False, + ) + ) + + tokenizer.pre_tokenizer = pre_tokenizers.ByteLevel(add_prefix_space=ot.add_prefix_space) + tokenizer.decoder = decoders.ByteLevel() + tokenizer.post_processor = processors.TemplateProcessing( + single=f"$A:0 {ot.eos_token}:0", + special_tokens=[ + (ot.eos_token, ot.eos_token_id), + ], + ) + + return tokenizer + + +class XGLMConverter(SpmConverter): + def vocab(self, proto): + vocab = [ + ("", 0.0), + ("", 0.0), + ("", 0.0), + ("", 0.0), + ] + vocab += [(piece.piece, piece.score) for piece in proto.pieces[3:]] + vocab += [("", 0.0), ("", 0.0), ("", 0.0), ("", 0.0), ("", 0.0), ("", 0.0), ("", 0.0)] # fmt: skip + return vocab + + def unk_id(self, proto): + unk_id = 3 + return unk_id + + def post_processor(self): + return processors.TemplateProcessing( + single=" $A", + pair=" $A $B", + special_tokens=[ + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ("", self.original_tokenizer.convert_tokens_to_ids("")), + ], + ) + + +class GemmaConverter(SpmConverter): + handle_byte_fallback = True + SpmExtractor = GemmaSentencePieceExtractor + # start and end of turn tokens must be marked as special + special_tokens = {"", ""} + + """" + split_by_unicode_script: true + split_by_number: true + split_by_whitespace: true + treat_whitespace_as_suffix: false + allow_whitespace_only_pieces: true + split_digits: true + byte_fallback: true + """ + + def normalizer(self, proto): + return normalizers.Replace(" ", "▁") + + def vocab(self, proto): + vocab = [ + (self.original_tokenizer.pad_token, 0.0), + (self.original_tokenizer.eos_token, 0.0), + (self.original_tokenizer.bos_token, 0.0), + ] + vocab += [(piece.piece, piece.score) for piece in proto.pieces[3:]] + + # Older gemma tokenizers had a missing tab token, so we fix that here + if not any(x[0] == "\t" for x in vocab): + override_index = next((i for i, x in enumerate(vocab) if x[0] == "<0x09>"), None) + if override_index is not None: + vocab[override_index] = ("\t", 0.0) + + return vocab + + def pre_tokenizer(self, replacement, add_prefix_space): + return pre_tokenizers.Split(" ", "merged_with_previous") + + def unk_id(self, proto): + unk_id = 3 + return unk_id + + def decoder(self, replacement, add_prefix_space): + return decoders.Sequence( + [ + decoders.Replace("▁", " "), + decoders.ByteFallback(), + decoders.Fuse(), + ] + ) + + +class LlamaConverter(SpmConverter): + handle_byte_fallback = True + + def vocab(self, proto): + vocab = [ + (self.original_tokenizer.convert_ids_to_tokens(0), 0.0), + (self.original_tokenizer.convert_ids_to_tokens(1), 0.0), + (self.original_tokenizer.convert_ids_to_tokens(2), 0.0), + ] + vocab += [(piece.piece, piece.score) for piece in proto.pieces[3:]] + return vocab + + def unk_id(self, proto): + unk_id = 0 + return unk_id + + def decoder(self, replacement, add_prefix_space): + sequence = [ + decoders.Replace("▁", " "), + decoders.ByteFallback(), + decoders.Fuse(), + ] + if add_prefix_space: + sequence += [decoders.Strip(content=" ", left=1)] + return decoders.Sequence(sequence) + + def normalizer(self, proto): + if getattr(self.original_tokenizer, "legacy", True): + sequence = [] + if getattr(self.original_tokenizer, "add_prefix_space", True): + sequence += [normalizers.Prepend(prepend="▁")] + sequence += [normalizers.Replace(pattern=" ", content="▁")] + return normalizers.Sequence(sequence) + return None # non-legacy, no normalizer + + def pre_tokenizer(self, replacement, add_prefix_space): + if not getattr(self.original_tokenizer, "legacy", True): # non-legacy, we need a replace + prepend_scheme = _get_prepend_scheme(add_prefix_space, self.original_tokenizer) + return pre_tokenizers.Metaspace(replacement=replacement, prepend_scheme=prepend_scheme, split=False) + return None + + def post_processor(self): + # the processor is defined in the LlamaTokenizerFast class. + return None + + +class MarkupLMConverter(Converter): + def converted(self) -> Tokenizer: + ot = self.original_tokenizer + vocab = ot.encoder + merges = list(ot.bpe_ranks.keys()) + + tokenizer = Tokenizer( + BPE( + vocab=vocab, + merges=merges, + dropout=None, + continuing_subword_prefix="", + end_of_word_suffix="", + fuse_unk=False, + unk_token=self.original_tokenizer.unk_token, + ) + ) + + tokenizer.pre_tokenizer = pre_tokenizers.ByteLevel(add_prefix_space=ot.add_prefix_space) + tokenizer.decoder = decoders.ByteLevel() + + cls = str(self.original_tokenizer.cls_token) + sep = str(self.original_tokenizer.sep_token) + cls_token_id = self.original_tokenizer.cls_token_id + sep_token_id = self.original_tokenizer.sep_token_id + + tokenizer.post_processor = processors.TemplateProcessing( + single=f"{cls} $A {sep}", + pair=f"{cls} $A {sep} $B {sep}", + special_tokens=[ + (cls, cls_token_id), + (sep, sep_token_id), + ], + ) + + return tokenizer + + +class MoshiConverter(SpmConverter): + handle_byte_fallback = True + + def __init__(self, vocab_file, **kwargs): + requires_backends(self, "protobuf") + + Converter.__init__(self, vocab_file) + + # from .utils import sentencepiece_model_pb2 as model_pb2 + model_pb2 = import_protobuf() + + m = model_pb2.ModelProto() + with open(vocab_file, "rb") as f: + m.ParseFromString(f.read()) + self.proto = m + + def normalizer(self, proto): + precompiled_charsmap = proto.normalizer_spec.precompiled_charsmap + _normalizers = [ + normalizers.Replace(" ", "▁"), + ] + if not precompiled_charsmap: + return normalizers.Sequence(_normalizers) + else: + return normalizers.Sequence([normalizers.Precompiled(precompiled_charsmap)] + _normalizers) + + def decoder(self, replacement, add_prefix_space): + sequence = [ + decoders.Replace("▁", " "), + decoders.ByteFallback(), + decoders.Fuse(), + ] + if add_prefix_space: + sequence += [decoders.Strip(content=" ", left=1)] + return decoders.Sequence(sequence) + + def pre_tokenizer(self, replacement, add_prefix_space): + prepend_scheme = "first" + return pre_tokenizers.Metaspace(replacement=replacement, prepend_scheme=prepend_scheme, split=False) + + +class HeliumConverter(SpmConverter): + handle_byte_fallback = True + + def __init__(self, vocab_file=None, **kwargs): + requires_backends(self, "protobuf") + + Converter.__init__(self, vocab_file) + + model_pb2 = import_protobuf() + + m = model_pb2.ModelProto() + with open(vocab_file, "rb") as f: + m.ParseFromString(f.read()) + self.proto = m + + def tokenizer(self, proto): + vocab_scores = self.vocab(proto) + tokenizer = Tokenizer( + Unigram( + vocab_scores, + unk_id=self.unk_id(proto), + byte_fallback=self.handle_byte_fallback, + ) + ) + # control tokens are special + # user defined symbols are not + # both user and control tokens are AddedTokens + # Add user defined symbols (type == 4) from sentencepiece (https://github.com/google/sentencepiece/blob/6225e08edb2577757163b3f5dbba4c0b670ef445/src/sentencepiece_model.proto#L299C29-L299C33) + spm_added_tokens = [ + (id, p.piece, p.type == 3 or p.piece in self.special_tokens) + for id, p in enumerate(proto.pieces) + if p.type in [3, 4] + ] + tokenizer.add_tokens( + [ + AddedToken(token, normalized=False, special=special, single_word=True) + for id, token, special in sorted(spm_added_tokens, key=lambda x: x[0]) + ] + ) + tokenizer.add_tokens([AddedToken("\n", normalized=False, special=False)]) + tokenizer.enable_padding(pad_token="", pad_id=3) + return tokenizer + + def vocab(self, proto): + vocab = [] + for piece in proto.pieces: + if piece.piece == "<0x0A>": + vocab += [("\n", piece.score)] + else: + vocab += [(piece.piece, piece.score)] + return vocab + + def unk_id(self, proto): + unk_id = 0 + return unk_id + + def decoder(self, replacement, add_prefix_space): + sequence = [ + decoders.Replace("▁", " "), + decoders.ByteFallback(), + decoders.Fuse(), + ] + sequence += [decoders.Strip(content=" ", left=1)] + return decoders.Sequence(sequence) + + def normalizer(self, proto): + return normalizers.Sequence([normalizers.Prepend(" "), normalizers.Replace(r" ", "▁")]) + + def pre_tokenizer(self, replacement, add_prefix_space): + return pre_tokenizers.Sequence([pre_tokenizers.Split("\n", "contiguous")]) + + def post_processor(self): + return processors.TemplateProcessing( + single=[ + "", + "$A", + ], + pair=[ + "", + "$A", + "", + "$B", + ], + special_tokens=[ + ("", 1), + ], + ) + + +class ParakeetConverter(SpmConverter): + handle_byte_fallback = True + + def __init__(self, vocab_file=None, *args): + self.vocab_file = vocab_file + + requires_backends(self, "protobuf") + + Converter.__init__(self, vocab_file) + + model_pb2 = import_protobuf() + m = model_pb2.ModelProto() + with open(vocab_file, "rb") as f: + m.ParseFromString(f.read()) + self.proto = m + + def tokenizer(self, proto): + vocab_scores = self.vocab(proto) + + _, merges = self.SpmExtractor(self.vocab_file).extract(vocab_scores) + bpe_vocab = {word: i for i, (word, score) in enumerate(vocab_scores)} + tokenizer = Tokenizer( + BPE( + bpe_vocab, + merges, + unk_token=proto.trainer_spec.unk_piece, + fuse_unk=True, + byte_fallback=self.handle_byte_fallback, + dropout=None, + ) + ) + + # Add user defined symbols and control tokens from sentencepiece model + spm_added_tokens = [ + (id, p.piece, p.type == 3 or p.piece in self.special_tokens) + for id, p in enumerate(proto.pieces) + if p.type in [3, 4] + ] + tokenizer.add_tokens( + [ + AddedToken(token, normalized=False, special=special) + for id, token, special in sorted(spm_added_tokens, key=lambda x: x[0]) + ] + ) + + return tokenizer + + +def bytes_to_unicode(): + """ + Returns list of utf-8 byte and a mapping to unicode strings. We specifically avoids mapping to whitespace/control + characters the bpe code barfs on. + + The reversible bpe codes work on unicode strings. This means you need a large # of unicode characters in your vocab + if you want to avoid UNKs. When you're at something like a 10B token dataset you end up needing around 5K for + decent coverage. This is a significant percentage of your normal, say, 32K bpe vocab. To avoid that, we want lookup + tables between utf-8 bytes and unicode strings. + """ + bs = ( + list(range(ord("!"), ord("~") + 1)) + list(range(ord("¡"), ord("¬") + 1)) + list(range(ord("®"), ord("ÿ") + 1)) + ) + cs = bs[:] + n = 0 + for b in range(2**8): + if b not in bs: + bs.append(b) + cs.append(2**8 + n) + n += 1 + cs = [chr(n) for n in cs] + return dict(zip(bs, cs)) + + +class TikTokenConverter: + """ + A general tiktoken converter. + """ + + def __init__( + self, + vocab_file=None, + pattern=r"""(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+""", + add_prefix_space=False, + extra_special_tokens=None, + **kwargs, + ): + self.vocab_file = vocab_file + self.pattern = pattern + self.add_prefix_space = add_prefix_space + self.extra_special_tokens = ( + extra_special_tokens.keys() if isinstance(extra_special_tokens, dict) else extra_special_tokens + ) + + def extract_vocab_merges_from_model(self, tiktoken_url: str): + try: + from tiktoken.load import load_tiktoken_bpe + except Exception: + raise ValueError( + "`tiktoken` is required to read a `tiktoken` file. Install it with `pip install tiktoken`." + ) + + bpe_ranks = load_tiktoken_bpe(tiktoken_url) + byte_encoder = bytes_to_unicode() + + def token_bytes_to_string(b): + return "".join([byte_encoder[ord(char)] for char in b.decode("latin-1")]) + + merges = [] + vocab = {} + for token, rank in bpe_ranks.items(): + vocab[token_bytes_to_string(token)] = rank + if len(token) == 1: + continue + local = [] + for index in range(1, len(token)): + piece_l, piece_r = token[:index], token[index:] + if piece_l in bpe_ranks and piece_r in bpe_ranks and (piece_l + piece_r) in bpe_ranks: + local.append((piece_l, piece_r, rank)) + local = sorted(local, key=lambda x: (bpe_ranks[x[0]], bpe_ranks[x[1]]), reverse=False) + merges.extend(local) + merges = sorted(merges, key=lambda val: val[2], reverse=False) + merges = [(token_bytes_to_string(val[0]), token_bytes_to_string(val[1])) for val in merges] + return vocab, merges + + def tokenizer(self): + vocab_scores, merges = self.extract_vocab_merges_from_model(self.vocab_file) + tokenizer = Tokenizer(BPE(vocab_scores, merges, fuse_unk=False)) + if hasattr(tokenizer.model, "ignore_merges"): + tokenizer.model.ignore_merges = True + return tokenizer + + def converted(self) -> Tokenizer: + tokenizer = self.tokenizer() + tokenizer.pre_tokenizer = pre_tokenizers.Sequence( + [ + pre_tokenizers.Split(Regex(self.pattern), behavior="isolated", invert=False), + pre_tokenizers.ByteLevel(add_prefix_space=self.add_prefix_space, use_regex=False), + ] + ) + tokenizer.decoder = decoders.ByteLevel() + + if self.extra_special_tokens is not None: + tokenizer.add_special_tokens( + [AddedToken(token, normalized=False, special=True) for token in self.extra_special_tokens] + ) + + tokenizer.post_processor = processors.ByteLevel(trim_offsets=False) + + return tokenizer + + +class MistralConverter: + def __init__( + self, + vocab_file=None, + pattern=r"""(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+""", + add_prefix_space=False, + additional_special_tokens=None, + **kwargs, + ): + self.vocab_file = vocab_file + self.pattern = pattern + self.add_prefix_space = add_prefix_space + self.additional_special_tokens = ( + additional_special_tokens.keys() + if isinstance(additional_special_tokens, dict) + else additional_special_tokens + ) + + def extract_vocab_merges_from_model(self, tiktoken_url: str): + import base64 + import json + + with open(self.vocab_file, "r", encoding="utf-8") as f: + untyped = json.load(f) + self.pattern = untyped["config"]["pattern"] + self.additional_special_tokens = [ + AddedToken(k["token_str"], special=k["is_control"]) for k in untyped["special_tokens"] + ] + bpe_ranks = untyped["vocab"] + byte_encoder = bytes_to_unicode() + + @lru_cache + def token_bytes_to_string(b): + return "".join([byte_encoder[ord(char)] for char in b.decode("latin-1")]) + + merges = [] + vocab = {} + for idx, token in enumerate(self.additional_special_tokens): + vocab[token.content] = idx + bpe_ranks = [base64.b64decode(k["token_bytes"]) for k in bpe_ranks] + rank_set = set(bpe_ranks) + token_to_rank = {token: rank for rank, token in enumerate(bpe_ranks)} + for rank, token in enumerate(tqdm(bpe_ranks, desc="Converting tekken.json to tokenizer.json")): + vocab[token_bytes_to_string(token)] = rank + if len(token) == 1: + continue + local = [] + for index in range(1, len(token)): + piece_l, piece_r = token[:index], token[index:] + if piece_l in rank_set and piece_r in rank_set and (piece_l + piece_r) in rank_set: + local.append((piece_l, piece_r, rank)) + local = sorted(local, key=lambda x: (token_to_rank[x[0]], token_to_rank[x[1]]), reverse=False) + merges.extend(local) + merges = sorted(merges, key=lambda val: val[2], reverse=False) + merges = [(token_bytes_to_string(val[0]), token_bytes_to_string(val[1])) for val in merges] + return vocab, merges + + def tokenizer(self): + vocab_scores, merges = self.extract_vocab_merges_from_model(self.vocab_file) + tokenizer = Tokenizer(BPE(vocab_scores, merges, fuse_unk=False)) + if hasattr(tokenizer.model, "ignore_merges"): + tokenizer.model.ignore_merges = True + return tokenizer + + def converted(self) -> Tokenizer: + tokenizer = self.tokenizer() + tokenizer.pre_tokenizer = pre_tokenizers.Sequence( + [ + pre_tokenizers.Split(Regex(self.pattern), behavior="isolated", invert=False), + pre_tokenizers.ByteLevel(add_prefix_space=self.add_prefix_space, use_regex=False), + ] + ) + tokenizer.decoder = decoders.ByteLevel() + + tokenizer.add_tokens(self.additional_special_tokens) + tokenizer.post_processor = processors.ByteLevel(trim_offsets=False) + + return tokenizer + + +SLOW_TO_FAST_CONVERTERS = { + "AlbertTokenizer": AlbertConverter, + "BartTokenizer": RobertaConverter, + "BarthezTokenizer": BarthezConverter, + "BertTokenizer": BertConverter, + "BigBirdTokenizer": BigBirdConverter, + "BlenderbotTokenizer": BlenderbotConverter, + "CamembertTokenizer": CamembertConverter, + "CLIPTokenizer": CLIPConverter, + "CodeGenTokenizer": GPT2Converter, + "ConvBertTokenizer": BertConverter, + "DebertaTokenizer": DebertaConverter, + "DebertaV2Tokenizer": DebertaV2Converter, + "DistilBertTokenizer": BertConverter, + "DPRReaderTokenizer": BertConverter, + "DPRQuestionEncoderTokenizer": BertConverter, + "DPRContextEncoderTokenizer": BertConverter, + "ElectraTokenizer": BertConverter, + "FNetTokenizer": AlbertConverter, + "FunnelTokenizer": FunnelConverter, + "GPT2Tokenizer": GPT2Converter, + "HerbertTokenizer": HerbertConverter, + "LayoutLMTokenizer": BertConverter, + "LayoutLMv2Tokenizer": BertConverter, + "LayoutLMv3Tokenizer": RobertaConverter, + "LayoutXLMTokenizer": XLMRobertaConverter, + "LongformerTokenizer": RobertaConverter, + "LEDTokenizer": RobertaConverter, + "LxmertTokenizer": BertConverter, + "MarkupLMTokenizer": MarkupLMConverter, + "MBartTokenizer": MBartConverter, + "MBart50Tokenizer": MBart50Converter, + "MPNetTokenizer": MPNetConverter, + "MobileBertTokenizer": BertConverter, + "MvpTokenizer": RobertaConverter, + "NllbTokenizer": NllbConverter, + "OpenAIGPTTokenizer": OpenAIGPTConverter, + "PegasusTokenizer": PegasusConverter, + "Qwen2Tokenizer": Qwen2Converter, + "ReformerTokenizer": ReformerConverter, + "RemBertTokenizer": RemBertConverter, + "RobertaTokenizer": RobertaConverter, + "RoFormerTokenizer": RoFormerConverter, + "SeamlessM4TTokenizer": SeamlessM4TConverter, + "SqueezeBertTokenizer": BertConverter, + "T5Tokenizer": T5Converter, + "UdopTokenizer": UdopConverter, + "WhisperTokenizer": WhisperConverter, + "XLMRobertaTokenizer": XLMRobertaConverter, + "XLNetTokenizer": XLNetConverter, + "SplinterTokenizer": SplinterConverter, + "XGLMTokenizer": XGLMConverter, + "LlamaTokenizer": LlamaConverter, + "CodeLlamaTokenizer": LlamaConverter, + "GemmaTokenizer": GemmaConverter, + "Phi3Tokenizer": LlamaConverter, +} + + +def convert_slow_tokenizer(transformer_tokenizer, from_tiktoken=False) -> Tokenizer: + """ + Utilities to convert a slow tokenizer instance in a fast tokenizer instance. + + Args: + transformer_tokenizer ([`~tokenization_utils_base.PreTrainedTokenizer`]): + Instance of a slow tokenizer to convert in the backend tokenizer for + [`~tokenization_utils_base.PreTrainedTokenizerFast`]. + from_tiktoken (bool, optional): Whether to use the `tiktoken` library to convert the tokenizer instead of sentencepiece. + Defaults to False. + + Return: + A instance of [`~tokenizers.Tokenizer`] to be used as the backend tokenizer of a + [`~tokenization_utils_base.PreTrainedTokenizerFast`] + """ + + tokenizer_class_name = transformer_tokenizer.__class__.__name__ + if tokenizer_class_name in SLOW_TO_FAST_CONVERTERS and not from_tiktoken: + converter_class = SLOW_TO_FAST_CONVERTERS[tokenizer_class_name] + return converter_class(transformer_tokenizer).converted() + elif transformer_tokenizer.vocab_file.endswith("tekken.json"): + transformer_tokenizer.original_tokenizer = transformer_tokenizer + logger.info("Converting from Mistral tekken.json") + return MistralConverter(transformer_tokenizer.vocab_file).converted() + else: + try: + logger.info("Converting from Tiktoken") + return TikTokenConverter( + vocab_file=transformer_tokenizer.vocab_file, + extra_special_tokens=transformer_tokenizer.extra_special_tokens, + ).converted() + except Exception: + raise ValueError( + f"Converting from SentencePiece and Tiktoken failed, if a converter for SentencePiece is available, provide a model path " + f"with a SentencePiece tokenizer.model file." + f"Currently available slow->fast converters: {list(SLOW_TO_FAST_CONVERTERS.keys())}" + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/convert_slow_tokenizers_checkpoints_to_fast.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/convert_slow_tokenizers_checkpoints_to_fast.py new file mode 100644 index 0000000000000000000000000000000000000000..46886e6fc0396cff06719e2613358df984a9f565 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/convert_slow_tokenizers_checkpoints_to_fast.py @@ -0,0 +1,149 @@ +# Copyright 2018 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Convert slow tokenizers checkpoints in fast (serialization format of the `tokenizers` library)""" + +import argparse +import os +from pathlib import Path + +import transformers + +from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS +from .utils import logging + + +logging.set_verbosity_info() + +logger = logging.get_logger(__name__) + + +TOKENIZER_CLASSES = {} +for name in SLOW_TO_FAST_CONVERTERS: + # Special cases for tokenizers that don't have their own Fast tokenizer + if name == "Phi3Tokenizer": + tokenizer_class_name = "LlamaTokenizerFast" + elif name == "ElectraTokenizer": + tokenizer_class_name = "BertTokenizerFast" + else: + tokenizer_class_name = name + "Fast" + + try: + TOKENIZER_CLASSES[name] = getattr(transformers, tokenizer_class_name) + except AttributeError: + # Skip tokenizers that don't have a Fast version + pass + + +def convert_slow_checkpoint_to_fast(tokenizer_name, checkpoint_name, dump_path, force_download): + if tokenizer_name is not None and tokenizer_name not in TOKENIZER_CLASSES: + raise ValueError(f"Unrecognized tokenizer name, should be one of {list(TOKENIZER_CLASSES.keys())}.") + + if tokenizer_name is None: + tokenizer_names = TOKENIZER_CLASSES + else: + tokenizer_names = {tokenizer_name: getattr(transformers, tokenizer_name + "Fast")} + + logger.info(f"Loading tokenizer classes: {tokenizer_names}") + + for tokenizer_name in tokenizer_names: + tokenizer_class = TOKENIZER_CLASSES[tokenizer_name] + + add_prefix = True + if checkpoint_name is None: + checkpoint_names = list(tokenizer_class.max_model_input_sizes.keys()) + else: + checkpoint_names = [checkpoint_name] + + logger.info(f"For tokenizer {tokenizer_class.__class__.__name__} loading checkpoints: {checkpoint_names}") + + for checkpoint in checkpoint_names: + logger.info(f"Loading {tokenizer_class.__class__.__name__} {checkpoint}") + + # Load tokenizer + tokenizer = tokenizer_class.from_pretrained(checkpoint, force_download=force_download) + + # Save fast tokenizer + logger.info(f"Save fast tokenizer to {dump_path} with prefix {checkpoint} add_prefix {add_prefix}") + + # For organization names we create sub-directories + if "/" in checkpoint: + checkpoint_directory, checkpoint_prefix_name = checkpoint.split("/") + dump_path_full = os.path.join(dump_path, checkpoint_directory) + + # Security check + try: + Path(dump_path_full).resolve().relative_to(Path(dump_path).resolve()) + except ValueError: + raise ValueError( + f"Invalid checkpoint path: '{checkpoint}' attempts to escape `dump_path`: {dump_path}" + ) + + elif add_prefix: + checkpoint_prefix_name = checkpoint + dump_path_full = dump_path + else: + checkpoint_prefix_name = None + dump_path_full = dump_path + + logger.info(f"=> {dump_path_full} with prefix {checkpoint_prefix_name}, add_prefix {add_prefix}") + + if checkpoint in list(tokenizer.pretrained_vocab_files_map.values())[0]: + file_path = list(tokenizer.pretrained_vocab_files_map.values())[0][checkpoint] + next_char = file_path.split(checkpoint)[-1][0] + if next_char == "/": + dump_path_full = os.path.join(dump_path_full, checkpoint_prefix_name) + checkpoint_prefix_name = None + + logger.info(f"=> {dump_path_full} with prefix {checkpoint_prefix_name}, add_prefix {add_prefix}") + + file_names = tokenizer.save_pretrained( + dump_path_full, legacy_format=False, filename_prefix=checkpoint_prefix_name + ) + logger.info(f"=> File names {file_names}") + + for file_name in file_names: + if not file_name.endswith("tokenizer.json"): + os.remove(file_name) + logger.info(f"=> removing {file_name}") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + # Required parameters + parser.add_argument( + "--dump_path", default=None, type=str, required=True, help="Path to output generated fast tokenizer files." + ) + parser.add_argument( + "--tokenizer_name", + default=None, + type=str, + help=( + f"Optional tokenizer type selected in the list of {list(TOKENIZER_CLASSES.keys())}. If not given, will " + "download and convert all the checkpoints from AWS." + ), + ) + parser.add_argument( + "--checkpoint_name", + default=None, + type=str, + help="Optional checkpoint name. If not given, will download and convert the canonical checkpoints from AWS.", + ) + parser.add_argument( + "--force_download", + action="store_true", + help="Re-download checkpoints.", + ) + args = parser.parse_args() + + convert_slow_checkpoint_to_fast(args.tokenizer_name, args.checkpoint_name, args.dump_path, args.force_download) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/core_model_loading.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/core_model_loading.py new file mode 100644 index 0000000000000000000000000000000000000000..a428a472ad857f2d8ade81615cb63319bc201e5f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/core_model_loading.py @@ -0,0 +1,1300 @@ +# Copyright 2025 The HuggingFace Inc. team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Core helpers for loading model checkpoints.""" + +from __future__ import annotations + +import math +import os +import re +import traceback +from abc import abstractmethod +from collections import defaultdict +from collections.abc import Callable +from concurrent.futures import Future, ThreadPoolExecutor +from contextlib import contextmanager +from copy import deepcopy +from dataclasses import dataclass, field +from itertools import chain +from typing import TYPE_CHECKING, Any + +import torch + +from .integrations.accelerate import get_device, offload_weight +from .integrations.tensor_parallel import ALL_PARALLEL_STYLES +from .utils import is_env_variable_true, logging +from .utils.loading_report import LoadStateDictInfo + + +_torch_distributed_available = torch.distributed.is_available() + +if TYPE_CHECKING: + from .integrations.tensor_parallel import TensorParallelLayer + from .modeling_utils import LoadStateDictConfig, PreTrainedModel + from .quantizers import HfQuantizer + + +logger = logging.get_logger(__name__) + + +def build_glob_alternation( + globs: list[WeightRenaming | WeightConverter | str], +) -> tuple[re.Pattern, dict[str, str], dict[str, str]]: + """ + Build a single alternation regex with one named group per glob. + """ + src_group_to_glob: dict[str, str] = {} + tgt_group_to_glob: dict[str, str] = {} + branches: list[str] = [] + i = 0 + for glob in globs: + if isinstance(glob, (WeightRenaming, WeightConverter)): + for src in glob.source_patterns: + group_name = f"g{i}" + src_group_to_glob[group_name] = src + i += 1 + body = src.replace("*", r".*") + branches.append(f"(?P<{group_name}>{body})") + tgt_group_to_glob[group_name] = glob.target_patterns[0] # we index with the first target + else: + group_name = f"g{i}" + src_group_to_glob[group_name] = glob + i += 1 + body = glob + body = body.replace("*", r".*") + branches.append(f"(?P<{group_name}>{body})") + tgt_group_to_glob[group_name] = glob + + alternation = re.compile("|".join(branches)) + return alternation, src_group_to_glob, tgt_group_to_glob + + +class ConversionOps: + """Base class for weight conversion operations.""" + + def __repr__(self): + if hasattr(self, "dim"): + return f"{self.__class__.__name__}(dim={self.dim})" + else: + return f"{self.__class__.__name__}" + + @abstractmethod + def convert( + self, input_dict: dict[str, Any], source_patterns: list[str], target_patterns: list[str], **kwargs + ) -> dict[str, list[torch.Tensor]]: + raise NotImplementedError + + @property + def reverse_op(self) -> ConversionOps: + raise NotImplementedError + + +class Chunk(ConversionOps): + """Split a tensor along ``dim`` into equally sized chunks.""" + + def __init__(self, dim: int = 0): + self.dim = dim + + @torch.no_grad + def convert( + self, input_dict: dict[str, torch.Tensor], source_patterns: list[str], target_patterns: list[str], **kwargs + ) -> dict[str, torch.Tensor]: + tensors = next(iter(input_dict.values())) + tensor = tensors[0] if isinstance(tensors, list) else tensors + targets = self.get_target_patterns(input_dict, target_patterns) + sizes = len(targets) + chunks = torch.chunk(tensor, sizes, dim=self.dim) + return dict(zip(targets, chunks)) + + def get_target_patterns(self, input_dict: dict, target_patterns: list[str]) -> list[str]: + # Here we always return the target patterns + if len(input_dict) > 1 or len(target_patterns) == 1: + raise ValueError("Undefined Operation encountered!") + return target_patterns + + @property + def reverse_op(self) -> ConversionOps: + return Concatenate(self.dim) + + +class Concatenate(ConversionOps): + """Concatenate tensors along `dim`.""" + + def __init__(self, dim: int = 0): + self.dim = dim + + @torch.no_grad + def convert( + self, + input_dict: dict[str, list[torch.Tensor]], + source_patterns: list[str], + target_patterns: list[str], + **kwargs, + ) -> dict[str, torch.Tensor]: + target_pattern = self.get_target_pattern(target_patterns) + all_tensors = [] + # Very important to keep the relative order of the source patterns here, so we iterate over them not the + # input directly as it's unordered! + for source_pattern in source_patterns: + tensors = input_dict[source_pattern] + if isinstance(tensors, list): + all_tensors.extend(tensors) + else: + all_tensors.append(tensors) + return {target_pattern: torch.cat(all_tensors, dim=self.dim)} + + def get_target_pattern(self, target_patterns: list[str]) -> str: + # Here we always return the target pattern + if len(target_patterns) > 1: + raise ValueError("Undefined Operation encountered!") + return target_patterns[0] + + @property + def reverse_op(self) -> ConversionOps: + return Chunk(self.dim) + + +class MergeModulelist(ConversionOps): + """ + Merge a list of tensors into a single tensor along the first dimension. + We explicitly define this because for EP or TP you want to make sure you know what you are doing! + + """ + + def __init__(self, dim: int = 0): + self.dim = dim + + @torch.no_grad + def convert( + self, + input_dict: dict[str, list[torch.Tensor]], + source_patterns: list[str], + target_patterns: list[str], + **kwargs, + ) -> dict[str, torch.Tensor]: + merged: dict[str, torch.Tensor] = {} + for source_pattern, tensors in input_dict.items(): + target_pattern = self.get_target_pattern(input_dict, source_pattern, target_patterns) + merged[target_pattern] = torch.stack(tensors, dim=self.dim) + return merged + + def get_target_pattern(self, input_dict: dict, source_pattern: str, target_patterns: list[str]) -> str: + # Here it's a single operation, so we use the target + if len(input_dict) == 1: + if len(target_patterns) == 1: + return target_patterns[0] + else: + raise ValueError("Undefined Operation encountered!") + # Here it's the first operation in a chain, so we use the source as they were replaced before in the chain + else: + return source_pattern + + @property + def reverse_op(self) -> ConversionOps: + return SplitModulelist(self.dim) + + +class SplitModulelist(ConversionOps): + """Inverse of :class:`MergeModulelist` using explicit split sizes per group.""" + + def __init__(self, dim: int = 0): + self.dim = dim + + @torch.no_grad + def convert( + self, input_dict: dict[str, torch.Tensor], source_patterns: list[str], target_patterns: list[str], **kwargs + ) -> dict[str, torch.Tensor]: + all_tensors = {} + for source_pattern, tensors in input_dict.items(): + tensor = tensors[0] if isinstance(tensors, list) else tensors + # We split in the number of tensors present in the given dim + sizes = tensor.size(self.dim) + targets = self.get_target_patterns(input_dict, source_pattern, target_patterns, sizes) + chunks = torch.chunk(tensor, sizes, dim=self.dim) + # We squeeze each chunk here as well to make sure to give them their original shape + all_tensors.update({target: chunk.squeeze() for target, chunk in zip(targets, chunks)}) + return all_tensors + + def get_target_patterns( + self, input_dict: dict, source_pattern: str, target_patterns: list[str], sizes: int + ) -> list[str]: + # Here it's a single operation, so we use the target + if len(input_dict) == 1: + if len(target_patterns) == 1: + return [target_patterns[0].replace("*", f"{i}") for i in range(sizes)] + else: + raise ValueError("Undefined Operation encountered!") + # Here it's the last operation in a chain, so we use the source as they were replaced before in the chain + else: + return [source_pattern.replace("*", f"{i}") for i in range(sizes)] + + @property + def reverse_op(self) -> ConversionOps: + return MergeModulelist(self.dim) + + +class Transpose(ConversionOps): + """ + Transposes the given tensor along dim0 and dim1. + """ + + def __init__(self, dim0: int = 0, dim1: int = 1, check_dims: bool = False): + self.dim0 = dim0 + self.dim1 = dim1 + self.check_dims = check_dims + + @torch.no_grad + def convert( + self, input_dict: dict[str, torch.Tensor], source_patterns: list[str], target_patterns: list[str], **kwargs + ) -> dict[str, torch.Tensor]: + target_pattern = self.get_target_pattern(input_dict, source_patterns, target_patterns) + tensors = next(iter(input_dict.values())) + tensor = tensors[0] if isinstance(tensors, list) else tensors + # In this case, always transpose + if not self.check_dims: + return {target_pattern: torch.transpose(tensor, dim0=self.dim0, dim1=self.dim1).contiguous()} + # In this case, check the shapes before transposing + else: + # NOTE: this rely on the first param name, so cannot be used for many-to-one operation + expected_shape = kwargs["model"].get_parameter(kwargs["full_layer_name"]).shape + # The shapes are the same: do NOT transpose + if tensor.shape == expected_shape: + return {target_pattern: tensor} + else: + return {target_pattern: torch.transpose(tensor, dim0=self.dim0, dim1=self.dim1).contiguous()} + + def get_target_pattern( + self, input_dict: dict[str, torch.Tensor], source_patterns: list[str], target_patterns: list[str] + ) -> str: + if len(input_dict) != 1: + raise ValueError("Undefined Operation encountered!") + # Here it's the first operation of a chain, so return the source + if len(target_patterns) > 1: + if len(source_patterns) == 1: + return source_patterns[0] + else: + raise ValueError("Undefined Operation encountered!") + # Here it's the only operation, or the last operation in a chain, so we return the target + else: + return target_patterns[0] + + @property + def reverse_op(self) -> ConversionOps: + return Transpose(dim0=self.dim1, dim1=self.dim0, check_dims=self.check_dims) + + +class PermuteForRope(ConversionOps): + """ + Applies the permutation required to convert complex RoPE weights to the split sin/cos format. + """ + + def __init__(self): + pass + + def _apply(self, tensor: torch.Tensor) -> torch.Tensor: + dim1, dim2 = tensor.shape + n_heads = self.config.getattr("num_attention_heads", 1) + + tensor = tensor.view(n_heads, dim1 // n_heads // 2, 2, dim2) + tensor = tensor.transpose(1, 2).reshape(dim1, dim2) + return tensor + + @torch.no_grad + def convert( + self, + input_dict: dict[str, list[torch.Tensor]], + source_patterns: list[str], + target_patterns: list[str], + config, + **kwargs, + ) -> dict[str, list[torch.Tensor]]: + self.config = config + output: dict[str, list[torch.Tensor]] = {} + for key, tensors in input_dict.items(): + if len(tensors) != 1: + raise ValueError("PermuteForRope expects a single tensor per key.") + output[key] = [self._apply(tensors[0])] + return output + + +class ErnieFuseAndSplitTextVisionExperts(ConversionOps): + r""" + Special operation that splits a module list over all keys and fuses over the number of original modules. + + Example with 2 original modules "Gate" and "Up" with 2 target keys "Text" and "Vision": + + ModuleList 1 ModuleList 2 + [ Gate ] [ Up ] + | | | | + [Gate_Text] [Gate_Vision] [Up_Text] [Up_Vision] + \ \ / / + \ \ / / + \ / \ / + \ / \ / + [GateUp_Text] [GateUp_Vision] + + The splits are equal and are defined by the amount of target keys. + The final fusions are defined by the amount of original module lists. + """ + + def __init__(self, stack_dim: int = 0, concat_dim: int = 1): + self.stack_dim = stack_dim + self.concat_dim = concat_dim + + def split_list_into_chunks(self, tensor_list: list[torch.Tensor], chunks: int = 2): + split_size = math.ceil(len(tensor_list) / chunks) # best effort split size + return [tensor_list[i * split_size : (i + 1) * split_size] for i in range(chunks)] + + @torch.no_grad() + def convert( + self, + input_dict: dict[str, list[torch.Tensor]], + source_patterns: list[str], + target_patterns: list[str], + config, + **kwargs, + ) -> dict[str, list[torch.Tensor]]: + valid_keys = input_dict.keys() + split_and_fused = defaultdict(list) + for key in source_patterns: + if key not in valid_keys: + raise ValueError( + f"Expected pattern {key} in collected tensors but only found tensors for: {valid_keys}" + ) + + tensors = input_dict.get(key, []) + split_tensor_lists = self.split_list_into_chunks(tensors, chunks=len(target_patterns)) + stacked_tensors = (torch.stack(tensor_group, dim=self.stack_dim) for tensor_group in split_tensor_lists) + for idx, tensor_group in enumerate(stacked_tensors): + split_and_fused[target_patterns[idx]].append(tensor_group) + + for k, v in split_and_fused.items(): + split_and_fused[k] = torch.cat(v, dim=self.concat_dim) + + return split_and_fused + + @property + def reverse_op(self) -> ConversionOps: + return ErnieSplitAndDecoupleTextVisionExperts(stack_dim=self.stack_dim, concat_dim=self.concat_dim) + + +class ErnieSplitAndDecoupleTextVisionExperts(ConversionOps): + r""" + Special operation that splits a fused module list over all original modules and + then decouples them into a mixed module list each over all keys. + + Example with 2 original modules "Gate" and "Up" with 2 target keys "Text" and "Vision": + + [GateUp_Text] [GateUp_Vision] + / \ / \ + / \ / \ + / / \ \ + / / \ \ + [Gate_Text] [Gate_Vision] [Up_Text] [Up_Vision] + | | | | + [ Gate ] [ Up ] + ModuleList 1 ModuleList 2 + + The splits are equal and are defined by the amount of original module lists. + The final decoupled module lists are defined by the amount of keys. + """ + + def __init__(self, stack_dim: int = 0, concat_dim: int = 1): + self.stack_dim = stack_dim + self.concat_dim = concat_dim + + @torch.no_grad() + def convert( + self, + input_dict: dict[str, list[torch.Tensor]], + source_patterns: list[str], + target_patterns: list[str], + config, + **kwargs, + ) -> dict[str, list[torch.Tensor]]: + fused_modules = len(target_patterns) + valid_keys = input_dict.keys() + split_tensors = [] + for key in source_patterns: + if key not in valid_keys: + raise ValueError( + f"Expected pattern {key} in collected tensors but only found tensors for: {valid_keys}" + ) + + # Assuming that we get single sized lists here to index with 0 + split_tensors.append(input_dict[key][0].chunk(fused_modules, dim=self.concat_dim)) + + decoupled = {} + for idx, key in enumerate(target_patterns): + tensor_groups = [ + list(torch.unbind(tensor_group[idx], dim=self.stack_dim)) for tensor_group in split_tensors + ] + tensor_list = list(chain.from_iterable(tensor_groups)) + targets = [key.replace("*", f"{i}") for i in range(len(tensor_list))] + decoupled |= dict(zip(targets, tensor_list)) + + return decoupled + + @property + def reverse_op(self) -> ConversionOps: + return ErnieFuseAndSplitTextVisionExperts(stack_dim=self.stack_dim, concat_dim=self.concat_dim) + + +class Force16BytesAlignment(ConversionOps): + """ + Ensures that the given tensor is 16-bytes aligned in memory and clones it if not. + This guarantees 16-bytes alignment for kernels / implementations that use TMA or SIMD instructions like torch.nn.functional.grouped_mm. + """ + + @torch.no_grad() + def convert( + self, input_dict: dict[str, torch.Tensor], source_patterns: list[str], target_patterns: list[str], **kwargs + ) -> dict[str, torch.Tensor]: + target_pattern = self.get_target_pattern(input_dict, source_patterns, target_patterns) + tensors = next(iter(input_dict.values())) + tensor = tensors[0] if isinstance(tensors, list) else tensors + tensor = tensor.clone() if tensor.data_ptr() % 16 != 0 else tensor + return {target_pattern: tensor} + + def get_target_pattern( + self, input_dict: dict[str, torch.Tensor], source_patterns: list[str], target_patterns: list[str] + ) -> str: + if len(input_dict) != 1: + raise ValueError("Undefined Operation encountered!") + # Here it's the first operation of a chain, so return the source + if len(target_patterns) > 1: + if len(source_patterns) == 1: + return source_patterns[0] + else: + raise ValueError("Undefined Operation encountered!") + # Here it's the only operation, or the last operation in a chain, so we return the target + else: + return target_patterns[0] + + @property + def reverse_op(self) -> ConversionOps: + return Force16BytesAlignment() + + +def process_target_pattern(pattern: str) -> tuple[str, str | None]: + """ + Process a target pattern for reverse mapping (when targets become sources). + + This handles several edge cases in checkpoint conversion mappings: + - Removes `^` prefix and `$` suffix (start/end of string anchors) + - Removes negative lookahead/lookbehind assertions + - Detects capturing groups and replaces them with `\\1` backreference + + Args: + pattern: The target pattern to process for reverse mapping. + + Returns: + A tuple of (processed_pattern, captured_group) where captured_group is + the original capturing group found (e.g., "(encoder|decoder)") or None. + """ + # Some mapping contains `^` to notify start of string when matching -> remove it during reverse mapping + pattern = pattern.removeprefix("^") + # Some mapping contains `$` to notify end of string when matching -> remove it during reverse mapping + pattern = pattern.removesuffix("$") + # Remove negative lookahead/behind if any. This is ugly but needed for reverse mapping of + # Qwen2.5, Sam3, Ernie4.5 VL MoE! + pattern = re.sub(r"\(\?.+\)", "", pattern) + # Allow capturing groups in patterns, i.e. to add/remove a prefix to all keys (e.g. timm_wrapper, sam3) + capturing_group_match = re.search(r"\(.+?\)", pattern) + captured_group = None + if capturing_group_match: + captured_group = capturing_group_match.group(0) + pattern = pattern.replace(captured_group, r"\1", 1) + return pattern, captured_group + + +@dataclass(slots=True) +class WeightTransform: + source_patterns: str | list[str] = field(init=True) + target_patterns: str | list[str] = field(init=True) + compiled_sources: re.Pattern = field(init=False) + + distributed_operation: TensorParallelLayer | None = None + quantization_operation: ConversionOps | None = None + + collected_tensors: dict[str, list[Future]] = field(default_factory=lambda: defaultdict(list), init=False) + layer_targets: dict[str, set[str]] = field(default_factory=lambda: defaultdict(set), init=False) + + def __setattr__(self, name, value): + if name in ("source_patterns", "target_patterns"): + # We do not allow to re-set the patterns, as they are linked between each other and changing one + # without the other can mess-up with the capturing groups/compiled sources + if hasattr(self, name): + raise ValueError(f"Cannot assign to field {name}, you should create a new instance") + # Switch str to list + elif isinstance(value, str): + value = [value] + object.__setattr__(self, name, value) + + def __post_init__(self): + # Due to how our `_checkpoint_conversion_mapping` mappings are written, we need a few exceptions here + # when instantiating the reverse mapping (i.e. the targets become sources, and sources become targets) + # The issues lie in the sources usually, so here we need to check the targets for the reversed mapping + + # Process target_patterns: detect capturing groups and replace with \1 + # Store the original capturing group patterns for reverse mapping + target_capturing_groups: list[str] = [] + for i, pattern in enumerate(self.target_patterns): + self.target_patterns[i], captured_group = process_target_pattern(pattern) + if captured_group is not None: + target_capturing_groups.append(captured_group) + + # Validate that we only have one unique capturing group pattern across all targets + # This ensures deterministic reverse mapping when sources have \1 backreferences + unique_capturing_groups = set(target_capturing_groups) + if len(unique_capturing_groups) > 1: + raise ValueError( + f"Multiple different capturing groups found in target_patterns: {unique_capturing_groups}. " + f"All target patterns must use the same capturing group pattern." + ) + unique_capturing_group = unique_capturing_groups.pop() if unique_capturing_groups else None + + # We also need to check capturing groups in the sources during reverse mapping (e.g. timm_wrapper, sam3) + for i, pattern in enumerate(self.source_patterns): + if r"\1" in pattern: + if unique_capturing_group is None: + raise ValueError( + f"Source pattern '{pattern}' contains \\1 backreference, but no capturing groups " + f"found in target_patterns." + ) + # Use the unique capturing group from target_patterns for all sources + pattern = pattern.replace(r"\1", unique_capturing_group, 1) + self.source_patterns[i] = pattern + + # Construct the regex we will use to rename keys from the sources to the targets + branches = [] + for i, source_pattern in enumerate(self.source_patterns): + group_name = f"g{i}" + pattern = source_pattern.replace(".*.", r"\..*\.") + branches.append(f"(?P<{group_name}>{pattern})") + self.compiled_sources = re.compile("|".join(branches)) + + def add_tensor(self, target_key: str, source_key: str, source_pattern: str, future: Future): + self.collected_tensors[source_pattern].append(future) + self.layer_targets[target_key].add(source_key) + + def rename_source_key(self, source_key: str) -> tuple[str, str | None]: + """ + Return a tuple (renamed_key, source_pattern_producing_the_match). + Try renaming `source_key` according to the source and target patterns of the current WeightTransform. + In case of a one-to-many transform, i.e. we have several target patterns, the matching source pattern + will be replaced by the first of all the target patterns (they are then correctly expanded in the Operations). + """ + # Try matching one of the alternation branches + match_object = self.compiled_sources.search(source_key) + if match_object is None: + return source_key, None + + # Find the source that produced the match (it's the first group that matched, as the search stops after first branch match) + matching_group_name = next(name for name, val in match_object.groupdict().items() if val is not None) + source_pattern_that_matched = self.source_patterns[int(matching_group_name[1:])] + # If we matched, we always replace with the first target pattern, in case we have several (one to many transform) + replacement = self.target_patterns[0] + # Allow capturing groups in patterns, i.e. to add a prefix to all keys (e.g. timm_wrapper, sam3) + if r"\1" in replacement: + # The index of the internal group we need to replace is the index of the matched named group as it comes + # inside that matched named group + replaced_group_idx = self.compiled_sources.groupindex[matching_group_name] + 1 + replacement = replacement.replace(r"\1", match_object.group(replaced_group_idx)) + renamed_key = source_key.replace(match_object.group(0), replacement) + return renamed_key, source_pattern_that_matched + + def reverse_transform(self) -> WeightTransform: + """Reverse the current `WeightTransform` instance, to be able to save with the opposite weight transformations.""" + # TODO: check this and relax when quantizer have `reverse_op` + if self.quantization_operation is not None: + raise ValueError("Cannot reverse the transform with TP or quantization") + + kwargs = {} + # Add the reverse ops if applicable (it needs to be provided at __init__) + if hasattr(self, "operations"): + # All reverse ops, in reverse order + kwargs["operations"] = [op.reverse_op for op in self.operations[::-1]] + + reverse_transform = self.__class__( + source_patterns=self.target_patterns, target_patterns=self.source_patterns, **kwargs + ) + + return reverse_transform + + def materialize_tensors(self) -> dict[str, list[torch.Tensor]]: + """ + Materialize all the tensors that were saved in `self.collected_tensors`. This function removes them from the + internal attribute to avoid keeping them in memory during the different `self.convert` operations, and return + a new dictionary (otherwise we use more memory than needed during loading). + + We basically have 3 cases here: + - async loading (default): the tensors are Future instances that we need to wait for + - sync loading: the tensors are Callable, we need to call the Callable to actually load them from disk + - saving: the tensors are already torch.Tensor instances (the existing model weights) + """ + collected_tensors = {} + for key in set(self.collected_tensors.keys()): + # Remove from internal attribute + tensors = self.collected_tensors.pop(key) + # Async loading + if isinstance(tensors[0], Future): + tensors = [future.result() for future in tensors if future.result() is not None] + # Sync loading + elif callable(tensors[0]): + tensors = [func() for func in tensors] + # Add them to the new dictionary + collected_tensors[key] = tensors + + return collected_tensors + + +@dataclass(slots=True) +class WeightRenaming(WeightTransform): + # Special case of WeightTransform that only renames keys without any conversion. + + def convert( + self, + layer_name: str, + model=None, + config=None, + hf_quantizer=None, + loading_info: LoadStateDictInfo | None = None, + ): + # Collect the tensors here - we use a new dictionary to avoid keeping them in memory in the internal + # attribute during the whole process + collected_tensors = self.materialize_tensors() + + # Perform renaming op (for a simple WeightRenaming, `self.source_patterns` and `self.target_patterns` can + # only be of length 1, and are actually the full key names - we also have only 1 single related tensor) + target_key = self.target_patterns[0] + collected_tensors = {target_key: collected_tensors[self.source_patterns[0]]} + + if hf_quantizer is not None and self.quantization_operation is not None: + with log_conversion_errors( + layer_name, loading_info, (len(collected_tensors), layer_name), self.quantization_operation + ): + collected_tensors = self.quantization_operation.convert( + collected_tensors, + source_patterns=self.source_patterns, + target_patterns=self.target_patterns, + full_layer_name=target_key, + model=model, + config=config, + missing_keys=loading_info.missing_keys if loading_info else None, + ) + + return collected_tensors + + +# List of classes that are known to be able to use m:n +_INTERNAL_MANY_TO_MANY_CONVERSIONS = ( + ErnieFuseAndSplitTextVisionExperts, + ErnieSplitAndDecoupleTextVisionExperts, +) + + +@dataclass(slots=True) +class WeightConverter(WeightTransform): + operations: list[ConversionOps] = field(default_factory=list, repr=False) + + def __post_init__(self): + WeightTransform.__post_init__(self) + if bool(len(self.source_patterns) - 1) + bool(len(self.target_patterns) - 1) >= 2: + # We allow many-to-many only if we use an internal operation that can handle it + if not any(isinstance(op, _INTERNAL_MANY_TO_MANY_CONVERSIONS) for op in self.operations): + raise ValueError( + f"source keys={self.source_patterns}, target_patterns={self.target_patterns} but you can only have one to many, one to one or many to one." + ) + if not self.operations: + raise ValueError("WeightConverter requires at least one operation.") + + def convert( + self, + layer_name: str, + model=None, + config=None, + hf_quantizer=None, + loading_info: LoadStateDictInfo | None = None, + ): + # Collect the tensors here - we use a new dictionary to avoid keeping them in memory in the internal + # attribute during the whole process + collected_tensors = self.materialize_tensors() + + for op in self.operations: + with log_conversion_errors(layer_name, loading_info, (len(collected_tensors), layer_name), op): + collected_tensors = op.convert( + collected_tensors, + source_patterns=self.source_patterns, + target_patterns=self.target_patterns, + # Additional kwargs, usually not used + full_layer_name=layer_name, + model=model, + config=config, + missing_keys=loading_info.missing_keys if loading_info else None, + ) + + # Tensors are returned from ops with the target patterns, we need to expand them to full name. + # This means we need to grab the prefix and suffix to add to every target key + full_name = layer_name + if ".*." in layer_name: + full_name = layer_name.replace(".*.", ".0.") + + try: + prefix, _, suffix = next(full_name.partition(k) for k in collected_tensors.keys() if k in full_name) + # Rename the tensors + collected_tensors = {prefix + k + suffix: v for k, v in collected_tensors.items()} + # some quantizers need to already rename in `convert` as they cannot only rely on prefix and suffix + except StopIteration: + pass + + if hf_quantizer is not None and self.quantization_operation is not None: + with log_conversion_errors( + layer_name, loading_info, (len(collected_tensors), layer_name), self.quantization_operation + ): + collected_tensors = self.quantization_operation.convert( + collected_tensors, + source_patterns=self.source_patterns, + target_patterns=self.target_patterns, + full_layer_name=layer_name, + config=config, + model=model, + missing_keys=loading_info.missing_keys if loading_info else None, + ) + return collected_tensors + + +# For I/O bound operations (i.e. here reading files), it is better to have fewer threads, e.g. 4 is a good default. +# Having too many is actually harming performances quite a lot, i.e. using 16 can sometimes lead to taking TWICE +# as much time to load the same model +GLOBAL_WORKERS = min(4, os.cpu_count() or 4) + + +def _materialize_copy(tensor: torch.Tensor, device=None, dtype=None) -> torch.Tensor: + # This slicing is what actually loads the tensor from the safetensors slice object + tensor = tensor[...] + if dtype is not None or device is not None: + tensor = tensor.to(device=device, dtype=dtype) + return tensor + + +def spawn_materialize( + thread_pool: ThreadPoolExecutor | None, tensor: torch.Tensor, device=None, dtype=None +) -> Future | Callable: + """Materialize a tensor from file asynchronously if `thread_pool` is provided, or return a Callable that will + load the tensor synchronously when called.""" + + def _job(): + return _materialize_copy(tensor, device, dtype) + + if thread_pool is not None: + return thread_pool.submit(_job) + else: + # Return the Callable here, not the Tensor itself, so we actually delay loading to avoid saturating cpu + # memory during Conversion + return _job + + +def spawn_tp_materialize( + thread_pool: ThreadPoolExecutor | None, tensor: torch.Tensor, sharding_method, tensor_idx, device=None, dtype=None +) -> Future | Callable: + """Materialize and shard a tensor (according to the TP-plan) from file asynchronously if `thread_pool` is provided, or + return a Callable that will load the tensor synchronously when called.""" + + def _job(): + return sharding_method.shard_tensor(tensor, tensor_idx=tensor_idx, device=device, dtype=dtype) + + if thread_pool is not None: + return thread_pool.submit(_job) + else: + # Return the Callable here, not the Tensor itself, so we actually delay loading to avoid saturating cpu + # memory during Conversion + return _job + + +def dot_natural_key(s: str): + """Sort key for state-dict names: split on ``"."`` and sort digits numerically + and strings alphabetically. We emit a tuple at each point to sort ints + first and strings second to avoid int-string comparison failures. + """ + result = [] + for p in s.split("."): + if p.isdigit(): + result.append((0, int(p))) + else: + result.append((1, p)) + return result + + +@contextmanager +def log_conversion_errors( + first_target_key: str, + loading_info: LoadStateDictInfo | None, + extras: Any = None, + op: list[ConversionOps] | ConversionOps | None = None, +): + """Catch all exceptions during `convert` calls, and log the errors for later. Re-raise a `SkipParameters` exception + that will be caught later to skip the parameters that raised the original Exception.""" + try: + yield + except Exception as e: + # During reverse mapping, we do not log and skip errors + if loading_info is None: + raise e + + def _format_op_name(curr_op: list[ConversionOps] | ConversionOps | None) -> str | None: + if curr_op is None: + return None + if isinstance(curr_op, (list, tuple, set)): + names = [o.__class__.__name__ for o in curr_op if o is not None] + if not names: + return None + return ", ".join(names) + return curr_op.__class__.__name__ + + op_name = _format_op_name(op) + + tb_str = "".join(traceback.format_exception(type(e), e, e.__traceback__)) + if isinstance(extras, tuple) and len(extras) == 2: + length, target_keys = extras + descriptor = f"{op_name} " if op_name else "" + loading_info.conversion_errors[first_target_key] = ( + f"{tb_str}{e}\nError: {descriptor}on tensors destined for {target_keys}. Ckpt contains: {length}" + ) + elif isinstance(extras, str): + suffix = f" via {op_name}" if op_name else "" + loading_info.conversion_errors[first_target_key] = ( + f"{tb_str}{e}\nError{suffix} when processing parameter {extras}" + ) + elif extras is None and op_name: + loading_info.conversion_errors[first_target_key] = f"{op_name}: {e}" + else: + loading_info.conversion_errors[first_target_key] = f"{extras} |Error: {e}" + + # Raise a specific Exception that we can catch easily + raise SkipParameters() + + +def set_param_for_module( + model: PreTrainedModel, + target_name: str, + param_value: torch.Tensor, + loading_info: LoadStateDictInfo, + distributed_operation: TensorParallelLayer | None, + hf_quantizer: HfQuantizer, +): + module_path, _, param_name = target_name.rpartition(".") + module_obj = model.get_submodule(module_path) if module_path else model + + ref = getattr(module_obj, param_name) + if ref is None: + loading_info.unexpected_keys.add(target_name) + else: + if not isinstance(param_value, torch.nn.Parameter): + if param_name not in module_obj._buffers: + param_value = torch.nn.Parameter(param_value, requires_grad=param_value.is_floating_point()) + + # Remove from missing keys (it's either mismatched, or all good) + loading_info.missing_keys.discard(target_name) + + # Determine expected shape: for TP, use sharded shape; otherwise, use full shape + if distributed_operation is not None: + expected_shape = torch.Size(distributed_operation.get_expected_sharded_shape(ref.shape)) + else: + expected_shape = ref.shape + + if ref is not None and param_value.shape != expected_shape and hf_quantizer is None: + loading_info.mismatched_keys.add((target_name, param_value.shape, expected_shape)) + else: + # super important otherwise _init_weight will re-init the param + param_value._is_hf_initialized = True + setattr(module_obj, param_name, param_value) + + +def offload_and_maybe_resave_param( + target_name: str, + param: torch.Tensor, + loading_info: LoadStateDictInfo, + disk_offload_folder: str, + disk_offload_index: dict, + applied_ops: WeightConverter | WeightRenaming, +) -> dict: + """Takes care of correctly offloading `param`. If it's not already present in the `disk_offload_index`, or if any + WeightConverter operations have been applied, it will resave the new parameter. Otherwise, it will use the original + `disk_offload_index` for this given param.""" + # We need to remove from missing keys + loading_info.missing_keys.discard(target_name) + # If not already offloaded, or if we applied any special Operation except Renaming, we need to re-save + if target_name not in disk_offload_index or isinstance(applied_ops, WeightConverter): + disk_offload_index = offload_weight(param, target_name, disk_offload_folder, disk_offload_index) + return disk_offload_index + + +class SkipParameters(Exception): + """Control-flow sentinel: abort processing of the current parameters only (that were supposed to be created + by a WeightConverter).""" + + pass + + +def rename_source_key( + source_key: str, + weight_renamings: list[WeightRenaming], + weight_converters: list[WeightConverter], + prefix: str | None = None, + meta_state_dict: dict | None = None, +) -> tuple[str, str | None]: + """ + Rename a source key given all the renaming and weight conversion patterns we have. Also takes care of adding/removing + the base model prefix during loading if necessary. + """ + renamed_key = source_key + # 1. apply all renamings in turns (if multiple match, it's the responsibility of the mappings to make sure they + # are coherent) + for renaming in weight_renamings: + renamed_key, _ = renaming.rename_source_key(renamed_key) + + # 2. apply renaming through weight conversions on the key if we have any WeightConverter (here we stop after + # the first match, as we assume only 1 converter can match any source key) + source_pattern = None + for converter in weight_converters: + renamed_key, source_pattern = converter.rename_source_key(renamed_key) + if source_pattern is not None: + break + + # 3. check if we need to add or remove prefix if necessary (only during loading, not saving) + if prefix is not None and meta_state_dict is not None: + if ( + renamed_key.startswith(prefix) + and meta_state_dict.get(re.sub(f"^{prefix}.", "", renamed_key, count=1)) is not None + ): + renamed_key = re.sub(f"^{prefix}.", "", renamed_key, count=1) + elif meta_state_dict.get(f"{prefix}.{renamed_key}") is not None: + renamed_key = f"{prefix}.{renamed_key}" + + return renamed_key, source_pattern + + +def convert_and_load_state_dict_in_model( + model: PreTrainedModel, + state_dict: dict[str, Any], + load_config: LoadStateDictConfig, + tp_plan: dict[str, str] | None, + disk_offload_index: dict | None = None, +): + r""" + We build a mapping from the keys obtained by renaming each of the checkpoint keys according to the weight_mapping rules. + Then we load the tensors into the model, applying any conversion operations as needed. + + The `param_name_to_load` will look like this: + { + "model.layers.0.attention.q.weight": # Notice here there is only the first key of the target keys + WeightConverter( + source_patterns=["qkv"], + target_patterns=["q", "k","v"], + operations=[Chunk(dim=0, chunks=3)]), + collected_tensors={ + "qkv": [Future]}, + layer_targets={ + "model.layers.0.attention.q.weight": {"model.layers.0.attention.qkv.weight"}, + "model.layers.0.attention.k.weight": {"model.layers.0.attention.qkv.weight"}, + "model.layers.0.attention.v.weight": {"model.layers.0.attention.qkv.weight"}, + } + ), + ... + } + + We make sure that the keys are the full keys. The only "nit" here is that 1 key can map to multiple target keys (e.g. qkv -> q, k, v). + In that case the weight converter will take care of doing the appropriate renaming. + + For example for: + ```python + WeightConverter( + source_patterns=["mlp.experts.*.gate_proj.weight","mlp.experts.*.up_proj.weight"], + target_patterns="mlp.experts.gate_up_proj", + operations=[MergeModulelist(dim=0), Concatenate(dim=1)], + ) + ``` + we would have the following collected tensors: + ```python + collected_tensors = { + "mlp.experts.*.gate_proj.weight": [Future, Future, Future, Future, Future, Future, Future, Future], + "mlp.experts.*.up_proj.weight": [Future, Future, Future, Future, Future, Future, Future, Future], + } + ``` + The first op, `MergeModulelist`, would stack the 8 tensors of each source but will not "rename" them into the fused target name. + The second op, `Concatenate`, would then rename the fused tensor into the final target name. + + If we want to split `qkv` we would have: + ```python + collected_tensors = { + "attention.qkv.weight": [Future], # here its the full SOURCE keys. + } + ``` + The `Chunk` operation would then split the single tensor into 3 and rename them accordingly and update the collected tensors to: + ```python + realized_values = { + "attention.q.weight": [Tensor], + "attention.k.weight": [Tensor], + "attention.v.weight": [Tensor], + } + ``` + + Now that this is done, we can quantize / dequantize accordingly the collected_tensors. + + For some quantization methods, we need to gather different tensors: + + ```python + # for "medmekk/llama-3.2-1b-float8-torchao" + WeightConverter( + source_patterns=[":qdata", ":scale"], + target_patterns="", + operations=[TorchaoDeserialize()], + ) + ``` + This will collect all tensors that have the same prefix, but end with `:qdata` or `:scale`. This will give us: + ```python + all_weight_mapping = { + "model.layers.13.self_attn.o_proj.weight": WeightConverter( + source_patterns=[":qdata", ":scale"], + target_patterns="", + operations=[TorchaoDeserialize()], + collected_tensors={ + ":qdata": [Future], + ":scale": [Future], + }, + ... + } + ``` + + """ + prefix = model.base_model_prefix + tp_plan = tp_plan or {} + device_map = load_config.device_map or {"": "cpu"} + hf_quantizer = load_config.hf_quantizer + dtype = load_config.dtype + device_mesh = load_config.device_mesh + disk_offload_folder = load_config.disk_offload_folder + offload_buffers = load_config.offload_buffers + dtype_plan = load_config.dtype_plan or {} + weight_mapping = load_config.weight_mapping or [] + meta_model_state_dict = model.state_dict() + model_buffers = {k for k, _ in model.named_buffers()} + + # We start from all missing keys, and we will remove/add them from the proper containers as loading advances + loading_info = LoadStateDictInfo( + missing_keys=set(meta_model_state_dict.keys()), + unexpected_keys=set(), + mismatched_keys=set(), + conversion_errors={}, + error_msgs=[], + ) + + # We use threading by default, if not explicitly deactivated via env variable. If we have to offload, + # we cannot use it either to control the memory as we are under memory constraints, so we need to be sequential + if is_env_variable_true("HF_DEACTIVATE_ASYNC_LOAD") or "disk" in device_map.values(): + thread_pool = None + else: + thread_pool = ThreadPoolExecutor(max_workers=GLOBAL_WORKERS) + + renamings = [entry for entry in weight_mapping if isinstance(entry, WeightRenaming)] + converters = [entry for entry in weight_mapping if isinstance(entry, WeightConverter)] + param_name_to_load: dict[str, WeightRenaming | WeightConverter] = {} + + # build '(?P.*.*\\.block_sparse_moe\\..*)' and group to source {'g0': '*.block_sparse_moe.'} + # and target to source {'g0': '*.mlp.'}. This allows us to quickly find which pattern matched. + if tp_plan != {}: + tp_plan_alt, tp_plan_by_group_name, _ = build_glob_alternation(list(tp_plan.keys())) + if dtype_plan != {}: + dtype_policy_alt, dtype_policy_by_group_name, _ = build_glob_alternation(list(dtype_plan.keys())) + + pattern_to_converter = {k: converter for converter in converters for k in converter.source_patterns} + + state_dict = sorted(state_dict.items(), key=lambda kv: dot_natural_key(kv[0])) + for original_key, tensor in state_dict: + # 1. Rename the key according to all renaming pattern and optional weight converter patterns + renamed_key, source_pattern = rename_source_key( + original_key, renamings, converters, prefix, meta_model_state_dict + ) + + # 2. finally, collect the tensor into the proper converter + if renamed_key in meta_model_state_dict: + empty_param = meta_model_state_dict.get(renamed_key) + # If we enter here, we have a WeightConverter operation to perform + if source_pattern is not None: + new_converter = deepcopy(pattern_to_converter[source_pattern]) + # each target key gets its own converter instance + mapping = param_name_to_load.setdefault(renamed_key, new_converter) + # Otherwise, only potential renaming + else: + mapping = param_name_to_load.setdefault(renamed_key, WeightRenaming(original_key, renamed_key)) + source_pattern = original_key + + # 3. Handle dtype casting + if ( + hf_quantizer + and not hf_quantizer.pre_quantized + and hf_quantizer.param_needs_quantization(model, renamed_key) + ): + mapping.quantization_operation = hf_quantizer.get_quantize_ops() + + _dtype = dtype + if hf_quantizer and hf_quantizer.pre_quantized and original_key != renamed_key: + # if the key was renamed as it is not available in the state dict otherwise, it means that we are deserializing it, + # so we need to make sure to load the tensor with the same dtype from the checkpoint + # TODO: make the condition more srict for native fp8 model such as qwen2moe fp8 + _dtype = None + elif dtype_plan != {} and dtype_policy_alt.search(renamed_key): + matched_dtype_pattern = dtype_policy_alt.search(renamed_key) + if matched_dtype_pattern is not None: + _dtype = dtype_plan[dtype_policy_by_group_name[matched_dtype_pattern.lastgroup]] + elif empty_param is not None and empty_param.dtype != _dtype: + _dtype = empty_param.dtype # usually correct when initializing + + # 4. Handle TP sharding or device_map placement + future_or_tensor = None + if device_mesh: + if matched_tp_pattern := tp_plan_alt.search(renamed_key): + matched_tp_pattern = tp_plan_by_group_name[matched_tp_pattern.lastgroup] + if getattr(mapping, "distributed_operation", None) is None: + tp_layer = ALL_PARALLEL_STYLES[model.tp_plan[matched_tp_pattern]].__class__ + mapping.distributed_operation = tp_layer( + device_mesh=device_mesh, rank=device_mesh.get_local_rank(), empty_param=empty_param.clone() + ) + shard_index = ( + len(mapping.collected_tensors.get(source_pattern, [])) + if isinstance(mapping, WeightConverter) and isinstance(mapping.operations[0], MergeModulelist) + else None + ) + future_or_tensor = spawn_tp_materialize( + thread_pool, + tensor, + mapping.distributed_operation, + shard_index, + device_map[""], + _dtype, + ) + + if future_or_tensor is None: + param_device = get_device(device_map, renamed_key, valid_torch_device=True) + future_or_tensor = spawn_materialize(thread_pool, tensor, param_device, _dtype) + + mapping.add_tensor(renamed_key, original_key, source_pattern, future_or_tensor) + elif source_pattern is not None: # add all target keys as unexpected + mapping = pattern_to_converter[source_pattern] + for k in mapping.target_patterns: + loading_info.unexpected_keys.add(renamed_key.replace(mapping.target_patterns[0], k)) + else: + loading_info.unexpected_keys.add(renamed_key) + + try: + total_entries = len(param_name_to_load) + with logging.tqdm(total=total_entries, desc="Loading weights") as pbar: + for first_param_name, mapping in param_name_to_load.items(): + pbar.update(1) + pbar.set_postfix({"Materializing param": first_param_name}) + pbar.refresh() + try: + realized_value = mapping.convert( + first_param_name, + model=model, + config=model.config, + hf_quantizer=hf_quantizer, + loading_info=loading_info, + ) + for target_name, param in realized_value.items(): + param = param[0] if isinstance(param, list) else param + param_device = get_device(device_map, target_name) + # Offloading support + if param_device == "disk" and (target_name not in model_buffers or offload_buffers): + disk_offload_index = offload_and_maybe_resave_param( + target_name, param, loading_info, disk_offload_folder, disk_offload_index, mapping + ) + else: + set_param_for_module( + model, + target_name, + param, + loading_info, + mapping.distributed_operation, + hf_quantizer, + ) + + # Cleanup all the tensors that were gathered before next iteration + del realized_value + + except SkipParameters: + continue + + # Close the pool, independently of whether the code was interrupted or finished successfully + finally: + if thread_pool is not None: + # `cancel_futures=True` in case the program was interrupted, to avoid wasting time on exit + thread_pool.shutdown(wait=False, cancel_futures=True) + + # Keep the current weight conversion mapping for later saving (in case it was coming directly from the user) + model._weight_conversions = weight_mapping + return loading_info, disk_offload_index + + +def revert_weight_conversion(model: PreTrainedModel, state_dict: dict[str, torch.Tensor]): + """ + Revert the conversion mapping that was used to load the model with `from_pretrained`, or the default one + if the model was created in another way and is part of the default mappings. + """ + weight_conversions = getattr(model, "_weight_conversions", None) + # In this case, the model was not created with `from_pretrained` -> let's check if it's in the hardcoded + # mappings, and recreate the mapping from there if it is + if weight_conversions is None: + from .conversion_mapping import get_model_conversion_mapping + + # Do not resave with the legacy renaming, if present + weight_conversions = get_model_conversion_mapping(model, add_legacy=False) + weight_conversions = weight_conversions if len(weight_conversions) > 0 else None + + # We did not find any operations to perform -> quick escape + if weight_conversions is None: + return state_dict + + # Reverse all Transform to correctly match keys + reverse_weight_conversion = [conversion.reverse_transform() for conversion in weight_conversions] + # If we are still here, we need to create the (reverse) conversion mapping from scratch + renamings = [entry for entry in reverse_weight_conversion if isinstance(entry, WeightRenaming)] + converters = [entry for entry in reverse_weight_conversion if isinstance(entry, WeightConverter)] + pattern_to_converter = {k: converter for converter in converters for k in converter.source_patterns} + conversion_mapping = {} + + state_dict = sorted(state_dict.items(), key=lambda kv: dot_natural_key(kv[0])) + for original_key, tensor in state_dict: + # Rename the key according to all renaming pattern and optional weight converter patterns + renamed_key, source_pattern = rename_source_key(original_key, renamings, converters) + if source_pattern is not None: + new_converter = deepcopy(pattern_to_converter[source_pattern]) + # each target key gets its own converter instance + mapping = conversion_mapping.setdefault(renamed_key, new_converter) + else: + mapping = conversion_mapping.setdefault(renamed_key, WeightRenaming(original_key, renamed_key)) + source_pattern = original_key + + mapping.add_tensor(renamed_key, original_key, source_pattern, tensor) + + new_state_dict = {} + for first_param_name, reversed_converter in conversion_mapping.items(): + # Apply the reverse converter + realized_value = reversed_converter.convert(first_param_name, model=model, config=model.config) + for target_name, param in realized_value.items(): + param = param[0] if isinstance(param, list) else param + new_state_dict[target_name] = param + + return new_state_dict diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/debug_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/debug_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..920b1cf44dafd320729eef1e6a36b9a41741c83c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/debug_utils.py @@ -0,0 +1,346 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import collections + +from .utils import ExplicitEnum, is_torch_available, logging + + +if is_torch_available(): + import torch + + +logger = logging.get_logger(__name__) + + +class DebugUnderflowOverflow: + """ + This debug class helps detect and understand where the model starts getting very large or very small, and more + importantly `nan` or `inf` weight and activation elements. + + There are 2 working modes: + + 1. Underflow/overflow detection (default) + 2. Specific batch absolute min/max tracing without detection + + Mode 1: Underflow/overflow detection + + To activate the underflow/overflow detection, initialize the object with the model : + + ```python + debug_overflow = DebugUnderflowOverflow(model) + ``` + + then run the training as normal and if `nan` or `inf` gets detected in at least one of the weight, input or output + elements this module will throw an exception and will print `max_frames_to_save` frames that lead to this event, + each frame reporting + + 1. the fully qualified module name plus the class name whose `forward` was run + 2. the absolute min and max value of all elements for each module weights, and the inputs and output + + For example, here is the header and the last few frames in detection report for `google/mt5-small` run in fp16 + mixed precision : + + ``` + Detected inf/nan during batch_number=0 + Last 21 forward frames: + abs min abs max metadata + [...] + encoder.block.2.layer.1.DenseReluDense.wi_0 Linear + 2.17e-07 4.50e+00 weight + 1.79e-06 4.65e+00 input[0] + 2.68e-06 3.70e+01 output + encoder.block.2.layer.1.DenseReluDense.wi_1 Linear + 8.08e-07 2.66e+01 weight + 1.79e-06 4.65e+00 input[0] + 1.27e-04 2.37e+02 output + encoder.block.2.layer.1.DenseReluDense.wo Linear + 1.01e-06 6.44e+00 weight + 0.00e+00 9.74e+03 input[0] + 3.18e-04 6.27e+04 output + encoder.block.2.layer.1.DenseReluDense T5DenseGatedGeluDense + 1.79e-06 4.65e+00 input[0] + 3.18e-04 6.27e+04 output + encoder.block.2.layer.1.dropout Dropout + 3.18e-04 6.27e+04 input[0] + 0.00e+00 inf output + ``` + + You can see here, that `T5DenseGatedGeluDense.forward` resulted in output activations, whose absolute max value was + around 62.7K, which is very close to fp16's top limit of 64K. In the next frame we have `Dropout` which + renormalizes the weights, after it zeroed some of the elements, which pushes the absolute max value to more than + 64K, and we get an overflow. + + As you can see it's the previous frames that we need to look into when the numbers start going into very large for + fp16 numbers. + + The tracking is done in a forward hook, which gets invoked immediately after `forward` has completed. + + By default the last 21 frames are printed. You can change the default to adjust for your needs. For example : + + ```python + debug_overflow = DebugUnderflowOverflow(model, max_frames_to_save=100) + ``` + + To validate that you have set up this debugging feature correctly, and you intend to use it in a training that + may take hours to complete, first run it with normal tracing enabled for one of a few batches as explained in + the next section. + + + Mode 2. Specific batch absolute min/max tracing without detection + + The second work mode is per-batch tracing with the underflow/overflow detection feature turned off. + + Let's say you want to watch the absolute min and max values for all the ingredients of each `forward` call of a + given batch, and only do that for batches 1 and 3. Then you instantiate this class as : + + ```python + debug_overflow = DebugUnderflowOverflow(model, trace_batch_nums=[1, 3]) + ``` + + And now full batches 1 and 3 will be traced using the same format as explained above. Batches are 0-indexed. + + This is helpful if you know that the program starts misbehaving after a certain batch number, so you can + fast-forward right to that area. + + + Early stopping: + + You can also specify the batch number after which to stop the training, with : + + ```python + debug_overflow = DebugUnderflowOverflow(model, trace_batch_nums=[1, 3], abort_after_batch_num=3) + ``` + + This feature is mainly useful in the tracing mode, but you can use it for any mode. + + + **Performance**: + + As this module measures absolute `min`/``max` of each weight of the model on every forward it'll slow the training + down. Therefore remember to turn it off once the debugging needs have been met. + + Args: + model (`nn.Module`): + The model to debug. + max_frames_to_save (`int`, *optional*, defaults to 21): + How many frames back to record + trace_batch_nums(`list[int]`, *optional*, defaults to `[]`): + Which batch numbers to trace (turns detection off) + abort_after_batch_num (`int``, *optional*): + Whether to abort after a certain batch number has finished + """ + + def __init__(self, model, max_frames_to_save=21, trace_batch_nums=[], abort_after_batch_num=None): + self.model = model + self.trace_batch_nums = trace_batch_nums + self.abort_after_batch_num = abort_after_batch_num + + # keep a LIFO buffer of frames to dump as soon as inf/nan is encountered to give context to the problem emergence + self.frames = collections.deque([], max_frames_to_save) + self.frame = [] + self.batch_number = 0 + self.total_calls = 0 + self.detected_overflow = False + self.prefix = " " + + self.analyse_model() + + self.register_forward_hook() + + def save_frame(self, frame=None): + if frame is not None: + self.expand_frame(frame) + self.frames.append("\n".join(self.frame)) + self.frame = [] # start a new frame + + def expand_frame(self, line): + self.frame.append(line) + + def trace_frames(self): + print("\n".join(self.frames)) + self.frames = [] + + def reset_saved_frames(self): + self.frames = [] + + def dump_saved_frames(self): + print(f"\nDetected inf/nan during batch_number={self.batch_number}") + print(f"Last {len(self.frames)} forward frames:") + print(f"{'abs min':8} {'abs max':8} metadata") + print("\n".join(self.frames)) + print("\n\n") + self.frames = [] + + def analyse_model(self): + # extract the fully qualified module names, to be able to report at run time. e.g.: + # encoder.block.2.layer.0.SelfAttention.o + # + # for shared weights only the first shared module name will be registered + self.module_names = {m: name for name, m in self.model.named_modules()} + # self.longest_module_name = max(len(v) for v in self.module_names.values()) + + def analyse_variable(self, var, ctx): + if torch.is_tensor(var): + self.expand_frame(get_abs_min_max(var, ctx)) + if detect_overflow(var, ctx): + self.detected_overflow = True + elif var is None: + self.expand_frame(f"{'None':>17} {ctx}") + else: + self.expand_frame(f"{'not a tensor':>17} {ctx}") + + def batch_start_frame(self): + self.expand_frame(f"\n\n{self.prefix} *** Starting batch number={self.batch_number} ***") + self.expand_frame(f"{'abs min':8} {'abs max':8} metadata") + + def batch_end_frame(self): + self.expand_frame(f"{self.prefix} *** Finished batch number={self.batch_number - 1} ***\n\n") + + def create_frame(self, module, input, output): + self.expand_frame(f"{self.prefix} {self.module_names[module]} {module.__class__.__name__}") + + # params + for name, p in module.named_parameters(recurse=False): + self.analyse_variable(p, name) + + # inputs + if isinstance(input, tuple): + for i, x in enumerate(input): + self.analyse_variable(x, f"input[{i}]") + else: + self.analyse_variable(input, "input") + + # outputs + if isinstance(output, tuple): + for i, x in enumerate(output): + # possibly a tuple of tuples + if isinstance(x, tuple): + for j, y in enumerate(x): + self.analyse_variable(y, f"output[{i}][{j}]") + else: + self.analyse_variable(x, f"output[{i}]") + else: + self.analyse_variable(output, "output") + + self.save_frame() + + def register_forward_hook(self): + self.model.apply(self._register_forward_hook) + + def _register_forward_hook(self, module): + module.register_forward_hook(self.forward_hook) + + def forward_hook(self, module, input, output): + # - input is a tuple of packed inputs (could be non-Tensors) + # - output could be a Tensor or a tuple of Tensors and non-Tensors + + last_frame_of_batch = False + + trace_mode = self.batch_number in self.trace_batch_nums + if trace_mode: + self.reset_saved_frames() + + if self.total_calls == 0: + self.batch_start_frame() + self.total_calls += 1 + + # count batch numbers - the very first forward hook of the batch will be called when the + # batch completes - i.e. it gets called very last - we know this batch has finished + if module == self.model: + self.batch_number += 1 + last_frame_of_batch = True + + self.create_frame(module, input, output) + + # if last_frame_of_batch: + # self.batch_end_frame() + + if trace_mode: + self.trace_frames() + + if last_frame_of_batch: + self.batch_start_frame() + + if self.detected_overflow and not trace_mode: + self.dump_saved_frames() + + # now we can abort, as it's pointless to continue running + raise ValueError( + "DebugUnderflowOverflow: inf/nan detected, aborting as there is no point running further. " + "Please scroll up above this traceback to see the activation values prior to this event." + ) + + # abort after certain batch if requested to do so + if self.abort_after_batch_num is not None and self.batch_number > self.abort_after_batch_num: + raise ValueError( + f"DebugUnderflowOverflow: aborting after {self.batch_number} batches due to" + f" `abort_after_batch_num={self.abort_after_batch_num}` arg" + ) + + +def get_abs_min_max(var, ctx): + abs_var = var.abs() + return f"{abs_var.min():8.2e} {abs_var.max():8.2e} {ctx}" + + +def detect_overflow(var, ctx): + """ + Report whether the tensor contains any `nan` or `inf` entries. + + This is useful for detecting overflows/underflows and best to call right after the function that did some math that + modified the tensor in question. + + This function contains a few other helper features that you can enable and tweak directly if you want to track + various other things. + + Args: + var: the tensor variable to check + ctx: the message to print as a context + + Return: + `True` if `inf` or `nan` was detected, `False` otherwise + """ + detected = False + if torch.isnan(var).any().item(): + detected = True + print(f"{ctx} has nans") + if torch.isinf(var).any().item(): + detected = True + print(f"{ctx} has infs") + + # if needed to monitor large elements can enable the following + if 0: # and detected: + n100 = var[torch.ge(var.abs(), 100)] + if n100.numel() > 0: + print(f"{ctx}: n100={n100.numel()}") + n1000 = var[torch.ge(var.abs(), 1000)] + if n1000.numel() > 0: + print(f"{ctx}: n1000={n1000.numel()}") + n10000 = var[torch.ge(var.abs(), 10000)] + if n10000.numel() > 0: + print(f"{ctx}: n10000={n10000.numel()}") + + if 0: + print(f"min={var.min():9.2e} max={var.max():9.2e}") + + if 0: + print(f"min={var.min():9.2e} max={var.max():9.2e} var={var.var():9.2e} mean={var.mean():9.2e} ({ctx})") + + return detected + + +class DebugOption(ExplicitEnum): + UNDERFLOW_OVERFLOW = "underflow_overflow" + TPU_METRICS_DEBUG = "tpu_metrics_debug" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/dependency_versions_check.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/dependency_versions_check.py new file mode 100644 index 0000000000000000000000000000000000000000..9f9edb40eb51bf1907c9f575cdb4c9424ec967d5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/dependency_versions_check.py @@ -0,0 +1,62 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .dependency_versions_table import deps +from .utils.versions import require_version, require_version_core + + +# define which module versions we always want to check at run time +# (usually the ones defined in `install_requires` in setup.py) +# +# order specific notes: +# - tqdm must be checked before tokenizers + +pkgs_to_check_at_runtime = [ + "python", + "tqdm", + "regex", + "packaging", + "filelock", + "numpy", + "tokenizers", + "huggingface-hub", + "safetensors", + "accelerate", + "pyyaml", +] + +for pkg in pkgs_to_check_at_runtime: + if pkg in deps: + if pkg == "tokenizers": + # must be loaded here, or else tqdm check may fail + from .utils import is_tokenizers_available + + if not is_tokenizers_available(): + continue # not required, check version only if installed + elif pkg == "accelerate": + # must be loaded here, or else tqdm check may fail + from .utils import is_accelerate_available + + # Maybe switch to is_torch_available in the future here so that Accelerate is hard dep of + # Transformers with PyTorch + if not is_accelerate_available(): + continue # not required, check version only if installed + + require_version_core(deps[pkg]) + else: + raise ValueError(f"can't find {pkg} in {deps.keys()}, check dependency_versions_table.py") + + +def dep_version_check(pkg, hint=None): + require_version(deps[pkg], hint) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/dependency_versions_table.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/dependency_versions_table.py new file mode 100644 index 0000000000000000000000000000000000000000..1b38c0a702d341c46959ac02ea47c154ff6d9969 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/dependency_versions_table.py @@ -0,0 +1,94 @@ +# THIS FILE HAS BEEN AUTOGENERATED. To update: +# 1. modify the `_deps` dict in setup.py +# 2. run `make fix-repo`` +deps = { + "Pillow": "Pillow>=10.0.1,<=15.0", + "accelerate": "accelerate>=1.1.0", + "av": "av", + "beautifulsoup4": "beautifulsoup4", + "blobfile": "blobfile", + "codecarbon": "codecarbon>=2.8.1", + "datasets": "datasets>=2.15.0", + "deepspeed": "deepspeed>=0.9.3", + "diffusers": "diffusers", + "dill": "dill<0.3.5", + "evaluate": "evaluate>=0.4.6", + "faiss-cpu": "faiss-cpu", + "fastapi": "fastapi", + "filelock": "filelock", + "fugashi": "fugashi>=1.0", + "GitPython": "GitPython<3.1.19", + "hf-doc-builder": "hf-doc-builder>=0.3.0", + "huggingface-hub": "huggingface-hub>=1.3.0,<2.0", + "importlib_metadata": "importlib_metadata", + "ipadic": "ipadic>=1.0.0,<2.0", + "jinja2": "jinja2>=3.1.0", + "jmespath": "jmespath>=1.0.1", + "kenlm": "kenlm", + "kernels": "kernels>=0.10.2,<0.11", + "librosa": "librosa", + "mistral-common[image]": "mistral-common[image]>=1.8.8", + "nltk": "nltk<=3.8.1", + "num2words": "num2words", + "numpy": "numpy>=1.17", + "openai": "openai>=1.98.0", + "opencv-python": "opencv-python", + "optimum-benchmark": "optimum-benchmark>=0.3.0", + "optuna": "optuna", + "pandas": "pandas<2.3.0", + "packaging": "packaging>=20.0", + "parameterized": "parameterized>=0.9", + "peft": "peft>=0.18.0", + "phonemizer": "phonemizer", + "protobuf": "protobuf", + "psutil": "psutil", + "pyyaml": "pyyaml>=5.1", + "pydantic": "pydantic>=2", + "pytest": "pytest>=7.2.0,<9.0.0", + "pytest-asyncio": "pytest-asyncio>=1.2.0", + "pytest-random-order": "pytest-random-order", + "pytest-rerunfailures": "pytest-rerunfailures<16.0", + "pytest-timeout": "pytest-timeout", + "pytest-env": "pytest-env", + "pytest-xdist": "pytest-xdist", + "pytest-order": "pytest-order", + "python": "python>=3.10.0", + "regex": "regex!=2019.12.17", + "rhoknp": "rhoknp>=1.1.0,<1.3.1", + "rjieba": "rjieba", + "rouge-score": "rouge-score!=0.0.7,!=0.0.8,!=0.1,!=0.1.1", + "ruff": "ruff==0.14.10", + "sacrebleu": "sacrebleu>=1.4.12,<2.0.0", + "sacremoses": "sacremoses", + "safetensors": "safetensors>=0.4.3", + "sagemaker": "sagemaker>=2.31.0", + "schedulefree": "schedulefree>=1.2.6", + "scikit-learn": "scikit-learn", + "scipy": "scipy", + "sentencepiece": "sentencepiece>=0.1.91,!=0.1.92", + "starlette": "starlette", + "sudachipy": "sudachipy>=0.6.6", + "sudachidict_core": "sudachidict_core>=20220729", + "tensorboard": "tensorboard", + "timeout-decorator": "timeout-decorator", + "tiktoken": "tiktoken", + "timm": "timm>=1.0.23", + "tokenizers": "tokenizers>=0.22.0,<=0.23.0", + "torch": "torch>=2.4", + "torchaudio": "torchaudio", + "torchvision": "torchvision", + "pyctcdecode": "pyctcdecode>=0.4.0", + "tqdm": "tqdm>=4.27", + "typer-slim": "typer-slim", + "unidic": "unidic>=1.0.2", + "unidic_lite": "unidic_lite>=1.0.7", + "urllib3": "urllib3<2.0.0", + "uvicorn": "uvicorn", + "pytest-rich": "pytest-rich", + "libcst": "libcst", + "rich": "rich", + "ray[tune]": "ray[tune]>=2.7.0", + "opentelemetry-api": "opentelemetry-api", + "opentelemetry-exporter-otlp": "opentelemetry-exporter-otlp", + "opentelemetry-sdk": "opentelemetry-sdk", +} diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/dynamic_module_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/dynamic_module_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..e94617d2f51e4c7c51da63526a15c9aab98bea93 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/dynamic_module_utils.py @@ -0,0 +1,810 @@ +# Copyright 2021 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Utilities to dynamically load objects from the Hub.""" + +import ast +import filecmp +import hashlib +import importlib +import importlib.metadata +import importlib.util +import keyword +import os +import re +import shutil +import signal +import sys +import threading +from pathlib import Path +from types import ModuleType +from typing import Any + +from huggingface_hub import is_offline_mode, try_to_load_from_cache +from packaging import version + +from .utils import ( + HF_MODULES_CACHE, + TRANSFORMERS_DYNAMIC_MODULE_NAME, + cached_file, + extract_commit_hash, + logging, +) +from .utils.import_utils import VersionComparison, split_package_version + + +logger = logging.get_logger(__name__) # pylint: disable=invalid-name + + +def _sanitize_module_name(name: str) -> str: + r""" + Tries to sanitize a module name so that it can be used as a Python module. + + The following transformations are applied: + + 1. Replace `.` in module names with `_dot_`. + 2. Replace `-` in module names with `_hyphen_`. + 3. If the module name starts with a digit, prepend it with `_`. + 4. Warn if the sanitized name is a Python reserved keyword or not a valid identifier. + + If the input name is already a valid identifier, it is returned unchanged. + """ + # We not replacing `\W` characters with `_` to avoid collisions. Because `_` is a very common + # separator used in module names, replacing `\W` with `_` would create too many collisions. + # Once a module is imported, it is cached in `sys.modules` and the second import would return + # the first module, which might not be the expected behavior if name collisions happen. + new_name = name.replace(".", "_dot_").replace("-", "_hyphen_") + if new_name and new_name[0].isdigit(): + new_name = f"_{new_name}" + if keyword.iskeyword(new_name): + logger.warning( + f"The module name {new_name} (originally {name}) is a reserved keyword in Python. " + "Please rename the original module to avoid import issues." + ) + elif not new_name.isidentifier(): + logger.warning( + f"The module name {new_name} (originally {name}) is not a valid Python identifier. " + "Please rename the original module to avoid import issues." + ) + return new_name + + +_HF_REMOTE_CODE_LOCK = threading.Lock() + + +def init_hf_modules(): + """ + Creates the cache directory for modules with an init, and adds it to the Python path. + """ + # This function has already been executed if HF_MODULES_CACHE already is in the Python path. + if HF_MODULES_CACHE in sys.path: + return + + sys.path.append(HF_MODULES_CACHE) + os.makedirs(HF_MODULES_CACHE, exist_ok=True) + init_path = Path(HF_MODULES_CACHE) / "__init__.py" + if not init_path.exists(): + init_path.touch() + importlib.invalidate_caches() + + +def create_dynamic_module(name: str | os.PathLike) -> None: + """ + Creates a dynamic module in the cache directory for modules. + + Args: + name (`str` or `os.PathLike`): + The name of the dynamic module to create. + """ + init_hf_modules() + dynamic_module_path = (Path(HF_MODULES_CACHE) / name).resolve() + # If the parent module does not exist yet, recursively create it. + if not dynamic_module_path.parent.exists(): + create_dynamic_module(dynamic_module_path.parent) + os.makedirs(dynamic_module_path, exist_ok=True) + init_path = dynamic_module_path / "__init__.py" + if not init_path.exists(): + init_path.touch() + # It is extremely important to invalidate the cache when we change stuff in those modules, or users end up + # with errors about module that do not exist. Same for all other `invalidate_caches` in this file. + importlib.invalidate_caches() + + +def get_relative_imports(module_file: str | os.PathLike) -> list[str]: + """ + Get the list of modules that are relatively imported in a module file. + + Args: + module_file (`str` or `os.PathLike`): The module file to inspect. + + Returns: + `list[str]`: The list of relative imports in the module. + """ + with open(module_file, encoding="utf-8") as f: + content = f.read() + + # Imports of the form `import .xxx` + relative_imports = re.findall(r"^\s*import\s+\.(\S+)\s*$", content, flags=re.MULTILINE) + # Imports of the form `from .xxx import yyy` + relative_imports += re.findall(r"^\s*from\s+\.(\S+)\s+import", content, flags=re.MULTILINE) + # Unique-ify + return list(set(relative_imports)) + + +def get_relative_import_files(module_file: str | os.PathLike) -> list[str]: + """ + Get the list of all files that are needed for a given module. Note that this function recurses through the relative + imports (if a imports b and b imports c, it will return module files for b and c). + + Args: + module_file (`str` or `os.PathLike`): The module file to inspect. + + Returns: + `list[str]`: The list of all relative imports a given module needs (recursively), which will give us the list + of module files a given module needs. + """ + no_change = False + files_to_check = [module_file] + all_relative_imports = [] + + # Let's recurse through all relative imports + while not no_change: + new_imports = [] + for f in files_to_check: + new_imports.extend(get_relative_imports(f)) + + module_path = Path(module_file).parent + new_import_files = [f"{str(module_path / m)}.py" for m in new_imports] + files_to_check = [f for f in new_import_files if f not in all_relative_imports] + + no_change = len(files_to_check) == 0 + all_relative_imports.extend(files_to_check) + + return all_relative_imports + + +def get_imports(filename: str | os.PathLike) -> list[str]: + """ + Extracts all the libraries (not relative imports this time) that are imported in a file. + + Args: + filename (`str` or `os.PathLike`): The module file to inspect. + + Returns: + `list[str]`: The list of all packages required to use the input module. + """ + with open(filename, encoding="utf-8") as f: + content = f.read() + imported_modules = set() + + import transformers.utils + + def recursive_look_for_imports(node): + if isinstance(node, ast.Try): + return # Don't recurse into Try blocks and ignore imports in them + elif isinstance(node, ast.If): + test = node.test + for condition_node in ast.walk(test): + if isinstance(condition_node, ast.Call): + check_function = getattr(condition_node.func, "id", "") + if ( + check_function.endswith("available") + and check_function.startswith("is_flash_attn") + or hasattr(transformers.utils.import_utils, check_function) + ): + # Don't recurse into "if flash_attn_available()" or any "if library_available" blocks + # that appears in `transformers.utils.import_utils` and ignore imports in them + return + elif isinstance(node, ast.Import): + # Handle 'import x' statements + for alias in node.names: + top_module = alias.name.split(".")[0] + if top_module: + imported_modules.add(top_module) + elif isinstance(node, ast.ImportFrom): + # Handle 'from x import y' statements, ignoring relative imports + if node.level == 0 and node.module: + top_module = node.module.split(".")[0] + if top_module: + imported_modules.add(top_module) + + # Recursively visit all children + for child in ast.iter_child_nodes(node): + recursive_look_for_imports(child) + + tree = ast.parse(content) + recursive_look_for_imports(tree) + + return sorted(imported_modules) + + +def check_imports(filename: str | os.PathLike) -> list[str]: + """ + Check if the current Python environment contains all the libraries that are imported in a file. Will raise if a + library is missing. + + Args: + filename (`str` or `os.PathLike`): The module file to check. + + Returns: + `list[str]`: The list of relative imports in the file. + """ + imports = get_imports(filename) + missing_packages = [] + for imp in imports: + try: + importlib.import_module(imp) + except ImportError as exception: + logger.warning(f"Encountered exception while importing {imp}: {exception}") + # Some packages can fail with an ImportError because of a dependency issue. + # This check avoids hiding such errors. + # See https://github.com/huggingface/transformers/issues/33604 + if "No module named" in str(exception): + missing_packages.append(imp) + else: + raise + + if len(missing_packages) > 0: + raise ImportError( + "This modeling file requires the following packages that were not found in your environment: " + f"{', '.join(missing_packages)}. Run `pip install {' '.join(missing_packages)}`" + ) + + return get_relative_imports(filename) + + +def get_class_in_module( + class_name: str, + module_path: str | os.PathLike, + *, + force_reload: bool = False, +) -> type: + """ + Import a module on the cache directory for modules and extract a class from it. + + Args: + class_name (`str`): The name of the class to import. + module_path (`str` or `os.PathLike`): The path to the module to import. + force_reload (`bool`, *optional*, defaults to `False`): + Whether to reload the dynamic module from file if it already exists in `sys.modules`. + Otherwise, the module is only reloaded if the file has changed. + + Returns: + `typing.Type`: The class looked for. + """ + name = os.path.normpath(module_path) + name = name.removesuffix(".py") + name = name.replace(os.path.sep, ".") + module_file: Path = Path(HF_MODULES_CACHE) / module_path + with _HF_REMOTE_CODE_LOCK: + if force_reload: + sys.modules.pop(name, None) + importlib.invalidate_caches() + cached_module: ModuleType | None = sys.modules.get(name) + module_spec = importlib.util.spec_from_file_location(name, location=module_file) + + # Hash the module file and all its relative imports to check if we need to reload it + module_files: list[Path] = [module_file] + sorted(map(Path, get_relative_import_files(module_file))) + module_hash: str = hashlib.sha256(b"".join(bytes(f) + f.read_bytes() for f in module_files)).hexdigest() + + module: ModuleType + if cached_module is None: + module = importlib.util.module_from_spec(module_spec) + # insert it into sys.modules before any loading begins + sys.modules[name] = module + else: + module = cached_module + # reload in both cases, unless the module is already imported and the hash hits + if getattr(module, "__transformers_module_hash__", "") != module_hash: + module_spec.loader.exec_module(module) + module.__transformers_module_hash__ = module_hash + return getattr(module, class_name) + + +def get_cached_module_file( + pretrained_model_name_or_path: str | os.PathLike, + module_file: str, + cache_dir: str | os.PathLike | None = None, + force_download: bool = False, + proxies: dict[str, str] | None = None, + token: bool | str | None = None, + revision: str | None = None, + local_files_only: bool = False, + repo_type: str | None = None, + _commit_hash: str | None = None, + **deprecated_kwargs, +) -> str: + """ + Prepares Downloads a module from a local folder or a distant repo and returns its path inside the cached + Transformers module. + + Args: + pretrained_model_name_or_path (`str` or `os.PathLike`): + This can be either: + + - a string, the *model id* of a pretrained model configuration hosted inside a model repo on + huggingface.co. + - a path to a *directory* containing a configuration file saved using the + [`~PreTrainedTokenizer.save_pretrained`] method, e.g., `./my_model_directory/`. + + module_file (`str`): + The name of the module file containing the class to look for. + cache_dir (`str` or `os.PathLike`, *optional*): + Path to a directory in which a downloaded pretrained model configuration should be cached if the standard + cache should not be used. + force_download (`bool`, *optional*, defaults to `False`): + Whether or not to force to (re-)download the configuration files and override the cached versions if they + exist. + proxies (`dict[str, str]`, *optional*): + A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128', + 'http://hostname': 'foo.bar:4012'}.` The proxies are used on each request. + token (`str` or *bool*, *optional*): + The token to use as HTTP bearer authorization for remote files. If `True`, will use the token generated + when running `hf auth login` (stored in `~/.huggingface`). + revision (`str`, *optional*, defaults to `"main"`): + The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a + git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + identifier allowed by git. + local_files_only (`bool`, *optional*, defaults to `False`): + If `True`, will only try to load the tokenizer configuration from local files. + repo_type (`str`, *optional*): + Specify the repo type (useful when downloading from a space for instance). + + + + Passing `token=True` is required when you want to use a private model. + + + + Returns: + `str`: The path to the module inside the cache. + """ + if is_offline_mode() and not local_files_only: + logger.info("Offline mode: forcing local_files_only=True") + local_files_only = True + + # Download and cache module_file from the repo `pretrained_model_name_or_path` of grab it if it's a local file. + pretrained_model_name_or_path = str(pretrained_model_name_or_path) + is_local = os.path.isdir(pretrained_model_name_or_path) + if is_local: + submodule = _sanitize_module_name(os.path.basename(pretrained_model_name_or_path)) + else: + submodule = os.path.sep.join(map(_sanitize_module_name, pretrained_model_name_or_path.split("/"))) + cached_module = try_to_load_from_cache( + pretrained_model_name_or_path, module_file, cache_dir=cache_dir, revision=_commit_hash, repo_type=repo_type + ) + + new_files = [] + try: + # Load from URL or cache if already cached + resolved_module_file = cached_file( + pretrained_model_name_or_path, + module_file, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + revision=revision, + repo_type=repo_type, + _commit_hash=_commit_hash, + ) + if not is_local and cached_module != resolved_module_file: + new_files.append(module_file) + + except OSError: + logger.info(f"Could not locate the {module_file} inside {pretrained_model_name_or_path}.") + raise + + # Check we have all the requirements in our environment + modules_needed = check_imports(resolved_module_file) + + # Now we move the module inside our cached dynamic modules. + full_submodule = TRANSFORMERS_DYNAMIC_MODULE_NAME + os.path.sep + submodule + create_dynamic_module(full_submodule) + submodule_path = Path(HF_MODULES_CACHE) / full_submodule + if submodule == _sanitize_module_name(os.path.basename(pretrained_model_name_or_path)): + # We copy local files to avoid putting too many folders in sys.path. This copy is done when the file is new or + # has changed since last copy. + if not (submodule_path / module_file).exists() or not filecmp.cmp( + resolved_module_file, str(submodule_path / module_file) + ): + (submodule_path / module_file).parent.mkdir(parents=True, exist_ok=True) + shutil.copy(resolved_module_file, submodule_path / module_file) + importlib.invalidate_caches() + for module_needed in modules_needed: + module_needed = Path(module_file).parent / f"{module_needed}.py" + module_needed_file = os.path.join(pretrained_model_name_or_path, module_needed) + if not (submodule_path / module_needed).exists() or not filecmp.cmp( + module_needed_file, str(submodule_path / module_needed) + ): + shutil.copy(module_needed_file, submodule_path / module_needed) + importlib.invalidate_caches() + else: + # Get the commit hash + commit_hash = extract_commit_hash(resolved_module_file, _commit_hash) + + # The module file will end up being placed in a subfolder with the git hash of the repo. This way we get the + # benefit of versioning. + submodule_path = submodule_path / commit_hash + full_submodule = full_submodule + os.path.sep + commit_hash + full_submodule_module_file_path = os.path.join(full_submodule, module_file) + create_dynamic_module(Path(full_submodule_module_file_path).parent) + + if not (submodule_path / module_file).exists(): + shutil.copy(resolved_module_file, submodule_path / module_file) + importlib.invalidate_caches() + # Make sure we also have every file with relative + for module_needed in modules_needed: + if not ((submodule_path / module_file).parent / f"{module_needed}.py").exists(): + get_cached_module_file( + pretrained_model_name_or_path, + f"{Path(module_file).parent / module_needed}.py", + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + token=token, + revision=revision, + local_files_only=local_files_only, + _commit_hash=commit_hash, + ) + new_files.append(f"{module_needed}.py") + + if len(new_files) > 0 and revision is None: + new_files = "\n".join([f"- {f}" for f in new_files]) + repo_type_str = "" if repo_type is None else f"{repo_type}s/" + url = f"https://huggingface.co/{repo_type_str}{pretrained_model_name_or_path}" + logger.warning( + f"A new version of the following files was downloaded from {url}:\n{new_files}" + "\n. Make sure to double-check they do not contain any added malicious code. To avoid downloading new " + "versions of the code file, you can pin a revision." + ) + + return os.path.join(full_submodule, module_file) + + +def get_class_from_dynamic_module( + class_reference: str, + pretrained_model_name_or_path: str | os.PathLike, + cache_dir: str | os.PathLike | None = None, + force_download: bool = False, + proxies: dict[str, str] | None = None, + token: bool | str | None = None, + revision: str | None = None, + local_files_only: bool = False, + repo_type: str | None = None, + code_revision: str | None = None, + **kwargs, +) -> type: + """ + Extracts a class from a module file, present in the local folder or repository of a model. + + + + Calling this function will execute the code in the module file found locally or downloaded from the Hub. It should + therefore only be called on trusted repos. + + + + + + Args: + class_reference (`str`): + The full name of the class to load, including its module and optionally its repo. + pretrained_model_name_or_path (`str` or `os.PathLike`): + This can be either: + + - a string, the *model id* of a pretrained model configuration hosted inside a model repo on + huggingface.co. + - a path to a *directory* containing a configuration file saved using the + [`~PreTrainedTokenizer.save_pretrained`] method, e.g., `./my_model_directory/`. + + This is used when `class_reference` does not specify another repo. + module_file (`str`): + The name of the module file containing the class to look for. + class_name (`str`): + The name of the class to import in the module. + cache_dir (`str` or `os.PathLike`, *optional*): + Path to a directory in which a downloaded pretrained model configuration should be cached if the standard + cache should not be used. + force_download (`bool`, *optional*, defaults to `False`): + Whether or not to force to (re-)download the configuration files and override the cached versions if they + exist. + proxies (`dict[str, str]`, *optional*): + A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128', + 'http://hostname': 'foo.bar:4012'}.` The proxies are used on each request. + token (`str` or `bool`, *optional*): + The token to use as HTTP bearer authorization for remote files. If `True`, will use the token generated + when running `hf auth login` (stored in `~/.huggingface`). + revision (`str`, *optional*, defaults to `"main"`): + The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a + git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + identifier allowed by git. + local_files_only (`bool`, *optional*, defaults to `False`): + If `True`, will only try to load the tokenizer configuration from local files. + repo_type (`str`, *optional*): + Specify the repo type (useful when downloading from a space for instance). + code_revision (`str`, *optional*, defaults to `"main"`): + The specific revision to use for the code on the Hub, if the code leaves in a different repository than the + rest of the model. It can be a branch name, a tag name, or a commit id, since we use a git-based system for + storing models and other artifacts on huggingface.co, so `revision` can be any identifier allowed by git. + + + + Passing `token=True` is required when you want to use a private model. + + + + Returns: + `typing.Type`: The class, dynamically imported from the module. + + Examples: + + ```python + # Download module `modeling.py` from huggingface.co and cache then extract the class `MyBertModel` from this + # module. + cls = get_class_from_dynamic_module("modeling.MyBertModel", "sgugger/my-bert-model") + + # Download module `modeling.py` from a given repo and cache then extract the class `MyBertModel` from this + # module. + cls = get_class_from_dynamic_module("sgugger/my-bert-model--modeling.MyBertModel", "sgugger/another-bert-model") + ```""" + # Catch the name of the repo if it's specified in `class_reference` + if "--" in class_reference: + repo_id, class_reference = class_reference.split("--") + else: + repo_id = pretrained_model_name_or_path + module_file, class_name = class_reference.split(".") + + if code_revision is None and pretrained_model_name_or_path == repo_id: + code_revision = revision + # And lastly we get the class inside our newly created module + final_module = get_cached_module_file( + repo_id, + module_file + ".py", + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + token=token, + revision=code_revision, + local_files_only=local_files_only, + repo_type=repo_type, + ) + return get_class_in_module(class_name, final_module, force_reload=force_download) + + +def custom_object_save(obj: Any, folder: str | os.PathLike, config: dict | None = None) -> list[str]: + """ + Save the modeling files corresponding to a custom model/configuration/tokenizer etc. in a given folder. Optionally + adds the proper fields in a config. + + Args: + obj (`Any`): The object for which to save the module files. + folder (`str` or `os.PathLike`): The folder where to save. + config (`PreTrainedConfig` or dictionary, `optional`): + A config in which to register the auto_map corresponding to this custom object. + + Returns: + `list[str]`: The list of files saved. + """ + if obj.__module__ == "__main__": + logger.warning( + f"We can't save the code defining {obj} in {folder} as it's been defined in __main__. You should put " + "this code in a separate module so we can include it in the saved folder and make it easier to share via " + "the Hub." + ) + return + + def _set_auto_map_in_config(_config): + module_name = obj.__class__.__module__ + last_module = module_name.split(".")[-1] + full_name = f"{last_module}.{obj.__class__.__name__}" + # Special handling for tokenizers + if "Tokenizer" in full_name: + slow_tokenizer_class = None + fast_tokenizer_class = None + if obj.__class__.__name__.endswith("Fast"): + # Fast tokenizer: we have the fast tokenizer class and we may have the slow one has an attribute. + fast_tokenizer_class = f"{last_module}.{obj.__class__.__name__}" + if getattr(obj, "slow_tokenizer_class", None) is not None: + slow_tokenizer = getattr(obj, "slow_tokenizer_class") + slow_tok_module_name = slow_tokenizer.__module__ + last_slow_tok_module = slow_tok_module_name.split(".")[-1] + slow_tokenizer_class = f"{last_slow_tok_module}.{slow_tokenizer.__name__}" + else: + # Slow tokenizer: no way to have the fast class + slow_tokenizer_class = f"{last_module}.{obj.__class__.__name__}" + + full_name = (slow_tokenizer_class, fast_tokenizer_class) + + if isinstance(_config, dict): + auto_map = _config.get("auto_map", {}) + auto_map[obj._auto_class] = full_name + _config["auto_map"] = auto_map + elif getattr(_config, "auto_map", None) is not None: + _config.auto_map[obj._auto_class] = full_name + else: + _config.auto_map = {obj._auto_class: full_name} + + # Add object class to the config auto_map + if isinstance(config, (list, tuple)): + for cfg in config: + _set_auto_map_in_config(cfg) + elif config is not None: + _set_auto_map_in_config(config) + + result = [] + # Copy module file to the output folder. + object_file = sys.modules[obj.__module__].__file__ + dest_file = Path(folder) / (Path(object_file).name) + shutil.copy(object_file, dest_file) + result.append(dest_file) + + # Gather all relative imports recursively and make sure they are copied as well. + for needed_file in get_relative_import_files(object_file): + dest_file = Path(folder) / (Path(needed_file).name) + shutil.copy(needed_file, dest_file) + result.append(dest_file) + + return result + + +def _raise_timeout_error(signum, frame): + raise ValueError( + "Loading this model requires you to execute custom code contained in the model repository on your local " + "machine. Please set the option `trust_remote_code=True` to permit loading of this model." + ) + + +TIME_OUT_REMOTE_CODE = 15 + + +def resolve_trust_remote_code( + trust_remote_code, model_name, has_local_code, has_remote_code, error_message=None, upstream_repo=None +): + """ + Resolves the `trust_remote_code` argument. If there is remote code to be loaded, the user must opt-in to loading + it. + + Args: + trust_remote_code (`bool` or `None`): + User-defined `trust_remote_code` value. + model_name (`str`): + The name of the model repository in huggingface.co. + has_local_code (`bool`): + Whether the model has local code. + has_remote_code (`bool`): + Whether the model has remote code. + error_message (`str`, *optional*): + Custom error message to display if there is remote code to load and the user didn't opt-in. If unset, the error + message will be regarding loading a model with custom code. + + Returns: + The resolved `trust_remote_code` value. + """ + if error_message is None: + if upstream_repo is not None: + error_message = ( + f"The repository {model_name} references custom code contained in {upstream_repo} which " + f"must be executed to correctly load the model. You can inspect the repository " + f"content at https://hf.co/{upstream_repo} .\n" + ) + elif os.path.isdir(model_name): + error_message = ( + f"The repository {model_name} contains custom code which must be executed " + f"to correctly load the model. You can inspect the repository " + f"content at {os.path.abspath(model_name)} .\n" + ) + else: + error_message = ( + f"The repository {model_name} contains custom code which must be executed " + f"to correctly load the model. You can inspect the repository " + f"content at https://hf.co/{model_name} .\n" + ) + + if trust_remote_code is None: + if has_local_code: + trust_remote_code = False + elif has_remote_code and TIME_OUT_REMOTE_CODE > 0: + prev_sig_handler = None + try: + prev_sig_handler = signal.signal(signal.SIGALRM, _raise_timeout_error) + signal.alarm(TIME_OUT_REMOTE_CODE) + while trust_remote_code is None: + answer = input( + f"{error_message} You can inspect the repository content at https://hf.co/{model_name}.\n" + f"You can avoid this prompt in future by passing the argument `trust_remote_code=True`.\n\n" + f"Do you wish to run the custom code? [y/N] " + ) + if answer.lower() in ["yes", "y", "1"]: + trust_remote_code = True + elif answer.lower() in ["no", "n", "0", ""]: + trust_remote_code = False + signal.alarm(0) + except Exception: + # OS which does not support signal.SIGALRM + raise ValueError( + f"{error_message} You can inspect the repository content at https://hf.co/{model_name}.\n" + f"Please pass the argument `trust_remote_code=True` to allow custom code to be run." + ) + finally: + if prev_sig_handler is not None: + signal.signal(signal.SIGALRM, prev_sig_handler) + signal.alarm(0) + elif has_remote_code: + # For the CI which puts the timeout at 0 + _raise_timeout_error(None, None) + + if has_remote_code and not has_local_code and not trust_remote_code: + raise ValueError( + f"{error_message} You can inspect the repository content at https://hf.co/{model_name}.\n" + f"Please pass the argument `trust_remote_code=True` to allow custom code to be run." + ) + + return trust_remote_code + + +def check_python_requirements(path_or_repo_id, requirements_file="requirements.txt", **kwargs): + """ + Tries to locate `requirements_file` in a local folder or repo, and confirms that the environment has all the + python dependencies installed. + + Args: + path_or_repo_id (`str` or `os.PathLike`): + This can be either: + - a string, the *model id* of a model repo on huggingface.co. + - a path to a *directory* potentially containing the file. + kwargs (`dict[str, Any]`, *optional*): + Additional arguments to pass to `cached_file`. + """ + failed = [] # error messages regarding requirements + try: + requirements = cached_file(path_or_repo_id=path_or_repo_id, filename=requirements_file, **kwargs) + with open(requirements, "r") as f: + requirements = f.readlines() + + for requirement in requirements: + requirement = requirement.strip() + if not requirement or requirement.startswith("#"): # skip empty lines and comments + continue + + try: + # e.g. "torch>2.6.0" -> "torch", ">", "2.6.0" + package_name, delimiter, version_number = split_package_version(requirement) + except ValueError: # e.g. "torch", as opposed to "torch>2.6.0" + package_name = requirement + delimiter, version_number = None, None + + try: + local_package_version = importlib.metadata.version(package_name) + except importlib.metadata.PackageNotFoundError: + failed.append(f"{requirement} (installed: None)") + continue + + if delimiter is not None and version_number is not None: + is_satisfied = VersionComparison.from_string(delimiter)( + version.parse(local_package_version), version.parse(version_number) + ) + else: + is_satisfied = True + + if not is_satisfied: + failed.append(f"{requirement} (installed: {local_package_version})") + + except OSError: # no requirements.txt + pass + + if failed: + raise ImportError( + f"Missing requirements in your local environment for `{path_or_repo_id}`:\n" + "\n".join(failed) + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/feature_extraction_sequence_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/feature_extraction_sequence_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..5e346d3e15e5a956785df989e20f624590be249c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/feature_extraction_sequence_utils.py @@ -0,0 +1,382 @@ +# Copyright 2021 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Sequence feature extraction class for common feature extractors to preprocess sequences. +""" + +import numpy as np + +from .audio_utils import is_valid_audio, load_audio +from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin +from .utils import PaddingStrategy, TensorType, is_torch_tensor, logging, to_numpy + + +logger = logging.get_logger(__name__) + + +class SequenceFeatureExtractor(FeatureExtractionMixin): + """ + This is a general feature extraction class for speech recognition. + + Args: + feature_size (`int`): + The feature dimension of the extracted features. + sampling_rate (`int`): + The sampling rate at which the audio files should be digitalized expressed in hertz (Hz). + padding_value (`float`): + The value that is used to fill the padding values / vectors. + """ + + def __init__(self, feature_size: int, sampling_rate: int, padding_value: float, **kwargs): + self.feature_size = feature_size + self.sampling_rate = sampling_rate + self.padding_value = padding_value + + self.padding_side = kwargs.pop("padding_side", "right") + self.return_attention_mask = kwargs.pop("return_attention_mask", True) + + super().__init__(**kwargs) + + def pad( + self, + processed_features: BatchFeature + | list[BatchFeature] + | dict[str, BatchFeature] + | dict[str, list[BatchFeature]] + | list[dict[str, BatchFeature]], + padding: bool | str | PaddingStrategy = True, + max_length: int | None = None, + truncation: bool = False, + pad_to_multiple_of: int | None = None, + return_attention_mask: bool | None = None, + return_tensors: str | TensorType | None = None, + ) -> BatchFeature: + """ + Pad input values / input vectors or a batch of input values / input vectors up to predefined length or to the + max sequence length in the batch. + + Padding side (left/right) padding values are defined at the feature extractor level (with `self.padding_side`, + `self.padding_value`) + + + + If the `processed_features` passed are dictionary of numpy arrays or PyTorch tensors the + result will use the same type unless you provide a different tensor type with `return_tensors`. In the case of + PyTorch tensors, you will lose the specific device of your tensors however. + + + + Args: + processed_features ([`BatchFeature`], list of [`BatchFeature`], `dict[str, list[float]]`, `dict[str, list[list[float]]` or `list[dict[str, list[float]]]`): + Processed inputs. Can represent one input ([`BatchFeature`] or `dict[str, list[float]]`) or a batch of + input values / vectors (list of [`BatchFeature`], *dict[str, list[list[float]]]* or *list[dict[str, + list[float]]]*) so you can use this method during preprocessing as well as in a PyTorch Dataloader + collate function. + + Instead of `list[float]` you can have tensors (numpy arrays or PyTorch tensors), + see the note above for the return type. + padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `True`): + Select a strategy to pad the returned sequences (according to the model's padding side and padding + index) among: + + - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single + sequence if provided). + - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum + acceptable input length for the model if that argument is not provided. + - `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different + lengths). + max_length (`int`, *optional*): + Maximum length of the returned list and optionally padding length (see above). + truncation (`bool`): + Activates truncation to cut input sequences longer than `max_length` to `max_length`. + pad_to_multiple_of (`int`, *optional*): + If set will pad the sequence to a multiple of the provided value. + + This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability + `>= 7.5` (Volta), or on TPUs which benefit from having sequence lengths be a multiple of 128. + return_attention_mask (`bool`, *optional*): + Whether to return the attention mask. If left to the default, will return the attention mask according + to the specific feature_extractor's default. + + [What are attention masks?](../glossary#attention-mask) + return_tensors (`str` or [`~utils.TensorType`], *optional*): + If set, will return tensors instead of list of python integers. Acceptable values are: + + - `'pt'`: Return PyTorch `torch.Tensor` objects. + - `'np'`: Return Numpy `np.ndarray` objects. + """ + # If we have a list of dicts, let's convert it in a dict of lists + # We do this to allow using this method as a collate_fn function in PyTorch Dataloader + if isinstance(processed_features, (list, tuple)) and isinstance(processed_features[0], (dict, BatchFeature)): + # Call .keys() explicitly for compatibility with TensorDict and other Mapping subclasses + processed_features = { + key: [example[key] for example in processed_features] for key in processed_features[0].keys() + } + + # The model's main input name, usually `input_values`, has be passed for padding + if self.model_input_names[0] not in processed_features: + raise ValueError( + "You should supply an instance of `transformers.BatchFeature` or list of `transformers.BatchFeature`" + f" to this method that includes {self.model_input_names[0]}, but you provided" + f" {list(processed_features.keys())}" + ) + + required_input = processed_features[self.model_input_names[0]] + return_attention_mask = ( + return_attention_mask if return_attention_mask is not None else self.return_attention_mask + ) + + if len(required_input) == 0: + if return_attention_mask: + processed_features["attention_mask"] = [] + return processed_features + + # If we have PyTorch tensors or lists as inputs, we cast them as Numpy arrays + # and rebuild them afterwards if no return_tensors is specified + # Note that we lose the specific device the tensor may be on for PyTorch + + first_element = required_input[0] + if isinstance(first_element, (list, tuple)): + # first_element might be an empty list/tuple in some edge cases so we grab the first non empty element. + index = 0 + while len(required_input[index]) == 0: + index += 1 + if index < len(required_input): + first_element = required_input[index][0] + + if return_tensors is None: + if is_torch_tensor(first_element): + return_tensors = "pt" + elif isinstance(first_element, (int, float, list, tuple, np.ndarray)): + return_tensors = "np" + else: + raise ValueError( + f"type of {first_element} unknown: {type(first_element)}. " + "Should be one of a python, numpy, or pytorch object." + ) + + for key, value in processed_features.items(): + if isinstance(value[0], (int, float)): + processed_features[key] = to_numpy(value) + else: + processed_features[key] = [to_numpy(v) for v in value] + + # Convert padding_strategy in PaddingStrategy + padding_strategy = self._get_padding_strategies(padding=padding, max_length=max_length) + + required_input = processed_features[self.model_input_names[0]] + + batch_size = len(required_input) + if not all(len(v) == batch_size for v in processed_features.values()): + raise ValueError("Some items in the output dictionary have a different batch size than others.") + + truncated_inputs = [] + for i in range(batch_size): + inputs = {k: v[i] for k, v in processed_features.items()} + # truncation + inputs_slice = self._truncate( + inputs, + max_length=max_length, + pad_to_multiple_of=pad_to_multiple_of, + truncation=truncation, + ) + truncated_inputs.append(inputs_slice) + + if padding_strategy == PaddingStrategy.LONGEST: + # make sure that `max_length` cannot be longer than the longest truncated length + max_length = max(len(input_slice[self.model_input_names[0]]) for input_slice in truncated_inputs) + padding_strategy = PaddingStrategy.MAX_LENGTH + + batch_outputs = {} + for i in range(batch_size): + # padding + outputs = self._pad( + truncated_inputs[i], + max_length=max_length, + padding_strategy=padding_strategy, + pad_to_multiple_of=pad_to_multiple_of, + return_attention_mask=return_attention_mask, + ) + + for key, value in outputs.items(): + if key not in batch_outputs: + batch_outputs[key] = [] + if value.dtype is np.dtype(np.float64): + value = value.astype(np.float32) + batch_outputs[key].append(value) + + return BatchFeature(batch_outputs, tensor_type=return_tensors) + + def _pad( + self, + processed_features: dict[str, np.ndarray] | BatchFeature, + max_length: int | None = None, + padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD, + pad_to_multiple_of: int | None = None, + return_attention_mask: bool | None = None, + ) -> dict: + """ + Pad inputs (on left/right and up to predefined length or max length in the batch) + + Args: + processed_features (`Union[dict[str, np.ndarray], BatchFeature]`): + Dictionary of input values (`np.ndarray[float]`) / input vectors (`list[np.ndarray[float]]`) or batch + of inputs values (`list[np.ndarray[int]]`) / input vectors (`list[np.ndarray[int]]`) + max_length (`int`, *optional*): + Maximum length of the returned list and optionally padding length (see below) + padding_strategy (`PaddingStrategy`, *optional*, default to `PaddingStrategy.DO_NOT_PAD`): + PaddingStrategy to use for padding. + + - PaddingStrategy.LONGEST Pad to the longest sequence in the batch + - PaddingStrategy.MAX_LENGTH: Pad to the max length (default) + - PaddingStrategy.DO_NOT_PAD: Do not pad + The feature_extractor padding sides are defined in self.padding_side: + + - 'left': pads on the left of the sequences + - 'right': pads on the right of the sequences + pad_to_multiple_of (`int`, *optional*): + Integer if set will pad the sequence to a multiple of the provided value. This is especially useful to + enable the use of Tensor Core on NVIDIA hardware with compute capability `>= 7.5` (Volta), or on TPUs + which benefit from having sequence lengths be a multiple of 128. + return_attention_mask (`bool`, *optional*): + Set to False to avoid returning attention mask (default: set to model specifics) + """ + required_input = processed_features[self.model_input_names[0]] + + if padding_strategy == PaddingStrategy.LONGEST: + max_length = len(required_input) + + if max_length is not None and pad_to_multiple_of is not None and (max_length % pad_to_multiple_of != 0): + max_length = ((max_length // pad_to_multiple_of) + 1) * pad_to_multiple_of + + needs_to_be_padded = padding_strategy != PaddingStrategy.DO_NOT_PAD and len(required_input) < max_length + + if return_attention_mask and "attention_mask" not in processed_features: + processed_features["attention_mask"] = np.ones(len(required_input), dtype=np.int32) + + if needs_to_be_padded: + difference = max_length - len(required_input) + if self.padding_side == "right": + if return_attention_mask: + processed_features["attention_mask"] = np.pad( + processed_features["attention_mask"], (0, difference) + ) + padding_shape = ((0, difference), (0, 0)) if self.feature_size > 1 else (0, difference) + processed_features[self.model_input_names[0]] = np.pad( + required_input, padding_shape, "constant", constant_values=self.padding_value + ) + elif self.padding_side == "left": + if return_attention_mask: + processed_features["attention_mask"] = np.pad( + processed_features["attention_mask"], (difference, 0) + ) + padding_shape = ((difference, 0), (0, 0)) if self.feature_size > 1 else (difference, 0) + processed_features[self.model_input_names[0]] = np.pad( + required_input, padding_shape, "constant", constant_values=self.padding_value + ) + else: + raise ValueError("Invalid padding strategy:" + str(self.padding_side)) + + return processed_features + + def _truncate( + self, + processed_features: dict[str, np.ndarray] | BatchFeature, + max_length: int | None = None, + pad_to_multiple_of: int | None = None, + truncation: bool | None = None, + ): + """ + Truncate inputs to predefined length or max length in the batch + + Args: + processed_features(`Union[dict[str, np.ndarray], BatchFeature]`): + Dictionary of input values (`np.ndarray[float]`) / input vectors (`list[np.ndarray[float]]`) or batch + of inputs values (`list[np.ndarray[int]]`) / input vectors (`list[np.ndarray[int]]`) + max_length (`int`, *optional*): + maximum length of the returned list and optionally padding length (see below) + pad_to_multiple_of (`int`, *optional*) : + Integer if set will pad the sequence to a multiple of the provided value. This is especially useful to + enable the use of Tensor Core on NVIDIA hardware with compute capability `>= 7.5` (Volta), or on TPUs + which benefit from having sequence lengths be a multiple of 128. + truncation (`bool`, *optional*): + Activates truncation to cut input sequences longer than `max_length` to `max_length`. + """ + if not truncation: + return processed_features + elif truncation and max_length is None: + raise ValueError("When setting ``truncation=True``, make sure that ``max_length`` is defined.") + + required_input = processed_features[self.model_input_names[0]] + + # find `max_length` that fits `pad_to_multiple_of` + if max_length is not None and pad_to_multiple_of is not None and (max_length % pad_to_multiple_of != 0): + max_length = ((max_length // pad_to_multiple_of) + 1) * pad_to_multiple_of + + needs_to_be_truncated = len(required_input) > max_length + + if needs_to_be_truncated: + processed_features[self.model_input_names[0]] = processed_features[self.model_input_names[0]][:max_length] + if "attention_mask" in processed_features: + processed_features["attention_mask"] = processed_features["attention_mask"][:max_length] + + return processed_features + + def _get_padding_strategies(self, padding=False, max_length=None): + """ + Find the correct padding strategy + """ + + # Get padding strategy + if padding is not False: + if padding is True: + padding_strategy = PaddingStrategy.LONGEST # Default to pad to the longest sequence in the batch + elif not isinstance(padding, PaddingStrategy): + padding_strategy = PaddingStrategy(padding) + elif isinstance(padding, PaddingStrategy): + padding_strategy = padding + else: + padding_strategy = PaddingStrategy.DO_NOT_PAD + + # Set max length if needed + if max_length is None: + if padding_strategy == PaddingStrategy.MAX_LENGTH: + raise ValueError( + f"When setting ``padding={PaddingStrategy.MAX_LENGTH}``, make sure that max_length is defined" + ) + + # Test if we have a padding value + if padding_strategy != PaddingStrategy.DO_NOT_PAD and (self.padding_value is None): + raise ValueError( + "Asking to pad but the feature_extractor does not have a padding value. Please select a value to use" + " as `padding_value`. For example: `feature_extractor.padding_value = 0.0`." + ) + + return padding_strategy + + def fetch_audio(self, audio_url_or_urls: str | list[str] | list[list[str]]): + """ + Convert a single or a list of urls into the corresponding `np.ndarray` objects. + + If a single url is passed, the return value will be a single object. If a list is passed a list of objects is + returned. + """ + if isinstance(audio_url_or_urls, list): + return [self.fetch_audio(x) for x in audio_url_or_urls] + elif isinstance(audio_url_or_urls, str): + return load_audio(audio_url_or_urls) + elif is_valid_audio(audio_url_or_urls): + return audio_url_or_urls + else: + raise TypeError(f"only a single or a list of entries is supported but got type={type(audio_url_or_urls)}") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/feature_extraction_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/feature_extraction_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..f1b66f752da4d879feaeb3eb1eebfb51086cd741 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/feature_extraction_utils.py @@ -0,0 +1,672 @@ +# Copyright 2021 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Feature extraction saving/loading class for common feature extractors. +""" + +import copy +import json +import os +from collections import UserDict +from typing import TYPE_CHECKING, Any, TypeVar, Union + +import numpy as np +from huggingface_hub import create_repo, is_offline_mode + +from .dynamic_module_utils import custom_object_save +from .utils import ( + FEATURE_EXTRACTOR_NAME, + PROCESSOR_NAME, + PushToHubMixin, + TensorType, + _is_tensor_or_array_like, + copy_func, + is_numpy_array, + is_torch_available, + is_torch_device, + is_torch_dtype, + logging, + requires_backends, + safe_load_json_file, +) +from .utils.hub import cached_file + + +if TYPE_CHECKING: + from .feature_extraction_sequence_utils import SequenceFeatureExtractor + + +logger = logging.get_logger(__name__) + +PreTrainedFeatureExtractor = Union["SequenceFeatureExtractor"] + +# type hinting: specifying the type of feature extractor class that inherits from FeatureExtractionMixin +SpecificFeatureExtractorType = TypeVar("SpecificFeatureExtractorType", bound="FeatureExtractionMixin") + + +class BatchFeature(UserDict): + r""" + Holds the output of the [`~SequenceFeatureExtractor.pad`] and feature extractor specific `__call__` methods. + + This class is derived from a python dictionary and can be used as a dictionary. + + Args: + data (`dict`, *optional*): + Dictionary of lists/arrays/tensors returned by the __call__/pad methods ('input_values', 'attention_mask', + etc.). + tensor_type (`Union[None, str, TensorType]`, *optional*): + You can give a tensor_type here to convert the lists of integers in PyTorch/Numpy Tensors at + initialization. + skip_tensor_conversion (`list[str]` or `set[str]`, *optional*): + List or set of keys that should NOT be converted to tensors, even when `tensor_type` is specified. + """ + + def __init__( + self, + data: dict[str, Any] | None = None, + tensor_type: None | str | TensorType = None, + skip_tensor_conversion: list[str] | set[str] | None = None, + ): + super().__init__(data) + self.skip_tensor_conversion = skip_tensor_conversion + self.convert_to_tensors(tensor_type=tensor_type) + + def __getitem__(self, item: str) -> Any: + """ + If the key is a string, returns the value of the dict associated to `key` ('input_values', 'attention_mask', + etc.). + """ + if isinstance(item, str): + return self.data[item] + else: + raise KeyError("Indexing with integers is not available when using Python based feature extractors") + + def __getattr__(self, item: str): + try: + return self.data[item] + except KeyError: + raise AttributeError + + def __getstate__(self): + return {"data": self.data} + + def __setstate__(self, state): + if "data" in state: + self.data = state["data"] + + def _get_is_as_tensor_fns(self, tensor_type: str | TensorType | None = None): + if tensor_type is None: + return None, None + + # Convert to TensorType + if not isinstance(tensor_type, TensorType): + tensor_type = TensorType(tensor_type) + + if tensor_type == TensorType.PYTORCH: + if not is_torch_available(): + raise ImportError("Unable to convert output to PyTorch tensors format, PyTorch is not installed.") + import torch + + def as_tensor(value): + if torch.is_tensor(value): + return value + + # stack list of tensors if tensor_type is PyTorch (# torch.tensor() does not support list of tensors) + if isinstance(value, (list, tuple)) and len(value) > 0 and torch.is_tensor(value[0]): + return torch.stack(value) + + # convert list of numpy arrays to numpy array (stack) if tensor_type is Numpy + if isinstance(value, (list, tuple)) and len(value) > 0: + if isinstance(value[0], np.ndarray): + value = np.array(value) + elif ( + isinstance(value[0], (list, tuple)) + and len(value[0]) > 0 + and isinstance(value[0][0], np.ndarray) + ): + value = np.array(value) + if isinstance(value, np.ndarray): + return torch.from_numpy(value) + else: + return torch.tensor(value) + + is_tensor = torch.is_tensor + else: + + def as_tensor(value, dtype=None): + if isinstance(value, (list, tuple)) and isinstance(value[0], (list, tuple, np.ndarray)): + value_lens = [len(val) for val in value] + if len(set(value_lens)) > 1 and dtype is None: + # we have a ragged list so handle explicitly + value = as_tensor([np.asarray(val) for val in value], dtype=object) + return np.asarray(value, dtype=dtype) + + is_tensor = is_numpy_array + return is_tensor, as_tensor + + def convert_to_tensors( + self, + tensor_type: str | TensorType | None = None, + skip_tensor_conversion: list[str] | set[str] | None = None, + ): + """ + Convert the inner content to tensors. + + Args: + tensor_type (`str` or [`~utils.TensorType`], *optional*): + The type of tensors to use. If `str`, should be one of the values of the enum [`~utils.TensorType`]. If + `None`, no modification is done. + skip_tensor_conversion (`list[str]` or `set[str]`, *optional*): + List or set of keys that should NOT be converted to tensors, even when `tensor_type` is specified. + + Note: + Values that don't have an array-like structure (e.g., strings, dicts, lists of strings) are + automatically skipped and won't be converted to tensors. Ragged arrays (lists of arrays with + different lengths) are still attempted, though they may raise errors during conversion. + """ + if tensor_type is None: + return self + + is_tensor, as_tensor = self._get_is_as_tensor_fns(tensor_type) + skip_tensor_conversion = ( + skip_tensor_conversion if skip_tensor_conversion is not None else self.skip_tensor_conversion + ) + + # Do the tensor conversion in batch + for key, value in self.items(): + # Skip keys explicitly marked for no conversion + if skip_tensor_conversion and key in skip_tensor_conversion: + continue + + # Skip values that are not array-like + if not _is_tensor_or_array_like(value): + continue + + try: + if not is_tensor(value): + tensor = as_tensor(value) + self[key] = tensor + except Exception as e: + if key == "overflowing_values": + raise ValueError( + f"Unable to create tensor for '{key}' with overflowing values of different lengths. " + f"Original error: {str(e)}" + ) from e + raise ValueError( + f"Unable to convert output '{key}' (type: {type(value).__name__}) to tensor: {str(e)}\n" + f"You can try:\n" + f" 1. Use padding=True to ensure all outputs have the same shape\n" + f" 2. Set return_tensors=None to return Python objects instead of tensors" + ) from e + + return self + + def to(self, *args, **kwargs) -> "BatchFeature": + """ + Send all values to device by calling `v.to(*args, **kwargs)` (PyTorch only). This should support casting in + different `dtypes` and sending the `BatchFeature` to a different `device`. + + Args: + args (`Tuple`): + Will be passed to the `to(...)` function of the tensors. + kwargs (`Dict`, *optional*): + Will be passed to the `to(...)` function of the tensors. + To enable asynchronous data transfer, set the `non_blocking` flag in `kwargs` (defaults to `False`). + + Returns: + [`BatchFeature`]: The same instance after modification. + """ + requires_backends(self, ["torch"]) + import torch + + device = kwargs.get("device") + non_blocking = kwargs.get("non_blocking", False) + # Check if the args are a device or a dtype + if device is None and len(args) > 0: + # device should be always the first argument + arg = args[0] + if is_torch_dtype(arg): + # The first argument is a dtype + pass + elif isinstance(arg, str) or is_torch_device(arg) or isinstance(arg, int): + device = arg + else: + # it's something else + raise ValueError(f"Attempting to cast a BatchFeature to type {str(arg)}. This is not supported.") + + # We cast only floating point tensors to avoid issues with tokenizers casting `LongTensor` to `FloatTensor` + def maybe_to(v): + # check if v is a floating point tensor + if isinstance(v, torch.Tensor) and torch.is_floating_point(v): + # cast and send to device + return v.to(*args, **kwargs) + elif isinstance(v, torch.Tensor) and device is not None: + return v.to(device=device, non_blocking=non_blocking) + # recursively handle lists and tuples + elif isinstance(v, (list, tuple)): + return type(v)(maybe_to(item) for item in v) + else: + return v + + self.data = {k: maybe_to(v) for k, v in self.items()} + return self + + +class FeatureExtractionMixin(PushToHubMixin): + """ + This is a feature extraction mixin used to provide saving/loading functionality for sequential and audio feature + extractors. + """ + + _auto_class = None + + def __init__(self, **kwargs): + """Set elements of `kwargs` as attributes.""" + # Pop "processor_class", it should not be saved in feature extractor config + kwargs.pop("processor_class", None) + # Additional attributes without default values + for key, value in kwargs.items(): + try: + setattr(self, key, value) + except AttributeError as err: + logger.error(f"Can't set {key} with value {value} for {self}") + raise err + + @classmethod + def from_pretrained( + cls: type[SpecificFeatureExtractorType], + pretrained_model_name_or_path: str | os.PathLike, + cache_dir: str | os.PathLike | None = None, + force_download: bool = False, + local_files_only: bool = False, + token: str | bool | None = None, + revision: str = "main", + **kwargs, + ) -> SpecificFeatureExtractorType: + r""" + Instantiate a type of [`~feature_extraction_utils.FeatureExtractionMixin`] from a feature extractor, *e.g.* a + derived class of [`SequenceFeatureExtractor`]. + + Args: + pretrained_model_name_or_path (`str` or `os.PathLike`): + This can be either: + + - a string, the *model id* of a pretrained feature_extractor hosted inside a model repo on + huggingface.co. + - a path to a *directory* containing a feature extractor file saved using the + [`~feature_extraction_utils.FeatureExtractionMixin.save_pretrained`] method, e.g., + `./my_model_directory/`. + - a path or url to a saved feature extractor JSON *file*, e.g., + `./my_model_directory/preprocessor_config.json`. + cache_dir (`str` or `os.PathLike`, *optional*): + Path to a directory in which a downloaded pretrained model feature extractor should be cached if the + standard cache should not be used. + force_download (`bool`, *optional*, defaults to `False`): + Whether or not to force to (re-)download the feature extractor files and override the cached versions + if they exist. + proxies (`dict[str, str]`, *optional*): + A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128', + 'http://hostname': 'foo.bar:4012'}.` The proxies are used on each request. + token (`str` or `bool`, *optional*): + The token to use as HTTP bearer authorization for remote files. If `True`, or not specified, will use + the token generated when running `hf auth login` (stored in `~/.huggingface`). + revision (`str`, *optional*, defaults to `"main"`): + The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a + git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + identifier allowed by git. + + + + + To test a pull request you made on the Hub, you can pass `revision="refs/pr/"`. + + + + return_unused_kwargs (`bool`, *optional*, defaults to `False`): + If `False`, then this function returns just the final feature extractor object. If `True`, then this + functions returns a `Tuple(feature_extractor, unused_kwargs)` where *unused_kwargs* is a dictionary + consisting of the key/value pairs whose keys are not feature extractor attributes: i.e., the part of + `kwargs` which has not been used to update `feature_extractor` and is otherwise ignored. + kwargs (`dict[str, Any]`, *optional*): + The values in kwargs of any keys which are feature extractor attributes will be used to override the + loaded values. Behavior concerning key/value pairs whose keys are *not* feature extractor attributes is + controlled by the `return_unused_kwargs` keyword parameter. + + Returns: + A feature extractor of type [`~feature_extraction_utils.FeatureExtractionMixin`]. + + Examples: + + ```python + # We can't instantiate directly the base class *FeatureExtractionMixin* nor *SequenceFeatureExtractor* so let's show the examples on a + # derived class: *Wav2Vec2FeatureExtractor* + feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained( + "facebook/wav2vec2-base-960h" + ) # Download feature_extraction_config from huggingface.co and cache. + feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained( + "./test/saved_model/" + ) # E.g. feature_extractor (or model) was saved using *save_pretrained('./test/saved_model/')* + feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("./test/saved_model/preprocessor_config.json") + feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained( + "facebook/wav2vec2-base-960h", return_attention_mask=False, foo=False + ) + assert feature_extractor.return_attention_mask is False + feature_extractor, unused_kwargs = Wav2Vec2FeatureExtractor.from_pretrained( + "facebook/wav2vec2-base-960h", return_attention_mask=False, foo=False, return_unused_kwargs=True + ) + assert feature_extractor.return_attention_mask is False + assert unused_kwargs == {"foo": False} + ```""" + kwargs["cache_dir"] = cache_dir + kwargs["force_download"] = force_download + kwargs["local_files_only"] = local_files_only + kwargs["revision"] = revision + + if token is not None: + kwargs["token"] = token + + feature_extractor_dict, kwargs = cls.get_feature_extractor_dict(pretrained_model_name_or_path, **kwargs) + + return cls.from_dict(feature_extractor_dict, **kwargs) + + def save_pretrained(self, save_directory: str | os.PathLike, push_to_hub: bool = False, **kwargs): + """ + Save a feature_extractor object to the directory `save_directory`, so that it can be re-loaded using the + [`~feature_extraction_utils.FeatureExtractionMixin.from_pretrained`] class method. + + Args: + save_directory (`str` or `os.PathLike`): + Directory where the feature extractor JSON file will be saved (will be created if it does not exist). + push_to_hub (`bool`, *optional*, defaults to `False`): + Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the + repository you want to push to with `repo_id` (will default to the name of `save_directory` in your + namespace). + kwargs (`dict[str, Any]`, *optional*): + Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method. + """ + if os.path.isfile(save_directory): + raise AssertionError(f"Provided path ({save_directory}) should be a directory, not a file") + + os.makedirs(save_directory, exist_ok=True) + + if push_to_hub: + commit_message = kwargs.pop("commit_message", None) + repo_id = kwargs.pop("repo_id", save_directory.split(os.path.sep)[-1]) + repo_id = create_repo(repo_id, exist_ok=True, **kwargs).repo_id + files_timestamps = self._get_files_timestamps(save_directory) + + # If we have a custom config, we copy the file defining it in the folder and set the attributes so it can be + # loaded from the Hub. + if self._auto_class is not None: + custom_object_save(self, save_directory, config=self) + + # If we save using the predefined names, we can load using `from_pretrained` + output_feature_extractor_file = os.path.join(save_directory, FEATURE_EXTRACTOR_NAME) + + self.to_json_file(output_feature_extractor_file) + logger.info(f"Feature extractor saved in {output_feature_extractor_file}") + + if push_to_hub: + self._upload_modified_files( + save_directory, + repo_id, + files_timestamps, + commit_message=commit_message, + token=kwargs.get("token"), + ) + + return [output_feature_extractor_file] + + @classmethod + def get_feature_extractor_dict( + cls, pretrained_model_name_or_path: str | os.PathLike, **kwargs + ) -> tuple[dict[str, Any], dict[str, Any]]: + """ + From a `pretrained_model_name_or_path`, resolve to a dictionary of parameters, to be used for instantiating a + feature extractor of type [`~feature_extraction_utils.FeatureExtractionMixin`] using `from_dict`. + + Parameters: + pretrained_model_name_or_path (`str` or `os.PathLike`): + The identifier of the pre-trained checkpoint from which we want the dictionary of parameters. + + Returns: + `tuple[Dict, Dict]`: The dictionary(ies) that will be used to instantiate the feature extractor object. + """ + cache_dir = kwargs.pop("cache_dir", None) + force_download = kwargs.pop("force_download", False) + proxies = kwargs.pop("proxies", None) + subfolder = kwargs.pop("subfolder", None) + token = kwargs.pop("token", None) + local_files_only = kwargs.pop("local_files_only", False) + revision = kwargs.pop("revision", None) + + from_pipeline = kwargs.pop("_from_pipeline", None) + from_auto_class = kwargs.pop("_from_auto", False) + + user_agent = {"file_type": "feature extractor", "from_auto_class": from_auto_class} + if from_pipeline is not None: + user_agent["using_pipeline"] = from_pipeline + + if is_offline_mode() and not local_files_only: + logger.info("Offline mode: forcing local_files_only=True") + local_files_only = True + + pretrained_model_name_or_path = str(pretrained_model_name_or_path) + is_local = os.path.isdir(pretrained_model_name_or_path) + if os.path.isdir(pretrained_model_name_or_path): + feature_extractor_file = os.path.join(pretrained_model_name_or_path, FEATURE_EXTRACTOR_NAME) + if os.path.isfile(pretrained_model_name_or_path): + resolved_feature_extractor_file = pretrained_model_name_or_path + resolved_processor_file = None + is_local = True + else: + feature_extractor_file = FEATURE_EXTRACTOR_NAME + try: + # Load from local folder or from cache or download from model Hub and cache + resolved_processor_file = cached_file( + pretrained_model_name_or_path, + filename=PROCESSOR_NAME, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _raise_exceptions_for_missing_entries=False, + ) + resolved_feature_extractor_file = cached_file( + pretrained_model_name_or_path, + filename=feature_extractor_file, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _raise_exceptions_for_missing_entries=False, + ) + except OSError: + # Raise any environment error raise by `cached_file`. It will have a helpful error message adapted to + # the original exception. + raise + except Exception: + # For any other exception, we throw a generic error. + raise OSError( + f"Can't load feature extractor for '{pretrained_model_name_or_path}'. If you were trying to load" + " it from 'https://huggingface.co/models', make sure you don't have a local directory with the" + f" same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a" + f" directory containing a {FEATURE_EXTRACTOR_NAME} file" + ) + + # Load feature_extractor dict. Priority goes as (nested config if found -> image processor config) + # We are downloading both configs because almost all models have a `processor_config.json` but + # not all of these are nested. We need to check if it was saved recebtly as nested or if it is legacy style + feature_extractor_dict = None + if resolved_processor_file is not None: + processor_dict = safe_load_json_file(resolved_processor_file) + if "feature_extractor" in processor_dict or "audio_processor" in processor_dict: + feature_extractor_dict = processor_dict.get("feature_extractor", processor_dict.get("audio_processor")) + + if resolved_feature_extractor_file is not None and feature_extractor_dict is None: + feature_extractor_dict = safe_load_json_file(resolved_feature_extractor_file) + + if feature_extractor_dict is None: + raise OSError( + f"Can't load feature extractor for '{pretrained_model_name_or_path}'. If you were trying to load" + " it from 'https://huggingface.co/models', make sure you don't have a local directory with the" + f" same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a" + f" directory containing a {feature_extractor_file} file" + ) + + if is_local: + logger.info(f"loading configuration file {resolved_feature_extractor_file}") + else: + logger.info( + f"loading configuration file {feature_extractor_file} from cache at {resolved_feature_extractor_file}" + ) + + return feature_extractor_dict, kwargs + + @classmethod + def from_dict( + cls, feature_extractor_dict: dict[str, Any], **kwargs + ) -> Union["FeatureExtractionMixin", tuple["FeatureExtractionMixin", dict[str, Any]]]: + """ + Instantiates a type of [`~feature_extraction_utils.FeatureExtractionMixin`] from a Python dictionary of + parameters. + + Args: + feature_extractor_dict (`dict[str, Any]`): + Dictionary that will be used to instantiate the feature extractor object. Such a dictionary can be + retrieved from a pretrained checkpoint by leveraging the + [`~feature_extraction_utils.FeatureExtractionMixin.to_dict`] method. + kwargs (`dict[str, Any]`): + Additional parameters from which to initialize the feature extractor object. + + Returns: + [`~feature_extraction_utils.FeatureExtractionMixin`]: The feature extractor object instantiated from those + parameters. + """ + return_unused_kwargs = kwargs.pop("return_unused_kwargs", False) + + # Update feature_extractor with kwargs if needed + to_remove = [] + for key, value in kwargs.items(): + if key in feature_extractor_dict: + feature_extractor_dict[key] = value + to_remove.append(key) + for key in to_remove: + kwargs.pop(key, None) + + feature_extractor = cls(**feature_extractor_dict) + + logger.info(f"Feature extractor {feature_extractor}") + if return_unused_kwargs: + return feature_extractor, kwargs + else: + return feature_extractor + + def to_dict(self) -> dict[str, Any]: + """ + Serializes this instance to a Python dictionary. Returns: + `dict[str, Any]`: Dictionary of all the attributes that make up this configuration instance. + """ + output = copy.deepcopy(self.__dict__) + output["feature_extractor_type"] = self.__class__.__name__ + if "mel_filters" in output: + del output["mel_filters"] + if "window" in output: + del output["window"] + return output + + @classmethod + def from_json_file(cls, json_file: str | os.PathLike) -> "FeatureExtractionMixin": + """ + Instantiates a feature extractor of type [`~feature_extraction_utils.FeatureExtractionMixin`] from the path to + a JSON file of parameters. + + Args: + json_file (`str` or `os.PathLike`): + Path to the JSON file containing the parameters. + + Returns: + A feature extractor of type [`~feature_extraction_utils.FeatureExtractionMixin`]: The feature_extractor + object instantiated from that JSON file. + """ + with open(json_file, encoding="utf-8") as reader: + text = reader.read() + feature_extractor_dict = json.loads(text) + return cls(**feature_extractor_dict) + + def to_json_string(self) -> str: + """ + Serializes this instance to a JSON string. + + Returns: + `str`: String containing all the attributes that make up this feature_extractor instance in JSON format. + """ + dictionary = self.to_dict() + + for key, value in dictionary.items(): + if isinstance(value, np.ndarray): + dictionary[key] = value.tolist() + + return json.dumps(dictionary, indent=2, sort_keys=True) + "\n" + + def to_json_file(self, json_file_path: str | os.PathLike): + """ + Save this instance to a JSON file. + + Args: + json_file_path (`str` or `os.PathLike`): + Path to the JSON file in which this feature_extractor instance's parameters will be saved. + """ + with open(json_file_path, "w", encoding="utf-8") as writer: + writer.write(self.to_json_string()) + + def __repr__(self): + return f"{self.__class__.__name__} {self.to_json_string()}" + + @classmethod + def register_for_auto_class(cls, auto_class="AutoFeatureExtractor"): + """ + Register this class with a given auto class. This should only be used for custom feature extractors as the ones + in the library are already mapped with `AutoFeatureExtractor`. + + + + Args: + auto_class (`str` or `type`, *optional*, defaults to `"AutoFeatureExtractor"`): + The auto class to register this new feature extractor with. + """ + if not isinstance(auto_class, str): + auto_class = auto_class.__name__ + + import transformers.models.auto as auto_module + + if not hasattr(auto_module, auto_class): + raise ValueError(f"{auto_class} is not a valid auto class.") + + cls._auto_class = auto_class + + +FeatureExtractionMixin.push_to_hub = copy_func(FeatureExtractionMixin.push_to_hub) +if FeatureExtractionMixin.push_to_hub.__doc__ is not None: + FeatureExtractionMixin.push_to_hub.__doc__ = FeatureExtractionMixin.push_to_hub.__doc__.format( + object="feature extractor", object_class="AutoFeatureExtractor", object_files="feature extractor file" + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/file_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/file_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..d733e70b728d63a13befc3a920acb3b982a91a13 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/file_utils.py @@ -0,0 +1,105 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +File utilities: utilities related to download and cache models + +This module should not be update anymore and is only left for backward compatibility. +""" + +from . import __version__ + +# Backward compatibility imports, to make sure all those objects can be found in file_utils +from .utils import ( + CLOUDFRONT_DISTRIB_PREFIX, + CONFIG_NAME, + DUMMY_INPUTS, + DUMMY_MASK, + ENV_VARS_TRUE_AND_AUTO_VALUES, + ENV_VARS_TRUE_VALUES, + FEATURE_EXTRACTOR_NAME, + HF_MODULES_CACHE, + MODEL_CARD_NAME, + MULTIPLE_CHOICE_DUMMY_INPUTS, + S3_BUCKET_PREFIX, + SENTENCEPIECE_UNDERLINE, + SPIECE_UNDERLINE, + TRANSFORMERS_DYNAMIC_MODULE_NAME, + WEIGHTS_INDEX_NAME, + WEIGHTS_NAME, + ContextManagers, + DummyObject, + EntryNotFoundError, + ExplicitEnum, + ModelOutput, + PaddingStrategy, + PushToHubMixin, + RepositoryNotFoundError, + RevisionNotFoundError, + TensorType, + _LazyModule, + add_code_sample_docstrings, + add_end_docstrings, + add_start_docstrings, + add_start_docstrings_to_model_forward, + copy_func, + define_sagemaker_information, + get_torch_version, + has_file, + http_user_agent, + is_apex_available, + is_bs4_available, + is_coloredlogs_available, + is_datasets_available, + is_detectron2_available, + is_faiss_available, + is_g2p_en_available, + is_in_notebook, + is_librosa_available, + is_onnx_available, + is_pandas_available, + is_phonemizer_available, + is_protobuf_available, + is_psutil_available, + is_py3nvml_available, + is_pyctcdecode_available, + is_pytesseract_available, + is_pytorch_quantization_available, + is_rjieba_available, + is_sagemaker_dp_enabled, + is_sagemaker_mp_enabled, + is_scipy_available, + is_sentencepiece_available, + is_seqio_available, + is_sklearn_available, + is_soundfile_available, + is_spacy_available, + is_speech_available, + is_tensor, + is_timm_available, + is_tokenizers_available, + is_torch_available, + is_torch_cuda_available, + is_torch_fx_proxy, + is_torch_mps_available, + is_torch_tf32_available, + is_torch_xla_available, + is_torchaudio_available, + is_training_run_on_sagemaker, + is_vision_available, + replace_return_docstrings, + requires_backends, + to_numpy, + to_py_obj, + torch_only_method, +) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/hf_argparser.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/hf_argparser.py new file mode 100644 index 0000000000000000000000000000000000000000..b9e6f99b041d6fdb7b9986f06bbb9db5383d5073 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/hf_argparser.py @@ -0,0 +1,426 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import dataclasses +import json +import os +import sys +import types +from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError +from collections.abc import Callable, Iterable +from copy import copy +from enum import Enum +from inspect import isclass +from pathlib import Path +from typing import Any, Literal, NewType, Union, get_type_hints + +import yaml + + +DataClass = NewType("DataClass", Any) +DataClassType = NewType("DataClassType", Any) + + +# From https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse +def string_to_bool(v): + if isinstance(v, bool): + return v + if v.lower() in ("yes", "true", "t", "y", "1"): + return True + elif v.lower() in ("no", "false", "f", "n", "0"): + return False + else: + raise ArgumentTypeError( + f"Truthy value expected: got {v} but expected one of yes/no, true/false, t/f, y/n, 1/0 (case insensitive)." + ) + + +def make_choice_type_function(choices: list) -> Callable[[str], Any]: + """ + Creates a mapping function from each choices string representation to the actual value. Used to support multiple + value types for a single argument. + + Args: + choices (list): List of choices. + + Returns: + Callable[[str], Any]: Mapping function from string representation to actual value for each choice. + """ + str_to_choice = {str(choice): choice for choice in choices} + return lambda arg: str_to_choice.get(arg, arg) + + +def HfArg( + *, + aliases: str | list[str] | None = None, + help: str | None = None, + default: Any = dataclasses.MISSING, + default_factory: Callable[[], Any] = dataclasses.MISSING, + metadata: dict | None = None, + **kwargs, +) -> dataclasses.Field: + """Argument helper enabling a concise syntax to create dataclass fields for parsing with `HfArgumentParser`. + + Example comparing the use of `HfArg` and `dataclasses.field`: + ``` + @dataclass + class Args: + regular_arg: str = dataclasses.field(default="Huggingface", metadata={"aliases": ["--example", "-e"], "help": "This syntax could be better!"}) + hf_arg: str = HfArg(default="Huggingface", aliases=["--example", "-e"], help="What a nice syntax!") + ``` + + Args: + aliases (Union[str, list[str]], optional): + Single string or list of strings of aliases to pass on to argparse, e.g. `aliases=["--example", "-e"]`. + Defaults to None. + help (str, optional): Help string to pass on to argparse that can be displayed with --help. Defaults to None. + default (Any, optional): + Default value for the argument. If not default or default_factory is specified, the argument is required. + Defaults to dataclasses.MISSING. + default_factory (Callable[[], Any], optional): + The default_factory is a 0-argument function called to initialize a field's value. It is useful to provide + default values for mutable types, e.g. lists: `default_factory=list`. Mutually exclusive with `default=`. + Defaults to dataclasses.MISSING. + metadata (dict, optional): Further metadata to pass on to `dataclasses.field`. Defaults to None. + + Returns: + Field: A `dataclasses.Field` with the desired properties. + """ + if metadata is None: + # Important, don't use as default param in function signature because dict is mutable and shared across function calls + metadata = {} + if aliases is not None: + metadata["aliases"] = aliases + if help is not None: + metadata["help"] = help + + return dataclasses.field(metadata=metadata, default=default, default_factory=default_factory, **kwargs) + + +class HfArgumentParser(ArgumentParser): + """ + This subclass of `argparse.ArgumentParser` uses type hints on dataclasses to generate arguments. + + The class is designed to play well with the native argparse. In particular, you can add more (non-dataclass backed) + arguments to the parser after initialization and you'll get the output back after parsing as an additional + namespace. Optional: To create sub argument groups use the `_argument_group_name` attribute in the dataclass. + + Args: + dataclass_types (`DataClassType` or `Iterable[DataClassType]`, *optional*): + Dataclass type, or list of dataclass types for which we will "fill" instances with the parsed args. + kwargs (`dict[str, Any]`, *optional*): + Passed to `argparse.ArgumentParser()` in the regular way. + """ + + dataclass_types: Iterable[DataClassType] + + def __init__(self, dataclass_types: DataClassType | Iterable[DataClassType] | None = None, **kwargs): + # Make sure dataclass_types is an iterable + if dataclass_types is None: + dataclass_types = [] + elif not isinstance(dataclass_types, Iterable): + dataclass_types = [dataclass_types] + + # To make the default appear when using --help + if "formatter_class" not in kwargs: + kwargs["formatter_class"] = ArgumentDefaultsHelpFormatter + super().__init__(**kwargs) + if dataclasses.is_dataclass(dataclass_types): + dataclass_types = [dataclass_types] + self.dataclass_types = list(dataclass_types) + for dtype in self.dataclass_types: + self._add_dataclass_arguments(dtype) + + @staticmethod + def _parse_dataclass_field(parser: ArgumentParser, field: dataclasses.Field): + # Long-option strings are conventionlly separated by hyphens rather + # than underscores, e.g., "--long-format" rather than "--long_format". + # Argparse converts hyphens to underscores so that the destination + # string is a valid attribute name. Hf_argparser should do the same. + long_options = [f"--{field.name}"] + if "_" in field.name: + long_options.append(f"--{field.name.replace('_', '-')}") + + kwargs = field.metadata.copy() + # field.metadata is not used at all by Data Classes, + # it is provided as a third-party extension mechanism. + if isinstance(field.type, str): + raise RuntimeError( + "Unresolved type detected, which should have been done with the help of " + "`typing.get_type_hints` method by default" + ) + + aliases = kwargs.pop("aliases", []) + if isinstance(aliases, str): + aliases = [aliases] + + origin_type = getattr(field.type, "__origin__", field.type) + if origin_type is Union or (hasattr(types, "UnionType") and isinstance(origin_type, types.UnionType)): + if str not in field.type.__args__ and ( + len(field.type.__args__) != 2 or type(None) not in field.type.__args__ + ): + raise ValueError( + "Only `Union[X, NoneType]` (i.e., `Optional[X]`) is allowed for `Union` because" + " the argument parser only supports one type per argument." + f" Problem encountered in field '{field.name}'." + ) + if type(None) not in field.type.__args__: + # filter `str` in Union + field.type = field.type.__args__[0] if field.type.__args__[1] is str else field.type.__args__[1] + origin_type = getattr(field.type, "__origin__", field.type) + elif bool not in field.type.__args__: + # filter `NoneType` in Union (except for `Union[bool, NoneType]`) + field.type = ( + field.type.__args__[0] if isinstance(None, field.type.__args__[1]) else field.type.__args__[1] + ) + origin_type = getattr(field.type, "__origin__", field.type) + + # A variable to store kwargs for a boolean field, if needed + # so that we can init a `no_*` complement argument (see below) + bool_kwargs = {} + if origin_type is Literal or (isinstance(field.type, type) and issubclass(field.type, Enum)): + if origin_type is Literal: + kwargs["choices"] = field.type.__args__ + else: + kwargs["choices"] = [x.value for x in field.type] + + kwargs["type"] = make_choice_type_function(kwargs["choices"]) + + if field.default is not dataclasses.MISSING: + kwargs["default"] = field.default + else: + kwargs["required"] = True + elif field.type is bool or field.type == bool | None: + # Copy the correct kwargs to use to instantiate a `no_*` complement argument below. + # We do not initialize it here because the `no_*` alternative must be instantiated after the real argument + bool_kwargs = copy(kwargs) + + # Hack because type=bool in argparse does not behave as we want. + kwargs["type"] = string_to_bool + if field.type is bool or (field.default is not None and field.default is not dataclasses.MISSING): + # Default value is False if we have no default when of type bool. + default = False if field.default is dataclasses.MISSING else field.default + # This is the value that will get picked if we don't include --{field.name} in any way + kwargs["default"] = default + # This tells argparse we accept 0 or 1 value after --{field.name} + kwargs["nargs"] = "?" + # This is the value that will get picked if we do --{field.name} (without value) + kwargs["const"] = True + elif isclass(origin_type) and issubclass(origin_type, list): + kwargs["type"] = field.type.__args__[0] + kwargs["nargs"] = "+" + if field.default_factory is not dataclasses.MISSING: + kwargs["default"] = field.default_factory() + elif field.default is dataclasses.MISSING: + kwargs["required"] = True + else: + kwargs["type"] = field.type + if field.default is not dataclasses.MISSING: + kwargs["default"] = field.default + elif field.default_factory is not dataclasses.MISSING: + kwargs["default"] = field.default_factory() + else: + kwargs["required"] = True + parser.add_argument(*long_options, *aliases, **kwargs) + + # Add a complement `no_*` argument for a boolean field AFTER the initial field has already been added. + # Order is important for arguments with the same destination! + # We use a copy of earlier kwargs because the original kwargs have changed a lot before reaching down + # here and we do not need those changes/additional keys. + if field.default is True and (field.type is bool or field.type == bool | None): + bool_kwargs["default"] = False + parser.add_argument( + f"--no_{field.name}", + f"--no-{field.name.replace('_', '-')}", + action="store_false", + dest=field.name, + **bool_kwargs, + ) + + def _add_dataclass_arguments(self, dtype: DataClassType): + if hasattr(dtype, "_argument_group_name"): + parser = self.add_argument_group(dtype._argument_group_name) + else: + parser = self + + try: + type_hints: dict[str, type] = get_type_hints(dtype) + except NameError: + raise RuntimeError( + f"Type resolution failed for {dtype}. Try declaring the class in global scope or " + "removing line of `from __future__ import annotations` which opts in Postponed " + "Evaluation of Annotations (PEP 563)" + ) + + for field in dataclasses.fields(dtype): + if not field.init: + continue + field.type = type_hints[field.name] + self._parse_dataclass_field(parser, field) + + def parse_args_into_dataclasses( + self, + args=None, + return_remaining_strings=False, + look_for_args_file=True, + args_filename=None, + args_file_flag=None, + ) -> tuple[DataClass, ...]: + """ + Parse command-line args into instances of the specified dataclass types. + + This relies on argparse's `ArgumentParser.parse_known_args`. See the doc at: + docs.python.org/3/library/argparse.html#argparse.ArgumentParser.parse_args + + Args: + args: + List of strings to parse. The default is taken from sys.argv. (same as argparse.ArgumentParser) + return_remaining_strings: + If true, also return a list of remaining argument strings. + look_for_args_file: + If true, will look for a ".args" file with the same base name as the entry point script for this + process, and will append its potential content to the command line args. + args_filename: + If not None, will uses this file instead of the ".args" file specified in the previous argument. + args_file_flag: + If not None, will look for a file in the command-line args specified with this flag. The flag can be + specified multiple times and precedence is determined by the order (last one wins). + + Returns: + Tuple consisting of: + + - the dataclass instances in the same order as they were passed to the initializer.abspath + - if applicable, an additional namespace for more (non-dataclass backed) arguments added to the parser + after initialization. + - The potential list of remaining argument strings. (same as argparse.ArgumentParser.parse_known_args) + """ + + if args_file_flag or args_filename or (look_for_args_file and len(sys.argv)): + args_files = [] + + if args_filename: + args_files.append(Path(args_filename)) + elif look_for_args_file and len(sys.argv): + args_files.append(Path(sys.argv[0]).with_suffix(".args")) + + # args files specified via command line flag should overwrite default args files so we add them last + if args_file_flag: + # Create special parser just to extract the args_file_flag values + args_file_parser = ArgumentParser() + args_file_parser.add_argument(args_file_flag, type=str, action="append") + + # Use only remaining args for further parsing (remove the args_file_flag) + cfg, args = args_file_parser.parse_known_args(args=args) + cmd_args_file_paths = vars(cfg).get(args_file_flag.lstrip("-"), None) + + if cmd_args_file_paths: + args_files.extend([Path(p) for p in cmd_args_file_paths]) + + file_args = [] + for args_file in args_files: + if args_file.exists(): + file_args += args_file.read_text().split() + + # in case of duplicate arguments the last one has precedence + # args specified via the command line should overwrite args from files, so we add them last + args = file_args + args if args is not None else file_args + sys.argv[1:] + namespace, remaining_args = self.parse_known_args(args=args) + outputs = [] + for dtype in self.dataclass_types: + keys = {f.name for f in dataclasses.fields(dtype) if f.init} + inputs = {k: v for k, v in vars(namespace).items() if k in keys} + for k in keys: + delattr(namespace, k) + obj = dtype(**inputs) + outputs.append(obj) + if len(namespace.__dict__) > 0: + # additional namespace. + outputs.append(namespace) + if return_remaining_strings: + return (*outputs, remaining_args) + else: + if remaining_args: + raise ValueError(f"Some specified arguments are not used by the HfArgumentParser: {remaining_args}") + + return (*outputs,) + + def parse_dict(self, args: dict[str, Any], allow_extra_keys: bool = False) -> tuple[DataClass, ...]: + """ + Alternative helper method that does not use `argparse` at all, instead uses a dict and populating the dataclass + types. + + Args: + args (`dict`): + dict containing config values + allow_extra_keys (`bool`, *optional*, defaults to `False`): + Defaults to False. If False, will raise an exception if the dict contains keys that are not parsed. + + Returns: + Tuple consisting of: + + - the dataclass instances in the same order as they were passed to the initializer. + """ + unused_keys = set(args.keys()) + outputs = [] + for dtype in self.dataclass_types: + keys = {f.name for f in dataclasses.fields(dtype) if f.init} + inputs = {k: v for k, v in args.items() if k in keys} + unused_keys.difference_update(inputs.keys()) + obj = dtype(**inputs) + outputs.append(obj) + if not allow_extra_keys and unused_keys: + raise ValueError(f"Some keys are not used by the HfArgumentParser: {sorted(unused_keys)}") + return tuple(outputs) + + def parse_json_file(self, json_file: str | os.PathLike, allow_extra_keys: bool = False) -> tuple[DataClass, ...]: + """ + Alternative helper method that does not use `argparse` at all, instead loading a json file and populating the + dataclass types. + + Args: + json_file (`str` or `os.PathLike`): + File name of the json file to parse + allow_extra_keys (`bool`, *optional*, defaults to `False`): + Defaults to False. If False, will raise an exception if the json file contains keys that are not + parsed. + + Returns: + Tuple consisting of: + + - the dataclass instances in the same order as they were passed to the initializer. + """ + with open(Path(json_file), encoding="utf-8") as open_json_file: + data = json.loads(open_json_file.read()) + outputs = self.parse_dict(data, allow_extra_keys=allow_extra_keys) + return tuple(outputs) + + def parse_yaml_file(self, yaml_file: str | os.PathLike, allow_extra_keys: bool = False) -> tuple[DataClass, ...]: + """ + Alternative helper method that does not use `argparse` at all, instead loading a yaml file and populating the + dataclass types. + + Args: + yaml_file (`str` or `os.PathLike`): + File name of the yaml file to parse + allow_extra_keys (`bool`, *optional*, defaults to `False`): + Defaults to False. If False, will raise an exception if the json file contains keys that are not + parsed. + + Returns: + Tuple consisting of: + + - the dataclass instances in the same order as they were passed to the initializer. + """ + outputs = self.parse_dict(yaml.safe_load(Path(yaml_file).read_text()), allow_extra_keys=allow_extra_keys) + return tuple(outputs) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/hyperparameter_search.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/hyperparameter_search.py new file mode 100644 index 0000000000000000000000000000000000000000..267bb36a8e6eff68a7207a09eb32018d8ca532cd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/hyperparameter_search.py @@ -0,0 +1,123 @@ +# Copyright 2023-present the HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .integrations import ( + is_optuna_available, + is_ray_tune_available, + is_wandb_available, + run_hp_search_optuna, + run_hp_search_ray, + run_hp_search_wandb, +) +from .trainer_utils import ( + HPSearchBackend, + default_hp_space_optuna, + default_hp_space_ray, + default_hp_space_wandb, +) +from .utils import logging + + +logger = logging.get_logger(__name__) + + +class HyperParamSearchBackendBase: + name: str + pip_package: str | None = None + + @staticmethod + def is_available(): + raise NotImplementedError + + def run(self, trainer, n_trials: int, direction: str, **kwargs): + raise NotImplementedError + + def default_hp_space(self, trial): + raise NotImplementedError + + def ensure_available(self): + if not self.is_available(): + raise RuntimeError( + f"You picked the {self.name} backend, but it is not installed. Run {self.pip_install()}." + ) + + @classmethod + def pip_install(cls): + return f"`pip install {cls.pip_package or cls.name}`" + + +class OptunaBackend(HyperParamSearchBackendBase): + name = "optuna" + + @staticmethod + def is_available(): + return is_optuna_available() + + def run(self, trainer, n_trials: int, direction: str, **kwargs): + return run_hp_search_optuna(trainer, n_trials, direction, **kwargs) + + def default_hp_space(self, trial): + return default_hp_space_optuna(trial) + + +class RayTuneBackend(HyperParamSearchBackendBase): + name = "ray" + pip_package = "'ray[tune]'" + + @staticmethod + def is_available(): + return is_ray_tune_available() + + def run(self, trainer, n_trials: int, direction: str, **kwargs): + return run_hp_search_ray(trainer, n_trials, direction, **kwargs) + + def default_hp_space(self, trial): + return default_hp_space_ray(trial) + + +class WandbBackend(HyperParamSearchBackendBase): + name = "wandb" + + @staticmethod + def is_available(): + return is_wandb_available() + + def run(self, trainer, n_trials: int, direction: str, **kwargs): + return run_hp_search_wandb(trainer, n_trials, direction, **kwargs) + + def default_hp_space(self, trial): + return default_hp_space_wandb(trial) + + +ALL_HYPERPARAMETER_SEARCH_BACKENDS = { + HPSearchBackend(backend.name): backend for backend in [OptunaBackend, RayTuneBackend, WandbBackend] +} + + +def default_hp_search_backend() -> str: + available_backends = [backend for backend in ALL_HYPERPARAMETER_SEARCH_BACKENDS.values() if backend.is_available()] + if len(available_backends) > 0: + name = available_backends[0].name + if len(available_backends) > 1: + logger.info( + f"{len(available_backends)} hyperparameter search backends available. Using {name} as the default." + ) + return name + raise RuntimeError( + "No hyperparameter search backend available.\n" + + "\n".join( + f" - To install {backend.name} run {backend.pip_install()}" + for backend in ALL_HYPERPARAMETER_SEARCH_BACKENDS.values() + ) + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_processing_base.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_processing_base.py new file mode 100644 index 0000000000000000000000000000000000000000..f59fd41f7b85a09969bfbebea3f4a7aa7cf094fa --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_processing_base.py @@ -0,0 +1,486 @@ +# Copyright 2020 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import copy +import json +import os +from typing import Any, TypeVar + +import numpy as np +from huggingface_hub import create_repo, is_offline_mode + +from .dynamic_module_utils import custom_object_save +from .feature_extraction_utils import BatchFeature as BaseBatchFeature +from .image_utils import is_valid_image, load_image +from .utils import ( + IMAGE_PROCESSOR_NAME, + PROCESSOR_NAME, + PushToHubMixin, + copy_func, + logging, + safe_load_json_file, +) +from .utils.hub import cached_file + + +ImageProcessorType = TypeVar("ImageProcessorType", bound="ImageProcessingMixin") + + +logger = logging.get_logger(__name__) + + +# TODO: Move BatchFeature to be imported by both image_processing_utils and image_processing_utils_fast +# We override the class string here, but logic is the same. +class BatchFeature(BaseBatchFeature): + r""" + Holds the output of the image processor specific `__call__` methods. + + This class is derived from a python dictionary and can be used as a dictionary. + + Args: + data (`dict`): + Dictionary of lists/arrays/tensors returned by the __call__ method ('pixel_values', etc.). + tensor_type (`Union[None, str, TensorType]`, *optional*): + You can give a tensor_type here to convert the lists of integers in PyTorch/Numpy Tensors at + initialization. + """ + + +# TODO: (Amy) - factor out the common parts of this and the feature extractor +class ImageProcessingMixin(PushToHubMixin): + """ + This is an image processor mixin used to provide saving/loading functionality for sequential and image feature + extractors. + """ + + _auto_class = None + + def __init__(self, **kwargs): + """Set elements of `kwargs` as attributes.""" + # This key was saved while we still used `XXXFeatureExtractor` for image processing. Now we use + # `XXXImageProcessor`, this attribute and its value are misleading. + kwargs.pop("feature_extractor_type", None) + # Pop "processor_class", should not be saved with image processing config anymore + kwargs.pop("processor_class", None) + # Additional attributes without default values + for key, value in kwargs.items(): + try: + setattr(self, key, value) + except AttributeError as err: + logger.error(f"Can't set {key} with value {value} for {self}") + raise err + + @classmethod + def from_pretrained( + cls: type[ImageProcessorType], + pretrained_model_name_or_path: str | os.PathLike, + cache_dir: str | os.PathLike | None = None, + force_download: bool = False, + local_files_only: bool = False, + token: str | bool | None = None, + revision: str = "main", + **kwargs, + ) -> ImageProcessorType: + r""" + Instantiate a type of [`~image_processing_utils.ImageProcessingMixin`] from an image processor. + + Args: + pretrained_model_name_or_path (`str` or `os.PathLike`): + This can be either: + + - a string, the *model id* of a pretrained image_processor hosted inside a model repo on + huggingface.co. + - a path to a *directory* containing a image processor file saved using the + [`~image_processing_utils.ImageProcessingMixin.save_pretrained`] method, e.g., + `./my_model_directory/`. + - a path or url to a saved image processor JSON *file*, e.g., + `./my_model_directory/preprocessor_config.json`. + cache_dir (`str` or `os.PathLike`, *optional*): + Path to a directory in which a downloaded pretrained model image processor should be cached if the + standard cache should not be used. + force_download (`bool`, *optional*, defaults to `False`): + Whether or not to force to (re-)download the image processor files and override the cached versions if + they exist. + proxies (`dict[str, str]`, *optional*): + A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128', + 'http://hostname': 'foo.bar:4012'}.` The proxies are used on each request. + token (`str` or `bool`, *optional*): + The token to use as HTTP bearer authorization for remote files. If `True`, or not specified, will use + the token generated when running `hf auth login` (stored in `~/.huggingface`). + revision (`str`, *optional*, defaults to `"main"`): + The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a + git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + identifier allowed by git. + + + + + To test a pull request you made on the Hub, you can pass `revision="refs/pr/"`. + + + + return_unused_kwargs (`bool`, *optional*, defaults to `False`): + If `False`, then this function returns just the final image processor object. If `True`, then this + functions returns a `Tuple(image_processor, unused_kwargs)` where *unused_kwargs* is a dictionary + consisting of the key/value pairs whose keys are not image processor attributes: i.e., the part of + `kwargs` which has not been used to update `image_processor` and is otherwise ignored. + subfolder (`str`, *optional*, defaults to `""`): + In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + specify the folder name here. + kwargs (`dict[str, Any]`, *optional*): + The values in kwargs of any keys which are image processor attributes will be used to override the + loaded values. Behavior concerning key/value pairs whose keys are *not* image processor attributes is + controlled by the `return_unused_kwargs` keyword parameter. + + Returns: + A image processor of type [`~image_processing_utils.ImageProcessingMixin`]. + + Examples: + + ```python + # We can't instantiate directly the base class *ImageProcessingMixin* so let's show the examples on a + # derived class: *CLIPImageProcessor* + image_processor = CLIPImageProcessor.from_pretrained( + "openai/clip-vit-base-patch32" + ) # Download image_processing_config from huggingface.co and cache. + image_processor = CLIPImageProcessor.from_pretrained( + "./test/saved_model/" + ) # E.g. image processor (or model) was saved using *save_pretrained('./test/saved_model/')* + image_processor = CLIPImageProcessor.from_pretrained("./test/saved_model/preprocessor_config.json") + image_processor = CLIPImageProcessor.from_pretrained( + "openai/clip-vit-base-patch32", do_normalize=False, foo=False + ) + assert image_processor.do_normalize is False + image_processor, unused_kwargs = CLIPImageProcessor.from_pretrained( + "openai/clip-vit-base-patch32", do_normalize=False, foo=False, return_unused_kwargs=True + ) + assert image_processor.do_normalize is False + assert unused_kwargs == {"foo": False} + ```""" + kwargs["cache_dir"] = cache_dir + kwargs["force_download"] = force_download + kwargs["local_files_only"] = local_files_only + kwargs["revision"] = revision + + if token is not None: + kwargs["token"] = token + + image_processor_dict, kwargs = cls.get_image_processor_dict(pretrained_model_name_or_path, **kwargs) + + return cls.from_dict(image_processor_dict, **kwargs) + + def save_pretrained(self, save_directory: str | os.PathLike, push_to_hub: bool = False, **kwargs): + """ + Save an image processor object to the directory `save_directory`, so that it can be re-loaded using the + [`~image_processing_utils.ImageProcessingMixin.from_pretrained`] class method. + + Args: + save_directory (`str` or `os.PathLike`): + Directory where the image processor JSON file will be saved (will be created if it does not exist). + push_to_hub (`bool`, *optional*, defaults to `False`): + Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the + repository you want to push to with `repo_id` (will default to the name of `save_directory` in your + namespace). + kwargs (`dict[str, Any]`, *optional*): + Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method. + """ + if os.path.isfile(save_directory): + raise AssertionError(f"Provided path ({save_directory}) should be a directory, not a file") + + os.makedirs(save_directory, exist_ok=True) + + if push_to_hub: + commit_message = kwargs.pop("commit_message", None) + repo_id = kwargs.pop("repo_id", save_directory.split(os.path.sep)[-1]) + repo_id = create_repo(repo_id, exist_ok=True, **kwargs).repo_id + files_timestamps = self._get_files_timestamps(save_directory) + + # If we have a custom config, we copy the file defining it in the folder and set the attributes so it can be + # loaded from the Hub. + if self._auto_class is not None: + custom_object_save(self, save_directory, config=self) + + # If we save using the predefined names, we can load using `from_pretrained` + output_image_processor_file = os.path.join(save_directory, IMAGE_PROCESSOR_NAME) + + self.to_json_file(output_image_processor_file) + logger.info(f"Image processor saved in {output_image_processor_file}") + + if push_to_hub: + self._upload_modified_files( + save_directory, + repo_id, + files_timestamps, + commit_message=commit_message, + token=kwargs.get("token"), + ) + + return [output_image_processor_file] + + @classmethod + def get_image_processor_dict( + cls, pretrained_model_name_or_path: str | os.PathLike, **kwargs + ) -> tuple[dict[str, Any], dict[str, Any]]: + """ + From a `pretrained_model_name_or_path`, resolve to a dictionary of parameters, to be used for instantiating a + image processor of type [`~image_processor_utils.ImageProcessingMixin`] using `from_dict`. + + Parameters: + pretrained_model_name_or_path (`str` or `os.PathLike`): + The identifier of the pre-trained checkpoint from which we want the dictionary of parameters. + subfolder (`str`, *optional*, defaults to `""`): + In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + specify the folder name here. + image_processor_filename (`str`, *optional*, defaults to `"config.json"`): + The name of the file in the model directory to use for the image processor config. + + Returns: + `tuple[Dict, Dict]`: The dictionary(ies) that will be used to instantiate the image processor object. + """ + cache_dir = kwargs.pop("cache_dir", None) + force_download = kwargs.pop("force_download", False) + proxies = kwargs.pop("proxies", None) + token = kwargs.pop("token", None) + local_files_only = kwargs.pop("local_files_only", False) + revision = kwargs.pop("revision", None) + subfolder = kwargs.pop("subfolder", "") + image_processor_filename = kwargs.pop("image_processor_filename", IMAGE_PROCESSOR_NAME) + + from_pipeline = kwargs.pop("_from_pipeline", None) + from_auto_class = kwargs.pop("_from_auto", False) + + user_agent = {"file_type": "image processor", "from_auto_class": from_auto_class} + if from_pipeline is not None: + user_agent["using_pipeline"] = from_pipeline + + if is_offline_mode() and not local_files_only: + logger.info("Offline mode: forcing local_files_only=True") + local_files_only = True + + pretrained_model_name_or_path = str(pretrained_model_name_or_path) + is_local = os.path.isdir(pretrained_model_name_or_path) + if os.path.isdir(pretrained_model_name_or_path): + image_processor_file = os.path.join(pretrained_model_name_or_path, image_processor_filename) + if os.path.isfile(pretrained_model_name_or_path): + resolved_image_processor_file = pretrained_model_name_or_path + resolved_processor_file = None + is_local = True + else: + image_processor_file = image_processor_filename + try: + resolved_processor_file = cached_file( + pretrained_model_name_or_path, + filename=PROCESSOR_NAME, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _raise_exceptions_for_missing_entries=False, + ) + resolved_image_processor_file = cached_file( + pretrained_model_name_or_path, + filename=image_processor_file, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _raise_exceptions_for_missing_entries=False, + ) + except OSError: + # Raise any environment error raise by `cached_file`. It will have a helpful error message adapted to + # the original exception. + raise + except Exception: + # For any other exception, we throw a generic error. + raise OSError( + f"Can't load image processor for '{pretrained_model_name_or_path}'. If you were trying to load" + " it from 'https://huggingface.co/models', make sure you don't have a local directory with the" + f" same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a" + f" directory containing a {image_processor_filename} file" + ) + + # Load image_processor dict. Priority goes as (nested config if found -> image processor config) + # We are downloading both configs because almost all models have a `processor_config.json` but + # not all of these are nested. We need to check if it was saved recebtly as nested or if it is legacy style + image_processor_dict = None + if resolved_processor_file is not None: + processor_dict = safe_load_json_file(resolved_processor_file) + if "image_processor" in processor_dict: + image_processor_dict = processor_dict["image_processor"] + + if resolved_image_processor_file is not None and image_processor_dict is None: + image_processor_dict = safe_load_json_file(resolved_image_processor_file) + + if image_processor_dict is None: + raise OSError( + f"Can't load image processor for '{pretrained_model_name_or_path}'. If you were trying to load" + " it from 'https://huggingface.co/models', make sure you don't have a local directory with the" + f" same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a" + f" directory containing a {image_processor_filename} file" + ) + + if is_local: + logger.info(f"loading configuration file {resolved_image_processor_file}") + else: + logger.info( + f"loading configuration file {image_processor_file} from cache at {resolved_image_processor_file}" + ) + + return image_processor_dict, kwargs + + @classmethod + def from_dict(cls, image_processor_dict: dict[str, Any], **kwargs): + """ + Instantiates a type of [`~image_processing_utils.ImageProcessingMixin`] from a Python dictionary of parameters. + + Args: + image_processor_dict (`dict[str, Any]`): + Dictionary that will be used to instantiate the image processor object. Such a dictionary can be + retrieved from a pretrained checkpoint by leveraging the + [`~image_processing_utils.ImageProcessingMixin.to_dict`] method. + kwargs (`dict[str, Any]`): + Additional parameters from which to initialize the image processor object. + + Returns: + [`~image_processing_utils.ImageProcessingMixin`]: The image processor object instantiated from those + parameters. + """ + image_processor_dict = image_processor_dict.copy() + return_unused_kwargs = kwargs.pop("return_unused_kwargs", False) + image_processor_dict.update({k: v for k, v in kwargs.items() if k in cls.valid_kwargs.__annotations__}) + image_processor = cls(**image_processor_dict) + + # Remove kwargs that are used to initialize the image processor attributes + for key in list(kwargs): + if hasattr(image_processor, key): + kwargs.pop(key) + + logger.info(f"Image processor {image_processor}") + if return_unused_kwargs: + return image_processor, kwargs + else: + return image_processor + + def to_dict(self) -> dict[str, Any]: + """ + Serializes this instance to a Python dictionary. + + Returns: + `dict[str, Any]`: Dictionary of all the attributes that make up this image processor instance. + """ + output = copy.deepcopy(self.__dict__) + output["image_processor_type"] = self.__class__.__name__ + + return output + + @classmethod + def from_json_file(cls, json_file: str | os.PathLike): + """ + Instantiates a image processor of type [`~image_processing_utils.ImageProcessingMixin`] from the path to a JSON + file of parameters. + + Args: + json_file (`str` or `os.PathLike`): + Path to the JSON file containing the parameters. + + Returns: + A image processor of type [`~image_processing_utils.ImageProcessingMixin`]: The image_processor object + instantiated from that JSON file. + """ + with open(json_file, encoding="utf-8") as reader: + text = reader.read() + image_processor_dict = json.loads(text) + return cls(**image_processor_dict) + + def to_json_string(self) -> str: + """ + Serializes this instance to a JSON string. + + Returns: + `str`: String containing all the attributes that make up this feature_extractor instance in JSON format. + """ + dictionary = self.to_dict() + + for key, value in dictionary.items(): + if isinstance(value, np.ndarray): + dictionary[key] = value.tolist() + + return json.dumps(dictionary, indent=2, sort_keys=True) + "\n" + + def to_json_file(self, json_file_path: str | os.PathLike): + """ + Save this instance to a JSON file. + + Args: + json_file_path (`str` or `os.PathLike`): + Path to the JSON file in which this image_processor instance's parameters will be saved. + """ + with open(json_file_path, "w", encoding="utf-8") as writer: + writer.write(self.to_json_string()) + + def __repr__(self): + return f"{self.__class__.__name__} {self.to_json_string()}" + + @classmethod + def register_for_auto_class(cls, auto_class="AutoImageProcessor"): + """ + Register this class with a given auto class. This should only be used for custom image processors as the ones + in the library are already mapped with `AutoImageProcessor `. + + + + Args: + auto_class (`str` or `type`, *optional*, defaults to `"AutoImageProcessor "`): + The auto class to register this new image processor with. + """ + if not isinstance(auto_class, str): + auto_class = auto_class.__name__ + + import transformers.models.auto as auto_module + + if not hasattr(auto_module, auto_class): + raise ValueError(f"{auto_class} is not a valid auto class.") + + cls._auto_class = auto_class + + def fetch_images(self, image_url_or_urls: str | list[str] | list[list[str]]): + """ + Convert a single or a list of urls into the corresponding `PIL.Image` objects. + + If a single url is passed, the return value will be a single object. If a list is passed a list of objects is + returned. + """ + if isinstance(image_url_or_urls, list): + return [self.fetch_images(x) for x in image_url_or_urls] + elif isinstance(image_url_or_urls, str): + return load_image(image_url_or_urls) + elif is_valid_image(image_url_or_urls): + return image_url_or_urls + else: + raise TypeError(f"only a single or a list of entries is supported but got type={type(image_url_or_urls)}") + + +ImageProcessingMixin.push_to_hub = copy_func(ImageProcessingMixin.push_to_hub) +if ImageProcessingMixin.push_to_hub.__doc__ is not None: + ImageProcessingMixin.push_to_hub.__doc__ = ImageProcessingMixin.push_to_hub.__doc__.format( + object="image processor", object_class="AutoImageProcessor", object_files="image processor file" + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_processing_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_processing_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..50ba1c0424a6b530d06d19b5f9966b184f0f1089 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_processing_utils.py @@ -0,0 +1,316 @@ +# Copyright 2022 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import math +from collections.abc import Iterable + +import numpy as np + +from .image_processing_base import BatchFeature, ImageProcessingMixin +from .image_transforms import center_crop, normalize, rescale +from .image_utils import ChannelDimension, ImageInput, get_image_size +from .processing_utils import ImagesKwargs, Unpack +from .utils import logging +from .utils.import_utils import requires + + +logger = logging.get_logger(__name__) + + +INIT_SERVICE_KWARGS = [ + "processor_class", + "image_processor_type", +] + + +@requires(backends=("vision",)) +class BaseImageProcessor(ImageProcessingMixin): + valid_kwargs = ImagesKwargs + + @property + def is_fast(self) -> bool: + """ + `bool`: Whether or not this image processor is a fast processor (backed by PyTorch and TorchVision). + """ + return False + + def __call__(self, images: ImageInput, *args, **kwargs: Unpack[ImagesKwargs]) -> BatchFeature: + """Preprocess an image or a batch of images.""" + return self.preprocess(images, *args, **kwargs) + + def preprocess(self, images, **kwargs) -> BatchFeature: + raise NotImplementedError("Each image processor must implement its own preprocess method") + + def rescale( + self, + image: np.ndarray, + scale: float, + data_format: str | ChannelDimension | None = None, + input_data_format: str | ChannelDimension | None = None, + **kwargs, + ) -> np.ndarray: + """ + Rescale an image by a scale factor. image = image * scale. + + Args: + image (`np.ndarray`): + Image to rescale. + scale (`float`): + The scaling factor to rescale pixel values by. + data_format (`str` or `ChannelDimension`, *optional*): + The channel dimension format for the output image. If unset, the channel dimension format of the input + image is used. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format. + input_data_format (`ChannelDimension` or `str`, *optional*): + The channel dimension format for the input image. If unset, the channel dimension format is inferred + from the input image. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format. + + Returns: + `np.ndarray`: The rescaled image. + """ + return rescale(image, scale=scale, data_format=data_format, input_data_format=input_data_format, **kwargs) + + def normalize( + self, + image: np.ndarray, + mean: float | Iterable[float], + std: float | Iterable[float], + data_format: str | ChannelDimension | None = None, + input_data_format: str | ChannelDimension | None = None, + **kwargs, + ) -> np.ndarray: + """ + Normalize an image. image = (image - image_mean) / image_std. + + Args: + image (`np.ndarray`): + Image to normalize. + mean (`float` or `Iterable[float]`): + Image mean to use for normalization. + std (`float` or `Iterable[float]`): + Image standard deviation to use for normalization. + data_format (`str` or `ChannelDimension`, *optional*): + The channel dimension format for the output image. If unset, the channel dimension format of the input + image is used. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format. + input_data_format (`ChannelDimension` or `str`, *optional*): + The channel dimension format for the input image. If unset, the channel dimension format is inferred + from the input image. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format. + + Returns: + `np.ndarray`: The normalized image. + """ + return normalize( + image, mean=mean, std=std, data_format=data_format, input_data_format=input_data_format, **kwargs + ) + + def center_crop( + self, + image: np.ndarray, + size: dict[str, int], + data_format: str | ChannelDimension | None = None, + input_data_format: str | ChannelDimension | None = None, + **kwargs, + ) -> np.ndarray: + """ + Center crop an image to `(size["height"], size["width"])`. If the input size is smaller than `crop_size` along + any edge, the image is padded with 0's and then center cropped. + + Args: + image (`np.ndarray`): + Image to center crop. + size (`dict[str, int]`): + Size of the output image. + data_format (`str` or `ChannelDimension`, *optional*): + The channel dimension format for the output image. If unset, the channel dimension format of the input + image is used. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format. + input_data_format (`ChannelDimension` or `str`, *optional*): + The channel dimension format for the input image. If unset, the channel dimension format is inferred + from the input image. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format. + """ + size = get_size_dict(size) + if "height" not in size or "width" not in size: + raise ValueError(f"The size dictionary must have keys 'height' and 'width'. Got {size.keys()}") + return center_crop( + image, + size=(size["height"], size["width"]), + data_format=data_format, + input_data_format=input_data_format, + **kwargs, + ) + + def to_dict(self): + encoder_dict = super().to_dict() + encoder_dict.pop("_valid_processor_keys", None) + return encoder_dict + + +VALID_SIZE_DICT_KEYS = ( + {"height", "width"}, + {"shortest_edge"}, + {"shortest_edge", "longest_edge"}, + {"longest_edge"}, + {"max_height", "max_width"}, +) + + +def is_valid_size_dict(size_dict): + if not isinstance(size_dict, dict): + return False + + size_dict_keys = set(size_dict.keys()) + for allowed_keys in VALID_SIZE_DICT_KEYS: + if size_dict_keys == allowed_keys: + return True + return False + + +def convert_to_size_dict( + size, max_size: int | None = None, default_to_square: bool = True, height_width_order: bool = True +): + # By default, if size is an int we assume it represents a tuple of (size, size). + if isinstance(size, int) and default_to_square: + if max_size is not None: + raise ValueError("Cannot specify both size as an int, with default_to_square=True and max_size") + return {"height": size, "width": size} + # In other configs, if size is an int and default_to_square is False, size represents the length of + # the shortest edge after resizing. + elif isinstance(size, int) and not default_to_square: + size_dict = {"shortest_edge": size} + if max_size is not None: + size_dict["longest_edge"] = max_size + return size_dict + # Otherwise, if size is a tuple it's either (height, width) or (width, height) + elif isinstance(size, (tuple, list)) and height_width_order: + return {"height": size[0], "width": size[1]} + elif isinstance(size, (tuple, list)) and not height_width_order: + return {"height": size[1], "width": size[0]} + elif size is None and max_size is not None: + if default_to_square: + raise ValueError("Cannot specify both default_to_square=True and max_size") + return {"longest_edge": max_size} + + raise ValueError(f"Could not convert size input to size dict: {size}") + + +def get_size_dict( + size: int | Iterable[int] | dict[str, int] | None = None, + max_size: int | None = None, + height_width_order: bool = True, + default_to_square: bool = True, + param_name="size", +) -> dict: + """ + Converts the old size parameter in the config into the new dict expected in the config. This is to ensure backwards + compatibility with the old image processor configs and removes ambiguity over whether the tuple is in (height, + width) or (width, height) format. + + - If `size` is tuple, it is converted to `{"height": size[0], "width": size[1]}` or `{"height": size[1], "width": + size[0]}` if `height_width_order` is `False`. + - If `size` is an int, and `default_to_square` is `True`, it is converted to `{"height": size, "width": size}`. + - If `size` is an int and `default_to_square` is False, it is converted to `{"shortest_edge": size}`. If `max_size` + is set, it is added to the dict as `{"longest_edge": max_size}`. + + Args: + size (`Union[int, Iterable[int], dict[str, int]]`, *optional*): + The `size` parameter to be cast into a size dictionary. + max_size (`Optional[int]`, *optional*): + The `max_size` parameter to be cast into a size dictionary. + height_width_order (`bool`, *optional*, defaults to `True`): + If `size` is a tuple, whether it's in (height, width) or (width, height) order. + default_to_square (`bool`, *optional*, defaults to `True`): + If `size` is an int, whether to default to a square image or not. + """ + if not isinstance(size, dict): + size_dict = convert_to_size_dict(size, max_size, default_to_square, height_width_order) + logger.info( + f"{param_name} should be a dictionary on of the following set of keys: {VALID_SIZE_DICT_KEYS}, got {size}." + f" Converted to {size_dict}.", + ) + else: + size_dict = size + + if not is_valid_size_dict(size_dict): + raise ValueError( + f"{param_name} must have one of the following set of keys: {VALID_SIZE_DICT_KEYS}, got {size_dict.keys()}" + ) + return size_dict + + +def select_best_resolution(original_size: tuple, possible_resolutions: list) -> tuple: + """ + Selects the best resolution from a list of possible resolutions based on the original size. + + This is done by calculating the effective and wasted resolution for each possible resolution. + + The best fit resolution is the one that maximizes the effective resolution and minimizes the wasted resolution. + + Args: + original_size (tuple): + The original size of the image in the format (height, width). + possible_resolutions (list): + A list of possible resolutions in the format [(height1, width1), (height2, width2), ...]. + + Returns: + tuple: The best fit resolution in the format (height, width). + """ + original_height, original_width = original_size + best_fit = None + max_effective_resolution = 0 + min_wasted_resolution = float("inf") + + for height, width in possible_resolutions: + scale = min(width / original_width, height / original_height) + downscaled_width, downscaled_height = int(original_width * scale), int(original_height * scale) + effective_resolution = min(downscaled_width * downscaled_height, original_width * original_height) + wasted_resolution = (width * height) - effective_resolution + + if effective_resolution > max_effective_resolution or ( + effective_resolution == max_effective_resolution and wasted_resolution < min_wasted_resolution + ): + max_effective_resolution = effective_resolution + min_wasted_resolution = wasted_resolution + best_fit = (height, width) + + return best_fit + + +def get_patch_output_size(image, target_resolution, input_data_format): + """ + Given an image and a target resolution, calculate the output size of the image after cropping to the target + """ + original_height, original_width = get_image_size(image, channel_dim=input_data_format) + target_height, target_width = target_resolution + + scale_w = target_width / original_width + scale_h = target_height / original_height + + if scale_w < scale_h: + new_width = target_width + new_height = min(math.ceil(original_height * scale_w), target_height) + else: + new_height = target_height + new_width = min(math.ceil(original_width * scale_h), target_width) + + return new_height, new_width diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_processing_utils_fast.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_processing_utils_fast.py new file mode 100644 index 0000000000000000000000000000000000000000..29285f281e24edc30d18390e91da705b700e59cd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_processing_utils_fast.py @@ -0,0 +1,952 @@ +# Copyright 2024 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from collections.abc import Iterable +from copy import deepcopy +from functools import lru_cache, partial +from typing import Any, Optional, Union + +import numpy as np +from huggingface_hub.dataclasses import validate_typed_dict + +from .image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict +from .image_transforms import ( + convert_to_rgb, + get_resize_output_image_size, + get_size_with_aspect_ratio, + group_images_by_shape, + reorder_images, +) +from .image_utils import ( + ChannelDimension, + ImageInput, + ImageType, + SizeDict, + get_image_size, + get_image_size_for_max_height_width, + get_image_type, + infer_channel_dimension_format, + make_flat_list_of_images, + validate_kwargs, + validate_preprocess_arguments, +) +from .processing_utils import ImagesKwargs, Unpack +from .utils import ( + TensorType, + auto_docstring, + is_torch_available, + is_torchvision_available, + is_vision_available, + logging, +) +from .utils.import_utils import is_rocm_platform, is_torchdynamo_compiling + + +if is_vision_available(): + from .image_utils import PILImageResampling + +if is_torch_available(): + import torch + +if is_torchvision_available(): + import torchvision.transforms.v2.functional as tvF + + from .image_utils import pil_torch_interpolation_mapping +else: + pil_torch_interpolation_mapping = None + + +logger = logging.get_logger(__name__) + + +@lru_cache(maxsize=10) +def validate_fast_preprocess_arguments( + do_rescale: bool | None = None, + rescale_factor: float | None = None, + do_normalize: bool | None = None, + image_mean: float | list[float] | None = None, + image_std: float | list[float] | None = None, + do_center_crop: bool | None = None, + crop_size: SizeDict | None = None, + do_resize: bool | None = None, + size: SizeDict | None = None, + interpolation: Optional["tvF.InterpolationMode"] = None, + return_tensors: str | TensorType | None = None, + data_format: ChannelDimension = ChannelDimension.FIRST, +): + """ + Checks validity of typically used arguments in an `ImageProcessorFast` `preprocess` method. + Raises `ValueError` if arguments incompatibility is caught. + """ + validate_preprocess_arguments( + do_rescale=do_rescale, + rescale_factor=rescale_factor, + do_normalize=do_normalize, + image_mean=image_mean, + image_std=image_std, + do_center_crop=do_center_crop, + crop_size=crop_size, + do_resize=do_resize, + size=size, + interpolation=interpolation, + ) + # Extra checks for ImageProcessorFast + if return_tensors is not None and return_tensors != "pt": + raise ValueError("Only returning PyTorch tensors is currently supported.") + + if data_format != ChannelDimension.FIRST: + raise ValueError("Only channel first data format is currently supported.") + + +def safe_squeeze(tensor: "torch.Tensor", axis: int | None = None) -> "torch.Tensor": + """ + Squeezes a tensor, but only if the axis specified has dim 1. + """ + if axis is None: + return tensor.squeeze() + + try: + return tensor.squeeze(axis=axis) + except ValueError: + return tensor + + +def max_across_indices(values: Iterable[Any]) -> list[Any]: + """ + Return the maximum value across all indices of an iterable of values. + """ + return [max(values_i) for values_i in zip(*values)] + + +def get_max_height_width(images: list["torch.Tensor"]) -> tuple[int, ...]: + """ + Get the maximum height and width across all images in a batch. + """ + + _, max_height, max_width = max_across_indices([img.shape for img in images]) + + return (max_height, max_width) + + +def divide_to_patches( + image: Union[np.ndarray, "torch.Tensor"], patch_size: int +) -> list[Union[np.ndarray, "torch.Tensor"]]: + """ + Divides an image into patches of a specified size. + + Args: + image (`Union[np.array, "torch.Tensor"]`): + The input image. + patch_size (`int`): + The size of each patch. + Returns: + list: A list of Union[np.array, "torch.Tensor"] representing the patches. + """ + patches = [] + height, width = get_image_size(image, channel_dim=ChannelDimension.FIRST) + for i in range(0, height, patch_size): + for j in range(0, width, patch_size): + patch = image[:, i : i + patch_size, j : j + patch_size] + patches.append(patch) + + return patches + + +@auto_docstring +class BaseImageProcessorFast(BaseImageProcessor): + r""" + Base class for fast image processors using PyTorch and TorchVision for image transformations. + + This class provides a complete implementation for standard image preprocessing operations (resize, crop, rescale, + normalize) with GPU support and batch processing optimizations. Most image processors can be implemented by simply + setting class attributes; only processors requiring custom logic need to override methods. + + Basic Implementation + -------------------- + + For processors that only need standard operations (resize, center crop, rescale, normalize), define class + attributes: + + class MyImageProcessorFast(BaseImageProcessorFast): + resample = PILImageResampling.BILINEAR + image_mean = IMAGENET_DEFAULT_MEAN + image_std = IMAGENET_DEFAULT_STD + size = {"height": 224, "width": 224} + do_resize = True + do_rescale = True + do_normalize = True + + Custom Processing + ----------------- + + Override `_preprocess` (most common): + For custom image processing logic, override `_preprocess`. This method receives a list of torch tensors with + channel dimension first and should return a BatchFeature. Use `group_images_by_shape` and `reorder_images` for + efficient batch processing: + + def _preprocess( + self, + images: list[torch.Tensor], + do_resize: bool, + size: SizeDict, + # ... other parameters + **kwargs, + ) -> BatchFeature: + # Group images by shape for batched operations + grouped_images, indices = group_images_by_shape(images) + processed_groups = {} + + for shape, stacked_images in grouped_images.items(): + if do_resize: + stacked_images = self.resize(stacked_images, size) + # Custom processing here + processed_groups[shape] = stacked_images + + processed_images = reorder_images(processed_groups, indices) + return BatchFeature(data={"pixel_values": torch.stack(processed_images)}) + + Override `_preprocess_image_like_inputs` (for additional inputs): + For processors handling multiple input types (e.g., images + segmentation maps), override this method: + + def _preprocess_image_like_inputs( + self, + images: ImageInput, + segmentation_maps: Optional[ImageInput] = None, + do_convert_rgb: bool, + input_data_format: ChannelDimension, + device: Optional[torch.device] = None, + **kwargs, + ) -> BatchFeature: + images = self._prepare_image_like_inputs(images, do_convert_rgb, input_data_format, device) + batch_feature = self._preprocess(images, **kwargs) + + if segmentation_maps is not None: + # Process segmentation maps separately + maps = self._prepare_image_like_inputs(segmentation_maps, ...) + batch_feature["labels"] = self._preprocess(maps, ...) + + return batch_feature + + Override `_further_process_kwargs` (for custom kwargs formatting): + To format custom kwargs before validation: + + def _further_process_kwargs(self, custom_param=None, **kwargs): + kwargs = super()._further_process_kwargs(**kwargs) + if custom_param is not None: + kwargs["custom_param"] = self._format_custom_param(custom_param) + return kwargs + + Override `_validate_preprocess_kwargs` (for custom validation): + To add custom validation logic: + + def _validate_preprocess_kwargs(self, custom_param=None, **kwargs): + super()._validate_preprocess_kwargs(**kwargs) + if custom_param is not None and custom_param < 0: + raise ValueError("custom_param must be non-negative") + + Override `_prepare_images_structure` (for nested inputs): + By default, nested image lists are flattened. Override to preserve structure: + + def _prepare_images_structure(self, images, expected_ndims=3): + # Custom logic to handle nested structure + return images # Return as-is or with custom processing + + Custom Parameters + ----------------- + + To add parameters beyond `ImagesKwargs`, create a custom kwargs class and set it as `valid_kwargs`: + + class MyImageProcessorKwargs(ImagesKwargs): + custom_param: Optional[int] = None + another_param: Optional[bool] = None + + class MyImageProcessorFast(BaseImageProcessorFast): + valid_kwargs = MyImageProcessorKwargs + custom_param = 10 # default value + + def _preprocess(self, images, custom_param, **kwargs): + # Use custom_param in processing + ... + + Key Notes + --------- + + - Images in `_preprocess` are always torch tensors with channel dimension first, regardless of input format + - Arguments not provided by users default to class attribute values + - Use batch processing utilities (`group_images_by_shape`, `reorder_images`) for GPU efficiency + - Image loading, format conversion, and argument handling are automatic - focus only on processing logic + """ + + resample = None + image_mean = None + image_std = None + size = None + default_to_square = True + crop_size = None + do_resize = None + do_center_crop = None + do_pad = None + pad_size = None + do_rescale = None + rescale_factor = 1 / 255 + do_normalize = None + do_convert_rgb = None + return_tensors = None + data_format = ChannelDimension.FIRST + input_data_format = None + device = None + model_input_names = ["pixel_values"] + image_seq_length = None + valid_kwargs = ImagesKwargs + unused_kwargs = None + + def __init__(self, **kwargs: Unpack[ImagesKwargs]): + super().__init__(**kwargs) + kwargs = self.filter_out_unused_kwargs(kwargs) + size = kwargs.pop("size", self.size) + self.size = ( + get_size_dict(size=size, default_to_square=kwargs.pop("default_to_square", self.default_to_square)) + if size is not None + else None + ) + crop_size = kwargs.pop("crop_size", self.crop_size) + self.crop_size = get_size_dict(crop_size, param_name="crop_size") if crop_size is not None else None + pad_size = kwargs.pop("pad_size", self.pad_size) + self.pad_size = get_size_dict(size=pad_size, param_name="pad_size") if pad_size is not None else None + + for key in self.valid_kwargs.__annotations__: + kwarg = kwargs.pop(key, None) + if kwarg is not None: + setattr(self, key, kwarg) + else: + setattr(self, key, deepcopy(getattr(self, key, None))) + + # get valid kwargs names + self._valid_kwargs_names = list(self.valid_kwargs.__annotations__.keys()) + + @property + def is_fast(self) -> bool: + """ + `bool`: Whether or not this image processor is a fast processor (backed by PyTorch and TorchVision). + """ + return True + + def pad( + self, + images: list["torch.Tensor"], + pad_size: SizeDict = None, + fill_value: int | None = 0, + padding_mode: str | None = "constant", + return_mask: bool = False, + disable_grouping: bool | None = False, + is_nested: bool | None = False, + **kwargs, + ) -> Union[tuple["torch.Tensor", "torch.Tensor"], "torch.Tensor"]: + """ + Pads images to `(pad_size["height"], pad_size["width"])` or to the largest size in the batch. + + Args: + images (`list[torch.Tensor]`): + Images to pad. + pad_size (`SizeDict`, *optional*): + Dictionary in the format `{"height": int, "width": int}` specifying the size of the output image. + fill_value (`int`, *optional*, defaults to `0`): + The constant value used to fill the padded area. + padding_mode (`str`, *optional*, defaults to "constant"): + The padding mode to use. Can be any of the modes supported by + `torch.nn.functional.pad` (e.g. constant, reflection, replication). + return_mask (`bool`, *optional*, defaults to `False`): + Whether to return a pixel mask to denote padded regions. + disable_grouping (`bool`, *optional*, defaults to `False`): + Whether to disable grouping of images by size. + + Returns: + `Union[tuple[torch.Tensor, torch.Tensor], torch.Tensor]`: The padded images and pixel masks if `return_mask` is `True`. + """ + if pad_size is not None: + if not (pad_size.height and pad_size.width): + raise ValueError(f"Pad size must contain 'height' and 'width' keys only. Got pad_size={pad_size}.") + pad_size = (pad_size.height, pad_size.width) + else: + pad_size = get_max_height_width(images) + + grouped_images, grouped_images_index = group_images_by_shape( + images, disable_grouping=disable_grouping, is_nested=is_nested + ) + processed_images_grouped = {} + processed_masks_grouped = {} + for shape, stacked_images in grouped_images.items(): + image_size = stacked_images.shape[-2:] + padding_height = pad_size[0] - image_size[0] + padding_width = pad_size[1] - image_size[1] + if padding_height < 0 or padding_width < 0: + raise ValueError( + f"Padding dimensions are negative. Please make sure that the `pad_size` is larger than the " + f"image size. Got pad_size={pad_size}, image_size={image_size}." + ) + if image_size != pad_size: + padding = (0, 0, padding_width, padding_height) + stacked_images = tvF.pad(stacked_images, padding, fill=fill_value, padding_mode=padding_mode) + processed_images_grouped[shape] = stacked_images + + if return_mask: + # keep only one from the channel dimension in pixel mask + stacked_masks = torch.zeros_like(stacked_images, dtype=torch.int64)[..., 0, :, :] + stacked_masks[..., : image_size[0], : image_size[1]] = 1 + processed_masks_grouped[shape] = stacked_masks + + processed_images = reorder_images(processed_images_grouped, grouped_images_index, is_nested=is_nested) + if return_mask: + processed_masks = reorder_images(processed_masks_grouped, grouped_images_index, is_nested=is_nested) + return processed_images, processed_masks + + return processed_images + + def resize( + self, + image: "torch.Tensor", + size: SizeDict, + interpolation: Optional["tvF.InterpolationMode"] = None, + antialias: bool = True, + **kwargs, + ) -> "torch.Tensor": + """ + Resize an image to `(size["height"], size["width"])`. + + Args: + image (`torch.Tensor`): + Image to resize. + size (`SizeDict`): + Dictionary in the format `{"height": int, "width": int}` specifying the size of the output image. + interpolation (`InterpolationMode`, *optional*, defaults to `InterpolationMode.BILINEAR`): + `InterpolationMode` filter to use when resizing the image e.g. `InterpolationMode.BICUBIC`. + antialias (`bool`, *optional*, defaults to `True`): + Whether to use antialiasing. + + Returns: + `torch.Tensor`: The resized image. + """ + interpolation = interpolation if interpolation is not None else tvF.InterpolationMode.BILINEAR + if size.shortest_edge and size.longest_edge: + # Resize the image so that the shortest edge or the longest edge is of the given size + # while maintaining the aspect ratio of the original image. + new_size = get_size_with_aspect_ratio( + image.size()[-2:], + size.shortest_edge, + size.longest_edge, + ) + elif size.shortest_edge: + new_size = get_resize_output_image_size( + image, + size=size.shortest_edge, + default_to_square=False, + input_data_format=ChannelDimension.FIRST, + ) + elif size.max_height and size.max_width: + new_size = get_image_size_for_max_height_width(image.size()[-2:], size.max_height, size.max_width) + elif size.height and size.width: + new_size = (size.height, size.width) + else: + raise ValueError( + "Size must contain 'height' and 'width' keys, or 'max_height' and 'max_width', or 'shortest_edge' key. Got" + f" {size}." + ) + # This is a workaround to avoid a bug in torch.compile when dealing with uint8 on AMD MI3XX GPUs + # Tracked in PyTorch issue: https://github.com/pytorch/pytorch/issues/155209 + # TODO: remove this once the bug is fixed (detected with torch==2.7.0+git1fee196, torchvision==0.22.0+9eb57cd) + if is_torchdynamo_compiling() and is_rocm_platform(): + return self.compile_friendly_resize(image, new_size, interpolation, antialias) + return tvF.resize(image, new_size, interpolation=interpolation, antialias=antialias) + + @staticmethod + def compile_friendly_resize( + image: "torch.Tensor", + new_size: tuple[int, int], + interpolation: Optional["tvF.InterpolationMode"] = None, + antialias: bool = True, + ) -> "torch.Tensor": + """ + A wrapper around `tvF.resize` so that it is compatible with torch.compile when the image is a uint8 tensor. + """ + if image.dtype == torch.uint8: + # 256 is used on purpose instead of 255 to avoid numerical differences + # see https://github.com/huggingface/transformers/pull/38540#discussion_r2127165652 + image = image.float() / 256 + image = tvF.resize(image, new_size, interpolation=interpolation, antialias=antialias) + image = image * 256 + # torch.where is used on purpose instead of torch.clamp to avoid bug in torch.compile + # see https://github.com/huggingface/transformers/pull/38540#discussion_r2126888471 + image = torch.where(image > 255, 255, image) + image = torch.where(image < 0, 0, image) + image = image.round().to(torch.uint8) + else: + image = tvF.resize(image, new_size, interpolation=interpolation, antialias=antialias) + return image + + def rescale( + self, + image: "torch.Tensor", + scale: float, + **kwargs, + ) -> "torch.Tensor": + """ + Rescale an image by a scale factor. image = image * scale. + + Args: + image (`torch.Tensor`): + Image to rescale. + scale (`float`): + The scaling factor to rescale pixel values by. + + Returns: + `torch.Tensor`: The rescaled image. + """ + return image * scale + + def normalize( + self, + image: "torch.Tensor", + mean: float | Iterable[float], + std: float | Iterable[float], + **kwargs, + ) -> "torch.Tensor": + """ + Normalize an image. image = (image - image_mean) / image_std. + + Args: + image (`torch.Tensor`): + Image to normalize. + mean (`torch.Tensor`, `float` or `Iterable[float]`): + Image mean to use for normalization. + std (`torch.Tensor`, `float` or `Iterable[float]`): + Image standard deviation to use for normalization. + + Returns: + `torch.Tensor`: The normalized image. + """ + return tvF.normalize(image, mean, std) + + @lru_cache(maxsize=10) + def _fuse_mean_std_and_rescale_factor( + self, + do_normalize: bool | None = None, + image_mean: float | list[float] | None = None, + image_std: float | list[float] | None = None, + do_rescale: bool | None = None, + rescale_factor: float | None = None, + device: Optional["torch.device"] = None, + ) -> tuple: + if do_rescale and do_normalize: + # Fused rescale and normalize + image_mean = torch.tensor(image_mean, device=device) * (1.0 / rescale_factor) + image_std = torch.tensor(image_std, device=device) * (1.0 / rescale_factor) + do_rescale = False + return image_mean, image_std, do_rescale + + def rescale_and_normalize( + self, + images: "torch.Tensor", + do_rescale: bool, + rescale_factor: float, + do_normalize: bool, + image_mean: float | list[float], + image_std: float | list[float], + ) -> "torch.Tensor": + """ + Rescale and normalize images. + """ + image_mean, image_std, do_rescale = self._fuse_mean_std_and_rescale_factor( + do_normalize=do_normalize, + image_mean=image_mean, + image_std=image_std, + do_rescale=do_rescale, + rescale_factor=rescale_factor, + device=images.device, + ) + # if/elif as we use fused rescale and normalize if both are set to True + if do_normalize: + images = self.normalize(images.to(dtype=torch.float32), image_mean, image_std) + elif do_rescale: + images = self.rescale(images, rescale_factor) + + return images + + def center_crop( + self, + image: "torch.Tensor", + size: SizeDict, + **kwargs, + ) -> "torch.Tensor": + """ + Note: override torchvision's center_crop to have the same behavior as the slow processor. + Center crop an image to `(size["height"], size["width"])`. If the input size is smaller than `crop_size` along + any edge, the image is padded with 0's and then center cropped. + + Args: + image (`"torch.Tensor"`): + Image to center crop. + size (`dict[str, int]`): + Size of the output image. + + Returns: + `torch.Tensor`: The center cropped image. + """ + if size.height is None or size.width is None: + raise ValueError(f"The size dictionary must have keys 'height' and 'width'. Got {size.keys()}") + image_height, image_width = image.shape[-2:] + crop_height, crop_width = size.height, size.width + + if crop_width > image_width or crop_height > image_height: + padding_ltrb = [ + (crop_width - image_width) // 2 if crop_width > image_width else 0, + (crop_height - image_height) // 2 if crop_height > image_height else 0, + (crop_width - image_width + 1) // 2 if crop_width > image_width else 0, + (crop_height - image_height + 1) // 2 if crop_height > image_height else 0, + ] + image = tvF.pad(image, padding_ltrb, fill=0) # PIL uses fill value 0 + image_height, image_width = image.shape[-2:] + if crop_width == image_width and crop_height == image_height: + return image + + crop_top = int((image_height - crop_height) / 2.0) + crop_left = int((image_width - crop_width) / 2.0) + return tvF.crop(image, crop_top, crop_left, crop_height, crop_width) + + def convert_to_rgb( + self, + image: ImageInput, + ) -> ImageInput: + """ + Converts an image to RGB format. Only converts if the image is of type PIL.Image.Image, otherwise returns the image + as is. + Args: + image (ImageInput): + The image to convert. + + Returns: + ImageInput: The converted image. + """ + return convert_to_rgb(image) + + def filter_out_unused_kwargs(self, kwargs: dict): + """ + Filter out the unused kwargs from the kwargs dictionary. + """ + if self.unused_kwargs is None: + return kwargs + + for kwarg_name in self.unused_kwargs: + if kwarg_name in kwargs: + logger.warning_once(f"This processor does not use the `{kwarg_name}` parameter. It will be ignored.") + kwargs.pop(kwarg_name) + return kwargs + + def _prepare_images_structure( + self, + images: ImageInput, + expected_ndims: int = 3, + ) -> ImageInput: + """ + Prepare the images structure for processing. + + Args: + images (`ImageInput`): + The input images to process. + + Returns: + `ImageInput`: The images with a valid nesting. + """ + # Checks for `str` in case of URL/local path and optionally loads images + images = self.fetch_images(images) + return make_flat_list_of_images(images, expected_ndims=expected_ndims) + + def _process_image( + self, + image: ImageInput, + do_convert_rgb: bool | None = None, + input_data_format: str | ChannelDimension | None = None, + device: Optional["torch.device"] = None, + ) -> "torch.Tensor": + image_type = get_image_type(image) + if image_type not in [ImageType.PIL, ImageType.TORCH, ImageType.NUMPY]: + raise ValueError(f"Unsupported input image type {image_type}") + + if do_convert_rgb: + image = self.convert_to_rgb(image) + + if image_type == ImageType.PIL: + image = tvF.pil_to_tensor(image) + elif image_type == ImageType.NUMPY: + # not using tvF.to_tensor as it doesn't handle (C, H, W) numpy arrays + image = torch.from_numpy(image).contiguous() + + # If the image is 2D, we need to unsqueeze it to add a channel dimension for processing + if image.ndim == 2: + image = image.unsqueeze(0) + + # Infer the channel dimension format if not provided + if input_data_format is None: + input_data_format = infer_channel_dimension_format(image) + + if input_data_format == ChannelDimension.LAST: + # We force the channel dimension to be first for torch tensors as this is what torchvision expects. + image = image.permute(2, 0, 1).contiguous() + + # Now that we have torch tensors, we can move them to the right device + if device is not None: + image = image.to(device) + + return image + + def _prepare_image_like_inputs( + self, + images: ImageInput, + do_convert_rgb: bool | None = None, + input_data_format: str | ChannelDimension | None = None, + device: Optional["torch.device"] = None, + expected_ndims: int = 3, + ) -> list["torch.Tensor"]: + """ + Prepare image-like inputs for processing. + + Args: + images (`ImageInput`): + The image-like inputs to process. + do_convert_rgb (`bool`, *optional*): + Whether to convert the images to RGB. + input_data_format (`str` or `ChannelDimension`, *optional*): + The input data format of the images. + device (`torch.device`, *optional*): + The device to put the processed images on. + expected_ndims (`int`, *optional*): + The expected number of dimensions for the images. (can be 2 for segmentation maps etc.) + + Returns: + List[`torch.Tensor`]: The processed images. + """ + + # Get structured images (potentially nested) + images = self._prepare_images_structure(images, expected_ndims=expected_ndims) + + process_image_partial = partial( + self._process_image, do_convert_rgb=do_convert_rgb, input_data_format=input_data_format, device=device + ) + + # Check if we have nested structure, assuming the nesting is consistent + has_nested_structure = len(images) > 0 and isinstance(images[0], (list, tuple)) + + if has_nested_structure: + processed_images = [[process_image_partial(img) for img in nested_list] for nested_list in images] + else: + processed_images = [process_image_partial(img) for img in images] + + return processed_images + + def _further_process_kwargs( + self, + size: SizeDict | None = None, + crop_size: SizeDict | None = None, + pad_size: SizeDict | None = None, + default_to_square: bool | None = None, + image_mean: float | list[float] | None = None, + image_std: float | list[float] | None = None, + data_format: ChannelDimension | None = None, + **kwargs, + ) -> dict: + """ + Update kwargs that need further processing before being validated + Can be overridden by subclasses to customize the processing of kwargs. + """ + if kwargs is None: + kwargs = {} + if size is not None: + size = SizeDict(**get_size_dict(size=size, default_to_square=default_to_square)) + if crop_size is not None: + crop_size = SizeDict(**get_size_dict(crop_size, param_name="crop_size")) + if pad_size is not None: + pad_size = SizeDict(**get_size_dict(size=pad_size, param_name="pad_size")) + if isinstance(image_mean, list): + image_mean = tuple(image_mean) + if isinstance(image_std, list): + image_std = tuple(image_std) + if data_format is None: + data_format = ChannelDimension.FIRST + + kwargs["size"] = size + kwargs["crop_size"] = crop_size + kwargs["pad_size"] = pad_size + kwargs["image_mean"] = image_mean + kwargs["image_std"] = image_std + kwargs["data_format"] = data_format + + # torch resize uses interpolation instead of resample + # Check if resample is an int before checking if it's an instance of PILImageResampling + # because if pillow < 9.1.0, resample is an int and PILImageResampling is a module. + # Checking PILImageResampling will fail with error `TypeError: isinstance() arg 2 must be a type or tuple of types`. + resample = kwargs.pop("resample") + kwargs["interpolation"] = ( + pil_torch_interpolation_mapping[resample] if isinstance(resample, (PILImageResampling, int)) else resample + ) + + return kwargs + + def _validate_preprocess_kwargs( + self, + do_rescale: bool | None = None, + rescale_factor: float | None = None, + do_normalize: bool | None = None, + image_mean: float | tuple[float] | None = None, + image_std: float | tuple[float] | None = None, + do_resize: bool | None = None, + size: SizeDict | None = None, + do_center_crop: bool | None = None, + crop_size: SizeDict | None = None, + interpolation: Optional["tvF.InterpolationMode"] = None, + return_tensors: str | TensorType | None = None, + data_format: ChannelDimension | None = None, + **kwargs, + ): + """ + validate the kwargs for the preprocess method. + """ + validate_fast_preprocess_arguments( + do_rescale=do_rescale, + rescale_factor=rescale_factor, + do_normalize=do_normalize, + image_mean=image_mean, + image_std=image_std, + do_resize=do_resize, + size=size, + do_center_crop=do_center_crop, + crop_size=crop_size, + interpolation=interpolation, + return_tensors=return_tensors, + data_format=data_format, + ) + + @auto_docstring + def preprocess(self, images: ImageInput, *args, **kwargs: Unpack[ImagesKwargs]) -> BatchFeature: + # args are not validated, but their order in the `preprocess` and `_preprocess` signatures must be the same + validate_kwargs(captured_kwargs=kwargs.keys(), valid_processor_keys=self._valid_kwargs_names) + + # Perform type validation on received kwargs + validate_typed_dict(self.valid_kwargs, kwargs) + + # Set default kwargs from self. This ensures that if a kwarg is not provided + # by the user, it gets its default value from the instance, or is set to None. + for kwarg_name in self._valid_kwargs_names: + kwargs.setdefault(kwarg_name, getattr(self, kwarg_name, None)) + + # Extract parameters that are only used for preparing the input images + do_convert_rgb = kwargs.pop("do_convert_rgb") + input_data_format = kwargs.pop("input_data_format") + device = kwargs.pop("device") + + # Update kwargs that need further processing before being validated + kwargs = self._further_process_kwargs(**kwargs) + + # Validate kwargs + self._validate_preprocess_kwargs(**kwargs) + + # Pop kwargs that are not needed in _preprocess + kwargs.pop("data_format") + + return self._preprocess_image_like_inputs( + images, *args, do_convert_rgb=do_convert_rgb, input_data_format=input_data_format, device=device, **kwargs + ) + + def _preprocess_image_like_inputs( + self, + images: ImageInput, + *args, + do_convert_rgb: bool, + input_data_format: ChannelDimension, + device: Union[str, "torch.device"] | None = None, + **kwargs: Unpack[ImagesKwargs], + ) -> BatchFeature: + """ + Preprocess image-like inputs. + To be overridden by subclasses when image-like inputs other than images should be processed. + It can be used for segmentation maps, depth maps, etc. + """ + # Prepare input images + images = self._prepare_image_like_inputs( + images=images, do_convert_rgb=do_convert_rgb, input_data_format=input_data_format, device=device + ) + return self._preprocess(images, *args, **kwargs) + + def _preprocess( + self, + images: list["torch.Tensor"], + do_resize: bool, + size: SizeDict, + interpolation: Optional["tvF.InterpolationMode"], + do_center_crop: bool, + crop_size: SizeDict, + do_rescale: bool, + rescale_factor: float, + do_normalize: bool, + image_mean: float | list[float] | None, + image_std: float | list[float] | None, + do_pad: bool | None, + pad_size: SizeDict | None, + disable_grouping: bool | None, + return_tensors: str | TensorType | None, + **kwargs, + ) -> BatchFeature: + # Group images by size for batched resizing + grouped_images, grouped_images_index = group_images_by_shape(images, disable_grouping=disable_grouping) + resized_images_grouped = {} + for shape, stacked_images in grouped_images.items(): + if do_resize: + stacked_images = self.resize(image=stacked_images, size=size, interpolation=interpolation) + resized_images_grouped[shape] = stacked_images + resized_images = reorder_images(resized_images_grouped, grouped_images_index) + + # Group images by size for further processing + # Needed in case do_resize is False, or resize returns images with different sizes + grouped_images, grouped_images_index = group_images_by_shape(resized_images, disable_grouping=disable_grouping) + processed_images_grouped = {} + for shape, stacked_images in grouped_images.items(): + if do_center_crop: + stacked_images = self.center_crop(stacked_images, crop_size) + # Fused rescale and normalize + stacked_images = self.rescale_and_normalize( + stacked_images, do_rescale, rescale_factor, do_normalize, image_mean, image_std + ) + processed_images_grouped[shape] = stacked_images + processed_images = reorder_images(processed_images_grouped, grouped_images_index) + + if do_pad: + processed_images = self.pad(processed_images, pad_size=pad_size, disable_grouping=disable_grouping) + + return BatchFeature(data={"pixel_values": processed_images}, tensor_type=return_tensors) + + def to_dict(self): + encoder_dict = super().to_dict() + + # Filter out None values that are class defaults, but preserve explicitly set None values + filtered_dict = {} + for key, value in encoder_dict.items(): + if value is None: + class_default = getattr(type(self), key, "NOT_FOUND") + # Keep None if user explicitly set it (class default is non-None) + if class_default != "NOT_FOUND" and class_default is not None: + filtered_dict[key] = value + else: + filtered_dict[key] = value + + filtered_dict.pop("_valid_processor_keys", None) + filtered_dict.pop("_valid_kwargs_names", None) + return filtered_dict diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_transforms.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_transforms.py new file mode 100644 index 0000000000000000000000000000000000000000..b8df25511f81b2d748834a8ea49b5dd353b9f176 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_transforms.py @@ -0,0 +1,1032 @@ +# Copyright 2022 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from collections import defaultdict +from collections.abc import Collection, Iterable +from math import ceil +from typing import Optional, Union + +import numpy as np + +from .image_utils import ( + ChannelDimension, + ImageInput, + get_channel_dimension_axis, + get_image_size, + infer_channel_dimension_format, +) +from .utils import ExplicitEnum, TensorType, is_torch_tensor +from .utils.import_utils import ( + is_torch_available, + is_vision_available, + requires_backends, +) + + +if is_vision_available(): + import PIL + + from .image_utils import PILImageResampling + +if is_torch_available(): + import torch + + +def to_channel_dimension_format( + image: np.ndarray, + channel_dim: ChannelDimension | str, + input_channel_dim: ChannelDimension | str | None = None, +) -> np.ndarray: + """ + Converts `image` to the channel dimension format specified by `channel_dim`. The input + can have arbitrary number of leading dimensions. Only last three dimension will be permuted + to format the `image`. + + Args: + image (`numpy.ndarray`): + The image to have its channel dimension set. + channel_dim (`ChannelDimension`): + The channel dimension format to use. + input_channel_dim (`ChannelDimension`, *optional*): + The channel dimension format of the input image. If not provided, it will be inferred from the input image. + + Returns: + `np.ndarray`: The image with the channel dimension set to `channel_dim`. + """ + if not isinstance(image, np.ndarray): + raise TypeError(f"Input image must be of type np.ndarray, got {type(image)}") + + if input_channel_dim is None: + input_channel_dim = infer_channel_dimension_format(image) + + target_channel_dim = ChannelDimension(channel_dim) + if input_channel_dim == target_channel_dim: + return image + + if target_channel_dim == ChannelDimension.FIRST: + axes = list(range(image.ndim - 3)) + [image.ndim - 1, image.ndim - 3, image.ndim - 2] + image = image.transpose(axes) + elif target_channel_dim == ChannelDimension.LAST: + axes = list(range(image.ndim - 3)) + [image.ndim - 2, image.ndim - 1, image.ndim - 3] + image = image.transpose(axes) + else: + raise ValueError(f"Unsupported channel dimension format: {channel_dim}") + + return image + + +def rescale( + image: np.ndarray, + scale: float, + data_format: ChannelDimension | None = None, + dtype: np.dtype = np.float32, + input_data_format: str | ChannelDimension | None = None, +) -> np.ndarray: + """ + Rescales `image` by `scale`. + + Args: + image (`np.ndarray`): + The image to rescale. + scale (`float`): + The scale to use for rescaling the image. + data_format (`ChannelDimension`, *optional*): + The channel dimension format of the image. If not provided, it will be the same as the input image. + dtype (`np.dtype`, *optional*, defaults to `np.float32`): + The dtype of the output image. Defaults to `np.float32`. Used for backwards compatibility with feature + extractors. + input_data_format (`ChannelDimension`, *optional*): + The channel dimension format of the input image. If not provided, it will be inferred from the input image. + + Returns: + `np.ndarray`: The rescaled image. + """ + if not isinstance(image, np.ndarray): + raise TypeError(f"Input image must be of type np.ndarray, got {type(image)}") + + rescaled_image = image.astype(np.float64) * scale # Numpy type promotion has changed, so always upcast first + if data_format is not None: + rescaled_image = to_channel_dimension_format(rescaled_image, data_format, input_data_format) + + rescaled_image = rescaled_image.astype(dtype) # Finally downcast to the desired dtype at the end + + return rescaled_image + + +def _rescale_for_pil_conversion(image): + """ + Detects whether or not the image needs to be rescaled before being converted to a PIL image. + + The assumption is that if the image is of type `np.float` and all values are between 0 and 1, it needs to be + rescaled. + """ + if image.dtype == np.uint8: + do_rescale = False + elif np.allclose(image, image.astype(int)): + if np.all(image >= 0) and np.all(image <= 255): + do_rescale = False + else: + raise ValueError( + "The image to be converted to a PIL image contains values outside the range [0, 255], " + f"got [{image.min()}, {image.max()}] which cannot be converted to uint8." + ) + elif np.all(image >= 0) and np.all(image <= 1): + do_rescale = True + else: + raise ValueError( + "The image to be converted to a PIL image contains values outside the range [0, 1], " + f"got [{image.min()}, {image.max()}] which cannot be converted to uint8." + ) + return do_rescale + + +def to_pil_image( + image: Union[np.ndarray, "PIL.Image.Image", "torch.Tensor"], + do_rescale: bool | None = None, + image_mode: str | None = None, + input_data_format: str | ChannelDimension | None = None, +) -> "PIL.Image.Image": + """ + Converts `image` to a PIL Image. Optionally rescales it and puts the channel dimension back as the last axis if + needed. + + Args: + image (`PIL.Image.Image` or `numpy.ndarray` or `torch.Tensor`): + The image to convert to the `PIL.Image` format. + do_rescale (`bool`, *optional*): + Whether or not to apply the scaling factor (to make pixel values integers between 0 and 255). Will default + to `True` if the image type is a floating type and casting to `int` would result in a loss of precision, + and `False` otherwise. + image_mode (`str`, *optional*): + The mode to use for the PIL image. If unset, will use the default mode for the input image type. + input_data_format (`ChannelDimension`, *optional*): + The channel dimension format of the input image. If unset, will use the inferred format from the input. + + Returns: + `PIL.Image.Image`: The converted image. + """ + requires_backends(to_pil_image, ["vision"]) + + if isinstance(image, PIL.Image.Image): + return image + + # Convert all tensors to numpy arrays before converting to PIL image + if is_torch_tensor(image): + image = image.numpy() + elif not isinstance(image, np.ndarray): + raise ValueError(f"Input image type not supported: {type(image)}") + + # If the channel has been moved to first dim, we put it back at the end. + image = to_channel_dimension_format(image, ChannelDimension.LAST, input_data_format) + + # If there is a single channel, we squeeze it, as otherwise PIL can't handle it. + image = np.squeeze(image, axis=-1) if image.shape[-1] == 1 else image + + # PIL.Image can only store uint8 values so we rescale the image to be between 0 and 255 if needed. + do_rescale = _rescale_for_pil_conversion(image) if do_rescale is None else do_rescale + + if do_rescale: + image = rescale(image, 255) + + image = image.astype(np.uint8) + return PIL.Image.fromarray(image, mode=image_mode) + + +def get_size_with_aspect_ratio(image_size, size, max_size=None) -> tuple[int, int]: + """ + Computes the output image size given the input image size and the desired output size. + + Args: + image_size (`tuple[int, int]`): + The input image size. + size (`int`): + The desired output size. + max_size (`int`, *optional*): + The maximum allowed output size. + """ + height, width = image_size + raw_size = None + if max_size is not None: + min_original_size = float(min((height, width))) + max_original_size = float(max((height, width))) + if max_original_size / min_original_size * size > max_size: + raw_size = max_size * min_original_size / max_original_size + size = int(round(raw_size)) + + if (height <= width and height == size) or (width <= height and width == size): + oh, ow = height, width + elif width < height: + ow = size + if max_size is not None and raw_size is not None: + oh = int(raw_size * height / width) + else: + oh = int(size * height / width) + else: + oh = size + if max_size is not None and raw_size is not None: + ow = int(raw_size * width / height) + else: + ow = int(size * width / height) + + return (oh, ow) + + +# Logic adapted from torchvision resizing logic: https://github.com/pytorch/vision/blob/511924c1ced4ce0461197e5caa64ce5b9e558aab/torchvision/transforms/functional.py#L366 +def get_resize_output_image_size( + input_image: np.ndarray, + size: int | tuple[int, int] | list[int] | tuple[int, ...], + default_to_square: bool = True, + max_size: int | None = None, + input_data_format: str | ChannelDimension | None = None, +) -> tuple: + """ + Find the target (height, width) dimension of the output image after resizing given the input image and the desired + size. + + Args: + input_image (`np.ndarray`): + The image to resize. + size (`int` or `tuple[int, int]` or list[int] or `tuple[int]`): + The size to use for resizing the image. If `size` is a sequence like (h, w), output size will be matched to + this. + + If `size` is an int and `default_to_square` is `True`, then image will be resized to (size, size). If + `size` is an int and `default_to_square` is `False`, then smaller edge of the image will be matched to this + number. i.e, if height > width, then image will be rescaled to (size * height / width, size). + default_to_square (`bool`, *optional*, defaults to `True`): + How to convert `size` when it is a single int. If set to `True`, the `size` will be converted to a square + (`size`,`size`). If set to `False`, will replicate + [`torchvision.transforms.Resize`](https://pytorch.org/vision/stable/transforms.html#torchvision.transforms.Resize) + with support for resizing only the smallest edge and providing an optional `max_size`. + max_size (`int`, *optional*): + The maximum allowed for the longer edge of the resized image: if the longer edge of the image is greater + than `max_size` after being resized according to `size`, then the image is resized again so that the longer + edge is equal to `max_size`. As a result, `size` might be overruled, i.e the smaller edge may be shorter + than `size`. Only used if `default_to_square` is `False`. + input_data_format (`ChannelDimension`, *optional*): + The channel dimension format of the input image. If unset, will use the inferred format from the input. + + Returns: + `tuple`: The target (height, width) dimension of the output image after resizing. + """ + if isinstance(size, (tuple, list)): + if len(size) == 2: + return tuple(size) + elif len(size) == 1: + # Perform same logic as if size was an int + size = size[0] + else: + raise ValueError("size must have 1 or 2 elements if it is a list or tuple") + + if default_to_square: + return (size, size) + + height, width = get_image_size(input_image, input_data_format) + short, long = (width, height) if width <= height else (height, width) + requested_new_short = size + + new_short, new_long = requested_new_short, int(requested_new_short * long / short) + + if max_size is not None: + if max_size <= requested_new_short: + raise ValueError( + f"max_size = {max_size} must be strictly greater than the requested " + f"size for the smaller edge size = {size}" + ) + if new_long > max_size: + new_short, new_long = int(max_size * new_short / new_long), max_size + + return (new_long, new_short) if width <= height else (new_short, new_long) + + +def resize( + image: np.ndarray, + size: tuple[int, int], + resample: Optional["PILImageResampling"] = None, + reducing_gap: int | None = None, + data_format: ChannelDimension | None = None, + return_numpy: bool = True, + input_data_format: str | ChannelDimension | None = None, +) -> np.ndarray: + """ + Resizes `image` to `(height, width)` specified by `size` using the PIL library. + + Args: + image (`np.ndarray`): + The image to resize. + size (`tuple[int, int]`): + The size to use for resizing the image. + resample (`int`, *optional*, defaults to `PILImageResampling.BILINEAR`): + The filter to user for resampling. + reducing_gap (`int`, *optional*): + Apply optimization by resizing the image in two steps. The bigger `reducing_gap`, the closer the result to + the fair resampling. See corresponding Pillow documentation for more details. + data_format (`ChannelDimension`, *optional*): + The channel dimension format of the output image. If unset, will use the inferred format from the input. + return_numpy (`bool`, *optional*, defaults to `True`): + Whether or not to return the resized image as a numpy array. If False a `PIL.Image.Image` object is + returned. + input_data_format (`ChannelDimension`, *optional*): + The channel dimension format of the input image. If unset, will use the inferred format from the input. + + Returns: + `np.ndarray`: The resized image. + """ + requires_backends(resize, ["vision"]) + + resample = resample if resample is not None else PILImageResampling.BILINEAR + + if not len(size) == 2: + raise ValueError("size must have 2 elements") + + # For all transformations, we want to keep the same data format as the input image unless otherwise specified. + # The resized image from PIL will always have channels last, so find the input format first. + if input_data_format is None: + input_data_format = infer_channel_dimension_format(image) + data_format = input_data_format if data_format is None else data_format + + # To maintain backwards compatibility with the resizing done in previous image feature extractors, we use + # the pillow library to resize the image and then convert back to numpy + do_rescale = False + if not isinstance(image, PIL.Image.Image): + do_rescale = _rescale_for_pil_conversion(image) + image = to_pil_image(image, do_rescale=do_rescale, input_data_format=input_data_format) + height, width = size + # PIL images are in the format (width, height) + resized_image = image.resize((width, height), resample=resample, reducing_gap=reducing_gap) + + if return_numpy: + resized_image = np.array(resized_image) + # If the input image channel dimension was of size 1, then it is dropped when converting to a PIL image + # so we need to add it back if necessary. + resized_image = np.expand_dims(resized_image, axis=-1) if resized_image.ndim == 2 else resized_image + # The image is always in channels last format after converting from a PIL image + resized_image = to_channel_dimension_format( + resized_image, data_format, input_channel_dim=ChannelDimension.LAST + ) + # If an image was rescaled to be in the range [0, 255] before converting to a PIL image, then we need to + # rescale it back to the original range. + resized_image = rescale(resized_image, 1 / 255) if do_rescale else resized_image + return resized_image + + +def normalize( + image: np.ndarray, + mean: float | Collection[float], + std: float | Collection[float], + data_format: ChannelDimension | None = None, + input_data_format: str | ChannelDimension | None = None, +) -> np.ndarray: + """ + Normalizes `image` using the mean and standard deviation specified by `mean` and `std`. + + image = (image - mean) / std + + Args: + image (`np.ndarray`): + The image to normalize. + mean (`float` or `Collection[float]`): + The mean to use for normalization. + std (`float` or `Collection[float]`): + The standard deviation to use for normalization. + data_format (`ChannelDimension`, *optional*): + The channel dimension format of the output image. If unset, will use the inferred format from the input. + input_data_format (`ChannelDimension`, *optional*): + The channel dimension format of the input image. If unset, will use the inferred format from the input. + """ + if not isinstance(image, np.ndarray): + raise TypeError("image must be a numpy array") + + if input_data_format is None: + input_data_format = infer_channel_dimension_format(image) + + channel_axis = get_channel_dimension_axis(image, input_data_format=input_data_format) + num_channels = image.shape[channel_axis] + + # We cast to float32 to avoid errors that can occur when subtracting uint8 values. + # We preserve the original dtype if it is a float type to prevent upcasting float16. + if not np.issubdtype(image.dtype, np.floating): + image = image.astype(np.float32) + + if isinstance(mean, Collection): + if len(mean) != num_channels: + raise ValueError(f"mean must have {num_channels} elements if it is an iterable, got {len(mean)}") + else: + mean = [mean] * num_channels + mean = np.array(mean, dtype=image.dtype) + + if isinstance(std, Collection): + if len(std) != num_channels: + raise ValueError(f"std must have {num_channels} elements if it is an iterable, got {len(std)}") + else: + std = [std] * num_channels + std = np.array(std, dtype=image.dtype) + + if input_data_format == ChannelDimension.LAST: + image = (image - mean) / std + else: + image = ((image.T - mean) / std).T + + image = to_channel_dimension_format(image, data_format, input_data_format) if data_format is not None else image + return image + + +def center_crop( + image: np.ndarray, + size: tuple[int, int], + data_format: str | ChannelDimension | None = None, + input_data_format: str | ChannelDimension | None = None, +) -> np.ndarray: + """ + Crops the `image` to the specified `size` using a center crop. Note that if the image is too small to be cropped to + the size given, it will be padded (so the returned result will always be of size `size`). + + Args: + image (`np.ndarray`): + The image to crop. + size (`tuple[int, int]`): + The target size for the cropped image. + data_format (`str` or `ChannelDimension`, *optional*): + The channel dimension format for the output image. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format. + If unset, will use the inferred format of the input image. + input_data_format (`str` or `ChannelDimension`, *optional*): + The channel dimension format for the input image. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format. + If unset, will use the inferred format of the input image. + Returns: + `np.ndarray`: The cropped image. + """ + requires_backends(center_crop, ["vision"]) + + if not isinstance(image, np.ndarray): + raise TypeError(f"Input image must be of type np.ndarray, got {type(image)}") + + if not isinstance(size, Iterable) or len(size) != 2: + raise ValueError("size must have 2 elements representing the height and width of the output image") + + if input_data_format is None: + input_data_format = infer_channel_dimension_format(image) + output_data_format = data_format if data_format is not None else input_data_format + + # We perform the crop in (C, H, W) format and then convert to the output format + image = to_channel_dimension_format(image, ChannelDimension.FIRST, input_data_format) + + orig_height, orig_width = get_image_size(image, ChannelDimension.FIRST) + crop_height, crop_width = size + crop_height, crop_width = int(crop_height), int(crop_width) + + # In case size is odd, (image_shape[0] + size[0]) // 2 won't give the proper result. + top = (orig_height - crop_height) // 2 + bottom = top + crop_height + # In case size is odd, (image_shape[1] + size[1]) // 2 won't give the proper result. + left = (orig_width - crop_width) // 2 + right = left + crop_width + + # Check if cropped area is within image boundaries + if top >= 0 and bottom <= orig_height and left >= 0 and right <= orig_width: + image = image[..., top:bottom, left:right] + image = to_channel_dimension_format(image, output_data_format, ChannelDimension.FIRST) + return image + + # Otherwise, we may need to pad if the image is too small. Oh joy... + new_height = max(crop_height, orig_height) + new_width = max(crop_width, orig_width) + new_shape = image.shape[:-2] + (new_height, new_width) + new_image = np.zeros_like(image, shape=new_shape) + + # If the image is too small, pad it with zeros + top_pad = ceil((new_height - orig_height) / 2) + bottom_pad = top_pad + orig_height + left_pad = ceil((new_width - orig_width) / 2) + right_pad = left_pad + orig_width + new_image[..., top_pad:bottom_pad, left_pad:right_pad] = image + + top += top_pad + bottom += top_pad + left += left_pad + right += left_pad + + new_image = new_image[..., max(0, top) : min(new_height, bottom), max(0, left) : min(new_width, right)] + new_image = to_channel_dimension_format(new_image, output_data_format, ChannelDimension.FIRST) + + return new_image + + +def _center_to_corners_format_torch(bboxes_center: "torch.Tensor") -> "torch.Tensor": + center_x, center_y, width, height = bboxes_center.unbind(-1) + bbox_corners = torch.stack( + # top left x, top left y, bottom right x, bottom right y + [(center_x - 0.5 * width), (center_y - 0.5 * height), (center_x + 0.5 * width), (center_y + 0.5 * height)], + dim=-1, + ) + return bbox_corners + + +def _center_to_corners_format_numpy(bboxes_center: np.ndarray) -> np.ndarray: + center_x, center_y, width, height = bboxes_center.T + bboxes_corners = np.stack( + # top left x, top left y, bottom right x, bottom right y + [center_x - 0.5 * width, center_y - 0.5 * height, center_x + 0.5 * width, center_y + 0.5 * height], + axis=-1, + ) + return bboxes_corners + + +# 2 functions below inspired by https://github.com/facebookresearch/detr/blob/master/util/box_ops.py +def center_to_corners_format(bboxes_center: TensorType) -> TensorType: + """ + Converts bounding boxes from center format to corners format. + + center format: contains the coordinate for the center of the box and its width, height dimensions + (center_x, center_y, width, height) + corners format: contains the coordinates for the top-left and bottom-right corners of the box + (top_left_x, top_left_y, bottom_right_x, bottom_right_y) + """ + # Function is used during model forward pass, so we use torch if relevant, without converting to numpy + if is_torch_tensor(bboxes_center): + return _center_to_corners_format_torch(bboxes_center) + elif isinstance(bboxes_center, np.ndarray): + return _center_to_corners_format_numpy(bboxes_center) + + raise ValueError(f"Unsupported input type {type(bboxes_center)}") + + +def _corners_to_center_format_torch(bboxes_corners: "torch.Tensor") -> "torch.Tensor": + top_left_x, top_left_y, bottom_right_x, bottom_right_y = bboxes_corners.unbind(-1) + b = [ + (top_left_x + bottom_right_x) / 2, # center x + (top_left_y + bottom_right_y) / 2, # center y + (bottom_right_x - top_left_x), # width + (bottom_right_y - top_left_y), # height + ] + return torch.stack(b, dim=-1) + + +def _corners_to_center_format_numpy(bboxes_corners: np.ndarray) -> np.ndarray: + top_left_x, top_left_y, bottom_right_x, bottom_right_y = bboxes_corners.T + bboxes_center = np.stack( + [ + (top_left_x + bottom_right_x) / 2, # center x + (top_left_y + bottom_right_y) / 2, # center y + (bottom_right_x - top_left_x), # width + (bottom_right_y - top_left_y), # height + ], + axis=-1, + ) + return bboxes_center + + +def corners_to_center_format(bboxes_corners: TensorType) -> TensorType: + """ + Converts bounding boxes from corners format to center format. + + corners format: contains the coordinates for the top-left and bottom-right corners of the box + (top_left_x, top_left_y, bottom_right_x, bottom_right_y) + center format: contains the coordinate for the center of the box and its the width, height dimensions + (center_x, center_y, width, height) + """ + # Inverse function accepts different input types so implemented here too + if is_torch_tensor(bboxes_corners): + return _corners_to_center_format_torch(bboxes_corners) + elif isinstance(bboxes_corners, np.ndarray): + return _corners_to_center_format_numpy(bboxes_corners) + + raise ValueError(f"Unsupported input type {type(bboxes_corners)}") + + +# 2 functions below copied from https://github.com/cocodataset/panopticapi/blob/master/panopticapi/utils.py +# Copyright (c) 2018, Alexander Kirillov +# All rights reserved. +def rgb_to_id(color): + """ + Converts RGB color to unique ID. + """ + if isinstance(color, np.ndarray) and len(color.shape) == 3: + if color.dtype == np.uint8: + color = color.astype(np.int32) + return color[:, :, 0] + 256 * color[:, :, 1] + 256 * 256 * color[:, :, 2] + return int(color[0] + 256 * color[1] + 256 * 256 * color[2]) + + +def id_to_rgb(id_map): + """ + Converts unique ID to RGB color. + """ + if isinstance(id_map, np.ndarray): + id_map_copy = id_map.copy() + rgb_shape = tuple(list(id_map.shape) + [3]) + rgb_map = np.zeros(rgb_shape, dtype=np.uint8) + for i in range(3): + rgb_map[..., i] = id_map_copy % 256 + id_map_copy //= 256 + return rgb_map + color = [] + for _ in range(3): + color.append(id_map % 256) + id_map //= 256 + return color + + +class PaddingMode(ExplicitEnum): + """ + Enum class for the different padding modes to use when padding images. + """ + + CONSTANT = "constant" + REFLECT = "reflect" + REPLICATE = "replicate" + SYMMETRIC = "symmetric" + + +def pad( + image: np.ndarray, + padding: int | tuple[int, int] | Iterable[tuple[int, int]], + mode: PaddingMode = PaddingMode.CONSTANT, + constant_values: float | Iterable[float] = 0.0, + data_format: str | ChannelDimension | None = None, + input_data_format: str | ChannelDimension | None = None, +) -> np.ndarray: + """ + Pads the `image` with the specified (height, width) `padding` and `mode`. + + Args: + image (`np.ndarray`): + The image to pad. + padding (`int` or `tuple[int, int]` or `Iterable[tuple[int, int]]`): + Padding to apply to the edges of the height, width axes. Can be one of three formats: + - `((before_height, after_height), (before_width, after_width))` unique pad widths for each axis. + - `((before, after),)` yields same before and after pad for height and width. + - `(pad,)` or int is a shortcut for before = after = pad width for all axes. + mode (`PaddingMode`): + The padding mode to use. Can be one of: + - `"constant"`: pads with a constant value. + - `"reflect"`: pads with the reflection of the vector mirrored on the first and last values of the + vector along each axis. + - `"replicate"`: pads with the replication of the last value on the edge of the array along each axis. + - `"symmetric"`: pads with the reflection of the vector mirrored along the edge of the array. + constant_values (`float` or `Iterable[float]`, *optional*): + The value to use for the padding if `mode` is `"constant"`. + data_format (`str` or `ChannelDimension`, *optional*): + The channel dimension format for the output image. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format. + If unset, will use same as the input image. + input_data_format (`str` or `ChannelDimension`, *optional*): + The channel dimension format for the input image. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format. + If unset, will use the inferred format of the input image. + + Returns: + `np.ndarray`: The padded image. + + """ + if input_data_format is None: + input_data_format = infer_channel_dimension_format(image) + + def _expand_for_data_format(values): + """ + Convert values to be in the format expected by np.pad based on the data format. + """ + if isinstance(values, (int, float)): + values = ((values, values), (values, values)) + elif isinstance(values, tuple) and len(values) == 1: + values = ((values[0], values[0]), (values[0], values[0])) + elif isinstance(values, tuple) and len(values) == 2 and isinstance(values[0], int): + values = (values, values) + elif isinstance(values, tuple) and len(values) == 2 and isinstance(values[0], tuple): + pass + else: + raise ValueError(f"Unsupported format: {values}") + + # add 0 for channel dimension + values = ((0, 0), *values) if input_data_format == ChannelDimension.FIRST else (*values, (0, 0)) + + # Add additional padding if there's a batch dimension + values = ((0, 0), *values) if image.ndim == 4 else values + return values + + padding = _expand_for_data_format(padding) + + if mode == PaddingMode.CONSTANT: + constant_values = _expand_for_data_format(constant_values) + image = np.pad(image, padding, mode="constant", constant_values=constant_values) + elif mode == PaddingMode.REFLECT: + image = np.pad(image, padding, mode="reflect") + elif mode == PaddingMode.REPLICATE: + image = np.pad(image, padding, mode="edge") + elif mode == PaddingMode.SYMMETRIC: + image = np.pad(image, padding, mode="symmetric") + else: + raise ValueError(f"Invalid padding mode: {mode}") + + image = to_channel_dimension_format(image, data_format, input_data_format) if data_format is not None else image + return image + + +# TODO (Amy): Accept 1/3/4 channel numpy array as input and return np.array as default +def convert_to_rgb(image: ImageInput) -> ImageInput: + """ + Converts an image to RGB format. Only converts if the image is of type PIL.Image.Image, otherwise returns the image + as is. + Args: + image (Image): + The image to convert. + """ + requires_backends(convert_to_rgb, ["vision"]) + + if not isinstance(image, PIL.Image.Image): + return image + + if image.mode == "RGB": + return image + + image = image.convert("RGB") + return image + + +def flip_channel_order( + image: np.ndarray, + data_format: ChannelDimension | None = None, + input_data_format: str | ChannelDimension | None = None, +) -> np.ndarray: + """ + Flips the channel order of the image. + + If the image is in RGB format, it will be converted to BGR and vice versa. + + Args: + image (`np.ndarray`): + The image to flip. + data_format (`ChannelDimension`, *optional*): + The channel dimension format for the output image. Can be one of: + - `ChannelDimension.FIRST`: image in (num_channels, height, width) format. + - `ChannelDimension.LAST`: image in (height, width, num_channels) format. + If unset, will use same as the input image. + input_data_format (`ChannelDimension`, *optional*): + The channel dimension format for the input image. Can be one of: + - `ChannelDimension.FIRST`: image in (num_channels, height, width) format. + - `ChannelDimension.LAST`: image in (height, width, num_channels) format. + If unset, will use the inferred format of the input image. + """ + input_data_format = infer_channel_dimension_format(image) if input_data_format is None else input_data_format + + if input_data_format == ChannelDimension.LAST: + image = image[..., ::-1] + elif input_data_format == ChannelDimension.FIRST: + image = image[::-1, ...] + else: + raise ValueError(f"Unsupported channel dimension: {input_data_format}") + + if data_format is not None: + image = to_channel_dimension_format(image, data_format, input_channel_dim=input_data_format) + return image + + +def split_to_tiles(images: "torch.Tensor", num_tiles_height: int, num_tiles_width: int) -> "torch.Tensor": + # Split image into number of required tiles (width x height) + batch_size, num_channels, height, width = images.size() + images = images.view( + batch_size, + num_channels, + num_tiles_height, + height // num_tiles_height, + num_tiles_width, + width // num_tiles_width, + ) + # Permute dimensions to reorder the axes + image = images.permute(0, 2, 4, 1, 3, 5).contiguous() + # Reshape into the desired output shape (batch_size * 4, num_channels, width/2, height/2) + image = image.view( + batch_size, + num_tiles_width * num_tiles_height, + num_channels, + height // num_tiles_height, + width // num_tiles_width, + ) + return image + + +def _group_images_by_shape(nested_images, *paired_inputs, is_nested: bool = False): + """ + Helper function to flatten a single level of nested image and batch structures and group by shape. + Args: + nested_images (list): + A list of images or a single tensor + paired_inputs (Any, *optional*): + Zero or more lists that mirror the structure of `nested_images` (flat list, or list of lists when + `is_nested=True`). Each element is paired 1:1 with the corresponding image so it can be grouped by the + same shape key. These paired values are grouped alongside `nested_images` but are not stacked in the output, so + they do not need to be tensors. + is_nested (bool, *optional*, defaults to False): + Whether the images are nested. + Returns: + tuple[dict, ...]: + - A dictionary with shape as key and list of images with that shape as value + - A dictionary with shape as key and list of paired values with that shape as value + - A dictionary mapping original indices to (shape, index) tuples + - A dictionary mapping original indices to (shape, index) tuples for each paired input + """ + grouped_images = defaultdict(list) + grouped_images_index = {} + paired_grouped_values = [defaultdict(list) for _ in paired_inputs] + + # Normalize inputs to consistent nested structure + normalized_images = [nested_images] if not is_nested else nested_images + normalized_paired = [] + for paired_input in paired_inputs: + normalized_paired.append([paired_input] if not is_nested else paired_input) + + # Process each image and group by shape + for i, (sublist, *paired_sublists) in enumerate(zip(normalized_images, *normalized_paired)): + for j, (image, *paired_values) in enumerate(zip(sublist, *paired_sublists)): + key = (i, j) if is_nested else j + shape = image.shape[1:] + + # Add to grouped structures + grouped_images[shape].append(image) + for paired_index, paired_value in enumerate(paired_values): + paired_grouped_values[paired_index][shape].append(paired_value) + grouped_images_index[key] = (shape, len(grouped_images[shape]) - 1) + + # Store structure size for nested inputs to handle empty sublists during reconstruction + if is_nested: + grouped_images_index["_num_sublists"] = len(normalized_images) + + return grouped_images, *paired_grouped_values, grouped_images_index + + +def _reconstruct_nested_structure(indices, processed_images): + """Helper function to reconstruct a single level nested structure.""" + # Get the number of sublists (handles empty sublists like in [[], [image]]) + num_sublists = indices.pop("_num_sublists", None) + + # Group indices by outer index + nested_indices = defaultdict(list) + for i, j in indices: + nested_indices[i].append(j) + + # Determine the number of outer sublists + if num_sublists is not None: + max_outer_idx = num_sublists - 1 + elif nested_indices: + max_outer_idx = max(nested_indices.keys()) + else: + return [] + + # Create the result structure + result = [] + for i in range(max_outer_idx + 1): + if i not in nested_indices: + result.append([]) + else: + inner_max_idx = max(nested_indices[i]) + inner_list = [None] * (inner_max_idx + 1) + for j in nested_indices[i]: + shape, idx = indices[(i, j)] + inner_list[j] = processed_images[shape][idx] + result.append(inner_list) + + return result + + +def _iterate_items(items, is_nested: bool): + """ + Helper function to iterate over items yielding (key, item) pairs. + + For nested structures, yields ((row_index, col_index), item). + For flat structures, yields (index, item). + """ + if is_nested: + for i, row in enumerate(items): + for j, item in enumerate(row): + yield (i, j), item + else: + for i, item in enumerate(items): + yield i, item + + +def _get_device_from_images(images, is_nested: bool) -> "torch.device": + """ + Get the device from the first non-empty element in a (potentially nested) list of images. + + Handles cases like `images = [[], [image]]` where the first sublist may be empty. + """ + if is_nested: + for row in images: + if isinstance(row, torch.Tensor): + return row.device + if isinstance(row, list) and len(row) > 0: + return row[0].device + return images[0].device + + +def group_images_by_shape( + images: Union[list["torch.Tensor"], "torch.Tensor"], + *paired_inputs, + disable_grouping: bool | None, + is_nested: bool = False, +) -> tuple[dict, ...]: + """ + Groups images by shape. + Returns a dictionary with the shape as key and a list of images with that shape as value, + and a dictionary with the index of the image in the original list as key and the shape and index in the grouped list as value. + + The function supports both flat lists of tensors and nested structures. + The input must be either all flat or all nested, not a mix of both. + + Args: + images (Union[list["torch.Tensor"], "torch.Tensor"]): + A list of images or a single tensor + paired_inputs (Any, *optional*): + Zero or more lists that mirror the structure of `images` (flat list, or list of lists when + `is_nested=True`). Each element is paired 1:1 with the corresponding image so it can be grouped by the + same shape key. These paired values are grouped alongside `images` but are not stacked in the output, so + they do not need to be tensors. + disable_grouping (bool): + Whether to disable grouping. If None, will be set to True if the images are on CPU, and False otherwise. + This choice is based on empirical observations, as detailed here: https://github.com/huggingface/transformers/pull/38157 + is_nested (bool, *optional*, defaults to False): + Whether the images are nested. + + Returns: + tuple[dict, ...]: + - A dictionary with shape as key and list/batch of images with that shape as value + - Zero or more dictionaries (one per argument in `*paired_inputs`) grouped consistently with `images`; these carry + the corresponding per-item values and are not stacked + - A dictionary mapping original indices to (shape, index) tuples + """ + # If disable grouping is not explicitly provided, we favor disabling it if the images are on CPU, and enabling it otherwise. + if disable_grouping is None: + device = _get_device_from_images(images, is_nested) + disable_grouping = device == "cpu" + + if disable_grouping: + grouped_images_index = {key: (key, 0) for key, _ in _iterate_items(images, is_nested)} + if is_nested: + grouped_images_index["_num_sublists"] = len(images) + + return ( + {key: img.unsqueeze(0) for key, img in _iterate_items(images, is_nested)}, + *[ + {key: item.unsqueeze(0) for key, item in _iterate_items(paired_list, is_nested)} + for paired_list in paired_inputs + ], + grouped_images_index, + ) + + # Handle single level nested structure + grouped_images, *paired_grouped_values, grouped_images_index = _group_images_by_shape( + images, *paired_inputs, is_nested=is_nested + ) + + # Stack images with the same shape + grouped_images = {shape: torch.stack(images_list, dim=0) for shape, images_list in grouped_images.items()} + + return grouped_images, *paired_grouped_values, grouped_images_index + + +def reorder_images( + processed_images: dict[tuple[int, int], "torch.Tensor"], + grouped_images_index: dict[int | tuple[int, int], tuple[tuple[int, int], int]], + is_nested: bool = False, +) -> Union[list["torch.Tensor"], "torch.Tensor"]: + """ + Reconstructs images in the original order, preserving the original structure (nested or not). + The input structure is either all flat or all nested. + + Args: + processed_images (dict[tuple[int, int], "torch.Tensor"]): + Dictionary mapping shapes to batched processed images. + grouped_images_index (dict[Union[int, tuple[int, int]], tuple[tuple[int, int], int]]): + Dictionary mapping original indices to (shape, index) tuples. + is_nested (bool, *optional*, defaults to False): + Whether the images are nested. Cannot be inferred from the input, as some processing functions outputs nested images. + even with non nested images,e.g functions splitting images into patches. We thus can't deduce is_nested from the input. + + + Returns: + Union[list["torch.Tensor"], "torch.Tensor"]: + Images in the original structure. + """ + if not is_nested: + return [ + processed_images[grouped_images_index[i][0]][grouped_images_index[i][1]] + for i in range(len(grouped_images_index)) + ] + + return _reconstruct_nested_structure(grouped_images_index, processed_images) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..c4e4d5927dd56b8e70e3495d805806f6bcf70acd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/image_utils.py @@ -0,0 +1,952 @@ +# Copyright 2021 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import base64 +import os +from collections.abc import Iterable +from dataclasses import dataclass +from io import BytesIO +from typing import Optional, Union + +import httpx +import numpy as np + +from .utils import ( + ExplicitEnum, + is_numpy_array, + is_torch_available, + is_torch_tensor, + is_torchvision_available, + is_vision_available, + logging, + requires_backends, + to_numpy, +) +from .utils.constants import ( # noqa: F401 + IMAGENET_DEFAULT_MEAN, + IMAGENET_DEFAULT_STD, + IMAGENET_STANDARD_MEAN, + IMAGENET_STANDARD_STD, + OPENAI_CLIP_MEAN, + OPENAI_CLIP_STD, +) + + +if is_vision_available(): + import PIL.Image + import PIL.ImageOps + + PILImageResampling = PIL.Image.Resampling + + if is_torchvision_available(): + from torchvision.transforms import InterpolationMode + + pil_torch_interpolation_mapping = { + PILImageResampling.NEAREST: InterpolationMode.NEAREST_EXACT, + PILImageResampling.BOX: InterpolationMode.BOX, + PILImageResampling.BILINEAR: InterpolationMode.BILINEAR, + PILImageResampling.HAMMING: InterpolationMode.HAMMING, + PILImageResampling.BICUBIC: InterpolationMode.BICUBIC, + PILImageResampling.LANCZOS: InterpolationMode.LANCZOS, + } + else: + pil_torch_interpolation_mapping = {} + + +if is_torch_available(): + import torch + + +logger = logging.get_logger(__name__) + + +ImageInput = Union[ + "PIL.Image.Image", np.ndarray, "torch.Tensor", list["PIL.Image.Image"], list[np.ndarray], list["torch.Tensor"] +] + + +class ChannelDimension(ExplicitEnum): + FIRST = "channels_first" + LAST = "channels_last" + + +class AnnotationFormat(ExplicitEnum): + COCO_DETECTION = "coco_detection" + COCO_PANOPTIC = "coco_panoptic" + + +AnnotationType = dict[str, int | str | list[dict]] + + +def is_pil_image(img): + return is_vision_available() and isinstance(img, PIL.Image.Image) + + +class ImageType(ExplicitEnum): + PIL = "pillow" + TORCH = "torch" + NUMPY = "numpy" + + +def get_image_type(image): + if is_pil_image(image): + return ImageType.PIL + if is_torch_tensor(image): + return ImageType.TORCH + if is_numpy_array(image): + return ImageType.NUMPY + raise ValueError(f"Unrecognized image type {type(image)}") + + +def is_valid_image(img): + return is_pil_image(img) or is_numpy_array(img) or is_torch_tensor(img) + + +def is_valid_list_of_images(images: list): + return images and all(is_valid_image(image) for image in images) + + +def concatenate_list(input_list): + if isinstance(input_list[0], list): + return [item for sublist in input_list for item in sublist] + elif isinstance(input_list[0], np.ndarray): + return np.concatenate(input_list, axis=0) + elif isinstance(input_list[0], torch.Tensor): + return torch.cat(input_list, dim=0) + + +def valid_images(imgs): + # If we have an list of images, make sure every image is valid + if isinstance(imgs, (list, tuple)): + for img in imgs: + if not valid_images(img): + return False + # If not a list of tuple, we have been given a single image or batched tensor of images + elif not is_valid_image(imgs): + return False + return True + + +def is_batched(img): + if isinstance(img, (list, tuple)): + return is_valid_image(img[0]) + return False + + +def is_scaled_image(image: np.ndarray) -> bool: + """ + Checks to see whether the pixel values have already been rescaled to [0, 1]. + """ + if image.dtype == np.uint8: + return False + + # It's possible the image has pixel values in [0, 255] but is of floating type + return np.min(image) >= 0 and np.max(image) <= 1 + + +def make_list_of_images(images, expected_ndims: int = 3) -> list[ImageInput]: + """ + Ensure that the output is a list of images. If the input is a single image, it is converted to a list of length 1. + If the input is a batch of images, it is converted to a list of images. + + Args: + images (`ImageInput`): + Image of images to turn into a list of images. + expected_ndims (`int`, *optional*, defaults to 3): + Expected number of dimensions for a single input image. If the input image has a different number of + dimensions, an error is raised. + """ + if is_batched(images): + return images + + # Either the input is a single image, in which case we create a list of length 1 + if is_pil_image(images): + # PIL images are never batched + return [images] + + if is_valid_image(images): + if images.ndim == expected_ndims + 1: + # Batch of images + images = list(images) + elif images.ndim == expected_ndims: + # Single image + images = [images] + else: + raise ValueError( + f"Invalid image shape. Expected either {expected_ndims + 1} or {expected_ndims} dimensions, but got" + f" {images.ndim} dimensions." + ) + return images + raise ValueError( + f"Invalid image type. Expected either PIL.Image.Image, numpy.ndarray, or torch.Tensor, but got {type(images)}." + ) + + +def make_flat_list_of_images( + images: list[ImageInput] | ImageInput, + expected_ndims: int = 3, +) -> ImageInput: + """ + Ensure that the output is a flat list of images. If the input is a single image, it is converted to a list of length 1. + If the input is a nested list of images, it is converted to a flat list of images. + Args: + images (`Union[list[ImageInput], ImageInput]`): + The input image. + expected_ndims (`int`, *optional*, defaults to 3): + The expected number of dimensions for a single input image. + Returns: + list: A list of images or a 4d array of images. + """ + # If the input is a nested list of images, we flatten it + if ( + isinstance(images, (list, tuple)) + and all(isinstance(images_i, (list, tuple)) for images_i in images) + and all(is_valid_list_of_images(images_i) or not images_i for images_i in images) + ): + return [img for img_list in images for img in img_list] + + if isinstance(images, (list, tuple)) and is_valid_list_of_images(images): + if is_pil_image(images[0]) or images[0].ndim == expected_ndims: + return images + if images[0].ndim == expected_ndims + 1: + return [img for img_list in images for img in img_list] + + if is_valid_image(images): + if is_pil_image(images) or images.ndim == expected_ndims: + return [images] + if images.ndim == expected_ndims + 1: + return list(images) + + raise ValueError(f"Could not make a flat list of images from {images}") + + +def make_nested_list_of_images( + images: list[ImageInput] | ImageInput, + expected_ndims: int = 3, +) -> list[ImageInput]: + """ + Ensure that the output is a nested list of images. + Args: + images (`Union[list[ImageInput], ImageInput]`): + The input image. + expected_ndims (`int`, *optional*, defaults to 3): + The expected number of dimensions for a single input image. + Returns: + list: A list of list of images or a list of 4d array of images. + """ + # If it's a list of batches, it's already in the right format + if ( + isinstance(images, (list, tuple)) + and all(isinstance(images_i, (list, tuple)) for images_i in images) + and all(is_valid_list_of_images(images_i) or not images_i for images_i in images) + ): + return images + + # If it's a list of images, it's a single batch, so convert it to a list of lists + if isinstance(images, (list, tuple)) and is_valid_list_of_images(images): + if is_pil_image(images[0]) or images[0].ndim == expected_ndims: + return [images] + if images[0].ndim == expected_ndims + 1: + return [list(image) for image in images] + + # If it's a single image, convert it to a list of lists + if is_valid_image(images): + if is_pil_image(images) or images.ndim == expected_ndims: + return [[images]] + if images.ndim == expected_ndims + 1: + return [list(images)] + + raise ValueError("Invalid input type. Must be a single image, a list of images, or a list of batches of images.") + + +def to_numpy_array(img) -> np.ndarray: + if not is_valid_image(img): + raise ValueError(f"Invalid image type: {type(img)}") + + if is_vision_available() and isinstance(img, PIL.Image.Image): + return np.array(img) + return to_numpy(img) + + +def infer_channel_dimension_format( + image: np.ndarray, num_channels: int | tuple[int, ...] | None = None +) -> ChannelDimension: + """ + Infers the channel dimension format of `image`. + + Args: + image (`np.ndarray`): + The image to infer the channel dimension of. + num_channels (`int` or `tuple[int, ...]`, *optional*, defaults to `(1, 3)`): + The number of channels of the image. + + Returns: + The channel dimension of the image. + """ + num_channels = num_channels if num_channels is not None else (1, 3) + num_channels = (num_channels,) if isinstance(num_channels, int) else num_channels + + if image.ndim == 3: + first_dim, last_dim = 0, 2 + elif image.ndim == 4: + first_dim, last_dim = 1, 3 + elif image.ndim == 5: + first_dim, last_dim = 2, 4 + else: + raise ValueError(f"Unsupported number of image dimensions: {image.ndim}") + + if image.shape[first_dim] in num_channels and image.shape[last_dim] in num_channels: + logger.warning( + f"The channel dimension is ambiguous. Got image shape {image.shape}. Assuming channels are the first dimension. Use the [input_data_format](https://huggingface.co/docs/transformers/main/internal/image_processing_utils#transformers.image_transforms.rescale.input_data_format) parameter to assign the channel dimension." + ) + return ChannelDimension.FIRST + elif image.shape[first_dim] in num_channels: + return ChannelDimension.FIRST + elif image.shape[last_dim] in num_channels: + return ChannelDimension.LAST + raise ValueError("Unable to infer channel dimension format") + + +def get_channel_dimension_axis(image: np.ndarray, input_data_format: ChannelDimension | str | None = None) -> int: + """ + Returns the channel dimension axis of the image. + + Args: + image (`np.ndarray`): + The image to get the channel dimension axis of. + input_data_format (`ChannelDimension` or `str`, *optional*): + The channel dimension format of the image. If `None`, will infer the channel dimension from the image. + + Returns: + The channel dimension axis of the image. + """ + if input_data_format is None: + input_data_format = infer_channel_dimension_format(image) + if input_data_format == ChannelDimension.FIRST: + return image.ndim - 3 + elif input_data_format == ChannelDimension.LAST: + return image.ndim - 1 + raise ValueError(f"Unsupported data format: {input_data_format}") + + +def get_image_size(image: np.ndarray, channel_dim: ChannelDimension | None = None) -> tuple[int, int]: + """ + Returns the (height, width) dimensions of the image. + + Args: + image (`np.ndarray`): + The image to get the dimensions of. + channel_dim (`ChannelDimension`, *optional*): + Which dimension the channel dimension is in. If `None`, will infer the channel dimension from the image. + + Returns: + A tuple of the image's height and width. + """ + if channel_dim is None: + channel_dim = infer_channel_dimension_format(image) + + if channel_dim == ChannelDimension.FIRST: + return image.shape[-2], image.shape[-1] + elif channel_dim == ChannelDimension.LAST: + return image.shape[-3], image.shape[-2] + else: + raise ValueError(f"Unsupported data format: {channel_dim}") + + +def get_image_size_for_max_height_width( + image_size: tuple[int, int], + max_height: int, + max_width: int, +) -> tuple[int, int]: + """ + Computes the output image size given the input image and the maximum allowed height and width. Keep aspect ratio. + Important, even if image_height < max_height and image_width < max_width, the image will be resized + to at least one of the edges be equal to max_height or max_width. + + For example: + - input_size: (100, 200), max_height: 50, max_width: 50 -> output_size: (25, 50) + - input_size: (100, 200), max_height: 200, max_width: 500 -> output_size: (200, 400) + + Args: + image_size (`tuple[int, int]`): + The image to resize. + max_height (`int`): + The maximum allowed height. + max_width (`int`): + The maximum allowed width. + """ + height, width = image_size + height_scale = max_height / height + width_scale = max_width / width + min_scale = min(height_scale, width_scale) + new_height = int(height * min_scale) + new_width = int(width * min_scale) + return new_height, new_width + + +def is_valid_annotation_coco_detection(annotation: dict[str, list | tuple]) -> bool: + if ( + isinstance(annotation, dict) + and "image_id" in annotation + and "annotations" in annotation + and isinstance(annotation["annotations"], (list, tuple)) + and ( + # an image can have no annotations + len(annotation["annotations"]) == 0 or isinstance(annotation["annotations"][0], dict) + ) + ): + return True + return False + + +def is_valid_annotation_coco_panoptic(annotation: dict[str, list | tuple]) -> bool: + if ( + isinstance(annotation, dict) + and "image_id" in annotation + and "segments_info" in annotation + and "file_name" in annotation + and isinstance(annotation["segments_info"], (list, tuple)) + and ( + # an image can have no segments + len(annotation["segments_info"]) == 0 or isinstance(annotation["segments_info"][0], dict) + ) + ): + return True + return False + + +def valid_coco_detection_annotations(annotations: Iterable[dict[str, list | tuple]]) -> bool: + return all(is_valid_annotation_coco_detection(ann) for ann in annotations) + + +def valid_coco_panoptic_annotations(annotations: Iterable[dict[str, list | tuple]]) -> bool: + return all(is_valid_annotation_coco_panoptic(ann) for ann in annotations) + + +def load_image(image: Union[str, "PIL.Image.Image"], timeout: float | None = None) -> "PIL.Image.Image": + """ + Loads `image` to a PIL Image. + + Args: + image (`str` or `PIL.Image.Image`): + The image to convert to the PIL Image format. + timeout (`float`, *optional*): + The timeout value in seconds for the URL request. + + Returns: + `PIL.Image.Image`: A PIL Image. + """ + requires_backends(load_image, ["vision"]) + if isinstance(image, str): + if image.startswith("http://") or image.startswith("https://"): + # We need to actually check for a real protocol, otherwise it's impossible to use a local file + # like http_huggingface_co.png + image = PIL.Image.open(BytesIO(httpx.get(image, timeout=timeout, follow_redirects=True).content)) + elif os.path.isfile(image): + image = PIL.Image.open(image) + else: + if image.startswith("data:image/"): + image = image.split(",")[1] + + # Try to load as base64 + try: + b64 = base64.decodebytes(image.encode()) + image = PIL.Image.open(BytesIO(b64)) + except Exception as e: + raise ValueError( + f"Incorrect image source. Must be a valid URL starting with `http://` or `https://`, a valid path to an image file, or a base64 encoded string. Got {image}. Failed with {e}" + ) + elif not isinstance(image, PIL.Image.Image): + raise TypeError( + "Incorrect format used for image. Should be an url linking to an image, a base64 string, a local path, or a PIL image." + ) + image = PIL.ImageOps.exif_transpose(image) + image = image.convert("RGB") + return image + + +def load_images( + images: Union[list, tuple, str, "PIL.Image.Image"], timeout: float | None = None +) -> Union["PIL.Image.Image", list["PIL.Image.Image"], list[list["PIL.Image.Image"]]]: + """Loads images, handling different levels of nesting. + + Args: + images: A single image, a list of images, or a list of lists of images to load. + timeout: Timeout for loading images. + + Returns: + A single image, a list of images, a list of lists of images. + """ + if isinstance(images, (list, tuple)): + if len(images) and isinstance(images[0], (list, tuple)): + return [[load_image(image, timeout=timeout) for image in image_group] for image_group in images] + else: + return [load_image(image, timeout=timeout) for image in images] + else: + return load_image(images, timeout=timeout) + + +def validate_preprocess_arguments( + do_rescale: bool | None = None, + rescale_factor: float | None = None, + do_normalize: bool | None = None, + image_mean: float | list[float] | None = None, + image_std: float | list[float] | None = None, + do_pad: bool | None = None, + pad_size: dict[str, int] | int | None = None, + do_center_crop: bool | None = None, + crop_size: dict[str, int] | None = None, + do_resize: bool | None = None, + size: dict[str, int] | None = None, + resample: Optional["PILImageResampling"] = None, + interpolation: Optional["InterpolationMode"] = None, +): + """ + Checks validity of typically used arguments in an `ImageProcessor` `preprocess` method. + Raises `ValueError` if arguments incompatibility is caught. + Many incompatibilities are model-specific. `do_pad` sometimes needs `size_divisor`, + sometimes `size_divisibility`, and sometimes `size`. New models and processors added should follow + existing arguments when possible. + + """ + if do_rescale and rescale_factor is None: + raise ValueError("`rescale_factor` must be specified if `do_rescale` is `True`.") + + if do_pad and pad_size is None: + # Processors pad images using different args depending on the model, so the below check is pointless + # but we keep it for BC for now. TODO: remove in v5 + # Usually padding can be called with: + # - "pad_size/size" if we're padding to specific values + # - "size_divisor" if we're padding to any value divisible by X + # - "None" if we're padding to the maximum size image in batch + raise ValueError( + "Depending on the model, `size_divisor` or `pad_size` or `size` must be specified if `do_pad` is `True`." + ) + + if do_normalize and (image_mean is None or image_std is None): + raise ValueError("`image_mean` and `image_std` must both be specified if `do_normalize` is `True`.") + + if do_center_crop and crop_size is None: + raise ValueError("`crop_size` must be specified if `do_center_crop` is `True`.") + + if interpolation is not None and resample is not None: + raise ValueError( + "Only one of `interpolation` and `resample` should be specified, depending on image processor type." + ) + + if do_resize and not (size is not None and (resample is not None or interpolation is not None)): + raise ValueError("`size` and `resample/interpolation` must be specified if `do_resize` is `True`.") + + +class ImageFeatureExtractionMixin: + """ + Mixin that contain utilities for preparing image features. + """ + + def _ensure_format_supported(self, image): + if not isinstance(image, (PIL.Image.Image, np.ndarray)) and not is_torch_tensor(image): + raise ValueError( + f"Got type {type(image)} which is not supported, only `PIL.Image.Image`, `np.ndarray` and " + "`torch.Tensor` are." + ) + + def to_pil_image(self, image, rescale=None): + """ + Converts `image` to a PIL Image. Optionally rescales it and puts the channel dimension back as the last axis if + needed. + + Args: + image (`PIL.Image.Image` or `numpy.ndarray` or `torch.Tensor`): + The image to convert to the PIL Image format. + rescale (`bool`, *optional*): + Whether or not to apply the scaling factor (to make pixel values integers between 0 and 255). Will + default to `True` if the image type is a floating type, `False` otherwise. + """ + self._ensure_format_supported(image) + + if is_torch_tensor(image): + image = image.numpy() + + if isinstance(image, np.ndarray): + if rescale is None: + # rescale default to the array being of floating type. + rescale = isinstance(image.flat[0], np.floating) + # If the channel as been moved to first dim, we put it back at the end. + if image.ndim == 3 and image.shape[0] in [1, 3]: + image = image.transpose(1, 2, 0) + if rescale: + image = image * 255 + image = image.astype(np.uint8) + return PIL.Image.fromarray(image) + return image + + def convert_rgb(self, image): + """ + Converts `PIL.Image.Image` to RGB format. + + Args: + image (`PIL.Image.Image`): + The image to convert. + """ + self._ensure_format_supported(image) + if not isinstance(image, PIL.Image.Image): + return image + + return image.convert("RGB") + + def rescale(self, image: np.ndarray, scale: float | int) -> np.ndarray: + """ + Rescale a numpy image by scale amount + """ + self._ensure_format_supported(image) + return image * scale + + def to_numpy_array(self, image, rescale=None, channel_first=True): + """ + Converts `image` to a numpy array. Optionally rescales it and puts the channel dimension as the first + dimension. + + Args: + image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`): + The image to convert to a NumPy array. + rescale (`bool`, *optional*): + Whether or not to apply the scaling factor (to make pixel values floats between 0. and 1.). Will + default to `True` if the image is a PIL Image or an array/tensor of integers, `False` otherwise. + channel_first (`bool`, *optional*, defaults to `True`): + Whether or not to permute the dimensions of the image to put the channel dimension first. + """ + self._ensure_format_supported(image) + + if isinstance(image, PIL.Image.Image): + image = np.array(image) + + if is_torch_tensor(image): + image = image.numpy() + + rescale = isinstance(image.flat[0], np.integer) if rescale is None else rescale + + if rescale: + image = self.rescale(image.astype(np.float32), 1 / 255.0) + + if channel_first and image.ndim == 3: + image = image.transpose(2, 0, 1) + + return image + + def expand_dims(self, image): + """ + Expands 2-dimensional `image` to 3 dimensions. + + Args: + image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`): + The image to expand. + """ + self._ensure_format_supported(image) + + # Do nothing if PIL image + if isinstance(image, PIL.Image.Image): + return image + + if is_torch_tensor(image): + image = image.unsqueeze(0) + else: + image = np.expand_dims(image, axis=0) + return image + + def normalize(self, image, mean, std, rescale=False): + """ + Normalizes `image` with `mean` and `std`. Note that this will trigger a conversion of `image` to a NumPy array + if it's a PIL Image. + + Args: + image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`): + The image to normalize. + mean (`list[float]` or `np.ndarray` or `torch.Tensor`): + The mean (per channel) to use for normalization. + std (`list[float]` or `np.ndarray` or `torch.Tensor`): + The standard deviation (per channel) to use for normalization. + rescale (`bool`, *optional*, defaults to `False`): + Whether or not to rescale the image to be between 0 and 1. If a PIL image is provided, scaling will + happen automatically. + """ + self._ensure_format_supported(image) + + if isinstance(image, PIL.Image.Image): + image = self.to_numpy_array(image, rescale=True) + # If the input image is a PIL image, it automatically gets rescaled. If it's another + # type it may need rescaling. + elif rescale: + if isinstance(image, np.ndarray): + image = self.rescale(image.astype(np.float32), 1 / 255.0) + elif is_torch_tensor(image): + image = self.rescale(image.float(), 1 / 255.0) + + if isinstance(image, np.ndarray): + if not isinstance(mean, np.ndarray): + mean = np.array(mean).astype(image.dtype) + if not isinstance(std, np.ndarray): + std = np.array(std).astype(image.dtype) + elif is_torch_tensor(image): + import torch + + if not isinstance(mean, torch.Tensor): + if isinstance(mean, np.ndarray): + mean = torch.from_numpy(mean) + else: + mean = torch.tensor(mean) + if not isinstance(std, torch.Tensor): + if isinstance(std, np.ndarray): + std = torch.from_numpy(std) + else: + std = torch.tensor(std) + + if image.ndim == 3 and image.shape[0] in [1, 3]: + return (image - mean[:, None, None]) / std[:, None, None] + else: + return (image - mean) / std + + def resize(self, image, size, resample=None, default_to_square=True, max_size=None): + """ + Resizes `image`. Enforces conversion of input to PIL.Image. + + Args: + image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`): + The image to resize. + size (`int` or `tuple[int, int]`): + The size to use for resizing the image. If `size` is a sequence like (h, w), output size will be + matched to this. + + If `size` is an int and `default_to_square` is `True`, then image will be resized to (size, size). If + `size` is an int and `default_to_square` is `False`, then smaller edge of the image will be matched to + this number. i.e, if height > width, then image will be rescaled to (size * height / width, size). + resample (`int`, *optional*, defaults to `PILImageResampling.BILINEAR`): + The filter to user for resampling. + default_to_square (`bool`, *optional*, defaults to `True`): + How to convert `size` when it is a single int. If set to `True`, the `size` will be converted to a + square (`size`,`size`). If set to `False`, will replicate + [`torchvision.transforms.Resize`](https://pytorch.org/vision/stable/transforms.html#torchvision.transforms.Resize) + with support for resizing only the smallest edge and providing an optional `max_size`. + max_size (`int`, *optional*, defaults to `None`): + The maximum allowed for the longer edge of the resized image: if the longer edge of the image is + greater than `max_size` after being resized according to `size`, then the image is resized again so + that the longer edge is equal to `max_size`. As a result, `size` might be overruled, i.e the smaller + edge may be shorter than `size`. Only used if `default_to_square` is `False`. + + Returns: + image: A resized `PIL.Image.Image`. + """ + resample = resample if resample is not None else PILImageResampling.BILINEAR + + self._ensure_format_supported(image) + + if not isinstance(image, PIL.Image.Image): + image = self.to_pil_image(image) + + if isinstance(size, list): + size = tuple(size) + + if isinstance(size, int) or len(size) == 1: + if default_to_square: + size = (size, size) if isinstance(size, int) else (size[0], size[0]) + else: + width, height = image.size + # specified size only for the smallest edge + short, long = (width, height) if width <= height else (height, width) + requested_new_short = size if isinstance(size, int) else size[0] + + if short == requested_new_short: + return image + + new_short, new_long = requested_new_short, int(requested_new_short * long / short) + + if max_size is not None: + if max_size <= requested_new_short: + raise ValueError( + f"max_size = {max_size} must be strictly greater than the requested " + f"size for the smaller edge size = {size}" + ) + if new_long > max_size: + new_short, new_long = int(max_size * new_short / new_long), max_size + + size = (new_short, new_long) if width <= height else (new_long, new_short) + + return image.resize(size, resample=resample) + + def center_crop(self, image, size): + """ + Crops `image` to the given size using a center crop. Note that if the image is too small to be cropped to the + size given, it will be padded (so the returned result has the size asked). + + Args: + image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor` of shape (n_channels, height, width) or (height, width, n_channels)): + The image to resize. + size (`int` or `tuple[int, int]`): + The size to which crop the image. + + Returns: + new_image: A center cropped `PIL.Image.Image` or `np.ndarray` or `torch.Tensor` of shape: (n_channels, + height, width). + """ + self._ensure_format_supported(image) + + if not isinstance(size, tuple): + size = (size, size) + + # PIL Image.size is (width, height) but NumPy array and torch Tensors have (height, width) + if is_torch_tensor(image) or isinstance(image, np.ndarray): + if image.ndim == 2: + image = self.expand_dims(image) + image_shape = image.shape[1:] if image.shape[0] in [1, 3] else image.shape[:2] + else: + image_shape = (image.size[1], image.size[0]) + + top = (image_shape[0] - size[0]) // 2 + bottom = top + size[0] # In case size is odd, (image_shape[0] + size[0]) // 2 won't give the proper result. + left = (image_shape[1] - size[1]) // 2 + right = left + size[1] # In case size is odd, (image_shape[1] + size[1]) // 2 won't give the proper result. + + # For PIL Images we have a method to crop directly. + if isinstance(image, PIL.Image.Image): + return image.crop((left, top, right, bottom)) + + # Check if image is in (n_channels, height, width) or (height, width, n_channels) format + channel_first = image.shape[0] in [1, 3] + + # Transpose (height, width, n_channels) format images + if not channel_first: + if isinstance(image, np.ndarray): + image = image.transpose(2, 0, 1) + if is_torch_tensor(image): + image = image.permute(2, 0, 1) + + # Check if cropped area is within image boundaries + if top >= 0 and bottom <= image_shape[0] and left >= 0 and right <= image_shape[1]: + return image[..., top:bottom, left:right] + + # Otherwise, we may need to pad if the image is too small. Oh joy... + new_shape = image.shape[:-2] + (max(size[0], image_shape[0]), max(size[1], image_shape[1])) + if isinstance(image, np.ndarray): + new_image = np.zeros_like(image, shape=new_shape) + elif is_torch_tensor(image): + new_image = image.new_zeros(new_shape) + + top_pad = (new_shape[-2] - image_shape[0]) // 2 + bottom_pad = top_pad + image_shape[0] + left_pad = (new_shape[-1] - image_shape[1]) // 2 + right_pad = left_pad + image_shape[1] + new_image[..., top_pad:bottom_pad, left_pad:right_pad] = image + + top += top_pad + bottom += top_pad + left += left_pad + right += left_pad + + new_image = new_image[ + ..., max(0, top) : min(new_image.shape[-2], bottom), max(0, left) : min(new_image.shape[-1], right) + ] + + return new_image + + def flip_channel_order(self, image): + """ + Flips the channel order of `image` from RGB to BGR, or vice versa. Note that this will trigger a conversion of + `image` to a NumPy array if it's a PIL Image. + + Args: + image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`): + The image whose color channels to flip. If `np.ndarray` or `torch.Tensor`, the channel dimension should + be first. + """ + self._ensure_format_supported(image) + + if isinstance(image, PIL.Image.Image): + image = self.to_numpy_array(image) + + return image[::-1, :, :] + + def rotate(self, image, angle, resample=None, expand=0, center=None, translate=None, fillcolor=None): + """ + Returns a rotated copy of `image`. This method returns a copy of `image`, rotated the given number of degrees + counter clockwise around its centre. + + Args: + image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`): + The image to rotate. If `np.ndarray` or `torch.Tensor`, will be converted to `PIL.Image.Image` before + rotating. + + Returns: + image: A rotated `PIL.Image.Image`. + """ + resample = resample if resample is not None else PIL.Image.NEAREST + + self._ensure_format_supported(image) + + if not isinstance(image, PIL.Image.Image): + image = self.to_pil_image(image) + + return image.rotate( + angle, resample=resample, expand=expand, center=center, translate=translate, fillcolor=fillcolor + ) + + +def validate_annotations( + annotation_format: AnnotationFormat, + supported_annotation_formats: tuple[AnnotationFormat, ...], + annotations: list[dict], +) -> None: + if annotation_format not in supported_annotation_formats: + raise ValueError(f"Unsupported annotation format: {format} must be one of {supported_annotation_formats}") + + if annotation_format is AnnotationFormat.COCO_DETECTION: + if not valid_coco_detection_annotations(annotations): + raise ValueError( + "Invalid COCO detection annotations. Annotations must a dict (single image) or list of dicts " + "(batch of images) with the following keys: `image_id` and `annotations`, with the latter " + "being a list of annotations in the COCO format." + ) + + if annotation_format is AnnotationFormat.COCO_PANOPTIC: + if not valid_coco_panoptic_annotations(annotations): + raise ValueError( + "Invalid COCO panoptic annotations. Annotations must a dict (single image) or list of dicts " + "(batch of images) with the following keys: `image_id`, `file_name` and `segments_info`, with " + "the latter being a list of annotations in the COCO format." + ) + + +def validate_kwargs(valid_processor_keys: list[str], captured_kwargs: list[str]): + unused_keys = set(captured_kwargs).difference(set(valid_processor_keys)) + if unused_keys: + unused_key_str = ", ".join(unused_keys) + # TODO raise a warning here instead of simply logging? + logger.warning(f"Unused or unrecognized kwargs: {unused_key_str}.") + + +@dataclass(frozen=True) +class SizeDict: + """ + Hashable dictionary to store image size information. + """ + + height: int | None = None + width: int | None = None + longest_edge: int | None = None + shortest_edge: int | None = None + max_height: int | None = None + max_width: int | None = None + + def __getitem__(self, key): + if hasattr(self, key): + return getattr(self, key) + raise KeyError(f"Key {key} not found in SizeDict.") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/initialization.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/initialization.py new file mode 100644 index 0000000000000000000000000000000000000000..779ac3a87e5c40e95648dfe06c142b06e68bacd7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/initialization.py @@ -0,0 +1,302 @@ +# Copyright 2025 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import math +import sys +from collections import defaultdict +from contextlib import contextmanager + +import torch + + +# Record all the torch primitives in advance, so that we can use them without them being modified when we patch torch +# in context managers +TORCH_INIT_FUNCTIONS = { + "uniform_": torch.nn.init.uniform_, + "normal_": torch.nn.init.normal_, + "constant_": torch.nn.init.constant_, + "ones_": torch.nn.init.ones_, + "zeros_": torch.nn.init.zeros_, + "eye_": torch.nn.init.eye_, + "dirac_": torch.nn.init.dirac_, + "xavier_uniform_": torch.nn.init.xavier_uniform_, + "xavier_normal_": torch.nn.init.xavier_normal_, + "kaiming_uniform_": torch.nn.init.kaiming_uniform_, + "kaiming_normal_": torch.nn.init.kaiming_normal_, + "trunc_normal_": torch.nn.init.trunc_normal_, + "orthogonal_": torch.nn.init.orthogonal_, + "sparse_": torch.nn.init.sparse_, +} + + +def uniform_( + tensor: torch.Tensor, a: float = 0.0, b: float = 1.0, generator: torch.Generator | None = None +) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["uniform_"](tensor, a=a, b=b, generator=generator) + return tensor + + +def normal_( + tensor: torch.Tensor, mean: float = 0.0, std: float = 1.0, generator: torch.Generator | None = None +) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["normal_"](tensor, mean=mean, std=std, generator=generator) + return tensor + + +def constant_(tensor: torch.Tensor, val: float) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["constant_"](tensor, val=val) + return tensor + + +def ones_(tensor: torch.Tensor) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["ones_"](tensor) + return tensor + + +def zeros_(tensor: torch.Tensor) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["zeros_"](tensor) + return tensor + + +def eye_(tensor: torch.Tensor) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["eye_"](tensor) + return tensor + + +def dirac_(tensor: torch.Tensor, groups: int = 1) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["dirac_"](tensor, groups=groups) + return tensor + + +def xavier_uniform_(tensor: torch.Tensor, gain: float = 1.0, generator: torch.Generator | None = None) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["xavier_uniform_"](tensor, gain=gain, generator=generator) + return tensor + + +def xavier_normal_(tensor: torch.Tensor, gain: float = 1.0, generator: torch.Generator | None = None) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["xavier_normal_"](tensor, gain=gain, generator=generator) + return tensor + + +def kaiming_uniform_( + tensor: torch.Tensor, + a: float = 0, + mode: str = "fan_in", + nonlinearity: str = "leaky_relu", + generator: torch.Generator | None = None, +) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["kaiming_uniform_"]( + tensor, a=a, mode=mode, nonlinearity=nonlinearity, generator=generator + ) + return tensor + + +def kaiming_normal_( + tensor: torch.Tensor, + a: float = 0, + mode: str = "fan_in", + nonlinearity: str = "leaky_relu", + generator: torch.Generator | None = None, +) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["kaiming_normal_"]( + tensor, a=a, mode=mode, nonlinearity=nonlinearity, generator=generator + ) + return tensor + + +def trunc_normal_( + tensor: torch.Tensor, + mean: float = 0.0, + std: float = 1.0, + a: float = -2.0, + b: float = 2.0, + generator: torch.Generator | None = None, +) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["trunc_normal_"](tensor, mean=mean, std=std, a=a, b=b, generator=generator) + return tensor + + +def orthogonal_( + tensor: torch.Tensor, + gain: float = 1, + generator: torch.Generator | None = None, +) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["orthogonal_"](tensor, gain=gain, generator=generator) + return tensor + + +def sparse_( + tensor: torch.Tensor, sparsity: float, std: float = 0.01, generator: torch.Generator | None = None +) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + return TORCH_INIT_FUNCTIONS["sparse_"](tensor, sparsity=sparsity, std=std, generator=generator) + return tensor + + +def copy_(tensor: torch.Tensor, other: torch.Tensor) -> torch.Tensor: + if not getattr(tensor, "_is_hf_initialized", False): + with torch.no_grad(): + return tensor.copy_(other) + return tensor + + +def _variance_scaling(tensor, mode="fan_in", distribution="normal"): + fan_in, fan_out = torch.nn.init._calculate_fan_in_and_fan_out(tensor) + if mode == "fan_in": + denom = fan_in + elif mode == "fan_out": + denom = fan_out + elif mode == "fan_avg": + denom = (fan_in + fan_out) / 2 + + variance = 1.0 / denom + + if distribution == "truncated_normal": + trunc_normal_(tensor, std=math.sqrt(variance) / 0.87962566103423978) + elif distribution == "normal": + normal_(tensor, std=math.sqrt(variance)) + elif distribution == "uniform": + bound = math.sqrt(3 * variance) + uniform_(tensor, -bound, bound) + else: + raise ValueError(f"invalid distribution {distribution}") + + +def lecun_normal_(tensor): + if not getattr(tensor, "_is_hf_initialized", False): + _variance_scaling(tensor, mode="fan_in", distribution="truncated_normal") + return tensor + + +def default_flax_embed_init_(tensor): + if not getattr(tensor, "_is_hf_initialized", False): + _variance_scaling(tensor, mode="fan_in", distribution="normal") + return tensor + + +# Here, we need to check several modules imported, and hot patch all of them, as sometimes torch does +# something like `from torch.nn.init import xavier_uniform_` in their internals (e.g in torch.nn.modules.activations, +# where MultiHeadAttention lives), so the function name is binded at import time and just doing +# `setattr(torch.nn.init, name, globals()[name])` is thus not enough +# The following list should be enough for all torch versions we work with +TORCH_MODULES_TO_PATCH = ( + "torch.nn.init", + "torch.nn.modules.activation", + "torch.nn.modules.transformer", + "torch.nn.modules.linear", + "torch.nn.modules.loss", + "torch.nn.modules.batchnorm", + "torch.nn.modules.conv", + "torch.nn.modules.normalization", + "torch.nn.modules.rnn", + "torch.nn.modules.sparse", +) + + +@contextmanager +def guard_torch_init_functions(): + """ + Guard the `torch.nn.init` primitive functions to behave exactly like the functions in this file, i.e. be + protected against the `_is_hf_initialized` flag to avoid re-init if the param was already loaded. + + Usually, all models are using the init from `transformers` which are already guarded, but just to make extra sure + and for remote code, we also use this context manager. + """ + originals = defaultdict(dict) + try: + # Replace all torch funcs by the ones in this file + for module_name in TORCH_MODULES_TO_PATCH: + if module_name in sys.modules: + module = sys.modules[module_name] + for func_name in TORCH_INIT_FUNCTIONS.keys(): + if hasattr(module, func_name): + originals[module][func_name] = getattr(module, func_name) + setattr(module, func_name, globals()[func_name]) + yield + finally: + # Set back the original functions on all modules + for module, functions in originals.items(): + for func_name, func in functions.items(): + setattr(module, func_name, func) + + +@contextmanager +def no_init_weights(): + """ + Disable weight initialization both at the torch-level, and at the transformers-level (`init_weights`). + This is used to speed-up initializing an empty model with deepspeed, as we do not initialize the model on meta device + with deepspeed, but we still don't need to run expensive weight initializations as we are loading params afterwards. + """ + from .modeling_utils import PreTrainedModel + + def empty_func(*args, **kwargs): + pass + + originals = defaultdict(dict) + try: + # Replace all torch funcs by empty ones + for module_name in TORCH_MODULES_TO_PATCH: + if module_name in sys.modules: + module = sys.modules[module_name] + for func_name in TORCH_INIT_FUNCTIONS.keys(): + if hasattr(module, func_name): + originals[module][func_name] = getattr(module, func_name) + setattr(module, func_name, empty_func) + + # Also patch our own `init_weights` + original_init_weights = PreTrainedModel.init_weights + PreTrainedModel.init_weights = empty_func + + yield + finally: + # Set back the original torch functions on all modules + for module, functions in originals.items(): + for func_name, func in functions.items(): + setattr(module, func_name, func) + # Set back `init_weights` + PreTrainedModel.init_weights = original_init_weights + + +@contextmanager +def no_tie_weights(): + """ + Disable weight tying during loading with `from_pretrained`. This is needed as we want to have access to ALL + weights in the state_dict during `from_pretrained`, and otherwise tying them would remove them from it, as it's + called in `post_init` when instantiating. + """ + from .modeling_utils import PreTrainedModel + + def empty_func(*args, **kwargs): + pass + + try: + original_tie_weights = PreTrainedModel.tie_weights + PreTrainedModel.tie_weights = empty_func + + yield + finally: + # Set back the original + PreTrainedModel.tie_weights = original_tie_weights diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/masking_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/masking_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..ee594262e51f92f05c05ccc81bb6ec7a14f3e5e3 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/masking_utils.py @@ -0,0 +1,1551 @@ +# Copyright 2025 HuggingFace Inc. team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import itertools +from collections.abc import Callable + +import torch +import torch.nn.functional as F + +from .cache_utils import Cache +from .configuration_utils import PreTrainedConfig +from .utils import is_torch_xpu_available, logging +from .utils.deprecation import deprecate_kwarg +from .utils.generic import GeneralInterface, is_flash_attention_requested +from .utils.import_utils import is_torch_flex_attn_available, is_torch_greater_or_equal, is_tracing + + +if is_torch_flex_attn_available(): + from torch.nn.attention.flex_attention import _DEFAULT_SPARSE_BLOCK_SIZE as flex_default_block_size + from torch.nn.attention.flex_attention import BlockMask, create_block_mask +else: + # Register a fake type to avoid crashing for annotations and `isinstance` checks + BlockMask = torch.Tensor + +_is_torch_greater_or_equal_than_2_5 = is_torch_greater_or_equal("2.5", accept_dev=True) +_is_torch_greater_or_equal_than_2_6 = is_torch_greater_or_equal("2.6", accept_dev=True) +_is_torch_xpu_available = is_torch_xpu_available() + +if _is_torch_greater_or_equal_than_2_6: + from torch._dynamo._trace_wrapped_higher_order_op import TransformGetItemToIndex + + +logger = logging.get_logger(__name__) + + +def and_masks(*mask_functions: Callable) -> Callable: + """Returns a mask function that is the intersection of provided mask functions""" + if not all(callable(arg) for arg in mask_functions): + raise RuntimeError(f"All inputs should be callable mask_functions: {mask_functions}") + + def and_mask(batch_idx, head_idx, q_idx, kv_idx): + result = q_idx.new_ones((), dtype=torch.bool) + for mask in mask_functions: + result = result & mask(batch_idx, head_idx, q_idx, kv_idx).to(result.device) + return result + + return and_mask + + +def or_masks(*mask_functions: Callable) -> Callable: + """Returns a mask function that is the union of provided mask functions""" + if not all(callable(arg) for arg in mask_functions): + raise RuntimeError(f"All inputs should be callable mask_functions: {mask_functions}") + + def or_mask(batch_idx, head_idx, q_idx, kv_idx): + result = q_idx.new_zeros((), dtype=torch.bool) + for mask in mask_functions: + result = result | mask(batch_idx, head_idx, q_idx, kv_idx).to(result.device) + return result + + return or_mask + + +def causal_mask_function(batch_idx: int, head_idx: int, q_idx: int, kv_idx: int) -> bool: + """ + This creates a basic lower-diagonal causal mask. + """ + return kv_idx <= q_idx + + +def bidirectional_mask_function(batch_idx: int, head_idx: int, q_idx: int, kv_idx: int) -> bool: + """ + This creates a full bidirectional mask. + + NOTE: It is important to keep an index-based version for non-vmap expansion. + """ + return q_idx >= 0 + + +def sliding_window_overlay(sliding_window: int) -> Callable: + """ + This is an overlay depicting a sliding window pattern. Add it on top of a causal mask for a proper sliding + window mask. + """ + + def inner_mask(batch_idx: int, head_idx: int, q_idx: int, kv_idx: int) -> bool: + return kv_idx > q_idx - sliding_window + + return inner_mask + + +def chunked_overlay(chunk_size: int, left_padding: torch.Tensor) -> Callable: + """ + This is an overlay depicting a chunked attention pattern. Add it on top of a causal mask for a proper chunked + attention mask. + """ + + def inner_mask(batch_idx: int, head_idx: int, q_idx: int, kv_idx: int) -> bool: + return (kv_idx - left_padding[batch_idx]) // chunk_size == (q_idx - left_padding[batch_idx]) // chunk_size + + return inner_mask + + +def sliding_window_causal_mask_function(sliding_window: int) -> Callable: + """ + This return the mask_function function to create a sliding window mask. + """ + return and_masks(sliding_window_overlay(sliding_window), causal_mask_function) + + +def sliding_window_bidirectional_overlay(sliding_window: int) -> Callable: + """ + This is an overlay depicting a bidirectional sliding window pattern. + """ + + def inner_mask(batch_idx: int, head_idx: int, q_idx: int, kv_idx: int) -> bool: + """A token can attend to any other token if their absolute distance is within + the (inclusive) sliding window size (distance <= sliding_window).""" + return abs(q_idx - kv_idx) <= sliding_window + + return inner_mask + + +def sliding_window_bidirectional_mask_function(sliding_window: int) -> Callable: + """ + This return the mask_function function to create a bidirectional sliding window mask. + """ + return and_masks(sliding_window_bidirectional_overlay(sliding_window), bidirectional_mask_function) + + +def chunked_causal_mask_function(chunk_size: int, left_padding: torch.Tensor) -> Callable: + """ + This return the mask_function function to create a chunked attention mask. + """ + return and_masks(chunked_overlay(chunk_size, left_padding), causal_mask_function) + + +def padding_mask_function(padding_mask: torch.Tensor) -> Callable: + """ + This return the mask_function function corresponding to a 2D padding mask. + """ + + def inner_mask(batch_idx: int, head_idx: int, q_idx: int, kv_idx: int) -> bool: + # Note that here the mask should ALWAYS be at least of the max `kv_index` size in the dimension 1. This is because + # we cannot pad it here in the mask_function as we don't know the final size, and we cannot try/except, as it is not + # vectorizable on accelerator devices + return padding_mask[batch_idx, kv_idx] + + return inner_mask + + +def packed_sequence_mask_function(packed_sequence_mask: torch.Tensor) -> Callable: + """ + This return the mask_function function corresponding to a 2D packed sequence mask. + """ + + def inner_mask(batch_idx: int, head_idx: int, q_idx: int, kv_idx: int) -> bool: + return packed_sequence_mask[batch_idx, q_idx] == packed_sequence_mask[batch_idx, kv_idx] + + return inner_mask + + +def add_offsets_to_mask_function(mask_function: Callable, q_offset: int, kv_offset: int) -> Callable: + """ + This function adds the correct offsets to the `q_idx` and `kv_idx` as the torch API can only accept lengths, + not start and end indices. + """ + + def inner_mask(batch_idx: int, head_idx: int, q_idx: int, kv_idx: int) -> bool: + return mask_function(batch_idx, head_idx, q_idx + q_offset, kv_idx + kv_offset) + + return inner_mask + + +def prepare_padding_mask(attention_mask: torch.Tensor | None, kv_length: int, kv_offset: int) -> torch.Tensor | None: + """ + From the 2D attention mask, prepare the correct padding mask to use by potentially padding it. + """ + local_padding_mask = attention_mask + if attention_mask is not None: + # Pad it if necessary + if (padding_length := kv_length + kv_offset - attention_mask.shape[-1]) > 0: + local_padding_mask = torch.nn.functional.pad(attention_mask, (0, padding_length)) + return local_padding_mask + + +def _can_skip_causal_mask_xpu( + padding_mask: torch.Tensor | None, + query_length: int, + kv_length: int, + local_attention_size: int | None, +) -> bool: + """ + XPU-specific logic for determining if we can skip causal mask creation. + + For XPU devices, we have special handling: + - Single query tokens (query_length == 1) use the same logic as CUDA + - Multi-query tokens can skip if padding_mask is provided and correctly structured + The mask must have all True values in the query window and all False after + """ + + if is_tracing(padding_mask): + return False + + # Check local attention constraint (same as CUDA) + if local_attention_size is not None and kv_length >= local_attention_size: + return False + + if padding_mask is None: + # Without padding mask, can skip if single query token or full causal attention + return query_length == 1 or kv_length == query_length + + # XPU allows skipping under additional conditions when padding_mask is provided + if query_length == 1: + # Single query token: skip only if no padding tokens present + return padding_mask.all() + + # XPU-specific: check if query window is all True and rest is all False + # This allows XPU to optimize the 1st token in static cache + return padding_mask[:, :query_length].all() and not padding_mask[:, query_length:].any() + + +def _ignore_causal_mask_sdpa( + padding_mask: torch.Tensor | None, + query_length: int, + kv_length: int, + kv_offset: int, + local_attention_size: int | None = None, +) -> bool: + """ + Detects whether the causal mask can be ignored in case PyTorch's SDPA is used, rather relying on SDPA's `is_causal` argument. + + In case no token is masked in the 2D `padding_mask` argument, if `query_length == 1` or + `key_value_length == query_length`, we rather rely on SDPA `is_causal` argument to use causal/non-causal masks, + allowing to dispatch to the flash attention kernel (that can otherwise not be used if a custom `attn_mask` is + passed). + """ + if padding_mask is not None and padding_mask.shape[-1] > kv_length: + mask_indices = torch.arange(kv_length, device=padding_mask.device) + mask_indices += kv_offset + padding_mask = padding_mask[:, mask_indices] + + if _is_torch_xpu_available: + # XPU devices have special handling for mask skipping: + # - Single query tokens use the same logic as CUDA + # - Multi-query tokens can skip if padding_mask is provided and correctly structured + # (all True in query window, all False after) + return _can_skip_causal_mask_xpu(padding_mask, query_length, kv_length, local_attention_size) + # When using `torch.export` or `torch.onnx.dynamo_export`, we must pass an example input, and `is_causal` behavior is + # hard-coded to the forward. If a user exports a model with query_length > 1, the exported model will hard-code `is_causal=True` + # which is in general wrong (see https://github.com/pytorch/pytorch/issues/108108). Thus, we only set + # `ignore_causal_mask = True` if we are not tracing + if ( + not is_tracing(padding_mask) + # only cases when lower and upper diags are the same, see https://github.com/pytorch/pytorch/issues/108108 + and (query_length == 1 or kv_length == query_length) + # in this case we need to add special patterns to the mask so cannot be skipped otherwise + and (local_attention_size is None or kv_length < local_attention_size) + # In this case, we need to add padding to the mask, so cannot be skipped otherwise + and (padding_mask is None or padding_mask.all()) + ): + return True + + return False + + +def _can_skip_bidirectional_mask_xpu( + padding_mask: torch.Tensor | None, + kv_length: int, + local_attention_size: int | None, +) -> bool: + """ + XPU-specific logic for determining if we can skip bidirectional mask creation. + + For XPU devices, we have special handling: + - Skip if no padding and no local attention constraint + """ + + if is_tracing(padding_mask): + return False + + # Check local attention constraint (same as CUDA) + if local_attention_size is not None and kv_length >= local_attention_size: + return False + + if padding_mask is None: + # Without padding mask, can always skip for full bidirectional attention + return True + + # Skip only if no padding tokens present + return padding_mask.all() + + +def _ignore_bidirectional_mask_sdpa( + padding_mask: torch.Tensor | None, + kv_length: int, + local_attention_size: int | None = None, +) -> bool: + """ + Detects whether the bidirectional mask can be ignored in case PyTorch's SDPA is used. + + In case no token is masked in the 2D `padding_mask` argument and no local attention constraint applies + (i.e. `local_attention_size` is None or `kv_length < local_attention_size`), we skip mask creation, + allowing to dispatch to the flash attention kernel (that can otherwise not be used if a custom `attn_mask` is + passed). + """ + if _is_torch_xpu_available: + # XPU devices have special handling for mask skipping: + # - Skip if no padding and no local attention constraint + return _can_skip_bidirectional_mask_xpu(padding_mask, kv_length, local_attention_size) + + # When using `torch.export` or `torch.onnx.dynamo_export`, we need to avoid to check the contents of the mask; + # otherwise, we will encounter dynamic control flows + if ( + not is_tracing(padding_mask) + and (padding_mask is None or padding_mask.all()) + # in this case we need to add special patterns to the mask so cannot be skipped otherwise + and (local_attention_size is None or kv_length < local_attention_size) + ): + return True + + return False + + +def _vmap_expansion_sdpa(mask_function: Callable) -> Callable: + """ + Used to vmap our mask_functions over the all 4 dimensions (b_idx, h_idx, q_idx, kv_idx) of the inputs. + Using vmap here allows us to keep the performance of vectorized ops, while having a single set of primitive + functions between attention interfaces (i.e. between flex and sdpa/eager, FA2 being a bit different). + """ + # We vmap the function over all 4 dimensions, broadcasting [b_idx, h_idx, q_idx, kv_idx] + dimensions = [(None, None, None, 0), (None, None, 0, None), (None, 0, None, None), (0, None, None, None)] + for dims in dimensions: + mask_function = torch.vmap(mask_function, in_dims=dims, out_dims=0) + return mask_function + + +def _non_vmap_expansion_sdpa( + batch_indices: torch.Tensor, head_indices: torch.Tensor, q_indices: torch.Tensor, kv_indices: torch.Tensor +): + """ + Used to broadcast our mask_functions over the all 4 dimensions (b_idx, h_idx, q_idx, kv_idx) of the inputs. + Allows the usage of any index-based mask function without relying on vmap. + + NOTE: This is limited to index based functions only and is not guaranteed to work otherwise. + + Reference: + - https://github.com/huggingface/optimum-onnx/blob/c123e8f4fab61b54a8e0e31ce74462bcacca576e/optimum/exporters/onnx/model_patcher.py#L362-L365 + """ + batch_indices = batch_indices[:, None, None, None] + head_indices = head_indices[None, :, None, None] + q_indices = q_indices[None, None, :, None] + kv_indices = kv_indices[None, None, None, :] + return batch_indices, head_indices, q_indices, kv_indices + + +def sdpa_mask( + batch_size: int, + cache_position: torch.Tensor, + kv_length: int, + kv_offset: int = 0, + mask_function: Callable = causal_mask_function, + attention_mask: torch.Tensor | None = None, + local_size: int | None = None, + allow_is_causal_skip: bool = True, + allow_is_bidirectional_skip: bool = False, + allow_torch_fix: bool = True, + use_vmap: bool = False, + **kwargs, +) -> torch.Tensor | None: + """ + Create a 4D boolean mask of shape `(batch_size, 1, query_length, kv_length)` where a value of True indicates that + the element should take part in the attention computation, and False that it should not. + This function can only be used with torch>=2.5, as the context manager is otherwise not available. + + Args: + batch_size (`int`): + The batch size of the input sequence. + cache_position (`torch.Tensor`): + A tensor of shape (query_length,) indicating the current indices of the input sequence elements. + kv_length (`int`): + The size that the key and value states will have during the attention computation. + kv_offset (`int`, optional): + An optional offset to indicate at which first position the key and values states will refer to. + mask_function (`Callable`): + The mask factory function describing the mask pattern. + attention_mask (`torch.Tensor`, optional): + The 2D attention mask corresponding to padded tokens of shape (batch_size, number_of_seen_tokens+q_length) + local_size (`int`, optional): + The size of the local attention, if we do not use full attention. This is used only if `allow_is_causal_skip=True` + to try to skip mask creation if possible. + allow_is_causal_skip (`bool`, optional): + Whether to allow to return `None` for the mask under conditions where we can use the `is_causal` argument in + `torch.sdpa` instead. Default to `True`. + allow_is_bidirectional_skip (`bool`, optional): + Whether to allow to return `None` for the mask under conditions where we do not have to add any bias, + i.e. full attention without any padding. Default to `False`. + allow_torch_fix (`bool`, optional): + Whether to update the mask in case a query is not attending to any tokens, to solve a bug in torch's older + versions. We need an arg to skip it when using eager. By default `True`. + use_vmap (`bool`, optional): + Whether to use `vmap` during the mask construction or not. Allows powerful custom patterns that may not be + index-based (for the cost of speed performance). By default `False`. + + + ## Creating a simple causal mask: + + To create the following causal mask: + + 0 ■ ⬚ ⬚ ⬚ ⬚ + 1 ■ ■ ⬚ ⬚ ⬚ + 2 ■ ■ ■ ⬚ ⬚ + 3 ■ ■ ■ ■ ⬚ + 4 ■ ■ ■ ■ ■ + + You can do + + ```python + >>> sdpa_mask(batch_size=1, cache_position=torch.arange(5), kv_length=5) + >>> tensor([[[[ True, False, False, False, False], + [ True, True, False, False, False], + [ True, True, True, False, False], + [ True, True, True, True, False], + [ True, True, True, True, True]]]]) + ``` + + ## Creating a sliding window mask: + + To create the following sliding window mask (`sliding_window=3`): + + 0 ■ ⬚ ⬚ ⬚ ⬚ + 1 ■ ■ ⬚ ⬚ ⬚ + 2 ■ ■ ■ ⬚ ⬚ + 3 ⬚ ■ ■ ■ ⬚ + 4 ⬚ ⬚ ■ ■ ■ + + You can do + + ```python + >>> sdpa_mask(batch_size=1, cache_position=torch.arange(5), kv_length=5, mask_function=sliding_window_causal_mask_function(3)) + >>> tensor([[[[ True, False, False, False, False], + [ True, True, False, False, False], + [ True, True, True, False, False], + [False, True, True, True, False], + [False, False, True, True, True]]]]) + ``` + + ## Creating a chunked attention mask + + To create the following chunked attention mask (`chunk_size=3`): + + 0 ■ ⬚ ⬚ ⬚ ⬚ + 1 ■ ■ ⬚ ⬚ ⬚ + 2 ■ ■ ■ ⬚ ⬚ + 3 ⬚ ⬚ ⬚ ■ ⬚ + 4 ⬚ ⬚ ⬚ ■ ■ + + You can do + + ```python + >>> sdpa_mask(batch_size=1, cache_position=torch.arange(5), kv_length=5, mask_function=chunked_causal_mask_function(3, torch.zeros(1, dtype=int))) + >>> tensor([[[[ True, False, False, False, False], + [ True, True, False, False, False], + [ True, True, True, False, False], + [False, False, False, True, False], + [False, False, False, True, True]]]]) + ``` + + """ + q_length = cache_position.shape[0] + + # Potentially pad the 2D mask + padding_mask = prepare_padding_mask(attention_mask, kv_length, kv_offset) + + # Under specific conditions, we can avoid materializing the mask + # 1. Causal masks can rely on the `is_causal` argument + # 2. Bidirectional do not need any further processing (no bias) + if allow_is_causal_skip and _ignore_causal_mask_sdpa(padding_mask, q_length, kv_length, kv_offset, local_size): + return None + if allow_is_bidirectional_skip and _ignore_bidirectional_mask_sdpa(padding_mask, kv_length, local_size): + return None + + # Potentially add the padding 2D mask + if padding_mask is not None: + mask_function = and_masks(mask_function, padding_mask_function(padding_mask)) + + batch_arange = torch.arange(batch_size, device=cache_position.device) + head_arange = torch.arange(1, device=cache_position.device) + # Similar to `kv_arange = torch.arange(start=kv_offset, end=kv_offset + kv_length, device=cache_position.device)` + # but without data-dependent slicing (i.e. torch.compile friendly) + kv_arange = torch.arange(kv_length, device=cache_position.device) + kv_offset + + # Actual mask creation + # Option 1: Fast non-vmap mask creation (default) + if not use_vmap: + # Apply mask function element-wise through broadcasting + attention_mask = mask_function(*_non_vmap_expansion_sdpa(batch_arange, head_arange, cache_position, kv_arange)) + # Expand the mask to match batch size and query length if they weren't used in the mask function + attention_mask = attention_mask.expand(batch_size, -1, q_length, kv_length) + + # Option 2: Vmap mask creation (torch>=2.6 and custom patterns) + elif _is_torch_greater_or_equal_than_2_6: + # This creates the 4D mask easily. Note that we need this context manager as vmap cannot handle slicing a tensor from + # scalar tensor (it internally calls `.item()` which vmap does not allow, but this context works around it + # We don't need to add an offset to the mask_function either, as we vmap directly the correct indices for k and kv indices + with TransformGetItemToIndex(): + attention_mask = _vmap_expansion_sdpa(mask_function)(batch_arange, head_arange, cache_position, kv_arange) + + # Option 3: Error out since it indicates that the user did something custom, which they shouldn't have (torch<2.6) + else: + raise ValueError( + "The vmap functionality for mask creation is only supported from torch>=2.6. " + "Please update your torch version or use `use_vmap=False` with index-based masks." + ) + + # Due to a bug in versions of torch<2.5, we need to update the mask in case a query is not attending to any + # tokens (due to padding). See details in https://github.com/pytorch/pytorch/issues/110213 + if not _is_torch_greater_or_equal_than_2_5 and allow_torch_fix: + attention_mask = attention_mask | torch.all(~attention_mask, dim=-1, keepdim=True) + + return attention_mask + + +def eager_mask( + batch_size: int, + cache_position: torch.Tensor, + kv_length: int, + kv_offset: int = 0, + mask_function: Callable = causal_mask_function, + attention_mask: torch.Tensor | None = None, + dtype: torch.dtype = torch.float32, + allow_is_bidirectional_skip: bool = False, + use_vmap: bool = False, + **kwargs, +) -> torch.Tensor: + """ + Create a 4D float mask of shape `(batch_size, 1, query_length, kv_length)` where a value of 0 indicates that + the element should take part in the attention computation, and -inf (minimum value for the given `dtype`) that + it should not. + + Args: + batch_size (`int`): + The batch size of the input sequence. + cache_position (`torch.Tensor`): + A tensor of shape (query_length,) indicating the current indices of the input sequence elements. + kv_length (`int`): + The size that the key and value states will have during the attention computation. + kv_offset (`int`, optional): + An optional offset to indicate at which first position the key and values states will refer to. + mask_function (`Callable`): + The mask factory function describing the mask pattern. + attention_mask (`torch.Tensor`, optional): + The 2D attention mask corresponding to padded tokens of shape (batch_size, number_of_seen_tokens+q_length) + dtype (`torch.dtype`, optional): + The dtype to use for the mask. By default, `torch.float32`. + allow_is_bidirectional_skip (`bool`, optional): + Whether to allow to return `None` for the mask under conditions where we do not have to add any bias, + i.e. full attention without any padding. Default to `False`. + use_vmap (`bool`, optional): + Whether to use `vmap` during the mask construction or not. Allows powerful custom patterns that may not be + index-based (for the cost of speed performance). By default `False`. + """ + # The masks for eager attention are simply boolean mask from sdpa, casted to 0 and -inf + _ = kwargs.pop("allow_is_causal_skip", None) + _ = kwargs.pop("allow_torch_fix", None) + mask = sdpa_mask( + batch_size=batch_size, + cache_position=cache_position, + kv_length=kv_length, + kv_offset=kv_offset, + mask_function=mask_function, + attention_mask=attention_mask, + allow_is_causal_skip=False, + allow_is_bidirectional_skip=allow_is_bidirectional_skip, + allow_torch_fix=False, + use_vmap=use_vmap, + **kwargs, + ) + # only bidirectional masks can be skipped, otherwise we convert bool -> float + if mask is not None: + min_dtype = torch.finfo(dtype).min + # we need 0s where the tokens should be taken into account, and -inf otherwise (mask is already of boolean type) + mask = torch.where(mask, torch.tensor(0.0, device=mask.device, dtype=dtype), min_dtype) + return mask + + +def flash_attention_mask( + batch_size: int, + cache_position: torch.Tensor, + kv_length: int, + kv_offset: int = 0, + mask_function: Callable = causal_mask_function, + attention_mask: torch.Tensor | None = None, + **kwargs, +): + """ + Create the attention mask necessary to use FA2. Since FA2 is un-padded by definition, here we simply return + `None` if the mask is fully causal, or we return the 2D mask which will then be used to extract the seq_lens. + We just slice it in case of sliding window. + + Args: + batch_size (`int`): + The batch size of the input sequence. + cache_position (`torch.Tensor`): + A tensor of shape (query_length,) indicating the current indices of the input sequence elements. + kv_length (`int`): + The size that the key and value states will have during the attention computation. + kv_offset (`int`, optional): + An optional offset to indicate at which first position the key and values states will refer to. + mask_function (`Callable`): + The mask factory function describing the mask pattern. + attention_mask (`torch.Tensor`, optional): + The 2D attention mask corresponding to padded tokens of shape (batch_size, number_of_seen_tokens+q_length) + """ + if attention_mask is not None: + # Here we need to slice from the right if using sliding or chunked (for full attention, this is equivalent to doing nothing) + attention_mask = attention_mask[:, -kv_length:] + # We only return an actual mask if there is at least 1 padding token, otherwise we return `None` and use `is_causal` in FA2 + # (note that the attention_mask is a boolean dtype here) + if attention_mask.all(): + attention_mask = None + + return attention_mask + + +def flex_attention_mask( + batch_size: int, + cache_position: torch.Tensor, + kv_length: int, + kv_offset: int = 0, + mask_function: Callable = causal_mask_function, + attention_mask: torch.Tensor | None = None, + **kwargs, +) -> BlockMask: + """ + Create a 4D block mask which is a compressed representation of the full 4D block causal mask. BlockMask is essential + for performant computation of flex attention. See: https://pytorch.org/blog/flexattention/ + + Args: + batch_size (`int`): + The batch size of the input sequence. + cache_position (`torch.Tensor`): + A tensor of shape (query_length,) indicating the current indices of the input sequence elements. + kv_length (`int`): + The size that the key and value states will have during the attention computation. + kv_offset (`int`, optional): + An optional offset to indicate at which first position the key and values states will refer to. + mask_function (`Callable`): + The mask factory function describing the mask pattern. + attention_mask (`torch.Tensor`, optional): + The 2D attention mask corresponding to padded tokens of shape (batch_size, number_of_seen_tokens+q_length) + """ + q_length, q_offset = cache_position.shape[0], cache_position[0] + + # Potentially add the padding 2D mask + if attention_mask is not None: + # Older torch (2.5.x) cannot handle sequences not in multiples of 128 (default block size) + # Hence we pad to multiples of this as a minimum to ensure this + pad_len = ((attention_mask.shape[1] // flex_default_block_size) + 1) * flex_default_block_size + pad_len = pad_len - attention_mask.shape[1] + if not _is_torch_greater_or_equal_than_2_6 and pad_len > 0: + attention_mask = torch.nn.functional.pad(attention_mask, value=0, pad=(0, pad_len)) + + padding_mask = prepare_padding_mask(attention_mask, kv_length, kv_offset) + mask_function = and_masks(mask_function, padding_mask_function(padding_mask)) + + # Add the offsets on top (because flex interface only allows length, not start and end indices) + mask_function = add_offsets_to_mask_function(mask_function, q_offset, kv_offset) + + # Finally create the block mask + block_mask = create_block_mask( + mask_mod=mask_function, + B=batch_size, + H=None, + Q_LEN=q_length, + KV_LEN=kv_length, + device=cache_position.device, + _compile=_is_torch_greater_or_equal_than_2_6, + ) + return block_mask + + +class AttentionMaskInterface(GeneralInterface): + # Class instance object, so that a call to `register` can be reflected into all other files correctly, even if + # a new instance is created (in order to locally override a given function) + _global_mapping = { + "sdpa": sdpa_mask, + "eager": eager_mask, + "flash_attention_2": flash_attention_mask, + "flash_attention_3": flash_attention_mask, + "flex_attention": flex_attention_mask, + } + + +# Global AttentionMaskInterface shared by all models which do not need to overwrite any of the existing ones +ALL_MASK_ATTENTION_FUNCTIONS: AttentionMaskInterface = AttentionMaskInterface() + + +def find_packed_sequence_indices(position_ids: torch.Tensor) -> torch.Tensor | None: + """ + Find the indices of the sequence to which each new query token in the sequence belongs when using packed + tensor format (i.e. several sequences packed in the same batch dimension). + + Args: + position_ids (`torch.Tensor`) + A 2D tensor of shape (batch_size, query_length) indicating the positions of each token in the sequences. + + Returns: + A 2D tensor where each similar integer indicates that the tokens belong to the same sequence. For example, if we + pack 3 sequences of 2, 3 and 1 tokens respectively along a single batch dim, this will return [[0, 0, 1, 1, 1, 2]]. + + If the there is only one sequence in each batch item (and we don't compile), then we return `None` indicating + no packed sequences. This is the same as [[0, 0, 0, 0, 0, 0]] for the example above. + """ + # What separate different sequences is when 2 consecutive positions_ids are separated by more than 1. So + # taking the diff (by prepending the first value - 1 to keep correct indexing) and applying cumsum to the result + # gives exactly the sequence indices + # Note that we assume that a single sequence cannot span several batch dimensions, i.e. 1 single sequence + # cannot be part of the end of the first batch dim and the start of the 2nd one for example + first_dummy_value = position_ids[:, :1] - 1 # We just need the diff on this first value to be 1 + position_diff = torch.diff(position_ids, prepend=first_dummy_value, dim=-1) + packed_sequence_mask = (position_diff != 1).cumsum(-1) + + # Sadly this is a dynamic control flow, so we cannot enable this check on anything compile related + if not is_tracing(packed_sequence_mask) and (packed_sequence_mask[:, -1] == 0).all(): + return None + + return packed_sequence_mask + + +@deprecate_kwarg("input_embeds", version="5.6.0", new_name="inputs_embeds") +def _preprocess_mask_arguments( + config: PreTrainedConfig, + inputs_embeds: torch.Tensor, + attention_mask: torch.Tensor | BlockMask | None, + cache_position: torch.Tensor, + past_key_values: Cache | None, + position_ids: torch.Tensor | None, + layer_idx: int | None, +) -> tuple[bool, torch.Tensor | BlockMask | None, int, int]: + """ + Perform some common pre-processing of the mask arguments we get from the modeling code. Mostly determine the + key-value length and offsets, and if we should early exit or not. + + Args: + config (`PreTrainedConfig`): + The model config. + inputs_embeds (`torch.Tensor`): + The input embeddings of shape (batch_size, query_length, hidden_dim). This is used only to infer the + batch size, query length and dtype. + attention_mask (`torch.Tensor`, optional): + The 2D attention mask corresponding to padded tokens of shape (batch_size, number_of_seen_tokens+q_length). + It can also be an already prepared 4D mask, in which case it is returned as-is. + cache_position (`torch.Tensor`): + A tensor of shape (query_length,) indicating the current indices of the input sequence elements. + past_key_values (`Cache`, optional): + The past key values, if we use a cache. + position_ids (`torch.Tensor`, optional) + A 2D tensor of shape (batch_size, query_length) indicating the positions of each token in the sequences. + layer_idx (`int`, optional): + If `past_key_values` is not None, this is the layer index of the cache from which to get the key-value + length and offset. Indeed, for hybrid caches, different layers may return different lengths. + + Returns: + early_exit (`bool`): + Whether we should early exit mask creation, and return the mask as-is. + attention_mask (`torch.Tensor` or `BlockMask` or `None`): + The attention mask to either return immediately, or to use in downstream mask creation. + packed_sequence_mask (`torch.Tensor`, optional): + In case we detected packed sequence format, this is a tensor where each similar integer indicates that + the tokens belong to the same sequence. + kv_length (`int`): + The size that the key and value states will have during the attention computation. + kv_offset (`int`): + An offset to indicate at which first position the key and values states will refer to. + """ + # If the mask is already 4D, simply return as-is (it was already prepared, or it is custom) + if isinstance(attention_mask, (torch.Tensor, BlockMask)) and len(attention_mask.shape) == 4: + return True, attention_mask, None, None, None + + # For TGI/vLLM backends, or other custom attention without equivalent mask creation: we don't need a mask! + # Note: it's not ideal to check the `_global_mapping` attribute instead of the object itself, however otherwise + # full graph dynamo tracing (i.e. torch.export or compile with `fullgraph=True`) will fail on Python<3.11 + # with `torch._dynamo.exc.Unsupported: 'inline in skipfiles:Mapping.__contains__ | __contains__, skipped + # according trace_rules.lookup SKIP_DIRS'` -- can be removed when we require Python>=3.11 + if config._attn_implementation not in ALL_MASK_ATTENTION_FUNCTIONS._global_mapping: + return True, None, None, None, None + + # Move the mask to correct device, and potentially switch dtype for efficiency + if attention_mask is not None and attention_mask.ndim == 2: + attention_mask = attention_mask.to(device=cache_position.device, dtype=torch.bool) + + # If using a cache, it can give all information about mask sizes based on seen tokens + if past_key_values is not None: + kv_length, kv_offset = past_key_values.get_mask_sizes(cache_position, layer_idx) + # Otherwise, we infer based on our input + else: + # 1. Rely on input directly + if attention_mask is None: + kv_length, kv_offset = inputs_embeds.shape[1], 0 + # 2. Rely on the mask instead - needed for special cases like prefix tuning in PEFT + # + # This is a very unique and special case where an encoder utilizes a cache and expects its length + # to be accounted for (usually, they should never use a cache). In general, the mask should always + # match with the input sizes nonetheless (i.e. it does not affect others). + # Conclusion: "prefix tuning is evil" + else: + kv_length, kv_offset = attention_mask.shape[-1], 0 + + # We check the position_ids for potential packed sequence format (only if the 2D attention mask is explicitly None, + # and we don't have past_key_values, i.e. generally a training setup) + packed_sequence_mask = None + if position_ids is not None and attention_mask is None and past_key_values is None: + batch_size = inputs_embeds.shape[0] + # The position ids are sometimes just unsqueezed, without being expanded + if batch_size != position_ids.shape[0]: + position_ids = position_ids.expand(batch_size, -1) + packed_sequence_mask = find_packed_sequence_indices(position_ids) + + return False, attention_mask, packed_sequence_mask, kv_length, kv_offset + + +@deprecate_kwarg("input_embeds", version="5.6.0", new_name="inputs_embeds") +def create_causal_mask( + config: PreTrainedConfig, + inputs_embeds: torch.Tensor, + attention_mask: torch.Tensor | None, + cache_position: torch.Tensor, + past_key_values: Cache | None, + position_ids: torch.Tensor | None = None, + or_mask_function: Callable | None = None, + and_mask_function: Callable | None = None, +) -> torch.Tensor | BlockMask | None: + """ + Create a standard causal mask based on the attention implementation used (stored in the config). If `past_key_values` + has an hybrid cache structure, this function will return the mask corresponding to one of the "full_attention" layers (to align + to what is needed in the `modeling_xxx.py` files). + + Args: + config (`PreTrainedConfig`): + The model config. + inputs_embeds (`torch.Tensor`): + The input embeddings of shape (batch_size, query_length, hidden_dim). This is used only to infer the + batch size, query length and dtype. + attention_mask (`torch.Tensor`, optional): + The 2D attention mask corresponding to padded tokens of shape (batch_size, number_of_seen_tokens+q_length). + It can also be an already prepared 4D mask, in which case it is returned as-is. + cache_position (`torch.Tensor`): + A tensor of shape (query_length,) indicating the current indices of the input sequence elements. + past_key_values (`Cache`, optional): + The past key values, if we use a cache. + position_ids (`torch.Tensor`, optional) + A 2D tensor of shape (batch_size, query_length) indicating the positions of each token in the sequences. + or_mask_function (`Callable`, optional): + An optional mask function to combine with the causal mask function (by doing the union of both). This is + useful to easily overlay another mask on top of the causal one, for example for image tokens handling. + and_mask_function (`Callable`, optional): + An optional mask function to combine with the causal mask function (by doing the intersection of both). This is + useful to easily overlay another mask on top of the causal one, for example for image tokens handling. + """ + # Power feature: if `is_causal` is False, then fallback to bi-directional mask for bi-directional attention. + # It allows to use decoder-only models with bi-directional attention as well + if not getattr(config, "is_causal", True): + return create_bidirectional_mask( + config, + inputs_embeds, + attention_mask, + or_mask_function=or_mask_function, + and_mask_function=and_mask_function, + ) + + # If we have an hybrid cache structure, here we want to create the mask for the full layers + if hasattr(past_key_values, "is_sliding") and False in past_key_values.is_sliding: + layer_idx = past_key_values.is_sliding.index(False) + else: + layer_idx = 0 + + early_exit, attention_mask, packed_sequence_mask, kv_length, kv_offset = _preprocess_mask_arguments( + config, inputs_embeds, attention_mask, cache_position, past_key_values, position_ids, layer_idx + ) + if early_exit: + return attention_mask + + batch_size, dtype = inputs_embeds.shape[0], inputs_embeds.dtype + mask_factory_function = causal_mask_function + mask_interface = ALL_MASK_ATTENTION_FUNCTIONS[config._attn_implementation] + + # Defaulting to using non-vmap based mask creations except when detecting + # users passing custom mask functions (as we cannot guarantee that they + # are properly index-based as required by our implementation). + use_vmap = False + + # Do not allow skip if we are compiling (this is to match BC) + # TODO: cyril -> probably revisit and remove this, but a lot of tests rely on it + if _is_torch_xpu_available: + # Do not allow skip if we are compiling for decoding, but for prefill, we still allow skip to optimization the perf of 1st token generation + allow_is_causal_skip = not (getattr(past_key_values, "is_compileable", False) and cache_position.shape[0] == 1) + else: + allow_is_causal_skip = not getattr(past_key_values, "is_compileable", False) + + # Allow slight deviations from causal mask + # Note that it is very important to apply this before any other deviations of the mask (such as packed sequence mask, + # padding mask, etc) as the resulting mask may otherwise not be correct! + if or_mask_function is not None: + if not _is_torch_greater_or_equal_than_2_6: + raise ValueError("Using `or_mask_function` or `and_mask_function` arguments require torch>=2.6") + mask_factory_function = or_masks(mask_factory_function, or_mask_function) + allow_is_causal_skip = False + use_vmap = True + if and_mask_function is not None: + if not _is_torch_greater_or_equal_than_2_6: + raise ValueError("Using `or_mask_function` or `and_mask_function` arguments require torch>=2.6") + mask_factory_function = and_masks(mask_factory_function, and_mask_function) + allow_is_causal_skip = False + use_vmap = True + + # If we detected packing format + if packed_sequence_mask is not None: + mask_factory_function = and_masks(mask_factory_function, packed_sequence_mask_function(packed_sequence_mask)) + allow_is_causal_skip = False + + # We now create the mask + causal_mask = mask_interface( + batch_size=batch_size, + cache_position=cache_position, + kv_length=kv_length, + kv_offset=kv_offset, + mask_function=mask_factory_function, + attention_mask=attention_mask, + allow_is_causal_skip=allow_is_causal_skip, # additional kwarg for sdpa + dtype=dtype, # Additional kwarg for eager + config=config, # Pass the config as well, in case someone wants to easily have their own mask_interface + use_vmap=use_vmap, # Short-circuit to non-vmap expansions for the mask + ) + return causal_mask + + +@deprecate_kwarg("input_embeds", version="5.6.0", new_name="inputs_embeds") +def create_bidirectional_mask( + config: PreTrainedConfig, + inputs_embeds: torch.Tensor, + attention_mask: torch.Tensor | None, + encoder_hidden_states: torch.Tensor | None = None, + or_mask_function: Callable | None = None, + and_mask_function: Callable | None = None, +) -> torch.Tensor | BlockMask | None: + """ + Create a standard bidirectional mask based on the attention implementation used (stored in the config). + + Args: + config (`PreTrainedConfig`): + The model config. + inputs_embeds (`torch.Tensor`): + The input embeddings of shape (batch_size, query_length, hidden_dim). This is only used to infer metadata + such as the batch size, query length, dtype, and device. + attention_mask (`torch.Tensor`, optional): + The 2D attention mask corresponding to padded tokens of shape (batch_size, kv_length). + It can also be an already prepared 4D mask of shape (batch_size, 1, query_length, kv_length), + in which case it is returned as-is. + encoder_hidden_states (`torch.Tensor`, optional): + The input embeddings of shape (batch_size, kv_length, hidden_dim). If provided, it is used instead of + `inputs_embeds` to infer the batch size, kv length and dtype. + or_mask_function (`Callable`, optional): + An optional mask function to combine with the base mask function (by doing the union of both). This is + useful to easily overlay another mask on top, for example for image tokens handling. + and_mask_function (`Callable`, optional): + An optional mask function to combine with the base mask function (by doing the intersection of both). This is + useful to easily overlay another mask on top, for example for image tokens handling. + """ + # Due to the logic surrounding `cache_position` in inferring query-related information, we + # construct a dummy tensor imitating initial positions + cache_position = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device, dtype=torch.long) + + embeds = encoder_hidden_states if encoder_hidden_states is not None else inputs_embeds + # We ignore a few irrelevant arguments at the end as we do not have a (growing) cache here + early_exit, attention_mask, _, kv_length, kv_offset = _preprocess_mask_arguments( + config, embeds, attention_mask, cache_position, None, None, 0 + ) + if early_exit: + return attention_mask + + batch_size, dtype = embeds.shape[0], embeds.dtype + mask_factory_function = bidirectional_mask_function + mask_interface = ALL_MASK_ATTENTION_FUNCTIONS[config._attn_implementation] + + # Allow skipping the mask creation except we have additional masking operators (and/or masks) + allow_is_bidirectional_skip = True + # Defaulting to using non-vmap based mask creations except when detecting + # users passing custom mask functions (as we cannot guarantee that they + # are properly index-based as required by our implementation). + use_vmap = False + + # Allow slight deviations from the base mask + # Note that it is very important to apply this before any other deviations of the mask (such as packed sequence mask, + # padding mask, etc) as the resulting mask may otherwise not be correct! + if or_mask_function is not None: + if not _is_torch_greater_or_equal_than_2_6: + raise ValueError("Using `or_mask_function` or `and_mask_function` arguments require torch>=2.6") + mask_factory_function = or_masks(mask_factory_function, or_mask_function) + allow_is_bidirectional_skip = False + use_vmap = True + if and_mask_function is not None: + if not _is_torch_greater_or_equal_than_2_6: + raise ValueError("Using `or_mask_function` or `and_mask_function` arguments require torch>=2.6") + mask_factory_function = and_masks(mask_factory_function, and_mask_function) + allow_is_bidirectional_skip = False + use_vmap = True + + # We now create the mask + attention_mask = mask_interface( + batch_size=batch_size, + cache_position=cache_position, + kv_length=kv_length, + kv_offset=kv_offset, + mask_function=mask_factory_function, + attention_mask=attention_mask, + # Additional kwargs for sdpa + allow_is_causal_skip=False, + allow_is_bidirectional_skip=allow_is_bidirectional_skip, + dtype=dtype, # Additional kwarg for eager + config=config, # Pass the config as well, in case someone wants to easily have their own mask_interface + use_vmap=use_vmap, # Short-circuit to non-vmap expansions for the mask + ) + return attention_mask + + +@deprecate_kwarg("input_embeds", version="5.6.0", new_name="inputs_embeds") +def create_sliding_window_causal_mask( + config: PreTrainedConfig, + inputs_embeds: torch.Tensor, + attention_mask: torch.Tensor | None, + cache_position: torch.Tensor, + past_key_values: Cache | None, + position_ids: torch.Tensor | None = None, + or_mask_function: Callable | None = None, + and_mask_function: Callable | None = None, +) -> torch.Tensor | BlockMask | None: + """ + Create a sliding window causal mask based on the attention implementation used (stored in the config). This type + of attention pattern was mostly democratized by Mistral. If `past_key_values` has an hybrid cache structure, this + function will return the mask corresponding to one of the "sliding_attention" layers (to align to what is needed in the + `modeling_xxx.py` files). + + Args: + config (`PreTrainedConfig`): + The model config. + inputs_embeds (`torch.Tensor`): + The input embeddings of shape (batch_size, query_length, hidden_dim). This is used only to infer the + batch size, query length and dtype. + attention_mask (`torch.Tensor`, optional): + The 2D attention mask corresponding to padded tokens of shape (batch_size, number_of_seen_tokens+q_length). + It can also be an already prepared 4D mask, in which case it is returned as-is. + cache_position (`torch.Tensor`): + A tensor of shape (query_length,) indicating the current indices of the input sequence elements. + past_key_values (`Cache`, optional): + The past key values, if we use a cache. + position_ids (`torch.Tensor`, optional) + A 2D tensor of shape (batch_size, query_length) indicating the positions of each token in the sequences. + or_mask_function (`Callable`, optional): + An optional mask function to combine with the sliding causal mask function (by doing the union of both). This is + useful to easily overlay another mask on top of the sliding causal one, for example for image tokens handling. + and_mask_function (`Callable`, optional): + An optional mask function to combine with the sliding causal mask function (by doing the intersection of both). This is + useful to easily overlay another mask on top of the sliding causal one, for example for image tokens handling. + """ + # Power feature: if `is_causal` is False, then fallback to bi-directional mask for bi-directional attention + # It allows to use decoder-only models with bi-directional attention as well + if not getattr(config, "is_causal", True): + return create_bidirectional_sliding_window_mask( + config, + inputs_embeds, + attention_mask, + or_mask_function=or_mask_function, + and_mask_function=and_mask_function, + ) + + # If we have an hybrid cache structure, here we want to create the mask for the sliding layers + if hasattr(past_key_values, "is_sliding") and True in past_key_values.is_sliding: + layer_idx = past_key_values.is_sliding.index(True) + else: + layer_idx = 0 + + early_exit, attention_mask, packed_sequence_mask, kv_length, kv_offset = _preprocess_mask_arguments( + config, inputs_embeds, attention_mask, cache_position, past_key_values, position_ids, layer_idx + ) + if early_exit: + return attention_mask + + sliding_window = getattr(config, "sliding_window", None) + if sliding_window is None: + raise ValueError("Could not find a `sliding_window` argument in the config, or it is not set") + + batch_size, dtype = inputs_embeds.shape[0], inputs_embeds.dtype + mask_factory_function = sliding_window_causal_mask_function(sliding_window) + mask_interface = ALL_MASK_ATTENTION_FUNCTIONS[config._attn_implementation] + + # Defaulting to using non-vmap based mask creations except when detecting + # users passing custom mask functions (as we cannot guarantee that they + # are properly index-based as required by our implementation). + use_vmap = False + # Do not allow skip if we are compiling (this is to match BC) + # TODO: cyril -> probably revisit and remove this, but a lot of tests rely on it + allow_is_causal_skip = not getattr(past_key_values, "is_compileable", False) + + # Allow slight deviations from causal mask + # Note that it is very important to apply this before any other deviations of the mask (such as packed sequence mask, + # padding mask, etc) as the resulting mask may otherwise not be correct! + if or_mask_function is not None: + if not _is_torch_greater_or_equal_than_2_6: + raise ValueError("Using `or_mask_function` or `and_mask_function` arguments require torch>=2.6") + mask_factory_function = or_masks(mask_factory_function, or_mask_function) + allow_is_causal_skip = False + use_vmap = True + if and_mask_function is not None: + if not _is_torch_greater_or_equal_than_2_6: + raise ValueError("Using `or_mask_function` or `and_mask_function` arguments require torch>=2.6") + mask_factory_function = and_masks(mask_factory_function, and_mask_function) + allow_is_causal_skip = False + use_vmap = True + + # If we detected packing format + if packed_sequence_mask is not None: + mask_factory_function = and_masks(mask_factory_function, packed_sequence_mask_function(packed_sequence_mask)) + allow_is_causal_skip = False + + # We now create the mask + causal_mask = mask_interface( + batch_size=batch_size, + cache_position=cache_position, + kv_length=kv_length, + kv_offset=kv_offset, + mask_function=mask_factory_function, + attention_mask=attention_mask, + allow_is_causal_skip=allow_is_causal_skip, # additional kwarg for sdpa + local_size=sliding_window, # Additional kwarg for sdpa + dtype=dtype, # Additional kwarg for eager + config=config, # Pass the config as well, in case someone wants to easily have their own mask_interface + use_vmap=use_vmap, # Short-circuit to non-vmap expansions for the mask + ) + return causal_mask + + +@deprecate_kwarg("input_embeds", version="5.6.0", new_name="inputs_embeds") +def create_bidirectional_sliding_window_mask( + config: PreTrainedConfig, + inputs_embeds: torch.Tensor, + attention_mask: torch.Tensor | None, + or_mask_function: Callable | None = None, + and_mask_function: Callable | None = None, +) -> torch.Tensor | BlockMask | None: + """ + Create a standard bidirectional sliding window mask based on the attention implementation used (stored in the config). + + Args: + config (`PreTrainedConfig`): + The model config. + inputs_embeds (`torch.Tensor`): + The input embeddings of shape (batch_size, query_length, hidden_dim). This is only used to infer metadata + such as the batch size, query length, dtype, and device. + attention_mask (`torch.Tensor`, optional): + The 2D attention mask corresponding to padded tokens of shape (batch_size, kv_length). + It can also be an already prepared 4D mask of shape (batch_size, 1, query_length, kv_length), + in which case it is returned as-is. + or_mask_function (`Callable`, optional): + An optional mask function to combine with the base mask function (by doing the union of both). This is + useful to easily overlay another mask on top, for example for image tokens handling. + and_mask_function (`Callable`, optional): + An optional mask function to combine with the base mask function (by doing the intersection of both). This is + useful to easily overlay another mask on top, for example for image tokens handling. + """ + # Due to the logic surrounding `cache_position` in inferring query-related information, we + # construct a dummy tensor imitating initial positions + cache_position = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device, dtype=torch.long) + + # We ignore a few irrelevant arguments at the end as we do not have a (growing) cache here + early_exit, attention_mask, _, kv_length, kv_offset = _preprocess_mask_arguments( + config, inputs_embeds, attention_mask, cache_position, None, None, 0 + ) + if early_exit: + return attention_mask + + sliding_window = getattr(config, "sliding_window", None) + if sliding_window is None: + raise ValueError("Could not find a `sliding_window` argument in the config, or it is not set") + + batch_size, dtype = inputs_embeds.shape[0], inputs_embeds.dtype + mask_factory_function = sliding_window_bidirectional_mask_function(sliding_window) + mask_interface = ALL_MASK_ATTENTION_FUNCTIONS[config._attn_implementation] + + use_vmap = False + allow_is_bidirectional_skip = True + + if or_mask_function is not None: + if not _is_torch_greater_or_equal_than_2_6: + raise ValueError("Using `or_mask_function` or `and_mask_function` arguments require torch>=2.6") + mask_factory_function = or_masks(mask_factory_function, or_mask_function) + allow_is_bidirectional_skip = False + use_vmap = True + if and_mask_function is not None: + if not _is_torch_greater_or_equal_than_2_6: + raise ValueError("Using `or_mask_function` or `and_mask_function` arguments require torch>=2.6") + mask_factory_function = and_masks(mask_factory_function, and_mask_function) + allow_is_bidirectional_skip = False + use_vmap = True + + attention_mask = mask_interface( + batch_size=batch_size, + cache_position=cache_position, + kv_length=kv_length, + kv_offset=kv_offset, + mask_function=mask_factory_function, + attention_mask=attention_mask, + allow_is_causal_skip=False, + allow_is_bidirectional_skip=allow_is_bidirectional_skip, + local_size=sliding_window, # Additional kwarg for sdpa + dtype=dtype, # Additional kwarg for eager + config=config, # Pass the config as well, in case someone wants to easily have their own mask_interface + use_vmap=use_vmap, # Short-circuit to non-vmap expansions for the mask + ) + return attention_mask + + +@deprecate_kwarg("input_embeds", version="5.6.0", new_name="inputs_embeds") +def create_chunked_causal_mask( + config: PreTrainedConfig, + inputs_embeds: torch.Tensor, + attention_mask: torch.Tensor | None, + cache_position: torch.Tensor, + past_key_values: Cache | None, + position_ids: torch.Tensor | None = None, + or_mask_function: Callable | None = None, + and_mask_function: Callable | None = None, +) -> torch.Tensor | BlockMask | None: + """ + Create a chunked attention causal mask based on the attention implementation used (stored in the config). This type + of attention pattern was mostly democratized by Llama4. If `past_key_values` has an hybrid cache structure, this + function will return the mask corresponding to one of the "chunked_attention" layers (to align to what is needed in the + `modeling_xxx.py` files). + + Args: + config (`PreTrainedConfig`): + The model config. + inputs_embeds (`torch.Tensor`): + The input embeddings of shape (batch_size, query_length, hidden_dim). This is used only to infer the + batch size, query length and dtype. + attention_mask (`torch.Tensor`, optional): + The 2D attention mask corresponding to padded tokens of shape (batch_size, number_of_seen_tokens+q_length). + It can also be an already prepared 4D mask, in which case it is returned as-is. + cache_position (`torch.Tensor`): + A tensor of shape (query_length,) indicating the current indices of the input sequence elements. + past_key_values (`Cache`, optional): + The past key values, if we use a cache. + position_ids (`torch.Tensor`, optional) + A 2D tensor of shape (batch_size, query_length) indicating the positions of each token in the sequences. + or_mask_function (`Callable`, optional): + An optional mask function to combine with the chunked causal mask function (by doing the union of both). This is + useful to easily overlay another mask on top of the chunked causal one, for example for image tokens handling. + and_mask_function (`Callable`, optional): + An optional mask function to combine with the chunked causal mask function (by doing the intersection of both). This is + useful to easily overlay another mask on top of the chunked causal one, for example for image tokens handling. + """ + # If we have an hybrid cache structure, here we want to create the mask for the sliding layers + if hasattr(past_key_values, "is_sliding") and True in past_key_values.is_sliding: + layer_idx = past_key_values.is_sliding.index(True) + else: + layer_idx = 0 + + early_exit, attention_mask, packed_sequence_mask, kv_length, kv_offset = _preprocess_mask_arguments( + config, inputs_embeds, attention_mask, cache_position, past_key_values, position_ids, layer_idx + ) + if early_exit: + return attention_mask + + chunk_size = getattr(config, "attention_chunk_size", None) + if chunk_size is None: + raise ValueError("Could not find an `attention_chunk_size` argument in the config, or it is not set") + + # Raise if using chunked attention on context too large with FA + if is_flash_attention_requested(config) and kv_length + kv_offset > chunk_size: + raise ValueError( + "Flash attention cannot handle chunked attention, and the key-value length is larger than the chunk size so the " + "chunked pattern cannot be respected. You should use another `attn_implementation` when instantiating the model" + ) + + batch_size, dtype = inputs_embeds.shape[0], inputs_embeds.dtype + # For chunked attention and batched inputs, we need to take the number of left padding tokens into account + # to start the chunk from the actual start of the sequence for the padded sequence + if attention_mask is not None: + # Only count the left padding tokens, not all of them + left_padding_tokens = (attention_mask.cumsum(dim=-1) == torch.zeros_like(attention_mask)).sum(dim=-1) + else: + left_padding_tokens = torch.zeros(batch_size, device=cache_position.device, dtype=int) + mask_factory_function = chunked_causal_mask_function(chunk_size, left_padding_tokens) + mask_interface = ALL_MASK_ATTENTION_FUNCTIONS[config._attn_implementation] + + # Defaulting to using non-vmap based mask creations except when detecting + # users passing custom mask functions (as we cannot guarantee that they + # are properly index-based as required by our implementation). + use_vmap = False + # Do not allow skip if we are compiling (this is to match BC) + # TODO: cyril -> probably revisit and remove this, but a lot of tests rely on it + allow_is_causal_skip = not getattr(past_key_values, "is_compileable", False) + + # Allow slight deviations from causal mask + # Note that it is very important to apply this before any other deviations of the mask (such as packed sequence mask, + # padding mask, etc) as the resulting mask may otherwise not be correct! + if or_mask_function is not None: + if not _is_torch_greater_or_equal_than_2_6: + raise ValueError("Using `or_mask_function` or `and_mask_function` arguments require torch>=2.6") + mask_factory_function = or_masks(mask_factory_function, or_mask_function) + allow_is_causal_skip = False + use_vmap = True + if and_mask_function is not None: + if not _is_torch_greater_or_equal_than_2_6: + raise ValueError("Using `or_mask_function` or `and_mask_function` arguments require torch>=2.6") + mask_factory_function = and_masks(mask_factory_function, and_mask_function) + allow_is_causal_skip = False + use_vmap = True + + # If we detected packing format + if packed_sequence_mask is not None: + mask_factory_function = and_masks(mask_factory_function, packed_sequence_mask_function(packed_sequence_mask)) + allow_is_causal_skip = False + + # We now create the mask + causal_mask = mask_interface( + batch_size=batch_size, + cache_position=cache_position, + kv_length=kv_length, + kv_offset=kv_offset, + mask_function=mask_factory_function, + attention_mask=attention_mask, + allow_is_causal_skip=allow_is_causal_skip, # additional kwarg for sdpa + local_size=chunk_size, # Additional kwarg for sdpa + dtype=dtype, # Additional kwarg for eager + config=config, # Pass the config as well, in case someone wants to easily have their own mask_interface + use_vmap=use_vmap, # Short-circuit to non-vmap expansions for the mask + ) + return causal_mask + + +LAYER_PATTERN_TO_MASK_FUNCTION_MAPPING = { + "full_attention": create_causal_mask, + "sliding_attention": create_sliding_window_causal_mask, + "chunked_attention": create_chunked_causal_mask, +} + + +@deprecate_kwarg("input_embeds", version="5.6.0", new_name="inputs_embeds") +def create_masks_for_generate( + config: PreTrainedConfig, + inputs_embeds: torch.Tensor, + attention_mask: torch.Tensor | None, + cache_position: torch.Tensor, + past_key_values: Cache | None, + position_ids: torch.Tensor | None = None, + or_mask_function: Callable | None = None, + and_mask_function: Callable | None = None, + **kwargs, +): + """ + This function mimics how we create the masks in the `modeling_xxx.py` files, and is used in places like `generate` + in order to easily create the masks in advance, when we compile the forwards with Static caches. + + Args: + config (`PreTrainedConfig`): + The model config. + inputs_embeds (`torch.Tensor`): + The input embeddings of shape (batch_size, query_length, hidden_dim). This is used only to infer the + batch size, query length and dtype. + attention_mask (`torch.Tensor`, optional): + The 2D attention mask corresponding to padded tokens of shape (batch_size, number_of_seen_tokens+q_length). + It can also be an already prepared 4D mask, in which case it is returned as-is. + cache_position (`torch.Tensor`): + A tensor of shape (query_length,) indicating the current indices of the input sequence elements. + past_key_values (`Cache`, optional): + The past key values, if we use a cache. + position_ids (`torch.Tensor`, optional) + A 2D tensor of shape (batch_size, query_length) indicating the positions of each token in the sequences. + or_mask_function (`Callable`, optional): + An optional mask function to combine with the other mask function (by doing the union of both). This is + useful to easily overlay another mask on top of the causal one, for example for image tokens handling. + and_mask_function (`Callable`, optional): + An optional mask function to combine with the other mask function (by doing the intersection of both). This is + useful to easily overlay another mask on top of the causal one, for example for image tokens handling. + """ + # The attribute reside in the text config for composite models + effective_config = config.get_text_config() + # Prepare the mask args + mask_kwargs = { + "config": effective_config, + "inputs_embeds": inputs_embeds, + "attention_mask": attention_mask, + "cache_position": cache_position, + "past_key_values": past_key_values, + "position_ids": position_ids, + "or_mask_function": or_mask_function, + "and_mask_function": and_mask_function, + } + + # If the attribute exist, we need several masks + if hasattr(effective_config, "layer_types"): + causal_masks = {} + for layer_pattern in set(effective_config.layer_types): + causal_masks[layer_pattern] = LAYER_PATTERN_TO_MASK_FUNCTION_MAPPING[layer_pattern](**mask_kwargs) + return causal_masks + # In this case, all layers are sliding + elif getattr(effective_config, "sliding_window", None) is not None: + return create_sliding_window_causal_mask(**mask_kwargs) + # In this case, all layers are chunked + elif getattr(effective_config, "attention_chunk_size", None) is not None: + return create_chunked_causal_mask(**mask_kwargs) + # All layers use standard causal attention + return create_causal_mask(**mask_kwargs) + + +# Below are utilities to pretty-print the different masks +# Print the matrix with words as row labels +GREEN = "\033[92m" +YELLOW = "\033[93m" +RESET = "\033[0m" +BLACK_SQUARE = "■" +WHITE_SQUARE = "⬚" +GREY_SQUARE = "∙" +LOW_TRIANGLE = "⬕" +UPPER_TRIANGLE = "⬔" + + +def get_style(style): + if style == "majong": + BLACK_SQUARE = "🀞" # Full block (represents "on" or active) + BLACK_SQUARE = "🀙" # Full block (represents "on" or active) + WHITE_SQUARE = "🀆" # "▒" # Light shade (represents "off" or inactive) + LOW_TRIANGLE = "🀛" # Lower left triangle (stylized indication) + UPPER_TRIANGLE = "🀛" # Upper left triangle (stylized indication) + else: + BLACK_SQUARE = "█" # Full block (represents "on" or active) + WHITE_SQUARE = "░" # "▒" # Light shade (represents "off" or inactive) + LOW_TRIANGLE = "▙" # Lower left triangle (stylized indication)) + UPPER_TRIANGLE = "▜" # Upper left triangle (stylized indication) + + return BLACK_SQUARE, WHITE_SQUARE, LOW_TRIANGLE, UPPER_TRIANGLE + + +# LOW_TRIANGLE = UPPER_TRIANGLE = "⟍" # Upper right triangle (stylized indication) + +YELLOW_SQUARE = f"{YELLOW}{BLACK_SQUARE}{RESET}" +GREEN_SQUARE = f"{GREEN}{BLACK_SQUARE}{RESET}" + + +def tensor_to_mask_visual(original_tensor: torch.Tensor, grid_size=(20, 40), style="majong") -> str: + BLACK_SQUARE, WHITE_SQUARE, LOW_TRIANGLE, UPPER_TRIANGLE = get_style(style) + h, w = original_tensor.shape + max_h, max_w = grid_size + if not (h < max_h and w < max_w): + # Preserve aspect ratio within max grid size + aspect_ratio = 2 * w / h + if aspect_ratio > 1: + w = max_w + h = min(max_h, max(1, round(max_w / aspect_ratio))) + else: + h = max_h + w = max(1, round(max_h * aspect_ratio)) + + # Step 1: Rescale tensor by average pooling + tensor = original_tensor.unsqueeze(0).unsqueeze(0) # Add batch and channel dimensions + tensor = F.adaptive_avg_pool2d(tensor, output_size=(h, w))[0, 0] # Remove extra dims + else: + tensor = original_tensor + + # Step 3: Build the string representation + result = [] + for i in range(h): + row = "" + for j in range(w): + if tensor[i, j] == 1: + row += BLACK_SQUARE + elif tensor[i, j] == 0: + row += WHITE_SQUARE + else: + if j > 0: + if tensor[i, j - 1] == 1: + row += LOW_TRIANGLE + elif tensor[i, j - 1] == 0: + row += UPPER_TRIANGLE + else: + row += BLACK_SQUARE if tensor[i, j] == 1 else WHITE_SQUARE + else: + row += ( + BLACK_SQUARE + if tensor[i, j] == 1 + else ( + WHITE_SQUARE + if tensor[i, j] == 0 + else (UPPER_TRIANGLE if tensor[i, j + 1] == 1 else LOW_TRIANGLE) + ) + ) + result.append(row) + + return "\n".join(result) + + +class AttentionMask(torch.Tensor): + def __new__(cls, data, style=None): + # Create a new instance of AttentionMask as a Tensor + cls.style = style + return torch.Tensor._make_subclass(cls, data, require_grad=False) + + def __init__(self, data): + # You can initialize any additional metadata here if needed + pass + + def to_string(self, grid_size=(20, 40), limit=4): + """Returns a string representation of the block mask.""" + dense_mask = self + *batch_dims, num_rows, num_cols = dense_mask.shape + total_vis = [] + + for idx, batch_idx in enumerate(itertools.product(*[range(i) for i in batch_dims])): + if idx == limit: + total_vis.append("...") + total_vis.append("To print out more, set AttentionMask.to_string(limit=N)") + total_vis.append("You can also index (AttentionMask[batch, head]) to choose a specific batch or head") + break + block_vis = tensor_to_mask_visual(dense_mask[batch_idx], grid_size=grid_size, style=self.style) + total_vis.append(block_vis) + + total_vis.append(f"torch.Tensor(shape={tuple(self.shape)}, dtype={self.dtype})") + return "\n".join(total_vis) + + def __repr__(self): + return self.to_string() + + def __str__(self): + return self.to_string() + + @classmethod + def from_tensor(cls, tensor: torch.Tensor, style: str | None = None) -> "AttentionMask": + res = cls(tensor) + res.style = style + return res diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/model_debugging_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/model_debugging_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..5b230836c6e7ec63a83b276e3ced23e30e6dd300 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/model_debugging_utils.py @@ -0,0 +1,455 @@ +# Copyright 2025 The HuggingFace Inc. team. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import functools +import json +import os +import re +from contextlib import contextmanager, redirect_stdout +from io import StringIO + +from .utils import logging +from .utils.import_utils import is_torch_available, requires + + +if is_torch_available(): + import torch + from safetensors.torch import save_file + + _torch_distributed_available = False + # Note to code inspectors: this toolbox is intended for people who add models to `transformers`. + if torch.distributed.is_available(): + import torch.distributed.tensor + + _torch_distributed_available = True +else: + _torch_distributed_available = False + + +logger = logging.get_logger(__name__) + + +def _is_rank_zero(): + """Return True if rank=0 or we aren't running distributed.""" + if not (_torch_distributed_available and torch.distributed.is_initialized()): + return True + return torch.distributed.get_rank() == 0 + + +MEMORY_ADDRESS_REGEX = re.compile(r"object at 0x[0-9A-Fa-f]+") + + +def _sanitize_repr_for_diff(x_str: str) -> str: + """ + Replace memory addresses in an object's repr with a stable placeholder + so that beautiful JSON diffs won't be ruined by ephemeral addresses. + """ + return MEMORY_ADDRESS_REGEX.sub("object at 0xXXXXXXXX", x_str) + + +def _dtensor_repr(x): + """Return a stable string representation for a DTensor-like object.""" + if _is_rank_zero(): + return f"DTensor (rank0) -> {repr(x._local_tensor)}" + return "DTensor(non-rank0)" + + +def _serialize_tensor_like_io( + value, debug_path: str | None = None, use_repr: bool = True, path_to_value: str | None = None +): + """ + Converts Tensors and DTensors to a JSON-serializable dictionary representation. + + Args: + value: Any Python object, often including torch Tensors, lists, dicts, etc. + debug_path (`str`, *optional*, defaults to `None`): Directory to dump debug JSON and SafeTensors files. + use_repr (bool, *optional*, defaults to `True`): Whether to save a `repr()`-ized version of the tensor as the + `value` property in the asscoiated FULL_TENSORS.json file, or to store the full tensors in separate + SafeTensors file and store the relative path to that file in the `value` property in the dictionary. + path_to_value (`str`, *optional*, defaults to `None`): The file name for the SafeTensors file holding the full + tensor value if `use_repr=False`. + + Returns: + A nested Python structure (list, dict, or sanitized string) that is safe to json.dump. + """ + torch.set_printoptions(sci_mode=True) + + if use_repr: + value_out = _repr_to_list(value) + elif path_to_value: + if not path_to_value.endswith(".safetensors"): + path_to_value += ".safetensors" + + filepath = os.path.join(debug_path, path_to_value) if debug_path else path_to_value + save_file({"data": value.contiguous().detach().cpu()}, filepath) + value_out = f"./{path_to_value}" + else: + raise ValueError(f"{use_repr=} and {path_to_value=} cannot both be falsy.") + + out = { + "shape": repr(value.shape), + "dtype": repr(value.dtype), + "value": value_out, + } + if value.dtype in {torch.float16, torch.float32, torch.bfloat16}: + out.update( + { + "mean": _sanitize_repr_for_diff(repr(value.mean())), + "std": _sanitize_repr_for_diff(repr(value.std())), + "min": _sanitize_repr_for_diff(repr(value.min())), + "max": _sanitize_repr_for_diff(repr(value.max())), + } + ) + return out + + +def _serialize_io(value, debug_path: str | None = None, use_repr: bool = True, path_to_value: str | None = None): + """ + Recursively build a JSON-serializable Python structure from `value`. + Tensors and DTensors become either sanitized repr strings, or are saved to disk as SafeTensors files and their + relative paths are recorded in the returned Python structure. + Lists/tuples/dicts are recursed into. + All memory addresses are replaced with a stable placeholder. + + Args: + value: Any Python object, often including torch Tensors, lists, dicts, etc. + debug_path (`str`, *optional*, defaults to `None`): Directory to dump debug JSON and SafeTensors files. + use_repr (bool, *optional*, defaults to `True`): Whether to save a `repr()`-ized version of the tensors as the + `value` property in the asscoiated FULL_TENSORS.json file, or to store full tensors in separate SafeTensors + files and store the relative path to that file in the `value` property. + path_to_value (`str`, *optional*, defaults to `None`): The file name for the SafeTensors file holding the full + tensor value if `use_repr=False`. + + Returns: + A nested Python structure (list, dict, or sanitized string) that is safe to json.dump. + """ + if isinstance(value, (list, tuple)): + return [ + _serialize_io(v, debug_path=debug_path, use_repr=use_repr, path_to_value=f"{path_to_value}_{i}") + for i, v in enumerate(value) + ] + + if isinstance(value, dict): + return { + k: _serialize_io(v, debug_path=debug_path, use_repr=use_repr, path_to_value=f"{path_to_value}_{k}") + for k, v in value.items() + } + + if hasattr(value, "_local_tensor"): + return _serialize_tensor_like_io( + value._local_tensor, debug_path=debug_path, use_repr=use_repr, path_to_value=path_to_value + ) + + if isinstance(value, torch.Tensor): + return _serialize_tensor_like_io(value, debug_path=debug_path, use_repr=use_repr, path_to_value=path_to_value) + + return _sanitize_repr_for_diff(repr(value)) + + +def _repr_to_list(value: torch.Tensor): + """ + Converts a tensor into a sanitized multi-line string representation. + + Args: + value (`torch.Tensor`): The tensor to represent. + + Returns: + `list[str]`: List of string lines representing the tensor. + """ + torch.set_printoptions(sci_mode=True, linewidth=120) + with StringIO() as buf, redirect_stdout(buf): + print(value) # to redirected stdout to avoid line splits + raw = buf.getvalue() + return _sanitize_repr_for_diff(raw).splitlines() + + +def prune_outputs_if_children(node): + # if there are children, remove this node's "outputs" + # so we only see outputs at the leaf level + if node.get("children"): + node.pop("outputs", None) + for child in node["children"]: + prune_outputs_if_children(child) + + +LAYER_SUFFIX_RE = re.compile(r"(.*)\.(\d+)$") # should be generic enough, ends with a number + + +def is_layer_block(node): + """ + Checks whether a node represents a layer block with submodules. + + Args: + node (`dict`): A node from the call tree. + + Returns: + `bool`: Whether the node is a layer block. + """ + match = LAYER_SUFFIX_RE.match(node.get("module_path", "")) + if not match or not node.get("children"): + return False + number = match.group(2) + return any(f".{number}." in child.get("module_path", "") for child in node["children"]) + + +def prune_intermediate_layers(node): + """ + Recursively removes intermediate layers from the tree to improve readability. + Keeps at least the first and last layers if many consecutive layers are present. + + Args: + node (`dict`): The root or subnode to prune recursively. + """ + if not node.get("children"): + return + layer_blocks = [(i, child) for i, child in enumerate(node["children"]) if is_layer_block(child)] + + if len(layer_blocks) > 2: + to_remove = [i for i, _ in layer_blocks[1:-1]] + node["children"] = [child for i, child in enumerate(node["children"]) if i not in to_remove] + + for child in node["children"]: + prune_intermediate_layers(child) + + +def log_model_debug_trace(debug_path: str | None, model): + if debug_path: + try: + os.makedirs(debug_path, exist_ok=True) + base = os.path.join(debug_path, model._debugger_module_dump_name + "_debug_tree") + except Exception as e: + raise ValueError(f"Unexpected or existing debug_path={debug_path}.") from e + else: + base = model._debugger_module_dump_name + "_debug_tree" + + logger.info(f"Writing model trace at {base}.json") + full_path = base + "_FULL_TENSORS.json" + summary_path = base + "_SUMMARY.json" + + prune_outputs_if_children(model._call_tree) + + with open(full_path, "w") as f: + json.dump(model._call_tree, f, indent=2) + + # summary-only version for readability - traversing the tree again #TODO optimize? + def strip_values(node): + def clean(val): + if isinstance(val, dict): + val.pop("value", None) + for v in val.values(): + clean(v) + elif isinstance(val, list): + for item in val: + clean(item) + + clean(node.get("inputs", {})) + clean(node.get("outputs", {})) + + for child in node.get("children", []): + strip_values(child) + + tree_copy = json.loads(json.dumps(model._call_tree)) # deep copy + strip_values(tree_copy) + + with open(summary_path, "w") as f: + json.dump(tree_copy, f, indent=2) + + +def _attach_debugger_logic( + model, + debug_path: str = ".", + do_prune_layers: bool = True, + use_repr: bool = True, +): + """ + Attaches a debugging wrapper to every module in the model. + + This records structured inputs and outputs during the forward pass into a call tree. + + Args: + model (`PreTrainedModel`, `nn.Module`): Model to wrap. + debug_path (`str`): Optional directory to dump debug JSON files. + do_prune_layers (`bool`, *optional*, defaults to `True`): Whether to prune intermediate layers. + use_repr (bool, *optional*, defaults to `True`): Whether to save a `repr()`-ized version of the tensors as the + `value` property in the associated FULL_TENSORS.json file, or to store full tensors in separate SafeTensors + files and store the relative path to that file in the `value` property. + """ + class_name = model.__class__.__name__ + + # Prepare data structures on the model object + model._call_tree = {"module_path": class_name, "inputs": None, "outputs": None, "children": []} + model._debugger_model_call_stack = [] + model._debugger_module_dump_name = class_name # used for final JSON filename + + if debug_path: + try: + os.makedirs(debug_path, exist_ok=True) + except Exception as e: + raise ValueError(f"Unexpected or existing debug_path={debug_path}.") from e + + def wrap_forward(module, full_path): + orig_forward = module.forward + + @functools.wraps(orig_forward) + def wrapped_forward(*inps, **kws): + if _is_rank_zero(): + dict_inputs = {"args": inps, "kwargs": kws} + dict_inputs = {k: dict_inputs[k] for k in dict_inputs if len(dict_inputs[k]) > 0} + node = { + "module_path": full_path, + "inputs": _serialize_io( + dict_inputs, + debug_path=debug_path, + use_repr=use_repr, + path_to_value=f"{full_path}_inputs", + ), + "outputs": None, + "children": [], + } + model._debugger_model_call_stack.append(node) + with torch.no_grad(): + out = orig_forward(*inps, **kws) + + if _is_rank_zero(): + if sum(1 for _ in module.named_children()) > 0: + node["outputs"] = None + else: + node["outputs"] = _serialize_io( + out, + debug_path=debug_path, + use_repr=use_repr, + path_to_value=f"{full_path}_outputs", + ) + + finished = model._debugger_model_call_stack.pop() + # prune empty vertices here as well (mostly empty children nodes) + if not finished["children"]: + finished.pop("children") + + if model._debugger_model_call_stack: + model._debugger_model_call_stack[-1]["children"].append(finished) + return out + + module.forward = wrapped_forward + + # wrap all submodules + for name, submodule in model.named_modules(): + if name == "": + continue + wrap_forward(submodule, f"{class_name}.{name}") + + # wrap top-level forward + real_top_forward = model.forward + + @functools.wraps(real_top_forward) + def top_wrapped_forward(*inps, **kws): + if _is_rank_zero(): + top_node = { + "module_path": f"{class_name} (top-level)", + "inputs": _serialize_io( + {"args": inps, "kwargs": kws}, + debug_path=debug_path, + use_repr=use_repr, + path_to_value=f"{class_name}_inputs", + ), + "outputs": None, + "children": [], + } + model._debugger_model_call_stack.append(top_node) + + out = real_top_forward(*inps, **kws) + if _is_rank_zero() and model._debugger_model_call_stack: + top_node["outputs"] = _serialize_io( + out, + debug_path=debug_path, + use_repr=use_repr, + path_to_value=f"{class_name}_outputs", + ) + finished = model._debugger_model_call_stack.pop() + model._call_tree["inputs"] = finished["inputs"] + model._call_tree["outputs"] = finished["outputs"] + model._call_tree["children"] = finished["children"] + # prune empty stuff for visibility + [model._call_tree.pop(k, None) for k in list(model._call_tree.keys()) if not model._call_tree[k]] + + # prune layers that are not 0 or last + if do_prune_layers: + prune_intermediate_layers(model._call_tree) + # Write final JSON trace here + log_model_debug_trace(debug_path=debug_path, model=model) + return out + + model.forward = top_wrapped_forward + + +@requires(backends=("torch",)) +@contextmanager +def model_addition_debugger_context( + model, + debug_path: str | None = None, + do_prune_layers: bool = True, + use_repr: bool = True, +): + """ + # Model addition debugger - context manager for model adders + This context manager is a power user tool intended for model adders. + + It tracks all forward calls within a model forward and logs a slice of each input and output on a nested JSON file. + If `use_repr=True` (the default), the JSON file will record a `repr()`-ized version of the tensors as a list of + strings. If `use_repr=False`, the full tensors will be stored in separate SafeTensors files and the JSON file will + provide a relative path to that file. + + To note, this context manager enforces `torch.no_grad()`. + + ## Usage + + add the context manager to a model to debug + + ```python + import torch + + from PIL import Image + from transformers import LlavaProcessor, LlavaForConditionalGeneration, model_addition_debugger_context + + torch.random.manual_seed(673) + + # load pretrained model and processor + model_id = "llava-hf/llava-1.5-7b-hf" + processor = LlavaProcessor.from_pretrained(model_id) + model = LlavaForConditionalGeneration.from_pretrained(model_id) + + # create random image input + random_image = Image.fromarray(torch.randint(0, 256, (224, 224, 3), dtype=torch.uint8).numpy()) + + # prompt + prompt = "Describe this image." + + # process inputs + inputs = processor(text=prompt, images=random_image, return_tensors="pt") + + # call forward method (not .generate!) + with model_addition_debugger_context(model, debug_path="Your_debug_path", do_prune_layers=False): + output = model.forward(**inputs) + ``` + + """ + orig_forwards = {m: m.forward for _, m in model.named_modules()} + orig_forwards[model] = model.forward + _attach_debugger_logic(model, debug_path, do_prune_layers, use_repr) + try: + yield model + finally: + for module_instance, forward_method in orig_forwards.items(): + module_instance.forward = forward_method diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/modelcard.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modelcard.py new file mode 100644 index 0000000000000000000000000000000000000000..922dca4936454e5f5091e06bba2ef66152ebcc45 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modelcard.py @@ -0,0 +1,589 @@ +# Copyright 2018 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Configuration base class and utilities.""" + +import os +from dataclasses import dataclass +from pathlib import Path +from typing import Any + +import httpx +import yaml +from huggingface_hub import is_offline_mode, model_info +from huggingface_hub.errors import OfflineModeIsEnabled +from huggingface_hub.utils import HFValidationError + +from . import __version__ +from .models.auto.modeling_auto import ( + MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES, + MODEL_FOR_CAUSAL_LM_MAPPING_NAMES, + MODEL_FOR_CTC_MAPPING_NAMES, + MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES, + MODEL_FOR_IMAGE_SEGMENTATION_MAPPING_NAMES, + MODEL_FOR_IMAGE_TEXT_TO_TEXT_MAPPING_NAMES, + MODEL_FOR_MASKED_LM_MAPPING_NAMES, + MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES, + MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES, + MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES, + MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES, + MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES, + MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING_NAMES, + MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES, + MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING_NAMES, +) +from .training_args import ParallelMode +from .utils import ( + is_datasets_available, + is_tokenizers_available, + is_torch_available, + logging, +) + + +TASK_MAPPING = { + "text-generation": MODEL_FOR_CAUSAL_LM_MAPPING_NAMES, + "image-classification": MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES, + "image-segmentation": MODEL_FOR_IMAGE_SEGMENTATION_MAPPING_NAMES, + "fill-mask": MODEL_FOR_MASKED_LM_MAPPING_NAMES, + "object-detection": MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES, + "question-answering": MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES, + "text2text-generation": MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES, + "text-classification": MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES, + "table-question-answering": MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING_NAMES, + "token-classification": MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES, + "audio-classification": MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES, + "automatic-speech-recognition": {**MODEL_FOR_CTC_MAPPING_NAMES, **MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES}, + "zero-shot-image-classification": MODEL_FOR_ZERO_SHOT_IMAGE_CLASSIFICATION_MAPPING_NAMES, + "image-text-to-text": MODEL_FOR_IMAGE_TEXT_TO_TEXT_MAPPING_NAMES, +} + +logger = logging.get_logger(__name__) + + +AUTOGENERATED_TRAINER_COMMENT = """ + +""" + + +TASK_TAG_TO_NAME_MAPPING = { + "fill-mask": "Masked Language Modeling", + "image-classification": "Image Classification", + "image-segmentation": "Image Segmentation", + "multiple-choice": "Multiple Choice", + "object-detection": "Object Detection", + "question-answering": "Question Answering", + "summarization": "Summarization", + "table-question-answering": "Table Question Answering", + "text-classification": "Text Classification", + "text-generation": "Causal Language Modeling", + "text2text-generation": "Sequence-to-sequence Language Modeling", + "token-classification": "Token Classification", + "translation": "Translation", + "zero-shot-classification": "Zero Shot Classification", + "automatic-speech-recognition": "Automatic Speech Recognition", + "audio-classification": "Audio Classification", +} + + +METRIC_TAGS = [ + "accuracy", + "bleu", + "f1", + "matthews_correlation", + "pearsonr", + "precision", + "recall", + "rouge", + "sacrebleu", + "spearmanr", + "wer", +] + + +def _listify(obj): + if obj is None: + return [] + elif isinstance(obj, str): + return [obj] + else: + return obj + + +def _insert_values_as_list(metadata, name, values): + if values is None: + return metadata + if isinstance(values, str): + values = [values] + values = [v for v in values if v is not None] + if len(values) == 0: + return metadata + metadata[name] = values + return metadata + + +def infer_metric_tags_from_eval_results(eval_results): + if eval_results is None: + return {} + result = {} + for key in eval_results: + if key.lower().replace(" ", "_") in METRIC_TAGS: + result[key.lower().replace(" ", "_")] = key + elif key.lower() == "rouge1": + result["rouge"] = key + return result + + +def _insert_value(metadata, name, value): + if value is None: + return metadata + metadata[name] = value + return metadata + + +def is_hf_dataset(dataset): + if not is_datasets_available(): + return False + + from datasets import Dataset, IterableDataset + + return isinstance(dataset, (Dataset, IterableDataset)) + + +def _get_mapping_values(mapping): + result = [] + for v in mapping.values(): + if isinstance(v, (tuple, list)): + result += list(v) + else: + result.append(v) + return result + + +@dataclass +class TrainingSummary: + model_name: str + language: str | list[str] | None = None + license: str | None = None + tags: str | list[str] | None = None + finetuned_from: str | None = None + tasks: str | list[str] | None = None + dataset: str | list[str] | None = None + dataset_tags: str | list[str] | None = None + dataset_args: str | list[str] | None = None + dataset_metadata: dict[str, Any] | None = None + eval_results: dict[str, float] | None = None + eval_lines: list[str] | None = None + hyperparameters: dict[str, Any] | None = None + source: str | None = "trainer" + + def __post_init__(self): + # Infer default license from the checkpoint used, if possible. + if ( + self.license is None + and not is_offline_mode() + and self.finetuned_from is not None + and len(self.finetuned_from) > 0 + ): + try: + info = model_info(self.finetuned_from) + for tag in info.tags: + if tag.startswith("license:"): + self.license = tag[8:] + except (httpx.HTTPError, HFValidationError, OfflineModeIsEnabled): + pass + + def create_model_index(self, metric_mapping): + model_index = {"name": self.model_name} + + # Dataset mapping tag -> name + dataset_names = _listify(self.dataset) + dataset_tags = _listify(self.dataset_tags) + dataset_args = _listify(self.dataset_args) + dataset_metadata = _listify(self.dataset_metadata) + if len(dataset_args) < len(dataset_tags): + dataset_args = dataset_args + [None] * (len(dataset_tags) - len(dataset_args)) + dataset_mapping = dict(zip(dataset_tags, dataset_names)) + dataset_arg_mapping = dict(zip(dataset_tags, dataset_args)) + dataset_metadata_mapping = dict(zip(dataset_tags, dataset_metadata)) + + task_mapping = { + task: TASK_TAG_TO_NAME_MAPPING[task] for task in _listify(self.tasks) if task in TASK_TAG_TO_NAME_MAPPING + } + + model_index["results"] = [] + + if len(task_mapping) == 0 and len(dataset_mapping) == 0: + return [model_index] + if len(task_mapping) == 0: + task_mapping = {None: None} + if len(dataset_mapping) == 0: + dataset_mapping = {None: None} + + # One entry per dataset and per task + all_possibilities = [(task_tag, ds_tag) for task_tag in task_mapping for ds_tag in dataset_mapping] + for task_tag, ds_tag in all_possibilities: + result = {} + if task_tag is not None: + result["task"] = {"name": task_mapping[task_tag], "type": task_tag} + + if ds_tag is not None: + metadata = dataset_metadata_mapping.get(ds_tag, {}) + result["dataset"] = { + "name": dataset_mapping[ds_tag], + "type": ds_tag, + **metadata, + } + if dataset_arg_mapping[ds_tag] is not None: + result["dataset"]["args"] = dataset_arg_mapping[ds_tag] + + if len(metric_mapping) > 0: + result["metrics"] = [] + for metric_tag, metric_name in metric_mapping.items(): + result["metrics"].append( + { + "name": metric_name, + "type": metric_tag, + "value": self.eval_results[metric_name], + } + ) + + # Remove partial results to avoid the model card being rejected. + if "task" in result and "dataset" in result and "metrics" in result: + model_index["results"].append(result) + else: + logger.info(f"Dropping the following result as it does not have all the necessary fields:\n{result}") + + return [model_index] + + def create_metadata(self): + metric_mapping = infer_metric_tags_from_eval_results(self.eval_results) + + metadata = {} + metadata = _insert_value(metadata, "library_name", "transformers") + metadata = _insert_values_as_list(metadata, "language", self.language) + metadata = _insert_value(metadata, "license", self.license) + if self.finetuned_from is not None and isinstance(self.finetuned_from, str) and len(self.finetuned_from) > 0: + metadata = _insert_value(metadata, "base_model", self.finetuned_from) + metadata = _insert_values_as_list(metadata, "tags", self.tags) + metadata = _insert_values_as_list(metadata, "datasets", self.dataset_tags) + metadata = _insert_values_as_list(metadata, "metrics", list(metric_mapping.keys())) + metadata["model-index"] = self.create_model_index(metric_mapping) + + return metadata + + def to_model_card(self): + model_card = "" + + metadata = yaml.dump(self.create_metadata(), sort_keys=False) + if len(metadata) > 0: + model_card = f"---\n{metadata}---\n" + + # Now the model card for realsies. + if self.source == "trainer": + model_card += AUTOGENERATED_TRAINER_COMMENT + + model_card += f"\n# {self.model_name}\n\n" + + if self.finetuned_from is None: + model_card += "This model was trained from scratch on " + else: + model_card += ( + "This model is a fine-tuned version of" + f" [{self.finetuned_from}](https://huggingface.co/{self.finetuned_from}) on " + ) + + if self.dataset is None or (isinstance(self.dataset, list) and len(self.dataset) == 0): + model_card += "an unknown dataset." + else: + if isinstance(self.dataset, str): + model_card += f"the {self.dataset} dataset." + elif isinstance(self.dataset, (tuple, list)) and len(self.dataset) == 1: + model_card += f"the {self.dataset[0]} dataset." + else: + model_card += ( + ", ".join([f"the {ds}" for ds in self.dataset[:-1]]) + f" and the {self.dataset[-1]} datasets." + ) + + if self.eval_results is not None: + model_card += "\nIt achieves the following results on the evaluation set:\n" + model_card += "\n".join([f"- {name}: {_maybe_round(value)}" for name, value in self.eval_results.items()]) + model_card += "\n" + + model_card += "\n## Model description\n\nMore information needed\n" + model_card += "\n## Intended uses & limitations\n\nMore information needed\n" + model_card += "\n## Training and evaluation data\n\nMore information needed\n" + + model_card += "\n## Training procedure\n" + model_card += "\n### Training hyperparameters\n" + if self.hyperparameters is not None: + model_card += "\nThe following hyperparameters were used during training:\n" + model_card += "\n".join([f"- {name}: {value}" for name, value in self.hyperparameters.items()]) + model_card += "\n" + else: + model_card += "\nMore information needed\n" + + if self.eval_lines is not None: + model_card += "\n### Training results\n\n" + model_card += make_markdown_table(self.eval_lines) + model_card += "\n" + + model_card += "\n### Framework versions\n\n" + model_card += f"- Transformers {__version__}\n" + + if self.source == "trainer" and is_torch_available(): + import torch + + model_card += f"- Pytorch {torch.__version__}\n" + if is_datasets_available(): + import datasets + + model_card += f"- Datasets {datasets.__version__}\n" + if is_tokenizers_available(): + import tokenizers + + model_card += f"- Tokenizers {tokenizers.__version__}\n" + + return model_card + + @classmethod + def from_trainer( + cls, + trainer, + language=None, + license=None, + tags=None, + model_name=None, + finetuned_from=None, + tasks=None, + dataset_tags=None, + dataset_metadata=None, + dataset=None, + dataset_args=None, + ): + # Infer default from dataset + one_dataset = trainer.eval_dataset if trainer.eval_dataset is not None else trainer.train_dataset + if is_hf_dataset(one_dataset) and (dataset_tags is None or dataset_args is None or dataset_metadata is None): + default_tag = one_dataset.builder_name + # Those are not real datasets from the Hub so we exclude them. + if default_tag not in ["csv", "json", "pandas", "parquet", "text"]: + if dataset_metadata is None: + dataset_metadata = [{"config": one_dataset.config_name, "split": str(one_dataset.split)}] + if dataset_tags is None: + dataset_tags = [default_tag] + if dataset_args is None: + dataset_args = [one_dataset.config_name] + + if dataset is None and dataset_tags is not None: + dataset = dataset_tags + + # Infer default finetuned_from + if ( + finetuned_from is None + and hasattr(trainer.model.config, "_name_or_path") + and not os.path.isdir(trainer.model.config._name_or_path) + ): + finetuned_from = trainer.model.config._name_or_path + + # Infer default task tag: + if tasks is None: + model_class_name = trainer.model.__class__.__name__ + for task, mapping in TASK_MAPPING.items(): + if model_class_name in _get_mapping_values(mapping): + tasks = task + + if model_name is None: + model_name = Path(trainer.args.output_dir).name + if len(model_name) == 0: + model_name = finetuned_from + + # Add `generated_from_trainer` to the tags + if tags is None: + tags = ["generated_from_trainer"] + elif isinstance(tags, str) and tags != "generated_from_trainer": + tags = [tags, "generated_from_trainer"] + elif "generated_from_trainer" not in tags: + tags.append("generated_from_trainer") + + _, eval_lines, eval_results = parse_log_history(trainer.state.log_history) + hyperparameters = extract_hyperparameters_from_trainer(trainer) + + return cls( + language=language, + license=license, + tags=tags, + model_name=model_name, + finetuned_from=finetuned_from, + tasks=tasks, + dataset=dataset, + dataset_tags=dataset_tags, + dataset_args=dataset_args, + dataset_metadata=dataset_metadata, + eval_results=eval_results, + eval_lines=eval_lines, + hyperparameters=hyperparameters, + ) + + +def parse_log_history(log_history): + """ + Parse the `log_history` of a Trainer to get the intermediate and final evaluation results. + """ + idx = 0 + while idx < len(log_history) and "train_runtime" not in log_history[idx]: + idx += 1 + + # If there are no training logs + if idx == len(log_history): + idx -= 1 + while idx >= 0 and "eval_loss" not in log_history[idx]: + idx -= 1 + + if idx >= 0: + return None, None, log_history[idx] + else: + return None, None, None + + # From now one we can assume we have training logs: + train_log = log_history[idx] + lines = [] + training_loss = "No log" + for i in range(idx): + if "loss" in log_history[i]: + training_loss = log_history[i]["loss"] + if "eval_loss" in log_history[i]: + metrics = log_history[i].copy() + _ = metrics.pop("total_flos", None) + epoch = metrics.pop("epoch", None) + step = metrics.pop("step", None) + _ = metrics.pop("eval_runtime", None) + _ = metrics.pop("eval_samples_per_second", None) + _ = metrics.pop("eval_steps_per_second", None) + values = {"Training Loss": training_loss, "Epoch": epoch, "Step": step} + for k, v in metrics.items(): + if k == "eval_loss": + values["Validation Loss"] = v + else: + splits = k.split("_") + name = " ".join([part.capitalize() for part in splits[1:]]) + values[name] = v + lines.append(values) + + idx = len(log_history) - 1 + while idx >= 0 and "eval_loss" not in log_history[idx]: + idx -= 1 + + if idx > 0: + eval_results = {} + for key, value in log_history[idx].items(): + key = key.removeprefix("eval_") + if key not in ["runtime", "samples_per_second", "steps_per_second", "epoch", "step"]: + camel_cased_key = " ".join([part.capitalize() for part in key.split("_")]) + eval_results[camel_cased_key] = value + return train_log, lines, eval_results + else: + return train_log, lines, None + + +def _maybe_round(v, decimals=4): + if isinstance(v, float) and len(str(v).split(".")) > 1 and len(str(v).split(".")[1]) > decimals: + return f"{v:.{decimals}f}" + return str(v) + + +def _regular_table_line(values, col_widths): + values_with_space = [f"| {v}" + " " * (w - len(v) + 1) for v, w in zip(values, col_widths)] + return "".join(values_with_space) + "|\n" + + +def _second_table_line(col_widths): + values = ["|:" + "-" * w + ":" for w in col_widths] + return "".join(values) + "|\n" + + +def make_markdown_table(lines): + """ + Create a nice Markdown table from the results in `lines`. + """ + if lines is None or len(lines) == 0: + return "" + col_widths = {key: len(str(key)) for key in lines[0]} + for line in lines: + for key, value in line.items(): + if col_widths[key] < len(_maybe_round(value)): + col_widths[key] = len(_maybe_round(value)) + + table = _regular_table_line(list(lines[0].keys()), list(col_widths.values())) + table += _second_table_line(list(col_widths.values())) + for line in lines: + table += _regular_table_line([_maybe_round(v) for v in line.values()], list(col_widths.values())) + return table + + +_TRAINING_ARGS_KEYS = [ + "learning_rate", + "train_batch_size", + "eval_batch_size", + "seed", +] + + +def extract_hyperparameters_from_trainer(trainer): + hyperparameters = {k: getattr(trainer.args, k) for k in _TRAINING_ARGS_KEYS} + + if trainer.args.parallel_mode not in [ParallelMode.NOT_PARALLEL, ParallelMode.NOT_DISTRIBUTED]: + hyperparameters["distributed_type"] = ( + "multi-GPU" if trainer.args.parallel_mode == ParallelMode.DISTRIBUTED else trainer.args.parallel_mode.value + ) + if trainer.args.world_size > 1: + hyperparameters["num_devices"] = trainer.args.world_size + if trainer.args.gradient_accumulation_steps > 1: + hyperparameters["gradient_accumulation_steps"] = trainer.args.gradient_accumulation_steps + + total_train_batch_size = ( + trainer.args.train_batch_size * trainer.args.world_size * trainer.args.gradient_accumulation_steps + ) + if total_train_batch_size != hyperparameters["train_batch_size"]: + hyperparameters["total_train_batch_size"] = total_train_batch_size + total_eval_batch_size = trainer.args.eval_batch_size * trainer.args.world_size + if total_eval_batch_size != hyperparameters["eval_batch_size"]: + hyperparameters["total_eval_batch_size"] = total_eval_batch_size + + if trainer.args.optim: + optimizer_name = trainer.args.optim + optimizer_args = trainer.args.optim_args if trainer.args.optim_args else "No additional optimizer arguments" + + if "adam" in optimizer_name.lower(): + hyperparameters["optimizer"] = ( + f"Use {optimizer_name} with betas=({trainer.args.adam_beta1},{trainer.args.adam_beta2}) and" + f" epsilon={trainer.args.adam_epsilon} and optimizer_args={optimizer_args}" + ) + else: + hyperparameters["optimizer"] = f"Use {optimizer_name} and the args are:\n{optimizer_args}" + + hyperparameters["lr_scheduler_type"] = trainer.args.lr_scheduler_type.value + if trainer.args.warmup_steps != 0.0: + hyperparameters["lr_scheduler_warmup_steps"] = trainer.args.warmup_steps + if trainer.args.max_steps != -1: + hyperparameters["training_steps"] = trainer.args.max_steps + else: + hyperparameters["num_epochs"] = trainer.args.num_train_epochs + + if trainer.args.fp16: + hyperparameters["mixed_precision_training"] = "Native AMP" + + if trainer.args.label_smoothing_factor != 0.0: + hyperparameters["label_smoothing_factor"] = trainer.args.label_smoothing_factor + + return hyperparameters diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_attn_mask_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_attn_mask_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..08288876b38f240a63aea4ef77add03c6e9bb19f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_attn_mask_utils.py @@ -0,0 +1,506 @@ +# Copyright 2023 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +IMPORTANT NOTICE: Every class and function in this file is deprecated in favor of using the much more general +`masking_utils.py` primitives. New code should not rely on it, it is only kept for backward compatibility for now, +and will be removed in the future. +""" + +from dataclasses import dataclass +from typing import Union + +import torch + +from .utils import logging +from .utils.import_utils import is_torchdynamo_compiling, is_tracing + + +logger = logging.get_logger(__name__) + + +DEPRECATION_MESSAGE = ( + "The attention mask API under `transformers.modeling_attn_mask_utils` (`AttentionMaskConverter`) " + "is deprecated and will be removed in Transformers v5.10. Please use the new API in `transformers.masking_utils`." +) + + +@dataclass +class AttentionMaskConverter: + """ + A utility attention mask class that allows one to: + - Create a causal 4d mask + - Create a causal 4d mask with slided window + - Convert a 2d attention mask (batch_size, query_length) to a 4d attention mask (batch_size, 1, query_length, + key_value_length) that can be multiplied with attention scores + + Examples: + + ```python + >>> import torch + >>> from transformers.modeling_attn_mask_utils import AttentionMaskConverter + + >>> converter = AttentionMaskConverter(True) + >>> converter.to_4d(torch.tensor([[0, 0, 0, 1, 1]]), 5, key_value_length=5, dtype=torch.float32) + tensor([[[[-3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38], + [-3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38], + [-3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38], + [-3.4028e+38, -3.4028e+38, -3.4028e+38, 0.0000e+00, -3.4028e+38], + [-3.4028e+38, -3.4028e+38, -3.4028e+38, 0.0000e+00, 0.0000e+00]]]]) + ``` + + Parameters: + is_causal (`bool`): + Whether the attention mask should be a uni-directional (causal) or bi-directional mask. + + sliding_window (`int`, *optional*): + Optionally, the sliding window masks can be created if `sliding_window` is defined to a positive integer. + """ + + is_causal: bool + sliding_window: int + + def __init__(self, is_causal: bool, sliding_window: int | None = None): + logger.warning_once(DEPRECATION_MESSAGE, FutureWarning) + + self.is_causal = is_causal + self.sliding_window = sliding_window + + if self.sliding_window is not None and self.sliding_window <= 0: + raise ValueError( + f"Make sure that when passing `sliding_window` that its value is a strictly positive integer, not `{self.sliding_window}`" + ) + + def to_causal_4d( + self, + batch_size: int, + query_length: int, + key_value_length: int, + dtype: torch.dtype, + device: Union[torch.device, "str"] = "cpu", + ) -> torch.Tensor | None: + """ + Creates a causal 4D mask of (bsz, head_dim=1, query_length, key_value_length) shape and adds large negative + bias to upper right hand triangular matrix (causal mask). + """ + if not self.is_causal: + raise ValueError(f"Please use `to_causal_4d` only if {self.__class__} has `is_causal` set to True.") + + # If shape is not cached, create a new causal mask and cache it + input_shape = (batch_size, query_length) + past_key_values_length = key_value_length - query_length + + # create causal mask + # [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len] + causal_4d_mask = None + if input_shape[-1] > 1 or self.sliding_window is not None: + causal_4d_mask = self._make_causal_mask( + input_shape, + dtype, + device=device, + past_key_values_length=past_key_values_length, + sliding_window=self.sliding_window, + ) + + return causal_4d_mask + + def to_4d( + self, + attention_mask_2d: torch.Tensor, + query_length: int, + dtype: torch.dtype, + key_value_length: int | None = None, + ) -> torch.Tensor: + """ + Converts 2D attention mask to 4D attention mask by expanding mask to (bsz, head_dim=1, query_length, + key_value_length) shape and by adding a large negative bias to not-attended positions. If attention_mask is + causal, a causal mask will be added. + """ + input_shape = (attention_mask_2d.shape[0], query_length) + + # create causal mask + # [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len] + causal_4d_mask = None + if (input_shape[-1] > 1 or self.sliding_window is not None) and self.is_causal: + if key_value_length is None: + raise ValueError( + "This attention mask converter is causal. Make sure to pass `key_value_length` to correctly create a causal mask." + ) + + past_key_values_length = key_value_length - query_length + causal_4d_mask = self._make_causal_mask( + input_shape, + dtype, + device=attention_mask_2d.device, + past_key_values_length=past_key_values_length, + sliding_window=self.sliding_window, + ) + elif self.sliding_window is not None: + raise NotImplementedError("Sliding window is currently only implemented for causal masking") + + # [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len] + expanded_attn_mask = self._expand_mask(attention_mask_2d, dtype, tgt_len=input_shape[-1]).to( + attention_mask_2d.device + ) + + if causal_4d_mask is not None: + expanded_attn_mask = causal_4d_mask.masked_fill(expanded_attn_mask.bool(), torch.finfo(dtype).min) + + # expanded_attn_mask + causal_4d_mask can cause some overflow + expanded_4d_mask = expanded_attn_mask + + return expanded_4d_mask + + @staticmethod + def _make_causal_mask( + input_ids_shape: torch.Size, + dtype: torch.dtype, + device: torch.device, + past_key_values_length: int = 0, + sliding_window: int | None = None, + ): + """ + Make causal mask used for bi-directional self-attention. + """ + logger.warning_once(DEPRECATION_MESSAGE, FutureWarning) + + bsz, tgt_len = input_ids_shape + mask = torch.full((tgt_len, tgt_len), torch.finfo(dtype).min, device=device) + mask_cond = torch.arange(mask.size(-1), device=device) + mask.masked_fill_(mask_cond < (mask_cond + 1).view(mask.size(-1), 1), 0) + + mask = mask.to(dtype) + + if past_key_values_length > 0: + mask = torch.cat([torch.zeros(tgt_len, past_key_values_length, dtype=dtype, device=device), mask], dim=-1) + + # add lower triangular sliding window mask if necessary + if sliding_window is not None: + diagonal = past_key_values_length - sliding_window - 1 + + context_mask = torch.tril(torch.ones_like(mask, dtype=torch.bool), diagonal=diagonal) + # Recent changes in PyTorch prevent mutations on tensors converted with aten::_to_copy + # See https://github.com/pytorch/pytorch/issues/127571 + if is_torchdynamo_compiling(): + mask = mask.clone() + mask.masked_fill_(context_mask, torch.finfo(dtype).min) + + return mask[None, None, :, :].expand(bsz, 1, tgt_len, tgt_len + past_key_values_length) + + @staticmethod + def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: int | None = None): + """ + Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`. + """ + logger.warning_once(DEPRECATION_MESSAGE, FutureWarning) + + bsz, src_len = mask.size() + tgt_len = tgt_len if tgt_len is not None else src_len + + expanded_mask = mask[:, None, None, :].expand(bsz, 1, tgt_len, src_len).to(dtype) + + inverted_mask = torch.tensor(1.0, dtype=dtype) - expanded_mask + + return inverted_mask.masked_fill(inverted_mask.to(torch.bool), torch.finfo(dtype).min) + + @staticmethod + def _unmask_unattended( + expanded_mask: torch.FloatTensor, + min_dtype: float, + ): + # fmt: off + """ + Attend to all tokens in masked rows from the expanded attention mask, for example the relevant first rows when + using left padding. This is required by F.scaled_dot_product_attention memory-efficient attention path. + Details: https://github.com/pytorch/pytorch/issues/110213 + + `expanded_mask` is [bsz, num_masks, tgt_seq_len, src_seq_len] or [bsz, tgt_seq_len, src_seq_len]. + `attention_mask` is [bsz, src_seq_len]. + + The dimension num_masks of `expanded_mask` is most often 1, but it can also be the number of heads in the case of alibi attention bias. + + For example, if `expanded_mask` is (e.g. here left-padding case) + ``` + [[[[0, 0, 0], + [0, 0, 0], + [0, 0, 1]]], + [[[1, 0, 0], + [1, 1, 0], + [1, 1, 1]]], + [[[0, 0, 0], + [0, 1, 0], + [0, 1, 1]]]] + ``` + then the modified `expanded_mask` will be + ``` + [[[[1, 1, 1], <-- modified + [1, 1, 1], <-- modified + [0, 0, 1]]], + [[[1, 0, 0], + [1, 1, 0], + [1, 1, 1]]], + [[[1, 1, 1], <-- modified + [0, 1, 0], + [0, 1, 1]]]] + ``` + """ + logger.warning_once(DEPRECATION_MESSAGE, FutureWarning) + + # fmt: on + if expanded_mask.dtype == torch.bool: + raise ValueError( + "AttentionMaskConverter._unmask_unattended expects a float `expanded_mask`, got a BoolTensor." + ) + + return expanded_mask.mul(~torch.all(expanded_mask == min_dtype, dim=-1, keepdim=True)) + + @staticmethod + def _ignore_causal_mask_sdpa( + attention_mask: torch.Tensor | None, + inputs_embeds: torch.Tensor, + past_key_values_length: int, + sliding_window: int | None = None, + is_training: bool = False, + ) -> bool: + """ + Detects whether the optional user-specified attention_mask & the automatically created causal mask can be + ignored in case PyTorch's SDPA is used, rather relying on SDPA's `is_causal` argument. + + In case no token is masked in the `attention_mask` argument, if `query_length == 1` or + `key_value_length == query_length`, we rather rely on SDPA `is_causal` argument to use causal/non-causal masks, + allowing to dispatch to the flash attention kernel (that can otherwise not be used if a custom `attn_mask` is + passed). + """ + logger.warning_once(DEPRECATION_MESSAGE, FutureWarning) + + _, query_length = inputs_embeds.shape[0], inputs_embeds.shape[1] + key_value_length = query_length + past_key_values_length + + is_tracing_ = is_tracing(inputs_embeds) + + ignore_causal_mask = False + + if attention_mask is None: + # TODO: When tracing with TorchDynamo with fullgraph=True, the model is recompiled depending on the input + # shape, thus SDPA's `is_causal` argument is rightfully updated + # (see https://gist.github.com/fxmarty/1313f39037fc1c112508989628c57363). However, when using + # `torch.export` or `torch.onnx.dynamo_export`, we must pass an example input, and `is_causal` behavior is + # hard-coded. If a user exports a model with q_len > 1, the exported model will hard-code `is_causal=True` + # which is in general wrong (see https://github.com/pytorch/pytorch/issues/108108). + # Thus, we only set `ignore_causal_mask = True` if the model is set to training. + # + # Besides, jit.trace can not handle the `q_len > 1` condition for `is_causal` + # ("TypeError: scaled_dot_product_attention(): argument 'is_causal' must be bool, not Tensor"). + if ( + (is_training or not is_tracing_) + and (query_length == 1 or key_value_length == query_length) + and (sliding_window is None or key_value_length < sliding_window) + ): + ignore_causal_mask = True + elif sliding_window is None or key_value_length < sliding_window: + if len(attention_mask.shape) == 4: + return False + elif not is_tracing_ and torch.all(attention_mask == 1): + if query_length == 1 or key_value_length == query_length: + # For query_length == 1, causal attention and bi-directional attention are the same. + ignore_causal_mask = True + + # Unfortunately, for query_length > 1 and key_value_length != query_length, we cannot generally ignore + # the attention mask, as SDPA causal mask generation may be wrong. We will set `is_causal=False` in + # SDPA and rely on Transformers attention_mask instead, hence not setting it to None here. + # Reference: https://github.com/pytorch/pytorch/issues/108108 + # TODO: maybe revisit this with https://github.com/pytorch/pytorch/pull/114823 in PyTorch 2.3. + + return ignore_causal_mask + + +def _prepare_4d_causal_attention_mask( + attention_mask: torch.Tensor | None, + input_shape: torch.Size | tuple | list, + inputs_embeds: torch.Tensor, + past_key_values_length: int, + sliding_window: int | None = None, +): + """ + Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape + `(batch_size, key_value_length)` + + Args: + attention_mask (`torch.Tensor` or `None`): + A 2D attention mask of shape `(batch_size, key_value_length)` + input_shape (`tuple(int)` or `list(int)` or `torch.Size`): + The input shape should be a tuple that defines `(batch_size, query_length)`. + inputs_embeds (`torch.Tensor`): + The embedded inputs as a torch Tensor. + past_key_values_length (`int`): + The length of the key value cache. + sliding_window (`int`, *optional*): + If the model uses windowed attention, a sliding window should be passed. + """ + attn_mask_converter = AttentionMaskConverter(is_causal=True, sliding_window=sliding_window) + + key_value_length = input_shape[-1] + past_key_values_length + + # 4d mask is passed through the layers + if attention_mask is not None and len(attention_mask.shape) == 2: + attention_mask = attn_mask_converter.to_4d( + attention_mask, input_shape[-1], key_value_length=key_value_length, dtype=inputs_embeds.dtype + ) + elif attention_mask is not None and len(attention_mask.shape) == 4: + expected_shape = (input_shape[0], 1, input_shape[1], key_value_length) + if tuple(attention_mask.shape) != expected_shape: + raise ValueError( + f"Incorrect 4D attention_mask shape: {tuple(attention_mask.shape)}; expected: {expected_shape}." + ) + else: + # if the 4D mask has correct shape - invert it and fill with negative infinity + inverted_mask = 1.0 - attention_mask + attention_mask = inverted_mask.masked_fill( + inverted_mask.to(torch.bool), torch.finfo(inputs_embeds.dtype).min + ) + else: + attention_mask = attn_mask_converter.to_causal_4d( + input_shape[0], input_shape[-1], key_value_length, dtype=inputs_embeds.dtype, device=inputs_embeds.device + ) + + return attention_mask + + +# Adapted from _prepare_4d_causal_attention_mask +def _prepare_4d_causal_attention_mask_for_sdpa( + attention_mask: torch.Tensor | None, + input_shape: torch.Size | tuple | list, + inputs_embeds: torch.Tensor, + past_key_values_length: int, + sliding_window: int | None = None, +): + """ + Prepares the correct `attn_mask` argument to be used by `torch.nn.functional.scaled_dot_product_attention`. + + In case no token is masked in the `attention_mask` argument, we simply set it to `None` for the cases `query_length == 1` and + `key_value_length == query_length`, and rely instead on SDPA `is_causal` argument to use causal/non-causal masks, + allowing to dispatch to the flash attention kernel (that can otherwise not be used if a custom `attn_mask` is passed). + """ + attn_mask_converter = AttentionMaskConverter(is_causal=True, sliding_window=sliding_window) + + key_value_length = input_shape[-1] + past_key_values_length + + # torch.jit.trace, symbolic_trace and torchdynamo with fullgraph=True are unable to capture the controlflow `is_causal=attention_mask is None and q_len > 1` + # used as an SDPA argument. We keep compatibility with these tracing tools by always using SDPA's `attn_mask` argument in case we are tracing. + # TODO: For dynamo, rather use a check on fullgraph=True once this is possible (https://github.com/pytorch/pytorch/pull/120400). + is_tracing_ = is_tracing(inputs_embeds) + + ignore_causal_mask = AttentionMaskConverter._ignore_causal_mask_sdpa( + attention_mask=attention_mask, + inputs_embeds=inputs_embeds, + past_key_values_length=past_key_values_length, + sliding_window=sliding_window, + ) + + if ignore_causal_mask: + expanded_4d_mask = None + elif attention_mask is None: + expanded_4d_mask = attn_mask_converter.to_causal_4d( + input_shape[0], input_shape[-1], key_value_length, dtype=inputs_embeds.dtype, device=inputs_embeds.device + ) + else: + if attention_mask.dim() == 4: + expanded_4d_mask = attention_mask + else: + expanded_4d_mask = attn_mask_converter.to_4d( + attention_mask, + input_shape[-1], + dtype=inputs_embeds.dtype, + key_value_length=key_value_length, + ) + + # Attend to all tokens in masked rows from the causal_mask, for example the relevant first rows when + # using left padding. This is required by F.scaled_dot_product_attention memory-efficient attention path. + # Details: https://github.com/pytorch/pytorch/issues/110213 + if not is_tracing_ and expanded_4d_mask.device.type in ["cuda", "xpu"]: + expanded_4d_mask = AttentionMaskConverter._unmask_unattended( + expanded_4d_mask, min_dtype=torch.finfo(inputs_embeds.dtype).min + ) + + return expanded_4d_mask + + +def _prepare_4d_attention_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: int | None = None): + """ + Creates a non-causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape + `(batch_size, key_value_length)` + + Args: + mask (`torch.Tensor`): + A 2D attention mask of shape `(batch_size, key_value_length)` + dtype (`torch.dtype`): + The torch dtype the created mask shall have. + tgt_len (`int`): + The target length or query length the created mask shall have. + """ + return AttentionMaskConverter._expand_mask(mask=mask, dtype=dtype, tgt_len=tgt_len) + + +def _prepare_4d_attention_mask_for_sdpa(mask: torch.Tensor, dtype: torch.dtype, tgt_len: int | None = None): + """ + Creates a non-causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape + `(batch_size, key_value_length)` + + Args: + mask (`torch.Tensor`): + A 2D attention mask of shape `(batch_size, key_value_length)` + dtype (`torch.dtype`): + The torch dtype the created mask shall have. + tgt_len (`int`): + The target length or query length the created mask shall have. + """ + logger.warning_once(DEPRECATION_MESSAGE, FutureWarning) + + _, key_value_length = mask.shape + tgt_len = tgt_len if tgt_len is not None else key_value_length + + # torch.jit.trace, symbolic_trace and torchdynamo with fullgraph=True are unable to capture data-dependent controlflows. + if not is_tracing(mask) and torch.all(mask == 1): + return None + else: + return AttentionMaskConverter._expand_mask(mask=mask, dtype=dtype, tgt_len=tgt_len) + + +def _create_4d_causal_attention_mask( + input_shape: torch.Size | tuple | list, + dtype: torch.dtype, + device: torch.device, + past_key_values_length: int = 0, + sliding_window: int | None = None, +) -> torch.Tensor | None: + """ + Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` + + Args: + input_shape (`tuple(int)` or `list(int)` or `torch.Size`): + The input shape should be a tuple that defines `(batch_size, query_length)`. + dtype (`torch.dtype`): + The torch dtype the created mask shall have. + device (`int`): + The torch device the created mask shall have. + sliding_window (`int`, *optional*): + If the model uses windowed attention, a sliding window should be passed. + """ + attn_mask_converter = AttentionMaskConverter(is_causal=True, sliding_window=sliding_window) + + key_value_length = past_key_values_length + input_shape[-1] + attention_mask = attn_mask_converter.to_causal_4d( + input_shape[0], input_shape[-1], key_value_length, dtype=dtype, device=device + ) + + return attention_mask diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_flash_attention_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_flash_attention_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..d937e3703cb23e4b5430a21fb196ead443b6ecf0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_flash_attention_utils.py @@ -0,0 +1,705 @@ +# Copyright 2025 The Fairseq Authors and the HuggingFace Inc. team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import inspect +import os +from collections.abc import Callable +from functools import partial +from typing import TypedDict + +import torch +import torch.nn.functional as F + +from .utils import ( + is_flash_attn_2_available, + is_flash_attn_3_available, + is_flash_attn_greater_or_equal_2_10, + is_torch_npu_available, + is_torch_xpu_available, + logging, +) + + +logger = logging.get_logger(__name__) + + +# TODO Deprecate when all models have the attention interface +def flash_attn_supports_top_left_mask(): + if is_flash_attn_3_available(): + return False + if is_flash_attn_2_available(): + return not is_flash_attn_greater_or_equal_2_10() + + from .integrations.npu_flash_attention import is_npu_fa2_top_left_aligned_causal_mask + + return is_npu_fa2_top_left_aligned_causal_mask() + + +# TODO Deprecate when all models have the attention interface +def is_flash_attn_available(): + return ( + is_flash_attn_3_available() + or is_flash_attn_2_available() + or is_torch_npu_available() + or is_torch_xpu_available() + ) + + +# `globals()` is not compatible with dynamo, hence we have do define them in global scope ourselves +_loaded_implementation = None +_flash_fn = None +_flash_varlen_fn = None +_pad_fn = None +_unpad_fn = None + +# function that processes kwargs, generalized to handle any supported kwarg within the function +_process_flash_kwargs_fn = None +# exceptions where hf API doesn't match the original flash attention API +_hf_api_to_flash_mapping = { + "dropout": "dropout_p", + "sliding_window": "window_size", +} + + +def _lazy_imports(implementation: str | None, attention_wrapper: Callable | None = None): + """ + Lazy loads the respective flash attention implementations. + + Return: + flash_attn_func: The base flash attention function. + flash_attn_varlen_func: The flash attention function supporting variable sequence lengths, + e.g. for padding-free training. + pad_input: The function to pad inputs into one sequence and returning the respective kwargs. + unpad_input: The function to unpad outputs based on the kwargs (from pad_input). + """ + is_fa2 = is_flash_attn_2_available() + is_fa3 = is_flash_attn_3_available() + + pad_input, unpad_input = _pad_input, _unpad_input + + is_paged = implementation.startswith("paged|") + implementation = implementation.split("|")[1] if is_paged else implementation + + if (implementation == "flash_attention_2" and is_fa2) or (implementation is None and is_fa2 and not is_fa3): + from flash_attn import flash_attn_func, flash_attn_varlen_func + from flash_attn.bert_padding import pad_input, unpad_input + elif is_torch_npu_available(): + # Package `flash-attn` is unavailable on Ascend NPU, which will cause ImportError + # Flash-Attention2 related apis for Ascend NPU must be imported from `.integrations.npu_flash_attention` module + from .integrations.npu_flash_attention import npu_flash_attn_func as flash_attn_func + from .integrations.npu_flash_attention import npu_flash_attn_varlen_func as flash_attn_varlen_func + else: + if implementation == "flash_attention_3" or (implementation is None and is_fa3): + from flash_attn_interface import flash_attn_func, flash_attn_varlen_func + # Kernels fallback + else: + from .integrations.hub_kernels import load_and_register_attn_kernel + + # We want to explicitly register the name with `paged|` if found + kernel_implementation = f"paged|{implementation}" if is_paged else implementation + kernel = load_and_register_attn_kernel(kernel_implementation, attention_wrapper) + + flash_attn_func = getattr(kernel, "flash_attn_func", None) + flash_attn_varlen_func = getattr(kernel, "flash_attn_varlen_func", None) + if flash_attn_varlen_func is None: + raise ValueError( + f"Could not find the currently requested flash attention implementation at `{implementation}`." + "Make sure that you request a valid kernel from the hub, e.g. `kernels-community/flash-attn2`." + ) + if flash_attn_func is None: + logger.warning( + f"The loaded flash attention implementation at `{implementation}` only supports varlen, i.e. " + "it can only be used with continuous batching and does not support the full functionality for " + "the base transformers generation methods." + ) + + return flash_attn_func, flash_attn_varlen_func, pad_input, unpad_input + + +def _lazy_define_process_function(flash_function): + """ + Depending on the version and kernel some features are not supported. Due to limitations in + `torch.compile`, we opt to statically type which (optional) kwarg parameters are supported + within `_process_flash_attention_kwargs`. + + NOTE: While all supported kwargs are marked as `True`, everything else is marked as `False`. + This might be confusing for kwargs that we use in any case, e.g. `is_causal`. + """ + + flash_parameters = inspect.signature(flash_function).parameters + process_parameters = inspect.signature(_process_flash_attention_kwargs).parameters + + supports_mapping = {} + for param in process_parameters: + fa_param = _hf_api_to_flash_mapping.get(param, param) + supports_mapping[fa_param] = fa_param in flash_parameters + + return partial(_process_flash_attention_kwargs, supports_mapping=supports_mapping) + + +def lazy_import_flash_attention(implementation: str | None, attention_wrapper: Callable | None = None): + """ + Lazily import flash attention and return the respective functions + flags. + + NOTE: For fullgraph, this needs to be called before compile, while no fullgraph can + work without preloading. See `load_and_register_attn_kernel` in `integrations.hub_kernels`. + """ + global _loaded_implementation + if implementation is None and _loaded_implementation is None: + raise ValueError("Could not find any flash attn implementation based on your environment.") + + global _flash_fn, _flash_varlen_fn, _pad_fn, _unpad_fn, _process_flash_kwargs_fn + if implementation is not None and _loaded_implementation != implementation: + _loaded_implementation = implementation + + _flash_fn, _flash_varlen_fn, _pad_fn, _unpad_fn = _lazy_imports(implementation, attention_wrapper) + _process_flash_kwargs_fn = _lazy_define_process_function(_flash_varlen_fn) + + return (_flash_fn, _flash_varlen_fn, _pad_fn, _unpad_fn), _process_flash_kwargs_fn + + +def lazy_import_paged_flash_attention(implementation: str | None): + """ + Same as `lazy_import_flash_attention` but explicitly wrapping it with the paged implementation. + """ + from .integrations.flash_paged import paged_attention_forward + + (_, flash_attn_varlen_func, _, _), _ = lazy_import_flash_attention( + implementation, attention_wrapper=paged_attention_forward + ) + return flash_attn_varlen_func + + +def _index_first_axis(tensor, indices): + """ + A local implementation of the PyTorch indexing operation `tensor[indices]` on the first axis, + after flattening the first two dimensions of the tensor. This is functionally equivalent to + FA2's `index_first_axis` and replaces the need to import it. + """ + # The input tensor is expected to be of shape (batch, seq_len, ...). We flatten the first + # two dimensions to get (total_tokens, ...) before indexing. + reshaped_tensor = tensor.reshape(-1, *tensor.shape[2:]) + return reshaped_tensor[indices] + + +def _unpad_input(hidden_states, attention_mask, unused_mask=None): + """ + unpad_input function for flash attention variants that do not have them within their pkg themselves, e.g. fa3. + + Arguments: + hidden_states: (batch, seqlen, ...) + attention_mask: (batch, seqlen), bool / int, 1 means valid and 0 means not valid. + unused_mask: (batch, seqlen), bool / int, 1 means the element is allocated but unused. + + Return: + hidden_states: (total_nnz, ...), where total_nnz = number of tokens selected in attention_mask + unused_mask. + indices: (total_nnz), the indices of masked tokens from the flattened input sequence. + cu_seqlens: (batch + 1), the cumulative sequence lengths, used to index into hidden_states. + max_seqlen_in_batch: int + seqused: (batch), returns the number of tokens selected in attention_mask + unused_mask. + """ + all_masks = (attention_mask + unused_mask) if unused_mask is not None else attention_mask + seqlens_in_batch = all_masks.sum(dim=-1, dtype=torch.int32) + used_seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32) + indices = torch.nonzero(all_masks.flatten(), as_tuple=False).flatten() + max_seqlen_in_batch = seqlens_in_batch.max().item() + cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.int32), (1, 0)) + + return ( + _index_first_axis(hidden_states, indices), + indices, + cu_seqlens, + max_seqlen_in_batch, + used_seqlens_in_batch, + ) + + +def _pad_input(hidden_states, indices, batch, seqlen): + """ + pad_input function for flash attention variants that do not have them within their pkg themselves, e.g. fa3. + + Arguments: + hidden_states: (total_nnz, ...), where total_nnz = number of tokens in selected in attention_mask. + indices: (total_nnz), the indices that represent the non-masked tokens of the original padded input sequence. + batch: int, batch size for the padded sequence. + seqlen: int, maximum sequence length for the padded sequence. + + Return: + hidden_states: (batch, seqlen, ...) + """ + dim = hidden_states.shape[1:] + output = torch.zeros((batch * seqlen), *dim, device=hidden_states.device, dtype=hidden_states.dtype) + output[indices] = hidden_states + return output.view(batch, seqlen, *dim) + + +def _get_unpad_data(attention_mask: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor, int]: + """ + Retrieves indexing data required to repad unpadded (ragged) tensors. + + Arguments: + attention_mask (`torch.Tensor`): + Boolean or int tensor of shape (batch_size, sequence_length), 1 means valid and 0 means not valid. + + Return: + indices (`torch.Tensor`): + The indices of non-masked tokens from the flattened input sequence. + cu_seqlens (`torch.Tensor`): + The cumulative sequence lengths, used to index into ragged (unpadded) tensors. `cu_seqlens` shape is (batch_size + 1,). + max_seqlen_in_batch (`int`): + Maximum sequence length in batch. + """ + seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32) + indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten() + # NOTE: Similar to the `.item()` in prepare_fa2_from_position_ids, with torch compile, + # this might cause a graph break + max_seqlen_in_batch = seqlens_in_batch.max().item() + cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.int32), (1, 0)) + return ( + indices, + cu_seqlens, + max_seqlen_in_batch, + ) + + +def _upad_input( + query_layer: torch.Tensor, + key_layer: torch.Tensor, + value_layer: torch.Tensor, + attention_mask: torch.Tensor, + query_length: int, + unpad_input_func, +): + """ + Unpads query, key, and values tensors, using a single dimension for all tokens even though they belong to different batches. + This function is used instead of `flash_attn.bert_padding.unpad_input` in order to avoid the recomputation of the same intermediary + tensors for query, key, value tensors. + + Arguments: + query_layer (`torch.Tensor`): + Query state with padding. Shape: (batch_size, query_length, num_heads, head_dim). + key_layer (`torch.Tensor`): + Key state with padding. Shape: (batch_size, kv_seq_len, num_key_value_heads, head_dim). + value_layer (`torch.Tensor`): + Value state with padding. Shape: (batch_size, kv_seq_len, num_key_value_heads, head_dim). + attention_mask (`torch.Tensor`): + Boolean or int tensor of shape (batch_size, sequence_length), 1 means valid and 0 means not valid. + query_length (`int`): + Target length. + unpad_input_func: + The function to use for unpadding the input tensors. + + Return: + query_layer (`torch.Tensor`): + Query state without padding. Shape: (total_target_length, num_heads, head_dim). + key_layer (`torch.Tensor`): + Key state with padding. Shape: (total_source_length, num_key_value_heads, head_dim). + value_layer (`torch.Tensor`): + Value state with padding. Shape: (total_source_length, num_key_value_heads, head_dim). + indices_q (`torch.Tensor`): + The indices of non-masked tokens from the flattened input target sequence. + (cu_seqlens_q, cu_seqlens_k) (`tuple[int]`): + The cumulative sequence lengths for the target (query) and source (key, value), used to index into ragged (unpadded) tensors. `cu_seqlens` shape is (batch_size + 1,). + (max_seqlen_in_batch_q, max_seqlen_in_batch_k) (`tuple[int]`): + Maximum sequence length in batch (`max_seqlen_in_batch_q` for the target sequence i.e. query, `max_seqlen_in_batch_k` for the source sequence i.e. key/value). + """ + indices_k, cu_seqlens_k, max_seqlen_in_batch_k = _get_unpad_data(attention_mask) + + # With static caches, the k/v states may be larger than the mask -> we need to slice them to avoid generating garbage + # It's a bit of an anti-pattern, but otherwise we silently compute wrong attentions scores + if key_layer.shape[1] > (seq_len := attention_mask.shape[-1]): + key_layer, value_layer = key_layer[:, :seq_len, :, :], value_layer[:, :seq_len, :, :] + + batch_size, kv_seq_len, num_key_value_heads, head_dim = key_layer.shape + + key_layer = _index_first_axis(key_layer, indices_k) + value_layer = _index_first_axis(value_layer, indices_k) + if query_length == kv_seq_len: + query_layer = _index_first_axis(query_layer, indices_k) + cu_seqlens_q = cu_seqlens_k + max_seqlen_in_batch_q = max_seqlen_in_batch_k + indices_q = indices_k + elif query_length == 1: + max_seqlen_in_batch_q = 1 + cu_seqlens_q = torch.arange( + batch_size + 1, dtype=torch.int32, device=query_layer.device + ) # There is a memcpy here, that is very bad. + indices_q = cu_seqlens_q[:-1] + query_layer = query_layer.squeeze(1) + else: + # The -q_len: slice assumes left padding. + attention_mask = attention_mask[:, -query_length:] + query_layer, indices_q, cu_seqlens_q, max_seqlen_in_batch_q, *_ = unpad_input_func(query_layer, attention_mask) + + return ( + query_layer, + key_layer, + value_layer, + indices_q, + (cu_seqlens_q, cu_seqlens_k), + (max_seqlen_in_batch_q, max_seqlen_in_batch_k), + ) + + +def prepare_fa_kwargs_from_position_ids(position_ids): + """ + This function returns all the necessary kwargs to call `flash_attn_varlen_func` extracted from position_ids. + + Arguments: + position_ids (`torch.Tensor`): + Boolean or int tensor of shape (batch_size, sequence_length), 1 means valid and 0 means not valid. + + Return: + (cu_seqlens_q, cu_seqlens_k) (`tuple[int]`): + The cumulative sequence lengths for the target (query) and source (key, value), used to index into + ragged (unpadded) tensors. `cu_seqlens` shape is (batch_size + 1,). + (max_seqlen_in_batch_q, max_seqlen_in_batch_k) (`tuple[int]`): + Maximum sequence length in batch (`max_seqlen_in_batch_q` for the target sequence i.e. query, + `max_seqlen_in_batch_k` for the source sequence i.e. key/value). + """ + tensor_kwargs = {"dtype": torch.int32, "device": position_ids.device} + + position_ids = position_ids.reshape(-1) + indices_q = (position_ids == 0).nonzero().view(-1) + + cu_seq_lens_q = torch.cat( + ( + indices_q.to(**tensor_kwargs), + torch.tensor(position_ids.size(), **tensor_kwargs), + ) + ) + cu_seq_lens_k = cu_seq_lens_q + + # https://github.com/Dao-AILab/flash-attention/blob/2dd8078adc1d9b74e315ee99718c0dea0de8eeb6/flash_attn/flash_attn_interface.py#L1423-L1424 + # We should use cu_seq_lens instead of position_ids to get the max length since position_ids is not always increasing + # for some models (e.g. qwen2-vl). + max_length_q = cu_seq_lens_q.diff().max() + # NOTE: With torch compile, this will cause a graph break if you don't set + # `TORCHDYNAMO_CAPTURE_SCALAR_OUTPUTS=1` in the environment or call + # `torch._dynamo.config.capture_scalar_outputs = True` before doing the forward pass. + # This is a limitation of flash attention API, as the function `flash_attn_varlen_func` + # requires `max_length_q`, `max_length_k` to be passed as `int` and not `torch.Tensor`. + max_length_q = max_length_q.item() + max_length_k = max_length_q + + return (cu_seq_lens_q, cu_seq_lens_k), (max_length_q, max_length_k) + + +def _prepare_from_posids(query, key, value, position_ids): + """ + This function returns necessary arguments to call `flash_attn_varlen_func`. + All three query, key, value states will be flattened. + Cumulative lengths of each examples in the batch will be extracted from position_ids. + NOTE: ideally cumulative lengths should be prepared at the data collator stage + + Arguments: + query (`torch.Tensor`): + Query state with padding. Shape: (batch_size, query_length, num_heads, head_dim). + key (`torch.Tensor`): + Key state with padding. Shape: (batch_size, kv_seq_len, num_key_value_heads, head_dim). + value (`torch.Tensor`): + Value state with padding. Shape: (batch_size, kv_seq_len, num_key_value_heads, head_dim). + position_ids (`torch.Tensor`): + Boolean or int tensor of shape (batch_size, sequence_length), 1 means valid and 0 means not valid. + + Return: + query (`torch.Tensor`): + Query state without padding. Shape: (total_target_length, num_heads, head_dim). + key (`torch.Tensor`): + Key state with padding. Shape: (total_source_length, num_key_value_heads, head_dim). + value (`torch.Tensor`): + Value state with padding. Shape: (total_source_length, num_key_value_heads, head_dim). + (cu_seqlens_q, cu_seqlens_k) (`tuple[int]`): + The cumulative sequence lengths for the target (query) and source (key, value), used to index into ragged (unpadded) tensors. `cu_seqlens` shape is (batch_size + 1,). + (max_seqlen_in_batch_q, max_seqlen_in_batch_k) (`tuple[int]`): + Maximum sequence length in batch (`max_seqlen_in_batch_q` for the target sequence i.e. query, `max_seqlen_in_batch_k` for the source sequence i.e. key/value). + """ + query = query.contiguous().view(-1, query.size(-2), query.size(-1)) + key = key.contiguous().view(-1, key.size(-2), key.size(-1)) + value = value.contiguous().view(-1, value.size(-2), value.size(-1)) + + (cu_seq_lens_q, cu_seq_lens_k), (max_length_q, max_length_k) = prepare_fa_kwargs_from_position_ids(position_ids) + + return (query, key, value, (cu_seq_lens_q, cu_seq_lens_k), (max_length_q, max_length_k)) + + +def _is_packed_sequence(position_ids, batch_size): + """ + Check the position ids whether packed sequences are indicated or not + 1. Position ids exist + 2. Flattened sequences only are supported + 3. Compile-friendly `not (torch.diff(position_ids, dim=-1) >= 0).all()`, i.e. we have multiple increasing sequences + """ + if position_ids is None: + return False + + increasing_position_sequences = ( + torch.arange(position_ids.shape[1], device=position_ids.device) + position_ids.min() + ) + return batch_size == 1 and (increasing_position_sequences - position_ids).abs().sum().bool() + + +def fa_peft_integration_check( + q: torch.Tensor, + k: torch.Tensor, + v: torch.Tensor, + target_dtype: torch.dtype | None = None, +): + """ + PEFT usually casts the layer norms in float32 for training stability reasons + therefore the input hidden states gets silently casted in float32. Hence, we need + cast them back in float16 / bfloat16 just to be sure everything works as expected. + This might slowdown training & inference so it is recommended to not cast the LayerNorms! + """ + if target_dtype and q.dtype == torch.float32: + logger.warning_once(f"Casting fp32 inputs back to {target_dtype} for flash-attn compatibility.") + q, k, v = q.to(target_dtype), k.to(target_dtype), v.to(target_dtype) + return q, k, v + + +class FlashAttentionKwargs(TypedDict, total=False): + """ + Keyword arguments for Flash Attention with Compile. + + Attributes: + cu_seq_lens_q (`torch.LongTensor`, *optional*) + Gets cumulative sequence length for query state. + cu_seq_lens_k (`torch.LongTensor`, *optional*) + Gets cumulative sequence length for key state. + max_length_q (`int`, *optional*): + Maximum sequence length for query state. + max_length_k (`int`, *optional*): + Maximum sequence length for key state. + """ + + cu_seq_lens_q: torch.LongTensor | None + cu_seq_lens_k: torch.LongTensor | None + max_length_q: int | None + max_length_k: int | None + + +def _process_flash_attention_kwargs( + query_length: int, + key_length: int, + is_causal: bool, + dropout: float = 0.0, + softmax_scale: float | None = None, + sliding_window: int | None = None, + use_top_left_mask: bool = False, + softcap: float | None = None, + deterministic: bool | None = None, + s_aux: torch.Tensor | None = None, + supports_mapping: dict[str, bool] | None = None, + **kwargs, +): + """ + Returns a set of kwargs that are passed down to the according flash attention function based on + requested features and whether it is supported - depends on the version and kernel implementation + which is dynamically configured at `lazy_import_flash_attention`. The (un)supported features can be + inspected in `supports_mapping`, see `_lazy_define_process_function` for more details. + + Args: + query_length (`int`): + Length of the query states + key_length (`int`): + Length of the key states + is_causal (`bool`): + Whether we perform causal (decoder) attention or full attention. + dropout (`float`): + Attention dropout. + softmax_scale (`float`, *optional*): + The scaling of QK^T before applying softmax. Default to `1 / sqrt(head_dim)`. + sliding_window (`int`, *optional*): + The size of the sliding window, i.e. we look at a max of `sliding_window` tokens back. + use_top_left_mask (`bool`): + Deprecated behavior of older versions of flash attention requiring different masking. + softcap (`float`, *optional*): + Softcap for the attention logits, used e.g. in gemma2. + deterministic (`bool`, *optional*): + Determines if the deterministic option introduced in flash_attn>=2.4.1 is enabled. + s_aux (`torch.Tensor`, *optional*): + Attention sink auxiliary that adds a `bias` to the attention calculation via an additional head. + Return: + flash_kwargs (`dict`): + A dict of kwargs that are requested and supported. + """ + flash_kwargs = { + "causal": is_causal and not (use_top_left_mask and query_length == 1), + "softmax_scale": softmax_scale, + } + + if supports_mapping["dropout_p"]: + flash_kwargs["dropout_p"] = dropout + + if supports_mapping["window_size"] and sliding_window is not None and key_length > sliding_window: + # The flash attention API sets inclusive boundaries, i.e. (4, 0) would take 4 tokens to the left + # and the current token for a total size of 5. However, we usually define our window sizes by + # their total window size (when causal). Encoder models as of now seldom use SWA and when they + # do, they must align with this symmetric logic, i.e. for a total of `2*sliding_window + 1`. + flash_kwargs["window_size"] = (sliding_window - 1, sliding_window - 1) + + if supports_mapping["deterministic"]: + flash_kwargs["deterministic"] = ( + deterministic if deterministic is not None else os.getenv("FLASH_ATTENTION_DETERMINISTIC", "0") == "1" + ) + + if supports_mapping["softcap"] and softcap is not None: + flash_kwargs["softcap"] = softcap + + # Only within kernel implementation atm + if supports_mapping["s_aux"] and s_aux is not None: + flash_kwargs["s_aux"] = s_aux + + return flash_kwargs + + +def _flash_attention_forward( + query_states: torch.Tensor, + key_states: torch.Tensor, + value_states: torch.Tensor, + attention_mask: torch.Tensor | None, + query_length: int, + is_causal: bool, + dropout: float = 0.0, + position_ids: torch.Tensor | None = None, + softmax_scale: float | None = None, + sliding_window: int | None = None, + use_top_left_mask: bool = False, + softcap: float | None = None, + deterministic: bool | None = None, + cu_seq_lens_q: torch.LongTensor | None = None, + cu_seq_lens_k: torch.LongTensor | None = None, + max_length_q: int | None = None, + max_length_k: int | None = None, + target_dtype: torch.dtype | None = None, + attn_implementation: str | None = None, + **kwargs, +): + """ + Calls the forward method of Flash Attention - if the input hidden states contain at least one padding token + first unpad the input, then computes the attention scores and pad the final attention scores. + + (Optional) kwargs are described further in `_process_flash_attention_kwargs` and `FlashAttentionKwargs`. + + Args: + query_states (`torch.Tensor`): + Input query states to be passed to Flash Attention API + key_states (`torch.Tensor`): + Input key states to be passed to Flash Attention API + value_states (`torch.Tensor`): + Input value states to be passed to Flash Attention API + attention_mask (`torch.Tensor`, *optional*): + The padding mask - corresponds to a tensor of size `(batch_size, seq_len)` where 0 stands for the + position of padding tokens and 1 for the position of non-padding tokens. + attn_implementation (`str`, *optional*): + The attention implementation to use. If None, will default to the one based on the environment. + """ + (flash_fn, flash_varlen_fn, pad_fn, unpad_fn), process_flash_kwargs_fn = lazy_import_flash_attention( + attn_implementation + ) + + # PEFT possibly silently casts tensors to fp32, this potentially reconverts to correct dtype or is a no op + query_states, key_states, value_states = fa_peft_integration_check( + query_states, key_states, value_states, target_dtype + ) + + # Extract the flash attention kwargs that have been requested (and are supported by the implementation) + flash_kwargs = process_flash_kwargs_fn( + query_length=query_length, + key_length=key_states.size(1), + is_causal=is_causal, + dropout=dropout, + softmax_scale=softmax_scale, + sliding_window=sliding_window, + use_top_left_mask=use_top_left_mask, + softcap=softcap, + deterministic=deterministic, + **kwargs, + ) + + # We will use `flash_varlen_fn` to prevent cross-example attention and also allow padding free approach under two cases: + # Case 1. If position ids is provided and the position ids indicate packed sequences, see `_is_packed_sequence`. + # Case 2. Some models pass directly pre-computed `cu_seqlens` so we don't need to infer it from position ids. It is safe to + # use `flash_varlen_fn` knowing we already have all necessary the kwargs. + # + # NOTE: it is user's responsibility to take care of flattening `position_ids` if that's needed by the model. + # See #39121 for more information. + is_fa_with_position_ids = _is_packed_sequence(position_ids, batch_size=query_states.size(0)) + is_fa_with_varlen_kwargs = all( + kwarg is not None for kwarg in (cu_seq_lens_q, cu_seq_lens_k, max_length_q, max_length_k) + ) + + # Contains at least one padding token in the sequence + if attention_mask is not None: + q, k, v, indices_q, (cu_seq_lens_q, cu_seq_lens_k), (max_length_q, max_length_k) = _upad_input( + query_states, key_states, value_states, attention_mask, query_length, unpad_fn + ) + + # TODO for now this is required to work with + # https://huggingface.co/kernels-community/metal-flash-sdpa/blob/main/torch-ext/metal_flash_sdpa/__init__.py + if "mps" in str(q.device): + cu_seq_lens_k = cu_seq_lens_k.clone() + + out_unpad = flash_varlen_fn( + q, + k, + v, + cu_seqlens_q=cu_seq_lens_q, + cu_seqlens_k=cu_seq_lens_k, + max_seqlen_q=max_length_q, + max_seqlen_k=max_length_k, + **flash_kwargs, + ) + if isinstance(out_unpad, tuple): + out_unpad = out_unpad[0] + + out = pad_fn(out_unpad, indices_q, query_states.size(0), query_length) + + # Padding free, i.e. sequences flattened into one total sequence + elif is_fa_with_varlen_kwargs or is_fa_with_position_ids: + if cu_seq_lens_q is None or cu_seq_lens_k is None: + q, k, v, (cu_seq_lens_q, cu_seq_lens_k), (max_length_q, max_length_k) = _prepare_from_posids( + query_states, key_states, value_states, position_ids + ) + else: + q = query_states.reshape(-1, query_states.size(-2), query_states.size(-1)) + k = key_states.reshape(-1, key_states.size(-2), key_states.size(-1)) + v = value_states.reshape(-1, value_states.size(-2), value_states.size(-1)) + + # TODO for now this is required to work with + # https://huggingface.co/kernels-community/metal-flash-sdpa/blob/main/torch-ext/metal_flash_sdpa/__init__.py + if "mps" in str(q.device): + cu_seq_lens_k = cu_seq_lens_k.clone() + + out = flash_varlen_fn( + q, + k, + v, + cu_seqlens_q=cu_seq_lens_q, + cu_seqlens_k=cu_seq_lens_k, + max_seqlen_q=max_length_q, + max_seqlen_k=max_length_k, + **flash_kwargs, + ) + if isinstance(out, tuple): + out = out[0] + + out = out.view(query_states.size(0), -1, out.size(-2), out.size(-1)) + + # No padding + else: + out = flash_fn(query_states, key_states, value_states, **flash_kwargs) + if isinstance(out, tuple): + out = out[0] + + return out diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_gguf_pytorch_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_gguf_pytorch_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..ca960a9564b579f6c097be5cbd8057f34fdc1648 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_gguf_pytorch_utils.py @@ -0,0 +1,587 @@ +# Copyright 2024 The ggml.ai team and The HuggingFace Inc. team. and pygguf author (github.com/99991) +# https://github.com/99991/pygguf +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import re +from typing import NamedTuple + +import numpy as np +from tqdm.auto import tqdm + +from .integrations import ( + GGUF_CONFIG_DEFAULTS_MAPPING, + GGUF_CONFIG_MAPPING, + GGUF_TOKENIZER_MAPPING, + _gguf_parse_value, +) +from .utils import is_torch_available +from .utils.import_utils import is_gguf_available +from .utils.logging import get_logger + + +if is_torch_available(): + import torch + +logger = get_logger(__name__) + + +GGUF_TO_TRANSFORMERS_MAPPING = { + "ignore": { + "GGUF": { + "version": "version", + "tensor_count": "tensor_count", + "kv_count": "kv_count", + }, + "general": {"file_type": "file_type", "quantization_version": "quantization_version"}, + }, + "config": GGUF_CONFIG_MAPPING, + "tokenizer": {"tokenizer": GGUF_TOKENIZER_MAPPING["tokenizer"]}, + "tokenizer_config": {"tokenizer": GGUF_TOKENIZER_MAPPING["tokenizer_config"]}, +} + +GGUF_SUPPORTED_ARCHITECTURES = list(GGUF_TO_TRANSFORMERS_MAPPING["config"].keys()) + + +class GGUFTensor(NamedTuple): + weights: np.ndarray + name: str + metadata: dict + + +class TensorProcessor: + def __init__(self, config=None): + self.config = config or {} + + def preprocess_name(self, hf_name: str) -> str: + """ + Preprocesses the tensor name to ease loading the GGUF tensors. + """ + return hf_name + + def perform_fallback_tensor_mapping( + self, gguf_to_hf_name_map: dict[str, str], suffix: str, qual_name: str, hf_name: str + ): + """ + Called when get_gguf_hf_weights_map fails to map a HF parameter + (tensor) and corresponding GGUF one. + + This is particularly useful to resolve one-to-many + HF-GGUF mappings sometimes appear in some MoE models. + """ + pass + + def process(self, weights, name, **kwargs): + return GGUFTensor(weights, name, {}) + + +class LlamaTensorProcessor(TensorProcessor): + def __init__(self, config=None): + super().__init__(config=config) + + def process(self, weights, name, **kwargs): + if ".attn_k." in name or ".attn_q." in name: + num_heads = self.config.get("num_attention_heads") + num_kv_heads = self.config.get("num_key_value_heads") + + if None in (num_heads, num_kv_heads): + return GGUFTensor(weights, name, {}) + if ".attn_q." in name: + weights = self._reverse_permute_weights(weights, num_heads, num_heads) + elif ".attn_k." in name: + weights = self._reverse_permute_weights(weights, num_heads, num_kv_heads) + return GGUFTensor(weights, name, {}) + + def _reverse_permute_weights( + self, weights: np.ndarray, n_head: int, num_kv_heads: int | None = None + ) -> np.ndarray: + # Original permutation implementation + # https://github.com/ggerganov/llama.cpp/blob/a38b884c6c4b0c256583acfaaabdf556c62fabea/convert_hf_to_gguf.py#L1402-L1408 + if num_kv_heads is not None and n_head != num_kv_heads: + n_head = num_kv_heads + + dim = weights.shape[0] // n_head // 2 + w = weights.reshape(n_head, dim, 2, *weights.shape[1:]) + return w.swapaxes(2, 1).reshape(weights.shape) + + +class Qwen2MoeTensorProcessor(TensorProcessor): + HF_EXPERT_RENAME_PATTERN = re.compile(r"mlp.experts.\d+.") + HF_MOE_W13_PATTERN = re.compile(r"model\.layers\.(?P\d+)\.mlp\.experts\.gate_up_proj") + GGUF_MOE_WEIGHTS_PATTERN = re.compile(r"(?P.*\.ffn_(?Pgate|down|up)_exps)\.weight$") + + def __init__(self, config=None): + super().__init__(config=config) + + def preprocess_name(self, hf_name: str) -> str: + return re.sub(self.HF_EXPERT_RENAME_PATTERN, "mlp.experts.", hf_name) + + def perform_fallback_tensor_mapping( + self, gguf_to_hf_name_map: dict[str, str], suffix: str, qual_name: str, hf_name: str + ): + # Map merged MoE weights (w1 (gate) and w3 (up)) separately. + if m := re.fullmatch(self.HF_MOE_W13_PATTERN, hf_name): + full_hf_name = qual_name + hf_name + gguf_to_hf_name_map[f"blk.{m['bid']}.ffn_gate_exps{suffix}"] = full_hf_name + gguf_to_hf_name_map[f"blk.{m['bid']}.ffn_up_exps{suffix}"] = full_hf_name + + def process(self, weights, name: str, **kwargs): + if m := re.fullmatch(self.GGUF_MOE_WEIGHTS_PATTERN, name): + tensor_key_mapping = kwargs.get("tensor_key_mapping") + parsed_parameters = kwargs.get("parsed_parameters") + if tensor_key_mapping: + self._set_moe_expert_tensor(weights, parsed_parameters, tensor_key_mapping[m["name"]], m["w"]) + return GGUFTensor(weights, None, {}) + if "ffn_gate_inp_shexp" in name: + # for compatibility tensor shared_expert_gate must be (1, 2048) dim, + # quantized one is (2048) + weights = np.expand_dims(weights, axis=0) + return GGUFTensor(weights, name, {}) + + def _set_moe_expert_tensor(self, weights: np.ndarray, parsed_parameters: dict[str, dict], hf_name: str, w: str): + torch_weights = torch.from_numpy(np.copy(weights)) + if w == "down": + parsed_parameters["tensors"][hf_name] = torch_weights + else: + # Double the size of the second dimension to interleave w1 (gate) and w3 (up) + # weights per expert (which is the first dimension). + # w1 (gate) comes first and w3 (up) comes second. + # ref: https://github.com/vllm-project/vllm/blob/8f8fda261a620234fdeea338f44093d5d8072879/vllm/model_executor/layers/fused_moe/layer.py#L988-L1015 + shape = list(weights.shape) + shard_dim = 1 + shard_size = shape[shard_dim] + shape[shard_dim] = shard_size * 2 + if hf_name not in parsed_parameters["tensors"]: + parsed_parameters["tensors"][hf_name] = torch.zeros(shape, dtype=torch_weights.dtype) + out: torch.Tensor = parsed_parameters["tensors"][hf_name] + if w == "gate": + out = out.narrow(shard_dim, 0, shard_size) + else: # w == "up" + out = out.narrow(shard_dim, shard_size, shard_size) + out.copy_(torch_weights) + + +class BloomTensorProcessor(TensorProcessor): + def __init__(self, config=None): + super().__init__(config=config) + + def process(self, weights, name, **kwargs): + if "attn_qkv" in name: + num_heads = self.config["n_head"] + n_embed = self.config["hidden_size"] + if "weight" in name: + weights = self._reverse_reshape_weights(weights, num_heads, n_embed) + else: + weights = self._reverse_reshape_bias(weights, num_heads, n_embed) + return GGUFTensor(weights, name, {}) + + def _reverse_reshape_weights(self, weights: np.ndarray, n_head: int, n_embed: int): + # Original reshape implementation + # https://github.com/ggerganov/llama.cpp/blob/master/convert_hf_to_gguf.py#L972-L985 + q, k, v = np.array_split(weights, 3, axis=0) + + q = q.reshape(n_head, n_embed // n_head, n_embed) + k = k.reshape(n_head, n_embed // n_head, n_embed) + v = v.reshape(n_head, n_embed // n_head, n_embed) + qkv_weights = np.stack([q, k, v], axis=1) + + return qkv_weights.reshape(n_head * 3 * (n_embed // n_head), n_embed) + + def _reverse_reshape_bias(self, weights: np.ndarray, n_head: int, n_embed: int): + # Original reshape implementation + # https://github.com/ggerganov/llama.cpp/blob/master/convert_hf_to_gguf.py#L986-L998 + q_bias, k_bias, v_bias = np.array_split(weights, 3) + + q_bias = q_bias.reshape(n_head, n_embed // n_head) + k_bias = k_bias.reshape(n_head, n_embed // n_head) + v_bias = v_bias.reshape(n_head, n_embed // n_head) + + qkv_bias = np.stack([q_bias, k_bias, v_bias], axis=1).flatten() + return qkv_bias + + +class T5TensorProcessor(TensorProcessor): + def __init__(self, config=None): + super().__init__(config=config) + + def process(self, weights, name, **kwargs): + bid = None + for chunk in name.split("."): + if chunk.isdigit(): + bid = int(chunk) + break + return GGUFTensor(weights, name, {"bid": bid}) + + +class GPT2TensorProcessor(TensorProcessor): + def __init__(self, config=None): + super().__init__(config=config) + + def process(self, weights, name, **kwargs): + # Original transpose implementation + # https://github.com/ggerganov/llama.cpp/blob/a38b884c6c4b0c256583acfaaabdf556c62fabea/convert_hf_to_gguf.py#L2060-L2061 + if ( + "attn_qkv.weight" in name + or "ffn_down.weight" in name + or "ffn_up.weight" in name + or "attn_output.weight" in name + ): + weights = weights.T + + # Handle special case for output.weight + if name == "output.weight": + # output.weight has conflicts with attn_output.weight in name checking + # Store the tensor directly and signal to skip further processing + name = "lm_head.weight" + parsed_parameters = kwargs.get("parsed_parameters", {}) + parsed_parameters["tensors"][name] = torch.from_numpy(np.copy(weights)) + name = None # Signal to skip further processing + return GGUFTensor(weights, name, {}) + + +class MambaTensorProcessor(TensorProcessor): + def __init__(self, config=None): + super().__init__(config=config) + + def process(self, weights, name, **kwargs): + if "ssm_conv1d.weight" in name: + # for compatibility tensor ssm_conv1d must be (5120, 1, 4]) dim, + # quantized one is (5120, 4) + weights = np.expand_dims(weights, axis=1) + if "ssm_a" in name: + # Original exponential implementation + # https://github.com/ggerganov/llama.cpp/blob/master/convert_hf_to_gguf.py#L2975-L2977 + weights = np.log(-weights) + return GGUFTensor(weights, name, {}) + + +class NemotronTensorProcessor(TensorProcessor): + def __init__(self, config=None): + super().__init__(config=config) + + # ref : https://github.com/ggerganov/llama.cpp/blob/master/convert_hf_to_gguf.py#L4666 + def process(self, weights, name, **kwargs): + if "norm.weight" in name: + weights = weights - 1 + return GGUFTensor(weights, name, {}) + + +class Gemma2TensorProcessor(TensorProcessor): + def __init__(self, config=None): + super().__init__(config=config) + + # ref: https://github.com/ggerganov/llama.cpp/blob/d79d8f39b4da6deca4aea8bf130c6034c482b320/convert_hf_to_gguf.py#L3191 + # ref: https://github.com/huggingface/transformers/blob/fc37f38915372c15992b540dfcbbe00a916d4fc6/src/transformers/models/gemma/modeling_gemma.py#L89 + def process(self, weights, name, **kwargs): + if "norm.weight" in name: + weights = weights - 1 + return GGUFTensor(weights, name, {}) + + +class Lfm2TensorProcessor(TensorProcessor): + def __init__(self, config=None): + super().__init__(config=config) + + def process(self, weights, name, **kwargs): + if "shortconv.conv.weight" in name: + ## GGUF shape is [hidden_dim, L_cache], HF expects [hidden_dim, 1, L_cache] + weights = np.expand_dims(weights, axis=1) ## equivalent to unsqueeze(1) + return GGUFTensor(weights, name, {}) + + +TENSOR_PROCESSORS = { + "llama": LlamaTensorProcessor, + "qwen2moe": Qwen2MoeTensorProcessor, + "qwen3moe": Qwen2MoeTensorProcessor, + "bloom": BloomTensorProcessor, + "t5": T5TensorProcessor, + "t5encoder": T5TensorProcessor, + "gpt2": GPT2TensorProcessor, + "mamba": MambaTensorProcessor, + "nemotron": NemotronTensorProcessor, + "gemma2": Gemma2TensorProcessor, + "gemma3": Gemma2TensorProcessor, + "lfm2": Lfm2TensorProcessor, +} + + +def read_field(reader, field): + if field not in reader.fields: + return [] + value = reader.fields[field] + return [_gguf_parse_value(value.parts[_data_index], value.types) for _data_index in value.data] + + +# modified from https://github.com/vllm-project/vllm/blob/v0.6.4.post1/vllm/model_executor/model_loader/loader.py#L1115-L1147 +def get_gguf_hf_weights_map( + hf_model, + processor: TensorProcessor, + model_type: str | None = None, + num_layers: int | None = None, + qual_name: str = "", +): + """ + GGUF uses this naming convention for their tensors from HF checkpoint: + `blk.N.BB.weight` and `blk.N.BB.bias` + where N signifies the block number of a layer, and BB signifies the + attention/mlp layer components. + See "Standardized tensor names" in + https://github.com/ggerganov/ggml/blob/master/docs/gguf.md for details. + """ + if is_gguf_available() and is_torch_available(): + from gguf import MODEL_ARCH_NAMES, get_tensor_name_map + else: + logger.error( + "Loading a GGUF checkpoint in PyTorch, requires both PyTorch and GGUF>=0.10.0 to be installed. Please see " + "https://pytorch.org/ and https://github.com/ggerganov/llama.cpp/tree/master/gguf-py for installation instructions." + ) + raise ImportError("Please install torch and gguf>=0.10.0 to load a GGUF checkpoint in PyTorch.") + + model_type = hf_model.config.model_type if model_type is None else model_type + num_layers = hf_model.config.num_hidden_layers if num_layers is None else num_layers + # hack: ggufs have a different name for cohere + if model_type == "cohere": + model_type = "command-r" + elif model_type == "qwen2_moe": + model_type = "qwen2moe" + elif model_type == "qwen3_moe": + model_type = "qwen3moe" + elif model_type == "gemma3_text": + model_type = "gemma3" + elif model_type == "umt5": + model_type = "t5" + arch = None + for key, value in MODEL_ARCH_NAMES.items(): + if value == model_type: + arch = key + break + if arch is None: + raise NotImplementedError( + f"Unknown gguf model_type: {model_type} in gguf-py. " + "This might because you're using an outdated version of gguf-py package, " + "you can install `gguf` package from source refer to " + "https://github.com/ggerganov/llama.cpp/tree/master/gguf-py#development" + ) + name_map = get_tensor_name_map(arch, num_layers) + + # Use a dummy conversion to get the mapping, because + # hf => gguf and gguf => hf mappings are reversed + gguf_to_hf_name_map = {} + state_dict = hf_model.state_dict() + for hf_name in state_dict: + hf_name = processor.preprocess_name(hf_name) + + name, suffix = hf_name, "" + if hf_name.endswith(".weight") or hf_name.endswith(".bias"): + name, suffix = hf_name.rsplit(".", 1) + suffix = "." + suffix + + gguf_name = name_map.get_name(name) + if gguf_name is None: + processor.perform_fallback_tensor_mapping(gguf_to_hf_name_map, suffix, qual_name, hf_name) + continue + + gguf_to_hf_name_map[gguf_name + suffix] = qual_name + hf_name + + # Some model like Bloom converted from BloomModel instead of BloomForCausalLM + # Therefore, we need to check submodule as well to get a correct mapping + if named_children := hf_model.named_children(): + for name, child in named_children: + sub_map = get_gguf_hf_weights_map( + child, processor, model_type, num_layers, qual_name=f"{qual_name}{name}." + ) + # Ignore the keys that are already in the main map to avoid overwriting + sub_map = {k: v for k, v in sub_map.items() if k not in gguf_to_hf_name_map} + gguf_to_hf_name_map.update(sub_map) + + return gguf_to_hf_name_map + + +def load_gguf_checkpoint(gguf_checkpoint_path, return_tensors=False, model_to_load=None): + """ + Load a GGUF file and return a dictionary of parsed parameters containing tensors, the parsed + tokenizer and config attributes. + + Args: + gguf_checkpoint_path (`str`): + The path the to GGUF file to load + return_tensors (`bool`, defaults to `False`): + Whether to read the tensors from the file and return them. Not doing so is faster + and only loads the metadata in memory. + """ + if is_gguf_available() and is_torch_available(): + from gguf import GGUFReader, dequantize + else: + logger.error( + "Loading a GGUF checkpoint in PyTorch, requires both PyTorch and GGUF>=0.10.0 to be installed. Please see " + "https://pytorch.org/ and https://github.com/ggerganov/llama.cpp/tree/master/gguf-py for installation instructions." + ) + raise ImportError("Please install torch and gguf>=0.10.0 to load a GGUF checkpoint in PyTorch.") + + reader = GGUFReader(gguf_checkpoint_path) + fields = reader.fields + reader_keys = list(fields.keys()) + + parsed_parameters = {k: {} for k in GGUF_TO_TRANSFORMERS_MAPPING} + + architecture = read_field(reader, "general.architecture")[0] + # NOTE: Some GGUF checkpoints may miss `general.name` field in metadata + model_name = read_field(reader, "general.name") + + updated_architecture = None + # in llama.cpp mistral models use the same architecture as llama. We need + # to add this patch to ensure things work correctly on our side. + if "llama" in architecture and "mistral" in model_name: + updated_architecture = "mistral" + # FIXME: Currently this implementation is only for flan-t5 architecture. + # It needs to be developed for supporting legacy t5. + elif "t5" in architecture or "t5encoder" in architecture: + parsed_parameters["config"]["is_gated_act"] = True + if model_name and "umt5" in model_name[0].lower(): + updated_architecture = "umt5" + if "t5encoder" in architecture: + parsed_parameters["config"]["architectures"] = ["UMT5EncoderModel"] + else: + if "t5encoder" in architecture: + parsed_parameters["config"]["architectures"] = ["T5EncoderModel"] + updated_architecture = "t5" + else: + updated_architecture = architecture + + if "qwen2moe" in architecture: + updated_architecture = "qwen2_moe" + elif "qwen3moe" in architecture: + updated_architecture = "qwen3_moe" + + # For stablelm architecture, we need to set qkv_bias and use_parallel_residual from tensors + # If `qkv_bias=True`, qkv_proj with bias will be present in the tensors + # If `use_parallel_residual=False`, ffn_norm will be present in the tensors + if "stablelm" in architecture: + attn_bias_name = {"attn_q.bias", "attn_k.bias", "attn_v.bias"} + ffn_norm_name = "ffn_norm" + qkv_bias = any(bias_name in tensor.name for tensor in reader.tensors for bias_name in attn_bias_name) + use_parallel_residual = any(ffn_norm_name in tensor.name for tensor in reader.tensors) + parsed_parameters["config"]["use_qkv_bias"] = qkv_bias + parsed_parameters["config"]["use_parallel_residual"] = not use_parallel_residual + + if architecture not in GGUF_SUPPORTED_ARCHITECTURES and updated_architecture not in GGUF_SUPPORTED_ARCHITECTURES: + raise ValueError(f"GGUF model with architecture {architecture} is not supported yet.") + + # Handle tie_word_embeddings, if lm_head.weight is not present in tensors, + # tie_word_embeddings is true otherwise false + exceptions = ["falcon", "bloom"] + parsed_parameters["config"]["tie_word_embeddings"] = ( + all(tensor.name != "output.weight" for tensor in reader.tensors) or architecture in exceptions + ) + + # Set GGUF-specific default values + config_defaults = GGUF_CONFIG_DEFAULTS_MAPPING.get( + updated_architecture, GGUF_CONFIG_DEFAULTS_MAPPING.get(architecture) or {} + ) + for key, value in config_defaults.items(): + parsed_parameters["config"].setdefault(key, value) + + # List all key-value pairs in a columnized format + for gguf_key, field in reader.fields.items(): + gguf_key = gguf_key.replace(architecture, updated_architecture) + split = gguf_key.split(".") + prefix = split[0] + config_key = ".".join(split[1:]) + + value = [_gguf_parse_value(field.parts[_data_index], field.types) for _data_index in field.data] + + if len(value) == 1: + value = value[0] + + if isinstance(value, str) and architecture in value: + value = value.replace(architecture, updated_architecture) + + for parameter, parameter_renames in GGUF_TO_TRANSFORMERS_MAPPING.items(): + if prefix in parameter_renames and config_key in parameter_renames[prefix]: + renamed_config_key = parameter_renames[prefix][config_key] + if renamed_config_key == -1: + continue + + if renamed_config_key is not None: + parsed_parameters[parameter][renamed_config_key] = value + + if gguf_key in reader_keys: + reader_keys.remove(gguf_key) + + if gguf_key in reader_keys: + logger.info(f"Some keys were not parsed and added into account {gguf_key} | {value}") + + # Gemma3 GGUF checkpoint only contains weights of text backbone + if parsed_parameters["config"]["model_type"] == "gemma3": + parsed_parameters["config"]["model_type"] = "gemma3_text" + + if parsed_parameters["config"]["model_type"] == "lfm2": + gguf_num_key_value_heads = parsed_parameters["config"]["num_key_value_heads"] + # LFM2 GGUF checkpoint defines num_key_value_heads as a list of integers .e.g [0, 0, 8, 0, 0, 8, 0, 0, 8, 0, 8, 0, 8, 0, 8, 0] but we need to set it to the max value for HF + parsed_parameters["config"]["num_key_value_heads"] = max(gguf_num_key_value_heads) + ## we already read the correct intermediate_size from the GGUF checkpoint so we need to set block_auto_adjust_ff_dim to False + parsed_parameters["config"]["block_auto_adjust_ff_dim"] = False + + ## llama.cpp defines the layers that are full-attention by looking at num_key_value_heads + ## we need to set the full_attn_idxs to the layers that are full-attention + parsed_parameters["config"]["full_attn_idxs"] = [ + i for i, num_kv_heads in enumerate(gguf_num_key_value_heads) if num_kv_heads > 0 + ] + + # retrieve config vocab_size from tokenizer + # Please refer to https://github.com/huggingface/transformers/issues/32526 for more details + if "vocab_size" not in parsed_parameters["config"]: + tokenizer_parameters = parsed_parameters["tokenizer"] + if "tokens" in tokenizer_parameters: + parsed_parameters["config"]["vocab_size"] = len(tokenizer_parameters["tokens"]) + else: + logger.warning( + "Can't find a way to retrieve missing config vocab_size from tokenizer parameters. " + "This will use default value from model config class and cause unexpected behavior." + ) + + if return_tensors: + parsed_parameters["tensors"] = {} + + config = parsed_parameters.get("config", {}) + + ProcessorClass = TENSOR_PROCESSORS.get(architecture, TensorProcessor) + processor = ProcessorClass(config=config) + + tensor_key_mapping = get_gguf_hf_weights_map(model_to_load, processor) + + for tensor in tqdm(reader.tensors, desc="Converting and de-quantizing GGUF tensors..."): + name = tensor.name + weights = dequantize(tensor.data, tensor.tensor_type) + + result = processor.process( + weights=weights, + name=name, + tensor_key_mapping=tensor_key_mapping, + parsed_parameters=parsed_parameters, + ) + + weights = result.weights + name = result.name + + if name not in tensor_key_mapping: + continue + + name = tensor_key_mapping[name] + + parsed_parameters["tensors"][name] = torch.from_numpy(np.copy(weights)) + + if len(reader_keys) > 0: + logger.info(f"Some keys of the GGUF file were not considered: {reader_keys}") + + return parsed_parameters diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_layers.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_layers.py new file mode 100644 index 0000000000000000000000000000000000000000..1012606fcaaf37c7104c97e9c9f587401805a858 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_layers.py @@ -0,0 +1,288 @@ +# Copyright 2025 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from functools import partial + +import torch +import torch.nn as nn + +from .cache_utils import Cache +from .modeling_outputs import ( + BaseModelOutputWithPast, + QuestionAnsweringModelOutput, + SequenceClassifierOutputWithPast, + TokenClassifierOutput, +) +from .models.auto import AutoModel +from .processing_utils import Unpack +from .utils import TransformersKwargs, auto_docstring, can_return_tuple, logging + + +logger = logging.get_logger(__name__) + + +class GradientCheckpointingLayer(nn.Module): + """Base class for layers with gradient checkpointing. + + This class enables gradient checkpointing functionality for a layer. By default, gradient checkpointing is disabled + (`gradient_checkpointing = False`). When `model.set_gradient_checkpointing()` is called, gradient checkpointing is + enabled by setting `gradient_checkpointing = True` and assigning a checkpointing function to `_gradient_checkpointing_func`. + + Important: + + When using gradient checkpointing with `use_reentrant=True`, inputs that require gradients (e.g. hidden states) + must be passed as positional arguments (`*args`) rather than keyword arguments to properly propagate gradients. + + Example: + + ```python + >>> # Correct - hidden_states passed as positional arg + >>> out = self.layer(hidden_states, attention_mask=attention_mask) + + >>> # Incorrect - hidden_states passed as keyword arg + >>> out = self.layer(hidden_states=hidden_states, attention_mask=attention_mask) + ``` + """ + + gradient_checkpointing = False + + def __call__(self, *args, **kwargs): + if self.gradient_checkpointing and self.training: + do_warn = False + layer_name = self.__class__.__name__ + message = f"Caching is incompatible with gradient checkpointing in {layer_name}. Setting" + + if "use_cache" in kwargs and kwargs["use_cache"]: + kwargs["use_cache"] = False + message += " `use_cache=False`," + do_warn = True + + # different names for the same thing in different layers + # TODO cyril: this one without `S` can be removed after deprecation cycle + if "past_key_value" in kwargs and kwargs["past_key_value"] is not None: + kwargs["past_key_value"] = None + message += " `past_key_value=None`," + do_warn = True + + if "past_key_values" in kwargs and kwargs["past_key_values"] is not None: + kwargs["past_key_values"] = None + message += " `past_key_values=None`," + do_warn = True + + if "layer_past" in kwargs and kwargs["layer_past"] is not None: + kwargs["layer_past"] = None + message += " `layer_past=None`," + do_warn = True + + # warn if anything was changed + if do_warn: + message = message.rstrip(",") + "." + logger.warning_once(message) + + return self._gradient_checkpointing_func(partial(super().__call__, **kwargs), *args) + return super().__call__(*args, **kwargs) + + +@auto_docstring +class GenericForSequenceClassification: + base_model_prefix = "model" + + def __init__(self, config): + super().__init__(config) + self.num_labels = config.num_labels + # Similar to `self.model = AutoModel.from_config(config)` but allows to change the base model name if needed in the child class + setattr(self, self.base_model_prefix, AutoModel.from_config(config)) + self.score = nn.Linear(config.hidden_size, self.num_labels, bias=False) + + # Initialize weights and apply final processing + self.post_init() + + @can_return_tuple + @auto_docstring + def forward( + self, + input_ids: torch.LongTensor | None = None, + attention_mask: torch.Tensor | None = None, + position_ids: torch.LongTensor | None = None, + past_key_values: Cache | None = None, + inputs_embeds: torch.FloatTensor | None = None, + labels: torch.LongTensor | None = None, + use_cache: bool | None = None, + **kwargs: Unpack[TransformersKwargs], + ) -> SequenceClassifierOutputWithPast: + transformer_outputs: BaseModelOutputWithPast = getattr(self, self.base_model_prefix)( + input_ids, + attention_mask=attention_mask, + position_ids=position_ids, + past_key_values=past_key_values, + inputs_embeds=inputs_embeds, + use_cache=use_cache, + **kwargs, + ) + hidden_states = transformer_outputs.last_hidden_state + logits = self.score(hidden_states) + + if input_ids is not None: + batch_size = input_ids.shape[0] + else: + batch_size = inputs_embeds.shape[0] + + if self.config.pad_token_id is None and batch_size != 1: + raise ValueError("Cannot handle batch sizes > 1 if no padding token is defined.") + if self.config.pad_token_id is None: + last_non_pad_token = -1 + elif input_ids is not None: + # To handle both left- and right- padding, we take the rightmost token that is not equal to pad_token_id + non_pad_mask = (input_ids != self.config.pad_token_id).to(logits.device, torch.int32) + token_indices = torch.arange(input_ids.shape[-1], device=logits.device, dtype=torch.int32) + last_non_pad_token = (token_indices * non_pad_mask).argmax(-1) + else: + last_non_pad_token = -1 + logger.warning_once( + f"{self.__class__.__name__} will not detect padding tokens in `inputs_embeds`. Results may be " + "unexpected if using padding tokens in conjunction with `inputs_embeds.`" + ) + + pooled_logits = logits[torch.arange(batch_size, device=logits.device), last_non_pad_token] + + loss = None + if labels is not None: + loss = self.loss_function(logits=logits, labels=labels, pooled_logits=pooled_logits, config=self.config) + + return SequenceClassifierOutputWithPast( + loss=loss, + logits=pooled_logits, + past_key_values=transformer_outputs.past_key_values, + hidden_states=transformer_outputs.hidden_states, + attentions=transformer_outputs.attentions, + ) + + +@auto_docstring +class GenericForQuestionAnswering: + base_model_prefix = "model" + + def __init__(self, config): + super().__init__(config) + # Similar to `self.model = AutoModel.from_config(config)` but allows to change the base model name if needed in the child class + setattr(self, self.base_model_prefix, AutoModel.from_config(config)) + self.qa_outputs = nn.Linear(config.hidden_size, 2) + + # Initialize weights and apply final processing + self.post_init() + + def get_input_embeddings(self): + return getattr(self, self.base_model_prefix).embed_tokens + + def set_input_embeddings(self, value): + getattr(self, self.base_model_prefix).embed_tokens = value + + @can_return_tuple + @auto_docstring + def forward( + self, + input_ids: torch.LongTensor | None = None, + attention_mask: torch.Tensor | None = None, + position_ids: torch.LongTensor | None = None, + past_key_values: Cache | None = None, + inputs_embeds: torch.FloatTensor | None = None, + start_positions: torch.LongTensor | None = None, + end_positions: torch.LongTensor | None = None, + **kwargs: Unpack[TransformersKwargs], + ) -> QuestionAnsweringModelOutput: + outputs: BaseModelOutputWithPast = getattr(self, self.base_model_prefix)( + input_ids, + attention_mask=attention_mask, + position_ids=position_ids, + past_key_values=past_key_values, + inputs_embeds=inputs_embeds, + **kwargs, + ) + + sequence_output = outputs.last_hidden_state + + logits = self.qa_outputs(sequence_output) + start_logits, end_logits = logits.split(1, dim=-1) + start_logits = start_logits.squeeze(-1).contiguous() + end_logits = end_logits.squeeze(-1).contiguous() + + loss = None + if start_positions is not None and end_positions is not None: + loss = self.loss_function(start_logits, end_logits, start_positions, end_positions, **kwargs) + + return QuestionAnsweringModelOutput( + loss=loss, + start_logits=start_logits, + end_logits=end_logits, + hidden_states=outputs.hidden_states, + attentions=outputs.attentions, + ) + + +@auto_docstring +class GenericForTokenClassification: + base_model_prefix = "model" + + def __init__(self, config): + super().__init__(config) + self.num_labels = config.num_labels + # Similar to `self.model = AutoModel.from_config(config)` but allows to change the base model name if needed in the child class + setattr(self, self.base_model_prefix, AutoModel.from_config(config)) + if getattr(config, "classifier_dropout", None) is not None: + classifier_dropout = config.classifier_dropout + elif getattr(config, "hidden_dropout", None) is not None: + classifier_dropout = config.hidden_dropout + else: + classifier_dropout = 0.1 + self.dropout = nn.Dropout(classifier_dropout) + self.score = nn.Linear(config.hidden_size, config.num_labels) + + # Initialize weights and apply final processing + self.post_init() + + @can_return_tuple + @auto_docstring + def forward( + self, + input_ids: torch.LongTensor | None = None, + attention_mask: torch.Tensor | None = None, + position_ids: torch.LongTensor | None = None, + past_key_values: Cache | None = None, + inputs_embeds: torch.FloatTensor | None = None, + labels: torch.LongTensor | None = None, + use_cache: bool | None = None, + **kwargs: Unpack[TransformersKwargs], + ) -> TokenClassifierOutput: + outputs: BaseModelOutputWithPast = getattr(self, self.base_model_prefix)( + input_ids, + attention_mask=attention_mask, + position_ids=position_ids, + past_key_values=past_key_values, + inputs_embeds=inputs_embeds, + use_cache=use_cache, + **kwargs, + ) + sequence_output = outputs.last_hidden_state + sequence_output = self.dropout(sequence_output) + logits = self.score(sequence_output) + + loss = None + if labels is not None: + loss = self.loss_function(logits, labels, self.config) + + return TokenClassifierOutput( + loss=loss, + logits=logits, + hidden_states=outputs.hidden_states, + attentions=outputs.attentions, + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_outputs.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..4db902237b50bb92649b43ebecb3f1bd11421a5d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_outputs.py @@ -0,0 +1,1706 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from dataclasses import dataclass + +import torch + +from .cache_utils import Cache, EncoderDecoderCache +from .utils import ModelOutput + + +@dataclass +class BaseModelOutput(ModelOutput): + """ + Base class for model's outputs, with potential hidden states and attentions. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the model. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + last_hidden_state: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class BaseModelOutputWithNoAttention(ModelOutput): + """ + Base class for model's outputs, with potential hidden states. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`): + Sequence of hidden-states at the output of the last layer of the model. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, num_channels, height, width)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + """ + + last_hidden_state: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class BaseModelOutputWithPooling(ModelOutput): + """ + Base class for model's outputs that also contains a pooling of the last hidden states. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the model. + pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`): + Last layer hidden-state of the first token of the sequence (classification token) after further processing + through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns + the classification token after processing through a linear layer and a tanh activation function. The linear + layer weights are trained from the next sentence prediction (classification) objective during pretraining. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + last_hidden_state: torch.FloatTensor | None = None + pooler_output: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class BaseModelOutputWithPoolingAndNoAttention(ModelOutput): + """ + Base class for model's outputs that also contains a pooling of the last hidden states. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`): + Sequence of hidden-states at the output of the last layer of the model. + pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`): + Last layer hidden-state after a pooling operation on the spatial dimensions. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, num_channels, height, width)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + """ + + last_hidden_state: torch.FloatTensor | None = None + pooler_output: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class BaseModelOutputWithPast(ModelOutput): + """ + Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding). + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the model. + + If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1, + hidden_size)` is output. + past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if + `config.is_encoder_decoder=True` in the cross-attention blocks) that can be used (see `past_key_values` + input) to speed up sequential decoding. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + last_hidden_state: torch.FloatTensor | None = None + past_key_values: Cache | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class BaseModelOutputWithCrossAttentions(ModelOutput): + """ + Base class for model's outputs, with potential hidden states and attentions. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the model. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` and `config.add_cross_attention=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + """ + + last_hidden_state: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class BaseModelOutputWithPoolingAndCrossAttentions(ModelOutput): + """ + Base class for model's outputs that also contains a pooling of the last hidden states. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the model. + pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`): + Last layer hidden-state of the first token of the sequence (classification token) after further processing + through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns + the classification token after processing through a linear layer and a tanh activation function. The linear + layer weights are trained from the next sentence prediction (classification) objective during pretraining. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` and `config.add_cross_attention=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if + `config.is_encoder_decoder=True` in the cross-attention blocks) that can be used (see `past_key_values` + input) to speed up sequential decoding. + """ + + last_hidden_state: torch.FloatTensor | None = None + pooler_output: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + past_key_values: Cache | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class BaseModelOutputWithPastAndCrossAttentions(ModelOutput): + """ + Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding). + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the model. + + If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1, + hidden_size)` is output. + past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if + `config.is_encoder_decoder=True` in the cross-attention blocks) that can be used (see `past_key_values` + input) to speed up sequential decoding. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` and `config.add_cross_attention=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + """ + + last_hidden_state: torch.FloatTensor | None = None + past_key_values: Cache | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class MoECausalLMOutputWithPast(ModelOutput): + """ + Base class for causal language model (or autoregressive) outputs as well as Mixture of Expert's router hidden + states terms, to train a MoE model. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Language modeling loss (for next-token prediction). + logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`): + Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax). + past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see + `past_key_values` input) to speed up sequential decoding. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + z_loss (`torch.FloatTensor`, *optional*, returned when `labels` is provided): + z_loss for the sparse modules. + aux_loss (`torch.FloatTensor`, *optional*, returned when `labels` is provided): + aux_loss for the sparse modules. + router_logits (`tuple(torch.FloatTensor)`, *optional*, returned when `output_router_logits=True` is passed or when `config.add_router_probs=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, sequence_length, num_experts)`. + + Router logits of the encoder model, useful to compute the auxiliary loss and the z_loss for the sparse + modules. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + past_key_values: Cache | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + z_loss: torch.FloatTensor | None = None + aux_loss: torch.FloatTensor | None = None + router_logits: tuple[torch.FloatTensor] | None = None + + +@dataclass +class MoEModelOutput(ModelOutput): + """ + Base class for model's outputs, with potential hidden states and attentions. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the model. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + router_probs (`tuple(torch.FloatTensor)`, *optional*, returned when `output_router_probs=True` and `config.add_router_probs=True` is passed or when `config.output_router_probs=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, sequence_length, num_experts)`. + + Raw router probabilities that are computed by MoE routers, these terms are used to compute the auxiliary + loss and the z_loss for Mixture of Experts models. + """ + + last_hidden_state: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + router_probs: tuple[torch.FloatTensor] | None = None + router_logits: tuple[torch.FloatTensor] | None = None + + +@dataclass +class MoeModelOutputWithPast(ModelOutput): + """ + Base class for model's outputs, with potential hidden states and attentions. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the model. + past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if + `config.is_encoder_decoder=True` in the cross-attention blocks) that can be used (see `past_key_values` + input) to speed up sequential decoding. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + router_logits (`tuple(torch.FloatTensor)`, *optional*, returned when `output_router_probs=True` and `config.add_router_probs=True` is passed or when `config.output_router_probs=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, sequence_length, num_experts)`. + + Raw router logtis (post-softmax) that are computed by MoE routers, these terms are used to compute the auxiliary + loss for Mixture of Experts models. + """ + + last_hidden_state: torch.FloatTensor | None = None + past_key_values: Cache | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + router_logits: tuple[torch.FloatTensor] | None = None + + +@dataclass +class MoeCausalLMOutputWithPast(ModelOutput): + """ + Base class for causal language model (or autoregressive) with mixture of experts outputs. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Language modeling loss (for next-token prediction). + + logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`): + Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax). + + aux_loss (`torch.FloatTensor`, *optional*, returned when `labels` is provided): + aux_loss for the sparse modules. + + router_logits (`tuple(torch.FloatTensor)`, *optional*, returned when `output_router_probs=True` and `config.add_router_probs=True` is passed or when `config.output_router_probs=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, sequence_length, num_experts)`. + + Raw router logtis (post-softmax) that are computed by MoE routers, these terms are used to compute the auxiliary + loss for Mixture of Experts models. + + past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see + `past_key_values` input) to speed up sequential decoding. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + aux_loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + past_key_values: Cache | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + router_logits: tuple[torch.FloatTensor] | None = None + + +@dataclass +class MoEModelOutputWithPastAndCrossAttentions(ModelOutput): + """ + Base class for model's outputs that may also contain a past key/values (to speed up sequential decoding) as well as + Mixture of Expert's router hidden states terms, to train a MoE model. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the model. + + If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1, + hidden_size)` is output. + past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if + `config.is_encoder_decoder=True` in the cross-attention blocks) that can be used (see `past_key_values` + input) to speed up sequential decoding. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` and `config.add_cross_attention=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + router_probs (`tuple(torch.FloatTensor)`, *optional*, returned when `output_router_probs=True` and `config.add_router_probs=True` is passed or when `config.output_router_probs=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, sequence_length, num_experts)`. + + Raw router probabilities that are computed by MoE routers, these terms are used to compute the auxiliary + loss and the z_loss for Mixture of Experts models. + """ + + last_hidden_state: torch.FloatTensor | None = None + past_key_values: Cache | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + router_probs: tuple[torch.FloatTensor] | None = None + router_logits: tuple[torch.FloatTensor] | None = None + + +@dataclass +class Seq2SeqModelOutput(ModelOutput): + """ + Base class for model encoder's outputs that also contains : pre-computed hidden states that can speed up sequential + decoding. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the decoder of the model. + + If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1, + hidden_size)` is output. + past_key_values (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.EncoderDecoderCache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention + blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. + decoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the decoder at the output of each layer plus the optional initial embedding outputs. + decoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): + Sequence of hidden-states at the output of the last layer of the encoder of the model. + encoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the encoder at the output of each layer plus the optional initial embedding outputs. + encoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + """ + + last_hidden_state: torch.FloatTensor | None = None + past_key_values: EncoderDecoderCache | None = None + decoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + decoder_attentions: tuple[torch.FloatTensor, ...] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + encoder_last_hidden_state: torch.FloatTensor | None = None + encoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + encoder_attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class Seq2SeqMoEModelOutput(ModelOutput): + """ + Base class for model encoder's outputs that also contains : pre-computed hidden states that can speed up sequential + decoding. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the decoder of the model. + + If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1, + hidden_size)` is output. + past_key_values (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.EncoderDecoderCache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention + blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. + decoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the decoder at the output of each layer plus the optional initial embedding outputs. + decoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + decoder_router_logits (`tuple(torch.FloatTensor)`, *optional*, returned when `output_router_logits=True` is passed or when `config.add_router_probs=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, sequence_length, num_experts)`. + + Router logits of the decoder model, useful to compute the auxiliary loss for Mixture of Experts models. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): + Sequence of hidden-states at the output of the last layer of the encoder of the model. + encoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the encoder at the output of each layer plus the optional initial embedding outputs. + encoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + encoder_router_logits (`tuple(torch.FloatTensor)`, *optional*, returned when `output_router_logits=True` is passed or when `config.add_router_probs=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, sequence_length, num_experts)`. + + Router logits of the encoder model, useful to compute the auxiliary loss and the z_loss for the sparse + modules. + """ + + last_hidden_state: torch.FloatTensor | None = None + past_key_values: EncoderDecoderCache | None = None + decoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + decoder_attentions: tuple[torch.FloatTensor, ...] | None = None + decoder_router_logits: tuple[torch.FloatTensor] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + encoder_last_hidden_state: torch.FloatTensor | None = None + encoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + encoder_attentions: tuple[torch.FloatTensor, ...] | None = None + encoder_router_logits: tuple[torch.FloatTensor] | None = None + + +@dataclass +class CausalLMOutput(ModelOutput): + """ + Base class for causal language model (or autoregressive) outputs. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Language modeling loss (for next-token prediction). + logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`): + Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax). + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class CausalLMOutputWithPast(ModelOutput): + """ + Base class for causal language model (or autoregressive) outputs. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Language modeling loss (for next-token prediction). + logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`): + Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax). + past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see + `past_key_values` input) to speed up sequential decoding. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + past_key_values: Cache | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class CausalLMOutputWithCrossAttentions(ModelOutput): + """ + Base class for causal language model (or autoregressive) outputs. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Language modeling loss (for next-token prediction). + logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`): + Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax). + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Cross attentions weights after the attention softmax, used to compute the weighted average in the + cross-attention heads. + past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see + `past_key_values` input) to speed up sequential decoding. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + past_key_values: Cache | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class SequenceClassifierOutputWithPast(ModelOutput): + """ + Base class for outputs of sentence classification models. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Classification (or regression if config.num_labels==1) loss. + logits (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`): + Classification (or regression if config.num_labels==1) scores (before SoftMax). + past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see + `past_key_values` input) to speed up sequential decoding. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + past_key_values: Cache | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class MaskedLMOutput(ModelOutput): + """ + Base class for masked language models outputs. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Masked language modeling (MLM) loss. + logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`): + Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax). + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class Seq2SeqLMOutput(ModelOutput): + """ + Base class for sequence-to-sequence language models outputs. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Language modeling loss. + logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`): + Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax). + past_key_values (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.EncoderDecoderCache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention + blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. + decoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the decoder at the output of each layer plus the initial embedding outputs. + decoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): + Sequence of hidden-states at the output of the last layer of the encoder of the model. + encoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the encoder at the output of each layer plus the initial embedding outputs. + encoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + past_key_values: EncoderDecoderCache | None = None + decoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + decoder_attentions: tuple[torch.FloatTensor, ...] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + encoder_last_hidden_state: torch.FloatTensor | None = None + encoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + encoder_attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class Seq2SeqMoEOutput(ModelOutput): + """ + Base class for sequence-to-sequence language models outputs. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Language modeling loss. + logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`): + Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax). + past_key_values (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.EncoderDecoderCache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention + blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. + decoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the decoder at the output of each layer plus the initial embedding outputs. + decoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + decoder_router_logits (`tuple(torch.FloatTensor)`, *optional*, returned when `output_router_logits=True` is passed or when `config.add_router_probs=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, sequence_length, num_experts)`. + + Router logits of the decoder model, useful to compute the auxiliary loss for Mixture of Experts models. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): + Sequence of hidden-states at the output of the last layer of the encoder of the model. + encoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the encoder at the output of each layer plus the initial embedding outputs. + encoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + encoder_router_logits (`tuple(torch.FloatTensor)`, *optional*, returned when `output_router_logits=True` is passed or when `config.add_router_probs=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, sequence_length, num_experts)`. + + Router logits of the encoder model, useful to compute the auxiliary loss and z_loss for Mixture of Experts + models. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + encoder_z_loss: torch.FloatTensor | None = None + decoder_z_loss: torch.FloatTensor | None = None + encoder_aux_loss: torch.FloatTensor | None = None + decoder_aux_loss: torch.FloatTensor | None = None + past_key_values: EncoderDecoderCache | None = None + decoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + decoder_attentions: tuple[torch.FloatTensor, ...] | None = None + decoder_router_logits: tuple[torch.FloatTensor] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + encoder_last_hidden_state: torch.FloatTensor | None = None + encoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + encoder_attentions: tuple[torch.FloatTensor, ...] | None = None + encoder_router_logits: tuple[torch.FloatTensor] | None = None + + +@dataclass +class NextSentencePredictorOutput(ModelOutput): + """ + Base class for outputs of models predicting if two sentences are consecutive or not. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `next_sentence_label` is provided): + Next sequence prediction (classification) loss. + logits (`torch.FloatTensor` of shape `(batch_size, 2)`): + Prediction scores of the next sequence prediction (classification) head (scores of True/False continuation + before SoftMax). + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class SequenceClassifierOutput(ModelOutput): + """ + Base class for outputs of sentence classification models. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Classification (or regression if config.num_labels==1) loss. + logits (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`): + Classification (or regression if config.num_labels==1) scores (before SoftMax). + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class Seq2SeqSequenceClassifierOutput(ModelOutput): + """ + Base class for outputs of sequence-to-sequence sentence classification models. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `label` is provided): + Classification (or regression if config.num_labels==1) loss. + logits (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`): + Classification (or regression if config.num_labels==1) scores (before SoftMax). + past_key_values (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.EncoderDecoderCache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention + blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. + decoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the decoder at the output of each layer plus the initial embedding outputs. + decoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): + Sequence of hidden-states at the output of the last layer of the encoder of the model. + encoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the encoder at the output of each layer plus the initial embedding outputs. + encoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + past_key_values: EncoderDecoderCache | None = None + decoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + decoder_attentions: tuple[torch.FloatTensor, ...] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + encoder_last_hidden_state: torch.FloatTensor | None = None + encoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + encoder_attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class MultipleChoiceModelOutput(ModelOutput): + """ + Base class for outputs of multiple choice models. + + Args: + loss (`torch.FloatTensor` of shape *(1,)*, *optional*, returned when `labels` is provided): + Classification loss. + logits (`torch.FloatTensor` of shape `(batch_size, num_choices)`): + *num_choices* is the second dimension of the input tensors. (see *input_ids* above). + + Classification scores (before SoftMax). + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class TokenClassifierOutput(ModelOutput): + """ + Base class for outputs of token classification models. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided) : + Classification loss. + logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.num_labels)`): + Classification scores (before SoftMax). + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class QuestionAnsweringModelOutput(ModelOutput): + """ + Base class for outputs of question answering models. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Total span extraction loss is the sum of a Cross-Entropy for the start and end positions. + start_logits (`torch.FloatTensor` of shape `(batch_size, sequence_length)`): + Span-start scores (before SoftMax). + end_logits (`torch.FloatTensor` of shape `(batch_size, sequence_length)`): + Span-end scores (before SoftMax). + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + start_logits: torch.FloatTensor | None = None + end_logits: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class Seq2SeqQuestionAnsweringModelOutput(ModelOutput): + """ + Base class for outputs of sequence-to-sequence question answering models. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Total span extraction loss is the sum of a Cross-Entropy for the start and end positions. + start_logits (`torch.FloatTensor` of shape `(batch_size, sequence_length)`): + Span-start scores (before SoftMax). + end_logits (`torch.FloatTensor` of shape `(batch_size, sequence_length)`): + Span-end scores (before SoftMax). + past_key_values (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.EncoderDecoderCache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention + blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. + decoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the decoder at the output of each layer plus the initial embedding outputs. + decoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): + Sequence of hidden-states at the output of the last layer of the encoder of the model. + encoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the encoder at the output of each layer plus the initial embedding outputs. + encoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + """ + + loss: torch.FloatTensor | None = None + start_logits: torch.FloatTensor | None = None + end_logits: torch.FloatTensor | None = None + past_key_values: EncoderDecoderCache | None = None + decoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + decoder_attentions: tuple[torch.FloatTensor, ...] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + encoder_last_hidden_state: torch.FloatTensor | None = None + encoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + encoder_attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class SemanticSegmenterOutput(ModelOutput): + """ + Base class for outputs of semantic segmentation models. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Classification (or regression if config.num_labels==1) loss. + logits (`torch.FloatTensor` of shape `(batch_size, config.num_labels, logits_height, logits_width)`): + Classification scores for each pixel. + + + + The logits returned do not necessarily have the same size as the `pixel_values` passed as inputs. This is + to avoid doing two interpolations and lose some quality when a user needs to resize the logits to the + original image size as post-processing. You should always check your logits shape and resize as needed. + + + + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, patch_size, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, patch_size, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class ImageClassifierOutput(ModelOutput): + """ + Base class for outputs of image classification models. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Classification (or regression if config.num_labels==1) loss. + logits (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`): + Classification (or regression if config.num_labels==1) scores (before SoftMax). + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each stage) of shape `(batch_size, sequence_length, hidden_size)`. Hidden-states + (also called feature maps) of the model at the output of each stage. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, patch_size, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class ImageClassifierOutputWithNoAttention(ModelOutput): + """ + Base class for outputs of image classification models. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Classification (or regression if config.num_labels==1) loss. + logits (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`): + Classification (or regression if config.num_labels==1) scores (before SoftMax). + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each stage) of shape `(batch_size, num_channels, height, width)`. Hidden-states (also + called feature maps) of the model at the output of each stage. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class DepthEstimatorOutput(ModelOutput): + """ + Base class for outputs of depth estimation models. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Classification (or regression if config.num_labels==1) loss. + predicted_depth (`torch.FloatTensor` of shape `(batch_size, height, width)`): + Predicted depth for each pixel. + + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, num_channels, height, width)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, patch_size, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + predicted_depth: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class ImageSuperResolutionOutput(ModelOutput): + """ + Base class for outputs of image super resolution models. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Reconstruction loss. + reconstruction (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`): + Reconstructed images, possibly upscaled. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each stage) of shape `(batch_size, sequence_length, hidden_size)`. Hidden-states + (also called feature maps) of the model at the output of each stage. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, patch_size, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + reconstruction: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class Wav2Vec2BaseModelOutput(ModelOutput): + """ + Base class for models that have been trained with the Wav2Vec2 loss objective. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the model. + extract_features (`torch.FloatTensor` of shape `(batch_size, sequence_length, conv_dim[-1])`): + Sequence of extracted feature vectors of the last convolutional layer of the model. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of + shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + last_hidden_state: torch.FloatTensor | None = None + extract_features: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class XVectorOutput(ModelOutput): + """ + Output type of [`Wav2Vec2ForXVector`]. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Classification loss. + logits (`torch.FloatTensor` of shape `(batch_size, config.xvector_output_dim)`): + Classification hidden states before AMSoftmax. + embeddings (`torch.FloatTensor` of shape `(batch_size, config.xvector_output_dim)`): + Utterance embeddings used for vector similarity-based retrieval. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of + shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + loss: torch.FloatTensor | None = None + logits: torch.FloatTensor | None = None + embeddings: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class BackboneOutput(ModelOutput): + """ + Base class for outputs of backbones. + + Args: + feature_maps (`tuple(torch.FloatTensor)` of shape `(batch_size, num_channels, height, width)`): + Feature maps of the stages. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of + shape `(batch_size, sequence_length, hidden_size)` or `(batch_size, num_channels, height, width)`, + depending on the backbone. + + Hidden-states of the model at the output of each stage plus the initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. Only applicable if the backbone uses attention. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + """ + + feature_maps: tuple[torch.FloatTensor] | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class BaseModelOutputWithPoolingAndProjection(ModelOutput): + """ + Base class for model's outputs that also contains a pooling of the last hidden states. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the model. + pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`): + Last layer hidden-state of the first token of the sequence (classification token) after further processing + through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns + the classification token after processing through a linear layer and a tanh activation function. The linear + layer weights are trained from the next sentence prediction (classification) objective during pretraining. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the model at the output of each layer plus the optional initial embedding outputs. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights after the attention softmax, used to compute the weighted average in the self-attention + heads. + projection_state (`tuple(torch.FloatTensor)`, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` of shape `(batch_size,config.project_dim)`. + + Text embeddings before the projection layer, used to mimic the last hidden state of the teacher encoder. + """ + + last_hidden_state: torch.FloatTensor | None = None + pooler_output: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None + projection_state: tuple[torch.FloatTensor] | None = None + + +@dataclass +class Seq2SeqSpectrogramOutput(ModelOutput): + """ + Base class for sequence-to-sequence spectrogram outputs. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): + Spectrogram generation loss. + spectrogram (`torch.FloatTensor` of shape `(batch_size, sequence_length, num_bins)`): + The predicted spectrogram. + past_key_values (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.EncoderDecoderCache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention + blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. + decoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the decoder at the output of each layer plus the initial embedding outputs. + decoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): + Sequence of hidden-states at the output of the last layer of the encoder of the model. + encoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the encoder at the output of each layer plus the initial embedding outputs. + encoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + """ + + loss: torch.FloatTensor | None = None + spectrogram: torch.FloatTensor | None = None + past_key_values: EncoderDecoderCache | None = None + decoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + decoder_attentions: tuple[torch.FloatTensor, ...] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + encoder_last_hidden_state: torch.FloatTensor | None = None + encoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + encoder_attentions: tuple[torch.FloatTensor, ...] | None = None + + +@dataclass +class Seq2SeqTSModelOutput(ModelOutput): + """ + Base class for time series model's encoder outputs that also contains pre-computed hidden states that can speed up + sequential decoding. + + Args: + last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): + Sequence of hidden-states at the output of the last layer of the decoder of the model. + + If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1, + hidden_size)` is output. + past_key_values (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.EncoderDecoderCache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention + blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. + decoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the decoder at the output of each layer plus the optional initial embedding outputs. + decoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): + Sequence of hidden-states at the output of the last layer of the encoder of the model. + encoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the encoder at the output of each layer plus the optional initial embedding outputs. + encoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + loc (`torch.FloatTensor` of shape `(batch_size,)` or `(batch_size, input_size)`, *optional*): + Shift values of each time series' context window which is used to give the model inputs of the same + magnitude and then used to shift back to the original magnitude. + scale (`torch.FloatTensor` of shape `(batch_size,)` or `(batch_size, input_size)`, *optional*): + Scaling values of each time series' context window which is used to give the model inputs of the same + magnitude and then used to rescale back to the original magnitude. + static_features (`torch.FloatTensor` of shape `(batch_size, feature size)`, *optional*): + Static features of each time series' in a batch which are copied to the covariates at inference time. + """ + + last_hidden_state: torch.FloatTensor | None = None + past_key_values: EncoderDecoderCache | None = None + decoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + decoder_attentions: tuple[torch.FloatTensor, ...] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + encoder_last_hidden_state: torch.FloatTensor | None = None + encoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + encoder_attentions: tuple[torch.FloatTensor, ...] | None = None + loc: torch.FloatTensor | None = None + scale: torch.FloatTensor | None = None + static_features: torch.FloatTensor | None = None + + +@dataclass +class Seq2SeqTSPredictionOutput(ModelOutput): + """ + Base class for time series model's decoder outputs that also contain the loss as well as the parameters of the + chosen distribution. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when a `future_values` is provided): + Distributional loss. + params (`torch.FloatTensor` of shape `(batch_size, num_samples, num_params)`): + Parameters of the chosen distribution. + past_key_values (`EncoderDecoderCache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): + It is a [`~cache_utils.EncoderDecoderCache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). + + Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention + blocks) that can be used (see `past_key_values` input) to speed up sequential decoding. + decoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the decoder at the output of each layer plus the initial embedding outputs. + decoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + cross_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the decoder's cross-attention layer, after the attention softmax, used to compute the + weighted average in the cross-attention heads. + encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*): + Sequence of hidden-states at the output of the last layer of the encoder of the model. + encoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. + + Hidden-states of the encoder at the output of each layer plus the initial embedding outputs. + encoder_attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, + sequence_length)`. + + Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the + self-attention heads. + loc (`torch.FloatTensor` of shape `(batch_size,)` or `(batch_size, input_size)`, *optional*): + Shift values of each time series' context window which is used to give the model inputs of the same + magnitude and then used to shift back to the original magnitude. + scale (`torch.FloatTensor` of shape `(batch_size,)` or `(batch_size, input_size)`, *optional*): + Scaling values of each time series' context window which is used to give the model inputs of the same + magnitude and then used to rescale back to the original magnitude. + static_features (`torch.FloatTensor` of shape `(batch_size, feature size)`, *optional*): + Static features of each time series' in a batch which are copied to the covariates at inference time. + """ + + loss: torch.FloatTensor | None = None + params: tuple[torch.FloatTensor, ...] | None = None + past_key_values: EncoderDecoderCache | None = None + decoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + decoder_attentions: tuple[torch.FloatTensor, ...] | None = None + cross_attentions: tuple[torch.FloatTensor, ...] | None = None + encoder_last_hidden_state: torch.FloatTensor | None = None + encoder_hidden_states: tuple[torch.FloatTensor, ...] | None = None + encoder_attentions: tuple[torch.FloatTensor, ...] | None = None + loc: torch.FloatTensor | None = None + scale: torch.FloatTensor | None = None + static_features: torch.FloatTensor | None = None + + +@dataclass +class SampleTSPredictionOutput(ModelOutput): + """ + Base class for time series model's predictions outputs that contains the sampled values from the chosen + distribution. + + Args: + sequences (`torch.FloatTensor` of shape `(batch_size, num_samples, prediction_length)` or `(batch_size, num_samples, prediction_length, input_size)`): + Sampled values from the chosen distribution. + """ + + sequences: torch.FloatTensor | None = None + + +@dataclass +class MaskedImageModelingOutput(ModelOutput): + """ + Base class for outputs of masked image completion / in-painting models. + + Args: + loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `bool_masked_pos` is provided): + Reconstruction loss. + reconstruction (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`): + Reconstructed / completed images. + hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or + when `config.output_hidden_states=True`): + Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, + + one for the output of each stage) of shape `(batch_size, sequence_length, hidden_size)`. Hidden-states + (also called feature maps) of the model at the output of each stage. + attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when + `config.output_attentions=True`): + Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, patch_size, + sequence_length)`. Attentions weights after the attention softmax, used to compute the weighted average in + the self-attention heads. + """ + + loss: torch.FloatTensor | None = None + reconstruction: torch.FloatTensor | None = None + hidden_states: tuple[torch.FloatTensor, ...] | None = None + attentions: tuple[torch.FloatTensor, ...] | None = None diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_rope_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_rope_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..cb5f94e9f03b0903ee2d996c022b803a478b3d0c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_rope_utils.py @@ -0,0 +1,945 @@ +# Copyright 2024 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import math +import warnings +from functools import wraps +from typing import TYPE_CHECKING, Optional, TypedDict + +from .utils import is_torch_available, logging + + +logger = logging.get_logger(__name__) + + +if is_torch_available(): + import torch + +if TYPE_CHECKING: + from .configuration_utils import PreTrainedConfig + + +def dynamic_rope_update(rope_forward): + """ + Decorator function to update the RoPE parameters in the forward pass, if the model is using a dynamic RoPE + (i.e. a RoPE implementation that may recompute its frequencies in the forward pass). + + Args: + rope_forward (Callable): + The forward pass of the RoPE implementation. + + Returns: + The decorated forward pass. + """ + + def longrope_frequency_update(self, position_ids, device, layer_type=None): + """Longrope uses long factor if sequence is larger than original pretraining length, short otherwise.""" + seq_len = torch.max(position_ids) + 1 + + if layer_type is None: + rope_type = self.rope_type + original_inv_freq = self.original_inv_freq + prefix = "" + original_max_position_embeddings = self.config.rope_parameters["original_max_position_embeddings"] + else: + rope_type = self.rope_type[layer_type] + original_inv_freq = getattr(self, f"{layer_type}_original_inv_freq") + prefix = f"{layer_type}_" + original_max_position_embeddings = self.config.rope_parameters[layer_type][ + "original_max_position_embeddings" + ] + + if seq_len > original_max_position_embeddings: + if not hasattr(self, f"{layer_type}_long_inv_freq"): + rope_init_fn = ROPE_INIT_FUNCTIONS[rope_type] + long_inv_freq, _ = rope_init_fn( + self.config, + device, + seq_len=original_max_position_embeddings + 1, + layer_type=layer_type, + ) + self.register_buffer(f"{prefix}inv_freq", long_inv_freq, persistent=False) + setattr(self, f"{prefix}long_inv_freq", long_inv_freq) + else: + # This .to() is needed if the model has been moved to a device after being initialized (because + # the buffer is automatically moved, but not the original copy) + original_inv_freq = original_inv_freq.to(device) + self.register_buffer(f"{prefix}inv_freq", original_inv_freq, persistent=False) + setattr(self, f"{prefix}original_inv_freq", original_inv_freq) + + def dynamic_frequency_update(self, position_ids, device, layer_type=None): + """ + dynamic RoPE layers should recompute `inv_freq` in the following situations: + 1 - growing beyond the cached sequence length (allow scaling) + 2 - the current sequence length is in the original scale (avoid losing precision with small sequences) + """ + seq_len = torch.max(position_ids) + 1 + if layer_type is None: + rope_type = self.rope_type + max_seq_len_cached = self.max_seq_len_cached + original_inv_freq = self.original_inv_freq + prefix = "" + else: + rope_type = self.rope_type[layer_type] + max_seq_len_cached = getattr(self, f"{layer_type}_max_seq_len_cached", self.max_seq_len_cached) + original_inv_freq = getattr(self, f"{layer_type}_original_inv_freq") + prefix = f"{layer_type}_" + + if seq_len > max_seq_len_cached: # growth + rope_init_fn = ROPE_INIT_FUNCTIONS[rope_type] + inv_freq, self.attention_scaling = rope_init_fn( + self.config, + device, + seq_len=seq_len, + layer_type=layer_type, + ) + # TODO joao: may break with compilation + self.register_buffer(f"{prefix}inv_freq", inv_freq, persistent=False) + setattr(self, f"{layer_type}_max_seq_len_cached", seq_len) + + if seq_len < self.original_max_seq_len and max_seq_len_cached > self.original_max_seq_len: # reset + # This .to() is needed if the model has been moved to a device after being initialized (because + # the buffer is automatically moved, but not the original copy) + original_inv_freq = original_inv_freq.to(device) + self.register_buffer(f"{prefix}inv_freq", original_inv_freq, persistent=False) + setattr(self, f"{prefix}original_inv_freq", original_inv_freq) + setattr(self, f"{layer_type}_max_seq_len_cached", self.original_max_seq_len) + + @wraps(rope_forward) + def wrapper(self, x, position_ids, layer_type=None): + rope_type = self.rope_type if layer_type is None else self.rope_type[layer_type] + kwargs = {"layer_type": layer_type} if layer_type is not None else {} + if "dynamic" in rope_type: + dynamic_frequency_update(self, position_ids, device=x.device, **kwargs) + elif rope_type == "longrope": + longrope_frequency_update(self, position_ids, device=x.device, **kwargs) + return rope_forward(self, x, position_ids, **kwargs) + + return wrapper + + +def _compute_linear_scaling_rope_parameters( + config: Optional["PreTrainedConfig"] = None, + device: Optional["torch.device"] = None, + seq_len: int | None = None, + layer_type: str | None = None, +) -> tuple["torch.Tensor", float]: + """ + Computes the inverse frequencies with linear scaling. Credits to the Reddit user /u/kaiokendev + Args: + config ([`~transformers."PreTrainedConfig"`]): + The model configuration. This function assumes that the config will provide at least the following + properties: + + * rope_theta (`float`): The base wavelength from which the inverse frequencies will be derived. + * hidden_size (`int`): The numerator when deriving a head_dim, if not provided directly. + * num_attention_heads (`int`): The denominator when deriving a head_dim, if not provided directly. + + Additionally, this function will make use of the following properties if they are found in the config: + + * head_dim (`int`, *optional*): The size of the key-value heads in the model. If None, this value will be + derived as hidden_size // num_attention_heads. + * partial_rotary_factor (`float`, *optional*): If less than 1.0, inverse frequencies will be returned for + the first fraction of the head_dim. Defaults to 1.0. + device (`torch.device`): + The device to use for initialization of the inverse frequencies. + seq_len (`int`, *optional*): + The current sequence length. Unused for this type of RoPE. + + Returns: + Tuple of (`torch.Tensor`, `float`), containing the inverse frequencies for the RoPE embeddings and the + post-processing scaling factor applied to the computed cos/sin (unused in this type of RoPE). + """ + # For backward compatibility standardize the `rope_parameters_dict` if it uses old format + config.standardize_rope_params() + rope_parameters_dict = config.rope_parameters[layer_type] if layer_type is not None else config.rope_parameters + factor = rope_parameters_dict["factor"] + + # Gets the default RoPE parameters + base = rope_parameters_dict["rope_theta"] + partial_rotary_factor = rope_parameters_dict.get("partial_rotary_factor", 1.0) + head_dim = getattr(config, "head_dim", None) or config.hidden_size // config.num_attention_heads + dim = int(head_dim * partial_rotary_factor) + attention_factor = 1.0 # Unused in this type of RoPE + + # Compute the inverse frequencies + inv_freq = 1.0 / (base ** (torch.arange(0, dim, 2, dtype=torch.int64).to(device=device, dtype=torch.float) / dim)) + + # Then applies linear scaling to the frequencies. + # NOTE: originally, scaling was applied to the position_ids. However, we get `embs = inv_freq @ position_ids`, so + # applying scaling to the inverse frequencies is equivalent. + inv_freq /= factor + return inv_freq, attention_factor + + +def _compute_dynamic_ntk_parameters( + config: Optional["PreTrainedConfig"] = None, + device: Optional["torch.device"] = None, + seq_len: int | None = None, + layer_type: str | None = None, +) -> tuple["torch.Tensor", float]: + """ + Computes the inverse frequencies with NTK scaling. Credits to the Reddit users /u/bloc97 and /u/emozilla + + Args: + config ([`~transformers."PreTrainedConfig"`]): + The model configuration. This function assumes that the config will provide at least the following + properties: + + * rope_theta (`float`): The base wavelength from which the inverse frequencies will be derived. + * hidden_size (`int`): The numerator when deriving a head_dim, if not provided directly. + * num_attention_heads (`int`): The denominator when deriving a head_dim, if not provided directly. + * max_position_embeddings (`int`): The default sequence length used to update the dynamic RoPE at + inference time + * rope_parameters (`dict[str, float]`): The standard RoPE scaling parameters, from which `factor` + will be accessed. The value of `factor` is used to determine the new base frequency, along with the + current sequence length (seq_len), the maximum positional embeddings (max_position_embeddings), and the + computed dimensionality (dim) of the rotary embeddings. If seq_len <= max_position_embeddings, this + factor has no effect. If seq_len <= max_position_embeddings, this factor effectively stretches the + context window using an exponent derived from `dim`. + + Additionally, this function will make use of the following properties if they are found in the config: + + * head_dim (`int`, *optional*): The size of the key-value heads in the model. If None, this value will be + derived as hidden_size // num_attention_heads. + * partial_rotary_factor (`float`, *optional*): If less than 1.0, inverse frequencies will be returned for + the first fraction of the head_dim. Defaults to 1.0. + device (`torch.device`): + The device to use for initialization of the inverse frequencies. + seq_len (`int`, *optional*): + The current sequence length, used to update the dynamic RoPE at inference time. If `None` or shorter than + max_position_embeddings, this value will be overridden by max_position_embeddings. + + Returns: + Tuple of (`torch.Tensor`, `float`), containing the inverse frequencies for the RoPE embeddings and the + post-processing scaling factor applied to the computed cos/sin (unused in this type of RoPE). + """ + # For backward compatibility standardize the `rope_parameters_dict` if it uses old format + config.standardize_rope_params() + rope_parameters_dict = config.rope_parameters[layer_type] if layer_type is not None else config.rope_parameters + + base = rope_parameters_dict["rope_theta"] + partial_rotary_factor = rope_parameters_dict.get("partial_rotary_factor", 1.0) + head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads) + dim = int(head_dim * partial_rotary_factor) + factor = rope_parameters_dict["factor"] + attention_factor = 1.0 # Unused in this type of RoPE + + # seq_len: default to max_position_embeddings, e.g. at init time + if seq_len is None: + seq_len = config.max_position_embeddings + elif isinstance(seq_len, torch.Tensor): + seq_len = torch.maximum( + seq_len, + torch.tensor(config.max_position_embeddings, dtype=seq_len.dtype, device=seq_len.device), + ) + else: + seq_len = max(seq_len, config.max_position_embeddings) + + # Compute the inverse frequencies + base = base * ((factor * seq_len / config.max_position_embeddings) - (factor - 1)) ** (dim / (dim - 2)) + inv_freq = 1.0 / (base ** (torch.arange(0, dim, 2, dtype=torch.int64).to(device=device, dtype=torch.float) / dim)) + return inv_freq, attention_factor + + +def _compute_yarn_parameters( + config: "PreTrainedConfig", + device: Optional["torch.device"] = None, + seq_len: int | None = None, + layer_type: str | None = None, +) -> tuple["torch.Tensor", float]: + """ + Computes the inverse frequencies with NTK scaling. Please refer to the + [original paper](https://huggingface.co/papers/2309.00071) + + Args: + config ([`~transformers."PreTrainedConfig"`]): + The model configuration. This function assumes that the config will provide at least the following + properties: + + * rope_theta (`float`): The base wavelength from which the inverse frequencies will be derived. + * hidden_size (`int`): The numerator when deriving a head_dim, if not provided directly. + * num_attention_heads (`int`): The denominator when deriving a head_dim, if not provided directly. + * max_position_embeddings (`int`): The maximum length of the positional embeddings. + * rope_parameters (`dict[str, float | int]`): The standard RoPE scaling parameters, from which the following + keys will be accessed: + * `attention_factor` (`float`, *optional*): The scaling factor to be applied to the computed cos/sin. + If None, the value is inferred from `factor`, `mscale`, and `mscale_all_dim` as available. + * `beta_fast` (`float`, *optional*, defaults to 32): Parameter to set the boundary for extrapolation + (only) in the linear ramp function. + * `beta_slow` (`float`, *optional*, defaults to 1): Parameter to set the boundary for interpolation + (only) in the linear ramp function. + * `factor` (`float`, *optional*): The scaling factor applied when interpolating the position IDs to + extend the possible context length. Additionally, if `attention_factor` is None, the log of this + value is used to compute a value for `attention_factor`, possibly in conjunciton with `mscale` and + `mscale_all_dim`, if provided. + * `mscale` (`float`, *optional*): If `attention_factor` is None and both `mscale` and + `mscale_all_dim` are provided, `mscale` acts scalar augmenting `log(factor)` when computing the + numerator for the inferred value of `attention_factor`. If not provided, `attention_factor` will be + calculated based on `factor` only. + * `mscale_all_dim` (`float`, *optional*): If `attention_factor` is None and both `mscale` and + `mscale_all_dim` are provided, `mscale_all_dim` acts scalar augmenting `log(factor)` when computing + the denominator for the inferred value of `attention_factor`. If not provided, `attention_factor` + will be calculated based on `factor` only. + * `original_max_position_embeddings` (`int`): The original max position embeddings used during pretraining. + * `truncate` (`bool`, *optional*): Whether to truncate the correction range. + + Additionally, this function will make use of the following properties if they are found in the config: + + * head_dim (`int`, *optional*): The size of the key-value heads in the model. If None, this value will be + derived as hidden_size // num_attention_heads. + * partial_rotary_factor (`float`, *optional*, defaults to 1.0): If less than 1.0, inverse frequencies + will be returned for the first fraction of the head_dim. + device (`torch.device`): + The device to use for initialization of the inverse frequencies. + seq_len (`int`, *optional*): + The current sequence length. Unused for this type of RoPE. + + Returns: + Tuple of (`torch.Tensor`, `float`), containing the inverse frequencies for the RoPE embeddings and the + post-processing scaling factor applied to the computed cos/sin. + """ + # For backward compatibility standardize the `rope_parameters_dict` if it uses old format + config.standardize_rope_params() + rope_parameters_dict = config.rope_parameters[layer_type] if layer_type is not None else config.rope_parameters + + base = rope_parameters_dict["rope_theta"] + partial_rotary_factor = rope_parameters_dict.get("partial_rotary_factor", 1.0) + head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads) + dim = int(head_dim * partial_rotary_factor) + + factor = rope_parameters_dict["factor"] + attention_factor = rope_parameters_dict.get("attention_factor") + mscale = rope_parameters_dict.get("mscale") + mscale_all_dim = rope_parameters_dict.get("mscale_all_dim") + original_max_position_embeddings = rope_parameters_dict["original_max_position_embeddings"] + + # NOTE: DeekSeek-V3 (and potentially other models) have `original_max_position_embeddings` field + # containing the pretrained value. They use the ratio between `max_position_embeddings` and this value + # to compute the default attention scaling factor, instead of using `factor`. + if factor is None: + factor = config.max_position_embeddings / original_max_position_embeddings + + def get_mscale(scale, mscale=1): + if scale <= 1: + return 1.0 + return 0.1 * mscale * math.log(scale) + 1.0 + + # Sets the attention factor as suggested in the paper + if attention_factor is None: + if mscale and mscale_all_dim: + attention_factor = float(get_mscale(factor, mscale) / get_mscale(factor, mscale_all_dim)) + else: + attention_factor = get_mscale(factor) + + # Optional config options + # beta_fast/beta_slow: as suggested in the paper, default to 32/1 (correspondingly) + beta_fast = rope_parameters_dict.get("beta_fast") or 32 + beta_slow = rope_parameters_dict.get("beta_slow") or 1 + + # Compute the inverse frequencies + def find_correction_dim(num_rotations, dim, base, max_position_embeddings): + """Inverse dimension formula to find the dimension based on the number of rotations""" + return (dim * math.log(max_position_embeddings / (num_rotations * 2 * math.pi))) / (2 * math.log(base)) + + def find_correction_range(low_rot, high_rot, dim, base, max_position_embeddings, truncate): + """Find dimension range bounds based on rotations""" + low = find_correction_dim(low_rot, dim, base, max_position_embeddings) + high = find_correction_dim(high_rot, dim, base, max_position_embeddings) + if truncate: + low = math.floor(low) + high = math.ceil(high) + return max(low, 0), min(high, dim - 1) + + def linear_ramp_factor(min, max, dim): + if min == max: + max += 0.001 # Prevent singularity + + linear_func = (torch.arange(dim, dtype=torch.float32) - min) / (max - min) + ramp_func = torch.clamp(linear_func, 0, 1) + return ramp_func + + # Note on variable naming: "interpolation" comes from the original technique, where we interpolate the position IDs + # to expand the possible context length. In other words, interpolation = apply scaling factor. + pos_freqs = base ** (torch.arange(0, dim, 2).to(device=device, dtype=torch.float) / dim) + inv_freq_extrapolation = 1.0 / pos_freqs + inv_freq_interpolation = 1.0 / (factor * pos_freqs) + + truncate = config.rope_parameters.get("truncate", True) + low, high = find_correction_range(beta_fast, beta_slow, dim, base, original_max_position_embeddings, truncate) + + # Get n-dimensional rotational scaling corrected for extrapolation + inv_freq_extrapolation_factor = 1 - linear_ramp_factor(low, high, dim // 2).to(device=device, dtype=torch.float) + inv_freq = ( + inv_freq_interpolation * (1 - inv_freq_extrapolation_factor) + + inv_freq_extrapolation * inv_freq_extrapolation_factor + ) + return inv_freq, attention_factor + + +def _compute_longrope_parameters( + config: "PreTrainedConfig", + device: Optional["torch.device"] = None, + seq_len: int | None = None, + layer_type: str | None = None, +) -> tuple["torch.Tensor", float]: + """ + Computes the inverse frequencies with LongRoPE scaling. Please refer to the + [original implementation](https://github.com/microsoft/LongRoPE) + + Args: + config ([`~transformers."PreTrainedConfig"`]): + The model configuration. This function assumes that the config will provide at least the following + properties: + + * rope_theta (`float`): The base wavelength from which the inverse frequencies will be derived. + * hidden_size (`int`): The numerator when deriving a head_dim, if not provided directly. + * num_attention_heads (`int`): The denominator when deriving a head_dim, if not provided directly. + * max_position_embeddings (`int`): The maximum length of the positional embeddings. + * original_max_position_embeddings (`int`, *optional*): The original max position embeddings used during + pretraining. If not provided, defaults to `max_position_embeddings`. + * rope_parameters (`dict[str, float]`): The standard RoPE scaling parameters, from which the following keys + will be accessed: + * `attention_factor` (`float`, *optional*): The scaling factor to be applied on the attention + computation. If unspecified, it defaults to value recommended by the implementation, inferred from + the value of `factor`. + * `factor` (`float`, *optional*): The scaling factor to apply to the RoPE embeddings. If both + `max_position_embeddings` and `original_max_position_embeddings` are provided, this value will be + overridden s the ratio between those values. + * `long_factor` (`float`, *optional*): The scale factor applied when computing the inverse + frequencies if `seq_len` is provided and greater than `original_max_position_embeddings`. + * `short_factor` (`float`, *optional*): The scale factor applied when computing the inverse + frequencies if `seq_len` is None or less-than-or-equal-to `original_max_position_embeddings`. + + Additionally, this function will make use of the following properties if they are found in the config: + + * head_dim (`int`, *optional*): The size of the key-value heads in the model. If None, this value will be + derived as hidden_size // num_attention_heads. + * partial_rotary_factor (`float`, *optional*, defaults to 1.0): If less than 1.0, inverse frequencies + will be returned for the first fraction of the head_dim. + device (`torch.device`): + The device to use for initialization of the inverse frequencies. + seq_len (`int`, *optional*): + The current sequence length. + + Returns: + Tuple of (`torch.Tensor`, `float`), containing the inverse frequencies for the RoPE embeddings and the + post-processing scaling factor applied to the computed cos/sin. + """ + # For backward compatibility standardize the `rope_parameters_dict` if it uses old format + config.standardize_rope_params() + rope_parameters_dict = config.rope_parameters[layer_type] if layer_type is not None else config.rope_parameters + + base = rope_parameters_dict["rope_theta"] + partial_rotary_factor = rope_parameters_dict.get("partial_rotary_factor", 1.0) + head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads) + dim = int(head_dim * partial_rotary_factor) + + long_factor = rope_parameters_dict["long_factor"] + short_factor = rope_parameters_dict["short_factor"] + factor = rope_parameters_dict.get("factor") + attention_factor = rope_parameters_dict.get("attention_factor") + original_max_position_embeddings = rope_parameters_dict["original_max_position_embeddings"] + + # NOTE: Phi3 (and potentially other models) modify `max_position_embeddings` and have a + # `original_max_position_embeddings` field containing the pretrained value. They use the ratio between these two + # values to compute the default attention scaling factor, instead of using `factor`. + if factor is None: + factor = config.max_position_embeddings / original_max_position_embeddings + + # Sets the attention factor as suggested in the paper + if attention_factor is None: + if factor <= 1.0: + attention_factor = 1.0 + else: + attention_factor = math.sqrt(1 + math.log(factor) / math.log(original_max_position_embeddings)) + + # Compute the inverse frequencies -- scaled based on the target sequence length + if seq_len and seq_len > original_max_position_embeddings: + ext_factors = torch.tensor(long_factor, dtype=torch.float32, device=device) + else: + ext_factors = torch.tensor(short_factor, dtype=torch.float32, device=device) + inv_freq_shape = torch.arange(0, dim, 2, dtype=torch.int64, device=device).float() / dim + inv_freq = 1.0 / (ext_factors * base**inv_freq_shape) + + return inv_freq, attention_factor + + +def _compute_llama3_parameters( + config: "PreTrainedConfig", + device: Optional["torch.device"] = None, + seq_len: int | None = None, + layer_type: str | None = None, +) -> tuple["torch.Tensor", float]: + """ + Computes the inverse frequencies for llama 3.1. + + Args: + config ([`~transformers."PreTrainedConfig"`]): + The model configuration. This function assumes that the config will provide at least the following + properties: + + * rope_theta (`float`): The base wavelength from which the inverse frequencies will be derived. + * hidden_size (`int`): The numerator when deriving a head_dim, if not provided directly. + * num_attention_heads (`int`): The denominator when deriving a head_dim, if not provided directly. + * rope_parameters (`dict[str, float | int]`): The standard RoPE scaling parameters, from which the following + keys will be accessed: + * `factor` (`float`, *optional*): The scaling factor applied to the inverse frequencies when 1) the + wavelength is greater than `low_freq_wavelen` prior to smoothing, and 2) to all inverse frequencies + during smoothing. + * `high_freq_factor` (`float`): The scale factor used to compute `high_freq_wavelen` and + the value for the denominator of the smoothing factor prior to the `low_freq_factor` shift. + * `low_freq_factor` (`float`): The scale factor used to compute `low_freq_wavelen` and + the shift applied to the numerator and denominator of the smoothing factor. + frequencies if `seq_len` is None or less-than-or-equal-to `original_max_position_embeddings`. + * `original_max_position_embeddings` (`int`): The original max position embeddings used + during pretraining. If not provided, the function falls back to `max_position_embeddings`. + + Additionally, this function will make use of the following properties if they are found in the config: + + * head_dim (`int`, *optional*): The size of the key-value heads in the model. If None, this value will be + derived as hidden_size // num_attention_heads. + * partial_rotary_factor (`float`, *optional*): If less than 1.0, inverse frequencies will be returned for + the first fraction of the head_dim. Defaults to 1.0. + device (`torch.device`): + The device to use for initialization of the inverse frequencies. + seq_len (`int`, *optional*): + The current sequence length. Unused for this type of RoPE. + Returns: + Tuple of (`torch.Tensor`, `float`), containing the inverse frequencies for the RoPE embeddings and the + post-processing scaling factor applied to the computed cos/sin. + """ + # For backward compatibility standardize the `rope_parameters_dict` if it uses old format + config.standardize_rope_params() + rope_parameters_dict = config.rope_parameters[layer_type] if layer_type is not None else config.rope_parameters + + # Gets the default RoPE parameters + base = rope_parameters_dict["rope_theta"] + partial_rotary_factor = rope_parameters_dict.get("partial_rotary_factor", 1.0) + head_dim = getattr(config, "head_dim", None) or config.hidden_size // config.num_attention_heads + dim = int(head_dim * partial_rotary_factor) + attention_factor = 1.0 # Unused in this type of RoPE + + # Compute the inverse frequencies + inv_freq = 1.0 / (base ** (torch.arange(0, dim, 2, dtype=torch.int64).to(device=device, dtype=torch.float) / dim)) + + factor = rope_parameters_dict["factor"] # `8` in the original implementation + low_freq_factor = rope_parameters_dict["low_freq_factor"] # `1` in the original implementation + high_freq_factor = rope_parameters_dict["high_freq_factor"] # `4` in the original implementation + old_context_len = rope_parameters_dict["original_max_position_embeddings"] # `8192` in the original implementation + + low_freq_wavelen = old_context_len / low_freq_factor + high_freq_wavelen = old_context_len / high_freq_factor + + wavelen = 2 * math.pi / inv_freq + # wavelen < high_freq_wavelen: do nothing + # wavelen > low_freq_wavelen: divide by factor + inv_freq_llama = torch.where(wavelen > low_freq_wavelen, inv_freq / factor, inv_freq) + # otherwise: interpolate between the two, using a smooth factor + smooth_factor = (old_context_len / wavelen - low_freq_factor) / (high_freq_factor - low_freq_factor) + smoothed_inv_freq = (1 - smooth_factor) * inv_freq_llama / factor + smooth_factor * inv_freq_llama + is_medium_freq = ~(wavelen < high_freq_wavelen) * ~(wavelen > low_freq_wavelen) + inv_freq_llama = torch.where(is_medium_freq, smoothed_inv_freq, inv_freq_llama) + + return inv_freq_llama, attention_factor + + +# This maps the "rope_type" string field in rope config to the corresponding function to compute the RoPE parameters +# from the model config. You can append new {'rope_type': callable} pairs to this rope_parameters to enable custom RoPE +# parameterizations, as long as the callable has the same signature. +ROPE_INIT_FUNCTIONS = { + "linear": _compute_linear_scaling_rope_parameters, + "dynamic": _compute_dynamic_ntk_parameters, + "yarn": _compute_yarn_parameters, + "longrope": _compute_longrope_parameters, + "llama3": _compute_llama3_parameters, +} + + +class RopeParameters(TypedDict, total=False): + """ + Args: + rope_theta (`float`): + The base period of the RoPE embeddings. + rope_type (`str`, *optional*, defaults to "default"): + The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope', + 'llama3'], with 'default' being the original RoPE implementation. + partial_rotary_factor (`float`, *optional*): + The percentage of the query and key head embedding on which RoPE will be applied. + factor (`float`, *optional*): + Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In + most scaling types, a `factor` of x will enable the model to handle sequences of length x * + original maximum pre-trained length. + original_max_position_embeddings (`int`, *optional*): + Used with 'yarn', 'longrope' and 'llama3'. The original max position embeddings used during + pretraining. + attention_factor (`float`, *optional*): + Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention + computation. If unspecified, it defaults to value recommended by the implementation, using the + `factor` field to infer the suggested value. + beta_fast (`float`, *optional*): + Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear + ramp function. If unspecified, it defaults to 32. + beta_slow (`float`, *optional*): + Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear + ramp function. If unspecified, it defaults to 1. + short_factor (`list[float]`, *optional*): + Only used with 'longrope'. The scaling factor to be applied to short contexts (< + `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden + size divided by the number of attention heads divided by 2 + long_factor (`list[float]`, *optional*): + Only used with 'longrope'. The scaling factor to be applied to long contexts (< + `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden + size divided by the number of attention heads divided by 2 + low_freq_factor (`float`, *optional*): + Only used with 'llama3'. Scaling factor applied to low frequency components of the RoPE + high_freq_factor (`float`, *optional*): + Only used with 'llama3'. Scaling factor applied to high frequency components of the RoPE + """ + + rope_theta: float + rope_type: str | None + partial_rotary_factor: float | None + factor: float | None + original_max_position_embeddings: int | None + attention_factor: float | None + beta_fast: float | None + beta_slow: float | None + short_factor: list[float] | None + long_factor: list[float] | None + low_freq_factor: float | None + high_freq_factor: float | None + + +class RotaryEmbeddingConfigMixin: + """ + A Mixin containing the functionality to standardize and validate RoPE parameters. + """ + + default_theta = 10_000.0 + + def convert_rope_params_to_dict(self, ignore_keys_at_rope_validation: set | None = None, **kwargs): + rope_scaling = kwargs.pop("rope_scaling", None) + self.rope_parameters = rope_scaling or self.rope_parameters + self.rope_parameters = self.rope_parameters if self.rope_parameters is not None else {} + + # Standardize and validate the correctness of rotary position embeddings parameters. Priority for these parameters is: + # 1. Values in `rope_parameters` dict (where they should be after standardization) + # 2. Values in `kwargs` (i.e. it's in config.json but not MyConfig.__init__'s args) + # 3. Values in the config's attributes (i.e. it's in MyConfig.__init__'s args) + # 4. Default values (i.e. not present at all but other RoPE parameters are present) + rope_theta = kwargs.pop("rope_theta", getattr(self, "rope_theta", self.default_theta)) + self.rope_parameters.setdefault("rope_theta", rope_theta) + + partial_rotary_factor = kwargs.get("partial_rotary_factor", getattr(self, "partial_rotary_factor", None)) + if partial_rotary_factor is not None: + self.rope_parameters.setdefault("partial_rotary_factor", partial_rotary_factor) + ignore_keys_at_rope_validation = ( + set() if ignore_keys_at_rope_validation is None else ignore_keys_at_rope_validation + ) + ignore_keys_at_rope_validation = ignore_keys_at_rope_validation | {"partial_rotary_factor"} + + self.standardize_rope_params() + self.validate_rope(ignore_keys=ignore_keys_at_rope_validation) + return kwargs + + def standardize_rope_params(self): + """ + Helper to standardize the config's rope params field by ensuring the params are defined for each + later type. For old model the fn will duplicate a single rope param in each layer type (backward compatibility) + """ + # Move `rope_theta` and `partial_rotary_factor` to the `rope_parameters`, if not there yet + rope_theta = getattr(self, "rope_theta", None) + partial_rotary_factor = getattr(self, "partial_rotary_factor", None) + rope_parameters = getattr(self, "rope_parameters", None) or {} + layer_types = getattr(self, "layer_types", None) + + # Case 0: no RoPE params defined + if not (rope_parameters or rope_theta): + # partial_rotary_factor without rope_theta is invalid, so we don't check for it here + logger.warning("`standardize_rope_params` was called but no RoPE parameters were found.") + return + # Case 1: RoPE param keys do not intersect with possible `layer_types` -> one global dict + elif layer_types is None or rope_parameters == {} or not set(rope_parameters.keys()).issubset(layer_types): + rope_parameters.setdefault("rope_type", rope_parameters.get("type", "default")) + rope_parameters.setdefault("rope_theta", rope_theta) + if partial_rotary_factor is not None: + rope_parameters["partial_rotary_factor"] = partial_rotary_factor + + # Move pretraining-time maximum length to rope parameter dict for RoPE types with scaling + if rope_parameters["rope_type"] in ["llama3", "yarn", "longrope"]: + if hasattr(self, "original_max_position_embeddings"): + # NOTE: Phi3 (and potentially other models) save `original_max_position_embeddings` field + # containing the pretrained value outside rope parameters. This is an exception case where we + # give priority to `self.original_max_position_embeddings + self.rope_parameters["original_max_position_embeddings"] = self.original_max_position_embeddings + else: + self.rope_parameters.setdefault("original_max_position_embeddings", self.max_position_embeddings) + + # Case 2: different RoPE for each layer -> several params as nested dict + else: + for layer_type in set(layer_types): + rope_parameters[layer_type].setdefault("rope_type", rope_parameters[layer_type].get("type", "default")) + rope_parameters[layer_type].setdefault("rope_theta", rope_theta) + if partial_rotary_factor is not None: + rope_parameters[layer_type]["partial_rotary_factor"] = partial_rotary_factor + + if rope_parameters[layer_type]["rope_type"] in ["llama3", "yarn", "longrope"]: + self.rope_parameters[layer_type].setdefault( + "original_max_position_embeddings", self.max_position_embeddings + ) + + self.rope_parameters = rope_parameters + + def validate_rope(self: "PreTrainedConfig", ignore_keys: set | None = None): + """ + Validate the RoPE config arguments, given a `"PreTrainedConfig"` object + """ + rope_parameters_dict = self.rope_parameters + if rope_parameters_dict is None: + return + + if getattr(self, "layer_types", None) is not None and set(rope_parameters_dict.keys()).issubset( + self.layer_types + ): + pass + else: + rope_parameters_dict = {"full_attention": rope_parameters_dict} + + for rope_parameters in rope_parameters_dict.values(): + rope_type = rope_parameters.get("rope_type", rope_parameters.get("type", "default")) + validation_fn = getattr(self, f"_validate_{rope_type}_rope_parameters", None) + rope_parameters["rope_type"] = rope_type + + if validation_fn is not None: + validation_fn(rope_parameters, ignore_keys=ignore_keys) + else: + logger.warning( + f"Missing validation function in 'RotaryEmbeddingConfigMixin' for 'rope_type'='{rope_type}'" + ) + + def _validate_default_rope_parameters(self, rope_parameters: dict, ignore_keys: set | None = None): + required_keys = {"rope_type", "rope_theta"} + received_keys = set(rope_parameters.keys()) + rope_type = rope_parameters["rope_type"] + self._check_received_keys(rope_type, received_keys, required_keys, ignore_keys=ignore_keys) + + def _validate_linear_rope_parameters(self, rope_parameters: dict, ignore_keys: set | None = None): + required_keys = {"rope_type", "factor", "rope_theta"} + received_keys = set(rope_parameters.keys()) + rope_type = rope_parameters["rope_type"] + self._check_received_keys(rope_type, received_keys, required_keys, ignore_keys=ignore_keys) + + factor = rope_parameters["factor"] + if factor is None or not isinstance(factor, float) or factor < 1.0: + logger.warning(f"`rope_parameters`'s factor field must be a float >= 1, got {factor}") + + def _validate_dynamic_rope_parameters(self, rope_parameters: dict, ignore_keys: set | None = None): + required_keys = {"rope_type", "factor"} + received_keys = set(rope_parameters.keys()) + rope_type = rope_parameters["rope_type"] + self._check_received_keys(rope_type, received_keys, required_keys, ignore_keys=ignore_keys) + + factor = rope_parameters["factor"] + if factor is None or not isinstance(factor, float) or factor < 1.0: + logger.warning(f"`rope_parameters`'s factor field must be a float >= 1, got {factor}") + + def _validate_yarn_rope_parameters(self, rope_parameters: dict, ignore_keys: set | None = None): + required_keys = {"rope_type", "factor", "rope_theta", "original_max_position_embeddings"} + optional_keys = { + "attention_factor", + "beta_fast", + "beta_slow", + "mscale", + "mscale_all_dim", + "truncate", + } + received_keys = set(rope_parameters.keys()) + rope_type = rope_parameters["rope_type"] + self._check_received_keys(rope_type, received_keys, required_keys, optional_keys, ignore_keys=ignore_keys) + + factor = rope_parameters["factor"] + if factor is None or not isinstance(factor, float) or factor < 1.0: + logger.warning(f"`rope_parameters`'s factor field must be a float >= 1, got {factor}") + + attention_factor = rope_parameters.get("attention_factor") + if attention_factor is not None and (not isinstance(attention_factor, float) or attention_factor < 0): + logger.warning( + f"`rope_parameters`'s attention_factor field must be a float greater than 0, got {attention_factor}" + ) + beta_fast = rope_parameters.get("beta_fast") + if beta_fast is not None and not isinstance(beta_fast, float): + logger.warning(f"`rope_parameters`'s beta_fast field must be a float, got {beta_fast}") + beta_slow = rope_parameters.get("beta_slow") + if beta_slow is not None and not isinstance(beta_slow, float): + logger.warning(f"`rope_parameters`'s beta_slow field must be a float, got {beta_slow}") + + if (beta_fast or 32) < (beta_slow or 1): + logger.warning( + f"`rope_parameters`'s beta_fast field must be greater than beta_slow, got beta_fast={beta_fast} " + f"(defaults to 32 if None) and beta_slow={beta_slow} (defaults to 1 if None)" + ) + + # Double-check: `factor` should be the ratio between the pre-yarn and post-yarn context lengths. + # NOTE: we might get `implicit_factor == 1` if config's `original_max_position_embeddings` was + # inferred from `max_position_embeddings` during standardization + original_max_position_embeddings = self.rope_parameters["original_max_position_embeddings"] + implicit_factor = self.max_position_embeddings / original_max_position_embeddings + if implicit_factor != factor and implicit_factor != 1: + logger.warning_once( + f"The explicitly set RoPE scaling factor (config.rope_parameters['factor'] = {factor}) does not match " + "the ratio implicitly set by other parameters (implicit factor = " + "post-yarn context length / pre-yarn context length = " + "config.max_position_embeddings / config.rope_parameters['original_max_position_embeddings'] = " + f"{implicit_factor}). Using the explicit factor ({factor}) in YaRN. This may cause unexpected " + "behaviour in model usage, please correct the 'original_max_position_embeddings' fields in the model config." + ) + + def _validate_longrope_rope_parameters(self, rope_parameters: dict, ignore_keys: set | None = None): + required_keys = {"rope_type", "short_factor", "long_factor", "rope_theta", "original_max_position_embeddings"} + optional_keys = {"attention_factor", "factor"} + received_keys = set(rope_parameters.keys()) + rope_type = rope_parameters["rope_type"] + self._check_received_keys(rope_type, received_keys, required_keys, optional_keys, ignore_keys=ignore_keys) + + partial_rotary_factor = rope_parameters.get("partial_rotary_factor", 1.0) + head_dim = getattr(self, "head_dim", self.hidden_size // self.num_attention_heads) + dim = int(head_dim * partial_rotary_factor) + + short_factor = rope_parameters.get("short_factor") + if not isinstance(short_factor, list) and all(isinstance(x, (int, float)) for x in short_factor): + logger.warning(f"`rope_parameters`'s short_factor field must be a list of numbers, got {short_factor}") + if len(short_factor) != dim // 2: + logger.warning( + f"`rope_parameters`'s short_factor field must have length {dim // 2}, got {len(short_factor)}" + ) + + long_factor = rope_parameters.get("long_factor") + if not isinstance(long_factor, list) and all(isinstance(x, (int, float)) for x in long_factor): + logger.warning(f"`rope_parameters`'s long_factor field must be a list of numbers, got {long_factor}") + if len(long_factor) != dim // 2: + logger.warning( + f"`rope_parameters`'s long_factor field must have length {dim // 2}, got {len(long_factor)}" + ) + + factor = rope_parameters.get("factor") + original_max_position_embeddings = rope_parameters["original_max_position_embeddings"] + + # Handle Phi3 divergence: we prefer the use of `attention_factor` and/or `factor` over + # `original_max_position_embeddings` to compute internal variables. The latter is undesirable + if factor is None and original_max_position_embeddings is not None: + logger.warning_once( + "This model config has set a `rope_parameters['original_max_position_embeddings']` field, to be used together with " + "`max_position_embeddings` to determine a scaling factor. Please set the `factor` field of `rope_parameters`" + "with this ratio instead -- we recommend the use of this field over `original_max_position_embeddings`, " + "as it is compatible with most model architectures." + ) + elif factor is None and original_max_position_embeddings is None: + logger.warning("Missing required keys in `rope_parameters`: 'factor'") + elif not isinstance(factor, float) or factor < 1.0: + logger.warning(f"`rope_parameters`'s factor field must be a float >= 1, got {factor}") + + attention_factor = rope_parameters.get("attention_factor") + if attention_factor is not None and (not isinstance(attention_factor, float) or attention_factor < 0.0): + logger.warning( + f"`rope_parameters`'s attention_factor field must be a float greater than 0, got {attention_factor}" + ) + + def _validate_llama3_rope_parameters(self, rope_parameters: dict, ignore_keys: set | None = None): + required_keys = { + "rope_type", + "factor", + "original_max_position_embeddings", + "low_freq_factor", + "high_freq_factor", + "rope_theta", + } + rope_type = rope_parameters["rope_type"] + received_keys = set(rope_parameters.keys()) + self._check_received_keys(rope_type, received_keys, required_keys, ignore_keys=ignore_keys) + + factor = rope_parameters["factor"] + if factor is None or not isinstance(factor, float) or factor < 1.0: + logger.warning(f"`rope_parameters`'s factor field must be a float >= 1, got {factor}") + + low_freq_factor = rope_parameters["low_freq_factor"] + high_freq_factor = rope_parameters["high_freq_factor"] + if low_freq_factor is None or not isinstance(low_freq_factor, float): + logger.warning(f"`rope_parameters`'s low_freq_factor field must be a float, got {low_freq_factor}") + if high_freq_factor is None or not isinstance(high_freq_factor, float): + logger.warning(f"`rope_parameters`'s high_freq_factor field must be a float, got {high_freq_factor}") + if high_freq_factor <= low_freq_factor: + logger.warning( + "`rope_parameters`'s high_freq_factor field must be greater than low_freq_factor, got high_freq_factor=" + f"{high_freq_factor} and low_freq_factor={low_freq_factor}" + ) + + original_max_position_embeddings = rope_parameters["original_max_position_embeddings"] + if original_max_position_embeddings is None or not isinstance(original_max_position_embeddings, int): + logger.warning( + "`rope_parameters`'s original_max_position_embeddings field must be an integer, got " + f"{original_max_position_embeddings}" + ) + if original_max_position_embeddings >= self.max_position_embeddings: + logger.warning( + "`rope_parameters`'s original_max_position_embeddings field must be less than max_position_embeddings, got " + f"{original_max_position_embeddings} and max_position_embeddings={self.max_position_embeddings}" + ) + + @staticmethod + def _check_received_keys( + rope_type: str, + received_keys: set, + required_keys: set, + optional_keys: set | None = None, + ignore_keys: set | None = None, + ): + """Compare the received keys in `config.rope_parameters` against the expected and optional keys""" + # BC: "rope_type" was originally "type" -- let's check for "rope_type" when "type" is present + if "type" in received_keys: + received_keys -= {"type"} + required_keys.add("rope_type") + + optional_keys = optional_keys or set() + if "partial_rotary_factor" not in optional_keys: + optional_keys.add("partial_rotary_factor") + + # Some models need to store model-specific keys, and we don't want to throw warning at them + if ignore_keys is not None: + received_keys -= ignore_keys + + missing_keys = required_keys - received_keys + if missing_keys: + raise KeyError(f"Missing required keys in `rope_parameters` for 'rope_type'='{rope_type}': {missing_keys}") + + unused_keys = received_keys - required_keys - optional_keys + if unused_keys: + logger.warning(f"Unrecognized keys in `rope_parameters` for 'rope_type'='{rope_type}': {unused_keys}") + + +def rope_config_validation(config: RotaryEmbeddingConfigMixin, ignore_keys: set | None = None): + """ + This is a deprecated function. + It has been kept for backward compatibility with custom code models. + """ + warnings.warn( + "`rope_config_validation` is deprecated and has been removed. " + "Its functionality has been moved to RotaryEmbeddingConfigMixin.validate_rope method. " + "PreTrainedConfig inherits this class, so please call self.validate_rope() instead. " + "Also, make sure to use the new rope_parameters syntax. " + "You can call self.standardize_rope_params() in the meantime.", + FutureWarning, + ) + config.standardize_rope_params() + config.validate_rope(ignore_keys=ignore_keys) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..e01e8a11d61685485a0c8450412fe9d488a22252 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/modeling_utils.py @@ -0,0 +1,4816 @@ +# Copyright 2018 The Google AI Language Team Authors, Facebook AI Research authors and The HuggingFace Inc. team. +# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import collections +import copy +import functools +import importlib.metadata +import inspect +import json +import os +import re +import sys +import warnings +from abc import abstractmethod +from collections import defaultdict +from collections.abc import Callable, Iterator +from contextlib import contextmanager +from dataclasses import dataclass, field +from enum import Enum +from functools import partial, wraps +from itertools import cycle +from threading import Thread +from typing import Optional, TypeVar, get_type_hints +from zipfile import is_zipfile + +import torch +from huggingface_hub import create_repo, is_offline_mode, split_torch_state_dict_into_shards +from packaging import version +from safetensors import safe_open +from safetensors.torch import save_file as safe_save_file +from torch import Tensor, nn +from torch.distributions import constraints +from torch.utils.checkpoint import checkpoint + +from . import initialization as init +from .configuration_utils import PreTrainedConfig +from .conversion_mapping import get_model_conversion_mapping +from .core_model_loading import ( + WeightConverter, + WeightRenaming, + convert_and_load_state_dict_in_model, + revert_weight_conversion, +) +from .distributed import DistributedConfig +from .dynamic_module_utils import custom_object_save +from .generation import CompileConfig, GenerationConfig +from .integrations import PeftAdapterMixin, deepspeed_config, is_deepspeed_zero3_enabled, is_fsdp_enabled +from .integrations.accelerate import ( + _get_device_map, + accelerate_disk_offload, + accelerate_dispatch, + check_and_set_device_map, + expand_device_map, + get_device, + load_offloaded_parameter, +) +from .integrations.deepspeed import _load_state_dict_into_zero3_model +from .integrations.eager_paged import eager_paged_attention_forward +from .integrations.flash_attention import flash_attention_forward +from .integrations.flash_paged import paged_attention_forward +from .integrations.flex_attention import flex_attention_forward +from .integrations.hub_kernels import is_kernel +from .integrations.peft import maybe_load_adapters +from .integrations.sdpa_attention import sdpa_attention_forward +from .integrations.sdpa_paged import sdpa_attention_paged_forward +from .integrations.tensor_parallel import ( + ALL_PARALLEL_STYLES, + _get_parameter_tp_plan, + distribute_model, + gather_state_dict_for_save, + initialize_tensor_parallelism, + shard_and_distribute_module, + verify_tp_plan, +) +from .loss.loss_utils import LOSS_MAPPING +from .modeling_flash_attention_utils import lazy_import_flash_attention, lazy_import_paged_flash_attention +from .modeling_rope_utils import ROPE_INIT_FUNCTIONS +from .pytorch_utils import id_tensor_storage +from .quantizers import HfQuantizer +from .quantizers.auto import get_hf_quantizer +from .quantizers.quantizers_utils import get_module_from_name +from .safetensors_conversion import auto_conversion +from .utils import ( + ADAPTER_SAFE_WEIGHTS_NAME, + DUMMY_INPUTS, + SAFE_WEIGHTS_INDEX_NAME, + SAFE_WEIGHTS_NAME, + WEIGHTS_INDEX_NAME, + WEIGHTS_NAME, + ContextManagers, + KernelConfig, + PushToHubMixin, + cached_file, + check_torch_load_is_safe, + copy_func, + has_file, + is_accelerate_available, + is_bitsandbytes_available, + is_env_variable_true, + is_flash_attn_2_available, + is_flash_attn_3_available, + is_grouped_mm_available, + is_kernels_available, + is_torch_flex_attn_available, + is_torch_mlu_available, + is_torch_npu_available, + is_torch_xpu_available, + logging, +) +from .utils.generic import GeneralInterface, is_flash_attention_requested +from .utils.hub import DownloadKwargs, create_and_tag_model_card, get_checkpoint_shard_files +from .utils.import_utils import ( + is_huggingface_hub_greater_or_equal, + is_sagemaker_mp_enabled, + is_tracing, +) +from .utils.loading_report import LoadStateDictInfo, log_state_dict_report +from .utils.output_capturing import _CAN_RECORD_REGISTRY, OutputRecorder +from .utils.quantization_config import QuantizationMethod + + +if is_accelerate_available(): + from accelerate.hooks import add_hook_to_module + from accelerate.utils import extract_model_from_parallel + + +_torch_distributed_available = torch.distributed.is_available() + +if is_sagemaker_mp_enabled(): + import smdistributed.modelparallel.torch as smp + from smdistributed.modelparallel import __version__ as SMP_VERSION + + IS_SAGEMAKER_MP_POST_1_10 = version.parse(SMP_VERSION) >= version.parse("1.10") +else: + IS_SAGEMAKER_MP_POST_1_10 = False + + +logger = logging.get_logger(__name__) + +XLA_USE_BF16 = os.environ.get("XLA_USE_BF16", "0").upper() +XLA_DOWNCAST_BF16 = os.environ.get("XLA_DOWNCAST_BF16", "0").upper() +SpecificPreTrainedModelType = TypeVar("SpecificPreTrainedModelType", bound="PreTrainedModel") +_is_quantized = False +_is_ds_init_called = False + +# Mapping from flash attention implementations to their kernel fallback repositories +FLASH_ATTN_KERNEL_FALLBACK = { + "flash_attention_2": "kernels-community/flash-attn2", + "flash_attention_3": "kernels-community/vllm-flash-attn3", +} + + +@dataclass(frozen=True) +class LoadStateDictConfig: + """ + Config for loading weights. This allows bundling arguments that are just + passed around. + """ + + pretrained_model_name_or_path: str | None = None + download_kwargs: DownloadKwargs | None = field(default_factory=DownloadKwargs) + use_safetensors: bool | None = None + ignore_mismatched_sizes: bool = False + sharded_metadata: dict | None = None + device_map: dict | None = None + disk_offload_folder: str | None = None + offload_buffers: bool = False + dtype: torch.dtype | None = None + dtype_plan: dict = field(default_factory=dict) + hf_quantizer: HfQuantizer | None = None + device_mesh: Optional["torch.distributed.device_mesh.DeviceMesh"] = None + weights_only: bool = True + weight_mapping: list[WeightConverter | WeightRenaming] | None = None + + @property + def is_quantized(self) -> bool: + return self.hf_quantizer is not None + + +def is_local_dist_rank_0(): + return ( + torch.distributed.is_available() + and torch.distributed.is_initialized() + and int(os.environ.get("LOCAL_RANK", "-1")) == 0 + ) + + +@contextmanager +def set_quantized_state(): + global _is_quantized + _is_quantized = True + try: + yield + finally: + _is_quantized = False + + +# Skip recursive calls to deepspeed.zero.Init to avoid pinning errors. +# This issue occurs with ZeRO stage 3 when using NVMe offloading. +# For more details, refer to issue #34429. +@contextmanager +def set_zero3_state(): + global _is_ds_init_called + _is_ds_init_called = True + try: + yield + finally: + _is_ds_init_called = False + + +@contextmanager +def local_torch_dtype(dtype: torch.dtype, model_class_name: str | None = None): + """ + Locally change the torch default dtype to `dtype`, and restore the old one upon exiting the context. + If `model_class_name` is provided, it's used to provide a more helpful error message if `dtype` is not valid. + """ + # Just a more helping error before we set `torch.set_default_dtype` later on which would crash in this case + if not dtype.is_floating_point: + if model_class_name is not None: + error_message = ( + f"{model_class_name} cannot be instantiated under `dtype={dtype}` as it's not a floating-point dtype" + ) + else: + error_message = f"Cannot set `{dtype}` as torch's default as it's not a floating-point dtype" + raise ValueError(error_message) + + original_dtype = torch.get_default_dtype() + try: + torch.set_default_dtype(dtype) + yield + finally: + torch.set_default_dtype(original_dtype) + + +def get_torch_context_manager_or_global_device(): + """ + Test if a device context manager is currently in use, or if it is not the case, check if the default device + is not "cpu". This is used to infer the correct device to load the model on, in case `device_map` is not provided. + """ + device_in_context = torch.tensor([]).device + default_device = torch.get_default_device() + # This case means no context manager was used -> we still check if the default that was potentially set is not cpu + if device_in_context == default_device: + if default_device != torch.device("cpu"): + return default_device + return None + return device_in_context + + +def get_state_dict_dtype(state_dict): + """ + Returns the first found floating dtype in `state_dict` if there is one, otherwise returns the first dtype. + """ + for t in state_dict.values(): + if t.is_floating_point(): + return t.dtype + + # if no floating dtype was found return whatever the first dtype is + if len(state_dict) == 0: + return torch.float32 + return next(iter(state_dict.values())).dtype + + +str_to_torch_dtype = { + "BOOL": torch.bool, + "U8": torch.uint8, + "I8": torch.int8, + "I16": torch.int16, + "U16": torch.uint16, + "F16": torch.float16, + "BF16": torch.bfloat16, + "I32": torch.int32, + "U32": torch.uint32, + "F32": torch.float32, + "F64": torch.float64, + "I64": torch.int64, + "U64": torch.uint64, + "F8_E4M3": torch.float8_e4m3fn, + "F8_E5M2": torch.float8_e5m2, +} + + +def load_state_dict( + checkpoint_file: str | os.PathLike, map_location: str | torch.device = "cpu", weights_only: bool = True +) -> dict[str, torch.Tensor]: + """ + Reads a `safetensor` or a `.bin` checkpoint file. We load the checkpoint on "cpu" by default. + """ + # Use safetensors if possible + if checkpoint_file.endswith(".safetensors"): + with safe_open(checkpoint_file, framework="pt") as f: + state_dict = {} + for k in f.keys(): + if map_location == "meta": + _slice = f.get_slice(k) + k_dtype = _slice.get_dtype() + if k_dtype in str_to_torch_dtype: + dtype = str_to_torch_dtype[k_dtype] + else: + raise ValueError(f"Cannot load safetensors of unknown dtype {k_dtype}") + state_dict[k] = torch.empty(size=_slice.get_shape(), dtype=dtype, device="meta") + else: + state_dict[k] = f.get_tensor(k).to(map_location) + return state_dict + + # Fallback to torch.load (if weights_only was explicitly False, do not check safety as this is known to be unsafe) + if weights_only: + check_torch_load_is_safe() + extra_args = {} + # mmap can only be used with files serialized with zipfile-based format. + if isinstance(checkpoint_file, str) and map_location != "meta" and is_zipfile(checkpoint_file): + extra_args = {"mmap": True} + + return torch.load(checkpoint_file, map_location=map_location, weights_only=weights_only, **extra_args) + + +def _end_ptr(tensor: torch.Tensor) -> int: + # extract the end of the pointer if the tensor is a slice of a bigger tensor + if tensor.nelement(): + stop = tensor.view(-1)[-1].data_ptr() + tensor.element_size() + else: + stop = tensor.data_ptr() + return stop + + +def _get_tied_weight_keys(module: nn.Module) -> list[str]: + tied_weight_keys: list[str] = [] + for name, submodule in module.named_modules(): + tied = getattr(submodule, "_tied_weights_keys", {}) or {} + tied_weight_keys.extend([f"{name}.{k}" if name else k for k in tied.keys()]) + return tied_weight_keys + + +def _find_disjoint(tensors: list[set[str]], state_dict: dict[str, torch.Tensor]) -> tuple[list[set[str]], list[str]]: + filtered_tensors = [] + for shared in tensors: + if len(shared) < 2: + filtered_tensors.append(shared) + continue + + areas = [] + for name in shared: + tensor = state_dict[name] + areas.append((tensor.data_ptr(), _end_ptr(tensor), name)) + areas.sort() + + _, last_stop, last_name = areas[0] + filtered_tensors.append({last_name}) + for start, stop, name in areas[1:]: + if start >= last_stop: + filtered_tensors.append({name}) + else: + filtered_tensors[-1].add(name) + last_stop = stop + disjoint_tensors = [] + shared_tensors = [] + for tensors in filtered_tensors: + if len(tensors) == 1: + disjoint_tensors.append(tensors.pop()) + else: + shared_tensors.append(tensors) + return shared_tensors, disjoint_tensors + + +def _find_identical(tensors: list[set[str]], state_dict: dict[str, torch.Tensor]) -> tuple[list[set[str]], set[str]]: + shared_tensors = [] + identical = [] + for shared in tensors: + if len(shared) < 2: + continue + + areas = collections.defaultdict(set) + for name in shared: + tensor = state_dict[name] + area = (tensor.device, tensor.data_ptr(), _end_ptr(tensor)) + areas[area].add(name) + if len(areas) == 1: + identical.append(shared) + else: + shared_tensors.append(shared) + return shared_tensors, identical + + +def remove_tied_weights_from_state_dict( + state_dict: dict[str, torch.Tensor], model: "PreTrainedModel" +) -> dict[str, torch.Tensor]: + """ + Remove all tied weights from the given `state_dict`, making sure to keep only the main weight that `model` + will expect when reloading (even if we know tie weights symmetrically, it's better to keep the intended one). + This is because `safetensors` does not allow tensor aliasing - so we're going to remove aliases before saving. + """ + # To avoid any potential mistakes and mismatches between config and actual tied weights, here we check the pointers + # of the Tensors themselves -> we are guaranteed to find all the actual tied weights + ptrs = collections.defaultdict(list) + for name, tensor in state_dict.items(): + if not isinstance(tensor, torch.Tensor): + # Sometimes in the state_dict we have non-tensor objects. + # e.g. in bitsandbytes we have some `str` objects in the state_dict + # In the non-tensor case, fall back to the pointer of the object itself + ptrs[id(tensor)].append(name) + + elif tensor.device.type == "meta": + # In offloaded cases, there may be meta tensors in the state_dict. + # For these cases, key by the pointer of the original tensor object + # (state_dict tensors are detached and therefore no longer shared) + tensor = model.get_parameter(name) + ptrs[id(tensor)].append(name) + + else: + ptrs[id_tensor_storage(tensor)].append(name) + + shared_ptrs = {ptr: names for ptr, names in ptrs.items() if len(names) > 1} + + # Recursively descend to find tied weight keys + all_potential_tied_weights_keys = set(_get_tied_weight_keys(model)) + error_names = [] + to_delete_names = set() + # Removing the keys which are declared as known duplicates on load. This allows to make sure the name which is + # kept is consistent + if all_potential_tied_weights_keys is not None: + for names in shared_ptrs.values(): + found = 0 + for name in sorted(names): + matches_pattern = any(re.search(pat, name) for pat in all_potential_tied_weights_keys) + if matches_pattern and name in state_dict: + found += 1 + if found < len(names): + to_delete_names.add(name) + # We are entering a place where the weights and the transformers configuration do NOT match. + shared_names, disjoint_names = _find_disjoint(shared_ptrs.values(), state_dict) + # Those are actually tensor sharing but disjoint from each other, we can safely clone them + # Reloaded won't have the same property, but it shouldn't matter in any meaningful way. + for name in disjoint_names: + state_dict[name] = state_dict[name].clone() + + # When not all duplicates have been cleaned, still remove those keys, but put a clear warning. + # If the link between tensors was done at runtime then `from_pretrained` will not get + # the key back leading to random tensor. A proper warning will be shown + # during reload (if applicable), but since the file is not necessarily compatible with + # the config, better show a proper warning. + shared_names, identical_names = _find_identical(shared_names, state_dict) + # delete tensors that have identical storage + for inames in identical_names: + known = inames.intersection(to_delete_names) + for name in known: + del state_dict[name] + unknown = inames.difference(to_delete_names) + if len(unknown) > 1: + error_names.append(unknown) + + if shared_names: + error_names.extend(shared_names) + + if len(error_names) > 0: + raise RuntimeError( + f"The weights trying to be saved contained shared tensors {error_names} which are not properly defined. " + f"We found all the potential target tied weights keys to be: {all_potential_tied_weights_keys}.\n" + "This can also just mean that the module's tied weight keys are wrong vs the actual tied weights in the model.", + ) + + return state_dict + + +def _load_parameter_into_model(model: "PreTrainedModel", param_name: str, tensor: torch.Tensor): + """Cast a single parameter or buffer `param_name` into the `model`, with value `tensor`.""" + parent, param_type = get_module_from_name(model, param_name) + if param_type in parent._parameters and not isinstance(tensor, nn.Parameter): + tensor = nn.Parameter(tensor, requires_grad=tensor.is_floating_point()) + # We need to use setattr here, as we set non-persistent buffers as well with this function (`load_state_dict` + # does not allow to do it) + setattr(parent, param_type, tensor) + + +def _add_variant(weights_name: str, variant: str | None = None) -> str: + if variant is not None: + path, name = weights_name.rsplit(".", 1) + weights_name = f"{path}.{variant}.{name}" + return weights_name + + +def _get_resolved_checkpoint_files( + pretrained_model_name_or_path: str | os.PathLike | None, + variant: str | None, + gguf_file: str | None, + use_safetensors: bool | None, + user_agent: dict | None, + is_remote_code: bool, # Because we can't determine this inside this function, we need it to be passed in + transformers_explicit_filename: str | None = None, + download_kwargs: DownloadKwargs | None = None, +) -> tuple[list[str] | None, dict | None]: + """Get all the checkpoint filenames based on `pretrained_model_name_or_path`, and optional metadata if the + checkpoints are sharded. + This function will download the data if necessary. + """ + download_kwargs = download_kwargs or DownloadKwargs() + cache_dir = download_kwargs.get("cache_dir") + force_download = download_kwargs.get("force_download", False) + proxies = download_kwargs.get("proxies") + local_files_only = download_kwargs.get("local_files_only", False) + token = download_kwargs.get("token") + revision = download_kwargs.get("revision") or "main" + subfolder = download_kwargs.get("subfolder", "") + commit_hash = download_kwargs.get("commit_hash") + if transformers_explicit_filename is not None: + if not transformers_explicit_filename.endswith(".safetensors") and not transformers_explicit_filename.endswith( + ".safetensors.index.json" + ): + if transformers_explicit_filename != "adapter_model.bin": + raise ValueError( + "The transformers file in the config seems to be incorrect: it is neither a safetensors file " + "(*.safetensors) nor a safetensors index file (*.safetensors.index.json): " + f"{transformers_explicit_filename}" + ) + + is_sharded = False + + if pretrained_model_name_or_path is not None and gguf_file is None: + pretrained_model_name_or_path = str(pretrained_model_name_or_path) + is_local = os.path.isdir(pretrained_model_name_or_path) + # If the file is a local folder (but not in the HF_HOME cache, even if it's technically local) + if is_local: + if transformers_explicit_filename is not None: + # If the filename is explicitly defined, load this by default. + archive_file = os.path.join(pretrained_model_name_or_path, subfolder, transformers_explicit_filename) + is_sharded = transformers_explicit_filename.endswith(".safetensors.index.json") + elif use_safetensors is not False and os.path.isfile( + os.path.join(pretrained_model_name_or_path, subfolder, _add_variant(SAFE_WEIGHTS_NAME, variant)) + ): + # Load from a safetensors checkpoint + archive_file = os.path.join( + pretrained_model_name_or_path, subfolder, _add_variant(SAFE_WEIGHTS_NAME, variant) + ) + elif use_safetensors is not False and os.path.isfile( + os.path.join(pretrained_model_name_or_path, subfolder, _add_variant(SAFE_WEIGHTS_INDEX_NAME, variant)) + ): + # Load from a sharded safetensors checkpoint + archive_file = os.path.join( + pretrained_model_name_or_path, subfolder, _add_variant(SAFE_WEIGHTS_INDEX_NAME, variant) + ) + is_sharded = True + elif not use_safetensors and os.path.isfile( + os.path.join(pretrained_model_name_or_path, subfolder, _add_variant(WEIGHTS_NAME, variant)) + ): + # Load from a PyTorch checkpoint + archive_file = os.path.join( + pretrained_model_name_or_path, subfolder, _add_variant(WEIGHTS_NAME, variant) + ) + elif not use_safetensors and os.path.isfile( + os.path.join(pretrained_model_name_or_path, subfolder, _add_variant(WEIGHTS_INDEX_NAME, variant)) + ): + # Load from a sharded PyTorch checkpoint + archive_file = os.path.join( + pretrained_model_name_or_path, subfolder, _add_variant(WEIGHTS_INDEX_NAME, variant) + ) + is_sharded = True + elif use_safetensors: + raise OSError( + f"Error no file named {_add_variant(SAFE_WEIGHTS_NAME, variant)} found in directory" + f" {pretrained_model_name_or_path}." + ) + else: + raise OSError( + f"Error no file named {_add_variant(SAFE_WEIGHTS_NAME, variant)}, or {_add_variant(WEIGHTS_NAME, variant)}," + f" found in directory {pretrained_model_name_or_path}." + ) + elif os.path.isfile(os.path.join(subfolder, pretrained_model_name_or_path)): + archive_file = pretrained_model_name_or_path + is_local = True + else: + # set correct filename + if transformers_explicit_filename is not None: + filename = transformers_explicit_filename + is_sharded = transformers_explicit_filename.endswith(".safetensors.index.json") + elif use_safetensors is not False: + filename = _add_variant(SAFE_WEIGHTS_NAME, variant) + else: + filename = _add_variant(WEIGHTS_NAME, variant) + + # Prepare set of kwargs for hub functions + has_file_kwargs = { + "revision": revision, + "proxies": proxies, + "token": token, + "cache_dir": cache_dir, + "local_files_only": local_files_only, + } + cached_file_kwargs = { + "force_download": force_download, + "user_agent": user_agent, + "subfolder": subfolder, + "_raise_exceptions_for_gated_repo": False, + "_raise_exceptions_for_missing_entries": False, + "_commit_hash": commit_hash, + **has_file_kwargs, + } + can_auto_convert = ( + not is_offline_mode() # for obvious reasons + # If we are in a CI environment or in a pytest run, we prevent the conversion + and not is_env_variable_true("DISABLE_SAFETENSORS_CONVERSION") + and not is_remote_code # converter bot does not work on remote code + and subfolder == "" # converter bot does not work on subfolders + ) + + try: + # Load from URL or cache if already cached + # Since we set _raise_exceptions_for_missing_entries=False, we don't get an exception but a None + # result when internet is up, the repo and revision exist, but the file does not. + resolved_archive_file = cached_file(pretrained_model_name_or_path, filename, **cached_file_kwargs) + + # Try safetensors files first if not already found + if resolved_archive_file is None and filename == _add_variant(SAFE_WEIGHTS_NAME, variant): + # Maybe the checkpoint is sharded, we try to grab the index name in this case. + resolved_archive_file = cached_file( + pretrained_model_name_or_path, + _add_variant(SAFE_WEIGHTS_INDEX_NAME, variant), + **cached_file_kwargs, + ) + if resolved_archive_file is not None: + is_sharded = True + elif use_safetensors: + if revision == "main" and can_auto_convert: + resolved_archive_file, revision, is_sharded = auto_conversion( + pretrained_model_name_or_path, **cached_file_kwargs + ) + cached_file_kwargs["revision"] = revision + if resolved_archive_file is None: + raise OSError( + f"{pretrained_model_name_or_path} does not appear to have a file named" + f" {_add_variant(SAFE_WEIGHTS_NAME, variant)} or {_add_variant(SAFE_WEIGHTS_INDEX_NAME, variant)} " + "and thus cannot be loaded with `safetensors`. Please do not set `use_safetensors=True`." + ) + else: + # This repo has no safetensors file of any kind, we switch to PyTorch. + filename = _add_variant(WEIGHTS_NAME, variant) + resolved_archive_file = cached_file( + pretrained_model_name_or_path, filename, **cached_file_kwargs + ) + + # Then try `.bin` files + if resolved_archive_file is None and filename == _add_variant(WEIGHTS_NAME, variant): + # Maybe the checkpoint is sharded, we try to grab the index name in this case. + resolved_archive_file = cached_file( + pretrained_model_name_or_path, + _add_variant(WEIGHTS_INDEX_NAME, variant), + **cached_file_kwargs, + ) + if resolved_archive_file is not None: + is_sharded = True + + # If we have a match, but it's `.bin` format, try to launch safetensors conversion for next time + if resolved_archive_file is not None: + safe_weights_name = SAFE_WEIGHTS_INDEX_NAME if is_sharded else SAFE_WEIGHTS_NAME + if ( + filename in [WEIGHTS_NAME, WEIGHTS_INDEX_NAME] + and not has_file(pretrained_model_name_or_path, safe_weights_name, **has_file_kwargs) + and can_auto_convert + ): + Thread( + target=auto_conversion, + args=(pretrained_model_name_or_path,), + kwargs={"ignore_errors_during_conversion": False, **cached_file_kwargs}, + name="Thread-auto_conversion", + ).start() + + # If no match, raise appropriare errors + else: + # Otherwise, no PyTorch file was found + if variant is not None and has_file( + pretrained_model_name_or_path, WEIGHTS_NAME, **has_file_kwargs + ): + raise OSError( + f"{pretrained_model_name_or_path} does not appear to have a file named" + f" {_add_variant(WEIGHTS_NAME, variant)} but there is a file without the variant" + f" {variant}. Use `variant=None` to load this model from those weights." + ) + else: + raise OSError( + f"{pretrained_model_name_or_path} does not appear to have a file named" + f" {_add_variant(WEIGHTS_NAME, variant)} or {_add_variant(SAFE_WEIGHTS_NAME, variant)}." + ) + + except OSError: + # Raise any environment error raise by `cached_file`. It will have a helpful error message adapted + # to the original exception. + raise + except Exception as e: + # For any other exception, we throw a generic error. + raise OSError( + f"Can't load the model for '{pretrained_model_name_or_path}'. If you were trying to load it" + " from 'https://huggingface.co/models', make sure you don't have a local directory with the" + f" same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a" + f" directory containing a file named {_add_variant(WEIGHTS_NAME, variant)}." + ) from e + + if is_local: + logger.info(f"loading weights file {archive_file}") + resolved_archive_file = archive_file + else: + logger.info(f"loading weights file {filename} from cache at {resolved_archive_file}") + + elif gguf_file: + # Case 1: the GGUF file is present locally + if os.path.isfile(gguf_file): + resolved_archive_file = gguf_file + # Case 2: The GGUF path is a location on the Hub + # Load from URL or cache if already cached + else: + cached_file_kwargs = { + "cache_dir": cache_dir, + "force_download": force_download, + "proxies": proxies, + "local_files_only": local_files_only, + "token": token, + "user_agent": user_agent, + "revision": revision, + "subfolder": subfolder, + "_raise_exceptions_for_gated_repo": False, + "_raise_exceptions_for_missing_entries": False, + "_commit_hash": commit_hash, + } + + resolved_archive_file = cached_file(pretrained_model_name_or_path, gguf_file, **cached_file_kwargs) + + # We now download and resolve all checkpoint files if the checkpoint is sharded + sharded_metadata = None + if is_sharded: + checkpoint_files, sharded_metadata = get_checkpoint_shard_files( + pretrained_model_name_or_path, + resolved_archive_file, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _commit_hash=commit_hash, + ) + else: + checkpoint_files = [resolved_archive_file] if pretrained_model_name_or_path is not None else None + + return checkpoint_files, sharded_metadata + + +def _get_dtype( + dtype: str | torch.dtype | dict | None, + checkpoint_files: list[str] | None, + config: PreTrainedConfig, + sharded_metadata: dict | None, + state_dict: dict | None, + weights_only: bool, + hf_quantizer: HfQuantizer | None = None, +) -> tuple[PreTrainedConfig, torch.dtype]: + """Find the correct `dtype` to use based on provided arguments. Also update the `config` based on the + inferred dtype. We do the following: + 1. If dtype is "auto", we try to read the config, else auto-detect dtype from the loaded state_dict, by checking + its first weights entry that is of a floating type - we assume all floating dtype weights are of the same dtype + 2. Else, use the dtype provided as a dict or str + """ + is_sharded = sharded_metadata is not None + + if dtype is not None: + if isinstance(dtype, str): + if dtype == "auto": + if hasattr(config, "dtype") and config.dtype is not None: + dtype = config.dtype + logger.info(f"Will use dtype={dtype} as defined in model's config object") + else: + if is_sharded and "dtype" in sharded_metadata: + dtype = sharded_metadata["dtype"] + elif state_dict is not None: + dtype = get_state_dict_dtype(state_dict) + else: + state_dict = load_state_dict( + checkpoint_files[0], map_location="meta", weights_only=weights_only + ) + dtype = get_state_dict_dtype(state_dict) + logger.info( + "Since the `dtype` attribute can't be found in model's config object, " + "will use dtype={dtype} as derived from model's weights" + ) + elif hasattr(torch, dtype): + dtype = getattr(torch, dtype) + else: + raise ValueError( + "`dtype` provided as a `str` can only be `'auto'`, or a string representation of a valid `torch.dtype`" + ) + + # cast it to a proper `torch.dtype` object + dtype = getattr(torch, dtype) if isinstance(dtype, str) else dtype + elif not isinstance(dtype, (dict, torch.dtype)): + raise ValueError( + f"`dtype` can be one of: `torch.dtype`, `'auto'`, a string of a valid `torch.dtype` or a `dict` with valid `dtype` " + f"for each sub-config in composite configs, but received {dtype}" + ) + else: + # set torch.get_default_dtype() (usually fp32) as the default dtype if `None` is provided + dtype = torch.get_default_dtype() + + if hf_quantizer is not None: + hf_quantizer.update_dtype(dtype) + + # Get the main dtype + if isinstance(dtype, dict): + main_dtype = dtype.get("", torch.get_default_dtype()) + main_dtype = getattr(torch, main_dtype) if isinstance(main_dtype, str) else main_dtype + + logger.warning_once( + "Using different dtypes per module is deprecated and will be removed in future versions " + "Setting different dtypes per backbone model might cause device errors downstream, therefore " + f"setting the dtype={main_dtype} for all modules." + ) + + else: + main_dtype = dtype + + # Set it on the config and subconfigs + config.dtype = main_dtype + for sub_config_key in config.sub_configs: + if (sub_config := getattr(config, sub_config_key)) is not None: + sub_config.dtype = main_dtype + + return config, main_dtype + + +class PipelineParallel(Enum): + inputs = 0 + outputs = 1 + + +class ModuleUtilsMixin: + """ + A few utilities for `torch.nn.Modules`, to be used as a mixin. + """ + + @property + def device(self) -> torch.device: + """ + `torch.device`: The device on which the module is (assuming that all the module parameters are on the same + device). + """ + return next(param.device for param in self.parameters()) + + @property + def dtype(self) -> torch.dtype: + """ + `torch.dtype`: The dtype of the module (assuming that all the module parameters have the same dtype). + """ + return next(param.dtype for param in self.parameters() if param.is_floating_point()) + + def invert_attention_mask(self, encoder_attention_mask: Tensor) -> Tensor: + """ + Invert an attention mask (e.g., switches 0. and 1.). + + Args: + encoder_attention_mask (`torch.Tensor`): An attention mask. + + Returns: + `torch.Tensor`: The inverted attention mask. + """ + if encoder_attention_mask.dim() == 3: + encoder_extended_attention_mask = encoder_attention_mask[:, None, :, :] + if encoder_attention_mask.dim() == 2: + encoder_extended_attention_mask = encoder_attention_mask[:, None, None, :] + # T5 has a mask that can compare sequence ids, we can simulate this here with this transposition + # encoder_extended_attention_mask = (encoder_extended_attention_mask == + # encoder_extended_attention_mask.transpose(-1, -2)) + encoder_extended_attention_mask = encoder_extended_attention_mask.to(dtype=self.dtype) # fp16 compatibility + encoder_extended_attention_mask = (1.0 - encoder_extended_attention_mask) * torch.finfo(self.dtype).min + + return encoder_extended_attention_mask + + @staticmethod + def create_extended_attention_mask_for_decoder(input_shape, attention_mask): + device = attention_mask.device + batch_size, seq_length = input_shape + seq_ids = torch.arange(seq_length, device=device) + causal_mask = seq_ids[None, None, :].repeat(batch_size, seq_length, 1) <= seq_ids[None, :, None] + # in case past_key_values are used we need to add a prefix ones mask to the causal mask + causal_mask = causal_mask.to(attention_mask.dtype) + + if causal_mask.shape[1] < attention_mask.shape[1]: + prefix_seq_len = attention_mask.shape[1] - causal_mask.shape[1] + causal_mask = torch.cat( + [ + torch.ones((batch_size, seq_length, prefix_seq_len), device=device, dtype=causal_mask.dtype), + causal_mask, + ], + axis=-1, + ) + + extended_attention_mask = causal_mask[:, None, :, :] * attention_mask[:, None, None, :] + return extended_attention_mask + + def get_extended_attention_mask( + self, + attention_mask: Tensor, + input_shape: tuple[int, ...], + dtype: torch.dtype | None = None, + ) -> Tensor: + """ + Makes broadcastable attention and causal masks so that future and masked tokens are ignored. + + Arguments: + attention_mask (`torch.Tensor`): + Mask with ones indicating tokens to attend to, zeros for tokens to ignore. + input_shape (`tuple[int]`): + The shape of the input to the model. + + Returns: + `torch.Tensor` The extended attention mask, with a the same dtype as `attention_mask.dtype`. + """ + if dtype is None: + dtype = self.dtype + + # We can provide a self-attention mask of dimensions [batch_size, from_seq_length, to_seq_length] + # ourselves in which case we just need to make it broadcastable to all heads. + if attention_mask.dim() == 3: + extended_attention_mask = attention_mask[:, None, :, :] + elif attention_mask.dim() == 2: + # Provided a padding mask of dimensions [batch_size, seq_length] + # - if the model is a decoder, apply a causal mask in addition to the padding mask + # - if the model is an encoder, make the mask broadcastable to [batch_size, num_heads, seq_length, seq_length] + if getattr(self.config, "is_decoder", None): + extended_attention_mask = ModuleUtilsMixin.create_extended_attention_mask_for_decoder( + input_shape, attention_mask + ) + else: + extended_attention_mask = attention_mask[:, None, None, :] + else: + raise ValueError( + f"Wrong shape for input_ids (shape {input_shape}) or attention_mask (shape {attention_mask.shape})" + ) + + # Since attention_mask is 1.0 for positions we want to attend and 0.0 for + # masked positions, this operation will create a tensor which is 0.0 for + # positions we want to attend and the dtype's smallest value for masked positions. + # Since we are adding it to the raw scores before the softmax, this is + # effectively the same as removing these entirely. + extended_attention_mask = extended_attention_mask.to(dtype=dtype) # fp16 compatibility + extended_attention_mask = (1.0 - extended_attention_mask) * torch.finfo(dtype).min + return extended_attention_mask + + def num_parameters(self, only_trainable: bool = False, exclude_embeddings: bool = False) -> int: + """ + Get number of (optionally, trainable or non-embeddings) parameters in the module. + + Args: + only_trainable (`bool`, *optional*, defaults to `False`): + Whether or not to return only the number of trainable parameters + + exclude_embeddings (`bool`, *optional*, defaults to `False`): + Whether or not to return only the number of non-embeddings parameters + + Returns: + `int`: The number of parameters. + """ + + if exclude_embeddings: + embedding_param_names = [ + f"{name}.weight" for name, module_type in self.named_modules() if isinstance(module_type, nn.Embedding) + ] + + is_loaded_in_4bit = getattr(self, "is_loaded_in_4bit", False) + if is_loaded_in_4bit: + import bitsandbytes as bnb + + total_params = 0 + for name, param in self.named_parameters(): + if exclude_embeddings and name in embedding_param_names: + continue + if param.requires_grad or not only_trainable: + # For 4bit models, we need to multiply the number of parameters by 2 as half of the parameters are + # used for the 4bit quantization (uint8 tensors are stored) + if is_loaded_in_4bit and isinstance(param, bnb.nn.Params4bit): + if hasattr(param, "element_size"): + num_bytes = param.element_size() + elif hasattr(param, "quant_storage"): + num_bytes = param.quant_storage.itemsize + else: + num_bytes = 1 + total_params += param.numel() * 2 * num_bytes + else: + total_params += param.numel() + + return total_params + + +class EmbeddingAccessMixin: + """ + Base utilities to regroup getters and setters for embeddings. + Introduces the `input_layer_embed` attribute, which indicates + where the input embeddings come from and where they + should be set. + """ + + _input_embed_layer = "embed_tokens" # default layer that holds input embeddings. + + def get_input_embeddings(self) -> nn.Module: + """ + Returns the model's input embeddings. + + Returns: + `nn.Module`: A torch module mapping vocabulary to hidden states. + """ + + name = getattr(self, "_input_embed_layer", "embed_tokens") + + # 1) Direct attribute (most NLP models). + if (default_embedding := getattr(self, name, None)) is not None: + return default_embedding + # 2) Nested embeddings (e.g., self.embeddings.patch_embedding for vision/audio models). + if hasattr(self, "embeddings") and hasattr(self.embeddings, name): + return getattr(self.embeddings, name) + # 3) Encoder/decoder wrappers (e.g., `self.model.embed_tokens` or similar overrides). + if hasattr(self, "model") and hasattr(self.model, name): + return getattr(self.model, name) + + if hasattr(self, "base_model"): + base_model = self.base_model + if base_model is not None and base_model is not self: + return base_model.get_input_embeddings() + + raise NotImplementedError( + f"`get_input_embeddings` not auto‑handled for {self.__class__.__name__}; please override in the subclass." + ) + + def set_input_embeddings(self, value: nn.Module): + """Fallback setter that handles **~70%** of models in the code-base. + + Order of attempts: + 1. `self.<_input_embed_layer>` (direct attribute) + 2. `self.embeddings.<_input_embed_layer>` (nested embeddings for vision/audio models) + 3. `self.model.<_input_embed_layer>` (encoder/decoder models) + 4. delegate to the *base model* if one exists + 5. otherwise raise `NotImplementedError` so subclasses still can (and + should) override for exotic layouts. + """ + + name = getattr(self, "_input_embed_layer", "embed_tokens") + # 1) Direct attribute (most NLP models) + if hasattr(self, name): + setattr(self, name, value) + # 2) Nested embeddings (e.g., self.embeddings.patch_embedding for vision models) + elif hasattr(self, "embeddings") and hasattr(self.embeddings, name): + setattr(self.embeddings, name, value) + # 3) encoder/decoder and VLMs like `Gemma3nForConditionalGeneration` + elif hasattr(self, "model") and hasattr(self.model, name): + setattr(self.model, name, value) + # 4) recurse once into the registered *base* model (e.g. for encoder/decoder) + elif hasattr(self, "base_model") and self.base_model is not self: + self.base_model.set_input_embeddings(value) + else: + raise NotImplementedError( + f"`set_input_embeddings` not auto‑handled for {self.__class__.__name__}; please override in the subclass." + ) + + def get_output_embeddings(self): + if not hasattr(self, "lm_head"): + return None + try: + # Speech / vision backbones raise here, so we return None. + # Legit use of get_input_embs? + self.get_input_embeddings() + except NotImplementedError: + return None + return self.lm_head + + def set_output_embeddings(self, new_embeddings): + """ + Sets the model's output embedding, defaulting to setting new_embeddings to lm_head. + """ + if getattr(self, "lm_head"): + self.lm_head = new_embeddings + + +class PreTrainedModel(nn.Module, EmbeddingAccessMixin, ModuleUtilsMixin, PushToHubMixin, PeftAdapterMixin): + r""" + Base class for all models. + + [`PreTrainedModel`] takes care of storing the configuration of the models and handles methods for loading, + downloading and saving models as well as a few methods common to all models to: + + - resize the input embeddings + + Class attributes (overridden by derived classes): + + - **config_class** ([`PreTrainedConfig`]) -- A subclass of [`PreTrainedConfig`] to use as configuration class + for this model architecture. + - **base_model_prefix** (`str`) -- A string indicating the attribute associated to the base model in derived + classes of the same architecture adding modules on top of the base model. + - **main_input_name** (`str`) -- The name of the principal input to the model (often `input_ids` for NLP + models, `pixel_values` for vision models and `input_values` for speech models). + - **can_record_outputs** (dict): + """ + + # General model properties + config_class: type[PreTrainedConfig] | None = None + _auto_class = None + base_model_prefix: str = "" + _is_stateful: bool = False + model_tags: list[str] | None = None + + # Input-related properties + main_input_name: str = "input_ids" + # Attributes used mainly in multimodal LLMs, though all models contain a valid field for these + # Possible values are: text, image, video, audio and time + input_modalities: str | list[str] = "text" + + # Device-map related properties + _no_split_modules: set[str] | list[str] | None = None + _skip_keys_device_placement: str | list[str] | None = None + + # Specific dtype upcasting + # `_keep_in_fp32_modules` will upcast to fp32 only if the requested dtype is fp16 + # `_keep_in_fp32_modules_strict` will upcast to fp32 independently if the requested dtype is fp16 or bf16 + _keep_in_fp32_modules: set[str] | list[str] | None = None + _keep_in_fp32_modules_strict: set[str] | list[str] | None = None + + # Loading-specific properties + # A dictionary `{"target": "source"}` of checkpoint keys that are potentially tied to one another + _tied_weights_keys: dict[str, str] = None + # Used for BC support in VLMs, not meant to be used by new models + _checkpoint_conversion_mapping: dict[str, str] = {} + # A list of `re` patterns describing keys to ignore if they are missing from checkpoints to avoid warnings + _keys_to_ignore_on_load_missing: list[str] | None = None + # A list of `re` patterns describing keys to ignore if they are unexpected in the checkpoints to avoid warnings + _keys_to_ignore_on_load_unexpected: list[str] | None = None + # A list of keys to ignore when saving the model + _keys_to_ignore_on_save: list[str] | None = None + + # Attention interfaces support properties + _supports_sdpa: bool = False + _supports_flash_attn: bool = False + _supports_flex_attn: bool = False + + # Tensor-parallelism-related properties + # A tensor parallel plan of the form `{"model.layer.mlp.param": "colwise"}` to be applied to the model when TP is enabled. + # For top-level models, this attribute is currently defined in respective model code. For base models, this attribute comes + # from `config.base_model_tp_plan` during `post_init`. + _tp_plan: dict[str, str] = None + # Tensor parallel degree to which model is sharded to + _tp_size = None + # A pipeline parallel plan specifying the layers which may not be present on all ranks when PP is enabled. For top-level + # models, this attribute is currently defined in respective model code. For base models, it comes from + # `config.base_model_pp_plan` during `post_init`. + _pp_plan: dict[str, PipelineParallel] | None = None + + # Advanced functionalities support + supports_gradient_checkpointing: bool = False + _can_compile_fullgraph: bool = False + # This flag signal that the model can be used as an efficient backend in TGI and vLLM + # In practice, it means that they support attention (mask) interface functions, fully pass the kwargs + # through all modules up to the Attention layer, can slice logits with Tensor, and have a default TP plan + _supports_attention_backend: bool = False + # A mapping describing what outputs can be captured by `capture_outputs` decorator during the forward pass + _can_record_outputs: dict | None = None + + @property + @torch.compiler.allow_in_graph + def can_record_outputs(self) -> dict[str, OutputRecorder]: + """ + Maps output names (e.g., "attentions", "hidden_states") + to either: + - A module class (e.g., `LlamaDecoderLayer`), using default index conventions: + * index=0 for "hidden_states" + * index=1 for "attentions" + - Or an `OutputRecorder(...)` with `target_class`, optional `index`, and `layer_name`. + + Examples: + These two are equivalent: + + ```python + _can_record_outputs = { + "attentions": LlamaAttention, + "hidden_states": LlamaDecoderLayer + } + + _can_record_outputs = { + "attentions": OutputRecorder(LlamaAttention, index=1), + "hidden_states": OutputRecorder(LlamaDecoderLayer, index=0) + } + ``` + + This means you can record outputs from the same class, by specifying a layer name. Before + collecting outputs, we check that they come from this layer. + + If you have cross attention that come from `LlamaAttention` and self attention that also + come from `LlamaAttention` but from `self_attn` you can do this: + + ```python + class LlamaModel(PreTrainedModel): + _can_record_outputs = { + "attentions": OutputRecorder(LlamaAttention, index=1, layer-name="self_attn"), + "cross_attentions": OutputRecorder(LlamaAttention, index=1, layer_name="cross_attn") + } + + ``` + """ + return self._can_record_outputs or {} + + @property + def dummy_inputs(self) -> dict[str, torch.Tensor]: + """ + `dict[str, torch.Tensor]`: Dummy inputs to do a forward pass in the network. + """ + return {"input_ids": torch.tensor(DUMMY_INPUTS)} + + def __init_subclass__(cls, **kwargs): + super().__init_subclass__(**kwargs) + # For BC we keep the original `config_class` definition in case + # there is a `config_class` attribute (e.g. remote code models), + # otherwise we derive it from the annotated `config` attribute. + + # defined in this particular subclass + child_annotation = cls.__dict__.get("__annotations__", {}).get("config", None) + child_attribute = cls.__dict__.get("config_class", None) + + # defined in the class (this subclass or any parent class) + full_annotation = get_type_hints(cls).get("config", None) + full_attribute = cls.config_class + + # priority (child class_config -> child annotation -> global class_config -> global annotation) + if child_attribute is not None: + cls.config_class = child_attribute + elif child_annotation is not None: + cls.config_class = child_annotation + elif full_attribute is not None: + cls.config_class = full_attribute + elif full_annotation is not None: + cls.config_class = full_annotation + + def __init__(self, config: PreTrainedConfig, *inputs, **kwargs): + super().__init__() + if not isinstance(config, PreTrainedConfig): + raise TypeError( + f"Parameter config in `{self.__class__.__name__}(config)` should be an instance of class " + "`PreTrainedConfig`. To create a model from a pretrained model use " + f"`model = {self.__class__.__name__}.from_pretrained(PRETRAINED_MODEL_NAME)`" + ) + self.config = config + self.name_or_path = config.name_or_path + + # Check the attention implementation is supported, or set it if not yet set (on the internal attr, to avoid + # setting it recursively) + self.config._attn_implementation_internal = self._check_and_adjust_attn_implementation( + self.config._attn_implementation, is_init_check=True + ) + # Check the experts implementation is supported, or set it if not yet set (on the internal attr, to avoid + # setting it recursively) + self.config._experts_implementation_internal = self._check_and_adjust_experts_implementation( + self.config._experts_implementation + ) + if self.can_generate(): + self.generation_config = GenerationConfig.from_model_config(config) + + # for initialization of the loss + loss_type = self.__class__.__name__ + if loss_type not in LOSS_MAPPING: + loss_groups = f"({'|'.join(LOSS_MAPPING)})" + loss_type = re.findall(loss_groups, self.__class__.__name__) + if len(loss_type) > 0: + loss_type = loss_type[0] + else: + loss_type = None + self.loss_type = loss_type + + _CAN_RECORD_REGISTRY[str(self.__class__)] = self._can_record_outputs # added for executorch support only + + def post_init(self): + """ + A method executed at the end of each Transformer model initialization, to execute code that needs the model's + modules properly initialized (such as weight initialization). + It is also used to obtain all correct static properties (parallelism plans, tied_weights_keys, _keep_in_fp32_modules, etc) + correctly in the case of composite models (that is, the top level model should know about those properties from its children). + """ + # Attach the different parallel plans and tied weight keys to the top-most model, so that everything is + # easily available + self._tp_plan, self._ep_plan, self._pp_plan = {}, {}, {} + # If current model is a base model, attach `base_model_tp_plan` and `base_model_pp_plan` from config + if self.base_model is self: + self._pp_plan = self.config.base_model_pp_plan.copy() if self.config.base_model_pp_plan is not None else {} + self._tp_plan = self.config.base_model_tp_plan.copy() if self.config.base_model_tp_plan is not None else {} + self._ep_plan = self.config.base_model_ep_plan.copy() if self.config.base_model_ep_plan is not None else {} + # Current submodel should register its tied weights + self.all_tied_weights_keys = self.get_expanded_tied_weights_keys(all_submodels=False) + # Current submodel should register its `_keep_in_fp32_modules` + self._keep_in_fp32_modules = set(self._keep_in_fp32_modules or []) + self._keep_in_fp32_modules_strict = set(self._keep_in_fp32_modules_strict or []) + # Current submodel must register its `_no_split_modules` as well + self._no_split_modules = set(self._no_split_modules or []) + + # Iterate over children only: as the final model is created, this is enough to gather the properties from all submodels. + # This works because the way the `__init__` and `post_init` are called on all submodules is depth-first in the graph + for name, module in self.named_children(): + # Parallel plans + if plan := getattr(module, "_ep_plan", None): + self._ep_plan.update({f"{name}.{k}": v for k, v in plan.copy().items()}) + if plan := getattr(module, "_tp_plan", None): + self._tp_plan.update({f"{name}.{k}": v for k, v in plan.copy().items()}) + if plan := getattr(module, "_pp_plan", None): + self._pp_plan.update({f"{name}.{k}": v for k, v in plan.copy().items()}) + # Always attach the keys of the children (if the children's config says to NOT tie, then it's empty) + if tied_keys := getattr(module, "all_tied_weights_keys", None): + self.all_tied_weights_keys.update({f"{name}.{k}": f"{name}.{v}" for k, v in tied_keys.copy().items()}) + # Record keep_in_fp_32 modules from the children as well + if keep_fp32 := getattr(module, "_keep_in_fp32_modules", None): + self._keep_in_fp32_modules.update(keep_fp32) + if keep_fp32_strict := getattr(module, "_keep_in_fp32_modules_strict", None): + self._keep_in_fp32_modules_strict.update(keep_fp32_strict) + # Record `_no_split_modules` from the children + if no_split := getattr(module, "_no_split_modules", None): + self._no_split_modules.update(no_split) + + # Maybe initialize the weights and tie the keys + self.init_weights() + self._backward_compatibility_gradient_checkpointing() + + @property + def tp_plan(self) -> dict[str, str]: + """ + The full tp plan for the model's modules + """ + if hasattr(self.config, "distributed_config") and self.config.distributed_config.enable_expert_parallel: + return self._ep_plan + return self._tp_plan + + @property + def pp_plan(self) -> dict[str, tuple[str, str]]: + return self._pp_plan + + @tp_plan.setter + def tp_plan(self, plan: dict[str, str] | None): + if plan is None: + self._tp_plan = {} + return + if not isinstance(plan, dict): + raise ValueError("Can only set a dictionary as `tp_plan`") + + # Ensure the styles are all valid + for layer_pattern, parallel_style in plan.items(): + if parallel_style not in ALL_PARALLEL_STYLES: + raise ValueError( + f"Unsupported tensor parallel style '{parallel_style}' for layer '{layer_pattern}'. " + f"Supported styles are {list(ALL_PARALLEL_STYLES.keys())}" + ) + + # Validate that the layer patterns match existing model structure. We check this by getting all parameter + # names and seeing if any match the patterns + model_param_names = [name for name, _ in self.named_parameters()] + for layer_pattern in plan.keys(): + # Convert pattern to regex (replace * with .*) + regex_pattern = layer_pattern.replace("*", r"\d+") + pattern_matched = False + for param_name in model_param_names: + if re.match(regex_pattern, param_name): + pattern_matched = True + break + if not pattern_matched: + warnings.warn( + f"Layer pattern '{layer_pattern}' does not match any parameters in the model. This rule may not " + "be applied during tensor parallelization, or may lead to dimension mismatches" + ) + + # Set the plan + self._tp_plan = plan + + @pp_plan.setter + def pp_plan(self, plan: dict[str, tuple[str, str]]): + self._pp_plan = plan + + def dequantize(self, dtype=None): + """ + Potentially dequantize the model in case it has been quantized by a quantization method that support + dequantization. + """ + hf_quantizer = getattr(self, "hf_quantizer", None) + + if hf_quantizer is None: + raise ValueError("You need to first quantize your model in order to dequantize it") + + return hf_quantizer.dequantize(self, dtype=dtype) + + def _backward_compatibility_gradient_checkpointing(self): + if self.supports_gradient_checkpointing and getattr(self.config, "gradient_checkpointing", False): + self.gradient_checkpointing_enable() + # Remove the attribute now that is has been consumed, so it's no saved in the config. + delattr(self.config, "gradient_checkpointing") + + def add_model_tags(self, tags: list[str] | str) -> None: + r""" + Add custom tags into the model that gets pushed to the Hugging Face Hub. Will + not overwrite existing tags in the model. + + Args: + tags (`Union[list[str], str]`): + The desired tags to inject in the model + + Examples: + + ```python + from transformers import AutoModel + + model = AutoModel.from_pretrained("google-bert/bert-base-cased") + + model.add_model_tags(["custom", "custom-bert"]) + + # Push the model to your namespace with the name "my-custom-bert". + model.push_to_hub("my-custom-bert") + ``` + """ + if isinstance(tags, str): + tags = [tags] + + if self.model_tags is None: + self.model_tags = [] + + for tag in tags: + if tag not in self.model_tags: + self.model_tags.append(tag) + + @classmethod + def _from_config(cls, config, **kwargs): + """ + All context managers that the model should be initialized under go here. + + Args: + dtype (`torch.dtype`, *optional*): + Override the default `dtype` and load the model under this dtype. + """ + # For BC on the old `torch_dtype` + dtype = kwargs.pop("dtype", config.dtype) + if (torch_dtype := kwargs.pop("torch_dtype", None)) is not None: + logger.warning_once("`torch_dtype` is deprecated! Use `dtype` instead!") + # if both kwargs are provided, use `dtype` + dtype = dtype if dtype != config.dtype else torch_dtype + if isinstance(dtype, str): + dtype = getattr(torch, dtype) + + # If passing `attn_implementation` as kwargs, respect it (it will be applied recursively on subconfigs) + if "attn_implementation" in kwargs: + config._attn_implementation = kwargs.pop("attn_implementation") + + # If passing `experts_implementation` as kwargs, respect it (it will be applied recursively on subconfigs) + if "experts_implementation" in kwargs: + config._experts_implementation = kwargs.pop("experts_implementation") + + init_contexts = [] + if dtype is not None: + init_contexts.append(local_torch_dtype(dtype, cls.__name__)) + + if is_deepspeed_zero3_enabled() and not _is_quantized and not _is_ds_init_called: + logger.info("Detected DeepSpeed ZeRO-3: activating zero.init() for this model") + # this immediately partitions the model across all gpus, to avoid the overhead in time + # and memory copying it on CPU or each GPU first + import deepspeed + + init_contexts.extend([deepspeed.zero.Init(config_dict_or_path=deepspeed_config()), set_zero3_state()]) + + # Instantiate the model + with ContextManagers(init_contexts): + model = cls(config, **kwargs) + + return model + + @property + def base_model(self) -> nn.Module: + """ + `torch.nn.Module`: The main body of the model. + """ + return getattr(self, self.base_model_prefix, self) + + @classmethod + def can_generate(cls) -> bool: + """ + Returns whether this model can generate sequences with `.generate()` from the `GenerationMixin`. + + Under the hood, on classes where this function returns True, some generation-specific changes are triggered: + for instance, the model instance will have a populated `generation_config` attribute. + + Returns: + `bool`: Whether this model can generate sequences with `.generate()`. + """ + # Directly inherits `GenerationMixin` -> can generate + if "GenerationMixin" in str(cls.__bases__): + return True + # The class inherits from a class that can generate (recursive check) -> can generate + for base in cls.__bases__: + if not hasattr(base, "can_generate"): + continue + if "PreTrainedModel" not in str(base) and base.can_generate(): + return True + # Detects whether `prepare_inputs_for_generation` has been overwritten in the model. Prior to v4.45, this + # was how we detected whether a model could generate. + if hasattr(cls, "prepare_inputs_for_generation"): # implicit: doesn't inherit `GenerationMixin` + logger.warning( + f"{cls.__name__} has generative capabilities, as `prepare_inputs_for_generation` is explicitly " + "defined. However, it doesn't directly inherit from `GenerationMixin`. From 👉v4.50👈 onwards, " + "`PreTrainedModel` will NOT inherit from `GenerationMixin`, and this model will lose the ability " + "to call `generate` and other related functions." + "\n - If you're using `trust_remote_code=True`, you can get rid of this warning by loading the " + "model with an auto class. See https://huggingface.co/docs/transformers/en/model_doc/auto#auto-classes" + "\n - If you are the owner of the model architecture code, please modify your model class such that " + "it inherits from `GenerationMixin` (after `PreTrainedModel`, otherwise you'll get an exception)." + "\n - If you are not the owner of the model architecture class, please contact the model code owner " + "to update it." + ) + # Otherwise, can't generate + return False + + def _flash_attn_2_can_dispatch(self, is_init_check: bool = False) -> bool: + """ + Check the availability of Flash Attention 2 for a given model. + + Args: + is_init_check (`bool`, *optional*): + Whether this check is performed early, i.e. at __init__ time, or later when the model and its weights are + fully instantiated. This is needed as we also check the devices of the weights, which are only available + later after __init__. This allows to raise proper exceptions early before instantiating the full models + if we know that the model does not support the requested attention. + """ + dtype = self.config.dtype + + # check `supports_flash_attn_2` for BC with custom code. TODO: remove after a few releases + if not (self._supports_flash_attn or getattr(self, "_supports_flash_attn_2", False)): + raise ValueError( + f"{self.__class__.__name__} does not support Flash Attention 2.0 yet. Please request to add support where" + f" the model is hosted, on its model hub page: https://huggingface.co/{self.config._name_or_path}/discussions/new" + " or in the Transformers GitHub repo: https://github.com/huggingface/transformers/issues/new" + ) + + if not is_flash_attn_2_available(): + preface = "FlashAttention2 has been toggled on, but it cannot be used due to the following error:" + install_message = "Please refer to the documentation of https://huggingface.co/docs/transformers/perf_infer_gpu_one#flashattention-2 to install Flash Attention 2." + + # package `flash-attn` can not be installed on Ascend NPU, following validation logics can be ignored. + if is_torch_npu_available(): + logger.info("Detect using FlashAttention2 on Ascend NPU.") + return True + + if is_torch_xpu_available(): + logger.info( + f"Detect using FlashAttention2 (via kernel `{FLASH_ATTN_KERNEL_FALLBACK['flash_attention_2']}`) on XPU." + ) + return True + + if importlib.util.find_spec("flash_attn") is None: + raise ImportError(f"{preface} the package flash_attn seems to be not installed. {install_message}") + else: + # Check FA2 installed version compatibility + flash_attention_version = version.parse(importlib.metadata.version("flash_attn")) + if torch.version.cuda: + if flash_attention_version < version.parse("2.1.0"): + raise ImportError( + f"{preface} you need flash_attn package version to be greater or equal than 2.1.0. Detected version {flash_attention_version}. {install_message}" + ) + elif not torch.cuda.is_available(): + raise ValueError( + f"{preface} Flash Attention 2 is not available on CPU. Please make sure torch can access a CUDA device." + ) + else: + raise ImportError(f"{preface} Flash Attention 2 is not available. {install_message}") + elif torch.version.hip: + if flash_attention_version < version.parse("2.0.4"): + raise ImportError( + f"{preface} you need flash_attn package version to be greater or equal than 2.0.4. Detected version {flash_attention_version}. {install_message}" + ) + else: + raise ImportError(f"{preface} Flash Attention 2 is not available. {install_message}") + + if dtype is None: + logger.warning_once( + "You are attempting to use Flash Attention 2 without specifying a torch dtype. This might lead to unexpected behaviour" + ) + elif dtype is not None and dtype not in [torch.float16, torch.bfloat16]: + logger.warning_once( + "Flash Attention 2 only supports torch.float16 and torch.bfloat16 dtypes, but" + f" the current dype in {self.__class__.__name__} is {dtype}. You should run training or inference using Automatic Mixed-Precision via the `with torch.autocast(device_type='torch_device'):` decorator," + ' or load the model with the `dtype` argument. Example: `model = AutoModel.from_pretrained("openai/whisper-tiny", attn_implementation="flash_attention_2", dtype=torch.float16)`' + ) + + # With the early check, the parameters are not yet initialized correctly + if not is_init_check: + param_devices = list({param.device for param in self.parameters()}) + if len(param_devices) == 1 and param_devices[0].type == "cpu": + if torch.cuda.is_available(): + logger.warning_once( + "You are attempting to use Flash Attention 2 with a model not initialized on GPU. Make sure to move the model to GPU" + " after initializing it on CPU with `model.to('cuda')`." + ) + elif is_torch_mlu_available(): + logger.warning_once( + "You are attempting to use Flash Attention 2 with a model not initialized on MLU. Make sure to move the model to MLU" + " after initializing it on CPU with `model.to('mlu')`." + ) + else: + raise ValueError( + "You are attempting to use Flash Attention 2 with a model not initialized on GPU and with no GPU available. " + "This is not supported yet. Please make sure to have access to a GPU and either initialise the model on a GPU by passing a device_map " + "or initialising the model on CPU and then moving it to GPU." + ) + + # If no error raise by this point, we can return `True` + return True + + def _flash_attn_3_can_dispatch(self, is_init_check: bool = False) -> bool: + """ + Check the availability of Flash Attention 3 for a given model. + + Args: + is_init_check (`bool`, *optional*): + Whether this check is performed early, i.e. at __init__ time, or later when the model and its weights are + fully instantiated. This is needed as we also check the devices of the weights, which are only available + later after __init__. This allows to raise proper exceptions early before instantiating the full models + if we know that the model does not support the requested attention. + """ + dtype = self.config.dtype + + if not self._supports_flash_attn: + raise ValueError( + f"{self.__class__.__name__} does not support Flash Attention 3 yet. Please request to add support where" + f" the model is hosted, on its model hub page: https://huggingface.co/{self.config._name_or_path}/discussions/new" + " or in the Transformers GitHub repo: https://github.com/huggingface/transformers/issues/new" + ) + + if not is_flash_attn_3_available(): + preface = "FlashAttention3 has been toggled on, but it cannot be used due to the following error:" + + if importlib.util.find_spec("flash_attn_3") is None: + raise ImportError(f"{preface} the package flash_attn_3 seems to be not installed.") + + if torch.cuda.is_available(): + major, _ = torch.cuda.get_device_capability() + if major < 9: + raise ValueError( + f"{preface} Flash Attention 3 requires compute capability >= 9.0, but found {torch.cuda.get_device_capability()} with compute capability {major}.0." + ) + else: + raise ImportError(f"{preface} Flash Attention 3 is not available.") + else: + raise ValueError( + f"{preface} Flash Attention 3 is not available on CPU. Please make sure torch can access a CUDA device." + ) + + if dtype is None: + logger.warning_once( + "You are attempting to use Flash Attention 3 without specifying a torch dtype. This might lead to unexpected behaviour" + ) + elif dtype is not None and dtype not in [torch.float16, torch.bfloat16]: + logger.warning_once( + "Flash Attention 3 only supports torch.float16 and torch.bfloat16 dtypes, but" + f" the current dype in {self.__class__.__name__} is {dtype}. You should run training or inference using Automatic Mixed-Precision via the `with torch.autocast(device_type='torch_device'):` decorator," + ' or load the model with the `dtype` argument. Example: `model = AutoModel.from_pretrained("meta-llama/Llama-3.2-1B", attn_implementation="flash_attention_3", dtype=torch.float16)`' + ) + + if getattr(self.config, "alibi", False) or getattr(self.config, "use_alibi", False): + raise ValueError("Model is configured to use ALiBi, which is not supported by Flash Attention 3.") + + # Check for attention dropout, which is incompatible with FA3 + if hasattr(self.config, "attention_dropout") and self.config.attention_dropout > 0: + raise ValueError( + f"Model has attention_dropout={self.config.attention_dropout}, which is not supported by Flash Attention 3." + ) + + # With the early check, the parameters are not yet initialized correctly + if not is_init_check: + param_devices = list({param.device for param in self.parameters()}) + if len(param_devices) == 1 and param_devices[0].type == "cpu": + if torch.cuda.is_available(): + logger.warning_once( + "You are attempting to use Flash Attention 3 with a model not initialized on GPU. Make sure to move the model to GPU" + " after initializing it on CPU with `model.to('cuda')`." + ) + else: + raise ValueError( + "You are attempting to use Flash Attention 3 with a model not initialized on GPU and with no GPU available. " + "This is not supported yet. Please make sure to have access to a GPU and either initialise the model on a GPU by passing a device_map " + "or initialising the model on CPU and then moving it to GPU." + ) + + return True + + def _sdpa_can_dispatch(self, is_init_check: bool = False) -> bool: + """ + Check the availability of SDPA for a given model. + + Args: + is_init_check (`bool`, *optional*): + Whether this check is performed early, i.e. at __init__ time, or later when the model and its weights are + fully instantiated. This is needed as we also check the devices of the weights, which are only available + later after __init__. This allows to raise proper exceptions early before instantiating the full models + if we know that the model does not support the requested attention. + """ + if not self._supports_sdpa: + raise ValueError( + f"{self.__class__.__name__} does not support an attention implementation through torch.nn.functional.scaled_dot_product_attention yet." + " Please request the support for this architecture: https://github.com/huggingface/transformers/issues/28005. If you believe" + ' this error is a bug, please open an issue in Transformers GitHub repository and load your model with the argument `attn_implementation="eager"` meanwhile. Example: `model = AutoModel.from_pretrained("openai/whisper-tiny", attn_implementation="eager")`' + ) + + if ( + torch.version.hip is not None + and torch.cuda.device_count() > 1 + and version.parse(torch.__version__) < version.parse("2.4.1") + ): + logger.warning_once( + "Using the `SDPA` attention implementation on multi-gpu setup with ROCM may lead to performance issues due to the FA backend. Disabling it to use alternative backends." + ) + torch.backends.cuda.enable_flash_sdp(False) + + return True + + def _grouped_mm_can_dispatch(self) -> bool: + """ + Check the availability of Grouped MM for a given model. + """ + + if not self._can_set_experts_implementation(): + raise ValueError(f"{self.__class__.__name__} does not support setting experts implementation.") + + if not is_grouped_mm_available(): + raise ImportError( + "PyTorch Grouped MM requirements in Transformers are not met. Please install torch>=2.9.0." + ) + + # If no error raised by this point, we can return `True` + return True + + def _flex_attn_can_dispatch(self, is_init_check: bool = False) -> bool: + """ + Check the availability of Flex Attention for a given model. + + Args: + is_init_check (`bool`, *optional*): + Whether this check is performed early, i.e. at __init__ time, or later when the model and its weights are + fully instantiated. This is needed as we also check the devices of the weights, which are only available + later after __init__. This allows to raise proper exceptions early before instantiating the full models + if we know that the model does not support the requested attention. + """ + if not self._supports_flex_attn: + raise ValueError( + f"{self.__class__.__name__} does not support an attention implementation through torch's flex_attention." + " Please request the support for this architecture: https://github.com/huggingface/transformers/issues/34809." + " If you believe this error is a bug, please open an issue in Transformers GitHub repository" + ' and load your model with the argument `attn_implementation="eager"` meanwhile.' + ' Example: `model = AutoModel.from_pretrained("openai/whisper-tiny", attn_implementation="eager")`' + ) + if not is_torch_flex_attn_available(): + raise ImportError( + "PyTorch Flex Attention requirements in Transformers are not met. Please install torch>=2.5.0." + ) + + # If no error raise by this point, we can return `True` + return True + + def _check_and_adjust_attn_implementation( + self, attn_implementation: str | None, is_init_check: bool = False + ) -> str: + """ + Check that the `attn_implementation` exists and is supported by the models, and try to get the kernel from hub if + it matches hf kernels pattern. + + Args: + attn_implementation (`str` or `None`): + The attention implementation to check for existence/validity. + is_init_check (`bool`, *optional*): + Whether this check is performed early, i.e. at __init__ time, or later when the model and its weights are + fully instantiated. This is needed as we also check the devices of the weights, which are only available + later after __init__. This allows to raise proper exceptions early before instantiating the full models + if we know that the model does not support the requested attention. + + Returns: + `str`: The final attention implementation to use, including potential fallbacks from sdpa to eager, or from + None to sdpa (to potentially eager). + """ + applicable_attn_implementation = attn_implementation + + is_paged = attn_implementation is not None and attn_implementation.startswith("paged|") + + # If FA not installed, do not fail but use kernels instead + requested_original_flash_attn = attn_implementation is not None and ( + attn_implementation.removeprefix("paged|") == "flash_attention_2" + or attn_implementation.removeprefix("paged|") == "flash_attention_3" + ) + if ( + requested_original_flash_attn + and self._supports_flash_attn + and not (is_flash_attn_2_available() or is_flash_attn_3_available()) + and is_kernels_available() + and not is_torch_npu_available() + ): + applicable_attn_implementation = FLASH_ATTN_KERNEL_FALLBACK[attn_implementation.removeprefix("paged|")] + + if is_torch_xpu_available() and attn_implementation.removeprefix("paged|") == "flash_attention_2": + # On XPU, kernels library is the native implementation + # Disabling this flag to avoid giving wrong fallbacks on errors and warnings + requested_original_flash_attn = False + + if is_paged: + applicable_attn_implementation = f"paged|{applicable_attn_implementation}" + + if is_kernel(applicable_attn_implementation): + try: + # preload flash attention here to allow compile with fullgraph + if is_paged: + lazy_import_paged_flash_attention(applicable_attn_implementation) + else: + lazy_import_flash_attention(applicable_attn_implementation) + + # log that we used kernel fallback if successful + if requested_original_flash_attn: + logger.warning_once( + f"You do not have `flash_attn` installed, using `{applicable_attn_implementation}` " + "from the `kernels` library instead!" + ) + except Exception as e: + # raise the proper exception for requested flash attention + if requested_original_flash_attn: + if attn_implementation.endswith("2"): + self._flash_attn_2_can_dispatch() + else: + self._flash_attn_3_can_dispatch() + + # error properly out if a kernel was specifically requested + raise e + else: + applicable_attn_implementation = self.get_correct_attn_implementation( + applicable_attn_implementation, is_init_check + ) + + # preload flash attention here to allow compile with fullgraph + if is_flash_attention_requested(requested_attention_implementation=applicable_attn_implementation): + lazy_import_flash_attention(applicable_attn_implementation) + + return applicable_attn_implementation + + def _check_and_adjust_experts_implementation(self, experts_implementation: str | None) -> str: + """ + Check that the `experts_implementation` exists and is supported by the models. + + Args: + experts_implementation (`str` or `None`): + The experts implementation to check for existence/validity. + Returns: + `str`: The final experts implementation to use. + """ + applicable_experts_implementation = self.get_correct_experts_implementation(experts_implementation) + return applicable_experts_implementation + + def get_correct_attn_implementation(self, requested_attention: str | None, is_init_check: bool = False) -> str: + applicable_attention = "sdpa" if requested_attention is None else requested_attention + if applicable_attention not in ["eager"] + ALL_ATTENTION_FUNCTIONS.valid_keys(): + message = ( + f'Specified `attn_implementation="{applicable_attention}"` is not supported. The only possible arguments are ' + '`attn_implementation="eager"`, `"paged|eager"`' + ) + # check `supports_flash_attn_2` for BC with custom code. TODO: remove after a few releases + if self._supports_flash_attn or getattr(self, "_supports_flash_attn_2", False): + message += ', `"attn_implementation=flash_attention_3"`, `"attn_implementation=flash_attention_2"`, `"attn_implementation=paged|flash_attention_2"`' + if self._supports_sdpa: + message += ', `"attn_implementation=sdpa"`, `"attn_implementation=paged|sdpa"`' + if self._supports_flex_attn: + message += ', `"attn_implementation=flex_attention"`' + raise ValueError(message + ".") + + # Perform relevant checks + if "flash_attention_2" in applicable_attention: + self._flash_attn_2_can_dispatch(is_init_check) + elif "flash_attention_3" in applicable_attention: + self._flash_attn_3_can_dispatch(is_init_check) + elif "flex_attention" in applicable_attention: + self._flex_attn_can_dispatch(is_init_check) + elif "sdpa" in applicable_attention: + # Sdpa is the default, so we try it and fallback to eager otherwise when not possible + try: + self._sdpa_can_dispatch(is_init_check) + except (ValueError, ImportError) as e: + if requested_attention is not None and "sdpa" in requested_attention: + raise e + applicable_attention = "eager" + + return applicable_attention + + def get_correct_experts_implementation(self, requested_experts: str | None) -> str: + applicable_experts = "grouped_mm" if requested_experts is None else requested_experts + if applicable_experts not in ["eager", "grouped_mm", "batched_mm"]: + message = ( + f'Specified `experts_implementation="{applicable_experts}"` is not supported. The only possible arguments are ' + '`experts_implementation="eager"`, `"experts_implementation=grouped_mm"` and `"experts_implementation=batched_mm"`.' + ) + raise ValueError(message) + + # Perform relevant checks + if applicable_experts == "grouped_mm": + try: + self._grouped_mm_can_dispatch() + except (ValueError, ImportError) as e: + if requested_experts == "grouped_mm": + raise e + applicable_experts = "eager" + + return applicable_experts + + @classmethod + def _can_set_attn_implementation(cls) -> bool: + """Detect whether the class supports setting its attention implementation dynamically. It is an ugly check based on + opening the file, but avoids maintaining yet another property flag. + """ + class_module = sys.modules[cls.__module__] + # This can happen for a custom model in a jupyter notebook or repl for example - simply do not allow to set it then + if not hasattr(class_module, "__file__"): + return False + class_file = class_module.__file__ + with open(class_file, "r", encoding="utf-8") as f: + code = f.read() + # heuristic -> if we find those patterns, the model uses the correct interface + if re.search(r"class \w+Attention\(nn.Module\)", code): + return "eager_attention_forward" in code and "ALL_ATTENTION_FUNCTIONS.get_interface(" in code + else: + # If no attention layer, assume `True`. Most probably a multimodal model or inherits from existing models + return True + + @classmethod + def _can_set_experts_implementation(cls) -> bool: + """Detect whether the class supports setting its experts implementation dynamically. It is an ugly check based on + opening the file, but avoids maintaining yet another property flag. + """ + class_module = sys.modules[cls.__module__] + # This can happen for a custom model in a jupyter notebook or repl for example - simply do not allow to set it then + if not hasattr(class_module, "__file__"): + return False + class_file = class_module.__file__ + with open(class_file, "r", encoding="utf-8") as f: + code = f.read() + # heuristic -> if we the use_experts_implementation decorator is used, then we can set it + return "@use_experts_implementation" in code + + def set_attn_implementation(self, attn_implementation: str | dict): + """ + Set the requested `attn_implementation` for this model. + + Args: + attn_implementation (`str` or `dict`): + The attention implementation to set for this model. It can be either a `str`, in which case it will be + dispatched to all submodels if relevant, or a `dict` where keys are the sub_configs name, in which case each + submodel will dispatch the corresponding value. + """ + requested_implementation = ( + attn_implementation + if not isinstance(attn_implementation, dict) + else attn_implementation.get("", self.config._attn_implementation) + ) + + if requested_implementation != self.config._attn_implementation: + # In this case, raise + if not self._can_set_attn_implementation(): + logger.warning( + f"{self.__class__.__name__} does not support setting its attention implementation dynamically, because it " + "does not follow the functional approach based on AttentionInterface " + "(see https://huggingface.co/docs/transformers/en/attention_interface)" + ) + else: + requested_implementation = self._check_and_adjust_attn_implementation( + requested_implementation, is_init_check=False + ) + # Apply the change (on the internal attr, to avoid setting it recursively) + self.config._attn_implementation_internal = requested_implementation + + # Apply it to all submodels as well + for submodule in self.modules(): + # We found a submodel (which is not self) with a different config (otherwise, it may be the same "actual model", + # e.g. ForCausalLM has a Model inside, but no need to check it again) + if ( + submodule is not self + and isinstance(submodule, PreTrainedModel) + and submodule.config.__class__ != self.config.__class__ + # If it was already changed, no need to do it again + and not hasattr(submodule.config, "_attn_was_changed") + ): + # In this case, warn and skip + if not submodule._can_set_attn_implementation(): + logger.warning( + f"{submodule.__class__.__name__} does not support setting its attention implementation dynamically, because it " + "does not follow the functional approach based on AttentionInterface " + "(see https://huggingface.co/docs/transformers/en/attention_interface)" + ) + # Set the attn on the submodule + else: + sub_implementation = requested_implementation + if isinstance(attn_implementation, dict): + for subconfig_key in self.config.sub_configs: + # We need to check for exact object match here, with `is` + if getattr(self.config, subconfig_key) is submodule.config: + sub_implementation = attn_implementation.get( + subconfig_key, submodule.config._attn_implementation + ) + break + # Check the module can use correctly, otherwise we raise an error if requested attention can't be set for submodule + sub_implementation = submodule.get_correct_attn_implementation(sub_implementation) + submodule.config._attn_implementation_internal = sub_implementation + + # Still add it as "changed" even if it was skipped, as we would otherwise try to set it in the dark afterwards + # We need to set it on the config itself, to differentiate 2 subconfigs of the same __class__ potentially + submodule.config._attn_was_changed = True + + # We need this as some old and badly designed models use subconfigs without declaring the corresponding modules as PreTrainedModel + for subconfig_key in self.config.sub_configs: + if (subconfig := getattr(self.config, subconfig_key)) is not None: + sub_implementation = ( + requested_implementation + if not isinstance(attn_implementation, dict) + else attn_implementation.get(subconfig_key, subconfig._attn_implementation) + ) + # This means we did not perform any check above for this particular subconfig -> set it in the dark if it is registered + if ( + not hasattr(subconfig, "_attn_was_changed") + # If it's already the same, then no need to enter here and raise warnings + and sub_implementation != subconfig._attn_implementation + ): + if sub_implementation not in ["eager"] + ALL_ATTENTION_FUNCTIONS.valid_keys(): + raise ValueError( + f'Specified `attn_implementation="{sub_implementation}"` is not supported for {subconfig_key}. ' + 'The only possible arguments are "eager" (manual attention implementation)' + f"or one of the following: {list(ALL_ATTENTION_FUNCTIONS.valid_keys())}" + ) + subconfig._attn_implementation_internal = sub_implementation + logger.warning( + f"We set the attention implementation for the sub-config `{subconfig_key}` to `{sub_implementation}` " + "without finding the associated sub-model. For this reason we could not check if the model supports it. " + "You may encounter undefined behavior." + ) + # Unset the attribute in this case, to avoid issues in the future + else: + if hasattr(subconfig, "_attn_was_changed"): + del subconfig._attn_was_changed + + def set_experts_implementation(self, experts_implementation: str | dict): + """ + Set the requested `experts_implementation` for this model. + + Args: + experts_implementation (`str` or `dict`): + The experts implementation to set for this model. It can be either a `str`, in which case it will be + dispatched to all submodels if relevant, or a `dict` where keys are the sub_configs name, in which case each + submodel will dispatch the corresponding value. + """ + requested_implementation = ( + experts_implementation + if not isinstance(experts_implementation, dict) + else experts_implementation.get("", self.config._experts_implementation) + ) + + if requested_implementation != self.config._experts_implementation: + requested_implementation = self._check_and_adjust_experts_implementation(requested_implementation) + # Apply the change (on the internal attr, to avoid setting it recursively) + self.config._experts_implementation_internal = requested_implementation + + # Apply it to all submodels as well + for submodule in self.modules(): + # We found a submodel (which is not self) with a different config (otherwise, it may be the same "actual model", + # e.g. ForCausalLM has a Model inside, but no need to check it again) + if ( + submodule is not self + and isinstance(submodule, PreTrainedModel) + and submodule.config.__class__ != self.config.__class__ + ): + # Set the experts on the submodule + sub_implementation = requested_implementation + if isinstance(experts_implementation, dict): + for subconfig_key in self.config.sub_configs: + # We need to check for exact object match here, with `is` + if getattr(self.config, subconfig_key) is submodule.config: + sub_implementation = experts_implementation.get( + subconfig_key, submodule.config._experts_implementation + ) + break + # Check the module can use correctly, otherwise we raise an error if requested experts can't be set for submodule + sub_implementation = submodule.get_correct_experts_implementation(sub_implementation) + submodule.config._experts_implementation_internal = sub_implementation + + def enable_input_require_grads(self): + """ + Enables the gradients for the input embeddings. This is useful for fine-tuning adapter weights while keeping + the model weights fixed. + """ + + def make_inputs_require_grads(module, input, output): + output.requires_grad_(True) + + hooks = [] + seen_modules = set() + found_embeddings = False + + for module in self.modules(): + if not (isinstance(module, PreTrainedModel) and hasattr(module, "get_input_embeddings")): + continue + + try: + input_embeddings = module.get_input_embeddings() + except NotImplementedError: + continue + + if input_embeddings is None or not hasattr(input_embeddings, "register_forward_hook"): + continue + + embedding_id = id(input_embeddings) + if embedding_id in seen_modules: + continue + + seen_modules.add(embedding_id) + hooks.append(input_embeddings.register_forward_hook(make_inputs_require_grads)) + found_embeddings = True + + self._require_grads_hooks = hooks + if hooks: + # for BC + self._require_grads_hook = hooks[0] + if not found_embeddings: + logger.warning_once( + f"{self.__class__.__name__} does not expose input embeddings. Gradients cannot flow back to the token " + "embeddings when using adapters or gradient checkpointing. Override `get_input_embeddings` to fully " + "support those features, or set `_input_embed_layer` to the attribute name that holds the embeddings." + ) + + def disable_input_require_grads(self): + """ + Removes the `_require_grads_hook`. + """ + hooks = getattr(self, "_require_grads_hooks", None) + if not hooks: + return + + for hook in hooks: + hook.remove() + + self._require_grads_hooks = [] + if hasattr(self, "_require_grads_hook"): + del self._require_grads_hook + + def get_encoder(self, modality: str | None = None): + """ + Best-effort lookup of the *encoder* module. If provided with `modality` argument, + it looks for a modality-specific encoder in multimodal models (e.g. "image_encoder") + By default the function returns model's text encoder if any, and otherwise returns `self`. + + Possible `modality` values are "image", "video" and "audio". + """ + # NOTE: new models need to use existing names for layers if possible, so this list doesn't grow infinitely + if modality in ["image", "video"]: + possible_module_names = ["vision_tower", "visual", "vision_model", "vision_encoder", "image_tower"] + elif modality == "audio": + possible_module_names = ["audio_tower", "audio_encoder", "speech_encoder"] + elif modality is None: + possible_module_names = ["text_encoder", "encoder"] + else: + raise ValueError(f'Unnrecognized modality, has to be "image", "video" or "audio" but found {modality}') + + for name in possible_module_names: + if hasattr(self, name): + return getattr(self, name) + + if self.base_model is not self and hasattr(self.base_model, "get_encoder"): + base_encoder = self.base_model.get_encoder(modality=modality) + # Base model will always have attr `get_encoder` if inherited from `PreTrainedModel` + # But it doesn't mean that the model has an encoder module, and we need to return `self` + if base_encoder != self.base_model: + return base_encoder + + # If this is a base transformer model (no encoder/model attributes), return self + return self + + def set_encoder(self, encoder, modality: str | None = None): + """ + Symmetric setter. Mirrors the lookup logic used in `get_encoder`. + """ + + # NOTE: new models need to use existing names for layers if possible, so this list doesn't grow infinitely + if modality in ["image", "video"]: + possible_module_names = ["vision_tower", "visual", "vision_model", "vision_encoder", "image_tower"] + if modality == "audio": + possible_module_names = ["audio_tower", "audio_encoder"] + elif modality is None: + possible_module_names = ["text_encoder", "encoder"] + else: + raise ValueError(f'Unnrecognized modality, has to be "image", "video" or "audio" but found {modality}') + + for name in possible_module_names: + if hasattr(self, name): + setattr(self, name, encoder) + return + + if self.base_model is not self: + if hasattr(self.base_model, "set_encoder"): + self.base_model.set_encoder(encoder, modality=modality) + else: + self.model = encoder + + def get_decoder(self): + """ + Best-effort lookup of the *decoder* module. + + Order of attempts (covers ~85 % of current usages): + + 1. `self.decoder/self.language_model/self.text_model` + 2. `self.base_model` (many wrappers store the decoder here) + 3. `self.base_model.get_decoder()` (nested wrappers) + 4. fallback: raise for the few exotic models that need a bespoke rule + """ + possible_module_names = ["language_model", "text_model", "decoder", "text_decoder"] + for name in possible_module_names: + if hasattr(self, name): + return getattr(self, name) + + if self.base_model is not self and hasattr(self.base_model, "get_decoder"): + return self.base_model.get_decoder() + + # If this is a base transformer model (no decoder/model attributes), return self + # This handles cases like MistralModel which is itself the decoder + return self + + def set_decoder(self, decoder): + """ + Symmetric setter. Mirrors the lookup logic used in `get_decoder`. + """ + + possible_module_names = ["language_model", "text_model", "decoder"] + for name in possible_module_names: + if hasattr(self, name): + setattr(self, name, decoder) + return + + if self.base_model is not self: + if hasattr(self.base_model, "set_decoder"): + self.base_model.set_decoder(decoder) + else: + self.model = decoder + + @torch.no_grad() + def _init_weights(self, module): + """ + Initialize the weights. This is quite general on purpose, in the spirit of what we usually do. For more complex + initialization scheme, it should be overridden by the derived `PreTrainedModel` class. In case a model adds an explicit + `nn.Parameter`, this method should also be overridden in order to initialize it correctly. + """ + if hasattr(self.config, "initializer_range"): + std = self.config.initializer_range or 0.02 + elif hasattr(self.config, "init_std"): + std = self.config.init_std + elif hasattr(self.config, "initializer_factor"): + std = self.config.initializer_factor + else: + # 0.02 is the standard default value across the library + std = getattr(self.config.get_text_config(), "initializer_range", 0.02) + + if isinstance(module, (nn.Linear, nn.Conv1d, nn.Conv2d, nn.Conv3d, nn.ConvTranspose1d, nn.ConvTranspose2d)): + if getattr(module, "weight", None) is not None: + init.normal_(module.weight, mean=0.0, std=std) + if module.bias is not None: + init.zeros_(module.bias) + elif isinstance(module, nn.Embedding): + init.normal_(module.weight, mean=0.0, std=std) + # Here we need the check explicitly, as we slice the weight in the `zeros_` call, so it looses the flag + if module.padding_idx is not None and not getattr(module.weight, "_is_hf_initialized", False): + init.zeros_(module.weight[module.padding_idx]) + elif isinstance(module, nn.MultiheadAttention): + # This uses torch's original init + module._reset_parameters() + # We cannot use `isinstance` on the RMSNorms or LayerNorms, as they usually are custom modules which change names + # between modelings (because they are prefixed with the model name) + elif ( + isinstance(module, (nn.GroupNorm, nn.BatchNorm1d, nn.BatchNorm2d, nn.BatchNorm3d)) + or "LayerNorm" in module.__class__.__name__ + or "RMSNorm" in module.__class__.__name__ + ): + # Norms can exist without weights (in which case they are None from torch primitives) + if getattr(module, "weight", None) is not None: + init.ones_(module.weight) + if getattr(module, "bias", None) is not None: + init.zeros_(module.bias) + # And the potential buffers for the BatchNorms + if getattr(module, "running_mean", None) is not None: + init.zeros_(module.running_mean) + init.ones_(module.running_var) + init.zeros_(module.num_batches_tracked) + # This matches all the usual RotaryEmbeddings modules + elif "RotaryEmbedding" in module.__class__.__name__ and hasattr(module, "original_inv_freq"): + rope_fn = ( + ROPE_INIT_FUNCTIONS[module.rope_type] + if module.rope_type != "default" + else module.compute_default_rope_parameters + ) + buffer_value, _ = rope_fn(module.config) + init.copy_(module.inv_freq, buffer_value) + init.copy_(module.original_inv_freq, buffer_value) + + def _initialize_weights(self, module): + """ + Initialize the weights if they are not already initialized. + """ + if getattr(module, "_is_hf_initialized", False): + return + + if ( + (weight := getattr(module, "weight", None)) is not None + and getattr(weight, "_is_hf_initialized", False) + and not list(module.named_buffers()) + ): + module._is_hf_initialized = True + return + + self._init_weights(module) + module._is_hf_initialized = True + + @torch.no_grad() + @init.guard_torch_init_functions() + def initialize_weights(self): + """ + This is equivalent to calling `self.apply(self._initialize_weights)`, but correctly handles composite models. + This function dynamically dispatches the correct `init_weights` function to the modules as we advance in the + module graph along the recursion. It can handle an arbitrary number of sub-models. Without it, every composite + model would have to recurse a second time on all sub-models explicitly in the outer-most `_init_weights`, which + is extremely error prone and inefficient. + """ + if not hasattr(torch.nn.Module, "smart_apply"): + # This function is equivalent to `torch.nn.Module.apply`, except that it dynamically adjust the function + # to apply as we go down the graph + def smart_apply(self, fn): + for module in self.children(): + # We found a sub-model: recursively dispatch its own init function now! + if isinstance(module, PreTrainedModel): + module.smart_apply(module._initialize_weights) + else: + module.smart_apply(fn) + fn(self) + return self + + torch.nn.Module.smart_apply = smart_apply + + # Let the magic happen with this simple call + self.smart_apply(self._initialize_weights) + + def get_expanded_tied_weights_keys(self, all_submodels: bool = False) -> dict: + r""" + Return the expanded tied weight keys (in case they contain modules or regex patterns) for only the current + model, or recursively for all submodels if `all_submodels=True` (i.e. it will re-check the config values for all + submodels). + + For almost all models, we only require to tie the embeddings, so the model has an internal property + `_tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}`. In this case, the mapping is already + "expanded", i.e. it already contains full parameters, and this function will simply return a copy of the property. + For more complex patterns, e.g. for `DFineForObjectDetection`, we have the following attribute + ``` + _tied_weights_keys = { + r"bbox_embed.(?![0])\d+": "bbox_embed.0", + r"class_embed.(?![0])\d+": "class_embed.0", + "model.decoder.class_embed": "class_embed", + "model.decoder.bbox_embed": "bbox_embed", + } + ``` + In this case, the function looks up all the model's parameters and buffers, and matches all the params, + returning the following: + ``` + { + 'bbox_embed.1.layers.0.bias': 'bbox_embed.0.layers.0.bias', + 'bbox_embed.1.layers.0.weight': 'bbox_embed.0.layers.0.weight', + 'bbox_embed.1.layers.1.bias': 'bbox_embed.0.layers.1.bias', + 'bbox_embed.1.layers.1.weight': 'bbox_embed.0.layers.1.weight', + 'bbox_embed.1.layers.2.bias': 'bbox_embed.0.layers.2.bias', + 'bbox_embed.1.layers.2.weight': 'bbox_embed.0.layers.2.weight', + 'bbox_embed.2.layers.0.bias': 'bbox_embed.0.layers.0.bias', + 'bbox_embed.2.layers.0.weight': 'bbox_embed.0.layers.0.weight', + ... + 'class_embed.1.bias': 'class_embed.0.bias', + 'class_embed.1.weight': 'class_embed.0.weight', + 'class_embed.2.bias': 'class_embed.0.bias', + 'class_embed.2.weight': 'class_embed.0.weight', + ... + 'model.decoder.class_embed.0.bias': 'class_embed.0.bias', + 'model.decoder.class_embed.0.weight': 'class_embed.0.weight', + 'model.decoder.class_embed.1.bias': 'class_embed.0.bias', + 'model.decoder.class_embed.1.weight': 'class_embed.0.weight', + ... + 'model.decoder.bbox_embed.0.layers.0.bias': 'bbox_embed.0.layers.0.bias', + 'model.decoder.bbox_embed.0.layers.0.weight': 'bbox_embed.0.layers.0.weight', + 'model.decoder.bbox_embed.0.layers.1.bias': 'bbox_embed.0.layers.1.bias', + 'model.decoder.bbox_embed.0.layers.1.weight': 'bbox_embed.0.layers.1.weight', + ... + } + ``` + i.e. all the parameters matching the regex and modules patterns in `_tied_weights_keys` + """ + if all_submodels: + expanded_tied_weights = {} + for prefix, submodule in self.named_modules(remove_duplicate=False): + if isinstance(submodule, PreTrainedModel): + # Will dynamically check the config if it has changed + submodel_tied_weights = submodule.get_expanded_tied_weights_keys(all_submodels=False) + if prefix != "": + submodel_tied_weights = { + f"{prefix}.{k}": f"{prefix}.{v}" for k, v in submodel_tied_weights.items() + } + expanded_tied_weights.update(submodel_tied_weights) + return expanded_tied_weights + + tied_mapping = self._tied_weights_keys + # If the config does not specify any tying, return empty dict + # NOTE: not all modules have `tie_word_embeddings` attr, for example vision-only + # modules do not have any word embeddings! + tie_word_embeddings = getattr(self.config, "tie_word_embeddings", False) + if not tie_word_embeddings: + return {} + # If None, return empty dict + elif tied_mapping is None: + return {} + # Short-cut for the most common cases: if the tied weights mapping only contains already expanded params, + # return it directly (the regex matches names containing only letters, numbers, dots, and underscores to make + # sure it does not contain a regex pattern, and finishing by "bias" or "weight" to make sure it's not a module) + common_case_regex = re.compile(r"^[A-Za-z0-9_\.]+(weight)|(bias)$") + if all(common_case_regex.match(k) for k in tied_mapping.keys() | tied_mapping.values()): + return tied_mapping.copy() + + # We need to expand the regex patterns or the modules into proper parameters + expanded_tied_weights = {} + all_param_names = {k for k, _ in self.named_parameters(remove_duplicate=False)} | { + k for k, _ in self.named_buffers(remove_duplicate=False) + } + for target_name, source_name in tied_mapping.items(): + target_name = "^" + target_name + source_name = "^" + source_name + + source_params = sorted(filter(lambda x: re.search(source_name, x), all_param_names)) + target_params = sorted(filter(lambda x: re.search(target_name, x), all_param_names)) + if ( + not len(source_params) > 0 + or not len(target_params) > 0 + or len(target_params) % len(source_params) != 0 + ): + raise ValueError( + f"There is an issue with your definition of `tie_weights_keys` for {source_name}:{target_name}. " + f"We found {source_params} to tie into {target_params}" + ) + # we cycle source as it should be dispatch in many target if regex + for target_n, source_n in zip(target_params, cycle(source_params)): + # If the source is already registered as a target, use the original corresponding source. This should never + # happen in general, but some models such as `d_fine` have complicated regex patterns, so it end up being + # the case for simplicity of the regexes. Fix it silently here + if source_n in expanded_tied_weights.keys(): + # Use original source instead of having keys both as source and targets + expanded_tied_weights[target_n] = expanded_tied_weights[source_n] + # Usual case, everything is already correct + else: + expanded_tied_weights[target_n] = source_n + + return expanded_tied_weights + + def tie_weights(self, missing_keys: set[str] | None = None, recompute_mapping: bool = True): + """ + Tie the model weights. If `recompute_mapping=False` (default when called internally), it will rely on the + `model.all_tied_weights_keys` attribute, containing the `{target: source}` mapping for the tied params. + If `recompute_mapping=True`, it will re-check all internal submodels and their config to determine the params + that need to be tied. This is the default when `model.tie_weights()` is called on its own, outside of + `__init__`, and `from_pretrained`, in case the config values were changed somewhere. + + Note that during `from_pretrained`, tying is *symmetric*: if the mapping says "tie target -> source" but + `source` is missing in the checkpoint while `target` exists, we *swap* source and target so we can still + tie everything to the parameter that actually exists. + """ + # In this case, the keys stored in `all_tied_weights_keys` are already correct + if not recompute_mapping: + tied_keys = self.all_tied_weights_keys + else: + tied_keys = self.get_expanded_tied_weights_keys(all_submodels=True) + + tied_keys = list(tied_keys.items()) + for i, (target_param_name, source_param_name) in enumerate(tied_keys): + # This is `from_pretrained` -> let's check symmetrically in case the source key is not present + if missing_keys is not None: + remove_from_missing = True + source_is_there = source_param_name not in missing_keys + target_is_there = target_param_name not in missing_keys + # Both are already present -> it means the config is wrong and do not reflect the actual + # checkpoint -> let's raise a warning and NOT tie them + if source_is_there and target_is_there: + logger.warning( + f"The tied weights mapping and config for this model specifies to tie {source_param_name} to " + f"{target_param_name}, but both are present in the checkpoints, so we will NOT tie them. " + "You should update the config with `tie_word_embeddings=False` to silence this warning" + ) + # Remove from internal attribute to correctly reflect actual tied weights + self.all_tied_weights_keys.pop(target_param_name) + # Skip to next iteration + continue + # We're missing the source but we have the target -> we swap them, tying the parameter that exists + elif not source_is_there and target_is_there: + target_param_name, source_param_name = source_param_name, target_param_name + # Both are missing -> check other keys in case more than 2 keys are tied to the same weight + elif not source_is_there and not target_is_there: + for target_backup, source_backup in tied_keys[i + 1 :]: + # In case of more than 2 keys tied to the same weight, they are guaranteed to all have + # the same source thanks to `get_expanded_tied_weights_keys` so this check is enough + if source_backup == source_param_name: + target_backup_is_there = target_backup not in missing_keys + # If the target is present, we found the correct weight to tie into (we know the source is missing) + # Note here that we do not tie the missing source right now as well, as it will be done anyway when + # the pair (target_backup, source_backup) becomes the main pair (target_param_name, source_param_name) + if target_backup_is_there: + source_param_name = target_backup + break + # If we did not break from the loop, it was impossible to find a source key -> let's raise + else: + # TODO Cyril: here ideally we want to raise instead of warning, but will break our CI as we have + # tests loading model from empty dicts to perform init checks - since we don't raise, add a flag + # to NOT remove from missing keys as it's actually still missing + remove_from_missing = False + logger.warning( + f"This checkpoint seem corrupted. The tied weights mapping for this model specifies to tie " + f"{source_param_name} to {target_param_name}, but both are absent from the checkpoint, " + "and we could not find another related tied weight for those keys" + ) + + # Perform the actual tying + source_param = self.get_parameter_or_buffer(source_param_name) + if "." in target_param_name: + parent_name, name = target_param_name.rsplit(".", 1) + parent = self.get_submodule(parent_name) + else: + name = target_param_name + parent = self + # Tie the weights + setattr(parent, name, source_param) + self._adjust_bias(parent, source_param) + # Remove from missing if necessary + if missing_keys is not None and remove_from_missing: + missing_keys.discard(target_param_name) + + def _adjust_bias(self, output_embeddings, input_embeddings): + if getattr(output_embeddings, "bias", None) is not None and hasattr(output_embeddings, "weight"): + weight_shape = output_embeddings.weight.shape + output_embeddings.bias.data = nn.functional.pad( + output_embeddings.bias.data, + (0, weight_shape[0] - output_embeddings.bias.shape[0]), + "constant", + 0, + ) + if hasattr(output_embeddings, "out_features") and hasattr(input_embeddings, "num_embeddings"): + output_embeddings.out_features = input_embeddings.num_embeddings + + def resize_token_embeddings( + self, + new_num_tokens: int | None = None, + pad_to_multiple_of: int | None = None, + mean_resizing: bool = True, + ) -> nn.Embedding: + """ + Resizes input token embeddings matrix of the model if `new_num_tokens != config.vocab_size`. + + Takes care of tying weights embeddings afterwards if the model class has a `tie_weights()` method. + + Arguments: + new_num_tokens (`int`, *optional*): + The new number of tokens in the embedding matrix. Increasing the size will add newly initialized + vectors at the end. Reducing the size will remove vectors from the end. If not provided or `None`, just + returns a pointer to the input tokens `torch.nn.Embedding` module of the model without doing anything. + pad_to_multiple_of (`int`, *optional*): + If set will pad the embedding matrix to a multiple of the provided value.If `new_num_tokens` is set to + `None` will just pad the embedding to a multiple of `pad_to_multiple_of`. + + This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability + `>= 7.5` (Volta), or on TPUs which benefit from having sequence lengths be a multiple of 128. For more + details about this, or help on choosing the correct value for resizing, refer to this guide: + https://docs.nvidia.com/deeplearning/performance/dl-performance-matrix-multiplication/index.html#requirements-tc + mean_resizing (`bool`): + Whether to initialize the added embeddings from a multivariate normal distribution that has old embeddings' mean and + covariance or to initialize them with a normal distribution that has a mean of zero and std equals `config.initializer_range`. + + Setting `mean_resizing` to `True` is useful when increasing the size of the embeddings of causal language models, + where the generated tokens' probabilities won't be affected by the added embeddings because initializing the new embeddings with the + old embeddings' mean will reduce the kl-divergence between the next token probability before and after adding the new embeddings. + Refer to this article for more information: https://nlp.stanford.edu/~johnhew/vocab-expansion.html + + Return: + `torch.nn.Embedding`: Pointer to the input tokens Embeddings Module of the model. + """ + model_embeds = self._resize_token_embeddings(new_num_tokens, pad_to_multiple_of, mean_resizing) + if new_num_tokens is None and pad_to_multiple_of is None: + return model_embeds + + # Since we are basically reusing the same old embeddings with new weight values, gathering is required + is_quantized = hasattr(self, "hf_quantizer") and self.hf_quantizer is not None + if is_deepspeed_zero3_enabled() and not is_quantized: + import deepspeed + + with deepspeed.zero.GatheredParameters(model_embeds.weight, modifier_rank=None): + vocab_size = model_embeds.weight.shape[0] + else: + vocab_size = model_embeds.weight.shape[0] + + # Update base model and current model config. + self.config.get_text_config().vocab_size = vocab_size + self.vocab_size = vocab_size + + # Tie weights again if needed + self.tie_weights() + + return model_embeds + + def _resize_token_embeddings(self, new_num_tokens, pad_to_multiple_of=None, mean_resizing=True): + old_embeddings = self.get_input_embeddings() + new_embeddings = self._get_resized_embeddings( + old_embeddings, new_num_tokens, pad_to_multiple_of, mean_resizing + ) + if hasattr(old_embeddings, "_hf_hook"): + hook = old_embeddings._hf_hook + add_hook_to_module(new_embeddings, hook) + old_embeddings_requires_grad = old_embeddings.weight.requires_grad + new_embeddings.requires_grad_(old_embeddings_requires_grad) + self.set_input_embeddings(new_embeddings) + is_quantized = hasattr(self, "hf_quantizer") and self.hf_quantizer is not None + + # Update new_num_tokens with the actual size of new_embeddings + if pad_to_multiple_of is not None: + if is_deepspeed_zero3_enabled() and not is_quantized: + import deepspeed + + with deepspeed.zero.GatheredParameters(new_embeddings.weight, modifier_rank=None): + new_num_tokens = new_embeddings.weight.shape[0] + else: + new_num_tokens = new_embeddings.weight.shape[0] + + # if word embeddings are not tied, make sure that lm head is resized as well + if self.get_output_embeddings() is not None: + old_lm_head = self.get_output_embeddings() + if isinstance(old_lm_head, torch.nn.Embedding): + new_lm_head = self._get_resized_embeddings(old_lm_head, new_num_tokens, mean_resizing=mean_resizing) + else: + new_lm_head = self._get_resized_lm_head(old_lm_head, new_num_tokens, mean_resizing=mean_resizing) + if hasattr(old_lm_head, "_hf_hook"): + hook = old_lm_head._hf_hook + add_hook_to_module(new_lm_head, hook) + old_lm_head_requires_grad = old_lm_head.weight.requires_grad + new_lm_head.requires_grad_(old_lm_head_requires_grad) + self.set_output_embeddings(new_lm_head) + + return self.get_input_embeddings() + + def _get_resized_embeddings( + self, + old_embeddings: nn.Embedding, + new_num_tokens: int | None = None, + pad_to_multiple_of: int | None = None, + mean_resizing: bool = True, + ) -> nn.Embedding: + """ + Build a resized Embedding Module from a provided token Embedding Module. Increasing the size will add newly + initialized vectors at the end. Reducing the size will remove vectors from the end + + Args: + old_embeddings (`torch.nn.Embedding`): + Old embeddings to be resized. + new_num_tokens (`int`, *optional*): + New number of tokens in the embedding matrix. + + Increasing the size will add newly initialized vectors at the end. Reducing the size will remove + vectors from the end. If not provided or `None`, just returns a pointer to the input tokens + `torch.nn.Embedding` module of the model without doing anything. + pad_to_multiple_of (`int`, *optional*): + If set will pad the embedding matrix to a multiple of the provided value. If `new_num_tokens` is set to + `None` will just pad the embedding to a multiple of `pad_to_multiple_of`. + + This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability + `>= 7.5` (Volta), or on TPUs which benefit from having sequence lengths be a multiple of 128. For more + details about this, or help on choosing the correct value for resizing, refer to this guide: + https://docs.nvidia.com/deeplearning/performance/dl-performance-matrix-multiplication/index.html#requirements-tc + mean_resizing (`bool`): + Whether to initialize the added embeddings from a multivariate normal distribution that has old embeddings' mean and + covariance or to initialize them with a normal distribution that has a mean of zero and std equals `config.initializer_range`. + + Setting `mean_resizing` to `True` is useful when increasing the size of the embeddings of causal language models, + where the generated tokens' probabilities will not be affected by the added embeddings because initializing the new embeddings with the + old embeddings' mean will reduce the kl-divergence between the next token probability before and after adding the new embeddings. + Refer to this article for more information: https://nlp.stanford.edu/~johnhew/vocab-expansion.html + + + Return: + `torch.nn.Embedding`: Pointer to the resized Embedding Module or the old Embedding Module if + `new_num_tokens` is `None` + """ + + if pad_to_multiple_of is not None: + if not isinstance(pad_to_multiple_of, int): + raise ValueError( + f"Asking to pad the embedding matrix to a multiple of `{pad_to_multiple_of}`, which is not and integer. Please make sure to pass an integer" + ) + if new_num_tokens is None: + new_num_tokens = old_embeddings.weight.shape[0] + new_num_tokens = ((new_num_tokens + pad_to_multiple_of - 1) // pad_to_multiple_of) * pad_to_multiple_of + else: + logger.info( + "You are resizing the embedding layer without providing a `pad_to_multiple_of` parameter. This means that the new embedding" + f" dimension will be {new_num_tokens}. This might induce some performance reduction as *Tensor Cores* will not be available." + " For more details about this, or help on choosing the correct value for resizing, refer to this guide:" + " https://docs.nvidia.com/deeplearning/performance/dl-performance-matrix-multiplication/index.html#requirements-tc" + ) + + if new_num_tokens is None: + return old_embeddings + + is_quantized = hasattr(self, "hf_quantizer") and self.hf_quantizer is not None + if is_deepspeed_zero3_enabled() and not is_quantized: + import deepspeed + + with deepspeed.zero.GatheredParameters(old_embeddings.weight, modifier_rank=None): + old_num_tokens, old_embedding_dim = old_embeddings.weight.size() + else: + old_num_tokens, old_embedding_dim = old_embeddings.weight.size() + + if old_num_tokens == new_num_tokens and not is_deepspeed_zero3_enabled(): + return old_embeddings + + if not isinstance(old_embeddings, nn.Embedding): + raise TypeError( + f"Old embeddings are of type {type(old_embeddings)}, which is not an instance of {nn.Embedding}. You" + " should either use a different resize function or make sure that `old_embeddings` are an instance of" + f" {nn.Embedding}." + ) + + # Build new embeddings + + # When using DeepSpeed ZeRO-3, we shouldn't create new embeddings with DeepSpeed init + # because the shape of the new embedding layer is used across various modeling files + # as well as to update config vocab size. Shape will be 0 when using DeepSpeed init leading + # to errors when training. + new_embeddings = nn.Embedding( + new_num_tokens, + old_embedding_dim, + device=old_embeddings.weight.device, + dtype=old_embeddings.weight.dtype, + ) + + if new_num_tokens > old_num_tokens and not mean_resizing: + # initialize new embeddings (in particular added tokens) with a mean of 0 and std equals `config.initializer_range`. + self._init_weights(new_embeddings) + + elif new_num_tokens > old_num_tokens and mean_resizing: + # initialize new embeddings (in particular added tokens). The new embeddings will be initialized + # from a multivariate normal distribution that has old embeddings' mean and covariance. + # as described in this article: https://nlp.stanford.edu/~johnhew/vocab-expansion.html + logger.warning_once( + "The new embeddings will be initialized from a multivariate normal distribution that has old embeddings' mean and covariance. " + "As described in this article: https://nlp.stanford.edu/~johnhew/vocab-expansion.html. " + "To disable this, use `mean_resizing=False`" + ) + + added_num_tokens = new_num_tokens - old_num_tokens + if is_deepspeed_zero3_enabled() and not is_quantized: + import deepspeed + + with deepspeed.zero.GatheredParameters([old_embeddings.weight], modifier_rank=None): + self._init_added_embeddings_weights_with_mean( + old_embeddings, new_embeddings, old_num_tokens, added_num_tokens + ) + else: + self._init_added_embeddings_weights_with_mean( + old_embeddings, new_embeddings, old_num_tokens, added_num_tokens + ) + + # Copy token embeddings from the previous weights + + # numbers of tokens to copy + n = min(old_num_tokens, new_num_tokens) + + if is_deepspeed_zero3_enabled() and not is_quantized: + import deepspeed + + params = [old_embeddings.weight, new_embeddings.weight] + with deepspeed.zero.GatheredParameters(params, modifier_rank=0): + new_embeddings.weight.data[:n, :] = old_embeddings.weight.data[:n, :] + else: + new_embeddings.weight.data[:n, :] = old_embeddings.weight.data[:n, :] + + # Replace weights in old_embeddings and return to maintain the same embedding type. + # This ensures correct functionality when a Custom Embedding class is passed as input. + # The input and output embedding types remain consistent. (c.f. https://github.com/huggingface/transformers/pull/31979) + if is_deepspeed_zero3_enabled() and not is_quantized: + import deepspeed + + params = [old_embeddings.weight, new_embeddings.weight] + with deepspeed.zero.GatheredParameters(params, modifier_rank=0): + old_embeddings.weight = new_embeddings.weight + old_embeddings.num_embeddings = new_embeddings.weight.data.shape[0] + + # If the new number of tokens is smaller than the original `padding_idx`, the `padding_idx` + # will be set to `None` in the resized embeddings. + if old_embeddings.padding_idx is not None and (new_num_tokens - 1) < old_embeddings.padding_idx: + old_embeddings.padding_idx = None + else: + old_embeddings.weight.data = new_embeddings.weight.data + old_embeddings.num_embeddings = new_embeddings.weight.data.shape[0] + if old_embeddings.padding_idx is not None and (new_num_tokens - 1) < old_embeddings.padding_idx: + old_embeddings.padding_idx = None + + return old_embeddings + + def _get_resized_lm_head( + self, + old_lm_head: nn.Linear, + new_num_tokens: int | None = None, + transposed: bool = False, + mean_resizing: bool = True, + ) -> nn.Linear: + """ + Build a resized Linear Module from a provided old Linear Module. Increasing the size will add newly initialized + vectors at the end. Reducing the size will remove vectors from the end + + Args: + old_lm_head (`torch.nn.Linear`): + Old lm head liner layer to be resized. + new_num_tokens (`int`, *optional*): + New number of tokens in the linear matrix. + + Increasing the size will add newly initialized vectors at the end. Reducing the size will remove + vectors from the end. If not provided or `None`, just returns a pointer to the input tokens + `torch.nn.Linear` module of the model without doing anything. transposed (`bool`, *optional*, defaults + to `False`): Whether `old_lm_head` is transposed or not. If True `old_lm_head.size()` is `lm_head_dim, + vocab_size` else `vocab_size, lm_head_dim`. + mean_resizing (`bool`): + Whether to initialize the added embeddings from a multivariate normal distribution that has old embeddings' mean and + covariance or to initialize them with a normal distribution that has a mean of zero and std equals `config.initializer_range`. + + Setting `mean_resizing` to `True` is useful when increasing the size of the embeddings of causal language models, + where the generated tokens' probabilities will not be affected by the added embeddings because initializing the new embeddings with the + old embeddings' mean will reduce the kl-divergence between the next token probability before and after adding the new embeddings. + Refer to this article for more information: https://nlp.stanford.edu/~johnhew/vocab-expansion.html + + Return: + `torch.nn.Linear`: Pointer to the resized Linear Module or the old Linear Module if `new_num_tokens` is + `None` + """ + + if new_num_tokens is None: + return old_lm_head + + is_quantized = hasattr(self, "hf_quantizer") and self.hf_quantizer is not None + if is_deepspeed_zero3_enabled() and not is_quantized: + import deepspeed + + with deepspeed.zero.GatheredParameters(old_lm_head.weight, modifier_rank=None): + old_num_tokens, old_lm_head_dim = ( + old_lm_head.weight.size() if not transposed else old_lm_head.weight.t().size() + ) + else: + old_num_tokens, old_lm_head_dim = ( + old_lm_head.weight.size() if not transposed else old_lm_head.weight.t().size() + ) + + if old_num_tokens == new_num_tokens and not is_deepspeed_zero3_enabled(): + return old_lm_head + + if not isinstance(old_lm_head, nn.Linear): + raise TypeError( + f"Old language model head is of type {type(old_lm_head)}, which is not an instance of {nn.Linear}. You" + " should either use a different resize function or make sure that `old_lm_head` are an instance of" + f" {nn.Linear}." + ) + + # Build new lm head + new_lm_head_shape = (old_lm_head_dim, new_num_tokens) if not transposed else (new_num_tokens, old_lm_head_dim) + has_new_lm_head_bias = old_lm_head.bias is not None + + # When using DeepSpeed ZeRO-3, we shouldn't create new embeddings with DeepSpeed init + # because the shape of the new embedding layer is used across various modeling files + # as well as to update config vocab size. Shape will be 0 when using DeepSpeed init leading + # to errors when training. + new_lm_head = nn.Linear( + *new_lm_head_shape, + bias=has_new_lm_head_bias, + device=old_lm_head.weight.device, + dtype=old_lm_head.weight.dtype, + ) + + if new_num_tokens > old_num_tokens and not mean_resizing: + # initialize new embeddings (in particular added tokens) with a mean of 0 and std equals `config.initializer_range`. + self._init_weights(new_lm_head) + + elif new_num_tokens > old_num_tokens and mean_resizing: + # initialize new lm_head weights (in particular added tokens). The new lm_head weights + # will be initialized from a multivariate normal distribution that has old embeddings' mean and covariance. + # as described in this article: https://nlp.stanford.edu/~johnhew/vocab-expansion.html + logger.warning_once( + "The new lm_head weights will be initialized from a multivariate normal distribution that has old embeddings' mean and covariance. " + "As described in this article: https://nlp.stanford.edu/~johnhew/vocab-expansion.html. " + "To disable this, use `mean_resizing=False`" + ) + + added_num_tokens = new_num_tokens - old_num_tokens + if is_deepspeed_zero3_enabled() and not is_quantized: + import deepspeed + + params = [old_lm_head.weight] + if has_new_lm_head_bias: + params += [old_lm_head.bias] + with deepspeed.zero.GatheredParameters(params, modifier_rank=None): + self._init_added_lm_head_weights_with_mean( + old_lm_head, new_lm_head, old_lm_head_dim, old_num_tokens, added_num_tokens, transposed + ) + if has_new_lm_head_bias: + self._init_added_lm_head_bias_with_mean(old_lm_head, new_lm_head, added_num_tokens) + + else: + self._init_added_lm_head_weights_with_mean( + old_lm_head, new_lm_head, old_lm_head_dim, old_num_tokens, added_num_tokens, transposed + ) + if has_new_lm_head_bias: + self._init_added_lm_head_bias_with_mean(old_lm_head, new_lm_head, added_num_tokens) + + num_tokens_to_copy = min(old_num_tokens, new_num_tokens) + + if is_deepspeed_zero3_enabled() and not is_quantized: + import deepspeed + + params = [old_lm_head.weight, old_lm_head.bias, new_lm_head.weight, new_lm_head.bias] + with deepspeed.zero.GatheredParameters(params, modifier_rank=0): + self._copy_lm_head_original_to_resized( + new_lm_head, old_lm_head, num_tokens_to_copy, transposed, has_new_lm_head_bias + ) + else: + self._copy_lm_head_original_to_resized( + new_lm_head, old_lm_head, num_tokens_to_copy, transposed, has_new_lm_head_bias + ) + + return new_lm_head + + def _init_added_embeddings_weights_with_mean( + self, old_embeddings, new_embeddings, old_num_tokens, added_num_tokens + ): + old_embeddings_weight = old_embeddings.weight.data.to(torch.float32) + mean_embeddings = torch.mean(old_embeddings_weight, axis=0) + old_centered_embeddings = old_embeddings_weight - mean_embeddings + covariance = old_centered_embeddings.T @ old_centered_embeddings / old_num_tokens + + # Check if the covariance is positive definite. + epsilon = 1e-9 + is_covariance_psd = constraints.positive_definite.check(epsilon * covariance).all() + if is_covariance_psd: + # If covariances is positive definite, a distribution can be created. and we can sample new weights from it. + distribution = torch.distributions.multivariate_normal.MultivariateNormal( + mean_embeddings, covariance_matrix=epsilon * covariance + ) + new_embeddings.weight.data[-1 * added_num_tokens :, :] = distribution.sample( + sample_shape=(added_num_tokens,) + ).to(old_embeddings.weight.dtype) + else: + # Otherwise, just initialize with the mean. because distribution will not be created. + new_embeddings.weight.data[-1 * added_num_tokens :, :] = ( + mean_embeddings[None, :].repeat(added_num_tokens, 1).to(old_embeddings.weight.dtype) + ) + + def _init_added_lm_head_weights_with_mean( + self, + old_lm_head, + new_lm_head, + old_lm_head_dim, + old_num_tokens, + added_num_tokens, + transposed: bool = False, + ): + if transposed: + # Transpose to the desired shape for the function. + new_lm_head.weight.data = new_lm_head.weight.data.T + old_lm_head.weight.data = old_lm_head.weight.data.T + + # The same initialization logic as Embeddings. + self._init_added_embeddings_weights_with_mean(old_lm_head, new_lm_head, old_num_tokens, added_num_tokens) + + if transposed: + # Transpose again to the correct shape. + new_lm_head.weight.data = new_lm_head.weight.data.T + old_lm_head.weight.data = old_lm_head.weight.data.T + + def _init_added_lm_head_bias_with_mean(self, old_lm_head, new_lm_head, added_num_tokens): + bias_mean = torch.mean(old_lm_head.bias.data, axis=0, dtype=torch.float32) + bias_std = torch.std(old_lm_head.bias.data, axis=0).to(torch.float32) + new_lm_head.bias.data[-1 * added_num_tokens :].normal_(mean=bias_mean, std=1e-9 * bias_std) + + def _copy_lm_head_original_to_resized( + self, new_lm_head, old_lm_head, num_tokens_to_copy, transposed, has_new_lm_head_bias + ): + # Copy old lm head weights to new lm head + if not transposed: + new_lm_head.weight.data[:num_tokens_to_copy, :] = old_lm_head.weight.data[:num_tokens_to_copy, :] + else: + new_lm_head.weight.data[:, :num_tokens_to_copy] = old_lm_head.weight.data[:, :num_tokens_to_copy] + + # Copy bias weights to new lm head + if has_new_lm_head_bias: + new_lm_head.bias.data[:num_tokens_to_copy] = old_lm_head.bias.data[:num_tokens_to_copy] + + def resize_position_embeddings(self, new_num_position_embeddings: int): + raise NotImplementedError( + f"`resize_position_embeddings` is not implemented for {self.__class__}`. To implement it, you should " + f"overwrite this method in the class {self.__class__} in `modeling_{self.__class__.__module__}.py`" + ) + + def get_position_embeddings(self) -> nn.Embedding | tuple[nn.Embedding]: + raise NotImplementedError( + f"`get_position_embeddings` is not implemented for {self.__class__}`. To implement it, you should " + f"overwrite this method in the class {self.__class__} in `modeling_{self.__class__.__module__}.py`" + ) + + def init_weights(self): + """ + Initialize and tie the weights if needed. If using a custom `PreTrainedModel`, you need to implement any + initialization logic in `_init_weights`. + """ + # If we are initializing on meta device, there is no point in trying to run inits + if get_torch_context_manager_or_global_device() != torch.device("meta"): + # Initialize weights + self.initialize_weights() + # Tie weights needs to be called here, but it can use the pre-computed `all_tied_weights_keys` + self.tie_weights(recompute_mapping=False) + + def gradient_checkpointing_enable(self, gradient_checkpointing_kwargs=None): + """ + Activates gradient checkpointing for the current model. + + We pass the `__call__` method of the modules instead of `forward` because `__call__` attaches all the hooks of + the module. https://discuss.pytorch.org/t/any-different-between-model-input-and-model-forward-input/3690/2 + + Args: + gradient_checkpointing_kwargs (dict, *optional*): + Additional keyword arguments passed along to the `torch.utils.checkpoint.checkpoint` function. + """ + if not self.supports_gradient_checkpointing: + raise ValueError(f"{self.__class__.__name__} does not support gradient checkpointing.") + + if gradient_checkpointing_kwargs is None: + gradient_checkpointing_kwargs = {"use_reentrant": False} + + gradient_checkpointing_func = functools.partial(checkpoint, **gradient_checkpointing_kwargs) + + # For old GC format (transformers < 4.35.0) for models that live on the Hub + # we will fall back to the overwritten `_set_gradient_checkpointing` method + _is_using_old_format = "value" in inspect.signature(self._set_gradient_checkpointing).parameters + + if not _is_using_old_format: + self._set_gradient_checkpointing(enable=True, gradient_checkpointing_func=gradient_checkpointing_func) + else: + self.apply(partial(self._set_gradient_checkpointing, value=True)) + logger.warning( + "You are using an old version of the checkpointing format that is deprecated (We will also silently ignore `gradient_checkpointing_kwargs` in case you passed it)." + "Please update to the new format on your modeling file. To use the new format, you need to completely remove the definition of the method `_set_gradient_checkpointing` in your model." + ) + + needs_embedding_grads = self.main_input_name == "input_ids" + # we use that also to detect whether or not we have to raise if embeddings are missing (the submodel might not have embeddings at all) + enable_input_grads = needs_embedding_grads or getattr(self, "_hf_peft_config_loaded", False) + if enable_input_grads: + # When using PEFT + gradient checkpointing + Trainer we need to make sure the input has requires_grad=True + # we do it also on PEFT: https://github.com/huggingface/peft/blob/85013987aa82aa1af3da1236b6902556ce3e483e/src/peft/peft_model.py#L334 + # When training with PEFT, only LoRA layers will have requires grad set to True, but the output of frozen layers need to propagate + # the gradients to make sure the gradient flows. + self.enable_input_require_grads() + + def _set_gradient_checkpointing(self, enable: bool = True, gradient_checkpointing_func: Callable = checkpoint): + is_gradient_checkpointing_set = False + + # Apply it on the top-level module in case the top-level modules supports it + # for example, LongT5Stack inherits from `PreTrainedModel`. + if hasattr(self, "gradient_checkpointing"): + self._gradient_checkpointing_func = gradient_checkpointing_func + self.gradient_checkpointing = enable + is_gradient_checkpointing_set = True + + for module in self.modules(): + if hasattr(module, "gradient_checkpointing"): + module._gradient_checkpointing_func = gradient_checkpointing_func + module.gradient_checkpointing = enable + is_gradient_checkpointing_set = True + + if not is_gradient_checkpointing_set: + raise ValueError( + f"{self.__class__.__name__} is not compatible with gradient checkpointing. Make sure all the architecture support it by setting a boolean attribute" + " `gradient_checkpointing` to modules of the model that uses checkpointing." + ) + + def gradient_checkpointing_disable(self): + """ + Deactivates gradient checkpointing for the current model. + """ + if self.supports_gradient_checkpointing: + # For old GC format (transformers < 4.35.0) for models that live on the Hub + # we will fall back to the overwritten `_set_gradient_checkpointing` method + _is_using_old_format = "value" in inspect.signature(self._set_gradient_checkpointing).parameters + if not _is_using_old_format: + self._set_gradient_checkpointing(enable=False) + else: + logger.warning( + "You are using an old version of the checkpointing format that is deprecated (We will also silently ignore `gradient_checkpointing_kwargs` in case you passed it)." + "Please update to the new format on your modeling file. To use the new format, you need to completely remove the definition of the method `_set_gradient_checkpointing` in your model." + ) + self.apply(partial(self._set_gradient_checkpointing, value=False)) + + if getattr(self, "_hf_peft_config_loaded", False): + self.disable_input_require_grads() + + @property + def is_gradient_checkpointing(self) -> bool: + """ + Whether gradient checkpointing is activated for this model or not. + """ + return any(hasattr(m, "gradient_checkpointing") and m.gradient_checkpointing for m in self.modules()) + + def save_pretrained( + self, + save_directory: str | os.PathLike, + is_main_process: bool = True, + state_dict: dict | None = None, + push_to_hub: bool = False, + max_shard_size: int | str = "50GB", + variant: str | None = None, + token: str | bool | None = None, + save_peft_format: bool = True, + save_original_format: bool = True, + **kwargs, + ): + """ + Save a model and its configuration file to a directory, so that it can be re-loaded using the + [`~PreTrainedModel.from_pretrained`] class method. + + Arguments: + save_directory (`str` or `os.PathLike`): + Directory to which to save. Will be created if it doesn't exist. + is_main_process (`bool`, *optional*, defaults to `True`): + Whether the process calling this is the main process or not. Useful when in distributed training like + TPUs and need to call this function on all processes. In this case, set `is_main_process=True` only on + the main process to avoid race conditions. + state_dict (nested dictionary of `torch.Tensor`): + The state dictionary of the model to save. Will default to `self.state_dict()`, but can be used to only + save parts of the model or if special precautions need to be taken when recovering the state dictionary + of a model (like when using model parallelism). + push_to_hub (`bool`, *optional*, defaults to `False`): + Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the + repository you want to push to with `repo_id` (will default to the name of `save_directory` in your + namespace). + max_shard_size (`int` or `str`, *optional*, defaults to `"50GB"`): + The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size + lower than this size. If expressed as a string, needs to be digits followed by a unit (like `"5MB"`). + + + + If a single weight of the model is bigger than `max_shard_size`, it will be in its own checkpoint shard + which will be bigger than `max_shard_size`. + + + + variant (`str`, *optional*): + If specified, weights are saved in the format model..safetensors. + token (`str` or `bool`, *optional*): + The token to use as HTTP bearer authorization for remote files. If `True`, or not specified, will use + the token generated when running `hf auth login` (stored in `~/.huggingface`). + save_peft_format (`bool`, *optional*, defaults to `True`): + For backward compatibility with PEFT library, in case adapter weights are attached to the model, all + keys of the state dict of adapters needs to be prepended with `base_model.model`. Advanced users can + disable this behaviours by setting `save_peft_format` to `False`. + save_original_format (`bool`, *optional*, defaults to `True`): + For backward compatibility with the previous versions of `transformers` you can save the checkpoint with + its reverse mapping. The reverse mapping needs to exists even if the model was loaded from a None legacy + checkpoint. + kwargs (`dict[str, Any]`, *optional*): + Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method. + """ + if token is not None: + kwargs["token"] = token + + _hf_peft_config_loaded = getattr(self, "_hf_peft_config_loaded", False) + + hf_quantizer = getattr(self, "hf_quantizer", None) + quantization_serializable = ( + hf_quantizer is not None and isinstance(hf_quantizer, HfQuantizer) and hf_quantizer.is_serializable() + ) + + if hf_quantizer is not None and not _hf_peft_config_loaded and not quantization_serializable: + raise ValueError( + f"The model is quantized with {hf_quantizer.quantization_config.quant_method} and is not serializable - check out the warnings from" + " the logger on the traceback to understand the reason why the quantized model is not serializable." + ) + + # we need to check against tp_size, not tp_plan, as tp_plan is substituted to the class one + if self._tp_size is not None and not is_huggingface_hub_greater_or_equal("0.31.4"): + raise ImportError( + "Saving a model with tensor parallelism requires `huggingface_hub` version 0.31.4 or higher." + ) + + if os.path.isfile(save_directory): + logger.error(f"Provided path ({save_directory}) should be a directory, not a file") + return + + os.makedirs(save_directory, exist_ok=True) + + if push_to_hub: + commit_message = kwargs.pop("commit_message", None) + repo_id = kwargs.pop("repo_id", save_directory.split(os.path.sep)[-1]) + create_pr = kwargs.pop("create_pr", False) + repo_id = create_repo(repo_id, exist_ok=True, **kwargs).repo_id + files_timestamps = self._get_files_timestamps(save_directory) + + metadata = {} + if hf_quantizer is not None: + state_dict, metadata = hf_quantizer.get_state_dict_and_metadata(self) + metadata["format"] = "pt" + + # Only save the model itself if we are using distributed training + model_to_save = unwrap_model(self) + # save the string version of dtype to the config, e.g. convert torch.float32 => "float32" + # we currently don't use this setting automatically, but may start to use with v5 + dtype = model_to_save.dtype + model_to_save.config.dtype = str(dtype).split(".")[1] + + # Attach architecture to the config + # When using FSDP2, unwrapping is a noop, so the model name doesn't change back to the original model name + model_to_save.config.architectures = [model_to_save.__class__.__name__.removeprefix("FSDP")] + + # If we have a custom model, we copy the file defining it in the folder and set the attributes so it can be + # loaded from the Hub. + if self._auto_class is not None: + custom_object_save(self, save_directory, config=self.config) + + # Save the config + if is_main_process: + if not _hf_peft_config_loaded: + model_to_save.config.save_pretrained(save_directory) + if self.can_generate(): + model_to_save.generation_config.save_pretrained(save_directory) + + if _hf_peft_config_loaded: + logger.info( + "Detected adapters on the model, saving the model in the PEFT format, only adapter weights will be saved." + ) + state_dict = model_to_save.get_adapter_state_dict(state_dict=state_dict) + + if save_peft_format: + logger.info( + "To match the expected format of the PEFT library, all keys of the state dict of adapters will be prepended with `base_model.model`." + ) + peft_state_dict = {} + for key, value in state_dict.items(): + peft_state_dict[f"base_model.model.{key}"] = value + state_dict = peft_state_dict + + active_adapter = self.active_adapters() + + if len(active_adapter) > 1: + raise ValueError( + "Multiple active adapters detected, saving multiple active adapters is not supported yet. You can save adapters separately one by one " + "by iteratively calling `model.set_adapter(adapter_name)` then `model.save_pretrained(...)`" + ) + active_adapter = active_adapter[0] + + current_peft_config = self.peft_config[active_adapter] + current_peft_config.save_pretrained(save_directory) + + # Get the model state_dict + if state_dict is None: + state_dict = model_to_save.state_dict() + + # if any model parameters are offloaded, we need to know it for later + is_offloaded = False + if ( + hasattr(self, "hf_device_map") + and len(set(self.hf_device_map.values())) > 1 + and ("cpu" in self.hf_device_map.values() or "disk" in self.hf_device_map.values()) + ): + is_offloaded = True + warnings.warn( + "Attempting to save a model with offloaded modules. Ensure that unallocated cpu memory " + "exceeds the `shard_size` (50GB default)" + ) + + # Translate state_dict from smp to hf if saving with smp >= 1.10 + if IS_SAGEMAKER_MP_POST_1_10: + for smp_to_hf, _ in smp.state.module_manager.translate_functions: + state_dict = smp_to_hf(state_dict) + + # Handle the case where some state_dict keys shouldn't be saved + if self._keys_to_ignore_on_save is not None: + for ignore_key in self._keys_to_ignore_on_save: + if ignore_key in state_dict: + del state_dict[ignore_key] + + # If model was sharded with TP, gather full tensors for saving + if self._tp_size is not None: + state_dict = gather_state_dict_for_save(state_dict, self._tp_plan, self._device_mesh, self._tp_size) + + # Remove tied weights as safetensors do not handle them + state_dict = remove_tied_weights_from_state_dict(state_dict, model_to_save) + + # Revert all renaming and/or weight operations + if save_original_format and not _hf_peft_config_loaded: + state_dict = revert_weight_conversion(model_to_save, state_dict) + + # Shard the model if it is too big. + if not _hf_peft_config_loaded: + weights_name = SAFE_WEIGHTS_NAME + weights_name = _add_variant(weights_name, variant) + else: + weights_name = ADAPTER_SAFE_WEIGHTS_NAME + + filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors") + state_dict_split = split_torch_state_dict_into_shards( + state_dict, filename_pattern=filename_pattern, max_shard_size=max_shard_size + ) + # Save index if sharded + index = None + if state_dict_split.is_sharded: + index = { + "metadata": {"total_parameters": self.num_parameters(), **state_dict_split.metadata}, + "weight_map": state_dict_split.tensor_to_filename, + } + + # Clean the folder from a previous save + for filename in os.listdir(save_directory): + full_filename = os.path.join(save_directory, filename) + # If we have a shard file that is not going to be replaced, we delete it, but only from the main process + # in distributed settings to avoid race conditions. + weights_no_suffix = weights_name.replace(".bin", "").replace(".safetensors", "") + + # make sure that file to be deleted matches format of sharded file, e.g. pytorch_model-00001-of-00005 + filename_no_suffix = filename.replace(".bin", "").replace(".safetensors", "") + reg = re.compile(r"(.*?)-\d{5}-of-\d{5}") + + if ( + filename.startswith(weights_no_suffix) + and os.path.isfile(full_filename) + and filename not in state_dict_split.filename_to_tensors + and is_main_process + and reg.fullmatch(filename_no_suffix) is not None + ): + os.remove(full_filename) + + # Save the model + for shard_file, tensor_names in logging.tqdm( + state_dict_split.filename_to_tensors.items(), desc="Writing model shards" + ): + filename = os.path.join(save_directory, shard_file) + shard_state_dict = {} + for tensor_name in tensor_names: + # Get the tensor, and remove it from state_dict to avoid keeping the ref + tensor = state_dict.pop(tensor_name) + + # If the param was offloaded, we need to load it back from disk to resave it. It's a strange pattern, + # but it would otherwise not be contained in the saved shard if we were to simply move the file + # or something + if is_offloaded and tensor.device.type == "meta": + tensor = load_offloaded_parameter(model_to_save, tensor_name) + + # only do contiguous after it's permuted correctly in case of TP + shard_state_dict[tensor_name] = tensor.contiguous() + + # TODO: it would be very nice to do the writing concurrently, but safetensors never releases the GIL, + # so it's not possible for now.... + # Write the shard to disk + safe_save_file(shard_state_dict, filename, metadata=metadata) + # Cleanup the data before next loop (important with offloading, so we don't blowup cpu RAM) + del shard_state_dict + + if index is None: + path_to_weights = os.path.join(save_directory, weights_name) + logger.info(f"Model weights saved in {path_to_weights}") + else: + save_index_file = SAFE_WEIGHTS_INDEX_NAME + save_index_file = os.path.join(save_directory, _add_variant(save_index_file, variant)) + # Save the index as well + with open(save_index_file, "w", encoding="utf-8") as f: + content = json.dumps(index, indent=2, sort_keys=True) + "\n" + f.write(content) + logger.info( + f"The model is bigger than the maximum size per checkpoint ({max_shard_size}) and is going to be " + f"split in {len(state_dict_split.filename_to_tensors)} checkpoint shards. You can find where each parameters has been saved in the " + f"index located at {save_index_file}." + ) + + if push_to_hub: + # Eventually create an empty model card + model_card = create_and_tag_model_card(repo_id, self.model_tags, token=token) + + # Update model card if needed: + model_card.save(os.path.join(save_directory, "README.md")) + + self._upload_modified_files( + save_directory, + repo_id, + files_timestamps, + commit_message=commit_message, + token=token, + create_pr=create_pr, + ) + + @wraps(PushToHubMixin.push_to_hub) + def push_to_hub(self, *args, **kwargs): + tags = self.model_tags if self.model_tags is not None else [] + + tags_kwargs = kwargs.get("tags", []) + if isinstance(tags_kwargs, str): + tags_kwargs = [tags_kwargs] + + for tag in tags_kwargs: + if tag not in tags: + tags.append(tag) + + if tags: + kwargs["tags"] = tags + return super().push_to_hub(*args, **kwargs) + + def get_memory_footprint(self, return_buffers=True): + r""" + Get the memory footprint of a model. This will return the memory footprint of the current model in bytes. + Useful to benchmark the memory footprint of the current model and design some tests. Solution inspired from the + PyTorch discussions: https://discuss.pytorch.org/t/gpu-memory-that-model-uses/56822/2 + + Arguments: + return_buffers (`bool`, *optional*, defaults to `True`): + Whether to return the size of the buffer tensors in the computation of the memory footprint. Buffers + are tensors that do not require gradients and not registered as parameters. E.g. mean and std in batch + norm layers. Please see: https://discuss.pytorch.org/t/what-pytorch-means-by-buffers/120266/2 + """ + mem = sum(param.nelement() * param.element_size() for param in self.parameters()) + if return_buffers: + mem_bufs = sum(buf.nelement() * buf.element_size() for buf in self.buffers()) + mem = mem + mem_bufs + return mem + + @wraps(torch.nn.Module.cuda) + def cuda(self, *args, **kwargs): + if getattr(self, "quantization_method", None) == QuantizationMethod.HQQ: + from hqq.core.quantize import HQQLinear + + # Since HQQLinear stores some tensors in the 'meta' attribute, + # it's necessary to manually call the `cuda` method on HQQLinear layers. + super().cuda(*args, **kwargs) + for module in self.modules(): + if isinstance(module, HQQLinear): + if len(args) > 0: + device = args[0] + else: + device = kwargs.get("device", "cuda") + module.cuda(device) + return self + + # Checks if the model has been loaded in 4-bit or 8-bit with BNB + if getattr(self, "quantization_method", None) == QuantizationMethod.BITS_AND_BYTES: + if getattr(self, "is_loaded_in_8bit", False): + raise ValueError( + "Calling `cuda()` is not supported for `8-bit` quantized models. " + " Please use the model as it is, since the model has already been set to the correct devices." + ) + return super().cuda(*args, **kwargs) + + @wraps(torch.nn.Module.to) + def to(self, *args, **kwargs): + # For BNB/GPTQ models, we prevent users from casting the model to another dtype to restrict unwanted behaviours. + # the correct API should be to load the model with the desired dtype directly through `from_pretrained`. + dtype_present_in_args = "dtype" in kwargs + + if not dtype_present_in_args: + for arg in args: + if isinstance(arg, torch.dtype): + dtype_present_in_args = True + break + + if getattr(self, "quantization_method", None) == QuantizationMethod.HQQ: + from hqq.core.quantize import HQQLinear + + # Since HQQLinear stores some tensors in the 'meta' attribute, we must + # explicitly move the parameters to the target device for each HQQLinear layer after `to`. + super().to(*args, **kwargs) + for module in self.modules(): + if isinstance(module, HQQLinear): + if "device" in kwargs: + device = kwargs["device"] + else: + device = args[0] + if "dtype" in kwargs: + dtype = kwargs["dtype"] + elif dtype_present_in_args: + dtype = arg + else: + dtype = None + # Due to the current messy implementation of HQQLinear, updating `compute_dtype` + # followed by calling the `cuda` method achieves the intended behavior of `to`, + # even when the target device is CPU. + if dtype is not None: + module.compute_dtype = dtype + module.cuda(device) + return self + + if dtype_present_in_args and getattr(self, "quantization_method", None) == QuantizationMethod.QUARK: + raise ValueError("Casting a Quark quantized model to a new `dtype` is not supported.") + + # Checks if the model has been loaded in 4-bit or 8-bit with BNB + if getattr(self, "quantization_method", None) == QuantizationMethod.BITS_AND_BYTES: + if dtype_present_in_args: + raise ValueError( + "You cannot cast a bitsandbytes model in a new `dtype`. Make sure to load the model using `from_pretrained` using the" + " desired `dtype` by passing the correct `dtype` argument." + ) + + if getattr(self, "is_loaded_in_8bit", False) and not is_bitsandbytes_available("0.48"): + raise ValueError( + "You need to install `pip install bitsandbytes>=0.48.0` if you want to move a 8-bit model across devices using to()." + ) + elif getattr(self, "quantization_method", None) == QuantizationMethod.GPTQ: + if dtype_present_in_args: + raise ValueError( + "You cannot cast a GPTQ model in a new `dtype`. Make sure to load the model using `from_pretrained` using the desired" + " `dtype` by passing the correct `dtype` argument." + ) + return super().to(*args, **kwargs) + + def half(self, *args): + # Checks if the model is quantized + if getattr(self, "is_quantized", False): + raise ValueError( + "`.half()` is not supported for quantized model. Please use the model as it is, since the" + " model has already been casted to the correct `dtype`." + ) + else: + return super().half(*args) + + def float(self, *args): + # Checks if the model is quantized + if getattr(self, "is_quantized", False): + raise ValueError( + "`.float()` is not supported for quantized model. Please use the model as it is, since the" + " model has already been casted to the correct `dtype`." + ) + else: + return super().float(*args) + + @classmethod + def get_init_context(cls, dtype: torch.dtype, is_quantized: bool, _is_ds_init_called: bool): + # Need to instantiate with correct dtype + init_contexts = [local_torch_dtype(dtype, cls.__name__), init.no_tie_weights()] + if is_deepspeed_zero3_enabled(): + import deepspeed + + # We cannot initialize the model on meta device with deepspeed when not quantized + if not is_quantized and not _is_ds_init_called: + logger.info("Detected DeepSpeed ZeRO-3: activating zero.init() for this model") + init_contexts.extend( + [ + init.no_init_weights(), + deepspeed.zero.Init(config_dict_or_path=deepspeed_config()), + set_zero3_state(), + ] + ) + elif is_quantized: + init_contexts.extend([torch.device("meta"), set_quantized_state()]) + else: + init_contexts.append(torch.device("meta")) + + return init_contexts + + def _get_dtype_plan(self, dtype: torch.dtype) -> dict: + """Create the dtype_plan describing modules/parameters that should use the `keep_in_fp32` flag.""" + dtype_plan = {} + + # The _keep_in_fp32_modules flag is only used to avoid bf16 -> fp16 casting precision issues. It was introduced + # in case of force loading a model that should stay in bf16 in fp16 + # See https://github.com/huggingface/transformers/issues/20287 for details. + if self._keep_in_fp32_modules is not None and dtype == torch.float16: + dtype_plan.update(dict.fromkeys(self._keep_in_fp32_modules, torch.float32)) + + # The _keep_in_fp32_modules_strict was introduced to always force upcast to fp32, for both fp16 and bf16 + if self._keep_in_fp32_modules_strict is not None and dtype in (torch.float16, torch.bfloat16): + dtype_plan.update(dict.fromkeys(self._keep_in_fp32_modules_strict, torch.float32)) + + return dtype_plan + + def set_use_kernels(self, use_kernels, kernel_config: KernelConfig | None = None): + """ + Set whether or not to use the `kernels` library to kernelize some layers of the model. + Args: + use_kernels (`bool`): + Whether or not to use the `kernels` library to kernelize some layers of the model. + kernel_config (`KernelConfig`, *optional*): + The kernel configuration to use to kernelize the model. If `None`, the default kernel mapping will be used. + """ + if use_kernels: + if not is_kernels_available(): + raise ValueError( + "`use_kernels=True` requires kernels>=0.9.0. Please install the latest version with `pip install -U kernels`" + ) + from kernels import use_kernel_mapping + + from .integrations.hub_kernels import register_kernel_mapping_transformers + + register_kernel_mapping_transformers() + + if kernel_config is not None and isinstance(kernel_config, KernelConfig): + # This will make sure the mapping is valid, and the layers are registered in the model + kernel_config.sanitize_kernel_mapping(self) + + # This will create a compatible mapping for the model with the kernels library + kernel_config.create_compatible_mapping(self) + + # This is a context manager to override the default kernel mapping + # We are calling kernelize inside this context manager using the use_kernels setter + # Param inherit_mapping should be False to avoid still loading kernel from remote + inherit_mapping = not kernel_config.use_local_kernel + with use_kernel_mapping(kernel_config.kernel_mapping, inherit_mapping=inherit_mapping): + self.use_kernels = True + # We use the default kernel mapping in .integrations.hub_kernels + else: + self.use_kernels = True + else: + self.use_kernels = False + + @classmethod + def from_pretrained( + cls: type[SpecificPreTrainedModelType], + pretrained_model_name_or_path: str | os.PathLike | None, + *model_args, + config: PreTrainedConfig | str | os.PathLike | None = None, + cache_dir: str | os.PathLike | None = None, + ignore_mismatched_sizes: bool = False, + force_download: bool = False, + local_files_only: bool = False, + token: str | bool | None = None, + revision: str = "main", + use_safetensors: bool | None = None, + weights_only: bool = True, + **kwargs, + ) -> SpecificPreTrainedModelType: + r""" + Instantiate a pretrained pytorch model from a pre-trained model configuration. + + The model is set in evaluation mode by default using `model.eval()` (Dropout modules are deactivated). To train + the model, you should first set it back in training mode with `model.train()`. + + The warning *Weights from XXX not initialized from pretrained model* means that the weights of XXX do not come + pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning + task. + + The warning *Weights from XXX not used in YYY* means that the layer XXX is not used by YYY, therefore those + weights are discarded. + + Parameters: + pretrained_model_name_or_path (`str` or `os.PathLike`, *optional*): + Can be either: + + - A string, the *model id* of a pretrained model hosted inside a model repo on huggingface.co. + - A path to a *directory* containing model weights saved using + [`~PreTrainedModel.save_pretrained`], e.g., `./my_model_directory/`. + - `None` if you are both providing the configuration and state dictionary (resp. with keyword + arguments `config` and `state_dict`). + model_args (sequence of positional arguments, *optional*): + All remaining positional arguments will be passed to the underlying model's `__init__` method. + config (`Union[PreTrainedConfig, str, os.PathLike]`, *optional*): + Can be either: + + - an instance of a class derived from [`PreTrainedConfig`], + - a string or path valid as input to [`~PreTrainedConfig.from_pretrained`]. + + Configuration for the model to use instead of an automatically loaded configuration. Configuration can + be automatically loaded when: + + - The model is a model provided by the library (loaded with the *model id* string of a pretrained + model). + - The model was saved using [`~PreTrainedModel.save_pretrained`] and is reloaded by supplying the + save directory. + - The model is loaded by supplying a local directory as `pretrained_model_name_or_path` and a + configuration JSON file named *config.json* is found in the directory. + state_dict (`dict[str, torch.Tensor]`, *optional*): + A state dictionary to use instead of a state dictionary loaded from saved weights file. + + This option can be used if you want to create a model from a pretrained configuration but load your own + weights. In this case though, you should check if using [`~PreTrainedModel.save_pretrained`] and + [`~PreTrainedModel.from_pretrained`] is not a simpler option. + cache_dir (`Union[str, os.PathLike]`, *optional*): + Path to a directory in which a downloaded pretrained model configuration should be cached if the + standard cache should not be used. + ignore_mismatched_sizes (`bool`, *optional*, defaults to `False`): + Whether or not to raise an error if some of the weights from the checkpoint do not have the same size + as the weights of the model (if for instance, you are instantiating a model with 10 labels from a + checkpoint with 3 labels). + force_download (`bool`, *optional*, defaults to `False`): + Whether or not to force the (re-)download of the model weights and configuration files, overriding the + cached versions if they exist. + proxies (`dict[str, str]`, *optional*): + A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128', + 'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request. + output_loading_info(`bool`, *optional*, defaults to `False`): + Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages. + local_files_only(`bool`, *optional*, defaults to `False`): + Whether or not to only look at local files (i.e., do not try to download the model). + token (`str` or `bool`, *optional*): + The token to use as HTTP bearer authorization for remote files. If `True`, or not specified, will use + the token generated when running `hf auth login` (stored in `~/.huggingface`). + revision (`str`, *optional*, defaults to `"main"`): + The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a + git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + identifier allowed by git. + + + + To test a pull request you made on the Hub, you can pass `revision="refs/pr/"`. + + + attn_implementation (`str`, *optional*): + The attention implementation to use in the model (if relevant). Can be any of `"eager"` (manual implementation of the attention), `"sdpa"` (using [`F.scaled_dot_product_attention`](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention.html)), `"flash_attention_2"` (using [Dao-AILab/flash-attention](https://github.com/Dao-AILab/flash-attention)), or `"flash_attention_3"` (using [Dao-AILab/flash-attention/hopper](https://github.com/Dao-AILab/flash-attention/tree/main/hopper)). By default, if available, SDPA will be used for torch>=2.1.1. The default is otherwise the manual `"eager"` implementation. + + Accept HF kernel references in the form: + /[@][:] + + - and are any non-"/" and non-":" sequences. + - "@" is optional (branch, tag, or commit-ish), e.g. "@main", "@v1.2.0", "@abc123". + - ":" is optional and selects a function inside the kernel repo. + - Both options can appear together and in this order only: @revision first, then :kernel_name. + - We intentionally allow a leading "|" prefix (e.g., "flash|...") because the code + strips it before loading; '|' is not excluded in the character classes here. + + Examples that match: + "org/model" + "org/model@main" + "org/model:custom_kernel" + "org/model@v1.2.3:custom_kernel" + experts_implementation (`str`, *optional*): + The experts implementation to use in the model (if relevant). Can be any of: + + - `"eager"` (sequential implementation of the experts matrix multiplications). + - `"batched_mm"` (using [`torch.bmm`](https://pytorch.org/docs/stable/generated/torch.bmm.html)). + - `"grouped_mm"` (using [`torch.nn.functional.grouped_mm`](https://docs.pytorch.org/docs/main/generated/torch.nn.functional.grouped_mm.html)). + + By default, if available, `grouped_mm` will be used for torch>=2.9.0. The default is otherwise the sequential `"eager"` implementation. + + > Parameters for big model inference + + dtype (`str` or `torch.dtype`, *optional*, defaults to `"auto"`): + Override the default `torch_dtype` and load the model under a specific `dtype`. The different options + are: + + 1. `torch.float16` or `torch.bfloat16` or `torch.float`: load in a specified + `dtype`, ignoring the model's `config.dtype` if one exists. If not specified + - the model will get loaded in `torch.float` (fp32). + + 2. `"auto"` - A `dtype` or `torch_dtype` entry in the `config.json` file of the model will be + attempted to be used. If this entry isn't found then next check the `dtype` of the first weight in + the checkpoint that's of a floating point type and use that as `dtype`. This will load the model + using the `dtype` it was saved in at the end of the training. It can't be used as an indicator of how + the model was trained. Since it could be trained in one of half precision dtypes, but saved in fp32. + + 3. A string that is a valid `torch.dtype`. E.g. "float32" loads the model in `torch.float32`, "float16" loads in `torch.float16` etc. + + + + For some models the `dtype` they were trained in is unknown - you may try to check the model's paper or + reach out to the authors and ask them to add this information to the model's card and to insert the + `dtype` or `torch_dtype` entry in `config.json` on the hub. + + + + device_map (`str` or `dict[str, Union[int, str, torch.device]]` or `int` or `torch.device`, *optional*): + A map that specifies where each submodule should go. It doesn't need to be refined to each + parameter/buffer name, once a given module name is inside, every submodule of it will be sent to the + same device. If we only pass the device (*e.g.*, `"cpu"`, `"cuda:1"`, `"mps"`, or a GPU ordinal rank + like `1`) on which the model will be allocated, the device map will map the entire model to this + device. Passing `device_map = 0` means put the whole model on GPU 0. + + To have Accelerate compute the most optimized `device_map` automatically, set `device_map="auto"`. For + more information about each option see [designing a device + map](https://hf.co/docs/accelerate/main/en/usage_guides/big_modeling#designing-a-device-map). + max_memory (`Dict`, *optional*): + A dictionary device identifier to maximum memory if using `device_map`. Will default to the maximum memory available for each + GPU and the available CPU RAM if unset. + tp_plan (`Optional[Union[dict, str]]`, *optional*): + A torch tensor parallel plan, see [here](https://pytorch.org/tutorials/intermediate/TP_tutorial.html). Use `tp_plan="auto"` to + use the predefined plan based on the model. If it's a dict, then it should match between module names and desired layout. + Note that if you use it, you should launch your script accordingly with `torchrun [args] script.py`. This will be much + faster than using a `device_map`, but has limitations. + tp_size (`str`, *optional*): + A torch tensor parallel degree. If not provided would default to world size. + device_mesh (`torch.distributed.DeviceMesh`, *optional*): + A torch device mesh. If not provided would default to world size. Used only for tensor parallel for now. + If provided, it has to contain dimension named `"tp"` in case it's > 1 dimensional, this dimension will be used for tensor parallelism + offload_folder (`str` or `os.PathLike`, *optional*): + If the `device_map` contains any value `"disk"`, the folder where we will offload weights. + offload_buffers (`bool`, *optional*): + Whether or not to offload the buffers with the model parameters. + quantization_config (`Union[QuantizationConfigMixin,Dict]`, *optional*): + A dictionary of configuration parameters or a QuantizationConfigMixin object for quantization (e.g + bitsandbytes, gptq). + subfolder (`str`, *optional*, defaults to `""`): + In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + specify the folder name here. + variant (`str`, *optional*): + If specified load weights from `variant` filename, *e.g.* pytorch_model..bin. + use_safetensors (`bool`, *optional*, defaults to `None`): + Whether or not to use `safetensors` checkpoints. Defaults to `None`. If not specified and `safetensors` + is not installed, it will be set to `False`. + weights_only (`bool`, *optional*, defaults to `True`): + Indicates whether unpickler should be restricted to loading only tensors, primitive types, + dictionaries and any types added via torch.serialization.add_safe_globals(). + When set to False, we can load wrapper tensor subclass weights. + key_mapping (`dict[str, str], *optional*): + A potential mapping of the weight names if using a model on the Hub which is compatible to a Transformers + architecture, but was not converted accordingly. + kwargs (remaining dictionary of keyword arguments, *optional*): + Can be used to update the configuration object (after it being loaded) and initiate the model (e.g., + `output_attentions=True`). Behaves differently depending on whether a `config` is provided or + automatically loaded: + + - If a configuration is provided with `config`, `**kwargs` will be directly passed to the + underlying model's `__init__` method (we assume all relevant updates to the configuration have + already been done) + - If a configuration is not provided, `kwargs` will be first passed to the configuration class + initialization function ([`~PreTrainedConfig.from_pretrained`]). Each key of `kwargs` that + corresponds to a configuration attribute will be used to override said attribute with the + supplied `kwargs` value. Remaining keys that do not correspond to any configuration attribute + will be passed to the underlying model's `__init__` function. + + + + Activate the special ["offline-mode"](https://huggingface.co/transformers/installation.html#offline-mode) to + use this method in a firewalled environment. + + + + Examples: + + ```python + >>> from transformers import BertConfig, BertModel + + >>> # Download model and configuration from huggingface.co and cache. + >>> model = BertModel.from_pretrained("google-bert/bert-base-uncased") + >>> # Model was saved using *save_pretrained('./test/saved_model/')* (for example purposes, not runnable). + >>> model = BertModel.from_pretrained("./test/saved_model/") + >>> # Update configuration during loading. + >>> model = BertModel.from_pretrained("google-bert/bert-base-uncased", output_attentions=True) + >>> assert model.config.output_attentions == True + ``` + """ + state_dict = kwargs.pop("state_dict", None) + proxies = kwargs.pop("proxies", None) + output_loading_info = kwargs.pop("output_loading_info", False) + from_pipeline = kwargs.pop("_from_pipeline", None) + from_auto_class = kwargs.pop("_from_auto", False) + dtype = kwargs.pop("dtype", None) + torch_dtype = kwargs.pop("torch_dtype", None) # kept for BC + device_map = kwargs.pop("device_map", None) + max_memory = kwargs.pop("max_memory", None) + offload_folder = kwargs.pop("offload_folder", None) + offload_buffers = kwargs.pop("offload_buffers", False) + quantization_config = kwargs.pop("quantization_config", None) + subfolder = kwargs.pop("subfolder", "") + commit_hash = kwargs.pop("_commit_hash", None) + variant = kwargs.pop("variant", None) + adapter_kwargs = (kwargs.pop("adapter_kwargs", {}) or {}).copy() + adapter_name = kwargs.pop("adapter_name", "default") + generation_config = kwargs.pop("generation_config", None) + gguf_file = kwargs.pop("gguf_file", None) + tp_plan = kwargs.pop("tp_plan", None) + tp_size = kwargs.pop("tp_size", None) + distributed_config: DistributedConfig = kwargs.pop("distributed_config", None) + device_mesh = kwargs.pop("device_mesh", None) + trust_remote_code = kwargs.pop("trust_remote_code", None) + use_kernels = kwargs.pop("use_kernels", False) + kernel_config = kwargs.pop("kernel_config", None) + key_mapping = kwargs.pop("key_mapping", None) + + if distributed_config is not None and tp_plan is None: + tp_plan = "auto" + + # Not used anymore -- remove them from the kwargs + for name in ["mirror", "_fast_init", "low_cpu_mem_usage", "from_tf", "from_flax", "offload_state_dict"]: + _ = kwargs.pop(name, None) + + # For BC on torch_dtype argument + if torch_dtype is not None: + dtype = dtype if dtype is not None else torch_dtype + if dtype is None: + dtype = "auto" + + if is_offline_mode() and not local_files_only: + local_files_only = True + + download_kwargs = { + "cache_dir": cache_dir, + "force_download": force_download, + "proxies": proxies, + "local_files_only": local_files_only, + "token": token, + "revision": revision, + "subfolder": subfolder, + } + download_kwargs_with_commit = {**download_kwargs, "commit_hash": commit_hash} + + if state_dict is not None and (pretrained_model_name_or_path is not None or gguf_file is not None): + raise ValueError( + "`state_dict` cannot be passed together with a model name or a `gguf_file`. Use one of the two loading strategies." + ) + + if device_map == "auto" and int(os.environ.get("WORLD_SIZE", "0")): + logger.info( + "You've set device_map=`auto` while triggering a distributed run with torchrun. This might lead to unexpected behavior. " + "If your plan is to load the model on each device, you should set device_map={" + ": PartialState().process_index} where PartialState comes from accelerate library" + ) + + if tp_plan is not None or tp_size is not None: # TP warnings, and setup + device_map, device_mesh, tp_size = initialize_tensor_parallelism( + tp_plan, tp_size=tp_size, device_mesh=device_mesh, device_map=device_map + ) + + if gguf_file is not None and not is_accelerate_available(): + raise ValueError("accelerate is required when loading a GGUF file `pip install accelerate`.") + + if adapter_kwargs is None: + adapter_kwargs = {} + + _adapter_model_path, pretrained_model_name_or_path, adapter_kwargs = maybe_load_adapters( + pretrained_model_name_or_path, + download_kwargs_with_commit, + **adapter_kwargs, + ) + device_map = check_and_set_device_map(device_map) # warn, error and fix the device map + + user_agent = {"file_type": "model", "framework": "pytorch", "from_auto_class": from_auto_class} + if from_pipeline is not None: + user_agent["using_pipeline"] = from_pipeline + + # Load config if we don't provide a configuration + if not isinstance(config, PreTrainedConfig): + config_path = config if config is not None else pretrained_model_name_or_path + config, model_kwargs = cls.config_class.from_pretrained( + config_path, + return_unused_kwargs=True, + gguf_file=gguf_file, + _from_auto=from_auto_class, + _from_pipeline=from_pipeline, + **download_kwargs, + **kwargs, + ) + if "gguf_file" in model_kwargs: + model_kwargs.pop("gguf_file") + commit_hash = model_kwargs.pop("_commit_hash", commit_hash) + else: + config = copy.deepcopy(config) + model_kwargs = kwargs + commit_hash = getattr(config, "_commit_hash", commit_hash) + + download_kwargs_with_commit["commit_hash"] = commit_hash + + # Because some composite configs call super().__init__ before instantiating the sub-configs, we need this call + # to correctly redispatch recursively if the kwarg is provided + if "attn_implementation" in kwargs: + config._attn_implementation = kwargs.pop("attn_implementation") + + if "experts_implementation" in kwargs: + config._experts_implementation = kwargs.pop("experts_implementation") + + hf_quantizer, config, device_map = get_hf_quantizer( + config, quantization_config, device_map, weights_only, user_agent + ) + + if gguf_file: + if hf_quantizer is not None: + raise ValueError( + "You cannot combine Quantization and loading a model from a GGUF file, try again by making sure you did not passed a `quantization_config` or that you did not load a quantized model from the Hub." + ) + if device_map is not None and ( + (isinstance(device_map, dict) and "disk" in device_map.values()) or "disk" in device_map + ): + raise RuntimeError( + "One or more modules is configured to be mapped to disk. Disk offload is not supported for models " + "loaded from GGUF files." + ) + + if kernel_config is not None and not use_kernels: + logger.warning_once( + "A kernel_config was provided but use_kernels is False; setting use_kernels=True automatically. To suppress this warning, explicitly set use_kernels to True." + ) + use_kernels = True + + checkpoint_files, sharded_metadata = _get_resolved_checkpoint_files( + pretrained_model_name_or_path=pretrained_model_name_or_path, + variant=variant, + gguf_file=gguf_file, + use_safetensors=use_safetensors, + download_kwargs=download_kwargs_with_commit, + user_agent=user_agent, + is_remote_code=cls._auto_class is not None, + transformers_explicit_filename=getattr(config, "transformers_weights", None), + ) + + is_quantized = hf_quantizer is not None + + if gguf_file: + from .modeling_gguf_pytorch_utils import load_gguf_checkpoint + + # we need a dummy model to get the state_dict - for this reason, we keep the state_dict as if it was + # passed directly as a kwarg from now on + with torch.device("meta"): + dummy_model = cls(config) + state_dict = load_gguf_checkpoint(checkpoint_files[0], return_tensors=True, model_to_load=dummy_model)[ + "tensors" + ] + + # Find the correct dtype based on current state + config, dtype = _get_dtype( + dtype, checkpoint_files, config, sharded_metadata, state_dict, weights_only, hf_quantizer + ) + + config.name_or_path = pretrained_model_name_or_path + model_init_context = cls.get_init_context(dtype, is_quantized, _is_ds_init_called) + config = copy.deepcopy(config) # We do not want to modify the config inplace in from_pretrained. + with ContextManagers(model_init_context): + # Let's make sure we don't run the init function of buffer modules + model = cls(config, *model_args, **model_kwargs) + + if hf_quantizer is not None: # replace module with quantized modules (does not touch weights) + hf_quantizer.preprocess_model( + model=model, + dtype=dtype, + device_map=device_map, + checkpoint_files=checkpoint_files, + use_kernels=use_kernels, + ) + + # Create the dtype_plan to potentially use the `keep_in_fp32` flags (this needs to be called on the already + # instantiated model, as the flags can be modified by instances sometimes) + dtype_plan = model._get_dtype_plan(dtype) + + # Obtain the weight conversion mapping for this model if any are registered + weight_conversions = get_model_conversion_mapping(model, key_mapping, hf_quantizer) + + if _torch_distributed_available and device_mesh is not None: # add hooks to nn.Modules: no weights + model = distribute_model(model, tp_plan, distributed_config, device_mesh, tp_size) + + # Prepare the full device map + if device_map is not None: + device_map = _get_device_map(model, device_map, max_memory, hf_quantizer) + + # Finalize model weight initialization + load_config = LoadStateDictConfig( + pretrained_model_name_or_path=pretrained_model_name_or_path, + ignore_mismatched_sizes=ignore_mismatched_sizes, + sharded_metadata=sharded_metadata, + device_map=device_map, + disk_offload_folder=offload_folder, + offload_buffers=offload_buffers, + dtype=dtype, + dtype_plan=dtype_plan, + hf_quantizer=hf_quantizer, + device_mesh=device_mesh, + weights_only=weights_only, + weight_mapping=weight_conversions, + use_safetensors=use_safetensors, + download_kwargs=download_kwargs, + ) + loading_info, disk_offload_index = cls._load_pretrained_model(model, state_dict, checkpoint_files, load_config) + loading_info = cls._finalize_model_loading(model, load_config, loading_info) + model.eval() # Set model in evaluation mode to deactivate Dropout modules by default + model.set_use_kernels(use_kernels, kernel_config) + + # If it is a model with generation capabilities, attempt to load generation files (generation config, + # custom generate function) + if model.can_generate() and hasattr(model, "adjust_generation_fn") and not gguf_file: + model.adjust_generation_fn( + generation_config, + from_auto_class, + from_pipeline, + pretrained_model_name_or_path, + **download_kwargs, + trust_remote_code=trust_remote_code, + **kwargs, + ) + + # If the device_map has more than 1 device: dispatch model with hooks on all devices + if device_map is not None and len(set(device_map.values())) > 1: + accelerate_dispatch(model, hf_quantizer, device_map, offload_folder, disk_offload_index, offload_buffers) + + if hf_quantizer is not None: + model.hf_quantizer = hf_quantizer + hf_quantizer.postprocess_model( + model + ) # usually a no-op but sometimes needed, e.g to remove the quant config when dequantizing + + if _adapter_model_path is not None: + if token is not None: + adapter_kwargs["token"] = token + loading_info = model.load_adapter( + _adapter_model_path, + adapter_name=adapter_name, + load_config=load_config, + adapter_kwargs=adapter_kwargs, + ) + + if output_loading_info: + return model, loading_info.to_dict() + return model + + @staticmethod + def _load_pretrained_model( + model: "PreTrainedModel", + state_dict: dict | None, + checkpoint_files: list[str] | None, + load_config: LoadStateDictConfig, + ) -> tuple[LoadStateDictInfo, dict]: + """Perform the actual loading of some checkpoints into a `model`, by reading them from disk and dispatching them accordingly.""" + is_quantized = load_config.is_quantized + is_hqq_or_quark = is_quantized and load_config.hf_quantizer.quantization_config.quant_method in { + QuantizationMethod.HQQ, + QuantizationMethod.QUARK, + } + + # Model's definition arriving here is final (TP hooks added, quantized layers replaces) + expected_keys = list(model.state_dict().keys()) + + if logger.level >= logging.WARNING: + verify_tp_plan(expected_keys, getattr(model, "_tp_plan", None)) + + # This offload index if for params explicitly on the "disk" in the device_map + disk_offload_index = None + # Prepare parameters offloading if needed + if load_config.device_map is not None and "disk" in load_config.device_map.values(): + disk_offload_index = accelerate_disk_offload( + model, + load_config.disk_offload_folder, + checkpoint_files, + load_config.device_map, + load_config.sharded_metadata, + load_config.dtype, + load_config.weight_mapping, + ) + + # Warmup cuda to load the weights much faster on devices + if load_config.device_map is not None and not is_hqq_or_quark: + expanded_device_map = expand_device_map(load_config.device_map, expected_keys) + caching_allocator_warmup(model, expanded_device_map, load_config.hf_quantizer) + + error_msgs = [] + + if is_deepspeed_zero3_enabled() and not is_quantized: + if state_dict is None: + merged_state_dict = {} + for ckpt_file in checkpoint_files: + merged_state_dict.update( + load_state_dict(ckpt_file, map_location="cpu", weights_only=load_config.weights_only) + ) + state_dict = merged_state_dict + error_msgs, missing_keys = _load_state_dict_into_zero3_model(model, state_dict, load_config) + # This is not true but for now we assume only best-case scenario with deepspeed, i.e. perfectly matching checkpoints + loading_info = LoadStateDictInfo( + missing_keys=missing_keys, + error_msgs=error_msgs, + unexpected_keys=set(), + mismatched_keys=set(), + conversion_errors={}, + ) + else: + all_pointer = set() + if state_dict is not None: + merged_state_dict = state_dict + elif checkpoint_files is not None and checkpoint_files[0].endswith(".safetensors") and state_dict is None: + merged_state_dict = {} + for file in checkpoint_files: + file_pointer = safe_open(file, framework="pt", device="cpu") + all_pointer.add(file_pointer) + for k in file_pointer.keys(): + merged_state_dict[k] = file_pointer.get_slice(k) # don't materialize yet + # Checkpoints are .bin + elif checkpoint_files is not None: + merged_state_dict = {} + for ckpt_file in checkpoint_files: + merged_state_dict.update(load_state_dict(ckpt_file)) + else: + raise ValueError("Neither a state dict nor checkpoint files were found.") + + loading_info, disk_offload_index = convert_and_load_state_dict_in_model( + model=model, + state_dict=merged_state_dict, + load_config=load_config, + tp_plan=model._tp_plan, + disk_offload_index=disk_offload_index, + ) + + # finally close all opened file pointers + for k in all_pointer: + k.__exit__(None, None, None) + + return loading_info, disk_offload_index + + @staticmethod + def _finalize_model_loading( + model, load_config: LoadStateDictConfig, loading_info: LoadStateDictInfo + ) -> LoadStateDictInfo: + """Perform all post processing operations after having loaded some checkpoints into a model, such as moving + missing keys from meta device to their expected device, reinitializing missing weights according to proper + distributions, tying the weights and logging the loading report.""" + try: + # Adjust `all_tied_weights_keys` before marking them as initialized + model._adjust_tied_keys_with_tied_pointers(loading_info.missing_and_mismatched()) + + # Marks tied weights as `_is_hf_initialized` to avoid initializing them (it's very important for efficiency) + model.mark_tied_weights_as_initialized() + + # Move missing (and potentially mismatched) keys and non-persistent buffers back to their expected device from + # meta device (because they were not moved when loading the weights as they were not in the loaded state dict) + model._move_missing_keys_from_meta_to_device( + loading_info.missing_and_mismatched(), + load_config.device_map, + load_config.device_mesh, + load_config.hf_quantizer, + ) + + # Correctly initialize the missing (and potentially mismatched) keys (all parameters without the `_is_hf_initialized` flag) + model._initialize_missing_keys(load_config.is_quantized) + + # Tie the weights + model.tie_weights(missing_keys=loading_info.missing_keys, recompute_mapping=False) + + # Adjust missing and unexpected keys + model._adjust_missing_and_unexpected_keys(loading_info) + finally: + log_state_dict_report( + model=model, + pretrained_model_name_or_path=load_config.pretrained_model_name_or_path, + ignore_mismatched_sizes=load_config.ignore_mismatched_sizes, + loading_info=loading_info, + logger=logger, + ) + + return loading_info + + def retrieve_modules_from_names(self, names, add_prefix=False, remove_prefix=False): + module_keys = {".".join(key.split(".")[:-1]) for key in names} + + # torch.nn.ParameterList is a special case where two parameter keywords + # are appended to the module name, *e.g.* bert.special_embeddings.0 + module_keys = module_keys.union( + {".".join(key.split(".")[:-2]) for key in names if len(key) > 0 and key[-1].isdigit()} + ) + + retrieved_modules = [] + # retrieve all modules that has at least one missing weight name + for name, module in self.named_modules(): + if remove_prefix: + _prefix = f"{self.base_model_prefix}." + name = name.removeprefix(_prefix) + elif add_prefix: + name = ".".join([self.base_model_prefix, name]) if len(name) > 0 else self.base_model_prefix + + if name in module_keys: + retrieved_modules.append(module) + + return retrieved_modules + + @classmethod + def register_for_auto_class(cls, auto_class="AutoModel"): + """ + Register this class with a given auto class. This should only be used for custom models as the ones in the + library are already mapped with an auto class. + + + + Args: + auto_class (`str` or `type`, *optional*, defaults to `"AutoModel"`): + The auto class to register this new model with. + """ + if not isinstance(auto_class, str): + auto_class = auto_class.__name__ + + import transformers.models.auto as auto_module + + if not hasattr(auto_module, auto_class): + raise ValueError(f"{auto_class} is not a valid auto class.") + + cls._auto_class = auto_class + + def warn_if_padding_and_no_attention_mask(self, input_ids, attention_mask): + """ + Shows a one-time warning if the input_ids appear to contain padding and no attention mask was given. + """ + + # Skip the check during tracing. + if is_tracing(input_ids): + return + + if (attention_mask is not None) or (self.config.pad_token_id is None): + return + + # Check only the first and last input IDs to reduce overhead. + if self.config.pad_token_id in input_ids[:, [-1, 0]]: + warn_string = ( + "We strongly recommend passing in an `attention_mask` since your input_ids may be padded. See " + "https://huggingface.co/docs/transformers/troubleshooting" + "#incorrect-output-when-padding-tokens-arent-masked." + ) + + # If the pad token is equal to either BOS, EOS, or SEP, we do not know whether the user should use an + # attention_mask or not. In this case, we should still show a warning because this is a rare case. + # NOTE: `sep_token_id` is not used in all models and it can be absent in the config + sep_token_id = getattr(self.config, "sep_token_id", None) + if ( + (self.config.bos_token_id is not None and self.config.bos_token_id == self.config.pad_token_id) + or (self.config.eos_token_id is not None and self.config.eos_token_id == self.config.pad_token_id) + or (sep_token_id is not None and sep_token_id == self.config.pad_token_id) + ): + warn_string += ( + f"\nYou may ignore this warning if your `pad_token_id` ({self.config.pad_token_id}) is identical " + f"to the `bos_token_id` ({self.config.bos_token_id}), `eos_token_id` ({self.config.eos_token_id}), " + f"or the `sep_token_id` ({sep_token_id}), and your input is not padded." + ) + + logger.warning_once(warn_string) + + @property + def supports_tp_plan(self): + """ + Returns whether the model has a tensor parallelism plan. + """ + if self._tp_plan is not None: + return True + # Check if base model has a TP plan + if getattr(self.base_model, "_tp_plan", None) is not None: + return True + if self.config.base_model_tp_plan is not None: + return True + return False + + @property + def tp_size(self): + """ + Returns the model's tensor parallelism degree. + """ + # if None, the model didn't undergo tensor parallel sharding + return self._tp_size + + @property + def supports_pp_plan(self): + if self._pp_plan is not None: + return True + # Check if base model has PP plan + if getattr(self.base_model, "_pp_plan", None) is not None: + return True + return False + + @property + def loss_function(self): + if hasattr(self, "_loss_function"): + return self._loss_function + + loss_type = getattr(self, "loss_type", None) + + if loss_type is None or loss_type not in LOSS_MAPPING: + logger.warning_once( + f"`loss_type={loss_type}` was set in the config but it is unrecognized. " + f"Using the default loss: `ForCausalLMLoss`." + ) + loss_type = "ForCausalLM" + return LOSS_MAPPING[loss_type] + + @loss_function.setter + def loss_function(self, value): + self._loss_function = value + + def kernelize(self, mode=None): + if not is_kernels_available(): + raise ValueError( + "Kernels are not available. To use kernels, please install kernels using `pip install kernels`" + ) + from kernels import Device, Mode, kernelize + + mode = Mode.INFERENCE if not self.training else Mode.TRAINING if mode is None else mode + kernelize(self, device=Device(type=self.device.type), mode=mode) + self._use_kernels = True + + @property + def use_kernels(self) -> bool: + return getattr(self, "_use_kernels", False) + + @use_kernels.setter + def use_kernels(self, value: bool) -> None: + # Avoid re-kernelizing if already enabled + if bool(value) and getattr(self, "_use_kernels", False): + return + + if value: + self.kernelize() + else: + if getattr(self, "_use_kernels", False): + logger.warning_once( + "Disabling kernels at runtime is a no-op as there is no 'unkernelize' routine; keeping current kernels active." + ) + self._use_kernels = False + + def get_compiled_call(self, compile_config: CompileConfig | None) -> Callable: + """Return a `torch.compile`'d version of `self.__call__`. This is useful to dynamically choose between + non-compiled/compiled `forward` during inference, especially to switch between prefill (where we don't + want to use compiled version to avoid recomputing the graph with new shapes) and iterative decoding + (where we want the speed-ups of compiled version with static shapes).""" + # Only reset it if not present or different from previous config + if "llama4" in self.config.model_type: # TODO try to enable for FULL COMPILE HYBRID CACHE SUPPORT + return self.__call__ + compile_config = compile_config or CompileConfig() + default_config = getattr(self.generation_config, "compile_config", None) or CompileConfig() + if ( + not hasattr(self, "_compiled_call") + or getattr(self, "_last_compile_config", default_config) != compile_config + ): + self._last_compile_config = compile_config + self._compiled_call = torch.compile(self.__call__, **compile_config.to_dict()) + return self._compiled_call + + @classmethod + def is_backend_compatible(cls): + return cls._supports_attention_backend + + def _adjust_tied_keys_with_tied_pointers(self, missing_keys: list[str]) -> None: + """ + Adds keys to `self.all_tied_weights_keys` by checking if any group of params + share the same data ptr. It helps us support remote code where the weight tying is + done in old-T5 style, by manually assigning the same module to different param names. + If we don't add them back in `self.all_tied_weights_keys`, they will be re-initialized + and all params in tied group get random weights. + """ + param_pointers = defaultdict(list) + for param_name, param_value in self.state_dict().items(): + param_pointers[param_value.data_ptr()].append(param_name) + + # Filter out params that are already in `self.all_tied_weights_keys` or if all + # are missing params. Missing param groups share the same data ptr by being on `meta` + tied_param_names = [ + names + for names in param_pointers.values() + if len(names) > 1 + and not any(name in self.all_tied_weights_keys.keys() for name in names) + and not all(name in missing_keys for name in names) + ] + + # Create a dummy mapping, it doesn't matter which one is source/target + # because they are already tied + tied_weights_keys_by_pointers = { + param_name: group[0] for group in tied_param_names for param_name in group[1:] + } + self.all_tied_weights_keys.update(tied_weights_keys_by_pointers) + + def _move_missing_keys_from_meta_to_device( + self, + missing_keys: list[str], + device_map: dict | None, + device_mesh: "torch.distributed.device_mesh.DeviceMesh | None", + hf_quantizer: HfQuantizer | None, + ) -> None: + """Move the missing keys (keys that are part of the model parameters, but were NOT found in the loaded state dicts) + back from meta device to their device according to the `device_map` if any, else cpu. Takes care of sharding those + missing parameters if `device_mesh` is provided, i.e. we are using TP. + All non-persistent buffers are also moved back to the correct device (they are not part of the state_dict, but are + not missing either). + """ + is_quantized = hf_quantizer is not None + # This is the only case where we do not initialize the model on meta device, so we don't have to do anything here + if is_deepspeed_zero3_enabled() and not is_quantized: + return + + # In this case we need to move everything back + if is_fsdp_enabled() and not is_local_dist_rank_0() and not is_quantized: + for key, param in self.named_parameters(): + value = torch.empty_like(param, device="cpu") + _load_parameter_into_model(self, key, value) + for key, buffer in self.named_buffers(): + value = torch.empty_like(buffer, device="cpu") + _load_parameter_into_model(self, key, value) + return + + # The tied weight keys are in the "missing" usually, but they should not be moved (they will be tied anyway) + # This is especially important because if they are moved, they will lose the `_is_hf_initialized` flag, and they + # will be re-initialized for nothing (which can be quite long) + for key in missing_keys - self.all_tied_weights_keys.keys(): + param = self.get_parameter_or_buffer(key) + param_device = get_device(device_map, key, valid_torch_device=True) + value = torch.empty_like(param, device=param_device) + # For TP, we may need to shard the param + if device_mesh is not None: + shard_and_distribute_module( + self, value, param, key, None, False, device_mesh.get_local_rank(), device_mesh + ) + # Otherwise, just move it to device + else: + _load_parameter_into_model(self, key, value) + # We need to move back non-persistent buffers as well, as they are not part of loaded weights anyway + for key, buffer in self.named_non_persistent_buffers(): + buffer_device = get_device(device_map, key, valid_torch_device=True) + value = torch.empty_like(buffer, device=buffer_device) + _load_parameter_into_model(self, key, value) + + def _initialize_missing_keys(self, is_quantized: bool) -> None: + """ + Initialize the missing keys (keys that are part of the model parameters, but were NOT found in the loaded state dicts), according to + `_initialize_weights`. Indeed, since the corresponding weights are missing from the state dict, they will not be replaced and need to + be initialized correctly (i.e. weight initialization distribution). + + Params that are not missing have the `is_hf_initialized` flag. + """ + # This will only initialize submodules that are not marked as initialized by the line above. + if is_deepspeed_zero3_enabled() and not is_quantized: + import deepspeed + + # keep_vars=True as we need the original tensors, so that the "_is_hf_initialized" is present on them + not_initialized_parameters = list( + {v for v in self.state_dict(keep_vars=True).values() if not getattr(v, "_is_hf_initialized", False)} + ) + with deepspeed.zero.GatheredParameters(not_initialized_parameters, modifier_rank=0): + self.initialize_weights() + else: + self.initialize_weights() + + def _adjust_missing_and_unexpected_keys(self, loading_info: LoadStateDictInfo) -> None: + """Adjust the `missing_keys` and `unexpected_keys` based on current model's exception rules, to avoid + raising unneeded warnings/errors. This is performed in-place. + """ + # Old checkpoints may have keys for rotary_emb.inv_freq for each layer, however we moved this buffer to the main model + # (so the buffer name has changed). Remove them in such a case. This is another exception that was not added to + # `_keys_to_ignore_on_load_unexpected` as it touches many models -> we add it manually to the existing patterns + has_inv_freq_buffers = any(buffer.endswith("rotary_emb.inv_freq") for buffer, _ in self.named_buffers()) + additional_unexpected_patterns = [r"rotary_emb\.inv_freq"] if has_inv_freq_buffers else [] + + missing_patterns = self._keys_to_ignore_on_load_missing or [] + unexpected_patterns = (self._keys_to_ignore_on_load_unexpected or []) + additional_unexpected_patterns + ignore_missing_regex, ignore_unexpected_regex = None, None + if len(missing_patterns) > 0: + ignore_missing_regex = re.compile("|".join(rf"({pattern})" for pattern in missing_patterns)) + if len(unexpected_patterns) > 0: + ignore_unexpected_regex = re.compile("|".join(rf"({pattern})" for pattern in unexpected_patterns)) + + # Clean-up missing keys + if ignore_missing_regex is not None: + loading_info.missing_keys = { + key for key in loading_info.missing_keys if ignore_missing_regex.search(key) is None + } + + # Clean-up unexpected keys + if ignore_unexpected_regex is not None: + loading_info.unexpected_keys = { + key for key in loading_info.unexpected_keys if ignore_unexpected_regex.search(key) is None + } + + def mark_tied_weights_as_initialized(self): + """Adds the `_is_hf_initialized` flag on parameters that will be tied, in order to avoid initializing them + later as they will be tied (overwritten) anyway. + This is very important as most embeddings are tied, and they are huge params (vocabularies are often 256k), so + running inits on them is very costly.""" + for tied_param in self.all_tied_weights_keys.keys(): + param = self.get_parameter(tied_param) + param._is_hf_initialized = True + + def get_parameter_or_buffer(self, target: str): + """ + Return the parameter or buffer given by `target` if it exists, otherwise throw an error. This combines + `get_parameter()` and `get_buffer()` in a single handy function. If the target is an `_extra_state` attribute, + it will return the extra state provided by the module. Note that it only work if `target` is a leaf of the model. + """ + try: + return self.get_parameter(target) + except AttributeError: + pass + try: + return self.get_buffer(target) + except AttributeError: + pass + module, param_name = get_module_from_name(self, target) + if ( + param_name == "_extra_state" + and getattr(module.__class__, "get_extra_state", torch.nn.Module.get_extra_state) + is not torch.nn.Module.get_extra_state + ): + return module.get_extra_state() + + raise AttributeError(f"`{target}` is neither a parameter, buffer, nor extra state.") + + def named_non_persistent_buffers( + self, recurse: bool = True, remove_duplicate: bool = True + ) -> Iterator[tuple[str, torch.Tensor]]: + """Similar to `named_buffers`, but only yield non-persistent ones. It is handy as it's not perfectly straightforward + to know if they are persistent or not""" + for name, tensor in self.named_buffers(recurse=recurse, remove_duplicate=remove_duplicate): + # We have to grab the parent here, as the attribute `_non_persistent_buffers_set` is on the immediate + # parent only + parent, buf_name = name.rsplit(".", 1) if "." in name else ("", name) + parent = self.get_submodule(parent) + if buf_name in parent._non_persistent_buffers_set: + yield name, tensor + + def train(self, mode: bool = True): + out = super().train(mode) + if self.use_kernels: + self.kernelize() + return out + + def eval(self): + return self.train(False) + + +PreTrainedModel.push_to_hub = copy_func(PreTrainedModel.push_to_hub) +if PreTrainedModel.push_to_hub.__doc__ is not None: + PreTrainedModel.push_to_hub.__doc__ = PreTrainedModel.push_to_hub.__doc__.format( + object="model", object_class="AutoModel", object_files="model file" + ) + + +def unwrap_model(model: nn.Module, recursive: bool = False) -> nn.Module: + """ + Recursively unwraps a model from potential containers (as used in distributed training). + + Args: + model (`torch.nn.Module`): The model to unwrap. + recursive (`bool`, *optional*, defaults to `False`): + Whether to recursively extract all cases of `module.module` from `model` as well as unwrap child sublayers + recursively, not just the top-level distributed containers. + """ + # Use accelerate implementation if available (should always be the case when using torch) + # This is for pytorch, as we also have to handle things like dynamo + if is_accelerate_available(): + kwargs = {} + if recursive: + kwargs["recursive"] = recursive + return extract_model_from_parallel(model, **kwargs) + else: + # since there could be multiple levels of wrapping, unwrap recursively + if hasattr(model, "module"): + return unwrap_model(model.module) + else: + return model + + +def is_accelerator_device(device: str | int | torch.device) -> bool: + """Check if the device is an accelerator. We need to function, as device_map can be "disk" as well, which is not + a proper `torch.device`. + """ + if device == "disk": + return False + else: + return torch.device(device).type not in ["meta", "cpu"] + + +def get_total_byte_count( + model: PreTrainedModel, accelerator_device_map: dict, hf_quantizer: HfQuantizer | None = None +): + """ + This utility function calculates the total bytes count needed to load the model on each device. + This is useful for caching_allocator_warmup as we want to know how much cache we need to pre-allocate. + """ + + total_byte_count = defaultdict(lambda: 0) + tied_param_names = model.all_tied_weights_keys.keys() + tp_plan = model._tp_plan if torch.distributed.is_available() and torch.distributed.is_initialized() else [] + + for param_name, device in accelerator_device_map.items(): + # Skip if the parameter has already been accounted for (tied weights) + if param_name in tied_param_names: + continue + + param = model.get_parameter_or_buffer(param_name) + + if hf_quantizer is not None: + dtype_size = hf_quantizer.param_element_size(model, param_name, param) + else: + dtype_size = param.element_size() + + param_byte_count = param.numel() * dtype_size + + if len(tp_plan) > 0: + is_part_of_plan = _get_parameter_tp_plan(param_name, tp_plan, is_weight=True) is not None + param_byte_count //= torch.distributed.get_world_size() if is_part_of_plan else 1 + + total_byte_count[device] += param_byte_count + return total_byte_count + + +def caching_allocator_warmup(model: PreTrainedModel, expanded_device_map: dict, hf_quantizer: HfQuantizer | None): + """This function warm-ups the caching allocator based on the size of the model tensors that will reside on each + device. It allows to have one large call to Malloc, instead of recursively calling it later when loading + the model, which is actually the loading speed bottleneck. + Calling this function allows to cut the model loading time by a very large margin. + + A few facts related to loading speed (taking into account the use of this function): + - When loading a model the first time, it is usually slower than the subsequent times, because the OS is very likely + to cache the different state dicts (if enough resources/RAM are available) + - Trying to force the OS to cache the files in advance (by e.g. accessing a small portion of them) is really hard, + and not a good idea in general as this is low level OS optimizations that depend on resource usage anyway + - As of 18/03/2025, loading a Llama 70B model with TP takes ~1 min without file cache, and ~13s with full file cache. + The baseline, i.e. only loading the tensor shards on device and adjusting dtype (i.e. copying them) is ~5s with full cache. + These numbers are reported for TP on 4 H100 GPUs. + - It is useless to pre-allocate more than the model size in this function (i.e. using an `allocation_factor` > 1) as + cudaMalloc is not a bottleneck at all anymore + - Loading speed bottleneck is now almost only tensor copy (i.e. changing the dtype) and moving the tensors to the devices. + However, we cannot really improve on those aspects obviously, as the data needs to be moved/copied in the end. + """ + # Remove disk, cpu and meta devices, and cast to proper torch.device + accelerator_device_map = { + param: torch.device(device) for param, device in expanded_device_map.items() if is_accelerator_device(device) + } + if not accelerator_device_map: + return + + total_byte_count = get_total_byte_count(model, accelerator_device_map, hf_quantizer) + + # This will kick off the caching allocator to avoid having to Malloc afterwards + for device, byte_count in total_byte_count.items(): + if device.type in ["cuda", "xpu"]: + accelerator_module = getattr(torch, device.type) + index = device.index if device.index is not None else accelerator_module.current_device() + free_device_memory, total_device_memory = accelerator_module.mem_get_info(index) + unused_memory = accelerator_module.memory_reserved(index) - accelerator_module.memory_allocated(index) + # If we have reserved but unused memory, we can lower the allocation we want to make, but only if it's still + # higher than the unused memory. This is because otherwise torch will use that unused memory when performing + # our own allocation, thus not allocating any new memory from the GPU. For example if byte_count=6 GiB, + # unused_memory=4 GiB, then we cannot allocate only 2 GiB as this would *likely* (may not be exact, due to + # fragmentation issues) simply use the pool of 4 GiB unused memory that is available. In those cases, it's better + # to allocate more than the technically only 2 GiB required + if byte_count - unused_memory > unused_memory: + byte_count = byte_count - unused_memory + # Minimum amount that will trigger new gpu allocation, even if it's technically "too much" compared to what we need + elif byte_count - unused_memory > 1.5 * 1024**3: + # Nothing we can do here, the memory will need to fill itself as we load params, but we cannot reallocate + # from gpu until the unused memory is not filled + if unused_memory + 1 > free_device_memory: + byte_count = 0 + # We allocate the minimum amount that will force new gpu allocation, even if it's technically "too much" + else: + byte_count = unused_memory + 1 + # If we only need to reallocate less than 1.5 GiB of what is already allocated, then don't allocate more + else: + byte_count = 0 + # Allow up to (max device memory - 1.2 GiB) in resource-constrained hardware configurations. Trying to reserve more + # than that amount might sometimes lead to unnecessary cuda/xpu OOM, if the last parameter to be loaded on the device is large, + # and the remaining reserved memory portion is smaller than the param size -> torch will then try to fully re-allocate all + # the param size, instead of using the remaining reserved part, and allocating only the difference, which can lead + # to OOM. See https://github.com/huggingface/transformers/issues/37436#issuecomment-2808982161 for more details. + # Note that we use an absolute value instead of device proportion here, as a 8GiB device could still allocate too much + # if using e.g. 90% of device size, while a 140GiB device would allocate too little + byte_count = min(byte_count, total_device_memory - 1.2 * 1024**3) + # We divide by 2 here as we allocate in fp16 + _ = torch.empty(int(byte_count // 2), dtype=torch.float16, device=device, requires_grad=False) + + +class AttentionInterface(GeneralInterface): + """ + Dict-like object keeping track of allowed attention functions. You can easily add a new attention function + with a call to `register()`. If a model needs to locally overwrite an existing attention function, say `sdpa`, + it needs to declare a new instance of this class inside the `modeling_.py`, and declare it on that instance. + """ + + # Class instance object, so that a call to `register` can be reflected into all other files correctly, even if + # a new instance is created (in order to locally override a given function) + _global_mapping = { + "flash_attention_3": flash_attention_forward, + "flash_attention_2": flash_attention_forward, + "flex_attention": flex_attention_forward, + "sdpa": sdpa_attention_forward, + "paged|flash_attention_3": paged_attention_forward, + "paged|flash_attention_2": paged_attention_forward, + "paged|sdpa": sdpa_attention_paged_forward, + "paged|eager": eager_paged_attention_forward, + } + + def get_interface(self, attn_implementation: str, default: Callable) -> Callable: + """Return the requested `attn_implementation`. Also strictly check its validity, and raise if invalid.""" + if attn_implementation is None: + logger.warning_once( + "You tried to access the `AttentionInterface` with a `config._attn_implementation` set to `None`. This " + "is expected if you use an Attention Module as a standalone Module. If this is not the case, something went " + "wrong with the dispatch of `config._attn_implementation`" + ) + elif attn_implementation != "eager" and attn_implementation not in self: + raise KeyError( + f"`{attn_implementation}` is not a valid attention implementation registered in the `AttentionInterface`" + ) + return super().get(attn_implementation, default) + + +# Global AttentionInterface shared by all models which do not need to overwrite any of the existing ones +ALL_ATTENTION_FUNCTIONS: AttentionInterface = AttentionInterface() + + +class PreTrainedAudioTokenizerBase(PreTrainedModel): + """ + Class that additionally defines the behavior of any `audio_tokenizer` to be added. + Characteristic for any of them: + 1. Encode raw audio into discrete audio codebooks (with x channels) + 2. Decode from discrete audio codebooks back to raw audio + It is possible that they can decode in different ways given a different representation + but they are forced to support 2. nonetheless, e.g. see `DAC`. + """ + + @abstractmethod + def encode(self, input_values: torch.Tensor, *args, **kwargs): + """ + Encode raw audio retrieved from a respective `FeatureExtractor` into discrete audio codebooks (with x channels) + """ + + @abstractmethod + def decode(self, audio_codes: torch.Tensor, *args, **kwargs): + """Decode from discrete audio codebooks back to raw audio""" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/optimization.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/optimization.py new file mode 100644 index 0000000000000000000000000000000000000000..94e95cbf1a73851a7c3dcefea9af8295951bcf02 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/optimization.py @@ -0,0 +1,972 @@ +# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""PyTorch optimization for BERT model.""" + +import math +import warnings +from functools import partial + +import torch +from torch.optim import Optimizer +from torch.optim.lr_scheduler import LambdaLR, ReduceLROnPlateau + +from .trainer_pt_utils import LayerWiseDummyOptimizer, LayerWiseDummyScheduler +from .trainer_utils import SchedulerType +from .utils import logging + + +logger = logging.get_logger(__name__) + + +def _get_constant_lambda(_=None): + return 1 + + +def get_constant_schedule(optimizer: Optimizer, last_epoch: int = -1): + """ + Create a schedule with a constant learning rate, using the learning rate set in optimizer. + + Args: + optimizer ([`~torch.optim.Optimizer`]): + The optimizer for which to schedule the learning rate. + last_epoch (`int`, *optional*, defaults to -1): + The index of the last epoch when resuming training. + + Return: + `torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule. + """ + + return LambdaLR(optimizer, _get_constant_lambda, last_epoch=last_epoch) + + +def get_reduce_on_plateau_schedule(optimizer: Optimizer, **kwargs): + """ + Create a schedule with a constant learning rate that decreases when a metric has stopped improving. + + Args: + optimizer ([`~torch.optim.Optimizer`]): + The optimizer for which to schedule the learning rate. + kwargs (`dict`, *optional*): + Extra parameters to be passed to the scheduler. See `torch.optim.lr_scheduler.ReduceLROnPlateau` + for possible parameters. + + Return: + `torch.optim.lr_scheduler.ReduceLROnPlateau` with the appropriate schedule. + """ + + return ReduceLROnPlateau(optimizer, **kwargs) + + +def _get_constant_schedule_with_warmup_lr_lambda(current_step: int, *, num_warmup_steps: int): + if current_step < num_warmup_steps: + return float(current_step) / float(max(1.0, num_warmup_steps)) + return 1.0 + + +def get_constant_schedule_with_warmup(optimizer: Optimizer, num_warmup_steps: int, last_epoch: int = -1): + """ + Create a schedule with a constant learning rate preceded by a warmup period during which the learning rate + increases linearly between 0 and the initial lr set in the optimizer. + + Args: + optimizer ([`~torch.optim.Optimizer`]): + The optimizer for which to schedule the learning rate. + num_warmup_steps (`int`): + The number of steps for the warmup phase. + last_epoch (`int`, *optional*, defaults to -1): + The index of the last epoch when resuming training. + + Return: + `torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule. + """ + + lr_lambda = partial(_get_constant_schedule_with_warmup_lr_lambda, num_warmup_steps=num_warmup_steps) + return LambdaLR(optimizer, lr_lambda, last_epoch=last_epoch) + + +def _get_linear_schedule_with_warmup_lr_lambda(current_step: int, *, num_warmup_steps: int, num_training_steps: int): + if current_step < num_warmup_steps: + return float(current_step) / float(max(1, num_warmup_steps)) + return max(0.0, float(num_training_steps - current_step) / float(max(1, num_training_steps - num_warmup_steps))) + + +def get_linear_schedule_with_warmup(optimizer, num_warmup_steps, num_training_steps, last_epoch=-1): + """ + Create a schedule with a learning rate that decreases linearly from the initial lr set in the optimizer to 0, after + a warmup period during which it increases linearly from 0 to the initial lr set in the optimizer. + + Args: + optimizer ([`~torch.optim.Optimizer`]): + The optimizer for which to schedule the learning rate. + num_warmup_steps (`int`): + The number of steps for the warmup phase. + num_training_steps (`int`): + The total number of training steps. + last_epoch (`int`, *optional*, defaults to -1): + The index of the last epoch when resuming training. + + Return: + `torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule. + """ + + lr_lambda = partial( + _get_linear_schedule_with_warmup_lr_lambda, + num_warmup_steps=num_warmup_steps, + num_training_steps=num_training_steps, + ) + return LambdaLR(optimizer, lr_lambda, last_epoch) + + +def _get_cosine_schedule_with_warmup_lr_lambda( + current_step: int, *, num_warmup_steps: int, num_training_steps: int, num_cycles: float +): + if current_step < num_warmup_steps: + return float(current_step) / float(max(1, num_warmup_steps)) + progress = float(current_step - num_warmup_steps) / float(max(1, num_training_steps - num_warmup_steps)) + return max(0.0, 0.5 * (1.0 + math.cos(math.pi * float(num_cycles) * 2.0 * progress))) + + +def get_cosine_schedule_with_warmup( + optimizer: Optimizer, num_warmup_steps: int, num_training_steps: int, num_cycles: float = 0.5, last_epoch: int = -1 +): + """ + Create a schedule with a learning rate that decreases following the values of the cosine function between the + initial lr set in the optimizer to 0, after a warmup period during which it increases linearly between 0 and the + initial lr set in the optimizer. + + Args: + optimizer ([`~torch.optim.Optimizer`]): + The optimizer for which to schedule the learning rate. + num_warmup_steps (`int`): + The number of steps for the warmup phase. + num_training_steps (`int`): + The total number of training steps. + num_cycles (`float`, *optional*, defaults to 0.5): + The number of waves in the cosine schedule (the defaults is to just decrease from the max value to 0 + following a half-cosine). + last_epoch (`int`, *optional*, defaults to -1): + The index of the last epoch when resuming training. + + Return: + `torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule. + """ + + lr_lambda = partial( + _get_cosine_schedule_with_warmup_lr_lambda, + num_warmup_steps=num_warmup_steps, + num_training_steps=num_training_steps, + num_cycles=num_cycles, + ) + return LambdaLR(optimizer, lr_lambda, last_epoch) + + +def _get_cosine_with_hard_restarts_schedule_with_warmup_lr_lambda( + current_step: int, *, num_warmup_steps: int, num_training_steps: int, num_cycles: int +): + if current_step < num_warmup_steps: + return float(current_step) / float(max(1, num_warmup_steps)) + progress = float(current_step - num_warmup_steps) / float(max(1, num_training_steps - num_warmup_steps)) + if progress >= 1.0: + return 0.0 + return max(0.0, 0.5 * (1.0 + math.cos(math.pi * ((float(num_cycles) * progress) % 1.0)))) + + +def get_cosine_with_hard_restarts_schedule_with_warmup( + optimizer: Optimizer, num_warmup_steps: int, num_training_steps: int, num_cycles: int = 1, last_epoch: int = -1 +): + """ + Create a schedule with a learning rate that decreases following the values of the cosine function between the + initial lr set in the optimizer to 0, with several hard restarts, after a warmup period during which it increases + linearly between 0 and the initial lr set in the optimizer. + + Args: + optimizer ([`~torch.optim.Optimizer`]): + The optimizer for which to schedule the learning rate. + num_warmup_steps (`int`): + The number of steps for the warmup phase. + num_training_steps (`int`): + The total number of training steps. + num_cycles (`int`, *optional*, defaults to 1): + The number of hard restarts to use. + last_epoch (`int`, *optional*, defaults to -1): + The index of the last epoch when resuming training. + + Return: + `torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule. + """ + + lr_lambda = partial( + _get_cosine_with_hard_restarts_schedule_with_warmup_lr_lambda, + num_warmup_steps=num_warmup_steps, + num_training_steps=num_training_steps, + num_cycles=num_cycles, + ) + return LambdaLR(optimizer, lr_lambda, last_epoch) + + +def _get_polynomial_decay_schedule_with_warmup_lr_lambda( + current_step: int, + *, + num_warmup_steps: int, + num_training_steps: int, + lr_end: float, + power: float, + lr_init: int, +): + if current_step < num_warmup_steps: + return float(current_step) / float(max(1, num_warmup_steps)) + elif current_step > num_training_steps: + return lr_end / lr_init # as LambdaLR multiplies by lr_init + else: + lr_range = lr_init - lr_end + decay_steps = num_training_steps - num_warmup_steps + pct_remaining = 1 - (current_step - num_warmup_steps) / decay_steps + decay = lr_range * pct_remaining**power + lr_end + return decay / lr_init # as LambdaLR multiplies by lr_init + + +def get_polynomial_decay_schedule_with_warmup( + optimizer, num_warmup_steps, num_training_steps, lr_end=1e-7, power=1.0, last_epoch=-1 +): + """ + Create a schedule with a learning rate that decreases as a polynomial decay from the initial lr set in the + optimizer to end lr defined by *lr_end*, after a warmup period during which it increases linearly from 0 to the + initial lr set in the optimizer. + + Args: + optimizer ([`~torch.optim.Optimizer`]): + The optimizer for which to schedule the learning rate. + num_warmup_steps (`int`): + The number of steps for the warmup phase. + num_training_steps (`int`): + The total number of training steps. + lr_end (`float`, *optional*, defaults to 1e-7): + The end LR. + power (`float`, *optional*, defaults to 1.0): + Power factor. + last_epoch (`int`, *optional*, defaults to -1): + The index of the last epoch when resuming training. + + Note: *power* defaults to 1.0 as in the fairseq implementation, which in turn is based on the original BERT + implementation at + https://github.com/google-research/bert/blob/f39e881b169b9d53bea03d2d341b31707a6c052b/optimization.py#L37 + + Return: + `torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule. + + """ + + lr_init = optimizer.defaults["lr"] + if not (lr_init > lr_end): + raise ValueError(f"lr_end ({lr_end}) must be smaller than initial lr ({lr_init})") + + lr_lambda = partial( + _get_polynomial_decay_schedule_with_warmup_lr_lambda, + num_warmup_steps=num_warmup_steps, + num_training_steps=num_training_steps, + lr_end=lr_end, + power=power, + lr_init=lr_init, + ) + return LambdaLR(optimizer, lr_lambda, last_epoch) + + +def _get_inverse_sqrt_schedule_lr_lambda(current_step: int, *, num_warmup_steps: int, timescale: int | None = None): + if current_step < num_warmup_steps: + return float(current_step) / float(max(1, num_warmup_steps)) + shift = timescale - num_warmup_steps + decay = 1.0 / math.sqrt((current_step + shift) / timescale) + return decay + + +def get_inverse_sqrt_schedule( + optimizer: Optimizer, num_warmup_steps: int, timescale: int | None = None, last_epoch: int = -1 +): + """ + Create a schedule with an inverse square-root learning rate, from the initial lr set in the optimizer, after a + warmup period which increases lr linearly from 0 to the initial lr set in the optimizer. + + Args: + optimizer ([`~torch.optim.Optimizer`]): + The optimizer for which to schedule the learning rate. + num_warmup_steps (`int`): + The number of steps for the warmup phase. + timescale (`int`, *optional*, defaults to `num_warmup_steps`): + Time scale. + last_epoch (`int`, *optional*, defaults to -1): + The index of the last epoch when resuming training. + + Return: + `torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule. + """ + # Note: this implementation is adapted from + # https://github.com/google-research/big_vision/blob/f071ce68852d56099437004fd70057597a95f6ef/big_vision/utils.py#L930 + + if timescale is None: + timescale = num_warmup_steps or 10_000 + + lr_lambda = partial(_get_inverse_sqrt_schedule_lr_lambda, num_warmup_steps=num_warmup_steps, timescale=timescale) + return LambdaLR(optimizer, lr_lambda, last_epoch=last_epoch) + + +def _get_cosine_schedule_with_warmup_lr_lambda( + current_step: int, *, num_warmup_steps: int, num_training_steps: int, num_cycles: float, min_lr_rate: float = 0.0 +): + if current_step < num_warmup_steps: + return float(current_step) / float(max(1, num_warmup_steps)) + progress = float(current_step - num_warmup_steps) / float(max(1, num_training_steps - num_warmup_steps)) + factor = 0.5 * (1.0 + math.cos(math.pi * float(num_cycles) * 2.0 * progress)) + factor = factor * (1 - min_lr_rate) + min_lr_rate + return max(0, factor) + + +def get_cosine_with_min_lr_schedule_with_warmup( + optimizer: Optimizer, + num_warmup_steps: int, + num_training_steps: int, + num_cycles: float = 0.5, + last_epoch: int = -1, + min_lr: float | None = None, + min_lr_rate: float | None = None, +): + """ + Create a schedule with a learning rate that decreases following the values of the cosine function between the + initial lr set in the optimizer to min_lr, after a warmup period during which it increases linearly between 0 and the + initial lr set in the optimizer. + + Args: + optimizer ([`~torch.optim.Optimizer`]): + The optimizer for which to schedule the learning rate. + num_warmup_steps (`int`): + The number of steps for the warmup phase. + num_training_steps (`int`): + The total number of training steps. + num_cycles (`float`, *optional*, defaults to 0.5): + The number of waves in the cosine schedule (the defaults is to just decrease from the max value to 0 + following a half-cosine). + last_epoch (`int`, *optional*, defaults to -1): + The index of the last epoch when resuming training. + min_lr (`float`, *optional*): + The minimum learning rate to reach after the cosine schedule. + min_lr_rate (`float`, *optional*): + The minimum learning rate as a ratio of the initial learning rate. If set, `min_lr` should not be set. + + Return: + `torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule. + """ + + if min_lr is not None and min_lr_rate is not None: + raise ValueError("Only one of min_lr or min_lr_rate should be set") + elif min_lr is not None: + min_lr_rate = min_lr / optimizer.defaults["lr"] + elif min_lr_rate is None: + raise ValueError("One of min_lr or min_lr_rate should be set through the `lr_scheduler_kwargs`") + + lr_lambda = partial( + _get_cosine_schedule_with_warmup_lr_lambda, + num_warmup_steps=num_warmup_steps, + num_training_steps=num_training_steps, + num_cycles=num_cycles, + min_lr_rate=min_lr_rate, + ) + return LambdaLR(optimizer, lr_lambda, last_epoch) + + +def _get_cosine_with_min_lr_schedule_with_warmup_lr_rate_lambda( + current_step: int, + *, + num_warmup_steps: int, + num_training_steps: int, + num_cycles: float, + min_lr_rate: float = 0.0, + warmup_lr_rate: float | None = None, +): + current_step = float(current_step) + num_warmup_steps = float(num_warmup_steps) + num_training_steps = float(num_training_steps) + + if current_step < num_warmup_steps: + if warmup_lr_rate is None: + return (current_step + 1.0) / max(1.0, num_warmup_steps) + else: + warmup_lr_rate = float(warmup_lr_rate) + return warmup_lr_rate + (1.0 - warmup_lr_rate) * (current_step) / (max(1, num_warmup_steps - 1)) + progress = (current_step - num_warmup_steps + 1.0) / (max(1.0, num_training_steps - num_warmup_steps)) + factor = 0.5 * (1.0 + math.cos(math.pi * num_cycles * 2.0 * progress)) + factor = factor * (1 - min_lr_rate) + min_lr_rate + return max(0, factor) + + +def get_cosine_with_min_lr_schedule_with_warmup_lr_rate( + optimizer: Optimizer, + num_warmup_steps: int, + num_training_steps: int, + num_cycles: float = 0.5, + last_epoch: int = -1, + min_lr: float | None = None, + min_lr_rate: float | None = None, + warmup_lr_rate: float | None = None, +): + """ + Create a schedule with a learning rate that decreases following the values of the cosine function between the + initial lr set in the optimizer to min_lr, after a warmup period during which it increases linearly between 0 and the + initial lr set in the optimizer. + + Args: + optimizer ([`~torch.optim.Optimizer`]): + The optimizer for which to schedule the learning rate. + num_warmup_steps (`int`): + The number of steps for the warmup phase. + num_training_steps (`int`): + The total number of training steps. + num_cycles (`float`, *optional*, defaults to 0.5): + The number of waves in the cosine schedule (the defaults is to just decrease from the max value to 0 + following a half-cosine). + last_epoch (`int`, *optional*, defaults to -1): + The index of the last epoch when resuming training. + min_lr (`float`, *optional*): + The minimum learning rate to reach after the cosine schedule. + min_lr_rate (`float`, *optional*): + The minimum learning rate as a ratio of the initial learning rate. If set, `min_lr` should not be set. + warmup_lr_rate (`float`, *optional*): + The minimum learning rate as a ratio of the start learning rate. If not set, `warmup_lr_rate` will be treated as float(1/num_warmup_steps). + + Return: + `torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule. + """ + + if min_lr is not None and min_lr_rate is not None: + raise ValueError("Only one of min_lr or min_lr_rate should be set") + elif min_lr is not None: + min_lr_rate = min_lr / optimizer.defaults["lr"] + elif min_lr_rate is None: + raise ValueError("One of min_lr or min_lr_rate should be set through the `lr_scheduler_kwargs`") + + lr_lambda = partial( + _get_cosine_with_min_lr_schedule_with_warmup_lr_rate_lambda, + num_warmup_steps=num_warmup_steps, + num_training_steps=num_training_steps, + num_cycles=num_cycles, + min_lr_rate=min_lr_rate, + warmup_lr_rate=warmup_lr_rate, + ) + return LambdaLR(optimizer, lr_lambda, last_epoch) + + +def _get_wsd_scheduler_lambda( + current_step: int, + *, + num_warmup_steps: int, + num_stable_steps: int, + num_decay_steps: int, + warmup_type: str, + decay_type: str, + min_lr_ratio: float, + num_cycles: float, +): + if current_step < num_warmup_steps: + progress = float(current_step) / float(max(1, num_warmup_steps)) + if warmup_type == "linear": + factor = progress + elif warmup_type == "cosine": + factor = 0.5 * (1.0 - math.cos(math.pi * progress)) + elif warmup_type == "1-sqrt": + factor = 1.0 - math.sqrt(1.0 - progress) + factor = factor * (1.0 - min_lr_ratio) + min_lr_ratio + return max(0.0, factor) + + if current_step < num_warmup_steps + num_stable_steps: + return 1.0 + + if current_step < num_warmup_steps + num_stable_steps + num_decay_steps: + progress = float(current_step - num_warmup_steps - num_stable_steps) / float(max(1, num_decay_steps)) + if decay_type == "linear": + factor = 1.0 - progress + elif decay_type == "cosine": + factor = 0.5 * (1.0 + math.cos(math.pi * float(num_cycles) * 2.0 * progress)) + elif decay_type == "1-sqrt": + factor = 1.0 - math.sqrt(progress) + factor = factor * (1.0 - min_lr_ratio) + min_lr_ratio + return max(0.0, factor) + return min_lr_ratio + + +def get_wsd_schedule( + optimizer: Optimizer, + num_warmup_steps: int, + num_decay_steps: int, + num_training_steps: int | None = None, + num_stable_steps: int | None = None, + warmup_type: str = "linear", + decay_type: str = "cosine", + min_lr_ratio: float = 0, + num_cycles: float = 0.5, + last_epoch: int = -1, +): + """ + Create a schedule with a learning rate that has three stages: + 1. warmup: increase from min_lr_ratio times the initial learning rate to the initial learning rate following a warmup_type. + 2. stable: constant learning rate. + 3. decay: decrease from the initial learning rate to min_lr_ratio times the initial learning rate following a decay_type. + + Args: + optimizer ([`~torch.optim.Optimizer`]): + The optimizer for which to schedule the learning rate. + num_warmup_steps (`int`): + The number of steps for the warmup phase. + num_decay_steps (`int`): + The number of steps for the decay phase. + num_training_steps (`int`, *optional*): + The total number of training steps. This is the sum of the warmup, stable and decay steps. If `num_stable_steps` is not provided, the stable phase will be `num_training_steps - num_warmup_steps - num_decay_steps`. + num_stable_steps (`int`, *optional*): + The number of steps for the stable phase. Please ensure that `num_warmup_steps + num_stable_steps + num_decay_steps` equals `num_training_steps`, otherwise the other steps will default to the minimum learning rate. + warmup_type (`str`, *optional*, defaults to "linear"): + The type of warmup to use. Can be 'linear', 'cosine' or '1-sqrt'. + decay_type (`str`, *optional*, defaults to "cosine"): + The type of decay to use. Can be 'linear', 'cosine' or '1-sqrt'. + min_lr_ratio (`float`, *optional*, defaults to 0): + The minimum learning rate as a ratio of the initial learning rate. + num_cycles (`float`, *optional*, defaults to 0.5): + The number of waves in the cosine schedule (the defaults is to just decrease from the max value to 0 + following a half-cosine). + last_epoch (`int`, *optional*, defaults to -1): + The index of the last epoch when resuming training. + + Return: + `torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule. + """ + + if num_training_steps is None and num_stable_steps is None: + raise ValueError("Either num_training_steps or num_stable_steps must be specified.") + + if num_training_steps is not None and num_stable_steps is not None: + warnings.warn("Both num_training_steps and num_stable_steps are specified. num_stable_steps will be used.") + + if warmup_type not in ["linear", "cosine", "1-sqrt"]: + raise ValueError(f"Unknown warmup type: {warmup_type}, expected 'linear', 'cosine' or '1-sqrt'") + + if decay_type not in ["linear", "cosine", "1-sqrt"]: + raise ValueError(f"Unknown decay type: {decay_type}, expected 'linear', 'cosine' or '1-sqrt'") + + if num_stable_steps is None: + num_stable_steps = num_training_steps - num_warmup_steps - num_decay_steps + + lr_lambda = partial( + _get_wsd_scheduler_lambda, + num_warmup_steps=num_warmup_steps, + num_stable_steps=num_stable_steps, + num_decay_steps=num_decay_steps, + warmup_type=warmup_type, + decay_type=decay_type, + min_lr_ratio=min_lr_ratio, + num_cycles=num_cycles, + ) + return LambdaLR(optimizer, lr_lambda, last_epoch) + + +TYPE_TO_SCHEDULER_FUNCTION = { + SchedulerType.LINEAR: get_linear_schedule_with_warmup, + SchedulerType.COSINE: get_cosine_schedule_with_warmup, + SchedulerType.COSINE_WITH_RESTARTS: get_cosine_with_hard_restarts_schedule_with_warmup, + SchedulerType.POLYNOMIAL: get_polynomial_decay_schedule_with_warmup, + SchedulerType.CONSTANT: get_constant_schedule, + SchedulerType.CONSTANT_WITH_WARMUP: get_constant_schedule_with_warmup, + SchedulerType.INVERSE_SQRT: get_inverse_sqrt_schedule, + SchedulerType.REDUCE_ON_PLATEAU: get_reduce_on_plateau_schedule, + SchedulerType.COSINE_WITH_MIN_LR: get_cosine_with_min_lr_schedule_with_warmup, + SchedulerType.COSINE_WARMUP_WITH_MIN_LR: get_cosine_with_min_lr_schedule_with_warmup_lr_rate, + SchedulerType.WARMUP_STABLE_DECAY: get_wsd_schedule, +} + + +def get_scheduler( + name: str | SchedulerType, + optimizer: Optimizer, + num_warmup_steps: int | None = None, + num_training_steps: int | None = None, + scheduler_specific_kwargs: dict | None = None, +): + """ + Unified API to get any scheduler from its name. + + Args: + name (`str` or `SchedulerType`): + The name of the scheduler to use. + optimizer (`torch.optim.Optimizer`): + The optimizer that will be used during training. + num_warmup_steps (`int`, *optional*): + The number of warmup steps to do. This is not required by all schedulers (hence the argument being + optional), the function will raise an error if it's unset and the scheduler type requires it. + num_training_steps (`int``, *optional*): + The number of training steps to do. This is not required by all schedulers (hence the argument being + optional), the function will raise an error if it's unset and the scheduler type requires it. + scheduler_specific_kwargs (`dict`, *optional*): + Extra parameters for schedulers such as cosine with restarts. Mismatched scheduler types and scheduler + parameters will cause the scheduler function to raise a TypeError. + """ + name = SchedulerType(name) + schedule_func = TYPE_TO_SCHEDULER_FUNCTION[name] + + # If a `LayerWiseDummyOptimizer` is passed we extract the optimizer dict and + # recursively call `get_scheduler` to get the proper schedulers on each parameter + if optimizer is not None and isinstance(optimizer, LayerWiseDummyOptimizer): + optimizer_dict = optimizer.optimizer_dict + scheduler_dict = {} + + for param in optimizer_dict: + scheduler_dict[param] = get_scheduler( + name, + optimizer=optimizer_dict[param], + num_warmup_steps=num_warmup_steps, + num_training_steps=num_training_steps, + scheduler_specific_kwargs=scheduler_specific_kwargs, + ) + + def scheduler_hook(param): + # Since the optimizer hook has been already attached we only need to + # attach the scheduler hook, the gradients have been zeroed here + scheduler_dict[param].step() + + for param in optimizer_dict: + if param.requires_grad: + param.register_post_accumulate_grad_hook(scheduler_hook) + + return LayerWiseDummyScheduler(optimizer_dict=optimizer_dict, lr=optimizer.defaults["lr"]) + + if name == SchedulerType.CONSTANT: + return schedule_func(optimizer) + + if scheduler_specific_kwargs is None: + scheduler_specific_kwargs = {} + + if name == SchedulerType.REDUCE_ON_PLATEAU: + return schedule_func(optimizer, **scheduler_specific_kwargs) + + # All other schedulers require `num_warmup_steps` + if num_warmup_steps is None: + raise ValueError(f"{name} requires `num_warmup_steps`, please provide that argument.") + + if name == SchedulerType.CONSTANT_WITH_WARMUP: + return schedule_func(optimizer, num_warmup_steps=num_warmup_steps) + + if name == SchedulerType.INVERSE_SQRT: + return schedule_func(optimizer, num_warmup_steps=num_warmup_steps) + + # wsd scheduler requires either num_training_steps or num_stable_steps + if name == SchedulerType.WARMUP_STABLE_DECAY: + return schedule_func( + optimizer, + num_warmup_steps=num_warmup_steps, + num_training_steps=num_training_steps, + **scheduler_specific_kwargs, + ) + + # All other schedulers require `num_training_steps` + if num_training_steps is None: + raise ValueError(f"{name} requires `num_training_steps`, please provide that argument.") + + return schedule_func( + optimizer, + num_warmup_steps=num_warmup_steps, + num_training_steps=num_training_steps, + **scheduler_specific_kwargs, + ) + + +class Adafactor(Optimizer): + """ + AdaFactor pytorch implementation can be used as a drop in replacement for Adam original fairseq code: + https://github.com/pytorch/fairseq/blob/master/fairseq/optim/adafactor.py + + Paper: *Adafactor: Adaptive Learning Rates with Sublinear Memory Cost* https://huggingface.co/papers/1804.04235 Note that + this optimizer internally adjusts the learning rate depending on the `scale_parameter`, `relative_step` and + `warmup_init` options. To use a manual (external) learning rate schedule you should set `scale_parameter=False` and + `relative_step=False`. + + Arguments: + params (`Iterable[nn.parameter.Parameter]`): + Iterable of parameters to optimize or dictionaries defining parameter groups. + lr (`float`, *optional*): + The external learning rate. + eps (`tuple[float, float]`, *optional*, defaults to `(1e-30, 0.001)`): + Regularization constants for square gradient and parameter scale respectively + clip_threshold (`float`, *optional*, defaults to 1.0): + Threshold of root mean square of final gradient update + decay_rate (`float`, *optional*, defaults to -0.8): + Coefficient used to compute running averages of square + beta1 (`float`, *optional*): + Coefficient used for computing running averages of gradient + weight_decay (`float`, *optional*, defaults to 0.0): + Weight decay (L2 penalty) + scale_parameter (`bool`, *optional*, defaults to `True`): + If True, learning rate is scaled by root mean square + relative_step (`bool`, *optional*, defaults to `True`): + If True, time-dependent learning rate is computed instead of external learning rate + warmup_init (`bool`, *optional*, defaults to `False`): + Time-dependent learning rate computation depends on whether warm-up initialization is being used + + This implementation handles low-precision (FP16, bfloat) values, but we have not thoroughly tested. + + Recommended T5 finetuning settings (https://discuss.huggingface.co/t/t5-finetuning-tips/684/3): + + - Training without LR warmup or clip_threshold is not recommended. + + - use scheduled LR warm-up to fixed LR + - use clip_threshold=1.0 (https://huggingface.co/papers/1804.04235) + - Disable relative updates + - Use scale_parameter=False + - Additional optimizer operations like gradient clipping should not be used alongside Adafactor + + Example: + + ```python + Adafactor(model.parameters(), scale_parameter=False, relative_step=False, warmup_init=False, lr=1e-3) + ``` + + Others reported the following combination to work well: + + ```python + Adafactor(model.parameters(), scale_parameter=True, relative_step=True, warmup_init=True, lr=None) + ``` + + When using `lr=None` with [`Trainer`] you will most likely need to use [`~optimization.AdafactorSchedule`] + scheduler as following: + + ```python + from transformers.optimization import Adafactor, AdafactorSchedule + + optimizer = Adafactor(model.parameters(), scale_parameter=True, relative_step=True, warmup_init=True, lr=None) + lr_scheduler = AdafactorSchedule(optimizer) + trainer = Trainer(..., optimizers=(optimizer, lr_scheduler)) + ``` + + Usage: + + ```python + # replace AdamW with Adafactor + optimizer = Adafactor( + model.parameters(), + lr=1e-3, + eps=(1e-30, 1e-3), + clip_threshold=1.0, + decay_rate=-0.8, + beta1=None, + weight_decay=0.0, + relative_step=False, + scale_parameter=False, + warmup_init=False, + ) + ```""" + + def __init__( + self, + params, + lr=None, + eps=(1e-30, 1e-3), + clip_threshold=1.0, + decay_rate=-0.8, + beta1=None, + weight_decay=0.0, + scale_parameter=True, + relative_step=True, + warmup_init=False, + ): + if lr is not None and relative_step: + raise ValueError("Cannot combine manual `lr` and `relative_step=True` options") + if warmup_init and not relative_step: + raise ValueError("`warmup_init=True` requires `relative_step=True`") + + defaults = { + "lr": lr, + "eps": eps, + "clip_threshold": clip_threshold, + "decay_rate": decay_rate, + "beta1": beta1, + "weight_decay": weight_decay, + "scale_parameter": scale_parameter, + "relative_step": relative_step, + "warmup_init": warmup_init, + } + super().__init__(params, defaults) + + @staticmethod + def _get_lr(param_group, param_state): + rel_step_sz = param_group["lr"] + if param_group["relative_step"]: + min_step = 1e-6 * param_state["step"] if param_group["warmup_init"] else 1e-2 + rel_step_sz = min(min_step, 1.0 / math.sqrt(param_state["step"])) + param_scale = 1.0 + if param_group["scale_parameter"]: + param_scale = max(param_group["eps"][1], param_state["RMS"]) + return param_scale * rel_step_sz + + @staticmethod + def _get_options(param_group, param_shape): + factored = len(param_shape) >= 2 + use_first_moment = param_group["beta1"] is not None + return factored, use_first_moment + + @staticmethod + def _rms(tensor): + return tensor.norm(2) / (tensor.numel() ** 0.5) + + @staticmethod + def _approx_sq_grad(exp_avg_sq_row, exp_avg_sq_col): + # copy from fairseq's adafactor implementation: + # https://github.com/huggingface/transformers/blob/8395f14de6068012787d83989c3627c3df6a252b/src/transformers/optimization.py#L505 + r_factor = (exp_avg_sq_row / exp_avg_sq_row.mean(dim=-1, keepdim=True)).rsqrt_().unsqueeze(-1) + c_factor = exp_avg_sq_col.unsqueeze(-2).rsqrt() + return torch.mul(r_factor, c_factor) + + @torch.no_grad() + def step(self, closure=None): + """ + Performs a single optimization step + + Arguments: + closure (callable, optional): A closure that reevaluates the model + and returns the loss. + """ + loss = None + if closure is not None: + loss = closure() + + for group in self.param_groups: + for p in group["params"]: + if p.grad is None: + continue + grad = p.grad + if grad.dtype in {torch.float16, torch.bfloat16}: + grad = grad.float() + if grad.is_sparse: + raise RuntimeError("Adafactor does not support sparse gradients.") + + state = self.state[p] + grad_shape = grad.shape + + factored, use_first_moment = self._get_options(group, grad_shape) + # State Initialization + if len(state) == 0: + state["step"] = 0 + + if use_first_moment: + # Exponential moving average of gradient values + state["exp_avg"] = torch.zeros_like(grad) + if factored: + state["exp_avg_sq_row"] = torch.zeros(grad_shape[:-1]).to(grad) + state["exp_avg_sq_col"] = torch.zeros(grad_shape[:-2] + grad_shape[-1:]).to(grad) + else: + state["exp_avg_sq"] = torch.zeros_like(grad) + + state["RMS"] = 0 + else: + if use_first_moment: + state["exp_avg"] = state["exp_avg"].to(grad) + if factored: + state["exp_avg_sq_row"] = state["exp_avg_sq_row"].to(grad) + state["exp_avg_sq_col"] = state["exp_avg_sq_col"].to(grad) + else: + state["exp_avg_sq"] = state["exp_avg_sq"].to(grad) + + p_data_fp32 = p + if p.dtype in {torch.float16, torch.bfloat16}: + p_data_fp32 = p_data_fp32.float() + + state["step"] += 1 + state["RMS"] = self._rms(p_data_fp32) + lr = self._get_lr(group, state) + + beta2t = 1.0 - math.pow(state["step"], group["decay_rate"]) + update = (grad**2) + group["eps"][0] + if factored: + exp_avg_sq_row = state["exp_avg_sq_row"] + exp_avg_sq_col = state["exp_avg_sq_col"] + + exp_avg_sq_row.mul_(beta2t).add_(update.mean(dim=-1), alpha=(1.0 - beta2t)) + exp_avg_sq_col.mul_(beta2t).add_(update.mean(dim=-2), alpha=(1.0 - beta2t)) + + # Approximation of exponential moving average of square of gradient + update = self._approx_sq_grad(exp_avg_sq_row, exp_avg_sq_col) + update.mul_(grad) + else: + exp_avg_sq = state["exp_avg_sq"] + + exp_avg_sq.mul_(beta2t).add_(update, alpha=(1.0 - beta2t)) + update = exp_avg_sq.rsqrt().mul_(grad) + + update.div_((self._rms(update) / group["clip_threshold"]).clamp_(min=1.0)) + update.mul_(lr) + + if use_first_moment: + exp_avg = state["exp_avg"] + exp_avg.mul_(group["beta1"]).add_(update, alpha=(1 - group["beta1"])) + update = exp_avg + + if group["weight_decay"] != 0: + p_data_fp32.add_(p_data_fp32, alpha=(-group["weight_decay"] * lr)) + + p_data_fp32.add_(-update) + + if p.dtype in {torch.float16, torch.bfloat16}: + p.copy_(p_data_fp32) + + return loss + + +class AdafactorSchedule(LambdaLR): + """ + Since [`~optimization.Adafactor`] performs its own scheduling, if the training loop relies on a scheduler (e.g., + for logging), this class creates a proxy object that retrieves the current lr values from the optimizer. + + It returns `initial_lr` during startup and the actual `lr` during stepping. + """ + + def __init__(self, optimizer, initial_lr=0.0): + def lr_lambda(_): + return initial_lr + + for group in optimizer.param_groups: + group["initial_lr"] = initial_lr + super().__init__(optimizer, lr_lambda) + for group in optimizer.param_groups: + del group["initial_lr"] + + def get_lr(self): + opt = self.optimizer + lrs = [ + opt._get_lr(group, opt.state[group["params"][0]]) + for group in opt.param_groups + if group["params"][0].grad is not None + ] + if len(lrs) == 0: + lrs = self.base_lrs # if called before stepping + return lrs + + +def get_adafactor_schedule(optimizer, initial_lr=0.0): + """ + Get a proxy schedule for [`~optimization.Adafactor`] + + Args: + optimizer ([`~torch.optim.Optimizer`]): + The optimizer for which to schedule the learning rate. + initial_lr (`float`, *optional*, defaults to 0.0): + Initial lr + + Return: + [`~optimization.Adafactor`] proxy schedule object. + + + """ + return AdafactorSchedule(optimizer, initial_lr) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/processing_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/processing_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..25fe40f2732610e759395898c1ed222b589271d6 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/processing_utils.py @@ -0,0 +1,1936 @@ +# Copyright 2022 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Processing saving/loading class for common processors. +""" + +import bisect +import copy +import inspect +import json +import os +import sys +import typing +from dataclasses import dataclass +from pathlib import Path +from typing import Annotated, Any, Literal, TypedDict, TypeVar, Union + +import numpy as np +import typing_extensions +from huggingface_hub import create_repo, is_offline_mode +from huggingface_hub.dataclasses import validate_typed_dict +from huggingface_hub.errors import EntryNotFoundError + +from .audio_utils import AudioInput, load_audio +from .dynamic_module_utils import custom_object_save +from .feature_extraction_utils import BatchFeature +from .image_utils import ChannelDimension, ImageInput, is_vision_available +from .tokenization_utils_base import ( + PaddingStrategy, + PreTokenizedInput, + PreTrainedTokenizerBase, + TextInput, + TruncationStrategy, +) +from .utils import ( + AUDIO_TOKENIZER_NAME, + CHAT_TEMPLATE_DIR, + CHAT_TEMPLATE_FILE, + LEGACY_PROCESSOR_CHAT_TEMPLATE_FILE, + PROCESSOR_NAME, + PushToHubMixin, + TensorType, + cached_file, + copy_func, + direct_transformers_import, + is_torch_available, + list_repo_templates, + logging, +) +from .utils.chat_template_utils import render_jinja_template +from .utils.type_validators import ( + device_validator, + image_size_validator, + padding_validator, + positive_any_number, + positive_int, + resampling_validator, + tensor_type_validator, + truncation_validator, + video_metadata_validator, +) +from .video_utils import VideoInput, VideoMetadataType + + +if is_torch_available(): + import torch + + from .modeling_utils import PreTrainedAudioTokenizerBase + +if is_vision_available(): + from .image_utils import PILImageResampling + +logger = logging.get_logger(__name__) + +# type hinting: specifying the type of processor class that inherits from ProcessorMixin +SpecificProcessorType = TypeVar("SpecificProcessorType", bound="ProcessorMixin") + +# Dynamically import the Transformers module to grab the attribute classes of the processor from their names. +transformers_module = direct_transformers_import(Path(__file__).parent) + + +class _LazyAutoProcessorMapping(dict): + """ + Lazy dictionary to avoid circular imports. + The mapping names are only imported when accessed. + """ + + _MAPPING_NAMES = { + "image_processor": ("transformers.models.auto.image_processing_auto", "AutoImageProcessor"), + "video_processor": ("transformers.models.auto.video_processing_auto", "AutoVideoProcessor"), + "feature_extractor": ("transformers.models.auto.feature_extraction_auto", "AutoFeatureExtractor"), + "audio_processor": ("transformers.models.auto.feature_extraction_auto", "AutoFeatureExtractor"), + "tokenizer": ("transformers.models.auto.tokenization_auto", "AutoTokenizer"), + } + + def __getitem__(self, key): + if key not in self._MAPPING_NAMES: + raise KeyError(key) + module_name, attr_name = self._MAPPING_NAMES[key] + module = __import__(module_name, fromlist=[attr_name]) + return getattr(module, attr_name) + + def __contains__(self, key): + return key in self._MAPPING_NAMES + + def keys(self): + return self._MAPPING_NAMES.keys() + + +MODALITY_TO_AUTOPROCESSOR_MAPPING = _LazyAutoProcessorMapping() + +MODALITY_TO_BASE_CLASS_MAPPING = { + "audio_tokenizer": "DacModel", + "audio_processor": "FeatureExtractionMixin", + "tokenizer": ("PreTrainedTokenizerBase", "MistralCommonBackend"), + "feature_extractor": "FeatureExtractionMixin", + "image_processor": "ImageProcessingMixin", + "video_processor": "BaseVideoProcessor", +} + + +def _get_modality_for_attribute(attribute_name: str) -> str: + """ + Get the canonical modality type for a given attribute name. + + For example: + - "image_processor" -> "image_processor" + - "encoder_image_processor" -> "image_processor" + - "text_tokenizer" -> "tokenizer" + - "my_feature_extractor" -> "feature_extractor" + """ + for modality in MODALITY_TO_AUTOPROCESSOR_MAPPING.keys(): + if modality in attribute_name: + return modality + raise ValueError( + f"Cannot determine modality for attribute '{attribute_name}'. " + f"Attribute name must contain one of: {list(MODALITY_TO_AUTOPROCESSOR_MAPPING.keys())}" + ) + + +if sys.version_info >= (3, 11): + Unpack = typing.Unpack +else: + Unpack = typing_extensions.Unpack + + +class TextKwargs(TypedDict, total=False): + """ + Keyword arguments for text processing. For extended documentation, check out tokenization_utils_base methods and + docstrings associated. + + Attributes: + add_special_tokens (`bool`, *optional*) + Whether or not to add special tokens when encoding the sequences. + padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*) + Activates and controls padding. + truncation (`bool`, `str` or [`~tokenization_utils_base.TruncationStrategy`], *optional*): + Activates and controls truncation. + max_length (`int`, *optional*): + Controls the maximum length to use by one of the truncation/padding parameters. + stride (`int`, *optional*): + If set, the overflowing tokens will contain some tokens from the end of the truncated sequence. + is_split_into_words (`bool`, *optional*): + Whether or not the input is already pre-tokenized. + pad_to_multiple_of (`int`, *optional*): + If set, will pad the sequence to a multiple of the provided value. + return_token_type_ids (`bool`, *optional*): + Whether to return token type IDs. + return_attention_mask (`bool`, *optional*): + Whether to return the attention mask. + return_overflowing_tokens (`bool`, *optional*): + Whether or not to return overflowing token sequences. + return_special_tokens_mask (`bool`, *optional*): + Whether or not to return special tokens mask information. + return_offsets_mapping (`bool`, *optional*): + Whether or not to return `(char_start, char_end)` for each token. + return_length (`bool`, *optional*): + Whether or not to return the lengths of the encoded inputs. + verbose (`bool`, *optional*): + Whether or not to print more information and warnings. + padding_side (`str`, *optional*): + The side on which padding will be applied. + return_mm_token_type_ids (`bool`, *optional*): + Whether to return multimodal token type ids indicating mm placeholder token positions. + return_tensors (`str` or [`~utils.TensorType`], *optional*): + If set, will return tensors of a particular framework. Acceptable values are: + - `'pt'`: Return PyTorch `torch.Tensor` objects. + - `'np'`: Return NumPy `np.ndarray` objects. + """ + + text_pair: TextInput | PreTokenizedInput | list[TextInput] | list[PreTokenizedInput] | None + text_target: TextInput | PreTokenizedInput | list[TextInput] | list[PreTokenizedInput] | None + text_pair_target: TextInput | PreTokenizedInput | list[TextInput] | list[PreTokenizedInput] | None + add_special_tokens: bool | None + padding: Annotated[bool | str | PaddingStrategy | None, padding_validator()] + truncation: Annotated[bool | str | TruncationStrategy | None, truncation_validator()] + max_length: Annotated[int | None, positive_int()] + stride: Annotated[int | None, positive_int()] + is_split_into_words: bool | None + pad_to_multiple_of: Annotated[int | None, positive_int()] + return_token_type_ids: bool | None + return_attention_mask: bool | None + return_overflowing_tokens: bool | None + return_special_tokens_mask: bool | None + return_offsets_mapping: bool | None + return_length: bool | None + verbose: bool | None + padding_side: Literal["left", "right"] | None + return_mm_token_type_ids: bool | None + return_tensors: Annotated[str | TensorType | None, tensor_type_validator()] + + +class ImagesKwargs(TypedDict, total=False): + """ + Keyword arguments for image processing. For extended documentation, check the appropriate ImageProcessor + class methods and docstrings. + + Attributes: + do_convert_rgb (`bool`): + Whether to convert the image to RGB format. + do_resize (`bool`, *optional*): + Whether to resize the image. + size (`dict[str, int]`, *optional*): + Resize the shorter side of the input to `size["shortest_edge"]`. + crop_size (`dict[str, int]`, *optional*): + Desired output size when applying center-cropping. + resample (`PILImageResampling`, *optional*): + Resampling filter to use if resizing the image. + do_rescale (`bool`, *optional*): + Whether to rescale the image by the specified scale `rescale_factor`. + rescale_factor (`int` or `float`, *optional*): + Scale factor to use if rescaling the image. + do_normalize (`bool`, *optional*): + Whether to normalize the image. + image_mean (`float` or `list[float] or tuple[float, float, float]`, *optional*): + Mean to use if normalizing the image. + image_std (`float` or `list[float] or tuple[float, float, float]`, *optional*): + Standard deviation to use if normalizing the image. + do_pad (`bool`, *optional*): + Whether to pad the images in the batch. + pad_size (`dict[str, int]`, *optional*): + The size `{"height": int, "width" int}` to pad the images to. + do_center_crop (`bool`, *optional*): + Whether to center crop the image. + data_format (`ChannelDimension` or `str`, *optional*): + The channel dimension format for the output image. + input_data_format (`ChannelDimension` or `str`, *optional*): + The channel dimension format for the input image. + device (`Union[str, torch.Tensor]`, *optional*): + The device to use for processing (e.g. "cpu", "cuda"), only relevant for fast image processing. + return_tensors (`str` or [`~utils.TensorType`], *optional*): + If set, will return tensors of a particular framework. Acceptable values are: + - `'pt'`: Return PyTorch `torch.Tensor` objects. + - `'np'`: Return NumPy `np.ndarray` objects. + disable_grouping (`bool`, *optional*): + Whether to group images by shapes when processing or not, only relevant for fast image processing. + image_seq_length (`int`, *optional*): + The number of image tokens to be used for each image in the input. + Added for backward compatibility but this should be set as a processor attribute in future models. + """ + + do_convert_rgb: bool | None + do_resize: bool | None + size: Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, image_size_validator()] + crop_size: Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, image_size_validator()] + resample: Annotated[Union["PILImageResampling", int] | None, resampling_validator()] + do_rescale: bool | None + rescale_factor: float | None + do_normalize: bool | None + image_mean: float | list[float] | tuple[float, ...] | None + image_std: float | list[float] | tuple[float, ...] | None + do_pad: bool | None + pad_size: Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, image_size_validator()] + do_center_crop: bool | None + data_format: str | ChannelDimension | None + input_data_format: str | ChannelDimension | None + device: Annotated[Union[str, "torch.device"] | None, device_validator()] + return_tensors: Annotated[str | TensorType | None, tensor_type_validator()] + disable_grouping: bool | None + image_seq_length: int | None + + +class VideosKwargs(TypedDict, total=False): + """ + Keyword arguments for video processing. + + Attributes: + do_convert_rgb (`bool`): + Whether to convert the video to RGB format. + do_resize (`bool`): + Whether to resize the video. + size (`dict[str, int]`, *optional*): + Resize the shorter side of the input to `size["shortest_edge"]`. + default_to_square (`bool`, *optional*, defaults to `self.default_to_square`): + Whether to default to a square when resizing, if size is an int. + resample (`PILImageResampling`, *optional*): + Resampling filter to use if resizing the video. + do_rescale (`bool`, *optional*): + Whether to rescale the video by the specified scale `rescale_factor`. + rescale_factor (`int` or `float`, *optional*): + Scale factor to use if rescaling the video. + do_normalize (`bool`, *optional*): + Whether to normalize the video. + image_mean (`float` or `list[float] or tuple[float, float, float]`, *optional*): + Mean to use if normalizing the video. + image_std (`float` or `list[float] or tuple[float, float, float]`, *optional*): + Standard deviation to use if normalizing the video. + do_center_crop (`bool`, *optional*): + Whether to center crop the video. + do_pad (`bool`, *optional*): + Whether to pad the images in the batch. + do_sample_frames (`bool`, *optional*): + Whether to sample frames from the video before processing or to process the whole video. + video_metadata (`Union[VideoMetadata, dict]`, *optional*): + Metadata of the video containing information about total duration, fps and total number of frames. + num_frames (`int`, *optional*): + Maximum number of frames to sample when `do_sample_frames=True`. + fps (`int` or `float`, *optional*): + Target frames to sample per second when `do_sample_frames=True`. + crop_size (`dict[str, int]`, *optional*): + Desired output size when applying center-cropping. + data_format (`ChannelDimension` or `str`, *optional*): + The channel dimension format for the output video. + input_data_format (`ChannelDimension` or `str`, *optional*): + The channel dimension format for the input video. + device (`Union[str, torch.Tensor]`, *optional*): + The device to use for processing (e.g. "cpu", "cuda"), only relevant for fast image processing. + return_metadata (`bool`, *optional*): + Whether to return video metadata or not. + return_tensors (`str` or [`~utils.TensorType`], *optional*): + If set, will return tensors of a particular framework. Acceptable values are: + - `'pt'`: Return PyTorch `torch.Tensor` objects. + - `'np'`: Return NumPy `np.ndarray` objects. + """ + + do_convert_rgb: bool | None + do_resize: bool | None + size: Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, image_size_validator()] + default_to_square: bool | None + resample: Annotated[Union["PILImageResampling", int] | None, resampling_validator()] + do_rescale: bool | None + rescale_factor: float | None + do_normalize: bool | None + image_mean: float | list[float] | tuple[float, ...] | None + image_std: float | list[float] | tuple[float, ...] | None + do_center_crop: bool | None + do_pad: bool | None + crop_size: Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, image_size_validator()] + data_format: str | ChannelDimension | None + input_data_format: str | ChannelDimension | None + device: Annotated[Union[str, "torch.device"] | None, device_validator()] + do_sample_frames: bool | None + video_metadata: Annotated[VideoMetadataType | None, video_metadata_validator()] + fps: Annotated[int | float | None, positive_any_number()] + num_frames: Annotated[int | None, positive_int()] + return_metadata: bool | None + return_tensors: Annotated[str | TensorType | None, tensor_type_validator()] + + +class AudioKwargs(TypedDict, total=False): + """ + Keyword arguments for audio processing. + + Attributes: + sampling_rate (`int`, *optional*): + The sampling rate at which the `raw_speech` input was sampled. + raw_speech (`np.ndarray`, `list[float]`, `list[np.ndarray]`, `list[list[float]]`): + The sequence or batch of sequences to be padded. Each sequence can be a numpy array, a list of float + values, a list of numpy arrays or a list of list of float values. Must be mono channel audio, not + stereo, i.e. single float per timestep. + padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*): + Select a strategy to pad the returned sequences (according to the model's padding side and padding + index) among: + + - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single + sequence if provided). + - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum + acceptable input length for the model if that argument is not provided. + - `False` or `'do_not_pad'` + max_length (`int`, *optional*): + Maximum length of the returned list and optionally padding length (see above). + truncation (`bool`, *optional*): + Activates truncation to cut input sequences longer than *max_length* to *max_length*. + pad_to_multiple_of (`int`, *optional*): + If set, will pad the sequence to a multiple of the provided value. + return_attention_mask (`bool`, *optional*): + Whether or not [`~ASTFeatureExtractor.__call__`] should return `attention_mask`. + return_tensors (`str` or [`~utils.TensorType`], *optional*): + If set, will return tensors of a particular framework. Acceptable values are: + - `'pt'`: Return PyTorch `torch.Tensor` objects. + - `'np'`: Return NumPy `np.ndarray` objects. + """ + + sampling_rate: Annotated[int | None, positive_int()] + raw_speech: Union["np.ndarray", list[float], list["np.ndarray"], list[list[float]]] | None + padding: Annotated[bool | str | PaddingStrategy | None, padding_validator()] + max_length: Annotated[int | None, positive_int()] + truncation: Annotated[bool | str | TruncationStrategy | None, truncation_validator()] + pad_to_multiple_of: Annotated[int | None, positive_int()] + return_attention_mask: bool | None + return_tensors: Annotated[str | TensorType | None, tensor_type_validator()] + + +class ProcessingKwargs(TypedDict, total=False): + """ + Base class for kwargs passing to processors. + In case a model has specific kwargs that are not present in the base class or default values for existing keys, + it should have its own `ModelProcessorKwargs` class that inherits from `ProcessingKwargs` to provide: + 1) Additional typed keys and that this model requires to process inputs. + 2) Default values for existing keys under a `_defaults` attribute. + New keys have to be defined as follows to ensure type hinting is done correctly. + + ```python + # adding a new image kwarg for this model + class ModelImagesKwargs(ImagesKwargs, total=False): + new_image_kwarg: Optional[bool] + + class ModelProcessorKwargs(ProcessingKwargs, total=False): + images_kwargs: ModelImagesKwargs + _defaults = { + "images_kwargs: { + "new_image_kwarg": False, + } + "text_kwargs": { + "padding": "max_length", + }, + } + + ``` + + For Python 3.8 compatibility, when inheriting from this class and overriding one of the kwargs, + you need to manually update the __annotations__ dictionary. This can be done as follows: + + ```python + class CustomProcessorKwargs(ProcessingKwargs, total=False): + images_kwargs: CustomImagesKwargs + + CustomProcessorKwargs.__annotations__["images_kwargs"] = CustomImagesKwargs # python 3.8 compatibility + ```python + + """ + + _defaults = {} + + text_kwargs: TextKwargs = { + **TextKwargs.__annotations__, + } + images_kwargs: ImagesKwargs = { + **ImagesKwargs.__annotations__, + } + videos_kwargs: VideosKwargs = { + **VideosKwargs.__annotations__, + } + audio_kwargs: AudioKwargs = { + **AudioKwargs.__annotations__, + } + + +class TokenizerChatTemplateKwargs(TypedDict, total=False): + """ + Keyword arguments for tokenizer's `apply_chat_template`, when it is called from within a processor. + + tools (`list[Dict]`, *optional*): + A list of tools (callable functions) that will be accessible to the model. If the template does not + support function calling, this argument will have no effect. Each tool should be passed as a JSON Schema, + giving the name, description and argument types for the tool. See our + [chat templating guide](https://huggingface.co/docs/transformers/main/en/chat_templating#automated-function-conversion-for-tool-use) + for more information. + documents (`list[dict[str, str]]`, *optional*): + A list of dicts representing documents that will be accessible to the model if it is performing RAG + (retrieval-augmented generation). If the template does not support RAG, this argument will have no + effect. We recommend that each document should be a dict containing "title" and "text" keys. Please + see the RAG section of the [chat templating guide](https://huggingface.co/docs/transformers/main/en/chat_templating#arguments-for-RAG) + for examples of passing documents with chat templates. + add_generation_prompt (bool, *optional*): + If this is set, a prompt with the token(s) that indicate + the start of an assistant message will be appended to the formatted output. This is useful when you want to generate a response from the model. + Note that this argument will be passed to the chat template, and so it must be supported in the + template for this argument to have any effect. + continue_final_message (bool, *optional*): + If this is set, the chat will be formatted so that the final + message in the chat is open-ended, without any EOS tokens. The model will continue this message + rather than starting a new one. This allows you to "prefill" part of + the model's response for it. Cannot be used at the same time as `add_generation_prompt`. + return_assistant_tokens_mask (`bool`, defaults to `False`): + Whether to return a mask of the assistant generated tokens. For tokens generated by the assistant, + the mask will contain 1. For user and system tokens, the mask will contain 0. + This functionality is only available for chat templates that support it via the `{% generation %}` keyword. + """ + + tools: list[dict] | None = None + documents: list[dict[str, str]] | None = None + add_generation_prompt: bool | None = False + continue_final_message: bool | None = False + return_assistant_tokens_mask: bool | None = False + + +class ProcessorChatTemplateKwargs(TokenizerChatTemplateKwargs, total=False): + """ + Keyword arguments for processor's `apply_chat_template`. + + tokenize (`bool`, *optional*, defaults to `False`): + Whether to tokenize the output or not. + return_dict (`bool`, defaults to `False`): + Whether to return a dictionary with named outputs. Has no effect if tokenize is `False`. + load_audio_from_video (`bool`, *optional*, defaults to `False`): + Whether to use the audio track of input video. If `True` the audio track will be loaded and passed to the + processor. This flag has no effect if the model doesn't support audio modality. + """ + + tokenize: bool | None = False + return_dict: bool | None = False + load_audio_from_video: bool | None = False + + +class AllKwargsForChatTemplate(TypedDict, total=False): + processor_kwargs: ProcessingKwargs + template_kwargs: ProcessorChatTemplateKwargs + + +@dataclass +class MultiModalData: + """ + Dataclass that holds extra useful data for processing + multimodal data. Processors currently cannot return keys, + unless it is used in model's forward. Thus we have helper + methods that calculate and return useful data from processing + input multimodals (images/videos). + Note that this dataclass is aimed to be used only in vLLM + and we might change its API in the future. + """ + + num_image_tokens: list[int] | None = None + num_video_tokens: list[int] | None = None + num_audio_tokens: list[int] | None = None + num_image_patches: list[int] | None = None + + def __contains__(self, key): + return hasattr(self, key) and getattr(self, key) is not None + + def __getitem__(self, key): + if hasattr(self, key): + return getattr(self, key) + raise AttributeError(f"{self.__class__.__name__} has no attribute {key}") + + +class ProcessorMixin(PushToHubMixin): + """ + This is a mixin used to provide saving/loading functionality for all processor classes. + """ + + # Names need to be attr_class for attr in attributes + _auto_class = None + valid_processor_kwargs = ProcessingKwargs + + # args have to match the attributes class attribute + def __init__(self, *args, **kwargs): + # First, extract chat template from kwargs. It can never be a positional arg + setattr(self, "chat_template", kwargs.pop("chat_template", None)) + + # Check audio tokenizer for its class but do not treat it as attr to avoid saving weights + if (audio_tokenizer := kwargs.pop("audio_tokenizer", None)) is not None: + proper_class = self.check_argument_for_proper_class("audio_tokenizer", audio_tokenizer) + if not (is_torch_available() and isinstance(audio_tokenizer, PreTrainedAudioTokenizerBase)): + raise ValueError( + f"Tried to use `{proper_class}` for audio tokenization. However, this class is not" + " registered for audio tokenization." + ) + setattr(self, "audio_tokenizer", audio_tokenizer) + + # Sanitize args and kwargs + for key in kwargs: + if key not in self.get_attributes(): + raise TypeError(f"Unexpected keyword argument {key}.") + for arg, attribute_name in zip(args, self.get_attributes()): + if attribute_name in kwargs: + raise TypeError(f"Got multiple values for argument {attribute_name}.") + else: + kwargs[attribute_name] = arg + + if len(kwargs) != len(self.get_attributes()): + raise ValueError( + f"This processor requires {len(self.get_attributes())} arguments: {', '.join(self.get_attributes())}. Got " + f"{len(args)} arguments instead." + ) + + # Check each arg is of the proper class (this will also catch a user initializing in the wrong order) + for attribute_name, arg in kwargs.items(): + self.check_argument_for_proper_class(attribute_name, arg) + setattr(self, attribute_name, arg) + + def __call__( + self, + images: ImageInput | None = None, + text: TextInput | PreTokenizedInput | list[TextInput] | list[PreTokenizedInput] | None = None, + videos: VideoInput | None = None, + audio: AudioInput | None = None, + **kwargs: Unpack[ProcessingKwargs], + ): + """ + Main method to prepare for model inputs. This method forwards the each modality argument to its own processor + along with `kwargs`. Please refer to the docstring of the each processor attributes for more information. + + Args: + images (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, `list[PIL.Image.Image]`, `list[np.ndarray]`, `list[torch.Tensor]`): + The image or batch of images to be prepared. Each image can be a PIL image, NumPy array or PyTorch + tensor. Both channels-first and channels-last formats are supported. + text (`TextInput`, `PreTokenizedInput`, `list[TextInput]`, `list[PreTokenizedInput]`, *optional*): + The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings + (pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set + `is_split_into_words=True` (to lift the ambiguity with a batch of sequences). + videos (`np.ndarray`, `torch.Tensor`, `List[np.ndarray]`, `List[torch.Tensor]`): + The video or batch of videos to be prepared. Each video can be a 4D NumPy array or PyTorch + tensor, or a nested list of 3D frames. Both channels-first and channels-last formats are supported. + audio (`np.ndarray`, `torch.Tensor`, `list[np.ndarray]`, `list[torch.Tensor]`): + The audio or batch of audio to be prepared. Each audio can be a NumPy array or PyTorch + tensor. + return_tensors (`str` or [`~utils.TensorType`], *optional*): + If set, will return tensors of a particular framework. Acceptable values are: + + - `'pt'`: Return PyTorch `torch.Tensor` objects. + - `'np'`: Return NumPy `np.ndarray` objects. + + Returns: + [`BatchFeature`]: A [`BatchFeature`] object with processed inputs in a dict format. + """ + if "audios" in kwargs and audio is None: + raise ValueError("You passed keyword argument `audios` which is deprecated. Please use `audio` instead.") + + if images is None and text is None and videos is None and audio is None: + raise ValueError(f"You need to provide at least one input to call {self.__class__.__name__}") + + kwargs = self._merge_kwargs( + self.valid_processor_kwargs, + tokenizer_init_kwargs=self.tokenizer.init_kwargs if hasattr(self, "tokenizer") else {}, + **kwargs, + ) + + attribute_to_kwargs = { + "tokenizer": (text, "text_kwargs"), + "image_processor": (images, "images_kwargs"), + "video_processor": (videos, "videos_kwargs"), + "feature_extractor": (audio, "audio_kwargs"), + } + outputs = {} + for attribute_name in self.get_attributes(): + attribute = getattr(self, attribute_name, None) + input_data, input_kwargs = attribute_to_kwargs[attribute_name] + if input_data is not None and attribute is not None: + attribute_output = attribute(input_data, **kwargs[input_kwargs]) + outputs.update(attribute_output) + + return BatchFeature(outputs) + + def check_argument_for_proper_class(self, argument_name, argument): + """ + Checks the passed argument's class against the expected transformers class. In case of an unexpected + mismatch between expected and actual class, an error is raise. Otherwise, the proper retrieved class + is returned. + """ + # If the exact attribute name is not in the mapping, use its canonical modality + # (e.g., "encoder_tokenizer" -> "tokenizer") + if argument_name not in MODALITY_TO_BASE_CLASS_MAPPING: + argument_name = _get_modality_for_attribute(argument_name) + class_name = MODALITY_TO_BASE_CLASS_MAPPING.get(argument_name) + if isinstance(class_name, tuple): + proper_class = tuple(self.get_possibly_dynamic_module(n) for n in class_name if n is not None) + else: + proper_class = self.get_possibly_dynamic_module(class_name) + + if not isinstance(argument, proper_class): + raise TypeError( + f"Received a {type(argument).__name__} for argument {argument_name}, but a {class_name} was expected." + ) + + return proper_class + + def to_dict(self) -> dict[str, Any]: + """ + Serializes this instance to a Python dictionary. + + Returns: + `dict[str, Any]`: Dictionary of all the attributes that make up this processor instance. + """ + output = copy.deepcopy(self.__dict__) + + # Get the kwargs in `__init__`. + sig = inspect.signature(self.__init__) + # Only save the attributes that are presented in the kwargs of `__init__`. + # or in the attributes + attrs_to_save = list(sig.parameters) + self.__class__.get_attributes() + # extra attributes to be kept + attrs_to_save += ["auto_map"] + + # Remove tokenizers from output - they have their own vocab files and are saved separately. + # All other sub-processors (image_processor, feature_extractor, etc.) are kept in processor_config.json. + for attribute in self.__class__.get_attributes(): + if attribute in output: + modality = _get_modality_for_attribute(attribute) + if modality == "tokenizer": + del output[attribute] + + if "chat_template" in output: + del output["chat_template"] + + def cast_array_to_list(dictionary): + """ + Numpy arrays are not serialiazable but can be in pre-processing dicts. + This function casts arrays to list, recusring through the nested configs as well. + """ + for key, value in dictionary.items(): + if isinstance(value, np.ndarray): + dictionary[key] = value.tolist() + elif isinstance(value, dict): + dictionary[key] = cast_array_to_list(value) + return dictionary + + # Special case, add `audio_tokenizer` dict which points to model weights and path + if "audio_tokenizer" in output: + audio_tokenizer_dict = { + "audio_tokenizer_class": self.audio_tokenizer.__class__.__name__, + "audio_tokenizer_name_or_path": self.audio_tokenizer.name_or_path, + } + output["audio_tokenizer"] = audio_tokenizer_dict + + # Serialize attributes as a dict + output = { + k: v.to_dict() if isinstance(v, PushToHubMixin) else v + for k, v in output.items() + if ( + k in attrs_to_save # keep all attributes that have to be serialized + and v.__class__.__name__ != "BeamSearchDecoderCTC" # remove attributes with that are objects + ) + } + output = cast_array_to_list(output) + output["processor_class"] = self.__class__.__name__ + + return output + + def to_json_string(self) -> str: + """ + Serializes this instance to a JSON string. + + Returns: + `str`: String containing all the attributes that make up this feature_extractor instance in JSON format. + """ + dictionary = self.to_dict() + + return json.dumps(dictionary, indent=2, sort_keys=True) + "\n" + + def to_json_file(self, json_file_path: str | os.PathLike): + """ + Save this instance to a JSON file. + + Args: + json_file_path (`str` or `os.PathLike`): + Path to the JSON file in which this processor instance's parameters will be saved. + """ + with open(json_file_path, "w", encoding="utf-8") as writer: + writer.write(self.to_json_string()) + + def __repr__(self): + attributes_repr = [f"- {name}: {repr(getattr(self, name))}" for name in self.get_attributes()] + attributes_repr = "\n".join(attributes_repr) + return f"{self.__class__.__name__}:\n{attributes_repr}\n\n{self.to_json_string()}" + + def save_pretrained(self, save_directory, push_to_hub: bool = False, **kwargs): + """ + Saves the attributes of this processor (feature extractor, tokenizer...) in the specified directory so that it + can be reloaded using the [`~ProcessorMixin.from_pretrained`] method. + + + + This class method is simply calling [`~feature_extraction_utils.FeatureExtractionMixin.save_pretrained`] and + [`~tokenization_utils_base.PreTrainedTokenizerBase.save_pretrained`]. Please refer to the docstrings of the + methods above for more information. + + + + Args: + save_directory (`str` or `os.PathLike`): + Directory where the feature extractor JSON file and the tokenizer files will be saved (directory will + be created if it does not exist). + push_to_hub (`bool`, *optional*, defaults to `False`): + Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the + repository you want to push to with `repo_id` (will default to the name of `save_directory` in your + namespace). + kwargs (`dict[str, Any]`, *optional*): + Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method. + """ + os.makedirs(save_directory, exist_ok=True) + + if push_to_hub: + commit_message = kwargs.pop("commit_message", None) + repo_id = kwargs.pop("repo_id", save_directory.split(os.path.sep)[-1]) + repo_id = create_repo(repo_id, exist_ok=True, **kwargs).repo_id + files_timestamps = self._get_files_timestamps(save_directory) + # If we have a custom config, we copy the file defining it in the folder and set the attributes so it can be + # loaded from the Hub. + if self._auto_class is not None: + attrs = [getattr(self, attribute_name) for attribute_name in self.get_attributes()] + configs = [(a.init_kwargs if isinstance(a, PreTrainedTokenizerBase) else a) for a in attrs] + configs.append(self) + custom_object_save(self, save_directory, config=configs) + + for attribute_name in self.get_attributes(): + attribute = getattr(self, attribute_name) + + modality = _get_modality_for_attribute(attribute_name) + is_primary = attribute_name == modality + if modality == "tokenizer": + attribute._set_processor_class(self.__class__.__name__) + # Save the tokenizer in its own vocab file. The other attributes are saved as part of `processor_config.json` + if is_primary: + attribute.save_pretrained(save_directory) + else: + # if a model has multiple tokenizers, save the additional tokenizers in their own folders. + attribute.save_pretrained(os.path.join(save_directory, attribute_name)) + elif attribute._auto_class is not None: + custom_object_save(attribute, save_directory, config=attribute) + + if self._auto_class is not None: + # We added an attribute to the init_kwargs of the tokenizers, which needs to be cleaned up. + for attribute_name in self.get_attributes(): + attribute = getattr(self, attribute_name) + if isinstance(attribute, PreTrainedTokenizerBase): + del attribute.init_kwargs["auto_map"] + + # If we save using the predefined names, we can load using `from_pretrained` + # plus we save chat_template in its own file + output_processor_file = os.path.join(save_directory, PROCESSOR_NAME) + output_chat_template_file_jinja = os.path.join(save_directory, CHAT_TEMPLATE_FILE) + chat_template_dir = os.path.join(save_directory, CHAT_TEMPLATE_DIR) + + # Save `chat_template` in its own file. We can't get it from `processor_dict` as we popped it in `to_dict` + # to avoid serializing chat template in json config file. So let's get it from `self` directly + if isinstance(self.chat_template, str): + # New format for single templates is to save them as chat_template.jinja + with open(output_chat_template_file_jinja, "w", encoding="utf-8") as f: + f.write(self.chat_template) + logger.info(f"chat template saved in {output_chat_template_file_jinja}") + elif isinstance(self.chat_template, dict): + # New format for multiple templates is to save the default as chat_template.jinja + # and the other templates in the chat_templates/ directory + for template_name, template in self.chat_template.items(): + if template_name == "default": + with open(output_chat_template_file_jinja, "w", encoding="utf-8") as f: + f.write(self.chat_template["default"]) + logger.info(f"chat template saved in {output_chat_template_file_jinja}") + else: + os.makedirs(chat_template_dir, exist_ok=True) + template_filepath = os.path.join(chat_template_dir, f"{template_name}.jinja") + with open(template_filepath, "w", encoding="utf-8") as f: + f.write(template) + logger.info(f"chat template saved in {template_filepath}") + + # Create a unified `preprocessor_config.json` and save all attributes as a composite config, except for tokenizers + self.to_json_file(output_processor_file) + logger.info(f"processor saved in {output_processor_file}") + return_files = [output_processor_file] + + if push_to_hub: + self._upload_modified_files( + save_directory, + repo_id, + files_timestamps, + commit_message=commit_message, + token=kwargs.get("token"), + ) + + return return_files + + @classmethod + def get_processor_dict( + cls, pretrained_model_name_or_path: str | os.PathLike, **kwargs + ) -> tuple[dict[str, Any], dict[str, Any]]: + """ + From a `pretrained_model_name_or_path`, resolve to a dictionary of parameters, to be used for instantiating a + processor of type [`~processing_utils.ProcessingMixin`] using `from_args_and_dict`. + + Parameters: + pretrained_model_name_or_path (`str` or `os.PathLike`): + The identifier of the pre-trained checkpoint from which we want the dictionary of parameters. + subfolder (`str`, *optional*, defaults to `""`): + In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + specify the folder name here. + + Returns: + `tuple[Dict, Dict]`: The dictionary(ies) that will be used to instantiate the processor object. + """ + # holding a copy for optionally loading the audio tokenizer (if available) + audio_tokenizer_kwargs = copy.deepcopy(kwargs) + + cache_dir = kwargs.pop("cache_dir", None) + force_download = kwargs.pop("force_download", False) + proxies = kwargs.pop("proxies", None) + token = kwargs.pop("token", None) + local_files_only = kwargs.pop("local_files_only", False) + revision = kwargs.pop("revision", None) + subfolder = kwargs.pop("subfolder", "") + + from_pipeline = kwargs.pop("_from_pipeline", None) + from_auto_class = kwargs.pop("_from_auto", False) + + user_agent = {"file_type": "processor", "from_auto_class": from_auto_class} + if from_pipeline is not None: + user_agent["using_pipeline"] = from_pipeline + + if is_offline_mode() and not local_files_only: + logger.info("Offline mode: forcing local_files_only=True") + local_files_only = True + + pretrained_model_name_or_path = str(pretrained_model_name_or_path) + is_local = os.path.isdir(pretrained_model_name_or_path) + if os.path.isdir(pretrained_model_name_or_path): + processor_file = os.path.join(pretrained_model_name_or_path, PROCESSOR_NAME) + + additional_chat_template_files = {} + resolved_additional_chat_template_files = {} + if os.path.isfile(pretrained_model_name_or_path): + resolved_processor_file = pretrained_model_name_or_path + # can't load chat-template and audio tokenizer when given a file as pretrained_model_name_or_path + resolved_chat_template_file = None + resolved_raw_chat_template_file = None + resolved_audio_tokenizer_file = None + is_local = True + else: + if is_local: + template_dir = Path(pretrained_model_name_or_path, CHAT_TEMPLATE_DIR) + if template_dir.is_dir(): + for template_file in template_dir.glob("*.jinja"): + template_name = template_file.stem + additional_chat_template_files[template_name] = f"{CHAT_TEMPLATE_DIR}/{template_file.name}" + else: + try: + for template in list_repo_templates( + pretrained_model_name_or_path, + local_files_only=local_files_only, + revision=revision, + cache_dir=cache_dir, + token=token, + ): + template = template.removesuffix(".jinja") + additional_chat_template_files[template] = f"{CHAT_TEMPLATE_DIR}/{template}.jinja" + except EntryNotFoundError: + pass # No template dir means no template files + processor_file = PROCESSOR_NAME + + try: + # Load from local folder or from cache or download from model Hub and cache + resolved_processor_file = cached_file( + pretrained_model_name_or_path, + processor_file, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _raise_exceptions_for_missing_entries=False, + ) + + # chat_template.json is a legacy file used by the processor class + # a raw chat_template.jinja is preferred in future + resolved_chat_template_file = cached_file( + pretrained_model_name_or_path, + LEGACY_PROCESSOR_CHAT_TEMPLATE_FILE, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _raise_exceptions_for_missing_entries=False, + ) + + resolved_raw_chat_template_file = cached_file( + pretrained_model_name_or_path, + CHAT_TEMPLATE_FILE, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _raise_exceptions_for_missing_entries=False, + ) + + resolved_additional_chat_template_files = { + template_name: cached_file( + pretrained_model_name_or_path, + template_file, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _raise_exceptions_for_missing_entries=False, + ) + for template_name, template_file in additional_chat_template_files.items() + } + + resolved_audio_tokenizer_file = cached_file( + pretrained_model_name_or_path, + AUDIO_TOKENIZER_NAME, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _raise_exceptions_for_missing_entries=False, + ) + except OSError: + # Raise any environment error raise by `cached_file`. It will have a helpful error message adapted to + # the original exception. + raise + except Exception: + # For any other exception, we throw a generic error. + raise OSError( + f"Can't load processor for '{pretrained_model_name_or_path}'. If you were trying to load" + " it from 'https://huggingface.co/models', make sure you don't have a local directory with the" + f" same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a" + f" directory containing a {PROCESSOR_NAME} file" + ) + + # Add chat template as kwarg before returning because most models don't have processor config + if resolved_chat_template_file is not None: + # This is the legacy path + with open(resolved_chat_template_file, encoding="utf-8") as reader: + chat_template_json = json.loads(reader.read()) + chat_templates = {"default": chat_template_json["chat_template"]} + if resolved_additional_chat_template_files: + raise ValueError( + "Cannot load chat template due to conflicting files - this checkpoint combines " + "a legacy chat_template.json file with separate template files, which is not " + "supported. To resolve this error, replace the legacy chat_template.json file " + "with a modern chat_template.jinja file." + ) + else: + chat_templates = { + template_name: open(template_file, "r", encoding="utf-8").read() + for template_name, template_file in resolved_additional_chat_template_files.items() + } + if resolved_raw_chat_template_file is not None: + with open(resolved_raw_chat_template_file, "r", encoding="utf-8") as reader: + chat_templates["default"] = reader.read() + if isinstance(chat_templates, dict) and "default" in chat_templates and len(chat_templates) == 1: + chat_templates = chat_templates["default"] # Flatten when we just have a single template/file + + # Existing processors on the Hub created before #27761 being merged don't have `processor_config.json` (if not + # updated afterward), and we need to keep `from_pretrained` work. So here it fallbacks to the empty dict. + # (`cached_file` called using `_raise_exceptions_for_missing_entries=False` to avoid exception) + # However, for models added in the future, we won't get the expected error if this file is missing. + if resolved_processor_file is None: + # In any case we need to pass `chat_template` if it is available + processor_dict = {} + else: + try: + # Load processor dict + with open(resolved_processor_file, encoding="utf-8") as reader: + text = reader.read() + processor_dict = json.loads(text) + + except json.JSONDecodeError: + raise OSError( + f"It looks like the config file at '{resolved_processor_file}' is not a valid JSON file." + ) + + if is_local: + logger.info(f"loading configuration file {resolved_processor_file}") + else: + logger.info(f"loading configuration file {processor_file} from cache at {resolved_processor_file}") + + if processor_dict.get("chat_template") is not None: + logger.warning_once( + "Chat templates should be in a 'chat_template.jinja' file but found key='chat_template' " + "in the processor's config. Make sure to move your template to its own file." + ) + elif chat_templates: + processor_dict["chat_template"] = chat_templates + + # Audio tokenizer needs to load the model checkpoint first, because the saved + # json file contains only references to the model path and repo id + if resolved_audio_tokenizer_file is not None or "audio_tokenizer" in processor_dict: + if resolved_audio_tokenizer_file is not None: + reader = open(resolved_audio_tokenizer_file, "r", encoding="utf-8") + audio_tokenizer_dict = reader.read() + audio_tokenizer_dict = json.loads(audio_tokenizer_dict) + else: + audio_tokenizer_dict = processor_dict["audio_tokenizer"] + + audio_tokenizer_class = cls.get_possibly_dynamic_module(audio_tokenizer_dict["audio_tokenizer_class"]) + audio_tokenizer_path = audio_tokenizer_dict["audio_tokenizer_name_or_path"] + processor_dict["audio_tokenizer"] = audio_tokenizer_class.from_pretrained( + audio_tokenizer_path, **audio_tokenizer_kwargs + ) + + return processor_dict, kwargs + + @classmethod + def from_args_and_dict(cls, args, processor_dict: dict[str, Any], **kwargs): + """ + Instantiates a type of [`~processing_utils.ProcessingMixin`] from a Python dictionary of parameters. + + Args: + processor_dict (`dict[str, Any]`): + Dictionary that will be used to instantiate the processor object. Such a dictionary can be + retrieved from a pretrained checkpoint by leveraging the + [`~processing_utils.ProcessingMixin.to_dict`] method. + kwargs (`dict[str, Any]`): + Additional parameters from which to initialize the processor object. + + Returns: + [`~processing_utils.ProcessingMixin`]: The processor object instantiated from those + parameters. + """ + processor_dict = processor_dict.copy() + return_unused_kwargs = kwargs.pop("return_unused_kwargs", False) + + # We have to pop up some unused (but specific) kwargs and then validate that it doesn't contain unused kwargs + # If we don't pop, some specific kwargs will raise a warning or error + for unused_kwarg in cls.get_attributes() + ["auto_map", "processor_class"]: + processor_dict.pop(unused_kwarg, None) + + # override processor_dict with given kwargs + processor_dict.update(kwargs) + + # check if there is an overlap between args and processor_dict + accepted_args_and_kwargs = cls.__init__.__code__.co_varnames[: cls.__init__.__code__.co_argcount][1:] + + # validate both processor_dict and given kwargs + unused_kwargs, valid_kwargs = cls.validate_init_kwargs( + processor_config=processor_dict, valid_kwargs=accepted_args_and_kwargs + ) + + # update args that are already in processor_dict to avoid duplicate arguments + args_to_update = { + i: valid_kwargs.pop(arg) + for i, arg in enumerate(accepted_args_and_kwargs) + if (arg in valid_kwargs and i < len(args)) + } + args = [args_to_update.get(i, arg) for i, arg in enumerate(args)] + + # instantiate processor with used (and valid) kwargs only + processor = cls(*args, **valid_kwargs) + + logger.info(f"Processor {processor}") + if return_unused_kwargs: + return processor, unused_kwargs + else: + return processor + + def _merge_kwargs( + self, + ModelProcessorKwargs: ProcessingKwargs, + tokenizer_init_kwargs: dict | None = None, + **kwargs, + ) -> dict[str, dict]: + """ + Method to merge dictionaries of kwargs cleanly separated by modality within a Processor instance. + The order of operations is as follows: + 1) kwargs passed as before have highest priority to preserve BC. + ```python + high_priority_kwargs = {"crop_size" = {"height": 222, "width": 222}, "padding" = "max_length"} + processor(..., **high_priority_kwargs) + ``` + 2) kwargs passed as modality-specific kwargs have second priority. This is the recommended API. + ```python + processor(..., text_kwargs={"padding": "max_length"}, images_kwargs={"crop_size": {"height": 222, "width": 222}}}) + ``` + 3) kwargs passed during instantiation of a modality processor have fourth priority. + ```python + tokenizer = tokenizer_class(..., {"padding": "max_length"}) + image_processor = image_processor_class(...) + processor(tokenizer, image_processor) # will pass max_length unless overridden by kwargs at call + ``` + 4) defaults kwargs specified at processor level have lowest priority. + ```python + class MyProcessingKwargs(ProcessingKwargs, CommonKwargs, TextKwargs, ImagesKwargs, total=False): + _defaults = { + "text_kwargs": { + "padding": "max_length", + "max_length": 64, + }, + } + ``` + Args: + ModelProcessorKwargs (`ProcessingKwargs`): + Typed dictionary of kwargs specifically required by the model passed. + tokenizer_init_kwargs (`Dict`, *optional*): + Dictionary of kwargs the tokenizer was instantiated with and need to take precedence over defaults. + + Returns: + output_kwargs (`Dict`): + Dictionary of per-modality kwargs to be passed to each modality-specific processor. + + """ + # holding a copy to avoid mutating user-provided arguments + # Use deepcopy to also copy nested dicts (like videos_kwargs) that will be modified via pop() + kwargs = copy.deepcopy(kwargs) + + # Initialize dictionaries + output_kwargs = { + "text_kwargs": {}, + "images_kwargs": {}, + "audio_kwargs": {}, + "videos_kwargs": {}, + } + + default_kwargs = { + "text_kwargs": {}, + "images_kwargs": {}, + "audio_kwargs": {}, + "videos_kwargs": {}, + } + + map_preprocessor_kwargs = { + "text_kwargs": "tokenizer", + "images_kwargs": "image_processor", + "audio_kwargs": "feature_extractor", + "videos_kwargs": "video_processor", + } + + possible_modality_keywords = {"text", "audio", "videos", "images"} + used_keys = set() + + # get defaults from set model processor kwargs if they exist + for modality in default_kwargs: + default_kwargs[modality] = ModelProcessorKwargs._defaults.get(modality, {}).copy() + # Some preprocessors define a set of accepted "valid_kwargs" (currently only vision). + # In those cases, we don’t declare a `ModalityKwargs` attribute in the TypedDict. + # Instead, we dynamically obtain the kwargs from the preprocessor and merge them + # with the general kwargs set. This ensures consistency between preprocessor and + # processor classes, and helps prevent accidental mismatches. + modality_valid_kwargs = set(ModelProcessorKwargs.__annotations__[modality].__annotations__) + if modality in map_preprocessor_kwargs: + preprocessor = getattr(self, map_preprocessor_kwargs[modality], None) + preprocessor_valid_kwargs = ( + getattr(preprocessor, "valid_kwargs", None) if preprocessor is not None else None + ) + modality_valid_kwargs.update( + set(preprocessor_valid_kwargs.__annotations__ if preprocessor_valid_kwargs is not None else []) + ) + # update defaults with arguments from tokenizer init + for modality_key in modality_valid_kwargs: + # init with tokenizer init kwargs if necessary + if tokenizer_init_kwargs is not None and modality_key in tokenizer_init_kwargs: + value = ( + getattr(self.tokenizer, modality_key) + if hasattr(self.tokenizer, modality_key) + else tokenizer_init_kwargs[modality_key] + ) + default_kwargs[modality][modality_key] = value + # now defaults kwargs are updated with the tokenizers defaults. + # pass defaults to output dictionary + output_kwargs.update(default_kwargs) + + # For `common_kwargs` just update all modality-specific kwargs with same key/values + common_kwargs = ModelProcessorKwargs._defaults.get("common_kwargs", {}) + common_kwargs.update(kwargs.get("common_kwargs", {})) + if common_kwargs: + for kwarg in output_kwargs.values(): + kwarg.update(common_kwargs) + + # update modality kwargs with passed kwargs + non_modality_kwargs = set(kwargs) - set(output_kwargs) + for modality, output_kwarg in output_kwargs.items(): + modality_valid_kwargs = set(ModelProcessorKwargs.__annotations__[modality].__annotations__) + if modality in map_preprocessor_kwargs: + preprocessor = getattr(self, map_preprocessor_kwargs[modality], None) + preprocessor_valid_kwargs = ( + getattr(preprocessor, "valid_kwargs", None) if preprocessor is not None else None + ) + modality_valid_kwargs.update( + set(preprocessor_valid_kwargs.__annotations__ if preprocessor_valid_kwargs is not None else []) + ) + for modality_key in modality_valid_kwargs: + # check if we received a structured kwarg dict or not to handle it correctly + if modality in kwargs: + kwarg_value = kwargs[modality].pop(modality_key, "__empty__") + # check if this key was passed as a flat kwarg. + if kwarg_value != "__empty__" and modality_key in non_modality_kwargs: + raise ValueError( + f"Keyword argument {modality_key} was passed two times:\n" + f"in a dictionary for {modality} and as a **kwarg." + ) + elif modality_key in kwargs: + # we get a modality_key instead of popping it because modality-specific processors + # can have overlapping kwargs + kwarg_value = kwargs.get(modality_key, "__empty__") + else: + kwarg_value = "__empty__" + if not isinstance(kwarg_value, str) or kwarg_value != "__empty__": + output_kwarg[modality_key] = kwarg_value + used_keys.add(modality_key) + + # Determine if kwargs is a flat dictionary or contains nested dictionaries + if any(key in default_kwargs for key in kwargs): + # kwargs is dictionary-based, and some keys match modality names + for modality, subdict in kwargs.items(): + if modality in default_kwargs: + for subkey, subvalue in subdict.items(): + if subkey not in used_keys: + output_kwargs[modality][subkey] = subvalue + used_keys.add(subkey) + else: + # kwargs is a flat dictionary + for key, kwarg in kwargs.items(): + if key not in used_keys and key not in possible_modality_keywords: + logger.warning_once( + f"Keyword argument `{key}` is not a valid argument for this processor and will be ignored." + ) + + for key, typed_dict_obj in ModelProcessorKwargs.__annotations__.items(): + if key in map_preprocessor_kwargs: + preprocessor = getattr(self, map_preprocessor_kwargs[key], None) + if preprocessor is None or getattr(preprocessor, "valid_kwargs", None) is None: + continue + preprocessor_typed_dict_obj = getattr(preprocessor, "valid_kwargs") + typed_dict_obj = TypedDict( + "merged_typed_dict", + {**preprocessor_typed_dict_obj.__annotations__, **typed_dict_obj.__annotations__}, + total=False, + ) + validate_typed_dict(typed_dict_obj, output_kwargs[key]) + return output_kwargs + + @classmethod + def from_pretrained( + cls: type[SpecificProcessorType], + pretrained_model_name_or_path: str | os.PathLike, + cache_dir: str | os.PathLike | None = None, + force_download: bool = False, + local_files_only: bool = False, + token: str | bool | None = None, + revision: str = "main", + **kwargs, + ) -> SpecificProcessorType: + r""" + Instantiate a processor associated with a pretrained model. + + + + This class method is simply calling the feature extractor + [`~feature_extraction_utils.FeatureExtractionMixin.from_pretrained`], image processor + [`~image_processing_utils.ImageProcessingMixin`] and the tokenizer + [`~tokenization_utils_base.PreTrainedTokenizer.from_pretrained`] methods. Please refer to the docstrings of the + methods above for more information. + + + + Args: + pretrained_model_name_or_path (`str` or `os.PathLike`): + This can be either: + + - a string, the *model id* of a pretrained feature_extractor hosted inside a model repo on + huggingface.co. + - a path to a *directory* containing a feature extractor file saved using the + [`~SequenceFeatureExtractor.save_pretrained`] method, e.g., `./my_model_directory/`. + - a path or url to a saved feature extractor JSON *file*, e.g., + `./my_model_directory/preprocessor_config.json`. + **kwargs + Additional keyword arguments passed along to both + [`~feature_extraction_utils.FeatureExtractionMixin.from_pretrained`] and + [`~tokenization_utils_base.PreTrainedTokenizer.from_pretrained`]. + """ + kwargs["cache_dir"] = cache_dir + kwargs["force_download"] = force_download + kwargs["local_files_only"] = local_files_only + kwargs["revision"] = revision + + if token is not None: + kwargs["token"] = token + + # Get processor_dict first so we can use it to instantiate non-tokenizer sub-processors + processor_dict, instantiation_kwargs = cls.get_processor_dict(pretrained_model_name_or_path, **kwargs) + args = cls._get_arguments_from_pretrained(pretrained_model_name_or_path, processor_dict, **kwargs) + return cls.from_args_and_dict(args, processor_dict, **instantiation_kwargs) + + @classmethod + def get_attributes(cls): + args_in_init = inspect.signature(cls.__init__).parameters.keys() + attributes = [] + for sub_processor_type in args_in_init: + # don't treat audio_tokenizer as an attribute + if sub_processor_type == "audio_tokenizer": + continue + if any(modality in sub_processor_type for modality in MODALITY_TO_AUTOPROCESSOR_MAPPING.keys()): + attributes.append(sub_processor_type) + + # Legacy processors may not override `__init__` and instead expose modality + # attributes via `_class`. In that case, `args_in_init` only exposes + # `*args`/`**kwargs`, so we need to infer the attributes from those class-level + # hints to keep backward compatibility (e.g. dynamic processors stored on the Hub). + if not attributes: + for attribute_name, value in cls.__dict__.items(): + if value is None or attribute_name == "audio_tokenizer_class" or not attribute_name.endswith("_class"): + continue + inferred_attribute = attribute_name[: -len("_class")] + if inferred_attribute == "audio_tokenizer": + continue + if any(modality in inferred_attribute for modality in MODALITY_TO_AUTOPROCESSOR_MAPPING.keys()): + attributes.append(inferred_attribute) + + return attributes + + @classmethod + def register_for_auto_class(cls, auto_class="AutoProcessor"): + """ + Register this class with a given auto class. This should only be used for custom feature extractors as the ones + in the library are already mapped with `AutoProcessor`. + + + + Args: + auto_class (`str` or `type`, *optional*, defaults to `"AutoProcessor"`): + The auto class to register this new feature extractor with. + """ + if not isinstance(auto_class, str): + auto_class = auto_class.__name__ + + import transformers.models.auto as auto_module + + if not hasattr(auto_module, auto_class): + raise ValueError(f"{auto_class} is not a valid auto class.") + + cls._auto_class = auto_class + + @classmethod + def _load_tokenizer_from_pretrained( + cls, sub_processor_type, pretrained_model_name_or_path, subfolder="", **kwargs + ): + auto_processor_class = MODALITY_TO_AUTOPROCESSOR_MAPPING["tokenizer"] + is_primary = sub_processor_type == "tokenizer" + + if is_primary: + # Primary tokenizer: load from root + tokenizer = auto_processor_class.from_pretrained( + pretrained_model_name_or_path, subfolder=subfolder, **kwargs + ) + else: + # Additional tokenizer: load from subfolder (e.g., "decoder_tokenizer") + tokenizer_subfolder = os.path.join(subfolder, sub_processor_type) if subfolder else sub_processor_type + tokenizer = auto_processor_class.from_pretrained( + pretrained_model_name_or_path, subfolder=tokenizer_subfolder, **kwargs + ) + return tokenizer + + @classmethod + def _get_arguments_from_pretrained(cls, pretrained_model_name_or_path, processor_dict=None, **kwargs): + """ + Identify and instantiate the subcomponents of Processor classes, such as image processors, tokenizers, + and feature extractors. This method inspects the processor's `__init__` signature to identify parameters + that correspond to known modality types (image_processor, tokenizer, feature_extractor, etc.) or contain + modality names in their attribute name. + + For tokenizers: Uses the appropriate Auto class (AutoTokenizer) to load via `.from_pretrained()`. + Additional tokenizers (e.g., "decoder_tokenizer") are loaded from subfolders. + + For other sub-processors (image_processor, feature_extractor, etc.): Primary ones are loaded via + Auto class. Additional ones are instantiated from the config stored in processor_config.json + (passed as processor_dict). + + Args: + pretrained_model_name_or_path: Path or model id to load from. + processor_dict: Optional dict containing processor config (from processor_config.json). + Required when loading additional non-tokenizer sub-processors. + """ + args = [] + processor_dict = processor_dict if processor_dict is not None else {} + # Remove subfolder from kwargs to avoid duplicate keyword arguments + subfolder = kwargs.pop("subfolder", "") + + # get args from processor init signature + sub_processors = cls.get_attributes() + for sub_processor_type in sub_processors: + modality = _get_modality_for_attribute(sub_processor_type) + is_primary = sub_processor_type == modality + + if ( + "tokenizer" in sub_processor_type + ): # This is only necessary for the checkpoint in test_processing_mistral3.py which has no config.json and + # the tokenizer_config.json references LlamaTokenizerFast. TODO: update the config on the hub. + if "PixtralProcessor" in cls.__name__: + from .tokenization_utils_tokenizers import TokenizersBackend + + tokenizer = TokenizersBackend.from_pretrained( + pretrained_model_name_or_path, subfolder=subfolder, **kwargs + ) + else: + tokenizer = cls._load_tokenizer_from_pretrained( + sub_processor_type, pretrained_model_name_or_path, subfolder=subfolder, **kwargs + ) + args.append(tokenizer) + elif is_primary: + # Primary non-tokenizer sub-processor: load via Auto class + auto_processor_class = MODALITY_TO_AUTOPROCESSOR_MAPPING[sub_processor_type] + sub_processor = auto_processor_class.from_pretrained( + pretrained_model_name_or_path, subfolder=subfolder, **kwargs + ) + args.append(sub_processor) + + elif sub_processor_type in processor_dict: + # Additional non-tokenizer sub-processor: instantiate from config in processor_dict + sub_processor_config = processor_dict[sub_processor_type] + if isinstance(sub_processor_config, dict): + # Determine the class to instantiate + # Image processors have 'image_processor_type', feature extractors have 'feature_extractor_type' + type_key = f"{modality}_type" + class_name = sub_processor_config.get(type_key) + if class_name is None: + raise ValueError( + f"Cannot instantiate {sub_processor_type}: missing '{type_key}' in config. " + f"Config keys: {list(sub_processor_config.keys())}" + ) + processor_class = cls.get_possibly_dynamic_module(class_name) + sub_processor = processor_class(**sub_processor_config) + args.append(sub_processor) + else: + raise ValueError( + f"Expected dict for {sub_processor_type} in processor_config.json, " + f"got {type(sub_processor_config)}" + ) + else: + raise ValueError( + f"Cannot find config for {sub_processor_type} in processor_config.json. " + f"Available keys: {list(processor_dict.keys())}" + ) + + return args + + @staticmethod + def get_possibly_dynamic_module(module_name): + if hasattr(transformers_module, module_name): + return getattr(transformers_module, module_name) + lookup_locations = [ + transformers_module.IMAGE_PROCESSOR_MAPPING, + transformers_module.VIDEO_PROCESSOR_MAPPING, + transformers_module.TOKENIZER_MAPPING, + transformers_module.FEATURE_EXTRACTOR_MAPPING, + transformers_module.MODEL_FOR_AUDIO_TOKENIZATION_MAPPING, + ] + for lookup_location in lookup_locations: + for custom_class in lookup_location._extra_content.values(): + if isinstance(custom_class, tuple): + for custom_subclass in custom_class: + if custom_subclass is not None and custom_subclass.__name__ == module_name: + return custom_subclass + elif custom_class is not None and custom_class.__name__ == module_name: + return custom_class + raise ValueError( + f"Could not find module {module_name} in `transformers`. If this is a custom class, " + f"it should be registered using the relevant `AutoClass.register()` function so that " + f"other functions can find it!" + ) + + def batch_decode(self, *args, **kwargs): + """ + This method forwards all its arguments to PreTrainedTokenizer's [`~PreTrainedTokenizer.batch_decode`]. Please + refer to the docstring of this method for more information. + """ + if not hasattr(self, "tokenizer"): + raise ValueError(f"Cannot batch decode text: {self.__class__.__name__} has no tokenizer.") + return self.tokenizer.batch_decode(*args, **kwargs) + + def decode(self, *args, **kwargs): + """ + This method forwards all its arguments to PreTrainedTokenizer's [`~PreTrainedTokenizer.decode`]. Please refer to + the docstring of this method for more information. + """ + if not hasattr(self, "tokenizer"): + raise ValueError(f"Cannot decode text: {self.__class__.__name__} has no tokenizer.") + return self.tokenizer.decode(*args, **kwargs) + + @property + def model_input_names(self): + model_input_names = [] + for attribute_name in self.get_attributes(): + attribute = getattr(self, attribute_name, None) + attr_input_names = getattr(attribute, "model_input_names") + model_input_names.extend(attr_input_names) + return model_input_names + + @staticmethod + def validate_init_kwargs(processor_config, valid_kwargs): + kwargs_from_config = set(processor_config.keys()) + valid_kwargs_set = set(valid_kwargs) + + unused_keys = kwargs_from_config - valid_kwargs_set + valid_keys = kwargs_from_config & valid_kwargs_set + + unused_kwargs = {k: processor_config[k] for k in unused_keys} if unused_keys else {} + valid_kwargs = {k: processor_config[k] for k in valid_keys} if valid_keys else {} + + return unused_kwargs, valid_kwargs + + def apply_chat_template( + self, + conversation: list[dict[str, str]] | list[list[dict[str, str]]], + chat_template: str | None = None, + **kwargs: Unpack[AllKwargsForChatTemplate], + ) -> str: + """ + Similar to the `apply_chat_template` method on tokenizers, this method applies a Jinja template to input + conversations to turn them into a single tokenizable string. + + The input is expected to be in the following format, where each message content is a list consisting of text and + optionally image or video inputs. One can also provide an image, video, URL or local path which will be used to form + `pixel_values` when `return_dict=True`. If not provided, one will get only the formatted text, optionally tokenized text. + + conversation = [ + { + "role": "user", + "content": [ + {"type": "image", "url": "https://www.ilankelman.org/stopsigns/australia.jpg"}, + {"type": "text", "text": "Please describe this image in detail."}, + ], + }, + ] + + Args: + conversation (`Union[list[Dict, [str, str]], list[list[dict[str, str]]]]`): + The conversation to format. + chat_template (`Optional[str]`, *optional*): + The Jinja template to use for formatting the conversation. If not provided, the tokenizer's + chat template is used. + """ + if chat_template is None: + if isinstance(self.chat_template, dict) and "default" in self.chat_template: + chat_template = self.chat_template["default"] + elif isinstance(self.chat_template, dict): + raise ValueError( + 'The processor has multiple chat templates but none of them are named "default". You need to specify' + " which one to use by passing the `chat_template` argument. Available templates are: " + f"{', '.join(self.chat_template.keys())}" + ) + elif self.chat_template is not None: + chat_template = self.chat_template + else: + raise ValueError( + "Cannot use apply_chat_template because this processor does not have a chat template." + ) + else: + if isinstance(self.chat_template, dict) and chat_template in self.chat_template: + # It's the name of a template, not a full template string + chat_template = self.chat_template[chat_template] + else: + # It's a template string, render it directly + pass + + # Check if tokenizer is fast - use backend attribute if available, otherwise fall back to class name + is_tokenizers_fast = False + if hasattr(self, "tokenizer"): + if hasattr(self.tokenizer, "backend"): + is_tokenizers_fast = self.tokenizer.backend == "tokenizers" + else: + # Fallback to class name check + is_tokenizers_fast = self.tokenizer.__class__.__name__.endswith("Fast") + + if kwargs.get("continue_final_message", False): + if kwargs.get("add_generation_prompt", False): + raise ValueError( + "continue_final_message and add_generation_prompt are not compatible. Use continue_final_message when you want the model to continue the final message, and add_generation_prompt when you want to add a header that will prompt it to start a new assistant message instead." + ) + if kwargs.get("return_assistant_tokens_mask", False): + raise ValueError("continue_final_message is not compatible with return_assistant_tokens_mask.") + + if kwargs.get("return_assistant_tokens_mask", False): + if not is_tokenizers_fast: + raise ValueError( + "`return_assistant_tokens_mask` is not possible with slow tokenizers. Make sure you have `tokenizers` installed. " + "If the error persists, open an issue to support a Fast tokenizer for your model." + ) + else: + kwargs["return_offsets_mapping"] = True # force offset mapping so we can infer token boundaries + + # Fill sets of kwargs that should be used by jinja template, filtering out kwargs used in `processor.__call__` + # NOTE: we don't only filter but also set the default values here. Without default values, we can remove it + template_kwargs = {} + for key in AllKwargsForChatTemplate.__annotations__["template_kwargs"].__annotations__: + kwarg_type_defaults = AllKwargsForChatTemplate.__annotations__["template_kwargs"] + default_value = getattr(kwarg_type_defaults, key, None) + value = kwargs.pop(key, default_value) + if value is not None and not isinstance(value, dict): + template_kwargs[key] = value + + # Pass unprocessed custom kwargs + template_kwargs.update(kwargs) + + # Set the sampling rate to load the audio files if user hasn't already passed with `kwargs` + if "sampling_rate" not in template_kwargs: + if hasattr(self, "feature_extractor") and hasattr(self.feature_extractor, "sampling_rate"): + template_kwargs["sampling_rate"] = self.feature_extractor.sampling_rate + else: + template_kwargs["sampling_rate"] = 16_000 + + if isinstance(conversation, (list, tuple)) and ( + isinstance(conversation[0], (list, tuple)) or hasattr(conversation[0], "content") + ): + is_batched = True + conversations = conversation + else: + is_batched = False + conversations = [conversation] + + # Normalize OpenAI-style "image_url" content blocks to HuggingFace-style "image" blocks + # OpenAI format: {"type": "image_url", "image_url": {"url": "..."}} + # HuggingFace format: {"type": "image", "url": "..."} + for conversation_idx, conversation in enumerate(conversations): + for message in conversation: + if not isinstance(message.get("content"), list): + continue + new_content = [] + for content in message["content"]: + if isinstance(content, dict) and content.get("type") == "image_url" and "image_url" in content: + image_url_info = content["image_url"] + url = image_url_info.get("url", "") if isinstance(image_url_info, dict) else image_url_info + new_content.append({"type": "image", "url": url}) + else: + new_content.append(content) + message["content"] = new_content + + tokenize = template_kwargs.pop("tokenize", False) + return_dict = template_kwargs.pop("return_dict", True) + + if tokenize: + batch_images, batch_videos = [], [] + batch_audios = [] + for conversation in conversations: + images, videos = [], [] + for message in conversation: + visuals = [content for content in message["content"] if content["type"] in ["image", "video"]] + audio_fnames = [ + content[key] + for content in message["content"] + for key in ["audio", "url", "path"] + if key in content and content["type"] == "audio" + ] + image_fnames = [ + vision_info[key] + for vision_info in visuals + for key in ["image", "url", "path", "base64"] + if key in vision_info and vision_info["type"] == "image" + ] + images.extend(image_fnames) + video_fnames = [ + vision_info[key] + for vision_info in visuals + for key in ["video", "url", "path"] + if key in vision_info and vision_info["type"] == "video" + ] + videos.extend(video_fnames) + + # Audio models do not accept nested list of audios (yet!) so we construct a flat input audio list + if not template_kwargs["load_audio_from_video"]: + for fname in audio_fnames: + batch_audios.append(load_audio(fname, sampling_rate=template_kwargs["sampling_rate"])) + else: + for fname in video_fnames: + batch_audios.append(load_audio(fname, sampling_rate=template_kwargs["sampling_rate"])) + + # Currently all processors can accept nested list of batches, but not flat list of visuals + # So we'll make a batched list of images and let the processor handle it + batch_images.append(images) + batch_videos.append(videos) + + special_tokens_map = {} + if hasattr(self, "tokenizer") and hasattr(self.tokenizer, "special_tokens_map"): + special_tokens = self.tokenizer.special_tokens_map + # Filter out tokens that conflict with template kwargs + special_tokens_map = {k: v for k, v in special_tokens.items() if k not in template_kwargs} + + prompt, generation_indices = render_jinja_template( + conversations=conversations, + chat_template=chat_template, + **template_kwargs, # different flags such as `return_assistant_mask` + **special_tokens_map, # tokenizer special tokens are used by some templates + ) + + if not is_batched: + prompt = prompt[0] + + if tokenize: + # Tokenizer's `apply_chat_template` never adds special tokens when tokenizing + # But processor's `apply_chat_template` didn't have an option to tokenize, so users had to format the prompt + # and pass it to the processor. Users thus never worried about special tokens relying on processor handling + # everything internally. The below line is to keep BC for that and be able to work with model that have + # special tokens in the template (consistent with tokenizers). We dont want to raise warning, it will flood command line + # without actionable solution for users + single_prompt = prompt[0] if is_batched else prompt + if self.tokenizer.bos_token is not None and single_prompt.startswith(self.tokenizer.bos_token): + kwargs["add_special_tokens"] = False + + # Always sample frames by default unless explicitly set to `False` by users. If users do not pass `num_frames`/`fps` + # sampling should not done for BC. + if "do_sample_frames" not in kwargs and ( + kwargs.get("fps") is not None or kwargs.get("num_frames") is not None + ): + kwargs["do_sample_frames"] = True + + images_exist = any((im is not None) for im_list in batch_images for im in im_list) + videos_exist = any((vid is not None) for vid_list in batch_videos for vid in vid_list) + out = self( + text=prompt, + images=batch_images if images_exist else None, + videos=batch_videos if videos_exist else None, + audio=batch_audios if batch_audios else None, + **kwargs, + ) + + if return_dict: + if template_kwargs.get("return_assistant_tokens_mask", False): + assistant_masks = [] + offset_mapping = out.pop("offset_mapping") + input_ids = out["input_ids"] + for i in range(len(input_ids)): + current_mask = [0] * len(input_ids[i]) + offsets = offset_mapping[i] + offset_starts = [start for start, end in offsets] + for assistant_start_char, assistant_end_char in generation_indices[i]: + start_pos = bisect.bisect_left(offset_starts, assistant_start_char) + end_pos = bisect.bisect_left(offset_starts, assistant_end_char) + + if not ( + start_pos >= 0 + and start_pos < len(offsets) + and offsets[start_pos][0] <= assistant_start_char < offsets[start_pos][1] + ): + # start_token is out of bounds maybe due to truncation. + continue + # Ensure end_pos is also within bounds + if end_pos > len(input_ids[i]): + end_pos = len(input_ids[i]) + for token_id in range(start_pos, end_pos if end_pos else len(input_ids[i])): + current_mask[token_id] = 1 + assistant_masks.append(current_mask) + out["assistant_masks"] = assistant_masks + out.convert_to_tensors(tensor_type=kwargs.get("return_tensors")) + return out + else: + return out["input_ids"] + return prompt + + def post_process_multimodal_output( + self, generated_outputs, skip_special_tokens=True, generation_mode=None, **kwargs + ): + """ + Post-process the output of a multimodal model to return the requested modality output. + If the model cannot generated the requested modality, an error will be raised. + + Args: + generated_outputs (`torch.Tensor` or `np.ndarray`): + The output of the model `generate` function. The output is expected to be a tensor of shape `(batch_size, sequence_length)` + or `(sequence_length,)`. + skip_special_tokens (`bool`, *optional*, defaults to `True`): + Whether or not to remove special tokens in the output. Argument passed to the tokenizer's `batch_decode` method. + generation_mode (`str`, *optional*): + Generation mode indicated which modality to output and can be one of `["text", "image", "audio"]`. + **kwargs: + Additional arguments to be passed to the tokenizer's `batch_decode method`. + + Returns: + `list[str]`: The decoded text. + """ + if generation_mode is not None and generation_mode != "text": + raise ValueError( + f"{self.__class__.__name__} got an unexpected generation_mode={generation_mode}. Supported options are only [`text`]" + ) + return self.post_process_image_text_to_text( + generated_outputs, skip_special_tokens=skip_special_tokens, **kwargs + ) + + def post_process_image_text_to_text(self, generated_outputs, skip_special_tokens=True, **kwargs): + """ + Post-process the output of a vlm to decode the text. + + Args: + generated_outputs (`torch.Tensor` or `np.ndarray`): + The output of the model `generate` function. The output is expected to be a tensor of shape `(batch_size, sequence_length)` + or `(sequence_length,)`. + skip_special_tokens (`bool`, *optional*, defaults to `True`): + Whether or not to remove special tokens in the output. Argument passed to the tokenizer's `decode` method. + **kwargs: + Additional arguments to be passed to the tokenizer's `decode` method. + + Returns: + `list[str]`: The decoded text. + """ + return self.tokenizer.decode(generated_outputs, skip_special_tokens=skip_special_tokens, **kwargs) + + def _check_special_mm_tokens(self, text: list[str], text_inputs: "BatchFeature", modalities: list[str]): + """ + Checks that number of special tokens in text and processed text is same. The count can be different + if tokenized text was truncated, leading to issues in model code. + """ + for modality in modalities: + token_str = getattr(self, f"{modality}_token") + token_id = getattr(self, f"{modality}_token_id") + ids_count = [list(ids).count(token_id) for ids in text_inputs["input_ids"]] + text_count = [sample.count(token_str) for sample in text] + + if ids_count != text_count: + raise ValueError( + f"Mismatch in `{modality}` token count between text and `input_ids`. Got ids={ids_count} and text={text_count}. " + "Likely due to `truncation='max_length'`. Please disable truncation or increase `max_length`." + ) + + +ProcessorMixin.push_to_hub = copy_func(ProcessorMixin.push_to_hub) +if ProcessorMixin.push_to_hub.__doc__ is not None: + ProcessorMixin.push_to_hub.__doc__ = ProcessorMixin.push_to_hub.__doc__.format( + object="processor", object_class="AutoProcessor", object_files="processor files" + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/py.typed b/TTS/Kokoro/.venv/Lib/site-packages/transformers/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/pytorch_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/pytorch_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..444c8bc457bb131806ac6b9cc0a0517fcf21b137 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/pytorch_utils.py @@ -0,0 +1,260 @@ +# Copyright 2022 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from __future__ import annotations + +import inspect +from collections.abc import Callable +from functools import lru_cache, wraps + +import torch +from safetensors.torch import storage_ptr, storage_size +from torch import nn + +from .utils import ( + is_torch_greater_or_equal, + is_torch_xla_available, + is_torchdynamo_compiling, + logging, +) + + +ALL_LAYERNORM_LAYERS = [nn.LayerNorm] + +logger = logging.get_logger(__name__) + +is_torch_greater_or_equal_than_2_8 = is_torch_greater_or_equal("2.8", accept_dev=True) +is_torch_greater_or_equal_than_2_6 = is_torch_greater_or_equal("2.6", accept_dev=True) + +# For backwards compatibility (e.g. some remote codes on Hub using those variables). +is_torch_greater_or_equal_than_2_4 = is_torch_greater_or_equal("2.4", accept_dev=True) +is_torch_greater_or_equal_than_2_3 = is_torch_greater_or_equal("2.3", accept_dev=True) +is_torch_greater_or_equal_than_2_2 = is_torch_greater_or_equal("2.2", accept_dev=True) +is_torch_greater_or_equal_than_2_1 = is_torch_greater_or_equal("2.1", accept_dev=True) +is_torch_greater_or_equal_than_2_0 = is_torch_greater_or_equal("2.0", accept_dev=True) +is_torch_greater_or_equal_than_1_13 = is_torch_greater_or_equal("1.13", accept_dev=True) +is_torch_greater_or_equal_than_1_12 = is_torch_greater_or_equal("1.12", accept_dev=True) + +# Cache this result has it's a C FFI call which can be pretty time-consuming +_torch_distributed_available = torch.distributed.is_available() + + +def softmax_backward_data(parent, grad_output, output): + """ + A function that calls the internal `_softmax_backward_data` PyTorch method and that adjusts the arguments according + to the torch version detected. + """ + + from torch import _softmax_backward_data + + return _softmax_backward_data(grad_output, output, parent.dim, output.dtype) + + +def prune_linear_layer(layer: nn.Linear, index: torch.LongTensor, dim: int = 0) -> nn.Linear: + """ + Prune a linear layer to keep only entries in index. + + Used to remove heads. + + Args: + layer (`torch.nn.Linear`): The layer to prune. + index (`torch.LongTensor`): The indices to keep in the layer. + dim (`int`, *optional*, defaults to 0): The dimension on which to keep the indices. + + Returns: + `torch.nn.Linear`: The pruned layer as a new layer with `requires_grad=True`. + """ + index = index.to(layer.weight.device) + W = layer.weight.index_select(dim, index).detach().clone() + if layer.bias is not None: + if dim == 1: + b = layer.bias.detach().clone() + else: + b = layer.bias[index].detach().clone() + new_size = list(layer.weight.size()) + new_size[dim] = len(index) + new_layer = nn.Linear(new_size[1], new_size[0], bias=layer.bias is not None).to(layer.weight.device) + new_layer.weight.requires_grad = False + new_layer.weight.copy_(W.contiguous()) + new_layer.weight.requires_grad = True + if layer.bias is not None: + new_layer.bias.requires_grad = False + new_layer.bias.copy_(b.contiguous()) + new_layer.bias.requires_grad = True + return new_layer + + +class Conv1D(nn.Module): + """ + 1D-convolutional layer as defined by Radford et al. for OpenAI GPT (and also used in GPT-2). + + Basically works like a linear layer but the weights are transposed. + + Args: + nf (`int`): The number of output features. + nx (`int`): The number of input features. + """ + + def __init__(self, nf, nx): + super().__init__() + self.nf = nf + self.nx = nx + self.weight = nn.Parameter(torch.empty(nx, nf)) + self.bias = nn.Parameter(torch.zeros(nf)) + nn.init.normal_(self.weight, std=0.02) + + def __repr__(self) -> str: + return "Conv1D(nf={nf}, nx={nx})".format(**self.__dict__) + + def forward(self, x): + size_out = x.size()[:-1] + (self.nf,) + x = torch.addmm(self.bias, x.view(-1, x.size(-1)), self.weight) + x = x.view(size_out) + return x + + +def apply_chunking_to_forward( + forward_fn: Callable[..., torch.Tensor], + chunk_size: int, + chunk_dim: int, + *input_tensors, +) -> torch.Tensor: + """ + This function chunks the `input_tensors` into smaller input tensor parts of size `chunk_size` over the dimension + `chunk_dim`. It then applies a layer `forward_fn` to each chunk independently to save memory. + + If the `forward_fn` is independent across the `chunk_dim` this function will yield the same result as directly + applying `forward_fn` to `input_tensors`. + + Args: + forward_fn (`Callable[..., torch.Tensor]`): + The forward function of the model. + chunk_size (`int`): + The chunk size of a chunked tensor: `num_chunks = len(input_tensors[0]) / chunk_size`. + chunk_dim (`int`): + The dimension over which the `input_tensors` should be chunked. + input_tensors (`tuple[torch.Tensor]`): + The input tensors of `forward_fn` which will be chunked + + Returns: + `torch.Tensor`: A tensor with the same shape as the `forward_fn` would have given if applied`. + + + Examples: + + ```python + # rename the usual forward() fn to forward_chunk() + def forward_chunk(self, hidden_states): + hidden_states = self.decoder(hidden_states) + return hidden_states + + + # implement a chunked forward function + def forward(self, hidden_states): + return apply_chunking_to_forward(self.forward_chunk, self.chunk_size_lm_head, self.seq_len_dim, hidden_states) + ```""" + + assert len(input_tensors) > 0, f"{input_tensors} has to be a tuple/list of tensors" + + # inspect.signature exist since python 3.5 and is a python method -> no problem with backward compatibility + num_args_in_forward_chunk_fn = len(inspect.signature(forward_fn).parameters) + if num_args_in_forward_chunk_fn != len(input_tensors): + raise ValueError( + f"forward_chunk_fn expects {num_args_in_forward_chunk_fn} arguments, but only {len(input_tensors)} input " + "tensors are given" + ) + + if chunk_size > 0: + tensor_shape = input_tensors[0].shape[chunk_dim] + for input_tensor in input_tensors: + if input_tensor.shape[chunk_dim] != tensor_shape: + raise ValueError( + f"All input tenors have to be of the same shape: {tensor_shape}, " + f"found shape {input_tensor.shape[chunk_dim]}" + ) + + if input_tensors[0].shape[chunk_dim] % chunk_size != 0: + raise ValueError( + f"The dimension to be chunked {input_tensors[0].shape[chunk_dim]} has to be a multiple of the chunk " + f"size {chunk_size}" + ) + + num_chunks = input_tensors[0].shape[chunk_dim] // chunk_size + + # chunk input tensor into tuples + input_tensors_chunks = tuple(input_tensor.chunk(num_chunks, dim=chunk_dim) for input_tensor in input_tensors) + # apply forward fn to every tuple + output_chunks = tuple(forward_fn(*input_tensors_chunk) for input_tensors_chunk in zip(*input_tensors_chunks)) + # concatenate output at same dimension + return torch.cat(output_chunks, dim=chunk_dim) + + return forward_fn(*input_tensors) + + +def meshgrid(*tensors: torch.Tensor | list[torch.Tensor], indexing: str | None = None) -> tuple[torch.Tensor, ...]: + """ + Wrapper around torch.meshgrid to avoid warning messages about the introduced `indexing` argument. + + Reference: https://pytorch.org/docs/1.13/generated/torch.meshgrid.html + """ + return torch.meshgrid(*tensors, indexing=indexing) + + +def id_tensor_storage(tensor: torch.Tensor) -> tuple[torch.device, int, int]: + """ + Unique identifier to a tensor storage. Multiple different tensors can share the same underlying storage. For + example, "meta" tensors all share the same storage, and thus their identifier will all be equal. This identifier is + guaranteed to be unique and constant for this tensor's storage during its lifetime. Two tensor storages with + non-overlapping lifetimes may have the same id. + """ + if _torch_distributed_available and is_torch_greater_or_equal("2.5"): + from torch.distributed.tensor import DTensor + + if isinstance(tensor, DTensor): + local_tensor = tensor.to_local() + return tensor.device, local_tensor.storage().data_ptr(), tensor.nbytes + + if tensor.device.type == "xla" and is_torch_xla_available(): + # NOTE: xla tensors dont have storage + # use some other unique id to distinguish. + # this is a XLA tensor, it must be created using torch_xla's + # device. So the following import is safe: + import torch_xla + + unique_id = torch_xla._XLAC._xla_get_tensor_id(tensor) + else: + unique_id = storage_ptr(tensor) + + return tensor.device, unique_id, storage_size(tensor) + + +@wraps(lru_cache) +def compile_compatible_method_lru_cache(*lru_args, **lru_kwargs): + """ + LRU cache decorator from standard functools library, but with a workaround to disable + caching when torchdynamo is compiling. Expected to work with class methods. + """ + + def decorator(func): + func_with_cache = lru_cache(*lru_args, **lru_kwargs)(func) + + @wraps(func) + def wrapper(*args, **kwargs): + if is_torchdynamo_compiling(): + return func(*args, **kwargs) + else: + return func_with_cache(*args, **kwargs) + + return wrapper + + return decorator diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/safetensors_conversion.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/safetensors_conversion.py new file mode 100644 index 0000000000000000000000000000000000000000..8089b3ec3ac68241e0f99159e4366372f26d9ad8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/safetensors_conversion.py @@ -0,0 +1,117 @@ +from typing import Optional + +import httpx +from huggingface_hub import Discussion, HfApi, get_repo_discussions + +from .utils import cached_file, http_user_agent, logging + + +logger = logging.get_logger(__name__) + + +def previous_pr(api: HfApi, model_id: str, pr_title: str, token: str) -> Optional["Discussion"]: + main_commit = api.list_repo_commits(model_id, token=token)[0].commit_id + for discussion in get_repo_discussions(repo_id=model_id, token=token): + if discussion.title == pr_title and discussion.status == "open" and discussion.is_pull_request: + commits = api.list_repo_commits(model_id, revision=discussion.git_reference, token=token) + + if main_commit == commits[1].commit_id: + return discussion + return None + + +def spawn_conversion(token: str, private: bool, model_id: str): + logger.info("Attempting to convert .bin model on the fly to safetensors.") + + safetensors_convert_space_url = "https://safetensors-convert.hf.space" + sse_url = f"{safetensors_convert_space_url}/call/run" + + def start(_sse_connection): + for line in _sse_connection.iter_lines(): + if not isinstance(line, str): + line = line.decode() + if line.startswith("event:"): + status = line[7:] + logger.debug(f"Safetensors conversion status: {status}") + + if status == "complete": + return + elif status == "heartbeat": + logger.debug("Heartbeat") + else: + logger.debug(f"Unknown status {status}") + else: + logger.debug(line) + + data = {"data": [model_id, private, token]} + + result = httpx.post(sse_url, follow_redirects=True, json=data).json() + event_id = result["event_id"] + + with httpx.stream("GET", f"{sse_url}/{event_id}") as sse_connection: + try: + logger.debug("Spawning safetensors automatic conversion.") + start(sse_connection) + except Exception as e: + logger.warning(f"Error during conversion: {repr(e)}") + + +def get_conversion_pr_reference(api: HfApi, model_id: str, **kwargs): + private = api.model_info(model_id).private + + logger.info("Attempting to create safetensors variant") + pr_title = "Adding `safetensors` variant of this model" + token = kwargs.get("token") + + # This looks into the current repo's open PRs to see if a PR for safetensors was already open. If so, it + # returns it. It checks that the PR was opened by the bot and not by another user so as to prevent + # security breaches. + pr = previous_pr(api, model_id, pr_title, token=token) + + if pr is None or (not private and pr.author != "SFconvertbot"): + spawn_conversion(token, private, model_id) + pr = previous_pr(api, model_id, pr_title, token=token) + else: + logger.info("Safetensors PR exists") + if pr is None: + raise OSError( + "Could not create safetensors conversion PR. The repo does not appear to have a file named pytorch_model.bin or model.safetensors." + "If you are loading with variant, use `use_safetensors=False` to load the original model." + ) + + sha = f"refs/pr/{pr.num}" + + return sha + + +def auto_conversion( + pretrained_model_name_or_path: str, + ignore_errors_during_conversion: bool = False, + safe_weights_name: str = "model.safetensors", + safe_weights_index_name: str = "model.safetensors.index.json", + **cached_file_kwargs, +): + try: + api = HfApi(token=cached_file_kwargs.get("token"), headers={"user-agent": http_user_agent()}) + sha = get_conversion_pr_reference(api, pretrained_model_name_or_path, **cached_file_kwargs) + + if sha is None: + return None, None + cached_file_kwargs["revision"] = sha + del cached_file_kwargs["_commit_hash"] + + # This is an additional HEAD call that could be removed if we could infer sharded/non-sharded from the PR + # description. + sharded = api.file_exists( + pretrained_model_name_or_path, + safe_weights_index_name, + revision=sha, + token=cached_file_kwargs.get("token"), + ) + filename = safe_weights_index_name if sharded else safe_weights_name + + resolved_archive_file = cached_file(pretrained_model_name_or_path, filename, **cached_file_kwargs) + return resolved_archive_file, sha, sharded + except Exception as e: + if not ignore_errors_during_conversion: + raise e diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/testing_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/testing_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..57c09c46b6ccc199e345b92f40767a19ad7d748d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/testing_utils.py @@ -0,0 +1,4312 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import ast +import collections +import contextlib +import copy +import doctest +import functools +import gc +import importlib +import inspect +import json +import logging +import multiprocessing +import os +import re +import shlex +import shutil +import subprocess +import sys +import tempfile +import threading +import time +import traceback +import types +import unittest +from collections import UserDict, defaultdict +from collections.abc import Callable, Generator, Iterable, Iterator, Mapping +from contextlib import contextmanager +from dataclasses import MISSING, fields +from functools import cache, wraps +from io import StringIO +from pathlib import Path +from typing import TYPE_CHECKING, Any +from unittest import mock +from unittest.mock import patch + +import httpx +from huggingface_hub import create_repo, delete_repo +from packaging import version + +from transformers import logging as transformers_logging + + +if TYPE_CHECKING: + from .trainer import Trainer +else: + Trainer = Any # type: ignore + +from .integrations import ( + is_clearml_available, + is_optuna_available, + is_ray_available, + is_swanlab_available, + is_tensorboard_available, + is_trackio_available, + is_wandb_available, +) +from .integrations.deepspeed import is_deepspeed_available +from .utils import ( + ACCELERATE_MIN_VERSION, + GGUF_MIN_VERSION, + SAFE_WEIGHTS_INDEX_NAME, + TRITON_MIN_VERSION, + WEIGHTS_INDEX_NAME, + is_accelerate_available, + is_apex_available, + is_apollo_torch_available, + is_aqlm_available, + is_auto_round_available, + is_av_available, + is_bitsandbytes_available, + is_bs4_available, + is_compressed_tensors_available, + is_cv2_available, + is_cython_available, + is_decord_available, + is_detectron2_available, + is_essentia_available, + is_faiss_available, + is_fbgemm_gpu_available, + is_flash_attn_2_available, + is_flash_attn_3_available, + is_flute_available, + is_fp_quant_available, + is_fsdp_available, + is_g2p_en_available, + is_galore_torch_available, + is_gguf_available, + is_gptqmodel_available, + is_grokadamw_available, + is_hadamard_available, + is_hqq_available, + is_huggingface_hub_greater_or_equal, + is_jinja_available, + is_jmespath_available, + is_jumanpp_available, + is_kernels_available, + is_levenshtein_available, + is_librosa_available, + is_liger_kernel_available, + is_lomo_available, + is_mistral_common_available, + is_natten_available, + is_nltk_available, + is_numba_available, + is_onnx_available, + is_openai_available, + is_optimum_available, + is_optimum_quanto_available, + is_pandas_available, + is_peft_available, + is_phonemizer_available, + is_pretty_midi_available, + is_psutil_available, + is_pyctcdecode_available, + is_pytesseract_available, + is_pytest_available, + is_pytest_order_available, + is_pytorch_quantization_available, + is_quark_available, + is_qutlass_available, + is_rjieba_available, + is_sacremoses_available, + is_schedulefree_available, + is_scipy_available, + is_sentencepiece_available, + is_seqio_available, + is_spacy_available, + is_speech_available, + is_spqr_available, + is_sudachi_available, + is_sudachi_projection_available, + is_tiktoken_available, + is_timm_available, + is_tokenizers_available, + is_torch_available, + is_torch_bf16_available_on_device, + is_torch_fp16_available_on_device, + is_torch_greater_or_equal, + is_torch_hpu_available, + is_torch_mlu_available, + is_torch_neuroncore_available, + is_torch_npu_available, + is_torch_optimi_available, + is_torch_tensorrt_fx_available, + is_torch_tf32_available, + is_torch_xla_available, + is_torch_xpu_available, + is_torchao_available, + is_torchaudio_available, + is_torchcodec_available, + is_torchvision_available, + is_triton_available, + is_vision_available, + is_vptq_available, + strtobool, +) + + +if is_accelerate_available(): + from accelerate.state import AcceleratorState, PartialState + from accelerate.utils.imports import is_fp8_available + + +if is_pytest_available(): + from _pytest.doctest import ( + Module, + _get_checker, + _get_continue_on_failure, + _get_runner, + _is_mocked, + _patch_unwrap_mock_aware, + get_optionflags, + ) + from _pytest.outcomes import skip + from _pytest.pathlib import import_path + from pytest import DoctestItem +else: + Module = object + DoctestItem = object + + +SMALL_MODEL_IDENTIFIER = "julien-c/bert-xsmall-dummy" +DUMMY_UNKNOWN_IDENTIFIER = "julien-c/dummy-unknown" +DUMMY_DIFF_TOKENIZER_IDENTIFIER = "julien-c/dummy-diff-tokenizer" +# Used to test Auto{Config, Model, Tokenizer} model_type detection. + +# Used to test the hub +USER = "__DUMMY_TRANSFORMERS_USER__" +ENDPOINT_STAGING = "https://hub-ci.huggingface.co" + +# Not critical, only usable on the sandboxed CI instance. +TOKEN = "hf_94wBhPGp6KrrTH3KDchhKpRxZwd6dmHWLL" + + +# Used in CausalLMModelTester (and related classes/methods) to infer the common model classes from the base model class +_COMMON_MODEL_NAMES_MAP = { + "config_class": "Config", + "causal_lm_class": "ForCausalLM", + "question_answering_class": "ForQuestionAnswering", + "sequence_classification_class": "ForSequenceClassification", + "token_classification_class": "ForTokenClassification", +} + + +if is_torch_available(): + import torch + from safetensors.torch import load_file + + from .modeling_utils import FLASH_ATTN_KERNEL_FALLBACK, PreTrainedModel + + IS_ROCM_SYSTEM = torch.version.hip is not None + IS_CUDA_SYSTEM = torch.version.cuda is not None + IS_XPU_SYSTEM = getattr(torch.version, "xpu", None) is not None + IS_NPU_SYSTEM = getattr(torch, "npu", None) is not None +else: + IS_ROCM_SYSTEM = False + IS_CUDA_SYSTEM = False + IS_XPU_SYSTEM = False + IS_NPU_SYSTEM = False + +logger = transformers_logging.get_logger(__name__) + + +def parse_flag_from_env(key, default=False): + try: + value = os.environ[key] + except KeyError: + # KEY isn't set, default to `default`. + _value = default + else: + # KEY is set, convert it to True or False. + try: + _value = strtobool(value) + except ValueError: + # More values are supported, but let's keep the message simple. + raise ValueError(f"If set, {key} must be yes or no.") + return _value + + +def parse_int_from_env(key, default=None): + try: + value = os.environ[key] + except KeyError: + _value = default + else: + try: + _value = int(value) + except ValueError: + raise ValueError(f"If set, {key} must be a int.") + return _value + + +_run_slow_tests = parse_flag_from_env("RUN_SLOW", default=False) +_run_flaky_tests = parse_flag_from_env("RUN_FLAKY", default=True) +_run_custom_tokenizers = parse_flag_from_env("RUN_CUSTOM_TOKENIZERS", default=False) +_run_staging = parse_flag_from_env("HUGGINGFACE_CO_STAGING", default=False) +_run_pipeline_tests = parse_flag_from_env("RUN_PIPELINE_TESTS", default=True) +_run_agent_tests = parse_flag_from_env("RUN_AGENT_TESTS", default=False) +_run_training_tests = parse_flag_from_env("RUN_TRAINING_TESTS", default=True) + + +def is_staging_test(test_case): + """ + Decorator marking a test as a staging test. + + Those tests will run using the staging environment of huggingface.co instead of the real model hub. + """ + if not _run_staging: + return unittest.skip(reason="test is staging test")(test_case) + else: + try: + import pytest # We don't need a hard dependency on pytest in the main library + except ImportError: + return test_case + else: + return pytest.mark.is_staging_test()(test_case) + + +def is_pipeline_test(test_case): + """ + Decorator marking a test as a pipeline test. If RUN_PIPELINE_TESTS is set to a falsy value, those tests will be + skipped. + """ + if not _run_pipeline_tests: + return unittest.skip(reason="test is pipeline test")(test_case) + else: + try: + import pytest # We don't need a hard dependency on pytest in the main library + except ImportError: + return test_case + else: + return pytest.mark.is_pipeline_test()(test_case) + + +def is_agent_test(test_case): + """ + Decorator marking a test as an agent test. If RUN_TOOL_TESTS is set to a falsy value, those tests will be skipped. + """ + if not _run_agent_tests: + return unittest.skip(reason="test is an agent test")(test_case) + else: + try: + import pytest # We don't need a hard dependency on pytest in the main library + except ImportError: + return test_case + else: + return pytest.mark.is_agent_test()(test_case) + + +def is_training_test(test_case): + """ + Decorator marking a test as a training test. If RUN_TRAINING_TESTS is set to a falsy value, those tests will be + skipped. + """ + if not _run_training_tests: + return unittest.skip(reason="test is training test")(test_case) + else: + try: + import pytest # We don't need a hard dependency on pytest in the main library + except ImportError: + return test_case + else: + return pytest.mark.is_training_test()(test_case) + + +def slow(test_case): + """ + Decorator marking a test as slow. + + Slow tests are skipped by default. Set the RUN_SLOW environment variable to a truthy value to run them. + + """ + return unittest.skipUnless(_run_slow_tests, "test is slow")(test_case) + + +def tooslow(test_case): + """ + Decorator marking a test as too slow. + + Slow tests are skipped while they're in the process of being fixed. No test should stay tagged as "tooslow" as + these will not be tested by the CI. + + """ + return unittest.skip(reason="test is too slow")(test_case) + + +def skip_if_not_implemented(test_func): + @functools.wraps(test_func) + def wrapper(*args, **kwargs): + try: + return test_func(*args, **kwargs) + except NotImplementedError as e: + raise unittest.SkipTest(f"Test skipped due to NotImplementedError: {e}") + + return wrapper + + +def apply_skip_if_not_implemented(cls): + """ + Class decorator to apply @skip_if_not_implemented to all test methods. + """ + for attr_name in dir(cls): + if attr_name.startswith("test_"): + attr = getattr(cls, attr_name) + if callable(attr): + setattr(cls, attr_name, skip_if_not_implemented(attr)) + return cls + + +def custom_tokenizers(test_case): + """ + Decorator marking a test for a custom tokenizer. + + Custom tokenizers require additional dependencies, and are skipped by default. Set the RUN_CUSTOM_TOKENIZERS + environment variable to a truthy value to run them. + """ + return unittest.skipUnless(_run_custom_tokenizers, "test of custom tokenizers")(test_case) + + +def require_bs4(test_case): + """ + Decorator marking a test that requires BeautifulSoup4. These tests are skipped when BeautifulSoup4 isn't installed. + """ + return unittest.skipUnless(is_bs4_available(), "test requires BeautifulSoup4")(test_case) + + +def require_galore_torch(test_case): + """ + Decorator marking a test that requires GaLore. These tests are skipped when GaLore isn't installed. + https://github.com/jiaweizzhao/GaLore + """ + return unittest.skipUnless(is_galore_torch_available(), "test requires GaLore")(test_case) + + +def require_apollo_torch(test_case): + """ + Decorator marking a test that requires GaLore. These tests are skipped when APOLLO isn't installed. + https://github.com/zhuhanqing/APOLLO + """ + return unittest.skipUnless(is_apollo_torch_available(), "test requires APOLLO")(test_case) + + +def require_torch_optimi(test_case): + """ + Decorator marking a test that requires torch-optimi. These tests are skipped when torch-optimi isn't installed. + https://github.com/jxnl/torch-optimi + """ + return unittest.skipUnless(is_torch_optimi_available(), "test requires torch-optimi")(test_case) + + +def require_lomo(test_case): + """ + Decorator marking a test that requires LOMO. These tests are skipped when LOMO-optim isn't installed. + https://github.com/OpenLMLab/LOMO + """ + return unittest.skipUnless(is_lomo_available(), "test requires LOMO")(test_case) + + +def require_grokadamw(test_case): + """ + Decorator marking a test that requires GrokAdamW. These tests are skipped when GrokAdamW isn't installed. + """ + return unittest.skipUnless(is_grokadamw_available(), "test requires GrokAdamW")(test_case) + + +def require_schedulefree(test_case): + """ + Decorator marking a test that requires schedulefree. These tests are skipped when schedulefree isn't installed. + https://github.com/facebookresearch/schedule_free + """ + return unittest.skipUnless(is_schedulefree_available(), "test requires schedulefree")(test_case) + + +def require_cv2(test_case): + """ + Decorator marking a test that requires OpenCV. + + These tests are skipped when OpenCV isn't installed. + + """ + return unittest.skipUnless(is_cv2_available(), "test requires OpenCV")(test_case) + + +def require_levenshtein(test_case): + """ + Decorator marking a test that requires Levenshtein. + + These tests are skipped when Levenshtein isn't installed. + + """ + return unittest.skipUnless(is_levenshtein_available(), "test requires Levenshtein")(test_case) + + +def require_nltk(test_case): + """ + Decorator marking a test that requires NLTK. + + These tests are skipped when NLTK isn't installed. + + """ + return unittest.skipUnless(is_nltk_available(), "test requires NLTK")(test_case) + + +def require_accelerate(test_case, min_version: str = ACCELERATE_MIN_VERSION): + """ + Decorator marking a test that requires accelerate. These tests are skipped when accelerate isn't installed. + """ + return unittest.skipUnless( + is_accelerate_available(min_version), f"test requires accelerate version >= {min_version}" + )(test_case) + + +def require_triton(min_version: str = TRITON_MIN_VERSION): + """ + Decorator marking a test that requires triton. These tests are skipped when triton isn't installed. + """ + + def decorator(test_case): + return unittest.skipUnless(is_triton_available(min_version), f"test requires triton version >= {min_version}")( + test_case + ) + + return decorator + + +def require_gguf(test_case, min_version: str = GGUF_MIN_VERSION): + """ + Decorator marking a test that requires ggguf. These tests are skipped when gguf isn't installed. + """ + return unittest.skipUnless(is_gguf_available(min_version), f"test requires gguf version >= {min_version}")( + test_case + ) + + +def require_fsdp(test_case, min_version: str = "1.12.0"): + """ + Decorator marking a test that requires fsdp. These tests are skipped when fsdp isn't installed. + """ + return unittest.skipUnless(is_fsdp_available(min_version), f"test requires torch version >= {min_version}")( + test_case + ) + + +def require_g2p_en(test_case): + """ + Decorator marking a test that requires g2p_en. These tests are skipped when SentencePiece isn't installed. + """ + return unittest.skipUnless(is_g2p_en_available(), "test requires g2p_en")(test_case) + + +def require_rjieba(test_case): + """ + Decorator marking a test that requires rjieba. These tests are skipped when rjieba isn't installed. + """ + return unittest.skipUnless(is_rjieba_available(), "test requires rjieba")(test_case) + + +def require_jinja(test_case): + """ + Decorator marking a test that requires jinja. These tests are skipped when jinja isn't installed. + """ + return unittest.skipUnless(is_jinja_available(), "test requires jinja")(test_case) + + +def require_jmespath(test_case): + """ + Decorator marking a test that requires jmespath. These tests are skipped when jmespath isn't installed. + """ + return unittest.skipUnless(is_jmespath_available(), "test requires jmespath")(test_case) + + +def require_onnx(test_case): + return unittest.skipUnless(is_onnx_available(), "test requires ONNX")(test_case) + + +def require_timm(test_case): + """ + Decorator marking a test that requires Timm. + + These tests are skipped when Timm isn't installed. + + """ + return unittest.skipUnless(is_timm_available(), "test requires Timm")(test_case) + + +def require_natten(test_case): + """ + Decorator marking a test that requires NATTEN. + + These tests are skipped when NATTEN isn't installed. + + """ + return unittest.skipUnless(is_natten_available(), "test requires natten")(test_case) + + +def require_torch(test_case): + """ + Decorator marking a test that requires PyTorch. + + These tests are skipped when PyTorch isn't installed. + + """ + return unittest.skipUnless(is_torch_available(), "test requires PyTorch")(test_case) + + +def require_torch_greater_or_equal(version: str): + """ + Decorator marking a test that requires PyTorch version >= `version`. + + These tests are skipped when PyTorch version is less than `version`. + """ + + def decorator(test_case): + return unittest.skipUnless(is_torch_greater_or_equal(version), f"test requires PyTorch version >= {version}")( + test_case + ) + + return decorator + + +def require_huggingface_hub_greater_or_equal(version: str): + """ + Decorator marking a test that requires huggingface_hub version >= `version`. + + These tests are skipped when huggingface_hub version is less than `version`. + """ + + def decorator(test_case): + return unittest.skipUnless( + is_huggingface_hub_greater_or_equal(version), f"test requires huggingface_hub version >= {version}" + )(test_case) + + return decorator + + +def require_flash_attn(test_case): + """ + Decorator marking a test that requires Flash Attention. + + These tests are skipped when Flash Attention isn't installed. + + """ + flash_attn_available = is_flash_attn_2_available() + kernels_available = is_kernels_available() + try: + from kernels import get_kernel + + get_kernel(FLASH_ATTN_KERNEL_FALLBACK["flash_attention_2"]) + except Exception as _: + kernels_available = False + + return unittest.skipUnless(kernels_available | flash_attn_available, "test requires Flash Attention")(test_case) + + +def require_kernels(test_case): + """ + Decorator marking a test that requires the kernels library. + + These tests are skipped when the kernels library isn't installed. + + """ + return unittest.skipUnless(is_kernels_available(), "test requires the kernels library")(test_case) + + +def require_flash_attn_3(test_case): + """ + Decorator marking a test that requires Flash Attention 3. + + These tests are skipped when Flash Attention 3 isn't installed. + """ + return unittest.skipUnless(is_flash_attn_3_available(), "test requires Flash Attention 3")(test_case) + + +def require_peft(test_case): + """ + Decorator marking a test that requires PEFT. + + These tests are skipped when PEFT isn't installed. + + """ + return unittest.skipUnless(is_peft_available(), "test requires PEFT")(test_case) + + +def require_torchvision(test_case): + """ + Decorator marking a test that requires Torchvision. + + These tests are skipped when Torchvision isn't installed. + + """ + return unittest.skipUnless(is_torchvision_available(), "test requires Torchvision")(test_case) + + +def require_torchcodec(test_case): + """ + Decorator marking a test that requires Torchcodec. + + These tests are skipped when Torchcodec isn't installed. + + """ + return unittest.skipUnless(is_torchcodec_available(), "test requires Torchcodec")(test_case) + + +def require_torchaudio(test_case): + """ + Decorator marking a test that requires torchaudio. These tests are skipped when torchaudio isn't installed. + """ + return unittest.skipUnless(is_torchaudio_available(), "test requires torchaudio")(test_case) + + +def require_sentencepiece(test_case): + """ + Decorator marking a test that requires SentencePiece. These tests are skipped when SentencePiece isn't installed. + """ + return unittest.skipUnless(is_sentencepiece_available(), "test requires SentencePiece")(test_case) + + +def require_sacremoses(test_case): + """ + Decorator marking a test that requires Sacremoses. These tests are skipped when Sacremoses isn't installed. + """ + return unittest.skipUnless(is_sacremoses_available(), "test requires Sacremoses")(test_case) + + +def require_seqio(test_case): + """ + Decorator marking a test that requires SentencePiece. These tests are skipped when SentencePiece isn't installed. + """ + return unittest.skipUnless(is_seqio_available(), "test requires Seqio")(test_case) + + +def require_scipy(test_case): + """ + Decorator marking a test that requires Scipy. These tests are skipped when SentencePiece isn't installed. + """ + return unittest.skipUnless(is_scipy_available(), "test requires Scipy")(test_case) + + +def require_tokenizers(test_case): + """ + Decorator marking a test that requires 🤗 Tokenizers. These tests are skipped when 🤗 Tokenizers isn't installed. + """ + return unittest.skipUnless(is_tokenizers_available(), "test requires tokenizers")(test_case) + + +def require_pandas(test_case): + """ + Decorator marking a test that requires pandas. These tests are skipped when pandas isn't installed. + """ + return unittest.skipUnless(is_pandas_available(), "test requires pandas")(test_case) + + +def require_pytesseract(test_case): + """ + Decorator marking a test that requires PyTesseract. These tests are skipped when PyTesseract isn't installed. + """ + return unittest.skipUnless(is_pytesseract_available(), "test requires PyTesseract")(test_case) + + +def require_pytorch_quantization(test_case): + """ + Decorator marking a test that requires PyTorch Quantization Toolkit. These tests are skipped when PyTorch + Quantization Toolkit isn't installed. + """ + return unittest.skipUnless(is_pytorch_quantization_available(), "test requires PyTorch Quantization Toolkit")( + test_case + ) + + +def require_vision(test_case): + """ + Decorator marking a test that requires the vision dependencies. These tests are skipped when torchaudio isn't + installed. + """ + return unittest.skipUnless(is_vision_available(), "test requires vision")(test_case) + + +def require_spacy(test_case): + """ + Decorator marking a test that requires SpaCy. These tests are skipped when SpaCy isn't installed. + """ + return unittest.skipUnless(is_spacy_available(), "test requires spacy")(test_case) + + +def require_torch_multi_gpu(test_case): + """ + Decorator marking a test that requires a multi-GPU CUDA setup (in PyTorch). These tests are skipped on a machine without + multiple CUDA GPUs. + + To run *only* the multi_gpu tests, assuming all test names contain multi_gpu: $ pytest -sv ./tests -k "multi_gpu" + """ + if not is_torch_available(): + return unittest.skip(reason="test requires PyTorch")(test_case) + + import torch + + return unittest.skipUnless(torch.cuda.device_count() > 1, "test requires multiple CUDA GPUs")(test_case) + + +def require_torch_multi_accelerator(test_case): + """ + Decorator marking a test that requires a multi-accelerator (in PyTorch). These tests are skipped on a machine + without multiple accelerators. To run *only* the multi_accelerator tests, assuming all test names contain + multi_accelerator: $ pytest -sv ./tests -k "multi_accelerator" + """ + if not is_torch_available(): + return unittest.skip(reason="test requires PyTorch")(test_case) + + return unittest.skipUnless(backend_device_count(torch_device) > 1, "test requires multiple accelerators")( + test_case + ) + + +def require_torch_non_multi_gpu(test_case): + """ + Decorator marking a test that requires 0 or 1 GPU setup (in PyTorch). + """ + if not is_torch_available(): + return unittest.skip(reason="test requires PyTorch")(test_case) + + import torch + + return unittest.skipUnless(torch.cuda.device_count() < 2, "test requires 0 or 1 GPU")(test_case) + + +def require_torch_non_multi_accelerator(test_case): + """ + Decorator marking a test that requires 0 or 1 accelerator setup (in PyTorch). + """ + if not is_torch_available(): + return unittest.skip(reason="test requires PyTorch")(test_case) + + return unittest.skipUnless(backend_device_count(torch_device) < 2, "test requires 0 or 1 accelerator")(test_case) + + +def require_torch_up_to_2_gpus(test_case): + """ + Decorator marking a test that requires 0 or 1 or 2 GPU setup (in PyTorch). + """ + if not is_torch_available(): + return unittest.skip(reason="test requires PyTorch")(test_case) + + import torch + + return unittest.skipUnless(torch.cuda.device_count() < 3, "test requires 0 or 1 or 2 GPUs")(test_case) + + +def require_torch_up_to_2_accelerators(test_case): + """ + Decorator marking a test that requires 0 or 1 or 2 accelerator setup (in PyTorch). + """ + if not is_torch_available(): + return unittest.skip(reason="test requires PyTorch")(test_case) + + return unittest.skipUnless(backend_device_count(torch_device) < 3, "test requires 0 or 1 or 2 accelerators")( + test_case + ) + + +def require_torch_xla(test_case): + """ + Decorator marking a test that requires TorchXLA (in PyTorch). + """ + return unittest.skipUnless(is_torch_xla_available(), "test requires TorchXLA")(test_case) + + +def require_torch_neuroncore(test_case): + """ + Decorator marking a test that requires NeuronCore (in PyTorch). + """ + return unittest.skipUnless(is_torch_neuroncore_available(check_device=False), "test requires PyTorch NeuronCore")( + test_case + ) + + +def require_torch_npu(test_case): + """ + Decorator marking a test that requires NPU (in PyTorch). + """ + return unittest.skipUnless(is_torch_npu_available(), "test requires PyTorch NPU")(test_case) + + +def require_torch_multi_npu(test_case): + """ + Decorator marking a test that requires a multi-NPU setup (in PyTorch). These tests are skipped on a machine without + multiple NPUs. + + To run *only* the multi_npu tests, assuming all test names contain multi_npu: $ pytest -sv ./tests -k "multi_npu" + """ + if not is_torch_npu_available(): + return unittest.skip(reason="test requires PyTorch NPU")(test_case) + + return unittest.skipUnless(torch.npu.device_count() > 1, "test requires multiple NPUs")(test_case) + + +def require_non_hpu(test_case): + """ + Decorator marking a test that should be skipped for HPU. + """ + return unittest.skipUnless(torch_device != "hpu", "test requires a non-HPU")(test_case) + + +def require_torch_xpu(test_case): + """ + Decorator marking a test that requires XPU (in PyTorch). + + These tests are skipped when XPU backend is not available. + """ + return unittest.skipUnless(is_torch_xpu_available(), "test requires XPU device")(test_case) + + +def require_non_xpu(test_case): + """ + Decorator marking a test that should be skipped for XPU. + """ + return unittest.skipUnless(torch_device != "xpu", "test requires a non-XPU")(test_case) + + +def require_torch_multi_xpu(test_case): + """ + Decorator marking a test that requires a multi-XPU setup (in PyTorch). These tests are skipped on a machine without + multiple XPUs. + + To run *only* the multi_xpu tests, assuming all test names contain multi_xpu: $ pytest -sv ./tests -k "multi_xpu" + """ + if not is_torch_xpu_available(): + return unittest.skip(reason="test requires PyTorch XPU")(test_case) + + return unittest.skipUnless(torch.xpu.device_count() > 1, "test requires multiple XPUs")(test_case) + + +def require_torch_multi_hpu(test_case): + """ + Decorator marking a test that requires a multi-HPU setup (in PyTorch). These tests are skipped on a machine without + multiple HPUs. + + To run *only* the multi_hpu tests, assuming all test names contain multi_hpu: $ pytest -sv ./tests -k "multi_hpu" + """ + if not is_torch_hpu_available(): + return unittest.skip(reason="test requires PyTorch HPU")(test_case) + + return unittest.skipUnless(torch.hpu.device_count() > 1, "test requires multiple HPUs")(test_case) + + +if is_torch_available(): + # Set env var CUDA_VISIBLE_DEVICES="" to force cpu-mode + import torch + + if "TRANSFORMERS_TEST_BACKEND" in os.environ: + backend = os.environ["TRANSFORMERS_TEST_BACKEND"] + try: + _ = importlib.import_module(backend) + except ModuleNotFoundError as e: + raise ModuleNotFoundError( + f"Failed to import `TRANSFORMERS_TEST_BACKEND` '{backend}'! This should be the name of an installed module. The original error (look up to see its" + f" traceback):\n{e}" + ) from e + + if "TRANSFORMERS_TEST_DEVICE" in os.environ: + torch_device = os.environ["TRANSFORMERS_TEST_DEVICE"] + if torch_device == "cuda" and not torch.cuda.is_available(): + raise ValueError( + f"TRANSFORMERS_TEST_DEVICE={torch_device}, but CUDA is unavailable. Please double-check your testing environment." + ) + if torch_device == "xpu" and not is_torch_xpu_available(): + raise ValueError( + f"TRANSFORMERS_TEST_DEVICE={torch_device}, but XPU is unavailable. Please double-check your testing environment." + ) + if torch_device == "npu" and not is_torch_npu_available(): + raise ValueError( + f"TRANSFORMERS_TEST_DEVICE={torch_device}, but NPU is unavailable. Please double-check your testing environment." + ) + if torch_device == "mlu" and not is_torch_mlu_available(): + raise ValueError( + f"TRANSFORMERS_TEST_DEVICE={torch_device}, but MLU is unavailable. Please double-check your testing environment." + ) + if torch_device == "hpu" and not is_torch_hpu_available(): + raise ValueError( + f"TRANSFORMERS_TEST_DEVICE={torch_device}, but HPU is unavailable. Please double-check your testing environment." + ) + + try: + # try creating device to see if provided device is valid + _ = torch.device(torch_device) + except RuntimeError as e: + raise RuntimeError( + f"Unknown testing device specified by environment variable `TRANSFORMERS_TEST_DEVICE`: {torch_device}" + ) from e + elif torch.cuda.is_available(): + torch_device = "cuda" + elif is_torch_npu_available(): + torch_device = "npu" + elif is_torch_mlu_available(): + torch_device = "mlu" + elif is_torch_hpu_available(): + torch_device = "hpu" + elif is_torch_xpu_available(): + torch_device = "xpu" + else: + torch_device = "cpu" +else: + torch_device = None + + +def require_torchao(test_case): + """Decorator marking a test that requires torchao""" + return unittest.skipUnless(is_torchao_available(), "test requires torchao")(test_case) + + +def require_torchao_version_greater_or_equal(torchao_version): + def decorator(test_case): + correct_torchao_version = is_torchao_available() and version.parse( + version.parse(importlib.metadata.version("torchao")).base_version + ) >= version.parse(torchao_version) + return unittest.skipUnless( + correct_torchao_version, f"Test requires torchao with the version greater than {torchao_version}." + )(test_case) + + return decorator + + +def require_torch_tensorrt_fx(test_case): + """Decorator marking a test that requires Torch-TensorRT FX""" + return unittest.skipUnless(is_torch_tensorrt_fx_available(), "test requires Torch-TensorRT FX")(test_case) + + +def require_torch_gpu(test_case): + """Decorator marking a test that requires CUDA and PyTorch.""" + return unittest.skipUnless(torch_device == "cuda", "test requires CUDA")(test_case) + + +def require_torch_mps(test_case): + """Decorator marking a test that requires CUDA and PyTorch.""" + return unittest.skipUnless(torch_device == "mps", "test requires MPS")(test_case) + + +def require_large_cpu_ram(test_case, memory: float = 80): + """Decorator marking a test that requires a CPU RAM with more than `memory` GiB of memory.""" + if not is_psutil_available(): + return test_case + + import psutil + + return unittest.skipUnless( + psutil.virtual_memory().total / 1024**3 > memory, + f"test requires a machine with more than {memory} GiB of CPU RAM memory", + )(test_case) + + +def require_torch_large_gpu(test_case, memory: float = 20): + """Decorator marking a test that requires a CUDA GPU with more than `memory` GiB of memory.""" + if torch_device != "cuda": + return unittest.skip(reason=f"test requires a CUDA GPU with more than {memory} GiB of memory")(test_case) + + return unittest.skipUnless( + torch.cuda.get_device_properties(0).total_memory / 1024**3 > memory, + f"test requires a GPU with more than {memory} GiB of memory", + )(test_case) + + +def require_torch_large_accelerator(test_case=None, *, memory: float = 20): + """Decorator marking a test that requires an accelerator with more than `memory` GiB of memory.""" + + def memory_decorator(tc): + if torch_device not in ("cuda", "xpu"): + return unittest.skip(f"test requires a GPU or XPU with more than {memory} GiB of memory")(tc) + + torch_accel = getattr(torch, torch_device) + return unittest.skipUnless( + torch_accel.get_device_properties(0).total_memory / 1024**3 > memory, + f"test requires a GPU or XPU with more than {memory} GiB of memory", + )(tc) + + return memory_decorator if test_case is None else memory_decorator(test_case) + + +def require_torch_accelerator(test_case): + """Decorator marking a test that requires an accessible accelerator and PyTorch.""" + return unittest.skipUnless(torch_device is not None and torch_device != "cpu", "test requires accelerator")( + test_case + ) + + +def require_torch_fp16(test_case): + """Decorator marking a test that requires a device that supports fp16""" + return unittest.skipUnless( + is_torch_fp16_available_on_device(torch_device), "test requires device with fp16 support" + )(test_case) + + +def require_fp8(test_case): + """Decorator marking a test that requires supports for fp8""" + return unittest.skipUnless(is_accelerate_available() and is_fp8_available(), "test requires fp8 support")( + test_case + ) + + +def require_torch_bf16(test_case): + """Decorator marking a test that requires a device that supports bf16""" + return unittest.skipUnless( + is_torch_bf16_available_on_device(torch_device), "test requires device with bf16 support" + )(test_case) + + +def require_deterministic_for_xpu(test_case): + @wraps(test_case) + def wrapper(*args, **kwargs): + if is_torch_xpu_available(): + original_state = torch.are_deterministic_algorithms_enabled() + try: + torch.use_deterministic_algorithms(True) + return test_case(*args, **kwargs) + finally: + torch.use_deterministic_algorithms(original_state) + else: + return test_case(*args, **kwargs) + + return wrapper + + +def require_torch_tf32(test_case): + """Decorator marking a test that requires Ampere or a newer GPU arch, cuda>=11 and torch>=1.7.""" + return unittest.skipUnless( + is_torch_tf32_available(), "test requires Ampere or a newer GPU arch, cuda>=11 and torch>=1.7" + )(test_case) + + +def require_detectron2(test_case): + """Decorator marking a test that requires detectron2.""" + return unittest.skipUnless(is_detectron2_available(), "test requires `detectron2`")(test_case) + + +def require_faiss(test_case): + """Decorator marking a test that requires faiss.""" + return unittest.skipUnless(is_faiss_available(), "test requires `faiss`")(test_case) + + +def require_optuna(test_case): + """ + Decorator marking a test that requires optuna. + + These tests are skipped when optuna isn't installed. + + """ + return unittest.skipUnless(is_optuna_available(), "test requires optuna")(test_case) + + +def require_ray(test_case): + """ + Decorator marking a test that requires Ray/tune. + + These tests are skipped when Ray/tune isn't installed. + + """ + return unittest.skipUnless(is_ray_available(), "test requires Ray/tune")(test_case) + + +def require_swanlab(test_case): + """ + Decorator marking a test that requires swanlab. + + These tests are skipped when swanlab isn't installed. + + """ + return unittest.skipUnless(is_swanlab_available(), "test requires swanlab")(test_case) + + +def require_trackio(test_case): + """ + Decorator marking a test that requires trackio. + + These tests are skipped when trackio isn't installed. + + """ + return unittest.skipUnless(is_trackio_available(), "test requires trackio")(test_case) + + +def require_wandb(test_case): + """ + Decorator marking a test that requires wandb. + + These tests are skipped when wandb isn't installed. + + """ + return unittest.skipUnless(is_wandb_available(), "test requires wandb")(test_case) + + +def require_clearml(test_case): + """ + Decorator marking a test requires clearml. + + These tests are skipped when clearml isn't installed. + + """ + return unittest.skipUnless(is_clearml_available(), "test requires clearml")(test_case) + + +def require_deepspeed(test_case): + """ + Decorator marking a test that requires deepspeed + """ + return unittest.skipUnless(is_deepspeed_available(), "test requires deepspeed")(test_case) + + +def require_apex(test_case): + """ + Decorator marking a test that requires apex + """ + return unittest.skipUnless(is_apex_available(), "test requires apex")(test_case) + + +def require_aqlm(test_case): + """ + Decorator marking a test that requires aqlm + """ + return unittest.skipUnless(is_aqlm_available(), "test requires aqlm")(test_case) + + +def require_vptq(test_case): + """ + Decorator marking a test that requires vptq + """ + return unittest.skipUnless(is_vptq_available(), "test requires vptq")(test_case) + + +def require_spqr(test_case): + """ + Decorator marking a test that requires spqr + """ + return unittest.skipUnless(is_spqr_available(), "test requires spqr")(test_case) + + +def require_av(test_case): + """ + Decorator marking a test that requires av + """ + return unittest.skipUnless(is_av_available(), "test requires av")(test_case) + + +def require_decord(test_case): + """ + Decorator marking a test that requires decord + """ + return unittest.skipUnless(is_decord_available(), "test requires decord")(test_case) + + +def require_bitsandbytes(test_case): + """ + Decorator marking a test that requires the bitsandbytes library. Will be skipped when the library or its hard dependency torch is not installed. + """ + return unittest.skipUnless(is_bitsandbytes_available(), "test requires bitsandbytes")(test_case) + + +def require_optimum(test_case): + """ + Decorator for optimum dependency + """ + return unittest.skipUnless(is_optimum_available(), "test requires optimum")(test_case) + + +def require_tensorboard(test_case): + """ + Decorator for `tensorboard` dependency + """ + return unittest.skipUnless(is_tensorboard_available(), "test requires tensorboard") + + +def require_gptqmodel(test_case): + """ + Decorator for gptqmodel dependency + """ + return unittest.skipUnless(is_gptqmodel_available(), "test requires gptqmodel")(test_case) + + +def require_hqq(test_case): + """ + Decorator for hqq dependency + """ + return unittest.skipUnless(is_hqq_available(), "test requires hqq")(test_case) + + +def require_auto_round(test_case): + """ + Decorator for auto_round dependency + """ + return unittest.skipUnless(is_auto_round_available(), "test requires autoround")(test_case) + + +def require_optimum_quanto(test_case): + """ + Decorator for quanto dependency + """ + return unittest.skipUnless(is_optimum_quanto_available(), "test requires optimum-quanto")(test_case) + + +def require_compressed_tensors(test_case): + """ + Decorator for compressed_tensors dependency + """ + return unittest.skipUnless(is_compressed_tensors_available(), "test requires compressed_tensors")(test_case) + + +def require_fbgemm_gpu(test_case): + """ + Decorator for fbgemm_gpu dependency + """ + return unittest.skipUnless(is_fbgemm_gpu_available(), "test requires fbgemm-gpu")(test_case) + + +def require_quark(test_case): + """ + Decorator for quark dependency + """ + return unittest.skipUnless(is_quark_available(), "test requires quark")(test_case) + + +def require_flute_hadamard(test_case): + """ + Decorator marking a test that requires higgs and hadamard + """ + return unittest.skipUnless( + is_flute_available() and is_hadamard_available(), "test requires flute and fast_hadamard_transform" + )(test_case) + + +def require_fp_quant(test_case): + """ + Decorator marking a test that requires fp_quant and qutlass + """ + return unittest.skipUnless(is_fp_quant_available(), "test requires fp_quant")(test_case) + + +def require_qutlass(test_case): + """ + Decorator marking a test that requires qutlass + """ + return unittest.skipUnless(is_qutlass_available(), "test requires qutlass")(test_case) + + +def require_phonemizer(test_case): + """ + Decorator marking a test that requires phonemizer + """ + return unittest.skipUnless(is_phonemizer_available(), "test requires phonemizer")(test_case) + + +def require_pyctcdecode(test_case): + """ + Decorator marking a test that requires pyctcdecode + """ + return unittest.skipUnless(is_pyctcdecode_available(), "test requires pyctcdecode")(test_case) + + +def require_numba(test_case): + """ + Decorator marking a test that requires numba + """ + return unittest.skipUnless(is_numba_available(), "test requires numba")(test_case) + + +def require_librosa(test_case): + """ + Decorator marking a test that requires librosa + """ + return unittest.skipUnless(is_librosa_available(), "test requires librosa")(test_case) + + +def require_liger_kernel(test_case): + """ + Decorator marking a test that requires liger_kernel + """ + return unittest.skipUnless(is_liger_kernel_available(), "test requires liger_kernel")(test_case) + + +def require_essentia(test_case): + """ + Decorator marking a test that requires essentia + """ + return unittest.skipUnless(is_essentia_available(), "test requires essentia")(test_case) + + +def require_pretty_midi(test_case): + """ + Decorator marking a test that requires pretty_midi + """ + return unittest.skipUnless(is_pretty_midi_available(), "test requires pretty_midi")(test_case) + + +def cmd_exists(cmd): + return shutil.which(cmd) is not None + + +def require_usr_bin_time(test_case): + """ + Decorator marking a test that requires `/usr/bin/time` + """ + return unittest.skipUnless(cmd_exists("/usr/bin/time"), "test requires /usr/bin/time")(test_case) + + +def require_sudachi(test_case): + """ + Decorator marking a test that requires sudachi + """ + return unittest.skipUnless(is_sudachi_available(), "test requires sudachi")(test_case) + + +def require_sudachi_projection(test_case): + """ + Decorator marking a test that requires sudachi_projection + """ + return unittest.skipUnless(is_sudachi_projection_available(), "test requires sudachi which supports projection")( + test_case + ) + + +def require_jumanpp(test_case): + """ + Decorator marking a test that requires jumanpp + """ + return unittest.skipUnless(is_jumanpp_available(), "test requires jumanpp")(test_case) + + +def require_cython(test_case): + """ + Decorator marking a test that requires jumanpp + """ + return unittest.skipUnless(is_cython_available(), "test requires cython")(test_case) + + +def require_tiktoken(test_case): + """ + Decorator marking a test that requires TikToken. These tests are skipped when TikToken isn't installed. + """ + return unittest.skipUnless(is_tiktoken_available(), "test requires TikToken")(test_case) + + +def require_speech(test_case): + """ + Decorator marking a test that requires speech. These tests are skipped when speech isn't available. + """ + return unittest.skipUnless(is_speech_available(), "test requires torchaudio")(test_case) + + +def require_openai(test_case): + """ + Decorator marking a test that requires openai + """ + return unittest.skipUnless(is_openai_available(), "test requires openai")(test_case) + + +def require_mistral_common(test_case): + """ + Decorator marking a test that requires mistral-common. These tests are skipped when mistral-common isn't available. + """ + return unittest.skipUnless(is_mistral_common_available(), "test requires mistral-common")(test_case) + + +def get_gpu_count(): + """ + Return the number of available gpus + """ + if is_torch_available(): + import torch + + return torch.cuda.device_count() + else: + return 0 + + +def get_tests_dir(append_path=None): + """ + Args: + append_path: optional path to append to the tests dir path + + Return: + The full path to the `tests` dir, so that the tests can be invoked from anywhere. Optionally `append_path` is + joined after the `tests` dir the former is provided. + + """ + # this function caller's __file__ + caller__file__ = inspect.stack()[1][1] + tests_dir = os.path.abspath(os.path.dirname(caller__file__)) + + while not tests_dir.endswith("tests"): + tests_dir = os.path.dirname(tests_dir) + + if append_path: + return os.path.join(tests_dir, append_path) + else: + return tests_dir + + +def get_steps_per_epoch(trainer: Trainer) -> int: + training_args = trainer.args + train_dataloader = trainer.get_train_dataloader() + + initial_training_values = trainer.set_initial_training_values( + args=training_args, + dataloader=train_dataloader, + total_train_batch_size=training_args.per_device_train_batch_size, + ) + steps_per_epoch = initial_training_values[1] + + return steps_per_epoch + + +def evaluate_side_effect_factory( + side_effect_values: list[dict[str, float]], +) -> Generator[dict[str, float], None, None]: + """ + Function that returns side effects for the _evaluate method. + Used when we're unsure of exactly how many times _evaluate will be called. + """ + yield from side_effect_values + + while True: + yield side_effect_values[-1] + + +# +# Helper functions for dealing with testing text outputs +# The original code came from: +# https://github.com/fastai/fastai/blob/master/tests/utils/text.py + + +# When any function contains print() calls that get overwritten, like progress bars, +# a special care needs to be applied, since under pytest -s captured output (capsys +# or contextlib.redirect_stdout) contains any temporary printed strings, followed by +# \r's. This helper function ensures that the buffer will contain the same output +# with and without -s in pytest, by turning: +# foo bar\r tar mar\r final message +# into: +# final message +# it can handle a single string or a multiline buffer +def apply_print_resets(buf): + return re.sub(r"^.*\r", "", buf, 0, re.MULTILINE) + + +def assert_screenout(out, what): + out_pr = apply_print_resets(out).lower() + match_str = out_pr.find(what.lower()) + assert match_str != -1, f"expecting to find {what} in output: f{out_pr}" + + +def set_config_for_less_flaky_test(config): + target_attrs = [ + "rms_norm_eps", + "layer_norm_eps", + "norm_eps", + "norm_epsilon", + "layer_norm_epsilon", + "batch_norm_eps", + ] + for target_attr in target_attrs: + setattr(config, target_attr, 1.0) + + # norm layers (layer/group norm, etc.) could cause flaky tests when the tensors have very small variance. + # (We don't need the original epsilon values to check eager/sdpa matches) + attrs = ["text_config", "vision_config", "text_encoder", "audio_encoder", "decoder"] + for attr in attrs: + if hasattr(config, attr): + for target_attr in target_attrs: + setattr(getattr(config, attr), target_attr, 1.0) + + +def set_model_for_less_flaky_test(model): + # Another way to make sure norm layers have desired epsilon. (Some models don't set it from its config.) + target_names = ( + "LayerNorm", + "GroupNorm", + "BatchNorm", + "RMSNorm", + "BatchNorm2d", + "BatchNorm1d", + "BitGroupNormActivation", + "WeightStandardizedConv2d", + ) + target_attrs = ["eps", "epsilon", "variance_epsilon"] + if is_torch_available() and isinstance(model, torch.nn.Module): + for module in model.modules(): + if type(module).__name__.endswith(target_names): + for attr in target_attrs: + if hasattr(module, attr): + setattr(module, attr, 1.0) + + +class CaptureStd: + """ + Context manager to capture: + + - stdout: replay it, clean it up and make it available via `obj.out` + - stderr: replay it and make it available via `obj.err` + + Args: + out (`bool`, *optional*, defaults to `True`): Whether to capture stdout or not. + err (`bool`, *optional*, defaults to `True`): Whether to capture stderr or not. + replay (`bool`, *optional*, defaults to `True`): Whether to replay or not. + By default each captured stream gets replayed back on context's exit, so that one can see what the test was + doing. If this is a not wanted behavior and the captured data shouldn't be replayed, pass `replay=False` to + disable this feature. + + Examples: + + ```python + # to capture stdout only with auto-replay + with CaptureStdout() as cs: + print("Secret message") + assert "message" in cs.out + + # to capture stderr only with auto-replay + import sys + + with CaptureStderr() as cs: + print("Warning: ", file=sys.stderr) + assert "Warning" in cs.err + + # to capture both streams with auto-replay + with CaptureStd() as cs: + print("Secret message") + print("Warning: ", file=sys.stderr) + assert "message" in cs.out + assert "Warning" in cs.err + + # to capture just one of the streams, and not the other, with auto-replay + with CaptureStd(err=False) as cs: + print("Secret message") + assert "message" in cs.out + # but best use the stream-specific subclasses + + # to capture without auto-replay + with CaptureStd(replay=False) as cs: + print("Secret message") + assert "message" in cs.out + ```""" + + def __init__(self, out=True, err=True, replay=True): + self.replay = replay + + if out: + self.out_buf = StringIO() + self.out = "error: CaptureStd context is unfinished yet, called too early" + else: + self.out_buf = None + self.out = "not capturing stdout" + + if err: + self.err_buf = StringIO() + self.err = "error: CaptureStd context is unfinished yet, called too early" + else: + self.err_buf = None + self.err = "not capturing stderr" + + def __enter__(self): + if self.out_buf: + self.out_old = sys.stdout + sys.stdout = self.out_buf + + if self.err_buf: + self.err_old = sys.stderr + sys.stderr = self.err_buf + + return self + + def __exit__(self, *exc): + if self.out_buf: + sys.stdout = self.out_old + captured = self.out_buf.getvalue() + if self.replay: + sys.stdout.write(captured) + self.out = apply_print_resets(captured) + + if self.err_buf: + sys.stderr = self.err_old + captured = self.err_buf.getvalue() + if self.replay: + sys.stderr.write(captured) + self.err = captured + + def __repr__(self): + msg = "" + if self.out_buf: + msg += f"stdout: {self.out}\n" + if self.err_buf: + msg += f"stderr: {self.err}\n" + return msg + + +# in tests it's the best to capture only the stream that's wanted, otherwise +# it's easy to miss things, so unless you need to capture both streams, use the +# subclasses below (less typing). Or alternatively, configure `CaptureStd` to +# disable the stream you don't need to test. + + +class CaptureStdout(CaptureStd): + """Same as CaptureStd but captures only stdout""" + + def __init__(self, replay=True): + super().__init__(err=False, replay=replay) + + +class CaptureStderr(CaptureStd): + """Same as CaptureStd but captures only stderr""" + + def __init__(self, replay=True): + super().__init__(out=False, replay=replay) + + +class CaptureLogger: + """ + Context manager to capture `logging` streams + + Args: + logger: 'logging` logger object + + Returns: + The captured output is available via `self.out` + + Example: + + ```python + >>> from transformers import logging + >>> from transformers.testing_utils import CaptureLogger + + >>> msg = "Testing 1, 2, 3" + >>> logging.set_verbosity_info() + >>> logger = logging.get_logger("transformers.models.bart.tokenization_bart") + >>> with CaptureLogger(logger) as cl: + ... logger.info(msg) + >>> assert cl.out, msg + "\n" + ``` + """ + + def __init__(self, logger): + self.logger = logger + self.io = StringIO() + self.sh = logging.StreamHandler(self.io) + self.out = "" + + def __enter__(self): + self.logger.addHandler(self.sh) + return self + + def __exit__(self, *exc): + self.logger.removeHandler(self.sh) + self.out = self.io.getvalue() + + def __repr__(self): + return f"captured: {self.out}\n" + + +@contextlib.contextmanager +def LoggingLevel(level): + """ + This is a context manager to temporarily change transformers modules logging level to the desired value and have it + restored to the original setting at the end of the scope. + + Example: + + ```python + with LoggingLevel(logging.INFO): + AutoModel.from_pretrained("openai-community/gpt2") # calls logger.info() several times + ``` + """ + orig_level = transformers_logging.get_verbosity() + try: + transformers_logging.set_verbosity(level) + yield + finally: + transformers_logging.set_verbosity(orig_level) + + +class TemporaryHubRepo: + """Create a temporary Hub repository and return its `RepoUrl` object. This is similar to + `tempfile.TemporaryDirectory` and can be used as a context manager. For example: + + with TemporaryHubRepo(token=self._token) as temp_repo: + ... + + Upon exiting the context, the repository and everything contained in it are removed. + + Example: + + ```python + with TemporaryHubRepo(token=self._token) as temp_repo: + model.push_to_hub(tmp_repo.repo_id, token=self._token) + ``` + """ + + def __init__(self, namespace: str | None = None, token: str | None = None) -> None: + self.token = token + with tempfile.TemporaryDirectory() as tmp_dir: + repo_id = Path(tmp_dir).name + if namespace is not None: + repo_id = f"{namespace}/{repo_id}" + self.repo_url = create_repo(repo_id, token=self.token) + + def __enter__(self): + return self.repo_url + + def __exit__(self, exc, value, tb): + delete_repo(repo_id=self.repo_url.repo_id, token=self.token, missing_ok=True) + + +@contextlib.contextmanager +# adapted from https://stackoverflow.com/a/64789046/9201239 +def ExtendSysPath(path: str | os.PathLike) -> Iterator[None]: + """ + Temporary add given path to `sys.path`. + + Usage : + + ```python + with ExtendSysPath("/path/to/dir"): + mymodule = importlib.import_module("mymodule") + ``` + """ + + path = os.fspath(path) + try: + sys.path.insert(0, path) + yield + finally: + sys.path.remove(path) + + +class TestCasePlus(unittest.TestCase): + """ + This class extends *unittest.TestCase* with additional features. + + Feature 1: A set of fully resolved important file and dir path accessors. + + In tests often we need to know where things are relative to the current test file, and it's not trivial since the + test could be invoked from more than one directory or could reside in sub-directories with different depths. This + class solves this problem by sorting out all the basic paths and provides easy accessors to them: + + - `pathlib` objects (all fully resolved): + + - `test_file_path` - the current test file path (=`__file__`) + - `test_file_dir` - the directory containing the current test file + - `tests_dir` - the directory of the `tests` test suite + - `examples_dir` - the directory of the `examples` test suite + - `repo_root_dir` - the directory of the repository + - `src_dir` - the directory of `src` (i.e. where the `transformers` sub-dir resides) + + - stringified paths---same as above but these return paths as strings, rather than `pathlib` objects: + + - `test_file_path_str` + - `test_file_dir_str` + - `tests_dir_str` + - `examples_dir_str` + - `repo_root_dir_str` + - `src_dir_str` + + Feature 2: Flexible auto-removable temporary dirs which are guaranteed to get removed at the end of test. + + 1. Create a unique temporary dir: + + ```python + def test_whatever(self): + tmp_dir = self.get_auto_remove_tmp_dir() + ``` + + `tmp_dir` will contain the path to the created temporary dir. It will be automatically removed at the end of the + test. + + + 2. Create a temporary dir of my choice, ensure it's empty before the test starts and don't + empty it after the test. + + ```python + def test_whatever(self): + tmp_dir = self.get_auto_remove_tmp_dir("./xxx") + ``` + + This is useful for debug when you want to monitor a specific directory and want to make sure the previous tests + didn't leave any data in there. + + 3. You can override the first two options by directly overriding the `before` and `after` args, leading to the + following behavior: + + `before=True`: the temporary dir will always be cleared at the beginning of the test. + + `before=False`: if the temporary dir already existed, any existing files will remain there. + + `after=True`: the temporary dir will always be deleted at the end of the test. + + `after=False`: the temporary dir will always be left intact at the end of the test. + + Note 1: In order to run the equivalent of `rm -r` safely, only subdirs of the project repository checkout are + allowed if an explicit `tmp_dir` is used, so that by mistake no `/tmp` or similar important part of the filesystem + will get nuked. i.e. please always pass paths that start with `./` + + Note 2: Each test can register multiple temporary dirs and they all will get auto-removed, unless requested + otherwise. + + Feature 3: Get a copy of the `os.environ` object that sets up `PYTHONPATH` specific to the current test suite. This + is useful for invoking external programs from the test suite - e.g. distributed training. + + + ```python + def test_whatever(self): + env = self.get_env() + ```""" + + def setUp(self): + # get_auto_remove_tmp_dir feature: + self.teardown_tmp_dirs = [] + + # figure out the resolved paths for repo_root, tests, examples, etc. + self._test_file_path = inspect.getfile(self.__class__) + path = Path(self._test_file_path).resolve() + self._test_file_dir = path.parents[0] + for up in [1, 2, 3]: + tmp_dir = path.parents[up] + if (tmp_dir / "src").is_dir() and (tmp_dir / "tests").is_dir(): + break + if tmp_dir: + self._repo_root_dir = tmp_dir + else: + raise ValueError(f"can't figure out the root of the repo from {self._test_file_path}") + self._tests_dir = self._repo_root_dir / "tests" + self._examples_dir = self._repo_root_dir / "examples" + self._src_dir = self._repo_root_dir / "src" + + @property + def test_file_path(self): + return self._test_file_path + + @property + def test_file_path_str(self): + return str(self._test_file_path) + + @property + def test_file_dir(self): + return self._test_file_dir + + @property + def test_file_dir_str(self): + return str(self._test_file_dir) + + @property + def tests_dir(self): + return self._tests_dir + + @property + def tests_dir_str(self): + return str(self._tests_dir) + + @property + def examples_dir(self): + return self._examples_dir + + @property + def examples_dir_str(self): + return str(self._examples_dir) + + @property + def repo_root_dir(self): + return self._repo_root_dir + + @property + def repo_root_dir_str(self): + return str(self._repo_root_dir) + + @property + def src_dir(self): + return self._src_dir + + @property + def src_dir_str(self): + return str(self._src_dir) + + def get_env(self): + """ + Return a copy of the `os.environ` object that sets up `PYTHONPATH` correctly, depending on the test suite it's + invoked from. This is useful for invoking external programs from the test suite - e.g. distributed training. + + It always inserts `./src` first, then `./tests` or `./examples` depending on the test suite type and finally + the preset `PYTHONPATH` if any (all full resolved paths). + + """ + env = os.environ.copy() + paths = [self.repo_root_dir_str, self.src_dir_str] + if "/examples" in self.test_file_dir_str: + paths.append(self.examples_dir_str) + paths.append(env.get("PYTHONPATH", "")) + + env["PYTHONPATH"] = ":".join(paths) + return env + + def get_auto_remove_tmp_dir(self, tmp_dir=None, before=None, after=None, return_pathlib_obj=False): + """ + Args: + tmp_dir (`string`, *optional*): + if `None`: + + - a unique temporary path will be created + - sets `before=True` if `before` is `None` + - sets `after=True` if `after` is `None` + else: + + - `tmp_dir` will be created + - sets `before=True` if `before` is `None` + - sets `after=False` if `after` is `None` + before (`bool`, *optional*): + If `True` and the `tmp_dir` already exists, make sure to empty it right away if `False` and the + `tmp_dir` already exists, any existing files will remain there. + after (`bool`, *optional*): + If `True`, delete the `tmp_dir` at the end of the test if `False`, leave the `tmp_dir` and its contents + intact at the end of the test. + return_pathlib_obj (`bool`, *optional*): + If `True` will return a pathlib.Path object + + Returns: + tmp_dir(`string`): either the same value as passed via *tmp_dir* or the path to the auto-selected tmp dir + """ + if tmp_dir is not None: + # defining the most likely desired behavior for when a custom path is provided. + # this most likely indicates the debug mode where we want an easily locatable dir that: + # 1. gets cleared out before the test (if it already exists) + # 2. is left intact after the test + if before is None: + before = True + if after is None: + after = False + + # using provided path + path = Path(tmp_dir).resolve() + + # to avoid nuking parts of the filesystem, only relative paths are allowed + if not tmp_dir.startswith("./"): + raise ValueError( + f"`tmp_dir` can only be a relative path, i.e. `./some/path`, but received `{tmp_dir}`" + ) + + # ensure the dir is empty to start with + if before is True and path.exists(): + shutil.rmtree(tmp_dir, ignore_errors=True) + + path.mkdir(parents=True, exist_ok=True) + + else: + # defining the most likely desired behavior for when a unique tmp path is auto generated + # (not a debug mode), here we require a unique tmp dir that: + # 1. is empty before the test (it will be empty in this situation anyway) + # 2. gets fully removed after the test + if before is None: + before = True + if after is None: + after = True + + # using unique tmp dir (always empty, regardless of `before`) + tmp_dir = tempfile.mkdtemp() + + if after is True: + # register for deletion + self.teardown_tmp_dirs.append(tmp_dir) + + return Path(tmp_dir).resolve() if return_pathlib_obj else tmp_dir + + def python_one_liner_max_rss(self, one_liner_str): + """ + Runs the passed python one liner (just the code) and returns how much max cpu memory was used to run the + program. + + Args: + one_liner_str (`string`): + a python one liner code that gets passed to `python -c` + + Returns: + max cpu memory bytes used to run the program. This value is likely to vary slightly from run to run. + + Requirements: + this helper needs `/usr/bin/time` to be installed (`apt install time`) + + Example: + + ``` + one_liner_str = 'from transformers import AutoModel; AutoModel.from_pretrained("google-t5/t5-large")' + max_rss = self.python_one_liner_max_rss(one_liner_str) + ``` + """ + + if not cmd_exists("/usr/bin/time"): + raise ValueError("/usr/bin/time is required, install with `apt install time`") + + cmd = shlex.split(f"/usr/bin/time -f %M python -c '{one_liner_str}'") + with CaptureStd() as cs: + execute_subprocess_async(cmd, env=self.get_env()) + # returned data is in KB so convert to bytes + max_rss = int(cs.err.split("\n")[-2].replace("stderr: ", "")) * 1024 + return max_rss + + def tearDown(self): + # get_auto_remove_tmp_dir feature: remove registered temp dirs + for path in self.teardown_tmp_dirs: + shutil.rmtree(path, ignore_errors=True) + self.teardown_tmp_dirs = [] + if is_accelerate_available(): + AcceleratorState._reset_state() + PartialState._reset_state() + + # delete all the env variables having `ACCELERATE` in them + for k in list(os.environ.keys()): + if "ACCELERATE" in k: + del os.environ[k] + + +def mockenv(**kwargs): + """ + this is a convenience wrapper, that allows this :: + + @mockenv(RUN_SLOW=True, USE_TF=False) def test_something(): + run_slow = os.getenv("RUN_SLOW", False) use_tf = os.getenv("USE_TF", False) + + """ + return mock.patch.dict(os.environ, kwargs) + + +# from https://stackoverflow.com/a/34333710/9201239 +@contextlib.contextmanager +def mockenv_context(*remove, **update): + """ + Temporarily updates the `os.environ` dictionary in-place. Similar to mockenv + + The `os.environ` dictionary is updated in-place so that the modification is sure to work in all situations. + + Args: + remove: Environment variables to remove. + update: Dictionary of environment variables and values to add/update. + """ + env = os.environ + update = update or {} + remove = remove or [] + + # List of environment variables being updated or removed. + stomped = (set(update.keys()) | set(remove)) & set(env.keys()) + # Environment variables and values to restore on exit. + update_after = {k: env[k] for k in stomped} + # Environment variables and values to remove on exit. + remove_after = frozenset(k for k in update if k not in env) + + try: + env.update(update) + [env.pop(k, None) for k in remove] + yield + finally: + env.update(update_after) + [env.pop(k) for k in remove_after] + + +# --- pytest conf functions --- # + +# to avoid multiple invocation from tests/conftest.py and examples/conftest.py - make sure it's called only once +pytest_opt_registered = {} + + +def pytest_addoption_shared(parser): + """ + This function is to be called from `conftest.py` via `pytest_addoption` wrapper that has to be defined there. + + It allows loading both `conftest.py` files at once without causing a failure due to adding the same `pytest` + option. + + """ + option = "--make-reports" + if option not in pytest_opt_registered: + parser.addoption( + option, + action="store", + default=False, + help="generate report files. The value of this option is used as a prefix to report names", + ) + pytest_opt_registered[option] = 1 + + +def pytest_terminal_summary_main(tr, id): + """ + Generate multiple reports at the end of test suite run - each report goes into a dedicated file in the current + directory. The report files are prefixed with the test suite name. + + This function emulates --duration and -rA pytest arguments. + + This function is to be called from `conftest.py` via `pytest_terminal_summary` wrapper that has to be defined + there. + + Args: + - tr: `terminalreporter` passed from `conftest.py` + - id: unique id like `tests` or `examples` that will be incorporated into the final reports filenames - this is + needed as some jobs have multiple runs of pytest, so we can't have them overwrite each other. + + NB: this functions taps into a private _pytest API and while unlikely, it could break should pytest do internal + changes - also it calls default internal methods of terminalreporter which can be hijacked by various `pytest-` + plugins and interfere. + + """ + from _pytest.config import create_terminal_writer + + if not len(id): + id = "tests" + + config = tr.config + orig_writer = config.get_terminal_writer() + orig_tbstyle = config.option.tbstyle + orig_reportchars = tr.reportchars + + dir = f"reports/{id}" + Path(dir).mkdir(parents=True, exist_ok=True) + report_files = { + k: f"{dir}/{k}.txt" + for k in [ + "durations", + "errors", + "failures_long", + "failures_short", + "failures_line", + "passes", + "stats", + "summary_short", + "warnings", + ] + } + + # custom durations report + # note: there is no need to call pytest --durations=XX to get this separate report + # adapted from https://github.com/pytest-dev/pytest/blob/897f151e/src/_pytest/runner.py#L66 + dlist = [] + for replist in tr.stats.values(): + for rep in replist: + if hasattr(rep, "duration"): + dlist.append(rep) + if dlist: + dlist.sort(key=lambda x: x.duration, reverse=True) + with open(report_files["durations"], "w") as f: + durations_min = 0.05 # sec + f.write("slowest durations\n") + for i, rep in enumerate(dlist): + if rep.duration < durations_min: + f.write(f"{len(dlist) - i} durations < {durations_min} secs were omitted") + break + f.write(f"{rep.duration:02.2f}s {rep.when:<8} {rep.nodeid}\n") + + def summary_failures_short(tr): + # expecting that the reports were --tb=long (default) so we chop them off here to the last frame + reports = tr.getreports("failed") + if not reports: + return + tr.write_sep("=", "FAILURES SHORT STACK") + for rep in reports: + msg = tr._getfailureheadline(rep) + tr.write_sep("_", msg, red=True, bold=True) + # chop off the optional leading extra frames, leaving only the last one + longrepr = re.sub(r".*_ _ _ (_ ){10,}_ _ ", "", rep.longreprtext, 0, re.MULTILINE | re.DOTALL) + tr._tw.line(longrepr) + # note: not printing out any rep.sections to keep the report short + + # use ready-made report funcs, we are just hijacking the filehandle to log to a dedicated file each + # adapted from https://github.com/pytest-dev/pytest/blob/897f151e/src/_pytest/terminal.py#L814 + # note: some pytest plugins may interfere by hijacking the default `terminalreporter` (e.g. + # pytest-instafail does that) + + # report failures with line/short/long styles + config.option.tbstyle = "auto" # full tb + with open(report_files["failures_long"], "w") as f: + tr._tw = create_terminal_writer(config, f) + tr.summary_failures() + + # config.option.tbstyle = "short" # short tb + with open(report_files["failures_short"], "w") as f: + tr._tw = create_terminal_writer(config, f) + summary_failures_short(tr) + + config.option.tbstyle = "line" # one line per error + with open(report_files["failures_line"], "w") as f: + tr._tw = create_terminal_writer(config, f) + tr.summary_failures() + + with open(report_files["errors"], "w") as f: + tr._tw = create_terminal_writer(config, f) + tr.summary_errors() + + with open(report_files["warnings"], "w") as f: + tr._tw = create_terminal_writer(config, f) + tr.summary_warnings() # normal warnings + tr.summary_warnings() # final warnings + + tr.reportchars = "wPpsxXEf" # emulate -rA (used in summary_passes() and short_test_summary()) + + # Skip the `passes` report, as it starts to take more than 5 minutes, and sometimes it timeouts on CircleCI if it + # takes > 10 minutes (as this part doesn't generate any output on the terminal). + # (also, it seems there is no useful information in this report, and we rarely need to read it) + # with open(report_files["passes"], "w") as f: + # tr._tw = create_terminal_writer(config, f) + # tr.summary_passes() + + with open(report_files["summary_short"], "w") as f: + tr._tw = create_terminal_writer(config, f) + tr.short_test_summary() + + with open(report_files["stats"], "w") as f: + tr._tw = create_terminal_writer(config, f) + tr.summary_stats() + + # restore: + tr._tw = orig_writer + tr.reportchars = orig_reportchars + config.option.tbstyle = orig_tbstyle + + +# --- distributed testing functions --- # + +# adapted from https://stackoverflow.com/a/59041913/9201239 +import asyncio # noqa + + +class _RunOutput: + def __init__(self, returncode, stdout, stderr): + self.returncode = returncode + self.stdout = stdout + self.stderr = stderr + + +async def _read_stream(stream, callback): + while True: + line = await stream.readline() + if line: + callback(line) + else: + break + + +async def _stream_subprocess(cmd, env=None, stdin=None, timeout=None, quiet=False, echo=False) -> _RunOutput: + if echo: + print("\nRunning: ", " ".join(cmd)) + + p = await asyncio.create_subprocess_exec( + cmd[0], + *cmd[1:], + stdin=stdin, + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE, + env=env, + ) + + # note: there is a warning for a possible deadlock when using `wait` with huge amounts of data in the pipe + # https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.asyncio.subprocess.Process.wait + # + # If it starts hanging, will need to switch to the following code. The problem is that no data + # will be seen until it's done and if it hangs for example there will be no debug info. + # out, err = await p.communicate() + # return _RunOutput(p.returncode, out, err) + + out = [] + err = [] + + def tee(line, sink, pipe, label=""): + line = line.decode("utf-8").rstrip() + sink.append(line) + if not quiet: + print(label, line, file=pipe) + + # XXX: the timeout doesn't seem to make any difference here + await asyncio.wait( + [ + asyncio.create_task(_read_stream(p.stdout, lambda l: tee(l, out, sys.stdout, label="stdout:"))), + asyncio.create_task(_read_stream(p.stderr, lambda l: tee(l, err, sys.stderr, label="stderr:"))), + ], + timeout=timeout, + ) + return _RunOutput(await p.wait(), out, err) + + +def execute_subprocess_async(cmd, env=None, stdin=None, timeout=180, quiet=False, echo=True) -> _RunOutput: + loop = asyncio.get_event_loop() + result = loop.run_until_complete( + _stream_subprocess(cmd, env=env, stdin=stdin, timeout=timeout, quiet=quiet, echo=echo) + ) + + cmd_str = " ".join(cmd) + if result.returncode > 0: + stderr = "\n".join(result.stderr) + raise RuntimeError( + f"'{cmd_str}' failed with returncode {result.returncode}\n\n" + f"The combined stderr from workers follows:\n{stderr}" + ) + + # check that the subprocess actually did run and produced some output, should the test rely on + # the remote side to do the testing + if not result.stdout and not result.stderr: + raise RuntimeError(f"'{cmd_str}' produced no output.") + + return result + + +def pytest_xdist_worker_id(): + """ + Returns an int value of worker's numerical id under `pytest-xdist`'s concurrent workers `pytest -n N` regime, or 0 + if `-n 1` or `pytest-xdist` isn't being used. + """ + worker = os.environ.get("PYTEST_XDIST_WORKER", "gw0") + worker = re.sub(r"^gw", "", worker, 0, re.MULTILINE) + return int(worker) + + +def get_torch_dist_unique_port(): + """ + Returns a port number that can be fed to `torch.distributed.launch`'s `--master_port` argument. + + Under `pytest-xdist` it adds a delta number based on a worker id so that concurrent tests don't try to use the same + port at once. + """ + port = 29500 + uniq_delta = pytest_xdist_worker_id() + return port + uniq_delta + + +def nested_simplify(obj, decimals=3): + """ + Simplifies an object by rounding float numbers, and downcasting tensors/numpy arrays to get simple equality test + within tests. + """ + import numpy as np + + if isinstance(obj, list): + return [nested_simplify(item, decimals) for item in obj] + if isinstance(obj, tuple): + return tuple(nested_simplify(item, decimals) for item in obj) + elif isinstance(obj, np.ndarray): + return nested_simplify(obj.tolist()) + elif isinstance(obj, Mapping): + return {nested_simplify(k, decimals): nested_simplify(v, decimals) for k, v in obj.items()} + elif isinstance(obj, (str, int, np.int64)) or obj is None: + return obj + elif is_torch_available() and isinstance(obj, torch.Tensor): + return nested_simplify(obj.tolist(), decimals) + elif isinstance(obj, float): + return round(obj, decimals) + elif isinstance(obj, (np.int32, np.float32, np.float16)): + return nested_simplify(obj.item(), decimals) + else: + raise Exception(f"Not supported: {type(obj)}") + + +def check_json_file_has_correct_format(file_path): + with open(file_path) as f: + lines = f.readlines() + if len(lines) == 1: + # length can only be 1 if dict is empty + assert lines[0] == "{}" + else: + # otherwise make sure json has correct format (at least 3 lines) + assert len(lines) >= 3 + # each key one line, ident should be 2, min length is 3 + assert lines[0].strip() == "{" + for line in lines[1:-1]: + left_indent = len(lines[1]) - len(lines[1].lstrip()) + assert left_indent == 2 + assert lines[-1].strip() == "}" + + +def to_2tuple(x): + if isinstance(x, collections.abc.Iterable): + return x + return (x, x) + + +# These utils relate to ensuring the right error message is received when running scripts +class SubprocessCallException(Exception): + pass + + +def run_command(command: list[str], return_stdout=False): + """ + Runs `command` with `subprocess.check_output` and will potentially return the `stdout`. Will also properly capture + if an error occurred while running `command` + """ + try: + output = subprocess.check_output(command, stderr=subprocess.STDOUT) + if return_stdout: + if hasattr(output, "decode"): + output = output.decode("utf-8") + return output + except subprocess.CalledProcessError as e: + raise SubprocessCallException( + f"Command `{' '.join(command)}` failed with the following error:\n\n{e.output.decode()}" + ) from e + + +class RequestCounter: + """ + Helper class that will count all requests made online. + + Might not be robust if urllib3 changes its logging format but should be good enough for us. + + Usage: + ```py + with RequestCounter() as counter: + _ = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-bert") + assert counter["GET"] == 0 + assert counter["HEAD"] == 1 + assert counter.total_calls == 1 + ``` + """ + + def __enter__(self): + self._counter = defaultdict(int) + self._thread_id = threading.get_ident() + self._extra_info = [] + + def patched_with_thread_info(func): + def wrap(*args, **kwargs): + self._extra_info.append(threading.get_ident()) + return func(*args, **kwargs) + + return wrap + + import urllib3 + + self.patcher = patch.object( + urllib3.connectionpool.log, "debug", side_effect=patched_with_thread_info(urllib3.connectionpool.log.debug) + ) + self.mock = self.patcher.start() + return self + + def __exit__(self, *args, **kwargs) -> None: + assert len(self.mock.call_args_list) == len(self._extra_info) + for thread_id, call in zip(self._extra_info, self.mock.call_args_list): + if thread_id != self._thread_id: + continue + # code 307: the URL being requested by the user has moved to a temporary location + if call.args[-2] == 307: + continue + log = call.args[0] % call.args[1:] + for method in ("HEAD", "GET", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"): + if method in log: + self._counter[method] += 1 + break + self.patcher.stop() + + def __getitem__(self, key: str) -> int: + return self._counter[key] + + @property + def total_calls(self) -> int: + return sum(self._counter.values()) + + +def is_flaky(max_attempts: int = 5, wait_before_retry: float | None = None, description: str | None = None): + """ + To decorate flaky tests. They will be retried on failures. + + Please note that our push tests use `pytest-rerunfailures`, which prompts the CI to rerun certain types of + failed tests. More specifically, if the test exception contains any substring in `FLAKY_TEST_FAILURE_PATTERNS` + (in `.circleci/create_circleci_config.py`), it will be rerun. If you find a recurrent pattern of failures, + expand `FLAKY_TEST_FAILURE_PATTERNS` in our CI configuration instead of using `is_flaky`. + + Args: + max_attempts (`int`, *optional*, defaults to 5): + The maximum number of attempts to retry the flaky test. + wait_before_retry (`float`, *optional*): + If provided, will wait that number of seconds before retrying the test. + description (`str`, *optional*): + A string to describe the situation (what / where / why is flaky, link to GH issue/PR comments, errors, + etc.) + """ + + def decorator(test_func_ref): + @functools.wraps(test_func_ref) + def wrapper(*args, **kwargs): + retry_count = 1 + + while retry_count < max_attempts: + try: + return test_func_ref(*args, **kwargs) + + except Exception as err: + logger.error(f"Test failed with {err} at try {retry_count}/{max_attempts}.") + if wait_before_retry is not None: + time.sleep(wait_before_retry) + retry_count += 1 + + return test_func_ref(*args, **kwargs) + + return unittest.skipUnless(_run_flaky_tests, "test is flaky")(wrapper) + + return decorator + + +def hub_retry(max_attempts: int = 5, wait_before_retry: float | None = 2): + """ + To decorate tests that download from the Hub. They can fail due to a + variety of network issues such as timeouts, connection resets, etc. + + Args: + max_attempts (`int`, *optional*, defaults to 5): + The maximum number of attempts to retry the flaky test. + wait_before_retry (`float`, *optional*, defaults to 2): + If provided, will wait that number of seconds before retrying the test. + """ + + def decorator(test_func_ref): + @functools.wraps(test_func_ref) + def wrapper(*args, **kwargs): + retry_count = 1 + + while retry_count < max_attempts: + try: + return test_func_ref(*args, **kwargs) + # We catch all exceptions related to network issues from httpx + except ( + httpx.HTTPError, + httpx.RequestError, + httpx.TimeoutException, + httpx.ReadTimeout, + httpx.ConnectError, + httpx.NetworkError, + ) as err: + logger.error( + f"Test failed with {err} at try {retry_count}/{max_attempts} as it couldn't connect to the specified Hub repository." + ) + if wait_before_retry is not None: + time.sleep(wait_before_retry) + retry_count += 1 + + return test_func_ref(*args, **kwargs) + + return wrapper + + return decorator + + +def run_first(test_case): + """ + Decorator marking a test with order(1). When pytest-order plugin is installed, tests marked with this decorator + are guaranteed to run first. + + This is especially useful in some test settings like on a Gaudi instance where a Gaudi device can only be used by a + single process at a time. So we make sure all tests that run in a subprocess are launched first, to avoid device + allocation conflicts. + """ + # Without this check, we get unwanted warnings when it's not installed + if is_pytest_order_available(): + import pytest + + return pytest.mark.order(1)(test_case) + else: + return test_case + + +def run_test_in_subprocess(test_case, target_func, inputs=None, timeout=None): + """ + To run a test in a subprocess. In particular, this can avoid (GPU) memory issue. + + Args: + test_case (`unittest.TestCase`): + The test that will run `target_func`. + target_func (`Callable`): + The function implementing the actual testing logic. + inputs (`dict`, *optional*, defaults to `None`): + The inputs that will be passed to `target_func` through an (input) queue. + timeout (`int`, *optional*, defaults to `None`): + The timeout (in seconds) that will be passed to the input and output queues. If not specified, the env. + variable `PYTEST_TIMEOUT` will be checked. If still `None`, its value will be set to `600`. + """ + if timeout is None: + timeout = int(os.environ.get("PYTEST_TIMEOUT", "600")) + + start_methohd = "spawn" + ctx = multiprocessing.get_context(start_methohd) + + input_queue = ctx.Queue(1) + output_queue = ctx.JoinableQueue(1) + + # We can't send `unittest.TestCase` to the child, otherwise we get issues regarding pickle. + input_queue.put(inputs, timeout=timeout) + + process = ctx.Process(target=target_func, args=(input_queue, output_queue, timeout)) + process.start() + # Kill the child process if we can't get outputs from it in time: otherwise, the hanging subprocess prevents + # the test to exit properly. + try: + results = output_queue.get(timeout=timeout) + output_queue.task_done() + except Exception as e: + process.terminate() + test_case.fail(e) + process.join(timeout=timeout) + + if results["error"] is not None: + test_case.fail(f"{results['error']}") + + +def run_test_using_subprocess(func): + """ + To decorate a test to run in a subprocess using the `subprocess` module. This could avoid potential GPU memory + issues (GPU OOM or a test that causes many subsequential failing with `CUDA error: device-side assert triggered`). + """ + import pytest + + @functools.wraps(func) + def wrapper(*args, **kwargs): + if os.getenv("_INSIDE_SUB_PROCESS", None) == "1": + func(*args, **kwargs) + else: + test = " ".join(os.environ.get("PYTEST_CURRENT_TEST").split(" ")[:-1]) + try: + env = copy.deepcopy(os.environ) + env["_INSIDE_SUB_PROCESS"] = "1" + # This prevents the entries in `short test summary info` given by the subprocess being truncated. so the + # full information can be passed to the parent pytest process. + # See: https://docs.pytest.org/en/stable/explanation/ci.html + env["CI"] = "true" + + # If not subclass of `unitTest.TestCase` and `pytestconfig` is used: try to grab and use the arguments + if "pytestconfig" in kwargs: + command = list(kwargs["pytestconfig"].invocation_params.args) + for idx, x in enumerate(command): + if x in kwargs["pytestconfig"].args: + test = test.split("::")[1:] + command[idx] = "::".join([f"{func.__globals__['__file__']}"] + test) + command = [f"{sys.executable}", "-m", "pytest"] + command + command = [x for x in command if x != "--no-summary"] + # Otherwise, simply run the test with no option at all + else: + command = [f"{sys.executable}", "-m", "pytest", f"{test}"] + + subprocess.run(command, env=env, check=True, capture_output=True) + except subprocess.CalledProcessError as e: + exception_message = e.stdout.decode() + lines = exception_message.split("\n") + # Add a first line with more informative information instead of just `= test session starts =`. + # This makes the `short test summary info` section more useful. + if "= test session starts =" in lines[0]: + text = "" + for line in lines[1:]: + if line.startswith("FAILED "): + text = line[len("FAILED ") :] + text = "".join(text.split(" - ")[1:]) + elif line.startswith("=") and line.endswith("=") and " failed in " in line: + break + elif len(text) > 0: + text += f"\n{line}" + text = "(subprocess) " + text + lines = [text] + lines + exception_message = "\n".join(lines) + raise pytest.fail(exception_message, pytrace=False) + + return wrapper + + +""" +The following contains utils to run the documentation tests without having to overwrite any files. + +The `preprocess_string` function adds `# doctest: +IGNORE_RESULT` markers on the fly anywhere a `load_dataset` call is +made as a print would otherwise fail the corresponding line. + +To skip cuda tests, make sure to call `SKIP_CUDA_DOCTEST=1 pytest --doctest-modules +""" + + +def preprocess_string(string, skip_cuda_tests): + """Prepare a docstring or a `.md` file to be run by doctest. + + The argument `string` would be the whole file content if it is a `.md` file. For a python file, it would be one of + its docstring. In each case, it may contain multiple python code examples. If `skip_cuda_tests` is `True` and a + cuda stuff is detective (with a heuristic), this method will return an empty string so no doctest will be run for + `string`. + """ + codeblock_pattern = r"(```(?:python|py)\s*\n\s*>>> )(.*?```)" + codeblocks = re.split(codeblock_pattern, string, flags=re.DOTALL) + is_cuda_found = False + for i, codeblock in enumerate(codeblocks): + if "load_dataset(" in codeblock and "# doctest: +IGNORE_RESULT" not in codeblock: + codeblocks[i] = re.sub(r"(>>> .*load_dataset\(.*)", r"\1 # doctest: +IGNORE_RESULT", codeblock) + if ( + (">>>" in codeblock or "..." in codeblock) + and re.search(r"cuda|to\(0\)|device=0", codeblock) + and skip_cuda_tests + ): + is_cuda_found = True + break + + modified_string = "" + if not is_cuda_found: + modified_string = "".join(codeblocks) + + return modified_string + + +class HfDocTestParser(doctest.DocTestParser): + """ + Overwrites the DocTestParser from doctest to properly parse the codeblocks that are formatted with black. This + means that there are no extra lines at the end of our snippets. The `# doctest: +IGNORE_RESULT` marker is also + added anywhere a `load_dataset` call is made as a print would otherwise fail the corresponding line. + + Tests involving cuda are skipped base on a naive pattern that should be updated if it is not enough. + """ + + # This regular expression is used to find doctest examples in a + # string. It defines three groups: `source` is the source code + # (including leading indentation and prompts); `indent` is the + # indentation of the first (PS1) line of the source code; and + # `want` is the expected output (including leading indentation). + # fmt: off + _EXAMPLE_RE = re.compile(r''' + # Source consists of a PS1 line followed by zero or more PS2 lines. + (?P + (?:^(?P [ ]*) >>> .*) # PS1 line + (?:\n [ ]* \.\.\. .*)*) # PS2 lines + \n? + # Want consists of any non-blank lines that do not start with PS1. + (?P (?:(?![ ]*$) # Not a blank line + (?![ ]*>>>) # Not a line starting with PS1 + # !!!!!!!!!!! HF Specific !!!!!!!!!!! + (?:(?!```).)* # Match any character except '`' until a '```' is found (this is specific to HF because black removes the last line) + # !!!!!!!!!!! HF Specific !!!!!!!!!!! + (?:\n|$) # Match a new line or end of string + )*) + ''', re.MULTILINE | re.VERBOSE + ) + # fmt: on + + # !!!!!!!!!!! HF Specific !!!!!!!!!!! + skip_cuda_tests: bool = os.environ.get("SKIP_CUDA_DOCTEST", "0") == "1" + # !!!!!!!!!!! HF Specific !!!!!!!!!!! + + def parse(self, string, name=""): + """ + Overwrites the `parse` method to incorporate a skip for CUDA tests, and remove logs and dataset prints before + calling `super().parse` + """ + string = preprocess_string(string, self.skip_cuda_tests) + return super().parse(string, name) + + +class HfDoctestModule(Module): + """ + Overwrites the `DoctestModule` of the pytest package to make sure the HFDocTestParser is used when discovering + tests. + """ + + def collect(self) -> Iterable[DoctestItem]: + class MockAwareDocTestFinder(doctest.DocTestFinder): + """A hackish doctest finder that overrides stdlib internals to fix a stdlib bug. + + https://github.com/pytest-dev/pytest/issues/3456 https://bugs.python.org/issue25532 + """ + + def _find_lineno(self, obj, source_lines): + """Doctest code does not take into account `@property`, this + is a hackish way to fix it. https://bugs.python.org/issue17446 + + Wrapped Doctests will need to be unwrapped so the correct line number is returned. This will be + reported upstream. #8796 + """ + if isinstance(obj, property): + obj = getattr(obj, "fget", obj) + + if hasattr(obj, "__wrapped__"): + # Get the main obj in case of it being wrapped + obj = inspect.unwrap(obj) + + # Type ignored because this is a private function. + return super()._find_lineno( # type:ignore[misc] + obj, + source_lines, + ) + + def _find(self, tests, obj, name, module, source_lines, globs, seen) -> None: + if _is_mocked(obj): + return + with _patch_unwrap_mock_aware(): + # Type ignored because this is a private function. + super()._find( # type:ignore[misc] + tests, obj, name, module, source_lines, globs, seen + ) + + if self.path.name == "conftest.py": + module = self.config.pluginmanager._importconftest( + self.path, + self.config.getoption("importmode"), + rootpath=self.config.rootpath, + ) + else: + try: + module = import_path( + self.path, + root=self.config.rootpath, + mode=self.config.getoption("importmode"), + ) + except ImportError: + if self.config.getvalue("doctest_ignore_import_errors"): + skip("unable to import module %r" % self.path) + else: + raise + + # !!!!!!!!!!! HF Specific !!!!!!!!!!! + finder = MockAwareDocTestFinder(parser=HfDocTestParser()) + # !!!!!!!!!!! HF Specific !!!!!!!!!!! + optionflags = get_optionflags(self) + runner = _get_runner( + verbose=False, + optionflags=optionflags, + checker=_get_checker(), + continue_on_failure=_get_continue_on_failure(self.config), + ) + for test in finder.find(module, module.__name__): + if test.examples: # skip empty doctests and cuda + yield DoctestItem.from_parent(self, name=test.name, runner=runner, dtest=test) + + +def _device_agnostic_dispatch(device: str, dispatch_table: dict[str, Callable], *args, **kwargs): + if device not in dispatch_table: + if not callable(dispatch_table["default"]): + return dispatch_table["default"] + + return dispatch_table["default"](*args, **kwargs) + + fn = dispatch_table[device] + + # Some device agnostic functions return values or None, will return then directly. + if not callable(fn): + return fn + + return fn(*args, **kwargs) + + +if is_torch_available(): + # Mappings from device names to callable functions to support device agnostic + # testing. + BACKEND_MANUAL_SEED = { + "cuda": torch.cuda.manual_seed, + "cpu": torch.manual_seed, + "default": torch.manual_seed, + } + BACKEND_EMPTY_CACHE = { + "cuda": torch.cuda.empty_cache, + "cpu": None, + "default": None, + } + BACKEND_DEVICE_COUNT = { + "cuda": torch.cuda.device_count, + "cpu": lambda: 0, + "default": lambda: 1, + } + BACKEND_RESET_MAX_MEMORY_ALLOCATED = { + "cuda": torch.cuda.reset_max_memory_allocated, + "cpu": None, + "default": None, + } + BACKEND_MAX_MEMORY_ALLOCATED = { + "cuda": torch.cuda.max_memory_allocated, + "cpu": 0, + "default": 0, + } + BACKEND_RESET_PEAK_MEMORY_STATS = { + "cuda": torch.cuda.reset_peak_memory_stats, + "cpu": None, + "default": None, + } + BACKEND_MEMORY_ALLOCATED = { + "cuda": torch.cuda.memory_allocated, + "cpu": 0, + "default": 0, + } + BACKEND_SYNCHRONIZE = { + "cuda": torch.cuda.synchronize, + "cpu": None, + "default": None, + } + BACKEND_TORCH_ACCELERATOR_MODULE = { + "cuda": torch.cuda, + "cpu": None, + "default": None, + } +else: + BACKEND_MANUAL_SEED = {"default": None} + BACKEND_EMPTY_CACHE = {"default": None} + BACKEND_DEVICE_COUNT = {"default": lambda: 0} + BACKEND_RESET_MAX_MEMORY_ALLOCATED = {"default": None} + BACKEND_RESET_PEAK_MEMORY_STATS = {"default": None} + BACKEND_MAX_MEMORY_ALLOCATED = {"default": 0} + BACKEND_MEMORY_ALLOCATED = {"default": 0} + BACKEND_SYNCHRONIZE = {"default": None} + BACKEND_TORCH_ACCELERATOR_MODULE = {"default": None} + + +if is_torch_hpu_available(): + BACKEND_MANUAL_SEED["hpu"] = torch.hpu.manual_seed + BACKEND_DEVICE_COUNT["hpu"] = torch.hpu.device_count + BACKEND_TORCH_ACCELERATOR_MODULE["hpu"] = torch.hpu + +if is_torch_mlu_available(): + BACKEND_EMPTY_CACHE["mlu"] = torch.mlu.empty_cache + BACKEND_MANUAL_SEED["mlu"] = torch.mlu.manual_seed + BACKEND_DEVICE_COUNT["mlu"] = torch.mlu.device_count + BACKEND_TORCH_ACCELERATOR_MODULE["mlu"] = torch.mlu + +if is_torch_npu_available(): + BACKEND_EMPTY_CACHE["npu"] = torch.npu.empty_cache + BACKEND_MANUAL_SEED["npu"] = torch.npu.manual_seed + BACKEND_DEVICE_COUNT["npu"] = torch.npu.device_count + BACKEND_TORCH_ACCELERATOR_MODULE["npu"] = torch.npu + +if is_torch_xpu_available(): + BACKEND_EMPTY_CACHE["xpu"] = torch.xpu.empty_cache + BACKEND_MANUAL_SEED["xpu"] = torch.xpu.manual_seed + BACKEND_DEVICE_COUNT["xpu"] = torch.xpu.device_count + BACKEND_RESET_MAX_MEMORY_ALLOCATED["xpu"] = torch.xpu.reset_peak_memory_stats + BACKEND_RESET_PEAK_MEMORY_STATS["xpu"] = torch.xpu.reset_peak_memory_stats + BACKEND_MAX_MEMORY_ALLOCATED["xpu"] = torch.xpu.max_memory_allocated + BACKEND_MEMORY_ALLOCATED["xpu"] = torch.xpu.memory_allocated + BACKEND_SYNCHRONIZE["xpu"] = torch.xpu.synchronize + BACKEND_TORCH_ACCELERATOR_MODULE["xpu"] = torch.xpu + + +if is_torch_xla_available(): + BACKEND_EMPTY_CACHE["xla"] = torch.cuda.empty_cache + BACKEND_MANUAL_SEED["xla"] = torch.cuda.manual_seed + BACKEND_DEVICE_COUNT["xla"] = torch.cuda.device_count + + +def backend_manual_seed(device: str, seed: int): + return _device_agnostic_dispatch(device, BACKEND_MANUAL_SEED, seed) + + +def backend_empty_cache(device: str): + return _device_agnostic_dispatch(device, BACKEND_EMPTY_CACHE) + + +def backend_device_count(device: str): + return _device_agnostic_dispatch(device, BACKEND_DEVICE_COUNT) + + +def backend_reset_max_memory_allocated(device: str): + return _device_agnostic_dispatch(device, BACKEND_RESET_MAX_MEMORY_ALLOCATED) + + +def backend_reset_peak_memory_stats(device: str): + return _device_agnostic_dispatch(device, BACKEND_RESET_PEAK_MEMORY_STATS) + + +def backend_max_memory_allocated(device: str): + return _device_agnostic_dispatch(device, BACKEND_MAX_MEMORY_ALLOCATED) + + +def backend_memory_allocated(device: str): + return _device_agnostic_dispatch(device, BACKEND_MEMORY_ALLOCATED) + + +def backend_synchronize(device: str): + return _device_agnostic_dispatch(device, BACKEND_SYNCHRONIZE) + + +def backend_torch_accelerator_module(device: str): + return _device_agnostic_dispatch(device, BACKEND_TORCH_ACCELERATOR_MODULE) + + +if is_torch_available(): + # If `TRANSFORMERS_TEST_DEVICE_SPEC` is enabled we need to import extra entries + # into device to function mappings. + if "TRANSFORMERS_TEST_DEVICE_SPEC" in os.environ: + device_spec_path = os.environ["TRANSFORMERS_TEST_DEVICE_SPEC"] + if not Path(device_spec_path).is_file(): + raise ValueError( + f"Specified path to device spec file is not a file or not found. Received '{device_spec_path}" + ) + + # Try to strip extension for later import – also verifies we are importing a + # python file. + device_spec_dir, _ = os.path.split(os.path.realpath(device_spec_path)) + sys.path.append(device_spec_dir) + try: + import_name = device_spec_path[: device_spec_path.index(".py")] + except ValueError as e: + raise ValueError(f"Provided device spec file was not a Python file! Received '{device_spec_path}") from e + + device_spec_module = importlib.import_module(import_name) + + # Imported file must contain `DEVICE_NAME`. If it doesn't, terminate early. + try: + device_name = device_spec_module.DEVICE_NAME + except AttributeError as e: + raise AttributeError("Device spec file did not contain `DEVICE_NAME`") from e + + if "TRANSFORMERS_TEST_DEVICE" in os.environ and torch_device != device_name: + msg = f"Mismatch between environment variable `TRANSFORMERS_TEST_DEVICE` '{torch_device}' and device found in spec '{device_name}'\n" + msg += "Either unset `TRANSFORMERS_TEST_DEVICE` or ensure it matches device spec name." + raise ValueError(msg) + + torch_device = device_name + + def update_mapping_from_spec(device_fn_dict: dict[str, Callable], attribute_name: str): + try: + # Try to import the function directly + spec_fn = getattr(device_spec_module, attribute_name) + device_fn_dict[torch_device] = spec_fn + except AttributeError as e: + # If the function doesn't exist, and there is no default, throw an error + if "default" not in device_fn_dict: + raise AttributeError( + f"`{attribute_name}` not found in '{device_spec_path}' and no default fallback function found." + ) from e + + # Add one entry here for each `BACKEND_*` dictionary. + update_mapping_from_spec(BACKEND_MANUAL_SEED, "MANUAL_SEED_FN") + update_mapping_from_spec(BACKEND_EMPTY_CACHE, "EMPTY_CACHE_FN") + update_mapping_from_spec(BACKEND_DEVICE_COUNT, "DEVICE_COUNT_FN") + + +def compare_pipeline_output_to_hub_spec(output, hub_spec): + missing_keys = [] + unexpected_keys = [] + all_field_names = {field.name for field in fields(hub_spec)} + matching_keys = sorted([key for key in output if key in all_field_names]) + + # Fields with a MISSING default are required and must be in the output + for field in fields(hub_spec): + if field.default is MISSING and field.name not in output: + missing_keys.append(field.name) + + # All output keys must match either a required or optional field in the Hub spec + for output_key in output: + if output_key not in all_field_names: + unexpected_keys.append(output_key) + + if missing_keys or unexpected_keys: + error = ["Pipeline output does not match Hub spec!"] + if matching_keys: + error.append(f"Matching keys: {matching_keys}") + if missing_keys: + error.append(f"Missing required keys in pipeline output: {missing_keys}") + if unexpected_keys: + error.append(f"Keys in pipeline output that are not in Hub spec: {unexpected_keys}") + raise KeyError("\n".join(error)) + + +@require_torch +def cleanup(device: str, gc_collect=False): + if gc_collect: + gc.collect() + backend_empty_cache(device) + torch.compiler.reset() + + +# Type definition of key used in `Expectations` class. +DeviceProperties = tuple[str | None, int | None, int | None] +# Helper type. Makes creating instances of `Expectations` smoother. +PackedDeviceProperties = tuple[str | None, None | int | tuple[int, int]] + + +@cache +def get_device_properties() -> DeviceProperties: + """ + Get environment device properties. + """ + if IS_CUDA_SYSTEM or IS_ROCM_SYSTEM: + import torch + + major, minor = torch.cuda.get_device_capability() + if IS_ROCM_SYSTEM: + return ("rocm", major, minor) + else: + return ("cuda", major, minor) + elif IS_XPU_SYSTEM: + import torch + + # To get more info of the architecture meaning and bit allocation, refer to https://github.com/intel/llvm/blob/sycl/sycl/include/sycl/ext/oneapi/experimental/device_architecture.def + arch = torch.xpu.get_device_capability()["architecture"] + gen_mask = 0x000000FF00000000 + gen = (arch & gen_mask) >> 32 + return ("xpu", gen, None) + elif IS_NPU_SYSTEM: + return ("npu", None, None) + else: + return (torch_device, None, None) + + +def unpack_device_properties( + properties: PackedDeviceProperties | None = None, +) -> DeviceProperties: + """ + Unpack a `PackedDeviceProperties` tuple into consistently formatted `DeviceProperties` tuple. If properties is None, it is fetched. + """ + if properties is None: + return get_device_properties() + device_type, major_minor = properties + if major_minor is None: + major, minor = None, None + elif isinstance(major_minor, int): + major, minor = major_minor, None + else: + major, minor = major_minor + return device_type, major, minor + + +class Expectations(UserDict[PackedDeviceProperties, Any]): + def get_expectation(self) -> Any: + """ + Find best matching expectation based on environment device properties. We look at device_type, major and minor + versions of the drivers. Expectations are stored as a dictionary with keys of the form + (device_type, (major, minor)). If the major and minor versions are not provided, we use None. + """ + return self.find_expectation(get_device_properties()) + + def unpacked(self) -> list[tuple[DeviceProperties, Any]]: + return [(unpack_device_properties(k), v) for k, v in self.data.items()] + + @staticmethod + def is_default(expectation_key: PackedDeviceProperties) -> bool: + """ + This function returns True if the expectation_key is the Default expectation (None, None). + When an Expectation dict contains a Default value, it is generally because the test existed before Expectations. + When we modify a test to use Expectations for a specific hardware, we don't want to affect the tests on other + hardwares. Thus we set the previous value as the Default expectation with key (None, None) and add a value for + the specific hardware with key (hardware_type, (major, minor)). + """ + return all(p is None for p in expectation_key) + + @staticmethod + def score(properties: DeviceProperties, other: DeviceProperties) -> float: + """ + Returns score indicating how similar two instances of the `Properties` tuple are. + Rules are as follows: + * Matching `type` adds one point, semi-matching `type` adds 0.1 point (e.g. cuda and rocm). + * If types match, matching `major` adds another point, and then matching `minor` adds another. + * The Default expectation (None, None) is worth 0.5 point, which is better than semi-matching. More on this + in the `is_default` function. + """ + device_type, major, minor = properties + other_device_type, other_major, other_minor = other + + score = 0 + # Matching device type, maybe major and minor + if device_type is not None and device_type == other_device_type: + score += 1 + if major is not None and major == other_major: + score += 1 + if minor is not None and minor == other_minor: + score += 1 + # Semi-matching device type, which carries less importance than the default expectation + elif device_type in ["cuda", "rocm"] and other_device_type in ["cuda", "rocm"]: + score = 0.1 + + # Default expectation + if Expectations.is_default(other): + score = 0.5 + + return score + + def find_expectation(self, properties: DeviceProperties = (None, None, None)) -> Any: + """ + Find best matching expectation based on provided device properties. We score each expectation, and to + distinguish between expectations with the same score, we use the major and minor version numbers, prioritizing + most recent versions. + """ + (result_key, result) = max( + self.unpacked(), + key=lambda x: ( + Expectations.score(properties, x[0]), # x[0] is a device properties tuple (device_type, major, minor) + x[0][1] if x[0][1] is not None else -1, # This key is the major version, -1 if major is None + x[0][2] if x[0][2] is not None else -1, # This key is the minor version, -1 if minor is None + ), + ) + + if Expectations.score(properties, result_key) == 0: + raise ValueError(f"No matching expectation found for {properties}") + + return result + + def __repr__(self): + return f"{self.data}" + + +def patch_torch_compile_force_graph(): + """ + Patch `torch.compile` to always use `fullgraph=True`. + + This is useful when some `torch.compile` tests are running with `fullgraph=False` and we want to be able to run + them with `fullgraph=True` in some occasion (without introducing new tests) to make sure there is no graph break. + + After PR #40137, `CompileConfig.fullgraph` is `False` by default, this patch is necessary. + """ + + force_fullgraph = os.environ.get("TORCH_COMPILE_FORCE_FULLGRAPH", "") + force_fullgraph = force_fullgraph.lower() in ("yes", "true", "on", "t", "y", "1") + + if force_fullgraph: + import torch + + orig_method = torch.compile + + def patched(*args, **kwargs): + # In `torch_compile`, all arguments except `model` is keyword only argument. + kwargs["fullgraph"] = True + return orig_method(*args, **kwargs) + + torch.compile = patched + + +def _get_test_info(): + """ + Collect some information about the current test. + + For example, test full name, line number, stack, traceback, etc. + """ + + full_test_name = os.environ.get("PYTEST_CURRENT_TEST", "").split(" ")[0] + test_file, test_class, test_name = full_test_name.split("::") + + # from the most recent frame to the top frame + stack_from_inspect = inspect.stack() + # but visit from the top frame to the most recent frame + + actual_test_file, _actual_test_class = test_file, test_class + test_frame, test_obj, test_method = None, None, None + for frame in reversed(stack_from_inspect): + # if test_file in str(frame).replace(r"\\", "/"): + # check frame's function + if it has `self` as locals; double check if self has the (function) name + # TODO: Question: How about expanded? + if ( + test_name.startswith(frame.function) + and "self" in frame.frame.f_locals + and hasattr(frame.frame.f_locals["self"], test_name) + ): + # if test_name == frame.frame.f_locals["self"]._testMethodName: + test_frame = frame + # The test instance + test_obj = frame.frame.f_locals["self"] + # TODO: Do we get the (relative?) path or it's just a file name? + # TODO: Does `test_obj` always have `tearDown` object? + actual_test_file = frame.filename + # TODO: check `test_method` will work used at the several places! + test_method = getattr(test_obj, test_name) + break + + if test_frame is not None: + line_number = test_frame.lineno + + # The frame of `patched` being called (the one and the only one calling `_get_test_info`) + # This is used to get the original method being patched in order to get the context. + frame_of_patched_obj = None + + captured_frames = [] + to_capture = False + # From the most outer (i.e. python's `runpy.py`) frame to most inner frame (i.e. the frame of this method) + # Between `the test method being called` and `before entering `patched``. + for frame in reversed(stack_from_inspect): + if ( + test_name.startswith(frame.function) + and "self" in frame.frame.f_locals + and hasattr(frame.frame.f_locals["self"], test_name) + ): + to_capture = True + # TODO: check simply with the name is not robust. + elif frame.frame.f_code.co_name == "patched": + frame_of_patched_obj = frame + to_capture = False + break + if to_capture: + captured_frames.append(frame) + + tb_next = None + for frame_info in reversed(captured_frames): + tb = types.TracebackType(tb_next, frame_info.frame, frame_info.frame.f_lasti, frame_info.frame.f_lineno) + tb_next = tb + test_traceback = tb + + origin_method_being_patched = frame_of_patched_obj.frame.f_locals["orig_method"] + + # An iterable of type `traceback.StackSummary` with each element of type `FrameSummary` + stack = traceback.extract_stack() + # The frame which calls `the original method being patched` + caller_frame = None + # From the most inner (i.e. recent) frame to the most outer frame + for frame in reversed(stack): + if origin_method_being_patched.__name__ in frame.line: + caller_frame = frame + + caller_path = os.path.relpath(caller_frame.filename) + caller_lineno = caller_frame.lineno + + test_lineno = line_number + + # Get the code context in the test function/method. + from _pytest._code.source import Source + + with open(actual_test_file) as fp: + s = fp.read() + source = Source(s) + test_code_context = "\n".join(source.getstatement(test_lineno - 1).lines) + + # Get the code context in the caller (to the patched function/method). + with open(caller_path) as fp: + s = fp.read() + source = Source(s) + caller_code_context = "\n".join(source.getstatement(caller_lineno - 1).lines) + + test_info = f"test:\n\n{full_test_name}\n\n{'-' * 80}\n\ntest context: {actual_test_file}:{test_lineno}\n\n{test_code_context}" + test_info = f"{test_info}\n\n{'-' * 80}\n\ncaller context: {caller_path}:{caller_lineno}\n\n{caller_code_context}" + + return ( + full_test_name, + test_file, + test_lineno, + test_obj, + test_method, + test_frame, + test_traceback, + test_code_context, + caller_path, + caller_lineno, + caller_code_context, + test_info, + ) + + +def _get_call_arguments(code_context): + """ + Analyze the positional and keyword arguments in a call expression. + + This will extract the expressions of the positional and kwyword arguments, and associate them to the positions and + the keyword argument names. + """ + + def get_argument_name(node): + """Extract the name/expression from an AST node""" + if isinstance(node, ast.Name): + return node.id + elif isinstance(node, ast.Attribute): + return ast.unparse(node) + elif isinstance(node, ast.Constant): + return repr(node.value) + else: + return ast.unparse(node) + + indent = len(code_context) - len(code_context.lstrip()) + code_context = code_context.replace(" " * indent, "") + + try: + # Parse the line + tree = ast.parse(code_context, mode="eval") + + assert isinstance(tree.body, ast.Call) + call_node = tree.body + + if call_node: + result = { + "positional_args": [], + "keyword_args": {}, + "starargs": None, # *args + "kwargs": None, # **kwargs + } + + # Extract positional arguments + for arg in call_node.args: + arg_name = get_argument_name(arg) + result["positional_args"].append(arg_name) + + # Extract keyword arguments + for keyword in call_node.keywords: + if keyword.arg is None: + # This is **kwargs + result["kwargs"] = get_argument_name(keyword.value) + else: + # Regular keyword argument + arg_name = get_argument_name(keyword.value) + result["keyword_args"][keyword.arg] = arg_name + + return result + + except (SyntaxError, AttributeError) as e: + print(f"Error parsing: {e}") + + return None + + +def _prepare_debugging_info(test_info, info): + """Combine the information about the test and the call information to a patched function/method within it.""" + + info = f"{test_info}\n\n{info}" + p = os.path.join(os.environ.get("_PATCHED_TESTING_METHODS_OUTPUT_DIR", ""), "captured_info.txt") + # TODO (ydshieh): This is not safe when we use pytest-xdist with more than 1 worker. + with open(p, "a") as fp: + fp.write(f"{info}\n\n{'=' * 120}\n\n") + + return info + + +def _patched_tearDown(self, *args, **kwargs): + """Used to report a test that has failures captured and handled by patched functions/methods (without re-raise). + + The patched functions/methods refer to the `patched` defined in `_patch_with_call_info`, which is applied to + `torch.testing.assert_close` and `unittest.case.TestCase.assertEqual`. + + The objective is to avoid a failure being silence after being processed. + + If there is any failure that is not handled by the patched functions/methods, we add custom error message for them + along with the usual pytest failure report. + """ + + # Check for regular failures before clearing: + # when `_patched_tearDown` is called, the current test fails due to an assertion error given by a method being + # patched by `_patch_with_call_info`. The patched method catches such an error and continue running the remaining + # statements within the test. If the test fails with another error not handled by the patched methods, we don't let + # pytest to fail and report it but the original failure (the first one that was processed) instead. + # We still record those failures not handled by the patched methods, and add custom messages along with the usual + # pytest failure report. + regular_failures_info = [] + + errors = None + if hasattr(self._outcome, "errors"): + errors = self._outcome.errors + elif hasattr(self._outcome, "result") and hasattr(self._outcome.result, "errors"): + errors = self._outcome.result.errors + + if hasattr(self, "_outcome") and errors: + for error_entry in errors: + test_instance, (exc_type, exc_obj, exc_tb) = error_entry + # breakpoint() + regular_failures_info.append( + { + "message": f"{str(exc_obj)}\n\n", + "type": exc_type.__name__, + "file": "test_modeling_vit.py", + "line": 237, # get_deepest_frame_line(exc_tb) # Your helper function + } + ) + + # Clear the regular failure (i.e. that is not from any of our patched assertion methods) from pytest's records. + if hasattr(self._outcome, "errors"): + self._outcome.errors.clear() + elif hasattr(self._outcome, "result") and hasattr(self._outcome.result, "errors"): + self._outcome.result.errors.clear() + + # reset back to the original tearDown method, so `_patched_tearDown` won't be run by the subsequent tests if they + # have only test failures that are not handle by the patched methods (or no test failure at all). + orig_tearDown = _patched_tearDown.orig_tearDown + type(self).tearDown = orig_tearDown + + # Call the original tearDown + orig_tearDown(self, *args, **kwargs) + + # Get the failure + test_method = getattr(self, self._testMethodName) + captured_failures = test_method.__func__.captured_failures[id(test_method)] + + # TODO: How could we show several exceptions in a sinigle test on the terminal? (Maybe not a good idea) + captured_exceptions = captured_failures[0]["exception"] + captured_traceback = captured_failures[0]["traceback"] + # Show the captured information on the terminal. + capturued_info = [x["info"] for x in captured_failures] + capturued_info_str = f"\n\n{'=' * 80}\n\n".join(capturued_info) + + # Enhance the exception message if there were suppressed failures + if regular_failures_info: + enhanced_message = f"""{str(captured_exceptions)} + +{"=" * 80} +Handled Failures: ({len(capturued_info)} handled): +{"-" * 80}\n +{capturued_info_str} + +{"=" * 80} +Unhandled Failures: ({len(regular_failures_info)} unhandled): +{"-" * 80}\n +{", ".join(f"{info['type']}: {info['message']}{info['file']}:{info['line']}" for info in regular_failures_info)} + +{"-" * 80} +Note: This failure occurred after other failures analyzed by the patched assertion methods. +To see the full details, temporarily disable assertion patching. +{"=" * 80}""" + + # Create new exception with enhanced message + enhanced_exception = type(captured_exceptions)(enhanced_message) + enhanced_exception.__cause__ = captured_exceptions.__cause__ + enhanced_exception.__context__ = captured_exceptions.__context__ + + # Raise with your existing traceback reconstruction + captured_exceptions = enhanced_exception + + # clean up the recorded status + del test_method.__func__.captured_failures + + raise captured_exceptions.with_traceback(captured_traceback) + + +def _patch_with_call_info(module_or_class, attr_name, _parse_call_info_func, target_args): + """ + Patch a callerable `attr_name` of a module or class `module_or_class`. + + This will allow us to collect the call information, e.g. the argument names and values, also the literal expressions + passed as the arguments. + """ + orig_method = getattr(module_or_class, attr_name) + if not callable(orig_method): + return + + def patched(*args, **kwargs): + # If the target callable is not called within a test, simply call it without modification. + if not os.environ.get("PYTEST_CURRENT_TEST", ""): + return orig_method(*args, **kwargs) + + try: + orig_method(*args, **kwargs) + except AssertionError as e: + captured_exception = e + # captured_traceback = e.__traceback__ + ( + full_test_name, + test_file, + test_lineno, + test_obj, + test_method, + test_frame, + test_traceback, + test_code_context, + caller_path, + caller_lineno, + caller_code_context, + test_info, + ) = _get_test_info() + test_info = f"{test_info}\n\n{'-' * 80}\n\npatched method: {orig_method.__module__}.{orig_method.__name__}" + call_argument_expressions = _get_call_arguments(caller_code_context) + + # This is specific + info = _parse_call_info_func(orig_method, args, kwargs, call_argument_expressions, target_args) + info = _prepare_debugging_info(test_info, info) + + # If the test is running in a CI environment (e.g. not a manual run), let's raise and fail the test, so it + # behaves as usual. + # On Github Actions or CircleCI, this is set automatically. + # When running manually, it's the user to determine if to set it. + # This is to avoid the patched function being called `with self.assertRaises(AssertionError):` and fails + # because of the missing expected `AssertionError`. + # TODO (ydshieh): If there is way to raise only when we are inside such context managers? + # TODO (ydshieh): How not to record the failure if it happens inside `self.assertRaises(AssertionError)`? + if os.getenv("CI") == "true": + raise captured_exception.with_traceback(test_traceback) + + # Save this, so we can raise at the end of the current test + captured_failure = { + "result": "failed", + "exception": captured_exception, + "traceback": test_traceback, + "info": info, + } + + # Record the failure status and its information, so we can raise it later. + # We are modifying the (unbound) function at class level: not its logic but only adding a new extra + # attribute. + if getattr(test_method.__func__, "captured_failures", None) is None: + test_method.__func__.captured_failures = {} + if id(test_method) not in test_method.__func__.captured_failures: + test_method.__func__.captured_failures[id(test_method)] = [] + test_method.__func__.captured_failures[id(test_method)].append(captured_failure) + + # This modifies the `tearDown` which will be called after every tests, but we reset it back inside + # `_patched_tearDown`. + if not hasattr(type(test_obj).tearDown, "orig_tearDown"): + orig_tearDown = type(test_obj).tearDown + _patched_tearDown.orig_tearDown = orig_tearDown + type(test_obj).tearDown = _patched_tearDown + + setattr(module_or_class, attr_name, patched) + + +def _parse_call_info(func, args, kwargs, call_argument_expressions, target_args): + """ + Prepare a string containing the call info to `func`, e.g. argument names/values/expressions. + """ + signature = inspect.signature(func) + signature_names = [param.name for param_name, param in signature.parameters.items()] + + # called as `self.method_name()` or `xxx.method_name()`. + if len(args) == len(call_argument_expressions["positional_args"]) + 1: + # We simply add "self" as the expression despite it might not be the actual argument name. + # (This part is very unlikely what a user would be interest to know) + call_argument_expressions["positional_args"] = ["self"] + call_argument_expressions["positional_args"] + + param_position_mapping = {param_name: idx for idx, param_name in enumerate(signature_names)} + + arg_info = {} + for arg_name in target_args: + if arg_name in kwargs: + arg_value = kwargs[arg_name] + arg_expr = call_argument_expressions["keyword_args"][arg_name] + else: + arg_pos = param_position_mapping[arg_name] + arg_value = args[arg_pos] + arg_expr = call_argument_expressions["positional_args"][arg_pos] + + arg_value_str = _format_py_obj(arg_value) + arg_info[arg_name] = {"arg_expr": arg_expr, "arg_value_str": arg_value_str} + + info = "" + for arg_name in arg_info: + arg_expr, arg_value_str = arg_info[arg_name]["arg_expr"], arg_info[arg_name]["arg_value_str"] + info += f"{'-' * 80}\n\nargument name: `{arg_name}`\nargument expression: `{arg_expr}`\n\nargument value:\n\n{arg_value_str}\n\n" + + # remove the trailing \n\n + info = info[:-2] + + return info + + +def patch_testing_methods_to_collect_info(): + """ + Patch some methods (`torch.testing.assert_close`, `unittest.case.TestCase.assertEqual`, etc). + + This will allow us to collect the call information, e.g. the argument names and values, also the literal expressions + passed as the arguments. + """ + p = os.path.join(os.environ.get("_PATCHED_TESTING_METHODS_OUTPUT_DIR", ""), "captured_info.txt") + Path(p).unlink(missing_ok=True) + + if is_torch_available(): + import torch + + _patch_with_call_info(torch.testing, "assert_close", _parse_call_info, target_args=("actual", "expected")) + + _patch_with_call_info(unittest.case.TestCase, "assertEqual", _parse_call_info, target_args=("first", "second")) + _patch_with_call_info(unittest.case.TestCase, "assertListEqual", _parse_call_info, target_args=("list1", "list2")) + _patch_with_call_info( + unittest.case.TestCase, "assertTupleEqual", _parse_call_info, target_args=("tuple1", "tuple2") + ) + _patch_with_call_info(unittest.case.TestCase, "assertSetEqual", _parse_call_info, target_args=("set1", "set1")) + _patch_with_call_info(unittest.case.TestCase, "assertDictEqual", _parse_call_info, target_args=("d1", "d2")) + _patch_with_call_info(unittest.case.TestCase, "assertIn", _parse_call_info, target_args=("member", "container")) + _patch_with_call_info(unittest.case.TestCase, "assertNotIn", _parse_call_info, target_args=("member", "container")) + _patch_with_call_info(unittest.case.TestCase, "assertLess", _parse_call_info, target_args=("a", "b")) + _patch_with_call_info(unittest.case.TestCase, "assertLessEqual", _parse_call_info, target_args=("a", "b")) + _patch_with_call_info(unittest.case.TestCase, "assertGreater", _parse_call_info, target_args=("a", "b")) + _patch_with_call_info(unittest.case.TestCase, "assertGreaterEqual", _parse_call_info, target_args=("a", "b")) + + +def torchrun(script: str, nproc_per_node: int, is_torchrun: bool = True, env: dict | None = None): + """Run the `script` using `torchrun` command for multi-processing in a subprocess. Captures errors as necessary.""" + with tempfile.NamedTemporaryFile(mode="w+", suffix=".py") as tmp: + tmp.write(script) + tmp.flush() + tmp.seek(0) + if is_torchrun: + cmd = ( + f"torchrun --nproc_per_node {nproc_per_node} --master_port {get_torch_dist_unique_port()} {tmp.name}" + ).split() + else: + cmd = ["python3", tmp.name] + + # Note that the subprocess will be waited for here, and raise an error if not successful + try: + _ = subprocess.run(cmd, capture_output=True, env=env, text=True, check=True) + except subprocess.CalledProcessError as e: + raise Exception(f"The following error was captured: {e.stderr}") + + +def _format_tensor(t, indent_level=0, sci_mode=None): + """Format torch's tensor in a pretty way to be shown 👀 in the test report.""" + + # `torch.testing.assert_close` could accept python int/float numbers. + if not isinstance(t, torch.Tensor): + t = torch.tensor(t) + + # Simply make the processing below simpler (not to handle both cases) + is_scalar = False + if t.ndim == 0: + t = torch.tensor([t]) + is_scalar = True + + # For scalar or one-dimensional tensor, keep it as one-line. If there is only one element along any dimension except + # the last one, we also keep it as one-line. + if t.ndim <= 1 or set(t.shape[0:-1]) == {1}: + # Use `detach` to remove `grad_fn=<...>`, and use `to("cpu")` to remove `device='...'` + t = t.detach().to("cpu") + + # We work directly with the string representation instead the tensor itself + t_str = str(t) + + # remove `tensor( ... )` so keep only the content + t_str = t_str.replace("tensor(", "").replace(")", "") + + # Sometimes there are extra spaces between `[` and the first digit of the first value (for alignment). + # For example `[[ 0.06, -0.51], [-0.76, -0.49]]`. It may have multiple consecutive spaces. + # Let's remove such extra spaces. + while "[ " in t_str: + t_str = t_str.replace("[ ", "[") + + # Put everything in a single line. We replace `\n` by a space ` ` so we still keep `,\n` as `, `. + t_str = t_str.replace("\n", " ") + + # Remove repeated spaces (introduced by the previous step) + while " " in t_str: + t_str = t_str.replace(" ", " ") + + # remove leading `[` and `]` for scalar tensor + if is_scalar: + t_str = t_str[1:-1] + + t_str = " " * 4 * indent_level + t_str + + return t_str + + # Otherwise, we separate the representations of each element along an outer dimension by new lines (after a `,`). + # The representation of each element is obtained by calling this function recursively with current `indent_level`. + else: + t_str = str(t) + + # (For the recursive calls should receive this value) + if sci_mode is None: + sci_mode = "e+" in t_str or "e-" in t_str + + # Use the original content to determine the scientific mode to use. This is required as the representation of + # t[index] (computed below) maybe have different format regarding scientific notation. + torch.set_printoptions(sci_mode=sci_mode) + + t_str = " " * 4 * indent_level + "[\n" + # Keep the ending `,` for all outer dimensions whose representations are not put in one-line, even if there is + # only one element along that dimension. + t_str += ",\n".join(_format_tensor(x, indent_level=indent_level + 1, sci_mode=sci_mode) for x in t) + t_str += ",\n" + " " * 4 * indent_level + "]" + + torch.set_printoptions(sci_mode=None) + + return t_str + + +def _quote_string(s): + """Given a string `s`, return a python literal expression that give `s` when it is used in a python source code. + + For example, if `s` is the string `abc`, the return value is `"abc"`. + + We choice double quotes over single quote despite `str(s)` would give `'abc'` instead of `"abc"`. + """ + has_single_quote = "'" in s + has_double_quote = '"' in s + + if has_single_quote and has_double_quote: + # replace any double quote by the raw string r'\"'. + s = s.replace('"', r"\"") + return f'"{s}"' + elif has_single_quote: + return f'"{s}"' + elif has_double_quote: + return f"'{s}'" + else: + return f'"{s}"' + + +def _format_py_obj(obj, indent=0, mode="", cache=None, prefix=""): + """Format python objects of basic built-in type in a pretty way so we could copy-past them to code editor easily. + + Currently, this support int, float, str, list, tuple, and dict. + + It also works with `torch.Tensor` via calling `format_tesnor`. + """ + + if cache is None: + cache = {} + else: + if (id(obj), indent, mode, prefix) in cache: + return cache[(id(obj), indent, mode, prefix)] + + # special format method for `torch.Tensor` + if str(obj.__class__) == "": + return _format_tensor(obj) + + elif obj.__class__.__name__ == "str": + quoted_string = _quote_string(obj) + # we don't want the newline being interpreted + quoted_string = quoted_string.replace("\n", r"\n") + output = quoted_string + + elif obj.__class__.__name__ in ["int", "float"]: + # for float like `1/3`, we will get `0.3333333333333333` + output = str(obj) + + elif obj.__class__.__name__ in ["list", "tuple", "dict"]: + parenthesis = { + "list": "[]", + "tuple": "()", + "dict": "{}", + } + p1, p2 = parenthesis[obj.__class__.__name__] + + elements_without_indent = [] + if isinstance(obj, dict): + for idx, (k, v) in enumerate(obj.items()): + last_element = idx == len(obj) - 1 + ok = _format_py_obj(k, indent=indent + 1, mode="one-line", cache=cache) + ov = _format_py_obj( + v, + indent=indent + 1, + mode=mode, + cache=cache, + prefix=ok.lstrip() + ": " + "," if not last_element else "", + ) + # Each element could be multiple-line, but the indent of its first line is removed + elements_without_indent.append(f"{ok.lstrip()}: {ov.lstrip()}") + + else: + for idx, x in enumerate(obj): + last_element = idx == len(obj) - 1 + o = _format_py_obj( + x, indent=indent + 1, mode=mode, cache=cache, prefix="," if not last_element else "" + ) + # Each element could be multiple-line, but the indent of its first line is removed + elements_without_indent.append(o.lstrip()) + + groups = [] + buf = [] + for idx, x in enumerate(elements_without_indent): + buf.append(x) + + x_expanded = "\n" in buf[-1] + not_last_element = idx != len(elements_without_indent) - 1 + # if `x` should be separated from subsequent elements + should_finalize_x = x_expanded or len(f"{' ' * (4 * (indent + 1))}") + len( + ", ".join(buf[-1:]) + ) > 120 - int(not_last_element) + + # if `buf[:-1]` (i.e. without `x`) should be combined together (into one line) + should_finalize_buf = x_expanded + + # the recursive call returns single line, so we can use it to determine if we can fit the width limit + if not should_finalize_buf: + buf_not_fit_into_one_line = len(f"{' ' * (4 * (indent + 1))}") + len(", ".join(buf)) > 120 - int( + not_last_element + ) + should_finalize_buf = buf_not_fit_into_one_line + + # any element of iterable type need to be on its own line + if (type(obj[idx]) if type(obj) is not dict else type(list(obj.values())[idx])) in [list, tuple, dict]: + should_finalize_x = True + should_finalize_buf = True + + # any type change --> need to be added after a new line + prev_type = None + current_type = type(obj[idx]) if type(obj) is not dict else type(list(obj.values())[idx]) + if len(buf) > 1: + prev_type = type(obj[idx - 1]) if type(obj) is not dict else type(list(obj.values())[idx - 1]) + type_changed = current_type != prev_type + if type_changed: + should_finalize_buf = True + + # all elements in the buf are string --> don't finalize the buf by width limit + if prev_type is None or (prev_type is str and current_type is str): + should_finalize_buf = False + + # collect as many elements of string type as possible (without width limit). + # These will be examined as a whole (if not fit into the width, each element would be in its own line) + if current_type is str: + should_finalize_x = False + # `len(buf) == 1` or `obj[idx-1]` is a string + if prev_type in [None, str]: + should_finalize_buf = False + + if should_finalize_buf: + orig_buf_len = len(buf) + + if orig_buf_len > 1: + not_fit_into_one_line = None + + # all elements in `obj` that give `buf[:-1]` are string. + if prev_type is str: + # `-1` at the end: because buf[-2] is not the last element + not_fit_into_one_line = len(f"{' ' * (4 * (indent + 1))}") + len(", ".join(buf[:-1])) > 120 - 1 + + if not_fit_into_one_line: + for x in buf[:-1]: + groups.append([x]) + else: + groups.append(buf[:-1]) + + buf = buf[-1:] + + if should_finalize_x: + groups.append(buf) + buf = [] + + # The last buf + if len(buf) > 0: + not_fit_into_one_line = None + if current_type is str: + # no `-1` at the end: because buf[-1] is the last element + not_fit_into_one_line = len(f"{' ' * (4 * (indent + 1))}") + len(", ".join(buf)) > 120 + + if not_fit_into_one_line: + for x in buf: + groups.append([x]) + else: + groups.append(buf) + + output = f"{' ' * 4 * indent}{p1}\n" + element_strings = [f"{' ' * (4 * (indent + 1))}" + ", ".join(buf) for buf in groups] + output += ",\n".join(element_strings) + output += f"\n{' ' * 4 * indent}{p2}" + + # if all elements are in one-line + no_new_line_in_elements = all("\n" not in x for x in element_strings) + # if yes, we can form a one-line representation of `obj` + could_use_one_line = no_new_line_in_elements + + # if mode == "one-line", this function always returns one-line representation, so `no_new_line_in_elements` + # will be `True`. + if could_use_one_line: + one_line_form = ", ".join([x.lstrip() for x in element_strings]) + one_line_form = f"{p1}{one_line_form}{p2}" + + if mode == "one-line": + return output + + # check with the width limit + could_use_one_line = len(f"{' ' * 4 * indent}") + len(prefix) + len(one_line_form) <= 120 + + # extra conditions for returning one-line representation + def use_one_line_repr(obj): + # iterable types + if type(obj) in (list, tuple, dict): + # get all types + element_types = [] + if type(obj) is dict: + element_types.extend(type(x) for x in obj.values()) + elif type(obj) in [list, tuple]: + element_types.extend(type(x) for x in obj) + + # At least one element is of iterable type + if any(x in (list, tuple, dict) for x in element_types): + # If `obj` has more than one element and at least one of them is iterable --> no one line repr. + if len(obj) > 1: + return False + + # only one element that is iterable, but not the same type as `obj` --> no one line repr. + if type(obj) is not type(obj[0]): + return False + + # one-line repr. if possible, without width limit + return no_new_line_in_elements + + # all elements are of simple types, but more than one type --> no one line repr. + if len(set(element_types)) > 1: + return False + + # all elements are of the same simple type + if element_types[0] in [int, float]: + # one-line repr. without width limit + return no_new_line_in_elements + elif element_types[0] is str: + if len(obj) == 1: + # one single string element --> one-line repr. without width limit + return no_new_line_in_elements + else: + # multiple string elements --> one-line repr. if fit into width limit + return could_use_one_line + + # simple types (int, flat, string) + return True + + # width condition combined with specific mode conditions + if use_one_line_repr(obj): + output = f"{' ' * 4 * indent}{one_line_form}" + + cache[(id(obj), indent, mode, prefix)] = output + + return output + + +def write_file(file, content): + with open(file, "w") as f: + f.write(content) + + +def read_json_file(file): + with open(file, "r") as fh: + return json.load(fh) + + +# ============================================================================= +# Training CI Utilities - Logging and Memory Monitoring +# ============================================================================= + + +# ANSI color codes for terminal output +class Colors: + """ANSI color codes for terminal output formatting.""" + + RESET = "\033[0m" + BOLD = "\033[1m" + DIM = "\033[2m" + + # Foreground colors + RED = "\033[31m" + GREEN = "\033[32m" + YELLOW = "\033[33m" + BLUE = "\033[34m" + MAGENTA = "\033[35m" + CYAN = "\033[36m" + WHITE = "\033[37m" + + # Bright variants + BRIGHT_RED = "\033[91m" + BRIGHT_GREEN = "\033[92m" + BRIGHT_YELLOW = "\033[93m" + BRIGHT_BLUE = "\033[94m" + BRIGHT_CYAN = "\033[96m" + + +class ColoredFormatter(logging.Formatter): + """Custom formatter that adds colors based on log level.""" + + LEVEL_COLORS = { + logging.DEBUG: Colors.DIM + Colors.CYAN, + logging.INFO: Colors.WHITE, + logging.WARNING: Colors.BRIGHT_YELLOW, + logging.ERROR: Colors.BRIGHT_RED, + logging.CRITICAL: Colors.BOLD + Colors.BRIGHT_RED, + } + + # Loggers that should be dimmed (less important/verbose) + DIMMED_LOGGERS = {"httpx", "httpcore", "urllib3", "requests"} + + def __init__(self, fmt: str | None = None, datefmt: str | None = None): + super().__init__(fmt, datefmt) + + def format(self, record: logging.LogRecord) -> str: + # Check if this logger should be dimmed + is_dimmed = record.name in self.DIMMED_LOGGERS + + if is_dimmed: + # Dim the entire log line for httpx and similar + timestamp = self.formatTime(record, self.datefmt) + message = record.getMessage() + return f"{Colors.DIM}{timestamp} - {record.name} - {record.levelname:8} - {message}{Colors.RESET}" + + # Get color for this level + color = self.LEVEL_COLORS.get(record.levelno, Colors.RESET) + + # Color the level name + levelname = record.levelname + colored_levelname = f"{color}{levelname:8}{Colors.RESET}" + + # Color the timestamp + colored_time = f"{Colors.DIM}{self.formatTime(record, self.datefmt)}{Colors.RESET}" + + # Color the logger name + colored_name = f"{Colors.BLUE}{record.name}{Colors.RESET}" + + # Get message + message = record.getMessage() + + return f"{colored_time} - {colored_name} - {colored_levelname} - {message}" + + +_warn_once_logged: set[str] = set() + + +def init_test_logger() -> logging.Logger: + """Initialize a test-specific logger with colored stderr handler and INFO level for tests. + + Uses a named logger instead of root logger to avoid conflicts with pytest-xdist parallel execution. + Uses stderr instead of stdout to avoid deadlocks with pytest-xdist output capture. + """ + logger = logging.getLogger("transformers.training_test") + logger.setLevel(logging.INFO) + + # Only add handler if not already present (avoid duplicate handlers on repeated calls) + if not logger.handlers: + # Use stderr instead of stdout - pytest-xdist captures stdout which can cause deadlocks + ch = logging.StreamHandler(sys.stderr) + ch.setLevel(logging.INFO) + + # Use colored formatter if terminal supports it, plain otherwise + if sys.stderr.isatty(): + formatter = ColoredFormatter(datefmt="%Y-%m-%d %H:%M:%S") + else: + formatter = logging.Formatter( + "%(asctime)s - %(name)s - %(levelname)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S" + ) + + ch.setFormatter(formatter) + logger.addHandler(ch) + + logger.propagate = False # Don't propagate to root logger to avoid duplicate output + return logger + + +def warn_once(logger_instance: logging.Logger, msg: str) -> None: + """Log a warning message only once per unique message. + + Uses a global set to track messages that have already been logged + to prevent duplicate warning messages from cluttering the output. + + Args: + logger_instance: The logger instance to use for warning. + msg: The warning message to log. + """ + if msg not in _warn_once_logged: + logger_instance.warning(msg) + _warn_once_logged.add(msg) + + +# Named tuple for passing memory stats for logging +MemoryStats = collections.namedtuple( + "MemoryStats", + [ + "rss_gib", # Resident Set Size in GiB + "rss_pct", # RSS as percentage of total memory + "vms_gib", # Virtual Memory Size in GiB + "peak_rss_gib", # Peak RSS in GiB + "peak_rss_pct", # Peak RSS as percentage of total memory + "available_gib", # Available system memory in GiB + "total_gib", # Total system memory in GiB + ], +) + + +class CPUMemoryMonitor: + """Monitor CPU memory usage for the current process.""" + + def __init__(self): + self.device_name = "CPU" + self._peak_rss = 0 + self._process = None + self.total_memory = 0 + self.total_memory_gib = 0 + + if is_psutil_available(): + import psutil + + self._process = psutil.Process(os.getpid()) + mem_info = psutil.virtual_memory() + self.total_memory = mem_info.total + self.total_memory_gib = self._to_gib(self.total_memory) + + def _to_gib(self, memory_in_bytes: int) -> float: + """Convert bytes to GiB.""" + return memory_in_bytes / (1024 * 1024 * 1024) + + def _to_pct(self, memory_in_bytes: int) -> float: + """Convert bytes to percentage of total memory.""" + if self.total_memory == 0: + return 0.0 + return 100.0 * memory_in_bytes / self.total_memory + + def _update_peak(self) -> None: + """Update peak memory tracking.""" + if self._process is not None: + current_rss = self._process.memory_info().rss + self._peak_rss = max(self._peak_rss, current_rss) + + def get_stats(self) -> MemoryStats: + """Get current memory statistics.""" + if not is_psutil_available(): + return MemoryStats(0, 0, 0, 0, 0, 0, 0) + + import psutil + + self._update_peak() + + mem_info = self._process.memory_info() + sys_mem = psutil.virtual_memory() + + return MemoryStats( + rss_gib=self._to_gib(mem_info.rss), + rss_pct=self._to_pct(mem_info.rss), + vms_gib=self._to_gib(mem_info.vms), + peak_rss_gib=self._to_gib(self._peak_rss), + peak_rss_pct=self._to_pct(self._peak_rss), + available_gib=self._to_gib(sys_mem.available), + total_gib=self._to_gib(sys_mem.total), + ) + + def reset_peak_stats(self) -> None: + """Reset peak memory tracking.""" + if self._process is not None: + self._peak_rss = self._process.memory_info().rss + + +def build_cpu_memory_monitor(logger_instance: logging.Logger | None = None) -> CPUMemoryMonitor: + """Build and initialize a CPU memory monitor. + + Args: + logger_instance: Optional logger to log initialization info. If None, no logging is done. + + Returns: + CPUMemoryMonitor instance. + """ + monitor = CPUMemoryMonitor() + if logger_instance is not None: + if is_psutil_available(): + logger_instance.info(f"CPU memory monitor initialized: {monitor.total_memory_gib:.2f} GiB total") + else: + logger_instance.warning("psutil not available, memory monitoring disabled") + return monitor + + +def convert_all_safetensors_to_bins(folder: str): + """Convert all safetensors files into torch bin files, to mimic saving with torch (since we still support loading + bin files, but not saving them anymore)""" + for file in os.listdir(folder): + path = os.path.join(folder, file) + if file.endswith(".safetensors"): + new_path = path.replace(".safetensors", ".bin").replace("model", "pytorch_model") + state_dict = load_file(path) + os.remove(path) + torch.save(state_dict, new_path) + # Adapt the index as well + elif file == SAFE_WEIGHTS_INDEX_NAME: + new_path = os.path.join(folder, WEIGHTS_INDEX_NAME) + with open(path) as f: + index = json.loads(f.read()) + os.remove(path) + if "weight_map" in index.keys(): + weight_map = index["weight_map"] + new_weight_map = {} + for k, v in weight_map.items(): + new_weight_map[k] = v.replace(".safetensors", ".bin").replace("model", "pytorch_model") + index["weight_map"] = new_weight_map + with open(new_path, "w") as f: + f.write(json.dumps(index, indent=4)) + + +@contextmanager +def force_serialization_as_bin_files(): + """Since we don't support saving with torch `.bin` files anymore, but still support loading them, we use this context + to easily create the bin files and try to load them back""" + try: + # Monkey patch the method to save as bin files + original_save = PreTrainedModel.save_pretrained + + def new_save(self, save_directory, *args, **kwargs): + original_save(self, save_directory, *args, **kwargs) + convert_all_safetensors_to_bins(save_directory) + + PreTrainedModel.save_pretrained = new_save + + yield + finally: + PreTrainedModel.save_pretrained = original_save diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/time_series_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/time_series_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..ebe1a2cbd3c2819276a0cd0d6105caa5a6397f0d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/time_series_utils.py @@ -0,0 +1,225 @@ +# Copyright 2023 The HuggingFace Inc. team. +# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Time series distributional output classes and utilities. +""" + +from collections.abc import Callable + +import torch +from torch import nn +from torch.distributions import ( + AffineTransform, + Distribution, + Independent, + NegativeBinomial, + Normal, + StudentT, + TransformedDistribution, +) + + +class AffineTransformed(TransformedDistribution): + def __init__(self, base_distribution: Distribution, loc=None, scale=None, event_dim=0): + self.scale = 1.0 if scale is None else scale + self.loc = 0.0 if loc is None else loc + + super().__init__(base_distribution, [AffineTransform(loc=self.loc, scale=self.scale, event_dim=event_dim)]) + + @property + def mean(self): + """ + Returns the mean of the distribution. + """ + return self.base_dist.mean * self.scale + self.loc + + @property + def variance(self): + """ + Returns the variance of the distribution. + """ + return self.base_dist.variance * self.scale**2 + + @property + def stddev(self): + """ + Returns the standard deviation of the distribution. + """ + return self.variance.sqrt() + + +class ParameterProjection(nn.Module): + def __init__( + self, in_features: int, args_dim: dict[str, int], domain_map: Callable[..., tuple[torch.Tensor]], **kwargs + ) -> None: + super().__init__(**kwargs) + self.args_dim = args_dim + self.proj = nn.ModuleList([nn.Linear(in_features, dim) for dim in args_dim.values()]) + self.domain_map = domain_map + + def forward(self, x: torch.Tensor) -> tuple[torch.Tensor]: + params_unbounded = [proj(x) for proj in self.proj] + + return self.domain_map(*params_unbounded) + + +class LambdaLayer(nn.Module): + def __init__(self, function): + super().__init__() + self.function = function + + def forward(self, x, *args): + return self.function(x, *args) + + +class DistributionOutput: + distribution_class: type + in_features: int + args_dim: dict[str, int] + + def __init__(self, dim: int = 1) -> None: + self.dim = dim + self.args_dim = {k: dim * self.args_dim[k] for k in self.args_dim} + + def _base_distribution(self, distr_args): + if self.dim == 1: + return self.distribution_class(*distr_args) + else: + return Independent(self.distribution_class(*distr_args), 1) + + def distribution( + self, + distr_args, + loc: torch.Tensor | None = None, + scale: torch.Tensor | None = None, + ) -> Distribution: + distr = self._base_distribution(distr_args) + if loc is None and scale is None: + return distr + else: + return AffineTransformed(distr, loc=loc, scale=scale, event_dim=self.event_dim) + + @property + def event_shape(self) -> tuple: + r""" + Shape of each individual event contemplated by the distributions that this object constructs. + """ + return () if self.dim == 1 else (self.dim,) + + @property + def event_dim(self) -> int: + r""" + Number of event dimensions, i.e., length of the `event_shape` tuple, of the distributions that this object + constructs. + """ + return len(self.event_shape) + + @property + def value_in_support(self) -> float: + r""" + A float that will have a valid numeric value when computing the log-loss of the corresponding distribution. By + default 0.0. This value will be used when padding data series. + """ + return 0.0 + + def get_parameter_projection(self, in_features: int) -> nn.Module: + r""" + Return the parameter projection layer that maps the input to the appropriate parameters of the distribution. + """ + return ParameterProjection( + in_features=in_features, + args_dim=self.args_dim, + domain_map=LambdaLayer(self.domain_map), + ) + + def domain_map(self, *args: torch.Tensor): + r""" + Converts arguments to the right shape and domain. The domain depends on the type of distribution, while the + correct shape is obtained by reshaping the trailing axis in such a way that the returned tensors define a + distribution of the right event_shape. + """ + raise NotImplementedError() + + @staticmethod + def squareplus(x: torch.Tensor) -> torch.Tensor: + r""" + Helper to map inputs to the positive orthant by applying the square-plus operation. Reference: + https://twitter.com/jon_barron/status/1387167648669048833 + """ + return (x + torch.sqrt(torch.square(x) + 4.0)) / 2.0 + + +class StudentTOutput(DistributionOutput): + """ + Student-T distribution output class. + """ + + args_dim: dict[str, int] = {"df": 1, "loc": 1, "scale": 1} + distribution_class: type = StudentT + + @classmethod + def domain_map(cls, df: torch.Tensor, loc: torch.Tensor, scale: torch.Tensor): + scale = cls.squareplus(scale).clamp_min(torch.finfo(scale.dtype).eps) + df = 2.0 + cls.squareplus(df) + return df.squeeze(-1), loc.squeeze(-1), scale.squeeze(-1) + + +class NormalOutput(DistributionOutput): + """ + Normal distribution output class. + """ + + args_dim: dict[str, int] = {"loc": 1, "scale": 1} + distribution_class: type = Normal + + @classmethod + def domain_map(cls, loc: torch.Tensor, scale: torch.Tensor): + scale = cls.squareplus(scale).clamp_min(torch.finfo(scale.dtype).eps) + return loc.squeeze(-1), scale.squeeze(-1) + + +class NegativeBinomialOutput(DistributionOutput): + """ + Negative Binomial distribution output class. + """ + + args_dim: dict[str, int] = {"total_count": 1, "logits": 1} + distribution_class: type = NegativeBinomial + + @classmethod + def domain_map(cls, total_count: torch.Tensor, logits: torch.Tensor): + total_count = cls.squareplus(total_count) + return total_count.squeeze(-1), logits.squeeze(-1) + + def _base_distribution(self, distr_args) -> Distribution: + total_count, logits = distr_args + if self.dim == 1: + return self.distribution_class(total_count=total_count, logits=logits) + else: + return Independent(self.distribution_class(total_count=total_count, logits=logits), 1) + + # Overwrites the parent class method. We cannot scale using the affine + # transformation since negative binomial should return integers. Instead + # we scale the parameters. + def distribution( + self, distr_args, loc: torch.Tensor | None = None, scale: torch.Tensor | None = None + ) -> Distribution: + total_count, logits = distr_args + + if scale is not None: + # See scaling property of Gamma. + logits += scale.log() + + return self._base_distribution((total_count, logits)) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_mistral_common.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_mistral_common.py new file mode 100644 index 0000000000000000000000000000000000000000..a29ad5c59587928af3d5371de96a9fd8872853f2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_mistral_common.py @@ -0,0 +1,1665 @@ +# Copyright 2025 Mistral AI and The HuggingFace Inc. team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import os +import re +import shutil +from collections.abc import Callable, Sequence +from enum import Enum +from pathlib import Path +from typing import Any, Literal, Union, overload + +import numpy as np +from huggingface_hub import create_repo + +from transformers.audio_utils import load_audio_as +from transformers.tokenization_utils_base import ( + VERY_LARGE_INTEGER, + AddedToken, + BatchEncoding, + EncodedInput, + PreTokenizedInput, + PreTrainedTokenizerBase, + TextInput, + TruncationStrategy, +) +from transformers.utils import PaddingStrategy, TensorType, add_end_docstrings, logging, to_py_obj +from transformers.utils.import_utils import is_mistral_common_available, is_torch_available, requires + + +if is_mistral_common_available(): + from mistral_common.protocol.instruct.request import ChatCompletionRequest + from mistral_common.protocol.instruct.validator import ValidationMode + from mistral_common.tokens.tokenizers.base import SpecialTokenPolicy, SpecialTokens + from mistral_common.tokens.tokenizers.mistral import MistralTokenizer + from mistral_common.tokens.tokenizers.tekken import Tekkenizer + from mistral_common.tokens.tokenizers.utils import ( + download_tokenizer_from_hf_hub, + get_one_valid_tokenizer_file, + ) + + +if is_torch_available(): + import torch + + +logger = logging.get_logger(__name__) + + +ENCODE_KWARGS_DOCSTRING = r""" + add_special_tokens (`bool`, *optional*, defaults to `True`): + Whether or not to add special tokens when encoding the sequences. This will use the underlying + `PretrainedTokenizerBase.build_inputs_with_special_tokens` function, which defines which tokens are + automatically added to the input ids. This is useful if you want to add `bos` or `eos` tokens + automatically. When Tokenizer is loading with `finetuning` mode it adds both `bos` and `eos`. Else, for "test" mode it only adds `bos`. + padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `False`): + Activates and controls padding. Accepts the following values: + + - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single + sequence is provided). + - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum + acceptable input length for the model if that argument is not provided. + - `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different + lengths). + truncation (`bool`, `str` or [`~tokenization_utils_base.TruncationStrategy`], *optional*, defaults to `False`): + Activates and controls truncation. Accepts the following values: + + - `True` or `'longest_first'`: Truncate to a maximum length specified with the argument `max_length` or + to the maximum acceptable input length for the model if that argument is not provided. + - `False` or `'do_not_truncate'` (default): No truncation (i.e., can output batch with sequence lengths + greater than the model maximum admissible input size). + max_length (`int`, *optional*): + Controls the maximum length to use by one of the truncation/padding parameters. + + If left unset or set to `None`, this will use the predefined model maximum length if a maximum length + is required by one of the truncation/padding parameters. If the model has no specific maximum input + length (like XLNet) truncation/padding to a maximum length will be deactivated. + stride (`int`, *optional*, defaults to 0): + If set to a number along with `max_length`, the overflowing tokens returned when + `return_overflowing_tokens=True` will contain some tokens from the end of the truncated sequence + returned to provide some overlap between truncated and overflowing sequences. The value of this + argument defines the number of overlapping tokens. + pad_to_multiple_of (`int`, *optional*): + If set will pad the sequence to a multiple of the provided value. Requires `padding` to be activated. + This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability + `>= 7.5` (Volta). + padding_side (`str`, *optional*): + The side on which the model should have padding applied. Should be selected between ['right', 'left']. + Default value is picked from the class attribute of the same name. + return_tensors (`str` or [`~utils.TensorType`], *optional*): + If set, will return tensors instead of list of python integers. Acceptable values are: + + - `'pt'`: Return PyTorch `torch.Tensor` objects. +""" + +ENCODE_PLUS_ADDITIONAL_KWARGS_DOCSTRING = r""" + return_token_type_ids (`bool`, *optional*): + Whether to return token type IDs. For `MistralCommonBackend` it returns a list of zeros of the sequence length as only one sequence is supported. + + [What are token type IDs?](../glossary#token-type-ids) + return_attention_mask (`bool`, *optional*): + Whether to return the attention mask. If left to the default, will return the attention mask according + to the specific tokenizer's default, defined by the `return_outputs` attribute. + + [What are attention masks?](../glossary#attention-mask) + return_overflowing_tokens (`bool`, *optional*, defaults to `False`): + Whether or not to return overflowing token sequences. If a pair of sequences of input ids (or a batch + of pairs) is provided with `truncation_strategy = longest_first` or `True`, an error is raised instead + of returning overflowing tokens. + return_special_tokens_mask (`bool`, *optional*, defaults to `False`): + Whether or not to return special tokens mask information. + return_length (`bool`, *optional*, defaults to `False`): + Whether or not to return the lengths of the encoded inputs. + verbose (`bool`, *optional*, defaults to `True`): + Whether or not to print more information and warnings. + return_offsets_mapping (`Literal[False]`, *optional*): False, kept to match Transformers' signature. + split_special_tokens (`Literal[False]`, *optional*): False, kept to match Transformers' signature. + **kwargs: passed to the `self.tokenize()` method + + Return: + [`BatchEncoding`]: A [`BatchEncoding`] with the following fields: + + - **input_ids** -- List of token ids to be fed to a model. + + [What are input IDs?](../glossary#input-ids) + + - **attention_mask** -- List of indices specifying which tokens should be attended to by the model (when + `return_attention_mask=True` or if *"attention_mask"* is in `self.model_input_names`). + + [What are attention masks?](../glossary#attention-mask) + + - **overflowing_tokens** -- List of overflowing tokens sequences (when a `max_length` is specified and + `return_overflowing_tokens=True`). + - **num_truncated_tokens** -- Number of tokens truncated (when a `max_length` is specified and + `return_overflowing_tokens=True`). + - **special_tokens_mask** -- List of 0s and 1s, with 1 specifying added special tokens and 0 specifying + regular sequence tokens (when `add_special_tokens=True` and `return_special_tokens_mask=True`). + - **length** -- The length of the inputs (when `return_length=True`) +""" + + +class MistralTokenizerType(str, Enum): + """Enum for the different type of tokenizer.""" + + spm = "spm" + tekken = "tekken" + + +@overload +def _maybe_remove_lang(text: str, skip_special_tokens: bool) -> str: ... +@overload +def _maybe_remove_lang(text: list[str], skip_special_tokens: bool) -> list[str]: ... +def _maybe_remove_lang(text: str | list[str], skip_special_tokens: bool) -> str | list[str]: + # in the specific case of Voxtral, the added f"lang:xx" (always a two char language code since it follows ISO 639-1 alpha-2 format) + # is not considered as a special token by mistral-common and is encoded/ decoded as normal text. + # Nevertheless we should remove it to ease users life. + if not skip_special_tokens: + return text + + if isinstance(text, str): + return re.sub(r"^lang:[a-z]{2}", "", text) + + return [re.sub(r"^lang:[a-z]{2}", "", string) for string in text] + + +_MAP_SPECIAL_TOKENS = { + "bos_token": SpecialTokens.bos.value, + "eos_token": SpecialTokens.eos.value, + "pad_token": SpecialTokens.pad.value, + "unk_token": SpecialTokens.unk.value, +} + +_VALID_INIT_KWARGS = {"_from_auto", "backend", "files_loaded"} + + +@requires(backends=("mistral-common",)) +class MistralCommonBackend(PreTrainedTokenizerBase): + """ + Class to wrap `mistral-common` tokenizers. + + `mistral-common` is the official tokenizer library for Mistral AI models. To use it, you need to install it with: + + ```bash + pip install transformers[mistral-common] + ``` + + Otherwise the tokenizer falls back to the Transformers implementation of the tokenizer. + + For more info on `mistral-common`, see [mistral-common](https://github.com/mistralai/mistral-common). + + This class is a wrapper around a `mistral_common.tokens.tokenizers.mistral.MistralTokenizer`. + It provides a Hugging Face compatible interface to tokenize using the official mistral-common tokenizer and inherits from the `PreTrainedTokenizerBase` class. + + Here are the key behavior differences with the `PythonBackend` class: + + - Pair of sequences are not supported. The signature has been kept for compatibility but all arguments related to pair of sequences are ignored. The return values for pairs are returned as `None`. + - The `is_split_into_words` argument is not supported. + - It is not possible to add new tokens to the tokenizer. Special tokens are handled differently from Transformers. In `mistral-common`, special tokens are never encoded directly. This means that: `tokenizer.encode("")` will not return the ID of the `` token. Instead, it will return a list of IDs corresponding to the tokenization of the string `""`. For more information, see the [mistral-common documentation](https://mistralai.github.io/mistral-common/usage/tokenizers/#special-tokens). + + If you have suggestions to improve this class, please open an issue on the [mistral-common GitHub repository](https://github.com/mistralai/mistral-common/issues) if it is related to the tokenizer or on the [Transformers GitHub repository](https://github.com/huggingface/transformers/issues) if it is related to the Hugging Face interface. + """ + + model_input_names: list[str] = ["input_ids", "attention_mask"] + padding_side: str = "left" + truncation_side: str = "right" + SPECIAL_TOKENS_ATTRIBUTES = [ + "bos_token", + "eos_token", + "unk_token", + "pad_token", + ] + + def __init__( + self, + tokenizer_path: str | os.PathLike | Path, + mode: ValidationMode = ValidationMode.test, + model_max_length: int = VERY_LARGE_INTEGER, + padding_side: str = "left", + truncation_side: str = "right", + model_input_names: list[str] | None = None, + clean_up_tokenization_spaces: bool = False, + **kwargs, + ): + """ + Constructs a `MistralCommonBackend`. + + - **model_input_names** (`list[str]`) -- A list of inputs expected in the forward pass of the model. + - **padding_side** (`str`) -- The default value for the side on which the model should have padding applied. + Should be `'right'` or `'left'`. + - **truncation_side** (`str`) -- The default value for the side on which the model should have truncation + applied. Should be `'right'` or `'left'`. + + Args: + tokenizer_path (`str` or `os.PathLike` or `Path`): + Path to the tokenizer file to load the `MistralTokenizer`. + mode (`Union[str, ValidationMode]`, *optional*, defaults to `ValidationMode.test`): + The mode to use for the tokenizer. This will be passed to the `MistralTokenizer` constructor. Possible values are: + - `"finetuning"` or `ValidationMode.finetuning`: The fine-tuning mode. + - `"test"` or `ValidationMode.test`: The test mode. + It changes how the tokenizer validates the input and prepares the request to the model. + model_max_length (`int`, *optional*): + The maximum length (in number of tokens) for the inputs to the transformer model. When the tokenizer is + loaded with [`~tokenization_utils_base.PreTrainedTokenizerBase.from_pretrained`], this will be set to the + value stored for the associated model in `max_model_input_sizes` (see above). If no value is provided, will + default to VERY_LARGE_INTEGER (`int(1e30)`). + padding_side (`str`, *optional*): + The side on which the model should have padding applied. Should be selected between ['right', 'left']. + Default value is picked from the class attribute of the same name. + truncation_side (`str`, *optional*): + The side on which the model should have truncation applied. Should be selected between ['right', 'left']. + Default value is picked from the class attribute of the same name. + model_input_names (`List[str]`, *optional*): + The list of inputs accepted by the forward pass of the model (like `"token_type_ids"` or + `"attention_mask"`). Default value is picked from the class attribute of the same name. + clean_up_tokenization_spaces (`bool`, *optional*, defaults to `False`): + Whether or not the model should clean up the spaces that were added when splitting the input text during the + tokenization process. + """ + if kwargs and not set(kwargs.keys()).issubset(_VALID_INIT_KWARGS): + raise ValueError(f"Kwargs {list(kwargs.keys())} are not supported to init `MistralCommonBackend`.") + + self.init_kwargs = { + "tokenizer_path": tokenizer_path, + "mode": mode, + "model_max_length": model_max_length, + "padding_side": padding_side, + "truncation_side": truncation_side, + "model_input_names": model_input_names, + "clean_up_tokenization_spaces": clean_up_tokenization_spaces, + } + self._tokenizer_path = Path(tokenizer_path) + self._mode = self._get_validation_mode(mode) + + self.tokenizer: MistralTokenizer = MistralTokenizer.from_file(str(self._tokenizer_path), mode=self._mode) + self._tokenizer_type = ( + MistralTokenizerType.tekken + if isinstance(self.tokenizer.instruct_tokenizer.tokenizer, Tekkenizer) + else MistralTokenizerType.spm + ) + self._cache_get_vocab: dict[str, int] | None = None + + self._all_special_ids = self._get_all_special_ids() + self._all_special_tokens = self.convert_ids_to_tokens(self.all_special_ids) + + super().__init__( + truncation_side=truncation_side, + padding_side=padding_side, + model_max_length=model_max_length, + clean_up_tokenization_spaces=clean_up_tokenization_spaces, + extra_special_tokens=None, # Not used by this backend. + model_specific_special_tokens=None, # Not used by this backend. + model_input_names=model_input_names or self.model_input_names, + **_MAP_SPECIAL_TOKENS, + **kwargs, + ) + + @property + def mode(self) -> ValidationMode: + """ + `ValidationMode`: The mode used by the tokenizer. Possible values are: + - `"finetuning"` or `ValidationMode.finetuning`: The finetuning mode. + - `"test"` or `ValidationMode.test`: The test mode. + It changes how the tokenizer validates the input and prepares the request to the model. + """ + return self._mode + + @property + def all_special_ids(self) -> list[int]: + """ + `list[int]`: List the ids of the special tokens(`''`, `''`, etc.). + """ + return sorted(self._all_special_ids) + + @property + def all_special_tokens(self) -> list[str]: + """ + `list[str]`: A list of all unique special tokens. + """ + return self._all_special_tokens + + @property + def vocab_size(self) -> int: + """ + Returns the size of the vocabulary. + + `int`: Size of the vocabulary. + """ + return self.tokenizer.instruct_tokenizer.tokenizer.n_words + + def get_vocab(self) -> dict[str, int]: + """ + Returns the vocabulary as a dictionary of token to index. + + This is a lossy conversion. There may be multiple token ids that decode to the same + string due to partial UTF-8 byte sequences being converted to �. + + Returns: + `Dict[str, int]`: The vocabulary. + """ + if self._cache_get_vocab is None: + # We reverse the order to make sure that the first token is the one to be returned when there are multiple tokens with the same string representation. + vocab = self.tokenizer.instruct_tokenizer.tokenizer.vocab() + self._cache_get_vocab = {token: self._piece_to_id(token, False) for token in vocab} + # Order the dict. + self._cache_get_vocab = dict( + sorted(((k, v) for k, v in self._cache_get_vocab.items()), key=lambda x: x[1]) + ) + return self._cache_get_vocab + + def __len__(self): + """ + Size of the full vocabulary with the added tokens. + """ + return self.vocab_size + + @add_end_docstrings( + ENCODE_KWARGS_DOCSTRING, + """ + **kwargs: Not supported by `MistralCommonBackend.encode`. + Will raise an error if used. + """, + """ + Returns: + `list[int]`, `torch.Tensor`: The tokenized ids of the text. + """, + ) + def encode( + self, + text: TextInput | EncodedInput, + text_pair: None = None, + add_special_tokens: bool = True, + padding: bool | str | PaddingStrategy = False, + truncation: bool | str | TruncationStrategy | None = None, + max_length: int | None = None, + stride: int = 0, + pad_to_multiple_of: int | None = None, + padding_side: str | None = None, + return_tensors: str | TensorType | None = None, + verbose: bool = True, + return_offsets_mapping: Literal[False] = False, + split_special_tokens: Literal[False] = False, + **kwargs, + ) -> list[int]: + """ + Converts a string to a sequence of ids (integer), using the tokenizer and vocabulary. + + Args: + text (`str` or `list[int]`): + The first sequence to be encoded. This can be a string or a list of integers (tokenized string ids). + text_pair (`None`, *optional*): + Not supported by `MistralCommonBackend.encode`. Kept to match `PreTrainedTokenizerBase.encode` signature. + """ + if return_offsets_mapping or split_special_tokens: + raise ValueError( + "`MistralCommonBackend` does not support `return_offsets_mapping` and `split_special_tokens`." + ) + + if truncation in [TruncationStrategy.ONLY_FIRST, TruncationStrategy.ONLY_SECOND, "only_first", "only_second"]: + raise ValueError( + "Truncation strategy `only_first` and `only_second` are not supported by `MistralCommonBackend`." + ) + + if kwargs: + raise ValueError(f"Kwargs {list(kwargs.keys())} are not supported by `MistralCommonBackend.encode`.") + + if text_pair: + raise ValueError("`MistralCommonBackend.encode` does not support `text_pair`.") + + return super().encode( + text=text, + text_pair=text_pair, + add_special_tokens=add_special_tokens, + padding=padding, + truncation=truncation, + max_length=max_length, + stride=stride, + return_tensors=return_tensors, + pad_to_multiple_of=pad_to_multiple_of, + padding_side=padding_side, + verbose=verbose, + ) + + def _decode( + self, + token_ids: int | list[int], + skip_special_tokens: bool = False, + clean_up_tokenization_spaces: bool | None = None, + **kwargs, + ) -> str: + if kwargs: + raise ValueError(f"Kwargs {list(kwargs.keys())} are not supported by `MistralCommonBackend.decode`.") + + token_ids = to_py_obj(token_ids) + + if isinstance(token_ids, int): + token_ids = [token_ids] + + special_token_policy = SpecialTokenPolicy.IGNORE if skip_special_tokens else SpecialTokenPolicy.KEEP + + text = self.tokenizer.decode(token_ids, special_token_policy=special_token_policy) + + # Apply tokenizer-specific cleanup if available and requested + clean_up_tokenization_spaces = ( + clean_up_tokenization_spaces + if clean_up_tokenization_spaces is not None + else self.clean_up_tokenization_spaces + ) + if clean_up_tokenization_spaces: + # Call custom cleanup method if it exists (e.g., for CLVP's [SPACE] token replacement) + if hasattr(self, "clean_up_tokenization") and callable(self.clean_up_tokenization): + text = self.clean_up_tokenization(text) + else: + # Otherwise apply standard cleanup + text = ( + text.replace(" .", ".") + .replace(" ?", "?") + .replace(" !", "!") + .replace(" ,", ",") + .replace(" ' ", "'") + .replace(" n't", "n't") + .replace(" 'm", "'m") + .replace(" 's", "'s") + .replace(" 've", "'ve") + .replace(" 're", "'re") + ) + + return _maybe_remove_lang(text=text, skip_special_tokens=skip_special_tokens) + + def decode( + self, + token_ids: Union[int, list[int], list[list[int]], np.ndarray, "torch.Tensor"], + skip_special_tokens: bool = False, + clean_up_tokenization_spaces: bool | None = None, + **kwargs, + ) -> str | list[str]: + """ + Converts a sequence of ids in a string, using the tokenizer and vocabulary with options to remove special + tokens and clean up tokenization spaces. + + Args: + token_ids (`Union[int, list[int], list[list[int]], np.ndarray, torch.Tensor]`): + A single sequence or a batch (list of sequences) of tokenized input ids. Can be obtained using the + `__call__` method. + skip_special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not to remove special tokens in the decoding. + clean_up_tokenization_spaces (`bool`, *optional*): + Whether or not to clean up the tokenization spaces. If `None`, will default to + `self.clean_up_tokenization_spaces`. + kwargs (additional keyword arguments, *optional*): + Not supported by `MistralCommonBackend.decode`. + Will raise an error if used. + + Returns: + `Union[str, list[str]]`: The decoded string for a single sequence, or a list of decoded strings for a + batch of sequences. + """ + if kwargs: + raise ValueError(f"Kwargs {list(kwargs.keys())} are not supported by `MistralCommonBackend.decode`.") + + return super().decode( + token_ids=token_ids, + skip_special_tokens=skip_special_tokens, + clean_up_tokenization_spaces=clean_up_tokenization_spaces, + ) + + def batch_decode( + self, + sequences: Union[list[int], list[list[int]], np.ndarray, "torch.Tensor"], + skip_special_tokens: bool = False, + clean_up_tokenization_spaces: bool | None = None, + **kwargs, + ) -> list[str]: + """ + Convert a list of lists of token ids into a list of strings by calling decode. + + This method is provided for backwards compatibility. The `decode` method now handles batched input natively, + so you can use `decode` directly instead of `batch_decode`. + + Args: + sequences (`Union[list[int], list[list[int]], np.ndarray, torch.Tensor]`): + List of tokenized input ids. Can be obtained using the `__call__` method. + skip_special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not to remove special tokens in the decoding. + clean_up_tokenization_spaces (`bool`, *optional*): + Whether or not to clean up the tokenization spaces. If `None`, will default to + `self.clean_up_tokenization_spaces`. + kwargs (additional keyword arguments, *optional*): + Not supported by `MistralCommonBackend.batch_decode`. + Will raise an error if used. + + Returns: + `list[str]`: The list of decoded sentences. + """ + if kwargs: + raise ValueError(f"Kwargs {list(kwargs.keys())} are not supported by `MistralCommonBackend.batch_decode`.") + + return super().batch_decode( + sequences=sequences, + skip_special_tokens=skip_special_tokens, + clean_up_tokenization_spaces=clean_up_tokenization_spaces, + ) + + @overload + def convert_ids_to_tokens(self, ids: int, skip_special_tokens: bool = False) -> str: ... + @overload + def convert_ids_to_tokens(self, ids: list[int], skip_special_tokens: bool = False) -> list[str]: ... + def convert_ids_to_tokens(self, ids: int | list[int], skip_special_tokens: bool = False) -> str | list[str]: + """ + Converts a single index or a sequence of indices in a token or a sequence of tokens, using the vocabulary and + added tokens. + + Args: + ids (`int` or `list[int]`): + The token id (or token ids) to convert to tokens. + skip_special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not to remove special tokens in the decoding. + + Returns: + `str` or `list[str]`: The decoded token(s). + """ + + if isinstance(ids, int): + return_int = True + ids = [ids] + else: + return_int = False + + tokens: list[str] = [] + for token_id in ids: + if self.tokenizer.instruct_tokenizer.tokenizer.is_special(token_id) and skip_special_tokens: + continue + tokens.append(self.tokenizer.instruct_tokenizer.tokenizer.id_to_piece(token_id)) + + if return_int and tokens == []: + raise ValueError(f"Invalid token id {ids[0]}.") + elif return_int: + return tokens[0] + + return tokens + + def _tekken_piece_to_id(self, piece: str, warn: bool) -> int: + tekken_tokenizer = self.tokenizer.instruct_tokenizer.tokenizer + assert isinstance(tekken_tokenizer, Tekkenizer), type(tekken_tokenizer) + + piece_bytes = piece.encode("utf-8") + shift = tekken_tokenizer.num_special_tokens + try: + return shift + tekken_tokenizer._tekken_token2id_nospecial[piece_bytes] + except KeyError: + piece_str = piece_bytes.decode("utf-8") + if piece_str in tekken_tokenizer._special_tokens_reverse_vocab: + return tekken_tokenizer._special_tokens_reverse_vocab[piece_str] + if warn: + logger.warning("Failed to convert token %s to id, replacing with ", piece_bytes) + return tekken_tokenizer.unk_id + + def _piece_to_id(self, piece: str, warn: bool) -> int: + if self._tokenizer_type == MistralTokenizerType.spm: + return self.tokenizer.instruct_tokenizer.tokenizer._model.piece_to_id(piece) + elif self._tokenizer_type == MistralTokenizerType.tekken: + return self._tekken_piece_to_id(piece, warn) + else: + raise ValueError(f"Unknown tokenizer type: {self._tokenizer_type}") + + def convert_tokens_to_ids(self, tokens: str | list[str]) -> int | list[int]: + """ + Converts a token string (or a sequence of tokens) in a single integer id (or a sequence of ids), using the + vocabulary. + + Args: + tokens (`str` or `list[str]`): One or several token(s) to convert to token id(s). + + Returns: + `int` or `list[int]`: The token id or list of token ids. + """ + + if isinstance(tokens, str): + one_token = True + tokens = [tokens] + else: + one_token = False + + ids: list[int] = [] + for token in tokens: + ids.append(self._piece_to_id(token, True)) + + if one_token: + return ids[0] + return ids + + def _text_to_ids(self, text: TextInput, add_special_tokens: bool) -> list[int]: + """ + Converts a string into a sequence of tokens ids, using the tokenizer. + """ + add_eos = add_special_tokens and self._mode == ValidationMode.finetuning + tokens_ids = self.tokenizer.instruct_tokenizer.tokenizer.encode(text, bos=add_special_tokens, eos=add_eos) + return tokens_ids + + def tokenize( + self, + text: TextInput, + return_offsets_mapping: Literal[False] = False, + split_special_tokens: Literal[False] = False, + **kwargs, + ) -> list[str]: + """ + Converts a string into a sequence of tokens, using the tokenizer. + + Split in words for word-based vocabulary or sub-words for sub-word-based vocabularies. + + Args: + text (`str`): + The sequence to be encoded. + return_offsets_mapping (`Literal[False]`, *optional*): False, kept to match Transformers' signature. + split_special_tokens (`Literal[False]`, *optional*): False, kept to match Transformers' signature. + **kwargs (additional keyword arguments): + Not supported by `MistralCommonBackend.tokenize`. + Will raise an error if used. + + Returns: + `list[str]`: The list of tokens. + """ + if return_offsets_mapping or split_special_tokens: + raise ValueError( + "`MistralCommonBackend` does not support `return_offsets_mapping` and `split_special_tokens`." + ) + + if kwargs: + raise ValueError(f"Kwargs {list(kwargs.keys())} are not supported by `MistralCommonBackend.tokenize`.") + + return self.convert_ids_to_tokens(self._text_to_ids(text, add_special_tokens=False), skip_special_tokens=False) + + def _get_all_special_ids(self) -> set[int]: + if self._tokenizer_type == MistralTokenizerType.tekken: + return self.tokenizer.instruct_tokenizer.tokenizer._special_token_ids + elif self._tokenizer_type == MistralTokenizerType.spm: + return { + token_id + for token_id in range(self.tokenizer.instruct_tokenizer.tokenizer.n_words) + if self.tokenizer.instruct_tokenizer.tokenizer.is_special(token_id) + } + else: + raise ValueError(f"Unknown tokenizer type: {self._tokenizer_type}") + + def get_special_tokens_mask( + self, token_ids_0: list[int], token_ids_1: None = None, already_has_special_tokens: bool = False + ) -> list[int]: + """ + Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding + special tokens using the tokenizer `prepare_for_model` or `encode_plus` methods. + + Args: + token_ids_0 (`list[int]`): List of ids of the sequence. + token_ids_1 (`None`, *optional*): None, kept to match Transformers' implementation. + already_has_special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not the token list is already formatted with special tokens for the model. + + Returns: + A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token. + """ + if token_ids_1 is not None: + raise ValueError( + "`token_ids_1` is not supported by `MistralCommonBackend` and should be `None`, kept for compatibility." + ) + + if already_has_special_tokens: + return [1 if int(token_id) in self._all_special_ids else 0 for token_id in token_ids_0] + + if self.mode == ValidationMode.test: + # [BOS] seq0 + return [1] + ([0] * len(token_ids_0)) + else: + # [BOS] seq0 [EOS] + return [1] + ([0] * len(token_ids_0)) + [1] + + def _encode_plus( # type: ignore[override] + self, + text: TextInput | PreTokenizedInput | EncodedInput, + text_pair: None = None, + add_special_tokens: bool = True, + padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD, + truncation_strategy: TruncationStrategy = TruncationStrategy.DO_NOT_TRUNCATE, + max_length: int | None = None, + stride: int = 0, + is_split_into_words: bool = False, + pad_to_multiple_of: int | None = None, + padding_side: str | None = None, + return_tensors: str | TensorType | None = None, + return_token_type_ids: bool | None = None, + return_attention_mask: bool | None = None, + return_overflowing_tokens: bool = False, + return_special_tokens_mask: bool = False, + return_length: bool = False, + verbose: bool = True, + return_offsets_mapping: Literal[False] = False, + split_special_tokens: Literal[False] = False, + **kwargs, + ) -> BatchEncoding: + # Detect batched inputs (list of sequences) + if text_pair is not None: + raise ValueError("`MistralCommonBackend` does not support `text_pair != None` for `_encode_plus`.") + + if return_offsets_mapping or split_special_tokens: + raise ValueError( + "`MistralCommonBackend` does not support `return_offsets_mapping` and `split_special_tokens`." + ) + + if kwargs: + raise ValueError(f"Kwargs {list(kwargs.keys())} are not supported by `MistralCommonBackend._encode_plus`.") + + is_batched = isinstance(text, (list, tuple)) and ( + (not text and not is_split_into_words) + or (text and is_split_into_words and isinstance(text[0], (list, tuple))) + or (text and not is_split_into_words and isinstance(text[0], (str, list, tuple))) + ) + + if is_batched: + batch_outputs = {} + one_overflowed = False + for current_text in text: + current_output = self._encode_plus( + text=current_text, + text_pair=None, + add_special_tokens=add_special_tokens, + padding_strategy=PaddingStrategy.DO_NOT_PAD, # we pad in batch afterward + truncation_strategy=truncation_strategy, + max_length=max_length, + stride=stride, + is_split_into_words=is_split_into_words, + pad_to_multiple_of=None, # we pad in batch afterward + padding_side=None, # we pad in batch afterward + return_tensors=None, # We convert the whole batch to tensors at the end + return_token_type_ids=return_token_type_ids, + return_attention_mask=False, # we pad in batch afterward + return_overflowing_tokens=return_overflowing_tokens, + return_special_tokens_mask=return_special_tokens_mask, + return_length=return_length, + verbose=verbose, + ) + for key, value in current_output.items(): + batch_outputs.setdefault(key, []).append(value) + + # To ensure the list is built for each sample, we need to add this. + if return_overflowing_tokens and not return_tensors: + if "overflowing_tokens" not in current_output: + batch_outputs.setdefault("overflowing_tokens", []).append([0]) + batch_outputs.setdefault("num_truncated_tokens", []).append([0]) + else: + one_overflowed = True + + # Remove overflow-related keys before tensor conversion if return_tensors is set + # Slow tokenizers don't support returning these as tensors + if return_overflowing_tokens and (return_tensors or not one_overflowed): + batch_outputs.pop("overflowing_tokens", None) + batch_outputs.pop("num_truncated_tokens", None) + + batch_outputs = self.pad( + batch_outputs, + padding=padding_strategy.value, + max_length=max_length, + pad_to_multiple_of=pad_to_multiple_of, + padding_side=padding_side, + return_attention_mask=return_attention_mask, + ) + + return BatchEncoding(batch_outputs, tensor_type=return_tensors) + + def get_input_ids(text): + if isinstance(text, str): + return self._text_to_ids(text, False) + elif isinstance(text, (list, tuple)) and len(text) > 0 and isinstance(text[0], int): + return text + else: + raise ValueError(f"Input {text} is not valid. Should be a string, or a list/tuple of integers.") + + first_ids = get_input_ids(text) + + return self.prepare_for_model( + first_ids, + pair_ids=None, + add_special_tokens=add_special_tokens, + padding=padding_strategy.value, + truncation=truncation_strategy.value, + max_length=max_length, + stride=stride, + pad_to_multiple_of=pad_to_multiple_of, + padding_side=padding_side, + return_tensors=return_tensors, + prepend_batch_axis=True, + return_attention_mask=return_attention_mask, + return_token_type_ids=return_token_type_ids, + return_overflowing_tokens=return_overflowing_tokens, + return_special_tokens_mask=return_special_tokens_mask, + return_length=return_length, + verbose=verbose, + ) + + @add_end_docstrings(ENCODE_KWARGS_DOCSTRING, ENCODE_PLUS_ADDITIONAL_KWARGS_DOCSTRING) + def prepare_for_model( + self, + ids: list[int], + pair_ids: None = None, + add_special_tokens: bool = True, + padding: bool | str | PaddingStrategy = False, + truncation: bool | str | TruncationStrategy | None = None, + max_length: int | None = None, + stride: int = 0, + pad_to_multiple_of: int | None = None, + padding_side: str | None = None, + return_tensors: str | TensorType | None = None, + return_token_type_ids: bool | None = None, + return_attention_mask: bool | None = None, + return_overflowing_tokens: bool = False, + return_special_tokens_mask: bool = False, + return_length: bool = False, + verbose: bool = True, + prepend_batch_axis: bool = False, + return_offsets_mapping: Literal[False] = False, + split_special_tokens: Literal[False] = False, + **kwargs, + ) -> BatchEncoding: + """ + Prepares a sequence of input id so that it can be used by the model. It + adds special tokens, truncates sequences if overflowing while taking into account the special tokens and + manages a moving window (with user defined stride) for overflowing tokens. + + Args: + ids (`list[int]`): + Tokenized input ids of the first sequence. + pair_ids (`None`, *optional*): + Not supported by `MistralCommonBackend`. Kept to match the interface of `PreTrainedTokenizerBase`. + """ + if return_offsets_mapping or split_special_tokens: + raise ValueError( + "`MistralCommonBackend` does not support `return_offsets_mapping` and `split_special_tokens`." + ) + + if pair_ids is not None: + raise ValueError( + "`pair_ids` is not supported by `MistralCommonBackend` and should be `None`, kept for compatibility." + ) + + if kwargs: + raise ValueError( + f"Kwargs {list(kwargs.keys())} are not supported by `MistralCommonBackend.prepare_for_model`." + ) + + padding_strategy, truncation_strategy, max_length, _ = self._get_padding_truncation_strategies( + padding=padding, + truncation=truncation, + max_length=max_length, + pad_to_multiple_of=pad_to_multiple_of, + verbose=verbose, + **kwargs, + ) + + # Validation + if ( + return_overflowing_tokens + and truncation_strategy == TruncationStrategy.LONGEST_FIRST + and pair_ids is not None + ): + raise ValueError( + "Not possible to return overflowing tokens for pair of sequences with the " + "`longest_first`. Please select another truncation strategy than `longest_first`, " + "for instance `only_second` or `only_first`." + ) + + # Defaults + if return_token_type_ids is None: + return_token_type_ids = "token_type_ids" in self.model_input_names + if return_attention_mask is None: + return_attention_mask = "attention_mask" in self.model_input_names + + # Truncation + num_special = self.num_special_tokens_to_add(pair=False) if add_special_tokens else 0 + total_len = len(ids) + len(pair_ids or []) + num_special + + overflowing_tokens = [] + if truncation_strategy != TruncationStrategy.DO_NOT_TRUNCATE and max_length and total_len > max_length: + ids, _, overflowing_tokens = self.truncate_sequences( + ids, + pair_ids=None, + num_tokens_to_remove=total_len - max_length, + truncation_strategy=truncation_strategy, + stride=stride, + ) + + # Add special tokens + if add_special_tokens: + sequence = self.build_inputs_with_special_tokens(ids, None) + token_type_ids = self.create_token_type_ids_from_sequences(ids, None) + else: + sequence = ids + token_type_ids = [0] * len(sequence) + + # Build output + encoded_inputs = {"input_ids": sequence} + if return_token_type_ids: + encoded_inputs["token_type_ids"] = token_type_ids + if return_special_tokens_mask: + encoded_inputs["special_tokens_mask"] = ( + self.get_special_tokens_mask(ids, None) if add_special_tokens else [0] * len(sequence) + ) + if return_overflowing_tokens and not return_tensors and overflowing_tokens: + encoded_inputs["overflowing_tokens"] = overflowing_tokens + encoded_inputs["num_truncated_tokens"] = total_len - max_length if max_length else 0 + + # Check sequence length and warn if needed + self._eventual_warn_about_too_long_sequence(encoded_inputs["input_ids"], max_length, verbose) + + # Pad + if padding_strategy != PaddingStrategy.DO_NOT_PAD or return_attention_mask: + encoded_inputs = self.pad( + encoded_inputs, + max_length=max_length, + padding=padding_strategy.value, + pad_to_multiple_of=pad_to_multiple_of, + padding_side=padding_side, + return_attention_mask=return_attention_mask, + ) + + if return_length: + encoded_inputs["length"] = len(encoded_inputs["input_ids"]) + + return BatchEncoding(encoded_inputs, tensor_type=return_tensors, prepend_batch_axis=prepend_batch_axis) + + def truncate_sequences( # type: ignore[override] + self, + ids: list[int], + pair_ids: None = None, + num_tokens_to_remove: int = 0, + truncation_strategy: str | TruncationStrategy = "longest_first", + stride: int = 0, + **kwargs, + ) -> tuple[list[int], None, list[int]]: + """ + Truncates a sequence pair in-place following the strategy. + + Args: + ids (`list[int]`): + Tokenized input ids. Can be obtained from a string by chaining the `tokenize` and + `convert_tokens_to_ids` methods. + pair_ids (`None`, *optional*): + Not supported by `MistralCommonBackend`. Kept to match the signature of `PreTrainedTokenizerBase.truncate_sequences`. + num_tokens_to_remove (`int`, *optional*, defaults to 0): + Number of tokens to remove using the truncation strategy. + truncation_strategy (`str` or [`~tokenization_utils_base.TruncationStrategy`], *optional*, defaults to `'longest_first'`): + The strategy to follow for truncation. Can be: + + - `'longest_first'`: Truncate to a maximum length specified with the argument `max_length` or to the + maximum acceptable input length for the model if that argument is not provided. + - `'do_not_truncate'` (default): No truncation (i.e., can output batch with sequence lengths greater + than the model maximum admissible input size). + stride (`int`, *optional*, defaults to 0): + If set to a positive number, the overflowing tokens returned will contain some tokens from the main + sequence returned. The value of this argument defines the number of additional tokens. + + Returns: + `Tuple[list[int], None, list[int]]`: The truncated `ids` and the list of + overflowing tokens. `None` is returned to match Transformers signature. + """ + + if pair_ids: + raise ValueError("`pair_ids` is not supported by `MistralCommonBackend.truncate_sequences`.") + + if not isinstance(truncation_strategy, TruncationStrategy): + truncation_strategy = TruncationStrategy(truncation_strategy) + + if truncation_strategy in [ + TruncationStrategy.ONLY_FIRST, + TruncationStrategy.ONLY_SECOND, + ]: + raise ValueError(f"{truncation_strategy=} is not supported by `MistralCommonBackend`.") + + if num_tokens_to_remove <= 0: + return ids, None, [] + + overflowing_tokens = [] + + if truncation_strategy == TruncationStrategy.LONGEST_FIRST: + window_len = min(len(ids), stride + num_tokens_to_remove) + if self.truncation_side == "left": + overflowing_tokens = ids[:window_len] + ids = ids[num_tokens_to_remove:] + else: + overflowing_tokens = ids[-window_len:] + ids = ids[:-num_tokens_to_remove] + + return ids, None, overflowing_tokens + + def apply_chat_template( # type: ignore[override] + self, + conversation: list[dict[str, str]] | list[list[dict[str, str]]], + tools: list[dict | Callable] | None = None, + add_generation_prompt: bool = False, + continue_final_message: bool = False, + tokenize: bool = True, + padding: bool | str | PaddingStrategy = False, + truncation: bool = False, + max_length: int | None = None, + return_tensors: str | TensorType | None = None, + return_dict: bool = True, + **kwargs, + ) -> str | list[int] | list[str] | list[list[int]] | BatchEncoding: + """ + Converts a list of dictionaries with `"role"` and `"content"` keys to a list of token + ids. + + Args: + conversation (Union[List[Dict[str, str]], List[List[Dict[str, str]]]]): A list of dicts + with "role" and "content" keys, representing the chat history so far. + tools (`List[Union[Dict, Callable]]`, *optional*): + A list of tools (callable functions) that will be accessible to the model. If the template does not + support function calling, this argument will have no effect. Each tool should be passed as a JSON Schema, + giving the name, description and argument types for the tool. See our + [chat templating guide](https://huggingface.co/docs/transformers/main/en/chat_templating#automated-function-conversion-for-tool-use) + for more information. + add_generation_prompt (`bool`, *optional*): + This argument is a no-op for `MistralCommonBackend`. However, it cannot be used at the same time as `continue_final_message` to keep the API consistent. + If any conversation ends with an assistant message, it will raise an error. In such cases, use `continue_final_message` instead. + continue_final_message (bool, *optional*): + If this is set, the chat will be formatted so that the final + message in the chat is open-ended, without any EOS tokens. The model will continue this message + rather than starting a new one. This allows you to "prefill" part of + the model's response for it. Cannot be used at the same time as `add_generation_prompt`. + tokenize (`bool`, defaults to `True`): + Whether to tokenize the output. If `False`, the output will be a string. + padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `False`): + Select a strategy to pad the returned sequences (according to the model's padding side and padding + index) among: + + - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single + sequence if provided). + - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum + acceptable input length for the model if that argument is not provided. + - `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different + lengths). + truncation (`bool`, defaults to `False`): + Whether to truncate sequences at the maximum length. Has no effect if tokenize is `False`. + max_length (`int`, *optional*): + Maximum length (in tokens) to use for padding or truncation. Has no effect if tokenize is `False`. If + not specified, the tokenizer's `max_length` attribute will be used as a default. + return_tensors (`str` or [`~utils.TensorType`], *optional*): + If set, will return tensors of a particular framework. Has no effect if tokenize is `False`. Acceptable + values are: + - `'pt'`: Return PyTorch `torch.Tensor` objects. + return_dict (`bool`, defaults to `False`): + Whether to return a dictionary with named outputs. Has no effect if tokenize is `False`. + If at least one conversation contains an image, its pixel values will be returned in the `pixel_values` key. + kwargs (additional keyword arguments, *optional*): + Not supported by `MistralCommonBackend.apply_chat_template`. + Will raise an error if used. + + Returns: + `Union[str, list[int], list[str], list[list[int]], BatchEncoding]`: The tokenized chat so far, including control tokens. This output is ready to pass to the model, either directly or via methods like `generate()`. + """ + if kwargs: + raise ValueError( + f"Kwargs {list(kwargs.keys())} are not supported by `MistralCommonBackend.apply_chat_template`." + ) + if not isinstance(truncation, bool): + raise TypeError("`truncation` must be a boolean for `apply_chat_template` method.") + + if add_generation_prompt and continue_final_message: + raise ValueError("Cannot use both `add_generation_prompt` and `continue_final_message`.") + + if isinstance(conversation, (list, tuple)) and ( + isinstance(conversation[0], (list, tuple)) or hasattr(conversation[0], "messages") + ): + conversations = conversation + is_batched = True + else: + conversations = [conversation] + is_batched = False + + if add_generation_prompt: + for conversation in conversations: + last_message = conversation[-1] + if last_message.get("role") == "assistant": + raise ValueError( + "The last message in the conversation is already an assistant message. Consider using `continue_final_message` instead." + ) + + def _maybe_adapt_message(message: dict[str, Any]) -> None: + """Adapt message to `mistral-common` format and leave validation to `mistral-common`.""" + if not isinstance(message, dict): + return message + maybe_list_content: str | list[dict[str, str | dict[str, Any]]] | None = message.get("content") + if not maybe_list_content or isinstance(maybe_list_content, str): + return message + + normalized_content: list[dict[str, str | dict[str, Any]]] = [] + message = message.copy() + for content in maybe_list_content: + content_type = content.get("type", None) + if not content_type: + continue + elif content_type == "image": + maybe_url: str | None = content.get("url") + maybe_path: str | None = content.get("path") + maybe_base64: str | None = content.get("base64") + if maybe_url: + image_content = maybe_url + elif maybe_path: + if not maybe_path.startswith("file://"): + maybe_path = Path(maybe_path).resolve().as_uri() + image_content = maybe_path + elif maybe_base64: + if not maybe_base64.startswith("data:image"): + maybe_base64 = "data:image/unk;base64," + maybe_base64 + image_content = maybe_base64 + else: + raise ValueError("Image content must be specified.") + normalized_content.append({"type": "image_url", "image_url": {"url": image_content}}) + elif content_type == "audio": + maybe_url: str | None = content.get("url") + maybe_path: str | None = content.get("path") + maybe_base64: str | None = content.get("base64") + if maybe_url or maybe_path: + audio_data = load_audio_as(maybe_url or maybe_path, return_format="dict", force_mono=True) + normalized_content.append({"type": "input_audio", "input_audio": audio_data}) + continue + if not maybe_base64: + raise ValueError("Audio content must be specified.") + normalized_content.append({"type": "audio_url", "audio_url": {"url": maybe_base64}}) + else: + normalized_content.append(content) + message["content"] = normalized_content + return message + + outputs = [] + images: list[np.ndarray] = [] + audios: list[np.ndarray] = [] + + for conversation in conversations: + messages: list[dict[str, str | list[dict[str, str | dict[str, Any]]]]] = [] + for message in conversation: + message = _maybe_adapt_message(message) + messages.append(message) + + chat_request = ChatCompletionRequest.from_openai( + messages=messages, + tools=tools, + continue_final_message=continue_final_message, + ) + + tokenized_request = self.tokenizer.encode_chat_completion(chat_request) + if tokenize: + outputs.append(tokenized_request.tokens) + else: + outputs.append(tokenized_request.text) + images.extend(tokenized_request.images) + audios.extend([el.audio_array for el in tokenized_request.audios]) + + if not is_batched: + outputs = outputs[0] + + if tokenize: + out = self( + outputs, + padding=padding, + truncation=truncation, + max_length=max_length, + add_special_tokens=False, + return_tensors=return_tensors, + ) + if return_dict: + if images: + pixel_values: list[np.ndarray] | np.ndarray | torch.Tensor + if return_tensors == "pt": + if not is_torch_available(): + raise ImportError( + "Unable to convert output to PyTorch tensors format, PyTorch is not installed." + ) + + pixel_values = torch.from_numpy(np.stack(images)) + elif return_tensors == "np": + pixel_values = np.array(images) + elif return_tensors is None: + pixel_values = images + else: + raise ValueError(f"Unsupported return_tensors type: {return_tensors}") + out.data["pixel_values"] = pixel_values + if audios: + if return_tensors is not None: + raise NotImplementedError( + "When passing audio content in apply_chat_template, `return_tensors` must be None since we cannot batch the audio inputs. The returned audio will be a list of numpy arrays." + ) + # Transformers convention is audio for plural audio (audio does not take a "s") + out.data["audio"] = audios + return out + else: + return out["input_ids"] + + else: + logger.warning( + "`MistralCommonBackend.apply_chat_template(..., tokenize=False)` is unsafe and may lead to unexpected behavior." + " Please consider using `tokenize=True` instead and don't encode the output manually." + ) + return outputs + + def build_inputs_with_special_tokens(self, token_ids_0: list[int], token_ids_1: None = None) -> list[int]: + """ + Build model inputs from a sequence by adding special tokens. + + This method dynamically builds inputs based on the tokenizer's `mode`: + - `"test"`: seq0 [EOS] + - `"finetuning"`: [BOS] seq0 + + Args: + token_ids_0 (`list[int]`): + List of IDs to which the special tokens will be added. + token_ids_1 (`None`, *optional*): None, kept to match Transformers' signature. + + Returns: + `list[int]`: List of input IDs with the appropriate special tokens. + """ + if token_ids_1 is not None: + raise ValueError( + "`MistralCommonBackend` does not implement `token_ids_1 != None` for `build_inputs_with_special_tokens`." + ) + + if self.mode == ValidationMode.test: + # [BOS] seq0 + return [self.bos_token_id] + token_ids_0 + + else: + # [BOS] seq0 [EOS] + return [self.bos_token_id] + token_ids_0 + [self.eos_token_id] + + def create_token_type_ids_from_sequences(self, token_ids_0: list[int], token_ids_1: None = None) -> list[int]: + """ + Create a mask of zeroes from the token ids with special tokens added. + + Kept to match Transformers' implementation. + + Args: + token_ids_0 (`list[int]`): + List of IDs. + token_ids_1 (`None`, *optional*): None, kept to match Transformers' signature. + + + Returns: + `list[int]`: Token type IDs according to the configured pattern. + """ + if token_ids_1 is not None: + raise ValueError( + "`MistralCommonBackend` does not implement `token_ids_1 != None` for `create_token_type_ids_from_sequences`." + ) + + sequence = self.build_inputs_with_special_tokens(token_ids_0) + + return [0] * len(sequence) + + def num_special_tokens_to_add(self, pair: Literal[False] = False) -> int: + """ + Returns the number of added tokens when encoding a sequence with special tokens. + + + + This encodes a dummy input and checks the number of added tokens, and is therefore not efficient. Do not put + this inside your training loop. + + + + Args: + pair (`Literal[False]`, *optional*): False, kept to match Transformer's signature. + + Returns: + `int`: Number of special tokens added to sequences. + """ + if pair: + raise ValueError( + "`MistralCommonBackend` does not implement `pair = True` for `num_special_tokens_to_add`." + ) + + return len(self.build_inputs_with_special_tokens([], None)) + + @add_end_docstrings(ENCODE_KWARGS_DOCSTRING, ENCODE_PLUS_ADDITIONAL_KWARGS_DOCSTRING) + def __call__( + self, + text: TextInput | EncodedInput | list[TextInput] | list[EncodedInput] | None = None, + text_pair: None = None, + text_target: None = None, + text_pair_target: None = None, + add_special_tokens: bool = True, + padding: bool | str | PaddingStrategy = False, + truncation: bool | str | TruncationStrategy | None = None, + max_length: int | None = None, + stride: int = 0, + pad_to_multiple_of: int | None = None, + padding_side: str | None = None, + return_tensors: str | TensorType | None = None, + return_attention_mask: bool | None = None, + return_overflowing_tokens: bool = False, + return_special_tokens_mask: bool = False, + return_length: bool = False, + verbose: bool = True, + return_offsets_mapping: Literal[False] = False, + split_special_tokens: Literal[False] = False, + **kwargs, + ) -> BatchEncoding: + """ + Main method to tokenize and prepare for the model one or several sequence(s) or one or several pair(s) of + sequences. + + Args: + text (`str`, `list[str]`, `list[list[str]]`, *optional*): + The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of int + (encoded strings). + text_pair (`None`, *optional*): + Not supported by `MistralCommonBackend`. Kept to match the signature of `PreTrainedTokenizerBase.__call__`. + text_target (`None`, *optional*): + Not supported by `MistralCommonBackend`. Kept to match the signature of `PreTrainedTokenizerBase.__call__`. + text_pair_target (`None`, *optional*): + Not supported by `MistralCommonBackend`. Kept to match the signature of `PreTrainedTokenizerBase.__call__`. + """ + if return_offsets_mapping or split_special_tokens: + raise ValueError( + "`MistralCommonBackend` does not support `return_offsets_mapping` and `split_special_tokens`." + ) + + if truncation in [TruncationStrategy.ONLY_FIRST, TruncationStrategy.ONLY_SECOND, "only_first", "only_second"]: + raise ValueError( + "Truncation strategy `only_first` and `only_second` are not supported by `MistralCommonBackend`." + ) + + if kwargs: + raise ValueError(f"Kwargs {list(kwargs.keys())} are not supported by `MistralCommonBackend.__call__`.") + + if text_pair or text_target or text_pair_target: + raise ValueError( + "`text_pair`, `text_target` and `text_pair_target` are not supported by `MistralCommonBackend`." + ) + + return super().__call__( + text=text, + text_pair=text_pair, + text_target=text_target, + add_special_tokens=add_special_tokens, + padding=padding, + truncation=truncation, + max_length=max_length, + stride=stride, + pad_to_multiple_of=pad_to_multiple_of, + padding_side=padding_side, + return_tensors=return_tensors, + return_attention_mask=return_attention_mask, + return_overflowing_tokens=return_overflowing_tokens, + return_special_tokens_mask=return_special_tokens_mask, + return_length=return_length, + verbose=verbose, + ) + + @classmethod + def from_pretrained( + cls, + pretrained_model_name_or_path: str | os.PathLike, + *init_inputs, + mode: str | ValidationMode = ValidationMode.test, + cache_dir: str | os.PathLike | None = None, + force_download: bool = False, + local_files_only: bool = False, + token: str | bool | None = None, + revision: str = "main", + model_max_length: int = VERY_LARGE_INTEGER, + padding_side: str = "left", + truncation_side: str = "right", + model_input_names: list[str] | None = None, + clean_up_tokenization_spaces: bool = False, + **kwargs, + ): + r""" + Instantiate a `MistralCommonBackend` from a predefined + tokenizer. + + Args: + pretrained_model_name_or_path (`str` or `os.PathLike`): + Can be either: + + - A string, the *model id* of a predefined tokenizer hosted inside a model repo on huggingface.co. + - A path to a *directory* containing the tokenizer config, for instance saved + using the [`MistralCommonBackend.tokenization_mistral_common.save_pretrained`] method, e.g., + `./my_model_directory/`. + mode (`Union[str, ValidationMode]`, *optional*, defaults to `ValidationMode.test`): + Validation mode for the `MistralTokenizer` tokenizer. Possible values are: + - `"finetuning"` or `ValidationMode.finetuning`: The fine-tuning mode. + - `"test"` or `ValidationMode.test`: The test mode. + It changes how the tokenizer validates the input and prepares the request to the model. + cache_dir (`str` or `os.PathLike`, *optional*): + Path to a directory in which a downloaded predefined tokenizer vocabulary files should be cached if the + standard cache should not be used. + force_download (`bool`, *optional*, defaults to `False`): + Whether or not to force the (re-)download the vocabulary files and override the cached versions if they + exist. + token (`str` or *bool*, *optional*): + The token to use as HTTP bearer authorization for remote files. If `True`, will use the token generated + when running `hf auth login` (stored in `~/.huggingface`). + local_files_only (`bool`, *optional*, defaults to `False`): + Whether or not to only rely on local files and not to attempt to download any files. + revision (`str`, *optional*, defaults to `"main"`): + The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a + git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + identifier allowed by git. + max_length (`int`, *optional*): + Controls the maximum length to use by one of the truncation/padding parameters. + + If left unset or set to `None`, this will use the predefined model maximum length if a maximum length + is required by one of the truncation/padding parameters. If the model has no specific maximum input + length (like XLNet) truncation/padding to a maximum length will be deactivated. + padding_side (`str`, *optional*, defaults to `"left"`): + The side on which the model should have padding applied. Should be selected between ['right', 'left']. + Default value is picked from the class attribute of the same name. + truncation_side (`str`, *optional*, defaults to `"right"`): + The side on which the model should have truncation applied. Should be selected between ['right', 'left']. + model_input_names (`List[str]`, *optional*): + The list of inputs accepted by the forward pass of the model (like `"token_type_ids"` or + `"attention_mask"`). Default value is picked from the class attribute of the same name. + clean_up_tokenization_spaces (`bool`, *optional*, defaults to `False`): + Whether or not the model should clean up the spaces that were added when splitting the input text during the + tokenization process. + kwargs (additional keyword arguments, *optional*): + Not supported by `MistralCommonBackend.from_pretrained`. + Will raise an error if used. + """ + if init_inputs: + raise ValueError("`init_inputs` are not supported by `MistralCommonBackend.from_pretrained`.") + + # Handle kwargs and AutoTokenizer/AutoProcessor case + valid_kwargs = _VALID_INIT_KWARGS.union( + {"trust_remote_code", "_from_pipeline", "_commit_hash", "dtype", "subfolder"} + ) + if kwargs and not set(kwargs.keys()).issubset(valid_kwargs): + raise ValueError( + f"Some kwargs in {list(kwargs.keys())} are not supported by `MistralCommonBackend.from_pretrained`." + ) + + mode = cls._get_validation_mode(mode) + + if not os.path.isdir(pretrained_model_name_or_path): + tokenizer_path = download_tokenizer_from_hf_hub( + repo_id=pretrained_model_name_or_path, + cache_dir=cache_dir, + token=token, + revision=revision, + force_download=force_download, + local_files_only=local_files_only, + ) + else: + candidate_files = os.listdir(pretrained_model_name_or_path) + tokenizer_path = os.path.join(pretrained_model_name_or_path, get_one_valid_tokenizer_file(candidate_files)) + + return cls( + tokenizer_path=tokenizer_path, + mode=mode, + model_max_length=model_max_length, + padding_side=padding_side, + truncation_side=truncation_side, + model_input_names=model_input_names, + clean_up_tokenization_spaces=clean_up_tokenization_spaces, + ) + + def save_pretrained( # type: ignore[override] + self, + save_directory: str | os.PathLike | Path, + push_to_hub: bool = False, + token: str | bool | None = None, + commit_message: str | None = None, + repo_id: str | None = None, + private: bool | None = None, + **kwargs, + ) -> tuple[str, ...]: + """ + Save the full tokenizer state. + + + This method make sure the full tokenizer can then be re-loaded using the + [`~MistralCommonBackend.tokenization_mistral_common.from_pretrained`] class method. + + Args: + save_directory (`str` or `os.PathLike`): The path to a directory where the tokenizer will be saved. + push_to_hub (`bool`, *optional*, defaults to `False`): + Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the + repository you want to push to with `repo_id` (will default to the name of `save_directory` in your + namespace). + token (`str` or *bool*, *optional*, defaults to `None`): + The token to use to push to the model hub. If `True`, will use the token in the `HF_TOKEN` environment + variable. + commit_message (`str`, *optional*): The commit message to use when pushing to the hub. + repo_id (`str`, *optional*): The name of the repository to which push to the Hub. + private (`bool`, *optional*): Whether the model repository is private or not. + kwargs (`Dict[str, Any]`, *optional*): + Not supported by `MistralCommonBackend.save_pretrained`. + Will raise an error if used. + + Returns: + A tuple of `str`: The files saved. + """ + if kwargs: + raise ValueError( + f"Kwargs {list(kwargs.keys())} are not supported by `MistralCommonBackend.save_pretrained`." + ) + + save_directory = Path(save_directory) + save_directory.mkdir(parents=True, exist_ok=True) + + shutil.copy(self._tokenizer_path, save_directory) + + if push_to_hub: + repo_id = repo_id or str(save_directory).split(os.path.sep)[-1] + repo_id = create_repo(repo_id, token=token, private=private, exist_ok=True).repo_id + files_timestamps = self._get_files_timestamps(save_directory) + + self._upload_modified_files( + save_directory, + repo_id, + files_timestamps, + commit_message=commit_message, + token=token, + ) + + return (str(save_directory / self._tokenizer_path.name),) + + @staticmethod + def _get_validation_mode(mode: str | ValidationMode) -> ValidationMode: + """Get the validation mode from a string or a ValidationMode.""" + _invalid_mode_msg = ( + f"Invalid `mistral-common` tokenizer mode: {mode}. Possible values are 'finetuning' or 'test'." + ) + if isinstance(mode, str): + try: + mode = ValidationMode[mode] + except KeyError: + raise ValueError(_invalid_mode_msg) + elif not isinstance(mode, (str, ValidationMode)): + raise ValueError(_invalid_mode_msg) + + if mode not in [ValidationMode.finetuning, ValidationMode.test]: + raise ValueError(_invalid_mode_msg) + return mode + + def __repr__(self) -> str: + # MistralCommonBackend does not implement added_tokens_decoder, so we need a custom repr + return ( + f"{self.__class__.__name__}(name_or_path='{self.name_or_path}'," + f" vocab_size={self.vocab_size}, model_max_length={self.model_max_length}," + f" padding_side='{self.padding_side}', truncation_side='{self.truncation_side}'," + f" special_tokens={self.special_tokens_map}" + ) + + def added_tokens_decoder(self): + raise NotImplementedError("`MistralCommonBackend` does not implement `added_tokens_decoder`.") + + def add_special_tokens( + self, + special_tokens_dict: dict[str, str | AddedToken | Sequence[str | AddedToken]], + replace_extra_special_tokens: bool = True, + ): + r"""`MistralCommonBackend` does not implement `add_special_tokens` by design. + + If you would like this behaviour to be implemented, please open an issue in the `Transformers` or `mistral-common` repositories to request it. + """ + + raise NotImplementedError("`MistralCommonBackend` does not implement `add_special_tokens`.") + + def add_tokens( # type: ignore[override] + self, + special_tokens_dict: dict[str, str | AddedToken | Sequence[str | AddedToken]], + replace_extra_special_tokens: bool = True, + ): + """ + `MistralCommonBackend` does not implement `add_special_tokens` by design. + + If you would like this behaviour to be implemented, please open an issue in the `Transformers` or `mistral-common` repositories to request it. + """ + + raise NotImplementedError("`MistralCommonBackend` does not implement `add_tokens`.") + + def convert_added_tokens(cls, obj: AddedToken | Any, save: bool = False, add_type_field: bool = True): # type: ignore[override] + """ + `MistralCommonBackend` does not implement `convert_added_tokens` by design. + + If you would like this behaviour to be implemented, please open an issue in the `Transformers` or `mistral-common` repositories to request it. + """ + + raise NotImplementedError("`MistralCommonBackend` does not implement `convert_added_tokens`.") + + def get_chat_template(self, chat_template: str | None = None, tools: list[dict] | None = None) -> str: + """`MistralCommonBackend` does not implement `get_chat_template` by design as `mistral-common` does not use chat templates.""" + + raise NotImplementedError("`MistralCommonBackend` does not implement `get_chat_template`.") + + def save_chat_templates( + self, + save_directory: str | os.PathLike, + tokenizer_config: dict, + filename_prefix: str | None, + save_jinja_files: bool, + ): + """`MistralCommonBackend` does not implement `save_chat_templates` by design as `mistral-common` does not use chat templates.""" + + raise NotImplementedError("`MistralCommonBackend` does not implement `save_chat_templates`.") + + def save_vocabulary(self, save_directory: str, filename_prefix: str | None = None) -> tuple[str, ...]: + """ + `MistralCommonBackend` does not implement `save_vocabulary` by design. + + This is because `mistral-common` is configured by one tokenizer file. If you'd like to save the vocabulary, please consider using the `save_pretrained` method instead. + """ + + raise NotImplementedError("`MistralCommonBackend` does not implement `save_vocabulary`.") + + +# Backward compatibility alias for codebases still importing the legacy name. +MistralCommonTokenizer = MistralCommonBackend diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_python.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_python.py new file mode 100644 index 0000000000000000000000000000000000000000..9f8702f5b2a174a6ba328245690346aa0a4f5877 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_python.py @@ -0,0 +1,1434 @@ +# Copyright 2020 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Tokenization classes for python tokenizers. For fast tokenizers (provided by HuggingFace's tokenizers library) see +tokenization_utils_tokenizers.py +""" + +import bisect +import unicodedata +from collections import OrderedDict +from typing import Any, overload + +from .tokenization_utils_base import ( + INIT_TOKENIZER_DOCSTRING, + AddedToken, + BatchEncoding, + EncodedInput, + PreTokenizedInput, + PreTrainedTokenizerBase, + TextInput, + TruncationStrategy, +) +from .utils import PaddingStrategy, TensorType, add_end_docstrings, logging + + +logger = logging.get_logger(__name__) + +# Slow tokenizers are saved in a vocabulary plus three separated files +SPECIAL_TOKENS_MAP_FILE = "special_tokens_map.json" +ADDED_TOKENS_FILE = "added_tokens.json" +TOKENIZER_CONFIG_FILE = "tokenizer_config.json" + + +class Trie: + """ + Trie in Python. Creates a Trie out of a list of words. The trie is used to split on `added_tokens` in one pass + Loose reference https://en.wikipedia.org/wiki/Trie + """ + + def __init__(self, *args): + self.data = {} + self._tokens = set() + self._termination_char = "" + self.update(*args) + + def update(self, *args): + """ + Updates the Trie with new tokens provided as arguments. + + Args: + *args: Variable number of words to be added to the Trie. + """ + for token in tuple(*args): + self.add(token) + + def add(self, word: str): + """ + Passes over every char (utf-8 char) on word and recursively adds it to the internal `data` trie representation. + The special key `""` in `self._termination_char` is used to represent termination. + + This function is idempotent, adding twice the same word will leave the trie unchanged + + Example: + + ```python + >>> trie = Trie() + >>> trie.add("Hello 友達") + >>> trie.data + {"H": {"e": {"l": {"l": {"o": {" ": {"友": {"達": {"": 1}}}}}}}}} + + >>> trie.add("Hello") + >>> trie.data + {"H": {"e": {"l": {"l": {"o": {"": 1, " ": {"友": {"達": {"": 1}}}}}}}}} + ``` + """ + if not word: + # Prevent empty string + return + + self._tokens.add(word) + ref = self.data + for char in word: + ref[char] = ref.setdefault(char, {}) + ref = ref[char] + ref[self._termination_char] = 1 + + def split(self, text: str) -> list[str]: + """ + Will look for the words added to the trie within `text`. Output is the original string split along the + boundaries of the words found. + + This trie will match the longest possible word first ! + + Example: + + ```python + >>> trie = Trie() + >>> trie.split("[CLS] This is a extra_id_100") + ["[CLS] This is a extra_id_100"] + + >>> trie.add("[CLS]") + >>> trie.add("extra_id_1") + >>> trie.add("extra_id_100") + >>> trie.split("[CLS] This is a extra_id_100") + ["[CLS]", " This is a ", "extra_id_100"] + ``` + """ + # indexes are counted left of the chars index. + # "hello", index 0, is left of h, index 1 is between h and e. + # index 5 is right of the "o". + + # States are going to capture every possible start (indexes as above) + # as keys, and have as values, a pointer to the position in the trie + # where we're at. This is a partial match for now. + # This enables to keep track of multiple matches while we're iterating + # the string + # If the trie contains, "blowing", and "lower" and we encounter the + # string "blower", we need to split into ["b", "lower"]. + # This is where we need to keep track of multiple possible starts. + states = OrderedDict() + + # This will contain every indices where we need + # to cut. + # We force to cut at offset 0 and len(text) (added later) + offsets = [0] + + # This is used by the lookahead which needs to skip over + # some text where the full match exceeded the place in the initial + # for loop + skip = 0 + # Main loop, Giving this algorithm O(n) complexity + for current, current_char in enumerate(text): + if skip and current < skip: + # Prevents the lookahead for matching twice + # like extra_id_100 and id_100 + continue + + # This will track every state + # that stop matching, we need to stop tracking them. + # If we look at "lowball", we're going to match "l" (add it to states), "o", "w", then + # fail on "b", we need to remove 0 from the valid states. + to_remove = set() + # Whenever we found a match, we need to drop everything + # this is a greedy algorithm, it will match on the first found token + reset = False + + # In this case, we already have partial matches (But unfinished) + for start, trie_pointer in states.items(): + if "" in trie_pointer: + # This is a final match, we need to reset and + # store the results in `offsets`. + + # Lookahead to match longest first + # Important in case of extra_id_1 vs extra_id_100 + # Here we are also actively looking for other earlier partial + # matches + # "[CLS]", "L", we need to match CLS even if L is special + for lookstart, looktrie_pointer in states.items(): + if lookstart > start: + # This partial match is later, we can stop looking + break + elif lookstart < start: + # This partial match is earlier, the trie pointer + # was already updated, so index is + 1 + lookahead_index = current + 1 + end = current + 1 + else: + # Here lookstart == start and + # looktrie_pointer == trie_pointer + # It wasn't updated yet so indices are current ones + lookahead_index = current + end = current + next_char = text[lookahead_index] if lookahead_index < len(text) else None + if "" in looktrie_pointer: + start = lookstart + end = lookahead_index + skip = lookahead_index + + while next_char in looktrie_pointer: + looktrie_pointer = looktrie_pointer[next_char] + lookahead_index += 1 + if "" in looktrie_pointer: + start = lookstart + end = lookahead_index + skip = lookahead_index + + if lookahead_index == len(text): + # End of string + break + next_char = text[lookahead_index] + # End lookahead + + # Storing and resetting + offsets.append(start) + offsets.append(end) + reset = True + break + elif current_char in trie_pointer: + # The current character being looked at has a match within the trie + # update the pointer (it will be stored back into states later). + trie_pointer = trie_pointer[current_char] + + # Storing back the new pointer into the states. + # Partial matches got longer by one. + states[start] = trie_pointer + else: + # The new character has not match in the trie, we need + # to stop keeping track of this partial match. + # We can't do it directly within the loop because of how + # python iteration works + to_remove.add(start) + + # Either clearing the full start (we found a real match) + # Or clearing only the partial matches that didn't work. + if reset: + states = {} + else: + for start in to_remove: + del states[start] + + # If this character is a starting character within the trie + # start keeping track of this partial match. + if current >= skip and current_char in self.data: + states[current] = self.data[current_char] + + # We have a cut at the end with states. + for start, trie_pointer in states.items(): + if "" in trie_pointer: + # This is a final match, we need to reset and + # store the results in `offsets`. + end = len(text) + offsets.append(start) + offsets.append(end) + # Longest cut is always the one with lower start so the first + # item so we need to break. + break + + return self.cut_text(text, offsets) + + def cut_text(self, text, offsets): + # We have all the offsets now, we just need to do the actual splitting. + # We need to eventually add the first part of the string and the eventual + # last part. + offsets.append(len(text)) + tokens = [] + start = 0 + for end in offsets: + if start > end: + logger.error( + "There was a bug in Trie algorithm in tokenization. Attempting to recover. Please report it" + " anyway." + ) + continue + elif start == end: + # This might happen if there's a match at index 0 + # we're also preventing zero-width cuts in case of two + # consecutive matches + continue + tokens.append(text[start:end]) + start = end + + return tokens + + +class ExtensionsTrie(Trie): + def __init__(self, *args): + super().__init__(*args) + + def extensions(self, prefix: str): + """ + Generates all extensions of a given prefix token in the Trie. + + Example: + + ```python + >>> trie = Trie() + >>> trie.add("apple") + >>> trie.add("app") + >>> trie.add("application") + >>> trie.extensions("app") + ['app', 'apple', 'application'] + ``` + """ + prefix_node = self._get_node(prefix) + ret = self._collect_tokens(prefix_node) + return [prefix + token for token in ret] + + def _get_node(self, token: str) -> dict: + """ + Retrieves the node corresponding to the given token in the Trie. + + Args: + token (str): The token for which the corresponding node needs to be retrieved. + + Returns: + dict: The node in the Trie corresponding to the given token. + """ + node = self.data + for char in token: + if char not in node: + break + + node = node[char] + return node + + def _collect_tokens(self, node: dict) -> list: + """ + Generates all tokens in the Trie starting from a given node. + + Args: + node (dict): The node in the Trie from which tokens need to be generated. + + Returns: + list: List of tokens generated from the given node. + """ + tokens = [self._termination_char] if self._termination_char in node else [] + for token, subtrie_head in node.items(): + if token != self._termination_char: + subtokens = self._collect_tokens(subtrie_head) + tokens.extend([token + subtoken for subtoken in subtokens]) + return tokens + + +def _is_whitespace(char): + """Checks whether `char` is a whitespace character.""" + # \t, \n, and \r are technically control characters but we treat them + # as whitespace since they are generally considered as such. + if char == " " or char == "\t" or char == "\n" or char == "\r": + return True + cat = unicodedata.category(char) + if cat == "Zs": + return True + return False + + +def _is_control(char): + """Checks whether `char` is a control character.""" + # These are technically control characters but we count them as whitespace + # characters. + if char == "\t" or char == "\n" or char == "\r": + return False + cat = unicodedata.category(char) + if cat.startswith("C"): + return True + return False + + +def _is_punctuation(char): + """Checks whether `char` is a punctuation character.""" + cp = ord(char) + # We treat all non-letter/number ASCII as punctuation. + # Characters such as "^", "$", and "`" are not in the Unicode + # Punctuation class but we treat them as punctuation anyways, for + # consistency. + if (cp >= 33 and cp <= 47) or (cp >= 58 and cp <= 64) or (cp >= 91 and cp <= 96) or (cp >= 123 and cp <= 126): + return True + cat = unicodedata.category(char) + if cat.startswith("P"): + return True + return False + + +def _is_end_of_word(text): + """Checks whether the last character in text is one of a punctuation, control or whitespace character.""" + last_char = text[-1] + return bool(_is_control(last_char) | _is_punctuation(last_char) | _is_whitespace(last_char)) + + +def _is_start_of_word(text): + """Checks whether the first character in text is one of a punctuation, control or whitespace character.""" + first_char = text[0] + return bool(_is_control(first_char) | _is_punctuation(first_char) | _is_whitespace(first_char)) + + +def _insert_one_token_to_ordered_list(token_list: list[str], new_token: str): + """ + Inserts one token to an ordered list if it does not already exist. Note: token_list must be sorted. + """ + insertion_idx = bisect.bisect_left(token_list, new_token) + # Checks if new_token is already in the ordered token_list + if insertion_idx < len(token_list) and token_list[insertion_idx] == new_token: + # new_token is in token_list, don't add + return + else: + token_list.insert(insertion_idx, new_token) + + +@add_end_docstrings(INIT_TOKENIZER_DOCSTRING) +class PythonBackend(PreTrainedTokenizerBase): + """ + Base class for all slow tokenizers. + + Inherits from [`~tokenization_utils_base.PreTrainedTokenizerBase`]. + + Handle all the shared methods for tokenization and special tokens as well as methods downloading/caching/loading + pretrained tokenizers as well as adding tokens to the vocabulary. + + This class also contain the added tokens in a unified way on top of all tokenizers so we don't have to handle the + specific vocabulary augmentation methods of the various underlying dictionary structures (BPE, sentencepiece...). + """ + + def __init__(self, **kwargs): + # 1. Init the parent class + + self.tokens_trie = Trie() + + # Initialize total_vocab_size early to avoid issues if get_vocab() is called early (custom tokenizers) + self.total_vocab_size = 0 + + # 2. init `_added_tokens_decoder` if child class did not + if not hasattr(self, "_added_tokens_decoder"): + self._added_tokens_decoder: dict[int, AddedToken] = {} + + # 3. if a `added_tokens_decoder` is passed, we are loading from a saved tokenizer, we overwrite + self._added_tokens_decoder.update(kwargs.pop("added_tokens_decoder", {})) + self._added_tokens_encoder: dict[str, int] = {k.content: v for v, k in self._added_tokens_decoder.items()} + + # 4. Token type ID configuration for dynamic mask building + # These can be overridden by subclasses to avoid overriding create_token_type_ids_from_sequences + self.token_type_ids_pattern = kwargs.pop("token_type_ids_pattern", "bert_style") # "all_zeros" or "bert_style" + self.token_type_ids_include_special_tokens = kwargs.pop("token_type_ids_include_special_tokens", True) + + # 5. Special tokens mask configuration + # Patterns: "none", "cls_sep", "eos", "bos", "bos_eos", "cls_double_sep", "prefix_suffix" + self.special_tokens_pattern = kwargs.pop("special_tokens_pattern", None) + + # 6. Set backend to "custom" if not already set (for direct PreTrainedTokenizer subclasses) + if "backend" not in kwargs: + kwargs["backend"] = "custom" + + # 7. init the parent class + super().__init__(**kwargs) + + # 4. If some of the special tokens are not part of the vocab, we add them, at the end. + # V5: the order of addition follows self.SPECIAL_TOKENS_ATTRIBUTES, then extra special tokens + # Note: _add_tokens will automatically skip tokens that are already in the base vocab + self._add_tokens( + [token for token in self.all_special_tokens if token not in self._added_tokens_encoder], + special_tokens=True, + ) + + @property + def is_fast(self) -> bool: + return False + + @property + def added_tokens_encoder(self) -> dict[str, int]: + """ + Returns the sorted mapping from string to index. The added tokens encoder is cached for performance + optimisation in `self._added_tokens_encoder` for the slow tokenizers. + """ + return {k.content: v for v, k in sorted(self._added_tokens_decoder.items(), key=lambda item: item[0])} + + @property + def added_tokens_decoder(self) -> dict[int, AddedToken]: + """ + Returns the added tokens in the vocabulary as a dictionary of index to AddedToken. + + Returns: + `dict[str, int]`: The added tokens. + """ + return dict(sorted(self._added_tokens_decoder.items(), key=lambda item: item[0])) + + @added_tokens_decoder.setter + def added_tokens_decoder(self, value: dict[int, AddedToken | str]) -> dict[int, AddedToken]: + # Always raise an error if string because users should define the behavior + for index, token in value.items(): + if not isinstance(token, (str, AddedToken)) or not isinstance(index, int): + raise TypeError( + f"The provided `added_tokens_decoder` has an element of type {index.__class__, token.__class__}, should be a dict of {int, AddedToken | str}" + ) + + self._added_tokens_decoder[index] = AddedToken(token) if isinstance(token, str) else token + self._added_tokens_encoder[str(token)] = index + self._update_total_vocab_size() + + def get_added_vocab(self) -> dict[str, int]: + """ + Returns the added tokens in the vocabulary as a dictionary of token to index. Results might be different from + the fast call because for now we always add the tokens even if they are already in the vocabulary. This is + something we should change. + + Returns: + `dict[str, int]`: The added tokens. + """ + return self._added_tokens_encoder + + def __len__(self): + """ + Size of the full vocabulary with the added tokens. + """ + # Lazy evaluation: compute if not already set (e.g., during initialization) + if self.total_vocab_size == 0: + self._update_total_vocab_size() + return self.total_vocab_size + + def _update_total_vocab_size(self): + """ + Update the size of the full vocabulary with the added tokens. Counts the `keys` and not the `values` because + otherwise if there is a hole in the vocab, we will add tokenizers at a wrong index. This operation is slow and + is only updated when adding tokens. + """ + self.total_vocab_size = len(self.get_vocab()) + + def _add_tokens(self, new_tokens: list[str] | list[AddedToken], special_tokens: bool = False) -> int: + """ + Add a list of new tokens to the tokenizer class. If the new tokens are not in the vocabulary, they are added to + it with indices starting from length of the current vocabulary. Special tokens are sometimes already in the + vocab which is why they have to be handled specifically. + + Args: + new_tokens (`list[str]`or `list[tokenizers.AddedToken]`): + Token(s) to add in vocabulary. A token is counted as added if it's not already in the vocabulary + (tested by checking if the tokenizer assign the index of the `unk_token` to them). If a token is part + of the vocabulary then we simply mark this token as an `AddedToken` which allows to control the + stripping and normalization of this token. This is NOT possible in `tokenizers`. + special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not the tokens should be added as special tokens. + + Returns: + `int`: The number of tokens actually added to the vocabulary. + + Examples: + + ```python + # Let's see how to increase the vocabulary of Bert model and tokenizer + tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased") + model = BertModel.from_pretrained("google-bert/bert-base-uncased") + + num_added_toks = tokenizer.add_tokens(["new_tok1", "my_new-tok2"]) + print("We have added", num_added_toks, "tokens") + # Note: resize_token_embeddings expects to receive the full size of the new vocabulary, i.e. the length of the tokenizer. + model.resize_token_embeddings(len(tokenizer)) + ```""" + added_tokens = 0 + if new_tokens is None: + return added_tokens + # TODO this is fairly slow to improve! + current_vocab = self.get_vocab().copy() + new_idx = len(current_vocab) # only call this once, len gives the last index + 1 + for token in new_tokens: + if not isinstance(token, (str, AddedToken)): + raise TypeError(f"Token {token} is not a string but a {type(token)}.") + if str(token) == "": + continue + if isinstance(token, str): + if token in self._added_tokens_encoder: + continue + else: + # very important for fast and slow equivalence! + is_special = token in self.all_special_tokens or special_tokens + token = AddedToken( + token, rstrip=False, lstrip=False, normalized=not is_special, special=is_special + ) + elif special_tokens: + # doing token.special=True changes the normalization! will fix in rust + # this is important and the only reason why the AddedTokens in each class are normalized by default + token.__setstate__({"special": True, "normalized": token.normalized}) + if token in self._added_tokens_decoder: + continue + if not token.special and token.normalized and getattr(self, "do_lower_case", False): + # Normalize if requested + token.content = token.content.lower() + if token.content not in current_vocab: + token_index = new_idx + added_tokens + current_vocab[token.content] = token_index + added_tokens += 1 + else: + token_index = current_vocab[token.content] + + if token.special and str(token) not in self.all_special_tokens: + self._extra_special_tokens.append(token) + # the setter automatically updates the reverse map + self._added_tokens_decoder[token_index] = token + self._added_tokens_encoder[token.content] = token_index + if self.verbose: + logger.info(f"Adding {token} to the vocabulary") + + self._update_trie() + self._update_total_vocab_size() + return added_tokens + + def _update_trie(self, unique_no_split_tokens: list[str] | None = None): + for token in self._added_tokens_decoder.values(): + if token.content not in self.tokens_trie._tokens: + self.tokens_trie.add(token.content) + for token in unique_no_split_tokens or []: + if token not in self.tokens_trie._tokens: + self.tokens_trie.add(token) + + def num_special_tokens_to_add(self, pair: bool = False) -> int: + """ + Returns the number of added tokens when encoding a sequence with special tokens. + + + + This encodes a dummy input and checks the number of added tokens, and is therefore not efficient. Do not put + this inside your training loop. + + + + Args: + pair (`bool`, *optional*, defaults to `False`): + Whether the number of added tokens should be computed in the case of a sequence pair or a single + sequence. + + Returns: + `int`: Number of special tokens added to sequences. + """ + token_ids_0 = [] + token_ids_1 = [] + return len(self.build_inputs_with_special_tokens(token_ids_0, token_ids_1 if pair else None)) + + def tokenize(self, text: TextInput, **kwargs) -> list[str]: + """ + Converts a string into a sequence of tokens, using the tokenizer. + + Args: + text: The sequence to be encoded. + **kwargs: Passed along to the model-specific `prepare_for_tokenization` preprocessing method. + + Returns: + The list of tokens. + """ + split_special_tokens = kwargs.pop("split_special_tokens", self.split_special_tokens) + text, kwargs = self.prepare_for_tokenization(text, **kwargs) + + if split_special_tokens: + # Don't split on any tokens - just tokenize directly + return self._tokenize(text) + + # Split on added tokens + tokens = self.tokens_trie.split(text) + no_split_token = self._added_tokens_encoder.keys() + + # Handle added token properties (lstrip, rstrip, single_word) + for i, token in enumerate(tokens): + if token in no_split_token: + tok_extended = self._added_tokens_decoder.get(self._added_tokens_encoder[token]) + left = tokens[i - 1] if i > 0 else None + right = tokens[i + 1] if i < len(tokens) - 1 else None + + if isinstance(tok_extended, AddedToken): + if tok_extended.rstrip and right: + tokens[i + 1] = right.lstrip() + if tok_extended.lstrip and left: + tokens[i - 1] = left.rstrip() + if tok_extended.single_word: + if left and left[-1] != " ": + tokens[i - 1] += token + tokens[i] = "" + elif right and right[0] != " ": + tokens[i + 1] = token + tokens[i + 1] + tokens[i] = "" + + # Tokenize non-added tokens + result = [] + all_special_tokens_set = set(self.all_special_tokens) + for token in tokens: + if not token: + continue + if token in no_split_token or token in all_special_tokens_set: + result.append(token) + else: + result.extend(self._tokenize(token)) + + return result + + def _tokenize(self, text, **kwargs): + """ + Converts a string into a sequence of tokens (string), using the tokenizer. Split in words for word-based + vocabulary or sub-words for sub-word-based vocabularies (BPE/SentencePieces/WordPieces). + + Do NOT take care of added tokens. + """ + raise NotImplementedError + + def _convert_token_to_id_with_added_voc(self, token): + if token in self.added_tokens_encoder: + return self.added_tokens_encoder[token] + return self._convert_token_to_id(token) + + def _convert_token_to_id(self, token): + raise NotImplementedError + + def _encode_plus( + self, + text: TextInput | PreTokenizedInput | EncodedInput, + text_pair: TextInput | PreTokenizedInput | EncodedInput | None = None, + add_special_tokens: bool = True, + padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD, + truncation_strategy: TruncationStrategy = TruncationStrategy.DO_NOT_TRUNCATE, + max_length: int | None = None, + stride: int = 0, + is_split_into_words: bool = False, + pad_to_multiple_of: int | None = None, + padding_side: str | None = None, + return_tensors: str | TensorType | None = None, + return_token_type_ids: bool | None = None, + return_attention_mask: bool | None = None, + return_overflowing_tokens: bool = False, + return_special_tokens_mask: bool = False, + return_length: bool = False, + verbose: bool = True, + **kwargs, + ) -> BatchEncoding: + # Detect batched inputs (list of sequences) + is_batched = isinstance(text, (list, tuple)) and ( + (not text and not is_split_into_words) + or (text and is_split_into_words and isinstance(text[0], (list, tuple))) + or (text and not is_split_into_words and isinstance(text[0], (str, list, tuple))) + ) + + if is_batched: + if text_pair is not None: + if not isinstance(text_pair, (list, tuple)) or len(text_pair) != len(text): + raise ValueError("If `text` is a batch, `text_pair` must also be a batch of the same length.") + pairs = text_pair if text_pair is not None else [None] * len(text) + + batch_outputs = {} + for current_text, current_pair in zip(text, pairs): + # Handle tuples/lists as sequence pairs like ("text1", "text2") + # For is_split_into_words=True: only unpack if it's a tuple of exactly 2 sequences (pair) + # Otherwise, treat the list as a single pretokenized sequence + if ( + isinstance(current_text, (list, tuple)) + and current_text + and not isinstance(current_text[0], int) + and current_pair is None + ): + # Check if this looks like a pair: tuple/list of length 2 where elements are strings or lists/tuples + is_pair = ( + len(current_text) == 2 + and (isinstance(current_text[0], str) or isinstance(current_text[0], (list, tuple))) + and (isinstance(current_text[1], str) or isinstance(current_text[1], (list, tuple))) + ) + if is_pair: + current_text, current_pair = current_text + elif len(current_text) == 1: + current_text = current_text[0] + elif not is_split_into_words: + # Only raise error for non-pretokenized input + raise ValueError(f"Expected a pair of sequences, got {len(current_text)} sequences.") + + current_output = self._encode_plus( + text=current_text, + text_pair=current_pair, + add_special_tokens=add_special_tokens, + padding_strategy=PaddingStrategy.DO_NOT_PAD, # we pad in batch afterward + truncation_strategy=truncation_strategy, + max_length=max_length, + stride=stride, + is_split_into_words=is_split_into_words, + pad_to_multiple_of=None, # we pad in batch afterward + padding_side=None, # we pad in batch afterward + return_tensors=None, # We convert the whole batch to tensors at the end + return_token_type_ids=return_token_type_ids, + return_attention_mask=False, # we pad in batch afterward + return_overflowing_tokens=return_overflowing_tokens, + return_special_tokens_mask=return_special_tokens_mask, + return_length=return_length, + verbose=verbose, + **kwargs, + ) + for key, value in current_output.items(): + batch_outputs.setdefault(key, []).append(value) + + # Remove overflow-related keys before tensor conversion if return_tensors is set + # Slow tokenizers don't support returning these as tensors + if return_tensors and return_overflowing_tokens: + batch_outputs.pop("overflowing_tokens", None) + batch_outputs.pop("num_truncated_tokens", None) + + batch_outputs = self.pad( + batch_outputs, + padding=padding_strategy.value, + max_length=max_length, + pad_to_multiple_of=pad_to_multiple_of, + padding_side=padding_side, + return_attention_mask=return_attention_mask, + ) + + return BatchEncoding(batch_outputs, tensor_type=return_tensors) + + # Single sequence handling + def get_input_ids(text): + if isinstance(text, str): + # Normal case: tokenize string + return self.convert_tokens_to_ids(self.tokenize(text, **kwargs)) + if isinstance(text, (list, tuple)) and text: + if isinstance(text[0], int): + return text + # Pre-tokenized strings + if isinstance(text[0], str): + if is_split_into_words: + return self.convert_tokens_to_ids( + [tok for word in text for tok in self.tokenize(word, **kwargs)] + ) + return self.convert_tokens_to_ids(text) + raise ValueError(f"Input must be a string, list of strings, or list of ints, got: {type(text)}") + + first_ids = get_input_ids(text) + second_ids = get_input_ids(text_pair) if text_pair is not None else None + + return self.prepare_for_model( + first_ids, + pair_ids=second_ids, + add_special_tokens=add_special_tokens, + padding=padding_strategy.value, + truncation=truncation_strategy.value, + max_length=max_length, + stride=stride, + pad_to_multiple_of=pad_to_multiple_of, + padding_side=padding_side, + return_tensors=return_tensors, + prepend_batch_axis=True, + return_attention_mask=return_attention_mask, + return_token_type_ids=return_token_type_ids, + return_overflowing_tokens=return_overflowing_tokens, + return_special_tokens_mask=return_special_tokens_mask, + return_length=return_length, + verbose=verbose, + ) + + def prepare_for_tokenization( + self, text: str, is_split_into_words: bool = False, **kwargs + ) -> tuple[str, dict[str, Any]]: + """ + Performs any necessary transformations before tokenization. + + This method should pop the arguments from kwargs and return the remaining `kwargs` as well. We test the + `kwargs` at the end of the encoding process to be sure all the arguments have been used. + + Args: + text (`str`): + The text to prepare. + is_split_into_words (`bool`, *optional*, defaults to `False`): + Whether or not the input is already pre-tokenized (e.g., split into words). If set to `True`, the + tokenizer assumes the input is already split into words (for instance, by splitting it on whitespace) + which it will tokenize. This is useful for NER or token classification. + kwargs (`dict[str, Any]`, *optional*): + Keyword arguments to use for the tokenization. + + Returns: + `tuple[str, dict[str, Any]]`: The prepared text and the unused kwargs. + """ + return (text, kwargs) + + def build_inputs_with_special_tokens( + self, token_ids_0: list[int], token_ids_1: list[int] | None = None + ) -> list[int]: + """ + Build model inputs from a sequence or a pair of sequences by adding special tokens. + + This method dynamically builds inputs based on the tokenizer's `special_tokens_pattern`: + - `"none"`: No special tokens + - `"cls_sep"`: [CLS] seq0 [SEP] or [CLS] seq0 [SEP] seq1 [SEP] + - `"eos"`: seq0 [EOS] or seq0 [EOS] seq1 [EOS] + - `"bos"`: [BOS] seq0 or [BOS] seq0 [BOS] seq1 + - `"bos_eos"`: [BOS] seq0 [EOS] or [BOS] seq0 [EOS] seq1 [EOS] + - `"cls_double_sep"`: [CLS] seq0 [SEP] or [CLS] seq0 [SEP] [SEP] seq1 [SEP] + - `"prefix_suffix"`: ` seq0 [seq1] ` (custom prefix/suffix stored on the tokenizer) + + Args: + token_ids_0 (`list[int]`): + List of IDs to which the special tokens will be added. + token_ids_1 (`list[int]`, *optional*): + Optional second list of IDs for sequence pairs. + + Returns: + `list[int]`: List of input IDs with the appropriate special tokens. + """ + if self.special_tokens_pattern == "cls_sep": + # [CLS] seq0 [SEP] or [CLS] seq0 [SEP] seq1 [SEP] + if self.cls_token_id is None and self.sep_token_id is None: + raise ValueError( + "Cannot add special tokens following 'cls_sep' pattern because one or several special tokens " + f"are not defined (cls_token_id={self.cls_token_id}; sep_token_id={self.sep_token_id})" + "Set the required special tokens in tokenizer or update `tokenizer.special_tokens_pattern`" + ) + if token_ids_1 is None: + return [self.cls_token_id] + token_ids_0 + [self.sep_token_id] + return [self.cls_token_id] + token_ids_0 + [self.sep_token_id] + token_ids_1 + [self.sep_token_id] + + elif self.special_tokens_pattern == "eos": + # seq0 [EOS] or seq0 [EOS] seq1 [EOS] + if self.eos_token_id is None: + raise ValueError( + "Cannot add special tokens following 'eos' pattern because eos token is not defined " + f"(eos_token_id={self.eos_token_id})." + "Set the required special tokens in tokenizer or update `tokenizer.special_tokens_pattern`" + ) + if token_ids_1 is None: + return token_ids_0 + [self.eos_token_id] + return token_ids_0 + [self.eos_token_id] + token_ids_1 + [self.eos_token_id] + + elif self.special_tokens_pattern == "bos": + # [BOS] seq0 or [BOS] seq0 [BOS] seq1 + if self.bos_token_id is None: + raise ValueError( + "Cannot add special tokens following 'bos' pattern because bos token is not defined " + f"(bos_token_id={self.bos_token_id})." + "Set the required special tokens in tokenizer or update `tokenizer.special_tokens_pattern`" + ) + if token_ids_1 is None: + return [self.bos_token_id] + token_ids_0 + return [self.bos_token_id] + token_ids_0 + [self.bos_token_id] + token_ids_1 + + elif self.special_tokens_pattern == "bos_eos": + # [BOS] seq0 [EOS] or [BOS] seq0 [EOS] seq1 [EOS] + if self.bos_token_id is None and self.eos_token_id is None: + raise ValueError( + "Cannot add special tokens following 'bos_eos' pattern because one or several special tokens " + f"are not defined (bos_token_id={self.bos_token_id}; eos_token_id={self.eos_token_id})" + "Set the required special tokens in tokenizer or update `tokenizer.special_tokens_pattern`" + ) + return token_ids_0 if token_ids_1 is None else token_ids_0 + token_ids_1 + + if token_ids_1 is None: + return [self.bos_token_id] + token_ids_0 + [self.eos_token_id] + return [self.bos_token_id] + token_ids_0 + [self.eos_token_id] + token_ids_1 + [self.eos_token_id] + + elif self.special_tokens_pattern == "cls_double_sep": + # [CLS] seq0 [SEP] or [CLS] seq0 [SEP] [SEP] seq1 [SEP] + if self.cls_token_id is None and self.sep_token_id is None: + raise ValueError( + "Cannot add special tokens following 'cls_double_sep' pattern because one or several special tokens " + f"are not defined (cls_token_id={self.cls_token_id}; sep_token_id={self.sep_token_id})" + "Set the required special tokens in tokenizer or update `tokenizer.special_tokens_pattern`" + ) + if token_ids_1 is None: + return [self.cls_token_id] + token_ids_0 + [self.sep_token_id] + return ( + [self.cls_token_id] + + token_ids_0 + + [self.sep_token_id, self.sep_token_id] + + token_ids_1 + + [self.sep_token_id] + ) + + elif self.special_tokens_pattern == "prefix_suffix": + prefix_tokens = getattr(self, "prefix_tokens", []) + suffix_tokens = getattr(self, "suffix_tokens", []) + if token_ids_1 is None: + return prefix_tokens + token_ids_0 + suffix_tokens + return prefix_tokens + token_ids_0 + token_ids_1 + suffix_tokens + + else: # "none" or any other value + # No special tokens + if token_ids_1 is None: + return token_ids_0 + return token_ids_0 + token_ids_1 + + def get_special_tokens_mask( + self, token_ids_0: list, token_ids_1: list | None = None, already_has_special_tokens: bool = False + ) -> list[int]: + """ + Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding + special tokens using the tokenizer `prepare_for_model` or `encode_plus` methods. + + This method dynamically builds the special tokens mask based on the tokenizer's `special_tokens_pattern`: + - `"none"`: No special tokens (default, returns all 0s) + - `"cls_sep"`: [CLS] seq0 [SEP] or [CLS] seq0 [SEP] seq1 [SEP] + - `"eos"`: seq0 [EOS] or seq0 [EOS] seq1 [EOS] + - `"bos"`: [BOS] seq0 or [BOS] seq0 [BOS] seq1 + - `"bos_eos"`: [BOS] seq0 [EOS] or [BOS] seq0 [EOS] seq1 [EOS] + - `"cls_double_sep"`: [CLS] seq0 [SEP] or [CLS] seq0 [SEP] [SEP] seq1 [SEP] + - `"prefix_suffix"`: ` seq0 [seq1] ` + + Args: + token_ids_0 (`list[int]`): + List of ids of the first sequence. + token_ids_1 (`list[int]`, *optional*): + List of ids of the second sequence. + already_has_special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not the token list is already formatted with special tokens for the model. + + Returns: + A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token. + """ + if already_has_special_tokens: + if token_ids_1 is not None: + raise ValueError( + "You should not supply a second sequence if the provided sequence of " + "ids is already formatted with special tokens for the model." + ) + + return super().get_special_tokens_mask( + token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=True + ) + + if self.special_tokens_pattern == "cls_sep": + # [CLS] seq0 [SEP] or [CLS] seq0 [SEP] seq1 [SEP] + if token_ids_1 is None: + return [1] + ([0] * len(token_ids_0)) + [1] + return [1] + ([0] * len(token_ids_0)) + [1] + ([0] * len(token_ids_1)) + [1] + + elif self.special_tokens_pattern == "eos": + # seq0 [EOS] or seq0 [EOS] seq1 [EOS] + if token_ids_1 is None: + return ([0] * len(token_ids_0)) + [1] + return ([0] * len(token_ids_0)) + [1] + ([0] * len(token_ids_1)) + [1] + + elif self.special_tokens_pattern == "bos": + # [BOS] seq0 or [BOS] seq0 [BOS] seq1 + if token_ids_1 is None: + return [1] + ([0] * len(token_ids_0)) + return [1] + ([0] * len(token_ids_0)) + [1] + ([0] * len(token_ids_1)) + + elif self.special_tokens_pattern == "bos_eos": + # [BOS] seq0 [EOS] or [BOS] seq0 [EOS] seq1 [EOS] + if token_ids_1 is None: + return [1] + ([0] * len(token_ids_0)) + [1] + return [1] + ([0] * len(token_ids_0)) + [1] + ([0] * len(token_ids_1)) + [1] + + elif self.special_tokens_pattern == "cls_double_sep": + # [CLS] seq0 [SEP] or [CLS] seq0 [SEP] [SEP] seq1 [SEP] + if token_ids_1 is None: + return [1] + ([0] * len(token_ids_0)) + [1] + return [1] + ([0] * len(token_ids_0)) + [1, 1] + ([0] * len(token_ids_1)) + [1] + + elif self.special_tokens_pattern == "prefix_suffix": + prefix_len = len(getattr(self, "prefix_tokens", [])) + suffix_len = len(getattr(self, "suffix_tokens", [])) + mask = [1] * prefix_len + ([0] * len(token_ids_0)) + if token_ids_1 is not None: + mask += [0] * len(token_ids_1) + mask += [1] * suffix_len + return mask + + else: + return [0] * ((len(token_ids_1) if token_ids_1 else 0) + len(token_ids_0)) + + @overload + def convert_ids_to_tokens(self, ids: int, skip_special_tokens: bool = False) -> str: ... + + @overload + def convert_ids_to_tokens(self, ids: list[int], skip_special_tokens: bool = False) -> list[str]: ... + + def convert_ids_to_tokens(self, ids: int | list[int], skip_special_tokens: bool = False) -> str | list[str]: + """ + Converts a single index or a sequence of indices in a token or a sequence of tokens, using the vocabulary and + added tokens. + + Args: + ids (`int` or `list[int]`): + The token id (or token ids) to convert to tokens. + skip_special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not to remove special tokens in the decoding. + + Returns: + `str` or `list[str]`: The decoded token(s). + """ + if isinstance(ids, int): + return ( + self._added_tokens_decoder[ids].content + if ids in self._added_tokens_decoder + else self._convert_id_to_token(ids) + ) + + tokens = [] + for index in ids: + index = int(index) + if skip_special_tokens and index in self.all_special_ids: + continue + tokens.append( + self._added_tokens_decoder[index].content + if index in self._added_tokens_decoder + else self._convert_id_to_token(index) + ) + return tokens + + def _convert_id_to_token(self, index: int) -> str: + raise NotImplementedError + + def convert_tokens_to_string(self, tokens: list[str]) -> str: + return " ".join(tokens) + + def _decode( + self, + token_ids: int | list[int], + skip_special_tokens: bool = False, + clean_up_tokenization_spaces: bool | None = None, + **kwargs, + ) -> str: + """Decode token ids to string.""" + filtered_tokens = self.convert_ids_to_tokens(token_ids, skip_special_tokens=skip_special_tokens) + if isinstance(filtered_tokens, str): + filtered_tokens = [filtered_tokens] + + text = self.convert_tokens_to_string(filtered_tokens) + + # Apply tokenizer-specific cleanup if available and requested + clean_up_tokenization_spaces = ( + clean_up_tokenization_spaces + if clean_up_tokenization_spaces is not None + else self.clean_up_tokenization_spaces + ) + if clean_up_tokenization_spaces: + # Call custom cleanup method if it exists (e.g., for CLVP's [SPACE] token replacement) + if hasattr(self, "clean_up_tokenization") and callable(self.clean_up_tokenization): + text = self.clean_up_tokenization(text) + else: + # Otherwise apply standard cleanup + text = ( + text.replace(" .", ".") + .replace(" ?", "?") + .replace(" !", "!") + .replace(" ,", ",") + .replace(" ' ", "'") + .replace(" n't", "n't") + .replace(" 'm", "'m") + .replace(" 's", "'s") + .replace(" 've", "'ve") + .replace(" 're", "'re") + ) + + return text + + def prepare_for_model( + self, + ids: list[int], + pair_ids: list[int] | None = None, + add_special_tokens: bool = True, + padding: bool | str | PaddingStrategy = False, + truncation: bool | str | TruncationStrategy = False, + max_length: int | None = None, + stride: int = 0, + pad_to_multiple_of: int | None = None, + padding_side: str | None = None, + return_tensors: str | TensorType | None = None, + return_token_type_ids: bool | None = None, + return_attention_mask: bool | None = None, + return_overflowing_tokens: bool = False, + return_special_tokens_mask: bool = False, + return_length: bool = False, + verbose: bool = True, + prepend_batch_axis: bool = False, + **kwargs, + ) -> BatchEncoding: + """ + Prepares a sequence of input ids so it can be used by the model. Adds special tokens, truncates, and pads. + + Args: + ids: Tokenized input ids of the first sequence. + pair_ids: Tokenized input ids of the second sequence (optional). + """ + # Get padding/truncation strategies + padding_strategy, truncation_strategy, max_length, _ = self._get_padding_truncation_strategies( + padding=padding, + truncation=truncation, + max_length=max_length, + pad_to_multiple_of=pad_to_multiple_of, + verbose=verbose, + **kwargs, + ) + + # Validation + if ( + return_overflowing_tokens + and truncation_strategy == TruncationStrategy.LONGEST_FIRST + and pair_ids is not None + ): + raise ValueError( + "Not possible to return overflowing tokens for pair of sequences with the " + "`longest_first`. Please select another truncation strategy than `longest_first`, " + "for instance `only_second` or `only_first`." + ) + + # Defaults + if return_token_type_ids is None: + return_token_type_ids = "token_type_ids" in self.model_input_names + if return_attention_mask is None: + return_attention_mask = "attention_mask" in self.model_input_names + + # Truncation + pair = pair_ids is not None + num_special = self.num_special_tokens_to_add(pair=pair) if add_special_tokens else 0 + total_len = len(ids) + len(pair_ids or []) + num_special + + overflowing_tokens = [] + if truncation_strategy != TruncationStrategy.DO_NOT_TRUNCATE and max_length and total_len > max_length: + ids, pair_ids, overflowing_tokens = self.truncate_sequences( + ids, + pair_ids=pair_ids, + num_tokens_to_remove=total_len - max_length, + truncation_strategy=truncation_strategy, + stride=stride, + ) + + # Add special tokens + if add_special_tokens: + sequence = self.build_inputs_with_special_tokens(ids, pair_ids) + token_type_ids = self.create_token_type_ids_from_sequences(ids, pair_ids) + else: + sequence = ids + (pair_ids if pair_ids else []) + token_type_ids = [0] * len(sequence) + + # Build output + encoded_inputs = {"input_ids": sequence} + if return_token_type_ids: + encoded_inputs["token_type_ids"] = token_type_ids + if return_special_tokens_mask: + encoded_inputs["special_tokens_mask"] = ( + self.get_special_tokens_mask(ids, pair_ids) if add_special_tokens else [0] * len(sequence) + ) + if return_overflowing_tokens and not return_tensors and overflowing_tokens: + encoded_inputs["overflowing_tokens"] = overflowing_tokens + encoded_inputs["num_truncated_tokens"] = total_len - max_length if max_length else 0 + + # Check sequence length and warn if needed + self._eventual_warn_about_too_long_sequence(encoded_inputs["input_ids"], max_length, verbose) + + # Pad + if padding_strategy != PaddingStrategy.DO_NOT_PAD or return_attention_mask: + encoded_inputs = self.pad( + encoded_inputs, + max_length=max_length, + padding=padding_strategy.value, + pad_to_multiple_of=pad_to_multiple_of, + padding_side=padding_side, + return_attention_mask=return_attention_mask, + ) + + if return_length: + encoded_inputs["length"] = len(encoded_inputs["input_ids"]) + + return BatchEncoding(encoded_inputs, tensor_type=return_tensors, prepend_batch_axis=prepend_batch_axis) + + def truncate_sequences( + self, + ids: list[int], + pair_ids: list[int] | None = None, + num_tokens_to_remove: int = 0, + truncation_strategy: str | TruncationStrategy = "longest_first", + stride: int = 0, + ) -> tuple[list[int], list[int], list[int]]: + """Truncates sequences according to the specified strategy.""" + if num_tokens_to_remove <= 0: + return ids, pair_ids, [] + + if not isinstance(truncation_strategy, TruncationStrategy): + truncation_strategy = TruncationStrategy(truncation_strategy) + + overflowing_tokens = [] + + # ONLY_FIRST or LONGEST_FIRST with single sequence + if truncation_strategy == TruncationStrategy.ONLY_FIRST or ( + truncation_strategy == TruncationStrategy.LONGEST_FIRST and pair_ids is None + ): + window_len = min(len(ids), stride + num_tokens_to_remove) + if self.truncation_side == "left": + overflowing_tokens = ids[:window_len] + ids = ids[num_tokens_to_remove:] + else: + overflowing_tokens = ids[-window_len:] + ids = ids[:-num_tokens_to_remove] + + # LONGEST_FIRST with pair + elif truncation_strategy == TruncationStrategy.LONGEST_FIRST: + logger.warning( + "Be aware, overflowing tokens are not returned for the setting you have chosen," + f" i.e. sequence pairs with the '{TruncationStrategy.LONGEST_FIRST.value}' " + "truncation strategy. So the returned list will always be empty even if some " + "tokens have been removed." + ) + len_ids, len_pair = len(ids), len(pair_ids) if pair_ids else 0 + first_remove = min(abs(len_pair - len_ids), num_tokens_to_remove) + second_remove = num_tokens_to_remove - first_remove + + if len_ids > len_pair: + ids_to_move = first_remove + second_remove // 2 + pair_ids_to_move = second_remove - second_remove // 2 + else: + ids_to_move = second_remove // 2 + pair_ids_to_move = first_remove + second_remove - (second_remove // 2) + + if self.truncation_side == "right": + ids = ids[:-ids_to_move] if ids_to_move > 0 else ids + pair_ids = pair_ids[:-pair_ids_to_move] if pair_ids and pair_ids_to_move > 0 else pair_ids + else: + ids = ids[ids_to_move:] + pair_ids = pair_ids[pair_ids_to_move:] if pair_ids else None + + # ONLY_SECOND + elif truncation_strategy == TruncationStrategy.ONLY_SECOND and pair_ids: + window_len = min(len(pair_ids), stride + num_tokens_to_remove) + if self.truncation_side == "right": + overflowing_tokens = pair_ids[-window_len:] + pair_ids = pair_ids[:-num_tokens_to_remove] + else: + overflowing_tokens = pair_ids[:window_len] + pair_ids = pair_ids[num_tokens_to_remove:] + + return ids, pair_ids, overflowing_tokens + + def create_token_type_ids_from_sequences( + self, token_ids_0: list[int], token_ids_1: list[int] | None = None + ) -> list[int]: + """ + Create a mask from the two sequences passed to be used in a sequence-pair classification task. + + This method dynamically builds the token type IDs based on the tokenizer's configuration attributes: + - `token_type_ids_pattern`: Pattern to use ("all_zeros" or "bert_style") + - `token_type_ids_include_special_tokens`: Whether to account for special tokens in length calculation + + Args: + token_ids_0 (`list[int]`): + List of IDs. + token_ids_1 (`list[int]`, *optional*): + Optional second list of IDs for sequence pairs. + + Returns: + `list[int]`: Token type IDs according to the configured pattern. + + Examples: + ```python + # All zeros pattern (default, used by RoBERTa, BART, etc.) + tokenizer.token_type_ids_pattern = "all_zeros" + # Returns: [0, 0, 0, ...] for both sequences + + # BERT-style pattern (first sequence gets 0s, second gets 1s) + tokenizer.token_type_ids_pattern = "bert_style" + # Returns: [0, 0, 0, ..., 1, 1, 1, ...] for sequence pairs + ``` + """ + # Calculate lengths - account for special tokens if configured + if self.token_type_ids_include_special_tokens: + # Build the full sequence to get accurate length + if token_ids_1 is None: + sequence = self.build_inputs_with_special_tokens(token_ids_0) + seq0_len = len(sequence) + seq1_len = 0 + else: + full_sequence = self.build_inputs_with_special_tokens(token_ids_0, token_ids_1) + # Approximate split - this works for most tokenizers + # For more complex cases, subclasses should still override + seq0_with_special = self.build_inputs_with_special_tokens(token_ids_0) + seq0_len = len(seq0_with_special) + seq1_len = len(full_sequence) - seq0_len + else: + # Use raw token lengths + seq0_len = len(token_ids_0) + seq1_len = len(token_ids_1) if token_ids_1 is not None else 0 + + # Build token type IDs based on pattern + if self.special_tokens_pattern == "prefix_suffix": + total_len = len(getattr(self, "prefix_tokens", [])) + len(token_ids_0) + if token_ids_1 is not None: + total_len += len(token_ids_1) + total_len += len(getattr(self, "suffix_tokens", [])) + return [0] * total_len + + if self.token_type_ids_pattern == "bert_style" and token_ids_1 is not None: + # BERT-style: first sequence gets 0s, second sequence gets 1s + return [0] * seq0_len + [1] * seq1_len + else: + # All zeros pattern (default): everything gets 0s + return [0] * (seq0_len + seq1_len) + + def save_vocabulary(self, save_directory: str, filename_prefix: str | None = None) -> tuple[str, ...]: + """ + Default implementation for common vocabulary saving patterns. + Saves self.encoder/self.vocab as JSON, optionally with self.bpe_ranks as merges. + Returns empty tuple if no vocabulary exists. + + Override this method if your tokenizer needs custom saving logic (e.g., SentencePiece models, + multiple vocabulary files, or special file formats). + + Args: + save_directory (`str`): + The directory in which to save the vocabulary. + filename_prefix (`str`, *optional*): + An optional prefix to add to the named of the saved files. + + Returns: + `tuple[str, ...]`: Paths to the files saved, or empty tuple if no files saved. + """ + import json + import os + + vocab_attr = getattr(self, "encoder", None) or getattr(self, "vocab", None) + if vocab_attr is None: + return () + + if not os.path.isdir(save_directory): + logger.error(f"Vocabulary path ({save_directory}) should be a directory") + return () + + vocab_files_names = getattr(self, "vocab_files_names", {}) + prefix = f"{filename_prefix}-" if filename_prefix else "" + + # Save vocabulary + vocab_file = os.path.join(save_directory, prefix + vocab_files_names.get("vocab_file", "vocab.json")) + with open(vocab_file, "w", encoding="utf-8") as f: + f.write(json.dumps(vocab_attr, indent=2, sort_keys=True, ensure_ascii=False) + "\n") + + # Save BPE merges if present + bpe_ranks = getattr(self, "bpe_ranks", None) + if bpe_ranks is None: + return (vocab_file,) + + merge_file = os.path.join(save_directory, prefix + vocab_files_names.get("merges_file", "merges.txt")) + with open(merge_file, "w", encoding="utf-8") as writer: + if getattr(self, "add_bpe_version_header", False): + writer.write("#version: 0.2\n") + + index = 0 + for bpe_tokens, token_index in sorted(bpe_ranks.items(), key=lambda kv: kv[1]): + if index != token_index: + logger.warning( + f"Saving vocabulary to {merge_file}: BPE merge indices are not consecutive." + " Please check that the tokenizer is not corrupted!" + ) + index = token_index + writer.write(" ".join(bpe_tokens) + "\n") + index += 1 + + return (vocab_file, merge_file) + + +# Backward compatibility alias +PreTrainedTokenizer = PythonBackend diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_utils_base.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_utils_base.py new file mode 100644 index 0000000000000000000000000000000000000000..89433159b18345b7b451f81d9c14ee95f6886702 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_utils_base.py @@ -0,0 +1,3526 @@ +# base +# Copyright 2020 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Base classes common to both the slow and the fast tokenization classes: PreTrainedTokenizerBase (host all the user +fronting encoding methods) Special token mixing (host the special tokens logic) and BatchEncoding (wrap the dictionary +of output with special method for the Fast tokenizers) +""" + +from __future__ import annotations + +import copy +import json +import os +import re +import warnings +from collections import OrderedDict, UserDict +from collections.abc import Callable, Collection, Mapping, Sequence, Sized +from dataclasses import dataclass +from pathlib import Path +from typing import TYPE_CHECKING, Any, NamedTuple, Union + +import numpy as np +from huggingface_hub import create_repo, is_offline_mode, list_repo_files +from packaging import version + +from . import __version__ +from .dynamic_module_utils import custom_object_save +from .utils import ( + CHAT_TEMPLATE_DIR, + CHAT_TEMPLATE_FILE, + ExplicitEnum, + PaddingStrategy, + PushToHubMixin, + TensorType, + add_end_docstrings, + cached_file, + copy_func, + extract_commit_hash, + is_mlx_available, + is_numpy_array, + is_protobuf_available, + is_tokenizers_available, + is_torch_available, + is_torch_device, + is_torch_tensor, + list_repo_templates, + logging, + requires_backends, + to_py_obj, +) +from .utils.chat_parsing_utils import recursive_parse +from .utils.chat_template_utils import render_jinja_template +from .utils.import_utils import PROTOBUF_IMPORT_ERROR + + +if TYPE_CHECKING: + if is_torch_available(): + import torch + + +def import_protobuf_decode_error(error_message=""): + if is_protobuf_available(): + from google.protobuf.message import DecodeError + + return DecodeError + else: + raise ImportError(PROTOBUF_IMPORT_ERROR.format(error_message)) + + +def flatten(arr: list): + res = [] + if len(arr) > 0: + for sub_arr in arr: + if isinstance(arr[0], (list, tuple)): + res.extend(flatten(sub_arr)) + else: + res.append(sub_arr) + return res + + +if is_tokenizers_available() or TYPE_CHECKING: + from tokenizers import Encoding as EncodingFast + +if is_tokenizers_available(): + from tokenizers import AddedToken +else: + + @dataclass(frozen=False, eq=True) + class AddedToken: + """ + AddedToken represents a token to be added to a Tokenizer An AddedToken can have special options defining the + way it should behave. + + The `normalized` will default to `not special` if it is not specified, similarly to the definition in + `tokenizers`. + """ + + def __init__( + self, content: str, single_word=False, lstrip=False, rstrip=False, special=False, normalized=None + ): + self.content = content + self.single_word = single_word + self.lstrip = lstrip + self.rstrip = rstrip + self.special = special + self.normalized = normalized if normalized is not None else not special + + def __getstate__(self): + return self.__dict__ + + def __str__(self): + return self.content + + +logger = logging.get_logger(__name__) + +VERY_LARGE_INTEGER = int(1e30) # This is used to set the max input length for a model with infinite size input +LARGE_INTEGER = int(1e20) # This is used when we need something big but slightly smaller than VERY_LARGE_INTEGER + +# Define type aliases and NamedTuples +TextInput = str +PreTokenizedInput = list[str] +EncodedInput = list[int] +TextInputPair = tuple[str, str] +PreTokenizedInputPair = tuple[list[str], list[str]] +EncodedInputPair = tuple[list[int], list[int]] + +# Define type aliases for text-related non-text modalities +AudioInput = Union[np.ndarray, "torch.Tensor", list[np.ndarray], list["torch.Tensor"]] + +# Slow tokenizers used to be saved in three separated files +SPECIAL_TOKENS_MAP_FILE = "special_tokens_map.json" +ADDED_TOKENS_FILE = "added_tokens.json" +TOKENIZER_CONFIG_FILE = "tokenizer_config.json" + +# Fast tokenizers (provided by HuggingFace tokenizer's library) can be saved in a single file +FULL_TOKENIZER_FILE = "tokenizer.json" +_re_tokenizer_file = re.compile(r"tokenizer\.(.*)\.json") + + +class TruncationStrategy(ExplicitEnum): + """ + Possible values for the `truncation` argument in [`PreTrainedTokenizerBase.__call__`]. Useful for tab-completion in + an IDE. + """ + + ONLY_FIRST = "only_first" + ONLY_SECOND = "only_second" + LONGEST_FIRST = "longest_first" + DO_NOT_TRUNCATE = "do_not_truncate" + + +class CharSpan(NamedTuple): + """ + Character span in the original string. + + Args: + start (`int`): Index of the first character in the original string. + end (`int`): Index of the character following the last character in the original string. + """ + + start: int + end: int + + +class TokenSpan(NamedTuple): + """ + Token span in an encoded string (list of tokens). + + Args: + start (`int`): Index of the first token in the span. + end (`int`): Index of the token following the last token in the span. + """ + + start: int + end: int + + +class BatchEncoding(UserDict): + """ + Holds the output of the [`~tokenization_utils_base.PreTrainedTokenizerBase.__call__`], + [`~tokenization_utils_base.PreTrainedTokenizerBase.encode_plus`] and + [`~tokenization_utils_base.PreTrainedTokenizerBase.batch_encode_plus`] methods (tokens, attention_masks, etc). + + This class is derived from a python dictionary and can be used as a dictionary. In addition, this class exposes + utility methods to map from word/character space to token space. + + Args: + data (`dict`, *optional*): + Dictionary of lists/arrays/tensors returned by the `__call__`/`encode_plus`/`batch_encode_plus` methods + ('input_ids', 'attention_mask', etc.). + encoding (`tokenizers.Encoding` or `Sequence[tokenizers.Encoding]`, *optional*): + If the tokenizer is a fast tokenizer which outputs additional information like mapping from word/character + space to token space the `tokenizers.Encoding` instance or list of instance (for batches) hold this + information. + tensor_type (`Union[None, str, TensorType]`, *optional*): + You can give a tensor_type here to convert the lists of integers in PyTorch/Numpy Tensors at + initialization. + prepend_batch_axis (`bool`, *optional*, defaults to `False`): + Whether or not to add a batch axis when converting to tensors (see `tensor_type` above). Note that this + parameter has an effect if the parameter `tensor_type` is set, *otherwise has no effect*. + n_sequences (`Optional[int]`, *optional*): + You can give a tensor_type here to convert the lists of integers in PyTorch/Numpy Tensors at + initialization. + """ + + def __init__( + self, + data: dict[str, Any] | None = None, + encoding: EncodingFast | Sequence[EncodingFast] | None = None, + tensor_type: None | str | TensorType = None, + prepend_batch_axis: bool = False, + n_sequences: int | None = None, + ): + super().__init__(data) + + # If encoding is not None, the fast tokenization is used + if encoding is not None and isinstance(encoding, EncodingFast): + encoding = [encoding] + + self._encodings = encoding + + if n_sequences is None and encoding is not None and encoding: + n_sequences = encoding[0].n_sequences + + self._n_sequences = n_sequences + + self.convert_to_tensors(tensor_type=tensor_type, prepend_batch_axis=prepend_batch_axis) + + @property + def n_sequences(self) -> int | None: + """ + `Optional[int]`: The number of sequences used to generate each sample from the batch encoded in this + [`BatchEncoding`]. Currently can be one of `None` (unknown), `1` (a single sentence) or `2` (a pair of + sentences) + """ + return self._n_sequences + + def __getitem__(self, item: int | str) -> Any | EncodingFast: + """ + If the key is a string, returns the value of the dict associated to `key` ('input_ids', 'attention_mask', + etc.). + + If the key is an integer, get the `tokenizers.Encoding` for batch item with index `key`. + + If the key is a slice, returns the value of the dict associated to `key` ('input_ids', 'attention_mask', etc.) + with the constraint of slice. + """ + if isinstance(item, str): + return self.data[item] + elif self._encodings is not None: + return self._encodings[item] + elif isinstance(item, slice): + return {key: self.data[key][item] for key in self.data} + else: + raise KeyError( + "Invalid key. Only three types of key are available: " + "(1) string, (2) integers for backend Encoding, and (3) slices for data subsetting." + ) + + def __getattr__(self, item: str): + try: + return self.data[item] + except KeyError: + raise AttributeError + + def __getstate__(self): + return {"data": self.data, "encodings": self._encodings} + + def __setstate__(self, state): + if "data" in state: + self.data = state["data"] + + if "encodings" in state: + self._encodings = state["encodings"] + + # After this point: + # Extended properties and methods only available for fast (Rust-based) tokenizers + # provided by HuggingFace tokenizers library. + + @property + def is_fast(self) -> bool: + """ + TOOD: ita i will rm this `bool`: Whether or not this BatchEncoding was created by a fast tokenizer. + """ + return self._encodings is not None + + @property + def encodings(self) -> list[EncodingFast] | None: + """ + `Optional[list[tokenizers.Encoding]]`: The list all encodings from the tokenization process. Returns `None` if + the input was tokenized through Python (i.e., not a fast) tokenizer. + """ + return self._encodings + + def tokens(self, batch_index: int = 0) -> list[str]: + """ + Return the list of tokens (sub-parts of the input strings after word/subword splitting and before conversion to + integer indices) at a given batch index (only works for the output of a fast tokenizer). + + Args: + batch_index (`int`, *optional*, defaults to 0): The index to access in the batch. + + Returns: + `list[str]`: The list of tokens at that index. + """ + if not self._encodings: + raise ValueError( + "tokens() is not available when using non-fast tokenizers (e.g. instance of a `XxxTokenizerFast`" + " class)." + ) + return self._encodings[batch_index].tokens + + def sequence_ids(self, batch_index: int = 0) -> list[int | None]: + """ + Return a list mapping the tokens to the id of their original sentences: + + - `None` for special tokens added around or between sequences, + - `0` for tokens corresponding to words in the first sequence, + - `1` for tokens corresponding to words in the second sequence when a pair of sequences was jointly + encoded. + + Args: + batch_index (`int`, *optional*, defaults to 0): The index to access in the batch. + + Returns: + `list[Optional[int]]`: A list indicating the sequence id corresponding to each token. Special tokens added + by the tokenizer are mapped to `None` and other tokens are mapped to the index of their corresponding + sequence. + """ + if not self._encodings: + raise ValueError( + "sequence_ids() is not available when using non-fast tokenizers (e.g. instance of a `XxxTokenizerFast`" + " class)." + ) + return self._encodings[batch_index].sequence_ids + + def word_ids(self, batch_index: int = 0) -> list[int | None]: + """ + Return a list mapping the tokens to their actual word in the initial sentence for a fast tokenizer. + + Args: + batch_index (`int`, *optional*, defaults to 0): The index to access in the batch. + + Returns: + `list[Optional[int]]`: A list indicating the word corresponding to each token. Special tokens added by the + tokenizer are mapped to `None` and other tokens are mapped to the index of their corresponding word + (several tokens will be mapped to the same word index if they are parts of that word). + """ + if not self._encodings: + raise ValueError( + "word_ids() is not available when using non-fast tokenizers (e.g. instance of a `XxxTokenizerFast`" + " class)." + ) + return self._encodings[batch_index].word_ids + + def token_to_sequence(self, batch_or_token_index: int, token_index: int | None = None) -> int: + """ + Get the index of the sequence represented by the given token. In the general use case, this method returns `0` + for a single sequence or the first sequence of a pair, and `1` for the second sequence of a pair + + Can be called as: + + - `self.token_to_sequence(token_index)` if batch size is 1 + - `self.token_to_sequence(batch_index, token_index)` if batch size is greater than 1 + + This method is particularly suited when the input sequences are provided as pre-tokenized sequences (i.e., + words are defined by the user). In this case it allows to easily associate encoded tokens with provided + tokenized words. + + Args: + batch_or_token_index (`int`): + Index of the sequence in the batch. If the batch only comprises one sequence, this can be the index of + the token in the sequence. + token_index (`int`, *optional*): + If a batch index is provided in *batch_or_token_index*, this can be the index of the token in the + sequence. + + Returns: + `int`: Index of the word in the input sequence. + """ + + if not self._encodings: + raise ValueError("token_to_sequence() is not available when using Python based tokenizers") + if token_index is not None: + batch_index = batch_or_token_index + else: + batch_index = 0 + token_index = batch_or_token_index + if batch_index < 0: + batch_index = self._batch_size + batch_index + if token_index < 0: + token_index = self._seq_len + token_index + return self._encodings[batch_index].token_to_sequence(token_index) + + def token_to_word(self, batch_or_token_index: int, token_index: int | None = None) -> int: + """ + Get the index of the word corresponding (i.e. comprising) to an encoded token in a sequence of the batch. + + Can be called as: + + - `self.token_to_word(token_index)` if batch size is 1 + - `self.token_to_word(batch_index, token_index)` if batch size is greater than 1 + + This method is particularly suited when the input sequences are provided as pre-tokenized sequences (i.e., + words are defined by the user). In this case it allows to easily associate encoded tokens with provided + tokenized words. + + Args: + batch_or_token_index (`int`): + Index of the sequence in the batch. If the batch only comprise one sequence, this can be the index of + the token in the sequence. + token_index (`int`, *optional*): + If a batch index is provided in *batch_or_token_index*, this can be the index of the token in the + sequence. + + Returns: + `int`: Index of the word in the input sequence. + """ + + if not self._encodings: + raise ValueError("token_to_word() is not available when using Python based tokenizers") + if token_index is not None: + batch_index = batch_or_token_index + else: + batch_index = 0 + token_index = batch_or_token_index + if batch_index < 0: + batch_index = self._batch_size + batch_index + if token_index < 0: + token_index = self._seq_len + token_index + return self._encodings[batch_index].token_to_word(token_index) + + def word_to_tokens( + self, batch_or_word_index: int, word_index: int | None = None, sequence_index: int = 0 + ) -> TokenSpan | None: + """ + Get the encoded token span corresponding to a word in a sequence of the batch. + + Token spans are returned as a [`~tokenization_utils_base.TokenSpan`] with: + + - **start** -- Index of the first token. + - **end** -- Index of the token following the last token. + + Can be called as: + + - `self.word_to_tokens(word_index, sequence_index: int = 0)` if batch size is 1 + - `self.word_to_tokens(batch_index, word_index, sequence_index: int = 0)` if batch size is greater or equal to + 1 + + This method is particularly suited when the input sequences are provided as pre-tokenized sequences (i.e. words + are defined by the user). In this case it allows to easily associate encoded tokens with provided tokenized + words. + + Args: + batch_or_word_index (`int`): + Index of the sequence in the batch. If the batch only comprises one sequence, this can be the index of + the word in the sequence. + word_index (`int`, *optional*): + If a batch index is provided in *batch_or_token_index*, this can be the index of the word in the + sequence. + sequence_index (`int`, *optional*, defaults to 0): + If pair of sequences are encoded in the batch this can be used to specify which sequence in the pair (0 + or 1) the provided word index belongs to. + + Returns: + ([`~tokenization_utils_base.TokenSpan`], *optional*): Span of tokens in the encoded sequence. Returns + `None` if no tokens correspond to the word. This can happen especially when the token is a special token + that has been used to format the tokenization. For example when we add a class token at the very beginning + of the tokenization. + """ + + if not self._encodings: + raise ValueError("word_to_tokens() is not available when using Python based tokenizers") + if word_index is not None: + batch_index = batch_or_word_index + else: + batch_index = 0 + word_index = batch_or_word_index + if batch_index < 0: + batch_index = self._batch_size + batch_index + if word_index < 0: + word_index = self._seq_len + word_index + span = self._encodings[batch_index].word_to_tokens(word_index, sequence_index) + return TokenSpan(*span) if span is not None else None + + def token_to_chars(self, batch_or_token_index: int, token_index: int | None = None) -> CharSpan | None: + """ + Get the character span corresponding to an encoded token in a sequence of the batch. + + Character spans are returned as a [`~tokenization_utils_base.CharSpan`] with: + + - **start** -- Index of the first character in the original string associated to the token. + - **end** -- Index of the character following the last character in the original string associated to the + token. + + Can be called as: + + - `self.token_to_chars(token_index)` if batch size is 1 + - `self.token_to_chars(batch_index, token_index)` if batch size is greater or equal to 1 + + Args: + batch_or_token_index (`int`): + Index of the sequence in the batch. If the batch only comprise one sequence, this can be the index of + the token in the sequence. + token_index (`int`, *optional*): + If a batch index is provided in *batch_or_token_index*, this can be the index of the token or tokens in + the sequence. + + Returns: + [`~tokenization_utils_base.CharSpan`]: Span of characters in the original string, or None, if the token + (e.g. , ) doesn't correspond to any chars in the origin string. + """ + + if not self._encodings: + raise ValueError("token_to_chars() is not available when using Python based tokenizers") + if token_index is not None: + batch_index = batch_or_token_index + else: + batch_index = 0 + token_index = batch_or_token_index + span_indices = self._encodings[batch_index].token_to_chars(token_index) + + return CharSpan(*span_indices) if span_indices is not None else None + + def char_to_token(self, batch_or_char_index: int, char_index: int | None = None, sequence_index: int = 0) -> int: + """ + Get the index of the token in the encoded output comprising a character in the original string for a sequence + of the batch. + + Can be called as: + + - `self.char_to_token(char_index)` if batch size is 1 + - `self.char_to_token(batch_index, char_index)` if batch size is greater or equal to 1 + + This method is particularly suited when the input sequences are provided as pre-tokenized sequences (i.e. words + are defined by the user). In this case it allows to easily associate encoded tokens with provided tokenized + words. + + Args: + batch_or_char_index (`int`): + Index of the sequence in the batch. If the batch only comprise one sequence, this can be the index of + the word in the sequence + char_index (`int`, *optional*): + If a batch index is provided in *batch_or_token_index*, this can be the index of the word in the + sequence. + sequence_index (`int`, *optional*, defaults to 0): + If pair of sequences are encoded in the batch this can be used to specify which sequence in the pair (0 + or 1) the provided character index belongs to. + + + Returns: + `int`: Index of the token, or None if the char index refers to a whitespace only token and whitespace is + trimmed with `trim_offsets=True`. + """ + + if not self._encodings: + raise ValueError("char_to_token() is not available when using Python based tokenizers") + if char_index is not None: + batch_index = batch_or_char_index + else: + batch_index = 0 + char_index = batch_or_char_index + return self._encodings[batch_index].char_to_token(char_index, sequence_index) + + def word_to_chars( + self, batch_or_word_index: int, word_index: int | None = None, sequence_index: int = 0 + ) -> CharSpan: + """ + Get the character span in the original string corresponding to given word in a sequence of the batch. + + Character spans are returned as a CharSpan NamedTuple with: + + - start: index of the first character in the original string + - end: index of the character following the last character in the original string + + Can be called as: + + - `self.word_to_chars(word_index)` if batch size is 1 + - `self.word_to_chars(batch_index, word_index)` if batch size is greater or equal to 1 + + Args: + batch_or_word_index (`int`): + Index of the sequence in the batch. If the batch only comprise one sequence, this can be the index of + the word in the sequence + word_index (`int`, *optional*): + If a batch index is provided in *batch_or_token_index*, this can be the index of the word in the + sequence. + sequence_index (`int`, *optional*, defaults to 0): + If pair of sequences are encoded in the batch this can be used to specify which sequence in the pair (0 + or 1) the provided word index belongs to. + + Returns: + `CharSpan` or `list[CharSpan]`: Span(s) of the associated character or characters in the string. CharSpan + are NamedTuple with: + + - start: index of the first character associated to the token in the original string + - end: index of the character following the last character associated to the token in the original + string + """ + + if not self._encodings: + raise ValueError("word_to_chars() is not available when using Python based tokenizers") + if word_index is not None: + batch_index = batch_or_word_index + else: + batch_index = 0 + word_index = batch_or_word_index + return CharSpan(*(self._encodings[batch_index].word_to_chars(word_index, sequence_index))) + + def char_to_word(self, batch_or_char_index: int, char_index: int | None = None, sequence_index: int = 0) -> int: + """ + Get the word in the original string corresponding to a character in the original string of a sequence of the + batch. + + Can be called as: + + - `self.char_to_word(char_index)` if batch size is 1 + - `self.char_to_word(batch_index, char_index)` if batch size is greater than 1 + + This method is particularly suited when the input sequences are provided as pre-tokenized sequences (i.e. words + are defined by the user). In this case it allows to easily associate encoded tokens with provided tokenized + words. + + Args: + batch_or_char_index (`int`): + Index of the sequence in the batch. If the batch only comprise one sequence, this can be the index of + the character in the original string. + char_index (`int`, *optional*): + If a batch index is provided in *batch_or_token_index*, this can be the index of the character in the + original string. + sequence_index (`int`, *optional*, defaults to 0): + If pair of sequences are encoded in the batch this can be used to specify which sequence in the pair (0 + or 1) the provided character index belongs to. + + + Returns: + `int` or `list[int]`: Index or indices of the associated encoded token(s). + """ + + if not self._encodings: + raise ValueError("char_to_word() is not available when using Python based tokenizers") + if char_index is not None: + batch_index = batch_or_char_index + else: + batch_index = 0 + char_index = batch_or_char_index + return self._encodings[batch_index].char_to_word(char_index, sequence_index) + + def convert_to_tensors(self, tensor_type: str | TensorType | None = None, prepend_batch_axis: bool = False): + """ + Convert the inner content to tensors. + + Args: + tensor_type (`str` or [`~utils.TensorType`], *optional*): + The type of tensors to use. If `str`, should be one of the values of the enum [`~utils.TensorType`]. If + `None`, no modification is done. + prepend_batch_axis (`int`, *optional*, defaults to `False`): + Whether or not to add the batch dimension during the conversion. + """ + if tensor_type is None: + return self + + # Convert to TensorType + if not isinstance(tensor_type, TensorType): + tensor_type = TensorType(tensor_type) + + if tensor_type == TensorType.PYTORCH: + if not is_torch_available(): + raise ImportError("Unable to convert output to PyTorch tensors format, PyTorch is not installed.") + import torch + + def as_tensor(value, dtype=None): + if isinstance(value, list) and len(value) > 0 and isinstance(value[0], np.ndarray): + return torch.from_numpy(np.array(value)) + if len(flatten(value)) == 0 and dtype is None: + dtype = torch.int64 + return torch.tensor(value, dtype=dtype) + + is_tensor = torch.is_tensor + + elif tensor_type == TensorType.MLX: + if not is_mlx_available(): + raise ImportError("Unable to convert output to MLX tensors format, MLX is not installed.") + import mlx.core as mx + + def as_tensor(value, dtype=None): + if len(flatten(value)) == 0 and dtype is None: + dtype = mx.int32 + return mx.array(value, dtype=dtype) + + def is_tensor(obj): + return isinstance(obj, mx.array) + else: + + def as_tensor(value, dtype=None): + if ( + isinstance(value, (list, tuple)) + and len(value) > 0 + and isinstance(value[0], (list, tuple, np.ndarray)) + ): + value_lens = [len(val) for val in value] + if len(set(value_lens)) > 1 and dtype is None: + # we have a ragged list so handle explicitly + value = as_tensor([np.asarray(val) for val in value], dtype=object) + if len(flatten(value)) == 0 and dtype is None: + dtype = np.int64 + return np.asarray(value, dtype=dtype) + + is_tensor = is_numpy_array + + # Do the tensor conversion in batch + for key, value in self.items(): + try: + if prepend_batch_axis: + value = [value] + + if not is_tensor(value): + tensor = as_tensor(value) + + # Removing this for now in favor of controlling the shape with `prepend_batch_axis` + # # at-least2d + # if tensor.ndim > 2: + # tensor = tensor.squeeze(0) + # elif tensor.ndim < 2: + # tensor = tensor[None, :] + + self[key] = tensor + except Exception as e: + if key == "overflowing_tokens": + raise ValueError( + "Unable to create tensor returning overflowing tokens of different lengths. " + "Please see if a fast version of this tokenizer is available to have this feature available." + ) from e + raise ValueError( + "Unable to create tensor, you should probably activate truncation and/or padding with" + " 'padding=True' 'truncation=True' to have batched tensors with the same length. Perhaps your" + f" features (`{key}` in this case) have excessive nesting (inputs type `list` where type `int` is" + " expected)." + ) from e + + return self + + def to(self, device: str | torch.device, *, non_blocking: bool = False) -> BatchEncoding: + """ + Send all values to device by calling `v.to(device, non_blocking=non_blocking)` (PyTorch only). + + Args: + device (`str` or `torch.device`): The device to put the tensors on. + non_blocking (`bool`): Whether to perform the copy asynchronously. + + Returns: + [`BatchEncoding`]: The same instance after modification. + """ + requires_backends(self, ["torch"]) + + # This check catches things like APEX blindly calling "to" on all inputs to a module + # Otherwise it passes the casts down and casts the LongTensor containing the token idxs + # into a HalfTensor + if isinstance(device, str) or is_torch_device(device) or isinstance(device, int): + self.data = { + k: v.to(device=device, non_blocking=non_blocking) if hasattr(v, "to") and callable(v.to) else v + for k, v in self.data.items() + } + else: + logger.warning(f"Attempting to cast a BatchEncoding to type {str(device)}. This is not supported.") + return self + + +ENCODE_KWARGS_DOCSTRING = r""" + add_special_tokens (`bool`, *optional*, defaults to `True`): + Whether or not to add special tokens when encoding the sequences. This will use the underlying + `PretrainedTokenizerBase.build_inputs_with_special_tokens` function, which defines which tokens are + automatically added to the input ids. This is useful if you want to add `bos` or `eos` tokens + automatically. + padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `False`): + Activates and controls padding. Accepts the following values: + + - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single + sequence is provided). + - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum + acceptable input length for the model if that argument is not provided. + - `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different + lengths). + truncation (`bool`, `str` or [`~tokenization_utils_base.TruncationStrategy`], *optional*, defaults to `False`): + Activates and controls truncation. Accepts the following values: + + - `True` or `'longest_first'`: Truncate to a maximum length specified with the argument `max_length` or + to the maximum acceptable input length for the model if that argument is not provided. This will + truncate token by token, removing a token from the longest sequence in the pair if a pair of + sequences (or a batch of pairs) is provided. + - `'only_first'`: Truncate to a maximum length specified with the argument `max_length` or to the + maximum acceptable input length for the model if that argument is not provided. This will only + truncate the first sequence of a pair if a pair of sequences (or a batch of pairs) is provided. + - `'only_second'`: Truncate to a maximum length specified with the argument `max_length` or to the + maximum acceptable input length for the model if that argument is not provided. This will only + truncate the second sequence of a pair if a pair of sequences (or a batch of pairs) is provided. + - `False` or `'do_not_truncate'` (default): No truncation (i.e., can output batch with sequence lengths + greater than the model maximum admissible input size). + max_length (`int`, *optional*): + Controls the maximum length to use by one of the truncation/padding parameters. + + If left unset or set to `None`, this will use the predefined model maximum length if a maximum length + is required by one of the truncation/padding parameters. If the model has no specific maximum input + length (like XLNet) truncation/padding to a maximum length will be deactivated. + stride (`int`, *optional*, defaults to 0): + If set to a number along with `max_length`, the overflowing tokens returned when + `return_overflowing_tokens=True` will contain some tokens from the end of the truncated sequence + returned to provide some overlap between truncated and overflowing sequences. The value of this + argument defines the number of overlapping tokens. + is_split_into_words (`bool`, *optional*, defaults to `False`): + Whether or not the input is already pre-tokenized (e.g., split into words). If set to `True`, the + tokenizer assumes the input is already split into words (for instance, by splitting it on whitespace) + which it will tokenize. This is useful for NER or token classification. + pad_to_multiple_of (`int`, *optional*): + If set will pad the sequence to a multiple of the provided value. Requires `padding` to be activated. + This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability + `>= 7.5` (Volta). + padding_side (`str`, *optional*): + The side on which the model should have padding applied. Should be selected between ['right', 'left']. + Default value is picked from the class attribute of the same name. + return_tensors (`str` or [`~utils.TensorType`], *optional*): + If set, will return tensors instead of list of python integers. Acceptable values are: + + - `'pt'`: Return PyTorch `torch.Tensor` objects. + - `'np'`: Return Numpy `np.ndarray` objects. +""" + +ENCODE_PLUS_ADDITIONAL_KWARGS_DOCSTRING = r""" + return_token_type_ids (`bool`, *optional*): + Whether to return token type IDs. If left to the default, will return the token type IDs according to + the specific tokenizer's default, defined by the `return_outputs` attribute. + + [What are token type IDs?](../glossary#token-type-ids) + return_attention_mask (`bool`, *optional*): + Whether to return the attention mask. If left to the default, will return the attention mask according + to the specific tokenizer's default, defined by the `return_outputs` attribute. + + [What are attention masks?](../glossary#attention-mask) + return_overflowing_tokens (`bool`, *optional*, defaults to `False`): + Whether or not to return overflowing token sequences. If a pair of sequences of input ids (or a batch + of pairs) is provided with `truncation_strategy = longest_first` or `True`, an error is raised instead + of returning overflowing tokens. + return_special_tokens_mask (`bool`, *optional*, defaults to `False`): + Whether or not to return special tokens mask information. + return_offsets_mapping (`bool`, *optional*, defaults to `False`): + Whether or not to return `(char_start, char_end)` for each token. + + This is only available on fast tokenizers inheriting from [`PreTrainedTokenizerFast`], if using + Python's tokenizer, this method will raise `NotImplementedError`. + return_length (`bool`, *optional*, defaults to `False`): + Whether or not to return the lengths of the encoded inputs. + verbose (`bool`, *optional*, defaults to `True`): + Whether or not to print more information and warnings. + **kwargs: passed to the `self.tokenize()` method + + Return: + [`BatchEncoding`]: A [`BatchEncoding`] with the following fields: + + - **input_ids** -- List of token ids to be fed to a model. + + [What are input IDs?](../glossary#input-ids) + + - **token_type_ids** -- List of token type ids to be fed to a model (when `return_token_type_ids=True` or + if *"token_type_ids"* is in `self.model_input_names`). + + [What are token type IDs?](../glossary#token-type-ids) + + - **attention_mask** -- List of indices specifying which tokens should be attended to by the model (when + `return_attention_mask=True` or if *"attention_mask"* is in `self.model_input_names`). + + [What are attention masks?](../glossary#attention-mask) + + - **overflowing_tokens** -- List of overflowing tokens sequences (when a `max_length` is specified and + `return_overflowing_tokens=True`). + - **num_truncated_tokens** -- Number of tokens truncated (when a `max_length` is specified and + `return_overflowing_tokens=True`). + - **special_tokens_mask** -- List of 0s and 1s, with 1 specifying added special tokens and 0 specifying + regular sequence tokens (when `add_special_tokens=True` and `return_special_tokens_mask=True`). + - **length** -- The length of the inputs (when `return_length=True`) +""" + + +INIT_TOKENIZER_DOCSTRING = r""" + Class attributes (overridden by derived classes) + + - **vocab_files_names** (`dict[str, str]`) -- A dictionary with, as keys, the `__init__` keyword name of each + vocabulary file required by the model, and as associated values, the filename for saving the associated file + (string). + - **pretrained_vocab_files_map** (`dict[str, dict[str, str]]`) -- A dictionary of dictionaries, with the + high-level keys being the `__init__` keyword name of each vocabulary file required by the model, the + low-level being the `short-cut-names` of the pretrained models with, as associated values, the `url` to the + associated pretrained vocabulary file. + - **model_input_names** (`list[str]`) -- A list of inputs expected in the forward pass of the model. + - **padding_side** (`str`) -- The default value for the side on which the model should have padding applied. + Should be `'right'` or `'left'`. + - **truncation_side** (`str`) -- The default value for the side on which the model should have truncation + applied. Should be `'right'` or `'left'`. + + Args: + model_max_length (`int`, *optional*): + The maximum length (in number of tokens) for the inputs to the transformer model. When the tokenizer is + loaded with [`~tokenization_utils_base.PreTrainedTokenizerBase.from_pretrained`], this will be set to the + value stored for the associated model in `max_model_input_sizes` (see above). If no value is provided, will + default to VERY_LARGE_INTEGER (`int(1e30)`). + padding_side (`str`, *optional*): + The side on which the model should have padding applied. Should be selected between ['right', 'left']. + Default value is picked from the class attribute of the same name. + truncation_side (`str`, *optional*): + The side on which the model should have truncation applied. Should be selected between ['right', 'left']. + Default value is picked from the class attribute of the same name. + chat_template (`str`, *optional*): + A Jinja template string that will be used to format lists of chat messages. See + https://huggingface.co/docs/transformers/chat_templating for a full description. + model_input_names (`list[string]`, *optional*): + The list of inputs accepted by the forward pass of the model (like `"token_type_ids"` or + `"attention_mask"`). Default value is picked from the class attribute of the same name. + bos_token (`str` or `tokenizers.AddedToken`, *optional*): + A special token representing the beginning of a sentence. + eos_token (`str` or `tokenizers.AddedToken`, *optional*): + A special token representing the end of a sentence. + unk_token (`str` or `tokenizers.AddedToken`, *optional*): + A special token representing an out-of-vocabulary token. + sep_token (`str` or `tokenizers.AddedToken`, *optional*): + A special token separating two different sentences in the same input (used by BERT for instance). + pad_token (`str` or `tokenizers.AddedToken`, *optional*): + A special token used to make arrays of tokens the same size for batching purpose. Will then be ignored by + attention mechanisms or loss computation. + cls_token (`str` or `tokenizers.AddedToken`, *optional*): + A special token representing the class of the input (used by BERT for instance). + mask_token (`str` or `tokenizers.AddedToken`, *optional*): + A special token representing a masked token (used by masked-language modeling pretraining objectives, like + BERT). Will be associated to `self.mask_token` and `self.mask_token_id`. + extra_special_tokens (list of `str` or `tokenizers.AddedToken`, *optional*): + A list of extra model-specific special tokens. Add them here to ensure they are skipped when decoding with + `skip_special_tokens` is set to True. If they are not part of the vocabulary, they will be added at the end + of the vocabulary. + split_special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not the special tokens should be split during the tokenization process. Passing will affect the + internal state of the tokenizer. The default behavior is to not split special tokens. This means that if + `` is the `bos_token`, then `tokenizer.tokenize("") = ['`]. Otherwise, if + `split_special_tokens=True`, then `tokenizer.tokenize("")` will be give `['<','s', '>']`. +""" + + +@add_end_docstrings(INIT_TOKENIZER_DOCSTRING) +class PreTrainedTokenizerBase(PushToHubMixin): + """ + Base class for all tokenizer backends. + """ + + vocab_files_names: dict[str, str] = {} + pretrained_vocab_files_map: dict[str, dict[str, str]] = {} + _auto_class: str | None = None + + # first name has to correspond to main model input name + # to make sure `tokenizer.pad(...)` works correctly + model_input_names: list[str] = ["input_ids", "attention_mask"] + padding_side: str = "right" + truncation_side: str = "right" + slow_tokenizer_class = None + + # Special tokens support (moved from SpecialTokensMixin) + # V5: Clean separation of named special tokens from extra special tokens + SPECIAL_TOKENS_ATTRIBUTES = [ + "bos_token", + "eos_token", + "unk_token", + "sep_token", + "pad_token", + "cls_token", + "mask_token", + ] + + def __init__(self, **kwargs): + self.init_inputs = () + for key in kwargs: + if hasattr(self, key) and callable(getattr(self, key)): + raise AttributeError(f"{key} conflicts with the method {key} in {self.__class__.__name__}") + + # V5: Convert deprecated additional_special_tokens to extra_special_tokens before storing init_kwargs + if "additional_special_tokens" in kwargs and "extra_special_tokens" not in kwargs: + kwargs["extra_special_tokens"] = kwargs.pop("additional_special_tokens") + + self.init_kwargs = copy.deepcopy(kwargs) + self.name_or_path = kwargs.pop("name_or_path", "") + self._processor_class = kwargs.pop("processor_class", None) + + self._pad_token_type_id = 0 + self.verbose = kwargs.pop("verbose", False) + + # V5: Separate storage for named special tokens and extra special tokens + self._special_tokens_map = dict.fromkeys(self.SPECIAL_TOKENS_ATTRIBUTES) + self._extra_special_tokens = [] # List of extra model-specific special tokens + + # V5: track both explicit and auto-detected model-specific tokens + explicit_model_specific_tokens = kwargs.pop("model_specific_special_tokens", None) + if explicit_model_specific_tokens is None: + explicit_model_specific_tokens = {} + elif not isinstance(explicit_model_specific_tokens, dict): + raise TypeError("model_specific_special_tokens must be a dictionary of token name to token value") + auto_model_specific_tokens = {} + + # Directly set hidden values to allow init with tokens not yet in vocab + for key in list(kwargs.keys()): + if key in self.SPECIAL_TOKENS_ATTRIBUTES: + value = kwargs.pop(key) + if value is None: + continue + if isinstance(value, (str, AddedToken)): + self._special_tokens_map[key] = value + else: + raise TypeError(f"Special token {key} has to be either str or AddedToken but got: {type(value)}") + elif key == "extra_special_tokens": + value = kwargs.pop(key) + if value is None: + continue + if isinstance(value, dict): + self._set_model_specific_special_tokens(special_tokens=value) + elif isinstance(value, (list, tuple)): + self._extra_special_tokens = list(value) + else: + raise TypeError("extra_special_tokens must be a list/tuple of tokens or a dict of named tokens") + elif ( + key.endswith("_token") + and key not in self.SPECIAL_TOKENS_ATTRIBUTES + and isinstance(kwargs[key], (str, AddedToken)) + ): + value = kwargs.pop(key) + if value is None: + continue + auto_model_specific_tokens[key] = value + + # For backward compatibility we fallback to set model_max_length from max_len if provided + model_max_length = kwargs.pop("model_max_length", kwargs.pop("max_len", None)) + self.model_max_length = model_max_length if model_max_length is not None else VERY_LARGE_INTEGER + + self.padding_side = kwargs.pop("padding_side", self.padding_side) + if self.padding_side not in ["right", "left"]: + raise ValueError( + f"Padding side should be selected between 'right' and 'left', current value: {self.padding_side}" + ) + + self.truncation_side = kwargs.pop("truncation_side", self.truncation_side) + if self.truncation_side not in ["right", "left"]: + raise ValueError( + f"Truncation side should be selected between 'right' and 'left', current value: {self.truncation_side}" + ) + + self.model_input_names = kwargs.pop("model_input_names", self.model_input_names) + + # By default, clean up tokenization spaces for both fast and slow tokenizers + self.clean_up_tokenization_spaces = kwargs.pop("clean_up_tokenization_spaces", False) + + # By default, do not split special tokens for both fast and slow tokenizers + self.split_special_tokens = kwargs.pop("split_special_tokens", False) + + self._in_target_context_manager = False + + self.chat_template = kwargs.pop("chat_template", None) + if isinstance(self.chat_template, (list, tuple)): + # Chat templates are stored as lists of dicts with fixed key names, + # we reconstruct that into a single dict while loading them. + self.chat_template = {template["name"]: template["template"] for template in self.chat_template} + + model_specific_tokens = {**auto_model_specific_tokens, **explicit_model_specific_tokens} + if model_specific_tokens: + self._set_model_specific_special_tokens(special_tokens=model_specific_tokens) + + self.deprecation_warnings = {} + + # Backend information (V5: tracking which backend and files were used) + self.backend = kwargs.pop("backend", None) + self.files_loaded = kwargs.pop("files_loaded", []) + + def _set_processor_class(self, processor_class: str): + """Sets processor class so it can be serialized in `tokenizer_config.json`.""" + self._processor_class = processor_class + + # ---- Special tokens API (moved from SpecialTokensMixin) ---- + def add_special_tokens( + self, + special_tokens_dict: dict[str, str | AddedToken | Sequence[str | AddedToken]], + replace_extra_special_tokens=True, + ) -> int: + """ + Add a dictionary of special tokens (eos, pad, cls, etc.) to the encoder and link them to class attributes. If + special tokens are NOT in the vocabulary, they are added to it (indexed starting from the last index of the + current vocabulary). + + When adding new tokens to the vocabulary, you should make sure to also resize the token embedding matrix of the + model so that its embedding matrix matches the tokenizer. + + In order to do that, please use the [`~PreTrainedModel.resize_token_embeddings`] method. + + Using `add_special_tokens` will ensure your special tokens can be used in several ways: + + - Special tokens can be skipped when decoding using `skip_special_tokens = True`. + - Special tokens are carefully handled by the tokenizer (they are never split), similar to `AddedTokens`. + - You can easily refer to special tokens using tokenizer class attributes like `tokenizer.cls_token`. This + makes it easy to develop model-agnostic training and fine-tuning scripts. + + When possible, special tokens are already registered for provided pretrained models (for instance + [`BertTokenizer`] `cls_token` is already registered to be `'[CLS]'` and XLM's one is also registered to be + `''`). + + Args: + special_tokens_dict (dictionary *str* to *str*, `tokenizers.AddedToken`, or `Sequence[Union[str, AddedToken]]`): + Keys should be in the list of predefined special attributes: [`bos_token`, `eos_token`, `unk_token`, + `sep_token`, `pad_token`, `cls_token`, `mask_token`, `extra_special_tokens`]. + + Tokens are only added if they are not already in the vocabulary (tested by checking if the tokenizer + assign the index of the `unk_token` to them). + replace_extra_special_tokens (`bool`, *optional*, defaults to `True`): + If `True`, the existing list of extra special tokens will be replaced by the list provided in + `special_tokens_dict`. Otherwise, `extra_special_tokens` will be extended. In the former + case, the tokens will NOT be removed from the tokenizer's full vocabulary - they are only being flagged + as non-special tokens. Remember, this only affects which tokens are skipped during decoding, not the + `added_tokens_encoder` and `added_tokens_decoder`. This means that the previous + `extra_special_tokens` are still added tokens, and will not be split by the model. + + Returns: + `int`: Number of tokens added to the vocabulary. + + Examples: + + ```python + # Let's see how to add a new classification token to GPT-2 + tokenizer = GPT2Tokenizer.from_pretrained("openai-community/gpt2") + model = GPT2Model.from_pretrained("openai-community/gpt2") + + special_tokens_dict = {"cls_token": ""} + + num_added_toks = tokenizer.add_special_tokens(special_tokens_dict) + print("We have added", num_added_toks, "tokens") + # Notice: resize_token_embeddings expect to receive the full size of the new vocabulary, i.e., the length of the tokenizer. + model.resize_token_embeddings(len(tokenizer)) + + assert tokenizer.cls_token == "" + ```""" + if not special_tokens_dict: + return 0 + + # V5: Allowed keys are SPECIAL_TOKENS_ATTRIBUTES + "extra_special_tokens" + # Backward compatibility: convert "additional_special_tokens" to "extra_special_tokens" + special_tokens_dict = dict(special_tokens_dict) + if "additional_special_tokens" in special_tokens_dict: + special_tokens_dict.setdefault( + "extra_special_tokens", special_tokens_dict.pop("additional_special_tokens") + ) + + allowed_keys = set(self.SPECIAL_TOKENS_ATTRIBUTES) | {"extra_special_tokens"} + tokens_to_add = [] + for key, value in special_tokens_dict.items(): + if key not in allowed_keys: + raise ValueError(f"Key {key} is not a valid special token. Valid keys are: {allowed_keys}") + + if self.verbose: + logger.info(f"Assigning {value} to the {key} key of the tokenizer") + + if key == "extra_special_tokens": + if not isinstance(value, (list, tuple)) or not all(isinstance(t, (str, AddedToken)) for t in value): + raise ValueError(f"Tokens {value} for key {key} should all be str or AddedToken instances") + new_tokens = [ + ( + AddedToken(t, rstrip=False, lstrip=False, normalized=False, special=True) + if isinstance(t, str) + else t + ) + for t in value + if replace_extra_special_tokens or str(t) not in self.extra_special_tokens + ] + if replace_extra_special_tokens and new_tokens: + self._extra_special_tokens = list(new_tokens) + else: + self._extra_special_tokens.extend(new_tokens) + tokens_to_add.extend(new_tokens) + else: + if not isinstance(value, (str, AddedToken)): + raise ValueError(f"Token {value} for key {key} should be a str or an AddedToken instance") + if isinstance(value, str): + value = AddedToken(value, rstrip=False, lstrip=False, normalized=False, special=True) + setattr(self, key, value) + tokens_to_add.append(value) + + return self.add_tokens(tokens_to_add, special_tokens=True) + + def add_tokens( + self, new_tokens: str | AddedToken | Sequence[str | AddedToken], special_tokens: bool = False + ) -> int: + """ + #TODO remove this from here! PreTrainedTOkeniuzerBase should be agnostic of AddedToken. + + Add a list of new tokens. If the new tokens are not in the vocabulary, they are added to the end. Added tokens and + tokens from the vocabulary of the tokenization algorithm are therefore not treated in the same way. + + Args: + new_tokens (`str`, `tokenizers.AddedToken` or a sequence of *str* or `tokenizers.AddedToken`): + Tokens are only added if they are not already in the vocabulary. `tokenizers.AddedToken` wraps a string + token to let you personalize its behavior: whether this token should only match against a single word, + whether this token should strip all potential whitespaces on the left side, whether this token should + strip all potential whitespaces on the right side, etc. + special_tokens (`bool`, *optional*, defaults to `False`): + Specifies if the token is special. This mostly changes the normalization behavior + See details for `tokenizers.AddedToken` in HuggingFace tokenizers library. + + Returns: + `int`: Number of tokens added to the vocabulary. + + Examples: + + ```python + # Let's see how to increase the vocabulary of Bert model and tokenizer + tokenizer = BertTokenizerFast.from_pretrained("google-bert/bert-base-uncased") + model = BertModel.from_pretrained("google-bert/bert-base-uncased") + + num_added_toks = tokenizer.add_tokens(["new_tok1", "my_new-tok2"]) + print("We have added", num_added_toks, "tokens") + # Notice: resize_token_embeddings expect to receive the full size of the new vocabulary, i.e., the length of the tokenizer. + model.resize_token_embeddings(len(tokenizer)) + ```""" + if not new_tokens: + return 0 + + if not isinstance(new_tokens, (list, tuple)): + new_tokens = [new_tokens] + return self._add_tokens(new_tokens, special_tokens=special_tokens) + + def _add_tokens(self, new_tokens: list[str] | list[AddedToken], special_tokens: bool = False) -> int: + raise NotImplementedError + + @property + def pad_token_type_id(self) -> int: + return self._pad_token_type_id + + def __setattr__(self, key, value): + # Handle _id/_ids suffix (eg. bos_token_id -> bos_token) + key_without_id = key.removesuffix("_ids").removesuffix("_id") if key.endswith(("_id", "_ids")) else key + + # Named special tokens (bos_token, eos_token, etc.) + if key_without_id in self.SPECIAL_TOKENS_ATTRIBUTES: + if key != key_without_id and value is not None: + value = self.convert_ids_to_tokens(value) + if value is not None and not isinstance(value, (str, AddedToken)): + raise ValueError(f"Cannot set a non-string value as the {key_without_id}") + self._special_tokens_map[key_without_id] = value + return + + # Extra special tokens: model-specific special tokens without standard names (eg. ) + if key_without_id == "extra_special_tokens": + if key != key_without_id and value is not None and isinstance(value, (list, tuple)): + value = [self.convert_ids_to_tokens(v) for v in value] + if not isinstance(value, (list, tuple)) and value is not None: + raise ValueError(f"extra_special_tokens must be a list or tuple, got {type(value)}") + self._extra_special_tokens = [] if value is None else list(value) + return + + super().__setattr__(key, value) + + def __getattr__(self, key): + # Handle _id/_ids suffix (eg. bos_token_id -> bos_token) + key_without_id = key.removesuffix("_ids").removesuffix("_id") if key.endswith(("_id", "_ids")) else key + + # Named special tokens (bos_token, eos_token, etc.) + if key_without_id in self.SPECIAL_TOKENS_ATTRIBUTES: + token_value = self._special_tokens_map.get(key_without_id) + if token_value is None: + if self.verbose: + logger.error(f"Using {key}, but it is not set yet.") + return None + return self.convert_tokens_to_ids(str(token_value)) if key != key_without_id else str(token_value) + + # Extra special tokens + if key_without_id == "extra_special_tokens": + tokens = [str(tok) for tok in self._extra_special_tokens] + return self.convert_tokens_to_ids(tokens) if key != key_without_id else tokens + + if key not in self.__dict__: + raise AttributeError(f"{self.__class__.__name__} has no attribute {key}") + return super().__getattr__(key) + + def get_special_tokens_mask( + self, token_ids_0: list[int], token_ids_1: list[int] | None = None, already_has_special_tokens: bool = False + ) -> list[int]: + """ + Retrieve sequence ids from a token list that has no special tokens added. + + For fast tokenizers, data collators call this with `already_has_special_tokens=True` to build a mask over an + already-formatted sequence. In that case, we compute the mask by checking membership in `all_special_ids`. + + Args: + token_ids_0: List of IDs for the (possibly already formatted) sequence. + token_ids_1: Unused when `already_has_special_tokens=True`. Must be None in that case. + already_has_special_tokens: Whether the sequence is already formatted with special tokens. + + Returns: + A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token. + """ + if already_has_special_tokens: + if token_ids_1 is not None: + raise ValueError( + "You should not supply a second sequence if the provided sequence of ids is already formatted " + "with special tokens for the model." + ) + special_ids = set(self.all_special_ids) + return [1 if int(tid) in special_ids else 0 for tid in token_ids_0] + + # Default base implementation for non-formatted sequences is not provided here. + # Concrete tokenizer classes should override this for their specific formatting rules. + raise NotImplementedError( + f"{self.__class__.__name__} does not implement get_special_tokens_mask for non-formatted sequences" + ) + + @property + def special_tokens_map(self) -> dict[str, str]: + """ + `dict[str, str]`: A flat dictionary mapping named special token attributes to their string values. + + Only includes the standard named special tokens (bos_token, eos_token, etc.), not extra_special_tokens. + This provides a clean, flat structure without mixed types. + + Returns: + A dictionary with keys like 'bos_token', 'eos_token', etc., and string values. + + **V5 Change**: This now returns only named tokens. Use `extra_special_tokens` for the additional tokens. + """ + return { + attr: str(self._special_tokens_map[attr]) + for attr in self.SPECIAL_TOKENS_ATTRIBUTES + if self._special_tokens_map.get(attr) is not None + } + + # Note: extra_special_tokens and extra_special_tokens_ids are handled by __getattr__ and __setattr__ + # We don't define them as @property to keep the implementation simpler + + @property + def all_special_tokens(self) -> list[str]: + """ + `list[str]`: A list of all unique special tokens (named + extra) as strings. + + Includes both named special tokens (bos_token, eos_token, etc.) and extra special tokens. + Converts tokens of `tokenizers.AddedToken` type to string. + """ + seen = set() + all_toks = [] + + # Add named special tokens + for attr in self.SPECIAL_TOKENS_ATTRIBUTES: + value = self._special_tokens_map.get(attr) + if value is not None: + token_str = str(value) + if token_str not in seen: + all_toks.append(token_str) + seen.add(token_str) + + # Add extra special tokens + for token in self._extra_special_tokens: + token_str = str(token) + if token_str not in seen: + all_toks.append(token_str) + seen.add(token_str) + + return all_toks + + @property + def all_special_ids(self) -> list[int]: + """ + `list[int]`: List the ids of the special tokens(`''`, `''`, etc.) mapped to class attributes. + """ + return self.convert_tokens_to_ids(self.all_special_tokens) + + def _set_model_specific_special_tokens(self, special_tokens: dict[str, str | AddedToken]): + """ + Adds new model-specific special tokens (e.g., for multimodal models). + + These tokens are added to the named special tokens map and will be saved in tokenizer config. + For example: if the model tokenizer is multimodal, we can support special image or audio tokens. + + Args: + special_tokens: Dictionary of {token_name: token_value} + """ + self.SPECIAL_TOKENS_ATTRIBUTES = self.SPECIAL_TOKENS_ATTRIBUTES + list(special_tokens.keys()) + for key, value in special_tokens.items(): + if isinstance(value, (str, AddedToken)): + self._special_tokens_map[key] = value + else: + raise TypeError(f"Special token {key} has to be either str or AddedToken but got: {type(value)}") + + @property + def added_tokens_decoder(self) -> dict[int, AddedToken]: + raise NotImplementedError() + + def __repr__(self) -> str: + added_tokens_decoder_rep = "\n\t".join([f"{k}: {v.__repr__()}," for k, v in self.added_tokens_decoder.items()]) + return ( + f"{self.__class__.__name__}(name_or_path='{self.name_or_path}'," + f" vocab_size={self.vocab_size}, model_max_length={self.model_max_length}," + f" padding_side='{self.padding_side}', truncation_side='{self.truncation_side}'," + f" special_tokens={self.special_tokens_map}," + " added_tokens_decoder={\n\t" + added_tokens_decoder_rep + "\n}\n)" + ) + + def __len__(self) -> int: + raise NotImplementedError() + + @property + def vocab_size(self) -> int: + """ + `int`: Size of the base vocabulary (without the added tokens). + """ + raise NotImplementedError() + + def get_vocab(self) -> dict[str, int]: + """ + Returns the vocabulary as a dictionary of token to index. + + `tokenizer.get_vocab()[token]` is equivalent to `tokenizer.convert_tokens_to_ids(token)` when `token` is in the + vocab. + + Returns: + `dict[str, int]`: The vocabulary. + """ + raise NotImplementedError() + + def convert_tokens_to_ids(self, tokens: str | list[str]) -> int | list[int]: + """ + Converts a token string (or a sequence of tokens) in a single integer id (or a sequence of ids), using the + vocabulary. + + Args: + tokens (`str` or `list[str]`): One or several token(s) to convert to token id(s). + + Returns: + `int` or `list[int]`: The token id or list of token ids. + """ + if isinstance(tokens, str): + return self._convert_token_to_id_with_added_voc(tokens) + + return [self._convert_token_to_id_with_added_voc(token) for token in tokens] + + def convert_ids_to_tokens(self, ids: int | list[int], skip_special_tokens: bool = False) -> str | list[str]: + """ + Converts a single index or a sequence of indices in a token or a sequence of tokens, using the vocabulary and + added tokens. + + Args: + ids (`int` or `list[int]`): + The token id (or token ids) to convert to tokens. + skip_special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not to remove special tokens in the decoding. + + Returns: + `str` or `list[str]`: The decoded token(s). + """ + raise NotImplementedError() + + @classmethod + def from_pretrained( + cls, + pretrained_model_name_or_path: str | os.PathLike, + *init_inputs, + cache_dir: str | os.PathLike | None = None, + force_download: bool = False, + local_files_only: bool = False, + token: str | bool | None = None, + revision: str = "main", + trust_remote_code=False, + **kwargs, + ): + r""" + Instantiate a [`~tokenization_utils_base.PreTrainedTokenizerBase`] (or a derived class) from a predefined + tokenizer. + + Args: + pretrained_model_name_or_path (`str` or `os.PathLike`): + Can be either: + + - A string, the *model id* of a predefined tokenizer hosted inside a model repo on huggingface.co. + - A path to a *directory* containing vocabulary files required by the tokenizer, for instance saved + using the [`~tokenization_utils_base.PreTrainedTokenizerBase.save_pretrained`] method, e.g., + `./my_model_directory/`. + - (**Deprecated**, not applicable to all derived classes) A path or url to a single saved vocabulary + file (if and only if the tokenizer only requires a single vocabulary file like Bert or XLNet), e.g., + `./my_model_directory/vocab.txt`. + cache_dir (`str` or `os.PathLike`, *optional*): + Path to a directory in which a downloaded predefined tokenizer vocabulary files should be cached if the + standard cache should not be used. + force_download (`bool`, *optional*, defaults to `False`): + Whether or not to force the (re-)download the vocabulary files and override the cached versions if they + exist. + proxies (`dict[str, str]`, *optional*): + A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128', + 'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request. + token (`str` or *bool*, *optional*): + The token to use as HTTP bearer authorization for remote files. If `True`, will use the token generated + when running `hf auth login` (stored in `~/.huggingface`). + local_files_only (`bool`, *optional*, defaults to `False`): + Whether or not to only rely on local files and not to attempt to download any files. + revision (`str`, *optional*, defaults to `"main"`): + The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a + git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + identifier allowed by git. + subfolder (`str`, *optional*): + In case the relevant files are located inside a subfolder of the model repo on huggingface.co (e.g. for + facebook/rag-token-base), specify it here. + inputs (additional positional arguments, *optional*): + Will be passed along to the Tokenizer `__init__` method. + trust_remote_code (`bool`, *optional*, defaults to `False`): + Whether or not to allow for custom models defined on the Hub in their own modeling files. This option + should only be set to `True` for repositories you trust and in which you have read the code, as it will + execute code present on the Hub on your local machine. + kwargs (additional keyword arguments, *optional*): + Will be passed to the Tokenizer `__init__` method. Can be used to set special tokens like `bos_token`, + `eos_token`, `unk_token`, `sep_token`, `pad_token`, `cls_token`, `mask_token`, + `extra_special_tokens`. See parameters in the `__init__` for more details. + + + + Passing `token=True` is required when you want to use a private model. + + + + Examples: + + ```python + # We can't instantiate directly the base class *PreTrainedTokenizerBase* so let's show our examples on a derived class: BertTokenizer + # Download vocabulary from huggingface.co and cache. + tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased") + + # Download vocabulary from huggingface.co (user-uploaded) and cache. + tokenizer = BertTokenizer.from_pretrained("dbmdz/bert-base-german-cased") + + # If vocabulary files are in a directory (e.g. tokenizer was saved using *save_pretrained('./test/saved_model/')*) + tokenizer = BertTokenizer.from_pretrained("./test/saved_model/") + + # If the tokenizer uses a single vocabulary file, you can point directly to this file + tokenizer = BertTokenizer.from_pretrained("./test/saved_model/my_vocab.txt") + + # You can link tokens to special vocabulary when instantiating + tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased", unk_token="") + # You should be sure '' is in the vocabulary when doing that. + # Otherwise use tokenizer.add_special_tokens({'unk_token': ''}) instead) + assert tokenizer.unk_token == "" + ```""" + proxies = kwargs.pop("proxies", None) + subfolder = kwargs.pop("subfolder", None) + from_pipeline = kwargs.pop("_from_pipeline", None) + from_auto_class = kwargs.pop("_from_auto", False) + commit_hash = kwargs.pop("_commit_hash", None) + gguf_file = kwargs.get("gguf_file") + + user_agent = {"file_type": "tokenizer", "from_auto_class": from_auto_class} + if from_pipeline is not None: + user_agent["using_pipeline"] = from_pipeline + + if is_offline_mode() and not local_files_only: + logger.info("Offline mode: forcing local_files_only=True") + local_files_only = True + + pretrained_model_name_or_path = str(pretrained_model_name_or_path) + vocab_files = {} + additional_files_names = {} + init_configuration = {} + + is_local = os.path.isdir(pretrained_model_name_or_path) + single_file_id = None + if os.path.isfile(pretrained_model_name_or_path): + # For legacy support: allow single-file loading if: + # 1. Only one vocab file is required, OR + # 2. It's a fast tokenizer with tokenizer_file (which is optional), OR + # 3. It's a GGUF file + vocab_files_count = len(cls.vocab_files_names) + has_optional_tokenizer_file = vocab_files_count > 1 and "tokenizer_file" in cls.vocab_files_names + + if vocab_files_count > 1 and not gguf_file and not has_optional_tokenizer_file: + raise ValueError( + f"Calling {cls.__name__}.from_pretrained() with the path to a single file or url is not " + "supported for this tokenizer. Use a model identifier or the path to a directory instead." + ) + file_id = "vocab_file" + if pretrained_model_name_or_path.endswith("tokenizer.json"): + file_id = "tokenizer_file" + vocab_files[file_id] = pretrained_model_name_or_path + single_file_id = file_id + else: + if gguf_file: + vocab_files["vocab_file"] = gguf_file + else: + # At this point pretrained_model_name_or_path is either a directory or a model identifier name + additional_files_names = { + "added_tokens_file": ADDED_TOKENS_FILE, # kept only for legacy + "special_tokens_map_file": SPECIAL_TOKENS_MAP_FILE, # kept only for legacy + "tokenizer_config_file": TOKENIZER_CONFIG_FILE, + # tokenizer_file used to initialize a slow from a fast. Properly copy the `addedTokens` instead of adding in random orders + "tokenizer_file": FULL_TOKENIZER_FILE, + "chat_template_file": CHAT_TEMPLATE_FILE, + } + + vocab_files = {**cls.vocab_files_names, **additional_files_names} + + # Check for versioned tokenizer files + if "tokenizer_file" in vocab_files: + fast_tokenizer_file = FULL_TOKENIZER_FILE + resolved_config_file = cached_file( + pretrained_model_name_or_path, + TOKENIZER_CONFIG_FILE, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + token=token, + revision=revision, + local_files_only=local_files_only, + subfolder=subfolder, + user_agent=user_agent, + _raise_exceptions_for_missing_entries=False, + _commit_hash=commit_hash, + ) + if resolved_config_file is not None: + with open(resolved_config_file, encoding="utf-8") as reader: + tokenizer_config = json.load(reader) + if "fast_tokenizer_files" in tokenizer_config: + fast_tokenizer_file = get_fast_tokenizer_file(tokenizer_config["fast_tokenizer_files"]) + commit_hash = extract_commit_hash(resolved_config_file, commit_hash) + vocab_files["tokenizer_file"] = fast_tokenizer_file + + # This block looks for any extra chat template files + if is_local: + template_dir = Path(pretrained_model_name_or_path, CHAT_TEMPLATE_DIR) + if template_dir.is_dir(): + for template_file in template_dir.glob("*.jinja"): + template_name = template_file.name.removesuffix(".jinja") + vocab_files[f"chat_template_{template_name}"] = f"{CHAT_TEMPLATE_DIR}/{template_file.name}" + else: + for template in list_repo_templates( + pretrained_model_name_or_path, + local_files_only=local_files_only, + revision=revision, + cache_dir=cache_dir, + token=token, + ): + template = template.removesuffix(".jinja") + vocab_files[f"chat_template_{template}"] = f"{CHAT_TEMPLATE_DIR}/{template}.jinja" + + remote_files = [] + if not is_local and not local_files_only: + try: + remote_files = list_repo_files(pretrained_model_name_or_path) + except Exception: + remote_files = [] + elif pretrained_model_name_or_path and os.path.isdir(pretrained_model_name_or_path): + remote_files = os.listdir(pretrained_model_name_or_path) + + if "tokenizer_file" in vocab_files and not re.search(vocab_files["tokenizer_file"], "".join(remote_files)): + # mistral tokenizer names are different, but we can still convert them if + # mistral common is not there + other_pattern = r"tekken\.json|tokenizer\.model\.*" + if match := re.search(other_pattern, "\n".join(remote_files)): + vocab_files["vocab_file"] = match.group() + + resolved_vocab_files = {} + for file_id, file_path in vocab_files.items(): + if file_path is None: + resolved_vocab_files[file_id] = None + elif single_file_id == file_id: + if os.path.isfile(file_path): + resolved_vocab_files[file_id] = file_path + else: + try: + resolved_vocab_files[file_id] = cached_file( + pretrained_model_name_or_path, + file_path, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _raise_exceptions_for_missing_entries=False, + _commit_hash=commit_hash, + ) + except OSError: + # Re-raise any error raised by cached_file in order to get a helpful error message + raise + except Exception: + # For any other exception, we throw a generic error. + raise OSError( + f"Can't load tokenizer for '{pretrained_model_name_or_path}'. If you were trying to load it from " + "'https://huggingface.co/models', make sure you don't have a local directory with the same name. " + f"Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a directory " + f"containing all relevant files for a {cls.__name__} tokenizer." + ) + commit_hash = extract_commit_hash(resolved_vocab_files[file_id], commit_hash) + + for file_id, file_path in vocab_files.items(): + if file_id not in resolved_vocab_files: + continue + + return cls._from_pretrained( + resolved_vocab_files, + pretrained_model_name_or_path, + init_configuration, + *init_inputs, + token=token, + cache_dir=cache_dir, + local_files_only=local_files_only, + _commit_hash=commit_hash, + _is_local=is_local, + trust_remote_code=trust_remote_code, + **kwargs, + ) + + @classmethod + def _from_pretrained( + cls, + resolved_vocab_files, + pretrained_model_name_or_path, + init_configuration, + *init_inputs, + token=None, + cache_dir=None, + local_files_only=False, + _commit_hash=None, + _is_local=False, + trust_remote_code=False, + **kwargs, + ): + # Prepare tokenizer initialization kwargs + # Did we saved some inputs and kwargs to reload ? + tokenizer_config_file = resolved_vocab_files.pop("tokenizer_config_file", None) + if tokenizer_config_file is not None: + with open(tokenizer_config_file, encoding="utf-8") as tokenizer_config_handle: + init_kwargs = json.load(tokenizer_config_handle) + # used in the past to check if the tokenizer class matches the class in the repo + init_kwargs.pop("tokenizer_class", None) + saved_init_inputs = init_kwargs.pop("init_inputs", ()) + if not init_inputs: + init_inputs = saved_init_inputs + else: + init_kwargs = init_configuration + + if resolved_vocab_files.get("tokenizer_file", None) is not None: + init_kwargs.pop("add_bos_token", None) + init_kwargs.pop("add_eos_token", None) + + # If independent chat template file(s) exist, they take priority over template entries in the tokenizer config + chat_templates = {} + chat_template_file = resolved_vocab_files.pop("chat_template_file", None) + extra_chat_templates = [key for key in resolved_vocab_files if key.startswith("chat_template_")] + if chat_template_file is not None: + with open(chat_template_file, encoding="utf-8") as chat_template_handle: + chat_templates["default"] = chat_template_handle.read() + for extra_chat_template in extra_chat_templates: + template_file = resolved_vocab_files.pop(extra_chat_template, None) + if template_file is None: + continue # I think this should never happen, but just in case + template_name = extra_chat_template.removeprefix("chat_template_") + with open(template_file) as chat_template_handle: + chat_templates[template_name] = chat_template_handle.read() + if len(chat_templates) == 1 and "default" in chat_templates: + init_kwargs["chat_template"] = chat_templates["default"] + elif chat_templates: + init_kwargs["chat_template"] = chat_templates + + if not _is_local: + if "auto_map" in init_kwargs: + # For backward compatibility with odl format. + if isinstance(init_kwargs["auto_map"], (tuple, list)): + init_kwargs["auto_map"] = {"AutoTokenizer": init_kwargs["auto_map"]} + + # Update with newly provided kwargs + init_kwargs.update(kwargs) + + # V5: Convert deprecated additional_special_tokens to extra_special_tokens + if "additional_special_tokens" in init_kwargs: + init_kwargs.setdefault("extra_special_tokens", init_kwargs.pop("additional_special_tokens")) + + # V5: Collect model-specific tokens (custom *_token keys not in standard attributes) + default_attrs = set(cls.SPECIAL_TOKENS_ATTRIBUTES) + model_specific_tokens = { + key: init_kwargs.pop(key) + for key in list(init_kwargs.keys()) + if key not in default_attrs and key.endswith("_token") and isinstance(init_kwargs[key], (str, AddedToken)) + } + # If extra_special_tokens is a dict, merge it into model_specific_tokens + if isinstance(init_kwargs.get("extra_special_tokens"), dict): + model_specific_tokens.update(init_kwargs.pop("extra_special_tokens")) + if model_specific_tokens: + init_kwargs["model_specific_special_tokens"] = model_specific_tokens + + # Merge resolved_vocab_files arguments in init_kwargs. + added_tokens_file = resolved_vocab_files.pop("added_tokens_file", None) + special_tokens_map_file = resolved_vocab_files.pop("special_tokens_map_file", None) + for args_name, file_path in resolved_vocab_files.items(): + if args_name not in init_kwargs or init_kwargs[args_name] is None: + init_kwargs[args_name] = file_path + tokenizer_file = resolved_vocab_files.get("tokenizer_file", None) + + init_kwargs["name_or_path"] = pretrained_model_name_or_path + init_kwargs["is_local"] = _is_local + + #### Handle tokenizer serialization of added and special tokens + added_tokens_decoder: dict[int, AddedToken] = {} + added_tokens_map: dict[str, AddedToken] = {} + # if we have info on the slow added tokens + if "added_tokens_decoder" in init_kwargs: + for idx, token in init_kwargs["added_tokens_decoder"].items(): + if isinstance(token, dict): + token = AddedToken(**token) + if isinstance(token, AddedToken): + added_tokens_decoder[int(idx)] = token + added_tokens_map[str(token)] = token + else: + raise TypeError( + f"Found a {token.__class__} in the saved `added_tokens_decoder`, should be a dictionary or an AddedToken instance" + ) + else: + # Legacy: read special_tokens_map.json and merge into init_kwargs + if special_tokens_map_file is not None: + with open(special_tokens_map_file, encoding="utf-8") as f: + special_tokens_map = json.load(f) + for key, value in special_tokens_map.items(): + if key in kwargs and kwargs[key]: + continue # User-provided kwargs take precedence + if isinstance(value, dict) and key != "extra_special_tokens": + value = AddedToken(**value, special=True) + elif key == "extra_special_tokens" and isinstance(value, list): + # Merge list tokens, converting dicts to AddedToken + existing = list(init_kwargs.get("extra_special_tokens") or []) + for tok in value: + tok = AddedToken(**tok, special=True) if isinstance(tok, dict) else tok + if tok not in existing: + existing.append(tok) + value = existing + init_kwargs[key] = value + # Convert dict extra_special_tokens to model_specific_special_tokens + if isinstance(init_kwargs.get("extra_special_tokens"), dict): + init_kwargs.setdefault("model_specific_special_tokens", {}).update( + init_kwargs.pop("extra_special_tokens") + ) + + # slow -> slow|fast, legacy: convert the `"added_tokens.json"` file to `added_tokens_decoder`. + # this is for legacy purpose. We don't add the tokens after init for efficiency. + if added_tokens_file is not None: + # V5: Check both named and extra special tokens + special_tokens = {str(init_kwargs[k]) for k in cls.SPECIAL_TOKENS_ATTRIBUTES if init_kwargs.get(k)} + special_tokens.update(str(t) for t in (init_kwargs.get("extra_special_tokens") or [])) + + with open(added_tokens_file, encoding="utf-8") as f: + added_tok_encoder = json.load(f) + for str_token, index in added_tok_encoder.items(): + is_special = str_token in special_tokens + added_tokens_decoder[index] = AddedToken( + str_token, rstrip=False, lstrip=False, normalized=not is_special, special=is_special + ) + added_tokens_map[str_token] = added_tokens_decoder[index] + + # allows converting a fast -> slow: add the `tokenizer.json`'s `"added_tokens"` to the slow tokenizer + # if `tokenizer_config.json` is `None` + if tokenizer_file is not None: + # This is for slow so can be done before + with open(tokenizer_file, encoding="utf-8") as tokenizer_file_handle: + tokenizer_file_handle = json.load(tokenizer_file_handle) + added_tokens = tokenizer_file_handle.pop("added_tokens") + for serialized_tokens in added_tokens: + idx = serialized_tokens.pop("id") + added_tokens_decoder[idx] = AddedToken(**serialized_tokens) + added_tokens_map[str(added_tokens_decoder[idx])] = added_tokens_decoder[idx] + # end legacy + + # Passing AddedTokens and not strings to the class to prevent it from casting the string to a different AddedToken + # convert {'__type': 'AddedToken', 'content': '', 'lstrip': False, 'normalized': True, ...} to AddedTokens + init_kwargs["added_tokens_decoder"] = added_tokens_decoder + init_kwargs = cls.convert_added_tokens(init_kwargs, save=False) + # V5: Map special tokens from added_tokens_map (named tokens only) + for key in cls.SPECIAL_TOKENS_ATTRIBUTES: + if key in init_kwargs and added_tokens_map != {} and init_kwargs[key] is not None: + init_kwargs[key] = added_tokens_map.get(str(init_kwargs[key]), init_kwargs[key]) + + # From pretrained with the legacy fixes + # for `tokenizers` based tokenizer, we actually want to have vocab and merges pre-extracted from whatever inputs + # for `none` (PythonBackend) based tokenizer, we also want the vocab file / merge files not extracted. + # for `sentencepiece` based tokenizer, we pass the sentencepiece model file directly. + init_kwargs = cls.convert_to_native_format(**init_kwargs) + + try: + tokenizer = cls(*init_inputs, **init_kwargs) + except import_protobuf_decode_error(): + raise RuntimeError( + "Unable to load tokenizer model from SPM, loading from TikToken will be attempted instead." + "(Google protobuf error: Tried to load SPM model with non-SPM vocab file).", + ) + except RuntimeError as e: + if "sentencepiece_processor.cc" in str(e): + raise RuntimeError( + "Unable to load tokenizer model from SPM, loading from TikToken will be attempted instead." + "(SentencePiece RuntimeError: Tried to load SPM model with non-SPM vocab file).", + ) from e + else: + raise e + except OSError: + raise OSError( + "Unable to load vocabulary from file. " + "Please check that the provided vocabulary is accessible and not corrupted." + ) + return tokenizer + + @classmethod + def convert_to_native_format(cls, **kwargs): + return kwargs + + @classmethod + def convert_added_tokens(cls, obj: AddedToken | Any, save=False, add_type_field=True): + if isinstance(obj, dict) and "__type" in obj and obj["__type"] == "AddedToken": + obj.pop("__type") + return AddedToken(**obj) + if isinstance(obj, AddedToken) and save: + obj = obj.__getstate__() + if add_type_field: + obj["__type"] = "AddedToken" + else: + # Don't save "special" for previous tokenizers + obj.pop("special") + return obj + elif isinstance(obj, (list, tuple)): + return [cls.convert_added_tokens(o, save=save, add_type_field=add_type_field) for o in obj] + elif isinstance(obj, dict): + return {k: cls.convert_added_tokens(v, save=save, add_type_field=add_type_field) for k, v in obj.items()} + return obj + + def save_pretrained( + self, + save_directory: str | os.PathLike, + legacy_format: bool | None = None, + filename_prefix: str | None = None, + push_to_hub: bool = False, + **kwargs, + ) -> tuple[str, ...]: + """ + Save the full tokenizer state. + + + This method make sure the full tokenizer can then be re-loaded using the + [`~tokenization_utils_base.PreTrainedTokenizer.from_pretrained`] class method.. + + Warning,None This won't save modifications you may have applied to the tokenizer after the instantiation (for + instance, modifying `tokenizer.do_lower_case` after creation). + + Args: + save_directory (`str` or `os.PathLike`): The path to a directory where the tokenizer will be saved. + legacy_format (`bool`, *optional*): + Only applicable for a fast tokenizer. If unset (default), will save the tokenizer in the unified JSON + format as well as in legacy format if it exists, i.e. with tokenizer specific vocabulary and a separate + added_tokens files. + + If `False`, will only save the tokenizer in the unified JSON format. This format is incompatible with + "slow" tokenizers (not powered by the *tokenizers* library), so the tokenizer will not be able to be + loaded in the corresponding "slow" tokenizer. + + If `True`, will save the tokenizer in legacy format. If the "slow" tokenizer doesn't exits, a value + error is raised. + filename_prefix (`str`, *optional*): + A prefix to add to the names of the files saved by the tokenizer. + push_to_hub (`bool`, *optional*, defaults to `False`): + Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the + repository you want to push to with `repo_id` (will default to the name of `save_directory` in your + namespace). + kwargs (`dict[str, Any]`, *optional*): + Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method. + + Returns: + A tuple of `str`: The files saved. + """ + + if os.path.isfile(save_directory): + logger.error(f"Provided path ({save_directory}) should be a directory, not a file") + return + + os.makedirs(save_directory, exist_ok=True) + + if push_to_hub: + commit_message = kwargs.pop("commit_message", None) + repo_id = kwargs.pop("repo_id", save_directory.split(os.path.sep)[-1]) + repo_id = create_repo(repo_id, exist_ok=True, **kwargs).repo_id + files_timestamps = self._get_files_timestamps(save_directory) + + tokenizer_config_file = os.path.join( + save_directory, (filename_prefix + "-" if filename_prefix else "") + TOKENIZER_CONFIG_FILE + ) + + tokenizer_config = copy.deepcopy(self.init_kwargs) + tokenizer_config.pop("add_bos_token", None) + tokenizer_config.pop("add_eos_token", None) + + # Let's save the init kwargs + target_keys = set(self.init_kwargs.keys()) + target_keys.discard("add_bos_token") + target_keys.discard("add_eos_token") + # Let's save the special tokens map (only the strings) + target_keys.update(["model_max_length"]) + + for k in target_keys: + if hasattr(self, k): + tokenizer_config[k] = getattr(self, k) + + # Let's make sure we properly save the special tokens + # V5: Save both named tokens and extra tokens + tokenizer_config.update(self.special_tokens_map) + if self._extra_special_tokens: + tokenizer_config["extra_special_tokens"] = self.extra_special_tokens + + save_jinja_files = kwargs.get("save_jinja_files", True) + tokenizer_config, saved_raw_chat_template_files = self.save_chat_templates( + save_directory, tokenizer_config, filename_prefix, save_jinja_files + ) + + if len(self.init_inputs) > 0: + tokenizer_config["init_inputs"] = copy.deepcopy(self.init_inputs) + for file_id in self.vocab_files_names: + tokenizer_config.pop(file_id, None) + + # no typefields, this way old fast and slow can load it + tokenizer_config = self.convert_added_tokens(tokenizer_config, add_type_field=True, save=True) + # Process added tokens separately: allows previous versions to ignore it! + added_tokens = {} + for key, value in self.added_tokens_decoder.items(): + added_tokens[key] = value.__getstate__() + tokenizer_config["added_tokens_decoder"] = added_tokens + + # Add tokenizer class to the tokenizer config to be able to reload it with from_pretrained + tokenizer_class = self.__class__.__name__ + + # tokenizers backend don't need to save added_tokens_decoder and additional_special_tokens + if any(base.__name__ == "TokenizersBackend" for base in self.__class__.__mro__): + tokenizer_config.pop("added_tokens_decoder", None) + tokenizer_config.pop("additional_special_tokens", None) + + # Remove the Fast at the end if we can save the slow tokenizer + if tokenizer_class.endswith("Fast") and getattr(self, "can_save_slow_tokenizer", False): + tokenizer_class = tokenizer_class[:-4] + tokenizer_config["tokenizer_class"] = tokenizer_class + if getattr(self, "_auto_map", None) is not None: + tokenizer_config["auto_map"] = self._auto_map + if getattr(self, "_processor_class", None) is not None: + tokenizer_config["processor_class"] = self._processor_class + tokenizer_config.pop("files_loaded", None) + # If we have a custom model, we copy the file defining it in the folder and set the attributes so it can be + # loaded from the Hub. + if self._auto_class is not None: + custom_object_save(self, save_directory, config=tokenizer_config) + + # remove private information + if "name_or_path" in tokenizer_config: + tokenizer_config.pop("name_or_path") + tokenizer_config.pop("special_tokens_map_file", None) + tokenizer_config.pop("tokenizer_file", None) + if "device_map" in tokenizer_config: + tokenizer_config.pop("device_map") + if "slow_tokenizer_class" in tokenizer_config: + tokenizer_config.pop("slow_tokenizer_class") + + with open(tokenizer_config_file, "w", encoding="utf-8") as f: + out_str = json.dumps(tokenizer_config, indent=2, sort_keys=True, ensure_ascii=False) + "\n" + f.write(out_str) + logger.info(f"tokenizer config file saved in {tokenizer_config_file}") + + # Sanitize AddedTokens in special_tokens_map + + file_names = (tokenizer_config_file, *saved_raw_chat_template_files) + + save_files = self._save_pretrained( + save_directory=save_directory, + file_names=file_names, + legacy_format=legacy_format, + filename_prefix=filename_prefix, + ) + + if push_to_hub: + self._upload_modified_files( + save_directory, + repo_id, + files_timestamps, + commit_message=commit_message, + token=kwargs.get("token"), + ) + + return save_files + + def _save_pretrained( + self, + save_directory: str | os.PathLike, + file_names: tuple[str, ...], + legacy_format: bool | None = None, + filename_prefix: str | None = None, + ) -> tuple[str, ...]: + """ + Save a tokenizer using the slow-tokenizer/legacy format: vocabulary + added tokens. + + Fast tokenizers can also be saved in a unique JSON file containing {config + vocab + added-tokens} using the + specific [`~tokenization_utils_tokenizers.PreTrainedTokenizerFast._save_pretrained`] + """ + if legacy_format is False: + raise ValueError( + "Only fast tokenizers (instances of PreTrainedTokenizerFast) can be saved in non legacy format." + ) + + save_directory = str(save_directory) + + added_tokens_file = os.path.join( + save_directory, (filename_prefix + "-" if filename_prefix else "") + ADDED_TOKENS_FILE + ) + # the new get_added_vocab() also returns special tokens and tokens that have an index < vocab_size + added_vocab = {tok: index for tok, index in self.added_tokens_encoder.items() if index >= self.vocab_size} + if added_vocab: + with open(added_tokens_file, "w", encoding="utf-8") as f: + out_str = json.dumps(added_vocab, indent=2, sort_keys=True, ensure_ascii=False) + "\n" + f.write(out_str) + logger.info(f"added tokens file saved in {added_tokens_file}") + + vocab_files = self.save_vocabulary(save_directory, filename_prefix=filename_prefix) + + return file_names + vocab_files + (added_tokens_file,) + + def save_vocabulary(self, save_directory: str, filename_prefix: str | None = None) -> tuple[str, ...]: + """ + Save only the vocabulary of the tokenizer (vocabulary + added tokens). + + This method won't save the configuration and special token mappings of the tokenizer. Use + [`~PreTrainedTokenizerFast._save_pretrained`] to save the whole state of the tokenizer. + + Args: + save_directory (`str`): + The directory in which to save the vocabulary. + filename_prefix (`str`, *optional*): + An optional prefix to add to the named of the saved files. + + Returns: + `tuple(str)`: Paths to the files saved. + """ + raise NotImplementedError + + def tokenize(self, text: str, pair: str | None = None, add_special_tokens: bool = False, **kwargs) -> list[str]: + """ + Converts a string into a sequence of tokens, replacing unknown tokens with the `unk_token`. + + Args: + text (`str`): + The sequence to be encoded. + pair (`str`, *optional*): + A second sequence to be encoded with the first. + add_special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not to add the special tokens associated with the corresponding model. + kwargs (additional keyword arguments, *optional*): + Will be passed to the underlying model specific encode method. See details in + [`~PreTrainedTokenizerBase.__call__`] + + Returns: + `list[str]`: The list of tokens. + """ + raise NotImplementedError + + @add_end_docstrings( + ENCODE_KWARGS_DOCSTRING, + """ + **kwargs: Passed along to the `.tokenize()` method. + """, + """ + Returns: + `list[int]`, `torch.Tensor`, or `np.ndarray`: The tokenized ids of the text. + """, + ) + def encode( + self, + text: TextInput | PreTokenizedInput | EncodedInput, + text_pair: TextInput | PreTokenizedInput | EncodedInput | None = None, + add_special_tokens: bool = True, + padding: bool | str | PaddingStrategy = False, + truncation: bool | str | TruncationStrategy | None = None, + max_length: int | None = None, + stride: int = 0, + padding_side: str | None = None, + return_tensors: str | TensorType | None = None, + **kwargs, + ) -> list[int]: + """ + Converts a string to a sequence of ids (integer), using the tokenizer and vocabulary. + + Same as doing `self.convert_tokens_to_ids(self.tokenize(text))`. + + Args: + text (`str`, `list[str]` or `list[int]`): + The first sequence to be encoded. This can be a string, a list of strings (tokenized string using the + `tokenize` method) or a list of integers (tokenized string ids using the `convert_tokens_to_ids` + method). + text_pair (`str`, `list[str]` or `list[int]`, *optional*): + Optional second sequence to be encoded. This can be a string, a list of strings (tokenized string using + the `tokenize` method) or a list of integers (tokenized string ids using the `convert_tokens_to_ids` + method). + """ + padding_strategy, truncation_strategy, max_length, kwargs_updated = self._get_padding_truncation_strategies( + padding=padding, + truncation=truncation, + max_length=max_length, + **kwargs, + ) + + kwargs.update(kwargs_updated) + + encoded_inputs = self._encode_plus( + text, + text_pair=text_pair, + add_special_tokens=add_special_tokens, + padding_strategy=padding_strategy, + truncation_strategy=truncation_strategy, + max_length=max_length, + stride=stride, + padding_side=padding_side, + return_tensors=return_tensors, + **kwargs, + ) + + return encoded_inputs["input_ids"] + + def num_special_tokens_to_add(self, pair: bool = False) -> int: + raise NotImplementedError + + @property + def max_len_single_sentence(self) -> int: + """ + `int`: The maximum length of a sentence that can be fed to the model. + """ + return self.model_max_length - self.num_special_tokens_to_add(pair=False) + + @max_len_single_sentence.setter + def max_len_single_sentence(self, value) -> None: + # For backward compatibility, allow to try to setup 'max_len_single_sentence'. + if value == self.model_max_length - self.num_special_tokens_to_add(pair=False) and self.verbose: + if not self.deprecation_warnings.get("max_len_single_sentence", False): + logger.warning( + "Setting 'max_len_single_sentence' is now deprecated. This value is automatically set up." + ) + self.deprecation_warnings["max_len_single_sentence"] = True + else: + raise ValueError( + "Setting 'max_len_single_sentence' is now deprecated. This value is automatically set up." + ) + + @property + def max_len_sentences_pair(self) -> int: + """ + `int`: The maximum combined length of a pair of sentences that can be fed to the model. + """ + return self.model_max_length - self.num_special_tokens_to_add(pair=True) + + @max_len_sentences_pair.setter + def max_len_sentences_pair(self, value) -> None: + # For backward compatibility, allow to try to setup 'max_len_sentences_pair'. + if value == self.model_max_length - self.num_special_tokens_to_add(pair=True) and self.verbose: + if not self.deprecation_warnings.get("max_len_sentences_pair", False): + logger.warning( + "Setting 'max_len_sentences_pair' is now deprecated. This value is automatically set up." + ) + self.deprecation_warnings["max_len_sentences_pair"] = True + else: + raise ValueError("Setting 'max_len_sentences_pair' is now deprecated. This value is automatically set up.") + + def _get_padding_truncation_strategies( + self, padding=False, truncation=None, max_length=None, pad_to_multiple_of=None, verbose=True, **kwargs + ): + """ + Find the correct padding/truncation strategy + """ + + # Backward compatibility for previous behavior: + # If you only set max_length, it activates truncation for max_length + if max_length is not None and padding is False and truncation is None: + truncation = "longest_first" + + # Get padding strategy + if padding is not False: + if padding is True: + if verbose: + if max_length is not None and ( + truncation is None or truncation is False or truncation == "do_not_truncate" + ): + warnings.warn( + "`max_length` is ignored when `padding`=`True` and there is no truncation strategy. " + "To pad to max length, use `padding='max_length'`." + ) + padding_strategy = PaddingStrategy.LONGEST # Default to pad to the longest sequence in the batch + elif not isinstance(padding, PaddingStrategy): + padding_strategy = PaddingStrategy(padding) + elif isinstance(padding, PaddingStrategy): + padding_strategy = padding + else: + padding_strategy = PaddingStrategy.DO_NOT_PAD + + # Get truncation strategy + if truncation is not False and truncation is not None: + if truncation is True: + truncation_strategy = ( + TruncationStrategy.LONGEST_FIRST + ) # Default to truncate the longest sequences in pairs of inputs + elif not isinstance(truncation, TruncationStrategy): + truncation_strategy = TruncationStrategy(truncation) + elif isinstance(truncation, TruncationStrategy): + truncation_strategy = truncation + else: + truncation_strategy = TruncationStrategy.DO_NOT_TRUNCATE + + # Set max length if needed + if max_length is None: + if padding_strategy == PaddingStrategy.MAX_LENGTH: + if self.model_max_length > LARGE_INTEGER: + padding_strategy = PaddingStrategy.DO_NOT_PAD + else: + max_length = self.model_max_length + + if truncation_strategy != TruncationStrategy.DO_NOT_TRUNCATE: + if self.model_max_length > LARGE_INTEGER: + truncation_strategy = TruncationStrategy.DO_NOT_TRUNCATE + else: + max_length = self.model_max_length + + # Test if we have a padding token + if padding_strategy != PaddingStrategy.DO_NOT_PAD and (self.pad_token is None or self.pad_token_id < 0): + raise ValueError( + "Asking to pad but the tokenizer does not have a padding token. " + "Please select a token to use as `pad_token` `(tokenizer.pad_token = tokenizer.eos_token e.g.)` " + "or add a new pad token via `tokenizer.add_special_tokens({'pad_token': '[PAD]'})`." + ) + + # Check that we will truncate to a multiple of pad_to_multiple_of if both are provided + if ( + truncation_strategy != TruncationStrategy.DO_NOT_TRUNCATE + and padding_strategy != PaddingStrategy.DO_NOT_PAD + and pad_to_multiple_of is not None + and max_length is not None + and (max_length % pad_to_multiple_of != 0) + ): + raise ValueError( + "Truncation and padding are both activated but " + f"truncation length ({max_length}) is not a multiple of pad_to_multiple_of ({pad_to_multiple_of})." + ) + + return padding_strategy, truncation_strategy, max_length, kwargs + + @add_end_docstrings(ENCODE_KWARGS_DOCSTRING, ENCODE_PLUS_ADDITIONAL_KWARGS_DOCSTRING) + def __call__( + self, + text: TextInput | PreTokenizedInput | list[TextInput] | list[PreTokenizedInput] | None = None, + text_pair: TextInput | PreTokenizedInput | list[TextInput] | list[PreTokenizedInput] | None = None, + text_target: TextInput | PreTokenizedInput | list[TextInput] | list[PreTokenizedInput] | None = None, + text_pair_target: TextInput | PreTokenizedInput | list[TextInput] | list[PreTokenizedInput] | None = None, + add_special_tokens: bool = True, + padding: bool | str | PaddingStrategy = False, + truncation: bool | str | TruncationStrategy | None = None, + max_length: int | None = None, + stride: int = 0, + is_split_into_words: bool = False, + pad_to_multiple_of: int | None = None, + padding_side: str | None = None, + return_tensors: str | TensorType | None = None, + return_token_type_ids: bool | None = None, + return_attention_mask: bool | None = None, + return_overflowing_tokens: bool = False, + return_special_tokens_mask: bool = False, + return_offsets_mapping: bool = False, + return_length: bool = False, + verbose: bool = True, + tokenizer_kwargs: dict[str, Any] | None = None, + **kwargs, + ) -> BatchEncoding: + """ + Main method to tokenize and prepare for the model one or several sequence(s) or one or several pair(s) of + sequences. + + Args: + text (`str`, `list[str]`, `list[list[str]]`, *optional*): + The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings + (pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set + `is_split_into_words=True` (to lift the ambiguity with a batch of sequences). + text_pair (`str`, `list[str]`, `list[list[str]]`, *optional*): + The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings + (pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set + `is_split_into_words=True` (to lift the ambiguity with a batch of sequences). + text_target (`str`, `list[str]`, `list[list[str]]`, *optional*): + The sequence or batch of sequences to be encoded as target texts. Each sequence can be a string or a + list of strings (pretokenized string). If the sequences are provided as list of strings (pretokenized), + you must set `is_split_into_words=True` (to lift the ambiguity with a batch of sequences). + text_pair_target (`str`, `list[str]`, `list[list[str]]`, *optional*): + The sequence or batch of sequences to be encoded as target texts. Each sequence can be a string or a + list of strings (pretokenized string). If the sequences are provided as list of strings (pretokenized), + you must set `is_split_into_words=True` (to lift the ambiguity with a batch of sequences). + tokenizer_kwargs (`dict[str, Any]`, *optional*): + Additional kwargs to pass to the tokenizer. These will be merged with the explicit parameters and + other kwargs, with explicit parameters taking precedence. + """ + # To avoid duplicating + all_kwargs = { + "add_special_tokens": add_special_tokens, + "padding": padding, + "truncation": truncation, + "max_length": max_length, + "stride": stride, + "is_split_into_words": is_split_into_words, + "pad_to_multiple_of": pad_to_multiple_of, + "padding_side": padding_side, + "return_tensors": return_tensors, + "return_token_type_ids": return_token_type_ids, + "return_attention_mask": return_attention_mask, + "return_overflowing_tokens": return_overflowing_tokens, + "return_special_tokens_mask": return_special_tokens_mask, + "return_offsets_mapping": return_offsets_mapping, + "return_length": return_length, + "split_special_tokens": kwargs.pop("split_special_tokens", self.split_special_tokens), + "verbose": verbose, + } + + max_target_length = kwargs.pop("max_target_length", None) + + # First merge tokenizer_kwargs, then other kwargs (explicit params take precedence) + if tokenizer_kwargs is not None: + all_kwargs.update(tokenizer_kwargs) + all_kwargs.update(kwargs) + if text is None and text_target is None: + raise ValueError("You need to specify either `text` or `text_target`.") + + padding_strategy, truncation_strategy, max_length, kwargs = self._get_padding_truncation_strategies( + padding=all_kwargs.pop("padding", False), + truncation=all_kwargs.pop("truncation", None), + max_length=all_kwargs.pop("max_length", None), + pad_to_multiple_of=all_kwargs.get("pad_to_multiple_of"), + verbose=all_kwargs.get("verbose", True), + **kwargs, + ) + + if text is not None: + # The context manager will send the inputs as normal texts and not text_target, but we shouldn't change the + # input mode in this case. + if not self._in_target_context_manager and hasattr(self, "_switch_to_input_mode"): + self._switch_to_input_mode() + encodings = self._encode_plus( + text=text, + text_pair=text_pair, + padding_strategy=padding_strategy, + truncation_strategy=truncation_strategy, + max_length=max_length, + **all_kwargs, + ) + if text_target is not None: + if hasattr(self, "_switch_to_target_mode"): + self._switch_to_target_mode() + target_encodings = self._encode_plus( + text=text_target, + text_pair=text_pair_target, + padding_strategy=padding_strategy, + truncation_strategy=truncation_strategy, + max_length=max_target_length if max_target_length is not None else max_length, + **all_kwargs, + ) + # Leave back tokenizer in input mode + if hasattr(self, "_switch_to_input_mode"): + self._switch_to_input_mode() + + if text_target is None: + return encodings + elif text is None: + return target_encodings + else: + encodings["labels"] = target_encodings["input_ids"] + return encodings + + def _encode_plus( + self, + text: TextInput | PreTokenizedInput | EncodedInput, + text_pair: TextInput | PreTokenizedInput | EncodedInput | None = None, + add_special_tokens: bool = True, + padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD, + truncation_strategy: TruncationStrategy = TruncationStrategy.DO_NOT_TRUNCATE, + max_length: int | None = None, + stride: int = 0, + is_split_into_words: bool = False, + pad_to_multiple_of: int | None = None, + padding_side: str | None = None, + return_tensors: str | TensorType | None = None, + return_token_type_ids: bool | None = None, + return_attention_mask: bool | None = None, + return_overflowing_tokens: bool = False, + return_special_tokens_mask: bool = False, + return_offsets_mapping: bool = False, + return_length: bool = False, + verbose: bool = True, + split_special_tokens: bool = False, + **kwargs, + ) -> BatchEncoding: + raise NotImplementedError + + def pad( + self, + encoded_inputs: BatchEncoding + | list[BatchEncoding] + | dict[str, EncodedInput] + | dict[str, list[EncodedInput]] + | list[dict[str, EncodedInput]], + padding: bool | str | PaddingStrategy = True, + max_length: int | None = None, + pad_to_multiple_of: int | None = None, + padding_side: str | None = None, + return_attention_mask: bool | None = None, + return_tensors: str | TensorType | None = None, + verbose: bool = True, + ) -> BatchEncoding: + """ + Pad a single encoded input or a batch of encoded inputs up to predefined length or to the max sequence length + in the batch. + + Padding side (left/right) padding token ids are defined at the tokenizer level (with `self.padding_side`, + `self.pad_token_id` and `self.pad_token_type_id`). + + Please note that with a fast tokenizer, using the `__call__` method is faster than using a method to encode the + text followed by a call to the `pad` method to get a padded encoding. + + + + If the `encoded_inputs` passed are dictionary of numpy arrays, or PyTorch tensors, the + result will use the same type unless you provide a different tensor type with `return_tensors`. In the case of + PyTorch tensors, you will lose the specific device of your tensors however. + + + + Args: + encoded_inputs ([`BatchEncoding`], list of [`BatchEncoding`], `dict[str, list[int]]`, `dict[str, list[list[int]]` or `list[dict[str, list[int]]]`): + Tokenized inputs. Can represent one input ([`BatchEncoding`] or `dict[str, list[int]]`) or a batch of + tokenized inputs (list of [`BatchEncoding`], *dict[str, list[list[int]]]* or *list[dict[str, + list[int]]]*) so you can use this method during preprocessing as well as in a PyTorch Dataloader + collate function. + + Instead of `list[int]` you can have tensors (numpy arrays, or PyTorch tensors), see + the note above for the return type. + padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `True`): + Select a strategy to pad the returned sequences (according to the model's padding side and padding + index) among: + + - `True` or `'longest'` (default): Pad to the longest sequence in the batch (or no padding if only a single + sequence if provided). + - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum + acceptable input length for the model if that argument is not provided. + - `False` or `'do_not_pad'`: No padding (i.e., can output a batch with sequences of different + lengths). + max_length (`int`, *optional*): + Maximum length of the returned list and optionally padding length (see above). + pad_to_multiple_of (`int`, *optional*): + If set will pad the sequence to a multiple of the provided value. + + This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability + `>= 7.5` (Volta). + padding_side (`str`, *optional*): + The side on which the model should have padding applied. Should be selected between ['right', 'left']. + Default value is picked from the class attribute of the same name. + return_attention_mask (`bool`, *optional*): + Whether to return the attention mask. If left to the default, will return the attention mask according + to the specific tokenizer's default, defined by the `return_outputs` attribute. + + [What are attention masks?](../glossary#attention-mask) + return_tensors (`str` or [`~utils.TensorType`], *optional*): + If set, will return tensors instead of list of python integers. Acceptable values are: + + - `'pt'`: Return PyTorch `torch.Tensor` objects. + - `'np'`: Return Numpy `np.ndarray` objects. + verbose (`bool`, *optional*, defaults to `True`): + Whether or not to print more information and warnings. + """ + + # If we have a list of dicts, let's convert it in a dict of lists + # We do this to allow using this method as a collate_fn function in PyTorch Dataloader + if ( + isinstance(encoded_inputs, (list, tuple)) + and len(encoded_inputs) > 0 + and isinstance(encoded_inputs[0], Mapping) + ): + # Call .keys() explicitly for compatibility with TensorDict and other Mapping subclasses + encoded_inputs = {key: [example[key] for example in encoded_inputs] for key in encoded_inputs[0].keys()} + + # The model's main input name, usually `input_ids`, has been passed for padding + if self.model_input_names[0] not in encoded_inputs: + raise ValueError( + "You should supply an encoding or a list of encodings to this method " + f"that includes {self.model_input_names[0]}, but you provided {list(encoded_inputs.keys())}" + ) + + required_input = encoded_inputs[self.model_input_names[0]] + + if required_input is None or (isinstance(required_input, Sized) and len(required_input) == 0): + if return_attention_mask: + encoded_inputs["attention_mask"] = [] + return encoded_inputs + + # If we have PyTorch/NumPy tensors/arrays as inputs, we cast them as python objects + # and rebuild them afterwards if no return_tensors is specified + # Note that we lose the specific device the tensor may be on for PyTorch + + first_element = required_input[0] + if isinstance(first_element, (list, tuple)): + # first_element might be an empty list/tuple in some edge cases so we grab the first non empty element. + for item in required_input: + if len(item) != 0: + first_element = item[0] + break + # At this state, if `first_element` is still a list/tuple, it's an empty one so there is nothing to do. + if not isinstance(first_element, (int, list, tuple)): + if is_torch_tensor(first_element): + return_tensors = "pt" if return_tensors is None else return_tensors + elif isinstance(first_element, np.ndarray): + return_tensors = "np" if return_tensors is None else return_tensors + else: + raise ValueError( + f"type of {first_element} unknown: {type(first_element)}. " + "Should be one of a python, numpy, or pytorch object." + ) + + for key, value in encoded_inputs.items(): + encoded_inputs[key] = to_py_obj(value) + + # Convert padding_strategy in PaddingStrategy + padding_strategy, _, max_length, _ = self._get_padding_truncation_strategies( + padding=padding, max_length=max_length, verbose=verbose + ) + + required_input = encoded_inputs[self.model_input_names[0]] + if required_input and not isinstance(required_input[0], (list, tuple)): + encoded_inputs = self._pad( + encoded_inputs, + max_length=max_length, + padding_strategy=padding_strategy, + pad_to_multiple_of=pad_to_multiple_of, + padding_side=padding_side, + return_attention_mask=return_attention_mask, + ) + return BatchEncoding(encoded_inputs, tensor_type=return_tensors) + + batch_size = len(required_input) + assert all(len(v) == batch_size for v in encoded_inputs.values()), ( + "Some items in the output dictionary have a different batch size than others." + ) + + if padding_strategy == PaddingStrategy.LONGEST: + max_length = max(len(inputs) for inputs in required_input) + padding_strategy = PaddingStrategy.MAX_LENGTH + + batch_outputs = {} + for i in range(batch_size): + inputs = {k: v[i] for k, v in encoded_inputs.items()} + outputs = self._pad( + inputs, + max_length=max_length, + padding_strategy=padding_strategy, + pad_to_multiple_of=pad_to_multiple_of, + padding_side=padding_side, + return_attention_mask=return_attention_mask, + ) + + for key, value in outputs.items(): + if key not in batch_outputs: + batch_outputs[key] = [] + batch_outputs[key].append(value) + + return BatchEncoding(batch_outputs, tensor_type=return_tensors) + + def _pad( + self, + encoded_inputs: dict[str, EncodedInput] | BatchEncoding, + max_length: int | None = None, + padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD, + pad_to_multiple_of: int | None = None, + padding_side: str | None = None, + return_attention_mask: bool | None = None, + ) -> dict: + """ + Pad encoded inputs (on left/right and up to predefined length or max length in the batch) + + Args: + encoded_inputs: + Dictionary of tokenized inputs (`list[int]`) or batch of tokenized inputs (`list[list[int]]`). + max_length: maximum length of the returned list and optionally padding length (see below). + Will truncate by taking into account the special tokens. + padding_strategy: PaddingStrategy to use for padding. + + - PaddingStrategy.LONGEST Pad to the longest sequence in the batch + - PaddingStrategy.MAX_LENGTH: Pad to the max length (default) + - PaddingStrategy.DO_NOT_PAD: Do not pad + The tokenizer padding sides are defined in `padding_side` argument: + + - 'left': pads on the left of the sequences + - 'right': pads on the right of the sequences + pad_to_multiple_of: (optional) Integer if set will pad the sequence to a multiple of the provided value. + This is especially useful to enable the use of Tensor Core on NVIDIA hardware with compute capability + `>= 7.5` (Volta). + padding_side: + The side on which the model should have padding applied. Should be selected between ['right', 'left']. + Default value is picked from the class attribute of the same name. + return_attention_mask: + (optional) Set to False to avoid returning attention mask (default: set to model specifics) + """ + # Load from model defaults + if return_attention_mask is None: + return_attention_mask = "attention_mask" in self.model_input_names + + required_input = encoded_inputs[self.model_input_names[0]] + + if padding_strategy == PaddingStrategy.LONGEST: + max_length = len(required_input) + + if max_length is not None and pad_to_multiple_of is not None and (max_length % pad_to_multiple_of != 0): + max_length = ((max_length // pad_to_multiple_of) + 1) * pad_to_multiple_of + + needs_to_be_padded = padding_strategy != PaddingStrategy.DO_NOT_PAD and len(required_input) != max_length + + # Initialize attention mask if not present. + if return_attention_mask and "attention_mask" not in encoded_inputs: + encoded_inputs["attention_mask"] = [1] * len(required_input) + + if needs_to_be_padded: + difference = max_length - len(required_input) + padding_side = padding_side if padding_side is not None else self.padding_side + + if padding_side == "right": + if return_attention_mask: + encoded_inputs["attention_mask"] = encoded_inputs["attention_mask"] + [0] * difference + if "token_type_ids" in encoded_inputs: + encoded_inputs["token_type_ids"] = ( + encoded_inputs["token_type_ids"] + [self.pad_token_type_id] * difference + ) + if "special_tokens_mask" in encoded_inputs: + encoded_inputs["special_tokens_mask"] = encoded_inputs["special_tokens_mask"] + [1] * difference + encoded_inputs[self.model_input_names[0]] = required_input + [self.pad_token_id] * difference + elif padding_side == "left": + if return_attention_mask: + encoded_inputs["attention_mask"] = [0] * difference + encoded_inputs["attention_mask"] + if "token_type_ids" in encoded_inputs: + encoded_inputs["token_type_ids"] = [self.pad_token_type_id] * difference + encoded_inputs[ + "token_type_ids" + ] + if "special_tokens_mask" in encoded_inputs: + encoded_inputs["special_tokens_mask"] = [1] * difference + encoded_inputs["special_tokens_mask"] + encoded_inputs[self.model_input_names[0]] = [self.pad_token_id] * difference + required_input + else: + raise ValueError(f"Invalid padding strategy:{padding_side}") + + return encoded_inputs + + def convert_tokens_to_string(self, tokens: list[str]) -> str: + """ + Converts a sequence of tokens in a single string. The most simple way to do it is `" ".join(tokens)` but we + often want to remove sub-word tokenization artifacts at the same time. + + Args: + tokens (`list[str]`): The token to join in a string. + + Returns: + `str`: The joined tokens. + """ + raise NotImplementedError + + def decode( + self, + token_ids: int | list[int] | list[list[int]] | np.ndarray | torch.Tensor, + skip_special_tokens: bool = False, + **kwargs, + ) -> str | list[str]: + """ + Converts a sequence of ids into a string, or a list of sequences into a list of strings, + using the tokenizer and vocabulary with options to remove special tokens and clean up + tokenization spaces. + + Similar to doing `self.convert_tokens_to_string(self.convert_ids_to_tokens(token_ids))`. + + Args: + token_ids (`Union[int, list[int], list[list[int]], np.ndarray, torch.Tensor]`): + A single sequence or a batch (list of sequences) of tokenized input ids. Can be obtained using the + `__call__` method. + skip_special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not to remove special tokens in the decoding. + kwargs (additional keyword arguments, *optional*): + Will be passed to the underlying model specific decode method. + + Returns: + `Union[str, list[str]]`: The decoded string for a single sequence, or a list of decoded strings for a + batch of sequences. + """ + # Convert inputs to python lists + token_ids = to_py_obj(token_ids) + + # If we received batched input, decode each sequence + if isinstance(token_ids, (list, tuple)) and len(token_ids) > 0 and isinstance(token_ids[0], (list, tuple)): + clean_up_tokenization_spaces = kwargs.pop("clean_up_tokenization_spaces", False) + return [ + self._decode( + token_ids=seq, + skip_special_tokens=skip_special_tokens, + clean_up_tokenization_spaces=clean_up_tokenization_spaces, + **kwargs, + ) + for seq in token_ids + ] + + return self._decode( + token_ids=token_ids, + skip_special_tokens=skip_special_tokens, + **kwargs, + ) + + def batch_decode( + self, + sequences: list[int] | list[list[int]] | np.ndarray | torch.Tensor, + skip_special_tokens: bool = False, + clean_up_tokenization_spaces: bool | None = None, + **kwargs, + ) -> list[str]: + """ + Convert a list of lists of token ids into a list of strings by calling decode. + + This method is provided for backwards compatibility. The `decode` method now handles batched input natively, + so you can use `decode` directly instead of `batch_decode`. + + Args: + sequences (`Union[list[int], list[list[int]], np.ndarray, torch.Tensor]`): + List of tokenized input ids. Can be obtained using the `__call__` method. + skip_special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not to remove special tokens in the decoding. + clean_up_tokenization_spaces (`bool`, *optional*): + Whether or not to clean up the tokenization spaces. If `None`, will default to + `self.clean_up_tokenization_spaces`. + kwargs (additional keyword arguments, *optional*): + Will be passed to the underlying model specific decode method. + + Returns: + `list[str]`: The list of decoded sentences. + """ + # Forward to decode() which now handles batched input natively + result = self.decode( + token_ids=sequences, + skip_special_tokens=skip_special_tokens, + clean_up_tokenization_spaces=clean_up_tokenization_spaces, + **kwargs, + ) + # Ensure we always return a list for backwards compatibility + if isinstance(result, str): + return [result] + return result + + def _decode( + self, + token_ids: int | list[int], + skip_special_tokens: bool = False, + clean_up_tokenization_spaces: bool | None = None, + **kwargs, + ) -> str: + raise NotImplementedError + + def _eventual_warn_about_too_long_sequence(self, ids: list[int], max_length: int | None, verbose: bool): + """ + Depending on the input and internal state we might trigger a warning about a sequence that is too long for its + corresponding model + + Args: + ids (`list[str]`): The ids produced by the tokenization + max_length (`int`, *optional*): The max_length desired (does not trigger a warning if it is set) + verbose (`bool`): Whether or not to print more information and warnings. + + """ + if max_length is None and len(ids) > self.model_max_length and verbose and self.model_max_length != 0: + if not self.deprecation_warnings.get("sequence-length-is-longer-than-the-specified-maximum", False): + logger.warning( + "Token indices sequence length is longer than the specified maximum sequence length " + f"for this model ({len(ids)} > {self.model_max_length}). Running this sequence through the model " + "will result in indexing errors" + ) + self.deprecation_warnings["sequence-length-is-longer-than-the-specified-maximum"] = True + + @classmethod + def register_for_auto_class(cls, auto_class="AutoTokenizer"): + """ + Register this class with a given auto class. This should only be used for custom tokenizers as the ones in the + library are already mapped with `AutoTokenizer`. + + Args: + auto_class (`str` or `type`, *optional*, defaults to `"AutoTokenizer"`): + The auto class to register this new tokenizer with. + """ + if not isinstance(auto_class, str): + auto_class = auto_class.__name__ + + import transformers.models.auto as auto_module + + if not hasattr(auto_module, auto_class): + raise ValueError(f"{auto_class} is not a valid auto class.") + + cls._auto_class = auto_class + + def apply_chat_template( + self, + conversation: list[dict[str, str]] | list[list[dict[str, str]]], + tools: list[dict | Callable] | None = None, + documents: list[dict[str, str]] | None = None, + chat_template: str | None = None, + add_generation_prompt: bool = False, + continue_final_message: bool = False, + tokenize: bool = True, + padding: bool | str | PaddingStrategy = False, + truncation: bool = False, + max_length: int | None = None, + return_tensors: str | TensorType | None = None, + return_dict: bool = True, + return_assistant_tokens_mask: bool = False, + tokenizer_kwargs: dict[str, Any] | None = None, + **kwargs, + ) -> str | list[int] | list[str] | list[list[int]] | BatchEncoding: + """ + Converts a list of dictionaries with `"role"` and `"content"` keys to a list of token + ids. This method is intended for use with chat models, and will read the tokenizer's chat_template attribute to + determine the format and control tokens to use when converting. + + Args: + conversation (Union[list[dict[str, str]], list[list[dict[str, str]]]]): A list of dicts + with "role" and "content" keys, representing the chat history so far. + tools (`list[Union[Dict, Callable]]`, *optional*): + A list of tools (callable functions) that will be accessible to the model. If the template does not + support function calling, this argument will have no effect. Each tool should be passed as a JSON Schema, + giving the name, description and argument types for the tool. See our + [tool use guide](https://huggingface.co/docs/transformers/en/chat_extras#passing-tools) + for more information. + documents (`list[dict[str, str]]`, *optional*): + A list of dicts representing documents that will be accessible to the model if it is performing RAG + (retrieval-augmented generation). If the template does not support RAG, this argument will have no + effect. We recommend that each document should be a dict containing "title" and "text" keys. + chat_template (`str`, *optional*): + A Jinja template to use for this conversion. It is usually not necessary to pass anything to this + argument, as the model's template will be used by default. + add_generation_prompt (bool, *optional*): + If this is set, a prompt with the token(s) that indicate + the start of an assistant message will be appended to the formatted output. This is useful when you want to generate a response from the model. + Note that this argument will be passed to the chat template, and so it must be supported in the + template for this argument to have any effect. + continue_final_message (bool, *optional*): + If this is set, the chat will be formatted so that the final + message in the chat is open-ended, without any EOS tokens. The model will continue this message + rather than starting a new one. This allows you to "prefill" part of + the model's response for it. Cannot be used at the same time as `add_generation_prompt`. + tokenize (`bool`, defaults to `True`): + Whether to tokenize the output. If `False`, the output will be a string. + padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `False`): + Select a strategy to pad the returned sequences (according to the model's padding side and padding + index) among: + + - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single + sequence if provided). + - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum + acceptable input length for the model if that argument is not provided. + - `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different + lengths). + truncation (`bool`, defaults to `False`): + Whether to truncate sequences at the maximum length. Has no effect if tokenize is `False`. + max_length (`int`, *optional*): + Maximum length (in tokens) to use for padding or truncation. Has no effect if tokenize is `False`. If + not specified, the tokenizer's `max_length` attribute will be used as a default. + return_tensors (`str` or [`~utils.TensorType`], *optional*): + If set, will return tensors of a particular framework. Has no effect if tokenize is `False`. Acceptable + values are: + - `'pt'`: Return PyTorch `torch.Tensor` objects. + - `'np'`: Return NumPy `np.ndarray` objects. + return_dict (`bool`, defaults to `True`): + Whether to return a dictionary with named outputs. Has no effect if tokenize is `False`. + tokenizer_kwargs (`dict[str: Any]`, *optional*): Additional kwargs to pass to the tokenizer. + return_assistant_tokens_mask (`bool`, defaults to `False`): + Whether to return a mask of the assistant generated tokens. For tokens generated by the assistant, + the mask will contain 1. For user and system tokens, the mask will contain 0. + This functionality is only available for chat templates that support it via the `{% generation %}` keyword. + **kwargs: Additional kwargs to pass to the template renderer. Will be accessible by the chat template. + + Returns: + `Union[list[int], Dict]`: A list of token ids representing the tokenized chat so far, including control tokens. This + output is ready to pass to the model, either directly or via methods like `generate()`. If `return_dict` is + set, will return a dict of tokenizer outputs instead. + """ + + if not tokenize: + return_dict = False # dicts are only returned by the tokenizer anyway + + if return_assistant_tokens_mask and not (return_dict and tokenize): + raise ValueError("`return_assistant_tokens_mask=True` requires `return_dict=True` and `tokenize=True`") + + if tokenizer_kwargs is None: + tokenizer_kwargs = {} + + chat_template = self.get_chat_template(chat_template, tools) + + if isinstance(conversation, (list, tuple)) and ( + isinstance(conversation[0], (list, tuple)) or hasattr(conversation[0], "messages") + ): + conversations = conversation + is_batched = True + else: + conversations = [conversation] + is_batched = False + + if continue_final_message: + if add_generation_prompt: + raise ValueError( + "continue_final_message and add_generation_prompt are not compatible. Use continue_final_message when you want the model to continue the final message, and add_generation_prompt when you want to add a header that will prompt it to start a new assistant message instead." + ) + if return_assistant_tokens_mask: + raise ValueError("continue_final_message is not compatible with return_assistant_tokens_mask.") + + template_kwargs = {**self.special_tokens_map, **kwargs} # kwargs overwrite special tokens if both are present + rendered_chat, generation_indices = render_jinja_template( + conversations=conversations, + tools=tools, + documents=documents, + chat_template=chat_template, + return_assistant_tokens_mask=return_assistant_tokens_mask, + continue_final_message=continue_final_message, + add_generation_prompt=add_generation_prompt, + **template_kwargs, + ) + + if not is_batched: + rendered_chat = rendered_chat[0] + + if tokenize: + out = self( + rendered_chat, + padding=padding, + truncation=truncation, + max_length=max_length, + add_special_tokens=False, + return_tensors=return_tensors, + **tokenizer_kwargs, + ) + if return_dict: + if return_assistant_tokens_mask: + assistant_masks = [] + if is_batched or return_tensors: + input_ids = out["input_ids"] + else: + input_ids = [out["input_ids"]] + for i in range(len(input_ids)): + current_mask = [0] * len(input_ids[i]) + for assistant_start_char, assistant_end_char in generation_indices[i]: + start_token = out.char_to_token(i, assistant_start_char) + end_token = out.char_to_token(i, assistant_end_char - 1) + if start_token is None: + # start_token is out of bounds maybe due to truncation. + break + for token_id in range(start_token, end_token + 1 if end_token else len(input_ids[i])): + current_mask[token_id] = 1 + assistant_masks.append(current_mask) + + if not is_batched and not return_tensors: + assistant_masks = assistant_masks[0] + + out["assistant_masks"] = assistant_masks + + if return_tensors: + out.convert_to_tensors(tensor_type=return_tensors) + + return out + else: + return out["input_ids"] + else: + return rendered_chat + + def encode_message_with_chat_template( + self, + message: dict[str, str], + conversation_history: list[dict[str, str]] | None = None, + **kwargs, + ) -> list[int]: + """ + Tokenize a single message. This method is a convenience wrapper around `apply_chat_template` that allows you + to tokenize messages one by one. This is useful for things like token-by-token streaming. + This method is not guaranteed to be perfect. For some models, it may be impossible to robustly tokenize + single messages. For example, if the chat template adds tokens after each message, but also has a prefix that + is added to the entire chat, it will be impossible to distinguish a chat-start-token from a message-start-token. + In these cases, this method will do its best to find the correct tokenization, but it may not be perfect. + **Note:** This method does not support `add_generation_prompt`. If you want to add a generation prompt, + you should do it separately after tokenizing the conversation. + Args: + message (`dict`): + A dictionary with "role" and "content" keys, representing the message to tokenize. + conversation_history (`list[dict]`, *optional*): + A list of dicts with "role" and "content" keys, representing the chat history so far. If you are + tokenizing messages one by one, you should pass the previous messages in the conversation here. + **kwargs: + Additional kwargs to pass to the `apply_chat_template` method. + Returns: + `list[int]`: A list of token ids representing the tokenized message. + """ + if "add_generation_prompt" in kwargs: + raise ValueError( + "`encode_message_with_chat_template` does not support `add_generation_prompt`. Please add the generation prompt " + "separately." + ) + + if conversation_history is None or len(conversation_history) == 0: + return self.apply_chat_template( + [message], add_generation_prompt=False, tokenize=True, return_dict=False, **kwargs + ) + + conversation = conversation_history + [message] + tokens = self.apply_chat_template( + conversation, add_generation_prompt=False, tokenize=True, return_dict=False, **kwargs + ) + + prefix_tokens = self.apply_chat_template( + conversation_history, add_generation_prompt=False, tokenize=True, return_dict=False, **kwargs + ) + # It's possible that the prefix tokens are not a prefix of the full list of tokens. + # For example, if the prefix is `User: Hi` and the full conversation is `User: HiAssistant: Hello`. + # In this case, we can't simply find the prefix, so we have to do something a bit more subtle. + # We look for the first place where the tokens differ, and that's our split point. + # This is not perfect, but it's the best we can do without a token-level API. + # To make this more robust, we could do a diff and find the longest common subsequence, but this is + # a good first approximation. + # This is particularly important for models like Llama3 that have changed their chat template to include + # EOS tokens after user messages. + min_len = min(len(prefix_tokens), len(tokens)) + for i in range(min_len): + if prefix_tokens[i] != tokens[i]: + return tokens[i:] + return tokens[min_len:] + + def get_chat_template(self, chat_template: str | None = None, tools: list[dict] | None = None) -> str: + """ + Retrieve the chat template string used for tokenizing chat messages. This template is used + internally by the `apply_chat_template` method and can also be used externally to retrieve the model's chat + template for better generation tracking. + + Args: + chat_template (`str`, *optional*): + A Jinja template or the name of a template to use for this conversion. + It is usually not necessary to pass anything to this argument, + as the model's template will be used by default. + tools (`list[Dict]`, *optional*): + A list of tools (callable functions) that will be accessible to the model. If the template does not + support function calling, this argument will have no effect. Each tool should be passed as a JSON Schema, + giving the name, description and argument types for the tool. See our + [chat templating guide](https://huggingface.co/docs/transformers/main/en/chat_templating#automated-function-conversion-for-tool-use) + for more information. + + Returns: + `str`: The chat template string. + """ + # First, handle the cases when the model has a dict of multiple templates + if isinstance(self.chat_template, dict): + template_dict = self.chat_template + if chat_template is not None and chat_template in template_dict: + # The user can pass the name of a template to the chat template argument instead of an entire template + chat_template = template_dict[chat_template] + elif chat_template is None: + if tools is not None and "tool_use" in template_dict: + chat_template = template_dict["tool_use"] + elif "default" in template_dict: + chat_template = template_dict["default"] + else: + raise ValueError( + "This model has multiple chat templates with no default specified! Please either pass a chat " + "template or the name of the template you wish to use to the `chat_template` argument. Available " + f"template names are {sorted(template_dict.keys())}." + ) + + elif chat_template is None: + # These are the cases when the model has a single template + # priority: `chat_template` argument > `tokenizer.chat_template` + if self.chat_template is not None: + chat_template = self.chat_template + else: + raise ValueError( + "Cannot use chat template functions because tokenizer.chat_template is not set and no template " + "argument was passed! For information about writing templates and setting the " + "tokenizer.chat_template attribute, please see the documentation at " + "https://huggingface.co/docs/transformers/main/en/chat_templating" + ) + + return chat_template + + def save_chat_templates( + self, + save_directory: str | os.PathLike, + tokenizer_config: dict, + filename_prefix: str | None, + save_jinja_files: bool, + ): + """ + Writes chat templates out to the save directory if we're using the new format, and removes them from + the tokenizer config if present. If we're using the legacy format, it doesn't write any files, and instead + writes the templates to the tokenizer config in the correct format. + """ + chat_template_file = os.path.join( + save_directory, (filename_prefix + "-" if filename_prefix else "") + CHAT_TEMPLATE_FILE + ) + chat_template_dir = os.path.join( + save_directory, (filename_prefix + "-" if filename_prefix else "") + CHAT_TEMPLATE_DIR + ) + + saved_raw_chat_template_files = [] + if save_jinja_files and isinstance(self.chat_template, str): + # New format for single templates is to save them as chat_template.jinja + with open(chat_template_file, "w", encoding="utf-8") as f: + f.write(self.chat_template) + logger.info(f"chat template saved in {chat_template_file}") + saved_raw_chat_template_files.append(chat_template_file) + if "chat_template" in tokenizer_config: + tokenizer_config.pop("chat_template") # To ensure it doesn't somehow end up in the config too + elif save_jinja_files and isinstance(self.chat_template, dict): + # New format for multiple templates is to save the default as chat_template.jinja + # and the other templates in the chat_templates/ directory + for template_name, template in self.chat_template.items(): + if template_name == "default": + with open(chat_template_file, "w", encoding="utf-8") as f: + f.write(self.chat_template["default"]) + logger.info(f"chat template saved in {chat_template_file}") + saved_raw_chat_template_files.append(chat_template_file) + else: + Path(chat_template_dir).mkdir(exist_ok=True) + template_filepath = os.path.join(chat_template_dir, f"{template_name}.jinja") + with open(template_filepath, "w", encoding="utf-8") as f: + f.write(template) + logger.info(f"chat template saved in {template_filepath}") + saved_raw_chat_template_files.append(template_filepath) + if "chat_template" in tokenizer_config: + tokenizer_config.pop("chat_template") # To ensure it doesn't somehow end up in the config too + elif isinstance(self.chat_template, dict): + # Legacy format for multiple templates: + # chat template dicts are saved to the config as lists of dicts with fixed key names. + tokenizer_config["chat_template"] = [{"name": k, "template": v} for k, v in self.chat_template.items()] + elif self.chat_template is not None: + # Legacy format for single templates: Just make them a key in tokenizer_config.json + tokenizer_config["chat_template"] = self.chat_template + return tokenizer_config, saved_raw_chat_template_files + + def parse_response( + self, + response: str | list[str | int | list[int]] | np.ndarray | torch.Tensor, + schema: list | dict | None = None, + ): + """ + Converts an output string created by generating text from a model into a parsed message dictionary. + This method is intended for use with chat models, and will read the tokenizer's `response_schema` attribute to + control parsing, although this can be overridden by passing a `response_schema` argument directly. + + This method is currently **highly experimental** and the schema specification is likely to change in future! + We recommend not building production code on top of it just yet. + + Args: + response (`str`): + The output string generated by the model. This can be either a decoded string or list of strings, + or token IDs as a list/array. + schema (`Union[list, dict]`, *optional*): + A response schema that indicates the expected output format and how parsing should be performed. + If not provided, the tokenizer's `response_schema` attribute will be used. + """ + batched = ( + (isinstance(response, list) and not isinstance(response[0], int)) + or getattr(response, "ndim", 0) > 1 # For torch/numpy tensors + ) + + if schema is None: + if getattr(self, "response_schema", None) is None: + raise AttributeError("This tokenizer does not have a `response_schema` for parsing chat responses!") + schema = self.response_schema + if batched: + if not (isinstance(response, list) and isinstance(response[0], str)): + response = self.batch_decode(response) + return [recursive_parse(single_response, schema) for single_response in response] + else: + if not isinstance(response, str): + response = self.decode(response) + return recursive_parse(response, schema) + + +def get_fast_tokenizer_file(tokenization_files: list[str]) -> str: + """ + Get the tokenization file to use for this version of transformers. + + Args: + tokenization_files (`list[str]`): The list of available configuration files. + + Returns: + `str`: The tokenization file to use. + """ + tokenizer_files_map = {} + for file_name in tokenization_files: + search = _re_tokenizer_file.search(file_name) + if search is not None: + v = search.groups()[0] + tokenizer_files_map[v] = file_name + available_versions = sorted(tokenizer_files_map.keys()) + + # Defaults to FULL_TOKENIZER_FILE and then try to look at some newer versions. + tokenizer_file = FULL_TOKENIZER_FILE + transformers_version = version.parse(__version__) + for v in available_versions: + if version.parse(v) <= transformers_version: + tokenizer_file = tokenizer_files_map[v] + else: + # No point going further since the versions are sorted. + break + + return tokenizer_file + + +# Shared helper to locate a SentencePiece model file for a repo/path +def find_sentencepiece_model_file(pretrained_model_name_or_path, **kwargs): + """ + Find any .model file (SentencePiece model) in the model directory or Hub repo. + + Tries known filenames first ("tokenizer.model", "spm.model"), then scans local dir, + and as a last resort lists files on the Hub to find any .model. + + Returns the filename (str) relative to the repo root or directory if found, else None. + """ + from .utils.hub import has_file + + # Try common names first + for candidate in ("tokenizer.model", "spm.model"): + try: + if has_file( + pretrained_model_name_or_path, + candidate, + revision=kwargs.get("revision"), + token=kwargs.get("token"), + cache_dir=kwargs.get("cache_dir"), + local_files_only=kwargs.get("local_files_only", False), + ): + return candidate + except Exception: + # TODO: tighten to OSError / ProxyError + continue + + subfolder = kwargs.get("subfolder", "") + local_files_only = kwargs.get("local_files_only", False) + + # Local directory scan + if os.path.isdir(pretrained_model_name_or_path): + dir_path = ( + os.path.join(pretrained_model_name_or_path, subfolder) if subfolder else pretrained_model_name_or_path + ) + if os.path.isdir(dir_path): + for filename in os.listdir(dir_path): + if filename.endswith(".model"): + return filename if not subfolder else os.path.join(subfolder, filename) + + # Hub listing if allowed + if not local_files_only: + try: + from huggingface_hub import list_repo_tree + + entries = list_repo_tree( + repo_id=pretrained_model_name_or_path, + revision=kwargs.get("revision"), + path_in_repo=subfolder if subfolder else None, + recursive=False, + token=kwargs.get("token"), + ) + for entry in entries: + if entry.path.endswith(".model"): + return entry.path if not subfolder else entry.path.removeprefix(f"{subfolder}/") + except Exception as e: + # TODO: tighten exception class + logger.debug(f"Could not list Hub repository files: {e}") + + return None + + +def load_vocab_and_merges(pretrained_model_name_or_path, **kwargs): + """ + Resolve and load tokenizer vocabulary files from a repo/path. + + Priority order: + 1. Load ``vocab.json`` (WordLevel/WordPiece/BPE fast tokenizers) + 2. Load ``vocab.txt`` when only a WordPiece vocab is available + 3. Optionally load ``merges.txt`` (BPE tokenizers) + + Returns: + tuple (vocab: dict|None, merges: list[tuple[str,str]]|None, files_loaded: list[str]) + """ + files_loaded = [] + vocab = None + merges = None + try: + resolved_vocab_file = cached_file( + pretrained_model_name_or_path, + "vocab.json", + cache_dir=kwargs.get("cache_dir"), + force_download=kwargs.get("force_download", False), + proxies=kwargs.get("proxies"), + token=kwargs.get("token"), + revision=kwargs.get("revision"), + local_files_only=kwargs.get("local_files_only", False), + subfolder=kwargs.get("subfolder", ""), + ) + except Exception: + resolved_vocab_file = None + + if resolved_vocab_file is not None: + try: + with open(resolved_vocab_file, "r", encoding="utf-8") as vf: + vocab = json.load(vf) + files_loaded.append("vocab.json") + except Exception: + vocab = None + + # Fallback to vocab.txt (WordPiece-style vocabularies) + if vocab is None: + try: + resolved_vocab_txt = cached_file( + pretrained_model_name_or_path, + "vocab.txt", + cache_dir=kwargs.get("cache_dir"), + force_download=kwargs.get("force_download", False), + proxies=kwargs.get("proxies"), + token=kwargs.get("token"), + revision=kwargs.get("revision"), + local_files_only=kwargs.get("local_files_only", False), + subfolder=kwargs.get("subfolder", ""), + ) + except Exception: + resolved_vocab_txt = None + + if resolved_vocab_txt is not None: + try: + vocab = OrderedDict() + with open(resolved_vocab_txt, "r", encoding="utf-8") as vf: + for index, token in enumerate(vf): + token = token.rstrip("\n") + vocab[token] = index + files_loaded.append("vocab.txt") + except Exception: + vocab = None + + try: + resolved_merges_file = cached_file( + pretrained_model_name_or_path, + "merges.txt", + cache_dir=kwargs.get("cache_dir"), + force_download=kwargs.get("force_download", False), + proxies=kwargs.get("proxies"), + token=kwargs.get("token"), + revision=kwargs.get("revision"), + local_files_only=kwargs.get("local_files_only", False), + subfolder=kwargs.get("subfolder", ""), + ) + except Exception: + resolved_merges_file = None + + if resolved_merges_file is not None: + try: + merges = [] + with open(resolved_merges_file, "r", encoding="utf-8") as mf: + for line in mf: + line = line.strip() + if line and not line.startswith("#"): + parts = line.split() + if len(parts) == 2: + merges.append((parts[0], parts[1])) + files_loaded.append("merges.txt") + except Exception: + merges = None + + return vocab, merges, files_loaded + + +# To update the docstring, we need to copy the method, otherwise we change the original docstring. +PreTrainedTokenizerBase.push_to_hub = copy_func(PreTrainedTokenizerBase.push_to_hub) +if PreTrainedTokenizerBase.push_to_hub.__doc__ is not None: + PreTrainedTokenizerBase.push_to_hub.__doc__ = PreTrainedTokenizerBase.push_to_hub.__doc__.format( + object="tokenizer", object_class="AutoTokenizer", object_files="tokenizer files" + ) + + +def _get_prepend_scheme(add_prefix_space: bool, original_tokenizer) -> str: + if add_prefix_space: + prepend_scheme = "always" + if not getattr(original_tokenizer, "legacy", True): + prepend_scheme = "first" + else: + prepend_scheme = "never" + return prepend_scheme + + +def generate_merges(vocab, vocab_scores: dict[str, float] | None = None, skip_tokens: Collection[str] | None = None): + skip_tokens = set(skip_tokens) if skip_tokens is not None else set() + reverse = vocab_scores is not None + vocab_scores = dict(vocab_scores) if reverse else vocab + + merges = [] + for merge, piece_score in vocab_scores.items(): + if merge in skip_tokens: + continue + local = [] + for index in range(1, len(merge)): + piece_l, piece_r = merge[:index], merge[index:] + if piece_l in skip_tokens or piece_r in skip_tokens: + continue + if piece_l in vocab and piece_r in vocab: + local.append((piece_l, piece_r, piece_score)) + local = sorted(local, key=lambda x: (vocab[x[0]], vocab[x[1]])) + merges.extend(local) + + merges = sorted(merges, key=lambda val: (val[2], len(val[0]), len(val[1])), reverse=reverse) + merges = [(val[0], val[1]) for val in merges] + return merges diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_utils_sentencepiece.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_utils_sentencepiece.py new file mode 100644 index 0000000000000000000000000000000000000000..82856de433c66bbe7dcb90552a1bb34fac33eefc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_utils_sentencepiece.py @@ -0,0 +1,315 @@ +# Copyright 2020 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +SentencePiece-based tokenization class for loading from sentencepiece.model files. +""" + +import os +from shutil import copyfile + + +try: + import sentencepiece as spm +except ImportError: + spm = None + +from .convert_slow_tokenizer import import_protobuf +from .tokenization_python import PreTrainedTokenizer +from .tokenization_utils_base import ( + INIT_TOKENIZER_DOCSTRING, + AddedToken, + generate_merges, +) +from .utils import add_end_docstrings, logging, requires_backends + + +logger = logging.get_logger(__name__) + +VOCAB_FILES_NAMES = {"vocab_file": "tokenizer.model"} + +SPIECE_UNDERLINE = "▁" + + +@add_end_docstrings(INIT_TOKENIZER_DOCSTRING) +class SentencePieceBackend(PreTrainedTokenizer): + """ + Base class for SentencePiece-based tokenizers that load from sentencepiece.model files. + + Inherits from [`~tokenization_utils.PreTrainedTokenizer`]. + + Handle all the shared methods for tokenization and special tokens as well as methods downloading/caching/loading + pretrained tokenizers as well as adding tokens to the vocabulary. + + This class also contain the added tokens in a unified way on top of all tokenizers so we don't have to handle the + specific vocabulary augmentation methods of the various underlying dictionary structures (BPE, sentencepiece...). + """ + + vocab_files_names = VOCAB_FILES_NAMES + + def __init__(self, **kwargs): + # Ensure optional dependency is available before loading + requires_backends(self, "sentencepiece") + + # Extract sentencepiece-specific parameters + self.vocab_file = kwargs.get("vocab_file") + self.legacy = kwargs.get("legacy", True) + self.sp_model_kwargs = kwargs.pop("sp_model_kwargs", {}) + + # Set backend to "sentencepiece" if not already set + if "backend" not in kwargs: + kwargs["backend"] = "sentencepiece" + + # Load the SentencePiece model before calling parent __init__ + # This is needed because parent __init__ may call methods that depend on sp_model + tokenizer = spm.SentencePieceProcessor(**self.sp_model_kwargs) + tokenizer.Load(self.vocab_file) + + if not self.legacy: + model_pb2 = import_protobuf() + proto = model_pb2.ModelProto.FromString(tokenizer.serialized_model_proto()) + if proto.normalizer_spec.add_dummy_prefix: + proto.normalizer_spec.add_dummy_prefix = False + tokenizer.LoadFromSerializedProto(proto.SerializeToString()) + + self.sp_model = tokenizer + + # Initialize total_vocab_size before parent __init__ (which may call _add_tokens -> len(self)) + self.total_vocab_size = self.sp_model.get_piece_size() + + # Add sp_model_kwargs back to kwargs so it gets stored in init_kwargs + kwargs["sp_model_kwargs"] = self.sp_model_kwargs + + # Call parent class __init__ (PreTrainedTokenizer) + # This handles tokens_trie, _added_tokens_decoder, _added_tokens_encoder, + # token_type_ids_pattern, special_tokens_pattern, and adds special tokens + super().__init__(**kwargs) + self._update_trie() + + @property + def vocab_size(self) -> int: + """Returns vocab size""" + return self.sp_model.get_piece_size() + + def get_vocab(self): + """Returns vocab as a dict""" + vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)} + vocab.update(self.added_tokens_encoder) + return vocab + + def _add_tokens(self, new_tokens: list[str] | list[AddedToken], special_tokens: bool = False) -> int: + """ + Add a list of new tokens to the tokenizer class. If the new tokens are not in the vocabulary, they are added to + it with indices starting from length of the current vocabulary. Special tokens are sometimes already in the + vocab which is why they have to be handled specifically. + + Args: + new_tokens (`list[str]`or `list[tokenizers.AddedToken]`): + Token(s) to add in vocabulary. A token is counted as added if it's not already in the vocabulary + (tested by checking if the tokenizer assign the index of the `unk_token` to them). If a token is part + of the vocabulary then we simply mark this token as an `AddedToken` which allows to control the + stripping and normalization of this token. This is NOT possible in `tokenizers`. + special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not the tokens should be added as special tokens. + + Returns: + `int`: The number of tokens actually added to the vocabulary. + + Examples: + + ```python + # Let's see how to increase the vocabulary of Bert model and tokenizer + tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased") + model = BertModel.from_pretrained("google-bert/bert-base-uncased") + + num_added_toks = tokenizer.add_tokens(["new_tok1", "my_new-tok2"]) + print("We have added", num_added_toks, "tokens") + # Note: resize_token_embeddings expects to receive the full size of the new vocabulary, i.e. the length of the tokenizer. + model.resize_token_embeddings(len(tokenizer)) + ```""" + if not new_tokens: + return 0 + + next_index = len(self) # total size (base + added) + num_added = 0 + for token in new_tokens: + if not isinstance(token, (str, AddedToken)): + raise TypeError(f"Token {token} is not a string but a {type(token)}.") + if str(token) == "": + continue + if isinstance(token, str): + if token in self._added_tokens_encoder: + continue + is_special = token in self.all_special_tokens or special_tokens + token = AddedToken(token, rstrip=False, lstrip=False, normalized=not is_special, special=is_special) + elif special_tokens: + # doing token.special=True changes the normalization! will fix in rust + # this is important and the only reason why the AddedTokens in each class are normalized by default + token.__setstate__({"special": True, "normalized": token.normalized}) + + if token in self._added_tokens_decoder.values(): + continue + if not token.special and token.normalized and getattr(self, "do_lower_case", False): + token.content = token.content.lower() + + # Check if token already exists in the SentencePiece base vocab + tok_id = self.sp_model.piece_to_id(token.content) + in_base_vocab = ( + tok_id < self.sp_model.get_piece_size() and self.sp_model.IdToPiece(tok_id) == token.content + ) + + if in_base_vocab: + token_index = tok_id + else: + token_index = next_index + next_index += 1 + num_added += 1 + + if token.special and str(token) not in self.all_special_tokens: + self._extra_special_tokens.append(token) + # the setter automatically updates the reverse map + self._added_tokens_decoder[token_index] = token + self._added_tokens_encoder[token.content] = token_index + if self.verbose: + logger.info(f"Adding {token} to the vocabulary") + + self._update_trie() + self._update_total_vocab_size() + return num_added + + def _update_trie(self, unique_no_split_tokens: list[str] | None = None): + # Add all added tokens + for token in self._added_tokens_decoder.values(): + if token.content not in self.tokens_trie._tokens: + self.tokens_trie.add(token.content) + # Also add all special tokens (even if they're in base vocab) so they get split during tokenization + for token in self.all_special_tokens: + if token not in self.tokens_trie._tokens: + self.tokens_trie.add(token) + # Add any additional no-split tokens + for token in unique_no_split_tokens or []: + if token not in self.tokens_trie._tokens: + self.tokens_trie.add(token) + + def _tokenize(self, text, **kwargs): + """ + Returns a tokenized string. + + We de-activated the `add_dummy_prefix` option, thus the sentencepiece internals will always strip any + SPIECE_UNDERLINE. For example: `self.sp_model.encode(f"{SPIECE_UNDERLINE}Hey", out_type = str)` will give + `['H', 'e', 'y']` instead of `['▁He', 'y']`. Thus we always encode `f"{unk_token}text"` and strip the + `unk_token`. Here is an example with `unk_token = ""` and `unk_token_length = 4`. + `self.tokenizer.sp_model.encode(" Hey", out_type = str)[4:]`. + """ + if self.legacy or not text.startswith((SPIECE_UNDERLINE, " ")): + return self.sp_model.encode(text, out_type=str) + + # 1. Encode string + prefix ex: " Hey" + tokens = self.sp_model.encode(self.unk_token + text, out_type=str) + # 2. Remove self.unk_token from ['<','unk','>', '▁Hey'] + unk_token_length = len(self.sp_model.encode(str(self.unk_token))) + return tokens[unk_token_length:] if len(tokens) >= unk_token_length else tokens + + def _convert_token_to_id(self, token): + """Converts a token (str) to an id using the vocab.""" + return self.sp_model.piece_to_id(token) + + def _convert_id_to_token(self, index): + """Converts an index (integer) in a token (str) using the vocab.""" + token = self.sp_model.IdToPiece(index) + return token + + def convert_tokens_to_string(self, tokens: list[str]) -> str: + """Converts a sequence of tokens (string) in a single string.""" + out_string = "".join(tokens).replace(SPIECE_UNDERLINE, " ").strip() + return out_string + + def save_vocabulary(self, save_directory: str, filename_prefix: str | None = None) -> tuple[str]: + """ + Save the sentencepiece vocabulary (copy original file) to a directory. + + Args: + save_directory (`str`): + The directory in which to save the vocabulary. + filename_prefix (`str`, *optional*): + An optional prefix to add to the named of the saved files. + + Returns: + `tuple(str)`: Paths to the files saved. + """ + if not os.path.isdir(save_directory): + logger.error(f"Vocabulary path ({save_directory}) should be a directory") + return + out_vocab_file = os.path.join( + save_directory, (filename_prefix + "-" if filename_prefix else "") + self.vocab_files_names["vocab_file"] + ) + + if os.path.abspath(self.vocab_file) != os.path.abspath(out_vocab_file) and os.path.isfile(self.vocab_file): + copyfile(self.vocab_file, out_vocab_file) + elif not os.path.isfile(self.vocab_file): + with open(out_vocab_file, "wb") as fi: + content_spiece_model = self.sp_model.serialized_model_proto() + fi.write(content_spiece_model) + + return (out_vocab_file,) + + def _decode( + self, + token_ids: int | list[int], + skip_special_tokens: bool = False, + clean_up_tokenization_spaces: bool | None = None, + spaces_between_special_tokens: bool = False, + **kwargs, + ) -> str: + """ + Decode token ids to string. + + Uses the generic decode path from PreTrainedTokenizer which works for all vocabularies, + including custom vocabularies that override _convert_id_to_token. + """ + # Use parent class's generic decode method - it's simpler and works for all cases + return super()._decode( + token_ids=token_ids, + skip_special_tokens=skip_special_tokens, + clean_up_tokenization_spaces=clean_up_tokenization_spaces, + **kwargs, + ) + + +class SentencePieceExtractor: + """ + Extractor implementation for SentencePiece trained models. https://github.com/google/sentencepiece + """ + + def __init__(self, model: str): + requires_backends(self, "sentencepiece") + from sentencepiece import SentencePieceProcessor + + self.sp = SentencePieceProcessor() + self.sp.Load(model) + + def extract(self, vocab_scores=None) -> tuple[dict[str, int], list[tuple[str, float]], list[tuple]]: + """ + By default will return vocab and merges with respect to their order, by sending `vocab_scores` we're going to + order the merges with respect to the piece scores instead. + """ + sp = self.sp + vocab_ids = {sp.id_to_piece(index): index for index in range(sp.GetPieceSize())} + + vocab_scores_dict = {sp.id_to_piece(i): sp.get_score(i) for i in range(sp.GetPieceSize())} + + merges = generate_merges(vocab_ids, vocab_scores_dict) + + vocab_scores_list = [(sp.id_to_piece(i), sp.get_score(i)) for i in range(sp.GetPieceSize())] + + return vocab_ids, vocab_scores_list, merges diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_utils_tokenizers.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_utils_tokenizers.py new file mode 100644 index 0000000000000000000000000000000000000000..446b7ebd989c31fd7afcdd552f3d59a69f9dcf78 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/tokenization_utils_tokenizers.py @@ -0,0 +1,1306 @@ +# Copyright 2020 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Tokenization classes for fast tokenizers (provided by HuggingFace's tokenizers library). For slow (python) tokenizers +see tokenization_utils.py +""" + +import copy +import json +import os +from collections import defaultdict +from collections.abc import Iterable +from shutil import copyfile +from typing import Any + +import tokenizers.pre_tokenizers as pre_tokenizers_fast +from huggingface_hub import is_offline_mode +from tokenizers import AddedToken, processors +from tokenizers import Encoding as EncodingFast +from tokenizers import Tokenizer as TokenizerFast +from tokenizers.decoders import Decoder as DecoderFast +from tokenizers.models import BPE, Unigram +from tokenizers.trainers import BpeTrainer, UnigramTrainer, WordLevelTrainer, WordPieceTrainer + +from transformers.utils.hub import cached_file + +from .integrations.ggml import convert_gguf_tokenizer +from .modeling_gguf_pytorch_utils import load_gguf_checkpoint +from .tokenization_utils_base import ( + INIT_TOKENIZER_DOCSTRING, + BatchEncoding, + PreTokenizedInput, + PreTrainedTokenizerBase, + TextInput, + TruncationStrategy, + generate_merges, +) +from .utils import PaddingStrategy, add_end_docstrings, logging + + +logger = logging.get_logger(__name__) + +# Fast tokenizers (provided by HuggingFace tokenizer's library) can be saved in a single file +TOKENIZER_FILE = "tokenizer.json" +SPECIAL_TOKENS_MAP_FILE = "special_tokens_map.json" +TOKENIZER_CONFIG_FILE = "tokenizer_config.json" +TIKTOKEN_VOCAB_FILE = "tokenizer.model" + +# Slow tokenizers have an additional added tokens files +ADDED_TOKENS_FILE = "added_tokens.json" + +INIT_TOKENIZER_DOCSTRING += """ + tokenizer_object ([`tokenizers.Tokenizer`]): + A [`tokenizers.Tokenizer`] object from 🤗 tokenizers to instantiate from. See [Using tokenizers from 🤗 + tokenizers](../fast_tokenizers) for more information. + tokenizer_file ([`str`]): + A path to a local JSON file representing a previously serialized [`tokenizers.Tokenizer`] object from 🤗 + tokenizers. +""" + +MODEL_TO_TRAINER_MAPPING = { + "BPE": BpeTrainer, + "Unigram": UnigramTrainer, + "WordLevel": WordLevelTrainer, + "WordPiece": WordPieceTrainer, +} + +VOCAB_FILES_NAMES = {"tokenizer_file": TOKENIZER_FILE, "vocab_file": TIKTOKEN_VOCAB_FILE} + + +@add_end_docstrings(INIT_TOKENIZER_DOCSTRING) +class TokenizersBackend(PreTrainedTokenizerBase): + """ + Base class for all fast tokenizers (wrapping HuggingFace tokenizers library). + + Inherits from [`~tokenization_utils_base.PreTrainedTokenizerBase`]. + + Handles all the shared methods for tokenization and special tokens, as well as methods for + downloading/caching/loading pretrained tokenizers, as well as adding tokens to the vocabulary. + + This class also contains the added tokens in a unified way on top of all tokenizers so we don't have to handle the + specific vocabulary augmentation methods of the various underlying dictionary structures (BPE, sentencepiece...). + """ + + vocab_files_names = VOCAB_FILES_NAMES + model = None + _tokenizer = None + + @classmethod + def convert_to_native_format(cls, trust_remote_code=False, **kwargs): + """s + Build a `tokenizers.Tokenizer` backend from the available serialization files (tokenizer.json, sentencepiece + models, tekken.json, vocab/merges). + """ + # Preserve kwargs for possible downstream use + local_kwargs = dict(kwargs) + fast_tokenizer_file = local_kwargs.pop("tokenizer_file", None) + + if ( + fast_tokenizer_file is not None + and os.path.isfile(fast_tokenizer_file) + and (cls is TokenizersBackend or "__init__" not in cls.__dict__ or trust_remote_code) + ): + local_kwargs["tokenizer_object"] = TokenizerFast.from_file(fast_tokenizer_file) + return local_kwargs + elif fast_tokenizer_file is not None and os.path.isfile(fast_tokenizer_file): + # we extract vocab / merges from the tokenizer file to pass them to __init__ + processor = TokenizerFast.from_file(fast_tokenizer_file).post_processor + with open(fast_tokenizer_file, encoding="utf-8") as tokenizer_handle: + tokenizer_json = json.load(tokenizer_handle) + vocab = tokenizer_json.get("model", {}).get("vocab", None) + if cls.model is None: + if isinstance(vocab, list): + vocab = list(map(tuple, vocab)) # TODO just for now + elif cls.model.__name__ == "Unigram": + if vocab and isinstance(vocab[0], (list, tuple)): + vocab = [tuple(item) for item in vocab] + elif cls.model.__name__ == "WordLevel": + vocab = {token: i for i, token in enumerate(vocab)} + elif cls.model.__name__ == "BPE" or cls.model.__name__ == "WordPiece": + if isinstance(vocab, list): + vocab = {token[0] if isinstance(token, list) else token: i for i, token in enumerate(vocab)} + local_kwargs["vocab"] = vocab + + model_type = getattr(cls, "model", None) + if "merges" in tokenizer_json.get("model", {}) and (model_type and model_type.__name__ == "BPE"): + merges = tokenizer_json["model"]["merges"] + merges = [tuple(merge.split(" ")) if isinstance(merge, str) else tuple(merge) for merge in merges] + local_kwargs["merges"] = merges + + if processor is not None: + local_kwargs["post_processor"] = processor + return local_kwargs + + vocab_file = local_kwargs.get("vocab_file") + merges_file = local_kwargs.get("merges_file") + vocab = local_kwargs.get("vocab") + merges = local_kwargs.get("merges") + + # Tekken converter (Mistral) + if isinstance(vocab_file, str) and vocab_file.endswith("tekken.json") and os.path.isfile(vocab_file): + from .convert_slow_tokenizer import MistralConverter + + local_kwargs["vocab"], local_kwargs["merges"] = MistralConverter( + vocab_file=vocab_file + ).extract_vocab_merges_from_model(vocab_file) + return local_kwargs + + # SentencePiece model (with TikToken fallback) + if isinstance(vocab_file, str) and os.path.isfile(vocab_file) and vocab_file.endswith(".model"): + try: + from .convert_slow_tokenizer import SentencePieceExtractor + + local_kwargs = SentencePieceExtractor(vocab_file).extract(cls.model, **local_kwargs) + try: + from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS + + converter_class = SLOW_TO_FAST_CONVERTERS.get(cls.__name__) + if converter_class is not None and hasattr(converter_class, "convert_from_spm"): + local_kwargs = converter_class.convert_from_spm(**local_kwargs) + except Exception as e: + logger.warning( + f"Could not reorder vocab using converter for {cls.__name__} due to {e}. Falling back to raw SentencePiece extraction." + ) + # what used to be in `convert_slow` + if hasattr(cls, "convert_from_spm_model"): + local_kwargs = cls.convert_from_spm_model(**local_kwargs) + except Exception as e: # TODO only catch deserialization error here! + logger.warning( + f"Could not extract SentencePiece model from {vocab_file} using sentencepiece library due to {e}. " + "Falling back to TikToken extractor." + ) + from .convert_slow_tokenizer import TikTokenConverter + + local_kwargs["vocab"], local_kwargs["merges"] = TikTokenConverter( + vocab_file=vocab_file, extra_special_tokens=local_kwargs.get("extra_special_tokens") + ).extract_vocab_merges_from_model(vocab_file) + + return local_kwargs + + # Fallback to standard vocab/merges files if they existed! + if vocab is None and isinstance(vocab_file, str) and os.path.isfile(vocab_file): + local_kwargs["vocab"] = vocab_file + vocab = local_kwargs["vocab"] + if merges is None and isinstance(merges_file, str) and os.path.isfile(merges_file): + local_kwargs["merges"] = merges_file + merges = local_kwargs["merges"] + + # Generate merges automatically when not provided for BPE tokenizers + if merges is None and cls.model is not None and cls.model.__name__ == "BPE" and isinstance(vocab, dict): + # Gather special tokens from kwargs to skip in merge generation + def _iter_special_tokens(values: Iterable[Any]) -> list[str]: + collected: list[str] = [] + for val in values: + if val is None: + continue + if isinstance(val, (list, tuple)): + collected.extend(_iter_special_tokens(val)) + else: + collected.append(str(val)) + return collected + + special_tokens_keys = [ + "pad_token", + "unk_token", + "bos_token", + "eos_token", + "sep_token", + "cls_token", + "mask_token", + "additional_special_tokens", + "extra_special_tokens", + ] + skip_tokens: set[str] = set() + for key in special_tokens_keys: + if key in local_kwargs: + skip_tokens.update(_iter_special_tokens([local_kwargs[key]])) + + merges = generate_merges(vocab, skip_tokens=skip_tokens) + local_kwargs["merges"] = merges + return local_kwargs + + def __init__(self, *args, **kwargs): + tokenizer_object = kwargs.pop("tokenizer_object", None) + gguf_file = kwargs.pop("gguf_file", None) + fast_tokenizer_file = kwargs.pop("tokenizer_file", None) + # Note: added_tokens_decoder is NOT popped - it's passed to super().__init__() for processing + added_tokens_decoder = kwargs.get("added_tokens_decoder", {}) + # Store add_prefix_space before super().__init__() to ensure it's not overridden + add_prefix_space = kwargs.get("add_prefix_space", False) + vocab_file = kwargs.get("vocab_file") + + vocab = kwargs.get("vocab") + merges = kwargs.get("merges") + + fast_tokenizer = None + if tokenizer_object is not None: + fast_tokenizer = copy.deepcopy(tokenizer_object) + elif fast_tokenizer_file is not None and os.path.isfile(fast_tokenizer_file): + # We have a serialization from tokenizers which let us directly build the backend + fast_tokenizer = TokenizerFast.from_file(fast_tokenizer_file) + elif gguf_file is not None: + # We need to convert a slow tokenizer to build the backend + gguf_path = cached_file(kwargs.get("name_or_path", ""), gguf_file, **kwargs) + gguf_param = load_gguf_checkpoint(gguf_path) + architecture = gguf_param["config"]["model_type"] + tokenizer_dict = gguf_param["tokenizer"] + tokenizer_config = gguf_param["tokenizer_config"] + fast_tokenizer, additional_kwargs = convert_gguf_tokenizer(architecture, tokenizer_dict) + kwargs.update(tokenizer_config) + if len(additional_kwargs) > 0: + kwargs.update(additional_kwargs) + elif self._tokenizer is None and vocab is not None: + # Build from vocab/merges extracted by convert_to_native_format + if merges is not None: + vocab_dict = vocab if isinstance(vocab, dict) else {w: i for i, (w, _) in enumerate(vocab)} + fast_tokenizer = TokenizerFast(BPE(vocab=vocab_dict, merges=merges, fuse_unk=True, dropout=None)) + elif isinstance(vocab, dict): + fast_tokenizer = TokenizerFast(BPE(vocab=vocab, merges=[], fuse_unk=True, dropout=None)) + elif isinstance(vocab, list) and vocab and isinstance(vocab[0], (tuple, list)): + fast_tokenizer = TokenizerFast(Unigram(vocab=vocab, unk_id=kwargs.get("unk_id", 0))) + elif self._tokenizer is None: + raise ValueError( + "Couldn't instantiate the backend tokenizer from one of: \n" + "(1) a `tokenizers` library serialization file, \n" + "(2) a slow tokenizer instance to convert or \n" + "(3) an equivalent slow tokenizer class to instantiate and convert. \n" + "You need to have sentencepiece or tiktoken installed to convert a slow tokenizer to a fast one." + ) + # Only set defaults when creating TokenizersBackend from scratch + if fast_tokenizer_file is None and tokenizer_object is None and self._tokenizer is None: + kwargs.setdefault("bos_token", "") + kwargs.setdefault("eos_token", "") + + if fast_tokenizer is not None: + self._tokenizer = fast_tokenizer + + if self._tokenizer is None: + raise ValueError("The backend tokenizer is not correctly initialized.") + + _truncation = self._tokenizer.truncation + + if _truncation is not None: + self._tokenizer.enable_truncation(**_truncation) + kwargs.setdefault("max_length", _truncation["max_length"]) + kwargs.setdefault("truncation_side", _truncation["direction"]) + kwargs.setdefault("stride", _truncation["stride"]) + kwargs.setdefault("truncation_strategy", _truncation["strategy"]) + else: + self._tokenizer.no_truncation() + + _padding = self._tokenizer.padding + if _padding is not None: + self._tokenizer.enable_padding(**_padding) + kwargs.setdefault("pad_token", _padding["pad_token"]) + kwargs.setdefault("pad_token_type_id", _padding["pad_type_id"]) + kwargs.setdefault("padding_side", _padding["direction"]) + kwargs.setdefault("max_length", _padding["length"]) + kwargs.setdefault("pad_to_multiple_of", _padding["pad_to_multiple_of"]) + + # Set backend to "tokenizers" if not already set + if "backend" not in kwargs: + kwargs["backend"] = "tokenizers" + + explicit_bos_eos_in_kwargs = "add_bos_token" in kwargs or "add_eos_token" in kwargs + self._add_bos_token = kwargs.get("add_bos_token", False) + self._add_eos_token = kwargs.get("add_eos_token", False) + if post_processor := kwargs.pop("post_processor", None): # most reliable way to get the post-processor + self._tokenizer.post_processor = post_processor + self._should_update_post_processor = explicit_bos_eos_in_kwargs or self._tokenizer.post_processor is None + # We call this after having initialized the backend tokenizer because we update it. + super().__init__(**kwargs) + + if vocab_file is not None: + self.vocab_file = vocab_file + # Ensure add_prefix_space is set correctly after parent init + self.add_prefix_space = add_prefix_space + self._tokenizer.encode_special_tokens = self.split_special_tokens + + added_tokens_decoder_hash = {hash(repr(token)) for token in self.added_tokens_decoder} + tokens_to_add = [ + token + for index, token in sorted(added_tokens_decoder.items(), key=lambda x: x[0]) + if hash(repr(token)) not in added_tokens_decoder_hash + ] + encoder = list(self.added_tokens_encoder.keys()) + [str(token) for token in tokens_to_add] + # if some of the special tokens are not already in the tokenizer, add them + # V5: Check both named special tokens and extra special tokens + # Iterate over _special_tokens_map to preserve AddedToken properties (lstrip, rstrip, etc.) + for special_token_value in self._special_tokens_map.values(): + if special_token_value is None: + continue + if str(special_token_value) not in encoder and special_token_value not in tokens_to_add: + tokens_to_add.append(special_token_value) + + # Also check extra special tokens + for token in self._extra_special_tokens: + if str(token) not in encoder and token not in tokens_to_add: + tokens_to_add.append(token) + + if len(tokens_to_add) > 0: + tokens = [] + all_named_tokens = [str(t) for t in self._special_tokens_map.values() if t] + for token in tokens_to_add: + if isinstance(token, str): + # Convert string to AddedToken, assuming it's special + token = AddedToken(token, special=True) + elif isinstance(token, AddedToken): + # Ensure the special flag is set correctly for special tokens + if not token.special and str(token) in all_named_tokens: + token.special = True + tokens.append(token) + if tokens: + # These tokens are from the special tokens map + self.add_tokens(tokens) + + try: + vocab_size = self._tokenizer.get_vocab_size() + except NotImplementedError: + vocab_size = 0 + + # Optionally patches mistral tokenizers with wrong regex + if vocab_size > 100000 and getattr(self._tokenizer, "pre_tokenizer", None) is not None: + kwargs.pop("tokenizer", None) + self._tokenizer = self._patch_mistral_regex( + self._tokenizer, + self.init_kwargs.get("name_or_path", None), + init_kwargs=self.init_kwargs, + fix_mistral_regex=kwargs.get("fix_mistral_regex"), + **kwargs, + ) + + self._should_update_post_processor = ( + self._should_update_post_processor or self._tokenizer.post_processor is None + ) + if self._should_update_post_processor: + self.update_post_processor() + + @property + def is_fast(self) -> bool: + return True + + @property + def can_save_slow_tokenizer(self) -> bool: + """ + `bool`: Whether or not the slow tokenizer can be saved. For a sentencepiece based slow tokenizer, this + can only be `True` if the original `"sentencepiece.model"` was not deleted. + """ + if "vocab_file" in self.vocab_files_names and self.vocab_files_names["vocab_file"].endswith(".model"): + if hasattr(self, "vocab_file") and self.vocab_file: + # If the vocab file is a sentencepiece model, we can save it + return os.path.isfile(self.vocab_file) + return False + else: + return True + + def save_vocabulary(self, save_directory: str, filename_prefix: str | None = None) -> tuple[str]: + if not os.path.isdir(save_directory): + logger.error(f"Vocabulary path ({save_directory}) should be a directory") + return + out_vocab_file = os.path.join( + save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"] + ) + + if os.path.abspath(self.vocab_file) != os.path.abspath(out_vocab_file): + copyfile(self.vocab_file, out_vocab_file) + + return (out_vocab_file,) + + def update_post_processor(self): + """ + Updates the underlying post processor with the current `bos_token` and `eos_token`. + """ + bos = self.bos_token + bos_token_id = self.bos_token_id + if bos is None and self.add_bos_token: + raise ValueError("add_bos_token = True but bos_token = None") + + eos = self.eos_token + eos_token_id = self.eos_token_id + # If eos_token is None and add_eos_token is True, silently disable add_eos_token + # This allows tokenizers to set add_eos_token even if eos_token is not configured + if eos is None and self.add_eos_token: + self.add_eos_token = False + return + + single = f"{(bos + ':0 ') if self.add_bos_token else ''}$A:0{(' ' + eos + ':0') if self.add_eos_token else ''}" + pair = f"{single}{(' ' + bos + ':1') if self.add_bos_token else ''} $B:1{(' ' + eos + ':1') if self.add_eos_token else ''}" + + special_tokens = [] + if self.add_bos_token: + special_tokens.append((bos, bos_token_id)) + if self.add_eos_token: + special_tokens.append((eos, eos_token_id)) + self._tokenizer.post_processor = processors.TemplateProcessing( + single=single, pair=pair, special_tokens=special_tokens + ) + + @property + def add_eos_token(self): + return getattr(self, "_add_eos_token", False) + + @property + def add_bos_token(self): + return getattr(self, "_add_bos_token", False) + + @add_eos_token.setter + def add_eos_token(self, value): + object.__setattr__(self, "_add_eos_token", value) + self.update_post_processor() + + @add_bos_token.setter + def add_bos_token(self, value): + object.__setattr__(self, "_add_bos_token", value) + self.update_post_processor() + + def _post_init(self): + """ + Post-initialization hook that runs after the tokenizer is fully set up. + This is called by from_pretrained() after loading the tokenizer, which allows + us to add any special tokens that may have been passed as AddedToken objects. + + Child classes should call super()._post_init() if they override this method. + """ + tokens_to_add = [] + # V5: Check named special tokens + for token_value in self._special_tokens_map.values(): + if token_value is None: + continue + if isinstance(token_value, AddedToken): + tokens_to_add.append(token_value) + elif isinstance(token_value, str): + tokens_to_add.append(AddedToken(token_value, special=True, normalized=False)) + + # V5: Check extra special tokens + for token in self._extra_special_tokens: + if isinstance(token, AddedToken): + tokens_to_add.append(token) + elif isinstance(token, str): + tokens_to_add.append(AddedToken(token, special=True, normalized=False)) + + if tokens_to_add: + # Ensure special tokens are added as such to the backend + self.add_tokens(tokens_to_add, special_tokens=True) + + if getattr(self, "_should_update_post_processor", True) or self._tokenizer.post_processor is None: + self.update_post_processor() + + @property + def vocab_size(self) -> int: + """ + `int`: Size of the base vocabulary (without the added tokens). + """ + return self._tokenizer.get_vocab_size(with_added_tokens=False) + + def get_vocab(self) -> dict[str, int]: + return self._tokenizer.get_vocab(with_added_tokens=True) + + @property + def vocab(self) -> dict[str, int]: + return self.get_vocab() + + @property + def added_tokens_encoder(self) -> dict[str, int]: + """ + Returns the sorted mapping from string to index. The added tokens encoder is cached for performance + optimisation in `self._added_tokens_encoder` for the slow tokenizers. + """ + return {k.content: v for v, k in sorted(self.added_tokens_decoder.items(), key=lambda item: item[0])} + + @property + def added_tokens_decoder(self) -> dict[int, AddedToken]: + """ + Returns the added tokens in the vocabulary as a dictionary of index to AddedToken. + + Returns: + `dict[str, int]`: The added tokens. + """ + return self._tokenizer.get_added_tokens_decoder() + + # BC v5: expose ``_added_tokens_encoder`` / ``_added_tokens_decoder`` attrs for custom tokenizers that expect + # them from slow tokenizers. Only supports read, not write (won't sync to Rust backend, use add_tokens() instead + _added_tokens_encoder = added_tokens_encoder + _added_tokens_decoder = added_tokens_decoder + + def get_added_vocab(self) -> dict[str, int]: + """ + Returns the added tokens in the vocabulary as a dictionary of token to index. + + Returns: + `dict[str, int]`: The added tokens. + """ + return {k.content: v for v, k in sorted(self.added_tokens_decoder.items(), key=lambda item: item[0])} + + def __bool__(self) -> bool: + """ + Returns True, to avoid expensive `assert tokenizer` gotchas. + """ + return True + + def __len__(self) -> int: + """ + Size of the full vocabulary with the added tokens. + """ + return self._tokenizer.get_vocab_size(with_added_tokens=True) + + @property + def backend_tokenizer(self) -> TokenizerFast: + """ + `tokenizers.implementations.BaseTokenizer`: The Rust tokenizer used as a backend. + """ + return self._tokenizer + + @property + def decoder(self) -> DecoderFast: + """ + `tokenizers.decoders.Decoder`: The Rust decoder for this tokenizer. + """ + return self._tokenizer.decoder + + def _convert_encoding( + self, + encoding: EncodingFast, + return_token_type_ids: bool | None = None, + return_attention_mask: bool | None = None, + return_overflowing_tokens: bool = False, + return_special_tokens_mask: bool = False, + return_offsets_mapping: bool = False, + return_length: bool = False, + verbose: bool = True, + ) -> tuple[dict[str, Any], list[EncodingFast]]: + """ + Convert the encoding representation (from low-level HuggingFace tokenizer output) to a python Dict and a list + of encodings, take care of building a batch from overflowing tokens. + + Overflowing tokens are converted to additional examples (like batches) so the output values of the dict are + lists (overflows) of lists (tokens). + + Output shape: (overflows, sequence length) + """ + if return_token_type_ids is None: + return_token_type_ids = "token_type_ids" in self.model_input_names + if return_attention_mask is None: + return_attention_mask = "attention_mask" in self.model_input_names + + if return_overflowing_tokens and encoding.overflowing is not None: + encodings = [encoding] + encoding.overflowing + else: + encodings = [encoding] + + encoding_dict = defaultdict(list) + for e in encodings: + encoding_dict["input_ids"].append(e.ids) + + if return_token_type_ids: + encoding_dict["token_type_ids"].append(e.type_ids) + if return_attention_mask: + encoding_dict["attention_mask"].append(e.attention_mask) + if return_special_tokens_mask: + encoding_dict["special_tokens_mask"].append(e.special_tokens_mask) + if return_offsets_mapping: + encoding_dict["offset_mapping"].append(e.offsets) + if return_length: + encoding_dict["length"].append(len(e.ids)) + + return encoding_dict, encodings + + def _convert_token_to_id_with_added_voc(self, token: str) -> int: + index = self._tokenizer.token_to_id(token) + if index is None: + return self.unk_token_id + return index + + def _convert_id_to_token(self, index: int) -> str | None: + return self._tokenizer.id_to_token(int(index)) + + def _add_tokens(self, new_tokens: list[str | AddedToken], special_tokens=False) -> int: + if special_tokens: + return self._tokenizer.add_special_tokens(new_tokens) + + return self._tokenizer.add_tokens(new_tokens) + + def num_special_tokens_to_add(self, pair: bool = False) -> int: + """ + Returns the number of added tokens when encoding a sequence with special tokens. + + + + This encodes a dummy input and checks the number of added tokens, and is therefore not efficient. Do not put + this inside your training loop. + + + + Args: + pair (`bool`, *optional*, defaults to `False`): + Whether the number of added tokens should be computed in the case of a sequence pair or a single + sequence. + + Returns: + `int`: Number of special tokens added to sequences. + """ + return self._tokenizer.num_special_tokens_to_add(pair) + + def convert_ids_to_tokens(self, ids: int | list[int], skip_special_tokens: bool = False) -> str | list[str]: + """ + Converts a single index or a sequence of indices in a token or a sequence of tokens, using the vocabulary and + added tokens. + + Args: + ids (`int` or `list[int]`): + The token id (or token ids) to convert to tokens. + skip_special_tokens (`bool`, *optional*, defaults to `False`): + Whether or not to remove special tokens in the decoding. + + Returns: + `str` or `list[str]`: The decoded token(s). + """ + if isinstance(ids, int): + return self._tokenizer.id_to_token(ids) + tokens = [] + # self.all_special_ids is an @property which may be slow, so only compute it once before the loop + ids_to_skip = set(self.all_special_ids) if skip_special_tokens else set() + for index in ids: + index = int(index) + if index in ids_to_skip: + continue + tokens.append(self._tokenizer.id_to_token(index)) + return tokens + + def tokenize(self, text: str, pair: str | None = None, add_special_tokens: bool = False, **kwargs) -> list[str]: + return self._encode_plus(text=text, text_pair=pair, add_special_tokens=add_special_tokens, **kwargs).tokens() + + def set_truncation_and_padding( + self, + padding_strategy: PaddingStrategy, + truncation_strategy: TruncationStrategy, + max_length: int, + stride: int, + pad_to_multiple_of: int | None, + padding_side: str | None, + ): + """ + Define the truncation and the padding strategies for fast tokenizers (provided by HuggingFace tokenizers + library) and restore the tokenizer settings afterwards. + + The provided tokenizer has no padding / truncation strategy before the managed section. If your tokenizer set a + padding / truncation strategy before, then it will be reset to no padding / truncation when exiting the managed + section. + + Args: + padding_strategy ([`~utils.PaddingStrategy`]): + The kind of padding that will be applied to the input + truncation_strategy ([`~tokenization_utils_base.TruncationStrategy`]): + The kind of truncation that will be applied to the input + max_length (`int`): + The maximum size of a sequence. + stride (`int`): + The stride to use when handling overflow. + pad_to_multiple_of (`int`, *optional*): + If set will pad the sequence to a multiple of the provided value. This is especially useful to enable + the use of Tensor Cores on NVIDIA hardware with compute capability `>= 7.5` (Volta). + padding_side (`str`, *optional*): + The side on which the model should have padding applied. Should be selected between ['right', 'left']. + Default value is picked from the class attribute of the same name. + """ + _truncation = self._tokenizer.truncation + _padding = self._tokenizer.padding + # Set truncation and padding on the backend tokenizer + if truncation_strategy == TruncationStrategy.DO_NOT_TRUNCATE: + if _truncation is not None: + self._tokenizer.no_truncation() + else: + target = { + "max_length": max_length, + "stride": stride, + "strategy": truncation_strategy.value, + "direction": self.truncation_side, + } + + # _truncation might contain more keys that the target `transformers` + # supports. Use only the target keys to trigger `enable_truncation`. + # This should enable this code to works on various `tokenizers` + # targets. + if _truncation is None: + current = None + else: + current = {k: _truncation.get(k, None) for k in target} + + if current != target: + self._tokenizer.enable_truncation(**target) + + if padding_strategy == PaddingStrategy.DO_NOT_PAD: + if _padding is not None: + self._tokenizer.no_padding() + else: + length = max_length if padding_strategy == PaddingStrategy.MAX_LENGTH else None + target = { + "length": length, + "direction": padding_side if padding_side is not None else self.padding_side, + "pad_id": self.pad_token_id, + "pad_token": self.pad_token, + "pad_type_id": self.pad_token_type_id, + "pad_to_multiple_of": pad_to_multiple_of, + } + if _padding != target: + self._tokenizer.enable_padding(**target) + + def _encode_plus( + self, + text: TextInput | PreTokenizedInput | list[TextInput] | list[PreTokenizedInput], + text_pair: TextInput | PreTokenizedInput | list[TextInput] | list[PreTokenizedInput] | None = None, + add_special_tokens: bool = True, + padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD, + truncation_strategy: TruncationStrategy = TruncationStrategy.DO_NOT_TRUNCATE, + max_length: int | None = None, + stride: int = 0, + is_split_into_words: bool = False, + pad_to_multiple_of: int | None = None, + padding_side: str | None = None, + return_tensors: bool | None = None, + return_token_type_ids: bool | None = None, + return_attention_mask: bool | None = None, + return_overflowing_tokens: bool = False, + return_special_tokens_mask: bool = False, + return_offsets_mapping: bool = False, + return_length: bool = False, + verbose: bool = True, + split_special_tokens: bool | None = None, + **kwargs, + ) -> BatchEncoding: + # Input validation (from _call_one) + def _is_valid_text_input(t): + if isinstance(t, str): + return True + elif isinstance(t, (list, tuple)): + if len(t) == 0: + return True + elif isinstance(t[0], str): + return True + elif isinstance(t[0], (list, tuple)): + if len(t[0]) == 0 or isinstance(t[0][0], str): + return True + elif isinstance(t[0][0], (list, tuple)): + return len(t[0][0]) == 0 or isinstance(t[0][0][0], str) + else: + return False + else: + return False + else: + return False + + if not _is_valid_text_input(text): + raise ValueError( + "text input must be of type `str` (single example), `list[str]` (batch or single pretokenized example) " + "or `list[list[str]]` (batch of pretokenized examples) or `list[tuple[list[str], list[str]]]` (batch of pretokenized sequence pairs)." + ) + + if text_pair is not None and not _is_valid_text_input(text_pair): + raise ValueError( + "text input must be of type `str` (single example), `list[str]` (batch or single pretokenized example) " + "or `list[list[str]]` (batch of pretokenized examples) or `list[tuple[list[str], list[str]]]` (batch of pretokenized sequence pairs)." + ) + + # Batch detection (from _call_one) + if is_split_into_words: + is_batched = isinstance(text, (list, tuple)) and text and isinstance(text[0], (list, tuple)) + else: + is_batched = isinstance(text, (list, tuple)) + + if is_batched: + # Batch validation + if isinstance(text_pair, str): + raise TypeError( + "when tokenizing batches of text, `text_pair` must be a list or tuple with the same length as" + " `text`." + ) + if text_pair is not None and len(text) != len(text_pair): + raise ValueError( + f"batch length of `text`: {len(text)} does not match batch length of `text_pair`:" + f" {len(text_pair)}." + ) + batch_text_or_text_pairs = list(zip(text, text_pair)) if text_pair is not None else text + else: + # Single input - convert to batch format + batch_text_or_text_pairs = [(text, text_pair)] if text_pair else [text] + + # Set tokenizer configuration (from _batch_encode_plus) + if not isinstance(batch_text_or_text_pairs, (tuple, list)): + raise TypeError( + f"batch_text_or_text_pairs has to be a list or a tuple (got {type(batch_text_or_text_pairs)})" + ) + + self.set_truncation_and_padding( + padding_strategy=padding_strategy, + truncation_strategy=truncation_strategy, + max_length=max_length, + stride=stride, + pad_to_multiple_of=pad_to_multiple_of, + padding_side=padding_side, + ) + + # Use self.split_special_tokens as default if not explicitly provided + if split_special_tokens is None: + split_special_tokens = self.split_special_tokens + + if self._tokenizer.encode_special_tokens != split_special_tokens: + self._tokenizer.encode_special_tokens = split_special_tokens + + # Direct rust backend call + encodings = self._tokenizer.encode_batch( + batch_text_or_text_pairs, + add_special_tokens=add_special_tokens, + is_pretokenized=is_split_into_words, + ) + + # Convert encodings to BatchEncoding format + tokens_and_encodings = [ + self._convert_encoding( + encoding=encoding, + return_token_type_ids=return_token_type_ids, + return_attention_mask=return_attention_mask, + return_overflowing_tokens=return_overflowing_tokens, + return_special_tokens_mask=return_special_tokens_mask, + return_offsets_mapping=return_offsets_mapping, + return_length=return_length, + verbose=verbose, + ) + for encoding in encodings + ] + + # Convert the output to have dict[list] from list[dict] + sanitized_tokens = {} + for key in tokens_and_encodings[0][0]: + stack = [e for item, _ in tokens_and_encodings for e in item[key]] + sanitized_tokens[key] = stack + sanitized_encodings = [e for _, item in tokens_and_encodings for e in item] + + # If returning overflowing tokens, we need to return a mapping + if return_overflowing_tokens: + overflow_to_sample_mapping = [] + for i, (toks, _) in enumerate(tokens_and_encodings): + overflow_to_sample_mapping += [i] * len(toks["input_ids"]) + sanitized_tokens["overflow_to_sample_mapping"] = overflow_to_sample_mapping + + for input_ids in sanitized_tokens["input_ids"]: + self._eventual_warn_about_too_long_sequence(input_ids, max_length, verbose) + + batched_output = BatchEncoding(sanitized_tokens, sanitized_encodings, tensor_type=return_tensors) + + # If single input, remove the batch dimension (unless returning overflowing tokens) + if not is_batched and return_tensors is None and not return_overflowing_tokens: + batched_output = BatchEncoding( + { + key: (value[0] if len(value) > 0 and isinstance(value[0], list) else value) + for key, value in batched_output.items() + }, + batched_output.encodings, + ) + + return batched_output + + def convert_tokens_to_string(self, tokens: list[str]) -> str: + return ( + self.backend_tokenizer.decoder.decode(tokens) + if self.backend_tokenizer.decoder is not None + else " ".join(tokens) + ) + + def _decode( + self, + token_ids: int | list[int], + skip_special_tokens: bool = False, + clean_up_tokenization_spaces: bool | None = None, + **kwargs, + ) -> str: + # Removed: use_source_tokenizer parameter (unused) + kwargs.pop("use_source_tokenizer", None) # Pop if present to avoid errors + + if isinstance(token_ids, int): + token_ids = [token_ids] + if isinstance(token_ids, dict): + token_ids = token_ids["input_ids"] + text = self._tokenizer.decode(token_ids, skip_special_tokens=skip_special_tokens) + + clean_up_tokenization_spaces = ( + clean_up_tokenization_spaces + if clean_up_tokenization_spaces is not None + else self.clean_up_tokenization_spaces + ) + if clean_up_tokenization_spaces: + # Call custom cleanup method if it exists + if hasattr(self, "clean_up_tokenization") and callable(self.clean_up_tokenization): + text = self.clean_up_tokenization(text) + else: + # Apply standard cleanup + text = ( + text.replace(" .", ".") + .replace(" ?", "?") + .replace(" !", "!") + .replace(" ,", ",") + .replace(" ' ", "'") + .replace(" n't", "n't") + .replace(" 'm", "'m") + .replace(" 's", "'s") + .replace(" 've", "'ve") + .replace(" 're", "'re") + ) + + return text + + def _save_pretrained( + self, + save_directory: str | os.PathLike, + file_names: tuple[str, ...], + legacy_format: bool | None = None, + filename_prefix: str | None = None, + ) -> tuple[str, ...]: + save_directory = str(save_directory) + + tokenizer_file = os.path.join( + save_directory, (filename_prefix + "-" if filename_prefix else "") + TOKENIZER_FILE + ) + self.backend_tokenizer.save(tokenizer_file) + file_names = file_names + (tokenizer_file,) + + return file_names + + def train_new_from_iterator( + self, + text_iterator, + vocab_size, + length=None, + new_special_tokens=None, + special_tokens_map=None, + **kwargs, + ): + """ + Trains a tokenizer on a new corpus with the same defaults (in terms of special tokens or tokenization pipeline) + as the current one. + + Args: + text_iterator (generator of `list[str]`): + The training corpus. Should be a generator of batches of texts, for instance a list of lists of texts + if you have everything in memory. + vocab_size (`int`): + The size of the vocabulary you want for your tokenizer. + length (`int`, *optional*): + The total number of sequences in the iterator. This is used to provide meaningful progress tracking + new_special_tokens (list of `str` or `AddedToken`, *optional*): + A list of new special tokens to add to the tokenizer you are training. + special_tokens_map (`dict[str, str]`, *optional*): + If you want to rename some of the special tokens this tokenizer uses, pass along a mapping old special + token name to new special token name in this argument. + kwargs (`dict[str, Any]`, *optional*): + Additional keyword arguments passed along to the trainer from the 🤗 Tokenizers library. + + Returns: + [`PreTrainedTokenizerFast`]: A new tokenizer of the same type as the original one, trained on + `text_iterator`. + + """ + tokenizer_json = json.loads(self._tokenizer.to_str()) + # Remove added tokens for now (uses IDs of tokens) + added_tokens = tokenizer_json.pop("added_tokens") + # Remove post processor for now (uses IDs of tokens) + post_processor = tokenizer_json.pop("post_processor") + + unk_token = None + # Remove vocab + if tokenizer_json["model"]["type"] == "BPE": + tokenizer_json["model"]["vocab"] = {} + tokenizer_json["model"]["merges"] = [] + elif tokenizer_json["model"]["type"] == "Unigram": + if tokenizer_json["model"]["unk_id"] is not None: + unk_id = tokenizer_json["model"]["unk_id"] + unk_token = tokenizer_json["model"]["vocab"][unk_id][0] + if special_tokens_map is not None and unk_token in special_tokens_map: + unk_token = special_tokens_map[unk_token] + tokenizer_json["model"]["unk_id"] = 0 + tokenizer_json["model"]["vocab"] = [[unk_token, 0.0]] + elif tokenizer_json["model"]["type"] in ["WordLevel", "WordPiece"]: + tokenizer_json["model"]["vocab"] = {} + else: + raise ValueError( + f"This method does not support this type of tokenizer (found {tokenizer_json['model']['type']}) " + "only BPE, Unigram, WordLevel and WordPiece." + ) + + if ( + special_tokens_map is not None + and "unk_token" in tokenizer_json["model"] + and tokenizer_json["model"]["unk_token"] in special_tokens_map + ): + tokenizer_json["model"]["unk_token"] = special_tokens_map[tokenizer_json["model"]["unk_token"]] + + tokenizer = TokenizerFast.from_str(json.dumps(tokenizer_json)) + + # Get the special tokens from the current tokenizer if none are specified. + special_tokens = [] + for added_token in added_tokens: + special = added_token.pop("special", None) + _ = added_token.pop("id", None) + if tokenizer_json["model"]["type"] != "Unigram" and not special: + continue + if special_tokens_map is not None and added_token["content"] in special_tokens_map: + added_token["content"] = special_tokens_map[added_token["content"]] + special_tokens.append(AddedToken(**added_token)) + + if new_special_tokens is not None: + special_tokens.extend(new_special_tokens) + + # Trainer needs to know the end of word / continuing subword thingies in BPE + if ( + tokenizer_json["model"]["type"] == "BPE" + and "continuing_subword_prefix" not in kwargs + and tokenizer_json["model"]["continuing_subword_prefix"] is not None + ): + kwargs["continuing_subword_prefix"] = tokenizer_json["model"]["continuing_subword_prefix"] + if ( + tokenizer_json["model"]["type"] == "BPE" + and "end_of_word_suffix" not in kwargs + and tokenizer_json["model"]["end_of_word_suffix"] is not None + ): + kwargs["end_of_word_suffix"] = tokenizer_json["model"]["end_of_word_suffix"] + if tokenizer_json["model"]["type"] == "Unigram" and unk_token is not None: + kwargs["unk_token"] = unk_token + if tokenizer_json["pre_tokenizer"] is not None: + if ( + tokenizer_json["pre_tokenizer"]["type"] == "ByteLevel" + or tokenizer_json["pre_tokenizer"]["type"] == "Sequence" + and "pretokenizers" in tokenizer_json["pre_tokenizer"] + and any( + pretokenizer["type"] == "ByteLevel" + for pretokenizer in tokenizer_json["pre_tokenizer"]["pretokenizers"] + ) + ): + kwargs["initial_alphabet"] = pre_tokenizers_fast.ByteLevel.alphabet() + + trainer_class = MODEL_TO_TRAINER_MAPPING[tokenizer_json["model"]["type"]] + trainer = trainer_class(vocab_size=vocab_size, special_tokens=special_tokens, **kwargs) + tokenizer.train_from_iterator(text_iterator, length=length, trainer=trainer) + + if post_processor is not None: + trained_tokenizer_json = json.loads(tokenizer.to_str()) + # Almost done, we just have to adjust the token IDs in the post processor + if "special_tokens" in post_processor: + for key in post_processor["special_tokens"]: + tokens = post_processor["special_tokens"][key]["tokens"] + if special_tokens_map is not None: + tokens = [special_tokens_map.get(token, token) for token in tokens] + post_processor["special_tokens"][key]["tokens"] = tokens + for token in tokens: + token_id = tokenizer.token_to_id(token) + if token_id is None: + raise ValueError( + "Attempted to set a token in the post processor that does not exist in the mapping" + ) + + post_processor["special_tokens"][key]["ids"] = [tokenizer.token_to_id(token) for token in tokens] + + for special_token in ["cls", "sep"]: + if special_token in post_processor: + token, _ = post_processor[special_token] + if special_tokens_map is not None and token in special_tokens_map: + token = special_tokens_map[token] + token_id = tokenizer.token_to_id(token) + if token_id is None: + raise ValueError( + "Attempted to set a token in the post processor that does not exist in the mapping" + ) + post_processor[special_token] = [token, token_id] + + trained_tokenizer_json["post_processor"] = post_processor + tokenizer = TokenizerFast.from_str(json.dumps(trained_tokenizer_json)) + + kwargs = self.init_kwargs.copy() + # V5: Map pad/cls/mask token at the Transformers level (named tokens only) + for token in PreTrainedTokenizerBase.SPECIAL_TOKENS_ATTRIBUTES: + if getattr(self, token) is not None: + special_token = getattr(self, token) + if special_tokens_map is not None and special_token in special_tokens_map: + special_token = special_tokens_map[special_token] + + special_token_full = self._special_tokens_map.get(token, None) + if isinstance(special_token_full, AddedToken): + # Create an added token with the same parameters except the content + kwargs[token] = AddedToken( + special_token, + single_word=special_token_full.single_word, + lstrip=special_token_full.lstrip, + rstrip=special_token_full.rstrip, + normalized=special_token_full.normalized, + special=True, + ) + else: + kwargs[token] = special_token + + # V5: Handle extra special tokens + extra_special_tokens = self.extra_special_tokens.copy() if self.extra_special_tokens else [] + if new_special_tokens is not None: + extra_special_tokens.extend(new_special_tokens) + if len(extra_special_tokens) > 0: + kwargs["extra_special_tokens"] = extra_special_tokens + + # Always try to pass tokenizer_object in kwargs first (standard TokenizersBackend usage) + # If the class creates its own tokenizer and passes it explicitly to super().__init__(), + # this will cause a TypeError, which we catch and handle by removing tokenizer_object + # from kwargs and setting _tokenizer directly after initialization. + kwargs["tokenizer_object"] = tokenizer + try: + return self.__class__(**kwargs) + except TypeError as e: + # Check if the error is due to multiple values for tokenizer_object + if "multiple values for keyword argument 'tokenizer_object'" in str(e): + # Class creates its own tokenizer and passes it explicitly (like LayoutLMv3Tokenizer) + # Remove tokenizer_object from kwargs and set _tokenizer directly + kwargs.pop("tokenizer_object", None) + new_tokenizer = self.__class__(**kwargs) + new_tokenizer._tokenizer = tokenizer + return new_tokenizer + else: + # Some other TypeError, re-raise it + raise + + @classmethod + def _patch_mistral_regex( + cls, + tokenizer, + pretrained_model_name_or_path, + token=None, + cache_dir=None, + local_files_only=False, + _commit_hash=None, + is_local=False, + init_kwargs=None, + fix_mistral_regex=None, + **kwargs, + ): + """ + Patches mistral related tokenizers with incorrect regex if detected + 1) Local file with an associated config saved next to it + >> Model type one of the mistral models (on older versions) + 2) Remote models on the hub from official mistral models + >> Tags including `base_model:.*mistralai` + """ + import re + + from huggingface_hub import model_info + from packaging import version + + from transformers.utils.hub import cached_file + + def is_base_mistral(model_id: str) -> bool: + model = model_info(model_id) + if model.tags is not None: + if re.search("base_model:.*mistralai", "".join(model.tags)): + return True + return False + + if is_offline_mode(): + is_local = True + + if pretrained_model_name_or_path is not None and ( + is_local or (not is_local and is_base_mistral(pretrained_model_name_or_path)) + ): + _config_file = cached_file( + pretrained_model_name_or_path, + "config.json", + cache_dir=cache_dir, + token=token, + local_files_only=local_files_only, + _raise_exceptions_for_missing_entries=False, + _raise_exceptions_for_connection_errors=False, + _commit_hash=_commit_hash, + ) + + # Detected using a (local) mistral tokenizer + mistral_config_detected = False + if _config_file is not None: + with open(_config_file, encoding="utf-8") as f: + _config = json.load(f) + transformers_version = _config.get("transformers_version") + transformers_model_type = _config.get("model_type") + + # Detect if we can skip the mistral fix by + # a) having a non-mistral tokenizer + # b) fixed version of transformers + if transformers_version and version.parse(transformers_version) <= version.parse("4.57.2"): + if ( + is_local + and transformers_model_type is not None + and transformers_model_type + not in [ + "mistral", + "mistral3", + "voxtral", + "ministral", + "pixtral", + ] + ): + return tokenizer + elif transformers_version and version.parse(transformers_version) > version.parse("4.57.3"): + return tokenizer + + mistral_config_detected = True + + if mistral_config_detected or (not is_local and is_base_mistral(pretrained_model_name_or_path)): + # Expose the `fix_mistral_regex` flag on the tokenizer when provided, even if no correction is applied. + if init_kwargs and "fix_mistral_regex" in init_kwargs: + setattr(tokenizer, "fix_mistral_regex", init_kwargs["fix_mistral_regex"]) + + # only warn if its not explicitly passed + if fix_mistral_regex is None and not getattr(tokenizer, "fix_mistral_regex", False): + setattr(tokenizer, "fix_mistral_regex", False) + logger.warning( + f"The tokenizer you are loading from '{pretrained_model_name_or_path}'" + f" with an incorrect regex pattern: https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Instruct-2503/discussions/84#69121093e8b480e709447d5e." + " This will lead to incorrect tokenization. You should set the `fix_mistral_regex=True` flag when loading this tokenizer to fix this issue." + ) + elif fix_mistral_regex is True or getattr(tokenizer, "fix_mistral_regex", False): + setattr(tokenizer, "fix_mistral_regex", True) + import tokenizers + + split_pretokenizer = tokenizers.pre_tokenizers.Split( + pattern=tokenizers.Regex( + r"[^\r\n\p{L}\p{N}]?[\p{Lu}\p{Lt}\p{Lm}\p{Lo}\p{M}]*[\p{Ll}\p{Lm}\p{Lo}\p{M}]+|[^\r\n\p{L}\p{N}]?[\p{Lu}\p{Lt}\p{Lm}\p{Lo}\p{M}]+[\p{Ll}\p{Lm}\p{Lo}\p{M}]*|\p{N}| ?[^\s\p{L}\p{N}]+[\r\n/]*|\s*[\r\n]+|\s+(?!\S)|\s+" + ), + behavior="isolated", + ) + current_pretokenizer = tokenizer.backend_tokenizer.pre_tokenizer + # Check if it's already a Sequence + if isinstance(current_pretokenizer, tokenizers.pre_tokenizers.Sequence): + # Replace the first element (the Split pattern) + tokenizer.backend_tokenizer.pre_tokenizer[0] = split_pretokenizer + else: + # Replace Metaspace with ByteLevel when adding Split, as Metaspace(split=False) doesn't + # work correctly with the Split pre-tokenizer and causes spaces to be lost during encoding + if isinstance(current_pretokenizer, tokenizers.pre_tokenizers.Metaspace): + current_pretokenizer = tokenizers.pre_tokenizers.ByteLevel( + add_prefix_space=False, use_regex=False + ) + + # Not a Sequence, so create one with Split + current pretokenizer + tokenizer.backend_tokenizer.pre_tokenizer = tokenizers.pre_tokenizers.Sequence( + [ + split_pretokenizer, + current_pretokenizer, + ] + ) + + return tokenizer + + +# Backward-compatible alias: allow referring to TokenizersBackend as PreTrainedTokenizerFast +PreTrainedTokenizerFast = TokenizersBackend diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer.py new file mode 100644 index 0000000000000000000000000000000000000000..731c922db81f6d77139bfcc8bfad9f12b059febf --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer.py @@ -0,0 +1,4400 @@ +# Copyright 2020-present the HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +The Trainer class, to easily train a 🤗 Transformers from scratch or finetune it on a new task. +""" + +import contextlib +import functools +import glob +import inspect +import json +import math +import os +import random +import shutil +import sys +import tempfile +import time +import warnings +from collections.abc import Callable, Iterator, Mapping +from functools import partial +from pathlib import Path +from typing import TYPE_CHECKING, Any + + +# Integrations must be imported before ML frameworks: +# ruff: isort: off +from .integrations import ( + get_reporting_integration_callbacks, +) + +# ruff: isort: on + +import huggingface_hub.utils as hf_hub_utils +import numpy as np +import safetensors.torch +import torch +import torch.distributed as dist +from huggingface_hub import CommitInfo, ModelCard, create_repo, upload_folder +from packaging import version +from torch import nn +from torch.utils.data import DataLoader, Dataset, IterableDataset, RandomSampler, SequentialSampler + +from . import __version__ +from .configuration_utils import PreTrainedConfig +from .data.data_collator import DataCollator, DataCollatorWithPadding, default_data_collator +from .debug_utils import DebugOption, DebugUnderflowOverflow +from .feature_extraction_sequence_utils import SequenceFeatureExtractor +from .feature_extraction_utils import FeatureExtractionMixin +from .hyperparameter_search import ALL_HYPERPARAMETER_SEARCH_BACKENDS, default_hp_search_backend +from .image_processing_utils import BaseImageProcessor +from .integrations.deepspeed import ( + deepspeed_init, + deepspeed_load_checkpoint, + deepspeed_sp_compute_loss, + is_deepspeed_available, + propagate_args_to_deepspeed, +) +from .integrations.fsdp import get_fsdp_ckpt_kwargs, update_fsdp_plugin_peft +from .integrations.liger import apply_liger_kernel +from .integrations.neftune import activate_neftune, deactivate_neftune +from .integrations.peft import MIN_PEFT_VERSION +from .integrations.tpu import save_tpu_checkpoint, tpu_spmd_dataloader, wrap_model_xla_fsdp +from .modelcard import TrainingSummary +from .modeling_utils import PreTrainedModel, unwrap_model +from .models.auto.modeling_auto import ( + MODEL_FOR_CAUSAL_LM_MAPPING_NAMES, + MODEL_MAPPING_NAMES, +) +from .optimization import get_scheduler +from .processing_utils import ProcessorMixin +from .tokenization_utils_base import PreTrainedTokenizerBase +from .trainer_callback import ( + CallbackHandler, + DefaultFlowCallback, + ExportableState, + PrinterCallback, + ProgressCallback, + TrainerCallback, + TrainerControl, + TrainerState, +) +from .trainer_optimizer import ( + _OPTIMIZER_HANDLERS, + OptimizerContext, + _parse_optim_args, + is_optimizer_factory, +) +from .trainer_pt_utils import ( + EvalLoopContainer, + IterableDatasetShard, + LabelSmoother, + LengthGroupedSampler, + distributed_broadcast_scalars, + find_batch_size, + get_model_param_count, + get_parameter_names, + is_attention_mask_causal, + nested_detach, + nested_gather, + reissue_pt_warnings, + remove_dummy_checkpoint, + safe_globals, + set_rng_state_for_device, +) +from .trainer_utils import ( + PREFIX_CHECKPOINT_DIR, + BestRun, + EvalLoopOutput, + EvalPrediction, + HPSearchBackend, + HubStrategy, + PredictionOutput, + RemoveColumnsCollator, + SaveStrategy, + TrainerMemoryTracker, + TrainOutput, + _is_peft_model, + align_special_tokens, + compare_trainer_and_checkpoint_args, + default_compute_objective, + denumpify_detensorize, + enable_full_determinism, + find_executable_batch_size, + get_last_checkpoint, + has_length, + load_sharded_checkpoint, + number_of_arguments, + rotate_checkpoints, + seed_worker, + set_seed, + sort_checkpoints, + speed_metrics, + unwrap_peft_model, + validate_quantization_for_training, +) +from .training_args import OptimizerNames, ParallelMode, TrainingArguments +from .utils import ( + ADAPTER_CONFIG_NAME, + ADAPTER_SAFE_WEIGHTS_NAME, + ADAPTER_WEIGHTS_NAME, + CONFIG_NAME, + GENERATION_CONFIG_NAME, + SAFE_WEIGHTS_INDEX_NAME, + SAFE_WEIGHTS_NAME, + WEIGHTS_INDEX_NAME, + WEIGHTS_NAME, + XLA_FSDPV2_MIN_VERSION, + PushInProgress, + can_return_loss, + check_torch_load_is_safe, + find_labels, + is_accelerate_available, + is_datasets_available, + is_in_notebook, + is_peft_available, + is_sagemaker_dp_enabled, + is_sagemaker_mp_enabled, + is_torch_hpu_available, + is_torch_mlu_available, + is_torch_musa_available, + is_torch_neuroncore_available, + is_torch_npu_available, + is_torch_xla_available, + logging, +) +from .utils.import_utils import requires +from .utils.quantization_config import QuantizationMethod + + +DEFAULT_CALLBACKS = [DefaultFlowCallback] +DEFAULT_PROGRESS_CALLBACK = ProgressCallback + +if is_in_notebook(): + from .utils.notebook import NotebookProgressCallback + + DEFAULT_PROGRESS_CALLBACK = NotebookProgressCallback + +if is_datasets_available(): + import datasets + +if is_torch_xla_available(): + import torch_xla.core.xla_model as xm + import torch_xla.debug.metrics as met + import torch_xla.runtime as xr + from torch_xla import __version__ as XLA_VERSION + + IS_XLA_FSDPV2_POST_2_2 = version.parse(XLA_VERSION) >= version.parse(XLA_FSDPV2_MIN_VERSION) + if IS_XLA_FSDPV2_POST_2_2: + import torch_xla.distributed.spmd as xs +else: + IS_XLA_FSDPV2_POST_2_2 = False + + +if is_sagemaker_mp_enabled(): + import smdistributed.modelparallel.torch as smp + + from .trainer_pt_utils import smp_forward_backward, smp_forward_only, smp_nested_concat + +if is_peft_available(): + from peft import PeftModel + +if is_accelerate_available(): + from accelerate import Accelerator, skip_first_batches + from accelerate.state import AcceleratorState + from accelerate.utils import ( + DataLoaderConfiguration, + DistributedDataParallelKwargs, + DistributedType, + GradientAccumulationPlugin, + load_fsdp_model, + load_fsdp_optimizer, + release_memory, + save_fsdp_model, + save_fsdp_optimizer, + ) + from accelerate.utils.memory import clear_device_cache + + if is_deepspeed_available(): + from accelerate.utils import DeepSpeedSchedulerWrapper + + +if TYPE_CHECKING: + import optuna + +logger = logging.get_logger(__name__) + + +# Name of the files used for checkpointing +TRAINING_ARGS_NAME = "training_args.bin" +TRAINER_STATE_NAME = "trainer_state.json" +OPTIMIZER_NAME = "optimizer.pt" +SCALER_NAME = "scaler.pt" +OPTIMIZER_NAME_BIN = "optimizer.bin" +SCHEDULER_NAME = "scheduler.pt" +FSDP_MODEL_NAME = "pytorch_model_fsdp" + + +@requires( + backends=( + "torch", + "accelerate", + ) +) +class Trainer: + """ + Trainer is a simple but feature-complete training and eval loop for PyTorch, optimized for 🤗 Transformers. + + Args: + model ([`PreTrainedModel`] or `torch.nn.Module`, *optional*): + The model to train, evaluate or use for predictions. If not provided, a `model_init` must be passed. + + + + [`Trainer`] is optimized to work with the [`PreTrainedModel`] provided by the library. You can still use + your own models defined as `torch.nn.Module` as long as they work the same way as the 🤗 Transformers + models. + + + + args ([`TrainingArguments`], *optional*): + The arguments to tweak for training. Will default to a basic instance of [`TrainingArguments`] with the + `output_dir` set to a directory named *tmp_trainer* in the current directory if not provided. + data_collator (`DataCollator`, *optional*): + The function to use to form a batch from a list of elements of `train_dataset` or `eval_dataset`. Will + default to [`default_data_collator`] if no `processing_class` is provided, an instance of + [`DataCollatorWithPadding`] otherwise if the processing_class is a feature extractor or tokenizer. + train_dataset (`torch.utils.data.Dataset` | `torch.utils.data.IterableDataset` | `datasets.Dataset`, *optional*): + The dataset to use for training. If it is a [`~datasets.Dataset`], columns not accepted by the + `model.forward()` method are automatically removed. + + Note that if it's a `torch.utils.data.IterableDataset` with some randomization and you are training in a + distributed fashion, your iterable dataset should either use a internal attribute `generator` that is a + `torch.Generator` for the randomization that must be identical on all processes (and the Trainer will + manually set the seed of this `generator` at each epoch) or have a `set_epoch()` method that internally + sets the seed of the RNGs used. + eval_dataset (`torch.utils.data.Dataset` | dict[str, `torch.utils.data.Dataset`] | `datasets.Dataset`, *optional*): + The dataset to use for evaluation. If it is a [`~datasets.Dataset`], columns not accepted by the + `model.forward()` method are automatically removed. If it is a dictionary, it will evaluate on each + dataset prepending the dictionary key to the metric name. + processing_class (`PreTrainedTokenizerBase` or `BaseImageProcessor` or `FeatureExtractionMixin` or `ProcessorMixin`, *optional*): + Processing class used to process the data. If provided, will be used to automatically process the inputs + for the model, and it will be saved along the model to make it easier to rerun an interrupted training or + reuse the fine-tuned model. + model_init (`Callable[[], PreTrainedModel]`, *optional*): + A function that instantiates the model to be used. If provided, each call to [`~Trainer.train`] will start + from a new instance of the model as given by this function. + + The function may have zero argument, or a single one containing the optuna/Ray Tune trial object, to + be able to choose different architectures according to hyper parameters (such as layer count, sizes of + inner layers, dropout probabilities etc). + compute_loss_func (`Callable`, *optional*): + A function that accepts the raw model outputs, labels, and the number of items in the entire accumulated + batch (batch_size * gradient_accumulation_steps) and returns the loss. For example, see the default [loss function](https://github.com/huggingface/transformers/blob/052e652d6d53c2b26ffde87e039b723949a53493/src/transformers/trainer.py#L3618) used by [`Trainer`]. + compute_metrics (`Callable[[EvalPrediction], Dict]`, *optional*): + The function that will be used to compute metrics at evaluation. Must take a [`EvalPrediction`] and return + a dictionary string to metric values. *Note* When passing TrainingArgs with `batch_eval_metrics` set to + `True`, your compute_metrics function must take a boolean `compute_result` argument. This will be triggered + after the last eval batch to signal that the function needs to calculate and return the global summary + statistics rather than accumulating the batch-level statistics + callbacks (List of [`TrainerCallback`], *optional*): + A list of callbacks to customize the training loop. Will add those to the list of default callbacks + detailed in [here](callback). + + If you want to remove one of the default callbacks used, use the [`Trainer.remove_callback`] method. + optimizers (`tuple[torch.optim.Optimizer, torch.optim.lr_scheduler.LambdaLR]`, *optional*, defaults to `(None, None)`): + A tuple containing the optimizer and the scheduler to use. Will default to an instance of [`AdamW`] on your + model and a scheduler given by [`get_linear_schedule_with_warmup`] controlled by `args`. + optimizer_cls_and_kwargs (`tuple[Type[torch.optim.Optimizer], dict[str, Any]]`, *optional*): + A tuple containing the optimizer class and keyword arguments to use. + Overrides `optim` and `optim_args` in `args`. Incompatible with the `optimizers` argument. + + Unlike `optimizers`, this argument avoids the need to place model parameters on the correct devices before initializing the Trainer. + preprocess_logits_for_metrics (`Callable[[torch.Tensor, torch.Tensor], torch.Tensor]`, *optional*): + A function that preprocess the logits right before caching them at each evaluation step. Must take two + tensors, the logits and the labels, and return the logits once processed as desired. The modifications made + by this function will be reflected in the predictions received by `compute_metrics`. + + Note that the labels (second parameter) will be `None` if the dataset does not have them. + + Important attributes: + + - **model** -- Always points to the core model. If using a transformers model, it will be a [`PreTrainedModel`] + subclass. + - **model_wrapped** -- Always points to the most external model in case one or more other modules wrap the + original model. This is the model that should be used for the forward pass. For example, under `DeepSpeed`, + the inner model is wrapped in `DeepSpeed` and then again in `torch.nn.DistributedDataParallel`. If the inner + model hasn't been wrapped, then `self.model_wrapped` is the same as `self.model`. + - **is_model_parallel** -- Whether or not a model has been switched to a model parallel mode (different from + data parallelism, this means some of the model layers are split on different GPUs). + - **place_model_on_device** -- Whether or not to automatically place the model on the device. Defaults to + `True` unless model parallel, DeepSpeed, FSDP, full fp16/bf16 eval, or SageMaker MP is active. Can be + overridden by subclassing `TrainingArguments` and overriding the `place_model_on_device` property. + - **is_in_train** -- Whether or not a model is currently running `train` (e.g. when `evaluate` is called while + in `train`) + + """ + + # Those methods are not used in Trainer itself but are available as methods for external use. + from .trainer_pt_utils import ( + get_learning_rates, + get_num_trainable_parameters, + get_optimizer_group, + log_metrics, + metrics_format, + save_metrics, + save_state, + ) + + # ---- Initialization & Validation ---- + + def __init__( + self, + model: PreTrainedModel | nn.Module | None = None, + args: TrainingArguments | None = None, + data_collator: DataCollator | None = None, + train_dataset: "Dataset | IterableDataset | datasets.Dataset | None" = None, + eval_dataset: "Dataset | dict[str, Dataset] | datasets.Dataset | None" = None, + processing_class: PreTrainedTokenizerBase + | BaseImageProcessor + | FeatureExtractionMixin + | ProcessorMixin + | None = None, + model_init: Callable[..., PreTrainedModel] | None = None, + compute_loss_func: Callable | None = None, + compute_metrics: Callable[[EvalPrediction], dict] | None = None, + callbacks: list[TrainerCallback] | None = None, + optimizers: tuple[torch.optim.Optimizer | None, torch.optim.lr_scheduler.LambdaLR | None] = (None, None), + optimizer_cls_and_kwargs: tuple[type[torch.optim.Optimizer], dict[str, Any]] | None = None, + preprocess_logits_for_metrics: Callable[[torch.Tensor, torch.Tensor], torch.Tensor] | None = None, + ): + # Init flow: + # 1. Args & seed – defaults, determinism + # 2. Accelerator & logging – accelerator, memory tracker, log level, device setup + # 3. Model resolution – model / model_init, Liger Kernel, quantization checks + # 4. Distributed strategy – model-parallel, FSDP, SageMaker MP flags + # 5. Device placement – move model to device, model wrapping + # 6. Model introspection – loss kwargs, label names, label smoother + # 7. Store init arguments – data, callables, optimizer, scheduler, validation + # 8. Callbacks – reporting integrations, JIT checkpoint, progress bar + # 9. Hub & output – repo init, output directory + # 10. Training state – TrainerState, TrainerControl, internal bookkeeping + # 11. Finalize – use_cache, XLA FSDPv2 mesh, memory tracker stop + + # ---- 1. Args & seed -------------------------------------------------------- + if args is None: + output_dir = "tmp_trainer" + logger.info(f"No `TrainingArguments` passed, using `output_dir={output_dir}`.") + args = TrainingArguments(output_dir=output_dir) + self.args = args + # Seed must be set before instantiating the model when using model_init + enable_full_determinism(self.args.seed) if self.args.full_determinism else set_seed(self.args.seed) + + # ---- 2. Accelerator & logging ---------------------------------------------- + # `create_accelerator_and_postprocess` reads self.model and self.args, + # and may set self.deepspeed — store temporary refs before calling it. + self.deepspeed = None + self.model = model + self.create_accelerator_and_postprocess() + + self._memory_tracker = TrainerMemoryTracker(self.args.skip_memory_metrics) + self._memory_tracker.start() + + log_level = args.get_process_log_level() + logging.set_verbosity(log_level) + + args._setup_devices # force device and distributed setup init explicitly + + # ---- 3. Model resolution ---------------------------------------------------- + if model is None: + if model_init is not None: + self.model_init = model_init + model = self.call_model_init() + else: + raise RuntimeError("`Trainer` requires either a `model` or `model_init` argument") + else: + if model_init is not None: + raise ValueError("`Trainer` requires either a `model` or `model_init` argument, but not both.") + self.model_init = model_init + + if model.__class__.__name__ in MODEL_MAPPING_NAMES: + raise ValueError( + f"The model you have picked ({model.__class__.__name__}) cannot be used as is for training: it only " + "computes hidden states and does not accept any labels. You should choose a model with a head " + "suitable for your task like any of the `AutoModelForXxx` listed at " + "https://huggingface.co/docs/transformers/model_doc/auto" + ) + + if self.args.use_liger_kernel: + apply_liger_kernel(model, self.args.liger_kernel_config) + + validate_quantization_for_training(model) + + # ---- 4. Distributed strategy ------------------------------------------------ + self.is_model_parallel = False + if getattr(model, "hf_device_map", None) is not None: + devices = [device for device in set(model.hf_device_map.values()) if device not in ["cpu", "disk"]] + if len(devices) > 1: + self.is_model_parallel = True + elif len(devices) == 1: + self.is_model_parallel = self.args.device != torch.device(devices[0]) + + self.is_fsdp_xla_enabled = args.fsdp_config["xla"] + if len(args.fsdp) > 0: + if self.is_deepspeed_enabled: + raise ValueError( + "Using --fsdp xxx together with --deepspeed is not possible, deactivate one of those flags." + ) + if not args.fsdp_config["xla"] and args.parallel_mode != ParallelMode.DISTRIBUTED: + raise ValueError("Using fsdp only works in distributed training.") + + # Postpone switching model to cuda when MP, DeepSpeed, full bf16/fp16 eval, or FSDP + if args.place_model_on_device is not None: + self.place_model_on_device = args.place_model_on_device + elif ( + self.is_model_parallel + or self.is_deepspeed_enabled + or (args.fp16_full_eval or args.bf16_full_eval) + or self.is_fsdp_xla_enabled + or self.is_fsdp_enabled + or is_sagemaker_mp_enabled() + ): + self.place_model_on_device = False + else: + self.place_model_on_device = True + + # ---- 5. Device placement ---------------------------------------------------- + # Bnb Quantized models don't support `.to` operation. + if ( + self.place_model_on_device + and getattr(model, "quantization_method", None) != QuantizationMethod.BITS_AND_BYTES + ): + self._move_model_to_device(model, args.device) + + # Force n_gpu to 1 to avoid DataParallel as MP will manage the GPUs + if self.is_model_parallel: + self.args._n_gpu = 1 + + # `self.model is self.model_wrapped` is used later to check if it's wrapped + self.model_wrapped = model + self.model = model + + # ---- 6. Model introspection ------------------------------------------------- + unwrapped_model = unwrap_peft_model(self.accelerator.unwrap_model(model)) + + if hasattr(unwrapped_model, "accepts_loss_kwargs"): + self.model_accepts_loss_kwargs = unwrapped_model.accepts_loss_kwargs + else: + forward_params = inspect.signature(unwrapped_model.forward).parameters + self.model_accepts_loss_kwargs = any( + k.kind == inspect.Parameter.VAR_KEYWORD for k in forward_params.values() + ) + + # Sequence Parallelism computes its own good_tokens count + pc = getattr(self.accelerator, "parallelism_config", None) + if pc is not None and pc.sp_backend == "deepspeed" and pc.sp_enabled: + self.model_accepts_loss_kwargs = False + + model_to_inspect = unwrap_peft_model(self.model) + default_label_names = find_labels(model_to_inspect.__class__) + self.label_names = default_label_names if self.args.label_names is None else self.args.label_names + self.can_return_loss = can_return_loss(model_to_inspect.__class__) + + if self.args.label_smoothing_factor != 0: + if getattr(self.model.config, "problem_type", None) == "multi_label_classification": + warnings.warn( + "Label smoothing is not compatible with multi-label classification. " + "Disabling label smoothing for this training run.", + UserWarning, + ) + self.label_smoother = None + else: + self.label_smoother = LabelSmoother(epsilon=self.args.label_smoothing_factor) + else: + self.label_smoother = None + + # ---- 7. Store init arguments ------------------------------------------------ + # Data + default_collator = ( + DataCollatorWithPadding(processing_class) + if processing_class is not None + and isinstance(processing_class, (PreTrainedTokenizerBase, SequenceFeatureExtractor)) + else default_data_collator + ) + self.data_collator = data_collator if data_collator is not None else default_collator + self.train_dataset = train_dataset + self.eval_dataset = eval_dataset + self.processing_class = processing_class + self.neftune_noise_alpha = args.neftune_noise_alpha + + # Callables + self.compute_loss_func = compute_loss_func + self.compute_metrics = compute_metrics + self.preprocess_logits_for_metrics = preprocess_logits_for_metrics + + # Optimizer & scheduler + self.optimizer, self.lr_scheduler = optimizers + self.optimizer_cls_and_kwargs = optimizer_cls_and_kwargs + + self._validate_args() + + # ---- 8. Callbacks ----------------------------------------------------------- + default_callbacks = DEFAULT_CALLBACKS + get_reporting_integration_callbacks(self.args.report_to) + + if self.args.enable_jit_checkpoint: + from .trainer_jit_checkpoint import JITCheckpointCallback + + jit_callback = JITCheckpointCallback() + default_callbacks = default_callbacks + [jit_callback] + jit_callback.set_trainer(self) + + callbacks = default_callbacks if callbacks is None else default_callbacks + callbacks + self.callback_handler = CallbackHandler( + callbacks, self.model, self.processing_class, self.optimizer, self.lr_scheduler + ) + self.add_callback(PrinterCallback if self.args.disable_tqdm else DEFAULT_PROGRESS_CALLBACK) + + # ---- 9. Hub & output --------------------------------------------------------- + self.hub_model_id = None # Set by init_hf_repo() when push_to_hub is enabled + if self.args.push_to_hub: + self.init_hf_repo() + if self.args.should_save: + os.makedirs(self.args.output_dir, exist_ok=True) + + # ---- 10. Training state ----------------------------------------------------- + self.control = TrainerControl() + self.state = TrainerState( + is_local_process_zero=self.is_local_process_zero(), + is_world_process_zero=self.is_world_process_zero(), + stateful_callbacks=[ + cb for cb in self.callback_handler.callbacks + [self.control] if isinstance(cb, ExportableState) + ], + ) + self.is_in_train = False # True between train() entry and exit + self.hp_name = None # Set by hyperparameter_search() to label the trial + self.hp_search_backend = None # Set by hyperparameter_search() (optuna / ray / wandb) + # Per-process FLOP counter; accumulated into self.state.total_flos then reset + self.current_flos = 0 + # Set True by _setup_loggers() on first call to self.log() + self._loggers_initialized = False + # Lazily filled by _set_signature_columns_if_needed(); caches model.forward param names + self._signature_columns = None + # Effective batch size; may be reduced by find_executable_batch_size + self._train_batch_size = args.train_batch_size + # Guards one-time LR scheduler creation in create_optimizer_and_scheduler + self._created_lr_scheduler = False + + self.control = self.callback_handler.on_init_end(self.args, self.state, self.control) + + # ---- 11. Finalize ----------------------------------------------------------- + if getattr(self.model, "config", None) is not None: + self.model.config.use_cache = self.args.use_cache + + self.is_fsdp_xla_v2_enabled = args.fsdp_config.get("xla_fsdp_v2", False) + if self.is_fsdp_xla_v2_enabled: + if not IS_XLA_FSDPV2_POST_2_2: + raise ValueError("FSDPv2 requires `torch_xla` 2.2 or higher.") + num_devices = xr.global_runtime_device_count() + xs.set_global_mesh(xs.Mesh(np.array(range(num_devices)), (num_devices, 1), axis_names=("fsdp", "tensor"))) + self.is_fsdp_xla_v1_enabled = self.is_fsdp_xla_enabled and not self.is_fsdp_xla_v2_enabled + + self._memory_tracker.stop_and_update_metrics() + + def _validate_args(self) -> None: + """Validate constructor arguments and fail fast on incompatible combinations.""" + args = self.args + + # --- SageMaker Model Parallel mixed-precision validation --- + if is_sagemaker_mp_enabled(): + if args.bf16: + raise ValueError("SageMaker Model Parallelism does not support BF16 yet. Please use FP16 instead ") + if args.fp16 != smp.state.cfg.fp16: + logger.warning( + f"FP16 provided in SM_HP_MP_PARAMETERS is {smp.state.cfg.fp16}, " + f"but FP16 provided in trainer argument is {args.fp16}, " + f"setting to {smp.state.cfg.fp16}" + ) + args.fp16 = smp.state.cfg.fp16 + + # --- Training-argument validations --- + if args.batch_eval_metrics and self.compute_metrics is not None: + if "compute_result" not in inspect.signature(self.compute_metrics).parameters: + raise ValueError( + "When using `batch_eval_metrics`, your `compute_metrics` function must take a `compute_result`" + " boolean argument which will be triggered after the last batch of the eval set to signal that the" + " summary statistics should be returned by the function." + ) + if args.eval_strategy is not None and args.eval_strategy != "no" and self.eval_dataset is None: + raise ValueError( + f"You have set `args.eval_strategy` to {args.eval_strategy} but you didn't pass an `eval_dataset` to `Trainer`. Either set `args.eval_strategy` to `no` or pass an `eval_dataset`. " + ) + if args.save_strategy == SaveStrategy.BEST or args.load_best_model_at_end: + if args.metric_for_best_model is None: + raise ValueError( + "`args.metric_for_best_model` must be provided when using 'best' save_strategy or if `args.load_best_model_at_end` is set to `True`." + ) + + # --- Optimizer validations --- + if self.optimizer_cls_and_kwargs is not None and self.optimizer is not None: + raise RuntimeError("Passing both `optimizers` and `optimizer_cls_and_kwargs` arguments is incompatible.") + if self.model_init is not None and (self.optimizer is not None or self.lr_scheduler is not None): + raise RuntimeError( + "Passing a `model_init` is incompatible with providing the `optimizers` argument. " + "You should subclass `Trainer` and override the `create_optimizer_and_scheduler` method." + ) + if is_torch_xla_available() and self.optimizer is not None: + for param in self.model.parameters(): + model_device = param.device + break + for param_group in self.optimizer.param_groups: + if len(param_group["params"]) > 0: + optimizer_device = param_group["params"][0].device + break + if model_device != optimizer_device: + raise ValueError( + "The model and the optimizer parameters are not on the same device, which probably means you" + " created an optimizer around your model **before** putting on the device and passing it to the" + " `Trainer`. Make sure the lines `import torch_xla.core.xla_model as xm` and" + " `model.to(xm.xla_device())` is performed before the optimizer creation in your script." + ) + if (self.is_fsdp_xla_enabled or self.is_fsdp_enabled) and ( + self.optimizer is not None or self.lr_scheduler is not None + ): + raise RuntimeError( + "Passing `optimizers` is not allowed if PyTorch FSDP is enabled. " + "You should subclass `Trainer` and override the `create_optimizer_and_scheduler` method." + ) + + # --- Dataset validations --- + if not callable(self.data_collator) and callable(getattr(self.data_collator, "collate_batch", None)): + raise TypeError("The `data_collator` should be a simple callable (function, class with `__call__`).") + if args.max_steps > 0 and args.num_train_epochs > 0: + logger.info("max_steps is given, it will override any value given in num_train_epochs") + if self.train_dataset is not None and not has_length(self.train_dataset) and args.max_steps <= 0: + raise ValueError( + "The train_dataset does not implement __len__, max_steps has to be specified. " + "The number of steps needs to be known in advance for the learning rate scheduler." + ) + + if self.train_dataset is not None and isinstance(self.train_dataset, torch.utils.data.IterableDataset): + logger.info( + f"The `train_sampling_strategy='{args.train_sampling_strategy}'` option is ignored when using an `IterableDataset`. " + "Samplers cannot be used with IterableDataset as they require indexed access to the dataset." + ) + + def _build_accelerator_args(self, **kwargs) -> dict[str, Any]: + """Helper method to build accelerator-specific keyword arguments.""" + args = { + "mixed_precision": self.args.mixed_precision, + "deepspeed_plugin": self.args.deepspeed_plugin, + } + args.update(kwargs) + + # We defer compatibility checks to accelerator + if self.args.parallelism_config is not None: + min_accelerate_version = "1.12.0" + if not is_accelerate_available(min_accelerate_version): + raise ImportError( + f"ParallelismConfig requires accelerate>={min_accelerate_version}). Please upgrade accelerate to use this feature." + ) + args["parallelism_config"] = self.args.parallelism_config + + self.is_tp_enabled = False + if getattr(self.model, "tp_size", None) is not None and self.model.tp_size > 1: + self.is_tp_enabled = True + if self.args.parallelism_config is None: + if is_accelerate_available("1.12.0"): + if self.args.parallelism_config is None: + from accelerate import ParallelismConfig + + args["parallelism_config"] = ParallelismConfig(tp_size=self.model.tp_size) + else: + raise ValueError("Requires accelerate>1.12.0 to use Tensor Parallelism.") + elif args["parallelism_config"].tp_size != self.model.tp_size: + args["parallelism_config"].tp_size = self.model.tp_size + + if is_accelerate_available("1.2.0"): + # it we don't have the correct version, we will rely on env var instead that were set in TrainingArguments + from accelerate.utils import TorchDynamoPlugin + + dynamo_plugin = TorchDynamoPlugin( + backend=self.args.torch_compile_backend, mode=self.args.torch_compile_mode + ) + args["dynamo_plugin"] = dynamo_plugin + + return args + + def create_accelerator_and_postprocess(self) -> None: + """Create the accelerator and perform post-creation setup (FSDP, DeepSpeed, etc.).""" + # We explicitly don't rely on the `Accelerator` to do gradient accumulation + grad_acc_kwargs = {} + if self.args.accelerator_config.gradient_accumulation_kwargs is not None: + grad_acc_kwargs = self.args.accelerator_config.gradient_accumulation_kwargs + + # check if num_steps is attempted to be passed in gradient_accumulation_kwargs + if "num_steps" in grad_acc_kwargs: + if self.args.gradient_accumulation_steps > 1: + # raise because we do not know which setting is intended. + raise ValueError( + "The `AcceleratorConfig`'s `num_steps` is set but `gradient_accumulation_steps` is greater than 1 in the passed `TrainingArguments`" + "If using the passed `AcceleratorConfig` is desired, do not set the `TrainingArguments` `gradient_accumulation_steps`." + ) + else: + self.args.gradient_accumulation_steps = grad_acc_kwargs["num_steps"] + else: + grad_acc_kwargs["num_steps"] = self.args.gradient_accumulation_steps + + # Just making sure that gradient_state have the correct values passed. + # We don't rely on `accumulate` from accelerate to set sync_gradients in gradient_state. + # Rather, we do it ourselves by setting self.accelerator.gradient_state._set_sync_gradients. + gradient_accumulation_plugin = GradientAccumulationPlugin(**grad_acc_kwargs) + + accelerator_config = self.args.accelerator_config.to_dict() + + # Extract dataloader config params from accelerator config + dataloader_params = ["split_batches", "dispatch_batches", "even_batches", "use_seedable_sampler"] + dataloader_config = DataLoaderConfiguration( + **{param: accelerator_config.pop(param) for param in dataloader_params} + ) + dataloader_config.data_seed = self.args.data_seed + + non_blocking = accelerator_config.pop("non_blocking") + + if non_blocking and not self.args.dataloader_pin_memory: + logger.warning( + "`non_blocking` is enabled but `dataloader_pin_memory` is not. For the best performance, it's recommended to enable both." + ) + dataloader_config.non_blocking = non_blocking + # this would have been updated above, no need for it anymore + accelerator_config.pop("gradient_accumulation_kwargs") + + fsdp_plugin = None + if self.args.fsdp_plugin_args is not None: + from accelerate.utils import FullyShardedDataParallelPlugin + + fsdp_plugin = FullyShardedDataParallelPlugin(**self.args.fsdp_plugin_args) + + args = self._build_accelerator_args( + dataloader_config=dataloader_config, + fsdp_plugin=fsdp_plugin, + gradient_accumulation_plugin=gradient_accumulation_plugin, + ) + + # create accelerator object + self.accelerator = Accelerator(**args) + # some Trainer classes need to use `gather` instead of `gather_for_metrics`, thus we store a flag + self.gather_function = self.accelerator.gather_for_metrics + + if "use_gather_object" in inspect.signature(self.gather_function).parameters: + self.gather_function = functools.partial( + self.gather_function, use_gather_object=self.args.eval_use_gather_object + ) + + # deepspeed and accelerate flags covering both trainer args and accelerate launcher + self.is_deepspeed_enabled = getattr(self.accelerator.state, "deepspeed_plugin", None) is not None + self.is_fsdp_enabled = getattr(self.accelerator.state, "fsdp_plugin", None) is not None + + # post accelerator creation setup + if self.is_fsdp_enabled: + fsdp_plugin = self.accelerator.state.fsdp_plugin + for param in ["limit_all_gathers", "activation_checkpointing"]: + setattr(fsdp_plugin, param, self.args.fsdp_config.get(param, getattr(fsdp_plugin, param))) + if fsdp_plugin.activation_checkpointing and self.args.gradient_checkpointing: + raise ValueError( + "The activation_checkpointing in FSDP config and the gradient_checkpointing in training arg " + "can't be set to True simultaneously. Please use FSDP's activation_checkpointing logic " + "when using FSDP." + ) + + if self.is_deepspeed_enabled and getattr(self.args, "hf_deepspeed_config", None) is None: + propagate_args_to_deepspeed(self.accelerator, self.args) + + # `save_only_model` can't be used with DeepSpeed/FSDP along with `load_best_model_at_end` + if ( + self.args.save_only_model + and (self.is_deepspeed_enabled or self.is_fsdp_enabled) + and self.args.load_best_model_at_end + ): + wrapper = "DeepSpeed" if self.is_deepspeed_enabled else "FSDP" + raise ValueError(f"{wrapper} can't be used with `save_only_model` along with `load_best_model_at_end`.") + + # `auto_find_batch_size` isn't supported yet with DeepSpeed Zero-3 + if ( + self.is_deepspeed_enabled + and self.accelerator.state.deepspeed_plugin.zero_stage == 3 + and self.args.auto_find_batch_size + ): + raise ValueError( + "`auto_find_batch_size` isn't supported yet with DeepSpeed Zero-3. Please consider using Zero-2, Zero-1, or FSDP" + ) + if ( + self.args.save_only_model + and self.is_fsdp_enabled + and "SHARDED_STATE_DICT" in str(self.accelerator.state.fsdp_plugin.state_dict_type) + ): + raise ValueError("save_only_model option is not compatible with FSDP state dict type 'SHARDED_STATE_DICT'") + + # ---- Data Loading ---- + + def get_train_dataloader(self) -> DataLoader: + """ + Returns the training [`~torch.utils.data.DataLoader`]. + + Will use no sampler if `train_dataset` does not implement `__len__`, a random sampler (adapted to distributed + training if necessary) otherwise. + + Subclass and override this method if you want to inject some custom behavior. + """ + if self.train_dataset is None: + raise ValueError("Trainer: training requires a train_dataset.") + + return self._get_dataloader( + dataset=self.train_dataset, + description="Training", + batch_size=self._train_batch_size, + sampler_fn=self._get_train_sampler, + is_training=True, + ) + + def get_eval_dataloader(self, eval_dataset: str | Dataset | None = None) -> DataLoader: + """ + Returns the evaluation [`~torch.utils.data.DataLoader`]. + + Subclass and override this method if you want to inject some custom behavior. + + Args: + eval_dataset (`str` or `torch.utils.data.Dataset`, *optional*): + If a `str`, will use `self.eval_dataset[eval_dataset]` as the evaluation dataset. If a `Dataset`, will override `self.eval_dataset` and must implement `__len__`. If it is a [`~datasets.Dataset`], columns not accepted by the `model.forward()` method are automatically removed. + """ + if eval_dataset is None and self.eval_dataset is None: + raise ValueError("Trainer: evaluation requires an eval_dataset.") + + # If we have persistent workers, don't do a fork bomb especially as eval datasets + # don't change during training + dataloader_key = eval_dataset if isinstance(eval_dataset, str) else "eval" + if ( + hasattr(self, "_eval_dataloaders") + and dataloader_key in self._eval_dataloaders + and self.args.dataloader_persistent_workers + ): + return self._eval_dataloaders[dataloader_key] + + eval_dataset = ( + self.eval_dataset[eval_dataset] + if isinstance(eval_dataset, str) + else eval_dataset + if eval_dataset is not None + else self.eval_dataset + ) + + return self._get_dataloader( + dataset=eval_dataset, + description="Evaluation", + batch_size=self.args.eval_batch_size, + sampler_fn=self._get_eval_sampler, + dataloader_key=dataloader_key, + ) + + def get_test_dataloader(self, test_dataset: Dataset) -> DataLoader: + """ + Returns the test [`~torch.utils.data.DataLoader`]. + + Subclass and override this method if you want to inject some custom behavior. + + Args: + test_dataset (`torch.utils.data.Dataset`, *optional*): + The test dataset to use. If it is a [`~datasets.Dataset`], columns not accepted by the + `model.forward()` method are automatically removed. It must implement `__len__`. + """ + return self._get_dataloader( + dataset=test_dataset, + description="test", + batch_size=self.args.eval_batch_size, + sampler_fn=self._get_eval_sampler, + ) + + def num_examples(self, dataloader: DataLoader) -> int: + """ + Helper to get number of samples in a [`~torch.utils.data.DataLoader`] by accessing its dataset. When + dataloader.dataset does not exist or has no length, estimates as best it can + """ + try: + dataset = dataloader.dataset + # Special case for IterableDatasetShard, we need to dig deeper + if isinstance(dataset, IterableDatasetShard): + return len(dataloader.dataset.dataset) + return len(dataloader.dataset) + except (NameError, AttributeError, TypeError): # no dataset or length, estimate by length of dataloader + return len(dataloader) * self.args.per_device_train_batch_size + + def _get_dataloader( + self, + dataset: Dataset, + description: str, + batch_size: int, + sampler_fn: Callable[[Dataset], torch.utils.data.Sampler] | None = None, + is_training: bool = False, + dataloader_key: str | None = None, + ) -> DataLoader: + """Create a [`~torch.utils.data.DataLoader`] from the given dataset.""" + + data_collator = self.data_collator + if is_datasets_available() and isinstance(dataset, datasets.Dataset): + dataset = self._remove_unused_columns(dataset, description=description) + else: + data_collator = self._get_collator_with_removed_columns(self.data_collator, description=description) + + # MPS requrires forking if multiple workers are specified + should_fork = torch.backends.mps.is_available() and self.args.dataloader_num_workers > 1 + + dataloader_params = { + "batch_size": batch_size, + "collate_fn": data_collator, + "num_workers": self.args.dataloader_num_workers, + "pin_memory": self.args.dataloader_pin_memory, + "persistent_workers": self.args.dataloader_persistent_workers, + "multiprocessing_context": "fork" if should_fork else None, + } + + if not isinstance(dataset, torch.utils.data.IterableDataset): + if sampler_fn is not None: + dataloader_params["sampler"] = sampler_fn(dataset) + dataloader_params["drop_last"] = self.args.dataloader_drop_last + dataloader_params["prefetch_factor"] = self.args.dataloader_prefetch_factor + if is_training: + dataloader_params["worker_init_fn"] = partial( + seed_worker, num_workers=self.args.dataloader_num_workers, rank=self.args.process_index + ) + + dataloader = self.accelerator.prepare(DataLoader(dataset, **dataloader_params)) + + # Store the prepared dataloader for subsequent evaluations if using persistent workers. + if dataloader_key is not None and self.args.dataloader_persistent_workers: + if hasattr(self, "_eval_dataloaders"): + self._eval_dataloaders[dataloader_key] = dataloader + else: + self._eval_dataloaders = {dataloader_key: dataloader} + + return dataloader + + def _get_train_sampler(self, train_dataset: Dataset | None = None) -> torch.utils.data.Sampler | None: + """Return the training sampler based on `train_sampling_strategy`.""" + if train_dataset is None: + train_dataset = self.train_dataset + if train_dataset is None or not has_length(train_dataset): + return None + + # Build the sampler. + if self.args.train_sampling_strategy == "group_by_length": + if is_datasets_available() and isinstance(train_dataset, datasets.Dataset): + lengths = ( + train_dataset[self.args.length_column_name] + if self.args.length_column_name in train_dataset.column_names + else None + ) + else: + lengths = None + model_input_name = ( + self.processing_class.model_input_names[0] if self.processing_class is not None else None + ) + return LengthGroupedSampler( + self.args.train_batch_size * self.args.gradient_accumulation_steps, + dataset=train_dataset, + lengths=lengths, + model_input_name=model_input_name, + ) + elif self.args.train_sampling_strategy == "sequential": + return SequentialSampler(train_dataset) + else: + return RandomSampler(train_dataset) + + def _get_eval_sampler(self, eval_dataset: Dataset) -> torch.utils.data.Sampler | None: + """Return the evaluation sampler, using sequential ordering when not distributed.""" + if eval_dataset is None or not has_length(eval_dataset): + return None + + if self.args.train_sampling_strategy == "group_by_length": + if is_datasets_available() and isinstance(eval_dataset, datasets.Dataset): + lengths = ( + eval_dataset[self.args.length_column_name] + if self.args.length_column_name in eval_dataset.column_names + else None + ) + else: + lengths = None + model_input_name = ( + self.processing_class.model_input_names[0] if self.processing_class is not None else None + ) + return LengthGroupedSampler( + self.args.eval_batch_size, + dataset=eval_dataset, + lengths=lengths, + model_input_name=model_input_name, + ) + + if self.args.world_size <= 1: + return SequentialSampler(eval_dataset) + else: + return None + + def _set_signature_columns_if_needed(self) -> None: + """Populate `_signature_columns` from the model's forward signature if not already set.""" + if self._signature_columns is None: + # Inspect model forward signature to keep only the arguments it accepts. + model_to_inspect = self.model + if _is_peft_model(self.model): + if hasattr(self.model, "get_base_model"): + model_to_inspect = self.model.get_base_model() + else: + # PeftMixedModel do not provide a `get_base_model` method + model_to_inspect = self.model.base_model.model + signature = inspect.signature(model_to_inspect.forward) + self._signature_columns = list(signature.parameters.keys()) + # Labels may be named label or label_ids, the default data collator handles that. + self._signature_columns += list(set(["label", "label_ids"] + self.label_names)) + + def _remove_unused_columns( + self, dataset: "datasets.Dataset", description: str | None = None + ) -> "datasets.Dataset": + """Remove dataset columns not accepted by the model's forward method.""" + if not self.args.remove_unused_columns: + return dataset + self._set_signature_columns_if_needed() + signature_columns = self._signature_columns + + ignored_columns = list(set(dataset.column_names) - set(signature_columns)) + if len(ignored_columns) > 0: + dset_description = "" if description is None else f"in the {description} set" + logger.info( + f"The following columns {dset_description} don't have a corresponding argument in " + f"`{self.model.__class__.__name__}.forward` and have been ignored: {', '.join(ignored_columns)}." + f" If {', '.join(ignored_columns)} are not expected by `{self.model.__class__.__name__}.forward`, " + " you can safely ignore this message." + ) + + columns = [k for k in signature_columns if k in dataset.column_names] + if len(columns) == 0: + raise ValueError( + f"No columns in the dataset match the model's forward method signature: ({', '.join(signature_columns)}). " + f"The following columns have been ignored: [{', '.join(ignored_columns)}]. " + "Please check the dataset and model. You may need to set `remove_unused_columns=False` in `TrainingArguments`." + ) + + if version.parse(datasets.__version__) < version.parse("1.4.0"): + dataset.set_format( + type=dataset.format["type"], columns=columns, format_kwargs=dataset.format["format_kwargs"] + ) + return dataset + else: + return dataset.remove_columns(ignored_columns) + + def _get_collator_with_removed_columns(self, data_collator: Callable, description: str | None = None) -> Callable: + """Wrap the data collator in a callable removing unused columns.""" + if not self.args.remove_unused_columns: + return data_collator + self._set_signature_columns_if_needed() + signature_columns = self._signature_columns + + remove_columns_collator = RemoveColumnsCollator( + data_collator=data_collator, + signature_columns=signature_columns, + logger=logger, + description=description, + model_name=self.model.__class__.__name__, + ) + return remove_columns_collator + + # ---- Optimizer & Scheduler & Learning rate ---- + + def create_optimizer_and_scheduler(self, num_training_steps: int) -> None: + """ + Setup the optimizer and the learning rate scheduler. + + We provide a reasonable default that works well. If you want to use something else, you can pass a tuple in the + Trainer's init through `optimizers`, or subclass and override this method (or `create_optimizer` and/or + `create_scheduler`) in a subclass. + """ + self.create_optimizer() + self.create_scheduler(num_training_steps=num_training_steps) + + def create_optimizer(self) -> torch.optim.Optimizer: + """ + Setup the optimizer. + + We provide a reasonable default that works well. If you want to use something else, you can pass a tuple in the + Trainer's init through `optimizers`, or subclass and override this method in a subclass. + + Returns: + `torch.optim.Optimizer`: The optimizer instance. + """ + opt_model = self.model_wrapped if is_sagemaker_mp_enabled() else self.model + + if self.optimizer is None: + decay_parameters = self.get_decay_parameter_names(opt_model) + optimizer_grouped_parameters = [ + { + "params": [ + p for n, p in opt_model.named_parameters() if (n in decay_parameters and p.requires_grad) + ], + "weight_decay": self.args.weight_decay, + }, + { + "params": [ + p for n, p in opt_model.named_parameters() if (n not in decay_parameters and p.requires_grad) + ], + "weight_decay": 0.0, + }, + ] + + if self.optimizer_cls_and_kwargs is not None: + optimizer_cls, optimizer_kwargs = self.optimizer_cls_and_kwargs + else: + optimizer_cls, optimizer_kwargs = self.get_optimizer_cls_and_kwargs(self.args, opt_model) + + # Check if this is a factory (for complex optimizers like Muon, Dion) + # Factories are instantiated first, then called with (opt_model, **kwargs) + if is_optimizer_factory(optimizer_cls): + self.optimizer = optimizer_cls()(opt_model, **optimizer_kwargs) + else: + # Standard optimizer class instantiation + # Overwrite `params` in case it's created by `get_optimizer_cls_and_kwargs` + # e.g. for GaLore optimizer. + if "params" in optimizer_kwargs: + optimizer_grouped_parameters = optimizer_kwargs.pop("params") + + # Overwrite `model` in case it's created by `get_optimizer_cls_and_kwargs` + # e.g. for LOMO optimizer. + if "model" in optimizer_kwargs: + optimizer_grouped_parameters = optimizer_kwargs.pop("model") + + # For layer-wise dummy optimizers we overwrite optimizer_grouped_parameters with `optimizer_dict` + # to avoid arguments conflicts. + if "optimizer_dict" in optimizer_kwargs: + optimizer_grouped_parameters = optimizer_kwargs.pop("optimizer_dict") + + self.optimizer = optimizer_cls(optimizer_grouped_parameters, **optimizer_kwargs) + + if "bitsandbytes" in str(optimizer_cls) and optimizer_kwargs.get("optim_bits", None) == 8: + import bitsandbytes + + manager = bitsandbytes.optim.GlobalOptimManager.get_instance() + + skipped = 0 + for module in opt_model.modules(): + if isinstance(module, nn.Embedding): + skipped += sum({p.data_ptr(): p.numel() for p in module.parameters()}.values()) + logger.info(f"skipped {module}: {skipped / 2**20}M params") + manager.register_module_override(module, "weight", {"optim_bits": 32}) + logger.debug(f"bitsandbytes: will optimize {module} in fp32") + logger.info(f"skipped: {skipped / 2**20}M params") + + if is_sagemaker_mp_enabled(): + self.optimizer = smp.DistributedOptimizer(self.optimizer) + + return self.optimizer + + def create_scheduler( + self, num_training_steps: int, optimizer: torch.optim.Optimizer | None = None + ) -> torch.optim.lr_scheduler.LRScheduler: + """ + Setup the scheduler. The optimizer of the trainer must have been set up either before this method is called or + passed as an argument. + + Args: + num_training_steps (int): The number of training steps to do. + + Returns: + `torch.optim.lr_scheduler.LRScheduler`: The learning rate scheduler instance. + """ + if self.lr_scheduler is None: + if optimizer is None: + if is_sagemaker_mp_enabled() and smp.state.cfg.fp16: + # If fp16 is enabled, we unwrap the optimizer + optimizer = self.optimizer.optimizer + else: + optimizer = self.optimizer + self.lr_scheduler = get_scheduler( + self.args.lr_scheduler_type, + optimizer=optimizer, + num_warmup_steps=self.args.get_warmup_steps(num_training_steps), + num_training_steps=num_training_steps, + scheduler_specific_kwargs=self.args.lr_scheduler_kwargs, + ) + self._created_lr_scheduler = True + return self.lr_scheduler + + @staticmethod + def get_optimizer_cls_and_kwargs(args: TrainingArguments, model: PreTrainedModel | None = None) -> tuple[Any, Any]: + """ + Returns the optimizer class and optimizer parameters based on the training arguments. + + Args: + args (`transformers.training_args.TrainingArguments`): + The training arguments for the training session. + model (`PreTrainedModel`, *optional*): + The model being trained. Required for some optimizers (GaLore, Apollo, LOMO). + + Returns: + A tuple containing the optimizer class and a dictionary of optimizer keyword arguments. + """ + ctx = OptimizerContext( + args=args, + model=model, + optimizer_kwargs={"lr": args.learning_rate}, + adam_kwargs={ + "betas": (args.adam_beta1, args.adam_beta2), + "eps": args.adam_epsilon, + }, + optim_args=_parse_optim_args(args.optim_args), + ) + + handler = _OPTIMIZER_HANDLERS.get(args.optim) + if handler is None: + raise ValueError(f"Trainer cannot instantiate unsupported optimizer: {args.optim}") + + return handler(ctx) + + def get_decay_parameter_names(self, model: nn.Module) -> list[str]: + """ + Get all parameter names that weight decay will be applied to. + + This function filters out parameters in two ways: + 1. By layer type (instances of layers specified in ALL_LAYERNORM_LAYERS) + 2. By parameter name patterns (containing 'bias', or variation of 'norm') + """ + forbidden_name_patterns = [r"bias", r"layernorm", r"rmsnorm", r"(?:^|\.)norm(?:$|\.)", r"_norm(?:$|\.)"] + decay_parameters = get_parameter_names(model, [nn.LayerNorm], forbidden_name_patterns) + return decay_parameters + + def _get_learning_rate(self) -> float: + """ + Returns the current learning rate from the scheduler. + + Handles DeepSpeed's dynamic loss scaling warmup period where `get_last_lr` may fail. + """ + if self.is_deepspeed_enabled: + # with deepspeed's fp16 and dynamic loss scale enabled the optimizer/scheduler steps may + # not run for the first few dozen steps while loss scale is too large, and thus during + # that time `get_last_lr` will fail if called during that warm up stage, so work around it: + try: + last_lr = self.lr_scheduler.get_last_lr()[0] + except AssertionError as e: + if "need to call step" in str(e): + logger.warning("tried to get lr value before scheduler/optimizer started stepping, returning lr=0") + last_lr = 0 + else: + raise + else: + if isinstance(self.lr_scheduler, torch.optim.lr_scheduler.ReduceLROnPlateau): + last_lr = self.optimizer.param_groups[0]["lr"] + else: + last_lr = self.lr_scheduler.get_last_lr()[0] + + if torch.is_tensor(last_lr): + last_lr = last_lr.item() + return last_lr + + # ---- Training ---- + + def train( + self, + resume_from_checkpoint: str | bool | None = None, + trial: "optuna.Trial | dict[str, Any] | None" = None, + ignore_keys_for_eval: list[str] | None = None, + ) -> TrainOutput: + """ + Main training entry point. + + Args: + resume_from_checkpoint (`str` or `bool`, *optional*): + If a `str`, local path to a saved checkpoint as saved by a previous instance of [`Trainer`]. If a + `bool` and equals `True`, load the last checkpoint in *args.output_dir* as saved by a previous instance + of [`Trainer`]. If present, training will resume from the model/optimizer/scheduler states loaded here. + trial (`optuna.Trial` or `dict[str, Any]`, *optional*): + The trial run or the hyperparameter dictionary for hyperparameter search. + ignore_keys_for_eval (`list[str]`, *optional*) + A list of keys in the output of your model (if it is a dictionary) that should be ignored when + gathering predictions for evaluation during the training. + + Returns: + [`~trainer_utils.TrainOutput`]: Object containing the global step count, training loss, and metrics. + """ + if resume_from_checkpoint is False: + resume_from_checkpoint = None + + # memory metrics - must set up as early as possible + self._memory_tracker.start() + + args = self.args + + self.is_in_train = True + + # If the model uses a tokenizer, it may have a new tokens for fine-tuning purposes. + if isinstance(self.processing_class, (PreTrainedTokenizerBase, ProcessorMixin)) and hasattr( + self.model, "config" + ): + align_special_tokens(self.model, self.processing_class) + + # Attach NEFTune hooks if necessary + if self.neftune_noise_alpha is not None: + self.neftune_hook_handle = activate_neftune(self.model, self.neftune_noise_alpha, self.accelerator) + + # When fp16/bf16 full eval is enabled, __init__ skips device placement so that + # evaluation_loop can cast dtype and move in one step. Move the model now for training. + if (args.fp16_full_eval or args.bf16_full_eval) and not self.is_model_parallel and self.model_init is None: + self._move_model_to_device(self.model, args.device) + + # This might change the seed so needs to run first. + self._hp_search_setup(trial) + self._train_batch_size = self.args.train_batch_size + + # Model re-init + model_reloaded = False + if self.model_init is not None: + # Seed must be set before instantiating the model when using model_init. + enable_full_determinism(self.args.seed) if self.args.full_determinism else set_seed(self.args.seed) + self.model = self.call_model_init(trial) + model_reloaded = True + # Reinitializes optimizer and scheduler + self.optimizer, self.lr_scheduler = None, None + + # Load potential model checkpoint + if isinstance(resume_from_checkpoint, bool) and resume_from_checkpoint: + resume_from_checkpoint = get_last_checkpoint(args.output_dir) + if resume_from_checkpoint is None: + raise ValueError(f"No valid checkpoint found in output directory ({args.output_dir})") + + if resume_from_checkpoint is not None: + if not is_sagemaker_mp_enabled() and not self.is_deepspeed_enabled and not self.is_fsdp_enabled: + self._load_from_checkpoint(resume_from_checkpoint) + # In case of repeating the find_executable_batch_size, set `self._train_batch_size` properly + state = TrainerState.load_from_json(os.path.join(resume_from_checkpoint, TRAINER_STATE_NAME)) + # Only restore the checkpoint's train_batch_size when using auto_find_batch_size, + # as that feature needs to resume with the automatically-found batch size. + # Otherwise, use the current args batch size to allow users to change batch configuration. + if state.train_batch_size is not None and args.auto_find_batch_size: + self._train_batch_size = state.train_batch_size + + # If model was re-initialized, put it on the right device and update self.model_wrapped + if model_reloaded: + if self.place_model_on_device: + self._move_model_to_device(self.model, args.device) + self.model_wrapped = self.model + + inner_training_loop = find_executable_batch_size( + self._inner_training_loop, self._train_batch_size, args.auto_find_batch_size + ) + if args.push_to_hub: + try: + # Disable progress bars when uploading models during checkpoints to avoid polluting stdout + hf_hub_utils.disable_progress_bars() + return inner_training_loop( + args=args, + resume_from_checkpoint=resume_from_checkpoint, + trial=trial, + ignore_keys_for_eval=ignore_keys_for_eval, + ) + finally: + hf_hub_utils.enable_progress_bars() + else: + return inner_training_loop( + args=args, + resume_from_checkpoint=resume_from_checkpoint, + trial=trial, + ignore_keys_for_eval=ignore_keys_for_eval, + ) + + def _inner_training_loop( + self, + batch_size: int | None = None, + args: TrainingArguments | None = None, + resume_from_checkpoint: str | None = None, + trial: "optuna.Trial | dict[str, Any] | None" = None, + ignore_keys_for_eval: list[str] | None = None, + ) -> TrainOutput: + """Run the actual training loop: forward, backward, optimizer step, logging, and checkpointing.""" + self.accelerator.free_memory() + self._train_batch_size = batch_size + if self.args.auto_find_batch_size: + if self.state.train_batch_size != self._train_batch_size: + release_memory(self.model_wrapped) + self.model_wrapped = self.model + + # Check for DeepSpeed *after* the initial pass and modify the config + if self.is_deepspeed_enabled: + # Temporarily unset `self.args.train_batch_size` + original_bs = self.args.per_device_train_batch_size + self.args.per_device_train_batch_size = self._train_batch_size // max(1, self.args.n_gpu) + propagate_args_to_deepspeed(self.accelerator, self.args, auto_find_batch_size=True) + self.args.per_device_train_batch_size = original_bs + self.state.train_batch_size = self._train_batch_size + logger.debug(f"Currently training with a batch size of: {self._train_batch_size}") + # Data loader and number of training steps + train_dataloader = self.get_train_dataloader() + if self.is_fsdp_xla_v2_enabled: + train_dataloader = tpu_spmd_dataloader(train_dataloader) + + # Setting up training control variables: + # number of training epochs: num_train_epochs + # number of training steps per epoch: num_update_steps_per_epoch + # total number of training steps to execute: max_steps + total_train_batch_size = self.get_total_train_batch_size(args) + + ( + num_train_epochs, + num_update_steps_per_epoch, + num_examples, + num_train_samples, + epoch_based, + len_dataloader, + max_steps, + ) = self.set_initial_training_values(args, train_dataloader, total_train_batch_size) + + if DebugOption.UNDERFLOW_OVERFLOW in self.args.debug: + if self.args.n_gpu > 1: + # nn.DataParallel(model) replicates the model, creating new variables and module + # references registered here no longer work on other gpus, breaking the module + raise ValueError( + "Currently --debug underflow_overflow is not supported under DP. Please use DDP with torchrun" + ) + else: + DebugUnderflowOverflow(self.model) + + delay_optimizer_creation = is_sagemaker_mp_enabled() or self.is_fsdp_xla_enabled or self.is_fsdp_enabled + + # Can't delay optimizer creation when using FSDP2: https://github.com/huggingface/accelerate/blob/3f636d626063ffcf9a337c7d3624d61b7d187d59/src/accelerate/accelerator.py#L1404 + is_fsdp2 = self.is_fsdp_enabled and (getattr(self.accelerator.state.fsdp_plugin, "fsdp_version", 1) == 2) + if is_fsdp2: + delay_optimizer_creation = False + + # We need to reset the scheduler, as its parameters may be different on subsequent calls + if self._created_lr_scheduler: + self.lr_scheduler = None + self._created_lr_scheduler = False + + if self.is_deepspeed_enabled: + self.optimizer, self.lr_scheduler = deepspeed_init(self, num_training_steps=max_steps) + + if not delay_optimizer_creation: + self.create_optimizer() + + self.state = TrainerState( + stateful_callbacks=[ + cb for cb in self.callback_handler.callbacks + [self.control] if isinstance(cb, ExportableState) + ] + ) + self.state.is_hyper_param_search = trial is not None + self.state.train_batch_size = self._train_batch_size + + # Compute absolute values for logging, eval, and save if given as ratio + self.state.compute_steps(args, max_steps) + + # Activate gradient checkpointing if needed + if args.gradient_checkpointing: + self.model.gradient_checkpointing_enable(gradient_checkpointing_kwargs=args.gradient_checkpointing_kwargs) + + model = self._wrap_model(self.model_wrapped) + + # as the model is wrapped, don't use `accelerator.prepare` + # this is for unhandled cases such as + # FSDP-XLA, SageMaker MP/DP, DataParallel + use_accelerator_prepare = model is self.model + + if use_accelerator_prepare and self.is_fsdp_enabled: + # In case of auto_find_batch_size=True + # Remove FSDP wrapping from sub-models. + self.model = unwrap_model(self.model, recursive=True) + + if delay_optimizer_creation: + if use_accelerator_prepare: + # configure fsdp plugin for qlora if any + if self.is_fsdp_enabled and _is_peft_model(model): + update_fsdp_plugin_peft(self.model, self.accelerator) + if self.accelerator.mixed_precision != "fp8": + self.model = self.accelerator.prepare(self.model) + self.create_optimizer() + + # prepare using `accelerator` prepare + if use_accelerator_prepare: + self.model.train() + if self.is_deepspeed_enabled: + from accelerate.utils import DummyScheduler + + if isinstance(self.lr_scheduler, DummyScheduler): + model, self.optimizer, self.lr_scheduler = self.accelerator.prepare( + self.model, self.optimizer, self.lr_scheduler + ) + else: + model, self.optimizer = self.accelerator.prepare(self.model, self.optimizer) + else: + model, self.optimizer = self.accelerator.prepare(self.model, self.optimizer) + else: + self.optimizer = self.accelerator.prepare(self.optimizer) + + # Create scheduler now that the optimizer won't change anymore + self.create_scheduler(num_training_steps=max_steps) + + # since DataLoader was Accelerate prepared w/o a model arg in the same call, we now have to complete the DL wrapping for ALST/UlyssesSP, after model has been prepared + pc = getattr(self.accelerator, "parallelism_config", None) + if pc is not None and pc.sp_backend == "deepspeed" and pc.sp_enabled: + train_dataloader = self.accelerator.deepspeed_ulysses_dl_adapter(train_dataloader, model) + + if self.is_fsdp_enabled: + self.model = self.model_wrapped = model + # Fix `got mixed torch.Tensor and DTensor` error in model.generate() for FSDP2 with LoRA + if hasattr(self.model, "generate"): + dist.fsdp.register_fsdp_forward_method(self.model, "generate") + + # for the rest of this function `model` is the outside model, whether it was wrapped or not + if model is not self.model: + self.model_wrapped = model + + # backward compatibility + if self.is_deepspeed_enabled: + self.deepspeed = self.model_wrapped + + # ckpt loading + if resume_from_checkpoint is not None: + if self.is_deepspeed_enabled: + deepspeed_load_checkpoint( + self.model_wrapped, resume_from_checkpoint, load_module_strict=not _is_peft_model(self.model) + ) + elif is_sagemaker_mp_enabled() or self.is_fsdp_enabled: + self._load_from_checkpoint(resume_from_checkpoint, self.model_wrapped) + + # Check if saved optimizer or scheduler states exist + self._load_optimizer_and_scheduler(resume_from_checkpoint) + self._load_scaler(resume_from_checkpoint) + + # important: at this point: + # self.model is the Transformers Model + # self.model_wrapped is DDP(Transformers Model), Deepspeed(Transformers Model), + # FSDP(Transformers Model), Dynamo Optimized Module(Transformers Model) etc. + + # Train! + logger.info("***** Running training *****") + logger.info(f" Num examples = {num_examples:,}") + logger.info(f" Num Epochs = {num_train_epochs:,}") + logger.info(f" Instantaneous batch size per device = {self.args.per_device_train_batch_size:,}") + if self.args.per_device_train_batch_size != self._train_batch_size: + logger.info(f" Training with DataParallel so batch size has been adjusted to: {self._train_batch_size:,}") + logger.info(f" Total train batch size (w. parallel, distributed & accumulation) = {total_train_batch_size:,}") + logger.info(f" Gradient Accumulation steps = {args.gradient_accumulation_steps}") + logger.info(f" Total optimization steps = {max_steps:,}") + logger.info(f" Number of trainable parameters = {get_model_param_count(model, trainable_only=True):,}") + + self.state.epoch = 0 + start_time = time.time() + self.initial_num_input_tokens_seen_for_session = self.state.num_input_tokens_seen + epochs_trained = 0 + steps_trained_in_current_epoch = 0 + + # Check if continuing training from a checkpoint + if resume_from_checkpoint is not None and os.path.isfile( + os.path.join(resume_from_checkpoint, TRAINER_STATE_NAME) + ): + self.state = TrainerState.load_from_json(os.path.join(resume_from_checkpoint, TRAINER_STATE_NAME)) + compare_trainer_and_checkpoint_args(self.args, self.state) + self._load_callback_state() + epochs_trained = int(self.state.global_step // num_update_steps_per_epoch) + if not args.ignore_data_skip: + steps_trained_in_current_epoch = self.state.global_step % (num_update_steps_per_epoch) + steps_trained_in_current_epoch *= args.gradient_accumulation_steps + else: + steps_trained_in_current_epoch = 0 + + logger.info(" Continuing training from checkpoint, will skip to saved global_step") + logger.info(f" Continuing training from epoch {epochs_trained}") + logger.info(f" Continuing training from global step {self.state.global_step}") + if not args.ignore_data_skip: + logger.info( + f" Will skip the first {epochs_trained} epochs then the first" + f" {steps_trained_in_current_epoch} batches in the first epoch." + ) + + # Update the references + for attr in ("model", "optimizer", "lr_scheduler"): + setattr(self.callback_handler, attr, getattr(self, attr)) + self.callback_handler.train_dataloader = train_dataloader + + self.state.init_training_references(self, max_steps, num_train_epochs, trial) + + # tr_loss is a tensor to avoid synchronization of TPUs through .item() + tr_loss = torch.tensor(0.0, device=args.device) + # _total_loss_scalar is updated everytime .item() has to be called on tr_loss and stores the sum of all losses + self._total_loss_scalar = 0.0 + self._globalstep_last_logged = self.state.global_step + model.zero_grad() + grad_norm: float | None = None + learning_rate = None + self.control = self.callback_handler.on_train_begin(args, self.state, self.control) + + if args.eval_on_start: + self._evaluate(trial, ignore_keys_for_eval, skip_scheduler=True) + + for epoch in range(epochs_trained, num_train_epochs): + epoch_dataloader = train_dataloader + + steps_in_epoch = ( + len(epoch_dataloader) + if len_dataloader is not None + else args.max_steps * args.gradient_accumulation_steps + ) + self.control = self.callback_handler.on_epoch_begin(args, self.state, self.control) + + step = -1 + rng_to_sync = False + + # Handle resumption from checkpoint + if epoch == epochs_trained and resume_from_checkpoint is not None: + if steps_trained_in_current_epoch > 0 and not args.ignore_data_skip: + epoch_dataloader = skip_first_batches(epoch_dataloader, steps_trained_in_current_epoch) + step = steps_trained_in_current_epoch - 1 + rng_to_sync = True + elif steps_trained_in_current_epoch == 0: + self._load_rng_state(resume_from_checkpoint) + + if hasattr(epoch_dataloader, "set_epoch"): + epoch_dataloader.set_epoch(epoch) + + epoch_iterator = iter(epoch_dataloader) + # We chunkify the epoch iterator into gradient accumulation steps `n` batches + remainder = steps_in_epoch % args.gradient_accumulation_steps + if remainder == 0: + remainder = args.gradient_accumulation_steps + update_step = -1 + total_updates = steps_in_epoch // args.gradient_accumulation_steps + int( + remainder < args.gradient_accumulation_steps + ) + for _ in range(total_updates): + update_step += 1 + num_batches = args.gradient_accumulation_steps if update_step != (total_updates - 1) else remainder + batch_samples, num_items_in_batch = self.get_batch_samples(epoch_iterator, num_batches, args.device) + # Store the number of batches for current gradient accumulation + # This is used to correctly scale the loss when the last accumulation step has fewer batches + self.current_gradient_accumulation_steps = len(batch_samples) + for i, inputs in enumerate(batch_samples): + step += 1 + do_sync_step = (step + 1) % args.gradient_accumulation_steps == 0 or (step + 1) == steps_in_epoch + # Since we perform prefetching, we need to manually set sync_gradients + self.accelerator.gradient_state._set_sync_gradients(do_sync_step) + + if self.args.include_num_input_tokens_seen != "no": + main_input_name = getattr(self.model, "main_input_name", "input_ids") + if main_input_name not in inputs: + logger.warning( + "Tried to track the number of tokens seen, however the current model is " + "not configured properly to know what item is the input. To fix this, add " + "a `main_input_name` attribute to the model class you are using." + ) + else: + if self.args.include_num_input_tokens_seen == "non_padding": + if "attention_mask" in inputs: + input_tokens = inputs["attention_mask"].sum() + elif ( + self.processing_class is not None + and hasattr(self.processing_class, "pad_token_id") + and self.processing_class.pad_token_id is not None + ): + input_tokens = ( + inputs[main_input_name] != self.processing_class.pad_token_id + ).sum() + else: + logger.warning( + "Could not determine method to count non-padding tokens, falling back to counting all tokens." + ) + input_tokens = inputs[main_input_name].numel() + else: + input_tokens = inputs[main_input_name].numel() + + input_tokens = torch.tensor(input_tokens, device=self.args.device, dtype=torch.int64) + self.state.num_input_tokens_seen += self.accelerator.gather(input_tokens).sum().item() + + if rng_to_sync: + self._load_rng_state(resume_from_checkpoint) + rng_to_sync = False + + if step % args.gradient_accumulation_steps == 0: + self.control = self.callback_handler.on_step_begin(args, self.state, self.control) + + # We sync the gradients in the following cases: 1. sync_each_batch set to True 2. Using deepspeed 3. when we are at the last batch sample + if ( + self.accelerator.gradient_state.plugin_kwargs.get("sync_each_batch", False) + or self.accelerator.distributed_type == DistributedType.DEEPSPEED + or i == len(batch_samples) - 1 + ): + sync_context = contextlib.nullcontext + else: + sync_context = functools.partial(self.accelerator.no_sync, model=model) + with sync_context(): + tr_loss_step = self.training_step(model, inputs, num_items_in_batch) + + if ( + args.logging_nan_inf_filter + and not is_torch_xla_available() + and (torch.isnan(tr_loss_step) or torch.isinf(tr_loss_step)) + ): + # if loss is nan or inf simply add the average of previous logged losses + tr_loss = tr_loss + tr_loss / (1 + self.state.global_step - self._globalstep_last_logged) + else: + if tr_loss.device != tr_loss_step.device: + raise ValueError( + f"Calculated loss must be on the original device: {tr_loss.device} but device in use is {tr_loss_step.device}" + ) + tr_loss = tr_loss + tr_loss_step + + self.current_flos += float(self.floating_point_ops(inputs)) + + if do_sync_step: + # Since we perform prefetching, we need to manually set sync_gradients to True + self.accelerator.gradient_state._set_sync_gradients(True) + + # Gradient clipping + if args.max_grad_norm is not None and args.max_grad_norm > 0: + if is_sagemaker_mp_enabled() and args.fp16: + _grad_norm = self.optimizer.clip_master_grads(args.max_grad_norm) + else: + grad_norm_context = contextlib.nullcontext + if self.is_tp_enabled: + from torch.distributed._tensor.experimental import implicit_replication + + grad_norm_context = implicit_replication + with grad_norm_context(): + _grad_norm = self.accelerator.clip_grad_norm_( + model.parameters(), + args.max_grad_norm, + ) + + if self.accelerator.distributed_type == DistributedType.DEEPSPEED: + grad_norm = model.get_global_grad_norm() + # In some cases the grad norm may not return a float + if hasattr(grad_norm, "item"): + grad_norm = grad_norm.item() + else: + grad_norm = _grad_norm + + self.control = self.callback_handler.on_pre_optimizer_step(args, self.state, self.control) + + context = contextlib.nullcontext + if self.is_tp_enabled: + from torch.distributed._tensor.experimental import implicit_replication + + context = implicit_replication + + with context(): + self.optimizer.step() + + self.control = self.callback_handler.on_optimizer_step(args, self.state, self.control) + + # get leaning rate before update + learning_rate = self._get_learning_rate() + + if not self.accelerator.optimizer_step_was_skipped: + # Delay optimizer scheduling until metrics are generated + if not isinstance(self.lr_scheduler, torch.optim.lr_scheduler.ReduceLROnPlateau): + self.lr_scheduler.step() + + model.zero_grad() + self.state.global_step += 1 + self.state.epoch = epoch + (step + 1) / steps_in_epoch + self.control = self.callback_handler.on_step_end(args, self.state, self.control) + self._maybe_log_save_evaluate( + tr_loss, + grad_norm, + model, + trial, + epoch, + ignore_keys_for_eval, + start_time, + learning_rate=learning_rate, + ) + else: + self.control = self.callback_handler.on_substep_end(args, self.state, self.control) + + # PyTorch/XLA relies on the data loader to insert the mark_step for + # each step. Since we are breaking the loop early, we need to manually + # insert the mark_step here. + if self.control.should_epoch_stop or self.control.should_training_stop: + if is_torch_xla_available(): + xm.mark_step() + break + # We also need to break out of the nested loop + if self.control.should_epoch_stop or self.control.should_training_stop: + if is_torch_xla_available(): + xm.mark_step() + break + if step < 0: + logger.warning( + "There seems not to be a single sample in your epoch_iterator, stopping training at step" + f" {self.state.global_step}! This is expected if you're using an IterableDataset and set" + f" num_steps ({max_steps}) higher than the number of available samples." + ) + self.control.should_training_stop = True + + self.control = self.callback_handler.on_epoch_end(args, self.state, self.control) + self._maybe_log_save_evaluate( + tr_loss, grad_norm, model, trial, epoch, ignore_keys_for_eval, start_time, learning_rate=learning_rate + ) + + if DebugOption.TPU_METRICS_DEBUG in self.args.debug: + if is_torch_xla_available(): + # tpu-comment: Logging debug metrics for PyTorch/XLA (compile, execute times, ops, etc.) + xm.master_print(met.metrics_report()) + else: + logger.warning( + "You enabled PyTorch/XLA debug metrics but you don't have a TPU " + "configured. Check your training configuration if this is unexpected." + ) + if self.control.should_training_stop: + break + + logger.info("\n\nTraining completed. Do not forget to share your model on huggingface.co/models =)\n\n") + if args.load_best_model_at_end and self.state.best_model_checkpoint is not None: + self._load_best_model() + + # add remaining tr_loss + self._total_loss_scalar += tr_loss.item() + effective_global_step = max(self.state.global_step, 0.001) # Avoid ZeroDivisionError + train_loss = self._total_loss_scalar / effective_global_step + + metrics = speed_metrics( + "train", + start_time, + num_samples=num_train_samples, + num_steps=self.state.max_steps, + ) + self.store_flos() + metrics["total_flos"] = self.state.total_flos + metrics["train_loss"] = train_loss + + self.is_in_train = False + + self._memory_tracker.stop_and_update_metrics(metrics) + + self.log(metrics) + + run_dir = self._get_output_dir(trial) + checkpoints_sorted = sort_checkpoints( + output_dir=run_dir, best_model_checkpoint=self.state.best_model_checkpoint + ) + + # Delete the last checkpoint when save_total_limit=1 if it's different from the best checkpoint and process allowed to save. + if self.args.should_save and self.state.best_model_checkpoint is not None and self.args.save_total_limit == 1: + for checkpoint in checkpoints_sorted: + if not os.path.samefile(checkpoint, self.state.best_model_checkpoint): + logger.info(f"Deleting older checkpoint [{checkpoint}] due to args.save_total_limit") + shutil.rmtree(checkpoint, ignore_errors=True) + + self.control = self.callback_handler.on_train_end(args, self.state, self.control) + + # Wait for the checkpoint to be uploaded. + self._finish_current_push() + + # After training we make sure to retrieve back the original forward pass method + # for the embedding layer by removing the forward post hook. + if self.neftune_noise_alpha is not None: + deactivate_neftune(self.model, self.neftune_hook_handle, self.accelerator) + + return TrainOutput(self.state.global_step, train_loss, metrics) + + def training_step( + self, + model: nn.Module, + inputs: dict[str, torch.Tensor | Any], + num_items_in_batch: torch.Tensor | int | None = None, + ) -> torch.Tensor: + """ + Perform a training step on a batch of inputs. + + Subclass and override to inject custom behavior. + + Args: + model (`nn.Module`): + The model to train. + inputs (`dict[str, torch.Tensor | Any]`): + The inputs and targets of the model. + + The dictionary will be unpacked before being fed to the model. Most models expect the targets under the + argument `labels`. Check your model's documentation for all accepted arguments. + + Return: + `torch.Tensor`: The tensor with training loss on this batch. + """ + # Prepare buffers for context parallelism + + cp_context, inputs = self._prepare_context_parallel_inputs(model, inputs) + + # Context manager is no-op if CP isn't enabled + with cp_context(): + model.train() + if hasattr(self.optimizer, "train") and callable(self.optimizer.train): + self.optimizer.train() + + inputs = self._prepare_inputs(inputs) + if is_sagemaker_mp_enabled(): + loss_mb = smp_forward_backward(model, inputs, self.args.gradient_accumulation_steps) + return loss_mb.reduce_mean().detach().to(self.args.device) + + with self.compute_loss_context_manager(): + loss = self.compute_loss(model, inputs, num_items_in_batch=num_items_in_batch) + + del inputs + if ( + self.args.torch_empty_cache_steps is not None + and self.state.global_step % self.args.torch_empty_cache_steps == 0 + ): + clear_device_cache() + + kwargs = {} + + # For LOMO optimizers you need to explicitly use the learning rate + if self.args.optim in [OptimizerNames.LOMO, OptimizerNames.ADALOMO]: + kwargs["learning_rate"] = self._get_learning_rate() + + if self.args.n_gpu > 1: + loss = loss.mean() # mean() to average on multi-gpu parallel training + + # Finally we need to normalize the loss for reporting if GA loss bug is not fixed during compute loss + if (not self.model_accepts_loss_kwargs or num_items_in_batch is None) and self.compute_loss_func is None: + # If the model does not accept loss kwargs, we need to normalize the loss by the number of gradient accumulation steps + loss = loss / self.current_gradient_accumulation_steps + + # Turning off loss scaling w.r.t. gradient accumulation when DeepSpeed is enabled + # https://github.com/huggingface/transformers/pull/35808 + if self.accelerator.distributed_type == DistributedType.DEEPSPEED: + kwargs["scale_wrt_gas"] = False + + self.accelerator.backward(loss, **kwargs) + + return loss.detach() + + def compute_loss( + self, + model: nn.Module, + inputs: dict[str, torch.Tensor | Any], + return_outputs: bool = False, + num_items_in_batch: torch.Tensor | int | None = None, + ) -> torch.Tensor | tuple[torch.Tensor, Any]: + """ + How the loss is computed by Trainer. By default, all models return the loss in the first element. + + Args: + model (`nn.Module`): + The model to compute the loss for. + inputs (`dict[str, torch.Tensor | Any]`): + The input data for the model. + return_outputs (`bool`, *optional*, defaults to `False`): + Whether to return the model outputs along with the loss. + num_items_in_batch (Optional[torch.Tensor], *optional*): + The number of items in the batch. If num_items_in_batch is not passed, + + Returns: + The loss of the model along with its output if return_outputs was set to True + + Subclass and override for custom behavior. If you are not using `num_items_in_batch` when computing your loss, + make sure to overwrite `self.model_accepts_loss_kwargs` to `False`. Otherwise, the loss calculating might be slightly inaccurate when performing gradient accumulation. + """ + pc = getattr(self.accelerator, "parallelism_config", None) + if pc is not None and pc.sp_backend == "deepspeed" and pc.sp_enabled and self.model.training: + return deepspeed_sp_compute_loss(self.accelerator, model, inputs, return_outputs, pc) + + if (self.label_smoother is not None or self.compute_loss_func is not None) and "labels" in inputs: + labels = inputs.pop("labels") + else: + labels = None + if self.model_accepts_loss_kwargs: + kwargs = {} + if num_items_in_batch is not None: + kwargs["num_items_in_batch"] = num_items_in_batch + inputs = {**inputs, **kwargs} + outputs = model(**inputs) + + # User-defined compute_loss function + if self.compute_loss_func is not None: + if labels is None: + logger.warning( + "Trainer: `compute_loss_func` is defined but `labels=None`. " + "Your custom loss function will still be called with labels=None. " + ) + loss = self.compute_loss_func( + outputs, + labels, + num_items_in_batch=num_items_in_batch, + ) + # Default HF loss handling (label smoothing) if no custom loss function + elif labels is not None: + unwrapped_model = self.accelerator.unwrap_model(model) + model_name = ( + unwrapped_model.base_model.model._get_name() + if _is_peft_model(unwrapped_model) + else unwrapped_model._get_name() + ) + if model_name in MODEL_FOR_CAUSAL_LM_MAPPING_NAMES.values(): + loss = self.label_smoother(outputs, labels, shift_labels=True) + else: + loss = self.label_smoother(outputs, labels) + else: + if isinstance(outputs, dict) and "loss" not in outputs: + raise ValueError( + "The model did not return a loss from the inputs, only the following keys: " + f"{','.join(outputs.keys())}. For reference, the inputs it received are {','.join(inputs.keys())}." + ) + # We don't use .loss here since the model may return tuples instead of ModelOutput. + loss = outputs["loss"] if isinstance(outputs, dict) else outputs[0] + + if ( + self.args.average_tokens_across_devices + and (self.model_accepts_loss_kwargs or self.compute_loss_func) + and num_items_in_batch is not None + ): + loss *= self.accelerator.num_processes if self.args.n_gpu <= 1 else self.args.n_gpu + + return (loss, outputs) if return_outputs else loss + + def compute_loss_context_manager(self) -> contextlib.ExitStack: + """ + A helper wrapper to group together context managers. + """ + ctx_stack = contextlib.ExitStack() + + autocast_ctx = self.autocast_smart_context_manager() + if not isinstance(autocast_ctx, contextlib.nullcontext): + ctx_stack.enter_context(autocast_ctx) + + return ctx_stack + + def autocast_smart_context_manager(self, cache_enabled: bool | None = True) -> contextlib.AbstractContextManager: + """ + A helper wrapper that creates an appropriate context manager for `autocast` while feeding it the desired + arguments, depending on the situation. We rely on accelerate for autocast, hence we do nothing here. + """ + return contextlib.nullcontext() + + def _maybe_log_save_evaluate( + self, + tr_loss: torch.Tensor, + grad_norm: torch.Tensor | float | None, + model: nn.Module, + trial: "optuna.Trial | dict[str, Any] | None", + epoch: float, + ignore_keys_for_eval: list[str] | None, + start_time: float, + learning_rate: float | None = None, + ) -> None: + """Log metrics, run evaluation, and save checkpoints if the current training state requires it.""" + if self.control.should_log and self.state.global_step > self._globalstep_last_logged: + if is_torch_xla_available(): + xm.mark_step() + + logs: dict[str, float] = {} + + # all_gather + mean() to get average loss over all processes + tr_loss_scalar = nested_gather(tr_loss, self.args.parallel_mode).mean().item() + + # reset tr_loss to zero + tr_loss -= tr_loss + + logs["loss"] = tr_loss_scalar / (self.state.global_step - self._globalstep_last_logged) + if grad_norm is not None: + logs["grad_norm"] = grad_norm.item() if isinstance(grad_norm, torch.Tensor) else grad_norm + if learning_rate is not None: + logs["learning_rate"] = learning_rate + else: + logs["learning_rate"] = self._get_learning_rate() + + self._total_loss_scalar += tr_loss_scalar + self._globalstep_last_logged = self.state.global_step + self.store_flos() + + self.log(logs, start_time) + + metrics = None + if self.control.should_evaluate: + metrics = self._evaluate(trial, ignore_keys_for_eval) + is_new_best_metric = self._determine_best_metric(metrics=metrics, trial=trial) + + if self.args.save_strategy == SaveStrategy.BEST: + self.control.should_save = is_new_best_metric + + if self.control.should_save: + self._save_checkpoint(model, trial) + self.control = self.callback_handler.on_save(self.args, self.state, self.control) + + # ---- Training Utilites ---- + def get_batch_samples( + self, epoch_iterator: Iterator, num_batches: int, device: torch.device + ) -> tuple[list, torch.Tensor | int | None]: + """ + Collects a specified number of batches from the epoch iterator and optionally counts the number of items in the batches to properly scale the loss. + """ + batch_samples = [] + + for _ in range(num_batches): + try: + batch_samples.append(next(epoch_iterator)) + except StopIteration: + break + + num_items_in_batch = self._get_num_items_in_batch(batch_samples, device) + return batch_samples, num_items_in_batch + + def _get_num_items_in_batch(self, batch_samples: list, device: torch.device) -> torch.Tensor | int | None: + """ + Counts the number of items in the batches to properly scale the loss. + Args: + batch_samples (`list`): List of batches + device (`torch.device`): The device on which the number of items in the batch should be. + Returns: + None if the number of items in the batch doesn't need to be computed else the number of items in the batch + """ + num_items_in_batch = None + count_num_items_in_batch = ( + len(batch_samples) > 0 + and "labels" in batch_samples[0] + and ( + # num_items_in_batch is passed to model forward + # https://github.com/huggingface/transformers/blob/v4.49.0/src/transformers/trainer.py#L3757 + self.model_accepts_loss_kwargs + # num_items_in_batch is passed to compute_loss_func + # https://github.com/huggingface/transformers/blob/v4.49.0/src/transformers/trainer.py#L3773 + or self.compute_loss_func is not None + # num_items_in_batch is also verified if (self.model_accepts_loss_kwargs or self.compute_loss_func) + # https://github.com/huggingface/transformers/blob/v4.49.0/src/transformers/trainer.py#L3790 + ) + ) + if count_num_items_in_batch: + # For now we don't support object detection + try: + num_items_in_batch = sum((batch["labels"].ne(-100)).sum() for batch in batch_samples) + except (TypeError, AttributeError): + pass + + if num_items_in_batch is not None: + if self.args.average_tokens_across_devices: + if self.args.world_size > 1: + num_items_in_batch = self.accelerator.gather(num_items_in_batch.to(device)).sum() + elif self.args.n_gpu > 1: + # In DP case, if we don't average, we need to divide by the number of gpu. This is the simplest approximation. + # Otherwise, we would have to scatter labels and calculate num_items_in_batch for each gpu. + num_items_in_batch = num_items_in_batch // self.args.n_gpu + + if torch.is_tensor(num_items_in_batch): + num_items_in_batch = num_items_in_batch.to(device) + + if self.args.n_gpu > 1 and num_items_in_batch.dim() == 0: + # In the DataParallel case, convert the scalar tensor into a 2-dim tensor with the same value repeated + num_items_in_batch = num_items_in_batch.unsqueeze(0).expand(self.args.n_gpu, -1) + # Divide by number of devices with the same batch + if pc := getattr(self.accelerator, "parallelism_config", None): + num_items_in_batch = num_items_in_batch // pc.non_data_parallel_size + + return num_items_in_batch + + def _prepare_input(self, data: torch.Tensor | Any) -> torch.Tensor | Any: + """ + Prepares one `data` before feeding it to the model, be it a tensor or a nested list/dictionary of tensors. + """ + if isinstance(data, Mapping): + return type(data)({k: self._prepare_input(v) for k, v in data.items()}) + elif isinstance(data, (tuple, list)): + return type(data)(self._prepare_input(v) for v in data) + elif isinstance(data, torch.Tensor): + kwargs = {"device": self.args.device} + if self.is_deepspeed_enabled and (torch.is_floating_point(data) or torch.is_complex(data)): + # NLP models inputs are int/uint and those get adjusted to the right dtype of the + # embedding. Other models such as wav2vec2's inputs are already float and thus + # may need special handling to match the dtypes of the model + kwargs.update({"dtype": self.accelerator.state.deepspeed_plugin.hf_ds_config.dtype()}) + return data.to(**kwargs) + return data + + def _prepare_inputs(self, inputs: dict[str, torch.Tensor | Any]) -> dict[str, torch.Tensor | Any]: + """ + Prepare `inputs` before feeding them to the model, converting them to tensors if they are not already and + handling potential state. + """ + inputs = self._prepare_input(inputs) + if len(inputs) == 0: + raise ValueError( + "The batch received was empty, your model won't be able to train on it. Double-check that your " + f"training dataset contains keys expected by the model: {','.join(self._signature_columns)}." + ) + + return inputs + + def _prepare_context_parallel_inputs( + self, model: nn.Module, inputs: dict[str, torch.Tensor | Any] + ) -> tuple[Callable, dict[str, torch.Tensor | Any]]: + """ + Prepare inputs for context parallelism by setting up buffers and validation. + + Args: + model: The model being trained + inputs: Input tensors to prepare + + Returns: + tuple: (context_manager, prepared_inputs) where context_manager is either + the context parallelism wrapper or a no-op context + """ + if ( + getattr(self.accelerator, "parallelism_config", None) is not None + and self.accelerator.parallelism_config.cp_enabled + ): + if self.accelerator.parallelism_config.cp_backend == "torch": + if hasattr(model, "config"): + if model.config._attn_implementation != "sdpa": + raise ValueError( + f"Context parallelism is supported only with SDPA attention, you are using {model.config._attn_implementation}." + ) + + if "shift_labels" not in inputs: + logger.warning_once("Shift labels not found in the inputs, shifting manually") + if "labels" in inputs: + _ignore_index = -100 + labels = nn.functional.pad(inputs["labels"], (0, 1), value=_ignore_index) + inputs["shift_labels"] = labels[:, 1:].contiguous() + + # note: we don't do anything for accelerator.parallelism_config.sp_backend == "deepspeed" since: + # - accelerator.parallelism_config performs the `model.config._attn_implementation` checks already and it supports more than `dspa` + # - UlyssesSPDataLoaderAdapter called from Accelerate performs the `shift_label` creation - must not interfere + # - position_ids generation should be done by HF Trainer if it wasn't done by the user + + if "position_ids" not in inputs: + logger.warning_once("Position IDs not found in the inputs, generating manually") + inputs["position_ids"] = torch.arange( + inputs["input_ids"].size(1), device=inputs["input_ids"].device + ).expand(inputs["input_ids"].size(0), -1) + + buffers = [] + buffer_seq_dims = [] + + if "input_ids" in inputs: + buffers.append(inputs["input_ids"]) + buffer_seq_dims.append(1) # Sequence dimension + if "labels" in inputs: + buffers.append(inputs["labels"]) + buffer_seq_dims.append(1) + if "shift_labels" in inputs: + buffers.append(inputs["shift_labels"]) + buffer_seq_dims.append(1) + # Add attention_mask to buffers for context parallel splitting (only if causal) + if "attention_mask" in inputs: + # Only validate causal mask once for performance + if not getattr(self, "_attn_mask_causal_checked", False): + # Context parallel currently doesn't support other masks than causal + # Accelerate applies hooks to replace mask with is_causal arg in SDPA + # Check if the mask is really causal and if not throw an error + attention_mask = inputs["attention_mask"] + if not is_attention_mask_causal(attention_mask): + raise ValueError( + "Context parallelism only supports causal attention masks. " + "The provided attention_mask is not causal. " + "Please ensure your data uses causal masking (lower triangular) " + "or remove the attention_mask to use the model's default causal masking." + ) + self._attn_mask_causal_checked = True + if self._attn_mask_causal_checked: + # Add to buffers only after validation (or if validation already passed) + attention_mask = inputs["attention_mask"] + if attention_mask.dim() == 2: + buffers.append(attention_mask) + buffer_seq_dims.append(1) + else: + # Other dimensionality; keep as-is without sharding to avoid incorrect splits + pass + # Include position_ids in context parallelism splitting + if "position_ids" in inputs and inputs["position_ids"] is not None: + buffers.append(inputs["position_ids"]) + buffer_seq_dims.append(1) + + return partial( + self.accelerator.maybe_context_parallel, + buffers=buffers, + buffer_seq_dims=buffer_seq_dims, + no_restore_buffers=set(buffers), + ), inputs + + return contextlib.nullcontext, inputs + + def set_initial_training_values( + self, args: TrainingArguments, dataloader: DataLoader, total_train_batch_size: int + ) -> tuple[int, int, int, int, bool, int | None, int]: + """ + Calculates and returns the following values: + - `num_train_epochs` + - `num_update_steps_per_epoch` + - `num_examples` + - `num_train_samples` + - `epoch_based` + - `len_dataloader` + - `max_steps` + """ + # Case 1: we rely on `args.max_steps` first + max_steps = args.max_steps + # If max_steps is negative, we use the number of epochs to determine the number of total steps later + epoch_based = max_steps < 0 + len_dataloader = len(dataloader) if has_length(dataloader) else None + + # Account for Sequence Parallelism (SP) dataloader adapter's effect + sp_size = self.get_sp_size() + if sp_size > 1 and len_dataloader is not None: + len_dataloader = len_dataloader * sp_size + + # Case 2: We have a dataloader length and can extrapolate + if len_dataloader is not None: + num_update_steps_per_epoch = max( + len_dataloader // args.gradient_accumulation_steps + + int(len_dataloader % args.gradient_accumulation_steps > 0), + 1, + ) + # Case 3: We have a length but are using epochs, we can extrapolate the number of steps + if epoch_based: + max_steps = math.ceil(args.num_train_epochs * num_update_steps_per_epoch) + + # Now we figure out `num_examples`, `num_train_epochs`, and `train_samples` + if len_dataloader: + num_examples = self.num_examples(dataloader) + if args.max_steps > 0: + num_train_epochs = max_steps // num_update_steps_per_epoch + int( + max_steps % num_update_steps_per_epoch > 0 + ) + # May be slightly incorrect if the last batch in the training dataloader has a smaller size but it's + # the best we can do. + num_train_samples = max_steps * total_train_batch_size + else: + num_train_epochs = math.ceil(args.num_train_epochs) + num_train_samples = self.num_examples(dataloader) * args.num_train_epochs + elif args.max_steps > 0: # Rely on max_steps when dataloader does not have a working size + # Setting a very large number of epochs so we go as many times as necessary over the iterator. + num_train_epochs = sys.maxsize + num_update_steps_per_epoch = max_steps + num_examples = total_train_batch_size * args.max_steps + num_train_samples = args.max_steps * total_train_batch_size + else: + raise ValueError( + "args.max_steps must be set to a positive value if dataloader does not have a length, was" + f" {args.max_steps}" + ) + return ( + num_train_epochs, + num_update_steps_per_epoch, + num_examples, + num_train_samples, + epoch_based, + len_dataloader, + max_steps, + ) + + def get_total_train_batch_size(self, args: TrainingArguments) -> int: + """Calculates total batch size (micro_batch * grad_accum * dp_world_size). + + Accounts for all parallelism dimensions: TP, CP, and SP. + + Formula: dp_world_size = world_size // (tp_size * cp_size * sp_size) + + Where: + - TP (Tensor Parallelism): Model layers split across GPUs + - CP (Context Parallelism): Sequences split using Ring Attention (FSDP2) + - SP (Sequence Parallelism): Sequences split using ALST/Ulysses (DeepSpeed) + + All dimensions are separate and multiplicative: world_size = dp_size * tp_size * cp_size * sp_size + """ + + dp_world_size = args.world_size // self.get_tp_size() // self.get_cp_size() // self.get_sp_size() + return self._train_batch_size * args.gradient_accumulation_steps * dp_world_size + + def get_sp_size(self) -> int: + """Get the sequence parallel size""" + if getattr(self.accelerator, "parallelism_config", None) is None: + return 1 + else: + pc = self.accelerator.parallelism_config + return pc.sp_size + + def get_cp_size(self) -> int: + """Get the context parallel size""" + if getattr(self.accelerator, "parallelism_config", None) is None: + return 1 + else: + pc = self.accelerator.parallelism_config + return pc.cp_size + + def get_tp_size(self) -> int: + """Get the tensor parallel size from either the model or DeepSpeed config.""" + + # 1. Check model.tp_size first + if (model_tp := getattr(self.model, "_tp_size", None)) is not None: + return model_tp + + # 2. Fall back to DeepSpeed config if enabled + if self.is_deepspeed_enabled and (deepspeed_config := getattr(self.args, "hf_deepspeed_config", None)): + return deepspeed_config.config.get("tensor_parallel", {}).get("autotp_size", 1) + + # 3. Default fallback + return 1 + + def _wrap_model(self, model: nn.Module, training: bool = True, dataloader: DataLoader | None = None) -> nn.Module: + """Wrap `model` for distributed training if needed (DDP, FSDP, SageMaker, etc.).""" + if is_sagemaker_mp_enabled(): + # Wrapping the base model twice in a DistributedModel will raise an error. + if isinstance(self.model_wrapped, smp.model.DistributedModel): + return self.model_wrapped + return smp.DistributedModel(model, backward_passes_per_step=self.args.gradient_accumulation_steps) + + # train/eval could be run multiple-times - if already wrapped, don't re-wrap it again + if self.accelerator.unwrap_model(model, keep_torch_compile=False) is not model: + return model + + # Multi-gpu training, 8bit models does not support DP + if self.args.n_gpu > 1 and not getattr(model, "is_loaded_in_8bit", False): + model = nn.DataParallel(model) + + # Note: in torch.distributed mode, there's no point in wrapping the model + # inside a DistributedDataParallel as we'll be under `no_grad` anyways. + if not training: + return model + + # Distributed training using PyTorch FSDP + if self.is_fsdp_xla_enabled: + self.model = model = wrap_model_xla_fsdp(model, self.args, self.is_fsdp_xla_v2_enabled) + elif is_sagemaker_dp_enabled(): + model = nn.parallel.DistributedDataParallel( + model, device_ids=[int(os.getenv("SMDATAPARALLEL_LOCAL_RANK"))] + ) + elif self.args.parallel_mode == ParallelMode.DISTRIBUTED: + if is_torch_neuroncore_available(): + return model + kwargs = {} + if self.args.ddp_find_unused_parameters is not None: + kwargs["find_unused_parameters"] = self.args.ddp_find_unused_parameters + elif isinstance(model, PreTrainedModel): + # find_unused_parameters breaks checkpointing as per + # https://github.com/huggingface/transformers/pull/4659#issuecomment-643356021 + kwargs["find_unused_parameters"] = not model.is_gradient_checkpointing + else: + kwargs["find_unused_parameters"] = True + + if self.args.ddp_bucket_cap_mb is not None: + kwargs["bucket_cap_mb"] = self.args.ddp_bucket_cap_mb + + if self.args.ddp_broadcast_buffers is not None: + kwargs["broadcast_buffers"] = self.args.ddp_broadcast_buffers + + self.accelerator.ddp_handler = DistributedDataParallelKwargs(**kwargs) + + return model + + # ---- Evaluation & Prediction ---- + + def evaluate( + self, + eval_dataset: Dataset | dict[str, Dataset] | None = None, + ignore_keys: list[str] | None = None, + metric_key_prefix: str = "eval", + ) -> dict[str, float]: + """ + Run evaluation and returns metrics. + + The calling script will be responsible for providing a method to compute metrics, as they are task-dependent + (pass it to the init `compute_metrics` argument). + + You can also subclass and override this method to inject custom behavior. + + Args: + eval_dataset (`Dataset` | dict[str, `Dataset`], *optional*): + Pass a dataset if you wish to override `self.eval_dataset`. If it is a [`~datasets.Dataset`], columns + not accepted by the `model.forward()` method are automatically removed. If it is a dictionary, it will + evaluate on each dataset, prepending the dictionary key to the metric name. Datasets must implement the + `__len__` method. + + + + If you pass a dictionary with names of datasets as keys and datasets as values, evaluate will run + separate evaluations on each dataset. This can be useful to monitor how training affects other + datasets or simply to get a more fine-grained evaluation. + When used with `load_best_model_at_end`, make sure `metric_for_best_model` references exactly one + of the datasets. If you, for example, pass in `{"data1": data1, "data2": data2}` for two datasets + `data1` and `data2`, you could specify `metric_for_best_model="eval_data1_loss"` for using the + loss on `data1` and `metric_for_best_model="eval_data2_loss"` for the loss on `data2`. + + + + ignore_keys (`list[str]`, *optional*): + A list of keys in the output of your model (if it is a dictionary) that should be ignored when + gathering predictions. + metric_key_prefix (`str`, *optional*, defaults to `"eval"`): + An optional prefix to be used as the metrics key prefix. For example the metrics "bleu" will be named + "eval_bleu" if the prefix is "eval" (default) + + Returns: + A dictionary containing the evaluation loss and the potential metrics computed from the predictions. The + dictionary also contains the epoch number which comes from the training state. + """ + # handle multiple eval datasets + override = eval_dataset is not None + eval_dataset = eval_dataset if override else self.eval_dataset + if isinstance(eval_dataset, dict): + metrics = {} + for eval_dataset_name, _eval_dataset in eval_dataset.items(): + dataset_metrics = self.evaluate( + eval_dataset=_eval_dataset if override else eval_dataset_name, + ignore_keys=ignore_keys, + metric_key_prefix=f"{metric_key_prefix}_{eval_dataset_name}", + ) + metrics.update(dataset_metrics) + return metrics + + # memory metrics - must set up as early as possible + self._memory_tracker.start() + + eval_dataloader = self.get_eval_dataloader(eval_dataset) + if self.is_fsdp_xla_v2_enabled: + eval_dataloader = tpu_spmd_dataloader(eval_dataloader) + + start_time = time.time() + + output = self.evaluation_loop( + eval_dataloader, + description="Evaluation", + # No point gathering the predictions if there are no metrics, otherwise we defer to + # self.args.prediction_loss_only + prediction_loss_only=True if self.compute_metrics is None else None, + ignore_keys=ignore_keys, + metric_key_prefix=metric_key_prefix, + ) + + total_batch_size = self.args.eval_batch_size * self.args.world_size + if f"{metric_key_prefix}_model_preparation_time" in output.metrics: + start_time += output.metrics[f"{metric_key_prefix}_model_preparation_time"] + output.metrics.update( + speed_metrics( + metric_key_prefix, + start_time, + num_samples=output.num_samples, + num_steps=math.ceil(output.num_samples / total_batch_size), + ) + ) + + self.log(output.metrics) + + if DebugOption.TPU_METRICS_DEBUG in self.args.debug: + # tpu-comment: Logging debug metrics for PyTorch/XLA (compile, execute times, ops, etc.) + xm.master_print(met.metrics_report()) + + self.control = self.callback_handler.on_evaluate(self.args, self.state, self.control, output.metrics) + + self._memory_tracker.stop_and_update_metrics(output.metrics) + + return output.metrics + + def evaluation_loop( + self, + dataloader: DataLoader, + description: str, + prediction_loss_only: bool | None = None, + ignore_keys: list[str] | None = None, + metric_key_prefix: str = "eval", + ) -> EvalLoopOutput: + """ + Prediction/evaluation loop, shared by `Trainer.evaluate()` and `Trainer.predict()`. + + Works both with or without labels. + """ + args = self.args + + prediction_loss_only = prediction_loss_only if prediction_loss_only is not None else args.prediction_loss_only + + # if eval is called w/o train, handle model prep here + if self.is_deepspeed_enabled and self.deepspeed is None: + _, _ = deepspeed_init(self, num_training_steps=0, inference=True) + + model = self._wrap_model(self.model, training=False, dataloader=dataloader) + + if len(self.accelerator._models) == 0 and model is self.model: + start_time = time.time() + model = ( + self.accelerator.prepare(model) + if self.is_deepspeed_enabled + or (self.is_fsdp_enabled and self.accelerator.mixed_precision != "fp8" and not self.args.torch_compile) + else self.accelerator.prepare_model(model, evaluation_mode=True) + ) + self.model_preparation_time = round(time.time() - start_time, 4) + + if self.is_fsdp_enabled: + self.model = model + + # for the rest of this function `model` is the outside model, whether it was wrapped or not + if model is not self.model: + self.model_wrapped = model + + # backward compatibility + if self.is_deepspeed_enabled: + self.deepspeed = self.model_wrapped + + # if full fp16 or bf16 eval is wanted and this ``evaluation`` or ``predict`` isn't called + # while ``train`` is running, cast it to the right dtype first and then put on device + if not self.is_in_train: + if args.fp16_full_eval: + model = model.to(dtype=torch.float16, device=args.device) + elif args.bf16_full_eval: + model = model.to(dtype=torch.bfloat16, device=args.device) + + batch_size = self.args.eval_batch_size + + logger.info(f"\n***** Running {description} *****") + if has_length(dataloader): + logger.info(f" Num examples = {self.num_examples(dataloader)}") + else: + logger.info(" Num examples: Unknown") + logger.info(f" Batch size = {batch_size}") + + if hasattr(model, "eval") and callable(model.eval): + model.eval() + if hasattr(self.optimizer, "eval") and callable(self.optimizer.eval): + self.optimizer.eval() + + self.callback_handler.eval_dataloader = dataloader + # Do this before wrapping. + eval_dataset = getattr(dataloader, "dataset", None) + + # Initialize containers + all_losses = EvalLoopContainer(self.args.eval_do_concat_batches, padding_index=-100) + all_preds = EvalLoopContainer(self.args.eval_do_concat_batches, padding_index=-100) + all_labels = EvalLoopContainer(self.args.eval_do_concat_batches, padding_index=-100) + all_inputs = EvalLoopContainer(self.args.eval_do_concat_batches, padding_index=-100) + + metrics = None + eval_set_kwargs = {} + + # Will be useful when we have an iterable dataset so don't know its length. + observed_num_examples = 0 + + # Main evaluation loop + for step, inputs in enumerate(dataloader): + # Update the observed num examples + observed_batch_size = find_batch_size(inputs) + if observed_batch_size is not None: + observed_num_examples += observed_batch_size + # For batch samplers, batch_size is not known by the dataloader in advance. + if batch_size is None: + batch_size = observed_batch_size + + # Prediction step + losses, logits, labels = self.prediction_step(model, inputs, prediction_loss_only, ignore_keys=ignore_keys) + main_input_name = getattr(self.model, "main_input_name", "input_ids") + inputs_decode = ( + self._prepare_input(inputs[main_input_name]) if "inputs" in args.include_for_metrics else None + ) + + if is_torch_xla_available(): + xm.mark_step() + + # Update containers + if losses is not None: + losses = self.gather_function(losses.repeat(batch_size)) + all_losses.add(losses) + if inputs_decode is not None: + inputs_decode = self.accelerator.pad_across_processes(inputs_decode, dim=1, pad_index=-100) + inputs_decode = self.gather_function(inputs_decode) + if not self.args.batch_eval_metrics or description == "Prediction": + all_inputs.add(inputs_decode) + if labels is not None: + # Pad labels here, preparing for preprocess_logits_for_metrics in next logits block. + labels = self.accelerator.pad_across_processes(labels, dim=1, pad_index=-100) + if logits is not None: + logits = self.accelerator.pad_across_processes(logits, dim=1, pad_index=-100) + if self.preprocess_logits_for_metrics is not None: + logits = self.preprocess_logits_for_metrics(logits, labels) + logits = self.gather_function(logits) + if not self.args.batch_eval_metrics or description == "Prediction": + all_preds.add(logits) + if labels is not None: + labels = self.gather_function(labels) + if not self.args.batch_eval_metrics or description == "Prediction": + all_labels.add(labels) + + self.control = self.callback_handler.on_prediction_step(args, self.state, self.control) + + if self.args.batch_eval_metrics: + if self.compute_metrics is not None and logits is not None and labels is not None: + is_last_step = self.accelerator.gradient_state.end_of_dataloader + batch_kwargs = {} + batch_kwargs["losses"] = losses if "loss" in args.include_for_metrics else None + batch_kwargs["inputs"] = inputs if "inputs" in args.include_for_metrics else None + metrics = self.compute_metrics( + EvalPrediction(predictions=logits, label_ids=labels, **batch_kwargs), + compute_result=is_last_step, + ) + + del losses, logits, labels, inputs + torch.cuda.empty_cache() + + # Gather all tensors and put them back on the CPU if we have done enough accumulation steps. + elif args.eval_accumulation_steps is not None and (step + 1) % args.eval_accumulation_steps == 0: + all_losses.to_cpu_and_numpy() + all_preds.to_cpu_and_numpy() + all_labels.to_cpu_and_numpy() + all_inputs.to_cpu_and_numpy() + + del losses, logits, labels, inputs + torch.cuda.empty_cache() + + # After all calls to `.gather_function`, reset to `gather_for_metrics`: + self.gather_function = self.accelerator.gather_for_metrics + + # Gather all remaining tensors and put them back on the CPU + all_losses = all_losses.get_arrays() + all_preds = all_preds.get_arrays() + all_labels = all_labels.get_arrays() + all_inputs = all_inputs.get_arrays() + + # Number of samples + if has_length(eval_dataset): + num_samples = len(eval_dataset) + # The instance check is weird and does not actually check for the type, but whether the dataset has the right + # methods. Therefore we need to make sure it also has the attribute. + elif isinstance(eval_dataset, IterableDatasetShard) and getattr(eval_dataset, "num_examples", 0) > 0: + num_samples = eval_dataset.num_examples + else: + if has_length(dataloader): + num_samples = self.num_examples(dataloader) + else: # both len(dataloader.dataset) and len(dataloader) fail + num_samples = observed_num_examples + if num_samples == 0 and observed_num_examples > 0: + num_samples = observed_num_examples + + # Metrics! + if ( + self.compute_metrics is not None + and all_preds is not None + and all_labels is not None + and not self.args.batch_eval_metrics + ): + eval_set_kwargs["losses"] = all_losses if "loss" in args.include_for_metrics else None + eval_set_kwargs["inputs"] = all_inputs if "inputs" in args.include_for_metrics else None + metrics = self.compute_metrics( + EvalPrediction(predictions=all_preds, label_ids=all_labels, **eval_set_kwargs) + ) + elif metrics is None: + metrics = {} + + # To be JSON-serializable, we need to remove numpy types or zero-d tensors + metrics = denumpify_detensorize(metrics) + + if isinstance(all_losses, list) and all_losses: + metrics[f"{metric_key_prefix}_loss"] = np.concatenate(all_losses).mean().item() + elif isinstance(all_losses, np.ndarray): + metrics[f"{metric_key_prefix}_loss"] = all_losses.mean().item() + if hasattr(self, "model_preparation_time"): + metrics[f"{metric_key_prefix}_model_preparation_time"] = self.model_preparation_time + + # Prefix all keys with metric_key_prefix + '_' + for key in list(metrics.keys()): + if not key.startswith(f"{metric_key_prefix}_"): + metrics[f"{metric_key_prefix}_{key}"] = metrics.pop(key) + + return EvalLoopOutput(predictions=all_preds, label_ids=all_labels, metrics=metrics, num_samples=num_samples) + + def predict( + self, test_dataset: Dataset, ignore_keys: list[str] | None = None, metric_key_prefix: str = "test" + ) -> PredictionOutput: + """ + Run prediction and returns predictions and potential metrics. + + Depending on the dataset and your use case, your test dataset may contain labels. In that case, this method + will also return metrics, like in `evaluate()`. + + Args: + test_dataset (`Dataset`): + Dataset to run the predictions on. If it is an `datasets.Dataset`, columns not accepted by the + `model.forward()` method are automatically removed. Has to implement the method `__len__` + ignore_keys (`list[str]`, *optional*): + A list of keys in the output of your model (if it is a dictionary) that should be ignored when + gathering predictions. + metric_key_prefix (`str`, *optional*, defaults to `"test"`): + An optional prefix to be used as the metrics key prefix. For example the metrics "bleu" will be named + "test_bleu" if the prefix is "test" (default) + + + + If your predictions or labels have different sequence length (for instance because you're doing dynamic padding + in a token classification task) the predictions will be padded (on the right) to allow for concatenation into + one array. The padding index is -100. + + + + Returns: *NamedTuple* A namedtuple with the following keys: + + - predictions (`np.ndarray`): The predictions on `test_dataset`. + - label_ids (`np.ndarray`, *optional*): The labels (if the dataset contained some). + - metrics (`dict[str, float]`, *optional*): The potential dictionary of metrics (if the dataset contained + labels). + """ + # memory metrics - must set up as early as possible + self._memory_tracker.start() + + test_dataloader = self.get_test_dataloader(test_dataset) + start_time = time.time() + + output = self.evaluation_loop( + test_dataloader, description="Prediction", ignore_keys=ignore_keys, metric_key_prefix=metric_key_prefix + ) + total_batch_size = self.args.eval_batch_size * self.args.world_size + if f"{metric_key_prefix}_model_preparation_time" in output.metrics: + start_time += output.metrics[f"{metric_key_prefix}_model_preparation_time"] + output.metrics.update( + speed_metrics( + metric_key_prefix, + start_time, + num_samples=output.num_samples, + num_steps=math.ceil(output.num_samples / total_batch_size), + ) + ) + + self.control = self.callback_handler.on_predict(self.args, self.state, self.control, output.metrics) + self._memory_tracker.stop_and_update_metrics(output.metrics) + + return PredictionOutput(predictions=output.predictions, label_ids=output.label_ids, metrics=output.metrics) + + def prediction_step( + self, + model: nn.Module, + inputs: dict[str, torch.Tensor | Any], + prediction_loss_only: bool, + ignore_keys: list[str] | None = None, + ) -> tuple[torch.Tensor | None, torch.Tensor | None, torch.Tensor | None]: + """ + Perform an evaluation step on `model` using `inputs`. + + Subclass and override to inject custom behavior. + + Args: + model (`nn.Module`): + The model to evaluate. + inputs (`dict[str, torch.Tensor | Any]`): + The inputs and targets of the model. + + The dictionary will be unpacked before being fed to the model. Most models expect the targets under the + argument `labels`. Check your model's documentation for all accepted arguments. + prediction_loss_only (`bool`): + Whether or not to return the loss only. + ignore_keys (`list[str]`, *optional*): + A list of keys in the output of your model (if it is a dictionary) that should be ignored when + gathering predictions. + + Return: + tuple[Optional[torch.Tensor], Optional[torch.Tensor], Optional[torch.Tensor]]: A tuple with the loss, + logits and labels (each being optional). + """ + has_labels = False if len(self.label_names) == 0 else all(inputs.get(k) is not None for k in self.label_names) + # For CLIP-like models capable of returning loss values. + # If `return_loss` is not specified or being `None` in `inputs`, we check if the default value of `return_loss` + # is `True` in `model.forward`. + return_loss = inputs.get("return_loss") + if return_loss is None: + return_loss = self.can_return_loss + loss_without_labels = len(self.label_names) == 0 and return_loss + + inputs = self._prepare_inputs(inputs) + if ignore_keys is None: + if hasattr(self.model, "config"): + ignore_keys = getattr(self.model.config, "keys_to_ignore_at_inference", ["past_key_values"]) + else: + ignore_keys = [] + + # labels may be popped when computing the loss (label smoothing for instance) so we grab them first. + if has_labels or loss_without_labels: + labels = nested_detach(tuple(inputs.get(name) for name in self.label_names)) + if len(labels) == 1: + labels = labels[0] + else: + labels = None + + with torch.no_grad(): + if is_sagemaker_mp_enabled(): + raw_outputs = smp_forward_only(model, inputs) + if has_labels or loss_without_labels: + if isinstance(raw_outputs, dict): + loss_mb = raw_outputs["loss"] + logits_mb = tuple(v for k, v in raw_outputs.items() if k not in ignore_keys + ["loss"]) + else: + loss_mb = raw_outputs[0] + logits_mb = raw_outputs[1:] + + loss = loss_mb.reduce_mean().detach().cpu() + logits = smp_nested_concat(logits_mb) + else: + loss = None + if isinstance(raw_outputs, dict): + logits_mb = tuple(v for k, v in raw_outputs.items() if k not in ignore_keys) + else: + logits_mb = raw_outputs + logits = smp_nested_concat(logits_mb) + else: + if has_labels or loss_without_labels: + with self.compute_loss_context_manager(): + num_items_in_batch = self._get_num_items_in_batch([inputs], self.args.device) + loss, outputs = self.compute_loss( + model, inputs, return_outputs=True, num_items_in_batch=num_items_in_batch + ) + loss = loss.detach().mean() + + if isinstance(outputs, dict): + logits = tuple(v for k, v in outputs.items() if k not in ignore_keys + ["loss"]) + else: + logits = outputs[1:] + else: + loss = None + with self.compute_loss_context_manager(): + outputs = model(**inputs) + if isinstance(outputs, dict): + logits = tuple(v for k, v in outputs.items() if k not in ignore_keys) + else: + logits = outputs + + if prediction_loss_only: + return (loss, None, None) + + logits = nested_detach(logits) + if len(logits) == 1: + logits = logits[0] + + return (loss, logits, labels) + + def _evaluate( + self, + trial: "optuna.Trial | dict[str, Any] | None", + ignore_keys_for_eval: list[str] | None, + skip_scheduler: bool = False, + ) -> dict[str, float]: + """Run evaluation, report to HP search, and step ReduceLROnPlateau if needed.""" + metrics = self.evaluate(ignore_keys=ignore_keys_for_eval) + self._report_to_hp_search(trial, self.state.global_step, metrics) + + # Run delayed LR scheduler now that metrics are populated + if isinstance(self.lr_scheduler, torch.optim.lr_scheduler.ReduceLROnPlateau) and not skip_scheduler: + metric_to_check = self.args.metric_for_best_model + if not metric_to_check.startswith("eval_"): + metric_to_check = f"eval_{metric_to_check}" + try: + self.lr_scheduler.step(metrics[metric_to_check]) + except KeyError as exc: + raise KeyError( + f"The `metric_for_best_model` training argument is set to '{metric_to_check}', " + f"which is not found in the evaluation metrics. " + f"The available evaluation metrics are: {list(metrics.keys())}. " + f"Please ensure that the `compute_metrics` function returns a dictionary that includes '{metric_to_check}' or " + f"consider changing the `metric_for_best_model` via the TrainingArguments." + ) from exc + return metrics + + # ---- Checkpoint Saving ---- + + def _get_output_dir(self, trial: "optuna.Trial | dict[str, Any] | None") -> str: + """Return the output directory, accounting for hyperparameter search trials.""" + if self.hp_search_backend is not None and trial is not None: + if self.hp_search_backend == HPSearchBackend.OPTUNA: + run_id = trial.number + elif self.hp_search_backend == HPSearchBackend.RAY: + import ray.tune + + run_id = ray.tune.get_context().get_trial_id() + elif self.hp_search_backend == HPSearchBackend.WANDB: + import wandb + + run_id = wandb.run.id + run_name = self.hp_name(trial) if self.hp_name is not None else f"run-{run_id}" + run_dir = os.path.join(self.args.output_dir, run_name) + else: + run_dir = self.args.output_dir + return run_dir + + def _save_checkpoint(self, model: nn.Module, trial: "optuna.Trial | dict[str, Any] | None") -> None: + """Save model checkpoint, optimizer, scheduler, scaler, RNG states, and trainer state.""" + # In all cases, including ddp/dp/deepspeed, self.model is always a reference to the model we + # want to save except FullyShardedDDP. + # assert unwrap_model(model) is self.model, "internal model should be a reference to self.model" + + # Save model checkpoint + checkpoint_folder = f"{PREFIX_CHECKPOINT_DIR}-{self.state.global_step}" + + if self.hp_search_backend is None and trial is None: + self.store_flos() + + run_dir = self._get_output_dir(trial=trial) + output_dir = os.path.join(run_dir, checkpoint_folder) + self.save_model(output_dir, _internal_call=True) + + if self.args.save_strategy in [SaveStrategy.STEPS, SaveStrategy.EPOCH] and self.state.best_global_step: + # Wait for everyone to get here so we are sure the model has been saved by process 0 + # before we check if the best_checkpoint_dir exists + if is_torch_xla_available(): + xm.rendezvous("load_best_model_at_end") + elif self.args.parallel_mode == ParallelMode.DISTRIBUTED: + dist.barrier() + elif is_sagemaker_mp_enabled(): + smp.barrier() + + best_checkpoint_folder = f"{PREFIX_CHECKPOINT_DIR}-{self.state.best_global_step}" + best_checkpoint_dir = os.path.join(run_dir, best_checkpoint_folder) + + if os.path.exists(best_checkpoint_dir): + self.state.best_model_checkpoint = best_checkpoint_dir + + if not self.args.save_only_model: + # Save optimizer and scheduler + self._save_optimizer_and_scheduler(output_dir) + self._save_scaler(output_dir) + # Save RNG state + self._save_rng_state(output_dir) + + # Save the Trainer state + if self.args.should_save: + # Update `ExportableState` callbacks and `TrainerControl` state to where we are currently + for cb in [ + cb for cb in self.callback_handler.callbacks + [self.control] if isinstance(cb, ExportableState) + ]: + cb_name = cb.__class__.__name__ + cb_state = cb.state() + if isinstance(self.state.stateful_callbacks[cb_name], list): + self.state.stateful_callbacks[cb_name].append(cb_state) + else: + self.state.stateful_callbacks[cb_name] = cb_state + self.state.save_to_json(os.path.join(output_dir, TRAINER_STATE_NAME)) + + if self.args.push_to_hub: + self._push_from_checkpoint(output_dir) + + # Maybe delete some older checkpoints. + if self.args.should_save: + # we use mtime as default, filesystems without mtime support will be detected in `sort_checkpoints` + rotate_checkpoints( + output_dir=run_dir, + save_total_limit=self.args.save_total_limit, + best_model_checkpoint=self.state.best_model_checkpoint, + use_mtime=True, + ) + + def _determine_best_metric(self, metrics: dict[str, float], trial: "optuna.Trial | dict[str, Any] | None") -> bool: + """ + Determine if the model should be saved based on the evaluation metrics. + + Returns: + bool: True if a new best metric was found, else False + """ + is_new_best_metric = False + + if self.args.metric_for_best_model is not None: + metric_to_check = self.args.metric_for_best_model + + if not metric_to_check.startswith("eval_"): + metric_to_check = f"eval_{metric_to_check}" + + try: + metric_value = metrics[metric_to_check] + except KeyError as exc: + raise KeyError( + f"The `metric_for_best_model` training argument is set to '{metric_to_check}', which is not found in the evaluation metrics. " + f"The available evaluation metrics are: {list(metrics.keys())}. Consider changing the `metric_for_best_model` via the TrainingArguments." + ) from exc + + operator = np.greater if self.args.greater_is_better else np.less + + if self.state.best_metric is None: + self.state.best_metric = float("-inf") if self.args.greater_is_better else float("inf") + + if operator(metric_value, self.state.best_metric): + self.state.best_metric = metric_value + + if self.args.save_strategy in [SaveStrategy.STEPS, SaveStrategy.EPOCH]: + self.state.best_global_step = self.state.global_step + + is_new_best_metric = True + + return is_new_best_metric + + def _save_rng_state(self, output_dir: str) -> None: + """Save random number generator states for reproducible resumption.""" + # Save RNG state in non-distributed training + rng_states = { + "python": random.getstate(), + "numpy": np.random.get_state(), + "cpu": torch.random.get_rng_state(), + } + if torch.cuda.is_available(): + if self.args.parallel_mode == ParallelMode.DISTRIBUTED: + # In non distributed, we save the global CUDA RNG state (will take care of DataParallel) + rng_states["cuda"] = torch.cuda.random.get_rng_state_all() + else: + rng_states["cuda"] = torch.cuda.random.get_rng_state() + + if is_torch_xla_available(): + rng_states["xla"] = xm.get_rng_state() + + if is_torch_npu_available(): + if self.args.parallel_mode == ParallelMode.DISTRIBUTED: + rng_states["npu"] = torch.npu.random.get_rng_state_all() + else: + rng_states["npu"] = torch.npu.random.get_rng_state() + + if is_torch_hpu_available(): + if self.args.parallel_mode == ParallelMode.DISTRIBUTED: + rng_states["hpu"] = torch.hpu.random.get_rng_state_all() + else: + rng_states["hpu"] = torch.hpu.random.get_rng_state() + + if is_torch_mlu_available(): + if self.args.parallel_mode == ParallelMode.DISTRIBUTED: + rng_states["mlu"] = torch.mlu.random.get_rng_state_all() + else: + rng_states["mlu"] = torch.mlu.random.get_rng_state() + + if is_torch_musa_available(): + if self.args.parallel_mode == ParallelMode.DISTRIBUTED: + rng_states["musa"] = torch.musa.get_rng_state_all() + else: + rng_states["musa"] = torch.musa.get_rng_state() + + # A process can arrive here before the process 0 has a chance to save the model, in which case output_dir may + # not yet exist. + os.makedirs(output_dir, exist_ok=True) + + if self.args.world_size <= 1: + torch.save(rng_states, os.path.join(output_dir, "rng_state.pth")) + else: + torch.save(rng_states, os.path.join(output_dir, f"rng_state_{self.args.process_index}.pth")) + + def _save_optimizer_and_scheduler(self, output_dir: str) -> None: + """Save optimizer and learning rate scheduler states to `output_dir`.""" + if is_torch_xla_available(): + xm.rendezvous("saving_optimizer_states") + if self.is_fsdp_xla_v1_enabled: + optm = { + "optimizer": self.optimizer.state_dict(), + "shard_metadata": self.model.get_shard_metadata(), + } + xm.save( + optm, + os.path.join( + output_dir, f"rank{self.args.process_index}-of-{self.args.world_size}-{OPTIMIZER_NAME}" + ), + master_only=False, + ) + else: + xm.save(self.optimizer.state_dict(), os.path.join(output_dir, OPTIMIZER_NAME)) + with warnings.catch_warnings(record=True) as caught_warnings: + xm.save(self.lr_scheduler.state_dict(), os.path.join(output_dir, SCHEDULER_NAME)) + reissue_pt_warnings(caught_warnings) + elif is_sagemaker_mp_enabled(): + opt_state_dict = self.optimizer.local_state_dict(gather_if_shard=False) + smp.barrier() + if smp.rdp_rank() == 0 or smp.state.cfg.shard_optimizer_state: + smp.save( + opt_state_dict, + os.path.join(output_dir, OPTIMIZER_NAME), + partial=True, + v3=smp.state.cfg.shard_optimizer_state, + ) + elif self.is_deepspeed_enabled: + # under zero3 model file itself doesn't get saved since it's bogus! Unless deepspeed + # config `stage3_gather_16bit_weights_on_model_save` is True + accept_exclude_frozen_parameters = "exclude_frozen_parameters" in set( + inspect.signature(self.model_wrapped.save_checkpoint).parameters.keys() + ) + if accept_exclude_frozen_parameters and _is_peft_model(self.model): + self.model_wrapped.save_checkpoint(output_dir, exclude_frozen_parameters=True) + else: + self.model_wrapped.save_checkpoint(output_dir) + elif self.is_fsdp_enabled: + # save fsdp specific ckpt for resuming from ckpt + save_fsdp_model( + self.accelerator.state.fsdp_plugin, self.accelerator, self.model, output_dir, **get_fsdp_ckpt_kwargs() + ) + save_fsdp_optimizer( + self.accelerator.state.fsdp_plugin, self.accelerator, self.optimizer, self.model, output_dir + ) + elif self.args.should_save: + # deepspeed.save_checkpoint above saves model/optim/sched + torch.save(self.optimizer.state_dict(), os.path.join(output_dir, OPTIMIZER_NAME)) + + # Save SCHEDULER & SCALER + is_deepspeed_custom_scheduler = self.is_deepspeed_enabled and not isinstance( + self.lr_scheduler, DeepSpeedSchedulerWrapper + ) + if ( + self.args.should_save + and (not self.is_deepspeed_enabled or is_deepspeed_custom_scheduler) + and not is_torch_xla_available() + ): + with warnings.catch_warnings(record=True) as caught_warnings: + torch.save(self.lr_scheduler.state_dict(), os.path.join(output_dir, SCHEDULER_NAME)) + reissue_pt_warnings(caught_warnings) + + def _save_scaler(self, output_dir: str) -> None: + """Save the gradient scaler state if one exists.""" + # See if there is a scaler attribute + try: + scaler = self.accelerator.scaler + except AttributeError: + return + if scaler is None: + return + if is_torch_xla_available(): + xm.rendezvous("saving_scaler_state") + with warnings.catch_warnings(record=True) as caught_warnings: + xm.save(self.accelerator.scaler.state_dict(), os.path.join(output_dir, SCALER_NAME)) + reissue_pt_warnings(caught_warnings) + + # Save SCALER + if self.args.should_save and not is_torch_xla_available(): + with warnings.catch_warnings(record=True) as caught_warnings: + torch.save(self.accelerator.scaler.state_dict(), os.path.join(output_dir, SCALER_NAME)) + reissue_pt_warnings(caught_warnings) + + # ---- Checkpoint Resuming ---- + + def _load_from_checkpoint(self, resume_from_checkpoint: str, model: nn.Module | None = None) -> None: + """Load model weights from a checkpoint directory.""" + if model is None: + model = self.model + + config_file = os.path.join(resume_from_checkpoint, CONFIG_NAME) + adapter_weights_file = os.path.join(resume_from_checkpoint, ADAPTER_WEIGHTS_NAME) + adapter_safe_weights_file = os.path.join(resume_from_checkpoint, ADAPTER_SAFE_WEIGHTS_NAME) + weights_file = os.path.join(resume_from_checkpoint, WEIGHTS_NAME) + weights_index_file = os.path.join(resume_from_checkpoint, WEIGHTS_INDEX_NAME) + safe_weights_file = os.path.join(resume_from_checkpoint, SAFE_WEIGHTS_NAME) + safe_weights_index_file = os.path.join(resume_from_checkpoint, SAFE_WEIGHTS_INDEX_NAME) + is_fsdp_ckpt = os.path.isdir(resume_from_checkpoint) and ( + # this checks the FSDP state dict when `SHARDED_STATE_DICT` is used + any( + FSDP_MODEL_NAME in folder_name + for folder_name in os.listdir(resume_from_checkpoint) + if os.path.isdir(os.path.join(resume_from_checkpoint, folder_name)) + ) + # this checks the FSDP state dict when `FULL_STATE_DICT` is used + or os.path.isfile(os.path.join(resume_from_checkpoint, f"{FSDP_MODEL_NAME}.bin")) + ) + # if multiple adapters exist, they get saved in sub directories + adapter_subdirs = ( + [ + folder_name + for folder_name in os.listdir(resume_from_checkpoint) + if os.path.isdir(os.path.join(resume_from_checkpoint, folder_name)) + and ( + os.path.isfile(os.path.join(resume_from_checkpoint, folder_name, ADAPTER_WEIGHTS_NAME)) + or os.path.isfile(os.path.join(resume_from_checkpoint, folder_name, ADAPTER_SAFE_WEIGHTS_NAME)) + ) + ] + if os.path.isdir(resume_from_checkpoint) + else [] + ) + + if is_fsdp_ckpt and not self.is_fsdp_enabled: + raise ValueError(f"Checkpoint found at {resume_from_checkpoint} is only supported when using PyTorch FSDP") + + if not ( + any( + os.path.isfile(f) + for f in [ + weights_file, + safe_weights_file, + weights_index_file, + safe_weights_index_file, + adapter_weights_file, + adapter_safe_weights_file, + ] + ) + or is_fsdp_ckpt + or adapter_subdirs + ): + raise ValueError(f"Can't find a valid checkpoint at {resume_from_checkpoint}") + + logger.info(f"Loading model from {resume_from_checkpoint}.") + + if os.path.isfile(config_file): + config = PreTrainedConfig.from_json_file(config_file) + checkpoint_version = config.transformers_version + if checkpoint_version is not None and checkpoint_version != __version__: + logger.warning( + f"You are resuming training from a checkpoint trained with {checkpoint_version} of " + f"Transformers but your current version is {__version__}. This is not recommended and could " + "yield to errors or unwanted behaviors." + ) + + if os.path.isfile(weights_file) or os.path.isfile(safe_weights_file) or is_fsdp_ckpt: + # If the model is on the GPU, it still works! + if is_sagemaker_mp_enabled(): + smp.resume_from_checkpoint( + path=resume_from_checkpoint, tag=WEIGHTS_NAME, partial=False, load_optimizer=False + ) + elif self.is_fsdp_enabled: + load_fsdp_model( + self.accelerator.state.fsdp_plugin, + self.accelerator, + model, + resume_from_checkpoint, + **get_fsdp_ckpt_kwargs(), + ) + else: + # We load the model state dict on the CPU to avoid an OOM error. + if os.path.isfile(safe_weights_file): + state_dict = safetensors.torch.load_file(safe_weights_file, device="cpu") + else: + check_torch_load_is_safe() + state_dict = torch.load(weights_file, map_location="cpu", weights_only=True) + + # workaround for FSDP bug https://github.com/pytorch/pytorch/issues/82963 + # which takes *args instead of **kwargs + load_result = model.load_state_dict(state_dict, False) + # release memory + del state_dict + self._issue_warnings_after_load(load_result) + + # Load adapters following PR # 24096 + elif _is_peft_model(model): + # If training a model using PEFT, assume that adapter have been saved properly. + if hasattr(model, "active_adapters") and hasattr(model, "load_adapter"): + if os.path.exists(resume_from_checkpoint): + active_adapters = model.active_adapters + if len(active_adapters) > 1: + logger.warning("Multiple active adapters detected will only consider the first adapter") + active_adapter = active_adapters[0] + + if adapter_subdirs: + for subdir_name in adapter_subdirs: + peft_id = os.path.join(resume_from_checkpoint, subdir_name) + model.load_adapter(peft_id, subdir_name, is_trainable=(subdir_name == active_adapter)) + model.set_adapter(active_adapter) + else: + model.load_adapter(resume_from_checkpoint, active_adapter, is_trainable=True) + else: + logger.warning( + "The intermediate checkpoints of PEFT may not be saved correctly, " + f"consider using a custom callback to save {ADAPTER_WEIGHTS_NAME} in corresponding saving folders. " + "Check some examples here: https://github.com/huggingface/peft/issues/96" + ) + else: + logger.warning(f"Could not load adapter model, make sure to have PEFT >= {MIN_PEFT_VERSION} installed") + else: + # We load the sharded checkpoint + load_result = load_sharded_checkpoint(model, resume_from_checkpoint, strict=is_sagemaker_mp_enabled()) + if not is_sagemaker_mp_enabled(): + self._issue_warnings_after_load(load_result) + + def _load_best_model(self) -> None: + """Load the best model found during training based on the tracked metric.""" + logger.info(f"Loading best model from {self.state.best_model_checkpoint} (score: {self.state.best_metric}).") + best_model_path = os.path.join(self.state.best_model_checkpoint, WEIGHTS_NAME) + best_safe_model_path = os.path.join(self.state.best_model_checkpoint, SAFE_WEIGHTS_NAME) + best_adapter_model_path = os.path.join(self.state.best_model_checkpoint, ADAPTER_WEIGHTS_NAME) + best_safe_adapter_model_path = os.path.join(self.state.best_model_checkpoint, ADAPTER_SAFE_WEIGHTS_NAME) + + model = self.model_wrapped if is_sagemaker_mp_enabled() else self.model + if self.is_deepspeed_enabled: + deepspeed_load_checkpoint( + self.model_wrapped, + self.state.best_model_checkpoint, + load_module_strict=not _is_peft_model(self.model), + ) + elif self.is_fsdp_enabled: + load_result = load_fsdp_model( + self.accelerator.state.fsdp_plugin, + self.accelerator, + model, + self.state.best_model_checkpoint, + **get_fsdp_ckpt_kwargs(), + ) + elif ( + os.path.exists(best_model_path) + or os.path.exists(best_safe_model_path) + or os.path.exists(best_adapter_model_path) + or os.path.exists(best_safe_adapter_model_path) + ): + has_been_loaded = True + if is_sagemaker_mp_enabled(): + smp.resume_from_checkpoint( + path=self.state.best_model_checkpoint, + tag=WEIGHTS_NAME, + partial=False, + load_optimizer=False, + ) + else: + if _is_peft_model(model): + # If training a model using PEFT, assume that adapter have been saved properly. + if hasattr(model, "active_adapters") and hasattr(model, "load_adapter"): + active_adapter = model.active_adapters[0] + if len(model.active_adapters) > 1: + logger.warning("Detected multiple active adapters, will only consider the first one") + + if os.path.exists(best_adapter_model_path) or os.path.exists(best_safe_adapter_model_path): + try: + model.load_adapter(self.state.best_model_checkpoint, active_adapter) + except RuntimeError as exc: + if model.peft_config[active_adapter].is_prompt_learning: + # for context: https://github.com/huggingface/peft/issues/2256 + msg = ( + "When using prompt learning PEFT methods such as " + f"{model.peft_config[active_adapter].peft_type.value}, setting " + "load_best_model_at_end=True can lead to errors, it is recommended " + "to set this to False and to load the model manually from the checkpoint " + "directory using PeftModel.from_pretrained(base_model, ) after training " + "has finished." + ) + raise RuntimeError(msg) from exc + else: + raise + # Load_adapter has no return value present, modify it when appropriate. + from torch.nn.modules.module import _IncompatibleKeys + + load_result = _IncompatibleKeys([], []) + else: + logger.warning( + "The intermediate checkpoints of PEFT may not be saved correctly, " + f"consider using a custom callback to save {ADAPTER_WEIGHTS_NAME} in corresponding saving folders. " + "Check some examples here: https://github.com/huggingface/peft/issues/96" + ) + has_been_loaded = False + else: + logger.warning( + f"Could not load adapter model, make sure to have PEFT >= {MIN_PEFT_VERSION} installed" + ) + has_been_loaded = False + else: + # We load the model state dict on the CPU to avoid an OOM error. + if os.path.isfile(best_safe_model_path): + state_dict = safetensors.torch.load_file(best_safe_model_path, device="cpu") + else: + check_torch_load_is_safe() + state_dict = torch.load(best_model_path, map_location="cpu", weights_only=True) + + # If the model is on the GPU, it still works! + # workaround for FSDP bug https://github.com/pytorch/pytorch/issues/82963 + # which takes *args instead of **kwargs + load_result = model.load_state_dict(state_dict, False) + if not is_sagemaker_mp_enabled() and has_been_loaded: + self._issue_warnings_after_load(load_result) + elif os.path.exists(os.path.join(self.state.best_model_checkpoint, SAFE_WEIGHTS_INDEX_NAME)) or os.path.exists( + os.path.join(self.state.best_model_checkpoint, WEIGHTS_INDEX_NAME) + ): + load_result = load_sharded_checkpoint( + model, self.state.best_model_checkpoint, strict=is_sagemaker_mp_enabled() + ) + if not is_sagemaker_mp_enabled(): + self._issue_warnings_after_load(load_result) + else: + logger.warning( + f"Could not locate the best model at {best_model_path}, if you are running a distributed training " + "on multiple nodes, you should activate `--save_on_each_node`." + ) + + def _load_rng_state(self, checkpoint: str | None) -> None: + """Restore random number generator states from a checkpoint.""" + # Load RNG states from `checkpoint` + if checkpoint is None: + return + + if self.args.world_size > 1: + process_index = self.args.process_index + rng_file = os.path.join(checkpoint, f"rng_state_{process_index}.pth") + if not os.path.isfile(rng_file): + logger.info( + f"Didn't find an RNG file for process {process_index}, if you are resuming a training that " + "wasn't launched in a distributed fashion, reproducibility is not guaranteed." + ) + return + else: + rng_file = os.path.join(checkpoint, "rng_state.pth") + if not os.path.isfile(rng_file): + logger.info( + "Didn't find an RNG file, if you are resuming a training that was launched in a distributed " + "fashion, reproducibility is not guaranteed." + ) + return + + with safe_globals(): + check_torch_load_is_safe() + checkpoint_rng_state = torch.load(rng_file, weights_only=True) + random.setstate(checkpoint_rng_state["python"]) + np.random.set_state(checkpoint_rng_state["numpy"]) + torch.random.set_rng_state(checkpoint_rng_state["cpu"]) + if is_torch_xla_available(): + xm.set_rng_state(checkpoint_rng_state["xla"]) + + is_distributed = self.args.parallel_mode == ParallelMode.DISTRIBUTED + if torch.cuda.is_available(): + set_rng_state_for_device("CUDA", torch.cuda, checkpoint_rng_state, is_distributed) + if is_torch_npu_available(): + set_rng_state_for_device("NPU", torch.npu, checkpoint_rng_state, is_distributed) + if is_torch_hpu_available(): + set_rng_state_for_device("HPU", torch.hpu, checkpoint_rng_state, is_distributed) + if is_torch_mlu_available(): + set_rng_state_for_device("MLU", torch.mlu, checkpoint_rng_state, is_distributed) + if is_torch_musa_available(): + set_rng_state_for_device("MUSA", torch.musa, checkpoint_rng_state, is_distributed) + + def _load_optimizer_and_scheduler(self, checkpoint: str | None) -> None: + """If optimizer and scheduler states exist, load them.""" + if checkpoint is None: + return + + if self.is_deepspeed_enabled: + # deepspeed loads optimizer/lr_scheduler together with the model in deepspeed_init + if not isinstance(self.lr_scheduler, DeepSpeedSchedulerWrapper): + with warnings.catch_warnings(record=True) as caught_warnings: + check_torch_load_is_safe() + self.lr_scheduler.load_state_dict( + torch.load(os.path.join(checkpoint, SCHEDULER_NAME), weights_only=True) + ) + reissue_pt_warnings(caught_warnings) + return + + checkpoint_file_exists = ( + glob.glob(os.path.join(checkpoint, OPTIMIZER_NAME) + "_*") + if is_sagemaker_mp_enabled() + else ( + os.path.isfile(os.path.join(checkpoint, OPTIMIZER_NAME)) + or os.path.isfile(os.path.join(checkpoint, OPTIMIZER_NAME_BIN)) + or ( + os.path.isdir(checkpoint) + and any( + OPTIMIZER_NAME_BIN.split(".")[0] in folder_name + for folder_name in os.listdir(checkpoint) + if os.path.isdir(os.path.join(checkpoint, folder_name)) + ) + ) + ) + ) + checkpoint_file_exists = ( + glob.glob(os.path.join(checkpoint, f"rank*-of-{self.args.world_size}-{OPTIMIZER_NAME}")) + if self.is_fsdp_xla_v1_enabled + else checkpoint_file_exists + ) + if checkpoint_file_exists and os.path.isfile(os.path.join(checkpoint, SCHEDULER_NAME)): + # Load in optimizer and scheduler states + if is_torch_xla_available(): + # On TPU we have to take some extra precautions to properly load the states on the right device. + if self.is_fsdp_xla_v1_enabled: + check_torch_load_is_safe() + optimizer_state = torch.load( + os.path.join( + checkpoint, f"rank{self.args.process_index}-of-{self.args.world_size}-{OPTIMIZER_NAME}" + ), + map_location="cpu", + weights_only=True, + ) + # We only need `optimizer` when resuming from checkpoint + optimizer_state = optimizer_state["optimizer"] + else: + check_torch_load_is_safe() + optimizer_state = torch.load( + os.path.join(checkpoint, OPTIMIZER_NAME), map_location="cpu", weights_only=True + ) + with warnings.catch_warnings(record=True) as caught_warnings: + check_torch_load_is_safe() + lr_scheduler_state = torch.load( + os.path.join(checkpoint, SCHEDULER_NAME), map_location="cpu", weights_only=True + ) + reissue_pt_warnings(caught_warnings) + + xm.send_cpu_data_to_device(optimizer_state, self.args.device) + xm.send_cpu_data_to_device(lr_scheduler_state, self.args.device) + + self.optimizer.load_state_dict(optimizer_state) + self.lr_scheduler.load_state_dict(lr_scheduler_state) + else: + if is_sagemaker_mp_enabled(): + + def opt_load_hook(mod, opt): + opt.load_state_dict(smp.load(os.path.join(checkpoint, OPTIMIZER_NAME), partial=True)) + + self.model_wrapped.register_post_step_hook(opt_load_hook) + else: + # We use the CPU when training on one GPU to avoid OOM for GPU RAM when training big models. + # In distributed training however, we load directly on each GPU and risk the GPU OOM as it's more + # likely to get OOM on CPU (since we load num_gpu times the optimizer state + map_location = self.args.device if self.args.world_size > 1 else "cpu" + if self.is_fsdp_enabled: + load_fsdp_optimizer( + self.accelerator.state.fsdp_plugin, + self.accelerator, + self.optimizer, + self.model, + checkpoint, + **get_fsdp_ckpt_kwargs(), + ) + else: + check_torch_load_is_safe() + self.optimizer.load_state_dict( + torch.load( + os.path.join(checkpoint, OPTIMIZER_NAME), map_location=map_location, weights_only=True + ) + ) + with warnings.catch_warnings(record=True) as caught_warnings: + check_torch_load_is_safe() + self.lr_scheduler.load_state_dict( + torch.load(os.path.join(checkpoint, SCHEDULER_NAME), weights_only=True) + ) + reissue_pt_warnings(caught_warnings) + + def _load_scaler(self, checkpoint: str | None) -> None: + """If scaler state exists, load it.""" + if checkpoint is None: + return + + checkpoint_file_exists = os.path.isfile(os.path.join(checkpoint, SCALER_NAME)) + + if checkpoint_file_exists: + # On TPU we have to take some extra precautions to properly load the states on the right device. + # Load in scaler states + if is_torch_xla_available(): + with warnings.catch_warnings(record=True) as caught_warnings: + check_torch_load_is_safe() + scaler_state = torch.load( + os.path.join(checkpoint, SCALER_NAME), map_location="cpu", weights_only=True + ) + reissue_pt_warnings(caught_warnings) + xm.send_cpu_data_to_device(scaler_state, self.args.device) + self.accelerator.scaler.load_state_dict(scaler_state) + else: + with warnings.catch_warnings(record=True) as caught_warnings: + check_torch_load_is_safe() + self.accelerator.scaler.load_state_dict( + torch.load(os.path.join(checkpoint, SCALER_NAME), weights_only=True) + ) + reissue_pt_warnings(caught_warnings) + + def _load_callback_state(self) -> None: + """If callback states exist and were passed in, restore their states if enabled""" + if not self.args.restore_callback_states_from_checkpoint: + return + # Callback states are stored in stateful_callbacks + not_found = [] + new_callbacks = [] + original_callbacks = self.callback_handler.callbacks + [self.control] + for stored_callback, data in self.state.stateful_callbacks.items(): + if not isinstance(data, list): + data = [data] + if any(callback.__class__.__name__ == stored_callback for callback in original_callbacks): + # We can load/restore from multiple callbacks of the same type. + duplicates = [ + callback for callback in original_callbacks if callback.__class__.__name__ == stored_callback + ] + for callback, callback_data in zip(duplicates, data): + args = callback_data.get("args", {}) + attributes = callback_data.get("attributes", {}) + new_callback = type(callback)(**args) + for attribute, value in attributes.items(): + setattr(new_callback, attribute, value) + if isinstance(callback, TrainerControl): + # Specifically for restoring the `control` state + self.control = new_callback + else: + new_callbacks.append(new_callback) + # We remove the existing callback and add it to the list of new callbacks + self.callback_handler.remove_callback(type(new_callback)) + logger.info("Continuing training from checkpoint, restoring any callbacks that were passed in") + else: + not_found.append(stored_callback) + if len(not_found) > 0: + logger.warning( + f"Checkpoint included callbacks not included in current configuration. Ignoring. ({', '.join(not_found)})" + ) + for callback in new_callbacks: + self.callback_handler.add_callback(callback) + + def _issue_warnings_after_load(self, load_result: Any) -> None: + """Log warnings for missing or unexpected keys after loading a checkpoint.""" + if len(load_result.missing_keys) != 0: + if self.model._keys_to_ignore_on_save is not None and set(load_result.missing_keys) == set( + self.model._keys_to_ignore_on_save + ): + self.model.tie_weights() + else: + logger.warning(f"There were missing keys in the checkpoint model loaded: {load_result.missing_keys}.") + if len(load_result.unexpected_keys) != 0: + logger.warning( + f"There were unexpected keys in the checkpoint model loaded: {load_result.unexpected_keys}." + ) + + # ---- Saving & Serialization ---- + + def save_model(self, output_dir: str | None = None, _internal_call: bool = False) -> None: + """ + Will save the model, so you can reload it using `from_pretrained()`. + + Will only save from the main process. + """ + + if output_dir is None: + output_dir = self.args.output_dir + + if is_torch_xla_available(): + save_tpu_checkpoint( + self.model, self.args, self.accelerator, self.processing_class, self.is_fsdp_xla_v1_enabled, output_dir + ) + elif is_sagemaker_mp_enabled(): + # Calling the state_dict needs to be done on the wrapped model and on all processes. + os.makedirs(output_dir, exist_ok=True) + state_dict = self.model_wrapped.state_dict() + if self.args.should_save: + self._save(output_dir, state_dict=state_dict) + Path(os.path.join(output_dir, "user_content.pt")).touch() + elif self.is_fsdp_enabled: + if "FULL_STATE_DICT" in str(self.accelerator.state.fsdp_plugin.state_dict_type): + state_dict = self.accelerator.get_state_dict(self.model) + if self.args.should_save: + self._save(output_dir, state_dict=state_dict) + elif self.is_deepspeed_enabled: + try: + accept_exclude_frozen_parameters = "exclude_frozen_parameters" in set( + inspect.signature(self.model_wrapped.save_checkpoint).parameters.keys() + ) + zero3_sharding = self.deepspeed.config.get("zero_optimization", {}).get("stage", None) == 3 + if accept_exclude_frozen_parameters and _is_peft_model(self.model) and zero3_sharding: + # When using PEFT with DeepSpeed ZeRO Stage 3, + # we do not need to load the frozen parameters + state_dict = self.deepspeed._zero3_consolidated_16bit_state_dict(exclude_frozen_parameters=True) + else: + state_dict = self.accelerator.get_state_dict(self.deepspeed) + if self.args.should_save: + self._save(output_dir, state_dict=state_dict) + except ValueError: + logger.warning( + " stage3_gather_16bit_weights_on_model_save=false. Saving the full checkpoint instead, use" + " zero_to_fp32.py to recover weights" + ) + if self.args.should_save: + self._save(output_dir, state_dict={}) + # remove the dummy state_dict + remove_dummy_checkpoint(self.args.should_save, output_dir, [WEIGHTS_NAME, SAFE_WEIGHTS_NAME]) + self.model_wrapped.save_checkpoint(output_dir) + + elif self.args.should_save: + self._save(output_dir) + + # Push to the Hub when `save_model` is called by the user. + if self.args.push_to_hub and not _internal_call: + self.push_to_hub(commit_message="Model save", revision=self.args.hub_revision) + + def _save(self, output_dir: str | None = None, state_dict: dict | None = None) -> None: + """Save model weights, configuration, and processing class to `output_dir`.""" + # If we are executing this function, we are the process zero, so we don't check for that. + output_dir = output_dir if output_dir is not None else self.args.output_dir + os.makedirs(output_dir, exist_ok=True) + logger.info(f"Saving model checkpoint to {output_dir}") + + supported_classes = (PreTrainedModel,) if not is_peft_available() else (PreTrainedModel, PeftModel) + # Save a trained model and configuration using `save_pretrained()`. + # They can then be reloaded using `from_pretrained()` + if not isinstance(self.model, supported_classes): + if state_dict is None: + state_dict = self.model.state_dict() + + if isinstance(self.accelerator.unwrap_model(self.model, keep_torch_compile=False), supported_classes): + self.accelerator.unwrap_model(self.model, keep_torch_compile=False).save_pretrained( + output_dir, state_dict=state_dict + ) + else: + logger.info("Trainer.model is not a `PreTrainedModel`, only saving its state dict.") + safetensors.torch.save_file( + state_dict, os.path.join(output_dir, SAFE_WEIGHTS_NAME), metadata={"format": "pt"} + ) + else: + self.model.save_pretrained(output_dir, state_dict=state_dict) + + if self.processing_class is not None: + self.processing_class.save_pretrained(output_dir) + elif ( + self.data_collator is not None + and hasattr(self.data_collator, "tokenizer") + and self.data_collator.tokenizer is not None + ): + logger.info("Saving Trainer.data_collator.tokenizer by default as Trainer.processing_class is `None`") + self.data_collator.tokenizer.save_pretrained(output_dir) + + # Good practice: save your training arguments together with the trained model + torch.save(self.args, os.path.join(output_dir, TRAINING_ARGS_NAME)) + + # ---- Logging & Metrics ---- + + def log(self, logs: dict[str, float], start_time: float | None = None) -> None: + """ + Log `logs` on the various objects watching training. + + Subclass and override this method to inject custom behavior. + + Args: + logs (`dict[str, float]`): + The values to log. + start_time (`Optional[float]`): + The start of training. + """ + if self.state.epoch is not None: + logs["epoch"] = self.state.epoch + if self.args.include_num_input_tokens_seen != "no": + logs["num_input_tokens_seen"] = self.state.num_input_tokens_seen + if start_time is not None: + current_session_num_tokens = ( + self.state.num_input_tokens_seen - self.initial_num_input_tokens_seen_for_session + ) + logs.update(speed_metrics("train", start_time, num_tokens=current_session_num_tokens)) + + output = {**logs, "step": self.state.global_step} + self.state.log_history.append(output) + self.control = self.callback_handler.on_log(self.args, self.state, self.control, logs) + + def store_flos(self) -> None: + """Store the number of floating-point operations that went into the model.""" + if self.args.parallel_mode == ParallelMode.DISTRIBUTED: + self.state.total_flos += ( + distributed_broadcast_scalars([self.current_flos], device=self.args.device).sum().item() + ) + self.current_flos = 0 + else: + self.state.total_flos += self.current_flos + self.current_flos = 0 + + def floating_point_ops(self, inputs: dict[str, torch.Tensor | Any]) -> int: + """ + For models that inherit from [`PreTrainedModel`], uses that method to compute the number of floating point + operations for every backward + forward pass. If using another model, either implement such a method in the + model or subclass and override this method. + + Args: + inputs (`dict[str, torch.Tensor | Any]`): + The inputs and targets of the model. + + Returns: + `int`: The number of floating-point operations. + """ + if (main_input := getattr(self.model, "main_input_name", "input_ids")) in inputs and hasattr( + self.model, "num_parameters" + ): + return 6 * inputs[main_input].numel() * self.model.num_parameters(exclude_embeddings=True) + return 0 + + # ---- Hub Integration ---- + + def init_hf_repo(self, token: str | None = None) -> None: + """ + Initializes a git repo in `self.args.hub_model_id`. + """ + # Only on process zero + if not self.is_world_process_zero(): + return + + if self.args.hub_model_id is None: + repo_name = Path(self.args.output_dir).absolute().name + else: + repo_name = self.args.hub_model_id + + token = token if token is not None else self.args.hub_token + repo_url = create_repo(repo_name, token=token, private=self.args.hub_private_repo, exist_ok=True) + self.hub_model_id = repo_url.repo_id + self.push_in_progress = None + + def create_model_card( + self, + language: str | None = None, + license: str | None = None, + tags: str | list[str] | None = None, + model_name: str | None = None, + finetuned_from: str | None = None, + tasks: str | list[str] | None = None, + dataset_tags: str | list[str] | None = None, + dataset: str | list[str] | None = None, + dataset_args: str | list[str] | None = None, + ) -> None: + """ + Creates a draft of a model card using the information available to the `Trainer`. + + Args: + language (`str`, *optional*): + The language of the model (if applicable) + license (`str`, *optional*): + The license of the model. Will default to the license of the pretrained model used, if the original + model given to the `Trainer` comes from a repo on the Hub. + tags (`str` or `list[str]`, *optional*): + Some tags to be included in the metadata of the model card. + model_name (`str`, *optional*): + The name of the model. + finetuned_from (`str`, *optional*): + The name of the model used to fine-tune this one (if applicable). Will default to the name of the repo + of the original model given to the `Trainer` (if it comes from the Hub). + tasks (`str` or `list[str]`, *optional*): + One or several task identifiers, to be included in the metadata of the model card. + dataset_tags (`str` or `list[str]`, *optional*): + One or several dataset tags, to be included in the metadata of the model card. + dataset (`str` or `list[str]`, *optional*): + One or several dataset identifiers, to be included in the metadata of the model card. + dataset_args (`str` or `list[str]`, *optional*): + One or several dataset arguments, to be included in the metadata of the model card. + """ + if not self.is_world_process_zero(): + return + + model_card_filepath = os.path.join(self.args.output_dir, "README.md") + is_peft_library = False + if os.path.exists(model_card_filepath): + library_name = ModelCard.load(model_card_filepath).data.get("library_name") + is_peft_library = library_name == "peft" + + # Append existing tags in `tags` + existing_tags = ModelCard.load(model_card_filepath).data.tags + if tags is not None and existing_tags is not None: + if isinstance(tags, str): + tags = [tags] + for tag in existing_tags: + if tag not in tags: + tags.append(tag) + + training_summary = TrainingSummary.from_trainer( + self, + language=language, + license=license, + tags=tags, + model_name=model_name, + finetuned_from=finetuned_from, + tasks=tasks, + dataset_tags=dataset_tags, + dataset=dataset, + dataset_args=dataset_args, + ) + model_card = training_summary.to_model_card() + with open(model_card_filepath, "w") as f: + f.write(model_card) + + if is_peft_library: + self.accelerator.unwrap_model(self.model).create_or_update_model_card(self.args.output_dir) + + def push_to_hub( + self, + commit_message: str | None = "End of training", + blocking: bool = True, + token: str | None = None, + revision: str | None = None, + **kwargs, + ) -> CommitInfo: + """ + Upload `self.model` and `self.processing_class` to the 🤗 model hub on the repo `self.args.hub_model_id`. + + Parameters: + commit_message (`str`, *optional*, defaults to `"End of training"`): + Message to commit while pushing. + blocking (`bool`, *optional*, defaults to `True`): + Whether the function should return only when the `git push` has finished. + token (`str`, *optional*, defaults to `None`): + Token with write permission to overwrite Trainer's original args. + revision (`str`, *optional*): + The git revision to commit from. Defaults to the head of the "main" branch. + kwargs (`dict[str, Any]`, *optional*): + Additional keyword arguments passed along to [`~Trainer.create_model_card`]. + + Returns: + The URL of the repository where the model was pushed if `blocking=False`, or a `Future` object tracking the + progress of the commit if `blocking=True`. + """ + self.callback_handler.on_push_begin(self.args, self.state, self.control) + + model_name = kwargs.pop("model_name", None) + if model_name is None and self.args.should_save: + if self.args.hub_model_id is None: + model_name = Path(self.args.output_dir).name + else: + model_name = self.args.hub_model_id.split("/")[-1] + token = token if token is not None else self.args.hub_token + + # In case the user calls this method with args.push_to_hub = False + if self.hub_model_id is None: + self.init_hf_repo(token=token) + + # Needs to be executed on all processes for TPU training, but will only save on the processed determined by + # self.args.should_save. + self.save_model(_internal_call=True) + + # Only push from one node. + if not self.is_world_process_zero(): + return + + # Add additional tags in the case the model has already some tags and users pass + # "tags" argument to `push_to_hub` so that trainer automatically handles internal tags + # from all models since Trainer does not call `model.push_to_hub`. + if getattr(self.model, "model_tags", None) is not None: + if "tags" not in kwargs: + kwargs["tags"] = [] + + # If it is a string, convert it to a list + if isinstance(kwargs["tags"], str): + kwargs["tags"] = [kwargs["tags"]] + + for model_tag in self.model.model_tags: + if model_tag not in kwargs["tags"]: + kwargs["tags"].append(model_tag) + + self.create_model_card(model_name=model_name, **kwargs) + + if revision is None: + revision = self.args.hub_revision + + # Wait for the current upload to be finished. + self._finish_current_push() + + return upload_folder( + repo_id=self.hub_model_id, + folder_path=self.args.output_dir, + commit_message=commit_message, + token=token, + run_as_future=not blocking, + ignore_patterns=["_*", f"{PREFIX_CHECKPOINT_DIR}-*"], + revision=revision, + ) + + def _push_from_checkpoint(self, checkpoint_folder: str) -> None: + """Push model and checkpoint files to the Hub from a checkpoint folder.""" + if not self.is_world_process_zero() or self.args.hub_strategy == HubStrategy.END: + return + # If we haven't finished the last push, we don't do this one unless args.hub_always_push=True. + if not self.args.hub_always_push and self.push_in_progress is not None and not self.push_in_progress.is_done(): + return + + self.callback_handler.on_push_begin(self.args, self.state, self.control) + output_dir = self.args.output_dir + # To avoid a new synchronization of all model weights, we just copy the file from the checkpoint folder + modeling_files = [CONFIG_NAME, GENERATION_CONFIG_NAME, WEIGHTS_NAME, SAFE_WEIGHTS_NAME] + # Add sharded checkpoints if we have an index + for index_file in [WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_INDEX_NAME]: + index_path = os.path.join(checkpoint_folder, index_file) + if os.path.isfile(index_path): + modeling_files.append(index_file) + with open(index_path) as f: + index = json.loads(f.read()) + shard_files = list(set(index["weight_map"].values())) + modeling_files.extend(shard_files) + if is_peft_available(): + modeling_files.extend([ADAPTER_CONFIG_NAME, ADAPTER_WEIGHTS_NAME, ADAPTER_SAFE_WEIGHTS_NAME]) + for modeling_file in modeling_files: + if os.path.isfile(os.path.join(checkpoint_folder, modeling_file)): + shutil.copy(os.path.join(checkpoint_folder, modeling_file), os.path.join(output_dir, modeling_file)) + # Saving the processing class is fast and we don't know how many files it may have spawned, so we resave it to be sure. + if self.processing_class is not None: + self.processing_class.save_pretrained(output_dir) + # Same for the training arguments + torch.save(self.args, os.path.join(output_dir, TRAINING_ARGS_NAME)) + + if self.args.save_strategy == SaveStrategy.STEPS: + commit_message = f"Training in progress, step {self.state.global_step}" + else: + commit_message = f"Training in progress, epoch {int(self.state.epoch)}" + + model_push_job = upload_folder( + repo_id=self.hub_model_id, + folder_path=output_dir, + commit_message=commit_message, + token=self.args.hub_token, + run_as_future=True, + ignore_patterns=["_*", f"{PREFIX_CHECKPOINT_DIR}-*"], + revision=self.args.hub_revision, + ) + + push_jobs = [model_push_job] + + if self.args.hub_strategy in [HubStrategy.CHECKPOINT, HubStrategy.ALL_CHECKPOINTS]: + path_in_repo = ( + "last-checkpoint" if self.args.hub_strategy == HubStrategy.CHECKPOINT else Path(checkpoint_folder).name + ) + checkpoint_push = upload_folder( + repo_id=self.hub_model_id, + folder_path=checkpoint_folder, + path_in_repo=path_in_repo, + commit_message=commit_message + ", checkpoint", + token=self.args.hub_token, + run_as_future=True, + revision=self.args.hub_revision, + ) + push_jobs.append(checkpoint_push) + + if self.push_in_progress is None or self.push_in_progress.is_done(): + self.push_in_progress = PushInProgress(push_jobs) + else: + self.push_in_progress.jobs.extend(push_jobs) + + def _finish_current_push(self) -> None: + """Wait for any in-progress push to the Hub to complete.""" + if not hasattr(self, "push_in_progress"): + return + if self.push_in_progress is not None and not self.push_in_progress.is_done(): + logger.info("Waiting for the current checkpoint push to be finished, this might take a couple of minutes.") + self.push_in_progress.wait_until_done() + + # ---- Hyperparameter Search ---- + + def hyperparameter_search( + self, + hp_space: Callable[["optuna.Trial"], dict[str, float]] | None = None, + compute_objective: Callable[[dict[str, float]], float] | None = None, + n_trials: int = 20, + direction: str | list[str] = "minimize", + backend: str | HPSearchBackend | None = None, + hp_name: Callable[["optuna.Trial"], str] | None = None, + **kwargs, + ) -> BestRun | list[BestRun]: + """ + Launch an hyperparameter search using `optuna` or `Ray Tune`. The optimized quantity is determined + by `compute_objective`, which defaults to a function returning the evaluation loss when no metric is provided, + the sum of all metrics otherwise. + + + + To use this method, you need to have provided a `model_init` when initializing your [`Trainer`]: we need to + reinitialize the model at each new run. This is incompatible with the `optimizers` argument, so you need to + subclass [`Trainer`] and override the method [`~Trainer.create_optimizer_and_scheduler`] for custom + optimizer/scheduler. + + + + Args: + hp_space (`Callable[["optuna.Trial"], dict[str, float]]`, *optional*): + A function that defines the hyperparameter search space. Will default to + [`~trainer_utils.default_hp_space_optuna`] or [`~trainer_utils.default_hp_space_ray`] + depending on your backend. + compute_objective (`Callable[[dict[str, float]], float]`, *optional*): + A function computing the objective to minimize or maximize from the metrics returned by the `evaluate` + method. Will default to [`~trainer_utils.default_compute_objective`]. + n_trials (`int`, *optional*, defaults to 100): + The number of trial runs to test. + direction (`str` or `list[str]`, *optional*, defaults to `"minimize"`): + If it's single objective optimization, direction is `str`, can be `"minimize"` or `"maximize"`, you + should pick `"minimize"` when optimizing the validation loss, `"maximize"` when optimizing one or + several metrics. If it's multi objectives optimization, direction is `list[str]`, can be List of + `"minimize"` and `"maximize"`, you should pick `"minimize"` when optimizing the validation loss, + `"maximize"` when optimizing one or several metrics. + backend (`str` or [`~training_utils.HPSearchBackend`], *optional*): + The backend to use for hyperparameter search. Will default to optuna or Ray Tune, depending + on which one is installed. If all are installed, will default to optuna. + hp_name (`Callable[["optuna.Trial"], str]]`, *optional*): + A function that defines the trial/run name. Will default to None. + kwargs (`dict[str, Any]`, *optional*): + Additional keyword arguments for each backend: + + - `optuna`: parameters from + [optuna.study.create_study](https://optuna.readthedocs.io/en/stable/reference/generated/optuna.study.create_study.html) + and also the parameters `timeout`, `n_jobs` and `gc_after_trial` from + [optuna.study.Study.optimize](https://optuna.readthedocs.io/en/stable/reference/generated/optuna.study.Study.html#optuna.study.Study.optimize) + - `ray`: parameters from [tune.run](https://docs.ray.io/en/latest/tune/api_docs/execution.html#tune-run). + If `resources_per_trial` is not set in the `kwargs`, it defaults to 1 CPU core and 1 GPU (if available). + If `progress_reporter` is not set in the `kwargs`, + [ray.tune.CLIReporter](https://docs.ray.io/en/latest/tune/api/doc/ray.tune.CLIReporter.html) is used. + Returns: + [`trainer_utils.BestRun` or `list[trainer_utils.BestRun]`]: All the information about the best run or best + runs for multi-objective optimization. Experiment summary can be found in `run_summary` attribute for Ray + backend. + """ + if backend is None: + backend = default_hp_search_backend() + backend = HPSearchBackend(backend) + backend_obj = ALL_HYPERPARAMETER_SEARCH_BACKENDS[backend]() + backend_obj.ensure_available() + self.hp_search_backend = backend + if self.model_init is None: + raise RuntimeError( + "To use hyperparameter search, you need to pass your model through a model_init function." + ) + + self.hp_space = backend_obj.default_hp_space if hp_space is None else hp_space + self.hp_name = hp_name + self.compute_objective = default_compute_objective if compute_objective is None else compute_objective + + best_run = backend_obj.run(self, n_trials, direction, **kwargs) + + self.hp_search_backend = None + return best_run + + def call_model_init(self, trial: "optuna.Trial | dict[str, Any] | None" = None) -> nn.Module: + """Invoke `model_init` to get a fresh model instance, optionally conditioned on a hyperparameter trial.""" + model_init_argcount = number_of_arguments(self.model_init) + if model_init_argcount == 0: + model = self.model_init() + elif model_init_argcount == 1: + model = self.model_init(trial) + else: + raise RuntimeError("model_init should have 0 or 1 argument.") + + if model is None: + raise RuntimeError("model_init should not return None.") + + return model + + def _hp_search_setup(self, trial: "optuna.Trial | dict[str, Any] | None") -> None: + """Set up training arguments and accelerator state for a hyperparameter search trial.""" + self._trial = trial + + if self.hp_search_backend is None or trial is None: + return + if self.hp_search_backend == HPSearchBackend.OPTUNA: + params = self.hp_space(trial) + elif self.hp_search_backend == HPSearchBackend.RAY: + params = trial + params.pop("wandb", None) + elif self.hp_search_backend == HPSearchBackend.WANDB: + params = trial + + for key, value in params.items(): + if not hasattr(self.args, key): + logger.warning( + f"Trying to set {key} in the hyperparameter search but there is no corresponding field in" + " `TrainingArguments`." + ) + continue + old_attr = getattr(self.args, key, None) + # Casting value to the proper type + if old_attr is not None: + value = type(old_attr)(value) + + setattr(self.args, key, value) + if self.hp_search_backend == HPSearchBackend.OPTUNA: + logger.info(f"Trial: {trial.params}") + if self.hp_search_backend == HPSearchBackend.WANDB: + logger.info(f"W&B Sweep parameters: {trial}") + if self.is_deepspeed_enabled: + if self.args.deepspeed is None: + raise ValueError("For sweeps with deepspeed, `args.deepspeed` must be set") + + self.accelerator.free_memory() + + # Rebuild the deepspeed config to reflect the updated training parameters + from accelerate.utils import DeepSpeedPlugin + + from transformers.integrations.deepspeed import HfTrainerDeepSpeedConfig + + self.args.hf_deepspeed_config = HfTrainerDeepSpeedConfig(self.args.deepspeed) + self.args.hf_deepspeed_config.trainer_config_process(self.args) + self.args.deepspeed_plugin = DeepSpeedPlugin(hf_ds_config=self.args.hf_deepspeed_config) + + # From 1.0 on, we need to fully wipe the DS plugin when doing sweeps. + # Simply calling `_reset_state` is enough and doesn't need a version pin. + AcceleratorState()._reset_state() + + self.create_accelerator_and_postprocess() + + def _report_to_hp_search( + self, trial: "optuna.Trial | dict[str, Any] | None", step: int, metrics: dict[str, float] + ) -> None: + """Report intermediate metrics to the active hyperparameter search backend.""" + if self.hp_search_backend is None or trial is None: + return + metrics = metrics.copy() + self.objective = self.compute_objective(metrics) + if self.hp_search_backend == HPSearchBackend.OPTUNA: + import optuna + + if hasattr(trial, "study") and not trial.study._is_multi_objective(): + trial.report(self.objective, step) + if trial.should_prune(): + self.callback_handler.on_train_end(self.args, self.state, self.control) + raise optuna.TrialPruned() + elif self.hp_search_backend == HPSearchBackend.RAY: + import ray.tune + + with tempfile.TemporaryDirectory() as temp_checkpoint_dir: + checkpoint = None + if self.control.should_save: + self._tune_save_checkpoint(checkpoint_dir=temp_checkpoint_dir) + checkpoint = ray.tune.Checkpoint.from_directory(temp_checkpoint_dir) + metrics["objective"] = self.objective + ray.tune.report(metrics, checkpoint=checkpoint) + + def _tune_save_checkpoint(self, checkpoint_dir: str) -> None: + """Save a checkpoint during a Ray Tune hyperparameter search trial.""" + output_dir = os.path.join(checkpoint_dir, f"{PREFIX_CHECKPOINT_DIR}-{self.state.global_step}") + self.save_model(output_dir, _internal_call=True) + if self.args.should_save: + # Update the `TrainerControl` state to where we are currently + self.state.stateful_callbacks["TrainerControl"] = self.control.state() + self.state.save_to_json(os.path.join(output_dir, TRAINER_STATE_NAME)) + torch.save(self.optimizer.state_dict(), os.path.join(output_dir, OPTIMIZER_NAME)) + torch.save(self.lr_scheduler.state_dict(), os.path.join(output_dir, SCHEDULER_NAME)) + + # ---- Callbacks ---- + + def add_callback(self, callback: type[TrainerCallback] | TrainerCallback) -> None: + """ + Add a callback to the current list of [`~transformers.TrainerCallback`]. + + Args: + callback (`type` or [`~transformers.TrainerCallback]`): + A [`~transformers.TrainerCallback`] class or an instance of a [`~transformers.TrainerCallback`]. In the + first case, will instantiate a member of that class. + """ + self.callback_handler.add_callback(callback) + + def pop_callback(self, callback: type[TrainerCallback] | TrainerCallback) -> TrainerCallback | None: + """ + Remove a callback from the current list of [`~transformers.TrainerCallback`] and returns it. + + If the callback is not found, returns `None` (and no error is raised). + + Args: + callback (`type` or [`~transformers.TrainerCallback]`): + A [`~transformers.TrainerCallback`] class or an instance of a [`~transformers.TrainerCallback`]. In the + first case, will pop the first member of that class found in the list of callbacks. + + Returns: + [`~transformers.TrainerCallback`]: The callback removed, if found. + """ + return self.callback_handler.pop_callback(callback) + + def remove_callback(self, callback: type[TrainerCallback] | TrainerCallback) -> None: + """ + Remove a callback from the current list of [`~transformers.TrainerCallback`]. + + Args: + callback (`type` or [`~transformers.TrainerCallback]`): + A [`~transformers.TrainerCallback`] class or an instance of a [`~transformers.TrainerCallback`]. In the + first case, will remove the first member of that class found in the list of callbacks. + """ + self.callback_handler.remove_callback(callback) + + # ---- Utilities ---- + + def is_local_process_zero(self) -> bool: + """ + Whether or not this process is the local (e.g., on one machine if training in a distributed fashion on several + machines) main process. + """ + return self.args.local_process_index == 0 + + def is_world_process_zero(self) -> bool: + """ + Whether or not this process is the global main process (when training in a distributed fashion on several + machines, this is only going to be `True` for one process). + """ + # Special case for SageMaker ModelParallel since there process_index is dp_process_index, not the global + # process index. + if is_sagemaker_mp_enabled(): + return smp.rank() == 0 + return self.args.process_index == 0 + + def _move_model_to_device(self, model: nn.Module, device: torch.device) -> None: + """Move the model to the specified device, re-tying weights on XLA if needed.""" + if getattr(model, "hf_device_map", None) is not None: + logger.warning( + "The model is already on multiple devices. Skipping the move to device specified in `args`." + ) + return + model = model.to(device) + # Moving a model to an XLA device disconnects the tied weights, so we have to retie them. + if self.args.parallel_mode == ParallelMode.TPU and hasattr(model, "tie_weights"): + model.tie_weights() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_callback.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_callback.py new file mode 100644 index 0000000000000000000000000000000000000000..92d61eba1ca27f942e925679f5b57b1d40735759 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_callback.py @@ -0,0 +1,776 @@ +# Copyright 2020-present the HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Callbacks to use with the Trainer class and customize the training loop. +""" + +import dataclasses +import json +import math +from dataclasses import dataclass + +import numpy as np +from tqdm.auto import tqdm + +from .trainer_utils import IntervalStrategy, SaveStrategy, has_length +from .training_args import TrainingArguments +from .utils import logging + + +logger = logging.get_logger(__name__) + + +@dataclass +class TrainerState: + """ + A class containing the [`Trainer`] inner state that will be saved along the model and optimizer when checkpointing + and passed to the [`TrainerCallback`]. + + + + In all this class, one step is to be understood as one update step. When using gradient accumulation, one update + step may require several forward and backward passes: if you use `gradient_accumulation_steps=n`, then one update + step requires going through *n* batches. + + + + Args: + epoch (`float`, *optional*): + Only set during training, will represent the epoch the training is at (the decimal part being the + percentage of the current epoch completed). + global_step (`int`, *optional*, defaults to 0): + During training, represents the number of update steps completed. + max_steps (`int`, *optional*, defaults to 0): + The number of update steps to do during the current training. + logging_steps (`int`, *optional*, defaults to 500): + Log every X updates steps + eval_steps (`int`, *optional*): + Run an evaluation every X steps. + save_steps (`int`, *optional*, defaults to 500): + Save checkpoint every X updates steps. + train_batch_size (`int`, *optional*): + The batch size for the training dataloader. Only needed when + `auto_find_batch_size` has been used. + num_input_tokens_seen (`int`, *optional*, defaults to 0): + When tracking the inputs tokens, the number of tokens seen during training (number of input tokens, not the + number of prediction tokens). + total_flos (`float`, *optional*, defaults to 0): + The total number of floating operations done by the model since the beginning of training (stored as floats + to avoid overflow). + log_history (`list[dict[str, float]]`, *optional*): + The list of logs done since the beginning of training. + best_metric (`float`, *optional*): + When tracking the best model, the value of the best metric encountered so far. + best_global_step (`int`, *optional*): + When tracking the best model, the step at which the best metric was encountered. + Used for setting `best_model_checkpoint`. + best_model_checkpoint (`str`, *optional*): + When tracking the best model, the value of the name of the checkpoint for the best model encountered so + far. + is_local_process_zero (`bool`, *optional*, defaults to `True`): + Whether or not this process is the local (e.g., on one machine if training in a distributed fashion on + several machines) main process. + is_world_process_zero (`bool`, *optional*, defaults to `True`): + Whether or not this process is the global main process (when training in a distributed fashion on several + machines, this is only going to be `True` for one process). + is_hyper_param_search (`bool`, *optional*, defaults to `False`): + Whether we are in the process of a hyper parameter search using Trainer.hyperparameter_search. This will + impact the way data will be logged in TensorBoard. + stateful_callbacks (`list[StatefulTrainerCallback]`, *optional*): + Callbacks attached to the `Trainer` that should have their states be saved or restored. + Relevant callbacks should implement a `state` and `from_state` function. + """ + + epoch: float | None = None + global_step: int = 0 + max_steps: int = 0 + logging_steps: int = 500 + eval_steps: int = 500 + save_steps: int = 500 + train_batch_size: int | None = None + num_train_epochs: int = 0 + num_input_tokens_seen: int = 0 + total_flos: float = 0 + log_history: list[dict[str, float]] = None + best_metric: float | None = None + best_global_step: int | None = None + best_model_checkpoint: str | None = None + is_local_process_zero: bool = True + is_world_process_zero: bool = True + is_hyper_param_search: bool = False + trial_name: str | None = None + trial_params: dict[str, str | float | int | bool] | None = None + stateful_callbacks: list["TrainerCallback"] | None = None + + def __post_init__(self): + if self.log_history is None: + self.log_history = [] + if self.stateful_callbacks is None: + self.stateful_callbacks = {} + elif isinstance(self.stateful_callbacks, dict): + # We are loading the callbacks in from the state file, no need to process them + pass + else: + # Saveable callbacks get stored as dict of kwargs + stateful_callbacks = {} + for callback in self.stateful_callbacks: + if not isinstance(callback, (ExportableState)): + raise TypeError( + f"All callbacks passed to be saved must inherit `ExportableState`, but received {type(callback)}" + ) + name = callback.__class__.__name__ + if name in stateful_callbacks: + # We can have multiple versions of the same callback + # if so, we store them as a list of states to restore + if not isinstance(stateful_callbacks[name], list): + stateful_callbacks[name] = [stateful_callbacks[name]] + stateful_callbacks[name].append(callback.state()) + else: + stateful_callbacks[name] = callback.state() + self.stateful_callbacks = stateful_callbacks + + def save_to_json(self, json_path: str): + """Save the content of this instance in JSON format inside `json_path`.""" + json_string = json.dumps(dataclasses.asdict(self), indent=2, sort_keys=True) + "\n" + with open(json_path, "w", encoding="utf-8") as f: + f.write(json_string) + + @classmethod + def load_from_json(cls, json_path: str): + """Create an instance from the content of `json_path`.""" + with open(json_path, encoding="utf-8") as f: + text = f.read() + return cls(**json.loads(text)) + + def compute_steps(self, args, max_steps): + """ + Calculates and stores the absolute value for logging, + eval, and save steps based on if it was a proportion + or not. + """ + for step_kind in ("logging", "eval", "save"): + num_steps = getattr(args, f"{step_kind}_steps") + if num_steps is not None: + if num_steps < 1: + num_steps = math.ceil(max_steps * num_steps) + setattr(self, f"{step_kind}_steps", num_steps) + + def init_training_references(self, trainer, max_steps, num_train_epochs, trial): + """ + Stores the initial training references needed in `self` + """ + if trainer.hp_name is not None and trainer._trial is not None: + # use self._trial because the Optuna hpo only call `_hp_search_setup(trial)` instead of passing trial + # parameter to Train when using DDP. + self.trial_name = trainer.hp_name(trainer._trial) + self.trial_params = None + if trial is not None: + from transformers.integrations import hp_params + + self.trial_params = hp_params(trial) + + self.max_steps = max_steps + self.num_train_epochs = num_train_epochs + self.is_local_process_zero = trainer.is_local_process_zero() + self.is_world_process_zero = trainer.is_world_process_zero() + + +class ExportableState: + """ + A class for objects that include the ability to have its state + be saved during `Trainer._save_checkpoint` and loaded back in during + `Trainer._load_from_checkpoint`. + + These must implement a `state` function that gets called during the respective + Trainer function call. It should only include parameters and attributes needed to + recreate the state at a particular time, to avoid utilizing pickle/maintain standard + file IO writing. + + Example: + + ```python + class EarlyStoppingCallback(TrainerCallback, ExportableState): + def __init__(self, early_stopping_patience: int = 1, early_stopping_threshold: Optional[float] = 0.0): + self.early_stopping_patience = early_stopping_patience + self.early_stopping_threshold = early_stopping_threshold + # early_stopping_patience_counter denotes the number of times validation metrics failed to improve. + self.early_stopping_patience_counter = 0 + + def state(self) -> dict: + return { + "args": { + "early_stopping_patience": self.early_stopping_patience, + "early_stopping_threshold": self.early_stopping_threshold, + }, + "attributes": { + "early_stopping_patience_counter": self.early_stopping_patience_counter, + } + } + ```""" + + def state(self) -> dict: + raise NotImplementedError("You must implement a `state` function to utilize this class.") + + @classmethod + def from_state(cls, state): + instance = cls(**state["args"]) + for k, v in state["attributes"].items(): + setattr(instance, k, v) + return instance + + +@dataclass +class TrainerControl(ExportableState): + """ + A class that handles the [`Trainer`] control flow. This class is used by the [`TrainerCallback`] to activate some + switches in the training loop. + + Args: + should_training_stop (`bool`, *optional*, defaults to `False`): + Whether or not the training should be interrupted. + + If `True`, this variable will not be set back to `False`. The training will just stop. + should_epoch_stop (`bool`, *optional*, defaults to `False`): + Whether or not the current epoch should be interrupted. + + If `True`, this variable will be set back to `False` at the beginning of the next epoch. + should_save (`bool`, *optional*, defaults to `False`): + Whether or not the model should be saved at this step. + + If `True`, this variable will be set back to `False` at the beginning of the next step. + should_evaluate (`bool`, *optional*, defaults to `False`): + Whether or not the model should be evaluated at this step. + + If `True`, this variable will be set back to `False` at the beginning of the next step. + should_log (`bool`, *optional*, defaults to `False`): + Whether or not the logs should be reported at this step. + + If `True`, this variable will be set back to `False` at the beginning of the next step. + """ + + should_training_stop: bool = False + should_epoch_stop: bool = False + should_save: bool = False + should_evaluate: bool = False + should_log: bool = False + + def _new_training(self): + """Internal method that resets the variable for a new training.""" + self.should_training_stop = False + + def _new_epoch(self): + """Internal method that resets the variable for a new epoch.""" + self.should_epoch_stop = False + + def _new_step(self): + """Internal method that resets the variable for a new step.""" + self.should_save = False + self.should_evaluate = False + self.should_log = False + + def state(self) -> dict: + return { + "args": { + "should_training_stop": self.should_training_stop, + "should_epoch_stop": self.should_epoch_stop, + "should_save": self.should_save, + "should_evaluate": self.should_evaluate, + "should_log": self.should_log, + }, + "attributes": {}, + } + + +class TrainerCallback: + # no-format + """ + A class for objects that will inspect the state of the training loop at some events and take some decisions. At + each of those events the following arguments are available: + + Args: + args ([`TrainingArguments`]): + The training arguments used to instantiate the [`Trainer`]. + state ([`TrainerState`]): + The current state of the [`Trainer`]. + control ([`TrainerControl`]): + The object that is returned to the [`Trainer`] and can be used to make some decisions. + model ([`PreTrainedModel`] or `torch.nn.Module`): + The model being trained. + processing_class ([`PreTrainedTokenizer` or `BaseImageProcessor` or `ProcessorMixin` or `FeatureExtractionMixin`]): + The processing class used for encoding the data. Can be a tokenizer, a processor, an image processor or a feature extractor. + optimizer (`torch.optim.Optimizer`): + The optimizer used for the training steps. + lr_scheduler (`torch.optim.lr_scheduler.LambdaLR`): + The scheduler used for setting the learning rate. + train_dataloader (`torch.utils.data.DataLoader`, *optional*): + The current dataloader used for training. + eval_dataloader (`torch.utils.data.DataLoader`, *optional*): + The current dataloader used for evaluation. + metrics (`dict[str, float]`): + The metrics computed by the last evaluation phase. + + Those are only accessible in the event `on_evaluate`. + logs (`dict[str, float]`): + The values to log. + + Those are only accessible in the event `on_log`. + + The `control` object is the only one that can be changed by the callback, in which case the event that changes it + should return the modified version. + + The argument `args`, `state` and `control` are positionals for all events, all the others are grouped in `kwargs`. + You can unpack the ones you need in the signature of the event using them. As an example, see the code of the + simple [`~transformers.PrinterCallback`]. + + Example: + + ```python + class PrinterCallback(TrainerCallback): + def on_log(self, args, state, control, logs=None, **kwargs): + _ = logs.pop("total_flos", None) + if state.is_local_process_zero: + print(logs) + ```""" + + def on_init_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called at the end of the initialization of the [`Trainer`]. + """ + + def on_train_begin(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called at the beginning of training. + """ + + def on_train_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called at the end of training. + """ + + def on_epoch_begin(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called at the beginning of an epoch. + """ + + def on_epoch_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called at the end of an epoch. + """ + + def on_step_begin(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called at the beginning of a training step. If using gradient accumulation, one training step might take + several inputs. + """ + + def on_pre_optimizer_step(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called before the optimizer step but after gradient clipping. Useful for monitoring gradients. + """ + + def on_optimizer_step(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called after the optimizer step but before gradients are zeroed out. Useful for monitoring gradients. + """ + + def on_substep_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called at the end of an substep during gradient accumulation. + """ + + def on_step_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called at the end of a training step. If using gradient accumulation, one training step might take + several inputs. + """ + + def on_evaluate(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called after an evaluation phase. + """ + + def on_predict(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, metrics, **kwargs): + """ + Event called after a successful prediction. + """ + + def on_save(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called after a checkpoint save. + """ + + def on_log(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called after logging the last logs. + """ + + def on_prediction_step(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called after a prediction step. + """ + + def on_push_begin(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + """ + Event called before pushing the model to the hub, at the beginning of Trainer.push_to_hub and Trainer._push_from_checkpoint. + """ + + +class CallbackHandler(TrainerCallback): + """Internal class that just calls the list of callbacks in order.""" + + def __init__(self, callbacks, model, processing_class, optimizer, lr_scheduler): + self.callbacks = [] + for cb in callbacks: + self.add_callback(cb) + self.model = model + self.processing_class = processing_class + self.optimizer = optimizer + self.lr_scheduler = lr_scheduler + self.train_dataloader = None + self.eval_dataloader = None + + if not any(isinstance(cb, DefaultFlowCallback) for cb in self.callbacks): + logger.warning( + "The Trainer will not work properly if you don't have a `DefaultFlowCallback` in its callbacks. You\n" + + "should add one before training with `trainer.add_callback(DefaultFlowCallback). The current list of" + + "callbacks is\n:" + + self.callback_list + ) + + def add_callback(self, callback): + cb = callback() if isinstance(callback, type) else callback + cb_class = callback if isinstance(callback, type) else callback.__class__ + if cb_class in [c.__class__ for c in self.callbacks]: + logger.warning( + f"You are adding a {cb_class} to the callbacks of this Trainer, but there is already one. The current" + + "list of callbacks is\n:" + + self.callback_list + ) + self.callbacks.append(cb) + + def pop_callback(self, callback): + if isinstance(callback, type): + for cb in self.callbacks: + if isinstance(cb, callback): + self.callbacks.remove(cb) + return cb + else: + for cb in self.callbacks: + if cb == callback: + self.callbacks.remove(cb) + return cb + + def remove_callback(self, callback): + if isinstance(callback, type): + for cb in self.callbacks: + if isinstance(cb, callback): + self.callbacks.remove(cb) + return + else: + self.callbacks.remove(callback) + + @property + def callback_list(self): + return "\n".join(cb.__class__.__name__ for cb in self.callbacks) + + def on_init_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl): + return self.call_event("on_init_end", args, state, control) + + def on_train_begin(self, args: TrainingArguments, state: TrainerState, control: TrainerControl): + control.should_training_stop = False + return self.call_event("on_train_begin", args, state, control) + + def on_train_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl): + return self.call_event("on_train_end", args, state, control) + + def on_epoch_begin(self, args: TrainingArguments, state: TrainerState, control: TrainerControl): + control.should_epoch_stop = False + return self.call_event("on_epoch_begin", args, state, control) + + def on_epoch_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl): + return self.call_event("on_epoch_end", args, state, control) + + def on_step_begin(self, args: TrainingArguments, state: TrainerState, control: TrainerControl): + control.should_log = False + control.should_evaluate = False + control.should_save = False + return self.call_event("on_step_begin", args, state, control) + + def on_pre_optimizer_step(self, args: TrainingArguments, state: TrainerState, control: TrainerControl): + return self.call_event("on_pre_optimizer_step", args, state, control) + + def on_optimizer_step(self, args: TrainingArguments, state: TrainerState, control: TrainerControl): + return self.call_event("on_optimizer_step", args, state, control) + + def on_substep_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl): + return self.call_event("on_substep_end", args, state, control) + + def on_step_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl): + return self.call_event("on_step_end", args, state, control) + + def on_evaluate(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, metrics): + control.should_evaluate = False + return self.call_event("on_evaluate", args, state, control, metrics=metrics) + + def on_predict(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, metrics): + return self.call_event("on_predict", args, state, control, metrics=metrics) + + def on_save(self, args: TrainingArguments, state: TrainerState, control: TrainerControl): + control.should_save = False + return self.call_event("on_save", args, state, control) + + def on_log(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, logs): + control.should_log = False + return self.call_event("on_log", args, state, control, logs=logs) + + def on_prediction_step(self, args: TrainingArguments, state: TrainerState, control: TrainerControl): + return self.call_event("on_prediction_step", args, state, control) + + def on_push_begin(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + return self.call_event("on_push_begin", args, state, control, **kwargs) + + def call_event(self, event, args, state, control, **kwargs): + for callback in self.callbacks: + result = getattr(callback, event)( + args, + state, + control, + model=self.model, + processing_class=self.processing_class, + optimizer=self.optimizer, + lr_scheduler=self.lr_scheduler, + train_dataloader=self.train_dataloader, + eval_dataloader=self.eval_dataloader, + **kwargs, + ) + # A Callback can skip the return of `control` if it doesn't change it. + if result is not None: + control = result + return control + + +class DefaultFlowCallback(TrainerCallback): + """ + A [`TrainerCallback`] that handles the default flow of the training loop for logs, evaluation and checkpoints. + """ + + def on_step_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + # Log + if state.global_step == 1 and args.logging_first_step: + control.should_log = True + if args.logging_strategy == IntervalStrategy.STEPS and state.global_step % state.logging_steps == 0: + control.should_log = True + + # Evaluate + if ( + args.eval_strategy == IntervalStrategy.STEPS + and state.global_step % state.eval_steps == 0 + and args.eval_delay <= state.global_step + ): + control.should_evaluate = True + + # Save + if ( + args.save_strategy == SaveStrategy.STEPS + and state.save_steps > 0 + and state.global_step % state.save_steps == 0 + ): + control.should_save = True + + # End training + if state.global_step >= state.max_steps: + control.should_training_stop = True + # Save the model at the end if we have a save strategy + if args.save_strategy == SaveStrategy.STEPS: + control.should_save = True + + return control + + def on_epoch_end(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs): + # Log + if args.logging_strategy == IntervalStrategy.EPOCH: + control.should_log = True + + # Evaluate + if args.eval_strategy == IntervalStrategy.EPOCH and args.eval_delay <= state.epoch: + control.should_evaluate = True + + # Save + if args.save_strategy == SaveStrategy.EPOCH: + control.should_save = True + + return control + + +class ProgressCallback(TrainerCallback): + """ + A [`TrainerCallback`] that displays the progress of training or evaluation. + You can modify `max_str_len` to control how long strings are truncated when logging. + """ + + def __init__(self, max_str_len: int = 100): + """ + Initialize the callback with optional max_str_len parameter to control string truncation length. + + Args: + max_str_len (`int`): + Maximum length of strings to display in logs. + Longer strings will be truncated with a message. + """ + self.training_bar = None + self.prediction_bar = None + self.max_str_len = max_str_len + + def on_train_begin(self, args, state, control, **kwargs): + if state.is_world_process_zero: + self.training_bar = tqdm(total=state.max_steps, dynamic_ncols=True) + self.current_step = 0 + + def on_step_end(self, args, state, control, **kwargs): + if state.is_world_process_zero: + self.training_bar.update(state.global_step - self.current_step) + self.current_step = state.global_step + + def on_prediction_step(self, args, state, control, eval_dataloader=None, **kwargs): + if state.is_world_process_zero and has_length(eval_dataloader): + if self.prediction_bar is None: + self.prediction_bar = tqdm( + total=len(eval_dataloader), leave=self.training_bar is None, dynamic_ncols=True + ) + self.prediction_bar.update(1) + + def on_evaluate(self, args, state, control, **kwargs): + if state.is_world_process_zero: + if self.prediction_bar is not None: + self.prediction_bar.close() + self.prediction_bar = None + + def on_predict(self, args, state, control, **kwargs): + if state.is_world_process_zero: + if self.prediction_bar is not None: + self.prediction_bar.close() + self.prediction_bar = None + + def on_log(self, args, state, control, logs=None, **kwargs): + if state.is_world_process_zero and self.training_bar is not None: + # make a shallow copy of logs so we can mutate the fields copied + # but avoid doing any value pickling. + shallow_logs = {} + for k, v in logs.items(): + if isinstance(v, str) and len(v) > self.max_str_len: + shallow_logs[k] = ( + f"[String too long to display, length: {len(v)} > {self.max_str_len}. " + "Consider increasing `max_str_len` if needed.]" + ) + if isinstance(v, float): + # Format floats for better readability + shallow_logs[k] = f"{v:.4g}" + else: + shallow_logs[k] = v + _ = shallow_logs.pop("total_flos", None) + self.training_bar.write(str(shallow_logs)) + + def on_train_end(self, args, state, control, **kwargs): + if state.is_world_process_zero: + self.training_bar.close() + self.training_bar = None + + +class PrinterCallback(TrainerCallback): + """ + A bare [`TrainerCallback`] that just prints the logs. + """ + + def on_log(self, args, state, control, logs=None, **kwargs): + _ = logs.pop("total_flos", None) + if state.is_local_process_zero: + if logs is not None: + logs = {k: (f"{v:.4g}" if isinstance(v, float) else v) for k, v in logs.items()} + print(logs) + + +class EarlyStoppingCallback(TrainerCallback, ExportableState): + """ + A [`TrainerCallback`] that handles early stopping. + + Args: + early_stopping_patience (`int`): + Use with `metric_for_best_model` to stop training when the specified metric worsens for + `early_stopping_patience` evaluation calls. + early_stopping_threshold(`float`, *optional*): + Use with TrainingArguments `metric_for_best_model` and `early_stopping_patience` to denote how much the + specified metric must improve to satisfy early stopping conditions. ` + + This callback depends on [`TrainingArguments`] argument *load_best_model_at_end* functionality to set best_metric + in [`TrainerState`]. Note that if the [`TrainingArguments`] argument *save_steps* differs from *eval_steps*, the + early stopping will not occur until the next save step. + """ + + def __init__(self, early_stopping_patience: int = 1, early_stopping_threshold: float | None = 0.0): + self.early_stopping_patience = early_stopping_patience + self.early_stopping_threshold = early_stopping_threshold + # early_stopping_patience_counter denotes the number of times validation metrics failed to improve. + self.early_stopping_patience_counter = 0 + + def check_metric_value(self, args, state, control, metric_value): + # best_metric is set by code for load_best_model + operator = np.greater if args.greater_is_better else np.less + if state.best_metric is None or ( + operator(metric_value, state.best_metric) + and abs(metric_value - state.best_metric) > self.early_stopping_threshold + ): + self.early_stopping_patience_counter = 0 + else: + self.early_stopping_patience_counter += 1 + + def on_train_begin(self, args, state, control, **kwargs): + if not args.load_best_model_at_end: + logger.warning( + "Using EarlyStoppingCallback without load_best_model_at_end=True. " + "Once training is finished, the best model will not be loaded automatically." + ) + assert args.metric_for_best_model is not None, ( + "EarlyStoppingCallback requires metric_for_best_model to be defined" + ) + assert args.eval_strategy != IntervalStrategy.NO, ( + "EarlyStoppingCallback requires IntervalStrategy of steps or epoch" + ) + + def on_evaluate(self, args, state, control, metrics, **kwargs): + metric_to_check = args.metric_for_best_model + if not metric_to_check.startswith("eval_"): + metric_to_check = f"eval_{metric_to_check}" + metric_value = metrics.get(metric_to_check) + + if metric_value is None: + logger.warning( + f"early stopping required metric_for_best_model, but did not find {metric_to_check} so early stopping" + " is disabled" + ) + return + + self.check_metric_value(args, state, control, metric_value) + if self.early_stopping_patience_counter >= self.early_stopping_patience: + control.should_training_stop = True + + def state(self) -> dict: + return { + "args": { + "early_stopping_patience": self.early_stopping_patience, + "early_stopping_threshold": self.early_stopping_threshold, + }, + "attributes": { + "early_stopping_patience_counter": self.early_stopping_patience_counter, + }, + } diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_jit_checkpoint.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_jit_checkpoint.py new file mode 100644 index 0000000000000000000000000000000000000000..90bbdcc25151ac54d6e603bc8aed8bcbc70f711f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_jit_checkpoint.py @@ -0,0 +1,125 @@ +import os +import signal +import threading + +from .trainer_callback import TrainerCallback +from .trainer_utils import PREFIX_CHECKPOINT_DIR +from .utils import logging + + +logger = logging.get_logger(__name__) + + +class CheckpointManager: + def __init__(self, trainer, kill_wait: int = 3): + """ + Initialize the CheckpointManager for Just-In-Time checkpoint handling. + + Args: + trainer: The Trainer instance that will be used to save checkpoints when SIGTERM is received. + kill_wait (`int`, *optional*, defaults to 3): Grace period to distinguish between SIGTERM and SIGKILL. + """ + self.trainer = trainer + self.is_checkpoint_requested = False + self._original_sigterm_handler = None + self.kill_wait = kill_wait + + def setup_signal_handler(self): + self._original_sigterm_handler = signal.signal(signal.SIGTERM, self._sigterm_handler) + logger.info("JIT checkpoint signal handler registered for SIGTERM") + + def _sigterm_handler(self, signum, frame): + if self.is_checkpoint_requested: + return + + logger.info(f"SIGTERM received, will request JIT checkpoint after {self.kill_wait}s") + threading.Timer(self.kill_wait, self._enable_checkpoint).start() + + def _enable_checkpoint(self): + logger.info("Kill wait period elapsed, requesting checkpoint") + self.is_checkpoint_requested = True + + def execute_jit_checkpoint(self): + try: + # Set checkpoint flag to False to avoid multiple checkpoints getting triggered by other callbacks + self.is_checkpoint_requested = False + + logger.info("Starting JIT checkpointing...") + current_step = self.trainer.state.global_step + logger.info(f"Saving JIT checkpoint at step {current_step}") + + output_dir = self.trainer._get_output_dir(trial=None) + checkpoint_folder = f"{PREFIX_CHECKPOINT_DIR}-{current_step}" + checkpoint_path = os.path.join(output_dir, checkpoint_folder) + + # Create checkpoint directory + os.makedirs(checkpoint_path, exist_ok=True) + + # Create a sentinel file to indicate checkpointing is in progress + sentinel_file = os.path.join(output_dir, checkpoint_folder, "checkpoint-is-incomplete.txt") + with open(sentinel_file, "w") as f: + f.write(f"Checkpoint started at step {current_step} and in progress...") + logger.info(f"Created checkpoint progress sentinel marker file: {sentinel_file}") + + # Invoke the trainer's checkpoint method directly + self.trainer._save_checkpoint(self.trainer.model, trial=None) + + # Remove sentinel file upon successful checkpointing + if os.path.exists(sentinel_file): + os.remove(sentinel_file) + logger.info("Sentinel marker file removed") + + logger.info("Immediate JIT checkpoint completed successfully") + + except Exception as e: + logger.error(f"Failed to save JIT checkpoint: {e}") + raise + + +class JITCheckpointCallback(TrainerCallback): + """ + Callback for Just-In-Time checkpointing on SIGTERM signals. + + When SIGTERM is received, the checkpoint manager sets `is_checkpoint_requested=True`. + The callbacks detect this flag and set `control.should_training_stop=True`, which signals + the Trainer's training loop to exit gracefully after saving the checkpoint. + """ + + def __init__(self): + self.trainer = None + self.jit_manager: CheckpointManager | None = None + + def set_trainer(self, trainer): + self.trainer = trainer + if trainer.args.enable_jit_checkpoint: + self.jit_manager = CheckpointManager(trainer=trainer) + self.jit_manager.setup_signal_handler() + logger.info("JIT checkpointing enabled") + + def on_pre_optimizer_step(self, args, state, control, **kwargs): + if self.jit_manager and self.jit_manager.is_checkpoint_requested: + control.should_training_stop = True + self.jit_manager.execute_jit_checkpoint() + + def on_step_begin(self, args, state, control, **kwargs): + if self.jit_manager and self.jit_manager.is_checkpoint_requested: + control.should_training_stop = True + self.jit_manager.execute_jit_checkpoint() + + def on_step_end(self, args, state, control, **kwargs): + if self.jit_manager and self.jit_manager.is_checkpoint_requested: + control.should_save = False + control.should_training_stop = True + self.jit_manager.execute_jit_checkpoint() + + def on_epoch_end(self, args, state, control, **kwargs): + if self.jit_manager and self.jit_manager.is_checkpoint_requested: + control.should_save = False + control.should_training_stop = True + self.jit_manager.execute_jit_checkpoint() + + def on_train_end(self, args, state, control, **kwargs): + # Restore original SIGTERM handler + if self.jit_manager and self.jit_manager._original_sigterm_handler is not None: + signal.signal(signal.SIGTERM, self.jit_manager._original_sigterm_handler) + logger.info("Restored original SIGTERM handler after training completion") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_optimizer.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_optimizer.py new file mode 100644 index 0000000000000000000000000000000000000000..64eab7c261ca06fbde17834ae7b466cb92780b03 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_optimizer.py @@ -0,0 +1,608 @@ +# Copyright 2024 The HuggingFace Inc. team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Optimizer utilities for the Trainer class. +""" + +from __future__ import annotations + +import importlib.metadata +import logging +from collections.abc import Callable +from dataclasses import dataclass +from typing import TYPE_CHECKING, Any + +import torch +from packaging import version +from torch import nn + +from .optimization import Adafactor +from .trainer_pt_utils import LayerWiseDummyOptimizer +from .trainer_utils import check_target_module_exists +from .training_args import OptimizerNames, ParallelMode +from .utils import ( + is_apollo_torch_available, + is_bitsandbytes_available, + is_galore_torch_available, + is_grokadamw_available, + is_lomo_available, + is_schedulefree_available, + is_torch_optimi_available, + is_torchao_available, + strtobool, +) + + +if TYPE_CHECKING: + from .modeling_utils import PreTrainedModel + from .training_args import TrainingArguments + +logger = logging.getLogger(__name__) + + +@dataclass +class OptimizerContext: + """Context object passed to all optimizer handlers.""" + + args: TrainingArguments + model: PreTrainedModel | None + optimizer_kwargs: dict[str, Any] + adam_kwargs: dict[str, Any] + optim_args: dict[str, str] + + +def _parse_optim_args(optim_args_str: str | None) -> dict[str, str]: + """Parse optimizer arguments from a comma-separated string.""" + if not optim_args_str: + return {} + optim_args = {} + for mapping in optim_args_str.replace(" ", "").split(","): + key, value = mapping.split("=") + optim_args[key] = value + return optim_args + + +# Type alias for optimizer handler functions +OptimizerHandler = Callable[[OptimizerContext], tuple[Any, dict[str, Any]]] + + +def is_optimizer_factory(optimizer_cls_or_factory: Any) -> bool: + """ + Check if the returned value from a handler is a factory rather than an Optimizer class. + + Factory callables are used for complex optimizers like Muon or Dion that need to: + - Split parameters between multiple internal optimizers + - Handle complex sharding logic + - Access the full model structure for parameter grouping + + Args: + optimizer_cls_or_factory: The first element returned by an optimizer handler. + + Returns: + `bool`: True if it's not an Optimizer class (i.e., likely a factory), False if it's an Optimizer class. + """ + # If it's a class that's a subclass of torch.optim.Optimizer, it's not a factory + if isinstance(optimizer_cls_or_factory, type) and issubclass(optimizer_cls_or_factory, torch.optim.Optimizer): + return False + return True + + +def _setup_low_rank_optimizer( + args: TrainingArguments, + model: PreTrainedModel, + optimizer_name: str, + optimizer_mapping: dict[str, Any], + optim_kwargs: dict[str, Any], + optimizer_kwargs: dict[str, Any], + is_layerwise_supported: bool = True, +) -> tuple[Any, dict[str, Any]]: + """ + Helper function to set up low-rank optimizers like GaLore and Apollo. + + These optimizers apply low-rank projections to specific target modules (typically linear layers). + """ + is_layerwise = optimizer_name.lower().endswith("layerwise") + if is_layerwise and args.parallel_mode == ParallelMode.DISTRIBUTED and is_layerwise_supported: + raise NotImplementedError(f"Layer-wise {optimizer_name} does not support DDP at this time") + + optimizer_cls = optimizer_mapping[optimizer_name] + + if args.optim_target_modules is None: + raise ValueError(f"You need to define `optim_target_modules` to use {optimizer_name} optimizers") + + if not isinstance(args.optim_target_modules, (list, str)): + raise TypeError( + f"`optim_target_modules` must be a list of strings, a regex string, or 'all-linear'. " + f"Got: {args.optim_target_modules}" + ) + + if model is None: + raise ValueError(f"You need to pass a model to initialize {optimizer_name} optimizer.") + + all_linear = ( + isinstance(args.optim_target_modules, str) and args.optim_target_modules.replace("_", "-") == "all-linear" + ) + + target_params_names = [] + for module_name, module in model.named_modules(): + target_module_exists, is_regex = check_target_module_exists( + args.optim_target_modules, module_name, return_is_regex=True + ) + + if not isinstance(module, nn.Linear): + if target_module_exists and not is_regex: + logger.warning(f"{module_name} matched but ignored. {optimizer_name} only supports linear layers.") + continue + + if not target_module_exists and not all_linear: + continue + + target_params_names.append(module_name + ".weight") + + if len(target_params_names) == 0: + raise ValueError(f"No target modules found for {optimizer_name} ({args.optim_target_modules}).") + + target_params = [p for n, p in model.named_parameters() if n in target_params_names] + non_target_params = [p for n, p in model.named_parameters() if n not in target_params_names] + + param_groups = [ + {"params": non_target_params}, + {"params": target_params, **optim_kwargs}, + ] + + if is_layerwise: + if args.gradient_accumulation_steps != 1: + raise ValueError(f"Layerwise {optimizer_name} does not support gradient accumulation!") + + optimizer_dict = {} + for param in non_target_params: + optimizer_dict[param] = optimizer_cls([{"params": [param]}], **optimizer_kwargs) + for param in target_params: + optimizer_dict[param] = optimizer_cls([{"params": [param], **optim_kwargs}], **optimizer_kwargs) + + def optimizer_hook(param): + if param.grad is not None: + optimizer_dict[param].step() + optimizer_dict[param].zero_grad() + + for param in model.parameters(): + if param.requires_grad: + param.register_post_accumulate_grad_hook(optimizer_hook) + + optimizer_cls = LayerWiseDummyOptimizer + optimizer_kwargs.update({"optimizer_dict": optimizer_dict}) + + optimizer_kwargs.update({"params": param_groups}) + return optimizer_cls, optimizer_kwargs + + +# ============================================================================= +# Individual optimizer handlers +# ============================================================================= + + +def _get_adafactor(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get Adafactor optimizer.""" + ctx.optimizer_kwargs.update({"scale_parameter": False, "relative_step": False}) + return Adafactor, ctx.optimizer_kwargs + + +def _get_adamw_torch(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get PyTorch AdamW optimizer (regular or fused).""" + from torch.optim import AdamW + + ctx.optimizer_kwargs.update(ctx.adam_kwargs) + if ctx.args.optim == OptimizerNames.ADAMW_TORCH_FUSED: + ctx.optimizer_kwargs.update({"fused": True}) + return AdamW, ctx.optimizer_kwargs + + +def _get_adamw_torch_xla(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get Torch XLA syncfree AdamW optimizer.""" + try: + from torch_xla.amp.syncfree import AdamW + + ctx.optimizer_kwargs.update(ctx.adam_kwargs) + return AdamW, ctx.optimizer_kwargs + except ImportError: + raise ValueError("Trainer failed to import syncfree AdamW from torch_xla.") + + +def _get_adamw_torch_npu_fused(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get NPU Fused AdamW optimizer.""" + try: + from torch_npu.optim import NpuFusedAdamW + + ctx.optimizer_kwargs.update(ctx.adam_kwargs) + return NpuFusedAdamW, ctx.optimizer_kwargs + except ImportError: + raise ValueError("Trainer failed to import FusedAdamW from torch_npu.") + + +def _get_adamw_apex_fused(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get Apex Fused Adam optimizer.""" + try: + from apex.optimizers import FusedAdam + + ctx.optimizer_kwargs.update(ctx.adam_kwargs) + return FusedAdam, ctx.optimizer_kwargs + except ImportError: + raise ValueError("Trainer tried to instantiate apex FusedAdam but apex is not installed!") + + +def _get_bitsandbytes_optimizer(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get bitsandbytes optimizer (AdamW, Lion, RMSprop variants).""" + if not is_bitsandbytes_available(): + raise ImportError( + "You need to install `bitsandbytes` in order to use bitsandbytes optimizers: `pip install -U bitsandbytes`" + ) + + from bitsandbytes.optim import AdamW, Lion, RMSprop + + optim_name = ctx.args.optim + is_paged = "paged" in optim_name + optim_bits = 8 if "8bit" in optim_name else 32 + optimizer_cls = None + additional_optim_kwargs = ctx.adam_kwargs + + if "adam" in optim_name: + optimizer_cls = AdamW + elif "lion" in optim_name: + optimizer_cls = Lion + additional_optim_kwargs = {"betas": (ctx.args.adam_beta1, ctx.args.adam_beta2)} + elif "rmsprop" in optim_name: + optimizer_cls = RMSprop + additional_optim_kwargs = ctx.optim_args + elif "ademamix" in optim_name: + from bitsandbytes.optim import AdEMAMix + + optimizer_cls = AdEMAMix + additional_optim_kwargs = { + "betas": ( + float(ctx.optim_args.get("beta1", ctx.args.adam_beta1)), + float(ctx.optim_args.get("beta2", ctx.args.adam_beta2)), + float(ctx.optim_args.get("beta3", 0.9999)), + ), + "alpha": float(ctx.optim_args.get("alpha", 5.0)), + "eps": float(ctx.optim_args.get("eps", ctx.args.adam_epsilon)), + } + if "t_alpha" in ctx.optim_args: + additional_optim_kwargs["t_alpha"] = int(ctx.optim_args["t_alpha"]) + if "t_beta3" in ctx.optim_args: + additional_optim_kwargs["t_beta3"] = int(ctx.optim_args["t_beta3"]) + + bnb_kwargs = {"optim_bits": optim_bits} + if "rmsprop" not in optim_name: + bnb_kwargs["is_paged"] = is_paged + + ctx.optimizer_kwargs.update(additional_optim_kwargs) + ctx.optimizer_kwargs.update(bnb_kwargs) + return optimizer_cls, ctx.optimizer_kwargs + + +def _get_adamw_anyprecision(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get AnyPrecision AdamW optimizer.""" + try: + from torchdistx.optimizers import AnyPrecisionAdamW + + ctx.optimizer_kwargs.update(ctx.adam_kwargs) + ctx.optimizer_kwargs.update( + { + "use_kahan_summation": strtobool(ctx.optim_args.get("use_kahan_summation", "False")), + "momentum_dtype": getattr(torch, ctx.optim_args.get("momentum_dtype", "float32")), + "variance_dtype": getattr(torch, ctx.optim_args.get("variance_dtype", "float32")), + "compensation_buffer_dtype": getattr( + torch, ctx.optim_args.get("compensation_buffer_dtype", "bfloat16") + ), + } + ) + return AnyPrecisionAdamW, ctx.optimizer_kwargs + except ImportError: + raise ValueError("Please install https://github.com/pytorch/torchdistx") + + +def _get_sgd(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get SGD optimizer.""" + return torch.optim.SGD, ctx.optimizer_kwargs + + +def _get_adagrad(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get Adagrad optimizer.""" + return torch.optim.Adagrad, ctx.optimizer_kwargs + + +def _get_rmsprop(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get RMSprop optimizer.""" + return torch.optim.RMSprop, ctx.optimizer_kwargs + + +def _get_galore_optimizer(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get GaLore optimizer.""" + if not is_galore_torch_available(): + raise ImportError( + "You need to install `galore_torch` in order to use GaLore optimizers. " + "Install it with `pip install git+https://github.com/jiaweizzhao/GaLore`" + ) + from galore_torch import GaLoreAdafactor, GaLoreAdamW, GaLoreAdamW8bit + + optimizer_mapping = { + OptimizerNames.GALORE_ADAMW: GaLoreAdamW, + OptimizerNames.GALORE_ADAMW_8BIT: GaLoreAdamW8bit, + OptimizerNames.GALORE_ADAFACTOR: GaLoreAdafactor, + OptimizerNames.GALORE_ADAMW_LAYERWISE: GaLoreAdamW, + OptimizerNames.GALORE_ADAMW_8BIT_LAYERWISE: GaLoreAdamW8bit, + OptimizerNames.GALORE_ADAFACTOR_LAYERWISE: GaLoreAdafactor, + } + + galore_optim_kwargs = { + "rank": int(ctx.optim_args.pop("rank", 128)), + "update_proj_gap": int(ctx.optim_args.pop("update_proj_gap", 200)), + "scale": float(ctx.optim_args.pop("scale", 0.25)), + "proj_type": ctx.optim_args.pop("proj_type", "std"), + } + + optimizer_cls, optimizer_kwargs = _setup_low_rank_optimizer( + ctx.args, ctx.model, ctx.args.optim, optimizer_mapping, galore_optim_kwargs, ctx.optimizer_kwargs + ) + if ctx.args.optim == OptimizerNames.GALORE_ADAFACTOR: + optimizer_kwargs.update({"scale_parameter": False, "relative_step": False}) + return optimizer_cls, optimizer_kwargs + + +def _get_apollo_optimizer(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get Apollo optimizer.""" + if not is_apollo_torch_available(): + raise ImportError( + "You need to install `apollo_torch` in order to use APOLLO optimizers. " + "Install it with `pip install git+https://github.com/zhuhanqing/APOLLO`" + ) + from apollo_torch import APOLLOAdamW + + optimizer_mapping = { + OptimizerNames.APOLLO_ADAMW: APOLLOAdamW, + OptimizerNames.APOLLO_ADAMW_LAYERWISE: APOLLOAdamW, + } + + apollo_optim_kwargs = { + "rank": int(ctx.optim_args.pop("rank", 128)), + "proj": ctx.optim_args.pop("proj", "random"), + "scale_type": ctx.optim_args.pop("scale_type", "channel"), + "update_proj_gap": int(ctx.optim_args.pop("update_proj_gap", 200)), + "scale": float(ctx.optim_args.pop("scale", 1.0)), + "proj_type": ctx.optim_args.pop("proj_type", "std"), + } + apollo_optim_kwargs.update(ctx.adam_kwargs) + + return _setup_low_rank_optimizer( + ctx.args, ctx.model, ctx.args.optim, optimizer_mapping, apollo_optim_kwargs, ctx.optimizer_kwargs + ) + + +def _get_lomo_optimizer(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get LOMO optimizer.""" + if not is_lomo_available(): + raise ImportError( + "You need to install `lomo_optim` in order to use LOMO optimizers. " + "Install it with `pip install lomo-optim`" + ) + + if ctx.model is None: + raise ValueError("You need to pass a `model` in order to correctly initialize a LOMO optimizer.") + + from lomo_optim import AdaLomo, Lomo + + optimizer_cls = AdaLomo if "ada" in ctx.args.optim else Lomo + ctx.optimizer_kwargs.update({"model": ctx.model}) + return optimizer_cls, ctx.optimizer_kwargs + + +def _get_grokadamw(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get GrokAdamW optimizer.""" + if not is_grokadamw_available(): + raise ValueError("Please install grokadamw with `pip install grokadamw`") + + from grokadamw import GrokAdamW + + ctx.optimizer_kwargs.update( + { + "alpha_init": float(ctx.optim_args.get("alpha_init", 0.98)), + "lamb": float(ctx.optim_args.get("lamb", 2.0)), + "gamma": float(ctx.optim_args.get("gamma", 0.1)), + "grokking_signal_decay_rate": float(ctx.optim_args.get("grokking_signal_decay_rate", 0.1)), + "gradient_clipping": float(ctx.optim_args.get("gradient_clipping", 1.0)), + } + ) + return GrokAdamW, ctx.optimizer_kwargs + + +def _get_torchao_optimizer(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get TorchAO 4-bit or 8-bit optimizer.""" + if not is_torchao_available() or version.parse(importlib.metadata.version("torchao")) < version.parse("0.4.0"): + raise ImportError( + "You need to have `torchao>=0.4.0` in order to use torch 4-bit optimizers. " + "Install it with `pip install torchao` or follow the instructions here: " + "https://github.com/pytorch/ao" + ) + if version.parse(importlib.metadata.version("torch")) <= version.parse("2.4"): + raise ImportError( + "You need to have `torch>2.4` in order to use torch 4-bit optimizers. " + "Install it with `pip install --upgrade torch` it is available on pipy. " + "Otherwise, you need to install torch nightly." + ) + + if version.parse(importlib.metadata.version("torchao")) >= version.parse("0.11.0"): + from torchao.optim import AdamW4bit, AdamW8bit + else: + from torchao.prototype.low_bit_optim import AdamW4bit, AdamW8bit + + if ctx.args.optim == OptimizerNames.ADAMW_TORCH_4BIT: + optimizer_cls = AdamW4bit + else: + optimizer_cls = AdamW8bit + + ctx.optimizer_kwargs.update( + { + "block_size": ctx.optim_args.get("block_size", 256), + "bf16_stochastic_round": strtobool(ctx.optim_args.get("bf16_stochastic_round", "False")), + } + ) + ctx.optimizer_kwargs.update(ctx.adam_kwargs) + return optimizer_cls, ctx.optimizer_kwargs + + +def _get_schedule_free_optimizer(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get ScheduleFree optimizer.""" + if not is_schedulefree_available(): + raise ImportError( + "You need to install `schedulefree` in order to use schedulefree optimizers. " + "Install it with `pip install schedulefree.`" + ) + from schedulefree import AdamWScheduleFree, SGDScheduleFree + + additional_optim_kwargs = {} + require_warmup = True + + if ctx.args.optim == OptimizerNames.SCHEDULE_FREE_RADAM: + if not is_schedulefree_available("1.4.0"): + raise ImportError( + "You need to install `schedulefree>=1.4.0` in order to use RAdamScheduleFree optimizer. " + "Install it with `pip install schedulefree.`" + ) + from schedulefree import RAdamScheduleFree + + optimizer_cls = RAdamScheduleFree + additional_optim_kwargs = ctx.adam_kwargs + require_warmup = False + elif ctx.args.optim == OptimizerNames.SCHEDULE_FREE_ADAMW: + optimizer_cls = AdamWScheduleFree + additional_optim_kwargs = ctx.adam_kwargs + elif ctx.args.optim == OptimizerNames.SCHEDULE_FREE_SGD: + optimizer_cls = SGDScheduleFree + else: + raise ValueError("Invalid schedulefree optimizer") + + additional_optim_kwargs["weight_decay"] = ctx.args.weight_decay + if require_warmup: + additional_optim_kwargs["warmup_steps"] = ctx.args.warmup_steps + additional_optim_kwargs.update( + { + "weight_lr_power": float(ctx.optim_args.get("weight_lr_power", 2.0)), + "r": float(ctx.optim_args.get("r", 0.0)), + } + ) + ctx.optimizer_kwargs.update(additional_optim_kwargs) + return optimizer_cls, ctx.optimizer_kwargs + + +def _get_stable_adamw(ctx: OptimizerContext) -> tuple[Any, dict[str, Any]]: + """Get StableAdamW optimizer from torch-optimi.""" + if not is_torch_optimi_available(): + raise ImportError( + "You need to install `torch-optimi` in order to use stable_adamw optimizers. " + "Install it with `pip install torch-optimi`." + ) + from optimi import StableAdamW + + max_lr = ctx.optim_args.pop("max_lr", None) + if max_lr is not None: + max_lr = float(max_lr) + + kahan_sum = ctx.optim_args.pop("kahan_sum", None) + if kahan_sum is not None: + kahan_sum = bool(kahan_sum) + + ctx.adam_kwargs["weight_decay"] = ctx.args.weight_decay + stable_adamw_kwargs = { + "decouple_lr": bool(ctx.optim_args.pop("decouple_lr", False)), + "max_lr": max_lr, + "kahan_sum": kahan_sum, + } + + ctx.optimizer_kwargs.update(ctx.adam_kwargs) + ctx.optimizer_kwargs.update(stable_adamw_kwargs) + return StableAdamW, ctx.optimizer_kwargs + + +# ============================================================================= +# Dispatch table +# ============================================================================= + +_BITSANDBYTES_OPTIMIZERS = [ + OptimizerNames.ADAMW_BNB, + OptimizerNames.ADAMW_8BIT, + OptimizerNames.PAGED_ADAMW, + OptimizerNames.PAGED_ADAMW_8BIT, + OptimizerNames.ADEMAMIX, + OptimizerNames.ADEMAMIX_8BIT, + OptimizerNames.PAGED_ADEMAMIX, + OptimizerNames.PAGED_ADEMAMIX_8BIT, + OptimizerNames.LION, + OptimizerNames.LION_8BIT, + OptimizerNames.PAGED_LION, + OptimizerNames.PAGED_LION_8BIT, + OptimizerNames.RMSPROP_BNB, + OptimizerNames.RMSPROP_8BIT, + OptimizerNames.RMSPROP_32BIT, +] + +_GALORE_OPTIMIZERS = [ + OptimizerNames.GALORE_ADAMW, + OptimizerNames.GALORE_ADAMW_8BIT, + OptimizerNames.GALORE_ADAFACTOR, + OptimizerNames.GALORE_ADAMW_LAYERWISE, + OptimizerNames.GALORE_ADAMW_8BIT_LAYERWISE, + OptimizerNames.GALORE_ADAFACTOR_LAYERWISE, +] + +_APOLLO_OPTIMIZERS = [ + OptimizerNames.APOLLO_ADAMW, + OptimizerNames.APOLLO_ADAMW_LAYERWISE, +] + +_TORCHAO_OPTIMIZERS = [ + OptimizerNames.ADAMW_TORCH_4BIT, + OptimizerNames.ADAMW_TORCH_8BIT, +] + +_SCHEDULE_FREE_OPTIMIZERS = [ + OptimizerNames.SCHEDULE_FREE_RADAM, + OptimizerNames.SCHEDULE_FREE_ADAMW, + OptimizerNames.SCHEDULE_FREE_SGD, +] + +# ============================================================================= +# Built-in optimizer handlers registry +# ============================================================================= + +_OPTIMIZER_HANDLERS: dict[str, OptimizerHandler] = { + OptimizerNames.ADAFACTOR: _get_adafactor, + OptimizerNames.ADAMW_TORCH: _get_adamw_torch, + OptimizerNames.ADAMW_TORCH_FUSED: _get_adamw_torch, + OptimizerNames.ADAMW_TORCH_XLA: _get_adamw_torch_xla, + OptimizerNames.ADAMW_TORCH_NPU_FUSED: _get_adamw_torch_npu_fused, + OptimizerNames.ADAMW_APEX_FUSED: _get_adamw_apex_fused, + OptimizerNames.ADAMW_ANYPRECISION: _get_adamw_anyprecision, + OptimizerNames.SGD: _get_sgd, + OptimizerNames.ADAGRAD: _get_adagrad, + OptimizerNames.RMSPROP: _get_rmsprop, + OptimizerNames.GROKADAMW: _get_grokadamw, + OptimizerNames.STABLE_ADAMW: _get_stable_adamw, + OptimizerNames.LOMO: _get_lomo_optimizer, + OptimizerNames.ADALOMO: _get_lomo_optimizer, + **dict.fromkeys(_BITSANDBYTES_OPTIMIZERS, _get_bitsandbytes_optimizer), + **dict.fromkeys(_GALORE_OPTIMIZERS, _get_galore_optimizer), + **dict.fromkeys(_APOLLO_OPTIMIZERS, _get_apollo_optimizer), + **dict.fromkeys(_TORCHAO_OPTIMIZERS, _get_torchao_optimizer), + **dict.fromkeys(_SCHEDULE_FREE_OPTIMIZERS, _get_schedule_free_optimizer), +} diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_pt_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_pt_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..30377f5f5a6193a477b1be987b499c777566f455 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_pt_utils.py @@ -0,0 +1,1336 @@ +# Copyright 2020-present the HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Torch utilities for the Trainer class. +""" + +import contextlib +import copy +import datetime +import io +import json +import math +import os +import re +import sys +import warnings +from collections.abc import Iterator, Mapping +from contextlib import contextmanager +from dataclasses import dataclass, field +from itertools import chain +from logging import StreamHandler +from typing import Any + +import numpy as np +import torch +import torch.distributed as dist +from packaging import version +from torch import nn +from torch.utils.data import Dataset, IterableDataset, RandomSampler, Sampler +from torch.utils.data.distributed import DistributedSampler + +from .integrations.deepspeed import is_deepspeed_zero3_enabled +from .tokenization_utils_base import BatchEncoding +from .utils import ( + is_sagemaker_mp_enabled, + is_torch_available, + is_torch_xla_available, + is_training_run_on_sagemaker, + logging, +) + + +if is_training_run_on_sagemaker(): + logging.add_handler(StreamHandler(sys.stdout)) + +if is_torch_xla_available(): + import torch_xla.runtime as xr + +if is_torch_available(): + from torch.optim.lr_scheduler import LRScheduler + + +logger = logging.get_logger(__name__) + + +def get_dataloader_sampler(dataloader): + if hasattr(dataloader, "batch_sampler") and dataloader.batch_sampler is not None: + return get_dataloader_sampler(dataloader.batch_sampler) + elif hasattr(dataloader, "sampler"): + return dataloader.sampler + + +def atleast_1d(tensor_or_array: torch.Tensor | np.ndarray): + if isinstance(tensor_or_array, torch.Tensor): + tensor_or_array = torch.atleast_1d(tensor_or_array) + else: + tensor_or_array = np.atleast_1d(tensor_or_array) + return tensor_or_array + + +def torch_pad_and_concatenate(tensor1, tensor2, padding_index=-100): + """Concatenates `tensor1` and `tensor2` on first axis, applying padding on the second if necessary.""" + tensor1 = atleast_1d(tensor1) + tensor2 = atleast_1d(tensor2) + + if len(tensor1.shape) == 1 or tensor1.shape[1] == tensor2.shape[1]: + return torch.cat((tensor1, tensor2), dim=0) + + # Let's figure out the new shape + new_shape = (tensor1.shape[0] + tensor2.shape[0], max(tensor1.shape[1], tensor2.shape[1])) + tensor1.shape[2:] + + # Now let's fill the result tensor + result = tensor1.new_full(new_shape, padding_index) + result[: tensor1.shape[0], : tensor1.shape[1]] = tensor1 + result[tensor1.shape[0] :, : tensor2.shape[1]] = tensor2 + return result + + +def numpy_pad_and_concatenate(array1, array2, padding_index=-100): + """Concatenates `array1` and `array2` on first axis, applying padding on the second if necessary.""" + array1 = atleast_1d(array1) + array2 = atleast_1d(array2) + + if len(array1.shape) == 1 or array1.shape[1] == array2.shape[1]: + return np.concatenate((array1, array2), axis=0) + + # Let's figure out the new shape + new_shape = (array1.shape[0] + array2.shape[0], max(array1.shape[1], array2.shape[1])) + array1.shape[2:] + + # Now let's fill the result tensor + result = np.full_like(array1, padding_index, shape=new_shape) + result[: array1.shape[0], : array1.shape[1]] = array1 + result[array1.shape[0] :, : array2.shape[1]] = array2 + return result + + +def nested_concat(tensors, new_tensors, padding_index=-100): + """ + Concat the `new_tensors` to `tensors` on the first dim and pad them on the second if needed. Works for tensors or + nested list/tuples/dict of tensors. + """ + if not (isinstance(tensors, torch.Tensor) and isinstance(new_tensors, torch.Tensor)): + assert type(tensors) is type(new_tensors), ( + f"Expected `tensors` and `new_tensors` to have the same type but found {type(tensors)} and {type(new_tensors)}." + ) + if isinstance(tensors, (list, tuple)): + return type(tensors)(nested_concat(t, n, padding_index=padding_index) for t, n in zip(tensors, new_tensors)) + elif isinstance(tensors, torch.Tensor): + return torch_pad_and_concatenate(tensors, new_tensors, padding_index=padding_index) + elif isinstance(tensors, Mapping): + return type(tensors)( + {k: nested_concat(t, new_tensors[k], padding_index=padding_index) for k, t in tensors.items()} + ) + elif isinstance(tensors, np.ndarray): + return numpy_pad_and_concatenate(tensors, new_tensors, padding_index=padding_index) + else: + raise TypeError(f"Unsupported type for concatenation: got {type(tensors)}") + + +def find_batch_size(tensors): + """ + Find the first dimension of a tensor in a nested list/tuple/dict of tensors. + """ + if isinstance(tensors, (list, tuple)): + for t in tensors: + result = find_batch_size(t) + if result is not None: + return result + elif isinstance(tensors, Mapping): + for value in tensors.values(): + result = find_batch_size(value) + if result is not None: + return result + elif isinstance(tensors, (torch.Tensor, np.ndarray)): + return tensors.shape[0] if len(tensors.shape) >= 1 else None + + +def nested_numpify(tensors): + "Numpify `tensors` (even if it's a nested list/tuple/dict of tensors)." + if isinstance(tensors, (list, tuple)): + return type(tensors)(nested_numpify(t) for t in tensors) + if isinstance(tensors, Mapping): + return type(tensors)({k: nested_numpify(t) for k, t in tensors.items()}) + + t = tensors.cpu() + if t.dtype == torch.bfloat16: + # As of Numpy 1.21.4, NumPy does not support bfloat16 (see + # https://github.com/numpy/numpy/blob/a47ecdea856986cd60eabbd53265c2ca5916ad5d/doc/source/user/basics.types.rst ). + # Until Numpy adds bfloat16, we must convert float32. + t = t.to(torch.float32) + return t.numpy() + + +def nested_detach(tensors): + "Detach `tensors` (even if it's a nested list/tuple/dict of tensors)." + if isinstance(tensors, (list, tuple)): + return type(tensors)(nested_detach(t) for t in tensors) + elif isinstance(tensors, Mapping): + return type(tensors)({k: nested_detach(t) for k, t in tensors.items()}) + return tensors.detach() if isinstance(tensors, torch.Tensor) else tensors + + +def nested_xla_mesh_reduce(tensors, name): + if is_torch_xla_available(): + import torch_xla.core.xla_model as xm + + if isinstance(tensors, (list, tuple)): + return type(tensors)(nested_xla_mesh_reduce(t, f"{name}_{i}") for i, t in enumerate(tensors)) + if isinstance(tensors, Mapping): + return type(tensors)( + {k: nested_xla_mesh_reduce(t, f"{name}_{i}") for i, (k, t) in enumerate(tensors.items())} + ) + + tensors = atleast_1d(tensors) + return xm.mesh_reduce(name, tensors, torch.cat) + else: + raise ImportError("Torch xla must be installed to use `nested_xla_mesh_reduce`") + + +def distributed_concat(tensor: Any, num_total_examples: int | None = None) -> Any: + try: + if isinstance(tensor, (tuple, list)): + return type(tensor)(distributed_concat(t, num_total_examples) for t in tensor) + if isinstance(tensor, Mapping): + return type(tensor)({k: distributed_concat(t, num_total_examples) for k, t in tensor.items()}) + tensor = atleast_1d(tensor).contiguous() + output_tensors = [tensor.clone() for _ in range(dist.get_world_size())] + dist.all_gather(output_tensors, tensor) + concat = torch.cat(output_tensors, dim=0) + + # truncate the dummy elements added by SequentialDistributedSampler + if num_total_examples is not None: + concat = concat[:num_total_examples] + return concat + except AssertionError: + raise AssertionError("Not currently using distributed training") + + +def nested_gather(tensors, parallel_mode, name=None): + """ + Gather value of `tensors` (tensor or list/tuple of nested tensors) across processes. + """ + from .training_args import ParallelMode + + if tensors is None: + return + if is_torch_xla_available(): + if name is None: + name = "nested_gather" + tensors = nested_xla_mesh_reduce(tensors, name) + elif is_sagemaker_mp_enabled(): + tensors = smp_gather(tensors) + elif parallel_mode == ParallelMode.DISTRIBUTED: + tensors = distributed_concat(tensors) + return tensors + + +def is_attention_mask_causal(attention_mask): + """ + Check if an attention mask is causal (compatible with causal attention). + + Context parallelism only supports causal attention patterns. This function + checks if the provided attention mask is compatible. + + Args: + attention_mask (`torch.Tensor`): The attention mask to check. + + Returns: + `bool`: True if the mask is causal or compatible with causal attention. + """ + if attention_mask is None: + return True # No mask is considered causal (model uses default causal masking) + + # Handle different mask dimensions + if attention_mask.dim() == 2: + # (batch_size, seq_len) - standard padding mask, compatible with causal attention + return True + elif attention_mask.dim() in [3, 4]: + # (batch_size, seq_len, seq_len) or (batch_size, num_heads, seq_len, seq_len) + # Check if it's lower triangular (causal) + seq_len = attention_mask.shape[-1] + if seq_len <= 1: + return True # Single token or empty is always causal + + # Take first batch and head (if 4D) for checking pattern + if attention_mask.dim() == 4: + mask = attention_mask[0, 0] # First batch, first head + else: + mask = attention_mask[0] # First batch + + # Check if upper triangular part is masked (should be 0 or very negative for causal) + upper_triangular = torch.triu(mask, diagonal=1) + + # For causal masks, upper triangular should be 0 or very negative (like -inf) + # Use a reasonable threshold to handle float precision issues + is_causal = torch.all(upper_triangular <= 1e-6) or torch.all(upper_triangular < -1e4) + return is_causal.item() if isinstance(is_causal, torch.Tensor) else is_causal + + # For unknown dimensions, be conservative and reject + return False + + +def distributed_broadcast_scalars( + scalars: list[int | float], + num_total_examples: int | None = None, + device: torch.device | None = torch.device("cuda"), +) -> torch.Tensor: + try: + tensorized_scalar = torch.tensor(scalars, device=device) + output_tensors = [tensorized_scalar.clone() for _ in range(dist.get_world_size())] + dist.all_gather(output_tensors, tensorized_scalar) + concat = torch.cat(output_tensors, dim=0) + + # truncate the dummy elements added by SequentialDistributedSampler + if num_total_examples is not None: + concat = concat[:num_total_examples] + return concat + except AssertionError: + raise AssertionError("Not currently using distributed training") + + +def reissue_pt_warnings(caught_warnings): + # Reissue warnings + if len(caught_warnings) > 1: + for w in caught_warnings: + if w.category is not UserWarning: + warnings.warn(w.message, w.category) + + +@contextmanager +def torch_distributed_zero_first(local_rank: int): + """ + Decorator to make all processes in distributed training wait for each local_master to do something. + + Args: + local_rank (`int`): The rank of the local process. + """ + if local_rank not in [-1, 0]: + dist.barrier() + yield + if local_rank == 0: + dist.barrier() + + +class DistributedSamplerWithLoop(DistributedSampler): + """ + Like a torch.utils.data.distributed.DistributedSampler` but loops at the end back to the beginning of the shuffled + samples to make each process have a round multiple of batch_size samples. + + Args: + dataset (`torch.utils.data.Dataset`): + Dataset used for sampling. + batch_size (`int`): + The batch size used with this sampler + kwargs (`dict[str, Any]`, *optional*): + All other keyword arguments passed to `DistributedSampler`. + """ + + def __init__(self, dataset, batch_size, **kwargs): + super().__init__(dataset, **kwargs) + self.batch_size = batch_size + + def __iter__(self): + indices = list(super().__iter__()) + remainder = 0 if len(indices) % self.batch_size == 0 else self.batch_size - len(indices) % self.batch_size + # DistributedSampler already added samples from the beginning to make the number of samples a round multiple + # of the world size, so we skip those. + start_remainder = 1 if self.rank < len(self.dataset) % self.num_replicas else 0 + indices += indices[start_remainder : start_remainder + remainder] + return iter(indices) + + +class EvalLoopContainer: + """ + Container to store intermediate results of evaluation loop. + + Args: + do_nested_concat (`bool`, *optional*, defaults to `True`): + If set to `True`, each iteration will recursively concatenate a new object containing tensors to + the existing stored tensors, provided that the structure of the existing object and the new one + are identical. If set to `False`, all newly added tensors will be stored in a list. + padding_index (`int`, *optional*, defaults to -100): + Value used to pad tensors of different shapes when `do_nested_concat=True`. + """ + + def __init__(self, do_nested_concat: bool = True, padding_index: int = -100): + self.do_nested_concat = do_nested_concat + self.padding_index = padding_index + self.tensors = None + self.arrays = None + + def add(self, tensors) -> None: + """Add tensors to the stored objects. If `do_nested_concat=True`, the tensors will be concatenated recursively.""" + if self.tensors is None: + self.tensors = tensors if self.do_nested_concat else [tensors] + elif self.do_nested_concat: + self.tensors = nested_concat(self.tensors, tensors, padding_index=self.padding_index) + else: + self.tensors.append(tensors) + + def to_cpu_and_numpy(self) -> None: + """Move tensors in stored objects to CPU and convert them to numpy arrays.""" + + # Check if we have something to add, if not just return + if self.tensors is None: + return + + new_arrays = nested_numpify(self.tensors) + if self.arrays is None: + self.arrays = new_arrays + elif self.do_nested_concat: + self.arrays = nested_concat(self.arrays, new_arrays, padding_index=self.padding_index) + else: + self.arrays.extend(new_arrays) + + # reset device tensors after adding to cpu + self.tensors = None + + def get_arrays(self): + """Returns the numpified and moved to CPU stored objects.""" + self.to_cpu_and_numpy() + return self.arrays + + +def get_tpu_sampler(dataset: torch.utils.data.Dataset, batch_size: int): + if xr.world_size() <= 1: + return RandomSampler(dataset) + return DistributedSampler(dataset, num_replicas=xr.world_size(), rank=xr.global_ordinal()) + + +def nested_new_like(arrays, num_samples, padding_index=-100): + """Create the same nested structure as `arrays` with a first dimension always at `num_samples`.""" + if isinstance(arrays, (list, tuple)): + return type(arrays)(nested_new_like(x, num_samples) for x in arrays) + return np.full_like(arrays, padding_index, shape=(num_samples, *arrays.shape[1:])) + + +def expand_like(arrays, new_seq_length, padding_index=-100): + """Expand the `arrays` so that the second dimension grows to `new_seq_length`. Uses `padding_index` for padding.""" + result = np.full_like(arrays, padding_index, shape=(arrays.shape[0], new_seq_length) + arrays.shape[2:]) + result[:, : arrays.shape[1]] = arrays + return result + + +def nested_truncate(tensors, limit): + "Truncate `tensors` at `limit` (even if it's a nested list/tuple/dict of tensors)." + if isinstance(tensors, (list, tuple)): + return type(tensors)(nested_truncate(t, limit) for t in tensors) + if isinstance(tensors, Mapping): + return type(tensors)({k: nested_truncate(t, limit) for k, t in tensors.items()}) + + return tensors[:limit] + + +@dataclass +class LabelSmoother: + """ + Adds label-smoothing on a pre-computed output from a Transformers model. + + Args: + epsilon (`float`, *optional*, defaults to 0.1): + The label smoothing factor. + ignore_index (`int`, *optional*, defaults to -100): + The index in the labels to ignore when computing the loss. + """ + + epsilon: float = 0.1 + ignore_index: int = -100 + + def __call__(self, model_output, labels, shift_labels=False): + logits = model_output["logits"] if isinstance(model_output, dict) else model_output[0] + if shift_labels: + logits = logits[..., :-1, :].contiguous() + labels = labels[..., 1:].contiguous() + + log_probs = -nn.functional.log_softmax(logits, dim=-1) + if labels.dim() == log_probs.dim() - 1: + labels = labels.unsqueeze(-1) + + padding_mask = labels.eq(self.ignore_index) + # In case the ignore_index is -100, the gather will fail, so we replace labels by 0. The padding_mask + # will ignore them in any case. + labels = torch.clamp(labels, min=0) + nll_loss = log_probs.gather(dim=-1, index=labels) + # works for fp16 input tensor too, by internally upcasting it to fp32 + smoothed_loss = log_probs.sum(dim=-1, keepdim=True, dtype=torch.float32) + + nll_loss.masked_fill_(padding_mask, 0.0) + smoothed_loss.masked_fill_(padding_mask, 0.0) + + # Take the mean over the label dimensions, then divide by the number of active elements (i.e. not-padded): + num_active_elements = padding_mask.numel() - padding_mask.long().sum() + nll_loss = nll_loss.sum() / num_active_elements + smoothed_loss = smoothed_loss.sum() / (num_active_elements * log_probs.shape[-1]) + return (1 - self.epsilon) * nll_loss + self.epsilon * smoothed_loss + + +def get_length_grouped_indices(lengths, batch_size, mega_batch_mult=None, generator=None): + """ + Return a list of indices so that each slice of `batch_size` consecutive indices correspond to elements of similar + lengths. To do this, the indices are: + + - randomly permuted + - grouped in mega-batches of size `mega_batch_mult * batch_size` + - sorted by length in each mega-batch + + The result is the concatenation of all mega-batches, with the batch of `batch_size` containing the element of + maximum length placed first, so that an OOM happens sooner rather than later. + """ + # Default for mega_batch_mult: 50 or the number to get 4 megabatches, whichever is smaller. + if mega_batch_mult is None: + mega_batch_mult = min(len(lengths) // (batch_size * 4), 50) + # Just in case, for tiny datasets + if mega_batch_mult == 0: + mega_batch_mult = 1 + + # We need to use torch for the random part as a distributed sampler will set the random seed for torch. + indices = torch.randperm(len(lengths), generator=generator) + megabatch_size = mega_batch_mult * batch_size + megabatches = [indices[i : i + megabatch_size].tolist() for i in range(0, len(lengths), megabatch_size)] + megabatches = [sorted(megabatch, key=lambda i: lengths[i], reverse=True) for megabatch in megabatches] + + # The rest is to get the biggest batch first. + # Since each megabatch is sorted by descending length, the longest element is the first + megabatch_maximums = [lengths[megabatch[0]] for megabatch in megabatches] + max_idx = torch.argmax(torch.tensor(megabatch_maximums)).item() + # Switch to put the longest element in first position + megabatches[0][0], megabatches[max_idx][0] = megabatches[max_idx][0], megabatches[0][0] + + return [i for megabatch in megabatches for i in megabatch] + + +class LengthGroupedSampler(Sampler): + r""" + Sampler that samples indices in a way that groups together features of the dataset of roughly the same length while + keeping a bit of randomness. + """ + + def __init__( + self, + batch_size: int, + dataset: Dataset | None = None, + lengths: list[int] | None = None, + model_input_name: str | None = None, + generator=None, + ): + if dataset is None and lengths is None: + raise ValueError("One of dataset and lengths must be provided.") + + self.batch_size = batch_size + if lengths is None: + model_input_name = model_input_name if model_input_name is not None else "input_ids" + if not isinstance(dataset[0], (dict, BatchEncoding)) or model_input_name not in dataset[0]: + raise ValueError( + "Can only automatically infer lengths for datasets whose items are dictionaries with an " + f"'{model_input_name}' key." + ) + lengths = [len(feature[model_input_name]) for feature in dataset] + elif isinstance(lengths, torch.Tensor): + logger.info( + "If lengths is a torch.Tensor, LengthGroupedSampler will be slow. Converting lengths to list[int]..." + ) + lengths = lengths.tolist() + + self.lengths = lengths + self.generator = generator + + def __len__(self): + return len(self.lengths) + + def __iter__(self): + indices = get_length_grouped_indices(self.lengths, self.batch_size, generator=self.generator) + return iter(indices) + + +class DistributedLengthGroupedSampler(DistributedSampler): + r""" + Distributed Sampler that samples indices in a way that groups together features of the dataset of roughly the same + length while keeping a bit of randomness. + """ + + # Copied and adapted from PyTorch DistributedSampler. + def __init__( + self, + batch_size: int, + dataset: Dataset | None = None, + num_replicas: int | None = None, + rank: int | None = None, + seed: int = 0, + drop_last: bool = False, + lengths: list[int] | None = None, + model_input_name: str | None = None, + ): + if dataset is None and lengths is None: + raise ValueError("One of dataset and lengths must be provided.") + if num_replicas is None: + if not dist.is_available(): + raise RuntimeError("Requires distributed package to be available") + num_replicas = dist.get_world_size() + if rank is None: + if not dist.is_available(): + raise RuntimeError("Requires distributed package to be available") + rank = dist.get_rank() + + self.batch_size = batch_size + self.num_replicas = num_replicas + self.rank = rank + self.epoch = 0 + self.drop_last = drop_last + + if lengths is None: + model_input_name = model_input_name if model_input_name is not None else "input_ids" + if not isinstance(dataset[0], (dict, BatchEncoding)) or model_input_name not in dataset[0]: + raise ValueError( + "Can only automatically infer lengths for datasets whose items are dictionaries with an " + f"'{model_input_name}' key." + ) + lengths = [len(feature[model_input_name]) for feature in dataset] + elif isinstance(lengths, torch.Tensor): + logger.info( + "If lengths is a torch.Tensor, DistributedLengthGroupedSampler will be slow. Converting lengths to" + " list[int]..." + ) + lengths = lengths.tolist() + + self.lengths = lengths + + # If the dataset length is evenly divisible by # of replicas, then there + # is no need to drop any data, since the dataset will be split equally. + if self.drop_last and len(self.lengths) % self.num_replicas != 0: + # Split to nearest available length that is evenly divisible. + # This is to ensure each rank receives the same amount of data when + # using this Sampler. + self.num_samples = math.ceil((len(self.lengths) - self.num_replicas) / self.num_replicas) + else: + self.num_samples = math.ceil(len(self.lengths) / self.num_replicas) + self.total_size = self.num_samples * self.num_replicas + self.seed = seed + + def __iter__(self) -> Iterator: + # Deterministically shuffle based on epoch and seed + g = torch.Generator() + g.manual_seed(self.seed + self.epoch) + indices = get_length_grouped_indices(self.lengths, self.batch_size, generator=g) + + if not self.drop_last: + # add extra samples to make it evenly divisible + indices += indices[: (self.total_size - len(indices))] + else: + # remove tail of data to make it evenly divisible + indices = indices[: self.total_size] + assert len(indices) == self.total_size + + # subsample + indices = indices[self.rank : self.total_size : self.num_replicas] + assert len(indices) == self.num_samples + + return iter(indices) + + +class ShardSampler(Sampler): + """ + Sampler that shards batches between several processes. Dispatches indices batch by batch: on 2 processes with batch + size 4, the first two batches are `[0, 1, 2, 3, 4, 5, 6, 7]` and `[8, 9, 10, 11, 12, 13, 14, 15]`, which shard into + `[0, 1, 2, 3]` and `[8, 9, 10, 11]` for GPU-0 and `[4, 5, 6, 7]` and `[12, 13, 14, 15]` for GPU-1. + + The sampler thus yields `[0, 1, 2, 3, 8, 9, 10, 11]` on GPU-0 and `[4, 5, 6, 7, 12, 13, 14, 15]` on GPU-1. + """ + + def __init__( + self, + dataset: Dataset, + batch_size: int = 1, + drop_last: bool = False, + num_processes: int = 1, + process_index: int = 0, + ): + self.dataset = dataset + self.batch_size = batch_size + self.drop_last = drop_last + self.num_processes = num_processes + self.process_index = process_index + + self.total_batch_size = total_batch_size = batch_size * num_processes + + num_batches = len(dataset) // total_batch_size if drop_last else math.ceil(len(dataset) / total_batch_size) + self.total_num_samples = num_batches * total_batch_size + + def __iter__(self): + indices = list(range(len(self.dataset))) + + # Add extra samples to make it evenly divisible. While loop is there in the edge case we have a tiny dataset + # and it needs to be done several times. + while len(indices) < self.total_num_samples: + indices += indices[: (self.total_num_samples - len(indices))] + + result = [] + for batch_start in range(self.batch_size * self.process_index, self.total_num_samples, self.total_batch_size): + result += indices[batch_start : batch_start + self.batch_size] + + return iter(result) + + def __len__(self): + # Each shard only sees a fraction of total_num_samples. + return self.total_num_samples // self.num_processes + + +class IterableDatasetShard(IterableDataset): + """ + Wraps a PyTorch `IterableDataset` to generate samples for one of the processes only. Instances of this class will + always yield a number of samples that is a round multiple of the actual batch size (which is `batch_size x + num_processes`). Depending on the value of the `drop_last` attribute, it will either stop the iteration at the + first batch that would be too small or loop with indices from the beginning. + + On two processes with an iterable dataset yielding of `[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]` with a batch size of + 2: + + - the shard on process 0 will yield `[0, 1, 4, 5, 8, 9]` so will see batches `[0, 1]`, `[4, 5]`, `[8, 9]` + - the shard on process 1 will yield `[2, 3, 6, 7, 10, 11]` so will see batches `[2, 3]`, `[6, 7]`, `[10, 11]` + + + + If your IterableDataset implements some randomization that needs to be applied the same way on all processes + (for instance, a shuffling), you should use a `torch.Generator` in a `generator` attribute of the `dataset` to + generate your random numbers and call the [`~trainer_pt_utils.IterableDatasetShard.set_epoch`] method of this + object. It will set the seed of this `generator` to `seed + epoch` on all processes before starting the + iteration. Alternatively, you can also implement a `set_epoch()` method in your iterable dataset to deal with + this. + + + + Args: + dataset (`torch.utils.data.IterableDataset`): + The batch sampler to split in several shards. + batch_size (`int`, *optional*, defaults to 1): + The size of the batches per shard. + drop_last (`bool`, *optional*, defaults to `False`): + Whether or not to drop the last incomplete batch or complete the last batches by using the samples from the + beginning. + num_processes (`int`, *optional*, defaults to 1): + The number of processes running concurrently. + process_index (`int`, *optional*, defaults to 0): + The index of the current process. + seed (`int`, *optional*, defaults to 0): + A random seed that will be used for the random number generation in + [`~trainer_pt_utils.IterableDatasetShard.set_epoch`]. + """ + + def __init__( + self, + dataset: IterableDataset, + batch_size: int = 1, + drop_last: bool = False, + num_processes: int = 1, + process_index: int = 0, + seed: int = 0, + ): + self.dataset = dataset + self.batch_size = batch_size + self.drop_last = drop_last + self.num_processes = num_processes + self.process_index = process_index + self.seed = seed + self.epoch = 0 + self.num_examples = 0 + + def set_epoch(self, epoch): + self.epoch = epoch + if hasattr(self.dataset, "set_epoch"): + self.dataset.set_epoch(epoch) + + def __iter__(self): + self.num_examples = 0 + if ( + not hasattr(self.dataset, "set_epoch") + and hasattr(self.dataset, "generator") + and isinstance(self.dataset.generator, torch.Generator) + ): + self.dataset.generator.manual_seed(self.seed + self.epoch) + real_batch_size = self.batch_size * self.num_processes + process_slice = range(self.process_index * self.batch_size, (self.process_index + 1) * self.batch_size) + + first_batch = None + current_batch = [] + for element in self.dataset: + self.num_examples += 1 + current_batch.append(element) + # Wait to have a full batch before yielding elements. + if len(current_batch) == real_batch_size: + for i in process_slice: + yield current_batch[i] + if first_batch is None: + first_batch = current_batch.copy() + current_batch = [] + + # Finished if drop_last is True, otherwise complete the last batch with elements from the beginning. + if not self.drop_last and len(current_batch) > 0: + if first_batch is None: + first_batch = current_batch.copy() + while len(current_batch) < real_batch_size: + current_batch += first_batch + for i in process_slice: + yield current_batch[i] + + def __len__(self): + # Will raise an error if the underlying dataset is not sized. + if self.drop_last: + return (len(self.dataset) // (self.batch_size * self.num_processes)) * self.batch_size + else: + return math.ceil(len(self.dataset) / (self.batch_size * self.num_processes)) * self.batch_size + + +def _secs2timedelta(secs): + """ + Convert seconds to hh:mm:ss.msec, msecs rounded to 2 decimal places. + """ + + msec = int(abs(secs - int(secs)) * 100) + return f"{datetime.timedelta(seconds=int(secs))}.{msec:02d}" + + +def metrics_format(metrics: dict[str, float]) -> dict[str, float]: + """ + Reformat Trainer metrics values to a human-readable format. + + Args: + metrics (`dict[str, float]`): + The metrics returned from train/evaluate/predict + + Returns: + metrics (`dict[str, float]`): The reformatted metrics + """ + + metrics_copy = metrics.copy() + for k, v in metrics_copy.items(): + if "_mem_" in k: + metrics_copy[k] = f"{v >> 20}MB" + elif "_runtime" in k: + metrics_copy[k] = _secs2timedelta(v) + elif k == "total_flos": + metrics_copy[k] = f"{int(v) >> 30}GF" + elif isinstance(metrics_copy[k], float): + metrics_copy[k] = round(v, 4) + + return metrics_copy + + +# Trainer helper method: imported into the Trainer class and used as a method (takes `self` as first argument). +def log_metrics(self, split, metrics): + """ + Log metrics in a specially formatted way. + + Under distributed environment this is done only for a process with rank 0. + + Args: + split (`str`): + Mode/split name: one of `train`, `eval`, `test` + metrics (`dict[str, float]`): + The metrics returned from train/evaluate/predictmetrics: metrics dict + + Notes on memory reports: + + In order to get memory usage report you need to install `psutil`. You can do that with `pip install psutil`. + + Now when this method is run, you will see a report that will include: + + ``` + init_mem_cpu_alloc_delta = 1301MB + init_mem_cpu_peaked_delta = 154MB + init_mem_gpu_alloc_delta = 230MB + init_mem_gpu_peaked_delta = 0MB + train_mem_cpu_alloc_delta = 1345MB + train_mem_cpu_peaked_delta = 0MB + train_mem_gpu_alloc_delta = 693MB + train_mem_gpu_peaked_delta = 7MB + ``` + + **Understanding the reports:** + + - the first segment, e.g., `train__`, tells you which stage the metrics are for. Reports starting with `init_` + will be added to the first stage that gets run. So that if only evaluation is run, the memory usage for the + `__init__` will be reported along with the `eval_` metrics. + - the third segment, is either `cpu` or `gpu`, tells you whether it's the general RAM or the gpu0 memory + metric. + - `*_alloc_delta` - is the difference in the used/allocated memory counter between the end and the start of the + stage - it can be negative if a function released more memory than it allocated. + - `*_peaked_delta` - is any extra memory that was consumed and then freed - relative to the current allocated + memory counter - it is never negative. When you look at the metrics of any stage you add up `alloc_delta` + + `peaked_delta` and you know how much memory was needed to complete that stage. + + The reporting happens only for process of rank 0 and gpu 0 (if there is a gpu). Typically this is enough since the + main process does the bulk of work, but it could be not quite so if model parallel is used and then other GPUs may + use a different amount of gpu memory. This is also not the same under DataParallel where gpu0 may require much more + memory than the rest since it stores the gradient and optimizer states for all participating GPUs. Perhaps in the + future these reports will evolve to measure those too. + + The CPU RAM metric measures RSS (Resident Set Size) includes both the memory which is unique to the process and the + memory shared with other processes. It is important to note that it does not include swapped out memory, so the + reports could be imprecise. + + The CPU peak memory is measured using a sampling thread. Due to python's GIL it may miss some of the peak memory if + that thread didn't get a chance to run when the highest memory was used. Therefore this report can be less than + reality. Using `tracemalloc` would have reported the exact peak memory, but it doesn't report memory allocations + outside of python. So if some C++ CUDA extension allocated its own memory it won't be reported. And therefore it + was dropped in favor of the memory sampling approach, which reads the current process memory usage. + + The GPU allocated and peak memory reporting is done with `torch.cuda.memory_allocated()` and + `torch.cuda.max_memory_allocated()`. This metric reports only "deltas" for pytorch-specific allocations, as + `torch.cuda` memory management system doesn't track any memory allocated outside of pytorch. For example, the very + first cuda call typically loads CUDA kernels, which may take from 0.5 to 2GB of GPU memory. + + Note that this tracker doesn't account for memory allocations outside of [`Trainer`]'s `__init__`, `train`, + `evaluate` and `predict` calls. + + Because `evaluation` calls may happen during `train`, we can't handle nested invocations because + `torch.cuda.max_memory_allocated` is a single counter, so if it gets reset by a nested eval call, `train`'s tracker + will report incorrect info. If this [pytorch issue](https://github.com/pytorch/pytorch/issues/16266) gets resolved + it will be possible to change this class to be re-entrant. Until then we will only track the outer level of + `train`, `evaluate` and `predict` methods. Which means that if `eval` is called during `train`, it's the latter + that will account for its memory usage and that of the former. + + This also means that if any other tool that is used along the [`Trainer`] calls + `torch.cuda.reset_peak_memory_stats`, the gpu peak memory stats could be invalid. And the [`Trainer`] will disrupt + the normal behavior of any such tools that rely on calling `torch.cuda.reset_peak_memory_stats` themselves. + + For best performance you may want to consider turning the memory profiling off for production runs. + """ + if not self.is_world_process_zero(): + return + + print(f"***** {split} metrics *****") + metrics_formatted = metrics_format(metrics) + k_width = max(len(str(x)) for x in metrics_formatted) + v_width = max(len(str(x)) for x in metrics_formatted.values()) + for key in sorted(metrics_formatted.keys()): + print(f" {key: <{k_width}} = {metrics_formatted[key]:>{v_width}}") + + +# Trainer helper method +def save_metrics(self, split, metrics, combined=True): + """ + Save metrics into a json file for that split, e.g. `train_results.json`. + + Under distributed environment this is done only for a process with rank 0. + + Args: + split (`str`): + Mode/split name: one of `train`, `eval`, `test`, `all` + metrics (`dict[str, float]`): + The metrics returned from train/evaluate/predict + combined (`bool`, *optional*, defaults to `True`): + Creates combined metrics by updating `all_results.json` with metrics of this call + + To understand the metrics please read the docstring of [`~Trainer.log_metrics`]. The only difference is that raw + unformatted numbers are saved in the current method. + + """ + if not self.is_world_process_zero(): + return + + path = os.path.join(self.args.output_dir, f"{split}_results.json") + with open(path, "w") as f: + json.dump(metrics, f, indent=4, sort_keys=True) + + if combined: + path = os.path.join(self.args.output_dir, "all_results.json") + if os.path.exists(path): + with open(path) as f: + all_metrics = json.load(f) + else: + all_metrics = {} + + all_metrics.update(metrics) + with open(path, "w") as f: + json.dump(all_metrics, f, indent=4, sort_keys=True) + + +# Trainer helper method +def save_state(self): + """ + Saves the Trainer state, since Trainer.save_model saves only the tokenizer with the model. + + Under distributed environment this is done only for a process with rank 0. + """ + if not self.is_world_process_zero(): + return + + path = os.path.join(self.args.output_dir, "trainer_state.json") + self.state.save_to_json(path) + + +# Trainer helper method +def get_num_trainable_parameters(self) -> int: + """ + Get the number of trainable parameters. + """ + return sum(p.numel() for p in self.model.parameters() if p.requires_grad) + + +# Trainer helper method +def get_learning_rates(self) -> list[float]: + """ + Returns the learning rate of each parameter from self.optimizer. + """ + if self.optimizer is None: + raise ValueError("Trainer optimizer is None, please make sure you have setup the optimizer before.") + return [group["lr"] for group in self.optimizer.param_groups] + + +# Trainer helper method +def get_optimizer_group(self, param: str | torch.nn.parameter.Parameter | None = None): + """ + Returns optimizer group for a parameter if given, else returns all optimizer groups for params. + + Args: + param (`str` or `torch.nn.parameter.Parameter`, *optional*): + The parameter for which optimizer group needs to be returned. + """ + if self.optimizer is None: + raise ValueError("Trainer optimizer is None, please make sure you have setup the optimizer before.") + if param is not None: + for group in self.optimizer.param_groups: + if param in group["params"]: + return group + return [group["params"] for group in self.optimizer.param_groups] + + +def get_model_param_count(model, trainable_only=False): + """ + Calculate model's total param count. If trainable_only is True then count only those requiring grads. + """ + if is_deepspeed_zero3_enabled(): + + def numel(p): + return p.ds_numel if hasattr(p, "ds_numel") else p.numel() + + else: + + def numel(p): + return p.numel() + + return sum(numel(p) for p in model.parameters() if not trainable_only or p.requires_grad) + + +def get_parameter_names(model, forbidden_layer_types, forbidden_layer_names=None): + """ + Returns the names of the model parameters that are not inside a forbidden layer. + """ + forbidden_layer_patterns = ( + [re.compile(pattern) for pattern in forbidden_layer_names] if forbidden_layer_names is not None else [] + ) + result = [] + for name, child in model.named_children(): + child_params = get_parameter_names(child, forbidden_layer_types, forbidden_layer_names) + result += [ + f"{name}.{n}" + for n in child_params + if not isinstance(child, tuple(forbidden_layer_types)) + and not any(pattern.search(f"{name}.{n}".lower()) for pattern in forbidden_layer_patterns) + ] + # Add model specific parameters that are not in any child + result += [ + k for k in model._parameters if not any(pattern.search(k.lower()) for pattern in forbidden_layer_patterns) + ] + + return result + + +def get_module_class_from_name(module, name): + """ + Gets a class from a module by its name. + + Args: + module (`torch.nn.Module`): The module to get the class from. + name (`str`): The name of the class. + """ + modules_children = list(module.children()) + if module.__class__.__name__ == name: + return module.__class__ + elif len(modules_children) == 0: + return + else: + for child_module in modules_children: + module_class = get_module_class_from_name(child_module, name) + if module_class is not None: + return module_class + + +def remove_dummy_checkpoint(is_main_process, output_dir, filenames): + if is_main_process: + for filename in filenames: + file = os.path.join(output_dir, filename) + if os.path.isfile(file): + os.remove(file) + + +if is_sagemaker_mp_enabled(): + import smdistributed.modelparallel.torch as smp + + @smp.step() + def smp_forward_backward(model, inputs, gradient_accumulation_steps=1): + outputs = model(**inputs) + loss = outputs["loss"] if isinstance(outputs, dict) else outputs[0] + loss /= gradient_accumulation_steps + model.backward(loss) + return loss + + @smp.step() + def smp_forward_only(model, inputs): + return model(**inputs) + + def smp_gather(tensor): + if isinstance(tensor, (list, tuple)): + return type(tensor)(smp_gather(t) for t in tensor) + elif isinstance(tensor, dict): + return type(tensor)({k: smp_gather(v) for k, v in tensor.items()}) + elif not isinstance(tensor, torch.Tensor): + raise TypeError( + f"Can't gather the values of type {type(tensor)}, only of nested list/tuple/dicts of tensors." + ) + all_tensors = smp.allgather(tensor, smp.CommGroup.DP_GROUP) + all_tensors = [atleast_1d(t) for t in all_tensors] + return torch.cat([t.cpu() for t in all_tensors], dim=0) + + def smp_nested_concat(tensor): + if isinstance(tensor, (list, tuple)): + return type(tensor)(smp_nested_concat(t) for t in tensor) + elif isinstance(tensor, dict): + return type(tensor)({k: smp_nested_concat(v) for k, v in tensor.items()}) + # It doesn't seem possible to check here if `tensor` is a StepOutput because StepOutput lives in `smp.step` + # which is also the name of the decorator so Python is confused. + return tensor.detach().concat().cpu() + + +@dataclass +class AcceleratorConfig: + """ + A subset of arguments relating to the underlying [`accelerate.Accelerator`] + implementation utilized in the `Trainer` that can be customized. + Mostly relating to data. + + Parameters: + split_batches (`bool`, *optional*, defaults to `False`): + Whether or not the accelerator should split the batches yielded by the dataloaders across the devices. If + `True` the actual batch size used will be the same on any kind of distributed processes, but it must be a + round multiple of the `num_processes` you are using. If `False`, actual batch size used will be the one set + in your script multiplied by the number of processes. + dispatch_batches (`bool`, *optional*): + If set to `True`, the dataloader prepared by the Accelerator is only iterated through on the main process + and then the batches are split and broadcast to each process. Will default to `True` for `DataLoader` whose + underlying dataset is an `IterableDataset`, `False` otherwise. + even_batches (`bool`, *optional*, defaults to `True`): + If set to `True`, in cases where the total batch size across all processes does not exactly divide the + dataset, samples at the start of the dataset will be duplicated so the batch can be divided equally among + all workers. + use_seedable_sampler (`bool`, *optional*, defaults to `True`): + Whether or not use a fully seedable random sampler ([`accelerate.data_loader.SeedableRandomSampler`]). Ensures + training results are fully reproducible using a different sampling technique. While seed-to-seed results + may differ, on average the differences are negligible when using multiple different seeds to compare. Should + also be ran with [`~utils.set_seed`] for the best results. + gradient_accumulation_kwargs (`dict`, *optional*): + Additional kwargs to configure gradient accumulation, see [`accelerate.utils.GradientAccumulationPlugin`]. + Any of the following (optional) keys are acceptable: + num_steps (`int`): Will take precedence over [`~.TrainingArguments.gradient_accumulation_steps`] if + the latter is set to 1, otherwise an exception will be raised. + sync_each_batch (`bool`): Whether to synchronize the gradients at each data batch. + The [`accelerate.utils.GradientAccumulationPlugin`] default is `False`. + non_blocking (`bool`, *optional*, defaults to `False`): + Whether to use non-blocking CUDA calls to help minimize synchronization during + distributed training with prepared `DataLoader` inputs being moved to device. + Best if used with `pin_memory=True` in the `TrainingArguments`. + use_configured_state (`bool*, *optional*, defaults to `False`): + Whether or not to use a pre-configured `AcceleratorState` or `PartialState` defined + before calling `TrainingArguments`. If `True`, an `Accelerator` or `PartialState` + must be initialized. May lead to issues using sweeps or hyperparameter tuning. + + """ + + # Data related arguments + split_batches: bool = field( + default=False, + metadata={ + "help": "Whether or not the accelerator should split the batches yielded by the dataloaders across the devices. If" + " `True` the actual batch size used will be the same on any kind of distributed processes, but it must be a" + " round multiple of the `num_processes` you are using. If `False`, actual batch size used will be the one set" + " in your script multiplied by the number of processes." + }, + ) + dispatch_batches: bool | None = field( + default=None, + metadata={ + "help": "If set to `True`, the dataloader prepared by the Accelerator is only iterated through on the main process" + " and then the batches are split and broadcast to each process. Will default to `True` for `DataLoader` whose" + " underlying dataset is an `IterableDataslet`, `False` otherwise." + }, + ) + even_batches: bool = field( + default=True, + metadata={ + "help": "If set to `True`, in cases where the total batch size across all processes does not exactly divide the" + " dataset, samples at the start of the dataset will be duplicated so the batch can be divided equally among" + " all workers." + }, + ) + use_seedable_sampler: bool = field( + default=True, + metadata={ + "help": "Whether or not use a fully seedable random sampler ([`accelerate.data_loader.SeedableRandomSampler`])." + "Ensures training results are fully reproducible using a different sampling technique. " + "While seed-to-seed results may differ, on average the differences are negligible when using" + "multiple different seeds to compare. Should also be ran with [`~utils.set_seed`] for the best results." + }, + ) + + non_blocking: bool = field( + default=False, + metadata={ + "help": "Whether to use non-blocking CUDA calls to help minimize synchronization during " + "distributed training with prepared `DataLoader` inputs being moved to device. " + "Best if used with `pin_memory=True` in the `TrainingArguments`. Requires accelerate " + "v0.30.0." + }, + ) + + gradient_accumulation_kwargs: dict | None = field( + default=None, + metadata={ + "help": "Additional kwargs to configure gradient accumulation, see [`accelerate.utils.GradientAccumulationPlugin`]. " + "Any of the following (optional) keys are acceptable: " + " num_steps (`int`): Will take precedence over [`~.TrainingArguments.gradient_accumulation_steps`] if " + " the latter is set to 1, otherwise an exception will be raised. " + " sync_each_batch (`bool`): Whether to synchronize the gradients at each data batch. " + " The [`accelerate.utils.GradientAccumulationPlugin`] default is `False`." + }, + ) + use_configured_state: bool = field( + default=False, + metadata={ + "help": "Whether or not to use a pre-configured `AcceleratorState` or `PartialState` defined before calling `TrainingArguments`." + "If `True`, an `Accelerator` or `PartialState` must be initialized. May lead to issues using sweeps or hyperparameter tuning." + }, + ) + + @classmethod + def from_json_file(cls, json_file): + # Check if exists + open_file = io.open if os.path.exists(json_file) else open + with open_file(json_file, "r", encoding="utf-8") as f: + config_dict = json.load(f) + # Check for keys and load sensible defaults + extra_keys = sorted(key for key in config_dict if key not in cls.__dataclass_fields__) + if len(extra_keys) > 0: + raise ValueError( + f"The config file at {json_file} had unknown keys ({extra_keys}), please try upgrading your `transformers`" + " version or fix (and potentially remove these keys) from your config file." + ) + return cls(**config_dict) + + def to_dict(self): + return copy.deepcopy(self.__dict__) + + def pop(self, key, default=None): + return self.__dict__.pop(key, default) + + +class LayerWiseDummyOptimizer(torch.optim.Optimizer): + """ + For Layer-wise optimizers such as GaLoRE optimizer, the optimization + step is already done through the post gradient hooks. Therefore + the trick is to create a dummy optimizer that can take arbitrary + args and kwargs and return a no-op during training. + + Initial idea from @hiyouga in LLaMA-Factory: + https://github.com/hiyouga/LLaMA-Factory/commit/8664262cde3919e10eaecbd66e8c5d356856362e#diff-ebe08ab14496dfb9e06075f0fdd36799ef6d1535cc4dd4715b74c4e3e06fe3ba + """ + + def __init__(self, optimizer_dict=None, **kwargs): + dummy_tensor = torch.randn(1, 1) + self.optimizer_dict = optimizer_dict + super().__init__([dummy_tensor], {"lr": kwargs.get("lr", 1e-03)}) + + def zero_grad(self, set_to_none: bool = True) -> None: + pass + + def step(self, closure=None) -> float | None: + pass + + +class LayerWiseDummyScheduler(LRScheduler): + """ + For Layer-wise optimizers such as GaLoRE optimizer, the optimization and scheduling step + are already done through the post gradient hooks. Therefore + the trick is to create a dummy scheduler that can take arbitrary + args and kwargs and return a no-op during training. + """ + + def __init__(self, *args, **kwargs): + self.default_lr = kwargs["lr"] + optimizer = LayerWiseDummyOptimizer(**kwargs) + last_epoch = -1 + super().__init__(optimizer, last_epoch) + + def get_lr(self): + # default value + lrs = [self.default_lr] + + # we take each lr in the parameters if they exist, assumes the optimizer to be the `LayerWiseDummyOptimizer` + if self.optimizer is not None: + param_wise_lrs = [ + [group["lr"] for group in optim.param_groups] for optim in self.optimizer.optimizer_dict.values() + ] + lrs = list(chain(*param_wise_lrs)) + + return lrs + + def _get_closed_form_lr(self): + return self.base_lrs + + +def set_rng_state_for_device(device_name, device_module, checkpoint_rng_state, is_distributed): + """Helper to set RNG state for a specific device type (CUDA, NPU, MLU, MUSA)""" + device_state_key = device_name.lower() + err_template = "Didn't manage to set back the RNG states of the {backend} because of the following error:\n {exception}\nThis won't yield the same results as if the training had not been interrupted." + try: + if is_distributed: + device_module.random.set_rng_state_all(checkpoint_rng_state[device_state_key]) + else: + device_module.random.set_rng_state(checkpoint_rng_state[device_state_key]) + except Exception as e: + # Log error if setting RNG state fails + logger.error(err_template.format(backend=device_name, exception=e)) + + +def safe_globals(): + """ + Context manager to allowlist numpy objects for torch.load with weights_only=True. + + Starting from version 2.4 PyTorch introduces a check for the objects loaded + with torch.load(weights_only=True). Starting from 2.6 weights_only=True becomes + a default and requires allowlisting of objects being loaded. + + See: https://github.com/pytorch/pytorch/pull/137602 + See: https://pytorch.org/docs/stable/notes/serialization.html#torch.serialization.add_safe_globals + See: https://github.com/huggingface/accelerate/pull/3036 + """ + if version.parse(torch.__version__).release < version.parse("2.6").release: + return contextlib.nullcontext() + + np_core = np._core if version.parse(np.__version__) >= version.parse("2.0.0") else np.core + allowlist = [np_core.multiarray._reconstruct, np.ndarray, np.dtype] + # numpy >1.25 defines numpy.dtypes.UInt32DType, but below works for + # all versions of numpy + allowlist += [type(np.dtype(np.uint32))] + + return torch.serialization.safe_globals(allowlist) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_seq2seq.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_seq2seq.py new file mode 100644 index 0000000000000000000000000000000000000000..2e1e6defcab055795754d21227c4ab085aada940 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_seq2seq.py @@ -0,0 +1,390 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import contextlib +from collections.abc import Callable +from copy import deepcopy +from pathlib import Path +from typing import TYPE_CHECKING, Any, Optional, Union + +import torch +from torch import nn +from torch.distributed.fsdp import FullyShardedDataParallel +from torch.utils.data import Dataset + +from .generation.configuration_utils import GenerationConfig +from .integrations.deepspeed import is_deepspeed_zero3_enabled +from .integrations.fsdp import is_fsdp_managed_module +from .trainer import Trainer +from .utils import is_datasets_available, logging + + +if is_datasets_available(): + import datasets + +if TYPE_CHECKING: + from torch.utils.data import IterableDataset + + from .data.data_collator import DataCollator + from .feature_extraction_utils import FeatureExtractionMixin + from .image_processing_utils import BaseImageProcessor + from .modeling_utils import PreTrainedModel + from .processing_utils import ProcessorMixin + from .tokenization_utils_base import PreTrainedTokenizerBase + from .trainer_callback import TrainerCallback + from .trainer_utils import EvalPrediction, PredictionOutput + from .training_args import TrainingArguments + + +logger = logging.get_logger(__name__) + + +class Seq2SeqTrainer(Trainer): + def __init__( + self, + model: Union["PreTrainedModel", nn.Module] | None = None, + args: Optional["TrainingArguments"] = None, + data_collator: Optional["DataCollator"] = None, + train_dataset: Union[Dataset, "IterableDataset", "datasets.Dataset"] | None = None, + eval_dataset: Dataset | dict[str, Dataset] | None = None, + processing_class: Union[ + "PreTrainedTokenizerBase", "BaseImageProcessor", "FeatureExtractionMixin", "ProcessorMixin" + ] + | None = None, + model_init: Callable[[], "PreTrainedModel"] | None = None, + compute_loss_func: Callable | None = None, + compute_metrics: Callable[["EvalPrediction"], dict] | None = None, + callbacks: list["TrainerCallback"] | None = None, + optimizers: tuple[torch.optim.Optimizer | None, torch.optim.lr_scheduler.LambdaLR | None] = (None, None), + preprocess_logits_for_metrics: Callable[[torch.Tensor, torch.Tensor], torch.Tensor] | None = None, + ): + super().__init__( + model=model, + args=args, + data_collator=data_collator, + train_dataset=train_dataset, + eval_dataset=eval_dataset, + processing_class=processing_class, + model_init=model_init, + compute_loss_func=compute_loss_func, + compute_metrics=compute_metrics, + callbacks=callbacks, + optimizers=optimizers, + preprocess_logits_for_metrics=preprocess_logits_for_metrics, + ) + + # Override self.model.generation_config if a GenerationConfig is specified in args. + # Priority: args.generation_config > model.generation_config > default GenerationConfig. + if self.args.generation_config is not None: + gen_config = self.load_generation_config(self.args.generation_config) + self.model.generation_config = gen_config + + @staticmethod + def load_generation_config(gen_config_arg: str | GenerationConfig) -> GenerationConfig: + """ + Loads a `~generation.GenerationConfig` from the `Seq2SeqTrainingArguments.generation_config` arguments. + + Args: + gen_config_arg (`str` or [`~generation.GenerationConfig]`): + `Seq2SeqTrainingArguments.generation_config` argument. + + Returns: + A `~generation.GenerationConfig`. + """ + + # GenerationConfig provided, nothing to do + if isinstance(gen_config_arg, GenerationConfig): + gen_config = deepcopy(gen_config_arg) + else: + # str or Path + pretrained_model_name = Path(gen_config_arg) if isinstance(gen_config_arg, str) else gen_config_arg + config_file_name = None + + # Figuring if it is path pointing to a file, pointing to a directory or else a model id or URL + # This step is required in order to determine config_file_name + if pretrained_model_name.is_file(): + config_file_name = pretrained_model_name.name + pretrained_model_name = pretrained_model_name.parent + # dir path + elif pretrained_model_name.is_dir(): + pass + # model id or URL + else: + pretrained_model_name = gen_config_arg + + gen_config = GenerationConfig.from_pretrained(pretrained_model_name, config_file_name) + + # Strict validation to fail early. `GenerationConfig.save_pretrained()`, run at the end of training, throws + # an exception if there are warnings at validation time. + try: + gen_config.validate(strict=True) + except ValueError as exc: + raise ValueError(str(exc) + "\n\nFix these issues to train your model.") + + return gen_config + + def evaluate( + self, + eval_dataset: Dataset | None = None, + ignore_keys: list[str] | None = None, + metric_key_prefix: str = "eval", + **gen_kwargs, + ) -> dict[str, float]: + """ + Run evaluation and returns metrics. + + The calling script will be responsible for providing a method to compute metrics, as they are task-dependent + (pass it to the init `compute_metrics` argument). + + You can also subclass and override this method to inject custom behavior. + + Args: + eval_dataset (`Dataset`, *optional*): + Pass a dataset if you wish to override `self.eval_dataset`. If it is an [`~datasets.Dataset`], columns + not accepted by the `model.forward()` method are automatically removed. It must implement the `__len__` + method. + ignore_keys (`list[str]`, *optional*): + A list of keys in the output of your model (if it is a dictionary) that should be ignored when + gathering predictions. + metric_key_prefix (`str`, *optional*, defaults to `"eval"`): + An optional prefix to be used as the metrics key prefix. For example the metrics "bleu" will be named + "eval_bleu" if the prefix is `"eval"` (default) + max_length (`int`, *optional*): + The maximum target length to use when predicting with the generate method. + num_beams (`int`, *optional*): + Number of beams for beam search that will be used when predicting with the generate method. 1 means no + beam search. + gen_kwargs: + Additional `generate` specific kwargs. + + Returns: + A dictionary containing the evaluation loss and the potential metrics computed from the predictions. The + dictionary also contains the epoch number which comes from the training state. + """ + + gen_kwargs = gen_kwargs.copy() + + # Use legacy argument setting if a) the option is not explicitly passed; and b) the argument is set in the + # training args + if ( + gen_kwargs.get("max_length") is None + and gen_kwargs.get("max_new_tokens") is None + and self.args.generation_max_length is not None + ): + gen_kwargs["max_length"] = self.args.generation_max_length + if gen_kwargs.get("num_beams") is None and self.args.generation_num_beams is not None: + gen_kwargs["num_beams"] = self.args.generation_num_beams + # We don't want to drop samples in general + self.gather_function = self.accelerator.gather + self._gen_kwargs = gen_kwargs + return super().evaluate(eval_dataset, ignore_keys=ignore_keys, metric_key_prefix=metric_key_prefix) + + def predict( + self, + test_dataset: Dataset, + ignore_keys: list[str] | None = None, + metric_key_prefix: str = "test", + **gen_kwargs, + ) -> "PredictionOutput": + """ + Run prediction and returns predictions and potential metrics. + + Depending on the dataset and your use case, your test dataset may contain labels. In that case, this method + will also return metrics, like in `evaluate()`. + + Args: + test_dataset (`Dataset`): + Dataset to run the predictions on. If it is a [`~datasets.Dataset`], columns not accepted by the + `model.forward()` method are automatically removed. Has to implement the method `__len__` + ignore_keys (`list[str]`, *optional*): + A list of keys in the output of your model (if it is a dictionary) that should be ignored when + gathering predictions. + metric_key_prefix (`str`, *optional*, defaults to `"eval"`): + An optional prefix to be used as the metrics key prefix. For example the metrics "bleu" will be named + "eval_bleu" if the prefix is `"eval"` (default) + max_length (`int`, *optional*): + The maximum target length to use when predicting with the generate method. + num_beams (`int`, *optional*): + Number of beams for beam search that will be used when predicting with the generate method. 1 means no + beam search. + gen_kwargs: + Additional `generate` specific kwargs. + + + + If your predictions or labels have different sequence lengths (for instance because you're doing dynamic + padding in a token classification task) the predictions will be padded (on the right) to allow for + concatenation into one array. The padding index is -100. + + + + Returns: *NamedTuple* A namedtuple with the following keys: + + - predictions (`np.ndarray`): The predictions on `test_dataset`. + - label_ids (`np.ndarray`, *optional*): The labels (if the dataset contained some). + - metrics (`dict[str, float]`, *optional*): The potential dictionary of metrics (if the dataset contained + labels). + """ + + gen_kwargs = gen_kwargs.copy() + + # Use legacy argument setting if a) the option is not explicitly passed; and b) the argument is set in the + # training args + if ( + gen_kwargs.get("max_length") is None + and gen_kwargs.get("max_new_tokens") is None + and self.args.generation_max_length is not None + ): + gen_kwargs["max_length"] = self.args.generation_max_length + if gen_kwargs.get("num_beams") is None and self.args.generation_num_beams is not None: + gen_kwargs["num_beams"] = self.args.generation_num_beams + self.gather_function = self.accelerator.gather + self._gen_kwargs = gen_kwargs + + return super().predict(test_dataset, ignore_keys=ignore_keys, metric_key_prefix=metric_key_prefix) + + def prediction_step( + self, + model: nn.Module, + inputs: dict[str, torch.Tensor | Any], + prediction_loss_only: bool, + ignore_keys: list[str] | None = None, + **gen_kwargs, + ) -> tuple[float | None, torch.Tensor | None, torch.Tensor | None]: + """ + Perform an evaluation step on `model` using `inputs`. + + Subclass and override to inject custom behavior. + + Args: + model (`nn.Module`): + The model to evaluate. + inputs (`dict[str, Union[torch.Tensor, Any]]`): + The inputs and targets of the model. + + The dictionary will be unpacked before being fed to the model. Most models expect the targets under the + argument `labels`. Check your model's documentation for all accepted arguments. + prediction_loss_only (`bool`): + Whether or not to return the loss only. + gen_kwargs: + Additional `generate` specific kwargs. + + Return: + tuple[Optional[float], Optional[torch.Tensor], Optional[torch.Tensor]]: A tuple with the loss, logits and + labels (each being optional). + """ + + if not self.args.predict_with_generate or prediction_loss_only: + return super().prediction_step( + model, inputs, prediction_loss_only=prediction_loss_only, ignore_keys=ignore_keys + ) + + has_labels = "labels" in inputs + inputs = self._prepare_inputs(inputs) + + # Priority (handled in generate): + # non-`None` gen_kwargs > model.generation_config > default GenerationConfig() + if len(gen_kwargs) == 0 and hasattr(self, "_gen_kwargs"): + gen_kwargs = self._gen_kwargs.copy() + if "num_beams" in gen_kwargs and gen_kwargs["num_beams"] is None: + gen_kwargs.pop("num_beams") + if "max_length" in gen_kwargs and gen_kwargs["max_length"] is None: + gen_kwargs.pop("max_length") + + default_synced_gpus = is_deepspeed_zero3_enabled() or is_fsdp_managed_module(self.model) + gen_kwargs["synced_gpus"] = gen_kwargs.get("synced_gpus", default_synced_gpus) + + generation_inputs = inputs.copy() + # If the `decoder_input_ids` was created from `labels`, evict the former, so that the model can freely generate + # (otherwise, it would continue generating from the padded `decoder_input_ids`) + if ( + "labels" in generation_inputs + and "decoder_input_ids" in generation_inputs + and generation_inputs["labels"].shape == generation_inputs["decoder_input_ids"].shape + ): + generation_inputs = { + k: v for k, v in inputs.items() if k not in ("decoder_input_ids", "decoder_attention_mask") + } + + summon_full_params_context = ( + FullyShardedDataParallel.summon_full_params(self.model) + if isinstance(self.model, FullyShardedDataParallel) + else contextlib.nullcontext() + ) + + with summon_full_params_context: + generated_tokens = self.model.generate(**generation_inputs, **gen_kwargs) + + # Temporary hack to ensure the generation config is not initialized for each iteration of the evaluation loop + # TODO: remove this hack when the legacy code that initializes generation_config from a model config is + # removed in https://github.com/huggingface/transformers/blob/98d88b23f54e5a23e741833f1e973fdf600cc2c5/src/transformers/generation/utils.py#L1183 + if self.model.generation_config._from_model_config: + self.model.generation_config._from_model_config = False + + # Retrieves GenerationConfig from model.generation_config + # Update with defaults because earlier the generation config used to be init + # with default values. Now we init it with `None` and keep defaults for BC + gen_config = self.model.generation_config + default_gen_config = gen_config._get_default_generation_params() + gen_config.update(**default_gen_config, defaults_only=True) + # in case the batch is shorter than max length, the output should be padded + if generated_tokens.shape[-1] < gen_config.max_length: + generated_tokens = self._pad_tensors_to_max_len(generated_tokens, gen_config.max_length) + elif gen_config.max_new_tokens is not None and generated_tokens.shape[-1] < gen_config.max_new_tokens + 1: + generated_tokens = self._pad_tensors_to_max_len(generated_tokens, gen_config.max_new_tokens + 1) + + with torch.no_grad(): + if has_labels: + with self.compute_loss_context_manager(): + outputs = model(**inputs) + if self.label_smoother is not None: + loss = self.label_smoother(outputs, inputs["labels"]).detach().mean() + else: + loss = (outputs["loss"] if isinstance(outputs, dict) else outputs[0]).detach().mean() + else: + loss = None + + if self.args.prediction_loss_only: + return loss, None, None + + if has_labels: + labels = inputs["labels"] + if labels.shape[-1] < gen_config.max_length: + labels = self._pad_tensors_to_max_len(labels, gen_config.max_length) + elif gen_config.max_new_tokens is not None and labels.shape[-1] < gen_config.max_new_tokens + 1: + labels = self._pad_tensors_to_max_len(labels, gen_config.max_new_tokens + 1) + else: + labels = None + + return loss, generated_tokens, labels + + def _pad_tensors_to_max_len(self, tensor, max_length): + if self.processing_class is not None and hasattr(self.processing_class, "pad_token_id"): + # If PAD token is not defined at least EOS token has to be defined + pad_token_id = ( + self.processing_class.pad_token_id + if self.processing_class.pad_token_id is not None + else self.processing_class.eos_token_id + ) + else: + if getattr(self.model.config, "pad_token_id", None) is not None: + pad_token_id = self.model.config.pad_token_id + else: + raise ValueError("Pad_token_id must be set in the configuration of the model, in order to pad tensors") + + padded_tensor = pad_token_id * torch.ones( + (tensor.shape[0], max_length), dtype=tensor.dtype, device=tensor.device + ) + padded_tensor[:, : tensor.shape[-1]] = tensor + return padded_tensor diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..46582e4069c8a36c8ca03d17837b04c3b0c0ae11 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/trainer_utils.py @@ -0,0 +1,1238 @@ +# Copyright 2020-present the HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +PyTorch-independent utilities for the Trainer class. +""" + +import copy +import functools +import gc +import inspect +import json +import os +import random +import re +import shutil +import threading +import time +from collections.abc import Callable +from functools import partial +from pathlib import Path +from typing import Any, NamedTuple + +import numpy as np + +from .utils import ( + SAFE_WEIGHTS_INDEX_NAME, + WEIGHTS_INDEX_NAME, + ExplicitEnum, + check_torch_load_is_safe, + is_peft_available, + is_psutil_available, + is_torch_available, + is_torch_cuda_available, + is_torch_hpu_available, + is_torch_mlu_available, + is_torch_mps_available, + is_torch_musa_available, + is_torch_npu_available, + is_torch_xla_available, + is_torch_xpu_available, + logging, + requires_backends, +) + + +logger = logging.get_logger(__name__) + + +if is_torch_available(): + import torch + from safetensors.torch import load_file as safe_load_file + +if is_peft_available(): + from peft import PeftMixedModel, PeftModel + + +def _is_peft_model(model): + if is_peft_available(): + return isinstance(model, (PeftModel, PeftMixedModel)) + return False + + +def unwrap_peft_model(model): + """ + Extract the base model from a PEFT-wrapped model. + + If the model is not a PEFT model, returns it unchanged. Otherwise, attempts to + unwrap the base model using ``get_base_model()`` or the ``base_model.model`` attribute. + + Args: + model: The model to unwrap. + + Returns: + The unwrapped base model. + + Raises: + AttributeError: If the model is a PEFT model but cannot be unwrapped safely. + """ + if not _is_peft_model(model): + return model + if hasattr(model, "get_base_model"): + return model.get_base_model() + elif hasattr(model, "base_model") and hasattr(model.base_model, "model"): + # PeftMixedModel do not provide a `get_base_model` method + return model.base_model.model + else: + raise AttributeError("Cannot extract base model safely from this PEFT wrapper.") + + +def validate_quantization_for_training(model): + """ + Validate that a quantized model is set up correctly for training. + + Raises `ValueError` when: + - A quantized + compiled model is used (torch.compile is not supported with PEFT fine-tuning). + - A purely quantized model has no trainable adapters attached (unless it supports QAT). + - The quantization method does not support training. + + Args: + model: The model to validate. + """ + _is_quantized_and_base_model = getattr(model, "is_quantized", False) and not getattr( + model, "_hf_peft_config_loaded", False + ) + _quantization_method_supports_training = ( + getattr(model, "hf_quantizer", None) is not None and model.hf_quantizer.is_trainable + ) + _is_model_quantized_and_qat_trainable = getattr(model, "hf_quantizer", None) is not None and getattr( + model.hf_quantizer, "is_qat_trainable", False + ) + + # Filter out quantized + compiled models + if _is_quantized_and_base_model and hasattr(model, "_orig_mod"): + raise ValueError( + "You cannot fine-tune quantized model with `torch.compile()` make sure to pass a non-compiled model when fine-tuning a quantized model with PEFT" + ) + + # At this stage the model is already loaded + if _is_quantized_and_base_model and not _is_peft_model(model) and not _is_model_quantized_and_qat_trainable: + raise ValueError( + "You cannot perform fine-tuning on purely quantized models. Please attach trainable adapters on top of" + " the quantized model to correctly perform fine-tuning. Please see: https://huggingface.co/docs/transformers/peft" + " for more details" + ) + elif _is_quantized_and_base_model and not _quantization_method_supports_training: + raise ValueError( + f"The model you are trying to fine-tune is quantized with {model.hf_quantizer.quantization_config.quant_method}" + " but that quantization method do not support training. Please open an issue on GitHub: https://github.com/huggingface/transformers" + f" to request the support for training support for {model.hf_quantizer.quantization_config.quant_method}" + ) + + +def seed_worker(worker_id: int, num_workers: int, rank: int): + """ + Helper function to set worker seed during Dataloader initialization. + """ + init_seed = torch.initial_seed() % 2**32 + worker_seed = num_workers * rank + init_seed + set_seed(worker_seed) + + +def enable_full_determinism(seed: int, warn_only: bool = False): + """ + Helper function for reproducible behavior during distributed training. See + https://pytorch.org/docs/stable/notes/randomness.html for pytorch + """ + # set seed first + set_seed(seed) + + if is_torch_available(): + # Enable PyTorch deterministic mode. This potentially requires either the environment + # variable 'CUDA_LAUNCH_BLOCKING' or 'CUBLAS_WORKSPACE_CONFIG' to be set, + # depending on the CUDA version, so we set them both here + os.environ["CUDA_LAUNCH_BLOCKING"] = "1" + os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":16:8" + # The environment variable required to enable deterministic mode on Ascend NPUs. + os.environ["ASCEND_LAUNCH_BLOCKING"] = "1" + os.environ["HCCL_DETERMINISTIC"] = "1" + + os.environ["FLASH_ATTENTION_DETERMINISTIC"] = "1" + torch.use_deterministic_algorithms(True, warn_only=warn_only) + + # Enable CUDNN deterministic mode + torch.backends.cudnn.deterministic = True + torch.backends.cudnn.benchmark = False + + +def set_seed(seed: int, deterministic: bool = False): + """ + Helper function for reproducible behavior to set the seed in `random`, `numpy`, `torch` (if installed). + + Args: + seed (`int`): + The seed to set. + deterministic (`bool`, *optional*, defaults to `False`): + Whether to use deterministic algorithms where available. Can slow down training. + """ + random.seed(seed) + np.random.seed(seed) + if is_torch_available(): + torch.manual_seed(seed) + torch.cuda.manual_seed_all(seed) + # ^^ safe to call this function even if cuda is not available + if deterministic: + torch.use_deterministic_algorithms(True) + if is_torch_mlu_available(): + torch.mlu.manual_seed_all(seed) + if is_torch_musa_available(): + torch.musa.manual_seed_all(seed) + if is_torch_npu_available(): + torch.npu.manual_seed_all(seed) + if is_torch_hpu_available(): + torch.hpu.manual_seed_all(seed) + if is_torch_xpu_available(): + torch.xpu.manual_seed_all(seed) + + +class EvalPrediction: + """ + Evaluation output (always contains labels), to be used to compute metrics. + + Parameters: + predictions (`np.ndarray`): Predictions of the model. + label_ids (`np.ndarray`): Targets to be matched. + inputs (`np.ndarray`, *optional*): Input data passed to the model. + losses (`np.ndarray`, *optional*): Loss values computed during evaluation. + """ + + def __init__( + self, + predictions: np.ndarray | tuple[np.ndarray], + label_ids: np.ndarray | tuple[np.ndarray], + inputs: np.ndarray | tuple[np.ndarray] | None = None, + losses: np.ndarray | tuple[np.ndarray] | None = None, + ): + self.predictions = predictions + self.label_ids = label_ids + self.inputs = inputs + self.losses = losses + self.elements = (self.predictions, self.label_ids) + if self.inputs is not None: + self.elements += (self.inputs,) + if self.losses is not None: + self.elements += (self.losses,) + + def __iter__(self): + return iter(self.elements) + + def __getitem__(self, idx): + if idx < 0 or idx >= len(self.elements): + raise IndexError("tuple index out of range") + return self.elements[idx] + + +class EvalLoopOutput(NamedTuple): + predictions: np.ndarray | tuple[np.ndarray] + label_ids: np.ndarray | tuple[np.ndarray] | None + metrics: dict[str, float] | None + num_samples: int | None + + +class PredictionOutput(NamedTuple): + predictions: np.ndarray | tuple[np.ndarray] + label_ids: np.ndarray | tuple[np.ndarray] | None + metrics: dict[str, float] | None + + +class TrainOutput(NamedTuple): + global_step: int + training_loss: float + metrics: dict[str, float] + + +PREFIX_CHECKPOINT_DIR = "checkpoint" +_re_checkpoint = re.compile(r"^" + PREFIX_CHECKPOINT_DIR + r"\-(\d+)$") + + +def get_last_checkpoint(folder): + content = os.listdir(folder) + checkpoints = [ + path + for path in content + if _re_checkpoint.search(path) is not None and os.path.isdir(os.path.join(folder, path)) + ] + if len(checkpoints) == 0: + return + return os.path.join(folder, max(checkpoints, key=lambda x: int(_re_checkpoint.search(x).groups()[0]))) + + +def sort_checkpoints( + output_dir: str, + checkpoint_prefix: str = PREFIX_CHECKPOINT_DIR, + use_mtime: bool = False, + best_model_checkpoint: str | None = None, +) -> list[str]: + """ + Return checkpoint directories sorted by step number (oldest first). + + Args: + output_dir (`str`): + The directory containing the checkpoints. + checkpoint_prefix (`str`, *optional*, defaults to `"checkpoint"`): + The prefix used for checkpoint directory names. + use_mtime (`bool`, *optional*, defaults to `False`): + Whether to sort by modification time instead of step number. + best_model_checkpoint (`str`, *optional*): + If provided, this checkpoint is moved to second-to-last position to protect + it from deletion while keeping the most recent checkpoint last for resuming. + + Returns: + `list[str]`: Sorted list of checkpoint directory paths (oldest first). + """ + glob_checkpoints = [str(x) for x in Path(output_dir).glob(f"{checkpoint_prefix}-*") if os.path.isdir(x)] + + ordering_and_checkpoint_path = [] + for path in glob_checkpoints: + if use_mtime: + ordering_and_checkpoint_path.append((os.path.getmtime(path), path)) + else: + regex_match = re.match(f".*{checkpoint_prefix}-([0-9]+)", path) + if regex_match is not None and regex_match.groups() is not None: + ordering_and_checkpoint_path.append((int(regex_match.groups()[0]), path)) + + checkpoints_sorted = sorted(ordering_and_checkpoint_path) + + # mtime is not reliable on some filesystems (e.g., cloud fuse filesystems) + # so we check if the mtime is fake and fall back to numerical ordering + if use_mtime and len(checkpoints_sorted) > 1: + mtime_diff = checkpoints_sorted[-1][0] - checkpoints_sorted[0][0] + if mtime_diff < 1.0: + logger.warning("mtime may not be reliable on this filesystem, falling back to numerical ordering") + return sort_checkpoints( + output_dir, checkpoint_prefix, use_mtime=False, best_model_checkpoint=best_model_checkpoint + ) + + checkpoints_sorted = [path for _, path in checkpoints_sorted] + + # Move best_model_checkpoint to second-to-last position to protect it from deletion + # while keeping the most recent checkpoint at the end for resuming training. + if best_model_checkpoint is not None: + best_model_checkpoint = str(Path(best_model_checkpoint)) + if best_model_checkpoint in checkpoints_sorted and checkpoints_sorted[-1] != best_model_checkpoint: + most_recent = checkpoints_sorted[-1] + checkpoints_sorted = [c for c in checkpoints_sorted if c not in {best_model_checkpoint, most_recent}] + checkpoints_sorted += [best_model_checkpoint, most_recent] + + return checkpoints_sorted + + +def rotate_checkpoints( + output_dir: str, + save_total_limit: int | None = None, + best_model_checkpoint: str | None = None, + use_mtime: bool = False, + checkpoint_prefix: str = PREFIX_CHECKPOINT_DIR, +) -> None: + """ + Delete older checkpoints, keeping at most `save_total_limit`. + + Always preserves the most recent checkpoint and the best model checkpoint (if provided). + + Args: + output_dir (`str`): + The directory containing the checkpoints. + save_total_limit (`int`, *optional*): + Maximum number of checkpoints to keep. No deletion if `None` or <= 0. + best_model_checkpoint (`str`, *optional*): + Path to best checkpoint (will always be preserved). + use_mtime (`bool`, *optional*, defaults to `False`): + Whether to sort by modification time instead of step number. + checkpoint_prefix (`str`, *optional*, defaults to `"checkpoint"`): + The prefix used for checkpoint directory names. + """ + if save_total_limit is None or save_total_limit <= 0: + return + + checkpoints = sort_checkpoints(output_dir, checkpoint_prefix, use_mtime) + if len(checkpoints) <= save_total_limit: + return + + # Checkpoints that must not be deleted + protected = {checkpoints[-1]} # most recent, for resuming + if best_model_checkpoint is not None: + protected.add(str(Path(best_model_checkpoint))) + + # Delete oldest non-protected checkpoints until we have save_total_limit left + num_to_keep = max(save_total_limit, len(protected)) + remaining = len(checkpoints) + for checkpoint in checkpoints: + if remaining <= num_to_keep: + break + if checkpoint not in protected: + shutil.rmtree(checkpoint, ignore_errors=True) + remaining -= 1 + + +class IntervalStrategy(ExplicitEnum): + NO = "no" + STEPS = "steps" + EPOCH = "epoch" + + +class SaveStrategy(ExplicitEnum): + NO = "no" + STEPS = "steps" + EPOCH = "epoch" + BEST = "best" + + +class HubStrategy(ExplicitEnum): + END = "end" + EVERY_SAVE = "every_save" + CHECKPOINT = "checkpoint" + ALL_CHECKPOINTS = "all_checkpoints" + + +class BestRun(NamedTuple): + """ + The best run found by a hyperparameter search (see [`~Trainer.hyperparameter_search`]). + + Parameters: + run_id (`str`): + The id of the best run (if models were saved, the corresponding checkpoint will be in the folder ending + with run-{run_id}). + objective (`float`): + The objective that was obtained for this run. + hyperparameters (`dict[str, Any]`): + The hyperparameters picked to get this run. + run_summary (`Optional[Any]`): + A summary of tuning experiments. `ray.tune.ExperimentAnalysis` object for Ray backend. + """ + + run_id: str + objective: float | list[float] + hyperparameters: dict[str, Any] + run_summary: Any | None = None + + +def default_compute_objective(metrics: dict[str, float]) -> float: + """ + The default objective to maximize/minimize when doing an hyperparameter search. It is the evaluation loss if no + metrics are provided to the [`Trainer`], the sum of all metrics otherwise. + + Args: + metrics (`dict[str, float]`): The metrics returned by the evaluate method. + + Return: + `float`: The objective to minimize or maximize + """ + metrics = copy.deepcopy(metrics) + loss = metrics.pop("eval_loss", None) + _ = metrics.pop("epoch", None) + # Remove speed metrics + speed_metrics = [m for m in metrics if m.endswith("_runtime") or m.endswith("_per_second")] + for sm in speed_metrics: + _ = metrics.pop(sm, None) + return loss if len(metrics) == 0 else sum(metrics.values()) + + +def default_hp_space_optuna(trial) -> dict[str, float]: + from .integrations import is_optuna_available + + assert is_optuna_available(), "This function needs Optuna installed: `pip install optuna`" + return { + "learning_rate": trial.suggest_float("learning_rate", 1e-6, 1e-4, log=True), + "num_train_epochs": trial.suggest_int("num_train_epochs", 1, 5), + "seed": trial.suggest_int("seed", 1, 40), + "per_device_train_batch_size": trial.suggest_categorical("per_device_train_batch_size", [4, 8, 16, 32, 64]), + } + + +def default_hp_space_ray(trial) -> dict[str, Any]: + from .integrations import is_ray_tune_available + + assert is_ray_tune_available(), "This function needs ray installed: `pip install ray[tune]`" + from ray import tune + + return { + "learning_rate": tune.loguniform(1e-6, 1e-4), + "num_train_epochs": tune.choice(list(range(1, 6))), + "seed": tune.uniform(1, 40), + "per_device_train_batch_size": tune.choice([4, 8, 16, 32, 64]), + } + + +def default_hp_space_wandb(trial) -> dict[str, Any]: + from .integrations import is_wandb_available + + if not is_wandb_available(): + raise ImportError("This function needs wandb installed: `pip install wandb`") + + return { + "method": "random", + "metric": {"name": "objective", "goal": "minimize"}, + "parameters": { + "learning_rate": {"distribution": "uniform", "min": 1e-6, "max": 1e-4}, + "num_train_epochs": {"distribution": "int_uniform", "min": 1, "max": 6}, + "seed": {"distribution": "int_uniform", "min": 1, "max": 40}, + "per_device_train_batch_size": {"values": [4, 8, 16, 32, 64]}, + }, + } + + +class HPSearchBackend(ExplicitEnum): + OPTUNA = "optuna" + RAY = "ray" + WANDB = "wandb" + + +def is_main_process(local_rank): + """ + Whether or not the current process is the local process, based on `xr.global_ordinal()` (for TPUs) first, then on + `local_rank`. + """ + if is_torch_xla_available(): + import torch_xla.runtime as xr + + return xr.global_ordinal() == 0 + return local_rank in [-1, 0] + + +def total_processes_number(local_rank): + """ + Return the number of processes launched in parallel. Works with `torch.distributed` and TPUs. + """ + if is_torch_xla_available(): + import torch_xla.runtime as xr + + return xr.world_size() + elif local_rank != -1 and is_torch_available(): + import torch + + return torch.distributed.get_world_size() + return 1 + + +def speed_metrics(split, start_time, num_samples=None, num_steps=None, num_tokens=None): + """ + Measure and return speed performance metrics. + + This function requires a time snapshot `start_time` before the operation to be measured starts and this function + should be run immediately after the operation to be measured has completed. + + Args: + - split: name to prefix metric (like train, eval, test...) + - start_time: operation start time + - num_samples: number of samples processed + - num_steps: number of steps processed + - num_tokens: number of tokens processed + """ + runtime = time.time() - start_time + result = {f"{split}_runtime": round(runtime, 4)} + if runtime == 0: + return result + if num_samples is not None: + samples_per_second = num_samples / runtime + result[f"{split}_samples_per_second"] = round(samples_per_second, 3) + if num_steps is not None: + steps_per_second = num_steps / runtime + result[f"{split}_steps_per_second"] = round(steps_per_second, 3) + if num_tokens is not None: + tokens_per_second = num_tokens / runtime + result[f"{split}_tokens_per_second"] = round(tokens_per_second, 3) + return result + + +class SchedulerType(ExplicitEnum): + """ + Scheduler names for the parameter `lr_scheduler_type` in [`TrainingArguments`]. + By default, it uses "linear". Internally, this retrieves `get_linear_schedule_with_warmup` scheduler from [`Trainer`]. + Scheduler types: + - "linear" = [`get_linear_schedule_with_warmup`] + - "cosine" = [`get_cosine_schedule_with_warmup`] + - "cosine_with_restarts" = [`get_cosine_with_hard_restarts_schedule_with_warmup`] + - "polynomial" = [`get_polynomial_decay_schedule_with_warmup`] + - "constant" = [`get_constant_schedule`] + - "constant_with_warmup" = [`get_constant_schedule_with_warmup`] + - "inverse_sqrt" = [`get_inverse_sqrt_schedule`] + - "reduce_lr_on_plateau" = [`get_reduce_on_plateau_schedule`] + - "cosine_with_min_lr" = [`get_cosine_with_min_lr_schedule_with_warmup`] + - "cosine_warmup_with_min_lr" = [`get_cosine_with_min_lr_schedule_with_warmup_lr_rate`] + - "warmup_stable_decay" = [`get_wsd_schedule`] + """ + + LINEAR = "linear" + COSINE = "cosine" + COSINE_WITH_RESTARTS = "cosine_with_restarts" + POLYNOMIAL = "polynomial" + CONSTANT = "constant" + CONSTANT_WITH_WARMUP = "constant_with_warmup" + INVERSE_SQRT = "inverse_sqrt" + REDUCE_ON_PLATEAU = "reduce_lr_on_plateau" + COSINE_WITH_MIN_LR = "cosine_with_min_lr" + COSINE_WARMUP_WITH_MIN_LR = "cosine_warmup_with_min_lr" + WARMUP_STABLE_DECAY = "warmup_stable_decay" + + +class TrainerMemoryTracker: + """ + A helper class that tracks cpu and gpu memory. + + This class will silently skip unless `psutil` is available. Install with `pip install psutil`. + + When a stage completes, it can pass metrics dict to update with the memory metrics gathered during this stage. + + Example : + + ```python + self._memory_tracker = TrainerMemoryTracker(self.args.skip_memory_metrics) + self._memory_tracker.start() + # code ... + metrics = {"train_runtime": 10.5} + self._memory_tracker.stop_and_update_metrics(metrics) + ``` + + To understand this class' intricacies please read the documentation of [`~Trainer.log_metrics`]. + """ + + # map trainer methods to metrics prefix + stages = { + "__init__": "init", + "train": "train", + "_inner_training_loop": "train", + "evaluate": "eval", + "predict": "test", + } + + def __init__(self, skip_memory_metrics=False): + self.skip_memory_metrics = skip_memory_metrics + + if not is_psutil_available(): + # soft dependency on psutil + self.skip_memory_metrics = True + + if self.skip_memory_metrics: + return + + import psutil + + if is_torch_cuda_available() or is_torch_mlu_available() or is_torch_musa_available(): + import torch + + self.torch = torch + self.gpu = {} + elif is_torch_mps_available(): + import torch + + self.torch = torch + self.gpu = {} + elif is_torch_xpu_available(): + import torch + + self.torch = torch + self.gpu = {} + elif is_torch_npu_available(): + import torch + + self.torch = torch + self.gpu = {} + elif is_torch_hpu_available(): + import torch + + self.torch = torch + self.gpu = {} + else: + self.torch = None + + self.process = psutil.Process() + + self.cur_stage = None + self.cpu = {} + self.init_reported = False + + def derive_stage(self): + """derives the stage/caller name automatically""" + caller = inspect.currentframe().f_back.f_back.f_code.co_name + if caller in self.stages: + return self.stages[caller] + else: + raise ValueError( + f"was called from {caller}, but only expect to be called from one of {self.stages.keys()}" + ) + + def cpu_mem_used(self): + """get resident set size memory for the current process""" + return self.process.memory_info().rss + + def peak_monitor_func(self): + self.cpu_mem_used_peak = -1 + + while True: + self.cpu_mem_used_peak = max(self.cpu_mem_used(), self.cpu_mem_used_peak) + + # can't sleep or will not catch the peak right (this comment is here on purpose) + # time.sleep(0.001) # 1msec + + if not self.peak_monitoring: + break + + def start(self): + """start tracking for the caller's stage""" + if self.skip_memory_metrics: + return + + stage = self.derive_stage() + # deal with nested calls of eval during train - simply ignore those + if self.cur_stage is not None and self.cur_stage != stage: + return + + self.cur_stage = stage + + gc.collect() + + if self.torch is not None: + if torch.cuda.is_available(): + self.torch.cuda.reset_peak_memory_stats() + self.torch.cuda.empty_cache() + elif is_torch_mlu_available(): + self.torch.mlu.reset_peak_memory_stats() + self.torch.mlu.empty_cache() + elif is_torch_musa_available(): + self.torch.musa.reset_peak_memory_stats() + self.torch.musa.empty_cache() + elif is_torch_xpu_available(): + self.torch.xpu.reset_peak_memory_stats() + self.torch.xpu.empty_cache() + elif is_torch_npu_available(): + self.torch.npu.reset_peak_memory_stats() + self.torch.npu.empty_cache() + elif is_torch_hpu_available(): + self.torch.hpu.reset_peak_memory_stats() + # not available on hpu as it reserves all device memory for the current process + # self.torch.hpu.empty_cache() + elif is_torch_mps_available(): + self.torch.mps.empty_cache() + + # gpu + if self.torch is not None: + if torch.cuda.is_available(): + self.gpu_mem_used_at_start = self.torch.cuda.memory_allocated() + elif is_torch_mlu_available(): + self.gpu_mem_used_at_start = self.torch.mlu.memory_allocated() + elif is_torch_musa_available(): + self.gpu_mem_used_at_start = self.torch.musa.memory_allocated() + elif is_torch_xpu_available(): + self.gpu_mem_used_at_start = self.torch.xpu.memory_allocated() + elif is_torch_npu_available(): + self.gpu_mem_used_at_start = self.torch.npu.memory_allocated() + elif is_torch_hpu_available(): + self.gpu_mem_used_at_start = self.torch.hpu.memory_allocated() + elif is_torch_mps_available(): + self.gpu_mem_used_at_start = self.torch.mps.current_allocated_memory() + + # cpu + self.cpu_mem_used_at_start = self.cpu_mem_used() + + self.peak_monitoring = True + peak_monitor_thread = threading.Thread(target=self.peak_monitor_func) + peak_monitor_thread.daemon = True + peak_monitor_thread.start() + + def stop(self, stage): + """stop tracking for the passed stage""" + + # deal with nested calls of eval during train - simply ignore those + if self.cur_stage is not None and self.cur_stage != stage: + return + + # this sends a signal to peak_monitor_func to complete its loop + self.peak_monitoring = False + + # first ensure all objects get collected and their memory is freed + gc.collect() + + if self.torch is not None: + if torch.cuda.is_available(): + self.torch.cuda.empty_cache() + elif is_torch_mlu_available(): + self.torch.mlu.empty_cache() + elif is_torch_musa_available(): + self.torch.musa.empty_cache() + elif is_torch_xpu_available(): + self.torch.xpu.empty_cache() + elif is_torch_npu_available(): + self.torch.npu.empty_cache() + elif is_torch_hpu_available(): + # not available on hpu as it reserves all device memory for the current process + # self.torch.npu.empty_cache() + pass + elif is_torch_mps_available(): + self.torch.mps.empty_cache() + + # concepts: + # - alloc_delta: the difference of allocated memory between the end and the start + # - peaked_delta: the difference between the peak memory and the current memory + # in order to know how much memory the measured code consumed one needs to sum these two + + # gpu + if self.torch is not None: + if torch.cuda.is_available(): + self.gpu_mem_used_now = self.torch.cuda.memory_allocated() + self.gpu_mem_used_peak = self.torch.cuda.max_memory_allocated() + elif is_torch_mlu_available(): + self.gpu_mem_used_now = self.torch.mlu.memory_allocated() + self.gpu_mem_used_peak = self.torch.mlu.max_memory_allocated() + elif is_torch_musa_available(): + self.gpu_mem_used_now = self.torch.musa.memory_allocated() + self.gpu_mem_used_peak = self.torch.musa.max_memory_allocated() + elif is_torch_xpu_available(): + self.gpu_mem_used_now = self.torch.xpu.memory_allocated() + self.gpu_mem_used_peak = self.torch.xpu.max_memory_allocated() + elif is_torch_npu_available(): + self.gpu_mem_used_now = self.torch.npu.memory_allocated() + self.gpu_mem_used_peak = self.torch.npu.max_memory_allocated() + elif is_torch_hpu_available(): + self.gpu_mem_used_now = self.torch.hpu.memory_allocated() + self.gpu_mem_used_peak = self.torch.hpu.max_memory_allocated() + elif is_torch_mps_available(): + self.gpu_mem_used_now = self.torch.mps.current_allocated_memory() + # self.torch.mps.max_memory_allocated() does not exist yet + self.gpu_mem_used_peak = None + + else: + raise ValueError("No available GPU device found!") + + self.gpu[self.cur_stage] = { + "begin": self.gpu_mem_used_at_start, + "end": self.gpu_mem_used_now, + "alloc": (self.gpu_mem_used_now - self.gpu_mem_used_at_start), + } + if self.gpu_mem_used_peak is not None: + self.gpu[self.cur_stage]["peaked"] = max(0, self.gpu_mem_used_peak - self.gpu_mem_used_now) + else: + self.gpu[self.cur_stage]["peaked"] = "Not available" + + # cpu + self.cpu_mem_used_now = self.cpu_mem_used() + self.cpu[self.cur_stage] = { + "begin": self.cpu_mem_used_at_start, + "end": self.cpu_mem_used_now, + "alloc": (self.cpu_mem_used_now - self.cpu_mem_used_at_start), + "peaked": max(0, self.cpu_mem_used_peak - self.cpu_mem_used_now), + } + + # reset - cycle finished + self.cur_stage = None + + def update_metrics(self, stage, metrics): + """updates the metrics""" + if self.skip_memory_metrics: + return + + # deal with nested calls of eval during train - simply ignore those + if self.cur_stage is not None and self.cur_stage != stage: + return + + # since we don't have a way to return init metrics, we push them into the first of train/val/predict + stages = [stage] + if not self.init_reported: + stages.insert(0, "init") + self.init_reported = True + + for stage in stages: + for t in ["alloc", "peaked"]: + if stage in self.cpu and t in self.cpu[stage]: + metrics[f"{stage}_mem_cpu_{t}_delta"] = self.cpu[stage][t] + if self.torch is not None and stage in self.gpu and t in self.gpu[stage]: + metrics[f"{stage}_mem_gpu_{t}_delta"] = self.gpu[stage][t] + # if we need additional debug info, enable the following + # for t in ["begin", "end"]: + # if stage in self.cpu and t in self.cpu[stage]: + # metrics[f"{stage}_mem_cpu_{t}"] = self.cpu[stage][t] + # if self.torch is not None and stage in self.gpu and t in self.gpu[stage]: + # metrics[f"{stage}_mem_gpu_{t}"] = self.gpu[stage][t] + + # since memory can be allocated before init, and it might be difficult to track overall + # memory usage, in particular for GPU, let's report memory usage at the point init was called + if stages[0] == "init": + metrics["before_init_mem_cpu"] = self.cpu["init"]["begin"] + if self.torch is not None: + metrics["before_init_mem_gpu"] = self.gpu["init"]["begin"] + # if we also wanted to report any additional memory allocations in between init and + # whatever the next stage was we could also report this: + # if self.cpu["init"]["end"] != self.cpu[stage]["begin"]: + # metrics[f"after_init_mem_cpu_delta"] = self.cpu[stage]["begin"] - self.cpu["init"]["end"] + # if self.torch is not None and self.gpu["init"]["end"] != self.gpu[stage]["begin"]: + # metrics[f"after_init_mem_gpu_delta"] = self.gpu[stage]["begin"] - self.gpu["init"]["end"] + + def stop_and_update_metrics(self, metrics=None): + """combine stop and metrics update in one call for simpler code""" + if self.skip_memory_metrics: + return + + stage = self.derive_stage() + self.stop(stage) + + # init doesn't have metrics to update so we just save that data for later stages to retrieve + if metrics is not None: + self.update_metrics(stage, metrics) + + +def has_length(dataset): + """ + Checks if the dataset implements __len__() and it doesn't raise an error + """ + try: + return len(dataset) is not None + except TypeError: + # TypeError: len() of unsized object + return False + except AttributeError: + # Ray DataSets raises an AttributeError: https://github.com/ray-project/ray/blob/master/python/ray/data/dataset.py#L5616 + return False + + +def denumpify_detensorize(metrics): + """ + Recursively calls `.item()` on the element of the dictionary passed + """ + if isinstance(metrics, (list, tuple)): + return type(metrics)(denumpify_detensorize(m) for m in metrics) + elif isinstance(metrics, dict): + return type(metrics)({k: denumpify_detensorize(v) for k, v in metrics.items()}) + elif isinstance(metrics, np.generic): + return metrics.item() + elif is_torch_available() and isinstance(metrics, torch.Tensor) and metrics.numel() == 1: + return metrics.item() + return metrics + + +def number_of_arguments(func): + """ + Return the number of arguments of the passed function, even if it's a partial function. + """ + if isinstance(func, functools.partial): + total_args = len(inspect.signature(func.func).parameters) + return total_args - len(func.args) - len(func.keywords) + return len(inspect.signature(func).parameters) + + +def find_executable_batch_size( + function: Callable | None = None, starting_batch_size: int = 128, auto_find_batch_size: bool = False +): + """ + Args: + A basic decorator that will try to execute `function`. If it fails from exceptions related to out-of-memory or + CUDNN, the batch size is multiplied by 0.9 and passed to `function`. `function` must take in a `batch_size` parameter as + its first argument. + function (`Callable`, *optional*) + A function to wrap + starting_batch_size (`int`, *optional*) + The batch size to try and fit into memory + auto_find_batch_size (`bool`, *optional*) + If False, will just execute `function` + """ + if function is None: + return functools.partial( + find_executable_batch_size, + starting_batch_size=starting_batch_size, + auto_find_batch_size=auto_find_batch_size, + ) + + if auto_find_batch_size: + requires_backends(find_executable_batch_size, "accelerate") + from accelerate.utils import find_executable_batch_size as accelerate_find_executable_batch_size + + return accelerate_find_executable_batch_size(function=function, starting_batch_size=starting_batch_size) + + return functools.partial(function, batch_size=starting_batch_size) + + +class FSDPOption(ExplicitEnum): + FULL_SHARD = "full_shard" + SHARD_GRAD_OP = "shard_grad_op" + NO_SHARD = "no_shard" + HYBRID_SHARD = "hybrid_shard" + HYBRID_SHARD_ZERO2 = "hybrid_shard_zero2" + OFFLOAD = "offload" + AUTO_WRAP = "auto_wrap" + + +class RemoveColumnsCollator: + """Wrap the data collator to remove unused columns before they are passed to the collator.""" + + def __init__( + self, + data_collator, + signature_columns, + logger=None, + model_name: str | None = None, + description: str | None = None, + ): + self.data_collator = data_collator + self.signature_columns = signature_columns + self.logger = logger + self.description = description + self.model_name = model_name + self.message_logged = False + + def _remove_columns(self, feature: dict) -> dict: + if not isinstance(feature, dict): + return feature + if not self.message_logged and self.logger and self.model_name: + ignored_columns = list(set(feature.keys()) - set(self.signature_columns)) + if len(ignored_columns) > 0: + dset_description = "" if self.description is None else f"in the {self.description} set" + self.logger.info( + f"The following columns {dset_description} don't have a corresponding argument in " + f"`{self.model_name}.forward` and have been ignored: {', '.join(ignored_columns)}." + f" If {', '.join(ignored_columns)} are not expected by `{self.model_name}.forward`, " + " you can safely ignore this message." + ) + self.message_logged = True + return {k: v for k, v in feature.items() if k in self.signature_columns} + + def __call__(self, features: list[dict]): + features = [self._remove_columns(feature) for feature in features] + return self.data_collator(features) + + +def check_target_module_exists(optim_target_modules, key: str, return_is_regex: bool = False): + """A helper method to check if the passed module's key name matches any of the target modules in the optim_target_modules. + + Args: + optim_target_modules (`Union[str, list[str]]`): + A list of strings to try to match. Can be also a full string. + key (`str`): + A key to search any matches in optim_target_modules + return_is_regex (`bool`): + If set to `True`, the method will return whether the passed `optim_target_modules` + is a regex or not. + + Returns: + `bool` : True of match object if key matches any target modules from config, False or + None if no match found + `bool` : If the matched target module is a regex to silence out the warnings in Trainer + for extra modules being found (only if `target_module_found=True` for an array of regex). + """ + target_module_found = False + is_regex = False + + if isinstance(optim_target_modules, str): + target_module_found = bool(re.fullmatch(optim_target_modules, key)) + is_regex = optim_target_modules != key + elif key in optim_target_modules: # from here, target_module_found must be a list of str + # this module is specified directly in target_modules + target_module_found = True + elif any(target_key in key for target_key in optim_target_modules): + target_module_found = True + elif any(bool(re.fullmatch(optim_target_module, key)) for optim_target_module in optim_target_modules): + target_module_found = True + is_regex = True + + if return_is_regex: + return target_module_found, is_regex + + return target_module_found + + +def load_sharded_checkpoint(model, folder, strict=True, prefer_safe=True): + """ + This is the same as + [`torch.nn.Module.load_state_dict`](https://pytorch.org/docs/stable/generated/torch.nn.Module.html?highlight=load_state_dict#torch.nn.Module.load_state_dict) + but for a sharded checkpoint. + + This load is performed efficiently: each checkpoint shard is loaded one by one in RAM and deleted after being + loaded in the model. + + Args: + model (`torch.nn.Module`): The model in which to load the checkpoint. + folder (`str` or `os.PathLike`): A path to a folder containing the sharded checkpoint. + strict (`bool`, *optional*, defaults to `True`): + Whether to strictly enforce that the keys in the model state dict match the keys in the sharded checkpoint. + prefer_safe (`bool`, *optional*, defaults to `False`): + If both safetensors and PyTorch save files are present in checkpoint and `prefer_safe` is True, the + safetensors files will be loaded. Otherwise, PyTorch files are always loaded when possible. + + Returns: + `NamedTuple`: A named tuple with `missing_keys` and `unexpected_keys` fields + - `missing_keys` is a list of str containing the missing keys + - `unexpected_keys` is a list of str containing the unexpected keys + """ + # Load the index + index_file = os.path.join(folder, WEIGHTS_INDEX_NAME) + safe_index_file = os.path.join(folder, SAFE_WEIGHTS_INDEX_NAME) + + index_present = os.path.isfile(index_file) + safe_index_present = os.path.isfile(safe_index_file) + + if not index_present and not safe_index_present: + filenames = (WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_INDEX_NAME) + raise ValueError(f"Can't find a checkpoint index ({' or '.join(filenames)}) in {folder}.") + + load_safe = safe_index_present and (prefer_safe or not index_present) + load_index = safe_index_file if load_safe else index_file + + with open(load_index, "r", encoding="utf-8") as f: + index = json.load(f) + + shard_files = list(set(index["weight_map"].values())) + + # If strict=True, error before loading any of the state dicts. + # TODO: Here, update the weight map with the config.dynamic_weight_conversion + loaded_keys = index["weight_map"].keys() + model_keys = model.state_dict().keys() + missing_keys = [key for key in model_keys if key not in loaded_keys] + unexpected_keys = [key for key in loaded_keys if key not in model_keys] + if strict and (len(missing_keys) > 0 or len(unexpected_keys) > 0): + error_message = f"Error(s) in loading state_dict for {model.__class__.__name__}" + if len(missing_keys) > 0: + str_missing_keys = ",".join([f'"{k}"' for k in missing_keys]) + error_message += f"\nMissing key(s): {str_missing_keys}." + if len(unexpected_keys) > 0: + str_unexpected_keys = ",".join([f'"{k}"' for k in unexpected_keys]) + error_message += f"\nMissing key(s): {str_unexpected_keys}." + raise RuntimeError(error_message) + + if load_safe: + loader = safe_load_file + else: + check_torch_load_is_safe() + loader = partial(torch.load, map_location="cpu", weights_only=True) + + for shard_file in shard_files: + state_dict = loader(os.path.join(folder, shard_file)) + model.load_state_dict(state_dict, strict=False) + + # Make sure memory is freed before we load the next state dict. + del state_dict + gc.collect() + + # Return the same thing as PyTorch load_state_dict function. + return torch.nn.modules.module._IncompatibleKeys(missing_keys, unexpected_keys) + + +def compare_trainer_and_checkpoint_args(training_args, trainer_state): + """ + Compare training arguments with those stored in a checkpoint's trainer state. + + Logs a warning if there are mismatches between the current training arguments + and the ones saved in the checkpoint. + + Args: + training_args: The current training arguments. + trainer_state: The trainer state loaded from a checkpoint. + """ + attributes_map = { + "logging_steps": "logging_steps", + "eval_steps": "eval_steps", + "save_steps": "save_steps", + } + + has_warning = False + warning_str = "Warning: The following arguments do not match the ones in the `trainer_state.json` within the checkpoint directory: " + for arg_attr, state_attr in attributes_map.items(): + arg_value = getattr(training_args, arg_attr, None) + state_value = getattr(trainer_state, state_attr, None) + + if arg_value is not None and state_value is not None and arg_value != state_value: + warning_str += f"\n\t{arg_attr}: {arg_value} (from args) != {state_value} (from trainer_state.json)" + has_warning = True + + # train bs is special as we need to account for multi-GPU + train_bs_args = training_args.per_device_train_batch_size + train_bs_state = trainer_state.train_batch_size // max(1, training_args.n_gpu) + + if train_bs_args != train_bs_state: + warning_str += f"\n\tper_device_train_batch_size: {train_bs_args} (from args) != {train_bs_state} (from trainer_state.json)" + has_warning = True + + if has_warning: + logger.warning_once(warning_str) + + +def align_special_tokens(model, processing_class): + """ + Aligns the special tokens of the tokenizer with the model configs. + + A new tokens may be defined in the tokenizer for fine-tuning purposes, e.g. an "end of turn" token may be + added on chat models. In that case, we want the model configs to be aligned with the tokenizer, so that all + downstream uses work as expected. This alignment should happen before training, to ensure the prediction step + uses the new tokens as well. + """ + from .processing_utils import ProcessorMixin + from .tokenization_utils_base import PreTrainedTokenizerBase + + if isinstance(processing_class, ProcessorMixin): + tokenizer: PreTrainedTokenizerBase = processing_class.tokenizer + else: + tokenizer = processing_class + model_has_generation_config = hasattr(model, "generation_config") and model.generation_config is not None + updated_tokens = {} + + # 1 - Align EOS token. EOS is more complex than the others, as `generation_config` may hold more than one EOS + # token. + tokenizer_has_new_eos = tokenizer.eos_token_id != getattr(model.config, "eos_token_id", None) + if model_has_generation_config: + # `generation_config.eos_token_id` is None: direct comparison + if model.generation_config.eos_token_id is None: + tokenizer_has_new_eos |= tokenizer.eos_token_id != model.generation_config.eos_token_id + else: + # `generation_config.eos_token_id` is an `int`: convert it to list (and continue below) + if isinstance(model.generation_config.eos_token_id, int): + model.generation_config.eos_token_id = [model.generation_config.eos_token_id] + # `generation_config.eos_token_id` is a `list`: check if the tokenizer's EOS token is in the list + tokenizer_has_new_eos |= tokenizer.eos_token_id not in model.generation_config.eos_token_id + + if tokenizer_has_new_eos: + updated_tokens["eos_token_id"] = tokenizer.eos_token_id + model.config.eos_token_id = tokenizer.eos_token_id + # The generation config may hold more than one EOS token. We preserve the original EOS tokens: any of the + # EOS tokens defined here will halt generation. + if model_has_generation_config: + all_eos_tokens = [tokenizer.eos_token_id] + if model.generation_config.eos_token_id is not None: + all_eos_tokens += list(model.generation_config.eos_token_id) + model.generation_config.eos_token_id = [token for token in all_eos_tokens if token is not None] + + # 2 - Align BOS + tokenizer_has_new_bos = tokenizer.bos_token_id != getattr(model.config, "bos_token_id", None) + if model_has_generation_config: + tokenizer_has_new_bos |= tokenizer.bos_token_id != model.generation_config.bos_token_id + + if tokenizer_has_new_bos: + updated_tokens["bos_token_id"] = tokenizer.bos_token_id + model.config.bos_token_id = tokenizer.bos_token_id + if model_has_generation_config: + model.generation_config.bos_token_id = tokenizer.bos_token_id + + # 3 - Align PAD + tokenizer_has_new_pad = tokenizer.pad_token_id != getattr(model.config, "pad_token_id", None) + if model_has_generation_config: + tokenizer_has_new_pad |= tokenizer.pad_token_id != model.generation_config.pad_token_id + + if tokenizer_has_new_pad: + updated_tokens["pad_token_id"] = tokenizer.pad_token_id + model.config.pad_token_id = tokenizer.pad_token_id + if model_has_generation_config: + model.generation_config.pad_token_id = tokenizer.pad_token_id + + # 4 - Warn users about the changes + if len(updated_tokens) > 0: + logger.warning( + "The tokenizer has new PAD/BOS/EOS tokens that differ from the model config and generation config. " + "The model config and generation config were aligned accordingly, being updated with the tokenizer's " + f"values. Updated tokens: {updated_tokens}." + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/training_args.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/training_args.py new file mode 100644 index 0000000000000000000000000000000000000000..b4332272764f47e780ad44cff87811e8f67ab167 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/training_args.py @@ -0,0 +1,2803 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import contextlib +import json +import math +import os +import warnings +from dataclasses import asdict, dataclass, field, fields +from datetime import timedelta +from enum import Enum +from functools import cached_property +from typing import Any + +from .debug_utils import DebugOption +from .trainer_utils import ( + FSDPOption, + HubStrategy, + IntervalStrategy, + SaveStrategy, + SchedulerType, +) +from .utils import ( + ACCELERATE_MIN_VERSION, + ExplicitEnum, + is_accelerate_available, + is_sagemaker_dp_enabled, + is_sagemaker_mp_enabled, + is_torch_available, + is_torch_bf16_gpu_available, + is_torch_cuda_available, + is_torch_hpu_available, + is_torch_mlu_available, + is_torch_mps_available, + is_torch_musa_available, + is_torch_neuroncore_available, + is_torch_npu_available, + is_torch_tf32_available, + is_torch_xla_available, + is_torch_xpu_available, + logging, + requires_backends, +) +from .utils.generic import strtobool +from .utils.import_utils import enable_tf32, is_optimum_neuron_available + + +logger = logging.get_logger(__name__) +log_levels = logging.get_log_levels_dict().copy() +trainer_log_levels = dict(**log_levels, passive=-1) + +if is_torch_available(): + import torch + import torch.distributed as dist + +if is_accelerate_available(): + from accelerate.state import AcceleratorState, PartialState + from accelerate.utils import DistributedType + + from .trainer_pt_utils import AcceleratorConfig + +if is_accelerate_available("1.10.1"): + from accelerate.parallelism_config import ParallelismConfig +else: + ParallelismConfig = Any + +if is_torch_xla_available(): + import torch_xla.core.xla_model as xm + +if is_torch_neuroncore_available(check_device=False): + # torchrun support + # https://github.com/pytorch/xla/pull/3609 + if os.environ.get("TORCHELASTIC_RUN_ID"): + if is_optimum_neuron_available(): + logger.info( + "Make sure that you are performing the training with the NeuronTrainer from optimum[neuron], this " + "will fail otherwise." + ) + else: + logger.warning( + "Please use the NeuronTrainer from optimum[neuron] instead of the Transformers library to perform " + "training on AWS Trainium instances. More information here: " + "https://github.com/huggingface/optimum-neuron" + ) + import torch_xla.distributed.xla_backend as xbn + + if not isinstance(dist.group.WORLD, xbn.ProcessGroupXla): + dist.init_process_group(backend="xla") + if not isinstance(dist.group.WORLD, xbn.ProcessGroupXla): + raise AssertionError("Failed to initialize torch.distributed process group using XLA backend.") + + +if is_sagemaker_mp_enabled(): + import smdistributed.modelparallel.torch as smp + + smp.init() + + +class OptimizerNames(ExplicitEnum): + """ + Stores the acceptable string identifiers for optimizers. + """ + + ADAMW_TORCH = "adamw_torch" + ADAMW_TORCH_FUSED = "adamw_torch_fused" + ADAMW_TORCH_XLA = "adamw_torch_xla" + ADAMW_TORCH_NPU_FUSED = "adamw_torch_npu_fused" + ADAMW_APEX_FUSED = "adamw_apex_fused" + ADAFACTOR = "adafactor" + ADAMW_ANYPRECISION = "adamw_anyprecision" + ADAMW_TORCH_4BIT = "adamw_torch_4bit" + ADAMW_TORCH_8BIT = "adamw_torch_8bit" + ADEMAMIX = "ademamix" + SGD = "sgd" + ADAGRAD = "adagrad" + ADAMW_BNB = "adamw_bnb_8bit" + ADAMW_8BIT = "adamw_8bit" # just an alias for adamw_bnb_8bit + ADEMAMIX_8BIT = "ademamix_8bit" + LION_8BIT = "lion_8bit" + LION = "lion_32bit" + PAGED_ADAMW = "paged_adamw_32bit" + PAGED_ADAMW_8BIT = "paged_adamw_8bit" + PAGED_ADEMAMIX = "paged_ademamix_32bit" + PAGED_ADEMAMIX_8BIT = "paged_ademamix_8bit" + PAGED_LION = "paged_lion_32bit" + PAGED_LION_8BIT = "paged_lion_8bit" + RMSPROP = "rmsprop" + RMSPROP_BNB = "rmsprop_bnb" + RMSPROP_8BIT = "rmsprop_bnb_8bit" + RMSPROP_32BIT = "rmsprop_bnb_32bit" + GALORE_ADAMW = "galore_adamw" + GALORE_ADAMW_8BIT = "galore_adamw_8bit" + GALORE_ADAFACTOR = "galore_adafactor" + GALORE_ADAMW_LAYERWISE = "galore_adamw_layerwise" + GALORE_ADAMW_8BIT_LAYERWISE = "galore_adamw_8bit_layerwise" + GALORE_ADAFACTOR_LAYERWISE = "galore_adafactor_layerwise" + LOMO = "lomo" + ADALOMO = "adalomo" + GROKADAMW = "grokadamw" + SCHEDULE_FREE_RADAM = "schedule_free_radam" + SCHEDULE_FREE_ADAMW = "schedule_free_adamw" + SCHEDULE_FREE_SGD = "schedule_free_sgd" + APOLLO_ADAMW = "apollo_adamw" + APOLLO_ADAMW_LAYERWISE = "apollo_adamw_layerwise" + STABLE_ADAMW = "stable_adamw" + + +def _convert_str_dict(passed_value: dict): + "Safely checks that a passed value is a dictionary and converts any string values to their appropriate types." + for key, value in passed_value.items(): + if isinstance(value, dict): + passed_value[key] = _convert_str_dict(value) + elif isinstance(value, str): + # First check for bool and convert + if value.lower() in ("true", "false"): + passed_value[key] = value.lower() == "true" + # Check for digit + elif value.isdigit(): + passed_value[key] = int(value) + elif value.replace(".", "", 1).isdigit(): + passed_value[key] = float(value) + + return passed_value + + +@dataclass +class TrainingArguments: + """ + Configuration class for controlling all aspects of model training with the Trainer. + TrainingArguments centralizes all hyperparameters, optimization settings, logging preferences, and infrastructure choices needed for training. + + [`HfArgumentParser`] can turn this class into + [argparse](https://docs.python.org/3/library/argparse#module-argparse) arguments that can be specified on the + command line. + + Parameters: + output_dir (`str`, *optional*, defaults to `"trainer_output"`): + The output directory where the model predictions and checkpoints will be written. + + > Training Duration and Batch Size + + per_device_train_batch_size (`int`, *optional*, defaults to 8): + The batch size *per device*. The **global batch size** is computed as: + `per_device_train_batch_size * number_of_devices` in multi-GPU or distributed setups. + num_train_epochs(`float`, *optional*, defaults to 3.0): + Total number of training epochs to perform (if not an integer, will perform the decimal part percents of + the last epoch before stopping training). + max_steps (`int`, *optional*, defaults to -1): + Overrides `num_train_epochs`. If set to a positive number, the total number of training steps to perform. + For a finite dataset, training is reiterated through the dataset (if all data is exhausted) until + `max_steps` is reached. + + > Learning Rate & Scheduler + + learning_rate (`float`, *optional*, defaults to 5e-5): + The initial learning rate for the optimizer. This is typically the peak learning rate when using a scheduler with warmup. + lr_scheduler_type (`str` or [`SchedulerType`], *optional*, defaults to `"linear"`): + The learning rate scheduler type to use. See [`SchedulerType`] for all possible values. Common choices: + - "linear" = [`get_linear_schedule_with_warmup`] + - "cosine" = [`get_cosine_schedule_with_warmup`] + - "constant" = [`get_constant_schedule`] + - "constant_with_warmup" = [`get_constant_schedule_with_warmup`] + lr_scheduler_kwargs (`dict` or `str`, *optional*, defaults to `None`): + The extra arguments for the lr_scheduler. See the documentation of each scheduler for possible values. + warmup_steps (`int` or `float`, *optional*, defaults to 0): + Number of steps for a linear warmup from 0 to `learning_rate`. Warmup helps stabilize training in the initial phase. Can be: + - An integer: exact number of warmup steps + - A float in range [0, 1): interpreted as ratio of total training steps + + > Optimizer + + optim (`str` or [`training_args.OptimizerNames`], *optional*, defaults to `"adamw_torch"` (for torch>=2.8 `"adamw_torch_fused"`)): + The optimizer to use. Common options: + - `"adamw_torch"`: PyTorch's AdamW (recommended default) + - `"adamw_torch_fused"`: Fused AdamW kernel + - `"adamw_hf"`: HuggingFace's AdamW implementation + - `"sgd"`: Stochastic Gradient Descent with momentum + - `"adafactor"`: Memory-efficient optimizer for large models + - `"adamw_8bit"`: 8-bit AdamW (requires bitsandbytes) + See [`OptimizerNames`] for the complete list. + optim_args (`str`, *optional*): + Optional arguments that are supplied to optimizers such as AnyPrecisionAdamW, AdEMAMix, and GaLore. + weight_decay (`float`, *optional*, defaults to 0): + Weight decay coefficient applied by the optimizer (not the loss function). Adds L2 + regularization to prevent overfitting by penalizing large weights. Automatically + excluded from bias and LayerNorm parameters. Typical values: 0.01 (standard), 0.1 + (stronger regularization), 0.0 (no regularization). + adam_beta1 (`float`, *optional*, defaults to 0.9): + The exponential decay rate for the first moment estimates (momentum) in Adam-based + optimizers. Controls how much history of gradients to retain. + adam_beta2 (`float`, *optional*, defaults to 0.999): + The exponential decay rate for the second moment estimates (variance) in Adam-based + optimizers. Controls adaptive learning rate scaling. + adam_epsilon (`float`, *optional*, defaults to 1e-8): + Epsilon value for numerical stability in Adam-based optimizers. Prevents division by + zero in the denominator of the update rule. + optim_target_modules (`Union[str, list[str]]`, *optional*): + The target modules to optimize, i.e. the module names that you would like to train. + Currently used for the [GaLore algorithm](https://huggingface.co/papers/2403.03507) and [APOLLO algorithm](https://huggingface.co/papers/2412.05270). + See [GaLore implementation](https://github.com/jiaweizzhao/GaLore) and [APOLLO implementation](https://github.com/zhuhanqing/APOLLO) for more details. + You need to make sure to pass a valid GaLore or APOLLO optimizer, e.g., one of: "apollo_adamw", "galore_adamw", "galore_adamw_8bit", "galore_adafactor" and make sure that the target modules are `nn.Linear` modules only. + + > Regularization & Training Stability + + gradient_accumulation_steps (`int`, *optional*, defaults to 1): + Number of update steps to accumulate gradients before performing a backward/update pass. + Simulates larger batch sizes without additional memory. Effective batch size = + `per_device_train_batch_size × num_devices × gradient_accumulation_steps`. + > [!TIP] + > When using gradient accumulation, one "step" is counted as one step with a backward pass. Therefore, logging, evaluation, and saving will occur every `gradient_accumulation_steps × xxx_step` training examples. + average_tokens_across_devices (`bool`, *optional*, defaults to `True`): + Whether or not to average tokens across devices. If enabled, will use all_reduce to synchronize + num_tokens_in_batch for precise loss calculation. Reference: + https://github.com/huggingface/transformers/issues/34242 + max_grad_norm (`float`, *optional*, defaults to 1.0): + Maximum gradient norm for gradient clipping. Applied after backward pass, before + optimizer step. Prevents gradient explosion by scaling down gradients when their global + norm exceeds this threshold. Set to 0 to disable clipping. Typical values: + 1.0 (standard), 0.5 (more conservative), 5.0 (less aggressive). + label_smoothing_factor (`float`, *optional*, defaults to 0.0): + Label smoothing factor to prevent overconfidence. Replaces hard 0/1 targets with soft + targets: 0 becomes `ε/num_labels` and 1 becomes `1 - ε + ε/num_labels`, where + ε = `label_smoothing_factor`. Zero means no smoothing. Typical range: 0.0 to 0.1. + + > Mixed Precision Training + + bf16 (`bool`, *optional*, defaults to `False`): + Enable bfloat16 (BF16) mixed precision training + Generally preferred over FP16 due to better numerical stability and no loss scaling required. + fp16 (`bool`, *optional*, defaults to `False`): + Enable float16 (FP16) mixed precision training. + Consider using BF16 instead if your hardware supports it. + bf16_full_eval (`bool`, *optional*, defaults to `False`): + Use full BF16 precision for evaluation (not just mixed precision). Faster and saves + memory but may affect metric values slightly. Only applies during evaluation. + fp16_full_eval (`bool`, *optional*, defaults to `False`): + Use full FP16 precision for evaluation (not just mixed precision). Faster and saves + memory but may affect metric values slightly. Only applies during evaluation. + tf32 (`bool`, *optional*): + Enable TensorFloat-32 (TF32) mode on Ampere and newer GPUs. TF32 uses 19-bit precision + for matrix multiplications (instead of FP32's 23-bit), providing up to 8x speedup with + negligible accuracy loss. Default depends on PyTorch version. See + [TF32 docs](https://huggingface.co/docs/transformers/perf_train_gpu_one#tf32). + + > Gradient Checkpointing + + gradient_checkpointing (`bool`, *optional*, defaults to `False`): + Enable gradient checkpointing to trade compute for memory. Reduces memory usage by + clearing activations during forward pass and recomputing them during backward pass. + Enables training larger models or batch sizes at the cost of ~20% slower training. + gradient_checkpointing_kwargs (`dict`, *optional*, defaults to `None`): + Keyword arguments passed to `gradient_checkpointing_enable()`. + + > Compilation + + torch_compile (`bool`, *optional*, defaults to `False`): + Compile the model using PyTorch 2.0's `torch.compile()` for faster training. Can provide + 20-50% speedup with no code changes. Uses default compilation settings unless + `torch_compile_backend` or `torch_compile_mode` are specified. + torch_compile_backend (`str`, *optional*): + Backend for `torch.compile()`. If set, automatically enables `torch_compile`. Options + include `"inductor"` (default), `"aot_eager"`, `"cudagraphs"`. Backends vary by PyTorch + version - see PyTorch docs for available options. + torch_compile_mode (`str`, *optional*): + Compilation mode for `torch.compile()`. If set, automatically enables `torch_compile`. + Options: `"default"`, `"reduce-overhead"` (minimize Python overhead), `"max-autotune"` + (aggressive optimization, slower compile time). + + > Kernels + + use_liger_kernel (`bool`, *optional*, defaults to `False`): + Enable [Liger Kernel](https://github.com/linkedin/Liger-Kernel) optimizations. Increases + multi-GPU throughput by ~20% and reduces memory usage by ~60%. Works with Flash Attention, + FSDP, and DeepSpeed. Currently supports Llama, Mistral, Mixtral, and Gemma models. + liger_kernel_config (`Optional[dict]`, *optional*): + Configuration for Liger Kernel. Passed as kwargs to `_apply_liger_kernel_to_instance()`. + Options typically include: `"rope"`, `"swiglu"`, `"cross_entropy"`, + `"fused_linear_cross_entropy"`, `"rms_norm"`. If `None`, uses default configuration. + + > Additional Optimizations + + use_cache (`bool`, *optional*, defaults to `False`): + Whether or not to enable cache for the model. For training, this is usually not needed apart from some PEFT methods that uses `past_key_values`. + neftune_noise_alpha (`Optional[float]`): + If not `None`, this will activate NEFTune noise embeddings. This can drastically improve model performance + for instruction fine-tuning. Check out the [original paper](https://huggingface.co/papers/2310.05914) and the + [original code](https://github.com/neelsjain/NEFTune). Support transformers `PreTrainedModel` and also + `PeftModel` from peft. The original paper used values in the range [5.0, 15.0]. + torch_empty_cache_steps (`int`, *optional*): + Number of steps to wait before calling `torch..empty_cache()`. If left unset or set to None, cache will not be emptied. + This can help avoid CUDA out-of-memory errors by lowering peak VRAM usage at a cost of about [10% slower performance](https://github.com/huggingface/transformers/issues/31372). + auto_find_batch_size (`bool`, *optional*, defaults to `False`) + Whether to find a batch size that will fit into memory automatically through exponential decay, avoiding + CUDA Out-of-Memory errors. + + > Logging & Monitoring Training + + logging_strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"steps"`): + The logging strategy to adopt during training. Possible values are: + - `"no"`: No logging is done during training. + - `"epoch"`: Logging is done at the end of each epoch. + - `"steps"`: Logging is done every `logging_steps`. + logging_steps (`int` or `float`, *optional*, defaults to 500): + Number of update steps between two logs if `logging_strategy="steps"`. Should be an integer or a float in + range `[0,1)`. If smaller than 1, will be interpreted as ratio of total training steps. + logging_first_step (`bool`, *optional*, defaults to `False`): + Whether to log the first `global_step` or not. + log_on_each_node (`bool`, *optional*, defaults to `True`): + In multinode distributed training, whether to log using `log_level` once per node, or only on the main + node. + logging_nan_inf_filter (`bool`, *optional*, defaults to `True`): + Filter out NaN and Inf losses when logging. If `True`, replaces NaN/Inf losses with the + average of recent valid losses. Does not affect gradient computation, only logging. + include_num_input_tokens_seen (`Optional[Union[str, bool]]`, *optional*, defaults to "no"): + Whether to track the number of input tokens seen. Must be one of ["all", "non_padding", "no"] or a boolean value which map to "all" or "no". + May be slower in distributed training as gather operations must be called. + + > Logging + + log_level (`str`, *optional*, defaults to `passive`): + Logging level for the main process. Options: `"debug"`, `"info"`, `"warning"`, `"error"`, + `"critical"`, or `"passive"` (doesn't change the current Transformers logging level, + which defaults to `"warning"`) + log_level_replica (`str`, *optional*, defaults to `"warning"`): + Logging level for replica processes in distributed training. Same options as `log_level`. + disable_tqdm (`bool`, *optional*): + Disable tqdm progress bars. Defaults to `True` if `log_level` is warning or lower, `False` otherwise. + + > Experiment Tracking Integration + + report_to (`str` or `list[str]`, *optional*, defaults to `"none"`): + The list of integrations to report the results and logs to. Supported platforms are `"azure_ml"`, + `"clearml"`, `"codecarbon"`, `"comet_ml"`, `"dagshub"`, `"dvclive"`, `"flyte"`, `"mlflow"`, `"swanlab"`, + `"tensorboard"`, `"trackio"` and `"wandb"`. Use `"all"` to report to all integrations installed, `"none"` + for no integrations. + run_name (`str`, *optional*): + A descriptor for the run. Typically used for [trackio](https://github.com/gradio-app/trackio), + [wandb](https://www.wandb.com/), [mlflow](https://www.mlflow.org/), [comet](https://www.comet.com/site) and + [swanlab](https://swanlab.cn) logging. + project (`str`, *optional*, defaults to `"huggingface"`): + The name of the project to use for logging. Currently, only used by Trackio. + trackio_space_id (`str` or `None`, *optional*, defaults to `"trackio"`): + The Hugging Face Space ID to deploy to when using Trackio. Should be a complete Space name like + `'username/reponame'` or `'orgname/reponame'`, or just `'reponame'` in which case the Space will be + created in the currently-logged-in Hugging Face user's namespace. If `None`, will log to a local directory. + Note that this Space will be public unless you set `hub_private_repo=True` or your organization's default + is to create private Spaces." + + > Evaluation + + eval_strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"no"`): + When to run evaluation. Options: + - `"no"`: No evaluation during training + - `"steps"`: Evaluate every `eval_steps` + - `"epoch"`: Evaluate at the end of each epoch + eval_steps (`int` or `float`, *optional*): + Number of update steps between two evaluations if `eval_strategy="steps"`. Will default to the same + value as `logging_steps` if not set. Should be an integer or a float in range `[0,1)`. If smaller than 1, + will be interpreted as ratio of total training steps. + eval_delay (`float`, *optional*): + Number of epochs or steps to wait for before the first evaluation can be performed, depending on the + eval_strategy. + per_device_eval_batch_size (`int`, *optional*, defaults to 8): + The batch size per device accelerator core/CPU for evaluation. + prediction_loss_only (`bool`, *optional*, defaults to `False`): + When performing evaluation and generating predictions, only returns the loss. + eval_on_start (`bool`, *optional*, defaults to `False`): + Whether to perform a evaluation step (sanity check) before the training to ensure the validation steps works correctly. + eval_do_concat_batches (`bool`, *optional*, defaults to `True`): + Whether to recursively concat inputs/losses/labels/predictions across batches. If `False`, + will instead store them as lists, with each batch kept separate. + eval_use_gather_object (`bool`, *optional*, defaults to `False`): + Whether to run recursively gather object in a nested list/tuple/dictionary of objects from all devices. This should only be enabled if users are not just returning tensors, and this is actively discouraged by PyTorch. + This is useful when the labels structure is non standard, like in computer vision tasks. + eval_accumulation_steps (`int`, *optional*): + Number of predictions steps to accumulate the output tensors for, before moving the results to the CPU. If + left unset, the whole predictions are accumulated on the device accelerator before being moved to the CPU (faster but + requires more memory). + + > Metrics Computation + + include_for_metrics (`list[str]`, *optional*, defaults to `[]`): + Include additional data in the `compute_metrics` function if needed for metrics computation. + Possible options to add to `include_for_metrics` list: + - `"inputs"`: Input data passed to the model, intended for calculating input dependent metrics. + - `"loss"`: Loss values computed during evaluation, intended for calculating loss dependent metrics. + batch_eval_metrics (`bool`, *optional*, defaults to `False`): + If set to `True`, evaluation will call compute_metrics at the end of each batch to accumulate statistics + rather than saving all eval logits in memory. When set to `True`, you must pass a compute_metrics function + that takes a boolean argument `compute_result`, which when passed `True`, will trigger the final global + summary statistics from the batch-level summary statistics you've accumulated over the evaluation set. + + > Checkpointing & Saving + + save_only_model (`bool`, *optional*, defaults to `False`): + Save only model weights, not optimizer/scheduler/RNG state. Significantly reduces + checkpoint size but prevents resuming training from the checkpoint. Use when you only + need the trained model for inference, not continued training. + You can only load the model using `from_pretrained` with this option set to `True`. + save_strategy (`str` or [`~trainer_utils.SaveStrategy`], *optional*, defaults to `"steps"`): + The checkpoint save strategy to adopt during training. Possible values are: + - `"no"`: No save is done during training. + - `"epoch"`: Save is done at the end of each epoch. + - `"steps"`: Save is done every `save_steps`. + - `"best"`: Save is done whenever a new `best_metric` is achieved. + save_steps (`int` or `float`, *optional*, defaults to 500): + Number of updates steps before two checkpoint saves if `save_strategy="steps"`. Should be an integer or a + float in range `[0,1)`. If smaller than 1, will be interpreted as ratio of total training steps. + save_on_each_node (`bool`, *optional*, defaults to `False`): + When doing multi-node distributed training, whether to save models and checkpoints on each node, or only on + the main one. + This should not be activated when the different nodes use the same storage as the files will be saved with + the same names for each node. + save_total_limit (`int`, *optional*): + Maximum number of checkpoints to keep. Deletes older checkpoints in `output_dir`. When + `load_best_model_at_end=True`, the best checkpoint is always retained plus the most + recent ones. For example, `save_total_limit=5` keeps the 4 most recent plus the best + enable_jit_checkpoint (`bool`, *optional*, defaults to `False`): + Enable Just-In-Time checkpointing on SIGTERM signal for graceful termination on + preemptible workloads. **Important**: Configure your orchestrator's graceful shutdown + period to allow sufficient time. For Kubernetes, set `terminationGracePeriodSeconds` + (default 30s is usually insufficient). For Slurm, use `--signal=USR1@`. + Required grace period ≥ longest iteration time + checkpoint save time. + + > Hugging Face Hub Integration + + push_to_hub (`bool`, *optional*, defaults to `False`): + Whether or not to push the model to the Hub every time the model is saved. If this is activated, + `output_dir` will begin a git directory synced with the repo (determined by `hub_model_id`) and the content + will be pushed each time a save is triggered (depending on your `save_strategy`). Calling + [`~Trainer.save_model`] will also trigger a push. + hub_token (`str`, *optional*): + The token to use to push the model to the Hub. Will default to the token in the cache folder obtained with + `hf auth login`. + hub_private_repo (`bool`, *optional*): + Whether to make the repo private. If `None` (default), the repo will be public unless the organization's + default is private. This value is ignored if the repo already exists. If reporting to Trackio with + deployment to Hugging Face Spaces enabled, the same logic determines whether the Space is private. + hub_model_id (`str`, *optional*): + The name of the repository to keep in sync with the local *output_dir*. It can be a simple model ID in + which case the model will be pushed in your namespace. Otherwise it should be the whole repository name, + for instance `"user_name/model"`, which allows you to push to an organization you are a member of with + `"organization_name/model"`. Will default to `user_name/output_dir_name` with *output_dir_name* being the + name of `output_dir`. + hub_strategy (`str` or [`~trainer_utils.HubStrategy`], *optional*, defaults to `"every_save"`): + Defines what and when to push to Hub. Options: + - `"end"`: Push only at the end of training + - `"every_save"`: Push on each save (async to not block training) + - `"checkpoint"`: Like `"every_save"` plus push latest checkpoint to `"last-checkpoint"` subfolder for easy resuming + - `"all_checkpoints"`: Push all checkpoints as they appear + hub_always_push (`bool`, *optional*, defaults to `False`): + Unless this is `True`, the `Trainer` will skip pushing a checkpoint when the previous push is not finished. + hub_revision (`str`, *optional*): + The revision to use when pushing to the Hub. Can be a branch name, a tag, or a commit hash. + + > Best Model Tracking + + load_best_model_at_end (`bool`, *optional*, defaults to `False`): + Load the best checkpoint at the end of training. Requires `eval_strategy` to be set. + When enabled, the best checkpoint is always saved (see `save_total_limit`). + + When `True`, `save_strategy` must match `eval_strategy`, and if using `"steps"`, + `save_steps` must be a multiple of `eval_steps`. + + metric_for_best_model (`str`, *optional*): + Metric to use for comparing models when `load_best_model_at_end=True`. Must be a metric + name returned by evaluation, with or without the `"eval_"` prefix. Defaults to `"loss"`. + If you set this, `greater_is_better` will default to `True` unless the name ends with + `"loss"`. Examples: `"accuracy"`, `"f1"`, `"eval_bleu"`. + greater_is_better (`bool`, *optional*): + Whether higher metric values are better. Defaults based on `metric_for_best_model`: + `True` if the metric name doesn't end in `"loss"`, `False` otherwise. + + > Resuming Training + + ignore_data_skip (`bool`, *optional*, defaults to `False`): + When resuming training, skip fast-forwarding through the dataset to reach the previous + state. If `True`, training starts from the beginning of the dataset (faster resume but + results won't match interrupted training). If `False`, skips seen data (slower resume + but exact continuation). + restore_callback_states_from_checkpoint (`bool`, *optional*, defaults to `False`): + Restore callback states from checkpoint when resuming. If `True`, will override callbacks + passed to Trainer if they exist in the checkpoint. + + > Reproducibility + + full_determinism (`bool`, *optional*, defaults to `False`) + If `True`, [`enable_full_determinism`] is called instead of [`set_seed`] to ensure reproducible results in + distributed training. Important: this will negatively impact the performance, so only use it for debugging. + seed (`int`, *optional*, defaults to 42): + Random seed that will be set at the beginning of training. To ensure reproducibility across runs, use the + [`~Trainer.model_init`] function to instantiate the model if it has some randomly initialized parameters. + data_seed (`int`, *optional*): + Random seed to be used with data samplers. If not set, random generators for data sampling will use the + same seed as `seed`. This can be used to ensure reproducibility of data sampling, independent of the model + seed. + + > Hardware Configuration + + use_cpu (`bool`, *optional*, defaults to `False`): + Whether or not to use cpu. If set to False, we will use the available torch device/backend. + + > Accelerate Configuration + + accelerator_config (`str`, `dict`, or `AcceleratorConfig`, *optional*): + Configuration for the internal Accelerate integration. Can be: + - Path to JSON config file: `"accelerator_config.json"` + - Dictionary with config options + - `AcceleratorConfig` instance + Key options: + - `split_batches` (`bool`, defaults to `False`): Whether to split batches across devices. + If `True`, actual batch size is the same on all devices (total must be divisible by + num_processes). If `False`, each device gets the specified batch size. + - `dispatch_batches` (`bool`): If `True`, only main process iterates through dataloader + and dispatches batches to devices. Defaults to `True` for `IterableDataset`, `False` + otherwise. + - `even_batches` (`bool`, defaults to `True`): Duplicate samples from dataset start to + ensure all workers get equal batch sizes. + - `use_seedable_sampler` (`bool`, defaults to `True`): Use fully seedable random sampler + for reproducibility. + - `use_configured_state` (`bool`, defaults to `False`): Use pre-initialized + `AcceleratorState`/`PartialState` instead of creating new one. May cause issues with + hyperparameter tuning. + + parallelism_config (`ParallelismConfig`, *optional*): + Parallelism configuration for the training run. Requires Accelerate `1.10.1` + + > Dataloader + + dataloader_drop_last (`bool`, *optional*, defaults to `False`): + Whether to drop the last incomplete batch (if the length of the dataset is not divisible by the batch size) + or not. + dataloader_num_workers (`int`, *optional*, defaults to 0): + Number of subprocesses to use for data loading (PyTorch only). 0 means that the data will be loaded in the + main process. + dataloader_pin_memory (`bool`, *optional*, defaults to `True`): + Whether you want to pin memory in data loaders or not. Will default to `True`. + dataloader_persistent_workers (`bool`, *optional*, defaults to `False`): + If True, the data loader will not shut down the worker processes after a dataset has been consumed once. + This allows to maintain the workers Dataset instances alive. Can potentially speed up training, but will + increase RAM usage. Will default to `False`. + dataloader_prefetch_factor (`int`, *optional*): + Number of batches loaded in advance by each worker. + 2 means there will be a total of 2 * num_workers batches prefetched across all workers. + remove_unused_columns (`bool`, *optional*, defaults to `True`): + Whether or not to automatically remove the columns unused by the model forward method. + label_names (`list[str]`, *optional*): + The list of keys in your dictionary of inputs that correspond to the labels. + Will eventually default to the list of argument names accepted by the model that contain the word "label", + except if the model used is one of the `XxxForQuestionAnswering` in which case it will also include the + `["start_positions", "end_positions"]` keys. + You should only specify `label_names` if you're using custom label names or if your model's `forward` consumes multiple label tensors (e.g., extractive QA). + train_sampling_strategy (`str`, *optional*, defaults to `"random"`): + The sampler to use for the training dataloader. Possible values are: + + - `"random"`: Uses `RandomSampler` (default). + - `"sequential"`: Uses `SequentialSampler`. + - `"group_by_length"`: Uses `LengthGroupedSampler` to group samples of roughly the same length + together (to minimize padding and be more efficient). + + Note: When using an `IterableDataset`, this argument is ignored. + length_column_name (`str`, *optional*, defaults to `"length"`): + Column name for precomputed lengths. If the column exists, grouping by length will use these values rather + than computing them on train startup. Ignored unless `train_sampling_strategy` is `"group_by_length"` and the dataset + is an instance of `Dataset`. + + > DDP (DistributedDataParallel) + + ddp_find_unused_parameters (`bool`, *optional*): + When using distributed training, the value of the flag `find_unused_parameters` passed to + `DistributedDataParallel`. Will default to `False` if gradient checkpointing is used, `True` otherwise. + ddp_bucket_cap_mb (`int`, *optional*): + When using distributed training, the value of the flag `bucket_cap_mb` passed to `DistributedDataParallel`. + ddp_broadcast_buffers (`bool`, *optional*): + When using distributed training, the value of the flag `broadcast_buffers` passed to + `DistributedDataParallel`. Will default to `False` if gradient checkpointing is used, `True` otherwise. + ddp_backend (`str`, *optional*): + The backend to use for distributed training. Must be one of `"nccl"`, `"mpi"`, `"xccl"`, `"gloo"`, `"hccl"`. + ddp_timeout (`int`, *optional*, defaults to 1800): + The timeout for `torch.distributed.init_process_group` calls, used to avoid GPU socket timeouts when + performing slow operations in distributed runnings. Please refer to the [PyTorch documentation](https://pytorch.org/docs/stable/distributed.html#torch.distributed.init_process_group) for more + information. + + > FSDP (Fully Sharded Data Parallel) + + fsdp (`bool`, `str` or list of [`~trainer_utils.FSDPOption`], *optional*, defaults to `None`): + Enable PyTorch Fully Sharded Data Parallel (FSDP) for distributed training. Options: + - `"full_shard"`: Shard parameters, gradients, and optimizer states (most memory efficient) + - `"shard_grad_op"`: Shard only optimizer states and gradients (ZeRO-2) + - `"hybrid_shard"`: Full shard within nodes, replicate across nodes + - `"hybrid_shard_zero2"`: Shard gradients/optimizer within nodes, replicate across nodes + - `"offload"`: Offload parameters and gradients to CPU (only with `"full_shard"` or + `"shard_grad_op"`) + - `"auto_wrap"`: Automatically wrap layers using `default_auto_wrap_policy` + fsdp_config (`str` or `dict`, *optional*): + Config to be used with fsdp (Pytorch Distributed Parallel Training). The value is either a location of + fsdp json config file (e.g., `fsdp_config.json`) or an already loaded json file as `dict`. + + A List of config and its options: + - fsdp_version (`int`, *optional*, defaults to `1`): + The version of FSDP to use. Defaults to 1. + - min_num_params (`int`, *optional*, defaults to `0`): + FSDP's minimum number of parameters for Default Auto Wrapping. (useful only when `fsdp` field is + passed). + - transformer_layer_cls_to_wrap (`list[str]`, *optional*): + List of transformer layer class names (case-sensitive) to wrap, e.g, `BertLayer`, `GPTJBlock`, + `T5Block` .... (useful only when `fsdp` flag is passed). + - backward_prefetch (`str`, *optional*) + FSDP's backward prefetch mode. Controls when to prefetch next set of parameters (useful only when + `fsdp` field is passed). + + A list of options along the following: + + - `"backward_pre"` : Prefetches the next set of parameters before the current set of parameter's + gradient computation. + - `"backward_post"` : This prefetches the next set of parameters after the current set of + parameter's gradient computation. + - forward_prefetch (`bool`, *optional*, defaults to `False`) + FSDP's forward prefetch mode (useful only when `fsdp` field is passed). + If `"True"`, then FSDP explicitly prefetches the next upcoming all-gather while executing in the + forward pass. + - limit_all_gathers (`bool`, *optional*, defaults to `False`) + FSDP's limit_all_gathers (useful only when `fsdp` field is passed). + If `"True"`, FSDP explicitly synchronizes the CPU thread to prevent too many in-flight + all-gathers. + - use_orig_params (`bool`, *optional*, defaults to `True`) + If `"True"`, allows non-uniform `requires_grad` during init, which means support for interspersed + frozen and trainable parameters. Useful in cases such as parameter-efficient fine-tuning. Please + refer this + [blog](https://dev-discuss.pytorch.org/t/rethinking-pytorch-fully-sharded-data-parallel-fsdp-from-first-principles/1019 + - sync_module_states (`bool`, *optional*, defaults to `True`) + If `"True"`, each individually wrapped FSDP unit will broadcast module parameters from rank 0 to + ensure they are the same across all ranks after initialization + - cpu_ram_efficient_loading (`bool`, *optional*, defaults to `False`) + If `"True"`, only the first process loads the pretrained model checkpoint while all other processes + have empty weights. When this setting as `"True"`, `sync_module_states` also must to be `"True"`, + otherwise all the processes except the main process would have random weights leading to unexpected + behaviour during training. + - activation_checkpointing (`bool`, *optional*, defaults to `False`): + If `"True"`, activation checkpointing is a technique to reduce memory usage by clearing activations of + certain layers and recomputing them during a backward pass. Effectively, this trades extra + computation time for reduced memory usage. + - xla (`bool`, *optional*, defaults to `False`): + Whether to use PyTorch/XLA Fully Sharded Data Parallel Training. This is an experimental feature + and its API may evolve in the future. + - xla_fsdp_settings (`dict`, *optional*) + The value is a dictionary which stores the XLA FSDP wrapping parameters. + + For a complete list of options, please see [here]( + https://github.com/pytorch/xla/blob/master/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py). + - xla_fsdp_grad_ckpt (`bool`, *optional*, defaults to `False`): + Will use gradient checkpointing over each nested XLA FSDP wrapped layer. This setting can only be + used when the xla flag is set to true, and an auto wrapping policy is specified through + fsdp_min_num_params or fsdp_transformer_layer_cls_to_wrap. + + > DeepSpeed + + deepspeed (`str` or `dict`, *optional*): + Enable [DeepSpeed](https://github.com/deepspeedai/DeepSpeed) integration. Value is either: + - Path to DeepSpeed JSON config file: `"ds_config.json"` + - Loaded config as dictionary + > [!TIP] + > If using ZeRO initialization, instantiate your model *after* initializing + `TrainingArguments`, otherwise ZeRO won't be applied. + + > Debugging & Profiling (Experimental) + + debug (`str` or list of [`~debug_utils.DebugOption`], *optional*, defaults to `""`): + Enable one or more debug features. This is an experimental feature. + Possible options are: + - "underflow_overflow": detects overflow in model's input/outputs and reports the last frames that led to + the event + - "tpu_metrics_debug": print debug metrics on TPU + skip_memory_metrics (`bool`, *optional*, defaults to `True`): + Whether to skip adding of memory profiler reports to metrics. This is skipped by default because it slows + down the training and evaluation speed. + + > External Script Flags (not used by Trainer) + + do_train (`bool`, *optional*, defaults to `False`): + Whether to run training or not. This argument is not directly used by [`Trainer`], it's intended to be used + by your training/evaluation scripts instead. See the [example + scripts](https://github.com/huggingface/transformers/tree/main/examples) for more details. + do_eval (`bool`, *optional*): + Whether to run evaluation on the validation set or not. Will be set to `True` if `eval_strategy` is + different from `"no"`. This argument is not directly used by [`Trainer`], it's intended to be used by your + training/evaluation scripts instead. See the [example + scripts](https://github.com/huggingface/transformers/tree/main/examples) for more details. + do_predict (`bool`, *optional*, defaults to `False`): + Whether to run predictions on the test set or not. This argument is not directly used by [`Trainer`], it's + intended to be used by your training/evaluation scripts instead. See the [example + scripts](https://github.com/huggingface/transformers/tree/main/examples) for more details. + resume_from_checkpoint (`str`, *optional*): + The path to a folder with a valid checkpoint for your model. This argument is not directly used by + [`Trainer`], it's intended to be used by your training/evaluation scripts instead. See the [example + scripts](https://github.com/huggingface/transformers/tree/main/examples) for more details. + """ + + # Fields that accept dict values via CLI as JSON strings (e.g., '{"key": "value"}'). + # Any new dict-typed arg must be added here and typed as `dict | str | None`. + _VALID_DICT_FIELDS = [ + "accelerator_config", + "fsdp_config", + "deepspeed", + "gradient_checkpointing_kwargs", + "lr_scheduler_kwargs", + ] + + # --- Output --- + output_dir: str | None = field( + default=None, + metadata={"help": "The output directory where the model predictions and checkpoints will be written."}, + ) + + # --- Training Duration and Batch Size --- + per_device_train_batch_size: int = field(default=8, metadata={"help": "The batch size per device for training."}) + num_train_epochs: float = field(default=3.0, metadata={"help": "Total number of training epochs to perform."}) + max_steps: int = field( + default=-1, + metadata={ + "help": "Overrides `num_train_epochs`. If set to a positive number, the total number of training steps to perform." + }, + ) + + # --- Learning Rate & Scheduler --- + learning_rate: float = field(default=5e-5, metadata={"help": "The initial learning rate for the optimizer."}) + lr_scheduler_type: SchedulerType | str = field( + default="linear", + metadata={"help": "The learning rate scheduler type to use. See `SchedulerType` for all possible values."}, + ) + lr_scheduler_kwargs: dict | str | None = field( + default=None, + metadata={ + "help": "The extra arguments for the lr_scheduler. See the documentation of each scheduler for possible values." + }, + ) + warmup_steps: float = field( + default=0, + metadata={ + "help": "Number of steps for a linear warmup from 0 to `learning_rate`. Can be an integer (exact steps) or a float in [0, 1) (ratio of total steps)." + }, + ) + + # --- Optimizer --- + default_optim = "adamw_torch" + if is_torch_available(): + from .pytorch_utils import is_torch_greater_or_equal_than_2_8 + + if is_torch_greater_or_equal_than_2_8: + default_optim = "adamw_torch_fused" + optim: OptimizerNames | str = field( + default=default_optim, + metadata={"help": "The optimizer to use. See `OptimizerNames` for the complete list."}, + ) + optim_args: str | None = field( + default=None, + metadata={ + "help": "Optional arguments supplied to optimizers such as AnyPrecisionAdamW, AdEMAMix, and GaLore." + }, + ) + weight_decay: float = field( + default=0.0, + metadata={ + "help": "Weight decay coefficient applied by the optimizer. Automatically excluded from bias and LayerNorm parameters." + }, + ) + adam_beta1: float = field( + default=0.9, + metadata={ + "help": "The exponential decay rate for the first moment estimates (momentum) in Adam-based optimizers." + }, + ) + adam_beta2: float = field( + default=0.999, + metadata={ + "help": "The exponential decay rate for the second moment estimates (variance) in Adam-based optimizers." + }, + ) + adam_epsilon: float = field( + default=1e-8, metadata={"help": "Epsilon value for numerical stability in Adam-based optimizers."} + ) + optim_target_modules: None | str | list[str] = field( + default=None, + metadata={"help": "The target modules to optimize. Currently used for the GaLore and APOLLO algorithms."}, + ) + + # --- Regularization & Training Stability --- + gradient_accumulation_steps: int = field( + default=1, + metadata={ + "help": ( + "Number of update steps to accumulate gradients before performing a backward/update pass." + " Effective batch size = per_device_train_batch_size * num_devices * gradient_accumulation_steps." + ) + }, + ) + average_tokens_across_devices: bool = field( + default=True, + metadata={ + "help": "Whether or not to average tokens across devices. If enabled, will use all_reduce to " + "synchronize num_tokens_in_batch for precise loss calculation. Reference: " + "https://github.com/huggingface/transformers/issues/34242" + }, + ) + max_grad_norm: float = field( + default=1.0, metadata={"help": "Maximum gradient norm for gradient clipping. Set to 0 to disable."} + ) + label_smoothing_factor: float = field( + default=0.0, metadata={"help": "Label smoothing factor to prevent overconfidence. Zero means no smoothing."} + ) + + # --- Mixed Precision --- + bf16: bool = field( + default=False, + metadata={ + "help": "Enable bfloat16 (BF16) mixed precision training. Generally preferred over FP16 due to better numerical stability." + }, + ) + fp16: bool = field( + default=False, + metadata={ + "help": "Enable float16 (FP16) mixed precision training. Consider using BF16 instead if your hardware supports it." + }, + ) + bf16_full_eval: bool = field( + default=False, + metadata={ + "help": "Use full BF16 precision for evaluation (not just mixed precision). Faster and saves memory." + }, + ) + fp16_full_eval: bool = field( + default=False, + metadata={ + "help": "Use full FP16 precision for evaluation (not just mixed precision). Faster and saves memory." + }, + ) + tf32: bool | None = field( + default=None, + metadata={ + "help": "Enable TF32 mode on Ampere and newer GPUs. Provides up to 8x speedup with negligible accuracy loss." + }, + ) + + # --- Gradient Checkpointing --- + gradient_checkpointing: bool = field( + default=False, + metadata={ + "help": "Enable gradient checkpointing to trade compute for memory. Reduces memory at the cost of ~20% slower training." + }, + ) + gradient_checkpointing_kwargs: dict[str, Any] | str | None = field( + default=None, + metadata={"help": "Keyword arguments passed to `gradient_checkpointing_enable()`."}, + ) + + # --- Compilation --- + torch_compile: bool = field( + default=False, metadata={"help": "Compile the model using `torch.compile()` for faster training."} + ) + torch_compile_backend: str | None = field( + default=None, + metadata={ + "help": "Backend for `torch.compile()`. If set, automatically enables `torch_compile`.", + }, + ) + torch_compile_mode: str | None = field( + default=None, + metadata={ + "help": "Compilation mode for `torch.compile()`. If set, automatically enables `torch_compile`.", + }, + ) + + # --- Kernels --- + use_liger_kernel: bool = field( + default=False, + metadata={ + "help": "Enable Liger Kernel optimizations. Increases throughput by ~20% and reduces memory by ~60%." + }, + ) + liger_kernel_config: dict[str, bool] | None = field( + default=None, + metadata={ + "help": "Configuration for Liger Kernel. Passed as kwargs to `_apply_liger_kernel_to_instance()`. If None, uses default configuration." + }, + ) + + # --- Additional Optimizations --- + use_cache: bool = field( + default=False, + metadata={ + "help": "Whether or not to use cache for the model For training, this is usually not needed apart from some PEFT methods that uses `past_key_values`." + }, + ) + neftune_noise_alpha: float | None = field( + default=None, + metadata={ + "help": "If not None, activates NEFTune noise embeddings. Can drastically improve performance for instruction fine-tuning. Typical range: [5.0, 15.0]." + }, + ) + torch_empty_cache_steps: int | None = field( + default=None, + metadata={ + "help": "Number of steps to wait before calling `torch..empty_cache()`. Helps avoid CUDA OOM at a cost of ~10% slower performance. If None, cache will not be emptied." + }, + ) + auto_find_batch_size: bool = field( + default=False, + metadata={ + "help": "Whether to find a batch size that will fit into memory automatically through exponential decay, avoiding CUDA Out-of-Memory errors." + }, + ) + + # --- Logging & Monitoring --- + logging_strategy: IntervalStrategy | str = field( + default="steps", + metadata={"help": "The logging strategy to adopt during training. Options: 'no', 'epoch', 'steps'."}, + ) + logging_steps: float = field( + default=500, + metadata={ + "help": ( + "Log every X updates steps. Should be an integer or a float in range `[0,1)`. " + "If smaller than 1, will be interpreted as ratio of total training steps." + ) + }, + ) + logging_first_step: bool = field( + default=False, metadata={"help": "Whether to log the first `global_step` or not."} + ) + log_on_each_node: bool = field( + default=True, + metadata={ + "help": ( + "When doing a multinode distributed training, whether to log once per node or just once on the main" + " node." + ) + }, + ) + logging_nan_inf_filter: bool = field( + default=True, + metadata={ + "help": "Filter out NaN and Inf losses when logging. Does not affect gradient computation, only logging." + }, + ) + include_num_input_tokens_seen: str | bool = field( + default="no", + metadata={ + "help": ( + "Whether to track the number of input tokens seen. " + "Must be one of [`all`, `non_padding`, `no`] or a boolean value which map to `all` or `no`" + ) + }, + ) + + # --- Log Levels --- + log_level: str = field( + default="passive", + metadata={ + "help": "Logging level for the main process. Options: 'debug', 'info', 'warning', 'error', 'critical', 'passive'.", + "choices": trainer_log_levels.keys(), + }, + ) + log_level_replica: str = field( + default="warning", + metadata={ + "help": "Logging level for replica processes in distributed training. Same options as `log_level`.", + "choices": trainer_log_levels.keys(), + }, + ) + disable_tqdm: bool | None = field( + default=None, + metadata={"help": "Disable tqdm progress bars. Defaults to True if log_level is warning or lower."}, + ) + + # --- Experiment Tracking --- + report_to: None | str | list[str] = field( + default="none", + metadata={ + "help": "The list of integrations to report the results and logs to. Use 'all' for all installed integrations, 'none' for no integrations." + }, + ) + run_name: str | None = field( + default=None, + metadata={ + "help": ( + "An optional descriptor for the run. Notably used for trackio, wandb, mlflow comet and swanlab " + "logging." + ) + }, + ) + project: str = field( + default="huggingface", + metadata={"help": "The name of the project to use for logging. Currently, only used by Trackio."}, + ) + trackio_space_id: str | None = field( + default="trackio", + metadata={ + "help": "The Hugging Face Space ID to deploy to when using Trackio. Should be a complete Space name like " + "'username/reponame' or 'orgname/reponame', or just 'reponame' in which case the Space will be created in " + "the currently-logged-in Hugging Face user's namespace. If `None`, will log to a local directory. Note " + "that this Space will be public unless you set `hub_private_repo=True` or your organization's " + "default is to create private Spaces." + }, + ) + + # --- Evaluation --- + eval_strategy: IntervalStrategy | str = field( + default="no", + metadata={"help": "When to run evaluation. Options: 'no', 'steps', 'epoch'."}, + ) + eval_steps: float | None = field( + default=None, + metadata={ + "help": ( + "Number of update steps between evaluations if `eval_strategy='steps'`. Defaults to `logging_steps` if not set." + " Should be an integer or a float in range `[0,1)`. If smaller than 1, will be interpreted as ratio of total training steps." + ) + }, + ) + eval_delay: float = field( + default=0, + metadata={ + "help": ( + "Number of epochs or steps to wait for before the first evaluation can be performed, depending on the" + " eval_strategy." + ) + }, + ) + per_device_eval_batch_size: int = field( + default=8, metadata={"help": "The batch size per device (GPU/TPU core/CPU) for evaluation."} + ) + prediction_loss_only: bool = field( + default=False, + metadata={"help": "When performing evaluation and generating predictions, only returns the loss."}, + ) + eval_on_start: bool = field( + default=False, + metadata={ + "help": "Whether to run through the entire `evaluation` step at the very beginning of training as a sanity check." + }, + ) + eval_do_concat_batches: bool = field( + default=True, + metadata={ + "help": "Whether to recursively concat inputs/losses/labels/predictions across batches. If `False`, will instead store them as lists, with each batch kept separate." + }, + ) + eval_use_gather_object: bool = field( + default=False, + metadata={ + "help": "Whether to run recursively gather object in a nested list/tuple/dictionary of objects from all devices." + }, + ) + eval_accumulation_steps: int | None = field( + default=None, + metadata={ + "help": "Number of predictions steps to accumulate the output tensors for, before moving the results to the CPU. If unset, predictions are accumulated on the accelerator before being moved to the CPU." + }, + ) + + # --- Metrics --- + include_for_metrics: list[str] = field( + default_factory=list, + metadata={"help": "Include additional data in the `compute_metrics` function. Options: 'inputs', 'loss'."}, + ) + batch_eval_metrics: bool = field( + default=False, + metadata={"help": "Break eval metrics calculation into batches to save memory."}, + ) + + # --- Checkpointing & Saving --- + save_only_model: bool = field( + default=False, + metadata={ + "help": "Save only model weights, not optimizer/scheduler/RNG state. Prevents resuming training from checkpoint." + }, + ) + save_strategy: SaveStrategy | str = field( + default="steps", + metadata={ + "help": "The checkpoint save strategy to adopt during training. Options: 'no', 'epoch', 'steps', 'best'." + }, + ) + save_steps: float = field( + default=500, + metadata={ + "help": ( + "Save checkpoint every X updates steps. Should be an integer or a float in range `[0,1)`. " + "If smaller than 1, will be interpreted as ratio of total training steps." + ) + }, + ) + save_on_each_node: bool = field( + default=False, + metadata={ + "help": ( + "When doing multi-node distributed training, whether to save models and checkpoints on each node, or" + " only on the main one" + ) + }, + ) + save_total_limit: int | None = field( + default=None, + metadata={ + "help": "Maximum number of checkpoints to keep. Deletes older checkpoints in `output_dir`. The best checkpoint is always retained when `load_best_model_at_end=True`." + }, + ) + enable_jit_checkpoint: bool = field( + default=False, + metadata={ + "help": "Enable JIT checkpointing on SIGTERM signal for graceful termination on preemptible workloads. Configure your orchestrator's graceful shutdown period accordingly." + }, + ) + + # --- Hub Integration --- + push_to_hub: bool = field( + default=False, metadata={"help": "Whether or not to push the model to the Hub every time the model is saved."} + ) + hub_token: str | None = field( + default=None, + metadata={ + "help": "The token to use to push the model to the Hub. Defaults to the token from `hf auth login`." + }, + ) + hub_private_repo: bool | None = field( + default=None, + metadata={ + "help": "Whether to make the repo private. If `None` (default), the repo will be public unless the " + "organization's default is private. This value is ignored if the repo already exists. If reporting to " + "Trackio with deployment to Hugging Face Spaces enabled, the same logic determines whether the Space is " + "private." + }, + ) + hub_model_id: str | None = field( + default=None, metadata={"help": "The name of the repository to keep in sync with the local `output_dir`."} + ) + hub_strategy: HubStrategy | str = field( + default="every_save", + metadata={ + "help": "Defines what and when to push to Hub. Options: 'end', 'every_save', 'checkpoint', 'all_checkpoints'." + }, + ) + hub_always_push: bool = field( + default=False, + metadata={"help": "Unless `True`, the Trainer will skip pushes if the previous one wasn't finished yet."}, + ) + hub_revision: str | None = field( + default=None, + metadata={ + "help": "The revision to use when pushing to the Hub. Can be a branch name, a tag, or a commit hash." + }, + ) + + # --- Best Model Tracking --- + load_best_model_at_end: bool = field( + default=False, + metadata={"help": "Load the best checkpoint at the end of training. Requires `eval_strategy` to be set."}, + ) + metric_for_best_model: str | None = field( + default=None, + metadata={ + "help": "Metric to use for comparing models when `load_best_model_at_end=True`. Defaults to 'loss'." + }, + ) + greater_is_better: bool | None = field( + default=None, + metadata={"help": "Whether higher metric values are better. Defaults based on `metric_for_best_model`."}, + ) + + # --- Resuming Training --- + ignore_data_skip: bool = field( + default=False, + metadata={ + "help": "When resuming training, skip fast-forwarding through the dataset to reach the previous state. If True, training starts from the beginning of the dataset." + }, + ) + restore_callback_states_from_checkpoint: bool = field( + default=False, + metadata={ + "help": "Whether to restore the callback states from the checkpoint. If `True`, will override callbacks passed to the `Trainer` if they exist in the checkpoint." + }, + ) + + # --- Reproducibility --- + full_determinism: bool = field( + default=False, + metadata={ + "help": ( + "Whether to call enable_full_determinism instead of set_seed for reproducibility in distributed" + " training. Important: this will negatively impact the performance, so only use it for debugging." + ) + }, + ) + seed: int = field(default=42, metadata={"help": "Random seed that will be set at the beginning of training."}) + data_seed: int | None = field( + default=None, + metadata={"help": "Random seed to be used with data samplers. If not set, uses the same seed as `seed`."}, + ) + + # --- Hardware --- + use_cpu: bool = field( + default=False, + metadata={ + "help": "Whether or not to use cpu. If set to False, we will use the available torch device/backend." + }, + ) + + # --- Accelerate --- + accelerator_config: dict | str | None = field( + default=None, + metadata={ + "help": "Configuration for the internal Accelerate integration. Can be a path to a JSON config file or a dict." + }, + ) + parallelism_config: ParallelismConfig | None = field( + default=None, + metadata={"help": "Parallelism configuration for the training run. Requires Accelerate `1.10.1`."}, + ) + + # --- Dataloader --- + dataloader_drop_last: bool = field( + default=False, metadata={"help": "Drop the last incomplete batch if it is not divisible by the batch size."} + ) + dataloader_num_workers: int = field( + default=0, + metadata={ + "help": ( + "Number of subprocesses to use for data loading (PyTorch only). 0 means that the data will be loaded" + " in the main process." + ) + }, + ) + dataloader_pin_memory: bool = field( + default=True, metadata={"help": "Whether or not to pin memory for DataLoader."} + ) + dataloader_persistent_workers: bool = field( + default=False, + metadata={ + "help": "If True, the data loader will not shut down the worker processes after a dataset has been consumed once. This allows to maintain the workers Dataset instances alive. Can potentially speed up training, but will increase RAM usage." + }, + ) + dataloader_prefetch_factor: int | None = field( + default=None, + metadata={ + "help": ( + "Number of batches loaded in advance by each worker. " + "2 means there will be a total of 2 * num_workers batches prefetched across all workers. " + ) + }, + ) + remove_unused_columns: bool = field( + default=True, + metadata={"help": "Whether or not to automatically remove the columns unused by the model forward method."}, + ) + label_names: list[str] | None = field( + default=None, metadata={"help": "The list of keys in your dictionary of inputs that correspond to the labels."} + ) + train_sampling_strategy: str = field( + default="random", + metadata={ + "help": "Sampler for training: 'random' (default), 'sequential', or 'group_by_length'.", + "choices": ["random", "sequential", "group_by_length"], + }, + ) + length_column_name: str = field( + default="length", + metadata={ + "help": "Column name for precomputed lengths. Ignored unless `train_sampling_strategy` is 'group_by_length'." + }, + ) + + # --- DDP --- + ddp_find_unused_parameters: bool | None = field( + default=None, + metadata={ + "help": ( + "When using distributed training, the value of the flag `find_unused_parameters` passed to " + "`DistributedDataParallel`." + ) + }, + ) + ddp_bucket_cap_mb: int | None = field( + default=None, + metadata={ + "help": ( + "When using distributed training, the value of the flag `bucket_cap_mb` passed to " + "`DistributedDataParallel`." + ) + }, + ) + ddp_broadcast_buffers: bool | None = field( + default=None, + metadata={ + "help": ( + "When using distributed training, the value of the flag `broadcast_buffers` passed to " + "`DistributedDataParallel`." + ) + }, + ) + ddp_backend: str | None = field( + default=None, + metadata={ + "help": "The backend to use for distributed training. Must be one of 'nccl', 'mpi', 'xccl', 'gloo', 'hccl'.", + "choices": ["nccl", "gloo", "mpi", "xccl", "hccl", "cncl", "mccl"], + }, + ) + ddp_timeout: int = field( + default=1800, + metadata={"help": "The timeout for `torch.distributed.init_process_group` calls (in seconds)."}, + ) + + # --- FSDP --- + fsdp: list[FSDPOption] | str | None = field( + default=None, + metadata={ + "help": "Enable PyTorch FSDP for distributed training. Options: 'full_shard', 'shard_grad_op', 'hybrid_shard', 'hybrid_shard_zero2', 'offload', 'auto_wrap'.", + }, + ) + fsdp_config: dict[str, Any] | str | None = field( + default=None, + metadata={ + "help": ( + "Config to be used with FSDP (Pytorch Fully Sharded Data Parallel). The value is either a " + "fsdp json config file (e.g., `fsdp_config.json`) or an already loaded json file as `dict`." + ) + }, + ) + + # --- DeepSpeed --- + deepspeed: dict | str | None = field( + default=None, + metadata={"help": "Enable DeepSpeed integration. Value is a path to a JSON config file or a dict."}, + ) + + # --- Debugging --- + debug: str | list[DebugOption] = field( + default="", + metadata={ + "help": "Enable one or more debug features. Options: 'underflow_overflow' (detect overflow in model I/O), 'tpu_metrics_debug' (print TPU metrics)." + }, + ) + skip_memory_metrics: bool = field( + default=True, + metadata={ + "help": "Whether to skip adding memory profiler reports to metrics. Skipped by default because it slows down training." + }, + ) + + # --- External Script Flags --- + do_train: bool = field( + default=False, + metadata={ + "help": "Whether to run training. Not directly used by Trainer; intended for training/evaluation scripts." + }, + ) + do_eval: bool = field( + default=False, + metadata={ + "help": "Whether to run evaluation. Not directly used by Trainer; intended for training/evaluation scripts." + }, + ) + do_predict: bool = field( + default=False, + metadata={ + "help": "Whether to run predictions on the test set. Not directly used by Trainer; intended for training/evaluation scripts." + }, + ) + resume_from_checkpoint: str | None = field( + default=None, + metadata={ + "help": "Path to a folder with a valid checkpoint for your model. Not directly used by Trainer; intended for training/evaluation scripts." + }, + ) + + # --- Deprecated / Internal --- + warmup_ratio: float | None = field( + default=None, + metadata={ + "help": "This argument is deprecated and will be removed in v5.2. Use `warmup_steps` instead as it also works with float values." + }, + ) + logging_dir: str | None = field( + default=None, + metadata={ + "help": "Deprecated and will be removed in v5.2. Set env var `TENSORBOARD_LOGGING_DIR` instead. TensorBoard log directory." + }, + ) + local_rank: int = field( + default=-1, + metadata={ + "help": "When using torch.distributed.launch (Deprecated), it will pass `local_rank` in the script, so we need this for the parser. To get the local rank, prefer using the property `local_process_index`" + }, + ) + + def __post_init__(self): + # ── 1. Defaults & Normalization ── + if self.output_dir is None: + self.output_dir = "trainer_output" + logger.info( + "No output directory specified, defaulting to 'trainer_output'. " + "To change this behavior, specify --output_dir when creating TrainingArguments." + ) + + # Parse JSON string dict args from CLI (e.g., '{"key": "value"}'). + # Only parses strings starting with '{'; other strings are treated as file paths. + for valid_field in self._VALID_DICT_FIELDS: + passed_value = getattr(self, valid_field) + if isinstance(passed_value, str) and passed_value.startswith("{"): + loaded_dict = json.loads(passed_value) + loaded_dict = _convert_str_dict(loaded_dict) + setattr(self, valid_field, loaded_dict) + + # Expand ~ in paths so os.makedirs works correctly (#10628) + if self.output_dir is not None: + self.output_dir = os.path.expanduser(self.output_dir) + + if self.disable_tqdm is None: + self.disable_tqdm = logger.getEffectiveLevel() > logging.WARN + + if self.warmup_ratio is not None: + logger.warning("warmup_ratio is deprecated and will be removed in v5.2. Use `warmup_steps` instead.") + self.warmup_steps = self.warmup_ratio + + if self.logging_dir is not None: + logger.warning( + "`logging_dir` is deprecated and will be removed in v5.2. Please set `TENSORBOARD_LOGGING_DIR` instead." + ) + + if isinstance(self.include_num_input_tokens_seen, bool): + self.include_num_input_tokens_seen = "all" if self.include_num_input_tokens_seen else "no" + + # ── 2. Enum / Type Conversions ── + self.eval_strategy = IntervalStrategy(self.eval_strategy) + self.logging_strategy = IntervalStrategy(self.logging_strategy) + self.save_strategy = SaveStrategy(self.save_strategy) + self.hub_strategy = HubStrategy(self.hub_strategy) + self.lr_scheduler_type = SchedulerType(self.lr_scheduler_type) + self.optim = OptimizerNames(self.optim) + + if isinstance(self.debug, str): + self.debug = [DebugOption(s) for s in self.debug.split()] + elif self.debug is None: + self.debug = [] + + # ── 3. Auto-derived Values ── + if self.do_eval is False and self.eval_strategy != IntervalStrategy.NO: + self.do_eval = True + + # Fall back to logging_steps if eval_steps is unset + if self.eval_strategy == IntervalStrategy.STEPS and (self.eval_steps is None or self.eval_steps == 0): + if self.logging_steps > 0: + logger.info(f"using `logging_steps` to initialize `eval_steps` to {self.logging_steps}") + self.eval_steps = self.logging_steps + else: + raise ValueError( + f"evaluation strategy {self.eval_strategy} requires either non-zero --eval_steps or" + " --logging_steps" + ) + + if ( + self.load_best_model_at_end or self.lr_scheduler_type == SchedulerType.REDUCE_ON_PLATEAU + ) and self.metric_for_best_model is None: + self.metric_for_best_model = "loss" + if self.greater_is_better is None and self.metric_for_best_model is not None: + self.greater_is_better = not self.metric_for_best_model.endswith("loss") + + if self.report_to == "none" or self.report_to == ["none"]: + self.report_to = [] + elif not isinstance(self.report_to, list): + self.report_to = [self.report_to] + + # ── 4. Validation ── + self._validate_args() + + # ── 5. Mixed Precision ── + # Read from env first; DeepSpeed may override this later + self.mixed_precision = os.environ.get("ACCELERATE_MIXED_PRECISION", "no") + if self.fp16: + self.mixed_precision = "fp16" + elif self.bf16: + self.mixed_precision = "bf16" + + # ── 6. Torch Compile ── + if (self.torch_compile_mode is not None or self.torch_compile_backend is not None) and not self.torch_compile: + self.torch_compile = True + if self.torch_compile and self.torch_compile_backend is None: + if not self.use_cpu and is_torch_hpu_available(): + self.torch_compile_backend = "hpu_backend" + else: + self.torch_compile_backend = "inductor" + + if self.torch_compile: + # TODO: remove env var fallback once minimum accelerate >= 1.2.0 + if not is_accelerate_available("1.2.0"): + os.environ["ACCELERATE_DYNAMO_BACKEND"] = self.torch_compile_backend + if self.torch_compile_mode is not None: + os.environ["ACCELERATE_DYNAMO_MODE"] = self.torch_compile_mode + + # ── 7. Accelerator Config (must come before self.device) ── + if is_accelerate_available(): + if not isinstance(self.accelerator_config, AcceleratorConfig): + if self.accelerator_config is None: + self.accelerator_config = AcceleratorConfig() + elif isinstance(self.accelerator_config, dict): + self.accelerator_config = AcceleratorConfig(**self.accelerator_config) + # Reject uninstantiated class (e.g. AcceleratorConfig instead of AcceleratorConfig()) + elif isinstance(self.accelerator_config, type): + raise NotImplementedError( + "Tried passing in a callable to `accelerator_config`, but this is not supported. " + "Please pass in a fully constructed `AcceleratorConfig` object instead." + ) + else: + self.accelerator_config = AcceleratorConfig.from_json_file(self.accelerator_config) + if self.accelerator_config.split_batches: + logger.info( + "Using `split_batches=True` in `accelerator_config` will override the `per_device_train_batch_size` " + "Batches will be split across all processes equally when using `split_batches=True`." + ) + + # ── 8. Device Init ── + if is_torch_available(): + self.device + + # ── 9. TF32 ── + if is_torch_available() and self.torch_compile: + if is_torch_tf32_available(): + if self.tf32 is None and not self.fp16 or self.bf16: + device_str = "MUSA" if is_torch_musa_available() else "CUDA" + logger.info( + f"Setting TF32 in {device_str} backends to speedup torch compile, you won't see any improvement" + " otherwise." + ) + enable_tf32(True) + else: + logger.warning( + "The speedups for torchdynamo mostly come with GPU Ampere or higher and which is not detected here." + ) + if is_torch_available() and self.tf32 is not None: + if self.tf32: + if is_torch_tf32_available(): + enable_tf32(True) + else: + raise ValueError("--tf32 requires Ampere or a newer GPU arch, cuda>=11 and torch>=1.7") + else: + if is_torch_tf32_available(): + enable_tf32(False) + # TF32 not available, nothing to disable + + # ── 10. Hardware Overrides ── + if self.use_cpu: + self.dataloader_pin_memory = False + + # ── 11. FSDP ── + # Store args only (not the plugin itself) to avoid pickle issues + self.fsdp_plugin_args = self._process_fsdp_args() + + # ── 12. DeepSpeed (must be last) ── + self.deepspeed_plugin = None + if self.deepspeed: + from transformers.integrations.deepspeed import HfTrainerDeepSpeedConfig + + # Leave self.deepspeed unmodified; users may rely on the original value + self.hf_deepspeed_config = HfTrainerDeepSpeedConfig(self.deepspeed) + self.hf_deepspeed_config.trainer_config_process(self) + + from accelerate.utils import DeepSpeedPlugin + + self.deepspeed_plugin = DeepSpeedPlugin(hf_ds_config=self.hf_deepspeed_config) + elif strtobool(os.environ.get("ACCELERATE_USE_DEEPSPEED", "false")): + from accelerate.utils import DeepSpeedPlugin + + self.deepspeed_plugin = DeepSpeedPlugin() + self.deepspeed_plugin.set_mixed_precision(self.mixed_precision) + self.deepspeed_plugin.set_deepspeed_weakref() + + def _validate_args(self): + """Validate argument combinations and value constraints.""" + if self.torch_empty_cache_steps is not None: + if not (isinstance(self.torch_empty_cache_steps, int) and self.torch_empty_cache_steps > 0): + raise ValueError( + f"`torch_empty_cache_steps` must be an integer bigger than 0, got {self.torch_empty_cache_steps}." + ) + + # logging_steps must be non-zero when logging_strategy="steps" + if self.logging_strategy == IntervalStrategy.STEPS and self.logging_steps == 0: + raise ValueError(f"logging strategy {self.logging_strategy} requires non-zero --logging_steps") + + if self.logging_strategy == IntervalStrategy.STEPS and self.logging_steps > 1: + if self.logging_steps != int(self.logging_steps): + raise ValueError(f"--logging_steps must be an integer if bigger than 1: {self.logging_steps}") + self.logging_steps = int(self.logging_steps) + if self.eval_strategy == IntervalStrategy.STEPS and self.eval_steps > 1: + if self.eval_steps != int(self.eval_steps): + raise ValueError(f"--eval_steps must be an integer if bigger than 1: {self.eval_steps}") + self.eval_steps = int(self.eval_steps) + if self.save_strategy == SaveStrategy.STEPS and self.save_steps > 1: + if self.save_steps != int(self.save_steps): + raise ValueError(f"--save_steps must be an integer if bigger than 1: {self.save_steps}") + self.save_steps = int(self.save_steps) + + # load_best_model_at_end requires compatible save and eval strategies + if self.load_best_model_at_end and self.save_strategy != SaveStrategy.BEST: + if self.eval_strategy != self.save_strategy: + raise ValueError( + "--load_best_model_at_end requires the save and eval strategy to match, but found\n- Evaluation " + f"strategy: {self.eval_strategy}\n- Save strategy: {self.save_strategy}" + ) + if self.eval_strategy == IntervalStrategy.STEPS and self.save_steps % self.eval_steps != 0: + if self.eval_steps < 1 or self.save_steps < 1: + if not (self.eval_steps < 1 and self.save_steps < 1): + raise ValueError( + "--load_best_model_at_end requires the saving steps to be a multiple of the evaluation " + "steps, which cannot get guaranteed when mixing ratio and absolute steps for save_steps " + f"{self.save_steps} and eval_steps {self.eval_steps}." + ) + # Use integer arithmetic to avoid floating point precision issues + LARGE_MULTIPLIER = 1_000_000 + if (self.save_steps * LARGE_MULTIPLIER) % (self.eval_steps * LARGE_MULTIPLIER) != 0: + raise ValueError( + "--load_best_model_at_end requires the saving steps to be a multiple of the evaluation " + f"steps, but found {self.save_steps}, which is not a multiple of {self.eval_steps}." + ) + else: + raise ValueError( + "--load_best_model_at_end requires the saving steps to be a round multiple of the evaluation " + f"steps, but found {self.save_steps}, which is not a round multiple of {self.eval_steps}." + ) + + if is_torch_available(): + if self.bf16 or self.bf16_full_eval: + if not self.use_cpu and not is_torch_bf16_gpu_available() and not is_torch_xla_available(): + error_message = "Your setup doesn't support bf16/gpu. You need to assign use_cpu if you want to train the model on CPU." + if is_torch_cuda_available(): + error_message += " You need Ampere+ GPU with cuda>=11.0." + raise ValueError(error_message) + + if self.fp16 and self.bf16: + raise ValueError("At most one of fp16 and bf16 can be True, but not both") + + if self.fp16_full_eval and self.bf16_full_eval: + raise ValueError("At most one of fp16 and bf16 can be True for full eval, but not both") + + if self.lr_scheduler_type == SchedulerType.REDUCE_ON_PLATEAU: + if self.eval_strategy == IntervalStrategy.NO: + raise ValueError("lr_scheduler_type reduce_lr_on_plateau requires an eval strategy") + if not is_torch_available(): + raise ValueError("lr_scheduler_type reduce_lr_on_plateau requires torch>=0.2.0") + + if self.warmup_steps < 0: + raise ValueError("warmup_steps must be an integer or a float") + + if self.dataloader_num_workers == 0 and self.dataloader_prefetch_factor is not None: + raise ValueError( + "--dataloader_prefetch_factor can only be set when data is loaded in a different process, i.e." + " when --dataloader_num_workers > 0." + ) + + def __str__(self): + self_as_dict = asdict(self) + + self_as_dict = {k: f"<{k.upper()}>" if k.endswith("_token") else v for k, v in self_as_dict.items()} + + attrs_as_str = [f"{k}={v},\n" for k, v in sorted(self_as_dict.items())] + return f"{self.__class__.__name__}(\n{''.join(attrs_as_str)})" + + __repr__ = __str__ + + @property + def train_batch_size(self) -> int: + """ + The actual batch size for training. + """ + train_batch_size = self.per_device_train_batch_size * max(1, self.n_gpu) + return train_batch_size + + @property + def eval_batch_size(self) -> int: + """ + The actual batch size for evaluation. + """ + eval_batch_size = self.per_device_eval_batch_size * max(1, self.n_gpu) + return eval_batch_size + + @property + def ddp_timeout_delta(self) -> timedelta: + """ + The actual timeout for torch.distributed.init_process_group since it expects a timedelta variable. + """ + return timedelta(seconds=self.ddp_timeout) + + @cached_property + def _setup_devices(self) -> "torch.device": + requires_backends(self, ["torch"]) + logger.info("PyTorch: setting up devices") + if not is_sagemaker_mp_enabled(): + if not is_accelerate_available(): + raise ImportError( + f"Using the `Trainer` with `PyTorch` requires `accelerate>={ACCELERATE_MIN_VERSION}`: " + f"Please run `pip install transformers[torch]` or `pip install 'accelerate>={ACCELERATE_MIN_VERSION}'`" + ) + # Build kwargs for PartialState; actual init happens below + accelerator_state_kwargs: dict[str, Any] = {"enabled": True, "use_configured_state": False} + if isinstance(self.accelerator_config, AcceleratorConfig): + accelerator_state_kwargs["use_configured_state"] = self.accelerator_config.pop( + "use_configured_state", False + ) + if accelerator_state_kwargs["use_configured_state"]: + if PartialState._shared_state == {}: + raise ValueError( + "Passing `'use_configured_state':True` to the AcceleratorConfig requires a pre-configured " + "`AcceleratorState` or `PartialState` to be defined before calling `TrainingArguments`. " + ) + self.distributed_state = PartialState(cpu=self.use_cpu) + if self.deepspeed and self.distributed_state.distributed_type != DistributedType.DEEPSPEED: + raise RuntimeError( + "Tried to use an already configured `Accelerator` or `PartialState` that was not initialized for DeepSpeed, " + "but also passed in a `deepspeed` configuration to the `TrainingArguments`. Please set " + "`use_configured_state:False` instead or setup your `Accelerator` or `PartialState` properly." + ) + else: + AcceleratorState._reset_state(reset_partial_state=True) + self.distributed_state = None + + self._n_gpu = 1 + if self.use_cpu or strtobool(os.environ.get("ACCELERATE_USE_CPU", "False")): + accelerator_state_kwargs["cpu"] = True + accelerator_state_kwargs["backend"] = self.ddp_backend + self._n_gpu = 0 + elif is_sagemaker_mp_enabled(): + accelerator_state_kwargs["enabled"] = False + device = torch.device("cuda", smp.local_rank()) + torch.cuda.set_device(device) + elif is_sagemaker_dp_enabled(): + accelerator_state_kwargs["_use_sagemaker_dp"] = True + elif self.deepspeed: + accelerator_state_kwargs["use_deepspeed"] = True + accelerator_state_kwargs["timeout"] = timedelta(seconds=self.ddp_timeout) + else: + accelerator_state_kwargs["backend"] = self.ddp_backend + accelerator_state_kwargs["timeout"] = timedelta(seconds=self.ddp_timeout) + + # Initialize PartialState with the accumulated kwargs + if accelerator_state_kwargs.pop("enabled", False) and not accelerator_state_kwargs.pop( + "use_configured_state", False + ): + # Temporarily set env var so Accelerate detects DeepSpeed + use_deepspeed = accelerator_state_kwargs.pop("use_deepspeed", False) + if use_deepspeed: + os.environ["ACCELERATE_USE_DEEPSPEED"] = "true" + self.distributed_state = PartialState(**accelerator_state_kwargs) + if use_deepspeed: + del os.environ["ACCELERATE_USE_DEEPSPEED"] + if not is_sagemaker_mp_enabled(): + device = self.distributed_state.device + if dist.is_available() and dist.is_initialized() and self.parallel_mode != ParallelMode.DISTRIBUTED: + logger.warning( + "torch.distributed process group is initialized, but parallel_mode != ParallelMode.DISTRIBUTED. " + "In order to use Torch DDP, launch your script with `python -m torch.distributed.launch" + ) + if is_torch_xla_available(): + device = self.distributed_state.device + self._n_gpu = 0 + elif is_sagemaker_dp_enabled() or is_sagemaker_mp_enabled(): + pass # _n_gpu already set above + elif self.distributed_state.distributed_type == DistributedType.NO: + if self.use_cpu: + device = torch.device("cpu") + elif is_torch_mps_available(): + device = torch.device("mps") + elif is_torch_xpu_available(): + device = torch.device("xpu:0") + torch.xpu.set_device(device) + elif is_torch_mlu_available(): + device = torch.device("mlu:0") + torch.mlu.set_device(device) + elif is_torch_musa_available(): + device = torch.device("musa:0") + torch.musa.set_device(device) + elif is_torch_npu_available(): + device = torch.device("npu:0") + torch.npu.set_device(device) + elif is_torch_hpu_available(): + device = torch.device("hpu:0") + torch.hpu.set_device(device) + else: + # Default to cuda:0 (respects CUDA_VISIBLE_DEVICES); nn.DataParallel handles n_gpu > 1 + device = torch.device( + "cuda:0" if torch.cuda.is_available() else os.environ.get("ACCELERATE_TORCH_DEVICE", "cpu") + ) + # _n_gpu may not have been set yet if _setup_devices is called early + self._n_gpu = torch.cuda.device_count() + if device.type == "cuda": + torch.cuda.set_device(device) + return device + + @property + def device(self) -> "torch.device": + """ + The device used by this process. + """ + requires_backends(self, ["torch"]) + return self._setup_devices + + @property + def n_gpu(self): + """ + The number of GPUs used by this process. + + Note: + This will only be greater than one when you have multiple GPUs available but are not using distributed + training. For distributed training, it will always be 1. + """ + requires_backends(self, ["torch"]) + # Ensure _setup_devices has been called + if not hasattr(self, "_n_gpu"): + _ = self._setup_devices + return self._n_gpu + + @property + def parallel_mode(self): + """ + The current mode used for parallelism if multiple GPUs/TPU cores are available. One of: + + - `ParallelMode.NOT_PARALLEL`: no parallelism (CPU or one GPU). + - `ParallelMode.NOT_DISTRIBUTED`: several GPUs in one single process (uses `torch.nn.DataParallel`). + - `ParallelMode.DISTRIBUTED`: several GPUs, each having its own process (uses + `torch.nn.DistributedDataParallel`). + - `ParallelMode.TPU`: several TPU cores. + """ + requires_backends(self, ["torch"]) + if is_torch_xla_available(): + return ParallelMode.TPU + elif is_sagemaker_mp_enabled(): + return ParallelMode.SAGEMAKER_MODEL_PARALLEL + elif is_sagemaker_dp_enabled(): + return ParallelMode.SAGEMAKER_DATA_PARALLEL + elif self.distributed_state is not None and self.distributed_state.distributed_type != DistributedType.NO: + return ParallelMode.DISTRIBUTED + elif self.n_gpu > 1: + return ParallelMode.NOT_DISTRIBUTED + else: + return ParallelMode.NOT_PARALLEL + + @property + def world_size(self): + """ + The number of processes used in parallel. + """ + requires_backends(self, ["torch"]) + if self.distributed_state is not None: + return self.distributed_state.num_processes + elif is_sagemaker_mp_enabled(): + return smp.dp_size() if not smp.state.cfg.prescaled_batch else smp.rdp_size() + return 1 + + @property + def process_index(self): + """ + The index of the current process used. + """ + requires_backends(self, ["torch"]) + if self.distributed_state is not None: + return self.distributed_state.process_index + elif is_sagemaker_mp_enabled(): + return smp.dp_rank() if not smp.state.cfg.prescaled_batch else smp.rdp_rank() + return 0 + + @property + def local_process_index(self): + """ + The index of the local process used. + """ + requires_backends(self, ["torch"]) + + if self.distributed_state is not None: + return self.distributed_state.local_process_index + elif is_sagemaker_mp_enabled(): + return smp.local_rank() + return 0 + + @property + def should_log(self): + """ + Whether or not the current process should produce log. + """ + if self.log_on_each_node: + return self.local_process_index == 0 + else: + if is_sagemaker_mp_enabled(): + return smp.rank() == 0 + else: + return self.process_index == 0 + + @property + def should_save(self): + """ + Whether or not the current process should write to disk, e.g., to save models and checkpoints. + """ + if self.save_on_each_node: + return self.local_process_index == 0 + else: + if is_sagemaker_mp_enabled(): + return smp.rank() == 0 + else: + return self.process_index == 0 + + def get_process_log_level(self): + """ + Returns the log level to be used depending on whether this process is the main process of node 0, main process + of node non-0, or a non-main process. + + For the main process the log level defaults to the logging level set (`logging.WARNING` if you didn't do + anything) unless overridden by `log_level` argument. + + For the replica processes the log level defaults to `logging.WARNING` unless overridden by `log_level_replica` + argument. + + The choice between the main and replica process settings is made according to the return value of `should_log`. + """ + + # convert to int + log_level = trainer_log_levels[self.log_level] + log_level_replica = trainer_log_levels[self.log_level_replica] + + log_level_main_node = logging.get_verbosity() if log_level == -1 else log_level + log_level_replica_node = logging.get_verbosity() if log_level_replica == -1 else log_level_replica + return log_level_main_node if self.should_log else log_level_replica_node + + @property + def place_model_on_device(self) -> bool | None: + """ + Can be subclassed and overridden for some specific integrations. + """ + return None + + @property + def _no_sync_in_gradient_accumulation(self): + """ + Whether or not to use no_sync for the gradients when doing gradient accumulation. + """ + return not ( + self.deepspeed or is_sagemaker_dp_enabled() or is_sagemaker_mp_enabled() or is_torch_neuroncore_available() + ) + + @contextlib.contextmanager + def main_process_first(self, local=True, desc="work"): + """ + A context manager for torch distributed environment where on needs to do something on the main process, while + blocking replicas, and when it's finished releasing the replicas. + + One such use is for `datasets`'s `map` feature which to be efficient should be run once on the main process, + which upon completion saves a cached version of results and which then automatically gets loaded by the + replicas. + + Args: + local (`bool`, *optional*, defaults to `True`): + if `True` first means process of rank 0 of each node if `False` first means process of rank 0 of node + rank 0 In multi-node environment with a shared filesystem you most likely will want to use + `local=False` so that only the main process of the first node will do the processing. If however, the + filesystem is not shared, then the main process of each node will need to do the processing, which is + the default behavior. + desc (`str`, *optional*, defaults to `"work"`): + a work description to be used in debug logs + + """ + if is_torch_available() and self.world_size > 1: + main_process_desc = "main local process" if local else "main process" + if self.distributed_state is not None: + is_main_process = ( + self.distributed_state.is_local_main_process if local else self.distributed_state.is_main_process + ) + elif is_sagemaker_mp_enabled(): + is_main_process = smp.rank() == 0 + + try: + if not is_main_process: + # tell all replicas to wait + logger.debug(f"{self.process_index}: waiting for the {main_process_desc} to perform {desc}") + + if is_torch_xla_available(): + xm.rendezvous(desc) + else: + dist.barrier() + yield + finally: + if is_main_process: + # the wait is over + logger.debug(f"{self.process_index}: {main_process_desc} completed {desc}, releasing all replicas") + if is_torch_xla_available(): + xm.rendezvous(desc) + else: + dist.barrier() + else: + yield + + def get_warmup_steps(self, num_training_steps: int): + """ + Get number of steps used for a linear warmup. + """ + warmup_steps = ( + int(self.warmup_steps) if self.warmup_steps >= 1 else math.ceil(num_training_steps * self.warmup_steps) + ) + return warmup_steps + + def _dict_dtype_to_str(self, d: dict[str, Any]) -> None: + """ + Checks whether the passed dictionary and its nested dicts have a *dtype* key and if it's not None, + converts torch.dtype to a string of just the type. For example, `torch.float32` get converted into *"float32"* + string, which can then be stored in the json format. + """ + if d.get("dtype") is not None and not isinstance(d["dtype"], str): + d["dtype"] = str(d["dtype"]).split(".")[1] + for value in d.values(): + if isinstance(value, dict): + self._dict_dtype_to_str(value) + + def to_dict(self): + """ + Serializes this instance while replace `Enum` by their values (for JSON serialization support). It obfuscates + the token values by removing their value. + """ + # Exclude non-init fields (they aren't user-facing config) + d = {field.name: getattr(self, field.name) for field in fields(self) if field.init} + + for k, v in d.items(): + if isinstance(v, Enum): + d[k] = v.value + if isinstance(v, list) and len(v) > 0 and isinstance(v[0], Enum): + d[k] = [x.value for x in v] + if k.endswith("_token"): + d[k] = f"<{k.upper()}>" + # Serialize AcceleratorConfig to dict + if is_accelerate_available() and isinstance(v, AcceleratorConfig): + d[k] = v.to_dict() + # Serialize quantization_config if nested inside model_init_kwargs + if k == "model_init_kwargs" and isinstance(v, dict) and "quantization_config" in v: + quantization_config = v.get("quantization_config") + if quantization_config and not isinstance(quantization_config, dict): + d[k]["quantization_config"] = quantization_config.to_dict() + if k == "parallelism_config" and v is not None: + d[k] = v.to_json() + + self._dict_dtype_to_str(d) + + return d + + def to_json_string(self): + """ + Serializes this instance to a JSON string. + """ + return json.dumps(self.to_dict(), indent=2) + + def to_sanitized_dict(self) -> dict[str, Any]: + """ + Sanitized serialization to use with TensorBoard's hparams + """ + d = self.to_dict() + d = {**d, "train_batch_size": self.train_batch_size, "eval_batch_size": self.eval_batch_size} + + valid_types = [bool, int, float, str] + if is_torch_available(): + valid_types.append(torch.Tensor) + + return {k: v if type(v) in valid_types else str(v) for k, v in d.items()} + + # Convenience setters for grouped configuration + def set_training( + self, + learning_rate: float = 5e-5, + batch_size: int = 8, + weight_decay: float = 0, + num_epochs: float = 3, + max_steps: int = -1, + gradient_accumulation_steps: int = 1, + seed: int = 42, + gradient_checkpointing: bool = False, + ): + """ + A method that regroups all basic arguments linked to the training. + + + + Calling this method will automatically set `self.do_train` to `True`. + + + + Args: + learning_rate (`float`, *optional*, defaults to 5e-5): + The initial learning rate for the optimizer. + batch_size (`int` *optional*, defaults to 8): + The batch size per device (GPU/TPU core/CPU...) used for training. + weight_decay (`float`, *optional*, defaults to 0): + The weight decay to apply (if not zero) to all layers except all bias and LayerNorm weights in the + optimizer. + num_train_epochs(`float`, *optional*, defaults to 3.0): + Total number of training epochs to perform (if not an integer, will perform the decimal part percents + of the last epoch before stopping training). + max_steps (`int`, *optional*, defaults to -1): + If set to a positive number, the total number of training steps to perform. Overrides `num_train_epochs`. + For a finite dataset, training is reiterated through the dataset (if all data is exhausted) until + `max_steps` is reached. + gradient_accumulation_steps (`int`, *optional*, defaults to 1): + Number of updates steps to accumulate the gradients for, before performing a backward/update pass. + + + + When using gradient accumulation, one step is counted as one step with backward pass. Therefore, + logging, evaluation, save will be conducted every `gradient_accumulation_steps * xxx_step` training + examples. + + + + seed (`int`, *optional*, defaults to 42): + Random seed that will be set at the beginning of training. To ensure reproducibility across runs, use + the [`~Trainer.model_init`] function to instantiate the model if it has some randomly initialized + parameters. + gradient_checkpointing (`bool`, *optional*, defaults to `False`): + If True, use gradient checkpointing to save memory at the expense of slower backward pass. + + Example: + + ```py + >>> from transformers import TrainingArguments + + >>> args = TrainingArguments("working_dir") + >>> args = args.set_training(learning_rate=1e-4, batch_size=32) + >>> args.learning_rate + 1e-4 + ``` + """ + self.do_train = True + self.learning_rate = learning_rate + self.per_device_train_batch_size = batch_size + self.weight_decay = weight_decay + self.num_train_epochs = num_epochs + self.max_steps = max_steps + self.gradient_accumulation_steps = gradient_accumulation_steps + self.seed = seed + self.gradient_checkpointing = gradient_checkpointing + return self + + def set_evaluate( + self, + strategy: str | IntervalStrategy = "no", + steps: int = 500, + batch_size: int = 8, + accumulation_steps: int | None = None, + delay: float | None = None, + loss_only: bool = False, + ): + """ + A method that regroups all arguments linked to evaluation. + + Args: + strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"no"`): + The evaluation strategy to adopt during training. Possible values are: + + - `"no"`: No evaluation is done during training. + - `"steps"`: Evaluation is done (and logged) every `steps`. + - `"epoch"`: Evaluation is done at the end of each epoch. + + Setting a `strategy` different from `"no"` will set `self.do_eval` to `True`. + steps (`int`, *optional*, defaults to 500): + Number of update steps between two evaluations if `strategy="steps"`. + batch_size (`int` *optional*, defaults to 8): + The batch size per device (GPU/TPU core/CPU...) used for evaluation. + accumulation_steps (`int`, *optional*): + Number of predictions steps to accumulate the output tensors for, before moving the results to the CPU. + If left unset, the whole predictions are accumulated on GPU/TPU before being moved to the CPU (faster + but requires more memory). + delay (`float`, *optional*): + Number of epochs or steps to wait for before the first evaluation can be performed, depending on the + eval_strategy. + loss_only (`bool`, *optional*, defaults to `False`): + Ignores all outputs except the loss. + + Example: + + ```py + >>> from transformers import TrainingArguments + + >>> args = TrainingArguments("working_dir") + >>> args = args.set_evaluate(strategy="steps", steps=100) + >>> args.eval_steps + 100 + ``` + """ + self.eval_strategy = IntervalStrategy(strategy) + if self.eval_strategy == IntervalStrategy.STEPS and steps == 0: + raise ValueError("Setting `strategy` as 'steps' requires a positive value for `steps`.") + self.do_eval = self.eval_strategy != IntervalStrategy.NO + self.eval_steps = steps + self.per_device_eval_batch_size = batch_size + self.eval_accumulation_steps = accumulation_steps + self.eval_delay = delay + self.prediction_loss_only = loss_only + return self + + def set_testing( + self, + batch_size: int = 8, + loss_only: bool = False, + ): + """ + A method that regroups all basic arguments linked to testing on a held-out dataset. + + + + Calling this method will automatically set `self.do_predict` to `True`. + + + + Args: + batch_size (`int` *optional*, defaults to 8): + The batch size per device (GPU/TPU core/CPU...) used for testing. + loss_only (`bool`, *optional*, defaults to `False`): + Ignores all outputs except the loss. + + Example: + + ```py + >>> from transformers import TrainingArguments + + >>> args = TrainingArguments("working_dir") + >>> args = args.set_testing(batch_size=32) + >>> args.per_device_eval_batch_size + 32 + ``` + """ + self.do_predict = True + self.per_device_eval_batch_size = batch_size + self.prediction_loss_only = loss_only + return self + + def set_save( + self, + strategy: str | IntervalStrategy = "steps", + steps: int = 500, + total_limit: int | None = None, + on_each_node: bool = False, + ): + """ + A method that regroups all arguments linked to checkpoint saving. + + Args: + strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"steps"`): + The checkpoint save strategy to adopt during training. Possible values are: + + - `"no"`: No save is done during training. + - `"epoch"`: Save is done at the end of each epoch. + - `"steps"`: Save is done every `save_steps`. + + steps (`int`, *optional*, defaults to 500): + Number of updates steps before two checkpoint saves if `strategy="steps"`. + total_limit (`int`, *optional*): + If a value is passed, will limit the total amount of checkpoints. Deletes the older checkpoints in + `output_dir`. + on_each_node (`bool`, *optional*, defaults to `False`): + When doing multi-node distributed training, whether to save models and checkpoints on each node, or + only on the main one. + + This should not be activated when the different nodes use the same storage as the files will be saved + with the same names for each node. + + Example: + + ```py + >>> from transformers import TrainingArguments + + >>> args = TrainingArguments("working_dir") + >>> args = args.set_save(strategy="steps", steps=100) + >>> args.save_steps + 100 + ``` + """ + self.save_strategy = SaveStrategy(strategy) + if self.save_strategy == SaveStrategy.STEPS and steps == 0: + raise ValueError("Setting `strategy` as 'steps' requires a positive value for `steps`.") + self.save_steps = steps + self.save_total_limit = total_limit + self.save_on_each_node = on_each_node + return self + + def set_logging( + self, + strategy: str | IntervalStrategy = "steps", + steps: int = 500, + report_to: str | list[str] = "none", + level: str = "passive", + first_step: bool = False, + nan_inf_filter: bool = False, + on_each_node: bool = False, + replica_level: str = "passive", + ): + """ + A method that regroups all arguments linked to logging. + + Args: + strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"steps"`): + The logging strategy to adopt during training. Possible values are: + + - `"no"`: No logging is done during training. + - `"epoch"`: Logging is done at the end of each epoch. + - `"steps"`: Logging is done every `logging_steps`. + + steps (`int`, *optional*, defaults to 500): + Number of update steps between two logs if `strategy="steps"`. + level (`str`, *optional*, defaults to `"passive"`): + Logger log level to use on the main process. Possible choices are the log levels as strings: `"debug"`, + `"info"`, `"warning"`, `"error"` and `"critical"`, plus a `"passive"` level which doesn't set anything + and lets the application set the level. + report_to (`str` or `list[str]`, *optional*, defaults to `"none"`): + The list of integrations to report the results and logs to. Supported platforms are `"azure_ml"`, + `"clearml"`, `"codecarbon"`, `"comet_ml"`, `"dagshub"`, `"dvclive"`, `"flyte"`, `"mlflow"`, + `"swanlab"`, `"tensorboard"`, `"trackio"` and `"wandb"`. Use `"all"` to report to all integrations + installed, `"none"` for no integrations. + first_step (`bool`, *optional*, defaults to `False`): + Whether to log and evaluate the first `global_step` or not. + nan_inf_filter (`bool`, *optional*, defaults to `True`): + Whether to filter `nan` and `inf` losses for logging. If set to `True` the loss of every step that is + `nan` or `inf` is filtered and the average loss of the current logging window is taken instead. + + + + `nan_inf_filter` only influences the logging of loss values, it does not change the behavior the + gradient is computed or applied to the model. + + + + on_each_node (`bool`, *optional*, defaults to `True`): + In multinode distributed training, whether to log using `log_level` once per node, or only on the main + node. + replica_level (`str`, *optional*, defaults to `"passive"`): + Logger log level to use on replicas. Same choices as `log_level` + + Example: + + ```py + >>> from transformers import TrainingArguments + + >>> args = TrainingArguments("working_dir") + >>> args = args.set_logging(strategy="steps", steps=100) + >>> args.logging_steps + 100 + ``` + """ + self.logging_strategy = IntervalStrategy(strategy) + if self.logging_strategy == IntervalStrategy.STEPS and steps == 0: + raise ValueError("Setting `strategy` as 'steps' requires a positive value for `steps`.") + self.logging_steps = steps + self.report_to = report_to + self.log_level = level + self.logging_first_step = first_step + self.logging_nan_inf_filter = nan_inf_filter + self.log_on_each_node = on_each_node + self.log_level_replica = replica_level + return self + + def set_push_to_hub( + self, + model_id: str, + strategy: str | HubStrategy = "every_save", + token: str | None = None, + private_repo: bool | None = None, + always_push: bool = False, + revision: str | None = None, + ): + """ + A method that regroups all arguments linked to synchronizing checkpoints with the Hub. + + + + Calling this method will set `self.push_to_hub` to `True`, which means the `output_dir` will begin a git + directory synced with the repo (determined by `model_id`) and the content will be pushed each time a save is + triggered (depending on your `self.save_strategy`). Calling [`~Trainer.save_model`] will also trigger a push. + + + + Args: + model_id (`str`): + The name of the repository to keep in sync with the local *output_dir*. It can be a simple model ID in + which case the model will be pushed in your namespace. Otherwise it should be the whole repository + name, for instance `"user_name/model"`, which allows you to push to an organization you are a member of + with `"organization_name/model"`. + strategy (`str` or [`~trainer_utils.HubStrategy`], *optional*, defaults to `"every_save"`): + Defines the scope of what is pushed to the Hub and when. Possible values are: + + - `"end"`: push the model, its configuration, the processing_class e.g. tokenizer (if passed along to the [`Trainer`]) and a + draft of a model card when the [`~Trainer.save_model`] method is called. + - `"every_save"`: push the model, its configuration, the processing_class e.g. tokenizer (if passed along to the [`Trainer`]) + and + a draft of a model card each time there is a model save. The pushes are asynchronous to not block + training, and in case the save are very frequent, a new push is only attempted if the previous one is + finished. A last push is made with the final model at the end of training. + - `"checkpoint"`: like `"every_save"` but the latest checkpoint is also pushed in a subfolder named + last-checkpoint, allowing you to resume training easily with + `trainer.train(resume_from_checkpoint="last-checkpoint")`. + - `"all_checkpoints"`: like `"checkpoint"` but all checkpoints are pushed like they appear in the + output + folder (so you will get one checkpoint folder per folder in your final repository) + + token (`str`, *optional*): + The token to use to push the model to the Hub. Will default to the token in the cache folder obtained + with `hf auth login`. + private_repo (`bool`, *optional*, defaults to `False`): + Whether to make the repo private. If `None` (default), the repo will be public unless the organization's default is private. This value is ignored if the repo already exists. + always_push (`bool`, *optional*, defaults to `False`): + Unless this is `True`, the `Trainer` will skip pushing a checkpoint when the previous push is not + finished. + revision (`str`, *optional*): + The revision to use when pushing to the Hub. Can be a branch name, a tag, or a commit hash. + + Example: + + ```py + >>> from transformers import TrainingArguments + + >>> args = TrainingArguments("working_dir") + >>> args = args.set_push_to_hub("me/awesome-model") + >>> args.hub_model_id + 'me/awesome-model' + ``` + """ + self.push_to_hub = True + self.hub_model_id = model_id + self.hub_strategy = HubStrategy(strategy) + self.hub_token = token + self.hub_private_repo = private_repo + self.hub_always_push = always_push + self.hub_revision = revision + return self + + def set_optimizer( + self, + name: str | OptimizerNames = "adamw_torch", + learning_rate: float = 5e-5, + weight_decay: float = 0, + beta1: float = 0.9, + beta2: float = 0.999, + epsilon: float = 1e-8, + args: str | None = None, + ): + """ + A method that regroups all arguments linked to the optimizer and its hyperparameters. + + Args: + name (`str` or [`training_args.OptimizerNames`], *optional*, defaults to `"adamw_torch"`): + The optimizer to use: `"adamw_torch"`, `"adamw_torch_fused"`, `"adamw_apex_fused"`, + `"adamw_anyprecision"` or `"adafactor"`. + learning_rate (`float`, *optional*, defaults to 5e-5): + The initial learning rate. + weight_decay (`float`, *optional*, defaults to 0): + The weight decay to apply (if not zero) to all layers except all bias and LayerNorm weights. + beta1 (`float`, *optional*, defaults to 0.9): + The beta1 hyperparameter for the adam optimizer or its variants. + beta2 (`float`, *optional*, defaults to 0.999): + The beta2 hyperparameter for the adam optimizer or its variants. + epsilon (`float`, *optional*, defaults to 1e-8): + The epsilon hyperparameter for the adam optimizer or its variants. + args (`str`, *optional*): + Optional arguments that are supplied to AnyPrecisionAdamW (only useful when + `optim="adamw_anyprecision"`). + + Example: + + ```py + >>> from transformers import TrainingArguments + + >>> args = TrainingArguments("working_dir") + >>> args = args.set_optimizer(name="adamw_torch", beta1=0.8) + >>> args.optim + 'adamw_torch' + ``` + """ + self.optim = OptimizerNames(name) + self.learning_rate = learning_rate + self.weight_decay = weight_decay + self.adam_beta1 = beta1 + self.adam_beta2 = beta2 + self.adam_epsilon = epsilon + self.optim_args = args + return self + + def set_lr_scheduler( + self, + name: str | SchedulerType = "linear", + num_epochs: float = 3.0, + max_steps: int = -1, + warmup_steps: float = 0, + warmup_ratio: float | None = None, + ): + """ + A method that regroups all arguments linked to the learning rate scheduler and its hyperparameters. + + Args: + name (`str` or [`SchedulerType`], *optional*, defaults to `"linear"`): + The scheduler type to use. See the documentation of [`SchedulerType`] for all possible values. + num_epochs(`float`, *optional*, defaults to 3.0): + Total number of training epochs to perform (if not an integer, will perform the decimal part percents + of the last epoch before stopping training). + max_steps (`int`, *optional*, defaults to -1): + If set to a positive number, the total number of training steps to perform. Overrides `num_train_epochs`. + For a finite dataset, training is reiterated through the dataset (if all data is exhausted) until + `max_steps` is reached. + warmup_steps (`float`, *optional*, defaults to 0): + Number of steps used for a linear warmup from 0 to `learning_rate`. Should be an integer or a float in range `[0,1)`. + If smaller than 1, will be interpreted as ratio of steps used for a linear warmup from 0 to `learning_rate`. + + Example: + + ```py + >>> from transformers import TrainingArguments + + >>> args = TrainingArguments("working_dir") + >>> args = args.set_lr_scheduler(name="cosine", warmup_steps=0.05) + >>> args.warmup_steps + 0.05 + ``` + """ + if warmup_ratio is not None: + logger.warning("warmup_ratio is deprecated and will be removed in v5.2 . Use `warmup_steps` instead.") + warmup_steps = warmup_ratio + + self.lr_scheduler_type = SchedulerType(name) + self.num_train_epochs = num_epochs + self.max_steps = max_steps + self.warmup_steps = warmup_steps + return self + + def set_dataloader( + self, + train_batch_size: int = 8, + eval_batch_size: int = 8, + drop_last: bool = False, + num_workers: int = 0, + pin_memory: bool = True, + persistent_workers: bool = False, + prefetch_factor: int | None = None, + auto_find_batch_size: bool = False, + ignore_data_skip: bool = False, + sampler_seed: int | None = None, + ): + """ + A method that regroups all arguments linked to the dataloaders creation. + + Args: + drop_last (`bool`, *optional*, defaults to `False`): + Whether to drop the last incomplete batch (if the length of the dataset is not divisible by the batch + size) or not. + num_workers (`int`, *optional*, defaults to 0): + Number of subprocesses to use for data loading (PyTorch only). 0 means that the data will be loaded in + the main process. + pin_memory (`bool`, *optional*, defaults to `True`): + Whether you want to pin memory in data loaders or not. Will default to `True`. + persistent_workers (`bool`, *optional*, defaults to `False`): + If True, the data loader will not shut down the worker processes after a dataset has been consumed + once. This allows to maintain the workers Dataset instances alive. Can potentially speed up training, + but will increase RAM usage. Will default to `False`. + prefetch_factor (`int`, *optional*): + Number of batches loaded in advance by each worker. + 2 means there will be a total of 2 * num_workers batches prefetched across all workers. + auto_find_batch_size (`bool`, *optional*, defaults to `False`) + Whether to find a batch size that will fit into memory automatically through exponential decay, + avoiding CUDA Out-of-Memory errors. Requires accelerate to be installed (`pip install accelerate`) + ignore_data_skip (`bool`, *optional*, defaults to `False`): + When resuming training, whether or not to skip the epochs and batches to get the data loading at the + same stage as in the previous training. If set to `True`, the training will begin faster (as that + skipping step can take a long time) but will not yield the same results as the interrupted training + would have. + sampler_seed (`int`, *optional*): + Random seed to be used with data samplers. If not set, random generators for data sampling will use the + same seed as `self.seed`. This can be used to ensure reproducibility of data sampling, independent of + the model seed. + + Example: + + ```py + >>> from transformers import TrainingArguments + + >>> args = TrainingArguments("working_dir") + >>> args = args.set_dataloader(train_batch_size=16, eval_batch_size=64) + >>> args.per_device_train_batch_size + 16 + ``` + """ + self.per_device_train_batch_size = train_batch_size + self.per_device_eval_batch_size = eval_batch_size + self.dataloader_drop_last = drop_last + self.dataloader_num_workers = num_workers + self.dataloader_pin_memory = pin_memory + self.dataloader_persistent_workers = persistent_workers + self.dataloader_prefetch_factor = prefetch_factor + self.auto_find_batch_size = auto_find_batch_size + self.ignore_data_skip = ignore_data_skip + self.data_seed = sampler_seed + return self + + def _process_fsdp_args(self): + if not self.fsdp: + self.fsdp = [] + elif self.fsdp is True: + self.fsdp = [FSDPOption.FULL_SHARD] + elif isinstance(self.fsdp, str): + self.fsdp = [FSDPOption(s) for s in self.fsdp.split()] + + if self.fsdp == [FSDPOption.OFFLOAD]: + raise ValueError( + "`--fsdp offload` can't work on its own. It needs to be added to `--fsdp full_shard` or " + '`--fsdp shard_grad_op`. For example, `--fsdp "full_shard offload"`.' + ) + elif FSDPOption.FULL_SHARD in self.fsdp and FSDPOption.SHARD_GRAD_OP in self.fsdp: + raise ValueError("`--fsdp full_shard` is not compatible with `--fsdp shard_grad_op`.") + + if self.gradient_checkpointing and ( + FSDPOption.FULL_SHARD in self.fsdp or FSDPOption.HYBRID_SHARD in self.fsdp + ): + logger.warning( + "When using FSDP full shard, instead of using `gradient_checkpointing` in TrainingArguments, please" + " use `activation_checkpointing` in `fsdp_config`. The former introduces a redundant AllGather" + " operation in backward pass. Reference: https://github.com/huggingface/transformers/issues/30404" + ) + + if self.fsdp_config is None: + self.fsdp_config = {} + + if isinstance(self.fsdp_config, str): + if len(self.fsdp) == 0: + warnings.warn("`--fsdp_config` is useful only when `--fsdp` is specified.") + with open(self.fsdp_config, encoding="utf-8") as f: + self.fsdp_config = json.load(f) + + if self.fsdp_config is not None and isinstance(self.fsdp_config, dict): + for k in list(self.fsdp_config.keys()): + if k.startswith("fsdp_"): + v = self.fsdp_config.pop(k) + self.fsdp_config[k[5:]] = v + + self.fsdp_config["min_num_params"] = self.fsdp_config.get("min_num_params", 0) + + # Normalize transformer_layer_cls_to_wrap from string to list + if isinstance(self.fsdp_config.get("transformer_layer_cls_to_wrap", None), str): + self.fsdp_config["transformer_layer_cls_to_wrap"] = [self.fsdp_config["transformer_layer_cls_to_wrap"]] + + if len(self.fsdp) == 0 and self.fsdp_config["min_num_params"] > 0: + warnings.warn("`min_num_params` is useful only when `--fsdp` is specified.") + + if len(self.fsdp) == 0 and self.fsdp_config.get("transformer_layer_cls_to_wrap", None) is not None: + warnings.warn("`transformer_layer_cls_to_wrap` is useful only when `--fsdp` is specified.") + + if ( + len(self.fsdp) > 0 + and self.fsdp_config["min_num_params"] > 0 + and self.fsdp_config.get("transformer_layer_cls_to_wrap", None) is not None + ): + raise ValueError("`min_num_params` and `transformer_layer_cls_to_wrap` are mutually exclusive.") + self.fsdp_config["xla"] = self.fsdp_config.get("xla", False) + self.fsdp_config["xla_fsdp_v2"] = self.fsdp_config.get("xla_fsdp_v2", False) + self.fsdp_config["xla_fsdp_grad_ckpt"] = self.fsdp_config.get("xla_fsdp_grad_ckpt", False) + if self.fsdp_config["xla"]: + if len(self.fsdp) > 0: + # Copy to avoid mutating the original (needed for JSON serialization) + self.xla_fsdp_config = self.fsdp_config.get("xla_fsdp_settings", {}).copy() + # Convert string dtype names to torch.dtype + if "compute_dtype" in self.xla_fsdp_config: + self.xla_fsdp_config["compute_dtype"] = getattr(torch, self.xla_fsdp_config["compute_dtype"]) + if "buffer_dtype" in self.xla_fsdp_config: + self.xla_fsdp_config["buffer_dtype"] = getattr(torch, self.xla_fsdp_config["buffer_dtype"]) + else: + warnings.warn("XLA FSDP can be used only when `--fsdp` is specified.") + else: + if self.fsdp_config["xla_fsdp_grad_ckpt"]: + warnings.warn("`--xla_fsdp_grad_ckpt` is useful only when `--xla` is set to true.") + + # Build kwargs for Accelerate's FSDPPlugin + fsdp_plugin_args = None + if len(self.fsdp) > 0 and not self.fsdp_config["xla"]: + from accelerate.utils.constants import ( + FSDP_AUTO_WRAP_POLICY, + FSDP_SHARDING_STRATEGY, + ) + + fsdp_plugin_args = {} + for fsdp_option in self.fsdp: + if fsdp_option.upper() in FSDP_SHARDING_STRATEGY: + fsdp_plugin_args["sharding_strategy"] = fsdp_option + elif fsdp_option == FSDPOption.OFFLOAD: + fsdp_plugin_args["cpu_offload"] = True + elif fsdp_option == FSDPOption.AUTO_WRAP: + fsdp_plugin_args["auto_wrap_policy"] = FSDP_AUTO_WRAP_POLICY[0] + if self.fsdp_config["min_num_params"] > 0: + fsdp_plugin_args["min_num_params"] = self.fsdp_config["min_num_params"] + fsdp_plugin_args["auto_wrap_policy"] = FSDP_AUTO_WRAP_POLICY[1] + elif self.fsdp_config.get("transformer_layer_cls_to_wrap", None) is not None: + fsdp_plugin_args["transformer_cls_names_to_wrap"] = ",".join( + self.fsdp_config["transformer_layer_cls_to_wrap"] + ) + fsdp_version = int(self.fsdp_config.get("version", 1)) + fsdp_plugin_args["fsdp_version"] = fsdp_version + prefetch_policy = self.fsdp_config.get("backward_prefetch", "NO_PREFETCH") + if fsdp_version == 2: + fsdp_plugin_args["reshard_after_forward"] = str_to_bool( + str(self.fsdp_config.get("reshard_after_forward", "false")).lower() + ) + else: + fsdp_plugin_args["forward_prefetch"] = str_to_bool( + str(self.fsdp_config.get("forward_prefetch", "false")).lower() + ) + fsdp_plugin_args["backward_prefetch"] = prefetch_policy.upper() + fsdp_plugin_args["reshard_after_forward"] = str( + self.fsdp_config.get("reshard_after_forward", "FULL_SHARD") + ).lower() + fsdp_plugin_args["use_orig_params"] = str_to_bool( + str(self.fsdp_config.get("use_orig_params", "true")).lower() + ) + + sync_module_states = str(self.fsdp_config.get("sync_module_states", "true")).lower() + cpu_ram_efficient_loading = str(self.fsdp_config.get("cpu_ram_efficient_loading", "false")).lower() + if sync_module_states == "false" and cpu_ram_efficient_loading == "true": + # Without sync, non-main processes would have random weights + raise ValueError('`sync_module_states` must be `"True"` if `cpu_ram_efficient_loading` is `"True"`') + + # Set env var to suppress Accelerate warning and for transformers to read + fsdp_plugin_args["cpu_ram_efficient_loading"] = str_to_bool(cpu_ram_efficient_loading) + os.environ["FSDP_CPU_RAM_EFFICIENT_LOADING"] = cpu_ram_efficient_loading + + fsdp_plugin_args["sync_module_states"] = str_to_bool(sync_module_states) + + return fsdp_plugin_args + + +class ParallelMode(Enum): + NOT_PARALLEL = "not_parallel" + NOT_DISTRIBUTED = "not_distributed" + DISTRIBUTED = "distributed" + SAGEMAKER_MODEL_PARALLEL = "sagemaker_model_parallel" + SAGEMAKER_DATA_PARALLEL = "sagemaker_data_parallel" + TPU = "tpu" + + +def str_to_bool(value, to_bool: bool = True) -> int | bool: + """ + Converts a string representation of truth to `True` (1) or `False` (0). + + True values are `y`, `yes`, `t`, `true`, `on`, and `1`; False value are `n`, `no`, `f`, `false`, `off`, and `0`; + """ + value = value.lower() + if value in ("y", "yes", "t", "true", "on", "1"): + return 1 if not to_bool else True + elif value in ("n", "no", "f", "false", "off", "0"): + return 0 if not to_bool else False + else: + raise ValueError(f"invalid truth value {value}") diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/training_args_seq2seq.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/training_args_seq2seq.py new file mode 100644 index 0000000000000000000000000000000000000000..521cda69c0bec00bc69b122292612690a913ed99 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/training_args_seq2seq.py @@ -0,0 +1,89 @@ +# Copyright 2020 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +from dataclasses import dataclass, field +from pathlib import Path + +from .generation.configuration_utils import GenerationConfig +from .training_args import TrainingArguments +from .utils import add_start_docstrings + + +logger = logging.getLogger(__name__) + + +@dataclass +@add_start_docstrings(TrainingArguments.__doc__) +class Seq2SeqTrainingArguments(TrainingArguments): + """ + Args: + predict_with_generate (`bool`, *optional*, defaults to `False`): + Whether to use generate to calculate generative metrics (ROUGE, BLEU). + generation_max_length (`int`, *optional*): + The `max_length` to use on each evaluation loop when `predict_with_generate=True`. Will default to the + `max_length` value of the model configuration. + generation_num_beams (`int`, *optional*): + The `num_beams` to use on each evaluation loop when `predict_with_generate=True`. Will default to the + `num_beams` value of the model configuration. + generation_config (`str` or `Path` or [`~generation.GenerationConfig`], *optional*): + Allows to load a [`~generation.GenerationConfig`] from the `from_pretrained` method. This can be either: + + - a string, the *model id* of a pretrained model configuration hosted inside a model repo on + huggingface.co. + - a path to a *directory* containing a configuration file saved using the + [`~GenerationConfig.save_pretrained`] method, e.g., `./my_model_directory/`. + - a [`~generation.GenerationConfig`] object. + """ + + sortish_sampler: bool = field(default=False, metadata={"help": "Whether to use SortishSampler or not."}) + predict_with_generate: bool = field( + default=False, metadata={"help": "Whether to use generate to calculate generative metrics (ROUGE, BLEU)."} + ) + generation_max_length: int | None = field( + default=None, + metadata={ + "help": ( + "The `max_length` to use on each evaluation loop when `predict_with_generate=True`. Will default " + "to the `max_length` value of the model configuration." + ) + }, + ) + generation_num_beams: int | None = field( + default=None, + metadata={ + "help": ( + "The `num_beams` to use on each evaluation loop when `predict_with_generate=True`. Will default " + "to the `num_beams` value of the model configuration." + ) + }, + ) + generation_config: str | Path | GenerationConfig | None = field( + default=None, + metadata={ + "help": "Model id, file path or url pointing to a GenerationConfig json file, to use during prediction." + }, + ) + + def to_dict(self): + """ + Serializes this instance while replace `Enum` by their values and `GenerationConfig` by dictionaries (for JSON + serialization support). It obfuscates the token values by removing their value. + """ + # filter out fields that are defined as field(init=False) + d = super().to_dict() + for k, v in d.items(): + if isinstance(v, GenerationConfig): + d[k] = v.to_dict() + return d diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/video_processing_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/video_processing_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..440b536d8e7d038cbd3bf830d4a911736164d22e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/video_processing_utils.py @@ -0,0 +1,888 @@ +# Copyright 2025 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +import os +import warnings +from collections.abc import Callable +from copy import deepcopy +from functools import partial +from typing import Any, Optional + +import numpy as np +from huggingface_hub import create_repo, is_offline_mode +from huggingface_hub.dataclasses import validate_typed_dict + +from .dynamic_module_utils import custom_object_save +from .image_processing_utils import ( + BatchFeature, + get_size_dict, +) +from .image_processing_utils_fast import BaseImageProcessorFast +from .image_utils import ( + ChannelDimension, + SizeDict, + validate_kwargs, +) +from .processing_utils import Unpack, VideosKwargs +from .utils import ( + IMAGE_PROCESSOR_NAME, + PROCESSOR_NAME, + VIDEO_PROCESSOR_NAME, + TensorType, + add_start_docstrings, + copy_func, + is_torch_available, + is_torchcodec_available, + is_torchvision_v2_available, + logging, + safe_load_json_file, +) +from .utils.hub import cached_file +from .utils.import_utils import requires +from .video_utils import ( + VideoInput, + VideoMetadata, + group_videos_by_shape, + infer_channel_dimension_format, + is_valid_video, + load_video, + make_batched_metadata, + make_batched_videos, + reorder_videos, +) + + +if is_torch_available(): + import torch + +if is_torchvision_v2_available(): + import torchvision.transforms.v2.functional as tvF + + +logger = logging.get_logger(__name__) + + +BASE_VIDEO_PROCESSOR_DOCSTRING = r""" + Args: + do_resize (`bool`, *optional*, defaults to `self.do_resize`): + Whether to resize the video's (height, width) dimensions to the specified `size`. Can be overridden by the + `do_resize` parameter in the `preprocess` method. + size (`dict`, *optional*, defaults to `self.size`): + Size of the output video after resizing. Can be overridden by the `size` parameter in the `preprocess` + method. + size_divisor (`int`, *optional*, defaults to `self.size_divisor`): + The size by which to make sure both the height and width can be divided. + default_to_square (`bool`, *optional*, defaults to `self.default_to_square`): + Whether to default to a square video when resizing, if size is an int. + resample (`PILImageResampling`, *optional*, defaults to `self.resample`): + Resampling filter to use if resizing the video. Only has an effect if `do_resize` is set to `True`. Can be + overridden by the `resample` parameter in the `preprocess` method. + do_center_crop (`bool`, *optional*, defaults to `self.do_center_crop`): + Whether to center crop the video to the specified `crop_size`. Can be overridden by `do_center_crop` in the + `preprocess` method. + crop_size (`dict[str, int]` *optional*, defaults to `self.crop_size`): + Size of the output video after applying `center_crop`. Can be overridden by `crop_size` in the `preprocess` + method. + do_rescale (`bool`, *optional*, defaults to `self.do_rescale`): + Whether to rescale the video by the specified scale `rescale_factor`. Can be overridden by the + `do_rescale` parameter in the `preprocess` method. + rescale_factor (`int` or `float`, *optional*, defaults to `self.rescale_factor`): + Scale factor to use if rescaling the video. Only has an effect if `do_rescale` is set to `True`. Can be + overridden by the `rescale_factor` parameter in the `preprocess` method. + do_normalize (`bool`, *optional*, defaults to `self.do_normalize`): + Whether to normalize the video. Can be overridden by the `do_normalize` parameter in the `preprocess` + method. Can be overridden by the `do_normalize` parameter in the `preprocess` method. + image_mean (`float` or `list[float]`, *optional*, defaults to `self.image_mean`): + Mean to use if normalizing the video. This is a float or list of floats the length of the number of + channels in the video. Can be overridden by the `image_mean` parameter in the `preprocess` method. Can be + overridden by the `image_mean` parameter in the `preprocess` method. + image_std (`float` or `list[float]`, *optional*, defaults to `self.image_std`): + Standard deviation to use if normalizing the video. This is a float or list of floats the length of the + number of channels in the video. Can be overridden by the `image_std` parameter in the `preprocess` method. + Can be overridden by the `image_std` parameter in the `preprocess` method. + do_convert_rgb (`bool`, *optional*, defaults to `self.image_std`): + Whether to convert the video to RGB. + video_metadata (`VideoMetadata`, *optional*): + Metadata of the video containing information about total duration, fps and total number of frames. + do_sample_frames (`int`, *optional*, defaults to `self.do_sample_frames`): + Whether to sample frames from the video before processing or to process the whole video. + num_frames (`int`, *optional*, defaults to `self.num_frames`): + Maximum number of frames to sample when `do_sample_frames=True`. + fps (`int` or `float`, *optional*, defaults to `self.fps`): + Target frames to sample per second when `do_sample_frames=True`. + return_tensors (`str` or `TensorType`, *optional*): + Returns stacked tensors if set to `pt, otherwise returns a list of tensors. + data_format (`ChannelDimension` or `str`, *optional*, defaults to `ChannelDimension.FIRST`): + The channel dimension format for the output video. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: video in (num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: video in (height, width, num_channels) format. + - Unset: Use the channel dimension format of the input video. + input_data_format (`ChannelDimension` or `str`, *optional*): + The channel dimension format for the input video. If unset, the channel dimension format is inferred + from the input video. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: video in (num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: video in (height, width, num_channels) format. + - `"none"` or `ChannelDimension.NONE`: video in (height, width) format. + device (`torch.device`, *optional*): + The device to process the videos on. If unset, the device is inferred from the input videos. + return_metadata (`bool`, *optional*): + Whether to return video metadata or not. + """ + + +@add_start_docstrings( + "Constructs a base VideoProcessor.", + BASE_VIDEO_PROCESSOR_DOCSTRING, +) +@requires(backends=("vision", "torchvision")) +class BaseVideoProcessor(BaseImageProcessorFast): + _auto_class = None + + resample = None + image_mean = None + image_std = None + size = None + size_divisor = None + default_to_square = True + crop_size = None + do_resize = None + do_center_crop = None + do_rescale = None + rescale_factor = 1 / 255 + do_normalize = None + do_convert_rgb = None + do_sample_frames = None + fps = None + num_frames = None + video_metadata = None + return_metadata = False + valid_kwargs = VideosKwargs + model_input_names = ["pixel_values_videos"] + + def __init__(self, **kwargs: Unpack[VideosKwargs]) -> None: + super().__init__() + + kwargs.pop("processor_class", None) + + # Additional attributes without default values + for key, value in kwargs.items(): + try: + setattr(self, key, value) + except AttributeError as err: + logger.error(f"Can't set {key} with value {value} for {self}") + raise err + + # Prepare size related keys and turn then into `SizeDict` + size = kwargs.pop("size", self.size) + self.size = ( + get_size_dict(size=size, default_to_square=kwargs.pop("default_to_square", self.default_to_square)) + if size is not None + else None + ) + crop_size = kwargs.pop("crop_size", self.crop_size) + self.crop_size = get_size_dict(crop_size, param_name="crop_size") if crop_size is not None else None + + # Save valid kwargs in a list for further processing + self.model_valid_processing_keys = list(self.valid_kwargs.__annotations__.keys()) + for key in self.model_valid_processing_keys: + if kwargs.get(key) is not None: + setattr(self, key, kwargs[key]) + else: + setattr(self, key, deepcopy(getattr(self, key, None))) + + def __call__(self, videos, **kwargs) -> BatchFeature: + return self.preprocess(videos, **kwargs) + + def convert_to_rgb( + self, + video: "torch.Tensor", + ) -> VideoInput: + """ + Converts a video to RGB format. + + Args: + video (`"torch.Tensor"`): + The video to convert. + + Returns: + `torch.Tensor`: The converted video. + """ + + video = tvF.grayscale_to_rgb(video) + if video.shape[-3] == 3 or not (video[..., 3, :, :] < 255).any(): + return video + + # There is a transparency layer, blend it with a white background. + # Calculate the alpha proportion for blending. + alpha = video[..., 3, :, :] / 255.0 + video = (1 - alpha[..., None, :, :]) * 255 + alpha[..., None, :, :] * video[..., :3, :, :] + return video + + def sample_frames( + self, + metadata: VideoMetadata, + num_frames: int | None = None, + fps: int | float | None = None, + **kwargs, + ): + """ + Default sampling function which uniformly samples the desired number of frames between 0 and total number of frames. + If `fps` is passed along with metadata, `fps` frames per second are sampled uniformty. Arguments `num_frames` + and `fps` are mutually exclusive. + + Args: + metadata (`VideoMetadata`): + Metadata of the video containing information about total duration, fps and total number of frames. + num_frames (`int`, *optional*): + Maximum number of frames to sample. Defaults to `self.num_frames`. + fps (`int` or `float`, *optional*): + Target frames to sample per second. Defaults to `self.fps`. + + Returns: + np.ndarray: + Indices to sample video frames. + """ + if fps is not None and num_frames is not None: + raise ValueError( + "`num_frames`, `fps`, and `sample_indices_fn` are mutually exclusive arguments, please use only one!" + ) + + num_frames = num_frames if num_frames is not None else self.num_frames + fps = fps if fps is not None else self.fps + total_num_frames = metadata.total_num_frames + + # If num_frames is not given but fps is, calculate num_frames from fps + if num_frames is None and fps is not None: + if metadata is None or metadata.fps is None: + raise ValueError( + "Asked to sample `fps` frames per second but no video metadata was provided which is required when sampling with `fps`. " + "Please pass in `VideoMetadata` object or use a fixed `num_frames` per input video" + ) + num_frames = int(total_num_frames / metadata.fps * fps) + + if num_frames > total_num_frames: + raise ValueError( + f"Video can't be sampled. The `num_frames={num_frames}` exceeds `total_num_frames={total_num_frames}`. " + ) + + if num_frames is not None: + indices = torch.arange(0, total_num_frames, total_num_frames / num_frames).int() + else: + indices = torch.arange(0, total_num_frames).int() + return indices + + def _decode_and_sample_videos( + self, + videos: VideoInput, + video_metadata: VideoMetadata | dict, + do_sample_frames: bool | None = None, + sample_indices_fn: Callable | None = None, + ) -> list["torch.Tensor"]: + """ + Decode input videos and sample frames if needed. + """ + videos = make_batched_videos(videos) + video_metadata = make_batched_metadata(videos, video_metadata=video_metadata) + + # Only sample frames if an array video is passed, otherwise first decode -> then sample + if is_valid_video(videos[0]) and do_sample_frames: + sampled_videos = [] + sampled_metadata = [] + for video, metadata in zip(videos, video_metadata): + indices = sample_indices_fn(metadata=metadata) + metadata.frames_indices = indices + sampled_videos.append(video[indices]) + sampled_metadata.append(metadata) + videos = sampled_videos + video_metadata = sampled_metadata + elif not is_valid_video(videos[0]): + if isinstance(videos[0], list): + # Videos sometimes are passed as a list of image URLs, especially through templates + videos = [ + torch.stack([tvF.pil_to_tensor(image) for image in images], dim=0) + for images in self.fetch_images(videos) + ] + if do_sample_frames: + raise ValueError( + "Sampling frames from a list of images is not supported! Set `do_sample_frames=False`." + ) + else: + videos, video_metadata = self.fetch_videos(videos, sample_indices_fn=sample_indices_fn) + + return videos, video_metadata + + def _prepare_input_videos( + self, + videos: VideoInput, + input_data_format: str | ChannelDimension | None = None, + device: str | None = None, + ) -> list["torch.Tensor"]: + """ + Prepare the input videos for processing. + """ + processed_videos = [] + for video in videos: + # `make_batched_videos` always returns a 4D array per video + if isinstance(video, np.ndarray): + # not using tvF.to_tensor as it doesn't handle (C, H, W) numpy arrays + video = torch.from_numpy(video).contiguous() + + # Infer the channel dimension format if not provided + if input_data_format is None: + input_data_format = infer_channel_dimension_format(video) + + if input_data_format == ChannelDimension.LAST: + video = video.permute(0, 3, 1, 2).contiguous() + + if device is not None: + video = video.to(device) + + processed_videos.append(video) + return processed_videos + + @add_start_docstrings( + BASE_VIDEO_PROCESSOR_DOCSTRING, + ) + def preprocess( + self, + videos: VideoInput, + **kwargs: Unpack[VideosKwargs], + ) -> BatchFeature: + validate_kwargs( + captured_kwargs=kwargs.keys(), + valid_processor_keys=list(self.valid_kwargs.__annotations__.keys()) + ["return_tensors"], + ) + + # Perform type validation on received kwargs + validate_typed_dict(self.valid_kwargs, kwargs) + + # Set default kwargs from self. This ensures that if a kwarg is not provided + # by the user, it gets its default value from the instance, or is set to None. + for kwarg_name in self.valid_kwargs.__annotations__: + kwargs.setdefault(kwarg_name, getattr(self, kwarg_name, None)) + + input_data_format = kwargs.pop("input_data_format") + do_sample_frames = kwargs.pop("do_sample_frames") + device = kwargs.pop("device") + video_metadata = kwargs.pop("video_metadata") + + sample_indices_fn = partial(self.sample_frames, **kwargs) if do_sample_frames else None + videos, video_metadata = self._decode_and_sample_videos( + videos, + video_metadata=video_metadata, + do_sample_frames=do_sample_frames, + sample_indices_fn=sample_indices_fn, + ) + videos = self._prepare_input_videos(videos=videos, input_data_format=input_data_format, device=device) + + kwargs = self._further_process_kwargs(**kwargs) + self._validate_preprocess_kwargs(**kwargs) + + # Pop kwargs that are not needed in _preprocess + kwargs.pop("data_format") + return_metadata = kwargs.pop("return_metadata") + + preprocessed_videos = self._preprocess(videos=videos, **kwargs) + if return_metadata: + preprocessed_videos["video_metadata"] = video_metadata + return preprocessed_videos + + def _preprocess( + self, + videos: list["torch.Tensor"], + do_convert_rgb: bool, + do_resize: bool, + size: SizeDict, + interpolation: Optional["tvF.InterpolationMode"], + do_center_crop: bool, + crop_size: SizeDict, + do_rescale: bool, + rescale_factor: float, + do_normalize: bool, + image_mean: float | list[float] | None, + image_std: float | list[float] | None, + return_tensors: str | TensorType | None = None, + **kwargs, + ) -> BatchFeature: + # Group videos by size for batched resizing + grouped_videos, grouped_videos_index = group_videos_by_shape(videos) + resized_videos_grouped = {} + for shape, stacked_videos in grouped_videos.items(): + if do_convert_rgb: + stacked_videos = self.convert_to_rgb(stacked_videos) + if do_resize: + stacked_videos = self.resize(stacked_videos, size=size, interpolation=interpolation) + resized_videos_grouped[shape] = stacked_videos + resized_videos = reorder_videos(resized_videos_grouped, grouped_videos_index) + + # Group videos by size for further processing + # Needed in case do_resize is False, or resize returns videos with different sizes + grouped_videos, grouped_videos_index = group_videos_by_shape(resized_videos) + processed_videos_grouped = {} + for shape, stacked_videos in grouped_videos.items(): + if do_center_crop: + stacked_videos = self.center_crop(stacked_videos, crop_size) + # Fused rescale and normalize + stacked_videos = self.rescale_and_normalize( + stacked_videos, do_rescale, rescale_factor, do_normalize, image_mean, image_std + ) + processed_videos_grouped[shape] = stacked_videos + + processed_videos = reorder_videos(processed_videos_grouped, grouped_videos_index) + + return BatchFeature(data={"pixel_values_videos": processed_videos}, tensor_type=return_tensors) + + @classmethod + def from_pretrained( + cls, + pretrained_model_name_or_path: str | os.PathLike, + cache_dir: str | os.PathLike | None = None, + force_download: bool = False, + local_files_only: bool = False, + token: str | bool | None = None, + revision: str = "main", + **kwargs, + ): + r""" + Instantiate a type of [`~video_processing_utils.VideoProcessorBase`] from an video processor. + + Args: + pretrained_model_name_or_path (`str` or `os.PathLike`): + This can be either: + + - a string, the *model id* of a pretrained video hosted inside a model repo on + huggingface.co. + - a path to a *directory* containing a video processor file saved using the + [`~video_processing_utils.VideoProcessorBase.save_pretrained`] method, e.g., + `./my_model_directory/`. + - a path or url to a saved video processor JSON *file*, e.g., + `./my_model_directory/video_preprocessor_config.json`. + cache_dir (`str` or `os.PathLike`, *optional*): + Path to a directory in which a downloaded pretrained model video processor should be cached if the + standard cache should not be used. + force_download (`bool`, *optional*, defaults to `False`): + Whether or not to force to (re-)download the video processor files and override the cached versions if + they exist. + proxies (`dict[str, str]`, *optional*): + A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128', + 'http://hostname': 'foo.bar:4012'}.` The proxies are used on each request. + token (`str` or `bool`, *optional*): + The token to use as HTTP bearer authorization for remote files. If `True`, or not specified, will use + the token generated when running `hf auth login` (stored in `~/.huggingface`). + revision (`str`, *optional*, defaults to `"main"`): + The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a + git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any + identifier allowed by git. + + + + + To test a pull request you made on the Hub, you can pass `revision="refs/pr/"`. + + + + return_unused_kwargs (`bool`, *optional*, defaults to `False`): + If `False`, then this function returns just the final video processor object. If `True`, then this + functions returns a `Tuple(video_processor, unused_kwargs)` where *unused_kwargs* is a dictionary + consisting of the key/value pairs whose keys are not video processor attributes: i.e., the part of + `kwargs` which has not been used to update `video_processor` and is otherwise ignored. + subfolder (`str`, *optional*, defaults to `""`): + In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + specify the folder name here. + kwargs (`dict[str, Any]`, *optional*): + The values in kwargs of any keys which are video processor attributes will be used to override the + loaded values. Behavior concerning key/value pairs whose keys are *not* video processor attributes is + controlled by the `return_unused_kwargs` keyword parameter. + + Returns: + A video processor of type [`~video_processing_utils.ImagVideoProcessorBase`]. + + Examples: + + ```python + # We can't instantiate directly the base class *VideoProcessorBase* so let's show the examples on a + # derived class: *LlavaOnevisionVideoProcessor* + video_processor = LlavaOnevisionVideoProcessor.from_pretrained( + "llava-hf/llava-onevision-qwen2-0.5b-ov-hf" + ) # Download video_processing_config from huggingface.co and cache. + video_processor = LlavaOnevisionVideoProcessor.from_pretrained( + "./test/saved_model/" + ) # E.g. video processor (or model) was saved using *save_pretrained('./test/saved_model/')* + video_processor = LlavaOnevisionVideoProcessor.from_pretrained("./test/saved_model/video_preprocessor_config.json") + video_processor = LlavaOnevisionVideoProcessor.from_pretrained( + "llava-hf/llava-onevision-qwen2-0.5b-ov-hf", do_normalize=False, foo=False + ) + assert video_processor.do_normalize is False + video_processor, unused_kwargs = LlavaOnevisionVideoProcessor.from_pretrained( + "llava-hf/llava-onevision-qwen2-0.5b-ov-hf", do_normalize=False, foo=False, return_unused_kwargs=True + ) + assert video_processor.do_normalize is False + assert unused_kwargs == {"foo": False} + ```""" + kwargs["cache_dir"] = cache_dir + kwargs["force_download"] = force_download + kwargs["local_files_only"] = local_files_only + kwargs["revision"] = revision + + if token is not None: + kwargs["token"] = token + + video_processor_dict, kwargs = cls.get_video_processor_dict(pretrained_model_name_or_path, **kwargs) + + return cls.from_dict(video_processor_dict, **kwargs) + + def save_pretrained(self, save_directory: str | os.PathLike, push_to_hub: bool = False, **kwargs): + """ + Save an video processor object to the directory `save_directory`, so that it can be re-loaded using the + [`~video_processing_utils.VideoProcessorBase.from_pretrained`] class method. + + Args: + save_directory (`str` or `os.PathLike`): + Directory where the video processor JSON file will be saved (will be created if it does not exist). + push_to_hub (`bool`, *optional*, defaults to `False`): + Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the + repository you want to push to with `repo_id` (will default to the name of `save_directory` in your + namespace). + kwargs (`dict[str, Any]`, *optional*): + Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method. + """ + if os.path.isfile(save_directory): + raise AssertionError(f"Provided path ({save_directory}) should be a directory, not a file") + + os.makedirs(save_directory, exist_ok=True) + + if push_to_hub: + commit_message = kwargs.pop("commit_message", None) + repo_id = kwargs.pop("repo_id", save_directory.split(os.path.sep)[-1]) + repo_id = create_repo(repo_id, exist_ok=True, **kwargs).repo_id + files_timestamps = self._get_files_timestamps(save_directory) + + # If we have a custom config, we copy the file defining it in the folder and set the attributes so it can be + # loaded from the Hub. + if self._auto_class is not None: + custom_object_save(self, save_directory, config=self) + + # If we save using the predefined names, we can load using `from_pretrained` + output_video_processor_file = os.path.join(save_directory, VIDEO_PROCESSOR_NAME) + + self.to_json_file(output_video_processor_file) + logger.info(f"Video processor saved in {output_video_processor_file}") + + if push_to_hub: + self._upload_modified_files( + save_directory, + repo_id, + files_timestamps, + commit_message=commit_message, + token=kwargs.get("token"), + ) + + return [output_video_processor_file] + + @classmethod + def get_video_processor_dict( + cls, pretrained_model_name_or_path: str | os.PathLike, **kwargs + ) -> tuple[dict[str, Any], dict[str, Any]]: + """ + From a `pretrained_model_name_or_path`, resolve to a dictionary of parameters, to be used for instantiating a + video processor of type [`~video_processing_utils.VideoProcessorBase`] using `from_dict`. + + Parameters: + pretrained_model_name_or_path (`str` or `os.PathLike`): + The identifier of the pre-trained checkpoint from which we want the dictionary of parameters. + subfolder (`str`, *optional*, defaults to `""`): + In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can + specify the folder name here. + + Returns: + `tuple[Dict, Dict]`: The dictionary(ies) that will be used to instantiate the video processor object. + """ + cache_dir = kwargs.pop("cache_dir", None) + force_download = kwargs.pop("force_download", False) + proxies = kwargs.pop("proxies", None) + token = kwargs.pop("token", None) + local_files_only = kwargs.pop("local_files_only", False) + revision = kwargs.pop("revision", None) + subfolder = kwargs.pop("subfolder", "") + + from_pipeline = kwargs.pop("_from_pipeline", None) + from_auto_class = kwargs.pop("_from_auto", False) + + user_agent = {"file_type": "video processor", "from_auto_class": from_auto_class} + if from_pipeline is not None: + user_agent["using_pipeline"] = from_pipeline + + if is_offline_mode() and not local_files_only: + logger.info("Offline mode: forcing local_files_only=True") + local_files_only = True + + pretrained_model_name_or_path = str(pretrained_model_name_or_path) + is_local = os.path.isdir(pretrained_model_name_or_path) + if os.path.isfile(pretrained_model_name_or_path): + resolved_video_processor_file = pretrained_model_name_or_path + resolved_processor_file = None + is_local = True + else: + video_processor_file = VIDEO_PROCESSOR_NAME + try: + # Try to load with a new config name first and if not successful try with the old file name + # NOTE: we save all processor configs as nested dict in PROCESSOR_NAME from v5, which is the standard + resolved_processor_file = cached_file( + pretrained_model_name_or_path, + filename=PROCESSOR_NAME, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _raise_exceptions_for_missing_entries=False, + ) + resolved_video_processor_files = [ + resolved_file + for filename in [video_processor_file, IMAGE_PROCESSOR_NAME] + if ( + resolved_file := cached_file( + pretrained_model_name_or_path, + filename=filename, + cache_dir=cache_dir, + force_download=force_download, + proxies=proxies, + local_files_only=local_files_only, + token=token, + user_agent=user_agent, + revision=revision, + subfolder=subfolder, + _raise_exceptions_for_missing_entries=False, + ) + ) + is not None + ] + resolved_video_processor_file = ( + resolved_video_processor_files[0] if resolved_video_processor_files else None + ) + except OSError: + # Raise any OS error raise by `cached_file`. It will have a helpful error message adapted to + # the original exception. + raise + except Exception: + # For any other exception, we throw a generic error. + raise OSError( + f"Can't load video processor for '{pretrained_model_name_or_path}'. If you were trying to load" + " it from 'https://huggingface.co/models', make sure you don't have a local directory with the" + f" same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a" + f" directory containing a {video_processor_file} file" + ) + + # Load video_processor dict. Priority goes as (nested config if found -> video processor config -> image processor config) + # We are downloading both configs because almost all models have a `processor_config.json` but + # not all of these are nested. We need to check if it was saved recebtly as nested or if it is legacy style + video_processor_dict = None + if resolved_processor_file is not None: + processor_dict = safe_load_json_file(resolved_processor_file) + if "video_processor" in processor_dict: + video_processor_dict = processor_dict["video_processor"] + + if resolved_video_processor_file is not None and video_processor_dict is None: + video_processor_dict = safe_load_json_file(resolved_video_processor_file) + + if video_processor_dict is None: + raise OSError( + f"Can't load video processor for '{pretrained_model_name_or_path}'. If you were trying to load" + " it from 'https://huggingface.co/models', make sure you don't have a local directory with the" + f" same name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a" + f" directory containing a {video_processor_file} file" + ) + + if is_local: + logger.info(f"loading configuration file {resolved_video_processor_file}") + else: + logger.info( + f"loading configuration file {video_processor_file} from cache at {resolved_video_processor_file}" + ) + + return video_processor_dict, kwargs + + @classmethod + def from_dict(cls, video_processor_dict: dict[str, Any], **kwargs): + """ + Instantiates a type of [`~video_processing_utils.VideoProcessorBase`] from a Python dictionary of parameters. + + Args: + video_processor_dict (`dict[str, Any]`): + Dictionary that will be used to instantiate the video processor object. Such a dictionary can be + retrieved from a pretrained checkpoint by leveraging the + [`~video_processing_utils.VideoProcessorBase.to_dict`] method. + kwargs (`dict[str, Any]`): + Additional parameters from which to initialize the video processor object. + + Returns: + [`~video_processing_utils.VideoProcessorBase`]: The video processor object instantiated from those + parameters. + """ + video_processor_dict = video_processor_dict.copy() + return_unused_kwargs = kwargs.pop("return_unused_kwargs", False) + + # The `size` parameter is a dict and was previously an int or tuple in feature extractors. + # We set `size` here directly to the `video_processor_dict` so that it is converted to the appropriate + # dict within the video processor and isn't overwritten if `size` is passed in as a kwarg. + if "size" in kwargs and "size" in video_processor_dict: + video_processor_dict["size"] = kwargs.pop("size") + if "crop_size" in kwargs and "crop_size" in video_processor_dict: + video_processor_dict["crop_size"] = kwargs.pop("crop_size") + + video_processor = cls(**video_processor_dict) + + # Update video_processor with kwargs if needed + to_remove = [] + for key, value in kwargs.items(): + if hasattr(video_processor, key): + setattr(video_processor, key, value) + to_remove.append(key) + for key in to_remove: + kwargs.pop(key, None) + + logger.info(f"Video processor {video_processor}") + if return_unused_kwargs: + return video_processor, kwargs + else: + return video_processor + + def to_dict(self) -> dict[str, Any]: + """ + Serializes this instance to a Python dictionary. + + Returns: + `dict[str, Any]`: Dictionary of all the attributes that make up this video processor instance. + """ + output = deepcopy(self.__dict__) + filtered_dict = {} + for key, value in output.items(): + if value is None: + class_default = getattr(type(self), key, "NOT_FOUND") + # Keep None if user explicitly set it (class default is non-None) + if class_default != "NOT_FOUND" and class_default is not None: + filtered_dict[key] = value + else: + filtered_dict[key] = value + + filtered_dict.pop("model_valid_processing_keys", None) + filtered_dict.pop("_valid_kwargs_names", None) + filtered_dict["video_processor_type"] = self.__class__.__name__ + + return filtered_dict + + def to_json_string(self) -> str: + """ + Serializes this instance to a JSON string. + + Returns: + `str`: String containing all the attributes that make up this feature_extractor instance in JSON format. + """ + dictionary = self.to_dict() + + for key, value in dictionary.items(): + if isinstance(value, np.ndarray): + dictionary[key] = value.tolist() + + return json.dumps(dictionary, indent=2, sort_keys=True) + "\n" + + def to_json_file(self, json_file_path: str | os.PathLike): + """ + Save this instance to a JSON file. + + Args: + json_file_path (`str` or `os.PathLike`): + Path to the JSON file in which this image_processor instance's parameters will be saved. + """ + with open(json_file_path, "w", encoding="utf-8") as writer: + writer.write(self.to_json_string()) + + def __repr__(self): + return f"{self.__class__.__name__} {self.to_json_string()}" + + @classmethod + def from_json_file(cls, json_file: str | os.PathLike): + """ + Instantiates a video processor of type [`~video_processing_utils.VideoProcessorBase`] from the path to a JSON + file of parameters. + + Args: + json_file (`str` or `os.PathLike`): + Path to the JSON file containing the parameters. + + Returns: + A video processor of type [`~video_processing_utils.VideoProcessorBase`]: The video_processor object + instantiated from that JSON file. + """ + with open(json_file, "r", encoding="utf-8") as reader: + text = reader.read() + video_processor_dict = json.loads(text) + return cls(**video_processor_dict) + + @classmethod + def register_for_auto_class(cls, auto_class="AutoVideoProcessor"): + """ + Register this class with a given auto class. This should only be used for custom video processors as the ones + in the library are already mapped with `AutoVideoProcessor `. + + + + This API is experimental and may have some slight breaking changes in the next releases. + + + + Args: + auto_class (`str` or `type`, *optional*, defaults to `"AutoVideoProcessor "`): + The auto class to register this new video processor with. + """ + if not isinstance(auto_class, str): + auto_class = auto_class.__name__ + + import transformers.models.auto as auto_module + + if not hasattr(auto_module, auto_class): + raise ValueError(f"{auto_class} is not a valid auto class.") + + cls._auto_class = auto_class + + def fetch_videos(self, video_url_or_urls: str | list[str] | list[list[str]], sample_indices_fn=None): + """ + Convert a single or a list of urls into the corresponding `np.array` objects. + + If a single url is passed, the return value will be a single object. If a list is passed a list of objects is + returned. + """ + backend = "torchcodec" + if not is_torchcodec_available(): + warnings.warn( + "`torchcodec` is not installed and cannot be used to decode the video by default. " + "Falling back to `torchvision`. Note that `torchvision` decoding is deprecated and will be removed in future versions. " + ) + backend = "torchvision" + + if isinstance(video_url_or_urls, list): + return list(zip(*[self.fetch_videos(x, sample_indices_fn=sample_indices_fn) for x in video_url_or_urls])) + else: + return load_video(video_url_or_urls, backend=backend, sample_indices_fn=sample_indices_fn) + + +BaseVideoProcessor.push_to_hub = copy_func(BaseVideoProcessor.push_to_hub) +if BaseVideoProcessor.push_to_hub.__doc__ is not None: + BaseVideoProcessor.push_to_hub.__doc__ = BaseVideoProcessor.push_to_hub.__doc__.format( + object="video processor", object_class="AutoVideoProcessor", object_files="video processor file" + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/transformers/video_utils.py b/TTS/Kokoro/.venv/Lib/site-packages/transformers/video_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..971e4fc08905b67d97118a4030544c4ea3b9185e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/transformers/video_utils.py @@ -0,0 +1,891 @@ +# Copyright 2025 The HuggingFace Inc. team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import warnings +from collections.abc import Callable, Iterable, Mapping +from contextlib import redirect_stdout +from dataclasses import dataclass, fields +from io import BytesIO +from typing import NewType, Union +from urllib.parse import urlparse + +import httpx +import numpy as np + +from .image_transforms import PaddingMode, to_channel_dimension_format +from .image_utils import ChannelDimension, infer_channel_dimension_format, is_valid_image +from .utils import ( + is_av_available, + is_cv2_available, + is_decord_available, + is_numpy_array, + is_torch_available, + is_torch_tensor, + is_torchcodec_available, + is_torchvision_available, + is_vision_available, + is_yt_dlp_available, + logging, + requires_backends, +) + + +if is_vision_available(): + import PIL.Image + + if is_torchvision_available(): + from torchvision import io as torchvision_io + +if is_torch_available(): + import torch + + +logger = logging.get_logger(__name__) + +URL = NewType("URL", str) +Path = NewType("Path", str) + +VideoInput = Union[ + list["PIL.Image.Image"], + np.ndarray, + "torch.Tensor", + list[np.ndarray], + list["torch.Tensor"], + list[list["PIL.Image.Image"]], + list[list[np.ndarray]], + list[list["torch.Tensor"]], + URL, + list[URL], + list[list[URL]], + Path, + list[Path], + list[list[Path]], +] + + +@dataclass +class VideoMetadata(Mapping): + total_num_frames: int + fps: float | None = None + width: int | None = None + height: int | None = None + duration: float | None = None + video_backend: str | None = None + frames_indices: list[int] | None = None + + def __iter__(self): + return (f.name for f in fields(self)) + + def __len__(self): + return len(fields(self)) + + def __getitem__(self, item): + return getattr(self, item) + + def __setitem__(self, key, value): + return setattr(self, key, value) + + @property + def timestamps(self) -> list[float]: + "Timestamps of the sampled frames in seconds." + if self.fps is None or self.frames_indices is None: + raise ValueError("Cannot infer video `timestamps` when `fps` or `frames_indices` is None.") + return [frame_idx / self.fps for frame_idx in self.frames_indices] + + @property + def sampled_fps(self) -> float: + "FPS of the sampled video." + if self.frames_indices is None or self.total_num_frames is None or self.fps is None: + return self.fps or 24 + return len(self.frames_indices) / self.total_num_frames * self.fps + + def update(self, dictionary): + for key, value in dictionary.items(): + if hasattr(self, key): + setattr(self, key, value) + + +VideoMetadataType = VideoMetadata | dict | list[dict | VideoMetadata] | list[list[dict | VideoMetadata]] + + +def is_valid_video_frame(frame): + return isinstance(frame, PIL.Image.Image) or ( + (is_numpy_array(frame) or is_torch_tensor(frame)) and frame.ndim == 3 + ) + + +def is_valid_video(video): + if not isinstance(video, (list, tuple)): + return (is_numpy_array(video) or is_torch_tensor(video)) and video.ndim == 4 + return video and all(is_valid_video_frame(frame) for frame in video) + + +def valid_videos(videos): + # If we have a list of videos, it could be either one video as list of frames or a batch + if isinstance(videos, (list, tuple)): + for video_or_frame in videos: + if not (is_valid_video(video_or_frame) or is_valid_video_frame(video_or_frame)): + return False + # If not a list, then we have a single 4D video or 5D batched tensor + elif not is_valid_video(videos) or videos.ndim == 5: + return False + return True + + +def is_batched_video(videos): + if isinstance(videos, (list, tuple)): + return is_valid_video(videos[0]) + elif (is_numpy_array(videos) or is_torch_tensor(videos)) and videos.ndim == 5: + return True + return False + + +def is_scaled_video(video: np.ndarray) -> bool: + """ + Checks to see whether the pixel values have already been rescaled to [0, 1]. + """ + # It's possible the video has pixel values in [0, 255] but is of floating type + return np.min(video) >= 0 and np.max(video) <= 1 + + +def convert_pil_frames_to_video(videos: list[VideoInput]) -> list[Union[np.ndarray, "torch.Tensor"]]: + """ + Given a batch of videos, converts each video to a 4D array. If video is already in array type, + it is simply returned. We assume that all inputs in the list are in the same format, based on the type of the first element. + + Args: + videos (`VideoInput`): + Video inputs to turn into a list of videos. + """ + + if not (isinstance(videos[0], (list, tuple)) and is_valid_image(videos[0][0])): + return videos + + video_converted = [] + for video in videos: + video = [np.array(frame) for frame in video] + video = np.stack(video) + video_converted.append(video) + return video_converted + + +def make_batched_videos(videos) -> list[Union[np.ndarray, "torch.Tensor", "URL", "Path"]]: + """ + Ensure that the input is a list of videos. If the input is a single video, it is converted to a list of length 1. + If the input is a batch of videos, it is converted to a list of 4D video arrays. Videos passed as list `PIL.Image` + frames are converted to 4D arrays. + + We assume that all inputs in the list are in the same format, based on the type of the first element. + + Args: + videos (`VideoInput`): + Video inputs to turn into a list of videos. + """ + # Early exit for deeply nested list of image frame paths. We shouldn't flatten them + try: + if isinstance(videos[0][0], list) and isinstance(videos[0][0][0], str): + return [image_paths for sublist in videos for image_paths in sublist] + except (IndexError, TypeError): + pass + + if is_batched_video(videos): + return convert_pil_frames_to_video(list(videos)) + elif isinstance(videos, str) or is_valid_video(videos): + return convert_pil_frames_to_video([videos]) + # only one frame passed, thus we unsqueeze time dim + elif is_valid_image(videos): + if isinstance(videos, PIL.Image.Image): + videos = np.array(videos) + return [videos[None, ...]] + elif not isinstance(videos, list): + raise ValueError( + f"Invalid video input. Expected either a list of video frames or an input of 4 or 5 dimensions, but got" + f" type {type(videos)}." + ) + + # Recursively flatten any nested structure + flat_videos_list = [] + for item in videos: + if isinstance(item, str) or is_valid_video(item): + flat_videos_list.append(item) + elif isinstance(item, list) and item: + flat_videos_list.extend(make_batched_videos(item)) + + flat_videos_list = convert_pil_frames_to_video(flat_videos_list) + return flat_videos_list + + +def make_batched_metadata(videos: VideoInput, video_metadata: VideoMetadataType) -> list[VideoMetadata]: + if video_metadata is None: + # Create default metadata and fill attributes we can infer from given video + video_metadata = [ + { + "total_num_frames": len(video), + "fps": None, + "duration": None, + "frames_indices": list(range(len(video))), + "height": get_video_size(video)[0] if is_valid_video(video) else None, + "width": get_video_size(video)[1] if is_valid_video(video) else None, + } + for video in videos + ] + + if isinstance(video_metadata, list): + # Flatten if nested list + if isinstance(video_metadata[0], list): + video_metadata = [ + VideoMetadata(**metadata) for metadata_list in video_metadata for metadata in metadata_list + ] + # Simply wrap in VideoMetadata if simple dict + elif isinstance(video_metadata[0], dict): + video_metadata = [VideoMetadata(**metadata) for metadata in video_metadata] + else: + # Create a batched list from single object + video_metadata = [VideoMetadata(**video_metadata)] + return video_metadata + + +def get_video_size(video: np.ndarray, channel_dim: ChannelDimension | None = None) -> tuple[int, int]: + """ + Returns the (height, width) dimensions of the video. + + Args: + video (`np.ndarray`): + The video to get the dimensions of. + channel_dim (`ChannelDimension`, *optional*): + Which dimension the channel dimension is in. If `None`, will infer the channel dimension from the video. + + Returns: + A tuple of the video's height and width. + """ + if channel_dim is None: + channel_dim = infer_channel_dimension_format(video, num_channels=(1, 3, 4)) + + if channel_dim == ChannelDimension.FIRST: + return video.shape[-2], video.shape[-1] + elif channel_dim == ChannelDimension.LAST: + return video.shape[-3], video.shape[-2] + else: + raise ValueError(f"Unsupported data format: {channel_dim}") + + +def get_uniform_frame_indices(total_num_frames: int, num_frames: int | None = None): + """ + Creates a numpy array for uniform sampling of `num_frame` frames from `total_num_frames` + when loading a video. + + Args: + total_num_frames (`int`): + Total number of frames that a video has. + num_frames (`int`, *optional*): + Number of frames to sample uniformly. If not specified, all frames are sampled. + + Returns: + np.ndarray: np array of frame indices that will be sampled. + """ + if num_frames is not None: + indices = np.arange(0, total_num_frames, total_num_frames / num_frames).astype(int) + else: + indices = np.arange(0, total_num_frames).astype(int) + return indices + + +def default_sample_indices_fn(metadata: VideoMetadata, num_frames=None, fps=None, **kwargs): + """ + A default sampling function that replicates the logic used in get_uniform_frame_indices, + while optionally handling `fps` if `num_frames` is not provided. + + Args: + metadata (`VideoMetadata`): + `VideoMetadata` object containing metadata about the video, such as "total_num_frames" or "fps". + num_frames (`int`, *optional*): + Number of frames to sample uniformly. + fps (`int` or `float`, *optional*): + Desired frames per second. Takes priority over num_frames if both are provided. + + Returns: + `np.ndarray`: Array of frame indices to sample. + """ + total_num_frames = metadata.total_num_frames + video_fps = metadata.fps + + # If num_frames is not given but fps is, calculate num_frames from fps + if num_frames is None and fps is not None: + num_frames = int(total_num_frames / video_fps * fps) + if num_frames > total_num_frames: + raise ValueError( + f"When loading the video with fps={fps}, we computed num_frames={num_frames} " + f"which exceeds total_num_frames={total_num_frames}. Check fps or video metadata." + ) + + if num_frames is not None: + indices = np.arange(0, total_num_frames, total_num_frames / num_frames, dtype=int) + else: + indices = np.arange(0, total_num_frames, dtype=int) + return indices + + +def read_video_opencv( + video_path: Union["URL", "Path"], + sample_indices_fn: Callable, + **kwargs, +) -> tuple[np.ndarray, VideoMetadata]: + """ + Decode a video using the OpenCV backend. + + Args: + video_path (`str`): + Path to the video file. + sample_indices_fn (`Callable`): + A callable function that will return indices at which the video should be sampled. If the video has to be loaded using + by a different sampling technique than provided by `num_frames` or `fps` arguments, one should provide their own `sample_indices_fn`. + If not provided, simple uniform sampling with fps is performed. + Example: + def sample_indices_fn(metadata, **kwargs): + return np.linspace(0, metadata.total_num_frames - 1, num_frames, dtype=int) + + Returns: + tuple[`np.ndarray`, `VideoMetadata`]: A tuple containing: + - Numpy array of frames in RGB (shape: [num_frames, height, width, 3]). + - `VideoMetadata` object. + """ + # Lazy import cv2 + requires_backends(read_video_opencv, ["cv2"]) + import cv2 + + video = cv2.VideoCapture(video_path) + total_num_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT)) + video_fps = video.get(cv2.CAP_PROP_FPS) + duration = total_num_frames / video_fps if video_fps else 0 + metadata = VideoMetadata( + total_num_frames=int(total_num_frames), + fps=float(video_fps), + duration=float(duration), + video_backend="opencv", + height=int(video.get(cv2.CAP_PROP_FRAME_HEIGHT)), + width=int(video.get(cv2.CAP_PROP_FRAME_WIDTH)), + ) + + indices = sample_indices_fn(metadata=metadata, **kwargs) + index = 0 + frames = [] + while video.isOpened(): + success, frame = video.read() + if not success: + break + if index in indices: + height, width, channel = frame.shape + frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) + frames.append(frame[0:height, 0:width, 0:channel]) + if success: + index += 1 + if index >= total_num_frames: + break + + video.release() + metadata.frames_indices = indices + return np.stack(frames), metadata + + +def read_video_decord( + video_path: Union["URL", "Path"], + sample_indices_fn: Callable, + **kwargs, +): + """ + Decode a video using the Decord backend. + + Args: + video_path (`str`): + Path to the video file. + sample_indices_fn (`Callable`): + A callable function that will return indices at which the video should be sampled. If the video has to be loaded using + by a different sampling technique than provided by `num_frames` or `fps` arguments, one should provide their own `sample_indices_fn`. + If not provided, simple uniform sampling with fps is performed. + Example: + def sample_indices_fn(metadata, **kwargs): + return np.linspace(0, metadata.total_num_frames - 1, num_frames, dtype=int) + + Returns: + tuple[`np.array`, `VideoMetadata`]: A tuple containing: + - Numpy array of frames in RGB (shape: [num_frames, height, width, 3]). + - `VideoMetadata` object. + """ + # Lazy import from decord + requires_backends(read_video_decord, ["decord"]) + from decord import VideoReader, cpu + + vr = VideoReader(uri=video_path, ctx=cpu(0)) # decord has problems with gpu + video_fps = vr.get_avg_fps() + total_num_frames = len(vr) + duration = total_num_frames / video_fps if video_fps else 0 + metadata = VideoMetadata( + total_num_frames=int(total_num_frames), + fps=float(video_fps), + duration=float(duration), + video_backend="decord", + ) + + indices = sample_indices_fn(metadata=metadata, **kwargs) + video = vr.get_batch(indices).asnumpy() + + metadata.update( + { + "frames_indices": indices, + "height": video.shape[1], + "width": video.shape[2], + } + ) + return video, metadata + + +def read_video_pyav( + video_path: Union["URL", "Path"], + sample_indices_fn: Callable, + **kwargs, +): + """ + Decode the video with PyAV decoder. + + Args: + video_path (`str`): + Path to the video file. + sample_indices_fn (`Callable`, *optional*): + A callable function that will return indices at which the video should be sampled. If the video has to be loaded using + by a different sampling technique than provided by `num_frames` or `fps` arguments, one should provide their own `sample_indices_fn`. + If not provided, simple uniform sampling with fps is performed. + Example: + def sample_indices_fn(metadata, **kwargs): + return np.linspace(0, metadata.total_num_frames - 1, num_frames, dtype=int) + + Returns: + tuple[`np.array`, `VideoMetadata`]: A tuple containing: + - Numpy array of frames in RGB (shape: [num_frames, height, width, 3]). + - `VideoMetadata` object. + """ + # Lazy import av + requires_backends(read_video_pyav, ["av"]) + import av + + container = av.open(video_path) + total_num_frames = container.streams.video[0].frames + video_fps = container.streams.video[0].average_rate # should we better use `av_guess_frame_rate`? + duration = total_num_frames / video_fps if video_fps else 0 + metadata = VideoMetadata( + total_num_frames=int(total_num_frames), + fps=float(video_fps), + duration=float(duration), + video_backend="pyav", + height=container.streams.video[0].height, + width=container.streams.video[0].width, + ) + + indices = sample_indices_fn(metadata=metadata, **kwargs) + frames = [] + container.seek(0) + end_index = indices[-1] + for i, frame in enumerate(container.decode(video=0)): + if i > end_index: + break + if i >= 0 and i in indices: + frames.append(frame) + + video = np.stack([x.to_ndarray(format="rgb24") for x in frames]) + metadata.frames_indices = indices + return video, metadata + + +def read_video_torchvision( + video_path: Union["URL", "Path"], + sample_indices_fn: Callable, + **kwargs, +): + """ + Decode the video with torchvision decoder. + + Args: + video_path (`str`): + Path to the video file. + sample_indices_fn (`Callable`, *optional*): + A callable function that will return indices at which the video should be sampled. If the video has to be loaded using + by a different sampling technique than provided by `num_frames` or `fps` arguments, one should provide their own `sample_indices_fn`. + If not provided, simple uniform sampling with fps is performed. + Example: + def sample_indices_fn(metadata, **kwargs): + return np.linspace(0, metadata.total_num_frames - 1, num_frames, dtype=int) + + Returns: + tuple[`torch.Tensor`, `VideoMetadata`]: A tuple containing: + - Torch tensor of frames in RGB (shape: [num_frames, height, width, 3]). + - `VideoMetadata` object. + """ + warnings.warn( + "Using `torchvision` for video decoding is deprecated and will be removed in future versions. " + "Please use `torchcodec` instead." + ) + video, _, info = torchvision_io.read_video( + video_path, + start_pts=0.0, + end_pts=None, + pts_unit="sec", + output_format="TCHW", + ) + video_fps = info["video_fps"] + total_num_frames = video.size(0) + duration = total_num_frames / video_fps if video_fps else 0 + metadata = VideoMetadata( + total_num_frames=int(total_num_frames), + fps=float(video_fps), + duration=float(duration), + video_backend="torchvision", + ) + + indices = sample_indices_fn(metadata=metadata, **kwargs) + video = video[indices].contiguous() + metadata.update( + { + "frames_indices": indices, + "height": video.shape[2], + "width": video.shape[3], + } + ) + return video, metadata + + +def read_video_torchcodec( + video_path: Union["URL", "Path"], + sample_indices_fn: Callable, + **kwargs, +): + """ + Decode the video with torchcodec decoder. + + Args: + video_path (`str`): + Path to the video file. + sample_indices_fn (`Callable`): + A callable function that will return indices at which the video should be sampled. If the video has to be loaded using + by a different sampling technique than provided by `num_frames` or `fps` arguments, one should provide their own `sample_indices_fn`. + If not provided, simple uniform sampling with fps is performed. + Example: + def sample_indices_fn(metadata, **kwargs): + return np.linspace(0, metadata.total_num_frames - 1, num_frames, dtype=int) + + Returns: + Tuple[`torch.Tensor`, `VideoMetadata`]: A tuple containing: + - Torch tensor of frames in RGB (shape: [num_frames, height, width, 3]). + - `VideoMetadata` object. + """ + # Lazy import torchcodec + requires_backends(read_video_torchcodec, ["torchcodec"]) + from torchcodec.decoders import VideoDecoder + + # VideoDecoder expects a string for device, default to "cpu" if None + + decoder = VideoDecoder( + video_path, + # Interestingly `exact` mode takes less than approximate when we load the whole video + seek_mode="exact", + # Allow FFmpeg decide on the number of threads for efficiency + num_ffmpeg_threads=0, + device=kwargs.get("device", "cpu"), + ) + total_num_frames = decoder.metadata.num_frames + video_fps = decoder.metadata.average_fps + metadata = VideoMetadata( + total_num_frames=total_num_frames, + fps=video_fps, + duration=decoder.metadata.duration_seconds, + video_backend="torchcodec", + height=decoder.metadata.height, + width=decoder.metadata.width, + ) + + indices = sample_indices_fn(metadata=metadata, **kwargs) + video = decoder.get_frames_at(indices=indices).data.contiguous() + metadata.frames_indices = indices + return video, metadata + + +VIDEO_DECODERS = { + "decord": read_video_decord, + "opencv": read_video_opencv, + "pyav": read_video_pyav, + "torchvision": read_video_torchvision, + "torchcodec": read_video_torchcodec, +} + + +def load_video( + video: VideoInput, + num_frames: int | None = None, + fps: int | float | None = None, + backend: str = "pyav", + sample_indices_fn: Callable | None = None, + **kwargs, +) -> np.ndarray: + """ + Loads `video` to a numpy array. + + Args: + video (`VideoInput`): + The video to convert to the numpy array format. Can be a link to video or local path. + num_frames (`int`, *optional*): + Number of frames to sample uniformly. If not passed, the whole video is loaded. + fps (`int` or `float`, *optional*): + Number of frames to sample per second. Should be passed only when `num_frames=None`. + If not specified and `num_frames==None`, all frames are sampled. + backend (`str`, *optional*, defaults to `"pyav"`): + The backend to use when loading the video. Can be any of ["decord", "pyav", "opencv", "torchvision", "torchcodec"]. Defaults to "pyav". + sample_indices_fn (`Callable`, *optional*): + A callable function that will return indices at which the video should be sampled. If the video has to be loaded using + by a different sampling technique than provided by `num_frames` or `fps` arguments, one should provide their own `sample_indices_fn`. + If not provided, simple uniformt sampling with fps is performed, otherwise `sample_indices_fn` has priority over other args. + The function expects at input the all args along with all kwargs passed to `load_video` and should output valid + indices at which the video should be sampled. For example: + + Example: + def sample_indices_fn(metadata, **kwargs): + return np.linspace(0, metadata.total_num_frames - 1, num_frames, dtype=int) + + Returns: + tuple[`np.ndarray`, Dict]: A tuple containing: + - Numpy array of frames in RGB (shape: [num_frames, height, width, 3]). + - Metadata dictionary. + """ + + # If `sample_indices_fn` is given, we can accept any args as those might be needed by custom `sample_indices_fn` + if fps is not None and num_frames is not None and sample_indices_fn is None: + raise ValueError( + "`num_frames`, `fps`, and `sample_indices_fn` are mutually exclusive arguments, please use only one!" + ) + + # If user didn't pass a sampling function, create one on the fly with default logic + if sample_indices_fn is None: + + def sample_indices_fn_func(metadata, **fn_kwargs): + return default_sample_indices_fn(metadata, num_frames=num_frames, fps=fps, **fn_kwargs) + + sample_indices_fn = sample_indices_fn_func + + # Early exit if provided an array or `PIL` frames + if not isinstance(video, str): + metadata = [None] * len(video) + return video, metadata + + if urlparse(video).netloc in ["www.youtube.com", "youtube.com"]: + if not is_yt_dlp_available(): + raise ImportError("To load a video from YouTube url you have to install `yt_dlp` first.") + # Lazy import from yt_dlp + requires_backends(load_video, ["yt_dlp"]) + from yt_dlp import YoutubeDL + + buffer = BytesIO() + with redirect_stdout(buffer), YoutubeDL() as f: + f.download([video]) + bytes_obj = buffer.getvalue() + file_obj = BytesIO(bytes_obj) + elif video.startswith("http://") or video.startswith("https://"): + file_obj = BytesIO(httpx.get(video, follow_redirects=True).content) + elif os.path.isfile(video): + file_obj = video + else: + raise TypeError("Incorrect format used for video. Should be an url linking to an video or a local path.") + + # can also load with decord, but not cv2/torchvision + # both will fail in case of url links + video_is_url = video.startswith("http://") or video.startswith("https://") + if video_is_url and backend == "opencv": + raise ValueError("If you are trying to load a video from URL, you cannot use 'opencv' as backend") + + if ( + (not is_decord_available() and backend == "decord") + or (not is_av_available() and backend == "pyav") + or (not is_cv2_available() and backend == "opencv") + or (not is_torchvision_available() and backend == "torchvision") + or (not is_torchcodec_available() and backend == "torchcodec") + ): + raise ImportError( + f"You chose backend={backend} for loading the video but the required library is not found in your environment " + f"Make sure to install {backend} before loading the video." + ) + + video_decoder = VIDEO_DECODERS[backend] + video, metadata = video_decoder(file_obj, sample_indices_fn, **kwargs) + return video, metadata + + +def convert_to_rgb( + video: np.ndarray, + input_data_format: str | ChannelDimension | None = None, +) -> np.ndarray: + """ + Convert video to RGB by blending the transparency layer if it's in RGBA format, otherwise simply returns it. + + Args: + video (`np.ndarray`): + The video to convert. + input_data_format (`ChannelDimension`, *optional*): + The channel dimension format of the input video. If unset, will use the inferred format from the input. + """ + if not isinstance(video, np.ndarray): + raise TypeError(f"Video has to be a numpy array to convert to RGB format, but found {type(video)}") + + # np.array usually comes with ChannelDimension.LAST so let's convert it + if input_data_format is None: + input_data_format = infer_channel_dimension_format(video) + video = to_channel_dimension_format(video, ChannelDimension.FIRST, input_channel_dim=input_data_format) + + # 3 channels for RGB already + if video.shape[-3] == 3: + return video + + # Grayscale video so we repeat it 3 times for each channel + if video.shape[-3] == 1: + return video.repeat(3, -3) + + if not (video[..., 3, :, :] < 255).any(): + return video + + # There is a transparency layer, blend it with a white background. + # Calculate the alpha proportion for blending. + alpha = video[..., 3, :, :] / 255.0 + video = (1 - alpha[..., None, :, :]) * 255 + alpha[..., None, :, :] * video[..., 3, :, :] + return video + + +def pad( + video: np.ndarray, + padding: int | tuple[int, int] | Iterable[tuple[int, int]], + mode: PaddingMode = PaddingMode.CONSTANT, + constant_values: float | Iterable[float] = 0.0, + data_format: str | ChannelDimension | None = None, + input_data_format: str | ChannelDimension | None = None, +) -> np.ndarray: + """ + Pads the `video` with the specified (height, width) `padding` and `mode`. + + Args: + video (`np.ndarray`): + The video to pad. + padding (`int` or `tuple[int, int]` or `Iterable[tuple[int, int]]`): + Padding to apply to the edges of the height, width axes. Can be one of three formats: + - `((before_height, after_height), (before_width, after_width))` unique pad widths for each axis. + - `((before, after),)` yields same before and after pad for height and width. + - `(pad,)` or int is a shortcut for before = after = pad width for all axes. + mode (`PaddingMode`): + The padding mode to use. Can be one of: + - `"constant"`: pads with a constant value. + - `"reflect"`: pads with the reflection of the vector mirrored on the first and last values of the + vector along each axis. + - `"replicate"`: pads with the replication of the last value on the edge of the array along each axis. + - `"symmetric"`: pads with the reflection of the vector mirrored along the edge of the array. + constant_values (`float` or `Iterable[float]`, *optional*): + The value to use for the padding if `mode` is `"constant"`. + data_format (`str` or `ChannelDimension`, *optional*): + The channel dimension format for the output video. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: video in (num_frames, num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: video in (num_frames, height, width, num_channels) format. + If unset, will use same as the input video. + input_data_format (`str` or `ChannelDimension`, *optional*): + The channel dimension format for the input video. Can be one of: + - `"channels_first"` or `ChannelDimension.FIRST`: video in (num_frames, num_channels, height, width) format. + - `"channels_last"` or `ChannelDimension.LAST`: video in (num_frames, height, width, num_channels) format. + If unset, will use the inferred format of the input video. + + Returns: + `np.ndarray`: The padded video. + + """ + if input_data_format is None: + input_data_format = infer_channel_dimension_format(video) + + def _expand_for_data_format(values): + """ + Convert values to be in the format expected by np.pad based on the data format. + """ + if isinstance(values, (int, float)): + values = ((values, values), (values, values)) + elif isinstance(values, tuple) and len(values) == 1: + values = ((values[0], values[0]), (values[0], values[0])) + elif isinstance(values, tuple) and len(values) == 2 and isinstance(values[0], int): + values = (values, values) + elif isinstance(values, tuple) and len(values) == 2 and isinstance(values[0], tuple): + pass + else: + raise ValueError(f"Unsupported format: {values}") + + # add 0 for channel dimension + values = ( + ((0, 0), (0, 0), *values) if input_data_format == ChannelDimension.FIRST else ((0, 0), *values, (0, 0)) + ) + + # Add additional padding if there's a batch dimension + values = (0, *values) if video.ndim == 5 else values + return values + + padding_map = { + PaddingMode.CONSTANT: "constant", + PaddingMode.REFLECT: "reflect", + PaddingMode.REPLICATE: "replicate", + PaddingMode.SYMMETRIC: "symmetric", + } + padding = _expand_for_data_format(padding) + + pad_kwargs = {} + if mode not in padding_map: + raise ValueError(f"Invalid padding mode: {mode}") + elif mode == PaddingMode.CONSTANT: + pad_kwargs["constant_values"] = _expand_for_data_format(constant_values) + + video = np.pad(video, padding, mode=padding_map[mode], **pad_kwargs) + video = to_channel_dimension_format(video, data_format, input_data_format) if data_format is not None else video + return video + + +def group_videos_by_shape( + videos: list["torch.Tensor"], +) -> tuple[dict[tuple[int, int], "torch.Tensor"], dict[int, tuple[tuple[int, int], int]]]: + """ + Groups videos by shape. + Returns a dictionary with the shape as key and a list of videos with that shape as value, + and a dictionary with the index of the video in the original list as key and the shape and index in the grouped list as value. + """ + grouped_videos = {} + grouped_videos_index = {} + for i, video in enumerate(videos): + shape = video.shape[-2::] + num_frames = video.shape[-4] # video format BTCHW + shape = (num_frames, *shape) + if shape not in grouped_videos: + grouped_videos[shape] = [] + grouped_videos[shape].append(video) + grouped_videos_index[i] = (shape, len(grouped_videos[shape]) - 1) + # stack videos with the same size and number of frames + grouped_videos = {shape: torch.stack(videos, dim=0) for shape, videos in grouped_videos.items()} + return grouped_videos, grouped_videos_index + + +def reorder_videos( + processed_videos: dict[tuple[int, int], "torch.Tensor"], + grouped_videos_index: dict[int, tuple[tuple[int, int], int]], +) -> list["torch.Tensor"]: + """ + Reconstructs a list of videos in the original order. + """ + return [ + processed_videos[grouped_videos_index[i][0]][grouped_videos_index[i][1]] + for i in range(len(grouped_videos_index)) + ] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/typer/cli.py b/TTS/Kokoro/.venv/Lib/site-packages/typer/cli.py new file mode 100644 index 0000000000000000000000000000000000000000..4b4356f8bdafcd5fc9e8de6c0c95f6f8f4f8bda1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/typer/cli.py @@ -0,0 +1,317 @@ +import importlib.util +import re +import sys +from pathlib import Path +from typing import Any + +import click +import typer +import typer.core +from click import Command, Group, Option + +from . import __version__ +from .core import HAS_RICH, MARKUP_MODE_KEY + +default_app_names = ("app", "cli", "main") +default_func_names = ("main", "cli", "app") + +app = typer.Typer() +utils_app = typer.Typer(help="Extra utility commands for Typer apps.") +app.add_typer(utils_app, name="utils") + + +class State: + def __init__(self) -> None: + self.app: str | None = None + self.func: str | None = None + self.file: Path | None = None + self.module: str | None = None + + +state = State() + + +def maybe_update_state(ctx: click.Context) -> None: + path_or_module = ctx.params.get("path_or_module") + if path_or_module: + file_path = Path(path_or_module) + if file_path.exists() and file_path.is_file(): + state.file = file_path + else: + if not re.fullmatch(r"[a-zA-Z_]\w*(\.[a-zA-Z_]\w*)*", path_or_module): + typer.echo( + f"Not a valid file or Python module: {path_or_module}", err=True + ) + sys.exit(1) + state.module = path_or_module + app_name = ctx.params.get("app") + if app_name: + state.app = app_name + func_name = ctx.params.get("func") + if func_name: + state.func = func_name + + +class TyperCLIGroup(typer.core.TyperGroup): + def list_commands(self, ctx: click.Context) -> list[str]: + self.maybe_add_run(ctx) + return super().list_commands(ctx) + + def get_command(self, ctx: click.Context, name: str) -> Command | None: # ty: ignore[invalid-method-override] + self.maybe_add_run(ctx) + return super().get_command(ctx, name) + + def invoke(self, ctx: click.Context) -> Any: + self.maybe_add_run(ctx) + return super().invoke(ctx) + + def maybe_add_run(self, ctx: click.Context) -> None: + maybe_update_state(ctx) + maybe_add_run_to_cli(self) + + +def get_typer_from_module(module: Any) -> typer.Typer | None: + # Try to get defined app + if state.app: + obj = getattr(module, state.app, None) + if not isinstance(obj, typer.Typer): + typer.echo(f"Not a Typer object: --app {state.app}", err=True) + sys.exit(1) + return obj + # Try to get defined function + if state.func: + func_obj = getattr(module, state.func, None) + if not callable(func_obj): + typer.echo(f"Not a function: --func {state.func}", err=True) + raise typer.Exit(1) + sub_app = typer.Typer() + sub_app.command()(func_obj) + return sub_app + # Iterate and get a default object to use as CLI + local_names = dir(module) + local_names_set = set(local_names) + # Try to get a default Typer app + for name in default_app_names: + if name in local_names_set: + obj = getattr(module, name, None) + if isinstance(obj, typer.Typer): + return obj + # Try to get any Typer app + for name in local_names_set - set(default_app_names): + obj = getattr(module, name) + if isinstance(obj, typer.Typer): + return obj + # Try to get a default function + for func_name in default_func_names: + func_obj = getattr(module, func_name, None) + if callable(func_obj): + sub_app = typer.Typer() + sub_app.command()(func_obj) + return sub_app + # Try to get any func app + for func_name in local_names_set - set(default_func_names): + func_obj = getattr(module, func_name) + if callable(func_obj): + sub_app = typer.Typer() + sub_app.command()(func_obj) + return sub_app + return None + + +def get_typer_from_state() -> typer.Typer | None: + spec = None + if state.file: + module_name = state.file.name + spec = importlib.util.spec_from_file_location(module_name, str(state.file)) + elif state.module: + spec = importlib.util.find_spec(state.module) + if spec is None: + if state.file: + typer.echo(f"Could not import as Python file: {state.file}", err=True) + else: + typer.echo(f"Could not import as Python module: {state.module}", err=True) + sys.exit(1) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) # type: ignore + obj = get_typer_from_module(module) + return obj + + +def maybe_add_run_to_cli(cli: click.Group) -> None: + if "run" not in cli.commands: + if state.file or state.module: + obj = get_typer_from_state() + if obj: + obj._add_completion = False + click_obj = typer.main.get_command(obj) + click_obj.name = "run" + if not click_obj.help: + click_obj.help = "Run the provided Typer app." + cli.add_command(click_obj) + + +def print_version(ctx: click.Context, param: Option, value: bool) -> None: + if not value or ctx.resilient_parsing: + return + typer.echo(f"Typer version: {__version__}") + raise typer.Exit() + + +@app.callback(cls=TyperCLIGroup, no_args_is_help=True) +def callback( + ctx: typer.Context, + *, + path_or_module: str = typer.Argument(None), + app: str = typer.Option(None, help="The typer app object/variable to use."), + func: str = typer.Option(None, help="The function to convert to Typer."), + version: bool = typer.Option( + False, + "--version", + help="Print version and exit.", + callback=print_version, + ), +) -> None: + """ + Run Typer scripts with completion, without having to create a package. + + You probably want to install completion for the typer command: + + $ typer --install-completion + + https://typer.tiangolo.com/ + """ + maybe_update_state(ctx) + + +def get_docs_for_click( + *, + obj: Command, + ctx: typer.Context, + indent: int = 0, + name: str = "", + call_prefix: str = "", + title: str | None = None, +) -> str: + docs = "#" * (1 + indent) + command_name = name or obj.name + if call_prefix: + command_name = f"{call_prefix} {command_name}" + if not title: + title = f"`{command_name}`" if command_name else "CLI" + docs += f" {title}\n\n" + rich_markup_mode = None + if hasattr(ctx, "obj") and isinstance(ctx.obj, dict): + rich_markup_mode = ctx.obj.get(MARKUP_MODE_KEY, None) + to_parse: bool = bool(HAS_RICH and (rich_markup_mode == "rich")) + if obj.help: + docs += f"{_parse_html(to_parse, obj.help)}\n\n" + usage_pieces = obj.collect_usage_pieces(ctx) + if usage_pieces: + docs += "**Usage**:\n\n" + docs += "```console\n" + docs += "$ " + if command_name: + docs += f"{command_name} " + docs += f"{' '.join(usage_pieces)}\n" + docs += "```\n\n" + args = [] + opts = [] + for param in obj.get_params(ctx): + rv = param.get_help_record(ctx) + if rv is not None: + if param.param_type_name == "argument": + args.append(rv) + elif param.param_type_name == "option": + opts.append(rv) + if args: + docs += "**Arguments**:\n\n" + for arg_name, arg_help in args: + docs += f"* `{arg_name}`" + if arg_help: + docs += f": {_parse_html(to_parse, arg_help)}" + docs += "\n" + docs += "\n" + if opts: + docs += "**Options**:\n\n" + for opt_name, opt_help in opts: + docs += f"* `{opt_name}`" + if opt_help: + docs += f": {_parse_html(to_parse, opt_help)}" + docs += "\n" + docs += "\n" + if obj.epilog: + docs += f"{obj.epilog}\n\n" + if isinstance(obj, Group): + group = obj + commands = group.list_commands(ctx) + if commands: + docs += "**Commands**:\n\n" + for command in commands: + command_obj = group.get_command(ctx, command) + assert command_obj + docs += f"* `{command_obj.name}`" + command_help = command_obj.get_short_help_str() + if command_help: + docs += f": {_parse_html(to_parse, command_help)}" + docs += "\n" + docs += "\n" + for command in commands: + command_obj = group.get_command(ctx, command) + assert command_obj + use_prefix = "" + if command_name: + use_prefix += f"{command_name}" + docs += get_docs_for_click( + obj=command_obj, ctx=ctx, indent=indent + 1, call_prefix=use_prefix + ) + return docs + + +def _parse_html(to_parse: bool, input_text: str) -> str: + if not to_parse: + return input_text + from . import rich_utils + + return rich_utils.rich_to_html(input_text) + + +@utils_app.command() +def docs( + ctx: typer.Context, + name: str = typer.Option("", help="The name of the CLI program to use in docs."), + output: Path | None = typer.Option( + None, + help="An output file to write docs to, like README.md.", + file_okay=True, + dir_okay=False, + ), + title: str | None = typer.Option( + None, + help="The title for the documentation page. If not provided, the name of " + "the program is used.", + ), +) -> None: + """ + Generate Markdown docs for a Typer app. + """ + typer_obj = get_typer_from_state() + if not typer_obj: + typer.echo("No Typer app found", err=True) + raise typer.Abort() + if hasattr(typer_obj, "rich_markup_mode"): + if not hasattr(ctx, "obj") or ctx.obj is None: + ctx.ensure_object(dict) + if isinstance(ctx.obj, dict): + ctx.obj[MARKUP_MODE_KEY] = typer_obj.rich_markup_mode + click_obj = typer.main.get_command(typer_obj) + docs = get_docs_for_click(obj=click_obj, ctx=ctx, name=name, title=title) + clean_docs = f"{docs.strip()}\n" + if output: + output.write_text(clean_docs) + typer.echo(f"Docs saved to: {output}") + else: + typer.echo(clean_docs) + + +def main() -> Any: + return app() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/typer/colors.py b/TTS/Kokoro/.venv/Lib/site-packages/typer/colors.py new file mode 100644 index 0000000000000000000000000000000000000000..54e7b166cb1de83321a4965cc4915824b47a7f4f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/typer/colors.py @@ -0,0 +1,20 @@ +# Variable names to colors, just for completion +BLACK = "black" +RED = "red" +GREEN = "green" +YELLOW = "yellow" +BLUE = "blue" +MAGENTA = "magenta" +CYAN = "cyan" +WHITE = "white" + +RESET = "reset" + +BRIGHT_BLACK = "bright_black" +BRIGHT_RED = "bright_red" +BRIGHT_GREEN = "bright_green" +BRIGHT_YELLOW = "bright_yellow" +BRIGHT_BLUE = "bright_blue" +BRIGHT_MAGENTA = "bright_magenta" +BRIGHT_CYAN = "bright_cyan" +BRIGHT_WHITE = "bright_white" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/typer/completion.py b/TTS/Kokoro/.venv/Lib/site-packages/typer/completion.py new file mode 100644 index 0000000000000000000000000000000000000000..0d621e411d7bab9a6d4ab14102670adbcabaf962 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/typer/completion.py @@ -0,0 +1,146 @@ +import os +import sys +from collections.abc import MutableMapping +from typing import Any + +import click + +from ._completion_classes import completion_init +from ._completion_shared import Shells, _get_shell_name, get_completion_script, install +from .models import ParamMeta +from .params import Option +from .utils import get_params_from_function + +_click_patched = False + + +def get_completion_inspect_parameters() -> tuple[ParamMeta, ParamMeta]: + completion_init() + test_disable_detection = os.getenv("_TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION") + if not test_disable_detection: + parameters = get_params_from_function(_install_completion_placeholder_function) + else: + parameters = get_params_from_function( + _install_completion_no_auto_placeholder_function + ) + install_param, show_param = parameters.values() + return install_param, show_param + + +def install_callback(ctx: click.Context, param: click.Parameter, value: Any) -> Any: + if not value or ctx.resilient_parsing: + return value # pragma: no cover + if isinstance(value, str): + shell, path = install(shell=value) + else: + shell, path = install() + click.secho(f"{shell} completion installed in {path}", fg="green") + click.echo("Completion will take effect once you restart the terminal") + sys.exit(0) + + +def show_callback(ctx: click.Context, param: click.Parameter, value: Any) -> Any: + if not value or ctx.resilient_parsing: + return value # pragma: no cover + prog_name = ctx.find_root().info_name + assert prog_name + complete_var = "_{}_COMPLETE".format(prog_name.replace("-", "_").upper()) + shell = "" + test_disable_detection = os.getenv("_TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION") + if isinstance(value, str): + shell = value + elif not test_disable_detection: + detected_shell = _get_shell_name() + if detected_shell is not None: + shell = detected_shell + script_content = get_completion_script( + prog_name=prog_name, complete_var=complete_var, shell=shell + ) + click.echo(script_content) + sys.exit(0) + + +# Create a fake command function to extract the completion parameters +def _install_completion_placeholder_function( + install_completion: bool = Option( + None, + "--install-completion", + callback=install_callback, + expose_value=False, + help="Install completion for the current shell.", + ), + show_completion: bool = Option( + None, + "--show-completion", + callback=show_callback, + expose_value=False, + help="Show completion for the current shell, to copy it or customize the installation.", + ), +) -> Any: + pass # pragma: no cover + + +def _install_completion_no_auto_placeholder_function( + install_completion: Shells = Option( + None, + callback=install_callback, + expose_value=False, + help="Install completion for the specified shell.", + ), + show_completion: Shells = Option( + None, + callback=show_callback, + expose_value=False, + help="Show completion for the specified shell, to copy it or customize the installation.", + ), +) -> Any: + pass # pragma: no cover + + +# Re-implement Click's shell_complete to add error message with: +# Invalid completion instruction +# To use 7.x instruction style for compatibility +# And to add extra error messages, for compatibility with Typer in previous versions +# This is only called in new Command method, only used by Click 8.x+ +def shell_complete( + cli: click.Command, + ctx_args: MutableMapping[str, Any], + prog_name: str, + complete_var: str, + instruction: str, +) -> int: + import click + import click.shell_completion + + if "_" not in instruction: + click.echo("Invalid completion instruction.", err=True) + return 1 + + # Click 8 changed the order/style of shell instructions from e.g. + # source_bash to bash_source + # Typer override to preserve the old style for compatibility + # Original in Click 8.x commented: + # shell, _, instruction = instruction.partition("_") + instruction, _, shell = instruction.partition("_") + # Typer override end + + comp_cls = click.shell_completion.get_completion_class(shell) + + if comp_cls is None: + click.echo(f"Shell {shell} not supported.", err=True) + return 1 + + comp = comp_cls(cli, ctx_args, prog_name, complete_var) + + if instruction == "source": + click.echo(comp.source()) + return 0 + + # Typer override to print the completion help msg with Rich + if instruction == "complete": + click.echo(comp.complete()) + return 0 + # Typer override end + + click.echo(f'Completion instruction "{instruction}" not supported.', err=True) + return 1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/urllib3-2.6.3.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/urllib3-2.6.3.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..b75670fb69f700549164c9ebfc8486eaed0d73ae --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/urllib3-2.6.3.dist-info/METADATA @@ -0,0 +1,164 @@ +Metadata-Version: 2.4 +Name: urllib3 +Version: 2.6.3 +Summary: HTTP library with thread-safe connection pooling, file post, and more. +Project-URL: Changelog, https://github.com/urllib3/urllib3/blob/main/CHANGES.rst +Project-URL: Documentation, https://urllib3.readthedocs.io +Project-URL: Code, https://github.com/urllib3/urllib3 +Project-URL: Issue tracker, https://github.com/urllib3/urllib3/issues +Author-email: Andrey Petrov +Maintainer-email: Seth Michael Larson , Quentin Pradet , Illia Volochii +License-Expression: MIT +License-File: LICENSE.txt +Keywords: filepost,http,httplib,https,pooling,ssl,threadsafe,urllib +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Internet :: WWW/HTTP +Classifier: Topic :: Software Development :: Libraries +Requires-Python: >=3.9 +Provides-Extra: brotli +Requires-Dist: brotli>=1.2.0; (platform_python_implementation == 'CPython') and extra == 'brotli' +Requires-Dist: brotlicffi>=1.2.0.0; (platform_python_implementation != 'CPython') and extra == 'brotli' +Provides-Extra: h2 +Requires-Dist: h2<5,>=4; extra == 'h2' +Provides-Extra: socks +Requires-Dist: pysocks!=1.5.7,<2.0,>=1.5.6; extra == 'socks' +Provides-Extra: zstd +Requires-Dist: backports-zstd>=1.0.0; (python_version < '3.14') and extra == 'zstd' +Description-Content-Type: text/markdown + +

+ +![urllib3](https://github.com/urllib3/urllib3/raw/main/docs/_static/banner_github.svg) + +

+ +

+ PyPI Version + Python Versions + Join our Discord + Coverage Status + Build Status on GitHub + Documentation Status
+ OpenSSF Scorecard + SLSA 3 + CII Best Practices +

+ +urllib3 is a powerful, *user-friendly* HTTP client for Python. +urllib3 brings many critical features that are missing from the Python +standard libraries: + +- Thread safety. +- Connection pooling. +- Client-side SSL/TLS verification. +- File uploads with multipart encoding. +- Helpers for retrying requests and dealing with HTTP redirects. +- Support for gzip, deflate, brotli, and zstd encoding. +- Proxy support for HTTP and SOCKS. +- 100% test coverage. + +... and many more features, but most importantly: Our maintainers have a 15+ +year track record of maintaining urllib3 with the highest code standards and +attention to security and safety. + +[Much of the Python ecosystem already uses urllib3](https://urllib3.readthedocs.io/en/stable/#who-uses) +and you should too. + + +## Installing + +urllib3 can be installed with [pip](https://pip.pypa.io): + +```bash +$ python -m pip install urllib3 +``` + +Alternatively, you can grab the latest source code from [GitHub](https://github.com/urllib3/urllib3): + +```bash +$ git clone https://github.com/urllib3/urllib3.git +$ cd urllib3 +$ pip install . +``` + +## Getting Started + +urllib3 is easy to use: + +```python3 +>>> import urllib3 +>>> resp = urllib3.request("GET", "http://httpbin.org/robots.txt") +>>> resp.status +200 +>>> resp.data +b"User-agent: *\nDisallow: /deny\n" +``` + +urllib3 has usage and reference documentation at [urllib3.readthedocs.io](https://urllib3.readthedocs.io). + + +## Community + +urllib3 has a [community Discord channel](https://discord.gg/urllib3) for asking questions and +collaborating with other contributors. Drop by and say hello 👋 + + +## Contributing + +urllib3 happily accepts contributions. Please see our +[contributing documentation](https://urllib3.readthedocs.io/en/latest/contributing.html) +for some tips on getting started. + + +## Security Disclosures + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure with maintainers. + + +## Maintainers + +Meet our maintainers since 2008: + +- Current Lead: [@illia-v](https://github.com/illia-v) (Illia Volochii) +- [@sethmlarson](https://github.com/sethmlarson) (Seth M. Larson) +- [@pquentin](https://github.com/pquentin) (Quentin Pradet) +- [@theacodes](https://github.com/theacodes) (Thea Flowers) +- [@haikuginger](https://github.com/haikuginger) (Jess Shapiro) +- [@lukasa](https://github.com/lukasa) (Cory Benfield) +- [@sigmavirus24](https://github.com/sigmavirus24) (Ian Stapleton Cordasco) +- [@shazow](https://github.com/shazow) (Andrey Petrov) + +👋 + + +## Sponsorship + +If your company benefits from this library, please consider [sponsoring its +development](https://urllib3.readthedocs.io/en/latest/sponsors.html). + + +## For Enterprise + +Professional support for urllib3 is available as part of the [Tidelift +Subscription][1]. Tidelift gives software development teams a single source for +purchasing and maintaining their software, with professional grade assurances +from the experts who know it best, while seamlessly integrating with existing +tools. + +[1]: https://tidelift.com/subscription/pkg/pypi-urllib3?utm_source=pypi-urllib3&utm_medium=referral&utm_campaign=readme diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..ba3060e0728add70fd7ed9643027e9838d243978 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/METADATA @@ -0,0 +1,191 @@ +Metadata-Version: 2.4 +Name: uvicorn +Version: 0.41.0 +Summary: The lightning-fast ASGI server. +Project-URL: Changelog, https://uvicorn.dev/release-notes +Project-URL: Funding, https://github.com/sponsors/encode +Project-URL: Homepage, https://uvicorn.dev/ +Project-URL: Source, https://github.com/Kludex/uvicorn +Author-email: Tom Christie +Maintainer-email: Marcelo Trylesinski +License-Expression: BSD-3-Clause +License-File: LICENSE.md +Classifier: Development Status :: 4 - Beta +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Internet :: WWW/HTTP +Requires-Python: >=3.10 +Requires-Dist: click>=7.0 +Requires-Dist: h11>=0.8 +Requires-Dist: typing-extensions>=4.0; python_version < '3.11' +Provides-Extra: standard +Requires-Dist: colorama>=0.4; (sys_platform == 'win32') and extra == 'standard' +Requires-Dist: httptools>=0.6.3; extra == 'standard' +Requires-Dist: python-dotenv>=0.13; extra == 'standard' +Requires-Dist: pyyaml>=5.1; extra == 'standard' +Requires-Dist: uvloop>=0.15.1; (sys_platform != 'win32' and (sys_platform != 'cygwin' and platform_python_implementation != 'PyPy')) and extra == 'standard' +Requires-Dist: watchfiles>=0.20; extra == 'standard' +Requires-Dist: websockets>=10.4; extra == 'standard' +Description-Content-Type: text/markdown + +

+ uvicorn +

+ +

+An ASGI web server, for Python. +

+ +--- + +[![Build Status](https://github.com/Kludex/uvicorn/workflows/Test%20Suite/badge.svg)](https://github.com/Kludex/uvicorn/actions) +[![Package version](https://badge.fury.io/py/uvicorn.svg)](https://pypi.python.org/pypi/uvicorn) +[![Supported Python Version](https://img.shields.io/pypi/pyversions/uvicorn.svg?color=%2334D058)](https://pypi.org/project/uvicorn) +[![Discord](https://img.shields.io/discord/1051468649518616576?logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/RxKUF5JuHs) + +--- + +**Documentation**: [https://uvicorn.dev](https://uvicorn.dev) + +**Source Code**: [https://www.github.com/Kludex/uvicorn](https://www.github.com/Kludex/uvicorn) + +--- + +Uvicorn is an ASGI web server implementation for Python. + +Until recently Python has lacked a minimal low-level server/application interface for +async frameworks. The [ASGI specification][asgi] fills this gap, and means we're now able to +start building a common set of tooling usable across all async frameworks. + +Uvicorn supports HTTP/1.1 and WebSockets. + +## Quickstart + +Install using `pip`: + +```shell +$ pip install uvicorn +``` + +This will install uvicorn with minimal (pure Python) dependencies. + +```shell +$ pip install 'uvicorn[standard]' +``` + +This will install uvicorn with "Cython-based" dependencies (where possible) and other "optional extras". + +In this context, "Cython-based" means the following: + +- the event loop `uvloop` will be installed and used if possible. +- the http protocol will be handled by `httptools` if possible. + +Moreover, "optional extras" means that: + +- the websocket protocol will be handled by `websockets` (should you want to use `wsproto` you'd need to install it manually) if possible. +- the `--reload` flag in development mode will use `watchfiles`. +- windows users will have `colorama` installed for the colored logs. +- `python-dotenv` will be installed should you want to use the `--env-file` option. +- `PyYAML` will be installed to allow you to provide a `.yaml` file to `--log-config`, if desired. + +Create an application, in `example.py`: + +```python +async def app(scope, receive, send): + assert scope['type'] == 'http' + + await send({ + 'type': 'http.response.start', + 'status': 200, + 'headers': [ + (b'content-type', b'text/plain'), + ], + }) + await send({ + 'type': 'http.response.body', + 'body': b'Hello, world!', + }) +``` + +Run the server: + +```shell +$ uvicorn example:app +``` + +--- + +## Why ASGI? + +Most well established Python Web frameworks started out as WSGI-based frameworks. + +WSGI applications are a single, synchronous callable that takes a request and returns a response. +This doesn’t allow for long-lived connections, like you get with long-poll HTTP or WebSocket connections, +which WSGI doesn't support well. + +Having an async concurrency model also allows for options such as lightweight background tasks, +and can be less of a limiting factor for endpoints that have long periods being blocked on network +I/O such as dealing with slow HTTP requests. + +--- + +## Alternative ASGI servers + +A strength of the ASGI protocol is that it decouples the server implementation +from the application framework. This allows for an ecosystem of interoperating +webservers and application frameworks. + +### Daphne + +The first ASGI server implementation, originally developed to power Django Channels, is [the Daphne webserver][daphne]. + +It is run widely in production, and supports HTTP/1.1, HTTP/2, and WebSockets. + +Any of the example applications given here can equally well be run using `daphne` instead. + +``` +$ pip install daphne +$ daphne app:App +``` + +### Hypercorn + +[Hypercorn][hypercorn] was initially part of the Quart web framework, before +being separated out into a standalone ASGI server. + +Hypercorn supports HTTP/1.1, HTTP/2, and WebSockets. + +It also supports [the excellent `trio` async framework][trio], as an alternative to `asyncio`. + +``` +$ pip install hypercorn +$ hypercorn app:App +``` + +### Mangum + +[Mangum][mangum] is an adapter for using ASGI applications with AWS Lambda & API Gateway. + +### Granian + +[Granian][granian] is an ASGI compatible Rust HTTP server which supports HTTP/2, TLS and WebSockets. + +--- + +

Uvicorn is BSD licensed code.
Designed & crafted with care.

— 🦄 —

+ +[asgi]: https://asgi.readthedocs.io/en/latest/ +[daphne]: https://github.com/django/daphne +[hypercorn]: https://github.com/pgjones/hypercorn +[trio]: https://trio.readthedocs.io +[mangum]: https://github.com/jordaneremieff/mangum +[granian]: https://github.com/emmett-framework/granian diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..330906b0cf81e75e1df713bf9fb6468a2cefdb76 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/RECORD @@ -0,0 +1,89 @@ +../../Scripts/uvicorn.exe,sha256=vqnv16ZXHSIovdbYwd80iOaz9Hu035l4OwFVS5unYA4,108375 +uvicorn-0.41.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +uvicorn-0.41.0.dist-info/METADATA,sha256=3g2xBjn1FkSlbXvVlBM-SqoYj2FVwiuIEp6ZlZ62dfc,6738 +uvicorn-0.41.0.dist-info/RECORD,, +uvicorn-0.41.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +uvicorn-0.41.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87 +uvicorn-0.41.0.dist-info/entry_points.txt,sha256=FW1w-hkc9QgwaGoovMvm0ZY73w_NcycWdGAUfDsNGxw,46 +uvicorn-0.41.0.dist-info/licenses/LICENSE.md,sha256=7-Gs8-YvuZwoiw7HPlp3O3Jo70Mg_nV-qZQhTktjw3E,1526 +uvicorn/__init__.py,sha256=ew0hjyTltPba0Nc9vruW3ELX_ulcJUZMaB1De1hjPOc,147 +uvicorn/__main__.py,sha256=DQizy6nKP0ywhPpnCHgmRDYIMfcqZKVEzNIWQZjqtVQ,62 +uvicorn/__pycache__/__init__.cpython-312.pyc,, +uvicorn/__pycache__/__main__.cpython-312.pyc,, +uvicorn/__pycache__/_compat.cpython-312.pyc,, +uvicorn/__pycache__/_subprocess.cpython-312.pyc,, +uvicorn/__pycache__/_types.cpython-312.pyc,, +uvicorn/__pycache__/config.cpython-312.pyc,, +uvicorn/__pycache__/importer.cpython-312.pyc,, +uvicorn/__pycache__/logging.cpython-312.pyc,, +uvicorn/__pycache__/main.cpython-312.pyc,, +uvicorn/__pycache__/server.cpython-312.pyc,, +uvicorn/__pycache__/workers.cpython-312.pyc,, +uvicorn/_compat.py,sha256=6X49c9ovzmMHir2S3syinOQMzSPBcp8MNuI9ZQrbYiU,2916 +uvicorn/_subprocess.py,sha256=fQ4JTajuXay6mVc8KQNGfXu6JHoab46aS6kyIMWJMPk,2776 +uvicorn/_types.py,sha256=JDM6E-hqZ6o_cSZvjDULjAv77PFH2pLe_Vgqshe8qH4,7677 +uvicorn/config.py,sha256=aYK4Nc-M0uvbT4LmgIvY8c00kekEz0P4BWhG8VMojcg,22095 +uvicorn/importer.py,sha256=nRt0QQ3qpi264-n_mR0l55C2ddM8nowTNzT1jsWaam8,1128 +uvicorn/lifespan/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +uvicorn/lifespan/__pycache__/__init__.cpython-312.pyc,, +uvicorn/lifespan/__pycache__/off.cpython-312.pyc,, +uvicorn/lifespan/__pycache__/on.cpython-312.pyc,, +uvicorn/lifespan/off.py,sha256=nfI6qHAUo_8-BEXMBKoHQ9wUbsXrPaXLCbDSS0vKSr8,332 +uvicorn/lifespan/on.py,sha256=iETPFj6SFhPDPcdeGxfa43LKImJU7MI5i7QUUepBcPE,5173 +uvicorn/logging.py,sha256=IBPSo2qRBWJRj5C2nN7I1civFAj9jKZ5Azxk0JpPB98,4235 +uvicorn/loops/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +uvicorn/loops/__pycache__/__init__.cpython-312.pyc,, +uvicorn/loops/__pycache__/asyncio.cpython-312.pyc,, +uvicorn/loops/__pycache__/auto.cpython-312.pyc,, +uvicorn/loops/__pycache__/uvloop.cpython-312.pyc,, +uvicorn/loops/asyncio.py,sha256=a8wO4fB4pCk-RLICq7CnGr_cxQI7MBLJj-Go4UQldD8,333 +uvicorn/loops/auto.py,sha256=pdTsMcqkbE8fvdNgLs1y4c6hsuN598mZOSOlC0a23S4,566 +uvicorn/loops/uvloop.py,sha256=Ca-TL-W8tbdEW5uvL_GrMih7G8e_t_vhNevi2NKYjEU,236 +uvicorn/main.py,sha256=e3CTIV0c80cp1639Ttnej7b5uvdtgLLWtSOcHU8Gu54,18183 +uvicorn/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +uvicorn/middleware/__pycache__/__init__.cpython-312.pyc,, +uvicorn/middleware/__pycache__/asgi2.cpython-312.pyc,, +uvicorn/middleware/__pycache__/message_logger.cpython-312.pyc,, +uvicorn/middleware/__pycache__/proxy_headers.cpython-312.pyc,, +uvicorn/middleware/__pycache__/wsgi.cpython-312.pyc,, +uvicorn/middleware/asgi2.py,sha256=YQrQNm3RehFts3mzk3k4yw8aD8Egtj0tRS3N45YkQa0,394 +uvicorn/middleware/message_logger.py,sha256=IHEZUSnFNaMFUFdwtZO3AuFATnYcSor-gVtOjbCzt8M,2859 +uvicorn/middleware/proxy_headers.py,sha256=yQG3ThmZhRh9jp-AId7DQhb5WVl6to0hD1G0DPrtLow,5790 +uvicorn/middleware/wsgi.py,sha256=VnbnkdCL3_ctLWzk1j39xvxysuoAB3kSYmi8TsOLpNs,7125 +uvicorn/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +uvicorn/protocols/__pycache__/__init__.cpython-312.pyc,, +uvicorn/protocols/__pycache__/utils.cpython-312.pyc,, +uvicorn/protocols/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +uvicorn/protocols/http/__pycache__/__init__.cpython-312.pyc,, +uvicorn/protocols/http/__pycache__/auto.cpython-312.pyc,, +uvicorn/protocols/http/__pycache__/flow_control.cpython-312.pyc,, +uvicorn/protocols/http/__pycache__/h11_impl.cpython-312.pyc,, +uvicorn/protocols/http/__pycache__/httptools_impl.cpython-312.pyc,, +uvicorn/protocols/http/auto.py,sha256=YfXGyzWTaaE2p_jkTPWrJCXsxEaQnC3NK0-G7Wgmnls,403 +uvicorn/protocols/http/flow_control.py,sha256=050WVg31EvPOkHwynCoMP1zXFl_vO3U4durlc5vyp4U,1701 +uvicorn/protocols/http/h11_impl.py,sha256=9ZLSc6KxHmnKG-ZSCZrcBRcjdDep-iKg2nIyTGyCAqc,21202 +uvicorn/protocols/http/httptools_impl.py,sha256=0AFBFIUj3kYqYoGGw6x507CaDknKe9nZPa6wJV-4LnU,22293 +uvicorn/protocols/utils.py,sha256=1hKdDCmo_GtGrK1zZfa70jL7Hr3mDE8RnL69O4rHQRg,2058 +uvicorn/protocols/websockets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +uvicorn/protocols/websockets/__pycache__/__init__.cpython-312.pyc,, +uvicorn/protocols/websockets/__pycache__/auto.cpython-312.pyc,, +uvicorn/protocols/websockets/__pycache__/websockets_impl.cpython-312.pyc,, +uvicorn/protocols/websockets/__pycache__/websockets_sansio_impl.cpython-312.pyc,, +uvicorn/protocols/websockets/__pycache__/wsproto_impl.cpython-312.pyc,, +uvicorn/protocols/websockets/auto.py,sha256=pAEMIsyXQ12CL6ffaEJQ2cQEC8yAr8sr7bC0H6hzBfs,590 +uvicorn/protocols/websockets/websockets_impl.py,sha256=l4pBaHAsvM-Y_BoPhe8j0fq1DCjqjPJ2PYRDUbukjRs,15419 +uvicorn/protocols/websockets/websockets_sansio_impl.py,sha256=GOhauU8ZdcrbHuejvGPoDdg7GqWYudTUu9HSyLSq2Ww,17057 +uvicorn/protocols/websockets/wsproto_impl.py,sha256=uVOrpfa4tdY-dNGAJdcpvDYxCT6tM6voaeKK9zJtsp4,15273 +uvicorn/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 +uvicorn/server.py,sha256=fXk3__HBf1g-oh_4_OXIpb8tnTyafxuWRiEet6SQEvM,13368 +uvicorn/supervisors/__init__.py,sha256=wT8eOEIqT1yWQgytZtv5taWMul7xoTIY0xm1m4oyPTw,507 +uvicorn/supervisors/__pycache__/__init__.cpython-312.pyc,, +uvicorn/supervisors/__pycache__/basereload.cpython-312.pyc,, +uvicorn/supervisors/__pycache__/multiprocess.cpython-312.pyc,, +uvicorn/supervisors/__pycache__/statreload.cpython-312.pyc,, +uvicorn/supervisors/__pycache__/watchfilesreload.cpython-312.pyc,, +uvicorn/supervisors/basereload.py,sha256=mYOPopNS6fVTrqfQ4HzclH7Xw-VVQy7ZDSINv5_lu04,4018 +uvicorn/supervisors/multiprocess.py,sha256=_lU92Bnf_IqibFmmNoojY3J3fR6LzSBa76BpmcSMfHc,7580 +uvicorn/supervisors/statreload.py,sha256=XPaEtVXaasII1kkG32UUG8oD7-fS0FwyXkQLF9QYPbA,1548 +uvicorn/supervisors/watchfilesreload.py,sha256=u-MuYm0LsZMN670u_TtSWiMBUA2z4j1sIe3O2A67Ep4,2923 +uvicorn/workers.py,sha256=lMCubn1Wi-4h2jxrXNMmhOJZy7ZP8QxbZbP3_2O1iHE,3873 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/REQUESTED b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..ae8ec1bdaa94d726ceb907542d76cbd5d38cafcd --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.28.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b00fcb60173c5497fb24839da1837e8bdbfd98c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn-0.41.0.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +uvicorn = uvicorn.main:main diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5da02c2eaa248ec3538ecf1374263c16613fa9bb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/__init__.py @@ -0,0 +1,5 @@ +from uvicorn.config import Config +from uvicorn.main import Server, main, run + +__version__ = "0.41.0" +__all__ = ["main", "run", "Config", "Server"] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/__main__.py b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..8a1dc979a39e36ce81e987843391479f125d73f3 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/__main__.py @@ -0,0 +1,4 @@ +import uvicorn + +if __name__ == "__main__": + uvicorn.main() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/_compat.py b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/_compat.py new file mode 100644 index 0000000000000000000000000000000000000000..118a19ac0c43e518a24cf1108bfbb9dde507bd0c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/_compat.py @@ -0,0 +1,91 @@ +from __future__ import annotations + +import asyncio +import sys +from collections.abc import Callable, Coroutine +from typing import Any, TypeVar + +__all__ = ["asyncio_run", "iscoroutinefunction"] + +if sys.version_info >= (3, 14): + from inspect import iscoroutinefunction +else: + from asyncio import iscoroutinefunction + +_T = TypeVar("_T") + +if sys.version_info >= (3, 12): + asyncio_run = asyncio.run +elif sys.version_info >= (3, 11): + + def asyncio_run( + main: Coroutine[Any, Any, _T], + *, + debug: bool = False, + loop_factory: Callable[[], asyncio.AbstractEventLoop] | None = None, + ) -> _T: + # asyncio.run from Python 3.12 + # https://docs.python.org/3/license.html#psf-license + with asyncio.Runner(debug=debug, loop_factory=loop_factory) as runner: + return runner.run(main) + +else: + # modified version of asyncio.run from Python 3.10 to add loop_factory kwarg + # https://docs.python.org/3/license.html#psf-license + def asyncio_run( + main: Coroutine[Any, Any, _T], + *, + debug: bool = False, + loop_factory: Callable[[], asyncio.AbstractEventLoop] | None = None, + ) -> _T: + try: + asyncio.get_running_loop() + except RuntimeError: + pass + else: + raise RuntimeError("asyncio.run() cannot be called from a running event loop") + + if not asyncio.iscoroutine(main): + raise ValueError(f"a coroutine was expected, got {main!r}") + + if loop_factory is None: + loop = asyncio.new_event_loop() + else: + loop = loop_factory() + try: + if loop_factory is None: + asyncio.set_event_loop(loop) + if debug is not None: + loop.set_debug(debug) + return loop.run_until_complete(main) + finally: + try: + _cancel_all_tasks(loop) + loop.run_until_complete(loop.shutdown_asyncgens()) + loop.run_until_complete(loop.shutdown_default_executor()) + finally: + if loop_factory is None: + asyncio.set_event_loop(None) + loop.close() + + def _cancel_all_tasks(loop: asyncio.AbstractEventLoop) -> None: + to_cancel = asyncio.all_tasks(loop) + if not to_cancel: + return + + for task in to_cancel: + task.cancel() + + loop.run_until_complete(asyncio.gather(*to_cancel, return_exceptions=True)) + + for task in to_cancel: + if task.cancelled(): + continue + if task.exception() is not None: + loop.call_exception_handler( + { + "message": "unhandled exception during asyncio.run() shutdown", + "exception": task.exception(), + "task": task, + } + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/_subprocess.py b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/_subprocess.py new file mode 100644 index 0000000000000000000000000000000000000000..c084ec90b6a16c9e4824808d22283642e2757ded --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/_subprocess.py @@ -0,0 +1,84 @@ +""" +Some light wrappers around Python's multiprocessing, to deal with cleanly +starting child processes. +""" + +from __future__ import annotations + +import multiprocessing +import os +import sys +from collections.abc import Callable +from multiprocessing.context import SpawnProcess +from socket import socket + +from uvicorn.config import Config + +multiprocessing.allow_connection_pickling() +spawn = multiprocessing.get_context("spawn") + + +def get_subprocess( + config: Config, + target: Callable[..., None], + sockets: list[socket], +) -> SpawnProcess: + """ + Called in the parent process, to instantiate a new child process instance. + The child is not yet started at this point. + + * config - The Uvicorn configuration instance. + * target - A callable that accepts a list of sockets. In practice this will + be the `Server.run()` method. + * sockets - A list of sockets to pass to the server. Sockets are bound once + by the parent process, and then passed to the child processes. + """ + # We pass across the stdin fileno, and reopen it in the child process. + # This is required for some debugging environments. + try: + stdin_fileno = sys.stdin.fileno() + # The `sys.stdin` can be `None`, see https://docs.python.org/3/library/sys.html#sys.__stdin__. + except (AttributeError, OSError): + stdin_fileno = None + + kwargs = { + "config": config, + "target": target, + "sockets": sockets, + "stdin_fileno": stdin_fileno, + } + + return spawn.Process(target=subprocess_started, kwargs=kwargs) + + +def subprocess_started( + config: Config, + target: Callable[..., None], + sockets: list[socket], + stdin_fileno: int | None, +) -> None: + """ + Called when the child process starts. + + * config - The Uvicorn configuration instance. + * target - A callable that accepts a list of sockets. In practice this will + be the `Server.run()` method. + * sockets - A list of sockets to pass to the server. Sockets are bound once + by the parent process, and then passed to the child processes. + * stdin_fileno - The file number of sys.stdin, so that it can be reattached + to the child process. + """ + # Re-open stdin. + if stdin_fileno is not None: + sys.stdin = os.fdopen(stdin_fileno) # pragma: full coverage + + # Logging needs to be setup again for each child. + config.configure_logging() + + try: + # Now we can call into `Server.run(sockets=sockets)` + target(sockets=sockets) + except KeyboardInterrupt: # pragma: no cover + # suppress the exception to avoid a traceback from subprocess.Popen + # the parent already expects us to end, so no vital information is lost + pass diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/_types.py b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/_types.py new file mode 100644 index 0000000000000000000000000000000000000000..822445a7b58bb5b0726a9be205e8855a958dcdcf --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/_types.py @@ -0,0 +1,274 @@ +""" +Copyright (c) Django Software Foundation and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of Django nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +""" + +from __future__ import annotations + +import sys +import types +from collections.abc import Awaitable, Callable, Iterable, MutableMapping +from typing import Any, Literal, Protocol, TypedDict + +if sys.version_info >= (3, 11): # pragma: py-lt-311 + from typing import NotRequired +else: # pragma: py-gte-311 + from typing_extensions import NotRequired + +# WSGI +Environ = MutableMapping[str, Any] +ExcInfo = tuple[type[BaseException], BaseException, types.TracebackType | None] +StartResponse = Callable[[str, Iterable[tuple[str, str]], ExcInfo | None], None] +WSGIApp = Callable[[Environ, StartResponse], Iterable[bytes] | BaseException] + + +# ASGI +class ASGIVersions(TypedDict): + spec_version: str + version: Literal["2.0"] | Literal["3.0"] + + +class HTTPScope(TypedDict): + type: Literal["http"] + asgi: ASGIVersions + http_version: str + method: str + scheme: str + path: str + raw_path: bytes + query_string: bytes + root_path: str + headers: Iterable[tuple[bytes, bytes]] + client: tuple[str, int] | None + server: tuple[str, int | None] | None + state: NotRequired[dict[str, Any]] + extensions: NotRequired[dict[str, dict[object, object]]] + + +class WebSocketScope(TypedDict): + type: Literal["websocket"] + asgi: ASGIVersions + http_version: str + scheme: str + path: str + raw_path: bytes + query_string: bytes + root_path: str + headers: Iterable[tuple[bytes, bytes]] + client: tuple[str, int] | None + server: tuple[str, int | None] | None + subprotocols: Iterable[str] + state: NotRequired[dict[str, Any]] + extensions: NotRequired[dict[str, dict[object, object]]] + + +class LifespanScope(TypedDict): + type: Literal["lifespan"] + asgi: ASGIVersions + state: NotRequired[dict[str, Any]] + + +WWWScope = HTTPScope | WebSocketScope +Scope = HTTPScope | WebSocketScope | LifespanScope + + +class HTTPRequestEvent(TypedDict): + type: Literal["http.request"] + body: bytes + more_body: bool + + +class HTTPResponseDebugEvent(TypedDict): + type: Literal["http.response.debug"] + info: dict[str, object] + + +class HTTPResponseStartEvent(TypedDict): + type: Literal["http.response.start"] + status: int + headers: NotRequired[Iterable[tuple[bytes, bytes]]] + trailers: NotRequired[bool] + + +class HTTPResponseBodyEvent(TypedDict): + type: Literal["http.response.body"] + body: bytes + more_body: NotRequired[bool] + + +class HTTPResponseTrailersEvent(TypedDict): + type: Literal["http.response.trailers"] + headers: Iterable[tuple[bytes, bytes]] + more_trailers: bool + + +class HTTPServerPushEvent(TypedDict): + type: Literal["http.response.push"] + path: str + headers: Iterable[tuple[bytes, bytes]] + + +class HTTPDisconnectEvent(TypedDict): + type: Literal["http.disconnect"] + + +class WebSocketConnectEvent(TypedDict): + type: Literal["websocket.connect"] + + +class WebSocketAcceptEvent(TypedDict): + type: Literal["websocket.accept"] + subprotocol: NotRequired[str | None] + headers: NotRequired[Iterable[tuple[bytes, bytes]]] + + +class _WebSocketReceiveEventBytes(TypedDict): + type: Literal["websocket.receive"] + bytes: bytes + text: NotRequired[None] + + +class _WebSocketReceiveEventText(TypedDict): + type: Literal["websocket.receive"] + bytes: NotRequired[None] + text: str + + +WebSocketReceiveEvent = _WebSocketReceiveEventBytes | _WebSocketReceiveEventText + + +class _WebSocketSendEventBytes(TypedDict): + type: Literal["websocket.send"] + bytes: bytes + text: NotRequired[None] + + +class _WebSocketSendEventText(TypedDict): + type: Literal["websocket.send"] + bytes: NotRequired[None] + text: str + + +WebSocketSendEvent = _WebSocketSendEventBytes | _WebSocketSendEventText + + +class WebSocketResponseStartEvent(TypedDict): + type: Literal["websocket.http.response.start"] + status: int + headers: Iterable[tuple[bytes, bytes]] + + +class WebSocketResponseBodyEvent(TypedDict): + type: Literal["websocket.http.response.body"] + body: bytes + more_body: NotRequired[bool] + + +class WebSocketDisconnectEvent(TypedDict): + type: Literal["websocket.disconnect"] + code: int + reason: NotRequired[str | None] + + +class WebSocketCloseEvent(TypedDict): + type: Literal["websocket.close"] + code: NotRequired[int] + reason: NotRequired[str | None] + + +class LifespanStartupEvent(TypedDict): + type: Literal["lifespan.startup"] + + +class LifespanShutdownEvent(TypedDict): + type: Literal["lifespan.shutdown"] + + +class LifespanStartupCompleteEvent(TypedDict): + type: Literal["lifespan.startup.complete"] + + +class LifespanStartupFailedEvent(TypedDict): + type: Literal["lifespan.startup.failed"] + message: str + + +class LifespanShutdownCompleteEvent(TypedDict): + type: Literal["lifespan.shutdown.complete"] + + +class LifespanShutdownFailedEvent(TypedDict): + type: Literal["lifespan.shutdown.failed"] + message: str + + +WebSocketEvent = WebSocketReceiveEvent | WebSocketDisconnectEvent | WebSocketConnectEvent + + +ASGIReceiveEvent = ( + HTTPRequestEvent + | HTTPDisconnectEvent + | WebSocketConnectEvent + | WebSocketReceiveEvent + | WebSocketDisconnectEvent + | LifespanStartupEvent + | LifespanShutdownEvent +) + + +ASGISendEvent = ( + HTTPResponseStartEvent + | HTTPResponseBodyEvent + | HTTPResponseTrailersEvent + | HTTPServerPushEvent + | HTTPDisconnectEvent + | WebSocketAcceptEvent + | WebSocketSendEvent + | WebSocketResponseStartEvent + | WebSocketResponseBodyEvent + | WebSocketCloseEvent + | LifespanStartupCompleteEvent + | LifespanStartupFailedEvent + | LifespanShutdownCompleteEvent + | LifespanShutdownFailedEvent +) + + +ASGIReceiveCallable = Callable[[], Awaitable[ASGIReceiveEvent]] +ASGISendCallable = Callable[[ASGISendEvent], Awaitable[None]] + + +class ASGI2Protocol(Protocol): + def __init__(self, scope: Scope) -> None: ... # pragma: no cover + + async def __call__(self, receive: ASGIReceiveCallable, send: ASGISendCallable) -> None: ... # pragma: no cover + + +ASGI2Application = type[ASGI2Protocol] +ASGI3Application = Callable[[Scope, ASGIReceiveCallable, ASGISendCallable], Awaitable[None]] +ASGIApplication = ASGI2Application | ASGI3Application diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/logging.py b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/logging.py new file mode 100644 index 0000000000000000000000000000000000000000..bd16115311a2c4deb4f5de0131d5cdfb14049980 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/logging.py @@ -0,0 +1,117 @@ +from __future__ import annotations + +import http +import logging +import sys +from copy import copy +from typing import Literal + +import click + +TRACE_LOG_LEVEL = 5 + + +class ColourizedFormatter(logging.Formatter): + """ + A custom log formatter class that: + + * Outputs the LOG_LEVEL with an appropriate color. + * If a log call includes an `extra={"color_message": ...}` it will be used + for formatting the output, instead of the plain text message. + """ + + level_name_colors = { + TRACE_LOG_LEVEL: lambda level_name: click.style(str(level_name), fg="blue"), + logging.DEBUG: lambda level_name: click.style(str(level_name), fg="cyan"), + logging.INFO: lambda level_name: click.style(str(level_name), fg="green"), + logging.WARNING: lambda level_name: click.style(str(level_name), fg="yellow"), + logging.ERROR: lambda level_name: click.style(str(level_name), fg="red"), + logging.CRITICAL: lambda level_name: click.style(str(level_name), fg="bright_red"), + } + + def __init__( + self, + fmt: str | None = None, + datefmt: str | None = None, + style: Literal["%", "{", "$"] = "%", + use_colors: bool | None = None, + ): + if use_colors in (True, False): + self.use_colors = use_colors + else: + self.use_colors = sys.stdout.isatty() + super().__init__(fmt=fmt, datefmt=datefmt, style=style) + + def color_level_name(self, level_name: str, level_no: int) -> str: + def default(level_name: str) -> str: + return str(level_name) # pragma: no cover + + func = self.level_name_colors.get(level_no, default) + return func(level_name) + + def should_use_colors(self) -> bool: + return True # pragma: no cover + + def formatMessage(self, record: logging.LogRecord) -> str: + recordcopy = copy(record) + levelname = recordcopy.levelname + separator = " " * (8 - len(recordcopy.levelname)) + if self.use_colors: + levelname = self.color_level_name(levelname, recordcopy.levelno) + if "color_message" in recordcopy.__dict__: + recordcopy.msg = recordcopy.__dict__["color_message"] + recordcopy.__dict__["message"] = recordcopy.getMessage() + recordcopy.__dict__["levelprefix"] = levelname + ":" + separator + return super().formatMessage(recordcopy) + + +class DefaultFormatter(ColourizedFormatter): + def should_use_colors(self) -> bool: + return sys.stderr.isatty() # pragma: no cover + + +class AccessFormatter(ColourizedFormatter): + status_code_colours = { + 1: lambda code: click.style(str(code), fg="bright_white"), + 2: lambda code: click.style(str(code), fg="green"), + 3: lambda code: click.style(str(code), fg="yellow"), + 4: lambda code: click.style(str(code), fg="red"), + 5: lambda code: click.style(str(code), fg="bright_red"), + } + + def get_status_code(self, status_code: int) -> str: + try: + status_phrase = http.HTTPStatus(status_code).phrase + except ValueError: + status_phrase = "" + status_and_phrase = f"{status_code} {status_phrase}" + if self.use_colors: + + def default(code: int) -> str: + return status_and_phrase # pragma: no cover + + func = self.status_code_colours.get(status_code // 100, default) + return func(status_and_phrase) + return status_and_phrase + + def formatMessage(self, record: logging.LogRecord) -> str: + recordcopy = copy(record) + ( + client_addr, + method, + full_path, + http_version, + status_code, + ) = recordcopy.args # type: ignore[misc] + status_code = self.get_status_code(int(status_code)) # type: ignore[arg-type] + request_line = f"{method} {full_path} HTTP/{http_version}" + if self.use_colors: + request_line = click.style(request_line, bold=True) + recordcopy.__dict__.update( + { + "client_addr": client_addr, + "request_line": request_line, + "status_code": status_code, + } + ) + return super().formatMessage(recordcopy) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/main.py b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/main.py new file mode 100644 index 0000000000000000000000000000000000000000..93c85cb7661015e40a1ed568d692c8741a6faacb --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/main.py @@ -0,0 +1,630 @@ +from __future__ import annotations + +import asyncio +import logging +import os +import platform +import ssl +import sys +import warnings +from collections.abc import Callable +from configparser import RawConfigParser +from typing import IO, Any, get_args + +import click + +import uvicorn +from uvicorn._types import ASGIApplication +from uvicorn.config import ( + INTERFACES, + LIFESPAN, + LOG_LEVELS, + LOGGING_CONFIG, + SSL_PROTOCOL_VERSION, + Config, + HTTPProtocolType, + InterfaceType, + LifespanType, + LoopFactoryType, + WSProtocolType, +) +from uvicorn.server import Server +from uvicorn.supervisors import ChangeReload, Multiprocess + +LEVEL_CHOICES = click.Choice(list(LOG_LEVELS.keys())) +LIFESPAN_CHOICES = click.Choice(list(LIFESPAN.keys())) +INTERFACE_CHOICES = click.Choice(INTERFACES) + + +def _metavar_from_type(_type: Any) -> str: + return f"[{'|'.join(key for key in get_args(_type) if key != 'none')}]" + + +STARTUP_FAILURE = 3 + +logger = logging.getLogger("uvicorn.error") + + +def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> None: + if not value or ctx.resilient_parsing: + return + click.echo( + "Running uvicorn {version} with {py_implementation} {py_version} on {system}".format( # noqa: UP032 + version=uvicorn.__version__, + py_implementation=platform.python_implementation(), + py_version=platform.python_version(), + system=platform.system(), + ) + ) + ctx.exit() + + +@click.command(context_settings={"auto_envvar_prefix": "UVICORN"}) +@click.argument("app", envvar="UVICORN_APP") +@click.option( + "--host", + type=str, + default="127.0.0.1", + help="Bind socket to this host.", + show_default=True, +) +@click.option( + "--port", + type=int, + default=8000, + help="Bind socket to this port. If 0, an available port will be picked.", + show_default=True, +) +@click.option("--uds", type=str, default=None, help="Bind to a UNIX domain socket.") +@click.option("--fd", type=int, default=None, help="Bind to socket from this file descriptor.") +@click.option("--reload", is_flag=True, default=False, help="Enable auto-reload.") +@click.option( + "--reload-dir", + "reload_dirs", + multiple=True, + help="Set reload directories explicitly, instead of using the current working directory.", + type=click.Path(exists=True), +) +@click.option( + "--reload-include", + "reload_includes", + multiple=True, + help="Set glob patterns to include while watching for files. Includes '*.py' " + "by default; these defaults can be overridden with `--reload-exclude`. " + "This option has no effect unless watchfiles is installed.", +) +@click.option( + "--reload-exclude", + "reload_excludes", + multiple=True, + help="Set glob patterns to exclude while watching for files. Includes " + "'.*, .py[cod], .sw.*, ~*' by default; these defaults can be overridden " + "with `--reload-include`. This option has no effect unless watchfiles is " + "installed.", +) +@click.option( + "--reload-delay", + type=float, + default=0.25, + show_default=True, + help="Delay between previous and next check if application needs to be. Defaults to 0.25s.", +) +@click.option( + "--workers", + default=None, + type=int, + help="Number of worker processes. Defaults to the $WEB_CONCURRENCY environment" + " variable if available, or 1. Not valid with --reload.", +) +@click.option( + "--loop", + type=str, + metavar=_metavar_from_type(LoopFactoryType), + default="auto", + help="Event loop factory implementation.", + show_default=True, +) +@click.option( + "--http", + type=str, + metavar=_metavar_from_type(HTTPProtocolType), + default="auto", + help="HTTP protocol implementation.", + show_default=True, +) +@click.option( + "--ws", + type=str, + metavar=_metavar_from_type(WSProtocolType), + default="auto", + help="WebSocket protocol implementation.", + show_default=True, +) +@click.option( + "--ws-max-size", + type=int, + default=16777216, + help="WebSocket max size message in bytes", + show_default=True, +) +@click.option( + "--ws-max-queue", + type=int, + default=32, + help="The maximum length of the WebSocket message queue.", + show_default=True, +) +@click.option( + "--ws-ping-interval", + type=float, + default=20.0, + help="WebSocket ping interval in seconds.", + show_default=True, +) +@click.option( + "--ws-ping-timeout", + type=float, + default=20.0, + help="WebSocket ping timeout in seconds.", + show_default=True, +) +@click.option( + "--ws-per-message-deflate", + type=bool, + default=True, + help="WebSocket per-message-deflate compression", + show_default=True, +) +@click.option( + "--lifespan", + type=LIFESPAN_CHOICES, + default="auto", + help="Lifespan implementation.", + show_default=True, +) +@click.option( + "--interface", + type=INTERFACE_CHOICES, + default="auto", + help="Select ASGI3, ASGI2, or WSGI as the application interface.", + show_default=True, +) +@click.option( + "--env-file", + type=click.Path(exists=True), + default=None, + help="Environment configuration file.", + show_default=True, +) +@click.option( + "--log-config", + type=click.Path(exists=True), + default=None, + help="Logging configuration file. Supported formats: .ini, .json, .yaml.", + show_default=True, +) +@click.option( + "--log-level", + type=LEVEL_CHOICES, + default=None, + help="Log level. [default: info]", + show_default=True, +) +@click.option( + "--access-log/--no-access-log", + is_flag=True, + default=True, + help="Enable/Disable access log.", +) +@click.option( + "--use-colors/--no-use-colors", + is_flag=True, + default=None, + help="Enable/Disable colorized logging.", +) +@click.option( + "--proxy-headers/--no-proxy-headers", + is_flag=True, + default=True, + help="Enable/Disable X-Forwarded-Proto, X-Forwarded-For to populate url scheme and remote address info.", +) +@click.option( + "--server-header/--no-server-header", + is_flag=True, + default=True, + help="Enable/Disable default Server header.", +) +@click.option( + "--date-header/--no-date-header", + is_flag=True, + default=True, + help="Enable/Disable default Date header.", +) +@click.option( + "--forwarded-allow-ips", + type=str, + default=None, + help="Comma separated list of IP Addresses, IP Networks, or literals " + "(e.g. UNIX Socket path) to trust with proxy headers. Defaults to the " + "$FORWARDED_ALLOW_IPS environment variable if available, or '127.0.0.1'. " + "The literal '*' means trust everything.", +) +@click.option( + "--root-path", + type=str, + default="", + help="Set the ASGI 'root_path' for applications submounted below a given URL path.", +) +@click.option( + "--limit-concurrency", + type=int, + default=None, + help="Maximum number of concurrent connections or tasks to allow, before issuing HTTP 503 responses.", +) +@click.option( + "--backlog", + type=int, + default=2048, + help="Maximum number of connections to hold in backlog", +) +@click.option( + "--limit-max-requests", + type=int, + default=None, + help="Maximum number of requests to service before terminating the process.", +) +@click.option( + "--limit-max-requests-jitter", + type=int, + default=0, + help="Maximum jitter to add to limit_max_requests." + " Staggers worker restarts to avoid all workers restarting simultaneously.", + show_default=True, +) +@click.option( + "--timeout-keep-alive", + type=int, + default=5, + help="Close Keep-Alive connections if no new data is received within this timeout (in seconds).", + show_default=True, +) +@click.option( + "--timeout-graceful-shutdown", + type=int, + default=None, + help="Maximum number of seconds to wait for graceful shutdown.", +) +@click.option( + "--timeout-worker-healthcheck", + type=int, + default=5, + help="Maximum number of seconds to wait for a worker to respond to a healthcheck.", + show_default=True, +) +@click.option("--ssl-keyfile", type=str, default=None, help="SSL key file", show_default=True) +@click.option( + "--ssl-certfile", + type=str, + default=None, + help="SSL certificate file", + show_default=True, +) +@click.option( + "--ssl-keyfile-password", + type=str, + default=None, + help="SSL keyfile password", + show_default=True, +) +@click.option( + "--ssl-version", + type=int, + default=int(SSL_PROTOCOL_VERSION), + help="SSL version to use (see stdlib ssl module's)", + show_default=True, +) +@click.option( + "--ssl-cert-reqs", + type=int, + default=int(ssl.CERT_NONE), + help="Whether client certificate is required (see stdlib ssl module's)", + show_default=True, +) +@click.option( + "--ssl-ca-certs", + type=str, + default=None, + help="CA certificates file", + show_default=True, +) +@click.option( + "--ssl-ciphers", + type=str, + default="TLSv1", + help="Ciphers to use (see stdlib ssl module's)", + show_default=True, +) +@click.option( + "--header", + "headers", + multiple=True, + help="Specify custom default HTTP response headers as a Name:Value pair", +) +@click.option( + "--version", + is_flag=True, + callback=print_version, + expose_value=False, + is_eager=True, + help="Display the uvicorn version and exit.", +) +@click.option( + "--app-dir", + default="", + show_default=True, + help="Look for APP in the specified directory, by adding this to the PYTHONPATH." + " Defaults to the current working directory.", +) +@click.option( + "--h11-max-incomplete-event-size", + "h11_max_incomplete_event_size", + type=int, + default=None, + help="For h11, the maximum number of bytes to buffer of an incomplete event.", +) +@click.option( + "--factory", + is_flag=True, + default=False, + help="Treat APP as an application factory, i.e. a () -> callable.", + show_default=True, +) +def main( + app: str, + host: str, + port: int, + uds: str, + fd: int, + loop: LoopFactoryType | str, + http: HTTPProtocolType | str, + ws: WSProtocolType | str, + ws_max_size: int, + ws_max_queue: int, + ws_ping_interval: float, + ws_ping_timeout: float, + ws_per_message_deflate: bool, + lifespan: LifespanType, + interface: InterfaceType, + reload: bool, + reload_dirs: list[str], + reload_includes: list[str], + reload_excludes: list[str], + reload_delay: float, + workers: int, + env_file: str, + log_config: str, + log_level: str, + access_log: bool, + proxy_headers: bool, + server_header: bool, + date_header: bool, + forwarded_allow_ips: str, + root_path: str, + limit_concurrency: int, + backlog: int, + limit_max_requests: int, + limit_max_requests_jitter: int, + timeout_keep_alive: int, + timeout_graceful_shutdown: int | None, + timeout_worker_healthcheck: int, + ssl_keyfile: str, + ssl_certfile: str, + ssl_keyfile_password: str, + ssl_version: int, + ssl_cert_reqs: int, + ssl_ca_certs: str, + ssl_ciphers: str, + headers: list[str], + use_colors: bool, + app_dir: str, + h11_max_incomplete_event_size: int | None, + factory: bool, +) -> None: + run( + app, + host=host, + port=port, + uds=uds, + fd=fd, + loop=loop, + http=http, + ws=ws, + ws_max_size=ws_max_size, + ws_max_queue=ws_max_queue, + ws_ping_interval=ws_ping_interval, + ws_ping_timeout=ws_ping_timeout, + ws_per_message_deflate=ws_per_message_deflate, + lifespan=lifespan, + env_file=env_file, + log_config=LOGGING_CONFIG if log_config is None else log_config, + log_level=log_level, + access_log=access_log, + interface=interface, + reload=reload, + reload_dirs=reload_dirs or None, + reload_includes=reload_includes or None, + reload_excludes=reload_excludes or None, + reload_delay=reload_delay, + workers=workers, + proxy_headers=proxy_headers, + server_header=server_header, + date_header=date_header, + forwarded_allow_ips=forwarded_allow_ips, + root_path=root_path, + limit_concurrency=limit_concurrency, + backlog=backlog, + limit_max_requests=limit_max_requests, + limit_max_requests_jitter=limit_max_requests_jitter, + timeout_keep_alive=timeout_keep_alive, + timeout_graceful_shutdown=timeout_graceful_shutdown, + timeout_worker_healthcheck=timeout_worker_healthcheck, + ssl_keyfile=ssl_keyfile, + ssl_certfile=ssl_certfile, + ssl_keyfile_password=ssl_keyfile_password, + ssl_version=ssl_version, + ssl_cert_reqs=ssl_cert_reqs, + ssl_ca_certs=ssl_ca_certs, + ssl_ciphers=ssl_ciphers, + headers=[header.split(":", 1) for header in headers], # type: ignore[misc] + use_colors=use_colors, + factory=factory, + app_dir=app_dir, + h11_max_incomplete_event_size=h11_max_incomplete_event_size, + ) + + +def run( + app: ASGIApplication | Callable[..., Any] | str, + *, + host: str = "127.0.0.1", + port: int = 8000, + uds: str | None = None, + fd: int | None = None, + loop: LoopFactoryType | str = "auto", + http: type[asyncio.Protocol] | HTTPProtocolType | str = "auto", + ws: type[asyncio.Protocol] | WSProtocolType | str = "auto", + ws_max_size: int = 16777216, + ws_max_queue: int = 32, + ws_ping_interval: float | None = 20.0, + ws_ping_timeout: float | None = 20.0, + ws_per_message_deflate: bool = True, + lifespan: LifespanType = "auto", + interface: InterfaceType = "auto", + reload: bool = False, + reload_dirs: list[str] | str | None = None, + reload_includes: list[str] | str | None = None, + reload_excludes: list[str] | str | None = None, + reload_delay: float = 0.25, + workers: int | None = None, + env_file: str | os.PathLike[str] | None = None, + log_config: dict[str, Any] | str | RawConfigParser | IO[Any] | None = LOGGING_CONFIG, + log_level: str | int | None = None, + access_log: bool = True, + proxy_headers: bool = True, + server_header: bool = True, + date_header: bool = True, + forwarded_allow_ips: list[str] | str | None = None, + root_path: str = "", + limit_concurrency: int | None = None, + backlog: int = 2048, + limit_max_requests: int | None = None, + limit_max_requests_jitter: int = 0, + timeout_keep_alive: int = 5, + timeout_graceful_shutdown: int | None = None, + timeout_worker_healthcheck: int = 5, + ssl_keyfile: str | os.PathLike[str] | None = None, + ssl_certfile: str | os.PathLike[str] | None = None, + ssl_keyfile_password: str | None = None, + ssl_version: int = SSL_PROTOCOL_VERSION, + ssl_cert_reqs: int = ssl.CERT_NONE, + ssl_ca_certs: str | os.PathLike[str] | None = None, + ssl_ciphers: str = "TLSv1", + headers: list[tuple[str, str]] | None = None, + use_colors: bool | None = None, + app_dir: str | None = None, + factory: bool = False, + h11_max_incomplete_event_size: int | None = None, +) -> None: + if app_dir is not None: + sys.path.insert(0, app_dir) + + config = Config( + app, + host=host, + port=port, + uds=uds, + fd=fd, + loop=loop, + http=http, + ws=ws, + ws_max_size=ws_max_size, + ws_max_queue=ws_max_queue, + ws_ping_interval=ws_ping_interval, + ws_ping_timeout=ws_ping_timeout, + ws_per_message_deflate=ws_per_message_deflate, + lifespan=lifespan, + interface=interface, + reload=reload, + reload_dirs=reload_dirs, + reload_includes=reload_includes, + reload_excludes=reload_excludes, + reload_delay=reload_delay, + workers=workers, + env_file=env_file, + log_config=log_config, + log_level=log_level, + access_log=access_log, + proxy_headers=proxy_headers, + server_header=server_header, + date_header=date_header, + forwarded_allow_ips=forwarded_allow_ips, + root_path=root_path, + limit_concurrency=limit_concurrency, + backlog=backlog, + limit_max_requests=limit_max_requests, + limit_max_requests_jitter=limit_max_requests_jitter, + timeout_keep_alive=timeout_keep_alive, + timeout_graceful_shutdown=timeout_graceful_shutdown, + timeout_worker_healthcheck=timeout_worker_healthcheck, + ssl_keyfile=ssl_keyfile, + ssl_certfile=ssl_certfile, + ssl_keyfile_password=ssl_keyfile_password, + ssl_version=ssl_version, + ssl_cert_reqs=ssl_cert_reqs, + ssl_ca_certs=ssl_ca_certs, + ssl_ciphers=ssl_ciphers, + headers=headers, + use_colors=use_colors, + factory=factory, + h11_max_incomplete_event_size=h11_max_incomplete_event_size, + ) + server = Server(config=config) + + if (config.reload or config.workers > 1) and not isinstance(app, str): + logger = logging.getLogger("uvicorn.error") + logger.warning("You must pass the application as an import string to enable 'reload' or 'workers'.") + sys.exit(1) + + try: + if config.should_reload: + sock = config.bind_socket() + ChangeReload(config, target=server.run, sockets=[sock]).run() + elif config.workers > 1: + sock = config.bind_socket() + Multiprocess(config, target=server.run, sockets=[sock]).run() + else: + server.run() + except KeyboardInterrupt: + pass # pragma: full coverage + finally: + if config.uds and os.path.exists(config.uds): + os.remove(config.uds) # pragma: py-win32 + + if not server.started and not config.should_reload and config.workers == 1: + sys.exit(STARTUP_FAILURE) + + +def __getattr__(name: str) -> Any: + if name == "ServerState": + warnings.warn( + "uvicorn.main.ServerState is deprecated, use uvicorn.server.ServerState instead.", + DeprecationWarning, + ) + from uvicorn.server import ServerState + + return ServerState + raise AttributeError(f"module {__name__} has no attribute {name}") + + +if __name__ == "__main__": + main() # pragma: no cover diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/py.typed b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/py.typed @@ -0,0 +1 @@ + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/server.py b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/server.py new file mode 100644 index 0000000000000000000000000000000000000000..938a6aaa905035fdd0b4af66133a89cefacd73f5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/server.py @@ -0,0 +1,346 @@ +from __future__ import annotations + +import asyncio +import contextlib +import functools +import logging +import os +import platform +import random +import signal +import socket +import sys +import threading +import time +from collections.abc import Generator, Sequence +from email.utils import formatdate +from types import FrameType +from typing import TYPE_CHECKING, TypeAlias + +import click + +from uvicorn._compat import asyncio_run +from uvicorn.config import Config + +if TYPE_CHECKING: + from uvicorn.protocols.http.h11_impl import H11Protocol + from uvicorn.protocols.http.httptools_impl import HttpToolsProtocol + from uvicorn.protocols.websockets.websockets_impl import WebSocketProtocol + from uvicorn.protocols.websockets.websockets_sansio_impl import WebSocketsSansIOProtocol + from uvicorn.protocols.websockets.wsproto_impl import WSProtocol + + Protocols: TypeAlias = H11Protocol | HttpToolsProtocol | WSProtocol | WebSocketProtocol | WebSocketsSansIOProtocol + +HANDLED_SIGNALS = ( + signal.SIGINT, # Unix signal 2. Sent by Ctrl+C. + signal.SIGTERM, # Unix signal 15. Sent by `kill `. +) +if sys.platform == "win32": # pragma: py-not-win32 + HANDLED_SIGNALS += (signal.SIGBREAK,) # Windows signal 21. Sent by Ctrl+Break. + +logger = logging.getLogger("uvicorn.error") + + +class ServerState: + """ + Shared servers state that is available between all protocol instances. + """ + + def __init__(self) -> None: + self.total_requests = 0 + self.connections: set[Protocols] = set() + self.tasks: set[asyncio.Task[None]] = set() + self.default_headers: list[tuple[bytes, bytes]] = [] + + +class Server: + def __init__(self, config: Config) -> None: + self.config = config + self.server_state = ServerState() + + self.started = False + self.should_exit = False + self.force_exit = False + self.last_notified = 0.0 + + self._captured_signals: list[int] = [] + + @functools.cached_property + def limit_max_requests(self) -> int | None: + if self.config.limit_max_requests is None: + return None + return self.config.limit_max_requests + random.randint(0, self.config.limit_max_requests_jitter) + + def run(self, sockets: list[socket.socket] | None = None) -> None: + return asyncio_run(self.serve(sockets=sockets), loop_factory=self.config.get_loop_factory()) + + async def serve(self, sockets: list[socket.socket] | None = None) -> None: + with self.capture_signals(): + await self._serve(sockets) + + async def _serve(self, sockets: list[socket.socket] | None = None) -> None: + process_id = os.getpid() + + config = self.config + if not config.loaded: + config.load() + + self.lifespan = config.lifespan_class(config) + + message = "Started server process [%d]" + color_message = "Started server process [" + click.style("%d", fg="cyan") + "]" + logger.info(message, process_id, extra={"color_message": color_message}) + + await self.startup(sockets=sockets) + if not self.should_exit: + await self.main_loop() + if self.started: + await self.shutdown(sockets=sockets) + + message = "Finished server process [%d]" + color_message = "Finished server process [" + click.style("%d", fg="cyan") + "]" + logger.info(message, process_id, extra={"color_message": color_message}) + + async def startup(self, sockets: list[socket.socket] | None = None) -> None: + await self.lifespan.startup() + if self.lifespan.should_exit: + self.should_exit = True + return + + config = self.config + + def create_protocol( + _loop: asyncio.AbstractEventLoop | None = None, + ) -> asyncio.Protocol: + return config.http_protocol_class( # type: ignore[call-arg] + config=config, + server_state=self.server_state, + app_state=self.lifespan.state, + _loop=_loop, + ) + + loop = asyncio.get_running_loop() + + listeners: Sequence[socket.SocketType] + if sockets is not None: # pragma: full coverage + # Explicitly passed a list of open sockets. + # We use this when the server is run from a Gunicorn worker. + + def _share_socket( + sock: socket.SocketType, + ) -> socket.SocketType: # pragma py-not-win32 + # Windows requires the socket be explicitly shared across + # multiple workers (processes). + from socket import fromshare # type: ignore[attr-defined] + + sock_data = sock.share(os.getpid()) # type: ignore[attr-defined] + return fromshare(sock_data) + + self.servers: list[asyncio.base_events.Server] = [] + for sock in sockets: + is_windows = platform.system() == "Windows" + if config.workers > 1 and is_windows: # pragma: py-not-win32 + sock = _share_socket(sock) # type: ignore[assignment] + server = await loop.create_server(create_protocol, sock=sock, ssl=config.ssl, backlog=config.backlog) + self.servers.append(server) + listeners = sockets + + elif config.fd is not None: # pragma: py-win32 + # Use an existing socket, from a file descriptor. + sock = socket.fromfd(config.fd, socket.AF_UNIX, socket.SOCK_STREAM) + server = await loop.create_server(create_protocol, sock=sock, ssl=config.ssl, backlog=config.backlog) + assert server.sockets is not None # mypy + listeners = server.sockets + self.servers = [server] + + elif config.uds is not None: # pragma: py-win32 + # Create a socket using UNIX domain socket. + uds_perms = 0o666 + if os.path.exists(config.uds): + uds_perms = os.stat(config.uds).st_mode # pragma: full coverage + server = await loop.create_unix_server( + create_protocol, path=config.uds, ssl=config.ssl, backlog=config.backlog + ) + os.chmod(config.uds, uds_perms) + assert server.sockets is not None # mypy + listeners = server.sockets + self.servers = [server] + + else: + # Standard case. Create a socket from a host/port pair. + try: + server = await loop.create_server( + create_protocol, + host=config.host, + port=config.port, + ssl=config.ssl, + backlog=config.backlog, + ) + except OSError as exc: + logger.error(exc) + await self.lifespan.shutdown() + sys.exit(1) + + assert server.sockets is not None + listeners = server.sockets + self.servers = [server] + + if sockets is None: + self._log_started_message(listeners) + else: + # We're most likely running multiple workers, so a message has already been + # logged by `config.bind_socket()`. + pass # pragma: full coverage + + self.started = True + + def _log_started_message(self, listeners: Sequence[socket.SocketType]) -> None: + config = self.config + + if config.fd is not None: # pragma: py-win32 + sock = listeners[0] + logger.info( + "Uvicorn running on socket %s (Press CTRL+C to quit)", + sock.getsockname(), + ) + + elif config.uds is not None: # pragma: py-win32 + logger.info("Uvicorn running on unix socket %s (Press CTRL+C to quit)", config.uds) + + else: + addr_format = "%s://%s:%d" + host = "0.0.0.0" if config.host is None else config.host + if ":" in host: + # It's an IPv6 address. + addr_format = "%s://[%s]:%d" + + port = config.port + if port == 0: + port = listeners[0].getsockname()[1] + + protocol_name = "https" if config.ssl else "http" + message = f"Uvicorn running on {addr_format} (Press CTRL+C to quit)" + color_message = "Uvicorn running on " + click.style(addr_format, bold=True) + " (Press CTRL+C to quit)" + logger.info( + message, + protocol_name, + host, + port, + extra={"color_message": color_message}, + ) + + async def main_loop(self) -> None: + counter = 0 + should_exit = await self.on_tick(counter) + while not should_exit: + counter += 1 + counter = counter % 864000 + await asyncio.sleep(0.1) + should_exit = await self.on_tick(counter) + + async def on_tick(self, counter: int) -> bool: + # Update the default headers, once per second. + if counter % 10 == 0: + current_time = time.time() + current_date = formatdate(current_time, usegmt=True).encode() + + if self.config.date_header: + date_header = [(b"date", current_date)] + else: + date_header = [] + + self.server_state.default_headers = date_header + self.config.encoded_headers + + # Callback to `callback_notify` once every `timeout_notify` seconds. + if self.config.callback_notify is not None: + if current_time - self.last_notified > self.config.timeout_notify: # pragma: full coverage + self.last_notified = current_time + await self.config.callback_notify() + + # Determine if we should exit. + if self.should_exit: + return True + + max_requests = self.limit_max_requests + if max_requests is not None and self.server_state.total_requests >= max_requests: + logger.info("Maximum request limit of %d exceeded. Terminating process.", max_requests) + return True + + return False + + async def shutdown(self, sockets: list[socket.socket] | None = None) -> None: + logger.info("Shutting down") + + # Stop accepting new connections. + for server in self.servers: + server.close() + for sock in sockets or []: + sock.close() # pragma: full coverage + + # Request shutdown on all existing connections. + for connection in list(self.server_state.connections): + connection.shutdown() + await asyncio.sleep(0.1) + + # When 3.10 is not supported anymore, use `async with asyncio.timeout(...):`. + try: + await asyncio.wait_for( + self._wait_tasks_to_complete(), + timeout=self.config.timeout_graceful_shutdown, + ) + except asyncio.TimeoutError: + logger.error( + "Cancel %s running task(s), timeout graceful shutdown exceeded", + len(self.server_state.tasks), + ) + for t in self.server_state.tasks: + t.cancel(msg="Task cancelled, timeout graceful shutdown exceeded") + + # Send the lifespan shutdown event, and wait for application shutdown. + if not self.force_exit: + await self.lifespan.shutdown() + + async def _wait_tasks_to_complete(self) -> None: + # Wait for existing connections to finish sending responses. + if self.server_state.connections and not self.force_exit: + msg = "Waiting for connections to close. (CTRL+C to force quit)" + logger.info(msg) + while self.server_state.connections and not self.force_exit: + await asyncio.sleep(0.1) + + # Wait for existing tasks to complete. + if self.server_state.tasks and not self.force_exit: + msg = "Waiting for background tasks to complete. (CTRL+C to force quit)" + logger.info(msg) + while self.server_state.tasks and not self.force_exit: + await asyncio.sleep(0.1) + + for server in self.servers: + await server.wait_closed() + + @contextlib.contextmanager + def capture_signals(self) -> Generator[None, None, None]: + # Signals can only be listened to from the main thread. + if threading.current_thread() is not threading.main_thread(): + yield + return + # always use signal.signal, even if loop.add_signal_handler is available + # this allows to restore previous signal handlers later on + original_handlers = {sig: signal.signal(sig, self.handle_exit) for sig in HANDLED_SIGNALS} + try: + yield + finally: + for sig, handler in original_handlers.items(): + signal.signal(sig, handler) + # If we did gracefully shut down due to a signal, try to + # trigger the expected behaviour now; multiple signals would be + # done LIFO, see https://stackoverflow.com/questions/48434964 + for captured_signal in reversed(self._captured_signals): + signal.raise_signal(captured_signal) + + def handle_exit(self, sig: int, frame: FrameType | None) -> None: + self._captured_signals.append(sig) + if self.should_exit and sig == signal.SIGINT: + self.force_exit = True # pragma: full coverage + else: + self.should_exit = True diff --git a/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/workers.py b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/workers.py new file mode 100644 index 0000000000000000000000000000000000000000..827d091c0f1693a43ae030b55e6ff79f7a552192 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/uvicorn/workers.py @@ -0,0 +1,111 @@ +from __future__ import annotations + +import asyncio +import logging +import signal +import sys +import warnings +from typing import Any + +from gunicorn.arbiter import Arbiter +from gunicorn.workers.base import Worker + +from uvicorn._compat import asyncio_run +from uvicorn.config import Config +from uvicorn.server import Server + +warnings.warn( + "The `uvicorn.workers` module is deprecated. Please use `uvicorn-worker` package instead.\n" + "For more details, see https://github.com/Kludex/uvicorn-worker.", + DeprecationWarning, +) + + +class UvicornWorker(Worker): + """ + A worker class for Gunicorn that interfaces with an ASGI consumer callable, + rather than a WSGI callable. + """ + + CONFIG_KWARGS: dict[str, Any] = {"loop": "auto", "http": "auto"} + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + logger = logging.getLogger("uvicorn.error") + logger.handlers = self.log.error_log.handlers + logger.setLevel(self.log.error_log.level) + logger.propagate = False + + logger = logging.getLogger("uvicorn.access") + logger.handlers = self.log.access_log.handlers + logger.setLevel(self.log.access_log.level) + logger.propagate = False + + config_kwargs: dict = { + "app": None, + "log_config": None, + "timeout_keep_alive": self.cfg.keepalive, + "timeout_notify": self.timeout, + "callback_notify": self.callback_notify, + "limit_max_requests": self.max_requests, + "forwarded_allow_ips": self.cfg.forwarded_allow_ips, + } + + if self.cfg.is_ssl: + ssl_kwargs = { + "ssl_keyfile": self.cfg.ssl_options.get("keyfile"), + "ssl_certfile": self.cfg.ssl_options.get("certfile"), + "ssl_keyfile_password": self.cfg.ssl_options.get("password"), + "ssl_version": self.cfg.ssl_options.get("ssl_version"), + "ssl_cert_reqs": self.cfg.ssl_options.get("cert_reqs"), + "ssl_ca_certs": self.cfg.ssl_options.get("ca_certs"), + "ssl_ciphers": self.cfg.ssl_options.get("ciphers"), + } + config_kwargs.update(ssl_kwargs) + + if self.cfg.settings["backlog"].value: + config_kwargs["backlog"] = self.cfg.settings["backlog"].value + + config_kwargs.update(self.CONFIG_KWARGS) + + self.config = Config(**config_kwargs) + + def init_signals(self) -> None: + # Reset signals so Gunicorn doesn't swallow subprocess return codes + # other signals are set up by Server.install_signal_handlers() + # See: https://github.com/Kludex/uvicorn/issues/894 + for s in self.SIGNALS: + signal.signal(s, signal.SIG_DFL) + + signal.signal(signal.SIGUSR1, self.handle_usr1) + # Don't let SIGUSR1 disturb active requests by interrupting system calls + signal.siginterrupt(signal.SIGUSR1, False) + + def _install_sigquit_handler(self) -> None: + """Install a SIGQUIT handler on workers. + + - https://github.com/Kludex/uvicorn/issues/1116 + - https://github.com/benoitc/gunicorn/issues/2604 + """ + + loop = asyncio.get_running_loop() + loop.add_signal_handler(signal.SIGQUIT, self.handle_exit, signal.SIGQUIT, None) + + async def _serve(self) -> None: + self.config.app = self.wsgi + server = Server(config=self.config) + self._install_sigquit_handler() + await server.serve(sockets=self.sockets) + if not server.started: + sys.exit(Arbiter.WORKER_BOOT_ERROR) + + def run(self) -> None: + return asyncio_run(self._serve(), loop_factory=self.config.get_loop_factory()) + + async def callback_notify(self) -> None: + self.notify() + + +class UvicornH11Worker(UvicornWorker): + CONFIG_KWARGS = {"loop": "asyncio", "http": "h11"} diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/LICENSE b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..ac46402056a55ae34cd45ef49ac9005d8abd6474 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2018 Ines Montani + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..4b25b2ca50bbee6748c42aa4d9de46858686579f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/METADATA @@ -0,0 +1,579 @@ +Metadata-Version: 2.1 +Name: wasabi +Version: 1.1.3 +Summary: A lightweight console printing and formatting toolkit +Home-page: https://github.com/explosion/wasabi +Author: Explosion +Author-email: contact@explosion.ai +License: MIT +Requires-Python: >=3.6 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: typing-extensions <5.0.0,>=3.7.4.1 ; python_version < "3.8" +Requires-Dist: colorama >=0.4.6 ; sys_platform == "win32" and python_version >= "3.7" + +# wasabi: A lightweight console printing and formatting toolkit + +Over the years, I've written countless implementations of coloring and +formatting utilities to output messages in our libraries like +[spaCy](https://spacy.io), [Thinc](https://github.com/explosion/thinc) and +[Prodigy](https://prodi.gy). While there are many other great open-source +options, I've always ended up wanting something slightly different or slightly +custom. + +This package is still a work in progress and aims to bundle those utilities in a +standardised way so they can be shared across our other projects. It's super +lightweight, has zero dependencies and works with Python 3.6+. + +[![tests](https://github.com/explosion/wasabi/actions/workflows/tests.yml/badge.svg)](https://github.com/explosion/wasabi/actions/workflows/tests.yml) +[![PyPi](https://img.shields.io/pypi/v/wasabi.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.python.org/pypi/wasabi) +[![conda](https://img.shields.io/conda/vn/conda-forge/wasabi.svg?style=flat-square&logo=conda-forge/logoColor=white)](https://anaconda.org/conda-forge/wasabi) +[![GitHub](https://img.shields.io/github/release/ines/wasabi/all.svg?style=flat-square&logo=github)](https://github.com/ines/wasabi) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/ambv/black) + + + +## 💬 FAQ + +### Are you going to add more features? + +Yes, there's still a few of helpers and features to port over. However, the new +features will be heavily biased by what we (think we) need. I always appreciate +pull requests to improve the existing functionality – but I want to keep this +library as simple, lightweight and specific as possible. + +### Can I use this for my projects? + +Sure, if you like it, feel free to adopt it! Just keep in mind that the package +is very specific and not intended to be a full-featured and fully customisable +formatting library. If that's what you're looking for, you might want to try +other packages – for example, [`colored`](https://pypi.org/project/colored/), +[`crayons`](https://github.com/kennethreitz/crayons), +[`colorful`](https://github.com/timofurrer/colorful), +[`tabulate`](https://bitbucket.org/astanin/python-tabulate), +[`console`](https://github.com/mixmastamyk/console) or +[`py-term`](https://github.com/gravmatt/py-term), to name a few. + +### Why `wasabi`? + +I was looking for a short and descriptive name, but everything was already +taken. So I ended up naming this package after one of my rats, Wasabi. 🐀 + +## ⌛️ Installation + +```bash +pip install wasabi +``` + +## 🎛 API + +### function `msg` + +An instance of `Printer`, initialized with the default config. Useful as a quick +shortcut if you don't need to customize initialization. + +```python +from wasabi import msg + +msg.good("Success!") +``` + +### class `Printer` + +#### method `Printer.__init__` + +```python +from wasabi import Printer + +msg = Printer() +``` + +| Argument | Type | Description | Default | +| ----------------- | --------- | ------------------------------------------------------------- | ------------- | +| `pretty` | bool | Pretty-print output with colors and icons. | `True` | +| `no_print` | bool | Don't actually print, just return. | `False` | +| `colors` | dict | Add or overwrite color values, names mapped to `0`-`256`. | `None` | +| `icons` | dict | Add or overwrite icon. Name mapped to unicode. | `None` | +| `line_max` | int | Maximum line length (for divider). | `80` | +| `animation` | str | Steps of loading animation for `Printer.loading`. | `"⠙⠹⠸⠼⠴⠦⠧⠇⠏"` | +| `animation_ascii` | str | Alternative animation for ASCII terminals. | `"\|/-\\"` | +| `hide_animation` | bool | Don't display animation, e.g. for logs. | `False` | +| `ignore_warnings` | bool | Don't output messages of type `MESSAGE.WARN`. | `False` | +| `env_prefix` | str | Prefix for environment variables, e.g. `WASABI_LOG_FRIENDLY`. | `"WASABI"` | +| `timestamp` | bool | Add timestamp before output. | `False` | +| **RETURNS** | `Printer` | The initialized printer. | - | + +#### method `Printer.text` + +```python +msg = Printer() +msg.text("Hello world!") +``` + +| Argument | Type | Description | Default | +| ---------- | -------------- | ---------------------------------------------------------------------------------------------------------------------- | ------- | +| `title` | str | The main text to print. | `""` | +| `text` | str | Optional additional text to print. | `""` | +| `color` |  unicode / int | Color name or value. | `None` | +| `icon` | str | Name of icon to add. | `None` | +| `show` | bool | Whether to print or not. Can be used to only output messages under certain condition, e.g. if `--verbose` flag is set. | `True` | +| `spaced` | bool | Whether to add newlines around the output. | `False` | +| `no_print` | bool | Don't actually print, just return. Overwrites global setting. | `False` | +| `exits` | int | If set, perform a system exit with the given code after printing. | `None` | + +#### method `Printer.good`, `Printer.fail`, `Printer.warn`, `Printer.info` + +Print special formatted messages. + +```python +msg = Printer() +msg.good("Success") +msg.fail("Error") +msg.warn("Warning") +msg.info("Info") +``` + +| Argument | Type | Description | Default | +| -------- | ---- | ---------------------------------------------------------------------------------------------------------------------- | ------- | +| `title` | str | The main text to print. | `""` | +| `text` | str | Optional additional text to print. | `""` | +| `show` | bool | Whether to print or not. Can be used to only output messages under certain condition, e.g. if `--verbose` flag is set. | `True` | +| `exits` | int | If set, perform a system exit with the given code after printing. | `None` | + +#### method `Printer.divider` + +Print a formatted divider. + +```python +msg = Printer() +msg.divider("Heading") +``` + +| Argument | Type | Description | Default | +| -------- | ---- | ---------------------------------------------------------------------------------------------------------------------- | ------- | +| `text` | str | Headline text. If empty, only the line is printed. | `""` | +| `char` | str | Single line character to repeat. | `"="` | +| `show` | bool | Whether to print or not. Can be used to only output messages under certain condition, e.g. if `--verbose` flag is set. | `True` | +| `icon` | str | Optional icon to use with title. | `None` | + +#### contextmanager `Printer.loading` + +```python +msg = Printer() +with msg.loading("Loading..."): + # Do something here that takes longer + time.sleep(10) +msg.good("Successfully loaded something!") +``` + +| Argument | Type | Description | Default | +| -------- | ---- | ---------------------------------- | -------------- | +| `text` | str | The text to display while loading. | `"Loading..."` | + +#### method `Printer.table`, `Printer.row` + +See [Tables](#tables). + +#### property `Printer.counts` + +Get the counts of how often the special printers were fired, e.g. +`MESSAGES.GOOD`. Can be used to print an overview like "X warnings" + +```python +msg = Printer() +msg.good("Success") +msg.fail("Error") +msg.warn("Error") + +print(msg.counts) +# Counter({'good': 1, 'fail': 2, 'warn': 0, 'info': 0}) +``` + +| Argument | Type | Description | +| ----------- | --------- | ---------------------------------------------------- | +| **RETURNS** | `Counter` | The counts for the individual special message types. | + +### Tables + +#### function `table` + +Lightweight helper to format tabular data. + +```python +from wasabi import table + +data = [("a1", "a2", "a3"), ("b1", "b2", "b3")] +header = ("Column 1", "Column 2", "Column 3") +widths = (8, 9, 10) +aligns = ("r", "c", "l") +formatted = table(data, header=header, divider=True, widths=widths, aligns=aligns) +``` + +``` +Column 1 Column 2 Column 3 +-------- --------- ---------- + a1 a2 a3 + b1 b2 b3 +``` + +| Argument | Type | Description | Default | +| -------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ---------- | +| `data` | iterable / dict | The data to render. Either a list of lists (one per row) or a dict for two-column tables. | | +| `header` | iterable | Optional header columns. | `None` | +| `footer` | iterable | Optional footer columns. | `None` | +| `divider` | bool | Show a divider line between header/footer and body. | `False` | +| `widths` | iterable / `"auto"` | Column widths in order. If `"auto"`, widths will be calculated automatically based on the largest value. | `"auto"` | +| `max_col` | int | Maximum column width. | `30` | +| `spacing` | int | Number of spaces between columns. | `3` | +| `aligns` | iterable / unicode | Columns alignments in order. `"l"` (left, default), `"r"` (right) or `"c"` (center). If If a string, value is used for all columns. | `None` | +| `multiline` | bool | If a cell value is a list of a tuple, render it on multiple lines, with one value per line. | `False` | +| `env_prefix` | unicode | Prefix for environment variables, e.g. WASABI_LOG_FRIENDLY. | `"WASABI"` | +| `color_values` | dict | Add or overwrite color values, name mapped to value. | `None` | +| `fg_colors` | iterable | Foreground colors, one per column. None can be specified for individual columns to retain the default background color. | `None` | +| `bg_colors` | iterable | Background colors, one per column. None can be specified for individual columns to retain the default background color. | `None` | +| **RETURNS** | str | The formatted table. | | + +#### function `row` + +```python +from wasabi import row + +data = ("a1", "a2", "a3") +formatted = row(data) +``` + +``` +a1 a2 a3 +``` + +| Argument | Type | Description | Default | +| ------------ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | +| `data` | iterable | The individual columns to format. | | +| `widths` | list / int / `"auto"` | Column widths, either one integer for all columns or an iterable of values. If "auto", widths will be calculated automatically based on the largest value. | `"auto"` | +| `spacing` | int | Number of spaces between columns. | `3` | +| `aligns` | list | Columns alignments in order. `"l"` (left), `"r"` (right) or `"c"` (center). | `None` | +| `env_prefix` | unicode | Prefix for environment variables, e.g. WASABI_LOG_FRIENDLY. | `"WASABI"` | +| `fg_colors` | list | Foreground colors for the columns, in order. None can be specified for individual columns to retain the default foreground color. | `None` | +| `bg_colors` | list | Background colors for the columns, in order. None can be specified for individual columns to retain the default background color. | `None` | +| **RETURNS** | str | The formatted row. | | + +### class `TracebackPrinter` + +Helper to output custom formatted tracebacks and error messages. Currently used +in [Thinc](https://github.com/explosion/thinc). + +#### method `TracebackPrinter.__init__` + +Initialize a traceback printer. + +```python +from wasabi import TracebackPrinter + +tb = TracebackPrinter(tb_base="thinc", tb_exclude=("check.py",)) +``` + +| Argument | Type | Description | Default | +| ----------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- | +| `color_error` | str / int | Color name or code for errors (passed to `color` helper). | `"red"` | +| `color_tb` | str / int | Color name or code for traceback headline (passed to `color` helper). | `"blue"` | +| `color_highlight` | str / int | Color name or code for highlighted text (passed to `color` helper). | `"yellow"` | +| `indent` | int | Number of spaces to use for indentation. | `2` | +| `tb_base` | str | Name of directory to use to show relative paths. For example, `"thinc"` will look for the last occurence of `"/thinc/"` in a path and only show path to the right of it. | `None` | +| `tb_exclude` | tuple | List of filenames to exclude from traceback. | `tuple()` | +| **RETURNS** | `TracebackPrinter` | The traceback printer. | | + +#### method `TracebackPrinter.__call__` + +Output custom formatted tracebacks and errors. + +```python +from wasabi import TracebackPrinter +import traceback + +tb = TracebackPrinter(tb_base="thinc", tb_exclude=("check.py",)) + +error = tb("Some error", "Error description", highlight="kwargs", tb=traceback.extract_stack()) +raise ValueError(error) +``` + +``` + Some error + Some error description + + Traceback: + ├─ [61] in .env/lib/python3.6/site-packages/pluggy/manager.py + ├─── _multicall [187] in .env/lib/python3.6/site-packages/pluggy/callers.py + └───── pytest_fixture_setup [969] in .env/lib/python3.6/site-packages/_pytest/fixtures.py + >>> result = call_fixture_func(fixturefunc, request, kwargs) +``` + +| Argument | Type | Description | Default | +| ----------- | -------- | ------------------------------------------------------------------------------------------ | ------- | +| `title` | str | The message title. | | +| `*texts` | str | Optional texts to print (one per line). | | +| `highlight` | str | Optional sequence to highlight in the traceback, e.g. the bad value that caused the error. | `False` | +| `tb` | iterable | The traceback, e.g. generated by `traceback.extract_stack()`. | `None` | +| **RETURNS** | str | The formatted traceback. Can be printed or raised by custom exception. | | + +### class `MarkdownRenderer` + +Helper to create Markdown-formatted content. Will store the blocks added to the +Markdown document in order. + +```python +from wasabi import MarkdownRenderer + +md = MarkdownRenderer() +md.add(md.title(1, "Hello world")) +md.add("This is a paragraph") +print(md.text) +``` + +### method `MarkdownRenderer.__init__` + +Initialize a Markdown renderer. + +```python +from wasabi import MarkdownRenderer + +md = MarkdownRenderer() +``` + +| Argument | Type | Description | Default | +| ----------- | ------------------ | ------------------------------ | ------- | +| `no_emoji` | bool | Don't include emoji in titles. | `False` | +| **RETURNS** | `MarkdownRenderer` | The renderer. | + +### method `MarkdownRenderer.add` + +Add a block to the Markdown document. + +```python +from wasabi import MarkdownRenderer + +md = MarkdownRenderer() +md.add("This is a paragraph") +``` + +| Argument | Type | Description | Default | +| -------- | ---- | ------------------- | ------- | +| `text` | str | The content to add. | | + +### property `MarkdownRenderer.text` + +The rendered Markdown document. + +```python +md = MarkdownRenderer() +md.add("This is a paragraph") +print(md.text) +``` + +| Argument | Type | Description | Default | +| ----------- | ---- | -------------------------------- | ------- | +| **RETURNS** | str | The document as a single string. | | + +### method `MarkdownRenderer.table` + +Create a Markdown-formatted table. + +```python +md = MarkdownRenderer() +table = md.table([("a", "b"), ("c", "d")], ["Column 1", "Column 2"]) +md.add(table) +``` + + +```markdown +| Column 1 | Column 2 | +| --- | --- | +| a | b | +| c | d | +``` + +| Argument | Type | Description | Default | +| ----------- | ----------------------- | ------------------------------------------------------------------------------------ | ------- | +| `data` | Iterable[Iterable[str]] | The body, one iterable per row, containig an interable of column contents. | | +| `header` | Iterable[str] | The column names. | | +| `aligns` | Iterable[str] | Columns alignments in order. `"l"` (left, default), `"r"` (right) or `"c"` (center). | `None` | +| **RETURNS** | str | The table. | | + +### method `MarkdownRenderer.title` + +Create a Markdown-formatted heading. + +```python +md = MarkdownRenderer() +md.add(md.title(1, "Hello world")) +md.add(md.title(2, "Subheading", "💖")) +``` + +```markdown +# Hello world + +## 💖 Subheading +``` + +| Argument | Type | Description | Default | +| ----------- | ---- | -------------------------------------- | ------- | +| `level` | int | The heading level, e.g. `3` for `###`. | | +| `text` | str | The heading text. | | +| `emoji` | str | Optional emoji to show before heading. | `None` | +| **RETURNS** | str | The rendered title. | | + +### method `MarkdownRenderer.list` + +Create a Markdown-formatted non-nested list. + +```python +md = MarkdownRenderer() +md.add(md.list(["item", "other item"])) +md.add(md.list(["first item", "second item"], numbered=True)) +``` + +```markdown +- item +- other item + +1. first item +2. second item +``` + +| Argument | Type | Description | Default | +| ----------- | ------------- | ------------------------------- | ------- | +| `items` | Iterable[str] | The list items. | | +| `numbered` | bool | Whether to use a numbered list. | `False` | +| **RETURNS** | str | The rendered list. | | + +### method `MarkdownRenderer.link` + +Create a Markdown-formatted link. + +```python +md = MarkdownRenderer() +md.add(md.link("Google", "https://google.com")) +``` + +```markdown +[Google](https://google.com) +``` + +| Argument | Type | Description | Default | +| ----------- | ---- | ------------------ | ------- | +| `text` | str | The link text. | | +| `url` | str | The link URL. | | +| **RETURNS** | str | The rendered link. | | + +### method `MarkdownRenderer.code_block` + +Create a Markdown-formatted code block. + +```python +md = MarkdownRenderer() +md.add(md.code_block("import spacy", "python")) +``` + +````markdown +```python +import spacy +``` +```` + +| Argument | Type | Description | Default | +| ----------- | ---- | ------------------------ | ------- | +| `text` | str | The code text. | | +| `lang` | str | Optional code language. | `""` | +| **RETURNS** | str | The rendered code block. | | + +### method `MarkdownRenderer.code`, `MarkdownRenderer.bold`, `MarkdownRenderer.italic` + +Create a Markdown-formatted text. + +```python +md = MarkdownRenderer() +md.add(md.code("import spacy")) +md.add(md.bold("Hello!")) +md.add(md.italic("Emphasis")) +``` + +```markdown +`import spacy` + +**Hello!** + +_Emphasis_ +``` + +### Utilities + +#### function `color` + +```python +from wasabi import color + +formatted = color("This is a text", fg="white", bg="green", bold=True) +``` + +| Argument | Type | Description | Default | +| ----------- | --------- | --------------------------------------------- | ------- | +| `text` | str | The text to be formatted. | - | +| `fg` | str / int | Foreground color. String name or `0` - `256`. | `None` | +| `bg` | str / int | Background color. String name or `0` - `256`. | `None` | +| `bold` | bool | Format the text in bold. | `False` | +| `underline` | bool | Format the text by underlining. | `False` | +| **RETURNS** | str | The formatted string. | | + +#### function `wrap` + +```python +from wasabi import wrap + +wrapped = wrap("Hello world, this is a text.", indent=2) +``` + +| Argument | Type | Description | Default | +| ----------- | ---- | ------------------------------------------ | ------- | +| `text` | str | The text to wrap. | - | +| `wrap_max` | int | Maximum line width, including indentation. | `80` | +| `indent` | int | Number of spaces used for indentation. | `4` | +| **RETURNS** | str | The wrapped text with line breaks. | | + +#### function `diff_strings` + +```python +from wasabi import diff_strings + +diff = diff_strings("hello world!", "helloo world") +``` + +| Argument | Type | Description | Default | +| ----------- | --------- | ---------------------------------------------------------------------------- | ------------------ | +| `a` | str | The first string to diff. | +| `b` | str | The second string to diff. | +| `fg` | str / int | Foreground color. String name or `0` - `256`. | `"black"` | +| `bg` | tuple | Background colors as `(insert, delete)` tuple of string name or `0` - `256`. | `("green", "red")` | +| **RETURNS** | str | The formatted diff. | | + +### Environment variables + +Wasabi also respects the following environment variables. The prefix can be +customised on the `Printer` via the `env_prefix` argument. For example, setting +`env_prefix="SPACY"` will expect the environment variable `SPACY_LOG_FRIENDLY`. + +| Name | Description | +| ---------------------- | ------------------------------------------------------ | +| `ANSI_COLORS_DISABLED` | Disable colors. | +| `WASABI_LOG_FRIENDLY` | Make output nicer for logs (no colors, no animations). | +| `WASABI_NO_PRETTY` | Disable pretty printing, e.g. colors and icons. | + +## 🔔 Run tests + +Fork or clone the repo, make sure you have `pytest` installed and then run it on +the package directory. The tests are located in +[`/wasabi/tests`](/wasabi/tests). + +```bash +pip install pytest +cd wasabi +python -m pytest wasabi +``` diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..3baef412e10724293dd932eee406c8c8a12712d1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/RECORD @@ -0,0 +1,37 @@ +wasabi-1.1.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +wasabi-1.1.3.dist-info/LICENSE,sha256=VFEGPy-fp93JVB9xDa69VMP0RZLK8W9vmGJsMhO-yT0,1079 +wasabi-1.1.3.dist-info/METADATA,sha256=Qo26MoPqikBZ7_OElawi1Y-cKbfJ_xLfPnlsIJqW0Gk,28727 +wasabi-1.1.3.dist-info/RECORD,, +wasabi-1.1.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92 +wasabi-1.1.3.dist-info/top_level.txt,sha256=W9sjXfJi_nAtQ-jjHMYsfeSlxTmnidUT6Eg0PqIYxkM,7 +wasabi-1.1.3.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 +wasabi/__init__.py,sha256=2TKPFqEubrqf__BlV3x2d_aW8wjlKj6vJ2vtZkaq264,311 +wasabi/__pycache__/__init__.cpython-312.pyc,, +wasabi/__pycache__/compat.cpython-312.pyc,, +wasabi/__pycache__/markdown.cpython-312.pyc,, +wasabi/__pycache__/printer.cpython-312.pyc,, +wasabi/__pycache__/tables.cpython-312.pyc,, +wasabi/__pycache__/traceback_printer.cpython-312.pyc,, +wasabi/__pycache__/util.cpython-312.pyc,, +wasabi/compat.py,sha256=KyvFVH2FVs7f0CTE9B08xNBTeyFP9A5lF0zyczqCRSI,206 +wasabi/markdown.py,sha256=iAQhNSHvcsFmqIpKHtv6nzZRoEOYOTek8EfEAdkgWFY,4229 +wasabi/printer.py,sha256=6_cBI--XrIovrnHdpQR-3YwpB8zY9sNchul_4JbDfP0,12305 +wasabi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wasabi/tables.py,sha256=Ru1-030p8hnKwhFkIQWydy__9SE8dGSOOaIPC8IE_cw,6773 +wasabi/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wasabi/tests/__pycache__/__init__.cpython-312.pyc,, +wasabi/tests/__pycache__/test_jupyter.cpython-312.pyc,, +wasabi/tests/__pycache__/test_markdown.cpython-312.pyc,, +wasabi/tests/__pycache__/test_printer.cpython-312.pyc,, +wasabi/tests/__pycache__/test_tables.cpython-312.pyc,, +wasabi/tests/__pycache__/test_traceback.cpython-312.pyc,, +wasabi/tests/__pycache__/test_util.cpython-312.pyc,, +wasabi/tests/test-data/wasabi-test-notebook.ipynb,sha256=Jp_v9Tu2_vwPHZGv0WXr4gnY498fb8sN1PQPlLtsBJk,835 +wasabi/tests/test_jupyter.py,sha256=QTw__Se20003N_Rn82P8NGn8oTl6z1dJvmgQwwyZjDE,1122 +wasabi/tests/test_markdown.py,sha256=LAXaw5Ta_5ShL49Ku_TCH5RuSV88hbwylOg4kPNJvSk,1173 +wasabi/tests/test_printer.py,sha256=nLm5qLavzAmcCM47kGsqoY5faiQOJG3lAlPYK13lep0,7354 +wasabi/tests/test_tables.py,sha256=lX_oTwGlO01fpNEWUAAA0K00QHbJKPjpQLybgx23BFQ,17497 +wasabi/tests/test_traceback.py,sha256=Dkw6KPV_lLYlBQJSfVP_9as-tkPx4i6CfO8byozRb0Q,1622 +wasabi/tests/test_util.py,sha256=_yWKsOM4wAvqGbAeXNsAsjVQSz9SOba2FMdBE46n8Dg,2453 +wasabi/traceback_printer.py,sha256=lnNAOtU-KnKFyTffVMIuAJsD0AOMhZhi80hVt3sF06Q,4834 +wasabi/util.py,sha256=xQZm_9PgXvVvJ4ZEsZFNilXsAI8blILvWQMybdEiJWo,7260 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..bab98d675883cc7567a79df485cd7b4f015e376f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.43.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..e74d045affdcc77bfc9eef5afa3fa9fbde1245ec --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/top_level.txt @@ -0,0 +1 @@ +wasabi diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/zip-safe b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/zip-safe new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi-1.1.3.dist-info/zip-safe @@ -0,0 +1 @@ + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7e7a61ecbb90fd731ee4855a96ea9bc8314ef1ac --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/__init__.py @@ -0,0 +1,8 @@ +from .markdown import MarkdownRenderer # noqa +from .printer import Printer # noqa +from .tables import row, table # noqa +from .traceback_printer import TracebackPrinter # noqa +from .util import MESSAGES # noqa +from .util import color, diff_strings, format_repr, get_raw_input, wrap # noqa + +msg = Printer() diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi/compat.py b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/compat.py new file mode 100644 index 0000000000000000000000000000000000000000..04f50aa304f891a3b0412cba15094c12cad9f6e0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/compat.py @@ -0,0 +1,8 @@ +import sys + + +# Use typing_extensions for Python versions < 3.8 +if sys.version_info < (3, 8): + from typing_extensions import Protocol, Literal +else: + from typing import Protocol, Literal # noqa: F401 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi/markdown.py b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/markdown.py new file mode 100644 index 0000000000000000000000000000000000000000..65d06d6197f501fda97deb110861f0f8d4340027 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/markdown.py @@ -0,0 +1,126 @@ +from typing import Iterable, List, Optional, Sequence + +from .compat import Literal + + +class MarkdownRenderer: + """Simple helper for generating raw Markdown.""" + + def __init__(self, no_emoji: bool = False): + """Initialize the renderer. + + no_emoji (bool): Don't show emoji in titles etc. + """ + self.data: List = [] + self.no_emoji = no_emoji + + @property + def text(self) -> str: + """RETURNS (str): The Markdown document.""" + return "\n\n".join(self.data) + + def add(self, content: str): + """Add a string to the Markdown document. + + content (str): Add content to the document. + """ + self.data.append(content) + + def table( + self, + data: Iterable[Iterable[str]], + header: Sequence[str], + aligns: Optional[Sequence[Literal["r", "c", "l"]]] = None, + ) -> str: + """Create a Markdown table. + + data (Iterable[Iterable[str]]): The body, one iterable per row, + containig an interable of column contents. + header (Sequence[str]): The column names. + aligns (Optional[Sequence[Literal["r", "c", "l"]]]): Optional alignment-mode for each column. Values should + either be 'l' (left), 'r' (right), or 'c' (center). Optional. + RETURNS (str): The rendered table. + """ + if aligns is None: + aligns = ["l"] * len(header) + if len(aligns) != len(header): + err = "Invalid aligns: {} (header length: {})".format(aligns, len(header)) + raise ValueError(err) + get_divider = lambda a: ":---:" if a == "c" else "---:" if a == "r" else "---" + head = "| {} |".format(" | ".join(header)) + divider = "| {} |".format( + " | ".join(get_divider(aligns[i]) for i in range(len(header))) + ) + body = "\n".join("| {} |".format(" | ".join(row)) for row in data) + return "{}\n{}\n{}".format(head, divider, body) + + def title(self, level: int, text: str, emoji: Optional[str] = None) -> str: + """Create a Markdown heading. + + level (int): The heading level, e.g. 3 for ### + text (str): The heading text. + emoji (Optional[str]): Optional emoji to show before heading text, if enabled. + RETURNS (str): The rendered title. + """ + prefix = "{} ".format(emoji) if emoji and not self.no_emoji else "" + return "{} {}{}".format("#" * level, prefix, text) + + def list(self, items: Iterable[str], numbered: bool = False) -> str: + """Create a non-nested list. + + items (Iterable[str]): The list items. + numbered (bool): Whether to use a numbered list. + RETURNS (str): The rendered list. + """ + content = [] + for i, item in enumerate(items): + if numbered: + content.append("{}. {}".format(i + 1, item)) + else: + content.append("- {}".format(item)) + return "\n".join(content) + + def link(self, text: str, url: str) -> str: + """Create a Markdown link. + + text (str): The link text. + url (str): The link URL. + RETURNS (str): The rendered link. + """ + return "[{}]({})".format(text, url) + + def code_block(self, text: str, lang: str = "") -> str: + """Create a Markdown code block. + + text (str): The code text. + lang (str): Optional code language. + RETURNS (str): The rendered code block. + """ + return "```{}\n{}\n```".format(lang, text) + + def code(self, text: str) -> str: + """Create Markdown inline code. + + text (str): The inline code text. + RETURNS (str): The rendered code text. + """ + return self._wrap(text, "`") + + def bold(self, text: str) -> str: + """Create bold text. + + text (str): The text to format in boldface. + RETURNS (str): The formatted text. + """ + return self._wrap(text, "**") + + def italic(self, text: str): + """Create italic text. + + text (str): The text to italicize. + RETURNS (str): The formatted text. + """ + return self._wrap(text, "_") + + def _wrap(self, text, marker): + return "{}{}{}".format(marker, text, marker) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi/printer.py b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/printer.py new file mode 100644 index 0000000000000000000000000000000000000000..e33da3ce72e11bfbe26883f1126d8c6552b5d781 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/printer.py @@ -0,0 +1,345 @@ +import datetime +import itertools +import os +import sys +import time +import traceback +from collections import Counter +from contextlib import contextmanager +from multiprocessing import Process +from typing import Any, Collection, Dict, NoReturn, Optional, Union, cast, overload + +from .compat import Literal +from .tables import row, table +from .util import COLORS, ICONS, MESSAGES, can_render +from .util import color as _color +from .util import locale_escape, supports_ansi, wrap + + +class Printer(object): + def __init__( + self, + pretty: bool = True, + no_print: bool = False, + colors: Optional[Dict] = None, + icons: Optional[Dict] = None, + line_max: int = 80, + animation: str = "⠙⠹⠸⠼⠴⠦⠧⠇⠏", + animation_ascii: str = "|/-\\", + hide_animation: bool = False, + ignore_warnings: bool = False, + env_prefix: str = "WASABI", + timestamp: bool = False, + ): + """Initialize the command-line printer. + + pretty (bool): Pretty-print output (colors, icons). + no_print (bool): Don't actually print, just return. + colors (Optional[Dict]): Optional color values to add or overwrite, name mapped to value. + icons (Optional[Dict]): Optional icons to add or overwrite. Name mapped to unicode icon. + line_max (int): Maximum line length (for divider). + animation (str): Steps of loading animation for loading() method. + animation_ascii (str): Alternative animation for ASCII terminals. + hide_animation (bool): Don't display animation, e.g. for logs. + ignore_warnings (bool): Do not output messages of type MESSAGE.WARN. + env_prefix (str): Prefix for environment variables, e.g. + WASABI_LOG_FRIENDLY. + timestamp (bool): Print a timestamp (default False). + RETURNS (Printer): The initialized printer. + """ + env_log_friendly = os.getenv("{}_LOG_FRIENDLY".format(env_prefix), False) + env_no_pretty = os.getenv("{}_NO_PRETTY".format(env_prefix), False) + self._counts: Counter = Counter() + self.pretty = pretty and not env_no_pretty + self.no_print = no_print + self.show_color = supports_ansi() and not env_log_friendly + self.hide_animation = hide_animation or env_log_friendly + self.ignore_warnings = ignore_warnings + self.line_max = line_max + self.colors = dict(COLORS) + self.icons = dict(ICONS) + self.timestamp = timestamp + if colors: + self.colors.update(colors) + if icons: + self.icons.update(icons) + self.anim = animation if can_render(animation) else animation_ascii + + @property + def counts(self) -> Counter: + """Get the counts of how often the special printers were fired, + e.g. MESSAGES.GOOD. Can be used to print an overview like "X warnings". + """ + return self._counts + + def good( + self, + title: Any = "", + text: Any = "", + show: bool = True, + spaced: bool = False, + exits: Optional[int] = None, + ): + """Print a success message. + + title (Any): The main text to print. + text (Any): Optional additional text to print. + show (bool): Whether to print or not. Can be used to only output + messages under certain condition, e.g. if --verbose flag is set. + spaced (bool): Whether to add newlines around the output. + exits (Optional[int]): Optional toggle to perform a system exit. + """ + return self._get_msg( + title, text, style=MESSAGES.GOOD, show=show, spaced=spaced, exits=exits + ) + + @overload + def fail( + self, + title: Any = "", + text: Any = "", + show: bool = True, + spaced: bool = False, + exits: Optional[Literal[0, False]] = None, + ): + ... + + @overload + def fail( + self, + title: Any = "", + text: Any = "", + show: bool = True, + spaced: bool = False, + exits: Literal[1, True] = True, + ) -> NoReturn: + ... + + def fail( + self, + title: Any = "", + text: Any = "", + show: bool = True, + spaced: bool = False, + exits: Optional[Union[int, bool]] = None, + ) -> Union[str, None, NoReturn]: + """Print an error message. + + title (Any): The main text to print. + text (Any): Optional additional text to print. + show (bool): Whether to print or not. Can be used to only output + messages under certain condition, e.g. if --verbose flag is set. + spaced (bool): Whether to add newlines around the output. + exits (Optional[int]): Optional toggle to perform a system exit. + """ + return self._get_msg( + title, text, style=MESSAGES.FAIL, show=show, spaced=spaced, exits=exits + ) + + def warn( + self, + title: Any = "", + text: Any = "", + show: bool = True, + spaced: bool = False, + exits: Optional[int] = None, + ): + """Print a warning message. + + title (Any): The main text to print. + text (Any): Optional additional text to print. + show (bool): Whether to print or not. Can be used to only output + messages under certain condition, e.g. if --verbose flag is set. + spaced (bool): Whether to add newlines around the output. + exits (Optional[int]): Optional toggle to perform a system exit. + """ + return self._get_msg( + title, text, style=MESSAGES.WARN, show=show, spaced=spaced, exits=exits + ) + + def info( + self, + title: Any = "", + text: Any = "", + show: bool = True, + spaced: bool = False, + exits: Optional[int] = None, + ): + """Print an informational message. + + title (Any): The main text to print. + text (Any): Optional additional text to print. + show (bool): Whether to print or not. Can be used to only output + messages under certain condition, e.g. if --verbose flag is set. + spaced (bool): Whether to add newlines around the output. + exits (Optional[int]): Optional toggle to perform a system exit. + """ + return self._get_msg( + title, text, style=MESSAGES.INFO, show=show, spaced=spaced, exits=exits + ) + + def text( + self, + title: Any = "", + text: Any = "", + color: Optional[Union[str, int]] = None, + bg_color: Optional[Union[str, int]] = None, + icon: Optional[str] = None, + spaced: bool = False, + show: bool = True, + no_print: bool = False, + exits: Optional[int] = None, + ): + """Print a message. + + title (Any): The main text to print. + text (Any): Optional additional text to print. + color (Optional[Union[str, int]]): Optional foreground color. + bg_color (Optional[Union[str, int]]): Optional background color. + icon (Optional[str]): Optional name of icon to add. + spaced (bool): Whether to add newlines around the output. + show (bool): Whether to print or not. Can be used to only output + messages under certain condition, e.g. if --verbose flag is set. + no_print (bool): Don't actually print, just return. + exits (Optional[int]): Perform a system exit. Optional. + """ + if not show: + return + if self.pretty: + color = self.colors.get(cast(str, color), color) + bg_color = self.colors.get(cast(str, bg_color), bg_color) + icon = self.icons.get(cast(str, icon)) + if icon: + title = locale_escape("{} {}".format(icon, title)).strip() + if self.show_color: + title = _color(title, fg=color, bg=bg_color) + title = wrap(title, indent=0) + if text: + title = "{}\n{}".format(title, wrap(text, indent=0)) + if self.timestamp: + now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + title = "{}\t{}".format(now, title) + if exits is not None or spaced: + title = "\n{}\n".format(title) + if not self.no_print and not no_print: + print(title) + if exits is not None: + sys.stdout.flush() + sys.stderr.flush() + if self.no_print or no_print and exits != 0: + try: + raise RuntimeError(title.strip()) + except Exception as e: + # Remove wasabi from the traceback and re-raise + tb = "\n".join(traceback.format_stack()[:-3]) + raise SystemExit("{}\n{}".format(tb, e)) + sys.exit(exits) + if self.no_print or no_print: + return title + + def divider( + self, + text: str = "", + char: str = "=", + show: bool = True, + icon: Optional[str] = None, + ): + """Print a divider with a headline: + ============================ Headline here =========================== + + text (str): Headline text. If empty, only the line is printed. + char (str): Line character to repeat, e.g. =. + show (bool): Whether to print or not. + icon (Optional[str]): Optional icon to display with title. + """ + if not show: + return + if len(char) != 1: + raise ValueError( + "Divider chars need to be one character long. " + "Received: {}".format(char) + ) + if self.pretty: + icon = self.icons.get(cast(str, icon)) + if icon: + text = locale_escape("{} {}".format(icon, text)).strip() + deco = char * (int(round((self.line_max - len(text))) / 2) - 2) + text = " {} ".format(text) if text else "" + text = _color( + "\n{deco}{text}{deco}".format(deco=deco, text=text), bold=True + ) + if len(text) < self.line_max: + text = text + char * (self.line_max - len(text)) + if self.no_print: + return text + print(text) + + def table(self, data: Union[Collection, Dict], **kwargs): + """Print data as a table. + + data (Union[Collection, Dict]): The data to render. Either a list of lists + (one per row) or a dict for two-column tables. + kwargs: Table settings. See tables.table for details. + """ + title = kwargs.pop("title", None) + text = table(data, **kwargs) + if title: + self.divider(title) + if self.no_print: + return text + print(text) + + def row(self, data: Collection, **kwargs): + """Print a table row. + + data (Collection): The individual columns to format. + kwargs: Row settings. See tables.row for details. + """ + text = row(data, **kwargs) + if self.no_print: + return text + print(text) + + @contextmanager + def loading(self, text: str = "Loading..."): + if self.no_print: + yield + elif self.hide_animation: + print(text) + yield + else: + sys.stdout.flush() + t = Process(target=self._spinner, args=(text,)) + t.start() + try: + yield + except Exception as e: + # Handle exception inside the with block + t.terminate() + sys.stdout.write("\n") + raise (e) + t.terminate() + sys.stdout.write("\r\x1b[2K") # erase line + sys.stdout.flush() + + def _spinner(self, text: str = "Loading..."): + for char in itertools.cycle(self.anim): + sys.stdout.write("\r{} {}".format(char, text)) + sys.stdout.flush() + time.sleep(0.1) + + def _get_msg( + self, + title: Any, + text: Any, + style: Optional[str] = None, + show: bool = False, + spaced: bool = False, + exits: Optional[int] = None, + ): + if self.ignore_warnings and style == MESSAGES.WARN: + show = False + self._counts[style] += 1 + return self.text( + title, text, color=style, icon=style, show=show, spaced=spaced, exits=exits + ) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi/py.typed b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi/tables.py b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/tables.py new file mode 100644 index 0000000000000000000000000000000000000000..dd5b92db381f4ab9c2f990dc50de5f8113d7bfa1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/tables.py @@ -0,0 +1,158 @@ +import os +from itertools import zip_longest +from typing import Collection, Dict, Iterable, List, Optional, Sequence, Union +from typing import cast + +from .compat import Literal +from .util import COLORS +from .util import color as _color +from .util import supports_ansi + +ALIGN_MAP = {"l": "<", "r": ">", "c": "^"} + + +def table( + # fmt: off + data: Union[Collection, Dict], + header: Optional[Iterable] = None, + footer: Optional[Iterable] = None, + divider: bool = False, + widths: Union[Iterable[int], Literal["auto"]] = "auto", + max_col: int = 30, + spacing: int = 3, + aligns: Optional[Union[Iterable[Literal["r", "c", "l"]], Literal["r", "c", "l"]]] = None, + multiline: bool = False, + env_prefix: str = "WASABI", + color_values: Optional[Dict] = None, + fg_colors: Optional[Iterable] = None, + bg_colors: Optional[Iterable] = None, + # fmt: on +) -> str: + """Format tabular data. + + data (Union[Collection, Dict]): The data to render. Either a list of lists (one per + row) or a dict for two-column tables. + header (Optional[Iterable]): Optional header columns. + footer (Optional[Iterable]): Optional footer columns. + divider (bool): Show a divider line between header/footer and body. + widths (Union[Iterable[int], Literal['auto']]): Column widths in order. If "auto", widths + will be calculated automatically based on the largest value. + max_col (int): Maximum column width. + spacing (int): Spacing between columns, in spaces. + aligns (Optional[Union[Iterable[str], str]]): Optional column alignments + in order. 'l' (left, default), 'r' (right) or 'c' (center). If a string, + value is used for all columns. + multiline (bool): If a cell value is a list of a tuple, render it on + multiple lines, with one value per line. + env_prefix (str): Prefix for environment variables, e.g. + WASABI_LOG_FRIENDLY. + color_values (Optional[Dict]): Optional color values to add or overwrite, name mapped to value. + fg_colors (Optional[Iterable]): Optional foreground colors, one per column. None can be specified + for individual columns to retain the default foreground color. + bg_colors (Optional[Iterable]): Optional background colors, one per column. None can be specified + for individual columns to retain the default background color. + RETURNS (str): The formatted table. + """ + if fg_colors is not None or bg_colors is not None: + colors = dict(COLORS) + if color_values is not None: + colors.update(color_values) + if fg_colors is not None: + fg_colors = [colors.get(fg_color, fg_color) for fg_color in fg_colors] + if bg_colors is not None: + bg_colors = [colors.get(bg_color, bg_color) for bg_color in bg_colors] + if isinstance(data, dict): + data = list(data.items()) + if multiline: + zipped_data = [] + for i, item in enumerate(data): + vals = [v if isinstance(v, (list, tuple)) else [v] for v in item] + zipped_data.extend(list(zip_longest(*vals, fillvalue=""))) + if i < len(data) - 1: + zipped_data.append(tuple(["" for i in item])) + data = zipped_data + if widths == "auto": + widths = _get_max_widths(data, header, footer, max_col) + settings = { + "widths": widths, + "spacing": spacing, + "aligns": aligns, + "env_prefix": env_prefix, + "fg_colors": fg_colors, + "bg_colors": bg_colors, + } + divider_row = row(["-" * width for width in widths], **settings) # type: ignore + rows = [] + if header: + rows.append(row(header, **settings)) # type: ignore + if divider: + rows.append(divider_row) + for i, item in enumerate(data): + rows.append(row(item, **settings)) # type: ignore + if footer: + if divider: + rows.append(divider_row) + rows.append(row(footer, **settings)) # type: ignore + return "\n{}\n".format("\n".join(rows)) + + +def row( + data: Collection, + widths: Union[Sequence[int], int, Literal["auto"]] = "auto", + spacing: int = 3, + aligns: Optional[Union[Sequence[Literal["r", "c", "l"]], str]] = None, + env_prefix: str = "WASABI", + fg_colors: Optional[Sequence] = None, + bg_colors: Optional[Sequence] = None, +) -> str: + """Format data as a table row. + + data (Collection): The individual columns to format. + widths (Union[Sequence[int], int, Literal['auto']]): Column widths, either one integer for all + columns or an iterable of values. If "auto", widths will be calculated + automatically based on the largest value. + spacing (int): Spacing between columns, in spaces. + aligns (Optional[Union[Sequence[Literal['r', 'c', 'l']], str]]): Optional column + alignments in order. 'l' (left, default), 'r' (right) or 'c' (center). + If a string, value is used for all columns. + env_prefix (str): Prefix for environment variables, e.g. + WASABI_LOG_FRIENDLY. + fg_colors (Optional[Sequence]): Optional foreground colors for the columns, in order. None can be + specified for individual columns to retain the default foreground color. + bg_colors (Optional[Sequence]): Optional background colors for the columns, in order. None can be + specified for individual columns to retain the default background color. + RETURNS (str): The formatted row. + """ + env_log_friendly = os.getenv("{}_LOG_FRIENDLY".format(env_prefix), False) + show_colors = ( + supports_ansi() + and not env_log_friendly + and (fg_colors is not None or bg_colors is not None) + ) + cols: List[str] = [] + _aligns = ( + [aligns for _ in data] if isinstance(aligns, str) else cast(List[str], aligns) + ) + if not hasattr(widths, "__iter__") and widths != "auto": # single number + widths = cast(List[int], [widths for _ in range(len(data))]) + for i, col in enumerate(data): + align = ALIGN_MAP.get(_aligns[i] if _aligns and i < len(_aligns) else "l") + col_width = len(col) if widths == "auto" else cast(List[int], widths)[i] + tpl = "{:%s%d}" % (align, col_width) + col = tpl.format(str(col)) + if show_colors: + fg = fg_colors[i] if fg_colors is not None else None + bg = bg_colors[i] if bg_colors is not None else None + col = _color(col, fg=fg, bg=bg) + cols.append(col) + return (" " * spacing).join(cols) + + +def _get_max_widths(data, header, footer, max_col): + all_data = list(data) + if header: + all_data.append(header) + if footer: + all_data.append(footer) + widths = [[len(str(col)) for col in item] for item in all_data] + return [min(max(w), max_col) for w in list(zip(*widths))] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi/traceback_printer.py b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/traceback_printer.py new file mode 100644 index 0000000000000000000000000000000000000000..d5c75c8553a83b941c6439bc71455c75fe166b53 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/traceback_printer.py @@ -0,0 +1,114 @@ +import os +from typing import Optional, Tuple, Union + +from .util import NO_UTF8, color, supports_ansi + +LINE_EDGE = "└─" if not NO_UTF8 else "|_" +LINE_FORK = "├─" if not NO_UTF8 else "|__" +LINE_PATH = "──" if not NO_UTF8 else "__" + + +class TracebackPrinter(object): + def __init__( + self, + color_error: Union[str, int] = "red", + color_tb: Union[str, int] = "blue", + color_highlight: Union[str, int] = "yellow", + indent: int = 2, + tb_base: Optional[str] = None, + tb_exclude: Tuple = tuple(), + tb_range_start: int = -5, + tb_range_end: int = -2, + ): + """Initialize a traceback printer. + + color_error (Union[str, int]): Color name or code for errors. + color_tb (Union[str, int]): Color name or code for traceback headline. + color_highlight (Union[str, int]): Color name or code for highlights. + indent (int): Indentation in spaces. + tb_base (Optional[str]): Optional name of directory to use to show relative paths. For + example, "thinc" will look for the last occurence of "/thinc/" in + a path and only show path to the right of it. + tb_exclude (tuple): List of filenames to exclude from traceback. + tb_range_start (int): The starting index from a traceback to include. + tb_range_end (int): The final index from a traceback to include. If None + the traceback will continue until the last record. + RETURNS (TracebackPrinter): The traceback printer. + """ + self.color_error = color_error + self.color_tb = color_tb + self.color_highlight = color_highlight + self.indent = " " * indent + if tb_base == ".": + tb_base = "{}{}".format(os.getcwd(), os.path.sep) + elif tb_base is not None: + tb_base = "/{}/".format(tb_base) + self.tb_base = tb_base + self.tb_exclude = tuple(tb_exclude) + self.tb_range_start = tb_range_start + self.tb_range_end = tb_range_end + self.supports_ansi = supports_ansi() + + def __call__(self, title: str, *texts, **settings) -> str: + """Output custom formatted tracebacks and errors. + + title (str): The message title. + *texts (str): The texts to print (one per line). + RETURNS (str): The formatted traceback. Can be printed or raised + by custom exception. + """ + highlight = settings.get("highlight", False) + tb = settings.get("tb", None) + if self.supports_ansi: # use first line as title + title = color(title, fg=self.color_error, bold=True) + info = "\n" + "\n".join([self.indent + text for text in texts]) if texts else "" + tb = self._get_traceback(tb, highlight) if tb else "" + msg = "\n\n{}{}{}{}\n".format(self.indent, title, info, tb) + return msg + + def _get_traceback(self, tb, highlight): + # Exclude certain file names from traceback + tb = [record for record in tb if not record[0].endswith(self.tb_exclude)] + tb_range = ( + tb[self.tb_range_start : self.tb_range_end] + if self.tb_range_end is not None + else tb[self.tb_range_start :] + ) + tb_list = [ + self._format_traceback(path, line, fn, text, i, len(tb_range), highlight) + for i, (path, line, fn, text) in enumerate(tb_range) + ] + tb_data = "\n".join(tb_list).strip() + title = "Traceback:" + if self.supports_ansi: + title = color(title, fg=self.color_tb, bold=True) + return "\n\n{indent}{title}\n{indent}{tb}".format( + title=title, tb=tb_data, indent=self.indent + ) + + def _format_traceback(self, path, line, fn, text, i, count, highlight): + template = "{base_indent}{indent} {fn} in {path}:{line}{text}" + indent = (LINE_EDGE if i == count - 1 else LINE_FORK) + LINE_PATH * i + if self.tb_base and self.tb_base in path: + path = path.rsplit(self.tb_base, 1)[1] + text = self._format_user_error(text, i, highlight) if i == count - 1 else "" + if self.supports_ansi: + fn = color(fn, bold=True) + path = color(path, underline=True) + return template.format( + base_indent=self.indent, + line=line, + indent=indent, + text=text, + fn=fn, + path=path, + ) + + def _format_user_error(self, text, i, highlight): + spacing = " " * i + " >>>" + if self.supports_ansi: + spacing = color(spacing, fg=self.color_error) + if highlight and self.supports_ansi: + formatted_highlight = color(highlight, fg=self.color_highlight) + text = text.replace(highlight, formatted_highlight) + return "\n{} {} {}".format(self.indent, spacing, text) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wasabi/util.py b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/util.py new file mode 100644 index 0000000000000000000000000000000000000000..c2d46c0ecea4db6ae6bb163d625458dde4d1cf4f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wasabi/util.py @@ -0,0 +1,221 @@ +import difflib +import os +import sys +import textwrap +from typing import Any, Optional, Tuple, Union + +STDOUT_ENCODING = sys.stdout.encoding if hasattr(sys.stdout, "encoding") else None +ENCODING = STDOUT_ENCODING or "ascii" +NO_UTF8 = ENCODING.lower() not in ("utf8", "utf-8") + + +# Environment variables +ENV_ANSI_DISABLED = "ANSI_COLORS_DISABLED" # no colors + + +class MESSAGES(object): + GOOD = "good" + FAIL = "fail" + WARN = "warn" + INFO = "info" + + +COLORS = { + MESSAGES.GOOD: 2, + MESSAGES.FAIL: 1, + MESSAGES.WARN: 3, + MESSAGES.INFO: 4, + "red": 1, + "green": 2, + "yellow": 3, + "blue": 4, + "pink": 5, + "cyan": 6, + "white": 7, + "grey": 8, + "black": 16, +} + + +ICONS = { + MESSAGES.GOOD: "\u2714" if not NO_UTF8 else "[+]", + MESSAGES.FAIL: "\u2718" if not NO_UTF8 else "[x]", + MESSAGES.WARN: "\u26a0" if not NO_UTF8 else "[!]", + MESSAGES.INFO: "\u2139" if not NO_UTF8 else "[i]", +} + +INSERT_SYMBOL = "+" +DELETE_SYMBOL = "-" + + +def color( + text: str, + fg: Optional[Union[str, int]] = None, + bg: Optional[Union[str, int]] = None, + bold: bool = False, + underline: bool = False, +) -> str: + """Color text by applying ANSI escape sequence. + + text (str): The text to be formatted. + fg (Optional[Union[str, int]]): Optional foreground color. String name or 0 - 256 (see COLORS). + bg (Optional[Union[str, int]]): Optional background color. String name or 0 - 256 (see COLORS). + bold (bool): Format text in bold. + underline (bool): Underline text. + RETURNS (str): The formatted text. + """ + fg = COLORS.get(fg, fg) # type: ignore + bg = COLORS.get(bg, bg) # type: ignore + if not any([fg, bg, bold]): + return text + styles = [] + if bold: + styles.append("1") + if underline: + styles.append("4") + if fg: + styles.append("38;5;{}".format(fg)) + if bg: + styles.append("48;5;{}".format(bg)) + return "\x1b[{}m{}\x1b[0m".format(";".join(styles), text) + + +def wrap(text: Any, wrap_max: int = 80, indent: int = 4) -> str: + """Wrap text at given width using textwrap module. + + text (Any): The text to wrap. + wrap_max (int): Maximum line width, including indentation. Defaults to 80. + indent (int): Number of spaces used for indentation. Defaults to 4. + RETURNS (str): The wrapped text with line breaks. + """ + indent_str = indent * " " + wrap_width = wrap_max - len(indent_str) + text = str(text) + return textwrap.fill( + text, + width=wrap_width, + initial_indent=indent_str, + subsequent_indent=indent_str, + break_long_words=False, + break_on_hyphens=False, + ) + + +def format_repr(obj: Any, max_len: int = 50, ellipsis: str = "...") -> str: + """Wrapper around `repr()` to print shortened and formatted string version. + + obj: The object to represent. + max_len (int): Maximum string length. Longer strings will be cut in the + middle so only the beginning and end is displayed, separated by ellipsis. + ellipsis (str): Ellipsis character(s), e.g. "...". + RETURNS (str): The formatted representation. + """ + string = repr(obj) + if len(string) >= max_len: + half = int(max_len / 2) + return "{} {} {}".format(string[:half], ellipsis, string[-half:]) + else: + return string + + +def diff_strings( + a: str, + b: str, + fg: Union[str, int] = "black", + bg: Union[Tuple[str, str], Tuple[int, int]] = ("green", "red"), + add_symbols: bool = False, +) -> str: + """Compare two strings and return a colored diff with red/green background + for deletion and insertions. + + a (str): The first string to diff. + b (str): The second string to diff. + fg (Union[str, int]): Foreground color. String name or 0 - 256 (see COLORS). + bg (Union[Tuple[str, str], Tuple[int, int]]): Background colors as + (insert, delete) tuple of string name or 0 - 256 (see COLORS). + add_symbols (bool): Whether to add symbols before the diff lines. Uses '+' + for inserts and '-' for deletions. Default is False. + RETURNS (str): The formatted diff. + """ + a_list = a.split("\n") + b_list = b.split("\n") + output = [] + matcher = difflib.SequenceMatcher(None, a_list, b_list) + for opcode, a0, a1, b0, b1 in matcher.get_opcodes(): + if opcode == "equal": + for item in a_list[a0:a1]: + output.append(item) + if opcode == "insert" or opcode == "replace": + for item in b_list[b0:b1]: + item = "{} {}".format(INSERT_SYMBOL, item) if add_symbols else item + output.append(color(item, fg=fg, bg=bg[0])) + if opcode == "delete" or opcode == "replace": + for item in a_list[a0:a1]: + item = "{} {}".format(DELETE_SYMBOL, item) if add_symbols else item + output.append(color(item, fg=fg, bg=bg[1])) + return "\n".join(output) + + +def get_raw_input( + description: str, default: Optional[Union[str, bool]] = False, indent: int = 4 +) -> str: + """Get user input from the command line via raw_input / input. + + description (str): Text to display before prompt. + default (Optional[Union[str, bool]]): Optional default value to display with prompt. + indent (int): Indentation in spaces. + RETURNS (str): User input. + """ + additional = " (default: {})".format(default) if default else "" + prompt = wrap("{}{}: ".format(description, additional), indent=indent) + user_input = input(prompt) + return user_input + + +def locale_escape(string: Any, errors: str = "replace") -> str: + """Mangle non-supported characters, for savages with ASCII terminals. + + string (Any): The string to escape. + errors (str): The str.encode errors setting. Defaults to `"replace"`. + RETURNS (str): The escaped string. + """ + string = str(string) + string = string.encode(ENCODING, errors).decode("utf8") + return string + + +def can_render(string: str) -> bool: + """Check if terminal can render unicode characters, e.g. special loading + icons. Can be used to display fallbacks for ASCII terminals. + + string (str): The string to render. + RETURNS (bool): Whether the terminal can render the text. + """ + try: + string.encode(ENCODING) + return True + except UnicodeEncodeError: + return False + + +def supports_ansi() -> bool: + """Returns True if the running system's terminal supports ANSI escape + sequences for color, formatting etc. and False otherwise. + + RETURNS (bool): Whether the terminal supports ANSI colors. + """ + if os.getenv(ENV_ANSI_DISABLED): + return False + # We require colorama on Windows Python 3.7+, but we might be running on Unix, or we + # might be running on Windows Python 3.6. In both cases, colorama might be missing, + # *or* there might by accident happen to be an install of an old version that + # doesn't have just_fix_windows_console. So we need to confirm not just that we can + # import colorama, but that we can import just_fix_windows_console. + try: + from colorama import just_fix_windows_console + except ImportError: + if sys.platform == "win32" and "ANSICON" not in os.environ: + return False + else: + just_fix_windows_console() + return True diff --git a/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..be6977b0e3d743e6bf4c0edc70e8ab69b352912e --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/METADATA @@ -0,0 +1,97 @@ +Metadata-Version: 2.4 +Name: weasel +Version: 0.4.3 +Summary: Weasel: A small and easy workflow system +Home-page: https://github.com/explosion/weasel/ +Author: Explosion +Author-email: contact@explosion.ai +License: MIT +Project-URL: Release notes, https://github.com/explosion/weasel/releases +Project-URL: Source, https://github.com/explosion/weasel/ +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Topic :: Scientific/Engineering +Requires-Python: >=3.7 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: confection<0.2.0,>=0.0.4 +Requires-Dist: packaging>=20.0 +Requires-Dist: wasabi<1.2.0,>=0.9.1 +Requires-Dist: srsly<3.0.0,>=2.4.3 +Requires-Dist: typer-slim<1.0.0,>=0.3.0 +Requires-Dist: cloudpathlib<1.0.0,>=0.7.0 +Requires-Dist: smart-open<8.0.0,>=5.2.1 +Requires-Dist: requests<3.0.0,>=2.13.0 +Requires-Dist: pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4 +Dynamic: license-file + + + +# Weasel: A small and easy workflow system + +Weasel lets you manage and share **end-to-end workflows** for +different **use cases and domains**, and orchestrate training, packaging and +serving your custom pipelines. You can start off by cloning a pre-defined +project template, adjust it to fit your needs, load in your data, train a +pipeline, export it as a Python package, upload your outputs to a remote storage +and share your results with your team. Weasel can be used via the +[`weasel`](https://github.com/explosion/weasel/blob/main/docs/cli.md) command and we provide templates in our +[`projects`](https://github.com/explosion/projects) repo. + +![Illustration of project workflow and commands](https://raw.githubusercontent.com/explosion/weasel/main/docs/assets/images/projects.svg) + +## 💡 Example: Get started with a project template + +The easiest way to get started is to clone a project template and run it – for +example, this [end-to-end template](https://github.com/explosion/projects/tree/v3/pipelines/tagger_parser_ud) +that lets you train a spaCy **part-of-speech +tagger** and **dependency parser** on a Universal Dependencies treebank. + +```shell +python -m weasel clone pipelines/tagger_parser_ud +``` + +> **Note** +> +> Our [`projects`](https://github.com/explosion/projects) repo includes various +> project templates for different NLP tasks, models, workflows and integrations +> that you can clone and run. The easiest way to get started is to pick a +> template, clone it and start modifying it! + +## 📕 Documentation + +Get started with the documentation: + +- [Learn how to create a Weasel workflow](https://github.com/explosion/weasel/blob/main/docs/tutorial/workflow.md) +- [Working with directory and assets](https://github.com/explosion/weasel/blob/main/docs/tutorial/directory-and-assets.md) +- [Running custom scripts](https://github.com/explosion/weasel/blob/main/docs/tutorial/custom-scripts.md) +- [Using remote storage](https://github.com/explosion/weasel/blob/main/docs/tutorial/remote-storage.md) +- [Weasel integrations](https://github.com/explosion/weasel/blob/main/docs/tutorial/integrations.md) +- [Command line interface description](https://github.com/explosion/weasel/blob/main/docs/cli.md) + +## Migrating from spaCy Projects + +Weasel is a standalone replacement for spaCy Projects. +There are a few backward incompatibilities that you should be aware of: + +- The `SPACY_CONFIG_OVERRIDES` environment variable is no longer checked. + You can set configuration overrides using `WEASEL_CONFIG_OVERRIDES`. +- Support for the `spacy_version` configuration key has been dropped. +- Support for the `check_requirements` configuration key has been dropped. +- Support for `SPACY_PROJECT_USE_GIT_VERSION` environment variable has been dropped. +- Error codes are now Weasel-specific, and do not follow spaCy error codes. + +Weasel checks for the first three incompatibilities and will issue a +warning if you're using it with spaCy-specific configuration options. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..c63c42c63933f27104afa69196f0d421b9c5562c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/RECORD @@ -0,0 +1,84 @@ +../../Scripts/weasel.exe,sha256=F7vsy0-mum43Ph1t_8MVWxMRvZ_enCU83jVfdKJQoLM,108371 +weasel-0.4.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +weasel-0.4.3.dist-info/METADATA,sha256=XPwHY7G1DOs-QGXn7fu9cdhdgAhKTlOlIZfHTvPwv7M,4631 +weasel-0.4.3.dist-info/RECORD,, +weasel-0.4.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91 +weasel-0.4.3.dist-info/entry_points.txt,sha256=Ku6ayp2e_UG9cng9-7nSDO2DfyGxscPrEObzuBQAsjw,42 +weasel-0.4.3.dist-info/licenses/LICENSE,sha256=tOUBWHi-AmTXp0ejBTOMwjyy06UNb-tzhHEJp7bpfpk,1083 +weasel-0.4.3.dist-info/top_level.txt,sha256=q8qdiyp4oNjR1P6uQwsl70WBUs0BPkCb0ppX3TEyT20,7 +weasel/__init__.py,sha256=TNxXsTPgb52OhakIda9wTRh91cqoBqgQRx5TxjzQQFU,21 +weasel/__main__.py,sha256=SJW-HXQX9pN1eNxZwGiScvyRD3xSxtOuQNzpdLiSihk,59 +weasel/__pycache__/__init__.cpython-312.pyc,, +weasel/__pycache__/__main__.cpython-312.pyc,, +weasel/__pycache__/about.cpython-312.pyc,, +weasel/__pycache__/compat.cpython-312.pyc,, +weasel/__pycache__/errors.cpython-312.pyc,, +weasel/__pycache__/schemas.cpython-312.pyc,, +weasel/about.py,sha256=e7WX26FgbGH36hSiP-_yM3zyHhhGoqXSFdtXdBpLa2s,82 +weasel/cli/__init__.py,sha256=GXld7K87SuSgOG-C1g9nfEHqNs5u6nzalyGfK5fE6Rs,272 +weasel/cli/__pycache__/__init__.cpython-312.pyc,, +weasel/cli/__pycache__/assets.cpython-312.pyc,, +weasel/cli/__pycache__/clone.cpython-312.pyc,, +weasel/cli/__pycache__/document.cpython-312.pyc,, +weasel/cli/__pycache__/dvc.cpython-312.pyc,, +weasel/cli/__pycache__/main.cpython-312.pyc,, +weasel/cli/__pycache__/pull.cpython-312.pyc,, +weasel/cli/__pycache__/push.cpython-312.pyc,, +weasel/cli/__pycache__/remote_storage.cpython-312.pyc,, +weasel/cli/__pycache__/run.cpython-312.pyc,, +weasel/cli/assets.py,sha256=gInZF_NQ0hNotGhdqjnZGXKCdIv86mDI_Show4DGXNE,8231 +weasel/cli/clone.py,sha256=iTB77lyUyVrWPT10pF2VKyizsxSxVDxf_f61OIe9ows,5025 +weasel/cli/document.py,sha256=nHA8EUlzxgiYKh_Su9gcmlxUpk5KSlBWSVX-ihuBstk,5747 +weasel/cli/dvc.py,sha256=mMkj6SaYdv_s3AwYfnbIKzz1Z3D3MqgHK81Pv5FP33A,8453 +weasel/cli/main.py,sha256=aPVKaMuyS8wwScIiW_iFZdR9_6r10IdKJmIZHIWJz40,815 +weasel/cli/pull.py,sha256=q2wRT8EyxbivyhAqMumOindaawKOs1YlUqkJ-huJh7I,2934 +weasel/cli/push.py,sha256=oSaEahe5oHW9g7IGfT2z2ngW8EmV2Btz7D-EmAE9jJU,2764 +weasel/cli/remote_storage.py,sha256=Fw9LARU3eob8HeCVxmn446DoSnfcvaJO1qZx8IKjptE,8118 +weasel/cli/run.py,sha256=vlYKpkZCxdaa3yniZXM2Z1VtqnJy6NqnsHHoK7TIYXM,13247 +weasel/compat.py,sha256=3D8nISnH-yEZEMAv7oRSveO1BLo9w2ljtbMKT2-YS6A,134 +weasel/errors.py,sha256=jkMCBB7FYZAlxz7dHU4Tb9bnTkmz5_5NLczoNdN7twQ,1171 +weasel/schemas.py,sha256=C_cZw7QMy073zMEhy_PUH_DbkEBlwYI3hE79UcSScio,4268 +weasel/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +weasel/tests/__pycache__/__init__.cpython-312.pyc,, +weasel/tests/__pycache__/test_schemas.cpython-312.pyc,, +weasel/tests/__pycache__/test_validation.cpython-312.pyc,, +weasel/tests/__pycache__/util.cpython-312.pyc,, +weasel/tests/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +weasel/tests/cli/__pycache__/__init__.cpython-312.pyc,, +weasel/tests/cli/__pycache__/test_cli.cpython-312.pyc,, +weasel/tests/cli/__pycache__/test_cli_app.cpython-312.pyc,, +weasel/tests/cli/__pycache__/test_document.cpython-312.pyc,, +weasel/tests/cli/__pycache__/test_remote.cpython-312.pyc,, +weasel/tests/cli/test_cli.py,sha256=nU66ZEVtKPKlMvZNqMb15YslpBLufqg7r7jQcMFXhQI,6389 +weasel/tests/cli/test_cli_app.py,sha256=iM_ZJN_Pd5yymLhWPolziqlo_XW6mZ-1o5qSy1k-hcM,6085 +weasel/tests/cli/test_document.py,sha256=ePPkLI3jYfwiF9NfeNfnlwrFni4YCzuFwdUD0QDmJTg,3628 +weasel/tests/cli/test_remote.py,sha256=0mxj-nanABFaiKBFm6YKPrVkDqtHUTbQefNQBZtPQOs,2156 +weasel/tests/test_schemas.py,sha256=dR0EH4lXCVajvJemW3lE0IN4mU5vcVyWEz9j5Kn70yA,831 +weasel/tests/test_validation.py,sha256=H7TBn4nYCzHkRQJJswwaD4L26bgrdszHAbH5zRFIXwY,5222 +weasel/tests/util.py,sha256=Q7beCwKxA0lOXtv--clahP7tOtTlplwA7c1Wv0Rna-I,600 +weasel/util/__init__.py,sha256=oW0e4e67DbmBVKKEd6fGL8QY0XSxTDqRvZ-v_GwZfTo,841 +weasel/util/__pycache__/__init__.cpython-312.pyc,, +weasel/util/__pycache__/commands.cpython-312.pyc,, +weasel/util/__pycache__/config.cpython-312.pyc,, +weasel/util/__pycache__/environment.cpython-312.pyc,, +weasel/util/__pycache__/filesystem.cpython-312.pyc,, +weasel/util/__pycache__/frozen.cpython-312.pyc,, +weasel/util/__pycache__/git.cpython-312.pyc,, +weasel/util/__pycache__/hashing.cpython-312.pyc,, +weasel/util/__pycache__/logging.cpython-312.pyc,, +weasel/util/__pycache__/modules.cpython-312.pyc,, +weasel/util/__pycache__/remote.cpython-312.pyc,, +weasel/util/__pycache__/validation.cpython-312.pyc,, +weasel/util/__pycache__/versions.cpython-312.pyc,, +weasel/util/commands.py,sha256=fXcja6DTv-gWT_NQ41Lh2HpeKOaTUzP3cqnP7MtTc3A,2960 +weasel/util/config.py,sha256=FmOuOFnJFDbHyer3nxVc3nxrNQx69FQyUp_xCQfsABk,5788 +weasel/util/environment.py,sha256=Nh3zXA8s5Ii4Iioo73_9zC8v3J2-4RtFX-5D_ZwZ2s8,1058 +weasel/util/filesystem.py,sha256=N00l3jaXqfwPbfKPTRZQ26TB4Hck-qAsNYCDrSEwucY,2965 +weasel/util/frozen.py,sha256=Gw7GG0WWItZ3PhNqdDs5g-MlcPsDJVMXhdiAz1w2Gs8,2232 +weasel/util/git.py,sha256=Iek2RhSHt3rb6XqMR8BZyFGBmjkUkuPtaB59b59wyVM,6535 +weasel/util/hashing.py,sha256=M3kwb7IDD-El-cPwI7u8Hw68q0CDjCuSmmhFOUjoH3g,1380 +weasel/util/logging.py,sha256=T90QXYcnZOOK5ah4_3sfIRYjnJwHmSvInZ5nPCM3XAM,247 +weasel/util/modules.py,sha256=0-eSiCtIdAxbPJpto5UABAdG-YiwYj1HNrkm2MycQE4,587 +weasel/util/remote.py,sha256=qXcbvJ9WPnNv0hSURCS7pnv1IId_o-a5YqP9AaDCPig,2321 +weasel/util/validation.py,sha256=fWO0VrqKO6au4Vl70GtFdfewWEovS4GAhPDAekOLirA,3218 +weasel/util/versions.py,sha256=99u_vbAiTyx2pc_c3qXlbFjjjAKCzKQW6i2milrmMNU,2098 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..e7fa31b6f3f78deb1022c1f7927f07d4d16da822 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/entry_points.txt b/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..56ed090b82f1855b7b4d8faa16e771edd5c56ed8 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +weasel = weasel.cli:app diff --git a/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e4ec8929fdf8f5e6e6e66b0f439f1f620183bf1 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/weasel-0.4.3.dist-info/top_level.txt @@ -0,0 +1 @@ +weasel diff --git a/TTS/Kokoro/.venv/Lib/site-packages/weasel/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/weasel/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..be3c49ec1c50274d30b6095d8bc350bc9e31396f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/weasel/__init__.py @@ -0,0 +1 @@ +from .cli import app diff --git a/TTS/Kokoro/.venv/Lib/site-packages/weasel/__main__.py b/TTS/Kokoro/.venv/Lib/site-packages/weasel/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..82171c680a3ace61795228ed8a114a62cfaea37b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/weasel/__main__.py @@ -0,0 +1,3 @@ +from .cli.main import COMMAND, app + +app(prog_name=COMMAND) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/weasel/about.py b/TTS/Kokoro/.venv/Lib/site-packages/weasel/about.py new file mode 100644 index 0000000000000000000000000000000000000000..14a1760194706250a00725f7cda750a513a3b10f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/weasel/about.py @@ -0,0 +1,2 @@ +__projects__ = "https://github.com/explosion/projects" +__projects_branch__ = "v3" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/weasel/compat.py b/TTS/Kokoro/.venv/Lib/site-packages/weasel/compat.py new file mode 100644 index 0000000000000000000000000000000000000000..515171aa9ac51d029f078ae8e34edd5e8c1af973 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/weasel/compat.py @@ -0,0 +1,5 @@ +import sys + +is_windows = sys.platform.startswith("win") +is_linux = sys.platform.startswith("linux") +is_osx = sys.platform == "darwin" diff --git a/TTS/Kokoro/.venv/Lib/site-packages/weasel/errors.py b/TTS/Kokoro/.venv/Lib/site-packages/weasel/errors.py new file mode 100644 index 0000000000000000000000000000000000000000..3b0a5b01f4e208ec7b04f08814513cf2c7501da9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/weasel/errors.py @@ -0,0 +1,34 @@ +class ErrorsWithCodes(type): + def __getattribute__(self, code): + msg = super().__getattribute__(code) + if code.startswith("__"): # python system attributes like __class__ + return msg + else: + return "[{code}] {msg}".format(code=code, msg=msg) + + +class Warnings(metaclass=ErrorsWithCodes): + # File system + W801 = "Could not clean/remove the temp directory at {dir}: {msg}." + W802 = ( + "Remote storage is not yet supported for Python 3.12 with " + "cloudpathlib. Please use Python 3.11 or earlier for remote storage." + ) + + +class Errors(metaclass=ErrorsWithCodes): + # API - Datastructure + E001 = ( + "Can't write to frozen dictionary. This is likely an internal " + "error. Are you writing to a default function argument?" + ) + E002 = ( + "Can't write to frozen list. Maybe you're trying to modify a computed " + "property or default function argument?" + ) + + # Workflow + E501 = "Can not execute command '{str_command}'. Do you have '{tool}' installed?" + + # File system + E801 = "The tar file pulled from the remote attempted an unsafe path " "traversal." diff --git a/TTS/Kokoro/.venv/Lib/site-packages/weasel/schemas.py b/TTS/Kokoro/.venv/Lib/site-packages/weasel/schemas.py new file mode 100644 index 0000000000000000000000000000000000000000..9563417a89cc80198e5bbb9dc0cb0b537dafb49a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/weasel/schemas.py @@ -0,0 +1,100 @@ +from collections import defaultdict +from typing import Any, Dict, List, Optional, Type, Union + +try: + from pydantic.v1 import BaseModel, Field, StrictStr, ValidationError, root_validator +except ImportError: + from pydantic import BaseModel, Field, StrictStr, ValidationError, root_validator # type: ignore + +from wasabi import msg + + +def validate(schema: Type[BaseModel], obj: Dict[str, Any]) -> List[str]: + """Validate data against a given pydantic schema. + + obj (Dict[str, Any]): JSON-serializable data to validate. + schema (pydantic.BaseModel): The schema to validate against. + RETURNS (List[str]): A list of error messages, if available. + """ + try: + schema(**obj) + return [] + except ValidationError as e: + errors = e.errors() + data = defaultdict(list) + for error in errors: + err_loc = " -> ".join([str(p) for p in error.get("loc", [])]) + data[err_loc].append(error.get("msg")) + return [f"[{loc}] {', '.join(msg)}" for loc, msg in data.items()] # type: ignore[arg-type] + + +# Project config Schema + + +class ProjectConfigAssetGitItem(BaseModel): + # fmt: off + repo: StrictStr = Field(..., title="URL of Git repo to download from") + path: StrictStr = Field(..., title="File path or sub-directory to download (used for sparse checkout)") + branch: StrictStr = Field("master", title="Branch to clone from") + # fmt: on + + +class ProjectConfigAssetURL(BaseModel): + # fmt: off + dest: StrictStr = Field(..., title="Destination of downloaded asset") + url: Optional[StrictStr] = Field(None, title="URL of asset") + checksum: Optional[str] = Field(None, title="MD5 hash of file", regex=r"([a-fA-F\d]{32})") + description: StrictStr = Field("", title="Description of asset") + # fmt: on + + +class ProjectConfigAssetGit(BaseModel): + # fmt: off + git: ProjectConfigAssetGitItem = Field(..., title="Git repo information") + checksum: Optional[str] = Field(None, title="MD5 hash of file", regex=r"([a-fA-F\d]{32})") + description: Optional[StrictStr] = Field(None, title="Description of asset") + # fmt: on + + +class ProjectConfigCommand(BaseModel): + # fmt: off + name: StrictStr = Field(..., title="Name of command") + help: Optional[StrictStr] = Field(None, title="Command description") + script: List[StrictStr] = Field([], title="List of CLI commands to run, in order") + deps: List[StrictStr] = Field([], title="File dependencies required by this command") + outputs: List[StrictStr] = Field([], title="Outputs produced by this command") + outputs_no_cache: List[StrictStr] = Field([], title="Outputs not tracked by DVC (DVC only)") + no_skip: bool = Field(False, title="Never skip this command, even if nothing changed") + # fmt: on + + class Config: + title = "A single named command specified in a project config" + extra = "forbid" + + +class ProjectConfigSchema(BaseModel): + # fmt: off + vars: Dict[StrictStr, Any] = Field({}, title="Optional variables to substitute in commands") + env: Dict[StrictStr, Any] = Field({}, title="Optional variable names to substitute in commands, mapped to environment variable names") + assets: List[Union[ProjectConfigAssetURL, ProjectConfigAssetGit]] = Field([], title="Data assets") + workflows: Dict[StrictStr, List[StrictStr]] = Field({}, title="Named workflows, mapped to list of project commands to run in order") + commands: List[ProjectConfigCommand] = Field([], title="Project command shortucts") + title: Optional[str] = Field(None, title="Project title") + # fmt: on + + class Config: + title = "Schema for project configuration file" + + @root_validator(pre=True) + def check_legacy_keys(cls, obj: Dict[str, Any]) -> Dict[str, Any]: + if "spacy_version" in obj: + msg.warn( + "Your project configuration file includes a `spacy_version` key, " + "which is now deprecated. Weasel will not validate your version of spaCy.", + ) + if "check_requirements" in obj: + msg.warn( + "Your project configuration file includes a `check_requirements` key, " + "which is now deprecated. Weasel will not validate your requirements.", + ) + return obj diff --git a/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/LICENSE b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..24d39e6d40e5e824149ed6dee1134e519d32f2d7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Delgan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..d350a11abc49f70563f2e84190f8c378c29d7366 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/METADATA @@ -0,0 +1,57 @@ +Metadata-Version: 2.1 +Name: win32_setctime +Version: 1.2.0 +Summary: A small Python utility to set file creation time on Windows +Home-page: https://github.com/Delgan/win32-setctime +Download-URL: https://github.com/Delgan/win32-setctime/archive/1.2.0.tar.gz +Author: Delgan +Author-email: delgan.py@gmail.com +License: MIT license +Keywords: win32,windows,filesystem,filetime +Classifier: Development Status :: 5 - Production/Stable +Classifier: Topic :: System :: Filesystems +Classifier: Intended Audience :: Developers +Classifier: Environment :: Win32 (MS Windows) +Classifier: Natural Language :: English +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: Microsoft +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: Implementation :: CPython +Requires-Python: >=3.5 +Description-Content-Type: text/markdown +License-File: LICENSE +Provides-Extra: dev +Requires-Dist: black>=19.3b0; python_version >= "3.6" and extra == "dev" +Requires-Dist: pytest>=4.6.2; extra == "dev" + +# win32-setctime + +[![Pypi version](https://img.shields.io/pypi/v/win32-setctime.svg)](https://pypi.python.org/pypi/win32-setctime) [![Python version](https://img.shields.io/badge/python-3.5%2B-blue.svg)](https://pypi.python.org/pypi/win32-setctime) [![Build status](https://img.shields.io/github/actions/workflow/status/Delgan/win32-setctime/tests.yml?branch=master)](https://github.com/Delgan/win32-setctime/actions/workflows/tests.yml?query=branch:master) [![License](https://img.shields.io/github/license/delgan/win32-setctime.svg)](https://github.com/Delgan/win32-setctime/blob/master/LICENSE) + +A small Python utility to set file creation time on Windows. + + +## Installation + +```shell +pip install win32-setctime +``` + +## Usage + +```python +from win32_setctime import setctime + +setctime("my_file.txt", 1561675987.509, follow_symlinks=True) +``` diff --git a/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..8acd3cbef5dc799bcdc13fa59fbda01dc377501d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/RECORD @@ -0,0 +1,11 @@ +win32_setctime-1.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +win32_setctime-1.2.0.dist-info/LICENSE,sha256=Ly12bEzvJ6QNSzwX0-AuW1ud3_uiVEqT-Z_6_gV3hRg,1063 +win32_setctime-1.2.0.dist-info/METADATA,sha256=d4Ot4AL4subLsE2XIT-tdm0rhOF-WGj798jFslsuFQk,2431 +win32_setctime-1.2.0.dist-info/RECORD,, +win32_setctime-1.2.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91 +win32_setctime-1.2.0.dist-info/top_level.txt,sha256=JAa2y6T8woNK0AX-c4sHDXeZkn3NtEaMzTXMIc4Dsyg,15 +win32_setctime/__init__.py,sha256=lwUDx0bUQlEmE684x_yQKM9OjIR44-x-lf7P5D4YTWY,102 +win32_setctime/__pycache__/__init__.cpython-312.pyc,, +win32_setctime/__pycache__/_setctime.cpython-312.pyc,, +win32_setctime/_setctime.py,sha256=TD8-lXfob3i2d0xSCn42rt4e6FiAyfiu8cAfcUKPZCw,2307 +win32_setctime/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..ae527e7d64811439e61b93aa375defb30e06edfe --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (75.6.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..98e02c7a7b1880201d7a2984b1d2eb9034cb3933 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime-1.2.0.dist-info/top_level.txt @@ -0,0 +1 @@ +win32_setctime diff --git a/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b3eb4147bc29766326a8c60fc8cb182e555aa270 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime/__init__.py @@ -0,0 +1,4 @@ +from ._setctime import setctime, SUPPORTED + +__version__ = "1.2.0" +__all__ = ["setctime", "SUPPORTED"] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime/_setctime.py b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime/_setctime.py new file mode 100644 index 0000000000000000000000000000000000000000..8e9d9a6ef96e1d1eb20e5a0b9df90912279a0e7c --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime/_setctime.py @@ -0,0 +1,78 @@ +import os +import sys + +try: + from ctypes import byref, get_last_error, wintypes, FormatError, WinDLL, WinError + + kernel32 = WinDLL("kernel32", use_last_error=True) + + CreateFileW = kernel32.CreateFileW + SetFileTime = kernel32.SetFileTime + CloseHandle = kernel32.CloseHandle + + CreateFileW.argtypes = ( + wintypes.LPWSTR, + wintypes.DWORD, + wintypes.DWORD, + wintypes.LPVOID, + wintypes.DWORD, + wintypes.DWORD, + wintypes.HANDLE, + ) + CreateFileW.restype = wintypes.HANDLE + + SetFileTime.argtypes = ( + wintypes.HANDLE, + wintypes.PFILETIME, + wintypes.PFILETIME, + wintypes.PFILETIME, + ) + SetFileTime.restype = wintypes.BOOL + + CloseHandle.argtypes = (wintypes.HANDLE,) + CloseHandle.restype = wintypes.BOOL +except (ImportError, AttributeError, OSError, ValueError): + SUPPORTED = False +else: + SUPPORTED = os.name == "nt" + + +if sys.version_info >= (3, 6): + PathLike = os.PathLike +else: + from pathlib import PurePath as PathLike + +from typing import Union + + +def setctime( + filepath: Union[str, PathLike], timestamp: float, *, follow_symlinks: bool = True +) -> None: + """Set the "ctime" (creation time) attribute of a file given an unix timestamp (Windows only).""" + if not SUPPORTED: + raise OSError("This function is only available for the Windows platform.") + + filepath = os.path.normpath(os.path.abspath(str(filepath))) + timestamp = int(timestamp * 10000000) + 116444736000000000 + + if not 0 < timestamp < (1 << 64): + raise ValueError("The system value of the timestamp exceeds u64 size: %d" % timestamp) + + atime = wintypes.FILETIME(0xFFFFFFFF, 0xFFFFFFFF) + mtime = wintypes.FILETIME(0xFFFFFFFF, 0xFFFFFFFF) + ctime = wintypes.FILETIME(timestamp & 0xFFFFFFFF, timestamp >> 32) + + flags = 128 | 0x02000000 + + if not follow_symlinks: + flags |= 0x00200000 + + handle = wintypes.HANDLE(CreateFileW(filepath, 256, 0, None, 3, flags, None)) + if handle.value == wintypes.HANDLE(-1).value: + raise WinError(get_last_error()) + + if not wintypes.BOOL(SetFileTime(handle, byref(ctime), byref(atime), byref(mtime))): + raise WinError(get_last_error()) + + if not wintypes.BOOL(CloseHandle(handle)): + raise WinError(get_last_error()) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime/py.typed b/TTS/Kokoro/.venv/Lib/site-packages/win32_setctime/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/INSTALLER b/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/METADATA b/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..9514f4ad602d069e29c06ea1b29d7a4588cdab15 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/METADATA @@ -0,0 +1,188 @@ +Metadata-Version: 2.4 +Name: wrapt +Version: 2.1.1 +Summary: Module for decorators, wrappers and monkey patching. +Author-email: Graham Dumpleton +License-Expression: BSD-2-Clause +Project-URL: Homepage, https://github.com/GrahamDumpleton/wrapt +Project-URL: Bug Tracker, https://github.com/GrahamDumpleton/wrapt/issues/ +Project-URL: Changelog, https://wrapt.readthedocs.io/en/latest/changes.html +Project-URL: Documentation, https://wrapt.readthedocs.io/ +Keywords: wrapper,proxy,decorator +Classifier: Development Status :: 5 - Production/Stable +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Requires-Python: >=3.9 +Description-Content-Type: text/x-rst +License-File: LICENSE +Provides-Extra: dev +Requires-Dist: pytest; extra == "dev" +Requires-Dist: setuptools; extra == "dev" +Dynamic: license-file + +wrapt +===== + +|PyPI| |Documentation| + +A Python module for decorators, wrappers and monkey patching. + +Overview +-------- + +The **wrapt** module provides a transparent object proxy for Python, which can be used as the basis for the construction of function wrappers and decorator functions. + +The **wrapt** module focuses very much on correctness. It goes way beyond existing mechanisms such as ``functools.wraps()`` to ensure that decorators preserve introspectability, signatures, type checking abilities etc. The decorators that can be constructed using this module will work in far more scenarios than typical decorators and provide more predictable and consistent behaviour. + +To ensure that the overhead is as minimal as possible, a C extension module is used for performance critical components. An automatic fallback to a pure Python implementation is also provided where a target system does not have a compiler to allow the C extension to be compiled. + +Key Features +------------ + +* **Universal decorators** that work with functions, methods, classmethods, staticmethods, and classes +* **Transparent object proxies** for advanced wrapping scenarios +* **Monkey patching utilities** for safe runtime modifications +* **C extension** for optimal performance with Python fallback +* **Comprehensive introspection preservation** (signatures, annotations, etc.) +* **Thread-safe decorator implementations** + +Installation +------------ + +Install from PyPI using pip:: + + pip install wrapt + +Supported Python Versions +-------------------------- + +* Python 3.9+ +* CPython and PyPy implementations + +Documentation +------------- + +For comprehensive documentation, examples, and advanced usage patterns, visit: + +* https://wrapt.readthedocs.io/ + +Quick Start +----------- + +To implement your decorator you need to first define a wrapper function. +This will be called each time a decorated function is called. The wrapper +function needs to take four positional arguments: + +* ``wrapped`` - The wrapped function which in turns needs to be called by your wrapper function. +* ``instance`` - The object to which the wrapped function was bound when it was called. +* ``args`` - The list of positional arguments supplied when the decorated function was called. +* ``kwargs`` - The dictionary of keyword arguments supplied when the decorated function was called. + +The wrapper function would do whatever it needs to, but would usually in +turn call the wrapped function that is passed in via the ``wrapped`` +argument. + +The decorator ``@wrapt.decorator`` then needs to be applied to the wrapper +function to convert it into a decorator which can in turn be applied to +other functions. + +.. code-block:: python + + import wrapt + + @wrapt.decorator + def pass_through(wrapped, instance, args, kwargs): + return wrapped(*args, **kwargs) + + @pass_through + def function(): + pass + +If you wish to implement a decorator which accepts arguments, then wrap the +definition of the decorator in a function closure. Any arguments supplied +to the outer function when the decorator is applied, will be available to +the inner wrapper when the wrapped function is called. + +.. code-block:: python + + import wrapt + + def with_arguments(myarg1, myarg2): + @wrapt.decorator + def wrapper(wrapped, instance, args, kwargs): + return wrapped(*args, **kwargs) + return wrapper + + @with_arguments(1, 2) + def function(): + pass + +When applied to a normal function or static method, the wrapper function +when called will be passed ``None`` as the ``instance`` argument. + +When applied to an instance method, the wrapper function when called will +be passed the instance of the class the method is being called on as the +``instance`` argument. This will be the case even when the instance method +was called explicitly via the class and the instance passed as the first +argument. That is, the instance will never be passed as part of ``args``. + +When applied to a class method, the wrapper function when called will be +passed the class type as the ``instance`` argument. + +When applied to a class, the wrapper function when called will be passed +``None`` as the ``instance`` argument. The ``wrapped`` argument in this +case will be the class. + +The above rules can be summarised with the following example. + +.. code-block:: python + + import inspect + + @wrapt.decorator + def universal(wrapped, instance, args, kwargs): + if instance is None: + if inspect.isclass(wrapped): + # Decorator was applied to a class. + return wrapped(*args, **kwargs) + else: + # Decorator was applied to a function or staticmethod. + return wrapped(*args, **kwargs) + else: + if inspect.isclass(instance): + # Decorator was applied to a classmethod. + return wrapped(*args, **kwargs) + else: + # Decorator was applied to an instancemethod. + return wrapped(*args, **kwargs) + +Using these checks it is therefore possible to create a universal decorator +that can be applied in all situations. It is no longer necessary to create +different variants of decorators for normal functions and instance methods, +or use additional wrappers to convert a function decorator into one that +will work for instance methods. + +In all cases, the wrapped function passed to the wrapper function is called +in the same way, with ``args`` and ``kwargs`` being passed. The +``instance`` argument doesn't need to be used in calling the wrapped +function. + +Links +----- + +* **Documentation**: https://wrapt.readthedocs.io/ +* **Source Code**: https://github.com/GrahamDumpleton/wrapt +* **Bug Reports**: https://github.com/GrahamDumpleton/wrapt/issues/ +* **Changelog**: https://wrapt.readthedocs.io/en/latest/changes.html + +.. |PyPI| image:: https://img.shields.io/pypi/v/wrapt.svg?logo=python&cacheSeconds=3600 + :target: https://pypi.python.org/pypi/wrapt +.. |Documentation| image:: https://img.shields.io/badge/docs-wrapt.readthedocs.io-blue.svg + :target: https://wrapt.readthedocs.io/ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/RECORD b/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..5d1585970a70f015ba8d92d95e0ec33d68cbef4d --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/RECORD @@ -0,0 +1,28 @@ +wrapt-2.1.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +wrapt-2.1.1.dist-info/METADATA,sha256=YaCV_wZBvukuL_OHIlLYSA3Hsra5Iy5aDfHEyDQwYiM,7553 +wrapt-2.1.1.dist-info/RECORD,, +wrapt-2.1.1.dist-info/WHEEL,sha256=4SIlGrTWEevUMa-6zmQ9aBHcYatnnG9aOHYILIJiCXU,102 +wrapt-2.1.1.dist-info/licenses/LICENSE,sha256=_Fr7gpM6wYQ69WLcNDeSaH6KUTBYqq_7ddirpUkqcFA,1328 +wrapt-2.1.1.dist-info/top_level.txt,sha256=Jf7kcuXtwjUJMwOL0QzALDg2WiSiXiH9ThKMjN64DW0,6 +wrapt/__init__.py,sha256=-OYYTnJvjCO2a8FcKg_CwZQ9e9cNmrfF9xng9tglgcM,1604 +wrapt/__init__.pyi,sha256=ohvv2MDx0tC0OVW8U6Cv0an4ev7XPxklm0ECGY3NQxs,13040 +wrapt/__pycache__/__init__.cpython-312.pyc,, +wrapt/__pycache__/__wrapt__.cpython-312.pyc,, +wrapt/__pycache__/arguments.cpython-312.pyc,, +wrapt/__pycache__/decorators.cpython-312.pyc,, +wrapt/__pycache__/importer.cpython-312.pyc,, +wrapt/__pycache__/patches.cpython-312.pyc,, +wrapt/__pycache__/proxies.cpython-312.pyc,, +wrapt/__pycache__/weakrefs.cpython-312.pyc,, +wrapt/__pycache__/wrappers.cpython-312.pyc,, +wrapt/__wrapt__.py,sha256=-LqO3HqSUI6DnhboE7CMvn-DO-L_E1eh6IicnOm5--w,1431 +wrapt/_wrappers.c,sha256=CHiGjkkz7YlPj4aPW8hp0W4rHSPg7ftc5mCnBzHEerU,119897 +wrapt/_wrappers.cp312-win_amd64.pyd,sha256=LxB1xZEnU9QRTX-lSTAj8FnA_vWmxO0h4OH5eVv0nDQ,44032 +wrapt/arguments.py,sha256=PiJtDy6JMT_0BQei7ZhxJXePIMYyk4GbHFjkTa0n9Q4,2607 +wrapt/decorators.py,sha256=DUSiYLn_xgxLvbEesol1tbmufvmn8Q6l6gcVnrU6RDU,21613 +wrapt/importer.py,sha256=NdOh6aVIIg5Fi1S8eLKL-wmX3qZ6SgOdk3_Xy7RQ5Q4,12467 +wrapt/patches.py,sha256=yYh5_hXX-pIb8HyIs37MwCD6vUTeR96gsxd4W1N-mkw,10146 +wrapt/proxies.py,sha256=CnPZSNkvTFTDp0zNzxvUpCZhQO2MaLgFHkbCBVKD-qc,12868 +wrapt/py.typed,sha256=2Ox0AU4FNnXJ0T5LyWKc_BbJXopWJJUFe8o2V7Zhvjc,9 +wrapt/weakrefs.py,sha256=IlTqGPbJ3mENcvPCboI0tYAzrhZg34cgRqWrP23GkHc,4744 +wrapt/wrappers.py,sha256=PA3nS-5AW8BS5WYKqN32dsxKgLw0sTMcupLPABaLI-Q,35419 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/WHEEL b/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..861d347c001fd9a03baee61ef485f020d9448d80 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.10.2) +Root-Is-Purelib: false +Tag: cp312-cp312-win_amd64 + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/top_level.txt b/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba11553ab9e90bd2fc2366e2d157f5bf947d80d5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt-2.1.1.dist-info/top_level.txt @@ -0,0 +1 @@ +wrapt diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..41eabafa7d1bcd9f2f5f0f53d32bf1156217ddda --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/__init__.py @@ -0,0 +1,64 @@ +""" +Wrapt is a library for decorators, wrappers and monkey patching. +""" + +__version_info__ = ("2", "1", "1") +__version__ = ".".join(__version_info__) + +from .__wrapt__ import ( + BaseObjectProxy, + BoundFunctionWrapper, + CallableObjectProxy, + FunctionWrapper, + PartialCallableObjectProxy, + partial, +) +from .decorators import AdapterFactory, adapter_factory, decorator, synchronized +from .importer import ( + discover_post_import_hooks, + notify_module_loaded, + register_post_import_hook, + when_imported, +) +from .patches import ( + apply_patch, + function_wrapper, + patch_function_wrapper, + resolve_path, + transient_function_wrapper, + wrap_function_wrapper, + wrap_object, + wrap_object_attribute, +) +from .proxies import AutoObjectProxy, LazyObjectProxy, ObjectProxy, lazy_import +from .weakrefs import WeakFunctionProxy + +__all__ = ( + "AutoObjectProxy", + "BaseObjectProxy", + "BoundFunctionWrapper", + "CallableObjectProxy", + "FunctionWrapper", + "LazyObjectProxy", + "ObjectProxy", + "PartialCallableObjectProxy", + "partial", + "AdapterFactory", + "adapter_factory", + "decorator", + "synchronized", + "discover_post_import_hooks", + "notify_module_loaded", + "register_post_import_hook", + "when_imported", + "apply_patch", + "function_wrapper", + "lazy_import", + "patch_function_wrapper", + "resolve_path", + "transient_function_wrapper", + "wrap_function_wrapper", + "wrap_object", + "wrap_object_attribute", + "WeakFunctionProxy", +) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/__init__.pyi b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/__init__.pyi new file mode 100644 index 0000000000000000000000000000000000000000..ee579300d11d7d5c2f19c64185ee9d79f8000479 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/__init__.pyi @@ -0,0 +1,388 @@ +import sys + +if sys.version_info >= (3, 10): + from inspect import FullArgSpec + from types import ModuleType, TracebackType + from typing import ( + Any, + Callable, + Concatenate, + Generic, + ParamSpec, + Protocol, + TypeVar, + overload, + ) + + P = ParamSpec("P") + R = TypeVar("R", covariant=True) + + T = TypeVar("T", bound=Any) + + # Need two sets of ParamSpec/TypeVar for generics in some cases to ensure + # that mypy, pyrefly and ty all work correctly. More specifically need a + # separate set for cases where extracting the type or instance from the + # first argument of a callable where binding is involved. + + P1 = ParamSpec("P1") + R1 = TypeVar("R1", covariant=True) + + T1 = TypeVar("T1", bound=Any) + + P2 = ParamSpec("P2") + R2 = TypeVar("R2", covariant=True) + + T2 = TypeVar("T2", bound=Any) + + class Boolean(Protocol): + def __bool__(self) -> bool: ... + + # ObjectProxy + + class BaseObjectProxy(Generic[T]): + __wrapped__: T + def __init__(self, wrapped: T) -> None: ... + + class ObjectProxy(BaseObjectProxy[T]): + def __init__(self, wrapped: T) -> None: ... + + class AutoObjectProxy(BaseObjectProxy[T]): + def __init__(self, wrapped: T) -> None: ... + + # LazyObjectProxy + + class LazyObjectProxy(AutoObjectProxy[T]): + def __init__( + self, callback: Callable[[], T] | None, *, interface: Any = ... + ) -> None: ... + + @overload + def lazy_import(name: str) -> LazyObjectProxy[ModuleType]: ... + @overload + def lazy_import( + name: str, attribute: str, *, interface: Any = ... + ) -> LazyObjectProxy[Any]: ... + + # CallableObjectProxy + + class CallableObjectProxy(BaseObjectProxy[T]): + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + + # PartialCallableObjectProxy + + class PartialCallableObjectProxy: + def __init__( + self, func: Callable[..., Any], *args: Any, **kwargs: Any + ) -> None: ... + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + + def partial( + func: Callable[..., Any], /, *args: Any, **kwargs: Any + ) -> Callable[..., Any]: ... + + # WeakFunctionProxy + + class WeakFunctionProxy: + def __init__( + self, + wrapped: Callable[..., Any], + callback: Callable[..., Any] | None = None, + ) -> None: ... + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + + # FunctionWrapper + + WrappedFunction = Callable[P, R] + + GenericCallableWrapperFunction = Callable[ + [WrappedFunction[P, R], Any, tuple[Any, ...], dict[str, Any]], R + ] + + ClassMethodWrapperFunction = Callable[ + [type[Any], WrappedFunction[P, R], Any, tuple[Any, ...], dict[str, Any]], R + ] + + InstanceMethodWrapperFunction = Callable[ + [Any, WrappedFunction[P, R], Any, tuple[Any, ...], dict[str, Any]], R + ] + + WrapperFunction = ( + GenericCallableWrapperFunction[P, R] + | ClassMethodWrapperFunction[P, R] + | InstanceMethodWrapperFunction[P, R] + ) + + class _FunctionWrapperBase(ObjectProxy[WrappedFunction[P, R]]): + _self_instance: Any + _self_wrapper: WrapperFunction[P, R] + _self_enabled: bool | Boolean | Callable[[], bool] | None + _self_binding: str + _self_parent: Any + _self_owner: Any + + class BoundFunctionWrapper(_FunctionWrapperBase[P1, R1]): + def __call__(self, *args: P1.args, **kwargs: P1.kwargs) -> R1: ... + + # Note that for following overloads, testing with mypy and ty they still do + # not handle static methods being decorated but to best knowledge this is + # a limitation in those type checkers. Testing with pyrefly fails on any + # type of bound method. Testing with pyright handles case correctly. + # + # Also, note that use of T2, P2 and R2 in first two cases is also required + # to ensure correct handling by mypy and ty, so do not change to use of T1, + # P1 and R1. + + @overload + def __get__( # Required to ensure mypy, pyrefly and ty works correctly + self: BoundFunctionWrapper[Concatenate[T2, P2], R2], + instance: T2, + owner: type[T2] | None = None, + ) -> BoundFunctionWrapper[P2, R2]: ... + @overload + def __get__( # Required to ensure mypy, pyrefly and ty works correctly + self: BoundFunctionWrapper[Concatenate[T2, P2], R2], + instance: T2, + owner: type[Any] | None = None, + ) -> BoundFunctionWrapper[P2, R2]: ... + @overload + def __get__( # Required to ensure mypy, pyrefly and ty works correctly + self, instance: None, owner: type[T1] | None = None + ) -> BoundFunctionWrapper[P1, R1]: ... + @overload + def __get__( # Required to ensure pyright works correctly + self, instance: T1, owner: type[T1] | None = None + ) -> BoundFunctionWrapper[P1, R1]: ... + + class FunctionWrapper(_FunctionWrapperBase[P1, R1]): + def __init__( + self, + wrapped: WrappedFunction[P1, R1], + wrapper: WrapperFunction[P1, R1], + enabled: bool | Boolean | Callable[[], bool] | None = None, + ) -> None: ... + def __call__(self, *args: P1.args, **kwargs: P1.kwargs) -> R1: ... + + # Note that for following overloads, testing with mypy and ty they still do + # not handle static methods being decorated but to best knowledge this is + # a limitation in those type checkers. Testing with pyrefly fails on any + # type of bound method. Testing with pyright handles case correctly. + # + # Also, note that use of T2, P2 and R2 in first two cases is also required + # to ensure correct handling by mypy and ty, so do not change to use of T1, + # P1 and R1. + + @overload + def __get__( # Required to ensure mypy, pyrefly and ty works correctly + self: FunctionWrapper[Concatenate[T2, P2], R2], + instance: T2, + owner: type[Any] | None = None, + ) -> BoundFunctionWrapper[P2, R2]: ... + @overload + def __get__( # Required to ensure mypy, pyrefly and ty works correctly + self: FunctionWrapper[Concatenate[T2, P2], R2], + instance: T2, + owner: type[T2] | None = None, + ) -> BoundFunctionWrapper[P2, R2]: ... + @overload + def __get__( # Required to ensure mypy, pyrefly and ty works correctly + self, instance: None, owner: type[T1] | None = None + ) -> BoundFunctionWrapper[P1, R1]: ... + @overload + def __get__( # Required to ensure pyright works correctly + self, instance: T1, owner: type[T1] | None = None + ) -> BoundFunctionWrapper[P1, R1]: ... + + # AdapterFactory/adapter_factory() + + class AdapterFactory(Protocol): + def __call__( + self, wrapped: Callable[..., Any] + ) -> str | FullArgSpec | Callable[..., Any]: ... + + def adapter_factory(wrapped: Callable[..., Any]) -> AdapterFactory: ... + + # decorator() + + class Descriptor(Protocol): + def __get__(self, instance: Any, owner: type[Any] | None = None) -> Any: ... + + class FunctionDecorator: + @overload + def __call__( + self, + callable: ( + Callable[P, R] + | Callable[Concatenate[type[T], P], R] # Required for pylance + # | Callable[Concatenate[Any, P], R] # Breaks mypy, pyrefly and ty + | Callable[[type[T]], R] # Required for pylance + ), + ) -> FunctionWrapper[P, R]: ... + @overload + def __call__(self, callable: Descriptor) -> FunctionWrapper[P, Any]: ... + + class PartialFunctionDecorator: + @overload + def __call__( + self, wrapper: GenericCallableWrapperFunction[P, R], / + ) -> FunctionDecorator: ... + @overload + def __call__( + self, wrapper: ClassMethodWrapperFunction[P, R], / + ) -> FunctionDecorator: ... + @overload + def __call__( + self, wrapper: InstanceMethodWrapperFunction[P, R], / + ) -> FunctionDecorator: ... + + # ... Decorator applied to class type. + + @overload + def decorator(wrapper: type[T], /) -> FunctionDecorator: ... + + # ... Decorator applied to function or method. + + @overload + def decorator( + wrapper: GenericCallableWrapperFunction[P, R], / + ) -> FunctionDecorator: ... + @overload + def decorator( + wrapper: ClassMethodWrapperFunction[P, R], / + ) -> FunctionDecorator: ... + @overload + def decorator( + wrapper: InstanceMethodWrapperFunction[P, R], / + ) -> FunctionDecorator: ... + + # ... Positional arguments. + + @overload + def decorator( + *, + enabled: bool | Boolean | Callable[[], bool] | None = None, + adapter: str | FullArgSpec | AdapterFactory | Callable[..., Any] | None = None, + proxy: type[FunctionWrapper[Any, Any]] | None = None, + ) -> PartialFunctionDecorator: ... + + # function_wrapper() + + @overload + def function_wrapper(wrapper: type[Any]) -> FunctionDecorator: ... + @overload + def function_wrapper( + wrapper: GenericCallableWrapperFunction[P, R], + ) -> FunctionDecorator: ... + @overload + def function_wrapper( + wrapper: ClassMethodWrapperFunction[P, R], + ) -> FunctionDecorator: ... + @overload + def function_wrapper( + wrapper: InstanceMethodWrapperFunction[P, R], + ) -> FunctionDecorator: ... + # @overload + # def function_wrapper(wrapper: Any) -> FunctionDecorator: ... # Don't use, breaks stuff. + + # wrap_function_wrapper() + + def wrap_function_wrapper( + target: ModuleType | type[Any] | Any | str, + name: str, + wrapper: WrapperFunction[P, R], + ) -> FunctionWrapper[P, R]: ... + + # patch_function_wrapper() + + class WrapperDecorator: + def __call__(self, wrapper: WrapperFunction[P, R]) -> FunctionWrapper[P, R]: ... + + def patch_function_wrapper( + target: ModuleType | type[Any] | Any | str, + name: str, + enabled: bool | Boolean | Callable[[], bool] | None = None, + ) -> WrapperDecorator: ... + + # transient_function_wrapper() + + class TransientDecorator: + def __call__(self, wrapper: WrapperFunction[P, R]) -> FunctionDecorator: ... + + def transient_function_wrapper( + target: ModuleType | type[Any] | Any | str, name: str + ) -> TransientDecorator: ... + + # resolve_path() + + def resolve_path( + target: ModuleType | type[Any] | Any | str, name: str + ) -> tuple[ModuleType | type[Any] | Any, str, Callable[..., Any]]: ... + + # apply_patch() + + def apply_patch( + parent: ModuleType | type[Any] | Any, + attribute: str, + replacement: Any, + ) -> None: ... + + # wrap_object() + + WrapperFactory = Callable[ + [Callable[..., Any], tuple[Any, ...], dict[str, Any]], type[ObjectProxy[Any]] + ] + + def wrap_object( + target: ModuleType | type[Any] | Any | str, + name: str, + factory: WrapperFactory | type[ObjectProxy[Any]], + args: tuple[Any, ...], + kwargs: dict[str, Any], + ) -> Any: ... + + # wrap_object_attribute() + + def wrap_object_attribute( + target: ModuleType | type[Any] | Any | str, + name: str, + factory: WrapperFactory | type[ObjectProxy[Any]], + args: tuple[Any, ...] = (), + kwargs: dict[str, Any] = {}, + ) -> Any: ... + + # register_post_import_hook() + + def register_post_import_hook( + hook: Callable[[ModuleType], Any] | str, name: str + ) -> None: ... + + # discover_post_import_hooks() + + def discover_post_import_hooks(group: str) -> None: ... + + # notify_module_loaded() + + def notify_module_loaded(module: ModuleType) -> None: ... + + # when_imported() + + class ImportHookDecorator: + def __call__(self, hook: Callable[[ModuleType], Any]) -> Callable[..., Any]: ... + + def when_imported(name: str) -> ImportHookDecorator: ... + + # synchronized() + + class SynchronizedObject: + def __call__(self, wrapped: Callable[P, R]) -> Callable[P, R]: ... + def __enter__(self) -> Any: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> bool | None: ... + + @overload + def synchronized(wrapped: Callable[P, R]) -> Callable[P, R]: ... + @overload + def synchronized(wrapped: Any) -> SynchronizedObject: ... diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/__wrapt__.py b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/__wrapt__.py new file mode 100644 index 0000000000000000000000000000000000000000..c006f5fede77a79a3cff1a60ea31d770d8fbbd3b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/__wrapt__.py @@ -0,0 +1,42 @@ +"""This module is used to switch between C and Python implementations of the +wrappers. +""" + +import os + +from .wrappers import BoundFunctionWrapper, CallableObjectProxy, FunctionWrapper +from .wrappers import ObjectProxy as BaseObjectProxy +from .wrappers import PartialCallableObjectProxy, _FunctionWrapperBase + +# Try to use C extensions if not disabled. + +_using_c_extension = False + +_use_extensions = not os.environ.get("WRAPT_DISABLE_EXTENSIONS") + +if _use_extensions: + try: + from ._wrappers import ( # type: ignore[no-redef,import-not-found] + BoundFunctionWrapper, + CallableObjectProxy, + FunctionWrapper, + ) + from ._wrappers import ObjectProxy as BaseObjectProxy # type: ignore[no-redef] + from ._wrappers import ( # type: ignore[no-redef,import-not-found] + PartialCallableObjectProxy, + _FunctionWrapperBase, + ) + + _using_c_extension = True + except ImportError: + # C extensions not available, using Python implementations + pass + + +def partial(*args, **kwargs): + """Create a callable object proxy with partial application of the given + arguments and keywords. This behaves the same as `functools.partial`, but + implemented using the `ObjectProxy` class to provide better support for + introspection. + """ + return PartialCallableObjectProxy(*args, **kwargs) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/_wrappers.c b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/_wrappers.c new file mode 100644 index 0000000000000000000000000000000000000000..dabb0c4c5d335cb87399ab67a892957f30152251 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/_wrappers.c @@ -0,0 +1,4097 @@ +/* ------------------------------------------------------------------------- */ + +#include "Python.h" + +#include "structmember.h" + +#ifndef PyVarObject_HEAD_INIT +#define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, +#endif + +/* ------------------------------------------------------------------------- */ + +typedef struct +{ + PyObject_HEAD + + PyObject *dict; + PyObject *wrapped; + PyObject *weakreflist; +} WraptObjectProxyObject; + +PyTypeObject WraptObjectProxy_Type; +PyTypeObject WraptCallableObjectProxy_Type; + +typedef struct +{ + WraptObjectProxyObject object_proxy; + + PyObject *args; + PyObject *kwargs; +} WraptPartialCallableObjectProxyObject; + +PyTypeObject WraptPartialCallableObjectProxy_Type; + +typedef struct +{ + WraptObjectProxyObject object_proxy; + + PyObject *instance; + PyObject *wrapper; + PyObject *enabled; + PyObject *binding; + PyObject *parent; + PyObject *owner; +} WraptFunctionWrapperObject; + +PyTypeObject WraptFunctionWrapperBase_Type; +PyTypeObject WraptBoundFunctionWrapper_Type; +PyTypeObject WraptFunctionWrapper_Type; + +/* ------------------------------------------------------------------------- */ + +static int raise_uninitialized_wrapper_error(WraptObjectProxyObject *object) +{ + // Before raising an exception we need to first check whether this is a lazy + // proxy object and attempt to intialize the wrapped object using the supplied + // callback if so. If the callback is not present then we can proceed to raise + // the exception, but if the callback is present and returns a value, we set + // that as the wrapped object and continue and return without raising an error. + + static PyObject *wrapped_str = NULL; + static PyObject *wrapped_factory_str = NULL; + static PyObject *wrapped_get_str = NULL; + + PyObject *callback = NULL; + PyObject *value = NULL; + + if (!wrapped_str) + { + wrapped_str = PyUnicode_InternFromString("__wrapped__"); + wrapped_factory_str = PyUnicode_InternFromString("__wrapped_factory__"); + wrapped_get_str = PyUnicode_InternFromString("__wrapped_get__"); + } + + // Note that we use existance of __wrapped_factory__ to gate whether we can + // attempt to initialize the wrapped object lazily, but it is __wrapped_get__ + // that we actually call to do the initialization. This is so that we can + // handle multithreading correctly by having __wrapped_get__ use a lock to + // protect against multiple threads trying to initialize the wrapped object + // at the same time. + + callback = PyObject_GenericGetAttr((PyObject *)object, wrapped_factory_str); + + if (callback) + { + if (callback != Py_None) + { + Py_DECREF(callback); + + callback = PyObject_GenericGetAttr((PyObject *)object, wrapped_get_str); + + if (!callback) + return -1; + + value = PyObject_CallObject(callback, NULL); + + Py_DECREF(callback); + + if (value) + { + // We use setattr so that special dunder methods will be properly set. + + if (PyObject_SetAttr((PyObject *)object, wrapped_str, value) == -1) + { + Py_DECREF(value); + return -1; + } + + Py_DECREF(value); + + return 0; + } + else + { + return -1; + } + } + else + { + Py_DECREF(callback); + } + } + else + PyErr_Clear(); + + // We need to reach into the wrapt.wrappers module to get the exception + // class because the exception we need to raise needs to inherit from both + // ValueError and AttributeError and we can't do that in C code using the + // built in exception classes, or at least not easily or safely. + + PyObject *wrapt_wrappers_module = NULL; + PyObject *wrapper_not_initialized_error = NULL; + + // Import the wrapt.wrappers module and get the exception class. + // We do this fresh each time to be safe with multiple sub-interpreters. + + wrapt_wrappers_module = PyImport_ImportModule("wrapt.wrappers"); + + if (!wrapt_wrappers_module) + { + // Fallback to ValueError if import fails. + + PyErr_SetString(PyExc_ValueError, "wrapper has not been initialized"); + + return -1; + } + + wrapper_not_initialized_error = PyObject_GetAttrString( + wrapt_wrappers_module, "WrapperNotInitializedError"); + + if (!wrapper_not_initialized_error) + { + // Fallback to ValueError if attribute lookup fails. + + Py_DECREF(wrapt_wrappers_module); + + PyErr_SetString(PyExc_ValueError, "wrapper has not been initialized"); + + return -1; + } + + // Raise the custom exception. + + PyErr_SetString(wrapper_not_initialized_error, + "wrapper has not been initialized"); + + // Clean up references. + + Py_DECREF(wrapper_not_initialized_error); + Py_DECREF(wrapt_wrappers_module); + + return -1; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_new(PyTypeObject *type, PyObject *args, + PyObject *kwds) +{ + WraptObjectProxyObject *self; + + self = (WraptObjectProxyObject *)type->tp_alloc(type, 0); + + if (!self) + return NULL; + + self->dict = PyDict_New(); + self->wrapped = NULL; + self->weakreflist = NULL; + + return (PyObject *)self; +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_raw_init(WraptObjectProxyObject *self, + PyObject *wrapped) +{ + static PyObject *module_str = NULL; + static PyObject *doc_str = NULL; + static PyObject *wrapped_factory_str = NULL; + + PyObject *object = NULL; + + // If wrapped is Py_None and we have a __wrapped_factory__ attribute + // then we defer initialization of the wrapped object until it is first needed. + + if (!wrapped_factory_str) + { + wrapped_factory_str = PyUnicode_InternFromString("__wrapped_factory__"); + } + + if (wrapped == Py_None) + { + PyObject *callback = NULL; + + callback = PyObject_GenericGetAttr((PyObject *)self, wrapped_factory_str); + + if (callback) + { + if (callback != Py_None) + { + Py_DECREF(callback); + return 0; + } + else + { + Py_DECREF(callback); + } + } + else + PyErr_Clear(); + } + + Py_INCREF(wrapped); + Py_XDECREF(self->wrapped); + self->wrapped = wrapped; + + if (!module_str) + { + module_str = PyUnicode_InternFromString("__module__"); + } + + if (!doc_str) + { + doc_str = PyUnicode_InternFromString("__doc__"); + } + + object = PyObject_GetAttr(wrapped, module_str); + + if (object) + { + if (PyDict_SetItem(self->dict, module_str, object) == -1) + { + Py_DECREF(object); + return -1; + } + Py_DECREF(object); + } + else + PyErr_Clear(); + + object = PyObject_GetAttr(wrapped, doc_str); + + if (object) + { + if (PyDict_SetItem(self->dict, doc_str, object) == -1) + { + Py_DECREF(object); + return -1; + } + Py_DECREF(object); + } + else + PyErr_Clear(); + + return 0; +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_init(WraptObjectProxyObject *self, PyObject *args, + PyObject *kwds) +{ + PyObject *wrapped = NULL; + + char *const kwlist[] = {"wrapped", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:ObjectProxy", kwlist, + &wrapped)) + { + return -1; + } + + return WraptObjectProxy_raw_init(self, wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_traverse(WraptObjectProxyObject *self, + visitproc visit, void *arg) +{ + Py_VISIT(self->dict); + Py_VISIT(self->wrapped); + + return 0; +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_clear(WraptObjectProxyObject *self) +{ + Py_CLEAR(self->dict); + Py_CLEAR(self->wrapped); + + return 0; +} + +/* ------------------------------------------------------------------------- */ + +static void WraptObjectProxy_dealloc(WraptObjectProxyObject *self) +{ + PyObject_GC_UnTrack(self); + + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *)self); + + WraptObjectProxy_clear(self); + + Py_TYPE(self)->tp_free(self); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_repr(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyUnicode_FromFormat("<%s at %p for %s at %p>", Py_TYPE(self)->tp_name, + self, Py_TYPE(self->wrapped)->tp_name, + self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static Py_hash_t WraptObjectProxy_hash(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return -1; + } + + return PyObject_Hash(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_str(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_Str(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_add(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_Add(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_subtract(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_Subtract(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_multiply(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_Multiply(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_remainder(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_Remainder(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_divmod(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_Divmod(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_power(PyObject *o1, PyObject *o2, + PyObject *modulo) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_Power(o1, o2, modulo); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_negative(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyNumber_Negative(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_positive(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyNumber_Positive(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_absolute(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyNumber_Absolute(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_bool(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return -1; + } + + return PyObject_IsTrue(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_invert(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyNumber_Invert(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_lshift(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_Lshift(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_rshift(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_Rshift(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_and(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_And(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_xor(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_Xor(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_or(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_Or(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_long(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyNumber_Long(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_float(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyNumber_Float(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_inplace_add(WraptObjectProxyObject *self, + PyObject *other) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__iadd__")) + { + object = PyNumber_InPlaceAdd(self->wrapped, other); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_Add(self->wrapped, other); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_inplace_subtract(WraptObjectProxyObject *self, + PyObject *other) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__isub__")) + { + object = PyNumber_InPlaceSubtract(self->wrapped, other); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_Subtract(self->wrapped, other); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_inplace_multiply(WraptObjectProxyObject *self, + PyObject *other) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__imul__")) + { + object = PyNumber_InPlaceMultiply(self->wrapped, other); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_Multiply(self->wrapped, other); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptObjectProxy_inplace_remainder(WraptObjectProxyObject *self, + PyObject *other) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__imod__")) + { + object = PyNumber_InPlaceRemainder(self->wrapped, other); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_Remainder(self->wrapped, other); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_inplace_power(WraptObjectProxyObject *self, + PyObject *other, + PyObject *modulo) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__ipow__")) + { + object = PyNumber_InPlacePower(self->wrapped, other, modulo); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_Power(self->wrapped, other, modulo); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_inplace_lshift(WraptObjectProxyObject *self, + PyObject *other) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__ilshift__")) + { + object = PyNumber_InPlaceLshift(self->wrapped, other); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_Lshift(self->wrapped, other); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_inplace_rshift(WraptObjectProxyObject *self, + PyObject *other) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__irshift__")) + { + object = PyNumber_InPlaceRshift(self->wrapped, other); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_Rshift(self->wrapped, other); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_inplace_and(WraptObjectProxyObject *self, + PyObject *other) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__iand__")) + { + object = PyNumber_InPlaceAnd(self->wrapped, other); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_And(self->wrapped, other); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_inplace_xor(WraptObjectProxyObject *self, + PyObject *other) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__ixor__")) + { + object = PyNumber_InPlaceXor(self->wrapped, other); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_Xor(self->wrapped, other); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_inplace_or(WraptObjectProxyObject *self, + PyObject *other) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__ior__")) + { + object = PyNumber_InPlaceOr(self->wrapped, other); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_Or(self->wrapped, other); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_floor_divide(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_FloorDivide(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_true_divide(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_TrueDivide(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptObjectProxy_inplace_floor_divide(WraptObjectProxyObject *self, + PyObject *other) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__ifloordiv__")) + { + object = PyNumber_InPlaceFloorDivide(self->wrapped, other); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_FloorDivide(self->wrapped, other); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptObjectProxy_inplace_true_divide(WraptObjectProxyObject *self, + PyObject *other) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__itruediv__")) + { + object = PyNumber_InPlaceTrueDivide(self->wrapped, other); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_TrueDivide(self->wrapped, other); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_index(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyNumber_Index(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_matrix_multiply(PyObject *o1, PyObject *o2) +{ + if (PyObject_IsInstance(o1, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o1)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o1) == -1) + return NULL; + } + + o1 = ((WraptObjectProxyObject *)o1)->wrapped; + } + + if (PyObject_IsInstance(o2, (PyObject *)&WraptObjectProxy_Type)) + { + if (!((WraptObjectProxyObject *)o2)->wrapped) + { + if (raise_uninitialized_wrapper_error((WraptObjectProxyObject *)o2) == -1) + return NULL; + } + + o2 = ((WraptObjectProxyObject *)o2)->wrapped; + } + + return PyNumber_MatrixMultiply(o1, o2); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_inplace_matrix_multiply( + WraptObjectProxyObject *self, PyObject *other) +{ + PyObject *object = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (PyObject_IsInstance(other, (PyObject *)&WraptObjectProxy_Type)) + other = ((WraptObjectProxyObject *)other)->wrapped; + + if (PyObject_HasAttrString(self->wrapped, "__imatmul__")) + { + object = PyNumber_InPlaceMatrixMultiply(self->wrapped, other); + + if (!object) + return NULL; + + Py_DECREF(self->wrapped); + self->wrapped = object; + + Py_INCREF(self); + return (PyObject *)self; + } + else + { + PyObject *result = PyNumber_MatrixMultiply(self->wrapped, other); + + if (!result) + return NULL; + + PyObject *proxy_type = PyObject_GetAttrString((PyObject *)self, "__object_proxy__"); + + if (!proxy_type) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_args = PyTuple_Pack(1, result); + + Py_DECREF(result); + + if (!proxy_args) + { + Py_DECREF(proxy_type); + return NULL; + } + + PyObject *proxy_instance = PyObject_Call(proxy_type, proxy_args, NULL); + + Py_DECREF(proxy_type); + Py_DECREF(proxy_args); + + return proxy_instance; + } +} + +/* ------------------------------------------------------------------------- */ + +static Py_ssize_t WraptObjectProxy_length(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return -1; + } + + return PyObject_Length(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_contains(WraptObjectProxyObject *self, + PyObject *value) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return -1; + } + + return PySequence_Contains(self->wrapped, value); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_getitem(WraptObjectProxyObject *self, + PyObject *key) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_GetItem(self->wrapped, key); +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_setitem(WraptObjectProxyObject *self, PyObject *key, + PyObject *value) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return -1; + } + + if (value == NULL) + return PyObject_DelItem(self->wrapped, key); + else + return PyObject_SetItem(self->wrapped, key, value); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_self_setattr(WraptObjectProxyObject *self, + PyObject *args) +{ + PyObject *name = NULL; + PyObject *value = NULL; + + if (!PyArg_ParseTuple(args, "UO:__self_setattr__", &name, &value)) + return NULL; + + if (PyObject_GenericSetAttr((PyObject *)self, name, value) != 0) + { + return NULL; + } + + Py_INCREF(Py_None); + return Py_None; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_dir(WraptObjectProxyObject *self, + PyObject *args) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_Dir(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_enter(WraptObjectProxyObject *self, + PyObject *args, PyObject *kwds) +{ + PyObject *method = NULL; + PyObject *result = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + method = PyObject_GetAttrString(self->wrapped, "__enter__"); + + if (!method) + return NULL; + + result = PyObject_Call(method, args, kwds); + + Py_DECREF(method); + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_exit(WraptObjectProxyObject *self, + PyObject *args, PyObject *kwds) +{ + PyObject *method = NULL; + PyObject *result = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + method = PyObject_GetAttrString(self->wrapped, "__exit__"); + + if (!method) + return NULL; + + result = PyObject_Call(method, args, kwds); + + Py_DECREF(method); + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_aenter(WraptObjectProxyObject *self, + PyObject *args, PyObject *kwds) +{ + PyObject *method = NULL; + PyObject *result = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + method = PyObject_GetAttrString(self->wrapped, "__aenter__"); + + if (!method) + return NULL; + + result = PyObject_Call(method, args, kwds); + + Py_DECREF(method); + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_aexit(WraptObjectProxyObject *self, + PyObject *args, PyObject *kwds) +{ + PyObject *method = NULL; + PyObject *result = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + method = PyObject_GetAttrString(self->wrapped, "__aexit__"); + + if (!method) + return NULL; + + result = PyObject_Call(method, args, kwds); + + Py_DECREF(method); + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_copy(WraptObjectProxyObject *self, + PyObject *args, PyObject *kwds) +{ + PyErr_SetString(PyExc_NotImplementedError, + "object proxy must define __copy__()"); + + return NULL; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_deepcopy(WraptObjectProxyObject *self, + PyObject *args, PyObject *kwds) +{ + PyErr_SetString(PyExc_NotImplementedError, + "object proxy must define __deepcopy__()"); + + return NULL; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_reduce(WraptObjectProxyObject *self, + PyObject *args, PyObject *kwds) +{ + PyErr_SetString(PyExc_NotImplementedError, + "object proxy must define __reduce__()"); + + return NULL; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_reduce_ex(WraptObjectProxyObject *self, + PyObject *args, PyObject *kwds) +{ + PyErr_SetString(PyExc_NotImplementedError, + "object proxy must define __reduce_ex__()"); + + return NULL; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_bytes(WraptObjectProxyObject *self, + PyObject *args) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_Bytes(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_format(WraptObjectProxyObject *self, + PyObject *args) +{ + PyObject *format_spec = NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (!PyArg_ParseTuple(args, "|O:format", &format_spec)) + return NULL; + + return PyObject_Format(self->wrapped, format_spec); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_reversed(WraptObjectProxyObject *self, + PyObject *args) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_CallFunctionObjArgs((PyObject *)&PyReversed_Type, + self->wrapped, NULL); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_round(WraptObjectProxyObject *self, + PyObject *args, PyObject *kwds) +{ + PyObject *ndigits = NULL; + + PyObject *module = NULL; + PyObject *round = NULL; + + PyObject *result = NULL; + + char *const kwlist[] = {"ndigits", NULL}; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:ObjectProxy", kwlist, + &ndigits)) + { + return NULL; + } + + module = PyImport_ImportModule("builtins"); + + if (!module) + return NULL; + + round = PyObject_GetAttrString(module, "round"); + + if (!round) + { + Py_DECREF(module); + return NULL; + } + + Py_INCREF(round); + Py_DECREF(module); + + result = PyObject_CallFunctionObjArgs(round, self->wrapped, ndigits, NULL); + + Py_DECREF(round); + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_complex(WraptObjectProxyObject *self, + PyObject *args) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_CallFunctionObjArgs((PyObject *)&PyComplex_Type, + self->wrapped, NULL); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_mro_entries(WraptObjectProxyObject *self, + PyObject *args, PyObject *kwds) +{ + PyObject *wrapped = NULL; + PyObject *mro_entries_method = NULL; + PyObject *result = NULL; + int is_type = 0; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + wrapped = self->wrapped; + + // Check if wrapped is a type (class). + + is_type = PyType_Check(wrapped); + + // If wrapped is not a type and has __mro_entries__, forward to it. + + if (!is_type) + { + mro_entries_method = PyObject_GetAttrString(wrapped, "__mro_entries__"); + + if (mro_entries_method) + { + // Call wrapped.__mro_entries__(bases). + + result = PyObject_Call(mro_entries_method, args, kwds); + + Py_DECREF(mro_entries_method); + + return result; + } + else + { + PyErr_Clear(); + } + } + + return Py_BuildValue("(O)", wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_get_name(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_GetAttrString(self->wrapped, "__name__"); +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_set_name(WraptObjectProxyObject *self, + PyObject *value) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return -1; + } + + return PyObject_SetAttrString(self->wrapped, "__name__", value); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_get_qualname(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_GetAttrString(self->wrapped, "__qualname__"); +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_set_qualname(WraptObjectProxyObject *self, + PyObject *value) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return -1; + } + + return PyObject_SetAttrString(self->wrapped, "__qualname__", value); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_get_module(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_GetAttrString(self->wrapped, "__module__"); +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_set_module(WraptObjectProxyObject *self, + PyObject *value) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return -1; + } + + if (PyObject_SetAttrString(self->wrapped, "__module__", value) == -1) + return -1; + + return PyDict_SetItemString(self->dict, "__module__", value); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_get_doc(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_GetAttrString(self->wrapped, "__doc__"); +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_set_doc(WraptObjectProxyObject *self, + PyObject *value) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return -1; + } + + if (PyObject_SetAttrString(self->wrapped, "__doc__", value) == -1) + return -1; + + return PyDict_SetItemString(self->dict, "__doc__", value); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_get_class(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_GetAttrString(self->wrapped, "__class__"); +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_set_class(WraptObjectProxyObject *self, + PyObject *value) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return -1; + } + + return PyObject_SetAttrString(self->wrapped, "__class__", value); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptObjectProxy_get_annotations(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_GetAttrString(self->wrapped, "__annotations__"); +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_set_annotations(WraptObjectProxyObject *self, + PyObject *value) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return -1; + } + + return PyObject_SetAttrString(self->wrapped, "__annotations__", value); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_get_wrapped(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + Py_INCREF(self->wrapped); + return self->wrapped; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_get_object_proxy(WraptObjectProxyObject *self) +{ + Py_INCREF(&WraptObjectProxy_Type); + return (PyObject *)&WraptObjectProxy_Type; +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_set_wrapped(WraptObjectProxyObject *self, + PyObject *value) +{ + static PyObject *fixups_str = NULL; + + PyObject *fixups = NULL; + + if (!value) + { + PyErr_SetString(PyExc_TypeError, "__wrapped__ must be an object"); + return -1; + } + + Py_INCREF(value); + Py_XDECREF(self->wrapped); + + self->wrapped = value; + + if (!fixups_str) + { + fixups_str = PyUnicode_InternFromString("__wrapped_setattr_fixups__"); + } + + fixups = PyObject_GetAttr((PyObject *)self, fixups_str); + + if (fixups) + { + PyObject *result = NULL; + + result = PyObject_CallObject(fixups, NULL); + Py_DECREF(fixups); + + if (!result) + return -1; + + Py_DECREF(result); + } + else + PyErr_Clear(); + + return 0; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_getattro(WraptObjectProxyObject *self, + PyObject *name) +{ + PyObject *object = NULL; + PyObject *result = NULL; + + static PyObject *getattr_str = NULL; + + object = PyObject_GenericGetAttr((PyObject *)self, name); + + if (object) + return object; + + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + return NULL; + + PyErr_Clear(); + + if (!getattr_str) + { + getattr_str = PyUnicode_InternFromString("__getattr__"); + } + + object = PyObject_GenericGetAttr((PyObject *)self, getattr_str); + + if (!object) + return NULL; + + result = PyObject_CallFunctionObjArgs(object, name, NULL); + + Py_DECREF(object); + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_getattr(WraptObjectProxyObject *self, + PyObject *args) +{ + PyObject *name = NULL; + + if (!PyArg_ParseTuple(args, "U:__getattr__", &name)) + return NULL; + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_GetAttr(self->wrapped, name); +} + +/* ------------------------------------------------------------------------- */ + +static int WraptObjectProxy_setattro(WraptObjectProxyObject *self, + PyObject *name, PyObject *value) +{ + static PyObject *self_str = NULL; + static PyObject *startswith_str = NULL; + + PyObject *match = NULL; + + if (!startswith_str) + { + startswith_str = PyUnicode_InternFromString("startswith"); + } + + if (!self_str) + { + self_str = PyUnicode_InternFromString("_self_"); + } + + match = PyObject_CallMethodObjArgs(name, startswith_str, self_str, NULL); + + if (match == Py_True) + { + Py_DECREF(match); + + return PyObject_GenericSetAttr((PyObject *)self, name, value); + } + else if (!match) + PyErr_Clear(); + + Py_XDECREF(match); + + if (PyObject_HasAttr((PyObject *)Py_TYPE(self), name)) + return PyObject_GenericSetAttr((PyObject *)self, name, value); + + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return -1; + } + + return PyObject_SetAttr(self->wrapped, name, value); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_richcompare(WraptObjectProxyObject *self, + PyObject *other, int opcode) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_RichCompare(self->wrapped, other, opcode); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptObjectProxy_iter(WraptObjectProxyObject *self) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_GetIter(self->wrapped); +} + +/* ------------------------------------------------------------------------- */ + +static PyNumberMethods WraptObjectProxy_as_number = { + (binaryfunc)WraptObjectProxy_add, /*nb_add*/ + (binaryfunc)WraptObjectProxy_subtract, /*nb_subtract*/ + (binaryfunc)WraptObjectProxy_multiply, /*nb_multiply*/ + (binaryfunc)WraptObjectProxy_remainder, /*nb_remainder*/ + (binaryfunc)WraptObjectProxy_divmod, /*nb_divmod*/ + (ternaryfunc)WraptObjectProxy_power, /*nb_power*/ + (unaryfunc)WraptObjectProxy_negative, /*nb_negative*/ + (unaryfunc)WraptObjectProxy_positive, /*nb_positive*/ + (unaryfunc)WraptObjectProxy_absolute, /*nb_absolute*/ + (inquiry)WraptObjectProxy_bool, /*nb_nonzero/nb_bool*/ + (unaryfunc)WraptObjectProxy_invert, /*nb_invert*/ + (binaryfunc)WraptObjectProxy_lshift, /*nb_lshift*/ + (binaryfunc)WraptObjectProxy_rshift, /*nb_rshift*/ + (binaryfunc)WraptObjectProxy_and, /*nb_and*/ + (binaryfunc)WraptObjectProxy_xor, /*nb_xor*/ + (binaryfunc)WraptObjectProxy_or, /*nb_or*/ + (unaryfunc)WraptObjectProxy_long, /*nb_int*/ + 0, /*nb_long/nb_reserved*/ + (unaryfunc)WraptObjectProxy_float, /*nb_float*/ + (binaryfunc)WraptObjectProxy_inplace_add, /*nb_inplace_add*/ + (binaryfunc)WraptObjectProxy_inplace_subtract, /*nb_inplace_subtract*/ + (binaryfunc)WraptObjectProxy_inplace_multiply, /*nb_inplace_multiply*/ + (binaryfunc)WraptObjectProxy_inplace_remainder, /*nb_inplace_remainder*/ + (ternaryfunc)WraptObjectProxy_inplace_power, /*nb_inplace_power*/ + (binaryfunc)WraptObjectProxy_inplace_lshift, /*nb_inplace_lshift*/ + (binaryfunc)WraptObjectProxy_inplace_rshift, /*nb_inplace_rshift*/ + (binaryfunc)WraptObjectProxy_inplace_and, /*nb_inplace_and*/ + (binaryfunc)WraptObjectProxy_inplace_xor, /*nb_inplace_xor*/ + (binaryfunc)WraptObjectProxy_inplace_or, /*nb_inplace_or*/ + (binaryfunc)WraptObjectProxy_floor_divide, /*nb_floor_divide*/ + (binaryfunc)WraptObjectProxy_true_divide, /*nb_true_divide*/ + (binaryfunc) + WraptObjectProxy_inplace_floor_divide, /*nb_inplace_floor_divide*/ + (binaryfunc)WraptObjectProxy_inplace_true_divide, /*nb_inplace_true_divide*/ + (unaryfunc)WraptObjectProxy_index, /*nb_index*/ + (binaryfunc)WraptObjectProxy_matrix_multiply, /*nb_matrix_multiply*/ + (binaryfunc)WraptObjectProxy_inplace_matrix_multiply, /*nb_inplace_matrix_multiply*/ +}; + +static PySequenceMethods WraptObjectProxy_as_sequence = { + (lenfunc)WraptObjectProxy_length, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + (objobjproc)WraptObjectProxy_contains, /* sq_contains */ +}; + +static PyMappingMethods WraptObjectProxy_as_mapping = { + (lenfunc)WraptObjectProxy_length, /*mp_length*/ + (binaryfunc)WraptObjectProxy_getitem, /*mp_subscript*/ + (objobjargproc)WraptObjectProxy_setitem, /*mp_ass_subscript*/ +}; + +static PyMethodDef WraptObjectProxy_methods[] = { + {"__self_setattr__", (PyCFunction)WraptObjectProxy_self_setattr, + METH_VARARGS, 0}, + {"__dir__", (PyCFunction)WraptObjectProxy_dir, METH_NOARGS, 0}, + {"__enter__", (PyCFunction)WraptObjectProxy_enter, + METH_VARARGS | METH_KEYWORDS, 0}, + {"__exit__", (PyCFunction)WraptObjectProxy_exit, + METH_VARARGS | METH_KEYWORDS, 0}, + {"__aenter__", (PyCFunction)WraptObjectProxy_aenter, + METH_VARARGS | METH_KEYWORDS, 0}, + {"__aexit__", (PyCFunction)WraptObjectProxy_aexit, + METH_VARARGS | METH_KEYWORDS, 0}, + {"__copy__", (PyCFunction)WraptObjectProxy_copy, METH_NOARGS, 0}, + {"__deepcopy__", (PyCFunction)WraptObjectProxy_deepcopy, + METH_VARARGS | METH_KEYWORDS, 0}, + {"__reduce__", (PyCFunction)WraptObjectProxy_reduce, METH_NOARGS, 0}, + {"__reduce_ex__", (PyCFunction)WraptObjectProxy_reduce_ex, + METH_VARARGS | METH_KEYWORDS, 0}, + {"__getattr__", (PyCFunction)WraptObjectProxy_getattr, METH_VARARGS, 0}, + {"__bytes__", (PyCFunction)WraptObjectProxy_bytes, METH_NOARGS, 0}, + {"__format__", (PyCFunction)WraptObjectProxy_format, METH_VARARGS, 0}, + {"__reversed__", (PyCFunction)WraptObjectProxy_reversed, METH_NOARGS, 0}, + {"__round__", (PyCFunction)WraptObjectProxy_round, + METH_VARARGS | METH_KEYWORDS, 0}, + {"__complex__", (PyCFunction)WraptObjectProxy_complex, METH_NOARGS, 0}, + {"__mro_entries__", (PyCFunction)WraptObjectProxy_mro_entries, + METH_VARARGS | METH_KEYWORDS, 0}, + {NULL, NULL}, +}; + +static PyGetSetDef WraptObjectProxy_getset[] = { + {"__name__", (getter)WraptObjectProxy_get_name, + (setter)WraptObjectProxy_set_name, 0}, + {"__qualname__", (getter)WraptObjectProxy_get_qualname, + (setter)WraptObjectProxy_set_qualname, 0}, + {"__module__", (getter)WraptObjectProxy_get_module, + (setter)WraptObjectProxy_set_module, 0}, + {"__doc__", (getter)WraptObjectProxy_get_doc, + (setter)WraptObjectProxy_set_doc, 0}, + {"__class__", (getter)WraptObjectProxy_get_class, + (setter)WraptObjectProxy_set_class, 0}, + {"__annotations__", (getter)WraptObjectProxy_get_annotations, + (setter)WraptObjectProxy_set_annotations, 0}, + {"__wrapped__", (getter)WraptObjectProxy_get_wrapped, + (setter)WraptObjectProxy_set_wrapped, 0}, + {"__object_proxy__", (getter)WraptObjectProxy_get_object_proxy, 0, 0}, + {NULL}, +}; + +PyTypeObject WraptObjectProxy_Type = { + PyVarObject_HEAD_INIT(NULL, 0) "ObjectProxy", /*tp_name*/ + sizeof(WraptObjectProxyObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)WraptObjectProxy_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_as_async*/ + (unaryfunc)WraptObjectProxy_repr, /*tp_repr*/ + &WraptObjectProxy_as_number, /*tp_as_number*/ + &WraptObjectProxy_as_sequence, /*tp_as_sequence*/ + &WraptObjectProxy_as_mapping, /*tp_as_mapping*/ + (hashfunc)WraptObjectProxy_hash, /*tp_hash*/ + 0, /*tp_call*/ + (unaryfunc)WraptObjectProxy_str, /*tp_str*/ + (getattrofunc)WraptObjectProxy_getattro, /*tp_getattro*/ + (setattrofunc)WraptObjectProxy_setattro, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + (traverseproc)WraptObjectProxy_traverse, /*tp_traverse*/ + (inquiry)WraptObjectProxy_clear, /*tp_clear*/ + (richcmpfunc)WraptObjectProxy_richcompare, /*tp_richcompare*/ + offsetof(WraptObjectProxyObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* (getiterfunc)WraptObjectProxy_iter, */ /*tp_iter*/ + 0, /*tp_iternext*/ + WraptObjectProxy_methods, /*tp_methods*/ + 0, /*tp_members*/ + WraptObjectProxy_getset, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + offsetof(WraptObjectProxyObject, dict), /*tp_dictoffset*/ + (initproc)WraptObjectProxy_init, /*tp_init*/ + PyType_GenericAlloc, /*tp_alloc*/ + WraptObjectProxy_new, /*tp_new*/ + PyObject_GC_Del, /*tp_free*/ + 0, /*tp_is_gc*/ +}; + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptCallableObjectProxy_call(WraptObjectProxyObject *self, + PyObject *args, PyObject *kwds) +{ + if (!self->wrapped) + { + if (raise_uninitialized_wrapper_error(self) == -1) + return NULL; + } + + return PyObject_Call(self->wrapped, args, kwds); +} + +/* ------------------------------------------------------------------------- */; + +static PyGetSetDef WraptCallableObjectProxy_getset[] = { + {"__module__", (getter)WraptObjectProxy_get_module, + (setter)WraptObjectProxy_set_module, 0}, + {"__doc__", (getter)WraptObjectProxy_get_doc, + (setter)WraptObjectProxy_set_doc, 0}, + {NULL}, +}; + +PyTypeObject WraptCallableObjectProxy_Type = { + PyVarObject_HEAD_INIT(NULL, 0) "CallableObjectProxy", /*tp_name*/ + sizeof(WraptObjectProxyObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + 0, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + (ternaryfunc)WraptCallableObjectProxy_call, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(WraptObjectProxyObject, weakreflist), /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + WraptCallableObjectProxy_getset, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + (initproc)WraptObjectProxy_init, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ +}; + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptPartialCallableObjectProxy_new(PyTypeObject *type, + PyObject *args, + PyObject *kwds) +{ + WraptPartialCallableObjectProxyObject *self; + + self = (WraptPartialCallableObjectProxyObject *)WraptObjectProxy_new( + type, args, kwds); + + if (!self) + return NULL; + + self->args = NULL; + self->kwargs = NULL; + + return (PyObject *)self; +} + +/* ------------------------------------------------------------------------- */ + +static int WraptPartialCallableObjectProxy_raw_init( + WraptPartialCallableObjectProxyObject *self, PyObject *wrapped, + PyObject *args, PyObject *kwargs) +{ + int result = 0; + + result = WraptObjectProxy_raw_init((WraptObjectProxyObject *)self, wrapped); + + if (result == 0) + { + Py_INCREF(args); + Py_XDECREF(self->args); + self->args = args; + + Py_XINCREF(kwargs); + Py_XDECREF(self->kwargs); + self->kwargs = kwargs; + } + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static int WraptPartialCallableObjectProxy_init( + WraptPartialCallableObjectProxyObject *self, PyObject *args, + PyObject *kwds) +{ + PyObject *wrapped = NULL; + PyObject *fnargs = NULL; + + int result = 0; + + if (!PyObject_Length(args)) + { + PyErr_SetString(PyExc_TypeError, "__init__ of partial needs an argument"); + return -1; + } + + if (PyObject_Length(args) < 1) + { + PyErr_SetString(PyExc_TypeError, + "partial type takes at least one argument"); + return -1; + } + + wrapped = PyTuple_GetItem(args, 0); + + if (!PyCallable_Check(wrapped)) + { + PyErr_SetString(PyExc_TypeError, "the first argument must be callable"); + return -1; + } + + fnargs = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + + if (!fnargs) + return -1; + + result = + WraptPartialCallableObjectProxy_raw_init(self, wrapped, fnargs, kwds); + + Py_DECREF(fnargs); + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static int WraptPartialCallableObjectProxy_traverse( + WraptPartialCallableObjectProxyObject *self, visitproc visit, void *arg) +{ + WraptObjectProxy_traverse((WraptObjectProxyObject *)self, visit, arg); + + Py_VISIT(self->args); + Py_VISIT(self->kwargs); + + return 0; +} + +/* ------------------------------------------------------------------------- */ + +static int WraptPartialCallableObjectProxy_clear( + WraptPartialCallableObjectProxyObject *self) +{ + WraptObjectProxy_clear((WraptObjectProxyObject *)self); + + Py_CLEAR(self->args); + Py_CLEAR(self->kwargs); + + return 0; +} + +/* ------------------------------------------------------------------------- */ + +static void WraptPartialCallableObjectProxy_dealloc( + WraptPartialCallableObjectProxyObject *self) +{ + PyObject_GC_UnTrack(self); + + WraptPartialCallableObjectProxy_clear(self); + + WraptObjectProxy_dealloc((WraptObjectProxyObject *)self); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptPartialCallableObjectProxy_call( + WraptPartialCallableObjectProxyObject *self, PyObject *args, + PyObject *kwds) +{ + PyObject *fnargs = NULL; + PyObject *fnkwargs = NULL; + + PyObject *result = NULL; + + long i; + long offset; + + if (!self->object_proxy.wrapped) + { + if (raise_uninitialized_wrapper_error(&self->object_proxy) == -1) + return NULL; + } + + fnargs = PyTuple_New(PyTuple_Size(self->args) + PyTuple_Size(args)); + + for (i = 0; i < PyTuple_Size(self->args); i++) + { + PyObject *item; + item = PyTuple_GetItem(self->args, i); + Py_INCREF(item); + PyTuple_SetItem(fnargs, i, item); + } + + offset = PyTuple_Size(self->args); + + for (i = 0; i < PyTuple_Size(args); i++) + { + PyObject *item; + item = PyTuple_GetItem(args, i); + Py_INCREF(item); + PyTuple_SetItem(fnargs, offset + i, item); + } + + fnkwargs = PyDict_New(); + + if (self->kwargs && PyDict_Update(fnkwargs, self->kwargs) == -1) + { + Py_DECREF(fnargs); + Py_DECREF(fnkwargs); + return NULL; + } + + if (kwds && PyDict_Update(fnkwargs, kwds) == -1) + { + Py_DECREF(fnargs); + Py_DECREF(fnkwargs); + return NULL; + } + + result = PyObject_Call(self->object_proxy.wrapped, fnargs, fnkwargs); + + Py_DECREF(fnargs); + Py_DECREF(fnkwargs); + + return result; +} + +/* ------------------------------------------------------------------------- */; + +static PyGetSetDef WraptPartialCallableObjectProxy_getset[] = { + {"__module__", (getter)WraptObjectProxy_get_module, + (setter)WraptObjectProxy_set_module, 0}, + {"__doc__", (getter)WraptObjectProxy_get_doc, + (setter)WraptObjectProxy_set_doc, 0}, + {NULL}, +}; + +PyTypeObject WraptPartialCallableObjectProxy_Type = { + PyVarObject_HEAD_INIT(NULL, 0) "PartialCallableObjectProxy", /*tp_name*/ + sizeof(WraptPartialCallableObjectProxyObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)WraptPartialCallableObjectProxy_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + (ternaryfunc)WraptPartialCallableObjectProxy_call, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + (traverseproc)WraptPartialCallableObjectProxy_traverse, /*tp_traverse*/ + (inquiry)WraptPartialCallableObjectProxy_clear, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(WraptObjectProxyObject, weakreflist), /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + WraptPartialCallableObjectProxy_getset, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + (initproc)WraptPartialCallableObjectProxy_init, /*tp_init*/ + 0, /*tp_alloc*/ + WraptPartialCallableObjectProxy_new, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ +}; + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptFunctionWrapperBase_new(PyTypeObject *type, + PyObject *args, PyObject *kwds) +{ + WraptFunctionWrapperObject *self; + + self = (WraptFunctionWrapperObject *)WraptObjectProxy_new(type, args, kwds); + + if (!self) + return NULL; + + self->instance = NULL; + self->wrapper = NULL; + self->enabled = NULL; + self->binding = NULL; + self->parent = NULL; + self->owner = NULL; + + return (PyObject *)self; +} + +/* ------------------------------------------------------------------------- */ + +static int WraptFunctionWrapperBase_raw_init( + WraptFunctionWrapperObject *self, PyObject *wrapped, PyObject *instance, + PyObject *wrapper, PyObject *enabled, PyObject *binding, PyObject *parent, + PyObject *owner) +{ + int result = 0; + + result = WraptObjectProxy_raw_init((WraptObjectProxyObject *)self, wrapped); + + if (result == 0) + { + Py_INCREF(instance); + Py_XDECREF(self->instance); + self->instance = instance; + + Py_INCREF(wrapper); + Py_XDECREF(self->wrapper); + self->wrapper = wrapper; + + Py_INCREF(enabled); + Py_XDECREF(self->enabled); + self->enabled = enabled; + + Py_INCREF(binding); + Py_XDECREF(self->binding); + self->binding = binding; + + Py_INCREF(parent); + Py_XDECREF(self->parent); + self->parent = parent; + + Py_INCREF(owner); + Py_XDECREF(self->owner); + self->owner = owner; + } + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static int WraptFunctionWrapperBase_init(WraptFunctionWrapperObject *self, + PyObject *args, PyObject *kwds) +{ + PyObject *wrapped = NULL; + PyObject *instance = NULL; + PyObject *wrapper = NULL; + PyObject *enabled = Py_None; + PyObject *binding = NULL; + PyObject *parent = Py_None; + PyObject *owner = Py_None; + + static PyObject *callable_str = NULL; + + char *const kwlist[] = {"wrapped", "instance", "wrapper", "enabled", + "binding", "parent", "owner", NULL}; + + if (!callable_str) + { + callable_str = PyUnicode_InternFromString("callable"); + } + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOO|OOOO:FunctionWrapperBase", + kwlist, &wrapped, &instance, &wrapper, + &enabled, &binding, &parent, &owner)) + { + return -1; + } + + if (!binding) + binding = callable_str; + + return WraptFunctionWrapperBase_raw_init(self, wrapped, instance, wrapper, + enabled, binding, parent, owner); +} + +/* ------------------------------------------------------------------------- */ + +static int WraptFunctionWrapperBase_traverse(WraptFunctionWrapperObject *self, + visitproc visit, void *arg) +{ + WraptObjectProxy_traverse((WraptObjectProxyObject *)self, visit, arg); + + Py_VISIT(self->instance); + Py_VISIT(self->wrapper); + Py_VISIT(self->enabled); + Py_VISIT(self->binding); + Py_VISIT(self->parent); + Py_VISIT(self->owner); + + return 0; +} + +/* ------------------------------------------------------------------------- */ + +static int WraptFunctionWrapperBase_clear(WraptFunctionWrapperObject *self) +{ + WraptObjectProxy_clear((WraptObjectProxyObject *)self); + + Py_CLEAR(self->instance); + Py_CLEAR(self->wrapper); + Py_CLEAR(self->enabled); + Py_CLEAR(self->binding); + Py_CLEAR(self->parent); + Py_CLEAR(self->owner); + + return 0; +} + +/* ------------------------------------------------------------------------- */ + +static void WraptFunctionWrapperBase_dealloc(WraptFunctionWrapperObject *self) +{ + PyObject_GC_UnTrack(self); + + WraptFunctionWrapperBase_clear(self); + + WraptObjectProxy_dealloc((WraptObjectProxyObject *)self); +} + +/* ------------------------------------------------------------------------- */ + +static PyObject *WraptFunctionWrapperBase_call(WraptFunctionWrapperObject *self, + PyObject *args, PyObject *kwds) +{ + PyObject *param_kwds = NULL; + + PyObject *result = NULL; + + static PyObject *function_str = NULL; + static PyObject *callable_str = NULL; + static PyObject *classmethod_str = NULL; + static PyObject *instancemethod_str = NULL; + + if (!function_str) + { + function_str = PyUnicode_InternFromString("function"); + callable_str = PyUnicode_InternFromString("callable"); + classmethod_str = PyUnicode_InternFromString("classmethod"); + instancemethod_str = PyUnicode_InternFromString("instancemethod"); + } + + if (self->enabled != Py_None) + { + if (PyCallable_Check(self->enabled)) + { + PyObject *object = NULL; + + object = PyObject_CallFunctionObjArgs(self->enabled, NULL); + + if (!object) + return NULL; + + if (PyObject_Not(object)) + { + Py_DECREF(object); + return PyObject_Call(self->object_proxy.wrapped, args, kwds); + } + + Py_DECREF(object); + } + else if (PyObject_Not(self->enabled)) + { + return PyObject_Call(self->object_proxy.wrapped, args, kwds); + } + } + + if (!kwds) + { + param_kwds = PyDict_New(); + kwds = param_kwds; + } + + if ((self->instance == Py_None) && + (self->binding == function_str || + PyObject_RichCompareBool(self->binding, function_str, Py_EQ) == 1 || + self->binding == instancemethod_str || + PyObject_RichCompareBool(self->binding, instancemethod_str, Py_EQ) == + 1 || + self->binding == callable_str || + PyObject_RichCompareBool(self->binding, callable_str, Py_EQ) == 1 || + self->binding == classmethod_str || + PyObject_RichCompareBool(self->binding, classmethod_str, Py_EQ) == 1)) + { + + PyObject *instance = NULL; + + instance = PyObject_GetAttrString(self->object_proxy.wrapped, "__self__"); + + if (instance) + { + result = PyObject_CallFunctionObjArgs(self->wrapper, + self->object_proxy.wrapped, + instance, args, kwds, NULL); + + Py_XDECREF(param_kwds); + + Py_DECREF(instance); + + return result; + } + else + PyErr_Clear(); + } + + result = + PyObject_CallFunctionObjArgs(self->wrapper, self->object_proxy.wrapped, + self->instance, args, kwds, NULL); + + Py_XDECREF(param_kwds); + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptFunctionWrapperBase_descr_get(WraptFunctionWrapperObject *self, + PyObject *obj, PyObject *type) +{ + PyObject *bound_type = NULL; + PyObject *descriptor = NULL; + PyObject *result = NULL; + + static PyObject *bound_type_str = NULL; + static PyObject *function_str = NULL; + static PyObject *callable_str = NULL; + static PyObject *builtin_str = NULL; + static PyObject *class_str = NULL; + static PyObject *instancemethod_str = NULL; + + if (!bound_type_str) + { + bound_type_str = PyUnicode_InternFromString("__bound_function_wrapper__"); + } + + if (!function_str) + { + function_str = PyUnicode_InternFromString("function"); + callable_str = PyUnicode_InternFromString("callable"); + builtin_str = PyUnicode_InternFromString("builtin"); + class_str = PyUnicode_InternFromString("class"); + instancemethod_str = PyUnicode_InternFromString("instancemethod"); + } + + if (self->parent == Py_None) + { + if (self->binding == builtin_str || + PyObject_RichCompareBool(self->binding, builtin_str, Py_EQ) == 1) + { + Py_INCREF(self); + return (PyObject *)self; + } + + if (self->binding == class_str || + PyObject_RichCompareBool(self->binding, class_str, Py_EQ) == 1) + { + Py_INCREF(self); + return (PyObject *)self; + } + + if (Py_TYPE(self->object_proxy.wrapped)->tp_descr_get == NULL) + { + Py_INCREF(self); + return (PyObject *)self; + } + + descriptor = (Py_TYPE(self->object_proxy.wrapped)->tp_descr_get)( + self->object_proxy.wrapped, obj, type); + + if (!descriptor) + return NULL; + + if (Py_TYPE(self) != &WraptFunctionWrapper_Type) + { + bound_type = PyObject_GenericGetAttr((PyObject *)self, bound_type_str); + + if (!bound_type) + PyErr_Clear(); + } + + if (obj == NULL) + obj = Py_None; + + result = PyObject_CallFunctionObjArgs( + bound_type ? bound_type : (PyObject *)&WraptBoundFunctionWrapper_Type, + descriptor, obj, self->wrapper, self->enabled, self->binding, self, + type, NULL); + + Py_XDECREF(bound_type); + Py_DECREF(descriptor); + + return result; + } + + if (self->instance == Py_None && + (self->binding == function_str || + PyObject_RichCompareBool(self->binding, function_str, Py_EQ) == 1 || + self->binding == instancemethod_str || + PyObject_RichCompareBool(self->binding, instancemethod_str, Py_EQ) == + 1 || + self->binding == callable_str || + PyObject_RichCompareBool(self->binding, callable_str, Py_EQ) == 1)) + { + + PyObject *wrapped = NULL; + + static PyObject *wrapped_str = NULL; + + if (!wrapped_str) + { + wrapped_str = PyUnicode_InternFromString("__wrapped__"); + } + + wrapped = PyObject_GetAttr(self->parent, wrapped_str); + + if (!wrapped) + return NULL; + + if (Py_TYPE(wrapped)->tp_descr_get == NULL) + { + PyErr_Format(PyExc_AttributeError, + "'%s' object has no attribute '__get__'", + Py_TYPE(wrapped)->tp_name); + Py_DECREF(wrapped); + return NULL; + } + + descriptor = (Py_TYPE(wrapped)->tp_descr_get)(wrapped, obj, type); + + Py_DECREF(wrapped); + + if (!descriptor) + return NULL; + + if (Py_TYPE(self->parent) != &WraptFunctionWrapper_Type) + { + bound_type = + PyObject_GenericGetAttr((PyObject *)self->parent, bound_type_str); + + if (!bound_type) + PyErr_Clear(); + } + + if (obj == NULL) + obj = Py_None; + + result = PyObject_CallFunctionObjArgs( + bound_type ? bound_type : (PyObject *)&WraptBoundFunctionWrapper_Type, + descriptor, obj, self->wrapper, self->enabled, self->binding, + self->parent, type, NULL); + + Py_XDECREF(bound_type); + Py_DECREF(descriptor); + + return result; + } + + Py_INCREF(self); + return (PyObject *)self; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptFunctionWrapperBase_set_name(WraptFunctionWrapperObject *self, + PyObject *args, PyObject *kwds) +{ + PyObject *method = NULL; + PyObject *result = NULL; + + if (!self->object_proxy.wrapped) + { + if (raise_uninitialized_wrapper_error(&self->object_proxy) == -1) + return NULL; + } + + method = PyObject_GetAttrString(self->object_proxy.wrapped, "__set_name__"); + + if (!method) + { + PyErr_Clear(); + Py_INCREF(Py_None); + return Py_None; + } + + result = PyObject_Call(method, args, kwds); + + Py_DECREF(method); + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptFunctionWrapperBase_instancecheck(WraptFunctionWrapperObject *self, + PyObject *instance) +{ + PyObject *result = NULL; + + int check = 0; + + if (!self->object_proxy.wrapped) + { + if (raise_uninitialized_wrapper_error(&self->object_proxy) == -1) + return NULL; + } + + check = PyObject_IsInstance(instance, self->object_proxy.wrapped); + + if (check < 0) + { + return NULL; + } + + result = check ? Py_True : Py_False; + + Py_INCREF(result); + return result; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptFunctionWrapperBase_subclasscheck(WraptFunctionWrapperObject *self, + PyObject *args) +{ + PyObject *subclass = NULL; + PyObject *object = NULL; + PyObject *result = NULL; + + int check = 0; + + if (!self->object_proxy.wrapped) + { + if (raise_uninitialized_wrapper_error(&self->object_proxy) == -1) + return NULL; + } + + if (!PyArg_ParseTuple(args, "O", &subclass)) + return NULL; + + object = PyObject_GetAttrString(subclass, "__wrapped__"); + + if (!object) + PyErr_Clear(); + + check = PyObject_IsSubclass(object ? object : subclass, + self->object_proxy.wrapped); + + Py_XDECREF(object); + + if (check == -1) + return NULL; + + result = check ? Py_True : Py_False; + + Py_INCREF(result); + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptFunctionWrapperBase_get_self_instance(WraptFunctionWrapperObject *self, + void *closure) +{ + if (!self->instance) + { + Py_INCREF(Py_None); + return Py_None; + } + + Py_INCREF(self->instance); + return self->instance; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptFunctionWrapperBase_get_self_wrapper(WraptFunctionWrapperObject *self, + void *closure) +{ + if (!self->wrapper) + { + Py_INCREF(Py_None); + return Py_None; + } + + Py_INCREF(self->wrapper); + return self->wrapper; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptFunctionWrapperBase_get_self_enabled(WraptFunctionWrapperObject *self, + void *closure) +{ + if (!self->enabled) + { + Py_INCREF(Py_None); + return Py_None; + } + + Py_INCREF(self->enabled); + return self->enabled; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptFunctionWrapperBase_get_self_binding(WraptFunctionWrapperObject *self, + void *closure) +{ + if (!self->binding) + { + Py_INCREF(Py_None); + return Py_None; + } + + Py_INCREF(self->binding); + return self->binding; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptFunctionWrapperBase_get_self_parent(WraptFunctionWrapperObject *self, + void *closure) +{ + if (!self->parent) + { + Py_INCREF(Py_None); + return Py_None; + } + + Py_INCREF(self->parent); + return self->parent; +} + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptFunctionWrapperBase_get_self_owner(WraptFunctionWrapperObject *self, + void *closure) +{ + if (!self->owner) + { + Py_INCREF(Py_None); + return Py_None; + } + + Py_INCREF(self->owner); + return self->owner; +} + +/* ------------------------------------------------------------------------- */; + +static PyMethodDef WraptFunctionWrapperBase_methods[] = { + {"__set_name__", (PyCFunction)WraptFunctionWrapperBase_set_name, + METH_VARARGS | METH_KEYWORDS, 0}, + {"__instancecheck__", (PyCFunction)WraptFunctionWrapperBase_instancecheck, + METH_O, 0}, + {"__subclasscheck__", (PyCFunction)WraptFunctionWrapperBase_subclasscheck, + METH_VARARGS, 0}, + {NULL, NULL}, +}; + +/* ------------------------------------------------------------------------- */; + +static PyGetSetDef WraptFunctionWrapperBase_getset[] = { + {"__module__", (getter)WraptObjectProxy_get_module, + (setter)WraptObjectProxy_set_module, 0}, + {"__doc__", (getter)WraptObjectProxy_get_doc, + (setter)WraptObjectProxy_set_doc, 0}, + {"_self_instance", (getter)WraptFunctionWrapperBase_get_self_instance, NULL, + 0}, + {"_self_wrapper", (getter)WraptFunctionWrapperBase_get_self_wrapper, NULL, + 0}, + {"_self_enabled", (getter)WraptFunctionWrapperBase_get_self_enabled, NULL, + 0}, + {"_self_binding", (getter)WraptFunctionWrapperBase_get_self_binding, NULL, + 0}, + {"_self_parent", (getter)WraptFunctionWrapperBase_get_self_parent, NULL, 0}, + {"_self_owner", (getter)WraptFunctionWrapperBase_get_self_owner, NULL, 0}, + {NULL}, +}; + +PyTypeObject WraptFunctionWrapperBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) "_FunctionWrapperBase", /*tp_name*/ + sizeof(WraptFunctionWrapperObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)WraptFunctionWrapperBase_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + (ternaryfunc)WraptFunctionWrapperBase_call, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + (traverseproc)WraptFunctionWrapperBase_traverse, /*tp_traverse*/ + (inquiry)WraptFunctionWrapperBase_clear, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(WraptObjectProxyObject, weakreflist), /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + WraptFunctionWrapperBase_methods, /*tp_methods*/ + 0, /*tp_members*/ + WraptFunctionWrapperBase_getset, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + (descrgetfunc)WraptFunctionWrapperBase_descr_get, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + (initproc)WraptFunctionWrapperBase_init, /*tp_init*/ + 0, /*tp_alloc*/ + WraptFunctionWrapperBase_new, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ +}; + +/* ------------------------------------------------------------------------- */ + +static PyObject * +WraptBoundFunctionWrapper_call(WraptFunctionWrapperObject *self, PyObject *args, + PyObject *kwds) +{ + PyObject *param_args = NULL; + PyObject *param_kwds = NULL; + + PyObject *wrapped = NULL; + PyObject *instance = NULL; + + PyObject *result = NULL; + + static PyObject *function_str = NULL; + static PyObject *callable_str = NULL; + + if (self->enabled != Py_None) + { + if (PyCallable_Check(self->enabled)) + { + PyObject *object = NULL; + + object = PyObject_CallFunctionObjArgs(self->enabled, NULL); + + if (!object) + return NULL; + + if (PyObject_Not(object)) + { + Py_DECREF(object); + return PyObject_Call(self->object_proxy.wrapped, args, kwds); + } + + Py_DECREF(object); + } + else if (PyObject_Not(self->enabled)) + { + return PyObject_Call(self->object_proxy.wrapped, args, kwds); + } + } + + if (!function_str) + { + function_str = PyUnicode_InternFromString("function"); + callable_str = PyUnicode_InternFromString("callable"); + } + + /* + * We need to do things different depending on whether we are likely + * wrapping an instance method vs a static method or class method. + */ + + if (self->binding == function_str || + PyObject_RichCompareBool(self->binding, function_str, Py_EQ) == 1 || + self->binding == callable_str || + PyObject_RichCompareBool(self->binding, callable_str, Py_EQ) == 1) + { + + // if (self->instance == Py_None) { + // /* + // * This situation can occur where someone is calling the + // * instancemethod via the class type and passing the + // * instance as the first argument. We need to shift the args + // * before making the call to the wrapper and effectively + // * bind the instance to the wrapped function using a partial + // * so the wrapper doesn't see anything as being different. + // */ + + // if (PyTuple_Size(args) == 0) { + // PyErr_SetString(PyExc_TypeError, + // "missing 1 required positional argument"); + // return NULL; + // } + + // instance = PyTuple_GetItem(args, 0); + + // if (!instance) + // return NULL; + + // wrapped = PyObject_CallFunctionObjArgs( + // (PyObject *)&WraptPartialCallableObjectProxy_Type, + // self->object_proxy.wrapped, instance, NULL); + + // if (!wrapped) + // return NULL; + + // param_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + + // if (!param_args) { + // Py_DECREF(wrapped); + // return NULL; + // } + + // args = param_args; + // } + + if (self->instance == Py_None && PyTuple_Size(args) != 0) + { + /* + * This situation can occur where someone is calling the + * instancemethod via the class type and passing the + * instance as the first argument. We need to shift the args + * before making the call to the wrapper and effectively + * bind the instance to the wrapped function using a partial + * so the wrapper doesn't see anything as being different. + */ + + instance = PyTuple_GetItem(args, 0); + + if (!instance) + return NULL; + + if (PyObject_IsInstance(instance, self->owner) == 1) + { + wrapped = PyObject_CallFunctionObjArgs( + (PyObject *)&WraptPartialCallableObjectProxy_Type, + self->object_proxy.wrapped, instance, NULL); + + if (!wrapped) + return NULL; + + param_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + + if (!param_args) + { + Py_DECREF(wrapped); + return NULL; + } + + args = param_args; + } + else + { + instance = self->instance; + } + } + else + { + instance = self->instance; + } + + if (!wrapped) + { + Py_INCREF(self->object_proxy.wrapped); + wrapped = self->object_proxy.wrapped; + } + + if (!kwds) + { + param_kwds = PyDict_New(); + kwds = param_kwds; + } + + result = PyObject_CallFunctionObjArgs(self->wrapper, wrapped, instance, + args, kwds, NULL); + + Py_XDECREF(param_args); + Py_XDECREF(param_kwds); + Py_DECREF(wrapped); + + return result; + } + else + { + /* + * As in this case we would be dealing with a classmethod or + * staticmethod, then _self_instance will only tell us whether + * when calling the classmethod or staticmethod they did it via + * an instance of the class it is bound to and not the case + * where done by the class type itself. We thus ignore + * _self_instance and use the __self__ attribute of the bound + * function instead. For a classmethod, this means instance will + * be the class type and for a staticmethod it will be None. + * This is probably the more useful thing we can pass through + * even though we loose knowledge of whether they were called on + * the instance vs the class type, as it reflects what they have + * available in the decoratored function. + */ + + instance = PyObject_GetAttrString(self->object_proxy.wrapped, "__self__"); + + if (!instance) + { + PyErr_Clear(); + Py_INCREF(Py_None); + instance = Py_None; + } + + if (!kwds) + { + param_kwds = PyDict_New(); + kwds = param_kwds; + } + + result = PyObject_CallFunctionObjArgs( + self->wrapper, self->object_proxy.wrapped, instance, args, kwds, NULL); + + Py_XDECREF(param_kwds); + + Py_DECREF(instance); + + return result; + } +} + +/* ------------------------------------------------------------------------- */ + +static PyGetSetDef WraptBoundFunctionWrapper_getset[] = { + {"__module__", (getter)WraptObjectProxy_get_module, + (setter)WraptObjectProxy_set_module, 0}, + {"__doc__", (getter)WraptObjectProxy_get_doc, + (setter)WraptObjectProxy_set_doc, 0}, + {NULL}, +}; + +PyTypeObject WraptBoundFunctionWrapper_Type = { + PyVarObject_HEAD_INIT(NULL, 0) "BoundFunctionWrapper", /*tp_name*/ + sizeof(WraptFunctionWrapperObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + 0, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + (ternaryfunc)WraptBoundFunctionWrapper_call, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(WraptObjectProxyObject, weakreflist), /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + WraptBoundFunctionWrapper_getset, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ +}; + +/* ------------------------------------------------------------------------- */ + +static int WraptFunctionWrapper_init(WraptFunctionWrapperObject *self, + PyObject *args, PyObject *kwds) +{ + PyObject *wrapped = NULL; + PyObject *wrapper = NULL; + PyObject *enabled = Py_None; + PyObject *binding = NULL; + PyObject *instance = NULL; + + static PyObject *function_str = NULL; + static PyObject *classmethod_str = NULL; + static PyObject *staticmethod_str = NULL; + static PyObject *callable_str = NULL; + static PyObject *builtin_str = NULL; + static PyObject *class_str = NULL; + static PyObject *instancemethod_str = NULL; + + int result = 0; + + char *const kwlist[] = {"wrapped", "wrapper", "enabled", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO|O:FunctionWrapper", kwlist, + &wrapped, &wrapper, &enabled)) + { + return -1; + } + + if (!function_str) + { + function_str = PyUnicode_InternFromString("function"); + } + + if (!classmethod_str) + { + classmethod_str = PyUnicode_InternFromString("classmethod"); + } + + if (!staticmethod_str) + { + staticmethod_str = PyUnicode_InternFromString("staticmethod"); + } + + if (!callable_str) + { + callable_str = PyUnicode_InternFromString("callable"); + } + + if (!builtin_str) + { + builtin_str = PyUnicode_InternFromString("builtin"); + } + + if (!class_str) + { + class_str = PyUnicode_InternFromString("class"); + } + + if (!instancemethod_str) + { + instancemethod_str = PyUnicode_InternFromString("instancemethod"); + } + + if (PyObject_IsInstance(wrapped, + (PyObject *)&WraptFunctionWrapperBase_Type)) + { + binding = PyObject_GetAttrString(wrapped, "_self_binding"); + } + + if (!binding) + { + if (PyCFunction_Check(wrapped)) + { + binding = builtin_str; + } + else if (PyObject_IsInstance(wrapped, (PyObject *)&PyFunction_Type)) + { + binding = function_str; + } + else if (PyObject_IsInstance(wrapped, (PyObject *)&PyClassMethod_Type)) + { + binding = classmethod_str; + } + else if (PyObject_IsInstance(wrapped, (PyObject *)&PyType_Type)) + { + binding = class_str; + } + else if (PyObject_IsInstance(wrapped, (PyObject *)&PyStaticMethod_Type)) + { + binding = staticmethod_str; + } + else if ((instance = PyObject_GetAttrString(wrapped, "__self__")) != 0) + { + if (PyObject_IsInstance(instance, (PyObject *)&PyType_Type)) + { + binding = classmethod_str; + } + else if (PyObject_IsInstance(wrapped, (PyObject *)&PyMethod_Type)) + { + binding = instancemethod_str; + } + else + binding = callable_str; + + Py_DECREF(instance); + } + else + { + PyErr_Clear(); + + binding = callable_str; + } + } + + result = WraptFunctionWrapperBase_raw_init( + self, wrapped, Py_None, wrapper, enabled, binding, Py_None, Py_None); + + return result; +} + +/* ------------------------------------------------------------------------- */ + +static PyGetSetDef WraptFunctionWrapper_getset[] = { + {"__module__", (getter)WraptObjectProxy_get_module, + (setter)WraptObjectProxy_set_module, 0}, + {"__doc__", (getter)WraptObjectProxy_get_doc, + (setter)WraptObjectProxy_set_doc, 0}, + {NULL}, +}; + +PyTypeObject WraptFunctionWrapper_Type = { + PyVarObject_HEAD_INIT(NULL, 0) "FunctionWrapper", /*tp_name*/ + sizeof(WraptFunctionWrapperObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + 0, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(WraptObjectProxyObject, weakreflist), /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + WraptFunctionWrapper_getset, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + (initproc)WraptFunctionWrapper_init, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ +}; + +/* ------------------------------------------------------------------------- */ + +static struct PyModuleDef moduledef = { + PyModuleDef_HEAD_INIT, + "_wrappers", /* m_name */ + NULL, /* m_doc */ + -1, /* m_size */ + NULL, /* m_methods */ + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL, /* m_free */ +}; + +static PyObject *moduleinit(void) +{ + PyObject *module; + + module = PyModule_Create(&moduledef); + + if (module == NULL) + return NULL; + + if (PyType_Ready(&WraptObjectProxy_Type) < 0) + return NULL; + + /* Ensure that inheritance relationships specified. */ + + WraptCallableObjectProxy_Type.tp_base = &WraptObjectProxy_Type; + WraptPartialCallableObjectProxy_Type.tp_base = &WraptObjectProxy_Type; + WraptFunctionWrapperBase_Type.tp_base = &WraptObjectProxy_Type; + WraptBoundFunctionWrapper_Type.tp_base = &WraptFunctionWrapperBase_Type; + WraptFunctionWrapper_Type.tp_base = &WraptFunctionWrapperBase_Type; + + if (PyType_Ready(&WraptCallableObjectProxy_Type) < 0) + return NULL; + if (PyType_Ready(&WraptPartialCallableObjectProxy_Type) < 0) + return NULL; + if (PyType_Ready(&WraptFunctionWrapperBase_Type) < 0) + return NULL; + if (PyType_Ready(&WraptBoundFunctionWrapper_Type) < 0) + return NULL; + if (PyType_Ready(&WraptFunctionWrapper_Type) < 0) + return NULL; + + Py_INCREF(&WraptObjectProxy_Type); + PyModule_AddObject(module, "ObjectProxy", (PyObject *)&WraptObjectProxy_Type); + Py_INCREF(&WraptCallableObjectProxy_Type); + PyModule_AddObject(module, "CallableObjectProxy", + (PyObject *)&WraptCallableObjectProxy_Type); + Py_INCREF(&WraptPartialCallableObjectProxy_Type); + PyModule_AddObject(module, "PartialCallableObjectProxy", + (PyObject *)&WraptPartialCallableObjectProxy_Type); + Py_INCREF(&WraptFunctionWrapper_Type); + PyModule_AddObject(module, "FunctionWrapper", + (PyObject *)&WraptFunctionWrapper_Type); + + Py_INCREF(&WraptFunctionWrapperBase_Type); + PyModule_AddObject(module, "_FunctionWrapperBase", + (PyObject *)&WraptFunctionWrapperBase_Type); + Py_INCREF(&WraptBoundFunctionWrapper_Type); + PyModule_AddObject(module, "BoundFunctionWrapper", + (PyObject *)&WraptBoundFunctionWrapper_Type); + +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED); +#endif + + return module; +} + +PyMODINIT_FUNC PyInit__wrappers(void) { return moduleinit(); } + +/* ------------------------------------------------------------------------- */ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/_wrappers.cp312-win_amd64.pyd b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/_wrappers.cp312-win_amd64.pyd new file mode 100644 index 0000000000000000000000000000000000000000..6c227255e37fda1559ef96dca5678aa30d8a3983 Binary files /dev/null and b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/_wrappers.cp312-win_amd64.pyd differ diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/arguments.py b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/arguments.py new file mode 100644 index 0000000000000000000000000000000000000000..23952b587ae912e1517912cb4c377de36c1eae91 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/arguments.py @@ -0,0 +1,59 @@ +"""The inspect.formatargspec() function was dropped in Python 3.11 but we need +it for when constructing signature changing decorators based on result of +inspect.getfullargspec(). The code here implements inspect.formatargspec() based +on Parameter and Signature from inspect module, which were added in Python 3.6. +Thanks to Cyril Jouve for the implementation. +""" + +from typing import Any, Callable, List, Mapping, Optional, Sequence, Tuple + +try: + from inspect import Parameter, Signature +except ImportError: + from inspect import formatargspec # type: ignore[attr-defined] +else: + + def formatargspec( + args: List[str], + varargs: Optional[str] = None, + varkw: Optional[str] = None, + defaults: Optional[Tuple[Any, ...]] = None, + kwonlyargs: Optional[Sequence[str]] = None, + kwonlydefaults: Optional[Mapping[str, Any]] = None, + annotations: Mapping[str, Any] = {}, + formatarg: Callable[[str], str] = str, + formatvarargs: Callable[[str], str] = lambda name: "*" + name, + formatvarkw: Callable[[str], str] = lambda name: "**" + name, + formatvalue: Callable[[Any], str] = lambda value: "=" + repr(value), + formatreturns: Callable[[Any], str] = lambda text: " -> " + text, + formatannotation: Callable[[Any], str] = lambda annot: " -> " + repr(annot), + ) -> str: + if kwonlyargs is None: + kwonlyargs = () + if kwonlydefaults is None: + kwonlydefaults = {} + ndefaults = len(defaults) if defaults else 0 + parameters = [ + Parameter( + arg, + Parameter.POSITIONAL_OR_KEYWORD, + default=defaults[i] if defaults and i >= 0 else Parameter.empty, + annotation=annotations.get(arg, Parameter.empty), + ) + for i, arg in enumerate(args, ndefaults - len(args)) + ] + if varargs: + parameters.append(Parameter(varargs, Parameter.VAR_POSITIONAL)) + parameters.extend( + Parameter( + kwonlyarg, + Parameter.KEYWORD_ONLY, + default=kwonlydefaults.get(kwonlyarg, Parameter.empty), + annotation=annotations.get(kwonlyarg, Parameter.empty), + ) + for kwonlyarg in kwonlyargs + ) + if varkw: + parameters.append(Parameter(varkw, Parameter.VAR_KEYWORD)) + return_annotation = annotations.get("return", Signature.empty) + return str(Signature(parameters, return_annotation=return_annotation)) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/decorators.py b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/decorators.py new file mode 100644 index 0000000000000000000000000000000000000000..e42f7c1f72f23a81d29e4ea588a34457edf8c0a3 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/decorators.py @@ -0,0 +1,522 @@ +"""This module implements decorators for implementing other decorators +as well as some commonly used decorators. + +""" + +import sys +from functools import partial +from inspect import isclass, signature +from threading import Lock, RLock + +from .__wrapt__ import BoundFunctionWrapper, CallableObjectProxy, FunctionWrapper +from .arguments import formatargspec + +# Adapter wrapper for the wrapped function which will overlay certain +# properties from the adapter function onto the wrapped function so that +# functions such as inspect.getfullargspec(), inspect.signature() and +# inspect.getsource() return the correct results one would expect. + + +class _AdapterFunctionCode(CallableObjectProxy): + + def __init__(self, wrapped_code, adapter_code): + super(_AdapterFunctionCode, self).__init__(wrapped_code) + self._self_adapter_code = adapter_code + + @property + def co_argcount(self): + return self._self_adapter_code.co_argcount + + @property + def co_code(self): + return self._self_adapter_code.co_code + + @property + def co_flags(self): + return self._self_adapter_code.co_flags + + @property + def co_kwonlyargcount(self): + return self._self_adapter_code.co_kwonlyargcount + + @property + def co_varnames(self): + return self._self_adapter_code.co_varnames + + +class _AdapterFunctionSurrogate(CallableObjectProxy): + + def __init__(self, wrapped, adapter): + super(_AdapterFunctionSurrogate, self).__init__(wrapped) + self._self_adapter = adapter + + @property + def __code__(self): + return _AdapterFunctionCode( + self.__wrapped__.__code__, self._self_adapter.__code__ + ) + + @property + def __defaults__(self): + return self._self_adapter.__defaults__ + + @property + def __kwdefaults__(self): + return self._self_adapter.__kwdefaults__ + + @property + def __signature__(self): + if "signature" not in globals(): + return self._self_adapter.__signature__ + else: + return signature(self._self_adapter) + + +class _BoundAdapterWrapper(BoundFunctionWrapper): + + @property + def __func__(self): + return _AdapterFunctionSurrogate( + self.__wrapped__.__func__, self._self_parent._self_adapter + ) + + @property + def __signature__(self): + if "signature" not in globals(): + return self.__wrapped__.__signature__ + else: + return signature(self._self_parent._self_adapter) + + +class AdapterWrapper(FunctionWrapper): + + __bound_function_wrapper__ = _BoundAdapterWrapper + + def __init__(self, *args, **kwargs): + adapter = kwargs.pop("adapter") + super(AdapterWrapper, self).__init__(*args, **kwargs) + self._self_surrogate = _AdapterFunctionSurrogate(self.__wrapped__, adapter) + self._self_adapter = adapter + + @property + def __code__(self): + return self._self_surrogate.__code__ + + @property + def __defaults__(self): + return self._self_surrogate.__defaults__ + + @property + def __kwdefaults__(self): + return self._self_surrogate.__kwdefaults__ + + @property + def __signature__(self): + return self._self_surrogate.__signature__ + + +class AdapterFactory: + def __call__(self, wrapped): + raise NotImplementedError() + + +class DelegatedAdapterFactory(AdapterFactory): + def __init__(self, factory): + super(DelegatedAdapterFactory, self).__init__() + self.factory = factory + + def __call__(self, wrapped): + return self.factory(wrapped) + + +adapter_factory = DelegatedAdapterFactory + +# Decorator for creating other decorators. This decorator and the +# wrappers which they use are designed to properly preserve any name +# attributes, function signatures etc, in addition to the wrappers +# themselves acting like a transparent proxy for the original wrapped +# function so the wrapper is effectively indistinguishable from the +# original wrapped function. + + +def decorator(wrapper=None, /, *, enabled=None, adapter=None, proxy=FunctionWrapper): + """ + The decorator should be supplied with a single positional argument + which is the `wrapper` function to be used to implement the + decorator. This may be preceded by a step whereby the keyword + arguments are supplied to customise the behaviour of the + decorator. The `adapter` argument is used to optionally denote a + separate function which is notionally used by an adapter + decorator. In that case parts of the function `__code__` and + `__defaults__` attributes are used from the adapter function + rather than those of the wrapped function. This allows for the + argument specification from `inspect.getfullargspec()` and similar + functions to be overridden with a prototype for a different + function than what was wrapped. The `enabled` argument provides a + way to enable/disable the use of the decorator. If the type of + `enabled` is a boolean, then it is evaluated immediately and the + wrapper not even applied if it is `False`. If not a boolean, it will + be evaluated when the wrapper is called for an unbound wrapper, + and when binding occurs for a bound wrapper. When being evaluated, + if `enabled` is callable it will be called to obtain the value to + be checked. If `False`, the wrapper will not be called and instead + the original wrapped function will be called directly instead. + The `proxy` argument provides a way of passing a custom version of + the `FunctionWrapper` class used in decorating the function. + """ + + if wrapper is not None: + # Helper function for creating wrapper of the appropriate + # time when we need it down below. + + def _build(wrapped, wrapper, enabled=None, adapter=None): + if adapter: + if isinstance(adapter, AdapterFactory): + adapter = adapter(wrapped) + + if not callable(adapter): + ns = {} + + # Check if the signature argument specification has + # annotations. If it does then we need to remember + # it but also drop it when attempting to manufacture + # a standin adapter function. This is necessary else + # it will try and look up any types referenced in + # the annotations in the empty namespace we use, + # which will fail. + + annotations = {} + + if not isinstance(adapter, str): + if len(adapter) == 7: + annotations = adapter[-1] + adapter = adapter[:-1] + adapter = formatargspec(*adapter) + + exec(f"def adapter{adapter}: pass", ns, ns) + adapter = ns["adapter"] + + # Override the annotations for the manufactured + # adapter function so they match the original + # adapter signature argument specification. + + if annotations: + adapter.__annotations__ = annotations + + return AdapterWrapper( + wrapped=wrapped, wrapper=wrapper, enabled=enabled, adapter=adapter + ) + + return proxy(wrapped=wrapped, wrapper=wrapper, enabled=enabled) + + # The wrapper has been provided so return the final decorator. + # The decorator is itself one of our function wrappers so we + # can determine when it is applied to functions, instance methods + # or class methods. This allows us to bind the instance or class + # method so the appropriate self or cls attribute is supplied + # when it is finally called. + + def _wrapper(wrapped, instance, args, kwargs): + # We first check for the case where the decorator was applied + # to a class type. + # + # @decorator + # class mydecoratorclass: + # def __init__(self, arg=None): + # self.arg = arg + # def __call__(self, wrapped, instance, args, kwargs): + # return wrapped(*args, **kwargs) + # + # @mydecoratorclass(arg=1) + # def function(): + # pass + # + # In this case an instance of the class is to be used as the + # decorator wrapper function. If args was empty at this point, + # then it means that there were optional keyword arguments + # supplied to be used when creating an instance of the class + # to be used as the wrapper function. + + if instance is None and isclass(wrapped) and not args: + # We still need to be passed the target function to be + # wrapped as yet, so we need to return a further function + # to be able to capture it. + + def _capture(target_wrapped): + # Now have the target function to be wrapped and need + # to create an instance of the class which is to act + # as the decorator wrapper function. Before we do that, + # we need to first check that use of the decorator + # hadn't been disabled by a simple boolean. If it was, + # the target function to be wrapped is returned instead. + + _enabled = enabled + if type(_enabled) is bool: + if not _enabled: + return target_wrapped + _enabled = None + + # Now create an instance of the class which is to act + # as the decorator wrapper function. Any arguments had + # to be supplied as keyword only arguments so that is + # all we pass when creating it. + + target_wrapper = wrapped(**kwargs) + + # Finally build the wrapper itself and return it. + + return _build(target_wrapped, target_wrapper, _enabled, adapter) + + return _capture + + # We should always have the target function to be wrapped at + # this point as the first (and only) value in args. + + target_wrapped = args[0] + + # Need to now check that use of the decorator hadn't been + # disabled by a simple boolean. If it was, then target + # function to be wrapped is returned instead. + + _enabled = enabled + if type(_enabled) is bool: + if not _enabled: + return target_wrapped + _enabled = None + + # We now need to build the wrapper, but there are a couple of + # different cases we need to consider. + + if instance is None: + if isclass(wrapped): + # In this case the decorator was applied to a class + # type but optional keyword arguments were not supplied + # for initialising an instance of the class to be used + # as the decorator wrapper function. + # + # @decorator + # class mydecoratorclass: + # def __init__(self, arg=None): + # self.arg = arg + # def __call__(self, wrapped, instance, + # args, kwargs): + # return wrapped(*args, **kwargs) + # + # @mydecoratorclass + # def function(): + # pass + # + # We still need to create an instance of the class to + # be used as the decorator wrapper function, but no + # arguments are pass. + + target_wrapper = wrapped() + + else: + # In this case the decorator was applied to a normal + # function, or possibly a static method of a class. + # + # @decorator + # def mydecoratorfuntion(wrapped, instance, + # args, kwargs): + # return wrapped(*args, **kwargs) + # + # @mydecoratorfunction + # def function(): + # pass + # + # That normal function becomes the decorator wrapper + # function. + + target_wrapper = wrapper + + else: + if isclass(instance): + # In this case the decorator was applied to a class + # method. + # + # class myclass: + # @decorator + # @classmethod + # def decoratorclassmethod(cls, wrapped, + # instance, args, kwargs): + # return wrapped(*args, **kwargs) + # + # instance = myclass() + # + # @instance.decoratorclassmethod + # def function(): + # pass + # + # This one is a bit strange because binding was actually + # performed on the wrapper created by our decorator + # factory. We need to apply that binding to the decorator + # wrapper function that the decorator factory + # was applied to. + + target_wrapper = wrapper.__get__(None, instance) + + else: + # In this case the decorator was applied to an instance + # method. + # + # class myclass: + # @decorator + # def decoratorclassmethod(self, wrapped, + # instance, args, kwargs): + # return wrapped(*args, **kwargs) + # + # instance = myclass() + # + # @instance.decoratorclassmethod + # def function(): + # pass + # + # This one is a bit strange because binding was actually + # performed on the wrapper created by our decorator + # factory. We need to apply that binding to the decorator + # wrapper function that the decorator factory + # was applied to. + + target_wrapper = wrapper.__get__(instance, type(instance)) + + # Finally build the wrapper itself and return it. + + return _build(target_wrapped, target_wrapper, _enabled, adapter) + + # We first return our magic function wrapper here so we can + # determine in what context the decorator factory was used. In + # other words, it is itself a universal decorator. The decorator + # function is used as the adapter so that linters see a signature + # corresponding to the decorator and not the wrapper it is being + # applied to. + + return _build(wrapper, _wrapper, adapter=decorator) + + else: + # The wrapper still has not been provided, so we are just + # collecting the optional keyword arguments. Return the + # decorator again wrapped in a partial using the collected + # arguments. + + return partial(decorator, enabled=enabled, adapter=adapter, proxy=proxy) + + +# Decorator for implementing thread synchronization. It can be used as a +# decorator, in which case the synchronization context is determined by +# what type of function is wrapped, or it can also be used as a context +# manager, where the user needs to supply the correct synchronization +# context. It is also possible to supply an object which appears to be a +# synchronization primitive of some sort, by virtue of having release() +# and acquire() methods. In that case that will be used directly as the +# synchronization primitive without creating a separate lock against the +# derived or supplied context. + + +def synchronized(wrapped): + """Depending on the nature of the `wrapped` object, will either return a + decorator which can be used to wrap a function or method, or a context + manager, both of which will act accordingly depending on how used, to + synchronize access to calling of the wrapped function, or the block of + code within the context manager. If it is an object which is a + synchronization primitive, such as a threading Lock, RLock, Semaphore, + Condition, or Event, then it is assumed that the object is to be used + directly as the synchronization primitive, otherwise a lock is created + automatically and attached to the wrapped object and used as the + synchronization primitive. + """ + + # Determine if being passed an object which is a synchronization + # primitive. We can't check by type for Lock, RLock, Semaphore etc, + # as the means of creating them isn't the type. Therefore use the + # existence of acquire() and release() methods. This is more + # extensible anyway as it allows custom synchronization mechanisms. + + if hasattr(wrapped, "acquire") and hasattr(wrapped, "release"): + # We remember what the original lock is and then return a new + # decorator which accesses and locks it. When returning the new + # decorator we wrap it with an object proxy so we can override + # the context manager methods in case it is being used to wrap + # synchronized statements with a 'with' statement. + + lock = wrapped + + @decorator + def _synchronized(wrapped, instance, args, kwargs): + # Execute the wrapped function while the original supplied + # lock is held. + + with lock: + return wrapped(*args, **kwargs) + + class _PartialDecorator(CallableObjectProxy): + + def __enter__(self): + lock.acquire() + return lock + + def __exit__(self, *args): + lock.release() + + return _PartialDecorator(wrapped=_synchronized) + + # Following only apply when the lock is being created automatically + # based on the context of what was supplied. In this case we supply + # a final decorator, but need to use FunctionWrapper directly as we + # want to derive from it to add context manager methods in case it is + # being used to wrap synchronized statements with a 'with' statement. + + def _synchronized_lock(context): + # Attempt to retrieve the lock for the specific context. + + lock = vars(context).get("_synchronized_lock", None) + + if lock is None: + # There is no existing lock defined for the context we + # are dealing with so we need to create one. This needs + # to be done in a way to guarantee there is only one + # created, even if multiple threads try and create it at + # the same time. We can't always use the setdefault() + # method on the __dict__ for the context. This is the + # case where the context is a class, as __dict__ is + # actually a dictproxy. What we therefore do is use a + # meta lock on this wrapper itself, to control the + # creation and assignment of the lock attribute against + # the context. + + with synchronized._synchronized_meta_lock: + # We need to check again for whether the lock we want + # exists in case two threads were trying to create it + # at the same time and were competing to create the + # meta lock. + + lock = vars(context).get("_synchronized_lock", None) + + if lock is None: + lock = RLock() + setattr(context, "_synchronized_lock", lock) + + return lock + + def _synchronized_wrapper(wrapped, instance, args, kwargs): + # Execute the wrapped function while the lock for the + # desired context is held. If instance is None then the + # wrapped function is used as the context. + + with _synchronized_lock(instance if instance is not None else wrapped): + return wrapped(*args, **kwargs) + + class _FinalDecorator(FunctionWrapper): + + def __enter__(self): + self._self_lock = _synchronized_lock(self.__wrapped__) + self._self_lock.acquire() + return self._self_lock + + def __exit__(self, *args): + self._self_lock.release() + + return _FinalDecorator(wrapped=wrapped, wrapper=_synchronized_wrapper) + + +synchronized._synchronized_meta_lock = Lock() # type: ignore[attr-defined] diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/importer.py b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/importer.py new file mode 100644 index 0000000000000000000000000000000000000000..ca907189a79ecdcfcf3c0ba3fa9f2dd44a02e2ec --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/importer.py @@ -0,0 +1,332 @@ +"""This module implements a post import hook mechanism styled after what is +described in PEP-369. Note that it doesn't cope with modules being reloaded. + +""" + +import importlib.metadata +import sys +import threading +from importlib.util import find_spec +from typing import Callable, Dict, List + +from .__wrapt__ import BaseObjectProxy + +# The dictionary registering any post import hooks to be triggered once +# the target module has been imported. Once a module has been imported +# and the hooks fired, the list of hooks recorded against the target +# module will be truncated but the list left in the dictionary. This +# acts as a flag to indicate that the module had already been imported. + +_post_import_hooks: Dict[str, List[Callable]] = {} +_post_import_hooks_init = False +_post_import_hooks_lock = threading.RLock() + +# Register a new post import hook for the target module name. This +# differs from the PEP-369 implementation in that it also allows the +# hook function to be specified as a string consisting of the name of +# the callback in the form 'module:function'. This will result in a +# proxy callback being registered which will defer loading of the +# specified module containing the callback function until required. + + +def _create_import_hook_from_string(name): + def import_hook(module): + module_name, function = name.split(":") + attrs = function.split(".") + __import__(module_name) + callback = sys.modules[module_name] + for attr in attrs: + callback = getattr(callback, attr) + return callback(module) + + return import_hook + + +def register_post_import_hook(hook, name): + """ + Register a post import hook for the target module `name`. The `hook` + function will be called once the module is imported and will be passed the + module as argument. If the module is already imported, the `hook` will be + called immediately. If you also want to defer loading of the module containing + the `hook` function until required, you can specify the `hook` as a string in + the form 'module:function'. This will result in a proxy hook function being + registered which will defer loading of the specified module containing the + callback function until required. + """ + + # Create a deferred import hook if hook is a string name rather than + # a callable function. + + if isinstance(hook, str): + hook = _create_import_hook_from_string(hook) + + with _post_import_hooks_lock: + # Automatically install the import hook finder if it has not already + # been installed. + + global _post_import_hooks_init + + if not _post_import_hooks_init: + _post_import_hooks_init = True + sys.meta_path.insert(0, ImportHookFinder()) + + # Check if the module is already imported. If not, register the hook + # to be called after import. + + module = sys.modules.get(name, None) + + if module is None: + _post_import_hooks.setdefault(name, []).append(hook) + + # If the module is already imported, we fire the hook right away. Note that + # the hook is called outside of the lock to avoid deadlocks if code run as a + # consequence of calling the module import hook in turn triggers a separate + # thread which tries to register an import hook. + + if module is not None: + hook(module) + + +# Register post import hooks defined as package entry points. + + +def _create_import_hook_from_entrypoint(entrypoint): + def import_hook(module): + entrypoint_value = entrypoint.value.split(":") + module_name = entrypoint_value[0] + __import__(module_name) + callback = sys.modules[module_name] + + if len(entrypoint_value) > 1: + attrs = entrypoint_value[1].split(".") + for attr in attrs: + callback = getattr(callback, attr) + return callback(module) + + return import_hook + + +def discover_post_import_hooks(group): + """ + Discover and register post import hooks defined as package entry points + in the specified `group`. The group should be a string that matches the + entry point group name used in the package metadata. + """ + + try: + # Python 3.10+ style with select parameter + entrypoints = importlib.metadata.entry_points(group=group) + except TypeError: + # Python 3.8-3.9 style that returns a dict + entrypoints = importlib.metadata.entry_points().get(group, ()) + + for entrypoint in entrypoints: + callback = entrypoint.load() # Use the loaded callback directly + register_post_import_hook(callback, entrypoint.name) + + +# Indicate that a module has been loaded. Any post import hooks which +# were registered against the target module will be invoked. If an +# exception is raised in any of the post import hooks, that will cause +# the import of the target module to fail. + + +def notify_module_loaded(module): + """ + Notify that a `module` has been loaded and invoke any post import hooks + registered against the module. If the module is not registered, this + function does nothing. + """ + + name = getattr(module, "__name__", None) + + with _post_import_hooks_lock: + hooks = _post_import_hooks.pop(name, ()) + + # Note that the hook is called outside of the lock to avoid deadlocks if + # code run as a consequence of calling the module import hook in turn + # triggers a separate thread which tries to register an import hook. + + for hook in hooks: + hook(module) + + +# A custom module import finder. This intercepts attempts to import +# modules and watches out for attempts to import target modules of +# interest. When a module of interest is imported, then any post import +# hooks which are registered will be invoked. + + +class _ImportHookLoader: + + def load_module(self, fullname): + module = sys.modules[fullname] + notify_module_loaded(module) + + return module + + +class _ImportHookChainedLoader(BaseObjectProxy): + + def __init__(self, loader): + super(_ImportHookChainedLoader, self).__init__(loader) + + if hasattr(loader, "load_module"): + self.__self_setattr__("load_module", self._self_load_module) + if hasattr(loader, "create_module"): + self.__self_setattr__("create_module", self._self_create_module) + if hasattr(loader, "exec_module"): + self.__self_setattr__("exec_module", self._self_exec_module) + + def _self_set_loader(self, module): + # Set module's loader to self.__wrapped__ unless it's already set to + # something else. Import machinery will set it to spec.loader if it is + # None, so handle None as well. The module may not support attribute + # assignment, in which case we simply skip it. Note that we also deal + # with __loader__ not existing at all. This is to future proof things + # due to proposal to remove the attribute as described in the GitHub + # issue at https://github.com/python/cpython/issues/77458. Also prior + # to Python 3.3, the __loader__ attribute was only set if a custom + # module loader was used. It isn't clear whether the attribute still + # existed in that case or was set to None. + + class UNDEFINED: + pass + + if getattr(module, "__loader__", UNDEFINED) in (None, self): + try: + module.__loader__ = self.__wrapped__ + except AttributeError: + pass + + if ( + getattr(module, "__spec__", None) is not None + and getattr(module.__spec__, "loader", None) is self + ): + module.__spec__.loader = self.__wrapped__ + + def _self_load_module(self, fullname): + module = self.__wrapped__.load_module(fullname) + self._self_set_loader(module) + notify_module_loaded(module) + + return module + + # Python 3.4 introduced create_module() and exec_module() instead of + # load_module() alone. Splitting the two steps. + + def _self_create_module(self, spec): + return self.__wrapped__.create_module(spec) + + def _self_exec_module(self, module): + self._self_set_loader(module) + self.__wrapped__.exec_module(module) + notify_module_loaded(module) + + +class ImportHookFinder: + + def __init__(self): + self.in_progress = {} + + def find_module(self, fullname, path=None): + # If the module being imported is not one we have registered + # post import hooks for, we can return immediately. We will + # take no further part in the importing of this module. + + with _post_import_hooks_lock: + if fullname not in _post_import_hooks: + return None + + # When we are interested in a specific module, we will call back + # into the import system a second time to defer to the import + # finder that is supposed to handle the importing of the module. + # We set an in progress flag for the target module so that on + # the second time through we don't trigger another call back + # into the import system and cause a infinite loop. + + if fullname in self.in_progress: + return None + + self.in_progress[fullname] = True + + # Now call back into the import system again. + + try: + # For Python 3 we need to use find_spec().loader + # from the importlib.util module. It doesn't actually + # import the target module and only finds the + # loader. If a loader is found, we need to return + # our own loader which will then in turn call the + # real loader to import the module and invoke the + # post import hooks. + + loader = getattr(find_spec(fullname), "loader", None) + + if loader and not isinstance(loader, _ImportHookChainedLoader): + return _ImportHookChainedLoader(loader) + + finally: + del self.in_progress[fullname] + + def find_spec(self, fullname, path=None, target=None): + # Since Python 3.4, you are meant to implement find_spec() method + # instead of find_module() and since Python 3.10 you get deprecation + # warnings if you don't define find_spec(). + + # If the module being imported is not one we have registered + # post import hooks for, we can return immediately. We will + # take no further part in the importing of this module. + + with _post_import_hooks_lock: + if fullname not in _post_import_hooks: + return None + + # When we are interested in a specific module, we will call back + # into the import system a second time to defer to the import + # finder that is supposed to handle the importing of the module. + # We set an in progress flag for the target module so that on + # the second time through we don't trigger another call back + # into the import system and cause a infinite loop. + + if fullname in self.in_progress: + return None + + self.in_progress[fullname] = True + + # Now call back into the import system again. + + try: + # This should only be Python 3 so find_spec() should always + # exist so don't need to check. + + spec = find_spec(fullname) + loader = getattr(spec, "loader", None) + + if loader and not isinstance(loader, _ImportHookChainedLoader): + spec.loader = _ImportHookChainedLoader(loader) + + return spec + + finally: + del self.in_progress[fullname] + + +# Decorator for marking that a function should be called as a post +# import hook when the target module is imported. + + +def when_imported(name): + """ + Returns a decorator that registers the decorated function as a post import + hook for the module specified by `name`. The function will be called once + the module with the specified name is imported, and will be passed the + module as argument. If the module is already imported, the function will + be called immediately. + """ + + def register(hook): + register_post_import_hook(hook, name) + return hook + + return register diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/patches.py b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/patches.py new file mode 100644 index 0000000000000000000000000000000000000000..af590512276ab26c83236812972f5d1c55ef55ad --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/patches.py @@ -0,0 +1,239 @@ +import inspect +import sys + +from .__wrapt__ import FunctionWrapper + +# Helper functions for applying wrappers to existing functions. + + +def resolve_path(target, name): + """ + Resolves the dotted path supplied as `name` to an attribute on a target + object. The `target` can be a module, class, or instance of a class. If the + `target` argument is a string, it is assumed to be the name of a module, + which will be imported if necessary and then used as the target object. + Returns a tuple containing the parent object holding the attribute lookup + resolved to, the attribute name (path prefix removed if present), and the + original attribute value. + """ + + if isinstance(target, str): + __import__(target) + target = sys.modules[target] + + parent = target + + path = name.split(".") + attribute = path[0] + + # We can't just always use getattr() because in doing + # that on a class it will cause binding to occur which + # will complicate things later and cause some things not + # to work. For the case of a class we therefore access + # the __dict__ directly. To cope though with the wrong + # class being given to us, or a method being moved into + # a base class, we need to walk the class hierarchy to + # work out exactly which __dict__ the method was defined + # in, as accessing it from __dict__ will fail if it was + # not actually on the class given. Fallback to using + # getattr() if we can't find it. If it truly doesn't + # exist, then that will fail. + + def lookup_attribute(parent, attribute): + if inspect.isclass(parent): + for cls in inspect.getmro(parent): + if attribute in vars(cls): + return vars(cls)[attribute] + else: + return getattr(parent, attribute) + else: + return getattr(parent, attribute) + + original = lookup_attribute(parent, attribute) + + for attribute in path[1:]: + parent = original + original = lookup_attribute(parent, attribute) + + return (parent, attribute, original) + + +def apply_patch(parent, attribute, replacement): + """ + Convenience function for applying a patch to an attribute. Currently this + maps to the standard setattr() function, but in the future may be extended + to support more complex patching strategies. + """ + + setattr(parent, attribute, replacement) + + +def wrap_object(target, name, factory, args=(), kwargs={}): + """ + Wraps an object which is the attribute of a target object with a wrapper + object created by the `factory` function. The `target` can be a module, + class, or instance of a class. In the special case of `target` being a + string, it is assumed to be the name of a module, with the module being + imported if necessary and then used as the target object. The `name` is a + string representing the dotted path to the attribute. The `factory` function + should accept the original object and may accept additional positional and + keyword arguments which will be set by unpacking input arguments using + `*args` and `**kwargs` calling conventions. The factory function should + return a new object that will replace the original object. + """ + + (parent, attribute, original) = resolve_path(target, name) + wrapper = factory(original, *args, **kwargs) + apply_patch(parent, attribute, wrapper) + + return wrapper + + +# Function for applying a proxy object to an attribute of a class +# instance. The wrapper works by defining an attribute of the same name +# on the class which is a descriptor and which intercepts access to the +# instance attribute. Note that this cannot be used on attributes which +# are themselves defined by a property object. + + +class AttributeWrapper: + + def __init__(self, attribute, factory, args, kwargs): + self.attribute = attribute + self.factory = factory + self.args = args + self.kwargs = kwargs + + def __get__(self, instance, owner): + value = instance.__dict__[self.attribute] + return self.factory(value, *self.args, **self.kwargs) + + def __set__(self, instance, value): + instance.__dict__[self.attribute] = value + + def __delete__(self, instance): + del instance.__dict__[self.attribute] + + +def wrap_object_attribute(module, name, factory, args=(), kwargs={}): + """ + Wraps an object which is the attribute of a class instance with a wrapper + object created by the `factory` function. It does this by patching the + class, not the instance, with a descriptor that intercepts access to the + instance attribute. The `module` can be a module, class, or instance of a + class. In the special case of `module` being a string, it is assumed to be + the name of a module, with the module being imported if necessary and then + used as the target object. The `name` is a string representing the dotted + path to the attribute. The `factory` function should accept the original + object and may accept additional positional and keyword arguments which will + be set by unpacking input arguments using `*args` and `**kwargs` calling + conventions. The factory function should return a new object that will + replace the original object. + """ + + path, attribute = name.rsplit(".", 1) + parent = resolve_path(module, path)[2] + wrapper = AttributeWrapper(attribute, factory, args, kwargs) + apply_patch(parent, attribute, wrapper) + return wrapper + + +# Functions for creating a simple decorator using a FunctionWrapper, +# plus short cut functions for applying wrappers to functions. These are +# for use when doing monkey patching. For a more featured way of +# creating decorators see the decorator decorator instead. + + +def function_wrapper(wrapper): + """ + Creates a decorator for wrapping a function with a `wrapper` function. + The decorator which is returned may also be applied to any other callable + objects such as lambda functions, methods, classmethods, and staticmethods, + or objects which implement the `__call__()` method. The `wrapper` function + should accept the `wrapped` function, `instance`, `args`, and `kwargs`, + arguments and return the result of calling the wrapped function or some + other appropriate value. + """ + + def _wrapper(wrapped, instance, args, kwargs): + target_wrapped = args[0] + if instance is None: + target_wrapper = wrapper + elif inspect.isclass(instance): + target_wrapper = wrapper.__get__(None, instance) + else: + target_wrapper = wrapper.__get__(instance, type(instance)) + return FunctionWrapper(target_wrapped, target_wrapper) + + return FunctionWrapper(wrapper, _wrapper) + + +def wrap_function_wrapper(target, name, wrapper): + """ + Wraps a function which is the attribute of a target object with a `wrapper` + function. The `target` can be a module, class, or instance of a class. In + the special case of `target` being a string, it is assumed to be the name + of a module, with the module being imported if necessary. The `name` is a + string representing the dotted path to the attribute. The `wrapper` function + should accept the `wrapped` function, `instance`, `args`, and `kwargs` + arguments, and would return the result of calling the wrapped attribute or + some other appropriate value. + """ + + return wrap_object(target, name, FunctionWrapper, (wrapper,)) + + +def patch_function_wrapper(target, name, enabled=None): + """ + Creates a decorator which can be applied to a wrapper function, where the + wrapper function will be used to wrap a function which is the attribute of + a target object. The `target` can be a module, class, or instance of a class. + In the special case of `target` being a string, it is assumed to be the name + of a module, with the module being imported if necessary. The `name` is a + string representing the dotted path to the attribute. The `enabled` + argument can be a boolean or a callable that returns a boolean. When a + callable is provided, it will be called each time the wrapper is invoked to + determine if the wrapper function should be executed or whether the wrapped + function should be called directly. If `enabled` is not provided, the + wrapper is enabled by default. + """ + + def _wrapper(wrapper): + return wrap_object(target, name, FunctionWrapper, (wrapper, enabled)) + + return _wrapper + + +def transient_function_wrapper(target, name): + """Creates a decorator that patches a target function with a wrapper + function, but only for the duration of the call that the decorator was + applied to. The `target` can be a module, class, or instance of a class. + In the special case of `target` being a string, it is assumed to be the name + of a module, with the module being imported if necessary. The `name` is a + string representing the dotted path to the attribute. + """ + + def _decorator(wrapper): + def _wrapper(wrapped, instance, args, kwargs): + target_wrapped = args[0] + if instance is None: + target_wrapper = wrapper + elif inspect.isclass(instance): + target_wrapper = wrapper.__get__(None, instance) + else: + target_wrapper = wrapper.__get__(instance, type(instance)) + + def _execute(wrapped, instance, args, kwargs): + (parent, attribute, original) = resolve_path(target, name) + replacement = FunctionWrapper(original, target_wrapper) + setattr(parent, attribute, replacement) + try: + return wrapped(*args, **kwargs) + finally: + setattr(parent, attribute, original) + + return FunctionWrapper(target_wrapped, _execute) + + return FunctionWrapper(wrapper, _wrapper) + + return _decorator diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/proxies.py b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/proxies.py new file mode 100644 index 0000000000000000000000000000000000000000..ef4c1a5d21a4653630221d766df9a5e2135713b2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/proxies.py @@ -0,0 +1,351 @@ +"""Variants of ObjectProxy for different use cases.""" + +from collections.abc import Callable +from types import ModuleType + +from .__wrapt__ import BaseObjectProxy +from .decorators import synchronized + +# Define ObjectProxy which for compatibility adds `__iter__()` support which +# has been removed from `BaseObjectProxy`. + + +class ObjectProxy(BaseObjectProxy): + """A generic object proxy which forwards special methods as needed. + For backwards compatibility this class adds support for `__iter__()`. If + you don't need backward compatibility for `__iter__()` support then it is + preferable to use `BaseObjectProxy` directly. If you want automatic + support for special dunder methods for callables, iterators, and async, + then use `AutoObjectProxy`.""" + + @property + def __object_proxy__(self): + return ObjectProxy + + def __new__(cls, *args, **kwargs): + return super().__new__(cls) + + def __iter__(self): + return iter(self.__wrapped__) + + +# Define variant of ObjectProxy which can automatically adjust to the wrapped +# object and add special dunder methods. + + +def __wrapper_call__(*args, **kwargs): + def _unpack_self(self, *args): + return self, args + + self, args = _unpack_self(*args) + + return self.__wrapped__(*args, **kwargs) + + +def __wrapper_iter__(self): + return iter(self.__wrapped__) + + +def __wrapper_next__(self): + return self.__wrapped__.__next__() + + +def __wrapper_aiter__(self): + return self.__wrapped__.__aiter__() + + +async def __wrapper_anext__(self): + return await self.__wrapped__.__anext__() + + +def __wrapper_length_hint__(self): + return self.__wrapped__.__length_hint__() + + +def __wrapper_await__(self): + return (yield from self.__wrapped__.__await__()) + + +def __wrapper_get__(self, instance, owner): + return self.__wrapped__.__get__(instance, owner) + + +def __wrapper_set__(self, instance, value): + return self.__wrapped__.__set__(instance, value) + + +def __wrapper_delete__(self, instance): + return self.__wrapped__.__delete__(instance) + + +def __wrapper_set_name__(self, owner, name): + return self.__wrapped__.__set_name__(owner, name) + + +class AutoObjectProxy(BaseObjectProxy): + """An object proxy which can automatically adjust to the wrapped object + and add special dunder methods as needed. Note that this creates a new + class for each instance, so it has much higher memory overhead than using + `BaseObjectProxy` directly. If you know what special dunder methods you need + then it is preferable to use `BaseObjectProxy` directly and add them to a + subclass as needed. If you only need `__iter__()` support for backwards + compatibility then use `ObjectProxy` instead. + """ + + def __new__(cls, wrapped): + """Injects special dunder methods into a dynamically created subclass + as needed based on the wrapped object. + """ + + namespace = {} + + wrapped_attrs = dir(wrapped) + class_attrs = set(dir(cls)) + + if callable(wrapped) and "__call__" not in class_attrs: + namespace["__call__"] = __wrapper_call__ + + if "__iter__" in wrapped_attrs and "__iter__" not in class_attrs: + namespace["__iter__"] = __wrapper_iter__ + + if "__next__" in wrapped_attrs and "__next__" not in class_attrs: + namespace["__next__"] = __wrapper_next__ + + if "__aiter__" in wrapped_attrs and "__aiter__" not in class_attrs: + namespace["__aiter__"] = __wrapper_aiter__ + + if "__anext__" in wrapped_attrs and "__anext__" not in class_attrs: + namespace["__anext__"] = __wrapper_anext__ + + if "__length_hint__" in wrapped_attrs and "__length_hint__" not in class_attrs: + namespace["__length_hint__"] = __wrapper_length_hint__ + + # Note that not providing compatibility with generator-based coroutines + # (PEP 342) here as they are removed in Python 3.11+ and were deprecated + # in 3.8. + + if "__await__" in wrapped_attrs and "__await__" not in class_attrs: + namespace["__await__"] = __wrapper_await__ + + if "__get__" in wrapped_attrs and "__get__" not in class_attrs: + namespace["__get__"] = __wrapper_get__ + + if "__set__" in wrapped_attrs and "__set__" not in class_attrs: + namespace["__set__"] = __wrapper_set__ + + if "__delete__" in wrapped_attrs and "__delete__" not in class_attrs: + namespace["__delete__"] = __wrapper_delete__ + + if "__set_name__" in wrapped_attrs and "__set_name__" not in class_attrs: + namespace["__set_name__"] = __wrapper_set_name__ + + name = cls.__name__ + + if cls is AutoObjectProxy: + name = BaseObjectProxy.__name__ + + return super(AutoObjectProxy, cls).__new__(type(name, (cls,), namespace)) + + def __wrapped_setattr_fixups__(self): + """Adjusts special dunder methods on the class as needed based on the + wrapped object, when `__wrapped__` is changed. + """ + + cls = type(self) + class_attrs = set(dir(cls)) + + if callable(self.__wrapped__): + if "__call__" not in class_attrs: + cls.__call__ = __wrapper_call__ + elif getattr(cls, "__call__", None) is __wrapper_call__: + delattr(cls, "__call__") + + if hasattr(self.__wrapped__, "__iter__"): + if "__iter__" not in class_attrs: + cls.__iter__ = __wrapper_iter__ + elif getattr(cls, "__iter__", None) is __wrapper_iter__: + delattr(cls, "__iter__") + + if hasattr(self.__wrapped__, "__next__"): + if "__next__" not in class_attrs: + cls.__next__ = __wrapper_next__ + elif getattr(cls, "__next__", None) is __wrapper_next__: + delattr(cls, "__next__") + + if hasattr(self.__wrapped__, "__aiter__"): + if "__aiter__" not in class_attrs: + cls.__aiter__ = __wrapper_aiter__ + elif getattr(cls, "__aiter__", None) is __wrapper_aiter__: + delattr(cls, "__aiter__") + + if hasattr(self.__wrapped__, "__anext__"): + if "__anext__" not in class_attrs: + cls.__anext__ = __wrapper_anext__ + elif getattr(cls, "__anext__", None) is __wrapper_anext__: + delattr(cls, "__anext__") + + if hasattr(self.__wrapped__, "__length_hint__"): + if "__length_hint__" not in class_attrs: + cls.__length_hint__ = __wrapper_length_hint__ + elif getattr(cls, "__length_hint__", None) is __wrapper_length_hint__: + delattr(cls, "__length_hint__") + + if hasattr(self.__wrapped__, "__await__"): + if "__await__" not in class_attrs: + cls.__await__ = __wrapper_await__ + elif getattr(cls, "__await__", None) is __wrapper_await__: + delattr(cls, "__await__") + + if hasattr(self.__wrapped__, "__get__"): + if "__get__" not in class_attrs: + cls.__get__ = __wrapper_get__ + elif getattr(cls, "__get__", None) is __wrapper_get__: + delattr(cls, "__get__") + + if hasattr(self.__wrapped__, "__set__"): + if "__set__" not in class_attrs: + cls.__set__ = __wrapper_set__ + elif getattr(cls, "__set__", None) is __wrapper_set__: + delattr(cls, "__set__") + + if hasattr(self.__wrapped__, "__delete__"): + if "__delete__" not in class_attrs: + cls.__delete__ = __wrapper_delete__ + elif getattr(cls, "__delete__", None) is __wrapper_delete__: + delattr(cls, "__delete__") + + if hasattr(self.__wrapped__, "__set_name__"): + if "__set_name__" not in class_attrs: + cls.__set_name__ = __wrapper_set_name__ + elif getattr(cls, "__set_name__", None) is __wrapper_set_name__: + delattr(cls, "__set_name__") + + +class LazyObjectProxy(AutoObjectProxy): + """An object proxy which can generate/create the wrapped object on demand + when it is first needed. + """ + + def __new__(cls, callback=None, *, interface=...): + """Injects special dunder methods into a dynamically created subclass + as needed based on the wrapped object. + """ + + if interface is ...: + interface = type(None) + + namespace = {} + + interface_attrs = dir(interface) + class_attrs = set(dir(cls)) + + if "__call__" in interface_attrs and "__call__" not in class_attrs: + namespace["__call__"] = __wrapper_call__ + + if "__iter__" in interface_attrs and "__iter__" not in class_attrs: + namespace["__iter__"] = __wrapper_iter__ + + if "__next__" in interface_attrs and "__next__" not in class_attrs: + namespace["__next__"] = __wrapper_next__ + + if "__aiter__" in interface_attrs and "__aiter__" not in class_attrs: + namespace["__aiter__"] = __wrapper_aiter__ + + if "__anext__" in interface_attrs and "__anext__" not in class_attrs: + namespace["__anext__"] = __wrapper_anext__ + + if ( + "__length_hint__" in interface_attrs + and "__length_hint__" not in class_attrs + ): + namespace["__length_hint__"] = __wrapper_length_hint__ + + # Note that not providing compatibility with generator-based coroutines + # (PEP 342) here as they are removed in Python 3.11+ and were deprecated + # in 3.8. + + if "__await__" in interface_attrs and "__await__" not in class_attrs: + namespace["__await__"] = __wrapper_await__ + + if "__get__" in interface_attrs and "__get__" not in class_attrs: + namespace["__get__"] = __wrapper_get__ + + if "__set__" in interface_attrs and "__set__" not in class_attrs: + namespace["__set__"] = __wrapper_set__ + + if "__delete__" in interface_attrs and "__delete__" not in class_attrs: + namespace["__delete__"] = __wrapper_delete__ + + if "__set_name__" in interface_attrs and "__set_name__" not in class_attrs: + namespace["__set_name__"] = __wrapper_set_name__ + + name = cls.__name__ + + return super(AutoObjectProxy, cls).__new__(type(name, (cls,), namespace)) + + def __init__(self, callback=None, *, interface=...): + """Initialize the object proxy with wrapped object as `None` but due + to presence of special `__wrapped_factory__` attribute addded first, + this will actually trigger the deferred creation of the wrapped object + when first needed. + """ + + if callback is not None: + self.__wrapped_factory__ = callback + + super().__init__(None) + + __wrapped_initialized__ = False + + def __wrapped_factory__(self): + return None + + def __wrapped_get__(self): + """Gets the wrapped object, creating it if necessary.""" + + # We synchronize on the class type, which will be unique to this instance + # since we inherit from `AutoObjectProxy` which creates a new class + # for each instance. If we synchronize on `self` or the method then + # we can end up in infinite recursion via `__getattr__()`. + + with synchronized(type(self)): + # We were called because `__wrapped__` was not set, but because of + # multiple threads we may find that it has been set by the time + # we get the lock. So check again now whether `__wrapped__` is set. + # If it is then just return it, otherwise call the factory to + # create it. + + if self.__wrapped_initialized__: + return self.__wrapped__ + + self.__wrapped__ = self.__wrapped_factory__() + + self.__wrapped_initialized__ = True + + return self.__wrapped__ + + +def lazy_import(name, attribute=None, *, interface=...): + """Lazily imports the module `name`, returning a `LazyObjectProxy` which + will import the module when it is first needed. When `name is a dotted name, + then the full dotted name is imported and the last module is taken as the + target. If `attribute` is provided then it is used to retrieve an attribute + from the module. + """ + + if attribute is not None: + if interface is ...: + interface = Callable + else: + if interface is ...: + interface = ModuleType + + def _import(): + module = __import__(name, fromlist=[""]) + + if attribute is not None: + return getattr(module, attribute) + + return module + + return LazyObjectProxy(_import, interface=interface) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/py.typed b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..c4e267062532d691ce3d9413e7abd0068fc82e1f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/py.typed @@ -0,0 +1 @@ +partial diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/weakrefs.py b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/weakrefs.py new file mode 100644 index 0000000000000000000000000000000000000000..d2fff38947a69eda7d30296fe0c9fb66e5406962 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/weakrefs.py @@ -0,0 +1,114 @@ +import functools +import weakref + +from .__wrapt__ import BaseObjectProxy, _FunctionWrapperBase + +# A weak function proxy. This will work on instance methods, class +# methods, static methods and regular functions. Special treatment is +# needed for the method types because the bound method is effectively a +# transient object and applying a weak reference to one will immediately +# result in it being destroyed and the weakref callback called. The weak +# reference is therefore applied to the instance the method is bound to +# and the original function. The function is then rebound at the point +# of a call via the weak function proxy. + + +def _weak_function_proxy_callback(ref, proxy, callback): + if proxy._self_expired: + return + + proxy._self_expired = True + + # This could raise an exception. We let it propagate back and let + # the weakref.proxy() deal with it, at which point it generally + # prints out a short error message direct to stderr and keeps going. + + if callback is not None: + callback(proxy) + + +class WeakFunctionProxy(BaseObjectProxy): + """A weak function proxy.""" + + __slots__ = ("_self_expired", "_self_instance") + + def __init__(self, wrapped, callback=None): + """Create a proxy to object which uses a weak reference. This is + similar to the `weakref.proxy` but is designed to work with functions + and methods. It will automatically rebind the function to the instance + when called if the function was originally a bound method. This is + necessary because bound methods are transient objects and applying a + weak reference to one will immediately result in it being destroyed + and the weakref callback called. The weak reference is therefore + applied to the instance the method is bound to and the original + function. The function is then rebound at the point of a call via the + weak function proxy. + """ + + # We need to determine if the wrapped function is actually a + # bound method. In the case of a bound method, we need to keep a + # reference to the original unbound function and the instance. + # This is necessary because if we hold a reference to the bound + # function, it will be the only reference and given it is a + # temporary object, it will almost immediately expire and + # the weakref callback triggered. So what is done is that we + # hold a reference to the instance and unbound function and + # when called bind the function to the instance once again and + # then call it. Note that we avoid using a nested function for + # the callback here so as not to cause any odd reference cycles. + + _callback = callback and functools.partial( + _weak_function_proxy_callback, proxy=self, callback=callback + ) + + self._self_expired = False + + if isinstance(wrapped, _FunctionWrapperBase): + self._self_instance = weakref.ref(wrapped._self_instance, _callback) + + if wrapped._self_parent is not None: + super(WeakFunctionProxy, self).__init__( + weakref.proxy(wrapped._self_parent, _callback) + ) + + else: + super(WeakFunctionProxy, self).__init__( + weakref.proxy(wrapped, _callback) + ) + + return + + try: + self._self_instance = weakref.ref(wrapped.__self__, _callback) + + super(WeakFunctionProxy, self).__init__( + weakref.proxy(wrapped.__func__, _callback) + ) + + except AttributeError: + self._self_instance = None + + super(WeakFunctionProxy, self).__init__(weakref.proxy(wrapped, _callback)) + + def __call__(*args, **kwargs): + def _unpack_self(self, *args): + return self, args + + self, args = _unpack_self(*args) + + # We perform a boolean check here on the instance and wrapped + # function as that will trigger the reference error prior to + # calling if the reference had expired. + + instance = self._self_instance and self._self_instance() + function = self.__wrapped__ and self.__wrapped__ + + # If the wrapped function was originally a bound function, for + # which we retained a reference to the instance and the unbound + # function we need to rebind the function and then call it. If + # not just called the wrapped function. + + if instance is None: + return self.__wrapped__(*args, **kwargs) + + return function.__get__(instance, type(instance))(*args, **kwargs) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/wrapt/wrappers.py b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/wrappers.py new file mode 100644 index 0000000000000000000000000000000000000000..0335d19ffb2cd291a51c9ff5207e34609002d81f --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/wrapt/wrappers.py @@ -0,0 +1,980 @@ +import inspect +import operator +import sys + + +def with_metaclass(meta, *bases): + """Create a base class with a metaclass.""" + return meta("NewBase", bases, {}) + + +class WrapperNotInitializedError(ValueError, AttributeError): + """ + Exception raised when a wrapper is accessed before it has been initialized. + To satisfy different situations where this could arise, we inherit from both + ValueError and AttributeError. + """ + + pass + + +class _ObjectProxyMethods: + + # We use properties to override the values of __module__ and + # __doc__. If we add these in ObjectProxy, the derived class + # __dict__ will still be setup to have string variants of these + # attributes and the rules of descriptors means that they appear to + # take precedence over the properties in the base class. To avoid + # that, we copy the properties into the derived class type itself + # via a meta class. In that way the properties will always take + # precedence. + + @property + def __module__(self): + return self.__wrapped__.__module__ + + @__module__.setter + def __module__(self, value): + self.__wrapped__.__module__ = value + + @property + def __doc__(self): + return self.__wrapped__.__doc__ + + @__doc__.setter + def __doc__(self, value): + self.__wrapped__.__doc__ = value + + # We similar use a property for __dict__. We need __dict__ to be + # explicit to ensure that vars() works as expected. + + @property + def __dict__(self): + return self.__wrapped__.__dict__ + + # Need to also propagate the special __weakref__ attribute for case + # where decorating classes which will define this. If do not define + # it and use a function like inspect.getmembers() on a decorator + # class it will fail. This can't be in the derived classes. + + @property + def __weakref__(self): + return self.__wrapped__.__weakref__ + + +class _ObjectProxyMetaType(type): + def __new__(cls, name, bases, dictionary): + # Copy our special properties into the class so that they + # always take precedence over attributes of the same name added + # during construction of a derived class. This is to save + # duplicating the implementation for them in all derived classes. + + dictionary.update(vars(_ObjectProxyMethods)) + + return type.__new__(cls, name, bases, dictionary) + + +# NOTE: Although Python 3+ supports the newer metaclass=MetaClass syntax, +# we must continue using with_metaclass() for ObjectProxy. The newer syntax +# changes how __slots__ is handled during class creation, which would break +# the ability to set _self_* attributes on ObjectProxy instances. The +# with_metaclass() approach creates an intermediate base class that allows +# the necessary attribute flexibility while still applying the metaclass. + + +class ObjectProxy(with_metaclass(_ObjectProxyMetaType)): # type: ignore[misc] + + __slots__ = "__wrapped__" + + def __init__(self, wrapped): + """Create an object proxy around the given object.""" + + if wrapped is None: + try: + callback = object.__getattribute__(self, "__wrapped_factory__") + except AttributeError: + callback = None + + if callback is not None: + # If wrapped is none and class has a __wrapped_factory__ + # method, then we don't set __wrapped__ yet and instead will + # defer creation of the wrapped object until it is first + # needed. + + pass + + else: + object.__setattr__(self, "__wrapped__", wrapped) + else: + object.__setattr__(self, "__wrapped__", wrapped) + + # Python 3.2+ has the __qualname__ attribute, but it does not + # allow it to be overridden using a property and it must instead + # be an actual string object instead. + + try: + object.__setattr__(self, "__qualname__", wrapped.__qualname__) + except AttributeError: + pass + + # Python 3.10 onwards also does not allow itself to be overridden + # using a property and it must instead be set explicitly. + + try: + object.__setattr__(self, "__annotations__", wrapped.__annotations__) + except AttributeError: + pass + + @property + def __object_proxy__(self): + return ObjectProxy + + def __self_setattr__(self, name, value): + object.__setattr__(self, name, value) + + @property + def __name__(self): + return self.__wrapped__.__name__ + + @__name__.setter + def __name__(self, value): + self.__wrapped__.__name__ = value + + @property + def __class__(self): + return self.__wrapped__.__class__ + + @__class__.setter + def __class__(self, value): + self.__wrapped__.__class__ = value + + def __dir__(self): + return dir(self.__wrapped__) + + def __str__(self): + return str(self.__wrapped__) + + def __bytes__(self): + return bytes(self.__wrapped__) + + def __repr__(self): + return f"<{type(self).__name__} at 0x{id(self):x} for {type(self.__wrapped__).__name__} at 0x{id(self.__wrapped__):x}>" + + def __format__(self, format_spec): + return format(self.__wrapped__, format_spec) + + def __reversed__(self): + return reversed(self.__wrapped__) + + def __round__(self, ndigits=None): + return round(self.__wrapped__, ndigits) + + def __mro_entries__(self, bases): + if not isinstance(self.__wrapped__, type) and hasattr( + self.__wrapped__, "__mro_entries__" + ): + return self.__wrapped__.__mro_entries__(bases) + return (self.__wrapped__,) + + def __lt__(self, other): + return self.__wrapped__ < other + + def __le__(self, other): + return self.__wrapped__ <= other + + def __eq__(self, other): + return self.__wrapped__ == other + + def __ne__(self, other): + return self.__wrapped__ != other + + def __gt__(self, other): + return self.__wrapped__ > other + + def __ge__(self, other): + return self.__wrapped__ >= other + + def __hash__(self): + return hash(self.__wrapped__) + + def __nonzero__(self): + return bool(self.__wrapped__) + + def __bool__(self): + return bool(self.__wrapped__) + + def __setattr__(self, name, value): + if name.startswith("_self_"): + object.__setattr__(self, name, value) + + elif name == "__wrapped__": + object.__setattr__(self, name, value) + + try: + object.__delattr__(self, "__qualname__") + except AttributeError: + pass + try: + object.__setattr__(self, "__qualname__", value.__qualname__) + except AttributeError: + pass + try: + object.__delattr__(self, "__annotations__") + except AttributeError: + pass + try: + object.__setattr__(self, "__annotations__", value.__annotations__) + except AttributeError: + pass + + __wrapped_setattr_fixups__ = getattr( + self, "__wrapped_setattr_fixups__", None + ) + + if __wrapped_setattr_fixups__ is not None: + __wrapped_setattr_fixups__() + + elif name == "__qualname__": + setattr(self.__wrapped__, name, value) + object.__setattr__(self, name, value) + + elif name == "__annotations__": + setattr(self.__wrapped__, name, value) + object.__setattr__(self, name, value) + + elif hasattr(type(self), name): + object.__setattr__(self, name, value) + + else: + setattr(self.__wrapped__, name, value) + + def __getattr__(self, name): + # If we need to lookup `__wrapped__` then the `__init__()` method + # cannot have been called, or this is a lazy object proxy which is + # deferring creation of the wrapped object until it is first needed. + + if name == "__wrapped__": + # Note that we use existance of `__wrapped_factory__` to gate whether + # we can attempt to initialize the wrapped object lazily, but it is + # `__wrapped_get__` that we actually call to do the initialization. + # This is so that we can handle multithreading correctly by having + # `__wrapped_get__` use a lock to protect against multiple threads + # trying to initialize the wrapped object at the same time. + + try: + object.__getattribute__(self, "__wrapped_factory__") + except AttributeError: + pass + else: + return object.__getattribute__(self, "__wrapped_get__")() + + raise WrapperNotInitializedError("wrapper has not been initialized") + + return getattr(self.__wrapped__, name) + + def __delattr__(self, name): + if name.startswith("_self_"): + object.__delattr__(self, name) + + elif name == "__wrapped__": + raise TypeError("__wrapped__ attribute cannot be deleted") + + elif name == "__qualname__": + object.__delattr__(self, name) + delattr(self.__wrapped__, name) + + elif hasattr(type(self), name): + object.__delattr__(self, name) + + else: + delattr(self.__wrapped__, name) + + def __add__(self, other): + return self.__wrapped__ + other + + def __sub__(self, other): + return self.__wrapped__ - other + + def __mul__(self, other): + return self.__wrapped__ * other + + def __truediv__(self, other): + return operator.truediv(self.__wrapped__, other) + + def __floordiv__(self, other): + return self.__wrapped__ // other + + def __mod__(self, other): + return self.__wrapped__ % other + + def __divmod__(self, other): + return divmod(self.__wrapped__, other) + + def __pow__(self, other, *args): + return pow(self.__wrapped__, other, *args) + + def __lshift__(self, other): + return self.__wrapped__ << other + + def __rshift__(self, other): + return self.__wrapped__ >> other + + def __and__(self, other): + return self.__wrapped__ & other + + def __xor__(self, other): + return self.__wrapped__ ^ other + + def __or__(self, other): + return self.__wrapped__ | other + + def __radd__(self, other): + return other + self.__wrapped__ + + def __rsub__(self, other): + return other - self.__wrapped__ + + def __rmul__(self, other): + return other * self.__wrapped__ + + def __rtruediv__(self, other): + return operator.truediv(other, self.__wrapped__) + + def __rfloordiv__(self, other): + return other // self.__wrapped__ + + def __rmod__(self, other): + return other % self.__wrapped__ + + def __rdivmod__(self, other): + return divmod(other, self.__wrapped__) + + def __rpow__(self, other, *args): + return pow(other, self.__wrapped__, *args) + + def __rlshift__(self, other): + return other << self.__wrapped__ + + def __rrshift__(self, other): + return other >> self.__wrapped__ + + def __rand__(self, other): + return other & self.__wrapped__ + + def __rxor__(self, other): + return other ^ self.__wrapped__ + + def __ror__(self, other): + return other | self.__wrapped__ + + def __iadd__(self, other): + if hasattr(self.__wrapped__, "__iadd__"): + self.__wrapped__ += other + return self + else: + return self.__object_proxy__(self.__wrapped__ + other) + + def __isub__(self, other): + if hasattr(self.__wrapped__, "__isub__"): + self.__wrapped__ -= other + return self + else: + return self.__object_proxy__(self.__wrapped__ - other) + + def __imul__(self, other): + if hasattr(self.__wrapped__, "__imul__"): + self.__wrapped__ *= other + return self + else: + return self.__object_proxy__(self.__wrapped__ * other) + + def __itruediv__(self, other): + if hasattr(self.__wrapped__, "__itruediv__"): + self.__wrapped__ /= other + return self + else: + return self.__object_proxy__(self.__wrapped__ / other) + + def __ifloordiv__(self, other): + if hasattr(self.__wrapped__, "__ifloordiv__"): + self.__wrapped__ //= other + return self + else: + return self.__object_proxy__(self.__wrapped__ // other) + + def __imod__(self, other): + if hasattr(self.__wrapped__, "__imod__"): + self.__wrapped__ %= other + return self + else: + return self.__object_proxy__(self.__wrapped__ % other) + + return self + + def __ipow__(self, other): # type: ignore[misc] + if hasattr(self.__wrapped__, "__ipow__"): + self.__wrapped__ **= other + return self + else: + return self.__object_proxy__(self.__wrapped__**other) + + def __ilshift__(self, other): + if hasattr(self.__wrapped__, "__ilshift__"): + self.__wrapped__ <<= other + return self + else: + return self.__object_proxy__(self.__wrapped__ << other) + + def __irshift__(self, other): + if hasattr(self.__wrapped__, "__irshift__"): + self.__wrapped__ >>= other + return self + else: + return self.__object_proxy__(self.__wrapped__ >> other) + + def __iand__(self, other): + if hasattr(self.__wrapped__, "__iand__"): + self.__wrapped__ &= other + return self + else: + return self.__object_proxy__(self.__wrapped__ & other) + + def __ixor__(self, other): + if hasattr(self.__wrapped__, "__ixor__"): + self.__wrapped__ ^= other + return self + else: + return self.__object_proxy__(self.__wrapped__ ^ other) + + def __ior__(self, other): + if hasattr(self.__wrapped__, "__ior__"): + self.__wrapped__ |= other + return self + else: + return self.__object_proxy__(self.__wrapped__ | other) + + def __neg__(self): + return -self.__wrapped__ + + def __pos__(self): + return +self.__wrapped__ + + def __abs__(self): + return abs(self.__wrapped__) + + def __invert__(self): + return ~self.__wrapped__ + + def __int__(self): + return int(self.__wrapped__) + + def __float__(self): + return float(self.__wrapped__) + + def __complex__(self): + return complex(self.__wrapped__) + + def __oct__(self): + return oct(self.__wrapped__) + + def __hex__(self): + return hex(self.__wrapped__) + + def __index__(self): + return operator.index(self.__wrapped__) + + def __matmul__(self, other): + return self.__wrapped__ @ other + + def __rmatmul__(self, other): + return other @ self.__wrapped__ + + def __imatmul__(self, other): + if hasattr(self.__wrapped__, "__imatmul__"): + self.__wrapped__ @= other + return self + else: + return self.__object_proxy__(self.__wrapped__ @ other) + + def __len__(self): + return len(self.__wrapped__) + + def __contains__(self, value): + return value in self.__wrapped__ + + def __getitem__(self, key): + return self.__wrapped__[key] + + def __setitem__(self, key, value): + self.__wrapped__[key] = value + + def __delitem__(self, key): + del self.__wrapped__[key] + + def __getslice__(self, i, j): + return self.__wrapped__[i:j] + + def __setslice__(self, i, j, value): + self.__wrapped__[i:j] = value + + def __delslice__(self, i, j): + del self.__wrapped__[i:j] + + def __enter__(self): + return self.__wrapped__.__enter__() + + def __exit__(self, *args, **kwargs): + return self.__wrapped__.__exit__(*args, **kwargs) + + def __aenter__(self): + return self.__wrapped__.__aenter__() + + def __aexit__(self, *args, **kwargs): + return self.__wrapped__.__aexit__(*args, **kwargs) + + def __copy__(self): + raise NotImplementedError("object proxy must define __copy__()") + + def __deepcopy__(self, memo): + raise NotImplementedError("object proxy must define __deepcopy__()") + + def __reduce__(self): + raise NotImplementedError("object proxy must define __reduce__()") + + def __reduce_ex__(self, protocol): + raise NotImplementedError("object proxy must define __reduce_ex__()") + + +class CallableObjectProxy(ObjectProxy): + + def __call__(*args, **kwargs): + def _unpack_self(self, *args): + return self, args + + self, args = _unpack_self(*args) + + return self.__wrapped__(*args, **kwargs) + + +class PartialCallableObjectProxy(ObjectProxy): + """A callable object proxy that supports partial application of arguments + and keywords. + """ + + def __init__(*args, **kwargs): + """Create a callable object proxy with partial application of the given + arguments and keywords. This behaves the same as `functools.partial`, but + implemented using the `ObjectProxy` class to provide better support for + introspection. + """ + + def _unpack_self(self, *args): + return self, args + + self, args = _unpack_self(*args) + + if len(args) < 1: + raise TypeError("partial type takes at least one argument") + + wrapped, args = args[0], args[1:] + + if not callable(wrapped): + raise TypeError("the first argument must be callable") + + super(PartialCallableObjectProxy, self).__init__(wrapped) + + self._self_args = args + self._self_kwargs = kwargs + + def __call__(*args, **kwargs): + def _unpack_self(self, *args): + return self, args + + self, args = _unpack_self(*args) + + _args = self._self_args + args + + _kwargs = dict(self._self_kwargs) + _kwargs.update(kwargs) + + return self.__wrapped__(*_args, **_kwargs) + + +class _FunctionWrapperBase(ObjectProxy): + + __slots__ = ( + "_self_instance", + "_self_wrapper", + "_self_enabled", + "_self_binding", + "_self_parent", + "_self_owner", + ) + + def __init__( + self, + wrapped, + instance, + wrapper, + enabled=None, + binding="callable", + parent=None, + owner=None, + ): + + super(_FunctionWrapperBase, self).__init__(wrapped) + + object.__setattr__(self, "_self_instance", instance) + object.__setattr__(self, "_self_wrapper", wrapper) + object.__setattr__(self, "_self_enabled", enabled) + object.__setattr__(self, "_self_binding", binding) + object.__setattr__(self, "_self_parent", parent) + object.__setattr__(self, "_self_owner", owner) + + def __get__(self, instance, owner): + # This method is actually doing double duty for both unbound and bound + # derived wrapper classes. It should possibly be broken up and the + # distinct functionality moved into the derived classes. Can't do that + # straight away due to some legacy code which is relying on it being + # here in this base class. + # + # The distinguishing attribute which determines whether we are being + # called in an unbound or bound wrapper is the parent attribute. If + # binding has never occurred, then the parent will be None. + # + # First therefore, is if we are called in an unbound wrapper. In this + # case we perform the binding. + # + # We have two special cases to worry about here. These are where we are + # decorating a class or builtin function as neither provide a __get__() + # method to call. In this case we simply return self. + # + # Note that we otherwise still do binding even if instance is None and + # accessing an unbound instance method from a class. This is because we + # need to be able to later detect that specific case as we will need to + # extract the instance from the first argument of those passed in. + + if self._self_parent is None: + # Technically can probably just check for existence of __get__ on + # the wrapped object, but this is more explicit. + + if self._self_binding == "builtin": + return self + + if self._self_binding == "class": + return self + + binder = getattr(self.__wrapped__, "__get__", None) + + if binder is None: + return self + + descriptor = binder(instance, owner) + + return self.__bound_function_wrapper__( + descriptor, + instance, + self._self_wrapper, + self._self_enabled, + self._self_binding, + self, + owner, + ) + + # Now we have the case of binding occurring a second time on what was + # already a bound function. In this case we would usually return + # ourselves again. This mirrors what Python does. + # + # The special case this time is where we were originally bound with an + # instance of None and we were likely an instance method. In that case + # we rebind against the original wrapped function from the parent again. + + if self._self_instance is None and self._self_binding in ( + "function", + "instancemethod", + "callable", + ): + descriptor = self._self_parent.__wrapped__.__get__(instance, owner) + + return self._self_parent.__bound_function_wrapper__( + descriptor, + instance, + self._self_wrapper, + self._self_enabled, + self._self_binding, + self._self_parent, + owner, + ) + + return self + + def __call__(*args, **kwargs): + def _unpack_self(self, *args): + return self, args + + self, args = _unpack_self(*args) + + # If enabled has been specified, then evaluate it at this point + # and if the wrapper is not to be executed, then simply return + # the bound function rather than a bound wrapper for the bound + # function. When evaluating enabled, if it is callable we call + # it, otherwise we evaluate it as a boolean. + + if self._self_enabled is not None: + if callable(self._self_enabled): + if not self._self_enabled(): + return self.__wrapped__(*args, **kwargs) + elif not self._self_enabled: + return self.__wrapped__(*args, **kwargs) + + # This can occur where initial function wrapper was applied to + # a function that was already bound to an instance. In that case + # we want to extract the instance from the function and use it. + + if self._self_binding in ( + "function", + "instancemethod", + "classmethod", + "callable", + ): + if self._self_instance is None: + instance = getattr(self.__wrapped__, "__self__", None) + if instance is not None: + return self._self_wrapper(self.__wrapped__, instance, args, kwargs) + + # This is generally invoked when the wrapped function is being + # called as a normal function and is not bound to a class as an + # instance method. This is also invoked in the case where the + # wrapped function was a method, but this wrapper was in turn + # wrapped using the staticmethod decorator. + + return self._self_wrapper(self.__wrapped__, self._self_instance, args, kwargs) + + def __set_name__(self, owner, name): + # This is a special method use to supply information to + # descriptors about what the name of variable in a class + # definition is. Not wanting to add this to ObjectProxy as not + # sure of broader implications of doing that. Thus restrict to + # FunctionWrapper used by decorators. + + if hasattr(self.__wrapped__, "__set_name__"): + self.__wrapped__.__set_name__(owner, name) + + def __instancecheck__(self, instance): + # This is a special method used by isinstance() to make checks + # instance of the `__wrapped__`. + return isinstance(instance, self.__wrapped__) + + def __subclasscheck__(self, subclass): + # This is a special method used by issubclass() to make checks + # about inheritance of classes. We need to upwrap any object + # proxy. Not wanting to add this to ObjectProxy as not sure of + # broader implications of doing that. Thus restrict to + # FunctionWrapper used by decorators. + + if hasattr(subclass, "__wrapped__"): + return issubclass(subclass.__wrapped__, self.__wrapped__) + else: + return issubclass(subclass, self.__wrapped__) + + +class BoundFunctionWrapper(_FunctionWrapperBase): + + def __call__(*args, **kwargs): + def _unpack_self(self, *args): + return self, args + + self, args = _unpack_self(*args) + + # If enabled has been specified, then evaluate it at this point and if + # the wrapper is not to be executed, then simply return the bound + # function rather than a bound wrapper for the bound function. When + # evaluating enabled, if it is callable we call it, otherwise we + # evaluate it as a boolean. + + if self._self_enabled is not None: + if callable(self._self_enabled): + if not self._self_enabled(): + return self.__wrapped__(*args, **kwargs) + elif not self._self_enabled: + return self.__wrapped__(*args, **kwargs) + + # We need to do things different depending on whether we are likely + # wrapping an instance method vs a static method or class method. + + if self._self_binding == "function": + if self._self_instance is None and args: + instance, newargs = args[0], args[1:] + if isinstance(instance, self._self_owner): + wrapped = PartialCallableObjectProxy(self.__wrapped__, instance) + return self._self_wrapper(wrapped, instance, newargs, kwargs) + + return self._self_wrapper( + self.__wrapped__, self._self_instance, args, kwargs + ) + + elif self._self_binding == "callable": + if self._self_instance is None: + # This situation can occur where someone is calling the + # instancemethod via the class type and passing the instance as + # the first argument. We need to shift the args before making + # the call to the wrapper and effectively bind the instance to + # the wrapped function using a partial so the wrapper doesn't + # see anything as being different. + + if not args: + raise TypeError("missing 1 required positional argument") + + instance, args = args[0], args[1:] + wrapped = PartialCallableObjectProxy(self.__wrapped__, instance) + return self._self_wrapper(wrapped, instance, args, kwargs) + + return self._self_wrapper( + self.__wrapped__, self._self_instance, args, kwargs + ) + + else: + # As in this case we would be dealing with a classmethod or + # staticmethod, then _self_instance will only tell us whether + # when calling the classmethod or staticmethod they did it via an + # instance of the class it is bound to and not the case where + # done by the class type itself. We thus ignore _self_instance + # and use the __self__ attribute of the bound function instead. + # For a classmethod, this means instance will be the class type + # and for a staticmethod it will be None. This is probably the + # more useful thing we can pass through even though we loose + # knowledge of whether they were called on the instance vs the + # class type, as it reflects what they have available in the + # decoratored function. + + instance = getattr(self.__wrapped__, "__self__", None) + + return self._self_wrapper(self.__wrapped__, instance, args, kwargs) + + +class FunctionWrapper(_FunctionWrapperBase): + """ + A wrapper for callable objects that can be used to apply decorators to + functions, methods, classmethods, and staticmethods, or any other callable. + It handles binding and unbinding of methods, and allows for the wrapper to + be enabled or disabled. + """ + + __bound_function_wrapper__ = BoundFunctionWrapper + + def __init__(self, wrapped, wrapper, enabled=None): + """ + Initialize the `FunctionWrapper` with the `wrapped` callable, the + `wrapper` function, and an optional `enabled` argument. The `enabled` + argument can be a boolean or a callable that returns a boolean. When a + callable is provided, it will be called each time the wrapper is + invoked to determine if the wrapper function should be executed or + whether the wrapped function should be called directly. If `enabled` + is not provided, the wrapper is enabled by default. + """ + + # What it is we are wrapping here could be anything. We need to + # try and detect specific cases though. In particular, we need + # to detect when we are given something that is a method of a + # class. Further, we need to know when it is likely an instance + # method, as opposed to a class or static method. This can + # become problematic though as there isn't strictly a fool proof + # method of knowing. + # + # The situations we could encounter when wrapping a method are: + # + # 1. The wrapper is being applied as part of a decorator which + # is a part of the class definition. In this case what we are + # given is the raw unbound function, classmethod or staticmethod + # wrapper objects. + # + # The problem here is that we will not know we are being applied + # in the context of the class being set up. This becomes + # important later for the case of an instance method, because in + # that case we just see it as a raw function and can't + # distinguish it from wrapping a normal function outside of + # a class context. + # + # 2. The wrapper is being applied when performing monkey + # patching of the class type afterwards and the method to be + # wrapped was retrieved direct from the __dict__ of the class + # type. This is effectively the same as (1) above. + # + # 3. The wrapper is being applied when performing monkey + # patching of the class type afterwards and the method to be + # wrapped was retrieved from the class type. In this case + # binding will have been performed where the instance against + # which the method is bound will be None at that point. + # + # This case is a problem because we can no longer tell if the + # method was a static method, plus if using Python3, we cannot + # tell if it was an instance method as the concept of an + # unnbound method no longer exists. + # + # 4. The wrapper is being applied when performing monkey + # patching of an instance of a class. In this case binding will + # have been performed where the instance was not None. + # + # This case is a problem because we can no longer tell if the + # method was a static method. + # + # Overall, the best we can do is look at the original type of the + # object which was wrapped prior to any binding being done and + # see if it is an instance of classmethod or staticmethod. In + # the case where other decorators are between us and them, if + # they do not propagate the __class__ attribute so that the + # isinstance() checks works, then likely this will do the wrong + # thing where classmethod and staticmethod are used. + # + # Since it is likely to be very rare that anyone even puts + # decorators around classmethod and staticmethod, likelihood of + # that being an issue is very small, so we accept it and suggest + # that those other decorators be fixed. It is also only an issue + # if a decorator wants to actually do things with the arguments. + # + # As to not being able to identify static methods properly, we + # just hope that that isn't something people are going to want + # to wrap, or if they do suggest they do it the correct way by + # ensuring that it is decorated in the class definition itself, + # or patch it in the __dict__ of the class type. + # + # So to get the best outcome we can, whenever we aren't sure what + # it is, we label it as a 'callable'. If it was already bound and + # that is rebound later, we assume that it will be an instance + # method and try and cope with the possibility that the 'self' + # argument it being passed as an explicit argument and shuffle + # the arguments around to extract 'self' for use as the instance. + + binding = None + + if isinstance(wrapped, _FunctionWrapperBase): + binding = wrapped._self_binding + + if not binding: + if inspect.isbuiltin(wrapped): + binding = "builtin" + + elif inspect.isfunction(wrapped): + binding = "function" + + elif inspect.isclass(wrapped): + binding = "class" + + elif isinstance(wrapped, classmethod): + binding = "classmethod" + + elif isinstance(wrapped, staticmethod): + binding = "staticmethod" + + elif hasattr(wrapped, "__self__"): + if inspect.isclass(wrapped.__self__): + binding = "classmethod" + elif inspect.ismethod(wrapped): + binding = "instancemethod" + else: + binding = "callable" + + else: + binding = "callable" + + super(FunctionWrapper, self).__init__(wrapped, None, wrapper, enabled, binding) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/__init__.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d58f0891737def7f38e5d86dde2dbf9be0c13dce --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/__init__.py @@ -0,0 +1,390 @@ + +from .error import * + +from .tokens import * +from .events import * +from .nodes import * + +from .loader import * +from .dumper import * + +__version__ = '6.0.3' +try: + from .cyaml import * + __with_libyaml__ = True +except ImportError: + __with_libyaml__ = False + +import io + +#------------------------------------------------------------------------------ +# XXX "Warnings control" is now deprecated. Leaving in the API function to not +# break code that uses it. +#------------------------------------------------------------------------------ +def warnings(settings=None): + if settings is None: + return {} + +#------------------------------------------------------------------------------ +def scan(stream, Loader=Loader): + """ + Scan a YAML stream and produce scanning tokens. + """ + loader = Loader(stream) + try: + while loader.check_token(): + yield loader.get_token() + finally: + loader.dispose() + +def parse(stream, Loader=Loader): + """ + Parse a YAML stream and produce parsing events. + """ + loader = Loader(stream) + try: + while loader.check_event(): + yield loader.get_event() + finally: + loader.dispose() + +def compose(stream, Loader=Loader): + """ + Parse the first YAML document in a stream + and produce the corresponding representation tree. + """ + loader = Loader(stream) + try: + return loader.get_single_node() + finally: + loader.dispose() + +def compose_all(stream, Loader=Loader): + """ + Parse all YAML documents in a stream + and produce corresponding representation trees. + """ + loader = Loader(stream) + try: + while loader.check_node(): + yield loader.get_node() + finally: + loader.dispose() + +def load(stream, Loader): + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + """ + loader = Loader(stream) + try: + return loader.get_single_data() + finally: + loader.dispose() + +def load_all(stream, Loader): + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + """ + loader = Loader(stream) + try: + while loader.check_data(): + yield loader.get_data() + finally: + loader.dispose() + +def full_load(stream): + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + + Resolve all tags except those known to be + unsafe on untrusted input. + """ + return load(stream, FullLoader) + +def full_load_all(stream): + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + + Resolve all tags except those known to be + unsafe on untrusted input. + """ + return load_all(stream, FullLoader) + +def safe_load(stream): + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + + Resolve only basic YAML tags. This is known + to be safe for untrusted input. + """ + return load(stream, SafeLoader) + +def safe_load_all(stream): + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + + Resolve only basic YAML tags. This is known + to be safe for untrusted input. + """ + return load_all(stream, SafeLoader) + +def unsafe_load(stream): + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + + Resolve all tags, even those known to be + unsafe on untrusted input. + """ + return load(stream, UnsafeLoader) + +def unsafe_load_all(stream): + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + + Resolve all tags, even those known to be + unsafe on untrusted input. + """ + return load_all(stream, UnsafeLoader) + +def emit(events, stream=None, Dumper=Dumper, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None): + """ + Emit YAML parsing events into a stream. + If stream is None, return the produced string instead. + """ + getvalue = None + if stream is None: + stream = io.StringIO() + getvalue = stream.getvalue + dumper = Dumper(stream, canonical=canonical, indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break) + try: + for event in events: + dumper.emit(event) + finally: + dumper.dispose() + if getvalue: + return getvalue() + +def serialize_all(nodes, stream=None, Dumper=Dumper, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None): + """ + Serialize a sequence of representation trees into a YAML stream. + If stream is None, return the produced string instead. + """ + getvalue = None + if stream is None: + if encoding is None: + stream = io.StringIO() + else: + stream = io.BytesIO() + getvalue = stream.getvalue + dumper = Dumper(stream, canonical=canonical, indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break, + encoding=encoding, version=version, tags=tags, + explicit_start=explicit_start, explicit_end=explicit_end) + try: + dumper.open() + for node in nodes: + dumper.serialize(node) + dumper.close() + finally: + dumper.dispose() + if getvalue: + return getvalue() + +def serialize(node, stream=None, Dumper=Dumper, **kwds): + """ + Serialize a representation tree into a YAML stream. + If stream is None, return the produced string instead. + """ + return serialize_all([node], stream, Dumper=Dumper, **kwds) + +def dump_all(documents, stream=None, Dumper=Dumper, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + """ + Serialize a sequence of Python objects into a YAML stream. + If stream is None, return the produced string instead. + """ + getvalue = None + if stream is None: + if encoding is None: + stream = io.StringIO() + else: + stream = io.BytesIO() + getvalue = stream.getvalue + dumper = Dumper(stream, default_style=default_style, + default_flow_style=default_flow_style, + canonical=canonical, indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break, + encoding=encoding, version=version, tags=tags, + explicit_start=explicit_start, explicit_end=explicit_end, sort_keys=sort_keys) + try: + dumper.open() + for data in documents: + dumper.represent(data) + dumper.close() + finally: + dumper.dispose() + if getvalue: + return getvalue() + +def dump(data, stream=None, Dumper=Dumper, **kwds): + """ + Serialize a Python object into a YAML stream. + If stream is None, return the produced string instead. + """ + return dump_all([data], stream, Dumper=Dumper, **kwds) + +def safe_dump_all(documents, stream=None, **kwds): + """ + Serialize a sequence of Python objects into a YAML stream. + Produce only basic YAML tags. + If stream is None, return the produced string instead. + """ + return dump_all(documents, stream, Dumper=SafeDumper, **kwds) + +def safe_dump(data, stream=None, **kwds): + """ + Serialize a Python object into a YAML stream. + Produce only basic YAML tags. + If stream is None, return the produced string instead. + """ + return dump_all([data], stream, Dumper=SafeDumper, **kwds) + +def add_implicit_resolver(tag, regexp, first=None, + Loader=None, Dumper=Dumper): + """ + Add an implicit scalar detector. + If an implicit scalar value matches the given regexp, + the corresponding tag is assigned to the scalar. + first is a sequence of possible initial characters or None. + """ + if Loader is None: + loader.Loader.add_implicit_resolver(tag, regexp, first) + loader.FullLoader.add_implicit_resolver(tag, regexp, first) + loader.UnsafeLoader.add_implicit_resolver(tag, regexp, first) + else: + Loader.add_implicit_resolver(tag, regexp, first) + Dumper.add_implicit_resolver(tag, regexp, first) + +def add_path_resolver(tag, path, kind=None, Loader=None, Dumper=Dumper): + """ + Add a path based resolver for the given tag. + A path is a list of keys that forms a path + to a node in the representation tree. + Keys can be string values, integers, or None. + """ + if Loader is None: + loader.Loader.add_path_resolver(tag, path, kind) + loader.FullLoader.add_path_resolver(tag, path, kind) + loader.UnsafeLoader.add_path_resolver(tag, path, kind) + else: + Loader.add_path_resolver(tag, path, kind) + Dumper.add_path_resolver(tag, path, kind) + +def add_constructor(tag, constructor, Loader=None): + """ + Add a constructor for the given tag. + Constructor is a function that accepts a Loader instance + and a node object and produces the corresponding Python object. + """ + if Loader is None: + loader.Loader.add_constructor(tag, constructor) + loader.FullLoader.add_constructor(tag, constructor) + loader.UnsafeLoader.add_constructor(tag, constructor) + else: + Loader.add_constructor(tag, constructor) + +def add_multi_constructor(tag_prefix, multi_constructor, Loader=None): + """ + Add a multi-constructor for the given tag prefix. + Multi-constructor is called for a node if its tag starts with tag_prefix. + Multi-constructor accepts a Loader instance, a tag suffix, + and a node object and produces the corresponding Python object. + """ + if Loader is None: + loader.Loader.add_multi_constructor(tag_prefix, multi_constructor) + loader.FullLoader.add_multi_constructor(tag_prefix, multi_constructor) + loader.UnsafeLoader.add_multi_constructor(tag_prefix, multi_constructor) + else: + Loader.add_multi_constructor(tag_prefix, multi_constructor) + +def add_representer(data_type, representer, Dumper=Dumper): + """ + Add a representer for the given type. + Representer is a function accepting a Dumper instance + and an instance of the given data type + and producing the corresponding representation node. + """ + Dumper.add_representer(data_type, representer) + +def add_multi_representer(data_type, multi_representer, Dumper=Dumper): + """ + Add a representer for the given type. + Multi-representer is a function accepting a Dumper instance + and an instance of the given data type or subtype + and producing the corresponding representation node. + """ + Dumper.add_multi_representer(data_type, multi_representer) + +class YAMLObjectMetaclass(type): + """ + The metaclass for YAMLObject. + """ + def __init__(cls, name, bases, kwds): + super(YAMLObjectMetaclass, cls).__init__(name, bases, kwds) + if 'yaml_tag' in kwds and kwds['yaml_tag'] is not None: + if isinstance(cls.yaml_loader, list): + for loader in cls.yaml_loader: + loader.add_constructor(cls.yaml_tag, cls.from_yaml) + else: + cls.yaml_loader.add_constructor(cls.yaml_tag, cls.from_yaml) + + cls.yaml_dumper.add_representer(cls, cls.to_yaml) + +class YAMLObject(metaclass=YAMLObjectMetaclass): + """ + An object that can dump itself to a YAML stream + and load itself from a YAML stream. + """ + + __slots__ = () # no direct instantiation, so allow immutable subclasses + + yaml_loader = [Loader, FullLoader, UnsafeLoader] + yaml_dumper = Dumper + + yaml_tag = None + yaml_flow_style = None + + @classmethod + def from_yaml(cls, loader, node): + """ + Convert a representation node to a Python object. + """ + return loader.construct_yaml_object(node, cls) + + @classmethod + def to_yaml(cls, dumper, data): + """ + Convert a Python object to a representation node. + """ + return dumper.represent_yaml_object(cls.yaml_tag, data, cls, + flow_style=cls.yaml_flow_style) + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/composer.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/composer.py new file mode 100644 index 0000000000000000000000000000000000000000..6d15cb40e3b4198819c91c6f8d8b32807fcf53b2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/composer.py @@ -0,0 +1,139 @@ + +__all__ = ['Composer', 'ComposerError'] + +from .error import MarkedYAMLError +from .events import * +from .nodes import * + +class ComposerError(MarkedYAMLError): + pass + +class Composer: + + def __init__(self): + self.anchors = {} + + def check_node(self): + # Drop the STREAM-START event. + if self.check_event(StreamStartEvent): + self.get_event() + + # If there are more documents available? + return not self.check_event(StreamEndEvent) + + def get_node(self): + # Get the root node of the next document. + if not self.check_event(StreamEndEvent): + return self.compose_document() + + def get_single_node(self): + # Drop the STREAM-START event. + self.get_event() + + # Compose a document if the stream is not empty. + document = None + if not self.check_event(StreamEndEvent): + document = self.compose_document() + + # Ensure that the stream contains no more documents. + if not self.check_event(StreamEndEvent): + event = self.get_event() + raise ComposerError("expected a single document in the stream", + document.start_mark, "but found another document", + event.start_mark) + + # Drop the STREAM-END event. + self.get_event() + + return document + + def compose_document(self): + # Drop the DOCUMENT-START event. + self.get_event() + + # Compose the root node. + node = self.compose_node(None, None) + + # Drop the DOCUMENT-END event. + self.get_event() + + self.anchors = {} + return node + + def compose_node(self, parent, index): + if self.check_event(AliasEvent): + event = self.get_event() + anchor = event.anchor + if anchor not in self.anchors: + raise ComposerError(None, None, "found undefined alias %r" + % anchor, event.start_mark) + return self.anchors[anchor] + event = self.peek_event() + anchor = event.anchor + if anchor is not None: + if anchor in self.anchors: + raise ComposerError("found duplicate anchor %r; first occurrence" + % anchor, self.anchors[anchor].start_mark, + "second occurrence", event.start_mark) + self.descend_resolver(parent, index) + if self.check_event(ScalarEvent): + node = self.compose_scalar_node(anchor) + elif self.check_event(SequenceStartEvent): + node = self.compose_sequence_node(anchor) + elif self.check_event(MappingStartEvent): + node = self.compose_mapping_node(anchor) + self.ascend_resolver() + return node + + def compose_scalar_node(self, anchor): + event = self.get_event() + tag = event.tag + if tag is None or tag == '!': + tag = self.resolve(ScalarNode, event.value, event.implicit) + node = ScalarNode(tag, event.value, + event.start_mark, event.end_mark, style=event.style) + if anchor is not None: + self.anchors[anchor] = node + return node + + def compose_sequence_node(self, anchor): + start_event = self.get_event() + tag = start_event.tag + if tag is None or tag == '!': + tag = self.resolve(SequenceNode, None, start_event.implicit) + node = SequenceNode(tag, [], + start_event.start_mark, None, + flow_style=start_event.flow_style) + if anchor is not None: + self.anchors[anchor] = node + index = 0 + while not self.check_event(SequenceEndEvent): + node.value.append(self.compose_node(node, index)) + index += 1 + end_event = self.get_event() + node.end_mark = end_event.end_mark + return node + + def compose_mapping_node(self, anchor): + start_event = self.get_event() + tag = start_event.tag + if tag is None or tag == '!': + tag = self.resolve(MappingNode, None, start_event.implicit) + node = MappingNode(tag, [], + start_event.start_mark, None, + flow_style=start_event.flow_style) + if anchor is not None: + self.anchors[anchor] = node + while not self.check_event(MappingEndEvent): + #key_event = self.peek_event() + item_key = self.compose_node(node, None) + #if item_key in node.value: + # raise ComposerError("while composing a mapping", start_event.start_mark, + # "found duplicate key", key_event.start_mark) + item_value = self.compose_node(node, item_key) + #node.value[item_key] = item_value + node.value.append((item_key, item_value)) + end_event = self.get_event() + node.end_mark = end_event.end_mark + return node + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/constructor.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/constructor.py new file mode 100644 index 0000000000000000000000000000000000000000..619acd3070a4845c653fcf22a626e05158035bc2 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/constructor.py @@ -0,0 +1,748 @@ + +__all__ = [ + 'BaseConstructor', + 'SafeConstructor', + 'FullConstructor', + 'UnsafeConstructor', + 'Constructor', + 'ConstructorError' +] + +from .error import * +from .nodes import * + +import collections.abc, datetime, base64, binascii, re, sys, types + +class ConstructorError(MarkedYAMLError): + pass + +class BaseConstructor: + + yaml_constructors = {} + yaml_multi_constructors = {} + + def __init__(self): + self.constructed_objects = {} + self.recursive_objects = {} + self.state_generators = [] + self.deep_construct = False + + def check_data(self): + # If there are more documents available? + return self.check_node() + + def check_state_key(self, key): + """Block special attributes/methods from being set in a newly created + object, to prevent user-controlled methods from being called during + deserialization""" + if self.get_state_keys_blacklist_regexp().match(key): + raise ConstructorError(None, None, + "blacklisted key '%s' in instance state found" % (key,), None) + + def get_data(self): + # Construct and return the next document. + if self.check_node(): + return self.construct_document(self.get_node()) + + def get_single_data(self): + # Ensure that the stream contains a single document and construct it. + node = self.get_single_node() + if node is not None: + return self.construct_document(node) + return None + + def construct_document(self, node): + data = self.construct_object(node) + while self.state_generators: + state_generators = self.state_generators + self.state_generators = [] + for generator in state_generators: + for dummy in generator: + pass + self.constructed_objects = {} + self.recursive_objects = {} + self.deep_construct = False + return data + + def construct_object(self, node, deep=False): + if node in self.constructed_objects: + return self.constructed_objects[node] + if deep: + old_deep = self.deep_construct + self.deep_construct = True + if node in self.recursive_objects: + raise ConstructorError(None, None, + "found unconstructable recursive node", node.start_mark) + self.recursive_objects[node] = None + constructor = None + tag_suffix = None + if node.tag in self.yaml_constructors: + constructor = self.yaml_constructors[node.tag] + else: + for tag_prefix in self.yaml_multi_constructors: + if tag_prefix is not None and node.tag.startswith(tag_prefix): + tag_suffix = node.tag[len(tag_prefix):] + constructor = self.yaml_multi_constructors[tag_prefix] + break + else: + if None in self.yaml_multi_constructors: + tag_suffix = node.tag + constructor = self.yaml_multi_constructors[None] + elif None in self.yaml_constructors: + constructor = self.yaml_constructors[None] + elif isinstance(node, ScalarNode): + constructor = self.__class__.construct_scalar + elif isinstance(node, SequenceNode): + constructor = self.__class__.construct_sequence + elif isinstance(node, MappingNode): + constructor = self.__class__.construct_mapping + if tag_suffix is None: + data = constructor(self, node) + else: + data = constructor(self, tag_suffix, node) + if isinstance(data, types.GeneratorType): + generator = data + data = next(generator) + if self.deep_construct: + for dummy in generator: + pass + else: + self.state_generators.append(generator) + self.constructed_objects[node] = data + del self.recursive_objects[node] + if deep: + self.deep_construct = old_deep + return data + + def construct_scalar(self, node): + if not isinstance(node, ScalarNode): + raise ConstructorError(None, None, + "expected a scalar node, but found %s" % node.id, + node.start_mark) + return node.value + + def construct_sequence(self, node, deep=False): + if not isinstance(node, SequenceNode): + raise ConstructorError(None, None, + "expected a sequence node, but found %s" % node.id, + node.start_mark) + return [self.construct_object(child, deep=deep) + for child in node.value] + + def construct_mapping(self, node, deep=False): + if not isinstance(node, MappingNode): + raise ConstructorError(None, None, + "expected a mapping node, but found %s" % node.id, + node.start_mark) + mapping = {} + for key_node, value_node in node.value: + key = self.construct_object(key_node, deep=deep) + if not isinstance(key, collections.abc.Hashable): + raise ConstructorError("while constructing a mapping", node.start_mark, + "found unhashable key", key_node.start_mark) + value = self.construct_object(value_node, deep=deep) + mapping[key] = value + return mapping + + def construct_pairs(self, node, deep=False): + if not isinstance(node, MappingNode): + raise ConstructorError(None, None, + "expected a mapping node, but found %s" % node.id, + node.start_mark) + pairs = [] + for key_node, value_node in node.value: + key = self.construct_object(key_node, deep=deep) + value = self.construct_object(value_node, deep=deep) + pairs.append((key, value)) + return pairs + + @classmethod + def add_constructor(cls, tag, constructor): + if not 'yaml_constructors' in cls.__dict__: + cls.yaml_constructors = cls.yaml_constructors.copy() + cls.yaml_constructors[tag] = constructor + + @classmethod + def add_multi_constructor(cls, tag_prefix, multi_constructor): + if not 'yaml_multi_constructors' in cls.__dict__: + cls.yaml_multi_constructors = cls.yaml_multi_constructors.copy() + cls.yaml_multi_constructors[tag_prefix] = multi_constructor + +class SafeConstructor(BaseConstructor): + + def construct_scalar(self, node): + if isinstance(node, MappingNode): + for key_node, value_node in node.value: + if key_node.tag == 'tag:yaml.org,2002:value': + return self.construct_scalar(value_node) + return super().construct_scalar(node) + + def flatten_mapping(self, node): + merge = [] + index = 0 + while index < len(node.value): + key_node, value_node = node.value[index] + if key_node.tag == 'tag:yaml.org,2002:merge': + del node.value[index] + if isinstance(value_node, MappingNode): + self.flatten_mapping(value_node) + merge.extend(value_node.value) + elif isinstance(value_node, SequenceNode): + submerge = [] + for subnode in value_node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError("while constructing a mapping", + node.start_mark, + "expected a mapping for merging, but found %s" + % subnode.id, subnode.start_mark) + self.flatten_mapping(subnode) + submerge.append(subnode.value) + submerge.reverse() + for value in submerge: + merge.extend(value) + else: + raise ConstructorError("while constructing a mapping", node.start_mark, + "expected a mapping or list of mappings for merging, but found %s" + % value_node.id, value_node.start_mark) + elif key_node.tag == 'tag:yaml.org,2002:value': + key_node.tag = 'tag:yaml.org,2002:str' + index += 1 + else: + index += 1 + if merge: + node.value = merge + node.value + + def construct_mapping(self, node, deep=False): + if isinstance(node, MappingNode): + self.flatten_mapping(node) + return super().construct_mapping(node, deep=deep) + + def construct_yaml_null(self, node): + self.construct_scalar(node) + return None + + bool_values = { + 'yes': True, + 'no': False, + 'true': True, + 'false': False, + 'on': True, + 'off': False, + } + + def construct_yaml_bool(self, node): + value = self.construct_scalar(node) + return self.bool_values[value.lower()] + + def construct_yaml_int(self, node): + value = self.construct_scalar(node) + value = value.replace('_', '') + sign = +1 + if value[0] == '-': + sign = -1 + if value[0] in '+-': + value = value[1:] + if value == '0': + return 0 + elif value.startswith('0b'): + return sign*int(value[2:], 2) + elif value.startswith('0x'): + return sign*int(value[2:], 16) + elif value[0] == '0': + return sign*int(value, 8) + elif ':' in value: + digits = [int(part) for part in value.split(':')] + digits.reverse() + base = 1 + value = 0 + for digit in digits: + value += digit*base + base *= 60 + return sign*value + else: + return sign*int(value) + + inf_value = 1e300 + while inf_value != inf_value*inf_value: + inf_value *= inf_value + nan_value = -inf_value/inf_value # Trying to make a quiet NaN (like C99). + + def construct_yaml_float(self, node): + value = self.construct_scalar(node) + value = value.replace('_', '').lower() + sign = +1 + if value[0] == '-': + sign = -1 + if value[0] in '+-': + value = value[1:] + if value == '.inf': + return sign*self.inf_value + elif value == '.nan': + return self.nan_value + elif ':' in value: + digits = [float(part) for part in value.split(':')] + digits.reverse() + base = 1 + value = 0.0 + for digit in digits: + value += digit*base + base *= 60 + return sign*value + else: + return sign*float(value) + + def construct_yaml_binary(self, node): + try: + value = self.construct_scalar(node).encode('ascii') + except UnicodeEncodeError as exc: + raise ConstructorError(None, None, + "failed to convert base64 data into ascii: %s" % exc, + node.start_mark) + try: + if hasattr(base64, 'decodebytes'): + return base64.decodebytes(value) + else: + return base64.decodestring(value) + except binascii.Error as exc: + raise ConstructorError(None, None, + "failed to decode base64 data: %s" % exc, node.start_mark) + + timestamp_regexp = re.compile( + r'''^(?P[0-9][0-9][0-9][0-9]) + -(?P[0-9][0-9]?) + -(?P[0-9][0-9]?) + (?:(?:[Tt]|[ \t]+) + (?P[0-9][0-9]?) + :(?P[0-9][0-9]) + :(?P[0-9][0-9]) + (?:\.(?P[0-9]*))? + (?:[ \t]*(?PZ|(?P[-+])(?P[0-9][0-9]?) + (?::(?P[0-9][0-9]))?))?)?$''', re.X) + + def construct_yaml_timestamp(self, node): + value = self.construct_scalar(node) + match = self.timestamp_regexp.match(node.value) + values = match.groupdict() + year = int(values['year']) + month = int(values['month']) + day = int(values['day']) + if not values['hour']: + return datetime.date(year, month, day) + hour = int(values['hour']) + minute = int(values['minute']) + second = int(values['second']) + fraction = 0 + tzinfo = None + if values['fraction']: + fraction = values['fraction'][:6] + while len(fraction) < 6: + fraction += '0' + fraction = int(fraction) + if values['tz_sign']: + tz_hour = int(values['tz_hour']) + tz_minute = int(values['tz_minute'] or 0) + delta = datetime.timedelta(hours=tz_hour, minutes=tz_minute) + if values['tz_sign'] == '-': + delta = -delta + tzinfo = datetime.timezone(delta) + elif values['tz']: + tzinfo = datetime.timezone.utc + return datetime.datetime(year, month, day, hour, minute, second, fraction, + tzinfo=tzinfo) + + def construct_yaml_omap(self, node): + # Note: we do not check for duplicate keys, because it's too + # CPU-expensive. + omap = [] + yield omap + if not isinstance(node, SequenceNode): + raise ConstructorError("while constructing an ordered map", node.start_mark, + "expected a sequence, but found %s" % node.id, node.start_mark) + for subnode in node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError("while constructing an ordered map", node.start_mark, + "expected a mapping of length 1, but found %s" % subnode.id, + subnode.start_mark) + if len(subnode.value) != 1: + raise ConstructorError("while constructing an ordered map", node.start_mark, + "expected a single mapping item, but found %d items" % len(subnode.value), + subnode.start_mark) + key_node, value_node = subnode.value[0] + key = self.construct_object(key_node) + value = self.construct_object(value_node) + omap.append((key, value)) + + def construct_yaml_pairs(self, node): + # Note: the same code as `construct_yaml_omap`. + pairs = [] + yield pairs + if not isinstance(node, SequenceNode): + raise ConstructorError("while constructing pairs", node.start_mark, + "expected a sequence, but found %s" % node.id, node.start_mark) + for subnode in node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError("while constructing pairs", node.start_mark, + "expected a mapping of length 1, but found %s" % subnode.id, + subnode.start_mark) + if len(subnode.value) != 1: + raise ConstructorError("while constructing pairs", node.start_mark, + "expected a single mapping item, but found %d items" % len(subnode.value), + subnode.start_mark) + key_node, value_node = subnode.value[0] + key = self.construct_object(key_node) + value = self.construct_object(value_node) + pairs.append((key, value)) + + def construct_yaml_set(self, node): + data = set() + yield data + value = self.construct_mapping(node) + data.update(value) + + def construct_yaml_str(self, node): + return self.construct_scalar(node) + + def construct_yaml_seq(self, node): + data = [] + yield data + data.extend(self.construct_sequence(node)) + + def construct_yaml_map(self, node): + data = {} + yield data + value = self.construct_mapping(node) + data.update(value) + + def construct_yaml_object(self, node, cls): + data = cls.__new__(cls) + yield data + if hasattr(data, '__setstate__'): + state = self.construct_mapping(node, deep=True) + data.__setstate__(state) + else: + state = self.construct_mapping(node) + data.__dict__.update(state) + + def construct_undefined(self, node): + raise ConstructorError(None, None, + "could not determine a constructor for the tag %r" % node.tag, + node.start_mark) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:null', + SafeConstructor.construct_yaml_null) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:bool', + SafeConstructor.construct_yaml_bool) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:int', + SafeConstructor.construct_yaml_int) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:float', + SafeConstructor.construct_yaml_float) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:binary', + SafeConstructor.construct_yaml_binary) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:timestamp', + SafeConstructor.construct_yaml_timestamp) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:omap', + SafeConstructor.construct_yaml_omap) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:pairs', + SafeConstructor.construct_yaml_pairs) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:set', + SafeConstructor.construct_yaml_set) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:str', + SafeConstructor.construct_yaml_str) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:seq', + SafeConstructor.construct_yaml_seq) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:map', + SafeConstructor.construct_yaml_map) + +SafeConstructor.add_constructor(None, + SafeConstructor.construct_undefined) + +class FullConstructor(SafeConstructor): + # 'extend' is blacklisted because it is used by + # construct_python_object_apply to add `listitems` to a newly generate + # python instance + def get_state_keys_blacklist(self): + return ['^extend$', '^__.*__$'] + + def get_state_keys_blacklist_regexp(self): + if not hasattr(self, 'state_keys_blacklist_regexp'): + self.state_keys_blacklist_regexp = re.compile('(' + '|'.join(self.get_state_keys_blacklist()) + ')') + return self.state_keys_blacklist_regexp + + def construct_python_str(self, node): + return self.construct_scalar(node) + + def construct_python_unicode(self, node): + return self.construct_scalar(node) + + def construct_python_bytes(self, node): + try: + value = self.construct_scalar(node).encode('ascii') + except UnicodeEncodeError as exc: + raise ConstructorError(None, None, + "failed to convert base64 data into ascii: %s" % exc, + node.start_mark) + try: + if hasattr(base64, 'decodebytes'): + return base64.decodebytes(value) + else: + return base64.decodestring(value) + except binascii.Error as exc: + raise ConstructorError(None, None, + "failed to decode base64 data: %s" % exc, node.start_mark) + + def construct_python_long(self, node): + return self.construct_yaml_int(node) + + def construct_python_complex(self, node): + return complex(self.construct_scalar(node)) + + def construct_python_tuple(self, node): + return tuple(self.construct_sequence(node)) + + def find_python_module(self, name, mark, unsafe=False): + if not name: + raise ConstructorError("while constructing a Python module", mark, + "expected non-empty name appended to the tag", mark) + if unsafe: + try: + __import__(name) + except ImportError as exc: + raise ConstructorError("while constructing a Python module", mark, + "cannot find module %r (%s)" % (name, exc), mark) + if name not in sys.modules: + raise ConstructorError("while constructing a Python module", mark, + "module %r is not imported" % name, mark) + return sys.modules[name] + + def find_python_name(self, name, mark, unsafe=False): + if not name: + raise ConstructorError("while constructing a Python object", mark, + "expected non-empty name appended to the tag", mark) + if '.' in name: + module_name, object_name = name.rsplit('.', 1) + else: + module_name = 'builtins' + object_name = name + if unsafe: + try: + __import__(module_name) + except ImportError as exc: + raise ConstructorError("while constructing a Python object", mark, + "cannot find module %r (%s)" % (module_name, exc), mark) + if module_name not in sys.modules: + raise ConstructorError("while constructing a Python object", mark, + "module %r is not imported" % module_name, mark) + module = sys.modules[module_name] + if not hasattr(module, object_name): + raise ConstructorError("while constructing a Python object", mark, + "cannot find %r in the module %r" + % (object_name, module.__name__), mark) + return getattr(module, object_name) + + def construct_python_name(self, suffix, node): + value = self.construct_scalar(node) + if value: + raise ConstructorError("while constructing a Python name", node.start_mark, + "expected the empty value, but found %r" % value, node.start_mark) + return self.find_python_name(suffix, node.start_mark) + + def construct_python_module(self, suffix, node): + value = self.construct_scalar(node) + if value: + raise ConstructorError("while constructing a Python module", node.start_mark, + "expected the empty value, but found %r" % value, node.start_mark) + return self.find_python_module(suffix, node.start_mark) + + def make_python_instance(self, suffix, node, + args=None, kwds=None, newobj=False, unsafe=False): + if not args: + args = [] + if not kwds: + kwds = {} + cls = self.find_python_name(suffix, node.start_mark) + if not (unsafe or isinstance(cls, type)): + raise ConstructorError("while constructing a Python instance", node.start_mark, + "expected a class, but found %r" % type(cls), + node.start_mark) + if newobj and isinstance(cls, type): + return cls.__new__(cls, *args, **kwds) + else: + return cls(*args, **kwds) + + def set_python_instance_state(self, instance, state, unsafe=False): + if hasattr(instance, '__setstate__'): + instance.__setstate__(state) + else: + slotstate = {} + if isinstance(state, tuple) and len(state) == 2: + state, slotstate = state + if hasattr(instance, '__dict__'): + if not unsafe and state: + for key in state.keys(): + self.check_state_key(key) + instance.__dict__.update(state) + elif state: + slotstate.update(state) + for key, value in slotstate.items(): + if not unsafe: + self.check_state_key(key) + setattr(instance, key, value) + + def construct_python_object(self, suffix, node): + # Format: + # !!python/object:module.name { ... state ... } + instance = self.make_python_instance(suffix, node, newobj=True) + yield instance + deep = hasattr(instance, '__setstate__') + state = self.construct_mapping(node, deep=deep) + self.set_python_instance_state(instance, state) + + def construct_python_object_apply(self, suffix, node, newobj=False): + # Format: + # !!python/object/apply # (or !!python/object/new) + # args: [ ... arguments ... ] + # kwds: { ... keywords ... } + # state: ... state ... + # listitems: [ ... listitems ... ] + # dictitems: { ... dictitems ... } + # or short format: + # !!python/object/apply [ ... arguments ... ] + # The difference between !!python/object/apply and !!python/object/new + # is how an object is created, check make_python_instance for details. + if isinstance(node, SequenceNode): + args = self.construct_sequence(node, deep=True) + kwds = {} + state = {} + listitems = [] + dictitems = {} + else: + value = self.construct_mapping(node, deep=True) + args = value.get('args', []) + kwds = value.get('kwds', {}) + state = value.get('state', {}) + listitems = value.get('listitems', []) + dictitems = value.get('dictitems', {}) + instance = self.make_python_instance(suffix, node, args, kwds, newobj) + if state: + self.set_python_instance_state(instance, state) + if listitems: + instance.extend(listitems) + if dictitems: + for key in dictitems: + instance[key] = dictitems[key] + return instance + + def construct_python_object_new(self, suffix, node): + return self.construct_python_object_apply(suffix, node, newobj=True) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/none', + FullConstructor.construct_yaml_null) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/bool', + FullConstructor.construct_yaml_bool) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/str', + FullConstructor.construct_python_str) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/unicode', + FullConstructor.construct_python_unicode) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/bytes', + FullConstructor.construct_python_bytes) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/int', + FullConstructor.construct_yaml_int) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/long', + FullConstructor.construct_python_long) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/float', + FullConstructor.construct_yaml_float) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/complex', + FullConstructor.construct_python_complex) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/list', + FullConstructor.construct_yaml_seq) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/tuple', + FullConstructor.construct_python_tuple) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/dict', + FullConstructor.construct_yaml_map) + +FullConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/name:', + FullConstructor.construct_python_name) + +class UnsafeConstructor(FullConstructor): + + def find_python_module(self, name, mark): + return super(UnsafeConstructor, self).find_python_module(name, mark, unsafe=True) + + def find_python_name(self, name, mark): + return super(UnsafeConstructor, self).find_python_name(name, mark, unsafe=True) + + def make_python_instance(self, suffix, node, args=None, kwds=None, newobj=False): + return super(UnsafeConstructor, self).make_python_instance( + suffix, node, args, kwds, newobj, unsafe=True) + + def set_python_instance_state(self, instance, state): + return super(UnsafeConstructor, self).set_python_instance_state( + instance, state, unsafe=True) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/module:', + UnsafeConstructor.construct_python_module) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object:', + UnsafeConstructor.construct_python_object) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object/new:', + UnsafeConstructor.construct_python_object_new) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object/apply:', + UnsafeConstructor.construct_python_object_apply) + +# Constructor is same as UnsafeConstructor. Need to leave this in place in case +# people have extended it directly. +class Constructor(UnsafeConstructor): + pass diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/cyaml.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/cyaml.py new file mode 100644 index 0000000000000000000000000000000000000000..0c21345879b298bb8668201bebe7d289586b17f9 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/cyaml.py @@ -0,0 +1,101 @@ + +__all__ = [ + 'CBaseLoader', 'CSafeLoader', 'CFullLoader', 'CUnsafeLoader', 'CLoader', + 'CBaseDumper', 'CSafeDumper', 'CDumper' +] + +from yaml._yaml import CParser, CEmitter + +from .constructor import * + +from .serializer import * +from .representer import * + +from .resolver import * + +class CBaseLoader(CParser, BaseConstructor, BaseResolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + BaseConstructor.__init__(self) + BaseResolver.__init__(self) + +class CSafeLoader(CParser, SafeConstructor, Resolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + SafeConstructor.__init__(self) + Resolver.__init__(self) + +class CFullLoader(CParser, FullConstructor, Resolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + FullConstructor.__init__(self) + Resolver.__init__(self) + +class CUnsafeLoader(CParser, UnsafeConstructor, Resolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + UnsafeConstructor.__init__(self) + Resolver.__init__(self) + +class CLoader(CParser, Constructor, Resolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + Constructor.__init__(self) + Resolver.__init__(self) + +class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + CEmitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, encoding=encoding, + allow_unicode=allow_unicode, line_break=line_break, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + Representer.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + +class CSafeDumper(CEmitter, SafeRepresenter, Resolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + CEmitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, encoding=encoding, + allow_unicode=allow_unicode, line_break=line_break, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + SafeRepresenter.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + +class CDumper(CEmitter, Serializer, Representer, Resolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + CEmitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, encoding=encoding, + allow_unicode=allow_unicode, line_break=line_break, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + Representer.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/dumper.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/dumper.py new file mode 100644 index 0000000000000000000000000000000000000000..6aadba551f3836b02f4752277f4b3027073defad --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/dumper.py @@ -0,0 +1,62 @@ + +__all__ = ['BaseDumper', 'SafeDumper', 'Dumper'] + +from .emitter import * +from .serializer import * +from .representer import * +from .resolver import * + +class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + Emitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break) + Serializer.__init__(self, encoding=encoding, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + Representer.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + +class SafeDumper(Emitter, Serializer, SafeRepresenter, Resolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + Emitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break) + Serializer.__init__(self, encoding=encoding, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + SafeRepresenter.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + +class Dumper(Emitter, Serializer, Representer, Resolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + Emitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break) + Serializer.__init__(self, encoding=encoding, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + Representer.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/emitter.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/emitter.py new file mode 100644 index 0000000000000000000000000000000000000000..a664d011162af69184df2f8e59ab7feec818f7c7 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/emitter.py @@ -0,0 +1,1137 @@ + +# Emitter expects events obeying the following grammar: +# stream ::= STREAM-START document* STREAM-END +# document ::= DOCUMENT-START node DOCUMENT-END +# node ::= SCALAR | sequence | mapping +# sequence ::= SEQUENCE-START node* SEQUENCE-END +# mapping ::= MAPPING-START (node node)* MAPPING-END + +__all__ = ['Emitter', 'EmitterError'] + +from .error import YAMLError +from .events import * + +class EmitterError(YAMLError): + pass + +class ScalarAnalysis: + def __init__(self, scalar, empty, multiline, + allow_flow_plain, allow_block_plain, + allow_single_quoted, allow_double_quoted, + allow_block): + self.scalar = scalar + self.empty = empty + self.multiline = multiline + self.allow_flow_plain = allow_flow_plain + self.allow_block_plain = allow_block_plain + self.allow_single_quoted = allow_single_quoted + self.allow_double_quoted = allow_double_quoted + self.allow_block = allow_block + +class Emitter: + + DEFAULT_TAG_PREFIXES = { + '!' : '!', + 'tag:yaml.org,2002:' : '!!', + } + + def __init__(self, stream, canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None): + + # The stream should have the methods `write` and possibly `flush`. + self.stream = stream + + # Encoding can be overridden by STREAM-START. + self.encoding = None + + # Emitter is a state machine with a stack of states to handle nested + # structures. + self.states = [] + self.state = self.expect_stream_start + + # Current event and the event queue. + self.events = [] + self.event = None + + # The current indentation level and the stack of previous indents. + self.indents = [] + self.indent = None + + # Flow level. + self.flow_level = 0 + + # Contexts. + self.root_context = False + self.sequence_context = False + self.mapping_context = False + self.simple_key_context = False + + # Characteristics of the last emitted character: + # - current position. + # - is it a whitespace? + # - is it an indention character + # (indentation space, '-', '?', or ':')? + self.line = 0 + self.column = 0 + self.whitespace = True + self.indention = True + + # Whether the document requires an explicit document indicator + self.open_ended = False + + # Formatting details. + self.canonical = canonical + self.allow_unicode = allow_unicode + self.best_indent = 2 + if indent and 1 < indent < 10: + self.best_indent = indent + self.best_width = 80 + if width and width > self.best_indent*2: + self.best_width = width + self.best_line_break = '\n' + if line_break in ['\r', '\n', '\r\n']: + self.best_line_break = line_break + + # Tag prefixes. + self.tag_prefixes = None + + # Prepared anchor and tag. + self.prepared_anchor = None + self.prepared_tag = None + + # Scalar analysis and style. + self.analysis = None + self.style = None + + def dispose(self): + # Reset the state attributes (to clear self-references) + self.states = [] + self.state = None + + def emit(self, event): + self.events.append(event) + while not self.need_more_events(): + self.event = self.events.pop(0) + self.state() + self.event = None + + # In some cases, we wait for a few next events before emitting. + + def need_more_events(self): + if not self.events: + return True + event = self.events[0] + if isinstance(event, DocumentStartEvent): + return self.need_events(1) + elif isinstance(event, SequenceStartEvent): + return self.need_events(2) + elif isinstance(event, MappingStartEvent): + return self.need_events(3) + else: + return False + + def need_events(self, count): + level = 0 + for event in self.events[1:]: + if isinstance(event, (DocumentStartEvent, CollectionStartEvent)): + level += 1 + elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)): + level -= 1 + elif isinstance(event, StreamEndEvent): + level = -1 + if level < 0: + return False + return (len(self.events) < count+1) + + def increase_indent(self, flow=False, indentless=False): + self.indents.append(self.indent) + if self.indent is None: + if flow: + self.indent = self.best_indent + else: + self.indent = 0 + elif not indentless: + self.indent += self.best_indent + + # States. + + # Stream handlers. + + def expect_stream_start(self): + if isinstance(self.event, StreamStartEvent): + if self.event.encoding and not hasattr(self.stream, 'encoding'): + self.encoding = self.event.encoding + self.write_stream_start() + self.state = self.expect_first_document_start + else: + raise EmitterError("expected StreamStartEvent, but got %s" + % self.event) + + def expect_nothing(self): + raise EmitterError("expected nothing, but got %s" % self.event) + + # Document handlers. + + def expect_first_document_start(self): + return self.expect_document_start(first=True) + + def expect_document_start(self, first=False): + if isinstance(self.event, DocumentStartEvent): + if (self.event.version or self.event.tags) and self.open_ended: + self.write_indicator('...', True) + self.write_indent() + if self.event.version: + version_text = self.prepare_version(self.event.version) + self.write_version_directive(version_text) + self.tag_prefixes = self.DEFAULT_TAG_PREFIXES.copy() + if self.event.tags: + handles = sorted(self.event.tags.keys()) + for handle in handles: + prefix = self.event.tags[handle] + self.tag_prefixes[prefix] = handle + handle_text = self.prepare_tag_handle(handle) + prefix_text = self.prepare_tag_prefix(prefix) + self.write_tag_directive(handle_text, prefix_text) + implicit = (first and not self.event.explicit and not self.canonical + and not self.event.version and not self.event.tags + and not self.check_empty_document()) + if not implicit: + self.write_indent() + self.write_indicator('---', True) + if self.canonical: + self.write_indent() + self.state = self.expect_document_root + elif isinstance(self.event, StreamEndEvent): + if self.open_ended: + self.write_indicator('...', True) + self.write_indent() + self.write_stream_end() + self.state = self.expect_nothing + else: + raise EmitterError("expected DocumentStartEvent, but got %s" + % self.event) + + def expect_document_end(self): + if isinstance(self.event, DocumentEndEvent): + self.write_indent() + if self.event.explicit: + self.write_indicator('...', True) + self.write_indent() + self.flush_stream() + self.state = self.expect_document_start + else: + raise EmitterError("expected DocumentEndEvent, but got %s" + % self.event) + + def expect_document_root(self): + self.states.append(self.expect_document_end) + self.expect_node(root=True) + + # Node handlers. + + def expect_node(self, root=False, sequence=False, mapping=False, + simple_key=False): + self.root_context = root + self.sequence_context = sequence + self.mapping_context = mapping + self.simple_key_context = simple_key + if isinstance(self.event, AliasEvent): + self.expect_alias() + elif isinstance(self.event, (ScalarEvent, CollectionStartEvent)): + self.process_anchor('&') + self.process_tag() + if isinstance(self.event, ScalarEvent): + self.expect_scalar() + elif isinstance(self.event, SequenceStartEvent): + if self.flow_level or self.canonical or self.event.flow_style \ + or self.check_empty_sequence(): + self.expect_flow_sequence() + else: + self.expect_block_sequence() + elif isinstance(self.event, MappingStartEvent): + if self.flow_level or self.canonical or self.event.flow_style \ + or self.check_empty_mapping(): + self.expect_flow_mapping() + else: + self.expect_block_mapping() + else: + raise EmitterError("expected NodeEvent, but got %s" % self.event) + + def expect_alias(self): + if self.event.anchor is None: + raise EmitterError("anchor is not specified for alias") + self.process_anchor('*') + self.state = self.states.pop() + + def expect_scalar(self): + self.increase_indent(flow=True) + self.process_scalar() + self.indent = self.indents.pop() + self.state = self.states.pop() + + # Flow sequence handlers. + + def expect_flow_sequence(self): + self.write_indicator('[', True, whitespace=True) + self.flow_level += 1 + self.increase_indent(flow=True) + self.state = self.expect_first_flow_sequence_item + + def expect_first_flow_sequence_item(self): + if isinstance(self.event, SequenceEndEvent): + self.indent = self.indents.pop() + self.flow_level -= 1 + self.write_indicator(']', False) + self.state = self.states.pop() + else: + if self.canonical or self.column > self.best_width: + self.write_indent() + self.states.append(self.expect_flow_sequence_item) + self.expect_node(sequence=True) + + def expect_flow_sequence_item(self): + if isinstance(self.event, SequenceEndEvent): + self.indent = self.indents.pop() + self.flow_level -= 1 + if self.canonical: + self.write_indicator(',', False) + self.write_indent() + self.write_indicator(']', False) + self.state = self.states.pop() + else: + self.write_indicator(',', False) + if self.canonical or self.column > self.best_width: + self.write_indent() + self.states.append(self.expect_flow_sequence_item) + self.expect_node(sequence=True) + + # Flow mapping handlers. + + def expect_flow_mapping(self): + self.write_indicator('{', True, whitespace=True) + self.flow_level += 1 + self.increase_indent(flow=True) + self.state = self.expect_first_flow_mapping_key + + def expect_first_flow_mapping_key(self): + if isinstance(self.event, MappingEndEvent): + self.indent = self.indents.pop() + self.flow_level -= 1 + self.write_indicator('}', False) + self.state = self.states.pop() + else: + if self.canonical or self.column > self.best_width: + self.write_indent() + if not self.canonical and self.check_simple_key(): + self.states.append(self.expect_flow_mapping_simple_value) + self.expect_node(mapping=True, simple_key=True) + else: + self.write_indicator('?', True) + self.states.append(self.expect_flow_mapping_value) + self.expect_node(mapping=True) + + def expect_flow_mapping_key(self): + if isinstance(self.event, MappingEndEvent): + self.indent = self.indents.pop() + self.flow_level -= 1 + if self.canonical: + self.write_indicator(',', False) + self.write_indent() + self.write_indicator('}', False) + self.state = self.states.pop() + else: + self.write_indicator(',', False) + if self.canonical or self.column > self.best_width: + self.write_indent() + if not self.canonical and self.check_simple_key(): + self.states.append(self.expect_flow_mapping_simple_value) + self.expect_node(mapping=True, simple_key=True) + else: + self.write_indicator('?', True) + self.states.append(self.expect_flow_mapping_value) + self.expect_node(mapping=True) + + def expect_flow_mapping_simple_value(self): + self.write_indicator(':', False) + self.states.append(self.expect_flow_mapping_key) + self.expect_node(mapping=True) + + def expect_flow_mapping_value(self): + if self.canonical or self.column > self.best_width: + self.write_indent() + self.write_indicator(':', True) + self.states.append(self.expect_flow_mapping_key) + self.expect_node(mapping=True) + + # Block sequence handlers. + + def expect_block_sequence(self): + indentless = (self.mapping_context and not self.indention) + self.increase_indent(flow=False, indentless=indentless) + self.state = self.expect_first_block_sequence_item + + def expect_first_block_sequence_item(self): + return self.expect_block_sequence_item(first=True) + + def expect_block_sequence_item(self, first=False): + if not first and isinstance(self.event, SequenceEndEvent): + self.indent = self.indents.pop() + self.state = self.states.pop() + else: + self.write_indent() + self.write_indicator('-', True, indention=True) + self.states.append(self.expect_block_sequence_item) + self.expect_node(sequence=True) + + # Block mapping handlers. + + def expect_block_mapping(self): + self.increase_indent(flow=False) + self.state = self.expect_first_block_mapping_key + + def expect_first_block_mapping_key(self): + return self.expect_block_mapping_key(first=True) + + def expect_block_mapping_key(self, first=False): + if not first and isinstance(self.event, MappingEndEvent): + self.indent = self.indents.pop() + self.state = self.states.pop() + else: + self.write_indent() + if self.check_simple_key(): + self.states.append(self.expect_block_mapping_simple_value) + self.expect_node(mapping=True, simple_key=True) + else: + self.write_indicator('?', True, indention=True) + self.states.append(self.expect_block_mapping_value) + self.expect_node(mapping=True) + + def expect_block_mapping_simple_value(self): + self.write_indicator(':', False) + self.states.append(self.expect_block_mapping_key) + self.expect_node(mapping=True) + + def expect_block_mapping_value(self): + self.write_indent() + self.write_indicator(':', True, indention=True) + self.states.append(self.expect_block_mapping_key) + self.expect_node(mapping=True) + + # Checkers. + + def check_empty_sequence(self): + return (isinstance(self.event, SequenceStartEvent) and self.events + and isinstance(self.events[0], SequenceEndEvent)) + + def check_empty_mapping(self): + return (isinstance(self.event, MappingStartEvent) and self.events + and isinstance(self.events[0], MappingEndEvent)) + + def check_empty_document(self): + if not isinstance(self.event, DocumentStartEvent) or not self.events: + return False + event = self.events[0] + return (isinstance(event, ScalarEvent) and event.anchor is None + and event.tag is None and event.implicit and event.value == '') + + def check_simple_key(self): + length = 0 + if isinstance(self.event, NodeEvent) and self.event.anchor is not None: + if self.prepared_anchor is None: + self.prepared_anchor = self.prepare_anchor(self.event.anchor) + length += len(self.prepared_anchor) + if isinstance(self.event, (ScalarEvent, CollectionStartEvent)) \ + and self.event.tag is not None: + if self.prepared_tag is None: + self.prepared_tag = self.prepare_tag(self.event.tag) + length += len(self.prepared_tag) + if isinstance(self.event, ScalarEvent): + if self.analysis is None: + self.analysis = self.analyze_scalar(self.event.value) + length += len(self.analysis.scalar) + return (length < 128 and (isinstance(self.event, AliasEvent) + or (isinstance(self.event, ScalarEvent) + and not self.analysis.empty and not self.analysis.multiline) + or self.check_empty_sequence() or self.check_empty_mapping())) + + # Anchor, Tag, and Scalar processors. + + def process_anchor(self, indicator): + if self.event.anchor is None: + self.prepared_anchor = None + return + if self.prepared_anchor is None: + self.prepared_anchor = self.prepare_anchor(self.event.anchor) + if self.prepared_anchor: + self.write_indicator(indicator+self.prepared_anchor, True) + self.prepared_anchor = None + + def process_tag(self): + tag = self.event.tag + if isinstance(self.event, ScalarEvent): + if self.style is None: + self.style = self.choose_scalar_style() + if ((not self.canonical or tag is None) and + ((self.style == '' and self.event.implicit[0]) + or (self.style != '' and self.event.implicit[1]))): + self.prepared_tag = None + return + if self.event.implicit[0] and tag is None: + tag = '!' + self.prepared_tag = None + else: + if (not self.canonical or tag is None) and self.event.implicit: + self.prepared_tag = None + return + if tag is None: + raise EmitterError("tag is not specified") + if self.prepared_tag is None: + self.prepared_tag = self.prepare_tag(tag) + if self.prepared_tag: + self.write_indicator(self.prepared_tag, True) + self.prepared_tag = None + + def choose_scalar_style(self): + if self.analysis is None: + self.analysis = self.analyze_scalar(self.event.value) + if self.event.style == '"' or self.canonical: + return '"' + if not self.event.style and self.event.implicit[0]: + if (not (self.simple_key_context and + (self.analysis.empty or self.analysis.multiline)) + and (self.flow_level and self.analysis.allow_flow_plain + or (not self.flow_level and self.analysis.allow_block_plain))): + return '' + if self.event.style and self.event.style in '|>': + if (not self.flow_level and not self.simple_key_context + and self.analysis.allow_block): + return self.event.style + if not self.event.style or self.event.style == '\'': + if (self.analysis.allow_single_quoted and + not (self.simple_key_context and self.analysis.multiline)): + return '\'' + return '"' + + def process_scalar(self): + if self.analysis is None: + self.analysis = self.analyze_scalar(self.event.value) + if self.style is None: + self.style = self.choose_scalar_style() + split = (not self.simple_key_context) + #if self.analysis.multiline and split \ + # and (not self.style or self.style in '\'\"'): + # self.write_indent() + if self.style == '"': + self.write_double_quoted(self.analysis.scalar, split) + elif self.style == '\'': + self.write_single_quoted(self.analysis.scalar, split) + elif self.style == '>': + self.write_folded(self.analysis.scalar) + elif self.style == '|': + self.write_literal(self.analysis.scalar) + else: + self.write_plain(self.analysis.scalar, split) + self.analysis = None + self.style = None + + # Analyzers. + + def prepare_version(self, version): + major, minor = version + if major != 1: + raise EmitterError("unsupported YAML version: %d.%d" % (major, minor)) + return '%d.%d' % (major, minor) + + def prepare_tag_handle(self, handle): + if not handle: + raise EmitterError("tag handle must not be empty") + if handle[0] != '!' or handle[-1] != '!': + raise EmitterError("tag handle must start and end with '!': %r" % handle) + for ch in handle[1:-1]: + if not ('0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_'): + raise EmitterError("invalid character %r in the tag handle: %r" + % (ch, handle)) + return handle + + def prepare_tag_prefix(self, prefix): + if not prefix: + raise EmitterError("tag prefix must not be empty") + chunks = [] + start = end = 0 + if prefix[0] == '!': + end = 1 + while end < len(prefix): + ch = prefix[end] + if '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-;/?!:@&=+$,_.~*\'()[]': + end += 1 + else: + if start < end: + chunks.append(prefix[start:end]) + start = end = end+1 + data = ch.encode('utf-8') + for ch in data: + chunks.append('%%%02X' % ord(ch)) + if start < end: + chunks.append(prefix[start:end]) + return ''.join(chunks) + + def prepare_tag(self, tag): + if not tag: + raise EmitterError("tag must not be empty") + if tag == '!': + return tag + handle = None + suffix = tag + prefixes = sorted(self.tag_prefixes.keys()) + for prefix in prefixes: + if tag.startswith(prefix) \ + and (prefix == '!' or len(prefix) < len(tag)): + handle = self.tag_prefixes[prefix] + suffix = tag[len(prefix):] + chunks = [] + start = end = 0 + while end < len(suffix): + ch = suffix[end] + if '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-;/?:@&=+$,_.~*\'()[]' \ + or (ch == '!' and handle != '!'): + end += 1 + else: + if start < end: + chunks.append(suffix[start:end]) + start = end = end+1 + data = ch.encode('utf-8') + for ch in data: + chunks.append('%%%02X' % ch) + if start < end: + chunks.append(suffix[start:end]) + suffix_text = ''.join(chunks) + if handle: + return '%s%s' % (handle, suffix_text) + else: + return '!<%s>' % suffix_text + + def prepare_anchor(self, anchor): + if not anchor: + raise EmitterError("anchor must not be empty") + for ch in anchor: + if not ('0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_'): + raise EmitterError("invalid character %r in the anchor: %r" + % (ch, anchor)) + return anchor + + def analyze_scalar(self, scalar): + + # Empty scalar is a special case. + if not scalar: + return ScalarAnalysis(scalar=scalar, empty=True, multiline=False, + allow_flow_plain=False, allow_block_plain=True, + allow_single_quoted=True, allow_double_quoted=True, + allow_block=False) + + # Indicators and special characters. + block_indicators = False + flow_indicators = False + line_breaks = False + special_characters = False + + # Important whitespace combinations. + leading_space = False + leading_break = False + trailing_space = False + trailing_break = False + break_space = False + space_break = False + + # Check document indicators. + if scalar.startswith('---') or scalar.startswith('...'): + block_indicators = True + flow_indicators = True + + # First character or preceded by a whitespace. + preceded_by_whitespace = True + + # Last character or followed by a whitespace. + followed_by_whitespace = (len(scalar) == 1 or + scalar[1] in '\0 \t\r\n\x85\u2028\u2029') + + # The previous character is a space. + previous_space = False + + # The previous character is a break. + previous_break = False + + index = 0 + while index < len(scalar): + ch = scalar[index] + + # Check for indicators. + if index == 0: + # Leading indicators are special characters. + if ch in '#,[]{}&*!|>\'\"%@`': + flow_indicators = True + block_indicators = True + if ch in '?:': + flow_indicators = True + if followed_by_whitespace: + block_indicators = True + if ch == '-' and followed_by_whitespace: + flow_indicators = True + block_indicators = True + else: + # Some indicators cannot appear within a scalar as well. + if ch in ',?[]{}': + flow_indicators = True + if ch == ':': + flow_indicators = True + if followed_by_whitespace: + block_indicators = True + if ch == '#' and preceded_by_whitespace: + flow_indicators = True + block_indicators = True + + # Check for line breaks, special, and unicode characters. + if ch in '\n\x85\u2028\u2029': + line_breaks = True + if not (ch == '\n' or '\x20' <= ch <= '\x7E'): + if (ch == '\x85' or '\xA0' <= ch <= '\uD7FF' + or '\uE000' <= ch <= '\uFFFD' + or '\U00010000' <= ch < '\U0010ffff') and ch != '\uFEFF': + unicode_characters = True + if not self.allow_unicode: + special_characters = True + else: + special_characters = True + + # Detect important whitespace combinations. + if ch == ' ': + if index == 0: + leading_space = True + if index == len(scalar)-1: + trailing_space = True + if previous_break: + break_space = True + previous_space = True + previous_break = False + elif ch in '\n\x85\u2028\u2029': + if index == 0: + leading_break = True + if index == len(scalar)-1: + trailing_break = True + if previous_space: + space_break = True + previous_space = False + previous_break = True + else: + previous_space = False + previous_break = False + + # Prepare for the next character. + index += 1 + preceded_by_whitespace = (ch in '\0 \t\r\n\x85\u2028\u2029') + followed_by_whitespace = (index+1 >= len(scalar) or + scalar[index+1] in '\0 \t\r\n\x85\u2028\u2029') + + # Let's decide what styles are allowed. + allow_flow_plain = True + allow_block_plain = True + allow_single_quoted = True + allow_double_quoted = True + allow_block = True + + # Leading and trailing whitespaces are bad for plain scalars. + if (leading_space or leading_break + or trailing_space or trailing_break): + allow_flow_plain = allow_block_plain = False + + # We do not permit trailing spaces for block scalars. + if trailing_space: + allow_block = False + + # Spaces at the beginning of a new line are only acceptable for block + # scalars. + if break_space: + allow_flow_plain = allow_block_plain = allow_single_quoted = False + + # Spaces followed by breaks, as well as special character are only + # allowed for double quoted scalars. + if space_break or special_characters: + allow_flow_plain = allow_block_plain = \ + allow_single_quoted = allow_block = False + + # Although the plain scalar writer supports breaks, we never emit + # multiline plain scalars. + if line_breaks: + allow_flow_plain = allow_block_plain = False + + # Flow indicators are forbidden for flow plain scalars. + if flow_indicators: + allow_flow_plain = False + + # Block indicators are forbidden for block plain scalars. + if block_indicators: + allow_block_plain = False + + return ScalarAnalysis(scalar=scalar, + empty=False, multiline=line_breaks, + allow_flow_plain=allow_flow_plain, + allow_block_plain=allow_block_plain, + allow_single_quoted=allow_single_quoted, + allow_double_quoted=allow_double_quoted, + allow_block=allow_block) + + # Writers. + + def flush_stream(self): + if hasattr(self.stream, 'flush'): + self.stream.flush() + + def write_stream_start(self): + # Write BOM if needed. + if self.encoding and self.encoding.startswith('utf-16'): + self.stream.write('\uFEFF'.encode(self.encoding)) + + def write_stream_end(self): + self.flush_stream() + + def write_indicator(self, indicator, need_whitespace, + whitespace=False, indention=False): + if self.whitespace or not need_whitespace: + data = indicator + else: + data = ' '+indicator + self.whitespace = whitespace + self.indention = self.indention and indention + self.column += len(data) + self.open_ended = False + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + + def write_indent(self): + indent = self.indent or 0 + if not self.indention or self.column > indent \ + or (self.column == indent and not self.whitespace): + self.write_line_break() + if self.column < indent: + self.whitespace = True + data = ' '*(indent-self.column) + self.column = indent + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + + def write_line_break(self, data=None): + if data is None: + data = self.best_line_break + self.whitespace = True + self.indention = True + self.line += 1 + self.column = 0 + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + + def write_version_directive(self, version_text): + data = '%%YAML %s' % version_text + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.write_line_break() + + def write_tag_directive(self, handle_text, prefix_text): + data = '%%TAG %s %s' % (handle_text, prefix_text) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.write_line_break() + + # Scalar streams. + + def write_single_quoted(self, text, split=True): + self.write_indicator('\'', True) + spaces = False + breaks = False + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if spaces: + if ch is None or ch != ' ': + if start+1 == end and self.column > self.best_width and split \ + and start != 0 and end != len(text): + self.write_indent() + else: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + elif breaks: + if ch is None or ch not in '\n\x85\u2028\u2029': + if text[start] == '\n': + self.write_line_break() + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + self.write_indent() + start = end + else: + if ch is None or ch in ' \n\x85\u2028\u2029' or ch == '\'': + if start < end: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + if ch == '\'': + data = '\'\'' + self.column += 2 + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + 1 + if ch is not None: + spaces = (ch == ' ') + breaks = (ch in '\n\x85\u2028\u2029') + end += 1 + self.write_indicator('\'', False) + + ESCAPE_REPLACEMENTS = { + '\0': '0', + '\x07': 'a', + '\x08': 'b', + '\x09': 't', + '\x0A': 'n', + '\x0B': 'v', + '\x0C': 'f', + '\x0D': 'r', + '\x1B': 'e', + '\"': '\"', + '\\': '\\', + '\x85': 'N', + '\xA0': '_', + '\u2028': 'L', + '\u2029': 'P', + } + + def write_double_quoted(self, text, split=True): + self.write_indicator('"', True) + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if ch is None or ch in '"\\\x85\u2028\u2029\uFEFF' \ + or not ('\x20' <= ch <= '\x7E' + or (self.allow_unicode + and ('\xA0' <= ch <= '\uD7FF' + or '\uE000' <= ch <= '\uFFFD'))): + if start < end: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + if ch is not None: + if ch in self.ESCAPE_REPLACEMENTS: + data = '\\'+self.ESCAPE_REPLACEMENTS[ch] + elif ch <= '\xFF': + data = '\\x%02X' % ord(ch) + elif ch <= '\uFFFF': + data = '\\u%04X' % ord(ch) + else: + data = '\\U%08X' % ord(ch) + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end+1 + if 0 < end < len(text)-1 and (ch == ' ' or start >= end) \ + and self.column+(end-start) > self.best_width and split: + data = text[start:end]+'\\' + if start < end: + start = end + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.write_indent() + self.whitespace = False + self.indention = False + if text[start] == ' ': + data = '\\' + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + end += 1 + self.write_indicator('"', False) + + def determine_block_hints(self, text): + hints = '' + if text: + if text[0] in ' \n\x85\u2028\u2029': + hints += str(self.best_indent) + if text[-1] not in '\n\x85\u2028\u2029': + hints += '-' + elif len(text) == 1 or text[-2] in '\n\x85\u2028\u2029': + hints += '+' + return hints + + def write_folded(self, text): + hints = self.determine_block_hints(text) + self.write_indicator('>'+hints, True) + if hints[-1:] == '+': + self.open_ended = True + self.write_line_break() + leading_space = True + spaces = False + breaks = True + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if breaks: + if ch is None or ch not in '\n\x85\u2028\u2029': + if not leading_space and ch is not None and ch != ' ' \ + and text[start] == '\n': + self.write_line_break() + leading_space = (ch == ' ') + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + if ch is not None: + self.write_indent() + start = end + elif spaces: + if ch != ' ': + if start+1 == end and self.column > self.best_width: + self.write_indent() + else: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + else: + if ch is None or ch in ' \n\x85\u2028\u2029': + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + if ch is None: + self.write_line_break() + start = end + if ch is not None: + breaks = (ch in '\n\x85\u2028\u2029') + spaces = (ch == ' ') + end += 1 + + def write_literal(self, text): + hints = self.determine_block_hints(text) + self.write_indicator('|'+hints, True) + if hints[-1:] == '+': + self.open_ended = True + self.write_line_break() + breaks = True + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if breaks: + if ch is None or ch not in '\n\x85\u2028\u2029': + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + if ch is not None: + self.write_indent() + start = end + else: + if ch is None or ch in '\n\x85\u2028\u2029': + data = text[start:end] + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + if ch is None: + self.write_line_break() + start = end + if ch is not None: + breaks = (ch in '\n\x85\u2028\u2029') + end += 1 + + def write_plain(self, text, split=True): + if self.root_context: + self.open_ended = True + if not text: + return + if not self.whitespace: + data = ' ' + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.whitespace = False + self.indention = False + spaces = False + breaks = False + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if spaces: + if ch != ' ': + if start+1 == end and self.column > self.best_width and split: + self.write_indent() + self.whitespace = False + self.indention = False + else: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + elif breaks: + if ch not in '\n\x85\u2028\u2029': + if text[start] == '\n': + self.write_line_break() + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + self.write_indent() + self.whitespace = False + self.indention = False + start = end + else: + if ch is None or ch in ' \n\x85\u2028\u2029': + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + if ch is not None: + spaces = (ch == ' ') + breaks = (ch in '\n\x85\u2028\u2029') + end += 1 diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/error.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/error.py new file mode 100644 index 0000000000000000000000000000000000000000..b796b4dc519512c4825ff539a2e6aa20f4d370d0 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/error.py @@ -0,0 +1,75 @@ + +__all__ = ['Mark', 'YAMLError', 'MarkedYAMLError'] + +class Mark: + + def __init__(self, name, index, line, column, buffer, pointer): + self.name = name + self.index = index + self.line = line + self.column = column + self.buffer = buffer + self.pointer = pointer + + def get_snippet(self, indent=4, max_length=75): + if self.buffer is None: + return None + head = '' + start = self.pointer + while start > 0 and self.buffer[start-1] not in '\0\r\n\x85\u2028\u2029': + start -= 1 + if self.pointer-start > max_length/2-1: + head = ' ... ' + start += 5 + break + tail = '' + end = self.pointer + while end < len(self.buffer) and self.buffer[end] not in '\0\r\n\x85\u2028\u2029': + end += 1 + if end-self.pointer > max_length/2-1: + tail = ' ... ' + end -= 5 + break + snippet = self.buffer[start:end] + return ' '*indent + head + snippet + tail + '\n' \ + + ' '*(indent+self.pointer-start+len(head)) + '^' + + def __str__(self): + snippet = self.get_snippet() + where = " in \"%s\", line %d, column %d" \ + % (self.name, self.line+1, self.column+1) + if snippet is not None: + where += ":\n"+snippet + return where + +class YAMLError(Exception): + pass + +class MarkedYAMLError(YAMLError): + + def __init__(self, context=None, context_mark=None, + problem=None, problem_mark=None, note=None): + self.context = context + self.context_mark = context_mark + self.problem = problem + self.problem_mark = problem_mark + self.note = note + + def __str__(self): + lines = [] + if self.context is not None: + lines.append(self.context) + if self.context_mark is not None \ + and (self.problem is None or self.problem_mark is None + or self.context_mark.name != self.problem_mark.name + or self.context_mark.line != self.problem_mark.line + or self.context_mark.column != self.problem_mark.column): + lines.append(str(self.context_mark)) + if self.problem is not None: + lines.append(self.problem) + if self.problem_mark is not None: + lines.append(str(self.problem_mark)) + if self.note is not None: + lines.append(self.note) + return '\n'.join(lines) + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/events.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/events.py new file mode 100644 index 0000000000000000000000000000000000000000..f79ad389cb6c9517e391dcd25534866bc9ccd36a --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/events.py @@ -0,0 +1,86 @@ + +# Abstract classes. + +class Event(object): + def __init__(self, start_mark=None, end_mark=None): + self.start_mark = start_mark + self.end_mark = end_mark + def __repr__(self): + attributes = [key for key in ['anchor', 'tag', 'implicit', 'value'] + if hasattr(self, key)] + arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) + for key in attributes]) + return '%s(%s)' % (self.__class__.__name__, arguments) + +class NodeEvent(Event): + def __init__(self, anchor, start_mark=None, end_mark=None): + self.anchor = anchor + self.start_mark = start_mark + self.end_mark = end_mark + +class CollectionStartEvent(NodeEvent): + def __init__(self, anchor, tag, implicit, start_mark=None, end_mark=None, + flow_style=None): + self.anchor = anchor + self.tag = tag + self.implicit = implicit + self.start_mark = start_mark + self.end_mark = end_mark + self.flow_style = flow_style + +class CollectionEndEvent(Event): + pass + +# Implementations. + +class StreamStartEvent(Event): + def __init__(self, start_mark=None, end_mark=None, encoding=None): + self.start_mark = start_mark + self.end_mark = end_mark + self.encoding = encoding + +class StreamEndEvent(Event): + pass + +class DocumentStartEvent(Event): + def __init__(self, start_mark=None, end_mark=None, + explicit=None, version=None, tags=None): + self.start_mark = start_mark + self.end_mark = end_mark + self.explicit = explicit + self.version = version + self.tags = tags + +class DocumentEndEvent(Event): + def __init__(self, start_mark=None, end_mark=None, + explicit=None): + self.start_mark = start_mark + self.end_mark = end_mark + self.explicit = explicit + +class AliasEvent(NodeEvent): + pass + +class ScalarEvent(NodeEvent): + def __init__(self, anchor, tag, implicit, value, + start_mark=None, end_mark=None, style=None): + self.anchor = anchor + self.tag = tag + self.implicit = implicit + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + self.style = style + +class SequenceStartEvent(CollectionStartEvent): + pass + +class SequenceEndEvent(CollectionEndEvent): + pass + +class MappingStartEvent(CollectionStartEvent): + pass + +class MappingEndEvent(CollectionEndEvent): + pass + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/loader.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/loader.py new file mode 100644 index 0000000000000000000000000000000000000000..e90c11224c38e559cdf0cb205f0692ebd4fb8681 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/loader.py @@ -0,0 +1,63 @@ + +__all__ = ['BaseLoader', 'FullLoader', 'SafeLoader', 'Loader', 'UnsafeLoader'] + +from .reader import * +from .scanner import * +from .parser import * +from .composer import * +from .constructor import * +from .resolver import * + +class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, BaseResolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + BaseConstructor.__init__(self) + BaseResolver.__init__(self) + +class FullLoader(Reader, Scanner, Parser, Composer, FullConstructor, Resolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + FullConstructor.__init__(self) + Resolver.__init__(self) + +class SafeLoader(Reader, Scanner, Parser, Composer, SafeConstructor, Resolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + SafeConstructor.__init__(self) + Resolver.__init__(self) + +class Loader(Reader, Scanner, Parser, Composer, Constructor, Resolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + Constructor.__init__(self) + Resolver.__init__(self) + +# UnsafeLoader is the same as Loader (which is and was always unsafe on +# untrusted input). Use of either Loader or UnsafeLoader should be rare, since +# FullLoad should be able to load almost all YAML safely. Loader is left intact +# to ensure backwards compatibility. +class UnsafeLoader(Reader, Scanner, Parser, Composer, Constructor, Resolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + Constructor.__init__(self) + Resolver.__init__(self) diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/nodes.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/nodes.py new file mode 100644 index 0000000000000000000000000000000000000000..c4f070c41e1fb1bc01af27d69329e92dded38908 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/nodes.py @@ -0,0 +1,49 @@ + +class Node(object): + def __init__(self, tag, value, start_mark, end_mark): + self.tag = tag + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + def __repr__(self): + value = self.value + #if isinstance(value, list): + # if len(value) == 0: + # value = '' + # elif len(value) == 1: + # value = '<1 item>' + # else: + # value = '<%d items>' % len(value) + #else: + # if len(value) > 75: + # value = repr(value[:70]+u' ... ') + # else: + # value = repr(value) + value = repr(value) + return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value) + +class ScalarNode(Node): + id = 'scalar' + def __init__(self, tag, value, + start_mark=None, end_mark=None, style=None): + self.tag = tag + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + self.style = style + +class CollectionNode(Node): + def __init__(self, tag, value, + start_mark=None, end_mark=None, flow_style=None): + self.tag = tag + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + self.flow_style = flow_style + +class SequenceNode(CollectionNode): + id = 'sequence' + +class MappingNode(CollectionNode): + id = 'mapping' + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/parser.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/parser.py new file mode 100644 index 0000000000000000000000000000000000000000..13a5995d292045d0f865a99abf692bd35dc87814 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/parser.py @@ -0,0 +1,589 @@ + +# The following YAML grammar is LL(1) and is parsed by a recursive descent +# parser. +# +# stream ::= STREAM-START implicit_document? explicit_document* STREAM-END +# implicit_document ::= block_node DOCUMENT-END* +# explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +# block_node_or_indentless_sequence ::= +# ALIAS +# | properties (block_content | indentless_block_sequence)? +# | block_content +# | indentless_block_sequence +# block_node ::= ALIAS +# | properties block_content? +# | block_content +# flow_node ::= ALIAS +# | properties flow_content? +# | flow_content +# properties ::= TAG ANCHOR? | ANCHOR TAG? +# block_content ::= block_collection | flow_collection | SCALAR +# flow_content ::= flow_collection | SCALAR +# block_collection ::= block_sequence | block_mapping +# flow_collection ::= flow_sequence | flow_mapping +# block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END +# indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +# block_mapping ::= BLOCK-MAPPING_START +# ((KEY block_node_or_indentless_sequence?)? +# (VALUE block_node_or_indentless_sequence?)?)* +# BLOCK-END +# flow_sequence ::= FLOW-SEQUENCE-START +# (flow_sequence_entry FLOW-ENTRY)* +# flow_sequence_entry? +# FLOW-SEQUENCE-END +# flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +# flow_mapping ::= FLOW-MAPPING-START +# (flow_mapping_entry FLOW-ENTRY)* +# flow_mapping_entry? +# FLOW-MAPPING-END +# flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +# +# FIRST sets: +# +# stream: { STREAM-START } +# explicit_document: { DIRECTIVE DOCUMENT-START } +# implicit_document: FIRST(block_node) +# block_node: { ALIAS TAG ANCHOR SCALAR BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START } +# flow_node: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START } +# block_content: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR } +# flow_content: { FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR } +# block_collection: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START } +# flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START } +# block_sequence: { BLOCK-SEQUENCE-START } +# block_mapping: { BLOCK-MAPPING-START } +# block_node_or_indentless_sequence: { ALIAS ANCHOR TAG SCALAR BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START BLOCK-ENTRY } +# indentless_sequence: { ENTRY } +# flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START } +# flow_sequence: { FLOW-SEQUENCE-START } +# flow_mapping: { FLOW-MAPPING-START } +# flow_sequence_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START KEY } +# flow_mapping_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START KEY } + +__all__ = ['Parser', 'ParserError'] + +from .error import MarkedYAMLError +from .tokens import * +from .events import * +from .scanner import * + +class ParserError(MarkedYAMLError): + pass + +class Parser: + # Since writing a recursive-descendant parser is a straightforward task, we + # do not give many comments here. + + DEFAULT_TAGS = { + '!': '!', + '!!': 'tag:yaml.org,2002:', + } + + def __init__(self): + self.current_event = None + self.yaml_version = None + self.tag_handles = {} + self.states = [] + self.marks = [] + self.state = self.parse_stream_start + + def dispose(self): + # Reset the state attributes (to clear self-references) + self.states = [] + self.state = None + + def check_event(self, *choices): + # Check the type of the next event. + if self.current_event is None: + if self.state: + self.current_event = self.state() + if self.current_event is not None: + if not choices: + return True + for choice in choices: + if isinstance(self.current_event, choice): + return True + return False + + def peek_event(self): + # Get the next event. + if self.current_event is None: + if self.state: + self.current_event = self.state() + return self.current_event + + def get_event(self): + # Get the next event and proceed further. + if self.current_event is None: + if self.state: + self.current_event = self.state() + value = self.current_event + self.current_event = None + return value + + # stream ::= STREAM-START implicit_document? explicit_document* STREAM-END + # implicit_document ::= block_node DOCUMENT-END* + # explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* + + def parse_stream_start(self): + + # Parse the stream start. + token = self.get_token() + event = StreamStartEvent(token.start_mark, token.end_mark, + encoding=token.encoding) + + # Prepare the next state. + self.state = self.parse_implicit_document_start + + return event + + def parse_implicit_document_start(self): + + # Parse an implicit document. + if not self.check_token(DirectiveToken, DocumentStartToken, + StreamEndToken): + self.tag_handles = self.DEFAULT_TAGS + token = self.peek_token() + start_mark = end_mark = token.start_mark + event = DocumentStartEvent(start_mark, end_mark, + explicit=False) + + # Prepare the next state. + self.states.append(self.parse_document_end) + self.state = self.parse_block_node + + return event + + else: + return self.parse_document_start() + + def parse_document_start(self): + + # Parse any extra document end indicators. + while self.check_token(DocumentEndToken): + self.get_token() + + # Parse an explicit document. + if not self.check_token(StreamEndToken): + token = self.peek_token() + start_mark = token.start_mark + version, tags = self.process_directives() + if not self.check_token(DocumentStartToken): + raise ParserError(None, None, + "expected '', but found %r" + % self.peek_token().id, + self.peek_token().start_mark) + token = self.get_token() + end_mark = token.end_mark + event = DocumentStartEvent(start_mark, end_mark, + explicit=True, version=version, tags=tags) + self.states.append(self.parse_document_end) + self.state = self.parse_document_content + else: + # Parse the end of the stream. + token = self.get_token() + event = StreamEndEvent(token.start_mark, token.end_mark) + assert not self.states + assert not self.marks + self.state = None + return event + + def parse_document_end(self): + + # Parse the document end. + token = self.peek_token() + start_mark = end_mark = token.start_mark + explicit = False + if self.check_token(DocumentEndToken): + token = self.get_token() + end_mark = token.end_mark + explicit = True + event = DocumentEndEvent(start_mark, end_mark, + explicit=explicit) + + # Prepare the next state. + self.state = self.parse_document_start + + return event + + def parse_document_content(self): + if self.check_token(DirectiveToken, + DocumentStartToken, DocumentEndToken, StreamEndToken): + event = self.process_empty_scalar(self.peek_token().start_mark) + self.state = self.states.pop() + return event + else: + return self.parse_block_node() + + def process_directives(self): + self.yaml_version = None + self.tag_handles = {} + while self.check_token(DirectiveToken): + token = self.get_token() + if token.name == 'YAML': + if self.yaml_version is not None: + raise ParserError(None, None, + "found duplicate YAML directive", token.start_mark) + major, minor = token.value + if major != 1: + raise ParserError(None, None, + "found incompatible YAML document (version 1.* is required)", + token.start_mark) + self.yaml_version = token.value + elif token.name == 'TAG': + handle, prefix = token.value + if handle in self.tag_handles: + raise ParserError(None, None, + "duplicate tag handle %r" % handle, + token.start_mark) + self.tag_handles[handle] = prefix + if self.tag_handles: + value = self.yaml_version, self.tag_handles.copy() + else: + value = self.yaml_version, None + for key in self.DEFAULT_TAGS: + if key not in self.tag_handles: + self.tag_handles[key] = self.DEFAULT_TAGS[key] + return value + + # block_node_or_indentless_sequence ::= ALIAS + # | properties (block_content | indentless_block_sequence)? + # | block_content + # | indentless_block_sequence + # block_node ::= ALIAS + # | properties block_content? + # | block_content + # flow_node ::= ALIAS + # | properties flow_content? + # | flow_content + # properties ::= TAG ANCHOR? | ANCHOR TAG? + # block_content ::= block_collection | flow_collection | SCALAR + # flow_content ::= flow_collection | SCALAR + # block_collection ::= block_sequence | block_mapping + # flow_collection ::= flow_sequence | flow_mapping + + def parse_block_node(self): + return self.parse_node(block=True) + + def parse_flow_node(self): + return self.parse_node() + + def parse_block_node_or_indentless_sequence(self): + return self.parse_node(block=True, indentless_sequence=True) + + def parse_node(self, block=False, indentless_sequence=False): + if self.check_token(AliasToken): + token = self.get_token() + event = AliasEvent(token.value, token.start_mark, token.end_mark) + self.state = self.states.pop() + else: + anchor = None + tag = None + start_mark = end_mark = tag_mark = None + if self.check_token(AnchorToken): + token = self.get_token() + start_mark = token.start_mark + end_mark = token.end_mark + anchor = token.value + if self.check_token(TagToken): + token = self.get_token() + tag_mark = token.start_mark + end_mark = token.end_mark + tag = token.value + elif self.check_token(TagToken): + token = self.get_token() + start_mark = tag_mark = token.start_mark + end_mark = token.end_mark + tag = token.value + if self.check_token(AnchorToken): + token = self.get_token() + end_mark = token.end_mark + anchor = token.value + if tag is not None: + handle, suffix = tag + if handle is not None: + if handle not in self.tag_handles: + raise ParserError("while parsing a node", start_mark, + "found undefined tag handle %r" % handle, + tag_mark) + tag = self.tag_handles[handle]+suffix + else: + tag = suffix + #if tag == '!': + # raise ParserError("while parsing a node", start_mark, + # "found non-specific tag '!'", tag_mark, + # "Please check 'http://pyyaml.org/wiki/YAMLNonSpecificTag' and share your opinion.") + if start_mark is None: + start_mark = end_mark = self.peek_token().start_mark + event = None + implicit = (tag is None or tag == '!') + if indentless_sequence and self.check_token(BlockEntryToken): + end_mark = self.peek_token().end_mark + event = SequenceStartEvent(anchor, tag, implicit, + start_mark, end_mark) + self.state = self.parse_indentless_sequence_entry + else: + if self.check_token(ScalarToken): + token = self.get_token() + end_mark = token.end_mark + if (token.plain and tag is None) or tag == '!': + implicit = (True, False) + elif tag is None: + implicit = (False, True) + else: + implicit = (False, False) + event = ScalarEvent(anchor, tag, implicit, token.value, + start_mark, end_mark, style=token.style) + self.state = self.states.pop() + elif self.check_token(FlowSequenceStartToken): + end_mark = self.peek_token().end_mark + event = SequenceStartEvent(anchor, tag, implicit, + start_mark, end_mark, flow_style=True) + self.state = self.parse_flow_sequence_first_entry + elif self.check_token(FlowMappingStartToken): + end_mark = self.peek_token().end_mark + event = MappingStartEvent(anchor, tag, implicit, + start_mark, end_mark, flow_style=True) + self.state = self.parse_flow_mapping_first_key + elif block and self.check_token(BlockSequenceStartToken): + end_mark = self.peek_token().start_mark + event = SequenceStartEvent(anchor, tag, implicit, + start_mark, end_mark, flow_style=False) + self.state = self.parse_block_sequence_first_entry + elif block and self.check_token(BlockMappingStartToken): + end_mark = self.peek_token().start_mark + event = MappingStartEvent(anchor, tag, implicit, + start_mark, end_mark, flow_style=False) + self.state = self.parse_block_mapping_first_key + elif anchor is not None or tag is not None: + # Empty scalars are allowed even if a tag or an anchor is + # specified. + event = ScalarEvent(anchor, tag, (implicit, False), '', + start_mark, end_mark) + self.state = self.states.pop() + else: + if block: + node = 'block' + else: + node = 'flow' + token = self.peek_token() + raise ParserError("while parsing a %s node" % node, start_mark, + "expected the node content, but found %r" % token.id, + token.start_mark) + return event + + # block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END + + def parse_block_sequence_first_entry(self): + token = self.get_token() + self.marks.append(token.start_mark) + return self.parse_block_sequence_entry() + + def parse_block_sequence_entry(self): + if self.check_token(BlockEntryToken): + token = self.get_token() + if not self.check_token(BlockEntryToken, BlockEndToken): + self.states.append(self.parse_block_sequence_entry) + return self.parse_block_node() + else: + self.state = self.parse_block_sequence_entry + return self.process_empty_scalar(token.end_mark) + if not self.check_token(BlockEndToken): + token = self.peek_token() + raise ParserError("while parsing a block collection", self.marks[-1], + "expected , but found %r" % token.id, token.start_mark) + token = self.get_token() + event = SequenceEndEvent(token.start_mark, token.end_mark) + self.state = self.states.pop() + self.marks.pop() + return event + + # indentless_sequence ::= (BLOCK-ENTRY block_node?)+ + + def parse_indentless_sequence_entry(self): + if self.check_token(BlockEntryToken): + token = self.get_token() + if not self.check_token(BlockEntryToken, + KeyToken, ValueToken, BlockEndToken): + self.states.append(self.parse_indentless_sequence_entry) + return self.parse_block_node() + else: + self.state = self.parse_indentless_sequence_entry + return self.process_empty_scalar(token.end_mark) + token = self.peek_token() + event = SequenceEndEvent(token.start_mark, token.start_mark) + self.state = self.states.pop() + return event + + # block_mapping ::= BLOCK-MAPPING_START + # ((KEY block_node_or_indentless_sequence?)? + # (VALUE block_node_or_indentless_sequence?)?)* + # BLOCK-END + + def parse_block_mapping_first_key(self): + token = self.get_token() + self.marks.append(token.start_mark) + return self.parse_block_mapping_key() + + def parse_block_mapping_key(self): + if self.check_token(KeyToken): + token = self.get_token() + if not self.check_token(KeyToken, ValueToken, BlockEndToken): + self.states.append(self.parse_block_mapping_value) + return self.parse_block_node_or_indentless_sequence() + else: + self.state = self.parse_block_mapping_value + return self.process_empty_scalar(token.end_mark) + if not self.check_token(BlockEndToken): + token = self.peek_token() + raise ParserError("while parsing a block mapping", self.marks[-1], + "expected , but found %r" % token.id, token.start_mark) + token = self.get_token() + event = MappingEndEvent(token.start_mark, token.end_mark) + self.state = self.states.pop() + self.marks.pop() + return event + + def parse_block_mapping_value(self): + if self.check_token(ValueToken): + token = self.get_token() + if not self.check_token(KeyToken, ValueToken, BlockEndToken): + self.states.append(self.parse_block_mapping_key) + return self.parse_block_node_or_indentless_sequence() + else: + self.state = self.parse_block_mapping_key + return self.process_empty_scalar(token.end_mark) + else: + self.state = self.parse_block_mapping_key + token = self.peek_token() + return self.process_empty_scalar(token.start_mark) + + # flow_sequence ::= FLOW-SEQUENCE-START + # (flow_sequence_entry FLOW-ENTRY)* + # flow_sequence_entry? + # FLOW-SEQUENCE-END + # flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + # + # Note that while production rules for both flow_sequence_entry and + # flow_mapping_entry are equal, their interpretations are different. + # For `flow_sequence_entry`, the part `KEY flow_node? (VALUE flow_node?)?` + # generate an inline mapping (set syntax). + + def parse_flow_sequence_first_entry(self): + token = self.get_token() + self.marks.append(token.start_mark) + return self.parse_flow_sequence_entry(first=True) + + def parse_flow_sequence_entry(self, first=False): + if not self.check_token(FlowSequenceEndToken): + if not first: + if self.check_token(FlowEntryToken): + self.get_token() + else: + token = self.peek_token() + raise ParserError("while parsing a flow sequence", self.marks[-1], + "expected ',' or ']', but got %r" % token.id, token.start_mark) + + if self.check_token(KeyToken): + token = self.peek_token() + event = MappingStartEvent(None, None, True, + token.start_mark, token.end_mark, + flow_style=True) + self.state = self.parse_flow_sequence_entry_mapping_key + return event + elif not self.check_token(FlowSequenceEndToken): + self.states.append(self.parse_flow_sequence_entry) + return self.parse_flow_node() + token = self.get_token() + event = SequenceEndEvent(token.start_mark, token.end_mark) + self.state = self.states.pop() + self.marks.pop() + return event + + def parse_flow_sequence_entry_mapping_key(self): + token = self.get_token() + if not self.check_token(ValueToken, + FlowEntryToken, FlowSequenceEndToken): + self.states.append(self.parse_flow_sequence_entry_mapping_value) + return self.parse_flow_node() + else: + self.state = self.parse_flow_sequence_entry_mapping_value + return self.process_empty_scalar(token.end_mark) + + def parse_flow_sequence_entry_mapping_value(self): + if self.check_token(ValueToken): + token = self.get_token() + if not self.check_token(FlowEntryToken, FlowSequenceEndToken): + self.states.append(self.parse_flow_sequence_entry_mapping_end) + return self.parse_flow_node() + else: + self.state = self.parse_flow_sequence_entry_mapping_end + return self.process_empty_scalar(token.end_mark) + else: + self.state = self.parse_flow_sequence_entry_mapping_end + token = self.peek_token() + return self.process_empty_scalar(token.start_mark) + + def parse_flow_sequence_entry_mapping_end(self): + self.state = self.parse_flow_sequence_entry + token = self.peek_token() + return MappingEndEvent(token.start_mark, token.start_mark) + + # flow_mapping ::= FLOW-MAPPING-START + # (flow_mapping_entry FLOW-ENTRY)* + # flow_mapping_entry? + # FLOW-MAPPING-END + # flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + + def parse_flow_mapping_first_key(self): + token = self.get_token() + self.marks.append(token.start_mark) + return self.parse_flow_mapping_key(first=True) + + def parse_flow_mapping_key(self, first=False): + if not self.check_token(FlowMappingEndToken): + if not first: + if self.check_token(FlowEntryToken): + self.get_token() + else: + token = self.peek_token() + raise ParserError("while parsing a flow mapping", self.marks[-1], + "expected ',' or '}', but got %r" % token.id, token.start_mark) + if self.check_token(KeyToken): + token = self.get_token() + if not self.check_token(ValueToken, + FlowEntryToken, FlowMappingEndToken): + self.states.append(self.parse_flow_mapping_value) + return self.parse_flow_node() + else: + self.state = self.parse_flow_mapping_value + return self.process_empty_scalar(token.end_mark) + elif not self.check_token(FlowMappingEndToken): + self.states.append(self.parse_flow_mapping_empty_value) + return self.parse_flow_node() + token = self.get_token() + event = MappingEndEvent(token.start_mark, token.end_mark) + self.state = self.states.pop() + self.marks.pop() + return event + + def parse_flow_mapping_value(self): + if self.check_token(ValueToken): + token = self.get_token() + if not self.check_token(FlowEntryToken, FlowMappingEndToken): + self.states.append(self.parse_flow_mapping_key) + return self.parse_flow_node() + else: + self.state = self.parse_flow_mapping_key + return self.process_empty_scalar(token.end_mark) + else: + self.state = self.parse_flow_mapping_key + token = self.peek_token() + return self.process_empty_scalar(token.start_mark) + + def parse_flow_mapping_empty_value(self): + self.state = self.parse_flow_mapping_key + return self.process_empty_scalar(self.peek_token().start_mark) + + def process_empty_scalar(self, mark): + return ScalarEvent(None, None, (True, False), '', mark, mark) + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/reader.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/reader.py new file mode 100644 index 0000000000000000000000000000000000000000..774b0219b5932a0ee1c27e637371de5ba8d9cb16 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/reader.py @@ -0,0 +1,185 @@ +# This module contains abstractions for the input stream. You don't have to +# looks further, there are no pretty code. +# +# We define two classes here. +# +# Mark(source, line, column) +# It's just a record and its only use is producing nice error messages. +# Parser does not use it for any other purposes. +# +# Reader(source, data) +# Reader determines the encoding of `data` and converts it to unicode. +# Reader provides the following methods and attributes: +# reader.peek(length=1) - return the next `length` characters +# reader.forward(length=1) - move the current position to `length` characters. +# reader.index - the number of the current character. +# reader.line, stream.column - the line and the column of the current character. + +__all__ = ['Reader', 'ReaderError'] + +from .error import YAMLError, Mark + +import codecs, re + +class ReaderError(YAMLError): + + def __init__(self, name, position, character, encoding, reason): + self.name = name + self.character = character + self.position = position + self.encoding = encoding + self.reason = reason + + def __str__(self): + if isinstance(self.character, bytes): + return "'%s' codec can't decode byte #x%02x: %s\n" \ + " in \"%s\", position %d" \ + % (self.encoding, ord(self.character), self.reason, + self.name, self.position) + else: + return "unacceptable character #x%04x: %s\n" \ + " in \"%s\", position %d" \ + % (self.character, self.reason, + self.name, self.position) + +class Reader(object): + # Reader: + # - determines the data encoding and converts it to a unicode string, + # - checks if characters are in allowed range, + # - adds '\0' to the end. + + # Reader accepts + # - a `bytes` object, + # - a `str` object, + # - a file-like object with its `read` method returning `str`, + # - a file-like object with its `read` method returning `unicode`. + + # Yeah, it's ugly and slow. + + def __init__(self, stream): + self.name = None + self.stream = None + self.stream_pointer = 0 + self.eof = True + self.buffer = '' + self.pointer = 0 + self.raw_buffer = None + self.raw_decode = None + self.encoding = None + self.index = 0 + self.line = 0 + self.column = 0 + if isinstance(stream, str): + self.name = "" + self.check_printable(stream) + self.buffer = stream+'\0' + elif isinstance(stream, bytes): + self.name = "" + self.raw_buffer = stream + self.determine_encoding() + else: + self.stream = stream + self.name = getattr(stream, 'name', "") + self.eof = False + self.raw_buffer = None + self.determine_encoding() + + def peek(self, index=0): + try: + return self.buffer[self.pointer+index] + except IndexError: + self.update(index+1) + return self.buffer[self.pointer+index] + + def prefix(self, length=1): + if self.pointer+length >= len(self.buffer): + self.update(length) + return self.buffer[self.pointer:self.pointer+length] + + def forward(self, length=1): + if self.pointer+length+1 >= len(self.buffer): + self.update(length+1) + while length: + ch = self.buffer[self.pointer] + self.pointer += 1 + self.index += 1 + if ch in '\n\x85\u2028\u2029' \ + or (ch == '\r' and self.buffer[self.pointer] != '\n'): + self.line += 1 + self.column = 0 + elif ch != '\uFEFF': + self.column += 1 + length -= 1 + + def get_mark(self): + if self.stream is None: + return Mark(self.name, self.index, self.line, self.column, + self.buffer, self.pointer) + else: + return Mark(self.name, self.index, self.line, self.column, + None, None) + + def determine_encoding(self): + while not self.eof and (self.raw_buffer is None or len(self.raw_buffer) < 2): + self.update_raw() + if isinstance(self.raw_buffer, bytes): + if self.raw_buffer.startswith(codecs.BOM_UTF16_LE): + self.raw_decode = codecs.utf_16_le_decode + self.encoding = 'utf-16-le' + elif self.raw_buffer.startswith(codecs.BOM_UTF16_BE): + self.raw_decode = codecs.utf_16_be_decode + self.encoding = 'utf-16-be' + else: + self.raw_decode = codecs.utf_8_decode + self.encoding = 'utf-8' + self.update(1) + + NON_PRINTABLE = re.compile('[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD\U00010000-\U0010ffff]') + def check_printable(self, data): + match = self.NON_PRINTABLE.search(data) + if match: + character = match.group() + position = self.index+(len(self.buffer)-self.pointer)+match.start() + raise ReaderError(self.name, position, ord(character), + 'unicode', "special characters are not allowed") + + def update(self, length): + if self.raw_buffer is None: + return + self.buffer = self.buffer[self.pointer:] + self.pointer = 0 + while len(self.buffer) < length: + if not self.eof: + self.update_raw() + if self.raw_decode is not None: + try: + data, converted = self.raw_decode(self.raw_buffer, + 'strict', self.eof) + except UnicodeDecodeError as exc: + character = self.raw_buffer[exc.start] + if self.stream is not None: + position = self.stream_pointer-len(self.raw_buffer)+exc.start + else: + position = exc.start + raise ReaderError(self.name, position, character, + exc.encoding, exc.reason) + else: + data = self.raw_buffer + converted = len(data) + self.check_printable(data) + self.buffer += data + self.raw_buffer = self.raw_buffer[converted:] + if self.eof: + self.buffer += '\0' + self.raw_buffer = None + break + + def update_raw(self, size=4096): + data = self.stream.read(size) + if self.raw_buffer is None: + self.raw_buffer = data + else: + self.raw_buffer += data + self.stream_pointer += len(data) + if not data: + self.eof = True diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/representer.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/representer.py new file mode 100644 index 0000000000000000000000000000000000000000..808ca06dfbd60c9a23eb079151b74a82ef688749 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/representer.py @@ -0,0 +1,389 @@ + +__all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer', + 'RepresenterError'] + +from .error import * +from .nodes import * + +import datetime, copyreg, types, base64, collections + +class RepresenterError(YAMLError): + pass + +class BaseRepresenter: + + yaml_representers = {} + yaml_multi_representers = {} + + def __init__(self, default_style=None, default_flow_style=False, sort_keys=True): + self.default_style = default_style + self.sort_keys = sort_keys + self.default_flow_style = default_flow_style + self.represented_objects = {} + self.object_keeper = [] + self.alias_key = None + + def represent(self, data): + node = self.represent_data(data) + self.serialize(node) + self.represented_objects = {} + self.object_keeper = [] + self.alias_key = None + + def represent_data(self, data): + if self.ignore_aliases(data): + self.alias_key = None + else: + self.alias_key = id(data) + if self.alias_key is not None: + if self.alias_key in self.represented_objects: + node = self.represented_objects[self.alias_key] + #if node is None: + # raise RepresenterError("recursive objects are not allowed: %r" % data) + return node + #self.represented_objects[alias_key] = None + self.object_keeper.append(data) + data_types = type(data).__mro__ + if data_types[0] in self.yaml_representers: + node = self.yaml_representers[data_types[0]](self, data) + else: + for data_type in data_types: + if data_type in self.yaml_multi_representers: + node = self.yaml_multi_representers[data_type](self, data) + break + else: + if None in self.yaml_multi_representers: + node = self.yaml_multi_representers[None](self, data) + elif None in self.yaml_representers: + node = self.yaml_representers[None](self, data) + else: + node = ScalarNode(None, str(data)) + #if alias_key is not None: + # self.represented_objects[alias_key] = node + return node + + @classmethod + def add_representer(cls, data_type, representer): + if not 'yaml_representers' in cls.__dict__: + cls.yaml_representers = cls.yaml_representers.copy() + cls.yaml_representers[data_type] = representer + + @classmethod + def add_multi_representer(cls, data_type, representer): + if not 'yaml_multi_representers' in cls.__dict__: + cls.yaml_multi_representers = cls.yaml_multi_representers.copy() + cls.yaml_multi_representers[data_type] = representer + + def represent_scalar(self, tag, value, style=None): + if style is None: + style = self.default_style + node = ScalarNode(tag, value, style=style) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + return node + + def represent_sequence(self, tag, sequence, flow_style=None): + value = [] + node = SequenceNode(tag, value, flow_style=flow_style) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + for item in sequence: + node_item = self.represent_data(item) + if not (isinstance(node_item, ScalarNode) and not node_item.style): + best_style = False + value.append(node_item) + if flow_style is None: + if self.default_flow_style is not None: + node.flow_style = self.default_flow_style + else: + node.flow_style = best_style + return node + + def represent_mapping(self, tag, mapping, flow_style=None): + value = [] + node = MappingNode(tag, value, flow_style=flow_style) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + if hasattr(mapping, 'items'): + mapping = list(mapping.items()) + if self.sort_keys: + try: + mapping = sorted(mapping) + except TypeError: + pass + for item_key, item_value in mapping: + node_key = self.represent_data(item_key) + node_value = self.represent_data(item_value) + if not (isinstance(node_key, ScalarNode) and not node_key.style): + best_style = False + if not (isinstance(node_value, ScalarNode) and not node_value.style): + best_style = False + value.append((node_key, node_value)) + if flow_style is None: + if self.default_flow_style is not None: + node.flow_style = self.default_flow_style + else: + node.flow_style = best_style + return node + + def ignore_aliases(self, data): + return False + +class SafeRepresenter(BaseRepresenter): + + def ignore_aliases(self, data): + if data is None: + return True + if isinstance(data, tuple) and data == (): + return True + if isinstance(data, (str, bytes, bool, int, float)): + return True + + def represent_none(self, data): + return self.represent_scalar('tag:yaml.org,2002:null', 'null') + + def represent_str(self, data): + return self.represent_scalar('tag:yaml.org,2002:str', data) + + def represent_binary(self, data): + if hasattr(base64, 'encodebytes'): + data = base64.encodebytes(data).decode('ascii') + else: + data = base64.encodestring(data).decode('ascii') + return self.represent_scalar('tag:yaml.org,2002:binary', data, style='|') + + def represent_bool(self, data): + if data: + value = 'true' + else: + value = 'false' + return self.represent_scalar('tag:yaml.org,2002:bool', value) + + def represent_int(self, data): + return self.represent_scalar('tag:yaml.org,2002:int', str(data)) + + inf_value = 1e300 + while repr(inf_value) != repr(inf_value*inf_value): + inf_value *= inf_value + + def represent_float(self, data): + if data != data or (data == 0.0 and data == 1.0): + value = '.nan' + elif data == self.inf_value: + value = '.inf' + elif data == -self.inf_value: + value = '-.inf' + else: + value = repr(data).lower() + # Note that in some cases `repr(data)` represents a float number + # without the decimal parts. For instance: + # >>> repr(1e17) + # '1e17' + # Unfortunately, this is not a valid float representation according + # to the definition of the `!!float` tag. We fix this by adding + # '.0' before the 'e' symbol. + if '.' not in value and 'e' in value: + value = value.replace('e', '.0e', 1) + return self.represent_scalar('tag:yaml.org,2002:float', value) + + def represent_list(self, data): + #pairs = (len(data) > 0 and isinstance(data, list)) + #if pairs: + # for item in data: + # if not isinstance(item, tuple) or len(item) != 2: + # pairs = False + # break + #if not pairs: + return self.represent_sequence('tag:yaml.org,2002:seq', data) + #value = [] + #for item_key, item_value in data: + # value.append(self.represent_mapping(u'tag:yaml.org,2002:map', + # [(item_key, item_value)])) + #return SequenceNode(u'tag:yaml.org,2002:pairs', value) + + def represent_dict(self, data): + return self.represent_mapping('tag:yaml.org,2002:map', data) + + def represent_set(self, data): + value = {} + for key in data: + value[key] = None + return self.represent_mapping('tag:yaml.org,2002:set', value) + + def represent_date(self, data): + value = data.isoformat() + return self.represent_scalar('tag:yaml.org,2002:timestamp', value) + + def represent_datetime(self, data): + value = data.isoformat(' ') + return self.represent_scalar('tag:yaml.org,2002:timestamp', value) + + def represent_yaml_object(self, tag, data, cls, flow_style=None): + if hasattr(data, '__getstate__'): + state = data.__getstate__() + else: + state = data.__dict__.copy() + return self.represent_mapping(tag, state, flow_style=flow_style) + + def represent_undefined(self, data): + raise RepresenterError("cannot represent an object", data) + +SafeRepresenter.add_representer(type(None), + SafeRepresenter.represent_none) + +SafeRepresenter.add_representer(str, + SafeRepresenter.represent_str) + +SafeRepresenter.add_representer(bytes, + SafeRepresenter.represent_binary) + +SafeRepresenter.add_representer(bool, + SafeRepresenter.represent_bool) + +SafeRepresenter.add_representer(int, + SafeRepresenter.represent_int) + +SafeRepresenter.add_representer(float, + SafeRepresenter.represent_float) + +SafeRepresenter.add_representer(list, + SafeRepresenter.represent_list) + +SafeRepresenter.add_representer(tuple, + SafeRepresenter.represent_list) + +SafeRepresenter.add_representer(dict, + SafeRepresenter.represent_dict) + +SafeRepresenter.add_representer(set, + SafeRepresenter.represent_set) + +SafeRepresenter.add_representer(datetime.date, + SafeRepresenter.represent_date) + +SafeRepresenter.add_representer(datetime.datetime, + SafeRepresenter.represent_datetime) + +SafeRepresenter.add_representer(None, + SafeRepresenter.represent_undefined) + +class Representer(SafeRepresenter): + + def represent_complex(self, data): + if data.imag == 0.0: + data = '%r' % data.real + elif data.real == 0.0: + data = '%rj' % data.imag + elif data.imag > 0: + data = '%r+%rj' % (data.real, data.imag) + else: + data = '%r%rj' % (data.real, data.imag) + return self.represent_scalar('tag:yaml.org,2002:python/complex', data) + + def represent_tuple(self, data): + return self.represent_sequence('tag:yaml.org,2002:python/tuple', data) + + def represent_name(self, data): + name = '%s.%s' % (data.__module__, data.__name__) + return self.represent_scalar('tag:yaml.org,2002:python/name:'+name, '') + + def represent_module(self, data): + return self.represent_scalar( + 'tag:yaml.org,2002:python/module:'+data.__name__, '') + + def represent_object(self, data): + # We use __reduce__ API to save the data. data.__reduce__ returns + # a tuple of length 2-5: + # (function, args, state, listitems, dictitems) + + # For reconstructing, we calls function(*args), then set its state, + # listitems, and dictitems if they are not None. + + # A special case is when function.__name__ == '__newobj__'. In this + # case we create the object with args[0].__new__(*args). + + # Another special case is when __reduce__ returns a string - we don't + # support it. + + # We produce a !!python/object, !!python/object/new or + # !!python/object/apply node. + + cls = type(data) + if cls in copyreg.dispatch_table: + reduce = copyreg.dispatch_table[cls](data) + elif hasattr(data, '__reduce_ex__'): + reduce = data.__reduce_ex__(2) + elif hasattr(data, '__reduce__'): + reduce = data.__reduce__() + else: + raise RepresenterError("cannot represent an object", data) + reduce = (list(reduce)+[None]*5)[:5] + function, args, state, listitems, dictitems = reduce + args = list(args) + if state is None: + state = {} + if listitems is not None: + listitems = list(listitems) + if dictitems is not None: + dictitems = dict(dictitems) + if function.__name__ == '__newobj__': + function = args[0] + args = args[1:] + tag = 'tag:yaml.org,2002:python/object/new:' + newobj = True + else: + tag = 'tag:yaml.org,2002:python/object/apply:' + newobj = False + function_name = '%s.%s' % (function.__module__, function.__name__) + if not args and not listitems and not dictitems \ + and isinstance(state, dict) and newobj: + return self.represent_mapping( + 'tag:yaml.org,2002:python/object:'+function_name, state) + if not listitems and not dictitems \ + and isinstance(state, dict) and not state: + return self.represent_sequence(tag+function_name, args) + value = {} + if args: + value['args'] = args + if state or not isinstance(state, dict): + value['state'] = state + if listitems: + value['listitems'] = listitems + if dictitems: + value['dictitems'] = dictitems + return self.represent_mapping(tag+function_name, value) + + def represent_ordered_dict(self, data): + # Provide uniform representation across different Python versions. + data_type = type(data) + tag = 'tag:yaml.org,2002:python/object/apply:%s.%s' \ + % (data_type.__module__, data_type.__name__) + items = [[key, value] for key, value in data.items()] + return self.represent_sequence(tag, [items]) + +Representer.add_representer(complex, + Representer.represent_complex) + +Representer.add_representer(tuple, + Representer.represent_tuple) + +Representer.add_multi_representer(type, + Representer.represent_name) + +Representer.add_representer(collections.OrderedDict, + Representer.represent_ordered_dict) + +Representer.add_representer(types.FunctionType, + Representer.represent_name) + +Representer.add_representer(types.BuiltinFunctionType, + Representer.represent_name) + +Representer.add_representer(types.ModuleType, + Representer.represent_module) + +Representer.add_multi_representer(object, + Representer.represent_object) + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/resolver.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/resolver.py new file mode 100644 index 0000000000000000000000000000000000000000..3522bdaaf6358110b608f4e6503b9d314c82d887 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/resolver.py @@ -0,0 +1,227 @@ + +__all__ = ['BaseResolver', 'Resolver'] + +from .error import * +from .nodes import * + +import re + +class ResolverError(YAMLError): + pass + +class BaseResolver: + + DEFAULT_SCALAR_TAG = 'tag:yaml.org,2002:str' + DEFAULT_SEQUENCE_TAG = 'tag:yaml.org,2002:seq' + DEFAULT_MAPPING_TAG = 'tag:yaml.org,2002:map' + + yaml_implicit_resolvers = {} + yaml_path_resolvers = {} + + def __init__(self): + self.resolver_exact_paths = [] + self.resolver_prefix_paths = [] + + @classmethod + def add_implicit_resolver(cls, tag, regexp, first): + if not 'yaml_implicit_resolvers' in cls.__dict__: + implicit_resolvers = {} + for key in cls.yaml_implicit_resolvers: + implicit_resolvers[key] = cls.yaml_implicit_resolvers[key][:] + cls.yaml_implicit_resolvers = implicit_resolvers + if first is None: + first = [None] + for ch in first: + cls.yaml_implicit_resolvers.setdefault(ch, []).append((tag, regexp)) + + @classmethod + def add_path_resolver(cls, tag, path, kind=None): + # Note: `add_path_resolver` is experimental. The API could be changed. + # `new_path` is a pattern that is matched against the path from the + # root to the node that is being considered. `node_path` elements are + # tuples `(node_check, index_check)`. `node_check` is a node class: + # `ScalarNode`, `SequenceNode`, `MappingNode` or `None`. `None` + # matches any kind of a node. `index_check` could be `None`, a boolean + # value, a string value, or a number. `None` and `False` match against + # any _value_ of sequence and mapping nodes. `True` matches against + # any _key_ of a mapping node. A string `index_check` matches against + # a mapping value that corresponds to a scalar key which content is + # equal to the `index_check` value. An integer `index_check` matches + # against a sequence value with the index equal to `index_check`. + if not 'yaml_path_resolvers' in cls.__dict__: + cls.yaml_path_resolvers = cls.yaml_path_resolvers.copy() + new_path = [] + for element in path: + if isinstance(element, (list, tuple)): + if len(element) == 2: + node_check, index_check = element + elif len(element) == 1: + node_check = element[0] + index_check = True + else: + raise ResolverError("Invalid path element: %s" % element) + else: + node_check = None + index_check = element + if node_check is str: + node_check = ScalarNode + elif node_check is list: + node_check = SequenceNode + elif node_check is dict: + node_check = MappingNode + elif node_check not in [ScalarNode, SequenceNode, MappingNode] \ + and not isinstance(node_check, str) \ + and node_check is not None: + raise ResolverError("Invalid node checker: %s" % node_check) + if not isinstance(index_check, (str, int)) \ + and index_check is not None: + raise ResolverError("Invalid index checker: %s" % index_check) + new_path.append((node_check, index_check)) + if kind is str: + kind = ScalarNode + elif kind is list: + kind = SequenceNode + elif kind is dict: + kind = MappingNode + elif kind not in [ScalarNode, SequenceNode, MappingNode] \ + and kind is not None: + raise ResolverError("Invalid node kind: %s" % kind) + cls.yaml_path_resolvers[tuple(new_path), kind] = tag + + def descend_resolver(self, current_node, current_index): + if not self.yaml_path_resolvers: + return + exact_paths = {} + prefix_paths = [] + if current_node: + depth = len(self.resolver_prefix_paths) + for path, kind in self.resolver_prefix_paths[-1]: + if self.check_resolver_prefix(depth, path, kind, + current_node, current_index): + if len(path) > depth: + prefix_paths.append((path, kind)) + else: + exact_paths[kind] = self.yaml_path_resolvers[path, kind] + else: + for path, kind in self.yaml_path_resolvers: + if not path: + exact_paths[kind] = self.yaml_path_resolvers[path, kind] + else: + prefix_paths.append((path, kind)) + self.resolver_exact_paths.append(exact_paths) + self.resolver_prefix_paths.append(prefix_paths) + + def ascend_resolver(self): + if not self.yaml_path_resolvers: + return + self.resolver_exact_paths.pop() + self.resolver_prefix_paths.pop() + + def check_resolver_prefix(self, depth, path, kind, + current_node, current_index): + node_check, index_check = path[depth-1] + if isinstance(node_check, str): + if current_node.tag != node_check: + return + elif node_check is not None: + if not isinstance(current_node, node_check): + return + if index_check is True and current_index is not None: + return + if (index_check is False or index_check is None) \ + and current_index is None: + return + if isinstance(index_check, str): + if not (isinstance(current_index, ScalarNode) + and index_check == current_index.value): + return + elif isinstance(index_check, int) and not isinstance(index_check, bool): + if index_check != current_index: + return + return True + + def resolve(self, kind, value, implicit): + if kind is ScalarNode and implicit[0]: + if value == '': + resolvers = self.yaml_implicit_resolvers.get('', []) + else: + resolvers = self.yaml_implicit_resolvers.get(value[0], []) + wildcard_resolvers = self.yaml_implicit_resolvers.get(None, []) + for tag, regexp in resolvers + wildcard_resolvers: + if regexp.match(value): + return tag + implicit = implicit[1] + if self.yaml_path_resolvers: + exact_paths = self.resolver_exact_paths[-1] + if kind in exact_paths: + return exact_paths[kind] + if None in exact_paths: + return exact_paths[None] + if kind is ScalarNode: + return self.DEFAULT_SCALAR_TAG + elif kind is SequenceNode: + return self.DEFAULT_SEQUENCE_TAG + elif kind is MappingNode: + return self.DEFAULT_MAPPING_TAG + +class Resolver(BaseResolver): + pass + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:bool', + re.compile(r'''^(?:yes|Yes|YES|no|No|NO + |true|True|TRUE|false|False|FALSE + |on|On|ON|off|Off|OFF)$''', re.X), + list('yYnNtTfFoO')) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:float', + re.compile(r'''^(?:[-+]?(?:[0-9][0-9_]*)\.[0-9_]*(?:[eE][-+][0-9]+)? + |\.[0-9][0-9_]*(?:[eE][-+][0-9]+)? + |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]* + |[-+]?\.(?:inf|Inf|INF) + |\.(?:nan|NaN|NAN))$''', re.X), + list('-+0123456789.')) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:int', + re.compile(r'''^(?:[-+]?0b[0-1_]+ + |[-+]?0[0-7_]+ + |[-+]?(?:0|[1-9][0-9_]*) + |[-+]?0x[0-9a-fA-F_]+ + |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$''', re.X), + list('-+0123456789')) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:merge', + re.compile(r'^(?:<<)$'), + ['<']) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:null', + re.compile(r'''^(?: ~ + |null|Null|NULL + | )$''', re.X), + ['~', 'n', 'N', '']) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:timestamp', + re.compile(r'''^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] + |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]? + (?:[Tt]|[ \t]+)[0-9][0-9]? + :[0-9][0-9] :[0-9][0-9] (?:\.[0-9]*)? + (?:[ \t]*(?:Z|[-+][0-9][0-9]?(?::[0-9][0-9])?))?)$''', re.X), + list('0123456789')) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:value', + re.compile(r'^(?:=)$'), + ['=']) + +# The following resolver is only for documentation purposes. It cannot work +# because plain scalars cannot start with '!', '&', or '*'. +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:yaml', + re.compile(r'^(?:!|&|\*)$'), + list('!&*')) + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/scanner.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/scanner.py new file mode 100644 index 0000000000000000000000000000000000000000..de925b07f1eaec33c9c305a8a69f9eb7ac5983c5 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/scanner.py @@ -0,0 +1,1435 @@ + +# Scanner produces tokens of the following types: +# STREAM-START +# STREAM-END +# DIRECTIVE(name, value) +# DOCUMENT-START +# DOCUMENT-END +# BLOCK-SEQUENCE-START +# BLOCK-MAPPING-START +# BLOCK-END +# FLOW-SEQUENCE-START +# FLOW-MAPPING-START +# FLOW-SEQUENCE-END +# FLOW-MAPPING-END +# BLOCK-ENTRY +# FLOW-ENTRY +# KEY +# VALUE +# ALIAS(value) +# ANCHOR(value) +# TAG(value) +# SCALAR(value, plain, style) +# +# Read comments in the Scanner code for more details. +# + +__all__ = ['Scanner', 'ScannerError'] + +from .error import MarkedYAMLError +from .tokens import * + +class ScannerError(MarkedYAMLError): + pass + +class SimpleKey: + # See below simple keys treatment. + + def __init__(self, token_number, required, index, line, column, mark): + self.token_number = token_number + self.required = required + self.index = index + self.line = line + self.column = column + self.mark = mark + +class Scanner: + + def __init__(self): + """Initialize the scanner.""" + # It is assumed that Scanner and Reader will have a common descendant. + # Reader do the dirty work of checking for BOM and converting the + # input data to Unicode. It also adds NUL to the end. + # + # Reader supports the following methods + # self.peek(i=0) # peek the next i-th character + # self.prefix(l=1) # peek the next l characters + # self.forward(l=1) # read the next l characters and move the pointer. + + # Had we reached the end of the stream? + self.done = False + + # The number of unclosed '{' and '['. `flow_level == 0` means block + # context. + self.flow_level = 0 + + # List of processed tokens that are not yet emitted. + self.tokens = [] + + # Add the STREAM-START token. + self.fetch_stream_start() + + # Number of tokens that were emitted through the `get_token` method. + self.tokens_taken = 0 + + # The current indentation level. + self.indent = -1 + + # Past indentation levels. + self.indents = [] + + # Variables related to simple keys treatment. + + # A simple key is a key that is not denoted by the '?' indicator. + # Example of simple keys: + # --- + # block simple key: value + # ? not a simple key: + # : { flow simple key: value } + # We emit the KEY token before all keys, so when we find a potential + # simple key, we try to locate the corresponding ':' indicator. + # Simple keys should be limited to a single line and 1024 characters. + + # Can a simple key start at the current position? A simple key may + # start: + # - at the beginning of the line, not counting indentation spaces + # (in block context), + # - after '{', '[', ',' (in the flow context), + # - after '?', ':', '-' (in the block context). + # In the block context, this flag also signifies if a block collection + # may start at the current position. + self.allow_simple_key = True + + # Keep track of possible simple keys. This is a dictionary. The key + # is `flow_level`; there can be no more that one possible simple key + # for each level. The value is a SimpleKey record: + # (token_number, required, index, line, column, mark) + # A simple key may start with ALIAS, ANCHOR, TAG, SCALAR(flow), + # '[', or '{' tokens. + self.possible_simple_keys = {} + + # Public methods. + + def check_token(self, *choices): + # Check if the next token is one of the given types. + while self.need_more_tokens(): + self.fetch_more_tokens() + if self.tokens: + if not choices: + return True + for choice in choices: + if isinstance(self.tokens[0], choice): + return True + return False + + def peek_token(self): + # Return the next token, but do not delete if from the queue. + # Return None if no more tokens. + while self.need_more_tokens(): + self.fetch_more_tokens() + if self.tokens: + return self.tokens[0] + else: + return None + + def get_token(self): + # Return the next token. + while self.need_more_tokens(): + self.fetch_more_tokens() + if self.tokens: + self.tokens_taken += 1 + return self.tokens.pop(0) + + # Private methods. + + def need_more_tokens(self): + if self.done: + return False + if not self.tokens: + return True + # The current token may be a potential simple key, so we + # need to look further. + self.stale_possible_simple_keys() + if self.next_possible_simple_key() == self.tokens_taken: + return True + + def fetch_more_tokens(self): + + # Eat whitespaces and comments until we reach the next token. + self.scan_to_next_token() + + # Remove obsolete possible simple keys. + self.stale_possible_simple_keys() + + # Compare the current indentation and column. It may add some tokens + # and decrease the current indentation level. + self.unwind_indent(self.column) + + # Peek the next character. + ch = self.peek() + + # Is it the end of stream? + if ch == '\0': + return self.fetch_stream_end() + + # Is it a directive? + if ch == '%' and self.check_directive(): + return self.fetch_directive() + + # Is it the document start? + if ch == '-' and self.check_document_start(): + return self.fetch_document_start() + + # Is it the document end? + if ch == '.' and self.check_document_end(): + return self.fetch_document_end() + + # TODO: support for BOM within a stream. + #if ch == '\uFEFF': + # return self.fetch_bom() <-- issue BOMToken + + # Note: the order of the following checks is NOT significant. + + # Is it the flow sequence start indicator? + if ch == '[': + return self.fetch_flow_sequence_start() + + # Is it the flow mapping start indicator? + if ch == '{': + return self.fetch_flow_mapping_start() + + # Is it the flow sequence end indicator? + if ch == ']': + return self.fetch_flow_sequence_end() + + # Is it the flow mapping end indicator? + if ch == '}': + return self.fetch_flow_mapping_end() + + # Is it the flow entry indicator? + if ch == ',': + return self.fetch_flow_entry() + + # Is it the block entry indicator? + if ch == '-' and self.check_block_entry(): + return self.fetch_block_entry() + + # Is it the key indicator? + if ch == '?' and self.check_key(): + return self.fetch_key() + + # Is it the value indicator? + if ch == ':' and self.check_value(): + return self.fetch_value() + + # Is it an alias? + if ch == '*': + return self.fetch_alias() + + # Is it an anchor? + if ch == '&': + return self.fetch_anchor() + + # Is it a tag? + if ch == '!': + return self.fetch_tag() + + # Is it a literal scalar? + if ch == '|' and not self.flow_level: + return self.fetch_literal() + + # Is it a folded scalar? + if ch == '>' and not self.flow_level: + return self.fetch_folded() + + # Is it a single quoted scalar? + if ch == '\'': + return self.fetch_single() + + # Is it a double quoted scalar? + if ch == '\"': + return self.fetch_double() + + # It must be a plain scalar then. + if self.check_plain(): + return self.fetch_plain() + + # No? It's an error. Let's produce a nice error message. + raise ScannerError("while scanning for the next token", None, + "found character %r that cannot start any token" % ch, + self.get_mark()) + + # Simple keys treatment. + + def next_possible_simple_key(self): + # Return the number of the nearest possible simple key. Actually we + # don't need to loop through the whole dictionary. We may replace it + # with the following code: + # if not self.possible_simple_keys: + # return None + # return self.possible_simple_keys[ + # min(self.possible_simple_keys.keys())].token_number + min_token_number = None + for level in self.possible_simple_keys: + key = self.possible_simple_keys[level] + if min_token_number is None or key.token_number < min_token_number: + min_token_number = key.token_number + return min_token_number + + def stale_possible_simple_keys(self): + # Remove entries that are no longer possible simple keys. According to + # the YAML specification, simple keys + # - should be limited to a single line, + # - should be no longer than 1024 characters. + # Disabling this procedure will allow simple keys of any length and + # height (may cause problems if indentation is broken though). + for level in list(self.possible_simple_keys): + key = self.possible_simple_keys[level] + if key.line != self.line \ + or self.index-key.index > 1024: + if key.required: + raise ScannerError("while scanning a simple key", key.mark, + "could not find expected ':'", self.get_mark()) + del self.possible_simple_keys[level] + + def save_possible_simple_key(self): + # The next token may start a simple key. We check if it's possible + # and save its position. This function is called for + # ALIAS, ANCHOR, TAG, SCALAR(flow), '[', and '{'. + + # Check if a simple key is required at the current position. + required = not self.flow_level and self.indent == self.column + + # The next token might be a simple key. Let's save it's number and + # position. + if self.allow_simple_key: + self.remove_possible_simple_key() + token_number = self.tokens_taken+len(self.tokens) + key = SimpleKey(token_number, required, + self.index, self.line, self.column, self.get_mark()) + self.possible_simple_keys[self.flow_level] = key + + def remove_possible_simple_key(self): + # Remove the saved possible key position at the current flow level. + if self.flow_level in self.possible_simple_keys: + key = self.possible_simple_keys[self.flow_level] + + if key.required: + raise ScannerError("while scanning a simple key", key.mark, + "could not find expected ':'", self.get_mark()) + + del self.possible_simple_keys[self.flow_level] + + # Indentation functions. + + def unwind_indent(self, column): + + ## In flow context, tokens should respect indentation. + ## Actually the condition should be `self.indent >= column` according to + ## the spec. But this condition will prohibit intuitively correct + ## constructions such as + ## key : { + ## } + #if self.flow_level and self.indent > column: + # raise ScannerError(None, None, + # "invalid indentation or unclosed '[' or '{'", + # self.get_mark()) + + # In the flow context, indentation is ignored. We make the scanner less + # restrictive then specification requires. + if self.flow_level: + return + + # In block context, we may need to issue the BLOCK-END tokens. + while self.indent > column: + mark = self.get_mark() + self.indent = self.indents.pop() + self.tokens.append(BlockEndToken(mark, mark)) + + def add_indent(self, column): + # Check if we need to increase indentation. + if self.indent < column: + self.indents.append(self.indent) + self.indent = column + return True + return False + + # Fetchers. + + def fetch_stream_start(self): + # We always add STREAM-START as the first token and STREAM-END as the + # last token. + + # Read the token. + mark = self.get_mark() + + # Add STREAM-START. + self.tokens.append(StreamStartToken(mark, mark, + encoding=self.encoding)) + + + def fetch_stream_end(self): + + # Set the current indentation to -1. + self.unwind_indent(-1) + + # Reset simple keys. + self.remove_possible_simple_key() + self.allow_simple_key = False + self.possible_simple_keys = {} + + # Read the token. + mark = self.get_mark() + + # Add STREAM-END. + self.tokens.append(StreamEndToken(mark, mark)) + + # The steam is finished. + self.done = True + + def fetch_directive(self): + + # Set the current indentation to -1. + self.unwind_indent(-1) + + # Reset simple keys. + self.remove_possible_simple_key() + self.allow_simple_key = False + + # Scan and add DIRECTIVE. + self.tokens.append(self.scan_directive()) + + def fetch_document_start(self): + self.fetch_document_indicator(DocumentStartToken) + + def fetch_document_end(self): + self.fetch_document_indicator(DocumentEndToken) + + def fetch_document_indicator(self, TokenClass): + + # Set the current indentation to -1. + self.unwind_indent(-1) + + # Reset simple keys. Note that there could not be a block collection + # after '---'. + self.remove_possible_simple_key() + self.allow_simple_key = False + + # Add DOCUMENT-START or DOCUMENT-END. + start_mark = self.get_mark() + self.forward(3) + end_mark = self.get_mark() + self.tokens.append(TokenClass(start_mark, end_mark)) + + def fetch_flow_sequence_start(self): + self.fetch_flow_collection_start(FlowSequenceStartToken) + + def fetch_flow_mapping_start(self): + self.fetch_flow_collection_start(FlowMappingStartToken) + + def fetch_flow_collection_start(self, TokenClass): + + # '[' and '{' may start a simple key. + self.save_possible_simple_key() + + # Increase the flow level. + self.flow_level += 1 + + # Simple keys are allowed after '[' and '{'. + self.allow_simple_key = True + + # Add FLOW-SEQUENCE-START or FLOW-MAPPING-START. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(TokenClass(start_mark, end_mark)) + + def fetch_flow_sequence_end(self): + self.fetch_flow_collection_end(FlowSequenceEndToken) + + def fetch_flow_mapping_end(self): + self.fetch_flow_collection_end(FlowMappingEndToken) + + def fetch_flow_collection_end(self, TokenClass): + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Decrease the flow level. + self.flow_level -= 1 + + # No simple keys after ']' or '}'. + self.allow_simple_key = False + + # Add FLOW-SEQUENCE-END or FLOW-MAPPING-END. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(TokenClass(start_mark, end_mark)) + + def fetch_flow_entry(self): + + # Simple keys are allowed after ','. + self.allow_simple_key = True + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add FLOW-ENTRY. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(FlowEntryToken(start_mark, end_mark)) + + def fetch_block_entry(self): + + # Block context needs additional checks. + if not self.flow_level: + + # Are we allowed to start a new entry? + if not self.allow_simple_key: + raise ScannerError(None, None, + "sequence entries are not allowed here", + self.get_mark()) + + # We may need to add BLOCK-SEQUENCE-START. + if self.add_indent(self.column): + mark = self.get_mark() + self.tokens.append(BlockSequenceStartToken(mark, mark)) + + # It's an error for the block entry to occur in the flow context, + # but we let the parser detect this. + else: + pass + + # Simple keys are allowed after '-'. + self.allow_simple_key = True + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add BLOCK-ENTRY. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(BlockEntryToken(start_mark, end_mark)) + + def fetch_key(self): + + # Block context needs additional checks. + if not self.flow_level: + + # Are we allowed to start a key (not necessary a simple)? + if not self.allow_simple_key: + raise ScannerError(None, None, + "mapping keys are not allowed here", + self.get_mark()) + + # We may need to add BLOCK-MAPPING-START. + if self.add_indent(self.column): + mark = self.get_mark() + self.tokens.append(BlockMappingStartToken(mark, mark)) + + # Simple keys are allowed after '?' in the block context. + self.allow_simple_key = not self.flow_level + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add KEY. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(KeyToken(start_mark, end_mark)) + + def fetch_value(self): + + # Do we determine a simple key? + if self.flow_level in self.possible_simple_keys: + + # Add KEY. + key = self.possible_simple_keys[self.flow_level] + del self.possible_simple_keys[self.flow_level] + self.tokens.insert(key.token_number-self.tokens_taken, + KeyToken(key.mark, key.mark)) + + # If this key starts a new block mapping, we need to add + # BLOCK-MAPPING-START. + if not self.flow_level: + if self.add_indent(key.column): + self.tokens.insert(key.token_number-self.tokens_taken, + BlockMappingStartToken(key.mark, key.mark)) + + # There cannot be two simple keys one after another. + self.allow_simple_key = False + + # It must be a part of a complex key. + else: + + # Block context needs additional checks. + # (Do we really need them? They will be caught by the parser + # anyway.) + if not self.flow_level: + + # We are allowed to start a complex value if and only if + # we can start a simple key. + if not self.allow_simple_key: + raise ScannerError(None, None, + "mapping values are not allowed here", + self.get_mark()) + + # If this value starts a new block mapping, we need to add + # BLOCK-MAPPING-START. It will be detected as an error later by + # the parser. + if not self.flow_level: + if self.add_indent(self.column): + mark = self.get_mark() + self.tokens.append(BlockMappingStartToken(mark, mark)) + + # Simple keys are allowed after ':' in the block context. + self.allow_simple_key = not self.flow_level + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add VALUE. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(ValueToken(start_mark, end_mark)) + + def fetch_alias(self): + + # ALIAS could be a simple key. + self.save_possible_simple_key() + + # No simple keys after ALIAS. + self.allow_simple_key = False + + # Scan and add ALIAS. + self.tokens.append(self.scan_anchor(AliasToken)) + + def fetch_anchor(self): + + # ANCHOR could start a simple key. + self.save_possible_simple_key() + + # No simple keys after ANCHOR. + self.allow_simple_key = False + + # Scan and add ANCHOR. + self.tokens.append(self.scan_anchor(AnchorToken)) + + def fetch_tag(self): + + # TAG could start a simple key. + self.save_possible_simple_key() + + # No simple keys after TAG. + self.allow_simple_key = False + + # Scan and add TAG. + self.tokens.append(self.scan_tag()) + + def fetch_literal(self): + self.fetch_block_scalar(style='|') + + def fetch_folded(self): + self.fetch_block_scalar(style='>') + + def fetch_block_scalar(self, style): + + # A simple key may follow a block scalar. + self.allow_simple_key = True + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Scan and add SCALAR. + self.tokens.append(self.scan_block_scalar(style)) + + def fetch_single(self): + self.fetch_flow_scalar(style='\'') + + def fetch_double(self): + self.fetch_flow_scalar(style='"') + + def fetch_flow_scalar(self, style): + + # A flow scalar could be a simple key. + self.save_possible_simple_key() + + # No simple keys after flow scalars. + self.allow_simple_key = False + + # Scan and add SCALAR. + self.tokens.append(self.scan_flow_scalar(style)) + + def fetch_plain(self): + + # A plain scalar could be a simple key. + self.save_possible_simple_key() + + # No simple keys after plain scalars. But note that `scan_plain` will + # change this flag if the scan is finished at the beginning of the + # line. + self.allow_simple_key = False + + # Scan and add SCALAR. May change `allow_simple_key`. + self.tokens.append(self.scan_plain()) + + # Checkers. + + def check_directive(self): + + # DIRECTIVE: ^ '%' ... + # The '%' indicator is already checked. + if self.column == 0: + return True + + def check_document_start(self): + + # DOCUMENT-START: ^ '---' (' '|'\n') + if self.column == 0: + if self.prefix(3) == '---' \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + return True + + def check_document_end(self): + + # DOCUMENT-END: ^ '...' (' '|'\n') + if self.column == 0: + if self.prefix(3) == '...' \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + return True + + def check_block_entry(self): + + # BLOCK-ENTRY: '-' (' '|'\n') + return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029' + + def check_key(self): + + # KEY(flow context): '?' + if self.flow_level: + return True + + # KEY(block context): '?' (' '|'\n') + else: + return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029' + + def check_value(self): + + # VALUE(flow context): ':' + if self.flow_level: + return True + + # VALUE(block context): ':' (' '|'\n') + else: + return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029' + + def check_plain(self): + + # A plain scalar may start with any non-space character except: + # '-', '?', ':', ',', '[', ']', '{', '}', + # '#', '&', '*', '!', '|', '>', '\'', '\"', + # '%', '@', '`'. + # + # It may also start with + # '-', '?', ':' + # if it is followed by a non-space character. + # + # Note that we limit the last rule to the block context (except the + # '-' character) because we want the flow context to be space + # independent. + ch = self.peek() + return ch not in '\0 \t\r\n\x85\u2028\u2029-?:,[]{}#&*!|>\'\"%@`' \ + or (self.peek(1) not in '\0 \t\r\n\x85\u2028\u2029' + and (ch == '-' or (not self.flow_level and ch in '?:'))) + + # Scanners. + + def scan_to_next_token(self): + # We ignore spaces, line breaks and comments. + # If we find a line break in the block context, we set the flag + # `allow_simple_key` on. + # The byte order mark is stripped if it's the first character in the + # stream. We do not yet support BOM inside the stream as the + # specification requires. Any such mark will be considered as a part + # of the document. + # + # TODO: We need to make tab handling rules more sane. A good rule is + # Tabs cannot precede tokens + # BLOCK-SEQUENCE-START, BLOCK-MAPPING-START, BLOCK-END, + # KEY(block), VALUE(block), BLOCK-ENTRY + # So the checking code is + # if : + # self.allow_simple_keys = False + # We also need to add the check for `allow_simple_keys == True` to + # `unwind_indent` before issuing BLOCK-END. + # Scanners for block, flow, and plain scalars need to be modified. + + if self.index == 0 and self.peek() == '\uFEFF': + self.forward() + found = False + while not found: + while self.peek() == ' ': + self.forward() + if self.peek() == '#': + while self.peek() not in '\0\r\n\x85\u2028\u2029': + self.forward() + if self.scan_line_break(): + if not self.flow_level: + self.allow_simple_key = True + else: + found = True + + def scan_directive(self): + # See the specification for details. + start_mark = self.get_mark() + self.forward() + name = self.scan_directive_name(start_mark) + value = None + if name == 'YAML': + value = self.scan_yaml_directive_value(start_mark) + end_mark = self.get_mark() + elif name == 'TAG': + value = self.scan_tag_directive_value(start_mark) + end_mark = self.get_mark() + else: + end_mark = self.get_mark() + while self.peek() not in '\0\r\n\x85\u2028\u2029': + self.forward() + self.scan_directive_ignored_line(start_mark) + return DirectiveToken(name, value, start_mark, end_mark) + + def scan_directive_name(self, start_mark): + # See the specification for details. + length = 0 + ch = self.peek(length) + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_': + length += 1 + ch = self.peek(length) + if not length: + raise ScannerError("while scanning a directive", start_mark, + "expected alphabetic or numeric character, but found %r" + % ch, self.get_mark()) + value = self.prefix(length) + self.forward(length) + ch = self.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a directive", start_mark, + "expected alphabetic or numeric character, but found %r" + % ch, self.get_mark()) + return value + + def scan_yaml_directive_value(self, start_mark): + # See the specification for details. + while self.peek() == ' ': + self.forward() + major = self.scan_yaml_directive_number(start_mark) + if self.peek() != '.': + raise ScannerError("while scanning a directive", start_mark, + "expected a digit or '.', but found %r" % self.peek(), + self.get_mark()) + self.forward() + minor = self.scan_yaml_directive_number(start_mark) + if self.peek() not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a directive", start_mark, + "expected a digit or ' ', but found %r" % self.peek(), + self.get_mark()) + return (major, minor) + + def scan_yaml_directive_number(self, start_mark): + # See the specification for details. + ch = self.peek() + if not ('0' <= ch <= '9'): + raise ScannerError("while scanning a directive", start_mark, + "expected a digit, but found %r" % ch, self.get_mark()) + length = 0 + while '0' <= self.peek(length) <= '9': + length += 1 + value = int(self.prefix(length)) + self.forward(length) + return value + + def scan_tag_directive_value(self, start_mark): + # See the specification for details. + while self.peek() == ' ': + self.forward() + handle = self.scan_tag_directive_handle(start_mark) + while self.peek() == ' ': + self.forward() + prefix = self.scan_tag_directive_prefix(start_mark) + return (handle, prefix) + + def scan_tag_directive_handle(self, start_mark): + # See the specification for details. + value = self.scan_tag_handle('directive', start_mark) + ch = self.peek() + if ch != ' ': + raise ScannerError("while scanning a directive", start_mark, + "expected ' ', but found %r" % ch, self.get_mark()) + return value + + def scan_tag_directive_prefix(self, start_mark): + # See the specification for details. + value = self.scan_tag_uri('directive', start_mark) + ch = self.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a directive", start_mark, + "expected ' ', but found %r" % ch, self.get_mark()) + return value + + def scan_directive_ignored_line(self, start_mark): + # See the specification for details. + while self.peek() == ' ': + self.forward() + if self.peek() == '#': + while self.peek() not in '\0\r\n\x85\u2028\u2029': + self.forward() + ch = self.peek() + if ch not in '\0\r\n\x85\u2028\u2029': + raise ScannerError("while scanning a directive", start_mark, + "expected a comment or a line break, but found %r" + % ch, self.get_mark()) + self.scan_line_break() + + def scan_anchor(self, TokenClass): + # The specification does not restrict characters for anchors and + # aliases. This may lead to problems, for instance, the document: + # [ *alias, value ] + # can be interpreted in two ways, as + # [ "value" ] + # and + # [ *alias , "value" ] + # Therefore we restrict aliases to numbers and ASCII letters. + start_mark = self.get_mark() + indicator = self.peek() + if indicator == '*': + name = 'alias' + else: + name = 'anchor' + self.forward() + length = 0 + ch = self.peek(length) + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_': + length += 1 + ch = self.peek(length) + if not length: + raise ScannerError("while scanning an %s" % name, start_mark, + "expected alphabetic or numeric character, but found %r" + % ch, self.get_mark()) + value = self.prefix(length) + self.forward(length) + ch = self.peek() + if ch not in '\0 \t\r\n\x85\u2028\u2029?:,]}%@`': + raise ScannerError("while scanning an %s" % name, start_mark, + "expected alphabetic or numeric character, but found %r" + % ch, self.get_mark()) + end_mark = self.get_mark() + return TokenClass(value, start_mark, end_mark) + + def scan_tag(self): + # See the specification for details. + start_mark = self.get_mark() + ch = self.peek(1) + if ch == '<': + handle = None + self.forward(2) + suffix = self.scan_tag_uri('tag', start_mark) + if self.peek() != '>': + raise ScannerError("while parsing a tag", start_mark, + "expected '>', but found %r" % self.peek(), + self.get_mark()) + self.forward() + elif ch in '\0 \t\r\n\x85\u2028\u2029': + handle = None + suffix = '!' + self.forward() + else: + length = 1 + use_handle = False + while ch not in '\0 \r\n\x85\u2028\u2029': + if ch == '!': + use_handle = True + break + length += 1 + ch = self.peek(length) + handle = '!' + if use_handle: + handle = self.scan_tag_handle('tag', start_mark) + else: + handle = '!' + self.forward() + suffix = self.scan_tag_uri('tag', start_mark) + ch = self.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a tag", start_mark, + "expected ' ', but found %r" % ch, self.get_mark()) + value = (handle, suffix) + end_mark = self.get_mark() + return TagToken(value, start_mark, end_mark) + + def scan_block_scalar(self, style): + # See the specification for details. + + if style == '>': + folded = True + else: + folded = False + + chunks = [] + start_mark = self.get_mark() + + # Scan the header. + self.forward() + chomping, increment = self.scan_block_scalar_indicators(start_mark) + self.scan_block_scalar_ignored_line(start_mark) + + # Determine the indentation level and go to the first non-empty line. + min_indent = self.indent+1 + if min_indent < 1: + min_indent = 1 + if increment is None: + breaks, max_indent, end_mark = self.scan_block_scalar_indentation() + indent = max(min_indent, max_indent) + else: + indent = min_indent+increment-1 + breaks, end_mark = self.scan_block_scalar_breaks(indent) + line_break = '' + + # Scan the inner part of the block scalar. + while self.column == indent and self.peek() != '\0': + chunks.extend(breaks) + leading_non_space = self.peek() not in ' \t' + length = 0 + while self.peek(length) not in '\0\r\n\x85\u2028\u2029': + length += 1 + chunks.append(self.prefix(length)) + self.forward(length) + line_break = self.scan_line_break() + breaks, end_mark = self.scan_block_scalar_breaks(indent) + if self.column == indent and self.peek() != '\0': + + # Unfortunately, folding rules are ambiguous. + # + # This is the folding according to the specification: + + if folded and line_break == '\n' \ + and leading_non_space and self.peek() not in ' \t': + if not breaks: + chunks.append(' ') + else: + chunks.append(line_break) + + # This is Clark Evans's interpretation (also in the spec + # examples): + # + #if folded and line_break == '\n': + # if not breaks: + # if self.peek() not in ' \t': + # chunks.append(' ') + # else: + # chunks.append(line_break) + #else: + # chunks.append(line_break) + else: + break + + # Chomp the tail. + if chomping is not False: + chunks.append(line_break) + if chomping is True: + chunks.extend(breaks) + + # We are done. + return ScalarToken(''.join(chunks), False, start_mark, end_mark, + style) + + def scan_block_scalar_indicators(self, start_mark): + # See the specification for details. + chomping = None + increment = None + ch = self.peek() + if ch in '+-': + if ch == '+': + chomping = True + else: + chomping = False + self.forward() + ch = self.peek() + if ch in '0123456789': + increment = int(ch) + if increment == 0: + raise ScannerError("while scanning a block scalar", start_mark, + "expected indentation indicator in the range 1-9, but found 0", + self.get_mark()) + self.forward() + elif ch in '0123456789': + increment = int(ch) + if increment == 0: + raise ScannerError("while scanning a block scalar", start_mark, + "expected indentation indicator in the range 1-9, but found 0", + self.get_mark()) + self.forward() + ch = self.peek() + if ch in '+-': + if ch == '+': + chomping = True + else: + chomping = False + self.forward() + ch = self.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a block scalar", start_mark, + "expected chomping or indentation indicators, but found %r" + % ch, self.get_mark()) + return chomping, increment + + def scan_block_scalar_ignored_line(self, start_mark): + # See the specification for details. + while self.peek() == ' ': + self.forward() + if self.peek() == '#': + while self.peek() not in '\0\r\n\x85\u2028\u2029': + self.forward() + ch = self.peek() + if ch not in '\0\r\n\x85\u2028\u2029': + raise ScannerError("while scanning a block scalar", start_mark, + "expected a comment or a line break, but found %r" % ch, + self.get_mark()) + self.scan_line_break() + + def scan_block_scalar_indentation(self): + # See the specification for details. + chunks = [] + max_indent = 0 + end_mark = self.get_mark() + while self.peek() in ' \r\n\x85\u2028\u2029': + if self.peek() != ' ': + chunks.append(self.scan_line_break()) + end_mark = self.get_mark() + else: + self.forward() + if self.column > max_indent: + max_indent = self.column + return chunks, max_indent, end_mark + + def scan_block_scalar_breaks(self, indent): + # See the specification for details. + chunks = [] + end_mark = self.get_mark() + while self.column < indent and self.peek() == ' ': + self.forward() + while self.peek() in '\r\n\x85\u2028\u2029': + chunks.append(self.scan_line_break()) + end_mark = self.get_mark() + while self.column < indent and self.peek() == ' ': + self.forward() + return chunks, end_mark + + def scan_flow_scalar(self, style): + # See the specification for details. + # Note that we loose indentation rules for quoted scalars. Quoted + # scalars don't need to adhere indentation because " and ' clearly + # mark the beginning and the end of them. Therefore we are less + # restrictive then the specification requires. We only need to check + # that document separators are not included in scalars. + if style == '"': + double = True + else: + double = False + chunks = [] + start_mark = self.get_mark() + quote = self.peek() + self.forward() + chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark)) + while self.peek() != quote: + chunks.extend(self.scan_flow_scalar_spaces(double, start_mark)) + chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark)) + self.forward() + end_mark = self.get_mark() + return ScalarToken(''.join(chunks), False, start_mark, end_mark, + style) + + ESCAPE_REPLACEMENTS = { + '0': '\0', + 'a': '\x07', + 'b': '\x08', + 't': '\x09', + '\t': '\x09', + 'n': '\x0A', + 'v': '\x0B', + 'f': '\x0C', + 'r': '\x0D', + 'e': '\x1B', + ' ': '\x20', + '\"': '\"', + '\\': '\\', + '/': '/', + 'N': '\x85', + '_': '\xA0', + 'L': '\u2028', + 'P': '\u2029', + } + + ESCAPE_CODES = { + 'x': 2, + 'u': 4, + 'U': 8, + } + + def scan_flow_scalar_non_spaces(self, double, start_mark): + # See the specification for details. + chunks = [] + while True: + length = 0 + while self.peek(length) not in '\'\"\\\0 \t\r\n\x85\u2028\u2029': + length += 1 + if length: + chunks.append(self.prefix(length)) + self.forward(length) + ch = self.peek() + if not double and ch == '\'' and self.peek(1) == '\'': + chunks.append('\'') + self.forward(2) + elif (double and ch == '\'') or (not double and ch in '\"\\'): + chunks.append(ch) + self.forward() + elif double and ch == '\\': + self.forward() + ch = self.peek() + if ch in self.ESCAPE_REPLACEMENTS: + chunks.append(self.ESCAPE_REPLACEMENTS[ch]) + self.forward() + elif ch in self.ESCAPE_CODES: + length = self.ESCAPE_CODES[ch] + self.forward() + for k in range(length): + if self.peek(k) not in '0123456789ABCDEFabcdef': + raise ScannerError("while scanning a double-quoted scalar", start_mark, + "expected escape sequence of %d hexadecimal numbers, but found %r" % + (length, self.peek(k)), self.get_mark()) + code = int(self.prefix(length), 16) + chunks.append(chr(code)) + self.forward(length) + elif ch in '\r\n\x85\u2028\u2029': + self.scan_line_break() + chunks.extend(self.scan_flow_scalar_breaks(double, start_mark)) + else: + raise ScannerError("while scanning a double-quoted scalar", start_mark, + "found unknown escape character %r" % ch, self.get_mark()) + else: + return chunks + + def scan_flow_scalar_spaces(self, double, start_mark): + # See the specification for details. + chunks = [] + length = 0 + while self.peek(length) in ' \t': + length += 1 + whitespaces = self.prefix(length) + self.forward(length) + ch = self.peek() + if ch == '\0': + raise ScannerError("while scanning a quoted scalar", start_mark, + "found unexpected end of stream", self.get_mark()) + elif ch in '\r\n\x85\u2028\u2029': + line_break = self.scan_line_break() + breaks = self.scan_flow_scalar_breaks(double, start_mark) + if line_break != '\n': + chunks.append(line_break) + elif not breaks: + chunks.append(' ') + chunks.extend(breaks) + else: + chunks.append(whitespaces) + return chunks + + def scan_flow_scalar_breaks(self, double, start_mark): + # See the specification for details. + chunks = [] + while True: + # Instead of checking indentation, we check for document + # separators. + prefix = self.prefix(3) + if (prefix == '---' or prefix == '...') \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + raise ScannerError("while scanning a quoted scalar", start_mark, + "found unexpected document separator", self.get_mark()) + while self.peek() in ' \t': + self.forward() + if self.peek() in '\r\n\x85\u2028\u2029': + chunks.append(self.scan_line_break()) + else: + return chunks + + def scan_plain(self): + # See the specification for details. + # We add an additional restriction for the flow context: + # plain scalars in the flow context cannot contain ',' or '?'. + # We also keep track of the `allow_simple_key` flag here. + # Indentation rules are loosed for the flow context. + chunks = [] + start_mark = self.get_mark() + end_mark = start_mark + indent = self.indent+1 + # We allow zero indentation for scalars, but then we need to check for + # document separators at the beginning of the line. + #if indent == 0: + # indent = 1 + spaces = [] + while True: + length = 0 + if self.peek() == '#': + break + while True: + ch = self.peek(length) + if ch in '\0 \t\r\n\x85\u2028\u2029' \ + or (ch == ':' and + self.peek(length+1) in '\0 \t\r\n\x85\u2028\u2029' + + (u',[]{}' if self.flow_level else u''))\ + or (self.flow_level and ch in ',?[]{}'): + break + length += 1 + if length == 0: + break + self.allow_simple_key = False + chunks.extend(spaces) + chunks.append(self.prefix(length)) + self.forward(length) + end_mark = self.get_mark() + spaces = self.scan_plain_spaces(indent, start_mark) + if not spaces or self.peek() == '#' \ + or (not self.flow_level and self.column < indent): + break + return ScalarToken(''.join(chunks), True, start_mark, end_mark) + + def scan_plain_spaces(self, indent, start_mark): + # See the specification for details. + # The specification is really confusing about tabs in plain scalars. + # We just forbid them completely. Do not use tabs in YAML! + chunks = [] + length = 0 + while self.peek(length) in ' ': + length += 1 + whitespaces = self.prefix(length) + self.forward(length) + ch = self.peek() + if ch in '\r\n\x85\u2028\u2029': + line_break = self.scan_line_break() + self.allow_simple_key = True + prefix = self.prefix(3) + if (prefix == '---' or prefix == '...') \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + return + breaks = [] + while self.peek() in ' \r\n\x85\u2028\u2029': + if self.peek() == ' ': + self.forward() + else: + breaks.append(self.scan_line_break()) + prefix = self.prefix(3) + if (prefix == '---' or prefix == '...') \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + return + if line_break != '\n': + chunks.append(line_break) + elif not breaks: + chunks.append(' ') + chunks.extend(breaks) + elif whitespaces: + chunks.append(whitespaces) + return chunks + + def scan_tag_handle(self, name, start_mark): + # See the specification for details. + # For some strange reasons, the specification does not allow '_' in + # tag handles. I have allowed it anyway. + ch = self.peek() + if ch != '!': + raise ScannerError("while scanning a %s" % name, start_mark, + "expected '!', but found %r" % ch, self.get_mark()) + length = 1 + ch = self.peek(length) + if ch != ' ': + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_': + length += 1 + ch = self.peek(length) + if ch != '!': + self.forward(length) + raise ScannerError("while scanning a %s" % name, start_mark, + "expected '!', but found %r" % ch, self.get_mark()) + length += 1 + value = self.prefix(length) + self.forward(length) + return value + + def scan_tag_uri(self, name, start_mark): + # See the specification for details. + # Note: we do not check if URI is well-formed. + chunks = [] + length = 0 + ch = self.peek(length) + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-;/?:@&=+$,_.!~*\'()[]%': + if ch == '%': + chunks.append(self.prefix(length)) + self.forward(length) + length = 0 + chunks.append(self.scan_uri_escapes(name, start_mark)) + else: + length += 1 + ch = self.peek(length) + if length: + chunks.append(self.prefix(length)) + self.forward(length) + length = 0 + if not chunks: + raise ScannerError("while parsing a %s" % name, start_mark, + "expected URI, but found %r" % ch, self.get_mark()) + return ''.join(chunks) + + def scan_uri_escapes(self, name, start_mark): + # See the specification for details. + codes = [] + mark = self.get_mark() + while self.peek() == '%': + self.forward() + for k in range(2): + if self.peek(k) not in '0123456789ABCDEFabcdef': + raise ScannerError("while scanning a %s" % name, start_mark, + "expected URI escape sequence of 2 hexadecimal numbers, but found %r" + % self.peek(k), self.get_mark()) + codes.append(int(self.prefix(2), 16)) + self.forward(2) + try: + value = bytes(codes).decode('utf-8') + except UnicodeDecodeError as exc: + raise ScannerError("while scanning a %s" % name, start_mark, str(exc), mark) + return value + + def scan_line_break(self): + # Transforms: + # '\r\n' : '\n' + # '\r' : '\n' + # '\n' : '\n' + # '\x85' : '\n' + # '\u2028' : '\u2028' + # '\u2029 : '\u2029' + # default : '' + ch = self.peek() + if ch in '\r\n\x85': + if self.prefix(2) == '\r\n': + self.forward(2) + else: + self.forward() + return '\n' + elif ch in '\u2028\u2029': + self.forward() + return ch + return '' diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/serializer.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/serializer.py new file mode 100644 index 0000000000000000000000000000000000000000..fe911e67ae7a739abb491fbbc6834b9c37bbda4b --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/serializer.py @@ -0,0 +1,111 @@ + +__all__ = ['Serializer', 'SerializerError'] + +from .error import YAMLError +from .events import * +from .nodes import * + +class SerializerError(YAMLError): + pass + +class Serializer: + + ANCHOR_TEMPLATE = 'id%03d' + + def __init__(self, encoding=None, + explicit_start=None, explicit_end=None, version=None, tags=None): + self.use_encoding = encoding + self.use_explicit_start = explicit_start + self.use_explicit_end = explicit_end + self.use_version = version + self.use_tags = tags + self.serialized_nodes = {} + self.anchors = {} + self.last_anchor_id = 0 + self.closed = None + + def open(self): + if self.closed is None: + self.emit(StreamStartEvent(encoding=self.use_encoding)) + self.closed = False + elif self.closed: + raise SerializerError("serializer is closed") + else: + raise SerializerError("serializer is already opened") + + def close(self): + if self.closed is None: + raise SerializerError("serializer is not opened") + elif not self.closed: + self.emit(StreamEndEvent()) + self.closed = True + + #def __del__(self): + # self.close() + + def serialize(self, node): + if self.closed is None: + raise SerializerError("serializer is not opened") + elif self.closed: + raise SerializerError("serializer is closed") + self.emit(DocumentStartEvent(explicit=self.use_explicit_start, + version=self.use_version, tags=self.use_tags)) + self.anchor_node(node) + self.serialize_node(node, None, None) + self.emit(DocumentEndEvent(explicit=self.use_explicit_end)) + self.serialized_nodes = {} + self.anchors = {} + self.last_anchor_id = 0 + + def anchor_node(self, node): + if node in self.anchors: + if self.anchors[node] is None: + self.anchors[node] = self.generate_anchor(node) + else: + self.anchors[node] = None + if isinstance(node, SequenceNode): + for item in node.value: + self.anchor_node(item) + elif isinstance(node, MappingNode): + for key, value in node.value: + self.anchor_node(key) + self.anchor_node(value) + + def generate_anchor(self, node): + self.last_anchor_id += 1 + return self.ANCHOR_TEMPLATE % self.last_anchor_id + + def serialize_node(self, node, parent, index): + alias = self.anchors[node] + if node in self.serialized_nodes: + self.emit(AliasEvent(alias)) + else: + self.serialized_nodes[node] = True + self.descend_resolver(parent, index) + if isinstance(node, ScalarNode): + detected_tag = self.resolve(ScalarNode, node.value, (True, False)) + default_tag = self.resolve(ScalarNode, node.value, (False, True)) + implicit = (node.tag == detected_tag), (node.tag == default_tag) + self.emit(ScalarEvent(alias, node.tag, implicit, node.value, + style=node.style)) + elif isinstance(node, SequenceNode): + implicit = (node.tag + == self.resolve(SequenceNode, node.value, True)) + self.emit(SequenceStartEvent(alias, node.tag, implicit, + flow_style=node.flow_style)) + index = 0 + for item in node.value: + self.serialize_node(item, node, index) + index += 1 + self.emit(SequenceEndEvent()) + elif isinstance(node, MappingNode): + implicit = (node.tag + == self.resolve(MappingNode, node.value, True)) + self.emit(MappingStartEvent(alias, node.tag, implicit, + flow_style=node.flow_style)) + for key, value in node.value: + self.serialize_node(key, node, None) + self.serialize_node(value, node, key) + self.emit(MappingEndEvent()) + self.ascend_resolver() + diff --git a/TTS/Kokoro/.venv/Lib/site-packages/yaml/tokens.py b/TTS/Kokoro/.venv/Lib/site-packages/yaml/tokens.py new file mode 100644 index 0000000000000000000000000000000000000000..4d0b48a394ac8c019b401516a12f688df361cf90 --- /dev/null +++ b/TTS/Kokoro/.venv/Lib/site-packages/yaml/tokens.py @@ -0,0 +1,104 @@ + +class Token(object): + def __init__(self, start_mark, end_mark): + self.start_mark = start_mark + self.end_mark = end_mark + def __repr__(self): + attributes = [key for key in self.__dict__ + if not key.endswith('_mark')] + attributes.sort() + arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) + for key in attributes]) + return '%s(%s)' % (self.__class__.__name__, arguments) + +#class BOMToken(Token): +# id = '' + +class DirectiveToken(Token): + id = '' + def __init__(self, name, value, start_mark, end_mark): + self.name = name + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + +class DocumentStartToken(Token): + id = '' + +class DocumentEndToken(Token): + id = '' + +class StreamStartToken(Token): + id = '' + def __init__(self, start_mark=None, end_mark=None, + encoding=None): + self.start_mark = start_mark + self.end_mark = end_mark + self.encoding = encoding + +class StreamEndToken(Token): + id = '' + +class BlockSequenceStartToken(Token): + id = '' + +class BlockMappingStartToken(Token): + id = '' + +class BlockEndToken(Token): + id = '' + +class FlowSequenceStartToken(Token): + id = '[' + +class FlowMappingStartToken(Token): + id = '{' + +class FlowSequenceEndToken(Token): + id = ']' + +class FlowMappingEndToken(Token): + id = '}' + +class KeyToken(Token): + id = '?' + +class ValueToken(Token): + id = ':' + +class BlockEntryToken(Token): + id = '-' + +class FlowEntryToken(Token): + id = ',' + +class AliasToken(Token): + id = '' + def __init__(self, value, start_mark, end_mark): + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + +class AnchorToken(Token): + id = '' + def __init__(self, value, start_mark, end_mark): + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + +class TagToken(Token): + id = '' + def __init__(self, value, start_mark, end_mark): + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + +class ScalarToken(Token): + id = '' + def __init__(self, value, plain, start_mark, end_mark, style=None): + self.value = value + self.plain = plain + self.start_mark = start_mark + self.end_mark = end_mark + self.style = style +